@web-ppt/edit-core 0.5.0-beta.2 → 0.5.0-beta.7

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 (337) hide show
  1. package/CHANGELOG.md +171 -0
  2. package/README.md +164 -21
  3. package/dist/alt-text.d.ts +5 -0
  4. package/dist/appearance/index.d.ts +12 -0
  5. package/dist/appearance/materialize.d.ts +4 -0
  6. package/dist/appearance/types.d.ts +26 -0
  7. package/dist/appearance/values.d.ts +9 -0
  8. package/dist/appearance.js +301 -0
  9. package/dist/cfb/index.d.ts +5 -0
  10. package/dist/cfb/read.d.ts +16 -0
  11. package/dist/cfb/write.d.ts +3 -0
  12. package/dist/cfb.js +208 -0
  13. package/dist/change-classification.d.ts +3 -3
  14. package/dist/chart/category-binding.d.ts +4 -0
  15. package/dist/chart/category-commands.d.ts +23 -0
  16. package/dist/chart/category-levels.d.ts +14 -0
  17. package/dist/chart/category-matrix.d.ts +2 -0
  18. package/dist/chart/category-value.d.ts +2 -0
  19. package/dist/chart/category-workbook.d.ts +13 -0
  20. package/dist/chart/commands.d.ts +28 -0
  21. package/dist/chart/context.d.ts +12 -0
  22. package/dist/chart/dataset-merge.d.ts +5 -0
  23. package/dist/chart/formula.d.ts +13 -0
  24. package/dist/chart/identity-frames.d.ts +4 -0
  25. package/dist/chart/identity-scopes.d.ts +6 -0
  26. package/dist/chart/identity.d.ts +24 -0
  27. package/dist/chart/index.d.ts +8 -0
  28. package/dist/chart/limits.d.ts +6 -0
  29. package/dist/chart/locator.d.ts +4 -0
  30. package/dist/chart/materialize.d.ts +7 -0
  31. package/dist/chart/ordering.d.ts +9 -0
  32. package/dist/chart/part-graph.d.ts +5 -0
  33. package/dist/chart/patch-validation.d.ts +3 -0
  34. package/dist/chart/plot-kinds.d.ts +2 -0
  35. package/dist/chart/projection.d.ts +8 -0
  36. package/dist/chart/save.d.ts +4 -0
  37. package/dist/chart/shared-added-plan.d.ts +19 -0
  38. package/dist/chart/shared-added-records.d.ts +8 -0
  39. package/dist/chart/shared-address.d.ts +5 -0
  40. package/dist/chart/shared-allocate.d.ts +7 -0
  41. package/dist/chart/shared-cache-codec.d.ts +5 -0
  42. package/dist/chart/shared-cache-identities.d.ts +3 -0
  43. package/dist/chart/shared-cache-migration.d.ts +7 -0
  44. package/dist/chart/shared-cache-save.d.ts +3 -0
  45. package/dist/chart/shared-cache-scopes.d.ts +13 -0
  46. package/dist/chart/shared-cache.d.ts +11 -0
  47. package/dist/chart/shared-category.d.ts +4 -0
  48. package/dist/chart/shared-cell.d.ts +9 -0
  49. package/dist/chart/shared-family.d.ts +26 -0
  50. package/dist/chart/shared-fields.d.ts +18 -0
  51. package/dist/chart/shared-graph.d.ts +19 -0
  52. package/dist/chart/shared-growth-space.d.ts +5 -0
  53. package/dist/chart/shared-inserted-cells.d.ts +14 -0
  54. package/dist/chart/shared-inserted-command.d.ts +7 -0
  55. package/dist/chart/shared-inserted-layout.d.ts +16 -0
  56. package/dist/chart/shared-inserted-project.d.ts +14 -0
  57. package/dist/chart/shared-inserted-records.d.ts +16 -0
  58. package/dist/chart/shared-inserted-save.d.ts +6 -0
  59. package/dist/chart/shared-joint-command.d.ts +9 -0
  60. package/dist/chart/shared-joint-records.d.ts +9 -0
  61. package/dist/chart/shared-record-axis.d.ts +25 -0
  62. package/dist/chart/shared-record-remove.d.ts +13 -0
  63. package/dist/chart/shared-record-stage.d.ts +2 -0
  64. package/dist/chart/shared-records.d.ts +2 -0
  65. package/dist/chart/shared-rows.d.ts +17 -0
  66. package/dist/chart/shared-runtime.d.ts +19 -0
  67. package/dist/chart/shared-save-plan.d.ts +4 -0
  68. package/dist/chart/shared-save.d.ts +3 -0
  69. package/dist/chart/shared-series.d.ts +6 -0
  70. package/dist/chart/shared-source-cache.d.ts +4 -0
  71. package/dist/chart/shared-topology.d.ts +9 -0
  72. package/dist/chart/shared-unresolved.d.ts +3 -0
  73. package/dist/chart/shared-validation.d.ts +6 -0
  74. package/dist/chart/shared-workbook-source.d.ts +6 -0
  75. package/dist/chart/shared-xy-command.d.ts +7 -0
  76. package/dist/chart/shared-xy-family.d.ts +16 -0
  77. package/dist/chart/shared-xy-project.d.ts +6 -0
  78. package/dist/chart/shared-xy-records.d.ts +23 -0
  79. package/dist/chart/shared-xy-save.d.ts +5 -0
  80. package/dist/chart/shared-xy-source.d.ts +39 -0
  81. package/dist/chart/shared.d.ts +13 -0
  82. package/dist/chart/source.d.ts +11 -0
  83. package/dist/chart/types.d.ts +86 -0
  84. package/dist/chart/validation.d.ts +24 -0
  85. package/dist/chart/workbook-range.d.ts +16 -0
  86. package/dist/chart/workbook-read.d.ts +7 -0
  87. package/dist/chart/workbook-write.d.ts +9 -0
  88. package/dist/chart/workbook.d.ts +25 -0
  89. package/dist/chart/xml-data.d.ts +14 -0
  90. package/dist/chart/xml-namespaces.d.ts +16 -0
  91. package/dist/chart-design/index.d.ts +10 -0
  92. package/dist/chart-design/types.d.ts +11 -0
  93. package/dist/chart-design/xml.d.ts +2 -0
  94. package/dist/chart-design.js +361 -0
  95. package/dist/chart-ex/index.d.ts +15 -0
  96. package/dist/chart-ex/workbook.d.ts +6 -0
  97. package/dist/chart-ex/xml.d.ts +14 -0
  98. package/dist/chart-ex.js +457 -0
  99. package/dist/chart-shared/index.d.ts +12 -0
  100. package/dist/chart-shared.js +1 -0
  101. package/dist/chart.js +1 -0
  102. package/dist/clipboard-links-GuPtqr1z.js +778 -0
  103. package/dist/clipboard-package.d.ts +4 -0
  104. package/dist/clipboard-source.d.ts +6 -2
  105. package/dist/clipboard-trees.d.ts +9 -0
  106. package/dist/commands/add-slide-identity.d.ts +2 -0
  107. package/dist/commands/bullet-image-resource.d.ts +11 -0
  108. package/dist/commands/clear-format.d.ts +4 -0
  109. package/dist/commands/common-object-slide-patch.d.ts +4 -0
  110. package/dist/commands/common-object-slide-types.d.ts +68 -0
  111. package/dist/commands/direct-format-patches.d.ts +11 -5
  112. package/dist/commands/distribute-elements.d.ts +4 -0
  113. package/dist/commands/edit-table-grid.d.ts +10 -0
  114. package/dist/commands/element-alt-text.d.ts +8 -0
  115. package/dist/commands/element-arrangement.d.ts +17 -0
  116. package/dist/commands/element-effects.d.ts +1 -1
  117. package/dist/commands/element-fill.d.ts +1 -1
  118. package/dist/commands/element-geometry.d.ts +5 -2
  119. package/dist/commands/element-image-content.d.ts +2 -2
  120. package/dist/commands/element-link.d.ts +1 -1
  121. package/dist/commands/element-name.d.ts +1 -1
  122. package/dist/commands/element-stroke.d.ts +1 -1
  123. package/dist/commands/element-text.d.ts +1 -1
  124. package/dist/commands/element-transform.d.ts +2 -2
  125. package/dist/commands/geometry-types.d.ts +23 -1
  126. package/dist/commands/hierarchy-record.d.ts +5 -0
  127. package/dist/commands/image-resource.d.ts +8 -1
  128. package/dist/commands/insertion-host.d.ts +14 -1
  129. package/dist/commands/layout-property.d.ts +7 -0
  130. package/dist/commands/master-property.d.ts +5 -0
  131. package/dist/commands/master-text-style-types.d.ts +27 -0
  132. package/dist/commands/master-text-style.d.ts +7 -0
  133. package/dist/commands/paste-resources.d.ts +9 -5
  134. package/dist/commands/patch-apply.d.ts +3 -0
  135. package/dist/commands/patch-count.d.ts +1 -0
  136. package/dist/commands/patch-invalidation.d.ts +1 -1
  137. package/dist/commands/patch-stage.d.ts +4 -0
  138. package/dist/commands/record-override.d.ts +5 -0
  139. package/dist/commands/replace-image.d.ts +6 -1
  140. package/dist/commands/sections.d.ts +10 -0
  141. package/dist/commands/set-preset.d.ts +5 -0
  142. package/dist/commands/slide-property-types.d.ts +55 -5
  143. package/dist/commands/slide-size.d.ts +7 -0
  144. package/dist/commands/spid.d.ts +1 -1
  145. package/dist/commands/table-grid-patch.d.ts +12 -0
  146. package/dist/commands/text-target.d.ts +2 -2
  147. package/dist/commands/theme-types.d.ts +47 -0
  148. package/dist/commands/theme.d.ts +9 -0
  149. package/dist/commands/types.d.ts +194 -17
  150. package/dist/commands/ungroup-source.d.ts +3 -0
  151. package/dist/comments/index.d.ts +35 -0
  152. package/dist/comments/save.d.ts +3 -0
  153. package/dist/comments/state.d.ts +10 -0
  154. package/dist/comments/xml.d.ts +12 -0
  155. package/dist/comments.js +782 -0
  156. package/dist/common-object-slide-types.d.ts +34 -0
  157. package/dist/data-validation.d.ts +1 -1
  158. package/dist/describe/budget.d.ts +3 -0
  159. package/dist/describe/index.d.ts +5 -0
  160. package/dist/describe/read.d.ts +4 -0
  161. package/dist/describe/types.d.ts +103 -0
  162. package/dist/describe.js +192 -0
  163. package/dist/design-dependencies.d.ts +8 -0
  164. package/dist/design-projection-package.d.ts +10 -0
  165. package/dist/design-target.d.ts +10 -0
  166. package/dist/design.d.ts +3 -0
  167. package/dist/document-extensions.d.ts +9 -0
  168. package/dist/document.d.ts +1 -1
  169. package/dist/dynamic-projection.d.ts +6 -0
  170. package/dist/edit-core.js +5420 -4111
  171. package/dist/editor.d.ts +15 -3
  172. package/dist/element-source.d.ts +11 -0
  173. package/dist/element-spids.d.ts +4 -0
  174. package/dist/extension-address-journal.d.ts +9 -0
  175. package/dist/extension-address-remap.d.ts +14 -0
  176. package/dist/extension-addresses.d.ts +20 -0
  177. package/dist/extension-copy-history.d.ts +7 -0
  178. package/dist/extension-copy.d.ts +16 -0
  179. package/dist/extension-migration-receipt.d.ts +34 -0
  180. package/dist/extension-recovery-context.d.ts +5 -0
  181. package/dist/extension-runtime.d.ts +64 -0
  182. package/dist/generate/comments.d.ts +3 -0
  183. package/dist/generate/compatibility-parts.d.ts +14 -0
  184. package/dist/generate/compatibility-references.d.ts +3 -0
  185. package/dist/generate/compatibility.d.ts +4 -0
  186. package/dist/generate/index.d.ts +1 -0
  187. package/dist/generate/master-defaults.d.ts +4 -0
  188. package/dist/generate/materialize.d.ts +2 -2
  189. package/dist/generate/math.d.ts +3 -0
  190. package/dist/generate/portable-clipboard.d.ts +4 -0
  191. package/dist/generate/projection-tree.d.ts +8 -0
  192. package/dist/generate/template.d.ts +68 -1
  193. package/dist/generate/text-body.d.ts +2 -0
  194. package/dist/generate/text-effects.d.ts +5 -0
  195. package/dist/generate/text-override.d.ts +8 -0
  196. package/dist/generate/validation.d.ts +3 -0
  197. package/dist/generate/warp.d.ts +2 -0
  198. package/dist/generate.js +1232 -512
  199. package/dist/history.d.ts +11 -1
  200. package/dist/identities.d.ts +4 -0
  201. package/dist/image-content.d.ts +5 -2
  202. package/dist/image-resource-history.d.ts +2 -0
  203. package/dist/index-C2r7c6G6.js +714 -0
  204. package/dist/index-CYDvbiwF.js +1 -0
  205. package/dist/index.d.ts +35 -7
  206. package/dist/ink/index.d.ts +27 -0
  207. package/dist/ink/model.d.ts +4 -0
  208. package/dist/ink/save.d.ts +3 -0
  209. package/dist/ink/source.d.ts +7 -0
  210. package/dist/ink.js +324 -0
  211. package/dist/layout-assets.d.ts +3 -1
  212. package/dist/layout-projection.d.ts +17 -5
  213. package/dist/layout-state.d.ts +2 -0
  214. package/dist/layout-types.d.ts +42 -0
  215. package/dist/layout.d.ts +5 -0
  216. package/dist/lint/color.d.ts +5 -0
  217. package/dist/lint/index.d.ts +7 -0
  218. package/dist/lint/prompts.d.ts +3 -0
  219. package/dist/lint/report.d.ts +21 -0
  220. package/dist/lint/sampler-batch.d.ts +4 -0
  221. package/dist/lint/sampler-images.d.ts +2 -0
  222. package/dist/lint/sampler.d.ts +9 -0
  223. package/dist/lint/snapshot.d.ts +34 -0
  224. package/dist/lint/types.d.ts +67 -0
  225. package/dist/lint-sampler.js +187 -0
  226. package/dist/lint.js +659 -0
  227. package/dist/master-state.d.ts +3 -0
  228. package/dist/master-text-style-state.d.ts +3 -0
  229. package/dist/master-types.d.ts +55 -0
  230. package/dist/master.d.ts +5 -0
  231. package/dist/media/audio-icon.d.ts +2 -0
  232. package/dist/media/commands.d.ts +3 -0
  233. package/dist/media/index.d.ts +10 -0
  234. package/dist/media/markup.d.ts +10 -0
  235. package/dist/media/mp4-boxes.d.ts +12 -0
  236. package/dist/media/mp4-fragments.d.ts +8 -0
  237. package/dist/media/mp4-samples.d.ts +4 -0
  238. package/dist/media/mp4.d.ts +2 -0
  239. package/dist/media/poster.d.ts +2 -0
  240. package/dist/media/replace-poster.d.ts +3 -0
  241. package/dist/media/resource.d.ts +4 -0
  242. package/dist/media/source.d.ts +14 -0
  243. package/dist/media/types.d.ts +33 -0
  244. package/dist/media-properties.d.ts +4 -0
  245. package/dist/media.js +1630 -0
  246. package/dist/model-invariants-BM19JVxy.js +8980 -0
  247. package/dist/object-source.d.ts +11 -0
  248. package/dist/ole/container.d.ts +14 -0
  249. package/dist/ole/content.d.ts +94 -0
  250. package/dist/ole/index.d.ts +20 -0
  251. package/dist/ole/preview.d.ts +3 -0
  252. package/dist/ole/save.d.ts +2 -0
  253. package/dist/ole/state.d.ts +16 -0
  254. package/dist/ole.js +870 -0
  255. package/dist/opc.js +1 -1
  256. package/dist/paragraph-level.d.ts +2 -2
  257. package/dist/paragraph-property-schema.d.ts +4 -1
  258. package/dist/{patch-D7lZelRa.js → patch-BwhfBbYE.js} +10 -10
  259. package/dist/patch-events.d.ts +5 -1
  260. package/dist/ppt/appearance.d.ts +11 -0
  261. package/dist/ppt/binary.d.ts +20 -0
  262. package/dist/ppt/drawing.d.ts +18 -0
  263. package/dist/ppt/geometry.d.ts +4 -0
  264. package/dist/ppt/index.d.ts +12 -0
  265. package/dist/ppt/pictures.d.ts +11 -0
  266. package/dist/ppt/text.d.ts +9 -0
  267. package/dist/ppt.js +774 -0
  268. package/dist/preset-geometry.d.ts +6 -0
  269. package/dist/projection.d.ts +2 -0
  270. package/dist/query-BHLjWjnu.js +903 -0
  271. package/dist/recovery-identity.d.ts +1 -0
  272. package/dist/recovery-migrations.d.ts +3 -0
  273. package/dist/recovery.d.ts +3 -0
  274. package/dist/resize/index.d.ts +6 -0
  275. package/dist/resize/text.d.ts +4 -0
  276. package/dist/resize.js +5090 -0
  277. package/dist/retained-element-origins.d.ts +6 -0
  278. package/dist/run-property-fields.d.ts +12 -0
  279. package/dist/run-property-schema.d.ts +3 -1
  280. package/dist/run-style.d.ts +15 -0
  281. package/dist/save/alt-text.d.ts +4 -0
  282. package/dist/save/comments.d.ts +3 -0
  283. package/dist/save/effects.d.ts +2 -1
  284. package/dist/save/extension-availability.d.ts +3 -0
  285. package/dist/save/extension-elements.d.ts +26 -0
  286. package/dist/save/index.d.ts +6 -1
  287. package/dist/save/insertion.d.ts +6 -5
  288. package/dist/save/layout-properties.d.ts +4 -0
  289. package/dist/save/master-properties.d.ts +5 -0
  290. package/dist/save/paragraph-overrides.d.ts +3 -0
  291. package/dist/save/slide-parts.d.ts +1 -0
  292. package/dist/save/table.d.ts +2 -0
  293. package/dist/save/xfrm.d.ts +8 -2
  294. package/dist/save.js +493 -498
  295. package/dist/sections.d.ts +8 -0
  296. package/dist/session-assets.d.ts +4 -0
  297. package/dist/slide-parts-D0o_DDhi.js +1331 -0
  298. package/dist/slide-size.d.ts +6 -0
  299. package/dist/smartart/drawing.d.ts +3 -0
  300. package/dist/smartart/index.d.ts +16 -0
  301. package/dist/smartart/model.d.ts +18 -0
  302. package/dist/smartart/save.d.ts +3 -0
  303. package/dist/smartart.js +604 -0
  304. package/dist/source-retention.d.ts +7 -0
  305. package/dist/space.d.ts +37 -0
  306. package/dist/table-cell.d.ts +7 -1
  307. package/dist/table-grid-projection.d.ts +6 -0
  308. package/dist/table-grid.d.ts +45 -0
  309. package/dist/table-invariants.d.ts +4 -0
  310. package/dist/table-rows.d.ts +2 -1
  311. package/dist/table-scale.d.ts +4 -0
  312. package/dist/table-style.d.ts +5 -4
  313. package/dist/templates/index.d.ts +4 -0
  314. package/dist/templates/recipes.d.ts +5 -0
  315. package/dist/templates/types.d.ts +17 -0
  316. package/dist/templates.js +543 -0
  317. package/dist/text-flatten.d.ts +6 -0
  318. package/dist/text-fragment.d.ts +5 -0
  319. package/dist/text-model.d.ts +8 -8
  320. package/dist/text-override-validation.d.ts +6 -2
  321. package/dist/text-selection.d.ts +4 -0
  322. package/dist/theme-projection.d.ts +8 -0
  323. package/dist/theme-xml.d.ts +3 -0
  324. package/dist/theme.d.ts +14 -0
  325. package/dist/types.d.ts +174 -8
  326. package/dist/xml/index.d.ts +1 -1
  327. package/dist/xml/nodes.d.ts +2 -2
  328. package/dist/xml/shape-ids.d.ts +3 -0
  329. package/dist/xml.js +19 -16
  330. package/package.json +73 -5
  331. package/schemas/describe.schema.json +479 -0
  332. package/schemas/lint.schema.json +145 -0
  333. package/dist/document-B1jjN-QB.js +0 -274
  334. package/dist/image-resource-DbgJS9n-.js +0 -24
  335. package/dist/index-D2JizcOQ.js +0 -706
  336. package/dist/insertion-CGpb504L.js +0 -6152
  337. package/dist/table-style-part-DBtpxmuo.js +0 -1042
