@harbour-enterprises/superdoc 0.22.0-next.1 → 0.22.0-next.11
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.
- package/dist/chunks/{PdfViewer-BpwMPbUj.es.js → PdfViewer-CS3pY_UR.es.js} +1 -1
- package/dist/chunks/{PdfViewer-B3KmcDup.cjs → PdfViewer-Cz3fT1qt.cjs} +1 -1
- package/dist/chunks/{index-Cw4YywoD.es.js → index-Bbqhu9ev.es.js} +53 -26
- package/dist/chunks/{index-BOf6E2I4.cjs → index-p73XAt11.cjs} +53 -26
- package/dist/chunks/{super-editor.es-DHDx2fsy.cjs → super-editor.es-CFD0lcOY.cjs} +3201 -2009
- package/dist/chunks/{super-editor.es-vfoWxyZL.es.js → super-editor.es-DK3l03fz.es.js} +3201 -2009
- package/dist/core/SuperDoc.d.ts +5 -0
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/core/types/index.d.ts +4 -4
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/stores/comments-store.d.ts +4 -1
- package/dist/stores/comments-store.d.ts.map +1 -1
- package/dist/style.css +51 -44
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-BcqEfCTg.js → converter-DFDRdFEB.js} +1880 -1169
- package/dist/super-editor/chunks/{docx-zipper-DZ9ph0iQ.js → docx-zipper-CplUdgI9.js} +73 -12
- package/dist/super-editor/chunks/{editor-BC2sSIVa.js → editor-BnpIdTLI.js} +1492 -1061
- package/dist/super-editor/chunks/{toolbar-DNTo5DDf.js → toolbar-5h-ljJ_h.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/src/core/DocxZipper.d.ts +1 -1
- package/dist/super-editor/src/core/helpers/generateDocxRandomId.d.ts +5 -0
- package/dist/super-editor/src/core/super-converter/SuperConverter.d.ts +1 -13
- package/dist/super-editor/src/core/super-converter/exporter.d.ts +5 -4
- package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/hyperlink-preprocessor.d.ts +9 -0
- package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/num-pages-preprocessor.d.ts +9 -0
- package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/page-preprocessor.d.ts +9 -0
- package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/page-ref-preprocessor.d.ts +9 -0
- package/dist/super-editor/src/core/super-converter/field-references/fld-preprocessors/toc-preprocessor.d.ts +8 -0
- package/dist/super-editor/src/core/super-converter/field-references/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/field-references/preProcessNodesForFldChar.d.ts +21 -0
- package/dist/super-editor/src/core/super-converter/helpers/tableFallbackHelpers.d.ts +24 -0
- package/dist/super-editor/src/core/super-converter/v2/exporter/helpers/translateChildNodes.d.ts +3 -3
- package/dist/super-editor/src/core/super-converter/v2/importer/pageReferenceImporter.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v2/importer/tableOfContentsImporter.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v2/types/index.d.ts +7 -1
- package/dist/super-editor/src/core/super-converter/v3/handlers/sd/pageReference/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/sd/pageReference/pageReference-translator.d.ts +7 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/sd/tableOfContents/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/sd/tableOfContents/tableOfContents-translator.d.ts +10 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/caps/caps-translator.d.ts +7 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/p/helpers/w-p-helpers.d.ts +0 -2
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/handle-doc-part-obj.d.ts +9 -1
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/translate-document-part-obj.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/node-translator/node-translator.d.ts +2 -2
- package/dist/super-editor/src/extensions/custom-selection/custom-selection.d.ts +5 -1
- package/dist/super-editor/src/extensions/index.d.ts +2 -1
- package/dist/super-editor/src/extensions/page-reference/index.d.ts +1 -0
- package/dist/super-editor/src/extensions/page-reference/page-reference.d.ts +2 -0
- package/dist/super-editor/src/extensions/structured-content/document-part-object.d.ts +2 -0
- package/dist/super-editor/src/extensions/structured-content/index.d.ts +2 -0
- package/dist/super-editor/src/extensions/structured-content/structured-content-commands.d.ts +67 -0
- package/dist/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentBlockTags.d.ts +6 -0
- package/dist/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentInlineTags.d.ts +6 -0
- package/dist/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentTags.d.ts +6 -0
- package/dist/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentTagsById.d.ts +7 -0
- package/dist/super-editor/src/extensions/structured-content/structuredContentHelpers/index.d.ts +4 -0
- package/dist/super-editor/src/extensions/tab/helpers/tabDecorations.d.ts +2 -2
- package/dist/super-editor/src/extensions/table-of-contents/index.d.ts +1 -0
- package/dist/super-editor/src/extensions/table-of-contents/table-of-contents.d.ts +2 -0
- package/dist/super-editor/src/utils/contextmenu-helpers.d.ts +24 -0
- package/dist/super-editor/style.css +7 -0
- package/dist/super-editor/super-editor.es.js +11 -17
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +3245 -2026
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/super-editor/src/components/slash-menu/contextmenu-helpers.d.ts +0 -1
|
@@ -14986,6 +14986,10 @@ function generateDocxRandomId(length = 8) {
|
|
|
14986
14986
|
}
|
|
14987
14987
|
return id.join("");
|
|
14988
14988
|
}
|
|
14989
|
+
function generateRandomSigned32BitIntStrId() {
|
|
14990
|
+
const val = Math.floor(Math.random() * 2147483647);
|
|
14991
|
+
return val.toString();
|
|
14992
|
+
}
|
|
14989
14993
|
function generateRandom32BitHex() {
|
|
14990
14994
|
const val = Math.floor(Math.random() * 2147483647);
|
|
14991
14995
|
return val.toString(16).toUpperCase().padStart(8, "0");
|
|
@@ -22564,6 +22568,7 @@ const helpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
22564
22568
|
generateDocxListAttributes,
|
|
22565
22569
|
generateDocxRandomId,
|
|
22566
22570
|
generateRandom32BitHex,
|
|
22571
|
+
generateRandomSigned32BitIntStrId,
|
|
22567
22572
|
getActiveFormatting,
|
|
22568
22573
|
getExtensionConfigField,
|
|
22569
22574
|
getMarkRange,
|
|
@@ -22961,13 +22966,56 @@ function translateChildNodes(params) {
|
|
|
22961
22966
|
const { content: nodes } = params.node;
|
|
22962
22967
|
if (!nodes) return [];
|
|
22963
22968
|
const translatedNodes = [];
|
|
22964
|
-
|
|
22969
|
+
const hyperlinkGroup = [];
|
|
22970
|
+
let index = 0;
|
|
22971
|
+
while (index < nodes.length) {
|
|
22972
|
+
const node = nodes[index];
|
|
22973
|
+
const linkMark = _isLinkNode(node);
|
|
22974
|
+
if (linkMark) {
|
|
22975
|
+
hyperlinkGroup.push(node);
|
|
22976
|
+
const nextNode = index + 1 < nodes.length ? nodes[index + 1] : null;
|
|
22977
|
+
const nextIsLink = _isLinkNode(nextNode, linkMark);
|
|
22978
|
+
if (nextIsLink) {
|
|
22979
|
+
index++;
|
|
22980
|
+
continue;
|
|
22981
|
+
} else {
|
|
22982
|
+
let translatedLinkGroup = exportSchemaToJson({
|
|
22983
|
+
...params,
|
|
22984
|
+
node: hyperlinkGroup[0],
|
|
22985
|
+
extraParams: { ...params.extraParams || {}, hyperlinkGroup: hyperlinkGroup.slice() }
|
|
22986
|
+
});
|
|
22987
|
+
if (translatedLinkGroup instanceof Array) translatedNodes.push(...translatedLinkGroup);
|
|
22988
|
+
else translatedNodes.push(translatedLinkGroup);
|
|
22989
|
+
hyperlinkGroup.length = 0;
|
|
22990
|
+
index++;
|
|
22991
|
+
continue;
|
|
22992
|
+
}
|
|
22993
|
+
}
|
|
22965
22994
|
let translatedNode = exportSchemaToJson({ ...params, node });
|
|
22966
22995
|
if (translatedNode instanceof Array) translatedNodes.push(...translatedNode);
|
|
22967
22996
|
else translatedNodes.push(translatedNode);
|
|
22968
|
-
|
|
22997
|
+
index++;
|
|
22998
|
+
}
|
|
22969
22999
|
return translatedNodes.filter((n) => n);
|
|
22970
23000
|
}
|
|
23001
|
+
function _isLinkNode(node, referenceMark = null) {
|
|
23002
|
+
if (!node || !node.marks && !node.attrs?.marksAsAttrs) return null;
|
|
23003
|
+
const marks = node.marks || node.attrs.marksAsAttrs;
|
|
23004
|
+
const linkMark = marks.find((mark) => mark.type === "link");
|
|
23005
|
+
if (!linkMark) return null;
|
|
23006
|
+
if (referenceMark) {
|
|
23007
|
+
return _isSameLinkMark(linkMark.attrs, referenceMark.attrs) ? linkMark : null;
|
|
23008
|
+
}
|
|
23009
|
+
return linkMark;
|
|
23010
|
+
}
|
|
23011
|
+
function _isSameLinkMark(attrsA, attrsB) {
|
|
23012
|
+
for (let key of ["anchor", "docLocation", "history", "href", "rId", "target"]) {
|
|
23013
|
+
if (attrsA[key] != attrsB[key]) {
|
|
23014
|
+
return false;
|
|
23015
|
+
}
|
|
23016
|
+
}
|
|
23017
|
+
return true;
|
|
23018
|
+
}
|
|
22971
23019
|
const baseNumbering = {
|
|
22972
23020
|
declaration: {
|
|
22973
23021
|
attributes: {
|
|
@@ -24323,37 +24371,37 @@ const _NodeTranslator = class _NodeTranslator {
|
|
|
24323
24371
|
/** @type {typeof TranslatorTypes} */
|
|
24324
24372
|
__publicField(_NodeTranslator, "translatorTypes", TranslatorTypes);
|
|
24325
24373
|
let NodeTranslator = _NodeTranslator;
|
|
24326
|
-
const encode$
|
|
24374
|
+
const encode$1b = (attributes) => {
|
|
24327
24375
|
return attributes["w:type"];
|
|
24328
24376
|
};
|
|
24329
|
-
const decode
|
|
24377
|
+
const decode$11 = (attrs) => {
|
|
24330
24378
|
const { lineBreakType } = attrs;
|
|
24331
24379
|
return lineBreakType;
|
|
24332
24380
|
};
|
|
24333
24381
|
const attrConfig$F = Object.freeze({
|
|
24334
24382
|
xmlName: "w:type",
|
|
24335
24383
|
sdName: "lineBreakType",
|
|
24336
|
-
encode: encode$
|
|
24337
|
-
decode: decode
|
|
24384
|
+
encode: encode$1b,
|
|
24385
|
+
decode: decode$11
|
|
24338
24386
|
});
|
|
24339
|
-
const encode$
|
|
24387
|
+
const encode$1a = (attributes) => {
|
|
24340
24388
|
const xmlAttrValue = attributes["w:clear"];
|
|
24341
24389
|
return xmlAttrValue;
|
|
24342
24390
|
};
|
|
24343
|
-
const decode$
|
|
24391
|
+
const decode$10 = (attrs) => {
|
|
24344
24392
|
const { clear } = attrs;
|
|
24345
24393
|
return clear;
|
|
24346
24394
|
};
|
|
24347
24395
|
const attrConfig$E = Object.freeze({
|
|
24348
24396
|
xmlName: "w:clear",
|
|
24349
24397
|
sdName: "clear",
|
|
24350
|
-
encode: encode$
|
|
24351
|
-
decode: decode$
|
|
24398
|
+
encode: encode$1a,
|
|
24399
|
+
decode: decode$10
|
|
24352
24400
|
});
|
|
24353
24401
|
const validXmlAttributes$m = [attrConfig$F, attrConfig$E];
|
|
24354
|
-
const XML_NODE_NAME$
|
|
24355
|
-
const SD_NODE_NAME$
|
|
24356
|
-
const encode$
|
|
24402
|
+
const XML_NODE_NAME$x = "w:br";
|
|
24403
|
+
const SD_NODE_NAME$f = "lineBreak";
|
|
24404
|
+
const encode$19 = (_2, encodedAttrs) => {
|
|
24357
24405
|
const isPageBreak = encodedAttrs?.lineBreakType === "page";
|
|
24358
24406
|
const translated = {
|
|
24359
24407
|
type: isPageBreak ? "hardBreak" : "lineBreak"
|
|
@@ -24363,7 +24411,7 @@ const encode$16 = (_2, encodedAttrs) => {
|
|
|
24363
24411
|
}
|
|
24364
24412
|
return translated;
|
|
24365
24413
|
};
|
|
24366
|
-
const decode
|
|
24414
|
+
const decode$$ = (params, decodedAttrs) => {
|
|
24367
24415
|
const { node } = params;
|
|
24368
24416
|
if (!node) return;
|
|
24369
24417
|
const wBreak = { name: "w:br" };
|
|
@@ -24380,39 +24428,39 @@ const decode$Z = (params, decodedAttrs) => {
|
|
|
24380
24428
|
};
|
|
24381
24429
|
return translated;
|
|
24382
24430
|
};
|
|
24383
|
-
const config$
|
|
24384
|
-
xmlName: XML_NODE_NAME$
|
|
24385
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
24431
|
+
const config$v = {
|
|
24432
|
+
xmlName: XML_NODE_NAME$x,
|
|
24433
|
+
sdNodeOrKeyName: SD_NODE_NAME$f,
|
|
24386
24434
|
type: NodeTranslator.translatorTypes.NODE,
|
|
24387
|
-
encode: encode$
|
|
24388
|
-
decode: decode
|
|
24435
|
+
encode: encode$19,
|
|
24436
|
+
decode: decode$$,
|
|
24389
24437
|
attributes: validXmlAttributes$m
|
|
24390
24438
|
};
|
|
24391
|
-
const translator$
|
|
24392
|
-
const encode$
|
|
24393
|
-
const decode$
|
|
24439
|
+
const translator$19 = NodeTranslator.from(config$v);
|
|
24440
|
+
const encode$18 = (attributes) => attributes?.["w:val"];
|
|
24441
|
+
const decode$_ = (attrs) => attrs?.highlight;
|
|
24394
24442
|
const attrConfig$D = Object.freeze({
|
|
24395
24443
|
xmlName: "w:val",
|
|
24396
24444
|
sdName: "highlight",
|
|
24397
|
-
encode: encode$
|
|
24398
|
-
decode: decode$
|
|
24445
|
+
encode: encode$18,
|
|
24446
|
+
decode: decode$_
|
|
24399
24447
|
});
|
|
24400
24448
|
const validXmlAttributes$l = [attrConfig$D];
|
|
24401
|
-
const XML_NODE_NAME$
|
|
24402
|
-
const SD_ATTR_KEY$
|
|
24449
|
+
const XML_NODE_NAME$w = "w:highlight";
|
|
24450
|
+
const SD_ATTR_KEY$g = "highlight";
|
|
24403
24451
|
const DISABLED_TOKENS = /* @__PURE__ */ new Set(["transparent", "none", "inherit"]);
|
|
24404
|
-
const encode$
|
|
24452
|
+
const encode$17 = (params, encodedAttrs = {}) => {
|
|
24405
24453
|
const { nodes } = params;
|
|
24406
24454
|
const node = nodes?.[0];
|
|
24407
24455
|
const value = encodedAttrs.highlight ?? node?.attributes?.["w:val"];
|
|
24408
24456
|
return {
|
|
24409
24457
|
type: "attr",
|
|
24410
|
-
xmlName: XML_NODE_NAME$
|
|
24411
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
24458
|
+
xmlName: XML_NODE_NAME$w,
|
|
24459
|
+
sdNodeOrKeyName: SD_ATTR_KEY$g,
|
|
24412
24460
|
attributes: { "w:val": value ?? null }
|
|
24413
24461
|
};
|
|
24414
24462
|
};
|
|
24415
|
-
const decode$
|
|
24463
|
+
const decode$Z = (params) => {
|
|
24416
24464
|
const attrs = params?.node?.attrs || {};
|
|
24417
24465
|
const highlightValue = attrs.highlight ?? attrs.color ?? null;
|
|
24418
24466
|
if (!highlightValue) return void 0;
|
|
@@ -24420,14 +24468,14 @@ const decode$X = (params) => {
|
|
|
24420
24468
|
if (!normalizedValue) return void 0;
|
|
24421
24469
|
if (DISABLED_TOKENS.has(normalizedValue)) {
|
|
24422
24470
|
return {
|
|
24423
|
-
name: XML_NODE_NAME$
|
|
24471
|
+
name: XML_NODE_NAME$w,
|
|
24424
24472
|
attributes: { "w:val": "none" }
|
|
24425
24473
|
};
|
|
24426
24474
|
}
|
|
24427
24475
|
const keyword = getDocxHighlightKeywordFromHex(highlightValue);
|
|
24428
24476
|
if (keyword) {
|
|
24429
24477
|
return {
|
|
24430
|
-
name: XML_NODE_NAME$
|
|
24478
|
+
name: XML_NODE_NAME$w,
|
|
24431
24479
|
attributes: { "w:val": keyword }
|
|
24432
24480
|
};
|
|
24433
24481
|
}
|
|
@@ -24442,63 +24490,63 @@ const decode$X = (params) => {
|
|
|
24442
24490
|
}
|
|
24443
24491
|
};
|
|
24444
24492
|
};
|
|
24445
|
-
const config$
|
|
24446
|
-
xmlName: XML_NODE_NAME$
|
|
24447
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
24493
|
+
const config$u = {
|
|
24494
|
+
xmlName: XML_NODE_NAME$w,
|
|
24495
|
+
sdNodeOrKeyName: SD_ATTR_KEY$g,
|
|
24448
24496
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
24449
|
-
encode: encode$
|
|
24450
|
-
decode: decode$
|
|
24497
|
+
encode: encode$17,
|
|
24498
|
+
decode: decode$Z,
|
|
24451
24499
|
attributes: validXmlAttributes$l
|
|
24452
24500
|
};
|
|
24453
|
-
const translator$
|
|
24454
|
-
const encode$
|
|
24501
|
+
const translator$18 = NodeTranslator.from(config$u);
|
|
24502
|
+
const encode$16 = (attributes) => {
|
|
24455
24503
|
return attributes["w:val"];
|
|
24456
24504
|
};
|
|
24457
|
-
const decode$
|
|
24505
|
+
const decode$Y = (attrs) => {
|
|
24458
24506
|
const { tabSize } = attrs || {};
|
|
24459
24507
|
return tabSize;
|
|
24460
24508
|
};
|
|
24461
24509
|
const attrConfig$C = Object.freeze({
|
|
24462
24510
|
xmlName: "w:val",
|
|
24463
24511
|
sdName: "tabSize",
|
|
24464
|
-
encode: encode$
|
|
24465
|
-
decode: decode$
|
|
24512
|
+
encode: encode$16,
|
|
24513
|
+
decode: decode$Y
|
|
24466
24514
|
});
|
|
24467
|
-
const encode$
|
|
24515
|
+
const encode$15 = (attributes) => {
|
|
24468
24516
|
return attributes["w:leader"];
|
|
24469
24517
|
};
|
|
24470
|
-
const decode$
|
|
24518
|
+
const decode$X = (attrs) => {
|
|
24471
24519
|
const { leader } = attrs || {};
|
|
24472
24520
|
return leader;
|
|
24473
24521
|
};
|
|
24474
24522
|
const attrConfig$B = Object.freeze({
|
|
24475
24523
|
xmlName: "w:leader",
|
|
24476
24524
|
sdName: "leader",
|
|
24477
|
-
encode: encode$
|
|
24478
|
-
decode: decode$
|
|
24525
|
+
encode: encode$15,
|
|
24526
|
+
decode: decode$X
|
|
24479
24527
|
});
|
|
24480
|
-
const encode$
|
|
24528
|
+
const encode$14 = (attributes) => {
|
|
24481
24529
|
return attributes["w:pos"];
|
|
24482
24530
|
};
|
|
24483
|
-
const decode$
|
|
24531
|
+
const decode$W = (attrs) => {
|
|
24484
24532
|
const { pos } = attrs || {};
|
|
24485
24533
|
return pos;
|
|
24486
24534
|
};
|
|
24487
24535
|
const attrConfig$A = Object.freeze({
|
|
24488
24536
|
xmlName: "w:pos",
|
|
24489
24537
|
sdName: "pos",
|
|
24490
|
-
encode: encode$
|
|
24491
|
-
decode: decode$
|
|
24538
|
+
encode: encode$14,
|
|
24539
|
+
decode: decode$W
|
|
24492
24540
|
});
|
|
24493
24541
|
const validXmlAttributes$k = [attrConfig$C, attrConfig$A, attrConfig$B];
|
|
24494
|
-
const XML_NODE_NAME$
|
|
24495
|
-
const SD_NODE_NAME$
|
|
24496
|
-
const encode$
|
|
24542
|
+
const XML_NODE_NAME$v = "w:tab";
|
|
24543
|
+
const SD_NODE_NAME$e = "tab";
|
|
24544
|
+
const encode$13 = (_2, encodedAttrs = {}) => {
|
|
24497
24545
|
const translated = { type: "tab" };
|
|
24498
24546
|
if (encodedAttrs) translated.attrs = { ...encodedAttrs };
|
|
24499
24547
|
return translated;
|
|
24500
24548
|
};
|
|
24501
|
-
const decode$
|
|
24549
|
+
const decode$V = (params, decodedAttrs = {}) => {
|
|
24502
24550
|
const { node } = params || {};
|
|
24503
24551
|
if (!node) return;
|
|
24504
24552
|
const wTab = { name: "w:tab" };
|
|
@@ -24514,15 +24562,15 @@ const decode$T = (params, decodedAttrs = {}) => {
|
|
|
24514
24562
|
}
|
|
24515
24563
|
return translated;
|
|
24516
24564
|
};
|
|
24517
|
-
const config$
|
|
24518
|
-
xmlName: XML_NODE_NAME$
|
|
24519
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
24565
|
+
const config$t = {
|
|
24566
|
+
xmlName: XML_NODE_NAME$v,
|
|
24567
|
+
sdNodeOrKeyName: SD_NODE_NAME$e,
|
|
24520
24568
|
type: NodeTranslator.translatorTypes.NODE,
|
|
24521
|
-
encode: encode$
|
|
24522
|
-
decode: decode$
|
|
24569
|
+
encode: encode$13,
|
|
24570
|
+
decode: decode$V,
|
|
24523
24571
|
attributes: validXmlAttributes$k
|
|
24524
24572
|
};
|
|
24525
|
-
const translator$
|
|
24573
|
+
const translator$17 = NodeTranslator.from(config$t);
|
|
24526
24574
|
const mergeTextNodes = (nodes) => {
|
|
24527
24575
|
if (!nodes || !Array.isArray(nodes)) {
|
|
24528
24576
|
return nodes;
|
|
@@ -24846,17 +24894,16 @@ const getParagraphSpacing = (node, docx, styleId = "", marks = [], options = {})
|
|
|
24846
24894
|
};
|
|
24847
24895
|
const getDefaultParagraphStyle = (docx, styleId = "") => {
|
|
24848
24896
|
const styles = docx["word/styles.xml"];
|
|
24849
|
-
|
|
24897
|
+
const rootElements = styles?.elements?.[0]?.elements;
|
|
24898
|
+
if (!rootElements?.length) {
|
|
24850
24899
|
return {};
|
|
24851
24900
|
}
|
|
24852
|
-
const defaults =
|
|
24853
|
-
const pDefault = defaults
|
|
24901
|
+
const defaults = rootElements.find((el) => el.name === "w:docDefaults");
|
|
24902
|
+
const pDefault = defaults?.elements?.find((el) => el.name === "w:pPrDefault") || {};
|
|
24854
24903
|
const pPrDefault = pDefault?.elements?.find((el) => el.name === "w:pPr");
|
|
24855
24904
|
const pPrDefaultSpacingTag = pPrDefault?.elements?.find((el) => el.name === "w:spacing") || {};
|
|
24856
24905
|
const pPrDefaultIndentTag = pPrDefault?.elements?.find((el) => el.name === "w:ind") || {};
|
|
24857
|
-
const stylesNormal =
|
|
24858
|
-
(el) => el.name === "w:style" && el.attributes["w:styleId"] === "Normal"
|
|
24859
|
-
);
|
|
24906
|
+
const stylesNormal = rootElements.find((el) => el.name === "w:style" && el.attributes["w:styleId"] === "Normal");
|
|
24860
24907
|
const pPrNormal = stylesNormal?.elements?.find((el) => el.name === "w:pPr");
|
|
24861
24908
|
const pPrNormalSpacingTag = pPrNormal?.elements?.find((el) => el.name === "w:spacing") || {};
|
|
24862
24909
|
const pPrNormalIndentTag = pPrNormal?.elements?.find((el) => el.name === "w:ind") || {};
|
|
@@ -24865,9 +24912,7 @@ const getDefaultParagraphStyle = (docx, styleId = "") => {
|
|
|
24865
24912
|
let pPrStyleIdIndentTag = {};
|
|
24866
24913
|
let pPrStyleJc = {};
|
|
24867
24914
|
if (styleId) {
|
|
24868
|
-
const stylesById =
|
|
24869
|
-
(el) => el.name === "w:style" && el.attributes["w:styleId"] === styleId
|
|
24870
|
-
);
|
|
24915
|
+
const stylesById = rootElements.find((el) => el.name === "w:style" && el.attributes["w:styleId"] === styleId);
|
|
24871
24916
|
const pPrById = stylesById?.elements?.find((el) => el.name === "w:pPr");
|
|
24872
24917
|
pPrStyleIdSpacingTag = pPrById?.elements?.find((el) => el.name === "w:spacing") || {};
|
|
24873
24918
|
pPrStyleIdIndentTag = pPrById?.elements?.find((el) => el.name === "w:ind") || {};
|
|
@@ -24899,104 +24944,10 @@ const getDefaultParagraphStyle = (docx, styleId = "") => {
|
|
|
24899
24944
|
justify: pPrByIdJcAttr
|
|
24900
24945
|
};
|
|
24901
24946
|
};
|
|
24902
|
-
const preProcessNodesForFldChar = (nodes = []) => {
|
|
24903
|
-
const processedNodes = [];
|
|
24904
|
-
let buffer2 = [];
|
|
24905
|
-
let collecting = false;
|
|
24906
|
-
for (const node of nodes) {
|
|
24907
|
-
const fldCharEl = node.elements?.find((el) => el.name === "w:fldChar");
|
|
24908
|
-
const fldType = fldCharEl?.attributes?.["w:fldCharType"];
|
|
24909
|
-
if (fldType === "begin") {
|
|
24910
|
-
buffer2 = [node];
|
|
24911
|
-
collecting = true;
|
|
24912
|
-
continue;
|
|
24913
|
-
}
|
|
24914
|
-
if (fldType === "separate" && collecting) {
|
|
24915
|
-
buffer2.push(node);
|
|
24916
|
-
continue;
|
|
24917
|
-
}
|
|
24918
|
-
if (fldType === "end" && collecting) {
|
|
24919
|
-
buffer2.push(node);
|
|
24920
|
-
processedNodes.push(...processCombinedNodesForFldChar(buffer2));
|
|
24921
|
-
buffer2 = [];
|
|
24922
|
-
collecting = false;
|
|
24923
|
-
continue;
|
|
24924
|
-
}
|
|
24925
|
-
if (collecting) {
|
|
24926
|
-
buffer2.push(node);
|
|
24927
|
-
} else {
|
|
24928
|
-
processedNodes.push(node);
|
|
24929
|
-
}
|
|
24930
|
-
}
|
|
24931
|
-
if (buffer2.length) {
|
|
24932
|
-
processedNodes.push(...buffer2);
|
|
24933
|
-
}
|
|
24934
|
-
return processedNodes;
|
|
24935
|
-
};
|
|
24936
|
-
const processCombinedNodesForFldChar = (nodesToCombine = []) => {
|
|
24937
|
-
let processedNodes = [];
|
|
24938
|
-
let hasPageMarker = false;
|
|
24939
|
-
let isNumPages = false;
|
|
24940
|
-
const textStart = nodesToCombine.findIndex(
|
|
24941
|
-
(n) => n.elements?.some((el) => el.name === "w:fldChar" && el.attributes["w:fldCharType"] === "separate")
|
|
24942
|
-
);
|
|
24943
|
-
const textEnd = nodesToCombine.findIndex(
|
|
24944
|
-
(n) => n.elements?.some((el) => el.name === "w:fldChar" && el.attributes["w:fldCharType"] === "end")
|
|
24945
|
-
);
|
|
24946
|
-
const textNodes = nodesToCombine.slice(textStart + 1, textEnd);
|
|
24947
|
-
const instrTextContainer = nodesToCombine.find((n) => n.elements?.some((el) => el.name === "w:instrText"));
|
|
24948
|
-
const instrTextNode = instrTextContainer?.elements?.find((el) => el.name === "w:instrText");
|
|
24949
|
-
const instrText = instrTextNode?.elements[0].text;
|
|
24950
|
-
if (!hasPageMarker) hasPageMarker = instrText?.trim().startsWith("PAGE");
|
|
24951
|
-
if (!isNumPages) isNumPages = instrText?.trim().startsWith("NUMPAGES");
|
|
24952
|
-
const urlMatch = instrText?.match(/HYPERLINK\s+"([^"]+)"/);
|
|
24953
|
-
if (hasPageMarker) {
|
|
24954
|
-
const pageNumNode = {
|
|
24955
|
-
name: "sd:autoPageNumber",
|
|
24956
|
-
type: "element"
|
|
24957
|
-
};
|
|
24958
|
-
nodesToCombine.forEach((n) => {
|
|
24959
|
-
const rPrNode = n.elements.find((el) => el.name === "w:rPr");
|
|
24960
|
-
if (rPrNode) pageNumNode.elements = [rPrNode];
|
|
24961
|
-
});
|
|
24962
|
-
processedNodes.push(pageNumNode);
|
|
24963
|
-
} else if (isNumPages) {
|
|
24964
|
-
const totalPageNumNode = {
|
|
24965
|
-
name: "sd:totalPageNumber",
|
|
24966
|
-
type: "element"
|
|
24967
|
-
};
|
|
24968
|
-
nodesToCombine.forEach((n) => {
|
|
24969
|
-
const rPrNode = n.elements.find((el) => el.name === "w:rPr");
|
|
24970
|
-
if (rPrNode) totalPageNumNode.elements = [rPrNode];
|
|
24971
|
-
});
|
|
24972
|
-
processedNodes.push(totalPageNumNode);
|
|
24973
|
-
} else if (urlMatch && urlMatch?.length >= 2) {
|
|
24974
|
-
const url = urlMatch[1];
|
|
24975
|
-
const textMarks = [];
|
|
24976
|
-
textNodes.forEach((n) => {
|
|
24977
|
-
const rPr2 = n.elements.find((el) => el.name === "w:rPr");
|
|
24978
|
-
if (!rPr2) return;
|
|
24979
|
-
const { elements } = rPr2;
|
|
24980
|
-
elements.forEach((el) => {
|
|
24981
|
-
textMarks.push(el);
|
|
24982
|
-
});
|
|
24983
|
-
});
|
|
24984
|
-
const linkMark = { name: "link", attributes: { href: url } };
|
|
24985
|
-
const rPr = { name: "w:rPr", type: "element", elements: [linkMark, ...textMarks] };
|
|
24986
|
-
processedNodes.push({
|
|
24987
|
-
name: "w:r",
|
|
24988
|
-
type: "element",
|
|
24989
|
-
elements: [rPr, ...textNodes]
|
|
24990
|
-
});
|
|
24991
|
-
}
|
|
24992
|
-
return processedNodes;
|
|
24993
|
-
};
|
|
24994
24947
|
const handleParagraphNode$1 = (params) => {
|
|
24995
24948
|
const { nodes, docx, nodeListHandler, filename } = params;
|
|
24996
24949
|
const node = carbonCopy(nodes[0]);
|
|
24997
24950
|
let schemaNode;
|
|
24998
|
-
let processedElements = preProcessNodesForFldChar(node.elements);
|
|
24999
|
-
node.elements = processedElements;
|
|
25000
24951
|
const handleStandardNode2 = nodeListHandler.handlerEntities.find(
|
|
25001
24952
|
(e) => e.handlerName === "standardNodeHandler"
|
|
25002
24953
|
)?.handler;
|
|
@@ -25137,89 +25088,89 @@ const handleParagraphNode$1 = (params) => {
|
|
|
25137
25088
|
}
|
|
25138
25089
|
return schemaNode;
|
|
25139
25090
|
};
|
|
25140
|
-
const encode
|
|
25091
|
+
const encode$12 = (attributes) => {
|
|
25141
25092
|
return attributes["w:rsidDel"];
|
|
25142
25093
|
};
|
|
25143
|
-
const decode$
|
|
25094
|
+
const decode$U = (attrs) => {
|
|
25144
25095
|
return attrs.rsidDel;
|
|
25145
25096
|
};
|
|
25146
25097
|
const attrConfig$z = Object.freeze({
|
|
25147
25098
|
xmlName: "w:rsidDel",
|
|
25148
25099
|
sdName: "rsidDel",
|
|
25149
|
-
encode: encode
|
|
25150
|
-
decode: decode$
|
|
25100
|
+
encode: encode$12,
|
|
25101
|
+
decode: decode$U
|
|
25151
25102
|
});
|
|
25152
|
-
const encode$
|
|
25103
|
+
const encode$11 = (attributes) => {
|
|
25153
25104
|
return attributes["w:rsidP"];
|
|
25154
25105
|
};
|
|
25155
|
-
const decode$
|
|
25106
|
+
const decode$T = (attrs) => {
|
|
25156
25107
|
return attrs.rsidP;
|
|
25157
25108
|
};
|
|
25158
25109
|
const attrConfig$y = Object.freeze({
|
|
25159
25110
|
xmlName: "w:rsidP",
|
|
25160
25111
|
sdName: "rsidP",
|
|
25161
|
-
encode: encode$
|
|
25162
|
-
decode: decode$
|
|
25112
|
+
encode: encode$11,
|
|
25113
|
+
decode: decode$T
|
|
25163
25114
|
});
|
|
25164
|
-
const encode$
|
|
25115
|
+
const encode$10 = (attributes) => {
|
|
25165
25116
|
return attributes["w:rsidR"];
|
|
25166
25117
|
};
|
|
25167
|
-
const decode$
|
|
25118
|
+
const decode$S = (attrs) => {
|
|
25168
25119
|
return attrs.rsidR;
|
|
25169
25120
|
};
|
|
25170
25121
|
const attrConfig$x = Object.freeze({
|
|
25171
25122
|
xmlName: "w:rsidR",
|
|
25172
25123
|
sdName: "rsidR",
|
|
25173
|
-
encode: encode$
|
|
25174
|
-
decode: decode$
|
|
25124
|
+
encode: encode$10,
|
|
25125
|
+
decode: decode$S
|
|
25175
25126
|
});
|
|
25176
|
-
const encode
|
|
25127
|
+
const encode$$ = (attributes) => {
|
|
25177
25128
|
return attributes["w:rsidRPr"];
|
|
25178
25129
|
};
|
|
25179
|
-
const decode$
|
|
25130
|
+
const decode$R = (attrs) => {
|
|
25180
25131
|
return attrs.rsidRPr;
|
|
25181
25132
|
};
|
|
25182
25133
|
const attrConfig$w = Object.freeze({
|
|
25183
25134
|
xmlName: "w:rsidRPr",
|
|
25184
25135
|
sdName: "rsidRPr",
|
|
25185
|
-
encode: encode
|
|
25186
|
-
decode: decode$
|
|
25136
|
+
encode: encode$$,
|
|
25137
|
+
decode: decode$R
|
|
25187
25138
|
});
|
|
25188
|
-
const encode$
|
|
25139
|
+
const encode$_ = (attributes) => {
|
|
25189
25140
|
return attributes["w:rsidRDefault"];
|
|
25190
25141
|
};
|
|
25191
|
-
const decode$
|
|
25142
|
+
const decode$Q = (attrs) => {
|
|
25192
25143
|
return attrs.rsidRDefault;
|
|
25193
25144
|
};
|
|
25194
25145
|
const attrConfig$v = Object.freeze({
|
|
25195
25146
|
xmlName: "w:rsidRDefault",
|
|
25196
25147
|
sdName: "rsidRDefault",
|
|
25197
|
-
encode: encode$
|
|
25198
|
-
decode: decode$
|
|
25148
|
+
encode: encode$_,
|
|
25149
|
+
decode: decode$Q
|
|
25199
25150
|
});
|
|
25200
|
-
const encode$
|
|
25151
|
+
const encode$Z = (attributes) => {
|
|
25201
25152
|
return attributes["w14:paraId"];
|
|
25202
25153
|
};
|
|
25203
|
-
const decode$
|
|
25154
|
+
const decode$P = (attrs) => {
|
|
25204
25155
|
return attrs.paraId;
|
|
25205
25156
|
};
|
|
25206
25157
|
const attrConfig$u = Object.freeze({
|
|
25207
25158
|
xmlName: "w14:paraId",
|
|
25208
25159
|
sdName: "paraId",
|
|
25209
|
-
encode: encode$
|
|
25210
|
-
decode: decode$
|
|
25160
|
+
encode: encode$Z,
|
|
25161
|
+
decode: decode$P
|
|
25211
25162
|
});
|
|
25212
|
-
const encode$
|
|
25163
|
+
const encode$Y = (attributes) => {
|
|
25213
25164
|
return attributes["w14:textId"];
|
|
25214
25165
|
};
|
|
25215
|
-
const decode$
|
|
25166
|
+
const decode$O = (attrs) => {
|
|
25216
25167
|
return attrs.textId;
|
|
25217
25168
|
};
|
|
25218
25169
|
const attrConfig$t = Object.freeze({
|
|
25219
25170
|
xmlName: "w14:textId",
|
|
25220
25171
|
sdName: "textId",
|
|
25221
|
-
encode: encode$
|
|
25222
|
-
decode: decode$
|
|
25172
|
+
encode: encode$Y,
|
|
25173
|
+
decode: decode$O
|
|
25223
25174
|
});
|
|
25224
25175
|
const validXmlAttributes$j = [
|
|
25225
25176
|
attrConfig$u,
|
|
@@ -25230,9 +25181,9 @@ const validXmlAttributes$j = [
|
|
|
25230
25181
|
attrConfig$w,
|
|
25231
25182
|
attrConfig$z
|
|
25232
25183
|
];
|
|
25233
|
-
const XML_NODE_NAME$
|
|
25234
|
-
const SD_NODE_NAME$
|
|
25235
|
-
const encode$
|
|
25184
|
+
const XML_NODE_NAME$u = "w:p";
|
|
25185
|
+
const SD_NODE_NAME$d = "paragraph";
|
|
25186
|
+
const encode$X = (params, encodedAttrs = {}) => {
|
|
25236
25187
|
const node = handleParagraphNode$1(params);
|
|
25237
25188
|
if (!node) return void 0;
|
|
25238
25189
|
if (encodedAttrs && Object.keys(encodedAttrs).length) {
|
|
@@ -25240,7 +25191,7 @@ const encode$U = (params, encodedAttrs = {}) => {
|
|
|
25240
25191
|
}
|
|
25241
25192
|
return node;
|
|
25242
25193
|
};
|
|
25243
|
-
const decode$
|
|
25194
|
+
const decode$N = (params, decodedAttrs = {}) => {
|
|
25244
25195
|
const translated = translateParagraphNode(params);
|
|
25245
25196
|
if (!translated) return void 0;
|
|
25246
25197
|
if (decodedAttrs && Object.keys(decodedAttrs).length) {
|
|
@@ -25248,16 +25199,16 @@ const decode$L = (params, decodedAttrs = {}) => {
|
|
|
25248
25199
|
}
|
|
25249
25200
|
return translated;
|
|
25250
25201
|
};
|
|
25251
|
-
const config$
|
|
25252
|
-
xmlName: XML_NODE_NAME$
|
|
25253
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
25202
|
+
const config$s = {
|
|
25203
|
+
xmlName: XML_NODE_NAME$u,
|
|
25204
|
+
sdNodeOrKeyName: SD_NODE_NAME$d,
|
|
25254
25205
|
type: NodeTranslator.translatorTypes.NODE,
|
|
25255
|
-
encode: encode$
|
|
25256
|
-
decode: decode$
|
|
25206
|
+
encode: encode$X,
|
|
25207
|
+
decode: decode$N,
|
|
25257
25208
|
attributes: validXmlAttributes$j
|
|
25258
25209
|
};
|
|
25259
|
-
const translator$
|
|
25260
|
-
const encode$
|
|
25210
|
+
const translator$16 = NodeTranslator.from(config$s);
|
|
25211
|
+
const encode$W = (attributes) => {
|
|
25261
25212
|
const raw = attributes?.["w:val"];
|
|
25262
25213
|
if (raw === void 0 || raw === null) return void 0;
|
|
25263
25214
|
if (typeof raw === "boolean") return raw;
|
|
@@ -25267,24 +25218,24 @@ const encode$T = (attributes) => {
|
|
|
25267
25218
|
if (val === "1" || val === "true" || val === "on") return true;
|
|
25268
25219
|
return void 0;
|
|
25269
25220
|
};
|
|
25270
|
-
const decode$
|
|
25221
|
+
const decode$M = (runProps) => {
|
|
25271
25222
|
if (runProps?.bold === false) return "0";
|
|
25272
25223
|
return void 0;
|
|
25273
25224
|
};
|
|
25274
25225
|
const attrConfig$s = Object.freeze({
|
|
25275
25226
|
xmlName: "w:val",
|
|
25276
25227
|
sdName: "bold",
|
|
25277
|
-
encode: encode$
|
|
25278
|
-
decode: decode$
|
|
25228
|
+
encode: encode$W,
|
|
25229
|
+
decode: decode$M
|
|
25279
25230
|
});
|
|
25280
25231
|
const validXmlAttributes$i = [attrConfig$s];
|
|
25281
|
-
const XML_NODE_NAME$
|
|
25282
|
-
const SD_ATTR_KEY$
|
|
25283
|
-
const encode$
|
|
25232
|
+
const XML_NODE_NAME$t = "w:b";
|
|
25233
|
+
const SD_ATTR_KEY$f = "bold";
|
|
25234
|
+
const encode$V = (params, encodedAttrs = {}) => {
|
|
25284
25235
|
const { nodes } = params;
|
|
25285
25236
|
const node = nodes[0];
|
|
25286
25237
|
if (!node) return void 0;
|
|
25287
|
-
const val = encodedAttrs?.[SD_ATTR_KEY$
|
|
25238
|
+
const val = encodedAttrs?.[SD_ATTR_KEY$f];
|
|
25288
25239
|
let attributes;
|
|
25289
25240
|
if (val === false) attributes = { "w:val": "0" };
|
|
25290
25241
|
else if (val === true)
|
|
@@ -25292,85 +25243,85 @@ const encode$S = (params, encodedAttrs = {}) => {
|
|
|
25292
25243
|
else attributes = node.attributes || {};
|
|
25293
25244
|
return {
|
|
25294
25245
|
type: "attr",
|
|
25295
|
-
xmlName: XML_NODE_NAME$
|
|
25296
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25246
|
+
xmlName: XML_NODE_NAME$t,
|
|
25247
|
+
sdNodeOrKeyName: SD_ATTR_KEY$f,
|
|
25297
25248
|
attributes
|
|
25298
25249
|
};
|
|
25299
25250
|
};
|
|
25300
|
-
const config$
|
|
25301
|
-
xmlName: XML_NODE_NAME$
|
|
25302
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25251
|
+
const config$r = {
|
|
25252
|
+
xmlName: XML_NODE_NAME$t,
|
|
25253
|
+
sdNodeOrKeyName: SD_ATTR_KEY$f,
|
|
25303
25254
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25304
|
-
encode: encode$
|
|
25255
|
+
encode: encode$V,
|
|
25305
25256
|
attributes: validXmlAttributes$i
|
|
25306
25257
|
};
|
|
25307
|
-
const translator$
|
|
25308
|
-
const XML_NODE_NAME$
|
|
25309
|
-
const SD_ATTR_KEY$
|
|
25310
|
-
const encode$
|
|
25258
|
+
const translator$15 = NodeTranslator.from(config$r);
|
|
25259
|
+
const XML_NODE_NAME$s = "w:i";
|
|
25260
|
+
const SD_ATTR_KEY$e = "italic";
|
|
25261
|
+
const encode$U = (params) => {
|
|
25311
25262
|
const { nodes } = params;
|
|
25312
25263
|
const node = nodes?.[0];
|
|
25313
25264
|
if (!node) return void 0;
|
|
25314
25265
|
return {
|
|
25315
25266
|
type: "attr",
|
|
25316
|
-
xmlName: XML_NODE_NAME$
|
|
25317
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25267
|
+
xmlName: XML_NODE_NAME$s,
|
|
25268
|
+
sdNodeOrKeyName: SD_ATTR_KEY$e,
|
|
25318
25269
|
attributes: {
|
|
25319
25270
|
"w:val": node.attributes?.["w:val"] ?? null
|
|
25320
25271
|
}
|
|
25321
25272
|
};
|
|
25322
25273
|
};
|
|
25323
|
-
const config$
|
|
25324
|
-
xmlName: XML_NODE_NAME$
|
|
25325
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25274
|
+
const config$q = {
|
|
25275
|
+
xmlName: XML_NODE_NAME$s,
|
|
25276
|
+
sdNodeOrKeyName: SD_ATTR_KEY$e,
|
|
25326
25277
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25327
|
-
encode: encode$
|
|
25278
|
+
encode: encode$U
|
|
25328
25279
|
};
|
|
25329
|
-
const translator$
|
|
25330
|
-
const encode$
|
|
25331
|
-
const decode$
|
|
25280
|
+
const translator$14 = NodeTranslator.from(config$q);
|
|
25281
|
+
const encode$T = (attributes) => attributes?.["w:val"];
|
|
25282
|
+
const decode$L = (attrs) => attrs?.underline;
|
|
25332
25283
|
const attrConfig$r = Object.freeze({
|
|
25333
25284
|
xmlName: "w:val",
|
|
25334
25285
|
sdName: "underline",
|
|
25335
|
-
encode: encode$
|
|
25336
|
-
decode: decode$
|
|
25286
|
+
encode: encode$T,
|
|
25287
|
+
decode: decode$L
|
|
25337
25288
|
});
|
|
25338
|
-
const encode$
|
|
25339
|
-
const decode$
|
|
25289
|
+
const encode$S = (attributes) => attributes?.["w:color"];
|
|
25290
|
+
const decode$K = (attrs) => attrs?.color;
|
|
25340
25291
|
const attrConfig$q = Object.freeze({
|
|
25341
25292
|
xmlName: "w:color",
|
|
25342
25293
|
sdName: "color",
|
|
25343
|
-
encode: encode$
|
|
25344
|
-
decode: decode$
|
|
25294
|
+
encode: encode$S,
|
|
25295
|
+
decode: decode$K
|
|
25345
25296
|
});
|
|
25346
|
-
const encode$
|
|
25347
|
-
const decode$
|
|
25297
|
+
const encode$R = (attributes) => attributes?.["w:themeColor"];
|
|
25298
|
+
const decode$J = (attrs) => attrs?.themeColor;
|
|
25348
25299
|
const attrConfig$p = Object.freeze({
|
|
25349
25300
|
xmlName: "w:themeColor",
|
|
25350
25301
|
sdName: "themeColor",
|
|
25351
|
-
encode: encode$
|
|
25352
|
-
decode: decode$
|
|
25302
|
+
encode: encode$R,
|
|
25303
|
+
decode: decode$J
|
|
25353
25304
|
});
|
|
25354
|
-
const encode$
|
|
25355
|
-
const decode$
|
|
25305
|
+
const encode$Q = (attributes) => attributes?.["w:themeTint"];
|
|
25306
|
+
const decode$I = (attrs) => attrs?.themeTint;
|
|
25356
25307
|
const attrConfig$o = Object.freeze({
|
|
25357
25308
|
xmlName: "w:themeTint",
|
|
25358
25309
|
sdName: "themeTint",
|
|
25359
|
-
encode: encode$
|
|
25360
|
-
decode: decode$
|
|
25310
|
+
encode: encode$Q,
|
|
25311
|
+
decode: decode$I
|
|
25361
25312
|
});
|
|
25362
|
-
const encode$
|
|
25363
|
-
const decode$
|
|
25313
|
+
const encode$P = (attributes) => attributes?.["w:themeShade"];
|
|
25314
|
+
const decode$H = (attrs) => attrs?.themeShade;
|
|
25364
25315
|
const attrConfig$n = Object.freeze({
|
|
25365
25316
|
xmlName: "w:themeShade",
|
|
25366
25317
|
sdName: "themeShade",
|
|
25367
|
-
encode: encode$
|
|
25368
|
-
decode: decode$
|
|
25318
|
+
encode: encode$P,
|
|
25319
|
+
decode: decode$H
|
|
25369
25320
|
});
|
|
25370
25321
|
const validXmlAttributes$h = [attrConfig$r, attrConfig$q, attrConfig$p, attrConfig$o, attrConfig$n];
|
|
25371
|
-
const XML_NODE_NAME$
|
|
25372
|
-
const SD_ATTR_KEY$
|
|
25373
|
-
const encode$
|
|
25322
|
+
const XML_NODE_NAME$r = "w:u";
|
|
25323
|
+
const SD_ATTR_KEY$d = "underline";
|
|
25324
|
+
const encode$O = (params, encodedAttrs = {}) => {
|
|
25374
25325
|
const { nodes } = params;
|
|
25375
25326
|
const node = nodes?.[0];
|
|
25376
25327
|
const sourceAttrs = node?.attributes || {};
|
|
@@ -25386,12 +25337,12 @@ const encode$L = (params, encodedAttrs = {}) => {
|
|
|
25386
25337
|
if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
|
|
25387
25338
|
return {
|
|
25388
25339
|
type: "attr",
|
|
25389
|
-
xmlName: XML_NODE_NAME$
|
|
25390
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25340
|
+
xmlName: XML_NODE_NAME$r,
|
|
25341
|
+
sdNodeOrKeyName: SD_ATTR_KEY$d,
|
|
25391
25342
|
attributes
|
|
25392
25343
|
};
|
|
25393
25344
|
};
|
|
25394
|
-
const decode$
|
|
25345
|
+
const decode$G = (params) => {
|
|
25395
25346
|
const attrs = params?.node?.attrs || {};
|
|
25396
25347
|
const underlineType = attrs.underlineType ?? attrs.underline ?? null;
|
|
25397
25348
|
const color = attrs.underlineColor ?? attrs.color ?? null;
|
|
@@ -25409,20 +25360,20 @@ const decode$E = (params) => {
|
|
|
25409
25360
|
if (themeTint) attributes["w:themeTint"] = themeTint;
|
|
25410
25361
|
if (themeShade) attributes["w:themeShade"] = themeShade;
|
|
25411
25362
|
return {
|
|
25412
|
-
name: XML_NODE_NAME$
|
|
25363
|
+
name: XML_NODE_NAME$r,
|
|
25413
25364
|
attributes
|
|
25414
25365
|
};
|
|
25415
25366
|
};
|
|
25416
|
-
const config$
|
|
25417
|
-
xmlName: XML_NODE_NAME$
|
|
25418
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25367
|
+
const config$p = {
|
|
25368
|
+
xmlName: XML_NODE_NAME$r,
|
|
25369
|
+
sdNodeOrKeyName: SD_ATTR_KEY$d,
|
|
25419
25370
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25420
|
-
encode: encode$
|
|
25421
|
-
decode: decode$
|
|
25371
|
+
encode: encode$O,
|
|
25372
|
+
decode: decode$G,
|
|
25422
25373
|
attributes: validXmlAttributes$h
|
|
25423
25374
|
};
|
|
25424
|
-
const translator$
|
|
25425
|
-
const encode$
|
|
25375
|
+
const translator$13 = NodeTranslator.from(config$p);
|
|
25376
|
+
const encode$N = (attributes) => {
|
|
25426
25377
|
const raw = attributes?.["w:val"];
|
|
25427
25378
|
if (raw === void 0 || raw === null) return void 0;
|
|
25428
25379
|
if (typeof raw === "boolean") return raw;
|
|
@@ -25432,24 +25383,24 @@ const encode$K = (attributes) => {
|
|
|
25432
25383
|
if (val === "1" || val === "true" || val === "on") return true;
|
|
25433
25384
|
return void 0;
|
|
25434
25385
|
};
|
|
25435
|
-
const decode$
|
|
25386
|
+
const decode$F = (attrs) => {
|
|
25436
25387
|
if (attrs?.strike === false) return "0";
|
|
25437
25388
|
return void 0;
|
|
25438
25389
|
};
|
|
25439
25390
|
const attrConfig$m = Object.freeze({
|
|
25440
25391
|
xmlName: "w:val",
|
|
25441
25392
|
sdName: "strike",
|
|
25442
|
-
encode: encode$
|
|
25443
|
-
decode: decode$
|
|
25393
|
+
encode: encode$N,
|
|
25394
|
+
decode: decode$F
|
|
25444
25395
|
});
|
|
25445
25396
|
const validXmlAttributes$g = [attrConfig$m];
|
|
25446
|
-
const XML_NODE_NAME$
|
|
25447
|
-
const SD_ATTR_KEY$
|
|
25448
|
-
const encode$
|
|
25397
|
+
const XML_NODE_NAME$q = "w:strike";
|
|
25398
|
+
const SD_ATTR_KEY$c = "strike";
|
|
25399
|
+
const encode$M = (params, encodedAttrs = {}) => {
|
|
25449
25400
|
const { nodes } = params;
|
|
25450
25401
|
const node = nodes?.[0];
|
|
25451
25402
|
if (!node) return void 0;
|
|
25452
|
-
const val = encodedAttrs?.[SD_ATTR_KEY$
|
|
25403
|
+
const val = encodedAttrs?.[SD_ATTR_KEY$c];
|
|
25453
25404
|
let attributes;
|
|
25454
25405
|
if (val === false) attributes = { "w:val": "0" };
|
|
25455
25406
|
else if (val === true) attributes = {};
|
|
@@ -25458,55 +25409,55 @@ const encode$J = (params, encodedAttrs = {}) => {
|
|
|
25458
25409
|
else if (val === true && attributes["w:val"] === void 0) delete attributes["w:val"];
|
|
25459
25410
|
return {
|
|
25460
25411
|
type: "attr",
|
|
25461
|
-
xmlName: XML_NODE_NAME$
|
|
25462
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25412
|
+
xmlName: XML_NODE_NAME$q,
|
|
25413
|
+
sdNodeOrKeyName: SD_ATTR_KEY$c,
|
|
25463
25414
|
attributes
|
|
25464
25415
|
};
|
|
25465
25416
|
};
|
|
25466
|
-
const config$
|
|
25467
|
-
xmlName: XML_NODE_NAME$
|
|
25468
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25417
|
+
const config$o = {
|
|
25418
|
+
xmlName: XML_NODE_NAME$q,
|
|
25419
|
+
sdNodeOrKeyName: SD_ATTR_KEY$c,
|
|
25469
25420
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25470
|
-
encode: encode$
|
|
25421
|
+
encode: encode$M,
|
|
25471
25422
|
attributes: validXmlAttributes$g
|
|
25472
25423
|
};
|
|
25473
|
-
const translator
|
|
25474
|
-
const encode$
|
|
25475
|
-
const decode$
|
|
25424
|
+
const translator$12 = NodeTranslator.from(config$o);
|
|
25425
|
+
const encode$L = (attributes) => attributes?.["w:val"];
|
|
25426
|
+
const decode$E = (attrs) => attrs?.color;
|
|
25476
25427
|
const attrConfig$l = Object.freeze({
|
|
25477
25428
|
xmlName: "w:val",
|
|
25478
25429
|
sdName: "color",
|
|
25479
|
-
encode: encode$
|
|
25480
|
-
decode: decode$
|
|
25430
|
+
encode: encode$L,
|
|
25431
|
+
decode: decode$E
|
|
25481
25432
|
});
|
|
25482
|
-
const encode$
|
|
25483
|
-
const decode$
|
|
25433
|
+
const encode$K = (attributes) => attributes?.["w:themeColor"];
|
|
25434
|
+
const decode$D = (attrs) => attrs?.themeColor;
|
|
25484
25435
|
const attrConfig$k = Object.freeze({
|
|
25485
25436
|
xmlName: "w:themeColor",
|
|
25486
25437
|
sdName: "themeColor",
|
|
25487
|
-
encode: encode$
|
|
25488
|
-
decode: decode$
|
|
25438
|
+
encode: encode$K,
|
|
25439
|
+
decode: decode$D
|
|
25489
25440
|
});
|
|
25490
|
-
const encode$
|
|
25491
|
-
const decode$
|
|
25441
|
+
const encode$J = (attributes) => attributes?.["w:themeTint"];
|
|
25442
|
+
const decode$C = (attrs) => attrs?.themeTint;
|
|
25492
25443
|
const attrConfig$j = Object.freeze({
|
|
25493
25444
|
xmlName: "w:themeTint",
|
|
25494
25445
|
sdName: "themeTint",
|
|
25495
|
-
encode: encode$
|
|
25496
|
-
decode: decode$
|
|
25446
|
+
encode: encode$J,
|
|
25447
|
+
decode: decode$C
|
|
25497
25448
|
});
|
|
25498
|
-
const encode$
|
|
25499
|
-
const decode$
|
|
25449
|
+
const encode$I = (attributes) => attributes?.["w:themeShade"];
|
|
25450
|
+
const decode$B = (attrs) => attrs?.themeShade;
|
|
25500
25451
|
const attrConfig$i = Object.freeze({
|
|
25501
25452
|
xmlName: "w:themeShade",
|
|
25502
25453
|
sdName: "themeShade",
|
|
25503
|
-
encode: encode$
|
|
25504
|
-
decode: decode$
|
|
25454
|
+
encode: encode$I,
|
|
25455
|
+
decode: decode$B
|
|
25505
25456
|
});
|
|
25506
25457
|
const validXmlAttributes$f = [attrConfig$l, attrConfig$k, attrConfig$j, attrConfig$i];
|
|
25507
|
-
const XML_NODE_NAME$
|
|
25508
|
-
const SD_ATTR_KEY$
|
|
25509
|
-
const encode$
|
|
25458
|
+
const XML_NODE_NAME$p = "w:color";
|
|
25459
|
+
const SD_ATTR_KEY$b = "color";
|
|
25460
|
+
const encode$H = (params, encodedAttrs = {}) => {
|
|
25510
25461
|
const { nodes } = params;
|
|
25511
25462
|
const node = nodes?.[0];
|
|
25512
25463
|
const sourceAttrs = node?.attributes || {};
|
|
@@ -25521,63 +25472,63 @@ const encode$E = (params, encodedAttrs = {}) => {
|
|
|
25521
25472
|
if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
|
|
25522
25473
|
return {
|
|
25523
25474
|
type: "attr",
|
|
25524
|
-
xmlName: XML_NODE_NAME$
|
|
25525
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25475
|
+
xmlName: XML_NODE_NAME$p,
|
|
25476
|
+
sdNodeOrKeyName: SD_ATTR_KEY$b,
|
|
25526
25477
|
attributes
|
|
25527
25478
|
};
|
|
25528
25479
|
};
|
|
25529
|
-
const config$
|
|
25530
|
-
xmlName: XML_NODE_NAME$
|
|
25531
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25532
|
-
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25533
|
-
encode: encode$
|
|
25480
|
+
const config$n = {
|
|
25481
|
+
xmlName: XML_NODE_NAME$p,
|
|
25482
|
+
sdNodeOrKeyName: SD_ATTR_KEY$b,
|
|
25483
|
+
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25484
|
+
encode: encode$H,
|
|
25534
25485
|
attributes: validXmlAttributes$f
|
|
25535
25486
|
};
|
|
25536
|
-
const translator$
|
|
25537
|
-
const encode$
|
|
25538
|
-
const decode$
|
|
25487
|
+
const translator$11 = NodeTranslator.from(config$n);
|
|
25488
|
+
const encode$G = (attributes) => attributes?.["w:eastAsia"];
|
|
25489
|
+
const decode$A = (attrs) => attrs?.eastAsia;
|
|
25539
25490
|
const attrConfig$h = Object.freeze({
|
|
25540
25491
|
xmlName: "w:eastAsia",
|
|
25541
25492
|
sdName: "eastAsia",
|
|
25542
|
-
encode: encode$
|
|
25543
|
-
decode: decode$
|
|
25493
|
+
encode: encode$G,
|
|
25494
|
+
decode: decode$A
|
|
25544
25495
|
});
|
|
25545
|
-
const encode$
|
|
25546
|
-
const decode$
|
|
25496
|
+
const encode$F = (attributes) => attributes?.["w:ascii"];
|
|
25497
|
+
const decode$z = (attrs) => attrs?.ascii;
|
|
25547
25498
|
const attrConfig$g = Object.freeze({
|
|
25548
25499
|
xmlName: "w:ascii",
|
|
25549
25500
|
sdName: "ascii",
|
|
25550
|
-
encode: encode$
|
|
25551
|
-
decode: decode$
|
|
25501
|
+
encode: encode$F,
|
|
25502
|
+
decode: decode$z
|
|
25552
25503
|
});
|
|
25553
|
-
const encode$
|
|
25554
|
-
const decode$
|
|
25504
|
+
const encode$E = (attributes) => attributes?.["w:hAnsi"];
|
|
25505
|
+
const decode$y = (attrs) => attrs?.hAnsi;
|
|
25555
25506
|
const attrConfig$f = Object.freeze({
|
|
25556
25507
|
xmlName: "w:hAnsi",
|
|
25557
25508
|
sdName: "hAnsi",
|
|
25558
|
-
encode: encode$
|
|
25559
|
-
decode: decode$
|
|
25509
|
+
encode: encode$E,
|
|
25510
|
+
decode: decode$y
|
|
25560
25511
|
});
|
|
25561
|
-
const encode$
|
|
25562
|
-
const decode$
|
|
25512
|
+
const encode$D = (attributes) => attributes?.["w:cs"];
|
|
25513
|
+
const decode$x = (attrs) => attrs?.cs;
|
|
25563
25514
|
const attrConfig$e = Object.freeze({
|
|
25564
25515
|
xmlName: "w:cs",
|
|
25565
25516
|
sdName: "cs",
|
|
25566
|
-
encode: encode$
|
|
25567
|
-
decode: decode$
|
|
25517
|
+
encode: encode$D,
|
|
25518
|
+
decode: decode$x
|
|
25568
25519
|
});
|
|
25569
|
-
const encode$
|
|
25570
|
-
const decode$
|
|
25520
|
+
const encode$C = (attributes) => attributes?.["w:val"];
|
|
25521
|
+
const decode$w = (attrs) => attrs?.value;
|
|
25571
25522
|
const attrConfig$d = Object.freeze({
|
|
25572
25523
|
xmlName: "w:val",
|
|
25573
25524
|
sdName: "value",
|
|
25574
|
-
encode: encode$
|
|
25575
|
-
decode: decode$
|
|
25525
|
+
encode: encode$C,
|
|
25526
|
+
decode: decode$w
|
|
25576
25527
|
});
|
|
25577
25528
|
const validXmlAttributes$e = [attrConfig$h, attrConfig$g, attrConfig$f, attrConfig$e, attrConfig$d];
|
|
25578
|
-
const XML_NODE_NAME$
|
|
25579
|
-
const SD_ATTR_KEY$
|
|
25580
|
-
const encode$
|
|
25529
|
+
const XML_NODE_NAME$o = "w:rFonts";
|
|
25530
|
+
const SD_ATTR_KEY$a = "fontFamily";
|
|
25531
|
+
const encode$B = (params, encodedAttrs = {}) => {
|
|
25581
25532
|
const { nodes } = params;
|
|
25582
25533
|
const node = nodes?.[0];
|
|
25583
25534
|
const sourceAttrs = node?.attributes || {};
|
|
@@ -25603,120 +25554,281 @@ const encode$y = (params, encodedAttrs = {}) => {
|
|
|
25603
25554
|
if (attributes["w:val"] === void 0) delete attributes["w:val"];
|
|
25604
25555
|
return {
|
|
25605
25556
|
type: "attr",
|
|
25606
|
-
xmlName: XML_NODE_NAME$
|
|
25607
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25557
|
+
xmlName: XML_NODE_NAME$o,
|
|
25558
|
+
sdNodeOrKeyName: SD_ATTR_KEY$a,
|
|
25608
25559
|
attributes
|
|
25609
25560
|
};
|
|
25610
25561
|
};
|
|
25611
|
-
const config$
|
|
25612
|
-
xmlName: XML_NODE_NAME$
|
|
25613
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25562
|
+
const config$m = {
|
|
25563
|
+
xmlName: XML_NODE_NAME$o,
|
|
25564
|
+
sdNodeOrKeyName: SD_ATTR_KEY$a,
|
|
25614
25565
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25615
|
-
encode: encode$
|
|
25566
|
+
encode: encode$B,
|
|
25616
25567
|
attributes: validXmlAttributes$e
|
|
25617
25568
|
};
|
|
25618
|
-
const translator$
|
|
25619
|
-
const encode$
|
|
25620
|
-
const decode$
|
|
25569
|
+
const translator$10 = NodeTranslator.from(config$m);
|
|
25570
|
+
const encode$A = (attributes) => attributes?.["w:val"];
|
|
25571
|
+
const decode$v = (attrs) => attrs?.styleId;
|
|
25621
25572
|
const attrConfig$c = Object.freeze({
|
|
25622
25573
|
xmlName: "w:val",
|
|
25623
25574
|
sdName: "styleId",
|
|
25624
|
-
encode: encode$
|
|
25625
|
-
decode: decode$
|
|
25575
|
+
encode: encode$A,
|
|
25576
|
+
decode: decode$v
|
|
25626
25577
|
});
|
|
25627
25578
|
const validXmlAttributes$d = [attrConfig$c];
|
|
25628
|
-
const XML_NODE_NAME$
|
|
25629
|
-
const SD_ATTR_KEY$
|
|
25630
|
-
const encode$
|
|
25579
|
+
const XML_NODE_NAME$n = "w:rStyle";
|
|
25580
|
+
const SD_ATTR_KEY$9 = "styleId";
|
|
25581
|
+
const encode$z = (params, encodedAttrs = {}) => {
|
|
25631
25582
|
const { nodes } = params;
|
|
25632
25583
|
const node = nodes?.[0];
|
|
25633
25584
|
const value = encodedAttrs.styleId ?? node?.attributes?.["w:val"];
|
|
25634
25585
|
return {
|
|
25635
25586
|
type: "attr",
|
|
25636
|
-
xmlName: XML_NODE_NAME$
|
|
25637
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25587
|
+
xmlName: XML_NODE_NAME$n,
|
|
25588
|
+
sdNodeOrKeyName: SD_ATTR_KEY$9,
|
|
25638
25589
|
attributes: { "w:val": value ?? null }
|
|
25639
25590
|
};
|
|
25640
25591
|
};
|
|
25641
|
-
const config$
|
|
25642
|
-
xmlName: XML_NODE_NAME$
|
|
25643
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25592
|
+
const config$l = {
|
|
25593
|
+
xmlName: XML_NODE_NAME$n,
|
|
25594
|
+
sdNodeOrKeyName: SD_ATTR_KEY$9,
|
|
25644
25595
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25645
|
-
encode: encode$
|
|
25596
|
+
encode: encode$z,
|
|
25646
25597
|
attributes: validXmlAttributes$d
|
|
25647
25598
|
};
|
|
25648
|
-
const translator
|
|
25649
|
-
const encode$
|
|
25650
|
-
const decode$
|
|
25599
|
+
const translator$$ = NodeTranslator.from(config$l);
|
|
25600
|
+
const encode$y = (attributes) => attributes?.["w:val"];
|
|
25601
|
+
const decode$u = (attrs) => attrs?.fontSize;
|
|
25651
25602
|
const attrConfig$b = Object.freeze({
|
|
25652
25603
|
xmlName: "w:val",
|
|
25653
25604
|
sdName: "fontSize",
|
|
25654
|
-
encode: encode$
|
|
25655
|
-
decode: decode$
|
|
25605
|
+
encode: encode$y,
|
|
25606
|
+
decode: decode$u
|
|
25656
25607
|
});
|
|
25657
25608
|
const validXmlAttributes$c = [attrConfig$b];
|
|
25658
|
-
const XML_NODE_NAME$
|
|
25659
|
-
const SD_ATTR_KEY$
|
|
25660
|
-
const encode$
|
|
25609
|
+
const XML_NODE_NAME$m = "w:sz";
|
|
25610
|
+
const SD_ATTR_KEY$8 = "fontSize";
|
|
25611
|
+
const encode$x = (params, encodedAttrs = {}) => {
|
|
25661
25612
|
const { nodes } = params;
|
|
25662
25613
|
const node = nodes?.[0];
|
|
25663
25614
|
const value = encodedAttrs.fontSize ?? node?.attributes?.["w:val"];
|
|
25664
25615
|
return {
|
|
25665
25616
|
type: "attr",
|
|
25666
|
-
xmlName: XML_NODE_NAME$
|
|
25667
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25617
|
+
xmlName: XML_NODE_NAME$m,
|
|
25618
|
+
sdNodeOrKeyName: SD_ATTR_KEY$8,
|
|
25668
25619
|
attributes: { "w:val": value ?? null }
|
|
25669
25620
|
};
|
|
25670
25621
|
};
|
|
25671
|
-
const config$
|
|
25672
|
-
xmlName: XML_NODE_NAME$
|
|
25673
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25622
|
+
const config$k = {
|
|
25623
|
+
xmlName: XML_NODE_NAME$m,
|
|
25624
|
+
sdNodeOrKeyName: SD_ATTR_KEY$8,
|
|
25674
25625
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25675
|
-
encode: encode$
|
|
25626
|
+
encode: encode$x,
|
|
25676
25627
|
attributes: validXmlAttributes$c
|
|
25677
25628
|
};
|
|
25678
|
-
const translator$
|
|
25679
|
-
const encode$
|
|
25680
|
-
const decode$
|
|
25629
|
+
const translator$_ = NodeTranslator.from(config$k);
|
|
25630
|
+
const encode$w = (attributes) => attributes?.["w:val"];
|
|
25631
|
+
const decode$t = (attrs) => attrs?.fontSizeCs;
|
|
25681
25632
|
const attrConfig$a = Object.freeze({
|
|
25682
25633
|
xmlName: "w:val",
|
|
25683
25634
|
sdName: "fontSizeCs",
|
|
25684
|
-
encode: encode$
|
|
25685
|
-
decode: decode$
|
|
25635
|
+
encode: encode$w,
|
|
25636
|
+
decode: decode$t
|
|
25686
25637
|
});
|
|
25687
25638
|
const validXmlAttributes$b = [attrConfig$a];
|
|
25688
|
-
const XML_NODE_NAME$
|
|
25689
|
-
const SD_ATTR_KEY$
|
|
25690
|
-
const encode$
|
|
25639
|
+
const XML_NODE_NAME$l = "w:szCs";
|
|
25640
|
+
const SD_ATTR_KEY$7 = "fontSizeCs";
|
|
25641
|
+
const encode$v = (params, encodedAttrs = {}) => {
|
|
25691
25642
|
const { nodes } = params;
|
|
25692
25643
|
const node = nodes?.[0];
|
|
25693
25644
|
const value = encodedAttrs.fontSizeCs ?? node?.attributes?.["w:val"];
|
|
25694
25645
|
return {
|
|
25695
25646
|
type: "attr",
|
|
25696
|
-
xmlName: XML_NODE_NAME$
|
|
25697
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25647
|
+
xmlName: XML_NODE_NAME$l,
|
|
25648
|
+
sdNodeOrKeyName: SD_ATTR_KEY$7,
|
|
25698
25649
|
attributes: { "w:val": value ?? null }
|
|
25699
25650
|
};
|
|
25700
25651
|
};
|
|
25701
|
-
const config$
|
|
25702
|
-
xmlName: XML_NODE_NAME$
|
|
25703
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25652
|
+
const config$j = {
|
|
25653
|
+
xmlName: XML_NODE_NAME$l,
|
|
25654
|
+
sdNodeOrKeyName: SD_ATTR_KEY$7,
|
|
25704
25655
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25705
|
-
encode: encode$
|
|
25656
|
+
encode: encode$v,
|
|
25706
25657
|
attributes: validXmlAttributes$b
|
|
25707
25658
|
};
|
|
25708
|
-
const translator$
|
|
25659
|
+
const translator$Z = NodeTranslator.from(config$j);
|
|
25660
|
+
const generateV2HandlerEntity = (handlerName, translator2) => ({
|
|
25661
|
+
handlerName,
|
|
25662
|
+
handler: (params) => {
|
|
25663
|
+
const { nodes } = params;
|
|
25664
|
+
if (nodes.length === 0 || nodes[0].name !== translator2.xmlName) {
|
|
25665
|
+
return { nodes: [], consumed: 0 };
|
|
25666
|
+
}
|
|
25667
|
+
const result = translator2.encode(params);
|
|
25668
|
+
if (!result) return { nodes: [], consumed: 0 };
|
|
25669
|
+
return {
|
|
25670
|
+
nodes: Array.isArray(result) ? result : [result],
|
|
25671
|
+
consumed: 1
|
|
25672
|
+
};
|
|
25673
|
+
}
|
|
25674
|
+
});
|
|
25675
|
+
function createSingleAttrPropertyHandler(xmlName, sdName = null, attrName = "w:val", transformEncode = null, transformDecode = null) {
|
|
25676
|
+
if (!sdName) sdName = xmlName.split(":")[1];
|
|
25677
|
+
if (!transformEncode) transformEncode = (v2) => v2;
|
|
25678
|
+
if (!transformDecode) transformDecode = (v2) => v2;
|
|
25679
|
+
return {
|
|
25680
|
+
xmlName,
|
|
25681
|
+
sdNodeOrKeyName: sdName,
|
|
25682
|
+
encode: ({ nodes }) => {
|
|
25683
|
+
return transformEncode(nodes[0].attributes[attrName]) ?? void 0;
|
|
25684
|
+
},
|
|
25685
|
+
decode: ({ node }) => {
|
|
25686
|
+
const value = node.attrs?.[sdName] != null ? transformDecode(node.attrs[sdName]) : void 0;
|
|
25687
|
+
return value != null ? { name: xmlName, attributes: { [attrName]: value } } : void 0;
|
|
25688
|
+
}
|
|
25689
|
+
};
|
|
25690
|
+
}
|
|
25691
|
+
function createMeasurementPropertyHandler(xmlName, sdName = null) {
|
|
25692
|
+
if (!sdName) sdName = xmlName.split(":")[1];
|
|
25693
|
+
return {
|
|
25694
|
+
xmlName,
|
|
25695
|
+
sdNodeOrKeyName: sdName,
|
|
25696
|
+
attributes: [
|
|
25697
|
+
createAttributeHandler("w:w", "value", parseInteger, integerToString),
|
|
25698
|
+
createAttributeHandler("w:type")
|
|
25699
|
+
],
|
|
25700
|
+
encode: (_2, encodedAttrs) => {
|
|
25701
|
+
return encodedAttrs["value"] != null ? encodedAttrs : void 0;
|
|
25702
|
+
},
|
|
25703
|
+
decode: function({ node }) {
|
|
25704
|
+
const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
|
|
25705
|
+
return decodedAttrs["w:w"] != null ? { attributes: decodedAttrs } : void 0;
|
|
25706
|
+
}
|
|
25707
|
+
};
|
|
25708
|
+
}
|
|
25709
|
+
function createBorderPropertyHandler(xmlName, sdName = null) {
|
|
25710
|
+
if (!sdName) sdName = xmlName.split(":")[1];
|
|
25711
|
+
return {
|
|
25712
|
+
xmlName,
|
|
25713
|
+
sdNodeOrKeyName: sdName,
|
|
25714
|
+
attributes: [
|
|
25715
|
+
createAttributeHandler("w:val"),
|
|
25716
|
+
createAttributeHandler("w:color"),
|
|
25717
|
+
createAttributeHandler("w:themeColor"),
|
|
25718
|
+
createAttributeHandler("w:themeTint"),
|
|
25719
|
+
createAttributeHandler("w:themeShade"),
|
|
25720
|
+
createAttributeHandler("w:sz", "size", parseInteger, integerToString),
|
|
25721
|
+
createAttributeHandler("w:space", null, parseInteger, integerToString),
|
|
25722
|
+
createAttributeHandler("w:shadow", null, parseBoolean, booleanToString),
|
|
25723
|
+
createAttributeHandler("w:frame", null, parseBoolean, booleanToString)
|
|
25724
|
+
],
|
|
25725
|
+
encode: (params, encodedAttrs) => {
|
|
25726
|
+
return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
|
|
25727
|
+
},
|
|
25728
|
+
decode: function({ node }, context) {
|
|
25729
|
+
const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
|
|
25730
|
+
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
25731
|
+
}
|
|
25732
|
+
};
|
|
25733
|
+
}
|
|
25734
|
+
const createAttributeHandler = (xmlName, sdName = null, transformEncode = null, transformDecode = null) => {
|
|
25735
|
+
if (!transformEncode) transformEncode = (v2) => v2;
|
|
25736
|
+
if (!transformDecode) transformDecode = (v2) => v2;
|
|
25737
|
+
if (!sdName) sdName = xmlName.split(":")[1];
|
|
25738
|
+
return {
|
|
25739
|
+
xmlName,
|
|
25740
|
+
sdName,
|
|
25741
|
+
encode: (attributes) => transformEncode(attributes[xmlName]),
|
|
25742
|
+
decode: (attributes) => transformDecode(attributes[sdName])
|
|
25743
|
+
};
|
|
25744
|
+
};
|
|
25745
|
+
function encodeProperties(node, translatorsByXmlName, asArray = false) {
|
|
25746
|
+
if (!node?.elements || node.elements.length === 0) {
|
|
25747
|
+
return asArray ? [] : {};
|
|
25748
|
+
}
|
|
25749
|
+
const attributes = asArray ? [] : {};
|
|
25750
|
+
node.elements.forEach((el) => {
|
|
25751
|
+
const translator2 = translatorsByXmlName[el.name];
|
|
25752
|
+
if (translator2) {
|
|
25753
|
+
const encodedAttr = translator2.encode({ nodes: [el] });
|
|
25754
|
+
if (encodedAttr != null) {
|
|
25755
|
+
if (asArray) {
|
|
25756
|
+
attributes.push({ [translator2.sdNodeOrKeyName]: encodedAttr });
|
|
25757
|
+
} else {
|
|
25758
|
+
attributes[translator2.sdNodeOrKeyName] = encodedAttr;
|
|
25759
|
+
}
|
|
25760
|
+
}
|
|
25761
|
+
}
|
|
25762
|
+
});
|
|
25763
|
+
return attributes;
|
|
25764
|
+
}
|
|
25765
|
+
function decodeProperties(translatorsBySdName, properties) {
|
|
25766
|
+
if (!properties || typeof properties !== "object") {
|
|
25767
|
+
return [];
|
|
25768
|
+
}
|
|
25769
|
+
const elements = [];
|
|
25770
|
+
Object.keys(properties).forEach((key) => {
|
|
25771
|
+
const translator2 = translatorsBySdName[key];
|
|
25772
|
+
if (translator2) {
|
|
25773
|
+
const result = translator2.decode({ node: { attrs: { [key]: properties[key] } } });
|
|
25774
|
+
if (result != null) {
|
|
25775
|
+
result.name = translator2.xmlName;
|
|
25776
|
+
elements.push(result);
|
|
25777
|
+
}
|
|
25778
|
+
}
|
|
25779
|
+
});
|
|
25780
|
+
return elements;
|
|
25781
|
+
}
|
|
25782
|
+
const parseBoolean = (value) => value != null ? ["1", "true"].includes(value) : void 0;
|
|
25783
|
+
const booleanToString = (value) => value != null ? value ? "1" : "0" : void 0;
|
|
25784
|
+
const parseInteger = (value) => {
|
|
25785
|
+
if (value == null) return void 0;
|
|
25786
|
+
const intValue = parseInt(value, 10);
|
|
25787
|
+
return isNaN(intValue) ? void 0 : intValue;
|
|
25788
|
+
};
|
|
25789
|
+
const integerToString = (value) => {
|
|
25790
|
+
const intValue = parseInteger(value);
|
|
25791
|
+
return intValue != void 0 ? String(intValue) : void 0;
|
|
25792
|
+
};
|
|
25793
|
+
const XML_NODE_NAME$k = "w:caps";
|
|
25794
|
+
const SD_ATTR_KEY$6 = "textTransform";
|
|
25795
|
+
const encode$u = (params, encodedAttrs = {}) => {
|
|
25796
|
+
const { nodes } = params;
|
|
25797
|
+
const node = nodes[0];
|
|
25798
|
+
if (!node) return void 0;
|
|
25799
|
+
let result;
|
|
25800
|
+
if (!["false", "0"].includes(encodedAttrs.val)) {
|
|
25801
|
+
result = "uppercase";
|
|
25802
|
+
} else {
|
|
25803
|
+
return void 0;
|
|
25804
|
+
}
|
|
25805
|
+
return {
|
|
25806
|
+
type: "attr",
|
|
25807
|
+
xmlName: XML_NODE_NAME$k,
|
|
25808
|
+
sdNodeOrKeyName: SD_ATTR_KEY$6,
|
|
25809
|
+
attributes: { [SD_ATTR_KEY$6]: result }
|
|
25810
|
+
};
|
|
25811
|
+
};
|
|
25812
|
+
const config$i = {
|
|
25813
|
+
xmlName: XML_NODE_NAME$k,
|
|
25814
|
+
sdNodeOrKeyName: SD_ATTR_KEY$6,
|
|
25815
|
+
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25816
|
+
encode: encode$u,
|
|
25817
|
+
attributes: [createAttributeHandler("w:val")]
|
|
25818
|
+
};
|
|
25819
|
+
const translator$Y = NodeTranslator.from(config$i);
|
|
25709
25820
|
const runPropertyTranslators = Object.freeze({
|
|
25710
|
-
"w:b": translator$
|
|
25711
|
-
"w:i": translator$
|
|
25712
|
-
"w:u": translator$
|
|
25713
|
-
"w:strike": translator
|
|
25714
|
-
"w:color": translator$
|
|
25715
|
-
"w:highlight": translator$
|
|
25716
|
-
"w:rFonts": translator$
|
|
25717
|
-
"w:rStyle": translator
|
|
25718
|
-
"w:sz": translator$
|
|
25719
|
-
"w:szCs": translator$
|
|
25821
|
+
"w:b": translator$15,
|
|
25822
|
+
"w:i": translator$14,
|
|
25823
|
+
"w:u": translator$13,
|
|
25824
|
+
"w:strike": translator$12,
|
|
25825
|
+
"w:color": translator$11,
|
|
25826
|
+
"w:highlight": translator$18,
|
|
25827
|
+
"w:rFonts": translator$10,
|
|
25828
|
+
"w:rStyle": translator$$,
|
|
25829
|
+
"w:sz": translator$_,
|
|
25830
|
+
"w:szCs": translator$Z,
|
|
25831
|
+
"w:caps": translator$Y
|
|
25720
25832
|
});
|
|
25721
25833
|
const rawRunPropertyXmlNames = Object.freeze(["w:lang", "w:shd"]);
|
|
25722
25834
|
const RAW_CHILD_NAME_SET = new Set(rawRunPropertyXmlNames);
|
|
@@ -25730,9 +25842,9 @@ const toRunPropertyEntry = (candidate) => {
|
|
|
25730
25842
|
attributes: { ...candidate.attributes || {} }
|
|
25731
25843
|
};
|
|
25732
25844
|
};
|
|
25733
|
-
const XML_NODE_NAME$
|
|
25845
|
+
const XML_NODE_NAME$j = "w:rPr";
|
|
25734
25846
|
const SD_ATTR_KEY$5 = "runProperties";
|
|
25735
|
-
const encode$
|
|
25847
|
+
const encode$t = (params) => {
|
|
25736
25848
|
const { nodes } = params;
|
|
25737
25849
|
const node = nodes?.[0] || {};
|
|
25738
25850
|
const contents = Array.isArray(node.elements) ? node.elements : [];
|
|
@@ -25766,16 +25878,16 @@ const encode$r = (params) => {
|
|
|
25766
25878
|
attributes: runPropsArray
|
|
25767
25879
|
};
|
|
25768
25880
|
};
|
|
25769
|
-
const config$
|
|
25770
|
-
xmlName: XML_NODE_NAME$
|
|
25881
|
+
const config$h = {
|
|
25882
|
+
xmlName: XML_NODE_NAME$j,
|
|
25771
25883
|
sdNodeOrKeyName: SD_ATTR_KEY$5,
|
|
25772
25884
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25773
|
-
encode: encode$
|
|
25885
|
+
encode: encode$t
|
|
25774
25886
|
};
|
|
25775
|
-
const translator$
|
|
25887
|
+
const translator$X = NodeTranslator.from(config$h);
|
|
25776
25888
|
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;
|
|
25777
25889
|
const containsEastAsianCharacters = (text) => EAST_ASIAN_CHARACTER_REGEX.test(text);
|
|
25778
|
-
const collectRunProperties = (params, rPrNode, translator2 = translator$
|
|
25890
|
+
const collectRunProperties = (params, rPrNode, translator2 = translator$X) => {
|
|
25779
25891
|
if (!rPrNode) return { entries: [], hadRPr: false, styleChangeMarks: [] };
|
|
25780
25892
|
const result = translator2.encode({ ...params, nodes: [rPrNode] }) || {};
|
|
25781
25893
|
let entries = [];
|
|
@@ -25844,7 +25956,10 @@ const applyRunMarks = (node, inlineMarks, textStyleAttrs) => {
|
|
|
25844
25956
|
};
|
|
25845
25957
|
const deriveStyleMarks = ({ docx, paragraphStyleId, runStyleId }) => {
|
|
25846
25958
|
const paragraphStyleMarks = collectStyleMarks(paragraphStyleId, docx);
|
|
25847
|
-
|
|
25959
|
+
if (paragraphStyleId?.startsWith("TOC")) {
|
|
25960
|
+
return paragraphStyleMarks;
|
|
25961
|
+
}
|
|
25962
|
+
let runStyleMarks = collectStyleMarks(runStyleId, docx);
|
|
25848
25963
|
const inlineMarks = mergeInlineMarkSets(paragraphStyleMarks.inlineMarks, runStyleMarks.inlineMarks);
|
|
25849
25964
|
const textStyleAttrs = mergeTextStyleAttrs(paragraphStyleMarks.textStyleAttrs, runStyleMarks.textStyleAttrs);
|
|
25850
25965
|
return { inlineMarks, textStyleAttrs };
|
|
@@ -26070,6 +26185,13 @@ const splitRunProperties = (entries = [], docx = null) => {
|
|
|
26070
26185
|
}
|
|
26071
26186
|
break;
|
|
26072
26187
|
}
|
|
26188
|
+
case "w:caps": {
|
|
26189
|
+
if (attributes["textTransform"] != null) {
|
|
26190
|
+
hasTextStyle = true;
|
|
26191
|
+
textStyleAttrs.textTransform = attributes["textTransform"];
|
|
26192
|
+
}
|
|
26193
|
+
break;
|
|
26194
|
+
}
|
|
26073
26195
|
case "w:rFonts": {
|
|
26074
26196
|
const asciiFamily = attributes["w:ascii"] || attributes["w:hAnsi"] || (attributes["w:eastAsia"] ? void 0 : attributes["w:val"]);
|
|
26075
26197
|
const eastAsiaFamily = attributes["w:eastAsia"];
|
|
@@ -26089,9 +26211,10 @@ const splitRunProperties = (entries = [], docx = null) => {
|
|
|
26089
26211
|
case "w:sz":
|
|
26090
26212
|
case "w:szCs": {
|
|
26091
26213
|
const rawSize = Number(attributes["w:val"]);
|
|
26214
|
+
const attrName = entry.xmlName === "w:sz" ? "fontSize" : "fontSizeCs";
|
|
26092
26215
|
if (Number.isFinite(rawSize) && rawSize > 0) {
|
|
26093
26216
|
hasTextStyle = true;
|
|
26094
|
-
textStyleAttrs
|
|
26217
|
+
textStyleAttrs[attrName] = `${rawSize / 2}pt`;
|
|
26095
26218
|
}
|
|
26096
26219
|
break;
|
|
26097
26220
|
}
|
|
@@ -26237,46 +26360,166 @@ const ensureTrackedWrapper = (runs, trackingMarksByType = /* @__PURE__ */ new Ma
|
|
|
26237
26360
|
}
|
|
26238
26361
|
return runs;
|
|
26239
26362
|
};
|
|
26240
|
-
const
|
|
26363
|
+
const XML_NODE_NAME$i = "w:hyperlink";
|
|
26364
|
+
const SD_NODE_NAME$c = "link";
|
|
26365
|
+
const _createAttributeHandler = (xmlName, sdName) => ({
|
|
26366
|
+
xmlName,
|
|
26367
|
+
sdName,
|
|
26368
|
+
encode: (attributes) => attributes[xmlName],
|
|
26369
|
+
decode: (attributes) => attributes[sdName]
|
|
26370
|
+
});
|
|
26371
|
+
const validXmlAttributes$a = [
|
|
26372
|
+
_createAttributeHandler("w:anchor", "anchor"),
|
|
26373
|
+
_createAttributeHandler("w:docLocation", "docLocation"),
|
|
26374
|
+
{
|
|
26375
|
+
xmlName: "w:history",
|
|
26376
|
+
sdName: "history",
|
|
26377
|
+
encode: (attributes) => attributes["w:history"] === "1" || attributes["w:history"] === "true",
|
|
26378
|
+
decode: (attributes) => attributes["history"] ? "1" : "0"
|
|
26379
|
+
},
|
|
26380
|
+
_createAttributeHandler("w:tooltip", "tooltip"),
|
|
26381
|
+
_createAttributeHandler("r:id", "rId"),
|
|
26382
|
+
_createAttributeHandler("w:tgtFrame", "target")
|
|
26383
|
+
];
|
|
26384
|
+
const encode$s = (params, encodedAttrs) => {
|
|
26385
|
+
const { nodes, docx, nodeListHandler } = params;
|
|
26386
|
+
const node = nodes[0];
|
|
26387
|
+
let href = _resolveHref(docx, encodedAttrs);
|
|
26388
|
+
const linkMark = { type: "link", attrs: { ...encodedAttrs, href } };
|
|
26389
|
+
const referenceNodeTypes = ["sd:pageReference", "sd:autoPageNumber", "sd:totalPageNumber"];
|
|
26390
|
+
const contentNodes = node.elements.filter((el) => el.name === "w:r" || referenceNodeTypes.includes(el.name));
|
|
26391
|
+
contentNodes.forEach((contentNode) => {
|
|
26392
|
+
const existingMarks = Array.isArray(contentNode.marks) ? contentNode.marks : [];
|
|
26393
|
+
const marksWithoutLink = existingMarks.filter((mark) => mark?.type !== "link");
|
|
26394
|
+
contentNode.marks = [...marksWithoutLink, linkMark];
|
|
26395
|
+
});
|
|
26396
|
+
const updatedNode = nodeListHandler.handler({
|
|
26397
|
+
...params,
|
|
26398
|
+
nodes: contentNodes,
|
|
26399
|
+
path: [...params.path || [], node]
|
|
26400
|
+
});
|
|
26401
|
+
return updatedNode;
|
|
26402
|
+
};
|
|
26403
|
+
const _resolveHref = (docx, encodedAttrs) => {
|
|
26404
|
+
const rels = docx["word/_rels/document.xml.rels"];
|
|
26405
|
+
const relationships = rels.elements.find((el) => el.name === "Relationships");
|
|
26406
|
+
const { elements } = relationships;
|
|
26407
|
+
const { rId, anchor } = encodedAttrs;
|
|
26408
|
+
let href;
|
|
26409
|
+
if (!rId && anchor) {
|
|
26410
|
+
href = `#${anchor}`;
|
|
26411
|
+
} else if (rId) {
|
|
26412
|
+
const rel = elements.find((el) => el.attributes["Id"] === rId) || {};
|
|
26413
|
+
const { attributes: relAttributes = {} } = rel;
|
|
26414
|
+
href = relAttributes["Target"];
|
|
26415
|
+
}
|
|
26416
|
+
return href;
|
|
26417
|
+
};
|
|
26418
|
+
function decode$s(params) {
|
|
26419
|
+
const { hyperlinkGroup = [params.node] } = params.extraParams || {};
|
|
26420
|
+
const node = hyperlinkGroup[0];
|
|
26421
|
+
const linkMark = node.marks.find((m2) => m2.type === "link");
|
|
26422
|
+
const linkAttrs = this.decodeAttributes({ ...params, node: linkMark });
|
|
26423
|
+
let { anchor, href: link } = linkMark.attrs;
|
|
26424
|
+
const isExternalLink = !anchor;
|
|
26425
|
+
if (isExternalLink) {
|
|
26426
|
+
linkAttrs["r:id"] = _addNewLinkRelationship(params, link, linkAttrs["r:id"]);
|
|
26427
|
+
}
|
|
26428
|
+
let contentNodes = [];
|
|
26429
|
+
hyperlinkGroup.forEach((linkNode) => {
|
|
26430
|
+
if ("marks" in linkNode) {
|
|
26431
|
+
linkNode.marks = linkNode.marks.filter((m2) => m2.type !== "link");
|
|
26432
|
+
} else {
|
|
26433
|
+
linkNode.attrs.marksAsAttrs = linkNode.attrs.marksAsAttrs.filter((m2) => m2.type !== "link");
|
|
26434
|
+
}
|
|
26435
|
+
const outputNode = exportSchemaToJson({ ...params, node: linkNode });
|
|
26436
|
+
if (outputNode) {
|
|
26437
|
+
if (outputNode instanceof Array) contentNodes.push(...outputNode);
|
|
26438
|
+
else contentNodes.push(outputNode);
|
|
26439
|
+
}
|
|
26440
|
+
});
|
|
26441
|
+
const newNode = {
|
|
26442
|
+
name: "w:hyperlink",
|
|
26443
|
+
type: "element",
|
|
26444
|
+
attributes: {
|
|
26445
|
+
...linkAttrs
|
|
26446
|
+
},
|
|
26447
|
+
elements: contentNodes
|
|
26448
|
+
};
|
|
26449
|
+
return newNode;
|
|
26450
|
+
}
|
|
26451
|
+
function _addNewLinkRelationship(params, link, rId) {
|
|
26452
|
+
if (!rId) rId = generateDocxRandomId();
|
|
26453
|
+
if (!params.relationships || !Array.isArray(params.relationships)) {
|
|
26454
|
+
params.relationships = [];
|
|
26455
|
+
}
|
|
26456
|
+
const existingRel = params.relationships.find(
|
|
26457
|
+
(rel) => rel.attributes && rel.attributes.Id === rId && rel.attributes.Target === link
|
|
26458
|
+
);
|
|
26459
|
+
if (existingRel) {
|
|
26460
|
+
return rId;
|
|
26461
|
+
}
|
|
26462
|
+
params.relationships.push({
|
|
26463
|
+
type: "element",
|
|
26464
|
+
name: "Relationship",
|
|
26465
|
+
attributes: {
|
|
26466
|
+
Id: rId,
|
|
26467
|
+
Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
|
|
26468
|
+
Target: link,
|
|
26469
|
+
TargetMode: "External"
|
|
26470
|
+
}
|
|
26471
|
+
});
|
|
26472
|
+
return rId;
|
|
26473
|
+
}
|
|
26474
|
+
const config$g = {
|
|
26475
|
+
xmlName: XML_NODE_NAME$i,
|
|
26476
|
+
sdNodeOrKeyName: SD_NODE_NAME$c,
|
|
26477
|
+
type: NodeTranslator.translatorTypes.NODE,
|
|
26478
|
+
encode: encode$s,
|
|
26479
|
+
decode: decode$s,
|
|
26480
|
+
attributes: validXmlAttributes$a
|
|
26481
|
+
};
|
|
26482
|
+
const translator$W = NodeTranslator.from(config$g);
|
|
26483
|
+
const encode$r = (attributes) => {
|
|
26241
26484
|
return attributes["w:rsidR"];
|
|
26242
26485
|
};
|
|
26243
|
-
const decode$
|
|
26486
|
+
const decode$r = (attrs) => {
|
|
26244
26487
|
return attrs.rsidR;
|
|
26245
26488
|
};
|
|
26246
26489
|
const attrConfig$9 = Object.freeze({
|
|
26247
26490
|
xmlName: "w:rsidR",
|
|
26248
26491
|
sdName: "rsidR",
|
|
26249
|
-
encode: encode$
|
|
26250
|
-
decode: decode$
|
|
26492
|
+
encode: encode$r,
|
|
26493
|
+
decode: decode$r
|
|
26251
26494
|
});
|
|
26252
|
-
const encode$
|
|
26495
|
+
const encode$q = (attributes) => {
|
|
26253
26496
|
return attributes["w:rsidRPr"];
|
|
26254
26497
|
};
|
|
26255
|
-
const decode$
|
|
26498
|
+
const decode$q = (attrs) => {
|
|
26256
26499
|
return attrs.rsidRPr;
|
|
26257
26500
|
};
|
|
26258
26501
|
const attrConfig$8 = Object.freeze({
|
|
26259
26502
|
xmlName: "w:rsidRPr",
|
|
26260
26503
|
sdName: "rsidRPr",
|
|
26261
|
-
encode: encode$
|
|
26262
|
-
decode: decode$
|
|
26504
|
+
encode: encode$q,
|
|
26505
|
+
decode: decode$q
|
|
26263
26506
|
});
|
|
26264
|
-
const encode$
|
|
26507
|
+
const encode$p = (attributes) => {
|
|
26265
26508
|
return attributes["w:rsidDel"];
|
|
26266
26509
|
};
|
|
26267
|
-
const decode$
|
|
26510
|
+
const decode$p = (attrs) => {
|
|
26268
26511
|
return attrs.rsidDel;
|
|
26269
26512
|
};
|
|
26270
26513
|
const attrConfig$7 = Object.freeze({
|
|
26271
26514
|
xmlName: "w:rsidDel",
|
|
26272
26515
|
sdName: "rsidDel",
|
|
26273
|
-
encode: encode$
|
|
26274
|
-
decode: decode$
|
|
26516
|
+
encode: encode$p,
|
|
26517
|
+
decode: decode$p
|
|
26275
26518
|
});
|
|
26276
|
-
const validXmlAttributes$
|
|
26277
|
-
const XML_NODE_NAME$
|
|
26519
|
+
const validXmlAttributes$9 = [attrConfig$9, attrConfig$8, attrConfig$7];
|
|
26520
|
+
const XML_NODE_NAME$h = "w:r";
|
|
26278
26521
|
const SD_KEY_NAME = "run";
|
|
26279
|
-
const encode$
|
|
26522
|
+
const encode$o = (params, encodedAttrs = {}) => {
|
|
26280
26523
|
const { nodes = [], nodeListHandler } = params || {};
|
|
26281
26524
|
const runNode = nodes[0];
|
|
26282
26525
|
if (!runNode) return void 0;
|
|
@@ -26324,9 +26567,11 @@ const encode$n = (params, encodedAttrs = {}) => {
|
|
|
26324
26567
|
}
|
|
26325
26568
|
return runNodeResult;
|
|
26326
26569
|
};
|
|
26327
|
-
const decode$
|
|
26570
|
+
const decode$o = (params, decodedAttrs = {}) => {
|
|
26328
26571
|
const { node } = params || {};
|
|
26329
26572
|
if (!node) return void 0;
|
|
26573
|
+
const isLinkNode = node.marks?.some((m2) => m2.type === "link");
|
|
26574
|
+
if (isLinkNode) return translator$W.decode(params);
|
|
26330
26575
|
const { runNode: runNodeForExport, trackingMarksByType } = prepareRunTrackingContext(node);
|
|
26331
26576
|
const runAttrs = runNodeForExport.attrs || {};
|
|
26332
26577
|
const runProperties = Array.isArray(runAttrs.runProperties) ? runAttrs.runProperties : [];
|
|
@@ -26381,7 +26626,7 @@ const decode$n = (params, decodedAttrs = {}) => {
|
|
|
26381
26626
|
runs.push(trackedClone);
|
|
26382
26627
|
return;
|
|
26383
26628
|
}
|
|
26384
|
-
const runWrapper = { name: XML_NODE_NAME$
|
|
26629
|
+
const runWrapper = { name: XML_NODE_NAME$h, elements: [] };
|
|
26385
26630
|
applyBaseRunProps(runWrapper);
|
|
26386
26631
|
if (!Array.isArray(runWrapper.elements)) runWrapper.elements = [];
|
|
26387
26632
|
runWrapper.elements.push(cloneXmlNode(child));
|
|
@@ -26389,162 +26634,29 @@ const decode$n = (params, decodedAttrs = {}) => {
|
|
|
26389
26634
|
});
|
|
26390
26635
|
const trackedRuns = ensureTrackedWrapper(runs, trackingMarksByType);
|
|
26391
26636
|
if (!trackedRuns.length) {
|
|
26392
|
-
const emptyRun = { name: XML_NODE_NAME$
|
|
26637
|
+
const emptyRun = { name: XML_NODE_NAME$h, elements: [] };
|
|
26393
26638
|
applyBaseRunProps(emptyRun);
|
|
26394
26639
|
trackedRuns.push(emptyRun);
|
|
26395
26640
|
}
|
|
26396
|
-
if (decodedAttrs && Object.keys(decodedAttrs).length) {
|
|
26397
|
-
trackedRuns.forEach((run2) => {
|
|
26398
|
-
run2.attributes = { ...run2.attributes || {}, ...decodedAttrs };
|
|
26399
|
-
});
|
|
26400
|
-
}
|
|
26401
|
-
if (trackedRuns.length === 1) {
|
|
26402
|
-
return trackedRuns[0];
|
|
26403
|
-
}
|
|
26404
|
-
return trackedRuns;
|
|
26405
|
-
};
|
|
26406
|
-
const config$e = {
|
|
26407
|
-
xmlName: XML_NODE_NAME$g,
|
|
26408
|
-
sdNodeOrKeyName: SD_KEY_NAME,
|
|
26409
|
-
type: NodeTranslator.translatorTypes.NODE,
|
|
26410
|
-
encode: encode$n,
|
|
26411
|
-
decode: decode$n,
|
|
26412
|
-
attributes: validXmlAttributes$a
|
|
26413
|
-
};
|
|
26414
|
-
const translator$U = NodeTranslator.from(config$e);
|
|
26415
|
-
const generateV2HandlerEntity = (handlerName, translator2) => ({
|
|
26416
|
-
handlerName,
|
|
26417
|
-
handler: (params) => {
|
|
26418
|
-
const { nodes } = params;
|
|
26419
|
-
if (nodes.length === 0 || nodes[0].name !== translator2.xmlName) {
|
|
26420
|
-
return { nodes: [], consumed: 0 };
|
|
26421
|
-
}
|
|
26422
|
-
const result = translator2.encode(params);
|
|
26423
|
-
if (!result) return { nodes: [], consumed: 0 };
|
|
26424
|
-
return {
|
|
26425
|
-
nodes: Array.isArray(result) ? result : [result],
|
|
26426
|
-
consumed: 1
|
|
26427
|
-
};
|
|
26428
|
-
}
|
|
26429
|
-
});
|
|
26430
|
-
function createSingleAttrPropertyHandler(xmlName, sdName = null, attrName = "w:val", transformEncode = null, transformDecode = null) {
|
|
26431
|
-
if (!sdName) sdName = xmlName.split(":")[1];
|
|
26432
|
-
if (!transformEncode) transformEncode = (v2) => v2;
|
|
26433
|
-
if (!transformDecode) transformDecode = (v2) => v2;
|
|
26434
|
-
return {
|
|
26435
|
-
xmlName,
|
|
26436
|
-
sdNodeOrKeyName: sdName,
|
|
26437
|
-
encode: ({ nodes }) => {
|
|
26438
|
-
return transformEncode(nodes[0].attributes[attrName]) ?? void 0;
|
|
26439
|
-
},
|
|
26440
|
-
decode: ({ node }) => {
|
|
26441
|
-
const value = node.attrs?.[sdName] != null ? transformDecode(node.attrs[sdName]) : void 0;
|
|
26442
|
-
return value != null ? { name: xmlName, attributes: { [attrName]: value } } : void 0;
|
|
26443
|
-
}
|
|
26444
|
-
};
|
|
26445
|
-
}
|
|
26446
|
-
function createMeasurementPropertyHandler(xmlName, sdName = null) {
|
|
26447
|
-
if (!sdName) sdName = xmlName.split(":")[1];
|
|
26448
|
-
return {
|
|
26449
|
-
xmlName,
|
|
26450
|
-
sdNodeOrKeyName: sdName,
|
|
26451
|
-
attributes: [
|
|
26452
|
-
createAttributeHandler("w:w", "value", parseInteger, integerToString),
|
|
26453
|
-
createAttributeHandler("w:type")
|
|
26454
|
-
],
|
|
26455
|
-
encode: (_2, encodedAttrs) => {
|
|
26456
|
-
return encodedAttrs["value"] != null ? encodedAttrs : void 0;
|
|
26457
|
-
},
|
|
26458
|
-
decode: function({ node }) {
|
|
26459
|
-
const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
|
|
26460
|
-
return decodedAttrs["w:w"] != null ? { attributes: decodedAttrs } : void 0;
|
|
26461
|
-
}
|
|
26462
|
-
};
|
|
26463
|
-
}
|
|
26464
|
-
function createBorderPropertyHandler(xmlName, sdName = null) {
|
|
26465
|
-
if (!sdName) sdName = xmlName.split(":")[1];
|
|
26466
|
-
return {
|
|
26467
|
-
xmlName,
|
|
26468
|
-
sdNodeOrKeyName: sdName,
|
|
26469
|
-
attributes: [
|
|
26470
|
-
createAttributeHandler("w:val"),
|
|
26471
|
-
createAttributeHandler("w:color"),
|
|
26472
|
-
createAttributeHandler("w:themeColor"),
|
|
26473
|
-
createAttributeHandler("w:themeTint"),
|
|
26474
|
-
createAttributeHandler("w:themeShade"),
|
|
26475
|
-
createAttributeHandler("w:sz", "size", parseInteger, integerToString),
|
|
26476
|
-
createAttributeHandler("w:space", null, parseInteger, integerToString),
|
|
26477
|
-
createAttributeHandler("w:shadow", null, parseBoolean, booleanToString),
|
|
26478
|
-
createAttributeHandler("w:frame", null, parseBoolean, booleanToString)
|
|
26479
|
-
],
|
|
26480
|
-
encode: (params, encodedAttrs) => {
|
|
26481
|
-
return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
|
|
26482
|
-
},
|
|
26483
|
-
decode: function({ node }, context) {
|
|
26484
|
-
const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
|
|
26485
|
-
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
26486
|
-
}
|
|
26487
|
-
};
|
|
26488
|
-
}
|
|
26489
|
-
const createAttributeHandler = (xmlName, sdName = null, transformEncode = null, transformDecode = null) => {
|
|
26490
|
-
if (!transformEncode) transformEncode = (v2) => v2;
|
|
26491
|
-
if (!transformDecode) transformDecode = (v2) => v2;
|
|
26492
|
-
if (!sdName) sdName = xmlName.split(":")[1];
|
|
26493
|
-
return {
|
|
26494
|
-
xmlName,
|
|
26495
|
-
sdName,
|
|
26496
|
-
encode: (attributes) => transformEncode(attributes[xmlName]),
|
|
26497
|
-
decode: (attributes) => transformDecode(attributes[sdName])
|
|
26498
|
-
};
|
|
26499
|
-
};
|
|
26500
|
-
function encodeProperties(node, translatorsByXmlName, asArray = false) {
|
|
26501
|
-
if (!node?.elements || node.elements.length === 0) {
|
|
26502
|
-
return asArray ? [] : {};
|
|
26503
|
-
}
|
|
26504
|
-
const attributes = asArray ? [] : {};
|
|
26505
|
-
node.elements.forEach((el) => {
|
|
26506
|
-
const translator2 = translatorsByXmlName[el.name];
|
|
26507
|
-
if (translator2) {
|
|
26508
|
-
const encodedAttr = translator2.encode({ nodes: [el] });
|
|
26509
|
-
if (encodedAttr != null) {
|
|
26510
|
-
if (asArray) {
|
|
26511
|
-
attributes.push({ [translator2.sdNodeOrKeyName]: encodedAttr });
|
|
26512
|
-
} else {
|
|
26513
|
-
attributes[translator2.sdNodeOrKeyName] = encodedAttr;
|
|
26514
|
-
}
|
|
26515
|
-
}
|
|
26516
|
-
}
|
|
26517
|
-
});
|
|
26518
|
-
return attributes;
|
|
26519
|
-
}
|
|
26520
|
-
function decodeProperties(translatorsBySdName, properties) {
|
|
26521
|
-
if (!properties || typeof properties !== "object") {
|
|
26522
|
-
return [];
|
|
26523
|
-
}
|
|
26524
|
-
const elements = [];
|
|
26525
|
-
Object.keys(properties).forEach((key) => {
|
|
26526
|
-
const translator2 = translatorsBySdName[key];
|
|
26527
|
-
if (translator2) {
|
|
26528
|
-
const result = translator2.decode({ node: { attrs: { [key]: properties[key] } } });
|
|
26529
|
-
if (result != null) {
|
|
26530
|
-
result.name = translator2.xmlName;
|
|
26531
|
-
elements.push(result);
|
|
26532
|
-
}
|
|
26533
|
-
}
|
|
26534
|
-
});
|
|
26535
|
-
return elements;
|
|
26536
|
-
}
|
|
26537
|
-
const parseBoolean = (value) => value != null ? ["1", "true"].includes(value) : void 0;
|
|
26538
|
-
const booleanToString = (value) => value != null ? value ? "1" : "0" : void 0;
|
|
26539
|
-
const parseInteger = (value) => {
|
|
26540
|
-
if (value == null) return void 0;
|
|
26541
|
-
const intValue = parseInt(value, 10);
|
|
26542
|
-
return isNaN(intValue) ? void 0 : intValue;
|
|
26641
|
+
if (decodedAttrs && Object.keys(decodedAttrs).length) {
|
|
26642
|
+
trackedRuns.forEach((run2) => {
|
|
26643
|
+
run2.attributes = { ...run2.attributes || {}, ...decodedAttrs };
|
|
26644
|
+
});
|
|
26645
|
+
}
|
|
26646
|
+
if (trackedRuns.length === 1) {
|
|
26647
|
+
return trackedRuns[0];
|
|
26648
|
+
}
|
|
26649
|
+
return trackedRuns;
|
|
26543
26650
|
};
|
|
26544
|
-
const
|
|
26545
|
-
|
|
26546
|
-
|
|
26651
|
+
const config$f = {
|
|
26652
|
+
xmlName: XML_NODE_NAME$h,
|
|
26653
|
+
sdNodeOrKeyName: SD_KEY_NAME,
|
|
26654
|
+
type: NodeTranslator.translatorTypes.NODE,
|
|
26655
|
+
encode: encode$o,
|
|
26656
|
+
decode: decode$o,
|
|
26657
|
+
attributes: validXmlAttributes$9
|
|
26547
26658
|
};
|
|
26659
|
+
const translator$V = NodeTranslator.from(config$f);
|
|
26548
26660
|
function preProcessVerticalMergeCells(table, { editorSchema }) {
|
|
26549
26661
|
if (!table || !Array.isArray(table.content)) {
|
|
26550
26662
|
return table;
|
|
@@ -26585,13 +26697,13 @@ function preProcessVerticalMergeCells(table, { editorSchema }) {
|
|
|
26585
26697
|
}
|
|
26586
26698
|
return table;
|
|
26587
26699
|
}
|
|
26588
|
-
const translator$
|
|
26700
|
+
const translator$U = NodeTranslator.from({
|
|
26589
26701
|
xmlName: "w:cantSplit",
|
|
26590
26702
|
sdNodeOrKeyName: "cantSplit",
|
|
26591
26703
|
encode: ({ nodes }) => ["1", "true"].includes(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
26592
26704
|
decode: ({ node }) => node.attrs?.cantSplit ? { attributes: {} } : void 0
|
|
26593
26705
|
});
|
|
26594
|
-
const translator$
|
|
26706
|
+
const translator$T = NodeTranslator.from({
|
|
26595
26707
|
xmlName: "w:cnfStyle",
|
|
26596
26708
|
sdNodeOrKeyName: "cnfStyle",
|
|
26597
26709
|
attributes: [
|
|
@@ -26617,8 +26729,8 @@ const translator$S = NodeTranslator.from({
|
|
|
26617
26729
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
26618
26730
|
}
|
|
26619
26731
|
});
|
|
26620
|
-
const translator$
|
|
26621
|
-
const translator$
|
|
26732
|
+
const translator$S = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
|
|
26733
|
+
const translator$R = NodeTranslator.from(
|
|
26622
26734
|
createSingleAttrPropertyHandler(
|
|
26623
26735
|
"w:gridAfter",
|
|
26624
26736
|
null,
|
|
@@ -26627,7 +26739,7 @@ const translator$Q = NodeTranslator.from(
|
|
|
26627
26739
|
(v2) => integerToString(v2)
|
|
26628
26740
|
)
|
|
26629
26741
|
);
|
|
26630
|
-
const translator$
|
|
26742
|
+
const translator$Q = NodeTranslator.from(
|
|
26631
26743
|
createSingleAttrPropertyHandler(
|
|
26632
26744
|
"w:gridBefore",
|
|
26633
26745
|
null,
|
|
@@ -26636,21 +26748,21 @@ const translator$P = NodeTranslator.from(
|
|
|
26636
26748
|
(v2) => integerToString(v2)
|
|
26637
26749
|
)
|
|
26638
26750
|
);
|
|
26639
|
-
const translator$
|
|
26751
|
+
const translator$P = NodeTranslator.from({
|
|
26640
26752
|
xmlName: "w:hidden",
|
|
26641
26753
|
sdNodeOrKeyName: "hidden",
|
|
26642
26754
|
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
26643
26755
|
decode: ({ node }) => node.attrs.hidden ? { attributes: {} } : void 0
|
|
26644
26756
|
});
|
|
26645
|
-
const translator$
|
|
26646
|
-
const translator$
|
|
26647
|
-
const translator$
|
|
26757
|
+
const translator$O = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc", "justification"));
|
|
26758
|
+
const translator$N = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "tableCellSpacing"));
|
|
26759
|
+
const translator$M = NodeTranslator.from({
|
|
26648
26760
|
xmlName: "w:tblHeader",
|
|
26649
26761
|
sdNodeOrKeyName: "repeatHeader",
|
|
26650
26762
|
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
26651
26763
|
decode: ({ node }) => node.attrs.repeatHeader ? { attributes: {} } : void 0
|
|
26652
26764
|
});
|
|
26653
|
-
const translator$
|
|
26765
|
+
const translator$L = NodeTranslator.from({
|
|
26654
26766
|
xmlName: "w:trHeight",
|
|
26655
26767
|
sdNodeOrKeyName: "rowHeight",
|
|
26656
26768
|
encode: ({ nodes }) => {
|
|
@@ -26677,11 +26789,11 @@ const translator$K = NodeTranslator.from({
|
|
|
26677
26789
|
return Object.keys(heightAttrs).length > 0 ? { attributes: heightAttrs } : void 0;
|
|
26678
26790
|
}
|
|
26679
26791
|
});
|
|
26680
|
-
const translator$
|
|
26681
|
-
const translator$
|
|
26682
|
-
const XML_NODE_NAME$
|
|
26792
|
+
const translator$K = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
|
|
26793
|
+
const translator$J = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
|
|
26794
|
+
const XML_NODE_NAME$g = "w:trPr";
|
|
26683
26795
|
const SD_ATTR_KEY$4 = "tableRowProperties";
|
|
26684
|
-
const encode$
|
|
26796
|
+
const encode$n = (params) => {
|
|
26685
26797
|
const { nodes } = params;
|
|
26686
26798
|
const node = nodes[0];
|
|
26687
26799
|
let attributes = {
|
|
@@ -26695,12 +26807,12 @@ const encode$m = (params) => {
|
|
|
26695
26807
|
};
|
|
26696
26808
|
return {
|
|
26697
26809
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
26698
|
-
xmlName: XML_NODE_NAME$
|
|
26810
|
+
xmlName: XML_NODE_NAME$g,
|
|
26699
26811
|
sdNodeOrKeyName: SD_ATTR_KEY$4,
|
|
26700
26812
|
attributes
|
|
26701
26813
|
};
|
|
26702
26814
|
};
|
|
26703
|
-
const decode$
|
|
26815
|
+
const decode$n = (params) => {
|
|
26704
26816
|
const { tableRowProperties = {} } = params.node.attrs || {};
|
|
26705
26817
|
const elements = decodeProperties(propertyTranslatorsBySdName$2, tableRowProperties);
|
|
26706
26818
|
const newNode = {
|
|
@@ -26712,6 +26824,7 @@ const decode$m = (params) => {
|
|
|
26712
26824
|
return newNode;
|
|
26713
26825
|
};
|
|
26714
26826
|
const propertyTranslators$3 = [
|
|
26827
|
+
translator$U,
|
|
26715
26828
|
translator$T,
|
|
26716
26829
|
translator$S,
|
|
26717
26830
|
translator$R,
|
|
@@ -26722,8 +26835,7 @@ const propertyTranslators$3 = [
|
|
|
26722
26835
|
translator$M,
|
|
26723
26836
|
translator$L,
|
|
26724
26837
|
translator$K,
|
|
26725
|
-
translator$J
|
|
26726
|
-
translator$I
|
|
26838
|
+
translator$J
|
|
26727
26839
|
];
|
|
26728
26840
|
const propertyTranslatorsByXmlName$2 = {};
|
|
26729
26841
|
propertyTranslators$3.forEach((translator2) => {
|
|
@@ -26733,25 +26845,25 @@ const propertyTranslatorsBySdName$2 = {};
|
|
|
26733
26845
|
propertyTranslators$3.forEach((translator2) => {
|
|
26734
26846
|
propertyTranslatorsBySdName$2[translator2.sdNodeOrKeyName] = translator2;
|
|
26735
26847
|
});
|
|
26736
|
-
const config$
|
|
26737
|
-
xmlName: XML_NODE_NAME$
|
|
26848
|
+
const config$e = {
|
|
26849
|
+
xmlName: XML_NODE_NAME$g,
|
|
26738
26850
|
sdNodeOrKeyName: SD_ATTR_KEY$4,
|
|
26739
26851
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
26740
|
-
encode: encode$
|
|
26741
|
-
decode: decode$
|
|
26852
|
+
encode: encode$n,
|
|
26853
|
+
decode: decode$n
|
|
26742
26854
|
};
|
|
26743
|
-
const translator$
|
|
26744
|
-
const XML_NODE_NAME$
|
|
26745
|
-
const SD_NODE_NAME$
|
|
26746
|
-
const validXmlAttributes$
|
|
26855
|
+
const translator$I = NodeTranslator.from(config$e);
|
|
26856
|
+
const XML_NODE_NAME$f = "w:tr";
|
|
26857
|
+
const SD_NODE_NAME$b = "tableRow";
|
|
26858
|
+
const validXmlAttributes$8 = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
|
|
26747
26859
|
(xmlName) => createAttributeHandler(xmlName)
|
|
26748
26860
|
);
|
|
26749
|
-
const encode$
|
|
26861
|
+
const encode$m = (params, encodedAttrs) => {
|
|
26750
26862
|
const { row } = params.extraParams;
|
|
26751
26863
|
let tableRowProperties = {};
|
|
26752
26864
|
const tPr = row.elements.find((el) => el.name === "w:trPr");
|
|
26753
26865
|
if (tPr) {
|
|
26754
|
-
({ attributes: tableRowProperties } = translator$
|
|
26866
|
+
({ attributes: tableRowProperties } = translator$I.encode({
|
|
26755
26867
|
...params,
|
|
26756
26868
|
nodes: [tPr]
|
|
26757
26869
|
}));
|
|
@@ -26764,7 +26876,7 @@ const encode$l = (params, encodedAttrs) => {
|
|
|
26764
26876
|
let currentColumnIndex = 0;
|
|
26765
26877
|
const content = cellNodes?.map((n) => {
|
|
26766
26878
|
let columnWidth = gridColumnWidths?.[currentColumnIndex] || null;
|
|
26767
|
-
const result = translator$
|
|
26879
|
+
const result = translator$9.encode({
|
|
26768
26880
|
...params,
|
|
26769
26881
|
extraParams: {
|
|
26770
26882
|
...params.extraParams,
|
|
@@ -26786,7 +26898,7 @@ const encode$l = (params, encodedAttrs) => {
|
|
|
26786
26898
|
};
|
|
26787
26899
|
return newNode;
|
|
26788
26900
|
};
|
|
26789
|
-
const decode$
|
|
26901
|
+
const decode$m = (params, decodedAttrs) => {
|
|
26790
26902
|
const { node } = params;
|
|
26791
26903
|
const elements = translateChildNodes(params);
|
|
26792
26904
|
if (node.attrs?.tableRowProperties) {
|
|
@@ -26798,7 +26910,7 @@ const decode$l = (params, decodedAttrs) => {
|
|
|
26798
26910
|
}
|
|
26799
26911
|
}
|
|
26800
26912
|
tableRowProperties["cantSplit"] = node.attrs["cantSplit"];
|
|
26801
|
-
const trPr = translator$
|
|
26913
|
+
const trPr = translator$I.decode({
|
|
26802
26914
|
...params,
|
|
26803
26915
|
node: { ...node, attrs: { ...node.attrs, tableRowProperties } }
|
|
26804
26916
|
});
|
|
@@ -26810,22 +26922,22 @@ const decode$l = (params, decodedAttrs) => {
|
|
|
26810
26922
|
elements
|
|
26811
26923
|
};
|
|
26812
26924
|
};
|
|
26813
|
-
const config$
|
|
26814
|
-
xmlName: XML_NODE_NAME$
|
|
26815
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
26925
|
+
const config$d = {
|
|
26926
|
+
xmlName: XML_NODE_NAME$f,
|
|
26927
|
+
sdNodeOrKeyName: SD_NODE_NAME$b,
|
|
26816
26928
|
type: NodeTranslator.translatorTypes.NODE,
|
|
26817
|
-
encode: encode$
|
|
26818
|
-
decode: decode$
|
|
26819
|
-
attributes: validXmlAttributes$
|
|
26929
|
+
encode: encode$m,
|
|
26930
|
+
decode: decode$m,
|
|
26931
|
+
attributes: validXmlAttributes$8
|
|
26820
26932
|
};
|
|
26821
|
-
const translator$
|
|
26822
|
-
const translator$
|
|
26933
|
+
const translator$H = NodeTranslator.from(config$d);
|
|
26934
|
+
const translator$G = NodeTranslator.from({
|
|
26823
26935
|
xmlName: "w:bidiVisual",
|
|
26824
26936
|
sdNodeOrKeyName: "rightToLeft",
|
|
26825
26937
|
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
26826
26938
|
decode: ({ node }) => node.attrs.rightToLeft ? { attributes: {} } : void 0
|
|
26827
26939
|
});
|
|
26828
|
-
const translator$
|
|
26940
|
+
const translator$F = NodeTranslator.from({
|
|
26829
26941
|
xmlName: "w:shd",
|
|
26830
26942
|
sdNodeOrKeyName: "shading",
|
|
26831
26943
|
attributes: [
|
|
@@ -26847,11 +26959,11 @@ const translator$E = NodeTranslator.from({
|
|
|
26847
26959
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
26848
26960
|
}
|
|
26849
26961
|
});
|
|
26850
|
-
const translator$
|
|
26851
|
-
const translator$
|
|
26852
|
-
const translator$
|
|
26853
|
-
const translator$
|
|
26854
|
-
const translator$
|
|
26962
|
+
const translator$E = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblCaption", "caption"));
|
|
26963
|
+
const translator$D = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblDescription", "description"));
|
|
26964
|
+
const translator$C = NodeTranslator.from(createMeasurementPropertyHandler("w:tblInd", "tableIndent"));
|
|
26965
|
+
const translator$B = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblLayout", "tableLayout", "w:type"));
|
|
26966
|
+
const translator$A = NodeTranslator.from({
|
|
26855
26967
|
xmlName: "w:tblLook",
|
|
26856
26968
|
sdNodeOrKeyName: "tblLook",
|
|
26857
26969
|
attributes: ["w:firstColumn", "w:firstRow", "w:lastColumn", "w:lastRow", "w:noHBand", "w:noVBand"].map((attr) => createAttributeHandler(attr, null, parseBoolean, booleanToString)).concat([createAttributeHandler("w:val")]),
|
|
@@ -26863,16 +26975,16 @@ const translator$z = NodeTranslator.from({
|
|
|
26863
26975
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
26864
26976
|
}
|
|
26865
26977
|
});
|
|
26866
|
-
const translator$
|
|
26867
|
-
const translator$
|
|
26868
|
-
const translator$
|
|
26978
|
+
const translator$z = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblOverlap", "overlap"));
|
|
26979
|
+
const translator$y = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblStyle", "tableStyleId"));
|
|
26980
|
+
const translator$x = NodeTranslator.from(
|
|
26869
26981
|
createSingleAttrPropertyHandler("w:tblStyleColBandSize", "tableStyleColBandSize")
|
|
26870
26982
|
);
|
|
26871
|
-
const translator$
|
|
26983
|
+
const translator$w = NodeTranslator.from(
|
|
26872
26984
|
createSingleAttrPropertyHandler("w:tblStyleRowBandSize", "tableStyleRowBandSize")
|
|
26873
26985
|
);
|
|
26874
|
-
const translator$
|
|
26875
|
-
const translator$
|
|
26986
|
+
const translator$v = NodeTranslator.from(createMeasurementPropertyHandler("w:tblW", "tableWidth"));
|
|
26987
|
+
const translator$u = NodeTranslator.from({
|
|
26876
26988
|
xmlName: "w:tblpPr",
|
|
26877
26989
|
sdNodeOrKeyName: "floatingTableProperties",
|
|
26878
26990
|
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))),
|
|
@@ -26884,29 +26996,29 @@ const translator$t = NodeTranslator.from({
|
|
|
26884
26996
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
26885
26997
|
}
|
|
26886
26998
|
});
|
|
26887
|
-
const translator$
|
|
26888
|
-
const translator$
|
|
26889
|
-
const translator$
|
|
26890
|
-
const translator$
|
|
26891
|
-
const translator$
|
|
26892
|
-
const translator$
|
|
26893
|
-
const translator$
|
|
26894
|
-
const translator$
|
|
26895
|
-
const translator$
|
|
26896
|
-
const translator$
|
|
26897
|
-
const translator$
|
|
26898
|
-
const translator$
|
|
26899
|
-
const translator$
|
|
26900
|
-
const translator$
|
|
26901
|
-
const XML_NODE_NAME$
|
|
26999
|
+
const translator$t = NodeTranslator.from(createBorderPropertyHandler("w:bottom"));
|
|
27000
|
+
const translator$s = NodeTranslator.from(createMeasurementPropertyHandler("w:bottom", "marginBottom"));
|
|
27001
|
+
const translator$r = NodeTranslator.from(createBorderPropertyHandler("w:end"));
|
|
27002
|
+
const translator$q = NodeTranslator.from(createMeasurementPropertyHandler("w:end", "marginEnd"));
|
|
27003
|
+
const translator$p = NodeTranslator.from(createBorderPropertyHandler("w:insideH"));
|
|
27004
|
+
const translator$o = NodeTranslator.from(createBorderPropertyHandler("w:insideV"));
|
|
27005
|
+
const translator$n = NodeTranslator.from(createBorderPropertyHandler("w:left"));
|
|
27006
|
+
const translator$m = NodeTranslator.from(createMeasurementPropertyHandler("w:left", "marginLeft"));
|
|
27007
|
+
const translator$l = NodeTranslator.from(createBorderPropertyHandler("w:right"));
|
|
27008
|
+
const translator$k = NodeTranslator.from(createMeasurementPropertyHandler("w:right", "marginRight"));
|
|
27009
|
+
const translator$j = NodeTranslator.from(createBorderPropertyHandler("w:start"));
|
|
27010
|
+
const translator$i = NodeTranslator.from(createMeasurementPropertyHandler("w:start", "marginStart"));
|
|
27011
|
+
const translator$h = NodeTranslator.from(createBorderPropertyHandler("w:top"));
|
|
27012
|
+
const translator$g = NodeTranslator.from(createMeasurementPropertyHandler("w:top", "marginTop"));
|
|
27013
|
+
const XML_NODE_NAME$e = "w:tblBorders";
|
|
26902
27014
|
const SD_ATTR_KEY$3 = "borders";
|
|
26903
|
-
const encode$
|
|
27015
|
+
const encode$l = (params) => {
|
|
26904
27016
|
const { nodes } = params;
|
|
26905
27017
|
const node = nodes[0];
|
|
26906
27018
|
const attributes = encodeProperties(node, tblBordersTranslatorsByXmlName);
|
|
26907
27019
|
return Object.keys(attributes).length > 0 ? attributes : void 0;
|
|
26908
27020
|
};
|
|
26909
|
-
const decode$
|
|
27021
|
+
const decode$l = (params) => {
|
|
26910
27022
|
const { borders = {} } = params.node.attrs || {};
|
|
26911
27023
|
const elements = decodeProperties(tblBordersTranslatorsBySdName, borders);
|
|
26912
27024
|
const newNode = {
|
|
@@ -26918,14 +27030,14 @@ const decode$k = (params) => {
|
|
|
26918
27030
|
return newNode;
|
|
26919
27031
|
};
|
|
26920
27032
|
const propertyTranslators$2 = [
|
|
26921
|
-
translator$
|
|
26922
|
-
translator$
|
|
27033
|
+
translator$t,
|
|
27034
|
+
translator$r,
|
|
27035
|
+
translator$p,
|
|
26923
27036
|
translator$o,
|
|
26924
27037
|
translator$n,
|
|
26925
|
-
translator$
|
|
26926
|
-
translator$
|
|
26927
|
-
translator$
|
|
26928
|
-
translator$g
|
|
27038
|
+
translator$l,
|
|
27039
|
+
translator$j,
|
|
27040
|
+
translator$h
|
|
26929
27041
|
];
|
|
26930
27042
|
const tblBordersTranslatorsByXmlName = {};
|
|
26931
27043
|
const tblBordersTranslatorsBySdName = {};
|
|
@@ -26933,27 +27045,27 @@ propertyTranslators$2.forEach((translator2) => {
|
|
|
26933
27045
|
tblBordersTranslatorsByXmlName[translator2.xmlName] = translator2;
|
|
26934
27046
|
tblBordersTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
|
|
26935
27047
|
});
|
|
26936
|
-
const translator$
|
|
26937
|
-
xmlName: XML_NODE_NAME$
|
|
27048
|
+
const translator$f = NodeTranslator.from({
|
|
27049
|
+
xmlName: XML_NODE_NAME$e,
|
|
26938
27050
|
sdNodeOrKeyName: SD_ATTR_KEY$3,
|
|
26939
27051
|
type: NodeTranslator.translatorTypes.NODE,
|
|
26940
27052
|
attributes: [],
|
|
26941
|
-
encode: encode$
|
|
26942
|
-
decode: decode$
|
|
27053
|
+
encode: encode$l,
|
|
27054
|
+
decode: decode$l
|
|
26943
27055
|
});
|
|
26944
|
-
const XML_NODE_NAME$
|
|
27056
|
+
const XML_NODE_NAME$d = "w:tblCellMar";
|
|
26945
27057
|
const SD_ATTR_KEY$2 = "cellMargins";
|
|
26946
|
-
const encode$
|
|
27058
|
+
const encode$k = (params) => {
|
|
26947
27059
|
const { nodes } = params;
|
|
26948
27060
|
const node = nodes[0];
|
|
26949
27061
|
const attributes = encodeProperties(node, propertyTranslatorsByXmlName$1);
|
|
26950
27062
|
return Object.keys(attributes).length > 0 ? attributes : void 0;
|
|
26951
27063
|
};
|
|
26952
|
-
const decode$
|
|
27064
|
+
const decode$k = (params) => {
|
|
26953
27065
|
const { cellMargins = {} } = params.node.attrs || {};
|
|
26954
27066
|
const elements = decodeProperties(propertyTranslatorsBySdName$1, cellMargins);
|
|
26955
27067
|
const newNode = {
|
|
26956
|
-
name: XML_NODE_NAME$
|
|
27068
|
+
name: XML_NODE_NAME$d,
|
|
26957
27069
|
type: "element",
|
|
26958
27070
|
attributes: {},
|
|
26959
27071
|
elements
|
|
@@ -26961,12 +27073,12 @@ const decode$j = (params) => {
|
|
|
26961
27073
|
return newNode;
|
|
26962
27074
|
};
|
|
26963
27075
|
const propertyTranslators$1 = [
|
|
26964
|
-
translator$
|
|
26965
|
-
translator$
|
|
26966
|
-
translator$
|
|
26967
|
-
translator$
|
|
26968
|
-
translator$
|
|
26969
|
-
translator$
|
|
27076
|
+
translator$s,
|
|
27077
|
+
translator$q,
|
|
27078
|
+
translator$m,
|
|
27079
|
+
translator$k,
|
|
27080
|
+
translator$i,
|
|
27081
|
+
translator$g
|
|
26970
27082
|
];
|
|
26971
27083
|
const propertyTranslatorsByXmlName$1 = {};
|
|
26972
27084
|
const propertyTranslatorsBySdName$1 = {};
|
|
@@ -26974,27 +27086,27 @@ propertyTranslators$1.forEach((translator2) => {
|
|
|
26974
27086
|
propertyTranslatorsByXmlName$1[translator2.xmlName] = translator2;
|
|
26975
27087
|
propertyTranslatorsBySdName$1[translator2.sdNodeOrKeyName] = translator2;
|
|
26976
27088
|
});
|
|
26977
|
-
const translator$
|
|
26978
|
-
xmlName: XML_NODE_NAME$
|
|
27089
|
+
const translator$e = NodeTranslator.from({
|
|
27090
|
+
xmlName: XML_NODE_NAME$d,
|
|
26979
27091
|
sdNodeOrKeyName: SD_ATTR_KEY$2,
|
|
26980
27092
|
type: NodeTranslator.translatorTypes.NODE,
|
|
26981
27093
|
attributes: [],
|
|
26982
|
-
encode: encode$
|
|
26983
|
-
decode: decode$
|
|
27094
|
+
encode: encode$k,
|
|
27095
|
+
decode: decode$k
|
|
26984
27096
|
});
|
|
26985
|
-
const XML_NODE_NAME$
|
|
27097
|
+
const XML_NODE_NAME$c = "w:tblPr";
|
|
26986
27098
|
const SD_ATTR_KEY$1 = "tableProperties";
|
|
26987
|
-
const encode$
|
|
27099
|
+
const encode$j = (params) => {
|
|
26988
27100
|
const { nodes } = params;
|
|
26989
27101
|
const node = nodes[0];
|
|
26990
27102
|
const attributes = encodeProperties(node, propertyTranslatorsByXmlName);
|
|
26991
27103
|
return {
|
|
26992
|
-
xmlName: XML_NODE_NAME$
|
|
27104
|
+
xmlName: XML_NODE_NAME$c,
|
|
26993
27105
|
sdNodeOrKeyName: SD_ATTR_KEY$1,
|
|
26994
27106
|
attributes
|
|
26995
27107
|
};
|
|
26996
27108
|
};
|
|
26997
|
-
const decode$
|
|
27109
|
+
const decode$j = (params) => {
|
|
26998
27110
|
const { tableProperties = {} } = params.node.attrs || {};
|
|
26999
27111
|
const elements = decodeProperties(propertyTranslatorsBySdName, tableProperties);
|
|
27000
27112
|
const newNode = {
|
|
@@ -27006,11 +27118,12 @@ const decode$i = (params) => {
|
|
|
27006
27118
|
return newNode;
|
|
27007
27119
|
};
|
|
27008
27120
|
const propertyTranslators = [
|
|
27121
|
+
translator$G,
|
|
27122
|
+
translator$O,
|
|
27009
27123
|
translator$F,
|
|
27010
|
-
translator$N,
|
|
27011
27124
|
translator$E,
|
|
27125
|
+
translator$N,
|
|
27012
27126
|
translator$D,
|
|
27013
|
-
translator$M,
|
|
27014
27127
|
translator$C,
|
|
27015
27128
|
translator$B,
|
|
27016
27129
|
translator$A,
|
|
@@ -27020,9 +27133,8 @@ const propertyTranslators = [
|
|
|
27020
27133
|
translator$w,
|
|
27021
27134
|
translator$v,
|
|
27022
27135
|
translator$u,
|
|
27023
|
-
translator$
|
|
27024
|
-
translator$e
|
|
27025
|
-
translator$d
|
|
27136
|
+
translator$f,
|
|
27137
|
+
translator$e
|
|
27026
27138
|
];
|
|
27027
27139
|
const propertyTranslatorsByXmlName = {};
|
|
27028
27140
|
const propertyTranslatorsBySdName = {};
|
|
@@ -27030,14 +27142,14 @@ propertyTranslators.forEach((translator2) => {
|
|
|
27030
27142
|
propertyTranslatorsByXmlName[translator2.xmlName] = translator2;
|
|
27031
27143
|
propertyTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
|
|
27032
27144
|
});
|
|
27033
|
-
const config$
|
|
27034
|
-
xmlName: XML_NODE_NAME$
|
|
27145
|
+
const config$c = {
|
|
27146
|
+
xmlName: XML_NODE_NAME$c,
|
|
27035
27147
|
sdNodeOrKeyName: SD_ATTR_KEY$1,
|
|
27036
|
-
encode: encode$
|
|
27037
|
-
decode: decode$
|
|
27148
|
+
encode: encode$j,
|
|
27149
|
+
decode: decode$j
|
|
27038
27150
|
};
|
|
27039
|
-
const translator$
|
|
27040
|
-
const translator$
|
|
27151
|
+
const translator$d = NodeTranslator.from(config$c);
|
|
27152
|
+
const translator$c = NodeTranslator.from(
|
|
27041
27153
|
createSingleAttrPropertyHandler("w:gridCol", "col", "w:w", parseInteger, integerToString)
|
|
27042
27154
|
);
|
|
27043
27155
|
const DEFAULT_COLUMN_WIDTH_PX = 100;
|
|
@@ -27087,20 +27199,20 @@ const resolveFallbackColumnWidthTwips = (params, totalColumns, cellMinWidthTwips
|
|
|
27087
27199
|
}
|
|
27088
27200
|
return Math.max(fallbackWidthTwips, cellMinWidthTwips);
|
|
27089
27201
|
};
|
|
27090
|
-
const XML_NODE_NAME$
|
|
27202
|
+
const XML_NODE_NAME$b = "w:tblGrid";
|
|
27091
27203
|
const SD_ATTR_KEY = "grid";
|
|
27092
27204
|
const cellMinWidth = pixelsToTwips(10);
|
|
27093
|
-
const encode$
|
|
27205
|
+
const encode$i = (params) => {
|
|
27094
27206
|
const { nodes } = params;
|
|
27095
27207
|
const node = nodes[0];
|
|
27096
|
-
const attributes = encodeProperties(node, { [translator$
|
|
27208
|
+
const attributes = encodeProperties(node, { [translator$c.xmlName]: translator$c }, true);
|
|
27097
27209
|
return {
|
|
27098
|
-
xmlName: XML_NODE_NAME$
|
|
27210
|
+
xmlName: XML_NODE_NAME$b,
|
|
27099
27211
|
sdNodeOrKeyName: SD_ATTR_KEY,
|
|
27100
27212
|
attributes
|
|
27101
27213
|
};
|
|
27102
27214
|
};
|
|
27103
|
-
const decode$
|
|
27215
|
+
const decode$i = (params) => {
|
|
27104
27216
|
const { grid: rawGrid } = params.node.attrs || {};
|
|
27105
27217
|
const grid = Array.isArray(rawGrid) ? rawGrid : [];
|
|
27106
27218
|
const { firstRow = {} } = params.extraParams || {};
|
|
@@ -27119,10 +27231,10 @@ const decode$h = (params) => {
|
|
|
27119
27231
|
numericWidth = fallbackColumnWidthTwips;
|
|
27120
27232
|
}
|
|
27121
27233
|
numericWidth = Math.max(numericWidth, cellMinWidth);
|
|
27122
|
-
const decoded = translator$
|
|
27234
|
+
const decoded = translator$c.decode({
|
|
27123
27235
|
node: { type: (
|
|
27124
27236
|
/** @type {string} */
|
|
27125
|
-
translator$
|
|
27237
|
+
translator$c.sdNodeOrKeyName
|
|
27126
27238
|
), attrs: { col: numericWidth } }
|
|
27127
27239
|
});
|
|
27128
27240
|
if (decoded) elements.push(decoded);
|
|
@@ -27157,39 +27269,100 @@ const decode$h = (params) => {
|
|
|
27157
27269
|
columnIndex++;
|
|
27158
27270
|
}
|
|
27159
27271
|
const newNode = {
|
|
27160
|
-
name: XML_NODE_NAME$
|
|
27272
|
+
name: XML_NODE_NAME$b,
|
|
27161
27273
|
attributes: {},
|
|
27162
27274
|
elements
|
|
27163
27275
|
};
|
|
27164
27276
|
return newNode;
|
|
27165
27277
|
};
|
|
27166
|
-
const config$
|
|
27167
|
-
xmlName: XML_NODE_NAME$
|
|
27278
|
+
const config$b = {
|
|
27279
|
+
xmlName: XML_NODE_NAME$b,
|
|
27168
27280
|
sdNodeOrKeyName: SD_ATTR_KEY,
|
|
27169
|
-
encode: encode$
|
|
27170
|
-
decode: decode$
|
|
27281
|
+
encode: encode$i,
|
|
27282
|
+
decode: decode$i
|
|
27171
27283
|
};
|
|
27172
|
-
const translator$
|
|
27173
|
-
const
|
|
27174
|
-
const
|
|
27175
|
-
const
|
|
27284
|
+
const translator$b = NodeTranslator.from(config$b);
|
|
27285
|
+
const DEFAULT_PAGE_WIDTH_TWIPS = 12240;
|
|
27286
|
+
const DEFAULT_PAGE_MARGIN_TWIPS = 1440;
|
|
27287
|
+
const DEFAULT_CONTENT_WIDTH_TWIPS = DEFAULT_PAGE_WIDTH_TWIPS - 2 * DEFAULT_PAGE_MARGIN_TWIPS;
|
|
27288
|
+
const MIN_COLUMN_WIDTH_TWIPS = pixelsToTwips(10);
|
|
27289
|
+
const pctToPercent = (value) => {
|
|
27290
|
+
if (value == null) return null;
|
|
27291
|
+
return value / 50;
|
|
27292
|
+
};
|
|
27293
|
+
const resolveContentWidthTwips = () => DEFAULT_CONTENT_WIDTH_TWIPS;
|
|
27294
|
+
const resolveMeasurementWidthPx = (measurement) => {
|
|
27295
|
+
if (!measurement || typeof measurement.value !== "number" || measurement.value <= 0) return null;
|
|
27296
|
+
const { value, type: type2 } = measurement;
|
|
27297
|
+
if (!type2 || type2 === "auto") return null;
|
|
27298
|
+
if (type2 === "dxa") return twipsToPixels(value);
|
|
27299
|
+
if (type2 === "pct") {
|
|
27300
|
+
const percent = pctToPercent(value);
|
|
27301
|
+
if (percent == null || percent <= 0) return null;
|
|
27302
|
+
const widthTwips = resolveContentWidthTwips() * percent / 100;
|
|
27303
|
+
return twipsToPixels(widthTwips);
|
|
27304
|
+
}
|
|
27305
|
+
return null;
|
|
27306
|
+
};
|
|
27307
|
+
const countColumnsInRow = (row) => {
|
|
27308
|
+
if (!row?.elements?.length) return 0;
|
|
27309
|
+
return row.elements.reduce((count, element) => {
|
|
27310
|
+
if (element.name !== "w:tc") return count;
|
|
27311
|
+
const tcPr = element.elements?.find((el) => el.name === "w:tcPr");
|
|
27312
|
+
const gridSpan = tcPr?.elements?.find((el) => el.name === "w:gridSpan");
|
|
27313
|
+
const spanValue = parseInt(gridSpan?.attributes?.["w:val"] || "1", 10);
|
|
27314
|
+
return count + (Number.isFinite(spanValue) && spanValue > 0 ? spanValue : 1);
|
|
27315
|
+
}, 0);
|
|
27316
|
+
};
|
|
27317
|
+
const clampColumnWidthTwips = (value) => Math.max(Math.round(value), MIN_COLUMN_WIDTH_TWIPS);
|
|
27318
|
+
const createFallbackGrid = (columnCount, columnWidthTwips) => Array.from({ length: columnCount }, () => ({ col: clampColumnWidthTwips(columnWidthTwips) }));
|
|
27319
|
+
const buildFallbackGridForTable = ({ params, rows, tableWidth, tableWidthMeasurement }) => {
|
|
27320
|
+
const firstRow = rows.find((row) => row.elements?.some((el) => el.name === "w:tc"));
|
|
27321
|
+
const columnCount = countColumnsInRow(firstRow);
|
|
27322
|
+
if (!columnCount) return null;
|
|
27323
|
+
const schemaDefaultPx = getSchemaDefaultColumnWidthPx(
|
|
27324
|
+
/** @type {any} */
|
|
27325
|
+
params
|
|
27326
|
+
);
|
|
27327
|
+
const minimumColumnWidthPx = Number.isFinite(schemaDefaultPx) && schemaDefaultPx > 0 ? schemaDefaultPx : DEFAULT_COLUMN_WIDTH_PX;
|
|
27328
|
+
let totalWidthPx;
|
|
27329
|
+
if (tableWidthMeasurement) {
|
|
27330
|
+
const resolved = resolveMeasurementWidthPx(tableWidthMeasurement);
|
|
27331
|
+
if (resolved != null) totalWidthPx = resolved;
|
|
27332
|
+
}
|
|
27333
|
+
if (totalWidthPx == null && tableWidth?.width && tableWidth.width > 0) {
|
|
27334
|
+
totalWidthPx = tableWidth.width;
|
|
27335
|
+
}
|
|
27336
|
+
if (totalWidthPx == null) {
|
|
27337
|
+
totalWidthPx = minimumColumnWidthPx * columnCount;
|
|
27338
|
+
}
|
|
27339
|
+
const rawColumnWidthPx = Math.max(totalWidthPx / columnCount, minimumColumnWidthPx);
|
|
27340
|
+
const columnWidthTwips = clampColumnWidthTwips(pixelsToTwips(rawColumnWidthPx));
|
|
27341
|
+
const fallbackColumnWidthPx = twipsToPixels(columnWidthTwips);
|
|
27342
|
+
return {
|
|
27343
|
+
grid: createFallbackGrid(columnCount, columnWidthTwips),
|
|
27344
|
+
columnWidths: Array(columnCount).fill(fallbackColumnWidthPx)
|
|
27345
|
+
};
|
|
27346
|
+
};
|
|
27347
|
+
const XML_NODE_NAME$a = "w:tbl";
|
|
27348
|
+
const SD_NODE_NAME$a = "table";
|
|
27349
|
+
const encode$h = (params, encodedAttrs) => {
|
|
27176
27350
|
const { nodes } = params;
|
|
27177
27351
|
const node = nodes[0];
|
|
27178
27352
|
const tblPr = node.elements.find((el) => el.name === "w:tblPr");
|
|
27179
27353
|
if (tblPr) {
|
|
27180
|
-
const encodedProperties = translator$
|
|
27354
|
+
const encodedProperties = translator$d.encode({ ...params, nodes: [tblPr] });
|
|
27181
27355
|
encodedAttrs["tableProperties"] = encodedProperties?.attributes || {};
|
|
27182
27356
|
}
|
|
27183
27357
|
const tblGrid = node.elements.find((el) => el.name === "w:tblGrid");
|
|
27184
27358
|
if (tblGrid) {
|
|
27185
|
-
encodedAttrs["grid"] = translator$
|
|
27359
|
+
encodedAttrs["grid"] = translator$b.encode({ ...params, nodes: [tblGrid] }).attributes;
|
|
27186
27360
|
}
|
|
27187
27361
|
[
|
|
27188
27362
|
"tableStyleId",
|
|
27189
27363
|
"justification",
|
|
27190
27364
|
"tableLayout",
|
|
27191
27365
|
["tableIndent", ({ value, type: type2 }) => ({ width: twipsToPixels(value), type: type2 })],
|
|
27192
|
-
["tableWidth", ({ value, type: type2 }) => ({ width: twipsToPixels(value), type: type2 })],
|
|
27193
27366
|
["tableCellSpacing", ({ value, type: type2 }) => ({ w: String(value), type: type2 })]
|
|
27194
27367
|
].forEach((prop) => {
|
|
27195
27368
|
let key;
|
|
@@ -27207,6 +27380,21 @@ const encode$g = (params, encodedAttrs) => {
|
|
|
27207
27380
|
if (encodedAttrs.tableCellSpacing) {
|
|
27208
27381
|
encodedAttrs["borderCollapse"] = "separate";
|
|
27209
27382
|
}
|
|
27383
|
+
if (encodedAttrs.tableProperties?.tableWidth) {
|
|
27384
|
+
const tableWidthMeasurement = encodedAttrs.tableProperties.tableWidth;
|
|
27385
|
+
const widthPx = twipsToPixels(tableWidthMeasurement.value);
|
|
27386
|
+
if (widthPx != null) {
|
|
27387
|
+
encodedAttrs.tableWidth = {
|
|
27388
|
+
width: widthPx,
|
|
27389
|
+
type: tableWidthMeasurement.type
|
|
27390
|
+
};
|
|
27391
|
+
} else if (tableWidthMeasurement.type === "auto") {
|
|
27392
|
+
encodedAttrs.tableWidth = {
|
|
27393
|
+
width: 0,
|
|
27394
|
+
type: tableWidthMeasurement.type
|
|
27395
|
+
};
|
|
27396
|
+
}
|
|
27397
|
+
}
|
|
27210
27398
|
const { borders, rowBorders } = _processTableBorders(encodedAttrs.tableProperties?.borders || {});
|
|
27211
27399
|
const referencedStyles = _getReferencedTableStyles(encodedAttrs.tableStyleId, params);
|
|
27212
27400
|
if (referencedStyles?.cellMargins && !encodedAttrs.tableProperties?.cellMargins) {
|
|
@@ -27220,10 +27408,22 @@ const encode$g = (params, encodedAttrs) => {
|
|
|
27220
27408
|
const borderRowData = Object.assign({}, referencedStyles?.rowBorders || {}, rowBorders || {});
|
|
27221
27409
|
encodedAttrs["borders"] = borderData;
|
|
27222
27410
|
const tblStyleTag = tblPr?.elements?.find((el) => el.name === "w:tblStyle");
|
|
27223
|
-
|
|
27411
|
+
let columnWidths = Array.isArray(encodedAttrs["grid"]) ? encodedAttrs["grid"].map((item) => twipsToPixels(item.col)) : [];
|
|
27412
|
+
if (!columnWidths.length) {
|
|
27413
|
+
const fallback = buildFallbackGridForTable({
|
|
27414
|
+
params,
|
|
27415
|
+
rows,
|
|
27416
|
+
tableWidth: encodedAttrs.tableWidth,
|
|
27417
|
+
tableWidthMeasurement: encodedAttrs.tableProperties?.tableWidth
|
|
27418
|
+
});
|
|
27419
|
+
if (fallback) {
|
|
27420
|
+
encodedAttrs.grid = fallback.grid;
|
|
27421
|
+
columnWidths = fallback.columnWidths;
|
|
27422
|
+
}
|
|
27423
|
+
}
|
|
27224
27424
|
const content = [];
|
|
27225
27425
|
rows.forEach((row) => {
|
|
27226
|
-
const result = translator$
|
|
27426
|
+
const result = translator$H.encode({
|
|
27227
27427
|
...params,
|
|
27228
27428
|
nodes: [row],
|
|
27229
27429
|
extraParams: {
|
|
@@ -27242,13 +27442,13 @@ const encode$g = (params, encodedAttrs) => {
|
|
|
27242
27442
|
attrs: encodedAttrs
|
|
27243
27443
|
};
|
|
27244
27444
|
};
|
|
27245
|
-
const decode$
|
|
27445
|
+
const decode$h = (params, decodedAttrs) => {
|
|
27246
27446
|
params.node = preProcessVerticalMergeCells(params.node, params);
|
|
27247
27447
|
const { node } = params;
|
|
27248
27448
|
const elements = translateChildNodes(params);
|
|
27249
27449
|
const firstRow = node.content?.find((n) => n.type === "tableRow");
|
|
27250
27450
|
const properties = node.attrs.grid;
|
|
27251
|
-
const element = translator$
|
|
27451
|
+
const element = translator$b.decode({
|
|
27252
27452
|
...params,
|
|
27253
27453
|
node: { ...node, attrs: { ...node.attrs, grid: properties } },
|
|
27254
27454
|
extraParams: {
|
|
@@ -27258,7 +27458,7 @@ const decode$g = (params, decodedAttrs) => {
|
|
|
27258
27458
|
if (element) elements.unshift(element);
|
|
27259
27459
|
if (node.attrs?.tableProperties) {
|
|
27260
27460
|
const properties2 = { ...node.attrs.tableProperties };
|
|
27261
|
-
const element2 = translator$
|
|
27461
|
+
const element2 = translator$d.decode({
|
|
27262
27462
|
...params,
|
|
27263
27463
|
node: { ...node, attrs: { ...node.attrs, tableProperties: properties2 } }
|
|
27264
27464
|
});
|
|
@@ -27324,7 +27524,7 @@ function _getReferencedTableStyles(tableStyleReference, params) {
|
|
|
27324
27524
|
if (baseTblPr && baseTblPr.elements) {
|
|
27325
27525
|
tblPr.elements.push(...baseTblPr.elements);
|
|
27326
27526
|
}
|
|
27327
|
-
const tableProperties = translator$
|
|
27527
|
+
const tableProperties = translator$d.encode({ ...params, nodes: [tblPr] }).attributes;
|
|
27328
27528
|
const { borders, rowBorders } = _processTableBorders(tableProperties.borders || {});
|
|
27329
27529
|
if (borders) stylesToReturn.borders = borders;
|
|
27330
27530
|
if (rowBorders) stylesToReturn.rowBorders = rowBorders;
|
|
@@ -27341,16 +27541,16 @@ function _getReferencedTableStyles(tableStyleReference, params) {
|
|
|
27341
27541
|
}
|
|
27342
27542
|
return stylesToReturn;
|
|
27343
27543
|
}
|
|
27344
|
-
const config$
|
|
27345
|
-
xmlName: XML_NODE_NAME$
|
|
27346
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
27544
|
+
const config$a = {
|
|
27545
|
+
xmlName: XML_NODE_NAME$a,
|
|
27546
|
+
sdNodeOrKeyName: SD_NODE_NAME$a,
|
|
27347
27547
|
type: NodeTranslator.translatorTypes.NODE,
|
|
27348
|
-
encode: encode$
|
|
27349
|
-
decode: decode$
|
|
27548
|
+
encode: encode$h,
|
|
27549
|
+
decode: decode$h,
|
|
27350
27550
|
attributes: []
|
|
27351
27551
|
};
|
|
27352
|
-
const translator$
|
|
27353
|
-
const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$
|
|
27552
|
+
const translator$a = NodeTranslator.from(config$a);
|
|
27553
|
+
const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$a);
|
|
27354
27554
|
function getReferencedTableStyles(tblStyleTag, docx) {
|
|
27355
27555
|
if (!tblStyleTag) return null;
|
|
27356
27556
|
const stylesToReturn = {};
|
|
@@ -27712,10 +27912,10 @@ function generateCellMargins(cellMargins) {
|
|
|
27712
27912
|
if (left != null) elements.push({ name: "w:left", attributes: { "w:w": pixelsToTwips(left) } });
|
|
27713
27913
|
return elements;
|
|
27714
27914
|
}
|
|
27715
|
-
const XML_NODE_NAME$
|
|
27716
|
-
const SD_NODE_NAME$
|
|
27717
|
-
const validXmlAttributes$
|
|
27718
|
-
function encode$
|
|
27915
|
+
const XML_NODE_NAME$9 = "w:tc";
|
|
27916
|
+
const SD_NODE_NAME$9 = "tableCell";
|
|
27917
|
+
const validXmlAttributes$7 = [];
|
|
27918
|
+
function encode$g(params, encodedAttrs) {
|
|
27719
27919
|
const {
|
|
27720
27920
|
node,
|
|
27721
27921
|
table,
|
|
@@ -27737,167 +27937,27 @@ function encode$f(params, encodedAttrs) {
|
|
|
27737
27937
|
columnWidth,
|
|
27738
27938
|
allColumnWidths
|
|
27739
27939
|
});
|
|
27740
|
-
if (encodedAttrs && Object.keys(encodedAttrs).length) {
|
|
27741
|
-
schemaNode.attrs = { ...schemaNode.attrs, ...encodedAttrs };
|
|
27742
|
-
}
|
|
27743
|
-
return schemaNode;
|
|
27744
|
-
}
|
|
27745
|
-
function decode$f(params, decodedAttrs) {
|
|
27746
|
-
const translated = translateTableCell(params);
|
|
27747
|
-
if (decodedAttrs && Object.keys(decodedAttrs).length) {
|
|
27748
|
-
translated.attributes = { ...translated.attributes || {}, ...decodedAttrs };
|
|
27749
|
-
}
|
|
27750
|
-
return translated;
|
|
27751
|
-
}
|
|
27752
|
-
const config$8 = {
|
|
27753
|
-
xmlName: XML_NODE_NAME$8,
|
|
27754
|
-
sdNodeOrKeyName: SD_NODE_NAME$8,
|
|
27755
|
-
type: NodeTranslator.translatorTypes.NODE,
|
|
27756
|
-
encode: encode$f,
|
|
27757
|
-
decode: decode$f,
|
|
27758
|
-
attributes: validXmlAttributes$8
|
|
27759
|
-
};
|
|
27760
|
-
const translator$8 = NodeTranslator.from(config$8);
|
|
27761
|
-
const XML_NODE_NAME$7 = "w:hyperlink";
|
|
27762
|
-
const SD_NODE_NAME$7 = "link";
|
|
27763
|
-
const _createAttributeHandler = (xmlName, sdName) => ({
|
|
27764
|
-
xmlName,
|
|
27765
|
-
sdName,
|
|
27766
|
-
encode: (attributes) => attributes[xmlName],
|
|
27767
|
-
decode: (attributes) => attributes[sdName]
|
|
27768
|
-
});
|
|
27769
|
-
const validXmlAttributes$7 = [
|
|
27770
|
-
_createAttributeHandler("w:anchor", "anchor"),
|
|
27771
|
-
_createAttributeHandler("w:docLocation", "docLocation"),
|
|
27772
|
-
{
|
|
27773
|
-
xmlName: "w:history",
|
|
27774
|
-
sdName: "history",
|
|
27775
|
-
encode: (attributes) => attributes["w:history"] === "1" || attributes["w:history"] === "true",
|
|
27776
|
-
decode: (attributes) => attributes["history"] ? "1" : "0"
|
|
27777
|
-
},
|
|
27778
|
-
_createAttributeHandler("w:tooltip", "tooltip"),
|
|
27779
|
-
_createAttributeHandler("r:id", "rId"),
|
|
27780
|
-
_createAttributeHandler("w:tgtFrame", "target")
|
|
27781
|
-
];
|
|
27782
|
-
const encode$e = (params, encodedAttrs) => {
|
|
27783
|
-
const { nodes, docx, nodeListHandler } = params;
|
|
27784
|
-
const node = nodes[0];
|
|
27785
|
-
let href = _resolveHref(docx, encodedAttrs);
|
|
27786
|
-
const linkMark = { attrs: { ...encodedAttrs, href } };
|
|
27787
|
-
const runNodes = node.elements.filter((el) => el.name === "w:r");
|
|
27788
|
-
runNodes.forEach((runNode) => {
|
|
27789
|
-
const existingRunMarks = Array.isArray(runNode.marks) ? runNode.marks : [];
|
|
27790
|
-
const runMarksWithoutLink = existingRunMarks.filter((mark) => mark?.type !== "link");
|
|
27791
|
-
runNode.marks = runMarksWithoutLink;
|
|
27792
|
-
});
|
|
27793
|
-
const updatedNode = nodeListHandler.handler({
|
|
27794
|
-
...params,
|
|
27795
|
-
nodes: runNodes,
|
|
27796
|
-
path: [...params.path || [], node]
|
|
27797
|
-
});
|
|
27798
|
-
const cloneMark2 = (mark) => {
|
|
27799
|
-
if (!mark || typeof mark !== "object") return mark;
|
|
27800
|
-
if (!mark.attrs) return { ...mark };
|
|
27801
|
-
return { ...mark, attrs: { ...mark.attrs } };
|
|
27802
|
-
};
|
|
27803
|
-
const ensureLinkMark = (child) => {
|
|
27804
|
-
if (!child || typeof child !== "object") return child;
|
|
27805
|
-
if (Array.isArray(child.content)) {
|
|
27806
|
-
const updatedContent = child.content.map((item) => ensureLinkMark(item));
|
|
27807
|
-
if (updatedContent !== child.content) {
|
|
27808
|
-
child = { ...child, content: updatedContent };
|
|
27809
|
-
}
|
|
27810
|
-
}
|
|
27811
|
-
if (child.type === "run") {
|
|
27812
|
-
const existingMarks2 = Array.isArray(child.marks) ? child.marks : [];
|
|
27813
|
-
const filteredMarks = existingMarks2.filter((mark) => mark?.type !== "link").map((mark) => cloneMark2(mark));
|
|
27814
|
-
if (filteredMarks.length !== existingMarks2.length) {
|
|
27815
|
-
if (filteredMarks.length) child = { ...child, marks: filteredMarks };
|
|
27816
|
-
else {
|
|
27817
|
-
const { marks: _removedMarks, ...rest } = child;
|
|
27818
|
-
child = rest;
|
|
27819
|
-
}
|
|
27820
|
-
}
|
|
27821
|
-
return child;
|
|
27822
|
-
}
|
|
27823
|
-
if (child.type !== "text") return child;
|
|
27824
|
-
const existingMarks = Array.isArray(child.marks) ? child.marks.map((mark) => cloneMark2(mark)) : [];
|
|
27825
|
-
const hasLink = existingMarks.some((mark) => mark?.type === "link");
|
|
27826
|
-
if (hasLink) return child;
|
|
27827
|
-
const linkClone = { type: "link", attrs: { ...linkMark.attrs } };
|
|
27828
|
-
return { ...child, marks: [...existingMarks, linkClone] };
|
|
27829
|
-
};
|
|
27830
|
-
if (!Array.isArray(updatedNode)) return updatedNode;
|
|
27831
|
-
return updatedNode.map((child) => ensureLinkMark(child));
|
|
27832
|
-
};
|
|
27833
|
-
const _resolveHref = (docx, encodedAttrs) => {
|
|
27834
|
-
const rels = docx["word/_rels/document.xml.rels"];
|
|
27835
|
-
const relationships = rels.elements.find((el) => el.name === "Relationships");
|
|
27836
|
-
const { elements } = relationships;
|
|
27837
|
-
const { rId, anchor } = encodedAttrs;
|
|
27838
|
-
let href;
|
|
27839
|
-
if (!rId && anchor) {
|
|
27840
|
-
href = `#${anchor}`;
|
|
27841
|
-
} else if (rId) {
|
|
27842
|
-
const rel = elements.find((el) => el.attributes["Id"] === rId) || {};
|
|
27843
|
-
const { attributes: relAttributes = {} } = rel;
|
|
27844
|
-
href = relAttributes["Target"];
|
|
27845
|
-
}
|
|
27846
|
-
return href;
|
|
27847
|
-
};
|
|
27848
|
-
function decode$e(params) {
|
|
27849
|
-
const { node } = params;
|
|
27850
|
-
const linkMark = node.marks.find((m2) => m2.type === "link");
|
|
27851
|
-
const linkAttrs = this.decodeAttributes({ ...params, node: linkMark });
|
|
27852
|
-
let { anchor, href: link } = linkMark.attrs;
|
|
27853
|
-
const isExternalLink = !anchor;
|
|
27854
|
-
if (isExternalLink) {
|
|
27855
|
-
linkAttrs["r:id"] = _addNewLinkRelationship(params, link, linkAttrs["r:id"]);
|
|
27856
|
-
}
|
|
27857
|
-
node.marks = node.marks.filter((m2) => m2.type !== "link");
|
|
27858
|
-
const outputNode = exportSchemaToJson({ ...params, node });
|
|
27859
|
-
const newNode = {
|
|
27860
|
-
name: "w:hyperlink",
|
|
27861
|
-
type: "element",
|
|
27862
|
-
attributes: {
|
|
27863
|
-
...linkAttrs
|
|
27864
|
-
},
|
|
27865
|
-
elements: [outputNode]
|
|
27866
|
-
};
|
|
27867
|
-
return newNode;
|
|
27868
|
-
}
|
|
27869
|
-
function _addNewLinkRelationship(params, link, rId) {
|
|
27870
|
-
if (!rId) rId = generateDocxRandomId();
|
|
27871
|
-
if (!params.relationships || !Array.isArray(params.relationships)) {
|
|
27872
|
-
params.relationships = [];
|
|
27873
|
-
}
|
|
27874
|
-
const existingRel = params.relationships.find(
|
|
27875
|
-
(rel) => rel.attributes && rel.attributes.Id === rId && rel.attributes.Target === link
|
|
27876
|
-
);
|
|
27877
|
-
if (existingRel) {
|
|
27878
|
-
return rId;
|
|
27879
|
-
}
|
|
27880
|
-
params.relationships.push({
|
|
27881
|
-
type: "element",
|
|
27882
|
-
name: "Relationship",
|
|
27883
|
-
attributes: {
|
|
27884
|
-
Id: rId,
|
|
27885
|
-
Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
|
|
27886
|
-
Target: link,
|
|
27887
|
-
TargetMode: "External"
|
|
27888
|
-
}
|
|
27889
|
-
});
|
|
27890
|
-
return rId;
|
|
27940
|
+
if (encodedAttrs && Object.keys(encodedAttrs).length) {
|
|
27941
|
+
schemaNode.attrs = { ...schemaNode.attrs, ...encodedAttrs };
|
|
27942
|
+
}
|
|
27943
|
+
return schemaNode;
|
|
27891
27944
|
}
|
|
27892
|
-
|
|
27893
|
-
|
|
27894
|
-
|
|
27945
|
+
function decode$g(params, decodedAttrs) {
|
|
27946
|
+
const translated = translateTableCell(params);
|
|
27947
|
+
if (decodedAttrs && Object.keys(decodedAttrs).length) {
|
|
27948
|
+
translated.attributes = { ...translated.attributes || {}, ...decodedAttrs };
|
|
27949
|
+
}
|
|
27950
|
+
return translated;
|
|
27951
|
+
}
|
|
27952
|
+
const config$9 = {
|
|
27953
|
+
xmlName: XML_NODE_NAME$9,
|
|
27954
|
+
sdNodeOrKeyName: SD_NODE_NAME$9,
|
|
27895
27955
|
type: NodeTranslator.translatorTypes.NODE,
|
|
27896
|
-
encode: encode$
|
|
27897
|
-
decode: decode$
|
|
27956
|
+
encode: encode$g,
|
|
27957
|
+
decode: decode$g,
|
|
27898
27958
|
attributes: validXmlAttributes$7
|
|
27899
27959
|
};
|
|
27900
|
-
const translator$
|
|
27960
|
+
const translator$9 = NodeTranslator.from(config$9);
|
|
27901
27961
|
function parseTagValueJSON(json) {
|
|
27902
27962
|
if (typeof json !== "string") {
|
|
27903
27963
|
return {};
|
|
@@ -28033,12 +28093,32 @@ function handleDocPartObj(params) {
|
|
|
28033
28093
|
}
|
|
28034
28094
|
const content = node?.elements.find((el) => el.name === "w:sdtContent");
|
|
28035
28095
|
const handler2 = validGalleryTypeMap[docPartGalleryType];
|
|
28036
|
-
const result = handler2({
|
|
28096
|
+
const result = handler2({
|
|
28097
|
+
...params,
|
|
28098
|
+
nodes: [content],
|
|
28099
|
+
extraParams: { ...params.extraParams || {}, sdtPr }
|
|
28100
|
+
});
|
|
28037
28101
|
return result;
|
|
28038
28102
|
}
|
|
28039
28103
|
const tableOfContentsHandler = (params) => {
|
|
28040
28104
|
const node = params.nodes[0];
|
|
28041
|
-
|
|
28105
|
+
const translatedContent = params.nodeListHandler.handler({
|
|
28106
|
+
...params,
|
|
28107
|
+
nodes: node.elements,
|
|
28108
|
+
path: [...params.path || [], node]
|
|
28109
|
+
});
|
|
28110
|
+
const sdtPr = params.extraParams.sdtPr;
|
|
28111
|
+
const id = sdtPr.elements?.find((el) => el.name === "w:id")?.attributes["w:val"] || "";
|
|
28112
|
+
const result = {
|
|
28113
|
+
type: "documentPartObject",
|
|
28114
|
+
content: translatedContent,
|
|
28115
|
+
attrs: {
|
|
28116
|
+
id,
|
|
28117
|
+
docPartGallery: "Table of Contents",
|
|
28118
|
+
docPartUnique: true
|
|
28119
|
+
}
|
|
28120
|
+
};
|
|
28121
|
+
return result;
|
|
28042
28122
|
};
|
|
28043
28123
|
const validGalleryTypeMap = {
|
|
28044
28124
|
"Table of Contents": tableOfContentsHandler
|
|
@@ -28082,6 +28162,9 @@ function handleStructuredContentNode(params) {
|
|
|
28082
28162
|
const node = nodes[0];
|
|
28083
28163
|
const sdtPr = node.elements.find((el) => el.name === "w:sdtPr");
|
|
28084
28164
|
const sdtContent = node.elements.find((el) => el.name === "w:sdtContent");
|
|
28165
|
+
const id = sdtPr?.elements?.find((el) => el.name === "w:id");
|
|
28166
|
+
const tag = sdtPr?.elements?.find((el) => el.name === "w:tag");
|
|
28167
|
+
const alias = sdtPr?.elements?.find((el) => el.name === "w:alias");
|
|
28085
28168
|
if (!sdtContent) {
|
|
28086
28169
|
return null;
|
|
28087
28170
|
}
|
|
@@ -28093,15 +28176,16 @@ function handleStructuredContentNode(params) {
|
|
|
28093
28176
|
nodes: sdtContent.elements,
|
|
28094
28177
|
path: [...params.path || [], sdtContent]
|
|
28095
28178
|
});
|
|
28096
|
-
|
|
28097
|
-
|
|
28098
|
-
sdtContentType = "structuredContentBlock";
|
|
28099
|
-
}
|
|
28179
|
+
const isBlockNode = paragraph || table;
|
|
28180
|
+
const sdtContentType = isBlockNode ? "structuredContentBlock" : "structuredContent";
|
|
28100
28181
|
let result = {
|
|
28101
28182
|
type: sdtContentType,
|
|
28102
28183
|
content: translatedContent,
|
|
28103
28184
|
marks,
|
|
28104
28185
|
attrs: {
|
|
28186
|
+
id: id?.attributes?.["w:val"] || null,
|
|
28187
|
+
tag: tag?.attributes?.["w:val"] || null,
|
|
28188
|
+
alias: alias?.attributes?.["w:val"] || null,
|
|
28105
28189
|
sdtPr
|
|
28106
28190
|
}
|
|
28107
28191
|
};
|
|
@@ -28692,32 +28776,32 @@ function translateAnchorNode(params) {
|
|
|
28692
28776
|
elements: [...anchorElements, ...elementsWithWrap]
|
|
28693
28777
|
};
|
|
28694
28778
|
}
|
|
28695
|
-
const XML_NODE_NAME$
|
|
28696
|
-
const SD_NODE_NAME$
|
|
28779
|
+
const XML_NODE_NAME$8 = "wp:anchor";
|
|
28780
|
+
const SD_NODE_NAME$8 = ["image"];
|
|
28697
28781
|
const validXmlAttributes$6 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
|
|
28698
|
-
function encode$
|
|
28782
|
+
function encode$f(params) {
|
|
28699
28783
|
const { node } = params.extraParams;
|
|
28700
28784
|
if (!node || !node.type) {
|
|
28701
28785
|
return null;
|
|
28702
28786
|
}
|
|
28703
28787
|
return handleAnchorNode(params);
|
|
28704
28788
|
}
|
|
28705
|
-
function decode$
|
|
28789
|
+
function decode$f(params) {
|
|
28706
28790
|
const { node } = params;
|
|
28707
28791
|
if (!node || !node.type) {
|
|
28708
28792
|
return null;
|
|
28709
28793
|
}
|
|
28710
28794
|
return translateAnchorNode(params);
|
|
28711
28795
|
}
|
|
28712
|
-
const config$
|
|
28713
|
-
xmlName: XML_NODE_NAME$
|
|
28714
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
28796
|
+
const config$8 = {
|
|
28797
|
+
xmlName: XML_NODE_NAME$8,
|
|
28798
|
+
sdNodeOrKeyName: SD_NODE_NAME$8,
|
|
28715
28799
|
type: NodeTranslator.translatorTypes.NODE,
|
|
28716
|
-
encode: encode$
|
|
28717
|
-
decode: decode$
|
|
28800
|
+
encode: encode$f,
|
|
28801
|
+
decode: decode$f,
|
|
28718
28802
|
attributes: validXmlAttributes$6
|
|
28719
28803
|
};
|
|
28720
|
-
const translator$
|
|
28804
|
+
const translator$8 = NodeTranslator.from(config$8);
|
|
28721
28805
|
function handleInlineNode(params) {
|
|
28722
28806
|
const { node } = params.extraParams;
|
|
28723
28807
|
if (node.name !== "wp:inline") {
|
|
@@ -28733,41 +28817,41 @@ function translateInlineNode(params) {
|
|
|
28733
28817
|
elements: nodeElements.elements
|
|
28734
28818
|
};
|
|
28735
28819
|
}
|
|
28736
|
-
const XML_NODE_NAME$
|
|
28737
|
-
const SD_NODE_NAME$
|
|
28820
|
+
const XML_NODE_NAME$7 = "wp:inline";
|
|
28821
|
+
const SD_NODE_NAME$7 = ["image"];
|
|
28738
28822
|
const validXmlAttributes$5 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
|
|
28739
|
-
function encode$
|
|
28823
|
+
function encode$e(params) {
|
|
28740
28824
|
const { node } = params.extraParams;
|
|
28741
28825
|
if (!node || !node.type) {
|
|
28742
28826
|
return null;
|
|
28743
28827
|
}
|
|
28744
28828
|
return handleInlineNode(params);
|
|
28745
28829
|
}
|
|
28746
|
-
function decode$
|
|
28830
|
+
function decode$e(params) {
|
|
28747
28831
|
const { node } = params;
|
|
28748
28832
|
if (!node || !node.type) {
|
|
28749
28833
|
return null;
|
|
28750
28834
|
}
|
|
28751
28835
|
return translateInlineNode(params);
|
|
28752
28836
|
}
|
|
28753
|
-
const config$
|
|
28754
|
-
xmlName: XML_NODE_NAME$
|
|
28755
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
28837
|
+
const config$7 = {
|
|
28838
|
+
xmlName: XML_NODE_NAME$7,
|
|
28839
|
+
sdNodeOrKeyName: SD_NODE_NAME$7,
|
|
28756
28840
|
type: NodeTranslator.translatorTypes.NODE,
|
|
28757
|
-
encode: encode$
|
|
28758
|
-
decode: decode$
|
|
28841
|
+
encode: encode$e,
|
|
28842
|
+
decode: decode$e,
|
|
28759
28843
|
attributes: validXmlAttributes$5
|
|
28760
28844
|
};
|
|
28761
|
-
const translator$
|
|
28762
|
-
const XML_NODE_NAME$
|
|
28763
|
-
const SD_NODE_NAME$
|
|
28845
|
+
const translator$7 = NodeTranslator.from(config$7);
|
|
28846
|
+
const XML_NODE_NAME$6 = "w:drawing";
|
|
28847
|
+
const SD_NODE_NAME$6 = [];
|
|
28764
28848
|
const validXmlAttributes$4 = [];
|
|
28765
|
-
function encode$
|
|
28849
|
+
function encode$d(params) {
|
|
28766
28850
|
const nodes = params.nodes;
|
|
28767
28851
|
const node = nodes[0];
|
|
28768
28852
|
const translatorByChildName = {
|
|
28769
|
-
"wp:anchor": translator$
|
|
28770
|
-
"wp:inline": translator$
|
|
28853
|
+
"wp:anchor": translator$8,
|
|
28854
|
+
"wp:inline": translator$7
|
|
28771
28855
|
};
|
|
28772
28856
|
return node.elements.reduce((acc, child) => {
|
|
28773
28857
|
if (acc) return acc;
|
|
@@ -28776,12 +28860,12 @@ function encode$b(params) {
|
|
|
28776
28860
|
return translator2.encode({ ...params, extraParams: { node: child } }) || acc;
|
|
28777
28861
|
}, null);
|
|
28778
28862
|
}
|
|
28779
|
-
function decode$
|
|
28863
|
+
function decode$d(params) {
|
|
28780
28864
|
const { node } = params;
|
|
28781
28865
|
if (!node || !node.type) {
|
|
28782
28866
|
return null;
|
|
28783
28867
|
}
|
|
28784
|
-
const childTranslator = node.attrs.isAnchor ? translator$
|
|
28868
|
+
const childTranslator = node.attrs.isAnchor ? translator$8 : translator$7;
|
|
28785
28869
|
const resultNode = childTranslator.decode(params);
|
|
28786
28870
|
return wrapTextInRun(
|
|
28787
28871
|
{
|
|
@@ -28791,15 +28875,15 @@ function decode$b(params) {
|
|
|
28791
28875
|
[]
|
|
28792
28876
|
);
|
|
28793
28877
|
}
|
|
28794
|
-
const config$
|
|
28795
|
-
xmlName: XML_NODE_NAME$
|
|
28796
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
28878
|
+
const config$6 = {
|
|
28879
|
+
xmlName: XML_NODE_NAME$6,
|
|
28880
|
+
sdNodeOrKeyName: SD_NODE_NAME$6,
|
|
28797
28881
|
type: NodeTranslator.translatorTypes.NODE,
|
|
28798
|
-
encode: encode$
|
|
28799
|
-
decode: decode$
|
|
28882
|
+
encode: encode$d,
|
|
28883
|
+
decode: decode$d,
|
|
28800
28884
|
attributes: validXmlAttributes$4
|
|
28801
28885
|
};
|
|
28802
|
-
const translator$
|
|
28886
|
+
const translator$6 = NodeTranslator.from(config$6);
|
|
28803
28887
|
class CommandService {
|
|
28804
28888
|
/**
|
|
28805
28889
|
* @param {import('./commands/types/index.js').CommandServiceOptions} props
|
|
@@ -30137,7 +30221,7 @@ function prepareTextAnnotation(params) {
|
|
|
30137
30221
|
return getTextNodeForExport(attrs.displayLabel, [...marks, ...marksFromAttrs], params);
|
|
30138
30222
|
}
|
|
30139
30223
|
function prepareImageAnnotation(params, imageSize) {
|
|
30140
|
-
return translator$
|
|
30224
|
+
return translator$6.decode({
|
|
30141
30225
|
...params,
|
|
30142
30226
|
imageSize
|
|
30143
30227
|
});
|
|
@@ -30357,27 +30441,104 @@ const generateSdtPrTagForDocumentSection = (id, title, tag) => {
|
|
|
30357
30441
|
]
|
|
30358
30442
|
};
|
|
30359
30443
|
};
|
|
30360
|
-
function
|
|
30444
|
+
function translateDocumentPartObj(params) {
|
|
30361
30445
|
const { node } = params;
|
|
30362
30446
|
const { attrs = {} } = node;
|
|
30363
30447
|
const childContent = translateChildNodes({ ...params, nodes: node.content });
|
|
30364
30448
|
const nodeElements = [
|
|
30449
|
+
{
|
|
30450
|
+
name: "w:sdtPr",
|
|
30451
|
+
elements: [
|
|
30452
|
+
{
|
|
30453
|
+
name: "w:id",
|
|
30454
|
+
attributes: {
|
|
30455
|
+
"w:val": attrs.id
|
|
30456
|
+
}
|
|
30457
|
+
},
|
|
30458
|
+
{
|
|
30459
|
+
name: "w:docPartObj",
|
|
30460
|
+
elements: [
|
|
30461
|
+
{
|
|
30462
|
+
name: "w:docPartGallery",
|
|
30463
|
+
attributes: {
|
|
30464
|
+
"w:val": attrs.docPartGallery
|
|
30465
|
+
}
|
|
30466
|
+
},
|
|
30467
|
+
...attrs.docPartUnique ? [
|
|
30468
|
+
{
|
|
30469
|
+
name: "w:docPartUnique"
|
|
30470
|
+
}
|
|
30471
|
+
] : []
|
|
30472
|
+
]
|
|
30473
|
+
}
|
|
30474
|
+
]
|
|
30475
|
+
},
|
|
30365
30476
|
{
|
|
30366
30477
|
name: "w:sdtContent",
|
|
30367
30478
|
elements: childContent
|
|
30368
30479
|
}
|
|
30369
30480
|
];
|
|
30370
|
-
nodeElements.unshift(attrs.sdtPr);
|
|
30371
30481
|
const result = {
|
|
30372
30482
|
name: "w:sdt",
|
|
30373
30483
|
elements: nodeElements
|
|
30374
30484
|
};
|
|
30375
30485
|
return result;
|
|
30376
30486
|
}
|
|
30377
|
-
|
|
30378
|
-
const
|
|
30487
|
+
function translateStructuredContent(params) {
|
|
30488
|
+
const { node } = params;
|
|
30489
|
+
const childContent = translateChildNodes({ ...params, nodes: node.content });
|
|
30490
|
+
const sdtContent = { name: "w:sdtContent", elements: childContent };
|
|
30491
|
+
const sdtPr = generateSdtPrTagForStructuredContent({ node });
|
|
30492
|
+
const nodeElements = [sdtPr, sdtContent];
|
|
30493
|
+
const result = {
|
|
30494
|
+
name: "w:sdt",
|
|
30495
|
+
elements: nodeElements
|
|
30496
|
+
};
|
|
30497
|
+
return result;
|
|
30498
|
+
}
|
|
30499
|
+
function generateSdtPrTagForStructuredContent({ node }) {
|
|
30500
|
+
const { attrs = {} } = node;
|
|
30501
|
+
const id = {
|
|
30502
|
+
name: "w:id",
|
|
30503
|
+
type: "element",
|
|
30504
|
+
attributes: { "w:val": attrs.id }
|
|
30505
|
+
};
|
|
30506
|
+
const alias = {
|
|
30507
|
+
name: "w:alias",
|
|
30508
|
+
type: "element",
|
|
30509
|
+
attributes: { "w:val": attrs.alias }
|
|
30510
|
+
};
|
|
30511
|
+
const tag = {
|
|
30512
|
+
name: "w:tag",
|
|
30513
|
+
type: "element",
|
|
30514
|
+
attributes: { "w:val": attrs.tag }
|
|
30515
|
+
};
|
|
30516
|
+
const resultElements = [];
|
|
30517
|
+
if (attrs.id) resultElements.push(id);
|
|
30518
|
+
if (attrs.alias) resultElements.push(alias);
|
|
30519
|
+
if (attrs.tag) resultElements.push(tag);
|
|
30520
|
+
if (attrs.sdtPr) {
|
|
30521
|
+
const elements = attrs.sdtPr.elements || [];
|
|
30522
|
+
const elementsToExclude = ["w:id", "w:alias", "w:tag"];
|
|
30523
|
+
const restElements = elements.filter((el) => !elementsToExclude.includes(el.name));
|
|
30524
|
+
const result2 = {
|
|
30525
|
+
name: "w:sdtPr",
|
|
30526
|
+
type: "element",
|
|
30527
|
+
elements: [...resultElements, ...restElements]
|
|
30528
|
+
};
|
|
30529
|
+
return result2;
|
|
30530
|
+
}
|
|
30531
|
+
const result = {
|
|
30532
|
+
name: "w:sdtPr",
|
|
30533
|
+
type: "element",
|
|
30534
|
+
elements: resultElements
|
|
30535
|
+
};
|
|
30536
|
+
return result;
|
|
30537
|
+
}
|
|
30538
|
+
const XML_NODE_NAME$5 = "w:sdt";
|
|
30539
|
+
const SD_NODE_NAME$5 = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
|
|
30379
30540
|
const validXmlAttributes$3 = [];
|
|
30380
|
-
function encode$
|
|
30541
|
+
function encode$c(params) {
|
|
30381
30542
|
const nodes = params.nodes;
|
|
30382
30543
|
const node = nodes[0];
|
|
30383
30544
|
const { type: sdtType, handler: handler2 } = sdtNodeTypeStrategy(node);
|
|
@@ -30387,7 +30548,7 @@ function encode$a(params) {
|
|
|
30387
30548
|
const result = handler2(params);
|
|
30388
30549
|
return result;
|
|
30389
30550
|
}
|
|
30390
|
-
function decode$
|
|
30551
|
+
function decode$c(params) {
|
|
30391
30552
|
const { node } = params;
|
|
30392
30553
|
if (!node || !node.type) {
|
|
30393
30554
|
return null;
|
|
@@ -30397,91 +30558,93 @@ function decode$a(params) {
|
|
|
30397
30558
|
structuredContent: () => translateStructuredContent(params),
|
|
30398
30559
|
structuredContentBlock: () => translateStructuredContent(params),
|
|
30399
30560
|
documentSection: () => translateDocumentSection(params),
|
|
30561
|
+
documentPartObject: () => translateDocumentPartObj(params),
|
|
30562
|
+
// Handled in doc-part-obj translator
|
|
30400
30563
|
default: () => null
|
|
30401
30564
|
};
|
|
30402
30565
|
const decoder = types2[node.type] ?? types2.default;
|
|
30403
30566
|
const result = decoder();
|
|
30404
30567
|
return result;
|
|
30405
30568
|
}
|
|
30406
|
-
const config$
|
|
30407
|
-
xmlName: XML_NODE_NAME$
|
|
30408
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
30569
|
+
const config$5 = {
|
|
30570
|
+
xmlName: XML_NODE_NAME$5,
|
|
30571
|
+
sdNodeOrKeyName: SD_NODE_NAME$5,
|
|
30409
30572
|
type: NodeTranslator.translatorTypes.NODE,
|
|
30410
|
-
encode: encode$
|
|
30411
|
-
decode: decode$
|
|
30573
|
+
encode: encode$c,
|
|
30574
|
+
decode: decode$c,
|
|
30412
30575
|
attributes: validXmlAttributes$3
|
|
30413
30576
|
};
|
|
30414
|
-
const translator$
|
|
30415
|
-
const encode$
|
|
30577
|
+
const translator$5 = NodeTranslator.from(config$5);
|
|
30578
|
+
const encode$b = (attributes) => {
|
|
30416
30579
|
return attributes["w:id"];
|
|
30417
30580
|
};
|
|
30418
|
-
const decode$
|
|
30581
|
+
const decode$b = (attrs) => {
|
|
30419
30582
|
return attrs.id;
|
|
30420
30583
|
};
|
|
30421
30584
|
const attrConfig$6 = Object.freeze({
|
|
30422
30585
|
xmlName: "w:id",
|
|
30423
30586
|
sdName: "id",
|
|
30424
|
-
encode: encode$
|
|
30425
|
-
decode: decode$
|
|
30587
|
+
encode: encode$b,
|
|
30588
|
+
decode: decode$b
|
|
30426
30589
|
});
|
|
30427
|
-
const encode$
|
|
30590
|
+
const encode$a = (attributes) => {
|
|
30428
30591
|
return attributes["w:name"];
|
|
30429
30592
|
};
|
|
30430
|
-
const decode$
|
|
30593
|
+
const decode$a = (attrs) => {
|
|
30431
30594
|
return attrs.name;
|
|
30432
30595
|
};
|
|
30433
30596
|
const attrConfig$5 = Object.freeze({
|
|
30434
30597
|
xmlName: "w:name",
|
|
30435
30598
|
sdName: "name",
|
|
30436
|
-
encode: encode$
|
|
30437
|
-
decode: decode$
|
|
30599
|
+
encode: encode$a,
|
|
30600
|
+
decode: decode$a
|
|
30438
30601
|
});
|
|
30439
|
-
const encode$
|
|
30602
|
+
const encode$9 = (attributes) => {
|
|
30440
30603
|
return attributes["w:colFirst"];
|
|
30441
30604
|
};
|
|
30442
|
-
const decode$
|
|
30605
|
+
const decode$9 = (attrs) => {
|
|
30443
30606
|
return attrs.colFirst;
|
|
30444
30607
|
};
|
|
30445
30608
|
const attrConfig$4 = Object.freeze({
|
|
30446
30609
|
xmlName: "w:colFirst",
|
|
30447
30610
|
sdName: "colFirst",
|
|
30448
|
-
encode: encode$
|
|
30449
|
-
decode: decode$
|
|
30611
|
+
encode: encode$9,
|
|
30612
|
+
decode: decode$9
|
|
30450
30613
|
});
|
|
30451
|
-
const encode$
|
|
30614
|
+
const encode$8 = (attributes) => {
|
|
30452
30615
|
return attributes["w:colLast"];
|
|
30453
30616
|
};
|
|
30454
|
-
const decode$
|
|
30617
|
+
const decode$8 = (attrs) => {
|
|
30455
30618
|
return attrs.colLast;
|
|
30456
30619
|
};
|
|
30457
30620
|
const attrConfig$3 = Object.freeze({
|
|
30458
30621
|
xmlName: "w:colLast",
|
|
30459
30622
|
sdName: "colLast",
|
|
30460
|
-
encode: encode$
|
|
30461
|
-
decode: decode$
|
|
30623
|
+
encode: encode$8,
|
|
30624
|
+
decode: decode$8
|
|
30462
30625
|
});
|
|
30463
|
-
const encode$
|
|
30626
|
+
const encode$7 = (attributes) => {
|
|
30464
30627
|
return attributes["w:displacedByCustomXml"];
|
|
30465
30628
|
};
|
|
30466
|
-
const decode$
|
|
30629
|
+
const decode$7 = (attrs) => {
|
|
30467
30630
|
return attrs.displacedByCustomXml;
|
|
30468
30631
|
};
|
|
30469
30632
|
const attrConfig$2 = Object.freeze({
|
|
30470
30633
|
xmlName: "w:displacedByCustomXml",
|
|
30471
30634
|
sdName: "displacedByCustomXml",
|
|
30472
|
-
encode: encode$
|
|
30473
|
-
decode: decode$
|
|
30635
|
+
encode: encode$7,
|
|
30636
|
+
decode: decode$7
|
|
30474
30637
|
});
|
|
30475
30638
|
const validXmlAttributes$2 = [attrConfig$6, attrConfig$5, attrConfig$4, attrConfig$3, attrConfig$2];
|
|
30476
|
-
const XML_NODE_NAME$
|
|
30477
|
-
const SD_NODE_NAME$
|
|
30478
|
-
const encode$
|
|
30639
|
+
const XML_NODE_NAME$4 = "w:bookmarkStart";
|
|
30640
|
+
const SD_NODE_NAME$4 = "bookmarkStart";
|
|
30641
|
+
const encode$6 = (params, encodedAttrs = {}) => {
|
|
30479
30642
|
return {
|
|
30480
30643
|
type: "bookmarkStart",
|
|
30481
30644
|
attrs: encodedAttrs
|
|
30482
30645
|
};
|
|
30483
30646
|
};
|
|
30484
|
-
const decode$
|
|
30647
|
+
const decode$6 = (params, decodedAttrs = {}) => {
|
|
30485
30648
|
const result = {
|
|
30486
30649
|
name: "w:bookmarkStart",
|
|
30487
30650
|
elements: []
|
|
@@ -30491,49 +30654,49 @@ const decode$4 = (params, decodedAttrs = {}) => {
|
|
|
30491
30654
|
}
|
|
30492
30655
|
return result;
|
|
30493
30656
|
};
|
|
30494
|
-
const config$
|
|
30495
|
-
xmlName: XML_NODE_NAME$
|
|
30496
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
30657
|
+
const config$4 = {
|
|
30658
|
+
xmlName: XML_NODE_NAME$4,
|
|
30659
|
+
sdNodeOrKeyName: SD_NODE_NAME$4,
|
|
30497
30660
|
type: NodeTranslator.translatorTypes.NODE,
|
|
30498
|
-
encode: encode$
|
|
30499
|
-
decode: decode$
|
|
30661
|
+
encode: encode$6,
|
|
30662
|
+
decode: decode$6,
|
|
30500
30663
|
attributes: validXmlAttributes$2
|
|
30501
30664
|
};
|
|
30502
|
-
const translator$
|
|
30503
|
-
const encode$
|
|
30665
|
+
const translator$4 = NodeTranslator.from(config$4);
|
|
30666
|
+
const encode$5 = (attributes) => {
|
|
30504
30667
|
return attributes["w:id"];
|
|
30505
30668
|
};
|
|
30506
|
-
const decode$
|
|
30669
|
+
const decode$5 = (attrs) => {
|
|
30507
30670
|
return attrs.id;
|
|
30508
30671
|
};
|
|
30509
30672
|
const attrConfig$1 = Object.freeze({
|
|
30510
30673
|
xmlName: "w:id",
|
|
30511
30674
|
sdName: "id",
|
|
30512
|
-
encode: encode$
|
|
30513
|
-
decode: decode$
|
|
30675
|
+
encode: encode$5,
|
|
30676
|
+
decode: decode$5
|
|
30514
30677
|
});
|
|
30515
|
-
const encode$
|
|
30678
|
+
const encode$4 = (attributes) => {
|
|
30516
30679
|
return attributes["w:displacedByCustomXml"];
|
|
30517
30680
|
};
|
|
30518
|
-
const decode$
|
|
30681
|
+
const decode$4 = (attrs) => {
|
|
30519
30682
|
return attrs.displacedByCustomXml;
|
|
30520
30683
|
};
|
|
30521
30684
|
const attrConfig = Object.freeze({
|
|
30522
30685
|
xmlName: "w:displacedByCustomXml",
|
|
30523
30686
|
sdName: "displacedByCustomXml",
|
|
30524
|
-
encode: encode$
|
|
30525
|
-
decode: decode$
|
|
30687
|
+
encode: encode$4,
|
|
30688
|
+
decode: decode$4
|
|
30526
30689
|
});
|
|
30527
30690
|
const validXmlAttributes$1 = [attrConfig$1, attrConfig];
|
|
30528
|
-
const XML_NODE_NAME$
|
|
30529
|
-
const SD_NODE_NAME$
|
|
30530
|
-
const encode$
|
|
30691
|
+
const XML_NODE_NAME$3 = "w:bookmarkEnd";
|
|
30692
|
+
const SD_NODE_NAME$3 = "bookmarkEnd";
|
|
30693
|
+
const encode$3 = (params, encodedAttrs = {}) => {
|
|
30531
30694
|
return {
|
|
30532
30695
|
type: "bookmarkEnd",
|
|
30533
30696
|
attrs: encodedAttrs
|
|
30534
30697
|
};
|
|
30535
30698
|
};
|
|
30536
|
-
const decode$
|
|
30699
|
+
const decode$3 = (params, decodedAttrs = {}) => {
|
|
30537
30700
|
const result = {
|
|
30538
30701
|
name: "w:bookmarkEnd",
|
|
30539
30702
|
elements: []
|
|
@@ -30543,64 +30706,294 @@ const decode$1 = (params, decodedAttrs = {}) => {
|
|
|
30543
30706
|
}
|
|
30544
30707
|
return result;
|
|
30545
30708
|
};
|
|
30709
|
+
const config$3 = {
|
|
30710
|
+
xmlName: XML_NODE_NAME$3,
|
|
30711
|
+
sdNodeOrKeyName: SD_NODE_NAME$3,
|
|
30712
|
+
type: NodeTranslator.translatorTypes.NODE,
|
|
30713
|
+
encode: encode$3,
|
|
30714
|
+
decode: decode$3,
|
|
30715
|
+
attributes: validXmlAttributes$1
|
|
30716
|
+
};
|
|
30717
|
+
const translator$3 = NodeTranslator.from(config$3);
|
|
30718
|
+
const XML_NODE_NAME$2 = "mc:AlternateContent";
|
|
30719
|
+
const SD_NODE_NAME$2 = [];
|
|
30720
|
+
const validXmlAttributes = [];
|
|
30721
|
+
function encode$2(params) {
|
|
30722
|
+
const { nodeListHandler } = params;
|
|
30723
|
+
const { node } = params.extraParams;
|
|
30724
|
+
if (!node || !node.type) {
|
|
30725
|
+
return null;
|
|
30726
|
+
}
|
|
30727
|
+
const allowedNamespaces = ["wps", "wp14", "w14", "w15"];
|
|
30728
|
+
const wpsNode = node.elements.find(
|
|
30729
|
+
(el) => el.name === "mc:Choice" && allowedNamespaces.includes(el.attributes["Requires"])
|
|
30730
|
+
);
|
|
30731
|
+
if (!wpsNode) {
|
|
30732
|
+
return null;
|
|
30733
|
+
}
|
|
30734
|
+
const contents = wpsNode.elements;
|
|
30735
|
+
return nodeListHandler.handler({
|
|
30736
|
+
...params,
|
|
30737
|
+
nodes: contents,
|
|
30738
|
+
path: [...params.path || [], wpsNode]
|
|
30739
|
+
});
|
|
30740
|
+
}
|
|
30741
|
+
function decode$2(params) {
|
|
30742
|
+
const { node } = params;
|
|
30743
|
+
const { drawingContent } = node.attrs;
|
|
30744
|
+
const drawing = {
|
|
30745
|
+
name: "w:drawing",
|
|
30746
|
+
elements: [...drawingContent ? [...drawingContent.elements || []] : []]
|
|
30747
|
+
};
|
|
30748
|
+
const choice = {
|
|
30749
|
+
name: "mc:Choice",
|
|
30750
|
+
attributes: { Requires: "wps" },
|
|
30751
|
+
elements: [drawing]
|
|
30752
|
+
};
|
|
30753
|
+
return {
|
|
30754
|
+
name: "mc:AlternateContent",
|
|
30755
|
+
elements: [choice]
|
|
30756
|
+
};
|
|
30757
|
+
}
|
|
30758
|
+
const config$2 = {
|
|
30759
|
+
xmlName: XML_NODE_NAME$2,
|
|
30760
|
+
sdNodeOrKeyName: SD_NODE_NAME$2,
|
|
30761
|
+
type: NodeTranslator.translatorTypes.NODE,
|
|
30762
|
+
encode: encode$2,
|
|
30763
|
+
decode: decode$2,
|
|
30764
|
+
attributes: validXmlAttributes
|
|
30765
|
+
};
|
|
30766
|
+
const translator$2 = NodeTranslator.from(config$2);
|
|
30767
|
+
const XML_NODE_NAME$1 = "sd:pageReference";
|
|
30768
|
+
const SD_NODE_NAME$1 = "pageReference";
|
|
30769
|
+
const encode$1 = (params, _2) => {
|
|
30770
|
+
const { nodes = [], nodeListHandler } = params || {};
|
|
30771
|
+
const node = nodes[0];
|
|
30772
|
+
const processedText = nodeListHandler.handler({
|
|
30773
|
+
...params,
|
|
30774
|
+
nodes: node.elements
|
|
30775
|
+
});
|
|
30776
|
+
const processedNode = {
|
|
30777
|
+
type: "pageReference",
|
|
30778
|
+
attrs: {
|
|
30779
|
+
instruction: node.attributes?.instruction || "",
|
|
30780
|
+
marksAsAttrs: node.marks || []
|
|
30781
|
+
},
|
|
30782
|
+
content: processedText
|
|
30783
|
+
};
|
|
30784
|
+
return processedNode;
|
|
30785
|
+
};
|
|
30786
|
+
const decode$1 = (params, _2) => {
|
|
30787
|
+
const { node } = params;
|
|
30788
|
+
const outputMarks = processOutputMarks(node.attrs?.marksAsAttrs || []);
|
|
30789
|
+
const contentNodes = (node.content ?? []).flatMap((n) => exportSchemaToJson({ ...params, node: n }));
|
|
30790
|
+
const translated = [
|
|
30791
|
+
{
|
|
30792
|
+
name: "w:r",
|
|
30793
|
+
elements: [
|
|
30794
|
+
{
|
|
30795
|
+
name: "w:rPr",
|
|
30796
|
+
elements: outputMarks
|
|
30797
|
+
},
|
|
30798
|
+
{
|
|
30799
|
+
name: "w:fldChar",
|
|
30800
|
+
attributes: {
|
|
30801
|
+
"w:fldCharType": "begin"
|
|
30802
|
+
}
|
|
30803
|
+
}
|
|
30804
|
+
]
|
|
30805
|
+
},
|
|
30806
|
+
{
|
|
30807
|
+
name: "w:r",
|
|
30808
|
+
elements: [
|
|
30809
|
+
{
|
|
30810
|
+
name: "w:rPr",
|
|
30811
|
+
elements: outputMarks
|
|
30812
|
+
},
|
|
30813
|
+
{
|
|
30814
|
+
name: "w:instrText",
|
|
30815
|
+
attributes: { "xml:space": "preserve" },
|
|
30816
|
+
elements: [
|
|
30817
|
+
{
|
|
30818
|
+
type: "text",
|
|
30819
|
+
text: `${node.attrs.instruction}`
|
|
30820
|
+
}
|
|
30821
|
+
]
|
|
30822
|
+
}
|
|
30823
|
+
]
|
|
30824
|
+
},
|
|
30825
|
+
{
|
|
30826
|
+
name: "w:r",
|
|
30827
|
+
elements: [
|
|
30828
|
+
{
|
|
30829
|
+
name: "w:rPr",
|
|
30830
|
+
elements: outputMarks
|
|
30831
|
+
},
|
|
30832
|
+
{
|
|
30833
|
+
name: "w:fldChar",
|
|
30834
|
+
attributes: {
|
|
30835
|
+
"w:fldCharType": "separate"
|
|
30836
|
+
}
|
|
30837
|
+
}
|
|
30838
|
+
]
|
|
30839
|
+
},
|
|
30840
|
+
...contentNodes,
|
|
30841
|
+
{
|
|
30842
|
+
name: "w:r",
|
|
30843
|
+
elements: [
|
|
30844
|
+
{
|
|
30845
|
+
name: "w:rPr",
|
|
30846
|
+
elements: outputMarks
|
|
30847
|
+
},
|
|
30848
|
+
{
|
|
30849
|
+
name: "w:fldChar",
|
|
30850
|
+
attributes: {
|
|
30851
|
+
"w:fldCharType": "end"
|
|
30852
|
+
}
|
|
30853
|
+
}
|
|
30854
|
+
]
|
|
30855
|
+
}
|
|
30856
|
+
];
|
|
30857
|
+
return translated;
|
|
30858
|
+
};
|
|
30546
30859
|
const config$1 = {
|
|
30547
30860
|
xmlName: XML_NODE_NAME$1,
|
|
30548
30861
|
sdNodeOrKeyName: SD_NODE_NAME$1,
|
|
30549
30862
|
type: NodeTranslator.translatorTypes.NODE,
|
|
30550
30863
|
encode: encode$1,
|
|
30551
|
-
decode: decode$1
|
|
30552
|
-
attributes: validXmlAttributes$1
|
|
30864
|
+
decode: decode$1
|
|
30553
30865
|
};
|
|
30554
30866
|
const translator$1 = NodeTranslator.from(config$1);
|
|
30555
|
-
const XML_NODE_NAME = "
|
|
30556
|
-
const SD_NODE_NAME =
|
|
30557
|
-
const
|
|
30558
|
-
|
|
30559
|
-
const
|
|
30560
|
-
const
|
|
30561
|
-
if (!node || !node.type) {
|
|
30562
|
-
return null;
|
|
30563
|
-
}
|
|
30564
|
-
const allowedNamespaces = ["wps", "wp14", "w14", "w15"];
|
|
30565
|
-
const wpsNode = node.elements.find(
|
|
30566
|
-
(el) => el.name === "mc:Choice" && allowedNamespaces.includes(el.attributes["Requires"])
|
|
30567
|
-
);
|
|
30568
|
-
if (!wpsNode) {
|
|
30569
|
-
return null;
|
|
30570
|
-
}
|
|
30571
|
-
const contents = wpsNode.elements;
|
|
30572
|
-
return nodeListHandler.handler({
|
|
30867
|
+
const XML_NODE_NAME = "sd:tableOfContents";
|
|
30868
|
+
const SD_NODE_NAME = "tableOfContents";
|
|
30869
|
+
const encode = (params, _2) => {
|
|
30870
|
+
const { nodes = [], nodeListHandler } = params || {};
|
|
30871
|
+
const node = nodes[0];
|
|
30872
|
+
const processedContent = nodeListHandler.handler({
|
|
30573
30873
|
...params,
|
|
30574
|
-
nodes:
|
|
30575
|
-
path: [...params.path || [], wpsNode]
|
|
30874
|
+
nodes: node.elements || []
|
|
30576
30875
|
});
|
|
30577
|
-
|
|
30578
|
-
|
|
30579
|
-
|
|
30580
|
-
|
|
30581
|
-
|
|
30582
|
-
|
|
30583
|
-
elements: [...drawingContent ? [...drawingContent.elements || []] : []]
|
|
30584
|
-
};
|
|
30585
|
-
const choice = {
|
|
30586
|
-
name: "mc:Choice",
|
|
30587
|
-
attributes: { Requires: "wps" },
|
|
30588
|
-
elements: [drawing]
|
|
30589
|
-
};
|
|
30590
|
-
return {
|
|
30591
|
-
name: "mc:AlternateContent",
|
|
30592
|
-
elements: [choice]
|
|
30876
|
+
const processedNode = {
|
|
30877
|
+
type: "tableOfContents",
|
|
30878
|
+
attrs: {
|
|
30879
|
+
instruction: node.attributes?.instruction || ""
|
|
30880
|
+
},
|
|
30881
|
+
content: processedContent
|
|
30593
30882
|
};
|
|
30594
|
-
|
|
30883
|
+
return processedNode;
|
|
30884
|
+
};
|
|
30885
|
+
const decode = (params, _2) => {
|
|
30886
|
+
const { node } = params;
|
|
30887
|
+
const contentNodes = node.content.map((n) => exportSchemaToJson({ ...params, node: n }));
|
|
30888
|
+
const tocBeginElements = [
|
|
30889
|
+
{
|
|
30890
|
+
name: "w:r",
|
|
30891
|
+
elements: [{ name: "w:fldChar", attributes: { "w:fldCharType": "begin" }, elements: [] }]
|
|
30892
|
+
},
|
|
30893
|
+
{
|
|
30894
|
+
name: "w:r",
|
|
30895
|
+
elements: [
|
|
30896
|
+
{
|
|
30897
|
+
name: "w:instrText",
|
|
30898
|
+
attributes: { "xml:space": "preserve" },
|
|
30899
|
+
elements: [{ text: node.attrs?.instruction || "", type: "text", name: "#text", elements: [] }]
|
|
30900
|
+
}
|
|
30901
|
+
]
|
|
30902
|
+
},
|
|
30903
|
+
{ name: "w:r", elements: [{ name: "w:fldChar", attributes: { "w:fldCharType": "separate" }, elements: [] }] }
|
|
30904
|
+
];
|
|
30905
|
+
if (contentNodes.length > 0) {
|
|
30906
|
+
const firstParagraph = contentNodes[0];
|
|
30907
|
+
let insertIndex = 0;
|
|
30908
|
+
if (firstParagraph.elements) {
|
|
30909
|
+
const pPrIndex = firstParagraph.elements.findIndex((el) => el.name === "w:pPr");
|
|
30910
|
+
insertIndex = pPrIndex >= 0 ? pPrIndex + 1 : 0;
|
|
30911
|
+
} else {
|
|
30912
|
+
firstParagraph.elements = [];
|
|
30913
|
+
}
|
|
30914
|
+
firstParagraph.elements.splice(insertIndex, 0, ...tocBeginElements);
|
|
30915
|
+
} else {
|
|
30916
|
+
contentNodes.push({
|
|
30917
|
+
name: "w:p",
|
|
30918
|
+
elements: tocBeginElements
|
|
30919
|
+
});
|
|
30920
|
+
}
|
|
30921
|
+
const tocEndElements = [
|
|
30922
|
+
{ name: "w:r", elements: [{ name: "w:fldChar", attributes: { "w:fldCharType": "end" }, elements: [] }] }
|
|
30923
|
+
];
|
|
30924
|
+
const lastParagraph = contentNodes[contentNodes.length - 1];
|
|
30925
|
+
if (lastParagraph.elements) {
|
|
30926
|
+
lastParagraph.elements.push(...tocEndElements);
|
|
30927
|
+
} else {
|
|
30928
|
+
lastParagraph.elements = [...tocEndElements];
|
|
30929
|
+
}
|
|
30930
|
+
return contentNodes;
|
|
30931
|
+
};
|
|
30595
30932
|
const config = {
|
|
30596
30933
|
xmlName: XML_NODE_NAME,
|
|
30597
30934
|
sdNodeOrKeyName: SD_NODE_NAME,
|
|
30598
30935
|
type: NodeTranslator.translatorTypes.NODE,
|
|
30599
30936
|
encode,
|
|
30600
|
-
decode
|
|
30601
|
-
attributes: validXmlAttributes
|
|
30937
|
+
decode
|
|
30602
30938
|
};
|
|
30603
30939
|
const translator = NodeTranslator.from(config);
|
|
30940
|
+
const DEFAULT_SECTION_PROPS_TWIPS = Object.freeze({
|
|
30941
|
+
pageSize: Object.freeze({ width: "12240", height: "15840" }),
|
|
30942
|
+
pageMargins: Object.freeze({
|
|
30943
|
+
top: "1440",
|
|
30944
|
+
right: "1440",
|
|
30945
|
+
bottom: "1440",
|
|
30946
|
+
left: "1440",
|
|
30947
|
+
header: "720",
|
|
30948
|
+
footer: "720",
|
|
30949
|
+
gutter: "0"
|
|
30950
|
+
})
|
|
30951
|
+
});
|
|
30952
|
+
const ensureSectionLayoutDefaults = (sectPr, converter) => {
|
|
30953
|
+
if (!sectPr) {
|
|
30954
|
+
return {
|
|
30955
|
+
type: "element",
|
|
30956
|
+
name: "w:sectPr",
|
|
30957
|
+
elements: []
|
|
30958
|
+
};
|
|
30959
|
+
}
|
|
30960
|
+
if (!sectPr.elements) sectPr.elements = [];
|
|
30961
|
+
const ensureChild = (name) => {
|
|
30962
|
+
let child = sectPr.elements.find((n) => n.name === name);
|
|
30963
|
+
if (!child) {
|
|
30964
|
+
child = {
|
|
30965
|
+
type: "element",
|
|
30966
|
+
name,
|
|
30967
|
+
elements: [],
|
|
30968
|
+
attributes: {}
|
|
30969
|
+
};
|
|
30970
|
+
sectPr.elements.push(child);
|
|
30971
|
+
} else {
|
|
30972
|
+
if (!child.elements) child.elements = [];
|
|
30973
|
+
if (!child.attributes) child.attributes = {};
|
|
30974
|
+
}
|
|
30975
|
+
return child;
|
|
30976
|
+
};
|
|
30977
|
+
const pageSize = converter?.pageStyles?.pageSize;
|
|
30978
|
+
const pgSz = ensureChild("w:pgSz");
|
|
30979
|
+
if (pageSize?.width != null) pgSz.attributes["w:w"] = String(inchesToTwips(pageSize.width));
|
|
30980
|
+
if (pageSize?.height != null) pgSz.attributes["w:h"] = String(inchesToTwips(pageSize.height));
|
|
30981
|
+
if (pgSz.attributes["w:w"] == null) pgSz.attributes["w:w"] = DEFAULT_SECTION_PROPS_TWIPS.pageSize.width;
|
|
30982
|
+
if (pgSz.attributes["w:h"] == null) pgSz.attributes["w:h"] = DEFAULT_SECTION_PROPS_TWIPS.pageSize.height;
|
|
30983
|
+
const pageMargins = converter?.pageStyles?.pageMargins;
|
|
30984
|
+
const pgMar = ensureChild("w:pgMar");
|
|
30985
|
+
if (pageMargins) {
|
|
30986
|
+
Object.entries(pageMargins).forEach(([key, value]) => {
|
|
30987
|
+
const converted = inchesToTwips(value);
|
|
30988
|
+
if (converted != null) pgMar.attributes[`w:${key}`] = String(converted);
|
|
30989
|
+
});
|
|
30990
|
+
}
|
|
30991
|
+
Object.entries(DEFAULT_SECTION_PROPS_TWIPS.pageMargins).forEach(([key, value]) => {
|
|
30992
|
+
const attrKey = `w:${key}`;
|
|
30993
|
+
if (pgMar.attributes[attrKey] == null) pgMar.attributes[attrKey] = value;
|
|
30994
|
+
});
|
|
30995
|
+
return sectPr;
|
|
30996
|
+
};
|
|
30604
30997
|
const isLineBreakOnlyRun = (node) => {
|
|
30605
30998
|
if (!node) return false;
|
|
30606
30999
|
if (node.type === "lineBreak" || node.type === "hardBreak") return true;
|
|
@@ -30615,32 +31008,35 @@ function exportSchemaToJson(params) {
|
|
|
30615
31008
|
doc: translateDocumentNode,
|
|
30616
31009
|
body: translateBodyNode,
|
|
30617
31010
|
heading: translateHeadingNode,
|
|
30618
|
-
paragraph: translator$
|
|
30619
|
-
run: translator$
|
|
31011
|
+
paragraph: translator$16,
|
|
31012
|
+
run: translator$V,
|
|
30620
31013
|
text: translateTextNode,
|
|
30621
31014
|
bulletList: translateList,
|
|
30622
31015
|
orderedList: translateList,
|
|
30623
|
-
lineBreak: translator$
|
|
30624
|
-
table: translator$
|
|
30625
|
-
tableRow: translator$
|
|
30626
|
-
tableCell: translator$
|
|
30627
|
-
bookmarkStart: translator$
|
|
30628
|
-
bookmarkEnd: translator$
|
|
30629
|
-
fieldAnnotation: translator$
|
|
30630
|
-
tab: translator$
|
|
30631
|
-
image: translator$
|
|
30632
|
-
hardBreak: translator$
|
|
31016
|
+
lineBreak: translator$19,
|
|
31017
|
+
table: translator$a,
|
|
31018
|
+
tableRow: translator$H,
|
|
31019
|
+
tableCell: translator$9,
|
|
31020
|
+
bookmarkStart: translator$4,
|
|
31021
|
+
bookmarkEnd: translator$3,
|
|
31022
|
+
fieldAnnotation: translator$5,
|
|
31023
|
+
tab: translator$17,
|
|
31024
|
+
image: translator$6,
|
|
31025
|
+
hardBreak: translator$19,
|
|
30633
31026
|
commentRangeStart: () => translateCommentNode(params, "Start"),
|
|
30634
31027
|
commentRangeEnd: () => translateCommentNode(params, "End"),
|
|
30635
31028
|
commentReference: () => null,
|
|
30636
31029
|
shapeContainer: translateShapeContainer,
|
|
30637
31030
|
shapeTextbox: translateShapeTextbox,
|
|
30638
31031
|
contentBlock: translateContentBlock,
|
|
30639
|
-
structuredContent: translator$
|
|
30640
|
-
structuredContentBlock: translator$
|
|
30641
|
-
|
|
31032
|
+
structuredContent: translator$5,
|
|
31033
|
+
structuredContentBlock: translator$5,
|
|
31034
|
+
documentPartObject: translator$5,
|
|
31035
|
+
documentSection: translator$5,
|
|
30642
31036
|
"page-number": translatePageNumberNode,
|
|
30643
|
-
"total-page-number": translateTotalPageNumberNode
|
|
31037
|
+
"total-page-number": translateTotalPageNumberNode,
|
|
31038
|
+
pageReference: translator$1,
|
|
31039
|
+
tableOfContents: translator
|
|
30644
31040
|
};
|
|
30645
31041
|
let handler2 = router[type2];
|
|
30646
31042
|
if (handler2 && "decode" in handler2 && typeof handler2.decode === "function") {
|
|
@@ -30653,28 +31049,30 @@ function exportSchemaToJson(params) {
|
|
|
30653
31049
|
return handler2(params);
|
|
30654
31050
|
}
|
|
30655
31051
|
function translateBodyNode(params) {
|
|
30656
|
-
let sectPr = params.bodyNode?.elements
|
|
31052
|
+
let sectPr = params.bodyNode?.elements?.find((n) => n.name === "w:sectPr");
|
|
31053
|
+
if (!sectPr) {
|
|
31054
|
+
sectPr = {
|
|
31055
|
+
type: "element",
|
|
31056
|
+
name: "w:sectPr",
|
|
31057
|
+
elements: []
|
|
31058
|
+
};
|
|
31059
|
+
} else if (!sectPr.elements) {
|
|
31060
|
+
sectPr = { ...sectPr, elements: [] };
|
|
31061
|
+
}
|
|
31062
|
+
sectPr = ensureSectionLayoutDefaults(sectPr, params.converter);
|
|
30657
31063
|
if (params.converter) {
|
|
30658
|
-
const hasHeader = sectPr
|
|
31064
|
+
const hasHeader = sectPr.elements?.some((n) => n.name === "w:headerReference");
|
|
30659
31065
|
const hasDefaultHeader = params.converter.headerIds?.default;
|
|
30660
31066
|
if (!hasHeader && hasDefaultHeader && !params.editor.options.isHeaderOrFooter) {
|
|
30661
31067
|
const defaultHeader = generateDefaultHeaderFooter("header", params.converter.headerIds?.default);
|
|
30662
31068
|
sectPr.elements.push(defaultHeader);
|
|
30663
31069
|
}
|
|
30664
|
-
const hasFooter = sectPr
|
|
31070
|
+
const hasFooter = sectPr.elements?.some((n) => n.name === "w:footerReference");
|
|
30665
31071
|
const hasDefaultFooter = params.converter.footerIds?.default;
|
|
30666
31072
|
if (!hasFooter && hasDefaultFooter && !params.editor.options.isHeaderOrFooter) {
|
|
30667
31073
|
const defaultFooter = generateDefaultHeaderFooter("footer", params.converter.footerIds?.default);
|
|
30668
31074
|
sectPr.elements.push(defaultFooter);
|
|
30669
31075
|
}
|
|
30670
|
-
const newMargins = params.converter.pageStyles.pageMargins;
|
|
30671
|
-
const sectPrMargins = sectPr.elements.find((n) => n.name === "w:pgMar");
|
|
30672
|
-
const { attributes } = sectPrMargins;
|
|
30673
|
-
Object.entries(newMargins).forEach(([key, value]) => {
|
|
30674
|
-
const convertedValue = inchesToTwips(value);
|
|
30675
|
-
attributes[`w:${key}`] = convertedValue;
|
|
30676
|
-
});
|
|
30677
|
-
sectPrMargins.attributes = attributes;
|
|
30678
31076
|
}
|
|
30679
31077
|
const elements = translateChildNodes(params);
|
|
30680
31078
|
if (params.isHeaderFooter) {
|
|
@@ -30976,8 +31374,6 @@ function translateTextNode(params) {
|
|
|
30976
31374
|
const trackedMarks = [TrackInsertMarkName, TrackDeleteMarkName];
|
|
30977
31375
|
const isTrackedNode = node.marks?.some((m2) => trackedMarks.includes(m2.type));
|
|
30978
31376
|
if (isTrackedNode) return translateTrackedNode(params);
|
|
30979
|
-
const isLinkNode = node.marks?.some((m2) => m2.type === "link");
|
|
30980
|
-
if (isLinkNode) return translator$7.decode(params);
|
|
30981
31377
|
const { text, marks = [] } = node;
|
|
30982
31378
|
return getTextNodeForExport(text, marks, params);
|
|
30983
31379
|
}
|
|
@@ -31283,7 +31679,7 @@ function translateMark(mark) {
|
|
|
31283
31679
|
markElement.type = "element";
|
|
31284
31680
|
break;
|
|
31285
31681
|
case "underline": {
|
|
31286
|
-
const translated = translator$
|
|
31682
|
+
const translated = translator$13.decode({
|
|
31287
31683
|
node: {
|
|
31288
31684
|
attrs: {
|
|
31289
31685
|
underlineType: attrs.underlineType ?? attrs.underline ?? null,
|
|
@@ -31347,7 +31743,7 @@ function translateMark(mark) {
|
|
|
31347
31743
|
break;
|
|
31348
31744
|
case "highlight": {
|
|
31349
31745
|
const highlightValue = attrs.color ?? attrs.highlight ?? null;
|
|
31350
|
-
const translated = translator$
|
|
31746
|
+
const translated = translator$18.decode({ node: { attrs: { highlight: highlightValue } } });
|
|
31351
31747
|
return translated || {};
|
|
31352
31748
|
}
|
|
31353
31749
|
}
|
|
@@ -31375,7 +31771,7 @@ function translateShapeContainer(params) {
|
|
|
31375
31771
|
const pict = {
|
|
31376
31772
|
name: "w:pict",
|
|
31377
31773
|
attributes: {
|
|
31378
|
-
"w14:anchorId":
|
|
31774
|
+
"w14:anchorId": generateRandomSigned32BitIntStrId()
|
|
31379
31775
|
},
|
|
31380
31776
|
elements: [shape]
|
|
31381
31777
|
};
|
|
@@ -31407,7 +31803,7 @@ function translateContentBlock(params) {
|
|
|
31407
31803
|
if (vmlAttributes || horizontalRule) {
|
|
31408
31804
|
return translateVRectContentBlock(params);
|
|
31409
31805
|
}
|
|
31410
|
-
const alternateContent = translator.decode(params);
|
|
31806
|
+
const alternateContent = translator$2.decode(params);
|
|
31411
31807
|
return wrapTextInRun(alternateContent);
|
|
31412
31808
|
}
|
|
31413
31809
|
function translateVRectContentBlock(params) {
|
|
@@ -31442,7 +31838,7 @@ function translateVRectContentBlock(params) {
|
|
|
31442
31838
|
const pict = {
|
|
31443
31839
|
name: "w:pict",
|
|
31444
31840
|
attributes: {
|
|
31445
|
-
"w14:anchorId":
|
|
31841
|
+
"w14:anchorId": generateRandomSigned32BitIntStrId()
|
|
31446
31842
|
},
|
|
31447
31843
|
elements: [rect]
|
|
31448
31844
|
};
|
|
@@ -31552,6 +31948,7 @@ const getAutoPageJson = (type2, outputMarks = []) => {
|
|
|
31552
31948
|
},
|
|
31553
31949
|
{
|
|
31554
31950
|
name: "w:instrText",
|
|
31951
|
+
attributes: { "xml:space": "preserve" },
|
|
31555
31952
|
elements: [
|
|
31556
31953
|
{
|
|
31557
31954
|
type: "text",
|
|
@@ -31611,7 +32008,7 @@ const handleDrawingNode = (params) => {
|
|
|
31611
32008
|
if (mainNode.name === "w:drawing") node = mainNode;
|
|
31612
32009
|
else node = mainNode.elements.find((el) => el.name === "w:drawing");
|
|
31613
32010
|
if (!node) return { nodes: [], consumed: 0 };
|
|
31614
|
-
const schemaNode = translator$
|
|
32011
|
+
const schemaNode = translator$6.encode(params);
|
|
31615
32012
|
const newNodes = schemaNode ? [schemaNode] : [];
|
|
31616
32013
|
return { nodes: newNodes, consumed: 1 };
|
|
31617
32014
|
};
|
|
@@ -31713,8 +32110,8 @@ const trackChangeNodeHandlerEntity = {
|
|
|
31713
32110
|
handlerName: "trackChangeNodeHandler",
|
|
31714
32111
|
handler: handleTrackChangeNode
|
|
31715
32112
|
};
|
|
31716
|
-
const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$
|
|
31717
|
-
const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$
|
|
32113
|
+
const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$W);
|
|
32114
|
+
const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$V);
|
|
31718
32115
|
const handleTextNode = (params) => {
|
|
31719
32116
|
const { nodes, insideTrackChange } = params;
|
|
31720
32117
|
if (nodes.length === 0 || !(nodes[0].name === "w:t" || insideTrackChange && nodes[0].name === "w:delText")) {
|
|
@@ -31755,7 +32152,7 @@ const handleParagraphNode = (params) => {
|
|
|
31755
32152
|
if (nodes.length === 0 || nodes[0].name !== "w:p") {
|
|
31756
32153
|
return { nodes: [], consumed: 0 };
|
|
31757
32154
|
}
|
|
31758
|
-
const schemaNode = translator$
|
|
32155
|
+
const schemaNode = translator$16.encode(params);
|
|
31759
32156
|
const newNodes = schemaNode ? [schemaNode] : [];
|
|
31760
32157
|
return { nodes: newNodes, consumed: 1 };
|
|
31761
32158
|
};
|
|
@@ -31768,7 +32165,7 @@ const handleSdtNode = (params) => {
|
|
|
31768
32165
|
if (nodes.length === 0 || nodes[0].name !== "w:sdt") {
|
|
31769
32166
|
return { nodes: [], consumed: 0 };
|
|
31770
32167
|
}
|
|
31771
|
-
const result = translator$
|
|
32168
|
+
const result = translator$5.encode(params);
|
|
31772
32169
|
if (!result) {
|
|
31773
32170
|
return { nodes: [], consumed: 0 };
|
|
31774
32171
|
}
|
|
@@ -31858,7 +32255,7 @@ const handler = (params) => {
|
|
|
31858
32255
|
if (nodes.length === 0 || nodes[0].name !== "w:br") {
|
|
31859
32256
|
return { nodes: [], consumed: 0 };
|
|
31860
32257
|
}
|
|
31861
|
-
const result = translator$
|
|
32258
|
+
const result = translator$19.encode(params);
|
|
31862
32259
|
if (!result) return { nodes: [], consumed: 0 };
|
|
31863
32260
|
return {
|
|
31864
32261
|
nodes: [result],
|
|
@@ -31930,7 +32327,7 @@ const handleBookmarkStartNode = (params) => {
|
|
|
31930
32327
|
if (isCustomMarkBookmark(nodes[0], params.editor)) {
|
|
31931
32328
|
return handleBookmarkNode(params);
|
|
31932
32329
|
}
|
|
31933
|
-
const node = translator$
|
|
32330
|
+
const node = translator$4.encode(params);
|
|
31934
32331
|
if (!node) return { nodes: [], consumed: 0 };
|
|
31935
32332
|
return { nodes: [node], consumed: 1 };
|
|
31936
32333
|
};
|
|
@@ -31962,7 +32359,7 @@ const handleBookmarkEndNode = (params) => {
|
|
|
31962
32359
|
if (!nodes.length || nodes[0].name !== "w:bookmarkEnd") {
|
|
31963
32360
|
return { nodes: [], consumed: 0 };
|
|
31964
32361
|
}
|
|
31965
|
-
const node = translator$
|
|
32362
|
+
const node = translator$3.encode(params);
|
|
31966
32363
|
if (!node) return { nodes: [], consumed: 0 };
|
|
31967
32364
|
return { nodes: [node], consumed: 1 };
|
|
31968
32365
|
};
|
|
@@ -32095,14 +32492,22 @@ const autoTotalPageCountEntity = {
|
|
|
32095
32492
|
handlerName: "autoTotalPageCountEntity",
|
|
32096
32493
|
handler: handleAutoTotalPageNumber
|
|
32097
32494
|
};
|
|
32495
|
+
const pageReferenceEntity = generateV2HandlerEntity("pageReferenceNodeHandler", translator$1);
|
|
32098
32496
|
const handlePictNode = (params) => {
|
|
32099
32497
|
const { nodes } = params;
|
|
32100
32498
|
if (!nodes.length || nodes[0].name !== "w:p") {
|
|
32101
32499
|
return { nodes: [], consumed: 0 };
|
|
32102
32500
|
}
|
|
32103
32501
|
const [pNode] = nodes;
|
|
32104
|
-
const
|
|
32105
|
-
|
|
32502
|
+
const runs = pNode.elements?.filter((el) => el.name === "w:r") || [];
|
|
32503
|
+
let pict = null;
|
|
32504
|
+
for (const run2 of runs) {
|
|
32505
|
+
const foundPict = run2.elements?.find((el) => el.name === "w:pict");
|
|
32506
|
+
if (foundPict) {
|
|
32507
|
+
pict = foundPict;
|
|
32508
|
+
break;
|
|
32509
|
+
}
|
|
32510
|
+
}
|
|
32106
32511
|
if (!pict) {
|
|
32107
32512
|
return { nodes: [], consumed: 0 };
|
|
32108
32513
|
}
|
|
@@ -32586,6 +32991,7 @@ const getDefaultStyleDefinition = (defaultStyleId, docx) => {
|
|
|
32586
32991
|
const spacing = pPr?.elements?.find((el) => el.name === "w:spacing");
|
|
32587
32992
|
const justify = pPr?.elements?.find((el) => el.name === "w:jc");
|
|
32588
32993
|
const indent = pPr?.elements?.find((el) => el.name === "w:ind");
|
|
32994
|
+
const tabs = pPr?.elements?.find((el) => el.name === "w:tabs");
|
|
32589
32995
|
let lineSpaceBefore, lineSpaceAfter, line;
|
|
32590
32996
|
if (spacing) {
|
|
32591
32997
|
lineSpaceBefore = twipsToPixels(spacing?.attributes["w:before"]);
|
|
@@ -32599,6 +33005,22 @@ const getDefaultStyleDefinition = (defaultStyleId, docx) => {
|
|
|
32599
33005
|
rightIndent = twipsToPixels(indent?.attributes["w:right"]);
|
|
32600
33006
|
firstLine = twipsToPixels(indent?.attributes["w:firstLine"]);
|
|
32601
33007
|
}
|
|
33008
|
+
let tabStops = [];
|
|
33009
|
+
if (tabs) {
|
|
33010
|
+
tabStops = (tabs.elements || []).filter((el) => el.name === "w:tab").map((tab) => {
|
|
33011
|
+
let val = tab.attributes["w:val"];
|
|
33012
|
+
if (val == "left") {
|
|
33013
|
+
val = "start";
|
|
33014
|
+
} else if (val == "right") {
|
|
33015
|
+
val = "end";
|
|
33016
|
+
}
|
|
33017
|
+
return {
|
|
33018
|
+
val,
|
|
33019
|
+
pos: twipsToPixels(tab.attributes["w:pos"]),
|
|
33020
|
+
leader: tab.attributes["w:leader"]
|
|
33021
|
+
};
|
|
33022
|
+
});
|
|
33023
|
+
}
|
|
32602
33024
|
const keepNext = pPr?.elements?.find((el) => el.name === "w:keepNext");
|
|
32603
33025
|
const keepLines = pPr?.elements?.find((el) => el.name === "w:keepLines");
|
|
32604
33026
|
const outlineLevel = pPr?.elements?.find((el) => el.name === "w:outlineLvl");
|
|
@@ -32631,7 +33053,8 @@ const getDefaultStyleDefinition = (defaultStyleId, docx) => {
|
|
|
32631
33053
|
const parsedStyles = {
|
|
32632
33054
|
spacing: { lineSpaceAfter, lineSpaceBefore, line },
|
|
32633
33055
|
textAlign,
|
|
32634
|
-
indent: { leftIndent, rightIndent, firstLine }
|
|
33056
|
+
indent: { leftIndent, rightIndent, firstLine },
|
|
33057
|
+
tabStops: tabStops.length > 0 ? tabStops : null
|
|
32635
33058
|
};
|
|
32636
33059
|
parsedMarks.forEach((mark) => {
|
|
32637
33060
|
const { type: type2, attrs } = mark;
|
|
@@ -32655,13 +33078,213 @@ const handleTabNode = (params) => {
|
|
|
32655
33078
|
if (!nodes.length || nodes[0].name !== "w:tab") {
|
|
32656
33079
|
return { nodes: [], consumed: 0 };
|
|
32657
33080
|
}
|
|
32658
|
-
const node = translator$
|
|
33081
|
+
const node = translator$17.encode(params);
|
|
32659
33082
|
return { nodes: [node], consumed: 1 };
|
|
32660
33083
|
};
|
|
32661
33084
|
const tabNodeEntityHandler = {
|
|
32662
33085
|
handlerName: "w:tabTranslator",
|
|
32663
33086
|
handler: handleTabNode
|
|
32664
33087
|
};
|
|
33088
|
+
const tableOfContentsHandlerEntity = generateV2HandlerEntity("tableOfContentsHandler", translator);
|
|
33089
|
+
function preProcessPageInstruction(nodesToCombine, _2, __) {
|
|
33090
|
+
const pageNumNode = {
|
|
33091
|
+
name: "sd:autoPageNumber",
|
|
33092
|
+
type: "element"
|
|
33093
|
+
};
|
|
33094
|
+
nodesToCombine.forEach((n) => {
|
|
33095
|
+
const rPrNode = n.elements.find((el) => el.name === "w:rPr");
|
|
33096
|
+
if (rPrNode) pageNumNode.elements = [rPrNode];
|
|
33097
|
+
});
|
|
33098
|
+
return [pageNumNode];
|
|
33099
|
+
}
|
|
33100
|
+
function preProcessNumPagesInstruction(nodesToCombine, _2, __) {
|
|
33101
|
+
const totalPageNumNode = {
|
|
33102
|
+
name: "sd:totalPageNumber",
|
|
33103
|
+
type: "element"
|
|
33104
|
+
};
|
|
33105
|
+
nodesToCombine.forEach((n) => {
|
|
33106
|
+
const rPrNode = n.elements?.find((el) => el.name === "w:rPr");
|
|
33107
|
+
if (rPrNode) totalPageNumNode.elements = [rPrNode];
|
|
33108
|
+
});
|
|
33109
|
+
return [totalPageNumNode];
|
|
33110
|
+
}
|
|
33111
|
+
function preProcessPageRefInstruction(nodesToCombine, instrText, _2) {
|
|
33112
|
+
const pageRefNode = {
|
|
33113
|
+
name: "sd:pageReference",
|
|
33114
|
+
type: "element",
|
|
33115
|
+
attributes: {
|
|
33116
|
+
instruction: instrText
|
|
33117
|
+
},
|
|
33118
|
+
elements: nodesToCombine
|
|
33119
|
+
};
|
|
33120
|
+
return [pageRefNode];
|
|
33121
|
+
}
|
|
33122
|
+
function preProcessHyperlinkInstruction(nodesToCombine, instruction, docx) {
|
|
33123
|
+
const urlMatch = instruction.match(/HYPERLINK\s+"([^"]+)"/);
|
|
33124
|
+
let linkAttributes;
|
|
33125
|
+
if (urlMatch && urlMatch.length >= 2) {
|
|
33126
|
+
const url = urlMatch[1];
|
|
33127
|
+
const rels = docx["word/_rels/document.xml.rels"];
|
|
33128
|
+
const relationships = rels?.elements.find((el) => el.name === "Relationships");
|
|
33129
|
+
if (relationships) {
|
|
33130
|
+
const rId = generateDocxRandomId();
|
|
33131
|
+
relationships.elements.push({
|
|
33132
|
+
type: "element",
|
|
33133
|
+
name: "Relationship",
|
|
33134
|
+
attributes: {
|
|
33135
|
+
Id: rId,
|
|
33136
|
+
Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
|
|
33137
|
+
Target: url,
|
|
33138
|
+
TargetMode: "External"
|
|
33139
|
+
}
|
|
33140
|
+
});
|
|
33141
|
+
linkAttributes = { "r:id": rId };
|
|
33142
|
+
} else {
|
|
33143
|
+
linkAttributes = { "w:anchor": url };
|
|
33144
|
+
}
|
|
33145
|
+
} else {
|
|
33146
|
+
const availableSwitches = {
|
|
33147
|
+
"w:anchor": `l "(?<value>[^"]+)"`,
|
|
33148
|
+
new_window: `
|
|
33149
|
+
`,
|
|
33150
|
+
"w:tgtFrame": ` "(?<value>[^"]+)"`,
|
|
33151
|
+
"w:tooltip": `o "(?<value>[^"]+)"`
|
|
33152
|
+
};
|
|
33153
|
+
const parsedSwitches = {};
|
|
33154
|
+
for (const [key, regex] of Object.entries(availableSwitches)) {
|
|
33155
|
+
const match = instruction.match(new RegExp(regex));
|
|
33156
|
+
if (match) {
|
|
33157
|
+
parsedSwitches[key] = match.groups?.value || true;
|
|
33158
|
+
}
|
|
33159
|
+
}
|
|
33160
|
+
if (parsedSwitches.new_window) {
|
|
33161
|
+
parsedSwitches["w:tgtFrame"] = "_blank";
|
|
33162
|
+
delete parsedSwitches.new_window;
|
|
33163
|
+
}
|
|
33164
|
+
linkAttributes = { ...parsedSwitches };
|
|
33165
|
+
}
|
|
33166
|
+
return [
|
|
33167
|
+
{
|
|
33168
|
+
name: "w:hyperlink",
|
|
33169
|
+
type: "element",
|
|
33170
|
+
attributes: linkAttributes,
|
|
33171
|
+
elements: nodesToCombine
|
|
33172
|
+
}
|
|
33173
|
+
];
|
|
33174
|
+
}
|
|
33175
|
+
function preProcessTocInstruction(nodesToCombine, instrText) {
|
|
33176
|
+
return [
|
|
33177
|
+
{
|
|
33178
|
+
name: "sd:tableOfContents",
|
|
33179
|
+
type: "element",
|
|
33180
|
+
attributes: {
|
|
33181
|
+
instruction: instrText
|
|
33182
|
+
},
|
|
33183
|
+
elements: nodesToCombine
|
|
33184
|
+
}
|
|
33185
|
+
];
|
|
33186
|
+
}
|
|
33187
|
+
const getInstructionPreProcessor = (instruction) => {
|
|
33188
|
+
const instructionType = instruction.split(" ")[0];
|
|
33189
|
+
switch (instructionType) {
|
|
33190
|
+
case "PAGE":
|
|
33191
|
+
return preProcessPageInstruction;
|
|
33192
|
+
case "NUMPAGES":
|
|
33193
|
+
return preProcessNumPagesInstruction;
|
|
33194
|
+
case "PAGEREF":
|
|
33195
|
+
return preProcessPageRefInstruction;
|
|
33196
|
+
case "HYPERLINK":
|
|
33197
|
+
return preProcessHyperlinkInstruction;
|
|
33198
|
+
case "TOC":
|
|
33199
|
+
return preProcessTocInstruction;
|
|
33200
|
+
default:
|
|
33201
|
+
return null;
|
|
33202
|
+
}
|
|
33203
|
+
};
|
|
33204
|
+
const preProcessNodesForFldChar = (nodes = [], docx) => {
|
|
33205
|
+
const processedNodes = [];
|
|
33206
|
+
let collectedNodesStack = [];
|
|
33207
|
+
let currentFieldStack = [];
|
|
33208
|
+
let unpairedEnd = null;
|
|
33209
|
+
let collecting = false;
|
|
33210
|
+
const finalizeField = () => {
|
|
33211
|
+
if (collecting) {
|
|
33212
|
+
const collectedNodes = collectedNodesStack.pop().filter((n) => n !== null);
|
|
33213
|
+
const currentField = currentFieldStack.pop();
|
|
33214
|
+
const combined = _processCombinedNodesForFldChar(collectedNodes, currentField.instrText.trim(), docx);
|
|
33215
|
+
if (collectedNodesStack.length === 0) {
|
|
33216
|
+
processedNodes.push(...combined);
|
|
33217
|
+
} else {
|
|
33218
|
+
collectedNodesStack[collectedNodesStack.length - 1].push(...combined);
|
|
33219
|
+
}
|
|
33220
|
+
} else {
|
|
33221
|
+
unpairedEnd = true;
|
|
33222
|
+
}
|
|
33223
|
+
};
|
|
33224
|
+
for (const node of nodes) {
|
|
33225
|
+
const fldCharEl = node.elements?.find((el) => el.name === "w:fldChar");
|
|
33226
|
+
const fldType = fldCharEl?.attributes?.["w:fldCharType"];
|
|
33227
|
+
const instrTextEl = node.elements?.find((el) => el.name === "w:instrText");
|
|
33228
|
+
collecting = collectedNodesStack.length > 0;
|
|
33229
|
+
if (fldType === "begin") {
|
|
33230
|
+
collectedNodesStack.push([null]);
|
|
33231
|
+
currentFieldStack.push({ instrText: "" });
|
|
33232
|
+
continue;
|
|
33233
|
+
}
|
|
33234
|
+
if (instrTextEl && collecting && currentFieldStack.length > 0) {
|
|
33235
|
+
currentFieldStack[currentFieldStack.length - 1].instrText += (instrTextEl.elements?.[0]?.text || "") + " ";
|
|
33236
|
+
continue;
|
|
33237
|
+
}
|
|
33238
|
+
if (fldType === "end") {
|
|
33239
|
+
finalizeField();
|
|
33240
|
+
continue;
|
|
33241
|
+
} else if (fldType === "separate") {
|
|
33242
|
+
continue;
|
|
33243
|
+
}
|
|
33244
|
+
if (Array.isArray(node.elements)) {
|
|
33245
|
+
const childResult = preProcessNodesForFldChar(node.elements, docx);
|
|
33246
|
+
node.elements = childResult.processedNodes;
|
|
33247
|
+
if (childResult.unpairedBegin) {
|
|
33248
|
+
childResult.unpairedBegin.forEach((pendingField) => {
|
|
33249
|
+
currentFieldStack.push(pendingField.fieldInfo);
|
|
33250
|
+
collectedNodesStack.push([node]);
|
|
33251
|
+
});
|
|
33252
|
+
} else if (childResult.unpairedEnd) {
|
|
33253
|
+
collectedNodesStack[collectedNodesStack.length - 1].push(node);
|
|
33254
|
+
finalizeField();
|
|
33255
|
+
} else if (collecting) {
|
|
33256
|
+
collectedNodesStack[collectedNodesStack.length - 1].push(node);
|
|
33257
|
+
} else {
|
|
33258
|
+
processedNodes.push(node);
|
|
33259
|
+
}
|
|
33260
|
+
} else if (collecting) {
|
|
33261
|
+
collectedNodesStack[collectedNodesStack.length - 1].push(node);
|
|
33262
|
+
} else {
|
|
33263
|
+
processedNodes.push(node);
|
|
33264
|
+
}
|
|
33265
|
+
}
|
|
33266
|
+
let unpairedBegin = null;
|
|
33267
|
+
if (collectedNodesStack.length > 0) {
|
|
33268
|
+
unpairedBegin = [];
|
|
33269
|
+
for (let i = 0; i < collectedNodesStack.length; i++) {
|
|
33270
|
+
processedNodes.push(...collectedNodesStack[i].filter((n) => n !== null));
|
|
33271
|
+
unpairedBegin.push({
|
|
33272
|
+
nodes: collectedNodesStack[i],
|
|
33273
|
+
fieldInfo: currentFieldStack[i]
|
|
33274
|
+
});
|
|
33275
|
+
}
|
|
33276
|
+
}
|
|
33277
|
+
return { processedNodes, unpairedBegin, unpairedEnd };
|
|
33278
|
+
};
|
|
33279
|
+
const _processCombinedNodesForFldChar = (nodesToCombine = [], instrText, docx) => {
|
|
33280
|
+
const instructionType = instrText.trim().split(" ")[0];
|
|
33281
|
+
const instructionPreProcessor = getInstructionPreProcessor(instructionType);
|
|
33282
|
+
if (instructionPreProcessor) {
|
|
33283
|
+
return instructionPreProcessor(nodesToCombine, instrText, docx);
|
|
33284
|
+
} else {
|
|
33285
|
+
return nodesToCombine;
|
|
33286
|
+
}
|
|
33287
|
+
};
|
|
32665
33288
|
const createDocumentJson = (docx, converter, editor) => {
|
|
32666
33289
|
const json = carbonCopy(getInitialJSON(docx));
|
|
32667
33290
|
if (!json) return null;
|
|
@@ -32689,7 +33312,10 @@ const createDocumentJson = (docx, converter, editor) => {
|
|
|
32689
33312
|
const nodeListHandler = defaultNodeListHandler();
|
|
32690
33313
|
const bodyNode = json.elements[0].elements.find((el) => el.name === "w:body");
|
|
32691
33314
|
if (bodyNode) {
|
|
33315
|
+
ensureSectionProperties(bodyNode);
|
|
32692
33316
|
const node = bodyNode;
|
|
33317
|
+
const { processedNodes } = preProcessNodesForFldChar(node.elements ?? [], docx);
|
|
33318
|
+
node.elements = processedNodes;
|
|
32693
33319
|
const contentElements = node.elements?.filter((n) => n.name !== "w:sectPr") ?? [];
|
|
32694
33320
|
const content = pruneIgnoredNodes(contentElements);
|
|
32695
33321
|
const comments = importCommentData({ docx, converter, editor });
|
|
@@ -32745,8 +33371,10 @@ const defaultNodeListHandler = () => {
|
|
|
32745
33371
|
trackChangeNodeHandlerEntity,
|
|
32746
33372
|
tableNodeHandlerEntity,
|
|
32747
33373
|
tabNodeEntityHandler,
|
|
33374
|
+
tableOfContentsHandlerEntity,
|
|
32748
33375
|
autoPageHandlerEntity,
|
|
32749
33376
|
autoTotalPageCountEntity,
|
|
33377
|
+
pageReferenceEntity,
|
|
32750
33378
|
standardNodeHandlerEntity
|
|
32751
33379
|
];
|
|
32752
33380
|
const handler2 = createNodeListHandler(entities);
|
|
@@ -32922,6 +33550,59 @@ function getDocumentStyles(node, docx, converter, editor) {
|
|
|
32922
33550
|
styles.alternateHeaders = isAlternatingHeadersOddEven(docx);
|
|
32923
33551
|
return styles;
|
|
32924
33552
|
}
|
|
33553
|
+
const DEFAULT_SECTION_PROPS = Object.freeze({
|
|
33554
|
+
pageSize: Object.freeze({ width: "12240", height: "15840" }),
|
|
33555
|
+
pageMargins: Object.freeze({
|
|
33556
|
+
top: "1440",
|
|
33557
|
+
right: "1440",
|
|
33558
|
+
bottom: "1440",
|
|
33559
|
+
left: "1440",
|
|
33560
|
+
header: "720",
|
|
33561
|
+
footer: "720",
|
|
33562
|
+
gutter: "0"
|
|
33563
|
+
})
|
|
33564
|
+
});
|
|
33565
|
+
function ensureSectionProperties(bodyNode) {
|
|
33566
|
+
if (!bodyNode.elements) bodyNode.elements = [];
|
|
33567
|
+
let sectPr = bodyNode.elements.find((el) => el.name === "w:sectPr");
|
|
33568
|
+
if (!sectPr) {
|
|
33569
|
+
sectPr = {
|
|
33570
|
+
type: "element",
|
|
33571
|
+
name: "w:sectPr",
|
|
33572
|
+
elements: []
|
|
33573
|
+
};
|
|
33574
|
+
bodyNode.elements.push(sectPr);
|
|
33575
|
+
} else if (!sectPr.elements) {
|
|
33576
|
+
sectPr.elements = [];
|
|
33577
|
+
}
|
|
33578
|
+
const ensureChild = (name, factory) => {
|
|
33579
|
+
let child = sectPr.elements.find((el) => el.name === name);
|
|
33580
|
+
if (!child) {
|
|
33581
|
+
child = factory();
|
|
33582
|
+
sectPr.elements.push(child);
|
|
33583
|
+
} else if (!child.attributes) {
|
|
33584
|
+
child.attributes = {};
|
|
33585
|
+
}
|
|
33586
|
+
return child;
|
|
33587
|
+
};
|
|
33588
|
+
const pgSz = ensureChild("w:pgSz", () => ({
|
|
33589
|
+
type: "element",
|
|
33590
|
+
name: "w:pgSz",
|
|
33591
|
+
attributes: {}
|
|
33592
|
+
}));
|
|
33593
|
+
pgSz.attributes["w:w"] = pgSz.attributes["w:w"] ?? DEFAULT_SECTION_PROPS.pageSize.width;
|
|
33594
|
+
pgSz.attributes["w:h"] = pgSz.attributes["w:h"] ?? DEFAULT_SECTION_PROPS.pageSize.height;
|
|
33595
|
+
const pgMar = ensureChild("w:pgMar", () => ({
|
|
33596
|
+
type: "element",
|
|
33597
|
+
name: "w:pgMar",
|
|
33598
|
+
attributes: {}
|
|
33599
|
+
}));
|
|
33600
|
+
Object.entries(DEFAULT_SECTION_PROPS.pageMargins).forEach(([key, value]) => {
|
|
33601
|
+
const attrKey = `w:${key}`;
|
|
33602
|
+
if (pgMar.attributes[attrKey] == null) pgMar.attributes[attrKey] = value;
|
|
33603
|
+
});
|
|
33604
|
+
return sectPr;
|
|
33605
|
+
}
|
|
32925
33606
|
function getStyleDefinitions(docx) {
|
|
32926
33607
|
const styles = docx["word/styles.xml"];
|
|
32927
33608
|
if (!styles) return [];
|
|
@@ -33114,6 +33795,36 @@ const FONT_FAMILY_FALLBACKS = Object.freeze({
|
|
|
33114
33795
|
auto: "sans-serif"
|
|
33115
33796
|
});
|
|
33116
33797
|
const DEFAULT_GENERIC_FALLBACK = "sans-serif";
|
|
33798
|
+
const DEFAULT_FONT_SIZE_PT = 10;
|
|
33799
|
+
const collectRunDefaultProperties = (runProps, { allowOverrideTypeface = true, allowOverrideSize = true, themeResolver, state: state2 }) => {
|
|
33800
|
+
if (!runProps?.elements?.length || !state2) return;
|
|
33801
|
+
const fontsNode = runProps.elements.find((el) => el.name === "w:rFonts");
|
|
33802
|
+
if (fontsNode?.attributes) {
|
|
33803
|
+
const themeName = fontsNode.attributes["w:asciiTheme"];
|
|
33804
|
+
if (themeName) {
|
|
33805
|
+
const themeInfo = themeResolver?.(themeName) || {};
|
|
33806
|
+
if ((allowOverrideTypeface || !state2.typeface) && themeInfo.typeface) state2.typeface = themeInfo.typeface;
|
|
33807
|
+
if ((allowOverrideTypeface || !state2.panose) && themeInfo.panose) state2.panose = themeInfo.panose;
|
|
33808
|
+
}
|
|
33809
|
+
const ascii = fontsNode.attributes["w:ascii"];
|
|
33810
|
+
if ((allowOverrideTypeface || !state2.typeface) && ascii) {
|
|
33811
|
+
state2.typeface = ascii;
|
|
33812
|
+
}
|
|
33813
|
+
}
|
|
33814
|
+
const sizeNode = runProps.elements.find((el) => el.name === "w:sz");
|
|
33815
|
+
if (sizeNode?.attributes?.["w:val"]) {
|
|
33816
|
+
const sizeTwips = Number(sizeNode.attributes["w:val"]);
|
|
33817
|
+
if (Number.isFinite(sizeTwips)) {
|
|
33818
|
+
if (state2.fallbackSzTwips === void 0) state2.fallbackSzTwips = sizeTwips;
|
|
33819
|
+
const sizePt = sizeTwips / 2;
|
|
33820
|
+
if (allowOverrideSize || state2.fontSizePt === void 0) state2.fontSizePt = sizePt;
|
|
33821
|
+
}
|
|
33822
|
+
}
|
|
33823
|
+
const kernNode = runProps.elements.find((el) => el.name === "w:kern");
|
|
33824
|
+
if (kernNode?.attributes?.["w:val"]) {
|
|
33825
|
+
if (allowOverrideSize || state2.kern === void 0) state2.kern = kernNode.attributes["w:val"];
|
|
33826
|
+
}
|
|
33827
|
+
};
|
|
33117
33828
|
const _SuperConverter = class _SuperConverter {
|
|
33118
33829
|
constructor(params = null) {
|
|
33119
33830
|
__privateAdd(this, _SuperConverter_instances);
|
|
@@ -33241,49 +33952,45 @@ const _SuperConverter = class _SuperConverter {
|
|
|
33241
33952
|
}
|
|
33242
33953
|
getDocumentDefaultStyles() {
|
|
33243
33954
|
const styles = this.convertedXml["word/styles.xml"];
|
|
33244
|
-
|
|
33245
|
-
const
|
|
33246
|
-
|
|
33247
|
-
|
|
33248
|
-
const
|
|
33249
|
-
const
|
|
33250
|
-
|
|
33251
|
-
|
|
33252
|
-
|
|
33253
|
-
|
|
33254
|
-
|
|
33255
|
-
|
|
33256
|
-
|
|
33257
|
-
|
|
33258
|
-
|
|
33259
|
-
|
|
33260
|
-
|
|
33261
|
-
|
|
33262
|
-
|
|
33263
|
-
|
|
33264
|
-
|
|
33265
|
-
|
|
33266
|
-
|
|
33267
|
-
|
|
33268
|
-
|
|
33269
|
-
|
|
33270
|
-
|
|
33271
|
-
|
|
33272
|
-
|
|
33273
|
-
|
|
33274
|
-
|
|
33275
|
-
|
|
33276
|
-
|
|
33277
|
-
|
|
33278
|
-
|
|
33279
|
-
|
|
33280
|
-
|
|
33281
|
-
|
|
33282
|
-
|
|
33283
|
-
const kern = rElements.find((el) => el.name === "w:kern")?.attributes["w:val"];
|
|
33284
|
-
const fontFamilyCss = _SuperConverter.toCssFontFamily(typeface, this.convertedXml);
|
|
33285
|
-
return { fontSizePt, kern, typeface, panose, fontFamilyCss };
|
|
33286
|
-
}
|
|
33955
|
+
const styleRoot = styles?.elements?.[0];
|
|
33956
|
+
const styleElements = styleRoot?.elements || [];
|
|
33957
|
+
if (!styleElements.length) return {};
|
|
33958
|
+
const defaults = styleElements.find((el) => el.name === "w:docDefaults");
|
|
33959
|
+
const normalStyle = styleElements.find((el) => el.name === "w:style" && el.attributes?.["w:styleId"] === "Normal");
|
|
33960
|
+
const defaultsState = {
|
|
33961
|
+
typeface: void 0,
|
|
33962
|
+
panose: void 0,
|
|
33963
|
+
fontSizePt: void 0,
|
|
33964
|
+
kern: void 0,
|
|
33965
|
+
fallbackSzTwips: void 0
|
|
33966
|
+
};
|
|
33967
|
+
const docDefaultRun = defaults?.elements?.find((el) => el.name === "w:rPrDefault");
|
|
33968
|
+
const docDefaultProps = docDefaultRun?.elements?.find((el) => el.name === "w:rPr") ?? docDefaultRun;
|
|
33969
|
+
collectRunDefaultProperties(docDefaultProps, {
|
|
33970
|
+
allowOverrideTypeface: true,
|
|
33971
|
+
allowOverrideSize: true,
|
|
33972
|
+
themeResolver: (theme) => this.getThemeInfo(theme),
|
|
33973
|
+
state: defaultsState
|
|
33974
|
+
});
|
|
33975
|
+
const normalRunProps = normalStyle?.elements?.find((el) => el.name === "w:rPr") ?? null;
|
|
33976
|
+
collectRunDefaultProperties(normalRunProps, {
|
|
33977
|
+
allowOverrideTypeface: true,
|
|
33978
|
+
allowOverrideSize: true,
|
|
33979
|
+
themeResolver: (theme) => this.getThemeInfo(theme),
|
|
33980
|
+
state: defaultsState
|
|
33981
|
+
});
|
|
33982
|
+
if (defaultsState.fontSizePt === void 0) {
|
|
33983
|
+
if (Number.isFinite(defaultsState.fallbackSzTwips)) defaultsState.fontSizePt = defaultsState.fallbackSzTwips / 2;
|
|
33984
|
+
else defaultsState.fontSizePt = DEFAULT_FONT_SIZE_PT;
|
|
33985
|
+
}
|
|
33986
|
+
const fontFamilyCss = defaultsState.typeface ? _SuperConverter.toCssFontFamily(defaultsState.typeface, this.convertedXml) : void 0;
|
|
33987
|
+
const result = {};
|
|
33988
|
+
if (defaultsState.fontSizePt !== void 0) result.fontSizePt = defaultsState.fontSizePt;
|
|
33989
|
+
if (defaultsState.kern !== void 0) result.kern = defaultsState.kern;
|
|
33990
|
+
if (defaultsState.typeface) result.typeface = defaultsState.typeface;
|
|
33991
|
+
if (defaultsState.panose) result.panose = defaultsState.panose;
|
|
33992
|
+
if (fontFamilyCss) result.fontFamilyCss = fontFamilyCss;
|
|
33993
|
+
return result;
|
|
33287
33994
|
}
|
|
33288
33995
|
getDocumentFonts() {
|
|
33289
33996
|
const fontTable = this.convertedXml["word/fontTable.xml"];
|
|
@@ -33768,7 +34475,7 @@ export {
|
|
|
33768
34475
|
objectIncludes as Z,
|
|
33769
34476
|
AddMarkStep as _,
|
|
33770
34477
|
Plugin as a,
|
|
33771
|
-
translator$
|
|
34478
|
+
translator$b as a$,
|
|
33772
34479
|
twipsToLines as a0,
|
|
33773
34480
|
pixelsToTwips as a1,
|
|
33774
34481
|
helpers as a2,
|
|
@@ -33779,102 +34486,106 @@ export {
|
|
|
33779
34486
|
createDocFromMarkdown as a7,
|
|
33780
34487
|
createDocFromHTML as a8,
|
|
33781
34488
|
EditorState as a9,
|
|
33782
|
-
|
|
33783
|
-
|
|
33784
|
-
|
|
33785
|
-
|
|
33786
|
-
|
|
33787
|
-
|
|
33788
|
-
translator$
|
|
33789
|
-
translator$
|
|
33790
|
-
translator$
|
|
33791
|
-
translator$
|
|
33792
|
-
translator$
|
|
33793
|
-
translator$
|
|
33794
|
-
translator$
|
|
33795
|
-
translator$
|
|
33796
|
-
translator$
|
|
33797
|
-
translator$
|
|
33798
|
-
translator$
|
|
33799
|
-
translator$
|
|
33800
|
-
translator$
|
|
33801
|
-
translator$
|
|
34489
|
+
vClickOutside as aA,
|
|
34490
|
+
getActiveFormatting as aB,
|
|
34491
|
+
readFromClipboard as aC,
|
|
34492
|
+
handleClipboardPaste as aD,
|
|
34493
|
+
getFileObject as aE,
|
|
34494
|
+
runPropertyTranslators as aF,
|
|
34495
|
+
translator$7 as aG,
|
|
34496
|
+
translator$8 as aH,
|
|
34497
|
+
translator$J as aI,
|
|
34498
|
+
translator$K as aJ,
|
|
34499
|
+
translator$13 as aK,
|
|
34500
|
+
translator$I as aL,
|
|
34501
|
+
translator$L as aM,
|
|
34502
|
+
translator$H as aN,
|
|
34503
|
+
translator$h as aO,
|
|
34504
|
+
translator$9 as aP,
|
|
34505
|
+
translator$u as aQ,
|
|
34506
|
+
translator$v as aR,
|
|
34507
|
+
translator$w as aS,
|
|
34508
|
+
translator$x as aT,
|
|
33802
34509
|
translator$y as aU,
|
|
33803
|
-
translator$
|
|
33804
|
-
translator$
|
|
33805
|
-
translator$
|
|
33806
|
-
translator$
|
|
33807
|
-
translator$
|
|
33808
|
-
translator$
|
|
34510
|
+
translator$d as aV,
|
|
34511
|
+
translator$z as aW,
|
|
34512
|
+
translator$A as aX,
|
|
34513
|
+
translator$B as aY,
|
|
34514
|
+
translator$C as aZ,
|
|
34515
|
+
translator$M as a_,
|
|
33809
34516
|
hasSomeParentWithClass as aa,
|
|
33810
34517
|
isActive as ab,
|
|
33811
34518
|
unflattenListsInHtml as ac,
|
|
33812
34519
|
parseSizeUnit as ad,
|
|
33813
34520
|
minMax as ae,
|
|
33814
34521
|
getLineHeightValueString as af,
|
|
33815
|
-
|
|
33816
|
-
|
|
33817
|
-
|
|
33818
|
-
|
|
33819
|
-
|
|
33820
|
-
|
|
33821
|
-
|
|
33822
|
-
|
|
33823
|
-
|
|
33824
|
-
|
|
33825
|
-
|
|
33826
|
-
|
|
33827
|
-
|
|
33828
|
-
|
|
33829
|
-
|
|
33830
|
-
|
|
33831
|
-
|
|
33832
|
-
|
|
33833
|
-
|
|
33834
|
-
|
|
34522
|
+
updateDOMAttributes as ag,
|
|
34523
|
+
findChildren as ah,
|
|
34524
|
+
htmlHandler as ai,
|
|
34525
|
+
generateRandomSigned32BitIntStrId as aj,
|
|
34526
|
+
InputRule as ak,
|
|
34527
|
+
kebabCase as al,
|
|
34528
|
+
findParentNodeClosestToPos as am,
|
|
34529
|
+
getListItemStyleDefinitions as an,
|
|
34530
|
+
docxNumberigHelpers as ao,
|
|
34531
|
+
parseIndentElement as ap,
|
|
34532
|
+
combineIndents as aq,
|
|
34533
|
+
SelectionRange as ar,
|
|
34534
|
+
Transform as as,
|
|
34535
|
+
isInTable as at,
|
|
34536
|
+
generateDocxRandomId as au,
|
|
34537
|
+
insertNewRelationship as av,
|
|
34538
|
+
commonjsGlobal as aw,
|
|
34539
|
+
getDefaultExportFromCjs$1 as ax,
|
|
34540
|
+
getContentTypesFromXml as ay,
|
|
34541
|
+
xmljs as az,
|
|
33835
34542
|
Slice as b,
|
|
33836
|
-
translator$
|
|
33837
|
-
translator$
|
|
34543
|
+
translator$D as b0,
|
|
34544
|
+
translator$N as b1,
|
|
33838
34545
|
translator$e as b2,
|
|
33839
|
-
translator$
|
|
33840
|
-
translator$
|
|
33841
|
-
translator$
|
|
33842
|
-
translator$
|
|
33843
|
-
translator
|
|
33844
|
-
translator$
|
|
33845
|
-
translator$
|
|
33846
|
-
translator$
|
|
33847
|
-
translator$
|
|
33848
|
-
translator$
|
|
33849
|
-
translator$
|
|
33850
|
-
translator as bE,
|
|
33851
|
-
|
|
33852
|
-
translator
|
|
33853
|
-
translator$
|
|
33854
|
-
translator$
|
|
33855
|
-
|
|
33856
|
-
translator$
|
|
33857
|
-
translator$
|
|
33858
|
-
translator$
|
|
33859
|
-
translator$
|
|
33860
|
-
translator
|
|
34546
|
+
translator$E as b3,
|
|
34547
|
+
translator$f as b4,
|
|
34548
|
+
translator$a as b5,
|
|
34549
|
+
translator$17 as b6,
|
|
34550
|
+
translator$Z as b7,
|
|
34551
|
+
translator$_ as b8,
|
|
34552
|
+
translator$12 as b9,
|
|
34553
|
+
translator$19 as bA,
|
|
34554
|
+
translator$t as bB,
|
|
34555
|
+
translator$4 as bC,
|
|
34556
|
+
translator$3 as bD,
|
|
34557
|
+
translator$G as bE,
|
|
34558
|
+
translator$15 as bF,
|
|
34559
|
+
translator as bG,
|
|
34560
|
+
translator$1 as bH,
|
|
34561
|
+
translator$2 as bI,
|
|
34562
|
+
_sfc_main as bJ,
|
|
34563
|
+
translator$j as ba,
|
|
34564
|
+
translator$F as bb,
|
|
34565
|
+
translator$5 as bc,
|
|
34566
|
+
translator$l as bd,
|
|
34567
|
+
translator$$ as be,
|
|
34568
|
+
translator$X as bf,
|
|
34569
|
+
translator$10 as bg,
|
|
34570
|
+
translator$V as bh,
|
|
34571
|
+
translator$16 as bi,
|
|
33861
34572
|
translator$n as bj,
|
|
33862
|
-
translator$
|
|
33863
|
-
translator$
|
|
33864
|
-
translator$
|
|
33865
|
-
translator$
|
|
33866
|
-
translator$
|
|
33867
|
-
translator$
|
|
34573
|
+
translator$O as bk,
|
|
34574
|
+
translator$o as bl,
|
|
34575
|
+
translator$p as bm,
|
|
34576
|
+
translator$14 as bn,
|
|
34577
|
+
translator$W as bo,
|
|
34578
|
+
translator$18 as bp,
|
|
33868
34579
|
translator$P as bq,
|
|
33869
|
-
translator$
|
|
33870
|
-
translator$
|
|
33871
|
-
translator$
|
|
33872
|
-
translator$
|
|
33873
|
-
translator$
|
|
34580
|
+
translator$c as br,
|
|
34581
|
+
translator$Q as bs,
|
|
34582
|
+
translator$R as bt,
|
|
34583
|
+
translator$r as bu,
|
|
34584
|
+
translator$6 as bv,
|
|
33874
34585
|
translator$S as bw,
|
|
33875
|
-
translator$
|
|
33876
|
-
translator$
|
|
33877
|
-
translator$
|
|
34586
|
+
translator$11 as bx,
|
|
34587
|
+
translator$T as by,
|
|
34588
|
+
translator$U as bz,
|
|
33878
34589
|
DOMParser$1 as c,
|
|
33879
34590
|
Mark as d,
|
|
33880
34591
|
dropPoint as e,
|