@web-ppt/edit-core 0.5.0-beta.1 → 0.5.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/README.md +1 -1
- package/dist/collaboration-identity.d.ts +3 -0
- package/dist/commands/add-slide-identity.d.ts +2 -0
- package/dist/commands/convert-to-custom-geometry.d.ts +4 -0
- package/dist/commands/element-geometry.d.ts +6 -0
- package/dist/commands/element-hierarchy.d.ts +6 -0
- package/dist/commands/element-table-style.d.ts +5 -0
- package/dist/commands/frame-decomposition.d.ts +10 -0
- package/dist/commands/generated-creation-defaults.d.ts +4 -0
- package/dist/commands/geometry-types.d.ts +22 -0
- package/dist/commands/group-types.d.ts +24 -0
- package/dist/commands/group.d.ts +4 -0
- package/dist/commands/insertion-host.d.ts +3 -0
- package/dist/commands/insertion-rect.d.ts +2 -0
- package/dist/commands/patch-invalidation.d.ts +4 -0
- package/dist/commands/patch.d.ts +4 -0
- package/dist/commands/record-clone.d.ts +3 -0
- package/dist/commands/set-geometry.d.ts +4 -0
- package/dist/commands/set-table-style.d.ts +3 -0
- package/dist/commands/spid.d.ts +1 -0
- package/dist/commands/table-style-types.d.ts +28 -0
- package/dist/commands/text-target.d.ts +1 -0
- package/dist/commands/types.d.ts +29 -4
- package/dist/commands/ungroup.d.ts +4 -0
- package/dist/custom-geometry-path.d.ts +3 -0
- package/dist/custom-geometry.d.ts +12 -0
- package/dist/document-B1jjN-QB.js +274 -0
- package/dist/edit-core.js +3597 -2639
- package/dist/editor.d.ts +6 -1
- package/dist/generate/custom-geometry.d.ts +2 -0
- package/dist/generate/index.d.ts +12 -0
- package/dist/generate/links.d.ts +3 -0
- package/dist/generate/materialize.d.ts +2 -0
- package/dist/generate/media.d.ts +13 -0
- package/dist/generate/table.d.ts +4 -0
- package/dist/generate/template.d.ts +3 -0
- package/dist/generate.js +744 -0
- package/dist/hyperlink.d.ts +2 -0
- package/dist/identity-allocation.d.ts +12 -0
- package/dist/identity-watermark.d.ts +4 -0
- package/dist/image-resource-DbgJS9n-.js +24 -0
- package/dist/{index-D4ZTaYOa.js → index-D2JizcOQ.js} +7 -7
- package/dist/index.d.ts +11 -3
- package/dist/insertion-CGpb504L.js +6152 -0
- package/dist/layout-projection.d.ts +2 -0
- package/dist/opc/patch.d.ts +2 -0
- package/dist/opc.js +1 -1
- package/dist/paragraph-level.d.ts +11 -0
- package/dist/paragraph-property-schema.d.ts +1 -1
- package/dist/{patch-DO8497wO.js → patch-D7lZelRa.js} +111 -94
- package/dist/patch-change.d.ts +4 -0
- package/dist/patch-events.d.ts +12 -0
- package/dist/recovery-identity.d.ts +2 -1
- package/dist/run-property-schema.d.ts +1 -1
- package/dist/save/geometry.d.ts +5 -0
- package/dist/save/insertion.d.ts +3 -0
- package/dist/save/notes.d.ts +2 -0
- package/dist/save/run-overrides.d.ts +10 -0
- package/dist/save/shape-format.d.ts +3 -0
- package/dist/save/table-style-part.d.ts +11 -0
- package/dist/save/table.d.ts +3 -0
- package/dist/save/text-source-less.d.ts +6 -0
- package/dist/save.js +468 -1441
- package/dist/table-direct-markup.d.ts +7 -1
- package/dist/table-style-part-DBtpxmuo.js +1042 -0
- package/dist/table-style.d.ts +20 -0
- package/dist/text-model.d.ts +1 -1
- package/dist/types.d.ts +44 -1
- package/dist/xml.js +1 -1
- package/package.json +6 -2
- package/dist/insertion-DabLme_U.js +0 -5471
package/dist/save.js
CHANGED
|
@@ -1,104 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { p as
|
|
3
|
-
import { p as
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (!v.some((b) => !b.targetMode && ie(i, b.target) === m.targetPart)) continue;
|
|
13
|
-
const y = n.get(m.targetPart);
|
|
14
|
-
if (y && (y.hash !== m.hash || y.bytes !== m.bytes))
|
|
15
|
-
throw new Error(`多个媒体资源争用目标 part:${m.targetPart}`);
|
|
16
|
-
n.set(m.targetPart, m);
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
for (const i of Object.values(e.elements)) {
|
|
20
|
-
const c = (r = i.meta.origin) == null ? void 0 : r.part;
|
|
21
|
-
if (!c) continue;
|
|
22
|
-
const f = i.meta.imageReplacement, v = [i.meta.insertion, f ? {
|
|
23
|
-
relationships: f.relationships,
|
|
24
|
-
resources: [e.imageResources[f.resourceHash]]
|
|
25
|
-
} : void 0];
|
|
26
|
-
for (const p of v)
|
|
27
|
-
p && o(c, p, (a = i.meta.imageReplacement) == null ? void 0 : a.suppressedRelationshipId);
|
|
28
|
-
}
|
|
29
|
-
for (const i of Object.values(e.slides)) {
|
|
30
|
-
const c = (s = i.origin) == null ? void 0 : s.part, f = i.backgroundImage;
|
|
31
|
-
if (!c || !f) continue;
|
|
32
|
-
const v = f.resourceHashes.map((p) => e.imageResources[p]);
|
|
33
|
-
if (v.some((p) => !p))
|
|
34
|
-
throw new Error(`幻灯片 ${i.id} 的图片背景资源不存在`);
|
|
35
|
-
o(c, { relationships: f.relationships, resources: v });
|
|
36
|
-
}
|
|
37
|
-
return { relationships: t, resources: n };
|
|
38
|
-
}
|
|
39
|
-
function z(e, t) {
|
|
40
|
-
const n = e ? x(e) : x(`<Relationships xmlns="${rn}"/>`), o = new Map(h(n.root, { localName: "Relationship" }).flatMap((r) => {
|
|
41
|
-
var f, v, p, m;
|
|
42
|
-
const a = (f = M(r, { localName: "Id", namespaceUri: null })) == null ? void 0 : f.value, s = (v = M(r, { localName: "Type", namespaceUri: null })) == null ? void 0 : v.value, i = (p = M(r, { localName: "Target", namespaceUri: null })) == null ? void 0 : p.value, c = (m = M(r, { localName: "TargetMode", namespaceUri: null })) == null ? void 0 : m.value;
|
|
43
|
-
return a && s && i ? [[a, { type: s, target: i, mode: c }]] : [];
|
|
44
|
-
}));
|
|
45
|
-
for (const r of t) {
|
|
46
|
-
const a = o.get(r.targetId);
|
|
47
|
-
if (a) {
|
|
48
|
-
if (a.type === r.type && a.target === r.target && a.mode === r.targetMode) continue;
|
|
49
|
-
throw new Error(`目标关系 id 冲突:${r.targetId}`);
|
|
50
|
-
}
|
|
51
|
-
o.set(r.targetId, {
|
|
52
|
-
type: r.type,
|
|
53
|
-
target: r.target,
|
|
54
|
-
mode: r.targetMode
|
|
55
|
-
}), w(n.root, B("Relationship", {
|
|
56
|
-
attributes: [
|
|
57
|
-
["Id", r.targetId],
|
|
58
|
-
["Type", r.type],
|
|
59
|
-
["Target", r.target],
|
|
60
|
-
...r.targetMode ? [["TargetMode", r.targetMode]] : []
|
|
61
|
-
]
|
|
62
|
-
}));
|
|
63
|
-
}
|
|
64
|
-
return X(n);
|
|
65
|
-
}
|
|
66
|
-
function sn(e, t) {
|
|
67
|
-
var a, s;
|
|
68
|
-
const n = e ? x(e) : x(`<Types xmlns="${on}"/>`), o = h(n.root, { localName: "Default" }), r = h(n.root, { localName: "Override" });
|
|
69
|
-
for (const i of t) {
|
|
70
|
-
const c = o.find((u) => {
|
|
71
|
-
var y;
|
|
72
|
-
return ((y = M(u, { localName: "Extension", namespaceUri: null })) == null ? void 0 : y.value.toLowerCase()) === i.extension.toLowerCase();
|
|
73
|
-
});
|
|
74
|
-
if ((c && ((a = M(c, { localName: "ContentType", namespaceUri: null })) == null ? void 0 : a.value)) === i.mime) continue;
|
|
75
|
-
const v = `/${i.targetPart}`, p = r.find((u) => {
|
|
76
|
-
var y;
|
|
77
|
-
return ((y = M(u, { localName: "PartName", namespaceUri: null })) == null ? void 0 : y.value) === v;
|
|
78
|
-
});
|
|
79
|
-
if (p) {
|
|
80
|
-
if (((s = M(p, {
|
|
81
|
-
localName: "ContentType",
|
|
82
|
-
namespaceUri: null
|
|
83
|
-
})) == null ? void 0 : s.value) !== i.mime)
|
|
84
|
-
throw new Error(`媒体资源与既有 Content-Type Override 冲突:${i.targetPart}`);
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
const m = B(c ? "Override" : "Default", {
|
|
88
|
-
attributes: c ? [["PartName", v], ["ContentType", i.mime]] : [["Extension", i.extension], ["ContentType", i.mime]]
|
|
89
|
-
});
|
|
90
|
-
w(n.root, m), c ? r.push(m) : o.push(m);
|
|
91
|
-
}
|
|
92
|
-
return X(n);
|
|
93
|
-
}
|
|
94
|
-
function cn(e) {
|
|
95
|
-
return Tt(e.bytes);
|
|
96
|
-
}
|
|
97
|
-
const ln = "application/vnd.openxmlformats-officedocument.presentationml.slide+xml", fn = "application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml", Ke = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide", Je = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout";
|
|
98
|
-
function Ee(e) {
|
|
99
|
-
return e.slideOrder.map((t) => e.slides[t]).filter((t) => !!t.creation);
|
|
100
|
-
}
|
|
101
|
-
function pn() {
|
|
1
|
+
import { c as Xe } from "./document-B1jjN-QB.js";
|
|
2
|
+
import { g as Z, j as Oe, n as G, k as oe, l as x, m as $e, o as je, p as ye, q as Ae, t as De, u as Be, w as Ee, x as _e, y as ze, z as Ge, A as Fe, B as He, C as We, D as Ie, E as Ye, F as qe, G as Je, H as Ke, I as Ve, J as Qe, K as Ze, L as et, M as tt, N as rt, O as st, h as nt } from "./insertion-CGpb504L.js";
|
|
3
|
+
import { p as at } from "./patch-D7lZelRa.js";
|
|
4
|
+
import { p as E, x as k, s as X, r as ot, a as D, f as C, b as B, i as A, c as Se, d as H, e as be, D as R, g as it, P as O, h as lt, j, k as ve, l as ct } from "./index-D2JizcOQ.js";
|
|
5
|
+
import { p as F, m as pt, t as ft, a as dt, r as ut, b as mt, c as ke, d as ht, e as gt, f as Pt, g as yt, h as St, i as vt, j as kt } from "./table-style-part-DBtpxmuo.js";
|
|
6
|
+
import { PLACEHOLDER_DIRECT_BITS as L, findPlaceholderByIdentity as wt } from "@web-ppt/core";
|
|
7
|
+
const Nt = "application/vnd.openxmlformats-officedocument.presentationml.slide+xml", Tt = "application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml", we = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide", Ne = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout";
|
|
8
|
+
function te(e) {
|
|
9
|
+
return e.slideOrder.map((s) => e.slides[s]).filter((s) => !!s.creation);
|
|
10
|
+
}
|
|
11
|
+
function xt() {
|
|
102
12
|
return new TextEncoder().encode(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
103
13
|
<p:sld xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">
|
|
104
14
|
<p:cSld><p:spTree>
|
|
@@ -107,1453 +17,570 @@ function pn() {
|
|
|
107
17
|
</p:spTree></p:cSld><p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>
|
|
108
18
|
</p:sld>`);
|
|
109
19
|
}
|
|
110
|
-
function
|
|
20
|
+
function Ot(e, s) {
|
|
111
21
|
if (!e.creation || !e.origin) throw new Error(`页面 ${e.id} 不是可物化的新页`);
|
|
112
|
-
return
|
|
22
|
+
return Me(e, s);
|
|
113
23
|
}
|
|
114
|
-
function
|
|
115
|
-
const
|
|
116
|
-
for (let
|
|
24
|
+
function Te(e) {
|
|
25
|
+
const s = new Set(e ? k(E(e).root, { localName: "Relationship" }).flatMap((r) => w(r, "Id") ?? []) : []);
|
|
26
|
+
for (let r = 1; ; r++) if (!s.has(`rId${r}`)) return `rId${r}`;
|
|
117
27
|
}
|
|
118
|
-
function
|
|
119
|
-
var
|
|
28
|
+
function Me(e, s) {
|
|
29
|
+
var c, p;
|
|
120
30
|
if (!e.origin || !e.layoutId) throw new Error(`页面 ${e.id} 缺少版式写回身份`);
|
|
121
|
-
if (!
|
|
122
|
-
const
|
|
123
|
-
return
|
|
124
|
-
sourceId:
|
|
125
|
-
targetId:
|
|
126
|
-
type:
|
|
127
|
-
target:
|
|
31
|
+
if (!s) {
|
|
32
|
+
const f = ((c = e.creation) == null ? void 0 : c.layoutRelationshipId) ?? Te();
|
|
33
|
+
return F(void 0, [{
|
|
34
|
+
sourceId: f,
|
|
35
|
+
targetId: f,
|
|
36
|
+
type: Ne,
|
|
37
|
+
target: Z(e.origin.part, e.layoutId)
|
|
128
38
|
}]);
|
|
129
39
|
}
|
|
130
|
-
const
|
|
131
|
-
var
|
|
132
|
-
return ((
|
|
40
|
+
const r = E(s), n = k(r.root, { localName: "Relationship" }).find((f) => {
|
|
41
|
+
var m;
|
|
42
|
+
return ((m = w(f, "Type")) == null ? void 0 : m.endsWith("/slideLayout")) && w(f, "TargetMode") !== "External" && (e.creation === void 0 || w(f, "Id") === e.creation.layoutRelationshipId);
|
|
133
43
|
});
|
|
134
|
-
if (!
|
|
135
|
-
const
|
|
136
|
-
return
|
|
137
|
-
sourceId:
|
|
138
|
-
targetId:
|
|
139
|
-
type:
|
|
140
|
-
target:
|
|
44
|
+
if (!n) {
|
|
45
|
+
const f = ((p = e.creation) == null ? void 0 : p.layoutRelationshipId) ?? Te(s);
|
|
46
|
+
return F(s, [{
|
|
47
|
+
sourceId: f,
|
|
48
|
+
targetId: f,
|
|
49
|
+
type: Ne,
|
|
50
|
+
target: Z(e.origin.part, e.layoutId)
|
|
141
51
|
}]);
|
|
142
52
|
}
|
|
143
|
-
const
|
|
144
|
-
return
|
|
145
|
-
}
|
|
146
|
-
function
|
|
147
|
-
const
|
|
148
|
-
let
|
|
149
|
-
const
|
|
150
|
-
var
|
|
151
|
-
for (const
|
|
152
|
-
if (
|
|
153
|
-
const
|
|
154
|
-
if (
|
|
155
|
-
for (const
|
|
156
|
-
|
|
53
|
+
const i = Z(e.origin.part, e.layoutId);
|
|
54
|
+
return w(n, "Target") === i && w(n, "TargetMode") === void 0 ? s : (X(n, "Target", i), ot(n, "TargetMode"), D(r));
|
|
55
|
+
}
|
|
56
|
+
function Et(e, s) {
|
|
57
|
+
const r = E(e), o = String(s);
|
|
58
|
+
let n = !1;
|
|
59
|
+
const i = (c) => {
|
|
60
|
+
var p, f;
|
|
61
|
+
for (const m of k(c)) {
|
|
62
|
+
if (m.namespaceUri === R && m.localName === "fld" && ((p = w(m, "type")) == null ? void 0 : p.toLowerCase()) === "slidenum") {
|
|
63
|
+
const N = H(m, { localName: "t", namespaceUri: R });
|
|
64
|
+
if (N && !(N.children.length === 1 && ((f = N.children[0]) == null ? void 0 : f.type) === "text" && N.children[0].value === o)) {
|
|
65
|
+
for (const l of [...N.children]) B(N, l);
|
|
66
|
+
A(N, it(o)), n = !0;
|
|
157
67
|
}
|
|
158
68
|
}
|
|
159
|
-
|
|
69
|
+
i(m);
|
|
160
70
|
}
|
|
161
71
|
};
|
|
162
|
-
return
|
|
72
|
+
return i(r.root), n ? D(r) : e;
|
|
163
73
|
}
|
|
164
|
-
function
|
|
165
|
-
var
|
|
166
|
-
const
|
|
167
|
-
for (const
|
|
168
|
-
const
|
|
169
|
-
|
|
74
|
+
function It(e) {
|
|
75
|
+
var r, o, n;
|
|
76
|
+
const s = /* @__PURE__ */ new Map();
|
|
77
|
+
for (const i of k(E(e).root, { localName: "Relationship" })) {
|
|
78
|
+
const c = (r = C(i, { localName: "Id", namespaceUri: null })) == null ? void 0 : r.value, p = (o = C(i, { localName: "Target", namespaceUri: null })) == null ? void 0 : o.value, f = (n = C(i, { localName: "TargetMode", namespaceUri: null })) == null ? void 0 : n.value;
|
|
79
|
+
c && p && f !== "External" && s.set(c, oe("ppt/presentation.xml", p));
|
|
170
80
|
}
|
|
171
|
-
return
|
|
81
|
+
return s;
|
|
172
82
|
}
|
|
173
|
-
function
|
|
174
|
-
var
|
|
175
|
-
return (
|
|
83
|
+
function w(e, s) {
|
|
84
|
+
var r;
|
|
85
|
+
return (r = C(e, { localName: s, namespaceUri: null })) == null ? void 0 : r.value;
|
|
176
86
|
}
|
|
177
|
-
function
|
|
178
|
-
const
|
|
179
|
-
|
|
87
|
+
function Re(e, s, r, o) {
|
|
88
|
+
const n = k(e).find((i) => i.localName !== r || i.namespaceUri !== o) ?? null;
|
|
89
|
+
A(e, s, n);
|
|
180
90
|
}
|
|
181
|
-
function
|
|
182
|
-
const
|
|
91
|
+
function bt(e, s, r, o) {
|
|
92
|
+
const n = lt(e, {
|
|
183
93
|
localName: "sectionLst",
|
|
184
|
-
namespaceUri:
|
|
94
|
+
namespaceUri: j
|
|
185
95
|
});
|
|
186
|
-
if (
|
|
187
|
-
for (const
|
|
96
|
+
if (n)
|
|
97
|
+
for (const i of k(n, {
|
|
188
98
|
localName: "section",
|
|
189
|
-
namespaceUri:
|
|
99
|
+
namespaceUri: j
|
|
190
100
|
})) {
|
|
191
|
-
const
|
|
101
|
+
const c = H(i, {
|
|
192
102
|
localName: "sldIdLst",
|
|
193
|
-
namespaceUri:
|
|
103
|
+
namespaceUri: j
|
|
194
104
|
});
|
|
195
|
-
if (!
|
|
196
|
-
const
|
|
105
|
+
if (!c) continue;
|
|
106
|
+
const p = k(c, {
|
|
197
107
|
localName: "sldId",
|
|
198
|
-
namespaceUri:
|
|
199
|
-
}),
|
|
200
|
-
const
|
|
201
|
-
return
|
|
108
|
+
namespaceUri: j
|
|
109
|
+
}), f = new Set(p.flatMap((d) => {
|
|
110
|
+
const h = w(d, "id");
|
|
111
|
+
return h ? [Number(h)] : [];
|
|
202
112
|
}));
|
|
203
|
-
for (const
|
|
204
|
-
const
|
|
205
|
-
o.has(
|
|
113
|
+
for (const d of p) {
|
|
114
|
+
const h = Number(w(d, "id"));
|
|
115
|
+
o.has(h) && B(c, d);
|
|
206
116
|
}
|
|
207
|
-
const
|
|
208
|
-
let
|
|
209
|
-
for (;
|
|
210
|
-
|
|
211
|
-
for (const
|
|
212
|
-
const
|
|
213
|
-
!
|
|
117
|
+
const m = p.filter((d) => !o.has(Number(w(d, "id"))));
|
|
118
|
+
let N = !0;
|
|
119
|
+
for (; N; ) {
|
|
120
|
+
N = !1;
|
|
121
|
+
for (const d of s) {
|
|
122
|
+
const h = d.creation;
|
|
123
|
+
!h || f.has(h.presentationSlideId) || h.sectionAfterSlideId === void 0 || !f.has(h.sectionAfterSlideId) || (f.add(h.presentationSlideId), N = !0);
|
|
214
124
|
}
|
|
215
125
|
}
|
|
216
|
-
const
|
|
217
|
-
if (!
|
|
218
|
-
const
|
|
219
|
-
if (
|
|
220
|
-
const
|
|
221
|
-
return
|
|
126
|
+
const l = new Map(m.map((d) => [Number(w(d, "id")), d])), P = r.flatMap((d) => {
|
|
127
|
+
if (!f.has(d)) return [];
|
|
128
|
+
const h = l.get(d);
|
|
129
|
+
if (h) return [h];
|
|
130
|
+
const S = G(c, j, "sldId");
|
|
131
|
+
return X(S, "id", String(d)), l.set(d, S), [S];
|
|
222
132
|
});
|
|
223
|
-
for (const
|
|
224
|
-
|
|
225
|
-
|
|
133
|
+
for (const d of P)
|
|
134
|
+
k(c).includes(d) || Re(c, d, "sldId", j);
|
|
135
|
+
be(c, P);
|
|
226
136
|
}
|
|
227
137
|
}
|
|
228
|
-
function
|
|
229
|
-
var
|
|
230
|
-
const o =
|
|
231
|
-
if (!
|
|
232
|
-
const
|
|
233
|
-
for (const
|
|
234
|
-
const
|
|
138
|
+
function Mt(e, s, r) {
|
|
139
|
+
var P;
|
|
140
|
+
const o = E(e), n = H(o.root, { localName: "sldIdLst", namespaceUri: O });
|
|
141
|
+
if (!n) throw new Error("presentation.xml 缺少 p:sldIdLst");
|
|
142
|
+
const i = It(s), c = /* @__PURE__ */ new Map(), p = Oe(r), f = /* @__PURE__ */ new Set();
|
|
143
|
+
for (const d of k(n, { localName: "sldId", namespaceUri: O })) {
|
|
144
|
+
const h = (P = C(d, {
|
|
235
145
|
localName: "id",
|
|
236
146
|
namespaceUri: "http://schemas.openxmlformats.org/officeDocument/2006/relationships"
|
|
237
|
-
})) == null ? void 0 :
|
|
238
|
-
if (
|
|
239
|
-
const
|
|
240
|
-
Number.isFinite(
|
|
241
|
-
} else
|
|
242
|
-
}
|
|
243
|
-
const
|
|
244
|
-
const
|
|
245
|
-
if (
|
|
246
|
-
const
|
|
247
|
-
if (!(
|
|
248
|
-
const
|
|
249
|
-
return
|
|
147
|
+
})) == null ? void 0 : P.value, S = h ? i.get(h) : void 0;
|
|
148
|
+
if (S && p.has(S)) {
|
|
149
|
+
const g = Number(w(d, "id"));
|
|
150
|
+
Number.isFinite(g) && f.add(g), B(n, d);
|
|
151
|
+
} else S && c.set(S, d);
|
|
152
|
+
}
|
|
153
|
+
const m = te(r), N = new Map(m.map((d) => [d.id, d])), l = r.slideOrder.map((d) => {
|
|
154
|
+
const h = r.slides[d], S = h.origin ? c.get(h.origin.part) : void 0;
|
|
155
|
+
if (S) return S;
|
|
156
|
+
const g = N.get(d);
|
|
157
|
+
if (!(g != null && g.creation)) throw new Error(`页面 ${d} 无法映射到 presentation.xml`);
|
|
158
|
+
const I = G(n, O, "sldId");
|
|
159
|
+
return X(I, "id", String(g.creation.presentationSlideId)), X(I, "r:id", g.creation.presentationRelationshipId), I;
|
|
250
160
|
});
|
|
251
|
-
for (const
|
|
252
|
-
|
|
253
|
-
return
|
|
161
|
+
for (const d of l)
|
|
162
|
+
k(n).includes(d) || Re(n, d, "sldId", O);
|
|
163
|
+
return be(n, l), bt(
|
|
254
164
|
o.root,
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
),
|
|
259
|
-
}
|
|
260
|
-
function
|
|
261
|
-
const
|
|
262
|
-
for (const
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
}
|
|
266
|
-
return
|
|
267
|
-
sourceId:
|
|
268
|
-
targetId:
|
|
269
|
-
type:
|
|
270
|
-
target:
|
|
165
|
+
m,
|
|
166
|
+
l.map((d) => Number(w(d, "id"))),
|
|
167
|
+
f
|
|
168
|
+
), D(o);
|
|
169
|
+
}
|
|
170
|
+
function Rt(e, s) {
|
|
171
|
+
const r = E(e), o = Oe(s);
|
|
172
|
+
for (const n of k(r.root, { localName: "Relationship" })) {
|
|
173
|
+
const i = w(n, "Type"), c = w(n, "Target"), p = w(n, "TargetMode");
|
|
174
|
+
i !== we || !c || p === "External" || o.has(oe("ppt/presentation.xml", c)) && B(r.root, n);
|
|
175
|
+
}
|
|
176
|
+
return F(D(r), te(s).map((n) => ({
|
|
177
|
+
sourceId: n.creation.presentationRelationshipId,
|
|
178
|
+
targetId: n.creation.presentationRelationshipId,
|
|
179
|
+
type: we,
|
|
180
|
+
target: Z("ppt/presentation.xml", n.origin.part)
|
|
271
181
|
})));
|
|
272
182
|
}
|
|
273
|
-
function
|
|
274
|
-
var
|
|
275
|
-
const o =
|
|
276
|
-
for (const
|
|
277
|
-
const
|
|
278
|
-
|
|
279
|
-
}
|
|
280
|
-
const
|
|
281
|
-
var
|
|
282
|
-
const
|
|
283
|
-
return
|
|
183
|
+
function Ct(e, s, r = /* @__PURE__ */ new Set()) {
|
|
184
|
+
var i, c;
|
|
185
|
+
const o = E(e);
|
|
186
|
+
for (const p of k(o.root, { localName: "Override" })) {
|
|
187
|
+
const f = (i = C(p, { localName: "PartName", namespaceUri: null })) == null ? void 0 : i.value;
|
|
188
|
+
f && r.has(f.replace(/^\//, "")) && B(o.root, p);
|
|
189
|
+
}
|
|
190
|
+
const n = new Set(k(o.root, { localName: "Override" }).flatMap((p) => {
|
|
191
|
+
var m;
|
|
192
|
+
const f = (m = C(p, { localName: "PartName", namespaceUri: null })) == null ? void 0 : m.value;
|
|
193
|
+
return f ? [f] : [];
|
|
284
194
|
}));
|
|
285
|
-
for (const
|
|
286
|
-
const
|
|
287
|
-
|
|
288
|
-
attributes: [["PartName",
|
|
289
|
-
})),
|
|
195
|
+
for (const p of te(s)) {
|
|
196
|
+
const f = `/${p.origin.part}`;
|
|
197
|
+
n.has(f) || (A(o.root, Se("Override", {
|
|
198
|
+
attributes: [["PartName", f], ["ContentType", Nt]]
|
|
199
|
+
})), n.add(f));
|
|
290
200
|
}
|
|
291
|
-
for (const
|
|
292
|
-
const
|
|
293
|
-
!
|
|
294
|
-
attributes: [["PartName", `/${
|
|
295
|
-
})),
|
|
201
|
+
for (const p of Object.values(s.slides)) {
|
|
202
|
+
const f = (c = p.notes) == null ? void 0 : c.targetPart;
|
|
203
|
+
!f || n.has(`/${f}`) || (A(o.root, Se("Override", {
|
|
204
|
+
attributes: [["PartName", `/${f}`], ["ContentType", Tt]]
|
|
205
|
+
})), n.add(`/${f}`));
|
|
296
206
|
}
|
|
297
|
-
return
|
|
207
|
+
return D(o);
|
|
298
208
|
}
|
|
299
|
-
function
|
|
300
|
-
var
|
|
301
|
-
const o =
|
|
302
|
-
if (!o) throw new Error(`页面副本缺少来源 OPC part:${
|
|
209
|
+
function Ce(e, s, r) {
|
|
210
|
+
var n;
|
|
211
|
+
const o = s[r] ?? ((n = e.package) == null ? void 0 : n.parts[r]);
|
|
212
|
+
if (!o) throw new Error(`页面副本缺少来源 OPC part:${r}`);
|
|
303
213
|
return o;
|
|
304
214
|
}
|
|
305
|
-
function
|
|
306
|
-
var
|
|
307
|
-
const o = (
|
|
308
|
-
return o ?
|
|
309
|
-
}
|
|
310
|
-
function Pe(e, t, n) {
|
|
311
|
-
var r;
|
|
312
|
-
const o = (r = t.creation) == null ? void 0 : r.duplicateSourcePart;
|
|
313
|
-
return o ? dt(e, n, U(o)) : void 0;
|
|
215
|
+
function Lt(e, s, r) {
|
|
216
|
+
var n;
|
|
217
|
+
const o = (n = s.creation) == null ? void 0 : n.duplicateSourcePart;
|
|
218
|
+
return o ? Ce(e, r, o) : void 0;
|
|
314
219
|
}
|
|
315
|
-
function
|
|
316
|
-
var n
|
|
317
|
-
const
|
|
318
|
-
return
|
|
319
|
-
|
|
220
|
+
function Q(e, s, r) {
|
|
221
|
+
var n;
|
|
222
|
+
const o = (n = s.creation) == null ? void 0 : n.duplicateSourcePart;
|
|
223
|
+
return o ? Ce(e, r, x(o)) : void 0;
|
|
224
|
+
}
|
|
225
|
+
function Ut(e) {
|
|
226
|
+
var r, o;
|
|
227
|
+
const s = (r = e.origin) == null ? void 0 : r.part;
|
|
228
|
+
return s ? (((o = e.creation) == null ? void 0 : o.duplicateRemovedSpids) ?? []).map((n) => ({
|
|
229
|
+
id: `${e.id}-baseline-${n}`,
|
|
320
230
|
parent: e.id,
|
|
321
|
-
meta: { editable: "full", origin: { part:
|
|
231
|
+
meta: { editable: "full", origin: { part: s, spid: n } }
|
|
322
232
|
})) : [];
|
|
323
233
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
}
|
|
328
|
-
function re(e, t, n = []) {
|
|
329
|
-
const o = se(e, t);
|
|
330
|
-
if (o) return o;
|
|
331
|
-
const r = E(e, L, t), a = h(e).find((s) => s.namespaceUri === L && n.includes(s.localName));
|
|
332
|
-
return w(e, r, a ?? null), r;
|
|
333
|
-
}
|
|
334
|
-
function Tn(e, t) {
|
|
335
|
-
const n = se(e, "alphaModFix");
|
|
336
|
-
if (t === void 0) {
|
|
337
|
-
n && T(e, n);
|
|
338
|
-
return;
|
|
339
|
-
}
|
|
340
|
-
const o = n ?? re(e, "alphaModFix", ["extLst"]);
|
|
341
|
-
N(o, "amt", String(Math.round(t * 1e5)));
|
|
342
|
-
}
|
|
343
|
-
function wn(e) {
|
|
344
|
-
return e.attributes.some((t) => !["l", "t", "r", "b"].includes(t.localName)) || h(e).length > 0;
|
|
345
|
-
}
|
|
346
|
-
function bn(e, t) {
|
|
347
|
-
const n = se(e, "srcRect");
|
|
348
|
-
if (!t) {
|
|
349
|
-
if (!n) return;
|
|
350
|
-
for (const r of ["l", "t", "r", "b"]) K(n, r);
|
|
351
|
-
wn(n) || T(e, n);
|
|
352
|
-
return;
|
|
353
|
-
}
|
|
354
|
-
const o = n ?? re(e, "srcRect", ["tile", "stretch"]);
|
|
355
|
-
for (const r of ["l", "t", "r", "b"])
|
|
356
|
-
N(o, r, String(Math.round(t[r] * 1e5)));
|
|
357
|
-
}
|
|
358
|
-
function kn(e, t) {
|
|
359
|
-
const n = se(e, "tile"), o = se(e, "stretch");
|
|
360
|
-
if (t.tile) {
|
|
361
|
-
o && T(e, o);
|
|
362
|
-
const a = n ?? re(e, "tile");
|
|
363
|
-
N(a, "sx", String(Math.round(t.tile.sx * 1e5))), N(a, "sy", String(Math.round(t.tile.sy * 1e5))), N(a, "flip", t.tile.flip), N(a, "tx", String(Math.round((t.tile.tx ?? 0) * 9525))), N(a, "ty", String(Math.round((t.tile.ty ?? 0) * 9525))), N(a, "algn", t.tile.algn ?? "tl");
|
|
364
|
-
return;
|
|
365
|
-
}
|
|
366
|
-
n && T(e, n);
|
|
367
|
-
const r = o ?? re(e, "stretch");
|
|
368
|
-
re(r, "fillRect");
|
|
369
|
-
}
|
|
370
|
-
function En(e, t, n, o) {
|
|
371
|
-
let r = se(e, "blipFill");
|
|
372
|
-
for (const s of [...h(e)])
|
|
373
|
-
s.namespaceUri !== L || !Sn.has(s.localName) || s !== r && T(e, s);
|
|
374
|
-
r || (r = E(e, L, "blipFill"), q(e, r)), o || K(r, "dpi");
|
|
375
|
-
const a = re(r, "blip", ["srcRect", "tile", "stretch"]);
|
|
376
|
-
N(a, "r:embed", n), K(a, "r:link"), Tn(a, t.alpha), bn(r, t.crop), kn(r, t);
|
|
377
|
-
}
|
|
378
|
-
const ue = "http://schemas.microsoft.com/office/powerpoint/2015/09/main", Ae = /* @__PURE__ */ new Set([
|
|
379
|
-
"vortex",
|
|
380
|
-
"switch",
|
|
381
|
-
"flip",
|
|
382
|
-
"ripple",
|
|
383
|
-
"honeycomb",
|
|
384
|
-
"glitter",
|
|
385
|
-
"warp",
|
|
386
|
-
"flythrough",
|
|
387
|
-
"flash",
|
|
388
|
-
"shred",
|
|
389
|
-
"reveal",
|
|
390
|
-
"wheelReverse",
|
|
391
|
-
"ferris",
|
|
392
|
-
"gallery",
|
|
393
|
-
"conveyor",
|
|
394
|
-
"pan",
|
|
395
|
-
"doors",
|
|
396
|
-
"window",
|
|
397
|
-
"prism"
|
|
398
|
-
]), xn = /* @__PURE__ */ new Set([
|
|
399
|
-
"fade",
|
|
400
|
-
"cut",
|
|
401
|
-
"push",
|
|
402
|
-
"pull",
|
|
403
|
-
"cover",
|
|
404
|
-
"wipe",
|
|
405
|
-
"split",
|
|
406
|
-
"zoom",
|
|
407
|
-
"dissolve",
|
|
408
|
-
"checker",
|
|
409
|
-
"blinds",
|
|
410
|
-
"comb",
|
|
411
|
-
"wheel",
|
|
412
|
-
"circle",
|
|
413
|
-
"diamond",
|
|
414
|
-
"plus",
|
|
415
|
-
"wedge",
|
|
416
|
-
"newsflash",
|
|
417
|
-
"randomBar",
|
|
418
|
-
"strips",
|
|
419
|
-
"random",
|
|
420
|
-
"fadeThroughBlack"
|
|
421
|
-
]), Mn = /* @__PURE__ */ new Set([O, ue]);
|
|
422
|
-
function Un(e) {
|
|
423
|
-
return e <= 625 ? "fast" : e <= 875 ? "med" : "slow";
|
|
424
|
-
}
|
|
425
|
-
function Te(e, t) {
|
|
426
|
-
for (const n of [...e.attributes])
|
|
427
|
-
t(n) && K(e, n.name);
|
|
428
|
-
}
|
|
429
|
-
function ht(e) {
|
|
430
|
-
return e === "p" ? g : e === "p14" ? O : ue;
|
|
431
|
-
}
|
|
432
|
-
function In(e, t, n) {
|
|
433
|
-
const o = ht(n);
|
|
434
|
-
return e && h(e).find((r) => r.namespaceUri === o && gt(r) === t);
|
|
435
|
-
}
|
|
436
|
-
function gt(e) {
|
|
437
|
-
if (e.namespaceUri === g)
|
|
438
|
-
return e.localName === "random" ? "dissolve" : e.localName === "fadeThroughBlack" ? "fade" : xn.has(e.localName) ? e.localName : void 0;
|
|
439
|
-
if (e.namespaceUri === O && Ae.has(e.localName)) return e.localName;
|
|
440
|
-
if (e.namespaceUri === ue && e.localName === "morph") return "morph";
|
|
441
|
-
}
|
|
442
|
-
function vt(e) {
|
|
443
|
-
return gt(e) !== void 0;
|
|
444
|
-
}
|
|
445
|
-
function Cn(e, t, n, o) {
|
|
446
|
-
const r = In(o, e.type, t), a = r ? ee(r) : E(n, ht(t), e.type);
|
|
447
|
-
if (Te(a, (s) => s.namespaceUri === null && ["dir", "orient", "option"].includes(s.localName)), e.type === "split" && e.dir) {
|
|
448
|
-
const [s, i] = e.dir.split("-");
|
|
449
|
-
N(a, "orient", s), N(a, "dir", i);
|
|
450
|
-
} else e.dir && N(a, "dir", e.dir);
|
|
451
|
-
return e.type === "morph" && N(a, "option", e.morphBy ?? "byObject"), a;
|
|
452
|
-
}
|
|
453
|
-
function Ze(e, t, n, o, r) {
|
|
454
|
-
const a = r ? ee(r) : E(o, g, "transition"), s = h(a).filter(vt);
|
|
455
|
-
for (const c of s.slice(1)) T(a, c);
|
|
456
|
-
Te(a, (c) => c.namespaceUri === null && ["spd", "advTm", "dur"].includes(c.localName) || c.namespaceUri === O && c.localName === "dur"), n || Te(a, (c) => c.namespaceUri === O || c.namespaceUri === ue), N(a, "spd", Un(e.durationMs)), n && (N(a, "xmlns:p14", O), N(a, "p14:dur", String(e.durationMs))), e.advanceAfterMs !== void 0 && N(a, "advTm", String(e.advanceAfterMs));
|
|
457
|
-
const i = Cn(e, t, a, r);
|
|
458
|
-
if (s[0]) ne(a, s[0], [i]);
|
|
459
|
-
else {
|
|
460
|
-
const c = a.children.find((f) => f.type === "element") ?? null;
|
|
461
|
-
w(a, i, c);
|
|
462
|
-
}
|
|
463
|
-
return a;
|
|
464
|
-
}
|
|
465
|
-
function Rn(e) {
|
|
466
|
-
if (!Ae.has(e.type) && e.type !== "morph") return e;
|
|
467
|
-
const t = ["gallery", "conveyor", "pan", "reveal"].includes(e.type) ? "push" : "fade";
|
|
468
|
-
return {
|
|
469
|
-
type: t,
|
|
470
|
-
durationMs: e.durationMs,
|
|
471
|
-
...t === "push" && e.dir && ["l", "r", "u", "d"].includes(e.dir) ? { dir: e.dir } : {},
|
|
472
|
-
...e.advanceAfterMs !== void 0 ? { advanceAfterMs: e.advanceAfterMs } : {}
|
|
473
|
-
};
|
|
474
|
-
}
|
|
475
|
-
function G(e) {
|
|
476
|
-
return e && h(e).find((t) => t.namespaceUri === g && t.localName === "transition");
|
|
477
|
-
}
|
|
478
|
-
function On(e) {
|
|
479
|
-
var o;
|
|
480
|
-
const t = ((o = e.attributes.find((r) => r.namespaceUri === null && r.localName === "Requires")) == null ? void 0 : o.value.trim().split(/\s+/).filter(Boolean)) ?? [], n = Zt(e).namespaces;
|
|
481
|
-
return t.length > 0 && t.every((r) => Mn.has(n.get(r) ?? ""));
|
|
482
|
-
}
|
|
483
|
-
function Re(e) {
|
|
484
|
-
const t = h(e);
|
|
485
|
-
return {
|
|
486
|
-
choice: t.find((n) => n.namespaceUri === j && n.localName === "Choice" && On(n)),
|
|
487
|
-
fallback: t.find((n) => n.namespaceUri === j && n.localName === "Fallback")
|
|
488
|
-
};
|
|
489
|
-
}
|
|
490
|
-
function pe(e, t) {
|
|
491
|
-
const n = G(e);
|
|
492
|
-
if (n) ne(e, n, [t]);
|
|
493
|
-
else {
|
|
494
|
-
const o = e.children.find((r) => r.type === "element") ?? null;
|
|
495
|
-
w(e, t, o);
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
function yt(e, t) {
|
|
499
|
-
const n = h(e), o = n.findIndex((s) => s.namespaceUri === j && s.localName === "Choice"), r = n.indexOf(t);
|
|
500
|
-
if (o < 0 || r <= o) return;
|
|
501
|
-
const a = [...n];
|
|
502
|
-
a.splice(r, 1), a.splice(o, 0, t), Oe(e, a);
|
|
503
|
-
}
|
|
504
|
-
function Ln(e, t) {
|
|
505
|
-
const n = (t == null ? void 0 : t.namespaceUri) === g ? t : void 0, o = (t == null ? void 0 : t.namespaceUri) === j ? ee(t) : B("mc:AlternateContent", { selfClosing: !1 });
|
|
506
|
-
N(o, "xmlns:mc", j);
|
|
507
|
-
const r = e.type === "morph";
|
|
508
|
-
let { choice: a, fallback: s } = Re(o);
|
|
509
|
-
if (!a || !G(a)) {
|
|
510
|
-
a = B("mc:Choice", { selfClosing: !1 });
|
|
511
|
-
const v = o.children.find((p) => p.type === "element") ?? null;
|
|
512
|
-
w(o, a, v);
|
|
513
|
-
}
|
|
514
|
-
const i = G(a) ?? n;
|
|
515
|
-
N(a, "xmlns:p14", O), r && N(a, "xmlns:p159", ue), N(a, "Requires", r ? "p159" : "p14"), yt(o, a), pe(a, Ze(
|
|
516
|
-
e,
|
|
517
|
-
r ? "p159" : Ae.has(e.type) ? "p14" : "p",
|
|
518
|
-
!0,
|
|
519
|
-
a,
|
|
520
|
-
i
|
|
521
|
-
)), s || (s = B("mc:Fallback", { selfClosing: !1 }), w(o, s));
|
|
522
|
-
const c = G(s) ?? n, f = Rn(e);
|
|
523
|
-
return pe(s, Ze(
|
|
524
|
-
f,
|
|
525
|
-
"p",
|
|
526
|
-
!1,
|
|
527
|
-
s,
|
|
528
|
-
c
|
|
529
|
-
)), o;
|
|
530
|
-
}
|
|
531
|
-
function An(e) {
|
|
532
|
-
return e.namespaceUri !== j || e.localName !== "AlternateContent" ? !1 : h(e).some((t) => t.namespaceUri === j && (t.localName === "Choice" || t.localName === "Fallback") && G(t) !== void 0);
|
|
533
|
-
}
|
|
534
|
-
function Bn(e) {
|
|
535
|
-
return h(e).filter((t) => t.namespaceUri === g && t.localName === "transition" || An(t));
|
|
536
|
-
}
|
|
537
|
-
function Ce(e, t) {
|
|
538
|
-
const n = ee(e);
|
|
539
|
-
for (const o of h(n).filter(vt))
|
|
540
|
-
T(n, o);
|
|
541
|
-
return Te(n, (o) => o.namespaceUri === null && ["spd", "dur", "advTm"].includes(o.localName) || o.namespaceUri === O && o.localName === "dur"), t.advanceAfterMs !== void 0 && N(n, "advTm", String(t.advanceAfterMs)), n;
|
|
542
|
-
}
|
|
543
|
-
function $n(e, t) {
|
|
544
|
-
if (e.namespaceUri === g) return Ce(e, t);
|
|
545
|
-
const n = ee(e);
|
|
546
|
-
let o = Re(n), r = o.choice;
|
|
547
|
-
if (!r || !G(r)) {
|
|
548
|
-
r = B("mc:Choice", { selfClosing: !1 });
|
|
549
|
-
const c = n.children.find((f) => f.type === "element") ?? null;
|
|
550
|
-
w(n, r, c);
|
|
551
|
-
}
|
|
552
|
-
N(r, "xmlns:p14", O), N(r, "Requires", "p14");
|
|
553
|
-
const a = G(r), s = G(o.fallback), i = a ?? s;
|
|
554
|
-
if (i ? pe(r, Ce(i, t)) : pe(r, E(r, g, "transition")), yt(n, r), o = Re(n), o.fallback) {
|
|
555
|
-
const c = G(o.fallback);
|
|
556
|
-
c ? ne(o.fallback, c, [Ce(c, t)]) : pe(
|
|
557
|
-
o.fallback,
|
|
558
|
-
E(o.fallback, g, "transition")
|
|
559
|
-
);
|
|
560
|
-
} else {
|
|
561
|
-
const c = B("mc:Fallback", { selfClosing: !1 });
|
|
562
|
-
w(n, c), w(c, E(c, g, "transition"));
|
|
563
|
-
}
|
|
564
|
-
return n;
|
|
565
|
-
}
|
|
566
|
-
function Fn(e) {
|
|
567
|
-
const t = (o, r = []) => o.attributes.some((a) => a.name !== "xmlns" && a.prefix !== "xmlns" && !(a.namespaceUri === null && r.includes(a.localName))), n = (o) => t(o) || o.children.some((r) => r.type === "element" || r.type === "text" && r.value.trim() || r.type !== "text");
|
|
568
|
-
return e.namespaceUri === g ? n(e) : t(e) || h(e).some((o) => t(o, ["Requires"]) || o.children.some((r) => r.type !== "element" ? r.type !== "text" || !!r.value.trim() : r.namespaceUri === g && r.localName === "transition" ? n(r) : !0));
|
|
569
|
-
}
|
|
570
|
-
function _n(e, t, n = !1) {
|
|
571
|
-
const o = Bn(e.root);
|
|
572
|
-
if (t.type === "none") {
|
|
573
|
-
if (o[0]) {
|
|
574
|
-
const s = $n(o[0], t), i = n || t.advanceAfterMs !== void 0 || Fn(s) ? [s] : [];
|
|
575
|
-
ne(e.root, o[0], i);
|
|
576
|
-
for (const c of o.slice(1)) T(e.root, c);
|
|
577
|
-
} else if (n || t.advanceAfterMs !== void 0) {
|
|
578
|
-
const s = E(e.root, g, "transition");
|
|
579
|
-
t.advanceAfterMs !== void 0 && N(s, "advTm", String(t.advanceAfterMs)), q(e.root, s);
|
|
580
|
-
}
|
|
581
|
-
return;
|
|
582
|
-
}
|
|
583
|
-
const r = Ln(t, o[0]);
|
|
584
|
-
if (o[0]) {
|
|
585
|
-
ne(e.root, o[0], [r]);
|
|
586
|
-
for (const s of o.slice(1)) T(e.root, s);
|
|
587
|
-
return;
|
|
588
|
-
}
|
|
589
|
-
const a = E(e.root, g, "transition");
|
|
590
|
-
q(e.root, a), ne(e.root, a, [r]);
|
|
591
|
-
}
|
|
592
|
-
const Dn = Object.freeze({
|
|
593
|
-
u: 1,
|
|
594
|
-
r: 2,
|
|
595
|
-
d: 4,
|
|
596
|
-
l: 8,
|
|
597
|
-
rd: 3,
|
|
598
|
-
ru: 6,
|
|
599
|
-
lu: 9,
|
|
600
|
-
ld: 12,
|
|
601
|
-
horz: 5,
|
|
602
|
-
vert: 10,
|
|
603
|
-
in: 16,
|
|
604
|
-
out: 32
|
|
605
|
-
});
|
|
606
|
-
function S(e, t, n = {}) {
|
|
607
|
-
const o = E(e, g, t);
|
|
608
|
-
for (const [r, a] of Object.entries(n)) N(o, r, String(a));
|
|
609
|
-
return w(e, o), o;
|
|
610
|
-
}
|
|
611
|
-
function oe(e, t, n = {}) {
|
|
612
|
-
return S(e, "cTn", { id: t(), ...n });
|
|
613
|
-
}
|
|
614
|
-
function Be(e, t) {
|
|
615
|
-
const n = S(e, "stCondLst");
|
|
616
|
-
S(n, "cond", { delay: t });
|
|
617
|
-
}
|
|
618
|
-
function Se(e, t, n, o, r = []) {
|
|
619
|
-
const a = S(e, "cBhvr");
|
|
620
|
-
oe(a, o, { dur: n, fill: "hold" });
|
|
621
|
-
const s = S(a, "tgtEl");
|
|
622
|
-
if (S(s, "spTgt", { spid: t }), r.length) {
|
|
623
|
-
const i = S(a, "attrNameLst");
|
|
624
|
-
for (const c of r) {
|
|
625
|
-
const f = S(i, "attrName");
|
|
626
|
-
w(f, ke(c));
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
function et(e, t, n, o, r) {
|
|
631
|
-
const a = S(e, "set"), s = S(a, "cBhvr"), i = oe(s, r, { dur: 1, fill: "hold" });
|
|
632
|
-
Be(i, o);
|
|
633
|
-
const c = S(s, "tgtEl");
|
|
634
|
-
S(c, "spTgt", { spid: t });
|
|
635
|
-
const f = S(s, "attrNameLst"), v = S(f, "attrName");
|
|
636
|
-
w(v, ke("style.visibility"));
|
|
637
|
-
const p = S(a, "to");
|
|
638
|
-
S(p, "strVal", { val: n });
|
|
639
|
-
}
|
|
640
|
-
function Xn(e, t, n, o) {
|
|
641
|
-
if (t.kind === "emphasis" && t.effect === "spin") {
|
|
642
|
-
const s = S(e, "animRot", { by: 216e5 });
|
|
643
|
-
Se(s, n, t.durationMs, o, ["r"]);
|
|
644
|
-
return;
|
|
645
|
-
}
|
|
646
|
-
if (t.kind === "emphasis" && t.effect === "grow") {
|
|
647
|
-
const s = S(e, "animScale");
|
|
648
|
-
Se(s, n, t.durationMs, o, ["ppt_w", "ppt_h"]), S(s, "by", { x: 125e3, y: 125e3 });
|
|
649
|
-
return;
|
|
650
|
-
}
|
|
651
|
-
if (t.effect === "appear") return;
|
|
652
|
-
const r = bt(t.effect, t.dir);
|
|
653
|
-
if (!r) throw new Error(`动画 ${t.effect} 缺少可保存 filter`);
|
|
654
|
-
const a = S(e, "animEffect", {
|
|
655
|
-
transition: t.kind === "exit" ? "out" : "in",
|
|
656
|
-
filter: r
|
|
657
|
-
});
|
|
658
|
-
Se(a, n, t.durationMs, o);
|
|
659
|
-
}
|
|
660
|
-
function tt(e) {
|
|
661
|
-
const t = Math.abs(e) < 5e-10 ? 0 : Math.round(e * 1e9) / 1e9;
|
|
662
|
-
return String(t);
|
|
663
|
-
}
|
|
664
|
-
function jn(e, t, n, o, r) {
|
|
665
|
-
const a = t.motionPath.map(([i, c], f) => `${f ? "L" : "M"} ${tt(i / o.meta.width)} ${tt(c / o.meta.height)}`).join(" "), s = S(e, "animMotion", {
|
|
666
|
-
origin: "layout",
|
|
667
|
-
path: `${a} E`,
|
|
668
|
-
pathEditMode: "relative"
|
|
669
|
-
});
|
|
670
|
-
Se(s, n, t.durationMs, r, ["ppt_x", "ppt_y"]);
|
|
671
|
-
}
|
|
672
|
-
function Gn(e, t, n, o) {
|
|
673
|
-
var f;
|
|
674
|
-
const r = n.elements[t.target], a = ((f = r == null ? void 0 : r.meta.origin) == null ? void 0 : f.spid) ?? (r == null ? void 0 : r.src.id);
|
|
675
|
-
if (a === void 0) throw new Error(`动画目标缺少 OOXML spid:${t.target}`);
|
|
676
|
-
const s = S(e, "par"), i = oe(s, o, {
|
|
677
|
-
presetID: t.kind === "motion" ? 0 : wt(t.effect).preset,
|
|
678
|
-
presetClass: t.kind === "motion" ? "path" : t.kind === "entrance" ? "entr" : t.kind === "exit" ? "exit" : "emph",
|
|
679
|
-
...t.kind !== "motion" && t.dir !== void 0 ? { presetSubtype: Dn[t.dir] ?? 0 } : {},
|
|
680
|
-
dur: t.durationMs,
|
|
681
|
-
fill: "hold",
|
|
682
|
-
nodeType: t.trigger === "click" ? "clickEffect" : t.trigger === "withPrev" ? "withEffect" : "afterEffect"
|
|
683
|
-
});
|
|
684
|
-
Be(i, t.delayMs);
|
|
685
|
-
const c = S(i, "childTnLst");
|
|
686
|
-
t.kind === "entrance" && et(c, a, "visible", 0, o), t.kind === "motion" ? jn(c, t, a, n, o) : Xn(c, t, a, o), t.kind === "exit" && et(c, a, "hidden", t.durationMs, o);
|
|
687
|
-
}
|
|
688
|
-
function zn(e, t, n) {
|
|
689
|
-
let o = 0;
|
|
690
|
-
const r = () => ++o, a = S(e, "par"), s = oe(a, r, {
|
|
691
|
-
dur: "indefinite",
|
|
692
|
-
restart: "never",
|
|
693
|
-
nodeType: "tmRoot"
|
|
694
|
-
}), i = S(s, "childTnLst"), c = S(i, "seq", { concurrent: 1, nextAc: "seek" }), f = oe(c, r, { dur: "indefinite", nodeType: "mainSeq" }), v = S(f, "childTnLst");
|
|
695
|
-
let p = null;
|
|
696
|
-
for (const m of t) {
|
|
697
|
-
if (!p || m.trigger === "click") {
|
|
698
|
-
const u = S(v, "par"), y = oe(u, r, { fill: "hold", nodeType: "clickEffect" });
|
|
699
|
-
Be(y, "indefinite"), p = S(y, "childTnLst");
|
|
700
|
-
}
|
|
701
|
-
Gn(p, m, n, r);
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
function xe(e) {
|
|
705
|
-
return e.attributes.some((t) => t.namespaceUri !== en);
|
|
706
|
-
}
|
|
707
|
-
function we(e) {
|
|
708
|
-
return h(e).filter((t) => t.namespaceUri === g && t.localName === "timing");
|
|
709
|
-
}
|
|
710
|
-
function Hn(e) {
|
|
711
|
-
if (e.namespaceUri !== j || e.localName !== "AlternateContent") return [];
|
|
712
|
-
const n = h(e).filter((o) => o.namespaceUri === j && (o.localName === "Choice" || o.localName === "Fallback")).map((o) => ({ parent: o, timings: we(o) }));
|
|
713
|
-
if (n.some(({ timings: o }) => o.length > 1))
|
|
714
|
-
throw new Error("mc:AlternateContent 分支包含多个 p:timing");
|
|
715
|
-
return n.some(({ timings: o }) => o.length) ? n.map(({ parent: o, timings: r }) => ({ parent: o, timing: r[0] })) : [];
|
|
716
|
-
}
|
|
717
|
-
function qn(e) {
|
|
718
|
-
const t = we(e), n = h(e).map(Hn).filter((o) => o.length);
|
|
719
|
-
if (t.length > 1 || n.length > 1 || t.length && n.length)
|
|
720
|
-
throw new Error("幻灯片包含多个 p:timing 载体");
|
|
721
|
-
return t.length ? [{ parent: e, timing: t[0] }] : n[0] ?? [];
|
|
722
|
-
}
|
|
723
|
-
const Vn = /* @__PURE__ */ new Set([
|
|
724
|
-
"set",
|
|
725
|
-
"anim",
|
|
726
|
-
"animClr",
|
|
727
|
-
"animEffect",
|
|
728
|
-
"animMotion",
|
|
729
|
-
"animRot",
|
|
730
|
-
"animScale",
|
|
731
|
-
"audio",
|
|
732
|
-
"video",
|
|
733
|
-
"cmd"
|
|
734
|
-
]);
|
|
735
|
-
function $(e) {
|
|
736
|
-
const t = tn(e).parent;
|
|
737
|
-
return (t == null ? void 0 : t.type) === "element" ? t : null;
|
|
738
|
-
}
|
|
739
|
-
function ae(e, t) {
|
|
740
|
-
var n;
|
|
741
|
-
return (n = e.attributes.find((o) => o.namespaceUri === null && o.localName === t)) == null ? void 0 : n.value;
|
|
742
|
-
}
|
|
743
|
-
function H(e) {
|
|
744
|
-
const t = [], n = [e];
|
|
745
|
-
for (; n.length; ) {
|
|
746
|
-
const o = n.pop();
|
|
747
|
-
if (t.push(o), t.length > 1e5) throw new Error("动画时间树节点超过保存安全上限");
|
|
748
|
-
const r = h(o);
|
|
749
|
-
for (let a = r.length - 1; a >= 0; a--) n.push(r[a]);
|
|
750
|
-
}
|
|
751
|
-
return t;
|
|
752
|
-
}
|
|
753
|
-
function Wn(e, t) {
|
|
754
|
-
return H(e).some((n) => {
|
|
755
|
-
const o = ae(n, "spid");
|
|
756
|
-
return o !== void 0 && t.has(Number(o));
|
|
757
|
-
});
|
|
758
|
-
}
|
|
759
|
-
function Yn(e) {
|
|
760
|
-
let t = $(e), n = (t == null ? void 0 : t.localName) === "tgtEl" ? t : e;
|
|
761
|
-
for (; t; ) {
|
|
762
|
-
if (t.namespaceUri === g && (t.localName === "cBhvr" || t.localName === "cond") || Vn.has(t.localName)) return t;
|
|
763
|
-
t = $(t);
|
|
764
|
-
}
|
|
765
|
-
return n;
|
|
766
|
-
}
|
|
767
|
-
function me(e) {
|
|
768
|
-
if (!(e.namespaceUri !== g || e.localName !== "par"))
|
|
769
|
-
return h(e).find((t) => t.namespaceUri === g && t.localName === "cTn" && !!ae(t, "presetClass"));
|
|
770
|
-
}
|
|
771
|
-
function Kn(e, t) {
|
|
772
|
-
const n = H(e).filter((r) => !!me(r));
|
|
773
|
-
let o = null;
|
|
774
|
-
for (let r = n.length - 1; r >= 0; r--) {
|
|
775
|
-
const a = n[r], s = me(a);
|
|
776
|
-
if (!t.has(a)) {
|
|
777
|
-
o = a;
|
|
778
|
-
continue;
|
|
779
|
-
}
|
|
780
|
-
ae(s, "nodeType") === "clickEffect" && o && N(me(o), "nodeType", "clickEffect");
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
function Jn(e) {
|
|
784
|
-
for (let t = 0; t < 64; t++) {
|
|
785
|
-
let n = !1;
|
|
786
|
-
const o = H(e).reverse();
|
|
787
|
-
for (const r of o) {
|
|
788
|
-
if (r.namespaceUri !== g || r.localName !== "par" && r.localName !== "seq") continue;
|
|
789
|
-
const a = h(r).find((c) => c.namespaceUri === g && c.localName === "cTn"), s = a && h(a).find((c) => c.namespaceUri === g && c.localName === "childTnLst"), i = $(r);
|
|
790
|
-
s && h(s).length === 0 && i && (T(i, r), n = !0);
|
|
791
|
-
}
|
|
792
|
-
if (!n) break;
|
|
793
|
-
}
|
|
794
|
-
for (const t of H(e).reverse()) {
|
|
795
|
-
if (t.namespaceUri !== g || t.localName !== "tnLst" && t.localName !== "bldLst" || h(t).length !== 0 || xe(t)) continue;
|
|
796
|
-
const n = $(t);
|
|
797
|
-
n && T(n, t);
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
function nt(e) {
|
|
801
|
-
return H(e).filter((t) => t.namespaceUri === g && t.localName === "spTgt");
|
|
802
|
-
}
|
|
803
|
-
function Qn(e) {
|
|
804
|
-
const t = $(e);
|
|
805
|
-
if (t && (T(t, e), t.localName === "tgtEl" && h(t).length === 0 && !xe(t))) {
|
|
806
|
-
const n = $(t);
|
|
807
|
-
n && T(n, t);
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
const Zn = /* @__PURE__ */ new Set([
|
|
811
|
-
"timing",
|
|
812
|
-
"tnLst",
|
|
813
|
-
"childTnLst",
|
|
814
|
-
"subTnLst",
|
|
815
|
-
"par",
|
|
816
|
-
"seq",
|
|
817
|
-
"cTn"
|
|
818
|
-
]);
|
|
819
|
-
function er(e) {
|
|
820
|
-
const t = /* @__PURE__ */ new Set();
|
|
821
|
-
for (const o of e) {
|
|
822
|
-
if (o.namespaceUri !== g || o.localName !== "cBhvr") continue;
|
|
823
|
-
const r = $(o);
|
|
824
|
-
r && !Zn.has(r.localName) && t.add(r);
|
|
825
|
-
}
|
|
826
|
-
const n = /* @__PURE__ */ new Set();
|
|
827
|
-
for (const o of t) {
|
|
828
|
-
const r = h(o).filter((a) => a.namespaceUri === g && a.localName === "cBhvr");
|
|
829
|
-
r.length && r.every((a) => e.has(a)) && n.add(o);
|
|
830
|
-
}
|
|
831
|
-
return n;
|
|
832
|
-
}
|
|
833
|
-
function tr(e) {
|
|
834
|
-
const t = /* @__PURE__ */ new Set();
|
|
835
|
-
for (const o of e) {
|
|
836
|
-
if (o.namespaceUri !== g || o.localName !== "cond") continue;
|
|
837
|
-
const r = $(o);
|
|
838
|
-
r && (r.localName === "stCondLst" || r.localName === "endCondLst") && t.add(r);
|
|
839
|
-
}
|
|
840
|
-
const n = /* @__PURE__ */ new Set();
|
|
841
|
-
for (const o of t) {
|
|
842
|
-
const r = h(o).filter((i) => i.namespaceUri === g && i.localName === "cond");
|
|
843
|
-
if (!r.length || !r.every((i) => e.has(i))) continue;
|
|
844
|
-
const a = $(o), s = a && $(a);
|
|
845
|
-
s && s.namespaceUri === g && (s.localName === "par" || s.localName === "seq") && n.add(s);
|
|
846
|
-
}
|
|
847
|
-
return n;
|
|
848
|
-
}
|
|
849
|
-
function nr(e, t) {
|
|
850
|
-
for (let n = $(e); n; n = $(n))
|
|
851
|
-
if (t.has(n)) return !0;
|
|
852
|
-
return !1;
|
|
853
|
-
}
|
|
854
|
-
function rr(e) {
|
|
855
|
-
return H(e).filter((t) => {
|
|
856
|
-
const n = me(t), o = n && h(n).find((r) => r.namespaceUri === g && r.localName === "childTnLst");
|
|
857
|
-
return !!o && h(o).length === 0;
|
|
858
|
-
});
|
|
859
|
-
}
|
|
860
|
-
function rt(e) {
|
|
861
|
-
for (const t of e) {
|
|
862
|
-
const n = $(t);
|
|
863
|
-
n && T(n, t);
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
function or(e) {
|
|
867
|
-
const t = we(e).map((n) => ({ parent: e, timing: n }));
|
|
868
|
-
for (const n of h(e))
|
|
869
|
-
if (!(n.namespaceUri !== j || n.localName !== "AlternateContent")) {
|
|
870
|
-
for (const o of h(n))
|
|
871
|
-
if (!(o.namespaceUri !== j || o.localName !== "Choice" && o.localName !== "Fallback"))
|
|
872
|
-
for (const r of we(o)) t.push({ parent: o, timing: r });
|
|
873
|
-
}
|
|
874
|
-
return t;
|
|
875
|
-
}
|
|
876
|
-
function ar(e, t) {
|
|
877
|
-
if (!t.length) return;
|
|
878
|
-
const n = new Set(t);
|
|
879
|
-
for (const o of or(e.root)) {
|
|
880
|
-
const r = o.timing, a = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map();
|
|
881
|
-
for (const m of H(r))
|
|
882
|
-
if (m.namespaceUri === g && m.localName === "spTgt" && n.has(Number(ae(m, "spid")))) {
|
|
883
|
-
const u = Yn(m);
|
|
884
|
-
u && i.set(u, [...i.get(u) ?? [], m]);
|
|
885
|
-
}
|
|
886
|
-
for (const [m, u] of i)
|
|
887
|
-
nt(m).some((b) => !n.has(Number(ae(b, "spid")))) ? u.forEach((b) => s.add(b)) : a.add(m);
|
|
888
|
-
s.forEach(Qn);
|
|
889
|
-
const c = er(a), f = tr(a);
|
|
890
|
-
c.forEach((m) => a.add(m));
|
|
891
|
-
const v = new Set([...a].filter((m) => !f.has(m)));
|
|
892
|
-
rt(v);
|
|
893
|
-
const p = new Set(rr(r));
|
|
894
|
-
for (const m of H(r).filter((u) => !!me(u)))
|
|
895
|
-
(f.has(m) || nr(m, f)) && p.add(m);
|
|
896
|
-
Kn(r, p), rt(f);
|
|
897
|
-
for (const m of H(r).filter((u) => u.namespaceUri === g && u.localName === "bldLst"))
|
|
898
|
-
for (const u of [...h(m)])
|
|
899
|
-
Wn(u, n) && T(m, u);
|
|
900
|
-
if (Jn(r), nt(r).some((m) => n.has(Number(ae(m, "spid")))))
|
|
901
|
-
throw new Error("删除动画目标后仍存在悬空 spTgt");
|
|
902
|
-
!xe(r) && h(r).length === 0 && T(o.parent, r);
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
function sr(e, t, n, o) {
|
|
906
|
-
for (const r of [...h(t)])
|
|
907
|
-
r.namespaceUri === g && r.localName === "tnLst" && T(t, r);
|
|
908
|
-
if (n.length) {
|
|
909
|
-
const r = E(t, g, "tnLst"), a = h(t).find((s) => s.namespaceUri === g && (s.localName === "bldLst" || s.localName === "extLst")) ?? null;
|
|
910
|
-
w(t, r, a), zn(r, n, o);
|
|
911
|
-
} else !xe(t) && h(t).length === 0 && T(e, t);
|
|
912
|
-
}
|
|
913
|
-
function ir(e, t, n, o) {
|
|
914
|
-
let r = qn(e.root);
|
|
915
|
-
if (!r.length && o.length) {
|
|
916
|
-
const a = E(e.root, g, "timing");
|
|
917
|
-
q(e.root, a), r = [{ parent: e.root, timing: a }];
|
|
918
|
-
}
|
|
919
|
-
for (const a of r) {
|
|
920
|
-
let s = a.timing;
|
|
921
|
-
!s && o.length && (s = E(a.parent, g, "timing"), q(a.parent, s)), s && sr(a.parent, s, o, t);
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
const cr = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
925
|
-
function lr(e, t) {
|
|
926
|
-
var r;
|
|
927
|
-
const n = new Map(((r = t.backgroundImage) == null ? void 0 : r.relationships.map((a) => [a.sourceId, a.targetId])) ?? []), o = (a) => {
|
|
928
|
-
for (const s of a.attributes) {
|
|
929
|
-
const i = s.namespaceUri === cr ? n.get(s.value) : null;
|
|
930
|
-
i && N(a, s.name, i, s.quote);
|
|
931
|
-
}
|
|
932
|
-
for (const s of h(a)) o(s);
|
|
933
|
-
};
|
|
934
|
-
o(e);
|
|
935
|
-
}
|
|
936
|
-
function Nt(e) {
|
|
937
|
-
return D(e.ovr, "background") || D(e.ovr, "hidden") || D(e.ovr, "transition") || D(e.ovr, "animations");
|
|
938
|
-
}
|
|
939
|
-
function fr(e, t) {
|
|
940
|
-
const n = I(e.root, {
|
|
941
|
-
localName: "cSld",
|
|
942
|
-
namespaceUri: g
|
|
943
|
-
});
|
|
944
|
-
if (!n) throw new Error(`幻灯片 ${t.id} 缺少 p:cSld`);
|
|
945
|
-
return n;
|
|
946
|
-
}
|
|
947
|
-
function pr(e, t, n) {
|
|
948
|
-
var s, i;
|
|
949
|
-
const o = (s = e.package) == null ? void 0 : s.parts[U(t)];
|
|
950
|
-
if (!o) return null;
|
|
951
|
-
const r = h(x(o).root, { localName: "Relationship" }).find((c) => {
|
|
952
|
-
var f;
|
|
953
|
-
return (f = M(c, { localName: "Type", namespaceUri: null })) == null ? void 0 : f.value.endsWith(n);
|
|
954
|
-
}), a = r && ((i = M(r, { localName: "Target", namespaceUri: null })) == null ? void 0 : i.value);
|
|
955
|
-
return a ? ie(t, a) : null;
|
|
956
|
-
}
|
|
957
|
-
function mr(e, t) {
|
|
958
|
-
var i;
|
|
959
|
-
const n = (i = e.package) == null ? void 0 : i.parts[t];
|
|
960
|
-
if (!n) return { found: !1, image: null };
|
|
961
|
-
const o = I(x(n).root, {
|
|
962
|
-
localName: "cSld",
|
|
963
|
-
namespaceUri: g
|
|
964
|
-
}), r = o && I(o, {
|
|
965
|
-
localName: "bg",
|
|
966
|
-
namespaceUri: g
|
|
967
|
-
});
|
|
968
|
-
if (!r) return { found: !1, image: null };
|
|
969
|
-
const a = I(r, {
|
|
970
|
-
localName: "bgPr",
|
|
971
|
-
namespaceUri: g
|
|
972
|
-
});
|
|
973
|
-
return { found: !0, image: a && I(a, {
|
|
974
|
-
localName: "blipFill",
|
|
975
|
-
namespaceUri: L
|
|
976
|
-
}) ? r : null };
|
|
977
|
-
}
|
|
978
|
-
function ur(e, t) {
|
|
979
|
-
var o;
|
|
980
|
-
if (((o = t.src.background) == null ? void 0 : o.type) !== "image" || !t.layoutId) return null;
|
|
981
|
-
const n = pr(e, t.layoutId, "/slideMaster");
|
|
982
|
-
for (const r of [t.layoutId, n]) {
|
|
983
|
-
if (!r) continue;
|
|
984
|
-
const a = mr(e, r);
|
|
985
|
-
if (a.found) return a.image;
|
|
986
|
-
}
|
|
987
|
-
return null;
|
|
988
|
-
}
|
|
989
|
-
function dr(e, t, n) {
|
|
990
|
-
if (!D(n.ovr, "background")) return;
|
|
991
|
-
const o = n.ovr.background;
|
|
992
|
-
(o == null ? void 0 : o.type) === "image" ? kt(o, `幻灯片 ${n.id} 的背景覆盖`) : Et(o, `幻灯片 ${n.id} 的背景覆盖`);
|
|
993
|
-
const r = fr(e, n);
|
|
994
|
-
let a = I(r, {
|
|
995
|
-
localName: "bg",
|
|
996
|
-
namespaceUri: g
|
|
997
|
-
});
|
|
998
|
-
if (!a) {
|
|
999
|
-
const i = o.type === "image" ? ur(t, n) : null;
|
|
1000
|
-
a = i ? ee(i) : E(r, g, "bg"), i && lr(a, n), q(r, a);
|
|
1001
|
-
}
|
|
1002
|
-
let s = I(a, {
|
|
1003
|
-
localName: "bgPr",
|
|
1004
|
-
namespaceUri: g
|
|
1005
|
-
});
|
|
1006
|
-
for (const i of [...h(a)])
|
|
1007
|
-
i.namespaceUri === g && i.localName === "bgRef" && T(a, i);
|
|
1008
|
-
if (s || (s = E(a, g, "bgPr"), q(a, s)), o.type === "image") {
|
|
1009
|
-
const i = n.backgroundImage;
|
|
1010
|
-
if (!i) throw new Error(`幻灯片 ${n.id} 的图片背景缺少关系`);
|
|
1011
|
-
En(
|
|
1012
|
-
s,
|
|
1013
|
-
o,
|
|
1014
|
-
i.imageRelationshipId,
|
|
1015
|
-
i.sourcePart !== void 0
|
|
1016
|
-
);
|
|
1017
|
-
} else
|
|
1018
|
-
xt(s), Mt(s, o);
|
|
1019
|
-
}
|
|
1020
|
-
function hr(e, t, n) {
|
|
1021
|
-
var o;
|
|
1022
|
-
if (Nt(n)) {
|
|
1023
|
-
if (D(n.ovr, "hidden") && (n.ovr.hidden ? N(e.root, "show", "0") : K(e.root, "show")), D(n.ovr, "transition")) {
|
|
1024
|
-
const r = n.layoutId ? (o = t.layouts[n.layoutId]) == null ? void 0 : o.transition : void 0;
|
|
1025
|
-
_n(
|
|
1026
|
-
e,
|
|
1027
|
-
n.ovr.transition,
|
|
1028
|
-
r !== void 0
|
|
1029
|
-
);
|
|
1030
|
-
}
|
|
1031
|
-
D(n.ovr, "animations") && ir(e, t, n, n.ovr.animations), dr(e, t, n);
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
|
-
function gr(e, t) {
|
|
1035
|
-
const { host: n } = Rt(e, t), o = I(n, { localName: "spPr", namespaceUri: g });
|
|
1036
|
-
if (!o) throw new Error(`元素 ${t.id} 缺少 p:spPr`);
|
|
234
|
+
function Xt(e, s) {
|
|
235
|
+
const { host: r } = De(e, s), o = H(r, { localName: "spPr", namespaceUri: O });
|
|
236
|
+
if (!o) throw new Error(`元素 ${s.id} 缺少 p:spPr`);
|
|
1037
237
|
return o;
|
|
1038
238
|
}
|
|
1039
|
-
function
|
|
1040
|
-
if (!
|
|
1041
|
-
const
|
|
1042
|
-
for (const
|
|
1043
|
-
|
|
239
|
+
function $t(e, s, r, o) {
|
|
240
|
+
if (!r && !o) return;
|
|
241
|
+
const n = Xt(e, s);
|
|
242
|
+
for (const p of [...k(n)])
|
|
243
|
+
p.namespaceUri === R && ["prstGeom", "custGeom"].includes(p.localName) && B(n, p);
|
|
1044
244
|
if (o) {
|
|
1045
|
-
|
|
245
|
+
ve(n, ct(o));
|
|
1046
246
|
return;
|
|
1047
247
|
}
|
|
1048
|
-
if (!
|
|
1049
|
-
const
|
|
1050
|
-
|
|
1051
|
-
const
|
|
1052
|
-
|
|
1053
|
-
for (const
|
|
1054
|
-
const
|
|
1055
|
-
|
|
248
|
+
if (!r) return;
|
|
249
|
+
const i = G(n, R, "prstGeom");
|
|
250
|
+
X(i, "prst", r.preset), ve(n, i);
|
|
251
|
+
const c = G(i, R, "avLst");
|
|
252
|
+
A(i, c);
|
|
253
|
+
for (const p of Object.keys(r.adj)) {
|
|
254
|
+
const f = r.adj[p], m = G(c, R, "gd");
|
|
255
|
+
X(m, "name", p), X(m, "fmla", `val ${Math.round(f)}`), A(c, m);
|
|
1056
256
|
}
|
|
1057
257
|
}
|
|
1058
|
-
function
|
|
1059
|
-
var
|
|
1060
|
-
const
|
|
1061
|
-
|
|
258
|
+
function jt(e, s, r, o, n) {
|
|
259
|
+
var p;
|
|
260
|
+
const i = s.meta.placeholderDirect ?? 0, c = !!(i & L.style);
|
|
261
|
+
i & L.transform || $e(e, s, r), (s.src.kind === "shape" || s.src.kind === "image") && !(i & L.geometry) && $t(e, s, o, n), s.src.kind === "shape" && r.kind === "shape" ? (!c && !(i & L.fill) && je(
|
|
1062
262
|
e,
|
|
1063
|
-
|
|
1064
|
-
((
|
|
1065
|
-
), !
|
|
263
|
+
s,
|
|
264
|
+
((p = r.fill) == null ? void 0 : p.type) === "image" ? { type: "none" } : r.fill
|
|
265
|
+
), !c && !(i & L.stroke) && r.stroke && ye(e, s, r.stroke)) : s.src.kind === "image" && r.kind === "image" && !c && !(i & L.stroke) && r.stroke && ye(e, s, r.stroke), (s.src.kind === "shape" || s.src.kind === "image" || s.src.kind === "group") && !c && !(i & L.effects) && r.effects && Ae(e, s, r.effects);
|
|
1066
266
|
}
|
|
1067
|
-
function
|
|
1068
|
-
return e &&
|
|
1069
|
-
localName:
|
|
1070
|
-
...
|
|
267
|
+
function U(e, s, r) {
|
|
268
|
+
return e && H(e, {
|
|
269
|
+
localName: s,
|
|
270
|
+
...r ? { namespaceUri: r } : {}
|
|
1071
271
|
});
|
|
1072
272
|
}
|
|
1073
|
-
function
|
|
1074
|
-
var
|
|
1075
|
-
return e ? ((
|
|
273
|
+
function ee(e, s) {
|
|
274
|
+
var r;
|
|
275
|
+
return e ? ((r = C(e, { localName: s })) == null ? void 0 : r.value) ?? null : null;
|
|
1076
276
|
}
|
|
1077
|
-
function
|
|
1078
|
-
const
|
|
277
|
+
function At(e) {
|
|
278
|
+
const s = k(e).find((n) => [
|
|
1079
279
|
"nvSpPr",
|
|
1080
280
|
"nvPicPr",
|
|
1081
281
|
"nvCxnSpPr",
|
|
1082
282
|
"nvGraphicFramePr"
|
|
1083
|
-
].includes(
|
|
1084
|
-
if (!
|
|
1085
|
-
const o =
|
|
1086
|
-
return { type:
|
|
283
|
+
].includes(n.localName)) ?? null, r = U(U(s, "nvPr", O), "ph", O);
|
|
284
|
+
if (!r) return null;
|
|
285
|
+
const o = ee(r, "idx");
|
|
286
|
+
return { type: ee(r, "type") ?? "obj", ...o === null ? {} : { idx: o } };
|
|
1087
287
|
}
|
|
1088
|
-
function
|
|
288
|
+
function xe(e, s) {
|
|
1089
289
|
if (!e) return;
|
|
1090
|
-
const
|
|
1091
|
-
|
|
290
|
+
const r = U(
|
|
291
|
+
U(e.root, "cSld", O),
|
|
1092
292
|
"spTree",
|
|
1093
|
-
|
|
293
|
+
O
|
|
1094
294
|
);
|
|
1095
|
-
if (!
|
|
1096
|
-
const o =
|
|
1097
|
-
|
|
295
|
+
if (!r) return;
|
|
296
|
+
const o = wt(
|
|
297
|
+
k(r).filter((i) => [
|
|
1098
298
|
"sp",
|
|
1099
299
|
"pic",
|
|
1100
300
|
"cxnSp",
|
|
1101
301
|
"graphicFrame"
|
|
1102
|
-
].includes(
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
),
|
|
1106
|
-
return
|
|
1107
|
-
}
|
|
1108
|
-
function
|
|
1109
|
-
const
|
|
1110
|
-
var
|
|
1111
|
-
if (!
|
|
1112
|
-
const
|
|
1113
|
-
|
|
302
|
+
].includes(i.localName)),
|
|
303
|
+
At,
|
|
304
|
+
s
|
|
305
|
+
), n = o ? U(o, "spPr", O) : null;
|
|
306
|
+
return U(n, "custGeom", R) ?? U(n, "prstGeom", R) ?? void 0;
|
|
307
|
+
}
|
|
308
|
+
function Dt(e) {
|
|
309
|
+
const s = /* @__PURE__ */ new Map(), r = (n) => {
|
|
310
|
+
var i;
|
|
311
|
+
if (!s.has(n)) {
|
|
312
|
+
const c = (i = e.package) == null ? void 0 : i.parts[n];
|
|
313
|
+
s.set(n, c ? E(c) : null);
|
|
1114
314
|
}
|
|
1115
|
-
return
|
|
1116
|
-
}, o = (
|
|
1117
|
-
const
|
|
1118
|
-
var
|
|
1119
|
-
return
|
|
1120
|
-
}),
|
|
1121
|
-
return
|
|
315
|
+
return s.get(n) ?? null;
|
|
316
|
+
}, o = (n) => {
|
|
317
|
+
const i = r(x(n)), c = i && k(i.root).find((f) => {
|
|
318
|
+
var m;
|
|
319
|
+
return f.localName === "Relationship" && ((m = ee(f, "Type")) == null ? void 0 : m.endsWith("/slideMaster"));
|
|
320
|
+
}), p = c ? ee(c, "Target") : null;
|
|
321
|
+
return p ? oe(n, p) : null;
|
|
1122
322
|
};
|
|
1123
|
-
return (
|
|
1124
|
-
const
|
|
1125
|
-
if (!(!
|
|
1126
|
-
return
|
|
323
|
+
return (n, i) => {
|
|
324
|
+
const c = n.sourceLayoutId, p = i.meta.ph;
|
|
325
|
+
if (!(!c || !p))
|
|
326
|
+
return xe(r(c), p) ?? (o(c) ? xe(r(o(c)), p) : void 0);
|
|
1127
327
|
};
|
|
1128
328
|
}
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
})
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
}
|
|
1157
|
-
function st(e, t) {
|
|
1158
|
-
for (const n of [...e.children]) T(e, n);
|
|
1159
|
-
w(e, ke(t));
|
|
1160
|
-
}
|
|
1161
|
-
function Tr(e, t) {
|
|
1162
|
-
const n = e ? Ye(e) : B("a:p", { selfClosing: !1 });
|
|
1163
|
-
let o = Le(n, { localName: "t" });
|
|
1164
|
-
if (!o) {
|
|
1165
|
-
const s = n.prefix ? `${n.prefix}:` : "", i = B(`${s}r`, { selfClosing: !1 }), c = h(n).find((f) => f.localName === "endParaRPr");
|
|
1166
|
-
if (c) {
|
|
1167
|
-
const f = B(`${s}rPr`);
|
|
1168
|
-
for (const v of c.attributes)
|
|
1169
|
-
N(f, v.name, v.value, v.quote);
|
|
1170
|
-
for (const v of c.children)
|
|
1171
|
-
w(f, Ye(v));
|
|
1172
|
-
w(i, f);
|
|
1173
|
-
}
|
|
1174
|
-
o = B(`${s}t`, { selfClosing: !1 }), w(i, o), w(n, i, c ?? null);
|
|
1175
|
-
}
|
|
1176
|
-
st(o, t);
|
|
1177
|
-
let r = !1;
|
|
1178
|
-
const a = (s) => {
|
|
1179
|
-
for (const i of h(s))
|
|
1180
|
-
i.localName === "t" ? r ? st(i, "") : r = !0 : a(i);
|
|
1181
|
-
};
|
|
1182
|
-
return a(n), n;
|
|
1183
|
-
}
|
|
1184
|
-
function it(e, t) {
|
|
1185
|
-
const n = x(e), o = Sr(n.root), r = h(o, {
|
|
1186
|
-
localName: "p",
|
|
1187
|
-
namespaceUri: L
|
|
1188
|
-
});
|
|
1189
|
-
for (const a of r) T(o, a);
|
|
1190
|
-
for (const [a, s] of t.split(`
|
|
1191
|
-
`).entries()) {
|
|
1192
|
-
const i = r[a] ?? r[r.length - 1] ?? null;
|
|
1193
|
-
w(o, Tr(i, s));
|
|
1194
|
-
}
|
|
1195
|
-
return X(n);
|
|
1196
|
-
}
|
|
1197
|
-
function wr() {
|
|
1198
|
-
return new TextEncoder().encode(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
1199
|
-
<p:notes xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">
|
|
1200
|
-
<p:cSld><p:spTree>
|
|
1201
|
-
<p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr>
|
|
1202
|
-
<p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr>
|
|
1203
|
-
<p:sp><p:nvSpPr><p:cNvPr id="2" name="备注正文"/><p:cNvSpPr/><p:nvPr><p:ph type="body" idx="1"/></p:nvPr></p:nvSpPr><p:spPr/><p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:r><a:t></a:t></a:r></a:p></p:txBody></p:sp>
|
|
1204
|
-
</p:spTree></p:cSld><p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>
|
|
1205
|
-
</p:notes>`);
|
|
1206
|
-
}
|
|
1207
|
-
const _ = (e, t) => {
|
|
1208
|
-
var n;
|
|
1209
|
-
return (n = e.attributes.find((o) => o.localName === t && o.namespaceUri === null)) == null ? void 0 : n.value;
|
|
1210
|
-
};
|
|
1211
|
-
function br(e, t, n) {
|
|
1212
|
-
const o = x(e);
|
|
1213
|
-
let r = !1;
|
|
1214
|
-
for (const a of h(o.root, { localName: "Relationship" }))
|
|
1215
|
-
_(a, "Type") !== t || _(a, "TargetMode") === "External" || (N(a, "Target", n), K(a, "TargetMode"), r = !0);
|
|
1216
|
-
return { bytes: r ? X(o) : e, found: r };
|
|
1217
|
-
}
|
|
1218
|
-
function kr(e) {
|
|
1219
|
-
const t = new Set(e ? h(
|
|
1220
|
-
x(e).root,
|
|
1221
|
-
{ localName: "Relationship" }
|
|
1222
|
-
).flatMap((n) => _(n, "Id") ?? []) : []);
|
|
1223
|
-
for (let n = 1; Number.isSafeInteger(n); n++) {
|
|
1224
|
-
const o = `rId${n}`;
|
|
1225
|
-
if (!t.has(o)) return o;
|
|
1226
|
-
}
|
|
1227
|
-
throw new Error("备注页的页面回指关系身份已耗尽");
|
|
1228
|
-
}
|
|
1229
|
-
function Er(e, t, n) {
|
|
1230
|
-
const o = Y(t, n);
|
|
1231
|
-
if (e) {
|
|
1232
|
-
const a = br(e, at, o);
|
|
1233
|
-
if (a.found) return a.bytes;
|
|
1234
|
-
}
|
|
1235
|
-
const r = kr(e);
|
|
1236
|
-
return z(e, [{
|
|
1237
|
-
sourceId: r,
|
|
1238
|
-
targetId: r,
|
|
1239
|
-
type: at,
|
|
1240
|
-
target: o
|
|
1241
|
-
}]);
|
|
1242
|
-
}
|
|
1243
|
-
function ct(e, t) {
|
|
1244
|
-
if (!e.origin) throw new Error(`页面 ${e.id} 缺少 notes 关系宿主`);
|
|
1245
|
-
if (!t)
|
|
1246
|
-
return e.notes ? z(void 0, [{
|
|
1247
|
-
sourceId: e.notes.relationshipId,
|
|
1248
|
-
targetId: e.notes.relationshipId,
|
|
1249
|
-
type: fe,
|
|
1250
|
-
target: Y(e.origin.part, e.notes.targetPart)
|
|
1251
|
-
}]) : z(void 0, []);
|
|
1252
|
-
const n = x(t), o = h(n.root, { localName: "Relationship" });
|
|
1253
|
-
if (!e.notes) {
|
|
1254
|
-
let s = !1;
|
|
1255
|
-
for (const i of o)
|
|
1256
|
-
_(i, "Type") === fe && _(i, "TargetMode") !== "External" && (T(n.root, i), s = !0);
|
|
1257
|
-
return s ? X(n) : t;
|
|
1258
|
-
}
|
|
1259
|
-
const r = o.find((s) => _(s, "Id") === e.notes.relationshipId);
|
|
1260
|
-
if (!r) return z(t, [{
|
|
1261
|
-
sourceId: e.notes.relationshipId,
|
|
1262
|
-
targetId: e.notes.relationshipId,
|
|
1263
|
-
type: fe,
|
|
1264
|
-
target: Y(e.origin.part, e.notes.targetPart)
|
|
1265
|
-
}]);
|
|
1266
|
-
if (_(r, "Type") !== fe)
|
|
1267
|
-
throw new Error(`页面 ${e.id} 的 notes 关系 id 与其它关系冲突`);
|
|
1268
|
-
const a = Y(e.origin.part, e.notes.targetPart);
|
|
1269
|
-
return _(r, "Target") === a && _(r, "TargetMode") === void 0 ? t : (N(r, "Target", a), K(r, "TargetMode"), X(n));
|
|
1270
|
-
}
|
|
1271
|
-
function xr(e, t, n) {
|
|
1272
|
-
var a;
|
|
1273
|
-
const o = t.origin && U(t.origin.part), r = o && ((a = e.package) == null ? void 0 : a.parts[o]);
|
|
1274
|
-
return !r || !t.origin ? !1 : h(x(r).root, { localName: "Relationship" }).some((s) => {
|
|
1275
|
-
const i = _(s, "Target");
|
|
1276
|
-
return _(s, "Type") === fe && _(s, "TargetMode") !== "External" && !!i && n.has(ie(t.origin.part, i));
|
|
1277
|
-
});
|
|
1278
|
-
}
|
|
1279
|
-
function Mr(e, t, n) {
|
|
1280
|
-
var a, s, i;
|
|
1281
|
-
const o = new Set([...n].filter(Ot));
|
|
1282
|
-
for (const c of Object.values(e.slides)) {
|
|
1283
|
-
const f = c.notes;
|
|
1284
|
-
if (f) {
|
|
1285
|
-
if (o.has(f.targetPart) || !((a = e.package) != null && a.parts[f.targetPart]) && !t[f.targetPart])
|
|
1286
|
-
o.add(f.targetPart), n.add(f.targetPart), n.add(U(f.targetPart));
|
|
1287
|
-
else if (D(c.ovr, "notes") && !t[f.targetPart]) {
|
|
1288
|
-
const v = f.sourcePart ?? f.targetPart, p = (s = e.package) == null ? void 0 : s.parts[v];
|
|
1289
|
-
if (!p) throw new Error(`找不到备注保存基线:${v}`);
|
|
1290
|
-
t[f.targetPart] = p.slice();
|
|
1291
|
-
}
|
|
1292
|
-
}
|
|
1293
|
-
}
|
|
1294
|
-
const r = /* @__PURE__ */ new Map();
|
|
1295
|
-
for (const c of Object.values(e.slides)) {
|
|
1296
|
-
if (!c.origin || !(!!c.notes && o.has(c.notes.targetPart) || xr(e, c, o)) || (r.set(c.origin.part, c), c.creation)) continue;
|
|
1297
|
-
const v = U(c.origin.part);
|
|
1298
|
-
if (t[v] || n.has(v)) continue;
|
|
1299
|
-
const p = (i = e.package) == null ? void 0 : i.parts[v];
|
|
1300
|
-
p ? t[v] = p.slice() : n.add(v);
|
|
1301
|
-
}
|
|
1302
|
-
return { relationshipSlides: r, trackedParts: o };
|
|
1303
|
-
}
|
|
1304
|
-
function Ur(e, t, n, o) {
|
|
1305
|
-
var r, a, s;
|
|
1306
|
-
for (const i of Object.values(e.slides)) {
|
|
1307
|
-
const c = i.notes;
|
|
1308
|
-
if (!c) continue;
|
|
1309
|
-
if (n.trackedParts.has(c.targetPart)) {
|
|
1310
|
-
const m = c.sourcePart ? t[c.sourcePart] ?? ((r = e.package) == null ? void 0 : r.parts[c.sourcePart]) : void 0;
|
|
1311
|
-
if (c.sourcePart && !m) throw new Error(`找不到备注克隆来源:${c.sourcePart}`);
|
|
1312
|
-
const u = D(i.ovr, "notes") ? i.ovr.notes : i.src.notes ?? "";
|
|
1313
|
-
o[c.targetPart] = it(m ?? wr(), u);
|
|
1314
|
-
const y = c.sourcePart ? t[U(c.sourcePart)] ?? ((a = e.package) == null ? void 0 : a.parts[U(c.sourcePart)]) : void 0;
|
|
1315
|
-
o[U(c.targetPart)] = Er(
|
|
1316
|
-
y,
|
|
1317
|
-
c.targetPart,
|
|
1318
|
-
i.origin.part
|
|
1319
|
-
);
|
|
1320
|
-
continue;
|
|
1321
|
-
}
|
|
1322
|
-
const f = t[c.targetPart];
|
|
1323
|
-
if (!f) continue;
|
|
1324
|
-
const v = (s = e.package) == null ? void 0 : s.parts[c.targetPart];
|
|
1325
|
-
(D(i.ovr, "notes") || v && (v.length !== f.length || v.some((m, u) => m !== f[u]))) && (o[c.targetPart] = D(i.ovr, "notes") ? it(f, i.ovr.notes) : f);
|
|
1326
|
-
}
|
|
1327
|
-
}
|
|
1328
|
-
function Ir(e) {
|
|
1329
|
-
const t = /* @__PURE__ */ new Map();
|
|
1330
|
-
return e.slideOrder.forEach((n, o) => {
|
|
1331
|
-
var s;
|
|
1332
|
-
const r = e.slides[n], a = (s = r.origin) == null ? void 0 : s.part;
|
|
1333
|
-
a && r.dynamicSlideNumbers.some((i) => {
|
|
1334
|
-
var f;
|
|
1335
|
-
const c = e.elements[i];
|
|
1336
|
-
return ((f = c == null ? void 0 : c.meta.origin) == null ? void 0 : f.part) === a && Jt(pt(e, i));
|
|
1337
|
-
}) && t.set(a, o + 1);
|
|
1338
|
-
}), t;
|
|
1339
|
-
}
|
|
1340
|
-
function Cr(e) {
|
|
1341
|
-
const t = /* @__PURE__ */ new Map();
|
|
1342
|
-
for (const n of Object.values(e.elements)) {
|
|
1343
|
-
if (!Gt(n) && !zt(n) && !Ht(n) && !qt(n) && !Vt(n) && !Wt(n) && !Yt(n) && !Kt(n) && !ft(n) && !n.meta.insertion) continue;
|
|
1344
|
-
const o = n.meta.origin;
|
|
1345
|
-
if (!o) throw new Error(`元素 ${n.id} 缺少 OOXML 回写锚点`);
|
|
1346
|
-
const r = t.get(o.part) ?? [];
|
|
1347
|
-
r.push(n), t.set(o.part, r);
|
|
1348
|
-
}
|
|
1349
|
-
return t;
|
|
1350
|
-
}
|
|
1351
|
-
function Rr(e) {
|
|
1352
|
-
const t = /* @__PURE__ */ new Map();
|
|
1353
|
-
for (const n of Object.values(e.removedElements)) {
|
|
1354
|
-
const o = n.meta.origin;
|
|
329
|
+
function Bt(e) {
|
|
330
|
+
const s = /* @__PURE__ */ new Map();
|
|
331
|
+
return e.slideOrder.forEach((r, o) => {
|
|
332
|
+
var c;
|
|
333
|
+
const n = e.slides[r], i = (c = n.origin) == null ? void 0 : c.part;
|
|
334
|
+
i && n.dynamicSlideNumbers.some((p) => {
|
|
335
|
+
var m;
|
|
336
|
+
const f = e.elements[p];
|
|
337
|
+
return ((m = f == null ? void 0 : f.meta.origin) == null ? void 0 : m.part) === i && nt(Ie(e, p));
|
|
338
|
+
}) && s.set(i, o + 1);
|
|
339
|
+
}), s;
|
|
340
|
+
}
|
|
341
|
+
function _t(e) {
|
|
342
|
+
const s = /* @__PURE__ */ new Map();
|
|
343
|
+
for (const r of Object.values(e.elements)) {
|
|
344
|
+
if (!qe(r) && !Je(r) && !Ke(r) && !Ve(r) && !Qe(r) && !Ze(r) && !et(r) && !tt(r) && !rt(r) && !st(r) && !Ee(r) && r.meta.sourceParent === void 0 && !r.meta.insertion) continue;
|
|
345
|
+
const o = r.meta.origin;
|
|
346
|
+
if (!o) throw new Error(`元素 ${r.id} 缺少 OOXML 回写锚点`);
|
|
347
|
+
const n = s.get(o.part) ?? [];
|
|
348
|
+
n.push(r), s.set(o.part, n);
|
|
349
|
+
}
|
|
350
|
+
return s;
|
|
351
|
+
}
|
|
352
|
+
function zt(e) {
|
|
353
|
+
const s = /* @__PURE__ */ new Map();
|
|
354
|
+
for (const r of Object.values(e.removedElements)) {
|
|
355
|
+
const o = r.meta.origin;
|
|
1355
356
|
if (!o) continue;
|
|
1356
|
-
const
|
|
1357
|
-
|
|
357
|
+
const n = s.get(o.part) ?? [];
|
|
358
|
+
n.push(r), s.set(o.part, n);
|
|
1358
359
|
}
|
|
1359
|
-
return
|
|
360
|
+
return s;
|
|
1360
361
|
}
|
|
1361
|
-
function
|
|
1362
|
-
var
|
|
1363
|
-
const
|
|
362
|
+
function Gt(e) {
|
|
363
|
+
var r;
|
|
364
|
+
const s = /* @__PURE__ */ new Map();
|
|
1364
365
|
for (const o of Object.values(e.slides)) {
|
|
1365
|
-
if (!
|
|
1366
|
-
const
|
|
1367
|
-
if (!
|
|
1368
|
-
|
|
366
|
+
if (!kt(o)) continue;
|
|
367
|
+
const n = (r = o.origin) == null ? void 0 : r.part;
|
|
368
|
+
if (!n) throw new Error(`幻灯片 ${o.id} 缺少 OOXML 回写锚点`);
|
|
369
|
+
s.set(n, o);
|
|
1369
370
|
}
|
|
1370
|
-
return
|
|
371
|
+
return s;
|
|
1371
372
|
}
|
|
1372
|
-
function
|
|
1373
|
-
var
|
|
1374
|
-
if (
|
|
373
|
+
function Kt(e) {
|
|
374
|
+
var de, ue, me, he;
|
|
375
|
+
if (Be(e), e.meta.readonly) throw new Error("只读编辑文档不能保存");
|
|
1375
376
|
if (e.meta.source !== "pptx" || !e.package)
|
|
1376
377
|
throw new Error("当前版本尚未实现生成式 PPTX 保存");
|
|
1377
|
-
const
|
|
1378
|
-
const
|
|
1379
|
-
return
|
|
1380
|
-
})),
|
|
378
|
+
const s = _t(e), r = Gt(e), o = new Set([...s].flatMap(([t, a]) => a.some(Ee) ? [t] : [])), n = zt(e), i = pt(e), c = te(e), p = new Map(Object.values(e.slides).flatMap((t) => t.layoutId !== t.sourceLayoutId && t.origin ? [[t.origin.part, t]] : [])), f = new Map(Object.values(e.slides).flatMap((t) => {
|
|
379
|
+
const a = _e(e, t.id);
|
|
380
|
+
return t.origin && a.length ? [[t.origin.part, a]] : [];
|
|
381
|
+
})), m = new Map(Object.values(e.slides).flatMap((t) => t.origin ? [[t.origin.part, t]] : [])), N = Dt(e), l = Object.assign(
|
|
1381
382
|
/* @__PURE__ */ Object.create(null),
|
|
1382
383
|
e.saveState.baselines
|
|
1383
|
-
),
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
const
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
384
|
+
), P = new Set(e.saveState.createdParts), d = "[Content_Types].xml", h = "ppt/presentation.xml", S = "ppt/_rels/presentation.xml.rels", g = ft(e);
|
|
385
|
+
if (g != null && g.definitions.length && !l[g.part]) {
|
|
386
|
+
const t = e.package.parts[g.part];
|
|
387
|
+
if (t) l[g.part] = t.slice();
|
|
388
|
+
else {
|
|
389
|
+
P.add(g.part);
|
|
390
|
+
for (const a of [d, S]) {
|
|
391
|
+
if (l[a]) continue;
|
|
392
|
+
const u = e.package.parts[a];
|
|
393
|
+
if (!u) throw new Error(`PPTX 缺少 ${a}`);
|
|
394
|
+
l[a] = u.slice();
|
|
395
|
+
}
|
|
1393
396
|
}
|
|
1394
|
-
const Me = /* @__PURE__ */ new Set([...o, ...Fe]), _e = $e.length !== e.saveState.sourceSlideParts.length || $e.some((l, d) => l !== e.saveState.sourceSlideParts[d]), Pt = J || de || _e || !!p[y];
|
|
1395
|
-
if (_e && !p[y]) {
|
|
1396
|
-
const l = e.package.parts[y];
|
|
1397
|
-
if (!l) throw new Error("PPTX 缺少 ppt/presentation.xml");
|
|
1398
|
-
p[y] = l.slice();
|
|
1399
397
|
}
|
|
1400
|
-
const
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
398
|
+
const I = dt(e, l, P), re = c.length > 0 || [...P].some((t) => /^ppt\/slides\/slide\d+\.xml$/.test(t)), ie = e.slideOrder.flatMap((t) => {
|
|
399
|
+
var a;
|
|
400
|
+
return ((a = e.slides[t].origin) == null ? void 0 : a.part) ?? [];
|
|
401
|
+
}), _ = ze(e, P), W = _.slideParts.size > 0, le = /* @__PURE__ */ new Set();
|
|
402
|
+
if (W)
|
|
403
|
+
for (const t of e.slideOrder) {
|
|
404
|
+
const a = e.slides[t], u = (de = a.origin) == null ? void 0 : de.part;
|
|
405
|
+
if (!u) continue;
|
|
406
|
+
const y = x(u), b = l[y] ?? (a.creation ? Q(e, a, l) : void 0) ?? e.package.parts[y];
|
|
407
|
+
Ge(e, u, b) && le.add(u);
|
|
408
|
+
}
|
|
409
|
+
const se = /* @__PURE__ */ new Set([...o, ...le]), ce = ie.length !== e.saveState.sourceSlideParts.length || ie.some((t, a) => t !== e.saveState.sourceSlideParts[a]), Le = re || W || ce || !!l[h];
|
|
410
|
+
if (ce && !l[h]) {
|
|
411
|
+
const t = e.package.parts[h];
|
|
412
|
+
if (!t) throw new Error("PPTX 缺少 ppt/presentation.xml");
|
|
413
|
+
l[h] = t.slice();
|
|
414
|
+
}
|
|
415
|
+
const Y = Le ? Bt(e) : /* @__PURE__ */ new Map();
|
|
416
|
+
for (const t of /* @__PURE__ */ new Set([
|
|
417
|
+
...s.keys(),
|
|
1404
418
|
...r.keys(),
|
|
1405
|
-
...
|
|
1406
|
-
...
|
|
1407
|
-
...
|
|
419
|
+
...n.keys(),
|
|
420
|
+
...Y.keys(),
|
|
421
|
+
...se,
|
|
422
|
+
...f.keys()
|
|
1408
423
|
])) {
|
|
1409
|
-
if (
|
|
1410
|
-
var
|
|
1411
|
-
return ((
|
|
424
|
+
if (l[t] || c.some((u) => {
|
|
425
|
+
var y;
|
|
426
|
+
return ((y = u.origin) == null ? void 0 : y.part) === t;
|
|
1412
427
|
})) continue;
|
|
1413
|
-
const
|
|
1414
|
-
if (!
|
|
1415
|
-
|
|
1416
|
-
}
|
|
1417
|
-
for (const
|
|
1418
|
-
const
|
|
1419
|
-
if (
|
|
1420
|
-
const
|
|
1421
|
-
|
|
1422
|
-
}
|
|
1423
|
-
for (const
|
|
1424
|
-
const
|
|
1425
|
-
if (
|
|
1426
|
-
const
|
|
1427
|
-
|
|
1428
|
-
}
|
|
1429
|
-
for (const [
|
|
1430
|
-
if (
|
|
1431
|
-
const
|
|
1432
|
-
if (
|
|
1433
|
-
const
|
|
1434
|
-
|
|
1435
|
-
}
|
|
1436
|
-
for (const
|
|
1437
|
-
if (
|
|
1438
|
-
const
|
|
1439
|
-
|
|
1440
|
-
}
|
|
1441
|
-
if ((
|
|
1442
|
-
const
|
|
1443
|
-
if (!
|
|
1444
|
-
|
|
1445
|
-
}
|
|
1446
|
-
if (
|
|
1447
|
-
for (const
|
|
1448
|
-
if (
|
|
1449
|
-
const
|
|
1450
|
-
if (!
|
|
1451
|
-
|
|
428
|
+
const a = e.package.parts[t];
|
|
429
|
+
if (!a) throw new Error(`找不到待写回的 OPC part:${t}`);
|
|
430
|
+
l[t] = a.slice();
|
|
431
|
+
}
|
|
432
|
+
for (const t of i.relationships.keys()) {
|
|
433
|
+
const a = x(t);
|
|
434
|
+
if (l[a] || P.has(a)) continue;
|
|
435
|
+
const u = e.package.parts[a];
|
|
436
|
+
u ? l[a] = u.slice() : P.add(a);
|
|
437
|
+
}
|
|
438
|
+
for (const t of se) {
|
|
439
|
+
const a = x(t);
|
|
440
|
+
if (l[a] || P.has(a)) continue;
|
|
441
|
+
const u = e.package.parts[a];
|
|
442
|
+
u ? l[a] = u.slice() : P.add(a);
|
|
443
|
+
}
|
|
444
|
+
for (const [t, a] of p) {
|
|
445
|
+
if (a.creation) continue;
|
|
446
|
+
const u = x(t);
|
|
447
|
+
if (l[u] || P.has(u)) continue;
|
|
448
|
+
const y = e.package.parts[u];
|
|
449
|
+
y ? l[u] = y.slice() : P.add(u);
|
|
450
|
+
}
|
|
451
|
+
for (const t of _.packageParts) {
|
|
452
|
+
if (P.has(t) || l[t]) continue;
|
|
453
|
+
const a = e.package.parts[t];
|
|
454
|
+
a && (l[t] = a.slice());
|
|
455
|
+
}
|
|
456
|
+
if ((i.resources.size || re || W || I.trackedParts.size) && !l[d]) {
|
|
457
|
+
const t = e.package.parts[d];
|
|
458
|
+
if (!t) throw new Error("PPTX 缺少 [Content_Types].xml");
|
|
459
|
+
l[d] = t.slice();
|
|
460
|
+
}
|
|
461
|
+
if (re || W)
|
|
462
|
+
for (const t of [h, S]) {
|
|
463
|
+
if (l[t]) continue;
|
|
464
|
+
const a = e.package.parts[t];
|
|
465
|
+
if (!a) throw new Error(`PPTX 缺少 ${t}`);
|
|
466
|
+
l[t] = a.slice();
|
|
1452
467
|
}
|
|
1453
|
-
for (const
|
|
1454
|
-
const
|
|
1455
|
-
|
|
1456
|
-
}
|
|
1457
|
-
for (const
|
|
1458
|
-
|
|
1459
|
-
const
|
|
1460
|
-
for (const
|
|
1461
|
-
for (const [
|
|
1462
|
-
!e.package.parts[
|
|
1463
|
-
const
|
|
1464
|
-
var
|
|
1465
|
-
const
|
|
1466
|
-
return
|
|
1467
|
-
})),
|
|
1468
|
-
for (const
|
|
1469
|
-
const
|
|
1470
|
-
var
|
|
1471
|
-
return ((
|
|
1472
|
-
}),
|
|
1473
|
-
if (!
|
|
1474
|
-
const
|
|
468
|
+
for (const t of c) {
|
|
469
|
+
const a = t.origin.part;
|
|
470
|
+
P.add(a), P.add(x(a));
|
|
471
|
+
}
|
|
472
|
+
for (const t of i.resources.values())
|
|
473
|
+
t.created && P.add(t.targetPart);
|
|
474
|
+
const v = /* @__PURE__ */ Object.create(null);
|
|
475
|
+
for (const t of P) v[t] = null;
|
|
476
|
+
for (const [t, a] of Object.entries(l))
|
|
477
|
+
!e.package.parts[t] && !_.packageParts.has(t) && !P.has(t) && (v[t] = a);
|
|
478
|
+
const Ue = new Set(e.slideOrder.flatMap((t) => {
|
|
479
|
+
var y;
|
|
480
|
+
const a = e.slides[t], u = (y = a.origin) == null ? void 0 : y.part;
|
|
481
|
+
return u && (l[u] || a.creation || Y.has(u)) ? [u] : [];
|
|
482
|
+
})), ne = /* @__PURE__ */ new Map();
|
|
483
|
+
for (const t of Ue) {
|
|
484
|
+
const a = c.find((M) => {
|
|
485
|
+
var $;
|
|
486
|
+
return (($ = M.origin) == null ? void 0 : $.part) === t;
|
|
487
|
+
}), u = l[t] ?? (a ? Lt(e, a, l) ?? xt() : void 0);
|
|
488
|
+
if (!u) throw new Error(`找不到页面保存基线:${t}`);
|
|
489
|
+
const y = E(u), b = s.get(t) ?? [], q = x(t), J = l[q] ?? (a ? Q(e, a, l) : void 0), T = se.has(t) ? Fe(
|
|
1475
490
|
e,
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
491
|
+
t,
|
|
492
|
+
J,
|
|
493
|
+
i.relationships.get(t) ?? []
|
|
1479
494
|
) : void 0;
|
|
1480
|
-
|
|
1481
|
-
const
|
|
1482
|
-
...
|
|
1483
|
-
...
|
|
495
|
+
T && ne.set(t, T), T == null || T.removeDanglingHyperlinks(y);
|
|
496
|
+
const K = [
|
|
497
|
+
...a ? Ut(a) : [],
|
|
498
|
+
...n.get(t) ?? []
|
|
1484
499
|
];
|
|
1485
|
-
|
|
1486
|
-
const
|
|
1487
|
-
|
|
1488
|
-
for (const
|
|
1489
|
-
const
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
500
|
+
He(y, e, t, b, K, { links: T });
|
|
501
|
+
const V = ((ue = a == null ? void 0 : a.creation) == null ? void 0 : ue.duplicateRemovedAnimationSpids) ?? ((me = a == null ? void 0 : a.creation) == null ? void 0 : me.duplicateRemovedSpids) ?? [], ae = (n.get(t) ?? []).flatMap((M) => M.sourceSpids ?? (M.meta.origin ? [M.meta.origin.spid] : []));
|
|
502
|
+
ut(y, [...V, ...ae]);
|
|
503
|
+
for (const M of f.get(t) ?? []) {
|
|
504
|
+
const $ = e.elements[M], Pe = m.get(t);
|
|
505
|
+
jt(
|
|
506
|
+
y,
|
|
507
|
+
$,
|
|
508
|
+
Ie(e, M),
|
|
509
|
+
We($),
|
|
510
|
+
Pe ? N(Pe, $) : void 0
|
|
1496
511
|
);
|
|
1497
512
|
}
|
|
1498
|
-
const
|
|
1499
|
-
|
|
1500
|
-
const
|
|
1501
|
-
|
|
1502
|
-
}
|
|
1503
|
-
const
|
|
1504
|
-
for (const
|
|
1505
|
-
...
|
|
1506
|
-
...
|
|
1507
|
-
...
|
|
1508
|
-
...
|
|
513
|
+
const z = r.get(t);
|
|
514
|
+
z && mt(y, e, z);
|
|
515
|
+
const ge = D(y);
|
|
516
|
+
v[t] = Y.has(t) ? Et(ge, Y.get(t)) : ge;
|
|
517
|
+
}
|
|
518
|
+
const pe = /* @__PURE__ */ new Set();
|
|
519
|
+
for (const t of /* @__PURE__ */ new Set([
|
|
520
|
+
...i.relationships.keys(),
|
|
521
|
+
...ne.keys(),
|
|
522
|
+
...p.keys(),
|
|
523
|
+
...I.relationshipSlides.keys()
|
|
1509
524
|
])) {
|
|
1510
|
-
const
|
|
1511
|
-
|
|
1512
|
-
const
|
|
1513
|
-
var
|
|
1514
|
-
return ((
|
|
1515
|
-
}),
|
|
1516
|
-
let
|
|
1517
|
-
const
|
|
1518
|
-
|
|
1519
|
-
const
|
|
1520
|
-
|
|
1521
|
-
}
|
|
1522
|
-
for (const [
|
|
1523
|
-
|
|
1524
|
-
for (const [
|
|
1525
|
-
if (
|
|
1526
|
-
const
|
|
1527
|
-
|
|
1528
|
-
[...
|
|
525
|
+
const a = i.relationships.get(t) ?? [], u = x(t);
|
|
526
|
+
pe.add(u);
|
|
527
|
+
const y = c.find((ae) => {
|
|
528
|
+
var z;
|
|
529
|
+
return ((z = ae.origin) == null ? void 0 : z.part) === t;
|
|
530
|
+
}), b = l[u] ?? (y ? Q(e, y, l) : void 0), q = ne.get(t), J = v[t];
|
|
531
|
+
let T = q && J instanceof Uint8Array ? Ye(b, a, q, J) : F(b, a);
|
|
532
|
+
const K = p.get(t);
|
|
533
|
+
K && (T = Me(K, T));
|
|
534
|
+
const V = I.relationshipSlides.get(t);
|
|
535
|
+
V && (T = ke(V, T)), v[u] = T;
|
|
536
|
+
}
|
|
537
|
+
for (const [t, a] of Object.entries(l))
|
|
538
|
+
t.endsWith(".rels") && !pe.has(t) && (v[t] = F(a, []));
|
|
539
|
+
for (const [t, a] of i.resources) v[t] = ht(a);
|
|
540
|
+
if (gt(e, l, I, v), l[d]) {
|
|
541
|
+
const t = Pt(
|
|
542
|
+
l[d],
|
|
543
|
+
[...i.resources.values()]
|
|
1529
544
|
);
|
|
1530
|
-
|
|
1531
|
-
|
|
545
|
+
v[d] = Ct(
|
|
546
|
+
t,
|
|
1532
547
|
e,
|
|
1533
|
-
|
|
548
|
+
_.contentTypeParts
|
|
1534
549
|
);
|
|
1535
550
|
}
|
|
1536
|
-
for (const
|
|
1537
|
-
const
|
|
1538
|
-
|
|
551
|
+
for (const t of c) {
|
|
552
|
+
const a = x(t.origin.part), u = v[a], y = u instanceof Uint8Array ? u : Q(e, t, l), b = (he = t.creation) != null && he.duplicateSourcePart ? y : Ot(t, y);
|
|
553
|
+
v[a] = ke(t, b);
|
|
1539
554
|
}
|
|
1540
|
-
if (
|
|
1541
|
-
const
|
|
1542
|
-
if (!
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
555
|
+
if (l[h]) {
|
|
556
|
+
const t = l[S] ?? e.package.parts[S];
|
|
557
|
+
if (!t) throw new Error("PPTX 缺少 ppt/_rels/presentation.xml.rels");
|
|
558
|
+
v[h] = Mt(
|
|
559
|
+
l[h],
|
|
560
|
+
t,
|
|
1546
561
|
e
|
|
1547
562
|
);
|
|
1548
563
|
}
|
|
1549
|
-
|
|
1550
|
-
|
|
564
|
+
if (l[S] && (v[S] = Rt(
|
|
565
|
+
l[S],
|
|
1551
566
|
e
|
|
1552
|
-
))
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
567
|
+
)), g != null && g.definitions.length && P.has(g.part)) {
|
|
568
|
+
const t = v[d] ?? l[d], a = v[S] ?? l[S];
|
|
569
|
+
if (!(t instanceof Uint8Array) || !(a instanceof Uint8Array))
|
|
570
|
+
throw new Error("创建 tableStyles.xml 缺少 OPC 闭包基线");
|
|
571
|
+
v[d] = yt(t, g.part), v[S] = St(
|
|
572
|
+
a,
|
|
573
|
+
g.part
|
|
574
|
+
);
|
|
575
|
+
}
|
|
576
|
+
for (const t of _.packageParts) v[t] = null;
|
|
577
|
+
if (g) {
|
|
578
|
+
const t = l[g.part];
|
|
579
|
+
g.definitions.length ? v[g.part] = vt(t, g.definitions) : t && (v[g.part] = t);
|
|
580
|
+
}
|
|
581
|
+
const fe = at(e.package, v);
|
|
582
|
+
return Xe(e, fe.package, l, [...P].sort()), fe;
|
|
1556
583
|
}
|
|
1557
584
|
export {
|
|
1558
|
-
|
|
585
|
+
Kt as saveEditDoc
|
|
1559
586
|
};
|