docx-plus 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, stream, fflate, xml) {
1
+ var docx = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, fflate, xml) {
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  //#region \0rolldown/runtime.js
4
4
  var __create = Object.create;
@@ -22,9 +22,9 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
22
22
  enumerable: true
23
23
  }) : target, mod));
24
24
  //#endregion
25
- hash_js = __toESM(hash_js);
26
- xml = __toESM(xml);
27
- //#region \0@oxc-project+runtime@0.123.0/helpers/typeof.js
25
+ hash_js = __toESM(hash_js, 1);
26
+ xml = __toESM(xml, 1);
27
+ //#region \0@oxc-project+runtime@0.124.0/helpers/typeof.js
28
28
  function _typeof(o) {
29
29
  "@babel/helpers - typeof";
30
30
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -34,7 +34,7 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
34
34
  }, _typeof(o);
35
35
  }
36
36
  //#endregion
37
- //#region \0@oxc-project+runtime@0.123.0/helpers/toPrimitive.js
37
+ //#region \0@oxc-project+runtime@0.124.0/helpers/toPrimitive.js
38
38
  function toPrimitive(t, r) {
39
39
  if ("object" != _typeof(t) || !t) return t;
40
40
  var e = t[Symbol.toPrimitive];
@@ -46,13 +46,13 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
46
46
  return ("string" === r ? String : Number)(t);
47
47
  }
48
48
  //#endregion
49
- //#region \0@oxc-project+runtime@0.123.0/helpers/toPropertyKey.js
49
+ //#region \0@oxc-project+runtime@0.124.0/helpers/toPropertyKey.js
50
50
  function toPropertyKey(t) {
51
51
  var i = toPrimitive(t, "string");
52
52
  return "symbol" == _typeof(i) ? i : i + "";
53
53
  }
54
54
  //#endregion
55
- //#region \0@oxc-project+runtime@0.123.0/helpers/defineProperty.js
55
+ //#region \0@oxc-project+runtime@0.124.0/helpers/defineProperty.js
56
56
  function _defineProperty(e, r, t) {
57
57
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
58
58
  value: t,
@@ -237,29 +237,6 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
237
237
  }
238
238
  };
239
239
  //#endregion
240
- //#region \0@oxc-project+runtime@0.123.0/helpers/objectSpread2.js
241
- function ownKeys(e, r) {
242
- var t = Object.keys(e);
243
- if (Object.getOwnPropertySymbols) {
244
- var o = Object.getOwnPropertySymbols(e);
245
- r && (o = o.filter(function(r) {
246
- return Object.getOwnPropertyDescriptor(e, r).enumerable;
247
- })), t.push.apply(t, o);
248
- }
249
- return t;
250
- }
251
- function _objectSpread2(e) {
252
- for (var r = 1; r < arguments.length; r++) {
253
- var t = null != arguments[r] ? arguments[r] : {};
254
- r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
255
- _defineProperty(e, r, t[r]);
256
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
257
- Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
258
- });
259
- }
260
- return e;
261
- }
262
- //#endregion
263
240
  //#region src/file/xml-components/default-attributes.ts
264
241
  /**
265
242
  * XML attribute components for the docx library.
@@ -353,7 +330,10 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
353
330
  * @returns Object with _attr key containing the attributes
354
331
  */
355
332
  prepForXml(_) {
356
- return { _attr: Object.values(this.root).filter(({ value }) => value !== void 0).reduce((acc, { key, value }) => _objectSpread2(_objectSpread2({}, acc), {}, { [key]: value }), {}) };
333
+ return { _attr: Object.values(this.root).filter(({ value }) => value !== void 0).reduce((acc, { key, value }) => ({
334
+ ...acc,
335
+ [key]: value
336
+ }), {}) };
357
337
  }
358
338
  };
359
339
  //#endregion
@@ -404,6 +384,9 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
404
384
  rsidSect: "w:rsidSect",
405
385
  space: "w:space",
406
386
  sz: "w:sz",
387
+ themeColor: "w:themeColor",
388
+ themeShade: "w:themeShade",
389
+ themeTint: "w:themeTint",
407
390
  top: "w:top",
408
391
  type: "w:type",
409
392
  val: "w:val",
@@ -930,6 +913,49 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
930
913
  * ```
931
914
  */
932
915
  const dateTimeValue = (val) => val.toISOString();
916
+ /**
917
+ * Theme color values used throughout OOXML for referencing document theme colors.
918
+ *
919
+ * Reference: ST_ThemeColor in OOXML specification
920
+ *
921
+ * @publicApi
922
+ */
923
+ const ThemeColor = {
924
+ DARK1: "dark1",
925
+ LIGHT1: "light1",
926
+ DARK2: "dark2",
927
+ LIGHT2: "light2",
928
+ ACCENT1: "accent1",
929
+ ACCENT2: "accent2",
930
+ ACCENT3: "accent3",
931
+ ACCENT4: "accent4",
932
+ ACCENT5: "accent5",
933
+ ACCENT6: "accent6",
934
+ HYPERLINK: "hyperlink",
935
+ FOLLOWED_HYPERLINK: "followedHyperlink",
936
+ NONE: "none",
937
+ BACKGROUND1: "background1",
938
+ TEXT1: "text1",
939
+ BACKGROUND2: "background2",
940
+ TEXT2: "text2"
941
+ };
942
+ /**
943
+ * Theme font values used for referencing document theme fonts.
944
+ *
945
+ * Reference: ST_Theme in OOXML specification
946
+ *
947
+ * @publicApi
948
+ */
949
+ const ThemeFont = {
950
+ MAJOR_EAST_ASIA: "majorEastAsia",
951
+ MAJOR_BIDI: "majorBidi",
952
+ MAJOR_ASCII: "majorAscii",
953
+ MAJOR_H_ANSI: "majorHAnsi",
954
+ MINOR_EAST_ASIA: "minorEastAsia",
955
+ MINOR_BIDI: "minorBidi",
956
+ MINOR_ASCII: "minorAscii",
957
+ MINOR_H_ANSI: "minorHAnsi"
958
+ };
933
959
  //#endregion
934
960
  //#region src/file/xml-components/simple-elements.ts
935
961
  /**
@@ -1342,12 +1368,20 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
1342
1368
  * });
1343
1369
  * ```
1344
1370
  */
