docx 8.4.0 → 8.6.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.
Files changed (74) hide show
  1. package/build/file/core-properties/properties.d.ts +2 -0
  2. package/build/file/document/body/section-properties/properties/line-number.d.ts +3 -5
  3. package/build/file/document-wrapper.d.ts +2 -1
  4. package/build/file/drawing/anchor/anchor.d.ts +5 -1
  5. package/build/file/drawing/drawing.d.ts +4 -2
  6. package/build/file/drawing/effect-extent/effect-extent.d.ts +7 -3
  7. package/build/file/drawing/inline/graphic/graphic-data/graphic-data.d.ts +6 -1
  8. package/build/file/drawing/inline/graphic/graphic-data/pic/blip/blip-extentions.d.ts +3 -0
  9. package/build/file/drawing/inline/graphic/graphic-data/pic/blip/blip.d.ts +1 -3
  10. package/build/file/drawing/inline/graphic/graphic-data/pic/pic.d.ts +6 -1
  11. package/build/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/no-fill.d.ts +1 -3
  12. package/build/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/outline.d.ts +41 -3
  13. package/build/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/rgb-color.d.ts +6 -0
  14. package/build/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/scheme-color.d.ts +25 -0
  15. package/build/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/solid-fill.d.ts +12 -0
  16. package/build/file/drawing/inline/graphic/graphic-data/pic/shape-properties/outline/solid-fill.spec.d.ts +1 -0
  17. package/build/file/drawing/inline/graphic/graphic-data/pic/shape-properties/shape-properties.d.ts +5 -1
  18. package/build/file/drawing/inline/graphic/graphic.d.ts +6 -1
  19. package/build/file/drawing/inline/inline.d.ts +5 -7
  20. package/build/file/drawing/inline/inline.spec.d.ts +1 -0
  21. package/build/file/file.d.ts +3 -0
  22. package/build/file/fonts/create-regular-font.d.ts +8 -0
  23. package/build/file/fonts/font-table.d.ts +10 -0
  24. package/build/file/fonts/font-wrapper.d.ts +16 -0
  25. package/build/file/fonts/font.d.ts +49 -0
  26. package/build/file/fonts/font.spec.d.ts +1 -0
  27. package/build/file/fonts/index.d.ts +1 -0
  28. package/build/file/fonts/obfuscate-ttf-to-odttf.d.ts +2 -0
  29. package/build/file/fonts/obsfuscate-ttf-to-odtts.spec.d.ts +1 -0
  30. package/build/file/index.d.ts +2 -0
  31. package/build/file/media/data.d.ts +12 -3
  32. package/build/file/paragraph/frame/frame-properties.d.ts +4 -39
  33. package/build/file/paragraph/links/pageref-field-instruction.d.ts +1 -1
  34. package/build/file/paragraph/links/pageref.d.ts +4 -1
  35. package/build/file/paragraph/math/n-ary/index.d.ts +3 -0
  36. package/build/file/paragraph/math/n-ary/math-limit-location.d.ts +1 -1
  37. package/build/file/paragraph/math/n-ary/math-limit-lower.d.ts +9 -0
  38. package/build/file/paragraph/math/n-ary/math-limit-lower.spec.d.ts +1 -0
  39. package/build/file/paragraph/math/n-ary/math-limit-upper.d.ts +9 -0
  40. package/build/file/paragraph/math/n-ary/math-limit-upper.spec.d.ts +1 -0
  41. package/build/file/paragraph/math/n-ary/math-limit.d.ts +5 -0
  42. package/build/file/paragraph/math/n-ary/math-limit.spec.d.ts +1 -0
  43. package/build/file/paragraph/math/n-ary/math-n-ary-properties.d.ts +1 -1
  44. package/build/file/paragraph/properties.d.ts +2 -1
  45. package/build/file/paragraph/run/image-run.d.ts +16 -4
  46. package/build/file/paragraph/run/page-number.d.ts +3 -0
  47. package/build/file/paragraph/run/properties.d.ts +20 -1
  48. package/build/file/paragraph/run/run.d.ts +1 -0
  49. package/build/file/paragraph/run/sequential-identifier.d.ts +1 -1
  50. package/build/file/relationships/relationship/relationship.d.ts +1 -1
  51. package/build/file/styles/styles.d.ts +1 -1
  52. package/build/file/table/table-properties/table-cell-margin.d.ts +1 -1
  53. package/build/file/track-revision/track-revision-components/deleted-text-run.d.ts +1 -1
  54. package/build/file/xml-components/imported-xml-component.d.ts +1 -1
  55. package/build/file/xml-components/initializable-xml-component.d.ts +1 -1
  56. package/build/file/xml-components/simple-elements.d.ts +3 -2
  57. package/build/index.cjs +1199 -711
  58. package/build/index.iife.js +1199 -711
  59. package/build/index.mjs +1199 -711
  60. package/build/index.umd.js +1199 -711
  61. package/build/patcher/from-docx.d.ts +18 -4
  62. package/build/patcher/index.d.ts +1 -0
  63. package/build/patcher/patch-detector.d.ts +6 -0
  64. package/build/patcher/patch-detector.spec.d.ts +1 -0
  65. package/build/patcher/replacer.d.ts +7 -2
  66. package/build/patcher/replacer.spec.d.ts +80 -1
  67. package/build/patcher/run-renderer.d.ts +1 -1
  68. package/build/patcher/traverser.d.ts +1 -0
  69. package/build/util/convenience-functions.d.ts +1 -0
  70. package/package.json +15 -15
  71. package/build/file/drawing/effect-extent/effect-extent-attributes.d.ts +0 -14
  72. package/build/file/drawing/inline/inline-attributes.d.ts +0 -10
  73. package/build/file/paragraph/formatting/width.d.ts +0 -0
  74. package/build/file/paragraph/links/pageref-properties.d.ts +0 -4
@@ -2,11 +2,48 @@
2
2
  typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.docx = {}));
3
3
  })(this, function(exports2) {
4
4
  "use strict";var __defProp = Object.defineProperty;
5
+ var __defProps = Object.defineProperties;
6
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
10
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
+ var __spreadValues = (a, b) => {
12
+ for (var prop in b || (b = {}))
13
+ if (__hasOwnProp.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ if (__getOwnPropSymbols)
16
+ for (var prop of __getOwnPropSymbols(b)) {
17
+ if (__propIsEnum.call(b, prop))
18
+ __defNormalProp(a, prop, b[prop]);
19
+ }
20
+ return a;
21
+ };
22
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6
23
  var __publicField = (obj, key, value) => {
7
24
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
8
25
  return value;
9
26
  };
27
+ var __async = (__this, __arguments, generator) => {
28
+ return new Promise((resolve, reject) => {
29
+ var fulfilled = (value) => {
30
+ try {
31
+ step(generator.next(value));
32
+ } catch (e) {
33
+ reject(e);
34
+ }
35
+ };
36
+ var rejected = (value) => {
37
+ try {
38
+ step(generator.throw(value));
39
+ } catch (e) {
40
+ reject(e);
41
+ }
42
+ };
43
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
44
+ step((generator = generator.apply(__this, __arguments)).next());
45
+ });
46
+ };
10
47
 
11
48
  class BaseXmlComponent {
12
49
  constructor(rootKey) {
@@ -41,6 +78,9 @@ var __publicField = (obj, key, value) => {
41
78
  [this.rootKey]: children.length ? children.length === 1 && ((_a = children[0]) == null ? void 0 : _a._attr) ? children[0] : children : EMPTY_OBJECT
42
79
  };
43
80
  }
81
+ /**
82
+ * @deprecated Do not use this method. It is only used internally by the library. It will be removed in a future version.
83
+ */
44
84
  addChildElement(child) {
45
85
  this.root.push(child);
46
86
  return this;
@@ -79,7 +119,7 @@ var __publicField = (obj, key, value) => {
79
119
  this.root = root;
80
120
  }
81
121
  prepForXml(_) {
82
- const attrs = Object.values(this.root).filter(({ value }) => value !== void 0).reduce((acc, { key, value }) => ({ ...acc, [key]: value }), {});
122
+ const attrs = Object.values(this.root).filter(({ value }) => value !== void 0).reduce((acc, { key, value }) => __spreadProps(__spreadValues({}, acc), { [key]: value }), {});
83
123
  return { _attr: attrs };
84
124
  }
85
125
  }
@@ -111,7 +151,7 @@ var __publicField = (obj, key, value) => {
111
151
  }
112
152
  }
113
153
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
114
- function getDefaultExportFromCjs(x) {
154
+ function getDefaultExportFromCjs$1(x) {
115
155
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
116
156
  }
117
157
  var sax$1 = {};
@@ -509,6 +549,177 @@ var __publicField = (obj, key, value) => {
509
549
  };
510
550
  }
511
551
  var inherits_browserExports = inherits_browser.exports;
552
+ function getDefaultExportFromCjs(x) {
553
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
554
+ }
555
+ var browser$1 = { exports: {} };
556
+ var process = browser$1.exports = {};
557
+ var cachedSetTimeout;
558
+ var cachedClearTimeout;
559
+ function defaultSetTimout() {
560
+ throw new Error("setTimeout has not been defined");
561
+ }
562
+ function defaultClearTimeout() {
563
+ throw new Error("clearTimeout has not been defined");
564
+ }
565
+ (function() {
566
+ try {
567
+ if (typeof setTimeout === "function") {
568
+ cachedSetTimeout = setTimeout;
569
+ } else {
570
+ cachedSetTimeout = defaultSetTimout;
571
+ }
572
+ } catch (e) {
573
+ cachedSetTimeout = defaultSetTimout;
574
+ }
575
+ try {
576
+ if (typeof clearTimeout === "function") {
577
+ cachedClearTimeout = clearTimeout;
578
+ } else {
579
+ cachedClearTimeout = defaultClearTimeout;
580
+ }
581
+ } catch (e) {
582
+ cachedClearTimeout = defaultClearTimeout;
583
+ }
584
+ })();
585
+ function runTimeout(fun) {
586
+ if (cachedSetTimeout === setTimeout) {
587
+ return setTimeout(fun, 0);
588
+ }
589
+ if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
590
+ cachedSetTimeout = setTimeout;
591
+ return setTimeout(fun, 0);
592
+ }
593
+ try {
594
+ return cachedSetTimeout(fun, 0);
595
+ } catch (e) {
596
+ try {
597
+ return cachedSetTimeout.call(null, fun, 0);
598
+ } catch (e2) {
599
+ return cachedSetTimeout.call(this, fun, 0);
600
+ }
601
+ }
602
+ }
603
+ function runClearTimeout(marker) {
604
+ if (cachedClearTimeout === clearTimeout) {
605
+ return clearTimeout(marker);
606
+ }
607
+ if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
608
+ cachedClearTimeout = clearTimeout;
609
+ return clearTimeout(marker);
610
+ }
611
+ try {
612
+ return cachedClearTimeout(marker);
613
+ } catch (e) {
614
+ try {
615
+ return cachedClearTimeout.call(null, marker);
616
+ } catch (e2) {
617
+ return cachedClearTimeout.call(this, marker);
618
+ }
619
+ }
620
+ }
621
+ var queue = [];
622
+ var draining = false;
623
+ var currentQueue;
624
+ var queueIndex = -1;
625
+ function cleanUpNextTick() {
626
+ if (!draining || !currentQueue) {
627
+ return;
628
+ }
629
+ draining = false;
630
+ if (currentQueue.length) {
631
+ queue = currentQueue.concat(queue);
632
+ } else {
633
+ queueIndex = -1;
634
+ }
635
+ if (queue.length) {
636
+ drainQueue();
637
+ }
638
+ }
639
+ function drainQueue() {
640
+ if (draining) {
641
+ return;
642
+ }
643
+ var timeout = runTimeout(cleanUpNextTick);
644
+ draining = true;
645
+ var len = queue.length;
646
+ while (len) {
647
+ currentQueue = queue;
648
+ queue = [];
649
+ while (++queueIndex < len) {
650
+ if (currentQueue) {
651
+ currentQueue[queueIndex].run();
652
+ }
653
+ }
654
+ queueIndex = -1;
655
+ len = queue.length;
656
+ }
657
+ currentQueue = null;
658
+ draining = false;
659
+ runClearTimeout(timeout);
660
+ }
661
+ process.nextTick = function(fun) {
662
+ var args = new Array(arguments.length - 1);
663
+ if (arguments.length > 1) {
664
+ for (var i = 1; i < arguments.length; i++) {
665
+ args[i - 1] = arguments[i];
666
+ }
667
+ }
668
+ queue.push(new Item(fun, args));
669
+ if (queue.length === 1 && !draining) {
670
+ runTimeout(drainQueue);
671
+ }
672
+ };
673
+ function Item(fun, array) {
674
+ this.fun = fun;
675
+ this.array = array;
676
+ }
677
+ Item.prototype.run = function() {
678
+ this.fun.apply(null, this.array);
679
+ };
680
+ process.title = "browser";
681
+ process.browser = true;
682
+ process.env = {};
683
+ process.argv = [];
684
+ process.version = "";
685
+ process.versions = {};
686
+ function noop() {
687
+ }
688
+ process.on = noop;
689
+ process.addListener = noop;
690
+ process.once = noop;
691
+ process.off = noop;
692
+ process.removeListener = noop;
693
+ process.removeAllListeners = noop;
694
+ process.emit = noop;
695
+ process.prependListener = noop;
696
+ process.prependOnceListener = noop;
697
+ process.listeners = function(name) {
698
+ return [];
699
+ };
700
+ process.binding = function(name) {
701
+ throw new Error("process.binding is not supported");
702
+ };
703
+ process.cwd = function() {
704
+ return "/";
705
+ };
706
+ process.chdir = function(dir) {
707
+ throw new Error("process.chdir is not supported");
708
+ };
709
+ process.umask = function() {
710
+ return 0;
711
+ };
712
+ var browserExports = browser$1.exports;
713
+ const process$1 = /* @__PURE__ */ getDefaultExportFromCjs(browserExports);
714
+ var streamBrowser;
715
+ var hasRequiredStreamBrowser;
716
+ function requireStreamBrowser() {
717
+ if (hasRequiredStreamBrowser)
718
+ return streamBrowser;
719
+ hasRequiredStreamBrowser = 1;
720
+ streamBrowser = eventsExports.EventEmitter;
721
+ return streamBrowser;
722
+ }
512
723
  var buffer = {};
513
724
  var base64Js = {};
514
725
  var hasRequiredBase64Js;
@@ -2163,209 +2374,20 @@ var __publicField = (obj, key, value) => {
2163
2374
  }
2164
2375
  function numberIsNaN(obj) {
2165
2376
  return obj !== obj;
2166
- }
2167
- var hexSliceLookupTable = function() {
2168
- var alphabet = "0123456789abcdef";
2169
- var table = new Array(256);
2170
- for (var i = 0; i < 16; ++i) {
2171
- var i16 = i * 16;
2172
- for (var j = 0; j < 16; ++j) {
2173
- table[i16 + j] = alphabet[i] + alphabet[j];
2174
- }
2175
- }
2176
- return table;
2177
- }();
2178
- })(buffer);
2179
- return buffer;
2180
- }
2181
- requireBuffer();
2182
- var browser$1 = { exports: {} };
2183
- var process = browser$1.exports = {};
2184
- var cachedSetTimeout;
2185
- var cachedClearTimeout;
2186
- function defaultSetTimout() {
2187
- throw new Error("setTimeout has not been defined");
2188
- }
2189
- function defaultClearTimeout() {
2190
- throw new Error("clearTimeout has not been defined");
2191
- }
2192
- (function() {
2193
- try {
2194
- if (typeof setTimeout === "function") {
2195
- cachedSetTimeout = setTimeout;
2196
- } else {
2197
- cachedSetTimeout = defaultSetTimout;
2198
- }
2199
- } catch (e) {
2200
- cachedSetTimeout = defaultSetTimout;
2201
- }
2202
- try {
2203
- if (typeof clearTimeout === "function") {
2204
- cachedClearTimeout = clearTimeout;
2205
- } else {
2206
- cachedClearTimeout = defaultClearTimeout;
2207
- }
2208
- } catch (e) {
2209
- cachedClearTimeout = defaultClearTimeout;
2210
- }
2211
- })();
2212
- function runTimeout(fun) {
2213
- if (cachedSetTimeout === setTimeout) {
2214
- return setTimeout(fun, 0);
2215
- }
2216
- if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
2217
- cachedSetTimeout = setTimeout;
2218
- return setTimeout(fun, 0);
2219
- }
2220
- try {
2221
- return cachedSetTimeout(fun, 0);
2222
- } catch (e) {
2223
- try {
2224
- return cachedSetTimeout.call(null, fun, 0);
2225
- } catch (e2) {
2226
- return cachedSetTimeout.call(this, fun, 0);
2227
- }
2228
- }
2229
- }
2230
- function runClearTimeout(marker) {
2231
- if (cachedClearTimeout === clearTimeout) {
2232
- return clearTimeout(marker);
2233
- }
2234
- if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
2235
- cachedClearTimeout = clearTimeout;
2236
- return clearTimeout(marker);
2237
- }
2238
- try {
2239
- return cachedClearTimeout(marker);
2240
- } catch (e) {
2241
- try {
2242
- return cachedClearTimeout.call(null, marker);
2243
- } catch (e2) {
2244
- return cachedClearTimeout.call(this, marker);
2245
- }
2246
- }
2247
- }
2248
- var queue = [];
2249
- var draining = false;
2250
- var currentQueue;
2251
- var queueIndex = -1;
2252
- function cleanUpNextTick() {
2253
- if (!draining || !currentQueue) {
2254
- return;
2255
- }
2256
- draining = false;
2257
- if (currentQueue.length) {
2258
- queue = currentQueue.concat(queue);
2259
- } else {
2260
- queueIndex = -1;
2261
- }
2262
- if (queue.length) {
2263
- drainQueue();
2264
- }
2265
- }
2266
- function drainQueue() {
2267
- if (draining) {
2268
- return;
2269
- }
2270
- var timeout = runTimeout(cleanUpNextTick);
2271
- draining = true;
2272
- var len = queue.length;
2273
- while (len) {
2274
- currentQueue = queue;
2275
- queue = [];
2276
- while (++queueIndex < len) {
2277
- if (currentQueue) {
2278
- currentQueue[queueIndex].run();
2279
- }
2280
- }
2281
- queueIndex = -1;
2282
- len = queue.length;
2283
- }
2284
- currentQueue = null;
2285
- draining = false;
2286
- runClearTimeout(timeout);
2287
- }
2288
- process.nextTick = function(fun) {
2289
- var args = new Array(arguments.length - 1);
2290
- if (arguments.length > 1) {
2291
- for (var i = 1; i < arguments.length; i++) {
2292
- args[i - 1] = arguments[i];
2293
- }
2294
- }
2295
- queue.push(new Item(fun, args));
2296
- if (queue.length === 1 && !draining) {
2297
- runTimeout(drainQueue);
2298
- }
2299
- };
2300
- function Item(fun, array) {
2301
- this.fun = fun;
2302
- this.array = array;
2303
- }
2304
- Item.prototype.run = function() {
2305
- this.fun.apply(null, this.array);
2306
- };
2307
- process.title = "browser";
2308
- process.browser = true;
2309
- process.env = {};
2310
- process.argv = [];
2311
- process.version = "";
2312
- process.versions = {};
2313
- function noop() {
2314
- }
2315
- process.on = noop;
2316
- process.addListener = noop;
2317
- process.once = noop;
2318
- process.off = noop;
2319
- process.removeListener = noop;
2320
- process.removeAllListeners = noop;
2321
- process.emit = noop;
2322
- process.prependListener = noop;
2323
- process.prependOnceListener = noop;
2324
- process.listeners = function(name) {
2325
- return [];
2326
- };
2327
- process.binding = function(name) {
2328
- throw new Error("process.binding is not supported");
2329
- };
2330
- process.cwd = function() {
2331
- return "/";
2332
- };
2333
- process.chdir = function(dir) {
2334
- throw new Error("process.chdir is not supported");
2335
- };
2336
- process.umask = function() {
2337
- return 0;
2338
- };
2339
- var browserExports = browser$1.exports;
2340
- const process$1 = /* @__PURE__ */ getDefaultExportFromCjs(browserExports);
2341
- (function(Object2) {
2342
- function get() {
2343
- var _global2 = this || self;
2344
- delete Object2.prototype.__magic__;
2345
- return _global2;
2346
- }
2347
- if (typeof globalThis === "object") {
2348
- return globalThis;
2349
- }
2350
- if (this) {
2351
- return get();
2352
- } else {
2353
- Object2.defineProperty(Object2.prototype, "__magic__", {
2354
- configurable: true,
2355
- get
2356
- });
2357
- var _global = __magic__;
2358
- return _global;
2359
- }
2360
- })(Object);
2361
- var streamBrowser;
2362
- var hasRequiredStreamBrowser;
2363
- function requireStreamBrowser() {
2364
- if (hasRequiredStreamBrowser)
2365
- return streamBrowser;
2366
- hasRequiredStreamBrowser = 1;
2367
- streamBrowser = eventsExports.EventEmitter;
2368
- return streamBrowser;
2377
+ }
2378
+ var hexSliceLookupTable = function() {
2379
+ var alphabet = "0123456789abcdef";
2380
+ var table = new Array(256);
2381
+ for (var i = 0; i < 16; ++i) {
2382
+ var i16 = i * 16;
2383
+ for (var j = 0; j < 16; ++j) {
2384
+ table[i16 + j] = alphabet[i] + alphabet[j];
2385
+ }
2386
+ }
2387
+ return table;
2388
+ }();
2389
+ })(buffer);
2390
+ return buffer;
2369
2391
  }
