pptx-viewer-core 1.2.4 → 1.2.6
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/CHANGELOG.md +8 -0
- package/dist/{SvgExporter-CYyO9c5A.d.mts → SvgExporter-BKbDaGaC.d.mts} +1 -1
- package/dist/{SvgExporter-DdjrIx33.d.ts → SvgExporter-CG73UVb9.d.ts} +1 -1
- package/dist/cli/index.d.mts +2 -2
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.js +0 -0
- package/dist/cli/index.mjs +0 -0
- package/dist/converter/index.d.mts +3 -3
- package/dist/converter/index.d.ts +3 -3
- package/dist/converter/index.js +0 -0
- package/dist/converter/index.mjs +0 -0
- package/dist/index.d.mts +126 -7
- package/dist/index.d.ts +126 -7
- package/dist/index.js +403 -56
- package/dist/index.mjs +402 -57
- package/dist/{presentation-BRAUjTRt.d.mts → presentation-CLc4eS3z.d.mts} +10 -0
- package/dist/{presentation-BRAUjTRt.d.ts → presentation-CLc4eS3z.d.ts} +10 -0
- package/dist/signature-node/index.d.mts +17 -7
- package/dist/signature-node/index.d.ts +17 -7
- package/dist/signature-node/index.js +297 -209
- package/dist/signature-node/index.mjs +295 -207
- package/dist/{text-operations-CkW4BO91.d.mts → text-operations-CCKEVX_5.d.mts} +1 -1
- package/dist/{text-operations-BJUOhA1w.d.ts → text-operations-oN04X1yi.d.ts} +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7175,6 +7175,32 @@ function findAinkInkPayload(graphicData) {
|
|
|
7175
7175
|
}
|
|
7176
7176
|
return void 0;
|
|
7177
7177
|
}
|
|
7178
|
+
function findOleObjPayload(graphicData) {
|
|
7179
|
+
if (!graphicData) {
|
|
7180
|
+
return void 0;
|
|
7181
|
+
}
|
|
7182
|
+
const direct = graphicData["p:oleObj"];
|
|
7183
|
+
if (direct) {
|
|
7184
|
+
return direct;
|
|
7185
|
+
}
|
|
7186
|
+
const altContent = graphicData["mc:AlternateContent"];
|
|
7187
|
+
if (!altContent) {
|
|
7188
|
+
return void 0;
|
|
7189
|
+
}
|
|
7190
|
+
const fallback = altContent["mc:Fallback"];
|
|
7191
|
+
const fallbackOleObj = fallback?.["p:oleObj"];
|
|
7192
|
+
if (fallbackOleObj) {
|
|
7193
|
+
return fallbackOleObj;
|
|
7194
|
+
}
|
|
7195
|
+
const choices = ensureArrayLike(altContent["mc:Choice"]);
|
|
7196
|
+
for (const choice of choices) {
|
|
7197
|
+
const node = choice?.["p:oleObj"];
|
|
7198
|
+
if (node) {
|
|
7199
|
+
return node;
|
|
7200
|
+
}
|
|
7201
|
+
}
|
|
7202
|
+
return void 0;
|
|
7203
|
+
}
|
|
7178
7204
|
function decodeAinkInk(inkRoot) {
|
|
7179
7205
|
const inkPaths = [];
|
|
7180
7206
|
const inkColors = [];
|
|
@@ -7287,7 +7313,7 @@ var PptxGraphicFrameParser = class {
|
|
|
7287
7313
|
};
|
|
7288
7314
|
}
|
|
7289
7315
|
if (type === "ole" && graphicData) {
|
|
7290
|
-
const oleObject = graphicData
|
|
7316
|
+
const oleObject = findOleObjPayload(graphicData);
|
|
7291
7317
|
const oleProgId = String(oleObject?.["@_progId"] || "").trim() || void 0;
|
|
7292
7318
|
const oleName = String(oleObject?.["@_name"] || "").trim() || void 0;
|
|
7293
7319
|
const oleClsId = String(oleObject?.["@_classid"] || "").trim() || void 0;
|
|
@@ -7378,7 +7404,7 @@ var PptxGraphicFrameParser = class {
|
|
|
7378
7404
|
if (graphicData["dgm:relIds"] || uri.includes("/drawingml/2006/diagram")) {
|
|
7379
7405
|
return "smartArt";
|
|
7380
7406
|
}
|
|
7381
|
-
if (
|
|
7407
|
+
if (uri.includes("/presentationml/2006/ole") || uri.includes("/drawingml/2006/ole") || findOleObjPayload(graphicData)) {
|
|
7382
7408
|
return "ole";
|
|
7383
7409
|
}
|
|
7384
7410
|
if (graphicData["a:videoFile"] || graphicData["a:audioFile"] || uri.includes("/drawingml/2006/media")) {
|
|
@@ -8679,6 +8705,87 @@ function parseGuideNode(node) {
|
|
|
8679
8705
|
return { id, orientation, positionEmu, color };
|
|
8680
8706
|
}
|
|
8681
8707
|
|
|
8708
|
+
// src/core/services/animation-target-reconcile.ts
|
|
8709
|
+
var NV_CONTAINERS = [
|
|
8710
|
+
"p:nvSpPr",
|
|
8711
|
+
"p:nvPicPr",
|
|
8712
|
+
"p:nvCxnSpPr",
|
|
8713
|
+
"p:nvGraphicFramePr",
|
|
8714
|
+
"p:nvGrpSpPr"
|
|
8715
|
+
];
|
|
8716
|
+
function readCnvPrId(rawXml) {
|
|
8717
|
+
if (!rawXml) {
|
|
8718
|
+
return void 0;
|
|
8719
|
+
}
|
|
8720
|
+
for (const nvKey of NV_CONTAINERS) {
|
|
8721
|
+
const nv = rawXml[nvKey];
|
|
8722
|
+
const cNvPr = nv?.["p:cNvPr"];
|
|
8723
|
+
const id = cNvPr?.["@_id"];
|
|
8724
|
+
if (id !== void 0 && id !== null && String(id).length > 0) {
|
|
8725
|
+
return String(id);
|
|
8726
|
+
}
|
|
8727
|
+
}
|
|
8728
|
+
return void 0;
|
|
8729
|
+
}
|
|
8730
|
+
function isTemplateElementId(elementId) {
|
|
8731
|
+
return elementId.startsWith("layout-") || elementId.startsWith("master-");
|
|
8732
|
+
}
|
|
8733
|
+
function collectShapeIdMap(elements) {
|
|
8734
|
+
const map = /* @__PURE__ */ new Map();
|
|
8735
|
+
const walk = (els) => {
|
|
8736
|
+
for (const el of els) {
|
|
8737
|
+
const cnvId = readCnvPrId(el.rawXml);
|
|
8738
|
+
if (cnvId) {
|
|
8739
|
+
el.shapeId = cnvId;
|
|
8740
|
+
if (!isTemplateElementId(el.id)) {
|
|
8741
|
+
map.set(cnvId, el.id);
|
|
8742
|
+
}
|
|
8743
|
+
}
|
|
8744
|
+
if (el.type === "group" && Array.isArray(el.children)) {
|
|
8745
|
+
walk(el.children);
|
|
8746
|
+
}
|
|
8747
|
+
}
|
|
8748
|
+
};
|
|
8749
|
+
walk(elements);
|
|
8750
|
+
return map;
|
|
8751
|
+
}
|
|
8752
|
+
function reconcileAnimationTargets(elements, nativeAnimations, editorAnimations) {
|
|
8753
|
+
const map = collectShapeIdMap(elements);
|
|
8754
|
+
if (map.size === 0) {
|
|
8755
|
+
return;
|
|
8756
|
+
}
|
|
8757
|
+
if (nativeAnimations) {
|
|
8758
|
+
for (const anim of nativeAnimations) {
|
|
8759
|
+
if (anim.targetId !== void 0) {
|
|
8760
|
+
const resolved = map.get(anim.targetId);
|
|
8761
|
+
if (resolved) {
|
|
8762
|
+
anim.targetId = resolved;
|
|
8763
|
+
}
|
|
8764
|
+
}
|
|
8765
|
+
if (anim.triggerShapeId !== void 0) {
|
|
8766
|
+
const resolved = map.get(anim.triggerShapeId);
|
|
8767
|
+
if (resolved) {
|
|
8768
|
+
anim.triggerShapeId = resolved;
|
|
8769
|
+
}
|
|
8770
|
+
}
|
|
8771
|
+
}
|
|
8772
|
+
}
|
|
8773
|
+
if (editorAnimations) {
|
|
8774
|
+
for (const anim of editorAnimations) {
|
|
8775
|
+
const resolvedElement = map.get(anim.elementId);
|
|
8776
|
+
if (resolvedElement) {
|
|
8777
|
+
anim.elementId = resolvedElement;
|
|
8778
|
+
}
|
|
8779
|
+
if (anim.triggerShapeId !== void 0) {
|
|
8780
|
+
const resolvedTrigger = map.get(anim.triggerShapeId);
|
|
8781
|
+
if (resolvedTrigger) {
|
|
8782
|
+
anim.triggerShapeId = resolvedTrigger;
|
|
8783
|
+
}
|
|
8784
|
+
}
|
|
8785
|
+
}
|
|
8786
|
+
}
|
|
8787
|
+
}
|
|
8788
|
+
|
|
8682
8789
|
// src/core/services/PptxSlideLoaderService.ts
|
|
8683
8790
|
var PptxSlideLoaderService = class {
|
|
8684
8791
|
/**
|
|
@@ -8819,6 +8926,7 @@ var PptxSlideLoaderService = class {
|
|
|
8819
8926
|
const transition = params.parseSlideTransition(slideXmlObj, path);
|
|
8820
8927
|
const animations = params.parseEditorAnimations(slideXmlObj);
|
|
8821
8928
|
const nativeAnimations = params.parseNativeAnimations(slideXmlObj);
|
|
8929
|
+
reconcileAnimationTargets(elements, nativeAnimations, animations);
|
|
8822
8930
|
const rawTiming = slideXmlObj["p:sld"]?.["p:timing"];
|
|
8823
8931
|
const drawingGuides = parseSlideDrawingGuides(slideXmlObj);
|
|
8824
8932
|
const customerData = await params.parseSlideCustomerData(slideXmlObj, path);
|
|
@@ -9318,6 +9426,60 @@ var PptxEditorAnimationService = class {
|
|
|
9318
9426
|
}
|
|
9319
9427
|
};
|
|
9320
9428
|
|
|
9429
|
+
// src/core/services/animation-shape-id-assign.ts
|
|
9430
|
+
function flattenElements(elements, out) {
|
|
9431
|
+
for (const el of elements) {
|
|
9432
|
+
out.push(el);
|
|
9433
|
+
if (el.type === "group" && Array.isArray(el.children)) {
|
|
9434
|
+
flattenElements(el.children, out);
|
|
9435
|
+
}
|
|
9436
|
+
}
|
|
9437
|
+
}
|
|
9438
|
+
function maxShapeId(elements) {
|
|
9439
|
+
let max = 0;
|
|
9440
|
+
for (const el of elements) {
|
|
9441
|
+
if (el.shapeId !== void 0) {
|
|
9442
|
+
const n = Number.parseInt(el.shapeId, 10);
|
|
9443
|
+
if (Number.isFinite(n) && n > max) {
|
|
9444
|
+
max = n;
|
|
9445
|
+
}
|
|
9446
|
+
}
|
|
9447
|
+
}
|
|
9448
|
+
return max;
|
|
9449
|
+
}
|
|
9450
|
+
function remapEditorAnimationsToShapeIds(elements, animations, reservedMaxId = 0) {
|
|
9451
|
+
const flat = [];
|
|
9452
|
+
flattenElements(elements, flat);
|
|
9453
|
+
const byId = /* @__PURE__ */ new Map();
|
|
9454
|
+
for (const el of flat) {
|
|
9455
|
+
byId.set(el.id, el);
|
|
9456
|
+
}
|
|
9457
|
+
let nextId2 = Math.max(maxShapeId(flat), reservedMaxId) + 1;
|
|
9458
|
+
const resolve = (elementId) => {
|
|
9459
|
+
const el = byId.get(elementId);
|
|
9460
|
+
if (!el) {
|
|
9461
|
+
return void 0;
|
|
9462
|
+
}
|
|
9463
|
+
if (el.shapeId === void 0) {
|
|
9464
|
+
el.shapeId = String(nextId2);
|
|
9465
|
+
nextId2 += 1;
|
|
9466
|
+
}
|
|
9467
|
+
return el.shapeId;
|
|
9468
|
+
};
|
|
9469
|
+
return animations.map((anim) => {
|
|
9470
|
+
const resolvedElement = resolve(anim.elementId);
|
|
9471
|
+
const resolvedTrigger = anim.triggerShapeId !== void 0 ? resolve(anim.triggerShapeId) : void 0;
|
|
9472
|
+
if (resolvedElement === void 0 && resolvedTrigger === void 0) {
|
|
9473
|
+
return anim;
|
|
9474
|
+
}
|
|
9475
|
+
return {
|
|
9476
|
+
...anim,
|
|
9477
|
+
elementId: resolvedElement ?? anim.elementId,
|
|
9478
|
+
triggerShapeId: resolvedTrigger ?? anim.triggerShapeId
|
|
9479
|
+
};
|
|
9480
|
+
});
|
|
9481
|
+
}
|
|
9482
|
+
|
|
9321
9483
|
// src/core/services/native-animation-helpers.ts
|
|
9322
9484
|
function extractSoundAction(cTn) {
|
|
9323
9485
|
const stSnd = cTn["p:stSnd"];
|
|
@@ -10540,7 +10702,7 @@ var PptxSlideTransitionService = class {
|
|
|
10540
10702
|
}
|
|
10541
10703
|
parseSlideTransition(slideXml2) {
|
|
10542
10704
|
const slideRoot = this.xmlLookupService.getChildByLocalName(slideXml2, "sld");
|
|
10543
|
-
const transitionNode = this.xmlLookupService.getChildByLocalName(slideRoot, "transition");
|
|
10705
|
+
const transitionNode = this.xmlLookupService.getChildByLocalName(slideRoot, "transition") || this.findTransitionInAlternateContent(slideRoot);
|
|
10544
10706
|
if (!transitionNode) {
|
|
10545
10707
|
return void 0;
|
|
10546
10708
|
}
|
|
@@ -10612,7 +10774,8 @@ var PptxSlideTransitionService = class {
|
|
|
10612
10774
|
transitionType = "morph";
|
|
10613
10775
|
}
|
|
10614
10776
|
}
|
|
10615
|
-
const
|
|
10777
|
+
const rawDuration = transitionNode["@_dur"] ?? transitionNode["@_p14:dur"];
|
|
10778
|
+
const parsedDuration = Number.parseInt(String(rawDuration || ""), 10);
|
|
10616
10779
|
const durationMs = Number.isFinite(parsedDuration) && parsedDuration > 0 ? parsedDuration : void 0;
|
|
10617
10780
|
const advanceOnClickToken = String(transitionNode["@_advClick"] || "").trim();
|
|
10618
10781
|
const advanceOnClick = advanceOnClickToken.length > 0 ? !["0", "false", "off"].includes(advanceOnClickToken.toLowerCase()) : void 0;
|
|
@@ -10661,6 +10824,35 @@ var PptxSlideTransitionService = class {
|
|
|
10661
10824
|
rawExtLst
|
|
10662
10825
|
};
|
|
10663
10826
|
}
|
|
10827
|
+
/**
|
|
10828
|
+
* Locate a `<p:transition>` wrapped in a slide-root `mc:AlternateContent`
|
|
10829
|
+
* envelope.
|
|
10830
|
+
*
|
|
10831
|
+
* Real PowerPoint (verified via COM-authored fixtures) wraps the
|
|
10832
|
+
* transition in `mc:AlternateContent` whenever it carries an Office
|
|
10833
|
+
* 2010+ attribute such as `p14:dur` (sub-second transition duration):
|
|
10834
|
+
* an `mc:Choice Requires="p14"` branch carries the richer transition,
|
|
10835
|
+
* and `mc:Fallback` carries a plain one for older readers. Without this
|
|
10836
|
+
* unwrap, `p:sld`'s direct-child lookup for `transition` finds nothing
|
|
10837
|
+
* and the whole transition (including plain ones falling back with no
|
|
10838
|
+
* p14 data) is silently dropped, even though `mc:Choice` is otherwise a
|
|
10839
|
+
* complete, directly usable `p:transition` node.
|
|
10840
|
+
*/
|
|
10841
|
+
findTransitionInAlternateContent(slideRoot) {
|
|
10842
|
+
const altContent = this.xmlLookupService.getChildByLocalName(slideRoot, "AlternateContent");
|
|
10843
|
+
if (!altContent) {
|
|
10844
|
+
return void 0;
|
|
10845
|
+
}
|
|
10846
|
+
const choices = this.xmlLookupService.getChildrenArrayByLocalName(altContent, "Choice");
|
|
10847
|
+
for (const choice of choices) {
|
|
10848
|
+
const transitionNode = this.xmlLookupService.getChildByLocalName(choice, "transition");
|
|
10849
|
+
if (transitionNode) {
|
|
10850
|
+
return transitionNode;
|
|
10851
|
+
}
|
|
10852
|
+
}
|
|
10853
|
+
const fallback = this.xmlLookupService.getChildByLocalName(altContent, "Fallback");
|
|
10854
|
+
return this.xmlLookupService.getChildByLocalName(fallback, "transition");
|
|
10855
|
+
}
|
|
10664
10856
|
/**
|
|
10665
10857
|
* Detects the PowerPoint 2016+ `morph` transition stored as a p159 extension
|
|
10666
10858
|
* inside the transition's extLst.
|
|
@@ -36615,6 +36807,22 @@ var PptxHandlerRuntime32 = class _PptxHandlerRuntime extends PptxHandlerRuntime3
|
|
|
36615
36807
|
|
|
36616
36808
|
// src/core/core/runtime/PptxHandlerRuntimeSaveElementWriter.ts
|
|
36617
36809
|
var PptxHandlerRuntime33 = class _PptxHandlerRuntime extends PptxHandlerRuntime32 {
|
|
36810
|
+
/**
|
|
36811
|
+
* Whether a shape XML represents a `<p:pic>` (picture-shaped) node.
|
|
36812
|
+
*
|
|
36813
|
+
* Real PowerPoint (verified via COM-authored fixtures) represents video
|
|
36814
|
+
* *and* audio media as `<p:pic>` (poster-frame blip + `p:nvPr/a:videoFile`
|
|
36815
|
+
* or `a:audioFile` + a `p14:media` extension) rather than the older
|
|
36816
|
+
* `<p:graphicFrame>` form. A `media`-typed element's `rawXml` is
|
|
36817
|
+
* therefore frequently `p:pic`-shaped, not a graphic frame; without this
|
|
36818
|
+
* check it falls into the generic `shapes` bucket, which the slide
|
|
36819
|
+
* writer serializes under `<p:sp>` -- corrupting the picture markup
|
|
36820
|
+
* (`p:nvPicPr`/`p:blipFill`) into an invalid shape and permanently
|
|
36821
|
+
* losing the media relationship on save.
|
|
36822
|
+
*/
|
|
36823
|
+
isPictureShape(shape) {
|
|
36824
|
+
return Boolean(shape["p:nvPicPr"]);
|
|
36825
|
+
}
|
|
36618
36826
|
/** Whether a shape XML represents a graphic frame. */
|
|
36619
36827
|
isGraphicFrameShape(shape) {
|
|
36620
36828
|
return Boolean(shape["p:nvGraphicFramePr"] || shape["a:graphic"] && shape["p:xfrm"]);
|
|
@@ -36730,6 +36938,34 @@ var PptxHandlerRuntime33 = class _PptxHandlerRuntime extends PptxHandlerRuntime3
|
|
|
36730
36938
|
isTemplateElementId(elementId) {
|
|
36731
36939
|
return elementId.startsWith("layout-") || elementId.startsWith("master-");
|
|
36732
36940
|
}
|
|
36941
|
+
/** Non-visual property containers that hold a `p:cNvPr`. */
|
|
36942
|
+
static NV_CONTAINERS = [
|
|
36943
|
+
"p:nvSpPr",
|
|
36944
|
+
"p:nvPicPr",
|
|
36945
|
+
"p:nvCxnSpPr",
|
|
36946
|
+
"p:nvGraphicFramePr",
|
|
36947
|
+
"p:nvGrpSpPr"
|
|
36948
|
+
];
|
|
36949
|
+
/**
|
|
36950
|
+
* Write an element's native shape id (`element.shapeId`) into the serialized
|
|
36951
|
+
* shape's `p:cNvPr/@id`. Animation targets (`p:spTgt/@spid`) reference this
|
|
36952
|
+
* id, so the two must agree for PowerPoint to bind an animation to its shape.
|
|
36953
|
+
* A no-op when the element carries no `shapeId` (nothing to reconcile) or the
|
|
36954
|
+
* shape XML has no cNvPr container.
|
|
36955
|
+
*/
|
|
36956
|
+
applyShapeIdToCnvPr(shape, el) {
|
|
36957
|
+
if (el.shapeId === void 0) {
|
|
36958
|
+
return;
|
|
36959
|
+
}
|
|
36960
|
+
for (const nvKey of _PptxHandlerRuntime.NV_CONTAINERS) {
|
|
36961
|
+
const nv = shape[nvKey];
|
|
36962
|
+
const cNvPr = nv?.["p:cNvPr"];
|
|
36963
|
+
if (cNvPr) {
|
|
36964
|
+
cNvPr["@_id"] = el.shapeId;
|
|
36965
|
+
return;
|
|
36966
|
+
}
|
|
36967
|
+
}
|
|
36968
|
+
}
|
|
36733
36969
|
/**
|
|
36734
36970
|
* Process a single slide element during save. Handles embedding,
|
|
36735
36971
|
* transforms, geometry, styles, text, and sorts into collectors.
|
|
@@ -36839,12 +37075,15 @@ var PptxHandlerRuntime33 = class _PptxHandlerRuntime extends PptxHandlerRuntime3
|
|
|
36839
37075
|
}
|
|
36840
37076
|
return;
|
|
36841
37077
|
}
|
|
37078
|
+
this.applyShapeIdToCnvPr(shape, el);
|
|
36842
37079
|
if (el.type === "picture" || el.type === "image") {
|
|
36843
37080
|
collectors.pics.push(shape);
|
|
36844
37081
|
} else if (el.type === "connector") {
|
|
36845
37082
|
collectors.connectors.push(shape);
|
|
36846
37083
|
} else if (el.type === "model3d") {
|
|
36847
37084
|
collectors.model3ds.push(shape);
|
|
37085
|
+
} else if (el.type === "media" && this.isPictureShape(shape)) {
|
|
37086
|
+
collectors.pics.push(shape);
|
|
36848
37087
|
} else if (this.isGraphicFrameShape(shape)) {
|
|
36849
37088
|
collectors.graphicFrames.push(shape);
|
|
36850
37089
|
} else {
|
|
@@ -36883,12 +37122,17 @@ var PptxHandlerRuntime34 = class extends PptxHandlerRuntime33 {
|
|
|
36883
37122
|
delete slideNode["p:transition"];
|
|
36884
37123
|
}
|
|
36885
37124
|
}
|
|
36886
|
-
|
|
36887
|
-
|
|
37125
|
+
const shapeIdAnimations = slide.animations !== void 0 ? remapEditorAnimationsToShapeIds(
|
|
37126
|
+
slide.elements,
|
|
37127
|
+
slide.animations,
|
|
37128
|
+
this.maxCnvPrId(this.ensureSlideTree(xmlObj))
|
|
37129
|
+
) : void 0;
|
|
37130
|
+
if (shapeIdAnimations !== void 0) {
|
|
37131
|
+
this.applyEditorAnimations(slideNode, shapeIdAnimations);
|
|
36888
37132
|
}
|
|
36889
|
-
if (
|
|
37133
|
+
if (shapeIdAnimations && shapeIdAnimations.length > 0) {
|
|
36890
37134
|
const generatedTiming = this.animationWriteService.buildTimingXml(
|
|
36891
|
-
|
|
37135
|
+
shapeIdAnimations,
|
|
36892
37136
|
slide.rawTiming
|
|
36893
37137
|
);
|
|
36894
37138
|
if (generatedTiming) {
|
|
@@ -37041,6 +37285,40 @@ var PptxHandlerRuntime34 = class extends PptxHandlerRuntime33 {
|
|
|
37041
37285
|
}
|
|
37042
37286
|
this.zip.file(slide.id, this.builder.build(xmlObj));
|
|
37043
37287
|
}
|
|
37288
|
+
/**
|
|
37289
|
+
* Largest `p:cNvPr/@id` already present anywhere in a shape tree, including
|
|
37290
|
+
* the implicit `<p:spTree>` group's own reserved id. Used to seed minting of
|
|
37291
|
+
* fresh animation-target shape ids so they never collide with a reserved id.
|
|
37292
|
+
*/
|
|
37293
|
+
maxCnvPrId(spTree) {
|
|
37294
|
+
let max = 0;
|
|
37295
|
+
const nvContainers = [
|
|
37296
|
+
"p:nvSpPr",
|
|
37297
|
+
"p:nvPicPr",
|
|
37298
|
+
"p:nvCxnSpPr",
|
|
37299
|
+
"p:nvGraphicFramePr",
|
|
37300
|
+
"p:nvGrpSpPr"
|
|
37301
|
+
];
|
|
37302
|
+
const visit = (node) => {
|
|
37303
|
+
for (const nvKey of nvContainers) {
|
|
37304
|
+
const nv = node[nvKey];
|
|
37305
|
+
const cNvPr = nv?.["p:cNvPr"];
|
|
37306
|
+
if (cNvPr?.["@_id"] !== void 0) {
|
|
37307
|
+
const n = Number.parseInt(String(cNvPr["@_id"]), 10);
|
|
37308
|
+
if (Number.isFinite(n) && n > max) {
|
|
37309
|
+
max = n;
|
|
37310
|
+
}
|
|
37311
|
+
}
|
|
37312
|
+
}
|
|
37313
|
+
for (const listKey of ["p:sp", "p:pic", "p:cxnSp", "p:graphicFrame", "p:grpSp"]) {
|
|
37314
|
+
for (const child of this.ensureArray(node[listKey])) {
|
|
37315
|
+
visit(child);
|
|
37316
|
+
}
|
|
37317
|
+
}
|
|
37318
|
+
};
|
|
37319
|
+
visit(spTree);
|
|
37320
|
+
return max;
|
|
37321
|
+
}
|
|
37044
37322
|
/**
|
|
37045
37323
|
* Re-wrap selected children with their original `<mc:AlternateContent>`
|
|
37046
37324
|
* envelope (CC-4).
|
|
@@ -41800,7 +42078,7 @@ var PptxHandlerRuntime57 = class extends PptxHandlerRuntime56 {
|
|
|
41800
42078
|
for (const [, target] of layoutRels.entries()) {
|
|
41801
42079
|
if (target.includes("slideMaster")) {
|
|
41802
42080
|
const layoutDir = layoutPath.substring(0, layoutPath.lastIndexOf("/") + 1);
|
|
41803
|
-
const masterPath = target.startsWith("/") ? target.substring(1) : target.startsWith("..") ? this.resolvePath(layoutDir, target) : `ppt/${target.replace(
|
|
42081
|
+
const masterPath = target.startsWith("/") ? target.substring(1) : target.startsWith("..") ? this.resolvePath(layoutDir, target) : `ppt/${target.replace(/\.\.\//g, "")}`;
|
|
41804
42082
|
try {
|
|
41805
42083
|
const masterXmlStr = await this.zip.file(masterPath)?.async("string");
|
|
41806
42084
|
if (masterXmlStr) {
|
|
@@ -41824,7 +42102,7 @@ var PptxHandlerRuntime57 = class extends PptxHandlerRuntime56 {
|
|
|
41824
42102
|
for (const [, target] of slideRels.entries()) {
|
|
41825
42103
|
if (target.includes("slideLayout")) {
|
|
41826
42104
|
const slideDir = slidePath.substring(0, slidePath.lastIndexOf("/") + 1);
|
|
41827
|
-
const layoutPath = target.startsWith("/") ? target.substring(1) : target.startsWith("..") ? this.resolvePath(slideDir, target) : `ppt/${target.replace(
|
|
42105
|
+
const layoutPath = target.startsWith("/") ? target.substring(1) : target.startsWith("..") ? this.resolvePath(slideDir, target) : `ppt/${target.replace(/\.\.\//g, "")}`;
|
|
41828
42106
|
try {
|
|
41829
42107
|
const layoutXmlStr = await this.zip.file(layoutPath)?.async("string");
|
|
41830
42108
|
if (layoutXmlStr) {
|
|
@@ -41852,7 +42130,7 @@ var PptxHandlerRuntime57 = class extends PptxHandlerRuntime56 {
|
|
|
41852
42130
|
for (const [, target] of slideRels.entries()) {
|
|
41853
42131
|
if (target.includes("slideLayout")) {
|
|
41854
42132
|
const slideDir = slidePath.substring(0, slidePath.lastIndexOf("/") + 1);
|
|
41855
|
-
const layoutPath = target.startsWith("/") ? target.substring(1) : target.startsWith("..") ? this.resolvePath(slideDir, target) : `ppt/${target.replace(
|
|
42133
|
+
const layoutPath = target.startsWith("/") ? target.substring(1) : target.startsWith("..") ? this.resolvePath(slideDir, target) : `ppt/${target.replace(/\.\.\//g, "")}`;
|
|
41856
42134
|
try {
|
|
41857
42135
|
const layoutXmlStr = await this.zip.file(layoutPath)?.async("string");
|
|
41858
42136
|
if (layoutXmlStr) {
|
|
@@ -41881,7 +42159,7 @@ var PptxHandlerRuntime57 = class extends PptxHandlerRuntime56 {
|
|
|
41881
42159
|
for (const [, target] of layoutRels.entries()) {
|
|
41882
42160
|
if (target.includes("slideMaster")) {
|
|
41883
42161
|
const layoutDir = layoutPath.substring(0, layoutPath.lastIndexOf("/") + 1);
|
|
41884
|
-
const masterPath = target.startsWith("/") ? target.substring(1) : target.startsWith("..") ? this.resolvePath(layoutDir, target) : `ppt/${target.replace(
|
|
42162
|
+
const masterPath = target.startsWith("/") ? target.substring(1) : target.startsWith("..") ? this.resolvePath(layoutDir, target) : `ppt/${target.replace(/\.\.\//g, "")}`;
|
|
41885
42163
|
try {
|
|
41886
42164
|
const masterXmlStr = await this.zip.file(masterPath)?.async("string");
|
|
41887
42165
|
if (masterXmlStr) {
|
|
@@ -41910,7 +42188,7 @@ var PptxHandlerRuntime58 = class extends PptxHandlerRuntime57 {
|
|
|
41910
42188
|
for (const [, target] of slideRels.entries()) {
|
|
41911
42189
|
if (target.includes("slideLayout")) {
|
|
41912
42190
|
const slideDir = slidePath.substring(0, slidePath.lastIndexOf("/") + 1);
|
|
41913
|
-
const layoutPath = target.startsWith("/") ? target.substring(1) : target.startsWith("..") ? this.resolvePath(slideDir, target) : `ppt/${target.replace(
|
|
42191
|
+
const layoutPath = target.startsWith("/") ? target.substring(1) : target.startsWith("..") ? this.resolvePath(slideDir, target) : `ppt/${target.replace(/\.\.\//g, "")}`;
|
|
41914
42192
|
try {
|
|
41915
42193
|
const layoutXmlStr = await this.zip.file(layoutPath)?.async("string");
|
|
41916
42194
|
if (layoutXmlStr) {
|
|
@@ -41939,7 +42217,7 @@ var PptxHandlerRuntime58 = class extends PptxHandlerRuntime57 {
|
|
|
41939
42217
|
for (const [, target] of layoutRels.entries()) {
|
|
41940
42218
|
if (target.includes("slideMaster")) {
|
|
41941
42219
|
const layoutDir = layoutPath.substring(0, layoutPath.lastIndexOf("/") + 1);
|
|
41942
|
-
const masterPath = target.startsWith("/") ? target.substring(1) : target.startsWith("..") ? this.resolvePath(layoutDir, target) : `ppt/${target.replace(
|
|
42220
|
+
const masterPath = target.startsWith("/") ? target.substring(1) : target.startsWith("..") ? this.resolvePath(layoutDir, target) : `ppt/${target.replace(/\.\.\//g, "")}`;
|
|
41943
42221
|
try {
|
|
41944
42222
|
const masterXmlStr = await this.zip.file(masterPath)?.async("string");
|
|
41945
42223
|
if (masterXmlStr) {
|
|
@@ -41964,7 +42242,7 @@ var PptxHandlerRuntime58 = class extends PptxHandlerRuntime57 {
|
|
|
41964
42242
|
for (const [, target] of slideRels.entries()) {
|
|
41965
42243
|
if (target.includes("slideLayout")) {
|
|
41966
42244
|
const slideDir = slidePath.substring(0, slidePath.lastIndexOf("/") + 1);
|
|
41967
|
-
return target.startsWith("/") ? target.substring(1) : target.startsWith("..") ? this.resolvePath(slideDir, target) : `ppt/${target.replace(
|
|
42245
|
+
return target.startsWith("/") ? target.substring(1) : target.startsWith("..") ? this.resolvePath(slideDir, target) : `ppt/${target.replace(/\.\.\//g, "")}`;
|
|
41968
42246
|
}
|
|
41969
42247
|
}
|
|
41970
42248
|
return void 0;
|
|
@@ -41980,7 +42258,7 @@ var PptxHandlerRuntime58 = class extends PptxHandlerRuntime57 {
|
|
|
41980
42258
|
for (const [, target] of layoutRels.entries()) {
|
|
41981
42259
|
if (target.includes("slideMaster")) {
|
|
41982
42260
|
const layoutDir = layoutPath.substring(0, layoutPath.lastIndexOf("/") + 1);
|
|
41983
|
-
return target.startsWith("/") ? target.substring(1) : target.startsWith("..") ? this.resolvePath(layoutDir, target) : `ppt/${target.replace(
|
|
42261
|
+
return target.startsWith("/") ? target.substring(1) : target.startsWith("..") ? this.resolvePath(layoutDir, target) : `ppt/${target.replace(/\.\.\//g, "")}`;
|
|
41984
42262
|
}
|
|
41985
42263
|
}
|
|
41986
42264
|
return void 0;
|
|
@@ -42624,7 +42902,7 @@ var PptxHandlerRuntime61 = class extends PptxHandlerRuntime60 {
|
|
|
42624
42902
|
for (const [, target] of layoutRels.entries()) {
|
|
42625
42903
|
if (target.includes("slideMaster")) {
|
|
42626
42904
|
const layoutDir = layoutPath.substring(0, layoutPath.lastIndexOf("/") + 1);
|
|
42627
|
-
masterPath = target.startsWith("/") ? target.substring(1) : target.startsWith("..") ? this.resolvePath(layoutDir, target) : `ppt/${target.replace(
|
|
42905
|
+
masterPath = target.startsWith("/") ? target.substring(1) : target.startsWith("..") ? this.resolvePath(layoutDir, target) : `ppt/${target.replace(/\.\.\//g, "")}`;
|
|
42628
42906
|
break;
|
|
42629
42907
|
}
|
|
42630
42908
|
}
|
|
@@ -42758,7 +43036,7 @@ var PptxHandlerRuntime62 = class extends PptxHandlerRuntime61 {
|
|
|
42758
43036
|
for (const [, target] of slideRels.entries()) {
|
|
42759
43037
|
if (target.includes("slideLayout")) {
|
|
42760
43038
|
const slideDir = slidePath.substring(0, slidePath.lastIndexOf("/") + 1);
|
|
42761
|
-
layoutPath = target.startsWith("/") ? target.substring(1) : target.startsWith("..") ? this.resolvePath(slideDir, target) : `ppt/${target.replace(
|
|
43039
|
+
layoutPath = target.startsWith("/") ? target.substring(1) : target.startsWith("..") ? this.resolvePath(slideDir, target) : `ppt/${target.replace(/\.\.\//g, "")}`;
|
|
42762
43040
|
break;
|
|
42763
43041
|
}
|
|
42764
43042
|
}
|
|
@@ -46510,7 +46788,7 @@ var PptxHandlerRuntime78 = class extends PptxHandlerRuntime77 {
|
|
|
46510
46788
|
}
|
|
46511
46789
|
return stack.join("/");
|
|
46512
46790
|
}
|
|
46513
|
-
return `ppt/${target.replace(
|
|
46791
|
+
return `ppt/${target.replace(/\.\.\//g, "")}`;
|
|
46514
46792
|
}
|
|
46515
46793
|
}
|
|
46516
46794
|
return void 0;
|
|
@@ -46759,7 +47037,22 @@ var PptxHandlerRuntime79 = class _PptxHandlerRuntime extends PptxHandlerRuntime7
|
|
|
46759
47037
|
await this.enrichOleElementsWithEmbeddedData(el.children, slidePath, depth + 1);
|
|
46760
47038
|
continue;
|
|
46761
47039
|
}
|
|
46762
|
-
if (el.type !== "ole"
|
|
47040
|
+
if (el.type !== "ole") {
|
|
47041
|
+
continue;
|
|
47042
|
+
}
|
|
47043
|
+
if (el.previewImage && !el.previewImageData) {
|
|
47044
|
+
try {
|
|
47045
|
+
const previewPath = this.resolveImagePath(slidePath, el.previewImage);
|
|
47046
|
+
if (previewPath) {
|
|
47047
|
+
const previewData = await this.getImageData(previewPath);
|
|
47048
|
+
if (previewData) {
|
|
47049
|
+
el.previewImageData = previewData;
|
|
47050
|
+
}
|
|
47051
|
+
}
|
|
47052
|
+
} catch {
|
|
47053
|
+
}
|
|
47054
|
+
}
|
|
47055
|
+
if (el.isLinked || !el.oleTarget) {
|
|
46763
47056
|
continue;
|
|
46764
47057
|
}
|
|
46765
47058
|
try {
|
|
@@ -47055,7 +47348,7 @@ var PptxHandlerRuntime80 = class extends PptxHandlerRuntime79 {
|
|
|
47055
47348
|
for (const [, target] of layoutRels.entries()) {
|
|
47056
47349
|
if (target.includes("slideMaster")) {
|
|
47057
47350
|
const layoutDir = layoutPath.substring(0, layoutPath.lastIndexOf("/") + 1);
|
|
47058
|
-
return target.startsWith("/") ? target.substring(1) : target.startsWith("..") ? this.resolvePath(layoutDir, target) : `ppt/${target.replace(
|
|
47351
|
+
return target.startsWith("/") ? target.substring(1) : target.startsWith("..") ? this.resolvePath(layoutDir, target) : `ppt/${target.replace(/\.\.\//g, "")}`;
|
|
47059
47352
|
}
|
|
47060
47353
|
}
|
|
47061
47354
|
return void 0;
|
|
@@ -47124,7 +47417,7 @@ var PptxHandlerRuntime80 = class extends PptxHandlerRuntime79 {
|
|
|
47124
47417
|
for (const [, target] of masterRels.entries()) {
|
|
47125
47418
|
if (target.includes("slideLayout")) {
|
|
47126
47419
|
const masterDir = masterPath.substring(0, masterPath.lastIndexOf("/") + 1);
|
|
47127
|
-
const resolved = target.startsWith("/") ? target.substring(1) : target.startsWith("..") ? this.resolvePath(masterDir, target) : `ppt/${target.replace(
|
|
47420
|
+
const resolved = target.startsWith("/") ? target.substring(1) : target.startsWith("..") ? this.resolvePath(masterDir, target) : `ppt/${target.replace(/\.\.\//g, "")}`;
|
|
47128
47421
|
masterLayoutPaths.add(resolved);
|
|
47129
47422
|
}
|
|
47130
47423
|
}
|
|
@@ -56011,7 +56304,7 @@ function getShapeClipPathFromPreset(shapeType, width, height, adjustments) {
|
|
|
56011
56304
|
if (!result || result.svgPath === "") {
|
|
56012
56305
|
return void 0;
|
|
56013
56306
|
}
|
|
56014
|
-
const escaped = result.svgPath.replace(/'/g, "\\'");
|
|
56307
|
+
const escaped = result.svgPath.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
|
|
56015
56308
|
return `path('${escaped}')`;
|
|
56016
56309
|
}
|
|
56017
56310
|
function getRoundRectRadiusPx(element) {
|
|
@@ -57942,7 +58235,7 @@ function moveSlidesToSection(data, slideIndices, targetSectionId) {
|
|
|
57942
58235
|
}
|
|
57943
58236
|
|
|
57944
58237
|
// src/core/builders/sdk/template-engine-helpers.ts
|
|
57945
|
-
var PLACEHOLDER_RE = /\{\{([^}]+)\}\}/g;
|
|
58238
|
+
var PLACEHOLDER_RE = /\{\{([^{}]+)\}\}/g;
|
|
57946
58239
|
var EACH_OPEN_RE = /^\s*#each\s+([\w.]+)\s*$/;
|
|
57947
58240
|
var EACH_CLOSE_RE = /^\s*\/each\s*$/;
|
|
57948
58241
|
var IF_OPEN_RE = /^\s*#if\s+(!?[\w.]+)\s*$/;
|
|
@@ -58006,7 +58299,7 @@ function processInlineConditionals(text, data) {
|
|
|
58006
58299
|
let safety = 0;
|
|
58007
58300
|
const MAX_ITERATIONS = 100;
|
|
58008
58301
|
while (safety++ < MAX_ITERATIONS) {
|
|
58009
|
-
const ifOpenPattern = /\{\{\s*#if\s+([
|
|
58302
|
+
const ifOpenPattern = /\{\{\s*#if\s+(!?[\w.]+)\s*\}\}((?:(?!\{\{\s*#if\s)(?!\{\{\s*\/if\s*\}\}).)*?)\{\{\s*\/if\s*\}\}/s;
|
|
58010
58303
|
const match = ifOpenPattern.exec(result);
|
|
58011
58304
|
if (!match) {
|
|
58012
58305
|
break;
|
|
@@ -58018,6 +58311,8 @@ function processInlineConditionals(text, data) {
|
|
|
58018
58311
|
}
|
|
58019
58312
|
return result;
|
|
58020
58313
|
}
|
|
58314
|
+
|
|
58315
|
+
// src/core/builders/sdk/template-engine-segments.ts
|
|
58021
58316
|
function replaceTokensAcrossSegments(segments, data) {
|
|
58022
58317
|
if (segments.length === 0) {
|
|
58023
58318
|
return;
|
|
@@ -58038,7 +58333,7 @@ function replaceTokensAcrossSegments(segments, data) {
|
|
|
58038
58333
|
const fullText = textParts.join("");
|
|
58039
58334
|
const afterConditionals = processInlineConditionals(fullText, data);
|
|
58040
58335
|
if (afterConditionals !== fullText) {
|
|
58041
|
-
redistributeText(segments,
|
|
58336
|
+
redistributeText(segments, fullText, afterConditionals);
|
|
58042
58337
|
replaceTokensAcrossSegments(segments, data);
|
|
58043
58338
|
return;
|
|
58044
58339
|
}
|
|
@@ -58096,7 +58391,7 @@ function replaceTokensAcrossSegments(segments, data) {
|
|
|
58096
58391
|
}
|
|
58097
58392
|
}
|
|
58098
58393
|
}
|
|
58099
|
-
function redistributeText(segments,
|
|
58394
|
+
function redistributeText(segments, _originalFull, newFull) {
|
|
58100
58395
|
let placed = false;
|
|
58101
58396
|
for (const seg of segments) {
|
|
58102
58397
|
if (seg.isParagraphBreak) {
|
|
@@ -58338,15 +58633,81 @@ async function mailMerge(handler, data, records) {
|
|
|
58338
58633
|
}
|
|
58339
58634
|
|
|
58340
58635
|
// src/core/builders/sdk/text-operations.ts
|
|
58341
|
-
function
|
|
58636
|
+
function toSearchRegex(search) {
|
|
58342
58637
|
if (typeof search === "string") {
|
|
58343
58638
|
const escaped = search.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
58344
58639
|
return new RegExp(escaped, "g");
|
|
58345
58640
|
}
|
|
58346
|
-
|
|
58347
|
-
|
|
58641
|
+
return search;
|
|
58642
|
+
}
|
|
58643
|
+
function execAll(regex, text) {
|
|
58644
|
+
const results = [];
|
|
58645
|
+
if (regex.global || regex.sticky) {
|
|
58646
|
+
regex.lastIndex = 0;
|
|
58647
|
+
let match;
|
|
58648
|
+
while ((match = regex.exec(text)) !== null) {
|
|
58649
|
+
results.push(match);
|
|
58650
|
+
if (match[0].length === 0) {
|
|
58651
|
+
regex.lastIndex += 1;
|
|
58652
|
+
}
|
|
58653
|
+
}
|
|
58654
|
+
return results;
|
|
58348
58655
|
}
|
|
58349
|
-
|
|
58656
|
+
let offset = 0;
|
|
58657
|
+
let remaining = text;
|
|
58658
|
+
while (remaining.length > 0) {
|
|
58659
|
+
const match = regex.exec(remaining);
|
|
58660
|
+
if (!match) {
|
|
58661
|
+
break;
|
|
58662
|
+
}
|
|
58663
|
+
const adjusted = [...match];
|
|
58664
|
+
adjusted.index = offset + match.index;
|
|
58665
|
+
adjusted.input = text;
|
|
58666
|
+
adjusted.groups = match.groups;
|
|
58667
|
+
results.push(adjusted);
|
|
58668
|
+
const advance = match.index + (match[0].length || 1);
|
|
58669
|
+
offset += advance;
|
|
58670
|
+
remaining = remaining.slice(advance);
|
|
58671
|
+
}
|
|
58672
|
+
return results;
|
|
58673
|
+
}
|
|
58674
|
+
function expandReplacement(replacement, match, fullText) {
|
|
58675
|
+
return replacement.replace(
|
|
58676
|
+
/\$(\$|&|`|'|<([^>]+)>|\d{1,2})/g,
|
|
58677
|
+
(whole, token, groupName) => {
|
|
58678
|
+
if (token === "$") {
|
|
58679
|
+
return "$";
|
|
58680
|
+
}
|
|
58681
|
+
if (token === "&") {
|
|
58682
|
+
return match[0];
|
|
58683
|
+
}
|
|
58684
|
+
if (token === "`") {
|
|
58685
|
+
return fullText.slice(0, match.index);
|
|
58686
|
+
}
|
|
58687
|
+
if (token === "'") {
|
|
58688
|
+
return fullText.slice(match.index + match[0].length);
|
|
58689
|
+
}
|
|
58690
|
+
if (groupName !== void 0) {
|
|
58691
|
+
return match.groups?.[groupName] ?? "";
|
|
58692
|
+
}
|
|
58693
|
+
const groupIndex = Number(token);
|
|
58694
|
+
return groupIndex >= 1 && groupIndex < match.length ? match[groupIndex] ?? "" : whole;
|
|
58695
|
+
}
|
|
58696
|
+
);
|
|
58697
|
+
}
|
|
58698
|
+
function applyReplacements(text, matches, replacement) {
|
|
58699
|
+
if (matches.length === 0) {
|
|
58700
|
+
return text;
|
|
58701
|
+
}
|
|
58702
|
+
let result = "";
|
|
58703
|
+
let cursor = 0;
|
|
58704
|
+
for (const match of matches) {
|
|
58705
|
+
result += text.slice(cursor, match.index);
|
|
58706
|
+
result += expandReplacement(replacement, match, text);
|
|
58707
|
+
cursor = match.index + match[0].length;
|
|
58708
|
+
}
|
|
58709
|
+
result += text.slice(cursor);
|
|
58710
|
+
return result;
|
|
58350
58711
|
}
|
|
58351
58712
|
function collectElements(elements) {
|
|
58352
58713
|
const result = [];
|
|
@@ -58362,7 +58723,7 @@ function findText(slides, search) {
|
|
|
58362
58723
|
if (typeof search === "string" && search === "") {
|
|
58363
58724
|
return [];
|
|
58364
58725
|
}
|
|
58365
|
-
const regex =
|
|
58726
|
+
const regex = toSearchRegex(search);
|
|
58366
58727
|
const results = [];
|
|
58367
58728
|
slides.forEach((slide, slideIndex) => {
|
|
58368
58729
|
const allElements = collectElements(slide.elements ?? []);
|
|
@@ -58373,9 +58734,7 @@ function findText(slides, search) {
|
|
|
58373
58734
|
const segments = element.textSegments ?? [];
|
|
58374
58735
|
segments.forEach((seg, segIndex) => {
|
|
58375
58736
|
const text = seg.text ?? "";
|
|
58376
|
-
regex
|
|
58377
|
-
let match;
|
|
58378
|
-
while ((match = regex.exec(text)) !== null) {
|
|
58737
|
+
for (const match of execAll(regex, text)) {
|
|
58379
58738
|
results.push({
|
|
58380
58739
|
slideIndex,
|
|
58381
58740
|
elementId: element.id,
|
|
@@ -58383,9 +58742,6 @@ function findText(slides, search) {
|
|
|
58383
58742
|
text: match[0],
|
|
58384
58743
|
matchIndex: match.index
|
|
58385
58744
|
});
|
|
58386
|
-
if (match[0].length === 0) {
|
|
58387
|
-
regex.lastIndex += 1;
|
|
58388
|
-
}
|
|
58389
58745
|
}
|
|
58390
58746
|
});
|
|
58391
58747
|
}
|
|
@@ -58396,7 +58752,7 @@ function replaceTextInSlide(slide, search, replacement) {
|
|
|
58396
58752
|
if (typeof search === "string" && search === "") {
|
|
58397
58753
|
return 0;
|
|
58398
58754
|
}
|
|
58399
|
-
const regex =
|
|
58755
|
+
const regex = toSearchRegex(search);
|
|
58400
58756
|
let totalReplacements = 0;
|
|
58401
58757
|
function processElements2(elements) {
|
|
58402
58758
|
for (const element of elements) {
|
|
@@ -58408,23 +58764,12 @@ function replaceTextInSlide(slide, search, replacement) {
|
|
|
58408
58764
|
}
|
|
58409
58765
|
const segments = element.textSegments ?? [];
|
|
58410
58766
|
let elementTextChanged = false;
|
|
58411
|
-
for (
|
|
58412
|
-
const seg = segments[segIdx];
|
|
58767
|
+
for (const seg of segments) {
|
|
58413
58768
|
const originalText = seg.text ?? "";
|
|
58414
|
-
|
|
58415
|
-
|
|
58416
|
-
|
|
58417
|
-
|
|
58418
|
-
while ((m = countRegex.exec(originalText)) !== null) {
|
|
58419
|
-
matchCount++;
|
|
58420
|
-
if (m[0].length === 0) {
|
|
58421
|
-
countRegex.lastIndex += 1;
|
|
58422
|
-
}
|
|
58423
|
-
}
|
|
58424
|
-
if (matchCount > 0) {
|
|
58425
|
-
const newText = originalText.replace(toGlobalRegex(search), replacement);
|
|
58426
|
-
seg.text = newText;
|
|
58427
|
-
totalReplacements += matchCount;
|
|
58769
|
+
const matches = execAll(regex, originalText);
|
|
58770
|
+
if (matches.length > 0) {
|
|
58771
|
+
seg.text = applyReplacements(originalText, matches, replacement);
|
|
58772
|
+
totalReplacements += matches.length;
|
|
58428
58773
|
elementTextChanged = true;
|
|
58429
58774
|
}
|
|
58430
58775
|
}
|
|
@@ -62388,7 +62733,7 @@ ${htmlRows.join("\n")}
|
|
|
62388
62733
|
return parts.join("").trim();
|
|
62389
62734
|
}
|
|
62390
62735
|
escapeMarkdownTableCell(text) {
|
|
62391
|
-
return text.replace(/\|/g, "\\|").replace(/\n+/g, " ").trim();
|
|
62736
|
+
return text.replace(/\\/g, "\\\\").replace(/\|/g, "\\|").replace(/\n+/g, " ").trim();
|
|
62392
62737
|
}
|
|
62393
62738
|
};
|
|
62394
62739
|
|
|
@@ -65439,9 +65784,11 @@ exports.pt = pt;
|
|
|
65439
65784
|
exports.reResolveSlideColors = reResolveSlideColors;
|
|
65440
65785
|
exports.readFileAsDataUrl = readFileAsDataUrl;
|
|
65441
65786
|
exports.rebuildTableStructureInRawXml = rebuildTableStructureInRawXml;
|
|
65787
|
+
exports.reconcileAnimationTargets = reconcileAnimationTargets;
|
|
65442
65788
|
exports.reflowSmartArtLayout = reflowSmartArtLayout;
|
|
65443
65789
|
exports.relativeLuminance = relativeLuminance;
|
|
65444
65790
|
exports.relayoutSmartArt = relayoutSmartArt;
|
|
65791
|
+
exports.remapEditorAnimationsToShapeIds = remapEditorAnimationsToShapeIds;
|
|
65445
65792
|
exports.removeChartCategory = removeChartCategory;
|
|
65446
65793
|
exports.removeChartSeries = removeChartSeries;
|
|
65447
65794
|
exports.removeSection = removeSection;
|