1345
- const createBorderElement = (elementName, { color, size, space, style }) => new BuilderElement({
1371
+ const createBorderElement = (elementName, { color, size, space, style, themeColor, themeTint, themeShade, shadow, frame }) => new BuilderElement({
1346
1372
  attributes: {
1347
1373
  color: {
1348
1374
  key: "w:color",
1349
1375
  value: color === void 0 ? void 0 : hexColorValue(color)
1350
1376
  },
1377
+ frame: {
1378
+ key: "w:frame",
1379
+ value: frame
1380
+ },
1381
+ shadow: {
1382
+ key: "w:shadow",
1383
+ value: shadow
1384
+ },
1351
1385
  size: {
1352
1386
  key: "w:sz",
1353
1387
  value: size === void 0 ? void 0 : eighthPointMeasureValue(size)
@@ -1359,6 +1393,18 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
1359
1393
  style: {
1360
1394
  key: "w:val",
1361
1395
  value: style
1396
+ },
1397
+ themeColor: {
1398
+ key: "w:themeColor",
1399
+ value: themeColor
1400
+ },
1401
+ themeShade: {
1402
+ key: "w:themeShade",
1403
+ value: themeShade === void 0 ? void 0 : uCharHexNumber(themeShade)
1404
+ },
1405
+ themeTint: {
1406
+ key: "w:themeTint",
1407
+ value: themeTint === void 0 ? void 0 : uCharHexNumber(themeTint)
1362
1408
  }
1363
1409
  },
1364
1410
  name: elementName
@@ -1562,20 +1608,32 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
1562
1608
  * </xsd:complexType>
1563
1609
  * ```
1564
1610
  */
1565
- const createIndent = ({ start, end, left, right, hanging, firstLine }) => new BuilderElement({
1611
+ const createIndent = ({ start, startChars, end, endChars, left, right, hanging, hangingChars, firstLine, firstLineChars }) => new BuilderElement({
1566
1612
  attributes: {
1567
1613
  end: {
1568
1614
  key: "w:end",
1569
1615
  value: end === void 0 ? void 0 : signedTwipsMeasureValue(end)
1570
1616
  },
1617
+ endChars: {
1618
+ key: "w:endChars",
1619
+ value: endChars === void 0 ? void 0 : decimalNumber(endChars)
1620
+ },
1571
1621
  firstLine: {
1572
1622
  key: "w:firstLine",
1573
1623
  value: firstLine === void 0 ? void 0 : twipsMeasureValue(firstLine)
1574
1624
  },
1625
+ firstLineChars: {
1626
+ key: "w:firstLineChars",
1627
+ value: firstLineChars === void 0 ? void 0 : decimalNumber(firstLineChars)
1628
+ },
1575
1629
  hanging: {
1576
1630
  key: "w:hanging",
1577
1631
  value: hanging === void 0 ? void 0 : twipsMeasureValue(hanging)
1578
1632
  },
1633
+ hangingChars: {
1634
+ key: "w:hangingChars",
1635
+ value: hangingChars === void 0 ? void 0 : decimalNumber(hangingChars)
1636
+ },
1579
1637
  left: {
1580
1638
  key: "w:left",
1581
1639
  value: left === void 0 ? void 0 : signedTwipsMeasureValue(left)
@@ -1587,6 +1645,10 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
1587
1645
  start: {
1588
1646
  key: "w:start",
1589
1647
  value: start === void 0 ? void 0 : signedTwipsMeasureValue(start)
1648
+ },
1649
+ startChars: {
1650
+ key: "w:startChars",
1651
+ value: startChars === void 0 ? void 0 : decimalNumber(startChars)
1590
1652
  }
1591
1653
  },
1592
1654
  name: "w:ind"
@@ -2037,7 +2099,7 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
2037
2099
  *
2038
2100
  * Reference: http://officeopenxml.com/WPshading.php
2039
2101
  */
2040
- const createShading = ({ fill, color, type }) => new BuilderElement({
2102
+ const createShading = ({ fill, color, type, themeColor, themeTint, themeShade, themeFill, themeFillTint, themeFillShade }) => new BuilderElement({
2041
2103
  attributes: {
2042
2104
  color: {
2043
2105
  key: "w:color",
@@ -2047,6 +2109,30 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
2047
2109
  key: "w:fill",
2048
2110
  value: fill === void 0 ? void 0 : hexColorValue(fill)
2049
2111
  },
2112
+ themeColor: {
2113
+ key: "w:themeColor",
2114
+ value: themeColor
2115
+ },
2116
+ themeFill: {
2117
+ key: "w:themeFill",
2118
+ value: themeFill
2119
+ },
2120
+ themeFillShade: {
2121
+ key: "w:themeFillShade",
2122
+ value: themeFillShade === void 0 ? void 0 : uCharHexNumber(themeFillShade)
2123
+ },
2124
+ themeFillTint: {
2125
+ key: "w:themeFillTint",
2126
+ value: themeFillTint === void 0 ? void 0 : uCharHexNumber(themeFillTint)
2127
+ },
2128
+ themeShade: {
2129
+ key: "w:themeShade",
2130
+ value: themeShade === void 0 ? void 0 : uCharHexNumber(themeShade)
2131
+ },
2132
+ themeTint: {
2133
+ key: "w:themeTint",
2134
+ value: themeTint === void 0 ? void 0 : uCharHexNumber(themeTint)
2135
+ },
2050
2136
  type: {
2051
2137
  key: "w:val",
2052
2138
  value: type
@@ -2225,7 +2311,13 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
2225
2311
  *
2226
2312
  * @publicApi
2227
2313
  */
2228
- const EmphasisMarkType = { DOT: "dot" };
2314
+ const EmphasisMarkType = {
2315
+ NONE: "none",
2316
+ COMMA: "comma",
2317
+ CIRCLE: "circle",
2318
+ DOT: "dot",
2319
+ UNDER_DOT: "underDot"
2320
+ };
2229
2321
  /**
2230
2322
  * Creates an emphasis mark element for a WordprocessingML document.
2231
2323
  *
@@ -2316,16 +2408,27 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
2316
2408
  *
2317
2409
  * @example
2318
2410
  * ```typescript
2319
- * new Color("FF0000"); // Red text
2411
+ * new Color("FF0000"); // Red text (backward compatible)
2320
2412
  * new Color("auto"); // Automatic color
2413
+ * new Color({ themeColor: ThemeColor.ACCENT1, themeTint: "99" }); // Theme color with tint
2321
2414
  * ```
2322
2415
  *
2323
2416
  * @internal
2324
2417
  */
2325
2418
  var Color = class extends XmlComponent {
2326
- constructor(color) {
2419
+ constructor(colorOrOptions) {
2327
2420
  super("w:color");
2328
- this.root.push(new Attributes({ val: hexColorValue(color) }));
2421
+ if (typeof colorOrOptions === "string") {
2422
+ this.root.push(new Attributes({ val: hexColorValue(colorOrOptions) }));
2423
+ return;
2424
+ }
2425
+ const opts = colorOrOptions;
2426
+ this.root.push(new Attributes({
2427
+ val: opts.val === void 0 ? void 0 : hexColorValue(opts.val),
2428
+ themeColor: opts.themeColor,
2429
+ themeTint: opts.themeTint === void 0 ? void 0 : uCharHexNumber(opts.themeTint),
2430
+ themeShade: opts.themeShade === void 0 ? void 0 : uCharHexNumber(opts.themeShade)
2431
+ }));
2329
2432
  }
2330
2433
  };
2331
2434
  /**
@@ -2524,18 +2627,34 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
2524
2627
  key: "w:ascii",
2525
2628
  value: attrs.ascii
2526
2629
  },
2630
+ asciiTheme: {
2631
+ key: "w:asciiTheme",
2632
+ value: attrs.asciiTheme
2633
+ },
2527
2634
  cs: {
2528
2635
  key: "w:cs",
2529
2636
  value: attrs.cs
2530
2637
  },
2638
+ cstheme: {
2639
+ key: "w:cstheme",
2640
+ value: attrs.cstheme
2641
+ },
2531
2642
  eastAsia: {
2532
2643
  key: "w:eastAsia",
2533
2644
  value: attrs.eastAsia
2534
2645
  },
2646
+ eastAsiaTheme: {
2647
+ key: "w:eastAsiaTheme",
2648
+ value: attrs.eastAsiaTheme
2649
+ },
2535
2650
  hAnsi: {
2536
2651
  key: "w:hAnsi",
2537
2652
  value: attrs.hAnsi
2538
2653
  },
2654
+ hAnsiTheme: {
2655
+ key: "w:hAnsiTheme",
2656
+ value: attrs.hAnsiTheme
2657
+ },
2539
2658
  hint: {
2540
2659
  key: "w:hint",
2541
2660
  value: attrs.hint
@@ -2692,12 +2811,24 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
2692
2811
  * createUnderline(UnderlineType.WAVE, "FF0000");
2693
2812
  * ```
2694
2813
  */
2695
- const createUnderline = (underlineType = UnderlineType.SINGLE, color) => new BuilderElement({
2814
+ const createUnderline = (underlineType = UnderlineType.SINGLE, color, themeColor, themeTint, themeShade) => new BuilderElement({
2696
2815
  attributes: {
2697
2816
  color: {
2698
2817
  key: "w:color",
2699
2818
  value: color === void 0 ? void 0 : hexColorValue(color)
2700
2819
  },
2820
+ themeColor: {
2821
+ key: "w:themeColor",
2822
+ value: themeColor
2823
+ },
2824
+ themeShade: {
2825
+ key: "w:themeShade",
2826
+ value: themeShade === void 0 ? void 0 : uCharHexNumber(themeShade)
2827
+ },
2828
+ themeTint: {
2829
+ key: "w:themeTint",
2830
+ value: themeTint === void 0 ? void 0 : uCharHexNumber(themeTint)
2831
+ },
2701
2832
  val: {
2702
2833
  key: "w:val",
2703
2834
  value: underlineType
@@ -2849,6 +2980,9 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
2849
2980
  if (options.doubleStrike !== void 0) this.push(new OnOffElement("w:dstrike", options.doubleStrike));
2850
2981
  if (options.emboss !== void 0) this.push(new OnOffElement("w:emboss", options.emboss));
2851
2982
  if (options.imprint !== void 0) this.push(new OnOffElement("w:imprint", options.imprint));
2983
+ if (options.outline !== void 0) this.push(new OnOffElement("w:outline", options.outline));
2984
+ if (options.shadow !== void 0) this.push(new OnOffElement("w:shadow", options.shadow));
2985
+ if (options.webHidden !== void 0) this.push(new OnOffElement("w:webHidden", options.webHidden));
2852
2986
  if (options.noProof !== void 0) this.push(new OnOffElement("w:noProof", options.noProof));
2853
2987
  if (options.snapToGrid !== void 0) this.push(new OnOffElement("w:snapToGrid", options.snapToGrid));
2854
2988
  if (options.vanish) this.push(new OnOffElement("w:vanish", options.vanish));
@@ -2874,6 +3008,8 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
2874
3008
  if (options.language) this.push(createLanguageComponent(options.language));
2875
3009
  if (options.specVanish) this.push(new OnOffElement("w:specVanish", options.vanish));
2876
3010
  if (options.math) this.push(new OnOffElement("w:oMath", options.math));
3011
+ if (options.fitText !== void 0) this.push(new NumberValueElement("w:fitText", options.fitText));
3012
+ if (options.complexScript !== void 0) this.push(new OnOffElement("w:cs", options.complexScript));
2877
3013
  if (options.revision) this.push(new RunPropertiesChange(options.revision));
2878
3014
  }
2879
3015
  push(item) {
@@ -3309,18 +3445,6 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
3309
3445
  * ```
3310
3446
  */
3311
3447
  const uniqueUuid = () => `${generateUuidPart(8)}-${generateUuidPart(4)}-${generateUuidPart(4)}-${generateUuidPart(4)}-${generateUuidPart(12)}`;
3312
- /**
3313
- * Encode a string to UTF-8 bytes.
3314
- *
3315
- * This is used to pre-encode XML content before passing to fflate's zipSync,
3316
- * which expects Uint8Array input for text content.
3317
- *
3318
- * The copy via `new Uint8Array()` ensures the returned array uses the
3319
- * current module's Uint8Array constructor, avoiding cross-realm issues
3320
- * in test environments (happy-dom) where TextEncoder returns a different
3321
- * realm's Uint8Array.
3322
- */
3323
- const encodeUtf8 = (str) => new Uint8Array(new TextEncoder().encode(str));
3324
3448
  //#endregion
3325
3449
  //#region src/file/drawing/floating/floating-position.ts
3326
3450
  /**
@@ -4727,13 +4851,16 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
4727
4851
  * @returns An XML component representing the click hyperlink
4728
4852
  */
4729
4853
  const createHyperlinkClick = (linkId, hasXmlNs) => new BuilderElement({
4730
- attributes: _objectSpread2(_objectSpread2({}, hasXmlNs ? { xmlns: {
4731
- key: "xmlns:a",
4732
- value: "http://schemas.openxmlformats.org/drawingml/2006/main"
4733
- } } : {}), {}, { id: {
4734
- key: "r:id",
4735
- value: `rId${linkId}`
4736
- } }),
4854
+ attributes: {
4855
+ ...hasXmlNs ? { xmlns: {
4856
+ key: "xmlns:a",
4857
+ value: "http://schemas.openxmlformats.org/drawingml/2006/main"
4858
+ } } : {},
4859
+ id: {
4860
+ key: "r:id",
4861
+ value: `rId${linkId}`
4862
+ }
4863
+ },
4737
4864
  name: "a:hlinkClick"
4738
4865
  });
4739
4866
  //#endregion
@@ -4981,21 +5108,23 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
4981
5108
  super("a:graphicData");
4982
5109
  if (mediaData.type === "wps") {
4983
5110
  this.root.push(new GraphicDataAttributes({ uri: "http://schemas.microsoft.com/office/word/2010/wordprocessingShape" }));
4984
- const wps = createWpsShape(_objectSpread2(_objectSpread2({}, mediaData.data), {}, {
5111
+ const wps = createWpsShape({
5112
+ ...mediaData.data,
4985
5113
  outline,
4986
5114
  solidFill,
4987
5115
  transformation: transform
4988
- }));
5116
+ });
4989
5117
  this.root.push(wps);
4990
5118
  } else if (mediaData.type === "wpg") {
4991
5119
  this.root.push(new GraphicDataAttributes({ uri: "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" }));
4992
5120
  const wpg = createWpgGroup({
4993
5121
  children: mediaData.children.map((child) => {
4994
- if (child.type === "wps") return createWpsShape(_objectSpread2(_objectSpread2({}, child.data), {}, {
5122
+ if (child.type === "wps") return createWpsShape({
5123
+ ...child.data,
4995
5124
  outline: child.outline,
4996
5125
  solidFill: child.solidFill,
4997
5126
  transformation: child.transformation
4998
- }));
5127
+ });
4999
5128
  else return new Pic({
5000
5129
  mediaData: child,
5001
5130
  outline: child.outline,
@@ -5624,14 +5753,15 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
5624
5753
  var Anchor = class extends XmlComponent {
5625
5754
  constructor({ mediaData, transform, drawingOptions }) {
5626
5755
  super("wp:anchor");
5627
- const floating = _objectSpread2({
5756
+ const floating = {
5628
5757
  allowOverlap: true,
5629
5758
  behindDocument: false,
5630
5759
  horizontalPosition: {},
5631
5760
  layoutInCell: true,
5632
5761
  lockAnchor: false,
5633
- verticalPosition: {}
5634
- }, drawingOptions.floating);
5762
+ verticalPosition: {},
5763
+ ...drawingOptions.floating
5764
+ };
5635
5765
  this.root.push(new AnchorAttributes({
5636
5766
  distT: floating.margins ? floating.margins.top || 0 : 0,
5637
5767
  distB: floating.margins ? floating.margins.bottom || 0 : 0,
@@ -5817,8 +5947,18 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
5817
5947
  const key = `${hashedId(rawData)}.${options.type}`;
5818
5948
  if (options.type === "svg") {
5819
5949
  const fallbackData = (0, undio.toUint8Array)(options.fallback.data);
5820
- this.imageData = _objectSpread2(_objectSpread2({ type: options.type }, createImageData(rawData, options.transformation, key)), {}, { fallback: _objectSpread2({ type: options.fallback.type }, createImageData(fallbackData, options.transformation, `${hashedId(fallbackData)}.${options.fallback.type}`)) });
5821
- } else this.imageData = _objectSpread2({ type: options.type }, createImageData(rawData, options.transformation, key));
5950
+ this.imageData = {
5951
+ type: options.type,
5952
+ ...createImageData(rawData, options.transformation, key),
5953
+ fallback: {
5954
+ type: options.fallback.type,
5955
+ ...createImageData(fallbackData, options.transformation, `${hashedId(fallbackData)}.${options.fallback.type}`)
5956
+ }
5957
+ };
5958
+ } else this.imageData = {
5959
+ type: options.type,
5960
+ ...createImageData(rawData, options.transformation, key)
5961
+ };
5822
5962
  const drawing = new Drawing(this.imageData, {
5823
5963
  docProperties: options.altText,
5824
5964
  floating: options.floating,
@@ -5867,7 +6007,7 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
5867
6007
  super({});
5868
6008
  _defineProperty(this, "wpsShapeData", void 0);
5869
6009
  this.wpsShapeData = {
5870
- data: _objectSpread2({}, options),
6010
+ data: { ...options },
5871
6011
  transformation: createTransformation(options.transformation),
5872
6012
  type: options.type
5873
6013
  };
@@ -6967,7 +7107,7 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
6967
7107
  * });
6968
7108
  * ```
6969
7109
  */
6970
- const createSpacing = ({ after, before, line, lineRule, beforeAutoSpacing, afterAutoSpacing }) => new BuilderElement({
7110
+ const createSpacing = ({ after, before, line, lineRule, beforeAutoSpacing, afterAutoSpacing, beforeLines, afterLines }) => new BuilderElement({
6971
7111
  attributes: {
6972
7112
  after: {
6973
7113
  key: "w:after",
@@ -6977,6 +7117,10 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
6977
7117
  key: "w:afterAutospacing",
6978
7118
  value: afterAutoSpacing
6979
7119
  },
7120
+ afterLines: {
7121
+ key: "w:afterLines",
7122
+ value: afterLines === void 0 ? void 0 : decimalNumber(afterLines)
7123
+ },
6980
7124
  before: {
6981
7125
  key: "w:before",
6982
7126
  value: before
@@ -6985,6 +7129,10 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
6985
7129
  key: "w:beforeAutospacing",
6986
7130
  value: beforeAutoSpacing
6987
7131
  },
7132
+ beforeLines: {
7133
+ key: "w:beforeLines",
7134
+ value: beforeLines === void 0 ? void 0 : decimalNumber(beforeLines)
7135
+ },
6988
7136
  line: {
6989
7137
  key: "w:line",
6990
7138
  value: line
@@ -7095,6 +7243,7 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
7095
7243
  */
7096
7244
  const LeaderType = {
7097
7245
  DOT: "dot",
7246
+ HEAVY: "heavy",
7098
7247
  HYPHEN: "hyphen",
7099
7248
  MIDDLE_DOT: "middleDot",
7100
7249
  NONE: "none",
@@ -7894,13 +8043,16 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
7894
8043
  * Creates a font relationship element for embedding fonts.
7895
8044
  */
7896
8045
  const createFontRelationship = ({ id, fontKey, subsetted }, name) => new BuilderElement({
7897
- attributes: _objectSpread2({ id: {
7898
- key: "r:id",
7899
- value: id
7900
- } }, fontKey ? { fontKey: {
7901
- key: "w:fontKey",
7902
- value: `{${fontKey}}`
7903
- } } : {}),
8046
+ attributes: {
8047
+ id: {
8048
+ key: "r:id",
8049
+ value: id
8050
+ },
8051
+ ...fontKey ? { fontKey: {
8052
+ key: "w:fontKey",
8053
+ value: `{${fontKey}}`
8054
+ } } : {}
8055
+ },
7904
8056
  children: subsetted ? [new OnOffElement("w:subsetted", subsetted)] : [],
7905
8057
  name
7906
8058
  });
@@ -8138,7 +8290,10 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
8138
8290
  _defineProperty(this, "fontTable", void 0);
8139
8291
  _defineProperty(this, "relationships", void 0);
8140
8292
  _defineProperty(this, "fontOptionsWithKey", []);
8141
- this.fontOptionsWithKey = options.map((o) => _objectSpread2(_objectSpread2({}, o), {}, { fontKey: uniqueUuid() }));
8293
+ this.fontOptionsWithKey = options.map((o) => ({
8294
+ ...o,
8295
+ fontKey: uniqueUuid()
8296
+ }));
8142
8297
  this.fontTable = createFontTable(this.fontOptionsWithKey);
8143
8298
  this.relationships = new Relationships();
8144
8299
  for (let i = 0; i < options.length; i++) this.relationships.addRelationship(i + 1, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/font", `fonts/${options[i].name}.odttf`);
@@ -8556,7 +8711,10 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
8556
8711
  date: options.date,
8557
8712
  id: options.id
8558
8713
  }));
8559
- this.root.push(new ParagraphProperties(_objectSpread2(_objectSpread2({}, options), {}, { includeIfEmpty: true })));
8714
+ this.root.push(new ParagraphProperties({
8715
+ ...options,
8716
+ includeIfEmpty: true
8717
+ }));
8560
8718
  }
8561
8719
  };
8562
8720
  //#endregion
@@ -10771,7 +10929,10 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
10771
10929
  *
10772
10930
  * @publicApi
10773
10931
  */
10774
- const VerticalAlignSection = _objectSpread2(_objectSpread2({}, VerticalAlignTable), {}, { BOTH: "both" });
10932
+ const VerticalAlignSection = {
10933
+ ...VerticalAlignTable,
10934
+ BOTH: "both"
10935
+ };
10775
10936
  /**
10776
10937
  * @deprecated Use {@link VerticalAlignTable} for table cells or
10777
10938
  * {@link VerticalAlignSection} for section properties. This alias remains for
@@ -11288,7 +11449,10 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
11288
11449
  date: options.date,
11289
11450
  id: options.id
11290
11451
  }));
11291
- this.root.push(new TableCellProperties(_objectSpread2(_objectSpread2({}, options), {}, { includeIfEmpty: true })));
11452
+ this.root.push(new TableCellProperties({
11453
+ ...options,
11454
+ includeIfEmpty: true
11455
+ }));
11292
11456
  }
11293
11457
  };
11294
11458
  //#endregion
@@ -11832,7 +11996,10 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
11832
11996
  date: options.date,
11833
11997
  id: options.id
11834
11998
  }));
11835
- this.root.push(new TableProperties(_objectSpread2(_objectSpread2({}, options), {}, { includeIfEmpty: true })));
11999
+ this.root.push(new TableProperties({
12000
+ ...options,
12001
+ includeIfEmpty: true
12002
+ }));
11836
12003
  }
11837
12004
  };
11838
12005
  //#endregion
@@ -12077,7 +12244,10 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
12077
12244
  date: options.date,
12078
12245
  id: options.id
12079
12246
  }));
12080
- this.root.push(new TableRowProperties(_objectSpread2(_objectSpread2({}, options), {}, { includeIfEmpty: true })));
12247
+ this.root.push(new TableRowProperties({
12248
+ ...options,
12249
+ includeIfEmpty: true
12250
+ }));
12081
12251
  }
12082
12252
  };
12083
12253
  //#endregion
@@ -12476,8 +12646,14 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
12476
12646
  */
12477
12647
  var DocumentAttributes = class extends XmlAttributeComponent {
12478
12648
  constructor(ns, Ignorable) {
12479
- super(_objectSpread2({ Ignorable }, Object.fromEntries(ns.map((n) => [n, DocumentAttributeNamespaces[n]]))));
12480
- _defineProperty(this, "xmlKeys", _objectSpread2({ Ignorable: "mc:Ignorable" }, Object.fromEntries(Object.keys(DocumentAttributeNamespaces).map((key) => [key, `xmlns:${key}`]))));
12649
+ super({
12650
+ Ignorable,
12651
+ ...Object.fromEntries(ns.map((n) => [n, DocumentAttributeNamespaces[n]]))
12652
+ });
12653
+ _defineProperty(this, "xmlKeys", {
12654
+ Ignorable: "mc:Ignorable",
12655
+ ...Object.fromEntries(Object.keys(DocumentAttributeNamespaces).map((key) => [key, `xmlns:${key}`]))
12656
+ });
12481
12657
  }
12482
12658
  };
12483
12659
  //#endregion
@@ -16157,7 +16333,10 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
16157
16333
  if (((_options$hyphenation2 = options.hyphenation) === null || _options$hyphenation2 === void 0 ? void 0 : _options$hyphenation2.hyphenationZone) !== void 0) this.root.push(new NumberValueElement("w:hyphenationZone", options.hyphenation.hyphenationZone));
16158
16334
  if (((_options$hyphenation3 = options.hyphenation) === null || _options$hyphenation3 === void 0 ? void 0 : _options$hyphenation3.consecutiveHyphenLimit) !== void 0) this.root.push(new NumberValueElement("w:consecutiveHyphenLimit", options.hyphenation.consecutiveHyphenLimit));
16159
16335
  if (((_options$hyphenation4 = options.hyphenation) === null || _options$hyphenation4 === void 0 ? void 0 : _options$hyphenation4.doNotHyphenateCaps) !== void 0) this.root.push(new OnOffElement("w:doNotHyphenateCaps", options.hyphenation.doNotHyphenateCaps));
16160
- this.root.push(new Compatibility(_objectSpread2(_objectSpread2({}, options.compatibility), {}, { version: (_ref = (_options$compatibilit = (_options$compatibilit2 = options.compatibility) === null || _options$compatibilit2 === void 0 ? void 0 : _options$compatibilit2.version) !== null && _options$compatibilit !== void 0 ? _options$compatibilit : options.compatibilityModeVersion) !== null && _ref !== void 0 ? _ref : 15 })));
16336
+ this.root.push(new Compatibility({
16337
+ ...options.compatibility,
16338
+ version: (_ref = (_options$compatibilit = (_options$compatibilit2 = options.compatibility) === null || _options$compatibilit2 === void 0 ? void 0 : _options$compatibilit2.version) !== null && _options$compatibilit !== void 0 ? _options$compatibilit : options.compatibilityModeVersion) !== null && _ref !== void 0 ? _ref : 15
16339
+ }));
16161
16340
  }
16162
16341
  };
16163
16342
  //#endregion
@@ -16426,10 +16605,11 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
16426
16605
  super({
16427
16606
  styleId: options.id,
16428
16607
  type: "character"
16429
- }, _objectSpread2({
16608
+ }, {
16430
16609
  uiPriority: 99,
16431
- unhideWhenUsed: true
16432
- }, options));
16610
+ unhideWhenUsed: true,
16611
+ ...options
16612
+ });
16433
16613
  _defineProperty(this, "runProperties", void 0);
16434
16614
  this.runProperties = new RunProperties(options.run);
16435
16615
  this.root.push(this.runProperties);
@@ -16465,11 +16645,12 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
16465
16645
  */
16466
16646
  var HeadingStyle = class extends StyleForParagraph {
16467
16647
  constructor(options) {
16468
- super(_objectSpread2({
16648
+ super({
16469
16649
  basedOn: "Normal",
16470
16650
  next: "Normal",
16471
- quickFormat: true
16472
- }, options));
16651
+ quickFormat: true,
16652
+ ...options
16653
+ });
16473
16654
  }
16474
16655
  };
16475
16656
  /**
@@ -16486,10 +16667,11 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
16486
16667
  */
16487
16668
  var TitleStyle = class extends HeadingStyle {
16488
16669
  constructor(options) {
16489
- super(_objectSpread2({
16670
+ super({
16490
16671
  id: "Title",
16491
- name: "Title"
16492
- }, options));
16672
+ name: "Title",
16673
+ ...options
16674
+ });
16493
16675
  }
16494
16676
  };
16495
16677
  /**
@@ -16506,10 +16688,11 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
16506
16688
  */
16507
16689
  var Heading1Style = class extends HeadingStyle {
16508
16690
  constructor(options) {
16509
- super(_objectSpread2({
16691
+ super({
16510
16692
  id: "Heading1",
16511
- name: "Heading 1"
16512
- }, options));
16693
+ name: "Heading 1",
16694
+ ...options
16695
+ });
16513
16696
  }
16514
16697
  };
16515
16698
  /**
@@ -16519,10 +16702,11 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
16519
16702
  */
16520
16703
  var Heading2Style = class extends HeadingStyle {
16521
16704
  constructor(options) {
16522
- super(_objectSpread2({
16705
+ super({
16523
16706
  id: "Heading2",
16524
- name: "Heading 2"
16525
- }, options));
16707
+ name: "Heading 2",
16708
+ ...options
16709
+ });
16526
16710
  }
16527
16711
  };
16528
16712
  /**
@@ -16532,10 +16716,11 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
16532
16716
  */
16533
16717
  var Heading3Style = class extends HeadingStyle {
16534
16718
  constructor(options) {
16535
- super(_objectSpread2({
16719
+ super({
16536
16720
  id: "Heading3",
16537
- name: "Heading 3"
16538
- }, options));
16721
+ name: "Heading 3",
16722
+ ...options
16723
+ });
16539
16724
  }
16540
16725
  };
16541
16726
  /**
@@ -16545,10 +16730,11 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
16545
16730
  */
16546
16731
  var Heading4Style = class extends HeadingStyle {
16547
16732
  constructor(options) {
16548
- super(_objectSpread2({
16733
+ super({
16549
16734
  id: "Heading4",
16550
- name: "Heading 4"
16551
- }, options));
16735
+ name: "Heading 4",
16736
+ ...options
16737
+ });
16552
16738
  }
16553
16739
  };
16554
16740
  /**
@@ -16558,10 +16744,11 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
16558
16744
  */
16559
16745
  var Heading5Style = class extends HeadingStyle {
16560
16746
  constructor(options) {
16561
- super(_objectSpread2({
16747
+ super({
16562
16748
  id: "Heading5",
16563
- name: "Heading 5"
16564
- }, options));
16749
+ name: "Heading 5",
16750
+ ...options
16751
+ });
16565
16752
  }
16566
16753
  };
16567
16754
  /**
@@ -16571,10 +16758,11 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
16571
16758
  */
16572
16759
  var Heading6Style = class extends HeadingStyle {
16573
16760
  constructor(options) {
16574
- super(_objectSpread2({
16761
+ super({
16575
16762
  id: "Heading6",
16576
- name: "Heading 6"
16577
- }, options));
16763
+ name: "Heading 6",
16764
+ ...options
16765
+ });
16578
16766
  }
16579
16767
  };
16580
16768
  /**
@@ -16584,10 +16772,11 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
16584
16772
  */
16585
16773
  var StrongStyle = class extends HeadingStyle {
16586
16774
  constructor(options) {
16587
- super(_objectSpread2({
16775
+ super({
16588
16776
  id: "Strong",
16589
- name: "Strong"
16590
- }, options));
16777
+ name: "Strong",
16778
+ ...options
16779
+ });
16591
16780
  }
16592
16781
  };
16593
16782
  /**
@@ -16597,12 +16786,13 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
16597
16786
  */
16598
16787
  var ListParagraph = class extends StyleForParagraph {
16599
16788
  constructor(options) {
16600
- super(_objectSpread2({
16789
+ super({
16601
16790
  basedOn: "Normal",
16602
16791
  id: "ListParagraph",
16603
16792
  name: "List Paragraph",
16604
- quickFormat: true
16605
- }, options));
16793
+ quickFormat: true,
16794
+ ...options
16795
+ });
16606
16796
  }
16607
16797
  };
16608
16798
  /**
@@ -16612,7 +16802,7 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
16612
16802
  */
16613
16803
  var FootnoteText = class extends StyleForParagraph {
16614
16804
  constructor(options) {
16615
- super(_objectSpread2({
16805
+ super({
16616
16806
  basedOn: "Normal",
16617
16807
  id: "FootnoteText",
16618
16808
  link: "FootnoteTextChar",
@@ -16625,8 +16815,9 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
16625
16815
  run: { size: 20 },
16626
16816
  semiHidden: true,
16627
16817
  uiPriority: 99,
16628
- unhideWhenUsed: true
16629
- }, options));
16818
+ unhideWhenUsed: true,
16819
+ ...options
16820
+ });
16630
16821
  }
16631
16822
  };
16632
16823
  /**
@@ -16636,13 +16827,14 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
16636
16827
  */
16637
16828
  var FootnoteReferenceStyle = class extends StyleForCharacter {
16638
16829
  constructor(options) {
16639
- super(_objectSpread2({
16830
+ super({
16640
16831
  basedOn: "DefaultParagraphFont",
16641
16832
  id: "FootnoteReference",
16642
16833
  name: "footnote reference",
16643
16834
  run: { superScript: true },
16644
- semiHidden: true
16645
- }, options));
16835
+ semiHidden: true,
16836
+ ...options
16837
+ });
16646
16838
  }
16647
16839
  };
16648
16840
  /**
@@ -16652,14 +16844,15 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
16652
16844
  */
16653
16845
  var FootnoteTextChar = class extends StyleForCharacter {
16654
16846
  constructor(options) {
16655
- super(_objectSpread2({
16847
+ super({
16656
16848
  basedOn: "DefaultParagraphFont",
16657
16849
  id: "FootnoteTextChar",
16658
16850
  link: "FootnoteText",
16659
16851
  name: "Footnote Text Char",
16660
16852
  run: { size: 20 },
16661
- semiHidden: true
16662
- }, options));
16853
+ semiHidden: true,
16854
+ ...options
16855
+ });
16663
16856
  }
16664
16857
  };
16665
16858
  /**
@@ -16669,7 +16862,7 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
16669
16862
  */
16670
16863
  var EndnoteText = class extends StyleForParagraph {
16671
16864
  constructor(options) {
16672
- super(_objectSpread2({
16865
+ super({
16673
16866
  basedOn: "Normal",
16674
16867
  id: "EndnoteText",
16675
16868
  link: "EndnoteTextChar",
@@ -16682,8 +16875,9 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
16682
16875
  run: { size: 20 },
16683
16876
  semiHidden: true,
16684
16877
  uiPriority: 99,
16685
- unhideWhenUsed: true
16686
- }, options));
16878
+ unhideWhenUsed: true,
16879
+ ...options
16880
+ });
16687
16881
  }
16688
16882
  };
16689
16883
  /**
@@ -16693,13 +16887,14 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
16693
16887
  */
16694
16888
  var EndnoteReferenceStyle = class extends StyleForCharacter {
16695
16889
  constructor(options) {
16696
- super(_objectSpread2({
16890
+ super({
16697
16891
  basedOn: "DefaultParagraphFont",
16698
16892
  id: "EndnoteReference",
16699
16893
  name: "endnote reference",
16700
16894
  run: { superScript: true },
16701
- semiHidden: true
16702
- }, options));
16895
+ semiHidden: true,
16896
+ ...options
16897
+ });
16703
16898
  }
16704
16899
  };
16705
16900
  /**
@@ -16709,14 +16904,15 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
16709
16904
  */
16710
16905
  var EndnoteTextChar = class extends StyleForCharacter {
16711
16906
  constructor(options) {
16712
- super(_objectSpread2({
16907
+ super({
16713
16908
  basedOn: "DefaultParagraphFont",
16714
16909
  id: "EndnoteTextChar",
16715
16910
  link: "EndnoteText",
16716
16911
  name: "Endnote Text Char",
16717
16912
  run: { size: 20 },
16718
- semiHidden: true
16719
- }, options));
16913
+ semiHidden: true,
16914
+ ...options
16915
+ });
16720
16916
  }
16721
16917
  };
16722
16918
  /**
@@ -16726,15 +16922,16 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
16726
16922
  */
16727
16923
  var HyperlinkStyle = class extends StyleForCharacter {
16728
16924
  constructor(options) {
16729
- super(_objectSpread2({
16925
+ super({
16730
16926
  basedOn: "DefaultParagraphFont",
16731
16927
  id: "Hyperlink",
16732
16928
  name: "Hyperlink",
16733
16929
  run: {
16734
16930
  color: "0563C1",
16735
16931
  underline: { type: UnderlineType.SINGLE }
16736
- }
16737
- }, options));
16932
+ },
16933
+ ...options
16934
+ });
16738
16935
  }
16739
16936
  };
16740
16937
  //#endregion
@@ -17004,26 +17201,50 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
17004
17201
  return {
17005
17202
  importedStyles: [
17006
17203
  new DocumentDefaults((_options$document = options.document) !== null && _options$document !== void 0 ? _options$document : {}),
17007
- new TitleStyle(_objectSpread2({ run: { size: 56 } }, options.title)),
17008
- new Heading1Style(_objectSpread2({ run: {
17009
- color: "2E74B5",
17010
- size: 32
17011
- } }, options.heading1)),
17012
- new Heading2Style(_objectSpread2({ run: {
17013
- color: "2E74B5",
17014
- size: 26
17015
- } }, options.heading2)),
17016
- new Heading3Style(_objectSpread2({ run: {
17017
- color: "1F4D78",
17018
- size: 24
17019
- } }, options.heading3)),
17020
- new Heading4Style(_objectSpread2({ run: {
17021
- color: "2E74B5",
17022
- italics: true
17023
- } }, options.heading4)),
17024
- new Heading5Style(_objectSpread2({ run: { color: "2E74B5" } }, options.heading5)),
17025
- new Heading6Style(_objectSpread2({ run: { color: "1F4D78" } }, options.heading6)),
17026
- new StrongStyle(_objectSpread2({ run: { bold: true } }, options.strong)),
17204
+ new TitleStyle({
17205
+ run: { size: 56 },
17206
+ ...options.title
17207
+ }),
17208
+ new Heading1Style({
17209
+ run: {
17210
+ color: "2E74B5",
17211
+ size: 32
17212
+ },
17213
+ ...options.heading1
17214
+ }),
17215
+ new Heading2Style({
17216
+ run: {
17217
+ color: "2E74B5",
17218
+ size: 26
17219
+ },
17220
+ ...options.heading2
17221
+ }),
17222
+ new Heading3Style({
17223
+ run: {
17224
+ color: "1F4D78",
17225
+ size: 24
17226
+ },
17227
+ ...options.heading3
17228
+ }),
17229
+ new Heading4Style({
17230
+ run: {
17231
+ color: "2E74B5",
17232
+ italics: true
17233
+ },
17234
+ ...options.heading4
17235
+ }),
17236
+ new Heading5Style({
17237
+ run: { color: "2E74B5" },
17238
+ ...options.heading5
17239
+ }),
17240
+ new Heading6Style({
17241
+ run: { color: "1F4D78" },
17242
+ ...options.heading6
17243
+ }),
17244
+ new StrongStyle({
17245
+ run: { bold: true },
17246
+ ...options.strong
17247
+ }),
17027
17248
  new ListParagraph(options.listParagraph || {}),
17028
17249
  new HyperlinkStyle(options.hyperlink || {}),
17029
17250
  new FootnoteReferenceStyle(options.footnoteReference || {}),
@@ -17141,11 +17362,12 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
17141
17362
  _defineProperty(this, "styles", void 0);
17142
17363
  _defineProperty(this, "comments", void 0);
17143
17364
  _defineProperty(this, "fontWrapper", void 0);
17144
- this.coreProperties = new CoreProperties(_objectSpread2(_objectSpread2({}, options), {}, {
17365
+ this.coreProperties = new CoreProperties({
17366
+ ...options,
17145
17367
  creator: (_options$creator = options.creator) !== null && _options$creator !== void 0 ? _options$creator : "Un-named",
17146
17368
  lastModifiedBy: (_options$lastModified = options.lastModifiedBy) !== null && _options$lastModified !== void 0 ? _options$lastModified : "Un-named",
17147
17369
  revision: (_options$revision = options.revision) !== null && _options$revision !== void 0 ? _options$revision : 1
17148
- }));
17370
+ });
17149
17371
  this.numbering = new Numbering(options.numbering ? options.numbering : { config: [] });
17150
17372
  this.comments = new Comments((_options$comments = options.comments) !== null && _options$comments !== void 0 ? _options$comments : { children: [] });
17151
17373
  this.fileRelationships = new Relationships();
@@ -17174,8 +17396,14 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
17174
17396
  var _options$styles;
17175
17397
  const defaultStyles = new DefaultStylesFactory().newInstance((_options$styles = options.styles) === null || _options$styles === void 0 ? void 0 : _options$styles.default);
17176
17398
  const externalStyles = new ExternalStylesFactory().newInstance(options.externalStyles);
17177
- this.styles = new Styles(_objectSpread2(_objectSpread2({}, externalStyles), {}, { importedStyles: [...defaultStyles.importedStyles, ...externalStyles.importedStyles] }));
17178
- } else if (options.styles) this.styles = new Styles(_objectSpread2(_objectSpread2({}, new DefaultStylesFactory().newInstance(options.styles.default)), options.styles));
17399
+ this.styles = new Styles({
17400
+ ...externalStyles,
17401
+ importedStyles: [...defaultStyles.importedStyles, ...externalStyles.importedStyles]
17402
+ });
17403
+ } else if (options.styles) this.styles = new Styles({
17404
+ ...new DefaultStylesFactory().newInstance(options.styles.default),
17405
+ ...options.styles
17406
+ });
17179
17407
  else this.styles = new Styles(new DefaultStylesFactory().newInstance());
17180
17408
  this.addDefaultRelationships();
17181
17409
  for (const section of options.sections) this.addSection(section);
@@ -17184,7 +17412,8 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
17184
17412
  this.fontWrapper = new FontWrapper((_options$fonts = options.fonts) !== null && _options$fonts !== void 0 ? _options$fonts : []);
17185
17413
  }
17186
17414
  addSection({ headers = {}, footers = {}, children, properties }) {
17187
- this.documentWrapper.View.Body.addSection(_objectSpread2(_objectSpread2({}, properties), {}, {
17415
+ this.documentWrapper.View.Body.addSection({
17416
+ ...properties,
17188
17417
  footerWrapperGroup: {
17189
17418
  default: footers.default ? this.createFooter(footers.default) : void 0,
17190
17419
  even: footers.even ? this.createFooter(footers.even) : void 0,
@@ -17195,7 +17424,7 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
17195
17424
  even: headers.even ? this.createHeader(headers.even) : void 0,
17196
17425
  first: headers.first ? this.createHeader(headers.first) : void 0
17197
17426
  }
17198
- }));
17427
+ });
17199
17428
  for (const child of children) this.documentWrapper.View.add(child);
17200
17429
  }
17201
17430
  createHeader(header) {
@@ -17452,28 +17681,6 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
17452
17681
  }
17453
17682
  };
17454
17683
  //#endregion
17455
- //#region \0@oxc-project+runtime@0.123.0/helpers/objectWithoutPropertiesLoose.js
17456
- function _objectWithoutPropertiesLoose(r, e) {
17457
- if (null == r) return {};
17458
- var t = {};
17459
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
17460
- if (e.includes(n)) continue;
17461
- t[n] = r[n];
17462
- }
17463
- return t;
17464
- }
17465
- //#endregion
17466
- //#region \0@oxc-project+runtime@0.123.0/helpers/objectWithoutProperties.js
17467
- function _objectWithoutProperties(e, t) {
17468
- if (null == e) return {};
17469
- var o, r, i = _objectWithoutPropertiesLoose(e, t);
17470
- if (Object.getOwnPropertySymbols) {
17471
- var s = Object.getOwnPropertySymbols(e);
17472
- for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
17473
- }
17474
- return i;
17475
- }
17476
- //#endregion
17477
17684
  //#region src/file/table-of-contents/table-of-contents.ts
17478
17685
  /**
17479
17686
  * Table of Contents module for WordprocessingML documents.
@@ -17485,11 +17692,6 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
17485
17692
  *
17486
17693
  * @module
17487
17694
  */
17488
- const _excluded$1 = [
17489
- "contentChildren",
17490
- "cachedEntries",
17491
- "beginDirty"
17492
- ];
17493
17695
  /**
17494
17696
  * Represents a Table of Contents in a WordprocessingML document.
17495
17697
  *
@@ -17520,8 +17722,7 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
17520
17722
  * ```
17521
17723
  */
17522
17724
  var TableOfContents = class extends FileChild {
17523
- constructor(alias = "Table of Contents", _ref = {}) {
17524
- let { contentChildren = [], cachedEntries = [], beginDirty = true } = _ref, properties = _objectWithoutProperties(_ref, _excluded$1);
17725
+ constructor(alias = "Table of Contents", { contentChildren = [], cachedEntries = [], beginDirty = true, ...properties } = {}) {
17525
17726
  super("w:sdt");
17526
17727
  this.root.push(new StructuredDocumentTagProperties(alias));
17527
17728
  const content = new StructuredDocumentTagContent();
@@ -18217,7 +18418,6 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
18217
18418
  *
18218
18419
  * @module
18219
18420
  */
18220
- const _excluded = ["style", "children"];
18221
18421
  /**
18222
18422
  * Represents a textbox in a WordprocessingML document.
18223
18423
  *
@@ -18267,8 +18467,7 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
18267
18467
  * ```
18268
18468
  */
18269
18469
  var Textbox = class extends FileChild {
18270
- constructor(_ref) {
18271
- let { style, children } = _ref, rest = _objectWithoutProperties(_ref, _excluded);
18470
+ constructor({ style, children, ...rest }) {
18272
18471
  super("w:p");
18273
18472
  this.root.push(new ParagraphProperties(rest));
18274
18473
  this.root.push(createPictElement({ shape: createShape({
@@ -18279,49 +18478,3185 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
18279
18478
  }
18280
18479
  };
18281
18480
  //#endregion
18282
- //#region src/util/output-type.ts
18481
+ //#region \0polyfill-node.events.js
18482
+ var domain;
18483
+ function EventHandlers() {}
18484
+ EventHandlers.prototype = Object.create(null);
18485
+ function EventEmitter() {
18486
+ EventEmitter.init.call(this);
18487
+ }
18488
+ EventEmitter.EventEmitter = EventEmitter;
18489
+ EventEmitter.usingDomains = false;
18490
+ EventEmitter.prototype.domain = void 0;
18491
+ EventEmitter.prototype._events = void 0;
18492
+ EventEmitter.prototype._maxListeners = void 0;
18493
+ EventEmitter.defaultMaxListeners = 10;
18494
+ EventEmitter.init = function() {
18495
+ this.domain = null;
18496
+ if (EventEmitter.usingDomains) {
18497
+ if (domain.active && !(this instanceof domain.Domain)) this.domain = domain.active;
18498
+ }
18499
+ if (!this._events || this._events === Object.getPrototypeOf(this)._events) {
18500
+ this._events = new EventHandlers();
18501
+ this._eventsCount = 0;
18502
+ }
18503
+ this._maxListeners = this._maxListeners || void 0;
18504
+ };
18505
+ EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
18506
+ if (typeof n !== "number" || n < 0 || isNaN(n)) throw new TypeError("\"n\" argument must be a positive number");
18507
+ this._maxListeners = n;
18508
+ return this;
18509
+ };
18510
+ function $getMaxListeners(that) {
18511
+ if (that._maxListeners === void 0) return EventEmitter.defaultMaxListeners;
18512
+ return that._maxListeners;
18513
+ }
18514
+ EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
18515
+ return $getMaxListeners(this);
18516
+ };
18517
+ function emitNone(handler, isFn, self) {
18518
+ if (isFn) handler.call(self);
18519
+ else {
18520
+ var len = handler.length;
18521
+ var listeners = arrayClone(handler, len);
18522
+ for (var i = 0; i < len; ++i) listeners[i].call(self);
18523
+ }
18524
+ }
18525
+ function emitOne(handler, isFn, self, arg1) {
18526
+ if (isFn) handler.call(self, arg1);
18527
+ else {
18528
+ var len = handler.length;
18529
+ var listeners = arrayClone(handler, len);
18530
+ for (var i = 0; i < len; ++i) listeners[i].call(self, arg1);
18531
+ }
18532
+ }
18533
+ function emitTwo(handler, isFn, self, arg1, arg2) {
18534
+ if (isFn) handler.call(self, arg1, arg2);
18535
+ else {
18536
+ var len = handler.length;
18537
+ var listeners = arrayClone(handler, len);
18538
+ for (var i = 0; i < len; ++i) listeners[i].call(self, arg1, arg2);
18539
+ }
18540
+ }
18541
+ function emitThree(handler, isFn, self, arg1, arg2, arg3) {
18542
+ if (isFn) handler.call(self, arg1, arg2, arg3);
18543
+ else {
18544
+ var len = handler.length;
18545
+ var listeners = arrayClone(handler, len);
18546
+ for (var i = 0; i < len; ++i) listeners[i].call(self, arg1, arg2, arg3);
18547
+ }
18548
+ }
18549
+ function emitMany(handler, isFn, self, args) {
18550
+ if (isFn) handler.apply(self, args);
18551
+ else {
18552
+ var len = handler.length;
18553
+ var listeners = arrayClone(handler, len);
18554
+ for (var i = 0; i < len; ++i) listeners[i].apply(self, args);
18555
+ }
18556
+ }
18557
+ EventEmitter.prototype.emit = function emit(type) {
18558
+ var er, handler, len, args, i, events, domain;
18559
+ var needDomainExit = false;
18560
+ var doError = type === "error";
18561
+ events = this._events;
18562
+ if (events) doError = doError && events.error == null;
18563
+ else if (!doError) return false;
18564
+ domain = this.domain;
18565
+ if (doError) {
18566
+ er = arguments[1];
18567
+ if (domain) {
18568
+ if (!er) er = /* @__PURE__ */ new Error("Uncaught, unspecified \"error\" event");
18569
+ er.domainEmitter = this;
18570
+ er.domain = domain;
18571
+ er.domainThrown = false;
18572
+ domain.emit("error", er);
18573
+ } else if (er instanceof Error) throw er;
18574
+ else {
18575
+ var err = /* @__PURE__ */ new Error("Uncaught, unspecified \"error\" event. (" + er + ")");
18576
+ err.context = er;
18577
+ throw err;
18578
+ }
18579
+ return false;
18580
+ }
18581
+ handler = events[type];
18582
+ if (!handler) return false;
18583
+ var isFn = typeof handler === "function";
18584
+ len = arguments.length;
18585
+ switch (len) {
18586
+ case 1:
18587
+ emitNone(handler, isFn, this);
18588
+ break;
18589
+ case 2:
18590
+ emitOne(handler, isFn, this, arguments[1]);
18591
+ break;
18592
+ case 3:
18593
+ emitTwo(handler, isFn, this, arguments[1], arguments[2]);
18594
+ break;
18595
+ case 4:
18596
+ emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]);
18597
+ break;
18598
+ default:
18599
+ args = new Array(len - 1);
18600
+ for (i = 1; i < len; i++) args[i - 1] = arguments[i];
18601
+ emitMany(handler, isFn, this, args);
18602
+ }
18603
+ if (needDomainExit) domain.exit();
18604
+ return true;
18605
+ };
18606
+ function _addListener(target, type, listener, prepend) {
18607
+ var m;
18608
+ var events;
18609
+ var existing;
18610
+ if (typeof listener !== "function") throw new TypeError("\"listener\" argument must be a function");
18611
+ events = target._events;
18612
+ if (!events) {
18613
+ events = target._events = new EventHandlers();
18614
+ target._eventsCount = 0;
18615
+ } else {
18616
+ if (events.newListener) {
18617
+ target.emit("newListener", type, listener.listener ? listener.listener : listener);
18618
+ events = target._events;
18619
+ }
18620
+ existing = events[type];
18621
+ }
18622
+ if (!existing) {
18623
+ existing = events[type] = listener;
18624
+ ++target._eventsCount;
18625
+ } else {
18626
+ if (typeof existing === "function") existing = events[type] = prepend ? [listener, existing] : [existing, listener];
18627
+ else if (prepend) existing.unshift(listener);
18628
+ else existing.push(listener);
18629
+ if (!existing.warned) {
18630
+ m = $getMaxListeners(target);
18631
+ if (m && m > 0 && existing.length > m) {
18632
+ existing.warned = true;
18633
+ var w = /* @__PURE__ */ new Error("Possible EventEmitter memory leak detected. " + existing.length + " " + type + " listeners added. Use emitter.setMaxListeners() to increase limit");
18634
+ w.name = "MaxListenersExceededWarning";
18635
+ w.emitter = target;
18636
+ w.type = type;
18637
+ w.count = existing.length;
18638
+ emitWarning(w);
18639
+ }
18640
+ }
18641
+ }
18642
+ return target;
18643
+ }
18644
+ function emitWarning(e) {
18645
+ typeof console.warn === "function" ? console.warn(e) : console.log(e);
18646
+ }
18647
+ EventEmitter.prototype.addListener = function addListener(type, listener) {
18648
+ return _addListener(this, type, listener, false);
18649
+ };
18650
+ EventEmitter.prototype.on = EventEmitter.prototype.addListener;
18651
+ EventEmitter.prototype.prependListener = function prependListener(type, listener) {
18652
+ return _addListener(this, type, listener, true);
18653
+ };
18654
+ function _onceWrap(target, type, listener) {
18655
+ var fired = false;
18656
+ function g() {
18657
+ target.removeListener(type, g);
18658
+ if (!fired) {
18659
+ fired = true;
18660
+ listener.apply(target, arguments);
18661
+ }
18662
+ }
18663
+ g.listener = listener;
18664
+ return g;
18665
+ }
18666
+ EventEmitter.prototype.once = function once(type, listener) {
18667
+ if (typeof listener !== "function") throw new TypeError("\"listener\" argument must be a function");
18668
+ this.on(type, _onceWrap(this, type, listener));
18669
+ return this;
18670
+ };
18671
+ EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) {
18672
+ if (typeof listener !== "function") throw new TypeError("\"listener\" argument must be a function");
18673
+ this.prependListener(type, _onceWrap(this, type, listener));
18674
+ return this;
18675
+ };
18676
+ EventEmitter.prototype.removeListener = function removeListener(type, listener) {
18677
+ var list, events, position, i, originalListener;
18678
+ if (typeof listener !== "function") throw new TypeError("\"listener\" argument must be a function");
18679
+ events = this._events;
18680
+ if (!events) return this;
18681
+ list = events[type];
18682
+ if (!list) return this;
18683
+ if (list === listener || list.listener && list.listener === listener) if (--this._eventsCount === 0) this._events = new EventHandlers();
18684
+ else {
18685
+ delete events[type];
18686
+ if (events.removeListener) this.emit("removeListener", type, list.listener || listener);
18687
+ }
18688
+ else if (typeof list !== "function") {
18689
+ position = -1;
18690
+ for (i = list.length; i-- > 0;) if (list[i] === listener || list[i].listener && list[i].listener === listener) {
18691
+ originalListener = list[i].listener;
18692
+ position = i;
18693
+ break;
18694
+ }
18695
+ if (position < 0) return this;
18696
+ if (list.length === 1) {
18697
+ list[0] = void 0;
18698
+ if (--this._eventsCount === 0) {
18699
+ this._events = new EventHandlers();
18700
+ return this;
18701
+ } else delete events[type];
18702
+ } else spliceOne(list, position);
18703
+ if (events.removeListener) this.emit("removeListener", type, originalListener || listener);
18704
+ }
18705
+ return this;
18706
+ };
18707
+ EventEmitter.prototype.off = function(type, listener) {
18708
+ return this.removeListener(type, listener);
18709
+ };
18710
+ EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) {
18711
+ var listeners, events = this._events;
18712
+ if (!events) return this;
18713
+ if (!events.removeListener) {
18714
+ if (arguments.length === 0) {
18715
+ this._events = new EventHandlers();
18716
+ this._eventsCount = 0;
18717
+ } else if (events[type]) if (--this._eventsCount === 0) this._events = new EventHandlers();
18718
+ else delete events[type];
18719
+ return this;
18720
+ }
18721
+ if (arguments.length === 0) {
18722
+ var keys = Object.keys(events);
18723
+ for (var i = 0, key; i < keys.length; ++i) {
18724
+ key = keys[i];
18725
+ if (key === "removeListener") continue;
18726
+ this.removeAllListeners(key);
18727
+ }
18728
+ this.removeAllListeners("removeListener");
18729
+ this._events = new EventHandlers();
18730
+ this._eventsCount = 0;
18731
+ return this;
18732
+ }
18733
+ listeners = events[type];
18734
+ if (typeof listeners === "function") this.removeListener(type, listeners);
18735
+ else if (listeners) do
18736
+ this.removeListener(type, listeners[listeners.length - 1]);
18737
+ while (listeners[0]);
18738
+ return this;
18739
+ };
18740
+ EventEmitter.prototype.listeners = function listeners(type) {
18741
+ var evlistener;
18742
+ var ret;
18743
+ var events = this._events;
18744
+ if (!events) ret = [];
18745
+ else {
18746
+ evlistener = events[type];
18747
+ if (!evlistener) ret = [];
18748
+ else if (typeof evlistener === "function") ret = [evlistener.listener || evlistener];
18749
+ else ret = unwrapListeners(evlistener);
18750
+ }
18751
+ return ret;
18752
+ };
18753
+ EventEmitter.listenerCount = function(emitter, type) {
18754
+ if (typeof emitter.listenerCount === "function") return emitter.listenerCount(type);
18755
+ else return listenerCount$1.call(emitter, type);
18756
+ };
18757
+ EventEmitter.prototype.listenerCount = listenerCount$1;
18758
+ function listenerCount$1(type) {
18759
+ var events = this._events;
18760
+ if (events) {
18761
+ var evlistener = events[type];
18762
+ if (typeof evlistener === "function") return 1;
18763
+ else if (evlistener) return evlistener.length;
18764
+ }
18765
+ return 0;
18766
+ }
18767
+ EventEmitter.prototype.eventNames = function eventNames() {
18768
+ return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];
18769
+ };
18770
+ function spliceOne(list, index) {
18771
+ for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) list[i] = list[k];
18772
+ list.pop();
18773
+ }
18774
+ function arrayClone(arr, i) {
18775
+ var copy = new Array(i);
18776
+ while (i--) copy[i] = arr[i];
18777
+ return copy;
18778
+ }
18779
+ function unwrapListeners(arr) {
18780
+ var ret = new Array(arr.length);
18781
+ for (var i = 0; i < ret.length; ++i) ret[i] = arr[i].listener || arr[i];
18782
+ return ret;
18783
+ }
18784
+ //#endregion
18785
+ //#region \0polyfill-node.global.js
18786
+ var _polyfill_node_global_default = typeof _polyfill_node_global_default !== "undefined" ? _polyfill_node_global_default : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};
18787
+ //#endregion
18788
+ //#region \0polyfill-node.buffer.js
18789
+ var lookup = [];
18790
+ var revLookup = [];
18791
+ var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
18792
+ var inited = false;
18793
+ function init() {
18794
+ inited = true;
18795
+ var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
18796
+ for (var i = 0, len = code.length; i < len; ++i) {
18797
+ lookup[i] = code[i];
18798
+ revLookup[code.charCodeAt(i)] = i;
18799
+ }
18800
+ revLookup["-".charCodeAt(0)] = 62;
18801
+ revLookup["_".charCodeAt(0)] = 63;
18802
+ }
18803
+ function toByteArray(b64) {
18804
+ if (!inited) init();
18805
+ var i, j, l, tmp, placeHolders, arr;
18806
+ var len = b64.length;
18807
+ if (len % 4 > 0) throw new Error("Invalid string. Length must be a multiple of 4");
18808
+ placeHolders = b64[len - 2] === "=" ? 2 : b64[len - 1] === "=" ? 1 : 0;
18809
+ arr = new Arr(len * 3 / 4 - placeHolders);
18810
+ l = placeHolders > 0 ? len - 4 : len;
18811
+ var L = 0;
18812
+ for (i = 0, j = 0; i < l; i += 4, j += 3) {
18813
+ tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];
18814
+ arr[L++] = tmp >> 16 & 255;
18815
+ arr[L++] = tmp >> 8 & 255;
18816
+ arr[L++] = tmp & 255;
18817
+ }
18818
+ if (placeHolders === 2) {
18819
+ tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4;
18820
+ arr[L++] = tmp & 255;
18821
+ } else if (placeHolders === 1) {
18822
+ tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2;
18823
+ arr[L++] = tmp >> 8 & 255;
18824
+ arr[L++] = tmp & 255;
18825
+ }
18826
+ return arr;
18827
+ }
18828
+ function tripletToBase64(num) {
18829
+ return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];
18830
+ }
18831
+ function encodeChunk(uint8, start, end) {
18832
+ var tmp;
18833
+ var output = [];
18834
+ for (var i = start; i < end; i += 3) {
18835
+ tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + uint8[i + 2];
18836
+ output.push(tripletToBase64(tmp));
18837
+ }
18838
+ return output.join("");
18839
+ }
18840
+ function fromByteArray(uint8) {
18841
+ if (!inited) init();
18842
+ var tmp;
18843
+ var len = uint8.length;
18844
+ var extraBytes = len % 3;
18845
+ var output = "";
18846
+ var parts = [];
18847
+ var maxChunkLength = 16383;
18848
+ for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength));
18849
+ if (extraBytes === 1) {
18850
+ tmp = uint8[len - 1];
18851
+ output += lookup[tmp >> 2];
18852
+ output += lookup[tmp << 4 & 63];
18853
+ output += "==";
18854
+ } else if (extraBytes === 2) {
18855
+ tmp = (uint8[len - 2] << 8) + uint8[len - 1];
18856
+ output += lookup[tmp >> 10];
18857
+ output += lookup[tmp >> 4 & 63];
18858
+ output += lookup[tmp << 2 & 63];
18859
+ output += "=";
18860
+ }
18861
+ parts.push(output);
18862
+ return parts.join("");
18863
+ }
18864
+ function read(buffer, offset, isLE, mLen, nBytes) {
18865
+ var e, m;
18866
+ var eLen = nBytes * 8 - mLen - 1;
18867
+ var eMax = (1 << eLen) - 1;
18868
+ var eBias = eMax >> 1;
18869
+ var nBits = -7;
18870
+ var i = isLE ? nBytes - 1 : 0;
18871
+ var d = isLE ? -1 : 1;
18872
+ var s = buffer[offset + i];
18873
+ i += d;
18874
+ e = s & (1 << -nBits) - 1;
18875
+ s >>= -nBits;
18876
+ nBits += eLen;
18877
+ for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8);
18878
+ m = e & (1 << -nBits) - 1;
18879
+ e >>= -nBits;
18880
+ nBits += mLen;
18881
+ for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8);
18882
+ if (e === 0) e = 1 - eBias;
18883
+ else if (e === eMax) return m ? NaN : (s ? -1 : 1) * Infinity;
18884
+ else {
18885
+ m = m + Math.pow(2, mLen);
18886
+ e = e - eBias;
18887
+ }
18888
+ return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
18889
+ }
18890
+ function write(buffer, value, offset, isLE, mLen, nBytes) {
18891
+ var e, m, c;
18892
+ var eLen = nBytes * 8 - mLen - 1;
18893
+ var eMax = (1 << eLen) - 1;
18894
+ var eBias = eMax >> 1;
18895
+ var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
18896
+ var i = isLE ? 0 : nBytes - 1;
18897
+ var d = isLE ? 1 : -1;
18898
+ var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
18899
+ value = Math.abs(value);
18900
+ if (isNaN(value) || value === Infinity) {
18901
+ m = isNaN(value) ? 1 : 0;
18902
+ e = eMax;
18903
+ } else {
18904
+ e = Math.floor(Math.log(value) / Math.LN2);
18905
+ if (value * (c = Math.pow(2, -e)) < 1) {
18906
+ e--;
18907
+ c *= 2;
18908
+ }
18909
+ if (e + eBias >= 1) value += rt / c;
18910
+ else value += rt * Math.pow(2, 1 - eBias);
18911
+ if (value * c >= 2) {
18912
+ e++;
18913
+ c /= 2;
18914
+ }
18915
+ if (e + eBias >= eMax) {
18916
+ m = 0;
18917
+ e = eMax;
18918
+ } else if (e + eBias >= 1) {
18919
+ m = (value * c - 1) * Math.pow(2, mLen);
18920
+ e = e + eBias;
18921
+ } else {
18922
+ m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
18923
+ e = 0;
18924
+ }
18925
+ }
18926
+ for (; mLen >= 8; buffer[offset + i] = m & 255, i += d, m /= 256, mLen -= 8);
18927
+ e = e << mLen | m;
18928
+ eLen += mLen;
18929
+ for (; eLen > 0; buffer[offset + i] = e & 255, i += d, e /= 256, eLen -= 8);
18930
+ buffer[offset + i - d] |= s * 128;
18931
+ }
18932
+ var toString = {}.toString;
18933
+ var isArray$1 = Array.isArray || function(arr) {
18934
+ return toString.call(arr) == "[object Array]";
18935
+ };
18283
18936
  /**
18284
- * Output type definitions for document generation.
18937
+ * If `Buffer.TYPED_ARRAY_SUPPORT`:
18938
+ * === true Use Uint8Array implementation (fastest)
18939
+ * === false Use Object implementation (most compatible, even IE6)
18285
18940
  *
18286
- * This module defines the various output formats supported when generating
18287
- * .docx files. These types correspond to fflate's output formats.
18941
+ * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
18942
+ * Opera 11.6+, iOS 4.2+.
18288
18943
  *
18289
- * @module
18944
+ * Due to various browser bugs, sometimes the Object implementation will be used even
18945
+ * when the browser supports typed arrays.
18946
+ *
18947
+ * Note:
18948
+ *
18949
+ * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
18950
+ * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
18951
+ *
18952
+ * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
18953
+ *
18954
+ * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
18955
+ * incorrect length in some situations.
18956
+
18957
+ * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
18958
+ * get the Object implementation, which is slower but behaves correctly.
18290
18959
  */
