@office-open/core 0.4.5 → 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.
@@ -1,3800 +1 @@
1
- import { S as XmlAttributeComponent, T as XmlComponent, a as BuilderElement } from "../_chunks/xml-components-CN6syVNr.mjs";
2
- import { d as convertPixelsToEmu, t as hashedId } from "../_chunks/id-generators-Ch07cHW1.mjs";
3
- //#region src/drawingml/color/color-transform.ts
4
- /**
5
- * Color transform elements for DrawingML colors.
6
- *
7
- * This module provides color transformation elements defined in EG_ColorTransform,
8
- * which can be applied as child elements to any color type (srgbClr, schemeClr, etc.).
9
- *
10
- * Reference: ISO/IEC 29500-4, dml-main.xsd, EG_ColorTransform
11
- *
12
- * @module
13
- */
14
- /**
15
- * Creates color transform child elements.
16
- *
17
- * These elements modify the parent color according to OOXML color transform rules.
18
- * Multiple transforms can be applied in sequence.
19
- *
20
- * @example
21
- * ```typescript
22
- * // Lighten accent1 by 40%
23
- * createColorTransforms({ tint: 40000 });
24
- * // Semi-transparent red with 50% alpha
25
- * createColorTransforms({ alpha: 50000 });
26
- * ```
27
- */
28
- const createColorTransforms = (options) => {
29
- const transforms = [];
30
- if (options.tint !== void 0) transforms.push(new BuilderElement({
31
- attributes: { val: {
32
- key: "val",
33
- value: options.tint
34
- } },
35
- name: "a:tint"
36
- }));
37
- if (options.shade !== void 0) transforms.push(new BuilderElement({
38
- attributes: { val: {
39
- key: "val",
40
- value: options.shade
41
- } },
42
- name: "a:shade"
43
- }));
44
- if (options.comp) transforms.push(new BuilderElement({ name: "a:comp" }));
45
- if (options.inv) transforms.push(new BuilderElement({ name: "a:inv" }));
46
- if (options.gray) transforms.push(new BuilderElement({ name: "a:gray" }));
47
- if (options.alpha !== void 0) transforms.push(new BuilderElement({
48
- attributes: { val: {
49
- key: "val",
50
- value: options.alpha
51
- } },
52
- name: "a:alpha"
53
- }));
54
- if (options.alphaOff !== void 0) transforms.push(new BuilderElement({
55
- attributes: { val: {
56
- key: "val",
57
- value: options.alphaOff
58
- } },
59
- name: "a:alphaOff"
60
- }));
61
- if (options.alphaMod !== void 0) transforms.push(new BuilderElement({
62
- attributes: { val: {
63
- key: "val",
64
- value: options.alphaMod
65
- } },
66
- name: "a:alphaMod"
67
- }));
68
- if (options.hue !== void 0) transforms.push(new BuilderElement({
69
- attributes: { val: {
70
- key: "val",
71
- value: options.hue
72
- } },
73
- name: "a:hue"
74
- }));
75
- if (options.hueOff !== void 0) transforms.push(new BuilderElement({
76
- attributes: { val: {
77
- key: "val",
78
- value: options.hueOff
79
- } },
80
- name: "a:hueOff"
81
- }));
82
- if (options.hueMod !== void 0) transforms.push(new BuilderElement({
83
- attributes: { val: {
84
- key: "val",
85
- value: options.hueMod
86
- } },
87
- name: "a:hueMod"
88
- }));
89
- if (options.sat !== void 0) transforms.push(new BuilderElement({
90
- attributes: { val: {
91
- key: "val",
92
- value: options.sat
93
- } },
94
- name: "a:sat"
95
- }));
96
- if (options.satOff !== void 0) transforms.push(new BuilderElement({
97
- attributes: { val: {
98
- key: "val",
99
- value: options.satOff
100
- } },
101
- name: "a:satOff"
102
- }));
103
- if (options.satMod !== void 0) transforms.push(new BuilderElement({
104
- attributes: { val: {
105
- key: "val",
106
- value: options.satMod
107
- } },
108
- name: "a:satMod"
109
- }));
110
- if (options.lum !== void 0) transforms.push(new BuilderElement({
111
- attributes: { val: {
112
- key: "val",
113
- value: options.lum
114
- } },
115
- name: "a:lum"
116
- }));
117
- if (options.lumOff !== void 0) transforms.push(new BuilderElement({
118
- attributes: { val: {
119
- key: "val",
120
- value: options.lumOff
121
- } },
122
- name: "a:lumOff"
123
- }));
124
- if (options.lumMod !== void 0) transforms.push(new BuilderElement({
125
- attributes: { val: {
126
- key: "val",
127
- value: options.lumMod
128
- } },
129
- name: "a:lumMod"
130
- }));
131
- if (options.red !== void 0) transforms.push(new BuilderElement({
132
- attributes: { val: {
133
- key: "val",
134
- value: options.red
135
- } },
136
- name: "a:red"
137
- }));
138
- if (options.redOff !== void 0) transforms.push(new BuilderElement({
139
- attributes: { val: {
140
- key: "val",
141
- value: options.redOff
142
- } },
143
- name: "a:redOff"
144
- }));
145
- if (options.redMod !== void 0) transforms.push(new BuilderElement({
146
- attributes: { val: {
147
- key: "val",
148
- value: options.redMod
149
- } },
150
- name: "a:redMod"
151
- }));
152
- if (options.green !== void 0) transforms.push(new BuilderElement({
153
- attributes: { val: {
154
- key: "val",
155
- value: options.green
156
- } },
157
- name: "a:green"
158
- }));
159
- if (options.greenOff !== void 0) transforms.push(new BuilderElement({
160
- attributes: { val: {
161
- key: "val",
162
- value: options.greenOff
163
- } },
164
- name: "a:greenOff"
165
- }));
166
- if (options.greenMod !== void 0) transforms.push(new BuilderElement({
167
- attributes: { val: {
168
- key: "val",
169
- value: options.greenMod
170
- } },
171
- name: "a:greenMod"
172
- }));
173
- if (options.blue !== void 0) transforms.push(new BuilderElement({
174
- attributes: { val: {
175
- key: "val",
176
- value: options.blue
177
- } },
178
- name: "a:blue"
179
- }));
180
- if (options.blueOff !== void 0) transforms.push(new BuilderElement({
181
- attributes: { val: {
182
- key: "val",
183
- value: options.blueOff
184
- } },
185
- name: "a:blueOff"
186
- }));
187
- if (options.blueMod !== void 0) transforms.push(new BuilderElement({
188
- attributes: { val: {
189
- key: "val",
190
- value: options.blueMod
191
- } },
192
- name: "a:blueMod"
193
- }));
194
- if (options.gamma) transforms.push(new BuilderElement({ name: "a:gamma" }));
195
- if (options.invGamma) transforms.push(new BuilderElement({ name: "a:invGamma" }));
196
- return transforms;
197
- };
198
- //#endregion
199
- //#region src/drawingml/color/hsl-color.ts
200
- /**
201
- * HSL color element for DrawingML.
202
- *
203
- * This module provides HSL (Hue, Saturation, Luminance) color support.
204
- *
205
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_HslColor
206
- *
207
- * @module
208
- */
209
- /**
210
- * Creates an HSL color element.
211
- *
212
- * Specifies a color using Hue, Saturation, and Luminance values.
213
- *
214
- * ## XSD Schema
215
- * ```xml
216
- * <xsd:complexType name="CT_HslColor">
217
- * <xsd:sequence>
218
- * <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
219
- * </xsd:sequence>
220
- * <xsd:attribute name="hue" type="ST_PositiveFixedAngle" use="required"/>
221
- * <xsd:attribute name="sat" type="ST_Percentage" use="required"/>
222
- * <xsd:attribute name="lum" type="ST_Percentage" use="required"/>
223
- * </xsd:complexType>
224
- * ```
225
- */
226
- const createHslColor = (options) => {
227
- const transforms = options.transforms ? createColorTransforms(options.transforms) : [];
228
- return new BuilderElement({
229
- attributes: {
230
- hue: {
231
- key: "hue",
232
- value: options.hue
233
- },
234
- lum: {
235
- key: "lum",
236
- value: options.luminance
237
- },
238
- sat: {
239
- key: "sat",
240
- value: options.saturation
241
- }
242
- },
243
- children: [...transforms],
244
- name: "a:hslClr"
245
- });
246
- };
247
- //#endregion
248
- //#region src/drawingml/color/preset-color.ts
249
- /**
250
- * Preset color element for DrawingML.
251
- *
252
- * This module provides named preset colors (CSS named colors).
253
- *
254
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_PresetColor / ST_PresetColorVal
255
- *
256
- * @module
257
- */
258
- /**
259
- * Preset color values (CSS named colors).
260
- *
261
- * ## XSD Schema
262
- * ```xml
263
- * <xsd:simpleType name="ST_PresetColorVal">
264
- * <xsd:restriction base="xsd:token">
265
- * <xsd:enumeration value="aliceBlue"/>
266
- * ...
267
- * <xsd:enumeration value="yellowGreen"/>
268
- * </xsd:restriction>
269
- * </xsd:simpleType>
270
- * ```
271
- */
272
- const PresetColor = {
273
- ALICE_BLUE: "aliceBlue",
274
- ANTIQUE_WHITE: "antiqueWhite",
275
- AQUA: "aqua",
276
- AQUAMARINE: "aquamarine",
277
- AZURE: "azure",
278
- BEIGE: "beige",
279
- BISQUE: "bisque",
280
- BLACK: "black",
281
- BLANCHED_ALMOND: "blanchedAlmond",
282
- BLUE: "blue",
283
- BLUE_VIOLET: "blueViolet",
284
- BROWN: "brown",
285
- BURLY_WOOD: "burlyWood",
286
- CADET_BLUE: "cadetBlue",
287
- CHARTREUSE: "chartreuse",
288
- CHOCOLATE: "chocolate",
289
- CORAL: "coral",
290
- CORNFLOWER_BLUE: "cornflowerBlue",
291
- CORNSILK: "cornsilk",
292
- CRIMSON: "crimson",
293
- CYAN: "cyan",
294
- DARK_BLUE: "darkBlue",
295
- DARK_CYAN: "darkCyan",
296
- DARK_GOLDENROD: "darkGoldenrod",
297
- DARK_GRAY: "darkGray",
298
- DARK_GREY: "darkGrey",
299
- DARK_GREEN: "darkGreen",
300
- DARK_KHAKI: "darkKhaki",
301
- DARK_MAGENTA: "darkMagenta",
302
- DARK_OLIVE_GREEN: "darkOliveGreen",
303
- DARK_ORANGE: "darkOrange",
304
- DARK_ORCHID: "darkOrchid",
305
- DARK_RED: "darkRed",
306
- DARK_SALMON: "darkSalmon",
307
- DARK_SEA_GREEN: "darkSeaGreen",
308
- DARK_SLATE_BLUE: "darkSlateBlue",
309
- DARK_SLATE_GRAY: "darkSlateGray",
310
- DARK_SLATE_GREY: "darkSlateGrey",
311
- DARK_TURQUOISE: "darkTurquoise",
312
- DARK_VIOLET: "darkViolet",
313
- DEEP_PINK: "deepPink",
314
- DEEP_SKY_BLUE: "deepSkyBlue",
315
- DIM_GRAY: "dimGray",
316
- DIM_GREY: "dimGrey",
317
- DODGER_BLUE: "dodgerBlue",
318
- FIREBRICK: "firebrick",
319
- FLORAL_WHITE: "floralWhite",
320
- FOREST_GREEN: "forestGreen",
321
- FUCHSIA: "fuchsia",
322
- GAINSBORO: "gainsboro",
323
- GHOST_WHITE: "ghostWhite",
324
- GOLD: "gold",
325
- GOLDENROD: "goldenrod",
326
- GRAY: "gray",
327
- GREY: "grey",
328
- GREEN: "green",
329
- GREEN_YELLOW: "greenYellow",
330
- HONEYDEW: "honeydew",
331
- HOT_PINK: "hotPink",
332
- INDIAN_RED: "indianRed",
333
- INDIGO: "indigo",
334
- IVORY: "ivory",
335
- KHAKI: "khaki",
336
- LAVENDER: "lavender",
337
- LAVENDER_BLUSH: "lavenderBlush",
338
- LAWN_GREEN: "lawnGreen",
339
- LEMON_CHIFFON: "lemonChiffon",
340
- LIGHT_BLUE: "lightBlue",
341
- LIGHT_CORAL: "lightCoral",
342
- LIGHT_CYAN: "lightCyan",
343
- LIGHT_GOLDENROD_YELLOW: "lightGoldenrodYellow",
344
- LIGHT_GRAY: "lightGray",
345
- LIGHT_GREY: "lightGrey",
346
- LIGHT_GREEN: "lightGreen",
347
- LIGHT_PINK: "lightPink",
348
- LIGHT_SALMON: "lightSalmon",
349
- LIGHT_SEA_GREEN: "lightSeaGreen",
350
- LIGHT_SKY_BLUE: "lightSkyBlue",
351
- LIGHT_SLATE_GRAY: "lightSlateGray",
352
- LIGHT_SLATE_GREY: "lightSlateGrey",
353
- LIGHT_STEEL_BLUE: "lightSteelBlue",
354
- LIGHT_YELLOW: "lightYellow",
355
- LIME: "lime",
356
- LIME_GREEN: "limeGreen",
357
- LINEN: "linen",
358
- MAGENTA: "magenta",
359
- MAROON: "maroon",
360
- MEDIUM_AQUAMARINE: "mediumAquamarine",
361
- MEDIUM_BLUE: "mediumBlue",
362
- MEDIUM_ORCHID: "mediumOrchid",
363
- MEDIUM_PURPLE: "mediumPurple",
364
- MEDIUM_SEA_GREEN: "mediumSeaGreen",
365
- MEDIUM_SLATE_BLUE: "mediumSlateBlue",
366
- MEDIUM_SPRING_GREEN: "mediumSpringGreen",
367
- MEDIUM_TURQUOISE: "mediumTurquoise",
368
- MEDIUM_VIOLET_RED: "mediumVioletRed",
369
- MIDNIGHT_BLUE: "midnightBlue",
370
- MINT_CREAM: "mintCream",
371
- MISTY_ROSE: "mistyRose",
372
- MOCCASIN: "moccasin",
373
- NAVAJO_WHITE: "navajoWhite",
374
- NAVY: "navy",
375
- OLD_LACE: "oldLace",
376
- OLIVE: "olive",
377
- OLIVE_DRAB: "oliveDrab",
378
- ORANGE: "orange",
379
- ORANGE_RED: "orangeRed",
380
- ORCHID: "orchid",
381
- PALE_GOLDENROD: "paleGoldenrod",
382
- PALE_GREEN: "paleGreen",
383
- PALE_TURQUOISE: "paleTurquoise",
384
- PALE_VIOLET_RED: "paleVioletRed",
385
- PAPAYA_WHIP: "papayaWhip",
386
- PEACH_PUFF: "peachPuff",
387
- PERU: "peru",
388
- PINK: "pink",
389
- PLUM: "plum",
390
- POWDER_BLUE: "powderBlue",
391
- PURPLE: "purple",
392
- RED: "red",
393
- ROSY_BROWN: "rosyBrown",
394
- ROYAL_BLUE: "royalBlue",
395
- SADDLE_BROWN: "saddleBrown",
396
- SALMON: "salmon",
397
- SANDY_BROWN: "sandyBrown",
398
- SEA_GREEN: "seaGreen",
399
- SEA_SHELL: "seaShell",
400
- SIENNA: "sienna",
401
- SILVER: "silver",
402
- SKY_BLUE: "skyBlue",
403
- SLATE_BLUE: "slateBlue",
404
- SLATE_GRAY: "slateGray",
405
- SLATE_GREY: "slateGrey",
406
- SNOW: "snow",
407
- SPRING_GREEN: "springGreen",
408
- STEEL_BLUE: "steelBlue",
409
- TAN: "tan",
410
- TEAL: "teal",
411
- THISTLE: "thistle",
412
- TOMATO: "tomato",
413
- TURQUOISE: "turquoise",
414
- VIOLET: "violet",
415
- WHEAT: "wheat",
416
- WHITE: "white",
417
- WHITE_SMOKE: "whiteSmoke",
418
- YELLOW: "yellow",
419
- YELLOW_GREEN: "yellowGreen"
420
- };
421
- /**
422
- * Creates a preset color element.
423
- *
424
- * Specifies a color using a named preset (CSS named color).
425
- *
426
- * ## XSD Schema
427
- * ```xml
428
- * <xsd:complexType name="CT_PresetColor">
429
- * <xsd:sequence>
430
- * <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
431
- * </xsd:sequence>
432
- * <xsd:attribute name="val" type="ST_PresetColorVal" use="required"/>
433
- * </xsd:complexType>
434
- * ```
435
- */
436
- const createPresetColor = (options) => {
437
- const transforms = options.transforms ? createColorTransforms(options.transforms) : [];
438
- return new BuilderElement({
439
- attributes: { value: {
440
- key: "val",
441
- value: options.value
442
- } },
443
- children: [...transforms],
444
- name: "a:prstClr"
445
- });
446
- };
447
- //#endregion
448
- //#region src/drawingml/color/rgb-color.ts
449
- /**
450
- * RGB color element for DrawingML shapes.
451
- *
452
- * This module provides RGB color support for solid fills.
453
- *
454
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SRgbColor
455
- *
456
- * @module
457
- */
458
- /**
459
- * Creates an sRGB color element.
460
- *
461
- * Specifies a color using RGB hex values.
462
- *
463
- * ## XSD Schema
464
- * ```xml
465
- * <xsd:complexType name="CT_SRgbColor">
466
- * <xsd:sequence>
467
- * <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
468
- * </xsd:sequence>
469
- * <xsd:attribute name="val" type="s:ST_HexColorRGB" use="required"/>
470
- * </xsd:complexType>
471
- * ```
472
- *
473
- * @example
474
- * ```typescript
475
- * const redColor = createRgbColor({ value: "FF0000" });
476
- * // With alpha transform
477
- * const semiRed = createRgbColor({ value: "FF0000", transforms: { alpha: 50000 } });
478
- * ```
479
- */
480
- const createRgbColor = (options) => {
481
- const transforms = options.transforms ? createColorTransforms(options.transforms) : [];
482
- return new BuilderElement({
483
- attributes: { value: {
484
- key: "val",
485
- value: options.value
486
- } },
487
- children: [...transforms],
488
- name: "a:srgbClr"
489
- });
490
- };
491
- //#endregion
492
- //#region src/drawingml/color/sc-rgb-color.ts
493
- /**
494
- * ScRGB color element for DrawingML shapes.
495
- *
496
- * This module provides scRGB color support using percentage-based RGB values.
497
- *
498
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_ScRgbColor
499
- *
500
- * @module
501
- */
502
- /**
503
- * Creates an scRGB color element.
504
- *
505
- * Specifies a color using percentage-based RGB values.
506
- *
507
- * ## XSD Schema
508
- * ```xml
509
- * <xsd:complexType name="CT_ScRgbColor">
510
- * <xsd:sequence>
511
- * <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
512
- * </xsd:sequence>
513
- * <xsd:attribute name="r" type="ST_Percentage" use="required"/>
514
- * <xsd:attribute name="g" type="ST_Percentage" use="required"/>
515
- * <xsd:attribute name="b" type="ST_Percentage" use="required"/>
516
- * </xsd:complexType>
517
- * ```
518
- *
519
- * @example
520
- * ```typescript
521
- * const redColor = createScRgbColor({ r: "100%", g: "0%", b: "0%" });
522
- * // With alpha transform
523
- * const semiRed = createScRgbColor({ r: "100%", g: "0%", b: "0%", transforms: { alpha: 50000 } });
524
- * ```
525
- */
526
- const createScRgbColor = (options) => {
527
- const transforms = options.transforms ? createColorTransforms(options.transforms) : [];
528
- return new BuilderElement({
529
- attributes: {
530
- r: {
531
- key: "r",
532
- value: options.r
533
- },
534
- g: {
535
- key: "g",
536
- value: options.g
537
- },
538
- b: {
539
- key: "b",
540
- value: options.b
541
- }
542
- },
543
- children: [...transforms],
544
- name: "a:scrgbClr"
545
- });
546
- };
547
- //#endregion
548
- //#region src/drawingml/color/scheme-color.ts
549
- /**
550
- * Scheme color element for DrawingML shapes.
551
- *
552
- * This module provides scheme-based color support for solid fills,
553
- * allowing colors to be defined using theme color schemes.
554
- *
555
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SchemeColor / ST_SchemeColorVal
556
- *
557
- * @module
558
- */
559
- /**
560
- * Scheme color values for theme-based colors.
561
- *
562
- * These values reference colors defined in the document's color scheme/theme.
563
- */
564
- const SchemeColor = {
565
- BG1: "bg1",
566
- TX1: "tx1",
567
- BG2: "bg2",
568
- TX2: "tx2",
569
- ACCENT1: "accent1",
570
- ACCENT2: "accent2",
571
- ACCENT3: "accent3",
572
- ACCENT4: "accent4",
573
- ACCENT5: "accent5",
574
- ACCENT6: "accent6",
575
- HLINK: "hlink",
576
- FOLHLINK: "folHlink",
577
- DK1: "dk1",
578
- LT1: "lt1",
579
- DK2: "dk2",
580
- LT2: "lt2",
581
- PHCLR: "phClr"
582
- };
583
- /**
584
- * Creates a scheme color element.
585
- *
586
- * Specifies a color using a theme color scheme reference.
587
- *
588
- * ## XSD Schema
589
- * ```xml
590
- * <xsd:complexType name="CT_SchemeColor">
591
- * <xsd:sequence>
592
- * <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
593
- * </xsd:sequence>
594
- * <xsd:attribute name="val" type="ST_SchemeColorVal" use="required"/>
595
- * </xsd:complexType>
596
- * ```
597
- *
598
- * @example
599
- * ```typescript
600
- * const accentColor = createSchemeColor({ value: SchemeColor.ACCENT1 });
601
- * // With tint transform
602
- * const lightAccent = createSchemeColor({
603
- * value: SchemeColor.ACCENT1,
604
- * transforms: { tint: 40000 },
605
- * });
606
- * ```
607
- */
608
- const createSchemeColor = (options) => {
609
- const transforms = options.transforms ? createColorTransforms(options.transforms) : [];
610
- return new BuilderElement({
611
- attributes: { value: {
612
- key: "val",
613
- value: options.value
614
- } },
615
- children: [...transforms],
616
- name: "a:schemeClr"
617
- });
618
- };
619
- //#endregion
620
- //#region src/drawingml/color/system-color.ts
621
- /**
622
- * System color element for DrawingML.
623
- *
624
- * This module provides system color support, referencing OS-level UI colors.
625
- *
626
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SystemColor / ST_SystemColorVal
627
- *
628
- * @module
629
- */
630
- /**
631
- * System color values referencing OS UI colors.
632
- *
633
- * ## XSD Schema
634
- * ```xml
635
- * <xsd:simpleType name="ST_SystemColorVal">
636
- * <xsd:restriction base="xsd:token">
637
- * <xsd:enumeration value="scrollBar"/>
638
- * <xsd:enumeration value="background"/>
639
- * ...
640
- * <xsd:enumeration value="menuBar"/>
641
- * </xsd:restriction>
642
- * </xsd:simpleType>
643
- * ```
644
- */
645
- const SystemColor = {
646
- SCROLL_BAR: "scrollBar",
647
- BACKGROUND: "background",
648
- ACTIVE_CAPTION: "activeCaption",
649
- INACTIVE_CAPTION: "inactiveCaption",
650
- MENU: "menu",
651
- WINDOW: "window",
652
- WINDOW_FRAME: "windowFrame",
653
- MENU_TEXT: "menuText",
654
- WINDOW_TEXT: "windowText",
655
- CAPTION_TEXT: "captionText",
656
- ACTIVE_BORDER: "activeBorder",
657
- INACTIVE_BORDER: "inactiveBorder",
658
- APP_WORKSPACE: "appWorkspace",
659
- HIGHLIGHT: "highlight",
660
- HIGHLIGHT_TEXT: "highlightText",
661
- BTN_FACE: "btnFace",
662
- BTN_SHADOW: "btnShadow",
663
- GRAY_TEXT: "grayText",
664
- BTN_TEXT: "btnText",
665
- INACTIVE_CAPTION_TEXT: "inactiveCaptionText",
666
- BTN_HIGHLIGHT: "btnHighlight",
667
- THREE_D_DK_SHADOW: "3dDkShadow",
668
- THREE_D_LIGHT: "3dLight",
669
- INFO_TEXT: "infoText",
670
- INFO_BK: "infoBk",
671
- HOT_LIGHT: "hotLight",
672
- GRADIENT_ACTIVE_CAPTION: "gradientActiveCaption",
673
- GRADIENT_INACTIVE_CAPTION: "gradientInactiveCaption",
674
- MENU_HIGHLIGHT: "menuHighlight",
675
- MENU_BAR: "menuBar"
676
- };
677
- /**
678
- * Creates a system color element.
679
- *
680
- * References a system-defined UI color (e.g., window background, button face).
681
- *
682
- * ## XSD Schema
683
- * ```xml
684
- * <xsd:complexType name="CT_SystemColor">
685
- * <xsd:sequence>
686
- * <xsd:group ref="EG_ColorTransform" minOccurs="0" maxOccurs="unbounded"/>
687
- * </xsd:sequence>
688
- * <xsd:attribute name="val" type="ST_SystemColorVal" use="required"/>
689
- * <xsd:attribute name="lastClr" type="s:ST_HexColorRGB" use="optional"/>
690
- * </xsd:complexType>
691
- * ```
692
- */
693
- const createSystemColor = (options) => {
694
- const transforms = options.transforms ? createColorTransforms(options.transforms) : [];
695
- return new BuilderElement({
696
- attributes: {
697
- lastClr: {
698
- key: "lastClr",
699
- value: options.lastClr
700
- },
701
- value: {
702
- key: "val",
703
- value: options.value
704
- }
705
- },
706
- children: [...transforms],
707
- name: "a:sysClr"
708
- });
709
- };
710
- //#endregion
711
- //#region src/drawingml/color/solid-fill.ts
712
- /**
713
- * Solid fill element for DrawingML shapes.
714
- *
715
- * This module provides solid fill support for outlines and shapes,
716
- * supporting RGB, scheme, HSL, system, and preset colors.
717
- *
718
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SolidColorFillProperties
719
- *
720
- * @module
721
- */
722
- /**
723
- * Creates the color child element for a solid fill based on the color type.
724
- */
725
- const SYSTEM_COLOR_VALUES = new Set(Object.values(SystemColor));
726
- const PRESET_COLOR_VALUES = new Set(Object.values(PresetColor));
727
- const SCHEME_COLOR_VALUES = new Set(Object.values(SchemeColor));
728
- const createColorElement = (color) => {
729
- if ("hue" in color && "saturation" in color && "luminance" in color) return createHslColor(color);
730
- if ("r" in color && "g" in color && "b" in color) return createScRgbColor(color);
731
- const colorValue = color.value;
732
- if (SYSTEM_COLOR_VALUES.has(colorValue)) return createSystemColor(color);
733
- if (PRESET_COLOR_VALUES.has(colorValue)) return createPresetColor(color);
734
- if (SCHEME_COLOR_VALUES.has(colorValue)) return createSchemeColor(color);
735
- return createRgbColor(color);
736
- };
737
- /**
738
- * Creates a solid fill element.
739
- *
740
- * Specifies a solid color fill using any supported color type.
741
- *
742
- * ## XSD Schema
743
- * ```xml
744
- * <xsd:complexType name="CT_SolidColorFillProperties">
745
- * <xsd:sequence>
746
- * <xsd:group ref="EG_ColorChoice" minOccurs="0"/>
747
- * <xsd:group ref="EG_EffectProperties" minOccurs="0"/>
748
- * </xsd:sequence>
749
- * </xsd:complexType>
750
- * ```
751
- *
752
- * @example
753
- * ```typescript
754
- * // RGB solid fill
755
- * const fill = createSolidFill({ value: "FF0000" });
756
- * // Scheme solid fill with tint
757
- * const schemeFill = createSolidFill({
758
- * value: SchemeColor.ACCENT1, transforms: { tint: 40000 },
759
- * });
760
- * // HSL solid fill
761
- * const hslFill = createSolidFill({ hue: 120000, saturation: 100000, luminance: 50000 });
762
- * ```
763
- */
764
- const createSolidFill = (options) => new BuilderElement({
765
- children: [createColorElement(options)],
766
- name: "a:solidFill"
767
- });
768
- //#endregion
769
- //#region src/drawingml/blip/blip-effects.ts
770
- /**
771
- * Blip image adjustment effects for DrawingML.
772
- *
773
- * These effects are applied directly to the image data within the `<a:blip>` element,
774
- * corresponding to Word's "Picture Format > Adjust" features (brightness, contrast,
775
- * grayscale, tint, duotone, etc.).
776
- *
777
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_Blip children
778
- *
779
- * @module
780
- */
781
- /**
782
- * Creates blip effect elements from BlipEffectsOptions.
783
- *
784
- * @returns Array of XML components representing blip effects
785
- */
786
- const createBlipEffects = (options) => {
787
- const children = [];
788
- if (options.grayscale) children.push(new BuilderElement({ name: "a:grayscl" }));
789
- if (options.luminance) {
790
- const attrs = {};
791
- if (options.luminance.bright !== void 0) attrs.bright = {
792
- key: "bright",
793
- value: `${options.luminance.bright}%`
794
- };
795
- if (options.luminance.contrast !== void 0) attrs.contrast = {
796
- key: "contrast",
797
- value: `${options.luminance.contrast}%`
798
- };
799
- children.push(new BuilderElement({
800
- attributes: attrs,
801
- name: "a:lum"
802
- }));
803
- }
804
- if (options.hsl) {
805
- const attrs = {};
806
- if (options.hsl.hue !== void 0) attrs.hue = {
807
- key: "hue",
808
- value: String(options.hsl.hue)
809
- };
810
- if (options.hsl.saturation !== void 0) attrs.sat = {
811
- key: "sat",
812
- value: `${options.hsl.saturation}%`
813
- };
814
- if (options.hsl.luminance !== void 0) attrs.lum = {
815
- key: "lum",
816
- value: `${options.hsl.luminance}%`
817
- };
818
- children.push(new BuilderElement({
819
- attributes: attrs,
820
- name: "a:hsl"
821
- }));
822
- }
823
- if (options.tint) {
824
- const attrs = {};
825
- if (options.tint.hue !== void 0) attrs.hue = {
826
- key: "hue",
827
- value: String(options.tint.hue)
828
- };
829
- if (options.tint.amount !== void 0) attrs.amt = {
830
- key: "amt",
831
- value: `${options.tint.amount}%`
832
- };
833
- children.push(new BuilderElement({
834
- attributes: attrs,
835
- name: "a:tint"
836
- }));
837
- }
838
- if (options.duotone) children.push(new BuilderElement({
839
- children: [createColorElement(options.duotone.color1), createColorElement(options.duotone.color2)],
840
- name: "a:duotone"
841
- }));
842
- if (options.biLevel) children.push(new BuilderElement({
843
- attributes: { thresh: {
844
- key: "thresh",
845
- value: `${options.biLevel.threshold}%`
846
- } },
847
- name: "a:biLevel"
848
- }));
849
- if (options.alphaCeiling) children.push(new BuilderElement({ name: "a:alphaCeiling" }));
850
- if (options.alphaFloor) children.push(new BuilderElement({ name: "a:alphaFloor" }));
851
- if (options.alphaInverse !== void 0) if (typeof options.alphaInverse === "boolean") children.push(new BuilderElement({ name: "a:alphaInv" }));
852
- else children.push(new BuilderElement({
853
- children: [createColorElement(options.alphaInverse)],
854
- name: "a:alphaInv"
855
- }));
856
- if (options.alphaModFix) {
857
- const amt = options.alphaModFix.amount ?? 100;
858
- children.push(new BuilderElement({
859
- attributes: { amt: {
860
- key: "amt",
861
- value: `${amt}%`
862
- } },
863
- name: "a:alphaModFix"
864
- }));
865
- }
866
- if (options.alphaRepl) children.push(new BuilderElement({
867
- attributes: { a: {
868
- key: "a",
869
- value: `${options.alphaRepl.amount}%`
870
- } },
871
- name: "a:alphaRepl"
872
- }));
873
- if (options.alphaBiLevel) children.push(new BuilderElement({
874
- attributes: { thresh: {
875
- key: "thresh",
876
- value: `${options.alphaBiLevel.threshold}%`
877
- } },
878
- name: "a:alphaBiLevel"
879
- }));
880
- if (options.colorChange) {
881
- const attrs = {};
882
- if (options.colorChange.useAlpha === false) attrs.useA = {
883
- key: "useA",
884
- value: "0"
885
- };
886
- children.push(new BuilderElement({
887
- attributes: attrs,
888
- children: [new BuilderElement({
889
- children: [createColorElement(options.colorChange.from)],
890
- name: "a:clrFrom"
891
- }), new BuilderElement({
892
- children: [createColorElement(options.colorChange.to)],
893
- name: "a:clrTo"
894
- })],
895
- name: "a:clrChange"
896
- }));
897
- }
898
- if (options.colorRepl) children.push(new BuilderElement({
899
- children: [createColorElement(options.colorRepl.color)],
900
- name: "a:clrRepl"
901
- }));
902
- if (options.blur) {
903
- const attrs = {};
904
- if (options.blur.radius !== void 0) attrs.rad = {
905
- key: "rad",
906
- value: options.blur.radius
907
- };
908
- if (options.blur.grow === false) attrs.grow = {
909
- key: "grow",
910
- value: 0
911
- };
912
- children.push(new BuilderElement({
913
- attributes: attrs,
914
- name: "a:blur"
915
- }));
916
- }
917
- return children;
918
- };
919
- //#endregion
920
- //#region src/drawingml/blip/source-rectangle.ts
921
- /**
922
- * Source rectangle module for blip fills.
923
- *
924
- * This module defines the portion of an image to use when filling a shape.
925
- *
926
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_RelativeRect
927
- *
928
- * @module
929
- */
930
- /**
931
- * Creates a source rectangle element for blip fill cropping.
932
- *
933
- * This element specifies a portion of the blip (image) to use as the fill.
934
- * When no options are provided, the entire blip is used.
935
- *
936
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_RelativeRect
937
- *
938
- * ## XSD Schema
939
- * ```xml
940
- * <xsd:complexType name="CT_RelativeRect">
941
- * <xsd:attribute name="l" type="ST_Percentage" use="optional" default="0"/>
942
- * <xsd:attribute name="t" type="ST_Percentage" use="optional" default="0"/>
943
- * <xsd:attribute name="r" type="ST_Percentage" use="optional" default="0"/>
944
- * <xsd:attribute name="b" type="ST_Percentage" use="optional" default="0"/>
945
- * </xsd:complexType>
946
- * ```
947
- *
948
- * @example
949
- * ```typescript
950
- * // Crop 10% from left and right
951
- * createSourceRectangle({ left: 10000, right: 10000 });
952
- * ```
953
- */
954
- const createSourceRectangle = (options) => {
955
- if (!options) return new BuilderElement({ name: "a:srcRect" });
956
- const attributes = {};
957
- if (options.left !== void 0) attributes.l = {
958
- key: "l",
959
- value: options.left
960
- };
961
- if (options.top !== void 0) attributes.t = {
962
- key: "t",
963
- value: options.top
964
- };
965
- if (options.right !== void 0) attributes.r = {
966
- key: "r",
967
- value: options.right
968
- };
969
- if (options.bottom !== void 0) attributes.b = {
970
- key: "b",
971
- value: options.bottom
972
- };
973
- return new BuilderElement({
974
- attributes,
975
- name: "a:srcRect"
976
- });
977
- };
978
- //#endregion
979
- //#region src/drawingml/blip/stretch.ts
980
- /**
981
- * Stretch fill module for blip fills.
982
- *
983
- * This module defines how images are stretched to fill shapes.
984
- *
985
- * Reference: http://officeopenxml.com/drwPic.php
986
- *
987
- * @module
988
- */
989
- /**
990
- * Represents a fill rectangle for stretch fill mode.
991
- *
992
- * This element specifies the rectangular area of the shape to which
993
- * the blip fill should be stretched.
994
- *
995
- * Reference: http://officeopenxml.com/drwPic.php
996
- *
997
- * ## XSD Schema
998
- * ```xml
999
- * <xsd:complexType name="CT_RelativeRect">
1000
- * <xsd:attribute name="l" type="ST_Percentage" use="optional" default="0"/>
1001
- * <xsd:attribute name="t" type="ST_Percentage" use="optional" default="0"/>
1002
- * <xsd:attribute name="r" type="ST_Percentage" use="optional" default="0"/>
1003
- * <xsd:attribute name="b" type="ST_Percentage" use="optional" default="0"/>
1004
- * </xsd:complexType>
1005
- * ```
1006
- */
1007
- var FillRectangle = class extends XmlComponent {
1008
- constructor() {
1009
- super("a:fillRect");
1010
- }
1011
- };
1012
- /**
1013
- * Represents a stretch fill mode for blip fills.
1014
- *
1015
- * This element specifies that the blip (image) should be stretched to fill
1016
- * the entire shape. The stretch fill is one of the fill mode properties
1017
- * that determines how an image is applied to a shape.
1018
- *
1019
- * Reference: http://officeopenxml.com/drwPic.php
1020
- *
1021
- * ## XSD Schema
1022
- * ```xml
1023
- * <xsd:complexType name="CT_StretchInfoProperties">
1024
- * <xsd:sequence>
1025
- * <xsd:element name="fillRect" type="CT_RelativeRect" minOccurs="0" maxOccurs="1"/>
1026
- * </xsd:sequence>
1027
- * </xsd:complexType>
1028
- * ```
1029
- *
1030
- * @example
1031
- * ```typescript
1032
- * const stretch = new Stretch();
1033
- * ```
1034
- */
1035
- var Stretch = class extends XmlComponent {
1036
- constructor() {
1037
- super("a:stretch");
1038
- this.root.push(new FillRectangle());
1039
- }
1040
- };
1041
- //#endregion
1042
- //#region src/drawingml/blip/tile.ts
1043
- /**
1044
- * Tile fill module for blip fills.
1045
- *
1046
- * This module defines how images are tiled (repeated) to fill shapes.
1047
- *
1048
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_TileInfoProperties
1049
- *
1050
- * @module
1051
- */
1052
- /**
1053
- * Tile flip mode for tiling images.
1054
- *
1055
- * Specifies whether the image is flipped along the x-axis, y-axis,
1056
- * both axes, or not at all when tiling.
1057
- */
1058
- const TileFlipMode$1 = {
1059
- NONE: "none",
1060
- X: "x",
1061
- Y: "y",
1062
- XY: "xy"
1063
- };
1064
- /**
1065
- * Tile alignment within the shape.
1066
- *
1067
- * Specifies the anchor position of the first tile relative to the shape.
1068
- */
1069
- const TileAlignment = {
1070
- TOP_LEFT: "tl",
1071
- TOP: "t",
1072
- TOP_RIGHT: "tr",
1073
- LEFT: "l",
1074
- CENTER: "ctr",
1075
- RIGHT: "r",
1076
- BOTTOM_LEFT: "bl",
1077
- BOTTOM: "b",
1078
- BOTTOM_RIGHT: "br"
1079
- };
1080
- /**
1081
- * Creates a tile fill mode element for blip fills.
1082
- *
1083
- * When a blip fill uses tile mode, the image is repeated (tiled) to fill
1084
- * the shape instead of being stretched. This element controls the tiling
1085
- * parameters such as offset, scale, flip, and alignment.
1086
- *
1087
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_TileInfoProperties
1088
- *
1089
- * ## XSD Schema
1090
- * ```xml
1091
- * <xsd:complexType name="CT_TileInfoProperties">
1092
- * <xsd:attribute name="tx" type="ST_Coordinate" use="optional"/>
1093
- * <xsd:attribute name="ty" type="ST_Coordinate" use="optional"/>
1094
- * <xsd:attribute name="sx" type="ST_Percentage" use="optional"/>
1095
- * <xsd:attribute name="sy" type="ST_Percentage" use="optional"/>
1096
- * <xsd:attribute name="flip" type="ST_TileFlipMode" default="none"/>
1097
- * <xsd:attribute name="algn" type="ST_RectAlignment" use="optional"/>
1098
- * </xsd:complexType>
1099
- * ```
1100
- *
1101
- * @example
1102
- * ```typescript
1103
- * // Tile with 50% scale
1104
- * createTileInfo({ sx: 50, sy: 50 });
1105
- * // Tile with flip and alignment
1106
- * createTileInfo({ flip: "XY", align: "CENTER" });
1107
- * ```
1108
- */
1109
- const createTileInfo = (options) => {
1110
- if (!options) return new BuilderElement({ name: "a:tile" });
1111
- const attributes = {};
1112
- if (options.tx !== void 0) attributes.tx = {
1113
- key: "tx",
1114
- value: options.tx
1115
- };
1116
- if (options.ty !== void 0) attributes.ty = {
1117
- key: "ty",
1118
- value: options.ty
1119
- };
1120
- if (options.sx !== void 0) attributes.sx = {
1121
- key: "sx",
1122
- value: options.sx
1123
- };
1124
- if (options.sy !== void 0) attributes.sy = {
1125
- key: "sy",
1126
- value: options.sy
1127
- };
1128
- if (options.flip !== void 0) attributes.flip = {
1129
- key: "flip",
1130
- value: TileFlipMode$1[options.flip]
1131
- };
1132
- if (options.align !== void 0) attributes.algn = {
1133
- key: "algn",
1134
- value: TileAlignment[options.align]
1135
- };
1136
- return new BuilderElement({
1137
- attributes: Object.keys(attributes).length > 0 ? attributes : void 0,
1138
- name: "a:tile"
1139
- });
1140
- };
1141
- //#endregion
1142
- //#region src/drawingml/fill/gradient-fill.ts
1143
- /**
1144
- * Gradient fill element for DrawingML shapes.
1145
- *
1146
- * This module provides gradient fill support with linear and path shading.
1147
- *
1148
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_GradientFillProperties
1149
- *
1150
- * @module
1151
- */
1152
- /**
1153
- * Path shade type for radial gradients.
1154
- */
1155
- const PathShadeType = {
1156
- SHAPE: "shape",
1157
- CIRCLE: "circle",
1158
- RECT: "rect"
1159
- };
1160
- /**
1161
- * Tile flip mode for gradient fill.
1162
- *
1163
- * ## XSD Schema
1164
- * ```xml
1165
- * <xsd:simpleType name="ST_TileFlipMode">
1166
- * <xsd:restriction base="xsd:string">
1167
- * <xsd:enumeration value="none"/>
1168
- * <xsd:enumeration value="x"/>
1169
- * <xsd:enumeration value="y"/>
1170
- * <xsd:enumeration value="xy"/>
1171
- * </xsd:restriction>
1172
- * </xsd:simpleType>
1173
- * ```
1174
- */
1175
- const TileFlipMode = {
1176
- NONE: "none",
1177
- X: "x",
1178
- Y: "y",
1179
- XY: "xy"
1180
- };
1181
- /**
1182
- * Creates a gradient stop element (a:gs).
1183
- *
1184
- * @example
1185
- * ```typescript
1186
- * createGradientStop({ position: 0, color: { value: "FF0000" } });
1187
- * createGradientStop({ position: 100000, color: { value: "0000FF" } });
1188
- * ```
1189
- */
1190
- const createGradientStop = (stop) => new BuilderElement({
1191
- attributes: { pos: {
1192
- key: "pos",
1193
- value: stop.position
1194
- } },
1195
- children: [createColorElement(stop.color)],
1196
- name: "a:gs"
1197
- });
1198
- /**
1199
- * Creates a relative rect element.
1200
- */
1201
- const createRelativeRect = (name, rect) => new BuilderElement({
1202
- attributes: {
1203
- l: {
1204
- key: "l",
1205
- value: rect?.left
1206
- },
1207
- t: {
1208
- key: "t",
1209
- value: rect?.top
1210
- },
1211
- r: {
1212
- key: "r",
1213
- value: rect?.right
1214
- },
1215
- b: {
1216
- key: "b",
1217
- value: rect?.bottom
1218
- }
1219
- },
1220
- name
1221
- });
1222
- /**
1223
- * Creates the shade element (a:lin or a:path).
1224
- */
1225
- const createShadeElement = (shade) => {
1226
- if ("angle" in shade) return new BuilderElement({
1227
- attributes: {
1228
- ang: {
1229
- key: "ang",
1230
- value: shade.angle
1231
- },
1232
- scaled: {
1233
- key: "scaled",
1234
- value: shade.scaled
1235
- }
1236
- },
1237
- name: "a:lin"
1238
- });
1239
- const pathShade = shade;
1240
- const children = [];
1241
- if (pathShade.fillToRect) children.push(createRelativeRect("a:fillToRect", pathShade.fillToRect));
1242
- return new BuilderElement({
1243
- attributes: { path: {
1244
- key: "path",
1245
- value: pathShade.path ? PathShadeType[pathShade.path] : void 0
1246
- } },
1247
- children,
1248
- name: "a:path"
1249
- });
1250
- };
1251
- /**
1252
- * Creates a gradient fill element.
1253
- *
1254
- * ## XSD Schema
1255
- * ```xml
1256
- * <xsd:complexType name="CT_GradientFillProperties">
1257
- * <xsd:sequence>
1258
- * <xsd:element name="gsLst" type="CT_GradientStopList" minOccurs="0"/>
1259
- * <xsd:group ref="EG_ShadeProperties" minOccurs="0"/>
1260
- * </xsd:sequence>
1261
- * <xsd:attribute name="rotWithShape" type="xsd:boolean" use="optional"/>
1262
- * </xsd:complexType>
1263
- * ```
1264
- *
1265
- * @example
1266
- * ```typescript
1267
- * // Linear gradient from red to blue
1268
- * createGradientFill({
1269
- * stops: [
1270
- * { position: 0, color: { value: "FF0000" } },
1271
- * { position: 100000, color: { value: "0000FF" } },
1272
- * ],
1273
- * shade: { angle: 5400000 },
1274
- * });
1275
- * ```
1276
- */
1277
- const createGradientFill = (options) => {
1278
- const children = [];
1279
- children.push(new BuilderElement({
1280
- children: options.stops.map(createGradientStop),
1281
- name: "a:gsLst"
1282
- }));
1283
- if (options.shade) children.push(createShadeElement(options.shade));
1284
- if (options.tileRect) children.push(createRelativeRect("a:tileRect", options.tileRect));
1285
- return new BuilderElement({
1286
- attributes: {
1287
- flip: {
1288
- key: "flip",
1289
- value: options.flip ? TileFlipMode[options.flip] : void 0
1290
- },
1291
- rotWithShape: {
1292
- key: "rotWithShape",
1293
- value: options.rotateWithShape
1294
- }
1295
- },
1296
- children,
1297
- name: "a:gradFill"
1298
- });
1299
- };
1300
- //#endregion
1301
- //#region src/drawingml/fill/pattern-fill.ts
1302
- /**
1303
- * Pattern fill element for DrawingML shapes.
1304
- *
1305
- * This module provides pattern fill support with preset patterns and
1306
- * optional foreground/background colors.
1307
- *
1308
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_PatternFillProperties
1309
- *
1310
- * @module
1311
- */
1312
- /**
1313
- * Preset pattern values for pattern fill.
1314
- *
1315
- * ## XSD Schema
1316
- * ```xml
1317
- * <xsd:simpleType name="ST_PresetPatternVal">
1318
- * <xsd:restriction base="xsd:token">
1319
- * <xsd:enumeration value="pct5"/> ... <xsd:enumeration value="zigZag"/>
1320
- * </xsd:restriction>
1321
- * </xsd:simpleType>
1322
- * ```
1323
- *
1324
- * @publicApi
1325
- */
1326
- const PresetPattern = {
1327
- PCT5: "pct5",
1328
- PCT10: "pct10",
1329
- PCT20: "pct20",
1330
- PCT25: "pct25",
1331
- PCT30: "pct30",
1332
- PCT40: "pct40",
1333
- PCT50: "pct50",
1334
- PCT60: "pct60",
1335
- PCT70: "pct70",
1336
- PCT75: "pct75",
1337
- PCT80: "pct80",
1338
- PCT90: "pct90",
1339
- HORZ: "horz",
1340
- VERT: "vert",
1341
- LT_HORZ: "ltHorz",
1342
- LT_VERT: "ltVert",
1343
- DK_HORZ: "dkHorz",
1344
- DK_VERT: "dkVert",
1345
- NAR_HORZ: "narHorz",
1346
- NAR_VERT: "narVert",
1347
- DASH_HORZ: "dashHorz",
1348
- DASH_VERT: "dashVert",
1349
- CROSS: "cross",
1350
- DN_DIAG: "dnDiag",
1351
- UP_DIAG: "upDiag",
1352
- LT_DN_DIAG: "ltDnDiag",
1353
- LT_UP_DIAG: "ltUpDiag",
1354
- DK_DN_DIAG: "dkDnDiag",
1355
- DK_UP_DIAG: "dkUpDiag",
1356
- WD_DN_DIAG: "wdDnDiag",
1357
- WD_UP_DIAG: "wdUpDiag",
1358
- DASH_DN_DIAG: "dashDnDiag",
1359
- DASH_UP_DIAG: "dashUpDiag",
1360
- DIAG_CROSS: "diagCross",
1361
- SM_CHECK: "smCheck",
1362
- LG_CHECK: "lgCheck",
1363
- SM_GRID: "smGrid",
1364
- LG_GRID: "lgGrid",
1365
- DOT_GRID: "dotGrid",
1366
- SM_CONFETTI: "smConfetti",
1367
- LG_CONFETTI: "lgConfetti",
1368
- HORZ_BRICK: "horzBrick",
1369
- DIAG_BRICK: "diagBrick",
1370
- SOLID_DMND: "solidDmnd",
1371
- OPEN_DMND: "openDmnd",
1372
- DOT_DMND: "dotDmnd",
1373
- PLAID: "plaid",
1374
- SPHERE: "sphere",
1375
- WEAVE: "weave",
1376
- DIVOT: "divot",
1377
- SHINGLE: "shingle",
1378
- WAVE: "wave",
1379
- TRELLIS: "trellis",
1380
- ZIG_ZAG: "zigZag"
1381
- };
1382
- /**
1383
- * Creates a pattern fill element (a:pattFill).
1384
- *
1385
- * Specifies a pattern fill using preset patterns with optional
1386
- * foreground and background colors.
1387
- *
1388
- * ## XSD Schema
1389
- * ```xml
1390
- * <xsd:complexType name="CT_PatternFillProperties">
1391
- * <xsd:sequence>
1392
- * <xsd:element name="fgClr" type="CT_Color" minOccurs="0"/>
1393
- * <xsd:element name="bgClr" type="CT_Color" minOccurs="0"/>
1394
- * </xsd:sequence>
1395
- * <xsd:attribute name="prst" type="ST_PresetPatternVal" use="optional"/>
1396
- * </xsd:complexType>
1397
- * ```
1398
- *
1399
- * @example
1400
- * ```typescript
1401
- * // Simple crosshatch pattern
1402
- * createPatternFill({ pattern: PresetPattern.CROSS });
1403
- * // Pattern with foreground color
1404
- * createPatternFill({
1405
- * pattern: PresetPattern.DIAG_CROSS,
1406
- * foregroundColor: { value: "FF0000" },
1407
- * });
1408
- * // Pattern with foreground and background colors
1409
- * createPatternFill({
1410
- * pattern: PresetPattern.HORZ,
1411
- * foregroundColor: { value: "0000FF" },
1412
- * backgroundColor: { value: "FFFF00" },
1413
- * });
1414
- * ```
1415
- */
1416
- const createPatternFill = (options) => {
1417
- const children = [];
1418
- if (options.foregroundColor) children.push(new BuilderElement({
1419
- children: [createColorElement(options.foregroundColor)],
1420
- name: "a:fgClr"
1421
- }));
1422
- if (options.backgroundColor) children.push(new BuilderElement({
1423
- children: [createColorElement(options.backgroundColor)],
1424
- name: "a:bgClr"
1425
- }));
1426
- return new BuilderElement({
1427
- attributes: { prst: {
1428
- key: "prst",
1429
- value: options.pattern
1430
- } },
1431
- children,
1432
- name: "a:pattFill"
1433
- });
1434
- };
1435
- //#endregion
1436
- //#region src/drawingml/fill/fill-options.ts
1437
- function normalizeColor(color) {
1438
- return typeof color === "string" ? { value: color.replace("#", "") } : color;
1439
- }
1440
- function toUint8Array(data) {
1441
- return data instanceof Uint8Array ? data : new Uint8Array(data);
1442
- }
1443
- /**
1444
- * Extracts media data from a blip fill option, if present.
1445
- * Returns undefined for non-blip fills.
1446
- *
1447
- * The returned data should be registered with the document's media store
1448
- * during `prepForXml` so the packer can resolve the `{fileName}` placeholder.
1449
- */
1450
- const extractBlipFillMedia = (fill) => {
1451
- if (typeof fill === "string" || fill.type !== "blip") return void 0;
1452
- const raw = toUint8Array(fill.data);
1453
- return {
1454
- data: raw,
1455
- fileName: `${hashedId(raw)}.${fill.imageType}`,
1456
- type: fill.imageType
1457
- };
1458
- };
1459
- /**
1460
- * Builds a DrawingML fill XmlComponent from a FillOptions config.
1461
- */
1462
- const buildFill = (options) => {
1463
- if (typeof options === "string") return createSolidFill({ value: options.replace("#", "") });
1464
- switch (options.type) {
1465
- case "solid": return createSolidFill(normalizeColor(options.color));
1466
- case "none": return new BuilderElement({ name: "a:noFill" });
1467
- case "gradient":
1468
- if ("options" in options) return createGradientFill(options.options);
1469
- return createGradientFill({
1470
- stops: options.stops.map((stop) => ({
1471
- position: stop.position * 1e3,
1472
- color: normalizeColor(stop.color)
1473
- })),
1474
- ...!options.path && options.angle !== void 0 && { shade: {
1475
- angle: options.angle * 6e4,
1476
- scaled: options.scaled ?? true
1477
- } },
1478
- ...options.path && { shade: { path: options.path.toUpperCase() } }
1479
- });
1480
- case "blip": {
1481
- const fileName = `${hashedId(toUint8Array(options.data))}.${options.imageType}`;
1482
- const blipChildren = [];
1483
- if (options.blipEffects) blipChildren.push(...createBlipEffects(options.blipEffects));
1484
- const children = [new BuilderElement({
1485
- attributes: {
1486
- cstate: {
1487
- key: "cstate",
1488
- value: "none"
1489
- },
1490
- embed: {
1491
- key: "r:embed",
1492
- value: `{${fileName}}`
1493
- }
1494
- },
1495
- children: blipChildren,
1496
- name: "a:blip"
1497
- }), createSourceRectangle(options.srcRect)];
1498
- if (options.tile) children.push(createTileInfo(options.tile));
1499
- else children.push(new Stretch());
1500
- const attributes = {};
1501
- if (options.dpi !== void 0) attributes.dpi = {
1502
- key: "dpi",
1503
- value: options.dpi
1504
- };
1505
- if (options.rotWithShape !== void 0) attributes.rotWithShape = {
1506
- key: "rotWithShape",
1507
- value: options.rotWithShape ? 1 : 0
1508
- };
1509
- return new BuilderElement({
1510
- attributes: Object.keys(attributes).length > 0 ? attributes : void 0,
1511
- children,
1512
- name: "a:blipFill"
1513
- });
1514
- }
1515
- case "pattern": return createPatternFill({
1516
- pattern: options.pattern,
1517
- ...options.foregroundColor && { foregroundColor: normalizeColor(options.foregroundColor) },
1518
- ...options.backgroundColor && { backgroundColor: normalizeColor(options.backgroundColor) }
1519
- });
1520
- case "group": return new BuilderElement({ name: "a:grpFill" });
1521
- }
1522
- };
1523
- //#endregion
1524
- //#region src/drawingml/fill/no-fill.ts
1525
- /**
1526
- * No fill element for DrawingML shapes.
1527
- *
1528
- * This module provides the no-fill option for outline and shape fills.
1529
- *
1530
- * @module
1531
- */
1532
- /**
1533
- * Creates a no-fill element.
1534
- *
1535
- * Specifies that the outline or shape should have no fill applied.
1536
- *
1537
- * ## XSD Schema
1538
- * ```xml
1539
- * <xsd:element name="noFill" type="CT_Empty"/>
1540
- * ```
1541
- *
1542
- * @example
1543
- * ```typescript
1544
- * const noFill = createNoFill();
1545
- * ```
1546
- */
1547
- const createNoFill = () => new BuilderElement({ name: "a:noFill" });
1548
- //#endregion
1549
- //#region src/drawingml/fill/group-fill.ts
1550
- /**
1551
- * Group fill element for DrawingML shapes.
1552
- *
1553
- * This module provides group fill support which inherits the fill
1554
- * from the parent group shape.
1555
- *
1556
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_GroupFillProperties
1557
- *
1558
- * @module
1559
- */
1560
- /**
1561
- * Creates a group fill element (a:grpFill).
1562
- *
1563
- * This element specifies that the shape should inherit its fill
1564
- * from the parent group shape. This is useful when shapes are
1565
- * grouped together and should share the same fill.
1566
- *
1567
- * ## XSD Schema
1568
- * ```xml
1569
- * <xsd:complexType name="CT_GroupFillProperties"/>
1570
- * ```
1571
- *
1572
- * @example
1573
- * ```typescript
1574
- * // Shape inherits fill from parent group
1575
- * createGroupFill();
1576
- * ```
1577
- */
1578
- const createGroupFill = () => new BuilderElement({ name: "a:grpFill" });
1579
- //#endregion
1580
- //#region src/drawingml/outline/custom-dash.ts
1581
- /**
1582
- * Custom dash pattern for DrawingML outlines.
1583
- *
1584
- * This module provides support for custom dash patterns defined by
1585
- * a list of dash stops, each specifying dash and space lengths as
1586
- * percentages relative to line width.
1587
- *
1588
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_DashStopList, CT_DashStop
1589
- *
1590
- * @module
1591
- */
1592
- /**
1593
- * Creates a custom dash element (a:custDash) for outlines.
1594
- *
1595
- * The custom dash element specifies a repeating pattern of dash and space
1596
- * segments. Each segment is defined by a `DashStop` with dash (`d`) and
1597
- * space (`sp`) lengths as positive percentages of the line width.
1598
- *
1599
- * ## XSD Schema
1600
- * ```xml
1601
- * <xsd:complexType name="CT_DashStopList">
1602
- * <xsd:sequence>
1603
- * <xsd:element name="ds" type="CT_DashStop" minOccurs="0" maxOccurs="unbounded"/>
1604
- * </xsd:sequence>
1605
- * </xsd:complexType>
1606
- * ```
1607
- *
1608
- * @example
1609
- * ```typescript
1610
- * // Simple dash pattern
1611
- * createCustomDash([
1612
- * { d: "500%", sp: "200%" },
1613
- * ]);
1614
- *
1615
- * // Complex alternating pattern
1616
- * createCustomDash([
1617
- * { d: "500%", sp: "200%" },
1618
- * { d: "100%", sp: "200%" },
1619
- * ]);
1620
- * ```
1621
- */
1622
- const createCustomDash = (stops) => {
1623
- const children = [];
1624
- for (const stop of stops) children.push(new BuilderElement({
1625
- attributes: {
1626
- d: {
1627
- key: "d",
1628
- value: stop.d
1629
- },
1630
- sp: {
1631
- key: "sp",
1632
- value: stop.sp
1633
- }
1634
- },
1635
- name: "a:ds"
1636
- }));
1637
- return new BuilderElement({
1638
- children,
1639
- name: "a:custDash"
1640
- });
1641
- };
1642
- //#endregion
1643
- //#region src/drawingml/outline/line-end.ts
1644
- /**
1645
- * Line end (arrow) properties for DrawingML outlines.
1646
- *
1647
- * This module provides support for line end markers (arrows) on shape outlines.
1648
- *
1649
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_LineEndProperties
1650
- *
1651
- * @module
1652
- */
1653
- /**
1654
- * Line end types (arrow head styles).
1655
- *
1656
- * ## XSD Schema
1657
- * ```xml
1658
- * <xsd:simpleType name="ST_LineEndType">
1659
- * <xsd:restriction base="xsd:token">
1660
- * <xsd:enumeration value="none"/>
1661
- * <xsd:enumeration value="triangle"/>
1662
- * <xsd:enumeration value="stealth"/>
1663
- * <xsd:enumeration value="diamond"/>
1664
- * <xsd:enumeration value="oval"/>
1665
- * <xsd:enumeration value="arrow"/>
1666
- * </xsd:restriction>
1667
- * </xsd:simpleType>
1668
- * ```
1669
- *
1670
- * @publicApi
1671
- */
1672
- const LineEndType = {
1673
- NONE: "none",
1674
- TRIANGLE: "triangle",
1675
- STEALTH: "stealth",
1676
- DIAMOND: "diamond",
1677
- OVAL: "oval",
1678
- ARROW: "arrow"
1679
- };
1680
- /**
1681
- * Line end width options.
1682
- *
1683
- * ## XSD Schema
1684
- * ```xml
1685
- * <xsd:simpleType name="ST_LineEndWidth">
1686
- * <xsd:restriction base="xsd:token">
1687
- * <xsd:enumeration value="sm"/>
1688
- * <xsd:enumeration value="med"/>
1689
- * <xsd:enumeration value="lg"/>
1690
- * </xsd:restriction>
1691
- * </xsd:simpleType>
1692
- * ```
1693
- *
1694
- * @publicApi
1695
- */
1696
- const LineEndWidth = {
1697
- SMALL: "sm",
1698
- MEDIUM: "med",
1699
- LARGE: "lg"
1700
- };
1701
- /**
1702
- * Line end length options.
1703
- *
1704
- * ## XSD Schema
1705
- * ```xml
1706
- * <xsd:simpleType name="ST_LineEndLength">
1707
- * <xsd:restriction base="xsd:token">
1708
- * <xsd:enumeration value="sm"/>
1709
- * <xsd:enumeration value="med"/>
1710
- * <xsd:enumeration value="lg"/>
1711
- * </xsd:restriction>
1712
- * </xsd:simpleType>
1713
- * ```
1714
- *
1715
- * @publicApi
1716
- */
1717
- const LineEndLength = {
1718
- SMALL: "sm",
1719
- MEDIUM: "med",
1720
- LARGE: "lg"
1721
- };
1722
- /**
1723
- * Creates a line end element (a:headEnd or a:tailEnd).
1724
- *
1725
- * @example
1726
- * ```typescript
1727
- * // Stealth arrow at start, medium size
1728
- * createLineEnd("a:headEnd", { type: "STEALTH", width: "MEDIUM", length: "MEDIUM" });
1729
- * // Triangle arrow at end
1730
- * createLineEnd("a:tailEnd", { type: "TRIANGLE" });
1731
- * ```
1732
- */
1733
- const createLineEnd = (name, options) => new BuilderElement({
1734
- attributes: {
1735
- type: {
1736
- key: "type",
1737
- value: LineEndType[options.type]
1738
- },
1739
- w: {
1740
- key: "w",
1741
- value: options.width ? LineEndWidth[options.width] : void 0
1742
- },
1743
- len: {
1744
- key: "len",
1745
- value: options.length ? LineEndLength[options.length] : void 0
1746
- }
1747
- },
1748
- name
1749
- });
1750
- //#endregion
1751
- //#region src/drawingml/outline/outline.ts
1752
- /**
1753
- * Outline (line) properties for DrawingML shapes.
1754
- *
1755
- * This module provides support for configuring outline properties including
1756
- * width, cap style, compound line types, fill properties, dash, and join.
1757
- *
1758
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_LineProperties
1759
- *
1760
- * @module
1761
- */
1762
- /**
1763
- * Line cap styles for outline endpoints.
1764
- *
1765
- * Defines how the ends of a line are rendered.
1766
- */
1767
- const LineCap = {
1768
- ROUND: "rnd",
1769
- SQUARE: "sq",
1770
- FLAT: "flat"
1771
- };
1772
- /**
1773
- * Compound line types for outlines.
1774
- *
1775
- * Defines the structure of compound lines (single, double, etc.).
1776
- */
1777
- const CompoundLine = {
1778
- SINGLE: "sng",
1779
- DOUBLE: "dbl",
1780
- THICK_THIN: "thickThin",
1781
- THIN_THICK: "thinThick",
1782
- TRI: "tri"
1783
- };
1784
- /**
1785
- * Pen alignment options for outline positioning.
1786
- *
1787
- * Defines how the outline is aligned relative to the shape edge.
1788
- */
1789
- const PenAlignment = {
1790
- CENTER: "ctr",
1791
- INSET: "in"
1792
- };
1793
- /**
1794
- * Preset dash styles for outlines.
1795
- *
1796
- * ## XSD Schema
1797
- * ```xml
1798
- * <xsd:simpleType name="ST_PresetLineDashVal">
1799
- * <xsd:restriction base="xsd:token">
1800
- * <xsd:enumeration value="solid"/>
1801
- * <xsd:enumeration value="dot"/>
1802
- * <xsd:enumeration value="dash"/>
1803
- * <xsd:enumeration value="lgDash"/>
1804
- * <xsd:enumeration value="dashDot"/>
1805
- * <xsd:enumeration value="lgDashDot"/>
1806
- * <xsd:enumeration value="lgDashDotDot"/>
1807
- * <xsd:enumeration value="sysDash"/>
1808
- * <xsd:enumeration value="sysDot"/>
1809
- * <xsd:enumeration value="sysDashDot"/>
1810
- * <xsd:enumeration value="sysDashDotDot"/>
1811
- * </xsd:restriction>
1812
- * </xsd:simpleType>
1813
- * ```
1814
- */
1815
- const PresetDash = {
1816
- SOLID: "solid",
1817
- DOT: "dot",
1818
- DASH: "dash",
1819
- LG_DASH: "lgDash",
1820
- DASH_DOT: "dashDot",
1821
- LG_DASH_DOT: "lgDashDot",
1822
- LG_DASH_DOT_DOT: "lgDashDotDot",
1823
- SYS_DASH: "sysDash",
1824
- SYS_DOT: "sysDot",
1825
- SYS_DASH_DOT: "sysDashDot",
1826
- SYS_DASH_DOT_DOT: "sysDashDotDot"
1827
- };
1828
- /**
1829
- * Line join styles.
1830
- */
1831
- const LineJoin = {
1832
- ROUND: "round",
1833
- BEVEL: "bevel",
1834
- MITER: "miter"
1835
- };
1836
- /**
1837
- * Creates the fill child element for an outline.
1838
- *
1839
- * Returns null when no fill type is specified (OOXML allows outline without fill).
1840
- */
1841
- const createOutlineFill = (options) => {
1842
- if (options.type === "noFill") return createNoFill();
1843
- if (options.type === "solidFill" && options.color) return createSolidFill(options.color);
1844
- if (options.type === "gradFill" && options.gradientFill) return createGradientFill(options.gradientFill);
1845
- if (options.type === "pattFill" && options.patternFill) return createPatternFill(options.patternFill);
1846
- return null;
1847
- };
1848
- /**
1849
- * Creates an outline element for DrawingML shapes.
1850
- *
1851
- * The outline element specifies the line properties for the shape border,
1852
- * including width, cap style, compound line type, alignment, dash, join, and fill.
1853
- *
1854
- * ## XSD Schema
1855
- * ```xml
1856
- * <xsd:complexType name="CT_LineProperties">
1857
- * <xsd:sequence>
1858
- * <xsd:group ref="EG_FillProperties" minOccurs="0"/>
1859
- * <xsd:group ref="EG_LineDashProperties" minOccurs="0"/>
1860
- * <xsd:group ref="EG_LineJoinProperties" minOccurs="0"/>
1861
- * </xsd:sequence>
1862
- * <xsd:attribute name="w" use="optional" type="a:ST_LineWidth"/>
1863
- * <xsd:attribute name="cap" use="optional" type="ST_LineCap"/>
1864
- * <xsd:attribute name="cmpd" use="optional" type="ST_CompoundLine"/>
1865
- * <xsd:attribute name="algn" use="optional" type="ST_PenAlignment"/>
1866
- * </xsd:complexType>
1867
- * ```
1868
- *
1869
- * @example
1870
- * ```typescript
1871
- * // Outline with RGB color and dash
1872
- * const outline = createOutline({
1873
- * width: 9525,
1874
- * type: "solidFill",
1875
- * color: { value: "FF0000" },
1876
- * dash: "DASH",
1877
- * });
1878
- * ```
1879
- */
1880
- const createOutline = (options) => {
1881
- const children = [];
1882
- const fill = createOutlineFill(options);
1883
- if (fill) children.push(fill);
1884
- if (options.customDash !== void 0) children.push(createCustomDash(options.customDash));
1885
- else if (options.dash !== void 0) children.push(new BuilderElement({
1886
- attributes: { val: {
1887
- key: "val",
1888
- value: PresetDash[options.dash]
1889
- } },
1890
- name: "a:prstDash"
1891
- }));
1892
- if (options.join !== void 0) if (options.join === "MITER" && options.miterLimit !== void 0) children.push(new BuilderElement({
1893
- attributes: { lim: {
1894
- key: "lim",
1895
- value: options.miterLimit
1896
- } },
1897
- name: "a:miter"
1898
- }));
1899
- else children.push(new BuilderElement({ name: `a:${LineJoin[options.join]}` }));
1900
- if (options.headEnd) children.push(createLineEnd("a:headEnd", options.headEnd));
1901
- if (options.tailEnd) children.push(createLineEnd("a:tailEnd", options.tailEnd));
1902
- return new BuilderElement({
1903
- attributes: {
1904
- align: {
1905
- key: "algn",
1906
- value: options.align ? PenAlignment[options.align] : void 0
1907
- },
1908
- cap: {
1909
- key: "cap",
1910
- value: options.cap ? LineCap[options.cap] : void 0
1911
- },
1912
- compoundLine: {
1913
- key: "cmpd",
1914
- value: options.compoundLine ? CompoundLine[options.compoundLine] : void 0
1915
- },
1916
- width: {
1917
- key: "w",
1918
- value: options.width
1919
- }
1920
- },
1921
- children,
1922
- name: "a:ln"
1923
- });
1924
- };
1925
- //#endregion
1926
- //#region src/drawingml/effects/fill-overlay.ts
1927
- /**
1928
- * Fill overlay effect for DrawingML shapes.
1929
- *
1930
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_FillOverlayEffect
1931
- *
1932
- * @module
1933
- */
1934
- /**
1935
- * Blend modes for fill overlay effect.
1936
- *
1937
- * ## XSD Schema
1938
- * ```xml
1939
- * <xsd:simpleType name="ST_BlendMode">
1940
- * <xsd:restriction base="xsd:token">
1941
- * <xsd:enumeration value="over"/>
1942
- * <xsd:enumeration value="mult"/>
1943
- * <xsd:enumeration value="screen"/>
1944
- * <xsd:enumeration value="darken"/>
1945
- * <xsd:enumeration value="lighten"/>
1946
- * </xsd:restriction>
1947
- * </xsd:simpleType>
1948
- * ```
1949
- */
1950
- const BlendMode = {
1951
- OVER: "over",
1952
- MULTIPLY: "mult",
1953
- SCREEN: "screen",
1954
- DARKEN: "darken",
1955
- LIGHTEN: "lighten"
1956
- };
1957
- /**
1958
- * Creates a fill overlay effect element.
1959
- *
1960
- * ## XSD Schema
1961
- * ```xml
1962
- * <xsd:complexType name="CT_FillOverlayEffect">
1963
- * <xsd:sequence>
1964
- * <xsd:group ref="EG_FillProperties" minOccurs="1" maxOccurs="1"/>
1965
- * </xsd:sequence>
1966
- * <xsd:attribute name="blend" type="ST_BlendMode" use="required"/>
1967
- * </xsd:complexType>
1968
- * ```
1969
- *
1970
- * @example
1971
- * ```typescript
1972
- * // Solid fill overlay
1973
- * const fillOverlay = createFillOverlayEffect({
1974
- * blend: BlendMode.MULTIPLY,
1975
- * solidFill: { value: "FF0000" },
1976
- * });
1977
- *
1978
- * // Gradient fill overlay
1979
- * const fillOverlay = createFillOverlayEffect({
1980
- * blend: BlendMode.SCREEN,
1981
- * gradientFill: { type: "linear", stops: [...] },
1982
- * });
1983
- * ```
1984
- */
1985
- const createFillOverlayEffect = (options) => {
1986
- let fillElement;
1987
- if (options.noFill) fillElement = createNoFill();
1988
- else if (options.solidFill) fillElement = createSolidFill(options.solidFill);
1989
- else if (options.gradientFill) fillElement = createGradientFill(options.gradientFill);
1990
- else if (options.patternFill) fillElement = createPatternFill(options.patternFill);
1991
- else if (options.groupFill) fillElement = createGroupFill();
1992
- else fillElement = createSolidFill({ value: "000000" });
1993
- return new BuilderElement({
1994
- attributes: { blend: {
1995
- key: "blend",
1996
- value: options.blend
1997
- } },
1998
- children: [fillElement],
1999
- name: "a:fillOverlay"
2000
- });
2001
- };
2002
- //#endregion
2003
- //#region src/drawingml/effects/glow.ts
2004
- /**
2005
- * Glow effect for DrawingML shapes.
2006
- *
2007
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_GlowEffect
2008
- *
2009
- * @module
2010
- */
2011
- /**
2012
- * Creates a glow effect element.
2013
- *
2014
- * ## XSD Schema
2015
- * ```xml
2016
- * <xsd:complexType name="CT_GlowEffect">
2017
- * <xsd:sequence>
2018
- * <xsd:group ref="EG_ColorChoice" minOccurs="1" maxOccurs="1"/>
2019
- * </xsd:sequence>
2020
- * <xsd:attribute name="rad" type="ST_PositiveCoordinate" use="optional" default="0"/>
2021
- * </xsd:complexType>
2022
- * ```
2023
- */
2024
- const createGlowEffect = (options) => {
2025
- if (options.radius === void 0) return new BuilderElement({
2026
- children: [createColorElement(options.color)],
2027
- name: "a:glow"
2028
- });
2029
- return new BuilderElement({
2030
- attributes: { rad: {
2031
- key: "rad",
2032
- value: options.radius
2033
- } },
2034
- children: [createColorElement(options.color)],
2035
- name: "a:glow"
2036
- });
2037
- };
2038
- //#endregion
2039
- //#region src/drawingml/effects/inner-shadow.ts
2040
- /**
2041
- * Inner shadow effect for DrawingML shapes.
2042
- *
2043
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_InnerShadowEffect
2044
- *
2045
- * @module
2046
- */
2047
- /**
2048
- * Creates an inner shadow effect element.
2049
- *
2050
- * ## XSD Schema
2051
- * ```xml
2052
- * <xsd:complexType name="CT_InnerShadowEffect">
2053
- * <xsd:sequence>
2054
- * <xsd:group ref="EG_ColorChoice" minOccurs="1" maxOccurs="1"/>
2055
- * </xsd:sequence>
2056
- * <xsd:attribute name="blurRad" type="ST_PositiveCoordinate" default="0"/>
2057
- * <xsd:attribute name="dist" type="ST_PositiveCoordinate" default="0"/>
2058
- * <xsd:attribute name="dir" type="ST_PositiveFixedAngle" default="0"/>
2059
- * </xsd:complexType>
2060
- * ```
2061
- */
2062
- const createInnerShadowEffect = (options) => {
2063
- if (!(options.blurRadius !== void 0 || options.distance !== void 0 || options.direction !== void 0)) return new BuilderElement({
2064
- children: [createColorElement(options.color)],
2065
- name: "a:innerShdw"
2066
- });
2067
- return new BuilderElement({
2068
- attributes: {
2069
- ...options.blurRadius !== void 0 && { blurRad: {
2070
- key: "blurRad",
2071
- value: options.blurRadius
2072
- } },
2073
- ...options.distance !== void 0 && { dist: {
2074
- key: "dist",
2075
- value: options.distance
2076
- } },
2077
- ...options.direction !== void 0 && { dir: {
2078
- key: "dir",
2079
- value: options.direction
2080
- } }
2081
- },
2082
- children: [createColorElement(options.color)],
2083
- name: "a:innerShdw"
2084
- });
2085
- };
2086
- //#endregion
2087
- //#region src/drawingml/effects/outer-shadow.ts
2088
- /**
2089
- * Outer shadow effect for DrawingML shapes.
2090
- *
2091
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_OuterShadowEffect
2092
- *
2093
- * @module
2094
- */
2095
- /**
2096
- * Rectangle alignment for shadow positioning.
2097
- */
2098
- const RectAlignment = {
2099
- TOP_LEFT: "tl",
2100
- TOP: "t",
2101
- TOP_RIGHT: "tr",
2102
- LEFT: "l",
2103
- CENTER: "ctr",
2104
- RIGHT: "r",
2105
- BOTTOM_LEFT: "bl",
2106
- BOTTOM: "b",
2107
- BOTTOM_RIGHT: "br"
2108
- };
2109
- /**
2110
- * Creates an outer shadow effect element.
2111
- *
2112
- * ## XSD Schema
2113
- * ```xml
2114
- * <xsd:complexType name="CT_OuterShadowEffect">
2115
- * <xsd:sequence>
2116
- * <xsd:group ref="EG_ColorChoice" minOccurs="1" maxOccurs="1"/>
2117
- * </xsd:sequence>
2118
- * <xsd:attribute name="blurRad" type="ST_PositiveCoordinate" default="0"/>
2119
- * <xsd:attribute name="dist" type="ST_PositiveCoordinate" default="0"/>
2120
- * <xsd:attribute name="dir" type="ST_PositiveFixedAngle" default="0"/>
2121
- * <xsd:attribute name="sx" type="ST_Percentage" default="100%"/>
2122
- * <xsd:attribute name="sy" type="ST_Percentage" default="100%"/>
2123
- * <xsd:attribute name="kx" type="ST_FixedAngle" default="0"/>
2124
- * <xsd:attribute name="ky" type="ST_FixedAngle" default="0"/>
2125
- * <xsd:attribute name="algn" type="ST_RectAlignment" default="b"/>
2126
- * <xsd:attribute name="rotWithShape" type="xsd:boolean" default="true"/>
2127
- * </xsd:complexType>
2128
- * ```
2129
- */
2130
- const createOuterShadowEffect = (options) => {
2131
- const attributes = {};
2132
- if (options.blurRadius !== void 0) attributes.blurRad = {
2133
- key: "blurRad",
2134
- value: options.blurRadius
2135
- };
2136
- if (options.distance !== void 0) attributes.dist = {
2137
- key: "dist",
2138
- value: options.distance
2139
- };
2140
- if (options.direction !== void 0) attributes.dir = {
2141
- key: "dir",
2142
- value: options.direction
2143
- };
2144
- if (options.scaleX !== void 0) attributes.sx = {
2145
- key: "sx",
2146
- value: options.scaleX
2147
- };
2148
- if (options.scaleY !== void 0) attributes.sy = {
2149
- key: "sy",
2150
- value: options.scaleY
2151
- };
2152
- if (options.skewX !== void 0) attributes.kx = {
2153
- key: "kx",
2154
- value: options.skewX
2155
- };
2156
- if (options.skewY !== void 0) attributes.ky = {
2157
- key: "ky",
2158
- value: options.skewY
2159
- };
2160
- if (options.alignment !== void 0) attributes.algn = {
2161
- key: "algn",
2162
- value: RectAlignment[options.alignment]
2163
- };
2164
- if (options.rotWithShape === false) attributes.rotWithShape = {
2165
- key: "rotWithShape",
2166
- value: 0
2167
- };
2168
- return new BuilderElement({
2169
- attributes,
2170
- children: [createColorElement(options.color)],
2171
- name: "a:outerShdw"
2172
- });
2173
- };
2174
- //#endregion
2175
- //#region src/drawingml/effects/preset-shadow.ts
2176
- /**
2177
- * Preset shadow effect for DrawingML shapes.
2178
- *
2179
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_PresetShadowEffect
2180
- *
2181
- * @module
2182
- */
2183
- /**
2184
- * Preset shadow types (20 variations).
2185
- *
2186
- * Reference: ISO/IEC 29500-4, dml-main.xsd, ST_PresetShadowVal
2187
- */
2188
- const PresetShadowVal = {
2189
- SHDW1: "shdw1",
2190
- SHDW2: "shdw2",
2191
- SHDW3: "shdw3",
2192
- SHDW4: "shdw4",
2193
- SHDW5: "shdw5",
2194
- SHDW6: "shdw6",
2195
- SHDW7: "shdw7",
2196
- SHDW8: "shdw8",
2197
- SHDW9: "shdw9",
2198
- SHDW10: "shdw10",
2199
- SHDW11: "shdw11",
2200
- SHDW12: "shdw12",
2201
- SHDW13: "shdw13",
2202
- SHDW14: "shdw14",
2203
- SHDW15: "shdw15",
2204
- SHDW16: "shdw16",
2205
- SHDW17: "shdw17",
2206
- SHDW18: "shdw18",
2207
- SHDW19: "shdw19",
2208
- SHDW20: "shdw20"
2209
- };
2210
- /**
2211
- * Creates a preset shadow effect element.
2212
- *
2213
- * ## XSD Schema
2214
- * ```xml
2215
- * <xsd:complexType name="CT_PresetShadowEffect">
2216
- * <xsd:sequence>
2217
- * <xsd:group ref="EG_ColorChoice" minOccurs="1" maxOccurs="1"/>
2218
- * </xsd:sequence>
2219
- * <xsd:attribute name="prst" type="ST_PresetShadowVal" use="required"/>
2220
- * <xsd:attribute name="dist" type="ST_PositiveCoordinate" default="0"/>
2221
- * <xsd:attribute name="dir" type="ST_PositiveFixedAngle" default="0"/>
2222
- * </xsd:complexType>
2223
- * ```
2224
- */
2225
- const createPresetShadowEffect = (options) => {
2226
- const attributes = { prst: {
2227
- key: "prst",
2228
- value: PresetShadowVal[options.preset]
2229
- } };
2230
- if (options.distance !== void 0) attributes.dist = {
2231
- key: "dist",
2232
- value: options.distance
2233
- };
2234
- if (options.direction !== void 0) attributes.dir = {
2235
- key: "dir",
2236
- value: options.direction
2237
- };
2238
- return new BuilderElement({
2239
- attributes,
2240
- children: [createColorElement(options.color)],
2241
- name: "a:prstShdw"
2242
- });
2243
- };
2244
- //#endregion
2245
- //#region src/drawingml/effects/reflection.ts
2246
- /**
2247
- * Reflection effect for DrawingML shapes.
2248
- *
2249
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_ReflectionEffect
2250
- *
2251
- * @module
2252
- */
2253
- /**
2254
- * Creates a reflection effect element.
2255
- *
2256
- * ## XSD Schema
2257
- * ```xml
2258
- * <xsd:complexType name="CT_ReflectionEffect">
2259
- * <xsd:attribute name="blurRad" type="ST_PositiveCoordinate" default="0"/>
2260
- * <xsd:attribute name="stA" type="ST_PositiveFixedPercentage" default="100%"/>
2261
- * <xsd:attribute name="stPos" type="ST_PositiveFixedPercentage" default="0%"/>
2262
- * <xsd:attribute name="endA" type="ST_PositiveFixedPercentage" default="0%"/>
2263
- * <xsd:attribute name="endPos" type="ST_PositiveFixedPercentage" default="100%"/>
2264
- * <xsd:attribute name="dist" type="ST_PositiveCoordinate" default="0"/>
2265
- * <xsd:attribute name="dir" type="ST_PositiveFixedAngle" default="0"/>
2266
- * <xsd:attribute name="fadeDir" type="ST_PositiveFixedAngle" default="5400000"/>
2267
- * <xsd:attribute name="sx" type="ST_Percentage" default="100%"/>
2268
- * <xsd:attribute name="sy" type="ST_Percentage" default="100%"/>
2269
- * <xsd:attribute name="kx" type="ST_FixedAngle" default="0"/>
2270
- * <xsd:attribute name="ky" type="ST_FixedAngle" default="0"/>
2271
- * <xsd:attribute name="algn" type="ST_RectAlignment" default="b"/>
2272
- * <xsd:attribute name="rotWithShape" type="xsd:boolean" default="true"/>
2273
- * </xsd:complexType>
2274
- * ```
2275
- */
2276
- const createReflectionEffect = (options) => {
2277
- if (!options) return new BuilderElement({ name: "a:reflection" });
2278
- const attributes = {};
2279
- if (options.blurRadius !== void 0) attributes.blurRad = {
2280
- key: "blurRad",
2281
- value: options.blurRadius
2282
- };
2283
- if (options.startAlpha !== void 0) attributes.stA = {
2284
- key: "stA",
2285
- value: options.startAlpha
2286
- };
2287
- if (options.startPosition !== void 0) attributes.stPos = {
2288
- key: "stPos",
2289
- value: options.startPosition
2290
- };
2291
- if (options.endAlpha !== void 0) attributes.endA = {
2292
- key: "endA",
2293
- value: options.endAlpha
2294
- };
2295
- if (options.endPosition !== void 0) attributes.endPos = {
2296
- key: "endPos",
2297
- value: options.endPosition
2298
- };
2299
- if (options.distance !== void 0) attributes.dist = {
2300
- key: "dist",
2301
- value: options.distance
2302
- };
2303
- if (options.direction !== void 0) attributes.dir = {
2304
- key: "dir",
2305
- value: options.direction
2306
- };
2307
- if (options.fadeDirection !== void 0) attributes.fadeDir = {
2308
- key: "fadeDir",
2309
- value: options.fadeDirection
2310
- };
2311
- if (options.scaleX !== void 0) attributes.sx = {
2312
- key: "sx",
2313
- value: options.scaleX
2314
- };
2315
- if (options.scaleY !== void 0) attributes.sy = {
2316
- key: "sy",
2317
- value: options.scaleY
2318
- };
2319
- if (options.skewX !== void 0) attributes.kx = {
2320
- key: "kx",
2321
- value: options.skewX
2322
- };
2323
- if (options.skewY !== void 0) attributes.ky = {
2324
- key: "ky",
2325
- value: options.skewY
2326
- };
2327
- if (options.alignment !== void 0) attributes.algn = {
2328
- key: "algn",
2329
- value: options.alignment
2330
- };
2331
- if (options.rotWithShape === false) attributes.rotWithShape = {
2332
- key: "rotWithShape",
2333
- value: 0
2334
- };
2335
- return new BuilderElement({
2336
- attributes,
2337
- name: "a:reflection"
2338
- });
2339
- };
2340
- //#endregion
2341
- //#region src/drawingml/effects/soft-edge.ts
2342
- /**
2343
- * Soft edge effect for DrawingML shapes.
2344
- *
2345
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_SoftEdgesEffect
2346
- *
2347
- * @module
2348
- */
2349
- /**
2350
- * Creates a soft edge effect element.
2351
- *
2352
- * ## XSD Schema
2353
- * ```xml
2354
- * <xsd:complexType name="CT_SoftEdgesEffect">
2355
- * <xsd:attribute name="rad" type="ST_PositiveCoordinate" use="required"/>
2356
- * </xsd:complexType>
2357
- * ```
2358
- *
2359
- * @param rad - Soft edge radius in EMUs (required)
2360
- */
2361
- const createSoftEdgeEffect = (rad) => new BuilderElement({
2362
- attributes: { rad: {
2363
- key: "rad",
2364
- value: rad
2365
- } },
2366
- name: "a:softEdge"
2367
- });
2368
- //#endregion
2369
- //#region src/drawingml/effects/effect-list.ts
2370
- /**
2371
- * Effect list container for DrawingML shapes.
2372
- *
2373
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_EffectList, EG_EffectProperties
2374
- *
2375
- * @module
2376
- */
2377
- /**
2378
- * Creates a blur effect element.
2379
- *
2380
- * ## XSD Schema
2381
- * ```xml
2382
- * <xsd:complexType name="CT_BlurEffect">
2383
- * <xsd:attribute name="rad" type="ST_PositiveCoordinate" default="0"/>
2384
- * <xsd:attribute name="grow" type="xsd:boolean" default="true"/>
2385
- * </xsd:complexType>
2386
- * ```
2387
- */
2388
- const createBlurEffect$1 = (options) => {
2389
- if (!(options.radius !== void 0 || options.grow === false)) return new BuilderElement({ name: "a:blur" });
2390
- return new BuilderElement({
2391
- attributes: {
2392
- ...options.radius !== void 0 && { rad: {
2393
- key: "rad",
2394
- value: options.radius
2395
- } },
2396
- ...options.grow === false && { grow: {
2397
- key: "grow",
2398
- value: 0
2399
- } }
2400
- },
2401
- name: "a:blur"
2402
- });
2403
- };
2404
- /**
2405
- * Creates an effect list element (a:effectLst).
2406
- *
2407
- * This is the EG_EffectProperties choice for a flat list of effects.
2408
- * Effects are emitted in XSD order: blur, glow, innerShdw, outerShdw, prstShdw, reflection, softEdge.
2409
- *
2410
- * ## XSD Schema
2411
- * ```xml
2412
- * <xsd:complexType name="CT_EffectList">
2413
- * <xsd:sequence>
2414
- * <xsd:element name="blur" type="CT_BlurEffect" minOccurs="0"/>
2415
- * <xsd:element name="fillOverlay" type="CT_FillOverlayEffect" minOccurs="0"/>
2416
- * <xsd:element name="glow" type="CT_GlowEffect" minOccurs="0"/>
2417
- * <xsd:element name="innerShdw" type="CT_InnerShadowEffect" minOccurs="0"/>
2418
- * <xsd:element name="outerShdw" type="CT_OuterShadowEffect" minOccurs="0"/>
2419
- * <xsd:element name="prstShdw" type="CT_PresetShadowEffect" minOccurs="0"/>
2420
- * <xsd:element name="reflection" type="CT_ReflectionEffect" minOccurs="0"/>
2421
- * <xsd:element name="softEdge" type="CT_SoftEdgesEffect" minOccurs="0"/>
2422
- * </xsd:sequence>
2423
- * </xsd:complexType>
2424
- * ```
2425
- */
2426
- const createEffectList = (options) => {
2427
- const children = [];
2428
- if (options.blur) children.push(createBlurEffect$1(options.blur));
2429
- if (options.fillOverlay) children.push(createFillOverlayEffect(options.fillOverlay));
2430
- if (options.glow) children.push(createGlowEffect(options.glow));
2431
- if (options.innerShadow) children.push(createInnerShadowEffect(options.innerShadow));
2432
- if (options.outerShadow) children.push(createOuterShadowEffect(options.outerShadow));
2433
- if (options.presetShadow) children.push(createPresetShadowEffect(options.presetShadow));
2434
- if (options.reflection) children.push(createReflectionEffect(options.reflection === true ? void 0 : options.reflection));
2435
- if (options.softEdge !== void 0) children.push(createSoftEdgeEffect(options.softEdge));
2436
- return new BuilderElement({
2437
- children,
2438
- name: "a:effectLst"
2439
- });
2440
- };
2441
- //#endregion
2442
- //#region src/drawingml/effects/effect-dag.ts
2443
- /**
2444
- * Effect container (effectDag) for DrawingML shapes.
2445
- *
2446
- * Provides CT_EffectContainer — a directed acyclic graph (DAG) of effects
2447
- * supporting 28 effect types including alpha/color operations, nested containers,
2448
- * and all effects from CT_EffectList.
2449
- *
2450
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_EffectContainer, EG_Effect
2451
- *
2452
- * @module
2453
- */
2454
- const buildOptionalAttributes = (options) => {
2455
- const attrs = {};
2456
- for (const [key, value] of Object.entries(options)) if (value !== void 0) attrs[key] = {
2457
- key,
2458
- value
2459
- };
2460
- return Object.keys(attrs).length > 0 ? attrs : void 0;
2461
- };
2462
- const createAlphaBiLevelEffect = (options) => new BuilderElement({
2463
- name: "a:alphaBiLevel",
2464
- attributes: { thresh: {
2465
- key: "thresh",
2466
- value: options.threshold
2467
- } }
2468
- });
2469
- const createAlphaCeilingEffect = () => new BuilderElement({ name: "a:alphaCeiling" });
2470
- const createAlphaFloorEffect = () => new BuilderElement({ name: "a:alphaFloor" });
2471
- const createAlphaInverseEffect = (options) => new BuilderElement({
2472
- name: "a:alphaInv",
2473
- children: options?.color ? [createColorElement(options.color)] : void 0
2474
- });
2475
- const createAlphaModulateFixedEffect = (options) => {
2476
- if (options?.amount === void 0) return new BuilderElement({ name: "a:alphaModFix" });
2477
- return new BuilderElement({
2478
- name: "a:alphaModFix",
2479
- attributes: { amt: {
2480
- key: "amt",
2481
- value: options.amount
2482
- } }
2483
- });
2484
- };
2485
- const createAlphaOutsetEffect = (options) => {
2486
- if (options?.radius === void 0) return new BuilderElement({ name: "a:alphaOutset" });
2487
- return new BuilderElement({
2488
- name: "a:alphaOutset",
2489
- attributes: { rad: {
2490
- key: "rad",
2491
- value: options.radius
2492
- } }
2493
- });
2494
- };
2495
- const createAlphaReplaceEffect = (options) => new BuilderElement({
2496
- name: "a:alphaRepl",
2497
- attributes: { a: {
2498
- key: "a",
2499
- value: options.alpha
2500
- } }
2501
- });
2502
- const createBiLevelEffect = (thresh) => new BuilderElement({
2503
- name: "a:biLevel",
2504
- attributes: { thresh: {
2505
- key: "thresh",
2506
- value: thresh
2507
- } }
2508
- });
2509
- const createBlendEffect = (options) => new BuilderElement({
2510
- name: "a:blend",
2511
- attributes: { blend: {
2512
- key: "blend",
2513
- value: options.blend
2514
- } },
2515
- children: [createEffectContainer(options.container)]
2516
- });
2517
- const createColorChangeEffect = (options) => {
2518
- const children = [new BuilderElement({
2519
- name: "a:clrFrom",
2520
- children: [createColorElement(options.from)]
2521
- }), new BuilderElement({
2522
- name: "a:clrTo",
2523
- children: [createColorElement(options.to)]
2524
- })];
2525
- if (options.useA === false) return new BuilderElement({
2526
- name: "a:clrChange",
2527
- attributes: { useA: {
2528
- key: "useA",
2529
- value: 0
2530
- } },
2531
- children
2532
- });
2533
- return new BuilderElement({
2534
- name: "a:clrChange",
2535
- children
2536
- });
2537
- };
2538
- const createColorReplaceEffect = (color) => new BuilderElement({
2539
- name: "a:clrRepl",
2540
- children: [createColorElement(color)]
2541
- });
2542
- const createDuotoneEffect = (options) => new BuilderElement({
2543
- name: "a:duotone",
2544
- children: [createColorElement(options.color1), createColorElement(options.color2)]
2545
- });
2546
- const createFillEffect = (options) => {
2547
- let fillElement;
2548
- if (options.noFill) fillElement = createNoFill();
2549
- else if (options.solidFill) fillElement = createSolidFill(options.solidFill);
2550
- else if (options.gradientFill) fillElement = createGradientFill(options.gradientFill);
2551
- else if (options.patternFill) fillElement = createPatternFill(options.patternFill);
2552
- else if (options.groupFill) fillElement = createGroupFill();
2553
- else fillElement = createNoFill();
2554
- return new BuilderElement({
2555
- name: "a:fill",
2556
- children: [fillElement]
2557
- });
2558
- };
2559
- const createGrayscaleEffect = () => new BuilderElement({ name: "a:grayscl" });
2560
- const createHSLEffect = (options) => {
2561
- return new BuilderElement({
2562
- name: "a:hsl",
2563
- attributes: buildOptionalAttributes({
2564
- hue: options?.hue,
2565
- sat: options?.saturation,
2566
- lum: options?.luminance
2567
- })
2568
- });
2569
- };
2570
- const createLuminanceEffect = (options) => {
2571
- return new BuilderElement({
2572
- name: "a:lum",
2573
- attributes: buildOptionalAttributes({
2574
- bright: options?.bright,
2575
- contrast: options?.contrast
2576
- })
2577
- });
2578
- };
2579
- const createTintEffect = (options) => {
2580
- return new BuilderElement({
2581
- name: "a:tint",
2582
- attributes: buildOptionalAttributes({
2583
- hue: options?.hue,
2584
- amt: options?.amount
2585
- })
2586
- });
2587
- };
2588
- const createRelativeOffsetEffect = (options) => {
2589
- return new BuilderElement({
2590
- name: "a:relOff",
2591
- attributes: buildOptionalAttributes({
2592
- tx: options?.translateX,
2593
- ty: options?.translateY
2594
- })
2595
- });
2596
- };
2597
- const createTransformEffect = (options) => {
2598
- return new BuilderElement({
2599
- name: "a:xfrm",
2600
- attributes: buildOptionalAttributes({
2601
- sx: options?.scaleX,
2602
- sy: options?.scaleY,
2603
- kx: options?.skewX,
2604
- ky: options?.skewY,
2605
- tx: options?.translateX,
2606
- ty: options?.translateY
2607
- })
2608
- });
2609
- };
2610
- const createEffectReference = (options) => new BuilderElement({
2611
- name: "a:effect",
2612
- attributes: { ref: {
2613
- key: "ref",
2614
- value: options.ref
2615
- } }
2616
- });
2617
- const createBlurEffect = (options) => {
2618
- if (!(options.radius !== void 0 || options.grow === false)) return new BuilderElement({ name: "a:blur" });
2619
- return new BuilderElement({
2620
- attributes: {
2621
- ...options.radius !== void 0 && { rad: {
2622
- key: "rad",
2623
- value: options.radius
2624
- } },
2625
- ...options.grow === false && { grow: {
2626
- key: "grow",
2627
- value: 0
2628
- } }
2629
- },
2630
- name: "a:blur"
2631
- });
2632
- };
2633
- /**
2634
- * Creates an effect container element (a:effectDag or a:cont).
2635
- *
2636
- * This is the CT_EffectContainer type — a recursive DAG of effects.
2637
- * All 28 EG_Effect types are supported.
2638
- *
2639
- * ## XSD Schema
2640
- * ```xml
2641
- * <xsd:complexType name="CT_EffectContainer">
2642
- * <xsd:group ref="EG_Effect" minOccurs="0" maxOccurs="unbounded"/>
2643
- * <xsd:attribute name="type" type="ST_EffectContainerType" default="sib"/>
2644
- * <xsd:attribute name="name" type="xsd:token" use="optional"/>
2645
- * </xsd:complexType>
2646
- * ```
2647
- *
2648
- * @param options - Container options with effects
2649
- * @param elementName - Element name, defaults to "a:effectDag" for top-level
2650
- */
2651
- const createEffectContainer = (options, elementName = "a:cont") => {
2652
- const attrs = buildOptionalAttributes({
2653
- type: options.type,
2654
- name: options.name
2655
- });
2656
- const children = [];
2657
- if (options.blur) children.push(createBlurEffect(options.blur));
2658
- if (options.fillOverlay) children.push(createFillOverlayEffect(options.fillOverlay));
2659
- if (options.glow) children.push(createGlowEffect(options.glow));
2660
- if (options.innerShadow) children.push(createInnerShadowEffect(options.innerShadow));
2661
- if (options.outerShadow) children.push(createOuterShadowEffect(options.outerShadow));
2662
- if (options.presetShadow) children.push(createPresetShadowEffect(options.presetShadow));
2663
- if (options.reflection) children.push(createReflectionEffect(options.reflection === true ? void 0 : options.reflection));
2664
- if (options.softEdge !== void 0) children.push(createSoftEdgeEffect(options.softEdge));
2665
- if (options.containers) for (const nested of options.containers) children.push(createEffectContainer(nested));
2666
- if (options.effectRefs) for (const ref of options.effectRefs) children.push(createEffectReference(ref));
2667
- if (options.alphaBiLevel) children.push(createAlphaBiLevelEffect(options.alphaBiLevel));
2668
- if (options.alphaCeiling) children.push(createAlphaCeilingEffect());
2669
- if (options.alphaFloor) children.push(createAlphaFloorEffect());
2670
- if (options.alphaInverse) children.push(createAlphaInverseEffect(options.alphaInverse));
2671
- if (options.alphaModulate) children.push(new BuilderElement({
2672
- name: "a:alphaMod",
2673
- children: [createEffectContainer(options.alphaModulate)]
2674
- }));
2675
- if (options.alphaModulateFixed) children.push(createAlphaModulateFixedEffect(options.alphaModulateFixed));
2676
- if (options.alphaOutset) children.push(createAlphaOutsetEffect(options.alphaOutset));
2677
- if (options.alphaReplace) children.push(createAlphaReplaceEffect(options.alphaReplace));
2678
- if (options.biLevel) children.push(createBiLevelEffect(options.biLevel.threshold));
2679
- if (options.blend) children.push(createBlendEffect(options.blend));
2680
- if (options.colorChange) children.push(createColorChangeEffect(options.colorChange));
2681
- if (options.colorReplace) children.push(createColorReplaceEffect(options.colorReplace));
2682
- if (options.duotone) children.push(createDuotoneEffect(options.duotone));
2683
- if (options.fill) children.push(createFillEffect(options.fill));
2684
- if (options.grayscale) children.push(createGrayscaleEffect());
2685
- if (options.hsl) children.push(createHSLEffect(options.hsl));
2686
- if (options.luminance) children.push(createLuminanceEffect(options.luminance));
2687
- if (options.tint) children.push(createTintEffect(options.tint));
2688
- if (options.relativeOffset) children.push(createRelativeOffsetEffect(options.relativeOffset));
2689
- if (options.transform) children.push(createTransformEffect(options.transform));
2690
- return new BuilderElement({
2691
- name: elementName,
2692
- attributes: attrs,
2693
- children: children.length > 0 ? children : void 0
2694
- });
2695
- };
2696
- /**
2697
- * Creates an effect DAG element (a:effectDag).
2698
- *
2699
- * This is the EG_EffectProperties choice alternative to effectLst,
2700
- * supporting all 28 effect types with recursive nesting.
2701
- *
2702
- * @example
2703
- * ```typescript
2704
- * // Simple effect DAG with glow and outer shadow
2705
- * createEffectDag({
2706
- * glow: { radius: 50800, color: { value: "FF0000" } },
2707
- * outerShadow: { color: { value: "000000" }, blurRadius: 76200 },
2708
- * });
2709
- *
2710
- * // DAG with alpha effects and nested container
2711
- * createEffectDag({
2712
- * type: "tree",
2713
- * alphaBiLevel: { threshold: 50000 },
2714
- * containers: [{
2715
- * glow: { color: { value: "FF0000" } },
2716
- * }],
2717
- * });
2718
- * ```
2719
- */
2720
- const createEffectDag = (options) => createEffectContainer(options, "a:effectDag");
2721
- //#endregion
2722
- //#region src/drawingml/three-d/scene-3d.ts
2723
- /**
2724
- * 3D scene module for DrawingML shapes.
2725
- *
2726
- * Provides CT_Scene3D — the 3D scene properties including camera, light rig,
2727
- * and optional backdrop that define how a 3D shape is rendered.
2728
- *
2729
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_Scene3D
2730
- *
2731
- * @module
2732
- */
2733
- const createSphereCoords = (coords) => new BuilderElement({
2734
- name: "a:rot",
2735
- attributes: {
2736
- lat: {
2737
- key: "lat",
2738
- value: coords.lat
2739
- },
2740
- lon: {
2741
- key: "lon",
2742
- value: coords.lon
2743
- },
2744
- rev: {
2745
- key: "rev",
2746
- value: coords.rev
2747
- }
2748
- }
2749
- });
2750
- const createCamera = (options) => {
2751
- const children = [];
2752
- if (options.rotation) children.push(createSphereCoords(options.rotation));
2753
- const attrs = { prst: {
2754
- key: "prst",
2755
- value: options.preset
2756
- } };
2757
- if (options.fov !== void 0) attrs.fov = {
2758
- key: "fov",
2759
- value: options.fov
2760
- };
2761
- if (options.zoom !== void 0) attrs.zoom = {
2762
- key: "zoom",
2763
- value: options.zoom
2764
- };
2765
- return new BuilderElement({
2766
- name: "a:camera",
2767
- attributes: attrs,
2768
- children: children.length > 0 ? children : void 0
2769
- });
2770
- };
2771
- const createLightRig = (options) => {
2772
- const children = [];
2773
- if (options.rotation) children.push(createSphereCoords(options.rotation));
2774
- return new BuilderElement({
2775
- name: "a:lightRig",
2776
- attributes: {
2777
- rig: {
2778
- key: "rig",
2779
- value: options.rig
2780
- },
2781
- dir: {
2782
- key: "dir",
2783
- value: options.direction
2784
- }
2785
- },
2786
- children: children.length > 0 ? children : void 0
2787
- });
2788
- };
2789
- const createPoint3D = (name, point) => new BuilderElement({
2790
- name,
2791
- attributes: {
2792
- x: {
2793
- key: "x",
2794
- value: point.x
2795
- },
2796
- y: {
2797
- key: "y",
2798
- value: point.y
2799
- },
2800
- z: {
2801
- key: "z",
2802
- value: point.z
2803
- }
2804
- }
2805
- });
2806
- const createVector3D = (name, vector) => new BuilderElement({
2807
- name,
2808
- attributes: {
2809
- dx: {
2810
- key: "dx",
2811
- value: vector.dx
2812
- },
2813
- dy: {
2814
- key: "dy",
2815
- value: vector.dy
2816
- },
2817
- dz: {
2818
- key: "dz",
2819
- value: vector.dz
2820
- }
2821
- }
2822
- });
2823
- const createBackdrop = (options) => new BuilderElement({
2824
- name: "a:backdrop",
2825
- children: [
2826
- createPoint3D("a:anchor", options.anchor),
2827
- createVector3D("a:norm", options.normal),
2828
- createVector3D("a:up", options.up)
2829
- ]
2830
- });
2831
- /**
2832
- * Creates a 3D scene element (a:scene3d).
2833
- *
2834
- * @example
2835
- * ```typescript
2836
- * // Simple scene with default camera and lighting
2837
- * createScene3D({
2838
- * camera: { preset: "perspectiveFront" },
2839
- * lightRig: { rig: "threePt", direction: "t" },
2840
- * });
2841
- *
2842
- * // Scene with rotated camera and backdrop
2843
- * createScene3D({
2844
- * camera: {
2845
- * preset: "isometricTopUp",
2846
- * rotation: { lat: 0, lon: 0, rev: 5400000 },
2847
- * },
2848
- * lightRig: { rig: "balanced", direction: "tl" },
2849
- * backdrop: {
2850
- * anchor: { x: 0, y: 0, z: 0 },
2851
- * normal: { dx: 0, dy: 0, dz: 1 },
2852
- * up: { dx: 0, dy: 1, dz: 0 },
2853
- * },
2854
- * });
2855
- * ```
2856
- */
2857
- const createScene3D = (options) => {
2858
- const children = [createCamera(options.camera), createLightRig(options.lightRig)];
2859
- if (options.backdrop) children.push(createBackdrop(options.backdrop));
2860
- return new BuilderElement({
2861
- name: "a:scene3d",
2862
- children
2863
- });
2864
- };
2865
- //#endregion
2866
- //#region src/drawingml/three-d/bevel.ts
2867
- /**
2868
- * Bevel element for DrawingML 3D shapes.
2869
- *
2870
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_Bevel
2871
- *
2872
- * @module
2873
- */
2874
- /**
2875
- * Bevel preset types (12 variations).
2876
- *
2877
- * Reference: ISO/IEC 29500-4, dml-main.xsd, ST_BevelPresetType
2878
- */
2879
- const BevelPresetType = {
2880
- RELAXED_INSET: "relaxedInset",
2881
- CIRCLE: "circle",
2882
- SLOPE: "slope",
2883
- CROSS: "cross",
2884
- ANGLE: "angle",
2885
- SOFT_ROUND: "softRound",
2886
- CONVEX: "convex",
2887
- COOL_SLANT: "coolSlant",
2888
- DIVOT: "divot",
2889
- RIBLET: "riblet",
2890
- HARD_EDGE: "hardEdge",
2891
- ART_DECO: "artDeco"
2892
- };
2893
- /**
2894
- * Creates a bevel element.
2895
- *
2896
- * ## XSD Schema
2897
- * ```xml
2898
- * <xsd:complexType name="CT_Bevel">
2899
- * <xsd:attribute name="w" type="ST_PositiveCoordinate" default="76200"/>
2900
- * <xsd:attribute name="h" type="ST_PositiveCoordinate" default="76200"/>
2901
- * <xsd:attribute name="prst" type="ST_BevelPresetType" default="circle"/>
2902
- * </xsd:complexType>
2903
- * ```
2904
- */
2905
- const createBevel = (options) => {
2906
- if (!options) return new BuilderElement({ name: "a:bevelT" });
2907
- const attributes = {};
2908
- if (options.w !== void 0) attributes.w = {
2909
- key: "w",
2910
- value: options.w
2911
- };
2912
- if (options.h !== void 0) attributes.h = {
2913
- key: "h",
2914
- value: options.h
2915
- };
2916
- if (options.prst !== void 0) attributes.prst = {
2917
- key: "prst",
2918
- value: BevelPresetType[options.prst]
2919
- };
2920
- return new BuilderElement({
2921
- attributes,
2922
- name: "a:bevelT"
2923
- });
2924
- };
2925
- /**
2926
- * Creates a bottom bevel element (a:bevelB).
2927
- */
2928
- const createBottomBevel = (options) => {
2929
- if (!options) return new BuilderElement({ name: "a:bevelB" });
2930
- const attributes = {};
2931
- if (options.w !== void 0) attributes.w = {
2932
- key: "w",
2933
- value: options.w
2934
- };
2935
- if (options.h !== void 0) attributes.h = {
2936
- key: "h",
2937
- value: options.h
2938
- };
2939
- if (options.prst !== void 0) attributes.prst = {
2940
- key: "prst",
2941
- value: BevelPresetType[options.prst]
2942
- };
2943
- return new BuilderElement({
2944
- attributes,
2945
- name: "a:bevelB"
2946
- });
2947
- };
2948
- //#endregion
2949
- //#region src/drawingml/three-d/shape-3d.ts
2950
- /**
2951
- * 3D shape properties for DrawingML.
2952
- *
2953
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_Shape3D
2954
- *
2955
- * @module
2956
- */
2957
- /**
2958
- * Preset material types for 3D shapes (15 variations).
2959
- *
2960
- * Reference: ISO/IEC 29500-4, dml-main.xsd, ST_PresetMaterialType
2961
- */
2962
- const PresetMaterialType = {
2963
- LEGACY_MATTE: "legacyMatte",
2964
- LEGACY_PLASTIC: "legacyPlastic",
2965
- LEGACY_METAL: "legacyMetal",
2966
- LEGACY_WIREFRAME: "legacyWireframe",
2967
- MATTE: "matte",
2968
- PLASTIC: "plastic",
2969
- METAL: "metal",
2970
- WARM_MATTE: "warmMatte",
2971
- TRANSLUCENT_POWDER: "translucentPowder",
2972
- POWDER: "powder",
2973
- DK_EDGE: "dkEdge",
2974
- SOFT_EDGE: "softEdge",
2975
- CLEAR: "clear",
2976
- FLAT: "flat",
2977
- SOFT_METAL: "softmetal"
2978
- };
2979
- /**
2980
- * Creates a 3D shape properties element (a:sp3d).
2981
- *
2982
- * ## XSD Schema
2983
- * ```xml
2984
- * <xsd:complexType name="CT_Shape3D">
2985
- * <xsd:sequence>
2986
- * <xsd:element name="bevelT" type="CT_Bevel" minOccurs="0"/>
2987
- * <xsd:element name="bevelB" type="CT_Bevel" minOccurs="0"/>
2988
- * <xsd:element name="extrusionClr" type="CT_Color" minOccurs="0"/>
2989
- * <xsd:element name="contourClr" type="CT_Color" minOccurs="0"/>
2990
- * </xsd:sequence>
2991
- * <xsd:attribute name="z" type="ST_Coordinate" default="0"/>
2992
- * <xsd:attribute name="extrusionH" type="ST_PositiveCoordinate" default="0"/>
2993
- * <xsd:attribute name="contourW" type="ST_PositiveCoordinate" default="0"/>
2994
- * <xsd:attribute name="prstMaterial" type="ST_PresetMaterialType" default="warmMatte"/>
2995
- * </xsd:complexType>
2996
- * ```
2997
- */
2998
- const createShape3D = (options) => {
2999
- const children = [];
3000
- if (options.bevelT) children.push(createBevel(options.bevelT));
3001
- if (options.bevelB) children.push(createBottomBevel(options.bevelB));
3002
- if (options.extrusionColor) children.push(new BuilderElement({
3003
- children: [createColorElement(options.extrusionColor)],
3004
- name: "a:extrusionClr"
3005
- }));
3006
- if (options.contourColor) children.push(new BuilderElement({
3007
- children: [createColorElement(options.contourColor)],
3008
- name: "a:contourClr"
3009
- }));
3010
- return new BuilderElement({
3011
- attributes: options.z !== void 0 || options.extrusionH !== void 0 || options.contourW !== void 0 || options.prstMaterial !== void 0 ? {
3012
- ...options.z !== void 0 && { z: {
3013
- key: "z",
3014
- value: options.z
3015
- } },
3016
- ...options.extrusionH !== void 0 && { extrusionH: {
3017
- key: "extrusionH",
3018
- value: options.extrusionH
3019
- } },
3020
- ...options.contourW !== void 0 && { contourW: {
3021
- key: "contourW",
3022
- value: options.contourW
3023
- } },
3024
- ...options.prstMaterial !== void 0 && { prstMaterial: {
3025
- key: "prstMaterial",
3026
- value: PresetMaterialType[options.prstMaterial]
3027
- } }
3028
- } : void 0,
3029
- children,
3030
- name: "a:sp3d"
3031
- });
3032
- };
3033
- //#endregion
3034
- //#region src/drawingml/geometry/adjustment-values.ts
3035
- /**
3036
- * Adjustment values module for preset geometries.
3037
- *
3038
- * This module provides adjustment value lists that can modify the appearance
3039
- * of preset shape geometries.
3040
- *
3041
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_GeomGuideList, CT_GeomGuide
3042
- *
3043
- * @module
3044
- */
3045
- /**
3046
- * Creates an adjustment values list element (a:avLst).
3047
- *
3048
- * The adjustment values list contains geometry guides that modify
3049
- * the appearance of a preset geometric shape. When empty, default
3050
- * values are used.
3051
- *
3052
- * ## XSD Schema
3053
- * ```xml
3054
- * <xsd:complexType name="CT_GeomGuideList">
3055
- * <xsd:sequence>
3056
- * <xsd:element name="gd" type="CT_GeomGuide" minOccurs="0" maxOccurs="unbounded"/>
3057
- * </xsd:sequence>
3058
- * </xsd:complexType>
3059
- * ```
3060
- *
3061
- * @example
3062
- * ```typescript
3063
- * // Empty adjustment values (defaults)
3064
- * createAdjustmentValues();
3065
- *
3066
- * // With guides
3067
- * createAdjustmentValues([
3068
- * { name: "adj", formula: "val 16667" },
3069
- * ]);
3070
- * ```
3071
- */
3072
- const createAdjustmentValues = (guides) => {
3073
- const children = [];
3074
- if (guides) for (const guide of guides) children.push(new BuilderElement({
3075
- attributes: {
3076
- name: {
3077
- key: "name",
3078
- value: guide.name
3079
- },
3080
- fmla: {
3081
- key: "fmla",
3082
- value: guide.formula
3083
- }
3084
- },
3085
- name: "a:gd"
3086
- }));
3087
- return new BuilderElement({
3088
- children,
3089
- name: "a:avLst"
3090
- });
3091
- };
3092
- //#endregion
3093
- //#region src/drawingml/geometry/preset-geometry-attributes.ts
3094
- /**
3095
- * Preset geometry attributes for DrawingML shapes.
3096
- *
3097
- * This module defines the shape type attribute for preset geometries.
3098
- *
3099
- * @module
3100
- */
3101
- /**
3102
- * Attributes for preset geometry.
3103
- *
3104
- * Defines the shape type identifier for a preset geometry.
3105
- *
3106
- * ## XSD Schema
3107
- * ```xml
3108
- * <xsd:attribute name="prst" type="ST_ShapeType" use="required"/>
3109
- * ```
3110
- *
3111
- * @internal
3112
- */
3113
- var PresetGeometryAttributes = class extends XmlAttributeComponent {
3114
- xmlKeys = { prst: "prst" };
3115
- };
3116
- //#endregion
3117
- //#region src/drawingml/geometry/preset-geometry.ts
3118
- /**
3119
- * Preset geometry module for DrawingML shapes.
3120
- *
3121
- * This module provides predefined shape geometries that can be applied
3122
- * to pictures and shapes without requiring custom path definitions.
3123
- *
3124
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_PresetGeometry2D
3125
- *
3126
- * @module
3127
- */
3128
- /**
3129
- * Represents a preset geometry for a DrawingML shape.
3130
- *
3131
- * This element specifies when a preset geometric shape should be used instead
3132
- * of a custom geometry. It includes a shape preset identifier and optional
3133
- * adjustment values that modify the base shape.
3134
- *
3135
- * ## XSD Schema
3136
- * ```xml
3137
- * <xsd:complexType name="CT_PresetGeometry2D">
3138
- * <xsd:sequence>
3139
- * <xsd:element name="avLst" type="CT_GeomGuideList" minOccurs="0" maxOccurs="1"/>
3140
- * </xsd:sequence>
3141
- * <xsd:attribute name="prst" type="ST_ShapeType" use="required"/>
3142
- * </xsd:complexType>
3143
- * ```
3144
- *
3145
- * @example
3146
- * ```typescript
3147
- * // Default rectangle
3148
- * const geometry = new PresetGeometry();
3149
- *
3150
- * // Rounded rectangle with adjustment
3151
- * const geometry = new PresetGeometry({
3152
- * preset: "roundRect",
3153
- * adjustmentValues: [{ name: "adj", formula: "val 16667" }],
3154
- * });
3155
- * ```
3156
- */
3157
- var PresetGeometry = class extends XmlComponent {
3158
- constructor(options) {
3159
- super("a:prstGeom");
3160
- this.root.push(new PresetGeometryAttributes({ prst: options?.preset ?? "rect" }));
3161
- this.root.push(createAdjustmentValues(options?.adjustmentValues));
3162
- }
3163
- };
3164
- //#endregion
3165
- //#region src/drawingml/geometry/custom-geometry.ts
3166
- /**
3167
- * Custom geometry module for DrawingML shapes.
3168
- *
3169
- * Provides CT_CustomGeometry2D — user-defined 2D geometry with paths,
3170
- * guides, adjust handles, connection sites, and a text insertion rectangle.
3171
- *
3172
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_CustomGeometry2D
3173
- *
3174
- * @module
3175
- */
3176
- /**
3177
- * Creates a geometry guide list element (a:avLst or a:gdLst).
3178
- *
3179
- * Both CT_GeomGuideList types share the same structure — a list of `a:gd` children.
3180
- * The only difference is the wrapper element name.
3181
- */
3182
- const createGuideList = (name, guides) => {
3183
- return new BuilderElement({
3184
- name,
3185
- children: guides.map((guide) => new BuilderElement({
3186
- attributes: {
3187
- name: {
3188
- key: "name",
3189
- value: guide.name
3190
- },
3191
- fmla: {
3192
- key: "fmla",
3193
- value: guide.formula
3194
- }
3195
- },
3196
- name: "a:gd"
3197
- }))
3198
- });
3199
- };
3200
- const createAdjPoint = (name, point) => new BuilderElement({
3201
- name,
3202
- children: [new BuilderElement({
3203
- name: "a:pt",
3204
- attributes: {
3205
- x: {
3206
- key: "x",
3207
- value: point.x
3208
- },
3209
- y: {
3210
- key: "y",
3211
- value: point.y
3212
- }
3213
- }
3214
- })]
3215
- });
3216
- const createPathCommand = (cmd) => {
3217
- switch (cmd.command) {
3218
- case "moveTo": return createAdjPoint("a:moveTo", cmd.point);
3219
- case "lineTo": return createAdjPoint("a:lnTo", cmd.point);
3220
- case "arcTo": return new BuilderElement({
3221
- name: "a:arcTo",
3222
- attributes: {
3223
- wR: {
3224
- key: "wR",
3225
- value: cmd.widthRadius
3226
- },
3227
- hR: {
3228
- key: "hR",
3229
- value: cmd.heightRadius
3230
- },
3231
- stAng: {
3232
- key: "stAng",
3233
- value: cmd.startAngle
3234
- },
3235
- swAng: {
3236
- key: "swAng",
3237
- value: cmd.sweepAngle
3238
- }
3239
- }
3240
- });
3241
- case "quadBezTo": return new BuilderElement({
3242
- name: "a:quadBezTo",
3243
- children: cmd.points.map((pt) => new BuilderElement({
3244
- name: "a:pt",
3245
- attributes: {
3246
- x: {
3247
- key: "x",
3248
- value: pt.x
3249
- },
3250
- y: {
3251
- key: "y",
3252
- value: pt.y
3253
- }
3254
- }
3255
- }))
3256
- });
3257
- case "cubicBezTo": return new BuilderElement({
3258
- name: "a:cubicBezTo",
3259
- children: cmd.points.map((pt) => new BuilderElement({
3260
- name: "a:pt",
3261
- attributes: {
3262
- x: {
3263
- key: "x",
3264
- value: pt.x
3265
- },
3266
- y: {
3267
- key: "y",
3268
- value: pt.y
3269
- }
3270
- }
3271
- }))
3272
- });
3273
- case "close": return new BuilderElement({ name: "a:close" });
3274
- }
3275
- };
3276
- const createPath = (options) => {
3277
- const attrs = {};
3278
- if (options.w !== void 0) attrs.w = {
3279
- key: "w",
3280
- value: options.w
3281
- };
3282
- if (options.h !== void 0) attrs.h = {
3283
- key: "h",
3284
- value: options.h
3285
- };
3286
- if (options.fill !== void 0) attrs.fill = {
3287
- key: "fill",
3288
- value: options.fill
3289
- };
3290
- if (options.stroke !== void 0) attrs.stroke = {
3291
- key: "stroke",
3292
- value: options.stroke
3293
- };
3294
- if (options.extrusionOk !== void 0) attrs.extrusionOk = {
3295
- key: "extrusionOk",
3296
- value: options.extrusionOk
3297
- };
3298
- return new BuilderElement({
3299
- name: "a:path",
3300
- attributes: Object.keys(attrs).length > 0 ? attrs : void 0,
3301
- children: options.commands.map(createPathCommand)
3302
- });
3303
- };
3304
- const createAdjustHandlePos = (position) => new BuilderElement({
3305
- name: "a:pos",
3306
- attributes: {
3307
- x: {
3308
- key: "x",
3309
- value: position.x
3310
- },
3311
- y: {
3312
- key: "y",
3313
- value: position.y
3314
- }
3315
- }
3316
- });
3317
- const createXYAdjustHandle = (handle) => {
3318
- const attrs = {};
3319
- if (handle.guideRefX !== void 0) attrs.gdRefX = {
3320
- key: "gdRefX",
3321
- value: handle.guideRefX
3322
- };
3323
- if (handle.minX !== void 0) attrs.minX = {
3324
- key: "minX",
3325
- value: handle.minX
3326
- };
3327
- if (handle.maxX !== void 0) attrs.maxX = {
3328
- key: "maxX",
3329
- value: handle.maxX
3330
- };
3331
- if (handle.guideRefY !== void 0) attrs.gdRefY = {
3332
- key: "gdRefY",
3333
- value: handle.guideRefY
3334
- };
3335
- if (handle.minY !== void 0) attrs.minY = {
3336
- key: "minY",
3337
- value: handle.minY
3338
- };
3339
- if (handle.maxY !== void 0) attrs.maxY = {
3340
- key: "maxY",
3341
- value: handle.maxY
3342
- };
3343
- return new BuilderElement({
3344
- name: "a:ahXY",
3345
- attributes: Object.keys(attrs).length > 0 ? attrs : void 0,
3346
- children: [createAdjustHandlePos(handle.position)]
3347
- });
3348
- };
3349
- const createPolarAdjustHandle = (handle) => {
3350
- const attrs = {};
3351
- if (handle.guideRefRadius !== void 0) attrs.gdRefR = {
3352
- key: "gdRefR",
3353
- value: handle.guideRefRadius
3354
- };
3355
- if (handle.minRadius !== void 0) attrs.minR = {
3356
- key: "minR",
3357
- value: handle.minRadius
3358
- };
3359
- if (handle.maxRadius !== void 0) attrs.maxR = {
3360
- key: "maxR",
3361
- value: handle.maxRadius
3362
- };
3363
- if (handle.guideRefAngle !== void 0) attrs.gdRefAng = {
3364
- key: "gdRefAng",
3365
- value: handle.guideRefAngle
3366
- };
3367
- if (handle.minAngle !== void 0) attrs.minAng = {
3368
- key: "minAng",
3369
- value: handle.minAngle
3370
- };
3371
- if (handle.maxAngle !== void 0) attrs.maxAng = {
3372
- key: "maxAng",
3373
- value: handle.maxAngle
3374
- };
3375
- return new BuilderElement({
3376
- name: "a:ahPolar",
3377
- attributes: Object.keys(attrs).length > 0 ? attrs : void 0,
3378
- children: [createAdjustHandlePos(handle.position)]
3379
- });
3380
- };
3381
- const createConnectionSite = (site) => new BuilderElement({
3382
- name: "a:cxn",
3383
- attributes: { ang: {
3384
- key: "ang",
3385
- value: site.angle
3386
- } },
3387
- children: [createAdjustHandlePos(site.position)]
3388
- });
3389
- const createGeomRect = (rect) => new BuilderElement({
3390
- name: "a:rect",
3391
- attributes: {
3392
- l: {
3393
- key: "l",
3394
- value: rect.left
3395
- },
3396
- t: {
3397
- key: "t",
3398
- value: rect.top
3399
- },
3400
- r: {
3401
- key: "r",
3402
- value: rect.right
3403
- },
3404
- b: {
3405
- key: "b",
3406
- value: rect.bottom
3407
- }
3408
- }
3409
- });
3410
- /**
3411
- * Creates a custom 2D geometry element (a:custGeom).
3412
- *
3413
- * @example
3414
- * ```typescript
3415
- * // Diamond shape
3416
- * const geom = createCustomGeometry({
3417
- * pathList: [{
3418
- * commands: [
3419
- * { command: "moveTo", point: { x: "5000000", y: "0" } },
3420
- * { command: "lineTo", point: { x: "10000000", y: "5000000" } },
3421
- * { command: "lineTo", point: { x: "5000000", y: "10000000" } },
3422
- * { command: "lineTo", point: { x: "0", y: "5000000" } },
3423
- * { command: "close" },
3424
- * ],
3425
- * }],
3426
- * textRect: { left: "2000000", top: "2000000", right: "8000000", bottom: "8000000" },
3427
- * });
3428
- * ```
3429
- */
3430
- const createCustomGeometry = (options) => {
3431
- const children = [];
3432
- if (options.adjustmentValues) children.push(createGuideList("a:avLst", options.adjustmentValues));
3433
- if (options.guides) children.push(createGuideList("a:gdLst", options.guides));
3434
- if (options.adjustHandles && options.adjustHandles.length > 0) children.push(new BuilderElement({
3435
- name: "a:ahLst",
3436
- children: options.adjustHandles.map((h) => h.type === "xy" ? createXYAdjustHandle(h) : createPolarAdjustHandle(h))
3437
- }));
3438
- if (options.connectionSites && options.connectionSites.length > 0) children.push(new BuilderElement({
3439
- name: "a:cxnLst",
3440
- children: options.connectionSites.map(createConnectionSite)
3441
- }));
3442
- if (options.textRect) children.push(createGeomRect(options.textRect));
3443
- children.push(new BuilderElement({
3444
- name: "a:pathLst",
3445
- children: options.pathList.map(createPath)
3446
- }));
3447
- return new BuilderElement({
3448
- name: "a:custGeom",
3449
- children
3450
- });
3451
- };
3452
- //#endregion
3453
- //#region src/drawingml/blip/blip-extentions.ts
3454
- /**
3455
- * Blip extensions module for SVG support.
3456
- *
3457
- * This module provides extension elements that enable SVG image support
3458
- * within blip elements using Office-specific extensions.
3459
- *
3460
- * Reference: http://officeopenxml.com/drwPic.php
3461
- *
3462
- * @module
3463
- */
3464
- /**
3465
- * Creates an SVG blip element for embedding SVG images.
3466
- *
3467
- * This element is a Microsoft Office extension that allows SVG images
3468
- * to be referenced within a blip.
3469
- *
3470
- * @param svgReferenceId - The reference ID for the SVG image
3471
- * @returns An XML component representing the SVG blip element
3472
- * @internal
3473
- */
3474
- const createSvgBlip = (svgReferenceId) => new BuilderElement({
3475
- attributes: {
3476
- asvg: {
3477
- key: "xmlns:asvg",
3478
- value: "http://schemas.microsoft.com/office/drawing/2016/SVG/main"
3479
- },
3480
- embed: {
3481
- key: "r:embed",
3482
- value: `{${svgReferenceId}}`
3483
- }
3484
- },
3485
- name: "asvg:svgBlip"
3486
- });
3487
- /**
3488
- * Creates an extension element for SVG support.
3489
- *
3490
- * This element wraps the SVG blip extension with the appropriate URI
3491
- * to identify it as an SVG extension.
3492
- *
3493
- * @param svgReferenceId - The reference ID for the SVG image
3494
- * @returns An XML component representing the extension element
3495
- * @internal
3496
- */
3497
- const createExtention = (svgReferenceId) => new BuilderElement({
3498
- attributes: { uri: {
3499
- key: "uri",
3500
- value: "{96DAC541-7B7A-43D3-8B79-37D633B846F1}"
3501
- } },
3502
- children: [createSvgBlip(svgReferenceId)],
3503
- name: "a:ext"
3504
- });
3505
- /**
3506
- * Creates an extension list for SVG images.
3507
- *
3508
- * This element contains the extensions needed to embed SVG images
3509
- * within a blip. It wraps the SVG-specific extension elements.
3510
- *
3511
- * ## XSD Schema
3512
- * ```xml
3513
- * <xsd:complexType name="CT_OfficeArtExtensionList">
3514
- * <xsd:sequence>
3515
- * <xsd:element name="ext" type="CT_OfficeArtExtension" minOccurs="0" maxOccurs="unbounded"/>
3516
- * </xsd:sequence>
3517
- * </xsd:complexType>
3518
- * ```
3519
- *
3520
- * @param svgReferenceId - The reference ID for the SVG image
3521
- * @returns An XML component representing the extension list
3522
- */
3523
- const createExtentionList = (svgReferenceId) => new BuilderElement({
3524
- children: [createExtention(svgReferenceId)],
3525
- name: "a:extLst"
3526
- });
3527
- //#endregion
3528
- //#region src/drawingml/blip/blip.ts
3529
- /**
3530
- * Blip (Binary Large Image or Picture) module for DrawingML.
3531
- *
3532
- * This module provides the blip element that references the actual
3533
- * image data within a picture.
3534
- *
3535
- * Reference: http://officeopenxml.com/drwPic.php
3536
- *
3537
- * @module
3538
- */
3539
- /**
3540
- * Creates a blip element for an image.
3541
- *
3542
- * A blip references the actual image data stored in the document package
3543
- * through a relationship ID. For SVG images, it includes extensions that
3544
- * reference the SVG data.
3545
- *
3546
- * Reference: http://officeopenxml.com/drwPic.php
3547
- *
3548
- * ## XSD Schema
3549
- * ```xml
3550
- * <xsd:complexType name="CT_Blip">
3551
- * <xsd:sequence>
3552
- * <xsd:choice minOccurs="0" maxOccurs="unbounded">
3553
- * <xsd:element name="alphaBiLevel" type="CT_AlphaBiLevelEffect"/>
3554
- * <xsd:element name="alphaCeiling" type="CT_AlphaCeilingEffect"/>
3555
- * <xsd:element name="alphaFloor" type="CT_AlphaFloorEffect"/>
3556
- * <xsd:element name="alphaInv" type="CT_AlphaInverseEffect"/>
3557
- * <xsd:element name="alphaMod" type="CT_AlphaModulateEffect"/>
3558
- * <xsd:element name="alphaModFix" type="CT_AlphaModulateFixedEffect"/>
3559
- * <xsd:element name="alphaRepl" type="CT_AlphaReplaceEffect"/>
3560
- * <xsd:element name="biLevel" type="CT_BiLevelEffect"/>
3561
- * <xsd:element name="blur" type="CT_BlurEffect"/>
3562
- * <xsd:element name="clrChange" type="CT_ColorChangeEffect"/>
3563
- * <xsd:element name="clrRepl" type="CT_ColorReplaceEffect"/>
3564
- * <xsd:element name="duotone" type="CT_DuotoneEffect"/>
3565
- * <xsd:element name="fillOverlay" type="CT_FillOverlayEffect"/>
3566
- * <xsd:element name="grayscl" type="CT_GrayscaleEffect"/>
3567
- * <xsd:element name="hsl" type="CT_HSLEffect"/>
3568
- * <xsd:element name="lum" type="CT_LuminanceEffect"/>
3569
- * <xsd:element name="tint" type="CT_TintEffect"/>
3570
- * </xsd:choice>
3571
- * <xsd:element name="extLst" type="CT_OfficeArtExtensionList" minOccurs="0"/>
3572
- * </xsd:sequence>
3573
- * <xsd:attribute ref="r:embed"/>
3574
- * <xsd:attribute ref="r:link"/>
3575
- * <xsd:attribute name="cstate" type="ST_BlipCompression"/>
3576
- * </xsd:complexType>
3577
- * ```
3578
- *
3579
- * @param options - Blip options including referenceId and type
3580
- * @param blipEffects - Optional blip effects (brightness, contrast, etc.)
3581
- * @returns An XML component representing the blip element
3582
- */
3583
- const createBlip = (options, blipEffects) => {
3584
- const children = [];
3585
- if (blipEffects) children.push(...createBlipEffects(blipEffects));
3586
- if (options.type === "svg" && options.fallbackFileName) children.push(createExtentionList(options.referenceId));
3587
- return new BuilderElement({
3588
- attributes: {
3589
- cstate: {
3590
- key: "cstate",
3591
- value: "none"
3592
- },
3593
- embed: {
3594
- key: "r:embed",
3595
- value: `{${options.type === "svg" && options.fallbackFileName ? options.fallbackFileName : options.referenceId}}`
3596
- }
3597
- },
3598
- children,
3599
- name: "a:blip"
3600
- });
3601
- };
3602
- //#endregion
3603
- //#region src/drawingml/blip/blip-fill.ts
3604
- /**
3605
- * Blip fill module for DrawingML pictures.
3606
- *
3607
- * This module defines how an image (blip) fills a picture shape,
3608
- * including stretching and cropping options.
3609
- *
3610
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_BlipFillProperties
3611
- *
3612
- * @module
3613
- */
3614
- /**
3615
- * Creates a blip fill element.
3616
- *
3617
- * This element specifies the type of fill used for a picture. It contains the blip (image)
3618
- * reference, an optional source rectangle for cropping, and the fill mode (typically stretch).
3619
- *
3620
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_BlipFillProperties
3621
- *
3622
- * ## XSD Schema
3623
- * ```xml
3624
- * <xsd:complexType name="CT_BlipFillProperties">
3625
- * <xsd:sequence>
3626
- * <xsd:element name="blip" type="CT_Blip" minOccurs="0" maxOccurs="1"/>
3627
- * <xsd:element name="srcRect" type="CT_RelativeRect" minOccurs="0" maxOccurs="1"/>
3628
- * <xsd:group ref="EG_FillModeProperties" minOccurs="0" maxOccurs="1"/>
3629
- * </xsd:sequence>
3630
- * <xsd:attribute name="dpi" type="xsd:unsignedInt" use="optional"/>
3631
- * <xsd:attribute name="rotWithShape" type="xsd:boolean" use="optional"/>
3632
- * </xsd:complexType>
3633
- * ```
3634
- *
3635
- * @param blipOptions - Blip options including referenceId and type
3636
- * @param fillOptions - Optional blip fill options
3637
- */
3638
- const createBlipFill = (blipOptions, fillOptions) => {
3639
- const children = [];
3640
- children.push(createBlip(blipOptions, fillOptions?.blipEffects));
3641
- children.push(createSourceRectangle(fillOptions?.srcRect));
3642
- if (fillOptions?.tile) children.push(createTileInfo(fillOptions.tile));
3643
- else children.push(new Stretch());
3644
- const attributes = {};
3645
- if (fillOptions?.dpi !== void 0) attributes.dpi = {
3646
- key: "dpi",
3647
- value: fillOptions.dpi
3648
- };
3649
- if (fillOptions?.rotWithShape !== void 0) attributes.rotWithShape = {
3650
- key: "rotWithShape",
3651
- value: fillOptions.rotWithShape ? 1 : 0
3652
- };
3653
- return new BuilderElement({
3654
- attributes: Object.keys(attributes).length > 0 ? attributes : void 0,
3655
- children,
3656
- name: "pic:blipFill"
3657
- });
3658
- };
3659
- //#endregion
3660
- //#region src/drawingml/transform.ts
3661
- /**
3662
- * 2D transform for DrawingML shapes.
3663
- *
3664
- * This module provides factory functions for creating transform elements
3665
- * (a:xfrm) used in shape properties, picture properties, and group shapes.
3666
- *
3667
- * Reference: ISO/IEC 29500-4, dml-main.xsd, CT_Transform2D / CT_GroupTransform2D
3668
- *
3669
- * @module
3670
- */
3671
- function buildXfrmAttrs(options) {
3672
- const attrs = {};
3673
- if (options.flipHorizontal !== void 0) attrs.flipH = {
3674
- key: "flipH",
3675
- value: options.flipHorizontal
3676
- };
3677
- if (options.flipVertical !== void 0) attrs.flipV = {
3678
- key: "flipV",
3679
- value: options.flipVertical
3680
- };
3681
- if (options.rotation !== void 0) attrs.rot = {
3682
- key: "rot",
3683
- value: options.rotation
3684
- };
3685
- return Object.keys(attrs).length > 0 ? attrs : void 0;
3686
- }
3687
- /**
3688
- * Creates a 2D transform element (a:xfrm).
3689
- *
3690
- * @param options - Transform options including position, size, rotation, and flip.
3691
- * @param elementName - Element name, defaults to "a:xfrm".
3692
- */
3693
- const createTransform2D = (options, elementName = "a:xfrm") => {
3694
- const children = [];
3695
- if (options.x !== void 0 || options.y !== void 0) children.push(new BuilderElement({
3696
- name: "a:off",
3697
- attributes: {
3698
- x: {
3699
- key: "x",
3700
- value: options.x ?? 0
3701
- },
3702
- y: {
3703
- key: "y",
3704
- value: options.y ?? 0
3705
- }
3706
- }
3707
- }));
3708
- if (options.width !== void 0 || options.height !== void 0) children.push(new BuilderElement({
3709
- name: "a:ext",
3710
- attributes: {
3711
- cx: {
3712
- key: "cx",
3713
- value: options.width ?? 0
3714
- },
3715
- cy: {
3716
- key: "cy",
3717
- value: options.height ?? 0
3718
- }
3719
- }
3720
- }));
3721
- return new BuilderElement({
3722
- name: elementName,
3723
- attributes: buildXfrmAttrs(options),
3724
- children: children.length > 0 ? children : void 0
3725
- });
3726
- };
3727
- /**
3728
- * Creates a group transform element (a:xfrm with chOff/chExt children).
3729
- */
3730
- const createGroupTransform2D = (options, elementName = "a:xfrm") => {
3731
- const base = createTransform2D(options, elementName);
3732
- base["root"].push(new BuilderElement({
3733
- name: "a:chOff",
3734
- attributes: {
3735
- x: {
3736
- key: "x",
3737
- value: options.childOffsetX ?? 0
3738
- },
3739
- y: {
3740
- key: "y",
3741
- value: options.childOffsetY ?? 0
3742
- }
3743
- }
3744
- }));
3745
- base["root"].push(new BuilderElement({
3746
- name: "a:chExt",
3747
- attributes: {
3748
- cx: {
3749
- key: "cx",
3750
- value: options.childExtentWidth ?? 0
3751
- },
3752
- cy: {
3753
- key: "cy",
3754
- value: options.childExtentHeight ?? 0
3755
- }
3756
- }
3757
- }));
3758
- return base;
3759
- };
3760
- //#endregion
3761
- //#region src/drawingml/media/transformation.ts
3762
- /**
3763
- * Media transformation utilities for DrawingML.
3764
- *
3765
- * Converts user-facing transformation options (pixels) to internal
3766
- * transformation data (pixels + EMUs).
3767
- *
3768
- * @module
3769
- */
3770
- /**
3771
- * Converts user-facing transformation options (pixels) to internal
3772
- * transformation data (pixels + EMUs).
3773
- *
3774
- * @param options - User-facing transformation in pixels
3775
- * @returns Internal transformation data with both pixel and EMU values
3776
- */
3777
- const createTransformation = (options) => ({
3778
- emus: {
3779
- x: convertPixelsToEmu(options.width),
3780
- y: convertPixelsToEmu(options.height)
3781
- },
3782
- flip: options.flip,
3783
- offset: {
3784
- emus: {
3785
- x: convertPixelsToEmu(options.offset?.left ?? 0),
3786
- y: convertPixelsToEmu(options.offset?.top ?? 0)
3787
- },
3788
- pixels: {
3789
- x: Math.round(options.offset?.left ?? 0),
3790
- y: Math.round(options.offset?.top ?? 0)
3791
- }
3792
- },
3793
- pixels: {
3794
- x: Math.round(options.width),
3795
- y: Math.round(options.height)
3796
- },
3797
- rotation: options.rotation ? options.rotation * 6e4 : void 0
3798
- });
3799
- //#endregion
3800
- export { BevelPresetType, BlendMode, CompoundLine, LineCap, LineEndLength, LineEndType, LineEndWidth, LineJoin, PathShadeType, PenAlignment, PresetColor, PresetDash, PresetGeometry, PresetGeometryAttributes, PresetMaterialType, PresetPattern, PresetShadowVal, RectAlignment, SchemeColor, Stretch, SystemColor, TileAlignment, TileFlipMode, buildFill, createAdjustmentValues, createBevel, createBlip, createBlipEffects, createBlipFill, createBottomBevel, createColorElement, createColorTransforms, createCustomDash, createCustomGeometry, createEffectDag, createEffectList, createExtentionList, createFillOverlayEffect, createGlowEffect, createGradientFill, createGradientStop, createGroupFill, createGroupTransform2D, createHslColor, createInnerShadowEffect, createLineEnd, createNoFill, createOuterShadowEffect, createOutline, createPatternFill, createPresetColor, createPresetShadowEffect, createReflectionEffect, createRgbColor, createScRgbColor, createScene3D, createSchemeColor, createShape3D, createSoftEdgeEffect, createSolidFill, createSourceRectangle, createSystemColor, createTileInfo, createTransform2D, createTransformation, extractBlipFillMedia };
1
+ import{S as e,T as t,a as n}from"../xml-components-Csq7gWPd.mjs";import{d as r,t as i}from"../id-generators-Dd0w7vti.mjs";const a=e=>{let t=[];return e.tint!==void 0&&t.push(new n({attributes:{val:{key:`val`,value:e.tint}},name:`a:tint`})),e.shade!==void 0&&t.push(new n({attributes:{val:{key:`val`,value:e.shade}},name:`a:shade`})),e.comp&&t.push(new n({name:`a:comp`})),e.inv&&t.push(new n({name:`a:inv`})),e.gray&&t.push(new n({name:`a:gray`})),e.alpha!==void 0&&t.push(new n({attributes:{val:{key:`val`,value:e.alpha}},name:`a:alpha`})),e.alphaOff!==void 0&&t.push(new n({attributes:{val:{key:`val`,value:e.alphaOff}},name:`a:alphaOff`})),e.alphaMod!==void 0&&t.push(new n({attributes:{val:{key:`val`,value:e.alphaMod}},name:`a:alphaMod`})),e.hue!==void 0&&t.push(new n({attributes:{val:{key:`val`,value:e.hue}},name:`a:hue`})),e.hueOff!==void 0&&t.push(new n({attributes:{val:{key:`val`,value:e.hueOff}},name:`a:hueOff`})),e.hueMod!==void 0&&t.push(new n({attributes:{val:{key:`val`,value:e.hueMod}},name:`a:hueMod`})),e.sat!==void 0&&t.push(new n({attributes:{val:{key:`val`,value:e.sat}},name:`a:sat`})),e.satOff!==void 0&&t.push(new n({attributes:{val:{key:`val`,value:e.satOff}},name:`a:satOff`})),e.satMod!==void 0&&t.push(new n({attributes:{val:{key:`val`,value:e.satMod}},name:`a:satMod`})),e.lum!==void 0&&t.push(new n({attributes:{val:{key:`val`,value:e.lum}},name:`a:lum`})),e.lumOff!==void 0&&t.push(new n({attributes:{val:{key:`val`,value:e.lumOff}},name:`a:lumOff`})),e.lumMod!==void 0&&t.push(new n({attributes:{val:{key:`val`,value:e.lumMod}},name:`a:lumMod`})),e.red!==void 0&&t.push(new n({attributes:{val:{key:`val`,value:e.red}},name:`a:red`})),e.redOff!==void 0&&t.push(new n({attributes:{val:{key:`val`,value:e.redOff}},name:`a:redOff`})),e.redMod!==void 0&&t.push(new n({attributes:{val:{key:`val`,value:e.redMod}},name:`a:redMod`})),e.green!==void 0&&t.push(new n({attributes:{val:{key:`val`,value:e.green}},name:`a:green`})),e.greenOff!==void 0&&t.push(new n({attributes:{val:{key:`val`,value:e.greenOff}},name:`a:greenOff`})),e.greenMod!==void 0&&t.push(new n({attributes:{val:{key:`val`,value:e.greenMod}},name:`a:greenMod`})),e.blue!==void 0&&t.push(new n({attributes:{val:{key:`val`,value:e.blue}},name:`a:blue`})),e.blueOff!==void 0&&t.push(new n({attributes:{val:{key:`val`,value:e.blueOff}},name:`a:blueOff`})),e.blueMod!==void 0&&t.push(new n({attributes:{val:{key:`val`,value:e.blueMod}},name:`a:blueMod`})),e.gamma&&t.push(new n({name:`a:gamma`})),e.invGamma&&t.push(new n({name:`a:invGamma`})),t},o=e=>{let t=e.transforms?a(e.transforms):[];return new n({attributes:{hue:{key:`hue`,value:e.hue},lum:{key:`lum`,value:e.luminance},sat:{key:`sat`,value:e.saturation}},children:[...t],name:`a:hslClr`})},s={ALICE_BLUE:`aliceBlue`,ANTIQUE_WHITE:`antiqueWhite`,AQUA:`aqua`,AQUAMARINE:`aquamarine`,AZURE:`azure`,BEIGE:`beige`,BISQUE:`bisque`,BLACK:`black`,BLANCHED_ALMOND:`blanchedAlmond`,BLUE:`blue`,BLUE_VIOLET:`blueViolet`,BROWN:`brown`,BURLY_WOOD:`burlyWood`,CADET_BLUE:`cadetBlue`,CHARTREUSE:`chartreuse`,CHOCOLATE:`chocolate`,CORAL:`coral`,CORNFLOWER_BLUE:`cornflowerBlue`,CORNSILK:`cornsilk`,CRIMSON:`crimson`,CYAN:`cyan`,DARK_BLUE:`darkBlue`,DARK_CYAN:`darkCyan`,DARK_GOLDENROD:`darkGoldenrod`,DARK_GRAY:`darkGray`,DARK_GREY:`darkGrey`,DARK_GREEN:`darkGreen`,DARK_KHAKI:`darkKhaki`,DARK_MAGENTA:`darkMagenta`,DARK_OLIVE_GREEN:`darkOliveGreen`,DARK_ORANGE:`darkOrange`,DARK_ORCHID:`darkOrchid`,DARK_RED:`darkRed`,DARK_SALMON:`darkSalmon`,DARK_SEA_GREEN:`darkSeaGreen`,DARK_SLATE_BLUE:`darkSlateBlue`,DARK_SLATE_GRAY:`darkSlateGray`,DARK_SLATE_GREY:`darkSlateGrey`,DARK_TURQUOISE:`darkTurquoise`,DARK_VIOLET:`darkViolet`,DEEP_PINK:`deepPink`,DEEP_SKY_BLUE:`deepSkyBlue`,DIM_GRAY:`dimGray`,DIM_GREY:`dimGrey`,DODGER_BLUE:`dodgerBlue`,FIREBRICK:`firebrick`,FLORAL_WHITE:`floralWhite`,FOREST_GREEN:`forestGreen`,FUCHSIA:`fuchsia`,GAINSBORO:`gainsboro`,GHOST_WHITE:`ghostWhite`,GOLD:`gold`,GOLDENROD:`goldenrod`,GRAY:`gray`,GREY:`grey`,GREEN:`green`,GREEN_YELLOW:`greenYellow`,HONEYDEW:`honeydew`,HOT_PINK:`hotPink`,INDIAN_RED:`indianRed`,INDIGO:`indigo`,IVORY:`ivory`,KHAKI:`khaki`,LAVENDER:`lavender`,LAVENDER_BLUSH:`lavenderBlush`,LAWN_GREEN:`lawnGreen`,LEMON_CHIFFON:`lemonChiffon`,LIGHT_BLUE:`lightBlue`,LIGHT_CORAL:`lightCoral`,LIGHT_CYAN:`lightCyan`,LIGHT_GOLDENROD_YELLOW:`lightGoldenrodYellow`,LIGHT_GRAY:`lightGray`,LIGHT_GREY:`lightGrey`,LIGHT_GREEN:`lightGreen`,LIGHT_PINK:`lightPink`,LIGHT_SALMON:`lightSalmon`,LIGHT_SEA_GREEN:`lightSeaGreen`,LIGHT_SKY_BLUE:`lightSkyBlue`,LIGHT_SLATE_GRAY:`lightSlateGray`,LIGHT_SLATE_GREY:`lightSlateGrey`,LIGHT_STEEL_BLUE:`lightSteelBlue`,LIGHT_YELLOW:`lightYellow`,LIME:`lime`,LIME_GREEN:`limeGreen`,LINEN:`linen`,MAGENTA:`magenta`,MAROON:`maroon`,MEDIUM_AQUAMARINE:`mediumAquamarine`,MEDIUM_BLUE:`mediumBlue`,MEDIUM_ORCHID:`mediumOrchid`,MEDIUM_PURPLE:`mediumPurple`,MEDIUM_SEA_GREEN:`mediumSeaGreen`,MEDIUM_SLATE_BLUE:`mediumSlateBlue`,MEDIUM_SPRING_GREEN:`mediumSpringGreen`,MEDIUM_TURQUOISE:`mediumTurquoise`,MEDIUM_VIOLET_RED:`mediumVioletRed`,MIDNIGHT_BLUE:`midnightBlue`,MINT_CREAM:`mintCream`,MISTY_ROSE:`mistyRose`,MOCCASIN:`moccasin`,NAVAJO_WHITE:`navajoWhite`,NAVY:`navy`,OLD_LACE:`oldLace`,OLIVE:`olive`,OLIVE_DRAB:`oliveDrab`,ORANGE:`orange`,ORANGE_RED:`orangeRed`,ORCHID:`orchid`,PALE_GOLDENROD:`paleGoldenrod`,PALE_GREEN:`paleGreen`,PALE_TURQUOISE:`paleTurquoise`,PALE_VIOLET_RED:`paleVioletRed`,PAPAYA_WHIP:`papayaWhip`,PEACH_PUFF:`peachPuff`,PERU:`peru`,PINK:`pink`,PLUM:`plum`,POWDER_BLUE:`powderBlue`,PURPLE:`purple`,RED:`red`,ROSY_BROWN:`rosyBrown`,ROYAL_BLUE:`royalBlue`,SADDLE_BROWN:`saddleBrown`,SALMON:`salmon`,SANDY_BROWN:`sandyBrown`,SEA_GREEN:`seaGreen`,SEA_SHELL:`seaShell`,SIENNA:`sienna`,SILVER:`silver`,SKY_BLUE:`skyBlue`,SLATE_BLUE:`slateBlue`,SLATE_GRAY:`slateGray`,SLATE_GREY:`slateGrey`,SNOW:`snow`,SPRING_GREEN:`springGreen`,STEEL_BLUE:`steelBlue`,TAN:`tan`,TEAL:`teal`,THISTLE:`thistle`,TOMATO:`tomato`,TURQUOISE:`turquoise`,VIOLET:`violet`,WHEAT:`wheat`,WHITE:`white`,WHITE_SMOKE:`whiteSmoke`,YELLOW:`yellow`,YELLOW_GREEN:`yellowGreen`},ee=e=>{let t=e.transforms?a(e.transforms):[];return new n({attributes:{value:{key:`val`,value:e.value}},children:[...t],name:`a:prstClr`})},te=e=>{let t=e.transforms?a(e.transforms):[];return new n({attributes:{value:{key:`val`,value:e.value}},children:[...t],name:`a:srgbClr`})},c=e=>{let t=e.transforms?a(e.transforms):[];return new n({attributes:{r:{key:`r`,value:e.r},g:{key:`g`,value:e.g},b:{key:`b`,value:e.b}},children:[...t],name:`a:scrgbClr`})},l={BG1:`bg1`,TX1:`tx1`,BG2:`bg2`,TX2:`tx2`,ACCENT1:`accent1`,ACCENT2:`accent2`,ACCENT3:`accent3`,ACCENT4:`accent4`,ACCENT5:`accent5`,ACCENT6:`accent6`,HLINK:`hlink`,FOLHLINK:`folHlink`,DK1:`dk1`,LT1:`lt1`,DK2:`dk2`,LT2:`lt2`,PHCLR:`phClr`},u=e=>{let t=e.transforms?a(e.transforms):[];return new n({attributes:{value:{key:`val`,value:e.value}},children:[...t],name:`a:schemeClr`})},d={SCROLL_BAR:`scrollBar`,BACKGROUND:`background`,ACTIVE_CAPTION:`activeCaption`,INACTIVE_CAPTION:`inactiveCaption`,MENU:`menu`,WINDOW:`window`,WINDOW_FRAME:`windowFrame`,MENU_TEXT:`menuText`,WINDOW_TEXT:`windowText`,CAPTION_TEXT:`captionText`,ACTIVE_BORDER:`activeBorder`,INACTIVE_BORDER:`inactiveBorder`,APP_WORKSPACE:`appWorkspace`,HIGHLIGHT:`highlight`,HIGHLIGHT_TEXT:`highlightText`,BTN_FACE:`btnFace`,BTN_SHADOW:`btnShadow`,GRAY_TEXT:`grayText`,BTN_TEXT:`btnText`,INACTIVE_CAPTION_TEXT:`inactiveCaptionText`,BTN_HIGHLIGHT:`btnHighlight`,THREE_D_DK_SHADOW:`3dDkShadow`,THREE_D_LIGHT:`3dLight`,INFO_TEXT:`infoText`,INFO_BK:`infoBk`,HOT_LIGHT:`hotLight`,GRADIENT_ACTIVE_CAPTION:`gradientActiveCaption`,GRADIENT_INACTIVE_CAPTION:`gradientInactiveCaption`,MENU_HIGHLIGHT:`menuHighlight`,MENU_BAR:`menuBar`},f=e=>{let t=e.transforms?a(e.transforms):[];return new n({attributes:{lastClr:{key:`lastClr`,value:e.lastClr},value:{key:`val`,value:e.value}},children:[...t],name:`a:sysClr`})},ne=new Set(Object.values(d)),re=new Set(Object.values(s)),ie=new Set(Object.values(l)),p=e=>{if(`hue`in e&&`saturation`in e&&`luminance`in e)return o(e);if(`r`in e&&`g`in e&&`b`in e)return c(e);let t=e.value;return ne.has(t)?f(e):re.has(t)?ee(e):ie.has(t)?u(e):te(e)},m=e=>new n({children:[p(e)],name:`a:solidFill`}),h=e=>{let t=[];if(e.grayscale&&t.push(new n({name:`a:grayscl`})),e.luminance){let r={};e.luminance.bright!==void 0&&(r.bright={key:`bright`,value:`${e.luminance.bright}%`}),e.luminance.contrast!==void 0&&(r.contrast={key:`contrast`,value:`${e.luminance.contrast}%`}),t.push(new n({attributes:r,name:`a:lum`}))}if(e.hsl){let r={};e.hsl.hue!==void 0&&(r.hue={key:`hue`,value:String(e.hsl.hue)}),e.hsl.saturation!==void 0&&(r.sat={key:`sat`,value:`${e.hsl.saturation}%`}),e.hsl.luminance!==void 0&&(r.lum={key:`lum`,value:`${e.hsl.luminance}%`}),t.push(new n({attributes:r,name:`a:hsl`}))}if(e.tint){let r={};e.tint.hue!==void 0&&(r.hue={key:`hue`,value:String(e.tint.hue)}),e.tint.amount!==void 0&&(r.amt={key:`amt`,value:`${e.tint.amount}%`}),t.push(new n({attributes:r,name:`a:tint`}))}if(e.duotone&&t.push(new n({children:[p(e.duotone.color1),p(e.duotone.color2)],name:`a:duotone`})),e.biLevel&&t.push(new n({attributes:{thresh:{key:`thresh`,value:`${e.biLevel.threshold}%`}},name:`a:biLevel`})),e.alphaCeiling&&t.push(new n({name:`a:alphaCeiling`})),e.alphaFloor&&t.push(new n({name:`a:alphaFloor`})),e.alphaInverse!==void 0&&(typeof e.alphaInverse==`boolean`?t.push(new n({name:`a:alphaInv`})):t.push(new n({children:[p(e.alphaInverse)],name:`a:alphaInv`}))),e.alphaModFix){let r=e.alphaModFix.amount??100;t.push(new n({attributes:{amt:{key:`amt`,value:`${r}%`}},name:`a:alphaModFix`}))}if(e.alphaRepl&&t.push(new n({attributes:{a:{key:`a`,value:`${e.alphaRepl.amount}%`}},name:`a:alphaRepl`})),e.alphaBiLevel&&t.push(new n({attributes:{thresh:{key:`thresh`,value:`${e.alphaBiLevel.threshold}%`}},name:`a:alphaBiLevel`})),e.colorChange){let r={};e.colorChange.useAlpha===!1&&(r.useA={key:`useA`,value:`0`}),t.push(new n({attributes:r,children:[new n({children:[p(e.colorChange.from)],name:`a:clrFrom`}),new n({children:[p(e.colorChange.to)],name:`a:clrTo`})],name:`a:clrChange`}))}if(e.colorRepl&&t.push(new n({children:[p(e.colorRepl.color)],name:`a:clrRepl`})),e.blur){let r={};e.blur.radius!==void 0&&(r.rad={key:`rad`,value:e.blur.radius}),e.blur.grow===!1&&(r.grow={key:`grow`,value:0}),t.push(new n({attributes:r,name:`a:blur`}))}return t},g=e=>{if(!e)return new n({name:`a:srcRect`});let t={};return e.left!==void 0&&(t.l={key:`l`,value:e.left}),e.top!==void 0&&(t.t={key:`t`,value:e.top}),e.right!==void 0&&(t.r={key:`r`,value:e.right}),e.bottom!==void 0&&(t.b={key:`b`,value:e.bottom}),new n({attributes:t,name:`a:srcRect`})};var ae=class extends t{constructor(){super(`a:fillRect`)}},_=class extends t{constructor(){super(`a:stretch`),this.root.push(new ae)}};const oe={NONE:`none`,X:`x`,Y:`y`,XY:`xy`},v={TOP_LEFT:`tl`,TOP:`t`,TOP_RIGHT:`tr`,LEFT:`l`,CENTER:`ctr`,RIGHT:`r`,BOTTOM_LEFT:`bl`,BOTTOM:`b`,BOTTOM_RIGHT:`br`},y=e=>{if(!e)return new n({name:`a:tile`});let t={};return e.tx!==void 0&&(t.tx={key:`tx`,value:e.tx}),e.ty!==void 0&&(t.ty={key:`ty`,value:e.ty}),e.sx!==void 0&&(t.sx={key:`sx`,value:e.sx}),e.sy!==void 0&&(t.sy={key:`sy`,value:e.sy}),e.flip!==void 0&&(t.flip={key:`flip`,value:oe[e.flip]}),e.align!==void 0&&(t.algn={key:`algn`,value:v[e.align]}),new n({attributes:Object.keys(t).length>0?t:void 0,name:`a:tile`})},b={SHAPE:`shape`,CIRCLE:`circle`,RECT:`rect`},se={NONE:`none`,X:`x`,Y:`y`,XY:`xy`},x=e=>new n({attributes:{pos:{key:`pos`,value:e.position}},children:[p(e.color)],name:`a:gs`}),S=(e,t)=>new n({attributes:{l:{key:`l`,value:t?.left},t:{key:`t`,value:t?.top},r:{key:`r`,value:t?.right},b:{key:`b`,value:t?.bottom}},name:e}),ce=e=>{if(`angle`in e)return new n({attributes:{ang:{key:`ang`,value:e.angle},scaled:{key:`scaled`,value:e.scaled}},name:`a:lin`});let t=e,r=[];return t.fillToRect&&r.push(S(`a:fillToRect`,t.fillToRect)),new n({attributes:{path:{key:`path`,value:t.path?b[t.path]:void 0}},children:r,name:`a:path`})},C=e=>{let t=[];return t.push(new n({children:e.stops.map(x),name:`a:gsLst`})),e.shade&&t.push(ce(e.shade)),e.tileRect&&t.push(S(`a:tileRect`,e.tileRect)),new n({attributes:{flip:{key:`flip`,value:e.flip?se[e.flip]:void 0},rotWithShape:{key:`rotWithShape`,value:e.rotateWithShape}},children:t,name:`a:gradFill`})},le={PCT5:`pct5`,PCT10:`pct10`,PCT20:`pct20`,PCT25:`pct25`,PCT30:`pct30`,PCT40:`pct40`,PCT50:`pct50`,PCT60:`pct60`,PCT70:`pct70`,PCT75:`pct75`,PCT80:`pct80`,PCT90:`pct90`,HORZ:`horz`,VERT:`vert`,LT_HORZ:`ltHorz`,LT_VERT:`ltVert`,DK_HORZ:`dkHorz`,DK_VERT:`dkVert`,NAR_HORZ:`narHorz`,NAR_VERT:`narVert`,DASH_HORZ:`dashHorz`,DASH_VERT:`dashVert`,CROSS:`cross`,DN_DIAG:`dnDiag`,UP_DIAG:`upDiag`,LT_DN_DIAG:`ltDnDiag`,LT_UP_DIAG:`ltUpDiag`,DK_DN_DIAG:`dkDnDiag`,DK_UP_DIAG:`dkUpDiag`,WD_DN_DIAG:`wdDnDiag`,WD_UP_DIAG:`wdUpDiag`,DASH_DN_DIAG:`dashDnDiag`,DASH_UP_DIAG:`dashUpDiag`,DIAG_CROSS:`diagCross`,SM_CHECK:`smCheck`,LG_CHECK:`lgCheck`,SM_GRID:`smGrid`,LG_GRID:`lgGrid`,DOT_GRID:`dotGrid`,SM_CONFETTI:`smConfetti`,LG_CONFETTI:`lgConfetti`,HORZ_BRICK:`horzBrick`,DIAG_BRICK:`diagBrick`,SOLID_DMND:`solidDmnd`,OPEN_DMND:`openDmnd`,DOT_DMND:`dotDmnd`,PLAID:`plaid`,SPHERE:`sphere`,WEAVE:`weave`,DIVOT:`divot`,SHINGLE:`shingle`,WAVE:`wave`,TRELLIS:`trellis`,ZIG_ZAG:`zigZag`},w=e=>{let t=[];return e.foregroundColor&&t.push(new n({children:[p(e.foregroundColor)],name:`a:fgClr`})),e.backgroundColor&&t.push(new n({children:[p(e.backgroundColor)],name:`a:bgClr`})),new n({attributes:{prst:{key:`prst`,value:e.pattern}},children:t,name:`a:pattFill`})};function T(e){return typeof e==`string`?{value:e.replace(`#`,``)}:e}function ue(e){return e instanceof Uint8Array?e:new Uint8Array(e)}const de=e=>{if(typeof e==`string`||e.type!==`blip`)return;let t=ue(e.data);return{data:t,fileName:`${i(t)}.${e.imageType}`,type:e.imageType}},fe=e=>{if(typeof e==`string`)return m({value:e.replace(`#`,``)});switch(e.type){case`solid`:return m(T(e.color));case`none`:return new n({name:`a:noFill`});case`gradient`:return`options`in e?C(e.options):C({stops:e.stops.map(e=>({position:e.position*1e3,color:T(e.color)})),...!e.path&&e.angle!==void 0&&{shade:{angle:e.angle*6e4,scaled:e.scaled??!0}},...e.path&&{shade:{path:e.path.toUpperCase()}}});case`blip`:{let t=`${i(ue(e.data))}.${e.imageType}`,r=[];e.blipEffects&&r.push(...h(e.blipEffects));let a=[new n({attributes:{cstate:{key:`cstate`,value:`none`},embed:{key:`r:embed`,value:`{${t}}`}},children:r,name:`a:blip`}),g(e.srcRect)];e.tile?a.push(y(e.tile)):a.push(new _);let o={};return e.dpi!==void 0&&(o.dpi={key:`dpi`,value:e.dpi}),e.rotWithShape!==void 0&&(o.rotWithShape={key:`rotWithShape`,value:+!!e.rotWithShape}),new n({attributes:Object.keys(o).length>0?o:void 0,children:a,name:`a:blipFill`})}case`pattern`:return w({pattern:e.pattern,...e.foregroundColor&&{foregroundColor:T(e.foregroundColor)},...e.backgroundColor&&{backgroundColor:T(e.backgroundColor)}});case`group`:return new n({name:`a:grpFill`})}},E=()=>new n({name:`a:noFill`}),D=()=>new n({name:`a:grpFill`}),O=e=>{let t=[];for(let r of e)t.push(new n({attributes:{d:{key:`d`,value:r.d},sp:{key:`sp`,value:r.sp}},name:`a:ds`}));return new n({children:t,name:`a:custDash`})},k={NONE:`none`,TRIANGLE:`triangle`,STEALTH:`stealth`,DIAMOND:`diamond`,OVAL:`oval`,ARROW:`arrow`},A={SMALL:`sm`,MEDIUM:`med`,LARGE:`lg`},j={SMALL:`sm`,MEDIUM:`med`,LARGE:`lg`},M=(e,t)=>new n({attributes:{type:{key:`type`,value:k[t.type]},w:{key:`w`,value:t.width?A[t.width]:void 0},len:{key:`len`,value:t.length?j[t.length]:void 0}},name:e}),N={ROUND:`rnd`,SQUARE:`sq`,FLAT:`flat`},P={SINGLE:`sng`,DOUBLE:`dbl`,THICK_THIN:`thickThin`,THIN_THICK:`thinThick`,TRI:`tri`},F={CENTER:`ctr`,INSET:`in`},I={SOLID:`solid`,DOT:`dot`,DASH:`dash`,LG_DASH:`lgDash`,DASH_DOT:`dashDot`,LG_DASH_DOT:`lgDashDot`,LG_DASH_DOT_DOT:`lgDashDotDot`,SYS_DASH:`sysDash`,SYS_DOT:`sysDot`,SYS_DASH_DOT:`sysDashDot`,SYS_DASH_DOT_DOT:`sysDashDotDot`},L={ROUND:`round`,BEVEL:`bevel`,MITER:`miter`},pe=e=>e.type===`noFill`?E():e.type===`solidFill`&&e.color?m(e.color):e.type===`gradFill`&&e.gradientFill?C(e.gradientFill):e.type===`pattFill`&&e.patternFill?w(e.patternFill):null,me=e=>{let t=[],r=pe(e);return r&&t.push(r),e.customDash===void 0?e.dash!==void 0&&t.push(new n({attributes:{val:{key:`val`,value:I[e.dash]}},name:`a:prstDash`})):t.push(O(e.customDash)),e.join!==void 0&&(e.join===`MITER`&&e.miterLimit!==void 0?t.push(new n({attributes:{lim:{key:`lim`,value:e.miterLimit}},name:`a:miter`})):t.push(new n({name:`a:${L[e.join]}`}))),e.headEnd&&t.push(M(`a:headEnd`,e.headEnd)),e.tailEnd&&t.push(M(`a:tailEnd`,e.tailEnd)),new n({attributes:{align:{key:`algn`,value:e.align?F[e.align]:void 0},cap:{key:`cap`,value:e.cap?N[e.cap]:void 0},compoundLine:{key:`cmpd`,value:e.compoundLine?P[e.compoundLine]:void 0},width:{key:`w`,value:e.width}},children:t,name:`a:ln`})},he={OVER:`over`,MULTIPLY:`mult`,SCREEN:`screen`,DARKEN:`darken`,LIGHTEN:`lighten`},R=e=>{let t;return t=e.noFill?E():e.solidFill?m(e.solidFill):e.gradientFill?C(e.gradientFill):e.patternFill?w(e.patternFill):e.groupFill?D():m({value:`000000`}),new n({attributes:{blend:{key:`blend`,value:e.blend}},children:[t],name:`a:fillOverlay`})},z=e=>e.radius===void 0?new n({children:[p(e.color)],name:`a:glow`}):new n({attributes:{rad:{key:`rad`,value:e.radius}},children:[p(e.color)],name:`a:glow`}),B=e=>e.blurRadius!==void 0||e.distance!==void 0||e.direction!==void 0?new n({attributes:{...e.blurRadius!==void 0&&{blurRad:{key:`blurRad`,value:e.blurRadius}},...e.distance!==void 0&&{dist:{key:`dist`,value:e.distance}},...e.direction!==void 0&&{dir:{key:`dir`,value:e.direction}}},children:[p(e.color)],name:`a:innerShdw`}):new n({children:[p(e.color)],name:`a:innerShdw`}),V={TOP_LEFT:`tl`,TOP:`t`,TOP_RIGHT:`tr`,LEFT:`l`,CENTER:`ctr`,RIGHT:`r`,BOTTOM_LEFT:`bl`,BOTTOM:`b`,BOTTOM_RIGHT:`br`},H=e=>{let t={};return e.blurRadius!==void 0&&(t.blurRad={key:`blurRad`,value:e.blurRadius}),e.distance!==void 0&&(t.dist={key:`dist`,value:e.distance}),e.direction!==void 0&&(t.dir={key:`dir`,value:e.direction}),e.scaleX!==void 0&&(t.sx={key:`sx`,value:e.scaleX}),e.scaleY!==void 0&&(t.sy={key:`sy`,value:e.scaleY}),e.skewX!==void 0&&(t.kx={key:`kx`,value:e.skewX}),e.skewY!==void 0&&(t.ky={key:`ky`,value:e.skewY}),e.alignment!==void 0&&(t.algn={key:`algn`,value:V[e.alignment]}),e.rotWithShape===!1&&(t.rotWithShape={key:`rotWithShape`,value:0}),new n({attributes:t,children:[p(e.color)],name:`a:outerShdw`})},U={SHDW1:`shdw1`,SHDW2:`shdw2`,SHDW3:`shdw3`,SHDW4:`shdw4`,SHDW5:`shdw5`,SHDW6:`shdw6`,SHDW7:`shdw7`,SHDW8:`shdw8`,SHDW9:`shdw9`,SHDW10:`shdw10`,SHDW11:`shdw11`,SHDW12:`shdw12`,SHDW13:`shdw13`,SHDW14:`shdw14`,SHDW15:`shdw15`,SHDW16:`shdw16`,SHDW17:`shdw17`,SHDW18:`shdw18`,SHDW19:`shdw19`,SHDW20:`shdw20`},W=e=>{let t={prst:{key:`prst`,value:U[e.preset]}};return e.distance!==void 0&&(t.dist={key:`dist`,value:e.distance}),e.direction!==void 0&&(t.dir={key:`dir`,value:e.direction}),new n({attributes:t,children:[p(e.color)],name:`a:prstShdw`})},G=e=>{if(!e)return new n({name:`a:reflection`});let t={};return e.blurRadius!==void 0&&(t.blurRad={key:`blurRad`,value:e.blurRadius}),e.startAlpha!==void 0&&(t.stA={key:`stA`,value:e.startAlpha}),e.startPosition!==void 0&&(t.stPos={key:`stPos`,value:e.startPosition}),e.endAlpha!==void 0&&(t.endA={key:`endA`,value:e.endAlpha}),e.endPosition!==void 0&&(t.endPos={key:`endPos`,value:e.endPosition}),e.distance!==void 0&&(t.dist={key:`dist`,value:e.distance}),e.direction!==void 0&&(t.dir={key:`dir`,value:e.direction}),e.fadeDirection!==void 0&&(t.fadeDir={key:`fadeDir`,value:e.fadeDirection}),e.scaleX!==void 0&&(t.sx={key:`sx`,value:e.scaleX}),e.scaleY!==void 0&&(t.sy={key:`sy`,value:e.scaleY}),e.skewX!==void 0&&(t.kx={key:`kx`,value:e.skewX}),e.skewY!==void 0&&(t.ky={key:`ky`,value:e.skewY}),e.alignment!==void 0&&(t.algn={key:`algn`,value:e.alignment}),e.rotWithShape===!1&&(t.rotWithShape={key:`rotWithShape`,value:0}),new n({attributes:t,name:`a:reflection`})},K=e=>new n({attributes:{rad:{key:`rad`,value:e}},name:`a:softEdge`}),ge=e=>e.radius!==void 0||e.grow===!1?new n({attributes:{...e.radius!==void 0&&{rad:{key:`rad`,value:e.radius}},...e.grow===!1&&{grow:{key:`grow`,value:0}}},name:`a:blur`}):new n({name:`a:blur`}),_e=e=>{let t=[];return e.blur&&t.push(ge(e.blur)),e.fillOverlay&&t.push(R(e.fillOverlay)),e.glow&&t.push(z(e.glow)),e.innerShadow&&t.push(B(e.innerShadow)),e.outerShadow&&t.push(H(e.outerShadow)),e.presetShadow&&t.push(W(e.presetShadow)),e.reflection&&t.push(G(e.reflection===!0?void 0:e.reflection)),e.softEdge!==void 0&&t.push(K(e.softEdge)),new n({children:t,name:`a:effectLst`})},q=e=>{let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]={key:n,value:r});return Object.keys(t).length>0?t:void 0},ve=e=>new n({name:`a:alphaBiLevel`,attributes:{thresh:{key:`thresh`,value:e.threshold}}}),ye=()=>new n({name:`a:alphaCeiling`}),be=()=>new n({name:`a:alphaFloor`}),xe=e=>new n({name:`a:alphaInv`,children:e?.color?[p(e.color)]:void 0}),Se=e=>e?.amount===void 0?new n({name:`a:alphaModFix`}):new n({name:`a:alphaModFix`,attributes:{amt:{key:`amt`,value:e.amount}}}),Ce=e=>e?.radius===void 0?new n({name:`a:alphaOutset`}):new n({name:`a:alphaOutset`,attributes:{rad:{key:`rad`,value:e.radius}}}),we=e=>new n({name:`a:alphaRepl`,attributes:{a:{key:`a`,value:e.alpha}}}),Te=e=>new n({name:`a:biLevel`,attributes:{thresh:{key:`thresh`,value:e}}}),Ee=e=>new n({name:`a:blend`,attributes:{blend:{key:`blend`,value:e.blend}},children:[J(e.container)]}),De=e=>{let t=[new n({name:`a:clrFrom`,children:[p(e.from)]}),new n({name:`a:clrTo`,children:[p(e.to)]})];return e.useA===!1?new n({name:`a:clrChange`,attributes:{useA:{key:`useA`,value:0}},children:t}):new n({name:`a:clrChange`,children:t})},Oe=e=>new n({name:`a:clrRepl`,children:[p(e)]}),ke=e=>new n({name:`a:duotone`,children:[p(e.color1),p(e.color2)]}),Ae=e=>{let t;return t=e.noFill?E():e.solidFill?m(e.solidFill):e.gradientFill?C(e.gradientFill):e.patternFill?w(e.patternFill):e.groupFill?D():E(),new n({name:`a:fill`,children:[t]})},je=()=>new n({name:`a:grayscl`}),Me=e=>new n({name:`a:hsl`,attributes:q({hue:e?.hue,sat:e?.saturation,lum:e?.luminance})}),Ne=e=>new n({name:`a:lum`,attributes:q({bright:e?.bright,contrast:e?.contrast})}),Pe=e=>new n({name:`a:tint`,attributes:q({hue:e?.hue,amt:e?.amount})}),Fe=e=>new n({name:`a:relOff`,attributes:q({tx:e?.translateX,ty:e?.translateY})}),Ie=e=>new n({name:`a:xfrm`,attributes:q({sx:e?.scaleX,sy:e?.scaleY,kx:e?.skewX,ky:e?.skewY,tx:e?.translateX,ty:e?.translateY})}),Le=e=>new n({name:`a:effect`,attributes:{ref:{key:`ref`,value:e.ref}}}),Re=e=>e.radius!==void 0||e.grow===!1?new n({attributes:{...e.radius!==void 0&&{rad:{key:`rad`,value:e.radius}},...e.grow===!1&&{grow:{key:`grow`,value:0}}},name:`a:blur`}):new n({name:`a:blur`}),J=(e,t=`a:cont`)=>{let r=q({type:e.type,name:e.name}),i=[];if(e.blur&&i.push(Re(e.blur)),e.fillOverlay&&i.push(R(e.fillOverlay)),e.glow&&i.push(z(e.glow)),e.innerShadow&&i.push(B(e.innerShadow)),e.outerShadow&&i.push(H(e.outerShadow)),e.presetShadow&&i.push(W(e.presetShadow)),e.reflection&&i.push(G(e.reflection===!0?void 0:e.reflection)),e.softEdge!==void 0&&i.push(K(e.softEdge)),e.containers)for(let t of e.containers)i.push(J(t));if(e.effectRefs)for(let t of e.effectRefs)i.push(Le(t));return e.alphaBiLevel&&i.push(ve(e.alphaBiLevel)),e.alphaCeiling&&i.push(ye()),e.alphaFloor&&i.push(be()),e.alphaInverse&&i.push(xe(e.alphaInverse)),e.alphaModulate&&i.push(new n({name:`a:alphaMod`,children:[J(e.alphaModulate)]})),e.alphaModulateFixed&&i.push(Se(e.alphaModulateFixed)),e.alphaOutset&&i.push(Ce(e.alphaOutset)),e.alphaReplace&&i.push(we(e.alphaReplace)),e.biLevel&&i.push(Te(e.biLevel.threshold)),e.blend&&i.push(Ee(e.blend)),e.colorChange&&i.push(De(e.colorChange)),e.colorReplace&&i.push(Oe(e.colorReplace)),e.duotone&&i.push(ke(e.duotone)),e.fill&&i.push(Ae(e.fill)),e.grayscale&&i.push(je()),e.hsl&&i.push(Me(e.hsl)),e.luminance&&i.push(Ne(e.luminance)),e.tint&&i.push(Pe(e.tint)),e.relativeOffset&&i.push(Fe(e.relativeOffset)),e.transform&&i.push(Ie(e.transform)),new n({name:t,attributes:r,children:i.length>0?i:void 0})},ze=e=>J(e,`a:effectDag`),Y=e=>new n({name:`a:rot`,attributes:{lat:{key:`lat`,value:e.lat},lon:{key:`lon`,value:e.lon},rev:{key:`rev`,value:e.rev}}}),Be=e=>{let t=[];e.rotation&&t.push(Y(e.rotation));let r={prst:{key:`prst`,value:e.preset}};return e.fov!==void 0&&(r.fov={key:`fov`,value:e.fov}),e.zoom!==void 0&&(r.zoom={key:`zoom`,value:e.zoom}),new n({name:`a:camera`,attributes:r,children:t.length>0?t:void 0})},Ve=e=>{let t=[];return e.rotation&&t.push(Y(e.rotation)),new n({name:`a:lightRig`,attributes:{rig:{key:`rig`,value:e.rig},dir:{key:`dir`,value:e.direction}},children:t.length>0?t:void 0})},He=(e,t)=>new n({name:e,attributes:{x:{key:`x`,value:t.x},y:{key:`y`,value:t.y},z:{key:`z`,value:t.z}}}),X=(e,t)=>new n({name:e,attributes:{dx:{key:`dx`,value:t.dx},dy:{key:`dy`,value:t.dy},dz:{key:`dz`,value:t.dz}}}),Ue=e=>new n({name:`a:backdrop`,children:[He(`a:anchor`,e.anchor),X(`a:norm`,e.normal),X(`a:up`,e.up)]}),We=e=>{let t=[Be(e.camera),Ve(e.lightRig)];return e.backdrop&&t.push(Ue(e.backdrop)),new n({name:`a:scene3d`,children:t})},Z={RELAXED_INSET:`relaxedInset`,CIRCLE:`circle`,SLOPE:`slope`,CROSS:`cross`,ANGLE:`angle`,SOFT_ROUND:`softRound`,CONVEX:`convex`,COOL_SLANT:`coolSlant`,DIVOT:`divot`,RIBLET:`riblet`,HARD_EDGE:`hardEdge`,ART_DECO:`artDeco`},Ge=e=>{if(!e)return new n({name:`a:bevelT`});let t={};return e.w!==void 0&&(t.w={key:`w`,value:e.w}),e.h!==void 0&&(t.h={key:`h`,value:e.h}),e.prst!==void 0&&(t.prst={key:`prst`,value:Z[e.prst]}),new n({attributes:t,name:`a:bevelT`})},Ke=e=>{if(!e)return new n({name:`a:bevelB`});let t={};return e.w!==void 0&&(t.w={key:`w`,value:e.w}),e.h!==void 0&&(t.h={key:`h`,value:e.h}),e.prst!==void 0&&(t.prst={key:`prst`,value:Z[e.prst]}),new n({attributes:t,name:`a:bevelB`})},qe={LEGACY_MATTE:`legacyMatte`,LEGACY_PLASTIC:`legacyPlastic`,LEGACY_METAL:`legacyMetal`,LEGACY_WIREFRAME:`legacyWireframe`,MATTE:`matte`,PLASTIC:`plastic`,METAL:`metal`,WARM_MATTE:`warmMatte`,TRANSLUCENT_POWDER:`translucentPowder`,POWDER:`powder`,DK_EDGE:`dkEdge`,SOFT_EDGE:`softEdge`,CLEAR:`clear`,FLAT:`flat`,SOFT_METAL:`softmetal`},Je=e=>{let t=[];return e.bevelT&&t.push(Ge(e.bevelT)),e.bevelB&&t.push(Ke(e.bevelB)),e.extrusionColor&&t.push(new n({children:[p(e.extrusionColor)],name:`a:extrusionClr`})),e.contourColor&&t.push(new n({children:[p(e.contourColor)],name:`a:contourClr`})),new n({attributes:e.z!==void 0||e.extrusionH!==void 0||e.contourW!==void 0||e.prstMaterial!==void 0?{...e.z!==void 0&&{z:{key:`z`,value:e.z}},...e.extrusionH!==void 0&&{extrusionH:{key:`extrusionH`,value:e.extrusionH}},...e.contourW!==void 0&&{contourW:{key:`contourW`,value:e.contourW}},...e.prstMaterial!==void 0&&{prstMaterial:{key:`prstMaterial`,value:qe[e.prstMaterial]}}}:void 0,children:t,name:`a:sp3d`})},Ye=e=>{let t=[];if(e)for(let r of e)t.push(new n({attributes:{name:{key:`name`,value:r.name},fmla:{key:`fmla`,value:r.formula}},name:`a:gd`}));return new n({children:t,name:`a:avLst`})};var Xe=class extends e{xmlKeys={prst:`prst`}},Ze=class extends t{constructor(e){super(`a:prstGeom`),this.root.push(new Xe({prst:e?.preset??`rect`})),this.root.push(Ye(e?.adjustmentValues))}};const Q=(e,t)=>new n({name:e,children:t.map(e=>new n({attributes:{name:{key:`name`,value:e.name},fmla:{key:`fmla`,value:e.formula}},name:`a:gd`}))}),Qe=(e,t)=>new n({name:e,children:[new n({name:`a:pt`,attributes:{x:{key:`x`,value:t.x},y:{key:`y`,value:t.y}}})]}),$e=e=>{switch(e.command){case`moveTo`:return Qe(`a:moveTo`,e.point);case`lineTo`:return Qe(`a:lnTo`,e.point);case`arcTo`:return new n({name:`a:arcTo`,attributes:{wR:{key:`wR`,value:e.widthRadius},hR:{key:`hR`,value:e.heightRadius},stAng:{key:`stAng`,value:e.startAngle},swAng:{key:`swAng`,value:e.sweepAngle}}});case`quadBezTo`:return new n({name:`a:quadBezTo`,children:e.points.map(e=>new n({name:`a:pt`,attributes:{x:{key:`x`,value:e.x},y:{key:`y`,value:e.y}}}))});case`cubicBezTo`:return new n({name:`a:cubicBezTo`,children:e.points.map(e=>new n({name:`a:pt`,attributes:{x:{key:`x`,value:e.x},y:{key:`y`,value:e.y}}}))});case`close`:return new n({name:`a:close`})}},et=e=>{let t={};return e.w!==void 0&&(t.w={key:`w`,value:e.w}),e.h!==void 0&&(t.h={key:`h`,value:e.h}),e.fill!==void 0&&(t.fill={key:`fill`,value:e.fill}),e.stroke!==void 0&&(t.stroke={key:`stroke`,value:e.stroke}),e.extrusionOk!==void 0&&(t.extrusionOk={key:`extrusionOk`,value:e.extrusionOk}),new n({name:`a:path`,attributes:Object.keys(t).length>0?t:void 0,children:e.commands.map($e)})},$=e=>new n({name:`a:pos`,attributes:{x:{key:`x`,value:e.x},y:{key:`y`,value:e.y}}}),tt=e=>{let t={};return e.guideRefX!==void 0&&(t.gdRefX={key:`gdRefX`,value:e.guideRefX}),e.minX!==void 0&&(t.minX={key:`minX`,value:e.minX}),e.maxX!==void 0&&(t.maxX={key:`maxX`,value:e.maxX}),e.guideRefY!==void 0&&(t.gdRefY={key:`gdRefY`,value:e.guideRefY}),e.minY!==void 0&&(t.minY={key:`minY`,value:e.minY}),e.maxY!==void 0&&(t.maxY={key:`maxY`,value:e.maxY}),new n({name:`a:ahXY`,attributes:Object.keys(t).length>0?t:void 0,children:[$(e.position)]})},nt=e=>{let t={};return e.guideRefRadius!==void 0&&(t.gdRefR={key:`gdRefR`,value:e.guideRefRadius}),e.minRadius!==void 0&&(t.minR={key:`minR`,value:e.minRadius}),e.maxRadius!==void 0&&(t.maxR={key:`maxR`,value:e.maxRadius}),e.guideRefAngle!==void 0&&(t.gdRefAng={key:`gdRefAng`,value:e.guideRefAngle}),e.minAngle!==void 0&&(t.minAng={key:`minAng`,value:e.minAngle}),e.maxAngle!==void 0&&(t.maxAng={key:`maxAng`,value:e.maxAngle}),new n({name:`a:ahPolar`,attributes:Object.keys(t).length>0?t:void 0,children:[$(e.position)]})},rt=e=>new n({name:`a:cxn`,attributes:{ang:{key:`ang`,value:e.angle}},children:[$(e.position)]}),it=e=>new n({name:`a:rect`,attributes:{l:{key:`l`,value:e.left},t:{key:`t`,value:e.top},r:{key:`r`,value:e.right},b:{key:`b`,value:e.bottom}}}),at=e=>{let t=[];return e.adjustmentValues&&t.push(Q(`a:avLst`,e.adjustmentValues)),e.guides&&t.push(Q(`a:gdLst`,e.guides)),e.adjustHandles&&e.adjustHandles.length>0&&t.push(new n({name:`a:ahLst`,children:e.adjustHandles.map(e=>e.type===`xy`?tt(e):nt(e))})),e.connectionSites&&e.connectionSites.length>0&&t.push(new n({name:`a:cxnLst`,children:e.connectionSites.map(rt)})),e.textRect&&t.push(it(e.textRect)),t.push(new n({name:`a:pathLst`,children:e.pathList.map(et)})),new n({name:`a:custGeom`,children:t})},ot=e=>new n({attributes:{asvg:{key:`xmlns:asvg`,value:`http://schemas.microsoft.com/office/drawing/2016/SVG/main`},embed:{key:`r:embed`,value:`{${e}}`}},name:`asvg:svgBlip`}),st=e=>new n({attributes:{uri:{key:`uri`,value:`{96DAC541-7B7A-43D3-8B79-37D633B846F1}`}},children:[ot(e)],name:`a:ext`}),ct=e=>new n({children:[st(e)],name:`a:extLst`}),lt=(e,t)=>{let r=[];return t&&r.push(...h(t)),e.type===`svg`&&e.fallbackFileName&&r.push(ct(e.referenceId)),new n({attributes:{cstate:{key:`cstate`,value:`none`},embed:{key:`r:embed`,value:`{${e.type===`svg`&&e.fallbackFileName?e.fallbackFileName:e.referenceId}}`}},children:r,name:`a:blip`})},ut=(e,t)=>{let r=[];r.push(lt(e,t?.blipEffects)),r.push(g(t?.srcRect)),t?.tile?r.push(y(t.tile)):r.push(new _);let i={};return t?.dpi!==void 0&&(i.dpi={key:`dpi`,value:t.dpi}),t?.rotWithShape!==void 0&&(i.rotWithShape={key:`rotWithShape`,value:+!!t.rotWithShape}),new n({attributes:Object.keys(i).length>0?i:void 0,children:r,name:`pic:blipFill`})};function dt(e){let t={};return e.flipHorizontal!==void 0&&(t.flipH={key:`flipH`,value:e.flipHorizontal}),e.flipVertical!==void 0&&(t.flipV={key:`flipV`,value:e.flipVertical}),e.rotation!==void 0&&(t.rot={key:`rot`,value:e.rotation}),Object.keys(t).length>0?t:void 0}const ft=(e,t=`a:xfrm`)=>{let r=[];return(e.x!==void 0||e.y!==void 0)&&r.push(new n({name:`a:off`,attributes:{x:{key:`x`,value:e.x??0},y:{key:`y`,value:e.y??0}}})),(e.width!==void 0||e.height!==void 0)&&r.push(new n({name:`a:ext`,attributes:{cx:{key:`cx`,value:e.width??0},cy:{key:`cy`,value:e.height??0}}})),new n({name:t,attributes:dt(e),children:r.length>0?r:void 0})},pt=(e,t=`a:xfrm`)=>{let r=ft(e,t);return r.root.push(new n({name:`a:chOff`,attributes:{x:{key:`x`,value:e.childOffsetX??0},y:{key:`y`,value:e.childOffsetY??0}}})),r.root.push(new n({name:`a:chExt`,attributes:{cx:{key:`cx`,value:e.childExtentWidth??0},cy:{key:`cy`,value:e.childExtentHeight??0}}})),r},mt=e=>({emus:{x:r(e.width),y:r(e.height)},flip:e.flip,offset:{emus:{x:r(e.offset?.left??0),y:r(e.offset?.top??0)},pixels:{x:Math.round(e.offset?.left??0),y:Math.round(e.offset?.top??0)}},pixels:{x:Math.round(e.width),y:Math.round(e.height)},rotation:e.rotation?e.rotation*6e4:void 0});export{Z as BevelPresetType,he as BlendMode,P as CompoundLine,N as LineCap,j as LineEndLength,k as LineEndType,A as LineEndWidth,L as LineJoin,b as PathShadeType,F as PenAlignment,s as PresetColor,I as PresetDash,Ze as PresetGeometry,Xe as PresetGeometryAttributes,qe as PresetMaterialType,le as PresetPattern,U as PresetShadowVal,V as RectAlignment,l as SchemeColor,_ as Stretch,d as SystemColor,v as TileAlignment,se as TileFlipMode,fe as buildFill,Ye as createAdjustmentValues,Ge as createBevel,lt as createBlip,h as createBlipEffects,ut as createBlipFill,Ke as createBottomBevel,p as createColorElement,a as createColorTransforms,O as createCustomDash,at as createCustomGeometry,ze as createEffectDag,_e as createEffectList,ct as createExtentionList,R as createFillOverlayEffect,z as createGlowEffect,C as createGradientFill,x as createGradientStop,D as createGroupFill,pt as createGroupTransform2D,o as createHslColor,B as createInnerShadowEffect,M as createLineEnd,E as createNoFill,H as createOuterShadowEffect,me as createOutline,w as createPatternFill,ee as createPresetColor,W as createPresetShadowEffect,G as createReflectionEffect,te as createRgbColor,c as createScRgbColor,We as createScene3D,u as createSchemeColor,Je as createShape3D,K as createSoftEdgeEffect,m as createSolidFill,g as createSourceRectangle,f as createSystemColor,y as createTileInfo,ft as createTransform2D,mt as createTransformation,de as extractBlipFillMedia};