ooxml-ui 1.28.1 → 1.29.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/chart/format-pane-fill-kinds.d.ts +0 -1
- package/dist/chart/format-pane-targets.d.ts +0 -1
- package/dist/chart/format-pane-types.d.ts +0 -1
- package/dist/chart/format-pane-view.d.ts +0 -1
- package/dist/{chunk-2EFIFIPB.js → chunk-LNHFMJ2P.js} +1 -1
- package/dist/{chunk-FHO7TEWA.js → chunk-WYKMVMX4.js} +14 -1
- package/dist/{chunk-WBE2Q5DC.js → chunk-YMZFOG2U.js} +2 -2
- package/dist/form/checkable.d.ts +0 -1
- package/dist/index.js +3 -3
- package/dist/pptx/ai/host.cjs +121 -0
- package/dist/pptx/ai/host.d.ts +39 -0
- package/dist/pptx/ai/host.d.ts.map +1 -0
- package/dist/pptx/ai/host.mjs +4 -0
- package/dist/pptx/ai/index.cjs +120 -870
- package/dist/pptx/ai/index.mjs +6 -842
- package/dist/pptx/{chunk-34A7YWVZ.cjs → chunk-BXCXY4HB.cjs} +536 -144
- package/dist/pptx/{chunk-TOPXMCGQ.mjs → chunk-DVLU476S.mjs} +504 -96
- package/dist/pptx/{chunk-MJACF7Y2.mjs → chunk-EHIQ4ANA.mjs} +5 -0
- package/dist/pptx/chunk-IY7H76CZ.cjs +874 -0
- package/dist/pptx/{chunk-GWKTHP6U.cjs → chunk-PATUICO4.cjs} +5 -0
- package/dist/pptx/{chunk-BYSLCSDL.cjs → chunk-UTBHXIDK.cjs} +46 -46
- package/dist/pptx/{chunk-SJX7SFED.mjs → chunk-YO3EMGXD.mjs} +2 -2
- package/dist/pptx/chunk-YQANSI3A.mjs +844 -0
- package/dist/pptx/dom/glyph-outline-cache.d.ts +3 -1
- package/dist/pptx/dom/glyph-outline-cache.d.ts.map +1 -1
- package/dist/pptx/dom/index.cjs +399 -398
- package/dist/pptx/dom/index.mjs +15 -14
- package/dist/pptx/dom/load-presentation.d.ts +7 -1
- package/dist/pptx/dom/load-presentation.d.ts.map +1 -1
- package/dist/pptx/export/html2canvas-clone.cjs +4 -4
- package/dist/pptx/export/html2canvas-clone.mjs +1 -1
- package/dist/pptx/export/print-document.cjs +18 -18
- package/dist/pptx/export/print-document.mjs +2 -2
- package/dist/pptx/i18n/index.cjs +6 -6
- package/dist/pptx/i18n/index.mjs +1 -1
- package/dist/pptx/i18n/translations-en.d.ts.map +1 -1
- package/dist/pptx/index.cjs +3179 -3163
- package/dist/pptx/index.mjs +9 -9
- package/dist/pptx/render/embedded-font-trust.d.ts +7 -0
- package/dist/pptx/render/embedded-font-trust.d.ts.map +1 -1
- package/dist/pptx/render/embedded-fonts.d.ts +4 -3
- package/dist/pptx/render/embedded-fonts.d.ts.map +1 -1
- package/dist/pptx/render/glyph-outline-font-registration.d.ts +83 -0
- package/dist/pptx/render/glyph-outline-font-registration.d.ts.map +1 -0
- package/dist/pptx/render/index.d.ts +2 -0
- package/dist/pptx/render/index.d.ts.map +1 -1
- package/dist/pptx/render/load-limits.d.ts +18 -0
- package/dist/pptx/render/load-limits.d.ts.map +1 -0
- package/dist/pptx/render/text-warp-glyph-outline-lookup.d.ts +39 -0
- package/dist/pptx/render/text-warp-glyph-outline-lookup.d.ts.map +1 -0
- package/dist/pptx/render/text-warp-opentype-parser.d.ts +15 -2
- package/dist/pptx/render/text-warp-opentype-parser.d.ts.map +1 -1
- package/dist/pptx/render/text-warp-outline-font-cache.d.ts +116 -42
- package/dist/pptx/render/text-warp-outline-font-cache.d.ts.map +1 -1
- package/dist/pptx/render/viewer-props-manifest.d.ts.map +1 -1
- package/dist/pptx/{smartart-insert-preview-OW6RXM7M.cjs → smartart-insert-preview-DHQ47GXP.cjs} +11 -11
- package/dist/pptx/{smartart-insert-preview-RAWXO2RH.mjs → smartart-insert-preview-IQVC5LMF.mjs} +10 -10
- package/dist/{presentation-preview-KY56TONW.js → presentation-preview-XGJMARKI.js} +1 -1
- package/dist/teams/app/presentation-preview.d.ts +3 -0
- package/dist/teams.js +2 -2
- package/dist/xlsx.js +4 -4
- package/package.json +8 -8
- package/dist/pptx/{chunk-YMITEJST.cjs → chunk-3CYWRMYZ.cjs} +1 -1
- package/dist/pptx/{chunk-3LOVEO7U.mjs → chunk-5VSUIPDX.mjs} +1 -1
- /package/dist/pptx/{chunk-FM4C4MBJ.cjs → chunk-67UQWOEQ.cjs} +0 -0
- /package/dist/pptx/{chunk-AMW2AR7J.mjs → chunk-6MZFWTBS.mjs} +0 -0
|
@@ -1,36 +1,35 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var chunkXOAXPD2W_cjs = require('./chunk-XOAXPD2W.cjs');
|
|
4
|
+
var chunkW3X2UVYQ_cjs = require('./chunk-W3X2UVYQ.cjs');
|
|
3
5
|
var chunkWSTWYZFM_cjs = require('./chunk-WSTWYZFM.cjs');
|
|
4
6
|
var chunkX7FS7XHU_cjs = require('./chunk-X7FS7XHU.cjs');
|
|
5
7
|
var chunkXFQ2RD4I_cjs = require('./chunk-XFQ2RD4I.cjs');
|
|
6
8
|
var chunk52LKIMK3_cjs = require('./chunk-52LKIMK3.cjs');
|
|
7
9
|
var chunkH5IPNKX6_cjs = require('./chunk-H5IPNKX6.cjs');
|
|
8
|
-
var chunkXOAXPD2W_cjs = require('./chunk-XOAXPD2W.cjs');
|
|
9
10
|
var chunkBSGCZ4JZ_cjs = require('./chunk-BSGCZ4JZ.cjs');
|
|
10
11
|
var chunkIOOI63TH_cjs = require('./chunk-IOOI63TH.cjs');
|
|
11
12
|
var chunkZJFN5POF_cjs = require('./chunk-ZJFN5POF.cjs');
|
|
12
13
|
var chunkCWWL7MCL_cjs = require('./chunk-CWWL7MCL.cjs');
|
|
13
14
|
var chunkWB25PCHQ_cjs = require('./chunk-WB25PCHQ.cjs');
|
|
14
|
-
var
|
|
15
|
+
var chunkUSBRSEJK_cjs = require('./chunk-USBRSEJK.cjs');
|
|
15
16
|
var chunk6KLPQQYP_cjs = require('./chunk-6KLPQQYP.cjs');
|
|
16
17
|
var chunkFOE75Z6N_cjs = require('./chunk-FOE75Z6N.cjs');
|
|
17
18
|
var chunkNTXHQHCS_cjs = require('./chunk-NTXHQHCS.cjs');
|
|
18
|
-
var
|
|
19
|
-
var
|
|
19
|
+
var chunk67UQWOEQ_cjs = require('./chunk-67UQWOEQ.cjs');
|
|
20
|
+
var chunk3CYWRMYZ_cjs = require('./chunk-3CYWRMYZ.cjs');
|
|
21
|
+
var chunkEW5DW5KR_cjs = require('./chunk-EW5DW5KR.cjs');
|
|
20
22
|
var chunkUPN5FFKP_cjs = require('./chunk-UPN5FFKP.cjs');
|
|
21
23
|
var chunkOJFD3SHS_cjs = require('./chunk-OJFD3SHS.cjs');
|
|
22
|
-
var chunkUSBRSEJK_cjs = require('./chunk-USBRSEJK.cjs');
|
|
23
24
|
var chunk3ESFHUZI_cjs = require('./chunk-3ESFHUZI.cjs');
|
|
24
25
|
var chunkU47LRWDT_cjs = require('./chunk-U47LRWDT.cjs');
|
|
25
|
-
var
|
|
26
|
+
var chunkPATUICO4_cjs = require('./chunk-PATUICO4.cjs');
|
|
26
27
|
var chunkY6DO6SVT_cjs = require('./chunk-Y6DO6SVT.cjs');
|
|
27
28
|
var chunkPBZWDEXQ_cjs = require('./chunk-PBZWDEXQ.cjs');
|
|
28
|
-
var chunkEW5DW5KR_cjs = require('./chunk-EW5DW5KR.cjs');
|
|
29
29
|
var pptx = require('ooxml-core/pptx');
|
|
30
30
|
var color = require('ooxml-core/color');
|
|
31
31
|
var text$1 = require('ooxml-core/text');
|
|
32
32
|
var textSegmentParagraphBreak = require('ooxml-core/pptx/editor/render/text-segment-paragraph-break');
|
|
33
|
-
var opentypeModule = require('opentype.js');
|
|
34
33
|
var math = require('ooxml-core/math');
|
|
35
34
|
var chart = require('ooxml-core/chart');
|
|
36
35
|
var schemaLabelKeys = require('ooxml-core/pptx/editor/render/schema-label-keys');
|
|
@@ -96,26 +95,6 @@ var live_js = require('lit/directives/live.js');
|
|
|
96
95
|
var drawingml = require('ooxml-core/drawingml');
|
|
97
96
|
var keyed_js = require('lit/directives/keyed.js');
|
|
98
97
|
|
|
99
|
-
function _interopNamespace(e) {
|
|
100
|
-
if (e && e.__esModule) return e;
|
|
101
|
-
var n = Object.create(null);
|
|
102
|
-
if (e) {
|
|
103
|
-
Object.keys(e).forEach(function (k) {
|
|
104
|
-
if (k !== 'default') {
|
|
105
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
106
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
107
|
-
enumerable: true,
|
|
108
|
-
get: function () { return e[k]; }
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
n.default = e;
|
|
114
|
-
return Object.freeze(n);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
var opentypeModule__namespace = /*#__PURE__*/_interopNamespace(opentypeModule);
|
|
118
|
-
|
|
119
98
|
// src/pptx/web-components/control-styles.ts
|
|
120
99
|
var sheetsByDocument = /* @__PURE__ */ new WeakMap();
|
|
121
100
|
function attachControlStyles(root, css) {
|
|
@@ -1660,10 +1639,10 @@ function getComputedStrokeStyle(element) {
|
|
|
1660
1639
|
const borderColor = style.strokeOpacity === void 0 ? rawColor : chunk6KLPQQYP_cjs.colorWithOpacity(chunk6KLPQQYP_cjs.normalizeHexColor(rawColor, chunk6KLPQQYP_cjs.DEFAULT_STROKE_COLOR), style.strokeOpacity);
|
|
1661
1640
|
return {
|
|
1662
1641
|
borderWidth,
|
|
1663
|
-
cssBorderWidth:
|
|
1642
|
+
cssBorderWidth: chunk67UQWOEQ_cjs.screenStrokeWidth(borderWidth),
|
|
1664
1643
|
borderStyle,
|
|
1665
1644
|
borderColor,
|
|
1666
|
-
border:
|
|
1645
|
+
border: chunk67UQWOEQ_cjs.screenBorder(borderWidth, borderStyle ?? "solid", borderColor),
|
|
1667
1646
|
...joins
|
|
1668
1647
|
};
|
|
1669
1648
|
}
|
|
@@ -1883,12 +1862,12 @@ function getPresetShapeVectorGeometry(shapeType, width, height, adjustments) {
|
|
|
1883
1862
|
function outlineStrands(compoundLine, strokeWidth) {
|
|
1884
1863
|
const offsets2 = getCompoundLineOffsets(compoundLine, strokeWidth);
|
|
1885
1864
|
if (offsets2.length <= 1) {
|
|
1886
|
-
return [{ strokeWidth, cssStrokeWidth:
|
|
1865
|
+
return [{ strokeWidth, cssStrokeWidth: chunk67UQWOEQ_cjs.screenStrokeWidth(strokeWidth), offset: 0 }];
|
|
1887
1866
|
}
|
|
1888
1867
|
const widths = getCompoundLineWidths(compoundLine, strokeWidth);
|
|
1889
1868
|
return offsets2.map((offset, idx) => {
|
|
1890
1869
|
const width = widths[idx] ?? strokeWidth;
|
|
1891
|
-
return { strokeWidth: width, cssStrokeWidth:
|
|
1870
|
+
return { strokeWidth: width, cssStrokeWidth: chunk67UQWOEQ_cjs.screenStrokeWidth(width), offset };
|
|
1892
1871
|
});
|
|
1893
1872
|
}
|
|
1894
1873
|
function needsCenteredStrokeOverlay(element, style, declaredWidth) {
|
|
@@ -1914,7 +1893,7 @@ function clipEdgeBleed(element, d, style) {
|
|
|
1914
1893
|
return edge ? {
|
|
1915
1894
|
d: edge,
|
|
1916
1895
|
strokeWidth: 1,
|
|
1917
|
-
cssStrokeWidth: `max(1px, calc(2 * var(${
|
|
1896
|
+
cssStrokeWidth: `max(1px, calc(2 * var(${chunk67UQWOEQ_cjs.DEVICE_PX_VAR}, 0px)))`,
|
|
1918
1897
|
offset: 0
|
|
1919
1898
|
} : void 0;
|
|
1920
1899
|
}
|
|
@@ -7478,6 +7457,43 @@ function readFontFileStyle(bytes) {
|
|
|
7478
7457
|
};
|
|
7479
7458
|
}
|
|
7480
7459
|
var trustedByList = /* @__PURE__ */ new WeakMap();
|
|
7460
|
+
var typefaceTrustByList = /* @__PURE__ */ new WeakMap();
|
|
7461
|
+
function trimmedName(font) {
|
|
7462
|
+
return typeof font.name === "string" ? font.name.trim() : "";
|
|
7463
|
+
}
|
|
7464
|
+
function isEmbeddedTypefaceTrusted(fonts, typeface) {
|
|
7465
|
+
const name = typeface.trim();
|
|
7466
|
+
let memo = typefaceTrustByList.get(fonts);
|
|
7467
|
+
const known = memo?.get(name);
|
|
7468
|
+
if (known !== void 0) {
|
|
7469
|
+
return known;
|
|
7470
|
+
}
|
|
7471
|
+
let trusted = true;
|
|
7472
|
+
if (name && resolveGoogleFontsFace(name)) {
|
|
7473
|
+
for (const font of fonts) {
|
|
7474
|
+
if (trimmedName(font) !== name) {
|
|
7475
|
+
continue;
|
|
7476
|
+
}
|
|
7477
|
+
const bytes = resolveEmbeddedFontClearBytes(font);
|
|
7478
|
+
const actual = bytes ? readFontFileStyle(bytes) : void 0;
|
|
7479
|
+
if (!actual) {
|
|
7480
|
+
continue;
|
|
7481
|
+
}
|
|
7482
|
+
const expectedWeight = resolveFontWeight(name, Boolean(font.bold));
|
|
7483
|
+
const expectedItalic = resolveFontItalic(name, font.italic);
|
|
7484
|
+
if (Math.abs(actual.weight - expectedWeight) >= WEIGHT_TOLERANCE || actual.italic !== expectedItalic) {
|
|
7485
|
+
trusted = false;
|
|
7486
|
+
break;
|
|
7487
|
+
}
|
|
7488
|
+
}
|
|
7489
|
+
}
|
|
7490
|
+
if (!memo) {
|
|
7491
|
+
memo = /* @__PURE__ */ new Map();
|
|
7492
|
+
typefaceTrustByList.set(fonts, memo);
|
|
7493
|
+
}
|
|
7494
|
+
memo.set(name, trusted);
|
|
7495
|
+
return trusted;
|
|
7496
|
+
}
|
|
7481
7497
|
function selectTrustedEmbeddedFonts(fonts) {
|
|
7482
7498
|
if (!fonts || fonts.length === 0) {
|
|
7483
7499
|
return [];
|
|
@@ -7486,30 +7502,147 @@ function selectTrustedEmbeddedFonts(fonts) {
|
|
|
7486
7502
|
if (memo) {
|
|
7487
7503
|
return memo;
|
|
7488
7504
|
}
|
|
7489
|
-
const
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
|
|
7493
|
-
|
|
7505
|
+
const trusted = fonts.filter((font) => isEmbeddedTypefaceTrusted(fonts, trimmedName(font)));
|
|
7506
|
+
trustedByList.set(fonts, trusted);
|
|
7507
|
+
return trusted;
|
|
7508
|
+
}
|
|
7509
|
+
|
|
7510
|
+
// src/pptx/render/glyph-outline-font-registration.ts
|
|
7511
|
+
var EmbeddedFontCandidates = class {
|
|
7512
|
+
byKey = /* @__PURE__ */ new Map();
|
|
7513
|
+
/** Weak, so a list that is no longer referenced by any candidate is not kept here. */
|
|
7514
|
+
registrations = /* @__PURE__ */ new WeakMap();
|
|
7515
|
+
/**
|
|
7516
|
+
* Record each font of `list` under `keyOf(font)`, after the candidates
|
|
7517
|
+
* already recorded for that key. `keyOf` returns `undefined` for a font
|
|
7518
|
+
* that needs no record. A list that is already registered is left as it is,
|
|
7519
|
+
* so its fonts keep their place, and gains one more owner. Returns this
|
|
7520
|
+
* owner's release: the candidates `list` has here are removed once every
|
|
7521
|
+
* owner has released. Calling a release again does nothing, and a release
|
|
7522
|
+
* from before the list was fully released never touches a later
|
|
7523
|
+
* registration of the same list.
|
|
7524
|
+
*/
|
|
7525
|
+
add(list, keyOf) {
|
|
7526
|
+
let registration = this.registrations.get(list);
|
|
7527
|
+
if (!registration) {
|
|
7528
|
+
registration = { keys: /* @__PURE__ */ new Set(), owners: 0 };
|
|
7529
|
+
this.registrations.set(list, registration);
|
|
7530
|
+
for (const font of list) {
|
|
7531
|
+
const key = keyOf(font);
|
|
7532
|
+
if (key === void 0) {
|
|
7533
|
+
continue;
|
|
7534
|
+
}
|
|
7535
|
+
registration.keys.add(key);
|
|
7536
|
+
const candidates = this.byKey.get(key);
|
|
7537
|
+
if (candidates) {
|
|
7538
|
+
candidates.push({ font, list });
|
|
7539
|
+
} else {
|
|
7540
|
+
this.byKey.set(key, [{ font, list }]);
|
|
7541
|
+
}
|
|
7542
|
+
}
|
|
7494
7543
|
}
|
|
7495
|
-
|
|
7496
|
-
const
|
|
7497
|
-
|
|
7498
|
-
|
|
7544
|
+
registration.owners += 1;
|
|
7545
|
+
const owned = registration;
|
|
7546
|
+
let released = false;
|
|
7547
|
+
return () => {
|
|
7548
|
+
if (released) {
|
|
7549
|
+
return;
|
|
7550
|
+
}
|
|
7551
|
+
released = true;
|
|
7552
|
+
this.release(list, owned);
|
|
7553
|
+
};
|
|
7554
|
+
}
|
|
7555
|
+
/** Whether any candidate is recorded for `key`. */
|
|
7556
|
+
has(key) {
|
|
7557
|
+
return this.byKey.has(key);
|
|
7558
|
+
}
|
|
7559
|
+
/** The keys that have candidates recorded. */
|
|
7560
|
+
keys() {
|
|
7561
|
+
return this.byKey.keys();
|
|
7562
|
+
}
|
|
7563
|
+
/** Remove and return the candidates recorded for `key`, in registration order. */
|
|
7564
|
+
take(key) {
|
|
7565
|
+
const candidates = this.byKey.get(key);
|
|
7566
|
+
this.byKey.delete(key);
|
|
7567
|
+
return candidates;
|
|
7568
|
+
}
|
|
7569
|
+
/** Every candidate still recorded, key by key in registration order. */
|
|
7570
|
+
*[Symbol.iterator]() {
|
|
7571
|
+
for (const candidates of this.byKey.values()) {
|
|
7572
|
+
yield* candidates;
|
|
7499
7573
|
}
|
|
7500
|
-
|
|
7501
|
-
|
|
7502
|
-
if (
|
|
7503
|
-
|
|
7574
|
+
}
|
|
7575
|
+
release(list, registration) {
|
|
7576
|
+
if (this.registrations.get(list) !== registration) {
|
|
7577
|
+
return;
|
|
7578
|
+
}
|
|
7579
|
+
registration.owners -= 1;
|
|
7580
|
+
if (registration.owners > 0) {
|
|
7581
|
+
return;
|
|
7582
|
+
}
|
|
7583
|
+
this.registrations.delete(list);
|
|
7584
|
+
for (const key of registration.keys) {
|
|
7585
|
+
const candidates = this.byKey.get(key);
|
|
7586
|
+
if (!candidates) {
|
|
7587
|
+
continue;
|
|
7588
|
+
}
|
|
7589
|
+
const kept = candidates.filter((candidate) => candidate.list !== list);
|
|
7590
|
+
if (kept.length > 0) {
|
|
7591
|
+
this.byKey.set(key, kept);
|
|
7592
|
+
} else {
|
|
7593
|
+
this.byKey.delete(key);
|
|
7594
|
+
}
|
|
7504
7595
|
}
|
|
7505
7596
|
}
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
|
|
7509
|
-
|
|
7510
|
-
|
|
7597
|
+
};
|
|
7598
|
+
function createEmbeddedOutlineFontsSlot(cache) {
|
|
7599
|
+
let current;
|
|
7600
|
+
let releaseCurrent;
|
|
7601
|
+
const release = () => {
|
|
7602
|
+
const releasing = releaseCurrent;
|
|
7603
|
+
current = void 0;
|
|
7604
|
+
releaseCurrent = void 0;
|
|
7605
|
+
releasing?.();
|
|
7606
|
+
};
|
|
7607
|
+
return {
|
|
7608
|
+
set(fonts) {
|
|
7609
|
+
if (fonts && fonts === current) {
|
|
7610
|
+
return;
|
|
7611
|
+
}
|
|
7612
|
+
release();
|
|
7613
|
+
if (!fonts || fonts.length === 0) {
|
|
7614
|
+
return;
|
|
7615
|
+
}
|
|
7616
|
+
current = fonts;
|
|
7617
|
+
releaseCurrent = cache.registerEmbeddedFonts(fonts);
|
|
7618
|
+
},
|
|
7619
|
+
release
|
|
7620
|
+
};
|
|
7511
7621
|
}
|
|
7512
|
-
|
|
7622
|
+
|
|
7623
|
+
// src/pptx/render/text-warp-opentype-parser.ts
|
|
7624
|
+
var loadedModule;
|
|
7625
|
+
var loading;
|
|
7626
|
+
function isOpenTypeFontParserReady() {
|
|
7627
|
+
return loadedModule !== void 0;
|
|
7628
|
+
}
|
|
7629
|
+
function preloadOpenTypeFontParser() {
|
|
7630
|
+
loading ??= import('opentype.js').then((module) => {
|
|
7631
|
+
const resolved2 = module;
|
|
7632
|
+
if (!resolved2.parse && !resolved2.default?.parse) {
|
|
7633
|
+
throw new Error("opentype.js does not expose a font parser");
|
|
7634
|
+
}
|
|
7635
|
+
loadedModule = resolved2;
|
|
7636
|
+
}).catch((error) => {
|
|
7637
|
+
loading = void 0;
|
|
7638
|
+
throw error;
|
|
7639
|
+
});
|
|
7640
|
+
return loading;
|
|
7641
|
+
}
|
|
7642
|
+
function parseOpenTypeFont(buffer, module = loadedModule) {
|
|
7643
|
+
if (!module) {
|
|
7644
|
+
throw new Error("opentype.js is not loaded yet; await preloadOpenTypeFontParser() first");
|
|
7645
|
+
}
|
|
7513
7646
|
const parser = module.parse ?? module.default?.parse;
|
|
7514
7647
|
if (!parser) {
|
|
7515
7648
|
throw new Error("opentype.js does not expose a font parser");
|
|
@@ -7517,6 +7650,55 @@ function parseOpenTypeFont(buffer, module = opentypeModule__namespace) {
|
|
|
7517
7650
|
return parser(buffer);
|
|
7518
7651
|
}
|
|
7519
7652
|
|
|
7653
|
+
// src/pptx/render/text-warp-glyph-outline-lookup.ts
|
|
7654
|
+
var WHITESPACE_RE2 = /^\s$/u;
|
|
7655
|
+
function extractGlyphOutlineCommands(font, char, x, y, fontSizePx) {
|
|
7656
|
+
if (!char) {
|
|
7657
|
+
return void 0;
|
|
7658
|
+
}
|
|
7659
|
+
if (WHITESPACE_RE2.test(char)) {
|
|
7660
|
+
return [];
|
|
7661
|
+
}
|
|
7662
|
+
try {
|
|
7663
|
+
if (!font.hasChar(char)) {
|
|
7664
|
+
return void 0;
|
|
7665
|
+
}
|
|
7666
|
+
const path = font.getPath(char, x, y, fontSizePx);
|
|
7667
|
+
return path.commands.map((cmd) => {
|
|
7668
|
+
switch (cmd.type) {
|
|
7669
|
+
case "M":
|
|
7670
|
+
case "L":
|
|
7671
|
+
return { type: cmd.type, x: cmd.x, y: cmd.y };
|
|
7672
|
+
case "Q":
|
|
7673
|
+
return { type: "Q", x1: cmd.x1, y1: cmd.y1, x: cmd.x, y: cmd.y };
|
|
7674
|
+
case "C":
|
|
7675
|
+
return { type: "C", x1: cmd.x1, y1: cmd.y1, x2: cmd.x2, y2: cmd.y2, x: cmd.x, y: cmd.y };
|
|
7676
|
+
case "Z":
|
|
7677
|
+
default:
|
|
7678
|
+
return { type: "Z" };
|
|
7679
|
+
}
|
|
7680
|
+
});
|
|
7681
|
+
} catch {
|
|
7682
|
+
return void 0;
|
|
7683
|
+
}
|
|
7684
|
+
}
|
|
7685
|
+
function createGlyphOutlineLookup(cache) {
|
|
7686
|
+
return (char, font, x, y) => {
|
|
7687
|
+
if (WHITESPACE_RE2.test(char)) {
|
|
7688
|
+
return [];
|
|
7689
|
+
}
|
|
7690
|
+
const parsed = cache.get(font.fontFamily, font.bold, font.italic);
|
|
7691
|
+
if (parsed) {
|
|
7692
|
+
const size2 = font.fontSizePx && font.fontSizePx > 0 ? font.fontSizePx : chunk6KLPQQYP_cjs.DEFAULT_TEXT_FONT_SIZE;
|
|
7693
|
+
const commands = extractGlyphOutlineCommands(parsed, char, x, y, size2);
|
|
7694
|
+
if (commands) {
|
|
7695
|
+
return commands;
|
|
7696
|
+
}
|
|
7697
|
+
}
|
|
7698
|
+
return traceGlyphOutlineCommands(char, font, x, y);
|
|
7699
|
+
};
|
|
7700
|
+
}
|
|
7701
|
+
|
|
7520
7702
|
// src/pptx/render/text-warp-outline-font-cache.ts
|
|
7521
7703
|
function toArrayBuffer(bytes) {
|
|
7522
7704
|
const copy = bytes.slice();
|
|
@@ -7526,114 +7708,284 @@ function primaryFontFamily(family2) {
|
|
|
7526
7708
|
const first = family2.split(",")[0] ?? family2;
|
|
7527
7709
|
return first.trim().replace(/^['"]|['"]$/gu, "");
|
|
7528
7710
|
}
|
|
7711
|
+
function sameBytes(a, b) {
|
|
7712
|
+
if (a === b) {
|
|
7713
|
+
return true;
|
|
7714
|
+
}
|
|
7715
|
+
if (a.length !== b.length) {
|
|
7716
|
+
return false;
|
|
7717
|
+
}
|
|
7718
|
+
for (let i = 0; i < a.length; i += 1) {
|
|
7719
|
+
if (a[i] !== b[i]) {
|
|
7720
|
+
return false;
|
|
7721
|
+
}
|
|
7722
|
+
}
|
|
7723
|
+
return true;
|
|
7724
|
+
}
|
|
7529
7725
|
function cacheKey(family2, bold, italic) {
|
|
7530
7726
|
return `${primaryFontFamily(family2).toLowerCase()}|${bold ? 1 : 0}|${italic ? 1 : 0}`;
|
|
7531
7727
|
}
|
|
7532
7728
|
var GlyphOutlineFontCache = class {
|
|
7533
7729
|
fonts = /* @__PURE__ */ new Map();
|
|
7534
7730
|
attempted = /* @__PURE__ */ new Set();
|
|
7535
|
-
/**
|
|
7731
|
+
/**
|
|
7732
|
+
* Registered embedded candidates per key, in registration order and grouped
|
|
7733
|
+
* by deck, with nothing read from them yet. A key's embedded candidates are
|
|
7734
|
+
* always older than its {@link pendingBytes}: an embedded font is not
|
|
7735
|
+
* recorded for a key that already has bytes, as it would not have been
|
|
7736
|
+
* parsed on arrival.
|
|
7737
|
+
*/
|
|
7738
|
+
pendingEmbedded = new EmbeddedFontCandidates();
|
|
7739
|
+
/**
|
|
7740
|
+
* Webfont bytes registered before the parser loaded, oldest first. Every
|
|
7741
|
+
* candidate is kept until one parses: a later registration only replaces an
|
|
7742
|
+
* earlier one if it parses, exactly as when each is parsed on arrival.
|
|
7743
|
+
*/
|
|
7744
|
+
pendingBytes = /* @__PURE__ */ new Map();
|
|
7745
|
+
/** Keys a lookup missed: parsing one later changes what a repaint draws. */
|
|
7746
|
+
missed = /* @__PURE__ */ new Set();
|
|
7747
|
+
listeners = /* @__PURE__ */ new Set();
|
|
7748
|
+
revision = 0;
|
|
7749
|
+
notifyQueued = false;
|
|
7750
|
+
loading;
|
|
7751
|
+
/**
|
|
7752
|
+
* Call `listener` when a newly parsed font makes an outline available that
|
|
7753
|
+
* an earlier lookup could not use. Returns the unsubscribe function. Shaped
|
|
7754
|
+
* for `useSyncExternalStore`.
|
|
7755
|
+
*/
|
|
7756
|
+
subscribe = (listener) => {
|
|
7757
|
+
this.listeners.add(listener);
|
|
7758
|
+
return () => {
|
|
7759
|
+
this.listeners.delete(listener);
|
|
7760
|
+
};
|
|
7761
|
+
};
|
|
7762
|
+
/** A number that changes each time {@link subscribe} listeners are notified. */
|
|
7763
|
+
getSnapshot = () => this.revision;
|
|
7764
|
+
/**
|
|
7765
|
+
* Load the parser if needed and parse every waiting font, embedded ones
|
|
7766
|
+
* included, so later lookups resolve synchronously. Await it before a
|
|
7767
|
+
* render that must use font-file outlines on its first pass. Rejects if the
|
|
7768
|
+
* parser cannot be loaded; the waiting fonts are kept, so a later call
|
|
7769
|
+
* retries. The load a lookup starts on its own parses only the fonts that
|
|
7770
|
+
* lookups asked for, so other embedded fonts stay undecoded.
|
|
7771
|
+
*/
|
|
7772
|
+
preload() {
|
|
7773
|
+
if (isOpenTypeFontParserReady()) {
|
|
7774
|
+
this.resolveAllPending();
|
|
7775
|
+
return Promise.resolve();
|
|
7776
|
+
}
|
|
7777
|
+
return this.loadParser().then(() => {
|
|
7778
|
+
this.resolveAllPending();
|
|
7779
|
+
});
|
|
7780
|
+
}
|
|
7781
|
+
/**
|
|
7782
|
+
* The parsed font for `(family, bold, italic)`, or `undefined` if unavailable.
|
|
7783
|
+
* Missing a font whose candidates wait for the parser starts loading it.
|
|
7784
|
+
*/
|
|
7536
7785
|
get(family2, bold, italic) {
|
|
7537
7786
|
if (!family2) {
|
|
7538
7787
|
return void 0;
|
|
7539
7788
|
}
|
|
7540
|
-
|
|
7789
|
+
const key = cacheKey(family2, Boolean(bold), Boolean(italic));
|
|
7790
|
+
const font = this.fonts.get(key);
|
|
7791
|
+
if (font) {
|
|
7792
|
+
return font;
|
|
7793
|
+
}
|
|
7794
|
+
const waiting = this.hasPending(key);
|
|
7795
|
+
if (waiting && isOpenTypeFontParserReady()) {
|
|
7796
|
+
this.resolvePending(key);
|
|
7797
|
+
return this.fonts.get(key);
|
|
7798
|
+
}
|
|
7799
|
+
this.missed.add(key);
|
|
7800
|
+
if (waiting) {
|
|
7801
|
+
this.requestParser();
|
|
7802
|
+
}
|
|
7803
|
+
return void 0;
|
|
7541
7804
|
}
|
|
7542
|
-
/**
|
|
7805
|
+
/**
|
|
7806
|
+
* True once a parse of this `(family, bold, italic)` was attempted, whether
|
|
7807
|
+
* or not it resolved. With the parser loaded this settles the key's waiting
|
|
7808
|
+
* candidates first, like a lookup; before that they are not attempts yet.
|
|
7809
|
+
*/
|
|
7543
7810
|
hasAttempted(family2, bold, italic) {
|
|
7544
|
-
|
|
7811
|
+
const key = cacheKey(family2, bold, italic);
|
|
7812
|
+
if (isOpenTypeFontParserReady()) {
|
|
7813
|
+
this.resolvePending(key);
|
|
7814
|
+
}
|
|
7815
|
+
return this.attempted.has(key);
|
|
7545
7816
|
}
|
|
7546
7817
|
/**
|
|
7547
|
-
*
|
|
7548
|
-
*
|
|
7549
|
-
*
|
|
7550
|
-
* are skipped. Typefaces whose
|
|
7551
|
-
*
|
|
7818
|
+
* Record every embedded font for outline lookups, no network involved and
|
|
7819
|
+
* nothing decoded yet. Safe to call repeatedly (e.g. once per render) with
|
|
7820
|
+
* the same list: a list already registered is not recorded again, and
|
|
7821
|
+
* already-resolved or already-failed entries are skipped. Typefaces whose
|
|
7822
|
+
* files do not match them are skipped too (see
|
|
7823
|
+
* `isEmbeddedTypefaceTrusted`), exactly as for `@font-face`. A font for a
|
|
7824
|
+
* key a lookup already missed is parsed now if the parser is loaded, and
|
|
7825
|
+
* otherwise starts loading it.
|
|
7826
|
+
*
|
|
7827
|
+
* Returns the release for this deck: call it when the deck is closed or
|
|
7828
|
+
* replaced to drop its fonts that were never looked up, so the cache stops
|
|
7829
|
+
* holding them. Fonts already parsed stay cached, as before.
|
|
7552
7830
|
*/
|
|
7553
7831
|
registerEmbeddedFonts(fonts) {
|
|
7554
|
-
|
|
7832
|
+
let needed = false;
|
|
7833
|
+
const release = this.pendingEmbedded.add(fonts, (font) => {
|
|
7555
7834
|
if (!font.name) {
|
|
7556
|
-
|
|
7835
|
+
return void 0;
|
|
7557
7836
|
}
|
|
7558
7837
|
const key = cacheKey(font.name, Boolean(font.bold), Boolean(font.italic));
|
|
7559
|
-
if (this.fonts.has(key) || this.attempted.has(key)) {
|
|
7560
|
-
|
|
7561
|
-
}
|
|
7562
|
-
this.attempted.add(key);
|
|
7563
|
-
const bytes = resolveEmbeddedFontClearBytes(font);
|
|
7564
|
-
if (!bytes || bytes.length < 4) {
|
|
7565
|
-
continue;
|
|
7566
|
-
}
|
|
7567
|
-
try {
|
|
7568
|
-
this.fonts.set(key, parseOpenTypeFont(toArrayBuffer(bytes)));
|
|
7569
|
-
} catch {
|
|
7838
|
+
if (this.fonts.has(key) || this.attempted.has(key) || this.pendingBytes.has(key)) {
|
|
7839
|
+
return void 0;
|
|
7570
7840
|
}
|
|
7841
|
+
needed ||= this.missed.has(key);
|
|
7842
|
+
return key;
|
|
7843
|
+
});
|
|
7844
|
+
if (needed) {
|
|
7845
|
+
this.resolveMissedOrLoad();
|
|
7571
7846
|
}
|
|
7847
|
+
return release;
|
|
7572
7848
|
}
|
|
7573
7849
|
/**
|
|
7574
7850
|
* Register raw bytes fetched separately for `(family, bold, italic)` (see
|
|
7575
7851
|
* `text-warp-outline-webfont-fetch.ts`). Returns whether parsing
|
|
7576
7852
|
* succeeded; a caller that owns re-rendering can use this to know whether
|
|
7577
|
-
* a re-render is worth triggering.
|
|
7853
|
+
* a re-render is worth triggering. Before the parser is loaded the bytes
|
|
7854
|
+
* are kept and `false` is returned; {@link subscribe} listeners are told
|
|
7855
|
+
* if they later fill in an outline that a lookup already asked for. Either
|
|
7856
|
+
* way, bytes that do not parse leave the font already registered for this
|
|
7857
|
+
* key (or still waiting for the parser) in place.
|
|
7578
7858
|
*/
|
|
7579
7859
|
registerFontBytes(family2, bold, italic, bytes) {
|
|
7580
7860
|
const key = cacheKey(family2, bold, italic);
|
|
7581
|
-
this.attempted.add(key);
|
|
7582
7861
|
if (bytes.length < 4) {
|
|
7862
|
+
this.attempted.add(key);
|
|
7863
|
+
return false;
|
|
7864
|
+
}
|
|
7865
|
+
if (!isOpenTypeFontParserReady()) {
|
|
7866
|
+
this.addPendingBytes(key, bytes);
|
|
7867
|
+
if (this.missed.has(key)) {
|
|
7868
|
+
this.requestParser();
|
|
7869
|
+
}
|
|
7583
7870
|
return false;
|
|
7584
7871
|
}
|
|
7872
|
+
if (this.parseInto(key, bytes)) {
|
|
7873
|
+
this.dropPending(key);
|
|
7874
|
+
return true;
|
|
7875
|
+
}
|
|
7876
|
+
this.resolvePending(key);
|
|
7877
|
+
return false;
|
|
7878
|
+
}
|
|
7879
|
+
/** Parse `bytes` for `key`; on failure the font already set for `key` stays. */
|
|
7880
|
+
parseInto(key, bytes) {
|
|
7881
|
+
this.attempted.add(key);
|
|
7585
7882
|
try {
|
|
7586
7883
|
this.fonts.set(key, parseOpenTypeFont(toArrayBuffer(bytes)));
|
|
7587
|
-
return true;
|
|
7588
7884
|
} catch {
|
|
7589
7885
|
return false;
|
|
7590
7886
|
}
|
|
7887
|
+
if (this.missed.delete(key)) {
|
|
7888
|
+
this.notify();
|
|
7889
|
+
}
|
|
7890
|
+
return true;
|
|
7591
7891
|
}
|
|
7592
|
-
|
|
7593
|
-
|
|
7594
|
-
|
|
7595
|
-
|
|
7596
|
-
|
|
7892
|
+
addPendingBytes(key, bytes) {
|
|
7893
|
+
const waiting = this.pendingBytes.get(key) ?? [];
|
|
7894
|
+
const index = waiting.findIndex((candidate) => sameBytes(candidate, bytes));
|
|
7895
|
+
if (index >= 0) {
|
|
7896
|
+
waiting.splice(index, 1);
|
|
7897
|
+
}
|
|
7898
|
+
waiting.push(bytes);
|
|
7899
|
+
this.pendingBytes.set(key, waiting);
|
|
7597
7900
|
}
|
|
7598
|
-
|
|
7599
|
-
return
|
|
7901
|
+
hasPending(key) {
|
|
7902
|
+
return this.pendingBytes.has(key) || this.pendingEmbedded.has(key);
|
|
7600
7903
|
}
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
7904
|
+
dropPending(key) {
|
|
7905
|
+
this.pendingBytes.delete(key);
|
|
7906
|
+
this.pendingEmbedded.take(key);
|
|
7907
|
+
}
|
|
7908
|
+
/**
|
|
7909
|
+
* Resolve the candidates waiting for `key` as if each had been parsed on
|
|
7910
|
+
* arrival (the parser must be loaded): the newest bytes that parse win, and
|
|
7911
|
+
* only when none do is the key's first trusted embedded font, the one an
|
|
7912
|
+
* eager registration would have parsed, decoded and parsed. Untrusted
|
|
7913
|
+
* embedded candidates are passed over without marking the key attempted.
|
|
7914
|
+
*/
|
|
7915
|
+
resolvePending(key) {
|
|
7916
|
+
const bytes = this.pendingBytes.get(key);
|
|
7917
|
+
this.pendingBytes.delete(key);
|
|
7918
|
+
const embedded = this.pendingEmbedded.take(key);
|
|
7919
|
+
if (bytes) {
|
|
7920
|
+
for (let i = bytes.length - 1; i >= 0; i -= 1) {
|
|
7921
|
+
if (this.parseInto(key, bytes[i])) {
|
|
7922
|
+
return;
|
|
7923
|
+
}
|
|
7924
|
+
}
|
|
7604
7925
|
}
|
|
7605
|
-
const
|
|
7606
|
-
|
|
7607
|
-
|
|
7608
|
-
case "M":
|
|
7609
|
-
case "L":
|
|
7610
|
-
return { type: cmd.type, x: cmd.x, y: cmd.y };
|
|
7611
|
-
case "Q":
|
|
7612
|
-
return { type: "Q", x1: cmd.x1, y1: cmd.y1, x: cmd.x, y: cmd.y };
|
|
7613
|
-
case "C":
|
|
7614
|
-
return { type: "C", x1: cmd.x1, y1: cmd.y1, x2: cmd.x2, y2: cmd.y2, x: cmd.x, y: cmd.y };
|
|
7615
|
-
case "Z":
|
|
7616
|
-
default:
|
|
7617
|
-
return { type: "Z" };
|
|
7926
|
+
for (const { font, list } of embedded ?? []) {
|
|
7927
|
+
if (!isEmbeddedTypefaceTrusted(list, font.name)) {
|
|
7928
|
+
continue;
|
|
7618
7929
|
}
|
|
7619
|
-
|
|
7620
|
-
|
|
7621
|
-
|
|
7930
|
+
this.attempted.add(key);
|
|
7931
|
+
const clear = resolveEmbeddedFontClearBytes(font);
|
|
7932
|
+
if (clear && clear.length >= 4) {
|
|
7933
|
+
this.parseInto(key, clear);
|
|
7934
|
+
}
|
|
7935
|
+
return;
|
|
7936
|
+
}
|
|
7622
7937
|
}
|
|
7623
|
-
|
|
7624
|
-
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
|
|
7629
|
-
|
|
7630
|
-
|
|
7631
|
-
|
|
7938
|
+
resolveAllPending() {
|
|
7939
|
+
for (const key of /* @__PURE__ */ new Set([...this.pendingBytes.keys(), ...this.pendingEmbedded.keys()])) {
|
|
7940
|
+
this.resolvePending(key);
|
|
7941
|
+
}
|
|
7942
|
+
}
|
|
7943
|
+
/** Parse the waiting candidates of the keys lookups missed, the only ones a repaint needs. */
|
|
7944
|
+
resolveMissed() {
|
|
7945
|
+
for (const key of [...this.missed]) {
|
|
7946
|
+
if (this.hasPending(key)) {
|
|
7947
|
+
this.resolvePending(key);
|
|
7632
7948
|
}
|
|
7633
7949
|
}
|
|
7634
|
-
|
|
7635
|
-
|
|
7636
|
-
|
|
7950
|
+
}
|
|
7951
|
+
resolveMissedOrLoad() {
|
|
7952
|
+
if (isOpenTypeFontParserReady()) {
|
|
7953
|
+
this.resolveMissed();
|
|
7954
|
+
} else {
|
|
7955
|
+
this.requestParser();
|
|
7956
|
+
}
|
|
7957
|
+
}
|
|
7958
|
+
loadParser() {
|
|
7959
|
+
this.loading ??= preloadOpenTypeFontParser().then(
|
|
7960
|
+
() => {
|
|
7961
|
+
this.loading = void 0;
|
|
7962
|
+
this.resolveMissed();
|
|
7963
|
+
},
|
|
7964
|
+
(error) => {
|
|
7965
|
+
this.loading = void 0;
|
|
7966
|
+
throw error;
|
|
7967
|
+
}
|
|
7968
|
+
);
|
|
7969
|
+
return this.loading;
|
|
7970
|
+
}
|
|
7971
|
+
/** Coalesce notifications, and never call listeners from inside a caller's own update. */
|
|
7972
|
+
notify() {
|
|
7973
|
+
if (this.notifyQueued) {
|
|
7974
|
+
return;
|
|
7975
|
+
}
|
|
7976
|
+
this.notifyQueued = true;
|
|
7977
|
+
queueMicrotask(() => {
|
|
7978
|
+
this.notifyQueued = false;
|
|
7979
|
+
this.revision += 1;
|
|
7980
|
+
for (const listener of [...this.listeners]) {
|
|
7981
|
+
listener();
|
|
7982
|
+
}
|
|
7983
|
+
});
|
|
7984
|
+
}
|
|
7985
|
+
requestParser() {
|
|
7986
|
+
this.loadParser().catch(() => void 0);
|
|
7987
|
+
}
|
|
7988
|
+
};
|
|
7637
7989
|
|
|
7638
7990
|
// src/pptx/render/google-webfonts-metric-clones.ts
|
|
7639
7991
|
var METRIC_COMPATIBLE_CLONES = {
|
|
@@ -7799,7 +8151,7 @@ var EQUATION_TEMPLATES = [
|
|
|
7799
8151
|
|
|
7800
8152
|
// src/pptx/render/mathml-sanitize.ts
|
|
7801
8153
|
function sanitizeMathMl(markup) {
|
|
7802
|
-
const sanitized =
|
|
8154
|
+
const sanitized = chunk3CYWRMYZ_cjs.sanitizeMarkupOrEmpty(markup, { USE_PROFILES: { mathMl: true, svg: true } });
|
|
7803
8155
|
if (/<math(?:\s|>)/iu.test(markup) && !/<math(?:\s|>)/iu.test(sanitized) && sanitized) {
|
|
7804
8156
|
return `<math xmlns="http://www.w3.org/1998/Math/MathML" display="inline">${sanitized}</math>`;
|
|
7805
8157
|
}
|
|
@@ -22291,7 +22643,7 @@ function borderToCss(border, resolve) {
|
|
|
22291
22643
|
const width = border.width ?? 1;
|
|
22292
22644
|
const dash = ooxmlDashToCssBorderStyle(border.dash);
|
|
22293
22645
|
const color = border.color ?? resolve(border.fill) ?? "#000000";
|
|
22294
|
-
return
|
|
22646
|
+
return chunk67UQWOEQ_cjs.screenBorder(width, dash, color);
|
|
22295
22647
|
}
|
|
22296
22648
|
function collectSections(entry6, tableData, pos) {
|
|
22297
22649
|
const { rowIndex, cellIndex, rowCount, columnCount } = pos;
|
|
@@ -23756,7 +24108,7 @@ function cellStyleToCss(style) {
|
|
|
23756
24108
|
const w = edge.width ?? 1;
|
|
23757
24109
|
const c = edge.color ?? style.borderColor ?? "#000000";
|
|
23758
24110
|
const s = ooxmlDashToCssBorderStyle(edge.dash);
|
|
23759
|
-
css[edge.prefix] =
|
|
24111
|
+
css[edge.prefix] = chunk67UQWOEQ_cjs.screenBorder(w, s, c);
|
|
23760
24112
|
}
|
|
23761
24113
|
}
|
|
23762
24114
|
Object.assign(css, cellPaddingCss(style));
|
|
@@ -27449,7 +27801,7 @@ function createTemplateContext(options = {}) {
|
|
|
27449
27801
|
const scheme = { ...pptx.DEFAULT_SCHEME_COLOR_MAP, ...options.scheme ?? {} };
|
|
27450
27802
|
let counter = 0;
|
|
27451
27803
|
const idFor = options.idFor ?? ((index) => `template-el-${Date.now()}-${index}`);
|
|
27452
|
-
const dictionary =
|
|
27804
|
+
const dictionary = chunkPATUICO4_cjs.translationsEn;
|
|
27453
27805
|
const translate = options.translate ?? ((key) => dictionary[key] ?? key);
|
|
27454
27806
|
return {
|
|
27455
27807
|
scheme,
|
|
@@ -45372,6 +45724,42 @@ function syncGoogleWebfontStylesheet(doc, id, href) {
|
|
|
45372
45724
|
}
|
|
45373
45725
|
return link;
|
|
45374
45726
|
}
|
|
45727
|
+
var LOAD_LIMIT_MESSAGE_KEYS = Object.freeze({
|
|
45728
|
+
maxInputBytes: "pptx.viewer.loadLimit.maxInputBytes",
|
|
45729
|
+
maxUncompressedBytes: "pptx.viewer.loadLimit.maxUncompressedBytes",
|
|
45730
|
+
maxEntries: "pptx.viewer.loadLimit.maxEntries",
|
|
45731
|
+
maxSlides: "pptx.viewer.loadLimit.maxSlides",
|
|
45732
|
+
maxShapes: "pptx.viewer.loadLimit.maxShapes"
|
|
45733
|
+
});
|
|
45734
|
+
var BYTE_LIMITS = /* @__PURE__ */ new Set([
|
|
45735
|
+
"maxInputBytes",
|
|
45736
|
+
"maxUncompressedBytes"
|
|
45737
|
+
]);
|
|
45738
|
+
function formatLoadLimitBytes(bytes) {
|
|
45739
|
+
if (bytes < 1024) {
|
|
45740
|
+
return `${Math.round(bytes)} B`;
|
|
45741
|
+
}
|
|
45742
|
+
const kib = bytes / 1024;
|
|
45743
|
+
if (kib < 1024) {
|
|
45744
|
+
return `${Math.round(kib * 10) / 10} KB`;
|
|
45745
|
+
}
|
|
45746
|
+
return `${Math.round(kib / 1024 * 10) / 10} MB`;
|
|
45747
|
+
}
|
|
45748
|
+
function formatValue(limit, value) {
|
|
45749
|
+
return BYTE_LIMITS.has(limit) ? formatLoadLimitBytes(value) : String(Math.round(value));
|
|
45750
|
+
}
|
|
45751
|
+
function pptxLoadErrorMessage(error, t2) {
|
|
45752
|
+
const violation = pptx.getPptxLoadLimitViolation(error);
|
|
45753
|
+
if (violation) {
|
|
45754
|
+
const { limit, maximum } = violation;
|
|
45755
|
+
const actual = violation.actual ?? maximum + 1;
|
|
45756
|
+
return t2(LOAD_LIMIT_MESSAGE_KEYS[limit], {
|
|
45757
|
+
actual: formatValue(limit, actual),
|
|
45758
|
+
maximum: formatValue(limit, maximum)
|
|
45759
|
+
});
|
|
45760
|
+
}
|
|
45761
|
+
return error instanceof Error ? error.message : String(error);
|
|
45762
|
+
}
|
|
45375
45763
|
|
|
45376
45764
|
// src/pptx/render/custom-shows.ts
|
|
45377
45765
|
function generateCustomShowId() {
|
|
@@ -52075,7 +52463,7 @@ function commentMarkerTitle(comment, fallbackAuthor) {
|
|
|
52075
52463
|
}
|
|
52076
52464
|
function buildCommentMarkers(comments, canvasWidth, canvasHeight, fallbackAuthor) {
|
|
52077
52465
|
return comments.map((comment, index) => {
|
|
52078
|
-
const pos =
|
|
52466
|
+
const pos = chunk3CYWRMYZ_cjs.getCommentMarkerPosition(comment, index, canvasWidth, canvasHeight);
|
|
52079
52467
|
return {
|
|
52080
52468
|
commentId: comment.id,
|
|
52081
52469
|
label: String(index + 1),
|
|
@@ -62880,13 +63268,13 @@ function smartArtColorPatch(data, fillColors) {
|
|
|
62880
63268
|
|
|
62881
63269
|
// src/pptx/render/smartart-builtin-layouts.ts
|
|
62882
63270
|
var loaded;
|
|
62883
|
-
var
|
|
63271
|
+
var loading2;
|
|
62884
63272
|
function preloadSmartArtBuiltinLayouts() {
|
|
62885
|
-
|
|
63273
|
+
loading2 ??= import('ooxml-core/pptx/smartart-layouts').then(
|
|
62886
63274
|
(module) => loaded = module,
|
|
62887
63275
|
() => void 0
|
|
62888
63276
|
);
|
|
62889
|
-
return
|
|
63277
|
+
return loading2;
|
|
62890
63278
|
}
|
|
62891
63279
|
function smartArtBuiltinLayouts() {
|
|
62892
63280
|
if (!loaded) {
|
|
@@ -68272,14 +68660,14 @@ async function buildForeignObjectSvgBody(element, doc, options) {
|
|
|
68272
68660
|
backgroundColor,
|
|
68273
68661
|
readComputedStyle = (el) => window.getComputedStyle(el)
|
|
68274
68662
|
} = options;
|
|
68275
|
-
await
|
|
68663
|
+
await chunk67UQWOEQ_cjs.settleThreeViews(element);
|
|
68276
68664
|
const clone = element.cloneNode(true);
|
|
68277
|
-
|
|
68665
|
+
chunk67UQWOEQ_cjs.withAuthoredStrokeWidths(
|
|
68278
68666
|
element,
|
|
68279
68667
|
() => inlineComputedStylesOnClone(element, clone, readComputedStyle)
|
|
68280
68668
|
);
|
|
68281
|
-
|
|
68282
|
-
|
|
68669
|
+
chunk67UQWOEQ_cjs.snapshotThreeViewsIntoClone(element, clone);
|
|
68670
|
+
chunk67UQWOEQ_cjs.prepareExportClone(clone);
|
|
68283
68671
|
const [{ allEmbedded: imagesEmbedded }, externalFonts] = await Promise.all([
|
|
68284
68672
|
embedImagesOnClone(clone),
|
|
68285
68673
|
collectExternalFontFaceCss(doc, fetchAsDataUrl)
|
|
@@ -77502,13 +77890,13 @@ function chartSpaceFormatSource(space, options = {}) {
|
|
|
77502
77890
|
labelOptions: labels
|
|
77503
77891
|
};
|
|
77504
77892
|
}
|
|
77505
|
-
var chartFormatLocale = (value) => i18n.normalizeLocale(value,
|
|
77893
|
+
var chartFormatLocale = (value) => i18n.normalizeLocale(value, chunkPATUICO4_cjs.CHART_FORMAT_LOCALES, "en");
|
|
77506
77894
|
function chartFormatTranslator(locale, override) {
|
|
77507
|
-
const strings =
|
|
77895
|
+
const strings = chunkPATUICO4_cjs.CHART_FORMAT_STRINGS[chartFormatLocale(locale)];
|
|
77508
77896
|
return (key, params, fallback) => {
|
|
77509
77897
|
const own = override?.(key, params, fallback);
|
|
77510
77898
|
if (own && own !== key) return own;
|
|
77511
|
-
return strings[key] ??
|
|
77899
|
+
return strings[key] ?? chunkPATUICO4_cjs.CHART_FORMAT_STRINGS.en[key] ?? key;
|
|
77512
77900
|
};
|
|
77513
77901
|
}
|
|
77514
77902
|
|
|
@@ -82603,7 +82991,7 @@ function definePptxInsertSmartArtDialog(registry2) {
|
|
|
82603
82991
|
if (this.#live || this.#draw) {
|
|
82604
82992
|
return;
|
|
82605
82993
|
}
|
|
82606
|
-
this.#live = import('./smartart-insert-preview-
|
|
82994
|
+
this.#live = import('./smartart-insert-preview-DHQ47GXP.cjs').then((module) => {
|
|
82607
82995
|
if (this.#draw || !this.#picker) {
|
|
82608
82996
|
return;
|
|
82609
82997
|
}
|
|
@@ -88737,7 +89125,7 @@ function sanitizeSlideSvg(svg2, width, height) {
|
|
|
88737
89125
|
if (!isSafeSvgMarkup(svg2)) {
|
|
88738
89126
|
return "";
|
|
88739
89127
|
}
|
|
88740
|
-
const sanitized =
|
|
89128
|
+
const sanitized = chunk3CYWRMYZ_cjs.sanitizeMarkupOrEmpty(svg2, { USE_PROFILES: { svg: true } }).trim();
|
|
88741
89129
|
if (!sanitized || sanitized.toLowerCase().startsWith("<svg")) {
|
|
88742
89130
|
return sanitized;
|
|
88743
89131
|
}
|
|
@@ -89272,18 +89660,18 @@ function definedSettings(settings) {
|
|
|
89272
89660
|
}
|
|
89273
89661
|
function planPrintJob(settings, deck) {
|
|
89274
89662
|
const slideCount = deck.slides.length;
|
|
89275
|
-
const validated =
|
|
89663
|
+
const validated = chunk3CYWRMYZ_cjs.validatePrintSettings(definedSettings(settings), slideCount);
|
|
89276
89664
|
if (!PRINT_WHAT.includes(validated.printWhat) || !SLIDE_RANGES.includes(validated.slideRange)) {
|
|
89277
89665
|
return { ok: false, reason: "invalid-settings" };
|
|
89278
89666
|
}
|
|
89279
|
-
const inDeck =
|
|
89667
|
+
const inDeck = chunk3CYWRMYZ_cjs.computeSlideIndices(
|
|
89280
89668
|
validated.slideRange,
|
|
89281
89669
|
deck.activeSlideIndex,
|
|
89282
89670
|
slideCount,
|
|
89283
89671
|
validated.customRangeFrom,
|
|
89284
89672
|
validated.customRangeTo
|
|
89285
89673
|
).filter((index) => Number.isInteger(index) && index >= 0 && index < slideCount);
|
|
89286
|
-
const slideIndices =
|
|
89674
|
+
const slideIndices = chunk3CYWRMYZ_cjs.filterHiddenSlideIndices(
|
|
89287
89675
|
inDeck,
|
|
89288
89676
|
deck.slides,
|
|
89289
89677
|
deck.includeHiddenSlides ?? false
|
|
@@ -89325,12 +89713,12 @@ function frameSlideSvg(svg2, width, height) {
|
|
|
89325
89713
|
return `${svg2.slice(0, end)}${frame}${svg2.slice(end)}`;
|
|
89326
89714
|
}
|
|
89327
89715
|
function buildOutlinePrintJobDocument(plan, title, slides) {
|
|
89328
|
-
const outline =
|
|
89329
|
-
return
|
|
89716
|
+
const outline = chunk3CYWRMYZ_cjs.buildOutlineHtml([...plan.slideIndices], slides);
|
|
89717
|
+
return chunk3CYWRMYZ_cjs.buildPrintHtmlDocument({
|
|
89330
89718
|
title,
|
|
89331
89719
|
bodyHtml: `<div class="outline-page">${outline}</div>`,
|
|
89332
89720
|
orientation: plan.orientation,
|
|
89333
|
-
colorFilter:
|
|
89721
|
+
colorFilter: chunk3CYWRMYZ_cjs.computeColorFilter(plan.settings.colorMode),
|
|
89334
89722
|
frameSlides: plan.settings.frameSlides,
|
|
89335
89723
|
scaleToFit: plan.settings.scaleToFit ?? true
|
|
89336
89724
|
});
|
|
@@ -89340,24 +89728,24 @@ function buildVectorPrintJobDocument(plan, title, svgs, size2) {
|
|
|
89340
89728
|
return buildPrintDocument(pages, size2.width, size2.height, {
|
|
89341
89729
|
title,
|
|
89342
89730
|
orientation: plan.orientation,
|
|
89343
|
-
colorFilter:
|
|
89731
|
+
colorFilter: chunk3CYWRMYZ_cjs.computeColorFilter(plan.settings.colorMode),
|
|
89344
89732
|
scaleToFit: plan.settings.scaleToFit ?? true
|
|
89345
89733
|
});
|
|
89346
89734
|
}
|
|
89347
89735
|
function buildRasterPrintJobDocument(plan, title, captures, slides, handoutMaster) {
|
|
89348
89736
|
const images = captures.map((capture) => capture.dataUrl);
|
|
89349
89737
|
const indices = captures.map((capture) => capture.slideIndex);
|
|
89350
|
-
let bodyHtml =
|
|
89738
|
+
let bodyHtml = chunk3CYWRMYZ_cjs.buildSlidesHtml(images, indices);
|
|
89351
89739
|
if (plan.printWhat === "notes") {
|
|
89352
|
-
bodyHtml =
|
|
89740
|
+
bodyHtml = chunk3CYWRMYZ_cjs.buildNotesHtml(images, indices, slides);
|
|
89353
89741
|
} else if (plan.printWhat === "handouts") {
|
|
89354
|
-
bodyHtml =
|
|
89742
|
+
bodyHtml = chunk3CYWRMYZ_cjs.buildHandoutsHtml(images, indices, plan.settings.slidesPerPage, handoutMaster);
|
|
89355
89743
|
}
|
|
89356
|
-
return
|
|
89744
|
+
return chunk3CYWRMYZ_cjs.buildPrintHtmlDocument({
|
|
89357
89745
|
title,
|
|
89358
89746
|
bodyHtml,
|
|
89359
89747
|
orientation: plan.orientation,
|
|
89360
|
-
colorFilter:
|
|
89748
|
+
colorFilter: chunk3CYWRMYZ_cjs.computeColorFilter(plan.settings.colorMode),
|
|
89361
89749
|
frameSlides: plan.settings.frameSlides,
|
|
89362
89750
|
scaleToFit: plan.settings.scaleToFit ?? true
|
|
89363
89751
|
});
|
|
@@ -91674,6 +92062,7 @@ exports.LINK_TOOLTIP_HOST_CLASS = LINK_TOOLTIP_HOST_CLASS;
|
|
|
91674
92062
|
exports.LINK_TOOLTIP_LABEL_CLASS = LINK_TOOLTIP_LABEL_CLASS;
|
|
91675
92063
|
exports.LINK_TOOLTIP_PANEL_CLASS = LINK_TOOLTIP_PANEL_CLASS;
|
|
91676
92064
|
exports.LIVE_PATCH_THROTTLE_MS = LIVE_PATCH_THROTTLE_MS;
|
|
92065
|
+
exports.LOAD_LIMIT_MESSAGE_KEYS = LOAD_LIMIT_MESSAGE_KEYS;
|
|
91677
92066
|
exports.LONG_PRESS_DURATION_MS = LONG_PRESS_DURATION_MS;
|
|
91678
92067
|
exports.LONG_PRESS_MOVE_TOLERANCE_PX = LONG_PRESS_MOVE_TOLERANCE_PX;
|
|
91679
92068
|
exports.MARKER_SUPPORTED_TYPES = MARKER_SUPPORTED_TYPES;
|
|
@@ -92528,6 +92917,7 @@ exports.createDeckStyleHost = createDeckStyleHost;
|
|
|
92528
92917
|
exports.createDefaultChartElement = createDefaultChartElement;
|
|
92529
92918
|
exports.createDefaultChartUserShapeGroupChild = createDefaultChartUserShapeGroupChild;
|
|
92530
92919
|
exports.createEditorHistoryController = createEditorHistoryController;
|
|
92920
|
+
exports.createEmbeddedOutlineFontsSlot = createEmbeddedOutlineFontsSlot;
|
|
92531
92921
|
exports.createEnvelopeWarp = createEnvelopeWarp;
|
|
92532
92922
|
exports.createGalleryPreviewController = createGalleryPreviewController;
|
|
92533
92923
|
exports.createGestureController = createGestureController;
|
|
@@ -92776,6 +93166,7 @@ exports.formatCursorLabel = formatCursorLabel;
|
|
|
92776
93166
|
exports.formatEditPointsTarget = formatEditPointsTarget;
|
|
92777
93167
|
exports.formatElapsed = formatElapsed;
|
|
92778
93168
|
exports.formatIsoDate = formatIsoDate;
|
|
93169
|
+
exports.formatLoadLimitBytes = formatLoadLimitBytes;
|
|
92779
93170
|
exports.formatMediaTime = formatMediaTime;
|
|
92780
93171
|
exports.formatMobileElapsed = formatMobileElapsed;
|
|
92781
93172
|
exports.formatRelativeTime = formatRelativeTime;
|
|
@@ -93405,6 +93796,7 @@ exports.polygonRegionBounds = polygonRegionBounds;
|
|
|
93405
93796
|
exports.powerPointAccelDecelProgress = powerPointAccelDecelProgress;
|
|
93406
93797
|
exports.pptxChartFormatKey = pptxChartFormatKey;
|
|
93407
93798
|
exports.pptxChartFormatSource = pptxChartFormatSource;
|
|
93799
|
+
exports.pptxLoadErrorMessage = pptxLoadErrorMessage;
|
|
93408
93800
|
exports.pptxOptionsLabels = pptxOptionsLabels;
|
|
93409
93801
|
exports.prefersReducedMotion = prefersReducedMotion;
|
|
93410
93802
|
exports.prepareElementForInsertion = prepareElementForInsertion;
|