pptx-glimpse 3.1.1 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.cjs +2492 -959
- package/dist/browser.d.cts +36 -4
- package/dist/browser.d.ts +36 -4
- package/dist/browser.js +411 -9
- package/dist/{chunk-5YFLSUKM.js → chunk-OOQWOZHT.js} +1 -1
- package/dist/{chunk-3UFL5U77.js → chunk-Q3ZCUUGG.js} +1 -1
- package/dist/{chunk-AQ35JYTB.js → chunk-VBQRNQOT.js} +2028 -887
- package/dist/cli.cjs +1617 -1584
- package/dist/cli.js +2 -2
- package/dist/index.cjs +1617 -1584
- package/dist/index.js +3 -3
- package/package.json +3 -3
package/dist/cli.cjs
CHANGED
|
@@ -6600,1739 +6600,1754 @@ function parseEnumValue(value, allowed) {
|
|
|
6600
6600
|
function parseEnumValueWithDefault(value, allowed, fallback) {
|
|
6601
6601
|
return parseEnumValue(value, allowed) ?? fallback;
|
|
6602
6602
|
}
|
|
6603
|
-
var
|
|
6604
|
-
|
|
6605
|
-
"
|
|
6603
|
+
var RECTANGLE_ALIGNMENT_TOKENS = /* @__PURE__ */ new Set([
|
|
6604
|
+
"tl",
|
|
6605
|
+
"t",
|
|
6606
|
+
"tr",
|
|
6607
|
+
"l",
|
|
6608
|
+
"ctr",
|
|
6606
6609
|
"r",
|
|
6607
|
-
"
|
|
6608
|
-
"
|
|
6609
|
-
"
|
|
6610
|
+
"bl",
|
|
6611
|
+
"b",
|
|
6612
|
+
"br"
|
|
6610
6613
|
]);
|
|
6611
|
-
var
|
|
6612
|
-
|
|
6613
|
-
"
|
|
6614
|
-
"
|
|
6615
|
-
"
|
|
6616
|
-
"
|
|
6614
|
+
var COLOR_TRANSFORM_KINDS = /* @__PURE__ */ new Set([
|
|
6615
|
+
"lumMod",
|
|
6616
|
+
"lumOff",
|
|
6617
|
+
"tint",
|
|
6618
|
+
"shade",
|
|
6619
|
+
"alpha"
|
|
6617
6620
|
]);
|
|
6618
|
-
var
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6621
|
+
var RAW_FILL_LOCAL_NAMES = ["grpFill"];
|
|
6622
|
+
var PRESET_COLOR_HEX = {
|
|
6623
|
+
black: "000000",
|
|
6624
|
+
white: "FFFFFF",
|
|
6625
|
+
red: "FF0000",
|
|
6626
|
+
green: "008000",
|
|
6627
|
+
blue: "0000FF",
|
|
6628
|
+
yellow: "FFFF00",
|
|
6629
|
+
cyan: "00FFFF",
|
|
6630
|
+
magenta: "FF00FF"
|
|
6628
6631
|
};
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
"
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
"
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
});
|
|
6658
|
-
const paragraphs = [];
|
|
6659
|
-
let logicalParagraphIndex = 0;
|
|
6660
|
-
getChildArray(txBody, "p").forEach((p, paragraphIndex) => {
|
|
6661
|
-
const orderedChildren = orderedParagraphs?.[paragraphIndex];
|
|
6662
|
-
if (orderedChildren !== void 0 && hasMultipleBulletPPr(p, orderedChildren)) {
|
|
6663
|
-
const split = splitInterleavedParagraph(
|
|
6664
|
-
p,
|
|
6665
|
-
orderedChildren,
|
|
6666
|
-
partPath,
|
|
6667
|
-
nextId,
|
|
6668
|
-
ownerNodeId,
|
|
6669
|
-
ownerOrderingSlot,
|
|
6670
|
-
logicalParagraphIndex
|
|
6632
|
+
function parseColorElement(parent) {
|
|
6633
|
+
if (!parent) return void 0;
|
|
6634
|
+
const srgb = getChild(parent, "srgbClr");
|
|
6635
|
+
if (srgb) {
|
|
6636
|
+
const hex = getAttr(srgb, "val");
|
|
6637
|
+
if (hex !== void 0) {
|
|
6638
|
+
return withTransforms({ kind: "srgb", hex: hex.toUpperCase() }, srgb);
|
|
6639
|
+
}
|
|
6640
|
+
}
|
|
6641
|
+
const scheme = getChild(parent, "schemeClr");
|
|
6642
|
+
if (scheme) {
|
|
6643
|
+
const name = getAttr(scheme, "val");
|
|
6644
|
+
if (name !== void 0) {
|
|
6645
|
+
return withTransforms({ kind: "scheme", scheme: name }, scheme);
|
|
6646
|
+
}
|
|
6647
|
+
}
|
|
6648
|
+
const sys = getChild(parent, "sysClr");
|
|
6649
|
+
if (sys) {
|
|
6650
|
+
const val = getAttr(sys, "val");
|
|
6651
|
+
if (val !== void 0) {
|
|
6652
|
+
const lastClr = getAttr(sys, "lastClr");
|
|
6653
|
+
return withTransforms(
|
|
6654
|
+
{
|
|
6655
|
+
kind: "system",
|
|
6656
|
+
value: val,
|
|
6657
|
+
...lastClr !== void 0 ? { lastColor: lastClr.toUpperCase() } : {}
|
|
6658
|
+
},
|
|
6659
|
+
sys
|
|
6671
6660
|
);
|
|
6672
|
-
paragraphs.push(...split);
|
|
6673
|
-
logicalParagraphIndex += split.length;
|
|
6674
|
-
return;
|
|
6675
6661
|
}
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6662
|
+
}
|
|
6663
|
+
return void 0;
|
|
6664
|
+
}
|
|
6665
|
+
function parseEffectList(effectList) {
|
|
6666
|
+
if (effectList === void 0) return void 0;
|
|
6667
|
+
const outerShadow = parseOuterShadow(getChild(effectList, "outerShdw"));
|
|
6668
|
+
const innerShadow = parseInnerShadow(getChild(effectList, "innerShdw"));
|
|
6669
|
+
const glow = parseGlow(getChild(effectList, "glow"));
|
|
6670
|
+
const softEdge = parseSoftEdge(getChild(effectList, "softEdge"));
|
|
6671
|
+
const parsed = {
|
|
6672
|
+
...outerShadow !== void 0 ? { outerShadow } : {},
|
|
6673
|
+
...innerShadow !== void 0 ? { innerShadow } : {},
|
|
6674
|
+
...glow !== void 0 ? { glow } : {},
|
|
6675
|
+
...softEdge !== void 0 ? { softEdge } : {}
|
|
6676
|
+
};
|
|
6677
|
+
return Object.keys(parsed).length > 0 ? parsed : void 0;
|
|
6678
|
+
}
|
|
6679
|
+
function parseBlipEffects(blip) {
|
|
6680
|
+
if (blip === void 0) return void 0;
|
|
6681
|
+
const grayscale = getChild(blip, "grayscl") !== void 0;
|
|
6682
|
+
const biLevel = parseBiLevel(getChild(blip, "biLevel"));
|
|
6683
|
+
const blur = parseBlurEffect(getChild(blip, "blur"));
|
|
6684
|
+
const lum = parseLumEffect(getChild(blip, "lum"));
|
|
6685
|
+
const duotone = parseDuotoneEffect(getChild(blip, "duotone"));
|
|
6686
|
+
const clrChange = parseColorChangeEffect(getChild(blip, "clrChange"));
|
|
6687
|
+
const parsed = {
|
|
6688
|
+
grayscale,
|
|
6689
|
+
...biLevel !== void 0 ? { biLevel } : {},
|
|
6690
|
+
...blur !== void 0 ? { blur } : {},
|
|
6691
|
+
...lum !== void 0 ? { lum } : {},
|
|
6692
|
+
...duotone !== void 0 ? { duotone } : {},
|
|
6693
|
+
...clrChange !== void 0 ? { clrChange } : {}
|
|
6694
|
+
};
|
|
6695
|
+
return grayscale || biLevel !== void 0 || blur !== void 0 || lum !== void 0 || duotone !== void 0 || clrChange !== void 0 ? parsed : void 0;
|
|
6696
|
+
}
|
|
6697
|
+
function parseOuterShadow(node) {
|
|
6698
|
+
if (node === void 0) return void 0;
|
|
6699
|
+
const color = parseColorElement(node);
|
|
6700
|
+
if (color === void 0) return void 0;
|
|
6690
6701
|
return {
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6702
|
+
blurRadius: asEmu2(numericAttr2(node, "blurRad") ?? 0),
|
|
6703
|
+
distance: asEmu2(numericAttr2(node, "dist") ?? 0),
|
|
6704
|
+
direction: asOoxmlAngle(numericAttr2(node, "dir") ?? 0),
|
|
6705
|
+
color,
|
|
6706
|
+
alignment: parseRectangleAlignment(getAttr(node, "algn"), "b"),
|
|
6707
|
+
rotateWithShape: getAttr(node, "rotWithShape") !== "0"
|
|
6696
6708
|
};
|
|
6697
6709
|
}
|
|
6698
|
-
function
|
|
6710
|
+
function parseInnerShadow(node) {
|
|
6699
6711
|
if (node === void 0) return void 0;
|
|
6700
|
-
const
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
|
|
6707
|
-
}
|
|
6708
|
-
return { ...defaultParagraph !== void 0 ? { defaultParagraph } : {}, levels };
|
|
6712
|
+
const color = parseColorElement(node);
|
|
6713
|
+
if (color === void 0) return void 0;
|
|
6714
|
+
return {
|
|
6715
|
+
blurRadius: asEmu2(numericAttr2(node, "blurRad") ?? 0),
|
|
6716
|
+
distance: asEmu2(numericAttr2(node, "dist") ?? 0),
|
|
6717
|
+
direction: asOoxmlAngle(numericAttr2(node, "dir") ?? 0),
|
|
6718
|
+
color
|
|
6719
|
+
};
|
|
6709
6720
|
}
|
|
6710
|
-
function
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
bulletPPrCount++;
|
|
6719
|
-
if (bulletPPrCount >= 2) return true;
|
|
6720
|
-
}
|
|
6721
|
-
pPrCounter++;
|
|
6722
|
-
}
|
|
6723
|
-
return false;
|
|
6721
|
+
function parseGlow(node) {
|
|
6722
|
+
if (node === void 0) return void 0;
|
|
6723
|
+
const color = parseColorElement(node);
|
|
6724
|
+
if (color === void 0) return void 0;
|
|
6725
|
+
return {
|
|
6726
|
+
radius: asEmu2(numericAttr2(node, "rad") ?? 0),
|
|
6727
|
+
color
|
|
6728
|
+
};
|
|
6724
6729
|
}
|
|
6725
|
-
function
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
const brList = getChildArray(p, "br");
|
|
6730
|
-
const groups = [];
|
|
6731
|
-
let currentGroup;
|
|
6732
|
-
let pPrCounter = 0;
|
|
6733
|
-
let runCounter = 0;
|
|
6734
|
-
let fieldCounter = 0;
|
|
6735
|
-
let breakCounter = 0;
|
|
6736
|
-
for (const child of orderedChildren) {
|
|
6737
|
-
const tag = orderedLocalName(child);
|
|
6738
|
-
if (tag === "pPr") {
|
|
6739
|
-
const pPr = pPrList[pPrCounter];
|
|
6740
|
-
const hasBullet = pPr !== void 0 && (getChild(pPr, "buChar") !== void 0 || getChild(pPr, "buAutoNum") !== void 0);
|
|
6741
|
-
if (hasBullet || currentGroup === void 0) {
|
|
6742
|
-
if (currentGroup !== void 0) groups.push(currentGroup);
|
|
6743
|
-
currentGroup = {
|
|
6744
|
-
pPrIndex: pPrCounter,
|
|
6745
|
-
rNodes: [],
|
|
6746
|
-
fldNodes: [],
|
|
6747
|
-
brNodes: [],
|
|
6748
|
-
orderedChildren: [child]
|
|
6749
|
-
};
|
|
6750
|
-
} else {
|
|
6751
|
-
currentGroup.orderedChildren.push(child);
|
|
6752
|
-
}
|
|
6753
|
-
pPrCounter++;
|
|
6754
|
-
} else if (tag === "r") {
|
|
6755
|
-
currentGroup ??= {
|
|
6756
|
-
pPrIndex: -1,
|
|
6757
|
-
rNodes: [],
|
|
6758
|
-
fldNodes: [],
|
|
6759
|
-
brNodes: [],
|
|
6760
|
-
orderedChildren: []
|
|
6761
|
-
};
|
|
6762
|
-
currentGroup.orderedChildren.push(child);
|
|
6763
|
-
if (rList[runCounter] !== void 0) currentGroup.rNodes.push(rList[runCounter]);
|
|
6764
|
-
runCounter++;
|
|
6765
|
-
} else if (tag === "fld") {
|
|
6766
|
-
currentGroup ??= {
|
|
6767
|
-
pPrIndex: -1,
|
|
6768
|
-
rNodes: [],
|
|
6769
|
-
fldNodes: [],
|
|
6770
|
-
brNodes: [],
|
|
6771
|
-
orderedChildren: []
|
|
6772
|
-
};
|
|
6773
|
-
currentGroup.orderedChildren.push(child);
|
|
6774
|
-
if (fldList[fieldCounter] !== void 0) currentGroup.fldNodes.push(fldList[fieldCounter]);
|
|
6775
|
-
fieldCounter++;
|
|
6776
|
-
} else if (tag === "br") {
|
|
6777
|
-
currentGroup ??= {
|
|
6778
|
-
pPrIndex: -1,
|
|
6779
|
-
rNodes: [],
|
|
6780
|
-
fldNodes: [],
|
|
6781
|
-
brNodes: [],
|
|
6782
|
-
orderedChildren: []
|
|
6783
|
-
};
|
|
6784
|
-
currentGroup.orderedChildren.push(child);
|
|
6785
|
-
if (brList[breakCounter] !== void 0) currentGroup.brNodes.push(brList[breakCounter]);
|
|
6786
|
-
breakCounter++;
|
|
6787
|
-
}
|
|
6788
|
-
}
|
|
6789
|
-
if (currentGroup !== void 0) groups.push(currentGroup);
|
|
6790
|
-
return groups.map((group, groupIndex) => {
|
|
6791
|
-
const synthetic = {};
|
|
6792
|
-
if (group.pPrIndex >= 0) synthetic.pPr = pPrList[group.pPrIndex];
|
|
6793
|
-
synthetic.r = group.rNodes;
|
|
6794
|
-
synthetic.fld = group.fldNodes;
|
|
6795
|
-
synthetic.br = group.brNodes;
|
|
6796
|
-
if (groupIndex === groups.length - 1 && getChild(p, "endParaRPr") !== void 0) {
|
|
6797
|
-
synthetic.endParaRPr = getChild(p, "endParaRPr");
|
|
6798
|
-
}
|
|
6799
|
-
const paragraph = parseParagraph(
|
|
6800
|
-
synthetic,
|
|
6801
|
-
partPath,
|
|
6802
|
-
nextId,
|
|
6803
|
-
ownerNodeId,
|
|
6804
|
-
ownerOrderingSlot,
|
|
6805
|
-
paragraphIndex + groupIndex,
|
|
6806
|
-
group.orderedChildren
|
|
6807
|
-
);
|
|
6808
|
-
if (groupIndex < groups.length - 1 && paragraph.runs.length > 0) {
|
|
6809
|
-
const lastRun = paragraph.runs[paragraph.runs.length - 1];
|
|
6810
|
-
if (lastRun.text.endsWith("\n")) {
|
|
6811
|
-
const trimmed = lastRun.text.slice(0, -1);
|
|
6812
|
-
const precedingRuns = paragraph.runs.slice(0, -1);
|
|
6813
|
-
return {
|
|
6814
|
-
...paragraph,
|
|
6815
|
-
runs: trimmed === "" ? precedingRuns : [...precedingRuns, { ...lastRun, text: trimmed }]
|
|
6816
|
-
};
|
|
6817
|
-
}
|
|
6818
|
-
}
|
|
6819
|
-
return paragraph;
|
|
6820
|
-
});
|
|
6821
|
-
}
|
|
6822
|
-
function parseBodyProperties(bodyPr) {
|
|
6823
|
-
if (!bodyPr) return void 0;
|
|
6824
|
-
const marginLeft = numericAttr2(bodyPr, "lIns");
|
|
6825
|
-
const marginRight = numericAttr2(bodyPr, "rIns");
|
|
6826
|
-
const marginTop = numericAttr2(bodyPr, "tIns");
|
|
6827
|
-
const marginBottom = numericAttr2(bodyPr, "bIns");
|
|
6828
|
-
const anchorToken = getAttr(bodyPr, "anchor");
|
|
6829
|
-
const anchor = anchorToken !== void 0 ? ANCHOR_MAP[anchorToken] : void 0;
|
|
6830
|
-
const wrap = parseWrap(getAttr(bodyPr, "wrap"));
|
|
6831
|
-
const vert = parseVerticalType(getAttr(bodyPr, "vert"));
|
|
6832
|
-
const numCol = numericAttr2(bodyPr, "numCol");
|
|
6833
|
-
const normAutofit = getChild(bodyPr, "normAutofit");
|
|
6834
|
-
const hasSpAutofit = getChild(bodyPr, "spAutoFit") !== void 0;
|
|
6835
|
-
const hasNoAutofit = getChild(bodyPr, "noAutofit") !== void 0;
|
|
6836
|
-
const fontScale = numericAttr2(normAutofit, "fontScale");
|
|
6837
|
-
const lnSpcReduction = numericAttr2(normAutofit, "lnSpcReduction");
|
|
6838
|
-
const properties = {
|
|
6839
|
-
...marginLeft !== void 0 ? { marginLeft: emu(marginLeft) } : {},
|
|
6840
|
-
...marginRight !== void 0 ? { marginRight: emu(marginRight) } : {},
|
|
6841
|
-
...marginTop !== void 0 ? { marginTop: emu(marginTop) } : {},
|
|
6842
|
-
...marginBottom !== void 0 ? { marginBottom: emu(marginBottom) } : {},
|
|
6843
|
-
...anchor !== void 0 ? { anchor } : {},
|
|
6844
|
-
...wrap !== void 0 ? { wrap } : {},
|
|
6845
|
-
...normAutofit !== void 0 ? {
|
|
6846
|
-
autoFit: "normAutofit",
|
|
6847
|
-
fontScale: fontScale !== void 0 ? fontScale / 1e5 : 1,
|
|
6848
|
-
lnSpcReduction: lnSpcReduction !== void 0 ? lnSpcReduction / 1e5 : 0
|
|
6849
|
-
} : hasSpAutofit ? { autoFit: "spAutofit", fontScale: 1, lnSpcReduction: 0 } : hasNoAutofit ? { autoFit: "noAutofit", fontScale: 1, lnSpcReduction: 0 } : {},
|
|
6850
|
-
...numCol !== void 0 ? { numCol: Math.max(1, numCol) } : {},
|
|
6851
|
-
...vert !== void 0 ? { vert } : {}
|
|
6730
|
+
function parseSoftEdge(node) {
|
|
6731
|
+
if (node === void 0) return void 0;
|
|
6732
|
+
return {
|
|
6733
|
+
radius: asEmu2(numericAttr2(node, "rad") ?? 0)
|
|
6852
6734
|
};
|
|
6853
|
-
return Object.keys(properties).length > 0 ? properties : void 0;
|
|
6854
6735
|
}
|
|
6855
|
-
function
|
|
6856
|
-
|
|
6736
|
+
function parseBiLevel(node) {
|
|
6737
|
+
if (node === void 0) return void 0;
|
|
6738
|
+
return {
|
|
6739
|
+
threshold: (numericAttr2(node, "thresh") ?? 5e4) / 1e5
|
|
6740
|
+
};
|
|
6857
6741
|
}
|
|
6858
|
-
function
|
|
6859
|
-
|
|
6742
|
+
function parseBlurEffect(node) {
|
|
6743
|
+
if (node === void 0) return void 0;
|
|
6744
|
+
return {
|
|
6745
|
+
radius: asEmu2(numericAttr2(node, "rad") ?? 0),
|
|
6746
|
+
grow: getAttr(node, "grow") !== "0"
|
|
6747
|
+
};
|
|
6860
6748
|
}
|
|
6861
|
-
function
|
|
6862
|
-
|
|
6863
|
-
const runs = parseRunsInOrder(
|
|
6864
|
-
p,
|
|
6865
|
-
partPath,
|
|
6866
|
-
nextId,
|
|
6867
|
-
ownerNodeId,
|
|
6868
|
-
ownerOrderingSlot,
|
|
6869
|
-
paragraphIndex,
|
|
6870
|
-
orderedChildren
|
|
6871
|
-
);
|
|
6872
|
-
const rawSidecars = collectUnknownSidecars(p, KNOWN_PARAGRAPH_CHILDREN, nextId);
|
|
6749
|
+
function parseLumEffect(node) {
|
|
6750
|
+
if (node === void 0) return void 0;
|
|
6873
6751
|
return {
|
|
6874
|
-
|
|
6875
|
-
|
|
6876
|
-
handle: {
|
|
6877
|
-
partPath,
|
|
6878
|
-
nodeId: textNodeId("paragraph", ownerNodeId, ownerOrderingSlot, paragraphIndex),
|
|
6879
|
-
orderingSlot: paragraphIndex
|
|
6880
|
-
},
|
|
6881
|
-
...rawSidecars.length > 0 ? { rawSidecars } : {}
|
|
6752
|
+
brightness: (numericAttr2(node, "bright") ?? 0) / 1e5,
|
|
6753
|
+
contrast: (numericAttr2(node, "contrast") ?? 0) / 1e5
|
|
6882
6754
|
};
|
|
6883
6755
|
}
|
|
6884
|
-
function
|
|
6885
|
-
|
|
6886
|
-
const
|
|
6887
|
-
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
|
|
6891
|
-
|
|
6892
|
-
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
|
|
6901
|
-
|
|
6902
|
-
|
|
6903
|
-
)
|
|
6904
|
-
|
|
6905
|
-
(br, index) => parseBreakRun(
|
|
6906
|
-
br,
|
|
6907
|
-
partPath,
|
|
6908
|
-
nextId,
|
|
6909
|
-
ownerNodeId,
|
|
6910
|
-
ownerOrderingSlot,
|
|
6911
|
-
paragraphIndex,
|
|
6912
|
-
rList.length + fldList.length + index
|
|
6913
|
-
)
|
|
6914
|
-
)
|
|
6915
|
-
];
|
|
6916
|
-
}
|
|
6917
|
-
const counters = {};
|
|
6918
|
-
const runs = [];
|
|
6919
|
-
for (const child of orderedChildren) {
|
|
6920
|
-
const tag = orderedLocalName(child);
|
|
6921
|
-
if (tag !== "r" && tag !== "fld" && tag !== "br") continue;
|
|
6922
|
-
const index = counters[tag] ?? 0;
|
|
6923
|
-
counters[tag] = index + 1;
|
|
6924
|
-
const runIndex = runs.length;
|
|
6925
|
-
if (tag === "r" && rList[index] !== void 0) {
|
|
6926
|
-
runs.push(
|
|
6927
|
-
parseRun(
|
|
6928
|
-
rList[index],
|
|
6929
|
-
partPath,
|
|
6930
|
-
nextId,
|
|
6931
|
-
ownerNodeId,
|
|
6932
|
-
ownerOrderingSlot,
|
|
6933
|
-
paragraphIndex,
|
|
6934
|
-
runIndex
|
|
6935
|
-
)
|
|
6936
|
-
);
|
|
6937
|
-
} else if (tag === "fld" && fldList[index] !== void 0) {
|
|
6938
|
-
runs.push(
|
|
6939
|
-
parseRun(
|
|
6940
|
-
fldList[index],
|
|
6941
|
-
partPath,
|
|
6942
|
-
nextId,
|
|
6943
|
-
ownerNodeId,
|
|
6944
|
-
ownerOrderingSlot,
|
|
6945
|
-
paragraphIndex,
|
|
6946
|
-
runIndex
|
|
6947
|
-
)
|
|
6948
|
-
);
|
|
6949
|
-
} else if (tag === "br" && brList[index] !== void 0) {
|
|
6950
|
-
runs.push(
|
|
6951
|
-
parseBreakRun(
|
|
6952
|
-
brList[index],
|
|
6953
|
-
partPath,
|
|
6954
|
-
nextId,
|
|
6955
|
-
ownerNodeId,
|
|
6956
|
-
ownerOrderingSlot,
|
|
6957
|
-
paragraphIndex,
|
|
6958
|
-
runIndex
|
|
6959
|
-
)
|
|
6960
|
-
);
|
|
6756
|
+
function parseDuotoneEffect(node) {
|
|
6757
|
+
if (node === void 0) return void 0;
|
|
6758
|
+
const colors = collectColorChildren(node);
|
|
6759
|
+
if (colors.length < 2) return void 0;
|
|
6760
|
+
return { color1: colors[0], color2: colors[1] };
|
|
6761
|
+
}
|
|
6762
|
+
function parseColorChangeEffect(node) {
|
|
6763
|
+
if (node === void 0) return void 0;
|
|
6764
|
+
const from = firstColorChild(getChild(node, "clrFrom"));
|
|
6765
|
+
const to = firstColorChild(getChild(node, "clrTo"));
|
|
6766
|
+
return from !== void 0 && to !== void 0 ? { from, to } : void 0;
|
|
6767
|
+
}
|
|
6768
|
+
function collectColorChildren(parent) {
|
|
6769
|
+
const colors = [];
|
|
6770
|
+
for (const [key, value] of Object.entries(parent)) {
|
|
6771
|
+
if (key.startsWith("@_")) continue;
|
|
6772
|
+
const nodes = Array.isArray(value) ? value : [value];
|
|
6773
|
+
for (const node of nodes) {
|
|
6774
|
+
if (!isXmlNode(node)) continue;
|
|
6775
|
+
const color = parseColorChild(key, node);
|
|
6776
|
+
if (color !== void 0) colors.push(color);
|
|
6961
6777
|
}
|
|
6962
6778
|
}
|
|
6963
|
-
return
|
|
6779
|
+
return colors;
|
|
6964
6780
|
}
|
|
6965
|
-
function
|
|
6966
|
-
|
|
6967
|
-
const alignToken = getAttr(pPr, "algn");
|
|
6968
|
-
const align = alignToken !== void 0 ? ALIGN_MAP[alignToken] : void 0;
|
|
6969
|
-
const level = numericAttr2(pPr, "lvl");
|
|
6970
|
-
const lineSpacing = parseSpacing(getChild(pPr, "lnSpc"));
|
|
6971
|
-
const spaceBefore = parseSpacing(getChild(pPr, "spcBef"));
|
|
6972
|
-
const spaceAfter = parseSpacing(getChild(pPr, "spcAft"));
|
|
6973
|
-
const marginLeft = numericAttr2(pPr, "marL");
|
|
6974
|
-
const indent = numericAttr2(pPr, "indent");
|
|
6975
|
-
const bullet = parseBullet(pPr);
|
|
6976
|
-
const bulletFont = getAttr(getChild(pPr, "buFont"), "typeface");
|
|
6977
|
-
const bulletColor = parseColorElement(getChild(pPr, "buClr"));
|
|
6978
|
-
const bulletSizePct = numericAttr2(getChild(pPr, "buSzPct"), "val");
|
|
6979
|
-
const tabStops = parseTabStops(pPr);
|
|
6980
|
-
const defaultRunProperties = parseRunProperties(getChild(pPr, "defRPr"));
|
|
6981
|
-
const properties = {
|
|
6982
|
-
...align !== void 0 ? { align } : {},
|
|
6983
|
-
...level !== void 0 ? { level } : {},
|
|
6984
|
-
...lineSpacing !== void 0 ? { lineSpacing } : {},
|
|
6985
|
-
...spaceBefore !== void 0 ? { spaceBefore } : {},
|
|
6986
|
-
...spaceAfter !== void 0 ? { spaceAfter } : {},
|
|
6987
|
-
...marginLeft !== void 0 ? { marginLeft: emu(marginLeft) } : {},
|
|
6988
|
-
...indent !== void 0 ? { indent: emu(indent) } : {},
|
|
6989
|
-
...bullet !== void 0 ? { bullet } : {},
|
|
6990
|
-
...bulletFont !== void 0 ? { bulletFont } : {},
|
|
6991
|
-
...bulletColor !== void 0 ? { bulletColor } : {},
|
|
6992
|
-
...bulletSizePct !== void 0 ? { bulletSizePct } : {},
|
|
6993
|
-
...tabStops.length > 0 ? { tabStops } : {},
|
|
6994
|
-
...defaultRunProperties !== void 0 ? { defaultRunProperties } : {}
|
|
6995
|
-
};
|
|
6996
|
-
return Object.keys(properties).length > 0 ? properties : void 0;
|
|
6781
|
+
function firstColorChild(parent) {
|
|
6782
|
+
return parent !== void 0 ? collectColorChildren(parent)[0] : void 0;
|
|
6997
6783
|
}
|
|
6998
|
-
function
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
alignment: unsafeOoxmlBoundaryAssertion(getAttr(tab, "algn")) ?? "l"
|
|
7002
|
-
}));
|
|
6784
|
+
function parseColorChild(key, node) {
|
|
6785
|
+
const name = localName(key);
|
|
6786
|
+
return name === "prstClr" ? parsePresetColor(node) : parseColorElement({ [name]: node });
|
|
7003
6787
|
}
|
|
7004
|
-
function
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
|
|
6788
|
+
function isXmlNode(value) {
|
|
6789
|
+
return typeof value === "object" && value !== null;
|
|
6790
|
+
}
|
|
6791
|
+
function parsePresetColor(node) {
|
|
6792
|
+
const value = getAttr(node, "val");
|
|
6793
|
+
const hex = value !== void 0 ? PRESET_COLOR_HEX[value] : void 0;
|
|
6794
|
+
return hex !== void 0 ? withTransforms({ kind: "srgb", hex }, node) : void 0;
|
|
6795
|
+
}
|
|
6796
|
+
function parseFill(parent, nextId) {
|
|
6797
|
+
if (!parent) return void 0;
|
|
6798
|
+
const solid = getChild(parent, "solidFill");
|
|
6799
|
+
if (solid) {
|
|
6800
|
+
const color = parseColorElement(solid);
|
|
6801
|
+
if (color) return { kind: "solid", color };
|
|
6802
|
+
return { kind: "raw", raw: makeSidecar("a:solidFill", solid, nextId) };
|
|
6803
|
+
}
|
|
6804
|
+
if (hasChild(parent, "noFill")) return { kind: "none" };
|
|
6805
|
+
const grad = getChild(parent, "gradFill");
|
|
6806
|
+
if (grad) {
|
|
6807
|
+
const fill = parseGradientFill(grad);
|
|
6808
|
+
return fill ?? { kind: "raw", raw: makeSidecar("a:gradFill", grad, nextId) };
|
|
6809
|
+
}
|
|
6810
|
+
const blip = getChild(parent, "blipFill");
|
|
6811
|
+
if (blip) {
|
|
6812
|
+
return parseBlipFill(blip) ?? { kind: "raw", raw: makeSidecar("a:blipFill", blip, nextId) };
|
|
6813
|
+
}
|
|
6814
|
+
const pattern = getChild(parent, "pattFill");
|
|
6815
|
+
if (pattern) {
|
|
6816
|
+
const fill = parsePatternFill(pattern);
|
|
6817
|
+
return fill ?? { kind: "raw", raw: makeSidecar("a:pattFill", pattern, nextId) };
|
|
6818
|
+
}
|
|
6819
|
+
for (const name of RAW_FILL_LOCAL_NAMES) {
|
|
6820
|
+
if (hasChild(parent, name)) {
|
|
6821
|
+
return { kind: "raw", raw: makeSidecar(`a:${name}`, getChild(parent, name) ?? {}, nextId) };
|
|
6822
|
+
}
|
|
6823
|
+
}
|
|
7009
6824
|
return void 0;
|
|
7010
6825
|
}
|
|
7011
|
-
function
|
|
7012
|
-
|
|
7013
|
-
|
|
7014
|
-
|
|
7015
|
-
|
|
7016
|
-
|
|
6826
|
+
function parseGradientFill(grad) {
|
|
6827
|
+
const stops = [];
|
|
6828
|
+
for (const gs of getChildArray(getChild(grad, "gsLst"), "gs")) {
|
|
6829
|
+
const color = parseColorElement(gs);
|
|
6830
|
+
if (color === void 0) continue;
|
|
6831
|
+
stops.push({
|
|
6832
|
+
position: (numericAttr2(gs, "pos") ?? 0) / 1e5,
|
|
6833
|
+
color
|
|
6834
|
+
});
|
|
7017
6835
|
}
|
|
7018
|
-
|
|
7019
|
-
|
|
7020
|
-
|
|
6836
|
+
if (stops.length === 0) return void 0;
|
|
6837
|
+
const path = getChild(grad, "path");
|
|
6838
|
+
if (path !== void 0) {
|
|
6839
|
+
const fillToRect = getChild(path, "fillToRect");
|
|
6840
|
+
const l = numericAttr2(fillToRect, "l") ?? 0;
|
|
6841
|
+
const t = numericAttr2(fillToRect, "t") ?? 0;
|
|
6842
|
+
const r = numericAttr2(fillToRect, "r") ?? 0;
|
|
6843
|
+
const b = numericAttr2(fillToRect, "b") ?? 0;
|
|
7021
6844
|
return {
|
|
7022
|
-
|
|
7023
|
-
|
|
7024
|
-
|
|
6845
|
+
kind: "gradient",
|
|
6846
|
+
gradientType: "radial",
|
|
6847
|
+
stops,
|
|
6848
|
+
centerX: (l + (1e5 - r)) / 2 / 1e5,
|
|
6849
|
+
centerY: (t + (1e5 - b)) / 2 / 1e5
|
|
7025
6850
|
};
|
|
7026
6851
|
}
|
|
7027
|
-
return void 0;
|
|
7028
|
-
}
|
|
7029
|
-
function decodeXmlCharRef(value) {
|
|
7030
|
-
return value.replace(
|
|
7031
|
-
/&#x([0-9a-fA-F]+);|&#([0-9]+);/g,
|
|
7032
|
-
(_match, hex, decimal) => String.fromCodePoint(parseInt(hex ?? decimal ?? "0", hex !== void 0 ? 16 : 10))
|
|
7033
|
-
);
|
|
7034
|
-
}
|
|
7035
|
-
function parseRun(r, partPath, nextId, ownerNodeId, ownerOrderingSlot, paragraphIndex, runIndex) {
|
|
7036
|
-
const properties = parseRunProperties(getChild(r, "rPr"));
|
|
7037
|
-
const rawSidecars = collectRunSidecars(r, nextId);
|
|
7038
6852
|
return {
|
|
7039
|
-
kind: "
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
|
|
7043
|
-
partPath,
|
|
7044
|
-
nodeId: textNodeId("run", ownerNodeId, ownerOrderingSlot, paragraphIndex, runIndex),
|
|
7045
|
-
orderingSlot: runIndex
|
|
7046
|
-
},
|
|
7047
|
-
...rawSidecars.length > 0 ? { rawSidecars } : {}
|
|
6853
|
+
kind: "gradient",
|
|
6854
|
+
gradientType: "linear",
|
|
6855
|
+
stops,
|
|
6856
|
+
angle: asOoxmlAngle(numericAttr2(getChild(grad, "lin"), "ang") ?? 0)
|
|
7048
6857
|
};
|
|
7049
6858
|
}
|
|
7050
|
-
function
|
|
7051
|
-
const
|
|
6859
|
+
function parseBlipFill(blipFill) {
|
|
6860
|
+
const blip = getChild(blipFill, "blip");
|
|
6861
|
+
const embed = getNamespacedAttr(blip, "embed");
|
|
6862
|
+
if (embed === void 0) return void 0;
|
|
6863
|
+
const tile = parseImageFillTile(getChild(blipFill, "tile"));
|
|
7052
6864
|
return {
|
|
7053
|
-
kind: "
|
|
7054
|
-
|
|
7055
|
-
...
|
|
7056
|
-
handle: {
|
|
7057
|
-
partPath,
|
|
7058
|
-
nodeId: textNodeId("run", ownerNodeId, ownerOrderingSlot, paragraphIndex, runIndex),
|
|
7059
|
-
orderingSlot: runIndex
|
|
7060
|
-
}
|
|
6865
|
+
kind: "image",
|
|
6866
|
+
blipRelationshipId: asRelationshipId(embed),
|
|
6867
|
+
...tile !== void 0 ? { tile } : {}
|
|
7061
6868
|
};
|
|
7062
6869
|
}
|
|
7063
|
-
function
|
|
7064
|
-
if (
|
|
7065
|
-
const
|
|
7066
|
-
|
|
7067
|
-
|
|
7068
|
-
|
|
7069
|
-
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
|
|
7073
|
-
const typefaceCs = getAttr(getChild(rPr, "cs"), "typeface");
|
|
7074
|
-
const hasHyperlink = getChild(rPr, "hlinkClick") !== void 0;
|
|
7075
|
-
const color = parseColorElement(getChild(rPr, "solidFill"));
|
|
7076
|
-
const properties = {
|
|
7077
|
-
...bold !== void 0 ? { bold: isTrue(bold) } : {},
|
|
7078
|
-
...italic !== void 0 ? { italic: isTrue(italic) } : {},
|
|
7079
|
-
...underline !== void 0 ? { underline: underline !== "none" } : hasHyperlink ? { underline: true } : {},
|
|
7080
|
-
...strike !== void 0 ? { strikethrough: strike !== "noStrike" } : {},
|
|
7081
|
-
...baseline !== void 0 ? { baseline: baseline / 1e3 } : {},
|
|
7082
|
-
// `a:rPr@sz` is in 1/100 pt unit. Convert to pt and save.
|
|
7083
|
-
...size !== void 0 ? { fontSize: asPt(size / 100) } : {},
|
|
7084
|
-
...typeface !== void 0 ? { typeface } : {},
|
|
7085
|
-
...typefaceEa !== void 0 ? { typefaceEa } : {},
|
|
7086
|
-
...typefaceCs !== void 0 ? { typefaceCs } : {},
|
|
7087
|
-
...color !== void 0 ? { color } : hasHyperlink ? { color: { kind: "scheme", scheme: "hlink" } } : {}
|
|
6870
|
+
function parseImageFillTile(tile) {
|
|
6871
|
+
if (tile === void 0) return void 0;
|
|
6872
|
+
const flip = getAttr(tile, "flip") ?? "none";
|
|
6873
|
+
return {
|
|
6874
|
+
tx: asEmu2(numericAttr2(tile, "tx") ?? 0),
|
|
6875
|
+
ty: asEmu2(numericAttr2(tile, "ty") ?? 0),
|
|
6876
|
+
sx: (numericAttr2(tile, "sx") ?? 1e5) / 1e5,
|
|
6877
|
+
sy: (numericAttr2(tile, "sy") ?? 1e5) / 1e5,
|
|
6878
|
+
flip: flip === "x" || flip === "y" || flip === "xy" ? flip : "none",
|
|
6879
|
+
align: parseRectangleAlignment(getAttr(tile, "algn"), "tl")
|
|
7088
6880
|
};
|
|
7089
|
-
return Object.keys(properties).length > 0 ? properties : void 0;
|
|
7090
6881
|
}
|
|
7091
|
-
function
|
|
7092
|
-
|
|
7093
|
-
const propLevel = collectUnknownSidecars(getChild(r, "rPr"), KNOWN_RUN_PROPERTY_CHILDREN, nextId);
|
|
7094
|
-
return [...runLevel, ...propLevel];
|
|
6882
|
+
function parseRectangleAlignment(value, fallback) {
|
|
6883
|
+
return parseEnumValueWithDefault(value, RECTANGLE_ALIGNMENT_TOKENS, fallback);
|
|
7095
6884
|
}
|
|
7096
|
-
function
|
|
7097
|
-
|
|
6885
|
+
function parsePatternFill(pattern) {
|
|
6886
|
+
const foregroundColor = parseColorElement(getChild(pattern, "fgClr"));
|
|
6887
|
+
const backgroundColor = parseColorElement(getChild(pattern, "bgClr"));
|
|
6888
|
+
if (foregroundColor === void 0 || backgroundColor === void 0) return void 0;
|
|
6889
|
+
return {
|
|
6890
|
+
kind: "pattern",
|
|
6891
|
+
preset: getAttr(pattern, "prst") ?? "ltDnDiag",
|
|
6892
|
+
foregroundColor,
|
|
6893
|
+
backgroundColor
|
|
6894
|
+
};
|
|
7098
6895
|
}
|
|
7099
|
-
function
|
|
7100
|
-
const
|
|
7101
|
-
|
|
7102
|
-
return asSourceNodeId(`text:${owner}:${suffix}`);
|
|
6896
|
+
function parseOutline(spPr, nextId) {
|
|
6897
|
+
const ln = getChild(spPr, "ln");
|
|
6898
|
+
return parseLine(ln, nextId);
|
|
7103
6899
|
}
|
|
7104
|
-
function
|
|
7105
|
-
|
|
6900
|
+
function parseLine(ln, nextId) {
|
|
6901
|
+
if (!ln) return void 0;
|
|
6902
|
+
const width = numericAttr2(ln, "w");
|
|
6903
|
+
const fill = parseFill(ln, nextId);
|
|
6904
|
+
const dashStyle = parseDashStyle(getChild(ln, "prstDash"));
|
|
6905
|
+
const customDash = parseCustomDash(ln);
|
|
6906
|
+
const lineCap = parseLineCap(getAttr(ln, "cap"));
|
|
6907
|
+
const lineJoin = parseLineJoin(ln);
|
|
6908
|
+
const headEnd = parseArrowEndpoint(getChild(ln, "headEnd"));
|
|
6909
|
+
const tailEnd = parseArrowEndpoint(getChild(ln, "tailEnd"));
|
|
6910
|
+
return {
|
|
6911
|
+
...width !== void 0 ? { width: asEmu2(width) } : {},
|
|
6912
|
+
...fill !== void 0 ? { fill } : {},
|
|
6913
|
+
...dashStyle !== void 0 ? { dashStyle } : {},
|
|
6914
|
+
...customDash !== void 0 ? { customDash } : {},
|
|
6915
|
+
...lineCap !== void 0 ? { lineCap } : {},
|
|
6916
|
+
...lineJoin !== void 0 ? { lineJoin } : {},
|
|
6917
|
+
...headEnd !== void 0 ? { headEnd } : {},
|
|
6918
|
+
...tailEnd !== void 0 ? { tailEnd } : {}
|
|
6919
|
+
};
|
|
7106
6920
|
}
|
|
7107
|
-
function
|
|
7108
|
-
const
|
|
7109
|
-
|
|
6921
|
+
function parseTransform(spPr) {
|
|
6922
|
+
const xfrm = getChild(spPr, "xfrm");
|
|
6923
|
+
if (!xfrm) return void 0;
|
|
6924
|
+
const off = getChild(xfrm, "off");
|
|
6925
|
+
const ext = getChild(xfrm, "ext");
|
|
6926
|
+
const offsetX = numericAttr2(off, "x");
|
|
6927
|
+
const offsetY = numericAttr2(off, "y");
|
|
6928
|
+
const width = numericAttr2(ext, "cx");
|
|
6929
|
+
const height = numericAttr2(ext, "cy");
|
|
6930
|
+
if (offsetX === void 0 || offsetY === void 0 || width === void 0 || height === void 0) {
|
|
6931
|
+
return void 0;
|
|
6932
|
+
}
|
|
6933
|
+
const rotation = numericAttr2(xfrm, "rot");
|
|
6934
|
+
const flipH = getAttr(xfrm, "flipH");
|
|
6935
|
+
const flipV = getAttr(xfrm, "flipV");
|
|
6936
|
+
return {
|
|
6937
|
+
offsetX: asEmu2(offsetX),
|
|
6938
|
+
offsetY: asEmu2(offsetY),
|
|
6939
|
+
width: asEmu2(width),
|
|
6940
|
+
height: asEmu2(height),
|
|
6941
|
+
...rotation !== void 0 ? { rotation: asOoxmlAngle(rotation) } : {},
|
|
6942
|
+
...isTrue(flipH) ? { flipHorizontal: true } : {},
|
|
6943
|
+
...isTrue(flipV) ? { flipVertical: true } : {}
|
|
6944
|
+
};
|
|
7110
6945
|
}
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
|
|
7114
|
-
var KNOWN_PICTURE_CHILDREN = /* @__PURE__ */ new Set(["nvPicPr", "blipFill", "spPr"]);
|
|
7115
|
-
var KNOWN_BLIP_FILL_CHILDREN = /* @__PURE__ */ new Set([
|
|
7116
|
-
"blip",
|
|
7117
|
-
"srcRect",
|
|
7118
|
-
"stretch",
|
|
7119
|
-
"tile"
|
|
7120
|
-
]);
|
|
7121
|
-
var KNOWN_BLIP_CHILDREN = /* @__PURE__ */ new Set([
|
|
7122
|
-
"grayscl",
|
|
7123
|
-
"biLevel",
|
|
7124
|
-
"blur",
|
|
7125
|
-
"lum",
|
|
7126
|
-
"duotone",
|
|
7127
|
-
"clrChange"
|
|
7128
|
-
]);
|
|
7129
|
-
var KNOWN_EFFECT_CHILDREN = /* @__PURE__ */ new Set([
|
|
7130
|
-
"outerShdw",
|
|
7131
|
-
"innerShdw",
|
|
7132
|
-
"glow",
|
|
7133
|
-
"softEdge"
|
|
7134
|
-
]);
|
|
7135
|
-
var KNOWN_GRAPHIC_FRAME_CHILDREN = /* @__PURE__ */ new Set([
|
|
7136
|
-
"nvGraphicFramePr",
|
|
7137
|
-
"xfrm",
|
|
7138
|
-
"graphic"
|
|
7139
|
-
]);
|
|
7140
|
-
var KNOWN_GRAPHIC_CHILDREN = /* @__PURE__ */ new Set(["graphicData"]);
|
|
7141
|
-
var KNOWN_GRAPHIC_DATA_CHILDREN = /* @__PURE__ */ new Set(["tbl"]);
|
|
7142
|
-
var KNOWN_TABLE_CHILDREN = /* @__PURE__ */ new Set(["tblPr", "tblGrid", "tr"]);
|
|
7143
|
-
var KNOWN_TABLE_CELL_CHILDREN = /* @__PURE__ */ new Set(["txBody", "tcPr"]);
|
|
7144
|
-
var KNOWN_TABLE_CELL_PROPERTIES_CHILDREN = /* @__PURE__ */ new Set([
|
|
7145
|
-
"lnL",
|
|
7146
|
-
"lnR",
|
|
7147
|
-
"lnT",
|
|
7148
|
-
"lnB",
|
|
7149
|
-
"solidFill",
|
|
7150
|
-
"noFill",
|
|
7151
|
-
"gradFill",
|
|
7152
|
-
"blipFill",
|
|
7153
|
-
"pattFill",
|
|
7154
|
-
"grpFill"
|
|
7155
|
-
]);
|
|
7156
|
-
var KNOWN_SP_PR_CHILDREN = /* @__PURE__ */ new Set([
|
|
7157
|
-
"xfrm",
|
|
7158
|
-
"prstGeom",
|
|
7159
|
-
"solidFill",
|
|
7160
|
-
"noFill",
|
|
7161
|
-
"gradFill",
|
|
7162
|
-
"blipFill",
|
|
7163
|
-
"pattFill",
|
|
7164
|
-
"grpFill",
|
|
7165
|
-
"ln",
|
|
7166
|
-
"effectLst"
|
|
7167
|
-
]);
|
|
7168
|
-
var SHAPE_TREE_NODE_TAGS = /* @__PURE__ */ new Set([
|
|
7169
|
-
"sp",
|
|
7170
|
-
"pic",
|
|
7171
|
-
"cxnSp",
|
|
7172
|
-
"grpSp",
|
|
7173
|
-
"graphicFrame"
|
|
7174
|
-
]);
|
|
7175
|
-
var CHART_GRAPHIC_DATA_URIS = /* @__PURE__ */ new Set([
|
|
7176
|
-
"http://schemas.openxmlformats.org/drawingml/2006/chart",
|
|
7177
|
-
"http://purl.oclc.org/ooxml/drawingml/chart"
|
|
7178
|
-
]);
|
|
7179
|
-
var SMARTART_DIAGRAM_URIS = /* @__PURE__ */ new Set([
|
|
7180
|
-
"http://schemas.openxmlformats.org/drawingml/2006/diagram",
|
|
7181
|
-
"http://purl.oclc.org/ooxml/drawingml/diagram"
|
|
7182
|
-
]);
|
|
7183
|
-
function parseShapeTree(spTree, partPath, nextId, orderedChildren) {
|
|
7184
|
-
if (!spTree) return [];
|
|
7185
|
-
if (orderedChildren !== void 0) {
|
|
7186
|
-
return parseShapeTreeOrdered(spTree, partPath, nextId, orderedChildren);
|
|
7187
|
-
}
|
|
7188
|
-
const nodes = [];
|
|
7189
|
-
let orderingSlot = 0;
|
|
7190
|
-
for (const key of Object.keys(spTree)) {
|
|
6946
|
+
function withTransforms(base, colorNode) {
|
|
6947
|
+
const transforms = [];
|
|
6948
|
+
for (const key of Object.keys(colorNode)) {
|
|
7191
6949
|
if (key.startsWith("@_")) continue;
|
|
7192
|
-
|
|
7193
|
-
const
|
|
7194
|
-
if (
|
|
7195
|
-
const value =
|
|
6950
|
+
const kind = localName(key);
|
|
6951
|
+
const transformKind = parseEnumValue(kind, COLOR_TRANSFORM_KINDS);
|
|
6952
|
+
if (transformKind === void 0) continue;
|
|
6953
|
+
const value = colorNode[key];
|
|
7196
6954
|
const items = Array.isArray(value) ? value : [value];
|
|
7197
6955
|
for (const item of items) {
|
|
7198
|
-
const
|
|
7199
|
-
if (
|
|
7200
|
-
|
|
7201
|
-
|
|
7202
|
-
|
|
7203
|
-
|
|
7204
|
-
|
|
7205
|
-
}
|
|
7206
|
-
nodes.push(parseGroup(node, partPath, nextId, orderingSlot));
|
|
7207
|
-
} else if (local === "graphicFrame") {
|
|
7208
|
-
nodes.push(parseGraphicFrame(node, partPath, nextId, orderingSlot));
|
|
7209
|
-
} else if (local === "AlternateContent") {
|
|
7210
|
-
const parsed = parseAlternateContent(node, partPath, nextId, orderingSlot);
|
|
7211
|
-
nodes.push(...parsed);
|
|
7212
|
-
} else {
|
|
7213
|
-
nodes.push(parseRawShapeNode(key, node, partPath, nextId, orderingSlot));
|
|
7214
|
-
}
|
|
7215
|
-
orderingSlot++;
|
|
6956
|
+
const raw = getAttr(unsafeOoxmlBoundaryAssertion(item), "val");
|
|
6957
|
+
if (raw === void 0) continue;
|
|
6958
|
+
const numeric = Number(raw);
|
|
6959
|
+
if (!Number.isFinite(numeric)) continue;
|
|
6960
|
+
transforms.push({
|
|
6961
|
+
kind: transformKind,
|
|
6962
|
+
value: asOoxmlPercent(numeric)
|
|
6963
|
+
});
|
|
7216
6964
|
}
|
|
7217
6965
|
}
|
|
7218
|
-
return
|
|
6966
|
+
return transforms.length > 0 ? { ...base, transforms } : base;
|
|
7219
6967
|
}
|
|
7220
|
-
function
|
|
7221
|
-
const
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
const key = Object.keys(child).find((candidate) => candidate !== ":@");
|
|
7226
|
-
if (key === void 0) continue;
|
|
7227
|
-
const local = localName(key);
|
|
7228
|
-
if (local === "AlternateContent") {
|
|
7229
|
-
const index2 = tagCounters[local] ?? 0;
|
|
7230
|
-
tagCounters[local] = index2 + 1;
|
|
7231
|
-
const alternateContents = getChildArray(spTree, "AlternateContent");
|
|
7232
|
-
const alternateContent = alternateContents[index2];
|
|
7233
|
-
if (alternateContent !== void 0) {
|
|
7234
|
-
nodes.push(...parseAlternateContent(alternateContent, partPath, nextId, orderingSlot));
|
|
7235
|
-
orderingSlot++;
|
|
7236
|
-
}
|
|
7237
|
-
continue;
|
|
7238
|
-
}
|
|
7239
|
-
if (!SHAPE_TREE_NODE_TAGS.has(local)) continue;
|
|
7240
|
-
const index = tagCounters[local] ?? 0;
|
|
7241
|
-
tagCounters[local] = index + 1;
|
|
7242
|
-
const node = getChildArray(spTree, local)[index];
|
|
7243
|
-
if (node === void 0) continue;
|
|
7244
|
-
nodes.push(parseShapeTreeNode(local, node, child, partPath, nextId, orderingSlot));
|
|
7245
|
-
orderingSlot++;
|
|
7246
|
-
}
|
|
7247
|
-
return nodes;
|
|
6968
|
+
function numericAttr2(node, name) {
|
|
6969
|
+
const raw = getAttr(node, name);
|
|
6970
|
+
if (raw === void 0) return void 0;
|
|
6971
|
+
const value = Number(raw);
|
|
6972
|
+
return Number.isFinite(value) ? value : void 0;
|
|
7248
6973
|
}
|
|
7249
|
-
function
|
|
7250
|
-
|
|
7251
|
-
if (local === "pic") return parseImage(node, partPath, nextId, orderingSlot);
|
|
7252
|
-
if (local === "cxnSp") {
|
|
7253
|
-
return parseConnector(node, partPath, nextId, orderingSlot, orderedNode);
|
|
7254
|
-
}
|
|
7255
|
-
if (local === "grpSp") {
|
|
7256
|
-
const orderedGroupChildren = unsafeOoxmlBoundaryAssertion(orderedNode?.[local]);
|
|
7257
|
-
return parseGroup(node, partPath, nextId, orderingSlot, orderedGroupChildren);
|
|
7258
|
-
}
|
|
7259
|
-
if (local === "graphicFrame") {
|
|
7260
|
-
return parseGraphicFrame(node, partPath, nextId, orderingSlot, orderedNode);
|
|
7261
|
-
}
|
|
7262
|
-
return parseRawShapeNode(`p:${local}`, node, partPath, nextId, orderingSlot);
|
|
6974
|
+
function isTrue(value) {
|
|
6975
|
+
return value === "1" || value === "true";
|
|
7263
6976
|
}
|
|
7264
|
-
function
|
|
7265
|
-
const
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
|
|
7269
|
-
const
|
|
7270
|
-
const
|
|
7271
|
-
|
|
7272
|
-
|
|
7273
|
-
|
|
7274
|
-
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
|
|
7281
|
-
|
|
7282
|
-
|
|
7283
|
-
|
|
7284
|
-
|
|
7285
|
-
|
|
7286
|
-
|
|
7287
|
-
|
|
7288
|
-
|
|
7289
|
-
|
|
6977
|
+
function parseDashStyle(prstDash) {
|
|
6978
|
+
const value = getAttr(prstDash, "val");
|
|
6979
|
+
return parseEnumValue(value, DASH_STYLES);
|
|
6980
|
+
}
|
|
6981
|
+
function parseCustomDash(ln) {
|
|
6982
|
+
const custDash = getChild(ln, "custDash");
|
|
6983
|
+
const segments = getChildArray(custDash, "ds");
|
|
6984
|
+
if (segments.length === 0) return void 0;
|
|
6985
|
+
return segments.flatMap((segment) => [
|
|
6986
|
+
(numericAttr2(segment, "d") ?? 1e5) / 1e5,
|
|
6987
|
+
(numericAttr2(segment, "sp") ?? 1e5) / 1e5
|
|
6988
|
+
]);
|
|
6989
|
+
}
|
|
6990
|
+
var LINE_CAP_MAP = {
|
|
6991
|
+
flat: "butt",
|
|
6992
|
+
sq: "square",
|
|
6993
|
+
rnd: "round"
|
|
6994
|
+
};
|
|
6995
|
+
function parseLineCap(value) {
|
|
6996
|
+
return value !== void 0 ? LINE_CAP_MAP[value] : void 0;
|
|
6997
|
+
}
|
|
6998
|
+
function parseLineJoin(ln) {
|
|
6999
|
+
if (hasChild(ln, "round")) return "round";
|
|
7000
|
+
if (hasChild(ln, "bevel")) return "bevel";
|
|
7001
|
+
if (hasChild(ln, "miter")) return "miter";
|
|
7002
|
+
return void 0;
|
|
7003
|
+
}
|
|
7004
|
+
function parseArrowEndpoint(node) {
|
|
7005
|
+
if (!node) return void 0;
|
|
7006
|
+
const type = parseEnumValue(getAttr(node, "type"), ARROW_TYPES);
|
|
7007
|
+
if (type === void 0) return void 0;
|
|
7008
|
+
const width = getAttr(node, "w") ?? "med";
|
|
7009
|
+
const length = getAttr(node, "len") ?? "med";
|
|
7290
7010
|
return {
|
|
7291
|
-
|
|
7292
|
-
|
|
7293
|
-
|
|
7294
|
-
...transform !== void 0 ? { transform } : {},
|
|
7295
|
-
...geometry !== void 0 ? { geometry } : {},
|
|
7296
|
-
...fill !== void 0 ? { fill } : {},
|
|
7297
|
-
...outline !== void 0 ? { outline } : {},
|
|
7298
|
-
...effects !== void 0 ? { effects } : {},
|
|
7299
|
-
...style !== void 0 ? { style } : {},
|
|
7300
|
-
...textBody !== void 0 ? { textBody } : {},
|
|
7301
|
-
...placeholder !== void 0 ? { placeholder } : {},
|
|
7302
|
-
handle: { partPath, ...nodeId !== void 0 ? { nodeId } : {}, orderingSlot },
|
|
7303
|
-
...rawSidecars.length > 0 ? { rawSidecars } : {}
|
|
7011
|
+
type,
|
|
7012
|
+
width: parseEnumValueWithDefault(width, ARROW_SIZES, "med"),
|
|
7013
|
+
length: parseEnumValueWithDefault(length, ARROW_SIZES, "med")
|
|
7304
7014
|
};
|
|
7305
7015
|
}
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
|
|
7327
|
-
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
|
|
7336
|
-
|
|
7337
|
-
|
|
7338
|
-
|
|
7339
|
-
|
|
7340
|
-
|
|
7341
|
-
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
|
|
7356
|
-
|
|
7357
|
-
|
|
7358
|
-
|
|
7359
|
-
|
|
7360
|
-
|
|
7361
|
-
|
|
7362
|
-
|
|
7363
|
-
|
|
7364
|
-
|
|
7365
|
-
|
|
7366
|
-
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
|
|
7370
|
-
|
|
7371
|
-
return
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
|
|
7376
|
-
|
|
7377
|
-
|
|
7378
|
-
|
|
7379
|
-
const
|
|
7380
|
-
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7409
|
-
|
|
7410
|
-
const
|
|
7411
|
-
const crop = parseCrop(getChild(blipFill, "srcRect"));
|
|
7412
|
-
const stretch = parseStretch(getChild(blipFill, "stretch"));
|
|
7413
|
-
const tile = parseImageFillTile(getChild(blipFill, "tile"));
|
|
7414
|
-
const blipEffects = parseBlipEffects(blip);
|
|
7415
|
-
const spPr = getChild(pic, "spPr");
|
|
7416
|
-
const transform = parseTransform(spPr);
|
|
7417
|
-
const effects = parseEffectList(getChild(spPr, "effectLst"));
|
|
7418
|
-
const rawSidecars = [
|
|
7419
|
-
...collectUnknownSidecars(pic, KNOWN_PICTURE_CHILDREN, nextId),
|
|
7420
|
-
...collectUnknownSidecars(spPr, KNOWN_SP_PR_CHILDREN, nextId),
|
|
7421
|
-
...collectEffectSidecars(spPr, effects, nextId),
|
|
7422
|
-
// Retains fill mode such as `a:stretch` / `a:tile` and recolor operation under blip.
|
|
7423
|
-
...collectUnknownSidecars(blipFill, KNOWN_BLIP_FILL_CHILDREN, nextId),
|
|
7424
|
-
...collectBlipEffectSidecars(blip, blipEffects, nextId)
|
|
7425
|
-
];
|
|
7016
|
+
var DASH_STYLES = /* @__PURE__ */ new Set([
|
|
7017
|
+
"solid",
|
|
7018
|
+
"dash",
|
|
7019
|
+
"dot",
|
|
7020
|
+
"dashDot",
|
|
7021
|
+
"lgDash",
|
|
7022
|
+
"lgDashDot",
|
|
7023
|
+
"sysDash",
|
|
7024
|
+
"sysDot"
|
|
7025
|
+
]);
|
|
7026
|
+
var ARROW_TYPES = /* @__PURE__ */ new Set([
|
|
7027
|
+
"triangle",
|
|
7028
|
+
"stealth",
|
|
7029
|
+
"diamond",
|
|
7030
|
+
"oval",
|
|
7031
|
+
"arrow"
|
|
7032
|
+
]);
|
|
7033
|
+
var ARROW_SIZES = /* @__PURE__ */ new Set(["sm", "med", "lg"]);
|
|
7034
|
+
var KNOWN_TXBODY_CHILDREN = /* @__PURE__ */ new Set(["bodyPr", "lstStyle", "p"]);
|
|
7035
|
+
var KNOWN_PARAGRAPH_CHILDREN = /* @__PURE__ */ new Set([
|
|
7036
|
+
"pPr",
|
|
7037
|
+
"r",
|
|
7038
|
+
"fld",
|
|
7039
|
+
"br",
|
|
7040
|
+
"endParaRPr"
|
|
7041
|
+
]);
|
|
7042
|
+
var KNOWN_RUN_CHILDREN = /* @__PURE__ */ new Set(["rPr", "t"]);
|
|
7043
|
+
var KNOWN_RUN_PROPERTY_CHILDREN = /* @__PURE__ */ new Set([
|
|
7044
|
+
"latin",
|
|
7045
|
+
"ea",
|
|
7046
|
+
"cs",
|
|
7047
|
+
"solidFill"
|
|
7048
|
+
]);
|
|
7049
|
+
var ALIGN_MAP = {
|
|
7050
|
+
l: "left",
|
|
7051
|
+
ctr: "center",
|
|
7052
|
+
r: "right",
|
|
7053
|
+
just: "justify"
|
|
7054
|
+
};
|
|
7055
|
+
var ANCHOR_MAP = {
|
|
7056
|
+
t: "top",
|
|
7057
|
+
ctr: "middle",
|
|
7058
|
+
b: "bottom"
|
|
7059
|
+
};
|
|
7060
|
+
var WRAP_VALUES = /* @__PURE__ */ new Set(["square", "none"]);
|
|
7061
|
+
var VERTICAL_VALUES = /* @__PURE__ */ new Set([
|
|
7062
|
+
"horz",
|
|
7063
|
+
"vert",
|
|
7064
|
+
"vert270",
|
|
7065
|
+
"eaVert",
|
|
7066
|
+
"wordArtVert",
|
|
7067
|
+
"mongolianVert"
|
|
7068
|
+
]);
|
|
7069
|
+
var VALID_AUTO_NUM_SCHEMES = /* @__PURE__ */ new Set([
|
|
7070
|
+
"arabicPeriod",
|
|
7071
|
+
"arabicParenR",
|
|
7072
|
+
"romanUcPeriod",
|
|
7073
|
+
"romanLcPeriod",
|
|
7074
|
+
"alphaUcPeriod",
|
|
7075
|
+
"alphaLcPeriod",
|
|
7076
|
+
"alphaLcParenR",
|
|
7077
|
+
"alphaUcParenR",
|
|
7078
|
+
"arabicPlain"
|
|
7079
|
+
]);
|
|
7080
|
+
function parseTextBody(txBody, partPath, nextId, ownerNodeId, ownerOrderingSlot, orderedTxBody) {
|
|
7081
|
+
if (!txBody) return void 0;
|
|
7082
|
+
const properties = parseBodyProperties(getChild(txBody, "bodyPr"));
|
|
7083
|
+
const listStyle = parseTextStyle(getChild(txBody, "lstStyle"));
|
|
7084
|
+
const orderedParagraphs = orderedTxBody?.filter((child) => orderedLocalName(child) === "p").map((child) => {
|
|
7085
|
+
const key = orderedKey(child);
|
|
7086
|
+
const value = key !== void 0 ? child[key] : void 0;
|
|
7087
|
+
return Array.isArray(value) ? value : void 0;
|
|
7088
|
+
});
|
|
7089
|
+
const paragraphs = [];
|
|
7090
|
+
let logicalParagraphIndex = 0;
|
|
7091
|
+
getChildArray(txBody, "p").forEach((p, paragraphIndex) => {
|
|
7092
|
+
const orderedChildren = orderedParagraphs?.[paragraphIndex];
|
|
7093
|
+
if (orderedChildren !== void 0 && hasMultipleBulletPPr(p, orderedChildren)) {
|
|
7094
|
+
const split = splitInterleavedParagraph(
|
|
7095
|
+
p,
|
|
7096
|
+
orderedChildren,
|
|
7097
|
+
partPath,
|
|
7098
|
+
nextId,
|
|
7099
|
+
ownerNodeId,
|
|
7100
|
+
ownerOrderingSlot,
|
|
7101
|
+
logicalParagraphIndex
|
|
7102
|
+
);
|
|
7103
|
+
paragraphs.push(...split);
|
|
7104
|
+
logicalParagraphIndex += split.length;
|
|
7105
|
+
return;
|
|
7106
|
+
}
|
|
7107
|
+
paragraphs.push(
|
|
7108
|
+
parseParagraph(
|
|
7109
|
+
p,
|
|
7110
|
+
partPath,
|
|
7111
|
+
nextId,
|
|
7112
|
+
ownerNodeId,
|
|
7113
|
+
ownerOrderingSlot,
|
|
7114
|
+
logicalParagraphIndex,
|
|
7115
|
+
orderedChildren
|
|
7116
|
+
)
|
|
7117
|
+
);
|
|
7118
|
+
logicalParagraphIndex++;
|
|
7119
|
+
});
|
|
7120
|
+
const rawSidecars = collectUnknownSidecars(txBody, KNOWN_TXBODY_CHILDREN, nextId);
|
|
7426
7121
|
return {
|
|
7427
|
-
|
|
7428
|
-
...
|
|
7429
|
-
...
|
|
7430
|
-
|
|
7431
|
-
...embed !== void 0 ? { blipRelationshipId: asRelationshipId(embed) } : {},
|
|
7432
|
-
...crop !== void 0 ? { crop } : {},
|
|
7433
|
-
...stretch !== void 0 ? { stretch } : {},
|
|
7434
|
-
...tile !== void 0 ? { tile } : {},
|
|
7435
|
-
...effects !== void 0 ? { effects } : {},
|
|
7436
|
-
...blipEffects !== void 0 ? { blipEffects } : {},
|
|
7437
|
-
handle: {
|
|
7438
|
-
partPath,
|
|
7439
|
-
...nodeId !== void 0 ? { nodeId } : {},
|
|
7440
|
-
...embed !== void 0 ? { relationshipId: asRelationshipId(embed) } : {},
|
|
7441
|
-
orderingSlot
|
|
7442
|
-
},
|
|
7122
|
+
paragraphs,
|
|
7123
|
+
...properties !== void 0 ? { properties } : {},
|
|
7124
|
+
...listStyle !== void 0 ? { listStyle } : {},
|
|
7125
|
+
handle: { partPath },
|
|
7443
7126
|
...rawSidecars.length > 0 ? { rawSidecars } : {}
|
|
7444
7127
|
};
|
|
7445
7128
|
}
|
|
7446
|
-
function
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
const
|
|
7450
|
-
|
|
7451
|
-
|
|
7452
|
-
|
|
7453
|
-
|
|
7454
|
-
|
|
7455
|
-
];
|
|
7456
|
-
for (const [name, parsed] of supportedChildren) {
|
|
7457
|
-
const node = getChild(effectList, name);
|
|
7458
|
-
if (node !== void 0 && parsed === void 0) {
|
|
7459
|
-
sidecars.push(makeSidecar(`a:${name}`, node, nextId));
|
|
7460
|
-
}
|
|
7461
|
-
}
|
|
7462
|
-
return sidecars;
|
|
7463
|
-
}
|
|
7464
|
-
function collectBlipEffectSidecars(blip, effects, nextId) {
|
|
7465
|
-
if (blip === void 0) return [];
|
|
7466
|
-
const sidecars = collectUnknownSidecars(blip, KNOWN_BLIP_CHILDREN, nextId);
|
|
7467
|
-
const supportedChildren = [
|
|
7468
|
-
["grayscl", effects?.grayscale === true],
|
|
7469
|
-
["biLevel", effects?.biLevel],
|
|
7470
|
-
["blur", effects?.blur],
|
|
7471
|
-
["lum", effects?.lum],
|
|
7472
|
-
["duotone", effects?.duotone],
|
|
7473
|
-
["clrChange", effects?.clrChange]
|
|
7474
|
-
];
|
|
7475
|
-
for (const [name, parsed] of supportedChildren) {
|
|
7476
|
-
const node = getChild(blip, name);
|
|
7477
|
-
if (node !== void 0 && (parsed === void 0 || parsed === false)) {
|
|
7478
|
-
sidecars.push(makeSidecar(`a:${name}`, node, nextId));
|
|
7479
|
-
}
|
|
7480
|
-
}
|
|
7481
|
-
return sidecars;
|
|
7482
|
-
}
|
|
7483
|
-
function parseGraphicFrame(graphicFrame, partPath, nextId, orderingSlot, orderedNode) {
|
|
7484
|
-
const graphic = getChild(graphicFrame, "graphic");
|
|
7485
|
-
const graphicData = getChild(graphic, "graphicData");
|
|
7486
|
-
const uri = getAttr(graphicData, "uri");
|
|
7487
|
-
if (uri !== void 0 && CHART_GRAPHIC_DATA_URIS.has(uri)) {
|
|
7488
|
-
const parsedChart = parseChartGraphicFrame(graphicFrame, partPath, nextId, orderingSlot);
|
|
7489
|
-
if (parsedChart !== void 0) return parsedChart;
|
|
7490
|
-
}
|
|
7491
|
-
if (uri !== void 0 && SMARTART_DIAGRAM_URIS.has(uri)) {
|
|
7492
|
-
const parsedSmartArt = parseSmartArtGraphicFrame(graphicFrame, partPath, nextId, orderingSlot);
|
|
7493
|
-
if (parsedSmartArt !== void 0) return parsedSmartArt;
|
|
7494
|
-
}
|
|
7495
|
-
const table = getChild(graphicData, "tbl");
|
|
7496
|
-
if (table === void 0) {
|
|
7497
|
-
return parseRawShapeNode("p:graphicFrame", graphicFrame, partPath, nextId, orderingSlot);
|
|
7498
|
-
}
|
|
7499
|
-
const orderedGraphicChildren = orderedNestedChildChildren(orderedNode, "graphicFrame", "graphic");
|
|
7500
|
-
const orderedGraphicDataChildren = orderedChildChildren2(orderedGraphicChildren, "graphicData");
|
|
7501
|
-
const orderedTableChildren = orderedChildChildren2(orderedGraphicDataChildren, "tbl");
|
|
7502
|
-
const parsedTable = parseTable(
|
|
7503
|
-
table,
|
|
7504
|
-
graphicFrame,
|
|
7505
|
-
partPath,
|
|
7506
|
-
nextId,
|
|
7507
|
-
orderingSlot,
|
|
7508
|
-
orderedTableChildren
|
|
7509
|
-
);
|
|
7510
|
-
if (parsedTable === void 0) {
|
|
7511
|
-
return parseRawShapeNode("p:graphicFrame", graphicFrame, partPath, nextId, orderingSlot);
|
|
7512
|
-
}
|
|
7513
|
-
return parsedTable;
|
|
7514
|
-
}
|
|
7515
|
-
function parseAlternateContent(alternateContent, partPath, nextId, orderingSlot) {
|
|
7516
|
-
const branches = [
|
|
7517
|
-
...getChildArray(alternateContent, "Choice"),
|
|
7518
|
-
...getChildArray(alternateContent, "Fallback")
|
|
7519
|
-
];
|
|
7520
|
-
for (const branch of branches) {
|
|
7521
|
-
const parsed = parseAlternateContentBranch(branch, partPath, nextId, orderingSlot);
|
|
7522
|
-
if (parsed.length > 0) {
|
|
7523
|
-
if (parsed.every((node) => node.kind === "raw")) {
|
|
7524
|
-
continue;
|
|
7525
|
-
}
|
|
7526
|
-
return parsed.map(
|
|
7527
|
-
(node) => attachRawSidecar(node, makeSidecar("mc:AlternateContent", alternateContent, nextId))
|
|
7528
|
-
);
|
|
7529
|
-
}
|
|
7129
|
+
function parseTextStyle(node) {
|
|
7130
|
+
if (node === void 0) return void 0;
|
|
7131
|
+
const defaultParagraph = parseParagraphProperties(getChild(node, "defPPr"));
|
|
7132
|
+
const levels = Array.from(
|
|
7133
|
+
{ length: 9 },
|
|
7134
|
+
(_, index) => parseParagraphProperties(getChild(node, `lvl${index + 1}pPr`))
|
|
7135
|
+
);
|
|
7136
|
+
if (defaultParagraph === void 0 && levels.every((level) => level === void 0)) {
|
|
7137
|
+
return void 0;
|
|
7530
7138
|
}
|
|
7531
|
-
return
|
|
7532
|
-
parseRawShapeNode("mc:AlternateContent", alternateContent, partPath, nextId, orderingSlot)
|
|
7533
|
-
];
|
|
7139
|
+
return { ...defaultParagraph !== void 0 ? { defaultParagraph } : {}, levels };
|
|
7534
7140
|
}
|
|
7535
|
-
function
|
|
7536
|
-
|
|
7537
|
-
|
|
7538
|
-
|
|
7539
|
-
|
|
7540
|
-
|
|
7141
|
+
function hasMultipleBulletPPr(p, orderedChildren) {
|
|
7142
|
+
const pPrList = getChildArray(p, "pPr");
|
|
7143
|
+
let bulletPPrCount = 0;
|
|
7144
|
+
let pPrCounter = 0;
|
|
7145
|
+
for (const child of orderedChildren) {
|
|
7146
|
+
if (orderedLocalName(child) !== "pPr") continue;
|
|
7147
|
+
const pPr = pPrList[pPrCounter];
|
|
7148
|
+
if (pPr !== void 0 && (getChild(pPr, "buChar") !== void 0 || getChild(pPr, "buAutoNum") !== void 0)) {
|
|
7149
|
+
bulletPPrCount++;
|
|
7150
|
+
if (bulletPPrCount >= 2) return true;
|
|
7151
|
+
}
|
|
7152
|
+
pPrCounter++;
|
|
7153
|
+
}
|
|
7154
|
+
return false;
|
|
7541
7155
|
}
|
|
7542
|
-
function
|
|
7543
|
-
const
|
|
7544
|
-
|
|
7545
|
-
|
|
7546
|
-
|
|
7547
|
-
|
|
7548
|
-
|
|
7549
|
-
|
|
7550
|
-
|
|
7551
|
-
|
|
7552
|
-
|
|
7553
|
-
|
|
7554
|
-
|
|
7555
|
-
|
|
7556
|
-
|
|
7557
|
-
|
|
7558
|
-
|
|
7156
|
+
function splitInterleavedParagraph(p, orderedChildren, partPath, nextId, ownerNodeId, ownerOrderingSlot, paragraphIndex) {
|
|
7157
|
+
const pPrList = getChildArray(p, "pPr");
|
|
7158
|
+
const rList = getChildArray(p, "r");
|
|
7159
|
+
const fldList = getChildArray(p, "fld");
|
|
7160
|
+
const brList = getChildArray(p, "br");
|
|
7161
|
+
const groups = [];
|
|
7162
|
+
let currentGroup;
|
|
7163
|
+
let pPrCounter = 0;
|
|
7164
|
+
let runCounter = 0;
|
|
7165
|
+
let fieldCounter = 0;
|
|
7166
|
+
let breakCounter = 0;
|
|
7167
|
+
for (const child of orderedChildren) {
|
|
7168
|
+
const tag = orderedLocalName(child);
|
|
7169
|
+
if (tag === "pPr") {
|
|
7170
|
+
const pPr = pPrList[pPrCounter];
|
|
7171
|
+
const hasBullet = pPr !== void 0 && (getChild(pPr, "buChar") !== void 0 || getChild(pPr, "buAutoNum") !== void 0);
|
|
7172
|
+
if (hasBullet || currentGroup === void 0) {
|
|
7173
|
+
if (currentGroup !== void 0) groups.push(currentGroup);
|
|
7174
|
+
currentGroup = {
|
|
7175
|
+
pPrIndex: pPrCounter,
|
|
7176
|
+
rNodes: [],
|
|
7177
|
+
fldNodes: [],
|
|
7178
|
+
brNodes: [],
|
|
7179
|
+
orderedChildren: [child]
|
|
7180
|
+
};
|
|
7559
7181
|
} else {
|
|
7560
|
-
|
|
7182
|
+
currentGroup.orderedChildren.push(child);
|
|
7561
7183
|
}
|
|
7184
|
+
pPrCounter++;
|
|
7185
|
+
} else if (tag === "r") {
|
|
7186
|
+
currentGroup ??= {
|
|
7187
|
+
pPrIndex: -1,
|
|
7188
|
+
rNodes: [],
|
|
7189
|
+
fldNodes: [],
|
|
7190
|
+
brNodes: [],
|
|
7191
|
+
orderedChildren: []
|
|
7192
|
+
};
|
|
7193
|
+
currentGroup.orderedChildren.push(child);
|
|
7194
|
+
if (rList[runCounter] !== void 0) currentGroup.rNodes.push(rList[runCounter]);
|
|
7195
|
+
runCounter++;
|
|
7196
|
+
} else if (tag === "fld") {
|
|
7197
|
+
currentGroup ??= {
|
|
7198
|
+
pPrIndex: -1,
|
|
7199
|
+
rNodes: [],
|
|
7200
|
+
fldNodes: [],
|
|
7201
|
+
brNodes: [],
|
|
7202
|
+
orderedChildren: []
|
|
7203
|
+
};
|
|
7204
|
+
currentGroup.orderedChildren.push(child);
|
|
7205
|
+
if (fldList[fieldCounter] !== void 0) currentGroup.fldNodes.push(fldList[fieldCounter]);
|
|
7206
|
+
fieldCounter++;
|
|
7207
|
+
} else if (tag === "br") {
|
|
7208
|
+
currentGroup ??= {
|
|
7209
|
+
pPrIndex: -1,
|
|
7210
|
+
rNodes: [],
|
|
7211
|
+
fldNodes: [],
|
|
7212
|
+
brNodes: [],
|
|
7213
|
+
orderedChildren: []
|
|
7214
|
+
};
|
|
7215
|
+
currentGroup.orderedChildren.push(child);
|
|
7216
|
+
if (brList[breakCounter] !== void 0) currentGroup.brNodes.push(brList[breakCounter]);
|
|
7217
|
+
breakCounter++;
|
|
7562
7218
|
}
|
|
7563
7219
|
}
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
const transform = parseTransform(graphicFrame);
|
|
7577
|
-
const rawSidecars = [
|
|
7578
|
-
...collectUnknownSidecars(graphicFrame, KNOWN_GRAPHIC_FRAME_CHILDREN, nextId),
|
|
7579
|
-
...collectUnknownSidecars(graphic, KNOWN_GRAPHIC_CHILDREN, nextId),
|
|
7580
|
-
...collectUnknownSidecars(graphicData, EMPTY_KNOWN, nextId)
|
|
7581
|
-
];
|
|
7582
|
-
return {
|
|
7583
|
-
kind: "chart",
|
|
7584
|
-
...nodeId !== void 0 ? { nodeId } : {},
|
|
7585
|
-
...name !== void 0 ? { name } : {},
|
|
7586
|
-
...transform !== void 0 ? { transform } : {},
|
|
7587
|
-
chartRelationshipId: asRelationshipId(rId),
|
|
7588
|
-
handle: {
|
|
7589
|
-
partPath,
|
|
7590
|
-
...nodeId !== void 0 ? { nodeId } : {},
|
|
7591
|
-
relationshipId: asRelationshipId(rId),
|
|
7592
|
-
orderingSlot
|
|
7593
|
-
},
|
|
7594
|
-
...rawSidecars.length > 0 ? { rawSidecars } : {}
|
|
7595
|
-
};
|
|
7596
|
-
}
|
|
7597
|
-
function parseSmartArtGraphicFrame(graphicFrame, partPath, nextId, orderingSlot) {
|
|
7598
|
-
const graphic = getChild(graphicFrame, "graphic");
|
|
7599
|
-
const graphicData = getChild(graphic, "graphicData");
|
|
7600
|
-
const relIds = getChild(graphicData, "relIds");
|
|
7601
|
-
const dmRId = getNamespacedAttr(relIds, "dm") ?? getAttr(relIds, "dm");
|
|
7602
|
-
if (dmRId === void 0) return void 0;
|
|
7603
|
-
const nvGraphicFramePr = getChild(graphicFrame, "nvGraphicFramePr");
|
|
7604
|
-
const cNvPr = getChild(nvGraphicFramePr, "cNvPr");
|
|
7605
|
-
const nodeId = sourceNodeId(cNvPr);
|
|
7606
|
-
const name = getAttr(cNvPr, "name");
|
|
7607
|
-
const transform = parseTransform(graphicFrame);
|
|
7608
|
-
const rawSidecars = [
|
|
7609
|
-
...collectUnknownSidecars(graphicFrame, KNOWN_GRAPHIC_FRAME_CHILDREN, nextId),
|
|
7610
|
-
...collectUnknownSidecars(graphic, KNOWN_GRAPHIC_CHILDREN, nextId),
|
|
7611
|
-
...collectUnknownSidecars(graphicData, EMPTY_KNOWN, nextId)
|
|
7612
|
-
];
|
|
7613
|
-
return {
|
|
7614
|
-
kind: "smartArt",
|
|
7615
|
-
...nodeId !== void 0 ? { nodeId } : {},
|
|
7616
|
-
...name !== void 0 ? { name } : {},
|
|
7617
|
-
...transform !== void 0 ? { transform } : {},
|
|
7618
|
-
dataRelationshipId: asRelationshipId(dmRId),
|
|
7619
|
-
handle: {
|
|
7220
|
+
if (currentGroup !== void 0) groups.push(currentGroup);
|
|
7221
|
+
return groups.map((group, groupIndex) => {
|
|
7222
|
+
const synthetic = {};
|
|
7223
|
+
if (group.pPrIndex >= 0) synthetic.pPr = pPrList[group.pPrIndex];
|
|
7224
|
+
synthetic.r = group.rNodes;
|
|
7225
|
+
synthetic.fld = group.fldNodes;
|
|
7226
|
+
synthetic.br = group.brNodes;
|
|
7227
|
+
if (groupIndex === groups.length - 1 && getChild(p, "endParaRPr") !== void 0) {
|
|
7228
|
+
synthetic.endParaRPr = getChild(p, "endParaRPr");
|
|
7229
|
+
}
|
|
7230
|
+
const paragraph = parseParagraph(
|
|
7231
|
+
synthetic,
|
|
7620
7232
|
partPath,
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
|
|
7625
|
-
|
|
7626
|
-
|
|
7233
|
+
nextId,
|
|
7234
|
+
ownerNodeId,
|
|
7235
|
+
ownerOrderingSlot,
|
|
7236
|
+
paragraphIndex + groupIndex,
|
|
7237
|
+
group.orderedChildren
|
|
7238
|
+
);
|
|
7239
|
+
if (groupIndex < groups.length - 1 && paragraph.runs.length > 0) {
|
|
7240
|
+
const lastRun = paragraph.runs[paragraph.runs.length - 1];
|
|
7241
|
+
if (lastRun.text.endsWith("\n")) {
|
|
7242
|
+
const trimmed = lastRun.text.slice(0, -1);
|
|
7243
|
+
const precedingRuns = paragraph.runs.slice(0, -1);
|
|
7244
|
+
return {
|
|
7245
|
+
...paragraph,
|
|
7246
|
+
runs: trimmed === "" ? precedingRuns : [...precedingRuns, { ...lastRun, text: trimmed }]
|
|
7247
|
+
};
|
|
7248
|
+
}
|
|
7249
|
+
}
|
|
7250
|
+
return paragraph;
|
|
7251
|
+
});
|
|
7627
7252
|
}
|
|
7628
|
-
function
|
|
7629
|
-
|
|
7630
|
-
|
|
7631
|
-
const
|
|
7632
|
-
const
|
|
7633
|
-
const
|
|
7634
|
-
const
|
|
7635
|
-
const
|
|
7636
|
-
const
|
|
7637
|
-
const
|
|
7638
|
-
const
|
|
7639
|
-
const
|
|
7640
|
-
const
|
|
7641
|
-
const
|
|
7642
|
-
|
|
7643
|
-
|
|
7644
|
-
|
|
7645
|
-
...
|
|
7646
|
-
|
|
7647
|
-
|
|
7648
|
-
|
|
7649
|
-
...
|
|
7650
|
-
...
|
|
7651
|
-
...
|
|
7652
|
-
|
|
7653
|
-
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
},
|
|
7657
|
-
|
|
7658
|
-
...rawSidecars.length > 0 ? { rawSidecars } : {}
|
|
7253
|
+
function parseBodyProperties(bodyPr) {
|
|
7254
|
+
if (!bodyPr) return void 0;
|
|
7255
|
+
const marginLeft = numericAttr2(bodyPr, "lIns");
|
|
7256
|
+
const marginRight = numericAttr2(bodyPr, "rIns");
|
|
7257
|
+
const marginTop = numericAttr2(bodyPr, "tIns");
|
|
7258
|
+
const marginBottom = numericAttr2(bodyPr, "bIns");
|
|
7259
|
+
const anchorToken = getAttr(bodyPr, "anchor");
|
|
7260
|
+
const anchor = anchorToken !== void 0 ? ANCHOR_MAP[anchorToken] : void 0;
|
|
7261
|
+
const wrap = parseWrap(getAttr(bodyPr, "wrap"));
|
|
7262
|
+
const vert = parseVerticalType(getAttr(bodyPr, "vert"));
|
|
7263
|
+
const numCol = numericAttr2(bodyPr, "numCol");
|
|
7264
|
+
const normAutofit = getChild(bodyPr, "normAutofit");
|
|
7265
|
+
const hasSpAutofit = getChild(bodyPr, "spAutoFit") !== void 0;
|
|
7266
|
+
const hasNoAutofit = getChild(bodyPr, "noAutofit") !== void 0;
|
|
7267
|
+
const fontScale = numericAttr2(normAutofit, "fontScale");
|
|
7268
|
+
const lnSpcReduction = numericAttr2(normAutofit, "lnSpcReduction");
|
|
7269
|
+
const properties = {
|
|
7270
|
+
...marginLeft !== void 0 ? { marginLeft: emu(marginLeft) } : {},
|
|
7271
|
+
...marginRight !== void 0 ? { marginRight: emu(marginRight) } : {},
|
|
7272
|
+
...marginTop !== void 0 ? { marginTop: emu(marginTop) } : {},
|
|
7273
|
+
...marginBottom !== void 0 ? { marginBottom: emu(marginBottom) } : {},
|
|
7274
|
+
...anchor !== void 0 ? { anchor } : {},
|
|
7275
|
+
...wrap !== void 0 ? { wrap } : {},
|
|
7276
|
+
...normAutofit !== void 0 ? {
|
|
7277
|
+
autoFit: "normAutofit",
|
|
7278
|
+
fontScale: fontScale !== void 0 ? fontScale / 1e5 : 1,
|
|
7279
|
+
lnSpcReduction: lnSpcReduction !== void 0 ? lnSpcReduction / 1e5 : 0
|
|
7280
|
+
} : hasSpAutofit ? { autoFit: "spAutofit", fontScale: 1, lnSpcReduction: 0 } : hasNoAutofit ? { autoFit: "noAutofit", fontScale: 1, lnSpcReduction: 0 } : {},
|
|
7281
|
+
...numCol !== void 0 ? { numCol: Math.max(1, numCol) } : {},
|
|
7282
|
+
...vert !== void 0 ? { vert } : {}
|
|
7659
7283
|
};
|
|
7284
|
+
return Object.keys(properties).length > 0 ? properties : void 0;
|
|
7660
7285
|
}
|
|
7661
|
-
function
|
|
7662
|
-
return
|
|
7286
|
+
function parseWrap(value) {
|
|
7287
|
+
return parseEnumValue(value, WRAP_VALUES);
|
|
7663
7288
|
}
|
|
7664
|
-
function
|
|
7665
|
-
|
|
7666
|
-
return getChildArray(tbl, "tr").map((tr, rowIndex) => ({
|
|
7667
|
-
height: emuAttr(tr, "h"),
|
|
7668
|
-
cells: getChildArray(tr, "tc").map((tc, cellIndex) => {
|
|
7669
|
-
const orderedCells = orderedChildChildrenList(orderedRows[rowIndex], "tc");
|
|
7670
|
-
return parseTableCell(
|
|
7671
|
-
tc,
|
|
7672
|
-
partPath,
|
|
7673
|
-
nextId,
|
|
7674
|
-
tableNodeId,
|
|
7675
|
-
tableOrderingSlot,
|
|
7676
|
-
rowIndex,
|
|
7677
|
-
cellIndex,
|
|
7678
|
-
orderedCells[cellIndex]
|
|
7679
|
-
);
|
|
7680
|
-
})
|
|
7681
|
-
}));
|
|
7289
|
+
function parseVerticalType(value) {
|
|
7290
|
+
return parseEnumValue(value, VERTICAL_VALUES);
|
|
7682
7291
|
}
|
|
7683
|
-
function
|
|
7684
|
-
const
|
|
7685
|
-
const
|
|
7686
|
-
|
|
7687
|
-
getChild(tc, "txBody"),
|
|
7292
|
+
function parseParagraph(p, partPath, nextId, ownerNodeId, ownerOrderingSlot, paragraphIndex, orderedChildren) {
|
|
7293
|
+
const properties = parseParagraphProperties(getChild(p, "pPr"));
|
|
7294
|
+
const runs = parseRunsInOrder(
|
|
7295
|
+
p,
|
|
7688
7296
|
partPath,
|
|
7689
7297
|
nextId,
|
|
7690
|
-
|
|
7691
|
-
|
|
7692
|
-
|
|
7298
|
+
ownerNodeId,
|
|
7299
|
+
ownerOrderingSlot,
|
|
7300
|
+
paragraphIndex,
|
|
7301
|
+
orderedChildren
|
|
7693
7302
|
);
|
|
7694
|
-
const
|
|
7695
|
-
const borders = parseCellBorders(tcPr, nextId);
|
|
7696
|
-
const rawSidecars = [
|
|
7697
|
-
...collectUnknownSidecars(tc, KNOWN_TABLE_CELL_CHILDREN, nextId),
|
|
7698
|
-
...collectUnknownSidecars(tcPr, KNOWN_TABLE_CELL_PROPERTIES_CHILDREN, nextId)
|
|
7699
|
-
];
|
|
7303
|
+
const rawSidecars = collectUnknownSidecars(p, KNOWN_PARAGRAPH_CHILDREN, nextId);
|
|
7700
7304
|
return {
|
|
7701
|
-
|
|
7702
|
-
...
|
|
7703
|
-
|
|
7704
|
-
|
|
7705
|
-
|
|
7706
|
-
|
|
7707
|
-
|
|
7305
|
+
runs,
|
|
7306
|
+
...properties !== void 0 ? { properties } : {},
|
|
7307
|
+
handle: {
|
|
7308
|
+
partPath,
|
|
7309
|
+
nodeId: textNodeId("paragraph", ownerNodeId, ownerOrderingSlot, paragraphIndex),
|
|
7310
|
+
orderingSlot: paragraphIndex
|
|
7311
|
+
},
|
|
7708
7312
|
...rawSidecars.length > 0 ? { rawSidecars } : {}
|
|
7709
7313
|
};
|
|
7710
7314
|
}
|
|
7711
|
-
function
|
|
7712
|
-
const
|
|
7713
|
-
const
|
|
7714
|
-
const
|
|
7715
|
-
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
|
|
7741
|
-
|
|
7742
|
-
|
|
7743
|
-
};
|
|
7744
|
-
}
|
|
7745
|
-
function parseGeometry(spPr, orderedSpPr) {
|
|
7746
|
-
const prstGeom = getChild(spPr, "prstGeom");
|
|
7747
|
-
if (prstGeom) {
|
|
7748
|
-
const preset = getAttr(prstGeom, "prst");
|
|
7749
|
-
const adjustValues = parseAdjustValues(getChild(prstGeom, "avLst"));
|
|
7750
|
-
return preset !== void 0 ? {
|
|
7751
|
-
preset,
|
|
7752
|
-
...Object.keys(adjustValues).length > 0 ? { adjustValues } : {}
|
|
7753
|
-
} : void 0;
|
|
7315
|
+
function parseRunsInOrder(p, partPath, nextId, ownerNodeId, ownerOrderingSlot, paragraphIndex, orderedChildren) {
|
|
7316
|
+
const rList = getChildArray(p, "r");
|
|
7317
|
+
const fldList = getChildArray(p, "fld");
|
|
7318
|
+
const brList = getChildArray(p, "br");
|
|
7319
|
+
if (orderedChildren === void 0) {
|
|
7320
|
+
return [
|
|
7321
|
+
...rList.map(
|
|
7322
|
+
(r, runIndex) => parseRun(r, partPath, nextId, ownerNodeId, ownerOrderingSlot, paragraphIndex, runIndex)
|
|
7323
|
+
),
|
|
7324
|
+
...fldList.map(
|
|
7325
|
+
(fld, index) => parseRun(
|
|
7326
|
+
fld,
|
|
7327
|
+
partPath,
|
|
7328
|
+
nextId,
|
|
7329
|
+
ownerNodeId,
|
|
7330
|
+
ownerOrderingSlot,
|
|
7331
|
+
paragraphIndex,
|
|
7332
|
+
rList.length + index
|
|
7333
|
+
)
|
|
7334
|
+
),
|
|
7335
|
+
...brList.map(
|
|
7336
|
+
(br, index) => parseBreakRun(
|
|
7337
|
+
br,
|
|
7338
|
+
partPath,
|
|
7339
|
+
nextId,
|
|
7340
|
+
ownerNodeId,
|
|
7341
|
+
ownerOrderingSlot,
|
|
7342
|
+
paragraphIndex,
|
|
7343
|
+
rList.length + fldList.length + index
|
|
7344
|
+
)
|
|
7345
|
+
)
|
|
7346
|
+
];
|
|
7754
7347
|
}
|
|
7755
|
-
const
|
|
7756
|
-
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
|
|
7762
|
-
|
|
7763
|
-
|
|
7764
|
-
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
|
|
7348
|
+
const counters = {};
|
|
7349
|
+
const runs = [];
|
|
7350
|
+
for (const child of orderedChildren) {
|
|
7351
|
+
const tag = orderedLocalName(child);
|
|
7352
|
+
if (tag !== "r" && tag !== "fld" && tag !== "br") continue;
|
|
7353
|
+
const index = counters[tag] ?? 0;
|
|
7354
|
+
counters[tag] = index + 1;
|
|
7355
|
+
const runIndex = runs.length;
|
|
7356
|
+
if (tag === "r" && rList[index] !== void 0) {
|
|
7357
|
+
runs.push(
|
|
7358
|
+
parseRun(
|
|
7359
|
+
rList[index],
|
|
7360
|
+
partPath,
|
|
7361
|
+
nextId,
|
|
7362
|
+
ownerNodeId,
|
|
7363
|
+
ownerOrderingSlot,
|
|
7364
|
+
paragraphIndex,
|
|
7365
|
+
runIndex
|
|
7366
|
+
)
|
|
7367
|
+
);
|
|
7368
|
+
} else if (tag === "fld" && fldList[index] !== void 0) {
|
|
7369
|
+
runs.push(
|
|
7370
|
+
parseRun(
|
|
7371
|
+
fldList[index],
|
|
7372
|
+
partPath,
|
|
7373
|
+
nextId,
|
|
7374
|
+
ownerNodeId,
|
|
7375
|
+
ownerOrderingSlot,
|
|
7376
|
+
paragraphIndex,
|
|
7377
|
+
runIndex
|
|
7378
|
+
)
|
|
7379
|
+
);
|
|
7380
|
+
} else if (tag === "br" && brList[index] !== void 0) {
|
|
7381
|
+
runs.push(
|
|
7382
|
+
parseBreakRun(
|
|
7383
|
+
brList[index],
|
|
7384
|
+
partPath,
|
|
7385
|
+
nextId,
|
|
7386
|
+
ownerNodeId,
|
|
7387
|
+
ownerOrderingSlot,
|
|
7388
|
+
paragraphIndex,
|
|
7389
|
+
runIndex
|
|
7390
|
+
)
|
|
7391
|
+
);
|
|
7770
7392
|
}
|
|
7771
7393
|
}
|
|
7772
|
-
return
|
|
7773
|
-
}
|
|
7774
|
-
function parseChildTransform(grpSpPr, fallback) {
|
|
7775
|
-
const xfrm = getChild(grpSpPr, "xfrm");
|
|
7776
|
-
const childOff = getChild(xfrm, "chOff");
|
|
7777
|
-
const childExt = getChild(xfrm, "chExt");
|
|
7778
|
-
const offsetX = numericAttr2(childOff, "x") ?? 0;
|
|
7779
|
-
const offsetY = numericAttr2(childOff, "y") ?? 0;
|
|
7780
|
-
const width = numericAttr2(childExt, "cx") ?? fallback?.width;
|
|
7781
|
-
const height = numericAttr2(childExt, "cy") ?? fallback?.height;
|
|
7782
|
-
if (width === void 0 || height === void 0) return void 0;
|
|
7783
|
-
return {
|
|
7784
|
-
offsetX: asEmu2(offsetX),
|
|
7785
|
-
offsetY: asEmu2(offsetY),
|
|
7786
|
-
width: asEmu2(Number(width)),
|
|
7787
|
-
height: asEmu2(Number(height))
|
|
7788
|
-
};
|
|
7394
|
+
return runs;
|
|
7789
7395
|
}
|
|
7790
|
-
function
|
|
7791
|
-
if (!
|
|
7792
|
-
const
|
|
7793
|
-
const
|
|
7794
|
-
const
|
|
7795
|
-
const
|
|
7796
|
-
const
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
|
|
7396
|
+
function parseParagraphProperties(pPr) {
|
|
7397
|
+
if (!pPr) return void 0;
|
|
7398
|
+
const alignToken = getAttr(pPr, "algn");
|
|
7399
|
+
const align = alignToken !== void 0 ? ALIGN_MAP[alignToken] : void 0;
|
|
7400
|
+
const level = numericAttr2(pPr, "lvl");
|
|
7401
|
+
const lineSpacing = parseSpacing(getChild(pPr, "lnSpc"));
|
|
7402
|
+
const spaceBefore = parseSpacing(getChild(pPr, "spcBef"));
|
|
7403
|
+
const spaceAfter = parseSpacing(getChild(pPr, "spcAft"));
|
|
7404
|
+
const marginLeft = numericAttr2(pPr, "marL");
|
|
7405
|
+
const indent = numericAttr2(pPr, "indent");
|
|
7406
|
+
const bullet = parseBullet(pPr);
|
|
7407
|
+
const bulletFont = getAttr(getChild(pPr, "buFont"), "typeface");
|
|
7408
|
+
const bulletColor = parseColorElement(getChild(pPr, "buClr"));
|
|
7409
|
+
const bulletSizePct = numericAttr2(getChild(pPr, "buSzPct"), "val");
|
|
7410
|
+
const tabStops = parseTabStops(pPr);
|
|
7411
|
+
const defaultRunProperties = parseRunProperties(getChild(pPr, "defRPr"));
|
|
7412
|
+
const properties = {
|
|
7413
|
+
...align !== void 0 ? { align } : {},
|
|
7414
|
+
...level !== void 0 ? { level } : {},
|
|
7415
|
+
...lineSpacing !== void 0 ? { lineSpacing } : {},
|
|
7416
|
+
...spaceBefore !== void 0 ? { spaceBefore } : {},
|
|
7417
|
+
...spaceAfter !== void 0 ? { spaceAfter } : {},
|
|
7418
|
+
...marginLeft !== void 0 ? { marginLeft: emu(marginLeft) } : {},
|
|
7419
|
+
...indent !== void 0 ? { indent: emu(indent) } : {},
|
|
7420
|
+
...bullet !== void 0 ? { bullet } : {},
|
|
7421
|
+
...bulletFont !== void 0 ? { bulletFont } : {},
|
|
7422
|
+
...bulletColor !== void 0 ? { bulletColor } : {},
|
|
7423
|
+
...bulletSizePct !== void 0 ? { bulletSizePct } : {},
|
|
7424
|
+
...tabStops.length > 0 ? { tabStops } : {},
|
|
7425
|
+
...defaultRunProperties !== void 0 ? { defaultRunProperties } : {}
|
|
7801
7426
|
};
|
|
7802
|
-
return Object.keys(
|
|
7803
|
-
}
|
|
7804
|
-
function parseStretch(stretch) {
|
|
7805
|
-
const fillRect = getChild(stretch, "fillRect");
|
|
7806
|
-
if (fillRect === void 0) return void 0;
|
|
7807
|
-
const left = (numericAttr2(fillRect, "l") ?? 0) / 1e5;
|
|
7808
|
-
const top = (numericAttr2(fillRect, "t") ?? 0) / 1e5;
|
|
7809
|
-
const right = (numericAttr2(fillRect, "r") ?? 0) / 1e5;
|
|
7810
|
-
const bottom = (numericAttr2(fillRect, "b") ?? 0) / 1e5;
|
|
7811
|
-
if (left === 0 && top === 0 && right === 0 && bottom === 0) return void 0;
|
|
7812
|
-
return { left, top, right, bottom };
|
|
7813
|
-
}
|
|
7814
|
-
function sourceNodeId(cNvPr) {
|
|
7815
|
-
const id = getAttr(cNvPr, "id");
|
|
7816
|
-
return id !== void 0 ? asSourceNodeId(id) : void 0;
|
|
7427
|
+
return Object.keys(properties).length > 0 ? properties : void 0;
|
|
7817
7428
|
}
|
|
7818
|
-
function
|
|
7819
|
-
return
|
|
7429
|
+
function parseTabStops(pPr) {
|
|
7430
|
+
return getChildArray(getChild(pPr, "tabLst"), "tab").map((tab) => ({
|
|
7431
|
+
position: emu(numericAttr2(tab, "pos") ?? 0),
|
|
7432
|
+
alignment: unsafeOoxmlBoundaryAssertion(getAttr(tab, "algn")) ?? "l"
|
|
7433
|
+
}));
|
|
7820
7434
|
}
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
if (child === void 0) return void 0;
|
|
7828
|
-
const key = Object.keys(child).find((candidate) => candidate !== ":@");
|
|
7829
|
-
const value = key !== void 0 ? child[key] : void 0;
|
|
7830
|
-
return Array.isArray(value) ? value : void 0;
|
|
7435
|
+
function parseSpacing(node) {
|
|
7436
|
+
const points = numericAttr2(getChild(node, "spcPts"), "val");
|
|
7437
|
+
if (points !== void 0) return { type: "pts", value: asHundredthPt2(points) };
|
|
7438
|
+
const percent = numericAttr2(getChild(node, "spcPct"), "val");
|
|
7439
|
+
if (percent !== void 0) return { type: "pct", value: percent };
|
|
7440
|
+
return void 0;
|
|
7831
7441
|
}
|
|
7832
|
-
function
|
|
7833
|
-
if (
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7442
|
+
function parseBullet(pPr) {
|
|
7443
|
+
if (pPr === void 0) return void 0;
|
|
7444
|
+
if (getChild(pPr, "buNone") !== void 0) return { type: "none" };
|
|
7445
|
+
const buChar = getChild(pPr, "buChar");
|
|
7446
|
+
if (buChar !== void 0) {
|
|
7447
|
+
return { type: "char", char: decodeXmlCharRef(getAttr(buChar, "char") ?? "\u2022") };
|
|
7448
|
+
}
|
|
7449
|
+
const buAutoNum = getChild(pPr, "buAutoNum");
|
|
7450
|
+
if (buAutoNum !== void 0) {
|
|
7451
|
+
const scheme = getAttr(buAutoNum, "type") ?? "arabicPeriod";
|
|
7452
|
+
return {
|
|
7453
|
+
type: "autoNum",
|
|
7454
|
+
scheme: parseEnumValueWithDefault(scheme, VALID_AUTO_NUM_SCHEMES, "arabicPeriod"),
|
|
7455
|
+
startAt: numericAttr2(buAutoNum, "startAt") ?? 1
|
|
7456
|
+
};
|
|
7457
|
+
}
|
|
7458
|
+
return void 0;
|
|
7842
7459
|
}
|
|
7843
|
-
function
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
Array.isArray(parentChildren) ? parentChildren : void 0,
|
|
7848
|
-
childLocalName
|
|
7460
|
+
function decodeXmlCharRef(value) {
|
|
7461
|
+
return value.replace(
|
|
7462
|
+
/&#x([0-9a-fA-F]+);|&#([0-9]+);/g,
|
|
7463
|
+
(_match, hex, decimal) => String.fromCodePoint(parseInt(hex ?? decimal ?? "0", hex !== void 0 ? 16 : 10))
|
|
7849
7464
|
);
|
|
7850
7465
|
}
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
if (value !== void 0 && value.trim() === "") {
|
|
7877
|
-
throw new Error("updateTextRunProperties: typeface must be a non-empty string");
|
|
7466
|
+
function parseRun(r, partPath, nextId, ownerNodeId, ownerOrderingSlot, paragraphIndex, runIndex) {
|
|
7467
|
+
const properties = parseRunProperties(getChild(r, "rPr"));
|
|
7468
|
+
const rawSidecars = collectRunSidecars(r, nextId);
|
|
7469
|
+
return {
|
|
7470
|
+
kind: "textRun",
|
|
7471
|
+
text: decodeXmlCharRef(getChildText(r, "t") ?? ""),
|
|
7472
|
+
...properties !== void 0 ? { properties } : {},
|
|
7473
|
+
handle: {
|
|
7474
|
+
partPath,
|
|
7475
|
+
nodeId: textNodeId("run", ownerNodeId, ownerOrderingSlot, paragraphIndex, runIndex),
|
|
7476
|
+
orderingSlot: runIndex
|
|
7477
|
+
},
|
|
7478
|
+
...rawSidecars.length > 0 ? { rawSidecars } : {}
|
|
7479
|
+
};
|
|
7480
|
+
}
|
|
7481
|
+
function parseBreakRun(br, partPath, nextId, ownerNodeId, ownerOrderingSlot, paragraphIndex, runIndex) {
|
|
7482
|
+
const properties = parseRunProperties(getChild(br, "rPr"));
|
|
7483
|
+
return {
|
|
7484
|
+
kind: "textRun",
|
|
7485
|
+
text: "\n",
|
|
7486
|
+
...properties !== void 0 ? { properties } : {},
|
|
7487
|
+
handle: {
|
|
7488
|
+
partPath,
|
|
7489
|
+
nodeId: textNodeId("run", ownerNodeId, ownerOrderingSlot, paragraphIndex, runIndex),
|
|
7490
|
+
orderingSlot: runIndex
|
|
7878
7491
|
}
|
|
7879
|
-
}
|
|
7880
|
-
};
|
|
7881
|
-
var EDITABLE_TEXT_RUN_PROPERTIES = Object.keys(EDITABLE_TEXT_RUN_PROPERTY_VALIDATORS).filter(
|
|
7882
|
-
(property) => property in EDITABLE_TEXT_RUN_PROPERTY_VALIDATORS
|
|
7883
|
-
);
|
|
7884
|
-
var EDITABLE_TEXT_RUN_PROPERTY_SET = new Set(EDITABLE_TEXT_RUN_PROPERTIES);
|
|
7885
|
-
function requireBooleanOrUndefined(value, fieldName) {
|
|
7886
|
-
if (value !== void 0 && typeof value !== "boolean") {
|
|
7887
|
-
throw new Error(`updateTextRunProperties: ${fieldName} must be a boolean value`);
|
|
7888
|
-
}
|
|
7492
|
+
};
|
|
7889
7493
|
}
|
|
7890
|
-
function
|
|
7891
|
-
|
|
7494
|
+
function parseRunProperties(rPr) {
|
|
7495
|
+
if (!rPr) return void 0;
|
|
7496
|
+
const bold = getAttr(rPr, "b");
|
|
7497
|
+
const italic = getAttr(rPr, "i");
|
|
7498
|
+
const underline = getAttr(rPr, "u");
|
|
7499
|
+
const strike = getAttr(rPr, "strike");
|
|
7500
|
+
const baseline = numericAttr2(rPr, "baseline");
|
|
7501
|
+
const size = numericAttr2(rPr, "sz");
|
|
7502
|
+
const typeface = getAttr(getChild(rPr, "latin"), "typeface");
|
|
7503
|
+
const typefaceEa = getAttr(getChild(rPr, "ea"), "typeface");
|
|
7504
|
+
const typefaceCs = getAttr(getChild(rPr, "cs"), "typeface");
|
|
7505
|
+
const hasHyperlink = getChild(rPr, "hlinkClick") !== void 0;
|
|
7506
|
+
const color = parseColorElement(getChild(rPr, "solidFill"));
|
|
7507
|
+
const properties = {
|
|
7508
|
+
...bold !== void 0 ? { bold: isTrue(bold) } : {},
|
|
7509
|
+
...italic !== void 0 ? { italic: isTrue(italic) } : {},
|
|
7510
|
+
...underline !== void 0 ? { underline: underline !== "none" } : hasHyperlink ? { underline: true } : {},
|
|
7511
|
+
...strike !== void 0 ? { strikethrough: strike !== "noStrike" } : {},
|
|
7512
|
+
...baseline !== void 0 ? { baseline: baseline / 1e3 } : {},
|
|
7513
|
+
// `a:rPr@sz` is in 1/100 pt unit. Convert to pt and save.
|
|
7514
|
+
...size !== void 0 ? { fontSize: asPt(size / 100) } : {},
|
|
7515
|
+
...typeface !== void 0 ? { typeface } : {},
|
|
7516
|
+
...typefaceEa !== void 0 ? { typefaceEa } : {},
|
|
7517
|
+
...typefaceCs !== void 0 ? { typefaceCs } : {},
|
|
7518
|
+
...color !== void 0 ? { color } : hasHyperlink ? { color: { kind: "scheme", scheme: "hlink" } } : {}
|
|
7519
|
+
};
|
|
7520
|
+
return Object.keys(properties).length > 0 ? properties : void 0;
|
|
7892
7521
|
}
|
|
7893
|
-
function
|
|
7894
|
-
|
|
7522
|
+
function collectRunSidecars(r, nextId) {
|
|
7523
|
+
const runLevel = collectUnknownSidecars(r, KNOWN_RUN_CHILDREN, nextId);
|
|
7524
|
+
const propLevel = collectUnknownSidecars(getChild(r, "rPr"), KNOWN_RUN_PROPERTY_CHILDREN, nextId);
|
|
7525
|
+
return [...runLevel, ...propLevel];
|
|
7895
7526
|
}
|
|
7896
|
-
function
|
|
7897
|
-
return
|
|
7527
|
+
function emu(value) {
|
|
7528
|
+
return asEmu2(value);
|
|
7898
7529
|
}
|
|
7899
|
-
function
|
|
7900
|
-
|
|
7530
|
+
function textNodeId(kind, ownerNodeId, ownerOrderingSlot, paragraphIndex, runIndex) {
|
|
7531
|
+
const owner = ownerNodeId !== void 0 ? `shape:${ownerNodeId}` : `shapeSlot:${ownerOrderingSlot}`;
|
|
7532
|
+
const suffix = kind === "paragraph" ? `p:${paragraphIndex}` : `p:${paragraphIndex}:r:${runIndex}`;
|
|
7533
|
+
return asSourceNodeId(`text:${owner}:${suffix}`);
|
|
7901
7534
|
}
|
|
7902
|
-
function
|
|
7903
|
-
return
|
|
7535
|
+
function orderedKey(node) {
|
|
7536
|
+
return Object.keys(node).find((key) => key !== ":@");
|
|
7904
7537
|
}
|
|
7905
|
-
|
|
7906
|
-
|
|
7907
|
-
|
|
7908
|
-
|
|
7909
|
-
|
|
7910
|
-
|
|
7911
|
-
|
|
7912
|
-
|
|
7913
|
-
|
|
7914
|
-
"
|
|
7538
|
+
function orderedLocalName(node) {
|
|
7539
|
+
const key = orderedKey(node);
|
|
7540
|
+
return key !== void 0 ? localName(key) : void 0;
|
|
7541
|
+
}
|
|
7542
|
+
var KNOWN_SHAPE_CHILDREN = /* @__PURE__ */ new Set(["nvSpPr", "spPr", "style", "txBody"]);
|
|
7543
|
+
var KNOWN_CONNECTOR_CHILDREN = /* @__PURE__ */ new Set(["nvCxnSpPr", "spPr", "style"]);
|
|
7544
|
+
var KNOWN_GROUP_CHILDREN = /* @__PURE__ */ new Set(["nvGrpSpPr", "grpSpPr"]);
|
|
7545
|
+
var KNOWN_PICTURE_CHILDREN = /* @__PURE__ */ new Set(["nvPicPr", "blipFill", "spPr"]);
|
|
7546
|
+
var KNOWN_BLIP_FILL_CHILDREN = /* @__PURE__ */ new Set([
|
|
7547
|
+
"blip",
|
|
7548
|
+
"srcRect",
|
|
7549
|
+
"stretch",
|
|
7550
|
+
"tile"
|
|
7551
|
+
]);
|
|
7552
|
+
var KNOWN_BLIP_CHILDREN = /* @__PURE__ */ new Set([
|
|
7553
|
+
"grayscl",
|
|
7554
|
+
"biLevel",
|
|
7555
|
+
"blur",
|
|
7556
|
+
"lum",
|
|
7557
|
+
"duotone",
|
|
7558
|
+
"clrChange"
|
|
7559
|
+
]);
|
|
7560
|
+
var KNOWN_EFFECT_CHILDREN = /* @__PURE__ */ new Set([
|
|
7561
|
+
"outerShdw",
|
|
7562
|
+
"innerShdw",
|
|
7563
|
+
"glow",
|
|
7564
|
+
"softEdge"
|
|
7565
|
+
]);
|
|
7566
|
+
var KNOWN_GRAPHIC_FRAME_CHILDREN = /* @__PURE__ */ new Set([
|
|
7567
|
+
"nvGraphicFramePr",
|
|
7568
|
+
"xfrm",
|
|
7569
|
+
"graphic"
|
|
7570
|
+
]);
|
|
7571
|
+
var KNOWN_GRAPHIC_CHILDREN = /* @__PURE__ */ new Set(["graphicData"]);
|
|
7572
|
+
var KNOWN_GRAPHIC_DATA_CHILDREN = /* @__PURE__ */ new Set(["tbl"]);
|
|
7573
|
+
var KNOWN_TABLE_CHILDREN = /* @__PURE__ */ new Set(["tblPr", "tblGrid", "tr"]);
|
|
7574
|
+
var KNOWN_TABLE_CELL_CHILDREN = /* @__PURE__ */ new Set(["txBody", "tcPr"]);
|
|
7575
|
+
var KNOWN_TABLE_CELL_PROPERTIES_CHILDREN = /* @__PURE__ */ new Set([
|
|
7576
|
+
"lnL",
|
|
7577
|
+
"lnR",
|
|
7578
|
+
"lnT",
|
|
7579
|
+
"lnB",
|
|
7580
|
+
"solidFill",
|
|
7581
|
+
"noFill",
|
|
7582
|
+
"gradFill",
|
|
7583
|
+
"blipFill",
|
|
7584
|
+
"pattFill",
|
|
7585
|
+
"grpFill"
|
|
7586
|
+
]);
|
|
7587
|
+
var KNOWN_SP_PR_CHILDREN = /* @__PURE__ */ new Set([
|
|
7588
|
+
"xfrm",
|
|
7589
|
+
"prstGeom",
|
|
7590
|
+
"solidFill",
|
|
7591
|
+
"noFill",
|
|
7592
|
+
"gradFill",
|
|
7593
|
+
"blipFill",
|
|
7594
|
+
"pattFill",
|
|
7595
|
+
"grpFill",
|
|
7596
|
+
"ln",
|
|
7597
|
+
"effectLst"
|
|
7915
7598
|
]);
|
|
7916
|
-
var
|
|
7917
|
-
"
|
|
7918
|
-
"
|
|
7919
|
-
"
|
|
7920
|
-
"
|
|
7921
|
-
"
|
|
7599
|
+
var SHAPE_TREE_NODE_TAGS = /* @__PURE__ */ new Set([
|
|
7600
|
+
"sp",
|
|
7601
|
+
"pic",
|
|
7602
|
+
"cxnSp",
|
|
7603
|
+
"grpSp",
|
|
7604
|
+
"graphicFrame"
|
|
7922
7605
|
]);
|
|
7923
|
-
var
|
|
7924
|
-
|
|
7925
|
-
|
|
7926
|
-
|
|
7927
|
-
|
|
7928
|
-
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
|
|
7933
|
-
|
|
7934
|
-
|
|
7935
|
-
if (!parent) return void 0;
|
|
7936
|
-
const srgb = getChild(parent, "srgbClr");
|
|
7937
|
-
if (srgb) {
|
|
7938
|
-
const hex = getAttr(srgb, "val");
|
|
7939
|
-
if (hex !== void 0) {
|
|
7940
|
-
return withTransforms({ kind: "srgb", hex: hex.toUpperCase() }, srgb);
|
|
7941
|
-
}
|
|
7606
|
+
var CHART_GRAPHIC_DATA_URIS = /* @__PURE__ */ new Set([
|
|
7607
|
+
"http://schemas.openxmlformats.org/drawingml/2006/chart",
|
|
7608
|
+
"http://purl.oclc.org/ooxml/drawingml/chart"
|
|
7609
|
+
]);
|
|
7610
|
+
var SMARTART_DIAGRAM_URIS = /* @__PURE__ */ new Set([
|
|
7611
|
+
"http://schemas.openxmlformats.org/drawingml/2006/diagram",
|
|
7612
|
+
"http://purl.oclc.org/ooxml/drawingml/diagram"
|
|
7613
|
+
]);
|
|
7614
|
+
function parseShapeTree(spTree, partPath, nextId, orderedChildren) {
|
|
7615
|
+
if (!spTree) return [];
|
|
7616
|
+
if (orderedChildren !== void 0) {
|
|
7617
|
+
return parseShapeTreeOrdered(spTree, partPath, nextId, orderedChildren);
|
|
7942
7618
|
}
|
|
7943
|
-
const
|
|
7944
|
-
|
|
7945
|
-
|
|
7946
|
-
if (
|
|
7947
|
-
|
|
7619
|
+
const nodes = [];
|
|
7620
|
+
let orderingSlot = 0;
|
|
7621
|
+
for (const key of Object.keys(spTree)) {
|
|
7622
|
+
if (key.startsWith("@_")) continue;
|
|
7623
|
+
if (key === "#text") continue;
|
|
7624
|
+
const local = localName(key);
|
|
7625
|
+
if (local === "nvGrpSpPr" || local === "grpSpPr") continue;
|
|
7626
|
+
const value = spTree[key];
|
|
7627
|
+
const items = Array.isArray(value) ? value : [value];
|
|
7628
|
+
for (const item of items) {
|
|
7629
|
+
const node = unsafeOoxmlBoundaryAssertion(item);
|
|
7630
|
+
if (local === "sp") {
|
|
7631
|
+
nodes.push(parseShape(node, partPath, nextId, orderingSlot));
|
|
7632
|
+
} else if (local === "pic") {
|
|
7633
|
+
nodes.push(parseImage(node, partPath, nextId, orderingSlot));
|
|
7634
|
+
} else if (local === "cxnSp") {
|
|
7635
|
+
nodes.push(parseConnector(node, partPath, nextId, orderingSlot));
|
|
7636
|
+
} else if (local === "grpSp") {
|
|
7637
|
+
nodes.push(parseGroup(node, partPath, nextId, orderingSlot));
|
|
7638
|
+
} else if (local === "graphicFrame") {
|
|
7639
|
+
nodes.push(parseGraphicFrame(node, partPath, nextId, orderingSlot));
|
|
7640
|
+
} else if (local === "AlternateContent") {
|
|
7641
|
+
const parsed = parseAlternateContent(node, partPath, nextId, orderingSlot);
|
|
7642
|
+
nodes.push(...parsed);
|
|
7643
|
+
} else {
|
|
7644
|
+
nodes.push(parseRawShapeNode(key, node, partPath, nextId, orderingSlot));
|
|
7645
|
+
}
|
|
7646
|
+
orderingSlot++;
|
|
7948
7647
|
}
|
|
7949
7648
|
}
|
|
7950
|
-
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
|
|
7962
|
-
|
|
7649
|
+
return nodes;
|
|
7650
|
+
}
|
|
7651
|
+
function parseShapeTreeOrdered(spTree, partPath, nextId, orderedChildren) {
|
|
7652
|
+
const nodes = [];
|
|
7653
|
+
const tagCounters = {};
|
|
7654
|
+
let orderingSlot = 0;
|
|
7655
|
+
for (const child of orderedChildren) {
|
|
7656
|
+
const key = Object.keys(child).find((candidate) => candidate !== ":@");
|
|
7657
|
+
if (key === void 0) continue;
|
|
7658
|
+
const local = localName(key);
|
|
7659
|
+
if (local === "AlternateContent") {
|
|
7660
|
+
const index2 = tagCounters[local] ?? 0;
|
|
7661
|
+
tagCounters[local] = index2 + 1;
|
|
7662
|
+
const alternateContents = getChildArray(spTree, "AlternateContent");
|
|
7663
|
+
const alternateContent = alternateContents[index2];
|
|
7664
|
+
if (alternateContent !== void 0) {
|
|
7665
|
+
nodes.push(...parseAlternateContent(alternateContent, partPath, nextId, orderingSlot));
|
|
7666
|
+
orderingSlot++;
|
|
7667
|
+
}
|
|
7668
|
+
continue;
|
|
7963
7669
|
}
|
|
7670
|
+
if (!SHAPE_TREE_NODE_TAGS.has(local)) continue;
|
|
7671
|
+
const index = tagCounters[local] ?? 0;
|
|
7672
|
+
tagCounters[local] = index + 1;
|
|
7673
|
+
const node = getChildArray(spTree, local)[index];
|
|
7674
|
+
if (node === void 0) continue;
|
|
7675
|
+
nodes.push(parseShapeTreeNode(local, node, child, partPath, nextId, orderingSlot));
|
|
7676
|
+
orderingSlot++;
|
|
7964
7677
|
}
|
|
7965
|
-
return
|
|
7966
|
-
}
|
|
7967
|
-
function parseEffectList(effectList) {
|
|
7968
|
-
if (effectList === void 0) return void 0;
|
|
7969
|
-
const outerShadow = parseOuterShadow(getChild(effectList, "outerShdw"));
|
|
7970
|
-
const innerShadow = parseInnerShadow(getChild(effectList, "innerShdw"));
|
|
7971
|
-
const glow = parseGlow(getChild(effectList, "glow"));
|
|
7972
|
-
const softEdge = parseSoftEdge(getChild(effectList, "softEdge"));
|
|
7973
|
-
const parsed = {
|
|
7974
|
-
...outerShadow !== void 0 ? { outerShadow } : {},
|
|
7975
|
-
...innerShadow !== void 0 ? { innerShadow } : {},
|
|
7976
|
-
...glow !== void 0 ? { glow } : {},
|
|
7977
|
-
...softEdge !== void 0 ? { softEdge } : {}
|
|
7978
|
-
};
|
|
7979
|
-
return Object.keys(parsed).length > 0 ? parsed : void 0;
|
|
7678
|
+
return nodes;
|
|
7980
7679
|
}
|
|
7981
|
-
function
|
|
7982
|
-
if (
|
|
7983
|
-
|
|
7984
|
-
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
|
|
7991
|
-
|
|
7992
|
-
|
|
7993
|
-
|
|
7994
|
-
|
|
7995
|
-
...clrChange !== void 0 ? { clrChange } : {}
|
|
7996
|
-
};
|
|
7997
|
-
return grayscale || biLevel !== void 0 || blur !== void 0 || lum !== void 0 || duotone !== void 0 || clrChange !== void 0 ? parsed : void 0;
|
|
7680
|
+
function parseShapeTreeNode(local, node, orderedNode, partPath, nextId, orderingSlot) {
|
|
7681
|
+
if (local === "sp") return parseShape(node, partPath, nextId, orderingSlot, orderedNode);
|
|
7682
|
+
if (local === "pic") return parseImage(node, partPath, nextId, orderingSlot);
|
|
7683
|
+
if (local === "cxnSp") {
|
|
7684
|
+
return parseConnector(node, partPath, nextId, orderingSlot, orderedNode);
|
|
7685
|
+
}
|
|
7686
|
+
if (local === "grpSp") {
|
|
7687
|
+
const orderedGroupChildren = unsafeOoxmlBoundaryAssertion(orderedNode?.[local]);
|
|
7688
|
+
return parseGroup(node, partPath, nextId, orderingSlot, orderedGroupChildren);
|
|
7689
|
+
}
|
|
7690
|
+
if (local === "graphicFrame") {
|
|
7691
|
+
return parseGraphicFrame(node, partPath, nextId, orderingSlot, orderedNode);
|
|
7692
|
+
}
|
|
7693
|
+
return parseRawShapeNode(`p:${local}`, node, partPath, nextId, orderingSlot);
|
|
7998
7694
|
}
|
|
7999
|
-
function
|
|
8000
|
-
|
|
8001
|
-
const
|
|
8002
|
-
|
|
7695
|
+
function parseShape(sp, partPath, nextId, orderingSlot, orderedNode) {
|
|
7696
|
+
const nvSpPr = getChild(sp, "nvSpPr");
|
|
7697
|
+
const cNvPr = getChild(nvSpPr, "cNvPr");
|
|
7698
|
+
const nodeId = sourceNodeId(cNvPr);
|
|
7699
|
+
const name = getAttr(cNvPr, "name");
|
|
7700
|
+
const placeholder = parsePlaceholder(getChild(getChild(nvSpPr, "nvPr"), "ph"));
|
|
7701
|
+
const spPr = getChild(sp, "spPr");
|
|
7702
|
+
const transform = parseTransform(spPr);
|
|
7703
|
+
const geometry = parseGeometry(spPr, orderedNestedChildChildren(orderedNode, "sp", "spPr"));
|
|
7704
|
+
const fill = parseFill(spPr, nextId);
|
|
7705
|
+
const outline = parseOutline(spPr, nextId);
|
|
7706
|
+
const effects = parseEffectList(getChild(spPr, "effectLst"));
|
|
7707
|
+
const style = parseShapeStyle(getChild(sp, "style"));
|
|
7708
|
+
const textBody = parseTextBody(
|
|
7709
|
+
getChild(sp, "txBody"),
|
|
7710
|
+
partPath,
|
|
7711
|
+
nextId,
|
|
7712
|
+
nodeId,
|
|
7713
|
+
orderingSlot,
|
|
7714
|
+
orderedNestedChildChildren(orderedNode, "sp", "txBody")
|
|
7715
|
+
);
|
|
7716
|
+
const rawSidecars = [
|
|
7717
|
+
...collectUnknownSidecars(sp, KNOWN_SHAPE_CHILDREN, nextId),
|
|
7718
|
+
...collectUnknownSidecars(spPr, KNOWN_SP_PR_CHILDREN, nextId),
|
|
7719
|
+
...collectEffectSidecars(spPr, effects, nextId)
|
|
7720
|
+
];
|
|
8003
7721
|
return {
|
|
8004
|
-
|
|
8005
|
-
|
|
8006
|
-
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
7722
|
+
kind: "shape",
|
|
7723
|
+
...nodeId !== void 0 ? { nodeId } : {},
|
|
7724
|
+
...name !== void 0 ? { name } : {},
|
|
7725
|
+
...transform !== void 0 ? { transform } : {},
|
|
7726
|
+
...geometry !== void 0 ? { geometry } : {},
|
|
7727
|
+
...fill !== void 0 ? { fill } : {},
|
|
7728
|
+
...outline !== void 0 ? { outline } : {},
|
|
7729
|
+
...effects !== void 0 ? { effects } : {},
|
|
7730
|
+
...style !== void 0 ? { style } : {},
|
|
7731
|
+
...textBody !== void 0 ? { textBody } : {},
|
|
7732
|
+
...placeholder !== void 0 ? { placeholder } : {},
|
|
7733
|
+
handle: { partPath, ...nodeId !== void 0 ? { nodeId } : {}, orderingSlot },
|
|
7734
|
+
...rawSidecars.length > 0 ? { rawSidecars } : {}
|
|
8010
7735
|
};
|
|
8011
7736
|
}
|
|
8012
|
-
function
|
|
8013
|
-
|
|
8014
|
-
const
|
|
8015
|
-
|
|
7737
|
+
function parseConnector(cxnSp, partPath, nextId, orderingSlot, orderedNode) {
|
|
7738
|
+
const nvCxnSpPr = getChild(cxnSp, "nvCxnSpPr");
|
|
7739
|
+
const cNvPr = getChild(nvCxnSpPr, "cNvPr");
|
|
7740
|
+
const cNvCxnSpPr = getChild(nvCxnSpPr, "cNvCxnSpPr");
|
|
7741
|
+
const nodeId = sourceNodeId(cNvPr);
|
|
7742
|
+
const name = getAttr(cNvPr, "name");
|
|
7743
|
+
const connection = parseConnectorConnection(cNvCxnSpPr);
|
|
7744
|
+
const spPr = getChild(cxnSp, "spPr");
|
|
7745
|
+
const transform = parseTransform(spPr);
|
|
7746
|
+
const geometry = parseGeometry(spPr, orderedNestedChildChildren(orderedNode, "cxnSp", "spPr"));
|
|
7747
|
+
const outline = parseOutline(spPr, nextId);
|
|
7748
|
+
const effects = parseEffectList(getChild(spPr, "effectLst"));
|
|
7749
|
+
const style = parseShapeStyle(getChild(cxnSp, "style"));
|
|
7750
|
+
const rawSidecars = [
|
|
7751
|
+
...collectUnknownSidecars(cxnSp, KNOWN_CONNECTOR_CHILDREN, nextId),
|
|
7752
|
+
...collectUnknownSidecars(spPr, KNOWN_SP_PR_CHILDREN, nextId),
|
|
7753
|
+
...collectEffectSidecars(spPr, effects, nextId)
|
|
7754
|
+
];
|
|
8016
7755
|
return {
|
|
8017
|
-
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
|
-
|
|
7756
|
+
kind: "connector",
|
|
7757
|
+
...nodeId !== void 0 ? { nodeId } : {},
|
|
7758
|
+
...name !== void 0 ? { name } : {},
|
|
7759
|
+
...connection !== void 0 ? { connection } : {},
|
|
7760
|
+
...transform !== void 0 ? { transform } : {},
|
|
7761
|
+
...geometry !== void 0 ? { geometry } : {},
|
|
7762
|
+
...outline !== void 0 ? { outline } : {},
|
|
7763
|
+
...effects !== void 0 ? { effects } : {},
|
|
7764
|
+
...style !== void 0 ? { style } : {},
|
|
7765
|
+
handle: { partPath, ...nodeId !== void 0 ? { nodeId } : {}, orderingSlot },
|
|
7766
|
+
...rawSidecars.length > 0 ? { rawSidecars } : {}
|
|
8021
7767
|
};
|
|
8022
7768
|
}
|
|
8023
|
-
function
|
|
8024
|
-
|
|
8025
|
-
const
|
|
8026
|
-
|
|
7769
|
+
function parseConnectorConnection(cNvCxnSpPr) {
|
|
7770
|
+
const start = parseConnectorConnectionEndpoint(getChild(cNvCxnSpPr, "stCxn"));
|
|
7771
|
+
const end = parseConnectorConnectionEndpoint(getChild(cNvCxnSpPr, "endCxn"));
|
|
7772
|
+
return start !== void 0 || end !== void 0 ? {
|
|
7773
|
+
...start !== void 0 ? { start } : {},
|
|
7774
|
+
...end !== void 0 ? { end } : {}
|
|
7775
|
+
} : void 0;
|
|
7776
|
+
}
|
|
7777
|
+
function parseConnectorConnectionEndpoint(node) {
|
|
7778
|
+
const shapeId = getAttr(node, "id");
|
|
7779
|
+
const connectionSiteIndex = numericAttr2(node, "idx");
|
|
7780
|
+
if (shapeId === void 0 || connectionSiteIndex === void 0) return void 0;
|
|
8027
7781
|
return {
|
|
8028
|
-
|
|
8029
|
-
|
|
7782
|
+
shapeId: asSourceNodeId(shapeId),
|
|
7783
|
+
connectionSiteIndex
|
|
8030
7784
|
};
|
|
8031
7785
|
}
|
|
8032
|
-
function
|
|
8033
|
-
if (
|
|
8034
|
-
|
|
8035
|
-
|
|
7786
|
+
function parseShapeStyle(style) {
|
|
7787
|
+
if (style === void 0) return void 0;
|
|
7788
|
+
const fillRef = parseStyleReference(getChild(style, "fillRef"));
|
|
7789
|
+
const lineRef = parseStyleReference(getChild(style, "lnRef"));
|
|
7790
|
+
const effectRef = parseStyleReference(getChild(style, "effectRef"));
|
|
7791
|
+
const parsed = {
|
|
7792
|
+
...fillRef !== void 0 ? { fillRef } : {},
|
|
7793
|
+
...lineRef !== void 0 ? { lineRef } : {},
|
|
7794
|
+
...effectRef !== void 0 ? { effectRef } : {}
|
|
8036
7795
|
};
|
|
7796
|
+
return Object.keys(parsed).length > 0 ? parsed : void 0;
|
|
8037
7797
|
}
|
|
8038
|
-
function
|
|
8039
|
-
if (
|
|
7798
|
+
function parseStyleReference(ref) {
|
|
7799
|
+
if (ref === void 0) return void 0;
|
|
7800
|
+
const index = numericAttr2(ref, "idx") ?? 0;
|
|
7801
|
+
const color = parseColorElement(ref);
|
|
8040
7802
|
return {
|
|
8041
|
-
|
|
7803
|
+
index,
|
|
7804
|
+
...color !== void 0 ? { color } : {}
|
|
8042
7805
|
};
|
|
8043
7806
|
}
|
|
8044
|
-
function
|
|
8045
|
-
|
|
7807
|
+
function parseGroup(grpSp, partPath, nextId, orderingSlot, orderedChildren) {
|
|
7808
|
+
const nvGrpSpPr = getChild(grpSp, "nvGrpSpPr");
|
|
7809
|
+
const cNvPr = getChild(nvGrpSpPr, "cNvPr");
|
|
7810
|
+
const nodeId = sourceNodeId(cNvPr);
|
|
7811
|
+
const name = getAttr(cNvPr, "name");
|
|
7812
|
+
const grpSpPr = getChild(grpSp, "grpSpPr");
|
|
7813
|
+
const transform = parseTransform(grpSpPr);
|
|
7814
|
+
const childTransform = parseChildTransform(grpSpPr, transform);
|
|
7815
|
+
const fill = parseFill(grpSpPr, nextId);
|
|
7816
|
+
const effects = parseEffectList(getChild(grpSpPr, "effectLst"));
|
|
7817
|
+
const rawSidecars = [
|
|
7818
|
+
...collectUnknownSidecars(grpSp, KNOWN_GROUP_CHILDREN, nextId),
|
|
7819
|
+
...collectUnknownSidecars(grpSpPr, KNOWN_SP_PR_CHILDREN, nextId),
|
|
7820
|
+
...collectEffectSidecars(grpSpPr, effects, nextId)
|
|
7821
|
+
];
|
|
8046
7822
|
return {
|
|
8047
|
-
|
|
8048
|
-
|
|
7823
|
+
kind: "group",
|
|
7824
|
+
...nodeId !== void 0 ? { nodeId } : {},
|
|
7825
|
+
...name !== void 0 ? { name } : {},
|
|
7826
|
+
...transform !== void 0 ? { transform } : {},
|
|
7827
|
+
...childTransform !== void 0 ? { childTransform } : {},
|
|
7828
|
+
...fill !== void 0 ? { fill } : {},
|
|
7829
|
+
...effects !== void 0 ? { effects } : {},
|
|
7830
|
+
children: parseShapeTree(grpSp, partPath, nextId, orderedChildren),
|
|
7831
|
+
handle: { partPath, ...nodeId !== void 0 ? { nodeId } : {}, orderingSlot },
|
|
7832
|
+
...rawSidecars.length > 0 ? { rawSidecars } : {}
|
|
8049
7833
|
};
|
|
8050
7834
|
}
|
|
8051
|
-
function
|
|
8052
|
-
|
|
7835
|
+
function parseImage(pic, partPath, nextId, orderingSlot) {
|
|
7836
|
+
const cNvPr = getChild(getChild(pic, "nvPicPr"), "cNvPr");
|
|
7837
|
+
const nodeId = sourceNodeId(cNvPr);
|
|
7838
|
+
const name = getAttr(cNvPr, "name");
|
|
7839
|
+
const blipFill = getChild(pic, "blipFill");
|
|
7840
|
+
const blip = getChild(blipFill, "blip");
|
|
7841
|
+
const embed = getNamespacedAttr(blip, "embed");
|
|
7842
|
+
const crop = parseCrop(getChild(blipFill, "srcRect"));
|
|
7843
|
+
const stretch = parseStretch(getChild(blipFill, "stretch"));
|
|
7844
|
+
const tile = parseImageFillTile(getChild(blipFill, "tile"));
|
|
7845
|
+
const blipEffects = parseBlipEffects(blip);
|
|
7846
|
+
const spPr = getChild(pic, "spPr");
|
|
7847
|
+
const transform = parseTransform(spPr);
|
|
7848
|
+
const effects = parseEffectList(getChild(spPr, "effectLst"));
|
|
7849
|
+
const rawSidecars = [
|
|
7850
|
+
...collectUnknownSidecars(pic, KNOWN_PICTURE_CHILDREN, nextId),
|
|
7851
|
+
...collectUnknownSidecars(spPr, KNOWN_SP_PR_CHILDREN, nextId),
|
|
7852
|
+
...collectEffectSidecars(spPr, effects, nextId),
|
|
7853
|
+
// Retains fill mode such as `a:stretch` / `a:tile` and recolor operation under blip.
|
|
7854
|
+
...collectUnknownSidecars(blipFill, KNOWN_BLIP_FILL_CHILDREN, nextId),
|
|
7855
|
+
...collectBlipEffectSidecars(blip, blipEffects, nextId)
|
|
7856
|
+
];
|
|
8053
7857
|
return {
|
|
8054
|
-
|
|
8055
|
-
|
|
7858
|
+
kind: "image",
|
|
7859
|
+
...nodeId !== void 0 ? { nodeId } : {},
|
|
7860
|
+
...name !== void 0 ? { name } : {},
|
|
7861
|
+
...transform !== void 0 ? { transform } : {},
|
|
7862
|
+
...embed !== void 0 ? { blipRelationshipId: asRelationshipId(embed) } : {},
|
|
7863
|
+
...crop !== void 0 ? { crop } : {},
|
|
7864
|
+
...stretch !== void 0 ? { stretch } : {},
|
|
7865
|
+
...tile !== void 0 ? { tile } : {},
|
|
7866
|
+
...effects !== void 0 ? { effects } : {},
|
|
7867
|
+
...blipEffects !== void 0 ? { blipEffects } : {},
|
|
7868
|
+
handle: {
|
|
7869
|
+
partPath,
|
|
7870
|
+
...nodeId !== void 0 ? { nodeId } : {},
|
|
7871
|
+
...embed !== void 0 ? { relationshipId: asRelationshipId(embed) } : {},
|
|
7872
|
+
orderingSlot
|
|
7873
|
+
},
|
|
7874
|
+
...rawSidecars.length > 0 ? { rawSidecars } : {}
|
|
8056
7875
|
};
|
|
8057
7876
|
}
|
|
8058
|
-
function
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
|
|
8062
|
-
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
|
|
8070
|
-
|
|
8071
|
-
|
|
8072
|
-
for (const [key, value] of Object.entries(parent)) {
|
|
8073
|
-
if (key.startsWith("@_")) continue;
|
|
8074
|
-
const nodes = Array.isArray(value) ? value : [value];
|
|
8075
|
-
for (const node of nodes) {
|
|
8076
|
-
if (!isXmlNode(node)) continue;
|
|
8077
|
-
const color = parseColorChild(key, node);
|
|
8078
|
-
if (color !== void 0) colors.push(color);
|
|
7877
|
+
function collectEffectSidecars(spPr, effects, nextId) {
|
|
7878
|
+
const effectList = getChild(spPr, "effectLst");
|
|
7879
|
+
if (effectList === void 0) return [];
|
|
7880
|
+
const sidecars = collectUnknownSidecars(effectList, KNOWN_EFFECT_CHILDREN, nextId);
|
|
7881
|
+
const supportedChildren = [
|
|
7882
|
+
["outerShdw", effects?.outerShadow],
|
|
7883
|
+
["innerShdw", effects?.innerShadow],
|
|
7884
|
+
["glow", effects?.glow],
|
|
7885
|
+
["softEdge", effects?.softEdge]
|
|
7886
|
+
];
|
|
7887
|
+
for (const [name, parsed] of supportedChildren) {
|
|
7888
|
+
const node = getChild(effectList, name);
|
|
7889
|
+
if (node !== void 0 && parsed === void 0) {
|
|
7890
|
+
sidecars.push(makeSidecar(`a:${name}`, node, nextId));
|
|
8079
7891
|
}
|
|
8080
7892
|
}
|
|
8081
|
-
return
|
|
8082
|
-
}
|
|
8083
|
-
function firstColorChild(parent) {
|
|
8084
|
-
return parent !== void 0 ? collectColorChildren(parent)[0] : void 0;
|
|
8085
|
-
}
|
|
8086
|
-
function parseColorChild(key, node) {
|
|
8087
|
-
const name = localName(key);
|
|
8088
|
-
return name === "prstClr" ? parsePresetColor(node) : parseColorElement({ [name]: node });
|
|
8089
|
-
}
|
|
8090
|
-
function isXmlNode(value) {
|
|
8091
|
-
return typeof value === "object" && value !== null;
|
|
7893
|
+
return sidecars;
|
|
8092
7894
|
}
|
|
8093
|
-
function
|
|
8094
|
-
|
|
8095
|
-
const
|
|
8096
|
-
|
|
7895
|
+
function collectBlipEffectSidecars(blip, effects, nextId) {
|
|
7896
|
+
if (blip === void 0) return [];
|
|
7897
|
+
const sidecars = collectUnknownSidecars(blip, KNOWN_BLIP_CHILDREN, nextId);
|
|
7898
|
+
const supportedChildren = [
|
|
7899
|
+
["grayscl", effects?.grayscale === true],
|
|
7900
|
+
["biLevel", effects?.biLevel],
|
|
7901
|
+
["blur", effects?.blur],
|
|
7902
|
+
["lum", effects?.lum],
|
|
7903
|
+
["duotone", effects?.duotone],
|
|
7904
|
+
["clrChange", effects?.clrChange]
|
|
7905
|
+
];
|
|
7906
|
+
for (const [name, parsed] of supportedChildren) {
|
|
7907
|
+
const node = getChild(blip, name);
|
|
7908
|
+
if (node !== void 0 && (parsed === void 0 || parsed === false)) {
|
|
7909
|
+
sidecars.push(makeSidecar(`a:${name}`, node, nextId));
|
|
7910
|
+
}
|
|
7911
|
+
}
|
|
7912
|
+
return sidecars;
|
|
8097
7913
|
}
|
|
8098
|
-
function
|
|
8099
|
-
|
|
8100
|
-
const
|
|
8101
|
-
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
|
|
7914
|
+
function parseGraphicFrame(graphicFrame, partPath, nextId, orderingSlot, orderedNode) {
|
|
7915
|
+
const graphic = getChild(graphicFrame, "graphic");
|
|
7916
|
+
const graphicData = getChild(graphic, "graphicData");
|
|
7917
|
+
const uri = getAttr(graphicData, "uri");
|
|
7918
|
+
if (uri !== void 0 && CHART_GRAPHIC_DATA_URIS.has(uri)) {
|
|
7919
|
+
const parsedChart = parseChartGraphicFrame(graphicFrame, partPath, nextId, orderingSlot);
|
|
7920
|
+
if (parsedChart !== void 0) return parsedChart;
|
|
8105
7921
|
}
|
|
8106
|
-
if (
|
|
8107
|
-
|
|
8108
|
-
|
|
8109
|
-
const fill = parseGradientFill(grad);
|
|
8110
|
-
return fill ?? { kind: "raw", raw: makeSidecar("a:gradFill", grad, nextId) };
|
|
7922
|
+
if (uri !== void 0 && SMARTART_DIAGRAM_URIS.has(uri)) {
|
|
7923
|
+
const parsedSmartArt = parseSmartArtGraphicFrame(graphicFrame, partPath, nextId, orderingSlot);
|
|
7924
|
+
if (parsedSmartArt !== void 0) return parsedSmartArt;
|
|
8111
7925
|
}
|
|
8112
|
-
const
|
|
8113
|
-
if (
|
|
8114
|
-
return
|
|
7926
|
+
const table = getChild(graphicData, "tbl");
|
|
7927
|
+
if (table === void 0) {
|
|
7928
|
+
return parseRawShapeNode("p:graphicFrame", graphicFrame, partPath, nextId, orderingSlot);
|
|
8115
7929
|
}
|
|
8116
|
-
const
|
|
8117
|
-
|
|
8118
|
-
|
|
8119
|
-
|
|
7930
|
+
const orderedGraphicChildren = orderedNestedChildChildren(orderedNode, "graphicFrame", "graphic");
|
|
7931
|
+
const orderedGraphicDataChildren = orderedChildChildren2(orderedGraphicChildren, "graphicData");
|
|
7932
|
+
const orderedTableChildren = orderedChildChildren2(orderedGraphicDataChildren, "tbl");
|
|
7933
|
+
const parsedTable = parseTable(
|
|
7934
|
+
table,
|
|
7935
|
+
graphicFrame,
|
|
7936
|
+
partPath,
|
|
7937
|
+
nextId,
|
|
7938
|
+
orderingSlot,
|
|
7939
|
+
orderedTableChildren
|
|
7940
|
+
);
|
|
7941
|
+
if (parsedTable === void 0) {
|
|
7942
|
+
return parseRawShapeNode("p:graphicFrame", graphicFrame, partPath, nextId, orderingSlot);
|
|
8120
7943
|
}
|
|
8121
|
-
|
|
8122
|
-
|
|
8123
|
-
|
|
7944
|
+
return parsedTable;
|
|
7945
|
+
}
|
|
7946
|
+
function parseAlternateContent(alternateContent, partPath, nextId, orderingSlot) {
|
|
7947
|
+
const branches = [
|
|
7948
|
+
...getChildArray(alternateContent, "Choice"),
|
|
7949
|
+
...getChildArray(alternateContent, "Fallback")
|
|
7950
|
+
];
|
|
7951
|
+
for (const branch of branches) {
|
|
7952
|
+
const parsed = parseAlternateContentBranch(branch, partPath, nextId, orderingSlot);
|
|
7953
|
+
if (parsed.length > 0) {
|
|
7954
|
+
if (parsed.every((node) => node.kind === "raw")) {
|
|
7955
|
+
continue;
|
|
7956
|
+
}
|
|
7957
|
+
return parsed.map(
|
|
7958
|
+
(node) => attachRawSidecar(node, makeSidecar("mc:AlternateContent", alternateContent, nextId))
|
|
7959
|
+
);
|
|
7960
|
+
}
|
|
7961
|
+
}
|
|
7962
|
+
return [
|
|
7963
|
+
parseRawShapeNode("mc:AlternateContent", alternateContent, partPath, nextId, orderingSlot)
|
|
7964
|
+
];
|
|
7965
|
+
}
|
|
7966
|
+
function attachRawSidecar(node, sidecar) {
|
|
7967
|
+
if (node.kind === "raw") return node;
|
|
7968
|
+
return {
|
|
7969
|
+
...node,
|
|
7970
|
+
rawSidecars: [...node.rawSidecars ?? [], sidecar]
|
|
7971
|
+
};
|
|
7972
|
+
}
|
|
7973
|
+
function parseAlternateContentBranch(branch, partPath, nextId, orderingSlot) {
|
|
7974
|
+
const nodes = [];
|
|
7975
|
+
for (const key of Object.keys(branch)) {
|
|
7976
|
+
if (key.startsWith("@_") || key === "#text") continue;
|
|
7977
|
+
const local = localName(key);
|
|
7978
|
+
const value = branch[key];
|
|
7979
|
+
const items = Array.isArray(value) ? value : [value];
|
|
7980
|
+
for (const item of items) {
|
|
7981
|
+
const node = unsafeOoxmlBoundaryAssertion(item);
|
|
7982
|
+
if (local === "sp") nodes.push(parseShape(node, partPath, nextId, orderingSlot));
|
|
7983
|
+
else if (local === "pic") nodes.push(parseImage(node, partPath, nextId, orderingSlot));
|
|
7984
|
+
else if (local === "cxnSp") {
|
|
7985
|
+
nodes.push(parseConnector(node, partPath, nextId, orderingSlot));
|
|
7986
|
+
} else if (local === "grpSp") {
|
|
7987
|
+
nodes.push(parseGroup(node, partPath, nextId, orderingSlot));
|
|
7988
|
+
} else if (local === "graphicFrame") {
|
|
7989
|
+
nodes.push(parseGraphicFrame(node, partPath, nextId, orderingSlot));
|
|
7990
|
+
} else {
|
|
7991
|
+
nodes.push(parseRawShapeNode(key, node, partPath, nextId, orderingSlot));
|
|
7992
|
+
}
|
|
8124
7993
|
}
|
|
8125
7994
|
}
|
|
8126
|
-
return
|
|
7995
|
+
return nodes;
|
|
8127
7996
|
}
|
|
8128
|
-
function
|
|
8129
|
-
const
|
|
8130
|
-
|
|
8131
|
-
|
|
8132
|
-
|
|
8133
|
-
|
|
8134
|
-
|
|
8135
|
-
|
|
8136
|
-
|
|
8137
|
-
|
|
8138
|
-
|
|
8139
|
-
const
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
|
|
8143
|
-
|
|
8144
|
-
const r = numericAttr2(fillToRect, "r") ?? 0;
|
|
8145
|
-
const b = numericAttr2(fillToRect, "b") ?? 0;
|
|
8146
|
-
return {
|
|
8147
|
-
kind: "gradient",
|
|
8148
|
-
gradientType: "radial",
|
|
8149
|
-
stops,
|
|
8150
|
-
centerX: (l + (1e5 - r)) / 2 / 1e5,
|
|
8151
|
-
centerY: (t + (1e5 - b)) / 2 / 1e5
|
|
8152
|
-
};
|
|
8153
|
-
}
|
|
7997
|
+
function parseChartGraphicFrame(graphicFrame, partPath, nextId, orderingSlot) {
|
|
7998
|
+
const graphic = getChild(graphicFrame, "graphic");
|
|
7999
|
+
const graphicData = getChild(graphic, "graphicData");
|
|
8000
|
+
const chart = getChild(graphicData, "chart");
|
|
8001
|
+
const rId = getNamespacedAttr(chart, "id") ?? getAttr(chart, "id");
|
|
8002
|
+
if (rId === void 0) return void 0;
|
|
8003
|
+
const nvGraphicFramePr = getChild(graphicFrame, "nvGraphicFramePr");
|
|
8004
|
+
const cNvPr = getChild(nvGraphicFramePr, "cNvPr");
|
|
8005
|
+
const nodeId = sourceNodeId(cNvPr);
|
|
8006
|
+
const name = getAttr(cNvPr, "name");
|
|
8007
|
+
const transform = parseTransform(graphicFrame);
|
|
8008
|
+
const rawSidecars = [
|
|
8009
|
+
...collectUnknownSidecars(graphicFrame, KNOWN_GRAPHIC_FRAME_CHILDREN, nextId),
|
|
8010
|
+
...collectUnknownSidecars(graphic, KNOWN_GRAPHIC_CHILDREN, nextId),
|
|
8011
|
+
...collectUnknownSidecars(graphicData, EMPTY_KNOWN, nextId)
|
|
8012
|
+
];
|
|
8154
8013
|
return {
|
|
8155
|
-
kind: "
|
|
8156
|
-
|
|
8157
|
-
|
|
8158
|
-
|
|
8014
|
+
kind: "chart",
|
|
8015
|
+
...nodeId !== void 0 ? { nodeId } : {},
|
|
8016
|
+
...name !== void 0 ? { name } : {},
|
|
8017
|
+
...transform !== void 0 ? { transform } : {},
|
|
8018
|
+
chartRelationshipId: asRelationshipId(rId),
|
|
8019
|
+
handle: {
|
|
8020
|
+
partPath,
|
|
8021
|
+
...nodeId !== void 0 ? { nodeId } : {},
|
|
8022
|
+
relationshipId: asRelationshipId(rId),
|
|
8023
|
+
orderingSlot
|
|
8024
|
+
},
|
|
8025
|
+
...rawSidecars.length > 0 ? { rawSidecars } : {}
|
|
8159
8026
|
};
|
|
8160
8027
|
}
|
|
8161
|
-
function
|
|
8162
|
-
const
|
|
8163
|
-
const
|
|
8164
|
-
|
|
8165
|
-
const
|
|
8028
|
+
function parseSmartArtGraphicFrame(graphicFrame, partPath, nextId, orderingSlot) {
|
|
8029
|
+
const graphic = getChild(graphicFrame, "graphic");
|
|
8030
|
+
const graphicData = getChild(graphic, "graphicData");
|
|
8031
|
+
const relIds = getChild(graphicData, "relIds");
|
|
8032
|
+
const dmRId = getNamespacedAttr(relIds, "dm") ?? getAttr(relIds, "dm");
|
|
8033
|
+
if (dmRId === void 0) return void 0;
|
|
8034
|
+
const nvGraphicFramePr = getChild(graphicFrame, "nvGraphicFramePr");
|
|
8035
|
+
const cNvPr = getChild(nvGraphicFramePr, "cNvPr");
|
|
8036
|
+
const nodeId = sourceNodeId(cNvPr);
|
|
8037
|
+
const name = getAttr(cNvPr, "name");
|
|
8038
|
+
const transform = parseTransform(graphicFrame);
|
|
8039
|
+
const rawSidecars = [
|
|
8040
|
+
...collectUnknownSidecars(graphicFrame, KNOWN_GRAPHIC_FRAME_CHILDREN, nextId),
|
|
8041
|
+
...collectUnknownSidecars(graphic, KNOWN_GRAPHIC_CHILDREN, nextId),
|
|
8042
|
+
...collectUnknownSidecars(graphicData, EMPTY_KNOWN, nextId)
|
|
8043
|
+
];
|
|
8166
8044
|
return {
|
|
8167
|
-
kind: "
|
|
8168
|
-
|
|
8169
|
-
...
|
|
8045
|
+
kind: "smartArt",
|
|
8046
|
+
...nodeId !== void 0 ? { nodeId } : {},
|
|
8047
|
+
...name !== void 0 ? { name } : {},
|
|
8048
|
+
...transform !== void 0 ? { transform } : {},
|
|
8049
|
+
dataRelationshipId: asRelationshipId(dmRId),
|
|
8050
|
+
handle: {
|
|
8051
|
+
partPath,
|
|
8052
|
+
...nodeId !== void 0 ? { nodeId } : {},
|
|
8053
|
+
relationshipId: asRelationshipId(dmRId),
|
|
8054
|
+
orderingSlot
|
|
8055
|
+
},
|
|
8056
|
+
...rawSidecars.length > 0 ? { rawSidecars } : {}
|
|
8170
8057
|
};
|
|
8171
8058
|
}
|
|
8172
|
-
function
|
|
8173
|
-
|
|
8174
|
-
|
|
8059
|
+
function parseTable(tbl, graphicFrame, partPath, nextId, orderingSlot, orderedTableChildren) {
|
|
8060
|
+
const columns = parseTableColumns(getChild(tbl, "tblGrid"));
|
|
8061
|
+
if (columns.length === 0) return void 0;
|
|
8062
|
+
const nvGraphicFramePr = getChild(graphicFrame, "nvGraphicFramePr");
|
|
8063
|
+
const cNvPr = getChild(nvGraphicFramePr, "cNvPr");
|
|
8064
|
+
const nodeId = sourceNodeId(cNvPr);
|
|
8065
|
+
const name = getAttr(cNvPr, "name");
|
|
8066
|
+
const tblPr = getChild(tbl, "tblPr");
|
|
8067
|
+
const tableStyleId = getChildText(tblPr, "tableStyleId");
|
|
8068
|
+
const graphic = getChild(graphicFrame, "graphic");
|
|
8069
|
+
const graphicData = getChild(graphic, "graphicData");
|
|
8070
|
+
const transform = parseTransform(graphicFrame);
|
|
8071
|
+
const rows = parseTableRows(tbl, partPath, nextId, nodeId, orderingSlot, orderedTableChildren);
|
|
8072
|
+
const rawSidecars = [
|
|
8073
|
+
...collectUnknownSidecars(graphicFrame, KNOWN_GRAPHIC_FRAME_CHILDREN, nextId),
|
|
8074
|
+
...collectUnknownSidecars(graphic, KNOWN_GRAPHIC_CHILDREN, nextId),
|
|
8075
|
+
...collectUnknownSidecars(graphicData, KNOWN_GRAPHIC_DATA_CHILDREN, nextId),
|
|
8076
|
+
...collectUnknownSidecars(tbl, KNOWN_TABLE_CHILDREN, nextId)
|
|
8077
|
+
];
|
|
8175
8078
|
return {
|
|
8176
|
-
|
|
8177
|
-
|
|
8178
|
-
|
|
8179
|
-
|
|
8180
|
-
|
|
8181
|
-
|
|
8079
|
+
kind: "table",
|
|
8080
|
+
...nodeId !== void 0 ? { nodeId } : {},
|
|
8081
|
+
...name !== void 0 ? { name } : {},
|
|
8082
|
+
...transform !== void 0 ? { transform } : {},
|
|
8083
|
+
table: {
|
|
8084
|
+
columns,
|
|
8085
|
+
rows,
|
|
8086
|
+
...tableStyleId !== void 0 ? { tableStyleId } : {}
|
|
8087
|
+
},
|
|
8088
|
+
handle: { partPath, ...nodeId !== void 0 ? { nodeId } : {}, orderingSlot },
|
|
8089
|
+
...rawSidecars.length > 0 ? { rawSidecars } : {}
|
|
8182
8090
|
};
|
|
8183
8091
|
}
|
|
8184
|
-
function
|
|
8185
|
-
return
|
|
8092
|
+
function parseTableColumns(tblGrid) {
|
|
8093
|
+
return getChildArray(tblGrid, "gridCol").map((col) => ({ width: emuAttr(col, "w") }));
|
|
8186
8094
|
}
|
|
8187
|
-
function
|
|
8188
|
-
const
|
|
8189
|
-
|
|
8190
|
-
|
|
8095
|
+
function parseTableRows(tbl, partPath, nextId, tableNodeId, tableOrderingSlot, orderedTableChildren) {
|
|
8096
|
+
const orderedRows = orderedChildChildrenList(orderedTableChildren, "tr");
|
|
8097
|
+
return getChildArray(tbl, "tr").map((tr, rowIndex) => ({
|
|
8098
|
+
height: emuAttr(tr, "h"),
|
|
8099
|
+
cells: getChildArray(tr, "tc").map((tc, cellIndex) => {
|
|
8100
|
+
const orderedCells = orderedChildChildrenList(orderedRows[rowIndex], "tc");
|
|
8101
|
+
return parseTableCell(
|
|
8102
|
+
tc,
|
|
8103
|
+
partPath,
|
|
8104
|
+
nextId,
|
|
8105
|
+
tableNodeId,
|
|
8106
|
+
tableOrderingSlot,
|
|
8107
|
+
rowIndex,
|
|
8108
|
+
cellIndex,
|
|
8109
|
+
orderedCells[cellIndex]
|
|
8110
|
+
);
|
|
8111
|
+
})
|
|
8112
|
+
}));
|
|
8113
|
+
}
|
|
8114
|
+
function parseTableCell(tc, partPath, nextId, tableNodeId, tableOrderingSlot, rowIndex, cellIndex, orderedCellChildren) {
|
|
8115
|
+
const tcPr = getChild(tc, "tcPr");
|
|
8116
|
+
const textOrderingSlot = tableOrderingSlot * 1e9 + rowIndex * 1e6 + cellIndex;
|
|
8117
|
+
const textBody = parseTextBody(
|
|
8118
|
+
getChild(tc, "txBody"),
|
|
8119
|
+
partPath,
|
|
8120
|
+
nextId,
|
|
8121
|
+
tableNodeId,
|
|
8122
|
+
textOrderingSlot,
|
|
8123
|
+
orderedChildChildren2(orderedCellChildren, "txBody")
|
|
8124
|
+
);
|
|
8125
|
+
const fill = parseFill(tcPr, nextId);
|
|
8126
|
+
const borders = parseCellBorders(tcPr, nextId);
|
|
8127
|
+
const rawSidecars = [
|
|
8128
|
+
...collectUnknownSidecars(tc, KNOWN_TABLE_CELL_CHILDREN, nextId),
|
|
8129
|
+
...collectUnknownSidecars(tcPr, KNOWN_TABLE_CELL_PROPERTIES_CHILDREN, nextId)
|
|
8130
|
+
];
|
|
8191
8131
|
return {
|
|
8192
|
-
|
|
8193
|
-
|
|
8194
|
-
|
|
8195
|
-
|
|
8132
|
+
...textBody !== void 0 ? { textBody } : {},
|
|
8133
|
+
...fill !== void 0 ? { fill } : {},
|
|
8134
|
+
...borders !== void 0 ? { borders } : {},
|
|
8135
|
+
gridSpan: numericAttr2(tc, "gridSpan") ?? 1,
|
|
8136
|
+
rowSpan: numericAttr2(tc, "rowSpan") ?? 1,
|
|
8137
|
+
hMerge: isTrue(getAttr(tc, "hMerge") ?? getAttr(tcPr, "hMerge")),
|
|
8138
|
+
vMerge: isTrue(getAttr(tc, "vMerge") ?? getAttr(tcPr, "vMerge")),
|
|
8139
|
+
...rawSidecars.length > 0 ? { rawSidecars } : {}
|
|
8196
8140
|
};
|
|
8197
8141
|
}
|
|
8198
|
-
function
|
|
8199
|
-
const
|
|
8200
|
-
|
|
8142
|
+
function parseCellBorders(tcPr, nextId) {
|
|
8143
|
+
const left = parseLine(getChild(tcPr, "lnL"), nextId);
|
|
8144
|
+
const right = parseLine(getChild(tcPr, "lnR"), nextId);
|
|
8145
|
+
const top = parseLine(getChild(tcPr, "lnT"), nextId);
|
|
8146
|
+
const bottom = parseLine(getChild(tcPr, "lnB"), nextId);
|
|
8147
|
+
if (left === void 0 && right === void 0 && top === void 0 && bottom === void 0) {
|
|
8148
|
+
return void 0;
|
|
8149
|
+
}
|
|
8150
|
+
return {
|
|
8151
|
+
...top !== void 0 ? { top } : {},
|
|
8152
|
+
...bottom !== void 0 ? { bottom } : {},
|
|
8153
|
+
...left !== void 0 ? { left } : {},
|
|
8154
|
+
...right !== void 0 ? { right } : {}
|
|
8155
|
+
};
|
|
8201
8156
|
}
|
|
8202
|
-
function
|
|
8203
|
-
|
|
8204
|
-
|
|
8205
|
-
|
|
8206
|
-
|
|
8207
|
-
|
|
8208
|
-
|
|
8209
|
-
|
|
8210
|
-
|
|
8211
|
-
|
|
8157
|
+
function parseRawShapeNode(key, node, partPath, nextId, orderingSlot) {
|
|
8158
|
+
const nodeId = sourceNodeId(getChild(getChild(node, "nvSpPr"), "cNvPr"));
|
|
8159
|
+
return {
|
|
8160
|
+
kind: "raw",
|
|
8161
|
+
...nodeId !== void 0 ? { nodeId } : {},
|
|
8162
|
+
raw: makeSidecar(key, node, nextId),
|
|
8163
|
+
handle: { partPath, ...nodeId !== void 0 ? { nodeId } : {}, orderingSlot }
|
|
8164
|
+
};
|
|
8165
|
+
}
|
|
8166
|
+
function parsePlaceholder(ph) {
|
|
8167
|
+
if (!ph) return void 0;
|
|
8168
|
+
const type = getAttr(ph, "type");
|
|
8169
|
+
const index = numericAttr2(ph, "idx");
|
|
8170
|
+
if (type === void 0 && index === void 0) return void 0;
|
|
8212
8171
|
return {
|
|
8213
|
-
...
|
|
8214
|
-
...
|
|
8215
|
-
...dashStyle !== void 0 ? { dashStyle } : {},
|
|
8216
|
-
...customDash !== void 0 ? { customDash } : {},
|
|
8217
|
-
...lineCap !== void 0 ? { lineCap } : {},
|
|
8218
|
-
...lineJoin !== void 0 ? { lineJoin } : {},
|
|
8219
|
-
...headEnd !== void 0 ? { headEnd } : {},
|
|
8220
|
-
...tailEnd !== void 0 ? { tailEnd } : {}
|
|
8172
|
+
...type !== void 0 ? { type } : {},
|
|
8173
|
+
...index !== void 0 ? { index } : {}
|
|
8221
8174
|
};
|
|
8222
8175
|
}
|
|
8223
|
-
function
|
|
8224
|
-
const
|
|
8225
|
-
if (
|
|
8226
|
-
|
|
8227
|
-
|
|
8228
|
-
|
|
8229
|
-
|
|
8230
|
-
|
|
8231
|
-
|
|
8232
|
-
if (offsetX === void 0 || offsetY === void 0 || width === void 0 || height === void 0) {
|
|
8233
|
-
return void 0;
|
|
8176
|
+
function parseGeometry(spPr, orderedSpPr) {
|
|
8177
|
+
const prstGeom = getChild(spPr, "prstGeom");
|
|
8178
|
+
if (prstGeom) {
|
|
8179
|
+
const preset = getAttr(prstGeom, "prst");
|
|
8180
|
+
const adjustValues = parseAdjustValues(getChild(prstGeom, "avLst"));
|
|
8181
|
+
return preset !== void 0 ? {
|
|
8182
|
+
preset,
|
|
8183
|
+
...Object.keys(adjustValues).length > 0 ? { adjustValues } : {}
|
|
8184
|
+
} : void 0;
|
|
8234
8185
|
}
|
|
8235
|
-
const
|
|
8236
|
-
|
|
8237
|
-
|
|
8186
|
+
const customPaths = parseCustomGeometry(
|
|
8187
|
+
getChild(spPr, "custGeom"),
|
|
8188
|
+
orderedChildChildren2(orderedSpPr, "custGeom")
|
|
8189
|
+
);
|
|
8190
|
+
if (customPaths !== void 0) return { kind: "custom", paths: customPaths };
|
|
8191
|
+
return void 0;
|
|
8192
|
+
}
|
|
8193
|
+
function parseAdjustValues(avLst) {
|
|
8194
|
+
const adjustValues = {};
|
|
8195
|
+
for (const guide of getChildArray(avLst, "gd")) {
|
|
8196
|
+
const name = getAttr(guide, "name");
|
|
8197
|
+
const formula = getAttr(guide, "fmla");
|
|
8198
|
+
const match = formula?.match(/val\s+(-?\d+)/);
|
|
8199
|
+
if (name !== void 0 && match !== void 0 && match !== null) {
|
|
8200
|
+
adjustValues[name] = Number(match[1]);
|
|
8201
|
+
}
|
|
8202
|
+
}
|
|
8203
|
+
return adjustValues;
|
|
8204
|
+
}
|
|
8205
|
+
function parseChildTransform(grpSpPr, fallback) {
|
|
8206
|
+
const xfrm = getChild(grpSpPr, "xfrm");
|
|
8207
|
+
const childOff = getChild(xfrm, "chOff");
|
|
8208
|
+
const childExt = getChild(xfrm, "chExt");
|
|
8209
|
+
const offsetX = numericAttr2(childOff, "x") ?? 0;
|
|
8210
|
+
const offsetY = numericAttr2(childOff, "y") ?? 0;
|
|
8211
|
+
const width = numericAttr2(childExt, "cx") ?? fallback?.width;
|
|
8212
|
+
const height = numericAttr2(childExt, "cy") ?? fallback?.height;
|
|
8213
|
+
if (width === void 0 || height === void 0) return void 0;
|
|
8238
8214
|
return {
|
|
8239
8215
|
offsetX: asEmu2(offsetX),
|
|
8240
8216
|
offsetY: asEmu2(offsetY),
|
|
8241
|
-
width: asEmu2(width),
|
|
8242
|
-
height: asEmu2(height)
|
|
8243
|
-
...rotation !== void 0 ? { rotation: asOoxmlAngle(rotation) } : {},
|
|
8244
|
-
...isTrue(flipH) ? { flipHorizontal: true } : {},
|
|
8245
|
-
...isTrue(flipV) ? { flipVertical: true } : {}
|
|
8217
|
+
width: asEmu2(Number(width)),
|
|
8218
|
+
height: asEmu2(Number(height))
|
|
8246
8219
|
};
|
|
8247
8220
|
}
|
|
8248
|
-
function
|
|
8249
|
-
|
|
8250
|
-
|
|
8251
|
-
|
|
8252
|
-
|
|
8253
|
-
|
|
8254
|
-
|
|
8255
|
-
|
|
8256
|
-
|
|
8257
|
-
|
|
8258
|
-
|
|
8259
|
-
|
|
8260
|
-
|
|
8261
|
-
if (!Number.isFinite(numeric)) continue;
|
|
8262
|
-
transforms.push({
|
|
8263
|
-
kind: transformKind,
|
|
8264
|
-
value: asOoxmlPercent(numeric)
|
|
8265
|
-
});
|
|
8266
|
-
}
|
|
8267
|
-
}
|
|
8268
|
-
return transforms.length > 0 ? { ...base, transforms } : base;
|
|
8221
|
+
function parseCrop(srcRect) {
|
|
8222
|
+
if (!srcRect) return void 0;
|
|
8223
|
+
const left = numericAttr2(srcRect, "l");
|
|
8224
|
+
const top = numericAttr2(srcRect, "t");
|
|
8225
|
+
const right = numericAttr2(srcRect, "r");
|
|
8226
|
+
const bottom = numericAttr2(srcRect, "b");
|
|
8227
|
+
const crop = {
|
|
8228
|
+
...left !== void 0 ? { left: asOoxmlPercent(left) } : {},
|
|
8229
|
+
...top !== void 0 ? { top: asOoxmlPercent(top) } : {},
|
|
8230
|
+
...right !== void 0 ? { right: asOoxmlPercent(right) } : {},
|
|
8231
|
+
...bottom !== void 0 ? { bottom: asOoxmlPercent(bottom) } : {}
|
|
8232
|
+
};
|
|
8233
|
+
return Object.keys(crop).length > 0 ? crop : void 0;
|
|
8269
8234
|
}
|
|
8270
|
-
function
|
|
8271
|
-
const
|
|
8272
|
-
if (
|
|
8273
|
-
const
|
|
8274
|
-
|
|
8235
|
+
function parseStretch(stretch) {
|
|
8236
|
+
const fillRect = getChild(stretch, "fillRect");
|
|
8237
|
+
if (fillRect === void 0) return void 0;
|
|
8238
|
+
const left = (numericAttr2(fillRect, "l") ?? 0) / 1e5;
|
|
8239
|
+
const top = (numericAttr2(fillRect, "t") ?? 0) / 1e5;
|
|
8240
|
+
const right = (numericAttr2(fillRect, "r") ?? 0) / 1e5;
|
|
8241
|
+
const bottom = (numericAttr2(fillRect, "b") ?? 0) / 1e5;
|
|
8242
|
+
if (left === 0 && top === 0 && right === 0 && bottom === 0) return void 0;
|
|
8243
|
+
return { left, top, right, bottom };
|
|
8275
8244
|
}
|
|
8276
|
-
function
|
|
8277
|
-
|
|
8245
|
+
function sourceNodeId(cNvPr) {
|
|
8246
|
+
const id = getAttr(cNvPr, "id");
|
|
8247
|
+
return id !== void 0 ? asSourceNodeId(id) : void 0;
|
|
8278
8248
|
}
|
|
8279
|
-
function
|
|
8280
|
-
|
|
8281
|
-
return parseEnumValue(value, DASH_STYLES);
|
|
8249
|
+
function emuAttr(node, attrName) {
|
|
8250
|
+
return asEmu2(numericAttr2(node, attrName) ?? 0);
|
|
8282
8251
|
}
|
|
8283
|
-
|
|
8284
|
-
|
|
8285
|
-
const
|
|
8286
|
-
|
|
8287
|
-
|
|
8288
|
-
|
|
8289
|
-
|
|
8290
|
-
|
|
8252
|
+
var EMPTY_KNOWN = /* @__PURE__ */ new Set();
|
|
8253
|
+
function orderedChildChildren2(parent, childLocalName) {
|
|
8254
|
+
const child = parent?.find((entry) => {
|
|
8255
|
+
const key2 = Object.keys(entry).find((candidate) => candidate !== ":@");
|
|
8256
|
+
return key2 !== void 0 && localName(key2) === childLocalName;
|
|
8257
|
+
});
|
|
8258
|
+
if (child === void 0) return void 0;
|
|
8259
|
+
const key = Object.keys(child).find((candidate) => candidate !== ":@");
|
|
8260
|
+
const value = key !== void 0 ? child[key] : void 0;
|
|
8261
|
+
return Array.isArray(value) ? value : void 0;
|
|
8291
8262
|
}
|
|
8292
|
-
|
|
8293
|
-
|
|
8294
|
-
|
|
8295
|
-
|
|
8263
|
+
function orderedChildChildrenList(parent, childLocalName) {
|
|
8264
|
+
if (parent === void 0) return [];
|
|
8265
|
+
return parent.filter((entry) => {
|
|
8266
|
+
const key = Object.keys(entry).find((candidate) => candidate !== ":@");
|
|
8267
|
+
return key !== void 0 && localName(key) === childLocalName;
|
|
8268
|
+
}).map((entry) => {
|
|
8269
|
+
const key = Object.keys(entry).find((candidate) => candidate !== ":@");
|
|
8270
|
+
const value = key !== void 0 ? entry[key] : void 0;
|
|
8271
|
+
return Array.isArray(value) ? value : void 0;
|
|
8272
|
+
});
|
|
8273
|
+
}
|
|
8274
|
+
function orderedNestedChildChildren(node, parentLocalName, childLocalName) {
|
|
8275
|
+
if (node === void 0) return void 0;
|
|
8276
|
+
const parentChildren = node[parentLocalName];
|
|
8277
|
+
return orderedChildChildren2(
|
|
8278
|
+
Array.isArray(parentChildren) ? parentChildren : void 0,
|
|
8279
|
+
childLocalName
|
|
8280
|
+
);
|
|
8281
|
+
}
|
|
8282
|
+
var xmlBuilder = new import_fast_xml_parser2.XMLBuilder({
|
|
8283
|
+
ignoreAttributes: false,
|
|
8284
|
+
attributeNamePrefix: "@_",
|
|
8285
|
+
format: false,
|
|
8286
|
+
suppressEmptyNode: true
|
|
8287
|
+
});
|
|
8288
|
+
var EDITABLE_TEXT_RUN_PROPERTY_VALIDATORS = {
|
|
8289
|
+
bold: (value) => requireBooleanOrUndefined(value, "bold"),
|
|
8290
|
+
italic: (value) => requireBooleanOrUndefined(value, "italic"),
|
|
8291
|
+
underline: (value) => requireBooleanOrUndefined(value, "underline"),
|
|
8292
|
+
fontSize: (value) => {
|
|
8293
|
+
if (value !== void 0 && (!Number.isFinite(value) || value <= 0)) {
|
|
8294
|
+
throw new Error("updateTextRunProperties: fontSize must be a finite positive pt value");
|
|
8295
|
+
}
|
|
8296
|
+
},
|
|
8297
|
+
color: (value) => {
|
|
8298
|
+
if (value === void 0) return;
|
|
8299
|
+
if (value.kind !== "srgb") {
|
|
8300
|
+
throw new Error("updateTextRunProperties: only srgb text run color is supported");
|
|
8301
|
+
}
|
|
8302
|
+
if (!/^[0-9A-Fa-f]{6}$/.test(value.hex)) {
|
|
8303
|
+
throw new Error("updateTextRunProperties: srgb text run color must be a 6-digit hex value");
|
|
8304
|
+
}
|
|
8305
|
+
},
|
|
8306
|
+
typeface: (value) => {
|
|
8307
|
+
if (value !== void 0 && value.trim() === "") {
|
|
8308
|
+
throw new Error("updateTextRunProperties: typeface must be a non-empty string");
|
|
8309
|
+
}
|
|
8310
|
+
}
|
|
8296
8311
|
};
|
|
8297
|
-
|
|
8298
|
-
|
|
8312
|
+
var EDITABLE_TEXT_RUN_PROPERTIES = Object.keys(EDITABLE_TEXT_RUN_PROPERTY_VALIDATORS).filter(
|
|
8313
|
+
(property) => property in EDITABLE_TEXT_RUN_PROPERTY_VALIDATORS
|
|
8314
|
+
);
|
|
8315
|
+
var EDITABLE_TEXT_RUN_PROPERTY_SET = new Set(EDITABLE_TEXT_RUN_PROPERTIES);
|
|
8316
|
+
var EDITABLE_PARAGRAPH_PROPERTIES = [
|
|
8317
|
+
"align",
|
|
8318
|
+
"level",
|
|
8319
|
+
"bullet"
|
|
8320
|
+
];
|
|
8321
|
+
var EDITABLE_PARAGRAPH_PROPERTY_SET = new Set(EDITABLE_PARAGRAPH_PROPERTIES);
|
|
8322
|
+
function requireBooleanOrUndefined(value, fieldName) {
|
|
8323
|
+
if (value !== void 0 && typeof value !== "boolean") {
|
|
8324
|
+
throw new Error(`updateTextRunProperties: ${fieldName} must be a boolean value`);
|
|
8325
|
+
}
|
|
8299
8326
|
}
|
|
8300
|
-
function
|
|
8301
|
-
|
|
8302
|
-
if (hasChild(ln, "bevel")) return "bevel";
|
|
8303
|
-
if (hasChild(ln, "miter")) return "miter";
|
|
8304
|
-
return void 0;
|
|
8327
|
+
function asEmu2(value) {
|
|
8328
|
+
return unsafeBrandAssertion2(value);
|
|
8305
8329
|
}
|
|
8306
|
-
function
|
|
8307
|
-
|
|
8308
|
-
const type = parseEnumValue(getAttr(node, "type"), ARROW_TYPES2);
|
|
8309
|
-
if (type === void 0) return void 0;
|
|
8310
|
-
const width = getAttr(node, "w") ?? "med";
|
|
8311
|
-
const length = getAttr(node, "len") ?? "med";
|
|
8312
|
-
return {
|
|
8313
|
-
type,
|
|
8314
|
-
width: parseEnumValueWithDefault(width, ARROW_SIZES2, "med"),
|
|
8315
|
-
length: parseEnumValueWithDefault(length, ARROW_SIZES2, "med")
|
|
8316
|
-
};
|
|
8330
|
+
function asPt(value) {
|
|
8331
|
+
return unsafeBrandAssertion2(value);
|
|
8317
8332
|
}
|
|
8318
|
-
|
|
8319
|
-
|
|
8320
|
-
|
|
8321
|
-
|
|
8322
|
-
|
|
8323
|
-
|
|
8324
|
-
|
|
8325
|
-
|
|
8326
|
-
|
|
8327
|
-
|
|
8328
|
-
var
|
|
8329
|
-
|
|
8330
|
-
|
|
8331
|
-
|
|
8332
|
-
|
|
8333
|
-
|
|
8334
|
-
|
|
8335
|
-
var
|
|
8333
|
+
function asHundredthPt2(value) {
|
|
8334
|
+
return unsafeBrandAssertion2(value);
|
|
8335
|
+
}
|
|
8336
|
+
function asOoxmlPercent(value) {
|
|
8337
|
+
return unsafeBrandAssertion2(value);
|
|
8338
|
+
}
|
|
8339
|
+
function asOoxmlAngle(value) {
|
|
8340
|
+
return unsafeBrandAssertion2(value);
|
|
8341
|
+
}
|
|
8342
|
+
var textEncoder = new TextEncoder();
|
|
8343
|
+
var ROOT_PART = asPartPath("");
|
|
8344
|
+
var PRESENTATION_PART = asPartPath("ppt/presentation.xml");
|
|
8345
|
+
var SLIDE_PART = asPartPath("ppt/slides/slide1.xml");
|
|
8346
|
+
var SLIDE_LAYOUT_PART = asPartPath("ppt/slideLayouts/slideLayout1.xml");
|
|
8347
|
+
var SLIDE_MASTER_PART = asPartPath("ppt/slideMasters/slideMaster1.xml");
|
|
8348
|
+
var THEME_PART = asPartPath("ppt/theme/theme1.xml");
|
|
8349
|
+
var APP_PROPS_PART = asPartPath("docProps/app.xml");
|
|
8350
|
+
var CORE_PROPS_PART = asPartPath("docProps/core.xml");
|
|
8336
8351
|
var DEFAULT_COLOR_MAP = {
|
|
8337
8352
|
bg1: "lt1",
|
|
8338
8353
|
tx1: "dk1",
|
|
@@ -8896,7 +8911,7 @@ function computeConnectorElement(context, connector, layer, partPath) {
|
|
|
8896
8911
|
sourceNode: connector,
|
|
8897
8912
|
...connector.transform !== void 0 ? { transform: connector.transform } : {},
|
|
8898
8913
|
...connector.geometry !== void 0 ? { geometry: connector.geometry } : {},
|
|
8899
|
-
...
|
|
8914
|
+
...computedOutlineProperty(context, connector.outline, connector.style?.lineRef, partPath),
|
|
8900
8915
|
...effects !== void 0 ? { effects } : {}
|
|
8901
8916
|
};
|
|
8902
8917
|
}
|
|
@@ -8940,7 +8955,7 @@ function computeShapeElement(context, shape, layer, partPath) {
|
|
|
8940
8955
|
...transform !== void 0 ? { transform } : {},
|
|
8941
8956
|
...geometry !== void 0 ? { geometry } : {},
|
|
8942
8957
|
...shape.fill !== void 0 ? { fill: computeFill(context, shape.fill, partPath) } : shape.style?.fillRef !== void 0 ? { fill: resolveFillReference(context, shape.style.fillRef, partPath) } : {},
|
|
8943
|
-
...
|
|
8958
|
+
...computedOutlineProperty(context, shape.outline, shape.style?.lineRef, partPath),
|
|
8944
8959
|
...effects !== void 0 ? { effects } : {},
|
|
8945
8960
|
...shape.textBody !== void 0 ? {
|
|
8946
8961
|
textBody: computeTextBody(
|
|
@@ -8955,7 +8970,7 @@ function computeShapeElement(context, shape, layer, partPath) {
|
|
|
8955
8970
|
}
|
|
8956
8971
|
function computeImageElement(context, image, layer, partPath) {
|
|
8957
8972
|
const relationship = resolveComputedRelationships(context.source, partPath).find(
|
|
8958
|
-
(
|
|
8973
|
+
(rel2) => rel2.id === image.blipRelationshipId && rel2.type === IMAGE_REL_TYPE2
|
|
8959
8974
|
);
|
|
8960
8975
|
const effects = image.effects !== void 0 ? computeEffectList(context, image.effects) : void 0;
|
|
8961
8976
|
const blipEffects = image.blipEffects !== void 0 ? computeBlipEffects(context, image.blipEffects) : void 0;
|
|
@@ -8986,7 +9001,7 @@ function computeTableElement(context, table, layer, partPath) {
|
|
|
8986
9001
|
}
|
|
8987
9002
|
function computeChartElement(context, chart, layer, partPath) {
|
|
8988
9003
|
const relationship = context.relationships.find(
|
|
8989
|
-
(
|
|
9004
|
+
(rel2) => rel2.id === chart.chartRelationshipId && CHART_REL_TYPES.has(rel2.type)
|
|
8990
9005
|
);
|
|
8991
9006
|
const chartXml = relationship?.targetPartPath !== void 0 ? readRawPackageText(context.source, relationship.targetPartPath) : void 0;
|
|
8992
9007
|
const chartData = chartXml !== void 0 ? parseComputedChartData(chartXml, context) : void 0;
|
|
@@ -9003,11 +9018,11 @@ function computeChartElement(context, chart, layer, partPath) {
|
|
|
9003
9018
|
}
|
|
9004
9019
|
function computeSmartArtElement(context, smartArt, layer, partPath) {
|
|
9005
9020
|
const dataRelationship = context.relationships.find(
|
|
9006
|
-
(
|
|
9021
|
+
(rel2) => rel2.id === smartArt.dataRelationshipId && DIAGRAM_DATA_REL_TYPES.has(rel2.type)
|
|
9007
9022
|
);
|
|
9008
9023
|
const dataRelationships = dataRelationship?.targetPartPath !== void 0 ? resolveComputedRelationships(context.source, dataRelationship.targetPartPath) : [];
|
|
9009
9024
|
const drawingRelationship = dataRelationships.find(
|
|
9010
|
-
(
|
|
9025
|
+
(rel2) => DIAGRAM_DRAWING_REL_TYPES.has(rel2.type)
|
|
9011
9026
|
);
|
|
9012
9027
|
const drawingPartPath = drawingRelationship?.targetPartPath;
|
|
9013
9028
|
const drawingXml = drawingPartPath !== void 0 ? readRawPackageText(context.source, drawingPartPath) : void 0;
|
|
@@ -9153,7 +9168,7 @@ function computeFill(context, fill, partPath) {
|
|
|
9153
9168
|
};
|
|
9154
9169
|
case "image": {
|
|
9155
9170
|
const relationship = resolveComputedRelationships(context.source, partPath).find(
|
|
9156
|
-
(
|
|
9171
|
+
(rel2) => rel2.id === fill.blipRelationshipId && rel2.type === IMAGE_REL_TYPE2
|
|
9157
9172
|
);
|
|
9158
9173
|
return {
|
|
9159
9174
|
kind: "image",
|
|
@@ -9178,6 +9193,24 @@ function computeOutline(context, outline, partPath) {
|
|
|
9178
9193
|
...outline.fill !== void 0 ? { fill: computeFill(context, outline.fill, partPath) } : {}
|
|
9179
9194
|
};
|
|
9180
9195
|
}
|
|
9196
|
+
function computedOutlineProperty(context, outline, lineRef, partPath) {
|
|
9197
|
+
const styleOutline = lineRef !== void 0 ? resolveLineReference(context, lineRef, partPath) : void 0;
|
|
9198
|
+
if (outline === void 0) {
|
|
9199
|
+
return styleOutline !== void 0 ? { outline: styleOutline } : {};
|
|
9200
|
+
}
|
|
9201
|
+
const computed = mergeComputedOutline(styleOutline, computeOutline(context, outline, partPath));
|
|
9202
|
+
return { outline: computed };
|
|
9203
|
+
}
|
|
9204
|
+
function mergeComputedOutline(base, override) {
|
|
9205
|
+
if (base === void 0) return override;
|
|
9206
|
+
const width = override.width ?? base.width;
|
|
9207
|
+
const fill = override.fill ?? base.fill;
|
|
9208
|
+
return {
|
|
9209
|
+
source: { ...base.source, ...override.source },
|
|
9210
|
+
...width !== void 0 ? { width } : {},
|
|
9211
|
+
...fill !== void 0 ? { fill } : {}
|
|
9212
|
+
};
|
|
9213
|
+
}
|
|
9181
9214
|
function resolveFillReference(context, ref, partPath) {
|
|
9182
9215
|
if (ref.index === 0) return void 0;
|
|
9183
9216
|
const list = ref.index >= 1e3 ? context.theme?.formatScheme?.backgroundFillStyles : context.theme?.formatScheme?.fillStyles;
|
|
@@ -9766,7 +9799,7 @@ var SLIDE_REL_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/rel
|
|
|
9766
9799
|
var SLIDE_LAYOUT_REL_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout";
|
|
9767
9800
|
var SLIDE_MASTER_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster";
|
|
9768
9801
|
var THEME_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme";
|
|
9769
|
-
var
|
|
9802
|
+
var PRESENTATION_CONTENT_TYPE2 = "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml";
|
|
9770
9803
|
var textDecoder3 = new TextDecoder();
|
|
9771
9804
|
function readPptx(input) {
|
|
9772
9805
|
const entries = unzipPackage(input);
|
|
@@ -9933,15 +9966,15 @@ function parsePartRoot(entries, partPath, rootLocalName, diagnostics, includeOrd
|
|
|
9933
9966
|
return { root, orderedRoot };
|
|
9934
9967
|
}
|
|
9935
9968
|
function resolveSingleRel(relationships, sourcePart, relType) {
|
|
9936
|
-
const rels = relationships.find((
|
|
9937
|
-
const match = rels?.find((
|
|
9969
|
+
const rels = relationships.find((rel2) => rel2.sourcePartPath === sourcePart)?.relationships;
|
|
9970
|
+
const match = rels?.find((rel2) => rel2.type === relType && rel2.targetMode !== "External");
|
|
9938
9971
|
if (match === void 0) return void 0;
|
|
9939
9972
|
return resolveInternalRelationshipTarget(sourcePart, match);
|
|
9940
9973
|
}
|
|
9941
9974
|
function resolveAllRels(relationships, sourcePart, relType) {
|
|
9942
|
-
const rels = relationships.find((
|
|
9943
|
-
return rels.filter((
|
|
9944
|
-
const target = resolveInternalRelationshipTarget(sourcePart,
|
|
9975
|
+
const rels = relationships.find((rel2) => rel2.sourcePartPath === sourcePart)?.relationships ?? [];
|
|
9976
|
+
return rels.filter((rel2) => rel2.type === relType && rel2.targetMode !== "External").flatMap((rel2) => {
|
|
9977
|
+
const target = resolveInternalRelationshipTarget(sourcePart, rel2);
|
|
9945
9978
|
return target === void 0 ? [] : [target];
|
|
9946
9979
|
});
|
|
9947
9980
|
}
|
|
@@ -10030,7 +10063,7 @@ function readPresentation(entries, relationships, overrides, diagnostics) {
|
|
|
10030
10063
|
const slideSize = readSlideSize(root);
|
|
10031
10064
|
const defaultTextStyle = parseTextStyle(getChild(root, "defaultTextStyle"));
|
|
10032
10065
|
const presentationRels = relationships.find(
|
|
10033
|
-
(
|
|
10066
|
+
(rel2) => rel2.sourcePartPath === presentationPath
|
|
10034
10067
|
)?.relationships;
|
|
10035
10068
|
const slidePartPaths = [];
|
|
10036
10069
|
const sldIdLst = getChild(root, "sldIdLst");
|
|
@@ -10038,7 +10071,7 @@ function readPresentation(entries, relationships, overrides, diagnostics) {
|
|
|
10038
10071
|
const relId = getNamespacedAttr(sldId, "id");
|
|
10039
10072
|
if (relId === void 0) continue;
|
|
10040
10073
|
const handle = { partPath: presentationPartPath, relationshipId: asRelationshipId(relId) };
|
|
10041
|
-
const relationship = presentationRels?.find((
|
|
10074
|
+
const relationship = presentationRels?.find((rel2) => rel2.id === relId);
|
|
10042
10075
|
if (relationship === void 0) {
|
|
10043
10076
|
diagnostics.push({
|
|
10044
10077
|
severity: "warning",
|
|
@@ -10081,15 +10114,15 @@ function readSlideSize(presentationRoot) {
|
|
|
10081
10114
|
}
|
|
10082
10115
|
function locatePresentationPart(relationships, overrides) {
|
|
10083
10116
|
const rootRels = relationships.find(
|
|
10084
|
-
(
|
|
10117
|
+
(rel2) => rel2.sourcePartPath === PACKAGE_ROOT_PART
|
|
10085
10118
|
)?.relationships;
|
|
10086
10119
|
const officeDocumentRel = rootRels?.find(
|
|
10087
|
-
(
|
|
10120
|
+
(rel2) => rel2.type === OFFICE_DOCUMENT_REL_TYPE && rel2.targetMode !== "External"
|
|
10088
10121
|
);
|
|
10089
10122
|
if (officeDocumentRel !== void 0) {
|
|
10090
10123
|
return resolveRelationshipTarget(PACKAGE_ROOT_PART, officeDocumentRel.target);
|
|
10091
10124
|
}
|
|
10092
|
-
const override = overrides.find((entry) => entry.contentType ===
|
|
10125
|
+
const override = overrides.find((entry) => entry.contentType === PRESENTATION_CONTENT_TYPE2);
|
|
10093
10126
|
return override?.partName;
|
|
10094
10127
|
}
|
|
10095
10128
|
var MEDIA_CONTENT_TYPE_PREFIXES = ["image/", "audio/", "video/"];
|
|
@@ -10117,7 +10150,7 @@ function extensionOf(path) {
|
|
|
10117
10150
|
function stripLeadingSlash(path) {
|
|
10118
10151
|
return path.startsWith("/") ? path.slice(1) : path;
|
|
10119
10152
|
}
|
|
10120
|
-
var
|
|
10153
|
+
var textEncoder2 = new TextEncoder();
|
|
10121
10154
|
var textDecoder4 = new TextDecoder();
|
|
10122
10155
|
var xmlBuilder2 = new import_fast_xml_parser3.XMLBuilder({
|
|
10123
10156
|
ignoreAttributes: false,
|