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