@@ -0,0 +1,543 @@
1
+ import { deflateSync as V } from "fflate";
2
+ import { THEME_COLOR_SLOTS as q } from "@web-ppt/core";
3
+ const J = new Uint8Array(), K = Object.freeze(/* @__PURE__ */ Object.create(null)), R = Object.freeze(/* @__PURE__ */ Object.create(null));
4
+ function Q(e, t, a = R) {
5
+ let r = e, l = t, n = a, p = !1;
6
+ const i = {
7
+ format: "pptx",
8
+ get bytes() {
9
+ return r;
10
+ },
11
+ get parts() {
12
+ return l;
13
+ },
14
+ get assets() {
15
+ return n;
16
+ },
17
+ get disposed() {
18
+ return p;
19
+ }
20
+ };
21
+ return Object.defineProperty(i, "dispose", {
22
+ value: () => {
23
+ r = J, l = K, n = R, p = !0;
24
+ }
25
+ }), Object.freeze(i);
26
+ }
27
+ function ee(e) {
28
+ var t;
29
+ (t = e.dispose) == null || t.call(e);
30
+ }
31
+ const G = new Uint32Array(256);
32
+ for (let e = 0; e < 256; e++) {
33
+ let t = e;
34
+ for (let a = 0; a < 8; a++) t = t & 1 ? 3988292384 ^ t >>> 1 : t >>> 1;
35
+ G[e] = t >>> 0;
36
+ }
37
+ function te(e) {
38
+ let t = 4294967295;
39
+ for (const a of e) t = G[(t ^ a) & 255] ^ t >>> 8;
40
+ return (t ^ 4294967295) >>> 0;
41
+ }
42
+ const ae = 33639248, re = 101010256, le = 67324752;
43
+ new TextDecoder("utf-8", { fatal: !0 });
44
+ const ne = new TextEncoder(), se = /* @__PURE__ */ new Set([
45
+ "7z",
46
+ "aac",
47
+ "avi",
48
+ "eot",
49
+ "gif",
50
+ "gz",
51
+ "jpeg",
52
+ "jpg",
53
+ "m4a",
54
+ "m4v",
55
+ "mov",
56
+ "mp3",
57
+ "mp4",
58
+ "mpeg",
59
+ "mpg",
60
+ "ogg",
61
+ "otf",
62
+ "png",
63
+ "ttf",
64
+ "webm",
65
+ "webp",
66
+ "woff",
67
+ "woff2",
68
+ "zip"
69
+ ]), oe = (e, t) => e < t ? -1 : e > t ? 1 : 0, j = (e) => new DataView(e.buffer, e.byteOffset, e.byteLength);
70
+ function pe(e) {
71
+ const t = e.reduce((l, n) => l + n.length, 0), a = new Uint8Array(t);
72
+ let r = 0;
73
+ for (const l of e)
74
+ a.set(l, r), r += l.length;
75
+ return a;
76
+ }
77
+ function ce(e, t) {
78
+ const a = Object.keys(e), r = new Set(a), l = a.filter((c) => t.get(c) !== null);
79
+ if (l.push(...[...t].filter(([c, $]) => !r.has(c) && $ !== null).map(([c]) => c).sort(oe)), l.length > 65535) throw new Error("重压结果需要 ZIP64 条目计数,当前不支持");
80
+ const n = [], p = [];
81
+ let i = 0;
82
+ for (const c of l) {
83
+ const $ = t.get(c) ?? e[c];
84
+ if (!$) throw new Error(`重压时缺少 OPC part:${c}`);
85
+ const o = ie(c, $, i);
86
+ n.push(o.local), p.push(o.central), i += o.local.length;
87
+ }
88
+ const f = p.reduce((c, $) => c + $.length, 0);
89
+ if (i > 4294967295 || f > 4294967295) throw new Error("重压结果需要 ZIP64 偏移,当前不支持");
90
+ const x = new Uint8Array(22), h = j(x);
91
+ return h.setUint32(0, re, !0), h.setUint16(8, l.length, !0), h.setUint16(10, l.length, !0), h.setUint32(12, f, !0), h.setUint32(16, i, !0), {
92
+ bytes: pe([...n, ...p, x]),
93
+ preservedEntries: 0,
94
+ rewrittenEntries: l.length
95
+ };
96
+ }
97
+ function ie(e, t, a) {
98
+ if (t.length > 4294967295) throw new Error(`OPC part 过大,需要 ZIP64:${e}`);
99
+ const r = ne.encode(e);
100
+ if (r.length > 65535) throw new Error(`OPC part 路径过长:${e.slice(0, 80)}`);
101
+ const l = e.slice(e.lastIndexOf(".") + 1).toLowerCase(), n = se.has(l) ? null : V(t, { level: 6 }), p = n !== null && n.length < t.length, i = p ? 8 : 0, f = p ? n : t;
102
+ if (f.length > 4294967295) throw new Error(`OPC part 压缩后过大,需要 ZIP64:${e}`);
103
+ const x = te(t), h = new Uint8Array(30 + r.length + f.length), c = j(h);
104
+ c.setUint32(0, le, !0), c.setUint16(4, 20, !0), c.setUint16(6, 2048, !0), c.setUint16(8, i, !0), c.setUint16(12, 33, !0), c.setUint32(14, x, !0), c.setUint32(18, f.length, !0), c.setUint32(22, t.length, !0), c.setUint16(26, r.length, !0), h.set(r, 30), h.set(f, 30 + r.length);
105
+ const $ = new Uint8Array(46 + r.length), o = j($);
106
+ return o.setUint32(0, ae, !0), o.setUint16(4, 798, !0), o.setUint16(6, 20, !0), o.setUint16(8, 2048, !0), o.setUint16(10, i, !0), o.setUint16(14, 33, !0), o.setUint32(16, x, !0), o.setUint32(20, f.length, !0), o.setUint32(24, t.length, !0), o.setUint16(28, r.length, !0), o.setUint32(42, a, !0), $.set(r, 46), { local: h, central: $ };
107
+ }
108
+ function de(e) {
109
+ const t = e.split("/");
110
+ if (!e || e.startsWith("/") || e.endsWith("/") || e.includes("\\") || t.some((a) => !a || a === "." || a === ".."))
111
+ throw new Error(`非法 OPC part 路径:${e}`);
112
+ }
113
+ function me(e) {
114
+ const t = /* @__PURE__ */ Object.create(null), a = /* @__PURE__ */ new Map();
115
+ for (const [n, p] of Object.entries(e)) {
116
+ de(n);
117
+ const i = p.slice();
118
+ t[n] = i, a.set(n, i);
119
+ }
120
+ const r = ce(/* @__PURE__ */ Object.create(null), a), l = Object.freeze(t);
121
+ return {
122
+ ...r,
123
+ bytes: r.bytes,
124
+ package: Q(r.bytes, l),
125
+ mode: "repacked",
126
+ fallbackReason: null
127
+ };
128
+ }
129
+ function ye(e) {
130
+ ee(e);
131
+ }
132
+ const _ = 96, D = 5376;
133
+ function z(e, t) {
134
+ if (typeof e != "number" || !Number.isFinite(e) || e < _ || e > D)
135
+ throw new Error(`${t} 必须是 ${_}–${D} 之间的有限数`);
136
+ }
137
+ const g = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
138
+ `, P = "http://schemas.openxmlformats.org/drawingml/2006/main", L = "http://schemas.openxmlformats.org/presentationml/2006/main", d = "http://schemas.openxmlformats.org/officeDocument/2006/relationships", ue = "http://schemas.openxmlformats.org/package/2006/relationships", fe = "http://schemas.openxmlformats.org/package/2006/content-types", he = new TextEncoder(), m = (e) => he.encode(e), b = (e) => e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
139
+ function Z(e, t) {
140
+ var r;
141
+ const a = (r = /^rgb\((\d+),(\d+),(\d+)\)$/.exec(e)) == null ? void 0 : r.slice(1).map(Number);
142
+ if (!a || a.some((l) => l < 0 || l > 255))
143
+ throw new Error(`${t} 不是有效主题颜色`);
144
+ return a.map((l) => l.toString(16).padStart(2, "0")).join("").toUpperCase();
145
+ }
146
+ function $e(e) {
147
+ return e ? q.map((t) => `<a:${t}><a:srgbClr val="${Z(e.colors[t], `主题 ${t}`)}"/></a:${t}>`).join("") : `<a:dk1><a:sysClr val="windowText" lastClr="000000"/></a:dk1><a:lt1><a:sysClr val="window" lastClr="FFFFFF"/></a:lt1>
148
+ <a:dk2><a:srgbClr val="1F3864"/></a:dk2><a:lt2><a:srgbClr val="F2F2F2"/></a:lt2>
149
+ <a:accent1><a:srgbClr val="4472C4"/></a:accent1><a:accent2><a:srgbClr val="ED7D31"/></a:accent2>
150
+ <a:accent3><a:srgbClr val="A5A5A5"/></a:accent3><a:accent4><a:srgbClr val="FFC000"/></a:accent4>
151
+ <a:accent5><a:srgbClr val="5B9BD5"/></a:accent5><a:accent6><a:srgbClr val="70AD47"/></a:accent6>
152
+ <a:hlink><a:srgbClr val="0563C1"/></a:hlink><a:folHlink><a:srgbClr val="954F72"/></a:folHlink>`;
153
+ }
154
+ function B(e) {
155
+ const t = `<a:latin typeface="${b(e.latin)}"/><a:ea typeface="${b(e.ea)}"/><a:cs typeface="${b(e.cs)}"/>`, a = Object.entries(e.scripts).sort(([r], [l]) => r < l ? -1 : r > l ? 1 : 0).map(([r, l]) => `<a:font script="${b(r)}" typeface="${b(l)}"/>`).join("");
156
+ return t + a;
157
+ }
158
+ function u(e, t) {
159
+ const a = Math.round(e * 9525);
160
+ if (!Number.isSafeInteger(a)) throw new Error(`${t} 超出 OOXML 安全整数范围`);
161
+ return String(a);
162
+ }
163
+ const v = (e) => `${g}<Relationships xmlns="${ue}">${e}</Relationships>`, C = `<p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr>
164
+ <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>`;
165
+ function M(e, t, a, r, l) {
166
+ const n = `<p:ph type="${a}"${l === void 0 ? "" : ` idx="${l}"`}/>`;
167
+ return `<p:sp><p:nvSpPr><p:cNvPr id="${e}" name="${t}"/><p:cNvSpPr/><p:nvPr>${n}</p:nvPr></p:nvSpPr>
168
+ <p:spPr><a:xfrm><a:off x="${u(r.x, `${t} x`)}" y="${u(r.y, `${t} y`)}"/><a:ext cx="${u(r.w, `${t} 宽度`)}" cy="${u(r.h, `${t} 高度`)}"/></a:xfrm></p:spPr>
169
+ <p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:endParaRPr lang="zh-CN"/></a:p></p:txBody></p:sp>`;
170
+ }
171
+ function Y(e, t, a) {
172
+ return `<p:sp><p:nvSpPr><p:cNvPr id="${e}" name="页码"/><p:cNvSpPr/><p:nvPr><p:ph type="sldNum" idx="12"/></p:nvPr></p:nvSpPr>
173
+ <p:spPr><a:xfrm><a:off x="${u(a.x, "页码 x")}" y="${u(a.y, "页码 y")}"/><a:ext cx="${u(a.w, "页码宽度")}" cy="${u(a.h, "页码高度")}"/></a:xfrm></p:spPr>
174
+ <p:txBody><a:bodyPr anchor="ctr"/><a:lstStyle/><a:p><a:pPr algn="r"/><a:fld id="{00000000-0000-0000-0000-${String(t).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>`;
175
+ }
176
+ function xe(e, t) {
177
+ const a = e / 1280, r = t / 720, l = (p, i, f, x) => ({
178
+ x: p * a,
179
+ y: i * r,
180
+ w: f * a,
181
+ h: x * r
182
+ }), n = (p, i) => Y(p, i, l(1120, 662, 96, 34));
183
+ return [
184
+ {
185
+ part: 1,
186
+ type: "title",
187
+ name: "标题页",
188
+ shapes: M(2, "标题", "ctrTitle", l(120, 196, 1040, 154)) + M(3, "副标题", "subTitle", l(200, 374, 880, 92), 1) + n(4, 1)
189
+ },
190
+ {
191
+ part: 2,
192
+ type: "obj",
193
+ name: "标题和内容",
194
+ shapes: M(2, "标题", "title", l(80, 52, 1120, 92)) + M(3, "内容", "body", l(96, 166, 1088, 446), 1) + n(4, 2)
195
+ },
196
+ { part: 3, type: "blank", name: "空白", shapes: n(2, 3) }
197
+ ];
198
+ }
199
+ function ge(e, t, a = 0, r = [], l) {
200
+ const n = /* @__PURE__ */ Object.create(null), p = r.some(Boolean), i = Array.from({ length: a }, (o, s) => `<Override PartName="/ppt/slides/slide${s + 1}.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slide+xml"/>`).join(`
201
+ `), f = r.map((o, s) => o ? `<Override PartName="/ppt/notesSlides/notesSlide${s + 1}.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml"/>` : "").filter(Boolean).join(`
202
+ `);
203
+ n["[Content_Types].xml"] = m(`${g}<Types xmlns="${fe}">
204
+ <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
205
+ <Default Extension="xml" ContentType="application/xml"/>
206
+ <Override PartName="/ppt/presentation.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"/>
207
+ <Override PartName="/ppt/slideMasters/slideMaster1.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml"/>
208
+ <Override PartName="/ppt/slideLayouts/slideLayout1.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/>
209
+ <Override PartName="/ppt/slideLayouts/slideLayout2.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/>
210
+ <Override PartName="/ppt/slideLayouts/slideLayout3.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/>
211
+ <Override PartName="/ppt/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/>
212
+ ${i}
213
+ ${f}
214
+ ${p ? '<Override PartName="/ppt/notesMasters/notesMaster1.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml"/>' : ""}
215
+ </Types>`), n["_rels/.rels"] = m(v(
216
+ `<Relationship Id="rId1" Type="${d}/officeDocument" Target="ppt/presentation.xml"/>`
217
+ )), n["ppt/presentation.xml"] = m(`${g}<p:presentation xmlns:a="${P}" xmlns:r="${d}" xmlns:p="${L}">
218
+ <p:sldMasterIdLst><p:sldMasterId id="2147483648" r:id="rId1"/></p:sldMasterIdLst>
219
+ ${p ? `<p:notesMasterIdLst><p:notesMasterId r:id="rId${a + 2}"/></p:notesMasterIdLst>` : ""}
220
+ <p:sldIdLst>${Array.from({ length: a }, (o, s) => `<p:sldId id="${256 + s}" r:id="rId${s + 2}"/>`).join("")}</p:sldIdLst>
221
+ <p:sldSz cx="${u(e, "页面宽度")}" cy="${u(t, "页面高度")}"/>
222
+ <p:notesSz cx="6858000" cy="9144000"/><p:defaultTextStyle/></p:presentation>`), n["ppt/_rels/presentation.xml.rels"] = m(v(
223
+ `<Relationship Id="rId1" Type="${d}/slideMaster" Target="slideMasters/slideMaster1.xml"/>` + Array.from({ length: a }, (o, s) => `<Relationship Id="rId${s + 2}" Type="${d}/slide" Target="slides/slide${s + 1}.xml"/>`).join("") + (p ? `<Relationship Id="rId${a + 2}" Type="${d}/notesMaster" Target="notesMasters/notesMaster1.xml"/>` : "")
224
+ ));
225
+ const x = b((l == null ? void 0 : l.name) ?? "Web PPT"), h = l ? B(l.fonts.major) : '<a:latin typeface=""/><a:ea typeface=""/><a:cs typeface=""/>', c = l ? B(l.fonts.minor) : '<a:latin typeface=""/><a:ea typeface=""/><a:cs typeface=""/>';
226
+ n["ppt/theme/theme1.xml"] = m(`${g}<a:theme xmlns:a="${P}" name="${x}">
227
+ <a:themeElements><a:clrScheme name="${x}">
228
+ ${$e(l)}
229
+ </a:clrScheme><a:fontScheme name="${x}">
230
+ <a:majorFont>${h}</a:majorFont>
231
+ <a:minorFont>${c}</a:minorFont>
232
+ </a:fontScheme><a:fmtScheme name="Web PPT">
233
+ <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>
234
+ <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>
235
+ <a:effectStyleLst><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/></a:effectStyle></a:effectStyleLst>
236
+ <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>
237
+ </a:fmtScheme></a:themeElements></a:theme>`), n["ppt/slideMasters/slideMaster1.xml"] = m(`${g}<p:sldMaster xmlns:a="${P}" xmlns:r="${d}" xmlns:p="${L}">
238
+ <p:cSld><p:bg><p:bgPr><a:solidFill><a:srgbClr val="FFFFFF"/></a:solidFill><a:effectLst/></p:bgPr></p:bg><p:spTree>${C}</p:spTree></p:cSld>
239
+ <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"/>
240
+ <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>
241
+ <p:txStyles><p:titleStyle/><p:bodyStyle/><p:otherStyle/></p:txStyles></p:sldMaster>`), n["ppt/slideMasters/_rels/slideMaster1.xml.rels"] = m(v(
242
+ `<Relationship Id="rId1" Type="${d}/slideLayout" Target="../slideLayouts/slideLayout1.xml"/><Relationship Id="rId2" Type="${d}/slideLayout" Target="../slideLayouts/slideLayout2.xml"/><Relationship Id="rId3" Type="${d}/slideLayout" Target="../slideLayouts/slideLayout3.xml"/><Relationship Id="rId4" Type="${d}/theme" Target="../theme/theme1.xml"/>`
243
+ ));
244
+ const $ = xe(e, t);
245
+ for (const o of $)
246
+ n[`ppt/slideLayouts/slideLayout${o.part}.xml`] = m(`${g}<p:sldLayout xmlns:a="${P}" xmlns:r="${d}" xmlns:p="${L}" type="${o.type}" showMasterSp="0">
247
+ <p:cSld name="${o.name}"><p:spTree>${C}${o.shapes}</p:spTree></p:cSld>
248
+ <p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:sldLayout>`), n[`ppt/slideLayouts/_rels/slideLayout${o.part}.xml.rels`] = m(v(
249
+ `<Relationship Id="rId1" Type="${d}/slideMaster" Target="../slideMasters/slideMaster1.xml"/>`
250
+ ));
251
+ p && (n["ppt/notesMasters/notesMaster1.xml"] = m(`${g}<p:notesMaster xmlns:a="${P}" xmlns:r="${d}" xmlns:p="${L}">
252
+ <p:cSld><p:spTree>${C}</p:spTree></p:cSld>
253
+ <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"/>
254
+ <p:hf/><p:notesStyle/></p:notesMaster>`), n["ppt/notesMasters/_rels/notesMaster1.xml.rels"] = m(v(
255
+ `<Relationship Id="rId1" Type="${d}/theme" Target="../theme/theme1.xml"/>`
256
+ )));
257
+ for (let o = 0; o < a; o++)
258
+ n[`ppt/slides/slide${o + 1}.xml`] = m(be()), n[`ppt/slides/_rels/slide${o + 1}.xml.rels`] = m(v(
259
+ `<Relationship Id="rId1" Type="${d}/slideLayout" Target="../slideLayouts/slideLayout3.xml"/>`
260
+ ));
261
+ return n;
262
+ }
263
+ function be() {
264
+ return `${g}<p:sld xmlns:a="${P}" xmlns:r="${d}" xmlns:p="${L}">
265
+ <p:cSld><p:spTree>${C}</p:spTree></p:cSld>
266
+ <p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:sld>`;
267
+ }
268
+ function I(e) {
269
+ if (e.slot === void 0 == (e.rgb === void 0))
270
+ throw new Error("模板颜色必须且只能指定主题槽或 RGB");
271
+ const t = e.slot ? `<a:schemeClr val="${e.slot}"` : `<a:srgbClr val="${Z(e.rgb, "模板颜色")}"`;
272
+ if (e.alpha === void 0) return `${t}/>`;
273
+ if (!Number.isFinite(e.alpha) || e.alpha < 0 || e.alpha > 1)
274
+ throw new Error("模板颜色透明度必须位于 0 到 1");
275
+ return `${t}><a:alpha val="${Math.round(e.alpha * 1e5)}"/></${e.slot ? "a:schemeClr" : "a:srgbClr"}>`;
276
+ }
277
+ function Se(e) {
278
+ return e ? `<a:solidFill>${I(e)}</a:solidFill>` : "<a:noFill/>";
279
+ }
280
+ function H(e, t, a, r) {
281
+ const { rect: l } = e, n = `<a:xfrm${e.rotation === void 0 ? "" : ` rot="${Math.round(e.rotation * 6e4)}"`}><a:off x="${u(l.x * a, `${e.name} x`)}" y="${u(l.y * r, `${e.name} y`)}"/><a:ext cx="${u(l.w * a, `${e.name} 宽度`)}" cy="${u(l.h * r, `${e.name} 高度`)}"/></a:xfrm>`, p = e.stroke ? `<a:ln w="${u(e.stroke.width ?? 1, `${e.name} 描边`)}"><a:solidFill>${I(e.stroke)}</a:solidFill></a:ln>` : "<a:ln><a:noFill/></a:ln>";
282
+ return `<p:sp><p:nvSpPr><p:cNvPr id="${t}" name="${b(e.name)}"/><p:cNvSpPr/><p:nvPr/></p:nvSpPr>
283
+ <p:spPr>${n}<a:prstGeom prst="${e.preset}"><a:avLst/></a:prstGeom>${Se(e.fill)}${p}</p:spPr></p:sp>`;
284
+ }
285
+ function O(e) {
286
+ return Array.from({ length: 9 }, (a, r) => {
287
+ const l = Math.max(12, e.size - (e.step ?? 0) * r), n = [
288
+ e.align ? `algn="${e.align}"` : "",
289
+ e.bullet ? `marL="${u(18 + r * 18, "文字缩进")}" indent="${u(-14, "文字悬挂")}"` : ""
290
+ ].filter(Boolean).join(" "), p = e.font === "major" ? "mj" : "mn", i = e.bullet ? '<a:buChar char="&#x2022;"/>' : "<a:buNone/>";
291
+ return `<a:lvl${r + 1}pPr${n ? ` ${n}` : ""}>${i}<a:defRPr lang="zh-CN" sz="${Math.round(l * 100)}"${e.bold ? ' b="1"' : ""}><a:solidFill>${I(e.color)}</a:solidFill><a:latin typeface="+${p}-lt"/><a:ea typeface="+${p}-ea"/><a:cs typeface="+${p}-cs"/></a:defRPr></a:lvl${r + 1}pPr>`;
292
+ }).join("");
293
+ }
294
+ function ve(e, t) {
295
+ const a = `<p:ph type="${t.type}"${t.index === void 0 ? "" : ` idx="${t.index}"`}/>`;
296
+ return `<p:sp><p:nvSpPr><p:cNvPr id="${e}" name="${b(t.name)}"/><p:cNvSpPr/><p:nvPr>${a}</p:nvPr></p:nvSpPr>
297
+ <p:spPr/><p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:endParaRPr lang="zh-CN"/></a:p></p:txBody></p:sp>`;
298
+ }
299
+ function Pe(e, t, a) {
300
+ var o;
301
+ if (a.layouts.length < 5 || !a.layouts.some(({ part: s }) => s === a.initialLayoutPart))
302
+ throw new Error("内置模板必须提供至少五种版式及有效初始版式");
303
+ const r = ge(e, t, 1, [], a.theme), l = e / 1280, n = t / 720, p = (s) => ({
304
+ x: s.x * l,
305
+ y: s.y * n,
306
+ w: s.w * l,
307
+ h: s.h * n
308
+ }), i = new TextDecoder().decode(r["[Content_Types].xml"]), f = a.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(`
309
+ `);
310
+ r["[Content_Types].xml"] = m(i.replace(
311
+ '<Override PartName="/ppt/theme/theme1.xml"',
312
+ `${f}${f ? `
313
+ ` : ""}<Override PartName="/ppt/theme/theme1.xml"`
314
+ ));
315
+ const x = a.masterDecorations.map((s, w) => H(s, w + 2, l, n)).join(""), h = a.layouts.map(({ part: s }, w) => `<p:sldLayoutId id="${2147483649 + w}" r:id="rId${s}"/>`).join("");
316
+ r["ppt/slideMasters/slideMaster1.xml"] = m(`${g}<p:sldMaster xmlns:a="${P}" xmlns:r="${d}" xmlns:p="${L}">
317
+ <p:cSld name="${b(a.theme.name)}"><p:bg><p:bgPr><a:solidFill>${I(a.masterBackground)}</a:solidFill><a:effectLst/></p:bgPr></p:bg><p:spTree>${C}${x}</p:spTree></p:cSld>
318
+ <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"/>
319
+ <p:sldLayoutIdLst>${h}</p:sldLayoutIdLst>
320
+ <p:txStyles><p:titleStyle>${O(a.textStyles.title)}</p:titleStyle><p:bodyStyle>${O(a.textStyles.body)}</p:bodyStyle><p:otherStyle>${O(a.textStyles.other)}</p:otherStyle></p:txStyles></p:sldMaster>`), r["ppt/slideMasters/_rels/slideMaster1.xml.rels"] = m(v(
321
+ a.layouts.map(({ part: s }) => `<Relationship Id="rId${s}" Type="${d}/slideLayout" Target="../slideLayouts/slideLayout${s}.xml"/>`).join("") + `<Relationship Id="rIdTheme" Type="${d}/theme" Target="../theme/theme1.xml"/>`
322
+ ));
323
+ for (const s of a.layouts) {
324
+ const w = (s.decorations ?? []).map((T, k) => H(T, k + 2, l, n)).join(""), U = (((o = s.decorations) == null ? void 0 : o.length) ?? 0) + 2, W = s.placeholders.map((T, k) => T.type === "sldNum" ? Y(U + k, s.part, p(T.rect)) : M(U + k, T.name, T.type, p(T.rect), T.index)).join(""), X = s.background ? `<p:bg><p:bgPr><a:solidFill>${I(s.background)}</a:solidFill><a:effectLst/></p:bgPr></p:bg>` : "";
325
+ r[`ppt/slideLayouts/slideLayout${s.part}.xml`] = m(`${g}<p:sldLayout xmlns:a="${P}" xmlns:r="${d}" xmlns:p="${L}" type="${s.type}" showMasterSp="1">
326
+ <p:cSld name="${b(s.name)}">${X}<p:spTree>${C}${w}${W}</p:spTree></p:cSld>
327
+ <p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:sldLayout>`), r[`ppt/slideLayouts/_rels/slideLayout${s.part}.xml.rels`] = m(v(
328
+ `<Relationship Id="rId1" Type="${d}/slideMaster" Target="../slideMasters/slideMaster1.xml"/>`
329
+ ));
330
+ }
331
+ const $ = a.layouts.find(({ part: s }) => s === a.initialLayoutPart).placeholders.filter(({ type: s }) => s !== "sldNum").map((s, w) => ve(w + 2, s)).join("");
332
+ return r["ppt/slides/slide1.xml"] = m(`${g}<p:sld xmlns:a="${P}" xmlns:r="${d}" xmlns:p="${L}">
333
+ <p:cSld><p:spTree>${C}${$}</p:spTree></p:cSld>
334
+ <p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:sld>`), r["ppt/slides/_rels/slide1.xml.rels"] = m(v(
335
+ `<Relationship Id="rId1" Type="${d}/slideLayout" Target="../slideLayouts/slideLayout${a.initialLayoutPart}.xml"/>`
336
+ )), r;
337
+ }
338
+ const y = (e, t, a, r) => ({ x: e, y: t, w: a, h: r }), F = { name: "页码", type: "sldNum", rect: y(1120, 662, 96, 34), index: 12 };
339
+ function E(e) {
340
+ return [
341
+ {
342
+ part: 1,
343
+ type: "title",
344
+ name: "标题页",
345
+ placeholders: [
346
+ { name: "标题", type: "ctrTitle", rect: y(126, 184, 1028, 160) },
347
+ { name: "副标题", type: "subTitle", rect: y(206, 370, 868, 94), index: 1 },
348
+ F
349
+ ],
350
+ decorations: [{
351
+ name: "标题强调线",
352
+ preset: "rect",
353
+ rect: y(126, 354, 132, 7),
354
+ fill: { slot: e }
355
+ }]
356
+ },
357
+ {
358
+ part: 2,
359
+ type: "obj",
360
+ name: "标题和内容",
361
+ placeholders: [
362
+ { name: "标题", type: "title", rect: y(80, 50, 1120, 92) },
363
+ { name: "内容", type: "body", rect: y(96, 166, 1088, 446), index: 1 },
364
+ F
365
+ ]
366
+ },
367
+ {
368
+ part: 3,
369
+ type: "twoObj",
370
+ name: "双内容",
371
+ placeholders: [
372
+ { name: "标题", type: "title", rect: y(80, 50, 1120, 92) },
373
+ { name: "左侧内容", type: "body", rect: y(96, 166, 520, 446), index: 1 },
374
+ { name: "右侧内容", type: "body", rect: y(664, 166, 520, 446), index: 2 },
375
+ F
376
+ ]
377
+ },
378
+ {
379
+ part: 4,
380
+ type: "secHead",
381
+ name: "章节页",
382
+ placeholders: [
383
+ { name: "章节标题", type: "title", rect: y(126, 238, 1028, 132) },
384
+ { name: "章节说明", type: "body", rect: y(206, 390, 868, 88), index: 1 },
385
+ F
386
+ ],
387
+ decorations: [{
388
+ name: "章节强调块",
389
+ preset: "rect",
390
+ rect: y(80, 238, 16, 240),
391
+ fill: { slot: e }
392
+ }]
393
+ },
394
+ { part: 5, type: "blank", name: "空白", placeholders: [F] }
395
+ ];
396
+ }
397
+ function N(e, t, a, r) {
398
+ const l = (n) => ({ latin: n, ea: n, cs: n, scripts: {} });
399
+ return { id: "ppt/theme/theme1.xml", name: e, colors: t, fonts: { major: l(a), minor: l(r) } };
400
+ }
401
+ const S = (e, t, a, r = {}) => ({
402
+ font: t,
403
+ color: { slot: e },
404
+ size: a,
405
+ ...r
406
+ }), A = {
407
+ aurora: {
408
+ id: "aurora",
409
+ name: "极光",
410
+ description: "明亮留白与流动色彩",
411
+ preview: {
412
+ surface: "#F6F7FF",
413
+ foreground: "#17223B",
414
+ accent: "#6D5EF7",
415
+ secondary: "#32C6B7",
416
+ motif: "orb"
417
+ },
418
+ theme: N("极光", {
419
+ dk1: "rgb(23,34,59)",
420
+ lt1: "rgb(246,247,255)",
421
+ dk2: "rgb(48,55,90)",
422
+ lt2: "rgb(231,235,252)",
423
+ accent1: "rgb(109,94,247)",
424
+ accent2: "rgb(50,198,183)",
425
+ accent3: "rgb(255,145,112)",
426
+ accent4: "rgb(83,139,255)",
427
+ accent5: "rgb(191,114,255)",
428
+ accent6: "rgb(86,198,113)",
429
+ hlink: "rgb(70,91,220)",
430
+ folHlink: "rgb(142,83,183)"
431
+ }, "Aptos Display", "Aptos"),
432
+ masterBackground: { slot: "lt1" },
433
+ masterDecorations: [
434
+ { name: "极光主光晕", preset: "ellipse", rect: y(1010, -170, 440, 440), fill: { slot: "accent1", alpha: 0.14 } },
435
+ { name: "极光次光晕", preset: "ellipse", rect: y(-130, 560, 300, 300), fill: { slot: "accent2", alpha: 0.18 } }
436
+ ],
437
+ textStyles: {
438
+ title: S("dk1", "major", 38, { step: 1, bold: !0 }),
439
+ body: S("dk1", "minor", 22, { step: 1.25, bullet: !0 }),
440
+ other: S("dk2", "minor", 18, { step: 0.75 })
441
+ },
442
+ layouts: E("accent1"),
443
+ initialLayoutPart: 1
444
+ },
445
+ editorial: {
446
+ id: "editorial",
447
+ name: "刊页",
448
+ description: "纸张质感与编辑式分栏",
449
+ preview: {
450
+ surface: "#F5F0E8",
451
+ foreground: "#221F1A",
452
+ accent: "#C94F37",
453
+ secondary: "#D5A84B",
454
+ motif: "rule"
455
+ },
456
+ theme: N("刊页", {
457
+ dk1: "rgb(34,31,26)",
458
+ lt1: "rgb(245,240,232)",
459
+ dk2: "rgb(73,65,55)",
460
+ lt2: "rgb(229,220,207)",
461
+ accent1: "rgb(201,79,55)",
462
+ accent2: "rgb(213,168,75)",
463
+ accent3: "rgb(67,121,112)",
464
+ accent4: "rgb(91,105,142)",
465
+ accent5: "rgb(151,92,111)",
466
+ accent6: "rgb(111,126,78)",
467
+ hlink: "rgb(44,91,139)",
468
+ folHlink: "rgb(121,72,118)"
469
+ }, "Georgia", "Arial"),
470
+ masterBackground: { slot: "lt1" },
471
+ masterDecorations: [
472
+ { name: "刊页左栏", preset: "rect", rect: y(0, 0, 18, 720), fill: { slot: "accent1" } },
473
+ { name: "刊页页脚线", preset: "line", rect: y(80, 650, 1120, 1), stroke: { slot: "accent2", width: 2 } }
474
+ ],
475
+ textStyles: {
476
+ title: S("dk1", "major", 36, { step: 1, bold: !0 }),
477
+ body: S("dk2", "minor", 21, { step: 1, bullet: !0 }),
478
+ other: S("dk2", "minor", 17, { step: 0.5 })
479
+ },
480
+ layouts: E("accent1"),
481
+ initialLayoutPart: 1
482
+ },
483
+ midnight: {
484
+ id: "midnight",
485
+ name: "夜幕",
486
+ description: "深色画布与高对比光束",
487
+ preview: {
488
+ surface: "#101827",
489
+ foreground: "#F7FAFF",
490
+ accent: "#4ED7F1",
491
+ secondary: "#9B8CFF",
492
+ motif: "beam"
493
+ },
494
+ theme: N("夜幕", {
495
+ dk1: "rgb(16,24,39)",
496
+ lt1: "rgb(247,250,255)",
497
+ dk2: "rgb(31,43,64)",
498
+ lt2: "rgb(215,224,238)",
499
+ accent1: "rgb(78,215,241)",
500
+ accent2: "rgb(155,140,255)",
501
+ accent3: "rgb(255,111,145)",
502
+ accent4: "rgb(255,196,92)",
503
+ accent5: "rgb(75,139,255)",
504
+ accent6: "rgb(85,221,166)",
505
+ hlink: "rgb(99,202,255)",
506
+ folHlink: "rgb(189,148,255)"
507
+ }, "Arial", "Arial"),
508
+ masterBackground: { slot: "dk1" },
509
+ masterDecorations: [
510
+ { name: "夜幕主光束", preset: "rect", rect: y(930, -210, 130, 700), fill: { slot: "accent1", alpha: 0.16 }, rotation: 28 },
511
+ { name: "夜幕次光束", preset: "rect", rect: y(1080, -160, 88, 620), fill: { slot: "accent2", alpha: 0.2 }, rotation: 28 }
512
+ ],
513
+ textStyles: {
514
+ title: S("lt1", "major", 38, { step: 1, bold: !0 }),
515
+ body: S("lt2", "minor", 22, { step: 1.25, bullet: !0 }),
516
+ other: S("lt2", "minor", 18, { step: 0.75 })
517
+ },
518
+ layouts: E("accent1"),
519
+ initialLayoutPart: 1
520
+ }
521
+ }, Te = Object.freeze(
522
+ Object.values(A).map(({ id: e, name: t, description: a, preview: r }) => Object.freeze({
523
+ id: e,
524
+ name: t,
525
+ description: a,
526
+ preview: Object.freeze({ ...r })
527
+ }))
528
+ );
529
+ function Ce() {
530
+ return Te;
531
+ }
532
+ function Fe(e, t = {}) {
533
+ const a = Object.prototype.hasOwnProperty.call(A, e) ? A[e] : void 0;
534
+ if (!a) throw new Error(`未知内置模板:${e}`);
535
+ const r = t.width ?? 1280, l = t.height ?? 720;
536
+ z(r, "页面宽度"), z(l, "页面高度");
537
+ const n = me(Pe(r, l, a));
538
+ return ye(n.package), n.bytes;
539
+ }
540
+ export {
541
+ Fe as createPptxFromTemplate,
542
+ Ce as listBuiltinTemplates
543
+ };
@@ -0,0 +1,6 @@
1
+ import type { Paragraph, TextBody } from '@web-ppt/core';
2
+ import type { ParagraphBullet, TextOverride } from './types';
3
+ export declare function sourceParagraphBullet(value: NonNullable<Paragraph['editInfo']>['bullet'] | undefined): ParagraphBullet | undefined;
4
+ export declare function flattenTextBody(body: TextBody): Extract<TextOverride, {
5
+ kind: 'flat';
6
+ }>;
@@ -0,0 +1,5 @@
1
+ import type { TextBody } from '@web-ppt/core';
2
+ import type { TextRange } from './commands/types';
3
+ import type { TextFragment } from './types';
4
+ /** 把有效文字选区降成可跨实例传输的格式白名单,不泄漏 OOXML 来源身份。 */
5
+ export declare function textFragmentFromRange(body: TextBody, range: TextRange): TextFragment;
@@ -1,21 +1,21 @@
1
1
  import type { TextBody } from '@web-ppt/core';