2370
2392
  var util = {};
2371
2393
  var types = {};
@@ -9428,6 +9450,12 @@ var __publicField = (obj, key, value) => {
9428
9450
  this.root.push(new Attributes({ val }));
9429
9451
  }
9430
9452
  }
9453
+ const createStringElement = (name, value) => new BuilderElement({
9454
+ name,
9455
+ attributes: {
9456
+ value: { key: "w:val", value }
9457
+ }
9458
+ });
9431
9459
  class NumberValueElement extends XmlComponent {
9432
9460
  constructor(name, val) {
9433
9461
  super(name);
@@ -9447,10 +9475,17 @@ var __publicField = (obj, key, value) => {
9447
9475
  }
9448
9476
  }
9449
9477
  class BuilderElement extends XmlComponent {
9450
- constructor(options2) {
9451
- super(options2.name);
9452
- if (options2.attributes) {
9453
- this.root.push(new NextAttributeComponent(options2.attributes));
9478
+ constructor({
9479
+ name,
9480
+ attributes,
9481
+ children
9482
+ }) {
9483
+ super(name);
9484
+ if (attributes) {
9485
+ this.root.push(new NextAttributeComponent(attributes));
9486
+ }
9487
+ if (children) {
9488
+ this.root.push(...children);
9454
9489
  }
9455
9490
  }
9456
9491
  }
@@ -9753,6 +9788,13 @@ var __publicField = (obj, key, value) => {
9753
9788
  this.root.push("SECTIONPAGES");
9754
9789
  }
9755
9790
  }
9791
+ class CurrentSection extends XmlComponent {
9792
+ constructor() {
9793
+ super("w:instrText");
9794
+ this.root.push(new TextAttributes({ space: SpaceType.PRESERVE }));
9795
+ this.root.push("SECTION");
9796
+ }
9797
+ }
9756
9798
  class ShadingAttributes extends XmlAttributeComponent {
9757
9799
  constructor() {
9758
9800
  super(...arguments);
@@ -9996,8 +10038,28 @@ var __publicField = (obj, key, value) => {
9996
10038
  SPARKLE: "sparkle",
9997
10039
  NONE: "none"
9998
10040
  };
10041
+ const HighlightColor = {
10042
+ BLACK: "black",
10043
+ BLUE: "blue",
10044
+ CYAN: "cyan",
10045
+ DARK_BLUE: "darkBlue",
10046
+ DARK_CYAN: "darkCyan",
10047
+ DARK_GRAY: "darkGray",
10048
+ DARK_GREEN: "darkGreen",
10049
+ DARK_MAGENTA: "darkMagenta",
10050
+ DARK_RED: "darkRed",
10051
+ DARK_YELLOW: "darkYellow",
10052
+ GREEN: "green",
10053
+ LIGHT_GRAY: "lightGray",
10054
+ MAGENTA: "magenta",
10055
+ NONE: "none",
10056
+ RED: "red",
10057
+ WHITE: "white",
10058
+ YELLOW: "yellow"
10059
+ };
9999
10060
  class RunProperties extends IgnoreIfEmptyXmlComponent {
10000
10061
  constructor(options2) {
10062
+ var _a, _b;
10001
10063
  super("w:rPr");
10002
10064
  if (!options2) {
10003
10065
  return;
@@ -10009,13 +10071,13 @@ var __publicField = (obj, key, value) => {
10009
10071
  this.push(new OnOffElement("w:b", options2.bold));
10010
10072
  }
10011
10073
  if (options2.boldComplexScript === void 0 && options2.bold !== void 0 || options2.boldComplexScript) {
10012
- this.push(new OnOffElement("w:bCs", options2.boldComplexScript ?? options2.bold));
10074
+ this.push(new OnOffElement("w:bCs", (_a = options2.boldComplexScript) != null ? _a : options2.bold));
10013
10075
  }
10014
10076
  if (options2.italics !== void 0) {
10015
10077
  this.push(new OnOffElement("w:i", options2.italics));
10016
10078
  }
10017
10079
  if (options2.italicsComplexScript === void 0 && options2.italics !== void 0 || options2.italicsComplexScript) {
10018
- this.push(new OnOffElement("w:iCs", options2.italicsComplexScript ?? options2.italics));
10080
+ this.push(new OnOffElement("w:iCs", (_b = options2.italicsComplexScript) != null ? _b : options2.italics));
10019
10081
  }
10020
10082
  if (options2.underline) {
10021
10083
  this.push(new Underline(options2.underline.type, options2.underline.color));
@@ -10137,22 +10199,22 @@ var __publicField = (obj, key, value) => {
10137
10199
  }
10138
10200
  class Text extends XmlComponent {
10139
10201
  constructor(options2) {
10202
+ var _a;
10140
10203
  super("w:t");
10141
10204
  if (typeof options2 === "string") {
10142
10205
  this.root.push(new TextAttributes({ space: SpaceType.PRESERVE }));
10143
10206
  this.root.push(options2);
10144
- return this;
10145
10207
  } else {
10146
- this.root.push(new TextAttributes({ space: options2.space ?? SpaceType.DEFAULT }));
10208
+ this.root.push(new TextAttributes({ space: (_a = options2.space) != null ? _a : SpaceType.DEFAULT }));
10147
10209
  this.root.push(options2.text);
10148
- return this;
10149
10210
  }
10150
10211
  }
10151
10212
  }
10152
10213
  const PageNumber = {
10153
10214
  CURRENT: "CURRENT",
10154
10215
  TOTAL_PAGES: "TOTAL_PAGES",
10155
- TOTAL_PAGES_IN_SECTION: "TOTAL_PAGES_IN_SECTION"
10216
+ TOTAL_PAGES_IN_SECTION: "TOTAL_PAGES_IN_SECTION",
10217
+ CURRENT_SECTION: "SECTION"
10156
10218
  };
10157
10219
  class Run extends XmlComponent {
10158
10220
  constructor(options2) {
@@ -10187,6 +10249,12 @@ var __publicField = (obj, key, value) => {
10187
10249
  this.root.push(new Separate());
10188
10250
  this.root.push(new End());
10189
10251
  break;
10252
+ case PageNumber.CURRENT_SECTION:
10253
+ this.root.push(new Begin());
10254
+ this.root.push(new CurrentSection());
10255
+ this.root.push(new Separate());
10256
+ this.root.push(new End());
10257
+ break;
10190
10258
  default:
10191
10259
  this.root.push(new Text(child));
10192
10260
  break;
@@ -10237,6 +10305,16 @@ var __publicField = (obj, key, value) => {
10237
10305
  }
10238
10306
  }
10239
10307
  let urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
10308
+ let customAlphabet = (alphabet, defaultSize = 21) => {
10309
+ return (size = defaultSize) => {
10310
+ let id = "";
10311
+ let i = size;
10312
+ while (i--) {
10313
+ id += alphabet[Math.random() * alphabet.length | 0];
10314
+ }
10315
+ return id;
10316
+ };
10317
+ };
10240
10318
  let nanoid = (size = 21) => {
10241
10319
  let id = "";
10242
10320
  let i = size;
@@ -10256,6 +10334,8 @@ var __publicField = (obj, key, value) => {
10256
10334
  const docPropertiesUniqueNumericIdGen = () => uniqueNumericIdCreator();
10257
10335
  const bookmarkUniqueNumericIdGen = () => uniqueNumericIdCreator();
10258
10336
  const uniqueId = () => nanoid().toLowerCase();
10337
+ const generateUuidPart = (count) => customAlphabet("1234567890abcdef", count)();
10338
+ const uniqueUuid = () => `${generateUuidPart(8)}-${generateUuidPart(4)}-${generateUuidPart(4)}-${generateUuidPart(4)}-${generateUuidPart(12)}`;
10259
10339
  const HorizontalPositionRelativeFrom = {
10260
10340
  CHARACTER: "character",
10261
10341
  COLUMN: "column",
@@ -10366,26 +10446,47 @@ var __publicField = (obj, key, value) => {
10366
10446
  });
10367
10447
  }
10368
10448
  }
10369
- class BlipAttributes extends XmlAttributeComponent {
10370
- constructor() {
10371
- super(...arguments);
10372
- __publicField(this, "xmlKeys", {
10373
- embed: "r:embed",
10374
- cstate: "cstate"
10375
- });
10376
- }
10377
- }
10378
- class Blip extends XmlComponent {
10379
- constructor(mediaData) {
10380
- super("a:blip");
10381
- this.root.push(
10382
- new BlipAttributes({
10383
- embed: `rId{${mediaData.fileName}}`,
10384
- cstate: "none"
10385
- })
10386
- );
10449
+ const createSvgBlip = (mediaData) => new BuilderElement({
10450
+ name: "asvg:svgBlip",
10451
+ attributes: {
10452
+ asvg: {
10453
+ key: "xmlns:asvg",
10454
+ value: "http://schemas.microsoft.com/office/drawing/2016/SVG/main"
10455
+ },
10456
+ embed: {
10457
+ key: "r:embed",
10458
+ value: `rId{${mediaData.fileName}}`
10459
+ }
10387
10460
  }
10388
- }
10461
+ });
10462
+ const createExtention = (mediaData) => new BuilderElement({
10463
+ name: "a:ext",
10464
+ attributes: {
10465
+ uri: {
10466
+ key: "uri",
10467
+ value: "{96DAC541-7B7A-43D3-8B79-37D633B846F1}"
10468
+ }
10469
+ },
10470
+ children: [createSvgBlip(mediaData)]
10471
+ });
10472
+ const createExtentionList = (mediaData) => new BuilderElement({
10473
+ name: "a:extLst",
10474
+ children: [createExtention(mediaData)]
10475
+ });
10476
+ const createBlip = (mediaData) => new BuilderElement({
10477
+ name: "a:blip",
10478
+ attributes: {
10479
+ embed: {
10480
+ key: "r:embed",
10481
+ value: `rId{${mediaData.type === "svg" ? mediaData.fallback.fileName : mediaData.fileName}}`
10482
+ },
10483
+ cstate: {
10484
+ key: "cstate",
10485
+ value: "none"
10486
+ }
10487
+ },
10488
+ children: mediaData.type === "svg" ? [createExtentionList(mediaData)] : []
10489
+ });
10389
10490
  class SourceRectangle extends XmlComponent {
10390
10491
  constructor() {
10391
10492
  super("a:srcRect");
@@ -10405,7 +10506,7 @@ var __publicField = (obj, key, value) => {
10405
10506
  class BlipFill extends XmlComponent {
10406
10507
  constructor(mediaData) {
10407
10508
  super("pic:blipFill");
10408
- this.root.push(new Blip(mediaData));
10509
+ this.root.push(createBlip(mediaData));
10409
10510
  this.root.push(new SourceRectangle());
10410
10511
  this.root.push(new Stretch());
10411
10512
  }
@@ -10438,18 +10539,17 @@ var __publicField = (obj, key, value) => {
10438
10539
  }
10439
10540
  const createHyperlinkClick = (linkId, hasXmlNs) => new BuilderElement({
10440
10541
  name: "a:hlinkClick",
10441
- attributes: {
10442
- ...hasXmlNs ? {
10443
- xmlns: {
10444
- key: "xmlns:a",
10445
- value: "http://schemas.openxmlformats.org/drawingml/2006/main"
10446
- }
10447
- } : {},
10542
+ attributes: __spreadProps(__spreadValues({}, hasXmlNs ? {
10543
+ xmlns: {
10544
+ key: "xmlns:a",
10545
+ value: "http://schemas.openxmlformats.org/drawingml/2006/main"
10546
+ }
10547
+ } : {}), {
10448
10548
  id: {
10449
10549
  key: "r:id",
10450
10550
  value: `rId${linkId}`
10451
10551
  }
10452
- }
10552
+ })
10453
10553
  });
10454
10554
  class NonVisualPropertiesAttributes extends XmlAttributeComponent {
10455
10555
  constructor() {
@@ -10566,6 +10666,59 @@ var __publicField = (obj, key, value) => {
10566
10666
  this.root.push(this.extents);
10567
10667
  }
10568
10668
  }
10669
+ const createNoFill = () => new BuilderElement({ name: "a:noFill" });
10670
+ const createSchemeColor = (options2) => new BuilderElement({
10671
+ name: "a:schemeClr",
10672
+ attributes: {
10673
+ value: {
10674
+ key: "val",
10675
+ value: options2.value
10676
+ }
10677
+ }
10678
+ });
10679
+ const createSolidRgbColor = (options2) => new BuilderElement({
10680
+ name: "a:srgbClr",
10681
+ attributes: {
10682
+ value: {
10683
+ key: "val",
10684
+ value: options2.value
10685
+ }
10686
+ }
10687
+ });
10688
+ const createSolidFill = (options2) => new BuilderElement({
10689
+ name: "a:solidFill",
10690
+ children: [options2.type === "rgb" ? createSolidRgbColor(options2) : createSchemeColor(options2)]
10691
+ });
10692
+ const createOutline = (options2) => new BuilderElement({
10693
+ name: "a:ln",
10694
+ attributes: {
10695
+ width: {
10696
+ key: "w",
10697
+ value: options2.width
10698
+ },
10699
+ cap: {
10700
+ key: "cap",
10701
+ value: options2.cap
10702
+ },
10703
+ compoundLine: {
10704
+ key: "cmpd",
10705
+ value: options2.compoundLine
10706
+ },
10707
+ align: {
10708
+ key: "algn",
10709
+ value: options2.align
10710
+ }
10711
+ },
10712
+ children: [
10713
+ options2.type === "noFill" ? createNoFill() : options2.solidFillType === "rgb" ? createSolidFill({
10714
+ type: "rgb",
10715
+ value: options2.value
10716
+ }) : createSolidFill({
10717
+ type: "scheme",
10718
+ value: options2.value
10719
+ })
10720
+ ]
10721
+ });
10569
10722
  class AdjustmentValues extends XmlComponent {
10570
10723
  constructor() {
10571
10724
  super("a:avLst");
@@ -10599,7 +10752,7 @@ var __publicField = (obj, key, value) => {
10599
10752
  }
10600
10753
  }
10601
10754
  class ShapeProperties extends XmlComponent {
10602
- constructor(transform) {
10755
+ constructor({ outline, transform }) {
10603
10756
  super("pic:spPr");
10604
10757
  __publicField(this, "form");
10605
10758
  this.root.push(
@@ -10610,10 +10763,18 @@ var __publicField = (obj, key, value) => {
10610
10763
  this.form = new Form(transform);
10611
10764
  this.root.push(this.form);
10612
10765
  this.root.push(new PresetGeometry());
10766
+ if (outline) {
10767
+ this.root.push(createNoFill());
10768
+ this.root.push(createOutline(outline));
10769
+ }
10613
10770
  }
10614
10771
  }
10615
10772
  class Pic extends XmlComponent {
10616
- constructor(mediaData, transform) {
10773
+ constructor({
10774
+ mediaData,
10775
+ transform,
10776
+ outline
10777
+ }) {
10617
10778
  super("pic:pic");
10618
10779
  this.root.push(
10619
10780
  new PicAttributes({
@@ -10622,11 +10783,15 @@ var __publicField = (obj, key, value) => {
10622
10783
  );
10623
10784
  this.root.push(new NonVisualPicProperties());
10624
10785
  this.root.push(new BlipFill(mediaData));
10625
- this.root.push(new ShapeProperties(transform));
10786
+ this.root.push(new ShapeProperties({ transform, outline }));
10626
10787
  }
10627
10788
  }
10628
10789
  class GraphicData extends XmlComponent {
10629
- constructor(mediaData, transform) {
10790
+ constructor({
10791
+ mediaData,
10792
+ transform,
10793
+ outline
10794
+ }) {
10630
10795
  super("a:graphicData");
10631
10796
  __publicField(this, "pic");
10632
10797
  this.root.push(
@@ -10634,7 +10799,7 @@ var __publicField = (obj, key, value) => {
10634
10799
  uri: "http://schemas.openxmlformats.org/drawingml/2006/picture"
10635
10800
  })
10636
10801
  );
10637
- this.pic = new Pic(mediaData, transform);
10802
+ this.pic = new Pic({ mediaData, transform, outline });
10638
10803
  this.root.push(this.pic);
10639
10804
  }
10640
10805
  }
@@ -10647,7 +10812,11 @@ var __publicField = (obj, key, value) => {
10647
10812
  }
10648
10813
  }
10649
10814
  class Graphic extends XmlComponent {
10650
- constructor(mediaData, transform) {
10815
+ constructor({
10816
+ mediaData,
10817
+ transform,
10818
+ outline
10819
+ }) {
10651
10820
  super("a:graphic");
10652
10821
  __publicField(this, "data");
10653
10822
  this.root.push(
@@ -10655,7 +10824,7 @@ var __publicField = (obj, key, value) => {
10655
10824
  a: "http://schemas.openxmlformats.org/drawingml/2006/main"
10656
10825
  })
10657
10826
  );
10658
- this.data = new GraphicData(mediaData, transform);
10827
+ this.data = new GraphicData({ mediaData, transform, outline });
10659
10828
  this.root.push(this.data);
10660
10829
  }
10661
10830
  }
@@ -10790,30 +10959,27 @@ var __publicField = (obj, key, value) => {
10790
10959
  return super.prepForXml(context);
10791
10960
  }
10792
10961
  }
10793
- class EffectExtentAttributes extends XmlAttributeComponent {
10794
- constructor() {
10795
- super(...arguments);
10796
- __publicField(this, "xmlKeys", {
10797
- b: "b",
10798
- l: "l",
10799
- r: "r",
10800
- t: "t"
10801
- });
10802
- }
10803
- }
10804
- class EffectExtent extends XmlComponent {
10805
- constructor() {
10806
- super("wp:effectExtent");
10807
- this.root.push(
10808
- new EffectExtentAttributes({
10809
- b: 0,
10810
- l: 0,
10811
- r: 0,
10812
- t: 0
10813
- })
10814
- );
10962
+ const createEffectExtent = ({ top, right, bottom, left }) => new BuilderElement({
10963
+ name: "wp:effectExtent",
10964
+ attributes: {
10965
+ top: {
10966
+ key: "t",
10967
+ value: top
10968
+ },
10969
+ right: {
10970
+ key: "r",
10971
+ value: right
10972
+ },
10973
+ bottom: {
10974
+ key: "b",
10975
+ value: bottom
10976
+ },
10977
+ left: {
10978
+ key: "l",
10979
+ value: left
10980
+ }
10815
10981
  }
10816
- }
10982
+ });
10817
10983
  class ExtentAttributes extends XmlAttributeComponent {
10818
10984
  constructor() {
10819
10985
  super(...arguments);
@@ -10878,17 +11044,20 @@ var __publicField = (obj, key, value) => {
10878
11044
  }
10879
11045
  }
10880
11046
  class Anchor extends XmlComponent {
10881
- constructor(mediaData, transform, drawingOptions) {
11047
+ constructor({
11048
+ mediaData,
11049
+ transform,
11050
+ drawingOptions
11051
+ }) {
10882
11052
  super("wp:anchor");
10883
- const floating = {
11053
+ const floating = __spreadValues({
10884
11054
  allowOverlap: true,
10885
11055
  behindDocument: false,
10886
11056
  lockAnchor: false,
10887
11057
  layoutInCell: true,
10888
11058
  verticalPosition: {},
10889
- horizontalPosition: {},
10890
- ...drawingOptions.floating
10891
- };
11059
+ horizontalPosition: {}
11060
+ }, drawingOptions.floating);
10892
11061
  this.root.push(
10893
11062
  new AnchorAttributes({
10894
11063
  distT: floating.margins ? floating.margins.top || 0 : 0,
@@ -10908,7 +11077,7 @@ var __publicField = (obj, key, value) => {
10908
11077
  this.root.push(new HorizontalPosition(floating.horizontalPosition));
10909
11078
  this.root.push(new VerticalPosition(floating.verticalPosition));
10910
11079
  this.root.push(new Extent(transform.emus.x, transform.emus.y));
10911
- this.root.push(new EffectExtent());
11080
+ this.root.push(createEffectExtent({ top: 0, right: 0, bottom: 0, left: 0 }));
10912
11081
  if (drawingOptions.floating !== void 0 && drawingOptions.floating.wrap !== void 0) {
10913
11082
  switch (drawingOptions.floating.wrap.type) {
10914
11083
  case TextWrappingType.SQUARE:
@@ -10929,98 +11098,128 @@ var __publicField = (obj, key, value) => {
10929
11098
  }
10930
11099
  this.root.push(new DocProperties(drawingOptions.docProperties));
10931
11100
  this.root.push(new GraphicFrameProperties());
10932
- this.root.push(new Graphic(mediaData, transform));
10933
- }
10934
- }
10935
- class InlineAttributes extends XmlAttributeComponent {
10936
- constructor() {
10937
- super(...arguments);
10938
- __publicField(this, "xmlKeys", {
10939
- distT: "distT",
10940
- distB: "distB",
10941
- distL: "distL",
10942
- distR: "distR"
10943
- });
10944
- }
10945
- }
10946
- class Inline extends XmlComponent {
10947
- constructor({ mediaData, transform, docProperties }) {
10948
- super("wp:inline");
10949
- __publicField(this, "extent");
10950
- __publicField(this, "graphic");
10951
- this.root.push(
10952
- new InlineAttributes({
10953
- distT: 0,
10954
- distB: 0,
10955
- distL: 0,
10956
- distR: 0
10957
- })
10958
- );
10959
- this.extent = new Extent(transform.emus.x, transform.emus.y);
10960
- this.graphic = new Graphic(mediaData, transform);
10961
- this.root.push(this.extent);
10962
- this.root.push(new EffectExtent());
10963
- this.root.push(new DocProperties(docProperties));
10964
- this.root.push(new GraphicFrameProperties());
10965
- this.root.push(this.graphic);
11101
+ this.root.push(new Graphic({ mediaData, transform, outline: drawingOptions.outline }));
10966
11102
  }
10967
11103
  }
11104
+ const createInline = ({ mediaData, transform, docProperties, outline }) => {
11105
+ var _a, _b, _c, _d;
11106
+ return new BuilderElement({
11107
+ name: "wp:inline",
11108
+ attributes: {
11109
+ distanceTop: {
11110
+ key: "distT",
11111
+ value: 0
11112
+ },
11113
+ distanceBottom: {
11114
+ key: "distB",
11115
+ value: 0
11116
+ },
11117
+ distanceLeft: {
11118
+ key: "distL",
11119
+ value: 0
11120
+ },
11121
+ distanceRight: {
11122
+ key: "distR",
11123
+ value: 0
11124
+ }
11125
+ },
11126
+ children: [
11127
+ new Extent(transform.emus.x, transform.emus.y),
11128
+ createEffectExtent(
11129
+ outline ? {
11130
+ top: ((_a = outline.width) != null ? _a : 9525) * 2,
11131
+ right: ((_b = outline.width) != null ? _b : 9525) * 2,
11132
+ bottom: ((_c = outline.width) != null ? _c : 9525) * 2,
11133
+ left: ((_d = outline.width) != null ? _d : 9525) * 2
11134
+ } : { top: 0, right: 0, bottom: 0, left: 0 }
11135
+ ),
11136
+ new DocProperties(docProperties),
11137
+ new GraphicFrameProperties(),
11138
+ new Graphic({ mediaData, transform, outline })
11139
+ ]
11140
+ });
11141
+ };
10968
11142
  class Drawing extends XmlComponent {
10969
11143
  constructor(imageData, drawingOptions = {}) {
10970
11144
  super("w:drawing");
10971
11145
  if (!drawingOptions.floating) {
10972
- const inline = new Inline({
10973
- mediaData: imageData,
10974
- transform: imageData.transformation,
10975
- docProperties: drawingOptions.docProperties
10976
- });
10977
- this.root.push(inline);
11146
+ this.root.push(
11147
+ createInline({
11148
+ mediaData: imageData,
11149
+ transform: imageData.transformation,
11150
+ docProperties: drawingOptions.docProperties,
11151
+ outline: drawingOptions.outline
11152
+ })
11153
+ );
10978
11154
  } else {
10979
- this.root.push(new Anchor(imageData, imageData.transformation, drawingOptions));
11155
+ this.root.push(new Anchor({ mediaData: imageData, transform: imageData.transformation, drawingOptions }));
10980
11156
  }
10981
11157
  }
10982
11158
  }
11159
+ const convertDataURIToBinary = (dataURI) => {
11160
+ if (typeof atob === "function") {
11161
+ const BASE64_MARKER = ";base64,";
11162
+ const base64Index = dataURI.indexOf(BASE64_MARKER);
11163
+ const base64IndexWithOffset = base64Index === -1 ? 0 : base64Index + BASE64_MARKER.length;
11164
+ return new Uint8Array(
11165
+ atob(dataURI.substring(base64IndexWithOffset)).split("").map((c) => c.charCodeAt(0))
11166
+ );
11167
+ } else {
11168
+ const b = require("buffer");
11169
+ return new b.Buffer(dataURI, "base64");
11170
+ }
11171
+ };
11172
+ const standardizeData = (data) => typeof data === "string" ? convertDataURIToBinary(data) : data;
11173
+ const createImageData = (options2, key) => ({
11174
+ data: standardizeData(options2.data),
11175
+ fileName: key,
11176
+ transformation: {
11177
+ pixels: {
11178
+ x: Math.round(options2.transformation.width),
11179
+ y: Math.round(options2.transformation.height)
11180
+ },
11181
+ emus: {
11182
+ x: Math.round(options2.transformation.width * 9525),
11183
+ y: Math.round(options2.transformation.height * 9525)
11184
+ },
11185
+ flip: options2.transformation.flip,
11186
+ rotation: options2.transformation.rotation ? options2.transformation.rotation * 6e4 : void 0
11187
+ }
11188
+ });
10983
11189
  class ImageRun extends Run {
10984
11190
  constructor(options2) {
10985
11191
  super({});
10986
- __publicField(this, "key", `${uniqueId()}.png`);
11192
+ __publicField(this, "key");
11193
+ __publicField(this, "fallbackKey", `${uniqueId()}.png`);
10987
11194
  __publicField(this, "imageData");
10988
- const newData = typeof options2.data === "string" ? this.convertDataURIToBinary(options2.data) : options2.data;
10989
- this.imageData = {
10990
- stream: newData,
10991
- fileName: this.key,
10992
- transformation: {
10993
- pixels: {
10994
- x: Math.round(options2.transformation.width),
10995
- y: Math.round(options2.transformation.height)
10996
- },
10997
- emus: {
10998
- x: Math.round(options2.transformation.width * 9525),
10999
- y: Math.round(options2.transformation.height * 9525)
11000
- },
11001
- flip: options2.transformation.flip,
11002
- rotation: options2.transformation.rotation ? options2.transformation.rotation * 6e4 : void 0
11003
- }
11004
- };
11005
- const drawing = new Drawing(this.imageData, { floating: options2.floating, docProperties: options2.altText });
11195
+ this.key = `${uniqueId()}.${options2.type}`;
11196
+ this.imageData = options2.type === "svg" ? __spreadProps(__spreadValues({
11197
+ type: options2.type
11198
+ }, createImageData(options2, this.key)), {
11199
+ fallback: __spreadValues({
11200
+ type: options2.fallback.type
11201
+ }, createImageData(
11202
+ __spreadProps(__spreadValues({}, options2.fallback), {
11203
+ transformation: options2.transformation
11204
+ }),
11205
+ this.fallbackKey
11206
+ ))
11207
+ }) : __spreadValues({
11208
+ type: options2.type
11209
+ }, createImageData(options2, this.key));
11210
+ const drawing = new Drawing(this.imageData, {
11211
+ floating: options2.floating,
11212
+ docProperties: options2.altText,
11213
+ outline: options2.outline
11214
+ });
11006
11215
  this.root.push(drawing);
11007
11216
  }
11008
11217
  prepForXml(context) {
11009
11218
  context.file.Media.addImage(this.key, this.imageData);
11010
- return super.prepForXml(context);
11011
- }
11012
- convertDataURIToBinary(dataURI) {
11013
- if (typeof atob === "function") {
11014
- const BASE64_MARKER = ";base64,";
11015
- const base64Index = dataURI.indexOf(BASE64_MARKER);
11016
- const base64IndexWithOffset = base64Index === -1 ? 0 : base64Index + BASE64_MARKER.length;
11017
- return new Uint8Array(
11018
- atob(dataURI.substring(base64IndexWithOffset)).split("").map((c) => c.charCodeAt(0))
11019
- );
11020
- } else {
11021
- const b = require("buffer");
11022
- return new b.Buffer(dataURI, "base64");
11219
+ if (this.imageData.type === "svg") {
11220
+ context.file.Media.addImage(this.fallbackKey, this.imageData.fallback);
11023
11221
  }
11222
+ return super.prepForXml(context);
11024
11223
  }
11025
11224
  }
11026
11225
  class SequentialIdentifierInstruction extends XmlComponent {
@@ -11716,22 +11915,18 @@ var __publicField = (obj, key, value) => {
11716
11915
  NEW_SECTION: "newSection",
11717
11916
  CONTINUOUS: "continuous"
11718
11917
  };
11719
- class LineNumberType extends XmlComponent {
11720
- constructor({ countBy, start, restart, distance }) {
11721
- super("w:lnNumType");
11722
- this.root.push(
11723
- new NextAttributeComponent({
11724
- countBy: { key: "w:countBy", value: countBy === void 0 ? void 0 : decimalNumber(countBy) },
11725
- start: { key: "w:start", value: start === void 0 ? void 0 : decimalNumber(start) },
11726
- restart: { key: "w:restart", value: restart },
11727
- distance: {
11728
- key: "w:distance",
11729
- value: distance === void 0 ? void 0 : twipsMeasureValue(distance)
11730
- }
11731
- })
11732
- );
11918
+ const createLineNumberType = ({ countBy, start, restart, distance }) => new BuilderElement({
11919
+ name: "w:lnNumType",
11920
+ attributes: {
11921
+ countBy: { key: "w:countBy", value: countBy === void 0 ? void 0 : decimalNumber(countBy) },
11922
+ start: { key: "w:start", value: start === void 0 ? void 0 : decimalNumber(start) },
11923
+ restart: { key: "w:restart", value: restart },
11924
+ distance: {
11925
+ key: "w:distance",
11926
+ value: distance === void 0 ? void 0 : twipsMeasureValue(distance)
11927
+ }
11733
11928
  }
11734
- }
11929
+ });
11735
11930
  const PageBorderDisplay = {
11736
11931
  ALL_PAGES: "allPages",
11737
11932
  FIRST_PAGE: "firstPage",
@@ -11947,7 +12142,7 @@ var __publicField = (obj, key, value) => {
11947
12142
  this.root.push(new PageBorders(borders));
11948
12143
  }
11949
12144
  if (lineNumbers) {
11950
- this.root.push(new LineNumberType(lineNumbers));
12145
+ this.root.push(createLineNumberType(lineNumbers));
11951
12146
  }
11952
12147
  this.root.push(new PageNumberType(pageNumbers));
11953
12148
  if (column) {
@@ -12236,55 +12431,77 @@ var __publicField = (obj, key, value) => {
12236
12431
  THROUGH: "through",
12237
12432
  TIGHT: "tight"
12238
12433
  };
12239
- class FramePropertiesAttributes extends XmlAttributeComponent {
12240
- constructor() {
12241
- super(...arguments);
12242
- __publicField(this, "xmlKeys", {
12243
- anchorLock: "w:anchorLock",
12244
- dropCap: "w:dropCap",
12245
- width: "w:w",
12246
- height: "w:h",
12247
- x: "w:x",
12248
- y: "w:y",
12249
- anchorHorizontal: "w:hAnchor",
12250
- anchorVertical: "w:vAnchor",
12251
- spaceHorizontal: "w:hSpace",
12252
- spaceVertical: "w:vSpace",
12253
- rule: "w:hRule",
12254
- alignmentX: "w:xAlign",
12255
- alignmentY: "w:yAlign",
12256
- lines: "w:lines",
12257
- wrap: "w:wrap"
12258
- });
12259
- }
12260
- }
12261
- class FrameProperties extends XmlComponent {
12262
- constructor(options2) {
12263
- var _a, _b;
12264
- super("w:framePr");
12265
- this.root.push(
12266
- new FramePropertiesAttributes({
12267
- anchorLock: options2.anchorLock,
12268
- dropCap: options2.dropCap,
12269
- width: options2.width,
12270
- height: options2.height,
12271
- x: options2.position ? options2.position.x : void 0,
12272
- y: options2.position ? options2.position.y : void 0,
12273
- anchorHorizontal: options2.anchor.horizontal,
12274
- anchorVertical: options2.anchor.vertical,
12275
- spaceHorizontal: (_a = options2.space) == null ? void 0 : _a.horizontal,
12276
- spaceVertical: (_b = options2.space) == null ? void 0 : _b.vertical,
12277
- rule: options2.rule,
12278
- alignmentX: options2.alignment ? options2.alignment.x : void 0,
12279
- alignmentY: options2.alignment ? options2.alignment.y : void 0,
12280
- lines: options2.lines,
12281
- wrap: options2.wrap
12282
- })
12283
- );
12284
- }
12285
- }
12434
+ const createFrameProperties = (options2) => {
12435
+ var _a, _b;
12436
+ return new BuilderElement({
12437
+ name: "w:framePr",
12438
+ attributes: {
12439
+ anchorLock: {
12440
+ key: "w:anchorLock",
12441
+ value: options2.anchorLock
12442
+ },
12443
+ dropCap: {
12444
+ key: "w:dropCap",
12445
+ value: options2.dropCap
12446
+ },
12447
+ width: {
12448
+ key: "w:w",
12449
+ value: options2.width
12450
+ },
12451
+ height: {
12452
+ key: "w:h",
12453
+ value: options2.height
12454
+ },
12455
+ x: {
12456
+ key: "w:x",
12457
+ value: options2.position ? options2.position.x : void 0
12458
+ },
12459
+ y: {
12460
+ key: "w:y",
12461
+ value: options2.position ? options2.position.y : void 0
12462
+ },
12463
+ anchorHorizontal: {
12464
+ key: "w:hAnchor",
12465
+ value: options2.anchor.horizontal
12466
+ },
12467
+ anchorVertical: {
12468
+ key: "w:vAnchor",
12469
+ value: options2.anchor.vertical
12470
+ },
12471
+ spaceHorizontal: {
12472
+ key: "w:hSpace",
12473
+ value: (_a = options2.space) == null ? void 0 : _a.horizontal
12474
+ },
12475
+ spaceVertical: {
12476
+ key: "w:vSpace",
12477
+ value: (_b = options2.space) == null ? void 0 : _b.vertical
12478
+ },
12479
+ rule: {
12480
+ key: "w:hRule",
12481
+ value: options2.rule
12482
+ },
12483
+ alignmentX: {
12484
+ key: "w:xAlign",
12485
+ value: options2.alignment ? options2.alignment.x : void 0
12486
+ },
12487
+ alignmentY: {
12488
+ key: "w:yAlign",
12489
+ value: options2.alignment ? options2.alignment.y : void 0
12490
+ },
12491
+ lines: {
12492
+ key: "w:lines",
12493
+ value: options2.lines
12494
+ },
12495
+ wrap: {
12496
+ key: "w:wrap",
12497
+ value: options2.wrap
12498
+ }
12499
+ }
12500
+ });
12501
+ };
12286
12502
  class ParagraphProperties extends IgnoreIfEmptyXmlComponent {
12287
12503
  constructor(options2) {
12504
+ var _a, _b;
12288
12505
  super("w:pPr");
12289
12506
  // eslint-disable-next-line functional/prefer-readonly-type
12290
12507
  __publicField(this, "numberingReferences", []);
@@ -12317,7 +12534,7 @@ var __publicField = (obj, key, value) => {
12317
12534
  this.push(new PageBreakBefore());
12318
12535
  }
12319
12536
  if (options2.frame) {
12320
- this.push(new FrameProperties(options2.frame));
12537
+ this.push(createFrameProperties(options2.frame));
12321
12538
  }
12322
12539
  if (options2.widowControl !== void 0) {
12323
12540
  this.push(new OnOffElement("w:widowControl", options2.widowControl));
@@ -12328,9 +12545,11 @@ var __publicField = (obj, key, value) => {
12328
12545
  if (options2.numbering) {
12329
12546
  this.numberingReferences.push({
12330
12547
  reference: options2.numbering.reference,
12331
- instance: options2.numbering.instance ?? 0
12548
+ instance: (_a = options2.numbering.instance) != null ? _a : 0
12332
12549
  });
12333
- this.push(new NumberProperties(`${options2.numbering.reference}-${options2.numbering.instance ?? 0}`, options2.numbering.level));
12550
+ this.push(new NumberProperties(`${options2.numbering.reference}-${(_b = options2.numbering.instance) != null ? _b : 0}`, options2.numbering.level));
12551
+ } else if (options2.numbering === false) {
12552
+ this.push(new NumberProperties(0, 0));
12334
12553
  }
12335
12554
  if (options2.border) {
12336
12555
  this.push(new Border(options2.border));
@@ -12344,6 +12563,9 @@ var __publicField = (obj, key, value) => {
12344
12563
  if (options2.wordWrap) {
12345
12564
  this.push(new WordWrap());
12346
12565
  }
12566
+ if (options2.overflowPunctuation) {
12567
+ this.push(new OnOffElement("w:overflowPunct", options2.overflowPunctuation));
12568
+ }
12347
12569
  const tabDefinitions = [
12348
12570
  ...options2.rightTabStop !== void 0 ? [{ type: TabStopType.RIGHT, position: options2.rightTabStop }] : [],
12349
12571
  ...options2.tabStops ? options2.tabStops : [],
@@ -12512,9 +12734,9 @@ var __publicField = (obj, key, value) => {
12512
12734
  }
12513
12735
  }
12514
12736
  class MathLimitLocation extends XmlComponent {
12515
- constructor() {
12737
+ constructor(value) {
12516
12738
  super("m:limLoc");
12517
- this.root.push(new MathLimitLocationAttributes({ value: "undOvr" }));
12739
+ this.root.push(new MathLimitLocationAttributes({ value: value || "undOvr" }));
12518
12740
  }
12519
12741
  }
12520
12742
  class MathSubScriptHideAttributes extends XmlAttributeComponent {
@@ -12542,12 +12764,12 @@ var __publicField = (obj, key, value) => {
12542
12764
  }
12543
12765
  }
12544
12766
  class MathNAryProperties extends XmlComponent {
12545
- constructor(accent, hasSuperScript, hasSubScript) {
12767
+ constructor(accent, hasSuperScript, hasSubScript, limitLocationVal) {
12546
12768
  super("m:naryPr");
12547
12769
  if (!!accent) {
12548
12770
  this.root.push(new MathAccentCharacter(accent));
12549
12771
  }
12550
- this.root.push(new MathLimitLocation());
12772
+ this.root.push(new MathLimitLocation(limitLocationVal));
12551
12773
  if (!hasSuperScript) {
12552
12774
  this.root.push(new MathSuperScriptHide());
12553
12775
  }
@@ -12588,7 +12810,7 @@ var __publicField = (obj, key, value) => {
12588
12810
  class MathIntegral extends XmlComponent {
12589
12811
  constructor(options2) {
12590
12812
  super("m:nary");
12591
- this.root.push(new MathNAryProperties("", !!options2.superScript, !!options2.subScript));
12813
+ this.root.push(new MathNAryProperties("", !!options2.superScript, !!options2.subScript, "subSup"));
12592
12814
  if (!!options2.subScript) {
12593
12815
  this.root.push(new MathSubScriptElement(options2.subScript));
12594
12816
  }
@@ -12598,6 +12820,28 @@ var __publicField = (obj, key, value) => {
12598
12820
  this.root.push(new MathBase(options2.children));
12599
12821
  }
12600
12822
  }
12823
+ class MathLimit extends XmlComponent {
12824
+ constructor(children) {
12825
+ super("m:lim");
12826
+ for (const child of children) {
12827
+ this.root.push(child);
12828
+ }
12829
+ }
12830
+ }
12831
+ class MathLimitUpper extends XmlComponent {
12832
+ constructor(options2) {
12833
+ super("m:limUpp");
12834
+ this.root.push(new MathBase(options2.children));
12835
+ this.root.push(new MathLimit(options2.limit));
12836
+ }
12837
+ }
12838
+ class MathLimitLower extends XmlComponent {
12839
+ constructor(options2) {
12840
+ super("m:limLow");
12841
+ this.root.push(new MathBase(options2.children));
12842
+ this.root.push(new MathLimit(options2.limit));
12843
+ }
12844
+ }
12601
12845
  class MathSuperScriptProperties extends XmlComponent {
12602
12846
  constructor() {
12603
12847
  super("m:sSupPr");
@@ -13201,8 +13445,8 @@ var __publicField = (obj, key, value) => {
13201
13445
  super("w:tbl");
13202
13446
  this.root.push(
13203
13447
  new TableProperties({
13204
- borders: borders ?? {},
13205
- width: width ?? { size: 100 },
13448
+ borders: borders != null ? borders : {},
13449
+ width: width != null ? width : { size: 100 },
13206
13450
  indent,
13207
13451
  float,
13208
13452
  layout,
@@ -13412,8 +13656,10 @@ var __publicField = (obj, key, value) => {
13412
13656
  this.root.push(new Default("image/jpeg", "jpg"));
13413
13657
  this.root.push(new Default("image/bmp", "bmp"));
13414
13658
  this.root.push(new Default("image/gif", "gif"));
13659
+ this.root.push(new Default("image/svg+xml", "svg"));
13415
13660
  this.root.push(new Default("application/vnd.openxmlformats-package.relationships+xml", "rels"));
13416
13661
  this.root.push(new Default("application/xml", "xml"));
13662
+ this.root.push(new Default("application/vnd.openxmlformats-officedocument.obfuscatedFont", "odttf"));
13417
13663
  this.root.push(
13418
13664
  new Override("application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml", "/word/document.xml")
13419
13665
  );
@@ -13425,6 +13671,7 @@ var __publicField = (obj, key, value) => {
13425
13671
  this.root.push(new Override("application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml", "/word/footnotes.xml"));
13426
13672
  this.root.push(new Override("application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml", "/word/settings.xml"));
13427
13673
  this.root.push(new Override("application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml", "/word/comments.xml"));
13674
+ this.root.push(new Override("application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml", "/word/fontTable.xml"));
13428
13675
  }
13429
13676
  addFooter(index) {
13430
13677
  this.root.push(
@@ -14654,7 +14901,7 @@ var __publicField = (obj, key, value) => {
14654
14901
  }
14655
14902
  class Settings extends XmlComponent {
14656
14903
  constructor(options2) {
14657
- var _a;
14904
+ var _a, _b, _c, _d;
14658
14905
  super("w:settings");
14659
14906
  this.root.push(
14660
14907
  new SettingsAttributes({
@@ -14691,10 +14938,9 @@ var __publicField = (obj, key, value) => {
14691
14938
  this.root.push(new NumberValueElement("w:defaultTabStop", options2.defaultTabStop));
14692
14939
  }
14693
14940
  this.root.push(
14694
- new Compatibility({
14695
- ...options2.compatibility ?? {},
14696
- version: ((_a = options2.compatibility) == null ? void 0 : _a.version) ?? options2.compatibilityModeVersion ?? 15
14697
- })
14941
+ new Compatibility(__spreadProps(__spreadValues({}, (_a = options2.compatibility) != null ? _a : {}), {
14942
+ version: (_d = (_c = (_b = options2.compatibility) == null ? void 0 : _b.version) != null ? _c : options2.compatibilityModeVersion) != null ? _d : 15
14943
+ }))
14698
14944
  );
14699
14945
  }
14700
14946
  }
@@ -14772,11 +15018,10 @@ var __publicField = (obj, key, value) => {
14772
15018
  constructor(options2) {
14773
15019
  super(
14774
15020
  { type: "character", styleId: options2.id },
14775
- {
15021
+ __spreadValues({
14776
15022
  uiPriority: 99,
14777
- unhideWhenUsed: true,
14778
- ...options2
14779
- }
15023
+ unhideWhenUsed: true
15024
+ }, options2)
14780
15025
  );
14781
15026
  __publicField(this, "runProperties");
14782
15027
  this.runProperties = new RunProperties(options2.run);
@@ -14785,100 +15030,90 @@ var __publicField = (obj, key, value) => {
14785
15030
  }
14786
15031
  class HeadingStyle extends StyleForParagraph {
14787
15032
  constructor(options2) {
14788
- super({
15033
+ super(__spreadValues({
14789
15034
  basedOn: "Normal",
14790
15035
  next: "Normal",
14791
- quickFormat: true,
14792
- ...options2
14793
- });
15036
+ quickFormat: true
15037
+ }, options2));
14794
15038
  }
14795
15039
  }
14796
15040
  class TitleStyle extends HeadingStyle {
14797
15041
  constructor(options2) {
14798
- super({
15042
+ super(__spreadValues({
14799
15043
  id: "Title",
14800
- name: "Title",
14801
- ...options2
14802
- });
15044
+ name: "Title"
15045
+ }, options2));
14803
15046
  }
14804
15047
  }
14805
15048
  class Heading1Style extends HeadingStyle {
14806
15049
  constructor(options2) {
14807
- super({
15050
+ super(__spreadValues({
14808
15051
  id: "Heading1",
14809
- name: "Heading 1",
14810
- ...options2
14811
- });
15052
+ name: "Heading 1"
15053
+ }, options2));
14812
15054
  }
14813
15055
  }
14814
15056
  class Heading2Style extends HeadingStyle {
14815
15057
  constructor(options2) {
14816
- super({
15058
+ super(__spreadValues({
14817
15059
  id: "Heading2",
14818
- name: "Heading 2",
14819
- ...options2
14820
- });
15060
+ name: "Heading 2"
15061
+ }, options2));
14821
15062
  }
14822
15063
  }
14823
15064
  class Heading3Style extends HeadingStyle {
14824
15065
  constructor(options2) {
14825
- super({
15066
+ super(__spreadValues({
14826
15067
  id: "Heading3",
14827
- name: "Heading 3",
14828
- ...options2
14829
- });
15068
+ name: "Heading 3"
15069
+ }, options2));
14830
15070
  }
14831
15071
  }
14832
15072
  class Heading4Style extends HeadingStyle {
14833
15073
  constructor(options2) {
14834
- super({
15074
+ super(__spreadValues({
14835
15075
  id: "Heading4",
14836
- name: "Heading 4",
14837
- ...options2
14838
- });
15076
+ name: "Heading 4"
15077
+ }, options2));
14839
15078
  }
14840
15079
  }
14841
15080
  class Heading5Style extends HeadingStyle {
14842
15081
  constructor(options2) {
14843
- super({
15082
+ super(__spreadValues({
14844
15083
  id: "Heading5",
14845
- name: "Heading 5",
14846
- ...options2
14847
- });
15084
+ name: "Heading 5"
15085
+ }, options2));
14848
15086
  }
14849
15087
  }
14850
15088
  class Heading6Style extends HeadingStyle {
14851
15089
  constructor(options2) {
14852
- super({
15090
+ super(__spreadValues({
14853
15091
  id: "Heading6",
14854
- name: "Heading 6",
14855
- ...options2
14856
- });
15092
+ name: "Heading 6"
15093
+ }, options2));
14857
15094
  }
14858
15095
  }
14859
15096
  class StrongStyle extends HeadingStyle {
14860
15097
  constructor(options2) {
14861
- super({
15098
+ super(__spreadValues({
14862
15099
  id: "Strong",
14863
- name: "Strong",
14864
- ...options2
14865
- });
15100
+ name: "Strong"
15101
+ }, options2));
14866
15102
  }
14867
15103
  }
14868
15104
  class ListParagraph extends StyleForParagraph {
14869
15105
  constructor(options2) {
14870
- super({
15106
+ super(__spreadValues({
14871
15107
  id: "ListParagraph",
14872
15108
  name: "List Paragraph",
14873
15109
  basedOn: "Normal",
14874
- quickFormat: true,
14875
- ...options2
14876
- });
15110
+ quickFormat: true
15111
+ }, options2));
14877
15112
  }
14878
15113
  }
14879
15114
  class FootnoteText extends StyleForParagraph {
14880
15115
  constructor(options2) {
14881
- super({
15116
+ super(__spreadValues({
14882
15117
  id: "FootnoteText",
14883
15118
  name: "footnote text",
14884
15119
  link: "FootnoteTextChar",
@@ -14895,28 +15130,26 @@ var __publicField = (obj, key, value) => {
14895
15130
  },
14896
15131
  run: {
14897
15132
  size: 20
14898
- },
14899
- ...options2
14900
- });
15133
+ }
15134
+ }, options2));
14901
15135
  }
14902
15136
  }
14903
15137
  class FootnoteReferenceStyle extends StyleForCharacter {
14904
15138
  constructor(options2) {
14905
- super({
15139
+ super(__spreadValues({
14906
15140
  id: "FootnoteReference",
14907
15141
  name: "footnote reference",
14908
15142
  basedOn: "DefaultParagraphFont",
14909
15143
  semiHidden: true,
14910
15144
  run: {
14911
15145
  superScript: true
14912
- },
14913
- ...options2
14914
- });
15146
+ }
15147
+ }, options2));
14915
15148
  }
14916
15149
  }
14917
15150
  class FootnoteTextChar extends StyleForCharacter {
14918
15151
  constructor(options2) {
14919
- super({
15152
+ super(__spreadValues({
14920
15153
  id: "FootnoteTextChar",
14921
15154
  name: "Footnote Text Char",
14922
15155
  basedOn: "DefaultParagraphFont",
@@ -14924,14 +15157,13 @@ var __publicField = (obj, key, value) => {
14924
15157
  semiHidden: true,
14925
15158
  run: {
14926
15159
  size: 20
14927
- },
14928
- ...options2
14929
- });
15160
+ }
15161
+ }, options2));
14930
15162
  }
14931
15163
  }
14932
15164
  class HyperlinkStyle extends StyleForCharacter {
14933
15165
  constructor(options2) {
14934
- super({
15166
+ super(__spreadValues({
14935
15167
  id: "Hyperlink",
14936
15168
  name: "Hyperlink",
14937
15169
  basedOn: "DefaultParagraphFont",
@@ -14940,9 +15172,8 @@ var __publicField = (obj, key, value) => {
14940
15172
  underline: {
14941
15173
  type: UnderlineType.SINGLE
14942
15174
  }
14943
- },
14944
- ...options2
14945
- });
15175
+ }
15176
+ }, options2));
14946
15177
  }
14947
15178
  }
14948
15179
  class Styles extends XmlComponent {
@@ -15036,6 +15267,7 @@ var __publicField = (obj, key, value) => {
15036
15267
  }
15037
15268
  class DefaultStylesFactory {
15038
15269
  newInstance(options2 = {}) {
15270
+ var _a;
15039
15271
  const documentAttributes = new DocumentAttributes({
15040
15272
  mc: "http://schemas.openxmlformats.org/markup-compatibility/2006",
15041
15273
  r: "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
@@ -15047,59 +15279,51 @@ var __publicField = (obj, key, value) => {
15047
15279
  return {
15048
15280
  initialStyles: documentAttributes,
15049
15281
  importedStyles: [
15050
- new DocumentDefaults(options2.document ?? {}),
15051
- new TitleStyle({
15282
+ new DocumentDefaults((_a = options2.document) != null ? _a : {}),
15283
+ new TitleStyle(__spreadValues({
15052
15284
  run: {
15053
15285
  size: 56
15054
- },
15055
- ...options2.title
15056
- }),
15057
- new Heading1Style({
15286
+ }
15287
+ }, options2.title)),
15288
+ new Heading1Style(__spreadValues({
15058
15289
  run: {
15059
15290
  color: "2E74B5",
15060
15291
  size: 32
15061
- },
15062
- ...options2.heading1
15063
- }),
15064
- new Heading2Style({
15292
+ }
15293
+ }, options2.heading1)),
15294
+ new Heading2Style(__spreadValues({
15065
15295
  run: {
15066
15296
  color: "2E74B5",
15067
15297
  size: 26
15068
- },
15069
- ...options2.heading2
15070
- }),
15071
- new Heading3Style({
15298
+ }
15299
+ }, options2.heading2)),
15300
+ new Heading3Style(__spreadValues({
15072
15301
  run: {
15073
15302
  color: "1F4D78",
15074
15303
  size: 24
15075
- },
15076
- ...options2.heading3
15077
- }),
15078
- new Heading4Style({
15304
+ }
15305
+ }, options2.heading3)),
15306
+ new Heading4Style(__spreadValues({
15079
15307
  run: {
15080
15308
  color: "2E74B5",
15081
15309
  italics: true
15082
- },
15083
- ...options2.heading4
15084
- }),
15085
- new Heading5Style({
15310
+ }
15311
+ }, options2.heading4)),
15312
+ new Heading5Style(__spreadValues({
15086
15313
  run: {
15087
15314
  color: "2E74B5"
15088
- },
15089
- ...options2.heading5
15090
- }),
15091
- new Heading6Style({
15315
+ }
15316
+ }, options2.heading5)),
15317
+ new Heading6Style(__spreadValues({
15092
15318
  run: {
15093
15319
  color: "1F4D78"
15094
- },
15095
- ...options2.heading6
15096
- }),
15097
- new StrongStyle({
15320
+ }
15321
+ }, options2.heading6)),
15322
+ new StrongStyle(__spreadValues({
15098
15323
  run: {
15099
15324
  bold: true
15100
- },
15101
- ...options2.strong
15102
- }),
15325
+ }
15326
+ }, options2.strong)),
15103
15327
  new ListParagraph(options2.listParagraph || {}),
15104
15328
  new HyperlinkStyle(options2.hyperlink || {}),
15105
15329
  new FootnoteReferenceStyle(options2.footnoteReference || {}),
@@ -15109,6 +15333,165 @@ var __publicField = (obj, key, value) => {
15109
15333
  };
15110
15334
  }
15111
15335
  }
15336
+ const CharacterSet = {
15337
+ ANSI: "00",
15338
+ DEFAULT: "01",
15339
+ SYMBOL: "02",
15340
+ MAC: "4D",
15341
+ JIS: "80",
15342
+ HANGUL: "81",
15343
+ JOHAB: "82",
15344
+ GB_2312: "86",
15345
+ CHINESEBIG5: "88",
15346
+ GREEK: "A1",
15347
+ TURKISH: "A2",
15348
+ VIETNAMESE: "A3",
15349
+ HEBREW: "B1",
15350
+ ARABIC: "B2",
15351
+ BALTIC: "BA",
15352
+ RUSSIAN: "CC",
15353
+ THAI: "DE",
15354
+ EASTEUROPE: "EE",
15355
+ OEM: "FF"
15356
+ };
15357
+ const createFontRelationship = ({ id, fontKey, subsetted }, name) => new BuilderElement({
15358
+ name,
15359
+ attributes: __spreadValues({
15360
+ id: { key: "r:id", value: id }
15361
+ }, fontKey ? { fontKey: { key: "w:fontKey", value: `{${fontKey}}` } } : {}),
15362
+ children: [...subsetted ? [new OnOffElement("w:subsetted", subsetted)] : []]
15363
+ });
15364
+ const createFont = ({
15365
+ name,
15366
+ altName,
15367
+ panose1,
15368
+ charset,
15369
+ family,
15370
+ notTrueType,
15371
+ pitch,
15372
+ sig,
15373
+ embedRegular,
15374
+ embedBold,
15375
+ embedItalic,
15376
+ embedBoldItalic
15377
+ }) => (
15378
+ // http://www.datypic.com/sc/ooxml/e-w_font-1.html
15379
+ new BuilderElement({
15380
+ name: "w:font",
15381
+ attributes: {
15382
+ name: { key: "w:name", value: name }
15383
+ },
15384
+ children: [
15385
+ // http://www.datypic.com/sc/ooxml/e-w_altName-1.html
15386
+ ...altName ? [createStringElement("w:altName", altName)] : [],
15387
+ // http://www.datypic.com/sc/ooxml/e-w_panose1-1.html
15388
+ ...panose1 ? [createStringElement("w:panose1", panose1)] : [],
15389
+ // http://www.datypic.com/sc/ooxml/e-w_charset-1.html
15390
+ ...charset ? [createStringElement("w:charset", charset)] : [],
15391
+ // http://www.datypic.com/sc/ooxml/e-w_family-1.html
15392
+ ...family ? [createStringElement("w:family", family)] : [],
15393
+ // http://www.datypic.com/sc/ooxml/e-w_notTrueType-1.html
15394
+ ...notTrueType ? [new OnOffElement("w:notTrueType", notTrueType)] : [],
15395
+ ...pitch ? [createStringElement("w:pitch", pitch)] : [],
15396
+ // http://www.datypic.com/sc/ooxml/e-w_sig-1.html
15397
+ ...sig ? [
15398
+ new BuilderElement({
15399
+ name: "w:sig",
15400
+ attributes: {
15401
+ usb0: { key: "w:usb0", value: sig.usb0 },
15402
+ usb1: { key: "w:usb1", value: sig.usb1 },
15403
+ usb2: { key: "w:usb2", value: sig.usb2 },
15404
+ usb3: { key: "w:usb3", value: sig.usb3 },
15405
+ csb0: { key: "w:csb0", value: sig.csb0 },
15406
+ csb1: { key: "w:csb1", value: sig.csb1 }
15407
+ }
15408
+ })
15409
+ ] : [],
15410
+ // http://www.datypic.com/sc/ooxml/e-w_embedRegular-1.html
15411
+ ...embedRegular ? [createFontRelationship(embedRegular, "w:embedRegular")] : [],
15412
+ // http://www.datypic.com/sc/ooxml/e-w_embedBold-1.html
15413
+ ...embedBold ? [createFontRelationship(embedBold, "w:embedBold")] : [],
15414
+ // http://www.datypic.com/sc/ooxml/e-w_embedItalic-1.html
15415
+ ...embedItalic ? [createFontRelationship(embedItalic, "w:embedItalic")] : [],
15416
+ // http://www.datypic.com/sc/ooxml/e-w_embedBoldItalic-1.html
15417
+ ...embedBoldItalic ? [createFontRelationship(embedBoldItalic, "w:embedBoldItalic")] : []
15418
+ ]
15419
+ })
15420
+ );
15421
+ const createRegularFont = ({
15422
+ name,
15423
+ index,
15424
+ fontKey,
15425
+ characterSet
15426
+ }) => createFont({
15427
+ name,
15428
+ sig: {
15429
+ usb0: "E0002AFF",
15430
+ usb1: "C000247B",
15431
+ usb2: "00000009",
15432
+ usb3: "00000000",
15433
+ csb0: "000001FF",
15434
+ csb1: "00000000"
15435
+ },
15436
+ charset: characterSet,
15437
+ family: "auto",
15438
+ pitch: "variable",
15439
+ embedRegular: {
15440
+ fontKey,
15441
+ id: `rId${index}`
15442
+ }
15443
+ });
15444
+ const createFontTable = (fonts) => (
15445
+ // https://c-rex.net/projects/samples/ooxml/e1/Part4/OOXML_P4_DOCX_Font_topic_ID0ERNCU.html
15446
+ // http://www.datypic.com/sc/ooxml/e-w_fonts.html
15447
+ new BuilderElement({
15448
+ name: "w:fonts",
15449
+ attributes: {
15450
+ mc: { key: "xmlns:mc", value: "http://schemas.openxmlformats.org/markup-compatibility/2006" },
15451
+ r: { key: "xmlns:r", value: "http://schemas.openxmlformats.org/officeDocument/2006/relationships" },
15452
+ w: { key: "xmlns:w", value: "http://schemas.openxmlformats.org/wordprocessingml/2006/main" },
15453
+ w14: { key: "xmlns:w14", value: "http://schemas.microsoft.com/office/word/2010/wordml" },
15454
+ w15: { key: "xmlns:w15", value: "http://schemas.microsoft.com/office/word/2012/wordml" },
15455
+ w16cex: { key: "xmlns:w16cex", value: "http://schemas.microsoft.com/office/word/2018/wordml/cex" },
15456
+ w16cid: { key: "xmlns:w16cid", value: "http://schemas.microsoft.com/office/word/2016/wordml/cid" },
15457
+ w16: { key: "xmlns:w16", value: "http://schemas.microsoft.com/office/word/2018/wordml" },
15458
+ w16sdtdh: { key: "xmlns:w16sdtdh", value: "http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" },
15459
+ w16se: { key: "xmlns:w16se", value: "http://schemas.microsoft.com/office/word/2015/wordml/symex" },
15460
+ Ignorable: { key: "mc:Ignorable", value: "w14 w15 w16se w16cid w16 w16cex w16sdtdh" }
15461
+ },
15462
+ children: fonts.map(
15463
+ (font, i) => createRegularFont({
15464
+ name: font.name,
15465
+ index: i + 1,
15466
+ fontKey: font.fontKey
15467
+ })
15468
+ )
15469
+ })
15470
+ );
15471
+ class FontWrapper {
15472
+ constructor(options2) {
15473
+ __publicField(this, "fontTable");
15474
+ __publicField(this, "relationships");
15475
+ __publicField(this, "fontOptionsWithKey", []);
15476
+ this.options = options2;
15477
+ this.fontOptionsWithKey = options2.map((o) => __spreadProps(__spreadValues({}, o), { fontKey: uniqueUuid() }));
15478
+ this.fontTable = createFontTable(this.fontOptionsWithKey);
15479
+ this.relationships = new Relationships();
15480
+ for (let i = 0; i < options2.length; i++) {
15481
+ this.relationships.createRelationship(
15482
+ i + 1,
15483
+ "http://schemas.openxmlformats.org/officeDocument/2006/relationships/font",
15484
+ `fonts/${options2[i].name}.odttf`
15485
+ );
15486
+ }
15487
+ }
15488
+ get View() {
15489
+ return this.fontTable;
15490
+ }
15491
+ get Relationships() {
15492
+ return this.relationships;
15493
+ }
15494
+ }
15112
15495
  class File {
15113
15496
  constructor(options2) {
15114
15497
  // eslint-disable-next-line functional/prefer-readonly-type
@@ -15129,17 +15512,17 @@ var __publicField = (obj, key, value) => {
15129
15512
  __publicField(this, "appProperties");
15130
15513
  __publicField(this, "styles");
15131
15514
  __publicField(this, "comments");
15132
- var _a, _b;
15133
- this.coreProperties = new CoreProperties({
15134
- ...options2,
15135
- creator: options2.creator ?? "Un-named",
15136
- revision: options2.revision ?? 1,
15137
- lastModifiedBy: options2.lastModifiedBy ?? "Un-named"
15138
- });
15515
+ __publicField(this, "fontWrapper");
15516
+ var _a, _b, _c, _d, _e, _f, _g, _h;
15517
+ this.coreProperties = new CoreProperties(__spreadProps(__spreadValues({}, options2), {
15518
+ creator: (_a = options2.creator) != null ? _a : "Un-named",
15519
+ revision: (_b = options2.revision) != null ? _b : 1,
15520
+ lastModifiedBy: (_c = options2.lastModifiedBy) != null ? _c : "Un-named"
15521
+ }));
15139
15522
  this.numbering = new Numbering(options2.numbering ? options2.numbering : { config: [] });
15140
- this.comments = new Comments(options2.comments ?? { children: [] });
15523
+ this.comments = new Comments((_d = options2.comments) != null ? _d : { children: [] });
15141
15524
  this.fileRelationships = new Relationships();
15142
- this.customProperties = new CustomProperties(options2.customProperties ?? []);
15525
+ this.customProperties = new CustomProperties((_e = options2.customProperties) != null ? _e : []);
15143
15526
  this.appProperties = new AppProperties();
15144
15527
  this.footnotesWrapper = new FootnotesWrapper();
15145
15528
  this.contentTypes = new ContentTypes();
@@ -15148,21 +15531,18 @@ var __publicField = (obj, key, value) => {
15148
15531
  compatibilityModeVersion: options2.compatabilityModeVersion,
15149
15532
  compatibility: options2.compatibility,
15150
15533
  evenAndOddHeaders: options2.evenAndOddHeaderAndFooters ? true : false,
15151
- trackRevisions: (_a = options2.features) == null ? void 0 : _a.trackRevisions,
15152
- updateFields: (_b = options2.features) == null ? void 0 : _b.updateFields,
15534
+ trackRevisions: (_f = options2.features) == null ? void 0 : _f.trackRevisions,
15535
+ updateFields: (_g = options2.features) == null ? void 0 : _g.updateFields,
15153
15536
  defaultTabStop: options2.defaultTabStop
15154
15537
  });
15155
15538
  this.media = new Media();
15156
- if (options2.externalStyles) {
15539
+ if (options2.externalStyles !== void 0) {
15157
15540
  const stylesFactory = new ExternalStylesFactory();
15158
15541
  this.styles = stylesFactory.newInstance(options2.externalStyles);
15159
15542
  } else if (options2.styles) {
15160
15543
  const stylesFactory = new DefaultStylesFactory();
15161
15544
  const defaultStyles = stylesFactory.newInstance(options2.styles.default);
15162
- this.styles = new Styles({
15163
- ...defaultStyles,
15164
- ...options2.styles
15165
- });
15545
+ this.styles = new Styles(__spreadValues(__spreadValues({}, defaultStyles), options2.styles));
15166
15546
  } else {
15167
15547
  const stylesFactory = new DefaultStylesFactory();
15168
15548
  this.styles = new Styles(stylesFactory.newInstance());
@@ -15176,10 +15556,10 @@ var __publicField = (obj, key, value) => {
15176
15556
  this.footnotesWrapper.View.createFootNote(parseFloat(key), options2.footnotes[key].children);
15177
15557
  }
15178
15558
  }
15559
+ this.fontWrapper = new FontWrapper((_h = options2.fonts) != null ? _h : []);
15179
15560
  }
15180
15561
  addSection({ headers = {}, footers = {}, children, properties }) {
15181
- this.documentWrapper.View.Body.addSection({
15182
- ...properties,
15562
+ this.documentWrapper.View.Body.addSection(__spreadProps(__spreadValues({}, properties), {
15183
15563
  headerWrapperGroup: {
15184
15564
  default: headers.default ? this.createHeader(headers.default) : void 0,
15185
15565
  first: headers.first ? this.createHeader(headers.first) : void 0,
@@ -15190,7 +15570,7 @@ var __publicField = (obj, key, value) => {
15190
15570
  first: footers.first ? this.createFooter(footers.first) : void 0,
15191
15571
  even: footers.even ? this.createFooter(footers.even) : void 0
15192
15572
  }
15193
- });
15573
+ }));
15194
15574
  for (const child of children) {
15195
15575
  this.documentWrapper.View.add(child);
15196
15576
  }
@@ -15323,6 +15703,9 @@ var __publicField = (obj, key, value) => {
15323
15703
  get Comments() {
15324
15704
  return this.comments;
15325
15705
  }
15706
+ get FontTable() {
15707
+ return this.fontWrapper;
15708
+ }
15326
15709
  }
15327
15710
  class FieldInstruction extends XmlComponent {
15328
15711
  constructor(properties = {}) {
@@ -18272,7 +18655,7 @@ var __publicField = (obj, key, value) => {
18272
18655
  });
18273
18656
  })(jszip_min);
18274
18657
  var jszip_minExports = jszip_min.exports;
18275
- const JSZip = /* @__PURE__ */ getDefaultExportFromCjs(jszip_minExports);
18658
+ const JSZip = /* @__PURE__ */ getDefaultExportFromCjs$1(jszip_minExports);
18276
18659
  var xml$2 = { exports: {} };
18277
18660
  var XML_CHARACTER_MAP = {
18278
18661
  "&": "&amp;",
@@ -18520,7 +18903,23 @@ var __publicField = (obj, key, value) => {
18520
18903
  xml$2.exports = xml;
18521
18904
  xml$2.exports.element = xml$2.exports.Element = element;
18522
18905
  var xmlExports = xml$2.exports;
18523
- const xml$1 = /* @__PURE__ */ getDefaultExportFromCjs(xmlExports);
18906
+ const xml$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(xmlExports);
18907
+ const obfuscatedStartOffset = 0;
18908
+ const obfuscatedEndOffset = 32;
18909
+ const guidSize = 32;
18910
+ const obfuscate = (buf, fontKey) => {
18911
+ const guid = fontKey.replace(/-/g, "");
18912
+ if (guid.length !== guidSize) {
18913
+ throw new Error(`Error: Cannot extract GUID from font filename: ${fontKey}`);
18914
+ }
18915
+ const hexStrings = guid.replace(/(..)/g, "$1 ").trim().split(" ");
18916
+ const hexNumbers = hexStrings.map((hexString) => parseInt(hexString, 16));
18917
+ hexNumbers.reverse();
18918
+ const bytesToObfuscate = buf.slice(obfuscatedStartOffset, obfuscatedEndOffset);
18919
+ const obfuscatedBytes = bytesToObfuscate.map((byte, i) => byte ^ hexNumbers[i % hexNumbers.length]);
18920
+ const out = Buffer.concat([buf.slice(0, obfuscatedStartOffset), obfuscatedBytes, buf.slice(obfuscatedEndOffset)]);
18921
+ return out;
18922
+ };
18524
18923
  class Formatter {
18525
18924
  // tslint:disable-next-line: no-object-literal-type-assertion
18526
18925
  format(input, context = { stack: [] }) {
@@ -18578,8 +18977,17 @@ var __publicField = (obj, key, value) => {
18578
18977
  zip.file(obj.path, obj.data);
18579
18978
  }
18580
18979
  }
18581
- for (const { stream, fileName } of file.Media.Array) {
18582
- zip.file(`word/media/${fileName}`, stream);
18980
+ for (const data of file.Media.Array) {
18981
+ if (data.type !== "svg") {
18982
+ zip.file(`word/media/${data.fileName}`, data.data);
18983
+ } else {
18984
+ zip.file(`word/media/${data.fileName}`, data.data);
18985
+ zip.file(`word/media/${data.fallback.fileName}`, data.fallback.data);
18986
+ }
18987
+ }
18988
+ for (const { data: buffer2, name, fontKey } of file.FontTable.fontOptionsWithKey) {
18989
+ const [nameWithoutExtension] = name.split(".");
18990
+ zip.file(`word/fonts/${nameWithoutExtension}.odttf`, obfuscate(buffer2, fontKey));
18583
18991
  }
18584
18992
  return zip;
18585
18993
  }
@@ -18942,6 +19350,39 @@ var __publicField = (obj, key, value) => {
18942
19350
  }
18943
19351
  ),
18944
19352
  path: "word/comments.xml"
19353
+ },
19354
+ FontTable: {
19355
+ data: xml$1(
19356
+ this.formatter.format(file.FontTable.View, {
19357
+ viewWrapper: file.Document,
19358
+ file,
19359
+ stack: []
19360
+ }),
19361
+ {
19362
+ indent: prettify,
19363
+ declaration: {
19364
+ standalone: "yes",
19365
+ encoding: "UTF-8"
19366
+ }
19367
+ }
19368
+ ),
19369
+ path: "word/fontTable.xml"
19370
+ },
19371
+ FontTableRelationships: {
19372
+ data: (() => xml$1(
19373
+ this.formatter.format(file.FontTable.Relationships, {
19374
+ viewWrapper: file.Document,
19375
+ file,
19376
+ stack: []
19377
+ }),
19378
+ {
19379
+ indent: prettify,
19380
+ declaration: {
19381
+ encoding: "UTF-8"
19382
+ }
19383
+ }
19384
+ ))(),
19385
+ path: "word/_rels/fontTable.xml.rels"
18945
19386
  }
18946
19387
  };
18947
19388
  }
@@ -18955,41 +19396,49 @@ var __publicField = (obj, key, value) => {
18955
19396
  };
18956
19397
  const convertPrettifyType = (prettify) => prettify === true ? PrettifyType.WITH_2_BLANKS : prettify === false ? void 0 : prettify;
18957
19398
  class Packer {
18958
- static async toString(file, prettify) {
18959
- const zip = this.compiler.compile(file, convertPrettifyType(prettify));
18960
- const zipData = await zip.generateAsync({
18961
- type: "string",
18962
- mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
18963
- compression: "DEFLATE"
19399
+ static toString(file, prettify) {
19400
+ return __async(this, null, function* () {
19401
+ const zip = this.compiler.compile(file, convertPrettifyType(prettify));
19402
+ const zipData = yield zip.generateAsync({
19403
+ type: "string",
19404
+ mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
19405
+ compression: "DEFLATE"
19406
+ });
19407
+ return zipData;
18964
19408
  });
18965
- return zipData;
18966
19409
  }
18967
- static async toBuffer(file, prettify) {
18968
- const zip = this.compiler.compile(file, convertPrettifyType(prettify));
18969
- const zipData = await zip.generateAsync({
18970
- type: "nodebuffer",
18971
- mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
18972
- compression: "DEFLATE"
19410
+ static toBuffer(file, prettify) {
19411
+ return __async(this, null, function* () {
19412
+ const zip = this.compiler.compile(file, convertPrettifyType(prettify));
19413
+ const zipData = yield zip.generateAsync({
19414
+ type: "nodebuffer",
19415
+ mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
19416
+ compression: "DEFLATE"
19417
+ });
19418
+ return zipData;
18973
19419
  });
18974
- return zipData;
18975
19420
  }
18976
- static async toBase64String(file, prettify) {
18977
- const zip = this.compiler.compile(file, convertPrettifyType(prettify));
18978
- const zipData = await zip.generateAsync({
18979
- type: "base64",
18980
- mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
18981
- compression: "DEFLATE"
19421
+ static toBase64String(file, prettify) {
19422
+ return __async(this, null, function* () {
19423
+ const zip = this.compiler.compile(file, convertPrettifyType(prettify));
19424
+ const zipData = yield zip.generateAsync({
19425
+ type: "base64",
19426
+ mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
19427
+ compression: "DEFLATE"
19428
+ });
19429
+ return zipData;
18982
19430
  });
18983
- return zipData;
18984
19431
  }
18985
- static async toBlob(file, prettify) {
18986
- const zip = this.compiler.compile(file, convertPrettifyType(prettify));
18987
- const zipData = await zip.generateAsync({
18988
- type: "blob",
18989
- mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
18990
- compression: "DEFLATE"
19432
+ static toBlob(file, prettify) {
19433
+ return __async(this, null, function* () {
19434
+ const zip = this.compiler.compile(file, convertPrettifyType(prettify));
19435
+ const zipData = yield zip.generateAsync({
19436
+ type: "blob",
19437
+ mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
19438
+ compression: "DEFLATE"
19439
+ });
19440
+ return zipData;
18991
19441
  });
18992
- return zipData;
18993
19442
  }
18994
19443
  static toStream(file, prettify) {
18995
19444
  const stream = new streamBrowserify.Stream();
@@ -19012,18 +19461,18 @@ var __publicField = (obj, key, value) => {
19012
19461
  return xmlObj;
19013
19462
  };
19014
19463
  const createTextElementContents = (text) => {
19464
+ var _a;
19015
19465
  const textJson = toJson(xml$1(formatter$1.format(new Text({ text }))));
19016
- return textJson.elements[0].elements ?? [];
19466
+ return (_a = textJson.elements[0].elements) != null ? _a : [];
19017
19467
  };
19018
- const patchSpaceAttribute = (element2) => ({
19019
- ...element2,
19468
+ const patchSpaceAttribute = (element2) => __spreadProps(__spreadValues({}, element2), {
19020
19469
  attributes: {
19021
19470
  "xml:space": "preserve"
19022
19471
  }
19023
19472
  });
19024
19473
  const getFirstLevelElements = (relationships, id) => {
19025
- var _a;
19026
- return ((_a = relationships.elements) == null ? void 0 : _a.filter((e) => e.name === id)[0].elements) ?? [];
19474
+ var _a, _b;
19475
+ return (_b = (_a = relationships.elements) == null ? void 0 : _a.filter((e) => e.name === id)[0].elements) != null ? _b : [];
19027
19476
  };
19028
19477
  const ReplaceMode = {
19029
19478
  START: 0,
@@ -19077,16 +19526,16 @@ var __publicField = (obj, key, value) => {
19077
19526
  return element2;
19078
19527
  };
19079
19528
  const findRunElementIndexWithToken = (paragraphElement, token) => {
19080
- var _a, _b;
19081
- for (let i = 0; i < (paragraphElement.elements ?? []).length; i++) {
19529
+ var _a, _b, _c, _d;
19530
+ for (let i = 0; i < ((_a = paragraphElement.elements) != null ? _a : []).length; i++) {
19082
19531
  const element2 = paragraphElement.elements[i];
19083
19532
  if (element2.type === "element" && element2.name === "w:r") {
19084
- const textElement = (element2.elements ?? []).filter((e) => e.type === "element" && e.name === "w:t");
19533
+ const textElement = ((_b = element2.elements) != null ? _b : []).filter((e) => e.type === "element" && e.name === "w:t");
19085
19534
  for (const text of textElement) {
19086
- if (!((_a = text.elements) == null ? void 0 : _a[0])) {
19535
+ if (!((_c = text.elements) == null ? void 0 : _c[0])) {
19087
19536
  continue;
19088
19537
  }
19089
- if ((_b = text.elements[0].text) == null ? void 0 : _b.includes(token)) {
19538
+ if ((_d = text.elements[0].text) == null ? void 0 : _d.includes(token)) {
19090
19539
  return i;
19091
19540
  }
19092
19541
  }
@@ -19095,16 +19544,14 @@ var __publicField = (obj, key, value) => {
19095
19544
  throw new Error("Token not found");
19096
19545
  };
19097
19546
  const splitRunElement = (runElement, token) => {
19098
- var _a;
19547
+ var _a, _b;
19099
19548
  let splitIndex = 0;
19100
- const splitElements = ((_a = runElement.elements) == null ? void 0 : _a.map((e, i) => {
19101
- var _a2;
19549
+ const splitElements = (_b = (_a = runElement.elements) == null ? void 0 : _a.map((e, i) => {
19550
+ var _a2, _b2;
19102
19551
  if (e.type === "element" && e.name === "w:t") {
19103
- const text = ((_a2 = e.elements) == null ? void 0 : _a2[0].text) ?? "";
19552
+ const text = (_b2 = (_a2 = e.elements) == null ? void 0 : _a2[0].text) != null ? _b2 : "";
19104
19553
  const splitText = text.split(token);
19105
- const newElements = splitText.map((t) => ({
19106
- ...e,
19107
- ...patchSpaceAttribute(e),
19554
+ const newElements = splitText.map((t) => __spreadProps(__spreadValues(__spreadValues({}, e), patchSpaceAttribute(e)), {
19108
19555
  elements: createTextElementContents(t)
19109
19556
  }));
19110
19557
  splitIndex = i;
@@ -19112,77 +19559,15 @@ var __publicField = (obj, key, value) => {
19112
19559
  } else {
19113
19560
  return e;
19114
19561
  }
19115
- }).flat()) ?? [];
19116
- const leftRunElement = {
19117
- ...JSON.parse(JSON.stringify(runElement)),
19562
+ }).flat()) != null ? _b : [];
19563
+ const leftRunElement = __spreadProps(__spreadValues({}, JSON.parse(JSON.stringify(runElement))), {
19118
19564
  elements: splitElements.slice(0, splitIndex + 1)
19119
- };
19120
- const rightRunElement = {
19121
- ...JSON.parse(JSON.stringify(runElement)),
19565
+ });
19566
+ const rightRunElement = __spreadProps(__spreadValues({}, JSON.parse(JSON.stringify(runElement))), {
19122
19567
  elements: splitElements.slice(splitIndex + 1)
19123
- };
19568
+ });
19124
19569
  return { left: leftRunElement, right: rightRunElement };
19125
19570
  };
19126
- const formatter = new Formatter();
19127
- const SPLIT_TOKEN = "ɵ";
19128
- const replacer = (json, patch, patchText, renderedParagraphs, context, keepOriginalStyles = false) => {
19129
- for (const renderedParagraph of renderedParagraphs) {
19130
- const textJson = patch.children.map((c) => toJson(xml$1(formatter.format(c, context)))).map((c) => c.elements[0]);
19131
- switch (patch.type) {
19132
- case PatchType.DOCUMENT: {
19133
- const parentElement = goToParentElementFromPath(json, renderedParagraph.path);
19134
- const elementIndex = getLastElementIndexFromPath(renderedParagraph.path);
19135
- parentElement.elements.splice(elementIndex, 1, ...textJson);
19136
- break;
19137
- }
19138
- case PatchType.PARAGRAPH:
19139
- default: {
19140
- const paragraphElement = goToElementFromPath(json, renderedParagraph.path);
19141
- replaceTokenInParagraphElement({
19142
- paragraphElement,
19143
- renderedParagraph,
19144
- originalText: patchText,
19145
- replacementText: SPLIT_TOKEN
19146
- });
19147
- const index = findRunElementIndexWithToken(paragraphElement, SPLIT_TOKEN);
19148
- const runElementToBeReplaced = paragraphElement.elements[index];
19149
- const { left, right } = splitRunElement(runElementToBeReplaced, SPLIT_TOKEN);
19150
- let newRunElements = textJson;
19151
- let patchedRightElement = right;
19152
- if (keepOriginalStyles) {
19153
- const runElementNonTextualElements = runElementToBeReplaced.elements.filter(
19154
- (e) => e.type === "element" && e.name !== "w:t"
19155
- );
19156
- newRunElements = textJson.map((e) => ({
19157
- ...e,
19158
- elements: [...runElementNonTextualElements, ...e.elements]
19159
- }));
19160
- patchedRightElement = {
19161
- ...right,
19162
- elements: [...runElementNonTextualElements, ...right.elements]
19163
- };
19164
- }
19165
- paragraphElement.elements.splice(index, 1, left, ...newRunElements, patchedRightElement);
19166
- break;
19167
- }
19168
- }
19169
- }
19170
- return json;
19171
- };
19172
- const goToElementFromPath = (json, path) => {
19173
- let element2 = json;
19174
- for (let i = 1; i < path.length; i++) {
19175
- const index = path[i];
19176
- const nextElements = element2.elements;
19177
- if (!nextElements) {
19178
- throw new Error("Could not find element");
19179
- }
19180
- element2 = nextElements[index];
19181
- }
19182
- return element2;
19183
- };
19184
- const goToParentElementFromPath = (json, path) => goToElementFromPath(json, path.slice(0, path.length - 1));
19185
- const getLastElementIndexFromPath = (path) => path[path.length - 1];
19186
19571
  const renderParagraphNode = (node) => {
19187
19572
  if (node.element.name !== "w:p") {
19188
19573
  throw new Error(`Invalid node type: ${node.element.name}`);
@@ -19192,7 +19577,7 @@ var __publicField = (obj, key, value) => {
19192
19577
  text: "",
19193
19578
  runs: [],
19194
19579
  index: -1,
19195
- path: []
19580
+ pathToParagraph: []
19196
19581
  };
19197
19582
  }
19198
19583
  let currentRunStringLength = 0;
@@ -19200,13 +19585,13 @@ var __publicField = (obj, key, value) => {
19200
19585
  const renderedRunNode = renderRunNode(element2, i, currentRunStringLength);
19201
19586
  currentRunStringLength += renderedRunNode.text.length;
19202
19587
  return renderedRunNode;
19203
- }).filter((e) => !!e).map((e) => e);
19588
+ }).filter((e) => !!e);
19204
19589
  const text = runs.reduce((acc, curr) => acc + curr.text, "");
19205
19590
  return {
19206
19591
  text,
19207
19592
  runs,
19208
19593
  index: node.index,
19209
- path: buildNodePath(node)
19594
+ pathToParagraph: buildNodePath(node)
19210
19595
  };
19211
19596
  };
19212
19597
  const renderRunNode = (node, index, currentRunStringIndex) => {
@@ -19222,14 +19607,14 @@ var __publicField = (obj, key, value) => {
19222
19607
  let currentTextStringIndex = currentRunStringIndex;
19223
19608
  const parts = node.elements.map(
19224
19609
  (element2, i) => {
19225
- var _a;
19610
+ var _a, _b;
19226
19611
  return element2.name === "w:t" && element2.elements && element2.elements.length > 0 ? {
19227
- text: ((_a = element2.elements[0].text) == null ? void 0 : _a.toString()) ?? "",
19612
+ text: (_b = (_a = element2.elements[0].text) == null ? void 0 : _a.toString()) != null ? _b : "",
19228
19613
  index: i,
19229
19614
  start: currentTextStringIndex,
19230
19615
  end: (() => {
19231
- var _a2;
19232
- currentTextStringIndex += (((_a2 = element2.elements[0].text) == null ? void 0 : _a2.toString()) ?? "").length - 1;
19616
+ var _a2, _b2;
19617
+ currentTextStringIndex += ((_b2 = (_a2 = element2.elements[0].text) == null ? void 0 : _a2.toString()) != null ? _b2 : "").length - 1;
19233
19618
  return currentTextStringIndex;
19234
19619
  })()
19235
19620
  } : void 0;
@@ -19246,14 +19631,14 @@ var __publicField = (obj, key, value) => {
19246
19631
  };
19247
19632
  const buildNodePath = (node) => node.parent ? [...buildNodePath(node.parent), node.index] : [node.index];
19248
19633
  const elementsToWrapper = (wrapper) => {
19249
- var _a;
19250
- return ((_a = wrapper.element.elements) == null ? void 0 : _a.map((e, i) => ({
19634
+ var _a, _b;
19635
+ return (_b = (_a = wrapper.element.elements) == null ? void 0 : _a.map((e, i) => ({
19251
19636
  element: e,
19252
19637
  index: i,
19253
19638
  parent: wrapper
19254
- }))) ?? [];
19639
+ }))) != null ? _b : [];
19255
19640
  };
19256
- const findLocationOfText = (node, text) => {
19641
+ const traverse = (node) => {
19257
19642
  let renderedParagraphs = [];
19258
19643
  const queue2 = [
19259
19644
  ...elementsToWrapper({
@@ -19271,8 +19656,74 @@ var __publicField = (obj, key, value) => {
19271
19656
  queue2.push(...elementsToWrapper(currentNode));
19272
19657
  }
19273
19658
  }
19274
- return renderedParagraphs.filter((p) => p.text.includes(text));
19659
+ return renderedParagraphs;
19660
+ };
19661
+ const findLocationOfText = (node, text) => traverse(node).filter((p) => p.text.includes(text));
19662
+ const formatter = new Formatter();
19663
+ const SPLIT_TOKEN = "ɵ";
19664
+ const replacer = ({
19665
+ json,
19666
+ patch,
19667
+ patchText,
19668
+ context,
19669
+ keepOriginalStyles = true
19670
+ }) => {
19671
+ const renderedParagraphs = findLocationOfText(json, patchText);
19672
+ if (renderedParagraphs.length === 0) {
19673
+ throw new Error(`Could not find text ${patchText}`);
19674
+ }
19675
+ for (const renderedParagraph of renderedParagraphs) {
19676
+ const textJson = patch.children.map((c) => toJson(xml$1(formatter.format(c, context)))).map((c) => c.elements[0]);
19677
+ switch (patch.type) {
19678
+ case PatchType.DOCUMENT: {
19679
+ const parentElement = goToParentElementFromPath(json, renderedParagraph.pathToParagraph);
19680
+ const elementIndex = getLastElementIndexFromPath(renderedParagraph.pathToParagraph);
19681
+ parentElement.elements.splice(elementIndex, 1, ...textJson);
19682
+ break;
19683
+ }
19684
+ case PatchType.PARAGRAPH:
19685
+ default: {
19686
+ const paragraphElement = goToElementFromPath(json, renderedParagraph.pathToParagraph);
19687
+ replaceTokenInParagraphElement({
19688
+ paragraphElement,
19689
+ renderedParagraph,
19690
+ originalText: patchText,
19691
+ replacementText: SPLIT_TOKEN
19692
+ });
19693
+ const index = findRunElementIndexWithToken(paragraphElement, SPLIT_TOKEN);
19694
+ const runElementToBeReplaced = paragraphElement.elements[index];
19695
+ const { left, right } = splitRunElement(runElementToBeReplaced, SPLIT_TOKEN);
19696
+ let newRunElements = textJson;
19697
+ let patchedRightElement = right;
19698
+ if (keepOriginalStyles) {
19699
+ const runElementNonTextualElements = runElementToBeReplaced.elements.filter(
19700
+ (e) => e.type === "element" && e.name !== "w:t"
19701
+ );
19702
+ newRunElements = textJson.map((e) => __spreadProps(__spreadValues({}, e), {
19703
+ elements: [...runElementNonTextualElements, ...e.elements]
19704
+ }));
19705
+ patchedRightElement = __spreadProps(__spreadValues({}, right), {
19706
+ elements: [...runElementNonTextualElements, ...right.elements]
19707
+ });
19708
+ }
19709
+ paragraphElement.elements.splice(index, 1, left, ...newRunElements, patchedRightElement);
19710
+ break;
19711
+ }
19712
+ }
19713
+ }
19714
+ return json;
19715
+ };
19716
+ const goToElementFromPath = (json, path) => {
19717
+ let element2 = json;
19718
+ for (let i = 1; i < path.length; i++) {
19719
+ const index = path[i];
19720
+ const nextElements = element2.elements;
19721
+ element2 = nextElements[index];
19722
+ }
19723
+ return element2;
19275
19724
  };
19725
+ const goToParentElementFromPath = (json, path) => goToElementFromPath(json, path.slice(0, path.length - 1));
19726
+ const getLastElementIndexFromPath = (path) => path[path.length - 1];
19276
19727
  const getIdFromRelationshipId = (relationshipId) => {
19277
19728
  const output = parseInt(relationshipId.substring(3), 10);
19278
19729
  return isNaN(output) ? 0 : output;
@@ -19280,8 +19731,8 @@ var __publicField = (obj, key, value) => {
19280
19731
  const getNextRelationshipIndex = (relationships) => {
19281
19732
  const relationshipElements = getFirstLevelElements(relationships, "Relationships");
19282
19733
  return relationshipElements.map((e) => {
19283
- var _a, _b;
19284
- return getIdFromRelationshipId(((_b = (_a = e.attributes) == null ? void 0 : _a.Id) == null ? void 0 : _b.toString()) ?? "");
19734
+ var _a, _b, _c;
19735
+ return getIdFromRelationshipId((_c = (_b = (_a = e.attributes) == null ? void 0 : _a.Id) == null ? void 0 : _b.toString()) != null ? _c : "");
19285
19736
  }).reduce((acc, curr) => Math.max(acc, curr), 0) + 1;
19286
19737
  };
19287
19738
  const appendRelationship = (relationships, id, type, target, targetMode) => {
@@ -19323,8 +19774,14 @@ var __publicField = (obj, key, value) => {
19323
19774
  PARAGRAPH: "paragraph"
19324
19775
  };
19325
19776
  const imageReplacer = new ImageReplacer();
19326
- const patchDocument = async (data, options2) => {
19327
- const zipContent = await JSZip.loadAsync(data);
19777
+ const patchDocument = (_0) => __async(this, [_0], function* ({
19778
+ outputType,
19779
+ data,
19780
+ patches,
19781
+ keepOriginalStyles
19782
+ }) {
19783
+ var _a, _b;
19784
+ const zipContent = yield JSZip.loadAsync(data);
19328
19785
  const contexts = /* @__PURE__ */ new Map();
19329
19786
  const file = {
19330
19787
  Media: new Media()
@@ -19336,10 +19793,10 @@ var __publicField = (obj, key, value) => {
19336
19793
  const binaryContentMap = /* @__PURE__ */ new Map();
19337
19794
  for (const [key, value] of Object.entries(zipContent.files)) {
19338
19795
  if (!key.endsWith(".xml") && !key.endsWith(".rels")) {
19339
- binaryContentMap.set(key, await value.async("uint8array"));
19796
+ binaryContentMap.set(key, yield value.async("uint8array"));
19340
19797
  continue;
19341
19798
  }
19342
- const json = toJson(await value.async("text"));
19799
+ const json = toJson(yield value.async("text"));
19343
19800
  if (key.startsWith("word/") && !key.endsWith(".xml.rels")) {
19344
19801
  const context = {
19345
19802
  file,
@@ -19359,35 +19816,38 @@ var __publicField = (obj, key, value) => {
19359
19816
  stack: []
19360
19817
  };
19361
19818
  contexts.set(key, context);
19362
- for (const [patchKey, patchValue] of Object.entries(options2.patches)) {
19819
+ for (const [patchKey, patchValue] of Object.entries(patches)) {
19363
19820
  const patchText = `{{${patchKey}}}`;
19364
- const renderedParagraphs = findLocationOfText(json, patchText);
19365
- replacer(
19366
- json,
19367
- {
19368
- ...patchValue,
19369
- children: patchValue.children.map((element2) => {
19370
- if (element2 instanceof ExternalHyperlink) {
19371
- const concreteHyperlink = new ConcreteHyperlink(element2.options.children, uniqueId());
19372
- hyperlinkRelationshipAdditions.push({
19373
- key,
19374
- hyperlink: {
19375
- id: concreteHyperlink.linkId,
19376
- link: element2.options.link
19821
+ while (true) {
19822
+ try {
19823
+ replacer({
19824
+ json,
19825
+ patch: __spreadProps(__spreadValues({}, patchValue), {
19826
+ children: patchValue.children.map((element2) => {
19827
+ if (element2 instanceof ExternalHyperlink) {
19828
+ const concreteHyperlink = new ConcreteHyperlink(element2.options.children, uniqueId());
19829
+ hyperlinkRelationshipAdditions.push({
19830
+ key,
19831
+ hyperlink: {
19832
+ id: concreteHyperlink.linkId,
19833
+ link: element2.options.link
19834
+ }
19835
+ });
19836
+ return concreteHyperlink;
19837
+ } else {
19838
+ return element2;
19377
19839
  }
19378
- });
19379
- return concreteHyperlink;
19380
- } else {
19381
- return element2;
19382
- }
19383
- })
19384
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
19385
- },
19386
- patchText,
19387
- renderedParagraphs,
19388
- context,
19389
- options2.keepOriginalStyles
19390
- );
19840
+ })
19841
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
19842
+ }),
19843
+ patchText,
19844
+ context,
19845
+ keepOriginalStyles
19846
+ });
19847
+ } catch (e) {
19848
+ break;
19849
+ }
19850
+ }
19391
19851
  }
19392
19852
  const mediaDatas = imageReplacer.getMediaData(JSON.stringify(json), context.file.Media);
19393
19853
  if (mediaDatas.length > 0) {
@@ -19402,7 +19862,7 @@ var __publicField = (obj, key, value) => {
19402
19862
  }
19403
19863
  for (const { key, mediaDatas } of imageRelationshipAdditions) {
19404
19864
  const relationshipKey = `word/_rels/${key.split("/").pop()}.rels`;
19405
- const relationshipsJson = map.get(relationshipKey) ?? createRelationshipFile();
19865
+ const relationshipsJson = (_a = map.get(relationshipKey)) != null ? _a : createRelationshipFile();
19406
19866
  map.set(relationshipKey, relationshipsJson);
19407
19867
  const index = getNextRelationshipIndex(relationshipsJson);
19408
19868
  const newJson = imageReplacer.replace(JSON.stringify(map.get(key)), mediaDatas, index);
@@ -19419,7 +19879,7 @@ var __publicField = (obj, key, value) => {
19419
19879
  }
19420
19880
  for (const { key, hyperlink } of hyperlinkRelationshipAdditions) {
19421
19881
  const relationshipKey = `word/_rels/${key.split("/").pop()}.rels`;
19422
- const relationshipsJson = map.get(relationshipKey) ?? createRelationshipFile();
19882
+ const relationshipsJson = (_b = map.get(relationshipKey)) != null ? _b : createRelationshipFile();
19423
19883
  map.set(relationshipKey, relationshipsJson);
19424
19884
  appendRelationship(
19425
19885
  relationshipsJson,
@@ -19439,6 +19899,7 @@ var __publicField = (obj, key, value) => {
19439
19899
  appendContentType(contentTypesJson, "image/jpeg", "jpg");
19440
19900
  appendContentType(contentTypesJson, "image/bmp", "bmp");
19441
19901
  appendContentType(contentTypesJson, "image/gif", "gif");
19902
+ appendContentType(contentTypesJson, "image/svg+xml", "svg");
19442
19903
  }
19443
19904
  const zip = new JSZip();
19444
19905
  for (const [key, value] of map) {
@@ -19448,15 +19909,15 @@ var __publicField = (obj, key, value) => {
19448
19909
  for (const [key, value] of binaryContentMap) {
19449
19910
  zip.file(key, value);
19450
19911
  }
19451
- for (const { stream, fileName } of file.Media.Array) {
19912
+ for (const { data: stream, fileName } of file.Media.Array) {
19452
19913
  zip.file(`word/media/${fileName}`, stream);
19453
19914
  }
19454
19915
  return zip.generateAsync({
19455
- type: "uint8array",
19916
+ type: outputType,
19456
19917
  mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
19457
19918
  compression: "DEFLATE"
19458
19919
  });
19459
- };
19920
+ });
19460
19921
  const toXml = (jsonObj) => {
19461
19922
  const output = lib.js2xml(jsonObj);
19462
19923
  return output;
@@ -19480,6 +19941,25 @@ var __publicField = (obj, key, value) => {
19480
19941
  }
19481
19942
  ]
19482
19943
  });
19944
+ const patchDetector = (_0) => __async(this, [_0], function* ({ data }) {
19945
+ const zipContent = yield JSZip.loadAsync(data);
19946
+ const patches = /* @__PURE__ */ new Set();
19947
+ for (const [key, value] of Object.entries(zipContent.files)) {
19948
+ if (!key.endsWith(".xml") && !key.endsWith(".rels")) {
19949
+ continue;
19950
+ }
19951
+ if (key.startsWith("word/") && !key.endsWith(".xml.rels")) {
19952
+ const json = toJson(yield value.async("text"));
19953
+ traverse(json).forEach((p) => findPatchKeys(p.text).forEach((patch) => patches.add(patch)));
19954
+ }
19955
+ }
19956
+ return Array.from(patches);
19957
+ });
19958
+ const findPatchKeys = (text) => {
19959
+ var _a;
19960
+ const pattern = new RegExp("(?<=\\{\\{).+?(?=\\}\\})", "gs");
19961
+ return (_a = text.match(pattern)) != null ? _a : [];
19962
+ };
19483
19963
  exports2.AbstractNumbering = AbstractNumbering;
19484
19964
  exports2.Alignment = Alignment;
19485
19965
  exports2.AlignmentAttributes = AlignmentAttributes;
@@ -19497,6 +19977,7 @@ var __publicField = (obj, key, value) => {
19497
19977
  exports2.BorderStyle = BorderStyle;
19498
19978
  exports2.BuilderElement = BuilderElement;
19499
19979
  exports2.CarriageReturn = CarriageReturn;
19980
+ exports2.CharacterSet = CharacterSet;
19500
19981
  exports2.CheckBox = CheckBox;
19501
19982
  exports2.CheckBoxSymbolElement = CheckBoxSymbolElement;
19502
19983
  exports2.CheckBoxUtil = CheckBoxUtil;
@@ -19532,6 +20013,7 @@ var __publicField = (obj, key, value) => {
19532
20013
  exports2.EndnoteReference = EndnoteReference;
19533
20014
  exports2.ExternalHyperlink = ExternalHyperlink;
19534
20015
  exports2.File = File;
20016
+ exports2.FileChild = FileChild;
19535
20017
  exports2.FootNoteReferenceRunAttributes = FootNoteReferenceRunAttributes;
19536
20018
  exports2.FootNotes = FootNotes;
19537
20019
  exports2.Footer = Footer;
@@ -19540,8 +20022,6 @@ var __publicField = (obj, key, value) => {
19540
20022
  exports2.FootnoteReferenceElement = FootnoteReferenceElement;
19541
20023
  exports2.FootnoteReferenceRun = FootnoteReferenceRun;
19542
20024
  exports2.FrameAnchorType = FrameAnchorType;
19543
- exports2.FrameProperties = FrameProperties;
19544
- exports2.FramePropertiesAttributes = FramePropertiesAttributes;
19545
20025
  exports2.FrameWrap = FrameWrap;
19546
20026
  exports2.GridSpan = GridSpan;
19547
20027
  exports2.Header = Header;
@@ -19551,6 +20031,7 @@ var __publicField = (obj, key, value) => {
19551
20031
  exports2.HeaderWrapper = HeaderWrapper;
19552
20032
  exports2.HeadingLevel = HeadingLevel;
19553
20033
  exports2.HeightRule = HeightRule;
20034
+ exports2.HighlightColor = HighlightColor;
19554
20035
  exports2.HorizontalPosition = HorizontalPosition;
19555
20036
  exports2.HorizontalPositionAlign = HorizontalPositionAlign;
19556
20037
  exports2.HorizontalPositionRelativeFrom = HorizontalPositionRelativeFrom;
@@ -19573,7 +20054,6 @@ var __publicField = (obj, key, value) => {
19573
20054
  exports2.LevelOverride = LevelOverride;
19574
20055
  exports2.LevelSuffix = LevelSuffix;
19575
20056
  exports2.LineNumberRestartFormat = LineNumberRestartFormat;
19576
- exports2.LineNumberType = LineNumberType;
19577
20057
  exports2.LineRuleType = LineRuleType;
19578
20058
  exports2.Math = Math$1;
19579
20059
  exports2.MathAccentCharacter = MathAccentCharacter;
@@ -19587,7 +20067,10 @@ var __publicField = (obj, key, value) => {
19587
20067
  exports2.MathFunctionName = MathFunctionName;
19588
20068
  exports2.MathFunctionProperties = MathFunctionProperties;
19589
20069
  exports2.MathIntegral = MathIntegral;
20070
+ exports2.MathLimit = MathLimit;
19590
20071
  exports2.MathLimitLocation = MathLimitLocation;
20072
+ exports2.MathLimitLower = MathLimitLower;
20073
+ exports2.MathLimitUpper = MathLimitUpper;
19591
20074
  exports2.MathNAryProperties = MathNAryProperties;
19592
20075
  exports2.MathNumerator = MathNumerator;
19593
20076
  exports2.MathPreSubSuperScript = MathPreSubSuperScript;
@@ -19731,6 +20214,9 @@ var __publicField = (obj, key, value) => {
19731
20214
  exports2.convertInchesToTwip = convertInchesToTwip;
19732
20215
  exports2.convertMillimetersToTwip = convertMillimetersToTwip;
19733
20216
  exports2.convertToXmlComponent = convertToXmlComponent;
20217
+ exports2.createFrameProperties = createFrameProperties;
20218
+ exports2.createLineNumberType = createLineNumberType;
20219
+ exports2.createStringElement = createStringElement;
19734
20220
  exports2.dateTimeValue = dateTimeValue;
19735
20221
  exports2.decimalNumber = decimalNumber;
19736
20222
  exports2.docPropertiesUniqueNumericIdGen = docPropertiesUniqueNumericIdGen;
@@ -19739,6 +20225,7 @@ var __publicField = (obj, key, value) => {
19739
20225
  exports2.hpsMeasureValue = hpsMeasureValue;
19740
20226
  exports2.longHexNumber = longHexNumber;
19741
20227
  exports2.measurementOrPercentValue = measurementOrPercentValue;
20228
+ exports2.patchDetector = patchDetector;
19742
20229
  exports2.patchDocument = patchDocument;
19743
20230
  exports2.percentageValue = percentageValue;
19744
20231
  exports2.pointMeasureValue = pointMeasureValue;
@@ -19752,6 +20239,7 @@ var __publicField = (obj, key, value) => {
19752
20239
  exports2.uCharHexNumber = uCharHexNumber;
19753
20240
  exports2.uniqueId = uniqueId;
19754
20241
  exports2.uniqueNumericIdCreator = uniqueNumericIdCreator;
20242
+ exports2.uniqueUuid = uniqueUuid;
19755
20243
  exports2.universalMeasureValue = universalMeasureValue;
19756
20244
  exports2.unsignedDecimalNumber = unsignedDecimalNumber;
19757
20245
  Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });