@hirokisakabe/pom 9.1.2 → 10.1.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/README.md +1 -1
- package/dist/autoFit/autoFit.js +55 -15
- package/dist/autoFit/autoFit.js.map +1 -1
- package/dist/autoFit/strategies/reduceFontSize.js.map +1 -1
- package/dist/buildContext.js +5 -3
- package/dist/buildContext.js.map +1 -1
- package/dist/buildPptx.d.ts +5 -3
- package/dist/buildPptx.d.ts.map +1 -1
- package/dist/buildPptx.js +5 -4
- package/dist/buildPptx.js.map +1 -1
- package/dist/calcYogaLayout/calcYogaLayout.js +1 -1
- package/dist/calcYogaLayout/calcYogaLayout.js.map +1 -1
- package/dist/calcYogaLayout/fontLoader.d.ts +13 -0
- package/dist/calcYogaLayout/fontLoader.d.ts.map +1 -0
- package/dist/calcYogaLayout/fontLoader.js +70 -3
- package/dist/calcYogaLayout/fontLoader.js.map +1 -1
- package/dist/calcYogaLayout/measureText.d.ts.map +1 -1
- package/dist/calcYogaLayout/measureText.js +6 -6
- package/dist/calcYogaLayout/measureText.js.map +1 -1
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/extractSlideMastersAsPptx.d.ts.map +1 -1
- package/dist/extractThemeTokensFromPptx.d.ts +0 -1
- package/dist/extractThemeTokensFromPptx.d.ts.map +1 -1
- package/dist/icons/renderIcon.js +12 -10
- package/dist/icons/renderIcon.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/parseXml/coercionRules.js.map +1 -1
- package/dist/parseXml/parseXml.d.ts +0 -1
- package/dist/parseXml/parseXml.d.ts.map +1 -1
- package/dist/parseXml/parseXml.js.map +1 -1
- package/dist/parseXml/serializeXml.d.ts +0 -1
- package/dist/parseXml/serializeXml.d.ts.map +1 -1
- package/dist/parseXml/serializeXml.js.map +1 -1
- package/dist/registry/definitions/icon.js +1 -1
- package/dist/registry/definitions/list.js +1 -1
- package/dist/registry/definitions/list.js.map +1 -1
- package/dist/registry/definitions/shape.js +1 -1
- package/dist/registry/definitions/shape.js.map +1 -1
- package/dist/registry/definitions/text.js +1 -1
- package/dist/registry/definitions/text.js.map +1 -1
- package/dist/renderPptx/nodes/chart.js +172 -47
- package/dist/renderPptx/nodes/chart.js.map +1 -1
- package/dist/renderPptx/nodes/flow.js +4 -1
- package/dist/renderPptx/nodes/flow.js.map +1 -1
- package/dist/renderPptx/nodes/icon.js +5 -2
- package/dist/renderPptx/nodes/icon.js.map +1 -1
- package/dist/renderPptx/nodes/list.js +7 -9
- package/dist/renderPptx/nodes/list.js.map +1 -1
- package/dist/renderPptx/nodes/matrix.js +4 -1
- package/dist/renderPptx/nodes/matrix.js.map +1 -1
- package/dist/renderPptx/nodes/processArrow.js +8 -2
- package/dist/renderPptx/nodes/processArrow.js.map +1 -1
- package/dist/renderPptx/nodes/pyramid.js +4 -1
- package/dist/renderPptx/nodes/pyramid.js.map +1 -1
- package/dist/renderPptx/nodes/shape.js +5 -2
- package/dist/renderPptx/nodes/shape.js.map +1 -1
- package/dist/renderPptx/nodes/table.js +89 -59
- package/dist/renderPptx/nodes/table.js.map +1 -1
- package/dist/renderPptx/nodes/text.js +1 -18
- package/dist/renderPptx/nodes/text.js.map +1 -1
- package/dist/renderPptx/nodes/timeline.js +9 -3
- package/dist/renderPptx/nodes/timeline.js.map +1 -1
- package/dist/renderPptx/nodes/tree.js +4 -1
- package/dist/renderPptx/nodes/tree.js.map +1 -1
- package/dist/renderPptx/pptxAuthoring.js +381 -0
- package/dist/renderPptx/pptxAuthoring.js.map +1 -0
- package/dist/renderPptx/renderPptx.js +157 -126
- package/dist/renderPptx/renderPptx.js.map +1 -1
- package/dist/renderPptx/textOptions.js +7 -8
- package/dist/renderPptx/textOptions.js.map +1 -1
- package/dist/renderPptx/units.js +3 -3
- package/dist/renderPptx/units.js.map +1 -1
- package/dist/renderPptx/utils/backgroundBorder.js +30 -44
- package/dist/renderPptx/utils/backgroundBorder.js.map +1 -1
- package/dist/renderPptx/utils/contentArea.js +1 -1
- package/dist/renderPptx/utils/contentArea.js.map +1 -1
- package/dist/renderPptx/utils/glimpsePicture.js +3 -22
- package/dist/renderPptx/utils/glimpsePicture.js.map +1 -1
- package/dist/renderPptx/utils/glimpseShape.js +6 -25
- package/dist/renderPptx/utils/glimpseShape.js.map +1 -1
- package/dist/renderPptx/utils/glimpseTextBox.js +41 -60
- package/dist/renderPptx/utils/glimpseTextBox.js.map +1 -1
- package/dist/renderPptx/utils/straightLine.js +5 -2
- package/dist/renderPptx/utils/straightLine.js.map +1 -1
- package/dist/renderPptx/utils/visualStyle.js +3 -33
- package/dist/renderPptx/utils/visualStyle.js.map +1 -1
- package/dist/renderPptx/writablePptx.d.ts +23 -0
- package/dist/renderPptx/writablePptx.d.ts.map +1 -0
- package/dist/renderPptx/writablePptx.js +74 -0
- package/dist/renderPptx/writablePptx.js.map +1 -0
- package/dist/shared/measureImage.js.map +1 -1
- package/dist/types.d.ts +0 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +12 -9
- package/dist/renderPptx/glimpseTextBoxes.js +0 -646
- package/dist/renderPptx/glimpseTextBoxes.js.map +0 -1
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
import { parseGradient, parseLinearGradient } from "../shared/gradient.js";
|
|
2
|
+
import { EMU_PER_IN, pxToEmu, pxToPt } from "./units.js";
|
|
3
|
+
import { createTextOptions, resolveSubSup } from "./textOptions.js";
|
|
4
|
+
import { addChart, addPicture, addShape, addTable, addTextBox, asEmu, asHundredthPt, asOoxmlAngle, asOoxmlPercent, asPt, createPptx, setSlideBackground } from "@pptx-glimpse/document";
|
|
5
|
+
//#region src/renderPptx/pptxAuthoring.ts
|
|
6
|
+
function cleanHex(color) {
|
|
7
|
+
const hex = color?.replace(/^#/, "").toUpperCase();
|
|
8
|
+
return hex?.length === 3 ? [...hex].map((character) => character.repeat(2)).join("") : hex;
|
|
9
|
+
}
|
|
10
|
+
function toColorInput(color, opacity) {
|
|
11
|
+
const hex = cleanHex(color);
|
|
12
|
+
if (!hex) return void 0;
|
|
13
|
+
return {
|
|
14
|
+
kind: "srgb",
|
|
15
|
+
hex,
|
|
16
|
+
transforms: opacity === void 0 ? void 0 : [{
|
|
17
|
+
kind: "alpha",
|
|
18
|
+
value: asOoxmlPercent(Math.round(opacity * 1e5))
|
|
19
|
+
}]
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function toUnderlineInput(underline) {
|
|
23
|
+
if (underline === void 0 || underline === false) return void 0;
|
|
24
|
+
if (underline === true) return true;
|
|
25
|
+
return {
|
|
26
|
+
style: underline.style,
|
|
27
|
+
color: toColorInput(underline.color)
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function toBaselineInput(subscript, superscript) {
|
|
31
|
+
if (subscript) return {
|
|
32
|
+
type: "percent",
|
|
33
|
+
value: asOoxmlPercent(-4e4)
|
|
34
|
+
};
|
|
35
|
+
if (superscript) return {
|
|
36
|
+
type: "percent",
|
|
37
|
+
value: asOoxmlPercent(3e4)
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function toGlowInput(glow) {
|
|
41
|
+
if (!glow) return void 0;
|
|
42
|
+
return {
|
|
43
|
+
radius: asEmu(Math.round(pxToEmu(glow.size ?? 8))),
|
|
44
|
+
color: toColorInput(glow.color ?? "FFFFFF", glow.opacity ?? .75)
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function toOutlineInput(outline) {
|
|
48
|
+
if (!outline) return void 0;
|
|
49
|
+
return {
|
|
50
|
+
width: asEmu(Math.round(pxToEmu(outline.size ?? 1))),
|
|
51
|
+
color: toColorInput(outline.color ?? "FFFFFF")
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function toCharSpacing(letterSpacingPx) {
|
|
55
|
+
if (letterSpacingPx === void 0) return void 0;
|
|
56
|
+
return Math.round(pxToPt(letterSpacingPx) * 100);
|
|
57
|
+
}
|
|
58
|
+
function toTextGradientInput(value) {
|
|
59
|
+
if (!value) return void 0;
|
|
60
|
+
const linear = parseLinearGradient(value);
|
|
61
|
+
if (!linear) return void 0;
|
|
62
|
+
const dmlAngle = ((linear.angle - 90) % 360 + 360) % 360;
|
|
63
|
+
return {
|
|
64
|
+
gradientType: "linear",
|
|
65
|
+
angle: asOoxmlAngle(Math.round(dmlAngle * 6e4)),
|
|
66
|
+
stops: linear.stops.map((stop) => ({
|
|
67
|
+
position: asOoxmlPercent(Math.round(stop.position * 1e3)),
|
|
68
|
+
color: toColorInput(stop.color)
|
|
69
|
+
}))
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function stripUndefined(value) {
|
|
73
|
+
return Object.fromEntries(Object.entries(value).filter(([, entry]) => entry !== void 0));
|
|
74
|
+
}
|
|
75
|
+
function resolveUnderline(node, run) {
|
|
76
|
+
if (run?.underline !== void 0) return run.underline;
|
|
77
|
+
if (node.underline !== void 0) return node.underline;
|
|
78
|
+
return run?.href ? true : void 0;
|
|
79
|
+
}
|
|
80
|
+
function buildRunProperties(node, run, gradientFill) {
|
|
81
|
+
const fontSizePx = run?.fontSize ?? node.fontSize ?? 24;
|
|
82
|
+
const subSup = run ? resolveSubSup(run, node) : node;
|
|
83
|
+
return stripUndefined({
|
|
84
|
+
fontFace: run?.fontFamily ?? node.fontFamily ?? "Noto Sans JP",
|
|
85
|
+
fontSize: asPt(pxToPt(fontSizePx)),
|
|
86
|
+
color: gradientFill ? void 0 : toColorInput(run?.color ?? node.color),
|
|
87
|
+
gradientFill,
|
|
88
|
+
bold: run?.bold ?? node.bold,
|
|
89
|
+
italic: run?.italic ?? node.italic,
|
|
90
|
+
underline: toUnderlineInput(resolveUnderline(node, run)),
|
|
91
|
+
strike: run?.strike ?? node.strike,
|
|
92
|
+
baseline: toBaselineInput(subSup.subscript, subSup.superscript),
|
|
93
|
+
highlight: toColorInput(run?.highlight ?? node.highlight),
|
|
94
|
+
glow: toGlowInput(node.glow),
|
|
95
|
+
outline: toOutlineInput(node.outline),
|
|
96
|
+
charSpacing: toCharSpacing(run?.letterSpacing ?? node.letterSpacing)
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function buildParagraphs(node) {
|
|
100
|
+
const gradientFill = toTextGradientInput(node.textGradient);
|
|
101
|
+
const sourceRuns = node.runs && node.runs.length > 0 ? node.runs.map((run) => ({
|
|
102
|
+
text: run.text,
|
|
103
|
+
properties: buildRunProperties(node, run, gradientFill),
|
|
104
|
+
href: run.href
|
|
105
|
+
})) : [{
|
|
106
|
+
text: node.text ?? "",
|
|
107
|
+
properties: buildRunProperties(node, void 0, gradientFill)
|
|
108
|
+
}];
|
|
109
|
+
const paragraphRuns = [[]];
|
|
110
|
+
for (const run of sourceRuns) run.text.replace(/\r*\n/g, "\n").split("\n").forEach((line, index) => {
|
|
111
|
+
if (index > 0) paragraphRuns.push([]);
|
|
112
|
+
paragraphRuns.at(-1)?.push({
|
|
113
|
+
...run,
|
|
114
|
+
text: line
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
const lineHeight = node.lineHeight ?? 1.3;
|
|
118
|
+
const fontSizePx = node.fontSize ?? 24;
|
|
119
|
+
return paragraphRuns.map((runs) => ({
|
|
120
|
+
properties: {
|
|
121
|
+
align: node.textAlign,
|
|
122
|
+
marginLeft: asEmu(0),
|
|
123
|
+
indent: asEmu(0),
|
|
124
|
+
bullet: { type: "none" },
|
|
125
|
+
lineSpacing: asHundredthPt(Math.round(pxToPt(fontSizePx * lineHeight) * 100))
|
|
126
|
+
},
|
|
127
|
+
runs: runs.map((run) => ({
|
|
128
|
+
text: run.text,
|
|
129
|
+
properties: run.properties,
|
|
130
|
+
hyperlink: run.href
|
|
131
|
+
}))
|
|
132
|
+
}));
|
|
133
|
+
}
|
|
134
|
+
function toGradientFill(value, opacity) {
|
|
135
|
+
const gradient = parseGradient(value);
|
|
136
|
+
if (!gradient) return void 0;
|
|
137
|
+
const stops = gradient.value.stops.map((stop) => ({
|
|
138
|
+
position: asOoxmlPercent(Math.round(stop.position * 1e3)),
|
|
139
|
+
color: toColorInput(stop.color, opacity)
|
|
140
|
+
}));
|
|
141
|
+
if (gradient.kind === "linear") {
|
|
142
|
+
const dmlAngle = ((gradient.value.angle - 90) % 360 + 360) % 360;
|
|
143
|
+
return {
|
|
144
|
+
kind: "gradient",
|
|
145
|
+
gradientType: "linear",
|
|
146
|
+
angle: asOoxmlAngle(Math.round(dmlAngle * 6e4)),
|
|
147
|
+
stops
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
kind: "gradient",
|
|
152
|
+
gradientType: "radial",
|
|
153
|
+
centerX: asOoxmlPercent(Math.round(gradient.value.centerX * 1e3)),
|
|
154
|
+
centerY: asOoxmlPercent(Math.round(gradient.value.centerY * 1e3)),
|
|
155
|
+
stops
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function withFillOpacity(fill, opacity) {
|
|
159
|
+
if (!fill || opacity === void 0 || fill.kind !== "solid") return fill;
|
|
160
|
+
return {
|
|
161
|
+
...fill,
|
|
162
|
+
color: toColorInput(fill.color.hex, opacity)
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
function toShadowEffects(shadow) {
|
|
166
|
+
if (!shadow) return void 0;
|
|
167
|
+
const common = {
|
|
168
|
+
blurRadius: asEmu(Math.round((shadow.blur ?? 3) * 12700)),
|
|
169
|
+
distance: asEmu(Math.round((shadow.offset ?? 23e3 / 12700) * 12700)),
|
|
170
|
+
direction: asOoxmlAngle(Math.round((shadow.angle ?? 90) * 6e4)),
|
|
171
|
+
color: toColorInput(shadow.color ?? "000000", shadow.opacity ?? .35)
|
|
172
|
+
};
|
|
173
|
+
return shadow.type === "inner" ? { innerShadow: common } : { outerShadow: {
|
|
174
|
+
...common,
|
|
175
|
+
alignment: "bl",
|
|
176
|
+
rotateWithShape: true
|
|
177
|
+
} };
|
|
178
|
+
}
|
|
179
|
+
function customGeometry(input) {
|
|
180
|
+
const commands = [];
|
|
181
|
+
let moved = false;
|
|
182
|
+
for (const point of input.points) {
|
|
183
|
+
if ("close" in point) {
|
|
184
|
+
if (moved) commands.push({ kind: "close" });
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
commands.push({
|
|
188
|
+
kind: moved ? "lineTo" : "moveTo",
|
|
189
|
+
x: Math.round(point.x * EMU_PER_IN),
|
|
190
|
+
y: Math.round(point.y * EMU_PER_IN)
|
|
191
|
+
});
|
|
192
|
+
moved = true;
|
|
193
|
+
}
|
|
194
|
+
if (!moved) return void 0;
|
|
195
|
+
return {
|
|
196
|
+
kind: "custom",
|
|
197
|
+
paths: [{
|
|
198
|
+
width: Math.round(input.width * EMU_PER_IN),
|
|
199
|
+
height: Math.round(input.height * EMU_PER_IN),
|
|
200
|
+
commands
|
|
201
|
+
}]
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
function enrichShapeInput(input, options) {
|
|
205
|
+
const preset = input.geometry.kind === "preset" ? input.geometry.preset : "";
|
|
206
|
+
const geometry = options?.customGeometry ? customGeometry(options.customGeometry) ?? input.geometry : preset === "roundRect" && options?.rectRadius !== void 0 ? {
|
|
207
|
+
...input.geometry,
|
|
208
|
+
adjustValues: { adj: Math.round(options.rectRadius * 5e4) }
|
|
209
|
+
} : input.geometry;
|
|
210
|
+
const gradientFill = options?.backgroundGradient ? toGradientFill(options.backgroundGradient, options.fillOpacity) : void 0;
|
|
211
|
+
const outlineGradient = options?.outlineGradient ? toGradientFill(options.outlineGradient, options.outlineOpacity ?? options.fillOpacity) : void 0;
|
|
212
|
+
const outline = input.outline ? {
|
|
213
|
+
...input.outline,
|
|
214
|
+
fill: outlineGradient ?? withFillOpacity(input.outline.fill, options?.outlineOpacity),
|
|
215
|
+
dash: options?.dashType ?? input.outline.dash
|
|
216
|
+
} : outlineGradient ? { fill: outlineGradient } : void 0;
|
|
217
|
+
const glow = options?.glow ? {
|
|
218
|
+
radius: asEmu(Math.round(pxToEmu(options.glow.size ?? 8))),
|
|
219
|
+
color: toColorInput(options.glow.color ?? "FFFFFF", options.glow.opacity ?? .75)
|
|
220
|
+
} : input.effects?.glow;
|
|
221
|
+
const effects = {
|
|
222
|
+
...input.effects,
|
|
223
|
+
...toShadowEffects(options?.shadow),
|
|
224
|
+
...glow ? { glow } : {}
|
|
225
|
+
};
|
|
226
|
+
const width = preset === "line" && options?.zeroWidth ? asEmu(0) : input.width;
|
|
227
|
+
let height = preset === "line" && options?.zeroHeight ? asEmu(0) : input.height;
|
|
228
|
+
if (preset === "line" && width === 0 && height === 0) height = asEmu(1);
|
|
229
|
+
return {
|
|
230
|
+
...input,
|
|
231
|
+
geometry,
|
|
232
|
+
width,
|
|
233
|
+
height,
|
|
234
|
+
fill: gradientFill ?? withFillOpacity(input.fill, options?.fillOpacity),
|
|
235
|
+
outline,
|
|
236
|
+
effects: Object.keys(effects).length > 0 ? effects : void 0,
|
|
237
|
+
flipHorizontal: options?.flipH ?? input.flipHorizontal,
|
|
238
|
+
flipVertical: options?.flipV ?? input.flipVertical
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
function applyHyperlinks(input, hyperlinks) {
|
|
242
|
+
if (!hyperlinks?.some(Boolean) || !input.paragraphs) return input;
|
|
243
|
+
let index = 0;
|
|
244
|
+
return {
|
|
245
|
+
...input,
|
|
246
|
+
paragraphs: input.paragraphs.map((paragraph) => ({
|
|
247
|
+
...paragraph,
|
|
248
|
+
runs: paragraph.runs.map((run) => ({
|
|
249
|
+
...run,
|
|
250
|
+
hyperlink: hyperlinks[index++]
|
|
251
|
+
}))
|
|
252
|
+
}))
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
var PptxAuthoringRegistry = class {
|
|
256
|
+
currentSource;
|
|
257
|
+
currentSlideHandle;
|
|
258
|
+
useLayoutTextMargins = false;
|
|
259
|
+
textCount = 0;
|
|
260
|
+
shapeCount = 0;
|
|
261
|
+
pictureCount = 0;
|
|
262
|
+
tableCount = 0;
|
|
263
|
+
chartCount = 0;
|
|
264
|
+
constructor() {
|
|
265
|
+
const source = createPptx();
|
|
266
|
+
this.currentSource = source;
|
|
267
|
+
this.currentSlideHandle = source.slides[0]?.handle;
|
|
268
|
+
}
|
|
269
|
+
initialize(source, useLayoutTextMargins = false) {
|
|
270
|
+
this.currentSource = source;
|
|
271
|
+
this.useLayoutTextMargins = useLayoutTextMargins;
|
|
272
|
+
}
|
|
273
|
+
selectSlide(handle) {
|
|
274
|
+
this.currentSlideHandle = handle;
|
|
275
|
+
}
|
|
276
|
+
get source() {
|
|
277
|
+
if (!this.currentSource) throw new Error("glimpse authoring is not initialized");
|
|
278
|
+
return this.currentSource;
|
|
279
|
+
}
|
|
280
|
+
get entries() {
|
|
281
|
+
return (this.source.edits ?? []).flatMap((edit) => (edit.kind === "addTextBox" || edit.kind === "addShape") && "xml" in edit ? [{
|
|
282
|
+
kind: "shape",
|
|
283
|
+
xml: edit.xml
|
|
284
|
+
}] : []);
|
|
285
|
+
}
|
|
286
|
+
replaceSource(source) {
|
|
287
|
+
this.currentSource = source;
|
|
288
|
+
}
|
|
289
|
+
get target() {
|
|
290
|
+
if (!this.currentSlideHandle) throw new Error("glimpse slide is not selected");
|
|
291
|
+
return this.currentSlideHandle;
|
|
292
|
+
}
|
|
293
|
+
register(node) {
|
|
294
|
+
const textOptions = createTextOptions(node);
|
|
295
|
+
this.registerTextBox({
|
|
296
|
+
offsetX: asEmu(Math.round(textOptions.x * EMU_PER_IN)),
|
|
297
|
+
offsetY: asEmu(Math.round(textOptions.y * EMU_PER_IN)),
|
|
298
|
+
width: asEmu(Math.round(textOptions.w * EMU_PER_IN)),
|
|
299
|
+
height: asEmu(Math.round(textOptions.h * EMU_PER_IN)),
|
|
300
|
+
rotation: node.rotate === void 0 ? void 0 : asOoxmlAngle(Math.round(node.rotate * 6e4)),
|
|
301
|
+
body: this.useLayoutTextMargins ? void 0 : {
|
|
302
|
+
anchor: "top",
|
|
303
|
+
marginLeft: asEmu(0),
|
|
304
|
+
marginRight: asEmu(0),
|
|
305
|
+
marginTop: asEmu(0),
|
|
306
|
+
marginBottom: asEmu(0)
|
|
307
|
+
},
|
|
308
|
+
paragraphs: buildParagraphs(node)
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
registerTextBox(input, options) {
|
|
312
|
+
const name = options?.name ?? `Text ${++this.textCount}`;
|
|
313
|
+
this.currentSource = addTextBox(this.source, this.target, applyHyperlinks({
|
|
314
|
+
...input,
|
|
315
|
+
name
|
|
316
|
+
}, options?.hyperlinks));
|
|
317
|
+
}
|
|
318
|
+
registerShape(input, options) {
|
|
319
|
+
const name = options?.name ?? `Shape ${++this.shapeCount}`;
|
|
320
|
+
this.currentSource = addShape(this.source, this.target, enrichShapeInput({
|
|
321
|
+
...input,
|
|
322
|
+
name
|
|
323
|
+
}, options));
|
|
324
|
+
}
|
|
325
|
+
registerPicture(input, options) {
|
|
326
|
+
const name = options?.name ?? `Picture ${++this.pictureCount}`;
|
|
327
|
+
this.currentSource = addPicture(this.source, this.target, {
|
|
328
|
+
...input,
|
|
329
|
+
name,
|
|
330
|
+
effects: toShadowEffects(options?.shadow)
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
registerTable(input, options) {
|
|
334
|
+
const name = options?.name ?? `Table ${++this.tableCount}`;
|
|
335
|
+
this.currentSource = addTable(this.source, this.target, {
|
|
336
|
+
...input,
|
|
337
|
+
name
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
registerChart(input, options) {
|
|
341
|
+
const name = options?.name ?? `Chart ${++this.chartCount}`;
|
|
342
|
+
this.currentSource = addChart(this.source, this.target, {
|
|
343
|
+
...input,
|
|
344
|
+
name
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
setSlideBackgroundGradient(backgroundGradient, opacity) {
|
|
348
|
+
const fill = toGradientFill(backgroundGradient, opacity);
|
|
349
|
+
if (!fill || fill.kind !== "gradient") return false;
|
|
350
|
+
const background = fill.gradientType === "linear" ? {
|
|
351
|
+
kind: "gradient",
|
|
352
|
+
gradientType: "linear",
|
|
353
|
+
stops: fill.stops,
|
|
354
|
+
angle: fill.angle ?? asOoxmlAngle(0)
|
|
355
|
+
} : {
|
|
356
|
+
kind: "gradient",
|
|
357
|
+
gradientType: "radial",
|
|
358
|
+
stops: fill.stops,
|
|
359
|
+
centerX: fill.centerX,
|
|
360
|
+
centerY: fill.centerY
|
|
361
|
+
};
|
|
362
|
+
this.currentSource = setSlideBackground(this.source, this.target, background);
|
|
363
|
+
return true;
|
|
364
|
+
}
|
|
365
|
+
setSlideBackgroundSolid(color) {
|
|
366
|
+
this.currentSource = setSlideBackground(this.source, this.target, {
|
|
367
|
+
kind: "solid",
|
|
368
|
+
color: toColorInput(color)
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
setSlideBackgroundImage(bytes) {
|
|
372
|
+
this.currentSource = setSlideBackground(this.source, this.target, {
|
|
373
|
+
kind: "image",
|
|
374
|
+
bytes
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
//#endregion
|
|
379
|
+
export { PptxAuthoringRegistry, cleanHex, toColorInput };
|
|
380
|
+
|
|
381
|
+
//# sourceMappingURL=pptxAuthoring.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pptxAuthoring.js","names":[],"sources":["../../src/renderPptx/pptxAuthoring.ts"],"sourcesContent":["import {\n addChart,\n addPicture,\n addShape,\n addTable,\n addTextBox,\n asEmu,\n asHundredthPt,\n asOoxmlAngle,\n asOoxmlPercent,\n asPt,\n createPptx,\n setSlideBackground,\n type AddChartInput,\n type AddPictureInput,\n type AddShapeColorInput,\n type AddShapeCustomGeometryPathCommandInput,\n type AddShapeEffectsInput,\n type AddShapeFillInput,\n type AddShapeGeometryInput,\n type AddShapeInput,\n type AddShapeOutlineInput,\n type AddTableInput,\n type AddTextBoxGradientFillInput,\n type AddTextBoxInput,\n type AddTextBoxParagraphInput,\n type AddTextBoxRunPropertiesInput,\n type PptxSourceModel,\n type SourceHandle,\n} from \"@pptx-glimpse/document\";\nimport { parseGradient, parseLinearGradient } from \"../shared/gradient.ts\";\nimport type {\n BorderStyle,\n PositionedNode,\n ShadowStyle,\n TextGlow,\n TextOutline,\n Underline,\n} from \"../types.ts\";\nimport { createTextOptions, resolveSubSup } from \"./textOptions.ts\";\nimport { EMU_PER_IN, pxToEmu, pxToPt } from \"./units.ts\";\n\ntype TextPositionedNode = Extract<PositionedNode, { type: \"text\" }>;\n\ninterface GlimpseTextRun {\n text: string;\n properties: AddTextBoxRunPropertiesInput;\n href?: string;\n}\n\nexport function cleanHex(color: string | undefined): string | undefined {\n const hex = color?.replace(/^#/, \"\").toUpperCase();\n return hex?.length === 3\n ? [...hex].map((character) => character.repeat(2)).join(\"\")\n : hex;\n}\n\nexport function toColorInput(\n color: string | undefined,\n opacity?: number,\n): AddShapeColorInput | undefined {\n const hex = cleanHex(color);\n if (!hex) return undefined;\n return {\n kind: \"srgb\",\n hex,\n transforms:\n opacity === undefined\n ? undefined\n : [\n {\n kind: \"alpha\",\n value: asOoxmlPercent(Math.round(opacity * 100000)),\n },\n ],\n };\n}\n\nfunction toUnderlineInput(underline: Underline | undefined) {\n if (underline === undefined || underline === false) return undefined;\n if (underline === true) return true;\n return {\n style: underline.style,\n color: toColorInput(underline.color),\n };\n}\n\nfunction toBaselineInput(\n subscript: boolean | undefined,\n superscript: boolean | undefined,\n) {\n if (subscript) {\n return {\n type: \"percent\" as const,\n value: asOoxmlPercent(-40000),\n };\n }\n if (superscript) {\n return {\n type: \"percent\" as const,\n value: asOoxmlPercent(30000),\n };\n }\n return undefined;\n}\n\nfunction toGlowInput(glow: TextGlow | undefined) {\n if (!glow) return undefined;\n return {\n radius: asEmu(Math.round(pxToEmu(glow.size ?? 8))),\n color: toColorInput(glow.color ?? \"FFFFFF\", glow.opacity ?? 0.75)!,\n };\n}\n\nfunction toOutlineInput(outline: TextOutline | undefined) {\n if (!outline) return undefined;\n return {\n width: asEmu(Math.round(pxToEmu(outline.size ?? 1))),\n color: toColorInput(outline.color ?? \"FFFFFF\"),\n };\n}\n\nfunction toCharSpacing(letterSpacingPx: number | undefined) {\n if (letterSpacingPx === undefined) return undefined;\n return Math.round(pxToPt(letterSpacingPx) * 100);\n}\n\nfunction toTextGradientInput(\n value: string | undefined,\n): AddTextBoxGradientFillInput | undefined {\n if (!value) return undefined;\n const linear = parseLinearGradient(value);\n if (!linear) return undefined;\n const dmlAngle = (((linear.angle - 90) % 360) + 360) % 360;\n return {\n gradientType: \"linear\",\n angle: asOoxmlAngle(Math.round(dmlAngle * 60000)),\n stops: linear.stops.map((stop) => ({\n position: asOoxmlPercent(Math.round(stop.position * 1000)),\n color: toColorInput(stop.color)!,\n })),\n };\n}\n\nfunction stripUndefined<T extends Record<string, unknown>>(value: T): T {\n return Object.fromEntries(\n Object.entries(value).filter(([, entry]) => entry !== undefined),\n ) as T;\n}\n\nfunction resolveUnderline(\n node: TextPositionedNode,\n run: NonNullable<TextPositionedNode[\"runs\"]>[number] | undefined,\n): Underline | undefined {\n if (run?.underline !== undefined) return run.underline;\n if (node.underline !== undefined) return node.underline;\n return run?.href ? true : undefined;\n}\n\nfunction buildRunProperties(\n node: TextPositionedNode,\n run: NonNullable<TextPositionedNode[\"runs\"]>[number] | undefined,\n gradientFill: AddTextBoxGradientFillInput | undefined,\n): AddTextBoxRunPropertiesInput {\n const fontSizePx = run?.fontSize ?? node.fontSize ?? 24;\n const subSup = run ? resolveSubSup(run, node) : node;\n return stripUndefined({\n fontFace: run?.fontFamily ?? node.fontFamily ?? \"Noto Sans JP\",\n fontSize: asPt(pxToPt(fontSizePx)),\n color: gradientFill ? undefined : toColorInput(run?.color ?? node.color),\n gradientFill,\n bold: run?.bold ?? node.bold,\n italic: run?.italic ?? node.italic,\n underline: toUnderlineInput(resolveUnderline(node, run)),\n strike: run?.strike ?? node.strike,\n baseline: toBaselineInput(subSup.subscript, subSup.superscript),\n highlight: toColorInput(run?.highlight ?? node.highlight),\n glow: toGlowInput(node.glow),\n outline: toOutlineInput(node.outline),\n charSpacing: toCharSpacing(run?.letterSpacing ?? node.letterSpacing),\n });\n}\n\nfunction buildParagraphs(node: TextPositionedNode): AddTextBoxParagraphInput[] {\n const gradientFill = toTextGradientInput(node.textGradient);\n const sourceRuns: GlimpseTextRun[] =\n node.runs && node.runs.length > 0\n ? node.runs.map((run) => ({\n text: run.text,\n properties: buildRunProperties(node, run, gradientFill),\n href: run.href,\n }))\n : [\n {\n text: node.text ?? \"\",\n properties: buildRunProperties(node, undefined, gradientFill),\n },\n ];\n const paragraphRuns: GlimpseTextRun[][] = [[]];\n for (const run of sourceRuns) {\n const lines = run.text.replace(/\\r*\\n/g, \"\\n\").split(\"\\n\");\n lines.forEach((line, index) => {\n if (index > 0) paragraphRuns.push([]);\n paragraphRuns.at(-1)?.push({ ...run, text: line });\n });\n }\n const lineHeight = node.lineHeight ?? 1.3;\n const fontSizePx = node.fontSize ?? 24;\n return paragraphRuns.map((runs) => ({\n properties: {\n align: node.textAlign,\n marginLeft: asEmu(0),\n indent: asEmu(0),\n bullet: { type: \"none\" },\n lineSpacing: asHundredthPt(\n Math.round(pxToPt(fontSizePx * lineHeight) * 100),\n ),\n },\n runs: runs.map((run) => ({\n text: run.text,\n properties: run.properties,\n hyperlink: run.href,\n })),\n }));\n}\n\nexport type CustomGeometryXmlInput = {\n width: number;\n height: number;\n points: readonly ({ x: number; y: number } | { close: true })[];\n};\n\nexport type GlimpseShapeXmlOptions = {\n fillColor?: string;\n fillOpacity?: number;\n backgroundGradient?: string;\n outlineGradient?: string;\n outlineOpacity?: number;\n glow?: TextGlow;\n shadow?: ShadowStyle;\n rectRadius?: number;\n dashType?: BorderStyle[\"dashType\"];\n flipH?: boolean;\n flipV?: boolean;\n zeroWidth?: boolean;\n zeroHeight?: boolean;\n customGeometry?: CustomGeometryXmlInput;\n};\n\nfunction toGradientFill(\n value: string,\n opacity?: number,\n): AddShapeFillInput | undefined {\n const gradient = parseGradient(value);\n if (!gradient) return undefined;\n const stops = gradient.value.stops.map((stop) => ({\n position: asOoxmlPercent(Math.round(stop.position * 1000)),\n color: toColorInput(stop.color, opacity)!,\n }));\n if (gradient.kind === \"linear\") {\n const dmlAngle = (((gradient.value.angle - 90) % 360) + 360) % 360;\n return {\n kind: \"gradient\",\n gradientType: \"linear\",\n angle: asOoxmlAngle(Math.round(dmlAngle * 60000)),\n stops,\n };\n }\n return {\n kind: \"gradient\",\n gradientType: \"radial\",\n centerX: asOoxmlPercent(Math.round(gradient.value.centerX * 1000)),\n centerY: asOoxmlPercent(Math.round(gradient.value.centerY * 1000)),\n stops,\n };\n}\n\nfunction withFillOpacity(\n fill: AddShapeFillInput | undefined,\n opacity: number | undefined,\n): AddShapeFillInput | undefined {\n if (!fill || opacity === undefined || fill.kind !== \"solid\") return fill;\n return {\n ...fill,\n color: toColorInput(fill.color.hex, opacity)!,\n };\n}\n\nfunction toShadowEffects(\n shadow: ShadowStyle | undefined,\n): AddShapeEffectsInput | undefined {\n if (!shadow) return undefined;\n const common = {\n blurRadius: asEmu(Math.round((shadow.blur ?? 3) * 12700)),\n distance: asEmu(Math.round((shadow.offset ?? 23000 / 12700) * 12700)),\n direction: asOoxmlAngle(Math.round((shadow.angle ?? 90) * 60000)),\n color: toColorInput(shadow.color ?? \"000000\", shadow.opacity ?? 0.35)!,\n };\n return shadow.type === \"inner\"\n ? { innerShadow: common }\n : {\n outerShadow: {\n ...common,\n alignment: \"bl\",\n rotateWithShape: true,\n },\n };\n}\n\nfunction customGeometry(\n input: CustomGeometryXmlInput,\n): AddShapeGeometryInput | undefined {\n const commands: AddShapeCustomGeometryPathCommandInput[] = [];\n let moved = false;\n for (const point of input.points) {\n if (\"close\" in point) {\n if (moved) commands.push({ kind: \"close\" });\n continue;\n }\n commands.push({\n kind: moved ? \"lineTo\" : \"moveTo\",\n x: Math.round(point.x * EMU_PER_IN),\n y: Math.round(point.y * EMU_PER_IN),\n });\n moved = true;\n }\n if (!moved) return undefined;\n return {\n kind: \"custom\",\n paths: [\n {\n width: Math.round(input.width * EMU_PER_IN),\n height: Math.round(input.height * EMU_PER_IN),\n commands,\n },\n ],\n };\n}\n\nfunction enrichShapeInput(\n input: AddShapeInput,\n options: GlimpseShapeXmlOptions | undefined,\n): AddShapeInput {\n const preset = input.geometry.kind === \"preset\" ? input.geometry.preset : \"\";\n const geometry = options?.customGeometry\n ? (customGeometry(options.customGeometry) ?? input.geometry)\n : preset === \"roundRect\" && options?.rectRadius !== undefined\n ? {\n ...input.geometry,\n adjustValues: {\n adj: Math.round(options.rectRadius * 50000),\n },\n }\n : input.geometry;\n const gradientFill = options?.backgroundGradient\n ? toGradientFill(options.backgroundGradient, options.fillOpacity)\n : undefined;\n const outlineGradient = options?.outlineGradient\n ? toGradientFill(\n options.outlineGradient,\n options.outlineOpacity ?? options.fillOpacity,\n )\n : undefined;\n const outline: AddShapeOutlineInput | undefined = input.outline\n ? {\n ...input.outline,\n fill:\n outlineGradient ??\n withFillOpacity(input.outline.fill, options?.outlineOpacity),\n dash: options?.dashType ?? input.outline.dash,\n }\n : outlineGradient\n ? { fill: outlineGradient }\n : undefined;\n const glow = options?.glow\n ? {\n radius: asEmu(Math.round(pxToEmu(options.glow.size ?? 8))),\n color: toColorInput(\n options.glow.color ?? \"FFFFFF\",\n options.glow.opacity ?? 0.75,\n )!,\n }\n : input.effects?.glow;\n const effects: AddShapeEffectsInput = {\n ...input.effects,\n ...toShadowEffects(options?.shadow),\n ...(glow ? { glow } : {}),\n };\n const width =\n preset === \"line\" && options?.zeroWidth ? asEmu(0) : input.width;\n let height =\n preset === \"line\" && options?.zeroHeight ? asEmu(0) : input.height;\n if (preset === \"line\" && width === 0 && height === 0) height = asEmu(1);\n return {\n ...input,\n geometry,\n width,\n height,\n fill: gradientFill ?? withFillOpacity(input.fill, options?.fillOpacity),\n outline,\n effects: Object.keys(effects).length > 0 ? effects : undefined,\n flipHorizontal: options?.flipH ?? input.flipHorizontal,\n flipVertical: options?.flipV ?? input.flipVertical,\n };\n}\n\nfunction applyHyperlinks(\n input: AddTextBoxInput,\n hyperlinks: readonly (string | undefined)[] | undefined,\n): AddTextBoxInput {\n if (!hyperlinks?.some(Boolean) || !input.paragraphs) return input;\n let index = 0;\n return {\n ...input,\n paragraphs: input.paragraphs.map((paragraph) => ({\n ...paragraph,\n runs: paragraph.runs.map((run) => ({\n ...run,\n hyperlink: hyperlinks[index++],\n })),\n })),\n };\n}\n\nexport class PptxAuthoringRegistry {\n private currentSource: PptxSourceModel | undefined;\n private currentSlideHandle: SourceHandle | undefined;\n private useLayoutTextMargins = false;\n private textCount = 0;\n private shapeCount = 0;\n private pictureCount = 0;\n private tableCount = 0;\n private chartCount = 0;\n\n constructor() {\n const source = createPptx();\n this.currentSource = source;\n this.currentSlideHandle = source.slides[0]?.handle;\n }\n\n initialize(source: PptxSourceModel, useLayoutTextMargins = false): void {\n this.currentSource = source;\n this.useLayoutTextMargins = useLayoutTextMargins;\n }\n\n selectSlide(handle: SourceHandle): void {\n this.currentSlideHandle = handle;\n }\n\n get source(): PptxSourceModel {\n if (!this.currentSource)\n throw new Error(\"glimpse authoring is not initialized\");\n return this.currentSource;\n }\n\n get entries(): readonly { kind: \"shape\"; xml: string }[] {\n return (this.source.edits ?? []).flatMap((edit) =>\n (edit.kind === \"addTextBox\" || edit.kind === \"addShape\") && \"xml\" in edit\n ? [{ kind: \"shape\" as const, xml: edit.xml }]\n : [],\n );\n }\n\n replaceSource(source: PptxSourceModel): void {\n this.currentSource = source;\n }\n\n private get target(): SourceHandle {\n if (!this.currentSlideHandle)\n throw new Error(\"glimpse slide is not selected\");\n return this.currentSlideHandle;\n }\n\n register(node: TextPositionedNode): void {\n const textOptions = createTextOptions(node);\n this.registerTextBox({\n offsetX: asEmu(Math.round(textOptions.x * EMU_PER_IN)),\n offsetY: asEmu(Math.round(textOptions.y * EMU_PER_IN)),\n width: asEmu(Math.round(textOptions.w * EMU_PER_IN)),\n height: asEmu(Math.round(textOptions.h * EMU_PER_IN)),\n rotation:\n node.rotate === undefined\n ? undefined\n : asOoxmlAngle(Math.round(node.rotate * 60000)),\n body: this.useLayoutTextMargins\n ? undefined\n : {\n anchor: \"top\",\n marginLeft: asEmu(0),\n marginRight: asEmu(0),\n marginTop: asEmu(0),\n marginBottom: asEmu(0),\n },\n paragraphs: buildParagraphs(node),\n });\n }\n\n registerTextBox(\n input: AddTextBoxInput,\n options?: {\n name?: string;\n hyperlinks?: readonly (string | undefined)[];\n },\n ): void {\n const name = options?.name ?? `Text ${++this.textCount}`;\n this.currentSource = addTextBox(\n this.source,\n this.target,\n applyHyperlinks({ ...input, name }, options?.hyperlinks),\n );\n }\n\n registerShape(\n input: AddShapeInput,\n options?: GlimpseShapeXmlOptions & { name?: string },\n ): void {\n const name = options?.name ?? `Shape ${++this.shapeCount}`;\n this.currentSource = addShape(\n this.source,\n this.target,\n enrichShapeInput({ ...input, name }, options),\n );\n }\n\n registerPicture(\n input: AddPictureInput,\n options?: { name?: string; shadow?: ShadowStyle },\n ): void {\n const name = options?.name ?? `Picture ${++this.pictureCount}`;\n this.currentSource = addPicture(this.source, this.target, {\n ...input,\n name,\n effects: toShadowEffects(options?.shadow),\n });\n }\n\n registerTable(input: AddTableInput, options?: { name?: string }): void {\n const name = options?.name ?? `Table ${++this.tableCount}`;\n this.currentSource = addTable(this.source, this.target, { ...input, name });\n }\n\n registerChart(input: AddChartInput, options?: { name?: string }): void {\n const name = options?.name ?? `Chart ${++this.chartCount}`;\n this.currentSource = addChart(this.source, this.target, { ...input, name });\n }\n\n setSlideBackgroundGradient(\n backgroundGradient: string,\n opacity?: number,\n ): boolean {\n const fill = toGradientFill(backgroundGradient, opacity);\n if (!fill || fill.kind !== \"gradient\") return false;\n const background =\n fill.gradientType === \"linear\"\n ? {\n kind: \"gradient\" as const,\n gradientType: \"linear\" as const,\n stops: fill.stops,\n angle: fill.angle ?? asOoxmlAngle(0),\n }\n : {\n kind: \"gradient\" as const,\n gradientType: \"radial\" as const,\n stops: fill.stops,\n centerX: fill.centerX,\n centerY: fill.centerY,\n };\n this.currentSource = setSlideBackground(\n this.source,\n this.target,\n background,\n );\n return true;\n }\n\n setSlideBackgroundSolid(color: string): void {\n this.currentSource = setSlideBackground(this.source, this.target, {\n kind: \"solid\",\n color: toColorInput(color)!,\n });\n }\n\n setSlideBackgroundImage(bytes: Uint8Array): void {\n this.currentSource = setSlideBackground(this.source, this.target, {\n kind: \"image\",\n bytes,\n });\n }\n}\n"],"mappings":";;;;;AAkDA,SAAgB,SAAS,OAA+C;CACtE,MAAM,MAAM,OAAO,QAAQ,MAAM,EAAE,CAAC,CAAC,YAAY;CACjD,OAAO,KAAK,WAAW,IACnB,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,cAAc,UAAU,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,IACxD;AACN;AAEA,SAAgB,aACd,OACA,SACgC;CAChC,MAAM,MAAM,SAAS,KAAK;CAC1B,IAAI,CAAC,KAAK,OAAO,KAAA;CACjB,OAAO;EACL,MAAM;EACN;EACA,YACE,YAAY,KAAA,IACR,KAAA,IACA,CACE;GACE,MAAM;GACN,OAAO,eAAe,KAAK,MAAM,UAAU,GAAM,CAAC;EACpD,CACF;CACR;AACF;AAEA,SAAS,iBAAiB,WAAkC;CAC1D,IAAI,cAAc,KAAA,KAAa,cAAc,OAAO,OAAO,KAAA;CAC3D,IAAI,cAAc,MAAM,OAAO;CAC/B,OAAO;EACL,OAAO,UAAU;EACjB,OAAO,aAAa,UAAU,KAAK;CACrC;AACF;AAEA,SAAS,gBACP,WACA,aACA;CACA,IAAI,WACF,OAAO;EACL,MAAM;EACN,OAAO,eAAe,IAAM;CAC9B;CAEF,IAAI,aACF,OAAO;EACL,MAAM;EACN,OAAO,eAAe,GAAK;CAC7B;AAGJ;AAEA,SAAS,YAAY,MAA4B;CAC/C,IAAI,CAAC,MAAM,OAAO,KAAA;CAClB,OAAO;EACL,QAAQ,MAAM,KAAK,MAAM,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC;EACjD,OAAO,aAAa,KAAK,SAAS,UAA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