2
2
  import type { TextEditOp, TextRange } from './commands/types';
3
- import type { ParagraphPropertiesState, ParagraphPropertyOverrides, RunPropertiesState, RunPropertyOverrides, TextFragment, TextMark, TextOverride } from './types';
3
+ import type { ParagraphPropertiesState, ParagraphPropertyOverrides, RunPropertiesState, RunPropertyOverrides, TextMark, TextOverride } from './types';
4
4
  export { textBodyFromOverride } from './text-override-projection';
5
- export declare function flattenTextBody(body: TextBody): Extract<TextOverride, {
6
- kind: 'flat';
7
- }>;
5
+ export { flattenTextBody } from './text-flatten';
6
+ export { textFragmentFromRange } from './text-fragment';
8
7
  export declare function applyTextEditOps(body: TextBody, ops: readonly TextEditOp[], initial?: Extract<TextOverride, {
9
8
  kind: 'flat';
10
- }>): TextOverride;
11
- /** 把有效文字选区降成可跨实例传输的格式白名单,不泄漏 OOXML 来源身份。 */
12
- export declare function textFragmentFromRange(body: TextBody, range: TextRange): TextFragment;
9
+ }>, fragmentImageOverrides?: ReadonlyMap<number, ReadonlyMap<number, import('./types').ElementImageReplacement>>): TextOverride;
13
10
  export declare function applyRunProps(body: TextBody, range: TextRange, props: RunPropertyOverrides, initial?: Extract<TextOverride, {
14
11
  kind: 'flat';
15
12
  }>): TextOverride;
