ooxml-core 1.27.1 → 1.28.0
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/{PptxHandler-OIR3ZY4Q.mjs → PptxHandler-AFVUHNJO.mjs} +3 -3
- package/dist/PptxHandler-EZW4YAWL.mjs +4 -0
- package/dist/{PptxHandler-NHOKKZ4S.cjs → PptxHandler-WI23AJHM.cjs} +3 -3
- package/dist/{PresentationBuilder-RFTSZUPR.mjs → PresentationBuilder-DYEHCRHX.mjs} +2 -2
- package/dist/{PresentationBuilder-EX6DAE5X.cjs → PresentationBuilder-KUNPJTRL.cjs} +5 -5
- package/dist/{PresentationBuilder-X5WFSHLB.mjs → PresentationBuilder-WGTZPVOG.mjs} +3 -3
- package/dist/automation/index.cjs +16 -7
- package/dist/automation/index.mjs +16 -7
- package/dist/chart/index.cjs +16 -7
- package/dist/chart/index.mjs +16 -7
- package/dist/{chunk-36TR3PER.cjs → chunk-A2PC3CBO.cjs} +28 -7
- package/dist/{chunk-ZWTXVWMY.mjs → chunk-D7CAHL6J.mjs} +1 -1
- package/dist/{chunk-JJ37PCNR.mjs → chunk-EYCM7RVL.mjs} +28 -7
- package/dist/{chunk-DMJIDRJE.cjs → chunk-IQ7CB7BJ.cjs} +1771 -1319
- package/dist/{chunk-5NJPYCGO.mjs → chunk-LGSBK3BV.mjs} +258 -258
- package/dist/{chunk-I57SMSU6.mjs → chunk-LNPVKKR5.mjs} +28 -7
- package/dist/{chunk-GZ4DIXZZ.mjs → chunk-N5ROEHEQ.mjs} +699 -247
- package/dist/{chunk-QIMNQDON.mjs → chunk-RCEHCVLC.mjs} +1 -1
- package/dist/{chunk-BXZF7H5G.mjs → chunk-V33RUK4D.mjs} +5 -5
- package/dist/{chunk-5KJAQKZG.mjs → chunk-YNGMSNF4.mjs} +718 -246
- package/dist/docx/embedded.cjs +16 -7
- package/dist/docx/embedded.mjs +16 -7
- package/dist/docx/index.cjs +16 -7
- package/dist/docx/index.mjs +16 -7
- package/dist/docx/load/index.cjs +16 -7
- package/dist/docx/load/index.mjs +16 -7
- package/dist/index.cjs +16 -7
- package/dist/index.mjs +16 -7
- package/dist/opc/index.cjs +16 -7
- package/dist/opc/index.mjs +16 -7
- package/dist/opc/zip-limits.d.ts +8 -1
- package/dist/opc/zip-limits.d.ts.map +1 -1
- package/dist/pptx/automation/index.cjs +1009 -505
- package/dist/pptx/automation/index.d.ts +4 -4
- package/dist/pptx/automation/index.mjs +6 -6
- package/dist/pptx/chunks/{index-D8DNpc1X.d.ts → index-0slnMhMO.d.ts} +161 -12
- package/dist/pptx/chunks/index-0slnMhMO.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-D4FnOx6x.d.ts → index-DP-R2qY1.d.ts} +3 -3
- package/dist/pptx/chunks/{index-D4FnOx6x.d.ts.map → index-DP-R2qY1.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-GWpMAY-f.d.ts → index-OQwOyNYK.d.ts} +4 -4
- package/dist/pptx/chunks/{index-GWpMAY-f.d.ts.map → index-OQwOyNYK.d.ts.map} +1 -1
- package/dist/pptx/chunks/{text-operations-CNfUj45U.d.ts → text-operations-dyvh8gyE.d.ts} +23 -1
- package/dist/pptx/chunks/{text-operations-CNfUj45U.d.ts.map → text-operations-dyvh8gyE.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +834 -333
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +5 -5
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +3 -3
- package/dist/pptx/editor/render/find-replace.cjs +14 -14
- package/dist/pptx/editor/render/find-replace.d.ts +2 -2
- package/dist/pptx/editor/render/find-replace.mjs +1 -1
- package/dist/pptx/editor/render/slide-operations.cjs +8 -8
- package/dist/pptx/editor/render/slide-operations.mjs +2 -2
- package/dist/pptx/index.cjs +1249 -726
- package/dist/pptx/index.d.ts +5 -5
- package/dist/pptx/index.mjs +6 -6
- package/dist/pptx/node/index.d.ts +1 -1
- package/dist/pptx/signature-node/index.cjs +28 -7
- package/dist/pptx/signature-node/index.mjs +2 -2
- package/dist/visio/index.cjs +14 -6
- package/dist/visio/index.mjs +14 -6
- package/dist/visio/ui/index.cjs +14 -6
- package/dist/visio/ui/index.mjs +14 -6
- package/dist/xlsx/index.cjs +14 -6
- package/dist/xlsx/index.mjs +14 -6
- package/dist/xlsx/load/index.cjs +14 -6
- package/dist/xlsx/load/index.mjs +14 -6
- package/dist/xlsx/ui/index.cjs +14 -6
- package/dist/xlsx/ui/index.mjs +14 -6
- package/package.json +5 -5
- package/dist/PptxHandler-TZJNIXPX.mjs +0 -4
- package/dist/pptx/chunks/index-D8DNpc1X.d.ts.map +0 -1
|
@@ -1261,7 +1261,7 @@ function ensureArrayLocal(value) {
|
|
|
1261
1261
|
return Array.isArray(value) ? value : value === void 0 ? [] : [value];
|
|
1262
1262
|
}
|
|
1263
1263
|
function countsSignature(counts) {
|
|
1264
|
-
return [...counts.entries()].sort((a, b) => a[0] < b[0] ? -1 : 1).map(([name,
|
|
1264
|
+
return [...counts.entries()].sort((a, b) => a[0] < b[0] ? -1 : 1).map(([name, count2]) => `${name}:${count2}`).join(",");
|
|
1265
1265
|
}
|
|
1266
1266
|
function pathSignature(path4) {
|
|
1267
1267
|
const counts = /* @__PURE__ */ new Map();
|
|
@@ -4501,7 +4501,7 @@ function resolveLimits(limits) {
|
|
|
4501
4501
|
maxEntryBytes: limits.maxEntryBytes ?? DEFAULT_ZIP_LIMITS.maxEntryBytes,
|
|
4502
4502
|
maxTotalBytes: limits.maxTotalBytes ?? DEFAULT_ZIP_LIMITS.maxTotalBytes,
|
|
4503
4503
|
label: limits.label ?? "ZIP",
|
|
4504
|
-
fail: (message, limit, kind) => create2 ? create2(message, { limit, kind }) : new ZipLimitError(message, { limit, kind })
|
|
4504
|
+
fail: (message, limit, kind, actual) => create2 ? create2(message, { limit, kind, actual }) : new ZipLimitError(message, { limit, kind, actual })
|
|
4505
4505
|
};
|
|
4506
4506
|
}
|
|
4507
4507
|
async function inflateEntryGuarded(entry2, alreadyRead, limits) {
|
|
@@ -4555,7 +4555,8 @@ async function* streamEntryGuarded(entry2, alreadyRead, limits) {
|
|
|
4555
4555
|
r.fail(
|
|
4556
4556
|
`${r.label} part ${entry2.name} inflates past its declared size`,
|
|
4557
4557
|
r.maxEntryBytes,
|
|
4558
|
-
size > declared ? "declaredSize" : "maxEntryBytes"
|
|
4558
|
+
size > declared ? "declaredSize" : "maxEntryBytes",
|
|
4559
|
+
size
|
|
4559
4560
|
)
|
|
4560
4561
|
);
|
|
4561
4562
|
if (alreadyRead + size > r.maxTotalBytes)
|
|
@@ -4563,7 +4564,8 @@ async function* streamEntryGuarded(entry2, alreadyRead, limits) {
|
|
|
4563
4564
|
r.fail(
|
|
4564
4565
|
`${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
|
|
4565
4566
|
r.maxTotalBytes,
|
|
4566
|
-
"maxTotalBytes"
|
|
4567
|
+
"maxTotalBytes",
|
|
4568
|
+
alreadyRead + size
|
|
4567
4569
|
)
|
|
4568
4570
|
);
|
|
4569
4571
|
queue.push(chunk2);
|
|
@@ -4610,7 +4612,8 @@ function guardZip(zip, limits = {}) {
|
|
|
4610
4612
|
throw r.fail(
|
|
4611
4613
|
`${r.label} package exceeds the ${r.maxEntries.toLocaleString("en-US")} part limit`,
|
|
4612
4614
|
r.maxEntries,
|
|
4613
|
-
"maxEntries"
|
|
4615
|
+
"maxEntries",
|
|
4616
|
+
entries.length
|
|
4614
4617
|
);
|
|
4615
4618
|
let declared = 0;
|
|
4616
4619
|
for (const entry2 of entries) {
|
|
@@ -4623,7 +4626,8 @@ function guardZip(zip, limits = {}) {
|
|
|
4623
4626
|
throw r.fail(
|
|
4624
4627
|
`${r.label} part ${entry2.name} exceeds the uncompressed part size limit`,
|
|
4625
4628
|
r.maxEntryBytes,
|
|
4626
|
-
"maxEntryBytes"
|
|
4629
|
+
"maxEntryBytes",
|
|
4630
|
+
size
|
|
4627
4631
|
);
|
|
4628
4632
|
declared += size;
|
|
4629
4633
|
}
|
|
@@ -4631,7 +4635,8 @@ function guardZip(zip, limits = {}) {
|
|
|
4631
4635
|
throw r.fail(
|
|
4632
4636
|
`${r.label} package exceeds the ${mib(r.maxTotalBytes)} MiB uncompressed content limit`,
|
|
4633
4637
|
r.maxTotalBytes,
|
|
4634
|
-
"maxTotalBytes"
|
|
4638
|
+
"maxTotalBytes",
|
|
4639
|
+
declared
|
|
4635
4640
|
);
|
|
4636
4641
|
const produced = /* @__PURE__ */ new Map();
|
|
4637
4642
|
let total = 0;
|
|
@@ -4670,7 +4675,8 @@ async function openZip(input2, limits = {}) {
|
|
|
4670
4675
|
throw r.fail(
|
|
4671
4676
|
`${r.label} package exceeds the ${mib(maxInput)} MiB compressed input limit`,
|
|
4672
4677
|
maxInput,
|
|
4673
|
-
"maxInputBytes"
|
|
4678
|
+
"maxInputBytes",
|
|
4679
|
+
bytes.byteLength
|
|
4674
4680
|
);
|
|
4675
4681
|
return guardZip(await JSZip__default.default.loadAsync(bytes), limits);
|
|
4676
4682
|
}
|
|
@@ -4688,11 +4694,14 @@ var init_zip_limits = __esm({
|
|
|
4688
4694
|
limit;
|
|
4689
4695
|
/** The check that failed (absent when the error was built without one). */
|
|
4690
4696
|
kind;
|
|
4697
|
+
/** The observed value, when known (a lower bound for a size found while inflating). */
|
|
4698
|
+
actual;
|
|
4691
4699
|
constructor(message, details) {
|
|
4692
4700
|
super(message);
|
|
4693
4701
|
this.name = "ZipLimitError";
|
|
4694
4702
|
this.limit = details.limit;
|
|
4695
4703
|
this.kind = details.kind;
|
|
4704
|
+
this.actual = details.actual;
|
|
4696
4705
|
}
|
|
4697
4706
|
};
|
|
4698
4707
|
mib = (bytes) => Math.round(bytes / 1048576);
|
|
@@ -4708,15 +4717,27 @@ var init_types2 = __esm({
|
|
|
4708
4717
|
MAX_ZIP_ENTRY_COUNT = 65536;
|
|
4709
4718
|
ZipBombError = class extends Error {
|
|
4710
4719
|
code = "ZIP_BOMB";
|
|
4720
|
+
/** Inflated bytes declared or read when a size limit failed (a lower bound while streaming). */
|
|
4711
4721
|
uncompressedBytes;
|
|
4722
|
+
/** The value of the limit that failed. */
|
|
4712
4723
|
limit;
|
|
4724
|
+
/** Number of archive entries, when the entry-count limit failed. */
|
|
4713
4725
|
entryCount;
|
|
4726
|
+
/**
|
|
4727
|
+
* The `PptxLoadLimits` field behind this error (`maxUncompressedBytes` or
|
|
4728
|
+
* `maxEntries`); `undefined` for a forged size or an unsafe part name.
|
|
4729
|
+
*/
|
|
4730
|
+
loadLimit;
|
|
4731
|
+
/** The observed value for {@link loadLimit}, when known. */
|
|
4732
|
+
actual;
|
|
4714
4733
|
constructor(message, details) {
|
|
4715
4734
|
super(message);
|
|
4716
4735
|
this.name = "ZipBombError";
|
|
4717
4736
|
this.uncompressedBytes = details.uncompressedBytes;
|
|
4718
4737
|
this.limit = details.limit;
|
|
4719
4738
|
this.entryCount = details.entryCount;
|
|
4739
|
+
this.loadLimit = details.loadLimit;
|
|
4740
|
+
this.actual = details.actual;
|
|
4720
4741
|
}
|
|
4721
4742
|
};
|
|
4722
4743
|
}
|
|
@@ -5295,6 +5316,330 @@ var init_PresentationBuilder = __esm({
|
|
|
5295
5316
|
}
|
|
5296
5317
|
});
|
|
5297
5318
|
|
|
5319
|
+
// pptx/core/utils/element-utils.ts
|
|
5320
|
+
function createEditorId(prefix) {
|
|
5321
|
+
const random = Math.random().toString(36).slice(2, 8).padEnd(6, "0");
|
|
5322
|
+
const sequence = (nextEditorIdSequence++).toString(36);
|
|
5323
|
+
return `${prefix}-${Date.now()}-${random}${sequence}`;
|
|
5324
|
+
}
|
|
5325
|
+
function ensureArrayValue(value) {
|
|
5326
|
+
if (!value) {
|
|
5327
|
+
return [];
|
|
5328
|
+
}
|
|
5329
|
+
return Array.isArray(value) ? value : [value];
|
|
5330
|
+
}
|
|
5331
|
+
var nextEditorIdSequence;
|
|
5332
|
+
var init_element_utils = __esm({
|
|
5333
|
+
"pptx/core/utils/element-utils.ts"() {
|
|
5334
|
+
nextEditorIdSequence = 0;
|
|
5335
|
+
}
|
|
5336
|
+
});
|
|
5337
|
+
|
|
5338
|
+
// pptx/core/utils/group-ops.ts
|
|
5339
|
+
function isTemplateElementId(elementId) {
|
|
5340
|
+
return elementId.startsWith("layout-") || elementId.startsWith("master-");
|
|
5341
|
+
}
|
|
5342
|
+
function makeStoreAwareId(intoTemplate, sourceId) {
|
|
5343
|
+
if (!intoTemplate) {
|
|
5344
|
+
return createEditorId("el");
|
|
5345
|
+
}
|
|
5346
|
+
return sourceId.startsWith("master-") ? `master-${createEditorId("el")}` : `layout-${createEditorId("el")}`;
|
|
5347
|
+
}
|
|
5348
|
+
function reassignDescendantIds(element, mintId) {
|
|
5349
|
+
if (element.type !== "group") {
|
|
5350
|
+
return;
|
|
5351
|
+
}
|
|
5352
|
+
for (const child31 of element.children) {
|
|
5353
|
+
const next = mintId(child31);
|
|
5354
|
+
if (next !== void 0) {
|
|
5355
|
+
child31.id = next;
|
|
5356
|
+
}
|
|
5357
|
+
reassignDescendantIds(child31, mintId);
|
|
5358
|
+
}
|
|
5359
|
+
}
|
|
5360
|
+
function groupElements(elements3, ids, groupId) {
|
|
5361
|
+
const idSet = new Set(ids);
|
|
5362
|
+
const gathered = [];
|
|
5363
|
+
let insertionIndex = -1;
|
|
5364
|
+
for (let i2 = 0; i2 < elements3.length; i2++) {
|
|
5365
|
+
const el = elements3[i2];
|
|
5366
|
+
if (idSet.has(el.id)) {
|
|
5367
|
+
gathered.push(el);
|
|
5368
|
+
if (insertionIndex === -1) {
|
|
5369
|
+
insertionIndex = i2;
|
|
5370
|
+
}
|
|
5371
|
+
}
|
|
5372
|
+
}
|
|
5373
|
+
if (gathered.length < 2) {
|
|
5374
|
+
return { elements: [...elements3], groupId: null };
|
|
5375
|
+
}
|
|
5376
|
+
let minX = gathered[0].x;
|
|
5377
|
+
let minY = gathered[0].y;
|
|
5378
|
+
let maxX = gathered[0].x + gathered[0].width;
|
|
5379
|
+
let maxY = gathered[0].y + gathered[0].height;
|
|
5380
|
+
for (let i2 = 1; i2 < gathered.length; i2++) {
|
|
5381
|
+
const el = gathered[i2];
|
|
5382
|
+
if (el.x < minX) {
|
|
5383
|
+
minX = el.x;
|
|
5384
|
+
}
|
|
5385
|
+
if (el.y < minY) {
|
|
5386
|
+
minY = el.y;
|
|
5387
|
+
}
|
|
5388
|
+
const rx = el.x + el.width;
|
|
5389
|
+
const ry = el.y + el.height;
|
|
5390
|
+
if (rx > maxX) {
|
|
5391
|
+
maxX = rx;
|
|
5392
|
+
}
|
|
5393
|
+
if (ry > maxY) {
|
|
5394
|
+
maxY = ry;
|
|
5395
|
+
}
|
|
5396
|
+
}
|
|
5397
|
+
const children16 = gathered.map((el) => {
|
|
5398
|
+
const child31 = cloneElement(el);
|
|
5399
|
+
child31.x = el.x - minX;
|
|
5400
|
+
child31.y = el.y - minY;
|
|
5401
|
+
return child31;
|
|
5402
|
+
});
|
|
5403
|
+
const group = {
|
|
5404
|
+
type: "group",
|
|
5405
|
+
id: groupId,
|
|
5406
|
+
name: "Group",
|
|
5407
|
+
x: minX,
|
|
5408
|
+
y: minY,
|
|
5409
|
+
width: maxX - minX,
|
|
5410
|
+
height: maxY - minY,
|
|
5411
|
+
children: children16
|
|
5412
|
+
};
|
|
5413
|
+
const remaining = elements3.filter((el) => !idSet.has(el.id));
|
|
5414
|
+
let adjustedIndex = 0;
|
|
5415
|
+
for (let i2 = 0; i2 < insertionIndex; i2++) {
|
|
5416
|
+
if (!idSet.has(elements3[i2].id)) {
|
|
5417
|
+
adjustedIndex++;
|
|
5418
|
+
}
|
|
5419
|
+
}
|
|
5420
|
+
return {
|
|
5421
|
+
elements: [...remaining.slice(0, adjustedIndex), group, ...remaining.slice(adjustedIndex)],
|
|
5422
|
+
groupId
|
|
5423
|
+
};
|
|
5424
|
+
}
|
|
5425
|
+
function ungroupElements(elements3, groupId, childIds, options = {}) {
|
|
5426
|
+
const groupIndex = elements3.findIndex((el) => el.id === groupId);
|
|
5427
|
+
if (groupIndex === -1) {
|
|
5428
|
+
return { elements: [...elements3], childIds: [] };
|
|
5429
|
+
}
|
|
5430
|
+
const group = elements3[groupIndex];
|
|
5431
|
+
if (group.type !== "group") {
|
|
5432
|
+
return { elements: [...elements3], childIds: [] };
|
|
5433
|
+
}
|
|
5434
|
+
const intoTemplate = options.intoTemplate ?? isTemplateElementId(group.id);
|
|
5435
|
+
const usedChildIds = [];
|
|
5436
|
+
const expanded = group.children.map((child31, index2) => {
|
|
5437
|
+
const newChildId = childIds[index2] ?? child31.id;
|
|
5438
|
+
usedChildIds.push(newChildId);
|
|
5439
|
+
const promoted = cloneElement(child31);
|
|
5440
|
+
promoted.id = newChildId;
|
|
5441
|
+
promoted.x = child31.x + group.x;
|
|
5442
|
+
promoted.y = child31.y + group.y;
|
|
5443
|
+
reassignDescendantIds(
|
|
5444
|
+
promoted,
|
|
5445
|
+
(descendant) => isTemplateElementId(descendant.id) === intoTemplate ? void 0 : makeStoreAwareId(intoTemplate, newChildId)
|
|
5446
|
+
);
|
|
5447
|
+
return promoted;
|
|
5448
|
+
});
|
|
5449
|
+
return {
|
|
5450
|
+
elements: [...elements3.slice(0, groupIndex), ...expanded, ...elements3.slice(groupIndex + 1)],
|
|
5451
|
+
childIds: usedChildIds
|
|
5452
|
+
};
|
|
5453
|
+
}
|
|
5454
|
+
var init_group_ops = __esm({
|
|
5455
|
+
"pptx/core/utils/group-ops.ts"() {
|
|
5456
|
+
init_clone_utils();
|
|
5457
|
+
init_element_utils();
|
|
5458
|
+
}
|
|
5459
|
+
});
|
|
5460
|
+
|
|
5461
|
+
// pptx/core/core/load-limits.ts
|
|
5462
|
+
function resolvePptxLoadLimits(options = {}) {
|
|
5463
|
+
const resolved = { ...DEFAULT_PPTX_LOAD_LIMITS };
|
|
5464
|
+
const legacy = options.maxUncompressedBytes;
|
|
5465
|
+
if (typeof legacy === "number" && legacy > 0) {
|
|
5466
|
+
resolved.maxUncompressedBytes = legacy;
|
|
5467
|
+
}
|
|
5468
|
+
const limits = options.limits;
|
|
5469
|
+
if (limits === void 0 || limits === null) {
|
|
5470
|
+
return resolved;
|
|
5471
|
+
}
|
|
5472
|
+
for (const name of LIMIT_NAMES) {
|
|
5473
|
+
const value = limits[name];
|
|
5474
|
+
if (value === void 0) {
|
|
5475
|
+
continue;
|
|
5476
|
+
}
|
|
5477
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) {
|
|
5478
|
+
throw new RangeError(`limits.${name} must be a positive finite number`);
|
|
5479
|
+
}
|
|
5480
|
+
if (name === "maxEntries" && value > MAX_ZIP_ENTRY_COUNT) {
|
|
5481
|
+
throw new RangeError(`limits.maxEntries must not exceed ${MAX_ZIP_ENTRY_COUNT}`);
|
|
5482
|
+
}
|
|
5483
|
+
resolved[name] = value;
|
|
5484
|
+
}
|
|
5485
|
+
return resolved;
|
|
5486
|
+
}
|
|
5487
|
+
function createPptxZipBombError(message, details) {
|
|
5488
|
+
const { limit, kind, actual } = details;
|
|
5489
|
+
if (kind === "maxEntries") {
|
|
5490
|
+
return new ZipBombError(message, {
|
|
5491
|
+
limit,
|
|
5492
|
+
loadLimit: "maxEntries",
|
|
5493
|
+
...actual === void 0 ? {} : { entryCount: actual, actual }
|
|
5494
|
+
});
|
|
5495
|
+
}
|
|
5496
|
+
if (kind === "maxEntryBytes" || kind === "maxTotalBytes") {
|
|
5497
|
+
return new ZipBombError(message, {
|
|
5498
|
+
limit,
|
|
5499
|
+
loadLimit: "maxUncompressedBytes",
|
|
5500
|
+
...actual === void 0 ? {} : { uncompressedBytes: actual, actual }
|
|
5501
|
+
});
|
|
5502
|
+
}
|
|
5503
|
+
return new ZipBombError(message, { limit });
|
|
5504
|
+
}
|
|
5505
|
+
function assertPptxInputWithinLimits(byteLength, limits) {
|
|
5506
|
+
if (byteLength > limits.maxInputBytes) {
|
|
5507
|
+
throw new PptxLoadLimitError(
|
|
5508
|
+
`PPTX input is ${count(byteLength)} bytes, more than the maxInputBytes limit of ${count(limits.maxInputBytes)}`,
|
|
5509
|
+
"maxInputBytes",
|
|
5510
|
+
limits.maxInputBytes,
|
|
5511
|
+
byteLength
|
|
5512
|
+
);
|
|
5513
|
+
}
|
|
5514
|
+
}
|
|
5515
|
+
function assertPptxTextWithinLimits(text2, limits) {
|
|
5516
|
+
const maximum = limits.maxInputBytes;
|
|
5517
|
+
if (text2.length * 3 <= maximum) {
|
|
5518
|
+
return;
|
|
5519
|
+
}
|
|
5520
|
+
const bytes = text2.length > maximum ? text2.length : utf8ByteLengthPast(text2, maximum);
|
|
5521
|
+
if (bytes > maximum) {
|
|
5522
|
+
throw new PptxLoadLimitError(
|
|
5523
|
+
`PPTX input is at least ${count(bytes)} bytes, more than the maxInputBytes limit of ${count(maximum)}`,
|
|
5524
|
+
"maxInputBytes",
|
|
5525
|
+
maximum,
|
|
5526
|
+
bytes
|
|
5527
|
+
);
|
|
5528
|
+
}
|
|
5529
|
+
}
|
|
5530
|
+
function utf8ByteLengthPast(text2, maximum) {
|
|
5531
|
+
let bytes = 0;
|
|
5532
|
+
for (let index2 = 0; index2 < text2.length && bytes <= maximum; index2++) {
|
|
5533
|
+
const unit = text2.charCodeAt(index2);
|
|
5534
|
+
if (unit < 128) {
|
|
5535
|
+
bytes += 1;
|
|
5536
|
+
} else if (unit < 2048) {
|
|
5537
|
+
bytes += 2;
|
|
5538
|
+
} else if (unit >= 55296 && unit <= 56319 && isLowSurrogate(text2.charCodeAt(index2 + 1))) {
|
|
5539
|
+
bytes += 4;
|
|
5540
|
+
index2++;
|
|
5541
|
+
} else {
|
|
5542
|
+
bytes += 3;
|
|
5543
|
+
}
|
|
5544
|
+
}
|
|
5545
|
+
return bytes;
|
|
5546
|
+
}
|
|
5547
|
+
function isLowSurrogate(unit) {
|
|
5548
|
+
return unit >= 56320 && unit <= 57343;
|
|
5549
|
+
}
|
|
5550
|
+
function assertPptxSlideCountWithinLimits(slideCount, limits) {
|
|
5551
|
+
if (slideCount > limits.maxSlides) {
|
|
5552
|
+
throw new PptxLoadLimitError(
|
|
5553
|
+
`PPTX presentation has ${count(slideCount)} slides, more than the maxSlides limit of ${count(limits.maxSlides)}`,
|
|
5554
|
+
"maxSlides",
|
|
5555
|
+
limits.maxSlides,
|
|
5556
|
+
slideCount
|
|
5557
|
+
);
|
|
5558
|
+
}
|
|
5559
|
+
}
|
|
5560
|
+
function countPptxShapesWithinLimits(counted, elements3, limits) {
|
|
5561
|
+
const maximum = limits.maxShapes;
|
|
5562
|
+
if (maximum === Number.POSITIVE_INFINITY) {
|
|
5563
|
+
return counted;
|
|
5564
|
+
}
|
|
5565
|
+
const total = counted + countAuthoredElements(elements3);
|
|
5566
|
+
if (total > maximum) {
|
|
5567
|
+
throw new PptxLoadLimitError(
|
|
5568
|
+
`PPTX presentation has at least ${count(total)} shapes, more than the maxShapes limit of ${count(maximum)}`,
|
|
5569
|
+
"maxShapes",
|
|
5570
|
+
maximum,
|
|
5571
|
+
total
|
|
5572
|
+
);
|
|
5573
|
+
}
|
|
5574
|
+
return total;
|
|
5575
|
+
}
|
|
5576
|
+
function countAuthoredElements(elements3) {
|
|
5577
|
+
let total = 0;
|
|
5578
|
+
const lists = [elements3];
|
|
5579
|
+
const positions = [0];
|
|
5580
|
+
while (lists.length > 0) {
|
|
5581
|
+
const top = lists.length - 1;
|
|
5582
|
+
const list3 = lists[top];
|
|
5583
|
+
const position3 = positions[top];
|
|
5584
|
+
if (position3 >= list3.length) {
|
|
5585
|
+
lists.pop();
|
|
5586
|
+
positions.pop();
|
|
5587
|
+
continue;
|
|
5588
|
+
}
|
|
5589
|
+
positions[top] = position3 + 1;
|
|
5590
|
+
const element = list3[position3];
|
|
5591
|
+
if (typeof element !== "object" || element === null) {
|
|
5592
|
+
continue;
|
|
5593
|
+
}
|
|
5594
|
+
const { id, type, children: children16 } = element;
|
|
5595
|
+
if (typeof id === "string" && isTemplateElementId(id)) {
|
|
5596
|
+
continue;
|
|
5597
|
+
}
|
|
5598
|
+
total++;
|
|
5599
|
+
if (type === "group" && Array.isArray(children16) && children16.length > 0) {
|
|
5600
|
+
lists.push(children16);
|
|
5601
|
+
positions.push(0);
|
|
5602
|
+
}
|
|
5603
|
+
}
|
|
5604
|
+
return total;
|
|
5605
|
+
}
|
|
5606
|
+
var DEFAULT_PPTX_LOAD_LIMITS, LIMIT_NAMES, PptxLoadLimitError, count;
|
|
5607
|
+
var init_load_limits = __esm({
|
|
5608
|
+
"pptx/core/core/load-limits.ts"() {
|
|
5609
|
+
init_group_ops();
|
|
5610
|
+
init_types2();
|
|
5611
|
+
DEFAULT_PPTX_LOAD_LIMITS = Object.freeze({
|
|
5612
|
+
maxInputBytes: Number.POSITIVE_INFINITY,
|
|
5613
|
+
maxUncompressedBytes: DEFAULT_MAX_UNCOMPRESSED_BYTES,
|
|
5614
|
+
maxEntries: MAX_ZIP_ENTRY_COUNT,
|
|
5615
|
+
maxSlides: Number.POSITIVE_INFINITY,
|
|
5616
|
+
maxShapes: Number.POSITIVE_INFINITY
|
|
5617
|
+
});
|
|
5618
|
+
LIMIT_NAMES = Object.keys(DEFAULT_PPTX_LOAD_LIMITS);
|
|
5619
|
+
PptxLoadLimitError = class extends Error {
|
|
5620
|
+
code = "PPTX_LOAD_LIMIT";
|
|
5621
|
+
/** The limit that was exceeded. */
|
|
5622
|
+
limit;
|
|
5623
|
+
/** The value of that limit. */
|
|
5624
|
+
maximum;
|
|
5625
|
+
/**
|
|
5626
|
+
* The observed value: exact for `maxSlides` and for `maxInputBytes` on
|
|
5627
|
+
* `load()`; for `maxShapes`, and for `maxInputBytes` on `loadFromJson()`
|
|
5628
|
+
* (which stops counting once past the limit), a lower bound.
|
|
5629
|
+
*/
|
|
5630
|
+
actual;
|
|
5631
|
+
constructor(message, limit, maximum, actual) {
|
|
5632
|
+
super(message);
|
|
5633
|
+
this.name = "PptxLoadLimitError";
|
|
5634
|
+
this.limit = limit;
|
|
5635
|
+
this.maximum = maximum;
|
|
5636
|
+
this.actual = actual;
|
|
5637
|
+
}
|
|
5638
|
+
};
|
|
5639
|
+
count = (value) => value.toLocaleString("en-US");
|
|
5640
|
+
}
|
|
5641
|
+
});
|
|
5642
|
+
|
|
5298
5643
|
// geometry/indexed.ts
|
|
5299
5644
|
function at(items, index2) {
|
|
5300
5645
|
const value = items[index2];
|
|
@@ -15213,148 +15558,6 @@ var init_preset_adjustment_validation = __esm({
|
|
|
15213
15558
|
}
|
|
15214
15559
|
});
|
|
15215
15560
|
|
|
15216
|
-
// pptx/core/utils/element-utils.ts
|
|
15217
|
-
function createEditorId(prefix) {
|
|
15218
|
-
const random = Math.random().toString(36).slice(2, 8).padEnd(6, "0");
|
|
15219
|
-
const sequence = (nextEditorIdSequence++).toString(36);
|
|
15220
|
-
return `${prefix}-${Date.now()}-${random}${sequence}`;
|
|
15221
|
-
}
|
|
15222
|
-
function ensureArrayValue(value) {
|
|
15223
|
-
if (!value) {
|
|
15224
|
-
return [];
|
|
15225
|
-
}
|
|
15226
|
-
return Array.isArray(value) ? value : [value];
|
|
15227
|
-
}
|
|
15228
|
-
var nextEditorIdSequence;
|
|
15229
|
-
var init_element_utils = __esm({
|
|
15230
|
-
"pptx/core/utils/element-utils.ts"() {
|
|
15231
|
-
nextEditorIdSequence = 0;
|
|
15232
|
-
}
|
|
15233
|
-
});
|
|
15234
|
-
|
|
15235
|
-
// pptx/core/utils/group-ops.ts
|
|
15236
|
-
function isTemplateElementId(elementId) {
|
|
15237
|
-
return elementId.startsWith("layout-") || elementId.startsWith("master-");
|
|
15238
|
-
}
|
|
15239
|
-
function makeStoreAwareId(intoTemplate, sourceId) {
|
|
15240
|
-
if (!intoTemplate) {
|
|
15241
|
-
return createEditorId("el");
|
|
15242
|
-
}
|
|
15243
|
-
return sourceId.startsWith("master-") ? `master-${createEditorId("el")}` : `layout-${createEditorId("el")}`;
|
|
15244
|
-
}
|
|
15245
|
-
function reassignDescendantIds(element, mintId) {
|
|
15246
|
-
if (element.type !== "group") {
|
|
15247
|
-
return;
|
|
15248
|
-
}
|
|
15249
|
-
for (const child31 of element.children) {
|
|
15250
|
-
const next = mintId(child31);
|
|
15251
|
-
if (next !== void 0) {
|
|
15252
|
-
child31.id = next;
|
|
15253
|
-
}
|
|
15254
|
-
reassignDescendantIds(child31, mintId);
|
|
15255
|
-
}
|
|
15256
|
-
}
|
|
15257
|
-
function groupElements(elements3, ids, groupId) {
|
|
15258
|
-
const idSet = new Set(ids);
|
|
15259
|
-
const gathered = [];
|
|
15260
|
-
let insertionIndex = -1;
|
|
15261
|
-
for (let i2 = 0; i2 < elements3.length; i2++) {
|
|
15262
|
-
const el = elements3[i2];
|
|
15263
|
-
if (idSet.has(el.id)) {
|
|
15264
|
-
gathered.push(el);
|
|
15265
|
-
if (insertionIndex === -1) {
|
|
15266
|
-
insertionIndex = i2;
|
|
15267
|
-
}
|
|
15268
|
-
}
|
|
15269
|
-
}
|
|
15270
|
-
if (gathered.length < 2) {
|
|
15271
|
-
return { elements: [...elements3], groupId: null };
|
|
15272
|
-
}
|
|
15273
|
-
let minX = gathered[0].x;
|
|
15274
|
-
let minY = gathered[0].y;
|
|
15275
|
-
let maxX = gathered[0].x + gathered[0].width;
|
|
15276
|
-
let maxY = gathered[0].y + gathered[0].height;
|
|
15277
|
-
for (let i2 = 1; i2 < gathered.length; i2++) {
|
|
15278
|
-
const el = gathered[i2];
|
|
15279
|
-
if (el.x < minX) {
|
|
15280
|
-
minX = el.x;
|
|
15281
|
-
}
|
|
15282
|
-
if (el.y < minY) {
|
|
15283
|
-
minY = el.y;
|
|
15284
|
-
}
|
|
15285
|
-
const rx = el.x + el.width;
|
|
15286
|
-
const ry = el.y + el.height;
|
|
15287
|
-
if (rx > maxX) {
|
|
15288
|
-
maxX = rx;
|
|
15289
|
-
}
|
|
15290
|
-
if (ry > maxY) {
|
|
15291
|
-
maxY = ry;
|
|
15292
|
-
}
|
|
15293
|
-
}
|
|
15294
|
-
const children16 = gathered.map((el) => {
|
|
15295
|
-
const child31 = cloneElement(el);
|
|
15296
|
-
child31.x = el.x - minX;
|
|
15297
|
-
child31.y = el.y - minY;
|
|
15298
|
-
return child31;
|
|
15299
|
-
});
|
|
15300
|
-
const group = {
|
|
15301
|
-
type: "group",
|
|
15302
|
-
id: groupId,
|
|
15303
|
-
name: "Group",
|
|
15304
|
-
x: minX,
|
|
15305
|
-
y: minY,
|
|
15306
|
-
width: maxX - minX,
|
|
15307
|
-
height: maxY - minY,
|
|
15308
|
-
children: children16
|
|
15309
|
-
};
|
|
15310
|
-
const remaining = elements3.filter((el) => !idSet.has(el.id));
|
|
15311
|
-
let adjustedIndex = 0;
|
|
15312
|
-
for (let i2 = 0; i2 < insertionIndex; i2++) {
|
|
15313
|
-
if (!idSet.has(elements3[i2].id)) {
|
|
15314
|
-
adjustedIndex++;
|
|
15315
|
-
}
|
|
15316
|
-
}
|
|
15317
|
-
return {
|
|
15318
|
-
elements: [...remaining.slice(0, adjustedIndex), group, ...remaining.slice(adjustedIndex)],
|
|
15319
|
-
groupId
|
|
15320
|
-
};
|
|
15321
|
-
}
|
|
15322
|
-
function ungroupElements(elements3, groupId, childIds, options = {}) {
|
|
15323
|
-
const groupIndex = elements3.findIndex((el) => el.id === groupId);
|
|
15324
|
-
if (groupIndex === -1) {
|
|
15325
|
-
return { elements: [...elements3], childIds: [] };
|
|
15326
|
-
}
|
|
15327
|
-
const group = elements3[groupIndex];
|
|
15328
|
-
if (group.type !== "group") {
|
|
15329
|
-
return { elements: [...elements3], childIds: [] };
|
|
15330
|
-
}
|
|
15331
|
-
const intoTemplate = options.intoTemplate ?? isTemplateElementId(group.id);
|
|
15332
|
-
const usedChildIds = [];
|
|
15333
|
-
const expanded = group.children.map((child31, index2) => {
|
|
15334
|
-
const newChildId = childIds[index2] ?? child31.id;
|
|
15335
|
-
usedChildIds.push(newChildId);
|
|
15336
|
-
const promoted = cloneElement(child31);
|
|
15337
|
-
promoted.id = newChildId;
|
|
15338
|
-
promoted.x = child31.x + group.x;
|
|
15339
|
-
promoted.y = child31.y + group.y;
|
|
15340
|
-
reassignDescendantIds(
|
|
15341
|
-
promoted,
|
|
15342
|
-
(descendant) => isTemplateElementId(descendant.id) === intoTemplate ? void 0 : makeStoreAwareId(intoTemplate, newChildId)
|
|
15343
|
-
);
|
|
15344
|
-
return promoted;
|
|
15345
|
-
});
|
|
15346
|
-
return {
|
|
15347
|
-
elements: [...elements3.slice(0, groupIndex), ...expanded, ...elements3.slice(groupIndex + 1)],
|
|
15348
|
-
childIds: usedChildIds
|
|
15349
|
-
};
|
|
15350
|
-
}
|
|
15351
|
-
var init_group_ops = __esm({
|
|
15352
|
-
"pptx/core/utils/group-ops.ts"() {
|
|
15353
|
-
init_clone_utils();
|
|
15354
|
-
init_element_utils();
|
|
15355
|
-
}
|
|
15356
|
-
});
|
|
15357
|
-
|
|
15358
15561
|
// pptx/core/utils/presentation-collections.ts
|
|
15359
15562
|
function remapReferenceList(references, mapping, removed) {
|
|
15360
15563
|
const result = [];
|
|
@@ -16735,9 +16938,9 @@ function decodeSlot(dir, id, majorVersion, warnings) {
|
|
|
16735
16938
|
};
|
|
16736
16939
|
}
|
|
16737
16940
|
function readDirectory(dir, majorVersion, strict, warnings) {
|
|
16738
|
-
const
|
|
16941
|
+
const count2 = Math.floor(dir.length / DIR_ENTRY_SIZE);
|
|
16739
16942
|
const slots = [];
|
|
16740
|
-
for (let id = 0; id <
|
|
16943
|
+
for (let id = 0; id < count2; id++)
|
|
16741
16944
|
slots.push(decodeSlot(dir, id, majorVersion, warnings));
|
|
16742
16945
|
const roots = slots.filter((slot) => slot.type === ENTRY_TYPE_ROOT);
|
|
16743
16946
|
if (roots.length !== 1 || !roots[0].nameValid)
|
|
@@ -17278,10 +17481,10 @@ function writeFatChain(fat, chain2) {
|
|
|
17278
17481
|
fat[chain2.sectors[i2]] = i2 < chain2.sectors.length - 1 ? chain2.sectors[i2 + 1] : ENDOFCHAIN;
|
|
17279
17482
|
}
|
|
17280
17483
|
}
|
|
17281
|
-
function writeFatRun(fat, firstSector,
|
|
17282
|
-
for (let i2 = 0; i2 <
|
|
17484
|
+
function writeFatRun(fat, firstSector, count2) {
|
|
17485
|
+
for (let i2 = 0; i2 < count2; i2++) {
|
|
17283
17486
|
const sector = firstSector + i2;
|
|
17284
|
-
fat[sector] = i2 <
|
|
17487
|
+
fat[sector] = i2 < count2 - 1 ? sector + 1 : ENDOFCHAIN;
|
|
17285
17488
|
}
|
|
17286
17489
|
}
|
|
17287
17490
|
function writeInt32Sectors(outBytes, int32Data, firstSector, numSectors, sectorSize) {
|
|
@@ -17799,21 +18002,21 @@ function parseChartFormulaRange(formula2) {
|
|
|
17799
18002
|
}
|
|
17800
18003
|
return { sheetName, start, end };
|
|
17801
18004
|
}
|
|
17802
|
-
function expandRangeAddresses(range,
|
|
18005
|
+
function expandRangeAddresses(range, count2) {
|
|
17803
18006
|
const { start, end } = range;
|
|
17804
|
-
if (
|
|
18007
|
+
if (count2 <= 0) {
|
|
17805
18008
|
return void 0;
|
|
17806
18009
|
}
|
|
17807
18010
|
if (start.col === end.col && start.row === end.row) {
|
|
17808
|
-
return
|
|
18011
|
+
return count2 === 1 ? [formatCellAddress(start)] : void 0;
|
|
17809
18012
|
}
|
|
17810
18013
|
if (start.col === end.col) {
|
|
17811
18014
|
const length = end.row - start.row + 1;
|
|
17812
|
-
return length ===
|
|
18015
|
+
return length === count2 ? Array.from({ length }, (_, i2) => formatCellAddress({ col: start.col, row: start.row + i2 })) : void 0;
|
|
17813
18016
|
}
|
|
17814
18017
|
if (start.row === end.row) {
|
|
17815
18018
|
const length = end.col - start.col + 1;
|
|
17816
|
-
return length ===
|
|
18019
|
+
return length === count2 ? Array.from({ length }, (_, i2) => formatCellAddress({ col: start.col + i2, row: start.row })) : void 0;
|
|
17817
18020
|
}
|
|
17818
18021
|
return void 0;
|
|
17819
18022
|
}
|
|
@@ -19729,8 +19932,8 @@ function fcLcbFieldOffset(fib, key2) {
|
|
|
19729
19932
|
}
|
|
19730
19933
|
function readFcLcbAt(wordDoc, fib, index2) {
|
|
19731
19934
|
const view = new DataView(wordDoc.buffer, wordDoc.byteOffset, wordDoc.byteLength);
|
|
19732
|
-
const
|
|
19733
|
-
if (!Number.isInteger(index2) || index2 < 0 || index2 >=
|
|
19935
|
+
const count2 = view.getUint16(fib.fibRgFcLcbOffset - 2, true);
|
|
19936
|
+
if (!Number.isInteger(index2) || index2 < 0 || index2 >= count2 || fib.fibRgFcLcbCount !== void 0 && fib.fibRgFcLcbCount !== count2)
|
|
19734
19937
|
throw new Error("FIB fc/lcb index outside declared array");
|
|
19735
19938
|
const off = fib.fibRgFcLcbOffset + index2 * 8;
|
|
19736
19939
|
return { fc: view.getUint32(off, true), lcb: view.getUint32(off + 4, true) };
|
|
@@ -19962,7 +20165,7 @@ function appendCompoundAllocations(input2, existingFatIds, payloads, sectorSize
|
|
|
19962
20165
|
const sectorCount = input2.length / sectorSize - 1;
|
|
19963
20166
|
const entriesPerFat = sectorSize / 4;
|
|
19964
20167
|
const counts = payloads.map((payload) => Math.ceil(payload.length / sectorSize));
|
|
19965
|
-
const payloadSectors = counts.reduce((sum,
|
|
20168
|
+
const payloadSectors = counts.reduce((sum, count2) => sum + count2, 0);
|
|
19966
20169
|
let fatCount = existingFatIds.length;
|
|
19967
20170
|
while (sectorCount + payloadSectors + fatCount - existingFatIds.length > fatCount * entriesPerFat)
|
|
19968
20171
|
fatCount++;
|
|
@@ -20047,21 +20250,21 @@ function resizeMiniCompoundStream(input2, fat, fatIds, root, target, replacement
|
|
|
20047
20250
|
output3.view.setUint32(target.offset + 120, replacement.length, true);
|
|
20048
20251
|
return output3.bytes;
|
|
20049
20252
|
}
|
|
20050
|
-
const firstMini = Math.ceil(root.size / MINI),
|
|
20051
|
-
const newRootSize =
|
|
20253
|
+
const firstMini = Math.ceil(root.size / MINI), count2 = Math.ceil(replacement.length / MINI);
|
|
20254
|
+
const newRootSize = count2 ? (firstMini + count2) * MINI : root.size;
|
|
20052
20255
|
const newRoot = new Uint8Array(newRootSize);
|
|
20053
20256
|
rootSectors.forEach((id, i2) => newRoot.set(input2.subarray((id + 1) * SECTOR, (id + 1) * SECTOR + Math.min(SECTOR, root.size - i2 * SECTOR)), i2 * SECTOR));
|
|
20054
|
-
if (
|
|
20257
|
+
if (count2)
|
|
20055
20258
|
newRoot.set(replacement, firstMini * MINI);
|
|
20056
|
-
const newMiniFatCount = Math.max(miniFatCount, Math.ceil((firstMini +
|
|
20259
|
+
const newMiniFatCount = Math.max(miniFatCount, Math.ceil((firstMini + count2) / 128));
|
|
20057
20260
|
const newMiniFat = new Uint8Array(newMiniFatCount * SECTOR).fill(255);
|
|
20058
20261
|
miniFatSectors.forEach((id, i2) => newMiniFat.set(input2.subarray((id + 1) * SECTOR, (id + 2) * SECTOR), i2 * SECTOR));
|
|
20059
20262
|
const miniView = new DataView(newMiniFat.buffer);
|
|
20060
20263
|
if (wasMini)
|
|
20061
20264
|
for (const id of oldChain)
|
|
20062
20265
|
miniView.setUint32(id * 4, FREE2, true);
|
|
20063
|
-
for (let i2 = 0; i2 <
|
|
20064
|
-
miniView.setUint32((firstMini + i2) * 4, i2 + 1 ===
|
|
20266
|
+
for (let i2 = 0; i2 < count2; i2++)
|
|
20267
|
+
miniView.setUint32((firstMini + i2) * 4, i2 + 1 === count2 ? END3 : firstMini + i2 + 1, true);
|
|
20065
20268
|
const output2 = appendCompoundAllocations(input2, fatIds, [newRoot, newMiniFat]);
|
|
20066
20269
|
if (!output2)
|
|
20067
20270
|
return void 0;
|
|
@@ -20071,7 +20274,7 @@ function resizeMiniCompoundStream(input2, fat, fatIds, root, target, replacement
|
|
|
20071
20274
|
output2.view.setUint32(root.offset + 120, newRootSize, true);
|
|
20072
20275
|
output2.view.setUint32(60, output2.chains[1][0] ?? END3, true);
|
|
20073
20276
|
output2.view.setUint32(64, newMiniFatCount, true);
|
|
20074
|
-
output2.view.setUint32(target.offset + 116,
|
|
20277
|
+
output2.view.setUint32(target.offset + 116, count2 ? firstMini : END3, true);
|
|
20075
20278
|
output2.view.setUint32(target.offset + 120, replacement.length, true);
|
|
20076
20279
|
return output2.bytes;
|
|
20077
20280
|
}
|
|
@@ -21572,9 +21775,9 @@ var init_deflate_encode = __esm({
|
|
|
21572
21775
|
len = 0;
|
|
21573
21776
|
acc = 0;
|
|
21574
21777
|
nbits = 0;
|
|
21575
|
-
bits(value,
|
|
21778
|
+
bits(value, count2) {
|
|
21576
21779
|
this.acc |= value << this.nbits;
|
|
21577
|
-
this.nbits +=
|
|
21780
|
+
this.nbits += count2;
|
|
21578
21781
|
while (this.nbits >= 8) {
|
|
21579
21782
|
this.push(this.acc & 255);
|
|
21580
21783
|
this.acc >>>= 8;
|
|
@@ -21582,12 +21785,12 @@ var init_deflate_encode = __esm({
|
|
|
21582
21785
|
}
|
|
21583
21786
|
}
|
|
21584
21787
|
/** Huffman codes are packed most-significant bit first. */
|
|
21585
|
-
code(value,
|
|
21788
|
+
code(value, count2) {
|
|
21586
21789
|
let reversed = 0;
|
|
21587
|
-
for (let i2 = 0; i2 <
|
|
21790
|
+
for (let i2 = 0; i2 < count2; i2++) {
|
|
21588
21791
|
reversed = reversed << 1 | value >>> i2 & 1;
|
|
21589
21792
|
}
|
|
21590
|
-
this.bits(reversed,
|
|
21793
|
+
this.bits(reversed, count2);
|
|
21591
21794
|
}
|
|
21592
21795
|
finish() {
|
|
21593
21796
|
if (this.nbits > 0) {
|
|
@@ -25959,12 +26162,12 @@ function functionValue(condition, point2, lookup) {
|
|
|
25959
26162
|
if (!target) {
|
|
25960
26163
|
return void 0;
|
|
25961
26164
|
}
|
|
25962
|
-
const { pos: pos2, count } = siblingPosition(target, ptType);
|
|
26165
|
+
const { pos: pos2, count: count2 } = siblingPosition(target, ptType);
|
|
25963
26166
|
if (condition.func === "pos") {
|
|
25964
26167
|
return pos2;
|
|
25965
26168
|
}
|
|
25966
26169
|
if (condition.func === "revPos") {
|
|
25967
|
-
return
|
|
26170
|
+
return count2 - pos2 + 1;
|
|
25968
26171
|
}
|
|
25969
26172
|
return condition.func === "posEven" ? pos2 % 2 === 0 ? 1 : 0 : pos2 % 2 === 1 ? 1 : 0;
|
|
25970
26173
|
}
|
|
@@ -29051,19 +29254,19 @@ function pointTypeMatches(node2, pointType2) {
|
|
|
29051
29254
|
}
|
|
29052
29255
|
return node2.nodeType === pointType2;
|
|
29053
29256
|
}
|
|
29054
|
-
function selectRange(nodes, start,
|
|
29055
|
-
if (start === void 0 &&
|
|
29257
|
+
function selectRange(nodes, start, count2) {
|
|
29258
|
+
if (start === void 0 && count2 === void 0) {
|
|
29056
29259
|
return nodes;
|
|
29057
29260
|
}
|
|
29058
29261
|
const zeroBasedStart = Math.max(0, (start ?? 1) - 1);
|
|
29059
|
-
const take2 =
|
|
29262
|
+
const take2 = count2 !== void 0 && count2 > 0 ? count2 : nodes.length - zeroBasedStart;
|
|
29060
29263
|
return nodes.slice(zeroBasedStart, zeroBasedStart + take2);
|
|
29061
29264
|
}
|
|
29062
|
-
function applyPointTypeAndRange(nodes, pointType2, start,
|
|
29265
|
+
function applyPointTypeAndRange(nodes, pointType2, start, count2) {
|
|
29063
29266
|
const filtered = pointType2 ? nodes.filter((n) => pointTypeMatches(n, pointType2)) : nodes;
|
|
29064
|
-
return selectRange(filtered, start,
|
|
29267
|
+
return selectRange(filtered, start, count2);
|
|
29065
29268
|
}
|
|
29066
|
-
function resolveAxisNodes(nodes, axis, pointTypes, start,
|
|
29269
|
+
function resolveAxisNodes(nodes, axis, pointTypes, start, count2, context) {
|
|
29067
29270
|
if (axis.length === 0) {
|
|
29068
29271
|
return void 0;
|
|
29069
29272
|
}
|
|
@@ -29093,21 +29296,21 @@ function resolveAxisNodes(nodes, axis, pointTypes, start, count, context) {
|
|
|
29093
29296
|
let current;
|
|
29094
29297
|
let nextHop;
|
|
29095
29298
|
if (axis[0] === "root" && axis.length > 1) {
|
|
29096
|
-
current = applyPointTypeAndRange(roots, pointTypes?.[1], start?.[1],
|
|
29299
|
+
current = applyPointTypeAndRange(roots, pointTypes?.[1], start?.[1], count2?.[1]);
|
|
29097
29300
|
nextHop = 2;
|
|
29098
29301
|
} else if (axis[0] === "root") {
|
|
29099
|
-
current = applyPointTypeAndRange(roots, pointTypes?.[0], start?.[0],
|
|
29302
|
+
current = applyPointTypeAndRange(roots, pointTypes?.[0], start?.[0], count2?.[0]);
|
|
29100
29303
|
nextHop = 1;
|
|
29101
29304
|
} else if (context !== void 0) {
|
|
29102
29305
|
current = applyPointTypeAndRange(
|
|
29103
29306
|
navigateAxisHop(context, axis[0], nodes, childrenOf, parentOf, roots),
|
|
29104
29307
|
pointTypes?.[0],
|
|
29105
29308
|
start?.[0],
|
|
29106
|
-
|
|
29309
|
+
count2?.[0]
|
|
29107
29310
|
);
|
|
29108
29311
|
nextHop = 1;
|
|
29109
29312
|
} else {
|
|
29110
|
-
current = applyPointTypeAndRange(roots, pointTypes?.[0], start?.[0],
|
|
29313
|
+
current = applyPointTypeAndRange(roots, pointTypes?.[0], start?.[0], count2?.[0]);
|
|
29111
29314
|
nextHop = 1;
|
|
29112
29315
|
}
|
|
29113
29316
|
for (let hop = nextHop; hop < axis.length; hop += 1) {
|
|
@@ -29115,13 +29318,13 @@ function resolveAxisNodes(nodes, axis, pointTypes, start, count, context) {
|
|
|
29115
29318
|
navigateAxisHop(current, axis[hop], nodes, childrenOf, parentOf, roots),
|
|
29116
29319
|
pointTypes?.[hop],
|
|
29117
29320
|
start?.[hop],
|
|
29118
|
-
|
|
29321
|
+
count2?.[hop]
|
|
29119
29322
|
);
|
|
29120
29323
|
}
|
|
29121
29324
|
return current;
|
|
29122
29325
|
}
|
|
29123
|
-
function resolveAxisCount(nodes, axis, pointTypes, start,
|
|
29124
|
-
return resolveAxisNodes(nodes, axis, pointTypes, start,
|
|
29326
|
+
function resolveAxisCount(nodes, axis, pointTypes, start, count2, context) {
|
|
29327
|
+
return resolveAxisNodes(nodes, axis, pointTypes, start, count2, context)?.length;
|
|
29125
29328
|
}
|
|
29126
29329
|
var init_smartart_layout_interpreter_axis_count = __esm({
|
|
29127
29330
|
"diagram/layout/smartart-layout-interpreter-axis-count.ts"() {
|
|
@@ -29147,14 +29350,14 @@ function depthFromAnchor(node2, anchorId, byId) {
|
|
|
29147
29350
|
}
|
|
29148
29351
|
return void 0;
|
|
29149
29352
|
}
|
|
29150
|
-
function resolveAxisMaxDepth(nodes, axis, pointTypes, start,
|
|
29353
|
+
function resolveAxisMaxDepth(nodes, axis, pointTypes, start, count2, anchor2) {
|
|
29151
29354
|
if (anchor2.length === 0) {
|
|
29152
29355
|
return void 0;
|
|
29153
29356
|
}
|
|
29154
29357
|
const byId = new Map(nodes.map((n) => [n.id, n]));
|
|
29155
29358
|
let max = 0;
|
|
29156
29359
|
for (const anchorPoint of anchor2) {
|
|
29157
|
-
const resolved = resolveAxisNodes(nodes, axis, pointTypes, start,
|
|
29360
|
+
const resolved = resolveAxisNodes(nodes, axis, pointTypes, start, count2, [anchorPoint]);
|
|
29158
29361
|
if (resolved === void 0) {
|
|
29159
29362
|
return void 0;
|
|
29160
29363
|
}
|
|
@@ -29640,8 +29843,8 @@ function selectArrangedNodes(node2, flat, roots) {
|
|
|
29640
29843
|
const followSibCounts = collectFollowSibNodeCounts(node2);
|
|
29641
29844
|
if (followSibCounts.length > 0) {
|
|
29642
29845
|
for (const i2 of [...indices]) {
|
|
29643
|
-
for (const
|
|
29644
|
-
for (let k = 1; k <=
|
|
29846
|
+
for (const count2 of followSibCounts) {
|
|
29847
|
+
for (let k = 1; k <= count2; k++) {
|
|
29645
29848
|
const j = i2 + k;
|
|
29646
29849
|
if (j < base2.length) {
|
|
29647
29850
|
indices.add(j);
|
|
@@ -31216,12 +31419,12 @@ function buildCycleRingExtensions(parentCentre, parentNode, context, path4) {
|
|
|
31216
31419
|
const baseAngleRad = dist > 1e-6 ? Math.atan2(dy, dx) : 0;
|
|
31217
31420
|
const halfExtent = Math.max(context.itemWidth, context.itemHeight) / 2;
|
|
31218
31421
|
const radius = context.itemWidth / 2 + Math.max(0, context.gapPx) + halfExtent;
|
|
31219
|
-
const
|
|
31422
|
+
const count2 = children16.length;
|
|
31220
31423
|
const spanRad = context.fanSpanDeg * DEG_TO_RAD2;
|
|
31221
31424
|
const nodes = [];
|
|
31222
31425
|
const connectors2 = [];
|
|
31223
31426
|
children16.forEach((child31, i2) => {
|
|
31224
|
-
const angle =
|
|
31427
|
+
const angle = count2 === 1 ? baseAngleRad : baseAngleRad - spanRad / 2 + spanRad * i2 / (count2 - 1);
|
|
31225
31428
|
const cx = parentCentre.x + Math.cos(angle) * radius;
|
|
31226
31429
|
const cy = parentCentre.y + Math.sin(angle) * radius;
|
|
31227
31430
|
const key2 = `${context.elementId}-cycle-ext-${path4}-${i2}`;
|
|
@@ -31234,7 +31437,7 @@ function buildCycleRingExtensions(parentCentre, parentNode, context, path4) {
|
|
|
31234
31437
|
height: context.itemHeight,
|
|
31235
31438
|
node: child31,
|
|
31236
31439
|
index: i2,
|
|
31237
|
-
total:
|
|
31440
|
+
total: count2,
|
|
31238
31441
|
palette: context.palette,
|
|
31239
31442
|
style: context.style,
|
|
31240
31443
|
ctx: context.ctx,
|
|
@@ -32411,12 +32614,12 @@ var init_smartart_layout_interpreter_linear_content_size = __esm({
|
|
|
32411
32614
|
});
|
|
32412
32615
|
|
|
32413
32616
|
// diagram/layout/smartart-layout-interpreter-axis-range.ts
|
|
32414
|
-
function positionRange(start,
|
|
32617
|
+
function positionRange(start, count2, step, total) {
|
|
32415
32618
|
const out = [];
|
|
32416
32619
|
const s = step > 0 ? step : 1;
|
|
32417
32620
|
for (let i2 = Math.max(0, start - 1); i2 < total; i2 += s) {
|
|
32418
32621
|
out.push(i2 + 1);
|
|
32419
|
-
if (
|
|
32622
|
+
if (count2 !== void 0 && count2 > 0 && out.length >= count2) {
|
|
32420
32623
|
break;
|
|
32421
32624
|
}
|
|
32422
32625
|
}
|
|
@@ -32436,8 +32639,8 @@ function compoundChildIds(role, node2, childrenOf) {
|
|
|
32436
32639
|
}
|
|
32437
32640
|
const children16 = childrenOf.get(node2.id) ?? [];
|
|
32438
32641
|
const start = role.presentationOf?.start?.[chIndex] ?? 1;
|
|
32439
|
-
const
|
|
32440
|
-
const positions = positionRange(start,
|
|
32642
|
+
const count2 = role.presentationOf?.count?.[chIndex];
|
|
32643
|
+
const positions = positionRange(start, count2, 1, children16.length);
|
|
32441
32644
|
const ids = [];
|
|
32442
32645
|
for (const position3 of positions) {
|
|
32443
32646
|
const child31 = children16[position3 - 1];
|
|
@@ -33011,9 +33214,9 @@ function arrangeSnake2(plan, nodes, box, palette, style, elementId, index2 = EMP
|
|
|
33011
33214
|
let y = INSET + row * (cellH + gapY);
|
|
33012
33215
|
if (centerIncompleteLines) {
|
|
33013
33216
|
const key2 = flowDir === "row" ? row : col;
|
|
33014
|
-
const
|
|
33015
|
-
if (
|
|
33016
|
-
const shift = (fullLineCount -
|
|
33217
|
+
const count2 = lineCounts.get(key2) ?? fullLineCount;
|
|
33218
|
+
if (count2 < fullLineCount) {
|
|
33219
|
+
const shift = (fullLineCount - count2) * (flowDir === "row" ? cellW + gapX : cellH + gapY) / 2;
|
|
33017
33220
|
if (flowDir === "row") {
|
|
33018
33221
|
x += shift;
|
|
33019
33222
|
} else {
|
|
@@ -33927,26 +34130,26 @@ var init_smartart_layout_interpreter_composite_foreach = __esm({
|
|
|
33927
34130
|
});
|
|
33928
34131
|
|
|
33929
34132
|
// diagram/hierarchy/smartart-hierarchy-pitch.ts
|
|
33930
|
-
function computeAxisPitch(dimension, margin, itemSize,
|
|
33931
|
-
const n = Math.max(1,
|
|
34133
|
+
function computeAxisPitch(dimension, margin, itemSize, count2, fixedGapRatio) {
|
|
34134
|
+
const n = Math.max(1, count2);
|
|
33932
34135
|
const gap = n <= 1 ? 0 : fixedGapRatio !== void 0 ? itemSize * Math.max(0, fixedGapRatio) : Math.max(0, (dimension - margin - n * itemSize) / (n - 1));
|
|
33933
34136
|
const pitch = itemSize + gap;
|
|
33934
34137
|
const centeredShift = (dimension - n * pitch + margin) / 2;
|
|
33935
34138
|
const maxShift = dimension - n * itemSize - gap * (n - 0.5);
|
|
33936
34139
|
return { pitch, shift: Math.min(centeredShift, maxShift) };
|
|
33937
34140
|
}
|
|
33938
|
-
function centeredAxisPitch(dimension, itemSize, gapRatio,
|
|
33939
|
-
const n = Math.max(1,
|
|
34141
|
+
function centeredAxisPitch(dimension, itemSize, gapRatio, count2) {
|
|
34142
|
+
const n = Math.max(1, count2);
|
|
33940
34143
|
const gap = n > 1 ? itemSize * Math.max(0, gapRatio) : 0;
|
|
33941
34144
|
const pitch = itemSize + gap;
|
|
33942
34145
|
const span = n * itemSize + Math.max(0, n - 1) * gap;
|
|
33943
34146
|
const shift = (dimension - span) / 2;
|
|
33944
34147
|
return { pitch, shift };
|
|
33945
34148
|
}
|
|
33946
|
-
function compositeFanPitch(dimension, boxW, compositeWidthFactor, cardOffsetXRatio, sibSpRatio,
|
|
34149
|
+
function compositeFanPitch(dimension, boxW, compositeWidthFactor, cardOffsetXRatio, sibSpRatio, count2) {
|
|
33947
34150
|
const compositeW = compositeWidthFactor ? boxW / compositeWidthFactor : boxW;
|
|
33948
34151
|
const cardOffsetX = cardOffsetXRatio * compositeW;
|
|
33949
|
-
const centred = centeredAxisPitch(dimension, compositeW, sibSpRatio,
|
|
34152
|
+
const centred = centeredAxisPitch(dimension, compositeW, sibSpRatio, count2);
|
|
33950
34153
|
const correction = cardOffsetX + boxW / 2 - centred.pitch / 2;
|
|
33951
34154
|
return { pitch: centred.pitch, shift: centred.shift + correction };
|
|
33952
34155
|
}
|
|
@@ -34047,16 +34250,16 @@ function childAxisSpec(template, childCount) {
|
|
|
34047
34250
|
const ownIndex = axis.indexOf("ch");
|
|
34048
34251
|
if (ownIndex >= 0) {
|
|
34049
34252
|
const start = template.presentationOf?.start?.[ownIndex] ?? 1;
|
|
34050
|
-
const
|
|
34051
|
-
return { positions: positionRange(start,
|
|
34253
|
+
const count2 = template.presentationOf?.count?.[ownIndex];
|
|
34254
|
+
return { positions: positionRange(start, count2, 1, childCount), fold };
|
|
34052
34255
|
}
|
|
34053
34256
|
const origin = template.forEachOrigin;
|
|
34054
34257
|
const originIndex = origin?.axis?.indexOf("ch") ?? -1;
|
|
34055
34258
|
if (origin && originIndex >= 0) {
|
|
34056
34259
|
const start = origin.start?.[originIndex] ?? 1;
|
|
34057
|
-
const
|
|
34260
|
+
const count2 = origin.count?.[originIndex];
|
|
34058
34261
|
const step = origin.step?.[originIndex] ?? 1;
|
|
34059
|
-
return { positions: positionRange(start,
|
|
34262
|
+
return { positions: positionRange(start, count2, step, childCount), fold };
|
|
34060
34263
|
}
|
|
34061
34264
|
return void 0;
|
|
34062
34265
|
}
|
|
@@ -34252,8 +34455,8 @@ function slotRect(slot, box, absX, absY) {
|
|
|
34252
34455
|
}
|
|
34253
34456
|
function arrangeByOrder(slotted, nodes, box, absX, absY, ctx, fontCtx) {
|
|
34254
34457
|
const perPoint = representativeSlotsPerPoint(slotted, nodes.length);
|
|
34255
|
-
const
|
|
34256
|
-
const slots = perPoint.slice(0,
|
|
34458
|
+
const count2 = Math.min(perPoint.length, nodes.length);
|
|
34459
|
+
const slots = perPoint.slice(0, count2).map((entry2) => slotRect(entry2, box, absX, absY));
|
|
34257
34460
|
const fontFit = fontCtx ? resolveSharedFontFit(
|
|
34258
34461
|
fontCtx,
|
|
34259
34462
|
perPoint[0]?.node,
|
|
@@ -34265,7 +34468,7 @@ function arrangeByOrder(slotted, nodes, box, absX, absY, ctx, fontCtx) {
|
|
|
34265
34468
|
}))
|
|
34266
34469
|
) : void 0;
|
|
34267
34470
|
const rendered = [];
|
|
34268
|
-
for (let i2 = 0; i2 <
|
|
34471
|
+
for (let i2 = 0; i2 < count2; i2++) {
|
|
34269
34472
|
const slot = slots[i2];
|
|
34270
34473
|
rendered.push(
|
|
34271
34474
|
presetBoxNode({
|
|
@@ -34276,7 +34479,7 @@ function arrangeByOrder(slotted, nodes, box, absX, absY, ctx, fontCtx) {
|
|
|
34276
34479
|
height: slot.height,
|
|
34277
34480
|
node: nodes[i2],
|
|
34278
34481
|
index: i2,
|
|
34279
|
-
total:
|
|
34482
|
+
total: count2,
|
|
34280
34483
|
palette: ctx.palette,
|
|
34281
34484
|
style: ctx.style,
|
|
34282
34485
|
fontSizeOverride: fontFit?.rootSizePx,
|
|
@@ -34321,9 +34524,9 @@ var init_smartart_layout_interpreter_composite_ring = __esm({
|
|
|
34321
34524
|
});
|
|
34322
34525
|
|
|
34323
34526
|
// diagram/layout/smartart-layout-interpreter-composite-pairs.ts
|
|
34324
|
-
function collectSelfDesPairs(selfSlots, desSlots, allChildren, nodes, box, absX, absY, childrenOf,
|
|
34527
|
+
function collectSelfDesPairs(selfSlots, desSlots, allChildren, nodes, box, absX, absY, childrenOf, count2) {
|
|
34325
34528
|
const pairs = [];
|
|
34326
|
-
for (let i2 = 0; i2 <
|
|
34529
|
+
for (let i2 = 0; i2 < count2; i2++) {
|
|
34327
34530
|
const node2 = nodes[i2];
|
|
34328
34531
|
const selfRect = resolveSlot(selfSlots[i2].dims, box, absX, absY);
|
|
34329
34532
|
const desSlotted = desSlots[i2];
|
|
@@ -34416,7 +34619,7 @@ function arrangeByPresentationOf(view, slotted, allChildren, nodes, flat, box, a
|
|
|
34416
34619
|
}
|
|
34417
34620
|
const desSlots = slotsWithAxis(slotted, "des");
|
|
34418
34621
|
const childRepeaterSlots = slotted.filter((slot) => !slot.node.presentationOf);
|
|
34419
|
-
const
|
|
34622
|
+
const count2 = Math.min(selfSlots.length, nodes.length);
|
|
34420
34623
|
const pairs = collectSelfDesPairs(
|
|
34421
34624
|
selfSlots,
|
|
34422
34625
|
desSlots,
|
|
@@ -34426,14 +34629,14 @@ function arrangeByPresentationOf(view, slotted, allChildren, nodes, flat, box, a
|
|
|
34426
34629
|
absX,
|
|
34427
34630
|
absY,
|
|
34428
34631
|
childrenOf,
|
|
34429
|
-
|
|
34632
|
+
count2
|
|
34430
34633
|
);
|
|
34431
34634
|
const fontFit = resolveFontFitFromPairs(fontCtx, selfSlots[0]?.node, pairs);
|
|
34432
34635
|
const rendered = [];
|
|
34433
|
-
for (let i2 = 0; i2 <
|
|
34636
|
+
for (let i2 = 0; i2 < count2; i2++) {
|
|
34434
34637
|
const { node: node2, selfRect, selfLayoutNode, desSlot } = pairs[i2];
|
|
34435
34638
|
rendered.push(
|
|
34436
|
-
...renderAnchoredPair(node2, i2,
|
|
34639
|
+
...renderAnchoredPair(node2, i2, count2, selfRect, selfLayoutNode, desSlot, ctx, fontFit)
|
|
34437
34640
|
);
|
|
34438
34641
|
for (const wrapperSlot of childRepeaterSlots) {
|
|
34439
34642
|
rendered.push(
|
|
@@ -34466,7 +34669,7 @@ function arrangeByPresentationOf(view, slotted, allChildren, nodes, flat, box, a
|
|
|
34466
34669
|
absY,
|
|
34467
34670
|
childrenOf,
|
|
34468
34671
|
ctx,
|
|
34469
|
-
|
|
34672
|
+
count2
|
|
34470
34673
|
)
|
|
34471
34674
|
);
|
|
34472
34675
|
return rendered;
|
|
@@ -35183,11 +35386,11 @@ var init_smartart_hierarchy_orgchart_tree = __esm({
|
|
|
35183
35386
|
// diagram/hierarchy/smartart-hierarchy-hang-depth.ts
|
|
35184
35387
|
function countDescendants(t, orgChart) {
|
|
35185
35388
|
const { normal } = partitionChildren(t, orgChart);
|
|
35186
|
-
let
|
|
35389
|
+
let count2 = normal.length;
|
|
35187
35390
|
for (const child31 of normal) {
|
|
35188
|
-
|
|
35391
|
+
count2 += countDescendants(child31, orgChart);
|
|
35189
35392
|
}
|
|
35190
|
-
return
|
|
35393
|
+
return count2;
|
|
35191
35394
|
}
|
|
35192
35395
|
function fanContinues(t, perRow, orgChart, siblingCount, normalCount) {
|
|
35193
35396
|
const chPrefFanEligible = Number.isFinite(perRow) && siblingCount === perRow && normalCount >= perRow;
|
|
@@ -35324,7 +35527,7 @@ var init_smartart_hierarchy_fan_aware_width = __esm({
|
|
|
35324
35527
|
});
|
|
35325
35528
|
|
|
35326
35529
|
// diagram/hierarchy/smartart-hierarchy-fold-depth.ts
|
|
35327
|
-
function endsInUnboundedDescendantHop(axis,
|
|
35530
|
+
function endsInUnboundedDescendantHop(axis, count2) {
|
|
35328
35531
|
if (!axis || axis.length === 0) {
|
|
35329
35532
|
return false;
|
|
35330
35533
|
}
|
|
@@ -35333,7 +35536,7 @@ function endsInUnboundedDescendantHop(axis, count) {
|
|
|
35333
35536
|
if (lastAxis !== "des" && lastAxis !== "desOrSelf") {
|
|
35334
35537
|
return false;
|
|
35335
35538
|
}
|
|
35336
|
-
const lastCount =
|
|
35539
|
+
const lastCount = count2?.[lastIndex];
|
|
35337
35540
|
return lastCount === void 0 || lastCount === 0;
|
|
35338
35541
|
}
|
|
35339
35542
|
function hierarchyLeafFoldsDescendants(node2) {
|
|
@@ -35665,17 +35868,17 @@ var init_smartart_hierarchy_hanging_box = __esm({
|
|
|
35665
35868
|
// diagram/hierarchy/smartart-hierarchy-hanging-fold.ts
|
|
35666
35869
|
function countRows(t, level2, orgChart, fold) {
|
|
35667
35870
|
const { assistants, normal } = partitionChildren(t, orgChart);
|
|
35668
|
-
let
|
|
35871
|
+
let count2 = 1 + assistants.length;
|
|
35669
35872
|
if (normal.length === 0) {
|
|
35670
|
-
return
|
|
35873
|
+
return count2;
|
|
35671
35874
|
}
|
|
35672
35875
|
if (fold && level2 >= 1) {
|
|
35673
|
-
return
|
|
35876
|
+
return count2;
|
|
35674
35877
|
}
|
|
35675
35878
|
for (const child31 of normal) {
|
|
35676
|
-
|
|
35879
|
+
count2 += countRows(child31, level2 + 1, orgChart, fold);
|
|
35677
35880
|
}
|
|
35678
|
-
return
|
|
35881
|
+
return count2;
|
|
35679
35882
|
}
|
|
35680
35883
|
function countHangingRows(roots, orgChart, fold) {
|
|
35681
35884
|
return roots.reduce((sum, root) => sum + countRows(root, 0, orgChart, fold), 0);
|
|
@@ -40576,8 +40779,8 @@ function readPairs(element, vt) {
|
|
|
40576
40779
|
const out = [];
|
|
40577
40780
|
for (let i2 = 0; i2 + 1 < variants.length; i2 += 2) {
|
|
40578
40781
|
const name = variants[i2]?.textContent ?? "";
|
|
40579
|
-
const
|
|
40580
|
-
out.push({ name, count: Number.isFinite(
|
|
40782
|
+
const count2 = Number.parseInt(variants[i2 + 1]?.textContent ?? "", 10);
|
|
40783
|
+
out.push({ name, count: Number.isFinite(count2) ? count2 : 0 });
|
|
40581
40784
|
}
|
|
40582
40785
|
return out;
|
|
40583
40786
|
}
|
|
@@ -40794,9 +40997,9 @@ var init_custom = __esm({
|
|
|
40794
40997
|
function titleGroups(headingPairs, titlesOfParts) {
|
|
40795
40998
|
let offset = 0;
|
|
40796
40999
|
return headingPairs.map((pair) => {
|
|
40797
|
-
const
|
|
40798
|
-
const titles = titlesOfParts.slice(offset, offset +
|
|
40799
|
-
offset +=
|
|
41000
|
+
const count2 = Math.max(0, pair.count);
|
|
41001
|
+
const titles = titlesOfParts.slice(offset, offset + count2);
|
|
41002
|
+
offset += count2;
|
|
40800
41003
|
return { name: pair.name, titles };
|
|
40801
41004
|
});
|
|
40802
41005
|
}
|
|
@@ -66691,7 +66894,7 @@ function parsedParagraphSignature(paragraph2) {
|
|
|
66691
66894
|
return signatureOf(counts);
|
|
66692
66895
|
}
|
|
66693
66896
|
function signatureOf(counts) {
|
|
66694
|
-
return [...counts.entries()].sort((a, b) => a[0] < b[0] ? -1 : 1).map(([name,
|
|
66897
|
+
return [...counts.entries()].sort((a, b) => a[0] < b[0] ? -1 : 1).map(([name, count2]) => `${name}:${count2}`).join(",");
|
|
66695
66898
|
}
|
|
66696
66899
|
function collectParsedParagraphs2(root) {
|
|
66697
66900
|
const result = [];
|
|
@@ -70038,23 +70241,23 @@ function classify(chars, index2) {
|
|
|
70038
70241
|
}
|
|
70039
70242
|
function countParagraphWords(text2) {
|
|
70040
70243
|
const chars = Array.from(text2);
|
|
70041
|
-
let
|
|
70244
|
+
let count2 = 0;
|
|
70042
70245
|
let previous = "none";
|
|
70043
70246
|
for (let index2 = 0; index2 < chars.length; index2++) {
|
|
70044
70247
|
const kind = classify(chars, index2);
|
|
70045
70248
|
if (kind === "space") {
|
|
70046
70249
|
if (previous === "none" || previous === "control") {
|
|
70047
|
-
|
|
70250
|
+
count2++;
|
|
70048
70251
|
}
|
|
70049
70252
|
previous = "space";
|
|
70050
70253
|
continue;
|
|
70051
70254
|
}
|
|
70052
70255
|
if (kind === "ideograph" || kind === "control" || kind !== previous) {
|
|
70053
|
-
|
|
70256
|
+
count2++;
|
|
70054
70257
|
}
|
|
70055
70258
|
previous = kind;
|
|
70056
70259
|
}
|
|
70057
|
-
return
|
|
70260
|
+
return count2;
|
|
70058
70261
|
}
|
|
70059
70262
|
var LINE_BREAK_CHAR, WORD_CHAR, DIGIT_CHAR, IDEOGRAPH_CHAR, SPACE_CHAR, WORD_JOINERS, NUMBER_JOINERS;
|
|
70060
70263
|
var init_app_properties_word_count = __esm({
|
|
@@ -70592,6 +70795,96 @@ var init_background_fill_shapes = __esm({
|
|
|
70592
70795
|
}
|
|
70593
70796
|
});
|
|
70594
70797
|
|
|
70798
|
+
// pptx/core/core/runtime/load-part-reader.ts
|
|
70799
|
+
function parseText2(parser, text2) {
|
|
70800
|
+
return text2 ? parser.parse(text2) : void 0;
|
|
70801
|
+
}
|
|
70802
|
+
function readPartText(zip, path4) {
|
|
70803
|
+
const reader2 = openReaders.get(zip);
|
|
70804
|
+
if (reader2) {
|
|
70805
|
+
return reader2.readText(path4);
|
|
70806
|
+
}
|
|
70807
|
+
return zip.file(path4)?.async("string") ?? Promise.resolve(void 0);
|
|
70808
|
+
}
|
|
70809
|
+
async function readPartXml(zip, parser, path4) {
|
|
70810
|
+
const reader2 = openReaders.get(zip);
|
|
70811
|
+
if (reader2) {
|
|
70812
|
+
return reader2.readXml(parser, path4);
|
|
70813
|
+
}
|
|
70814
|
+
const text2 = await zip.file(path4)?.async("string");
|
|
70815
|
+
return text2 ? parseText2(parser, text2) : void 0;
|
|
70816
|
+
}
|
|
70817
|
+
var openReaders, LoadPartReader;
|
|
70818
|
+
var init_load_part_reader = __esm({
|
|
70819
|
+
"pptx/core/core/runtime/load-part-reader.ts"() {
|
|
70820
|
+
openReaders = /* @__PURE__ */ new WeakMap();
|
|
70821
|
+
LoadPartReader = class {
|
|
70822
|
+
constructor(zip) {
|
|
70823
|
+
this.zip = zip;
|
|
70824
|
+
openReaders.set(zip, this);
|
|
70825
|
+
}
|
|
70826
|
+
zip;
|
|
70827
|
+
parts = /* @__PURE__ */ new Map();
|
|
70828
|
+
closed = false;
|
|
70829
|
+
entry(path4) {
|
|
70830
|
+
const file2 = this.zip.file(path4);
|
|
70831
|
+
if (!file2) {
|
|
70832
|
+
this.parts.delete(path4);
|
|
70833
|
+
return void 0;
|
|
70834
|
+
}
|
|
70835
|
+
const previous = this.parts.get(path4);
|
|
70836
|
+
if (previous?.file === file2) {
|
|
70837
|
+
return previous;
|
|
70838
|
+
}
|
|
70839
|
+
const entry2 = { file: file2, text: file2.async("string"), relationships: /* @__PURE__ */ new Map() };
|
|
70840
|
+
this.parts.set(path4, entry2);
|
|
70841
|
+
entry2.text.catch(() => {
|
|
70842
|
+
if (this.parts.get(path4) === entry2) {
|
|
70843
|
+
this.parts.delete(path4);
|
|
70844
|
+
}
|
|
70845
|
+
});
|
|
70846
|
+
return entry2;
|
|
70847
|
+
}
|
|
70848
|
+
readText(path4) {
|
|
70849
|
+
return this.entry(path4)?.text ?? Promise.resolve(void 0);
|
|
70850
|
+
}
|
|
70851
|
+
async readXml(parser, path4) {
|
|
70852
|
+
const entry2 = this.entry(path4);
|
|
70853
|
+
if (!entry2) {
|
|
70854
|
+
return void 0;
|
|
70855
|
+
}
|
|
70856
|
+
if (!path4.endsWith(".rels")) {
|
|
70857
|
+
return parseText2(parser, await entry2.text);
|
|
70858
|
+
}
|
|
70859
|
+
let parsed = entry2.relationships.get(parser);
|
|
70860
|
+
if (!parsed) {
|
|
70861
|
+
const pending = entry2.text.then((text2) => parseText2(parser, text2));
|
|
70862
|
+
entry2.relationships.set(parser, pending);
|
|
70863
|
+
pending.catch(() => {
|
|
70864
|
+
if (entry2.relationships.get(parser) === pending) {
|
|
70865
|
+
entry2.relationships.delete(parser);
|
|
70866
|
+
}
|
|
70867
|
+
});
|
|
70868
|
+
parsed = pending;
|
|
70869
|
+
}
|
|
70870
|
+
return structuredClone(await parsed);
|
|
70871
|
+
}
|
|
70872
|
+
/** Whether this reader still serves reads for its package. */
|
|
70873
|
+
get isOpen() {
|
|
70874
|
+
return !this.closed;
|
|
70875
|
+
}
|
|
70876
|
+
/** Drops every cached read; later reads of the package go to the archive. */
|
|
70877
|
+
close() {
|
|
70878
|
+
this.closed = true;
|
|
70879
|
+
if (openReaders.get(this.zip) === this) {
|
|
70880
|
+
openReaders.delete(this.zip);
|
|
70881
|
+
}
|
|
70882
|
+
this.parts.clear();
|
|
70883
|
+
}
|
|
70884
|
+
};
|
|
70885
|
+
}
|
|
70886
|
+
});
|
|
70887
|
+
|
|
70595
70888
|
// pptx/core/core/builders/element-hidden-flag.ts
|
|
70596
70889
|
function findCNvPr(shape) {
|
|
70597
70890
|
if (!shape) {
|
|
@@ -70665,11 +70958,10 @@ var init_flatten_elements = __esm({
|
|
|
70665
70958
|
|
|
70666
70959
|
// pptx/core/utils/slide-synchronization.ts
|
|
70667
70960
|
async function loadSlideSynchronization(input2) {
|
|
70668
|
-
const
|
|
70669
|
-
if (!
|
|
70961
|
+
const relsData = await readPartXml(input2.zip, input2.parser, input2.relsPath);
|
|
70962
|
+
if (!relsData) {
|
|
70670
70963
|
return void 0;
|
|
70671
70964
|
}
|
|
70672
|
-
const relsData = input2.parser.parse(relsXml);
|
|
70673
70965
|
const relationship2 = findSlideSyncRelationship(relsData);
|
|
70674
70966
|
if (!relationship2) {
|
|
70675
70967
|
return void 0;
|
|
@@ -70679,7 +70971,7 @@ async function loadSlideSynchronization(input2) {
|
|
|
70679
70971
|
return void 0;
|
|
70680
70972
|
}
|
|
70681
70973
|
const partPath = resolvePartPath2(input2.slidePath, target);
|
|
70682
|
-
const partXml = await input2.zip
|
|
70974
|
+
const partXml = await readPartText(input2.zip, partPath);
|
|
70683
70975
|
if (!partXml) {
|
|
70684
70976
|
return void 0;
|
|
70685
70977
|
}
|
|
@@ -70800,6 +71092,7 @@ function nextSlideSyncPath(files) {
|
|
|
70800
71092
|
var SLIDE_SYNC_CONTENT_TYPE;
|
|
70801
71093
|
var init_slide_synchronization = __esm({
|
|
70802
71094
|
"pptx/core/utils/slide-synchronization.ts"() {
|
|
71095
|
+
init_load_part_reader();
|
|
70803
71096
|
SLIDE_SYNC_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.slideSyncData+xml";
|
|
70804
71097
|
}
|
|
70805
71098
|
});
|
|
@@ -70813,11 +71106,10 @@ function ensureArray9(value) {
|
|
|
70813
71106
|
}
|
|
70814
71107
|
async function loadLegacyVmlDrawings(zip, parser, slidePath, relsPath2) {
|
|
70815
71108
|
try {
|
|
70816
|
-
const
|
|
70817
|
-
if (!
|
|
71109
|
+
const relsData = await readPartXml(zip, parser, relsPath2);
|
|
71110
|
+
if (!relsData) {
|
|
70818
71111
|
return [];
|
|
70819
71112
|
}
|
|
70820
|
-
const relsData = parser.parse(relsXml);
|
|
70821
71113
|
const relationships3 = ensureArray9(
|
|
70822
71114
|
relsData["Relationships"]?.["Relationship"]
|
|
70823
71115
|
);
|
|
@@ -70840,7 +71132,7 @@ async function loadLegacyVmlDrawings(zip, parser, slidePath, relsPath2) {
|
|
|
70840
71132
|
if (!resolved) {
|
|
70841
71133
|
continue;
|
|
70842
71134
|
}
|
|
70843
|
-
const vmlXml = await zip
|
|
71135
|
+
const vmlXml = await readPartText(zip, resolved);
|
|
70844
71136
|
if (!vmlXml) {
|
|
70845
71137
|
continue;
|
|
70846
71138
|
}
|
|
@@ -70859,6 +71151,7 @@ async function loadLegacyVmlDrawings(zip, parser, slidePath, relsPath2) {
|
|
|
70859
71151
|
var VML_DRAWING_REL_SUFFIX;
|
|
70860
71152
|
var init_vml_drawing_loader = __esm({
|
|
70861
71153
|
"pptx/core/utils/vml-drawing-loader.ts"() {
|
|
71154
|
+
init_load_part_reader();
|
|
70862
71155
|
init_safe_path();
|
|
70863
71156
|
init_vml_parser();
|
|
70864
71157
|
VML_DRAWING_REL_SUFFIX = "/relationships/vmlDrawing";
|
|
@@ -72865,10 +73158,10 @@ function assertAfterAnimationClearSupported(effectCTn) {
|
|
|
72865
73158
|
if (!isXmlObject5(sub)) return;
|
|
72866
73159
|
const countAfterFlags = (value) => {
|
|
72867
73160
|
if (Array.isArray(value))
|
|
72868
|
-
return value.reduce((
|
|
73161
|
+
return value.reduce((count2, child31) => count2 + countAfterFlags(child31), 0);
|
|
72869
73162
|
if (!isXmlObject5(value)) return 0;
|
|
72870
73163
|
return Object.entries(value).reduce(
|
|
72871
|
-
(
|
|
73164
|
+
(count2, [key2, child31]) => count2 + (key2 === "@_afterEffect" && ["1", "true"].includes(String(child31)) ? 1 : countAfterFlags(child31)),
|
|
72872
73165
|
0
|
|
72873
73166
|
);
|
|
72874
73167
|
};
|
|
@@ -73366,6 +73659,7 @@ var PptxSlideLoaderService;
|
|
|
73366
73659
|
var init_PptxSlideLoaderService = __esm({
|
|
73367
73660
|
"pptx/core/services/PptxSlideLoaderService.ts"() {
|
|
73368
73661
|
init_background_fill_shapes();
|
|
73662
|
+
init_load_part_reader();
|
|
73369
73663
|
init_element_hidden_flag();
|
|
73370
73664
|
init_background_style_ref();
|
|
73371
73665
|
init_flatten_elements();
|
|
@@ -73426,11 +73720,14 @@ var init_PptxSlideLoaderService = __esm({
|
|
|
73426
73720
|
* @returns Map of relationship ID to target path string.
|
|
73427
73721
|
*/
|
|
73428
73722
|
async loadPresentationSlideRels(params) {
|
|
73429
|
-
const
|
|
73430
|
-
|
|
73723
|
+
const relsData = await readPartXml(
|
|
73724
|
+
params.zip,
|
|
73725
|
+
params.parser,
|
|
73726
|
+
"ppt/_rels/presentation.xml.rels"
|
|
73727
|
+
);
|
|
73728
|
+
if (!relsData) {
|
|
73431
73729
|
return /* @__PURE__ */ new Map();
|
|
73432
73730
|
}
|
|
73433
|
-
const relsData = params.parser.parse(relsXml);
|
|
73434
73731
|
const relationships3 = relsData["Relationships"]?.["Relationship"];
|
|
73435
73732
|
const relNodes = this.toXmlObjectArray(relationships3);
|
|
73436
73733
|
const relsMap = /* @__PURE__ */ new Map();
|
|
@@ -73470,7 +73767,7 @@ var init_PptxSlideLoaderService = __esm({
|
|
|
73470
73767
|
if (!params.zip.file(path4)) {
|
|
73471
73768
|
path4 = `ppt/${target}`;
|
|
73472
73769
|
}
|
|
73473
|
-
const slideXmlStr = await params.zip
|
|
73770
|
+
const slideXmlStr = await readPartText(params.zip, path4);
|
|
73474
73771
|
if (!slideXmlStr) {
|
|
73475
73772
|
return void 0;
|
|
73476
73773
|
}
|
|
@@ -94708,8 +95005,8 @@ function reorderContainer(node2, rawInner) {
|
|
|
94708
95005
|
if (isGroupedByTag(children16.map((child31) => child31.tag))) {
|
|
94709
95006
|
return;
|
|
94710
95007
|
}
|
|
94711
|
-
for (const [tag,
|
|
94712
|
-
if (ensureItems(node2[tag]).length !==
|
|
95008
|
+
for (const [tag, count2] of occurrence) {
|
|
95009
|
+
if (ensureItems(node2[tag]).length !== count2) {
|
|
94713
95010
|
return;
|
|
94714
95011
|
}
|
|
94715
95012
|
}
|
|
@@ -94731,8 +95028,8 @@ function annotateOmmlSiblingOrder(xml, parsed) {
|
|
|
94731
95028
|
return;
|
|
94732
95029
|
}
|
|
94733
95030
|
const nodes = collectParsedOmathNodes(parsed);
|
|
94734
|
-
const
|
|
94735
|
-
for (let index2 = 0; index2 <
|
|
95031
|
+
const count2 = Math.min(fragments.length, nodes.length);
|
|
95032
|
+
for (let index2 = 0; index2 < count2; index2++) {
|
|
94736
95033
|
if (fragments[index2]) {
|
|
94737
95034
|
reorderContainer(nodes[index2], fragments[index2]);
|
|
94738
95035
|
}
|
|
@@ -95872,6 +96169,180 @@ var init_eot_parser = __esm({
|
|
|
95872
96169
|
}
|
|
95873
96170
|
});
|
|
95874
96171
|
|
|
96172
|
+
// pptx/core/utils/deferred-embedded-font.ts
|
|
96173
|
+
function resolveEmbeddedFontGuid(source) {
|
|
96174
|
+
if (isEotFormat(source.originalPartBytes)) {
|
|
96175
|
+
return void 0;
|
|
96176
|
+
}
|
|
96177
|
+
const { fontKey } = source;
|
|
96178
|
+
const fromKey = fontKey ? extractGuidFromPartName(fontKey) ?? fontKey.replace(/[{}]/g, "").trim() : null;
|
|
96179
|
+
return fromKey || extractGuidFromPartName(source.partPath) || void 0;
|
|
96180
|
+
}
|
|
96181
|
+
function hasSfntSignature(bytes) {
|
|
96182
|
+
if (bytes.length < 4) {
|
|
96183
|
+
return false;
|
|
96184
|
+
}
|
|
96185
|
+
const [v0, v1, v2, v3] = bytes;
|
|
96186
|
+
return v0 === 0 && v1 === 1 && v2 === 0 && v3 === 0 || v0 === 79 && v1 === 84 && v2 === 84 && v3 === 79 || v0 === 116 && v1 === 116 && v2 === 99 && v3 === 102 || v0 === 119 && v1 === 79 && v2 === 70 && (v3 === 70 || v3 === 50);
|
|
96187
|
+
}
|
|
96188
|
+
function warnInvalidSignature(name, bytes) {
|
|
96189
|
+
const hex5 = Array.from(bytes.subarray(0, 4), (b) => b.toString(16)).join(",");
|
|
96190
|
+
console.warn(
|
|
96191
|
+
`[pptx-viewer] Embedded font "${name}" has invalid sfnt header [${hex5}] after processing; skipping (web font fallback will be used)`
|
|
96192
|
+
);
|
|
96193
|
+
}
|
|
96194
|
+
function isEmbeddedFontPartPlausible(source) {
|
|
96195
|
+
const bytes = source.originalPartBytes;
|
|
96196
|
+
if (bytes.length === 0) {
|
|
96197
|
+
return false;
|
|
96198
|
+
}
|
|
96199
|
+
if (isEotFormat(bytes)) {
|
|
96200
|
+
return true;
|
|
96201
|
+
}
|
|
96202
|
+
const guid3 = resolveEmbeddedFontGuid(source);
|
|
96203
|
+
if (!guid3) {
|
|
96204
|
+
console.warn(
|
|
96205
|
+
`[pptx-viewer] Embedded font "${source.name}" at "${source.partPath}" has no fontKey attribute and no GUID in filename; skipping`
|
|
96206
|
+
);
|
|
96207
|
+
return false;
|
|
96208
|
+
}
|
|
96209
|
+
const header = deobfuscateFont(bytes.subarray(0, Math.min(bytes.length, 32)), guid3);
|
|
96210
|
+
if (header.length < 4) {
|
|
96211
|
+
return false;
|
|
96212
|
+
}
|
|
96213
|
+
if (!hasSfntSignature(header)) {
|
|
96214
|
+
warnInvalidSignature(source.name, header);
|
|
96215
|
+
return false;
|
|
96216
|
+
}
|
|
96217
|
+
return true;
|
|
96218
|
+
}
|
|
96219
|
+
function uint8ArrayToBase64(bytes) {
|
|
96220
|
+
let binary = "";
|
|
96221
|
+
const chunkSize = 8192;
|
|
96222
|
+
for (let i2 = 0; i2 < bytes.length; i2 += chunkSize) {
|
|
96223
|
+
const chunk2 = bytes.subarray(i2, Math.min(i2 + chunkSize, bytes.length));
|
|
96224
|
+
for (let j = 0; j < chunk2.length; j++) {
|
|
96225
|
+
binary += String.fromCharCode(chunk2[j]);
|
|
96226
|
+
}
|
|
96227
|
+
}
|
|
96228
|
+
return btoa(binary);
|
|
96229
|
+
}
|
|
96230
|
+
function decodeEmbeddedFontPart(source) {
|
|
96231
|
+
const { name, partPath, originalPartBytes } = source;
|
|
96232
|
+
try {
|
|
96233
|
+
let fontData;
|
|
96234
|
+
const fontGuid = resolveEmbeddedFontGuid(source);
|
|
96235
|
+
if (isEotFormat(originalPartBytes)) {
|
|
96236
|
+
const extracted = extractFontFromEot(originalPartBytes);
|
|
96237
|
+
if (!extracted) {
|
|
96238
|
+
const header = parseEotHeader(originalPartBytes);
|
|
96239
|
+
console.info(
|
|
96240
|
+
`[pptx-viewer] Embedded font "${name}" uses EOT format${header?.isCompressed ? " with MTX compression" : ""}; extraction failed, will use web font fallback`
|
|
96241
|
+
);
|
|
96242
|
+
return null;
|
|
96243
|
+
}
|
|
96244
|
+
fontData = extracted.fontData;
|
|
96245
|
+
} else if (fontGuid) {
|
|
96246
|
+
fontData = deobfuscateFont(originalPartBytes, fontGuid);
|
|
96247
|
+
} else {
|
|
96248
|
+
console.warn(
|
|
96249
|
+
`[pptx-viewer] Embedded font "${name}" at "${partPath}" has no fontKey attribute and no GUID in filename; skipping`
|
|
96250
|
+
);
|
|
96251
|
+
return null;
|
|
96252
|
+
}
|
|
96253
|
+
if (fontData.length < 4) {
|
|
96254
|
+
return null;
|
|
96255
|
+
}
|
|
96256
|
+
if (!hasSfntSignature(fontData)) {
|
|
96257
|
+
warnInvalidSignature(name, fontData);
|
|
96258
|
+
return null;
|
|
96259
|
+
}
|
|
96260
|
+
const format = detectFontFormat(fontData);
|
|
96261
|
+
const mimeType = format === "woff2" ? "font/woff2" : format === "woff" ? "font/woff" : format === "opentype" ? "font/otf" : "font/ttf";
|
|
96262
|
+
return {
|
|
96263
|
+
name,
|
|
96264
|
+
dataUrl: `data:${mimeType};base64,${uint8ArrayToBase64(fontData)}`,
|
|
96265
|
+
bold: source.bold,
|
|
96266
|
+
italic: source.italic,
|
|
96267
|
+
format,
|
|
96268
|
+
rawFontData: fontData,
|
|
96269
|
+
partPath,
|
|
96270
|
+
fontGuid,
|
|
96271
|
+
originalRId: source.originalRId,
|
|
96272
|
+
originalPartBytes
|
|
96273
|
+
};
|
|
96274
|
+
} catch {
|
|
96275
|
+
return null;
|
|
96276
|
+
}
|
|
96277
|
+
}
|
|
96278
|
+
function createDeferredEmbeddedFont(source) {
|
|
96279
|
+
const fontGuid = resolveEmbeddedFontGuid(source);
|
|
96280
|
+
let fields;
|
|
96281
|
+
let pending;
|
|
96282
|
+
const decode3 = () => {
|
|
96283
|
+
if (!fields) {
|
|
96284
|
+
const decoded = decodeEmbeddedFontPart(source);
|
|
96285
|
+
fields = {
|
|
96286
|
+
dataUrl: decoded?.dataUrl ?? "",
|
|
96287
|
+
format: decoded?.format,
|
|
96288
|
+
rawFontData: decoded?.rawFontData
|
|
96289
|
+
};
|
|
96290
|
+
}
|
|
96291
|
+
return fields;
|
|
96292
|
+
};
|
|
96293
|
+
const font = {
|
|
96294
|
+
name: source.name,
|
|
96295
|
+
get dataUrl() {
|
|
96296
|
+
return decode3().dataUrl;
|
|
96297
|
+
},
|
|
96298
|
+
set dataUrl(value) {
|
|
96299
|
+
decode3().dataUrl = value;
|
|
96300
|
+
},
|
|
96301
|
+
bold: source.bold,
|
|
96302
|
+
italic: source.italic,
|
|
96303
|
+
get format() {
|
|
96304
|
+
return decode3().format;
|
|
96305
|
+
},
|
|
96306
|
+
set format(value) {
|
|
96307
|
+
decode3().format = value;
|
|
96308
|
+
},
|
|
96309
|
+
get rawFontData() {
|
|
96310
|
+
return decode3().rawFontData;
|
|
96311
|
+
},
|
|
96312
|
+
set rawFontData(value) {
|
|
96313
|
+
decode3().rawFontData = value;
|
|
96314
|
+
},
|
|
96315
|
+
partPath: source.partPath,
|
|
96316
|
+
fontGuid,
|
|
96317
|
+
originalRId: source.originalRId,
|
|
96318
|
+
originalPartBytes: source.originalPartBytes
|
|
96319
|
+
};
|
|
96320
|
+
Object.defineProperties(font, {
|
|
96321
|
+
load: {
|
|
96322
|
+
value: () => pending ??= Promise.resolve().then(
|
|
96323
|
+
() => decode3().rawFontData?.length || decode3().dataUrl ? font : null
|
|
96324
|
+
)
|
|
96325
|
+
},
|
|
96326
|
+
isLoaded: { get: () => fields !== void 0 }
|
|
96327
|
+
});
|
|
96328
|
+
return font;
|
|
96329
|
+
}
|
|
96330
|
+
function shouldSaveEmbeddedFontVerbatim(font) {
|
|
96331
|
+
if (font.isLoaded === void 0 || !font.originalPartBytes?.length) {
|
|
96332
|
+
return false;
|
|
96333
|
+
}
|
|
96334
|
+
if (!font.originalRId || !font.partPath) {
|
|
96335
|
+
return false;
|
|
96336
|
+
}
|
|
96337
|
+
return font.isLoaded === false || !font.rawFontData?.length;
|
|
96338
|
+
}
|
|
96339
|
+
var init_deferred_embedded_font = __esm({
|
|
96340
|
+
"pptx/core/utils/deferred-embedded-font.ts"() {
|
|
96341
|
+
init_eot_parser();
|
|
96342
|
+
init_font_deobfuscation();
|
|
96343
|
+
}
|
|
96344
|
+
});
|
|
96345
|
+
|
|
95875
96346
|
// pptx/core/core/runtime/header-footer-parts.ts
|
|
95876
96347
|
function asArray3(value) {
|
|
95877
96348
|
if (Array.isArray(value)) {
|
|
@@ -97659,12 +98130,11 @@ async function chartLabelsHaveEditableSources(xml, zip, chartSpace, seriesNodes,
|
|
|
97659
98130
|
if (!external.targetPath || !external.embeddedWorkbookData) return false;
|
|
97660
98131
|
const target = resolve(chartPartPath, external.targetPath);
|
|
97661
98132
|
let references = 0;
|
|
97662
|
-
const parser = new fastXmlParser.XMLParser({ ignoreAttributes: false, attributeNamePrefix: "@_" });
|
|
97663
98133
|
try {
|
|
97664
98134
|
for (const path4 of Object.keys(zip.files)) {
|
|
97665
98135
|
if (!path4.endsWith(".rels") || !path4.includes("/_rels/")) continue;
|
|
97666
98136
|
const source = path4.replace("/_rels/", "/").slice(0, -5);
|
|
97667
|
-
const tree =
|
|
98137
|
+
const tree = await readPartXml(zip, relationshipParser, path4);
|
|
97668
98138
|
for (const rel of xmlChildren(xmlChild(tree, "Relationships"), "Relationship")) {
|
|
97669
98139
|
const relationshipTarget2 = xmlAttr(rel, "Target");
|
|
97670
98140
|
if (relationshipTarget2 && xmlAttr(rel, "TargetMode") !== "External" && resolve(source, relationshipTarget2) === target)
|
|
@@ -97681,11 +98151,14 @@ async function chartLabelsHaveEditableSources(xml, zip, chartSpace, seriesNodes,
|
|
|
97681
98151
|
return false;
|
|
97682
98152
|
}
|
|
97683
98153
|
}
|
|
98154
|
+
var relationshipParser;
|
|
97684
98155
|
var init_chart_label_source = __esm({
|
|
97685
98156
|
"pptx/core/utils/chart-label-source.ts"() {
|
|
98157
|
+
init_load_part_reader();
|
|
97686
98158
|
init_chart_xlsx_writer();
|
|
97687
98159
|
init_xml_access();
|
|
97688
98160
|
init_chart_xlsx_cellref();
|
|
98161
|
+
relationshipParser = new fastXmlParser.XMLParser({ ignoreAttributes: false, attributeNamePrefix: "@_" });
|
|
97689
98162
|
}
|
|
97690
98163
|
});
|
|
97691
98164
|
|
|
@@ -97912,10 +98385,10 @@ function collectFilteredSeriesIndices(container2, xmlLookup) {
|
|
|
97912
98385
|
}
|
|
97913
98386
|
return reserved;
|
|
97914
98387
|
}
|
|
97915
|
-
function assignSeriesIndices(
|
|
98388
|
+
function assignSeriesIndices(count2, reservedIndices) {
|
|
97916
98389
|
const assigned = [];
|
|
97917
98390
|
let cursor = 0;
|
|
97918
|
-
for (let i2 = 0; i2 <
|
|
98391
|
+
for (let i2 = 0; i2 < count2; i2++) {
|
|
97919
98392
|
while (reservedIndices.has(cursor)) {
|
|
97920
98393
|
cursor++;
|
|
97921
98394
|
}
|
|
@@ -98604,8 +99077,8 @@ function parseCache(node2) {
|
|
|
98604
99077
|
return point2;
|
|
98605
99078
|
})
|
|
98606
99079
|
};
|
|
98607
|
-
const
|
|
98608
|
-
if (Number.isInteger(
|
|
99080
|
+
const count2 = Number(cVal(node2, "ptCount") ?? Number.NaN);
|
|
99081
|
+
if (Number.isInteger(count2) && count2 >= 0) cache.pointCount = count2;
|
|
98609
99082
|
const formatCode2 = cChild(node2, "formatCode")?.textContent;
|
|
98610
99083
|
if (formatCode2) cache.formatCode = formatCode2;
|
|
98611
99084
|
return cache;
|
|
@@ -98623,8 +99096,8 @@ function parseDataSource(element) {
|
|
|
98623
99096
|
const levels = cChild(ref, "multiLvlStrCache");
|
|
98624
99097
|
if (levels) {
|
|
98625
99098
|
source.levels = children2(levels, "lvl", NS.c).map(parseCache);
|
|
98626
|
-
const
|
|
98627
|
-
if (Number.isInteger(
|
|
99099
|
+
const count2 = Number(cVal(levels, "ptCount") ?? Number.NaN);
|
|
99100
|
+
if (Number.isInteger(count2) && count2 >= 0) source.levelPointCount = count2;
|
|
98628
99101
|
}
|
|
98629
99102
|
return source;
|
|
98630
99103
|
}
|
|
@@ -100191,7 +100664,7 @@ function parseChartData(context, element) {
|
|
|
100191
100664
|
}
|
|
100192
100665
|
return out;
|
|
100193
100666
|
}
|
|
100194
|
-
function
|
|
100667
|
+
function parseText3(context, element) {
|
|
100195
100668
|
if (!element) return void 0;
|
|
100196
100669
|
reportUnmodelled2(context, element, /* @__PURE__ */ new Set(["txData", "rich"]));
|
|
100197
100670
|
const data = cxChild(element, "txData");
|
|
@@ -100211,7 +100684,7 @@ function parseTitle2(context, element) {
|
|
|
100211
100684
|
return assignDefined(
|
|
100212
100685
|
{},
|
|
100213
100686
|
{
|
|
100214
|
-
tx:
|
|
100687
|
+
tx: parseText3(context, cxChild(element, "tx")),
|
|
100215
100688
|
spPr: shapeProperties2(element),
|
|
100216
100689
|
txPr: textProperties2(element),
|
|
100217
100690
|
position: attribute6(element, "pos"),
|
|
@@ -100456,7 +100929,7 @@ function parseSeries2(context, element) {
|
|
|
100456
100929
|
ownerIndex: numberAttribute(context, element, "ownerIdx"),
|
|
100457
100930
|
uniqueId: attribute6(element, "uniqueId"),
|
|
100458
100931
|
formatIndex: numberAttribute(context, element, "formatIdx"),
|
|
100459
|
-
tx:
|
|
100932
|
+
tx: parseText3(context, cxChild(element, "tx")),
|
|
100460
100933
|
spPr: shapeProperties2(element),
|
|
100461
100934
|
txPr: textProperties2(element),
|
|
100462
100935
|
valueColorsXml: rawChild2(element, "valueColors"),
|
|
@@ -108347,9 +108820,9 @@ function buildFopt(simple, complex = []) {
|
|
|
108347
108820
|
payload.bytes(bytes);
|
|
108348
108821
|
}
|
|
108349
108822
|
}
|
|
108350
|
-
const
|
|
108823
|
+
const count2 = simple.length + complex.length;
|
|
108351
108824
|
const data = new ByteWriter().append(entries).append(payload).toBytes();
|
|
108352
|
-
return record(OA.FOPT, data,
|
|
108825
|
+
return record(OA.FOPT, data, count2, false, 3);
|
|
108353
108826
|
}
|
|
108354
108827
|
function buildMetroBlobTertiaryFopt(metroBlob) {
|
|
108355
108828
|
const data = new ByteWriter().u16(METRO_BLOB_OPID | 32768 | FBID_FLAG).u32(metroBlob.length >>> 0).bytes(metroBlob).toBytes();
|
|
@@ -108413,9 +108886,9 @@ function buildDgg(shapesPerDrawing, totalShapes) {
|
|
|
108413
108886
|
const cidcl = drawingCount + 1;
|
|
108414
108887
|
const cspSaved = totalShapes - drawingCount;
|
|
108415
108888
|
const w = new ByteWriter().u32(maxShapeId).u32(cidcl).u32(cspSaved).u32(drawingCount);
|
|
108416
|
-
shapesPerDrawing.forEach((
|
|
108889
|
+
shapesPerDrawing.forEach((count2, i2) => {
|
|
108417
108890
|
const drawingId = i2 + 1;
|
|
108418
|
-
w.u32(drawingId).u32(
|
|
108891
|
+
w.u32(drawingId).u32(count2);
|
|
108419
108892
|
});
|
|
108420
108893
|
return record(OA.Dgg, w.toBytes(), 0, false, 0);
|
|
108421
108894
|
}
|
|
@@ -109243,8 +109716,8 @@ function atom(recType, data) {
|
|
|
109243
109716
|
function textHeader(textType) {
|
|
109244
109717
|
return atom(RT.TextHeaderAtom, new ByteWriter().u32(textType).toBytes());
|
|
109245
109718
|
}
|
|
109246
|
-
function textSpecInfo(
|
|
109247
|
-
return atom(RT.TextSpecInfoAtom, new ByteWriter().u32(
|
|
109719
|
+
function textSpecInfo(count2) {
|
|
109720
|
+
return atom(RT.TextSpecInfoAtom, new ByteWriter().u32(count2).u32(1).u16(0).toBytes());
|
|
109248
109721
|
}
|
|
109249
109722
|
function promptText(textType, paragraphs) {
|
|
109250
109723
|
const text2 = paragraphs.join("\r");
|
|
@@ -110055,17 +110528,17 @@ function slideMasterIndex(masterIndex, masterCount) {
|
|
|
110055
110528
|
return masterIndex !== void 0 && Number.isInteger(masterIndex) && masterIndex >= 0 && masterIndex < masterCount ? masterIndex : 0;
|
|
110056
110529
|
}
|
|
110057
110530
|
function countDrawingShapes(shapes) {
|
|
110058
|
-
let
|
|
110531
|
+
let count2 = 1;
|
|
110059
110532
|
const walk3 = (list3) => {
|
|
110060
110533
|
for (const shape of list3) {
|
|
110061
|
-
|
|
110534
|
+
count2++;
|
|
110062
110535
|
if (shape.kind === "group") {
|
|
110063
110536
|
walk3(shape.children);
|
|
110064
110537
|
}
|
|
110065
110538
|
}
|
|
110066
110539
|
};
|
|
110067
110540
|
walk3(shapes);
|
|
110068
|
-
return
|
|
110541
|
+
return count2;
|
|
110069
110542
|
}
|
|
110070
110543
|
function collectFonts(deck, masters) {
|
|
110071
110544
|
const collect = (shape) => {
|
|
@@ -110646,7 +111119,7 @@ function toLevel(style = {}, themeFonts = {}) {
|
|
|
110646
111119
|
}
|
|
110647
111120
|
};
|
|
110648
111121
|
}
|
|
110649
|
-
function toLevels(levels,
|
|
111122
|
+
function toLevels(levels, count2, themeFonts) {
|
|
110650
111123
|
if (!levels) {
|
|
110651
111124
|
return void 0;
|
|
110652
111125
|
}
|
|
@@ -110656,7 +111129,7 @@ function toLevels(levels, count, themeFonts) {
|
|
|
110656
111129
|
}
|
|
110657
111130
|
const base2 = levels[-1];
|
|
110658
111131
|
return Array.from(
|
|
110659
|
-
{ length:
|
|
111132
|
+
{ length: count2 },
|
|
110660
111133
|
(_, i2) => toLevel(base2 || levels[i2] ? { ...base2, ...levels[i2] } : void 0, themeFonts)
|
|
110661
111134
|
);
|
|
110662
111135
|
}
|
|
@@ -111565,12 +112038,12 @@ function visitGraphicData(node2, relationshipId2, extended2, getLocalName2) {
|
|
|
111565
112038
|
}
|
|
111566
112039
|
if (Array.isArray(node2)) {
|
|
111567
112040
|
return node2.reduce(
|
|
111568
|
-
(
|
|
112041
|
+
(count3, entry2) => count3 + visitGraphicData(entry2, relationshipId2, extended2, getLocalName2),
|
|
111569
112042
|
0
|
|
111570
112043
|
);
|
|
111571
112044
|
}
|
|
111572
112045
|
const object2 = node2;
|
|
111573
|
-
let
|
|
112046
|
+
let count2 = 0;
|
|
111574
112047
|
for (const key2 of Object.keys(object2)) {
|
|
111575
112048
|
if (key2.startsWith("@_")) {
|
|
111576
112049
|
continue;
|
|
@@ -111582,14 +112055,14 @@ function visitGraphicData(node2, relationshipId2, extended2, getLocalName2) {
|
|
|
111582
112055
|
const chart = chartKey ? candidate[chartKey] : void 0;
|
|
111583
112056
|
if (chart && String(chart["@_r:id"]) === relationshipId2) {
|
|
111584
112057
|
rebindGraphicData(candidate, relationshipId2, extended2);
|
|
111585
|
-
|
|
112058
|
+
count2 += 1;
|
|
111586
112059
|
}
|
|
111587
112060
|
}
|
|
111588
112061
|
continue;
|
|
111589
112062
|
}
|
|
111590
|
-
|
|
112063
|
+
count2 += visitGraphicData(value, relationshipId2, extended2, getLocalName2);
|
|
111591
112064
|
}
|
|
111592
|
-
return
|
|
112065
|
+
return count2;
|
|
111593
112066
|
}
|
|
111594
112067
|
async function rewriteChartGraphicFrames(deps, slidePath, relationshipId2, extended2) {
|
|
111595
112068
|
const xml = await deps.zip.file(slidePath)?.async("string");
|
|
@@ -111597,11 +112070,11 @@ async function rewriteChartGraphicFrames(deps, slidePath, relationshipId2, exten
|
|
|
111597
112070
|
return 0;
|
|
111598
112071
|
}
|
|
111599
112072
|
const tree = deps.parser.parse(xml);
|
|
111600
|
-
const
|
|
111601
|
-
if (
|
|
112073
|
+
const count2 = visitGraphicData(tree, relationshipId2, extended2, deps.getLocalName);
|
|
112074
|
+
if (count2 > 0) {
|
|
111602
112075
|
deps.zip.file(slidePath, deps.builder.build(tree));
|
|
111603
112076
|
}
|
|
111604
|
-
return
|
|
112077
|
+
return count2;
|
|
111605
112078
|
}
|
|
111606
112079
|
var CHART_GRAPHIC_DATA_URI, CHART_EX_GRAPHIC_DATA_URI, NS_R;
|
|
111607
112080
|
var init_chart_part_registration = __esm({
|
|
@@ -114076,8 +114549,8 @@ async function discoverTagCollections(zip, codec2) {
|
|
|
114076
114549
|
if (!sourcePartPath) {
|
|
114077
114550
|
continue;
|
|
114078
114551
|
}
|
|
114079
|
-
const data =
|
|
114080
|
-
const root = data["Relationships"];
|
|
114552
|
+
const data = await readPartXml(zip, codec2, relFile.name);
|
|
114553
|
+
const root = data?.["Relationships"];
|
|
114081
114554
|
for (const relationship2 of ensureArray17(root?.["Relationship"])) {
|
|
114082
114555
|
if (String(relationship2["@_Type"] ?? "") !== TAG_RELATIONSHIP_TYPE) {
|
|
114083
114556
|
continue;
|
|
@@ -114182,7 +114655,7 @@ async function removeTagContentTypeOverride(zip, codec2, path4) {
|
|
|
114182
114655
|
zip.file("[Content_Types].xml", codec2.build(data));
|
|
114183
114656
|
}
|
|
114184
114657
|
async function readTagCollection(zip, codec2, path4) {
|
|
114185
|
-
const xml = await zip
|
|
114658
|
+
const xml = await readPartText(zip, path4);
|
|
114186
114659
|
if (!xml) {
|
|
114187
114660
|
return void 0;
|
|
114188
114661
|
}
|
|
@@ -114291,6 +114764,7 @@ function ensureArray17(value) {
|
|
|
114291
114764
|
var TAG_RELATIONSHIP_TYPE, TAG_CONTENT_TYPE;
|
|
114292
114765
|
var init_tag_package = __esm({
|
|
114293
114766
|
"pptx/core/utils/tag-package.ts"() {
|
|
114767
|
+
init_load_part_reader();
|
|
114294
114768
|
init_safe_path();
|
|
114295
114769
|
init_tag_package_owning_element();
|
|
114296
114770
|
TAG_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/tags";
|
|
@@ -119624,10 +120098,35 @@ var init_PptxHandlerRuntimeState = __esm({
|
|
|
119624
120098
|
"pptx/core/core/runtime/PptxHandlerRuntimeState.ts"() {
|
|
119625
120099
|
init_utils();
|
|
119626
120100
|
init_part_rels_path();
|
|
120101
|
+
init_load_part_reader();
|
|
119627
120102
|
init_template_element_baselines();
|
|
119628
120103
|
PptxHandlerRuntime = class {
|
|
119629
120104
|
/** The in-memory ZIP archive representing the OPC (.pptx) package. */
|
|
119630
120105
|
zip;
|
|
120106
|
+
/** Shares part reads within the load in progress; see {@link LoadPartReader}. */
|
|
120107
|
+
loadPartReader;
|
|
120108
|
+
/** Opens a part reader for the current package, closing any earlier one. */
|
|
120109
|
+
beginPartReads() {
|
|
120110
|
+
this.endPartReads();
|
|
120111
|
+
const reader2 = new LoadPartReader(this.zip);
|
|
120112
|
+
this.loadPartReader = reader2;
|
|
120113
|
+
return reader2;
|
|
120114
|
+
}
|
|
120115
|
+
/** Closes `reader` (by default the open one) and releases its cached reads. */
|
|
120116
|
+
endPartReads(reader2 = this.loadPartReader) {
|
|
120117
|
+
reader2?.close();
|
|
120118
|
+
if (reader2 && this.loadPartReader === reader2) {
|
|
120119
|
+
this.loadPartReader = void 0;
|
|
120120
|
+
}
|
|
120121
|
+
}
|
|
120122
|
+
/** The text of a package part, shared within a load. */
|
|
120123
|
+
readPartText(path4) {
|
|
120124
|
+
return readPartText(this.zip, path4);
|
|
120125
|
+
}
|
|
120126
|
+
/** A parsed package part; relationship parts are parsed once per load. */
|
|
120127
|
+
readPartXml(path4) {
|
|
120128
|
+
return readPartXml(this.zip, this.parser, path4);
|
|
120129
|
+
}
|
|
119631
120130
|
/** fast-xml-parser instance used to parse XML strings into JS objects. */
|
|
119632
120131
|
parser;
|
|
119633
120132
|
/** fast-xml-parser builder used to serialize JS objects back to XML strings. */
|
|
@@ -119891,6 +120390,8 @@ var init_PptxHandlerRuntimeState = __esm({
|
|
|
119891
120390
|
alternateContentBlockByRawXml = /* @__PURE__ */ new WeakMap();
|
|
119892
120391
|
/** Embedded fonts extracted during load, preserved for automatic re-embedding on save. */
|
|
119893
120392
|
loadedEmbeddedFonts = [];
|
|
120393
|
+
/** Decode every embedded font variant during load (see `PptxHandlerLoadOptions`). */
|
|
120394
|
+
eagerDecodeEmbeddedFonts = false;
|
|
119894
120395
|
/** Typed source metadata for lossless embedded-font list round trips. */
|
|
119895
120396
|
loadedEmbeddedFontList;
|
|
119896
120397
|
/**
|
|
@@ -120046,11 +120547,11 @@ var init_PptxHandlerRuntimeState = __esm({
|
|
|
120046
120547
|
* @param relsPath - Path of the `.rels` part; derived from `partPath` when omitted.
|
|
120047
120548
|
*/
|
|
120048
120549
|
async loadPartRelationships(partPath, relsPath2) {
|
|
120049
|
-
const
|
|
120050
|
-
|
|
120550
|
+
const path4 = relsPath2 ?? partRelsPath(partPath);
|
|
120551
|
+
const relsData = await this.readPartXml(path4);
|
|
120552
|
+
if (!relsData) {
|
|
120051
120553
|
return;
|
|
120052
120554
|
}
|
|
120053
|
-
const relsData = this.parser.parse(relsXml);
|
|
120054
120555
|
const relationships3 = relsData?.["Relationships"];
|
|
120055
120556
|
const raw2 = relationships3?.["Relationship"];
|
|
120056
120557
|
const entries = Array.isArray(raw2) ? raw2 : raw2 ? [raw2] : [];
|
|
@@ -121579,10 +122080,6 @@ var init_PptxHandlerRuntimeDocProperties = __esm({
|
|
|
121579
122080
|
this.zip.file(relsPath2, this.builder.build(relsData));
|
|
121580
122081
|
return true;
|
|
121581
122082
|
}
|
|
121582
|
-
/** The text of a package part, or `undefined` when the package has no such part. */
|
|
121583
|
-
async readPartText(path4) {
|
|
121584
|
-
return this.zip.file(path4)?.async("string");
|
|
121585
|
-
}
|
|
121586
122083
|
/**
|
|
121587
122084
|
* Parse extended (application) properties from `docProps/app.xml`.
|
|
121588
122085
|
*/
|
|
@@ -121643,8 +122140,10 @@ var init_PptxHandlerRuntimeDocProperties = __esm({
|
|
|
121643
122140
|
if (!relsFile) {
|
|
121644
122141
|
return [];
|
|
121645
122142
|
}
|
|
121646
|
-
const
|
|
121647
|
-
|
|
122143
|
+
const relsData = await this.readPartXml(relsPath2);
|
|
122144
|
+
if (!relsData) {
|
|
122145
|
+
return [];
|
|
122146
|
+
}
|
|
121648
122147
|
const relRoot = relsData["Relationships"] || {};
|
|
121649
122148
|
const relationships3 = this.ensureArray(relRoot["Relationship"]);
|
|
121650
122149
|
const relMap = /* @__PURE__ */ new Map();
|
|
@@ -121675,7 +122174,7 @@ var init_PptxHandlerRuntimeDocProperties = __esm({
|
|
|
121675
122174
|
try {
|
|
121676
122175
|
const file2 = this.zip.file(resolvedPath);
|
|
121677
122176
|
if (file2) {
|
|
121678
|
-
data = await
|
|
122177
|
+
data = await this.readPartText(resolvedPath);
|
|
121679
122178
|
}
|
|
121680
122179
|
} catch {
|
|
121681
122180
|
}
|
|
@@ -121755,9 +122254,7 @@ var init_PptxHandlerRuntimeDocProperties = __esm({
|
|
|
121755
122254
|
*/
|
|
121756
122255
|
async parseTags() {
|
|
121757
122256
|
try {
|
|
121758
|
-
return await discoverTagCollections(this.zip,
|
|
121759
|
-
parse: (xml) => this.parser.parse(xml)
|
|
121760
|
-
});
|
|
122257
|
+
return await discoverTagCollections(this.zip, this.parser);
|
|
121761
122258
|
} catch (e) {
|
|
121762
122259
|
console.warn("Failed to parse tags:", e);
|
|
121763
122260
|
return [];
|
|
@@ -121897,7 +122394,7 @@ var init_PptxHandlerRuntimeSlideMasters = __esm({
|
|
|
121897
122394
|
}
|
|
121898
122395
|
for (const file2 of masterFiles) {
|
|
121899
122396
|
const path4 = file2.name;
|
|
121900
|
-
const xml = await
|
|
122397
|
+
const xml = await this.readPartText(path4) ?? "";
|
|
121901
122398
|
const data = this.parser.parse(xml);
|
|
121902
122399
|
const sldMaster = data?.["p:sldMaster"];
|
|
121903
122400
|
if (!sldMaster) {
|
|
@@ -121922,8 +122419,7 @@ var init_PptxHandlerRuntimeSlideMasters = __esm({
|
|
|
121922
122419
|
);
|
|
121923
122420
|
const relsFile = this.zip.file(relsPath2);
|
|
121924
122421
|
if (relsFile) {
|
|
121925
|
-
const
|
|
121926
|
-
const relsData = this.parser.parse(relsXml);
|
|
122422
|
+
const relsData = await this.readPartXml(relsPath2);
|
|
121927
122423
|
const rels = this.ensureArray(
|
|
121928
122424
|
xmlChild(relsData, "Relationships")?.["Relationship"]
|
|
121929
122425
|
);
|
|
@@ -121937,8 +122433,7 @@ var init_PptxHandlerRuntimeSlideMasters = __esm({
|
|
|
121937
122433
|
}
|
|
121938
122434
|
const layoutPaths = [];
|
|
121939
122435
|
if (relsFile) {
|
|
121940
|
-
const
|
|
121941
|
-
const relsData = this.parser.parse(relsXml);
|
|
122436
|
+
const relsData = await this.readPartXml(relsPath2);
|
|
121942
122437
|
const rels = this.ensureArray(
|
|
121943
122438
|
xmlChild(relsData, "Relationships")?.["Relationship"]
|
|
121944
122439
|
);
|
|
@@ -121982,7 +122477,7 @@ var init_PptxHandlerRuntimeSlideMasters = __esm({
|
|
|
121982
122477
|
return void 0;
|
|
121983
122478
|
}
|
|
121984
122479
|
const path4 = files[0].name;
|
|
121985
|
-
const xml = await
|
|
122480
|
+
const xml = await this.readPartText(path4) ?? "";
|
|
121986
122481
|
const data = this.parser.parse(xml);
|
|
121987
122482
|
const master = data?.["p:handoutMaster"];
|
|
121988
122483
|
if (!master) {
|
|
@@ -122014,7 +122509,7 @@ var init_PptxHandlerRuntimeSlideMasters = __esm({
|
|
|
122014
122509
|
return void 0;
|
|
122015
122510
|
}
|
|
122016
122511
|
const path4 = files[0].name;
|
|
122017
|
-
const xml = await
|
|
122512
|
+
const xml = await this.readPartText(path4) ?? "";
|
|
122018
122513
|
const data = this.parser.parse(xml);
|
|
122019
122514
|
const master = data?.["p:notesMaster"];
|
|
122020
122515
|
if (!master) {
|
|
@@ -122045,7 +122540,7 @@ var init_PptxHandlerRuntimeSlideMasters = __esm({
|
|
|
122045
122540
|
if (!layoutFile) {
|
|
122046
122541
|
return void 0;
|
|
122047
122542
|
}
|
|
122048
|
-
const xml = await
|
|
122543
|
+
const xml = await this.readPartText(layoutPath) ?? "";
|
|
122049
122544
|
const data = this.parser.parse(xml);
|
|
122050
122545
|
const sldLayout = data?.["p:sldLayout"];
|
|
122051
122546
|
if (!sldLayout) {
|
|
@@ -122153,18 +122648,19 @@ var init_PptxHandlerRuntimePresentationProps = __esm({
|
|
|
122153
122648
|
*/
|
|
122154
122649
|
async parsePresentationProperties() {
|
|
122155
122650
|
try {
|
|
122156
|
-
const
|
|
122157
|
-
if (!
|
|
122651
|
+
const relsData = await this.readPartXml("ppt/_rels/presentation.xml.rels");
|
|
122652
|
+
if (!relsData) {
|
|
122158
122653
|
return void 0;
|
|
122159
122654
|
}
|
|
122160
|
-
const
|
|
122161
|
-
|
|
122655
|
+
const rels = this.ensureArray(
|
|
122656
|
+
relsData.Relationships?.Relationship
|
|
122657
|
+
);
|
|
122162
122658
|
const prRel = rels.find(
|
|
122163
122659
|
(r) => String(r?.["@_Type"] || "").includes("presProps") || String(r?.["@_Target"] || "").includes("presProps")
|
|
122164
122660
|
);
|
|
122165
122661
|
const prTarget = prRel ? String(prRel["@_Target"] || "") : "presProps.xml";
|
|
122166
122662
|
const prPath = prTarget.startsWith("/") ? prTarget.substring(1) : `ppt/${prTarget}`;
|
|
122167
|
-
const prXmlStr = await this.
|
|
122663
|
+
const prXmlStr = await this.readPartText(prPath);
|
|
122168
122664
|
if (!prXmlStr) {
|
|
122169
122665
|
return void 0;
|
|
122170
122666
|
}
|
|
@@ -122210,7 +122706,7 @@ var init_PptxHandlerRuntimePresentationProps = __esm({
|
|
|
122210
122706
|
*/
|
|
122211
122707
|
async parseViewProperties() {
|
|
122212
122708
|
try {
|
|
122213
|
-
const viewPropsXml2 = await this.
|
|
122709
|
+
const viewPropsXml2 = await this.readPartText("ppt/viewProps.xml");
|
|
122214
122710
|
if (!viewPropsXml2) {
|
|
122215
122711
|
return void 0;
|
|
122216
122712
|
}
|
|
@@ -124715,10 +125211,10 @@ function detectDominantScript(text2) {
|
|
|
124715
125211
|
}
|
|
124716
125212
|
let best;
|
|
124717
125213
|
let bestCount = 0;
|
|
124718
|
-
for (const [cat,
|
|
124719
|
-
if (
|
|
125214
|
+
for (const [cat, count2] of Object.entries(counts)) {
|
|
125215
|
+
if (count2 > bestCount) {
|
|
124720
125216
|
best = cat;
|
|
124721
|
-
bestCount =
|
|
125217
|
+
bestCount = count2;
|
|
124722
125218
|
}
|
|
124723
125219
|
}
|
|
124724
125220
|
return best;
|
|
@@ -126685,7 +127181,7 @@ var init_PptxHandlerRuntimeChartUserShapes = __esm({
|
|
|
126685
127181
|
if (existingRel?.target) {
|
|
126686
127182
|
drawingPath = this.resolveImagePath(chartPartPath, existingRel.target);
|
|
126687
127183
|
try {
|
|
126688
|
-
const xml = await this.
|
|
127184
|
+
const xml = await this.readPartText(drawingPath);
|
|
126689
127185
|
if (xml) {
|
|
126690
127186
|
const root = this.parser.parse(xml);
|
|
126691
127187
|
onDisk = parseChartUserShapesDrawing(root, this.xmlLookupService, {
|
|
@@ -126736,11 +127232,10 @@ var init_PptxHandlerRuntimeChartUserShapes = __esm({
|
|
|
126736
127232
|
const slash = chartPartPath.lastIndexOf("/");
|
|
126737
127233
|
const relsPath2 = `${chartPartPath.slice(0, slash + 1)}_rels/${chartPartPath.slice(slash + 1)}.rels`;
|
|
126738
127234
|
try {
|
|
126739
|
-
const
|
|
126740
|
-
if (!
|
|
127235
|
+
const tree = await this.readPartXml(relsPath2);
|
|
127236
|
+
if (!tree) {
|
|
126741
127237
|
return void 0;
|
|
126742
127238
|
}
|
|
126743
|
-
const tree = this.parser.parse(xml);
|
|
126744
127239
|
const root = tree["Relationships"];
|
|
126745
127240
|
const rels = root?.["Relationship"];
|
|
126746
127241
|
const list3 = rels === void 0 ? [] : Array.isArray(rels) ? rels : [rels];
|
|
@@ -127419,9 +127914,9 @@ function applyTableStructureEditXml(table, source, next, edit) {
|
|
|
127419
127914
|
if (axis !== "row" && axis !== "column" || action !== "insert" && action !== "delete") {
|
|
127420
127915
|
return false;
|
|
127421
127916
|
}
|
|
127422
|
-
const
|
|
127917
|
+
const count2 = axis === "row" ? rows.length : columns.length;
|
|
127423
127918
|
const delta2 = action === "insert" ? 1 : -1;
|
|
127424
|
-
if (!grid || !Number.isInteger(index2) || index2 < 0 || index2 >
|
|
127919
|
+
if (!grid || !Number.isInteger(index2) || index2 < 0 || index2 > count2 - (action === "delete" ? 1 : 0) || action === "delete" && count2 <= 1 || next.rows.length !== rows.length + (axis === "row" ? delta2 : 0) || next.columnWidths.length !== columns.length + (axis === "column" ? delta2 : 0)) {
|
|
127425
127920
|
return false;
|
|
127426
127921
|
}
|
|
127427
127922
|
if (axis === "row") {
|
|
@@ -129895,6 +130390,7 @@ var init_PptxHandlerRuntimeSaveDocumentParts = __esm({
|
|
|
129895
130390
|
"pptx/core/core/runtime/PptxHandlerRuntimeSaveDocumentParts.ts"() {
|
|
129896
130391
|
init_utils();
|
|
129897
130392
|
init_customer_data_package();
|
|
130393
|
+
init_deferred_embedded_font();
|
|
129898
130394
|
init_embedded_font_list();
|
|
129899
130395
|
init_font_deobfuscation();
|
|
129900
130396
|
init_safe_path();
|
|
@@ -130356,7 +130852,9 @@ var init_PptxHandlerRuntimeSaveDocumentParts = __esm({
|
|
|
130356
130852
|
return;
|
|
130357
130853
|
}
|
|
130358
130854
|
const fonts = explicitFonts ?? this.loadedEmbeddedFonts;
|
|
130359
|
-
const fontsWithData = fonts.filter(
|
|
130855
|
+
const fontsWithData = fonts.filter(
|
|
130856
|
+
(f6) => shouldSaveEmbeddedFontVerbatim(f6) || f6.rawFontData && f6.rawFontData.length > 0
|
|
130857
|
+
);
|
|
130360
130858
|
if (fontsWithData.length === 0) {
|
|
130361
130859
|
const metadata = explicitFontList ?? this.loadedEmbeddedFontList;
|
|
130362
130860
|
if (metadata && this.presentationData) {
|
|
@@ -130399,10 +130897,11 @@ var init_PptxHandlerRuntimeSaveDocumentParts = __esm({
|
|
|
130399
130897
|
"p:font": { "@_typeface": typeface }
|
|
130400
130898
|
};
|
|
130401
130899
|
for (const variant of variants) {
|
|
130402
|
-
const
|
|
130900
|
+
const verbatim = shouldSaveEmbeddedFontVerbatim(variant);
|
|
130901
|
+
const fontData = verbatim ? void 0 : variant.rawFontData;
|
|
130403
130902
|
const hasOriginal = Boolean(variant.originalRId && variant.partPath);
|
|
130404
|
-
const reuseObfuscation = hasOriginal && Boolean(variant.fontGuid);
|
|
130405
|
-
const reuseVerbatim = hasOriginal && !variant.fontGuid && Boolean(variant.originalPartBytes);
|
|
130903
|
+
const reuseObfuscation = hasOriginal && !verbatim && Boolean(variant.fontGuid);
|
|
130904
|
+
const reuseVerbatim = hasOriginal && (verbatim || !variant.fontGuid) && Boolean(variant.originalPartBytes);
|
|
130406
130905
|
let guid3;
|
|
130407
130906
|
let fontPartPath;
|
|
130408
130907
|
let relativeTarget4;
|
|
@@ -134018,13 +134517,13 @@ function countDeclaredIds(node2, counts, ensureArray20) {
|
|
|
134018
134517
|
if (!countDeclaredIds(branch, branchCounts, ensureArray20)) {
|
|
134019
134518
|
return false;
|
|
134020
134519
|
}
|
|
134021
|
-
for (const [id,
|
|
134022
|
-
merged.set(id, Math.max(merged.get(id) ?? 0,
|
|
134520
|
+
for (const [id, count2] of branchCounts) {
|
|
134521
|
+
merged.set(id, Math.max(merged.get(id) ?? 0, count2));
|
|
134023
134522
|
}
|
|
134024
134523
|
}
|
|
134025
134524
|
}
|
|
134026
|
-
for (const [id,
|
|
134027
|
-
counts.set(id, (counts.get(id) ?? 0) +
|
|
134525
|
+
for (const [id, count2] of merged) {
|
|
134526
|
+
counts.set(id, (counts.get(id) ?? 0) + count2);
|
|
134028
134527
|
}
|
|
134029
134528
|
}
|
|
134030
134529
|
return true;
|
|
@@ -134034,8 +134533,8 @@ function hasStructuralIdDefects(spTree, ensureArray20) {
|
|
|
134034
134533
|
if (!countDeclaredIds(spTree, counts, ensureArray20)) {
|
|
134035
134534
|
return true;
|
|
134036
134535
|
}
|
|
134037
|
-
for (const
|
|
134038
|
-
if (
|
|
134536
|
+
for (const count2 of counts.values()) {
|
|
134537
|
+
if (count2 > 1) {
|
|
134039
134538
|
return true;
|
|
134040
134539
|
}
|
|
134041
134540
|
}
|
|
@@ -142279,7 +142778,7 @@ var init_PptxHandlerRuntimeSlideParsing = __esm({
|
|
|
142279
142778
|
this.unwrapAlternateContent(spTree);
|
|
142280
142779
|
let rawXmlStr;
|
|
142281
142780
|
try {
|
|
142282
|
-
rawXmlStr = await this.
|
|
142781
|
+
rawXmlStr = await this.readPartText(slidePath);
|
|
142283
142782
|
} catch {
|
|
142284
142783
|
}
|
|
142285
142784
|
const slidePrefix = slidePath ? `${slidePath}-` : "";
|
|
@@ -142848,7 +143347,7 @@ var init_PptxHandlerRuntimeBackgroundParsing = __esm({
|
|
|
142848
143347
|
if (cached2) {
|
|
142849
143348
|
return cached2;
|
|
142850
143349
|
}
|
|
142851
|
-
const xml = await this.
|
|
143350
|
+
const xml = await this.readPartText(layoutPath);
|
|
142852
143351
|
if (!xml) {
|
|
142853
143352
|
return void 0;
|
|
142854
143353
|
}
|
|
@@ -142862,7 +143361,7 @@ var init_PptxHandlerRuntimeBackgroundParsing = __esm({
|
|
|
142862
143361
|
if (cached2) {
|
|
142863
143362
|
return cached2;
|
|
142864
143363
|
}
|
|
142865
|
-
const xml = await this.
|
|
143364
|
+
const xml = await this.readPartText(masterPath);
|
|
142866
143365
|
if (!xml) {
|
|
142867
143366
|
return void 0;
|
|
142868
143367
|
}
|
|
@@ -143322,7 +143821,7 @@ var init_PptxHandlerRuntimeSlideUtils = __esm({
|
|
|
143322
143821
|
if (!notesPath) {
|
|
143323
143822
|
return {};
|
|
143324
143823
|
}
|
|
143325
|
-
const notesXml = await this.
|
|
143824
|
+
const notesXml = await this.readPartText(notesPath);
|
|
143326
143825
|
if (!notesXml) {
|
|
143327
143826
|
return {};
|
|
143328
143827
|
}
|
|
@@ -143821,7 +144320,7 @@ var init_PptxHandlerRuntimeMasterElements = __esm({
|
|
|
143821
144320
|
try {
|
|
143822
144321
|
let masterXmlObj = this.masterXmlMap.get(master.path);
|
|
143823
144322
|
if (!masterXmlObj) {
|
|
143824
|
-
const xmlStr = await this.
|
|
144323
|
+
const xmlStr = await this.readPartText(master.path);
|
|
143825
144324
|
if (!xmlStr) {
|
|
143826
144325
|
continue;
|
|
143827
144326
|
}
|
|
@@ -143894,7 +144393,7 @@ var init_PptxHandlerRuntimeMasterElements = __esm({
|
|
|
143894
144393
|
}
|
|
143895
144394
|
const masterToken = masterPath.split("/").pop()?.replace(/\.xml$/u, "") ?? masterPath;
|
|
143896
144395
|
try {
|
|
143897
|
-
const masterXmlStr = await this.
|
|
144396
|
+
const masterXmlStr = await this.readPartText(masterPath);
|
|
143898
144397
|
if (!masterXmlStr) {
|
|
143899
144398
|
return [];
|
|
143900
144399
|
}
|
|
@@ -144056,7 +144555,7 @@ var init_PptxHandlerRuntimeAuxiliaryMasterElements = __esm({
|
|
|
144056
144555
|
}
|
|
144057
144556
|
const partPath = part.path;
|
|
144058
144557
|
rememberMasterPartBackground(this, partPath, part.backgroundColor);
|
|
144059
|
-
const xml = await this.
|
|
144558
|
+
const xml = await this.readPartText(partPath);
|
|
144060
144559
|
if (!xml) {
|
|
144061
144560
|
return;
|
|
144062
144561
|
}
|
|
@@ -144216,7 +144715,7 @@ var init_PptxHandlerRuntimeLayoutElements = __esm({
|
|
|
144216
144715
|
}
|
|
144217
144716
|
const layoutToken = layoutPath.split("/").pop()?.replace(/\.xml$/u, "") ?? layoutPath;
|
|
144218
144717
|
try {
|
|
144219
|
-
const layoutXmlStr = await this.
|
|
144718
|
+
const layoutXmlStr = await this.readPartText(layoutPath);
|
|
144220
144719
|
if (!layoutXmlStr) {
|
|
144221
144720
|
return [];
|
|
144222
144721
|
}
|
|
@@ -144950,7 +145449,7 @@ var init_PptxHandlerRuntimeThemeOverrides = __esm({
|
|
|
144950
145449
|
return cached2;
|
|
144951
145450
|
}
|
|
144952
145451
|
try {
|
|
144953
|
-
const overrideXml = await this.
|
|
145452
|
+
const overrideXml = await this.readPartText(overridePath);
|
|
144954
145453
|
if (!overrideXml) {
|
|
144955
145454
|
return null;
|
|
144956
145455
|
}
|
|
@@ -145579,10 +146078,7 @@ var init_PptxHandlerRuntimeThemeLoading = __esm({
|
|
|
145579
146078
|
if (!relsXml) {
|
|
145580
146079
|
return void 0;
|
|
145581
146080
|
}
|
|
145582
|
-
const relsData = this.
|
|
145583
|
-
// eslint-disable-next-line no-await-in-loop
|
|
145584
|
-
await relsXml.async("string")
|
|
145585
|
-
);
|
|
146081
|
+
const relsData = await this.readPartXml(relsPath2);
|
|
145586
146082
|
const relNodes = this.ensureArray(
|
|
145587
146083
|
relsData?.Relationships?.Relationship
|
|
145588
146084
|
);
|
|
@@ -145608,7 +146104,7 @@ var init_PptxHandlerRuntimeThemeLoading = __esm({
|
|
|
145608
146104
|
const options = [];
|
|
145609
146105
|
for (const file2 of themeFiles) {
|
|
145610
146106
|
try {
|
|
145611
|
-
const xml = await file2.
|
|
146107
|
+
const xml = await this.readPartText(file2.name) ?? "";
|
|
145612
146108
|
const data = this.parser.parse(xml);
|
|
145613
146109
|
const root = data["a:theme"];
|
|
145614
146110
|
const name = String(root?.["@_name"] || "").trim();
|
|
@@ -145688,7 +146184,7 @@ var init_PptxHandlerRuntimeThemeLoading = __esm({
|
|
|
145688
146184
|
];
|
|
145689
146185
|
for (const file2 of masterFiles) {
|
|
145690
146186
|
try {
|
|
145691
|
-
const masterXml = await file2.
|
|
146187
|
+
const masterXml = await this.readPartText(file2.name) ?? "";
|
|
145692
146188
|
const masterData = this.parser.parse(masterXml);
|
|
145693
146189
|
const clrMap = masterData?.["p:sldMaster"]?.["p:clrMap"];
|
|
145694
146190
|
if (!clrMap) {
|
|
@@ -145721,7 +146217,7 @@ var init_PptxHandlerRuntimeThemeLoading = __esm({
|
|
|
145721
146217
|
if (!themeFile) {
|
|
145722
146218
|
return null;
|
|
145723
146219
|
}
|
|
145724
|
-
const themeXml3 = await
|
|
146220
|
+
const themeXml3 = await this.readPartText(themePath) ?? "";
|
|
145725
146221
|
const model = this.parseThemePartXml(themeXml3);
|
|
145726
146222
|
this.cacheThemePartModel(themePath, themeXml3, model);
|
|
145727
146223
|
return { colorMap: model.colorMap, fontMap: model.fontMap, formatScheme: model.formatScheme };
|
|
@@ -145756,7 +146252,7 @@ var init_PptxHandlerRuntimeThemeLoading = __esm({
|
|
|
145756
146252
|
if (!relsXml) {
|
|
145757
146253
|
return void 0;
|
|
145758
146254
|
}
|
|
145759
|
-
const relsData =
|
|
146255
|
+
const relsData = await this.readPartXml(relsPath2);
|
|
145760
146256
|
const relNodes = this.ensureArray(
|
|
145761
146257
|
relsData?.Relationships?.Relationship
|
|
145762
146258
|
);
|
|
@@ -146085,11 +146581,10 @@ var init_PptxHandlerRuntimeComments = __esm({
|
|
|
146085
146581
|
async extractModernSlideComments(slidePath) {
|
|
146086
146582
|
try {
|
|
146087
146583
|
const relsPath2 = `${slidePath.replace("slides/", "slides/_rels/")}.rels`;
|
|
146088
|
-
const
|
|
146089
|
-
if (!
|
|
146584
|
+
const relsData = await this.readPartXml(relsPath2);
|
|
146585
|
+
if (!relsData) {
|
|
146090
146586
|
return [];
|
|
146091
146587
|
}
|
|
146092
|
-
const relsData = this.parser.parse(relsXml);
|
|
146093
146588
|
const rels = this.ensureArray(
|
|
146094
146589
|
xmlChild(relsData, "Relationships")?.Relationship
|
|
146095
146590
|
);
|
|
@@ -146106,7 +146601,7 @@ var init_PptxHandlerRuntimeComments = __esm({
|
|
|
146106
146601
|
continue;
|
|
146107
146602
|
}
|
|
146108
146603
|
const filePath = this.resolvePath(slidePath, target);
|
|
146109
|
-
const xml = await this.
|
|
146604
|
+
const xml = await this.readPartText(filePath);
|
|
146110
146605
|
if (!xml) {
|
|
146111
146606
|
continue;
|
|
146112
146607
|
}
|
|
@@ -146129,11 +146624,10 @@ var init_PptxHandlerRuntimeComments = __esm({
|
|
|
146129
146624
|
return [];
|
|
146130
146625
|
}
|
|
146131
146626
|
async loadModernCommentAuthors() {
|
|
146132
|
-
const
|
|
146133
|
-
if (!
|
|
146627
|
+
const relsData = await this.readPartXml("ppt/_rels/presentation.xml.rels");
|
|
146628
|
+
if (!relsData) {
|
|
146134
146629
|
return;
|
|
146135
146630
|
}
|
|
146136
|
-
const relsData = this.parser.parse(relsXml);
|
|
146137
146631
|
const relationships3 = this.ensureArray(
|
|
146138
146632
|
xmlChild(relsData, "Relationships")?.Relationship
|
|
146139
146633
|
);
|
|
@@ -146145,7 +146639,7 @@ var init_PptxHandlerRuntimeComments = __esm({
|
|
|
146145
146639
|
return;
|
|
146146
146640
|
}
|
|
146147
146641
|
const partPath = this.resolvePath("ppt/presentation.xml", target);
|
|
146148
|
-
const xml = await this.
|
|
146642
|
+
const xml = await this.readPartText(partPath);
|
|
146149
146643
|
if (!xml) {
|
|
146150
146644
|
return;
|
|
146151
146645
|
}
|
|
@@ -146171,12 +146665,12 @@ var init_PptxHandlerRuntimeComments = __esm({
|
|
|
146171
146665
|
}
|
|
146172
146666
|
}
|
|
146173
146667
|
const relsPath2 = `${slidePath.replace("slides/", "slides/_rels/")}.rels`;
|
|
146174
|
-
const relsXml = await this.
|
|
146668
|
+
const relsXml = await this.readPartText(relsPath2);
|
|
146175
146669
|
if (!relsXml) {
|
|
146176
146670
|
return void 0;
|
|
146177
146671
|
}
|
|
146178
146672
|
try {
|
|
146179
|
-
const relsData = this.
|
|
146673
|
+
const relsData = await this.readPartXml(relsPath2);
|
|
146180
146674
|
const rels = this.ensureArray(
|
|
146181
146675
|
xmlChild(relsData, "Relationships")?.Relationship
|
|
146182
146676
|
);
|
|
@@ -146215,7 +146709,7 @@ var init_PptxHandlerRuntimeComments = __esm({
|
|
|
146215
146709
|
return [];
|
|
146216
146710
|
}
|
|
146217
146711
|
const commentsPath = this.resolveImagePath(slidePath, commentTarget);
|
|
146218
|
-
const commentsXml = await this.
|
|
146712
|
+
const commentsXml = await this.readPartText(commentsPath);
|
|
146219
146713
|
if (!commentsXml) {
|
|
146220
146714
|
return [];
|
|
146221
146715
|
}
|
|
@@ -146250,7 +146744,7 @@ var init_PptxHandlerRuntimeComments = __esm({
|
|
|
146250
146744
|
}
|
|
146251
146745
|
}
|
|
146252
146746
|
async loadCommentAuthors() {
|
|
146253
|
-
const commentAuthorsXml = await this.
|
|
146747
|
+
const commentAuthorsXml = await this.readPartText("ppt/commentAuthors.xml");
|
|
146254
146748
|
if (!commentAuthorsXml) {
|
|
146255
146749
|
return;
|
|
146256
146750
|
}
|
|
@@ -146322,7 +146816,7 @@ var init_PptxHandlerRuntimeSmartArtXmlUtils = __esm({
|
|
|
146322
146816
|
return void 0;
|
|
146323
146817
|
}
|
|
146324
146818
|
const partPath = this.resolveImagePath(slidePath, target);
|
|
146325
|
-
const xmlString = await this.
|
|
146819
|
+
const xmlString = await this.readPartText(partPath);
|
|
146326
146820
|
if (!xmlString) {
|
|
146327
146821
|
return void 0;
|
|
146328
146822
|
}
|
|
@@ -148037,9 +148531,8 @@ var init_PptxHandlerRuntimeChartExternalData = __esm({
|
|
|
148037
148531
|
const chartDir = chartPartPath.substring(0, chartPartPath.lastIndexOf("/") + 1);
|
|
148038
148532
|
const chartFileName = chartPartPath.substring(chartPartPath.lastIndexOf("/") + 1);
|
|
148039
148533
|
const chartRelsPath = `${chartDir}_rels/${chartFileName}.rels`;
|
|
148040
|
-
const
|
|
148041
|
-
if (
|
|
148042
|
-
const chartRelsData = this.parser.parse(chartRelsXml);
|
|
148534
|
+
const chartRelsData = await this.readPartXml(chartRelsPath);
|
|
148535
|
+
if (chartRelsData) {
|
|
148043
148536
|
const relsContainer = chartRelsData?.Relationships;
|
|
148044
148537
|
if (relsContainer?.Relationship) {
|
|
148045
148538
|
const rels = Array.isArray(relsContainer.Relationship) ? relsContainer.Relationship : [relsContainer.Relationship];
|
|
@@ -148121,7 +148614,7 @@ var init_PptxHandlerRuntimeChartExternalData = __esm({
|
|
|
148121
148614
|
if (drawingPath.length === 0) {
|
|
148122
148615
|
return void 0;
|
|
148123
148616
|
}
|
|
148124
|
-
const drawingXml = await this.
|
|
148617
|
+
const drawingXml = await this.readPartText(drawingPath);
|
|
148125
148618
|
if (!drawingXml) {
|
|
148126
148619
|
return void 0;
|
|
148127
148620
|
}
|
|
@@ -148142,11 +148635,10 @@ var init_PptxHandlerRuntimeChartExternalData = __esm({
|
|
|
148142
148635
|
const chartDir = chartPartPath.substring(0, chartPartPath.lastIndexOf("/") + 1);
|
|
148143
148636
|
const chartFileName = chartPartPath.substring(chartPartPath.lastIndexOf("/") + 1);
|
|
148144
148637
|
const chartRelsPath = `${chartDir}_rels/${chartFileName}.rels`;
|
|
148145
|
-
const
|
|
148146
|
-
if (!
|
|
148638
|
+
const chartRelsData = await this.readPartXml(chartRelsPath);
|
|
148639
|
+
if (!chartRelsData) {
|
|
148147
148640
|
return [];
|
|
148148
148641
|
}
|
|
148149
|
-
const chartRelsData = this.parser.parse(chartRelsXml);
|
|
148150
148642
|
const relsContainer = chartRelsData?.Relationships;
|
|
148151
148643
|
if (!relsContainer?.Relationship) {
|
|
148152
148644
|
return [];
|
|
@@ -148983,8 +149475,7 @@ var init_PptxHandlerRuntimePresentationStructure = __esm({
|
|
|
148983
149475
|
var PptxHandlerRuntime99;
|
|
148984
149476
|
var init_PptxHandlerRuntimeEmbeddedFonts = __esm({
|
|
148985
149477
|
"pptx/core/core/runtime/PptxHandlerRuntimeEmbeddedFonts.ts"() {
|
|
148986
|
-
|
|
148987
|
-
init_font_deobfuscation();
|
|
149478
|
+
init_deferred_embedded_font();
|
|
148988
149479
|
init_layout_display_name();
|
|
148989
149480
|
init_strip_parent_dir_segments();
|
|
148990
149481
|
init_xml_access();
|
|
@@ -149038,11 +149529,10 @@ var init_PptxHandlerRuntimeEmbeddedFonts = __esm({
|
|
|
149038
149529
|
async loadPresentationFontRels() {
|
|
149039
149530
|
const map2 = /* @__PURE__ */ new Map();
|
|
149040
149531
|
try {
|
|
149041
|
-
const
|
|
149042
|
-
if (!
|
|
149532
|
+
const relsData = await this.readPartXml("ppt/_rels/presentation.xml.rels");
|
|
149533
|
+
if (!relsData) {
|
|
149043
149534
|
return map2;
|
|
149044
149535
|
}
|
|
149045
|
-
const relsData = this.parser.parse(relsXml);
|
|
149046
149536
|
const rels = this.ensureArray(
|
|
149047
149537
|
xmlChild(relsData, "Relationships")?.Relationship
|
|
149048
149538
|
);
|
|
@@ -149061,7 +149551,13 @@ var init_PptxHandlerRuntimeEmbeddedFonts = __esm({
|
|
|
149061
149551
|
}
|
|
149062
149552
|
return map2;
|
|
149063
149553
|
}
|
|
149064
|
-
/**
|
|
149554
|
+
/**
|
|
149555
|
+
* Read one variant's part. By default the result is a deferred descriptor
|
|
149556
|
+
* that decodes on first use (see `createDeferredEmbeddedFont`); parts that
|
|
149557
|
+
* fail the checks possible without decoding are skipped, as before. With
|
|
149558
|
+
* `eagerDecodeEmbeddedFonts` the variant is decoded now and skipped when
|
|
149559
|
+
* decoding fails.
|
|
149560
|
+
*/
|
|
149065
149561
|
async extractEmbeddedFontVariant(typeface, rId, bold, italic, relsMap, fontKey) {
|
|
149066
149562
|
const fontPath = relsMap.get(rId);
|
|
149067
149563
|
if (!fontPath) {
|
|
@@ -149072,80 +149568,25 @@ var init_PptxHandlerRuntimeEmbeddedFonts = __esm({
|
|
|
149072
149568
|
if (!fontBinary || fontBinary.length === 0) {
|
|
149073
149569
|
return null;
|
|
149074
149570
|
}
|
|
149075
|
-
const
|
|
149076
|
-
let fontData;
|
|
149077
|
-
let resolvedGuid;
|
|
149078
|
-
if (isEotFormat(fontBinary)) {
|
|
149079
|
-
const extracted = extractFontFromEot(fontBinary);
|
|
149080
|
-
if (extracted) {
|
|
149081
|
-
fontData = extracted.fontData;
|
|
149082
|
-
} else {
|
|
149083
|
-
const header = parseEotHeader(fontBinary);
|
|
149084
|
-
console.info(
|
|
149085
|
-
`[pptx-viewer] Embedded font "${typeface}" uses EOT format${header?.isCompressed ? " with MTX compression" : ""} \u2014 extraction failed, will use web font fallback`
|
|
149086
|
-
);
|
|
149087
|
-
return null;
|
|
149088
|
-
}
|
|
149089
|
-
} else {
|
|
149090
|
-
const guidFromKey = fontKey ? extractGuidFromPartName(fontKey) ?? fontKey.replace(/[{}]/g, "").trim() : null;
|
|
149091
|
-
const guidFromPath = extractGuidFromPartName(fontPath);
|
|
149092
|
-
const guid3 = guidFromKey || guidFromPath;
|
|
149093
|
-
if (guid3) {
|
|
149094
|
-
fontData = deobfuscateFont(fontBinary, guid3);
|
|
149095
|
-
resolvedGuid = guid3;
|
|
149096
|
-
} else {
|
|
149097
|
-
console.warn(
|
|
149098
|
-
`[pptx-viewer] Embedded font "${typeface}" at "${fontPath}" has no fontKey attribute and no GUID in filename \u2014 skipping`
|
|
149099
|
-
);
|
|
149100
|
-
return null;
|
|
149101
|
-
}
|
|
149102
|
-
}
|
|
149103
|
-
if (fontData.length < 4) {
|
|
149104
|
-
return null;
|
|
149105
|
-
}
|
|
149106
|
-
const v0 = fontData[0], v1 = fontData[1], v2 = fontData[2], v3 = fontData[3];
|
|
149107
|
-
const isTrueType = v0 === 0 && v1 === 1 && v2 === 0 && v3 === 0;
|
|
149108
|
-
const isOTTO = v0 === 79 && v1 === 84 && v2 === 84 && v3 === 79;
|
|
149109
|
-
const isTTC = v0 === 116 && v1 === 116 && v2 === 99 && v3 === 102;
|
|
149110
|
-
const isWOFF = v0 === 119 && v1 === 79 && v2 === 70 && (v3 === 70 || v3 === 50);
|
|
149111
|
-
if (!(isTrueType || isOTTO || isTTC || isWOFF)) {
|
|
149112
|
-
console.warn(
|
|
149113
|
-
`[pptx-viewer] Embedded font "${typeface}" has invalid sfnt header [${v0.toString(16)},${v1.toString(16)},${v2.toString(16)},${v3.toString(16)}] after processing \u2014 skipping (web font fallback will be used)`
|
|
149114
|
-
);
|
|
149115
|
-
return null;
|
|
149116
|
-
}
|
|
149117
|
-
const format = detectFontFormat(fontData);
|
|
149118
|
-
const mimeType = format === "woff2" ? "font/woff2" : format === "woff" ? "font/woff" : format === "opentype" ? "font/otf" : "font/ttf";
|
|
149119
|
-
const base643 = this.uint8ArrayToBase64(fontData);
|
|
149120
|
-
const dataUrl = `data:${mimeType};base64,${base643}`;
|
|
149121
|
-
return {
|
|
149571
|
+
const source = {
|
|
149122
149572
|
name: typeface,
|
|
149123
|
-
dataUrl,
|
|
149124
149573
|
bold,
|
|
149125
149574
|
italic,
|
|
149126
|
-
format,
|
|
149127
|
-
rawFontData: fontData,
|
|
149128
|
-
partPath: fontPath,
|
|
149129
|
-
fontGuid: resolvedGuid,
|
|
149130
149575
|
originalRId: rId,
|
|
149131
|
-
|
|
149576
|
+
partPath: fontPath,
|
|
149577
|
+
// The descriptor owns a copy, so it outlives this handler's ZIP and
|
|
149578
|
+
// the save pipeline can write it back verbatim.
|
|
149579
|
+
originalPartBytes: new Uint8Array(fontBinary),
|
|
149580
|
+
fontKey
|
|
149132
149581
|
};
|
|
149582
|
+
if (this.eagerDecodeEmbeddedFonts) {
|
|
149583
|
+
return decodeEmbeddedFontPart(source);
|
|
149584
|
+
}
|
|
149585
|
+
return isEmbeddedFontPartPlausible(source) ? createDeferredEmbeddedFont(source) : null;
|
|
149133
149586
|
} catch {
|
|
149134
149587
|
return null;
|
|
149135
149588
|
}
|
|
149136
149589
|
}
|
|
149137
|
-
/** Convert Uint8Array to base64 string. */
|
|
149138
|
-
uint8ArrayToBase64(bytes) {
|
|
149139
|
-
let binary = "";
|
|
149140
|
-
const chunkSize = 8192;
|
|
149141
|
-
for (let i2 = 0; i2 < bytes.length; i2 += chunkSize) {
|
|
149142
|
-
const chunk2 = bytes.subarray(i2, Math.min(i2 + chunkSize, bytes.length));
|
|
149143
|
-
for (let j = 0; j < chunk2.length; j++) {
|
|
149144
|
-
binary += String.fromCharCode(chunk2[j]);
|
|
149145
|
-
}
|
|
149146
|
-
}
|
|
149147
|
-
return btoa(binary);
|
|
149148
|
-
}
|
|
149149
149590
|
getLayoutOptions() {
|
|
149150
149591
|
const options = [];
|
|
149151
149592
|
for (const [path4, xmlObj] of this.layoutXmlMap.entries()) {
|
|
@@ -149198,12 +149639,16 @@ var init_PptxHandlerRuntimeLoadSession = __esm({
|
|
|
149198
149639
|
init_ole_embedded_extract();
|
|
149199
149640
|
init_ole_utils();
|
|
149200
149641
|
init_signature_detection();
|
|
149201
|
-
|
|
149642
|
+
init_load_limits();
|
|
149202
149643
|
init_authored_slide_background();
|
|
149203
149644
|
init_bullet_picture_image_enrichment();
|
|
149204
149645
|
init_PptxHandlerRuntimeEmbeddedFonts();
|
|
149205
149646
|
MAX_OLE_EMBEDDING_BYTES = 25 * 1024 * 1024;
|
|
149206
149647
|
PptxHandlerRuntime100 = class _PptxHandlerRuntime extends PptxHandlerRuntime99 {
|
|
149648
|
+
/** The limits of the load in progress (see `PptxHandlerLoadOptions.limits`). */
|
|
149649
|
+
loadLimits = { ...DEFAULT_PPTX_LOAD_LIMITS };
|
|
149650
|
+
/** Slide elements parsed so far by the load in progress, for `maxShapes`. */
|
|
149651
|
+
loadedShapeCount = 0;
|
|
149207
149652
|
isZipContainer(data) {
|
|
149208
149653
|
const bytes = new Uint8Array(data);
|
|
149209
149654
|
if (bytes.byteLength < 4) {
|
|
@@ -149212,7 +149657,9 @@ var init_PptxHandlerRuntimeLoadSession = __esm({
|
|
|
149212
149657
|
return bytes[0] === 80 && bytes[1] === 75 && (bytes[2] === 3 && bytes[3] === 4 || bytes[2] === 5 && bytes[3] === 6 || bytes[2] === 7 && bytes[3] === 8);
|
|
149213
149658
|
}
|
|
149214
149659
|
async initializeLoadSession(data, options) {
|
|
149660
|
+
const limits = resolvePptxLoadLimits(options);
|
|
149215
149661
|
this.eagerDecodeImages = options.eagerDecodeImages ?? false;
|
|
149662
|
+
this.eagerDecodeEmbeddedFonts = options.eagerDecodeEmbeddedFonts === true;
|
|
149216
149663
|
this.allowExternalImages = options.allowExternalImages === true;
|
|
149217
149664
|
if (data.byteLength < 4) {
|
|
149218
149665
|
throw new Error("Invalid PPTX binary: file is empty or truncated.");
|
|
@@ -149222,7 +149669,7 @@ var init_PptxHandlerRuntimeLoadSession = __esm({
|
|
|
149222
149669
|
"Invalid PPTX binary: not a ZIP/OpenXML package. The file is neither an OpenXML archive nor an OLE compound file (which is how legacy .ppt and encrypted presentations arrive), so it is most likely corrupt, truncated, or not a presentation at all."
|
|
149223
149670
|
);
|
|
149224
149671
|
}
|
|
149225
|
-
const maxBytes =
|
|
149672
|
+
const maxBytes = limits.maxUncompressedBytes;
|
|
149226
149673
|
let loaded;
|
|
149227
149674
|
try {
|
|
149228
149675
|
loaded = await JSZip__default.default.loadAsync(data);
|
|
@@ -149232,11 +149679,13 @@ var init_PptxHandlerRuntimeLoadSession = __esm({
|
|
|
149232
149679
|
}
|
|
149233
149680
|
this.zip = guardZip(loaded, {
|
|
149234
149681
|
label: "PPTX",
|
|
149235
|
-
maxEntries:
|
|
149682
|
+
maxEntries: limits.maxEntries,
|
|
149236
149683
|
maxEntryBytes: maxBytes,
|
|
149237
149684
|
maxTotalBytes: maxBytes,
|
|
149238
|
-
createError:
|
|
149685
|
+
createError: createPptxZipBombError
|
|
149239
149686
|
});
|
|
149687
|
+
this.loadLimits = limits;
|
|
149688
|
+
this.loadedShapeCount = 0;
|
|
149240
149689
|
try {
|
|
149241
149690
|
this.documentPropertiesUpdater = this.dependencyFactory.createDocumentPropertiesUpdater(
|
|
149242
149691
|
this.zip,
|
|
@@ -149363,13 +149812,13 @@ var init_PptxHandlerRuntimeLoadSession = __esm({
|
|
|
149363
149812
|
if (!file2) {
|
|
149364
149813
|
continue;
|
|
149365
149814
|
}
|
|
149366
|
-
const data = await
|
|
149815
|
+
const data = await this.readPartText(entry2) ?? "";
|
|
149367
149816
|
const propsPath = `customXml/itemProps${itemId}.xml`;
|
|
149368
149817
|
const propsFile = this.zip.file(propsPath);
|
|
149369
149818
|
let properties;
|
|
149370
149819
|
let schemaUri;
|
|
149371
149820
|
if (propsFile) {
|
|
149372
|
-
properties = await
|
|
149821
|
+
properties = await this.readPartText(propsPath) ?? "";
|
|
149373
149822
|
try {
|
|
149374
149823
|
const propsData = this.parser.parse(properties);
|
|
149375
149824
|
const schemaRefs = propsData?.["ds:datastoreItem"]?.["ds:schemaRefs"]?.["ds:schemaRef"];
|
|
@@ -149389,19 +149838,24 @@ var init_PptxHandlerRuntimeLoadSession = __esm({
|
|
|
149389
149838
|
const relsFile = this.zip.file(relsPath2);
|
|
149390
149839
|
let rels;
|
|
149391
149840
|
if (relsFile) {
|
|
149392
|
-
rels = await
|
|
149841
|
+
rels = await this.readPartText(relsPath2);
|
|
149393
149842
|
}
|
|
149394
149843
|
parts.push({ id: itemId, data, schemaUri, properties, rels });
|
|
149395
149844
|
}
|
|
149396
149845
|
this.customXmlParts = parts;
|
|
149397
149846
|
}
|
|
149398
149847
|
async loadPresentationState() {
|
|
149399
|
-
const presentationXml3 = await this.
|
|
149848
|
+
const presentationXml3 = await this.readPartText("ppt/presentation.xml");
|
|
149400
149849
|
if (!presentationXml3) {
|
|
149401
149850
|
throw new Error("Invalid PPTX: presentation.xml not found");
|
|
149402
149851
|
}
|
|
149403
149852
|
this.presentationData = this.parser.parse(presentationXml3);
|
|
149404
149853
|
this.detectAndSetStrictConformance(this.presentationData);
|
|
149854
|
+
const slideIds = this.presentationData?.["p:presentation"]?.["p:sldIdLst"]?.["p:sldId"];
|
|
149855
|
+
assertPptxSlideCountWithinLimits(
|
|
149856
|
+
Array.isArray(slideIds) ? slideIds.length : slideIds ? 1 : 0,
|
|
149857
|
+
this.loadLimits
|
|
149858
|
+
);
|
|
149405
149859
|
await this.loadThemeData();
|
|
149406
149860
|
this.parsePresentationDefaultTextStyle();
|
|
149407
149861
|
await this.loadCommentAuthors();
|
|
@@ -149531,7 +149985,17 @@ var init_PptxHandlerRuntimeLoadSession = __esm({
|
|
|
149531
149985
|
loadThemeOverride: (partBasePath) => this.loadThemeOverride(partBasePath),
|
|
149532
149986
|
applyThemeOverrideState: (override) => this.applyThemeOverrideState(override),
|
|
149533
149987
|
getLayoutElements: (slidePath) => this.getLayoutElements(slidePath),
|
|
149534
|
-
|
|
149988
|
+
// `maxShapes`: each slide's own elements are counted as soon as they are
|
|
149989
|
+
// parsed, before that slide's media is resolved and before the next slide.
|
|
149990
|
+
parseSlide: async (slideXml3, slidePath) => {
|
|
149991
|
+
const elements3 = await this.parseSlide(slideXml3, slidePath);
|
|
149992
|
+
this.loadedShapeCount = countPptxShapesWithinLimits(
|
|
149993
|
+
this.loadedShapeCount,
|
|
149994
|
+
elements3,
|
|
149995
|
+
this.loadLimits
|
|
149996
|
+
);
|
|
149997
|
+
return elements3;
|
|
149998
|
+
},
|
|
149535
149999
|
extractMediaTimingMap: (slideXml3, slidePath) => this.extractMediaTimingMap(slideXml3, slidePath),
|
|
149536
150000
|
enrichMediaElementsWithTiming: (elements3, timingMap) => this.enrichMediaElementsWithTiming(elements3, timingMap),
|
|
149537
150001
|
enrichOleElementsWithEmbeddedData: (elements3, slidePath) => this.enrichOleElementsWithEmbeddedData(elements3, slidePath),
|
|
@@ -149584,6 +150048,7 @@ var init_PptxHandlerRuntimeLoadPipeline = __esm({
|
|
|
149584
150048
|
init_smart_tags_parser();
|
|
149585
150049
|
init_strip_parent_dir_segments();
|
|
149586
150050
|
init_builders();
|
|
150051
|
+
init_load_limits();
|
|
149587
150052
|
init_authored_slide_background();
|
|
149588
150053
|
init_layout_switch_placeholder_prompts();
|
|
149589
150054
|
init_PptxHandlerRuntimeLoadSession();
|
|
@@ -149748,6 +150213,7 @@ var init_PptxHandlerRuntimeLoadPipeline = __esm({
|
|
|
149748
150213
|
* or resolve images. Create a new `PptxHandler` instance instead.
|
|
149749
150214
|
*/
|
|
149750
150215
|
dispose() {
|
|
150216
|
+
this.endPartReads();
|
|
149751
150217
|
this.revokeBlobUrls();
|
|
149752
150218
|
this.imageDataCache.clear();
|
|
149753
150219
|
this.slideMap.clear();
|
|
@@ -149781,7 +150247,23 @@ var init_PptxHandlerRuntimeLoadPipeline = __esm({
|
|
|
149781
150247
|
this.zip = null;
|
|
149782
150248
|
}
|
|
149783
150249
|
async load(data, options = {}) {
|
|
149784
|
-
|
|
150250
|
+
let reader2;
|
|
150251
|
+
try {
|
|
150252
|
+
await this.initializeLoadSession(data, options);
|
|
150253
|
+
reader2 = this.beginPartReads();
|
|
150254
|
+
try {
|
|
150255
|
+
return await this.loadInitializedSession();
|
|
150256
|
+
} catch (error62) {
|
|
150257
|
+
if (error62 instanceof PptxLoadLimitError) {
|
|
150258
|
+
this.dispose();
|
|
150259
|
+
}
|
|
150260
|
+
throw error62;
|
|
150261
|
+
}
|
|
150262
|
+
} finally {
|
|
150263
|
+
this.endPartReads(reader2);
|
|
150264
|
+
}
|
|
150265
|
+
}
|
|
150266
|
+
async loadInitializedSession() {
|
|
149785
150267
|
await this.detectAndPreserveVbaProject();
|
|
149786
150268
|
this.detectDigitalSignatureParts();
|
|
149787
150269
|
await this.parseCustomXmlParts();
|
|
@@ -149931,7 +150413,7 @@ var init_PptxHandlerRuntimeLoadPipeline = __esm({
|
|
|
149931
150413
|
options.push(this.buildLayoutOption(lp, xmlObj));
|
|
149932
150414
|
} else {
|
|
149933
150415
|
try {
|
|
149934
|
-
const layoutXmlStr = await this.
|
|
150416
|
+
const layoutXmlStr = await this.readPartText(lp);
|
|
149935
150417
|
if (layoutXmlStr) {
|
|
149936
150418
|
const layoutXmlObj = this.parser.parse(layoutXmlStr);
|
|
149937
150419
|
this.layoutXmlMap.set(lp, layoutXmlObj);
|
|
@@ -149974,7 +150456,7 @@ var init_PptxHandlerRuntimeLoadPipeline = __esm({
|
|
|
149974
150456
|
}
|
|
149975
150457
|
let layoutXml3 = this.layoutXmlMap.get(layoutPath);
|
|
149976
150458
|
if (!layoutXml3) {
|
|
149977
|
-
const layoutXmlStr = await this.
|
|
150459
|
+
const layoutXmlStr = await this.readPartText(layoutPath);
|
|
149978
150460
|
if (!layoutXmlStr) {
|
|
149979
150461
|
throw new Error(`Layout not found: ${layoutPath}`);
|
|
149980
150462
|
}
|
|
@@ -151230,24 +151712,24 @@ function parseStyleTextPropAtom(view, dataOffset, dataLen, textLength, scheme) {
|
|
|
151230
151712
|
const charRuns = [];
|
|
151231
151713
|
let covered = 0;
|
|
151232
151714
|
while (covered < total && c.canRead(6)) {
|
|
151233
|
-
const
|
|
151715
|
+
const count2 = c.u32();
|
|
151234
151716
|
const indentLevel = c.u16();
|
|
151235
|
-
const props = { count, indentLevel };
|
|
151717
|
+
const props = { count: count2, indentLevel };
|
|
151236
151718
|
if (!parsePfException(c, scheme, props)) {
|
|
151237
151719
|
break;
|
|
151238
151720
|
}
|
|
151239
151721
|
paragraphRuns.push(props);
|
|
151240
|
-
covered +=
|
|
151722
|
+
covered += count2;
|
|
151241
151723
|
}
|
|
151242
151724
|
covered = 0;
|
|
151243
151725
|
while (covered < total && c.canRead(8)) {
|
|
151244
|
-
const
|
|
151245
|
-
const props = { count };
|
|
151726
|
+
const count2 = c.u32();
|
|
151727
|
+
const props = { count: count2 };
|
|
151246
151728
|
if (!parseCfException(c, scheme, props)) {
|
|
151247
151729
|
break;
|
|
151248
151730
|
}
|
|
151249
151731
|
charRuns.push(props);
|
|
151250
|
-
covered +=
|
|
151732
|
+
covered += count2;
|
|
151251
151733
|
}
|
|
151252
151734
|
return { paragraphRuns, charRuns };
|
|
151253
151735
|
}
|
|
@@ -152309,13 +152791,13 @@ var init_geometry_map = __esm({
|
|
|
152309
152791
|
function parseProperties2(view, data, rec) {
|
|
152310
152792
|
const values = /* @__PURE__ */ new Map();
|
|
152311
152793
|
const complex = /* @__PURE__ */ new Map();
|
|
152312
|
-
const
|
|
152313
|
-
const entriesEnd = rec.dataOffset +
|
|
152794
|
+
const count2 = rec.recInstance;
|
|
152795
|
+
const entriesEnd = rec.dataOffset + count2 * 6;
|
|
152314
152796
|
if (entriesEnd > rec.dataOffset + rec.recLen) {
|
|
152315
152797
|
return { values, complex };
|
|
152316
152798
|
}
|
|
152317
152799
|
const complexRefs = [];
|
|
152318
|
-
for (let i2 = 0; i2 <
|
|
152800
|
+
for (let i2 = 0; i2 < count2; i2++) {
|
|
152319
152801
|
const at2 = rec.dataOffset + i2 * 6;
|
|
152320
152802
|
const opid = view.getUint16(at2, true);
|
|
152321
152803
|
const value = view.getUint32(at2 + 2, true);
|
|
@@ -153516,8 +153998,8 @@ function levelXml(tag, level2, fallbackSizePt) {
|
|
|
153516
153998
|
}
|
|
153517
153999
|
function styleLevels(levels, fallbackSizePt) {
|
|
153518
154000
|
const result = [];
|
|
153519
|
-
const
|
|
153520
|
-
for (let i2 = 0; i2 <
|
|
154001
|
+
const count2 = Math.max(1, Math.min(levels.length, 9));
|
|
154002
|
+
for (let i2 = 0; i2 < count2; i2++) {
|
|
153521
154003
|
result.push(levelXml(`lvl${i2 + 1}pPr`, levels[i2] ?? {}, fallbackSizePt));
|
|
153522
154004
|
}
|
|
153523
154005
|
return result.join("");
|
|
@@ -154013,6 +154495,7 @@ var PptxHandlerCore;
|
|
|
154013
154495
|
var init_PptxHandlerCore = __esm({
|
|
154014
154496
|
"pptx/core/PptxHandlerCore.ts"() {
|
|
154015
154497
|
init_core2();
|
|
154498
|
+
init_load_limits();
|
|
154016
154499
|
init_ppt();
|
|
154017
154500
|
init_encryption_detection();
|
|
154018
154501
|
init_ole2_parser();
|
|
@@ -154402,6 +154885,7 @@ var init_PptxHandlerCore = __esm({
|
|
|
154402
154885
|
* ```
|
|
154403
154886
|
*/
|
|
154404
154887
|
async load(data, options = {}) {
|
|
154888
|
+
assertPptxInputWithinLimits(data.byteLength, resolvePptxLoadLimits(options));
|
|
154405
154889
|
const detection = detectFileFormat(data);
|
|
154406
154890
|
if (detection.format === "ole") {
|
|
154407
154891
|
let ole;
|
|
@@ -154654,6 +155138,7 @@ var init_PptxHandler = __esm({
|
|
|
154654
155138
|
"pptx/core/PptxHandler.ts"() {
|
|
154655
155139
|
init_json();
|
|
154656
155140
|
init_PresentationBuilder();
|
|
155141
|
+
init_load_limits();
|
|
154657
155142
|
init_PptxHandlerCore();
|
|
154658
155143
|
PptxHandler = class extends PptxHandlerCore {
|
|
154659
155144
|
/**
|
|
@@ -154725,13 +155210,15 @@ var init_PptxHandler = __esm({
|
|
|
154725
155210
|
* archives and portable `pptx-viewer-json` documents.
|
|
154726
155211
|
*
|
|
154727
155212
|
* The buffer is sniffed first: JSON documents (leading `{` plus the
|
|
154728
|
-
* `"pptx-viewer-json"` format marker) are
|
|
154729
|
-
* everything else goes through the regular ZIP/OLE2 pipeline.
|
|
155213
|
+
* `"pptx-viewer-json"` format marker) are imported as {@link loadFromJson}
|
|
155214
|
+
* does; everything else goes through the regular ZIP/OLE2 pipeline.
|
|
154730
155215
|
*/
|
|
154731
155216
|
async load(data, options = {}) {
|
|
155217
|
+
const limits = resolvePptxLoadLimits(options);
|
|
155218
|
+
assertPptxInputWithinLimits(data.byteLength, limits);
|
|
154732
155219
|
const jsonText = decodePptxJsonText(data);
|
|
154733
155220
|
if (jsonText !== null) {
|
|
154734
|
-
return this.
|
|
155221
|
+
return this.importJson(jsonText, options, limits);
|
|
154735
155222
|
}
|
|
154736
155223
|
return super.load(data, options);
|
|
154737
155224
|
}
|
|
@@ -154742,9 +155229,26 @@ var init_PptxHandler = __esm({
|
|
|
154742
155229
|
* handler keeps a valid in-memory archive (editing and {@link save} keep
|
|
154743
155230
|
* working), then the imported model is overlaid on top: imported
|
|
154744
155231
|
* presentation fields win, and the slide array is replaced wholesale.
|
|
155232
|
+
*
|
|
155233
|
+
* `options.limits` applies as it does for {@link load}: `maxInputBytes` to
|
|
155234
|
+
* the UTF-8 size of `text` (checked before it is parsed), and `maxSlides`
|
|
155235
|
+
* and `maxShapes` to the document's slides with the same counting rule as
|
|
155236
|
+
* a `.pptx` package (layout and master elements are not counted).
|
|
154745
155237
|
*/
|
|
154746
155238
|
async loadFromJson(text2, options = {}) {
|
|
154747
|
-
const
|
|
155239
|
+
const limits = resolvePptxLoadLimits(options);
|
|
155240
|
+
assertPptxTextWithinLimits(text2, limits);
|
|
155241
|
+
return this.importJson(text2, options, limits);
|
|
155242
|
+
}
|
|
155243
|
+
async importJson(text2, options, limits) {
|
|
155244
|
+
const document2 = parsePptxJson(text2);
|
|
155245
|
+
assertPptxSlideCountWithinLimits(document2.slides.length, limits);
|
|
155246
|
+
let shapes = 0;
|
|
155247
|
+
for (const slide of document2.slides) {
|
|
155248
|
+
const elements3 = Array.isArray(slide.elements) ? slide.elements : [];
|
|
155249
|
+
shapes = countPptxShapesWithinLimits(shapes, elements3, limits);
|
|
155250
|
+
}
|
|
155251
|
+
const imported = pptxDataFromJsonDocument(document2);
|
|
154748
155252
|
const blankBytes = await buildBlankPresentationArchive({
|
|
154749
155253
|
width: imported.widthEmu,
|
|
154750
155254
|
height: imported.heightEmu,
|
|
@@ -154752,7 +155256,7 @@ var init_PptxHandler = __esm({
|
|
|
154752
155256
|
// the overlaid model, so the archive must carry the value itself.
|
|
154753
155257
|
firstSlideNumber: imported.firstSlideNumber
|
|
154754
155258
|
});
|
|
154755
|
-
const base2 = await super.load(blankBytes, options);
|
|
155259
|
+
const base2 = await super.load(blankBytes, { ...options, limits: void 0 });
|
|
154756
155260
|
return applyImportedPptxData(base2, imported);
|
|
154757
155261
|
}
|
|
154758
155262
|
};
|
|
@@ -155889,10 +156393,10 @@ function ensureChartData2(element) {
|
|
|
155889
156393
|
}
|
|
155890
156394
|
function validateShapeIndex(element, index2) {
|
|
155891
156395
|
ensureChartData2(element);
|
|
155892
|
-
const
|
|
155893
|
-
if (index2 < 0 || index2 >=
|
|
156396
|
+
const count2 = element.chartData.userShapes?.length ?? 0;
|
|
156397
|
+
if (index2 < 0 || index2 >= count2) {
|
|
155894
156398
|
throw new RangeError(
|
|
155895
|
-
`Overlay-shape index ${index2} is out of range. Chart has ${
|
|
156399
|
+
`Overlay-shape index ${index2} is out of range. Chart has ${count2} overlay shape(s) (indices 0-${count2 - 1}).`
|
|
155896
156400
|
);
|
|
155897
156401
|
}
|
|
155898
156402
|
}
|
|
@@ -160828,7 +161332,7 @@ function batchUpdateElements(ctx, params) {
|
|
|
160828
161332
|
}
|
|
160829
161333
|
const slide = ctx.pptxData.slides[params.slideIndex];
|
|
160830
161334
|
const idSet = new Set(params.elementIds);
|
|
160831
|
-
let
|
|
161335
|
+
let count2 = 0;
|
|
160832
161336
|
for (const el of slide.elements) {
|
|
160833
161337
|
if (!idSet.has(el.id)) {
|
|
160834
161338
|
continue;
|
|
@@ -160854,12 +161358,12 @@ function batchUpdateElements(ctx, params) {
|
|
|
160854
161358
|
if (params.hidden !== void 0) {
|
|
160855
161359
|
el.hidden = params.hidden;
|
|
160856
161360
|
}
|
|
160857
|
-
|
|
161361
|
+
count2++;
|
|
160858
161362
|
}
|
|
160859
161363
|
return {
|
|
160860
161364
|
pptxData: ctx.pptxData,
|
|
160861
161365
|
dirty: true,
|
|
160862
|
-
result: { updatedCount:
|
|
161366
|
+
result: { updatedCount: count2 }
|
|
160863
161367
|
};
|
|
160864
161368
|
}
|
|
160865
161369
|
|
|
@@ -160886,7 +161390,7 @@ function updateTableCells(ctx, params) {
|
|
|
160886
161390
|
if (!tbl.tableData) {
|
|
160887
161391
|
throw new Error(`Table '${params.elementId}' has no tableData.`);
|
|
160888
161392
|
}
|
|
160889
|
-
let
|
|
161393
|
+
let count2 = 0;
|
|
160890
161394
|
for (const cellUpdate of params.cells) {
|
|
160891
161395
|
const row = tbl.tableData.rows[cellUpdate.row];
|
|
160892
161396
|
if (!row) {
|
|
@@ -160899,12 +161403,12 @@ function updateTableCells(ctx, params) {
|
|
|
160899
161403
|
throw new Error(`Column ${cellUpdate.col} out of range (row has ${row.cells.length} cells).`);
|
|
160900
161404
|
}
|
|
160901
161405
|
cell.text = cellUpdate.text;
|
|
160902
|
-
|
|
161406
|
+
count2++;
|
|
160903
161407
|
}
|
|
160904
161408
|
return {
|
|
160905
161409
|
pptxData: ctx.pptxData,
|
|
160906
161410
|
dirty: true,
|
|
160907
|
-
result: { updatedCount:
|
|
161411
|
+
result: { updatedCount: count2 }
|
|
160908
161412
|
};
|
|
160909
161413
|
}
|
|
160910
161414
|
function manageTableStructure(ctx, params) {
|
|
@@ -161289,7 +161793,7 @@ function replaceText(ctx, params) {
|
|
|
161289
161793
|
};
|
|
161290
161794
|
}
|
|
161291
161795
|
const targetIndexes = params.slideIndexes ? params.slideIndexes : ctx.pptxData.slides.map((_, i2) => i2);
|
|
161292
|
-
let
|
|
161796
|
+
let count2 = 0;
|
|
161293
161797
|
for (const si of targetIndexes) {
|
|
161294
161798
|
const err = validateSlideIndex(si, ctx.pptxData.slides.length);
|
|
161295
161799
|
if (err) {
|
|
@@ -161304,7 +161808,7 @@ function replaceText(ctx, params) {
|
|
|
161304
161808
|
const after = before.replace(regex, params.replacement);
|
|
161305
161809
|
if (after !== before) {
|
|
161306
161810
|
const matchCount = Array.from(before.matchAll(regex)).length;
|
|
161307
|
-
|
|
161811
|
+
count2 += matchCount;
|
|
161308
161812
|
replaceElementText(textEl, regex, params.replacement);
|
|
161309
161813
|
}
|
|
161310
161814
|
}
|
|
@@ -161318,7 +161822,7 @@ function replaceText(ctx, params) {
|
|
|
161318
161822
|
const before = cell.text;
|
|
161319
161823
|
const after = before.replace(regex, params.replacement);
|
|
161320
161824
|
if (after !== before) {
|
|
161321
|
-
|
|
161825
|
+
count2 += Array.from(before.matchAll(regex)).length;
|
|
161322
161826
|
cell.text = after;
|
|
161323
161827
|
}
|
|
161324
161828
|
}
|
|
@@ -161331,18 +161835,18 @@ function replaceText(ctx, params) {
|
|
|
161331
161835
|
const before = slide.notes;
|
|
161332
161836
|
const after = before.replace(regex, params.replacement);
|
|
161333
161837
|
if (after !== before) {
|
|
161334
|
-
|
|
161838
|
+
count2 += Array.from(before.matchAll(regex)).length;
|
|
161335
161839
|
slide.notes = after;
|
|
161336
161840
|
}
|
|
161337
161841
|
}
|
|
161338
161842
|
}
|
|
161339
161843
|
return {
|
|
161340
161844
|
pptxData: ctx.pptxData,
|
|
161341
|
-
dirty:
|
|
161845
|
+
dirty: count2 > 0,
|
|
161342
161846
|
result: {
|
|
161343
161847
|
query: params.query,
|
|
161344
161848
|
replacement: params.replacement,
|
|
161345
|
-
replacementCount:
|
|
161849
|
+
replacementCount: count2
|
|
161346
161850
|
}
|
|
161347
161851
|
};
|
|
161348
161852
|
}
|
|
@@ -163691,7 +164195,7 @@ __export(util_exports, {
|
|
|
163691
164195
|
slugify: () => slugify,
|
|
163692
164196
|
stringifyPrimitive: () => stringifyPrimitive,
|
|
163693
164197
|
toZod: () => toZod,
|
|
163694
|
-
uint8ArrayToBase64: () =>
|
|
164198
|
+
uint8ArrayToBase64: () => uint8ArrayToBase642,
|
|
163695
164199
|
uint8ArrayToBase64url: () => uint8ArrayToBase64url,
|
|
163696
164200
|
uint8ArrayToHex: () => uint8ArrayToHex,
|
|
163697
164201
|
unwrapMessage: () => unwrapMessage
|
|
@@ -164263,14 +164767,14 @@ function codePointLength(str) {
|
|
|
164263
164767
|
const units = str.length;
|
|
164264
164768
|
if (!highSurrogate.test(str))
|
|
164265
164769
|
return units;
|
|
164266
|
-
let
|
|
164770
|
+
let count2 = units;
|
|
164267
164771
|
for (let i2 = 0; i2 < units - 1; i2++) {
|
|
164268
164772
|
if ((str.charCodeAt(i2) & 64512) === 55296 && (str.charCodeAt(i2 + 1) & 64512) === 56320) {
|
|
164269
|
-
|
|
164773
|
+
count2--;
|
|
164270
164774
|
i2++;
|
|
164271
164775
|
}
|
|
164272
164776
|
}
|
|
164273
|
-
return
|
|
164777
|
+
return count2;
|
|
164274
164778
|
}
|
|
164275
164779
|
function getLengthableOrigin(input2) {
|
|
164276
164780
|
if (Array.isArray(input2))
|
|
@@ -164325,7 +164829,7 @@ function base64ToUint8Array(base643) {
|
|
|
164325
164829
|
}
|
|
164326
164830
|
return bytes;
|
|
164327
164831
|
}
|
|
164328
|
-
function
|
|
164832
|
+
function uint8ArrayToBase642(bytes) {
|
|
164329
164833
|
let binaryString = "";
|
|
164330
164834
|
for (let i2 = 0; i2 < bytes.length; i2++) {
|
|
164331
164835
|
binaryString += String.fromCharCode(bytes[i2]);
|
|
@@ -164338,7 +164842,7 @@ function base64urlToUint8Array(base64url3) {
|
|
|
164338
164842
|
return base64ToUint8Array(base643 + padding);
|
|
164339
164843
|
}
|
|
164340
164844
|
function uint8ArrayToBase64url(bytes) {
|
|
164341
|
-
return
|
|
164845
|
+
return uint8ArrayToBase642(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
164342
164846
|
}
|
|
164343
164847
|
function hexToUint8Array(hex5) {
|
|
164344
164848
|
const cleanHex = hex5.replace(/^0x/, "");
|
|
@@ -168652,8 +169156,8 @@ function az_default() {
|
|
|
168652
169156
|
}
|
|
168653
169157
|
|
|
168654
169158
|
// ../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/be.js
|
|
168655
|
-
function getBelarusianPlural(
|
|
168656
|
-
const absCount = Math.abs(
|
|
169159
|
+
function getBelarusianPlural(count2, one, few, many) {
|
|
169160
|
+
const absCount = Math.abs(count2);
|
|
168657
169161
|
const lastDigit = absCount % 10;
|
|
168658
169162
|
const lastTwoDigits = absCount % 100;
|
|
168659
169163
|
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|
|
@@ -171300,8 +171804,8 @@ function hu_default() {
|
|
|
171300
171804
|
}
|
|
171301
171805
|
|
|
171302
171806
|
// ../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/hy.js
|
|
171303
|
-
function getArmenianPlural(
|
|
171304
|
-
return Math.abs(
|
|
171807
|
+
function getArmenianPlural(count2, one, many) {
|
|
171808
|
+
return Math.abs(count2) === 1 ? one : many;
|
|
171305
171809
|
}
|
|
171306
171810
|
function withDefiniteArticle(word) {
|
|
171307
171811
|
if (!word)
|
|
@@ -174039,8 +174543,8 @@ function ro_default() {
|
|
|
174039
174543
|
}
|
|
174040
174544
|
|
|
174041
174545
|
// ../../node_modules/.bun/zod@4.6.7/node_modules/zod/v4/locales/ru.js
|
|
174042
|
-
function getRussianPlural(
|
|
174043
|
-
const absCount = Math.abs(
|
|
174546
|
+
function getRussianPlural(count2, one, few, many) {
|
|
174547
|
+
const absCount = Math.abs(count2);
|
|
174044
174548
|
const lastDigit = absCount % 10;
|
|
174045
174549
|
const lastTwoDigits = absCount % 100;
|
|
174046
174550
|
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|