docx 9.0.2 → 9.0.3

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.
@@ -223,10 +223,10 @@ var __async = (__this, __arguments, generator) => {
223
223
  EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
224
224
  return _getMaxListeners(this);
225
225
  };
226
- EventEmitter.prototype.emit = function emit(type) {
226
+ EventEmitter.prototype.emit = function emit(type2) {
227
227
  var args = [];
228
228
  for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
229
- var doError = type === "error";
229
+ var doError = type2 === "error";
230
230
  var events2 = this._events;
231
231
  if (events2 !== void 0)
232
232
  doError = doError && events2.error === void 0;
@@ -243,7 +243,7 @@ var __async = (__this, __arguments, generator) => {
243
243
  err.context = er;
244
244
  throw err;
245
245
  }
246
- var handler = events2[type];
246
+ var handler = events2[type2];
247
247
  if (handler === void 0)
248
248
  return false;
249
249
  if (typeof handler === "function") {
@@ -256,7 +256,7 @@ var __async = (__this, __arguments, generator) => {
256
256
  }
257
257
  return true;
258
258
  };
259
- function _addListener(target, type, listener, prepend) {
259
+ function _addListener(target, type2, listener, prepend) {
260
260
  var m;
261
261
  var events2;
262
262
  var existing;
@@ -269,19 +269,19 @@ var __async = (__this, __arguments, generator) => {
269
269
  if (events2.newListener !== void 0) {
270
270
  target.emit(
271
271
  "newListener",
272
- type,
272
+ type2,
273
273
  listener.listener ? listener.listener : listener
274
274
  );
275
275
  events2 = target._events;
276
276
  }
277
- existing = events2[type];
277
+ existing = events2[type2];
278
278
  }
279
279
  if (existing === void 0) {
280
- existing = events2[type] = listener;
280
+ existing = events2[type2] = listener;
281
281
  ++target._eventsCount;
282
282
  } else {
283
283
  if (typeof existing === "function") {
284
- existing = events2[type] = prepend ? [listener, existing] : [existing, listener];
284
+ existing = events2[type2] = prepend ? [listener, existing] : [existing, listener];
285
285
  } else if (prepend) {
286
286
  existing.unshift(listener);
287
287
  } else {
@@ -290,22 +290,22 @@ var __async = (__this, __arguments, generator) => {
290
290
  m = _getMaxListeners(target);
291
291
  if (m > 0 && existing.length > m && !existing.warned) {
292
292
  existing.warned = true;
293
- var w = new Error("Possible EventEmitter memory leak detected. " + existing.length + " " + String(type) + " listeners added. Use emitter.setMaxListeners() to increase limit");
293
+ var w = new Error("Possible EventEmitter memory leak detected. " + existing.length + " " + String(type2) + " listeners added. Use emitter.setMaxListeners() to increase limit");
294
294
  w.name = "MaxListenersExceededWarning";
295
295
  w.emitter = target;
296
- w.type = type;
296
+ w.type = type2;
297
297
  w.count = existing.length;
298
298
  ProcessEmitWarning(w);
299
299
  }
300
300
  }
301
301
  return target;
302
302
  }
303
- EventEmitter.prototype.addListener = function addListener(type, listener) {
304
- return _addListener(this, type, listener, false);
303
+ EventEmitter.prototype.addListener = function addListener(type2, listener) {
304
+ return _addListener(this, type2, listener, false);
305
305
  };
306
306
  EventEmitter.prototype.on = EventEmitter.prototype.addListener;
307
- EventEmitter.prototype.prependListener = function prependListener(type, listener) {
308
- return _addListener(this, type, listener, true);
307
+ EventEmitter.prototype.prependListener = function prependListener(type2, listener) {
308
+ return _addListener(this, type2, listener, true);
309
309
  };
310
310
  function onceWrapper() {
311
311
  if (!this.fired) {
@@ -316,39 +316,39 @@ var __async = (__this, __arguments, generator) => {
316
316
  return this.listener.apply(this.target, arguments);
317
317
  }
318
318
  }
319
- function _onceWrap(target, type, listener) {
320
- var state2 = { fired: false, wrapFn: void 0, target, type, listener };
319
+ function _onceWrap(target, type2, listener) {
320
+ var state2 = { fired: false, wrapFn: void 0, target, type: type2, listener };
321
321
  var wrapped = onceWrapper.bind(state2);
322
322
  wrapped.listener = listener;
323
323
  state2.wrapFn = wrapped;
324
324
  return wrapped;
325
325
  }
326
- EventEmitter.prototype.once = function once2(type, listener) {
326
+ EventEmitter.prototype.once = function once2(type2, listener) {
327
327
  checkListener(listener);
328
- this.on(type, _onceWrap(this, type, listener));
328
+ this.on(type2, _onceWrap(this, type2, listener));
329
329
  return this;
330
330
  };
331
- EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) {
331
+ EventEmitter.prototype.prependOnceListener = function prependOnceListener(type2, listener) {
332
332
  checkListener(listener);
333
- this.prependListener(type, _onceWrap(this, type, listener));
333
+ this.prependListener(type2, _onceWrap(this, type2, listener));
334
334
  return this;
335
335
  };
336
- EventEmitter.prototype.removeListener = function removeListener(type, listener) {
336
+ EventEmitter.prototype.removeListener = function removeListener(type2, listener) {
337
337
  var list, events2, position, i, originalListener;
338
338
  checkListener(listener);
339
339
  events2 = this._events;
340
340
  if (events2 === void 0)
341
341
  return this;
342
- list = events2[type];
342
+ list = events2[type2];
343
343
  if (list === void 0)
344
344
  return this;
345
345
  if (list === listener || list.listener === listener) {
346
346
  if (--this._eventsCount === 0)
347
347
  this._events = /* @__PURE__ */ Object.create(null);
348
348
  else {
349
- delete events2[type];
349
+ delete events2[type2];
350
350
  if (events2.removeListener)
351
- this.emit("removeListener", type, list.listener || listener);
351
+ this.emit("removeListener", type2, list.listener || listener);
352
352
  }
353
353
  } else if (typeof list !== "function") {
354
354
  position = -1;
@@ -367,14 +367,14 @@ var __async = (__this, __arguments, generator) => {
367
367
  spliceOne(list, position);
368
368
  }
369
369
  if (list.length === 1)
370
- events2[type] = list[0];
370
+ events2[type2] = list[0];
371
371
  if (events2.removeListener !== void 0)
372
- this.emit("removeListener", type, originalListener || listener);
372
+ this.emit("removeListener", type2, originalListener || listener);
373
373
  }
374
374
  return this;
375
375
  };
376
376
  EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
377
- EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) {
377
+ EventEmitter.prototype.removeAllListeners = function removeAllListeners(type2) {
378
378
  var listeners, events2, i;
379
379
  events2 = this._events;
380
380
  if (events2 === void 0)
@@ -383,11 +383,11 @@ var __async = (__this, __arguments, generator) => {
383
383
  if (arguments.length === 0) {
384
384
  this._events = /* @__PURE__ */ Object.create(null);
385
385
  this._eventsCount = 0;
386
- } else if (events2[type] !== void 0) {
386
+ } else if (events2[type2] !== void 0) {
387
387
  if (--this._eventsCount === 0)
388
388
  this._events = /* @__PURE__ */ Object.create(null);
389
389
  else
390
- delete events2[type];
390
+ delete events2[type2];
391
391
  }
392
392
  return this;
393
393
  }
@@ -404,45 +404,45 @@ var __async = (__this, __arguments, generator) => {
404
404
  this._eventsCount = 0;
405
405
  return this;
406
406
  }
407
- listeners = events2[type];
407
+ listeners = events2[type2];
408
408
  if (typeof listeners === "function") {
409
- this.removeListener(type, listeners);
409
+ this.removeListener(type2, listeners);
410
410
  } else if (listeners !== void 0) {
411
411
  for (i = listeners.length - 1; i >= 0; i--) {
412
- this.removeListener(type, listeners[i]);
412
+ this.removeListener(type2, listeners[i]);
413
413
  }
414
414
  }
415
415
  return this;
416
416
  };
417
- function _listeners(target, type, unwrap) {
417
+ function _listeners(target, type2, unwrap) {
418
418
  var events2 = target._events;
419
419
  if (events2 === void 0)
420
420
  return [];
421
- var evlistener = events2[type];
421
+ var evlistener = events2[type2];
422
422
  if (evlistener === void 0)
423
423
  return [];
424
424
  if (typeof evlistener === "function")
425
425
  return unwrap ? [evlistener.listener || evlistener] : [evlistener];
426
426
  return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
427
427
  }
428
- EventEmitter.prototype.listeners = function listeners(type) {
429
- return _listeners(this, type, true);
428
+ EventEmitter.prototype.listeners = function listeners(type2) {
429
+ return _listeners(this, type2, true);
430
430
  };
431
- EventEmitter.prototype.rawListeners = function rawListeners(type) {
432
- return _listeners(this, type, false);
431
+ EventEmitter.prototype.rawListeners = function rawListeners(type2) {
432
+ return _listeners(this, type2, false);
433
433
  };
434
- EventEmitter.listenerCount = function(emitter, type) {
434
+ EventEmitter.listenerCount = function(emitter, type2) {
435
435
  if (typeof emitter.listenerCount === "function") {
436
- return emitter.listenerCount(type);
436
+ return emitter.listenerCount(type2);
437
437
  } else {
438
- return listenerCount.call(emitter, type);
438
+ return listenerCount.call(emitter, type2);
439
439
  }
440
440
  };
441
441
  EventEmitter.prototype.listenerCount = listenerCount;
442
- function listenerCount(type) {
442
+ function listenerCount(type2) {
443
443
  var events2 = this._events;
444
444
  if (events2 !== void 0) {
445
- var evlistener = events2[type];
445
+ var evlistener = events2[type2];
446
446
  if (typeof evlistener === "function") {
447
447
  return 1;
448
448
  } else if (evlistener !== void 0) {
@@ -2255,8 +2255,8 @@ var __async = (__this, __arguments, generator) => {
2255
2255
  }
2256
2256
  return i;
2257
2257
  }
2258
- function isInstance(obj, type) {
2259
- return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name;
2258
+ function isInstance(obj, type2) {
2259
+ return obj instanceof type2 || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type2.name;
2260
2260
  }
2261
2261
  function numberIsNaN(obj) {
2262
2262
  return obj !== obj;
@@ -2340,6 +2340,62 @@ var __async = (__this, __arguments, generator) => {
2340
2340
  };
2341
2341
  return shams;
2342
2342
  }
2343
+ var esErrors;
2344
+ var hasRequiredEsErrors;
2345
+ function requireEsErrors() {
2346
+ if (hasRequiredEsErrors) return esErrors;
2347
+ hasRequiredEsErrors = 1;
2348
+ esErrors = Error;
2349
+ return esErrors;
2350
+ }
2351
+ var _eval;
2352
+ var hasRequired_eval;
2353
+ function require_eval() {
2354
+ if (hasRequired_eval) return _eval;
2355
+ hasRequired_eval = 1;
2356
+ _eval = EvalError;
2357
+ return _eval;
2358
+ }
2359
+ var range;
2360
+ var hasRequiredRange;
2361
+ function requireRange() {
2362
+ if (hasRequiredRange) return range;
2363
+ hasRequiredRange = 1;
2364
+ range = RangeError;
2365
+ return range;
2366
+ }
2367
+ var ref;
2368
+ var hasRequiredRef;
2369
+ function requireRef() {
2370
+ if (hasRequiredRef) return ref;
2371
+ hasRequiredRef = 1;
2372
+ ref = ReferenceError;
2373
+ return ref;
2374
+ }
2375
+ var syntax;
2376
+ var hasRequiredSyntax;
2377
+ function requireSyntax() {
2378
+ if (hasRequiredSyntax) return syntax;
2379
+ hasRequiredSyntax = 1;
2380
+ syntax = SyntaxError;
2381
+ return syntax;
2382
+ }
2383
+ var type;
2384
+ var hasRequiredType;
2385
+ function requireType() {
2386
+ if (hasRequiredType) return type;
2387
+ hasRequiredType = 1;
2388
+ type = TypeError;
2389
+ return type;
2390
+ }
2391
+ var uri;
2392
+ var hasRequiredUri;
2393
+ function requireUri() {
2394
+ if (hasRequiredUri) return uri;
2395
+ hasRequiredUri = 1;
2396
+ uri = URIError;
2397
+ return uri;
2398
+ }
2343
2399
  var hasSymbols;
2344
2400
  var hasRequiredHasSymbols;
2345
2401
  function requireHasSymbols() {
@@ -2370,11 +2426,12 @@ var __async = (__this, __arguments, generator) => {
2370
2426
  if (hasRequiredHasProto) return hasProto;
2371
2427
  hasRequiredHasProto = 1;
2372
2428
  var test = {
2429
+ __proto__: null,
2373
2430
  foo: {}
2374
2431
  };
2375
2432
  var $Object = Object;
2376
2433
  hasProto = function hasProto2() {
2377
- return { __proto__: test }.foo === test.foo && !({ __proto__: null } instanceof $Object);
2434
+ return { __proto__: test }.foo === test.foo && !(test instanceof $Object);
2378
2435
  };
2379
2436
  return hasProto;
2380
2437
  }
@@ -2480,9 +2537,14 @@ var __async = (__this, __arguments, generator) => {
2480
2537
  if (hasRequiredGetIntrinsic) return getIntrinsic;
2481
2538
  hasRequiredGetIntrinsic = 1;
2482
2539
  var undefined$1;
2483
- var $SyntaxError = SyntaxError;
2540
+ var $Error = requireEsErrors();
2541
+ var $EvalError = require_eval();
2542
+ var $RangeError = requireRange();
2543
+ var $ReferenceError = requireRef();
2544
+ var $SyntaxError = requireSyntax();
2545
+ var $TypeError = requireType();
2546
+ var $URIError = requireUri();
2484
2547
  var $Function = Function;
2485
- var $TypeError = TypeError;
2486
2548
  var getEvalledConstructor = function(expressionSyntax) {
2487
2549
  try {
2488
2550
  return $Function('"use strict"; return (' + expressionSyntax + ").constructor;")();
@@ -2520,6 +2582,7 @@ var __async = (__this, __arguments, generator) => {
2520
2582
  var needsEval = {};
2521
2583
  var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
2522
2584
  var INTRINSICS = {
2585
+ __proto__: null,
2523
2586
  "%AggregateError%": typeof AggregateError === "undefined" ? undefined$1 : AggregateError,
2524
2587
  "%Array%": Array,
2525
2588
  "%ArrayBuffer%": typeof ArrayBuffer === "undefined" ? undefined$1 : ArrayBuffer,
@@ -2540,10 +2603,10 @@ var __async = (__this, __arguments, generator) => {
2540
2603
  "%decodeURIComponent%": decodeURIComponent,
2541
2604
  "%encodeURI%": encodeURI,
2542
2605
  "%encodeURIComponent%": encodeURIComponent,
2543
- "%Error%": Error,
2606
+ "%Error%": $Error,
2544
2607
  "%eval%": eval,
2545
2608
  // eslint-disable-line no-eval
2546
- "%EvalError%": EvalError,
2609
+ "%EvalError%": $EvalError,
2547
2610
  "%Float32Array%": typeof Float32Array === "undefined" ? undefined$1 : Float32Array,
2548
2611
  "%Float64Array%": typeof Float64Array === "undefined" ? undefined$1 : Float64Array,
2549
2612
  "%FinalizationRegistry%": typeof FinalizationRegistry === "undefined" ? undefined$1 : FinalizationRegistry,
@@ -2565,8 +2628,8 @@ var __async = (__this, __arguments, generator) => {
2565
2628
  "%parseInt%": parseInt,
2566
2629
  "%Promise%": typeof Promise === "undefined" ? undefined$1 : Promise,
2567
2630
  "%Proxy%": typeof Proxy === "undefined" ? undefined$1 : Proxy,
2568
- "%RangeError%": RangeError,
2569
- "%ReferenceError%": ReferenceError,
2631
+ "%RangeError%": $RangeError,
2632
+ "%ReferenceError%": $ReferenceError,
2570
2633
  "%Reflect%": typeof Reflect === "undefined" ? undefined$1 : Reflect,
2571
2634
  "%RegExp%": RegExp,
2572
2635
  "%Set%": typeof Set === "undefined" ? undefined$1 : Set,
@@ -2583,7 +2646,7 @@ var __async = (__this, __arguments, generator) => {
2583
2646
  "%Uint8ClampedArray%": typeof Uint8ClampedArray === "undefined" ? undefined$1 : Uint8ClampedArray,
2584
2647
  "%Uint16Array%": typeof Uint16Array === "undefined" ? undefined$1 : Uint16Array,
2585
2648
  "%Uint32Array%": typeof Uint32Array === "undefined" ? undefined$1 : Uint32Array,
2586
- "%URIError%": URIError,
2649
+ "%URIError%": $URIError,
2587
2650
  "%WeakMap%": typeof WeakMap === "undefined" ? undefined$1 : WeakMap,
2588
2651
  "%WeakRef%": typeof WeakRef === "undefined" ? undefined$1 : WeakRef,
2589
2652
  "%WeakSet%": typeof WeakSet === "undefined" ? undefined$1 : WeakSet
@@ -2619,6 +2682,7 @@ var __async = (__this, __arguments, generator) => {
2619
2682
  return value;
2620
2683
  };
2621
2684
  var LEGACY_ALIASES = {
2685
+ __proto__: null,
2622
2686
  "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"],
2623
2687
  "%ArrayPrototype%": ["Array", "prototype"],
2624
2688
  "%ArrayProto_entries%": ["Array", "prototype", "entries"],
@@ -2781,36 +2845,22 @@ var __async = (__this, __arguments, generator) => {
2781
2845
  return getIntrinsic;
2782
2846
  }
2783
2847
  var callBind = { exports: {} };
2784
- var hasPropertyDescriptors_1;
2785
- var hasRequiredHasPropertyDescriptors;
2786
- function requireHasPropertyDescriptors() {
2787
- if (hasRequiredHasPropertyDescriptors) return hasPropertyDescriptors_1;
2788
- hasRequiredHasPropertyDescriptors = 1;
2848
+ var esDefineProperty;
2849
+ var hasRequiredEsDefineProperty;
2850
+ function requireEsDefineProperty() {
2851
+ if (hasRequiredEsDefineProperty) return esDefineProperty;
2852
+ hasRequiredEsDefineProperty = 1;
2789
2853
  var GetIntrinsic = requireGetIntrinsic();
2790
- var $defineProperty = GetIntrinsic("%Object.defineProperty%", true);
2791
- var hasPropertyDescriptors = function hasPropertyDescriptors2() {
2792
- if ($defineProperty) {
2793
- try {
2794
- $defineProperty({}, "a", { value: 1 });
2795
- return true;
2796
- } catch (e) {
2797
- return false;
2798
- }
2799
- }
2800
- return false;
2801
- };
2802
- hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
2803
- if (!hasPropertyDescriptors()) {
2804
- return null;
2805
- }
2854
+ var $defineProperty = GetIntrinsic("%Object.defineProperty%", true) || false;
2855
+ if ($defineProperty) {
2806
2856
  try {
2807
- return $defineProperty([], "length", { value: 1 }).length !== 1;
2857
+ $defineProperty({}, "a", { value: 1 });
2808
2858
  } catch (e) {
2809
- return true;
2859
+ $defineProperty = false;
2810
2860
  }
2811
- };
2812
- hasPropertyDescriptors_1 = hasPropertyDescriptors;
2813
- return hasPropertyDescriptors_1;
2861
+ }
2862
+ esDefineProperty = $defineProperty;
2863
+ return esDefineProperty;
2814
2864
  }
2815
2865
  var gopd;
2816
2866
  var hasRequiredGopd;
@@ -2834,18 +2884,9 @@ var __async = (__this, __arguments, generator) => {
2834
2884
  function requireDefineDataProperty() {
2835
2885
  if (hasRequiredDefineDataProperty) return defineDataProperty;
2836
2886
  hasRequiredDefineDataProperty = 1;
2837
- var hasPropertyDescriptors = requireHasPropertyDescriptors()();
2838
- var GetIntrinsic = requireGetIntrinsic();
2839
- var $defineProperty = hasPropertyDescriptors && GetIntrinsic("%Object.defineProperty%", true);
2840
- if ($defineProperty) {
2841
- try {
2842
- $defineProperty({}, "a", { value: 1 });
2843
- } catch (e) {
2844
- $defineProperty = false;
2845
- }
2846
- }
2847
- var $SyntaxError = GetIntrinsic("%SyntaxError%");
2848
- var $TypeError = GetIntrinsic("%TypeError%");
2887
+ var $defineProperty = requireEsDefineProperty();
2888
+ var $SyntaxError = requireSyntax();
2889
+ var $TypeError = requireType();
2849
2890
  var gopd2 = requireGopd();
2850
2891
  defineDataProperty = function defineDataProperty2(obj, property, value) {
2851
2892
  if (!obj || typeof obj !== "object" && typeof obj !== "function") {
@@ -2886,6 +2927,28 @@ var __async = (__this, __arguments, generator) => {
2886
2927
  };
2887
2928
  return defineDataProperty;
2888
2929
  }
2930
+ var hasPropertyDescriptors_1;
2931
+ var hasRequiredHasPropertyDescriptors;
2932
+ function requireHasPropertyDescriptors() {
2933
+ if (hasRequiredHasPropertyDescriptors) return hasPropertyDescriptors_1;
2934
+ hasRequiredHasPropertyDescriptors = 1;
2935
+ var $defineProperty = requireEsDefineProperty();
2936
+ var hasPropertyDescriptors = function hasPropertyDescriptors2() {
2937
+ return !!$defineProperty;
2938
+ };
2939
+ hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
2940
+ if (!$defineProperty) {
2941
+ return null;
2942
+ }
2943
+ try {
2944
+ return $defineProperty([], "length", { value: 1 }).length !== 1;
2945
+ } catch (e) {
2946
+ return true;
2947
+ }
2948
+ };
2949
+ hasPropertyDescriptors_1 = hasPropertyDescriptors;
2950
+ return hasPropertyDescriptors_1;
2951
+ }
2889
2952
  var setFunctionLength;
2890
2953
  var hasRequiredSetFunctionLength;
2891
2954
  function requireSetFunctionLength() {
@@ -2895,7 +2958,7 @@ var __async = (__this, __arguments, generator) => {
2895
2958
  var define2 = requireDefineDataProperty();
2896
2959
  var hasDescriptors = requireHasPropertyDescriptors()();
2897
2960
  var gOPD = requireGopd();
2898
- var $TypeError = GetIntrinsic("%TypeError%");
2961
+ var $TypeError = requireType();
2899
2962
  var $floor = GetIntrinsic("%Math.floor%");
2900
2963
  setFunctionLength = function setFunctionLength2(fn, length) {
2901
2964
  if (typeof fn !== "function") {
@@ -2918,9 +2981,21 @@ var __async = (__this, __arguments, generator) => {
2918
2981
  }
2919
2982
  if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
2920
2983
  if (hasDescriptors) {
2921
- define2(fn, "length", length, true, true);
2984
+ define2(
2985
+ /** @type {Parameters<define>[0]} */
2986
+ fn,
2987
+ "length",
2988
+ length,
2989
+ true,
2990
+ true
2991
+ );
2922
2992
  } else {
2923
- define2(fn, "length", length);
2993
+ define2(
2994
+ /** @type {Parameters<define>[0]} */
2995
+ fn,
2996
+ "length",
2997
+ length
2998
+ );
2924
2999
  }
2925
3000
  }
2926
3001
  return fn;
@@ -2935,19 +3010,12 @@ var __async = (__this, __arguments, generator) => {
2935
3010
  var bind = requireFunctionBind();
2936
3011
  var GetIntrinsic = requireGetIntrinsic();
2937
3012
  var setFunctionLength2 = requireSetFunctionLength();
2938
- var $TypeError = GetIntrinsic("%TypeError%");
3013
+ var $TypeError = requireType();
2939
3014
  var $apply = GetIntrinsic("%Function.prototype.apply%");
2940
3015
  var $call = GetIntrinsic("%Function.prototype.call%");
2941
3016
  var $reflectApply = GetIntrinsic("%Reflect.apply%", true) || bind.call($call, $apply);
2942
- var $defineProperty = GetIntrinsic("%Object.defineProperty%", true);
3017
+ var $defineProperty = requireEsDefineProperty();
2943
3018
  var $max = GetIntrinsic("%Math.max%");
2944
- if ($defineProperty) {
2945
- try {
2946
- $defineProperty({}, "a", { value: 1 });
2947
- } catch (e) {
2948
- $defineProperty = null;
2949
- }
2950
- }
2951
3019
  module2.exports = function callBind2(originalFunction) {
2952
3020
  if (typeof originalFunction !== "function") {
2953
3021
  throw new $TypeError("a function is required");
@@ -3231,24 +3299,32 @@ var __async = (__this, __arguments, generator) => {
3231
3299
  forEach_1 = forEach;
3232
3300
  return forEach_1;
3233
3301
  }
3234
- var availableTypedArrays;
3235
- var hasRequiredAvailableTypedArrays;
3236
- function requireAvailableTypedArrays() {
3237
- if (hasRequiredAvailableTypedArrays) return availableTypedArrays;
3238
- hasRequiredAvailableTypedArrays = 1;
3239
- var possibleNames = [
3240
- "BigInt64Array",
3241
- "BigUint64Array",
3302
+ var possibleTypedArrayNames;
3303
+ var hasRequiredPossibleTypedArrayNames;
3304
+ function requirePossibleTypedArrayNames() {
3305
+ if (hasRequiredPossibleTypedArrayNames) return possibleTypedArrayNames;
3306
+ hasRequiredPossibleTypedArrayNames = 1;
3307
+ possibleTypedArrayNames = [
3242
3308
  "Float32Array",
3243
3309
  "Float64Array",
3310
+ "Int8Array",
3244
3311
  "Int16Array",
3245
3312
  "Int32Array",
3246
- "Int8Array",
3313
+ "Uint8Array",
3314
+ "Uint8ClampedArray",
3247
3315
  "Uint16Array",
3248
3316
  "Uint32Array",
3249
- "Uint8Array",
3250
- "Uint8ClampedArray"
3317
+ "BigInt64Array",
3318
+ "BigUint64Array"
3251
3319
  ];
3320
+ return possibleTypedArrayNames;
3321
+ }
3322
+ var availableTypedArrays;
3323
+ var hasRequiredAvailableTypedArrays;
3324
+ function requireAvailableTypedArrays() {
3325
+ if (hasRequiredAvailableTypedArrays) return availableTypedArrays;
3326
+ hasRequiredAvailableTypedArrays = 1;
3327
+ var possibleNames = requirePossibleTypedArrayNames();
3252
3328
  var g = typeof globalThis === "undefined" ? commonjsGlobal : globalThis;
3253
3329
  availableTypedArrays = function availableTypedArrays2() {
3254
3330
  var out = [];
@@ -3310,29 +3386,43 @@ var __async = (__this, __arguments, generator) => {
3310
3386
  }
3311
3387
  var tryTypedArrays = function tryAllTypedArrays(value) {
3312
3388
  var found = false;
3313
- forEach(cache, function(getter, typedArray) {
3314
- if (!found) {
3315
- try {
3316
- if ("$" + getter(value) === typedArray) {
3317
- found = $slice(typedArray, 1);
3389
+ forEach(
3390
+ // eslint-disable-next-line no-extra-parens
3391
+ /** @type {Record<`\$${TypedArrayName}`, Getter>} */
3392
+ /** @type {any} */
3393
+ cache,
3394
+ /** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */
3395
+ function(getter, typedArray) {
3396
+ if (!found) {
3397
+ try {
3398
+ if ("$" + getter(value) === typedArray) {
3399
+ found = $slice(typedArray, 1);
3400
+ }
3401
+ } catch (e) {
3318
3402
  }
3319
- } catch (e) {
3320
3403
  }
3321
3404
  }
3322
- });
3405
+ );
3323
3406
  return found;
3324
3407
  };
3325
3408
  var trySlices = function tryAllSlices(value) {
3326
3409
  var found = false;
3327
- forEach(cache, function(getter, name) {
3328
- if (!found) {
3329
- try {
3330
- getter(value);
3331
- found = $slice(name, 1);
3332
- } catch (e) {
3410
+ forEach(
3411
+ // eslint-disable-next-line no-extra-parens
3412
+ /** @type {Record<`\$${TypedArrayName}`, Getter>} */
3413
+ /** @type {any} */
3414
+ cache,
3415
+ /** @type {(getter: typeof cache, name: `\$${import('.').TypedArrayName}`) => void} */
3416
+ function(getter, name) {
3417
+ if (!found) {
3418
+ try {
3419
+ getter(value);
3420
+ found = $slice(name, 1);
3421
+ } catch (e) {
3422
+ }
3333
3423
  }
3334
3424
  }
3335
- });
3425
+ );
3336
3426
  return found;
3337
3427
  };
3338
3428
  whichTypedArray = function whichTypedArray2(value) {
@@ -4569,8 +4659,8 @@ var __async = (__this, __arguments, generator) => {
4569
4659
  if (endsWith(name, " argument")) {
4570
4660
  msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, "type"));
4571
4661
  } else {
4572
- var type = includes(name, ".") ? "property" : "argument";
4573
- msg = 'The "'.concat(name, '" ').concat(type, " ").concat(determiner, " ").concat(oneOf(expected, "type"));
4662
+ var type2 = includes(name, ".") ? "property" : "argument";
4663
+ msg = 'The "'.concat(name, '" ').concat(type2, " ").concat(determiner, " ").concat(oneOf(expected, "type"));
4574
4664
  }
4575
4665
  msg += ". Received type ".concat(typeof actual);
4576
4666
  return msg;
@@ -5785,8 +5875,8 @@ var __async = (__this, __arguments, generator) => {
5785
5875
  var Duplex;
5786
5876
  Readable.ReadableState = ReadableState;
5787
5877
  eventsExports.EventEmitter;
5788
- var EElistenerCount = function EElistenerCount2(emitter, type) {
5789
- return emitter.listeners(type).length;
5878
+ var EElistenerCount = function EElistenerCount2(emitter, type2) {
5879
+ return emitter.listeners(type2).length;
5790
5880
  };
5791
5881
  var Stream2 = requireStreamBrowser();
5792
5882
  var Buffer2 = requireBuffer().Buffer;
@@ -7512,15 +7602,15 @@ var __async = (__this, __arguments, generator) => {
7512
7602
  var qualName = qname(name, true);
7513
7603
  var prefix = qualName.prefix;
7514
7604
  var local = qualName.local;
7515
- var uri = prefix === "" ? "" : tag.ns[prefix] || "";
7605
+ var uri2 = prefix === "" ? "" : tag.ns[prefix] || "";
7516
7606
  var a = {
7517
7607
  name,
7518
7608
  value,
7519
7609
  prefix,
7520
7610
  local,
7521
- uri
7611
+ uri: uri2
7522
7612
  };
7523
- if (prefix && prefix !== "xmlns" && !uri) {
7613
+ if (prefix && prefix !== "xmlns" && !uri2) {
7524
7614
  strictFail(parser, "Unbound namespace prefix: " + JSON.stringify(prefix));
7525
7615
  a.uri = prefix;
7526
7616
  }
@@ -8307,19 +8397,19 @@ var __async = (__this, __arguments, generator) => {
8307
8397
  }
8308
8398
  return value;
8309
8399
  }
8310
- function addField(type, value) {
8400
+ function addField(type2, value) {
8311
8401
  var key;
8312
8402
  if (options.compact) {
8313
- if (!currentElement$1[options[type + "Key"]] && (isArray$1(options.alwaysArray) ? options.alwaysArray.indexOf(options[type + "Key"]) !== -1 : options.alwaysArray)) {
8314
- currentElement$1[options[type + "Key"]] = [];
8403
+ if (!currentElement$1[options[type2 + "Key"]] && (isArray$1(options.alwaysArray) ? options.alwaysArray.indexOf(options[type2 + "Key"]) !== -1 : options.alwaysArray)) {
8404
+ currentElement$1[options[type2 + "Key"]] = [];
8315
8405
  }
8316
- if (currentElement$1[options[type + "Key"]] && !isArray$1(currentElement$1[options[type + "Key"]])) {
8317
- currentElement$1[options[type + "Key"]] = [currentElement$1[options[type + "Key"]]];
8406
+ if (currentElement$1[options[type2 + "Key"]] && !isArray$1(currentElement$1[options[type2 + "Key"]])) {
8407
+ currentElement$1[options[type2 + "Key"]] = [currentElement$1[options[type2 + "Key"]]];
8318
8408
  }
8319
- if (type + "Fn" in options && typeof value === "string") {
8320
- value = options[type + "Fn"](value, currentElement$1);
8409
+ if (type2 + "Fn" in options && typeof value === "string") {
8410
+ value = options[type2 + "Fn"](value, currentElement$1);
8321
8411
  }
8322
- if (type === "instruction" && ("instructionFn" in options || "instructionNameFn" in options)) {
8412
+ if (type2 === "instruction" && ("instructionFn" in options || "instructionNameFn" in options)) {
8323
8413
  for (key in value) {
8324
8414
  if (value.hasOwnProperty(key)) {
8325
8415
  if ("instructionFn" in options) {
@@ -8332,18 +8422,18 @@ var __async = (__this, __arguments, generator) => {
8332
8422
  }
8333
8423
  }
8334
8424
  }
8335
- if (isArray$1(currentElement$1[options[type + "Key"]])) {
8336
- currentElement$1[options[type + "Key"]].push(value);
8425
+ if (isArray$1(currentElement$1[options[type2 + "Key"]])) {
8426
+ currentElement$1[options[type2 + "Key"]].push(value);
8337
8427
  } else {
8338
- currentElement$1[options[type + "Key"]] = value;
8428
+ currentElement$1[options[type2 + "Key"]] = value;
8339
8429
  }
8340
8430
  } else {
8341
8431
  if (!currentElement$1[options.elementsKey]) {
8342
8432
  currentElement$1[options.elementsKey] = [];
8343
8433
  }
8344
8434
  var element2 = {};
8345
- element2[options.typeKey] = type;
8346
- if (type === "instruction") {
8435
+ element2[options.typeKey] = type2;
8436
+ if (type2 === "instruction") {
8347
8437
  for (key in value) {
8348
8438
  if (value.hasOwnProperty(key)) {
8349
8439
  break;
@@ -8362,10 +8452,10 @@ var __async = (__this, __arguments, generator) => {
8362
8452
  element2[options.instructionKey] = value[key];
8363
8453
  }
8364
8454
  } else {
8365
- if (type + "Fn" in options) {
8366
- value = options[type + "Fn"](value, currentElement$1);
8455
+ if (type2 + "Fn" in options) {
8456
+ value = options[type2 + "Fn"](value, currentElement$1);
8367
8457
  }
8368
- element2[options[type + "Key"]] = value;
8458
+ element2[options[type2 + "Key"]] = value;
8369
8459
  }
8370
8460
  if (options.addParent) {
8371
8461
  element2[options.parentKey] = currentElement$1;
@@ -9165,9 +9255,9 @@ var __async = (__this, __arguments, generator) => {
9165
9255
  }
9166
9256
  }
9167
9257
  class Alignment extends XmlComponent {
9168
- constructor(type) {
9258
+ constructor(type2) {
9169
9259
  super("w:jc");
9170
- this.root.push(new AlignmentAttributes({ val: type }));
9260
+ this.root.push(new AlignmentAttributes({ val: type2 }));
9171
9261
  }
9172
9262
  }
9173
9263
  class BorderElement extends XmlComponent {
@@ -9447,13 +9537,13 @@ var __async = (__this, __arguments, generator) => {
9447
9537
  }
9448
9538
  }
9449
9539
  class Shading extends XmlComponent {
9450
- constructor({ fill, color, type }) {
9540
+ constructor({ fill, color, type: type2 }) {
9451
9541
  super("w:shd");
9452
9542
  this.root.push(
9453
9543
  new ShadingAttributes({
9454
9544
  fill: fill === void 0 ? void 0 : hexColorValue(fill),
9455
9545
  color: color === void 0 ? void 0 : hexColorValue(color),
9456
- type
9546
+ type: type2
9457
9547
  })
9458
9548
  );
9459
9549
  }
@@ -9620,11 +9710,11 @@ var __async = (__this, __arguments, generator) => {
9620
9710
  }
9621
9711
  }
9622
9712
  let VerticalAlign$1 = class VerticalAlign extends XmlComponent {
9623
- constructor(type) {
9713
+ constructor(type2) {
9624
9714
  super("w:vertAlign");
9625
9715
  this.root.push(
9626
9716
  new Attributes({
9627
- val: type
9717
+ val: type2
9628
9718
  })
9629
9719
  );
9630
9720
  }
@@ -9945,25 +10035,6 @@ var __async = (__this, __arguments, generator) => {
9945
10035
  this.root.push(new Symbol$1(options2.char, options2.symbolfont));
9946
10036
  }
9947
10037
  }
9948
- let urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
9949
- let customAlphabet = (alphabet, defaultSize = 21) => {
9950
- return (size = defaultSize) => {
9951
- let id = "";
9952
- let i = size;
9953
- while (i--) {
9954
- id += alphabet[Math.random() * alphabet.length | 0];
9955
- }
9956
- return id;
9957
- };
9958
- };
9959
- let nanoid = (size = 21) => {
9960
- let id = "";
9961
- let i = size;
9962
- while (i--) {
9963
- id += urlAlphabet[Math.random() * 64 | 0];
9964
- }
9965
- return id;
9966
- };
9967
10038
  var hash$1 = {};
9968
10039
  var utils$9 = {};
9969
10040
  var minimalisticAssert = assert$5;
@@ -11524,6 +11595,25 @@ var __async = (__this, __arguments, generator) => {
11524
11595
  hash2.ripemd160 = hash2.ripemd.ripemd160;
11525
11596
  })(hash$1);
11526
11597
  const hash = /* @__PURE__ */ getDefaultExportFromCjs$1(hash$1);
11598
+ let urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
11599
+ let customAlphabet = (alphabet, defaultSize = 21) => {
11600
+ return (size = defaultSize) => {
11601
+ let id = "";
11602
+ let i = size;
11603
+ while (i--) {
11604
+ id += alphabet[Math.random() * alphabet.length | 0];
11605
+ }
11606
+ return id;
11607
+ };
11608
+ };
11609
+ let nanoid = (size = 21) => {
11610
+ let id = "";
11611
+ let i = size;
11612
+ while (i--) {
11613
+ id += urlAlphabet[Math.random() * 64 | 0];
11614
+ }
11615
+ return id;
11616
+ };
11527
11617
  const convertMillimetersToTwip = (millimeters) => Math.floor(millimeters / 25.4 * 72 * 20);
11528
11618
  const convertInchesToTwip = (inches) => Math.floor(inches * 72 * 20);
11529
11619
  const uniqueNumericIdCreator = (initial = 0) => {
@@ -11869,8 +11959,8 @@ var __async = (__this, __arguments, generator) => {
11869
11959
  }
11870
11960
  }
11871
11961
  const createNoFill = () => new BuilderElement({ name: "a:noFill" });
11872
- const createSchemeColor = (options2) => new BuilderElement({
11873
- name: "a:schemeClr",
11962
+ const createSolidRgbColor = (options2) => new BuilderElement({
11963
+ name: "a:srgbClr",
11874
11964
  attributes: {
11875
11965
  value: {
11876
11966
  key: "val",
@@ -11878,8 +11968,8 @@ var __async = (__this, __arguments, generator) => {
11878
11968
  }
11879
11969
  }
11880
11970
  });
11881
- const createSolidRgbColor = (options2) => new BuilderElement({
11882
- name: "a:srgbClr",
11971
+ const createSchemeColor = (options2) => new BuilderElement({
11972
+ name: "a:schemeClr",
11883
11973
  attributes: {
11884
11974
  value: {
11885
11975
  key: "val",
@@ -12685,7 +12775,6 @@ var __async = (__this, __arguments, generator) => {
12685
12775
  DOT: "dot",
12686
12776
  HYPHEN: "hyphen",
12687
12777
  UNDERSCORE: "underscore",
12688
- // eslint-disable-next-line @typescript-eslint/naming-convention
12689
12778
  MIDDLE_DOT: "middleDot"
12690
12779
  };
12691
12780
  class PositionalTab extends XmlComponent {
@@ -12715,11 +12804,11 @@ var __async = (__this, __arguments, generator) => {
12715
12804
  // textWrapping breaks are the default and already exposed via the "Run" class
12716
12805
  };
12717
12806
  class Break extends XmlComponent {
12718
- constructor(type) {
12807
+ constructor(type2) {
12719
12808
  super("w:br");
12720
12809
  this.root.push(
12721
12810
  new Attributes({
12722
- type
12811
+ type: type2
12723
12812
  })
12724
12813
  );
12725
12814
  }
@@ -12742,7 +12831,6 @@ var __async = (__this, __arguments, generator) => {
12742
12831
  }
12743
12832
  }
12744
12833
  const LineRuleType = {
12745
- // eslint-disable-next-line @typescript-eslint/naming-convention
12746
12834
  AT_LEAST: "atLeast",
12747
12835
  EXACTLY: "exactly",
12748
12836
  EXACT: "exact",
@@ -12808,7 +12896,6 @@ var __async = (__this, __arguments, generator) => {
12808
12896
  const LeaderType = {
12809
12897
  DOT: "dot",
12810
12898
  HYPHEN: "hyphen",
12811
- // eslint-disable-next-line @typescript-eslint/naming-convention
12812
12899
  MIDDLE_DOT: "middleDot",
12813
12900
  NONE: "none",
12814
12901
  UNDERSCORE: "underscore"
@@ -12823,11 +12910,11 @@ var __async = (__this, __arguments, generator) => {
12823
12910
  }
12824
12911
  }
12825
12912
  class TabStopItem extends XmlComponent {
12826
- constructor({ type, position, leader }) {
12913
+ constructor({ type: type2, position, leader }) {
12827
12914
  super("w:tab");
12828
12915
  this.root.push(
12829
12916
  new TabAttributes({
12830
- val: type,
12917
+ val: type2,
12831
12918
  pos: position,
12832
12919
  leader
12833
12920
  })
@@ -12887,12 +12974,12 @@ var __async = (__this, __arguments, generator) => {
12887
12974
  EXTERNAL: "External"
12888
12975
  };
12889
12976
  class Relationship extends XmlComponent {
12890
- constructor(id, type, target, targetMode) {
12977
+ constructor(id, type2, target, targetMode) {
12891
12978
  super("Relationship");
12892
12979
  this.root.push(
12893
12980
  new RelationshipAttributes({
12894
12981
  id,
12895
- type,
12982
+ type: type2,
12896
12983
  target,
12897
12984
  targetMode
12898
12985
  })
@@ -13040,35 +13127,6 @@ var __async = (__this, __arguments, generator) => {
13040
13127
  this.root.push(new VerticalAlignAttributes({ verticalAlign: value }));
13041
13128
  }
13042
13129
  }
13043
- const HeaderFooterReferenceType = {
13044
- DEFAULT: "default",
13045
- FIRST: "first",
13046
- EVEN: "even"
13047
- };
13048
- class FooterReferenceAttributes extends XmlAttributeComponent {
13049
- constructor() {
13050
- super(...arguments);
13051
- __publicField(this, "xmlKeys", {
13052
- type: "w:type",
13053
- id: "r:id"
13054
- });
13055
- }
13056
- }
13057
- const HeaderFooterType = {
13058
- HEADER: "w:headerReference",
13059
- FOOTER: "w:footerReference"
13060
- };
13061
- class HeaderFooterReference extends XmlComponent {
13062
- constructor(type, options2) {
13063
- super(type);
13064
- this.root.push(
13065
- new FooterReferenceAttributes({
13066
- type: options2.type || HeaderFooterReferenceType.DEFAULT,
13067
- id: `rId${options2.id}`
13068
- })
13069
- );
13070
- }
13071
- }
13072
13130
  class Columns extends XmlComponent {
13073
13131
  constructor({ space, count, separate, equalWidth, children }) {
13074
13132
  super("w:cols");
@@ -13102,17 +13160,46 @@ var __async = (__this, __arguments, generator) => {
13102
13160
  }
13103
13161
  }
13104
13162
  class DocumentGrid extends XmlComponent {
13105
- constructor(linePitch, charSpace, type) {
13163
+ constructor(linePitch, charSpace, type2) {
13106
13164
  super("w:docGrid");
13107
13165
  this.root.push(
13108
13166
  new DocGridAttributes({
13109
- type,
13167
+ type: type2,
13110
13168
  linePitch: decimalNumber(linePitch),
13111
13169
  charSpace: charSpace ? decimalNumber(charSpace) : void 0
13112
13170
  })
13113
13171
  );
13114
13172
  }
13115
13173
  }
13174
+ const HeaderFooterReferenceType = {
13175
+ DEFAULT: "default",
13176
+ FIRST: "first",
13177
+ EVEN: "even"
13178
+ };
13179
+ class FooterReferenceAttributes extends XmlAttributeComponent {
13180
+ constructor() {
13181
+ super(...arguments);
13182
+ __publicField(this, "xmlKeys", {
13183
+ type: "w:type",
13184
+ id: "r:id"
13185
+ });
13186
+ }
13187
+ }
13188
+ const HeaderFooterType = {
13189
+ HEADER: "w:headerReference",
13190
+ FOOTER: "w:footerReference"
13191
+ };
13192
+ class HeaderFooterReference extends XmlComponent {
13193
+ constructor(type2, options2) {
13194
+ super(type2);
13195
+ this.root.push(
13196
+ new FooterReferenceAttributes({
13197
+ type: options2.type || HeaderFooterReferenceType.DEFAULT,
13198
+ id: `rId${options2.id}`
13199
+ })
13200
+ );
13201
+ }
13202
+ }
13116
13203
  const LineNumberRestartFormat = {
13117
13204
  NEW_PAGE: "newPage",
13118
13205
  NEW_SECTION: "newSection",
@@ -13331,13 +13418,13 @@ var __async = (__this, __arguments, generator) => {
13331
13418
  titlePage,
13332
13419
  verticalAlign,
13333
13420
  column,
13334
- type
13421
+ type: type2
13335
13422
  } = {}) {
13336
13423
  super("w:sectPr");
13337
13424
  this.addHeaderFooterGroup(HeaderFooterType.HEADER, headerWrapperGroup);
13338
13425
  this.addHeaderFooterGroup(HeaderFooterType.FOOTER, footerWrapperGroup);
13339
- if (type) {
13340
- this.root.push(new Type(type));
13426
+ if (type2) {
13427
+ this.root.push(new Type(type2));
13341
13428
  }
13342
13429
  this.root.push(new PageSize(width, height, orientation));
13343
13430
  this.root.push(new PageMargin(top, right, bottom, left, header, footer, gutter));
@@ -13362,10 +13449,10 @@ var __async = (__this, __arguments, generator) => {
13362
13449
  }
13363
13450
  this.root.push(new DocumentGrid(linePitch, charSpace, gridType));
13364
13451
  }
13365
- addHeaderFooterGroup(type, group) {
13452
+ addHeaderFooterGroup(type2, group) {
13366
13453
  if (group.default) {
13367
13454
  this.root.push(
13368
- new HeaderFooterReference(type, {
13455
+ new HeaderFooterReference(type2, {
13369
13456
  type: HeaderFooterReferenceType.DEFAULT,
13370
13457
  id: group.default.View.ReferenceId
13371
13458
  })
@@ -13373,7 +13460,7 @@ var __async = (__this, __arguments, generator) => {
13373
13460
  }
13374
13461
  if (group.first) {
13375
13462
  this.root.push(
13376
- new HeaderFooterReference(type, {
13463
+ new HeaderFooterReference(type2, {
13377
13464
  type: HeaderFooterReferenceType.FIRST,
13378
13465
  id: group.first.View.ReferenceId
13379
13466
  })
@@ -13381,7 +13468,7 @@ var __async = (__this, __arguments, generator) => {
13381
13468
  }
13382
13469
  if (group.even) {
13383
13470
  this.root.push(
13384
- new HeaderFooterReference(type, {
13471
+ new HeaderFooterReference(type2, {
13385
13472
  type: HeaderFooterReferenceType.EVEN,
13386
13473
  id: group.even.View.ReferenceId
13387
13474
  })
@@ -13580,8 +13667,8 @@ var __async = (__this, __arguments, generator) => {
13580
13667
  })
13581
13668
  );
13582
13669
  }
13583
- createRelationship(id, type, target, targetMode) {
13584
- const relationship = new Relationship(`rId${id}`, type, target, targetMode);
13670
+ createRelationship(id, type2, target, targetMode) {
13671
+ const relationship = new Relationship(`rId${id}`, type2, target, targetMode);
13585
13672
  this.root.push(relationship);
13586
13673
  return relationship;
13587
13674
  }
@@ -13629,7 +13716,6 @@ var __async = (__this, __arguments, generator) => {
13629
13716
  AROUND: "around",
13630
13717
  AUTO: "auto",
13631
13718
  NONE: "none",
13632
- // eslint-disable-next-line @typescript-eslint/naming-convention
13633
13719
  NOT_BESIDE: "notBeside",
13634
13720
  THROUGH: "through",
13635
13721
  TIGHT: "tight"
@@ -14257,12 +14343,11 @@ var __async = (__this, __arguments, generator) => {
14257
14343
  }
14258
14344
  const TableCellMarginElementType = {
14259
14345
  TABLE: "w:tblCellMar",
14260
- // eslint-disable-next-line @typescript-eslint/naming-convention
14261
14346
  TABLE_CELL: "w:tcMar"
14262
14347
  };
14263
14348
  class TableCellMargin extends IgnoreIfEmptyXmlComponent {
14264
- constructor(type, { marginUnitType = WidthType.DXA, top, left, bottom, right }) {
14265
- super(type);
14349
+ constructor(type2, { marginUnitType = WidthType.DXA, top, left, bottom, right }) {
14350
+ super(type2);
14266
14351
  if (top !== void 0) {
14267
14352
  this.root.push(new TableWidthElement("w:top", { type: marginUnitType, size: top }));
14268
14353
  }
@@ -14288,15 +14373,15 @@ var __async = (__this, __arguments, generator) => {
14288
14373
  PERCENTAGE: "pct"
14289
14374
  };
14290
14375
  class TableWidthElement extends XmlComponent {
14291
- constructor(name, { type = WidthType.AUTO, size }) {
14376
+ constructor(name, { type: type2 = WidthType.AUTO, size }) {
14292
14377
  super(name);
14293
14378
  let tableWidthValue = size;
14294
- if (type === WidthType.PERCENTAGE && typeof size === "number") {
14379
+ if (type2 === WidthType.PERCENTAGE && typeof size === "number") {
14295
14380
  tableWidthValue = `${size}%`;
14296
14381
  }
14297
14382
  this.root.push(
14298
14383
  new NextAttributeComponent({
14299
- type: { key: "w:type", value: type },
14384
+ type: { key: "w:type", value: type2 },
14300
14385
  size: { key: "w:w", value: measurementOrPercentValue(tableWidthValue) }
14301
14386
  })
14302
14387
  );
@@ -14368,11 +14453,8 @@ var __async = (__this, __arguments, generator) => {
14368
14453
  }
14369
14454
  }
14370
14455
  const TextDirection = {
14371
- // eslint-disable-next-line @typescript-eslint/naming-convention
14372
14456
  BOTTOM_TO_TOP_LEFT_TO_RIGHT: "btLr",
14373
- // eslint-disable-next-line @typescript-eslint/naming-convention
14374
14457
  LEFT_TO_RIGHT_TOP_TO_BOTTOM: "lrTb",
14375
- // eslint-disable-next-line @typescript-eslint/naming-convention
14376
14458
  TOP_TO_BOTTOM_RIGHT_TO_LEFT: "tbRl"
14377
14459
  };
14378
14460
  class TDirectionAttributes extends XmlAttributeComponent {
@@ -14590,9 +14672,9 @@ var __async = (__this, __arguments, generator) => {
14590
14672
  }
14591
14673
  }
14592
14674
  class TableLayout extends XmlComponent {
14593
- constructor(type) {
14675
+ constructor(type2) {
14594
14676
  super("w:tblLayout");
14595
- this.root.push(new TableLayoutAttributes({ type }));
14677
+ this.root.push(new TableLayoutAttributes({ type: type2 }));
14596
14678
  }
14597
14679
  }
14598
14680
  class TableProperties extends IgnoreIfEmptyXmlComponent {
@@ -14999,70 +15081,229 @@ var __async = (__this, __arguments, generator) => {
14999
15081
  this.properties.push(new CustomProperty(this.nextId++, property));
15000
15082
  }
15001
15083
  }
15002
- class FooterAttributes extends XmlAttributeComponent {
15003
- constructor() {
15004
- super(...arguments);
15005
- __publicField(this, "xmlKeys", {
15006
- wpc: "xmlns:wpc",
15007
- mc: "xmlns:mc",
15008
- o: "xmlns:o",
15009
- r: "xmlns:r",
15010
- m: "xmlns:m",
15011
- v: "xmlns:v",
15012
- wp14: "xmlns:wp14",
15013
- wp: "xmlns:wp",
15014
- w10: "xmlns:w10",
15015
- w: "xmlns:w",
15016
- w14: "xmlns:w14",
15017
- w15: "xmlns:w15",
15018
- wpg: "xmlns:wpg",
15019
- wpi: "xmlns:wpi",
15020
- wne: "xmlns:wne",
15021
- wps: "xmlns:wps",
15022
- cp: "xmlns:cp",
15023
- dc: "xmlns:dc",
15024
- dcterms: "xmlns:dcterms",
15025
- dcmitype: "xmlns:dcmitype",
15026
- xsi: "xmlns:xsi",
15027
- type: "xsi:type"
15028
- });
15029
- }
15030
- }
15031
- let Footer$1 = class Footer extends InitializableXmlComponent {
15032
- constructor(referenceNumber, initContent) {
15033
- super("w:ftr", initContent);
15034
- __publicField(this, "refId");
15035
- this.refId = referenceNumber;
15036
- if (!initContent) {
15037
- this.root.push(
15038
- new FooterAttributes({
15039
- wpc: "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",
15040
- mc: "http://schemas.openxmlformats.org/markup-compatibility/2006",
15041
- o: "urn:schemas-microsoft-com:office:office",
15042
- r: "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
15043
- m: "http://schemas.openxmlformats.org/officeDocument/2006/math",
15044
- v: "urn:schemas-microsoft-com:vml",
15045
- wp14: "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",
15046
- wp: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",
15047
- w10: "urn:schemas-microsoft-com:office:word",
15048
- w: "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
15049
- w14: "http://schemas.microsoft.com/office/word/2010/wordml",
15050
- w15: "http://schemas.microsoft.com/office/word/2012/wordml",
15051
- wpg: "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",
15052
- wpi: "http://schemas.microsoft.com/office/word/2010/wordprocessingInk",
15053
- wne: "http://schemas.microsoft.com/office/word/2006/wordml",
15054
- wps: "http://schemas.microsoft.com/office/word/2010/wordprocessingShape"
15055
- })
15056
- );
15057
- }
15058
- }
15059
- get ReferenceId() {
15060
- return this.refId;
15061
- }
15062
- add(item) {
15063
- this.root.push(item);
15064
- }
15065
- };
15084
+ const CharacterSet = {
15085
+ ANSI: "00",
15086
+ DEFAULT: "01",
15087
+ SYMBOL: "02",
15088
+ MAC: "4D",
15089
+ JIS: "80",
15090
+ HANGUL: "81",
15091
+ JOHAB: "82",
15092
+ GB_2312: "86",
15093
+ CHINESEBIG5: "88",
15094
+ GREEK: "A1",
15095
+ TURKISH: "A2",
15096
+ VIETNAMESE: "A3",
15097
+ HEBREW: "B1",
15098
+ ARABIC: "B2",
15099
+ BALTIC: "BA",
15100
+ RUSSIAN: "CC",
15101
+ THAI: "DE",
15102
+ EASTEUROPE: "EE",
15103
+ OEM: "FF"
15104
+ };
15105
+ const createFontRelationship = ({ id, fontKey, subsetted }, name) => new BuilderElement({
15106
+ name,
15107
+ attributes: __spreadValues({
15108
+ id: { key: "r:id", value: id }
15109
+ }, fontKey ? { fontKey: { key: "w:fontKey", value: `{${fontKey}}` } } : {}),
15110
+ children: [...subsetted ? [new OnOffElement("w:subsetted", subsetted)] : []]
15111
+ });
15112
+ const createFont = ({
15113
+ name,
15114
+ altName,
15115
+ panose1,
15116
+ charset,
15117
+ family,
15118
+ notTrueType,
15119
+ pitch,
15120
+ sig,
15121
+ embedRegular,
15122
+ embedBold,
15123
+ embedItalic,
15124
+ embedBoldItalic
15125
+ }) => (
15126
+ // http://www.datypic.com/sc/ooxml/e-w_font-1.html
15127
+ new BuilderElement({
15128
+ name: "w:font",
15129
+ attributes: {
15130
+ name: { key: "w:name", value: name }
15131
+ },
15132
+ children: [
15133
+ // http://www.datypic.com/sc/ooxml/e-w_altName-1.html
15134
+ ...altName ? [createStringElement("w:altName", altName)] : [],
15135
+ // http://www.datypic.com/sc/ooxml/e-w_panose1-1.html
15136
+ ...panose1 ? [createStringElement("w:panose1", panose1)] : [],
15137
+ // http://www.datypic.com/sc/ooxml/e-w_charset-1.html
15138
+ ...charset ? [createStringElement("w:charset", charset)] : [],
15139
+ // http://www.datypic.com/sc/ooxml/e-w_family-1.html
15140
+ ...family ? [createStringElement("w:family", family)] : [],
15141
+ // http://www.datypic.com/sc/ooxml/e-w_notTrueType-1.html
15142
+ ...notTrueType ? [new OnOffElement("w:notTrueType", notTrueType)] : [],
15143
+ ...pitch ? [createStringElement("w:pitch", pitch)] : [],
15144
+ // http://www.datypic.com/sc/ooxml/e-w_sig-1.html
15145
+ ...sig ? [
15146
+ new BuilderElement({
15147
+ name: "w:sig",
15148
+ attributes: {
15149
+ usb0: { key: "w:usb0", value: sig.usb0 },
15150
+ usb1: { key: "w:usb1", value: sig.usb1 },
15151
+ usb2: { key: "w:usb2", value: sig.usb2 },
15152
+ usb3: { key: "w:usb3", value: sig.usb3 },
15153
+ csb0: { key: "w:csb0", value: sig.csb0 },
15154
+ csb1: { key: "w:csb1", value: sig.csb1 }
15155
+ }
15156
+ })
15157
+ ] : [],
15158
+ // http://www.datypic.com/sc/ooxml/e-w_embedRegular-1.html
15159
+ ...embedRegular ? [createFontRelationship(embedRegular, "w:embedRegular")] : [],
15160
+ // http://www.datypic.com/sc/ooxml/e-w_embedBold-1.html
15161
+ ...embedBold ? [createFontRelationship(embedBold, "w:embedBold")] : [],
15162
+ // http://www.datypic.com/sc/ooxml/e-w_embedItalic-1.html
15163
+ ...embedItalic ? [createFontRelationship(embedItalic, "w:embedItalic")] : [],
15164
+ // http://www.datypic.com/sc/ooxml/e-w_embedBoldItalic-1.html
15165
+ ...embedBoldItalic ? [createFontRelationship(embedBoldItalic, "w:embedBoldItalic")] : []
15166
+ ]
15167
+ })
15168
+ );
15169
+ const createRegularFont = ({
15170
+ name,
15171
+ index,
15172
+ fontKey,
15173
+ characterSet
15174
+ }) => createFont({
15175
+ name,
15176
+ sig: {
15177
+ usb0: "E0002AFF",
15178
+ usb1: "C000247B",
15179
+ usb2: "00000009",
15180
+ usb3: "00000000",
15181
+ csb0: "000001FF",
15182
+ csb1: "00000000"
15183
+ },
15184
+ charset: characterSet,
15185
+ family: "auto",
15186
+ pitch: "variable",
15187
+ embedRegular: {
15188
+ fontKey,
15189
+ id: `rId${index}`
15190
+ }
15191
+ });
15192
+ const createFontTable = (fonts) => (
15193
+ // https://c-rex.net/projects/samples/ooxml/e1/Part4/OOXML_P4_DOCX_Font_topic_ID0ERNCU.html
15194
+ // http://www.datypic.com/sc/ooxml/e-w_fonts.html
15195
+ new BuilderElement({
15196
+ name: "w:fonts",
15197
+ attributes: {
15198
+ mc: { key: "xmlns:mc", value: "http://schemas.openxmlformats.org/markup-compatibility/2006" },
15199
+ r: { key: "xmlns:r", value: "http://schemas.openxmlformats.org/officeDocument/2006/relationships" },
15200
+ w: { key: "xmlns:w", value: "http://schemas.openxmlformats.org/wordprocessingml/2006/main" },
15201
+ w14: { key: "xmlns:w14", value: "http://schemas.microsoft.com/office/word/2010/wordml" },
15202
+ w15: { key: "xmlns:w15", value: "http://schemas.microsoft.com/office/word/2012/wordml" },
15203
+ w16cex: { key: "xmlns:w16cex", value: "http://schemas.microsoft.com/office/word/2018/wordml/cex" },
15204
+ w16cid: { key: "xmlns:w16cid", value: "http://schemas.microsoft.com/office/word/2016/wordml/cid" },
15205
+ w16: { key: "xmlns:w16", value: "http://schemas.microsoft.com/office/word/2018/wordml" },
15206
+ w16sdtdh: { key: "xmlns:w16sdtdh", value: "http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" },
15207
+ w16se: { key: "xmlns:w16se", value: "http://schemas.microsoft.com/office/word/2015/wordml/symex" },
15208
+ Ignorable: { key: "mc:Ignorable", value: "w14 w15 w16se w16cid w16 w16cex w16sdtdh" }
15209
+ },
15210
+ children: fonts.map(
15211
+ (font, i) => createRegularFont({
15212
+ name: font.name,
15213
+ index: i + 1,
15214
+ fontKey: font.fontKey
15215
+ })
15216
+ )
15217
+ })
15218
+ );
15219
+ class FontWrapper {
15220
+ constructor(options2) {
15221
+ __publicField(this, "fontTable");
15222
+ __publicField(this, "relationships");
15223
+ __publicField(this, "fontOptionsWithKey", []);
15224
+ this.options = options2;
15225
+ this.fontOptionsWithKey = options2.map((o) => __spreadProps(__spreadValues({}, o), { fontKey: uniqueUuid() }));
15226
+ this.fontTable = createFontTable(this.fontOptionsWithKey);
15227
+ this.relationships = new Relationships();
15228
+ for (let i = 0; i < options2.length; i++) {
15229
+ this.relationships.createRelationship(
15230
+ i + 1,
15231
+ "http://schemas.openxmlformats.org/officeDocument/2006/relationships/font",
15232
+ `fonts/${options2[i].name}.odttf`
15233
+ );
15234
+ }
15235
+ }
15236
+ get View() {
15237
+ return this.fontTable;
15238
+ }
15239
+ get Relationships() {
15240
+ return this.relationships;
15241
+ }
15242
+ }
15243
+ class FooterAttributes extends XmlAttributeComponent {
15244
+ constructor() {
15245
+ super(...arguments);
15246
+ __publicField(this, "xmlKeys", {
15247
+ wpc: "xmlns:wpc",
15248
+ mc: "xmlns:mc",
15249
+ o: "xmlns:o",
15250
+ r: "xmlns:r",
15251
+ m: "xmlns:m",
15252
+ v: "xmlns:v",
15253
+ wp14: "xmlns:wp14",
15254
+ wp: "xmlns:wp",
15255
+ w10: "xmlns:w10",
15256
+ w: "xmlns:w",
15257
+ w14: "xmlns:w14",
15258
+ w15: "xmlns:w15",
15259
+ wpg: "xmlns:wpg",
15260
+ wpi: "xmlns:wpi",
15261
+ wne: "xmlns:wne",
15262
+ wps: "xmlns:wps",
15263
+ cp: "xmlns:cp",
15264
+ dc: "xmlns:dc",
15265
+ dcterms: "xmlns:dcterms",
15266
+ dcmitype: "xmlns:dcmitype",
15267
+ xsi: "xmlns:xsi",
15268
+ type: "xsi:type"
15269
+ });
15270
+ }
15271
+ }
15272
+ let Footer$1 = class Footer extends InitializableXmlComponent {
15273
+ constructor(referenceNumber, initContent) {
15274
+ super("w:ftr", initContent);
15275
+ __publicField(this, "refId");
15276
+ this.refId = referenceNumber;
15277
+ if (!initContent) {
15278
+ this.root.push(
15279
+ new FooterAttributes({
15280
+ wpc: "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",
15281
+ mc: "http://schemas.openxmlformats.org/markup-compatibility/2006",
15282
+ o: "urn:schemas-microsoft-com:office:office",
15283
+ r: "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
15284
+ m: "http://schemas.openxmlformats.org/officeDocument/2006/math",
15285
+ v: "urn:schemas-microsoft-com:vml",
15286
+ wp14: "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",
15287
+ wp: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",
15288
+ w10: "urn:schemas-microsoft-com:office:word",
15289
+ w: "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
15290
+ w14: "http://schemas.microsoft.com/office/word/2010/wordml",
15291
+ w15: "http://schemas.microsoft.com/office/word/2012/wordml",
15292
+ wpg: "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",
15293
+ wpi: "http://schemas.microsoft.com/office/word/2010/wordprocessingInk",
15294
+ wne: "http://schemas.microsoft.com/office/word/2006/wordml",
15295
+ wps: "http://schemas.microsoft.com/office/word/2010/wordprocessingShape"
15296
+ })
15297
+ );
15298
+ }
15299
+ }
15300
+ get ReferenceId() {
15301
+ return this.refId;
15302
+ }
15303
+ add(item) {
15304
+ this.root.push(item);
15305
+ }
15306
+ };
15066
15307
  class FooterWrapper {
15067
15308
  constructor(media, referenceId, initContent) {
15068
15309
  __publicField(this, "footer");
@@ -15111,7 +15352,6 @@ var __async = (__this, __arguments, generator) => {
15111
15352
  }
15112
15353
  const FootnoteType = {
15113
15354
  SEPERATOR: "separator",
15114
- // eslint-disable-next-line @typescript-eslint/naming-convention
15115
15355
  CONTINUATION_SEPERATOR: "continuationSeparator"
15116
15356
  };
15117
15357
  class Footnote extends XmlComponent {
@@ -16453,246 +16693,87 @@ var __async = (__this, __arguments, generator) => {
16453
16693
  const xmlObj = lib.xml2js(xmlData, { compact: false });
16454
16694
  let stylesXmlElement;
16455
16695
  for (const xmlElm of xmlObj.elements || []) {
16456
- if (xmlElm.name === "w:styles") {
16457
- stylesXmlElement = xmlElm;
16458
- }
16459
- }
16460
- if (stylesXmlElement === void 0) {
16461
- throw new Error("can not find styles element");
16462
- }
16463
- const stylesElements = stylesXmlElement.elements || [];
16464
- const importedStyle = new Styles({
16465
- initialStyles: new ImportedRootElementAttributes(stylesXmlElement.attributes),
16466
- importedStyles: stylesElements.map((childElm) => convertToXmlComponent(childElm))
16467
- });
16468
- return importedStyle;
16469
- }
16470
- }
16471
- class DefaultStylesFactory {
16472
- newInstance(options2 = {}) {
16473
- var _a;
16474
- const documentAttributes = new DocumentAttributes({
16475
- mc: "http://schemas.openxmlformats.org/markup-compatibility/2006",
16476
- r: "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
16477
- w: "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
16478
- w14: "http://schemas.microsoft.com/office/word/2010/wordml",
16479
- w15: "http://schemas.microsoft.com/office/word/2012/wordml",
16480
- Ignorable: "w14 w15"
16481
- });
16482
- return {
16483
- initialStyles: documentAttributes,
16484
- importedStyles: [
16485
- new DocumentDefaults((_a = options2.document) != null ? _a : {}),
16486
- new TitleStyle(__spreadValues({
16487
- run: {
16488
- size: 56
16489
- }
16490
- }, options2.title)),
16491
- new Heading1Style(__spreadValues({
16492
- run: {
16493
- color: "2E74B5",
16494
- size: 32
16495
- }
16496
- }, options2.heading1)),
16497
- new Heading2Style(__spreadValues({
16498
- run: {
16499
- color: "2E74B5",
16500
- size: 26
16501
- }
16502
- }, options2.heading2)),
16503
- new Heading3Style(__spreadValues({
16504
- run: {
16505
- color: "1F4D78",
16506
- size: 24
16507
- }
16508
- }, options2.heading3)),
16509
- new Heading4Style(__spreadValues({
16510
- run: {
16511
- color: "2E74B5",
16512
- italics: true
16513
- }
16514
- }, options2.heading4)),
16515
- new Heading5Style(__spreadValues({
16516
- run: {
16517
- color: "2E74B5"
16518
- }
16519
- }, options2.heading5)),
16520
- new Heading6Style(__spreadValues({
16521
- run: {
16522
- color: "1F4D78"
16523
- }
16524
- }, options2.heading6)),
16525
- new StrongStyle(__spreadValues({
16526
- run: {
16527
- bold: true
16528
- }
16529
- }, options2.strong)),
16530
- new ListParagraph(options2.listParagraph || {}),
16531
- new HyperlinkStyle(options2.hyperlink || {}),
16532
- new FootnoteReferenceStyle(options2.footnoteReference || {}),
16533
- new FootnoteText(options2.footnoteText || {}),
16534
- new FootnoteTextChar(options2.footnoteTextChar || {})
16535
- ]
16536
- };
16537
- }
16538
- }
16539
- const CharacterSet = {
16540
- ANSI: "00",
16541
- DEFAULT: "01",
16542
- SYMBOL: "02",
16543
- MAC: "4D",
16544
- JIS: "80",
16545
- HANGUL: "81",
16546
- JOHAB: "82",
16547
- GB_2312: "86",
16548
- CHINESEBIG5: "88",
16549
- GREEK: "A1",
16550
- TURKISH: "A2",
16551
- VIETNAMESE: "A3",
16552
- HEBREW: "B1",
16553
- ARABIC: "B2",
16554
- BALTIC: "BA",
16555
- RUSSIAN: "CC",
16556
- THAI: "DE",
16557
- EASTEUROPE: "EE",
16558
- OEM: "FF"
16559
- };
16560
- const createFontRelationship = ({ id, fontKey, subsetted }, name) => new BuilderElement({
16561
- name,
16562
- attributes: __spreadValues({
16563
- id: { key: "r:id", value: id }
16564
- }, fontKey ? { fontKey: { key: "w:fontKey", value: `{${fontKey}}` } } : {}),
16565
- children: [...subsetted ? [new OnOffElement("w:subsetted", subsetted)] : []]
16566
- });
16567
- const createFont = ({
16568
- name,
16569
- altName,
16570
- panose1,
16571
- charset,
16572
- family,
16573
- notTrueType,
16574
- pitch,
16575
- sig,
16576
- embedRegular,
16577
- embedBold,
16578
- embedItalic,
16579
- embedBoldItalic
16580
- }) => (
16581
- // http://www.datypic.com/sc/ooxml/e-w_font-1.html
16582
- new BuilderElement({
16583
- name: "w:font",
16584
- attributes: {
16585
- name: { key: "w:name", value: name }
16586
- },
16587
- children: [
16588
- // http://www.datypic.com/sc/ooxml/e-w_altName-1.html
16589
- ...altName ? [createStringElement("w:altName", altName)] : [],
16590
- // http://www.datypic.com/sc/ooxml/e-w_panose1-1.html
16591
- ...panose1 ? [createStringElement("w:panose1", panose1)] : [],
16592
- // http://www.datypic.com/sc/ooxml/e-w_charset-1.html
16593
- ...charset ? [createStringElement("w:charset", charset)] : [],
16594
- // http://www.datypic.com/sc/ooxml/e-w_family-1.html
16595
- ...family ? [createStringElement("w:family", family)] : [],
16596
- // http://www.datypic.com/sc/ooxml/e-w_notTrueType-1.html
16597
- ...notTrueType ? [new OnOffElement("w:notTrueType", notTrueType)] : [],
16598
- ...pitch ? [createStringElement("w:pitch", pitch)] : [],
16599
- // http://www.datypic.com/sc/ooxml/e-w_sig-1.html
16600
- ...sig ? [
16601
- new BuilderElement({
16602
- name: "w:sig",
16603
- attributes: {
16604
- usb0: { key: "w:usb0", value: sig.usb0 },
16605
- usb1: { key: "w:usb1", value: sig.usb1 },
16606
- usb2: { key: "w:usb2", value: sig.usb2 },
16607
- usb3: { key: "w:usb3", value: sig.usb3 },
16608
- csb0: { key: "w:csb0", value: sig.csb0 },
16609
- csb1: { key: "w:csb1", value: sig.csb1 }
16610
- }
16611
- })
16612
- ] : [],
16613
- // http://www.datypic.com/sc/ooxml/e-w_embedRegular-1.html
16614
- ...embedRegular ? [createFontRelationship(embedRegular, "w:embedRegular")] : [],
16615
- // http://www.datypic.com/sc/ooxml/e-w_embedBold-1.html
16616
- ...embedBold ? [createFontRelationship(embedBold, "w:embedBold")] : [],
16617
- // http://www.datypic.com/sc/ooxml/e-w_embedItalic-1.html
16618
- ...embedItalic ? [createFontRelationship(embedItalic, "w:embedItalic")] : [],
16619
- // http://www.datypic.com/sc/ooxml/e-w_embedBoldItalic-1.html
16620
- ...embedBoldItalic ? [createFontRelationship(embedBoldItalic, "w:embedBoldItalic")] : []
16621
- ]
16622
- })
16623
- );
16624
- const createRegularFont = ({
16625
- name,
16626
- index,
16627
- fontKey,
16628
- characterSet
16629
- }) => createFont({
16630
- name,
16631
- sig: {
16632
- usb0: "E0002AFF",
16633
- usb1: "C000247B",
16634
- usb2: "00000009",
16635
- usb3: "00000000",
16636
- csb0: "000001FF",
16637
- csb1: "00000000"
16638
- },
16639
- charset: characterSet,
16640
- family: "auto",
16641
- pitch: "variable",
16642
- embedRegular: {
16643
- fontKey,
16644
- id: `rId${index}`
16645
- }
16646
- });
16647
- const createFontTable = (fonts) => (
16648
- // https://c-rex.net/projects/samples/ooxml/e1/Part4/OOXML_P4_DOCX_Font_topic_ID0ERNCU.html
16649
- // http://www.datypic.com/sc/ooxml/e-w_fonts.html
16650
- new BuilderElement({
16651
- name: "w:fonts",
16652
- attributes: {
16653
- mc: { key: "xmlns:mc", value: "http://schemas.openxmlformats.org/markup-compatibility/2006" },
16654
- r: { key: "xmlns:r", value: "http://schemas.openxmlformats.org/officeDocument/2006/relationships" },
16655
- w: { key: "xmlns:w", value: "http://schemas.openxmlformats.org/wordprocessingml/2006/main" },
16656
- w14: { key: "xmlns:w14", value: "http://schemas.microsoft.com/office/word/2010/wordml" },
16657
- w15: { key: "xmlns:w15", value: "http://schemas.microsoft.com/office/word/2012/wordml" },
16658
- w16cex: { key: "xmlns:w16cex", value: "http://schemas.microsoft.com/office/word/2018/wordml/cex" },
16659
- w16cid: { key: "xmlns:w16cid", value: "http://schemas.microsoft.com/office/word/2016/wordml/cid" },
16660
- w16: { key: "xmlns:w16", value: "http://schemas.microsoft.com/office/word/2018/wordml" },
16661
- w16sdtdh: { key: "xmlns:w16sdtdh", value: "http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" },
16662
- w16se: { key: "xmlns:w16se", value: "http://schemas.microsoft.com/office/word/2015/wordml/symex" },
16663
- Ignorable: { key: "mc:Ignorable", value: "w14 w15 w16se w16cid w16 w16cex w16sdtdh" }
16664
- },
16665
- children: fonts.map(
16666
- (font, i) => createRegularFont({
16667
- name: font.name,
16668
- index: i + 1,
16669
- fontKey: font.fontKey
16670
- })
16671
- )
16672
- })
16673
- );
16674
- class FontWrapper {
16675
- constructor(options2) {
16676
- __publicField(this, "fontTable");
16677
- __publicField(this, "relationships");
16678
- __publicField(this, "fontOptionsWithKey", []);
16679
- this.options = options2;
16680
- this.fontOptionsWithKey = options2.map((o) => __spreadProps(__spreadValues({}, o), { fontKey: uniqueUuid() }));
16681
- this.fontTable = createFontTable(this.fontOptionsWithKey);
16682
- this.relationships = new Relationships();
16683
- for (let i = 0; i < options2.length; i++) {
16684
- this.relationships.createRelationship(
16685
- i + 1,
16686
- "http://schemas.openxmlformats.org/officeDocument/2006/relationships/font",
16687
- `fonts/${options2[i].name}.odttf`
16688
- );
16696
+ if (xmlElm.name === "w:styles") {
16697
+ stylesXmlElement = xmlElm;
16698
+ }
16689
16699
  }
16700
+ if (stylesXmlElement === void 0) {
16701
+ throw new Error("can not find styles element");
16702
+ }
16703
+ const stylesElements = stylesXmlElement.elements || [];
16704
+ const importedStyle = new Styles({
16705
+ initialStyles: new ImportedRootElementAttributes(stylesXmlElement.attributes),
16706
+ importedStyles: stylesElements.map((childElm) => convertToXmlComponent(childElm))
16707
+ });
16708
+ return importedStyle;
16690
16709
  }
16691
- get View() {
16692
- return this.fontTable;
16693
- }
16694
- get Relationships() {
16695
- return this.relationships;
16710
+ }
16711
+ class DefaultStylesFactory {
16712
+ newInstance(options2 = {}) {
16713
+ var _a;
16714
+ const documentAttributes = new DocumentAttributes({
16715
+ mc: "http://schemas.openxmlformats.org/markup-compatibility/2006",
16716
+ r: "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
16717
+ w: "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
16718
+ w14: "http://schemas.microsoft.com/office/word/2010/wordml",
16719
+ w15: "http://schemas.microsoft.com/office/word/2012/wordml",
16720
+ Ignorable: "w14 w15"
16721
+ });
16722
+ return {
16723
+ initialStyles: documentAttributes,
16724
+ importedStyles: [
16725
+ new DocumentDefaults((_a = options2.document) != null ? _a : {}),
16726
+ new TitleStyle(__spreadValues({
16727
+ run: {
16728
+ size: 56
16729
+ }
16730
+ }, options2.title)),
16731
+ new Heading1Style(__spreadValues({
16732
+ run: {
16733
+ color: "2E74B5",
16734
+ size: 32
16735
+ }
16736
+ }, options2.heading1)),
16737
+ new Heading2Style(__spreadValues({
16738
+ run: {
16739
+ color: "2E74B5",
16740
+ size: 26
16741
+ }
16742
+ }, options2.heading2)),
16743
+ new Heading3Style(__spreadValues({
16744
+ run: {
16745
+ color: "1F4D78",
16746
+ size: 24
16747
+ }
16748
+ }, options2.heading3)),
16749
+ new Heading4Style(__spreadValues({
16750
+ run: {
16751
+ color: "2E74B5",
16752
+ italics: true
16753
+ }
16754
+ }, options2.heading4)),
16755
+ new Heading5Style(__spreadValues({
16756
+ run: {
16757
+ color: "2E74B5"
16758
+ }
16759
+ }, options2.heading5)),
16760
+ new Heading6Style(__spreadValues({
16761
+ run: {
16762
+ color: "1F4D78"
16763
+ }
16764
+ }, options2.heading6)),
16765
+ new StrongStyle(__spreadValues({
16766
+ run: {
16767
+ bold: true
16768
+ }
16769
+ }, options2.strong)),
16770
+ new ListParagraph(options2.listParagraph || {}),
16771
+ new HyperlinkStyle(options2.hyperlink || {}),
16772
+ new FootnoteReferenceStyle(options2.footnoteReference || {}),
16773
+ new FootnoteText(options2.footnoteText || {}),
16774
+ new FootnoteTextChar(options2.footnoteTextChar || {})
16775
+ ]
16776
+ };
16696
16777
  }
16697
16778
  }
16698
16779
  class File {
@@ -16794,8 +16875,8 @@ var __async = (__this, __arguments, generator) => {
16794
16875
  this.addFooterToDocument(wrapper);
16795
16876
  return wrapper;
16796
16877
  }
16797
- addHeaderToDocument(header, type = HeaderFooterReferenceType.DEFAULT) {
16798
- this.headers.push({ header, type });
16878
+ addHeaderToDocument(header, type2 = HeaderFooterReferenceType.DEFAULT) {
16879
+ this.headers.push({ header, type: type2 });
16799
16880
  this.documentWrapper.Relationships.createRelationship(
16800
16881
  header.View.ReferenceId,
16801
16882
  "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",
@@ -16803,8 +16884,8 @@ var __async = (__this, __arguments, generator) => {
16803
16884
  );
16804
16885
  this.contentTypes.addHeader(this.headers.length);
16805
16886
  }
16806
- addFooterToDocument(footer, type = HeaderFooterReferenceType.DEFAULT) {
16807
- this.footers.push({ footer, type });
16887
+ addFooterToDocument(footer, type2 = HeaderFooterReferenceType.DEFAULT) {
16888
+ this.footers.push({ footer, type: type2 });
16808
16889
  this.documentWrapper.Relationships.createRelationship(
16809
16890
  footer.View.ReferenceId,
16810
16891
  "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",
@@ -19793,7 +19874,6 @@ var __async = (__this, __arguments, generator) => {
19793
19874
  return out;
19794
19875
  };
19795
19876
  class Formatter {
19796
- // tslint:disable-next-line: no-object-literal-type-assertion
19797
19877
  format(input, context = { stack: [] }) {
19798
19878
  const output = input.prepForXml(context);
19799
19879
  if (output) {
@@ -20263,7 +20343,6 @@ var __async = (__this, __arguments, generator) => {
20263
20343
  NONE: "",
20264
20344
  WITH_2_BLANKS: " ",
20265
20345
  WITH_4_BLANKS: " ",
20266
- // eslint-disable-next-line @typescript-eslint/naming-convention
20267
20346
  WITH_TAB: " "
20268
20347
  };
20269
20348
  const convertPrettifyType = (prettify) => prettify === true ? PrettifyType.WITH_2_BLANKS : prettify === false ? void 0 : prettify;
@@ -20346,6 +20425,94 @@ var __async = (__this, __arguments, generator) => {
20346
20425
  var _a, _b;
20347
20426
  return (_b = (_a = relationships.elements) == null ? void 0 : _a.filter((e) => e.name === id)[0].elements) != null ? _b : [];
20348
20427
  };
20428
+ const appendContentType = (element2, contentType, extension) => {
20429
+ const relationshipElements = getFirstLevelElements(element2, "Types");
20430
+ const exist = relationshipElements.some(
20431
+ (el) => {
20432
+ var _a, _b;
20433
+ return el.type === "element" && el.name === "Default" && ((_a = el == null ? void 0 : el.attributes) == null ? void 0 : _a.ContentType) === contentType && ((_b = el == null ? void 0 : el.attributes) == null ? void 0 : _b.Extension) === extension;
20434
+ }
20435
+ );
20436
+ if (exist) {
20437
+ return;
20438
+ }
20439
+ relationshipElements.push({
20440
+ attributes: {
20441
+ ContentType: contentType,
20442
+ Extension: extension
20443
+ },
20444
+ name: "Default",
20445
+ type: "element"
20446
+ });
20447
+ };
20448
+ const getIdFromRelationshipId = (relationshipId) => {
20449
+ const output = parseInt(relationshipId.substring(3), 10);
20450
+ return isNaN(output) ? 0 : output;
20451
+ };
20452
+ const getNextRelationshipIndex = (relationships) => {
20453
+ const relationshipElements = getFirstLevelElements(relationships, "Relationships");
20454
+ return relationshipElements.map((e) => {
20455
+ var _a, _b, _c;
20456
+ return getIdFromRelationshipId((_c = (_b = (_a = e.attributes) == null ? void 0 : _a.Id) == null ? void 0 : _b.toString()) != null ? _c : "");
20457
+ }).reduce((acc, curr) => Math.max(acc, curr), 0) + 1;
20458
+ };
20459
+ const appendRelationship = (relationships, id, type2, target, targetMode) => {
20460
+ const relationshipElements = getFirstLevelElements(relationships, "Relationships");
20461
+ relationshipElements.push({
20462
+ attributes: {
20463
+ Id: `rId${id}`,
20464
+ Type: type2,
20465
+ Target: target,
20466
+ TargetMode: targetMode
20467
+ },
20468
+ name: "Relationship",
20469
+ type: "element"
20470
+ });
20471
+ return relationshipElements;
20472
+ };
20473
+ const findRunElementIndexWithToken = (paragraphElement, token) => {
20474
+ var _a, _b, _c, _d;
20475
+ for (let i = 0; i < ((_a = paragraphElement.elements) != null ? _a : []).length; i++) {
20476
+ const element2 = paragraphElement.elements[i];
20477
+ if (element2.type === "element" && element2.name === "w:r") {
20478
+ const textElement = ((_b = element2.elements) != null ? _b : []).filter((e) => e.type === "element" && e.name === "w:t");
20479
+ for (const text of textElement) {
20480
+ if (!((_c = text.elements) == null ? void 0 : _c[0])) {
20481
+ continue;
20482
+ }
20483
+ if ((_d = text.elements[0].text) == null ? void 0 : _d.includes(token)) {
20484
+ return i;
20485
+ }
20486
+ }
20487
+ }
20488
+ }
20489
+ throw new Error("Token not found");
20490
+ };
20491
+ const splitRunElement = (runElement, token) => {
20492
+ var _a, _b;
20493
+ let splitIndex = 0;
20494
+ const splitElements = (_b = (_a = runElement.elements) == null ? void 0 : _a.map((e, i) => {
20495
+ var _a2, _b2, _c;
20496
+ if (e.type === "element" && e.name === "w:t") {
20497
+ const text = (_c = (_b2 = (_a2 = e.elements) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.text) != null ? _c : "";
20498
+ const splitText = text.split(token);
20499
+ const newElements = splitText.map((t) => __spreadProps(__spreadValues(__spreadValues({}, e), patchSpaceAttribute(e)), {
20500
+ elements: createTextElementContents(t)
20501
+ }));
20502
+ splitIndex = i;
20503
+ return newElements;
20504
+ } else {
20505
+ return e;
20506
+ }
20507
+ }).flat()) != null ? _b : [];
20508
+ const leftRunElement = __spreadProps(__spreadValues({}, JSON.parse(JSON.stringify(runElement))), {
20509
+ elements: splitElements.slice(0, splitIndex + 1)
20510
+ });
20511
+ const rightRunElement = __spreadProps(__spreadValues({}, JSON.parse(JSON.stringify(runElement))), {
20512
+ elements: splitElements.slice(splitIndex + 1)
20513
+ });
20514
+ return { left: leftRunElement, right: rightRunElement };
20515
+ };
20349
20516
  const ReplaceMode = {
20350
20517
  START: 0,
20351
20518
  MIDDLE: 1,
@@ -20397,49 +20564,6 @@ var __async = (__this, __arguments, generator) => {
20397
20564
  element2.elements = createTextElementContents(text);
20398
20565
  return element2;
20399
20566
  };
20400
- const findRunElementIndexWithToken = (paragraphElement, token) => {
20401
- var _a, _b, _c, _d;
20402
- for (let i = 0; i < ((_a = paragraphElement.elements) != null ? _a : []).length; i++) {
20403
- const element2 = paragraphElement.elements[i];
20404
- if (element2.type === "element" && element2.name === "w:r") {
20405
- const textElement = ((_b = element2.elements) != null ? _b : []).filter((e) => e.type === "element" && e.name === "w:t");
20406
- for (const text of textElement) {
20407
- if (!((_c = text.elements) == null ? void 0 : _c[0])) {
20408
- continue;
20409
- }
20410
- if ((_d = text.elements[0].text) == null ? void 0 : _d.includes(token)) {
20411
- return i;
20412
- }
20413
- }
20414
- }
20415
- }
20416
- throw new Error("Token not found");
20417
- };
20418
- const splitRunElement = (runElement, token) => {
20419
- var _a, _b;
20420
- let splitIndex = 0;
20421
- const splitElements = (_b = (_a = runElement.elements) == null ? void 0 : _a.map((e, i) => {
20422
- var _a2, _b2, _c;
20423
- if (e.type === "element" && e.name === "w:t") {
20424
- const text = (_c = (_b2 = (_a2 = e.elements) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.text) != null ? _c : "";
20425
- const splitText = text.split(token);
20426
- const newElements = splitText.map((t) => __spreadProps(__spreadValues(__spreadValues({}, e), patchSpaceAttribute(e)), {
20427
- elements: createTextElementContents(t)
20428
- }));
20429
- splitIndex = i;
20430
- return newElements;
20431
- } else {
20432
- return e;
20433
- }
20434
- }).flat()) != null ? _b : [];
20435
- const leftRunElement = __spreadProps(__spreadValues({}, JSON.parse(JSON.stringify(runElement))), {
20436
- elements: splitElements.slice(0, splitIndex + 1)
20437
- });
20438
- const rightRunElement = __spreadProps(__spreadValues({}, JSON.parse(JSON.stringify(runElement))), {
20439
- elements: splitElements.slice(splitIndex + 1)
20440
- });
20441
- return { left: leftRunElement, right: rightRunElement };
20442
- };
20443
20567
  const renderParagraphNode = (node) => {
20444
20568
  if (node.element.name !== "w:p") {
20445
20569
  throw new Error(`Invalid node type: ${node.element.name}`);
@@ -20569,7 +20693,7 @@ var __async = (__this, __arguments, generator) => {
20569
20693
  let patchedRightElement = right;
20570
20694
  if (keepOriginalStyles) {
20571
20695
  const runElementNonTextualElements = runElementToBeReplaced.elements.filter(
20572
- (e) => e.type === "element" && e.name !== "w:t" && e.name !== "w:br"
20696
+ (e) => e.type === "element" && e.name !== "w:t" && e.name !== "w:br" && e.name !== "w:tab"
20573
20697
  );
20574
20698
  newRunElements = textJson.map((e) => __spreadProps(__spreadValues({}, e), {
20575
20699
  elements: [...runElementNonTextualElements, ...e.elements]
@@ -20596,51 +20720,6 @@ var __async = (__this, __arguments, generator) => {
20596
20720
  };
20597
20721
  const goToParentElementFromPath = (json, path) => goToElementFromPath(json, path.slice(0, path.length - 1));
20598
20722
  const getLastElementIndexFromPath = (path) => path[path.length - 1];
20599
- const getIdFromRelationshipId = (relationshipId) => {
20600
- const output = parseInt(relationshipId.substring(3), 10);
20601
- return isNaN(output) ? 0 : output;
20602
- };
20603
- const getNextRelationshipIndex = (relationships) => {
20604
- const relationshipElements = getFirstLevelElements(relationships, "Relationships");
20605
- return relationshipElements.map((e) => {
20606
- var _a, _b, _c;
20607
- return getIdFromRelationshipId((_c = (_b = (_a = e.attributes) == null ? void 0 : _a.Id) == null ? void 0 : _b.toString()) != null ? _c : "");
20608
- }).reduce((acc, curr) => Math.max(acc, curr), 0) + 1;
20609
- };
20610
- const appendRelationship = (relationships, id, type, target, targetMode) => {
20611
- const relationshipElements = getFirstLevelElements(relationships, "Relationships");
20612
- relationshipElements.push({
20613
- attributes: {
20614
- Id: `rId${id}`,
20615
- Type: type,
20616
- Target: target,
20617
- TargetMode: targetMode
20618
- },
20619
- name: "Relationship",
20620
- type: "element"
20621
- });
20622
- return relationshipElements;
20623
- };
20624
- const appendContentType = (element2, contentType, extension) => {
20625
- const relationshipElements = getFirstLevelElements(element2, "Types");
20626
- const exist = relationshipElements.some(
20627
- (el) => {
20628
- var _a, _b;
20629
- return el.type === "element" && el.name === "Default" && ((_a = el == null ? void 0 : el.attributes) == null ? void 0 : _a.ContentType) === contentType && ((_b = el == null ? void 0 : el.attributes) == null ? void 0 : _b.Extension) === extension;
20630
- }
20631
- );
20632
- if (exist) {
20633
- return;
20634
- }
20635
- relationshipElements.push({
20636
- attributes: {
20637
- ContentType: contentType,
20638
- Extension: extension
20639
- },
20640
- name: "Default",
20641
- type: "element"
20642
- });
20643
- };
20644
20723
  const PatchType = {
20645
20724
  DOCUMENT: "file",
20646
20725
  PARAGRAPH: "paragraph"