13
+ export declare function clearRunFormat(body: TextBody, range: TextRange, initial?: Extract<TextOverride, {
14
+ kind: 'flat';
15
+ }>): TextOverride;
16
16
  export declare function applyParagraphProps(body: TextBody, range: TextRange, props: ParagraphPropertyOverrides, initial?: Extract<TextOverride, {
17
17
  kind: 'flat';
18
- }>, levelTemplate?: TextBody, sourceBody?: TextBody): TextOverride;
18
+ }>, levelTemplate?: TextBody, sourceBody?: TextBody, imageOverride?: import('./types').ElementImageReplacement): TextOverride;
19
19
  export declare function queryTextParagraphProps(body: TextBody, range: TextRange, initial?: Extract<TextOverride, {
20
20
  kind: 'flat';
21
21
  }>): ParagraphPropertiesState;
@@ -1,7 +1,11 @@
1
- import type { TextOverride } from './types';
1
+ import type { EditDoc, ElementInsertionResource, TextOverride } from './types';
2
2
  export declare function validateFlatTextOverride(override: Extract<TextOverride, {
3
3
  kind: 'flat';
4
- }>): void;
4
+ }>, imageContext?: {
5
+ readonly doc: EditDoc;
6
+ readonly part: string | undefined;
7
+ readonly resources: Readonly<Record<string, ElementInsertionResource>>;
8
+ }): void;
5
9
  export declare function validateEmptyTextOverride(override: Extract<TextOverride, {
6
10
  kind: 'empty';
7
11
  }>): void;