18960
+ Buffer$1.TYPED_ARRAY_SUPPORT = _polyfill_node_global_default.TYPED_ARRAY_SUPPORT !== void 0 ? _polyfill_node_global_default.TYPED_ARRAY_SUPPORT : true;
18961
+ kMaxLength();
18962
+ function kMaxLength() {
18963
+ return Buffer$1.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823;
18964
+ }
18965
+ function createBuffer(that, length) {
18966
+ if (kMaxLength() < length) throw new RangeError("Invalid typed array length");
18967
+ if (Buffer$1.TYPED_ARRAY_SUPPORT) {
18968
+ that = new Uint8Array(length);
18969
+ that.__proto__ = Buffer$1.prototype;
18970
+ } else {
18971
+ if (that === null) that = new Buffer$1(length);
18972
+ that.length = length;
18973
+ }
18974
+ return that;
18975
+ }
18291
18976
  /**
18292
- * Converts a Uint8Array to the specified output type.
18977
+ * The Buffer constructor returns instances of `Uint8Array` that have their
18978
+ * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
18979
+ * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
18980
+ * and the `Uint8Array` methods. Square bracket notation works as expected -- it
18981
+ * returns a single octet.
18293
18982
  *
18294
- * This is used by both the Packer and patchDocument to convert fflate's
18295
- * raw Uint8Array output into the user's requested format.
18983
+ * The `Uint8Array` prototype remains unmodified.
18296
18984
  */
