@web-ppt/edit-core 0.5.0-beta.1
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 +274 -0
- package/LICENSE +21 -0
- package/README.md +474 -0
- package/dist/animation-catalog.d.ts +21 -0
- package/dist/body-properties.d.ts +8 -0
- package/dist/body-property-schema.d.ts +3 -0
- package/dist/change-classification.d.ts +10 -0
- package/dist/clipboard-binary.d.ts +4 -0
- package/dist/clipboard-links.d.ts +11 -0
- package/dist/clipboard-source.d.ts +23 -0
- package/dist/clipboard.d.ts +4 -0
- package/dist/commands/add-image.d.ts +4 -0
- package/dist/commands/add-shape.d.ts +4 -0
- package/dist/commands/add-slide-identity.d.ts +8 -0
- package/dist/commands/add-slide-template.d.ts +9 -0
- package/dist/commands/add-slide.d.ts +3 -0
- package/dist/commands/add-table.d.ts +4 -0
- package/dist/commands/align-elements.d.ts +4 -0
- package/dist/commands/apply-format.d.ts +4 -0
- package/dist/commands/clipboard-types.d.ts +91 -0
- package/dist/commands/direct-format-patches.d.ts +8 -0
- package/dist/commands/dispatch.d.ts +7 -0
- package/dist/commands/duplicate-slide.d.ts +3 -0
- package/dist/commands/edit-text.d.ts +3 -0
- package/dist/commands/element-effects.d.ts +5 -0
- package/dist/commands/element-fill.d.ts +5 -0
- package/dist/commands/element-image-content.d.ts +17 -0
- package/dist/commands/element-interaction.d.ts +11 -0
- package/dist/commands/element-link.d.ts +5 -0
- package/dist/commands/element-name.d.ts +8 -0
- package/dist/commands/element-order.d.ts +7 -0
- package/dist/commands/element-stroke.d.ts +5 -0
- package/dist/commands/element-text.d.ts +6 -0
- package/dist/commands/element-transform.d.ts +5 -0
- package/dist/commands/element-tree.d.ts +8 -0
- package/dist/commands/fit-text-shape.d.ts +3 -0
- package/dist/commands/format-painter-types.d.ts +17 -0
- package/dist/commands/image-format.d.ts +7 -0
- package/dist/commands/image-resource.d.ts +4 -0
- package/dist/commands/insert-row.d.ts +3 -0
- package/dist/commands/insertion-rect.d.ts +9 -0
- package/dist/commands/paste-elements.d.ts +4 -0
- package/dist/commands/paste-resources.d.ts +18 -0
- package/dist/commands/patch.d.ts +6 -0
- package/dist/commands/remove-slide.d.ts +3 -0
- package/dist/commands/replace-image.d.ts +3 -0
- package/dist/commands/replace-text.d.ts +5 -0
- package/dist/commands/set-animations.d.ts +3 -0
- package/dist/commands/set-body-props.d.ts +3 -0
- package/dist/commands/set-crop.d.ts +3 -0
- package/dist/commands/set-effects.d.ts +3 -0
- package/dist/commands/set-fill.d.ts +3 -0
- package/dist/commands/set-flip.d.ts +4 -0
- package/dist/commands/set-link.d.ts +3 -0
- package/dist/commands/set-para-props.d.ts +3 -0
- package/dist/commands/set-run-props.d.ts +3 -0
- package/dist/commands/set-slide-properties.d.ts +7 -0
- package/dist/commands/set-stroke.d.ts +3 -0
- package/dist/commands/set-xfrm.d.ts +3 -0
- package/dist/commands/set-z.d.ts +5 -0
- package/dist/commands/slide-image.d.ts +4 -0
- package/dist/commands/slide-layout.d.ts +8 -0
- package/dist/commands/slide-notes.d.ts +8 -0
- package/dist/commands/slide-order.d.ts +7 -0
- package/dist/commands/slide-property-types.d.ts +135 -0
- package/dist/commands/slide-property.d.ts +20 -0
- package/dist/commands/slide-tree.d.ts +6 -0
- package/dist/commands/spid.d.ts +4 -0
- package/dist/commands/table-row.d.ts +5 -0
- package/dist/commands/text-target.d.ts +25 -0
- package/dist/commands/types.d.ts +509 -0
- package/dist/commands/xfrm.d.ts +8 -0
- package/dist/data-validation.d.ts +7 -0
- package/dist/document.d.ts +17 -0
- package/dist/dynamic-slide-fields.d.ts +6 -0
- package/dist/edit-core.js +5321 -0
- package/dist/editor.d.ts +38 -0
- package/dist/element-ancestry.d.ts +3 -0
- package/dist/element-name.d.ts +4 -0
- package/dist/element-order.d.ts +7 -0
- package/dist/field-text.d.ts +3 -0
- package/dist/fractional-index.d.ts +10 -0
- package/dist/history.d.ts +50 -0
- package/dist/hyperlink.d.ts +10 -0
- package/dist/image-content.d.ts +7 -0
- package/dist/image-resource-history.d.ts +6 -0
- package/dist/index-D4ZTaYOa.js +706 -0
- package/dist/index.d.ts +46 -0
- package/dist/insertion-DabLme_U.js +5471 -0
- package/dist/insertion-invariants.d.ts +5 -0
- package/dist/layout-assets.d.ts +10 -0
- package/dist/layout-projection.d.ts +24 -0
- package/dist/layout-text-rebase.d.ts +3 -0
- package/dist/model-invariants.d.ts +5 -0
- package/dist/notes-part.d.ts +2 -0
- package/dist/opc/bytes.d.ts +1 -0
- package/dist/opc/crc32.d.ts +1 -0
- package/dist/opc/index.d.ts +3 -0
- package/dist/opc/package-owner.d.ts +4 -0
- package/dist/opc/patch.d.ts +6 -0
- package/dist/opc/types.d.ts +12 -0
- package/dist/opc/zip.d.ts +28 -0
- package/dist/opc-owner-protocol.d.ts +5 -0
- package/dist/opc.js +5 -0
- package/dist/paragraph-properties.d.ts +4 -0
- package/dist/paragraph-property-schema.d.ts +4 -0
- package/dist/patch-DO8497wO.js +322 -0
- package/dist/projection.d.ts +19 -0
- package/dist/recovery-identity.d.ts +35 -0
- package/dist/recovery-types.d.ts +30 -0
- package/dist/recovery.d.ts +28 -0
- package/dist/run-links.d.ts +3 -0
- package/dist/run-properties.d.ts +4 -0
- package/dist/run-property-schema.d.ts +3 -0
- package/dist/save/animation.d.ts +6 -0
- package/dist/save/background-image.d.ts +8 -0
- package/dist/save/clipboard-parts.d.ts +11 -0
- package/dist/save/drawing-color.d.ts +2 -0
- package/dist/save/duplicate-slide-parts.d.ts +15 -0
- package/dist/save/effects.d.ts +6 -0
- package/dist/save/hyperlink.d.ts +18 -0
- package/dist/save/image-content.d.ts +4 -0
- package/dist/save/index.d.ts +5 -0
- package/dist/save/insertion.d.ts +14 -0
- package/dist/save/layout-fallback-source.d.ts +4 -0
- package/dist/save/layout-fallback.d.ts +7 -0
- package/dist/save/materialize.d.ts +5 -0
- package/dist/save/name.d.ts +5 -0
- package/dist/save/notes.d.ts +12 -0
- package/dist/save/order.d.ts +5 -0
- package/dist/save/remove-element.d.ts +4 -0
- package/dist/save/remove-slide-parts.d.ts +11 -0
- package/dist/save/shape-format.d.ts +14 -0
- package/dist/save/slide-parts.d.ts +11 -0
- package/dist/save/slide-properties.d.ts +4 -0
- package/dist/save/table.d.ts +7 -0
- package/dist/save/text-body.d.ts +4 -0
- package/dist/save/text.d.ts +6 -0
- package/dist/save/transition.d.ts +4 -0
- package/dist/save/xfrm.d.ts +22 -0
- package/dist/save/xml-element.d.ts +3 -0
- package/dist/save.js +1559 -0
- package/dist/selection-pane.d.ts +18 -0
- package/dist/selection.d.ts +11 -0
- package/dist/session-assets.d.ts +20 -0
- package/dist/shape-effects.d.ts +6 -0
- package/dist/shape-fill.d.ts +12 -0
- package/dist/shape-stroke.d.ts +9 -0
- package/dist/slide-animation.d.ts +15 -0
- package/dist/slide-background-source.d.ts +13 -0
- package/dist/slide-notes.d.ts +2 -0
- package/dist/slide-properties.d.ts +4 -0
- package/dist/slide-transition.d.ts +19 -0
- package/dist/space.d.ts +47 -0
- package/dist/table-cell.d.ts +10 -0
- package/dist/table-direct-markup.d.ts +3 -0
- package/dist/table-insertion-policy.d.ts +5 -0
- package/dist/table-row-append-validation.d.ts +3 -0
- package/dist/table-rows.d.ts +12 -0
- package/dist/text-model.d.ts +28 -0
- package/dist/text-override-projection.d.ts +8 -0
- package/dist/text-override-validation.d.ts +7 -0
- package/dist/text-position.d.ts +8 -0
- package/dist/text-search-types.d.ts +46 -0
- package/dist/text-search.d.ts +5 -0
- package/dist/transaction-validation.d.ts +5 -0
- package/dist/types.d.ts +519 -0
- package/dist/xml/index.d.ts +9 -0
- package/dist/xml/mutate.d.ts +7 -0
- package/dist/xml/namespace.d.ts +5 -0
- package/dist/xml/nodes.d.ts +22 -0
- package/dist/xml/order.d.ts +15 -0
- package/dist/xml/qname.d.ts +15 -0
- package/dist/xml/query.d.ts +10 -0
- package/dist/xml/state.d.ts +30 -0
- package/dist/xml/tree.d.ts +8 -0
- package/dist/xml/types.d.ts +46 -0
- package/dist/xml.js +19 -0
- package/package.json +67 -0
package/dist/save.js
ADDED
|
@@ -0,0 +1,1559 @@
|
|
|
1
|
+
import { b as Tt, r as ie, a as Y, c as lt, n as E, d as U, e as wt, f as bt, o as D, g as kt, h as Et, i as xt, j as Mt, m as Ut, k as It, l as We, p as Ct, q as Rt, s as Ot, v as Lt, t as ft, u as At, w as Bt, x as $t, y as Ft, z as _t, A as Dt, B as pt, C as Xt, D as jt, E as Gt, F as zt, G as Ht, H as qt, I as Vt, J as Wt, K as Yt, L as Kt, M as Jt } from "./insertion-DabLme_U.js";
|
|
2
|
+
import { p as Qt } from "./patch-DO8497wO.js";
|
|
3
|
+
import { p as x, x as h, f as M, i as w, c as B, s as X, a as N, r as K, b as T, d as I, e as Oe, D as L, g as ke, P as g, h as Le, j as O, k as q, l as ne, m as ee, M as j, n as Zt, X as en, o as tn, q as Ye } from "./index-D4ZTaYOa.js";
|
|
4
|
+
import { PLACEHOLDER_DIRECT_BITS as Q, findPlaceholderByIdentity as nn } from "@web-ppt/core";
|
|
5
|
+
const rn = "http://schemas.openxmlformats.org/package/2006/relationships", on = "http://schemas.openxmlformats.org/package/2006/content-types";
|
|
6
|
+
function an(e) {
|
|
7
|
+
var r, a, s;
|
|
8
|
+
const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), o = (i, c, f) => {
|
|
9
|
+
const v = (c.relationships ?? []).filter((m) => m.targetId !== f), p = t.get(i) ?? [];
|
|
10
|
+
p.push(...v), t.set(i, p);
|
|
11
|
+
for (const m of c.resources ?? []) {
|
|
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() {
|
|
102
|
+
return new TextEncoder().encode(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
103
|
+
<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
|
+
<p:cSld><p:spTree>
|
|
105
|
+
<p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr>
|
|
106
|
+
<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>
|
|
107
|
+
</p:spTree></p:cSld><p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>
|
|
108
|
+
</p:sld>`);
|
|
109
|
+
}
|
|
110
|
+
function mn(e, t) {
|
|
111
|
+
if (!e.creation || !e.origin) throw new Error(`页面 ${e.id} 不是可物化的新页`);
|
|
112
|
+
return mt(e, t);
|
|
113
|
+
}
|
|
114
|
+
function Qe(e) {
|
|
115
|
+
const t = new Set(e ? h(x(e).root, { localName: "Relationship" }).flatMap((n) => C(n, "Id") ?? []) : []);
|
|
116
|
+
for (let n = 1; ; n++) if (!t.has(`rId${n}`)) return `rId${n}`;
|
|
117
|
+
}
|
|
118
|
+
function mt(e, t) {
|
|
119
|
+
var s, i;
|
|
120
|
+
if (!e.origin || !e.layoutId) throw new Error(`页面 ${e.id} 缺少版式写回身份`);
|
|
121
|
+
if (!t) {
|
|
122
|
+
const c = ((s = e.creation) == null ? void 0 : s.layoutRelationshipId) ?? Qe();
|
|
123
|
+
return z(void 0, [{
|
|
124
|
+
sourceId: c,
|
|
125
|
+
targetId: c,
|
|
126
|
+
type: Je,
|
|
127
|
+
target: Y(e.origin.part, e.layoutId)
|
|
128
|
+
}]);
|
|
129
|
+
}
|
|
130
|
+
const n = x(t), r = h(n.root, { localName: "Relationship" }).find((c) => {
|
|
131
|
+
var f;
|
|
132
|
+
return ((f = C(c, "Type")) == null ? void 0 : f.endsWith("/slideLayout")) && C(c, "TargetMode") !== "External" && (e.creation === void 0 || C(c, "Id") === e.creation.layoutRelationshipId);
|
|
133
|
+
});
|
|
134
|
+
if (!r) {
|
|
135
|
+
const c = ((i = e.creation) == null ? void 0 : i.layoutRelationshipId) ?? Qe(t);
|
|
136
|
+
return z(t, [{
|
|
137
|
+
sourceId: c,
|
|
138
|
+
targetId: c,
|
|
139
|
+
type: Je,
|
|
140
|
+
target: Y(e.origin.part, e.layoutId)
|
|
141
|
+
}]);
|
|
142
|
+
}
|
|
143
|
+
const a = Y(e.origin.part, e.layoutId);
|
|
144
|
+
return C(r, "Target") === a && C(r, "TargetMode") === void 0 ? t : (N(r, "Target", a), K(r, "TargetMode"), X(n));
|
|
145
|
+
}
|
|
146
|
+
function un(e, t) {
|
|
147
|
+
const n = x(e), o = String(t);
|
|
148
|
+
let r = !1;
|
|
149
|
+
const a = (s) => {
|
|
150
|
+
var i, c;
|
|
151
|
+
for (const f of h(s)) {
|
|
152
|
+
if (f.namespaceUri === L && f.localName === "fld" && ((i = C(f, "type")) == null ? void 0 : i.toLowerCase()) === "slidenum") {
|
|
153
|
+
const v = I(f, { localName: "t", namespaceUri: L });
|
|
154
|
+
if (v && !(v.children.length === 1 && ((c = v.children[0]) == null ? void 0 : c.type) === "text" && v.children[0].value === o)) {
|
|
155
|
+
for (const p of [...v.children]) T(v, p);
|
|
156
|
+
w(v, ke(o)), r = !0;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
a(f);
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
return a(n.root), r ? X(n) : e;
|
|
163
|
+
}
|
|
164
|
+
function dn(e) {
|
|
165
|
+
var n, o, r;
|
|
166
|
+
const t = /* @__PURE__ */ new Map();
|
|
167
|
+
for (const a of h(x(e).root, { localName: "Relationship" })) {
|
|
168
|
+
const s = (n = M(a, { localName: "Id", namespaceUri: null })) == null ? void 0 : n.value, i = (o = M(a, { localName: "Target", namespaceUri: null })) == null ? void 0 : o.value, c = (r = M(a, { localName: "TargetMode", namespaceUri: null })) == null ? void 0 : r.value;
|
|
169
|
+
s && i && c !== "External" && t.set(s, ie("ppt/presentation.xml", i));
|
|
170
|
+
}
|
|
171
|
+
return t;
|
|
172
|
+
}
|
|
173
|
+
function C(e, t) {
|
|
174
|
+
var n;
|
|
175
|
+
return (n = M(e, { localName: t, namespaceUri: null })) == null ? void 0 : n.value;
|
|
176
|
+
}
|
|
177
|
+
function ut(e, t, n, o) {
|
|
178
|
+
const r = h(e).find((a) => a.localName !== n || a.namespaceUri !== o) ?? null;
|
|
179
|
+
w(e, t, r);
|
|
180
|
+
}
|
|
181
|
+
function hn(e, t, n, o) {
|
|
182
|
+
const r = Le(e, {
|
|
183
|
+
localName: "sectionLst",
|
|
184
|
+
namespaceUri: O
|
|
185
|
+
});
|
|
186
|
+
if (r)
|
|
187
|
+
for (const a of h(r, {
|
|
188
|
+
localName: "section",
|
|
189
|
+
namespaceUri: O
|
|
190
|
+
})) {
|
|
191
|
+
const s = I(a, {
|
|
192
|
+
localName: "sldIdLst",
|
|
193
|
+
namespaceUri: O
|
|
194
|
+
});
|
|
195
|
+
if (!s) continue;
|
|
196
|
+
const i = h(s, {
|
|
197
|
+
localName: "sldId",
|
|
198
|
+
namespaceUri: O
|
|
199
|
+
}), c = new Set(i.flatMap((u) => {
|
|
200
|
+
const y = C(u, "id");
|
|
201
|
+
return y ? [Number(y)] : [];
|
|
202
|
+
}));
|
|
203
|
+
for (const u of i) {
|
|
204
|
+
const y = Number(C(u, "id"));
|
|
205
|
+
o.has(y) && T(s, u);
|
|
206
|
+
}
|
|
207
|
+
const f = i.filter((u) => !o.has(Number(C(u, "id"))));
|
|
208
|
+
let v = !0;
|
|
209
|
+
for (; v; ) {
|
|
210
|
+
v = !1;
|
|
211
|
+
for (const u of t) {
|
|
212
|
+
const y = u.creation;
|
|
213
|
+
!y || c.has(y.presentationSlideId) || y.sectionAfterSlideId === void 0 || !c.has(y.sectionAfterSlideId) || (c.add(y.presentationSlideId), v = !0);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
const p = new Map(f.map((u) => [Number(C(u, "id")), u])), m = n.flatMap((u) => {
|
|
217
|
+
if (!c.has(u)) return [];
|
|
218
|
+
const y = p.get(u);
|
|
219
|
+
if (y) return [y];
|
|
220
|
+
const b = E(s, O, "sldId");
|
|
221
|
+
return N(b, "id", String(u)), p.set(u, b), [b];
|
|
222
|
+
});
|
|
223
|
+
for (const u of m)
|
|
224
|
+
h(s).includes(u) || ut(s, u, "sldId", O);
|
|
225
|
+
Oe(s, m);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
function gn(e, t, n) {
|
|
229
|
+
var m;
|
|
230
|
+
const o = x(e), r = I(o.root, { localName: "sldIdLst", namespaceUri: g });
|
|
231
|
+
if (!r) throw new Error("presentation.xml 缺少 p:sldIdLst");
|
|
232
|
+
const a = dn(t), s = /* @__PURE__ */ new Map(), i = lt(n), c = /* @__PURE__ */ new Set();
|
|
233
|
+
for (const u of h(r, { localName: "sldId", namespaceUri: g })) {
|
|
234
|
+
const y = (m = M(u, {
|
|
235
|
+
localName: "id",
|
|
236
|
+
namespaceUri: "http://schemas.openxmlformats.org/officeDocument/2006/relationships"
|
|
237
|
+
})) == null ? void 0 : m.value, b = y ? a.get(y) : void 0;
|
|
238
|
+
if (b && i.has(b)) {
|
|
239
|
+
const A = Number(C(u, "id"));
|
|
240
|
+
Number.isFinite(A) && c.add(A), T(r, u);
|
|
241
|
+
} else b && s.set(b, u);
|
|
242
|
+
}
|
|
243
|
+
const f = Ee(n), v = new Map(f.map((u) => [u.id, u])), p = n.slideOrder.map((u) => {
|
|
244
|
+
const y = n.slides[u], b = y.origin ? s.get(y.origin.part) : void 0;
|
|
245
|
+
if (b) return b;
|
|
246
|
+
const A = v.get(u);
|
|
247
|
+
if (!(A != null && A.creation)) throw new Error(`页面 ${u} 无法映射到 presentation.xml`);
|
|
248
|
+
const J = E(r, g, "sldId");
|
|
249
|
+
return N(J, "id", String(A.creation.presentationSlideId)), N(J, "r:id", A.creation.presentationRelationshipId), J;
|
|
250
|
+
});
|
|
251
|
+
for (const u of p)
|
|
252
|
+
h(r).includes(u) || ut(r, u, "sldId", g);
|
|
253
|
+
return Oe(r, p), hn(
|
|
254
|
+
o.root,
|
|
255
|
+
f,
|
|
256
|
+
p.map((u) => Number(C(u, "id"))),
|
|
257
|
+
c
|
|
258
|
+
), X(o);
|
|
259
|
+
}
|
|
260
|
+
function vn(e, t) {
|
|
261
|
+
const n = x(e), o = lt(t);
|
|
262
|
+
for (const r of h(n.root, { localName: "Relationship" })) {
|
|
263
|
+
const a = C(r, "Type"), s = C(r, "Target"), i = C(r, "TargetMode");
|
|
264
|
+
a !== Ke || !s || i === "External" || o.has(ie("ppt/presentation.xml", s)) && T(n.root, r);
|
|
265
|
+
}
|
|
266
|
+
return z(X(n), Ee(t).map((r) => ({
|
|
267
|
+
sourceId: r.creation.presentationRelationshipId,
|
|
268
|
+
targetId: r.creation.presentationRelationshipId,
|
|
269
|
+
type: Ke,
|
|
270
|
+
target: Y("ppt/presentation.xml", r.origin.part)
|
|
271
|
+
})));
|
|
272
|
+
}
|
|
273
|
+
function yn(e, t, n = /* @__PURE__ */ new Set()) {
|
|
274
|
+
var a, s;
|
|
275
|
+
const o = x(e);
|
|
276
|
+
for (const i of h(o.root, { localName: "Override" })) {
|
|
277
|
+
const c = (a = M(i, { localName: "PartName", namespaceUri: null })) == null ? void 0 : a.value;
|
|
278
|
+
c && n.has(c.replace(/^\//, "")) && T(o.root, i);
|
|
279
|
+
}
|
|
280
|
+
const r = new Set(h(o.root, { localName: "Override" }).flatMap((i) => {
|
|
281
|
+
var f;
|
|
282
|
+
const c = (f = M(i, { localName: "PartName", namespaceUri: null })) == null ? void 0 : f.value;
|
|
283
|
+
return c ? [c] : [];
|
|
284
|
+
}));
|
|
285
|
+
for (const i of Ee(t)) {
|
|
286
|
+
const c = `/${i.origin.part}`;
|
|
287
|
+
r.has(c) || (w(o.root, B("Override", {
|
|
288
|
+
attributes: [["PartName", c], ["ContentType", ln]]
|
|
289
|
+
})), r.add(c));
|
|
290
|
+
}
|
|
291
|
+
for (const i of Object.values(t.slides)) {
|
|
292
|
+
const c = (s = i.notes) == null ? void 0 : s.targetPart;
|
|
293
|
+
!c || r.has(`/${c}`) || (w(o.root, B("Override", {
|
|
294
|
+
attributes: [["PartName", `/${c}`], ["ContentType", fn]]
|
|
295
|
+
})), r.add(`/${c}`));
|
|
296
|
+
}
|
|
297
|
+
return X(o);
|
|
298
|
+
}
|
|
299
|
+
function dt(e, t, n) {
|
|
300
|
+
var r;
|
|
301
|
+
const o = t[n] ?? ((r = e.package) == null ? void 0 : r.parts[n]);
|
|
302
|
+
if (!o) throw new Error(`页面副本缺少来源 OPC part:${n}`);
|
|
303
|
+
return o;
|
|
304
|
+
}
|
|
305
|
+
function Nn(e, t, n) {
|
|
306
|
+
var r;
|
|
307
|
+
const o = (r = t.creation) == null ? void 0 : r.duplicateSourcePart;
|
|
308
|
+
return o ? dt(e, n, o) : void 0;
|
|
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;
|
|
314
|
+
}
|
|
315
|
+
function Pn(e) {
|
|
316
|
+
var n, o;
|
|
317
|
+
const t = (n = e.origin) == null ? void 0 : n.part;
|
|
318
|
+
return t ? (((o = e.creation) == null ? void 0 : o.duplicateRemovedSpids) ?? []).map((r) => ({
|
|
319
|
+
id: `${e.id}-baseline-${r}`,
|
|
320
|
+
parent: e.id,
|
|
321
|
+
meta: { editable: "full", origin: { part: t, spid: r } }
|
|
322
|
+
})) : [];
|
|
323
|
+
}
|
|
324
|
+
const Sn = /* @__PURE__ */ new Set(["noFill", "solidFill", "gradFill", "blipFill", "pattFill", "grpFill"]);
|
|
325
|
+
function se(e, t) {
|
|
326
|
+
return I(e, { localName: t, namespaceUri: L });
|
|
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`);
|
|
1037
|
+
return o;
|
|
1038
|
+
}
|
|
1039
|
+
function vr(e, t, n, o) {
|
|
1040
|
+
if (!n && !o) return;
|
|
1041
|
+
const r = gr(e, t);
|
|
1042
|
+
for (const i of [...h(r)])
|
|
1043
|
+
i.namespaceUri === L && ["prstGeom", "custGeom"].includes(i.localName) && T(r, i);
|
|
1044
|
+
if (o) {
|
|
1045
|
+
q(r, ee(o));
|
|
1046
|
+
return;
|
|
1047
|
+
}
|
|
1048
|
+
if (!n) return;
|
|
1049
|
+
const a = E(r, L, "prstGeom");
|
|
1050
|
+
N(a, "prst", n.preset), q(r, a);
|
|
1051
|
+
const s = E(a, L, "avLst");
|
|
1052
|
+
w(a, s);
|
|
1053
|
+
for (const i of Object.keys(n.adj)) {
|
|
1054
|
+
const c = n.adj[i], f = E(s, L, "gd");
|
|
1055
|
+
N(f, "name", i), N(f, "fmla", `val ${Math.round(c)}`), w(s, f);
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
function yr(e, t, n, o, r) {
|
|
1059
|
+
var i;
|
|
1060
|
+
const a = t.meta.placeholderDirect ?? 0, s = !!(a & Q.style);
|
|
1061
|
+
a & Q.transform || Ut(e, t, n), (t.src.kind === "shape" || t.src.kind === "image") && !(a & Q.geometry) && vr(e, t, o, r), t.src.kind === "shape" && n.kind === "shape" ? (!s && !(a & Q.fill) && It(
|
|
1062
|
+
e,
|
|
1063
|
+
t,
|
|
1064
|
+
((i = n.fill) == null ? void 0 : i.type) === "image" ? { type: "none" } : n.fill
|
|
1065
|
+
), !s && !(a & Q.stroke) && n.stroke && We(e, t, n.stroke)) : t.src.kind === "image" && n.kind === "image" && !s && !(a & Q.stroke) && n.stroke && We(e, t, n.stroke), (t.src.kind === "shape" || t.src.kind === "image" || t.src.kind === "group") && !s && !(a & Q.effects) && n.effects && Ct(e, t, n.effects);
|
|
1066
|
+
}
|
|
1067
|
+
function Z(e, t, n) {
|
|
1068
|
+
return e && I(e, {
|
|
1069
|
+
localName: t,
|
|
1070
|
+
...n ? { namespaceUri: n } : {}
|
|
1071
|
+
});
|
|
1072
|
+
}
|
|
1073
|
+
function be(e, t) {
|
|
1074
|
+
var n;
|
|
1075
|
+
return e ? ((n = M(e, { localName: t })) == null ? void 0 : n.value) ?? null : null;
|
|
1076
|
+
}
|
|
1077
|
+
function Nr(e) {
|
|
1078
|
+
const t = h(e).find((r) => [
|
|
1079
|
+
"nvSpPr",
|
|
1080
|
+
"nvPicPr",
|
|
1081
|
+
"nvCxnSpPr",
|
|
1082
|
+
"nvGraphicFramePr"
|
|
1083
|
+
].includes(r.localName)) ?? null, n = Z(Z(t, "nvPr", g), "ph", g);
|
|
1084
|
+
if (!n) return null;
|
|
1085
|
+
const o = be(n, "idx");
|
|
1086
|
+
return { type: be(n, "type") ?? "obj", ...o === null ? {} : { idx: o } };
|
|
1087
|
+
}
|
|
1088
|
+
function ot(e, t) {
|
|
1089
|
+
if (!e) return;
|
|
1090
|
+
const n = Z(
|
|
1091
|
+
Z(e.root, "cSld", g),
|
|
1092
|
+
"spTree",
|
|
1093
|
+
g
|
|
1094
|
+
);
|
|
1095
|
+
if (!n) return;
|
|
1096
|
+
const o = nn(
|
|
1097
|
+
h(n).filter((a) => [
|
|
1098
|
+
"sp",
|
|
1099
|
+
"pic",
|
|
1100
|
+
"cxnSp",
|
|
1101
|
+
"graphicFrame"
|
|
1102
|
+
].includes(a.localName)),
|
|
1103
|
+
Nr,
|
|
1104
|
+
t
|
|
1105
|
+
), r = o ? Z(o, "spPr", g) : null;
|
|
1106
|
+
return Z(r, "custGeom", L) ?? Z(r, "prstGeom", L) ?? void 0;
|
|
1107
|
+
}
|
|
1108
|
+
function Pr(e) {
|
|
1109
|
+
const t = /* @__PURE__ */ new Map(), n = (r) => {
|
|
1110
|
+
var a;
|
|
1111
|
+
if (!t.has(r)) {
|
|
1112
|
+
const s = (a = e.package) == null ? void 0 : a.parts[r];
|
|
1113
|
+
t.set(r, s ? x(s) : null);
|
|
1114
|
+
}
|
|
1115
|
+
return t.get(r) ?? null;
|
|
1116
|
+
}, o = (r) => {
|
|
1117
|
+
const a = n(U(r)), s = a && h(a.root).find((c) => {
|
|
1118
|
+
var f;
|
|
1119
|
+
return c.localName === "Relationship" && ((f = be(c, "Type")) == null ? void 0 : f.endsWith("/slideMaster"));
|
|
1120
|
+
}), i = s ? be(s, "Target") : null;
|
|
1121
|
+
return i ? ie(r, i) : null;
|
|
1122
|
+
};
|
|
1123
|
+
return (r, a) => {
|
|
1124
|
+
const s = r.sourceLayoutId, i = a.meta.ph;
|
|
1125
|
+
if (!(!s || !i))
|
|
1126
|
+
return ot(n(s), i) ?? (o(s) ? ot(n(o(s)), i) : void 0);
|
|
1127
|
+
};
|
|
1128
|
+
}
|
|
1129
|
+
const at = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide", fe = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide";
|
|
1130
|
+
function Sr(e) {
|
|
1131
|
+
var n;
|
|
1132
|
+
const t = Le(e, {
|
|
1133
|
+
localName: "spTree",
|
|
1134
|
+
namespaceUri: g
|
|
1135
|
+
});
|
|
1136
|
+
for (const o of t ? h(t, {
|
|
1137
|
+
localName: "sp",
|
|
1138
|
+
namespaceUri: g
|
|
1139
|
+
}) : []) {
|
|
1140
|
+
const r = I(o, {
|
|
1141
|
+
localName: "nvSpPr",
|
|
1142
|
+
namespaceUri: g
|
|
1143
|
+
}), a = r && I(r, {
|
|
1144
|
+
localName: "nvPr",
|
|
1145
|
+
namespaceUri: g
|
|
1146
|
+
}), s = a && I(a, {
|
|
1147
|
+
localName: "ph",
|
|
1148
|
+
namespaceUri: g
|
|
1149
|
+
}), i = (n = s == null ? void 0 : s.attributes.find((f) => f.namespaceUri === null && f.localName === "type")) == null ? void 0 : n.value, c = I(o, {
|
|
1150
|
+
localName: "txBody",
|
|
1151
|
+
namespaceUri: g
|
|
1152
|
+
});
|
|
1153
|
+
if (i === "body" && c) return c;
|
|
1154
|
+
}
|
|
1155
|
+
throw new Error("notesSlide 缺少可编辑的 body 占位符");
|
|
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;
|
|
1355
|
+
if (!o) continue;
|
|
1356
|
+
const r = t.get(o.part) ?? [];
|
|
1357
|
+
r.push(n), t.set(o.part, r);
|
|
1358
|
+
}
|
|
1359
|
+
return t;
|
|
1360
|
+
}
|
|
1361
|
+
function Or(e) {
|
|
1362
|
+
var n;
|
|
1363
|
+
const t = /* @__PURE__ */ new Map();
|
|
1364
|
+
for (const o of Object.values(e.slides)) {
|
|
1365
|
+
if (!Nt(o)) continue;
|
|
1366
|
+
const r = (n = o.origin) == null ? void 0 : n.part;
|
|
1367
|
+
if (!r) throw new Error(`幻灯片 ${o.id} 缺少 OOXML 回写锚点`);
|
|
1368
|
+
t.set(r, o);
|
|
1369
|
+
}
|
|
1370
|
+
return t;
|
|
1371
|
+
}
|
|
1372
|
+
function Fr(e) {
|
|
1373
|
+
var je, Ge, ze, He;
|
|
1374
|
+
if (Lt(e), e.meta.readonly) throw new Error("只读编辑文档不能保存");
|
|
1375
|
+
if (e.meta.source !== "pptx" || !e.package)
|
|
1376
|
+
throw new Error("当前版本尚未实现生成式 PPTX 保存");
|
|
1377
|
+
const t = Cr(e), n = Or(e), o = new Set([...t].flatMap(([l, d]) => d.some(ft) ? [l] : [])), r = Rr(e), a = an(e), s = Ee(e), i = new Map(Object.values(e.slides).flatMap((l) => l.layoutId !== l.sourceLayoutId && l.origin ? [[l.origin.part, l]] : [])), c = new Map(Object.values(e.slides).flatMap((l) => {
|
|
1378
|
+
const d = At(e, l.id);
|
|
1379
|
+
return l.origin && d.length ? [[l.origin.part, d]] : [];
|
|
1380
|
+
})), f = new Map(Object.values(e.slides).flatMap((l) => l.origin ? [[l.origin.part, l]] : [])), v = Pr(e), p = Object.assign(
|
|
1381
|
+
/* @__PURE__ */ Object.create(null),
|
|
1382
|
+
e.saveState.baselines
|
|
1383
|
+
), m = new Set(e.saveState.createdParts), u = "[Content_Types].xml", y = "ppt/presentation.xml", b = "ppt/_rels/presentation.xml.rels", A = Mr(e, p, m), J = s.length > 0 || [...m].some((l) => /^ppt\/slides\/slide\d+\.xml$/.test(l)), $e = e.slideOrder.flatMap((l) => {
|
|
1384
|
+
var d;
|
|
1385
|
+
return ((d = e.slides[l].origin) == null ? void 0 : d.part) ?? [];
|
|
1386
|
+
}), ce = Bt(e, m), de = ce.slideParts.size > 0, Fe = /* @__PURE__ */ new Set();
|
|
1387
|
+
if (de)
|
|
1388
|
+
for (const l of e.slideOrder) {
|
|
1389
|
+
const d = e.slides[l], P = (je = d.origin) == null ? void 0 : je.part;
|
|
1390
|
+
if (!P) continue;
|
|
1391
|
+
const k = U(P), V = p[k] ?? (d.creation ? Pe(e, d, p) : void 0) ?? e.package.parts[k];
|
|
1392
|
+
$t(e, P, V) && Fe.add(P);
|
|
1393
|
+
}
|
|
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
|
+
}
|
|
1400
|
+
const he = Pt ? Ir(e) : /* @__PURE__ */ new Map();
|
|
1401
|
+
for (const l of /* @__PURE__ */ new Set([
|
|
1402
|
+
...t.keys(),
|
|
1403
|
+
...n.keys(),
|
|
1404
|
+
...r.keys(),
|
|
1405
|
+
...he.keys(),
|
|
1406
|
+
...Me,
|
|
1407
|
+
...c.keys()
|
|
1408
|
+
])) {
|
|
1409
|
+
if (p[l] || s.some((P) => {
|
|
1410
|
+
var k;
|
|
1411
|
+
return ((k = P.origin) == null ? void 0 : k.part) === l;
|
|
1412
|
+
})) continue;
|
|
1413
|
+
const d = e.package.parts[l];
|
|
1414
|
+
if (!d) throw new Error(`找不到待写回的 OPC part:${l}`);
|
|
1415
|
+
p[l] = d.slice();
|
|
1416
|
+
}
|
|
1417
|
+
for (const l of a.relationships.keys()) {
|
|
1418
|
+
const d = U(l);
|
|
1419
|
+
if (p[d] || m.has(d)) continue;
|
|
1420
|
+
const P = e.package.parts[d];
|
|
1421
|
+
P ? p[d] = P.slice() : m.add(d);
|
|
1422
|
+
}
|
|
1423
|
+
for (const l of Me) {
|
|
1424
|
+
const d = U(l);
|
|
1425
|
+
if (p[d] || m.has(d)) continue;
|
|
1426
|
+
const P = e.package.parts[d];
|
|
1427
|
+
P ? p[d] = P.slice() : m.add(d);
|
|
1428
|
+
}
|
|
1429
|
+
for (const [l, d] of i) {
|
|
1430
|
+
if (d.creation) continue;
|
|
1431
|
+
const P = U(l);
|
|
1432
|
+
if (p[P] || m.has(P)) continue;
|
|
1433
|
+
const k = e.package.parts[P];
|
|
1434
|
+
k ? p[P] = k.slice() : m.add(P);
|
|
1435
|
+
}
|
|
1436
|
+
for (const l of ce.packageParts) {
|
|
1437
|
+
if (m.has(l) || p[l]) continue;
|
|
1438
|
+
const d = e.package.parts[l];
|
|
1439
|
+
d && (p[l] = d.slice());
|
|
1440
|
+
}
|
|
1441
|
+
if ((a.resources.size || J || de || A.trackedParts.size) && !p[u]) {
|
|
1442
|
+
const l = e.package.parts[u];
|
|
1443
|
+
if (!l) throw new Error("PPTX 缺少 [Content_Types].xml");
|
|
1444
|
+
p[u] = l.slice();
|
|
1445
|
+
}
|
|
1446
|
+
if (J || de)
|
|
1447
|
+
for (const l of [y, b]) {
|
|
1448
|
+
if (p[l]) continue;
|
|
1449
|
+
const d = e.package.parts[l];
|
|
1450
|
+
if (!d) throw new Error(`PPTX 缺少 ${l}`);
|
|
1451
|
+
p[l] = d.slice();
|
|
1452
|
+
}
|
|
1453
|
+
for (const l of s) {
|
|
1454
|
+
const d = l.origin.part;
|
|
1455
|
+
m.add(d), m.add(U(d));
|
|
1456
|
+
}
|
|
1457
|
+
for (const l of a.resources.values())
|
|
1458
|
+
l.created && m.add(l.targetPart);
|
|
1459
|
+
const R = /* @__PURE__ */ Object.create(null);
|
|
1460
|
+
for (const l of m) R[l] = null;
|
|
1461
|
+
for (const [l, d] of Object.entries(p))
|
|
1462
|
+
!e.package.parts[l] && !ce.packageParts.has(l) && !m.has(l) && (R[l] = d);
|
|
1463
|
+
const St = new Set(e.slideOrder.flatMap((l) => {
|
|
1464
|
+
var k;
|
|
1465
|
+
const d = e.slides[l], P = (k = d.origin) == null ? void 0 : k.part;
|
|
1466
|
+
return P && (p[P] || d.creation || he.has(P)) ? [P] : [];
|
|
1467
|
+
})), Ue = /* @__PURE__ */ new Map();
|
|
1468
|
+
for (const l of St) {
|
|
1469
|
+
const d = s.find((W) => {
|
|
1470
|
+
var te;
|
|
1471
|
+
return ((te = W.origin) == null ? void 0 : te.part) === l;
|
|
1472
|
+
}), P = p[l] ?? (d ? Nn(e, d, p) ?? pn() : void 0);
|
|
1473
|
+
if (!P) throw new Error(`找不到页面保存基线:${l}`);
|
|
1474
|
+
const k = x(P), V = t.get(l) ?? [], ge = U(l), ve = p[ge] ?? (d ? Pe(e, d, p) : void 0), F = Me.has(l) ? Ft(
|
|
1475
|
+
e,
|
|
1476
|
+
l,
|
|
1477
|
+
ve,
|
|
1478
|
+
a.relationships.get(l) ?? []
|
|
1479
|
+
) : void 0;
|
|
1480
|
+
F && Ue.set(l, F), F == null || F.removeDanglingHyperlinks(k);
|
|
1481
|
+
const ye = [
|
|
1482
|
+
...d ? Pn(d) : [],
|
|
1483
|
+
...r.get(l) ?? []
|
|
1484
|
+
];
|
|
1485
|
+
_t(k, e, l, V, ye, { links: F });
|
|
1486
|
+
const Ne = ((Ge = d == null ? void 0 : d.creation) == null ? void 0 : Ge.duplicateRemovedAnimationSpids) ?? ((ze = d == null ? void 0 : d.creation) == null ? void 0 : ze.duplicateRemovedSpids) ?? [], Ie = (r.get(l) ?? []).flatMap((W) => W.sourceSpids ?? (W.meta.origin ? [W.meta.origin.spid] : []));
|
|
1487
|
+
ar(k, [...Ne, ...Ie]);
|
|
1488
|
+
for (const W of c.get(l) ?? []) {
|
|
1489
|
+
const te = e.elements[W], Ve = f.get(l);
|
|
1490
|
+
yr(
|
|
1491
|
+
k,
|
|
1492
|
+
te,
|
|
1493
|
+
pt(e, W),
|
|
1494
|
+
Dt(te),
|
|
1495
|
+
Ve ? v(Ve, te) : void 0
|
|
1496
|
+
);
|
|
1497
|
+
}
|
|
1498
|
+
const le = n.get(l);
|
|
1499
|
+
le && hr(k, e, le);
|
|
1500
|
+
const qe = X(k);
|
|
1501
|
+
R[l] = he.has(l) ? un(qe, he.get(l)) : qe;
|
|
1502
|
+
}
|
|
1503
|
+
const De = /* @__PURE__ */ new Set();
|
|
1504
|
+
for (const l of /* @__PURE__ */ new Set([
|
|
1505
|
+
...a.relationships.keys(),
|
|
1506
|
+
...Ue.keys(),
|
|
1507
|
+
...i.keys(),
|
|
1508
|
+
...A.relationshipSlides.keys()
|
|
1509
|
+
])) {
|
|
1510
|
+
const d = a.relationships.get(l) ?? [], P = U(l);
|
|
1511
|
+
De.add(P);
|
|
1512
|
+
const k = s.find((Ie) => {
|
|
1513
|
+
var le;
|
|
1514
|
+
return ((le = Ie.origin) == null ? void 0 : le.part) === l;
|
|
1515
|
+
}), V = p[P] ?? (k ? Pe(e, k, p) : void 0), ge = Ue.get(l), ve = R[l];
|
|
1516
|
+
let F = ge && ve instanceof Uint8Array ? Xt(V, d, ge, ve) : z(V, d);
|
|
1517
|
+
const ye = i.get(l);
|
|
1518
|
+
ye && (F = mt(ye, F));
|
|
1519
|
+
const Ne = A.relationshipSlides.get(l);
|
|
1520
|
+
Ne && (F = ct(Ne, F)), R[P] = F;
|
|
1521
|
+
}
|
|
1522
|
+
for (const [l, d] of Object.entries(p))
|
|
1523
|
+
l.endsWith(".rels") && !De.has(l) && (R[l] = z(d, []));
|
|
1524
|
+
for (const [l, d] of a.resources) R[l] = cn(d);
|
|
1525
|
+
if (Ur(e, p, A, R), p[u]) {
|
|
1526
|
+
const l = sn(
|
|
1527
|
+
p[u],
|
|
1528
|
+
[...a.resources.values()]
|
|
1529
|
+
);
|
|
1530
|
+
R[u] = yn(
|
|
1531
|
+
l,
|
|
1532
|
+
e,
|
|
1533
|
+
ce.contentTypeParts
|
|
1534
|
+
);
|
|
1535
|
+
}
|
|
1536
|
+
for (const l of s) {
|
|
1537
|
+
const d = U(l.origin.part), P = R[d], k = P instanceof Uint8Array ? P : Pe(e, l, p), V = (He = l.creation) != null && He.duplicateSourcePart ? k : mn(l, k);
|
|
1538
|
+
R[d] = ct(l, V);
|
|
1539
|
+
}
|
|
1540
|
+
if (p[y]) {
|
|
1541
|
+
const l = p[b] ?? e.package.parts[b];
|
|
1542
|
+
if (!l) throw new Error("PPTX 缺少 ppt/_rels/presentation.xml.rels");
|
|
1543
|
+
R[y] = gn(
|
|
1544
|
+
p[y],
|
|
1545
|
+
l,
|
|
1546
|
+
e
|
|
1547
|
+
);
|
|
1548
|
+
}
|
|
1549
|
+
p[b] && (R[b] = vn(
|
|
1550
|
+
p[b],
|
|
1551
|
+
e
|
|
1552
|
+
));
|
|
1553
|
+
for (const l of ce.packageParts) R[l] = null;
|
|
1554
|
+
const Xe = Qt(e.package, R);
|
|
1555
|
+
return jt(e, Xe.package, p, [...m].sort()), Xe;
|
|
1556
|
+
}
|
|
1557
|
+
export {
|
|
1558
|
+
Fr as saveEditDoc
|
|
1559
|
+
};
|