@web-ppt/edit-core 0.6.0 → 0.8.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.
Files changed (42) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +8 -0
  3. package/dist/agent/base64.d.ts +2 -0
  4. package/dist/agent/errors.d.ts +9 -0
  5. package/dist/agent/generated-schema.d.ts +6038 -0
  6. package/dist/agent/generated-validator.d.ts +6 -0
  7. package/dist/agent/index.d.ts +6 -0
  8. package/dist/agent/query.d.ts +3 -0
  9. package/dist/agent/session.d.ts +33 -0
  10. package/dist/agent/targets.d.ts +5 -0
  11. package/dist/agent/tools.d.ts +2 -0
  12. package/dist/agent/types.d.ts +126 -0
  13. package/dist/agent/validation.d.ts +2 -0
  14. package/dist/agent.js +46364 -0
  15. package/dist/commands/types.d.ts +23 -23
  16. package/dist/fill/api.d.ts +29 -0
  17. package/dist/fill/chart-seed-chart.d.ts +7 -0
  18. package/dist/fill/chart-seed-workbook.d.ts +12 -0
  19. package/dist/fill/chart-seed-xml.d.ts +12 -0
  20. package/dist/fill/chart-seed.d.ts +17 -0
  21. package/dist/fill/content.d.ts +16 -0
  22. package/dist/fill/errors.d.ts +10 -0
  23. package/dist/fill/generated-schema.d.ts +291 -0
  24. package/dist/fill/generated-validator.d.ts +6 -0
  25. package/dist/fill/index.d.ts +10 -0
  26. package/dist/fill/layouts.d.ts +24 -0
  27. package/dist/fill/package.d.ts +2 -0
  28. package/dist/fill/repair.d.ts +32 -0
  29. package/dist/fill/text-validation.d.ts +3 -0
  30. package/dist/fill/types.d.ts +60 -0
  31. package/dist/fill/validation.d.ts +10 -0
  32. package/dist/fill.js +12 -0
  33. package/dist/generate.js +53 -53
  34. package/dist/index-2ti1e4_F.js +411 -0
  35. package/dist/index-BbsPmmoy.js +4046 -0
  36. package/dist/save/notes-master.d.ts +12 -0
  37. package/dist/save.js +650 -484
  38. package/dist/{slide-parts-D0o_DDhi.js → slide-parts-zyOP9lia.js} +5 -5
  39. package/dist/types.d.ts +4 -4
  40. package/package.json +13 -3
  41. package/schemas/agent-tools.schema.json +7999 -0
  42. package/schemas/template-fill.schema.json +371 -0