@@ -0,0 +1,4 @@
1
+ import type { TextPosition } from './commands/types';
2
+ import type { FlatTextParagraph } from './types';
3
+ export declare function textPositionOffset(paragraph: FlatTextParagraph, position: TextPosition): number;
4
+ export declare function assertTextAtomBoundary(paragraph: FlatTextParagraph, offset: number): void;
@@ -0,0 +1,8 @@
1
+ import { type OpcPackage } from '@web-ppt/core';
2
+ import type { EditDoc } from './types';
3
+ /**
4
+ * 重解析器只看 OpcPackage;把主题覆盖收进内存 part 视图后,解析/继承/文字排版仍走 core 唯一真相。
5
+ * 保存后的原始来源由 baseline 覆盖回来,撤销因此不会被已经写入的新 package 污染。
6
+ */
7
+ export declare function themeProjectionPackage(doc: EditDoc): OpcPackage | null;
8
+ export declare function releaseThemeProjectionPackage(doc: EditDoc): void;
@@ -0,0 +1,3 @@
1
+ import type { ThemeRecord } from './types';
2
+ /** 只触碰显式覆盖的字段;其它属性、扩展和词法节点由保留型 XML 树原样直通。 */
3
+ export declare function materializeThemePart(bytes: Uint8Array, record: ThemeRecord): Uint8Array;
@@ -0,0 +1,14 @@
1
+ import type { ThemeColorScheme, ThemeColorSlot, ThemeFontScheme } from '@web-ppt/core';
2
+ import type { EditDoc, ThemeOverrides, ThemeRecord, ThemeState } from './types';
3
+ export declare function effectiveTheme(record: ThemeRecord): {
4
+ colors: ThemeColorScheme;
5
+ fonts: ThemeFontScheme;
6
+ };
7
+ export declare function themeHasOverrides(record: ThemeRecord): boolean;
8
+ export declare function queryTheme(doc: EditDoc, id: string): ThemeState;
9
+ export declare function listThemes(doc: EditDoc): ThemeState[];
10
+ export declare function assertThemeColor(value: unknown, label: string): asserts value is string;
11
+ export declare function normalizeThemeColor(value: string): string;
12
+ export declare function assertThemeFont(value: unknown, label: string): asserts value is string;
13
+ export declare function assertThemeOverrides(value: unknown, label: string): asserts value is ThemeOverrides;
14
+ export declare function isThemeColorSlot(value: string): value is ThemeColorSlot;