docx 9.5.2 → 9.5.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.
package/dist/index.cjs CHANGED
@@ -53,24 +53,59 @@ var __async = (__this, __arguments, generator) => {
53
53
  };
54
54
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
55
55
  class BaseXmlComponent {
56
+ /**
57
+ * Creates a new BaseXmlComponent with the specified XML element name.
58
+ *
59
+ * @param rootKey - The XML element name (e.g., "w:p", "w:r", "w:t")
60
+ */
56
61
  constructor(rootKey) {
62
+ /** The XML element name for this component (e.g., "w:p" for paragraph). */
57
63
  __publicField(this, "rootKey");
58
64
  this.rootKey = rootKey;
59
65
  }
60
66
  }
61
67
  const EMPTY_OBJECT = Object.seal({});
62
68
  class XmlComponent extends BaseXmlComponent {
69
+ /**
70
+ * Creates a new XmlComponent.
71
+ *
72
+ * @param rootKey - The XML element name (e.g., "w:p", "w:r", "w:t")
73
+ */
63
74
  constructor(rootKey) {
64
75
  super(rootKey);
76
+ /**
77
+ * Array of child components, text nodes, and attributes.
78
+ *
79
+ * This array forms the content of the XML element. It can contain other
80
+ * XmlComponents, string values (text nodes), or attribute components.
81
+ */
65
82
  // eslint-disable-next-line functional/prefer-readonly-type, @typescript-eslint/no-explicit-any
66
83
  __publicField(this, "root");
67
84
  this.root = new Array();
68
85
  }
69
- // This method is called by the formatter to get the XML representation of this component.
70
- // It is called recursively for all child components.
71
- // It is a serializer to be used in the xml library.
72
- // https://www.npmjs.com/package/xml
73
- // Child components can override this method to customize the XML representation, or execute side effects.
86
+ /**
87
+ * Prepares this component and its children for XML serialization.
88
+ *
89
+ * This method is called by the Formatter to convert the component tree into
90
+ * an object structure compatible with the xml library (https://www.npmjs.com/package/xml).
91
+ * It recursively processes all children and handles special cases like
92
+ * attribute-only elements and empty elements.
93
+ *
94
+ * The method can be overridden by subclasses to customize XML representation
95
+ * or execute side effects during serialization (e.g., creating relationships).
96
+ *
97
+ * @param context - The serialization context containing document state
98
+ * @returns The XML-serializable object, or undefined to exclude from output
99
+ *
100
+ * @example
101
+ * ```typescript
102
+ * // Override to add custom serialization logic
103
+ * prepForXml(context: IContext): IXmlableObject | undefined {
104
+ * // Custom logic here
105
+ * return super.prepForXml(context);
106
+ * }
107
+ * ```
108
+ */
74
109
  prepForXml(context) {
75
110
  var _a;
76
111
  context.stack.push(this);
@@ -86,7 +121,11 @@ class XmlComponent extends BaseXmlComponent {
86
121
  };
87
122
  }
88
123
  /**
124
+ * Adds a child element to this component.
125
+ *
89
126
  * @deprecated Do not use this method. It is only used internally by the library. It will be removed in a future version.
127
+ * @param child - The child component or text string to add
128
+ * @returns This component (for chaining)
90
129
  */
91
130
  addChildElement(child) {
92
131
  this.root.push(child);
@@ -94,6 +133,12 @@ class XmlComponent extends BaseXmlComponent {
94
133
  }
95
134
  }
96
135
  class IgnoreIfEmptyXmlComponent extends XmlComponent {
136
+ /**
137
+ * Prepares the component for XML serialization, excluding it if empty.
138
+ *
139
+ * @param context - The serialization context
140
+ * @returns The XML-serializable object, or undefined if empty
141
+ */
97
142
  prepForXml(context) {
98
143
  const result = super.prepForXml(context);
99
144
  if (result && (typeof result[this.rootKey] !== "object" || Object.keys(result[this.rootKey]).length)) {
@@ -103,11 +148,26 @@ class IgnoreIfEmptyXmlComponent extends XmlComponent {
103
148
  }
104
149
  }
105
150
  class XmlAttributeComponent extends BaseXmlComponent {
151
+ /**
152
+ * Creates a new attribute component.
153
+ *
154
+ * @param root - The attribute data object
155
+ */
106
156
  constructor(root) {
107
157
  super("_attr");
158
+ /** Optional mapping from property names to XML attribute names. */
108
159
  __publicField(this, "xmlKeys");
109
160
  this.root = root;
110
161
  }
162
+ /**
163
+ * Converts the attribute data to an XML-serializable object.
164
+ *
165
+ * This method transforms the property names using xmlKeys (if defined)
166
+ * and filters out undefined values.
167
+ *
168
+ * @param _ - Context (unused for attributes)
169
+ * @returns Object with _attr key containing the mapped attributes
170
+ */
111
171
  prepForXml(_) {
112
172
  const attrs = {};
113
173
  Object.entries(this.root).forEach(([key, value]) => {
@@ -120,10 +180,24 @@ class XmlAttributeComponent extends BaseXmlComponent {
120
180
  }
121
181
  }
122
182
  class NextAttributeComponent extends BaseXmlComponent {
183
+ /**
184
+ * Creates a new NextAttributeComponent.
185
+ *
186
+ * @param root - Attribute payload with explicit key-value mappings
187
+ */
123
188
  constructor(root) {
124
189
  super("_attr");
125
190
  this.root = root;
126
191
  }
192
+ /**
193
+ * Converts the attribute payload to an XML-serializable object.
194
+ *
195
+ * Extracts the key and value from each property and filters out
196
+ * undefined values.
197
+ *
198
+ * @param _ - Context (unused for attributes)
199
+ * @returns Object with _attr key containing the attributes
200
+ */
127
201
  prepForXml(_) {
128
202
  const attrs = Object.values(this.root).filter(({ value }) => value !== void 0).reduce((acc, { key, value }) => __spreadProps(__spreadValues({}, acc), { [key]: value }), {});
129
203
  return { _attr: attrs };
@@ -833,7 +907,6 @@ function requireBase64Js() {
833
907
  return base64Js;
834
908
  }
835
909
  var ieee754 = {};
836
- /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
837
910
  var hasRequiredIeee754;
838
911
  function requireIeee754() {
839
912
  if (hasRequiredIeee754) return ieee754;
@@ -917,25 +990,19 @@ function requireIeee754() {
917
990
  };
918
991
  return ieee754;
919
992
  }
920
- /*!
921
- * The buffer module from node.js, for the browser.
922
- *
923
- * @author Feross Aboukhadijeh <https://feross.org>
924
- * @license MIT
925
- */
926
993
  var hasRequiredBuffer;
927
994
  function requireBuffer() {
928
995
  if (hasRequiredBuffer) return buffer;
929
996
  hasRequiredBuffer = 1;
930
- (function(exports2) {
997
+ (function(exports$1) {
931
998
  var base64 = requireBase64Js();
932
999
  var ieee7542 = requireIeee754();
933
1000
  var customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null;
934
- exports2.Buffer = Buffer2;
935
- exports2.SlowBuffer = SlowBuffer;
936
- exports2.INSPECT_MAX_BYTES = 50;
1001
+ exports$1.Buffer = Buffer2;
1002
+ exports$1.SlowBuffer = SlowBuffer;
1003
+ exports$1.INSPECT_MAX_BYTES = 50;
937
1004
  var K_MAX_LENGTH = 2147483647;
938
- exports2.kMaxLength = K_MAX_LENGTH;
1005
+ exports$1.kMaxLength = K_MAX_LENGTH;
939
1006
  Buffer2.TYPED_ARRAY_SUPPORT = typedArraySupport();
940
1007
  if (!Buffer2.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") {
941
1008
  console.error(
@@ -1368,7 +1435,7 @@ function requireBuffer() {
1368
1435
  };
1369
1436
  Buffer2.prototype.inspect = function inspect() {
1370
1437
  var str = "";
1371
- var max2 = exports2.INSPECT_MAX_BYTES;
1438
+ var max2 = exports$1.INSPECT_MAX_BYTES;
1372
1439
  str = this.toString("hex", 0, max2).replace(/(.{2})/g, "$1 ").trim();
1373
1440
  if (this.length > max2) str += " ... ";
1374
1441
  return "<Buffer " + str + ">";
@@ -2281,7 +2348,7 @@ function requireBuffer() {
2281
2348
  function numberIsNaN(obj) {
2282
2349
  return obj !== obj;
2283
2350
  }
2284
- var hexSliceLookupTable = function() {
2351
+ var hexSliceLookupTable = (function() {
2285
2352
  var alphabet = "0123456789abcdef";
2286
2353
  var table = new Array(256);
2287
2354
  for (var i = 0; i < 16; ++i) {
@@ -2291,7 +2358,7 @@ function requireBuffer() {
2291
2358
  }
2292
2359
  }
2293
2360
  return table;
2294
- }();
2361
+ })();
2295
2362
  })(buffer);
2296
2363
  return buffer;
2297
2364
  }
@@ -2310,7 +2377,7 @@ function requireShams$1() {
2310
2377
  return true;
2311
2378
  }
2312
2379
  var obj = {};
2313
- var sym = Symbol("test");
2380
+ var sym = /* @__PURE__ */ Symbol("test");
2314
2381
  var symObj = Object(sym);
2315
2382
  if (typeof sym === "string") {
2316
2383
  return false;
@@ -2556,7 +2623,7 @@ function requireHasSymbols() {
2556
2623
  if (typeof origSymbol("foo") !== "symbol") {
2557
2624
  return false;
2558
2625
  }
2559
- if (typeof Symbol("bar") !== "symbol") {
2626
+ if (typeof /* @__PURE__ */ Symbol("bar") !== "symbol") {
2560
2627
  return false;
2561
2628
  }
2562
2629
  return hasSymbolSham();
@@ -2813,7 +2880,7 @@ function requireGetIntrinsic() {
2813
2880
  var throwTypeError = function() {
2814
2881
  throw new $TypeError();
2815
2882
  };
2816
- var ThrowTypeError = $gOPD ? function() {
2883
+ var ThrowTypeError = $gOPD ? (function() {
2817
2884
  try {
2818
2885
  arguments.callee;
2819
2886
  return throwTypeError;
@@ -2824,7 +2891,7 @@ function requireGetIntrinsic() {
2824
2891
  return throwTypeError;
2825
2892
  }
2826
2893
  }
2827
- }() : throwTypeError;
2894
+ })() : throwTypeError;
2828
2895
  var hasSymbols2 = requireHasSymbols()();
2829
2896
  var getProto2 = requireGetProto();
2830
2897
  var $ObjectGPO = requireObject_getPrototypeOf();
@@ -3087,7 +3154,7 @@ function requireGetIntrinsic() {
3087
3154
  if (!allowMissing) {
3088
3155
  throw new $TypeError("base intrinsic for " + name + " exists, but the property is not available.");
3089
3156
  }
3090
- return void 0;
3157
+ return void undefined$1;
3091
3158
  }
3092
3159
  if ($gOPD && i + 1 >= parts.length) {
3093
3160
  var desc = $gOPD(value, part);
@@ -3110,185 +3177,28 @@ function requireGetIntrinsic() {
3110
3177
  };
3111
3178
  return getIntrinsic;
3112
3179
  }
3113
- var callBind = { exports: {} };
3114
- var defineDataProperty;
3115
- var hasRequiredDefineDataProperty;
3116
- function requireDefineDataProperty() {
3117
- if (hasRequiredDefineDataProperty) return defineDataProperty;
3118
- hasRequiredDefineDataProperty = 1;
3119
- var $defineProperty = /* @__PURE__ */ requireEsDefineProperty();
3120
- var $SyntaxError = /* @__PURE__ */ requireSyntax();
3121
- var $TypeError = /* @__PURE__ */ requireType();
3122
- var gopd2 = /* @__PURE__ */ requireGopd();
3123
- defineDataProperty = function defineDataProperty2(obj, property, value) {
3124
- if (!obj || typeof obj !== "object" && typeof obj !== "function") {
3125
- throw new $TypeError("`obj` must be an object or a function`");
3126
- }
3127
- if (typeof property !== "string" && typeof property !== "symbol") {
3128
- throw new $TypeError("`property` must be a string or a symbol`");
3129
- }
3130
- if (arguments.length > 3 && typeof arguments[3] !== "boolean" && arguments[3] !== null) {
3131
- throw new $TypeError("`nonEnumerable`, if provided, must be a boolean or null");
3132
- }
3133
- if (arguments.length > 4 && typeof arguments[4] !== "boolean" && arguments[4] !== null) {
3134
- throw new $TypeError("`nonWritable`, if provided, must be a boolean or null");
3135
- }
3136
- if (arguments.length > 5 && typeof arguments[5] !== "boolean" && arguments[5] !== null) {
3137
- throw new $TypeError("`nonConfigurable`, if provided, must be a boolean or null");
3138
- }
3139
- if (arguments.length > 6 && typeof arguments[6] !== "boolean") {
3140
- throw new $TypeError("`loose`, if provided, must be a boolean");
3141
- }
3142
- var nonEnumerable = arguments.length > 3 ? arguments[3] : null;
3143
- var nonWritable = arguments.length > 4 ? arguments[4] : null;
3144
- var nonConfigurable = arguments.length > 5 ? arguments[5] : null;
3145
- var loose = arguments.length > 6 ? arguments[6] : false;
3146
- var desc = !!gopd2 && gopd2(obj, property);
3147
- if ($defineProperty) {
3148
- $defineProperty(obj, property, {
3149
- configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable,
3150
- enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable,
3151
- value,
3152
- writable: nonWritable === null && desc ? desc.writable : !nonWritable
3153
- });
3154
- } else if (loose || !nonEnumerable && !nonWritable && !nonConfigurable) {
3155
- obj[property] = value;
3156
- } else {
3157
- throw new $SyntaxError("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");
3158
- }
3159
- };
3160
- return defineDataProperty;
3161
- }
3162
- var hasPropertyDescriptors_1;
3163
- var hasRequiredHasPropertyDescriptors;
3164
- function requireHasPropertyDescriptors() {
3165
- if (hasRequiredHasPropertyDescriptors) return hasPropertyDescriptors_1;
3166
- hasRequiredHasPropertyDescriptors = 1;
3167
- var $defineProperty = /* @__PURE__ */ requireEsDefineProperty();
3168
- var hasPropertyDescriptors = function hasPropertyDescriptors2() {
3169
- return !!$defineProperty;
3170
- };
3171
- hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
3172
- if (!$defineProperty) {
3173
- return null;
3174
- }
3175
- try {
3176
- return $defineProperty([], "length", { value: 1 }).length !== 1;
3177
- } catch (e) {
3178
- return true;
3179
- }
3180
- };
3181
- hasPropertyDescriptors_1 = hasPropertyDescriptors;
3182
- return hasPropertyDescriptors_1;
3183
- }
3184
- var setFunctionLength;
3185
- var hasRequiredSetFunctionLength;
3186
- function requireSetFunctionLength() {
3187
- if (hasRequiredSetFunctionLength) return setFunctionLength;
3188
- hasRequiredSetFunctionLength = 1;
3189
- var GetIntrinsic = /* @__PURE__ */ requireGetIntrinsic();
3190
- var define = /* @__PURE__ */ requireDefineDataProperty();
3191
- var hasDescriptors = /* @__PURE__ */ requireHasPropertyDescriptors()();
3192
- var gOPD2 = /* @__PURE__ */ requireGopd();
3193
- var $TypeError = /* @__PURE__ */ requireType();
3194
- var $floor = GetIntrinsic("%Math.floor%");
3195
- setFunctionLength = function setFunctionLength2(fn, length) {
3196
- if (typeof fn !== "function") {
3197
- throw new $TypeError("`fn` is not a function");
3198
- }
3199
- if (typeof length !== "number" || length < 0 || length > 4294967295 || $floor(length) !== length) {
3200
- throw new $TypeError("`length` must be a positive 32-bit integer");
3201
- }
3202
- var loose = arguments.length > 2 && !!arguments[2];
3203
- var functionLengthIsConfigurable = true;
3204
- var functionLengthIsWritable = true;
3205
- if ("length" in fn && gOPD2) {
3206
- var desc = gOPD2(fn, "length");
3207
- if (desc && !desc.configurable) {
3208
- functionLengthIsConfigurable = false;
3209
- }
3210
- if (desc && !desc.writable) {
3211
- functionLengthIsWritable = false;
3212
- }
3213
- }
3214
- if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
3215
- if (hasDescriptors) {
3216
- define(
3217
- /** @type {Parameters<define>[0]} */
3218
- fn,
3219
- "length",
3220
- length,
3221
- true,
3222
- true
3223
- );
3224
- } else {
3225
- define(
3226
- /** @type {Parameters<define>[0]} */
3227
- fn,
3228
- "length",
3229
- length
3230
- );
3231
- }
3232
- }
3233
- return fn;
3234
- };
3235
- return setFunctionLength;
3236
- }
3237
- var applyBind;
3238
- var hasRequiredApplyBind;
3239
- function requireApplyBind() {
3240
- if (hasRequiredApplyBind) return applyBind;
3241
- hasRequiredApplyBind = 1;
3242
- var bind = requireFunctionBind();
3243
- var $apply = requireFunctionApply();
3244
- var actualApply2 = requireActualApply();
3245
- applyBind = function applyBind2() {
3246
- return actualApply2(bind, $apply, arguments);
3247
- };
3248
- return applyBind;
3249
- }
3250
- var hasRequiredCallBind;
3251
- function requireCallBind() {
3252
- if (hasRequiredCallBind) return callBind.exports;
3253
- hasRequiredCallBind = 1;
3254
- (function(module2) {
3255
- var setFunctionLength2 = /* @__PURE__ */ requireSetFunctionLength();
3256
- var $defineProperty = /* @__PURE__ */ requireEsDefineProperty();
3257
- var callBindBasic = requireCallBindApplyHelpers();
3258
- var applyBind2 = requireApplyBind();
3259
- module2.exports = function callBind2(originalFunction) {
3260
- var func = callBindBasic(arguments);
3261
- var adjustedLength = originalFunction.length - (arguments.length - 1);
3262
- return setFunctionLength2(
3263
- func,
3264
- 1 + (adjustedLength > 0 ? adjustedLength : 0),
3265
- true
3266
- );
3267
- };
3268
- if ($defineProperty) {
3269
- $defineProperty(module2.exports, "apply", { value: applyBind2 });
3270
- } else {
3271
- module2.exports.apply = applyBind2;
3272
- }
3273
- })(callBind);
3274
- return callBind.exports;
3275
- }
3276
- var callBound$1;
3277
- var hasRequiredCallBound$1;
3278
- function requireCallBound$1() {
3279
- if (hasRequiredCallBound$1) return callBound$1;
3280
- hasRequiredCallBound$1 = 1;
3180
+ var callBound;
3181
+ var hasRequiredCallBound;
3182
+ function requireCallBound() {
3183
+ if (hasRequiredCallBound) return callBound;
3184
+ hasRequiredCallBound = 1;
3281
3185
  var GetIntrinsic = /* @__PURE__ */ requireGetIntrinsic();
3282
- var callBind2 = requireCallBind();
3283
- var $indexOf = callBind2(GetIntrinsic("String.prototype.indexOf"));
3284
- callBound$1 = function callBoundIntrinsic(name, allowMissing) {
3285
- var intrinsic = GetIntrinsic(name, !!allowMissing);
3186
+ var callBindBasic = requireCallBindApplyHelpers();
3187
+ var $indexOf = callBindBasic([GetIntrinsic("%String.prototype.indexOf%")]);
3188
+ callBound = function callBoundIntrinsic(name, allowMissing) {
3189
+ var intrinsic = (
3190
+ /** @type {(this: unknown, ...args: unknown[]) => unknown} */
3191
+ GetIntrinsic(name, !!allowMissing)
3192
+ );
3286
3193
  if (typeof intrinsic === "function" && $indexOf(name, ".prototype.") > -1) {
3287
- return callBind2(intrinsic);
3194
+ return callBindBasic(
3195
+ /** @type {const} */
3196
+ [intrinsic]
3197
+ );
3288
3198
  }
3289
3199
  return intrinsic;
3290
3200
  };
3291
- return callBound$1;
3201
+ return callBound;
3292
3202
  }
3293
3203
  var isArguments;
3294
3204
  var hasRequiredIsArguments;
@@ -3296,7 +3206,7 @@ function requireIsArguments() {
3296
3206
  if (hasRequiredIsArguments) return isArguments;
3297
3207
  hasRequiredIsArguments = 1;
3298
3208
  var hasToStringTag = requireShams()();
3299
- var callBound2 = requireCallBound$1();
3209
+ var callBound2 = /* @__PURE__ */ requireCallBound();
3300
3210
  var $toString = callBound2("Object.prototype.toString");
3301
3211
  var isStandardArguments = function isArguments2(value) {
3302
3212
  if (hasToStringTag && value && typeof value === "object" && Symbol.toStringTag in value) {
@@ -3308,11 +3218,11 @@ function requireIsArguments() {
3308
3218
  if (isStandardArguments(value)) {
3309
3219
  return true;
3310
3220
  }
3311
- return value !== null && typeof value === "object" && typeof value.length === "number" && value.length >= 0 && $toString(value) !== "[object Array]" && $toString(value.callee) === "[object Function]";
3221
+ return value !== null && typeof value === "object" && "length" in value && typeof value.length === "number" && value.length >= 0 && $toString(value) !== "[object Array]" && "callee" in value && $toString(value.callee) === "[object Function]";
3312
3222
  };
3313
- var supportsStandardArguments = function() {
3223
+ var supportsStandardArguments = (function() {
3314
3224
  return isStandardArguments(arguments);
3315
- }();
3225
+ })();
3316
3226
  isStandardArguments.isLegacyArguments = isLegacyArguments;
3317
3227
  isArguments = supportsStandardArguments ? isStandardArguments : isLegacyArguments;
3318
3228
  return isArguments;
@@ -3572,30 +3482,170 @@ function requireAvailableTypedArrays() {
3572
3482
  }
3573
3483
  return out;
3574
3484
  };
3575
- return availableTypedArrays;
3485
+ return availableTypedArrays;
3486
+ }
3487
+ var callBind = { exports: {} };
3488
+ var defineDataProperty;
3489
+ var hasRequiredDefineDataProperty;
3490
+ function requireDefineDataProperty() {
3491
+ if (hasRequiredDefineDataProperty) return defineDataProperty;
3492
+ hasRequiredDefineDataProperty = 1;
3493
+ var $defineProperty = /* @__PURE__ */ requireEsDefineProperty();
3494
+ var $SyntaxError = /* @__PURE__ */ requireSyntax();
3495
+ var $TypeError = /* @__PURE__ */ requireType();
3496
+ var gopd2 = /* @__PURE__ */ requireGopd();
3497
+ defineDataProperty = function defineDataProperty2(obj, property, value) {
3498
+ if (!obj || typeof obj !== "object" && typeof obj !== "function") {
3499
+ throw new $TypeError("`obj` must be an object or a function`");
3500
+ }
3501
+ if (typeof property !== "string" && typeof property !== "symbol") {
3502
+ throw new $TypeError("`property` must be a string or a symbol`");
3503
+ }
3504
+ if (arguments.length > 3 && typeof arguments[3] !== "boolean" && arguments[3] !== null) {
3505
+ throw new $TypeError("`nonEnumerable`, if provided, must be a boolean or null");
3506
+ }
3507
+ if (arguments.length > 4 && typeof arguments[4] !== "boolean" && arguments[4] !== null) {
3508
+ throw new $TypeError("`nonWritable`, if provided, must be a boolean or null");
3509
+ }
3510
+ if (arguments.length > 5 && typeof arguments[5] !== "boolean" && arguments[5] !== null) {
3511
+ throw new $TypeError("`nonConfigurable`, if provided, must be a boolean or null");
3512
+ }
3513
+ if (arguments.length > 6 && typeof arguments[6] !== "boolean") {
3514
+ throw new $TypeError("`loose`, if provided, must be a boolean");
3515
+ }
3516
+ var nonEnumerable = arguments.length > 3 ? arguments[3] : null;
3517
+ var nonWritable = arguments.length > 4 ? arguments[4] : null;
3518
+ var nonConfigurable = arguments.length > 5 ? arguments[5] : null;
3519
+ var loose = arguments.length > 6 ? arguments[6] : false;
3520
+ var desc = !!gopd2 && gopd2(obj, property);
3521
+ if ($defineProperty) {
3522
+ $defineProperty(obj, property, {
3523
+ configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable,
3524
+ enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable,
3525
+ value,
3526
+ writable: nonWritable === null && desc ? desc.writable : !nonWritable
3527
+ });
3528
+ } else if (loose || !nonEnumerable && !nonWritable && !nonConfigurable) {
3529
+ obj[property] = value;
3530
+ } else {
3531
+ throw new $SyntaxError("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");
3532
+ }
3533
+ };
3534
+ return defineDataProperty;
3535
+ }
3536
+ var hasPropertyDescriptors_1;
3537
+ var hasRequiredHasPropertyDescriptors;
3538
+ function requireHasPropertyDescriptors() {
3539
+ if (hasRequiredHasPropertyDescriptors) return hasPropertyDescriptors_1;
3540
+ hasRequiredHasPropertyDescriptors = 1;
3541
+ var $defineProperty = /* @__PURE__ */ requireEsDefineProperty();
3542
+ var hasPropertyDescriptors = function hasPropertyDescriptors2() {
3543
+ return !!$defineProperty;
3544
+ };
3545
+ hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
3546
+ if (!$defineProperty) {
3547
+ return null;
3548
+ }
3549
+ try {
3550
+ return $defineProperty([], "length", { value: 1 }).length !== 1;
3551
+ } catch (e) {
3552
+ return true;
3553
+ }
3554
+ };
3555
+ hasPropertyDescriptors_1 = hasPropertyDescriptors;
3556
+ return hasPropertyDescriptors_1;
3557
+ }
3558
+ var setFunctionLength;
3559
+ var hasRequiredSetFunctionLength;
3560
+ function requireSetFunctionLength() {
3561
+ if (hasRequiredSetFunctionLength) return setFunctionLength;
3562
+ hasRequiredSetFunctionLength = 1;
3563
+ var GetIntrinsic = /* @__PURE__ */ requireGetIntrinsic();
3564
+ var define = /* @__PURE__ */ requireDefineDataProperty();
3565
+ var hasDescriptors = /* @__PURE__ */ requireHasPropertyDescriptors()();
3566
+ var gOPD2 = /* @__PURE__ */ requireGopd();
3567
+ var $TypeError = /* @__PURE__ */ requireType();
3568
+ var $floor = GetIntrinsic("%Math.floor%");
3569
+ setFunctionLength = function setFunctionLength2(fn, length) {
3570
+ if (typeof fn !== "function") {
3571
+ throw new $TypeError("`fn` is not a function");
3572
+ }
3573
+ if (typeof length !== "number" || length < 0 || length > 4294967295 || $floor(length) !== length) {
3574
+ throw new $TypeError("`length` must be a positive 32-bit integer");
3575
+ }
3576
+ var loose = arguments.length > 2 && !!arguments[2];
3577
+ var functionLengthIsConfigurable = true;
3578
+ var functionLengthIsWritable = true;
3579
+ if ("length" in fn && gOPD2) {
3580
+ var desc = gOPD2(fn, "length");
3581
+ if (desc && !desc.configurable) {
3582
+ functionLengthIsConfigurable = false;
3583
+ }
3584
+ if (desc && !desc.writable) {
3585
+ functionLengthIsWritable = false;
3586
+ }
3587
+ }
3588
+ if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
3589
+ if (hasDescriptors) {
3590
+ define(
3591
+ /** @type {Parameters<define>[0]} */
3592
+ fn,
3593
+ "length",
3594
+ length,
3595
+ true,
3596
+ true
3597
+ );
3598
+ } else {
3599
+ define(
3600
+ /** @type {Parameters<define>[0]} */
3601
+ fn,
3602
+ "length",
3603
+ length
3604
+ );
3605
+ }
3606
+ }
3607
+ return fn;
3608
+ };
3609
+ return setFunctionLength;
3610
+ }
3611
+ var applyBind;
3612
+ var hasRequiredApplyBind;
3613
+ function requireApplyBind() {
3614
+ if (hasRequiredApplyBind) return applyBind;
3615
+ hasRequiredApplyBind = 1;
3616
+ var bind = requireFunctionBind();
3617
+ var $apply = requireFunctionApply();
3618
+ var actualApply2 = requireActualApply();
3619
+ applyBind = function applyBind2() {
3620
+ return actualApply2(bind, $apply, arguments);
3621
+ };
3622
+ return applyBind;
3576
3623
  }
3577
- var callBound;
3578
- var hasRequiredCallBound;
3579
- function requireCallBound() {
3580
- if (hasRequiredCallBound) return callBound;
3581
- hasRequiredCallBound = 1;
3582
- var GetIntrinsic = /* @__PURE__ */ requireGetIntrinsic();
3583
- var callBindBasic = requireCallBindApplyHelpers();
3584
- var $indexOf = callBindBasic([GetIntrinsic("%String.prototype.indexOf%")]);
3585
- callBound = function callBoundIntrinsic(name, allowMissing) {
3586
- var intrinsic = (
3587
- /** @type {(this: unknown, ...args: unknown[]) => unknown} */
3588
- GetIntrinsic(name, !!allowMissing)
3589
- );
3590
- if (typeof intrinsic === "function" && $indexOf(name, ".prototype.") > -1) {
3591
- return callBindBasic(
3592
- /** @type {const} */
3593
- [intrinsic]
3624
+ var hasRequiredCallBind;
3625
+ function requireCallBind() {
3626
+ if (hasRequiredCallBind) return callBind.exports;
3627
+ hasRequiredCallBind = 1;
3628
+ (function(module2) {
3629
+ var setFunctionLength2 = /* @__PURE__ */ requireSetFunctionLength();
3630
+ var $defineProperty = /* @__PURE__ */ requireEsDefineProperty();
3631
+ var callBindBasic = requireCallBindApplyHelpers();
3632
+ var applyBind2 = requireApplyBind();
3633
+ module2.exports = function callBind2(originalFunction) {
3634
+ var func = callBindBasic(arguments);
3635
+ var adjustedLength = originalFunction.length - (arguments.length - 1);
3636
+ return setFunctionLength2(
3637
+ func,
3638
+ 1 + (adjustedLength > 0 ? adjustedLength : 0),
3639
+ true
3594
3640
  );
3641
+ };
3642
+ if ($defineProperty) {
3643
+ $defineProperty(module2.exports, "apply", { value: applyBind2 });
3644
+ } else {
3645
+ module2.exports.apply = applyBind2;
3595
3646
  }
3596
- return intrinsic;
3597
- };
3598
- return callBound;
3647
+ })(callBind);
3648
+ return callBind.exports;
3599
3649
  }
3600
3650
  var whichTypedArray;
3601
3651
  var hasRequiredWhichTypedArray;
@@ -3724,8 +3774,8 @@ var hasRequiredTypes;
3724
3774
  function requireTypes() {
3725
3775
  if (hasRequiredTypes) return types;
3726
3776
  hasRequiredTypes = 1;
3727
- (function(exports2) {
3728
- var isArgumentsObject = requireIsArguments();
3777
+ (function(exports$1) {
3778
+ var isArgumentsObject = /* @__PURE__ */ requireIsArguments();
3729
3779
  var isGeneratorFunction2 = requireIsGeneratorFunction();
3730
3780
  var whichTypedArray2 = /* @__PURE__ */ requireWhichTypedArray();
3731
3781
  var isTypedArray2 = /* @__PURE__ */ requireIsTypedArray();
@@ -3755,64 +3805,64 @@ function requireTypes() {
3755
3805
  return false;
3756
3806
  }
3757
3807
  }
3758
- exports2.isArgumentsObject = isArgumentsObject;
3759
- exports2.isGeneratorFunction = isGeneratorFunction2;
3760
- exports2.isTypedArray = isTypedArray2;
3808
+ exports$1.isArgumentsObject = isArgumentsObject;
3809
+ exports$1.isGeneratorFunction = isGeneratorFunction2;
3810
+ exports$1.isTypedArray = isTypedArray2;
3761
3811
  function isPromise(input) {
3762
3812
  return typeof Promise !== "undefined" && input instanceof Promise || input !== null && typeof input === "object" && typeof input.then === "function" && typeof input.catch === "function";
3763
3813
  }
3764
- exports2.isPromise = isPromise;
3814
+ exports$1.isPromise = isPromise;
3765
3815
  function isArrayBufferView(value) {
3766
3816
  if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
3767
3817
  return ArrayBuffer.isView(value);
3768
3818
  }
3769
3819
  return isTypedArray2(value) || isDataView(value);
3770
3820
  }
3771
- exports2.isArrayBufferView = isArrayBufferView;
3821
+ exports$1.isArrayBufferView = isArrayBufferView;
3772
3822
  function isUint8Array(value) {
3773
3823
  return whichTypedArray2(value) === "Uint8Array";
3774
3824
  }
3775
- exports2.isUint8Array = isUint8Array;
3825
+ exports$1.isUint8Array = isUint8Array;
3776
3826
  function isUint8ClampedArray(value) {
3777
3827
  return whichTypedArray2(value) === "Uint8ClampedArray";
3778
3828
  }
3779
- exports2.isUint8ClampedArray = isUint8ClampedArray;
3829
+ exports$1.isUint8ClampedArray = isUint8ClampedArray;
3780
3830
  function isUint16Array(value) {
3781
3831
  return whichTypedArray2(value) === "Uint16Array";
3782
3832
  }
3783
- exports2.isUint16Array = isUint16Array;
3833
+ exports$1.isUint16Array = isUint16Array;
3784
3834
  function isUint32Array(value) {
3785
3835
  return whichTypedArray2(value) === "Uint32Array";
3786
3836
  }
3787
- exports2.isUint32Array = isUint32Array;
3837
+ exports$1.isUint32Array = isUint32Array;
3788
3838
  function isInt8Array(value) {
3789
3839
  return whichTypedArray2(value) === "Int8Array";
3790
3840
  }
3791
- exports2.isInt8Array = isInt8Array;
3841
+ exports$1.isInt8Array = isInt8Array;
3792
3842
  function isInt16Array(value) {
3793
3843
  return whichTypedArray2(value) === "Int16Array";
3794
3844
  }
3795
- exports2.isInt16Array = isInt16Array;
3845
+ exports$1.isInt16Array = isInt16Array;
3796
3846
  function isInt32Array(value) {
3797
3847
  return whichTypedArray2(value) === "Int32Array";
3798
3848
  }
3799
- exports2.isInt32Array = isInt32Array;
3849
+ exports$1.isInt32Array = isInt32Array;
3800
3850
  function isFloat32Array(value) {
3801
3851
  return whichTypedArray2(value) === "Float32Array";
3802
3852
  }
3803
- exports2.isFloat32Array = isFloat32Array;
3853
+ exports$1.isFloat32Array = isFloat32Array;
3804
3854
  function isFloat64Array(value) {
3805
3855
  return whichTypedArray2(value) === "Float64Array";
3806
3856
  }
3807
- exports2.isFloat64Array = isFloat64Array;
3857
+ exports$1.isFloat64Array = isFloat64Array;
3808
3858
  function isBigInt64Array(value) {
3809
3859
  return whichTypedArray2(value) === "BigInt64Array";
3810
3860
  }
3811
- exports2.isBigInt64Array = isBigInt64Array;
3861
+ exports$1.isBigInt64Array = isBigInt64Array;
3812
3862
  function isBigUint64Array(value) {
3813
3863
  return whichTypedArray2(value) === "BigUint64Array";
3814
3864
  }
3815
- exports2.isBigUint64Array = isBigUint64Array;
3865
+ exports$1.isBigUint64Array = isBigUint64Array;
3816
3866
  function isMapToString(value) {
3817
3867
  return ObjectToString(value) === "[object Map]";
3818
3868
  }
@@ -3823,7 +3873,7 @@ function requireTypes() {
3823
3873
  }
3824
3874
  return isMapToString.working ? isMapToString(value) : value instanceof Map;
3825
3875
  }
3826
- exports2.isMap = isMap;
3876
+ exports$1.isMap = isMap;
3827
3877
  function isSetToString(value) {
3828
3878
  return ObjectToString(value) === "[object Set]";
3829
3879
  }
@@ -3834,7 +3884,7 @@ function requireTypes() {
3834
3884
  }
3835
3885
  return isSetToString.working ? isSetToString(value) : value instanceof Set;
3836
3886
  }
3837
- exports2.isSet = isSet;
3887
+ exports$1.isSet = isSet;
3838
3888
  function isWeakMapToString(value) {
3839
3889
  return ObjectToString(value) === "[object WeakMap]";
3840
3890
  }
@@ -3845,7 +3895,7 @@ function requireTypes() {
3845
3895
  }
3846
3896
  return isWeakMapToString.working ? isWeakMapToString(value) : value instanceof WeakMap;
3847
3897
  }
3848
- exports2.isWeakMap = isWeakMap;
3898
+ exports$1.isWeakMap = isWeakMap;
3849
3899
  function isWeakSetToString(value) {
3850
3900
  return ObjectToString(value) === "[object WeakSet]";
3851
3901
  }
@@ -3853,7 +3903,7 @@ function requireTypes() {
3853
3903
  function isWeakSet(value) {
3854
3904
  return isWeakSetToString(value);
3855
3905
  }
3856
- exports2.isWeakSet = isWeakSet;
3906
+ exports$1.isWeakSet = isWeakSet;
3857
3907
  function isArrayBufferToString(value) {
3858
3908
  return ObjectToString(value) === "[object ArrayBuffer]";
3859
3909
  }
@@ -3864,7 +3914,7 @@ function requireTypes() {
3864
3914
  }
3865
3915
  return isArrayBufferToString.working ? isArrayBufferToString(value) : value instanceof ArrayBuffer;
3866
3916
  }
3867
- exports2.isArrayBuffer = isArrayBuffer;
3917
+ exports$1.isArrayBuffer = isArrayBuffer;
3868
3918
  function isDataViewToString(value) {
3869
3919
  return ObjectToString(value) === "[object DataView]";
3870
3920
  }
@@ -3875,7 +3925,7 @@ function requireTypes() {
3875
3925
  }
3876
3926
  return isDataViewToString.working ? isDataViewToString(value) : value instanceof DataView;
3877
3927
  }
3878
- exports2.isDataView = isDataView;
3928
+ exports$1.isDataView = isDataView;
3879
3929
  var SharedArrayBufferCopy = typeof SharedArrayBuffer !== "undefined" ? SharedArrayBuffer : void 0;
3880
3930
  function isSharedArrayBufferToString(value) {
3881
3931
  return ObjectToString(value) === "[object SharedArrayBuffer]";
@@ -3889,57 +3939,57 @@ function requireTypes() {
3889
3939
  }
3890
3940
  return isSharedArrayBufferToString.working ? isSharedArrayBufferToString(value) : value instanceof SharedArrayBufferCopy;
3891
3941
  }
3892
- exports2.isSharedArrayBuffer = isSharedArrayBuffer;
3942
+ exports$1.isSharedArrayBuffer = isSharedArrayBuffer;
3893
3943
  function isAsyncFunction(value) {
3894
3944
  return ObjectToString(value) === "[object AsyncFunction]";
3895
3945
  }
3896
- exports2.isAsyncFunction = isAsyncFunction;
3946
+ exports$1.isAsyncFunction = isAsyncFunction;
3897
3947
  function isMapIterator(value) {
3898
3948
  return ObjectToString(value) === "[object Map Iterator]";
3899
3949
  }
3900
- exports2.isMapIterator = isMapIterator;
3950
+ exports$1.isMapIterator = isMapIterator;
3901
3951
  function isSetIterator(value) {
3902
3952
  return ObjectToString(value) === "[object Set Iterator]";
3903
3953
  }
3904
- exports2.isSetIterator = isSetIterator;
3954
+ exports$1.isSetIterator = isSetIterator;
3905
3955
  function isGeneratorObject(value) {
3906
3956
  return ObjectToString(value) === "[object Generator]";
3907
3957
  }
3908
- exports2.isGeneratorObject = isGeneratorObject;
3958
+ exports$1.isGeneratorObject = isGeneratorObject;
3909
3959
  function isWebAssemblyCompiledModule(value) {
3910
3960
  return ObjectToString(value) === "[object WebAssembly.Module]";
3911
3961
  }
3912
- exports2.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule;
3962
+ exports$1.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule;
3913
3963
  function isNumberObject(value) {
3914
3964
  return checkBoxedPrimitive(value, numberValue);
3915
3965
  }
3916
- exports2.isNumberObject = isNumberObject;
3966
+ exports$1.isNumberObject = isNumberObject;
3917
3967
  function isStringObject(value) {
3918
3968
  return checkBoxedPrimitive(value, stringValue);
3919
3969
  }
3920
- exports2.isStringObject = isStringObject;
3970
+ exports$1.isStringObject = isStringObject;
3921
3971
  function isBooleanObject(value) {
3922
3972
  return checkBoxedPrimitive(value, booleanValue);
3923
3973
  }
3924
- exports2.isBooleanObject = isBooleanObject;
3974
+ exports$1.isBooleanObject = isBooleanObject;
3925
3975
  function isBigIntObject(value) {
3926
3976
  return BigIntSupported && checkBoxedPrimitive(value, bigIntValue);
3927
3977
  }
3928
- exports2.isBigIntObject = isBigIntObject;
3978
+ exports$1.isBigIntObject = isBigIntObject;
3929
3979
  function isSymbolObject(value) {
3930
3980
  return SymbolSupported && checkBoxedPrimitive(value, symbolValue);
3931
3981
  }
3932
- exports2.isSymbolObject = isSymbolObject;
3982
+ exports$1.isSymbolObject = isSymbolObject;
3933
3983
  function isBoxedPrimitive(value) {
3934
3984
  return isNumberObject(value) || isStringObject(value) || isBooleanObject(value) || isBigIntObject(value) || isSymbolObject(value);
3935
3985
  }
3936
- exports2.isBoxedPrimitive = isBoxedPrimitive;
3986
+ exports$1.isBoxedPrimitive = isBoxedPrimitive;
3937
3987
  function isAnyArrayBuffer(value) {
3938
3988
  return typeof Uint8Array !== "undefined" && (isArrayBuffer(value) || isSharedArrayBuffer(value));
3939
3989
  }
3940
- exports2.isAnyArrayBuffer = isAnyArrayBuffer;
3990
+ exports$1.isAnyArrayBuffer = isAnyArrayBuffer;
3941
3991
  ["isProxy", "isExternal", "isModuleNamespaceObject"].forEach(function(method) {
3942
- Object.defineProperty(exports2, method, {
3992
+ Object.defineProperty(exports$1, method, {
3943
3993
  enumerable: false,
3944
3994
  value: function() {
3945
3995
  throw new Error(method + " is not supported in userland");
@@ -3963,7 +4013,7 @@ var hasRequiredUtil;
3963
4013
  function requireUtil() {
3964
4014
  if (hasRequiredUtil) return util;
3965
4015
  hasRequiredUtil = 1;
3966
- (function(exports2) {
4016
+ (function(exports$1) {
3967
4017
  var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors2(obj) {
3968
4018
  var keys = Object.keys(obj);
3969
4019
  var descriptors = {};
@@ -3973,7 +4023,7 @@ function requireUtil() {
3973
4023
  return descriptors;
3974
4024
  };
3975
4025
  var formatRegExp = /%[sdj%]/g;
3976
- exports2.format = function(f) {
4026
+ exports$1.format = function(f) {
3977
4027
  if (!isString(f)) {
3978
4028
  var objects = [];
3979
4029
  for (var i = 0; i < arguments.length; i++) {
@@ -4011,13 +4061,13 @@ function requireUtil() {
4011
4061
  }
4012
4062
  return str;
4013
4063
  };
4014
- exports2.deprecate = function(fn, msg) {
4064
+ exports$1.deprecate = function(fn, msg) {
4015
4065
  if (typeof process$1 !== "undefined" && process$1.noDeprecation === true) {
4016
4066
  return fn;
4017
4067
  }
4018
4068
  if (typeof process$1 === "undefined") {
4019
4069
  return function() {
4020
- return exports2.deprecate(fn, msg).apply(this, arguments);
4070
+ return exports$1.deprecate(fn, msg).apply(this, arguments);
4021
4071
  };
4022
4072
  }
4023
4073
  var warned = false;
@@ -4043,13 +4093,13 @@ function requireUtil() {
4043
4093
  debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".*").replace(/,/g, "$|^").toUpperCase();
4044
4094
  debugEnvRegex = new RegExp("^" + debugEnv + "$", "i");
4045
4095
  }
4046
- exports2.debuglog = function(set) {
4096
+ exports$1.debuglog = function(set) {
4047
4097
  set = set.toUpperCase();
4048
4098
  if (!debugs[set]) {
4049
4099
  if (debugEnvRegex.test(set)) {
4050
4100
  var pid = process$1.pid;
4051
4101
  debugs[set] = function() {
4052
- var msg = exports2.format.apply(exports2, arguments);
4102
+ var msg = exports$1.format.apply(exports$1, arguments);
4053
4103
  console.error("%s %d: %s", set, pid, msg);
4054
4104
  };
4055
4105
  } else {
@@ -4069,7 +4119,7 @@ function requireUtil() {
4069
4119
  if (isBoolean(opts)) {
4070
4120
  ctx.showHidden = opts;
4071
4121
  } else if (opts) {
4072
- exports2._extend(ctx, opts);
4122
+ exports$1._extend(ctx, opts);
4073
4123
  }
4074
4124
  if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
4075
4125
  if (isUndefined(ctx.depth)) ctx.depth = 2;
@@ -4078,7 +4128,7 @@ function requireUtil() {
4078
4128
  if (ctx.colors) ctx.stylize = stylizeWithColor;
4079
4129
  return formatValue(ctx, obj, ctx.depth);
4080
4130
  }
4081
- exports2.inspect = inspect;
4131
+ exports$1.inspect = inspect;
4082
4132
  inspect.colors = {
4083
4133
  "bold": [1, 22],
4084
4134
  "italic": [3, 23],
@@ -4125,7 +4175,7 @@ function requireUtil() {
4125
4175
  }
4126
4176
  function formatValue(ctx, value, recurseTimes) {
4127
4177
  if (ctx.customInspect && value && isFunction(value.inspect) && // Filter out the util module, it's inspect function is special
4128
- value.inspect !== exports2.inspect && // Also filter out any prototype objects using the circular check.
4178
+ value.inspect !== exports$1.inspect && // Also filter out any prototype objects using the circular check.
4129
4179
  !(value.constructor && value.constructor.prototype === value)) {
4130
4180
  var ret = value.inspect(recurseTimes, ctx);
4131
4181
  if (!isString(ret)) {
@@ -4311,68 +4361,68 @@ function requireUtil() {
4311
4361
  }
4312
4362
  return braces[0] + base + " " + output.join(", ") + " " + braces[1];
4313
4363
  }
4314
- exports2.types = requireTypes();
4364
+ exports$1.types = requireTypes();
4315
4365
  function isArray(ar) {
4316
4366
  return Array.isArray(ar);
4317
4367
  }
4318
- exports2.isArray = isArray;
4368
+ exports$1.isArray = isArray;
4319
4369
  function isBoolean(arg) {
4320
4370
  return typeof arg === "boolean";
4321
4371
  }
4322
- exports2.isBoolean = isBoolean;
4372
+ exports$1.isBoolean = isBoolean;
4323
4373
  function isNull(arg) {
4324
4374
  return arg === null;
4325
4375
  }
4326
- exports2.isNull = isNull;
4376
+ exports$1.isNull = isNull;
4327
4377
  function isNullOrUndefined(arg) {
4328
4378
  return arg == null;
4329
4379
  }
4330
- exports2.isNullOrUndefined = isNullOrUndefined;
4380
+ exports$1.isNullOrUndefined = isNullOrUndefined;
4331
4381
  function isNumber(arg) {
4332
4382
  return typeof arg === "number";
4333
4383
  }
4334
- exports2.isNumber = isNumber;
4384
+ exports$1.isNumber = isNumber;
4335
4385
  function isString(arg) {
4336
4386
  return typeof arg === "string";
4337
4387
  }
4338
- exports2.isString = isString;
4388
+ exports$1.isString = isString;
4339
4389
  function isSymbol(arg) {
4340
4390
  return typeof arg === "symbol";
4341
4391
  }
4342
- exports2.isSymbol = isSymbol;
4392
+ exports$1.isSymbol = isSymbol;
4343
4393
  function isUndefined(arg) {
4344
4394
  return arg === void 0;
4345
4395
  }
4346
- exports2.isUndefined = isUndefined;
4396
+ exports$1.isUndefined = isUndefined;
4347
4397
  function isRegExp(re) {
4348
4398
  return isObject(re) && objectToString(re) === "[object RegExp]";
4349
4399
  }
4350
- exports2.isRegExp = isRegExp;
4351
- exports2.types.isRegExp = isRegExp;
4400
+ exports$1.isRegExp = isRegExp;
4401
+ exports$1.types.isRegExp = isRegExp;
4352
4402
  function isObject(arg) {
4353
4403
  return typeof arg === "object" && arg !== null;
4354
4404
  }
4355
- exports2.isObject = isObject;
4405
+ exports$1.isObject = isObject;
4356
4406
  function isDate(d) {
4357
4407
  return isObject(d) && objectToString(d) === "[object Date]";
4358
4408
  }
4359
- exports2.isDate = isDate;
4360
- exports2.types.isDate = isDate;
4409
+ exports$1.isDate = isDate;
4410
+ exports$1.types.isDate = isDate;
4361
4411
  function isError(e) {
4362
4412
  return isObject(e) && (objectToString(e) === "[object Error]" || e instanceof Error);
4363
4413
  }
4364
- exports2.isError = isError;
4365
- exports2.types.isNativeError = isError;
4414
+ exports$1.isError = isError;
4415
+ exports$1.types.isNativeError = isError;
4366
4416
  function isFunction(arg) {
4367
4417
  return typeof arg === "function";
4368
4418
  }
4369
- exports2.isFunction = isFunction;
4419
+ exports$1.isFunction = isFunction;
4370
4420
  function isPrimitive(arg) {
4371
4421
  return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || typeof arg === "symbol" || // ES6 symbol
4372
4422
  typeof arg === "undefined";
4373
4423
  }
4374
- exports2.isPrimitive = isPrimitive;
4375
- exports2.isBuffer = requireIsBufferBrowser();
4424
+ exports$1.isPrimitive = isPrimitive;
4425
+ exports$1.isBuffer = requireIsBufferBrowser();
4376
4426
  function objectToString(o) {
4377
4427
  return Object.prototype.toString.call(o);
4378
4428
  }
@@ -4402,11 +4452,11 @@ function requireUtil() {
4402
4452
  ].join(":");
4403
4453
  return [d.getDate(), months[d.getMonth()], time].join(" ");
4404
4454
  }
4405
- exports2.log = function() {
4406
- console.log("%s - %s", timestamp(), exports2.format.apply(exports2, arguments));
4455
+ exports$1.log = function() {
4456
+ console.log("%s - %s", timestamp(), exports$1.format.apply(exports$1, arguments));
4407
4457
  };
4408
- exports2.inherits = requireInherits_browser();
4409
- exports2._extend = function(origin, add) {
4458
+ exports$1.inherits = requireInherits_browser();
4459
+ exports$1._extend = function(origin, add) {
4410
4460
  if (!add || !isObject(add)) return origin;
4411
4461
  var keys = Object.keys(add);
4412
4462
  var i = keys.length;
@@ -4418,8 +4468,8 @@ function requireUtil() {
4418
4468
  function hasOwnProperty(obj, prop) {
4419
4469
  return Object.prototype.hasOwnProperty.call(obj, prop);
4420
4470
  }
4421
- var kCustomPromisifiedSymbol = typeof Symbol !== "undefined" ? Symbol("util.promisify.custom") : void 0;
4422
- exports2.promisify = function promisify(original) {
4471
+ var kCustomPromisifiedSymbol = typeof Symbol !== "undefined" ? /* @__PURE__ */ Symbol("util.promisify.custom") : void 0;
4472
+ exports$1.promisify = function promisify(original) {
4423
4473
  if (typeof original !== "function")
4424
4474
  throw new TypeError('The "original" argument must be of type Function');
4425
4475
  if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {
@@ -4471,7 +4521,7 @@ function requireUtil() {
4471
4521
  getOwnPropertyDescriptors(original)
4472
4522
  );
4473
4523
  };
4474
- exports2.promisify.custom = kCustomPromisifiedSymbol;
4524
+ exports$1.promisify.custom = kCustomPromisifiedSymbol;
4475
4525
  function callbackifyOnRejected(reason, cb) {
4476
4526
  if (!reason) {
4477
4527
  var newReason = new Error("Promise was rejected with a falsy value");
@@ -4513,7 +4563,7 @@ function requireUtil() {
4513
4563
  );
4514
4564
  return callbackified;
4515
4565
  }
4516
- exports2.callbackify = callbackify;
4566
+ exports$1.callbackify = callbackify;
4517
4567
  })(util);
4518
4568
  return util;
4519
4569
  }
@@ -4526,31 +4576,25 @@ function requireBuffer_list() {
4526
4576
  var keys = Object.keys(object);
4527
4577
  if (Object.getOwnPropertySymbols) {
4528
4578
  var symbols = Object.getOwnPropertySymbols(object);
4529
- if (enumerableOnly) symbols = symbols.filter(function(sym) {
4579
+ enumerableOnly && (symbols = symbols.filter(function(sym) {
4530
4580
  return Object.getOwnPropertyDescriptor(object, sym).enumerable;
4531
- });
4532
- keys.push.apply(keys, symbols);
4581
+ })), keys.push.apply(keys, symbols);
4533
4582
  }
4534
4583
  return keys;
4535
4584
  }
4536
4585
  function _objectSpread(target) {
4537
4586
  for (var i = 1; i < arguments.length; i++) {
4538
- var source = arguments[i] != null ? arguments[i] : {};
4539
- if (i % 2) {
4540
- ownKeys(Object(source), true).forEach(function(key) {
4541
- _defineProperty(target, key, source[key]);
4542
- });
4543
- } else if (Object.getOwnPropertyDescriptors) {
4544
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
4545
- } else {
4546
- ownKeys(Object(source)).forEach(function(key) {
4547
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
4548
- });
4549
- }
4587
+ var source = null != arguments[i] ? arguments[i] : {};
4588
+ i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
4589
+ _defineProperty(target, key, source[key]);
4590
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
4591
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
4592
+ });
4550
4593
  }
4551
4594
  return target;
4552
4595
  }
4553
4596
  function _defineProperty(obj, key, value) {
4597
+ key = _toPropertyKey(key);
4554
4598
  if (key in obj) {
4555
4599
  Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
4556
4600
  } else {
@@ -4569,20 +4613,35 @@ function requireBuffer_list() {
4569
4613
  descriptor.enumerable = descriptor.enumerable || false;
4570
4614
  descriptor.configurable = true;
4571
4615
  if ("value" in descriptor) descriptor.writable = true;
4572
- Object.defineProperty(target, descriptor.key, descriptor);
4616
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
4573
4617
  }
4574
4618
  }
4575
4619
  function _createClass(Constructor, protoProps, staticProps) {
4576
4620
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
4621
+ Object.defineProperty(Constructor, "prototype", { writable: false });
4577
4622
  return Constructor;
4578
4623
  }
4624
+ function _toPropertyKey(arg) {
4625
+ var key = _toPrimitive(arg, "string");
4626
+ return typeof key === "symbol" ? key : String(key);
4627
+ }
4628
+ function _toPrimitive(input, hint) {
4629
+ if (typeof input !== "object" || input === null) return input;
4630
+ var prim = input[Symbol.toPrimitive];
4631
+ if (prim !== void 0) {
4632
+ var res = prim.call(input, hint);
4633
+ if (typeof res !== "object") return res;
4634
+ throw new TypeError("@@toPrimitive must return a primitive value.");
4635
+ }
4636
+ return String(input);
4637
+ }
4579
4638
  var _require = requireBuffer(), Buffer2 = _require.Buffer;
4580
4639
  var _require2 = requireUtil(), inspect = _require2.inspect;
4581
4640
  var custom = inspect && inspect.custom || "inspect";
4582
4641
  function copyBuffer(src, target, offset) {
4583
4642
  Buffer2.prototype.copy.call(src, target, offset);
4584
4643
  }
4585
- buffer_list = /* @__PURE__ */ function() {
4644
+ buffer_list = /* @__PURE__ */ (function() {
4586
4645
  function BufferList() {
4587
4646
  _classCallCheck(this, BufferList);
4588
4647
  this.head = null;
@@ -4634,9 +4693,7 @@ function requireBuffer_list() {
4634
4693
  if (this.length === 0) return "";
4635
4694
  var p = this.head;
4636
4695
  var ret = "" + p.data;
4637
- while (p = p.next) {
4638
- ret += s + p.data;
4639
- }
4696
+ while (p = p.next) ret += s + p.data;
4640
4697
  return ret;
4641
4698
  }
4642
4699
  }, {
@@ -4737,7 +4794,7 @@ function requireBuffer_list() {
4737
4794
  }, {
4738
4795
  key: custom,
4739
4796
  value: function value(_, options) {
4740
- return inspect(this, _objectSpread({}, options, {
4797
+ return inspect(this, _objectSpread(_objectSpread({}, options), {}, {
4741
4798
  // Only inspect one level.
4742
4799
  depth: 0,
4743
4800
  // It should not recurse.
@@ -4746,7 +4803,7 @@ function requireBuffer_list() {
4746
4803
  }
4747
4804
  }]);
4748
4805
  return BufferList;
4749
- }();
4806
+ })();
4750
4807
  return buffer_list;
4751
4808
  }
4752
4809
  var destroy_1;
@@ -4860,13 +4917,13 @@ function requireErrorsBrowser() {
4860
4917
  return message(arg1, arg2, arg3);
4861
4918
  }
4862
4919
  }
4863
- var NodeError = /* @__PURE__ */ function(_Base) {
4920
+ var NodeError = /* @__PURE__ */ (function(_Base) {
4864
4921
  _inheritsLoose(NodeError2, _Base);
4865
4922
  function NodeError2(arg1, arg2, arg3) {
4866
4923
  return _Base.call(this, getMessage(arg1, arg2, arg3)) || this;
4867
4924
  }
4868
4925
  return NodeError2;
4869
- }(Base);
4926
+ })(Base);
4870
4927
  NodeError.prototype.name = Base.name;
4871
4928
  NodeError.prototype.code = code;
4872
4929
  codes[code] = NodeError;
@@ -5031,7 +5088,7 @@ function require_stream_writable() {
5031
5088
  };
5032
5089
  var Stream = requireStreamBrowser();
5033
5090
  var Buffer2 = requireBuffer().Buffer;
5034
- var OurUint8Array = commonjsGlobal.Uint8Array || function() {
5091
+ var OurUint8Array = (typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
5035
5092
  };
5036
5093
  function _uint8ArrayToBuffer(chunk) {
5037
5094
  return Buffer2.from(chunk);
@@ -5479,9 +5536,7 @@ function require_stream_duplex() {
5479
5536
  hasRequired_stream_duplex = 1;
5480
5537
  var objectKeys = Object.keys || function(obj) {
5481
5538
  var keys2 = [];
5482
- for (var key in obj) {
5483
- keys2.push(key);
5484
- }
5539
+ for (var key in obj) keys2.push(key);
5485
5540
  return keys2;
5486
5541
  };
5487
5542
  _stream_duplex = Duplex;
@@ -5570,7 +5625,7 @@ var hasRequiredSafeBuffer;
5570
5625
  function requireSafeBuffer() {
5571
5626
  if (hasRequiredSafeBuffer) return safeBuffer.exports;
5572
5627
  hasRequiredSafeBuffer = 1;
5573
- (function(module2, exports2) {
5628
+ (function(module2, exports$1) {
5574
5629
  var buffer2 = requireBuffer();
5575
5630
  var Buffer2 = buffer2.Buffer;
5576
5631
  function copyProps(src, dst) {
@@ -5581,8 +5636,8 @@ function requireSafeBuffer() {
5581
5636
  if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {
5582
5637
  module2.exports = buffer2;
5583
5638
  } else {
5584
- copyProps(buffer2, exports2);
5585
- exports2.Buffer = SafeBuffer;
5639
+ copyProps(buffer2, exports$1);
5640
+ exports$1.Buffer = SafeBuffer;
5586
5641
  }
5587
5642
  function SafeBuffer(arg, encodingOrOffset, length) {
5588
5643
  return Buffer2(arg, encodingOrOffset, length);
@@ -5958,6 +6013,7 @@ function requireAsync_iterator() {
5958
6013
  hasRequiredAsync_iterator = 1;
5959
6014
  var _Object$setPrototypeO;
5960
6015
  function _defineProperty(obj, key, value) {
6016
+ key = _toPropertyKey(key);
5961
6017
  if (key in obj) {
5962
6018
  Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
5963
6019
  } else {
@@ -5965,14 +6021,28 @@ function requireAsync_iterator() {
5965
6021
  }
5966
6022
  return obj;
5967
6023
  }
6024
+ function _toPropertyKey(arg) {
6025
+ var key = _toPrimitive(arg, "string");
6026
+ return typeof key === "symbol" ? key : String(key);
6027
+ }
6028
+ function _toPrimitive(input, hint) {
6029
+ if (typeof input !== "object" || input === null) return input;
6030
+ var prim = input[Symbol.toPrimitive];
6031
+ if (prim !== void 0) {
6032
+ var res = prim.call(input, hint);
6033
+ if (typeof res !== "object") return res;
6034
+ throw new TypeError("@@toPrimitive must return a primitive value.");
6035
+ }
6036
+ return (hint === "string" ? String : Number)(input);
6037
+ }
5968
6038
  var finished = requireEndOfStream();
5969
- var kLastResolve = Symbol("lastResolve");
5970
- var kLastReject = Symbol("lastReject");
5971
- var kError = Symbol("error");
5972
- var kEnded = Symbol("ended");
5973
- var kLastPromise = Symbol("lastPromise");
5974
- var kHandlePromise = Symbol("handlePromise");
5975
- var kStream = Symbol("stream");
6039
+ var kLastResolve = /* @__PURE__ */ Symbol("lastResolve");
6040
+ var kLastReject = /* @__PURE__ */ Symbol("lastReject");
6041
+ var kError = /* @__PURE__ */ Symbol("error");
6042
+ var kEnded = /* @__PURE__ */ Symbol("ended");
6043
+ var kLastPromise = /* @__PURE__ */ Symbol("lastPromise");
6044
+ var kHandlePromise = /* @__PURE__ */ Symbol("handlePromise");
6045
+ var kStream = /* @__PURE__ */ Symbol("stream");
5976
6046
  function createIterResult(value, done) {
5977
6047
  return {
5978
6048
  value,
@@ -6143,7 +6213,7 @@ function require_stream_readable() {
6143
6213
  };
6144
6214
  var Stream = requireStreamBrowser();
6145
6215
  var Buffer2 = requireBuffer().Buffer;
6146
- var OurUint8Array = commonjsGlobal.Uint8Array || function() {
6216
+ var OurUint8Array = (typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() {
6147
6217
  };
6148
6218
  function _uint8ArrayToBuffer(chunk) {
6149
6219
  return Buffer2.from(chunk);
@@ -6608,11 +6678,9 @@ function require_stream_readable() {
6608
6678
  state2.pipes = null;
6609
6679
  state2.pipesCount = 0;
6610
6680
  state2.flowing = false;
6611
- for (var i = 0; i < len; i++) {
6612
- dests[i].emit("unpipe", this, {
6613
- hasUnpiped: false
6614
- });
6615
- }
6681
+ for (var i = 0; i < len; i++) dests[i].emit("unpipe", this, {
6682
+ hasUnpiped: false
6683
+ });
6616
6684
  return this;
6617
6685
  }
6618
6686
  var index = indexOf(state2.pipes, dest);
@@ -6711,8 +6779,7 @@ function require_stream_readable() {
6711
6779
  function flow(stream) {
6712
6780
  var state2 = stream._readableState;
6713
6781
  debug("flow", state2.flowing);
6714
- while (state2.flowing && stream.read() !== null) {
6715
- }
6782
+ while (state2.flowing && stream.read() !== null) ;
6716
6783
  }
6717
6784
  Readable.prototype.wrap = function(stream) {
6718
6785
  var _this = this;
@@ -6739,11 +6806,11 @@ function require_stream_readable() {
6739
6806
  });
6740
6807
  for (var i in stream) {
6741
6808
  if (this[i] === void 0 && typeof stream[i] === "function") {
6742
- this[i] = /* @__PURE__ */ function methodWrap(method) {
6809
+ this[i] = /* @__PURE__ */ (function methodWrap(method) {
6743
6810
  return function methodWrapReturnFunction() {
6744
6811
  return stream[method].apply(stream, arguments);
6745
6812
  };
6746
- }(i);
6813
+ })(i);
6747
6814
  }
6748
6815
  }
6749
6816
  for (var n = 0; n < kProxyEvents.length; n++) {
@@ -7139,7 +7206,7 @@ var hasRequiredSax;
7139
7206
  function requireSax() {
7140
7207
  if (hasRequiredSax) return sax;
7141
7208
  hasRequiredSax = 1;
7142
- (function(exports2) {
7209
+ (function(exports$1) {
7143
7210
  (function(sax2) {
7144
7211
  sax2.parser = function(strict, opt) {
7145
7212
  return new SAXParser(strict, opt);
@@ -8516,7 +8583,6 @@ function requireSax() {
8516
8583
  }
8517
8584
  return parser;
8518
8585
  }
8519
- /*! http://mths.be/fromcodepoint v0.1.0 by @mathias */
8520
8586
  if (!String.fromCodePoint) {
8521
8587
  (function() {
8522
8588
  var stringFromCharCode = String.fromCharCode;
@@ -8566,7 +8632,7 @@ function requireSax() {
8566
8632
  }
8567
8633
  })();
8568
8634
  }
8569
- })(exports2);
8635
+ })(exports$1);
8570
8636
  })(sax);
8571
8637
  return sax;
8572
8638
  }
@@ -9386,9 +9452,20 @@ class ImportedXmlComponentAttributes extends XmlAttributeComponent {
9386
9452
  }
9387
9453
  class ImportedXmlComponent extends XmlComponent {
9388
9454
  /**
9389
- * Converts the xml string to a XmlComponent tree.
9455
+ * Parses an XML string and converts it to an ImportedXmlComponent tree.
9456
+ *
9457
+ * This static method is the primary way to import external XML content.
9458
+ * It uses xml-js to parse the XML string into a JSON representation,
9459
+ * then converts that into a tree of XmlComponent objects.
9390
9460
  *
9391
- * @param importedContent xml content of the imported component
9461
+ * @param importedContent - The XML content as a string
9462
+ * @returns An ImportedXmlComponent representing the parsed XML
9463
+ *
9464
+ * @example
9465
+ * ```typescript
9466
+ * const xml = '<w:p><w:r><w:t>Hello</w:t></w:r></w:p>';
9467
+ * const component = ImportedXmlComponent.fromXmlString(xml);
9468
+ * ```
9392
9469
  */
9393
9470
  static fromXmlString(importedContent) {
9394
9471
  const xmlObj = libExports.xml2js(importedContent, { compact: false });
@@ -9397,8 +9474,8 @@ class ImportedXmlComponent extends XmlComponent {
9397
9474
  /**
9398
9475
  * Creates an ImportedXmlComponent.
9399
9476
  *
9400
- * @param rootKey the root element name
9401
- * @param _attr optional attributes for the root element
9477
+ * @param rootKey - The XML element name
9478
+ * @param _attr - Optional attributes for the root element
9402
9479
  */
9403
9480
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
9404
9481
  constructor(rootKey, _attr) {
@@ -9407,16 +9484,32 @@ class ImportedXmlComponent extends XmlComponent {
9407
9484
  this.root.push(new ImportedXmlComponentAttributes(_attr));
9408
9485
  }
9409
9486
  }
9487
+ /**
9488
+ * Adds a child component or text to this element.
9489
+ *
9490
+ * @param xmlComponent - The child component or text string to add
9491
+ */
9410
9492
  push(xmlComponent) {
9411
9493
  this.root.push(xmlComponent);
9412
9494
  }
9413
9495
  }
9414
9496
  class ImportedRootElementAttributes extends XmlComponent {
9497
+ /**
9498
+ * Creates an ImportedRootElementAttributes component.
9499
+ *
9500
+ * @param _attr - The attributes object to pass through
9501
+ */
9415
9502
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
9416
9503
  constructor(_attr) {
9417
9504
  super("");
9418
9505
  this._attr = _attr;
9419
9506
  }
9507
+ /**
9508
+ * Prepares the attributes for XML serialization.
9509
+ *
9510
+ * @param _ - Context (unused)
9511
+ * @returns Object with _attr key containing the raw attributes
9512
+ */
9420
9513
  prepForXml(_) {
9421
9514
  return {
9422
9515
  _attr: this._attr
@@ -9425,6 +9518,12 @@ class ImportedRootElementAttributes extends XmlComponent {
9425
9518
  }
9426
9519
  const WORKAROUND3 = "";
9427
9520
  class InitializableXmlComponent extends XmlComponent {
9521
+ /**
9522
+ * Creates a new InitializableXmlComponent.
9523
+ *
9524
+ * @param rootKey - The XML element name
9525
+ * @param initComponent - Optional component to copy children from
9526
+ */
9428
9527
  constructor(rootKey, initComponent) {
9429
9528
  super(rootKey);
9430
9529
  if (initComponent) {
@@ -9495,6 +9594,12 @@ const eighthPointMeasureValue = unsignedDecimalNumber;
9495
9594
  const pointMeasureValue = unsignedDecimalNumber;
9496
9595
  const dateTimeValue = (val) => val.toISOString();
9497
9596
  class OnOffElement extends XmlComponent {
9597
+ /**
9598
+ * Creates an OnOffElement.
9599
+ *
9600
+ * @param name - The XML element name (e.g., "w:b", "w:i")
9601
+ * @param val - The boolean value (defaults to true)
9602
+ */
9498
9603
  constructor(name, val = true) {
9499
9604
  super(name);
9500
9605
  if (val !== true) {
@@ -9503,6 +9608,12 @@ class OnOffElement extends XmlComponent {
9503
9608
  }
9504
9609
  }
9505
9610
  class HpsMeasureElement extends XmlComponent {
9611
+ /**
9612
+ * Creates an HpsMeasureElement.
9613
+ *
9614
+ * @param name - The XML element name
9615
+ * @param val - The measurement value (number in half-points or string with units)
9616
+ */
9506
9617
  constructor(name, val) {
9507
9618
  super(name);
9508
9619
  this.root.push(new Attributes({ val: hpsMeasureValue(val) }));
@@ -9511,6 +9622,12 @@ class HpsMeasureElement extends XmlComponent {
9511
9622
  class EmptyElement extends XmlComponent {
9512
9623
  }
9513
9624
  class StringValueElement extends XmlComponent {
9625
+ /**
9626
+ * Creates a StringValueElement.
9627
+ *
9628
+ * @param name - The XML element name
9629
+ * @param val - The string value
9630
+ */
9514
9631
  constructor(name, val) {
9515
9632
  super(name);
9516
9633
  this.root.push(new Attributes({ val }));
@@ -9523,24 +9640,50 @@ const createStringElement = (name, value) => new BuilderElement({
9523
9640
  }
9524
9641
  });
9525
9642
  class NumberValueElement extends XmlComponent {
9643
+ /**
9644
+ * Creates a NumberValueElement.
9645
+ *
9646
+ * @param name - The XML element name
9647
+ * @param val - The numeric value
9648
+ */
9526
9649
  constructor(name, val) {
9527
9650
  super(name);
9528
9651
  this.root.push(new Attributes({ val }));
9529
9652
  }
9530
9653
  }
9531
9654
  class StringEnumValueElement extends XmlComponent {
9655
+ /**
9656
+ * Creates a StringEnumValueElement.
9657
+ *
9658
+ * @param name - The XML element name
9659
+ * @param val - The enum value
9660
+ */
9532
9661
  constructor(name, val) {
9533
9662
  super(name);
9534
9663
  this.root.push(new Attributes({ val }));
9535
9664
  }
9536
9665
  }
9537
9666
  class StringContainer extends XmlComponent {
9667
+ /**
9668
+ * Creates a StringContainer.
9669
+ *
9670
+ * @param name - The XML element name
9671
+ * @param val - The text content
9672
+ */
9538
9673
  constructor(name, val) {
9539
9674
  super(name);
9540
9675
  this.root.push(val);
9541
9676
  }
9542
9677
  }
9543
9678
  class BuilderElement extends XmlComponent {
9679
+ /**
9680
+ * Creates a BuilderElement with the specified configuration.
9681
+ *
9682
+ * @param config - Element configuration
9683
+ * @param config.name - The XML element name
9684
+ * @param config.attributes - Optional attributes with explicit key-value pairs
9685
+ * @param config.children - Optional child elements
9686
+ */
9544
9687
  constructor({
9545
9688
  name,
9546
9689
  attributes,
@@ -9775,17 +9918,27 @@ class End extends XmlComponent {
9775
9918
  }
9776
9919
  }
9777
9920
  const HorizontalPositionAlign = {
9921
+ /** Center horizontally */
9778
9922
  CENTER: "center",
9923
+ /** Align to inside margin (left on odd, right on even pages) */
9779
9924
  INSIDE: "inside",
9925
+ /** Align to left */
9780
9926
  LEFT: "left",
9927
+ /** Align to outside margin (right on odd, left on even pages) */
9781
9928
  OUTSIDE: "outside",
9929
+ /** Align to right */
9782
9930
  RIGHT: "right"
9783
9931
  };
9784
9932
  const VerticalPositionAlign = {
9933
+ /** Align to bottom */
9785
9934
  BOTTOM: "bottom",
9935
+ /** Center vertically */
9786
9936
  CENTER: "center",
9937
+ /** Align to inside margin */
9787
9938
  INSIDE: "inside",
9939
+ /** Align to outside margin */
9788
9940
  OUTSIDE: "outside",
9941
+ /** Align to top */
9789
9942
  TOP: "top"
9790
9943
  };
9791
9944
  const NumberFormat$1 = {
@@ -9914,6 +10067,7 @@ class Shading extends XmlComponent {
9914
10067
  }
9915
10068
  }
9916
10069
  const ShadingType = {
10070
+ /** Clear shading - no pattern, fill color only */
9917
10071
  CLEAR: "clear",
9918
10072
  DIAGONAL_CROSS: "diagCross",
9919
10073
  DIAGONAL_STRIPE: "diagStripe",
@@ -9963,6 +10117,7 @@ class ChangeAttributes extends XmlAttributeComponent {
9963
10117
  }
9964
10118
  }
9965
10119
  const EmphasisMarkType = {
10120
+ /** Dot emphasis mark */
9966
10121
  DOT: "dot"
9967
10122
  };
9968
10123
  class BaseEmphasisMark extends XmlComponent {
@@ -10095,23 +10250,41 @@ class SubScript extends VerticalAlign$1 {
10095
10250
  }
10096
10251
  }
10097
10252
  const UnderlineType = {
10253
+ /** Single underline */
10098
10254
  SINGLE: "single",
10255
+ /** Underline words only (not spaces) */
10099
10256
  WORDS: "words",
10257
+ /** Double underline */
10100
10258
  DOUBLE: "double",
10259
+ /** Thick single underline */
10101
10260
  THICK: "thick",
10261
+ /** Dotted underline */
10102
10262
  DOTTED: "dotted",
10263
+ /** Heavy dotted underline */
10103
10264
  DOTTEDHEAVY: "dottedHeavy",
10265
+ /** Dashed underline */
10104
10266
  DASH: "dash",
10267
+ /** Heavy dashed underline */
10105
10268
  DASHEDHEAVY: "dashedHeavy",
10269
+ /** Long dashed underline */
10106
10270
  DASHLONG: "dashLong",
10271
+ /** Heavy long dashed underline */
10107
10272
  DASHLONGHEAVY: "dashLongHeavy",
10273
+ /** Dot-dash underline */
10108
10274
  DOTDASH: "dotDash",
10275
+ /** Heavy dot-dash underline */
10109
10276
  DASHDOTHEAVY: "dashDotHeavy",
10277
+ /** Dot-dot-dash underline */
10110
10278
  DOTDOTDASH: "dotDotDash",
10279
+ /** Heavy dot-dot-dash underline */
10111
10280
  DASHDOTDOTHEAVY: "dashDotDotHeavy",
10281
+ /** Wave underline */
10112
10282
  WAVE: "wave",
10283
+ /** Heavy wave underline */
10113
10284
  WAVYHEAVY: "wavyHeavy",
10285
+ /** Double wave underline */
10114
10286
  WAVYDOUBLE: "wavyDouble",
10287
+ /** No underline */
10115
10288
  NONE: "none"
10116
10289
  };
10117
10290
  class Underline extends XmlComponent {
@@ -10126,31 +10299,55 @@ class Underline extends XmlComponent {
10126
10299
  }
10127
10300
  }
10128
10301
  const TextEffect = {
10302
+ /** Blinking background animation */
10129
10303
  BLINK_BACKGROUND: "blinkBackground",
10304
+ /** Lights animation effect */
10130
10305
  LIGHTS: "lights",
10306
+ /** Black marching ants animation */
10131
10307
  ANTS_BLACK: "antsBlack",
10308
+ /** Red marching ants animation */
10132
10309
  ANTS_RED: "antsRed",
10310
+ /** Shimmer animation effect */
10133
10311
  SHIMMER: "shimmer",
10312
+ /** Sparkle animation effect */
10134
10313
  SPARKLE: "sparkle",
10314
+ /** No text effect */
10135
10315
  NONE: "none"
10136
10316
  };
10137
10317
  const HighlightColor = {
10318
+ /** Black highlight */
10138
10319
  BLACK: "black",
10320
+ /** Blue highlight */
10139
10321
  BLUE: "blue",
10322
+ /** Cyan highlight */
10140
10323
  CYAN: "cyan",
10324
+ /** Dark blue highlight */
10141
10325
  DARK_BLUE: "darkBlue",
10326
+ /** Dark cyan highlight */
10142
10327
  DARK_CYAN: "darkCyan",
10328
+ /** Dark gray highlight */
10143
10329
  DARK_GRAY: "darkGray",
10330
+ /** Dark green highlight */
10144
10331
  DARK_GREEN: "darkGreen",
10332
+ /** Dark magenta highlight */
10145
10333
  DARK_MAGENTA: "darkMagenta",
10334
+ /** Dark red highlight */
10146
10335
  DARK_RED: "darkRed",
10336
+ /** Dark yellow highlight */
10147
10337
  DARK_YELLOW: "darkYellow",
10338
+ /** Green highlight */
10148
10339
  GREEN: "green",
10340
+ /** Light gray highlight */
10149
10341
  LIGHT_GRAY: "lightGray",
10342
+ /** Magenta highlight */
10150
10343
  MAGENTA: "magenta",
10344
+ /** No highlight */
10151
10345
  NONE: "none",
10346
+ /** Red highlight */
10152
10347
  RED: "red",
10348
+ /** White highlight */
10153
10349
  WHITE: "white",
10350
+ /** Yellow highlight */
10154
10351
  YELLOW: "yellow"
10155
10352
  };
10156
10353
  class RunProperties extends IgnoreIfEmptyXmlComponent {
@@ -10307,9 +10504,13 @@ class Text extends XmlComponent {
10307
10504
  }
10308
10505
  }
10309
10506
  const PageNumber = {
10507
+ /** Inserts the current page number */
10310
10508
  CURRENT: "CURRENT",
10509
+ /** Inserts the total number of pages in the document */
10311
10510
  TOTAL_PAGES: "TOTAL_PAGES",
10511
+ /** Inserts the total number of pages in the current section */
10312
10512
  TOTAL_PAGES_IN_SECTION: "TOTAL_PAGES_IN_SECTION",
10513
+ /** Inserts the current section number */
10313
10514
  CURRENT_SECTION: "SECTION"
10314
10515
  };
10315
10516
  class Run extends XmlComponent {
@@ -12023,8 +12224,8 @@ var hasRequiredHash;
12023
12224
  function requireHash() {
12024
12225
  if (hasRequiredHash) return hash$1;
12025
12226
  hasRequiredHash = 1;
12026
- (function(exports2) {
12027
- var hash2 = exports2;
12227
+ (function(exports$1) {
12228
+ var hash2 = exports$1;
12028
12229
  hash2.utils = requireUtils();
12029
12230
  hash2.common = requireCommon$1();
12030
12231
  hash2.sha = requireSha();
@@ -12623,9 +12824,13 @@ const TextWrappingType = {
12623
12824
  TOP_AND_BOTTOM: 3
12624
12825
  };
12625
12826
  const TextWrappingSide = {
12827
+ /** Text wraps on both sides of the drawing */
12626
12828
  BOTH_SIDES: "bothSides",
12829
+ /** Text wraps only on the left side */
12627
12830
  LEFT: "left",
12831
+ /** Text wraps only on the right side */
12628
12832
  RIGHT: "right",
12833
+ /** Text wraps on the side with more space */
12629
12834
  LARGEST: "largest"
12630
12835
  };
12631
12836
  class WrapNone extends XmlComponent {
@@ -13048,6 +13253,7 @@ class RelationshipAttributes extends XmlAttributeComponent {
13048
13253
  }
13049
13254
  }
13050
13255
  const TargetModeType = {
13256
+ /** Target is external to the package (e.g., hyperlink to a URL) */
13051
13257
  EXTERNAL: "External"
13052
13258
  };
13053
13259
  class Relationship extends XmlComponent {
@@ -13072,11 +13278,24 @@ class Relationships extends XmlComponent {
13072
13278
  })
13073
13279
  );
13074
13280
  }
13281
+ /**
13282
+ * Creates a new relationship to another part in the package.
13283
+ *
13284
+ * @param id - Unique identifier for this relationship (will be prefixed with "rId")
13285
+ * @param type - Relationship type URI (e.g., image, header, hyperlink)
13286
+ * @param target - Path to the target part
13287
+ * @param targetMode - Optional mode indicating if target is external
13288
+ * @returns The created Relationship instance
13289
+ */
13075
13290
  createRelationship(id, type2, target, targetMode) {
13076
13291
  const relationship = new Relationship(`rId${id}`, type2, target, targetMode);
13077
13292
  this.root.push(relationship);
13078
13293
  return relationship;
13079
13294
  }
13295
+ /**
13296
+ * Gets the count of relationships in this collection.
13297
+ * Excludes the attributes element from the count.
13298
+ */
13080
13299
  get RelationshipCount() {
13081
13300
  return this.root.length - 1;
13082
13301
  }
@@ -13299,19 +13518,29 @@ class LastRenderedPageBreak extends EmptyElement {
13299
13518
  }
13300
13519
  }
13301
13520
  const PositionalTabAlignment = {
13521
+ /** Left-aligned tab */
13302
13522
  LEFT: "left",
13523
+ /** Center-aligned tab */
13303
13524
  CENTER: "center",
13525
+ /** Right-aligned tab */
13304
13526
  RIGHT: "right"
13305
13527
  };
13306
13528
  const PositionalTabRelativeTo = {
13529
+ /** Position relative to margin */
13307
13530
  MARGIN: "margin",
13531
+ /** Position relative to indent */
13308
13532
  INDENT: "indent"
13309
13533
  };
13310
13534
  const PositionalTabLeader = {
13535
+ /** No leader character */
13311
13536
  NONE: "none",
13537
+ /** Dot leader (...) */
13312
13538
  DOT: "dot",
13539
+ /** Hyphen leader (---) */
13313
13540
  HYPHEN: "hyphen",
13541
+ /** Underscore leader (___) */
13314
13542
  UNDERSCORE: "underscore",
13543
+ /** Middle dot leader (···) */
13315
13544
  MIDDLE_DOT: "middleDot"
13316
13545
  };
13317
13546
  class PositionalTab extends XmlComponent {
@@ -13336,7 +13565,9 @@ class PositionalTab extends XmlComponent {
13336
13565
  }
13337
13566
  }
13338
13567
  const BreakType = {
13568
+ /** Column break - text continues at the beginning of the next column */
13339
13569
  COLUMN: "column",
13570
+ /** Page break - text continues at the beginning of the next page */
13340
13571
  PAGE: "page"
13341
13572
  // textWrapping breaks are the default and already exposed via the "Run" class
13342
13573
  };
@@ -13368,9 +13599,13 @@ class PageBreakBefore extends XmlComponent {
13368
13599
  }
13369
13600
  }
13370
13601
  const LineRuleType = {
13602
+ /** Line spacing is at least the specified value */
13371
13603
  AT_LEAST: "atLeast",
13604
+ /** Line spacing is exactly the specified value */
13372
13605
  EXACTLY: "exactly",
13606
+ /** Line spacing is exactly the specified value (alias for EXACTLY) */
13373
13607
  EXACT: "exact",
13608
+ /** Line spacing is automatically determined based on content */
13374
13609
  AUTO: "auto"
13375
13610
  };
13376
13611
  class SpacingAttributes extends XmlAttributeComponent {
@@ -13393,12 +13628,19 @@ class Spacing extends XmlComponent {
13393
13628
  }
13394
13629
  }
13395
13630
  const HeadingLevel = {
13631
+ /** Heading 1 style */
13396
13632
  HEADING_1: "Heading1",
13633
+ /** Heading 2 style */
13397
13634
  HEADING_2: "Heading2",
13635
+ /** Heading 3 style */
13398
13636
  HEADING_3: "Heading3",
13637
+ /** Heading 4 style */
13399
13638
  HEADING_4: "Heading4",
13639
+ /** Heading 5 style */
13400
13640
  HEADING_5: "Heading5",
13641
+ /** Heading 6 style */
13401
13642
  HEADING_6: "Heading6",
13643
+ /** Title style */
13402
13644
  TITLE: "Title"
13403
13645
  };
13404
13646
  let Style$1 = class Style extends XmlComponent {
@@ -13420,24 +13662,39 @@ class TabStop extends XmlComponent {
13420
13662
  }
13421
13663
  }
13422
13664
  const TabStopType = {
13665
+ /** Left-aligned tab stop */
13423
13666
  LEFT: "left",
13667
+ /** Right-aligned tab stop */
13424
13668
  RIGHT: "right",
13669
+ /** Center-aligned tab stop */
13425
13670
  CENTER: "center",
13671
+ /** Bar tab stop - inserts a vertical bar at the position */
13426
13672
  BAR: "bar",
13673
+ /** Clears a tab stop at the specified position */
13427
13674
  CLEAR: "clear",
13675
+ /** Decimal-aligned tab stop - aligns on decimal point */
13428
13676
  DECIMAL: "decimal",
13677
+ /** End-aligned tab stop (right-to-left equivalent) */
13429
13678
  END: "end",
13679
+ /** List tab stop for numbered lists */
13430
13680
  NUM: "num",
13681
+ /** Start-aligned tab stop (left-to-right equivalent) */
13431
13682
  START: "start"
13432
13683
  };
13433
13684
  const LeaderType = {
13685
+ /** Dot leader (....) */
13434
13686
  DOT: "dot",
13687
+ /** Hyphen leader (----) */
13435
13688
  HYPHEN: "hyphen",
13689
+ /** Middle dot leader (····) */
13436
13690
  MIDDLE_DOT: "middleDot",
13691
+ /** No leader */
13437
13692
  NONE: "none",
13693
+ /** Underscore leader (____) */
13438
13694
  UNDERSCORE: "underscore"
13439
13695
  };
13440
13696
  const TabStopPosition = {
13697
+ /** Maximum tab stop position (right margin) */
13441
13698
  MAX: 9026
13442
13699
  };
13443
13700
  class TabAttributes extends XmlAttributeComponent {
@@ -13493,7 +13750,8 @@ class NumberId extends XmlComponent {
13493
13750
  class FileChild extends XmlComponent {
13494
13751
  constructor() {
13495
13752
  super(...arguments);
13496
- __publicField(this, "fileChild", Symbol());
13753
+ /** Marker property identifying this as a FileChild */
13754
+ __publicField(this, "fileChild", /* @__PURE__ */ Symbol());
13497
13755
  }
13498
13756
  }
13499
13757
  class HyperlinkAttributes extends XmlAttributeComponent {
@@ -13507,7 +13765,9 @@ class HyperlinkAttributes extends XmlAttributeComponent {
13507
13765
  }
13508
13766
  }
13509
13767
  const HyperlinkType = {
13768
+ /** Internal hyperlink to a bookmark within the document */
13510
13769
  INTERNAL: "INTERNAL",
13770
+ /** External hyperlink to a URL outside the document */
13511
13771
  EXTERNAL: "EXTERNAL"
13512
13772
  };
13513
13773
  class ConcreteHyperlink extends XmlComponent {
@@ -13789,16 +14049,23 @@ const createLineNumberType = ({ countBy, start, restart, distance }) => new Buil
13789
14049
  }
13790
14050
  });
13791
14051
  const PageBorderDisplay = {
14052
+ /** Display border on all pages */
13792
14053
  ALL_PAGES: "allPages",
14054
+ /** Display border only on first page */
13793
14055
  FIRST_PAGE: "firstPage",
14056
+ /** Display border on all pages except first page */
13794
14057
  NOT_FIRST_PAGE: "notFirstPage"
13795
14058
  };
13796
14059
  const PageBorderOffsetFrom = {
14060
+ /** Position border relative to page edge */
13797
14061
  PAGE: "page",
14062
+ /** Position border relative to text (default) */
13798
14063
  TEXT: "text"
13799
14064
  };
13800
14065
  const PageBorderZOrder = {
14066
+ /** Display border behind page contents */
13801
14067
  BACK: "back",
14068
+ /** Display border in front of page contents (default) */
13802
14069
  FRONT: "front"
13803
14070
  };
13804
14071
  class PageBordersAttributes extends XmlAttributeComponent {
@@ -13859,10 +14126,15 @@ class PageMargin extends XmlComponent {
13859
14126
  }
13860
14127
  }
13861
14128
  const PageNumberSeparator = {
14129
+ /** Hyphen separator (-) */
13862
14130
  HYPHEN: "hyphen",
14131
+ /** Period separator (.) */
13863
14132
  PERIOD: "period",
14133
+ /** Colon separator (:) */
13864
14134
  COLON: "colon",
14135
+ /** Em dash separator (—) */
13865
14136
  EM_DASH: "emDash",
14137
+ /** En dash separator (–) */
13866
14138
  EN_DASH: "endash"
13867
14139
  };
13868
14140
  class PageNumberTypeAttributes extends XmlAttributeComponent {
@@ -13915,7 +14187,9 @@ const createPageSize = ({ width, height, orientation, code }) => {
13915
14187
  });
13916
14188
  };
13917
14189
  const PageTextDirectionType = {
14190
+ /** Left-to-right, top-to-bottom (standard Western text flow) */
13918
14191
  LEFT_TO_RIGHT_TOP_TO_BOTTOM: "lrTb",
14192
+ /** Top-to-bottom, right-to-left (vertical East Asian text flow) */
13919
14193
  TOP_TO_BOTTOM_RIGHT_TO_LEFT: "tbRl"
13920
14194
  };
13921
14195
  class PageTextDirectionAttributes extends XmlAttributeComponent {
@@ -13935,10 +14209,15 @@ class PageTextDirection extends XmlComponent {
13935
14209
  }
13936
14210
  }
13937
14211
  const SectionType = {
14212
+ /** Section begins on the next page */
13938
14213
  NEXT_PAGE: "nextPage",
14214
+ /** Section begins on the next column */
13939
14215
  NEXT_COLUMN: "nextColumn",
14216
+ /** Section begins immediately following the previous section */
13940
14217
  CONTINUOUS: "continuous",
14218
+ /** Section begins on the next even-numbered page */
13941
14219
  EVEN_PAGE: "evenPage",
14220
+ /** Section begins on the next odd-numbered page */
13942
14221
  ODD_PAGE: "oddPage"
13943
14222
  };
13944
14223
  class SectionTypeAttributes extends XmlAttributeComponent {
@@ -13956,17 +14235,27 @@ class Type extends XmlComponent {
13956
14235
  }
13957
14236
  }
13958
14237
  const sectionMarginDefaults = {
14238
+ /** Top margin: 1440 twips (1 inch) */
13959
14239
  TOP: 1440,
14240
+ /** Right margin: 1440 twips (1 inch) */
13960
14241
  RIGHT: 1440,
14242
+ /** Bottom margin: 1440 twips (1 inch) */
13961
14243
  BOTTOM: 1440,
14244
+ /** Left margin: 1440 twips (1 inch) */
13962
14245
  LEFT: 1440,
14246
+ /** Header margin from top: 708 twips (0.5 inches) */
13963
14247
  HEADER: 708,
14248
+ /** Footer margin from bottom: 708 twips (0.5 inches) */
13964
14249
  FOOTER: 708,
14250
+ /** Gutter margin for binding: 0 twips */
13965
14251
  GUTTER: 0
13966
14252
  };
13967
14253
  const sectionPageSizeDefaults = {
14254
+ /** Page width: 11906 twips (8.27 inches, 210mm) */
13968
14255
  WIDTH: 11906,
14256
+ /** Page height: 16838 twips (11.69 inches, 297mm) */
13969
14257
  HEIGHT: 16838,
14258
+ /** Page orientation: portrait */
13970
14259
  ORIENTATION: PageOrientation.PORTRAIT
13971
14260
  };
13972
14261
  class SectionProperties extends XmlComponent {
@@ -14062,19 +14351,32 @@ class Body extends XmlComponent {
14062
14351
  __publicField(this, "sections", []);
14063
14352
  }
14064
14353
  /**
14065
- * Adds new section properties.
14066
- * Note: Previous section is created in paragraph after the current element, and then new section will be added.
14067
- * The spec says:
14068
- * - section element should be in the last paragraph of the section
14069
- * - last section should be direct child of body
14354
+ * Adds new section properties to the document body.
14355
+ *
14356
+ * Creates a new section by moving the previous section's properties into a paragraph
14357
+ * at the end of that section, and then adding the new section as the current section.
14070
14358
  *
14071
- * @param options new section options
14359
+ * According to the OOXML specification:
14360
+ * - Section properties for all sections except the last must be stored in a paragraph's
14361
+ * properties (pPr/sectPr) at the end of each section
14362
+ * - The last section's properties are stored as a direct child of the body element (w:body/w:sectPr)
14363
+ *
14364
+ * @param options - Section properties configuration (page size, margins, headers, footers, etc.)
14072
14365
  */
14073
14366
  addSection(options) {
14074
14367
  const currentSection = this.sections.pop();
14075
14368
  this.root.push(this.createSectionParagraph(currentSection));
14076
14369
  this.sections.push(new SectionProperties(options));
14077
14370
  }
14371
+ /**
14372
+ * Prepares the body element for XML serialization.
14373
+ *
14374
+ * Ensures that the last section's properties are placed as a direct child of the body
14375
+ * element, as required by the OOXML specification.
14376
+ *
14377
+ * @param context - The XML serialization context
14378
+ * @returns The prepared XML object or undefined
14379
+ */
14078
14380
  prepForXml(context) {
14079
14381
  if (this.sections.length === 1) {
14080
14382
  this.root.splice(0, 1);
@@ -14082,6 +14384,14 @@ class Body extends XmlComponent {
14082
14384
  }
14083
14385
  return super.prepForXml(context);
14084
14386
  }
14387
+ /**
14388
+ * Adds a block-level component to the body.
14389
+ *
14390
+ * This method is used internally by the Document class to add paragraphs,
14391
+ * tables, and other block-level elements to the document body.
14392
+ *
14393
+ * @param component - The XML component to add (paragraph, table, etc.)
14394
+ */
14085
14395
  push(component) {
14086
14396
  this.root.push(component);
14087
14397
  }
@@ -14224,10 +14534,21 @@ class Document extends XmlComponent {
14224
14534
  }
14225
14535
  this.root.push(this.body);
14226
14536
  }
14537
+ /**
14538
+ * Adds a block-level element to the document body.
14539
+ *
14540
+ * @param item - The element to add (paragraph, table, table of contents, or hyperlink)
14541
+ * @returns The Document instance for method chaining
14542
+ */
14227
14543
  add(item) {
14228
14544
  this.body.push(item);
14229
14545
  return this;
14230
14546
  }
14547
+ /**
14548
+ * Gets the document body element.
14549
+ *
14550
+ * @returns The Body instance containing all document content
14551
+ */
14231
14552
  get Body() {
14232
14553
  return this.body;
14233
14554
  }
@@ -14259,21 +14580,33 @@ class WordWrap extends XmlComponent {
14259
14580
  }
14260
14581
  }
14261
14582
  const DropCapType = {
14583
+ /** No drop cap effect */
14262
14584
  NONE: "none",
14585
+ /** Drop cap that drops down into the paragraph text */
14263
14586
  DROP: "drop",
14587
+ /** Drop cap that extends into the margin */
14264
14588
  MARGIN: "margin"
14265
14589
  };
14266
14590
  const FrameAnchorType = {
14591
+ /** Anchor relative to the page margin */
14267
14592
  MARGIN: "margin",
14593
+ /** Anchor relative to the page edge */
14268
14594
  PAGE: "page",
14595
+ /** Anchor relative to the text column */
14269
14596
  TEXT: "text"
14270
14597
  };
14271
14598
  const FrameWrap = {
14599
+ /** Wrap text around the frame on all sides */
14272
14600
  AROUND: "around",
14601
+ /** Automatic wrapping based on available space */
14273
14602
  AUTO: "auto",
14603
+ /** No text wrapping */
14274
14604
  NONE: "none",
14605
+ /** Do not allow text beside the frame */
14275
14606
  NOT_BESIDE: "notBeside",
14607
+ /** Allow text to flow through the frame */
14276
14608
  THROUGH: "through",
14609
+ /** Wrap text tightly around the frame */
14277
14610
  TIGHT: "tight"
14278
14611
  };
14279
14612
  const createFrameProperties = (options) => {
@@ -14447,9 +14780,23 @@ class ParagraphProperties extends IgnoreIfEmptyXmlComponent {
14447
14780
  this.push(new RunProperties(options.run));
14448
14781
  }
14449
14782
  }
14783
+ /**
14784
+ * Adds a property element to the paragraph properties.
14785
+ *
14786
+ * @param item - The XML component to add to the paragraph properties
14787
+ */
14450
14788
  push(item) {
14451
14789
  this.root.push(item);
14452
14790
  }
14791
+ /**
14792
+ * Prepares the paragraph properties for XML serialization.
14793
+ *
14794
+ * This method creates concrete numbering instances for any numbering references
14795
+ * before the properties are converted to XML.
14796
+ *
14797
+ * @param context - The XML context containing document and file information
14798
+ * @returns The prepared XML object, or undefined if the component should be ignored
14799
+ */
14453
14800
  prepForXml(context) {
14454
14801
  if (context.viewWrapper instanceof DocumentWrapper) {
14455
14802
  for (const reference of this.numberingReferences) {
@@ -14949,10 +15296,12 @@ class GridSpan extends XmlComponent {
14949
15296
  const VerticalMergeType = {
14950
15297
  /**
14951
15298
  * Cell that is merged with upper one.
15299
+ * This cell continues a vertical merge started by a cell above it.
14952
15300
  */
14953
15301
  CONTINUE: "continue",
14954
15302
  /**
14955
15303
  * Cell that is starting the vertical merge.
15304
+ * This cell begins a new vertical merge region.
14956
15305
  */
14957
15306
  RESTART: "restart"
14958
15307
  };
@@ -14973,8 +15322,11 @@ class VerticalMerge extends XmlComponent {
14973
15322
  }
14974
15323
  }
14975
15324
  const TextDirection = {
15325
+ /** Text flows from bottom to top, left to right */
14976
15326
  BOTTOM_TO_TOP_LEFT_TO_RIGHT: "btLr",
15327
+ /** Text flows from left to right, top to bottom (default) */
14977
15328
  LEFT_TO_RIGHT_TOP_TO_BOTTOM: "lrTb",
15329
+ /** Text flows from top to bottom, right to left */
14978
15330
  TOP_TO_BOTTOM_RIGHT_TO_LEFT: "tbRl"
14979
15331
  };
14980
15332
  class TDirectionAttributes extends XmlAttributeComponent {
@@ -15182,7 +15534,9 @@ class TableFloatProperties extends XmlComponent {
15182
15534
  }
15183
15535
  }
15184
15536
  const TableLayoutType = {
15537
+ /** Auto-fit layout - column widths are adjusted based on content */
15185
15538
  AUTOFIT: "autofit",
15539
+ /** Fixed layout - column widths are fixed as specified */
15186
15540
  FIXED: "fixed"
15187
15541
  };
15188
15542
  class TableLayoutAttributes extends XmlAttributeComponent {
@@ -15501,11 +15855,21 @@ class ContentTypes extends XmlComponent {
15501
15855
  this.root.push(new Override("application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml", "/word/comments.xml"));
15502
15856
  this.root.push(new Override("application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml", "/word/fontTable.xml"));
15503
15857
  }
15858
+ /**
15859
+ * Registers a footer part in the content types.
15860
+ *
15861
+ * @param index - Footer index number (e.g., 1 for footer1.xml)
15862
+ */
15504
15863
  addFooter(index) {
15505
15864
  this.root.push(
15506
15865
  new Override("application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml", `/word/footer${index}.xml`)
15507
15866
  );
15508
15867
  }
15868
+ /**
15869
+ * Registers a header part in the content types.
15870
+ *
15871
+ * @param index - Header index number (e.g., 1 for header1.xml)
15872
+ */
15509
15873
  addHeader(index) {
15510
15874
  this.root.push(
15511
15875
  new Override("application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml", `/word/header${index}.xml`)
@@ -15571,7 +15935,7 @@ class CustomPropertyAttributes extends XmlAttributeComponent {
15571
15935
  constructor() {
15572
15936
  super(...arguments);
15573
15937
  __publicField(this, "xmlKeys", {
15574
- fmtid: "fmtid",
15938
+ formatId: "fmtid",
15575
15939
  pid: "pid",
15576
15940
  name: "name"
15577
15941
  });
@@ -15582,7 +15946,7 @@ class CustomProperty extends XmlComponent {
15582
15946
  super("property");
15583
15947
  this.root.push(
15584
15948
  new CustomPropertyAttributes({
15585
- fmtid: "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",
15949
+ formatId: "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",
15586
15950
  pid: id.toString(),
15587
15951
  name: properties.name
15588
15952
  })
@@ -15663,50 +16027,47 @@ const createFont = ({
15663
16027
  embedBold,
15664
16028
  embedItalic,
15665
16029
  embedBoldItalic
15666
- }) => (
15667
- // http://www.datypic.com/sc/ooxml/e-w_font-1.html
15668
- new BuilderElement({
15669
- name: "w:font",
15670
- attributes: {
15671
- name: { key: "w:name", value: name }
15672
- },
15673
- children: [
15674
- // http://www.datypic.com/sc/ooxml/e-w_altName-1.html
15675
- ...altName ? [createStringElement("w:altName", altName)] : [],
15676
- // http://www.datypic.com/sc/ooxml/e-w_panose1-1.html
15677
- ...panose1 ? [createStringElement("w:panose1", panose1)] : [],
15678
- // http://www.datypic.com/sc/ooxml/e-w_charset-1.html
15679
- ...charset ? [createStringElement("w:charset", charset)] : [],
15680
- // http://www.datypic.com/sc/ooxml/e-w_family-1.html
15681
- ...[createStringElement("w:family", family)],
15682
- // http://www.datypic.com/sc/ooxml/e-w_notTrueType-1.html
15683
- ...notTrueType ? [new OnOffElement("w:notTrueType", notTrueType)] : [],
15684
- ...[createStringElement("w:pitch", pitch)],
15685
- // http://www.datypic.com/sc/ooxml/e-w_sig-1.html
15686
- ...sig ? [
15687
- new BuilderElement({
15688
- name: "w:sig",
15689
- attributes: {
15690
- usb0: { key: "w:usb0", value: sig.usb0 },
15691
- usb1: { key: "w:usb1", value: sig.usb1 },
15692
- usb2: { key: "w:usb2", value: sig.usb2 },
15693
- usb3: { key: "w:usb3", value: sig.usb3 },
15694
- csb0: { key: "w:csb0", value: sig.csb0 },
15695
- csb1: { key: "w:csb1", value: sig.csb1 }
15696
- }
15697
- })
15698
- ] : [],
15699
- // http://www.datypic.com/sc/ooxml/e-w_embedRegular-1.html
15700
- ...embedRegular ? [createFontRelationship(embedRegular, "w:embedRegular")] : [],
15701
- // http://www.datypic.com/sc/ooxml/e-w_embedBold-1.html
15702
- ...embedBold ? [createFontRelationship(embedBold, "w:embedBold")] : [],
15703
- // http://www.datypic.com/sc/ooxml/e-w_embedItalic-1.html
15704
- ...embedItalic ? [createFontRelationship(embedItalic, "w:embedItalic")] : [],
15705
- // http://www.datypic.com/sc/ooxml/e-w_embedBoldItalic-1.html
15706
- ...embedBoldItalic ? [createFontRelationship(embedBoldItalic, "w:embedBoldItalic")] : []
15707
- ]
15708
- })
15709
- );
16030
+ }) => new BuilderElement({
16031
+ name: "w:font",
16032
+ attributes: {
16033
+ name: { key: "w:name", value: name }
16034
+ },
16035
+ children: [
16036
+ // http://www.datypic.com/sc/ooxml/e-w_altName-1.html
16037
+ ...altName ? [createStringElement("w:altName", altName)] : [],
16038
+ // http://www.datypic.com/sc/ooxml/e-w_panose1-1.html
16039
+ ...panose1 ? [createStringElement("w:panose1", panose1)] : [],
16040
+ // http://www.datypic.com/sc/ooxml/e-w_charset-1.html
16041
+ ...charset ? [createStringElement("w:charset", charset)] : [],
16042
+ // http://www.datypic.com/sc/ooxml/e-w_family-1.html
16043
+ ...[createStringElement("w:family", family)],
16044
+ // http://www.datypic.com/sc/ooxml/e-w_notTrueType-1.html
16045
+ ...notTrueType ? [new OnOffElement("w:notTrueType", notTrueType)] : [],
16046
+ ...[createStringElement("w:pitch", pitch)],
16047
+ // http://www.datypic.com/sc/ooxml/e-w_sig-1.html
16048
+ ...sig ? [
16049
+ new BuilderElement({
16050
+ name: "w:sig",
16051
+ attributes: {
16052
+ usb0: { key: "w:usb0", value: sig.usb0 },
16053
+ usb1: { key: "w:usb1", value: sig.usb1 },
16054
+ usb2: { key: "w:usb2", value: sig.usb2 },
16055
+ usb3: { key: "w:usb3", value: sig.usb3 },
16056
+ csb0: { key: "w:csb0", value: sig.csb0 },
16057
+ csb1: { key: "w:csb1", value: sig.csb1 }
16058
+ }
16059
+ })
16060
+ ] : [],
16061
+ // http://www.datypic.com/sc/ooxml/e-w_embedRegular-1.html
16062
+ ...embedRegular ? [createFontRelationship(embedRegular, "w:embedRegular")] : [],
16063
+ // http://www.datypic.com/sc/ooxml/e-w_embedBold-1.html
16064
+ ...embedBold ? [createFontRelationship(embedBold, "w:embedBold")] : [],
16065
+ // http://www.datypic.com/sc/ooxml/e-w_embedItalic-1.html
16066
+ ...embedItalic ? [createFontRelationship(embedItalic, "w:embedItalic")] : [],
16067
+ // http://www.datypic.com/sc/ooxml/e-w_embedBoldItalic-1.html
16068
+ ...embedBoldItalic ? [createFontRelationship(embedBoldItalic, "w:embedBoldItalic")] : []
16069
+ ]
16070
+ });
15710
16071
  const createRegularFont = ({
15711
16072
  name,
15712
16073
  index,
@@ -15892,7 +16253,9 @@ class FootnoteRefRun extends Run {
15892
16253
  }
15893
16254
  }
15894
16255
  const FootnoteType = {
16256
+ /** Separator line between body text and footnotes */
15895
16257
  SEPERATOR: "separator",
16258
+ /** Continuation separator for footnotes spanning pages */
15896
16259
  CONTINUATION_SEPERATOR: "continuationSeparator"
15897
16260
  };
15898
16261
  class Footnote extends XmlComponent {
@@ -16014,6 +16377,12 @@ class FootNotes extends XmlComponent {
16014
16377
  });
16015
16378
  this.root.push(spacing);
16016
16379
  }
16380
+ /**
16381
+ * Creates and adds a new footnote to the collection.
16382
+ *
16383
+ * @param id - Unique numeric identifier for the footnote
16384
+ * @param paragraph - Array of paragraphs that make up the footnote content
16385
+ */
16017
16386
  createFootNote(id, paragraph) {
16018
16387
  const footnote = new Footnote({
16019
16388
  id,
@@ -16153,77 +16522,151 @@ class Media {
16153
16522
  __publicField(this, "map");
16154
16523
  this.map = /* @__PURE__ */ new Map();
16155
16524
  }
16525
+ /**
16526
+ * Adds an image to the media collection.
16527
+ *
16528
+ * @param key - Unique identifier for this image
16529
+ * @param mediaData - Complete image data including file name, transformation, and raw data
16530
+ */
16156
16531
  addImage(key, mediaData) {
16157
16532
  this.map.set(key, mediaData);
16158
16533
  }
16534
+ /**
16535
+ * Gets all images as an array.
16536
+ *
16537
+ * @returns Read-only array of all media data in the collection
16538
+ */
16159
16539
  get Array() {
16160
16540
  return Array.from(this.map.values());
16161
16541
  }
16162
16542
  }
16163
16543
  const WORKAROUND2 = "";
16164
16544
  const LevelFormat = {
16545
+ /** Decimal numbering (1, 2, 3...). */
16165
16546
  DECIMAL: "decimal",
16547
+ /** Uppercase roman numerals (I, II, III...). */
16166
16548
  UPPER_ROMAN: "upperRoman",
16549
+ /** Lowercase roman numerals (i, ii, iii...). */
16167
16550
  LOWER_ROMAN: "lowerRoman",
16551
+ /** Uppercase letters (A, B, C...). */
16168
16552
  UPPER_LETTER: "upperLetter",
16553
+ /** Lowercase letters (a, b, c...). */
16169
16554
  LOWER_LETTER: "lowerLetter",
16555
+ /** Ordinal numbers (1st, 2nd, 3rd...). */
16170
16556
  ORDINAL: "ordinal",
16557
+ /** Cardinal text (one, two, three...). */
16171
16558
  CARDINAL_TEXT: "cardinalText",
16559
+ /** Ordinal text (first, second, third...). */
16172
16560
  ORDINAL_TEXT: "ordinalText",
16561
+ /** Hexadecimal numbering. */
16173
16562
  HEX: "hex",
16563
+ /** Chicago Manual of Style numbering. */
16174
16564
  CHICAGO: "chicago",
16565
+ /** Ideograph digital numbering. */
16175
16566
  IDEOGRAPH__DIGITAL: "ideographDigital",
16567
+ /** Japanese counting system. */
16176
16568
  JAPANESE_COUNTING: "japaneseCounting",
16569
+ /** Japanese aiueo ordering. */
16177
16570
  AIUEO: "aiueo",
16571
+ /** Japanese iroha ordering. */
16178
16572
  IROHA: "iroha",
16573
+ /** Full-width decimal numbering. */
16179
16574
  DECIMAL_FULL_WIDTH: "decimalFullWidth",
16575
+ /** Half-width decimal numbering. */
16180
16576
  DECIMAL_HALF_WIDTH: "decimalHalfWidth",
16577
+ /** Japanese legal numbering. */
16181
16578
  JAPANESE_LEGAL: "japaneseLegal",
16579
+ /** Japanese digital ten thousand numbering. */
16182
16580
  JAPANESE_DIGITAL_TEN_THOUSAND: "japaneseDigitalTenThousand",
16581
+ /** Decimal numbers enclosed in circles. */
16183
16582
  DECIMAL_ENCLOSED_CIRCLE: "decimalEnclosedCircle",
16583
+ /** Full-width decimal numbering variant 2. */
16184
16584
  DECIMAL_FULL_WIDTH2: "decimalFullWidth2",
16585
+ /** Full-width aiueo ordering. */
16185
16586
  AIUEO_FULL_WIDTH: "aiueoFullWidth",
16587
+ /** Full-width iroha ordering. */
16186
16588
  IROHA_FULL_WIDTH: "irohaFullWidth",
16589
+ /** Decimal with leading zeros. */
16187
16590
  DECIMAL_ZERO: "decimalZero",
16591
+ /** Bullet points. */
16188
16592
  BULLET: "bullet",
16593
+ /** Korean ganada ordering. */
16189
16594
  GANADA: "ganada",
16595
+ /** Korean chosung ordering. */
16190
16596
  CHOSUNG: "chosung",
16597
+ /** Decimal enclosed with fullstop. */
16191
16598
  DECIMAL_ENCLOSED_FULLSTOP: "decimalEnclosedFullstop",
16599
+ /** Decimal enclosed in parentheses. */
16192
16600
  DECIMAL_ENCLOSED_PARENTHESES: "decimalEnclosedParen",
16601
+ /** Decimal enclosed in circles (Chinese). */
16193
16602
  DECIMAL_ENCLOSED_CIRCLE_CHINESE: "decimalEnclosedCircleChinese",
16603
+ /** Ideograph enclosed in circles. */
16194
16604
  IDEOGRAPH_ENCLOSED_CIRCLE: "ideographEnclosedCircle",
16605
+ /** Traditional ideograph numbering. */
16195
16606
  IDEOGRAPH_TRADITIONAL: "ideographTraditional",
16607
+ /** Ideograph zodiac numbering. */
16196
16608
  IDEOGRAPH_ZODIAC: "ideographZodiac",
16609
+ /** Traditional ideograph zodiac numbering. */
16197
16610
  IDEOGRAPH_ZODIAC_TRADITIONAL: "ideographZodiacTraditional",
16611
+ /** Taiwanese counting system. */
16198
16612
  TAIWANESE_COUNTING: "taiwaneseCounting",
16613
+ /** Traditional ideograph legal numbering. */
16199
16614
  IDEOGRAPH_LEGAL_TRADITIONAL: "ideographLegalTraditional",
16615
+ /** Taiwanese counting thousand system. */
16200
16616
  TAIWANESE_COUNTING_THOUSAND: "taiwaneseCountingThousand",
16617
+ /** Taiwanese digital numbering. */
16201
16618
  TAIWANESE_DIGITAL: "taiwaneseDigital",
16619
+ /** Chinese counting system. */
16202
16620
  CHINESE_COUNTING: "chineseCounting",
16621
+ /** Simplified Chinese legal numbering. */
16203
16622
  CHINESE_LEGAL_SIMPLIFIED: "chineseLegalSimplified",
16623
+ /** Chinese counting thousand system. */
16204
16624
  CHINESE_COUNTING_THOUSAND: "chineseCountingThousand",
16625
+ /** Korean digital numbering. */
16205
16626
  KOREAN_DIGITAL: "koreanDigital",
16627
+ /** Korean counting system. */
16206
16628
  KOREAN_COUNTING: "koreanCounting",
16629
+ /** Korean legal numbering. */
16207
16630
  KOREAN_LEGAL: "koreanLegal",
16631
+ /** Korean digital numbering variant 2. */
16208
16632
  KOREAN_DIGITAL2: "koreanDigital2",
16633
+ /** Vietnamese counting system. */
16209
16634
  VIETNAMESE_COUNTING: "vietnameseCounting",
16635
+ /** Russian lowercase numbering. */
16210
16636
  RUSSIAN_LOWER: "russianLower",
16637
+ /** Russian uppercase numbering. */
16211
16638
  RUSSIAN_UPPER: "russianUpper",
16639
+ /** No numbering. */
16212
16640
  NONE: "none",
16641
+ /** Number enclosed in dashes. */
16213
16642
  NUMBER_IN_DASH: "numberInDash",
16643
+ /** Hebrew numbering variant 1. */
16214
16644
  HEBREW1: "hebrew1",
16645
+ /** Hebrew numbering variant 2. */
16215
16646
  HEBREW2: "hebrew2",
16647
+ /** Arabic alpha numbering. */
16216
16648
  ARABIC_ALPHA: "arabicAlpha",
16649
+ /** Arabic abjad numbering. */
16217
16650
  ARABIC_ABJAD: "arabicAbjad",
16651
+ /** Hindi vowels. */
16218
16652
  HINDI_VOWELS: "hindiVowels",
16653
+ /** Hindi consonants. */
16219
16654
  HINDI_CONSONANTS: "hindiConsonants",
16655
+ /** Hindi numbers. */
16220
16656
  HINDI_NUMBERS: "hindiNumbers",
16657
+ /** Hindi counting system. */
16221
16658
  HINDI_COUNTING: "hindiCounting",
16659
+ /** Thai letters. */
16222
16660
  THAI_LETTERS: "thaiLetters",
16661
+ /** Thai numbers. */
16223
16662
  THAI_NUMBERS: "thaiNumbers",
16663
+ /** Thai counting system. */
16224
16664
  THAI_COUNTING: "thaiCounting",
16665
+ /** Thai Baht text. */
16225
16666
  BAHT_TEXT: "bahtText",
16667
+ /** Dollar text. */
16226
16668
  DOLLAR_TEXT: "dollarText",
16669
+ /** Custom numbering format. */
16227
16670
  CUSTOM: "custom"
16228
16671
  };
16229
16672
  class LevelAttributes extends XmlAttributeComponent {
@@ -16266,8 +16709,11 @@ class LevelJc extends XmlComponent {
16266
16709
  }
16267
16710
  }
16268
16711
  const LevelSuffix = {
16712
+ /** No separator after the numbering. */
16269
16713
  NOTHING: "nothing",
16714
+ /** Space character after the numbering. */
16270
16715
  SPACE: "space",
16716
+ /** Tab character after the numbering. */
16271
16717
  TAB: "tab"
16272
16718
  };
16273
16719
  class Suffix extends XmlComponent {
@@ -16286,6 +16732,12 @@ class IsLegalNumberingStyle extends XmlComponent {
16286
16732
  }
16287
16733
  }
16288
16734
  class LevelBase extends XmlComponent {
16735
+ /**
16736
+ * Creates a new numbering level.
16737
+ *
16738
+ * @param options - Level configuration options
16739
+ * @throws Error if level is greater than 9 (Word limitation)
16740
+ */
16289
16741
  constructor({
16290
16742
  level,
16291
16743
  format,
@@ -16331,12 +16783,16 @@ class LevelBase extends XmlComponent {
16331
16783
  }
16332
16784
  }
16333
16785
  class Level extends LevelBase {
16334
- // This is the level that sits under abstractNum. We make a
16335
- // handful of properties required
16786
+ // This is the level that sits under abstractNum
16336
16787
  }
16337
16788
  class LevelForOverride extends LevelBase {
16338
16789
  }
16339
16790
  class MultiLevelType extends XmlComponent {
16791
+ /**
16792
+ * Creates a new multi-level type specification.
16793
+ *
16794
+ * @param value - The multi-level type: "singleLevel", "multilevel", or "hybridMultilevel"
16795
+ */
16340
16796
  constructor(value) {
16341
16797
  super("w:multiLevelType");
16342
16798
  this.root.push(
@@ -16356,8 +16812,15 @@ class AbstractNumberingAttributes extends XmlAttributeComponent {
16356
16812
  }
16357
16813
  }
16358
16814
  class AbstractNumbering extends XmlComponent {
16815
+ /**
16816
+ * Creates a new abstract numbering definition.
16817
+ *
16818
+ * @param id - Unique identifier for this abstract numbering definition
16819
+ * @param levelOptions - Array of level definitions (up to 9 levels)
16820
+ */
16359
16821
  constructor(id, levelOptions) {
16360
16822
  super("w:abstractNum");
16823
+ /** The unique identifier for this abstract numbering definition. */
16361
16824
  __publicField(this, "id");
16362
16825
  this.root.push(
16363
16826
  new AbstractNumberingAttributes({
@@ -16389,10 +16852,18 @@ class NumAttributes extends XmlAttributeComponent {
16389
16852
  }
16390
16853
  }
16391
16854
  class ConcreteNumbering extends XmlComponent {
16855
+ /**
16856
+ * Creates a new concrete numbering instance.
16857
+ *
16858
+ * @param options - Configuration options for the numbering instance
16859
+ */
16392
16860
  constructor(options) {
16393
16861
  super("w:num");
16862
+ /** The unique identifier for this numbering instance. */
16394
16863
  __publicField(this, "numId");
16864
+ /** The reference name for this numbering instance. */
16395
16865
  __publicField(this, "reference");
16866
+ /** The instance number for tracking multiple uses. */
16396
16867
  __publicField(this, "instance");
16397
16868
  this.numId = options.numId;
16398
16869
  this.reference = options.reference;
@@ -16417,6 +16888,12 @@ class LevelOverrideAttributes extends XmlAttributeComponent {
16417
16888
  }
16418
16889
  }
16419
16890
  class LevelOverride extends XmlComponent {
16891
+ /**
16892
+ * Creates a new level override.
16893
+ *
16894
+ * @param levelNum - The level number to override (0-8)
16895
+ * @param start - Optional starting number for the level
16896
+ */
16420
16897
  constructor(levelNum, start) {
16421
16898
  super("w:lvlOverride");
16422
16899
  this.root.push(new LevelOverrideAttributes({ ilvl: levelNum }));
@@ -16432,12 +16909,25 @@ class StartOverrideAttributes extends XmlAttributeComponent {
16432
16909
  }
16433
16910
  }
16434
16911
  class StartOverride extends XmlComponent {
16912
+ /**
16913
+ * Creates a new start override.
16914
+ *
16915
+ * @param start - The starting number
16916
+ */
16435
16917
  constructor(start) {
16436
16918
  super("w:startOverride");
16437
16919
  this.root.push(new StartOverrideAttributes({ val: start }));
16438
16920
  }
16439
16921
  }
16440
16922
  class Numbering extends XmlComponent {
16923
+ /**
16924
+ * Creates a new numbering definition collection.
16925
+ *
16926
+ * Initializes the numbering with a default bullet list configuration and
16927
+ * any custom numbering configurations provided in the options.
16928
+ *
16929
+ * @param options - Configuration options for numbering definitions
16930
+ */
16441
16931
  constructor(options) {
16442
16932
  super("w:numbering");
16443
16933
  __publicField(this, "abstractNumberingMap", /* @__PURE__ */ new Map());
@@ -16574,6 +17064,14 @@ class Numbering extends XmlComponent {
16574
17064
  this.referenceConfigMap.set(con.reference, con.levels);
16575
17065
  }
16576
17066
  }
17067
+ /**
17068
+ * Prepares the numbering definitions for XML serialization.
17069
+ *
17070
+ * Adds all abstract and concrete numbering definitions to the XML tree.
17071
+ *
17072
+ * @param context - The XML context
17073
+ * @returns The prepared XML object
17074
+ */
16577
17075
  prepForXml(context) {
16578
17076
  for (const numbering of this.abstractNumberingMap.values()) {
16579
17077
  this.root.push(numbering);
@@ -16583,6 +17081,16 @@ class Numbering extends XmlComponent {
16583
17081
  }
16584
17082
  return super.prepForXml(context);
16585
17083
  }
17084
+ /**
17085
+ * Creates a concrete numbering instance from an abstract numbering definition.
17086
+ *
17087
+ * This method creates a new concrete numbering instance that references an
17088
+ * abstract numbering definition. It's used internally when paragraphs reference
17089
+ * numbering configurations.
17090
+ *
17091
+ * @param reference - The reference name of the abstract numbering definition
17092
+ * @param instance - The instance number for this concrete numbering
17093
+ */
16586
17094
  createConcreteNumberingInstance(reference, instance) {
16587
17095
  const abstractNumbering = this.abstractNumberingMap.get(reference);
16588
17096
  if (!abstractNumbering) {
@@ -16611,9 +17119,19 @@ class Numbering extends XmlComponent {
16611
17119
  };
16612
17120
  this.concreteNumberingMap.set(fullReference, new ConcreteNumbering(concreteNumberingSettings));
16613
17121
  }
17122
+ /**
17123
+ * Gets all concrete numbering instances.
17124
+ *
17125
+ * @returns An array of all concrete numbering instances
17126
+ */
16614
17127
  get ConcreteNumbering() {
16615
17128
  return Array.from(this.concreteNumberingMap.values());
16616
17129
  }
17130
+ /**
17131
+ * Gets all reference configurations.
17132
+ *
17133
+ * @returns An array of all numbering reference configurations
17134
+ */
16617
17135
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
16618
17136
  get ReferenceConfig() {
16619
17137
  return Array.from(this.referenceConfigMap.values());
@@ -17205,27 +17723,29 @@ class DocumentDefaults extends XmlComponent {
17205
17723
  }
17206
17724
  class ExternalStylesFactory {
17207
17725
  /**
17208
- * Creates new Style based on the given styles.
17209
- * Parses the styles and convert them to XmlComponent.
17726
+ * Creates new Styles based on the given XML data.
17727
+ *
17728
+ * Parses the styles XML and converts them to XmlComponent instances.
17729
+ *
17210
17730
  * Example content from styles.xml:
17211
- * <?xml version="1.0">
17731
+ * ```xml
17732
+ * <?xml version="1.0"?>
17212
17733
  * <w:styles xmlns:mc="some schema" ...>
17213
- *
17214
17734
  * <w:style w:type="paragraph" w:styleId="Heading1">
17215
- * <w:name w:val="heading 1"/>
17216
- * .....
17735
+ * <w:name w:val="heading 1"/>
17736
+ * ...
17217
17737
  * </w:style>
17218
- *
17219
17738
  * <w:style w:type="paragraph" w:styleId="Heading2">
17220
- * <w:name w:val="heading 2"/>
17221
- * .....
17739
+ * <w:name w:val="heading 2"/>
17740
+ * ...
17222
17741
  * </w:style>
17223
- *
17224
- * <w:docDefaults>Or any other element will be parsed to</w:docDefaults>
17225
- *
17742
+ * <w:docDefaults>...</w:docDefaults>
17226
17743
  * </w:styles>
17744
+ * ```
17227
17745
  *
17228
- * @param externalStyles context from styles.xml
17746
+ * @param xmlData - XML string containing styles data from styles.xml
17747
+ * @returns Styles object containing all parsed styles
17748
+ * @throws Error if styles element cannot be found in the XML
17229
17749
  */
17230
17750
  newInstance(xmlData) {
17231
17751
  const xmlObj = libExports.xml2js(xmlData, { compact: false });
@@ -17239,11 +17759,10 @@ class ExternalStylesFactory {
17239
17759
  throw new Error("can not find styles element");
17240
17760
  }
17241
17761
  const stylesElements = stylesXmlElement.elements || [];
17242
- const importedStyle = new Styles({
17762
+ return {
17243
17763
  initialStyles: new ImportedRootElementAttributes(stylesXmlElement.attributes),
17244
17764
  importedStyles: stylesElements.map((childElm) => convertToXmlComponent(childElm))
17245
- });
17246
- return importedStyle;
17765
+ };
17247
17766
  }
17248
17767
  }
17249
17768
  class DefaultStylesFactory {
@@ -17328,7 +17847,7 @@ class File {
17328
17847
  __publicField(this, "styles");
17329
17848
  __publicField(this, "comments");
17330
17849
  __publicField(this, "fontWrapper");
17331
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
17850
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
17332
17851
  this.coreProperties = new CoreProperties(__spreadProps(__spreadValues({}, options), {
17333
17852
  creator: (_a = options.creator) != null ? _a : "Un-named",
17334
17853
  revision: (_b = options.revision) != null ? _b : 1,
@@ -17358,8 +17877,13 @@ class File {
17358
17877
  });
17359
17878
  this.media = new Media();
17360
17879
  if (options.externalStyles !== void 0) {
17361
- const stylesFactory = new ExternalStylesFactory();
17362
- this.styles = stylesFactory.newInstance(options.externalStyles);
17880
+ const defaultFactory = new DefaultStylesFactory();
17881
+ const defaultStyles = defaultFactory.newInstance((_l = options.styles) == null ? void 0 : _l.default);
17882
+ const externalFactory = new ExternalStylesFactory();
17883
+ const externalStyles = externalFactory.newInstance(options.externalStyles);
17884
+ this.styles = new Styles(__spreadProps(__spreadValues({}, externalStyles), {
17885
+ importedStyles: [...defaultStyles.importedStyles, ...externalStyles.importedStyles]
17886
+ }));
17363
17887
  } else if (options.styles) {
17364
17888
  const stylesFactory = new DefaultStylesFactory();
17365
17889
  const defaultStyles = stylesFactory.newInstance(options.styles.default);
@@ -17377,7 +17901,7 @@ class File {
17377
17901
  this.footnotesWrapper.View.createFootNote(parseFloat(key), options.footnotes[key].children);
17378
17902
  }
17379
17903
  }
17380
- this.fontWrapper = new FontWrapper((_l = options.fonts) != null ? _l : []);
17904
+ this.fontWrapper = new FontWrapper((_m = options.fonts) != null ? _m : []);
17381
17905
  }
17382
17906
  addSection({ headers = {}, footers = {}, children, properties }) {
17383
17907
  this.documentWrapper.View.Body.addSection(__spreadProps(__spreadValues({}, properties), {
@@ -17626,7 +18150,9 @@ class TableOfContents extends FileChild {
17626
18150
  }
17627
18151
  class StyleLevel {
17628
18152
  constructor(styleName, level) {
18153
+ /** The name of the paragraph style. */
17629
18154
  __publicField(this, "styleName");
18155
+ /** The TOC level (1-9) to assign to this style. */
17630
18156
  __publicField(this, "level");
17631
18157
  this.styleName = styleName;
17632
18158
  this.level = level;
@@ -17663,6 +18189,11 @@ class FootnoteReference extends XmlComponent {
17663
18189
  }
17664
18190
  }
17665
18191
  class FootnoteReferenceRun extends Run {
18192
+ /**
18193
+ * Creates a new footnote reference run.
18194
+ *
18195
+ * @param id - Unique identifier linking to the footnote content
18196
+ */
17666
18197
  constructor(id) {
17667
18198
  super({ style: "FootnoteReference" });
17668
18199
  this.root.push(new FootnoteReference(id));
@@ -17935,11 +18466,11 @@ var hasRequiredJszip_min;
17935
18466
  function requireJszip_min() {
17936
18467
  if (hasRequiredJszip_min) return jszip_min.exports;
17937
18468
  hasRequiredJszip_min = 1;
17938
- (function(module2, exports2) {
17939
- !function(e) {
18469
+ (function(module2, exports$1) {
18470
+ !(function(e) {
17940
18471
  module2.exports = e();
17941
- }(function() {
17942
- return function s(a, o, h) {
18472
+ })(function() {
18473
+ return (function s(a, o, h) {
17943
18474
  function u(r, e2) {
17944
18475
  if (!o[r]) {
17945
18476
  if (!a[r]) {
@@ -17959,7 +18490,7 @@ function requireJszip_min() {
17959
18490
  }
17960
18491
  for (var l = "function" == typeof commonjsRequire && commonjsRequire, e = 0; e < h.length; e++) u(h[e]);
17961
18492
  return u;
17962
- }({ 1: [function(e, t, r) {
18493
+ })({ 1: [function(e, t, r) {
17963
18494
  var d = e("./utils"), c = e("./support"), p = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
17964
18495
  r.encode = function(e2) {
17965
18496
  for (var t2, r2, n, i, s, a, o, h = [], u = 0, l = e2.length, f = l, c2 = "string" !== d.getTypeOf(e2); u < e2.length; ) f = l - u, n = c2 ? (t2 = e2[u++], r2 = u < l ? e2[u++] : 0, u < l ? e2[u++] : 0) : (t2 = e2.charCodeAt(u++), r2 = u < l ? e2.charCodeAt(u++) : 0, u < l ? e2.charCodeAt(u++) : 0), i = t2 >> 2, s = (3 & t2) << 4 | r2 >> 4, a = 1 < f ? (15 & r2) << 2 | n >> 6 : 64, o = 2 < f ? 63 & n : 64, h.push(p.charAt(i) + p.charAt(s) + p.charAt(a) + p.charAt(o));
@@ -17996,26 +18527,26 @@ function requireJszip_min() {
17996
18527
  } }, r.DEFLATE = e("./flate");
17997
18528
  }, { "./flate": 7, "./stream/GenericWorker": 28 }], 4: [function(e, t, r) {
17998
18529
  var n = e("./utils");
17999
- var o = function() {
18530
+ var o = (function() {
18000
18531
  for (var e2, t2 = [], r2 = 0; r2 < 256; r2++) {
18001
18532
  e2 = r2;
18002
18533
  for (var n2 = 0; n2 < 8; n2++) e2 = 1 & e2 ? 3988292384 ^ e2 >>> 1 : e2 >>> 1;
18003
18534
  t2[r2] = e2;
18004
18535
  }
18005
18536
  return t2;
18006
- }();
18537
+ })();
18007
18538
  t.exports = function(e2, t2) {
18008
- return void 0 !== e2 && e2.length ? "string" !== n.getTypeOf(e2) ? function(e3, t3, r2, n2) {
18539
+ return void 0 !== e2 && e2.length ? "string" !== n.getTypeOf(e2) ? (function(e3, t3, r2, n2) {
18009
18540
  var i = o, s = n2 + r2;
18010
18541
  e3 ^= -1;
18011
18542
  for (var a = n2; a < s; a++) e3 = e3 >>> 8 ^ i[255 & (e3 ^ t3[a])];
18012
18543
  return -1 ^ e3;
18013
- }(0 | t2, e2, e2.length, 0) : function(e3, t3, r2, n2) {
18544
+ })(0 | t2, e2, e2.length, 0) : (function(e3, t3, r2, n2) {
18014
18545
  var i = o, s = n2 + r2;
18015
18546
  e3 ^= -1;
18016
18547
  for (var a = n2; a < s; a++) e3 = e3 >>> 8 ^ i[255 & (e3 ^ t3.charCodeAt(a))];
18017
18548
  return -1 ^ e3;
18018
- }(0 | t2, e2, e2.length, 0) : 0;
18549
+ })(0 | t2, e2, e2.length, 0) : 0;
18019
18550
  };
18020
18551
  }, { "./utils": 32 }], 5: [function(e, t, r) {
18021
18552
  r.base64 = false, r.binary = false, r.dir = false, r.createFolders = true, r.date = null, r.compression = null, r.compressionOptions = null, r.comment = null, r.unixPermissions = null, r.dosPermissions = null;
@@ -18056,12 +18587,12 @@ function requireJszip_min() {
18056
18587
  var S = 0;
18057
18588
  t2 && (S |= 8), l || !_ && !g || (S |= 2048);
18058
18589
  var z = 0, C = 0;
18059
- w && (z |= 16), "UNIX" === i2 ? (C = 798, z |= function(e3, t3) {
18590
+ w && (z |= 16), "UNIX" === i2 ? (C = 798, z |= (function(e3, t3) {
18060
18591
  var r3 = e3;
18061
18592
  return e3 || (r3 = t3 ? 16893 : 33204), (65535 & r3) << 16;
18062
- }(h.unixPermissions, w)) : (C = 20, z |= function(e3) {
18593
+ })(h.unixPermissions, w)) : (C = 20, z |= (function(e3) {
18063
18594
  return 63 & (e3 || 0);
18064
- }(h.dosPermissions)), a = k.getUTCHours(), a <<= 6, a |= k.getUTCMinutes(), a <<= 5, a |= k.getUTCSeconds() / 2, o = k.getUTCFullYear() - 1980, o <<= 4, o |= k.getUTCMonth() + 1, o <<= 5, o |= k.getUTCDate(), _ && (v = A(1, 1) + A(B(f), 4) + c, b += "up" + A(v.length, 2) + v), g && (y = A(1, 1) + A(B(p), 4) + m, b += "uc" + A(y.length, 2) + y);
18595
+ })(h.dosPermissions)), a = k.getUTCHours(), a <<= 6, a |= k.getUTCMinutes(), a <<= 5, a |= k.getUTCSeconds() / 2, o = k.getUTCFullYear() - 1980, o <<= 4, o |= k.getUTCMonth() + 1, o <<= 5, o |= k.getUTCDate(), _ && (v = A(1, 1) + A(B(f), 4) + c, b += "up" + A(v.length, 2) + v), g && (y = A(1, 1) + A(B(p), 4) + m, b += "uc" + A(y.length, 2) + y);
18065
18596
  var E = "";
18066
18597
  return E += "\n\0", E += A(S, 2), E += u.magic, E += A(a, 2), E += A(o, 2), E += A(x.crc32, 4), E += A(x.compressedSize, 4), E += A(x.uncompressedSize, 4), E += A(f.length, 2), E += A(b.length, 2), { fileRecord: R.LOCAL_FILE_HEADER + E + f + b, dirRecord: R.CENTRAL_FILE_HEADER + A(C, 2) + E + A(p.length, 2) + "\0\0\0\0" + A(z, 4) + A(n2, 4) + f + b + p };
18067
18598
  }
@@ -18082,17 +18613,17 @@ function requireJszip_min() {
18082
18613
  }, s.prototype.closedSource = function(e2) {
18083
18614
  this.accumulate = false;
18084
18615
  var t2 = this.streamFiles && !e2.file.dir, r2 = n(e2, t2, true, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);
18085
- if (this.dirRecords.push(r2.dirRecord), t2) this.push({ data: function(e3) {
18616
+ if (this.dirRecords.push(r2.dirRecord), t2) this.push({ data: (function(e3) {
18086
18617
  return R.DATA_DESCRIPTOR + A(e3.crc32, 4) + A(e3.compressedSize, 4) + A(e3.uncompressedSize, 4);
18087
- }(e2), meta: { percent: 100 } });
18618
+ })(e2), meta: { percent: 100 } });
18088
18619
  else for (this.push({ data: r2.fileRecord, meta: { percent: 0 } }); this.contentBuffer.length; ) this.push(this.contentBuffer.shift());
18089
18620
  this.currentFile = null;
18090
18621
  }, s.prototype.flush = function() {
18091
18622
  for (var e2 = this.bytesWritten, t2 = 0; t2 < this.dirRecords.length; t2++) this.push({ data: this.dirRecords[t2], meta: { percent: 100 } });
18092
- var r2 = this.bytesWritten - e2, n2 = function(e3, t3, r3, n3, i2) {
18623
+ var r2 = this.bytesWritten - e2, n2 = (function(e3, t3, r3, n3, i2) {
18093
18624
  var s2 = I.transformTo("string", i2(n3));
18094
18625
  return R.CENTRAL_DIRECTORY_END + "\0\0\0\0" + A(e3, 2) + A(e3, 2) + A(t3, 4) + A(r3, 4) + A(s2.length, 2) + s2;
18095
- }(this.dirRecords.length, r2, e2, this.zipComment, this.encodeFileName);
18626
+ })(this.dirRecords.length, r2, e2, this.zipComment, this.encodeFileName);
18096
18627
  this.push({ data: n2, meta: { percent: 100 } });
18097
18628
  }, s.prototype.prepareNextSource = function() {
18098
18629
  this.previous = this._sources.shift(), this.openedSource(this.previous.streamInfo), this.isPaused ? this.previous.pause() : this.previous.resume();
@@ -18127,11 +18658,11 @@ function requireJszip_min() {
18127
18658
  try {
18128
18659
  e2.forEach(function(e3, t3) {
18129
18660
  h++;
18130
- var r2 = function(e4, t4) {
18661
+ var r2 = (function(e4, t4) {
18131
18662
  var r3 = e4 || t4, n3 = u[r3];
18132
18663
  if (!n3) throw new Error(r3 + " is not a valid compression method !");
18133
18664
  return n3;
18134
- }(t3.options.compression, a.compression), n2 = t3.options.compressionOptions || a.compressionOptions || {}, i = t3.dir, s = t3.date;
18665
+ })(t3.options.compression, a.compression), n2 = t3.options.compressionOptions || a.compressionOptions || {}, i = t3.dir, s = t3.date;
18135
18666
  t3._compressWorker(r2, n2).withStreamInfo("file", { name: e3, dir: i, date: s, comment: t3.comment || "", unixPermissions: t3.unixPermissions, dosPermissions: t3.dosPermissions }).pipe(o);
18136
18667
  }), o.entriesCount = h;
18137
18668
  } catch (e3) {
@@ -18532,7 +19063,7 @@ function requireJszip_min() {
18532
19063
  n2 = [], r2(e3);
18533
19064
  }).on("end", function() {
18534
19065
  try {
18535
- var e3 = function(e4, t3, r3) {
19066
+ var e3 = (function(e4, t3, r3) {
18536
19067
  switch (e4) {
18537
19068
  case "blob":
18538
19069
  return h.newBlob(h.transformTo("arraybuffer", t3), r3);
@@ -18541,7 +19072,7 @@ function requireJszip_min() {
18541
19072
  default:
18542
19073
  return h.transformTo(e4, t3);
18543
19074
  }
18544
- }(s2, function(e4, t3) {
19075
+ })(s2, (function(e4, t3) {
18545
19076
  var r3, n3 = 0, i3 = null, s3 = 0;
18546
19077
  for (r3 = 0; r3 < t3.length; r3++) s3 += t3[r3].length;
18547
19078
  switch (e4) {
@@ -18557,7 +19088,7 @@ function requireJszip_min() {
18557
19088
  default:
18558
19089
  throw new Error("concat : unsupported type '" + e4 + "'");
18559
19090
  }
18560
- }(i2, n2), a2);
19091
+ })(i2, n2), a2);
18561
19092
  t2(e3);
18562
19093
  } catch (e4) {
18563
19094
  r2(e4);
@@ -18629,14 +19160,14 @@ function requireJszip_min() {
18629
19160
  n.call(this, "utf-8 encode");
18630
19161
  }
18631
19162
  s.utf8encode = function(e2) {
18632
- return h.nodebuffer ? r.newBufferFrom(e2, "utf-8") : function(e3) {
19163
+ return h.nodebuffer ? r.newBufferFrom(e2, "utf-8") : (function(e3) {
18633
19164
  var t2, r2, n2, i2, s2, a2 = e3.length, o2 = 0;
18634
19165
  for (i2 = 0; i2 < a2; i2++) 55296 == (64512 & (r2 = e3.charCodeAt(i2))) && i2 + 1 < a2 && 56320 == (64512 & (n2 = e3.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), o2 += r2 < 128 ? 1 : r2 < 2048 ? 2 : r2 < 65536 ? 3 : 4;
18635
19166
  for (t2 = h.uint8array ? new Uint8Array(o2) : new Array(o2), i2 = s2 = 0; s2 < o2; i2++) 55296 == (64512 & (r2 = e3.charCodeAt(i2))) && i2 + 1 < a2 && 56320 == (64512 & (n2 = e3.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), r2 < 128 ? t2[s2++] = r2 : (r2 < 2048 ? t2[s2++] = 192 | r2 >>> 6 : (r2 < 65536 ? t2[s2++] = 224 | r2 >>> 12 : (t2[s2++] = 240 | r2 >>> 18, t2[s2++] = 128 | r2 >>> 12 & 63), t2[s2++] = 128 | r2 >>> 6 & 63), t2[s2++] = 128 | 63 & r2);
18636
19167
  return t2;
18637
- }(e2);
19168
+ })(e2);
18638
19169
  }, s.utf8decode = function(e2) {
18639
- return h.nodebuffer ? o.transformTo("nodebuffer", e2).toString("utf-8") : function(e3) {
19170
+ return h.nodebuffer ? o.transformTo("nodebuffer", e2).toString("utf-8") : (function(e3) {
18640
19171
  var t2, r2, n2, i2, s2 = e3.length, a2 = new Array(2 * s2);
18641
19172
  for (t2 = r2 = 0; t2 < s2; ) if ((n2 = e3[t2++]) < 128) a2[r2++] = n2;
18642
19173
  else if (4 < (i2 = u[n2])) a2[r2++] = 65533, t2 += i2 - 1;
@@ -18645,7 +19176,7 @@ function requireJszip_min() {
18645
19176
  1 < i2 ? a2[r2++] = 65533 : n2 < 65536 ? a2[r2++] = n2 : (n2 -= 65536, a2[r2++] = 55296 | n2 >> 10 & 1023, a2[r2++] = 56320 | 1023 & n2);
18646
19177
  }
18647
19178
  return a2.length !== r2 && (a2.subarray ? a2 = a2.subarray(0, r2) : a2.length = r2), o.applyFromCharCode(a2);
18648
- }(e2 = o.transformTo(h.uint8array ? "uint8array" : "array", e2));
19179
+ })(e2 = o.transformTo(h.uint8array ? "uint8array" : "array", e2));
18649
19180
  }, o.inherits(a, n), a.prototype.processChunk = function(e2) {
18650
19181
  var t2 = o.transformTo(h.uint8array ? "uint8array" : "array", e2.data);
18651
19182
  if (this.leftOver && this.leftOver.length) {
@@ -18655,11 +19186,11 @@ function requireJszip_min() {
18655
19186
  } else t2 = this.leftOver.concat(t2);
18656
19187
  this.leftOver = null;
18657
19188
  }
18658
- var n2 = function(e3, t3) {
19189
+ var n2 = (function(e3, t3) {
18659
19190
  var r3;
18660
19191
  for ((t3 = t3 || e3.length) > e3.length && (t3 = e3.length), r3 = t3 - 1; 0 <= r3 && 128 == (192 & e3[r3]); ) r3--;
18661
19192
  return r3 < 0 ? t3 : 0 === r3 ? t3 : r3 + u[e3[r3]] > t3 ? r3 : t3;
18662
- }(t2), i2 = t2;
19193
+ })(t2), i2 = t2;
18663
19194
  n2 !== t2.length && (h.uint8array ? (i2 = t2.subarray(0, n2), this.leftOver = t2.subarray(n2, t2.length)) : (i2 = t2.slice(0, n2), this.leftOver = t2.slice(n2, t2.length))), this.push({ data: s.utf8decode(i2), meta: e2.meta });
18664
19195
  }, a.prototype.flush = function() {
18665
19196
  this.leftOver && this.leftOver.length && (this.push({ data: s.utf8decode(this.leftOver), meta: {} }), this.leftOver = null);
@@ -18696,19 +19227,19 @@ function requireJszip_min() {
18696
19227
  }, stringifyByChar: function(e2) {
18697
19228
  for (var t2 = "", r2 = 0; r2 < e2.length; r2++) t2 += String.fromCharCode(e2[r2]);
18698
19229
  return t2;
18699
- }, applyCanBeUsed: { uint8array: function() {
19230
+ }, applyCanBeUsed: { uint8array: (function() {
18700
19231
  try {
18701
19232
  return o.uint8array && 1 === String.fromCharCode.apply(null, new Uint8Array(1)).length;
18702
19233
  } catch (e2) {
18703
19234
  return false;
18704
19235
  }
18705
- }(), nodebuffer: function() {
19236
+ })(), nodebuffer: (function() {
18706
19237
  try {
18707
19238
  return o.nodebuffer && 1 === String.fromCharCode.apply(null, r.allocBuffer(1)).length;
18708
19239
  } catch (e2) {
18709
19240
  return false;
18710
19241
  }
18711
- }() } };
19242
+ })() } };
18712
19243
  function s(e2) {
18713
19244
  var t2 = 65536, r2 = a.getTypeOf(e2), n2 = true;
18714
19245
  if ("uint8array" === r2 ? n2 = i.applyCanBeUsed.uint8array : "nodebuffer" === r2 && (n2 = i.applyCanBeUsed.nodebuffer), n2) for (; 1 < t2; ) try {
@@ -18801,9 +19332,9 @@ function requireJszip_min() {
18801
19332
  }) : n3;
18802
19333
  }).then(function(e3) {
18803
19334
  var t2 = a.getTypeOf(e3);
18804
- return t2 ? ("arraybuffer" === t2 ? e3 = a.transformTo("uint8array", e3) : "string" === t2 && (s2 ? e3 = h.decode(e3) : n2 && true !== i2 && (e3 = function(e4) {
19335
+ return t2 ? ("arraybuffer" === t2 ? e3 = a.transformTo("uint8array", e3) : "string" === t2 && (s2 ? e3 = h.decode(e3) : n2 && true !== i2 && (e3 = (function(e4) {
18805
19336
  return l(e4, o.uint8array ? new Uint8Array(e4.length) : new Array(e4.length));
18806
- }(e3))), e3) : u.Promise.reject(new Error("Can't read the data of '" + r2 + "'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));
19337
+ })(e3))), e3) : u.Promise.reject(new Error("Can't read the data of '" + r2 + "'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));
18807
19338
  });
18808
19339
  };
18809
19340
  }, { "./base64": 1, "./external": 6, "./nodejsUtils": 14, "./support": 30, setimmediate: 54 }], 33: [function(e, t, r) {
@@ -18870,10 +19401,10 @@ function requireJszip_min() {
18870
19401
  }, readLocalPart: function(e2) {
18871
19402
  var t2, r2;
18872
19403
  if (e2.skip(22), this.fileNameLength = e2.readInt(2), r2 = e2.readInt(2), this.fileName = e2.readData(this.fileNameLength), e2.skip(r2), -1 === this.compressedSize || -1 === this.uncompressedSize) throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");
18873
- if (null === (t2 = function(e3) {
19404
+ if (null === (t2 = (function(e3) {
18874
19405
  for (var t3 in h) if (Object.prototype.hasOwnProperty.call(h, t3) && h[t3].magic === e3) return h[t3];
18875
19406
  return null;
18876
- }(this.compressionMethod))) throw new Error("Corrupted zip : compression " + s.pretty(this.compressionMethod) + " unknown (inner file : " + s.transformTo("string", this.fileName) + ")");
19407
+ })(this.compressionMethod))) throw new Error("Corrupted zip : compression " + s.pretty(this.compressionMethod) + " unknown (inner file : " + s.transformTo("string", this.fileName) + ")");
18877
19408
  this.decompressed = new i(this.compressedSize, this.uncompressedSize, this.crc32, t2, e2.readData(this.compressedSize));
18878
19409
  }, readCentralPart: function(e2) {
18879
19410
  this.versionMadeBy = e2.readInt(2), e2.skip(2), this.bitFlag = e2.readInt(2), this.compressionMethod = e2.readString(2), this.date = e2.readDate(), this.crc32 = e2.readInt(4), this.compressedSize = e2.readInt(4), this.uncompressedSize = e2.readInt(4);
@@ -19276,14 +19807,14 @@ function requireJszip_min() {
19276
19807
  }, {}], 44: [function(e, t, r) {
19277
19808
  t.exports = { Z_NO_FLUSH: 0, Z_PARTIAL_FLUSH: 1, Z_SYNC_FLUSH: 2, Z_FULL_FLUSH: 3, Z_FINISH: 4, Z_BLOCK: 5, Z_TREES: 6, Z_OK: 0, Z_STREAM_END: 1, Z_NEED_DICT: 2, Z_ERRNO: -1, Z_STREAM_ERROR: -2, Z_DATA_ERROR: -3, Z_BUF_ERROR: -5, Z_NO_COMPRESSION: 0, Z_BEST_SPEED: 1, Z_BEST_COMPRESSION: 9, Z_DEFAULT_COMPRESSION: -1, Z_FILTERED: 1, Z_HUFFMAN_ONLY: 2, Z_RLE: 3, Z_FIXED: 4, Z_DEFAULT_STRATEGY: 0, Z_BINARY: 0, Z_TEXT: 1, Z_UNKNOWN: 2, Z_DEFLATED: 8 };
19278
19809
  }, {}], 45: [function(e, t, r) {
19279
- var o = function() {
19810
+ var o = (function() {
19280
19811
  for (var e2, t2 = [], r2 = 0; r2 < 256; r2++) {
19281
19812
  e2 = r2;
19282
19813
  for (var n = 0; n < 8; n++) e2 = 1 & e2 ? 3988292384 ^ e2 >>> 1 : e2 >>> 1;
19283
19814
  t2[r2] = e2;
19284
19815
  }
19285
19816
  return t2;
19286
- }();
19817
+ })();
19287
19818
  t.exports = function(e2, t2, r2, n) {
19288
19819
  var i = o, s = n + r2;
19289
19820
  e2 ^= -1;
@@ -19384,9 +19915,9 @@ function requireJszip_min() {
19384
19915
  }
19385
19916
  function K(e2) {
19386
19917
  var t2 = G(e2);
19387
- return t2 === m && function(e3) {
19918
+ return t2 === m && (function(e3) {
19388
19919
  e3.window_size = 2 * e3.w_size, D(e3.head), e3.max_lazy_match = h[e3.level].max_lazy, e3.good_match = h[e3.level].good_length, e3.nice_match = h[e3.level].nice_length, e3.max_chain_length = h[e3.level].max_chain, e3.strstart = 0, e3.block_start = 0, e3.lookahead = 0, e3.insert = 0, e3.match_length = e3.prev_length = x - 1, e3.match_available = 0, e3.ins_h = 0;
19389
- }(e2.state), t2;
19920
+ })(e2.state), t2;
19390
19921
  }
19391
19922
  function Y(e2, t2, r2, n2, i2, s2) {
19392
19923
  if (!e2) return _;
@@ -19453,7 +19984,7 @@ function requireJszip_min() {
19453
19984
  } else if (0 === e2.avail_in && T(t2) <= T(r2) && t2 !== f) return R(e2, -5);
19454
19985
  if (666 === n2.status && 0 !== e2.avail_in) return R(e2, -5);
19455
19986
  if (0 !== e2.avail_in || 0 !== n2.lookahead || t2 !== l && 666 !== n2.status) {
19456
- var o2 = 2 === n2.strategy ? function(e3, t3) {
19987
+ var o2 = 2 === n2.strategy ? (function(e3, t3) {
19457
19988
  for (var r3; ; ) {
19458
19989
  if (0 === e3.lookahead && (j(e3), 0 === e3.lookahead)) {
19459
19990
  if (t3 === l) return A;
@@ -19462,7 +19993,7 @@ function requireJszip_min() {
19462
19993
  if (e3.match_length = 0, r3 = u._tr_tally(e3, 0, e3.window[e3.strstart]), e3.lookahead--, e3.strstart++, r3 && (N(e3, false), 0 === e3.strm.avail_out)) return A;
19463
19994
  }
19464
19995
  return e3.insert = 0, t3 === f ? (N(e3, true), 0 === e3.strm.avail_out ? O : B) : e3.last_lit && (N(e3, false), 0 === e3.strm.avail_out) ? A : I;
19465
- }(n2, t2) : 3 === n2.strategy ? function(e3, t3) {
19996
+ })(n2, t2) : 3 === n2.strategy ? (function(e3, t3) {
19466
19997
  for (var r3, n3, i3, s3, a3 = e3.window; ; ) {
19467
19998
  if (e3.lookahead <= S) {
19468
19999
  if (j(e3), e3.lookahead <= S && t3 === l) return A;
@@ -19477,7 +20008,7 @@ function requireJszip_min() {
19477
20008
  if (e3.match_length >= x ? (r3 = u._tr_tally(e3, 1, e3.match_length - x), e3.lookahead -= e3.match_length, e3.strstart += e3.match_length, e3.match_length = 0) : (r3 = u._tr_tally(e3, 0, e3.window[e3.strstart]), e3.lookahead--, e3.strstart++), r3 && (N(e3, false), 0 === e3.strm.avail_out)) return A;
19478
20009
  }
19479
20010
  return e3.insert = 0, t3 === f ? (N(e3, true), 0 === e3.strm.avail_out ? O : B) : e3.last_lit && (N(e3, false), 0 === e3.strm.avail_out) ? A : I;
19480
- }(n2, t2) : h[n2.level].func(n2, t2);
20011
+ })(n2, t2) : h[n2.level].func(n2, t2);
19481
20012
  if (o2 !== O && o2 !== B || (n2.status = 666), o2 === A || o2 === O) return 0 === e2.avail_out && (n2.last_flush = -1), m;
19482
20013
  if (o2 === I && (1 === t2 ? u._tr_align(n2) : 5 !== t2 && (u._tr_stored_block(n2, 0, 0, false), 3 === t2 && (D(n2.head), 0 === n2.lookahead && (n2.strstart = 0, n2.block_start = 0, n2.insert = 0))), F(e2), 0 === e2.avail_out)) return n2.last_flush = -1, m;
19483
20014
  }
@@ -20086,7 +20617,7 @@ function requireJszip_min() {
20086
20617
  for (; e2.heap_len < 2; ) s2[2 * (i2 = e2.heap[++e2.heap_len] = u2 < 2 ? ++u2 : 0)] = 1, e2.depth[i2] = 0, e2.opt_len--, o2 && (e2.static_len -= a2[2 * i2 + 1]);
20087
20618
  for (t2.max_code = u2, r2 = e2.heap_len >> 1; 1 <= r2; r2--) G(e2, s2, r2);
20088
20619
  for (i2 = h2; r2 = e2.heap[1], e2.heap[1] = e2.heap[e2.heap_len--], G(e2, s2, 1), n2 = e2.heap[1], e2.heap[--e2.heap_max] = r2, e2.heap[--e2.heap_max] = n2, s2[2 * i2] = s2[2 * r2] + s2[2 * n2], e2.depth[i2] = (e2.depth[r2] >= e2.depth[n2] ? e2.depth[r2] : e2.depth[n2]) + 1, s2[2 * r2 + 1] = s2[2 * n2 + 1] = i2, e2.heap[1] = i2++, G(e2, s2, 1), 2 <= e2.heap_len; ) ;
20089
- e2.heap[--e2.heap_max] = e2.heap[1], function(e3, t3) {
20620
+ e2.heap[--e2.heap_max] = e2.heap[1], (function(e3, t3) {
20090
20621
  var r3, n3, i3, s3, a3, o3, h3 = t3.dyn_tree, u3 = t3.max_code, l2 = t3.stat_desc.static_tree, f2 = t3.stat_desc.has_stree, c2 = t3.stat_desc.extra_bits, d2 = t3.stat_desc.extra_base, p2 = t3.stat_desc.max_length, m2 = 0;
20091
20622
  for (s3 = 0; s3 <= g; s3++) e3.bl_count[s3] = 0;
20092
20623
  for (h3[2 * e3.heap[e3.heap_max] + 1] = 0, r3 = e3.heap_max + 1; r3 < _; r3++) p2 < (s3 = h3[2 * h3[2 * (n3 = e3.heap[r3]) + 1] + 1] + 1) && (s3 = p2, m2++), h3[2 * n3 + 1] = s3, u3 < n3 || (e3.bl_count[s3]++, a3 = 0, d2 <= n3 && (a3 = c2[n3 - d2]), o3 = h3[2 * n3], e3.opt_len += o3 * (s3 + a3), f2 && (e3.static_len += o3 * (l2[2 * n3 + 1] + a3)));
@@ -20097,7 +20628,7 @@ function requireJszip_min() {
20097
20628
  } while (0 < m2);
20098
20629
  for (s3 = p2; 0 !== s3; s3--) for (n3 = e3.bl_count[s3]; 0 !== n3; ) u3 < (i3 = e3.heap[--r3]) || (h3[2 * i3 + 1] !== s3 && (e3.opt_len += (s3 - h3[2 * i3 + 1]) * h3[2 * i3], h3[2 * i3 + 1] = s3), n3--);
20099
20630
  }
20100
- }(e2, t2), Z(s2, u2, e2.bl_count);
20631
+ })(e2, t2), Z(s2, u2, e2.bl_count);
20101
20632
  }
20102
20633
  function X(e2, t2, r2) {
20103
20634
  var n2, i2, s2 = -1, a2 = t2[1], o2 = 0, h2 = 7, u2 = 4;
@@ -20114,12 +20645,12 @@ function requireJszip_min() {
20114
20645
  n(T);
20115
20646
  var q = false;
20116
20647
  function J(e2, t2, r2, n2) {
20117
- P(e2, (s << 1) + (n2 ? 1 : 0), 3), function(e3, t3, r3, n3) {
20648
+ P(e2, (s << 1) + (n2 ? 1 : 0), 3), (function(e3, t3, r3, n3) {
20118
20649
  M(e3), U(e3, r3), U(e3, ~r3), i.arraySet(e3.pending_buf, e3.window, t3, r3, e3.pending), e3.pending += r3;
20119
- }(e2, t2, r2);
20650
+ })(e2, t2, r2);
20120
20651
  }
20121
20652
  r._tr_init = function(e2) {
20122
- q || (function() {
20653
+ q || ((function() {
20123
20654
  var e3, t2, r2, n2, i2, s2 = new Array(g + 1);
20124
20655
  for (n2 = r2 = 0; n2 < a - 1; n2++) for (I[n2] = r2, e3 = 0; e3 < 1 << w[n2]; e3++) A[r2++] = n2;
20125
20656
  for (A[r2 - 1] = n2, n2 = i2 = 0; n2 < 16; n2++) for (T[n2] = i2, e3 = 0; e3 < 1 << k[n2]; e3++) E[i2++] = n2;
@@ -20131,30 +20662,30 @@ function requireJszip_min() {
20131
20662
  for (; e3 <= 287; ) z[2 * e3 + 1] = 8, e3++, s2[8]++;
20132
20663
  for (Z(z, l + 1, s2), e3 = 0; e3 < f; e3++) C[2 * e3 + 1] = 5, C[2 * e3] = j(e3, 5);
20133
20664
  O = new D(z, w, u + 1, l, g), B = new D(C, k, 0, f, g), R = new D(new Array(0), x, 0, c, p);
20134
- }(), q = true), e2.l_desc = new F(e2.dyn_ltree, O), e2.d_desc = new F(e2.dyn_dtree, B), e2.bl_desc = new F(e2.bl_tree, R), e2.bi_buf = 0, e2.bi_valid = 0, W(e2);
20665
+ })(), q = true), e2.l_desc = new F(e2.dyn_ltree, O), e2.d_desc = new F(e2.dyn_dtree, B), e2.bl_desc = new F(e2.bl_tree, R), e2.bi_buf = 0, e2.bi_valid = 0, W(e2);
20135
20666
  }, r._tr_stored_block = J, r._tr_flush_block = function(e2, t2, r2, n2) {
20136
20667
  var i2, s2, a2 = 0;
20137
- 0 < e2.level ? (2 === e2.strm.data_type && (e2.strm.data_type = function(e3) {
20668
+ 0 < e2.level ? (2 === e2.strm.data_type && (e2.strm.data_type = (function(e3) {
20138
20669
  var t3, r3 = 4093624447;
20139
20670
  for (t3 = 0; t3 <= 31; t3++, r3 >>>= 1) if (1 & r3 && 0 !== e3.dyn_ltree[2 * t3]) return o;
20140
20671
  if (0 !== e3.dyn_ltree[18] || 0 !== e3.dyn_ltree[20] || 0 !== e3.dyn_ltree[26]) return h;
20141
20672
  for (t3 = 32; t3 < u; t3++) if (0 !== e3.dyn_ltree[2 * t3]) return h;
20142
20673
  return o;
20143
- }(e2)), Y(e2, e2.l_desc), Y(e2, e2.d_desc), a2 = function(e3) {
20674
+ })(e2)), Y(e2, e2.l_desc), Y(e2, e2.d_desc), a2 = (function(e3) {
20144
20675
  var t3;
20145
20676
  for (X(e3, e3.dyn_ltree, e3.l_desc.max_code), X(e3, e3.dyn_dtree, e3.d_desc.max_code), Y(e3, e3.bl_desc), t3 = c - 1; 3 <= t3 && 0 === e3.bl_tree[2 * S[t3] + 1]; t3--) ;
20146
20677
  return e3.opt_len += 3 * (t3 + 1) + 5 + 5 + 4, t3;
20147
- }(e2), i2 = e2.opt_len + 3 + 7 >>> 3, (s2 = e2.static_len + 3 + 7 >>> 3) <= i2 && (i2 = s2)) : i2 = s2 = r2 + 5, r2 + 4 <= i2 && -1 !== t2 ? J(e2, t2, r2, n2) : 4 === e2.strategy || s2 === i2 ? (P(e2, 2 + (n2 ? 1 : 0), 3), K(e2, z, C)) : (P(e2, 4 + (n2 ? 1 : 0), 3), function(e3, t3, r3, n3) {
20678
+ })(e2), i2 = e2.opt_len + 3 + 7 >>> 3, (s2 = e2.static_len + 3 + 7 >>> 3) <= i2 && (i2 = s2)) : i2 = s2 = r2 + 5, r2 + 4 <= i2 && -1 !== t2 ? J(e2, t2, r2, n2) : 4 === e2.strategy || s2 === i2 ? (P(e2, 2 + (n2 ? 1 : 0), 3), K(e2, z, C)) : (P(e2, 4 + (n2 ? 1 : 0), 3), (function(e3, t3, r3, n3) {
20148
20679
  var i3;
20149
20680
  for (P(e3, t3 - 257, 5), P(e3, r3 - 1, 5), P(e3, n3 - 4, 4), i3 = 0; i3 < n3; i3++) P(e3, e3.bl_tree[2 * S[i3] + 1], 3);
20150
20681
  V(e3, e3.dyn_ltree, t3 - 1), V(e3, e3.dyn_dtree, r3 - 1);
20151
- }(e2, e2.l_desc.max_code + 1, e2.d_desc.max_code + 1, a2 + 1), K(e2, e2.dyn_ltree, e2.dyn_dtree)), W(e2), n2 && M(e2);
20682
+ })(e2, e2.l_desc.max_code + 1, e2.d_desc.max_code + 1, a2 + 1), K(e2, e2.dyn_ltree, e2.dyn_dtree)), W(e2), n2 && M(e2);
20152
20683
  }, r._tr_tally = function(e2, t2, r2) {
20153
20684
  return e2.pending_buf[e2.d_buf + 2 * e2.last_lit] = t2 >>> 8 & 255, e2.pending_buf[e2.d_buf + 2 * e2.last_lit + 1] = 255 & t2, e2.pending_buf[e2.l_buf + e2.last_lit] = 255 & r2, e2.last_lit++, 0 === t2 ? e2.dyn_ltree[2 * r2]++ : (e2.matches++, t2--, e2.dyn_ltree[2 * (A[r2] + u + 1)]++, e2.dyn_dtree[2 * N(t2)]++), e2.last_lit === e2.lit_bufsize - 1;
20154
20685
  }, r._tr_align = function(e2) {
20155
- P(e2, 2, 3), L(e2, m, z), function(e3) {
20686
+ P(e2, 2, 3), L(e2, m, z), (function(e3) {
20156
20687
  16 === e3.bi_valid ? (U(e3, e3.bi_buf), e3.bi_buf = 0, e3.bi_valid = 0) : 8 <= e3.bi_valid && (e3.pending_buf[e3.pending++] = 255 & e3.bi_buf, e3.bi_buf >>= 8, e3.bi_valid -= 8);
20157
- }(e2);
20688
+ })(e2);
20158
20689
  };
20159
20690
  }, { "../utils/common": 41 }], 53: [function(e, t, r) {
20160
20691
  t.exports = function() {
@@ -20162,21 +20693,21 @@ function requireJszip_min() {
20162
20693
  };
20163
20694
  }, {}], 54: [function(e, t, r) {
20164
20695
  (function(e2) {
20165
- !function(r2, n) {
20696
+ !(function(r2, n) {
20166
20697
  if (!r2.setImmediate) {
20167
20698
  var i, s, t2, a, o = 1, h = {}, u = false, l = r2.document, e3 = Object.getPrototypeOf && Object.getPrototypeOf(r2);
20168
20699
  e3 = e3 && e3.setTimeout ? e3 : r2, i = "[object process]" === {}.toString.call(r2.process) ? function(e4) {
20169
20700
  process$1.nextTick(function() {
20170
20701
  c(e4);
20171
20702
  });
20172
- } : function() {
20703
+ } : (function() {
20173
20704
  if (r2.postMessage && !r2.importScripts) {
20174
20705
  var e4 = true, t3 = r2.onmessage;
20175
20706
  return r2.onmessage = function() {
20176
20707
  e4 = false;
20177
20708
  }, r2.postMessage("", "*"), r2.onmessage = t3, e4;
20178
20709
  }
20179
- }() ? (a = "setImmediate$" + Math.random() + "$", r2.addEventListener ? r2.addEventListener("message", d, false) : r2.attachEvent("onmessage", d), function(e4) {
20710
+ })() ? (a = "setImmediate$" + Math.random() + "$", r2.addEventListener ? r2.addEventListener("message", d, false) : r2.attachEvent("onmessage", d), function(e4) {
20180
20711
  r2.postMessage(a + e4, "*");
20181
20712
  }) : r2.MessageChannel ? ((t2 = new MessageChannel()).port1.onmessage = function(e4) {
20182
20713
  c(e4.data);
@@ -20206,7 +20737,7 @@ function requireJszip_min() {
20206
20737
  if (t3) {
20207
20738
  u = true;
20208
20739
  try {
20209
- !function(e5) {
20740
+ !(function(e5) {
20210
20741
  var t4 = e5.callback, r3 = e5.args;
20211
20742
  switch (r3.length) {
20212
20743
  case 0:
@@ -20224,7 +20755,7 @@ function requireJszip_min() {
20224
20755
  default:
20225
20756
  t4.apply(n, r3);
20226
20757
  }
20227
- }(t3);
20758
+ })(t3);
20228
20759
  } finally {
20229
20760
  f(e4), u = false;
20230
20761
  }
@@ -20234,7 +20765,7 @@ function requireJszip_min() {
20234
20765
  function d(e4) {
20235
20766
  e4.source === r2 && "string" == typeof e4.data && 0 === e4.data.indexOf(a) && c(+e4.data.slice(a.length));
20236
20767
  }
20237
- }("undefined" == typeof self ? void 0 === e2 ? this : e2 : self);
20768
+ })("undefined" == typeof self ? void 0 === e2 ? this : e2 : self);
20238
20769
  }).call(this, "undefined" != typeof commonjsGlobal ? commonjsGlobal : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {});
20239
20770
  }, {}] }, {}, [10])(10);
20240
20771
  });
@@ -20521,6 +21052,14 @@ const obfuscate = (buf, fontKey) => {
20521
21052
  return out;
20522
21053
  };
20523
21054
  class Formatter {
21055
+ /**
21056
+ * Formats an XML component into a serializable object.
21057
+ *
21058
+ * @param input - The XML component to format
21059
+ * @param context - The context containing file state and relationships
21060
+ * @returns A serializable XML object structure
21061
+ * @throws Error if the component cannot be formatted correctly
21062
+ */
20524
21063
  format(input, context = { stack: [] }) {
20525
21064
  const output = input.prepForXml(context);
20526
21065
  if (output) {
@@ -20531,6 +21070,14 @@ class Formatter {
20531
21070
  }
20532
21071
  }
20533
21072
  class ImageReplacer {
21073
+ /**
21074
+ * Replaces image placeholder tokens with relationship IDs.
21075
+ *
21076
+ * @param xmlData - The XML string containing image placeholders
21077
+ * @param mediaData - Array of media data to replace
21078
+ * @param offset - Starting offset for relationship IDs
21079
+ * @returns XML string with placeholders replaced by relationship IDs
21080
+ */
20534
21081
  replace(xmlData, mediaData, offset) {
20535
21082
  let currentXmlData = xmlData;
20536
21083
  mediaData.forEach((image, i) => {
@@ -20538,11 +21085,28 @@ class ImageReplacer {
20538
21085
  });
20539
21086
  return currentXmlData;
20540
21087
  }
21088
+ /**
21089
+ * Extracts media data referenced in the XML content.
21090
+ *
21091
+ * @param xmlData - The XML string to search for media references
21092
+ * @param media - The media collection to search within
21093
+ * @returns Array of media data found in the XML
21094
+ */
20541
21095
  getMediaData(xmlData, media) {
20542
21096
  return media.Array.filter((image) => xmlData.search(`{${image.fileName}}`) > 0);
20543
21097
  }
20544
21098
  }
20545
21099
  class NumberingReplacer {
21100
+ /**
21101
+ * Replaces numbering placeholder tokens with actual numbering IDs.
21102
+ *
21103
+ * Placeholder format: {reference-instance} where reference identifies the
21104
+ * numbering definition and instance is the specific usage.
21105
+ *
21106
+ * @param xmlData - The XML string containing numbering placeholders
21107
+ * @param concreteNumberings - Array of concrete numbering instances to replace
21108
+ * @returns XML string with placeholders replaced by numbering IDs
21109
+ */
20546
21110
  replace(xmlData, concreteNumberings) {
20547
21111
  let currentXmlData = xmlData;
20548
21112
  for (const concreteNumbering of concreteNumberings) {
@@ -20555,6 +21119,11 @@ class NumberingReplacer {
20555
21119
  }
20556
21120
  }
20557
21121
  class Compiler {
21122
+ /**
21123
+ * Creates a new Compiler instance.
21124
+ *
21125
+ * Initializes the formatter and replacer utilities used during compilation.
21126
+ */
20558
21127
  constructor() {
20559
21128
  __publicField(this, "formatter");
20560
21129
  __publicField(this, "imageReplacer");
@@ -20563,6 +21132,21 @@ class Compiler {
20563
21132
  this.imageReplacer = new ImageReplacer();
20564
21133
  this.numberingReplacer = new NumberingReplacer();
20565
21134
  }
21135
+ /**
21136
+ * Compiles a File object into a JSZip archive containing the complete OOXML package.
21137
+ *
21138
+ * This method orchestrates the entire compilation process:
21139
+ * - Converts all document components to XML
21140
+ * - Manages image and numbering placeholder replacements
21141
+ * - Creates relationship files
21142
+ * - Packages fonts and media files
21143
+ * - Assembles everything into a ZIP archive
21144
+ *
21145
+ * @param file - The document to compile
21146
+ * @param prettifyXml - Optional XML formatting style
21147
+ * @param overrides - Optional custom XML file overrides
21148
+ * @returns A JSZip instance containing the complete .docx package
21149
+ */
20566
21150
  compile(file, prettifyXml, overrides = []) {
20567
21151
  const zip = new JSZip();
20568
21152
  const xmlifiedFileMapping = this.xmlifyFile(file, prettifyXml);
@@ -21033,13 +21617,26 @@ class Compiler {
21033
21617
  }
21034
21618
  }
21035
21619
  const PrettifyType = {
21620
+ /** No prettification (smallest file size) */
21036
21621
  NONE: "",
21622
+ /** Indent with 2 spaces */
21037
21623
  WITH_2_BLANKS: " ",
21624
+ /** Indent with 4 spaces */
21038
21625
  WITH_4_BLANKS: " ",
21626
+ /** Indent with tab character */
21039
21627
  WITH_TAB: " "
21040
21628
  };
21041
21629
  const convertPrettifyType = (prettify) => prettify === true ? PrettifyType.WITH_2_BLANKS : prettify === false ? void 0 : prettify;
21042
21630
  const _Packer = class _Packer {
21631
+ /**
21632
+ * Exports a document to the specified output format.
21633
+ *
21634
+ * @param file - The document to export
21635
+ * @param type - The output format type (e.g., "nodebuffer", "blob", "string")
21636
+ * @param prettify - Whether to prettify the XML output (boolean or PrettifyType)
21637
+ * @param overrides - Optional array of file overrides for custom XML content
21638
+ * @returns A promise resolving to the exported document in the specified format
21639
+ */
21043
21640
  // eslint-disable-next-line require-await
21044
21641
  static pack(_0, _12, _2) {
21045
21642
  return __async(this, arguments, function* (file, type2, prettify, overrides = []) {
@@ -21051,21 +21648,69 @@ const _Packer = class _Packer {
21051
21648
  });
21052
21649
  });
21053
21650
  }
21651
+ /**
21652
+ * Exports a document to a string representation.
21653
+ *
21654
+ * @param file - The document to export
21655
+ * @param prettify - Whether to prettify the XML output
21656
+ * @param overrides - Optional array of file overrides
21657
+ * @returns A promise resolving to the document as a string
21658
+ */
21054
21659
  static toString(file, prettify, overrides = []) {
21055
21660
  return _Packer.pack(file, "string", prettify, overrides);
21056
21661
  }
21662
+ /**
21663
+ * Exports a document to a Node.js Buffer.
21664
+ *
21665
+ * @param file - The document to export
21666
+ * @param prettify - Whether to prettify the XML output
21667
+ * @param overrides - Optional array of file overrides
21668
+ * @returns A promise resolving to the document as a Buffer
21669
+ */
21057
21670
  static toBuffer(file, prettify, overrides = []) {
21058
21671
  return _Packer.pack(file, "nodebuffer", prettify, overrides);
21059
21672
  }
21673
+ /**
21674
+ * Exports a document to a base64-encoded string.
21675
+ *
21676
+ * @param file - The document to export
21677
+ * @param prettify - Whether to prettify the XML output
21678
+ * @param overrides - Optional array of file overrides
21679
+ * @returns A promise resolving to the document as a base64 string
21680
+ */
21060
21681
  static toBase64String(file, prettify, overrides = []) {
21061
21682
  return _Packer.pack(file, "base64", prettify, overrides);
21062
21683
  }
21684
+ /**
21685
+ * Exports a document to a Blob (for browser environments).
21686
+ *
21687
+ * @param file - The document to export
21688
+ * @param prettify - Whether to prettify the XML output
21689
+ * @param overrides - Optional array of file overrides
21690
+ * @returns A promise resolving to the document as a Blob
21691
+ */
21063
21692
  static toBlob(file, prettify, overrides = []) {
21064
21693
  return _Packer.pack(file, "blob", prettify, overrides);
21065
21694
  }
21695
+ /**
21696
+ * Exports a document to an ArrayBuffer.
21697
+ *
21698
+ * @param file - The document to export
21699
+ * @param prettify - Whether to prettify the XML output
21700
+ * @param overrides - Optional array of file overrides
21701
+ * @returns A promise resolving to the document as an ArrayBuffer
21702
+ */
21066
21703
  static toArrayBuffer(file, prettify, overrides = []) {
21067
21704
  return _Packer.pack(file, "arraybuffer", prettify, overrides);
21068
21705
  }
21706
+ /**
21707
+ * Exports a document to a Node.js Stream.
21708
+ *
21709
+ * @param file - The document to export
21710
+ * @param prettify - Whether to prettify the XML output
21711
+ * @param overrides - Optional array of file overrides
21712
+ * @returns A readable stream containing the document data
21713
+ */
21069
21714
  static toStream(file, prettify, overrides = []) {
21070
21715
  const stream = new streamBrowserifyExports.Stream();
21071
21716
  const zip = this.compiler.compile(file, convertPrettifyType(prettify), overrides);
@@ -21146,6 +21791,12 @@ const appendRelationship = (relationships, id, type2, target, targetMode) => {
21146
21791
  });
21147
21792
  return relationshipElements;
21148
21793
  };
21794
+ class TokenNotFoundError extends Error {
21795
+ constructor(token) {
21796
+ super(`Token ${token} not found`);
21797
+ this.name = "TokenNotFoundError";
21798
+ }
21799
+ }
21149
21800
  const findRunElementIndexWithToken = (paragraphElement, token) => {
21150
21801
  var _a, _b, _c, _d;
21151
21802
  for (let i = 0; i < ((_a = paragraphElement.elements) != null ? _a : []).length; i++) {
@@ -21162,7 +21813,7 @@ const findRunElementIndexWithToken = (paragraphElement, token) => {
21162
21813
  }
21163
21814
  }
21164
21815
  }
21165
- throw new Error("Token not found");
21816
+ throw new TokenNotFoundError(token);
21166
21817
  };
21167
21818
  const splitRunElement = (runElement, token) => {
21168
21819
  var _a, _b;
@@ -21190,8 +21841,11 @@ const splitRunElement = (runElement, token) => {
21190
21841
  return { left: leftRunElement, right: rightRunElement };
21191
21842
  };
21192
21843
  const ReplaceMode = {
21844
+ /** Looking for the start of the replacement text */
21193
21845
  START: 0,
21846
+ /** Processing runs in the middle of the replacement text */
21194
21847
  MIDDLE: 1,
21848
+ /** Reached the end of the replacement text */
21195
21849
  END: 2
21196
21850
  };
21197
21851
  const replaceTokenInParagraphElement = ({
@@ -21399,7 +22053,9 @@ const goToElementFromPath = (json, path) => {
21399
22053
  const goToParentElementFromPath = (json, path) => goToElementFromPath(json, path.slice(0, path.length - 1));
21400
22054
  const getLastElementIndexFromPath = (path) => path[path.length - 1];
21401
22055
  const PatchType = {
22056
+ /** Replace entire file-level elements (e.g., whole paragraphs) */
21402
22057
  DOCUMENT: "file",
22058
+ /** Replace content within paragraphs (inline replacement) */
21403
22059
  PARAGRAPH: "paragraph"
21404
22060
  };
21405
22061
  const imageReplacer = new ImageReplacer();
@@ -21416,7 +22072,7 @@ const compareByteArrays = (a, b) => {
21416
22072
  }
21417
22073
  return true;
21418
22074
  };
21419
- const patchDocument = (_0) => __async(exports, [_0], function* ({
22075
+ const patchDocument = (_0) => __async(null, [_0], function* ({
21420
22076
  outputType,
21421
22077
  data,
21422
22078
  patches,
@@ -21609,7 +22265,7 @@ const createRelationshipFile = () => ({
21609
22265
  }
21610
22266
  ]
21611
22267
  });
21612
- const patchDetector = (_0) => __async(exports, [_0], function* ({ data }) {
22268
+ const patchDetector = (_0) => __async(null, [_0], function* ({ data }) {
21613
22269
  const zipContent = data instanceof JSZip ? data : yield JSZip.loadAsync(data);
21614
22270
  const patches = /* @__PURE__ */ new Set();
21615
22271
  for (const [key, value] of Object.entries(zipContent.files)) {