ooxml-ui 1.28.0 → 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-3d.d.ts +1 -0
- 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/comments/mentions.d.ts +63 -0
- package/dist/comments/mentions.d.ts.map +1 -0
- 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-WBFAVFD4.cjs → chunk-BXCXY4HB.cjs} +722 -279
- package/dist/pptx/{chunk-CT7UD6VL.mjs → chunk-DVLU476S.mjs} +688 -231
- 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-3AFB46RL.cjs → chunk-UTBHXIDK.cjs} +46 -46
- package/dist/pptx/{chunk-7OD74VJC.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 +3185 -3161
- package/dist/pptx/index.mjs +9 -9
- package/dist/pptx/render/comment-mentions.d.ts +16 -1
- package/dist/pptx/render/comment-mentions.d.ts.map +1 -1
- package/dist/pptx/render/comments-list.d.ts +11 -7
- package/dist/pptx/render/comments-list.d.ts.map +1 -1
- 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-3BY6HNZL.cjs → smartart-insert-preview-DHQ47GXP.cjs} +11 -11
- package/dist/pptx/{smartart-insert-preview-7CRBDPYF.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
|
}
|
|
@@ -6873,8 +6852,8 @@ function layoutEnvelopeBlock(paragraphs2, align2, getGlyphOutline) {
|
|
|
6873
6852
|
const char = chars[i];
|
|
6874
6853
|
const advance = advances[i] ?? 0;
|
|
6875
6854
|
const outline = WHITESPACE_RE.test(char) ? void 0 : getGlyphOutline?.(char, seg.font, x, baseline);
|
|
6876
|
-
const
|
|
6877
|
-
const ink = glyphInk(char, seg.font, x, baseline, advance,
|
|
6855
|
+
const usable2 = outline && outline.length > 0 ? outline : void 0;
|
|
6856
|
+
const ink = glyphInk(char, seg.font, x, baseline, advance, usable2);
|
|
6878
6857
|
if (ink) {
|
|
6879
6858
|
hasInk = true;
|
|
6880
6859
|
box.left = Math.min(box.left, ink.left);
|
|
@@ -6892,7 +6871,7 @@ function layoutEnvelopeBlock(paragraphs2, align2, getGlyphOutline) {
|
|
|
6892
6871
|
x,
|
|
6893
6872
|
baseline,
|
|
6894
6873
|
advance,
|
|
6895
|
-
outline:
|
|
6874
|
+
outline: usable2,
|
|
6896
6875
|
ink
|
|
6897
6876
|
});
|
|
6898
6877
|
x += advance;
|
|
@@ -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;
|
|
7573
|
+
}
|
|
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;
|
|
7499
7582
|
}
|
|
7500
|
-
|
|
7501
|
-
const
|
|
7502
|
-
|
|
7503
|
-
|
|
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
|
+
};
|
|
7621
|
+
}
|
|
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;
|
|
7511
7641
|
}
|
|
7512
|
-
function parseOpenTypeFont(buffer, module =
|
|
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
|
}
|
|
@@ -7878,9 +8230,9 @@ function computeTrendlinePoints(trendline, values, catCount, layout, range, mode
|
|
|
7878
8230
|
};
|
|
7879
8231
|
}
|
|
7880
8232
|
function valueToYLocal(val, range, topY, bottomY) {
|
|
7881
|
-
const
|
|
8233
|
+
const usable2 = bottomY - topY;
|
|
7882
8234
|
const ratio = (val - range.min) / range.span;
|
|
7883
|
-
return range.reverseOrder ? topY + ratio *
|
|
8235
|
+
return range.reverseOrder ? topY + ratio * usable2 : bottomY - ratio * usable2;
|
|
7884
8236
|
}
|
|
7885
8237
|
|
|
7886
8238
|
// src/pptx/render/chart-sparkline.ts
|
|
@@ -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() {
|
|
@@ -47917,9 +48305,9 @@ function deserializeElementClipboard(text4) {
|
|
|
47917
48305
|
try {
|
|
47918
48306
|
parsed = JSON.parse(text4, (_key, value) => {
|
|
47919
48307
|
if (typeof value === "object" && value !== null) {
|
|
47920
|
-
const
|
|
47921
|
-
if (typeof
|
|
47922
|
-
return base64ToUint8(
|
|
48308
|
+
const tagged2 = value[BINARY_TAG];
|
|
48309
|
+
if (typeof tagged2 === "string") {
|
|
48310
|
+
return base64ToUint8(tagged2);
|
|
47923
48311
|
}
|
|
47924
48312
|
}
|
|
47925
48313
|
return value;
|
|
@@ -51603,6 +51991,153 @@ function applyUniformCellPaddingPatch(el, padding) {
|
|
|
51603
51991
|
};
|
|
51604
51992
|
}
|
|
51605
51993
|
|
|
51994
|
+
// src/comments/mentions.ts
|
|
51995
|
+
var usable = (text4, mentions) => (mentions ?? []).filter(
|
|
51996
|
+
(m) => Number.isFinite(m.start) && Number.isFinite(m.length) && m.length > 0 && m.start >= 0 && m.start + m.length <= text4.length
|
|
51997
|
+
).sort((a, b) => a.start - b.start);
|
|
51998
|
+
function commentSegments(text4, mentions) {
|
|
51999
|
+
const body = String(text4 ?? "");
|
|
52000
|
+
const segments = [];
|
|
52001
|
+
let cursor = 0;
|
|
52002
|
+
for (const mention of usable(body, mentions)) {
|
|
52003
|
+
if (mention.start < cursor) continue;
|
|
52004
|
+
if (mention.start > cursor)
|
|
52005
|
+
segments.push({ kind: "text", text: body.slice(cursor, mention.start) });
|
|
52006
|
+
segments.push({
|
|
52007
|
+
kind: "mention",
|
|
52008
|
+
text: body.slice(mention.start, mention.start + mention.length),
|
|
52009
|
+
...mention.id !== void 0 ? { id: mention.id } : {},
|
|
52010
|
+
...mention.name !== void 0 ? { name: mention.name } : {}
|
|
52011
|
+
});
|
|
52012
|
+
cursor = mention.start + mention.length;
|
|
52013
|
+
}
|
|
52014
|
+
if (cursor < body.length) segments.push({ kind: "text", text: body.slice(cursor) });
|
|
52015
|
+
return segments;
|
|
52016
|
+
}
|
|
52017
|
+
function mentionQueryAt(text4, caret) {
|
|
52018
|
+
const body = String(text4 ?? "");
|
|
52019
|
+
const end = Math.max(0, Math.min(caret, body.length));
|
|
52020
|
+
for (let index = end - 1; index >= 0; index -= 1) {
|
|
52021
|
+
const character = body[index];
|
|
52022
|
+
if (character === "@") {
|
|
52023
|
+
if (index > 0 && !/\s/u.test(body[index - 1])) return null;
|
|
52024
|
+
return { query: body.slice(index + 1, end).toLowerCase(), start: index };
|
|
52025
|
+
}
|
|
52026
|
+
if (/\s/u.test(character)) return null;
|
|
52027
|
+
}
|
|
52028
|
+
return null;
|
|
52029
|
+
}
|
|
52030
|
+
var score = (candidate, needle) => {
|
|
52031
|
+
if (!needle) return 1;
|
|
52032
|
+
const name = candidate.name.toLowerCase();
|
|
52033
|
+
if (name.startsWith(needle)) return 0;
|
|
52034
|
+
if (name.includes(needle) || (candidate.initials ?? "").toLowerCase().startsWith(needle))
|
|
52035
|
+
return 2;
|
|
52036
|
+
return -1;
|
|
52037
|
+
};
|
|
52038
|
+
function matchMentionCandidates(candidates, query, limit = 6) {
|
|
52039
|
+
const needle = String(query ?? "").trim().toLowerCase();
|
|
52040
|
+
return candidates.filter((candidate) => candidate.id && candidate.name).map((candidate) => ({ candidate, rank: score(candidate, needle) })).filter(({ rank }) => rank >= 0).sort((a, b) => a.rank - b.rank || a.candidate.name.localeCompare(b.candidate.name)).slice(0, limit).map(({ candidate }) => candidate);
|
|
52041
|
+
}
|
|
52042
|
+
function insertMention(text4, mentions, caret, candidate) {
|
|
52043
|
+
const body = String(text4 ?? "");
|
|
52044
|
+
const at = Math.max(0, Math.min(caret, body.length));
|
|
52045
|
+
const active2 = mentionQueryAt(body, at);
|
|
52046
|
+
const start = active2 ? active2.start : at;
|
|
52047
|
+
const end = at;
|
|
52048
|
+
const label3 = `@${candidate.name}`;
|
|
52049
|
+
const delta = label3.length + 1 - (end - start);
|
|
52050
|
+
const next = (mentions ?? []).filter((m) => m.start >= end || m.start + m.length <= start).map((m) => m.start >= end ? { ...m, start: m.start + delta } : m);
|
|
52051
|
+
next.push({ start, length: label3.length, id: candidate.id, name: candidate.name });
|
|
52052
|
+
next.sort((a, b) => a.start - b.start);
|
|
52053
|
+
return {
|
|
52054
|
+
text: `${body.slice(0, start)}${label3} ${body.slice(end)}`,
|
|
52055
|
+
mentions: next,
|
|
52056
|
+
caret: start + label3.length + 1
|
|
52057
|
+
};
|
|
52058
|
+
}
|
|
52059
|
+
function trimMentionText(text4, mentions) {
|
|
52060
|
+
const body = String(text4 ?? "");
|
|
52061
|
+
const trimmed = body.trim();
|
|
52062
|
+
const lead = trimmed ? body.length - body.trimStart().length : 0;
|
|
52063
|
+
return {
|
|
52064
|
+
text: trimmed,
|
|
52065
|
+
mentions: usable(body, mentions).filter((m) => m.start >= lead && m.start + m.length <= lead + trimmed.length).map((m) => ({ ...m, start: m.start - lead }))
|
|
52066
|
+
};
|
|
52067
|
+
}
|
|
52068
|
+
|
|
52069
|
+
// src/pptx/render/comment-mentions.ts
|
|
52070
|
+
var COMMENT_MENTION_ATTRIBUTE = "data-pptx-comment-mention";
|
|
52071
|
+
var COMMENT_MENTION_CLASS = "pptx-comment-mention";
|
|
52072
|
+
var toSpan = (mention) => ({
|
|
52073
|
+
start: mention.startIndex,
|
|
52074
|
+
length: mention.length,
|
|
52075
|
+
...mention.personId !== void 0 ? { id: mention.personId } : {},
|
|
52076
|
+
...mention.authorName !== void 0 ? { name: mention.authorName } : {}
|
|
52077
|
+
});
|
|
52078
|
+
function commentTextSegments(text4, mentions) {
|
|
52079
|
+
return commentSegments(text4, mentions?.map(toSpan)).map((segment) => ({
|
|
52080
|
+
kind: segment.kind,
|
|
52081
|
+
text: segment.text,
|
|
52082
|
+
...segment.name !== void 0 ? { authorName: segment.name } : {},
|
|
52083
|
+
...segment.id !== void 0 ? { personId: segment.id } : {}
|
|
52084
|
+
}));
|
|
52085
|
+
}
|
|
52086
|
+
function hasCommentMentions(text4, mentions) {
|
|
52087
|
+
return commentTextSegments(text4, mentions).some((segment) => segment.kind === "mention");
|
|
52088
|
+
}
|
|
52089
|
+
function commentMentionQuery(text4, caret) {
|
|
52090
|
+
return mentionQueryAt(text4, caret);
|
|
52091
|
+
}
|
|
52092
|
+
function matchCommentMentionAuthors(authors, query, limit = 6) {
|
|
52093
|
+
return matchMentionCandidates(authors, query, limit);
|
|
52094
|
+
}
|
|
52095
|
+
function tagged(mentions) {
|
|
52096
|
+
return mentions.map((mention, index) => ({
|
|
52097
|
+
start: mention.startIndex,
|
|
52098
|
+
length: mention.length,
|
|
52099
|
+
id: String(index)
|
|
52100
|
+
}));
|
|
52101
|
+
}
|
|
52102
|
+
function untagged(spans, records) {
|
|
52103
|
+
return spans.map((span) => ({ ...records[Number(span.id)], startIndex: span.start }));
|
|
52104
|
+
}
|
|
52105
|
+
function trimCommentMentions(text4, mentions) {
|
|
52106
|
+
const records = mentions ?? [];
|
|
52107
|
+
const result = trimMentionText(text4, tagged(records));
|
|
52108
|
+
return { text: result.text, mentions: untagged(result.mentions, records) };
|
|
52109
|
+
}
|
|
52110
|
+
function followCommentEdit(before, after, mentions) {
|
|
52111
|
+
return pptx.rebaseCommentMentions(mentions ? [...mentions] : void 0, before, after) ?? [];
|
|
52112
|
+
}
|
|
52113
|
+
function defaultMentionId() {
|
|
52114
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
52115
|
+
return `{${crypto.randomUUID().toUpperCase()}}`;
|
|
52116
|
+
}
|
|
52117
|
+
const hex2 = (length) => Array.from(
|
|
52118
|
+
{ length },
|
|
52119
|
+
() => Math.floor(Math.random() * 16).toString(16).toUpperCase()
|
|
52120
|
+
).join("");
|
|
52121
|
+
return `{${hex2(8)}-${hex2(4)}-4${hex2(3)}-8${hex2(3)}-${hex2(12)}}`;
|
|
52122
|
+
}
|
|
52123
|
+
function insertCommentMention(text4, mentions, caret, author, generateId = defaultMentionId) {
|
|
52124
|
+
const existing = mentions ?? [];
|
|
52125
|
+
const result = insertMention(text4, tagged(existing), caret, { id: author.id, name: author.name });
|
|
52126
|
+
return {
|
|
52127
|
+
text: result.text,
|
|
52128
|
+
caret: result.caret,
|
|
52129
|
+
mentions: result.mentions.map(
|
|
52130
|
+
(span) => span.name === void 0 ? { ...existing[Number(span.id)], startIndex: span.start } : {
|
|
52131
|
+
id: generateId(),
|
|
52132
|
+
personId: author.id,
|
|
52133
|
+
authorName: author.name,
|
|
52134
|
+
startIndex: span.start,
|
|
52135
|
+
length: span.length
|
|
52136
|
+
}
|
|
52137
|
+
)
|
|
52138
|
+
};
|
|
52139
|
+
}
|
|
52140
|
+
|
|
51606
52141
|
// src/pptx/render/comments-list.ts
|
|
51607
52142
|
function generateCommentId() {
|
|
51608
52143
|
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
@@ -51611,14 +52146,18 @@ function generateCommentId() {
|
|
|
51611
52146
|
const rand = Math.random().toString(36).slice(2);
|
|
51612
52147
|
return `comment-${Date.now().toString(36)}-${rand}`;
|
|
51613
52148
|
}
|
|
51614
|
-
function
|
|
51615
|
-
const
|
|
51616
|
-
|
|
52149
|
+
function bodyWithMentions(text4, mentions) {
|
|
52150
|
+
const body = trimCommentMentions(text4, mentions);
|
|
52151
|
+
return body.mentions.length > 0 ? body : { text: body.text };
|
|
52152
|
+
}
|
|
52153
|
+
function addCommentToList(comments, text4, authorName, x, y, elementId, mentions) {
|
|
52154
|
+
const body = bodyWithMentions(text4, mentions);
|
|
52155
|
+
if (body.text.length === 0) {
|
|
51617
52156
|
return null;
|
|
51618
52157
|
}
|
|
51619
52158
|
const comment = {
|
|
51620
52159
|
id: generateCommentId(),
|
|
51621
|
-
|
|
52160
|
+
...body,
|
|
51622
52161
|
author: authorName,
|
|
51623
52162
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
51624
52163
|
resolved: false,
|
|
@@ -51670,20 +52209,22 @@ function removeCommentFromList(comments, id) {
|
|
|
51670
52209
|
const [next, changed] = filterCommentTree(comments, id);
|
|
51671
52210
|
return changed ? next : null;
|
|
51672
52211
|
}
|
|
51673
|
-
function editCommentInList(comments, id, text4) {
|
|
51674
|
-
const
|
|
52212
|
+
function editCommentInList(comments, id, text4, mentions) {
|
|
52213
|
+
const given = mentions ? bodyWithMentions(text4, mentions) : null;
|
|
52214
|
+
const trimmed = given ? given.text : text4.trim();
|
|
51675
52215
|
if (trimmed.length === 0) {
|
|
51676
52216
|
return null;
|
|
51677
52217
|
}
|
|
51678
|
-
const [next, changed] = mapCommentTree(comments, id, (comment) =>
|
|
51679
|
-
...comment
|
|
51680
|
-
|
|
51681
|
-
|
|
52218
|
+
const [next, changed] = mapCommentTree(comments, id, (comment) => {
|
|
52219
|
+
const { mentions: previous, ...rest } = comment;
|
|
52220
|
+
const kept = given ? given.mentions ?? [] : followCommentEdit(comment.text, trimmed, previous);
|
|
52221
|
+
return { ...rest, text: trimmed, ...kept.length > 0 ? { mentions: kept } : {} };
|
|
52222
|
+
});
|
|
51682
52223
|
return changed ? next : null;
|
|
51683
52224
|
}
|
|
51684
|
-
function replyToCommentInList(comments, parentId, text4, authorName) {
|
|
51685
|
-
const
|
|
51686
|
-
if (
|
|
52225
|
+
function replyToCommentInList(comments, parentId, text4, authorName, mentions) {
|
|
52226
|
+
const body = bodyWithMentions(text4, mentions);
|
|
52227
|
+
if (body.text.length === 0) {
|
|
51687
52228
|
return null;
|
|
51688
52229
|
}
|
|
51689
52230
|
const parent = comments.find((comment) => comment.id === parentId);
|
|
@@ -51692,7 +52233,7 @@ function replyToCommentInList(comments, parentId, text4, authorName) {
|
|
|
51692
52233
|
}
|
|
51693
52234
|
const reply = {
|
|
51694
52235
|
id: generateCommentId(),
|
|
51695
|
-
|
|
52236
|
+
...body,
|
|
51696
52237
|
author: authorName,
|
|
51697
52238
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
51698
52239
|
threadId: parentId,
|
|
@@ -51914,110 +52455,6 @@ function runReviewCommentCommand(id, host2, activeId) {
|
|
|
51914
52455
|
}
|
|
51915
52456
|
}
|
|
51916
52457
|
|
|
51917
|
-
// src/pptx/render/comment-mentions.ts
|
|
51918
|
-
var COMMENT_MENTION_ATTRIBUTE = "data-pptx-comment-mention";
|
|
51919
|
-
var COMMENT_MENTION_CLASS = "pptx-comment-mention";
|
|
51920
|
-
var usableMentions = (body, mentions) => (mentions ?? []).filter(
|
|
51921
|
-
(mention) => Number.isFinite(mention.startIndex) && Number.isFinite(mention.length) && mention.length > 0 && mention.startIndex >= 0 && mention.startIndex + mention.length <= body.length
|
|
51922
|
-
).sort((a, b) => a.startIndex - b.startIndex);
|
|
51923
|
-
function commentTextSegments(text4, mentions) {
|
|
51924
|
-
const body = String(text4 ?? "");
|
|
51925
|
-
if (body.length === 0) {
|
|
51926
|
-
return [];
|
|
51927
|
-
}
|
|
51928
|
-
const segments = [];
|
|
51929
|
-
let cursor = 0;
|
|
51930
|
-
for (const mention of usableMentions(body, mentions)) {
|
|
51931
|
-
if (mention.startIndex < cursor) {
|
|
51932
|
-
continue;
|
|
51933
|
-
}
|
|
51934
|
-
if (mention.startIndex > cursor) {
|
|
51935
|
-
segments.push({ kind: "text", text: body.slice(cursor, mention.startIndex) });
|
|
51936
|
-
}
|
|
51937
|
-
segments.push({
|
|
51938
|
-
kind: "mention",
|
|
51939
|
-
text: body.slice(mention.startIndex, mention.startIndex + mention.length),
|
|
51940
|
-
authorName: mention.authorName,
|
|
51941
|
-
personId: mention.personId
|
|
51942
|
-
});
|
|
51943
|
-
cursor = mention.startIndex + mention.length;
|
|
51944
|
-
}
|
|
51945
|
-
if (cursor < body.length) {
|
|
51946
|
-
segments.push({ kind: "text", text: body.slice(cursor) });
|
|
51947
|
-
}
|
|
51948
|
-
return segments;
|
|
51949
|
-
}
|
|
51950
|
-
function hasCommentMentions(text4, mentions) {
|
|
51951
|
-
return commentTextSegments(text4, mentions).some((segment) => segment.kind === "mention");
|
|
51952
|
-
}
|
|
51953
|
-
function commentMentionQuery(text4, caret) {
|
|
51954
|
-
const body = String(text4 ?? "");
|
|
51955
|
-
const position = Math.max(0, Math.min(caret, body.length));
|
|
51956
|
-
for (let index = position - 1; index >= 0; index -= 1) {
|
|
51957
|
-
const character = body[index];
|
|
51958
|
-
if (character === "@") {
|
|
51959
|
-
if (index > 0 && !/\s/u.test(body[index - 1])) {
|
|
51960
|
-
return null;
|
|
51961
|
-
}
|
|
51962
|
-
return { query: body.slice(index + 1, position).toLowerCase(), start: index };
|
|
51963
|
-
}
|
|
51964
|
-
if (/\s/u.test(character)) {
|
|
51965
|
-
return null;
|
|
51966
|
-
}
|
|
51967
|
-
}
|
|
51968
|
-
return null;
|
|
51969
|
-
}
|
|
51970
|
-
var mentionMatchScore = (author, needle) => {
|
|
51971
|
-
if (needle.length === 0) {
|
|
51972
|
-
return 1;
|
|
51973
|
-
}
|
|
51974
|
-
const name = author.name.toLowerCase();
|
|
51975
|
-
if (name.startsWith(needle)) {
|
|
51976
|
-
return 0;
|
|
51977
|
-
}
|
|
51978
|
-
if (name.includes(needle) || (author.initials || "").toLowerCase().startsWith(needle)) {
|
|
51979
|
-
return 2;
|
|
51980
|
-
}
|
|
51981
|
-
return -1;
|
|
51982
|
-
};
|
|
51983
|
-
function matchCommentMentionAuthors(authors, query, limit = 6) {
|
|
51984
|
-
const needle = String(query ?? "").trim().toLowerCase();
|
|
51985
|
-
const scored = authors.filter((author) => author.id && author.name).map((author) => ({ author, score: mentionMatchScore(author, needle) })).filter((entry6) => entry6.score >= 0);
|
|
51986
|
-
scored.sort((a, b) => a.score - b.score || a.author.name.localeCompare(b.author.name));
|
|
51987
|
-
return scored.slice(0, limit).map((entry6) => entry6.author);
|
|
51988
|
-
}
|
|
51989
|
-
function defaultMentionId() {
|
|
51990
|
-
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
51991
|
-
return `{${crypto.randomUUID().toUpperCase()}}`;
|
|
51992
|
-
}
|
|
51993
|
-
const hex2 = (length) => Array.from(
|
|
51994
|
-
{ length },
|
|
51995
|
-
() => Math.floor(Math.random() * 16).toString(16).toUpperCase()
|
|
51996
|
-
).join("");
|
|
51997
|
-
return `{${hex2(8)}-${hex2(4)}-4${hex2(3)}-8${hex2(3)}-${hex2(12)}}`;
|
|
51998
|
-
}
|
|
51999
|
-
function insertCommentMention(text4, mentions, caret, author, generateId = defaultMentionId) {
|
|
52000
|
-
const body = String(text4 ?? "");
|
|
52001
|
-
const active2 = commentMentionQuery(body, caret);
|
|
52002
|
-
const start = active2 ? active2.start : Math.max(0, Math.min(caret, body.length));
|
|
52003
|
-
const end = active2 ? active2.start + 1 + active2.query.length : start;
|
|
52004
|
-
const label3 = `@${author.name}`;
|
|
52005
|
-
const nextText = `${body.slice(0, start)}${label3} ${body.slice(end)}`;
|
|
52006
|
-
const delta = label3.length + 1 - (end - start);
|
|
52007
|
-
const shifted = (mentions ?? []).map(
|
|
52008
|
-
(mention) => mention.startIndex >= end ? { ...mention, startIndex: mention.startIndex + delta } : mention
|
|
52009
|
-
);
|
|
52010
|
-
shifted.push({
|
|
52011
|
-
id: generateId(),
|
|
52012
|
-
personId: author.id,
|
|
52013
|
-
authorName: author.name,
|
|
52014
|
-
startIndex: start,
|
|
52015
|
-
length: label3.length
|
|
52016
|
-
});
|
|
52017
|
-
shifted.sort((a, b) => a.startIndex - b.startIndex);
|
|
52018
|
-
return { text: nextText, mentions: shifted, caret: start + label3.length + 1 };
|
|
52019
|
-
}
|
|
52020
|
-
|
|
52021
52458
|
// src/pptx/render/comment-markers.ts
|
|
52022
52459
|
var COMMENT_MARKER_SIZE = 20;
|
|
52023
52460
|
var COMMENT_MARKER_COLOR = "rgba(255, 165, 0, 0.9)";
|
|
@@ -52026,7 +52463,7 @@ function commentMarkerTitle(comment, fallbackAuthor) {
|
|
|
52026
52463
|
}
|
|
52027
52464
|
function buildCommentMarkers(comments, canvasWidth, canvasHeight, fallbackAuthor) {
|
|
52028
52465
|
return comments.map((comment, index) => {
|
|
52029
|
-
const pos =
|
|
52466
|
+
const pos = chunk3CYWRMYZ_cjs.getCommentMarkerPosition(comment, index, canvasWidth, canvasHeight);
|
|
52030
52467
|
return {
|
|
52031
52468
|
commentId: comment.id,
|
|
52032
52469
|
label: String(index + 1),
|
|
@@ -55933,23 +56370,23 @@ function getPasswordStrength(password) {
|
|
|
55933
56370
|
if (!password) {
|
|
55934
56371
|
return 0;
|
|
55935
56372
|
}
|
|
55936
|
-
let
|
|
56373
|
+
let score2 = 0;
|
|
55937
56374
|
if (password.length >= 8) {
|
|
55938
|
-
|
|
56375
|
+
score2 += 1;
|
|
55939
56376
|
}
|
|
55940
56377
|
if (password.length >= 12) {
|
|
55941
|
-
|
|
56378
|
+
score2 += 1;
|
|
55942
56379
|
}
|
|
55943
56380
|
if (/[A-Z]/u.test(password) && /[a-z]/u.test(password)) {
|
|
55944
|
-
|
|
56381
|
+
score2 += 1;
|
|
55945
56382
|
}
|
|
55946
56383
|
if (/\d/u.test(password)) {
|
|
55947
|
-
|
|
56384
|
+
score2 += 1;
|
|
55948
56385
|
}
|
|
55949
56386
|
if (/[^A-Za-z0-9]/u.test(password)) {
|
|
55950
|
-
|
|
56387
|
+
score2 += 1;
|
|
55951
56388
|
}
|
|
55952
|
-
return Math.min(
|
|
56389
|
+
return Math.min(score2, 4);
|
|
55953
56390
|
}
|
|
55954
56391
|
function validatePasswordPair(password, confirmation) {
|
|
55955
56392
|
if (!password) {
|
|
@@ -62831,13 +63268,13 @@ function smartArtColorPatch(data, fillColors) {
|
|
|
62831
63268
|
|
|
62832
63269
|
// src/pptx/render/smartart-builtin-layouts.ts
|
|
62833
63270
|
var loaded;
|
|
62834
|
-
var
|
|
63271
|
+
var loading2;
|
|
62835
63272
|
function preloadSmartArtBuiltinLayouts() {
|
|
62836
|
-
|
|
63273
|
+
loading2 ??= import('ooxml-core/pptx/smartart-layouts').then(
|
|
62837
63274
|
(module) => loaded = module,
|
|
62838
63275
|
() => void 0
|
|
62839
63276
|
);
|
|
62840
|
-
return
|
|
63277
|
+
return loading2;
|
|
62841
63278
|
}
|
|
62842
63279
|
function smartArtBuiltinLayouts() {
|
|
62843
63280
|
if (!loaded) {
|
|
@@ -68223,14 +68660,14 @@ async function buildForeignObjectSvgBody(element, doc, options) {
|
|
|
68223
68660
|
backgroundColor,
|
|
68224
68661
|
readComputedStyle = (el) => window.getComputedStyle(el)
|
|
68225
68662
|
} = options;
|
|
68226
|
-
await
|
|
68663
|
+
await chunk67UQWOEQ_cjs.settleThreeViews(element);
|
|
68227
68664
|
const clone = element.cloneNode(true);
|
|
68228
|
-
|
|
68665
|
+
chunk67UQWOEQ_cjs.withAuthoredStrokeWidths(
|
|
68229
68666
|
element,
|
|
68230
68667
|
() => inlineComputedStylesOnClone(element, clone, readComputedStyle)
|
|
68231
68668
|
);
|
|
68232
|
-
|
|
68233
|
-
|
|
68669
|
+
chunk67UQWOEQ_cjs.snapshotThreeViewsIntoClone(element, clone);
|
|
68670
|
+
chunk67UQWOEQ_cjs.prepareExportClone(clone);
|
|
68234
68671
|
const [{ allEmbedded: imagesEmbedded }, externalFonts] = await Promise.all([
|
|
68235
68672
|
embedImagesOnClone(clone),
|
|
68236
68673
|
collectExternalFontFaceCss(doc, fetchAsDataUrl)
|
|
@@ -77453,13 +77890,13 @@ function chartSpaceFormatSource(space, options = {}) {
|
|
|
77453
77890
|
labelOptions: labels
|
|
77454
77891
|
};
|
|
77455
77892
|
}
|
|
77456
|
-
var chartFormatLocale = (value) => i18n.normalizeLocale(value,
|
|
77893
|
+
var chartFormatLocale = (value) => i18n.normalizeLocale(value, chunkPATUICO4_cjs.CHART_FORMAT_LOCALES, "en");
|
|
77457
77894
|
function chartFormatTranslator(locale, override) {
|
|
77458
|
-
const strings =
|
|
77895
|
+
const strings = chunkPATUICO4_cjs.CHART_FORMAT_STRINGS[chartFormatLocale(locale)];
|
|
77459
77896
|
return (key, params, fallback) => {
|
|
77460
77897
|
const own = override?.(key, params, fallback);
|
|
77461
77898
|
if (own && own !== key) return own;
|
|
77462
|
-
return strings[key] ??
|
|
77899
|
+
return strings[key] ?? chunkPATUICO4_cjs.CHART_FORMAT_STRINGS.en[key] ?? key;
|
|
77463
77900
|
};
|
|
77464
77901
|
}
|
|
77465
77902
|
|
|
@@ -79561,11 +79998,11 @@ function nextSelectActive(choices3, active2, step2) {
|
|
|
79561
79998
|
}
|
|
79562
79999
|
var SELECT_PAGE_SIZE = 8;
|
|
79563
80000
|
function pageSelectActive(choices3, active2, direction) {
|
|
79564
|
-
const
|
|
80001
|
+
const usable2 = (index) => !choices3[index]?.disabled && !choices3[index]?.hidden;
|
|
79565
80002
|
const last = choices3.length - 1;
|
|
79566
80003
|
const target = Math.max(0, Math.min(last, Math.max(active2, 0) + direction * SELECT_PAGE_SIZE));
|
|
79567
80004
|
for (let index = target; index >= 0 && index <= last; index -= direction)
|
|
79568
|
-
if (
|
|
80005
|
+
if (usable2(index)) return index;
|
|
79569
80006
|
return active2;
|
|
79570
80007
|
}
|
|
79571
80008
|
|
|
@@ -82554,7 +82991,7 @@ function definePptxInsertSmartArtDialog(registry2) {
|
|
|
82554
82991
|
if (this.#live || this.#draw) {
|
|
82555
82992
|
return;
|
|
82556
82993
|
}
|
|
82557
|
-
this.#live = import('./smartart-insert-preview-
|
|
82994
|
+
this.#live = import('./smartart-insert-preview-DHQ47GXP.cjs').then((module) => {
|
|
82558
82995
|
if (this.#draw || !this.#picker) {
|
|
82559
82996
|
return;
|
|
82560
82997
|
}
|
|
@@ -88688,7 +89125,7 @@ function sanitizeSlideSvg(svg2, width, height) {
|
|
|
88688
89125
|
if (!isSafeSvgMarkup(svg2)) {
|
|
88689
89126
|
return "";
|
|
88690
89127
|
}
|
|
88691
|
-
const sanitized =
|
|
89128
|
+
const sanitized = chunk3CYWRMYZ_cjs.sanitizeMarkupOrEmpty(svg2, { USE_PROFILES: { svg: true } }).trim();
|
|
88692
89129
|
if (!sanitized || sanitized.toLowerCase().startsWith("<svg")) {
|
|
88693
89130
|
return sanitized;
|
|
88694
89131
|
}
|
|
@@ -89223,18 +89660,18 @@ function definedSettings(settings) {
|
|
|
89223
89660
|
}
|
|
89224
89661
|
function planPrintJob(settings, deck) {
|
|
89225
89662
|
const slideCount = deck.slides.length;
|
|
89226
|
-
const validated =
|
|
89663
|
+
const validated = chunk3CYWRMYZ_cjs.validatePrintSettings(definedSettings(settings), slideCount);
|
|
89227
89664
|
if (!PRINT_WHAT.includes(validated.printWhat) || !SLIDE_RANGES.includes(validated.slideRange)) {
|
|
89228
89665
|
return { ok: false, reason: "invalid-settings" };
|
|
89229
89666
|
}
|
|
89230
|
-
const inDeck =
|
|
89667
|
+
const inDeck = chunk3CYWRMYZ_cjs.computeSlideIndices(
|
|
89231
89668
|
validated.slideRange,
|
|
89232
89669
|
deck.activeSlideIndex,
|
|
89233
89670
|
slideCount,
|
|
89234
89671
|
validated.customRangeFrom,
|
|
89235
89672
|
validated.customRangeTo
|
|
89236
89673
|
).filter((index) => Number.isInteger(index) && index >= 0 && index < slideCount);
|
|
89237
|
-
const slideIndices =
|
|
89674
|
+
const slideIndices = chunk3CYWRMYZ_cjs.filterHiddenSlideIndices(
|
|
89238
89675
|
inDeck,
|
|
89239
89676
|
deck.slides,
|
|
89240
89677
|
deck.includeHiddenSlides ?? false
|
|
@@ -89276,12 +89713,12 @@ function frameSlideSvg(svg2, width, height) {
|
|
|
89276
89713
|
return `${svg2.slice(0, end)}${frame}${svg2.slice(end)}`;
|
|
89277
89714
|
}
|
|
89278
89715
|
function buildOutlinePrintJobDocument(plan, title, slides) {
|
|
89279
|
-
const outline =
|
|
89280
|
-
return
|
|
89716
|
+
const outline = chunk3CYWRMYZ_cjs.buildOutlineHtml([...plan.slideIndices], slides);
|
|
89717
|
+
return chunk3CYWRMYZ_cjs.buildPrintHtmlDocument({
|
|
89281
89718
|
title,
|
|
89282
89719
|
bodyHtml: `<div class="outline-page">${outline}</div>`,
|
|
89283
89720
|
orientation: plan.orientation,
|
|
89284
|
-
colorFilter:
|
|
89721
|
+
colorFilter: chunk3CYWRMYZ_cjs.computeColorFilter(plan.settings.colorMode),
|
|
89285
89722
|
frameSlides: plan.settings.frameSlides,
|
|
89286
89723
|
scaleToFit: plan.settings.scaleToFit ?? true
|
|
89287
89724
|
});
|
|
@@ -89291,24 +89728,24 @@ function buildVectorPrintJobDocument(plan, title, svgs, size2) {
|
|
|
89291
89728
|
return buildPrintDocument(pages, size2.width, size2.height, {
|
|
89292
89729
|
title,
|
|
89293
89730
|
orientation: plan.orientation,
|
|
89294
|
-
colorFilter:
|
|
89731
|
+
colorFilter: chunk3CYWRMYZ_cjs.computeColorFilter(plan.settings.colorMode),
|
|
89295
89732
|
scaleToFit: plan.settings.scaleToFit ?? true
|
|
89296
89733
|
});
|
|
89297
89734
|
}
|
|
89298
89735
|
function buildRasterPrintJobDocument(plan, title, captures, slides, handoutMaster) {
|
|
89299
89736
|
const images = captures.map((capture) => capture.dataUrl);
|
|
89300
89737
|
const indices = captures.map((capture) => capture.slideIndex);
|
|
89301
|
-
let bodyHtml =
|
|
89738
|
+
let bodyHtml = chunk3CYWRMYZ_cjs.buildSlidesHtml(images, indices);
|
|
89302
89739
|
if (plan.printWhat === "notes") {
|
|
89303
|
-
bodyHtml =
|
|
89740
|
+
bodyHtml = chunk3CYWRMYZ_cjs.buildNotesHtml(images, indices, slides);
|
|
89304
89741
|
} else if (plan.printWhat === "handouts") {
|
|
89305
|
-
bodyHtml =
|
|
89742
|
+
bodyHtml = chunk3CYWRMYZ_cjs.buildHandoutsHtml(images, indices, plan.settings.slidesPerPage, handoutMaster);
|
|
89306
89743
|
}
|
|
89307
|
-
return
|
|
89744
|
+
return chunk3CYWRMYZ_cjs.buildPrintHtmlDocument({
|
|
89308
89745
|
title,
|
|
89309
89746
|
bodyHtml,
|
|
89310
89747
|
orientation: plan.orientation,
|
|
89311
|
-
colorFilter:
|
|
89748
|
+
colorFilter: chunk3CYWRMYZ_cjs.computeColorFilter(plan.settings.colorMode),
|
|
89312
89749
|
frameSlides: plan.settings.frameSlides,
|
|
89313
89750
|
scaleToFit: plan.settings.scaleToFit ?? true
|
|
89314
89751
|
});
|
|
@@ -91625,6 +92062,7 @@ exports.LINK_TOOLTIP_HOST_CLASS = LINK_TOOLTIP_HOST_CLASS;
|
|
|
91625
92062
|
exports.LINK_TOOLTIP_LABEL_CLASS = LINK_TOOLTIP_LABEL_CLASS;
|
|
91626
92063
|
exports.LINK_TOOLTIP_PANEL_CLASS = LINK_TOOLTIP_PANEL_CLASS;
|
|
91627
92064
|
exports.LIVE_PATCH_THROTTLE_MS = LIVE_PATCH_THROTTLE_MS;
|
|
92065
|
+
exports.LOAD_LIMIT_MESSAGE_KEYS = LOAD_LIMIT_MESSAGE_KEYS;
|
|
91628
92066
|
exports.LONG_PRESS_DURATION_MS = LONG_PRESS_DURATION_MS;
|
|
91629
92067
|
exports.LONG_PRESS_MOVE_TOLERANCE_PX = LONG_PRESS_MOVE_TOLERANCE_PX;
|
|
91630
92068
|
exports.MARKER_SUPPORTED_TYPES = MARKER_SUPPORTED_TYPES;
|
|
@@ -92479,6 +92917,7 @@ exports.createDeckStyleHost = createDeckStyleHost;
|
|
|
92479
92917
|
exports.createDefaultChartElement = createDefaultChartElement;
|
|
92480
92918
|
exports.createDefaultChartUserShapeGroupChild = createDefaultChartUserShapeGroupChild;
|
|
92481
92919
|
exports.createEditorHistoryController = createEditorHistoryController;
|
|
92920
|
+
exports.createEmbeddedOutlineFontsSlot = createEmbeddedOutlineFontsSlot;
|
|
92482
92921
|
exports.createEnvelopeWarp = createEnvelopeWarp;
|
|
92483
92922
|
exports.createGalleryPreviewController = createGalleryPreviewController;
|
|
92484
92923
|
exports.createGestureController = createGestureController;
|
|
@@ -92706,6 +93145,7 @@ exports.flattenOutline = flattenOutline;
|
|
|
92706
93145
|
exports.flattenSlideElements = flattenSlideElements;
|
|
92707
93146
|
exports.flattenTagCollections = flattenTagCollections;
|
|
92708
93147
|
exports.flattenViewerOptions = flattenViewerOptions;
|
|
93148
|
+
exports.followCommentEdit = followCommentEdit;
|
|
92709
93149
|
exports.followingText = followingText;
|
|
92710
93150
|
exports.fontAlignmentVerticalAlign = fontAlignmentVerticalAlign;
|
|
92711
93151
|
exports.fontFamilyItems = fontFamilyItems;
|
|
@@ -92726,6 +93166,7 @@ exports.formatCursorLabel = formatCursorLabel;
|
|
|
92726
93166
|
exports.formatEditPointsTarget = formatEditPointsTarget;
|
|
92727
93167
|
exports.formatElapsed = formatElapsed;
|
|
92728
93168
|
exports.formatIsoDate = formatIsoDate;
|
|
93169
|
+
exports.formatLoadLimitBytes = formatLoadLimitBytes;
|
|
92729
93170
|
exports.formatMediaTime = formatMediaTime;
|
|
92730
93171
|
exports.formatMobileElapsed = formatMobileElapsed;
|
|
92731
93172
|
exports.formatRelativeTime = formatRelativeTime;
|
|
@@ -93355,6 +93796,7 @@ exports.polygonRegionBounds = polygonRegionBounds;
|
|
|
93355
93796
|
exports.powerPointAccelDecelProgress = powerPointAccelDecelProgress;
|
|
93356
93797
|
exports.pptxChartFormatKey = pptxChartFormatKey;
|
|
93357
93798
|
exports.pptxChartFormatSource = pptxChartFormatSource;
|
|
93799
|
+
exports.pptxLoadErrorMessage = pptxLoadErrorMessage;
|
|
93358
93800
|
exports.pptxOptionsLabels = pptxOptionsLabels;
|
|
93359
93801
|
exports.prefersReducedMotion = prefersReducedMotion;
|
|
93360
93802
|
exports.prepareElementForInsertion = prepareElementForInsertion;
|
|
@@ -93956,6 +94398,7 @@ exports.transitionsLabel = transitionsLabel;
|
|
|
93956
94398
|
exports.translateChartFormatText = translateChartFormatText2;
|
|
93957
94399
|
exports.translateMotionPath = translateMotionPath;
|
|
93958
94400
|
exports.travelledBox = travelledBox;
|
|
94401
|
+
exports.trimCommentMentions = trimCommentMentions;
|
|
93959
94402
|
exports.trimmedMediaDurationMs = trimmedMediaDurationMs;
|
|
93960
94403
|
exports.updateGlowPatch = updateGlowPatch;
|
|
93961
94404
|
exports.updateGradientStopPatch = updateGradientStopPatch;
|