@web-ppt/edit-core 0.5.0-beta.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +183 -0
- package/README.md +164 -21
- package/dist/alt-text.d.ts +5 -0
- package/dist/appearance/index.d.ts +12 -0
- package/dist/appearance/materialize.d.ts +4 -0
- package/dist/appearance/types.d.ts +26 -0
- package/dist/appearance/values.d.ts +9 -0
- package/dist/appearance.js +301 -0
- package/dist/cfb/index.d.ts +5 -0
- package/dist/cfb/read.d.ts +16 -0
- package/dist/cfb/write.d.ts +3 -0
- package/dist/cfb.js +208 -0
- package/dist/change-classification.d.ts +3 -3
- package/dist/chart/category-binding.d.ts +4 -0
- package/dist/chart/category-commands.d.ts +23 -0
- package/dist/chart/category-levels.d.ts +14 -0
- package/dist/chart/category-matrix.d.ts +2 -0
- package/dist/chart/category-value.d.ts +2 -0
- package/dist/chart/category-workbook.d.ts +13 -0
- package/dist/chart/commands.d.ts +28 -0
- package/dist/chart/context.d.ts +12 -0
- package/dist/chart/dataset-merge.d.ts +5 -0
- package/dist/chart/formula.d.ts +13 -0
- package/dist/chart/identity-frames.d.ts +4 -0
- package/dist/chart/identity-scopes.d.ts +6 -0
- package/dist/chart/identity.d.ts +24 -0
- package/dist/chart/index.d.ts +8 -0
- package/dist/chart/limits.d.ts +6 -0
- package/dist/chart/locator.d.ts +4 -0
- package/dist/chart/materialize.d.ts +7 -0
- package/dist/chart/ordering.d.ts +9 -0
- package/dist/chart/part-graph.d.ts +5 -0
- package/dist/chart/patch-validation.d.ts +3 -0
- package/dist/chart/plot-kinds.d.ts +2 -0
- package/dist/chart/projection.d.ts +8 -0
- package/dist/chart/save.d.ts +4 -0
- package/dist/chart/shared-added-plan.d.ts +19 -0
- package/dist/chart/shared-added-records.d.ts +8 -0
- package/dist/chart/shared-address.d.ts +5 -0
- package/dist/chart/shared-allocate.d.ts +7 -0
- package/dist/chart/shared-cache-codec.d.ts +5 -0
- package/dist/chart/shared-cache-identities.d.ts +3 -0
- package/dist/chart/shared-cache-migration.d.ts +7 -0
- package/dist/chart/shared-cache-save.d.ts +3 -0
- package/dist/chart/shared-cache-scopes.d.ts +13 -0
- package/dist/chart/shared-cache.d.ts +11 -0
- package/dist/chart/shared-category.d.ts +4 -0
- package/dist/chart/shared-cell.d.ts +9 -0
- package/dist/chart/shared-family.d.ts +26 -0
- package/dist/chart/shared-fields.d.ts +18 -0
- package/dist/chart/shared-graph.d.ts +19 -0
- package/dist/chart/shared-growth-space.d.ts +5 -0
- package/dist/chart/shared-inserted-cells.d.ts +14 -0
- package/dist/chart/shared-inserted-command.d.ts +7 -0
- package/dist/chart/shared-inserted-layout.d.ts +16 -0
- package/dist/chart/shared-inserted-project.d.ts +14 -0
- package/dist/chart/shared-inserted-records.d.ts +16 -0
- package/dist/chart/shared-inserted-save.d.ts +6 -0
- package/dist/chart/shared-joint-command.d.ts +9 -0
- package/dist/chart/shared-joint-records.d.ts +9 -0
- package/dist/chart/shared-record-axis.d.ts +25 -0
- package/dist/chart/shared-record-remove.d.ts +13 -0
- package/dist/chart/shared-record-stage.d.ts +2 -0
- package/dist/chart/shared-records.d.ts +2 -0
- package/dist/chart/shared-rows.d.ts +17 -0
- package/dist/chart/shared-runtime.d.ts +19 -0
- package/dist/chart/shared-save-plan.d.ts +4 -0
- package/dist/chart/shared-save.d.ts +3 -0
- package/dist/chart/shared-series.d.ts +6 -0
- package/dist/chart/shared-source-cache.d.ts +4 -0
- package/dist/chart/shared-topology.d.ts +9 -0
- package/dist/chart/shared-unresolved.d.ts +3 -0
- package/dist/chart/shared-validation.d.ts +6 -0
- package/dist/chart/shared-workbook-source.d.ts +6 -0
- package/dist/chart/shared-xy-command.d.ts +7 -0
- package/dist/chart/shared-xy-family.d.ts +16 -0
- package/dist/chart/shared-xy-project.d.ts +6 -0
- package/dist/chart/shared-xy-records.d.ts +23 -0
- package/dist/chart/shared-xy-save.d.ts +5 -0
- package/dist/chart/shared-xy-source.d.ts +39 -0
- package/dist/chart/shared.d.ts +13 -0
- package/dist/chart/source.d.ts +11 -0
- package/dist/chart/types.d.ts +86 -0
- package/dist/chart/validation.d.ts +24 -0
- package/dist/chart/workbook-range.d.ts +16 -0
- package/dist/chart/workbook-read.d.ts +7 -0
- package/dist/chart/workbook-write.d.ts +9 -0
- package/dist/chart/workbook.d.ts +25 -0
- package/dist/chart/xml-data.d.ts +14 -0
- package/dist/chart/xml-namespaces.d.ts +16 -0
- package/dist/chart-design/index.d.ts +10 -0
- package/dist/chart-design/types.d.ts +11 -0
- package/dist/chart-design/xml.d.ts +2 -0
- package/dist/chart-design.js +361 -0
- package/dist/chart-ex/index.d.ts +15 -0
- package/dist/chart-ex/workbook.d.ts +6 -0
- package/dist/chart-ex/xml.d.ts +14 -0
- package/dist/chart-ex.js +457 -0
- package/dist/chart-shared/index.d.ts +12 -0
- package/dist/chart-shared.js +1 -0
- package/dist/chart.js +1 -0
- package/dist/clipboard-links-GuPtqr1z.js +778 -0
- package/dist/clipboard-package.d.ts +4 -0
- package/dist/clipboard-source.d.ts +6 -2
- package/dist/clipboard-trees.d.ts +9 -0
- package/dist/commands/add-slide-identity.d.ts +2 -0
- package/dist/commands/bullet-image-resource.d.ts +11 -0
- package/dist/commands/clear-format.d.ts +4 -0
- package/dist/commands/common-object-slide-patch.d.ts +4 -0
- package/dist/commands/common-object-slide-types.d.ts +68 -0
- package/dist/commands/direct-format-patches.d.ts +11 -5
- package/dist/commands/distribute-elements.d.ts +4 -0
- package/dist/commands/edit-table-grid.d.ts +10 -0
- package/dist/commands/element-alt-text.d.ts +8 -0
- package/dist/commands/element-arrangement.d.ts +17 -0
- package/dist/commands/element-effects.d.ts +1 -1
- package/dist/commands/element-fill.d.ts +1 -1
- package/dist/commands/element-geometry.d.ts +5 -2
- package/dist/commands/element-image-content.d.ts +2 -2
- package/dist/commands/element-link.d.ts +1 -1
- package/dist/commands/element-name.d.ts +1 -1
- package/dist/commands/element-stroke.d.ts +1 -1
- package/dist/commands/element-text.d.ts +1 -1
- package/dist/commands/element-transform.d.ts +2 -2
- package/dist/commands/geometry-types.d.ts +23 -1
- package/dist/commands/hierarchy-record.d.ts +5 -0
- package/dist/commands/image-resource.d.ts +8 -1
- package/dist/commands/insertion-host.d.ts +14 -1
- package/dist/commands/layout-property.d.ts +7 -0
- package/dist/commands/master-property.d.ts +5 -0
- package/dist/commands/master-text-style-types.d.ts +27 -0
- package/dist/commands/master-text-style.d.ts +7 -0
- package/dist/commands/paste-resources.d.ts +9 -5
- package/dist/commands/patch-apply.d.ts +3 -0
- package/dist/commands/patch-count.d.ts +1 -0
- package/dist/commands/patch-invalidation.d.ts +1 -1
- package/dist/commands/patch-stage.d.ts +4 -0
- package/dist/commands/record-override.d.ts +5 -0
- package/dist/commands/replace-image.d.ts +6 -1
- package/dist/commands/sections.d.ts +10 -0
- package/dist/commands/set-preset.d.ts +5 -0
- package/dist/commands/slide-property-types.d.ts +55 -5
- package/dist/commands/slide-size.d.ts +7 -0
- package/dist/commands/spid.d.ts +1 -1
- package/dist/commands/table-grid-patch.d.ts +12 -0
- package/dist/commands/text-target.d.ts +2 -2
- package/dist/commands/theme-types.d.ts +47 -0
- package/dist/commands/theme.d.ts +9 -0
- package/dist/commands/types.d.ts +194 -17
- package/dist/commands/ungroup-source.d.ts +3 -0
- package/dist/comments/index.d.ts +35 -0
- package/dist/comments/save.d.ts +3 -0
- package/dist/comments/state.d.ts +10 -0
- package/dist/comments/xml.d.ts +12 -0
- package/dist/comments.js +782 -0
- package/dist/common-object-slide-types.d.ts +34 -0
- package/dist/data-validation.d.ts +1 -1
- package/dist/describe/budget.d.ts +3 -0
- package/dist/describe/index.d.ts +5 -0
- package/dist/describe/read.d.ts +4 -0
- package/dist/describe/types.d.ts +103 -0
- package/dist/describe.js +192 -0
- package/dist/design-dependencies.d.ts +8 -0
- package/dist/design-projection-package.d.ts +10 -0
- package/dist/design-target.d.ts +10 -0
- package/dist/design.d.ts +3 -0
- package/dist/document-extensions.d.ts +9 -0
- package/dist/document.d.ts +1 -1
- package/dist/dynamic-projection.d.ts +6 -0
- package/dist/edit-core.js +5420 -4111
- package/dist/editor.d.ts +15 -3
- package/dist/element-source.d.ts +11 -0
- package/dist/element-spids.d.ts +4 -0
- package/dist/extension-address-journal.d.ts +9 -0
- package/dist/extension-address-remap.d.ts +14 -0
- package/dist/extension-addresses.d.ts +20 -0
- package/dist/extension-copy-history.d.ts +7 -0
- package/dist/extension-copy.d.ts +16 -0
- package/dist/extension-migration-receipt.d.ts +34 -0
- package/dist/extension-recovery-context.d.ts +5 -0
- package/dist/extension-runtime.d.ts +64 -0
- package/dist/generate/comments.d.ts +3 -0
- package/dist/generate/compatibility-parts.d.ts +14 -0
- package/dist/generate/compatibility-references.d.ts +3 -0
- package/dist/generate/compatibility.d.ts +4 -0
- package/dist/generate/index.d.ts +1 -0
- package/dist/generate/master-defaults.d.ts +4 -0
- package/dist/generate/materialize.d.ts +2 -2
- package/dist/generate/math.d.ts +3 -0
- package/dist/generate/portable-clipboard.d.ts +4 -0
- package/dist/generate/projection-tree.d.ts +8 -0
- package/dist/generate/template.d.ts +68 -1
- package/dist/generate/text-body.d.ts +2 -0
- package/dist/generate/text-effects.d.ts +5 -0
- package/dist/generate/text-override.d.ts +8 -0
- package/dist/generate/validation.d.ts +3 -0
- package/dist/generate/warp.d.ts +2 -0
- package/dist/generate.js +1232 -512
- package/dist/history.d.ts +11 -1
- package/dist/identities.d.ts +4 -0
- package/dist/image-content.d.ts +5 -2
- package/dist/image-resource-history.d.ts +2 -0
- package/dist/index-C2r7c6G6.js +714 -0
- package/dist/index-CYDvbiwF.js +1 -0
- package/dist/index.d.ts +35 -7
- package/dist/ink/index.d.ts +27 -0
- package/dist/ink/model.d.ts +4 -0
- package/dist/ink/save.d.ts +3 -0
- package/dist/ink/source.d.ts +7 -0
- package/dist/ink.js +324 -0
- package/dist/layout-assets.d.ts +3 -1
- package/dist/layout-projection.d.ts +17 -5
- package/dist/layout-state.d.ts +2 -0
- package/dist/layout-types.d.ts +42 -0
- package/dist/layout.d.ts +5 -0
- package/dist/lint/color.d.ts +5 -0
- package/dist/lint/index.d.ts +7 -0
- package/dist/lint/prompts.d.ts +3 -0
- package/dist/lint/report.d.ts +21 -0
- package/dist/lint/sampler-batch.d.ts +4 -0
- package/dist/lint/sampler-images.d.ts +2 -0
- package/dist/lint/sampler.d.ts +9 -0
- package/dist/lint/snapshot.d.ts +34 -0
- package/dist/lint/types.d.ts +67 -0
- package/dist/lint-sampler.js +187 -0
- package/dist/lint.js +659 -0
- package/dist/master-state.d.ts +3 -0
- package/dist/master-text-style-state.d.ts +3 -0
- package/dist/master-types.d.ts +55 -0
- package/dist/master.d.ts +5 -0
- package/dist/media/audio-icon.d.ts +2 -0
- package/dist/media/commands.d.ts +3 -0
- package/dist/media/index.d.ts +10 -0
- package/dist/media/markup.d.ts +10 -0
- package/dist/media/mp4-boxes.d.ts +12 -0
- package/dist/media/mp4-fragments.d.ts +8 -0
- package/dist/media/mp4-samples.d.ts +4 -0
- package/dist/media/mp4.d.ts +2 -0
- package/dist/media/poster.d.ts +2 -0
- package/dist/media/replace-poster.d.ts +3 -0
- package/dist/media/resource.d.ts +4 -0
- package/dist/media/source.d.ts +14 -0
- package/dist/media/types.d.ts +33 -0
- package/dist/media-properties.d.ts +4 -0
- package/dist/media.js +1630 -0
- package/dist/model-invariants-BM19JVxy.js +8980 -0
- package/dist/object-source.d.ts +11 -0
- package/dist/ole/container.d.ts +14 -0
- package/dist/ole/content.d.ts +94 -0
- package/dist/ole/index.d.ts +20 -0
- package/dist/ole/preview.d.ts +3 -0
- package/dist/ole/save.d.ts +2 -0
- package/dist/ole/state.d.ts +16 -0
- package/dist/ole.js +870 -0
- package/dist/opc.js +1 -1
- package/dist/paragraph-level.d.ts +2 -2
- package/dist/paragraph-property-schema.d.ts +4 -1
- package/dist/{patch-D7lZelRa.js → patch-BwhfBbYE.js} +10 -10
- package/dist/patch-events.d.ts +5 -1
- package/dist/ppt/appearance.d.ts +11 -0
- package/dist/ppt/binary.d.ts +20 -0
- package/dist/ppt/drawing.d.ts +18 -0
- package/dist/ppt/geometry.d.ts +4 -0
- package/dist/ppt/index.d.ts +12 -0
- package/dist/ppt/pictures.d.ts +11 -0
- package/dist/ppt/text.d.ts +9 -0
- package/dist/ppt.js +774 -0
- package/dist/preset-geometry.d.ts +6 -0
- package/dist/projection.d.ts +2 -0
- package/dist/query-BHLjWjnu.js +903 -0
- package/dist/recovery-identity.d.ts +1 -0
- package/dist/recovery-migrations.d.ts +3 -0
- package/dist/recovery.d.ts +3 -0
- package/dist/resize/index.d.ts +6 -0
- package/dist/resize/text.d.ts +4 -0
- package/dist/resize.js +5090 -0
- package/dist/retained-element-origins.d.ts +6 -0
- package/dist/run-property-fields.d.ts +12 -0
- package/dist/run-property-schema.d.ts +3 -1
- package/dist/run-style.d.ts +15 -0
- package/dist/save/alt-text.d.ts +4 -0
- package/dist/save/comments.d.ts +3 -0
- package/dist/save/effects.d.ts +2 -1
- package/dist/save/extension-availability.d.ts +3 -0
- package/dist/save/extension-elements.d.ts +26 -0
- package/dist/save/index.d.ts +6 -1
- package/dist/save/insertion.d.ts +6 -5
- package/dist/save/layout-properties.d.ts +4 -0
- package/dist/save/master-properties.d.ts +5 -0
- package/dist/save/paragraph-overrides.d.ts +3 -0
- package/dist/save/slide-parts.d.ts +1 -0
- package/dist/save/table.d.ts +2 -0
- package/dist/save/xfrm.d.ts +8 -2
- package/dist/save.js +493 -498
- package/dist/sections.d.ts +8 -0
- package/dist/session-assets.d.ts +4 -0
- package/dist/slide-parts-D0o_DDhi.js +1331 -0
- package/dist/slide-size.d.ts +6 -0
- package/dist/smartart/drawing.d.ts +3 -0
- package/dist/smartart/index.d.ts +16 -0
- package/dist/smartart/model.d.ts +18 -0
- package/dist/smartart/save.d.ts +3 -0
- package/dist/smartart.js +604 -0
- package/dist/source-retention.d.ts +7 -0
- package/dist/space.d.ts +37 -0
- package/dist/table-cell.d.ts +7 -1
- package/dist/table-grid-projection.d.ts +6 -0
- package/dist/table-grid.d.ts +45 -0
- package/dist/table-invariants.d.ts +4 -0
- package/dist/table-rows.d.ts +2 -1
- package/dist/table-scale.d.ts +4 -0
- package/dist/table-style.d.ts +5 -4
- package/dist/templates/index.d.ts +4 -0
- package/dist/templates/recipes.d.ts +5 -0
- package/dist/templates/types.d.ts +17 -0
- package/dist/templates.js +543 -0
- package/dist/text-flatten.d.ts +6 -0
- package/dist/text-fragment.d.ts +5 -0
- package/dist/text-model.d.ts +8 -8
- package/dist/text-override-validation.d.ts +6 -2
- package/dist/text-selection.d.ts +4 -0
- package/dist/theme-projection.d.ts +8 -0
- package/dist/theme-xml.d.ts +3 -0
- package/dist/theme.d.ts +14 -0
- package/dist/types.d.ts +174 -8
- package/dist/xml/index.d.ts +1 -1
- package/dist/xml/nodes.d.ts +2 -2
- package/dist/xml/shape-ids.d.ts +3 -0
- package/dist/xml.js +19 -16
- package/package.json +79 -5
- package/schemas/describe.schema.json +479 -0
- package/schemas/lint.schema.json +145 -0
- package/dist/document-B1jjN-QB.js +0 -274
- package/dist/image-resource-DbgJS9n-.js +0 -24
- package/dist/index-D2JizcOQ.js +0 -706
- package/dist/insertion-CGpb504L.js +0 -6152
- package/dist/table-style-part-DBtpxmuo.js +0 -1042
|
@@ -0,0 +1,778 @@
|
|
|
1
|
+
import { $ as nt, a0 as rt, a1 as ot, a2 as st, a3 as B, a4 as G, a5 as P, a6 as X, a7 as it, a8 as lt, a9 as ut, aa as at, ab as ct, ac as pt, ad as ft, ae as dt, af as mt, a as ht, ag as J, ah as kt, ai as gt, aj as bt, ak as xt, al as yt, o as Y, am as wt, an as St, ao as vt, ap as It, aq as Ot, ar as L, as as Pt } from "./model-invariants-BM19JVxy.js";
|
|
2
|
+
import { b as Lt } from "./index-C2r7c6G6.js";
|
|
3
|
+
import { formatDrawingAutoNumber as H, PARAGRAPH_LAYOUT_DIRECT_BITS as O } from "@web-ppt/core";
|
|
4
|
+
const $ = (e, t) => Object.prototype.hasOwnProperty.call(e ?? {}, t);
|
|
5
|
+
function Tt(e) {
|
|
6
|
+
return !e || e.kind === "none" || typeof e.color != "string" ? e : { ...e, color: nt(e.color) };
|
|
7
|
+
}
|
|
8
|
+
function F(e, t, o) {
|
|
9
|
+
return e.paragraphs[t.sourceParagraph ?? o];
|
|
10
|
+
}
|
|
11
|
+
function _(e, t) {
|
|
12
|
+
return (e == null ? void 0 : e.paragraphs.find((o) => o.lvl === t)) ?? (e == null ? void 0 : e.paragraphs[0]);
|
|
13
|
+
}
|
|
14
|
+
function Et(e, t) {
|
|
15
|
+
var o, n;
|
|
16
|
+
return $(e.paragraphOverrides, t) ? ((o = e.paragraphOverrides) == null ? void 0 : o[t]) !== null : ((n = e.directParagraphProps) == null ? void 0 : n[t]) === !0;
|
|
17
|
+
}
|
|
18
|
+
function $t(e) {
|
|
19
|
+
return B(e);
|
|
20
|
+
}
|
|
21
|
+
function At(e, t, o, n) {
|
|
22
|
+
var s, i;
|
|
23
|
+
const r = e.paragraphs[((s = n.source) == null ? void 0 : s.paragraph) ?? t.sourceParagraph ?? o];
|
|
24
|
+
return { paragraph: r, run: r == null ? void 0 : r.runs[((i = n.source) == null ? void 0 : i.run) ?? 0] };
|
|
25
|
+
}
|
|
26
|
+
function D(e, t, o) {
|
|
27
|
+
var r, s, i, l, u;
|
|
28
|
+
if ($(e.runOverrides, o)) return ((r = e.runOverrides) == null ? void 0 : r[o]) !== null;
|
|
29
|
+
const n = (((i = (s = t.paragraph) == null ? void 0 : s.editInfo) == null ? void 0 : i.directRun) ?? 0) | (((u = (l = t.run) == null ? void 0 : l.editInfo) == null ? void 0 : u.direct) ?? 0);
|
|
30
|
+
return o === "font" ? !!(n & ot) : !!(n & st(o));
|
|
31
|
+
}
|
|
32
|
+
function Nt(e, t, o, n, r) {
|
|
33
|
+
var l, u;
|
|
34
|
+
const s = At(e, t, o, n), i = { ...n.props };
|
|
35
|
+
D(n, s, "font") || (i.fonts = [...r.fonts]);
|
|
36
|
+
for (const a of rt)
|
|
37
|
+
D(n, s, a) || (i[a] = r[a]);
|
|
38
|
+
return {
|
|
39
|
+
...n,
|
|
40
|
+
props: i,
|
|
41
|
+
inheritedProps: $t(r),
|
|
42
|
+
inheritedRunProps: (l = r.editInfo) == null ? void 0 : l.inheritedRunProps,
|
|
43
|
+
inheritedFonts: [...r.fonts],
|
|
44
|
+
inheritedFontSlots: (u = r.editInfo) == null ? void 0 : u.fontSlots
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function Rt(e) {
|
|
48
|
+
var o;
|
|
49
|
+
const t = (o = e.editInfo) == null ? void 0 : o.inheritedParagraphProps;
|
|
50
|
+
return t ? { ...t } : {
|
|
51
|
+
level: 0,
|
|
52
|
+
align: e.align,
|
|
53
|
+
lineHeight: e.lineHeight,
|
|
54
|
+
spaceBefore: e.spaceBefore,
|
|
55
|
+
spaceAfter: e.spaceAfter,
|
|
56
|
+
marginLeft: e.marL,
|
|
57
|
+
indent: e.indent
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function Ct(e, t, o, n, r) {
|
|
61
|
+
var p;
|
|
62
|
+
if (t.props.lvl === n) return t;
|
|
63
|
+
const s = _(r, n) ?? _(e, n);
|
|
64
|
+
if (!s) return { ...t, props: { ...t.props, lvl: n } };
|
|
65
|
+
const i = F(e, t, o), l = { ...t.props, lvl: n }, u = [
|
|
66
|
+
["align", "align"],
|
|
67
|
+
["lineHeight", "lineHeight"],
|
|
68
|
+
["spaceBefore", "spaceBefore"],
|
|
69
|
+
["spaceAfter", "spaceAfter"],
|
|
70
|
+
["marginLeft", "marL"],
|
|
71
|
+
["indent", "indent"]
|
|
72
|
+
];
|
|
73
|
+
for (const [c, d] of u)
|
|
74
|
+
Et(t, c) || (l[d] = s[d]);
|
|
75
|
+
const a = ((p = i == null ? void 0 : i.editInfo) == null ? void 0 : p.directLayout) ?? 0, f = [
|
|
76
|
+
["bulletColor", O.bulletColor],
|
|
77
|
+
["bulletFont", O.bulletFont],
|
|
78
|
+
["bulletSize", O.bulletSize],
|
|
79
|
+
["rtl", O.rtl]
|
|
80
|
+
];
|
|
81
|
+
a & O.bullet || (l.bullet = s.bullet, s.bulletImage === void 0 ? delete l.bulletImage : l.bulletImage = s.bulletImage);
|
|
82
|
+
for (const [c, d] of f) {
|
|
83
|
+
if (a & d) continue;
|
|
84
|
+
const b = s[c];
|
|
85
|
+
b === void 0 ? delete l[c] : l[c] = b;
|
|
86
|
+
}
|
|
87
|
+
const m = s.runs[s.runs.length - 1];
|
|
88
|
+
return {
|
|
89
|
+
...t,
|
|
90
|
+
props: l,
|
|
91
|
+
inheritedParagraphProps: Rt(s),
|
|
92
|
+
marks: m ? t.marks.map((c) => Nt(e, t, o, c, m)) : t.marks
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function zt(e, t, o, n) {
|
|
96
|
+
var l, u, a, f;
|
|
97
|
+
const r = (l = t.paragraphOverrides) == null ? void 0 : l.bullet;
|
|
98
|
+
if (r !== void 0) {
|
|
99
|
+
const m = r ?? t.inheritedBullet;
|
|
100
|
+
return (m == null ? void 0 : m.kind) === "autoNum" ? { scheme: m.type, startAt: m.startAt ?? 1 } : void 0;
|
|
101
|
+
}
|
|
102
|
+
const s = F(e, t, o);
|
|
103
|
+
if (s != null && s.editInfo && s.editInfo.directLayout & O.bullet)
|
|
104
|
+
return s.editInfo.autoNumbering;
|
|
105
|
+
const i = n == null ? void 0 : n.paragraphs.find((m) => m.lvl === t.props.lvl);
|
|
106
|
+
return i ? (u = i.editInfo) == null ? void 0 : u.autoNumbering : (f = (a = e.paragraphs.find((m) => m.lvl === t.props.lvl)) == null ? void 0 : a.editInfo) == null ? void 0 : f.autoNumbering;
|
|
107
|
+
}
|
|
108
|
+
function Ft(e, t, o) {
|
|
109
|
+
const n = [];
|
|
110
|
+
return t.map((r, s) => {
|
|
111
|
+
const i = zt(e, r, s, o), l = r.props.lvl;
|
|
112
|
+
if (!i)
|
|
113
|
+
return n.length = l + 1, delete n[l], r;
|
|
114
|
+
n.length = l + 1;
|
|
115
|
+
const u = n[l], a = (u == null ? void 0 : u.scheme) === i.scheme ? u.value + 1 : i.startAt;
|
|
116
|
+
return n[l] = { scheme: i.scheme, value: a }, {
|
|
117
|
+
...r,
|
|
118
|
+
props: {
|
|
119
|
+
...r.props,
|
|
120
|
+
bullet: H(i.scheme, a)
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function Bt(e, t, o, n, r, s) {
|
|
126
|
+
const i = (p) => Object.prototype.hasOwnProperty.call(n, p), l = i("bullet") ? Tt(n.bullet) : void 0, u = (p) => ({
|
|
127
|
+
level: p.props.lvl,
|
|
128
|
+
align: p.props.align,
|
|
129
|
+
lineHeight: p.props.lineHeight,
|
|
130
|
+
spaceBefore: p.props.spaceBefore,
|
|
131
|
+
spaceAfter: p.props.spaceAfter,
|
|
132
|
+
marginLeft: p.props.marL,
|
|
133
|
+
indent: p.props.indent
|
|
134
|
+
}), a = (p) => {
|
|
135
|
+
const c = u(p), d = p.inheritedParagraphProps ?? c;
|
|
136
|
+
return {
|
|
137
|
+
level: i("level") ? n.level ?? d.level : c.level,
|
|
138
|
+
align: i("align") ? n.align ?? d.align : c.align,
|
|
139
|
+
lineHeight: i("lineHeight") ? n.lineHeight ?? d.lineHeight : c.lineHeight,
|
|
140
|
+
spaceBefore: i("spaceBefore") ? n.spaceBefore ?? d.spaceBefore : c.spaceBefore,
|
|
141
|
+
spaceAfter: i("spaceAfter") ? n.spaceAfter ?? d.spaceAfter : c.spaceAfter,
|
|
142
|
+
marginLeft: i("marginLeft") ? n.marginLeft ?? d.marginLeft : c.marginLeft,
|
|
143
|
+
indent: i("indent") ? n.indent ?? d.indent : c.indent
|
|
144
|
+
};
|
|
145
|
+
}, f = (p, c, d) => {
|
|
146
|
+
var v, S;
|
|
147
|
+
const b = {
|
|
148
|
+
...p.paragraphOverrides
|
|
149
|
+
}, y = u(c);
|
|
150
|
+
for (const g of Object.keys(n))
|
|
151
|
+
g !== "bullet" && (Object.is(n[g], y[g]) || (n[g] === null && !((v = p.directParagraphProps) != null && v[g]) ? delete b[g] : b[g] = n[g]));
|
|
152
|
+
if (i("bullet")) {
|
|
153
|
+
const g = F(e, c, d), h = !!((((S = g == null ? void 0 : g.editInfo) == null ? void 0 : S.directLayout) ?? 0) & O.bullet);
|
|
154
|
+
l === null && !h ? delete b.bullet : b.bullet = l;
|
|
155
|
+
}
|
|
156
|
+
return b;
|
|
157
|
+
};
|
|
158
|
+
let m = t.paragraphs.map((p, c) => {
|
|
159
|
+
var E, C, z;
|
|
160
|
+
if (c < o.from.p || c > o.to.p) return p;
|
|
161
|
+
const d = i("level") ? Ct(
|
|
162
|
+
e,
|
|
163
|
+
p,
|
|
164
|
+
c,
|
|
165
|
+
n.level ?? ((E = p.inheritedParagraphProps) == null ? void 0 : E.level) ?? 0,
|
|
166
|
+
r
|
|
167
|
+
) : p, b = a(d), y = f(d, p, c), { paragraphOverrides: v, bulletImageOverride: S, ...g } = d, h = {
|
|
168
|
+
...d.props,
|
|
169
|
+
lvl: b.level,
|
|
170
|
+
align: b.align,
|
|
171
|
+
lineHeight: b.lineHeight,
|
|
172
|
+
spaceBefore: b.spaceBefore,
|
|
173
|
+
spaceAfter: b.spaceAfter,
|
|
174
|
+
marL: b.marginLeft,
|
|
175
|
+
indent: b.indent
|
|
176
|
+
}, k = i("bullet") ? l ?? p.inheritedBullet : void 0;
|
|
177
|
+
if (i("bullet")) {
|
|
178
|
+
if (l === null && (h.bulletColor = null, h.bulletFont = null, h.bulletSize = null), (k == null ? void 0 : k.kind) === "char")
|
|
179
|
+
h.bullet = k.char, delete h.bulletImage;
|
|
180
|
+
else if ((k == null ? void 0 : k.kind) === "none")
|
|
181
|
+
h.bullet = null, delete h.bulletImage;
|
|
182
|
+
else if ((k == null ? void 0 : k.kind) === "autoNum")
|
|
183
|
+
h.bullet = H(k.type, k.startAt ?? 1), delete h.bulletImage;
|
|
184
|
+
else if ((k == null ? void 0 : k.kind) === "blip")
|
|
185
|
+
h.bullet = null, h.bulletImage = k.image.src;
|
|
186
|
+
else {
|
|
187
|
+
const I = F(e, p, c);
|
|
188
|
+
I && (h.bullet = I.bullet, h.bulletColor = I.bulletColor, h.bulletFont = I.bulletFont, h.bulletSize = I.bulletSize, h.bulletImage = I.bulletImage);
|
|
189
|
+
}
|
|
190
|
+
if (k && k.kind !== "none" && ($(k, "font") && (h.bulletFont = k.font ?? null), $(k, "color") && (h.bulletColor = k.color ?? null), $(k, "size"))) {
|
|
191
|
+
const I = Math.max(...d.marks.map((et) => et.props.size), 1);
|
|
192
|
+
h.bulletSize = k.size === null ? null : ((C = k.size) == null ? void 0 : C.kind) === "points" ? k.size.value * (4 / 3) / I : ((z = k.size) == null ? void 0 : z.value) ?? null;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return {
|
|
196
|
+
...g,
|
|
197
|
+
props: h,
|
|
198
|
+
...Object.keys(y).length ? { paragraphOverrides: y } : {},
|
|
199
|
+
...i("bullet") && (k == null ? void 0 : k.kind) === "blip" && s ? { bulletImageOverride: structuredClone(s) } : !i("bullet") && S ? { bulletImageOverride: S } : {}
|
|
200
|
+
};
|
|
201
|
+
});
|
|
202
|
+
return (i("level") || i("bullet")) && (m = Ft(e, m, r)), { ...t, paragraphs: m };
|
|
203
|
+
}
|
|
204
|
+
function Mt(e) {
|
|
205
|
+
return e.atomText === void 0 ? e.to - e.from : G({ text: "", math: e.props.math });
|
|
206
|
+
}
|
|
207
|
+
function w(e, t) {
|
|
208
|
+
if (!Number.isInteger(t.r) || !Number.isInteger(t.off) || t.r < 0 || t.off < 0)
|
|
209
|
+
throw new Error("文字位置必须是非负整数");
|
|
210
|
+
if (!e.marks.length && t.r === 0 && t.off === 0) return 0;
|
|
211
|
+
const o = e.marks[t.r];
|
|
212
|
+
if (!o || t.off > Mt(o)) throw new Error("文字位置超出段落范围");
|
|
213
|
+
return o.from + t.off;
|
|
214
|
+
}
|
|
215
|
+
function A(e, t) {
|
|
216
|
+
if (e.marks.some((n) => n.atomText !== void 0 && t > n.from && t < n.to)) throw new Error("公式只能作为整体选择");
|
|
217
|
+
}
|
|
218
|
+
function Ht(e, t) {
|
|
219
|
+
return e.atomText === t.atomText && JSON.stringify(e.props) === JSON.stringify(t.props) && e.preserveSource === t.preserveSource && at(e.runOverrides, t.runOverrides) && e.clearDirectFormatting === t.clearDirectFormatting && ct(e.inheritedProps, t.inheritedProps) && JSON.stringify(e.inheritedRunProps) === JSON.stringify(t.inheritedRunProps) && JSON.stringify(e.inheritedFonts) === JSON.stringify(t.inheritedFonts) && JSON.stringify(e.inheritedFontSlots) === JSON.stringify(t.inheritedFontSlots) && e.sourceLinkReadonly === t.sourceLinkReadonly && JSON.stringify(e.source) === JSON.stringify(t.source);
|
|
220
|
+
}
|
|
221
|
+
function N(e, t) {
|
|
222
|
+
let o = "";
|
|
223
|
+
const n = [], r = t.flatMap((s) => {
|
|
224
|
+
if (!s.text.includes(`
|
|
225
|
+
`)) return [s];
|
|
226
|
+
const i = [];
|
|
227
|
+
let l = 0;
|
|
228
|
+
for (let u = 0; u < s.text.length; u++)
|
|
229
|
+
s.text[u] === `
|
|
230
|
+
` && (u > l && i.push({ text: s.text.slice(l, u), template: s.template }), i.push({ text: `
|
|
231
|
+
`, template: s.template }), l = u + 1);
|
|
232
|
+
return l < s.text.length && i.push({ text: s.text.slice(l), template: s.template }), i;
|
|
233
|
+
});
|
|
234
|
+
for (const s of r) {
|
|
235
|
+
if (!s.text && t.length > 1) continue;
|
|
236
|
+
const i = o.length;
|
|
237
|
+
o += s.text;
|
|
238
|
+
const l = { ...s.template, from: i, to: o.length }, u = n[n.length - 1];
|
|
239
|
+
u && u.to === l.from && Ht(u, l) && !u.atomText && !l.atomText && s.text !== `
|
|
240
|
+
` && o.slice(u.from, u.to) !== `
|
|
241
|
+
` ? n[n.length - 1] = { ...u, to: l.to } : (l.to > l.from || t.length === 1) && n.push(l);
|
|
242
|
+
}
|
|
243
|
+
return { ...e, text: o, marks: n };
|
|
244
|
+
}
|
|
245
|
+
function R(e, t) {
|
|
246
|
+
const o = e.marks.find((n) => t >= n.from && t < n.to) ?? [...e.marks].reverse().find((n) => n.to <= t) ?? e.marks[0];
|
|
247
|
+
if (o) {
|
|
248
|
+
const { math: n, ...r } = o.props;
|
|
249
|
+
return { ...o, from: 0, to: 0, atomText: void 0, preserveSource: void 0, props: r };
|
|
250
|
+
}
|
|
251
|
+
return { from: 0, to: 0, props: ut };
|
|
252
|
+
}
|
|
253
|
+
function T(e, t, o) {
|
|
254
|
+
const n = [];
|
|
255
|
+
for (const r of e.marks) {
|
|
256
|
+
const s = Math.max(t, r.from), i = Math.min(o, r.to);
|
|
257
|
+
if (!(i <= s)) {
|
|
258
|
+
if (r.atomText !== void 0 && (s !== r.from || i !== r.to))
|
|
259
|
+
throw new Error("公式只能作为整体选择");
|
|
260
|
+
n.push({ text: e.text.slice(s, i), template: r });
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
return n;
|
|
264
|
+
}
|
|
265
|
+
function M(e, t, o, n, r = !1) {
|
|
266
|
+
if (n.includes("\r") || !r && n.includes(`
|
|
267
|
+
`))
|
|
268
|
+
throw new Error("replace 文本不能包含换行");
|
|
269
|
+
if (!Number.isInteger(t.p) || !Number.isInteger(o.p) || t.p < 0 || o.p < t.p || o.p >= e.length)
|
|
270
|
+
throw new Error("文字选择的段落范围无效");
|
|
271
|
+
const s = e[t.p], i = e[o.p], l = w(s, t), u = w(i, o);
|
|
272
|
+
if (t.p === o.p && u < l) throw new Error("文字选择起点不能晚于终点");
|
|
273
|
+
A(s, l), A(i, u);
|
|
274
|
+
const a = [
|
|
275
|
+
...T(s, 0, l),
|
|
276
|
+
...n ? [{ text: n, template: R(s, l) }] : [],
|
|
277
|
+
...T(i, u, i.text.length)
|
|
278
|
+
];
|
|
279
|
+
a.length || a.push({ text: "", template: R(s, l) });
|
|
280
|
+
const f = N(s, a);
|
|
281
|
+
return [...e.slice(0, t.p), f, ...e.slice(o.p + 1)];
|
|
282
|
+
}
|
|
283
|
+
function jt(e, t) {
|
|
284
|
+
if (!Number.isInteger(t.p) || t.p < 0 || t.p >= e.length)
|
|
285
|
+
throw new Error("拆分段落位置无效");
|
|
286
|
+
const o = e[t.p], n = w(o, t);
|
|
287
|
+
A(o, n);
|
|
288
|
+
const r = { text: "", template: R(o, n) }, s = T(o, 0, n), i = T(o, n, o.text.length), l = N(o, s.length ? s : [r]), u = N(o, i.length ? i : [r]);
|
|
289
|
+
return [...e.slice(0, t.p), l, u, ...e.slice(t.p + 1)];
|
|
290
|
+
}
|
|
291
|
+
function Jt(e, t, o, n, r) {
|
|
292
|
+
const s = w(e[t.p], t), i = R(e[t.p], s), l = M(e, t, o, ""), u = l[t.p], a = T(u, 0, s), f = T(u, s, u.text.length), m = n.paragraphs.map((c) => c.text.length ? c.marks.map((d) => ({
|
|
293
|
+
text: c.text.slice(d.from, d.to),
|
|
294
|
+
template: X(i, d.props)
|
|
295
|
+
})) : [{ text: "", template: i }]), p = m.map((c, d) => {
|
|
296
|
+
var k, E;
|
|
297
|
+
const b = N(u, [
|
|
298
|
+
...d === 0 ? a : [],
|
|
299
|
+
...c,
|
|
300
|
+
...d === m.length - 1 ? f : []
|
|
301
|
+
]), y = n.paragraphs[d].bullet;
|
|
302
|
+
if (!y) return b;
|
|
303
|
+
const v = y.kind === "blip" ? r == null ? void 0 : r.get(d) : void 0;
|
|
304
|
+
if (y.kind === "blip" && !v) throw new Error("富文本图片项目符号缺少资源闭包");
|
|
305
|
+
const S = y.kind === "none" ? y : {
|
|
306
|
+
...y,
|
|
307
|
+
font: y.font ?? null,
|
|
308
|
+
color: y.color ?? null,
|
|
309
|
+
size: y.size ?? null
|
|
310
|
+
}, g = S.kind === "blip" ? { ...S, image: { src: v.src } } : S, h = { ...b.props };
|
|
311
|
+
if (g.kind === "char" ? (h.bullet = g.char, delete h.bulletImage) : g.kind === "autoNum" ? (h.bullet = H(g.type, g.startAt ?? 1), delete h.bulletImage) : g.kind === "blip" ? (h.bullet = null, h.bulletImage = g.image.src) : (h.bullet = null, delete h.bulletImage), g.kind !== "none") {
|
|
312
|
+
h.bulletFont = g.font ?? null, h.bulletColor = g.color ?? null;
|
|
313
|
+
const C = Math.max(...b.marks.map((z) => z.props.size), 1);
|
|
314
|
+
h.bulletSize = ((k = g.size) == null ? void 0 : k.kind) === "points" ? g.size.value * (4 / 3) / C : ((E = g.size) == null ? void 0 : E.value) ?? null;
|
|
315
|
+
}
|
|
316
|
+
return {
|
|
317
|
+
...b,
|
|
318
|
+
props: h,
|
|
319
|
+
paragraphOverrides: { ...b.paragraphOverrides, bullet: g },
|
|
320
|
+
...v ? { bulletImageOverride: v } : {}
|
|
321
|
+
};
|
|
322
|
+
});
|
|
323
|
+
return [...l.slice(0, t.p), ...p, ...l.slice(t.p + 1)];
|
|
324
|
+
}
|
|
325
|
+
function oe(e, t, o, n) {
|
|
326
|
+
let r = o ?? P(e);
|
|
327
|
+
for (let s = 0; s < t.length; s++) {
|
|
328
|
+
const i = t[s], l = i.type === "replace" ? M(r.paragraphs, i.from, i.to, i.text) : i.type === "splitParagraph" ? jt(r.paragraphs, i.at) : i.type === "insertLineBreak" ? M(r.paragraphs, i.at, i.at, `
|
|
329
|
+
`, !0) : Jt(
|
|
330
|
+
r.paragraphs,
|
|
331
|
+
i.from,
|
|
332
|
+
i.to,
|
|
333
|
+
i.fragment,
|
|
334
|
+
n == null ? void 0 : n.get(s)
|
|
335
|
+
);
|
|
336
|
+
r = { ...r, paragraphs: l };
|
|
337
|
+
}
|
|
338
|
+
return r;
|
|
339
|
+
}
|
|
340
|
+
function K(e, t, o, n, r = !1) {
|
|
341
|
+
if (A(e, t), A(e, o), r && !e.text.length && e.marks.length === 1)
|
|
342
|
+
return { ...e, marks: [{ ...n(e.marks[0]), from: 0, to: 0 }] };
|
|
343
|
+
const s = [];
|
|
344
|
+
for (const i of e.marks) {
|
|
345
|
+
const l = Math.max(t, i.from), u = Math.min(o, i.to);
|
|
346
|
+
if (u <= l || i.atomText !== void 0) {
|
|
347
|
+
s.push({ text: e.text.slice(i.from, i.to), template: i });
|
|
348
|
+
continue;
|
|
349
|
+
}
|
|
350
|
+
if (i.preserveSource && i.props.field) {
|
|
351
|
+
s.push({ text: e.text.slice(i.from, i.to), template: n(i) });
|
|
352
|
+
continue;
|
|
353
|
+
}
|
|
354
|
+
i.from < l && s.push({ text: e.text.slice(i.from, l), template: i }), s.push({
|
|
355
|
+
text: e.text.slice(l, u),
|
|
356
|
+
template: n(i)
|
|
357
|
+
}), u < i.to && s.push({ text: e.text.slice(u, i.to), template: i });
|
|
358
|
+
}
|
|
359
|
+
return N(e, s);
|
|
360
|
+
}
|
|
361
|
+
function se(e, t, o, n) {
|
|
362
|
+
const r = n ?? P(e);
|
|
363
|
+
if (t.from.p < 0 || t.to.p < t.from.p || t.to.p >= r.paragraphs.length)
|
|
364
|
+
throw new Error("字符格式选区段落范围无效");
|
|
365
|
+
const s = r.paragraphs[t.from.p], i = r.paragraphs[t.to.p], l = w(s, t.from), u = w(i, t.to);
|
|
366
|
+
if (t.from.p === t.to.p && u < l) throw new Error("字符格式选区起点不能晚于终点");
|
|
367
|
+
if (t.from.p === t.to.p && u === l) return r;
|
|
368
|
+
const a = [...r.paragraphs];
|
|
369
|
+
for (let f = t.from.p; f <= t.to.p; f++) {
|
|
370
|
+
const m = a[f], p = f === t.from.p ? l : 0, c = f === t.to.p ? u : m.text.length;
|
|
371
|
+
a[f] = K(
|
|
372
|
+
m,
|
|
373
|
+
p,
|
|
374
|
+
c,
|
|
375
|
+
(d) => X(d, o),
|
|
376
|
+
t.from.p !== t.to.p && !m.text.length
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
return { ...r, paragraphs: a };
|
|
380
|
+
}
|
|
381
|
+
function ie(e, t, o) {
|
|
382
|
+
const n = o ?? P(e);
|
|
383
|
+
j(e, t, n);
|
|
384
|
+
const r = n.paragraphs[t.from.p], s = n.paragraphs[t.to.p], i = w(r, t.from), l = w(s, t.to);
|
|
385
|
+
if (t.from.p === t.to.p && l === i) return n;
|
|
386
|
+
const u = [...n.paragraphs];
|
|
387
|
+
for (let a = t.from.p; a <= t.to.p; a++) {
|
|
388
|
+
const f = u[a];
|
|
389
|
+
u[a] = K(
|
|
390
|
+
f,
|
|
391
|
+
a === t.from.p ? i : 0,
|
|
392
|
+
a === t.to.p ? l : f.text.length,
|
|
393
|
+
it,
|
|
394
|
+
t.from.p !== t.to.p && !f.text.length
|
|
395
|
+
);
|
|
396
|
+
}
|
|
397
|
+
return { ...n, paragraphs: u };
|
|
398
|
+
}
|
|
399
|
+
function le(e, t, o, n, r, s = e, i) {
|
|
400
|
+
const l = n ?? P(e);
|
|
401
|
+
return j(e, t, l), Bt(
|
|
402
|
+
s,
|
|
403
|
+
l,
|
|
404
|
+
t,
|
|
405
|
+
o,
|
|
406
|
+
r,
|
|
407
|
+
i
|
|
408
|
+
);
|
|
409
|
+
}
|
|
410
|
+
function ue(e, t, o) {
|
|
411
|
+
const n = o ?? P(e);
|
|
412
|
+
j(e, t, n);
|
|
413
|
+
const r = n.paragraphs.slice(t.from.p, t.to.p + 1), s = (a) => {
|
|
414
|
+
var f;
|
|
415
|
+
return Object.prototype.hasOwnProperty.call(a.paragraphOverrides ?? {}, "bullet") ? ((f = a.paragraphOverrides) == null ? void 0 : f.bullet) ?? a.inheritedBullet ?? { kind: "none" } : a.sourceBullet ? a.sourceBullet : a.props.bullet === null || a.props.bulletImage ? null : {
|
|
416
|
+
kind: "char",
|
|
417
|
+
char: a.props.bullet,
|
|
418
|
+
...a.props.bulletFont ? { font: a.props.bulletFont } : {}
|
|
419
|
+
};
|
|
420
|
+
}, i = r.map(s), l = i[0] ?? null, u = {
|
|
421
|
+
value: l,
|
|
422
|
+
mixed: i.some((a) => JSON.stringify(a) !== JSON.stringify(l))
|
|
423
|
+
};
|
|
424
|
+
return {
|
|
425
|
+
level: x(r.map((a) => a.props.lvl)),
|
|
426
|
+
align: x(r.map((a) => a.props.align)),
|
|
427
|
+
lineHeight: x(r.map((a) => a.props.lineHeight)),
|
|
428
|
+
spaceBefore: x(r.map((a) => a.props.spaceBefore)),
|
|
429
|
+
spaceAfter: x(r.map((a) => a.props.spaceAfter)),
|
|
430
|
+
marginLeft: x(r.map((a) => a.props.marL)),
|
|
431
|
+
indent: x(r.map((a) => a.props.indent)),
|
|
432
|
+
bullet: u
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
function x(e) {
|
|
436
|
+
const t = e[0] ?? null;
|
|
437
|
+
return { value: t, mixed: e.some((o) => !Object.is(o, t)) };
|
|
438
|
+
}
|
|
439
|
+
function _t(e) {
|
|
440
|
+
var n, r;
|
|
441
|
+
const t = ((n = e[0]) == null ? void 0 : n.props.fonts[0]) ?? null, o = JSON.stringify(((r = e[0]) == null ? void 0 : r.props.fonts) ?? []);
|
|
442
|
+
return {
|
|
443
|
+
value: t,
|
|
444
|
+
// 面板只显示主字体,但 eastAsia / complexScript 回退不同仍属于真实混合格式。
|
|
445
|
+
mixed: e.some((s) => JSON.stringify(s.props.fonts) !== o)
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
function j(e, t, o) {
|
|
449
|
+
const n = Q(e, t, o);
|
|
450
|
+
return {
|
|
451
|
+
font: _t(n),
|
|
452
|
+
size: x(n.map((r) => r.props.size)),
|
|
453
|
+
color: x(n.map((r) => r.props.color)),
|
|
454
|
+
b: x(n.map((r) => r.props.b)),
|
|
455
|
+
i: x(n.map((r) => r.props.i)),
|
|
456
|
+
u: x(n.map((r) => r.props.u)),
|
|
457
|
+
strike: x(n.map((r) => r.props.strike)),
|
|
458
|
+
underline: x(n.map((r) => r.props.underline ?? (r.props.u ? "sng" : "none"))),
|
|
459
|
+
strikeType: x(n.map((r) => r.props.strikeType ?? (r.props.strike ? "sngStrike" : "noStrike"))),
|
|
460
|
+
highlight: x(n.map((r) => lt(r.props.highlight))),
|
|
461
|
+
spacing: x(n.map((r) => r.props.spacing ?? 0)),
|
|
462
|
+
caps: x(n.map((r) => r.props.caps ?? "none")),
|
|
463
|
+
baseline: x(n.map((r) => r.props.baseline ?? 0))
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
function Q(e, t, o) {
|
|
467
|
+
const n = o ?? P(e);
|
|
468
|
+
if (t.from.p < 0 || t.to.p < t.from.p || t.to.p >= n.paragraphs.length)
|
|
469
|
+
throw new Error("字符格式查询段落范围无效");
|
|
470
|
+
const r = n.paragraphs[t.from.p], s = n.paragraphs[t.to.p], i = w(r, t.from), l = w(s, t.to);
|
|
471
|
+
if (t.from.p === t.to.p && l < i) throw new Error("字符格式查询起点不能晚于终点");
|
|
472
|
+
const u = [];
|
|
473
|
+
for (let a = t.from.p; a <= t.to.p; a++) {
|
|
474
|
+
const f = n.paragraphs[a], m = a === t.from.p ? i : 0, p = a === t.to.p ? l : f.text.length;
|
|
475
|
+
u.push(...f.marks.filter((c) => c.to > m && c.from < p));
|
|
476
|
+
}
|
|
477
|
+
return u.length || u.push(R(r, i)), u;
|
|
478
|
+
}
|
|
479
|
+
const ae = 5 * 1024 * 1024;
|
|
480
|
+
function ce(e) {
|
|
481
|
+
return { ...e, targetPart: `ppt/media/web-ppt-${e.hash}.${e.extension}`, created: !0 };
|
|
482
|
+
}
|
|
483
|
+
function pe(e, t, o) {
|
|
484
|
+
const n = t.filter((r) => !e.imageResources[r.hash]);
|
|
485
|
+
return {
|
|
486
|
+
forward: n.map((r) => ({ op: "set", path: ["imageResources", r.hash], value: r, origin: o })),
|
|
487
|
+
inverse: n.map((r) => ({ op: "del", path: ["imageResources", r.hash], origin: o }))
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
function Dt(e, t, o) {
|
|
491
|
+
if (!ArrayBuffer.isView(e) || Object.prototype.toString.call(e) !== "[object Uint8Array]")
|
|
492
|
+
throw new Error(`${t} 必须是 Uint8Array`);
|
|
493
|
+
const n = e;
|
|
494
|
+
if (!n.byteLength) throw new Error(`${t} 不能为空`);
|
|
495
|
+
if (o !== void 0 && n.byteLength > o)
|
|
496
|
+
throw new Error(`${t} 不能超过 ${o} 字节`);
|
|
497
|
+
return new Uint8Array(n.buffer.slice(n.byteOffset, n.byteOffset + n.byteLength));
|
|
498
|
+
}
|
|
499
|
+
function fe(e, t, o, n) {
|
|
500
|
+
const r = Dt(e, `${o}.bytes`, n), s = pt(r, t, o);
|
|
501
|
+
return {
|
|
502
|
+
hash: dt(r),
|
|
503
|
+
mime: t,
|
|
504
|
+
extension: s.extension,
|
|
505
|
+
bytes: ft(r)
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
const Ut = ["title", "body", "other"];
|
|
509
|
+
function U(e, t) {
|
|
510
|
+
var o;
|
|
511
|
+
return {
|
|
512
|
+
level: t,
|
|
513
|
+
align: e.align,
|
|
514
|
+
lineHeight: e.lineHeight,
|
|
515
|
+
spaceBefore: e.spaceBefore,
|
|
516
|
+
spaceAfter: e.spaceAfter,
|
|
517
|
+
marginLeft: e.marL,
|
|
518
|
+
indent: e.indent,
|
|
519
|
+
bullet: mt((o = e.editInfo) == null ? void 0 : o.bullet) ?? { kind: "none" }
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
function Vt(e, t) {
|
|
523
|
+
if (!t) return structuredClone(e);
|
|
524
|
+
const o = structuredClone(e), n = o;
|
|
525
|
+
for (const [r, s] of Object.entries(t))
|
|
526
|
+
r === "bullet" ? n[r] = structuredClone(s) : n[r] = s;
|
|
527
|
+
return o;
|
|
528
|
+
}
|
|
529
|
+
function qt(e, t) {
|
|
530
|
+
if (!t) return structuredClone(e);
|
|
531
|
+
const o = structuredClone(e), n = o;
|
|
532
|
+
for (const [r, s] of Object.entries(t))
|
|
533
|
+
r === "u" ? (n[r] = s, n.underline = s ? "sng" : "none") : r === "underline" ? (n.underline = s, n.u = s !== "none") : r === "strike" ? (n.strike = s, n.strikeType = s ? "sngStrike" : "noStrike") : r === "strikeType" ? (n.strikeType = s, n.strike = s !== "noStrike") : n[r] = s;
|
|
534
|
+
return o;
|
|
535
|
+
}
|
|
536
|
+
function Gt(e, t, o, n, r) {
|
|
537
|
+
var c, d;
|
|
538
|
+
const s = e.masters[t], i = s.textStyles[o].paragraphs[n], l = i == null ? void 0 : i.runs[i.runs.length - 1], u = (r == null ? void 0 : r.textStyles[o].paragraphs[n]) ?? i, a = u == null ? void 0 : u.runs[u.runs.length - 1];
|
|
539
|
+
if (!i || !l || !u || !a)
|
|
540
|
+
throw new Error(`母版 ${t} 的 ${o} 第 ${n + 1} 级来源不完整`);
|
|
541
|
+
const f = { paragraph: U(i, n), run: B(l) }, m = { paragraph: U(u, n), run: B(a) }, p = (d = (c = s.ovr.textStyles) == null ? void 0 : c[o]) == null ? void 0 : d[n];
|
|
542
|
+
return {
|
|
543
|
+
level: n,
|
|
544
|
+
source: structuredClone(f),
|
|
545
|
+
value: r ? structuredClone(m) : {
|
|
546
|
+
paragraph: Vt(f.paragraph, p == null ? void 0 : p.paragraph),
|
|
547
|
+
run: qt(f.run, p == null ? void 0 : p.run)
|
|
548
|
+
},
|
|
549
|
+
direct: {
|
|
550
|
+
paragraph: Object.keys((p == null ? void 0 : p.paragraph) ?? {}),
|
|
551
|
+
run: Object.keys((p == null ? void 0 : p.run) ?? {})
|
|
552
|
+
}
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
function de(e, t, o) {
|
|
556
|
+
return Object.fromEntries(Ut.map((n) => [
|
|
557
|
+
n,
|
|
558
|
+
Array.from({ length: 9 }, (r, s) => Gt(e, t, n, s, o))
|
|
559
|
+
]));
|
|
560
|
+
}
|
|
561
|
+
function me(e) {
|
|
562
|
+
const t = /* @__PURE__ */ new Set(), o = (n) => {
|
|
563
|
+
if (n.localName === "cNvPr") {
|
|
564
|
+
const r = Lt(n, { localName: "id", namespaceUri: null });
|
|
565
|
+
r && t.add(r.value);
|
|
566
|
+
}
|
|
567
|
+
for (const r of n.children) r.type === "element" && o(r);
|
|
568
|
+
};
|
|
569
|
+
return o(e), [...t];
|
|
570
|
+
}
|
|
571
|
+
function Xt(e) {
|
|
572
|
+
const t = e == null ? void 0 : e.meta.insertion, o = e == null ? void 0 : e.meta.origin;
|
|
573
|
+
return !t || !o ? [] : (t.relationships ?? []).flatMap((n) => {
|
|
574
|
+
var s;
|
|
575
|
+
if (n.targetMode) return [];
|
|
576
|
+
const r = ht(o.part, n.target);
|
|
577
|
+
return (s = t.resources) != null && s.some((i) => i.targetPart === r) ? [] : [r];
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
function he(e, t) {
|
|
581
|
+
var r;
|
|
582
|
+
const o = e.package;
|
|
583
|
+
if (!o || o.disposed) return;
|
|
584
|
+
const n = (r = t.slide) == null ? void 0 : r.creation;
|
|
585
|
+
n && J(e, [n.duplicateSourcePart ?? "", n.duplicateNotesSourcePart ?? ""]);
|
|
586
|
+
for (const s of new Set(Object.values(t.records).flatMap(Xt)))
|
|
587
|
+
o.parts[s] && J(e, kt(o, s));
|
|
588
|
+
}
|
|
589
|
+
function W(e, t) {
|
|
590
|
+
return t.sourceLinkReadonly ? { kind: "unsupported" } : wt(e, t.props.link);
|
|
591
|
+
}
|
|
592
|
+
function Yt(e, t) {
|
|
593
|
+
var r;
|
|
594
|
+
const o = W(e, t);
|
|
595
|
+
if (!Y(t.runOverrides ?? {}, "link") || ((r = t.runOverrides) == null ? void 0 : r.link) === null) return o;
|
|
596
|
+
const n = t.runOverrides.link;
|
|
597
|
+
return n.kind === "none" ? null : structuredClone(n);
|
|
598
|
+
}
|
|
599
|
+
function Kt(e, t, o, n) {
|
|
600
|
+
const { body: r, before: s } = gt(
|
|
601
|
+
e,
|
|
602
|
+
{ id: t, ...n !== void 0 ? { cell: n } : {} }
|
|
603
|
+
), i = (s == null ? void 0 : s.kind) === "flat" ? bt(s, r) : r, l = Q(i, o, (s == null ? void 0 : s.kind) === "flat" ? s : void 0), u = l.map((c) => Yt(e, c)), a = l.map((c) => W(e, c)), f = JSON.stringify(u[0]), m = JSON.stringify(a[0]), p = u.some((c) => JSON.stringify(c) !== f);
|
|
604
|
+
return {
|
|
605
|
+
value: structuredClone(u[0] ?? null),
|
|
606
|
+
source: structuredClone(a[0] ?? null),
|
|
607
|
+
mixed: p,
|
|
608
|
+
sourceMixed: a.some((c) => JSON.stringify(c) !== m),
|
|
609
|
+
direct: l.some((c) => Y(c.runOverrides ?? {}, "link")),
|
|
610
|
+
sourceReadonly: a.some(yt),
|
|
611
|
+
followable: !p && xt(e, u[0] ?? null)
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
function Z(e, t) {
|
|
615
|
+
var r, s, i;
|
|
616
|
+
if (!t) return null;
|
|
617
|
+
if (t.kind !== "slide") return structuredClone(t);
|
|
618
|
+
const o = (s = (r = e.slides[t.slideId]) == null ? void 0 : r.origin) == null ? void 0 : s.part, n = o && ((i = e.package) != null && i.parts[o]) ? It(e.package, o) : void 0;
|
|
619
|
+
return {
|
|
620
|
+
kind: "slide",
|
|
621
|
+
sourceSlideId: t.slideId,
|
|
622
|
+
...n ? { packageTarget: n } : {}
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
function Qt(e, t, o) {
|
|
626
|
+
return {
|
|
627
|
+
from: { p: e, r: t, off: 0 },
|
|
628
|
+
to: { p: e, r: t, off: G(o) }
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
function V(e, t, o, n) {
|
|
632
|
+
return o ? o.paragraphs.flatMap((r, s) => r.runs.flatMap((i, l) => {
|
|
633
|
+
const u = Kt(e, t, Qt(s, l, i), n), a = u.value ? Z(e, u.value) : u.direct ? { kind: "none" } : null;
|
|
634
|
+
return a ? [{ paragraph: s, run: l, ...n ? { cell: { ...n } } : {}, value: a }] : [];
|
|
635
|
+
})) : [];
|
|
636
|
+
}
|
|
637
|
+
function ke(e, t, o) {
|
|
638
|
+
var l;
|
|
639
|
+
const n = ((l = e.elements[t]) == null ? void 0 : l.meta.editable) === "full", r = St(o.kind) ? vt(e, [t]) : null, s = r != null && r.value ? Z(e, r.value) : r != null && r.direct ? { kind: "none" } : null, i = n && o.kind === "shape" ? V(e, t, o.text) : n && o.kind === "table" ? o.rows.flatMap((u, a) => u.cells.flatMap((f, m) => (
|
|
640
|
+
// 合并占位格没有独立文本身份;读取它会绕过表格主格拓扑。
|
|
641
|
+
f.merged ? [] : V(e, t, f.text, { r: a, c: m })
|
|
642
|
+
))) : [];
|
|
643
|
+
return {
|
|
644
|
+
...s ? { link: s } : {},
|
|
645
|
+
...i.length ? { textLinks: i } : {}
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
function Wt(e, t) {
|
|
649
|
+
const o = e;
|
|
650
|
+
if ((o == null ? void 0 : o.kind) === "external") {
|
|
651
|
+
Ot(e, t);
|
|
652
|
+
return;
|
|
653
|
+
}
|
|
654
|
+
if ((o == null ? void 0 : o.kind) === "slide") {
|
|
655
|
+
if (L(e, ["kind", "sourceSlideId", "packageTarget"], t), typeof o.sourceSlideId != "string" || !o.sourceSlideId)
|
|
656
|
+
throw new Error(`${t}.sourceSlideId 必须是非空页面身份`);
|
|
657
|
+
if (o.packageTarget && (L(o.packageTarget, ["rootHash", "closureHash"], `${t}.packageTarget`), !/^[0-9a-f]{64}$/.test(o.packageTarget.rootHash) || !/^[0-9a-f]{64}$/.test(o.packageTarget.closureHash)))
|
|
658
|
+
throw new Error(`${t}.packageTarget 无效`);
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
661
|
+
if ((o == null ? void 0 : o.kind) === "none" || (o == null ? void 0 : o.kind) === "unsupported") {
|
|
662
|
+
L(e, ["kind"], t);
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
if ((o == null ? void 0 : o.kind) === "relative") {
|
|
666
|
+
if (L(e, ["kind", "action"], t), !["next", "previous", "first", "last"].includes(String(o.action)))
|
|
667
|
+
throw new Error(`${t}.action 无效`);
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
throw new Error(`${t}.kind 无效`);
|
|
671
|
+
}
|
|
672
|
+
function ge(e, t) {
|
|
673
|
+
if (!Array.isArray(e)) throw new Error(`${t} 必须是数组`);
|
|
674
|
+
const o = /* @__PURE__ */ new Set();
|
|
675
|
+
e.forEach((n, r) => {
|
|
676
|
+
var l, u;
|
|
677
|
+
L(n, ["paragraph", "run", "cell", "value"], `${t}[${r}]`);
|
|
678
|
+
const s = n;
|
|
679
|
+
if (!Number.isInteger(s.paragraph) || s.paragraph < 0 || !Number.isInteger(s.run) || s.run < 0) throw new Error(`${t}[${r}] 位置无效`);
|
|
680
|
+
if (s.cell && (L(s.cell, ["r", "c"], `${t}[${r}].cell`), !Number.isInteger(s.cell.r) || s.cell.r < 0 || !Number.isInteger(s.cell.c) || s.cell.c < 0))
|
|
681
|
+
throw new Error(`${t}[${r}].cell 无效`);
|
|
682
|
+
Wt(s.value, `${t}[${r}].value`);
|
|
683
|
+
const i = `${((l = s.cell) == null ? void 0 : l.r) ?? ""}:${((u = s.cell) == null ? void 0 : u.c) ?? ""}:${s.paragraph}:${s.run}`;
|
|
684
|
+
if (o.has(i)) throw new Error(`${t} 包含重复位置`);
|
|
685
|
+
o.add(i);
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
function tt(e, t) {
|
|
689
|
+
if (t.kind === "external") return { kind: "external", href: t.href };
|
|
690
|
+
if (t.kind === "none") return { kind: "none" };
|
|
691
|
+
if (t.kind === "relative") return { kind: "relative", action: t.action };
|
|
692
|
+
if (t.kind === "unsupported") return { kind: "unsupported" };
|
|
693
|
+
if (e.slides[t.sourceSlideId]) return { kind: "slide", slideId: t.sourceSlideId };
|
|
694
|
+
const o = t.packageTarget && e.package ? Pt(e.package, t.packageTarget) : null;
|
|
695
|
+
return { kind: "slide", slideId: o && e.slideOrder.find((r) => {
|
|
696
|
+
var s;
|
|
697
|
+
return ((s = e.slides[r].origin) == null ? void 0 : s.part) === o;
|
|
698
|
+
}) || t.sourceSlideId };
|
|
699
|
+
}
|
|
700
|
+
function Zt(e, t) {
|
|
701
|
+
var n;
|
|
702
|
+
const o = (n = e.paragraphs[t.paragraph]) == null ? void 0 : n.runs[t.run];
|
|
703
|
+
if (!o) throw new Error(`剪贴板文字链接位置不存在:${t.paragraph}.${t.run}`);
|
|
704
|
+
return o;
|
|
705
|
+
}
|
|
706
|
+
function q(e, t, o) {
|
|
707
|
+
var s;
|
|
708
|
+
const n = [];
|
|
709
|
+
for (const i of o) {
|
|
710
|
+
const l = Zt(t, i), u = tt(e, i.value);
|
|
711
|
+
u.kind === "relative" ? l.link = `slide:${u.action}` : u.kind === "unsupported" ? (delete l.link, l.editInfo && (l.editInfo = { ...l.editInfo, readonlyLink: !0 })) : (delete l.link, n.push({ link: i, value: u }));
|
|
712
|
+
}
|
|
713
|
+
if (!n.length) return null;
|
|
714
|
+
const r = P(t);
|
|
715
|
+
for (const i of n) {
|
|
716
|
+
const l = (s = r.paragraphs[i.link.paragraph]) == null ? void 0 : s.marks[i.link.run];
|
|
717
|
+
if (!l) throw new Error("剪贴板文字链接格式位置不存在");
|
|
718
|
+
l.runOverrides = {
|
|
719
|
+
...l.runOverrides,
|
|
720
|
+
link: i.value
|
|
721
|
+
};
|
|
722
|
+
}
|
|
723
|
+
return r;
|
|
724
|
+
}
|
|
725
|
+
function be(e, t, o) {
|
|
726
|
+
var i, l;
|
|
727
|
+
const n = {};
|
|
728
|
+
let r;
|
|
729
|
+
if (o.link) {
|
|
730
|
+
const u = tt(e, o.link);
|
|
731
|
+
u.kind === "relative" ? t.link = `slide:${u.action}` : u.kind === "unsupported" ? (delete t.link, r = !0) : (delete t.link, n.link = u);
|
|
732
|
+
}
|
|
733
|
+
const s = o.textLinks ?? [];
|
|
734
|
+
if (t.kind === "shape" && t.text) {
|
|
735
|
+
const u = q(e, t.text, s.filter((a) => !a.cell));
|
|
736
|
+
u && (n.text = u);
|
|
737
|
+
} else if (t.kind === "table") {
|
|
738
|
+
const u = {}, a = /* @__PURE__ */ new Map();
|
|
739
|
+
for (const f of s) {
|
|
740
|
+
if (!f.cell) throw new Error("表格文字链接缺少单元格位置");
|
|
741
|
+
const m = `${f.cell.r}:${f.cell.c}`;
|
|
742
|
+
a.set(m, [...a.get(m) ?? [], f]);
|
|
743
|
+
}
|
|
744
|
+
for (const [f, m] of a) {
|
|
745
|
+
const [p, c] = f.split(":").map(Number), d = (l = (i = t.rows[p]) == null ? void 0 : i.cells[c]) == null ? void 0 : l.text;
|
|
746
|
+
if (!d) throw new Error(`剪贴板表格文字链接单元格不存在:${f}`);
|
|
747
|
+
const b = q(e, d, m);
|
|
748
|
+
b && (u[f] = { text: b });
|
|
749
|
+
}
|
|
750
|
+
Object.keys(u).length && (n.tableCells = u);
|
|
751
|
+
}
|
|
752
|
+
return { element: t, overrides: n, ...r ? { sourceLinkReadonly: r } : {} };
|
|
753
|
+
}
|
|
754
|
+
export {
|
|
755
|
+
ae as M,
|
|
756
|
+
ke as a,
|
|
757
|
+
A as b,
|
|
758
|
+
fe as c,
|
|
759
|
+
pe as d,
|
|
760
|
+
oe as e,
|
|
761
|
+
Ft as f,
|
|
762
|
+
be as g,
|
|
763
|
+
Wt as h,
|
|
764
|
+
Xt as i,
|
|
765
|
+
ge as j,
|
|
766
|
+
se as k,
|
|
767
|
+
ie as l,
|
|
768
|
+
de as m,
|
|
769
|
+
le as n,
|
|
770
|
+
ce as o,
|
|
771
|
+
ue as p,
|
|
772
|
+
j as q,
|
|
773
|
+
he as r,
|
|
774
|
+
me as s,
|
|
775
|
+
w as t,
|
|
776
|
+
Kt as u,
|
|
777
|
+
Q as v
|
|
778
|
+
};
|