@@ -0,0 +1,411 @@
1
+ import { c as W, d as Z } from "./index-BbsPmmoy.js";
2
+ import { THEME_COLOR_SLOTS as q } from "@web-ppt/core";
3
+ const _ = 96, B = 5376;
4
+ function D(e, a) {
5
+ if (typeof e != "number" || !Number.isFinite(e) || e < _ || e > B)
6
+ throw new Error(`${a} 必须是 ${_}–${B} 之间的有限数`);
7
+ }
8
+ const y = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
9
+ `, h = "http://schemas.openxmlformats.org/drawingml/2006/main", b = "http://schemas.openxmlformats.org/presentationml/2006/main", p = "http://schemas.openxmlformats.org/officeDocument/2006/relationships", J = "http://schemas.openxmlformats.org/package/2006/relationships", K = "http://schemas.openxmlformats.org/package/2006/content-types", Q = new TextEncoder(), o = (e) => Q.encode(e), f = (e) => e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
10
+ function H(e, a) {
11
+ var l;
12
+ const t = (l = /^rgb\((\d+),(\d+),(\d+)\)$/.exec(e)) == null ? void 0 : l.slice(1).map(Number);
13
+ if (!t || t.some((r) => r < 0 || r > 255))
14
+ throw new Error(`${a} 不是有效主题颜色`);
15
+ return t.map((r) => r.toString(16).padStart(2, "0")).join("").toUpperCase();
16
+ }
17
+ function V(e) {
18
+ return e ? q.map((a) => `<a:${a}><a:srgbClr val="${H(e.colors[a], `主题 ${a}`)}"/></a:${a}>`).join("") : `<a:dk1><a:sysClr val="windowText" lastClr="000000"/></a:dk1><a:lt1><a:sysClr val="window" lastClr="FFFFFF"/></a:lt1>
19
+ <a:dk2><a:srgbClr val="1F3864"/></a:dk2><a:lt2><a:srgbClr val="F2F2F2"/></a:lt2>
20
+ <a:accent1><a:srgbClr val="4472C4"/></a:accent1><a:accent2><a:srgbClr val="ED7D31"/></a:accent2>
21
+ <a:accent3><a:srgbClr val="A5A5A5"/></a:accent3><a:accent4><a:srgbClr val="FFC000"/></a:accent4>
22
+ <a:accent5><a:srgbClr val="5B9BD5"/></a:accent5><a:accent6><a:srgbClr val="70AD47"/></a:accent6>
23
+ <a:hlink><a:srgbClr val="0563C1"/></a:hlink><a:folHlink><a:srgbClr val="954F72"/></a:folHlink>`;
24
+ }
25
+ function A(e) {
26
+ const a = `<a:latin typeface="${f(e.latin)}"/><a:ea typeface="${f(e.ea)}"/><a:cs typeface="${f(e.cs)}"/>`, t = Object.entries(e.scripts).sort(([l], [r]) => l < r ? -1 : l > r ? 1 : 0).map(([l, r]) => `<a:font script="${f(l)}" typeface="${f(r)}"/>`).join("");
27
+ return a + t;
28
+ }
29
+ function m(e, a) {
30
+ const t = Math.round(e * 9525);
31
+ if (!Number.isSafeInteger(t)) throw new Error(`${a} 超出 OOXML 安全整数范围`);
32
+ return String(t);
33
+ }
34
+ const u = (e) => `${y}<Relationships xmlns="${J}">${e}</Relationships>`, L = `<p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr>
35
+ <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>`;
36
+ function F(e, a, t, l, r) {
37
+ const n = `<p:ph type="${t}"${r === void 0 ? "" : ` idx="${r}"`}/>`;
38
+ return `<p:sp><p:nvSpPr><p:cNvPr id="${e}" name="${a}"/><p:cNvSpPr/><p:nvPr>${n}</p:nvPr></p:nvSpPr>
39
+ <p:spPr><a:xfrm><a:off x="${m(l.x, `${a} x`)}" y="${m(l.y, `${a} y`)}"/><a:ext cx="${m(l.w, `${a} 宽度`)}" cy="${m(l.h, `${a} 高度`)}"/></a:xfrm></p:spPr>
40
+ <p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:endParaRPr lang="zh-CN"/></a:p></p:txBody></p:sp>`;
41
+ }
42
+ function G(e, a, t) {
43
+ return `<p:sp><p:nvSpPr><p:cNvPr id="${e}" name="页码"/><p:cNvSpPr/><p:nvPr><p:ph type="sldNum" idx="12"/></p:nvPr></p:nvSpPr>
44
+ <p:spPr><a:xfrm><a:off x="${m(t.x, "页码 x")}" y="${m(t.y, "页码 y")}"/><a:ext cx="${m(t.w, "页码宽度")}" cy="${m(t.h, "页码高度")}"/></a:xfrm></p:spPr>
45
+ <p:txBody><a:bodyPr anchor="ctr"/><a:lstStyle/><a:p><a:pPr algn="r"/><a:fld id="{00000000-0000-0000-0000-${String(a).padStart(12, "0")}}" type="slidenum"><a:rPr lang="zh-CN" sz="1100"/><a:t>1</a:t></a:fld><a:endParaRPr lang="zh-CN" sz="1100"/></a:p></p:txBody></p:sp>`;
46
+ }
47
+ function Y(e, a) {
48
+ const t = e / 1280, l = a / 720, r = (d, $, P, v) => ({
49
+ x: d * t,
50
+ y: $ * l,
51
+ w: P * t,
52
+ h: v * l
53
+ }), n = (d, $) => G(d, $, r(1120, 662, 96, 34));
54
+ return [
55
+ {
56
+ part: 1,
57
+ type: "title",
58
+ name: "标题页",
59
+ shapes: F(2, "标题", "ctrTitle", r(120, 196, 1040, 154)) + F(3, "副标题", "subTitle", r(200, 374, 880, 92), 1) + n(4, 1)
60
+ },
61
+ {
62
+ part: 2,
63
+ type: "obj",
64
+ name: "标题和内容",
65
+ shapes: F(2, "标题", "title", r(80, 52, 1120, 92)) + F(3, "内容", "body", r(96, 166, 1088, 446), 1) + n(4, 2)
66
+ },
67
+ { part: 3, type: "blank", name: "空白", shapes: n(2, 3) }
68
+ ];
69
+ }
70
+ function ee(e, a, t = 0, l = [], r) {
71
+ const n = /* @__PURE__ */ Object.create(null), d = l.some(Boolean), $ = Array.from({ length: t }, (i, s) => `<Override PartName="/ppt/slides/slide${s + 1}.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slide+xml"/>`).join(`
72
+ `), P = l.map((i, s) => i ? `<Override PartName="/ppt/notesSlides/notesSlide${s + 1}.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml"/>` : "").filter(Boolean).join(`
73
+ `);
74
+ n["[Content_Types].xml"] = o(`${y}<Types xmlns="${K}">
75
+ <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
76
+ <Default Extension="xml" ContentType="application/xml"/>
77
+ <Override PartName="/ppt/presentation.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"/>
78
+ <Override PartName="/ppt/slideMasters/slideMaster1.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml"/>
79
+ <Override PartName="/ppt/slideLayouts/slideLayout1.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/>
80
+ <Override PartName="/ppt/slideLayouts/slideLayout2.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/>
81
+ <Override PartName="/ppt/slideLayouts/slideLayout3.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/>
82
+ <Override PartName="/ppt/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/>
83
+ ${$}
84
+ ${P}
85
+ ${d ? '<Override PartName="/ppt/notesMasters/notesMaster1.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml"/>' : ""}
86
+ </Types>`), n["_rels/.rels"] = o(u(
87
+ `<Relationship Id="rId1" Type="${p}/officeDocument" Target="ppt/presentation.xml"/>`
88
+ )), n["ppt/presentation.xml"] = o(`${y}<p:presentation xmlns:a="${h}" xmlns:r="${p}" xmlns:p="${b}">
89
+ <p:sldMasterIdLst><p:sldMasterId id="2147483648" r:id="rId1"/></p:sldMasterIdLst>
90
+ ${d ? `<p:notesMasterIdLst><p:notesMasterId r:id="rId${t + 2}"/></p:notesMasterIdLst>` : ""}
91
+ <p:sldIdLst>${Array.from({ length: t }, (i, s) => `<p:sldId id="${256 + s}" r:id="rId${s + 2}"/>`).join("")}</p:sldIdLst>
92
+ <p:sldSz cx="${m(e, "页面宽度")}" cy="${m(a, "页面高度")}"/>
93
+ <p:notesSz cx="6858000" cy="9144000"/><p:defaultTextStyle/></p:presentation>`), n["ppt/_rels/presentation.xml.rels"] = o(u(
94
+ `<Relationship Id="rId1" Type="${p}/slideMaster" Target="slideMasters/slideMaster1.xml"/>` + Array.from({ length: t }, (i, s) => `<Relationship Id="rId${s + 2}" Type="${p}/slide" Target="slides/slide${s + 1}.xml"/>`).join("") + (d ? `<Relationship Id="rId${t + 2}" Type="${p}/notesMaster" Target="notesMasters/notesMaster1.xml"/>` : "")
95
+ ));
96
+ const v = f((r == null ? void 0 : r.name) ?? "Web PPT"), k = r ? A(r.fonts.major) : '<a:latin typeface=""/><a:ea typeface=""/><a:cs typeface=""/>', E = r ? A(r.fonts.minor) : '<a:latin typeface=""/><a:ea typeface=""/><a:cs typeface=""/>';
97
+ n["ppt/theme/theme1.xml"] = o(`${y}<a:theme xmlns:a="${h}" name="${v}">
98
+ <a:themeElements><a:clrScheme name="${v}">
99
+ ${V(r)}
100
+ </a:clrScheme><a:fontScheme name="${v}">
101
+ <a:majorFont>${k}</a:majorFont>
102
+ <a:minorFont>${E}</a:minorFont>
103
+ </a:fontScheme><a:fmtScheme name="Web PPT">
104
+ <a:fillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:fillStyleLst>
105
+ <a:lnStyleLst><a:ln w="6350"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:ln><a:ln w="12700"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:ln><a:ln w="19050"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:ln></a:lnStyleLst>
106
+ <a:effectStyleLst><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/></a:effectStyle></a:effectStyleLst>
107
+ <a:bgFillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:bgFillStyleLst>
108
+ </a:fmtScheme></a:themeElements></a:theme>`), n["ppt/slideMasters/slideMaster1.xml"] = o(`${y}<p:sldMaster xmlns:a="${h}" xmlns:r="${p}" xmlns:p="${b}">
109
+ <p:cSld><p:bg><p:bgPr><a:solidFill><a:srgbClr val="FFFFFF"/></a:solidFill><a:effectLst/></p:bgPr></p:bg><p:spTree>${L}</p:spTree></p:cSld>
110
+ <p:clrMap bg1="lt1" tx1="dk1" bg2="lt2" tx2="dk2" accent1="accent1" accent2="accent2" accent3="accent3" accent4="accent4" accent5="accent5" accent6="accent6" hlink="hlink" folHlink="folHlink"/>
111
+ <p:sldLayoutIdLst><p:sldLayoutId id="2147483649" r:id="rId1"/><p:sldLayoutId id="2147483650" r:id="rId2"/><p:sldLayoutId id="2147483651" r:id="rId3"/></p:sldLayoutIdLst>
112
+ <p:txStyles><p:titleStyle/><p:bodyStyle/><p:otherStyle/></p:txStyles></p:sldMaster>`), n["ppt/slideMasters/_rels/slideMaster1.xml.rels"] = o(u(
113
+ `<Relationship Id="rId1" Type="${p}/slideLayout" Target="../slideLayouts/slideLayout1.xml"/><Relationship Id="rId2" Type="${p}/slideLayout" Target="../slideLayouts/slideLayout2.xml"/><Relationship Id="rId3" Type="${p}/slideLayout" Target="../slideLayouts/slideLayout3.xml"/><Relationship Id="rId4" Type="${p}/theme" Target="../theme/theme1.xml"/>`
114
+ ));
115
+ const I = Y(e, a);
116
+ for (const i of I)
117
+ n[`ppt/slideLayouts/slideLayout${i.part}.xml`] = o(`${y}<p:sldLayout xmlns:a="${h}" xmlns:r="${p}" xmlns:p="${b}" type="${i.type}" showMasterSp="0">
118
+ <p:cSld name="${i.name}"><p:spTree>${L}${i.shapes}</p:spTree></p:cSld>
119
+ <p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:sldLayout>`), n[`ppt/slideLayouts/_rels/slideLayout${i.part}.xml.rels`] = o(u(
120
+ `<Relationship Id="rId1" Type="${p}/slideMaster" Target="../slideMasters/slideMaster1.xml"/>`
121
+ ));
122
+ d && (n["ppt/notesMasters/notesMaster1.xml"] = o(`${y}<p:notesMaster xmlns:a="${h}" xmlns:r="${p}" xmlns:p="${b}">
123
+ <p:cSld><p:spTree>${L}</p:spTree></p:cSld>
124
+ <p:clrMap bg1="lt1" tx1="dk1" bg2="lt2" tx2="dk2" accent1="accent1" accent2="accent2" accent3="accent3" accent4="accent4" accent5="accent5" accent6="accent6" hlink="hlink" folHlink="folHlink"/>
125
+ <p:hf/><p:notesStyle/></p:notesMaster>`), n["ppt/notesMasters/_rels/notesMaster1.xml.rels"] = o(u(
126
+ `<Relationship Id="rId1" Type="${p}/theme" Target="../theme/theme1.xml"/>`
127
+ )));
128
+ for (let i = 0; i < t; i++)
129
+ n[`ppt/slides/slide${i + 1}.xml`] = o(te()), n[`ppt/slides/_rels/slide${i + 1}.xml.rels`] = o(u(
130
+ `<Relationship Id="rId1" Type="${p}/slideLayout" Target="../slideLayouts/slideLayout3.xml"/>`
131
+ ));
132
+ return n;
133
+ }
134
+ function te() {
135
+ return `${y}<p:sld xmlns:a="${h}" xmlns:r="${p}" xmlns:p="${b}">
136
+ <p:cSld><p:spTree>${L}</p:spTree></p:cSld>
137
+ <p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:sld>`;
138
+ }
139
+ function C(e) {
140
+ if (e.slot === void 0 == (e.rgb === void 0))
141
+ throw new Error("模板颜色必须且只能指定主题槽或 RGB");
142
+ const a = e.slot ? `<a:schemeClr val="${e.slot}"` : `<a:srgbClr val="${H(e.rgb, "模板颜色")}"`;
143
+ if (e.alpha === void 0) return `${a}/>`;
144
+ if (!Number.isFinite(e.alpha) || e.alpha < 0 || e.alpha > 1)
145
+ throw new Error("模板颜色透明度必须位于 0 到 1");
146
+ return `${a}><a:alpha val="${Math.round(e.alpha * 1e5)}"/></${e.slot ? "a:schemeClr" : "a:srgbClr"}>`;
147
+ }
148
+ function ae(e) {
149
+ return e ? `<a:solidFill>${C(e)}</a:solidFill>` : "<a:noFill/>";
150
+ }
151
+ function z(e, a, t, l) {
152
+ const { rect: r } = e, n = `<a:xfrm${e.rotation === void 0 ? "" : ` rot="${Math.round(e.rotation * 6e4)}"`}><a:off x="${m(r.x * t, `${e.name} x`)}" y="${m(r.y * l, `${e.name} y`)}"/><a:ext cx="${m(r.w * t, `${e.name} 宽度`)}" cy="${m(r.h * l, `${e.name} 高度`)}"/></a:xfrm>`, d = e.stroke ? `<a:ln w="${m(e.stroke.width ?? 1, `${e.name} 描边`)}"><a:solidFill>${C(e.stroke)}</a:solidFill></a:ln>` : "<a:ln><a:noFill/></a:ln>";
153
+ return `<p:sp><p:nvSpPr><p:cNvPr id="${a}" name="${f(e.name)}"/><p:cNvSpPr/><p:nvPr/></p:nvSpPr>
154
+ <p:spPr>${n}<a:prstGeom prst="${e.preset}"><a:avLst/></a:prstGeom>${ae(e.fill)}${d}</p:spPr></p:sp>`;
155
+ }
156
+ function N(e) {
157
+ return Array.from({ length: 9 }, (t, l) => {
158
+ const r = Math.max(12, e.size - (e.step ?? 0) * l), n = [
159
+ e.align ? `algn="${e.align}"` : "",
160
+ e.bullet ? `marL="${m(18 + l * 18, "文字缩进")}" indent="${m(-14, "文字悬挂")}"` : ""
161
+ ].filter(Boolean).join(" "), d = e.font === "major" ? "mj" : "mn", $ = e.bullet ? '<a:buChar char="&#x2022;"/>' : "<a:buNone/>";
162
+ return `<a:lvl${l + 1}pPr${n ? ` ${n}` : ""}>${$}<a:defRPr lang="zh-CN" sz="${Math.round(r * 100)}"${e.bold ? ' b="1"' : ""}><a:solidFill>${C(e.color)}</a:solidFill><a:latin typeface="+${d}-lt"/><a:ea typeface="+${d}-ea"/><a:cs typeface="+${d}-cs"/></a:defRPr></a:lvl${l + 1}pPr>`;
163
+ }).join("");
164
+ }
165
+ function le(e, a) {
166
+ const t = `<p:ph type="${a.type}"${a.index === void 0 ? "" : ` idx="${a.index}"`}/>`;
167
+ return `<p:sp><p:nvSpPr><p:cNvPr id="${e}" name="${f(a.name)}"/><p:cNvSpPr/><p:nvPr>${t}</p:nvPr></p:nvSpPr>
168
+ <p:spPr/><p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:endParaRPr lang="zh-CN"/></a:p></p:txBody></p:sp>`;
169
+ }
170
+ function re(e, a, t) {
171
+ var i;
172
+ if (t.layouts.length < 5 || !t.layouts.some(({ part: s }) => s === t.initialLayoutPart))
173
+ throw new Error("内置模板必须提供至少五种版式及有效初始版式");
174
+ const l = ee(e, a, 1, [], t.theme), r = e / 1280, n = a / 720, d = (s) => ({
175
+ x: s.x * r,
176
+ y: s.y * n,
177
+ w: s.w * r,
178
+ h: s.h * n
179
+ }), $ = new TextDecoder().decode(l["[Content_Types].xml"]), P = t.layouts.filter(({ part: s }) => s > 3).map(({ part: s }) => `<Override PartName="/ppt/slideLayouts/slideLayout${s}.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/>`).join(`
180
+ `);
181
+ l["[Content_Types].xml"] = o($.replace(
182
+ '<Override PartName="/ppt/theme/theme1.xml"',
183
+ `${P}${P ? `
184
+ ` : ""}<Override PartName="/ppt/theme/theme1.xml"`
185
+ ));
186
+ const v = t.masterDecorations.map((s, S) => z(s, S + 2, r, n)).join(""), k = t.layouts.map(({ part: s }, S) => `<p:sldLayoutId id="${2147483649 + S}" r:id="rId${s}"/>`).join("");
187
+ l["ppt/slideMasters/slideMaster1.xml"] = o(`${y}<p:sldMaster xmlns:a="${h}" xmlns:r="${p}" xmlns:p="${b}">
188
+ <p:cSld name="${f(t.theme.name)}"><p:bg><p:bgPr><a:solidFill>${C(t.masterBackground)}</a:solidFill><a:effectLst/></p:bgPr></p:bg><p:spTree>${L}${v}</p:spTree></p:cSld>
189
+ <p:clrMap bg1="lt1" tx1="dk1" bg2="lt2" tx2="dk2" accent1="accent1" accent2="accent2" accent3="accent3" accent4="accent4" accent5="accent5" accent6="accent6" hlink="hlink" folHlink="folHlink"/>
190
+ <p:sldLayoutIdLst>${k}</p:sldLayoutIdLst>
191
+ <p:txStyles><p:titleStyle>${N(t.textStyles.title)}</p:titleStyle><p:bodyStyle>${N(t.textStyles.body)}</p:bodyStyle><p:otherStyle>${N(t.textStyles.other)}</p:otherStyle></p:txStyles></p:sldMaster>`), l["ppt/slideMasters/_rels/slideMaster1.xml.rels"] = o(u(
192
+ t.layouts.map(({ part: s }) => `<Relationship Id="rId${s}" Type="${p}/slideLayout" Target="../slideLayouts/slideLayout${s}.xml"/>`).join("") + `<Relationship Id="rIdTheme" Type="${p}/theme" Target="../theme/theme1.xml"/>`
193
+ ));
194
+ for (const s of t.layouts) {
195
+ const S = (s.decorations ?? []).map((g, M) => z(g, M + 2, r, n)).join(""), R = (((i = s.decorations) == null ? void 0 : i.length) ?? 0) + 2, X = s.placeholders.map((g, M) => g.type === "sldNum" ? G(R + M, s.part, d(g.rect)) : F(R + M, g.name, g.type, d(g.rect), g.index)).join(""), U = s.background ? `<p:bg><p:bgPr><a:solidFill>${C(s.background)}</a:solidFill><a:effectLst/></p:bgPr></p:bg>` : "";
196
+ l[`ppt/slideLayouts/slideLayout${s.part}.xml`] = o(`${y}<p:sldLayout xmlns:a="${h}" xmlns:r="${p}" xmlns:p="${b}" type="${s.type}" showMasterSp="1">
197
+ <p:cSld name="${f(s.name)}">${U}<p:spTree>${L}${S}${X}</p:spTree></p:cSld>
198
+ <p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:sldLayout>`), l[`ppt/slideLayouts/_rels/slideLayout${s.part}.xml.rels`] = o(u(
199
+ `<Relationship Id="rId1" Type="${p}/slideMaster" Target="../slideMasters/slideMaster1.xml"/>`
200
+ ));
201
+ }
202
+ const I = t.layouts.find(({ part: s }) => s === t.initialLayoutPart).placeholders.filter(({ type: s }) => s !== "sldNum").map((s, S) => le(S + 2, s)).join("");
203
+ return l["ppt/slides/slide1.xml"] = o(`${y}<p:sld xmlns:a="${h}" xmlns:r="${p}" xmlns:p="${b}">
204
+ <p:cSld><p:spTree>${L}${I}</p:spTree></p:cSld>
205
+ <p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:sld>`), l["ppt/slides/_rels/slide1.xml.rels"] = o(u(
206
+ `<Relationship Id="rId1" Type="${p}/slideLayout" Target="../slideLayouts/slideLayout${t.initialLayoutPart}.xml"/>`
207
+ )), l;
208
+ }
209
+ const c = (e, a, t, l) => ({ x: e, y: a, w: t, h: l }), T = { name: "页码", type: "sldNum", rect: c(1120, 662, 96, 34), index: 12 };
210
+ function w(e) {
211
+ return [
212
+ {
213
+ part: 1,
214
+ type: "title",
215
+ name: "标题页",
216
+ placeholders: [
217
+ { name: "标题", type: "ctrTitle", rect: c(126, 184, 1028, 160) },
218
+ { name: "副标题", type: "subTitle", rect: c(206, 370, 868, 94), index: 1 },
219
+ T
220
+ ],
221
+ decorations: [{
222
+ name: "标题强调线",
223
+ preset: "rect",
224
+ rect: c(126, 354, 132, 7),
225
+ fill: { slot: e }
226
+ }]
227
+ },
228
+ {
229
+ part: 2,
230
+ type: "obj",
231
+ name: "标题和内容",
232
+ placeholders: [
233
+ { name: "标题", type: "title", rect: c(80, 50, 1120, 92) },
234
+ { name: "内容", type: "body", rect: c(96, 166, 1088, 446), index: 1 },
235
+ T
236
+ ]
237
+ },
238
+ {
239
+ part: 3,
240
+ type: "twoObj",
241
+ name: "双内容",
242
+ placeholders: [
243
+ { name: "标题", type: "title", rect: c(80, 50, 1120, 92) },
244
+ { name: "左侧内容", type: "body", rect: c(96, 166, 520, 446), index: 1 },
245
+ { name: "右侧内容", type: "body", rect: c(664, 166, 520, 446), index: 2 },
246
+ T
247
+ ]
248
+ },
249
+ {
250
+ part: 4,
251
+ type: "secHead",
252
+ name: "章节页",
253
+ placeholders: [
254
+ { name: "章节标题", type: "title", rect: c(126, 238, 1028, 132) },
255
+ { name: "章节说明", type: "body", rect: c(206, 390, 868, 88), index: 1 },
256
+ T
257
+ ],
258
+ decorations: [{
259
+ name: "章节强调块",
260
+ preset: "rect",
261
+ rect: c(80, 238, 16, 240),
262
+ fill: { slot: e }
263
+ }]
264
+ },
265
+ { part: 5, type: "blank", name: "空白", placeholders: [T] }
266
+ ];
267
+ }
268
+ function O(e, a, t, l) {
269
+ const r = (n) => ({ latin: n, ea: n, cs: n, scripts: {} });
270
+ return { id: "ppt/theme/theme1.xml", name: e, colors: a, fonts: { major: r(t), minor: r(l) } };
271
+ }
272
+ const x = (e, a, t, l = {}) => ({
273
+ font: a,
274
+ color: { slot: e },
275
+ size: t,
276
+ ...l
277
+ }), j = {
278
+ aurora: {
279
+ id: "aurora",
280
+ name: "极光",
281
+ description: "明亮留白与流动色彩",
282
+ preview: {
283
+ surface: "#F6F7FF",
284
+ foreground: "#17223B",
285
+ accent: "#6D5EF7",
286
+ secondary: "#32C6B7",
287
+ motif: "orb"
288
+ },
289
+ theme: O("极光", {
290
+ dk1: "rgb(23,34,59)",
291
+ lt1: "rgb(246,247,255)",
292
+ dk2: "rgb(48,55,90)",
293
+ lt2: "rgb(231,235,252)",
294
+ accent1: "rgb(109,94,247)",
295
+ accent2: "rgb(50,198,183)",
296
+ accent3: "rgb(255,145,112)",
297
+ accent4: "rgb(83,139,255)",
298
+ accent5: "rgb(191,114,255)",
299
+ accent6: "rgb(86,198,113)",
300
+ hlink: "rgb(70,91,220)",
301
+ folHlink: "rgb(142,83,183)"
302
+ }, "Aptos Display", "Aptos"),
303
+ masterBackground: { slot: "lt1" },
304
+ masterDecorations: [
305
+ { name: "极光主光晕", preset: "ellipse", rect: c(1010, -170, 440, 440), fill: { slot: "accent1", alpha: 0.14 } },
306
+ { name: "极光次光晕", preset: "ellipse", rect: c(-130, 560, 300, 300), fill: { slot: "accent2", alpha: 0.18 } }
307
+ ],
308
+ textStyles: {
309
+ title: x("dk1", "major", 38, { step: 1, bold: !0 }),
310
+ body: x("dk1", "minor", 22, { step: 1.25, bullet: !0 }),
311
+ other: x("dk2", "minor", 18, { step: 0.75 })
312
+ },
313
+ layouts: w("accent1"),
314
+ initialLayoutPart: 1
315
+ },
316
+ editorial: {
317
+ id: "editorial",
318
+ name: "刊页",
319
+ description: "纸张质感与编辑式分栏",
320
+ preview: {
321
+ surface: "#F5F0E8",
322
+ foreground: "#221F1A",
323
+ accent: "#C94F37",
324
+ secondary: "#D5A84B",
325
+ motif: "rule"
326
+ },
327
+ theme: O("刊页", {
328
+ dk1: "rgb(34,31,26)",
329
+ lt1: "rgb(245,240,232)",
330
+ dk2: "rgb(73,65,55)",
331
+ lt2: "rgb(229,220,207)",
332
+ accent1: "rgb(201,79,55)",
333
+ accent2: "rgb(213,168,75)",
334
+ accent3: "rgb(67,121,112)",
335
+ accent4: "rgb(91,105,142)",
336
+ accent5: "rgb(151,92,111)",
337
+ accent6: "rgb(111,126,78)",
338
+ hlink: "rgb(44,91,139)",
339
+ folHlink: "rgb(121,72,118)"
340
+ }, "Georgia", "Arial"),
341
+ masterBackground: { slot: "lt1" },
342
+ masterDecorations: [
343
+ { name: "刊页左栏", preset: "rect", rect: c(0, 0, 18, 720), fill: { slot: "accent1" } },
344
+ { name: "刊页页脚线", preset: "line", rect: c(80, 650, 1120, 1), stroke: { slot: "accent2", width: 2 } }
345
+ ],
346
+ textStyles: {
347
+ title: x("dk1", "major", 36, { step: 1, bold: !0 }),
348
+ body: x("dk2", "minor", 21, { step: 1, bullet: !0 }),
349
+ other: x("dk2", "minor", 17, { step: 0.5 })
350
+ },
351
+ layouts: w("accent1"),
352
+ initialLayoutPart: 1
353
+ },
354
+ midnight: {
355
+ id: "midnight",
356
+ name: "夜幕",
357
+ description: "深色画布与高对比光束",
358
+ preview: {
359
+ surface: "#101827",
360
+ foreground: "#F7FAFF",
361
+ accent: "#4ED7F1",
362
+ secondary: "#9B8CFF",
363
+ motif: "beam"
364
+ },
365
+ theme: O("夜幕", {
366
+ dk1: "rgb(16,24,39)",
367
+ lt1: "rgb(247,250,255)",
368
+ dk2: "rgb(31,43,64)",
369
+ lt2: "rgb(215,224,238)",
370
+ accent1: "rgb(78,215,241)",
371
+ accent2: "rgb(155,140,255)",
372
+ accent3: "rgb(255,111,145)",
373
+ accent4: "rgb(255,196,92)",
374
+ accent5: "rgb(75,139,255)",
375
+ accent6: "rgb(85,221,166)",
376
+ hlink: "rgb(99,202,255)",
377
+ folHlink: "rgb(189,148,255)"
378
+ }, "Arial", "Arial"),
379
+ masterBackground: { slot: "dk1" },
380
+ masterDecorations: [
381
+ { name: "夜幕主光束", preset: "rect", rect: c(930, -210, 130, 700), fill: { slot: "accent1", alpha: 0.16 }, rotation: 28 },
382
+ { name: "夜幕次光束", preset: "rect", rect: c(1080, -160, 88, 620), fill: { slot: "accent2", alpha: 0.2 }, rotation: 28 }
383
+ ],
384
+ textStyles: {
385
+ title: x("lt1", "major", 38, { step: 1, bold: !0 }),
386
+ body: x("lt2", "minor", 22, { step: 1.25, bullet: !0 }),
387
+ other: x("lt2", "minor", 18, { step: 0.75 })
388
+ },
389
+ layouts: w("accent1"),
390
+ initialLayoutPart: 1
391
+ }
392
+ };
393
+ Object.freeze(
394
+ Object.values(j).map(({ id: e, name: a, description: t, preview: l }) => Object.freeze({
395
+ id: e,
396
+ name: a,
397
+ description: t,
398
+ preview: Object.freeze({ ...l })
399
+ }))
400
+ );
401
+ function pe(e, a = {}) {
402
+ const t = Object.prototype.hasOwnProperty.call(j, e) ? j[e] : void 0;
403
+ if (!t) throw new Error(`未知内置模板:${e}`);
404
+ const l = a.width ?? 1280, r = a.height ?? 720;
405
+ D(l, "页面宽度"), D(r, "页面高度");
406
+ const n = W(re(l, r, t));
407
+ return Z(n.package), n.bytes;
408
+ }
409
+ export {
410
+ pe as createPptxFromTemplate
411
+ };