18297
- const convertOutput = (data, type) => {
18298
- switch (type) {
18299
- case "nodebuffer": return Buffer.from(data);
18300
- case "blob": return new Blob([data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength)], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" });
18301
- case "arraybuffer": return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
18302
- case "uint8array": return data;
18303
- case "base64": return btoa((0, fflate.strFromU8)(data, true));
18304
- case "string":
18305
- case "text":
18306
- case "binarystring": return (0, fflate.strFromU8)(data, true);
18307
- case "array": return [...data];
18308
- default: return data;
18985
+ function Buffer$1(arg, encodingOrOffset, length) {
18986
+ if (!Buffer$1.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer$1)) return new Buffer$1(arg, encodingOrOffset, length);
18987
+ if (typeof arg === "number") {
18988
+ if (typeof encodingOrOffset === "string") throw new Error("If encoding is specified then the first argument must be a string");
18989
+ return allocUnsafe(this, arg);
18309
18990
  }
18991
+ return from(this, arg, encodingOrOffset, length);
18992
+ }
18993
+ Buffer$1.poolSize = 8192;
18994
+ Buffer$1._augment = function(arr) {
18995
+ arr.__proto__ = Buffer$1.prototype;
18996
+ return arr;
18997
+ };
18998
+ function from(that, value, encodingOrOffset, length) {
18999
+ if (typeof value === "number") throw new TypeError("\"value\" argument must not be a number");
19000
+ if (typeof ArrayBuffer !== "undefined" && value instanceof ArrayBuffer) return fromArrayBuffer(that, value, encodingOrOffset, length);
19001
+ if (typeof value === "string") return fromString(that, value, encodingOrOffset);
19002
+ return fromObject(that, value);
19003
+ }
19004
+ /**
19005
+ * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
19006
+ * if value is a number.
19007
+ * Buffer.from(str[, encoding])
19008
+ * Buffer.from(array)
19009
+ * Buffer.from(buffer)
19010
+ * Buffer.from(arrayBuffer[, byteOffset[, length]])
19011
+ **/
19012
+ Buffer$1.from = function(value, encodingOrOffset, length) {
19013
+ return from(null, value, encodingOrOffset, length);
19014
+ };
19015
+ if (Buffer$1.TYPED_ARRAY_SUPPORT) {
19016
+ Buffer$1.prototype.__proto__ = Uint8Array.prototype;
19017
+ Buffer$1.__proto__ = Uint8Array;
19018
+ if (typeof Symbol !== "undefined" && Symbol.species && Buffer$1[Symbol.species] === Buffer$1);
19019
+ }
19020
+ function assertSize(size) {
19021
+ if (typeof size !== "number") throw new TypeError("\"size\" argument must be a number");
19022
+ else if (size < 0) throw new RangeError("\"size\" argument must not be negative");
19023
+ }
19024
+ function alloc(that, size, fill, encoding) {
19025
+ assertSize(size);
19026
+ if (size <= 0) return createBuffer(that, size);
19027
+ if (fill !== void 0) return typeof encoding === "string" ? createBuffer(that, size).fill(fill, encoding) : createBuffer(that, size).fill(fill);
19028
+ return createBuffer(that, size);
19029
+ }
19030
+ /**
19031
+ * Creates a new filled Buffer instance.
19032
+ * alloc(size[, fill[, encoding]])
19033
+ **/
19034
+ Buffer$1.alloc = function(size, fill, encoding) {
19035
+ return alloc(null, size, fill, encoding);
19036
+ };
19037
+ function allocUnsafe(that, size) {
19038
+ assertSize(size);
19039
+ that = createBuffer(that, size < 0 ? 0 : checked(size) | 0);
19040
+ if (!Buffer$1.TYPED_ARRAY_SUPPORT) for (var i = 0; i < size; ++i) that[i] = 0;
19041
+ return that;
19042
+ }
19043
+ /**
19044
+ * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
19045
+ * */
19046
+ Buffer$1.allocUnsafe = function(size) {
19047
+ return allocUnsafe(null, size);
18310
19048
  };
18311
- //#endregion
18312
- //#region src/file/fonts/obfuscate-ttf-to-odttf.ts
18313
19049
  /**
18314
- * Font obfuscation module for embedding fonts in WordprocessingML documents.
18315
- *
18316
- * This module implements the OOXML font obfuscation algorithm used to embed
18317
- * fonts in DOCX documents. Obfuscation is required by the OOXML specification
18318
- * to prevent simple extraction of embedded font files.
18319
- *
18320
- * Reference: ECMA-376 Part 2, Section 11.1 (Font Embedding)
18321
- *
18322
- * @module
19050
+ * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
18323
19051
  */
18324
- /** Start offset for obfuscation in the font file */
19052
+ Buffer$1.allocUnsafeSlow = function(size) {
19053
+ return allocUnsafe(null, size);
19054
+ };
19055
+ function fromString(that, string, encoding) {
19056
+ if (typeof encoding !== "string" || encoding === "") encoding = "utf8";
19057
+ if (!Buffer$1.isEncoding(encoding)) throw new TypeError("\"encoding\" must be a valid string encoding");
19058
+ var length = byteLength(string, encoding) | 0;
19059
+ that = createBuffer(that, length);
19060
+ var actual = that.write(string, encoding);
19061
+ if (actual !== length) that = that.slice(0, actual);
19062
+ return that;
19063
+ }
19064
+ function fromArrayLike(that, array) {
19065
+ var length = array.length < 0 ? 0 : checked(array.length) | 0;
19066
+ that = createBuffer(that, length);
19067
+ for (var i = 0; i < length; i += 1) that[i] = array[i] & 255;
19068
+ return that;
19069
+ }
19070
+ function fromArrayBuffer(that, array, byteOffset, length) {
19071
+ array.byteLength;
19072
+ if (byteOffset < 0 || array.byteLength < byteOffset) throw new RangeError("'offset' is out of bounds");
19073
+ if (array.byteLength < byteOffset + (length || 0)) throw new RangeError("'length' is out of bounds");
19074
+ if (byteOffset === void 0 && length === void 0) array = new Uint8Array(array);
19075
+ else if (length === void 0) array = new Uint8Array(array, byteOffset);
19076
+ else array = new Uint8Array(array, byteOffset, length);
19077
+ if (Buffer$1.TYPED_ARRAY_SUPPORT) {
19078
+ that = array;
19079
+ that.__proto__ = Buffer$1.prototype;
19080
+ } else that = fromArrayLike(that, array);
19081
+ return that;
19082
+ }
19083
+ function fromObject(that, obj) {
19084
+ if (internalIsBuffer(obj)) {
19085
+ var len = checked(obj.length) | 0;
19086
+ that = createBuffer(that, len);
19087
+ if (that.length === 0) return that;
19088
+ obj.copy(that, 0, 0, len);
19089
+ return that;
19090
+ }
19091
+ if (obj) {
19092
+ if (typeof ArrayBuffer !== "undefined" && obj.buffer instanceof ArrayBuffer || "length" in obj) {
19093
+ if (typeof obj.length !== "number" || isnan(obj.length)) return createBuffer(that, 0);
19094
+ return fromArrayLike(that, obj);
19095
+ }
19096
+ if (obj.type === "Buffer" && isArray$1(obj.data)) return fromArrayLike(that, obj.data);
19097
+ }
19098
+ throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.");
19099
+ }
19100
+ function checked(length) {
19101
+ if (length >= kMaxLength()) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + kMaxLength().toString(16) + " bytes");
19102
+ return length | 0;
19103
+ }
19104
+ Buffer$1.isBuffer = isBuffer;
19105
+ function internalIsBuffer(b) {
19106
+ return !!(b != null && b._isBuffer);
19107
+ }
19108
+ Buffer$1.compare = function compare(a, b) {
19109
+ if (!internalIsBuffer(a) || !internalIsBuffer(b)) throw new TypeError("Arguments must be Buffers");
19110
+ if (a === b) return 0;
19111
+ var x = a.length;
19112
+ var y = b.length;
19113
+ for (var i = 0, len = Math.min(x, y); i < len; ++i) if (a[i] !== b[i]) {
19114
+ x = a[i];
19115
+ y = b[i];
19116
+ break;
19117
+ }
19118
+ if (x < y) return -1;
19119
+ if (y < x) return 1;
19120
+ return 0;
19121
+ };
19122
+ Buffer$1.isEncoding = function isEncoding(encoding) {
19123
+ switch (String(encoding).toLowerCase()) {
19124
+ case "hex":
19125
+ case "utf8":
19126
+ case "utf-8":
19127
+ case "ascii":
19128
+ case "latin1":
19129
+ case "binary":
19130
+ case "base64":
19131
+ case "ucs2":
19132
+ case "ucs-2":
19133
+ case "utf16le":
19134
+ case "utf-16le": return true;
19135
+ default: return false;
19136
+ }
19137
+ };
19138
+ Buffer$1.concat = function concat(list, length) {
19139
+ if (!isArray$1(list)) throw new TypeError("\"list\" argument must be an Array of Buffers");
19140
+ if (list.length === 0) return Buffer$1.alloc(0);
19141
+ var i;
19142
+ if (length === void 0) {
19143
+ length = 0;
19144
+ for (i = 0; i < list.length; ++i) length += list[i].length;
19145
+ }
19146
+ var buffer = Buffer$1.allocUnsafe(length);
19147
+ var pos = 0;
19148
+ for (i = 0; i < list.length; ++i) {
19149
+ var buf = list[i];
19150
+ if (!internalIsBuffer(buf)) throw new TypeError("\"list\" argument must be an Array of Buffers");
19151
+ buf.copy(buffer, pos);
19152
+ pos += buf.length;
19153
+ }
19154
+ return buffer;
19155
+ };
19156
+ function byteLength(string, encoding) {
19157
+ if (internalIsBuffer(string)) return string.length;
19158
+ if (typeof ArrayBuffer !== "undefined" && typeof ArrayBuffer.isView === "function" && (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) return string.byteLength;
19159
+ if (typeof string !== "string") string = "" + string;
19160
+ var len = string.length;
19161
+ if (len === 0) return 0;
19162
+ var loweredCase = false;
19163
+ for (;;) switch (encoding) {
19164
+ case "ascii":
19165
+ case "latin1":
19166
+ case "binary": return len;
19167
+ case "utf8":
19168
+ case "utf-8":
19169
+ case void 0: return utf8ToBytes(string).length;
19170
+ case "ucs2":
19171
+ case "ucs-2":
19172
+ case "utf16le":
19173
+ case "utf-16le": return len * 2;
19174
+ case "hex": return len >>> 1;
19175
+ case "base64": return base64ToBytes(string).length;
19176
+ default:
19177
+ if (loweredCase) return utf8ToBytes(string).length;
19178
+ encoding = ("" + encoding).toLowerCase();
19179
+ loweredCase = true;
19180
+ }
19181
+ }
19182
+ Buffer$1.byteLength = byteLength;
19183
+ function slowToString(encoding, start, end) {
19184
+ var loweredCase = false;
19185
+ if (start === void 0 || start < 0) start = 0;
19186
+ if (start > this.length) return "";
19187
+ if (end === void 0 || end > this.length) end = this.length;
19188
+ if (end <= 0) return "";
19189
+ end >>>= 0;
19190
+ start >>>= 0;
19191
+ if (end <= start) return "";
19192
+ if (!encoding) encoding = "utf8";
19193
+ while (true) switch (encoding) {
19194
+ case "hex": return hexSlice(this, start, end);
19195
+ case "utf8":
19196
+ case "utf-8": return utf8Slice(this, start, end);
19197
+ case "ascii": return asciiSlice(this, start, end);
19198
+ case "latin1":
19199
+ case "binary": return latin1Slice(this, start, end);
19200
+ case "base64": return base64Slice(this, start, end);
19201
+ case "ucs2":
19202
+ case "ucs-2":
19203
+ case "utf16le":
19204
+ case "utf-16le": return utf16leSlice(this, start, end);
19205
+ default:
19206
+ if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
19207
+ encoding = (encoding + "").toLowerCase();
19208
+ loweredCase = true;
19209
+ }
19210
+ }
19211
+ Buffer$1.prototype._isBuffer = true;
19212
+ function swap(b, n, m) {
19213
+ var i = b[n];
19214
+ b[n] = b[m];
19215
+ b[m] = i;
19216
+ }
19217
+ Buffer$1.prototype.swap16 = function swap16() {
19218
+ var len = this.length;
19219
+ if (len % 2 !== 0) throw new RangeError("Buffer size must be a multiple of 16-bits");
19220
+ for (var i = 0; i < len; i += 2) swap(this, i, i + 1);
19221
+ return this;
19222
+ };
19223
+ Buffer$1.prototype.swap32 = function swap32() {
19224
+ var len = this.length;
19225
+ if (len % 4 !== 0) throw new RangeError("Buffer size must be a multiple of 32-bits");
19226
+ for (var i = 0; i < len; i += 4) {
19227
+ swap(this, i, i + 3);
19228
+ swap(this, i + 1, i + 2);
19229
+ }
19230
+ return this;
19231
+ };
19232
+ Buffer$1.prototype.swap64 = function swap64() {
19233
+ var len = this.length;
19234
+ if (len % 8 !== 0) throw new RangeError("Buffer size must be a multiple of 64-bits");
19235
+ for (var i = 0; i < len; i += 8) {
19236
+ swap(this, i, i + 7);
19237
+ swap(this, i + 1, i + 6);
19238
+ swap(this, i + 2, i + 5);
19239
+ swap(this, i + 3, i + 4);
19240
+ }
19241
+ return this;
19242
+ };
19243
+ Buffer$1.prototype.toString = function toString() {
19244
+ var length = this.length | 0;
19245
+ if (length === 0) return "";
19246
+ if (arguments.length === 0) return utf8Slice(this, 0, length);
19247
+ return slowToString.apply(this, arguments);
19248
+ };
19249
+ Buffer$1.prototype.equals = function equals(b) {
19250
+ if (!internalIsBuffer(b)) throw new TypeError("Argument must be a Buffer");
19251
+ if (this === b) return true;
19252
+ return Buffer$1.compare(this, b) === 0;
19253
+ };
19254
+ Buffer$1.prototype.inspect = function inspect() {
19255
+ var str = "";
19256
+ var max = 50;
19257
+ if (this.length > 0) {
19258
+ str = this.toString("hex", 0, max).match(/.{2}/g).join(" ");
19259
+ if (this.length > max) str += " ... ";
19260
+ }
19261
+ return "<Buffer " + str + ">";
19262
+ };
19263
+ Buffer$1.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
19264
+ if (!internalIsBuffer(target)) throw new TypeError("Argument must be a Buffer");
19265
+ if (start === void 0) start = 0;
19266
+ if (end === void 0) end = target ? target.length : 0;
19267
+ if (thisStart === void 0) thisStart = 0;
19268
+ if (thisEnd === void 0) thisEnd = this.length;
19269
+ if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) throw new RangeError("out of range index");
19270
+ if (thisStart >= thisEnd && start >= end) return 0;
19271
+ if (thisStart >= thisEnd) return -1;
19272
+ if (start >= end) return 1;
19273
+ start >>>= 0;
19274
+ end >>>= 0;
19275
+ thisStart >>>= 0;
19276
+ thisEnd >>>= 0;
19277
+ if (this === target) return 0;
19278
+ var x = thisEnd - thisStart;
19279
+ var y = end - start;
19280
+ var len = Math.min(x, y);
19281
+ var thisCopy = this.slice(thisStart, thisEnd);
19282
+ var targetCopy = target.slice(start, end);
19283
+ for (var i = 0; i < len; ++i) if (thisCopy[i] !== targetCopy[i]) {
19284
+ x = thisCopy[i];
19285
+ y = targetCopy[i];
19286
+ break;
19287
+ }
19288
+ if (x < y) return -1;
19289
+ if (y < x) return 1;
19290
+ return 0;
19291
+ };
19292
+ function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
19293
+ if (buffer.length === 0) return -1;
19294
+ if (typeof byteOffset === "string") {
19295
+ encoding = byteOffset;
19296
+ byteOffset = 0;
19297
+ } else if (byteOffset > 2147483647) byteOffset = 2147483647;
19298
+ else if (byteOffset < -2147483648) byteOffset = -2147483648;
19299
+ byteOffset = +byteOffset;
19300
+ if (isNaN(byteOffset)) byteOffset = dir ? 0 : buffer.length - 1;
19301
+ if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
19302
+ if (byteOffset >= buffer.length) if (dir) return -1;
19303
+ else byteOffset = buffer.length - 1;
19304
+ else if (byteOffset < 0) if (dir) byteOffset = 0;
19305
+ else return -1;
19306
+ if (typeof val === "string") val = Buffer$1.from(val, encoding);
19307
+ if (internalIsBuffer(val)) {
19308
+ if (val.length === 0) return -1;
19309
+ return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
19310
+ } else if (typeof val === "number") {
19311
+ val = val & 255;
19312
+ if (Buffer$1.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf === "function") if (dir) return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);
19313
+ else return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);
19314
+ return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);
19315
+ }
19316
+ throw new TypeError("val must be string, number or Buffer");
19317
+ }
19318
+ function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
19319
+ var indexSize = 1;
19320
+ var arrLength = arr.length;
19321
+ var valLength = val.length;
19322
+ if (encoding !== void 0) {
19323
+ encoding = String(encoding).toLowerCase();
19324
+ if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") {
19325
+ if (arr.length < 2 || val.length < 2) return -1;
19326
+ indexSize = 2;
19327
+ arrLength /= 2;
19328
+ valLength /= 2;
19329
+ byteOffset /= 2;
19330
+ }
19331
+ }
19332
+ function read(buf, i) {
19333
+ if (indexSize === 1) return buf[i];
19334
+ else return buf.readUInt16BE(i * indexSize);
19335
+ }
19336
+ var i;
19337
+ if (dir) {
19338
+ var foundIndex = -1;
19339
+ for (i = byteOffset; i < arrLength; i++) if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
19340
+ if (foundIndex === -1) foundIndex = i;
19341
+ if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
19342
+ } else {
19343
+ if (foundIndex !== -1) i -= i - foundIndex;
19344
+ foundIndex = -1;
19345
+ }
19346
+ } else {
19347
+ if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
19348
+ for (i = byteOffset; i >= 0; i--) {
19349
+ var found = true;
19350
+ for (var j = 0; j < valLength; j++) if (read(arr, i + j) !== read(val, j)) {
19351
+ found = false;
19352
+ break;
19353
+ }
19354
+ if (found) return i;
19355
+ }
19356
+ }
19357
+ return -1;
19358
+ }
19359
+ Buffer$1.prototype.includes = function includes(val, byteOffset, encoding) {
19360
+ return this.indexOf(val, byteOffset, encoding) !== -1;
19361
+ };
19362
+ Buffer$1.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
19363
+ return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
19364
+ };
19365
+ Buffer$1.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
19366
+ return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
19367
+ };
19368
+ function hexWrite(buf, string, offset, length) {
19369
+ offset = Number(offset) || 0;
19370
+ var remaining = buf.length - offset;
19371
+ if (!length) length = remaining;
19372
+ else {
19373
+ length = Number(length);
19374
+ if (length > remaining) length = remaining;
19375
+ }
19376
+ var strLen = string.length;
19377
+ if (strLen % 2 !== 0) throw new TypeError("Invalid hex string");
19378
+ if (length > strLen / 2) length = strLen / 2;
19379
+ for (var i = 0; i < length; ++i) {
19380
+ var parsed = parseInt(string.substr(i * 2, 2), 16);
19381
+ if (isNaN(parsed)) return i;
19382
+ buf[offset + i] = parsed;
19383
+ }
19384
+ return i;
19385
+ }
19386
+ function utf8Write(buf, string, offset, length) {
19387
+ return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
19388
+ }
19389
+ function asciiWrite(buf, string, offset, length) {
19390
+ return blitBuffer(asciiToBytes(string), buf, offset, length);
19391
+ }
19392
+ function latin1Write(buf, string, offset, length) {
19393
+ return asciiWrite(buf, string, offset, length);
19394
+ }
19395
+ function base64Write(buf, string, offset, length) {
19396
+ return blitBuffer(base64ToBytes(string), buf, offset, length);
19397
+ }
19398
+ function ucs2Write(buf, string, offset, length) {
19399
+ return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
19400
+ }
19401
+ Buffer$1.prototype.write = function write(string, offset, length, encoding) {
19402
+ if (offset === void 0) {
19403
+ encoding = "utf8";
19404
+ length = this.length;
19405
+ offset = 0;
19406
+ } else if (length === void 0 && typeof offset === "string") {
19407
+ encoding = offset;
19408
+ length = this.length;
19409
+ offset = 0;
19410
+ } else if (isFinite(offset)) {
19411
+ offset = offset | 0;
19412
+ if (isFinite(length)) {
19413
+ length = length | 0;
19414
+ if (encoding === void 0) encoding = "utf8";
19415
+ } else {
19416
+ encoding = length;
19417
+ length = void 0;
19418
+ }
19419
+ } else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
19420
+ var remaining = this.length - offset;
19421
+ if (length === void 0 || length > remaining) length = remaining;
19422
+ if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) throw new RangeError("Attempt to write outside buffer bounds");
19423
+ if (!encoding) encoding = "utf8";
19424
+ var loweredCase = false;
19425
+ for (;;) switch (encoding) {
19426
+ case "hex": return hexWrite(this, string, offset, length);
19427
+ case "utf8":
19428
+ case "utf-8": return utf8Write(this, string, offset, length);
19429
+ case "ascii": return asciiWrite(this, string, offset, length);
19430
+ case "latin1":
19431
+ case "binary": return latin1Write(this, string, offset, length);
19432
+ case "base64": return base64Write(this, string, offset, length);
19433
+ case "ucs2":
19434
+ case "ucs-2":
19435
+ case "utf16le":
19436
+ case "utf-16le": return ucs2Write(this, string, offset, length);
19437
+ default:
19438
+ if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
19439
+ encoding = ("" + encoding).toLowerCase();
19440
+ loweredCase = true;
19441
+ }
19442
+ };
19443
+ Buffer$1.prototype.toJSON = function toJSON() {
19444
+ return {
19445
+ type: "Buffer",
19446
+ data: Array.prototype.slice.call(this._arr || this, 0)
19447
+ };
19448
+ };
19449
+ function base64Slice(buf, start, end) {
19450
+ if (start === 0 && end === buf.length) return fromByteArray(buf);
19451
+ else return fromByteArray(buf.slice(start, end));
19452
+ }
19453
+ function utf8Slice(buf, start, end) {
19454
+ end = Math.min(buf.length, end);
19455
+ var res = [];
19456
+ var i = start;
19457
+ while (i < end) {
19458
+ var firstByte = buf[i];
19459
+ var codePoint = null;
19460
+ var bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;
19461
+ if (i + bytesPerSequence <= end) {
19462
+ var secondByte, thirdByte, fourthByte, tempCodePoint;
19463
+ switch (bytesPerSequence) {
19464
+ case 1:
19465
+ if (firstByte < 128) codePoint = firstByte;
19466
+ break;
19467
+ case 2:
19468
+ secondByte = buf[i + 1];
19469
+ if ((secondByte & 192) === 128) {
19470
+ tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;
19471
+ if (tempCodePoint > 127) codePoint = tempCodePoint;
19472
+ }
19473
+ break;
19474
+ case 3:
19475
+ secondByte = buf[i + 1];
19476
+ thirdByte = buf[i + 2];
19477
+ if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {
19478
+ tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;
19479
+ if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) codePoint = tempCodePoint;
19480
+ }
19481
+ break;
19482
+ case 4:
19483
+ secondByte = buf[i + 1];
19484
+ thirdByte = buf[i + 2];
19485
+ fourthByte = buf[i + 3];
19486
+ if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {
19487
+ tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;
19488
+ if (tempCodePoint > 65535 && tempCodePoint < 1114112) codePoint = tempCodePoint;
19489
+ }
19490
+ }
19491
+ }
19492
+ if (codePoint === null) {
19493
+ codePoint = 65533;
19494
+ bytesPerSequence = 1;
19495
+ } else if (codePoint > 65535) {
19496
+ codePoint -= 65536;
19497
+ res.push(codePoint >>> 10 & 1023 | 55296);
19498
+ codePoint = 56320 | codePoint & 1023;
19499
+ }
19500
+ res.push(codePoint);
19501
+ i += bytesPerSequence;
19502
+ }
19503
+ return decodeCodePointsArray(res);
19504
+ }
19505
+ var MAX_ARGUMENTS_LENGTH = 4096;
19506
+ function decodeCodePointsArray(codePoints) {
19507
+ var len = codePoints.length;
19508
+ if (len <= MAX_ARGUMENTS_LENGTH) return String.fromCharCode.apply(String, codePoints);
19509
+ var res = "";
19510
+ var i = 0;
19511
+ while (i < len) res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH));
19512
+ return res;
19513
+ }
19514
+ function asciiSlice(buf, start, end) {
19515
+ var ret = "";
19516
+ end = Math.min(buf.length, end);
19517
+ for (var i = start; i < end; ++i) ret += String.fromCharCode(buf[i] & 127);
19518
+ return ret;
19519
+ }
19520
+ function latin1Slice(buf, start, end) {
19521
+ var ret = "";
19522
+ end = Math.min(buf.length, end);
19523
+ for (var i = start; i < end; ++i) ret += String.fromCharCode(buf[i]);
19524
+ return ret;
19525
+ }
19526
+ function hexSlice(buf, start, end) {
19527
+ var len = buf.length;
19528
+ if (!start || start < 0) start = 0;
19529
+ if (!end || end < 0 || end > len) end = len;
19530
+ var out = "";
19531
+ for (var i = start; i < end; ++i) out += toHex(buf[i]);
19532
+ return out;
19533
+ }
19534
+ function utf16leSlice(buf, start, end) {
19535
+ var bytes = buf.slice(start, end);
19536
+ var res = "";
19537
+ for (var i = 0; i < bytes.length; i += 2) res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
19538
+ return res;
19539
+ }
19540
+ Buffer$1.prototype.slice = function slice(start, end) {
19541
+ var len = this.length;
19542
+ start = ~~start;
19543
+ end = end === void 0 ? len : ~~end;
19544
+ if (start < 0) {
19545
+ start += len;
19546
+ if (start < 0) start = 0;
19547
+ } else if (start > len) start = len;
19548
+ if (end < 0) {
19549
+ end += len;
19550
+ if (end < 0) end = 0;
19551
+ } else if (end > len) end = len;
19552
+ if (end < start) end = start;
19553
+ var newBuf;
19554
+ if (Buffer$1.TYPED_ARRAY_SUPPORT) {
19555
+ newBuf = this.subarray(start, end);
19556
+ newBuf.__proto__ = Buffer$1.prototype;
19557
+ } else {
19558
+ var sliceLen = end - start;
19559
+ newBuf = new Buffer$1(sliceLen, void 0);
19560
+ for (var i = 0; i < sliceLen; ++i) newBuf[i] = this[i + start];
19561
+ }
19562
+ return newBuf;
19563
+ };
19564
+ function checkOffset(offset, ext, length) {
19565
+ if (offset % 1 !== 0 || offset < 0) throw new RangeError("offset is not uint");
19566
+ if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length");
19567
+ }
19568
+ Buffer$1.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) {
19569
+ offset = offset | 0;
19570
+ byteLength = byteLength | 0;
19571
+ if (!noAssert) checkOffset(offset, byteLength, this.length);
19572
+ var val = this[offset];
19573
+ var mul = 1;
19574
+ var i = 0;
19575
+ while (++i < byteLength && (mul *= 256)) val += this[offset + i] * mul;
19576
+ return val;
19577
+ };
19578
+ Buffer$1.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) {
19579
+ offset = offset | 0;
19580
+ byteLength = byteLength | 0;
19581
+ if (!noAssert) checkOffset(offset, byteLength, this.length);
19582
+ var val = this[offset + --byteLength];
19583
+ var mul = 1;
19584
+ while (byteLength > 0 && (mul *= 256)) val += this[offset + --byteLength] * mul;
19585
+ return val;
19586
+ };
19587
+ Buffer$1.prototype.readUInt8 = function readUInt8(offset, noAssert) {
19588
+ if (!noAssert) checkOffset(offset, 1, this.length);
19589
+ return this[offset];
19590
+ };
19591
+ Buffer$1.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
19592
+ if (!noAssert) checkOffset(offset, 2, this.length);
19593
+ return this[offset] | this[offset + 1] << 8;
19594
+ };
19595
+ Buffer$1.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
19596
+ if (!noAssert) checkOffset(offset, 2, this.length);
19597
+ return this[offset] << 8 | this[offset + 1];
19598
+ };
19599
+ Buffer$1.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
19600
+ if (!noAssert) checkOffset(offset, 4, this.length);
19601
+ return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;
19602
+ };
19603
+ Buffer$1.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
19604
+ if (!noAssert) checkOffset(offset, 4, this.length);
19605
+ return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
19606
+ };
19607
+ Buffer$1.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) {
19608
+ offset = offset | 0;
19609
+ byteLength = byteLength | 0;
19610
+ if (!noAssert) checkOffset(offset, byteLength, this.length);
19611
+ var val = this[offset];
19612
+ var mul = 1;
19613
+ var i = 0;
19614
+ while (++i < byteLength && (mul *= 256)) val += this[offset + i] * mul;
19615
+ mul *= 128;
19616
+ if (val >= mul) val -= Math.pow(2, 8 * byteLength);
19617
+ return val;
19618
+ };
19619
+ Buffer$1.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) {
19620
+ offset = offset | 0;
19621
+ byteLength = byteLength | 0;
19622
+ if (!noAssert) checkOffset(offset, byteLength, this.length);
19623
+ var i = byteLength;
19624
+ var mul = 1;
19625
+ var val = this[offset + --i];
19626
+ while (i > 0 && (mul *= 256)) val += this[offset + --i] * mul;
19627
+ mul *= 128;
19628
+ if (val >= mul) val -= Math.pow(2, 8 * byteLength);
19629
+ return val;
19630
+ };
19631
+ Buffer$1.prototype.readInt8 = function readInt8(offset, noAssert) {
19632
+ if (!noAssert) checkOffset(offset, 1, this.length);
19633
+ if (!(this[offset] & 128)) return this[offset];
19634
+ return (255 - this[offset] + 1) * -1;
19635
+ };
19636
+ Buffer$1.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
19637
+ if (!noAssert) checkOffset(offset, 2, this.length);
19638
+ var val = this[offset] | this[offset + 1] << 8;
19639
+ return val & 32768 ? val | 4294901760 : val;
19640
+ };
19641
+ Buffer$1.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
19642
+ if (!noAssert) checkOffset(offset, 2, this.length);
19643
+ var val = this[offset + 1] | this[offset] << 8;
19644
+ return val & 32768 ? val | 4294901760 : val;
19645
+ };
19646
+ Buffer$1.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
19647
+ if (!noAssert) checkOffset(offset, 4, this.length);
19648
+ return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
19649
+ };
19650
+ Buffer$1.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
19651
+ if (!noAssert) checkOffset(offset, 4, this.length);
19652
+ return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
19653
+ };
19654
+ Buffer$1.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
19655
+ if (!noAssert) checkOffset(offset, 4, this.length);
19656
+ return read(this, offset, true, 23, 4);
19657
+ };
19658
+ Buffer$1.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
19659
+ if (!noAssert) checkOffset(offset, 4, this.length);
19660
+ return read(this, offset, false, 23, 4);
19661
+ };
19662
+ Buffer$1.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
19663
+ if (!noAssert) checkOffset(offset, 8, this.length);
19664
+ return read(this, offset, true, 52, 8);
19665
+ };
19666
+ Buffer$1.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
19667
+ if (!noAssert) checkOffset(offset, 8, this.length);
19668
+ return read(this, offset, false, 52, 8);
19669
+ };
19670
+ function checkInt(buf, value, offset, ext, max, min) {
19671
+ if (!internalIsBuffer(buf)) throw new TypeError("\"buffer\" argument must be a Buffer instance");
19672
+ if (value > max || value < min) throw new RangeError("\"value\" argument is out of bounds");
19673
+ if (offset + ext > buf.length) throw new RangeError("Index out of range");
19674
+ }
19675
+ Buffer$1.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) {
19676
+ value = +value;
19677
+ offset = offset | 0;
19678
+ byteLength = byteLength | 0;
19679
+ if (!noAssert) {
19680
+ var maxBytes = Math.pow(2, 8 * byteLength) - 1;
19681
+ checkInt(this, value, offset, byteLength, maxBytes, 0);
19682
+ }
19683
+ var mul = 1;
19684
+ var i = 0;
19685
+ this[offset] = value & 255;
19686
+ while (++i < byteLength && (mul *= 256)) this[offset + i] = value / mul & 255;
19687
+ return offset + byteLength;
19688
+ };
19689
+ Buffer$1.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) {
19690
+ value = +value;
19691
+ offset = offset | 0;
19692
+ byteLength = byteLength | 0;
19693
+ if (!noAssert) {
19694
+ var maxBytes = Math.pow(2, 8 * byteLength) - 1;
19695
+ checkInt(this, value, offset, byteLength, maxBytes, 0);
19696
+ }
19697
+ var i = byteLength - 1;
19698
+ var mul = 1;
19699
+ this[offset + i] = value & 255;
19700
+ while (--i >= 0 && (mul *= 256)) this[offset + i] = value / mul & 255;
19701
+ return offset + byteLength;
19702
+ };
19703
+ Buffer$1.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
19704
+ value = +value;
19705
+ offset = offset | 0;
19706
+ if (!noAssert) checkInt(this, value, offset, 1, 255, 0);
19707
+ if (!Buffer$1.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
19708
+ this[offset] = value & 255;
19709
+ return offset + 1;
19710
+ };
19711
+ function objectWriteUInt16(buf, value, offset, littleEndian) {
19712
+ if (value < 0) value = 65535 + value + 1;
19713
+ for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) buf[offset + i] = (value & 255 << 8 * (littleEndian ? i : 1 - i)) >>> (littleEndian ? i : 1 - i) * 8;
19714
+ }
19715
+ Buffer$1.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
19716
+ value = +value;
19717
+ offset = offset | 0;
19718
+ if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
19719
+ if (Buffer$1.TYPED_ARRAY_SUPPORT) {
19720
+ this[offset] = value & 255;
19721
+ this[offset + 1] = value >>> 8;
19722
+ } else objectWriteUInt16(this, value, offset, true);
19723
+ return offset + 2;
19724
+ };
19725
+ Buffer$1.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
19726
+ value = +value;
19727
+ offset = offset | 0;
19728
+ if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
19729
+ if (Buffer$1.TYPED_ARRAY_SUPPORT) {
19730
+ this[offset] = value >>> 8;
19731
+ this[offset + 1] = value & 255;
19732
+ } else objectWriteUInt16(this, value, offset, false);
19733
+ return offset + 2;
19734
+ };
19735
+ function objectWriteUInt32(buf, value, offset, littleEndian) {
19736
+ if (value < 0) value = 4294967295 + value + 1;
19737
+ for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) buf[offset + i] = value >>> (littleEndian ? i : 3 - i) * 8 & 255;
19738
+ }
19739
+ Buffer$1.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
19740
+ value = +value;
19741
+ offset = offset | 0;
19742
+ if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
19743
+ if (Buffer$1.TYPED_ARRAY_SUPPORT) {
19744
+ this[offset + 3] = value >>> 24;
19745
+ this[offset + 2] = value >>> 16;
19746
+ this[offset + 1] = value >>> 8;
19747
+ this[offset] = value & 255;
19748
+ } else objectWriteUInt32(this, value, offset, true);
19749
+ return offset + 4;
19750
+ };
19751
+ Buffer$1.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
19752
+ value = +value;
19753
+ offset = offset | 0;
19754
+ if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
19755
+ if (Buffer$1.TYPED_ARRAY_SUPPORT) {
19756
+ this[offset] = value >>> 24;
19757
+ this[offset + 1] = value >>> 16;
19758
+ this[offset + 2] = value >>> 8;
19759
+ this[offset + 3] = value & 255;
19760
+ } else objectWriteUInt32(this, value, offset, false);
19761
+ return offset + 4;
19762
+ };
19763
+ Buffer$1.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) {
19764
+ value = +value;
19765
+ offset = offset | 0;
19766
+ if (!noAssert) {
19767
+ var limit = Math.pow(2, 8 * byteLength - 1);
19768
+ checkInt(this, value, offset, byteLength, limit - 1, -limit);
19769
+ }
19770
+ var i = 0;
19771
+ var mul = 1;
19772
+ var sub = 0;
19773
+ this[offset] = value & 255;
19774
+ while (++i < byteLength && (mul *= 256)) {
19775
+ if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) sub = 1;
19776
+ this[offset + i] = (value / mul >> 0) - sub & 255;
19777
+ }
19778
+ return offset + byteLength;
19779
+ };
19780
+ Buffer$1.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) {
19781
+ value = +value;
19782
+ offset = offset | 0;
19783
+ if (!noAssert) {
19784
+ var limit = Math.pow(2, 8 * byteLength - 1);
19785
+ checkInt(this, value, offset, byteLength, limit - 1, -limit);
19786
+ }
19787
+ var i = byteLength - 1;
19788
+ var mul = 1;
19789
+ var sub = 0;
19790
+ this[offset + i] = value & 255;
19791
+ while (--i >= 0 && (mul *= 256)) {
19792
+ if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) sub = 1;
19793
+ this[offset + i] = (value / mul >> 0) - sub & 255;
19794
+ }
19795
+ return offset + byteLength;
19796
+ };
19797
+ Buffer$1.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
19798
+ value = +value;
19799
+ offset = offset | 0;
19800
+ if (!noAssert) checkInt(this, value, offset, 1, 127, -128);
19801
+ if (!Buffer$1.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
19802
+ if (value < 0) value = 255 + value + 1;
19803
+ this[offset] = value & 255;
19804
+ return offset + 1;
19805
+ };
19806
+ Buffer$1.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
19807
+ value = +value;
19808
+ offset = offset | 0;
19809
+ if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
19810
+ if (Buffer$1.TYPED_ARRAY_SUPPORT) {
19811
+ this[offset] = value & 255;
19812
+ this[offset + 1] = value >>> 8;
19813
+ } else objectWriteUInt16(this, value, offset, true);
19814
+ return offset + 2;
19815
+ };
19816
+ Buffer$1.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
19817
+ value = +value;
19818
+ offset = offset | 0;
19819
+ if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
19820
+ if (Buffer$1.TYPED_ARRAY_SUPPORT) {
19821
+ this[offset] = value >>> 8;
19822
+ this[offset + 1] = value & 255;
19823
+ } else objectWriteUInt16(this, value, offset, false);
19824
+ return offset + 2;
19825
+ };
19826
+ Buffer$1.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
19827
+ value = +value;
19828
+ offset = offset | 0;
19829
+ if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
19830
+ if (Buffer$1.TYPED_ARRAY_SUPPORT) {
19831
+ this[offset] = value & 255;
19832
+ this[offset + 1] = value >>> 8;
19833
+ this[offset + 2] = value >>> 16;
19834
+ this[offset + 3] = value >>> 24;
19835
+ } else objectWriteUInt32(this, value, offset, true);
19836
+ return offset + 4;
19837
+ };
19838
+ Buffer$1.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
19839
+ value = +value;
19840
+ offset = offset | 0;
19841
+ if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
19842
+ if (value < 0) value = 4294967295 + value + 1;
19843
+ if (Buffer$1.TYPED_ARRAY_SUPPORT) {
19844
+ this[offset] = value >>> 24;
19845
+ this[offset + 1] = value >>> 16;
19846
+ this[offset + 2] = value >>> 8;
19847
+ this[offset + 3] = value & 255;
19848
+ } else objectWriteUInt32(this, value, offset, false);
19849
+ return offset + 4;
19850
+ };
19851
+ function checkIEEE754(buf, value, offset, ext, max, min) {
19852
+ if (offset + ext > buf.length) throw new RangeError("Index out of range");
19853
+ if (offset < 0) throw new RangeError("Index out of range");
19854
+ }
19855
+ function writeFloat(buf, value, offset, littleEndian, noAssert) {
19856
+ if (!noAssert) checkIEEE754(buf, value, offset, 4);
19857
+ write(buf, value, offset, littleEndian, 23, 4);
19858
+ return offset + 4;
19859
+ }
19860
+ Buffer$1.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
19861
+ return writeFloat(this, value, offset, true, noAssert);
19862
+ };
19863
+ Buffer$1.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
19864
+ return writeFloat(this, value, offset, false, noAssert);
19865
+ };
19866
+ function writeDouble(buf, value, offset, littleEndian, noAssert) {
19867
+ if (!noAssert) checkIEEE754(buf, value, offset, 8);
19868
+ write(buf, value, offset, littleEndian, 52, 8);
19869
+ return offset + 8;
19870
+ }
19871
+ Buffer$1.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
19872
+ return writeDouble(this, value, offset, true, noAssert);
19873
+ };
19874
+ Buffer$1.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
19875
+ return writeDouble(this, value, offset, false, noAssert);
19876
+ };
19877
+ Buffer$1.prototype.copy = function copy(target, targetStart, start, end) {
19878
+ if (!start) start = 0;
19879
+ if (!end && end !== 0) end = this.length;
19880
+ if (targetStart >= target.length) targetStart = target.length;
19881
+ if (!targetStart) targetStart = 0;
19882
+ if (end > 0 && end < start) end = start;
19883
+ if (end === start) return 0;
19884
+ if (target.length === 0 || this.length === 0) return 0;
19885
+ if (targetStart < 0) throw new RangeError("targetStart out of bounds");
19886
+ if (start < 0 || start >= this.length) throw new RangeError("sourceStart out of bounds");
19887
+ if (end < 0) throw new RangeError("sourceEnd out of bounds");
19888
+ if (end > this.length) end = this.length;
19889
+ if (target.length - targetStart < end - start) end = target.length - targetStart + start;
19890
+ var len = end - start;
19891
+ var i;
19892
+ if (this === target && start < targetStart && targetStart < end) for (i = len - 1; i >= 0; --i) target[i + targetStart] = this[i + start];
19893
+ else if (len < 1e3 || !Buffer$1.TYPED_ARRAY_SUPPORT) for (i = 0; i < len; ++i) target[i + targetStart] = this[i + start];
19894
+ else Uint8Array.prototype.set.call(target, this.subarray(start, start + len), targetStart);
19895
+ return len;
19896
+ };
19897
+ Buffer$1.prototype.fill = function fill(val, start, end, encoding) {
19898
+ if (typeof val === "string") {
19899
+ if (typeof start === "string") {
19900
+ encoding = start;
19901
+ start = 0;
19902
+ end = this.length;
19903
+ } else if (typeof end === "string") {
19904
+ encoding = end;
19905
+ end = this.length;
19906
+ }
19907
+ if (val.length === 1) {
19908
+ var code = val.charCodeAt(0);
19909
+ if (code < 256) val = code;
19910
+ }
19911
+ if (encoding !== void 0 && typeof encoding !== "string") throw new TypeError("encoding must be a string");
19912
+ if (typeof encoding === "string" && !Buffer$1.isEncoding(encoding)) throw new TypeError("Unknown encoding: " + encoding);
19913
+ } else if (typeof val === "number") val = val & 255;
19914
+ if (start < 0 || this.length < start || this.length < end) throw new RangeError("Out of range index");
19915
+ if (end <= start) return this;
19916
+ start = start >>> 0;
19917
+ end = end === void 0 ? this.length : end >>> 0;
19918
+ if (!val) val = 0;
19919
+ var i;
19920
+ if (typeof val === "number") for (i = start; i < end; ++i) this[i] = val;
19921
+ else {
19922
+ var bytes = internalIsBuffer(val) ? val : utf8ToBytes(new Buffer$1(val, encoding).toString());
19923
+ var len = bytes.length;
19924
+ for (i = 0; i < end - start; ++i) this[i + start] = bytes[i % len];
19925
+ }
19926
+ return this;
19927
+ };
19928
+ var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g;
19929
+ function base64clean(str) {
19930
+ str = stringtrim(str).replace(INVALID_BASE64_RE, "");
19931
+ if (str.length < 2) return "";
19932
+ while (str.length % 4 !== 0) str = str + "=";
19933
+ return str;
19934
+ }
19935
+ function stringtrim(str) {
19936
+ if (str.trim) return str.trim();
19937
+ return str.replace(/^\s+|\s+$/g, "");
19938
+ }
19939
+ function toHex(n) {
19940
+ if (n < 16) return "0" + n.toString(16);
19941
+ return n.toString(16);
19942
+ }
19943
+ function utf8ToBytes(string, units) {
19944
+ units = units || Infinity;
19945
+ var codePoint;
19946
+ var length = string.length;
19947
+ var leadSurrogate = null;
19948
+ var bytes = [];
19949
+ for (var i = 0; i < length; ++i) {
19950
+ codePoint = string.charCodeAt(i);
19951
+ if (codePoint > 55295 && codePoint < 57344) {
19952
+ if (!leadSurrogate) {
19953
+ if (codePoint > 56319) {
19954
+ if ((units -= 3) > -1) bytes.push(239, 191, 189);
19955
+ continue;
19956
+ } else if (i + 1 === length) {
19957
+ if ((units -= 3) > -1) bytes.push(239, 191, 189);
19958
+ continue;
19959
+ }
19960
+ leadSurrogate = codePoint;
19961
+ continue;
19962
+ }
19963
+ if (codePoint < 56320) {
19964
+ if ((units -= 3) > -1) bytes.push(239, 191, 189);
19965
+ leadSurrogate = codePoint;
19966
+ continue;
19967
+ }
19968
+ codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;
19969
+ } else if (leadSurrogate) {
19970
+ if ((units -= 3) > -1) bytes.push(239, 191, 189);
19971
+ }
19972
+ leadSurrogate = null;
19973
+ if (codePoint < 128) {
19974
+ if ((units -= 1) < 0) break;
19975
+ bytes.push(codePoint);
19976
+ } else if (codePoint < 2048) {
19977
+ if ((units -= 2) < 0) break;
19978
+ bytes.push(codePoint >> 6 | 192, codePoint & 63 | 128);
19979
+ } else if (codePoint < 65536) {
19980
+ if ((units -= 3) < 0) break;
19981
+ bytes.push(codePoint >> 12 | 224, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);
19982
+ } else if (codePoint < 1114112) {
19983
+ if ((units -= 4) < 0) break;
19984
+ bytes.push(codePoint >> 18 | 240, codePoint >> 12 & 63 | 128, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);
19985
+ } else throw new Error("Invalid code point");
19986
+ }
19987
+ return bytes;
19988
+ }
19989
+ function asciiToBytes(str) {
19990
+ var byteArray = [];
19991
+ for (var i = 0; i < str.length; ++i) byteArray.push(str.charCodeAt(i) & 255);
19992
+ return byteArray;
19993
+ }
19994
+ function utf16leToBytes(str, units) {
19995
+ var c, hi, lo;
19996
+ var byteArray = [];
19997
+ for (var i = 0; i < str.length; ++i) {
19998
+ if ((units -= 2) < 0) break;
19999
+ c = str.charCodeAt(i);
20000
+ hi = c >> 8;
20001
+ lo = c % 256;
20002
+ byteArray.push(lo);
20003
+ byteArray.push(hi);
20004
+ }
20005
+ return byteArray;
20006
+ }
20007
+ function base64ToBytes(str) {
20008
+ return toByteArray(base64clean(str));
20009
+ }
20010
+ function blitBuffer(src, dst, offset, length) {
20011
+ for (var i = 0; i < length; ++i) {
20012
+ if (i + offset >= dst.length || i >= src.length) break;
20013
+ dst[i + offset] = src[i];
20014
+ }
20015
+ return i;
20016
+ }
20017
+ function isnan(val) {
20018
+ return val !== val;
20019
+ }
20020
+ function isBuffer(obj) {
20021
+ return obj != null && (!!obj._isBuffer || isFastBuffer(obj) || isSlowBuffer(obj));
20022
+ }
20023
+ function isFastBuffer(obj) {
20024
+ return !!obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
20025
+ }
20026
+ function isSlowBuffer(obj) {
20027
+ return typeof obj.readFloatLE === "function" && typeof obj.slice === "function" && isFastBuffer(obj.slice(0, 0));
20028
+ }
20029
+ //#endregion
20030
+ //#region \0polyfill-node.process.js
20031
+ function defaultSetTimout() {
20032
+ throw new Error("setTimeout has not been defined");
20033
+ }
20034
+ function defaultClearTimeout() {
20035
+ throw new Error("clearTimeout has not been defined");
20036
+ }
20037
+ var cachedSetTimeout = defaultSetTimout;
20038
+ var cachedClearTimeout = defaultClearTimeout;
20039
+ if (typeof _polyfill_node_global_default.setTimeout === "function") cachedSetTimeout = setTimeout;
20040
+ if (typeof _polyfill_node_global_default.clearTimeout === "function") cachedClearTimeout = clearTimeout;
20041
+ function runTimeout(fun) {
20042
+ if (cachedSetTimeout === setTimeout) return setTimeout(fun, 0);
20043
+ if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
20044
+ cachedSetTimeout = setTimeout;
20045
+ return setTimeout(fun, 0);
20046
+ }
20047
+ try {
20048
+ return cachedSetTimeout(fun, 0);
20049
+ } catch (e) {
20050
+ try {
20051
+ return cachedSetTimeout.call(null, fun, 0);
20052
+ } catch (e) {
20053
+ return cachedSetTimeout.call(this, fun, 0);
20054
+ }
20055
+ }
20056
+ }
20057
+ function runClearTimeout(marker) {
20058
+ if (cachedClearTimeout === clearTimeout) return clearTimeout(marker);
20059
+ if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
20060
+ cachedClearTimeout = clearTimeout;
20061
+ return clearTimeout(marker);
20062
+ }
20063
+ try {
20064
+ return cachedClearTimeout(marker);
20065
+ } catch (e) {
20066
+ try {
20067
+ return cachedClearTimeout.call(null, marker);
20068
+ } catch (e) {
20069
+ return cachedClearTimeout.call(this, marker);
20070
+ }
20071
+ }
20072
+ }
20073
+ var queue = [];
20074
+ var draining = false;
20075
+ var currentQueue;
20076
+ var queueIndex = -1;
20077
+ function cleanUpNextTick() {
20078
+ if (!draining || !currentQueue) return;
20079
+ draining = false;
20080
+ if (currentQueue.length) queue = currentQueue.concat(queue);
20081
+ else queueIndex = -1;
20082
+ if (queue.length) drainQueue();
20083
+ }
20084
+ function drainQueue() {
20085
+ if (draining) return;
20086
+ var timeout = runTimeout(cleanUpNextTick);
20087
+ draining = true;
20088
+ var len = queue.length;
20089
+ while (len) {
20090
+ currentQueue = queue;
20091
+ queue = [];
20092
+ while (++queueIndex < len) if (currentQueue) currentQueue[queueIndex].run();
20093
+ queueIndex = -1;
20094
+ len = queue.length;
20095
+ }
20096
+ currentQueue = null;
20097
+ draining = false;
20098
+ runClearTimeout(timeout);
20099
+ }
20100
+ function nextTick(fun) {
20101
+ var args = new Array(arguments.length - 1);
20102
+ if (arguments.length > 1) for (var i = 1; i < arguments.length; i++) args[i - 1] = arguments[i];
20103
+ queue.push(new Item(fun, args));
20104
+ if (queue.length === 1 && !draining) runTimeout(drainQueue);
20105
+ }
20106
+ function Item(fun, array) {
20107
+ this.fun = fun;
20108
+ this.array = array;
20109
+ }
20110
+ Item.prototype.run = function() {
20111
+ this.fun.apply(null, this.array);
20112
+ };
20113
+ var title = "browser";
20114
+ var platform = "browser";
20115
+ var env = {};
20116
+ var argv = [];
20117
+ var versions = {};
20118
+ var release = {};
20119
+ var config = {};
20120
+ function noop() {}
20121
+ var on = noop;
20122
+ var addListener = noop;
20123
+ var once = noop;
20124
+ var off = noop;
20125
+ var removeListener = noop;
20126
+ var removeAllListeners = noop;
20127
+ var emit = noop;
20128
+ function binding(name) {
20129
+ throw new Error("process.binding is not supported");
20130
+ }
20131
+ function cwd() {
20132
+ return "/";
20133
+ }
20134
+ function chdir(dir) {
20135
+ throw new Error("process.chdir is not supported");
20136
+ }
20137
+ function umask() {
20138
+ return 0;
20139
+ }
20140
+ var performance = _polyfill_node_global_default.performance || {};
20141
+ var performanceNow = performance.now || performance.mozNow || performance.msNow || performance.oNow || performance.webkitNow || function() {
20142
+ return (/* @__PURE__ */ new Date()).getTime();
20143
+ };
20144
+ function hrtime(previousTimestamp) {
20145
+ var clocktime = performanceNow.call(performance) * .001;
20146
+ var seconds = Math.floor(clocktime);
20147
+ var nanoseconds = Math.floor(clocktime % 1 * 1e9);
20148
+ if (previousTimestamp) {
20149
+ seconds = seconds - previousTimestamp[0];
20150
+ nanoseconds = nanoseconds - previousTimestamp[1];
20151
+ if (nanoseconds < 0) {
20152
+ seconds--;
20153
+ nanoseconds += 1e9;
20154
+ }
20155
+ }
20156
+ return [seconds, nanoseconds];
20157
+ }
20158
+ var startTime = /* @__PURE__ */ new Date();
20159
+ function uptime() {
20160
+ return (/* @__PURE__ */ new Date() - startTime) / 1e3;
20161
+ }
20162
+ var browser$1 = {
20163
+ nextTick,
20164
+ title,
20165
+ browser: true,
20166
+ env,
20167
+ argv,
20168
+ version: "",
20169
+ versions,
20170
+ on,
20171
+ addListener,
20172
+ once,
20173
+ off,
20174
+ removeListener,
20175
+ removeAllListeners,
20176
+ emit,
20177
+ binding,
20178
+ cwd,
20179
+ chdir,
20180
+ umask,
20181
+ hrtime,
20182
+ platform,
20183
+ release,
20184
+ config,
20185
+ uptime
20186
+ };
20187
+ //#endregion
20188
+ //#region \0polyfill-node._inherits.js
20189
+ var inherits;
20190
+ if (typeof Object.create === "function") inherits = function inherits(ctor, superCtor) {
20191
+ ctor.super_ = superCtor;
20192
+ ctor.prototype = Object.create(superCtor.prototype, { constructor: {
20193
+ value: ctor,
20194
+ enumerable: false,
20195
+ writable: true,
20196
+ configurable: true
20197
+ } });
20198
+ };
20199
+ else inherits = function inherits(ctor, superCtor) {
20200
+ ctor.super_ = superCtor;
20201
+ var TempCtor = function() {};
20202
+ TempCtor.prototype = superCtor.prototype;
20203
+ ctor.prototype = new TempCtor();
20204
+ ctor.prototype.constructor = ctor;
20205
+ };
20206
+ var _polyfill_node__inherits_default = inherits;
20207
+ //#endregion
20208
+ //#region \0polyfill-node.util.js
20209
+ /**
20210
+ * Inherit the prototype methods from one constructor into another.
20211
+ *
20212
+ * The Function.prototype.inherits from lang.js rewritten as a standalone
20213
+ * function (not on Function.prototype). NOTE: If this file is to be loaded
20214
+ * during bootstrapping this function needs to be rewritten using some native
20215
+ * functions as prototype setup using normal JavaScript does not work as
20216
+ * expected during bootstrapping (see mirror.js in r114903).
20217
+ *
20218
+ * @param {function} ctor Constructor function which needs to inherit the
20219
+ * prototype.
20220
+ * @param {function} superCtor Constructor function to inherit prototype from.
20221
+ */
20222
+ var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(obj) {
20223
+ var keys = Object.keys(obj);
20224
+ var descriptors = {};
20225
+ for (var i = 0; i < keys.length; i++) descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);
20226
+ return descriptors;
20227
+ };
20228
+ var formatRegExp = /%[sdj%]/g;
20229
+ function format(f) {
20230
+ if (!isString(f)) {
20231
+ var objects = [];
20232
+ for (var i = 0; i < arguments.length; i++) objects.push(inspect(arguments[i]));
20233
+ return objects.join(" ");
20234
+ }
20235
+ var i = 1;
20236
+ var args = arguments;
20237
+ var len = args.length;
20238
+ var str = String(f).replace(formatRegExp, function(x) {
20239
+ if (x === "%%") return "%";
20240
+ if (i >= len) return x;
20241
+ switch (x) {
20242
+ case "%s": return String(args[i++]);
20243
+ case "%d": return Number(args[i++]);
20244
+ case "%j": try {
20245
+ return JSON.stringify(args[i++]);
20246
+ } catch (_) {
20247
+ return "[Circular]";
20248
+ }
20249
+ default: return x;
20250
+ }
20251
+ });
20252
+ for (var x = args[i]; i < len; x = args[++i]) if (isNull(x) || !isObject(x)) str += " " + x;
20253
+ else str += " " + inspect(x);
20254
+ return str;
20255
+ }
20256
+ function deprecate(fn, msg) {
20257
+ if (isUndefined(_polyfill_node_global_default.process)) return function() {
20258
+ return deprecate(fn, msg).apply(this, arguments);
20259
+ };
20260
+ if (browser$1.noDeprecation === true) return fn;
20261
+ var warned = false;
20262
+ function deprecated() {
20263
+ if (!warned) {
20264
+ if (browser$1.throwDeprecation) throw new Error(msg);
20265
+ else if (browser$1.traceDeprecation) console.trace(msg);
20266
+ else console.error(msg);
20267
+ warned = true;
20268
+ }
20269
+ return fn.apply(this, arguments);
20270
+ }
20271
+ return deprecated;
20272
+ }
20273
+ var debugs = {};
20274
+ var debugEnviron;
20275
+ function debuglog(set) {
20276
+ if (isUndefined(debugEnviron)) debugEnviron = browser$1.env.NODE_DEBUG || "";
20277
+ set = set.toUpperCase();
20278
+ if (!debugs[set]) if (new RegExp("\\b" + set + "\\b", "i").test(debugEnviron)) {
20279
+ var pid = 0;
20280
+ debugs[set] = function() {
20281
+ var msg = format.apply(null, arguments);
20282
+ console.error("%s %d: %s", set, pid, msg);
20283
+ };
20284
+ } else debugs[set] = function() {};
20285
+ return debugs[set];
20286
+ }
20287
+ /**
20288
+ * Echos the value of a value. Trys to print the value out
20289
+ * in the best way possible given the different types.
20290
+ *
20291
+ * @param {Object} obj The object to print out.
20292
+ * @param {Object} opts Optional options object that alters the output.
20293
+ */
20294
+ function inspect(obj, opts) {
20295
+ var ctx = {
20296
+ seen: [],
20297
+ stylize: stylizeNoColor
20298
+ };
20299
+ if (arguments.length >= 3) ctx.depth = arguments[2];
20300
+ if (arguments.length >= 4) ctx.colors = arguments[3];
20301
+ if (isBoolean(opts)) ctx.showHidden = opts;
20302
+ else if (opts) _extend(ctx, opts);
20303
+ if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
20304
+ if (isUndefined(ctx.depth)) ctx.depth = 2;
20305
+ if (isUndefined(ctx.colors)) ctx.colors = false;
20306
+ if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
20307
+ if (ctx.colors) ctx.stylize = stylizeWithColor;
20308
+ return formatValue(ctx, obj, ctx.depth);
20309
+ }
20310
+ inspect.colors = {
20311
+ "bold": [1, 22],
20312
+ "italic": [3, 23],
20313
+ "underline": [4, 24],
20314
+ "inverse": [7, 27],
20315
+ "white": [37, 39],
20316
+ "grey": [90, 39],
20317
+ "black": [30, 39],
20318
+ "blue": [34, 39],
20319
+ "cyan": [36, 39],
20320
+ "green": [32, 39],
20321
+ "magenta": [35, 39],
20322
+ "red": [31, 39],
20323
+ "yellow": [33, 39]
20324
+ };
20325
+ inspect.styles = {
20326
+ "special": "cyan",
20327
+ "number": "yellow",
20328
+ "boolean": "yellow",
20329
+ "undefined": "grey",
20330
+ "null": "bold",
20331
+ "string": "green",
20332
+ "date": "magenta",
20333
+ "regexp": "red"
20334
+ };
20335
+ function stylizeWithColor(str, styleType) {
20336
+ var style = inspect.styles[styleType];
20337
+ if (style) return "\x1B[" + inspect.colors[style][0] + "m" + str + "\x1B[" + inspect.colors[style][1] + "m";
20338
+ else return str;
20339
+ }
20340
+ function stylizeNoColor(str, styleType) {
20341
+ return str;
20342
+ }
20343
+ function arrayToHash(array) {
20344
+ var hash = {};
20345
+ array.forEach(function(val, idx) {
20346
+ hash[val] = true;
20347
+ });
20348
+ return hash;
20349
+ }
20350
+ function formatValue(ctx, value, recurseTimes) {
20351
+ if (ctx.customInspect && value && isFunction(value.inspect) && value.inspect !== inspect && !(value.constructor && value.constructor.prototype === value)) {
20352
+ var ret = value.inspect(recurseTimes, ctx);
20353
+ if (!isString(ret)) ret = formatValue(ctx, ret, recurseTimes);
20354
+ return ret;
20355
+ }
20356
+ var primitive = formatPrimitive(ctx, value);
20357
+ if (primitive) return primitive;
20358
+ var keys = Object.keys(value);
20359
+ var visibleKeys = arrayToHash(keys);
20360
+ if (ctx.showHidden) keys = Object.getOwnPropertyNames(value);
20361
+ if (isError(value) && (keys.indexOf("message") >= 0 || keys.indexOf("description") >= 0)) return formatError(value);
20362
+ if (keys.length === 0) {
20363
+ if (isFunction(value)) {
20364
+ var name = value.name ? ": " + value.name : "";
20365
+ return ctx.stylize("[Function" + name + "]", "special");
20366
+ }
20367
+ if (isRegExp(value)) return ctx.stylize(RegExp.prototype.toString.call(value), "regexp");
20368
+ if (isDate(value)) return ctx.stylize(Date.prototype.toString.call(value), "date");
20369
+ if (isError(value)) return formatError(value);
20370
+ }
20371
+ var base = "", array = false, braces = ["{", "}"];
20372
+ if (isArray(value)) {
20373
+ array = true;
20374
+ braces = ["[", "]"];
20375
+ }
20376
+ if (isFunction(value)) base = " [Function" + (value.name ? ": " + value.name : "") + "]";
20377
+ if (isRegExp(value)) base = " " + RegExp.prototype.toString.call(value);
20378
+ if (isDate(value)) base = " " + Date.prototype.toUTCString.call(value);
20379
+ if (isError(value)) base = " " + formatError(value);
20380
+ if (keys.length === 0 && (!array || value.length == 0)) return braces[0] + base + braces[1];
20381
+ if (recurseTimes < 0) if (isRegExp(value)) return ctx.stylize(RegExp.prototype.toString.call(value), "regexp");
20382
+ else return ctx.stylize("[Object]", "special");
20383
+ ctx.seen.push(value);
20384
+ var output;
20385
+ if (array) output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
20386
+ else output = keys.map(function(key) {
20387
+ return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
20388
+ });
20389
+ ctx.seen.pop();
20390
+ return reduceToSingleString(output, base, braces);
20391
+ }
20392
+ function formatPrimitive(ctx, value) {
20393
+ if (isUndefined(value)) return ctx.stylize("undefined", "undefined");
20394
+ if (isString(value)) {
20395
+ var simple = "'" + JSON.stringify(value).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, "\"") + "'";
20396
+ return ctx.stylize(simple, "string");
20397
+ }
20398
+ if (isNumber(value)) return ctx.stylize("" + value, "number");
20399
+ if (isBoolean(value)) return ctx.stylize("" + value, "boolean");
20400
+ if (isNull(value)) return ctx.stylize("null", "null");
20401
+ }
20402
+ function formatError(value) {
20403
+ return "[" + Error.prototype.toString.call(value) + "]";
20404
+ }
20405
+ function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
20406
+ var output = [];
20407
+ for (var i = 0, l = value.length; i < l; ++i) if (hasOwnProperty(value, String(i))) output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true));
20408
+ else output.push("");
20409
+ keys.forEach(function(key) {
20410
+ if (!key.match(/^\d+$/)) output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key, true));
20411
+ });
20412
+ return output;
20413
+ }
20414
+ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
20415
+ var name, str, desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
20416
+ if (desc.get) if (desc.set) str = ctx.stylize("[Getter/Setter]", "special");
20417
+ else str = ctx.stylize("[Getter]", "special");
20418
+ else if (desc.set) str = ctx.stylize("[Setter]", "special");
20419
+ if (!hasOwnProperty(visibleKeys, key)) name = "[" + key + "]";
20420
+ if (!str) if (ctx.seen.indexOf(desc.value) < 0) {
20421
+ if (isNull(recurseTimes)) str = formatValue(ctx, desc.value, null);
20422
+ else str = formatValue(ctx, desc.value, recurseTimes - 1);
20423
+ if (str.indexOf("\n") > -1) if (array) str = str.split("\n").map(function(line) {
20424
+ return " " + line;
20425
+ }).join("\n").substr(2);
20426
+ else str = "\n" + str.split("\n").map(function(line) {
20427
+ return " " + line;
20428
+ }).join("\n");
20429
+ } else str = ctx.stylize("[Circular]", "special");
20430
+ if (isUndefined(name)) {
20431
+ if (array && key.match(/^\d+$/)) return str;
20432
+ name = JSON.stringify("" + key);
20433
+ if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
20434
+ name = name.substr(1, name.length - 2);
20435
+ name = ctx.stylize(name, "name");
20436
+ } else {
20437
+ name = name.replace(/'/g, "\\'").replace(/\\"/g, "\"").replace(/(^"|"$)/g, "'");
20438
+ name = ctx.stylize(name, "string");
20439
+ }
20440
+ }
20441
+ return name + ": " + str;
20442
+ }
20443
+ function reduceToSingleString(output, base, braces) {
20444
+ var numLinesEst = 0;
20445
+ if (output.reduce(function(prev, cur) {
20446
+ numLinesEst++;
20447
+ if (cur.indexOf("\n") >= 0) numLinesEst++;
20448
+ return prev + cur.replace(/\u001b\[\d\d?m/g, "").length + 1;
20449
+ }, 0) > 60) return braces[0] + (base === "" ? "" : base + "\n ") + " " + output.join(",\n ") + " " + braces[1];
20450
+ return braces[0] + base + " " + output.join(", ") + " " + braces[1];
20451
+ }
20452
+ function isArray(ar) {
20453
+ return Array.isArray(ar);
20454
+ }
20455
+ function isBoolean(arg) {
20456
+ return typeof arg === "boolean";
20457
+ }
20458
+ function isNull(arg) {
20459
+ return arg === null;
20460
+ }
20461
+ function isNumber(arg) {
20462
+ return typeof arg === "number";
20463
+ }
20464
+ function isString(arg) {
20465
+ return typeof arg === "string";
20466
+ }
20467
+ function isUndefined(arg) {
20468
+ return arg === void 0;
20469
+ }
20470
+ function isRegExp(re) {
20471
+ return isObject(re) && objectToString(re) === "[object RegExp]";
20472
+ }
20473
+ function isObject(arg) {
20474
+ return typeof arg === "object" && arg !== null;
20475
+ }
20476
+ function isDate(d) {
20477
+ return isObject(d) && objectToString(d) === "[object Date]";
20478
+ }
20479
+ function isError(e) {
20480
+ return isObject(e) && (objectToString(e) === "[object Error]" || e instanceof Error);
20481
+ }
20482
+ function isFunction(arg) {
20483
+ return typeof arg === "function";
20484
+ }
20485
+ function objectToString(o) {
20486
+ return Object.prototype.toString.call(o);
20487
+ }
20488
+ function _extend(origin, add) {
20489
+ if (!add || !isObject(add)) return origin;
20490
+ var keys = Object.keys(add);
20491
+ var i = keys.length;
20492
+ while (i--) origin[keys[i]] = add[keys[i]];
20493
+ return origin;
20494
+ }
20495
+ function hasOwnProperty(obj, prop) {
20496
+ return Object.prototype.hasOwnProperty.call(obj, prop);
20497
+ }
20498
+ var kCustomPromisifiedSymbol = typeof Symbol !== "undefined" ? Symbol("util.promisify.custom") : void 0;
20499
+ function promisify(original) {
20500
+ if (typeof original !== "function") throw new TypeError("The \"original\" argument must be of type Function");
20501
+ if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {
20502
+ var fn = original[kCustomPromisifiedSymbol];
20503
+ if (typeof fn !== "function") throw new TypeError("The \"util.promisify.custom\" argument must be of type Function");
20504
+ Object.defineProperty(fn, kCustomPromisifiedSymbol, {
20505
+ value: fn,
20506
+ enumerable: false,
20507
+ writable: false,
20508
+ configurable: true
20509
+ });
20510
+ return fn;
20511
+ }
20512
+ function fn() {
20513
+ var promiseResolve, promiseReject;
20514
+ var promise = new Promise(function(resolve, reject) {
20515
+ promiseResolve = resolve;
20516
+ promiseReject = reject;
20517
+ });
20518
+ var args = [];
20519
+ for (var i = 0; i < arguments.length; i++) args.push(arguments[i]);
20520
+ args.push(function(err, value) {
20521
+ if (err) promiseReject(err);
20522
+ else promiseResolve(value);
20523
+ });
20524
+ try {
20525
+ original.apply(this, args);
20526
+ } catch (err) {
20527
+ promiseReject(err);
20528
+ }
20529
+ return promise;
20530
+ }
20531
+ Object.setPrototypeOf(fn, Object.getPrototypeOf(original));
20532
+ if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {
20533
+ value: fn,
20534
+ enumerable: false,
20535
+ writable: false,
20536
+ configurable: true
20537
+ });
20538
+ return Object.defineProperties(fn, getOwnPropertyDescriptors(original));
20539
+ }
20540
+ promisify.custom = kCustomPromisifiedSymbol;
20541
+ //#endregion
20542
+ //#region \0polyfill-node._buffer_list.js
20543
+ var _polyfill_node__buffer_list_default = BufferList;
20544
+ function BufferList() {
20545
+ this.head = null;
20546
+ this.tail = null;
20547
+ this.length = 0;
20548
+ }
20549
+ BufferList.prototype.push = function(v) {
20550
+ var entry = {
20551
+ data: v,
20552
+ next: null
20553
+ };
20554
+ if (this.length > 0) this.tail.next = entry;
20555
+ else this.head = entry;
20556
+ this.tail = entry;
20557
+ ++this.length;
20558
+ };
20559
+ BufferList.prototype.unshift = function(v) {
20560
+ var entry = {
20561
+ data: v,
20562
+ next: this.head
20563
+ };
20564
+ if (this.length === 0) this.tail = entry;
20565
+ this.head = entry;
20566
+ ++this.length;
20567
+ };
20568
+ BufferList.prototype.shift = function() {
20569
+ if (this.length === 0) return;
20570
+ var ret = this.head.data;
20571
+ if (this.length === 1) this.head = this.tail = null;
20572
+ else this.head = this.head.next;
20573
+ --this.length;
20574
+ return ret;
20575
+ };
20576
+ BufferList.prototype.clear = function() {
20577
+ this.head = this.tail = null;
20578
+ this.length = 0;
20579
+ };
20580
+ BufferList.prototype.join = function(s) {
20581
+ if (this.length === 0) return "";
20582
+ var p = this.head;
20583
+ var ret = "" + p.data;
20584
+ while (p = p.next) ret += s + p.data;
20585
+ return ret;
20586
+ };
20587
+ BufferList.prototype.concat = function(n) {
20588
+ if (this.length === 0) return Buffer$1.alloc(0);
20589
+ if (this.length === 1) return this.head.data;
20590
+ var ret = Buffer$1.allocUnsafe(n >>> 0);
20591
+ var p = this.head;
20592
+ var i = 0;
20593
+ while (p) {
20594
+ p.data.copy(ret, i);
20595
+ i += p.data.length;
20596
+ p = p.next;
20597
+ }
20598
+ return ret;
20599
+ };
20600
+ //#endregion
20601
+ //#region \0polyfill-node.string_decoder.js
20602
+ var isBufferEncoding = Buffer$1.isEncoding || function(encoding) {
20603
+ switch (encoding && encoding.toLowerCase()) {
20604
+ case "hex":
20605
+ case "utf8":
20606
+ case "utf-8":
20607
+ case "ascii":
20608
+ case "binary":
20609
+ case "base64":
20610
+ case "ucs2":
20611
+ case "ucs-2":
20612
+ case "utf16le":
20613
+ case "utf-16le":
20614
+ case "raw": return true;
20615
+ default: return false;
20616
+ }
20617
+ };
20618
+ function assertEncoding(encoding) {
20619
+ if (encoding && !isBufferEncoding(encoding)) throw new Error("Unknown encoding: " + encoding);
20620
+ }
20621
+ function StringDecoder(encoding) {
20622
+ this.encoding = (encoding || "utf8").toLowerCase().replace(/[-_]/, "");
20623
+ assertEncoding(encoding);
20624
+ switch (this.encoding) {
20625
+ case "utf8":
20626
+ this.surrogateSize = 3;
20627
+ break;
20628
+ case "ucs2":
20629
+ case "utf16le":
20630
+ this.surrogateSize = 2;
20631
+ this.detectIncompleteChar = utf16DetectIncompleteChar;
20632
+ break;
20633
+ case "base64":
20634
+ this.surrogateSize = 3;
20635
+ this.detectIncompleteChar = base64DetectIncompleteChar;
20636
+ break;
20637
+ default:
20638
+ this.write = passThroughWrite;
20639
+ return;
20640
+ }
20641
+ this.charBuffer = new Buffer$1(6);
20642
+ this.charReceived = 0;
20643
+ this.charLength = 0;
20644
+ }
20645
+ StringDecoder.prototype.write = function(buffer) {
20646
+ var charStr = "";
20647
+ while (this.charLength) {
20648
+ var available = buffer.length >= this.charLength - this.charReceived ? this.charLength - this.charReceived : buffer.length;
20649
+ buffer.copy(this.charBuffer, this.charReceived, 0, available);
20650
+ this.charReceived += available;
20651
+ if (this.charReceived < this.charLength) return "";
20652
+ buffer = buffer.slice(available, buffer.length);
20653
+ charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding);
20654
+ var charCode = charStr.charCodeAt(charStr.length - 1);
20655
+ if (charCode >= 55296 && charCode <= 56319) {
20656
+ this.charLength += this.surrogateSize;
20657
+ charStr = "";
20658
+ continue;
20659
+ }
20660
+ this.charReceived = this.charLength = 0;
20661
+ if (buffer.length === 0) return charStr;
20662
+ break;
20663
+ }
20664
+ this.detectIncompleteChar(buffer);
20665
+ var end = buffer.length;
20666
+ if (this.charLength) {
20667
+ buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end);
20668
+ end -= this.charReceived;
20669
+ }
20670
+ charStr += buffer.toString(this.encoding, 0, end);
20671
+ var end = charStr.length - 1;
20672
+ var charCode = charStr.charCodeAt(end);
20673
+ if (charCode >= 55296 && charCode <= 56319) {
20674
+ var size = this.surrogateSize;
20675
+ this.charLength += size;
20676
+ this.charReceived += size;
20677
+ this.charBuffer.copy(this.charBuffer, size, 0, size);
20678
+ buffer.copy(this.charBuffer, 0, 0, size);
20679
+ return charStr.substring(0, end);
20680
+ }
20681
+ return charStr;
20682
+ };
20683
+ StringDecoder.prototype.detectIncompleteChar = function(buffer) {
20684
+ var i = buffer.length >= 3 ? 3 : buffer.length;
20685
+ for (; i > 0; i--) {
20686
+ var c = buffer[buffer.length - i];
20687
+ if (i == 1 && c >> 5 == 6) {
20688
+ this.charLength = 2;
20689
+ break;
20690
+ }
20691
+ if (i <= 2 && c >> 4 == 14) {
20692
+ this.charLength = 3;
20693
+ break;
20694
+ }
20695
+ if (i <= 3 && c >> 3 == 30) {
20696
+ this.charLength = 4;
20697
+ break;
20698
+ }
20699
+ }
20700
+ this.charReceived = i;
20701
+ };
20702
+ StringDecoder.prototype.end = function(buffer) {
20703
+ var res = "";
20704
+ if (buffer && buffer.length) res = this.write(buffer);
20705
+ if (this.charReceived) {
20706
+ var cr = this.charReceived;
20707
+ var buf = this.charBuffer;
20708
+ var enc = this.encoding;
20709
+ res += buf.slice(0, cr).toString(enc);
20710
+ }
20711
+ return res;
20712
+ };
20713
+ function passThroughWrite(buffer) {
20714
+ return buffer.toString(this.encoding);
20715
+ }
20716
+ function utf16DetectIncompleteChar(buffer) {
20717
+ this.charReceived = buffer.length % 2;
20718
+ this.charLength = this.charReceived ? 2 : 0;
20719
+ }
20720
+ function base64DetectIncompleteChar(buffer) {
20721
+ this.charReceived = buffer.length % 3;
20722
+ this.charLength = this.charReceived ? 3 : 0;
20723
+ }
20724
+ //#endregion
20725
+ //#region \0polyfill-node._stream_readable.js
20726
+ Readable.ReadableState = ReadableState;
20727
+ var debug = debuglog("stream");
20728
+ _polyfill_node__inherits_default(Readable, EventEmitter);
20729
+ function prependListener(emitter, event, fn) {
20730
+ if (typeof emitter.prependListener === "function") return emitter.prependListener(event, fn);
20731
+ else if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);
20732
+ else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);
20733
+ else emitter._events[event] = [fn, emitter._events[event]];
20734
+ }
20735
+ function listenerCount(emitter, type) {
20736
+ return emitter.listeners(type).length;
20737
+ }
20738
+ function ReadableState(options, stream) {
20739
+ options = options || {};
20740
+ this.objectMode = !!options.objectMode;
20741
+ if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
20742
+ var hwm = options.highWaterMark;
20743
+ var defaultHwm = this.objectMode ? 16 : 16 * 1024;
20744
+ this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
20745
+ this.highWaterMark = ~~this.highWaterMark;
20746
+ this.buffer = new _polyfill_node__buffer_list_default();
20747
+ this.length = 0;
20748
+ this.pipes = null;
20749
+ this.pipesCount = 0;
20750
+ this.flowing = null;
20751
+ this.ended = false;
20752
+ this.endEmitted = false;
20753
+ this.reading = false;
20754
+ this.sync = true;
20755
+ this.needReadable = false;
20756
+ this.emittedReadable = false;
20757
+ this.readableListening = false;
20758
+ this.resumeScheduled = false;
20759
+ this.defaultEncoding = options.defaultEncoding || "utf8";
20760
+ this.ranOut = false;
20761
+ this.awaitDrain = 0;
20762
+ this.readingMore = false;
20763
+ this.decoder = null;
20764
+ this.encoding = null;
20765
+ if (options.encoding) {
20766
+ this.decoder = new StringDecoder(options.encoding);
20767
+ this.encoding = options.encoding;
20768
+ }
20769
+ }
20770
+ function Readable(options) {
20771
+ if (!(this instanceof Readable)) return new Readable(options);
20772
+ this._readableState = new ReadableState(options, this);
20773
+ this.readable = true;
20774
+ if (options && typeof options.read === "function") this._read = options.read;
20775
+ EventEmitter.call(this);
20776
+ }
20777
+ Readable.prototype.push = function(chunk, encoding) {
20778
+ var state = this._readableState;
20779
+ if (!state.objectMode && typeof chunk === "string") {
20780
+ encoding = encoding || state.defaultEncoding;
20781
+ if (encoding !== state.encoding) {
20782
+ chunk = Buffer$1.from(chunk, encoding);
20783
+ encoding = "";
20784
+ }
20785
+ }
20786
+ return readableAddChunk(this, state, chunk, encoding, false);
20787
+ };
20788
+ Readable.prototype.unshift = function(chunk) {
20789
+ var state = this._readableState;
20790
+ return readableAddChunk(this, state, chunk, "", true);
20791
+ };
20792
+ Readable.prototype.isPaused = function() {
20793
+ return this._readableState.flowing === false;
20794
+ };
20795
+ function readableAddChunk(stream, state, chunk, encoding, addToFront) {
20796
+ var er = chunkInvalid(state, chunk);
20797
+ if (er) stream.emit("error", er);
20798
+ else if (chunk === null) {
20799
+ state.reading = false;
20800
+ onEofChunk(stream, state);
20801
+ } else if (state.objectMode || chunk && chunk.length > 0) if (state.ended && !addToFront) {
20802
+ var e = /* @__PURE__ */ new Error("stream.push() after EOF");
20803
+ stream.emit("error", e);
20804
+ } else if (state.endEmitted && addToFront) {
20805
+ var _e = /* @__PURE__ */ new Error("stream.unshift() after end event");
20806
+ stream.emit("error", _e);
20807
+ } else {
20808
+ var skipAdd;
20809
+ if (state.decoder && !addToFront && !encoding) {
20810
+ chunk = state.decoder.write(chunk);
20811
+ skipAdd = !state.objectMode && chunk.length === 0;
20812
+ }
20813
+ if (!addToFront) state.reading = false;
20814
+ if (!skipAdd) if (state.flowing && state.length === 0 && !state.sync) {
20815
+ stream.emit("data", chunk);
20816
+ stream.read(0);
20817
+ } else {
20818
+ state.length += state.objectMode ? 1 : chunk.length;
20819
+ if (addToFront) state.buffer.unshift(chunk);
20820
+ else state.buffer.push(chunk);
20821
+ if (state.needReadable) emitReadable(stream);
20822
+ }
20823
+ maybeReadMore(stream, state);
20824
+ }
20825
+ else if (!addToFront) state.reading = false;
20826
+ return needMoreData(state);
20827
+ }
20828
+ function needMoreData(state) {
20829
+ return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
20830
+ }
20831
+ Readable.prototype.setEncoding = function(enc) {
20832
+ this._readableState.decoder = new StringDecoder(enc);
20833
+ this._readableState.encoding = enc;
20834
+ return this;
20835
+ };
20836
+ var MAX_HWM = 8388608;
20837
+ function computeNewHighWaterMark(n) {
20838
+ if (n >= MAX_HWM) n = MAX_HWM;
20839
+ else {
20840
+ n--;
20841
+ n |= n >>> 1;
20842
+ n |= n >>> 2;
20843
+ n |= n >>> 4;
20844
+ n |= n >>> 8;
20845
+ n |= n >>> 16;
20846
+ n++;
20847
+ }
20848
+ return n;
20849
+ }
20850
+ function howMuchToRead(n, state) {
20851
+ if (n <= 0 || state.length === 0 && state.ended) return 0;
20852
+ if (state.objectMode) return 1;
20853
+ if (n !== n) if (state.flowing && state.length) return state.buffer.head.data.length;
20854
+ else return state.length;
20855
+ if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
20856
+ if (n <= state.length) return n;
20857
+ if (!state.ended) {
20858
+ state.needReadable = true;
20859
+ return 0;
20860
+ }
20861
+ return state.length;
20862
+ }
20863
+ Readable.prototype.read = function(n) {
20864
+ debug("read", n);
20865
+ n = parseInt(n, 10);
20866
+ var state = this._readableState;
20867
+ var nOrig = n;
20868
+ if (n !== 0) state.emittedReadable = false;
20869
+ if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
20870
+ debug("read: emitReadable", state.length, state.ended);
20871
+ if (state.length === 0 && state.ended) endReadable(this);
20872
+ else emitReadable(this);
20873
+ return null;
20874
+ }
20875
+ n = howMuchToRead(n, state);
20876
+ if (n === 0 && state.ended) {
20877
+ if (state.length === 0) endReadable(this);
20878
+ return null;
20879
+ }
20880
+ var doRead = state.needReadable;
20881
+ debug("need readable", doRead);
20882
+ if (state.length === 0 || state.length - n < state.highWaterMark) {
20883
+ doRead = true;
20884
+ debug("length less than watermark", doRead);
20885
+ }
20886
+ if (state.ended || state.reading) {
20887
+ doRead = false;
20888
+ debug("reading or ended", doRead);
20889
+ } else if (doRead) {
20890
+ debug("do read");
20891
+ state.reading = true;
20892
+ state.sync = true;
20893
+ if (state.length === 0) state.needReadable = true;
20894
+ this._read(state.highWaterMark);
20895
+ state.sync = false;
20896
+ if (!state.reading) n = howMuchToRead(nOrig, state);
20897
+ }
20898
+ var ret;
20899
+ if (n > 0) ret = fromList(n, state);
20900
+ else ret = null;
20901
+ if (ret === null) {
20902
+ state.needReadable = true;
20903
+ n = 0;
20904
+ } else state.length -= n;
20905
+ if (state.length === 0) {
20906
+ if (!state.ended) state.needReadable = true;
20907
+ if (nOrig !== n && state.ended) endReadable(this);
20908
+ }
20909
+ if (ret !== null) this.emit("data", ret);
20910
+ return ret;
20911
+ };
20912
+ function chunkInvalid(state, chunk) {
20913
+ var er = null;
20914
+ if (!Buffer$1.isBuffer(chunk) && typeof chunk !== "string" && chunk !== null && chunk !== void 0 && !state.objectMode) er = /* @__PURE__ */ new TypeError("Invalid non-string/buffer chunk");
20915
+ return er;
20916
+ }
20917
+ function onEofChunk(stream, state) {
20918
+ if (state.ended) return;
20919
+ if (state.decoder) {
20920
+ var chunk = state.decoder.end();
20921
+ if (chunk && chunk.length) {
20922
+ state.buffer.push(chunk);
20923
+ state.length += state.objectMode ? 1 : chunk.length;
20924
+ }
20925
+ }
20926
+ state.ended = true;
20927
+ emitReadable(stream);
20928
+ }
20929
+ function emitReadable(stream) {
20930
+ var state = stream._readableState;
20931
+ state.needReadable = false;
20932
+ if (!state.emittedReadable) {
20933
+ debug("emitReadable", state.flowing);
20934
+ state.emittedReadable = true;
20935
+ if (state.sync) nextTick(emitReadable_, stream);
20936
+ else emitReadable_(stream);
20937
+ }
20938
+ }
20939
+ function emitReadable_(stream) {
20940
+ debug("emit readable");
20941
+ stream.emit("readable");
20942
+ flow(stream);
20943
+ }
20944
+ function maybeReadMore(stream, state) {
20945
+ if (!state.readingMore) {
20946
+ state.readingMore = true;
20947
+ nextTick(maybeReadMore_, stream, state);
20948
+ }
20949
+ }
20950
+ function maybeReadMore_(stream, state) {
20951
+ var len = state.length;
20952
+ while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
20953
+ debug("maybeReadMore read 0");
20954
+ stream.read(0);
20955
+ if (len === state.length) break;
20956
+ else len = state.length;
20957
+ }
20958
+ state.readingMore = false;
20959
+ }
20960
+ Readable.prototype._read = function(n) {
20961
+ this.emit("error", /* @__PURE__ */ new Error("not implemented"));
20962
+ };
20963
+ Readable.prototype.pipe = function(dest, pipeOpts) {
20964
+ var src = this;
20965
+ var state = this._readableState;
20966
+ switch (state.pipesCount) {
20967
+ case 0:
20968
+ state.pipes = dest;
20969
+ break;
20970
+ case 1:
20971
+ state.pipes = [state.pipes, dest];
20972
+ break;
20973
+ default:
20974
+ state.pipes.push(dest);
20975
+ break;
20976
+ }
20977
+ state.pipesCount += 1;
20978
+ debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts);
20979
+ var endFn = !pipeOpts || pipeOpts.end !== false ? onend : cleanup;
20980
+ if (state.endEmitted) nextTick(endFn);
20981
+ else src.once("end", endFn);
20982
+ dest.on("unpipe", onunpipe);
20983
+ function onunpipe(readable) {
20984
+ debug("onunpipe");
20985
+ if (readable === src) cleanup();
20986
+ }
20987
+ function onend() {
20988
+ debug("onend");
20989
+ dest.end();
20990
+ }
20991
+ var ondrain = pipeOnDrain(src);
20992
+ dest.on("drain", ondrain);
20993
+ var cleanedUp = false;
20994
+ function cleanup() {
20995
+ debug("cleanup");
20996
+ dest.removeListener("close", onclose);
20997
+ dest.removeListener("finish", onfinish);
20998
+ dest.removeListener("drain", ondrain);
20999
+ dest.removeListener("error", onerror);
21000
+ dest.removeListener("unpipe", onunpipe);
21001
+ src.removeListener("end", onend);
21002
+ src.removeListener("end", cleanup);
21003
+ src.removeListener("data", ondata);
21004
+ cleanedUp = true;
21005
+ if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
21006
+ }
21007
+ var increasedAwaitDrain = false;
21008
+ src.on("data", ondata);
21009
+ function ondata(chunk) {
21010
+ debug("ondata");
21011
+ increasedAwaitDrain = false;
21012
+ if (false === dest.write(chunk) && !increasedAwaitDrain) {
21013
+ if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
21014
+ debug("false write response, pause", src._readableState.awaitDrain);
21015
+ src._readableState.awaitDrain++;
21016
+ increasedAwaitDrain = true;
21017
+ }
21018
+ src.pause();
21019
+ }
21020
+ }
21021
+ function onerror(er) {
21022
+ debug("onerror", er);
21023
+ unpipe();
21024
+ dest.removeListener("error", onerror);
21025
+ if (listenerCount(dest, "error") === 0) dest.emit("error", er);
21026
+ }
21027
+ prependListener(dest, "error", onerror);
21028
+ function onclose() {
21029
+ dest.removeListener("finish", onfinish);
21030
+ unpipe();
21031
+ }
21032
+ dest.once("close", onclose);
21033
+ function onfinish() {
21034
+ debug("onfinish");
21035
+ dest.removeListener("close", onclose);
21036
+ unpipe();
21037
+ }
21038
+ dest.once("finish", onfinish);
21039
+ function unpipe() {
21040
+ debug("unpipe");
21041
+ src.unpipe(dest);
21042
+ }
21043
+ dest.emit("pipe", src);
21044
+ if (!state.flowing) {
21045
+ debug("pipe resume");
21046
+ src.resume();
21047
+ }
21048
+ return dest;
21049
+ };
21050
+ function pipeOnDrain(src) {
21051
+ return function() {
21052
+ var state = src._readableState;
21053
+ debug("pipeOnDrain", state.awaitDrain);
21054
+ if (state.awaitDrain) state.awaitDrain--;
21055
+ if (state.awaitDrain === 0 && src.listeners("data").length) {
21056
+ state.flowing = true;
21057
+ flow(src);
21058
+ }
21059
+ };
21060
+ }
21061
+ Readable.prototype.unpipe = function(dest) {
21062
+ var state = this._readableState;
21063
+ if (state.pipesCount === 0) return this;
21064
+ if (state.pipesCount === 1) {
21065
+ if (dest && dest !== state.pipes) return this;
21066
+ if (!dest) dest = state.pipes;
21067
+ state.pipes = null;
21068
+ state.pipesCount = 0;
21069
+ state.flowing = false;
21070
+ if (dest) dest.emit("unpipe", this);
21071
+ return this;
21072
+ }
21073
+ if (!dest) {
21074
+ var dests = state.pipes;
21075
+ var len = state.pipesCount;
21076
+ state.pipes = null;
21077
+ state.pipesCount = 0;
21078
+ state.flowing = false;
21079
+ for (var _i = 0; _i < len; _i++) dests[_i].emit("unpipe", this);
21080
+ return this;
21081
+ }
21082
+ var i = indexOf(state.pipes, dest);
21083
+ if (i === -1) return this;
21084
+ state.pipes.splice(i, 1);
21085
+ state.pipesCount -= 1;
21086
+ if (state.pipesCount === 1) state.pipes = state.pipes[0];
21087
+ dest.emit("unpipe", this);
21088
+ return this;
21089
+ };
21090
+ Readable.prototype.on = function(ev, fn) {
21091
+ var res = EventEmitter.prototype.on.call(this, ev, fn);
21092
+ if (ev === "data") {
21093
+ if (this._readableState.flowing !== false) this.resume();
21094
+ } else if (ev === "readable") {
21095
+ var state = this._readableState;
21096
+ if (!state.endEmitted && !state.readableListening) {
21097
+ state.readableListening = state.needReadable = true;
21098
+ state.emittedReadable = false;
21099
+ if (!state.reading) nextTick(nReadingNextTick, this);
21100
+ else if (state.length) emitReadable(this, state);
21101
+ }
21102
+ }
21103
+ return res;
21104
+ };
21105
+ Readable.prototype.addListener = Readable.prototype.on;
21106
+ function nReadingNextTick(self) {
21107
+ debug("readable nexttick read 0");
21108
+ self.read(0);
21109
+ }
21110
+ Readable.prototype.resume = function() {
21111
+ var state = this._readableState;
21112
+ if (!state.flowing) {
21113
+ debug("resume");
21114
+ state.flowing = true;
21115
+ resume(this, state);
21116
+ }
21117
+ return this;
21118
+ };
21119
+ function resume(stream, state) {
21120
+ if (!state.resumeScheduled) {
21121
+ state.resumeScheduled = true;
21122
+ nextTick(resume_, stream, state);
21123
+ }
21124
+ }
21125
+ function resume_(stream, state) {
21126
+ if (!state.reading) {
21127
+ debug("resume read 0");
21128
+ stream.read(0);
21129
+ }
21130
+ state.resumeScheduled = false;
21131
+ state.awaitDrain = 0;
21132
+ stream.emit("resume");
21133
+ flow(stream);
21134
+ if (state.flowing && !state.reading) stream.read(0);
21135
+ }
21136
+ Readable.prototype.pause = function() {
21137
+ debug("call pause flowing=%j", this._readableState.flowing);
21138
+ if (false !== this._readableState.flowing) {
21139
+ debug("pause");
21140
+ this._readableState.flowing = false;
21141
+ this.emit("pause");
21142
+ }
21143
+ return this;
21144
+ };
21145
+ function flow(stream) {
21146
+ var state = stream._readableState;
21147
+ debug("flow", state.flowing);
21148
+ while (state.flowing && stream.read() !== null);
21149
+ }
21150
+ Readable.prototype.wrap = function(stream) {
21151
+ var state = this._readableState;
21152
+ var paused = false;
21153
+ var self = this;
21154
+ stream.on("end", function() {
21155
+ debug("wrapped end");
21156
+ if (state.decoder && !state.ended) {
21157
+ var chunk = state.decoder.end();
21158
+ if (chunk && chunk.length) self.push(chunk);
21159
+ }
21160
+ self.push(null);
21161
+ });
21162
+ stream.on("data", function(chunk) {
21163
+ debug("wrapped data");
21164
+ if (state.decoder) chunk = state.decoder.write(chunk);
21165
+ if (state.objectMode && (chunk === null || chunk === void 0)) return;
21166
+ else if (!state.objectMode && (!chunk || !chunk.length)) return;
21167
+ if (!self.push(chunk)) {
21168
+ paused = true;
21169
+ stream.pause();
21170
+ }
21171
+ });
21172
+ for (var i in stream) if (this[i] === void 0 && typeof stream[i] === "function") this[i] = function(method) {
21173
+ return function() {
21174
+ return stream[method].apply(stream, arguments);
21175
+ };
21176
+ }(i);
21177
+ forEach([
21178
+ "error",
21179
+ "close",
21180
+ "destroy",
21181
+ "pause",
21182
+ "resume"
21183
+ ], function(ev) {
21184
+ stream.on(ev, self.emit.bind(self, ev));
21185
+ });
21186
+ self._read = function(n) {
21187
+ debug("wrapped _read", n);
21188
+ if (paused) {
21189
+ paused = false;
21190
+ stream.resume();
21191
+ }
21192
+ };
21193
+ return self;
21194
+ };
21195
+ Readable._fromList = fromList;
21196
+ function fromList(n, state) {
21197
+ if (state.length === 0) return null;
21198
+ var ret;
21199
+ if (state.objectMode) ret = state.buffer.shift();
21200
+ else if (!n || n >= state.length) {
21201
+ if (state.decoder) ret = state.buffer.join("");
21202
+ else if (state.buffer.length === 1) ret = state.buffer.head.data;
21203
+ else ret = state.buffer.concat(state.length);
21204
+ state.buffer.clear();
21205
+ } else ret = fromListPartial(n, state.buffer, state.decoder);
21206
+ return ret;
21207
+ }
21208
+ function fromListPartial(n, list, hasStrings) {
21209
+ var ret;
21210
+ if (n < list.head.data.length) {
21211
+ ret = list.head.data.slice(0, n);
21212
+ list.head.data = list.head.data.slice(n);
21213
+ } else if (n === list.head.data.length) ret = list.shift();
21214
+ else ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
21215
+ return ret;
21216
+ }
21217
+ function copyFromBufferString(n, list) {
21218
+ var p = list.head;
21219
+ var c = 1;
21220
+ var ret = p.data;
21221
+ n -= ret.length;
21222
+ while (p = p.next) {
21223
+ var str = p.data;
21224
+ var nb = n > str.length ? str.length : n;
21225
+ if (nb === str.length) ret += str;
21226
+ else ret += str.slice(0, n);
21227
+ n -= nb;
21228
+ if (n === 0) {
21229
+ if (nb === str.length) {
21230
+ ++c;
21231
+ if (p.next) list.head = p.next;
21232
+ else list.head = list.tail = null;
21233
+ } else {
21234
+ list.head = p;
21235
+ p.data = str.slice(nb);
21236
+ }
21237
+ break;
21238
+ }
21239
+ ++c;
21240
+ }
21241
+ list.length -= c;
21242
+ return ret;
21243
+ }
21244
+ function copyFromBuffer(n, list) {
21245
+ var ret = Buffer$1.allocUnsafe(n);
21246
+ var p = list.head;
21247
+ var c = 1;
21248
+ p.data.copy(ret);
21249
+ n -= p.data.length;
21250
+ while (p = p.next) {
21251
+ var buf = p.data;
21252
+ var nb = n > buf.length ? buf.length : n;
21253
+ buf.copy(ret, ret.length - n, 0, nb);
21254
+ n -= nb;
21255
+ if (n === 0) {
21256
+ if (nb === buf.length) {
21257
+ ++c;
21258
+ if (p.next) list.head = p.next;
21259
+ else list.head = list.tail = null;
21260
+ } else {
21261
+ list.head = p;
21262
+ p.data = buf.slice(nb);
21263
+ }
21264
+ break;
21265
+ }
21266
+ ++c;
21267
+ }
21268
+ list.length -= c;
21269
+ return ret;
21270
+ }
21271
+ function endReadable(stream) {
21272
+ var state = stream._readableState;
21273
+ if (state.length > 0) throw new Error("\"endReadable()\" called on non-empty stream");
21274
+ if (!state.endEmitted) {
21275
+ state.ended = true;
21276
+ nextTick(endReadableNT, state, stream);
21277
+ }
21278
+ }
21279
+ function endReadableNT(state, stream) {
21280
+ if (!state.endEmitted && state.length === 0) {
21281
+ state.endEmitted = true;
21282
+ stream.readable = false;
21283
+ stream.emit("end");
21284
+ }
21285
+ }
21286
+ function forEach(xs, f) {
21287
+ for (var i = 0, l = xs.length; i < l; i++) f(xs[i], i);
21288
+ }
21289
+ function indexOf(xs, x) {
21290
+ for (var i = 0, l = xs.length; i < l; i++) if (xs[i] === x) return i;
21291
+ return -1;
21292
+ }
21293
+ //#endregion
21294
+ //#region \0polyfill-node._stream_writable.js
21295
+ Writable.WritableState = WritableState;
21296
+ _polyfill_node__inherits_default(Writable, EventEmitter);
21297
+ function nop() {}
21298
+ function WriteReq(chunk, encoding, cb) {
21299
+ this.chunk = chunk;
21300
+ this.encoding = encoding;
21301
+ this.callback = cb;
21302
+ this.next = null;
21303
+ }
21304
+ function WritableState(options, stream) {
21305
+ Object.defineProperty(this, "buffer", { get: deprecate(function() {
21306
+ return this.getBuffer();
21307
+ }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.") });
21308
+ options = options || {};
21309
+ this.objectMode = !!options.objectMode;
21310
+ if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
21311
+ var hwm = options.highWaterMark;
21312
+ var defaultHwm = this.objectMode ? 16 : 16 * 1024;
21313
+ this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
21314
+ this.highWaterMark = ~~this.highWaterMark;
21315
+ this.needDrain = false;
21316
+ this.ending = false;
21317
+ this.ended = false;
21318
+ this.finished = false;
21319
+ this.decodeStrings = !(options.decodeStrings === false);
21320
+ this.defaultEncoding = options.defaultEncoding || "utf8";
21321
+ this.length = 0;
21322
+ this.writing = false;
21323
+ this.corked = 0;
21324
+ this.sync = true;
21325
+ this.bufferProcessing = false;
21326
+ this.onwrite = function(er) {
21327
+ onwrite(stream, er);
21328
+ };
21329
+ this.writecb = null;
21330
+ this.writelen = 0;
21331
+ this.bufferedRequest = null;
21332
+ this.lastBufferedRequest = null;
21333
+ this.pendingcb = 0;
21334
+ this.prefinished = false;
21335
+ this.errorEmitted = false;
21336
+ this.bufferedRequestCount = 0;
21337
+ this.corkedRequestsFree = new CorkedRequest(this);
21338
+ }
21339
+ WritableState.prototype.getBuffer = function writableStateGetBuffer() {
21340
+ var current = this.bufferedRequest;
21341
+ var out = [];
21342
+ while (current) {
21343
+ out.push(current);
21344
+ current = current.next;
21345
+ }
21346
+ return out;
21347
+ };
21348
+ function Writable(options) {
21349
+ if (!(this instanceof Writable) && !(this instanceof Duplex)) return new Writable(options);
21350
+ this._writableState = new WritableState(options, this);
21351
+ this.writable = true;
21352
+ if (options) {
21353
+ if (typeof options.write === "function") this._write = options.write;
21354
+ if (typeof options.writev === "function") this._writev = options.writev;
21355
+ }
21356
+ EventEmitter.call(this);
21357
+ }
21358
+ Writable.prototype.pipe = function() {
21359
+ this.emit("error", /* @__PURE__ */ new Error("Cannot pipe, not readable"));
21360
+ };
21361
+ function writeAfterEnd(stream, cb) {
21362
+ var er = /* @__PURE__ */ new Error("write after end");
21363
+ stream.emit("error", er);
21364
+ nextTick(cb, er);
21365
+ }
21366
+ function validChunk(stream, state, chunk, cb) {
21367
+ var valid = true;
21368
+ var er = false;
21369
+ if (chunk === null) er = /* @__PURE__ */ new TypeError("May not write null values to stream");
21370
+ else if (!Buffer$1.isBuffer(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) er = /* @__PURE__ */ new TypeError("Invalid non-string/buffer chunk");
21371
+ if (er) {
21372
+ stream.emit("error", er);
21373
+ nextTick(cb, er);
21374
+ valid = false;
21375
+ }
21376
+ return valid;
21377
+ }
21378
+ Writable.prototype.write = function(chunk, encoding, cb) {
21379
+ var state = this._writableState;
21380
+ var ret = false;
21381
+ if (typeof encoding === "function") {
21382
+ cb = encoding;
21383
+ encoding = null;
21384
+ }
21385
+ if (Buffer$1.isBuffer(chunk)) encoding = "buffer";
21386
+ else if (!encoding) encoding = state.defaultEncoding;
21387
+ if (typeof cb !== "function") cb = nop;
21388
+ if (state.ended) writeAfterEnd(this, cb);
21389
+ else if (validChunk(this, state, chunk, cb)) {
21390
+ state.pendingcb++;
21391
+ ret = writeOrBuffer(this, state, chunk, encoding, cb);
21392
+ }
21393
+ return ret;
21394
+ };
21395
+ Writable.prototype.cork = function() {
21396
+ var state = this._writableState;
21397
+ state.corked++;
21398
+ };
21399
+ Writable.prototype.uncork = function() {
21400
+ var state = this._writableState;
21401
+ if (state.corked) {
21402
+ state.corked--;
21403
+ if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
21404
+ }
21405
+ };
21406
+ Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
21407
+ if (typeof encoding === "string") encoding = encoding.toLowerCase();
21408
+ if (!([
21409
+ "hex",
21410
+ "utf8",
21411
+ "utf-8",
21412
+ "ascii",
21413
+ "binary",
21414
+ "base64",
21415
+ "ucs2",
21416
+ "ucs-2",
21417
+ "utf16le",
21418
+ "utf-16le",
21419
+ "raw"
21420
+ ].indexOf((encoding + "").toLowerCase()) > -1)) throw new TypeError("Unknown encoding: " + encoding);
21421
+ this._writableState.defaultEncoding = encoding;
21422
+ return this;
21423
+ };
21424
+ function decodeChunk(state, chunk, encoding) {
21425
+ if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") chunk = Buffer$1.from(chunk, encoding);
21426
+ return chunk;
21427
+ }
21428
+ function writeOrBuffer(stream, state, chunk, encoding, cb) {
21429
+ chunk = decodeChunk(state, chunk, encoding);
21430
+ if (Buffer$1.isBuffer(chunk)) encoding = "buffer";
21431
+ var len = state.objectMode ? 1 : chunk.length;
21432
+ state.length += len;
21433
+ var ret = state.length < state.highWaterMark;
21434
+ if (!ret) state.needDrain = true;
21435
+ if (state.writing || state.corked) {
21436
+ var last = state.lastBufferedRequest;
21437
+ state.lastBufferedRequest = new WriteReq(chunk, encoding, cb);
21438
+ if (last) last.next = state.lastBufferedRequest;
21439
+ else state.bufferedRequest = state.lastBufferedRequest;
21440
+ state.bufferedRequestCount += 1;
21441
+ } else doWrite(stream, state, false, len, chunk, encoding, cb);
21442
+ return ret;
21443
+ }
21444
+ function doWrite(stream, state, writev, len, chunk, encoding, cb) {
21445
+ state.writelen = len;
21446
+ state.writecb = cb;
21447
+ state.writing = true;
21448
+ state.sync = true;
21449
+ if (writev) stream._writev(chunk, state.onwrite);
21450
+ else stream._write(chunk, encoding, state.onwrite);
21451
+ state.sync = false;
21452
+ }
21453
+ function onwriteError(stream, state, sync, er, cb) {
21454
+ --state.pendingcb;
21455
+ if (sync) nextTick(cb, er);
21456
+ else cb(er);
21457
+ stream._writableState.errorEmitted = true;
21458
+ stream.emit("error", er);
21459
+ }
21460
+ function onwriteStateUpdate(state) {
21461
+ state.writing = false;
21462
+ state.writecb = null;
21463
+ state.length -= state.writelen;
21464
+ state.writelen = 0;
21465
+ }
21466
+ function onwrite(stream, er) {
21467
+ var state = stream._writableState;
21468
+ var sync = state.sync;
21469
+ var cb = state.writecb;
21470
+ onwriteStateUpdate(state);
21471
+ if (er) onwriteError(stream, state, sync, er, cb);
21472
+ else {
21473
+ var finished = needFinish(state);
21474
+ if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(stream, state);
21475
+ if (sync) nextTick(afterWrite, stream, state, finished, cb);
21476
+ else afterWrite(stream, state, finished, cb);
21477
+ }
21478
+ }
21479
+ function afterWrite(stream, state, finished, cb) {
21480
+ if (!finished) onwriteDrain(stream, state);
21481
+ state.pendingcb--;
21482
+ cb();
21483
+ finishMaybe(stream, state);
21484
+ }
21485
+ function onwriteDrain(stream, state) {
21486
+ if (state.length === 0 && state.needDrain) {
21487
+ state.needDrain = false;
21488
+ stream.emit("drain");
21489
+ }
21490
+ }
21491
+ function clearBuffer(stream, state) {
21492
+ state.bufferProcessing = true;
21493
+ var entry = state.bufferedRequest;
21494
+ if (stream._writev && entry && entry.next) {
21495
+ var l = state.bufferedRequestCount;
21496
+ var buffer = new Array(l);
21497
+ var holder = state.corkedRequestsFree;
21498
+ holder.entry = entry;
21499
+ var count = 0;
21500
+ while (entry) {
21501
+ buffer[count] = entry;
21502
+ entry = entry.next;
21503
+ count += 1;
21504
+ }
21505
+ doWrite(stream, state, true, state.length, buffer, "", holder.finish);
21506
+ state.pendingcb++;
21507
+ state.lastBufferedRequest = null;
21508
+ if (holder.next) {
21509
+ state.corkedRequestsFree = holder.next;
21510
+ holder.next = null;
21511
+ } else state.corkedRequestsFree = new CorkedRequest(state);
21512
+ } else {
21513
+ while (entry) {
21514
+ var chunk = entry.chunk;
21515
+ var encoding = entry.encoding;
21516
+ var cb = entry.callback;
21517
+ doWrite(stream, state, false, state.objectMode ? 1 : chunk.length, chunk, encoding, cb);
21518
+ entry = entry.next;
21519
+ if (state.writing) break;
21520
+ }
21521
+ if (entry === null) state.lastBufferedRequest = null;
21522
+ }
21523
+ state.bufferedRequestCount = 0;
21524
+ state.bufferedRequest = entry;
21525
+ state.bufferProcessing = false;
21526
+ }
21527
+ Writable.prototype._write = function(chunk, encoding, cb) {
21528
+ cb(/* @__PURE__ */ new Error("not implemented"));
21529
+ };
21530
+ Writable.prototype._writev = null;
21531
+ Writable.prototype.end = function(chunk, encoding, cb) {
21532
+ var state = this._writableState;
21533
+ if (typeof chunk === "function") {
21534
+ cb = chunk;
21535
+ chunk = null;
21536
+ encoding = null;
21537
+ } else if (typeof encoding === "function") {
21538
+ cb = encoding;
21539
+ encoding = null;
21540
+ }
21541
+ if (chunk !== null && chunk !== void 0) this.write(chunk, encoding);
21542
+ if (state.corked) {
21543
+ state.corked = 1;
21544
+ this.uncork();
21545
+ }
21546
+ if (!state.ending && !state.finished) endWritable(this, state, cb);
21547
+ };
21548
+ function needFinish(state) {
21549
+ return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
21550
+ }
21551
+ function prefinish(stream, state) {
21552
+ if (!state.prefinished) {
21553
+ state.prefinished = true;
21554
+ stream.emit("prefinish");
21555
+ }
21556
+ }
21557
+ function finishMaybe(stream, state) {
21558
+ var need = needFinish(state);
21559
+ if (need) if (state.pendingcb === 0) {
21560
+ prefinish(stream, state);
21561
+ state.finished = true;
21562
+ stream.emit("finish");
21563
+ } else prefinish(stream, state);
21564
+ return need;
21565
+ }
21566
+ function endWritable(stream, state, cb) {
21567
+ state.ending = true;
21568
+ finishMaybe(stream, state);
21569
+ if (cb) if (state.finished) nextTick(cb);
21570
+ else stream.once("finish", cb);
21571
+ state.ended = true;
21572
+ stream.writable = false;
21573
+ }
21574
+ function CorkedRequest(state) {
21575
+ var _this = this;
21576
+ this.next = null;
21577
+ this.entry = null;
21578
+ this.finish = function(err) {
21579
+ var entry = _this.entry;
21580
+ _this.entry = null;
21581
+ while (entry) {
21582
+ var cb = entry.callback;
21583
+ state.pendingcb--;
21584
+ cb(err);
21585
+ entry = entry.next;
21586
+ }
21587
+ if (state.corkedRequestsFree) state.corkedRequestsFree.next = _this;
21588
+ else state.corkedRequestsFree = _this;
21589
+ };
21590
+ }
21591
+ //#endregion
21592
+ //#region \0polyfill-node._stream_duplex.js
21593
+ _polyfill_node__inherits_default(Duplex, Readable);
21594
+ var keys = Object.keys(Writable.prototype);
21595
+ for (var v = 0; v < keys.length; v++) {
21596
+ var method = keys[v];
21597
+ if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
21598
+ }
21599
+ function Duplex(options) {
21600
+ if (!(this instanceof Duplex)) return new Duplex(options);
21601
+ Readable.call(this, options);
21602
+ Writable.call(this, options);
21603
+ if (options && options.readable === false) this.readable = false;
21604
+ if (options && options.writable === false) this.writable = false;
21605
+ this.allowHalfOpen = true;
21606
+ if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
21607
+ this.once("end", onend);
21608
+ }
21609
+ function onend() {
21610
+ if (this.allowHalfOpen || this._writableState.ended) return;
21611
+ nextTick(onEndNT, this);
21612
+ }
21613
+ function onEndNT(self) {
21614
+ self.end();
21615
+ }
21616
+ //#endregion
21617
+ //#region src/util/output-type.ts
21618
+ /**
21619
+ * Output type definitions for document generation.
21620
+ *
21621
+ * This module defines the various output formats supported when generating
21622
+ * .docx files. These types correspond to fflate's output formats.
21623
+ *
21624
+ * @module
21625
+ */
21626
+ /**
21627
+ * Converts a Uint8Array to the specified output type.
21628
+ *
21629
+ * This is used by both the Packer and patchDocument to convert fflate's
21630
+ * raw Uint8Array output into the user's requested format.
21631
+ */
21632
+ const convertOutput = (data, type) => {
21633
+ switch (type) {
21634
+ case "nodebuffer": return Buffer$1.from(data);
21635
+ case "blob": return new Blob([data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength)], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" });
21636
+ case "arraybuffer": return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
21637
+ case "uint8array": return data;
21638
+ case "base64": return btoa((0, fflate.strFromU8)(data, true));
21639
+ case "string":
21640
+ case "text":
21641
+ case "binarystring": return (0, fflate.strFromU8)(data, true);
21642
+ case "array": return [...data];
21643
+ default: return data;
21644
+ }
21645
+ };
21646
+ //#endregion
21647
+ //#region src/file/fonts/obfuscate-ttf-to-odttf.ts
21648
+ /**
21649
+ * Font obfuscation module for embedding fonts in WordprocessingML documents.
21650
+ *
21651
+ * This module implements the OOXML font obfuscation algorithm used to embed
21652
+ * fonts in DOCX documents. Obfuscation is required by the OOXML specification
21653
+ * to prevent simple extraction of embedded font files.
21654
+ *
21655
+ * Reference: ECMA-376 Part 2, Section 11.1 (Font Embedding)
21656
+ *
21657
+ * @module
21658
+ */
21659
+ /** Start offset for obfuscation in the font file */
18325
21660
  const obfuscatedStartOffset = 0;
18326
21661
  /** End offset for obfuscation (first 32 bytes are obfuscated) */
18327
21662
  const obfuscatedEndOffset = 32;
@@ -18519,13 +21854,12 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
18519
21854
  const footerFormattedViews = /* @__PURE__ */ new Map();
18520
21855
  const xmlifiedFileMapping = this.xmlifyFile(file, headerFormattedViews, footerFormattedViews, prettifyXml);
18521
21856
  const map = new Map(Object.entries(xmlifiedFileMapping));
18522
- for (const [, obj] of map) if (Array.isArray(obj)) for (const subFile of obj) files[subFile.path] = encodeUtf8(subFile.data);
18523
- else files[obj.path] = encodeUtf8(obj.data);
18524
- for (const subFile of overrides) files[subFile.path] = encodeUtf8(subFile.data);
18525
- for (const mediaData of file.Media.Array) if (mediaData.type !== "svg") files[`word/media/${mediaData.fileName}`] = [(0, undio.toUint8Array)(mediaData.data), { level: 0 }];
18526
- else {
21857
+ for (const [, obj] of map) if (Array.isArray(obj)) for (const subFile of obj) files[subFile.path] = (0, undio.textToUint8Array)(subFile.data);
21858
+ else files[obj.path] = (0, undio.textToUint8Array)(obj.data);
21859
+ for (const subFile of overrides) files[subFile.path] = (0, undio.textToUint8Array)(subFile.data);
21860
+ for (const mediaData of file.Media.Array) {
18527
21861
  files[`word/media/${mediaData.fileName}`] = [(0, undio.toUint8Array)(mediaData.data), { level: 0 }];
18528
- files[`word/media/${mediaData.fallback.fileName}`] = [(0, undio.toUint8Array)(mediaData.fallback.data), { level: 0 }];
21862
+ if (mediaData.type === "svg") files[`word/media/${mediaData.fallback.fileName}`] = [(0, undio.toUint8Array)(mediaData.fallback.data), { level: 0 }];
18529
21863
  }
18530
21864
  for (const { data: buffer, name, fontKey } of file.FontTable.fontOptionsWithKey) {
18531
21865
  const [nameWithoutExtension] = name.split(".");
@@ -18878,32 +22212,6 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
18878
22212
  }
18879
22213
  };
18880
22214
  //#endregion
18881
- //#region \0@oxc-project+runtime@0.123.0/helpers/asyncToGenerator.js
18882
- function asyncGeneratorStep(n, t, e, r, o, a, c) {
18883
- try {
18884
- var i = n[a](c), u = i.value;
18885
- } catch (n) {
18886
- e(n);
18887
- return;
18888
- }
18889
- i.done ? t(u) : Promise.resolve(u).then(r, o);
18890
- }
18891
- function _asyncToGenerator(n) {
18892
- return function() {
18893
- var t = this, e = arguments;
18894
- return new Promise(function(r, o) {
18895
- var a = n.apply(t, e);
18896
- function _next(n) {
18897
- asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
18898
- }
18899
- function _throw(n) {
18900
- asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
18901
- }
18902
- _next(void 0);
18903
- });
18904
- };
18905
- }
18906
- //#endregion
18907
22215
  //#region src/export/packer/packer.ts
18908
22216
  /**
18909
22217
  * Packer module for exporting documents to various output formats.
@@ -18956,11 +22264,8 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
18956
22264
  * @param overrides - Optional array of file overrides for custom XML content
18957
22265
  * @returns A promise resolving to the exported document in the specified format
18958
22266
  */
18959
- static pack(_x, _x2, _x3) {
18960
- var _this = this;
18961
- return _asyncToGenerator(function* (file, type, prettify, overrides = []) {
18962
- return convertOutput((0, fflate.zipSync)(_this.compiler.compile(file, convertPrettifyType(prettify), overrides), { level: 6 }), type);
18963
- }).apply(this, arguments);
22267
+ static async pack(file, type, prettify, overrides = []) {
22268
+ return convertOutput((0, fflate.zipSync)(this.compiler.compile(file, convertPrettifyType(prettify), overrides), { level: 6 }), type);
18964
22269
  }
18965
22270
  /**
18966
22271
  * Exports a document to a string representation.
@@ -19036,16 +22341,20 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
19036
22341
  * ```
19037
22342
  */
19038
22343
  static toStream(file, prettify, overrides = []) {
19039
- const stream$1 = new stream.Readable({ read() {} });
22344
+ /* v8 ignore start */
22345
+ const stream = new Readable({ read() {} });
22346
+ /* v8 ignore stop */
19040
22347
  try {
19041
22348
  const files = this.compiler.compile(file, convertPrettifyType(prettify), overrides);
19042
22349
  const zip = new fflate.Zip((err, chunk, final) => {
22350
+ /* v8 ignore start */
19043
22351
  if (err) {
19044
- stream$1.destroy(err);
22352
+ stream.destroy(err);
19045
22353
  return;
19046
22354
  }
19047
- if (!stream$1.destroyed) stream$1.push(chunk);
19048
- if (final) stream$1.push(null);
22355
+ /* v8 ignore stop */
22356
+ if (!stream.destroyed) stream.push(chunk);
22357
+ if (final) stream.push(null);
19049
22358
  });
19050
22359
  for (const [name, data] of Object.entries(files)) {
19051
22360
  var _level;
@@ -19057,9 +22366,9 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
19057
22366
  }
19058
22367
  zip.end();
19059
22368
  } catch (err) {
19060
- stream$1.destroy(err instanceof Error ? err : new Error(String(err)));
22369
+ stream.destroy(err instanceof Error ? err : new Error(String(err)));
19061
22370
  }
19062
- return stream$1;
22371
+ return stream;
19063
22372
  }
19064
22373
  };
19065
22374
  _defineProperty(Packer, "compiler", new Compiler());
@@ -19128,7 +22437,10 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
19128
22437
  * // Adds xml:space="preserve" to maintain whitespace
19129
22438
  * ```
19130
22439
  */
19131
- const patchSpaceAttribute = (element) => _objectSpread2(_objectSpread2({}, element), {}, { attributes: { "xml:space": "preserve" } });
22440
+ const patchSpaceAttribute = (element) => ({
22441
+ ...element,
22442
+ attributes: { "xml:space": "preserve" }
22443
+ });
19132
22444
  /**
19133
22445
  * Retrieves first-level child elements by parent element name.
19134
22446
  *
@@ -19320,14 +22632,24 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
19320
22632
  if (e.type === "element" && e.name === "w:t") {
19321
22633
  var _ref, _e$elements;
19322
22634
  const splitText = ((_ref = (_e$elements = e.elements) === null || _e$elements === void 0 || (_e$elements = _e$elements[0]) === null || _e$elements === void 0 ? void 0 : _e$elements.text) !== null && _ref !== void 0 ? _ref : "").split(token);
19323
- const newElements = splitText.map((t) => _objectSpread2(_objectSpread2(_objectSpread2({}, e), patchSpaceAttribute(e)), {}, { elements: createTextElementContents(t) }));
22635
+ const newElements = splitText.map((t) => ({
22636
+ ...e,
22637
+ ...patchSpaceAttribute(e),
22638
+ elements: createTextElementContents(t)
22639
+ }));
19324
22640
  if (splitText.length > 1) splitIndex = i;
19325
22641
  return newElements;
19326
22642
  } else return e;
19327
22643
  }).flat()) !== null && _runElement$elements$ !== void 0 ? _runElement$elements$ : [];
19328
22644
  return {
19329
- left: _objectSpread2(_objectSpread2({}, JSON.parse(JSON.stringify(runElement))), {}, { elements: splitElements.slice(0, splitIndex + 1) }),
19330
- right: _objectSpread2(_objectSpread2({}, JSON.parse(JSON.stringify(runElement))), {}, { elements: splitElements.slice(splitIndex + 1) })
22645
+ left: {
22646
+ ...JSON.parse(JSON.stringify(runElement)),
22647
+ elements: splitElements.slice(0, splitIndex + 1)
22648
+ },
22649
+ right: {
22650
+ ...JSON.parse(JSON.stringify(runElement)),
22651
+ elements: splitElements.slice(splitIndex + 1)
22652
+ }
19331
22653
  };
19332
22654
  };
19333
22655
  //#endregion
@@ -19587,9 +22909,15 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
19587
22909
  const runElementNonTextualElements = runElementToBeReplaced.elements.filter((e) => e.type === "element" && e.name === "w:rPr");
19588
22910
  newRunElements = textJson.map((e) => {
19589
22911
  var _e$elements;
19590
- return _objectSpread2(_objectSpread2({}, e), {}, { elements: [...runElementNonTextualElements, ...(_e$elements = e.elements) !== null && _e$elements !== void 0 ? _e$elements : []] });
22912
+ return {
22913
+ ...e,
22914
+ elements: [...runElementNonTextualElements, ...(_e$elements = e.elements) !== null && _e$elements !== void 0 ? _e$elements : []]
22915
+ };
19591
22916
  });
19592
- patchedRightElement = _objectSpread2(_objectSpread2({}, right), {}, { elements: [...runElementNonTextualElements, ...right.elements] });
22917
+ patchedRightElement = {
22918
+ ...right,
22919
+ elements: [...runElementNonTextualElements, ...right.elements]
22920
+ };
19593
22921
  }
19594
22922
  paragraphElement.elements.splice(index, 1, left, ...newRunElements, patchedRightElement);
19595
22923
  break;
@@ -19675,69 +23003,70 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
19675
23003
  *
19676
23004
  * @publicApi
19677
23005
  */
19678
- const patchDocument = function() {
19679
- var _ref = _asyncToGenerator(function* ({ outputType, data, patches, keepOriginalStyles, placeholderDelimiters = {
19680
- end: "}}",
19681
- start: "{{"
19682
- }, recursive = true }) {
19683
- const zipContent = (0, fflate.unzipSync)((0, undio.toUint8Array)(data));
19684
- const contexts = /* @__PURE__ */ new Map();
19685
- const file = { Media: new Media() };
19686
- const map = /* @__PURE__ */ new Map();
19687
- const imageRelationshipAdditions = [];
19688
- const hyperlinkRelationshipAdditions = [];
19689
- let hasMedia = false;
19690
- const binaryContentMap = /* @__PURE__ */ new Map();
19691
- for (const [key, value] of Object.entries(zipContent)) {
19692
- const startBytes = value.slice(0, 2);
19693
- if (compareByteArrays(startBytes, UTF16LE) || compareByteArrays(startBytes, UTF16BE)) {
19694
- binaryContentMap.set(key, value);
19695
- continue;
19696
- }
19697
- if (!key.endsWith(".xml") && !key.endsWith(".rels")) {
19698
- binaryContentMap.set(key, value);
19699
- continue;
19700
- }
19701
- const json = toJson((0, fflate.strFromU8)(value));
19702
- if (key === "word/document.xml") {
19703
- var _json$elements;
19704
- const document = (_json$elements = json.elements) === null || _json$elements === void 0 ? void 0 : _json$elements.find((i) => i.name === "w:document");
19705
- if (document && document.attributes) {
19706
- for (const ns of [
19707
- "mc",
19708
- "wp",
19709
- "r",
19710
- "w15",
19711
- "m"
19712
- ]) document.attributes[`xmlns:${ns}`] = DocumentAttributeNamespaces[ns];
19713
- document.attributes["mc:Ignorable"] = `${document.attributes["mc:Ignorable"] || ""} w15`.trim();
19714
- }
23006
+ const patchDocument = async ({ outputType, data, patches, keepOriginalStyles, placeholderDelimiters = {
23007
+ end: "}}",
23008
+ start: "{{"
23009
+ }, recursive = true }) => {
23010
+ const zipContent = (0, fflate.unzipSync)((0, undio.toUint8Array)(data));
23011
+ const contexts = /* @__PURE__ */ new Map();
23012
+ const file = { Media: new Media() };
23013
+ const map = /* @__PURE__ */ new Map();
23014
+ const imageRelationshipAdditions = [];
23015
+ const hyperlinkRelationshipAdditions = [];
23016
+ let hasMedia = false;
23017
+ const binaryContentMap = /* @__PURE__ */ new Map();
23018
+ for (const [key, value] of Object.entries(zipContent)) {
23019
+ const startBytes = value.slice(0, 2);
23020
+ if (compareByteArrays(startBytes, UTF16LE) || compareByteArrays(startBytes, UTF16BE)) {
23021
+ binaryContentMap.set(key, value);
23022
+ continue;
23023
+ }
23024
+ if (!key.endsWith(".xml") && !key.endsWith(".rels")) {
23025
+ binaryContentMap.set(key, value);
23026
+ continue;
23027
+ }
23028
+ const json = toJson((0, fflate.strFromU8)(value));
23029
+ if (key === "word/document.xml") {
23030
+ var _json$elements;
23031
+ const document = (_json$elements = json.elements) === null || _json$elements === void 0 ? void 0 : _json$elements.find((i) => i.name === "w:document");
23032
+ if (document && document.attributes) {
23033
+ for (const ns of [
23034
+ "mc",
23035
+ "wp",
23036
+ "r",
23037
+ "w15",
23038
+ "m"
23039
+ ]) document.attributes[`xmlns:${ns}`] = DocumentAttributeNamespaces[ns];
23040
+ document.attributes["mc:Ignorable"] = `${document.attributes["mc:Ignorable"] || ""} w15`.trim();
19715
23041
  }
19716
- if (key.startsWith("word/") && !key.endsWith(".xml.rels")) {
19717
- const context = {
19718
- file,
19719
- stack: [],
19720
- viewWrapper: { Relationships: { addRelationship: (linkId, _, target, __) => {
19721
- hyperlinkRelationshipAdditions.push({
19722
- hyperlink: {
19723
- id: linkId,
19724
- link: target
19725
- },
19726
- key
19727
- });
19728
- } } }
19729
- };
19730
- contexts.set(key, context);
19731
- if (!(placeholderDelimiters === null || placeholderDelimiters === void 0 ? void 0 : placeholderDelimiters.start.trim()) || !(placeholderDelimiters === null || placeholderDelimiters === void 0 ? void 0 : placeholderDelimiters.end.trim())) throw new Error("Both start and end delimiters must be non-empty strings.");
19732
- const { start, end } = placeholderDelimiters;
19733
- for (const [patchKey, patchValue] of Object.entries(patches)) {
19734
- const patchText = `${start}${patchKey}${end}`;
19735
- while (true) {
19736
- const { didFindOccurrence } = replacer({
19737
- context,
19738
- json,
19739
- keepOriginalStyles,
19740
- patch: _objectSpread2(_objectSpread2({}, patchValue), {}, { children: patchValue.children.map((element) => {
23042
+ }
23043
+ if (key.startsWith("word/") && !key.endsWith(".xml.rels")) {
23044
+ const context = {
23045
+ file,
23046
+ stack: [],
23047
+ viewWrapper: { Relationships: { addRelationship: (linkId, _, target, __) => {
23048
+ hyperlinkRelationshipAdditions.push({
23049
+ hyperlink: {
23050
+ id: linkId,
23051
+ link: target
23052
+ },
23053
+ key
23054
+ });
23055
+ } } }
23056
+ };
23057
+ contexts.set(key, context);
23058
+ if (!(placeholderDelimiters === null || placeholderDelimiters === void 0 ? void 0 : placeholderDelimiters.start.trim()) || !(placeholderDelimiters === null || placeholderDelimiters === void 0 ? void 0 : placeholderDelimiters.end.trim())) throw new Error("Both start and end delimiters must be non-empty strings.");
23059
+ const { start, end } = placeholderDelimiters;
23060
+ for (const [patchKey, patchValue] of Object.entries(patches)) {
23061
+ const patchText = `${start}${patchKey}${end}`;
23062
+ while (true) {
23063
+ const { didFindOccurrence } = replacer({
23064
+ context,
23065
+ json,
23066
+ keepOriginalStyles,
23067
+ patch: {
23068
+ ...patchValue,
23069
+ children: patchValue.children.map((element) => {
19741
23070
  if (element instanceof ExternalHyperlink) {
19742
23071
  const concreteHyperlink = new ConcreteHyperlink(element.options.children, uniqueId());
19743
23072
  hyperlinkRelationshipAdditions.push({
@@ -19749,63 +23078,60 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
19749
23078
  });
19750
23079
  return concreteHyperlink;
19751
23080
  } else return element;
19752
- }) }),
19753
- patchText
19754
- });
19755
- if (!recursive || !didFindOccurrence) break;
19756
- }
19757
- }
19758
- const mediaDatas = imageReplacer.getMediaData(JSON.stringify(json), context.file.Media);
19759
- if (mediaDatas.length > 0) {
19760
- hasMedia = true;
19761
- imageRelationshipAdditions.push({
19762
- key,
19763
- mediaDatas
23081
+ })
23082
+ },
23083
+ patchText
19764
23084
  });
23085
+ if (!recursive || !didFindOccurrence) break;
19765
23086
  }
19766
23087
  }
19767
- map.set(key, json);
19768
- }
19769
- for (const { key, mediaDatas } of imageRelationshipAdditions) {
19770
- var _map$get;
19771
- const relationshipKey = `word/_rels/${key.split("/").pop()}.rels`;
19772
- const relationshipsJson = (_map$get = map.get(relationshipKey)) !== null && _map$get !== void 0 ? _map$get : createRelationshipFile();
19773
- map.set(relationshipKey, relationshipsJson);
19774
- const index = getNextRelationshipIndex(relationshipsJson);
19775
- const newJson = imageReplacer.replace(JSON.stringify(map.get(key)), mediaDatas, index);
19776
- map.set(key, JSON.parse(newJson));
19777
- for (let i = 0; i < mediaDatas.length; i++) {
19778
- const { fileName } = mediaDatas[i];
19779
- appendRelationship(relationshipsJson, index + i, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", `media/${fileName}`);
23088
+ const mediaDatas = imageReplacer.getMediaData(JSON.stringify(json), context.file.Media);
23089
+ if (mediaDatas.length > 0) {
23090
+ hasMedia = true;
23091
+ imageRelationshipAdditions.push({
23092
+ key,
23093
+ mediaDatas
23094
+ });
19780
23095
  }
19781
23096
  }
19782
- for (const { key, hyperlink } of hyperlinkRelationshipAdditions) {
19783
- var _map$get2;
19784
- const relationshipKey = `word/_rels/${key.split("/").pop()}.rels`;
19785
- const relationshipsJson = (_map$get2 = map.get(relationshipKey)) !== null && _map$get2 !== void 0 ? _map$get2 : createRelationshipFile();
19786
- map.set(relationshipKey, relationshipsJson);
19787
- appendRelationship(relationshipsJson, hyperlink.id, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", hyperlink.link, TargetModeType.EXTERNAL);
19788
- }
19789
- if (hasMedia) {
19790
- const contentTypesJson = map.get("[Content_Types].xml");
19791
- if (!contentTypesJson) throw new Error("Could not find content types file");
19792
- appendContentType(contentTypesJson, "image/png", "png");
19793
- appendContentType(contentTypesJson, "image/jpeg", "jpeg");
19794
- appendContentType(contentTypesJson, "image/jpeg", "jpg");
19795
- appendContentType(contentTypesJson, "image/bmp", "bmp");
19796
- appendContentType(contentTypesJson, "image/gif", "gif");
19797
- appendContentType(contentTypesJson, "image/svg+xml", "svg");
23097
+ map.set(key, json);
23098
+ }
23099
+ for (const { key, mediaDatas } of imageRelationshipAdditions) {
23100
+ var _map$get;
23101
+ const relationshipKey = `word/_rels/${key.split("/").pop()}.rels`;
23102
+ const relationshipsJson = (_map$get = map.get(relationshipKey)) !== null && _map$get !== void 0 ? _map$get : createRelationshipFile();
23103
+ map.set(relationshipKey, relationshipsJson);
23104
+ const index = getNextRelationshipIndex(relationshipsJson);
23105
+ const newJson = imageReplacer.replace(JSON.stringify(map.get(key)), mediaDatas, index);
23106
+ map.set(key, JSON.parse(newJson));
23107
+ for (let i = 0; i < mediaDatas.length; i++) {
23108
+ const { fileName } = mediaDatas[i];
23109
+ appendRelationship(relationshipsJson, index + i, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", `media/${fileName}`);
19798
23110
  }
19799
- const files = {};
19800
- for (const [key, value] of map) files[key] = (0, undio.textToUint8Array)(toXml(value));
19801
- for (const [key, value] of binaryContentMap) files[key] = value;
19802
- for (const { data: mediaData, fileName } of file.Media.Array) files[`word/media/${fileName}`] = mediaData instanceof Uint8Array ? mediaData : new Uint8Array(mediaData);
19803
- return convertOutput((0, fflate.zipSync)(files, { level: 6 }), outputType);
19804
- });
19805
- return function patchDocument(_x) {
19806
- return _ref.apply(this, arguments);
19807
- };
19808
- }();
23111
+ }
23112
+ for (const { key, hyperlink } of hyperlinkRelationshipAdditions) {
23113
+ var _map$get2;
23114
+ const relationshipKey = `word/_rels/${key.split("/").pop()}.rels`;
23115
+ const relationshipsJson = (_map$get2 = map.get(relationshipKey)) !== null && _map$get2 !== void 0 ? _map$get2 : createRelationshipFile();
23116
+ map.set(relationshipKey, relationshipsJson);
23117
+ appendRelationship(relationshipsJson, hyperlink.id, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", hyperlink.link, TargetModeType.EXTERNAL);
23118
+ }
23119
+ if (hasMedia) {
23120
+ const contentTypesJson = map.get("[Content_Types].xml");
23121
+ if (!contentTypesJson) throw new Error("Could not find content types file");
23122
+ appendContentType(contentTypesJson, "image/png", "png");
23123
+ appendContentType(contentTypesJson, "image/jpeg", "jpeg");
23124
+ appendContentType(contentTypesJson, "image/jpeg", "jpg");
23125
+ appendContentType(contentTypesJson, "image/bmp", "bmp");
23126
+ appendContentType(contentTypesJson, "image/gif", "gif");
23127
+ appendContentType(contentTypesJson, "image/svg+xml", "svg");
23128
+ }
23129
+ const files = {};
23130
+ for (const [key, value] of map) files[key] = (0, undio.textToUint8Array)(toXml(value));
23131
+ for (const [key, value] of binaryContentMap) files[key] = value;
23132
+ for (const { data: mediaData, fileName } of file.Media.Array) files[`word/media/${fileName}`] = mediaData instanceof Uint8Array ? mediaData : new Uint8Array(mediaData);
23133
+ return convertOutput((0, fflate.zipSync)(files, { level: 6 }), outputType);
23134
+ };
19809
23135
  const toXml = (jsonObj) => {
19810
23136
  return (0, xml_js.js2xml)(jsonObj, { attributeValueFn: (str) => String(str).replace(/&(?!amp;|lt;|gt;|quot;|apos;)/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;") });
19811
23137
  };
@@ -19854,20 +23180,15 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
19854
23180
  * });
19855
23181
  * ```
19856
23182
  */
19857
- const patchDetector = function() {
19858
- var _ref = _asyncToGenerator(function* ({ data }) {
19859
- const zipContent = (0, fflate.unzipSync)((0, undio.toUint8Array)(data));
19860
- const patches = /* @__PURE__ */ new Set();
19861
- for (const [key, value] of Object.entries(zipContent)) {
19862
- if (!key.endsWith(".xml") && !key.endsWith(".rels")) continue;
19863
- if (key.startsWith("word/") && !key.endsWith(".xml.rels")) traverse(toJson((0, fflate.strFromU8)(value))).forEach((p) => findPatchKeys(p.text).forEach((patch) => patches.add(patch)));
19864
- }
19865
- return [...patches];
19866
- });
19867
- return function patchDetector(_x) {
19868
- return _ref.apply(this, arguments);
19869
- };
19870
- }();
23183
+ const patchDetector = async ({ data }) => {
23184
+ const zipContent = (0, fflate.unzipSync)((0, undio.toUint8Array)(data));
23185
+ const patches = /* @__PURE__ */ new Set();
23186
+ for (const [key, value] of Object.entries(zipContent)) {
23187
+ if (!key.endsWith(".xml") && !key.endsWith(".rels")) continue;
23188
+ if (key.startsWith("word/") && !key.endsWith(".xml.rels")) traverse(toJson((0, fflate.strFromU8)(value))).forEach((p) => findPatchKeys(p.text).forEach((patch) => patches.add(patch)));
23189
+ }
23190
+ return [...patches];
23191
+ };
19871
23192
  /**
19872
23193
  * Extracts placeholder keys from text using regex pattern.
19873
23194
  *
@@ -19876,8 +23197,7 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
19876
23197
  */
19877
23198
  const findPatchKeys = (text) => {
19878
23199
  var _text$match;
19879
- const pattern = /* @__PURE__ */ new RegExp("(?<=\\{\\{).+?(?=\\}\\})", "gs");
19880
- return (_text$match = text.match(pattern)) !== null && _text$match !== void 0 ? _text$match : [];
23200
+ return (_text$match = text.match(/(?<=\{\{).+?(?=\}\})/gs)) !== null && _text$match !== void 0 ? _text$match : [];
19881
23201
  };
19882
23202
  //#endregion
19883
23203
  exports.AbstractNumbering = AbstractNumbering;
@@ -20082,6 +23402,8 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
20082
23402
  exports.TextWrappingType = TextWrappingType;
20083
23403
  exports.Textbox = Textbox;
20084
23404
  exports.ThematicBreak = ThematicBreak;
23405
+ exports.ThemeColor = ThemeColor;
23406
+ exports.ThemeFont = ThemeFont;
20085
23407
  exports.UnderlineType = UnderlineType;
20086
23408
  exports.VerticalAlign = VerticalAlign;
20087
23409
  exports.VerticalAlignSection = VerticalAlignSection;
@@ -20160,7 +23482,6 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
20160
23482
  exports.decimalNumber = decimalNumber;
20161
23483
  exports.docPropertiesUniqueNumericIdGen = docPropertiesUniqueNumericIdGen;
20162
23484
  exports.eighthPointMeasureValue = eighthPointMeasureValue;
20163
- exports.encodeUtf8 = encodeUtf8;
20164
23485
  exports.hashedId = hashedId;
20165
23486
  exports.hexColorValue = hexColorValue;
20166
23487
  exports.hpsMeasureValue = hpsMeasureValue;
@@ -20184,4 +23505,4 @@ var docxPlus = (function(exports, xml_js, hash_js, nanoid_non_secure, undio, str
20184
23505
  exports.universalMeasureValue = universalMeasureValue;
20185
23506
  exports.unsignedDecimalNumber = unsignedDecimalNumber;
20186
23507
  return exports;
20187
- })({}, xml_js, hash_js, nanoid_non_secure, undio, stream, fflate, xml);
23508
+ })({}, xml_js, hash_js, nanoid_non_secure, undio, fflate, xml);