@wecom/wecom-openclaw-cli 1.0.15 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_commonjsHelpers.js +8 -0
- package/dist/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/_virtual/alignment-pattern.js +6 -0
- package/dist/_virtual/alignment-pattern.js.map +1 -0
- package/dist/_virtual/bitmapper.js +6 -0
- package/dist/_virtual/bitmapper.js.map +1 -0
- package/dist/_virtual/browser.js +6 -0
- package/dist/_virtual/browser.js.map +1 -0
- package/dist/_virtual/canvas.js +6 -0
- package/dist/_virtual/canvas.js.map +1 -0
- package/dist/_virtual/chunkstream.js +6 -0
- package/dist/_virtual/chunkstream.js.map +1 -0
- package/dist/_virtual/crc.js +6 -0
- package/dist/_virtual/crc.js.map +1 -0
- package/dist/_virtual/dijkstra.js +6 -0
- package/dist/_virtual/dijkstra.js.map +1 -0
- package/dist/_virtual/error-correction-code.js +6 -0
- package/dist/_virtual/error-correction-code.js.map +1 -0
- package/dist/_virtual/error-correction-level.js +6 -0
- package/dist/_virtual/error-correction-level.js.map +1 -0
- package/dist/_virtual/filter-parse-async.js +6 -0
- package/dist/_virtual/filter-parse-async.js.map +1 -0
- package/dist/_virtual/filter-parse-sync.js +6 -0
- package/dist/_virtual/filter-parse-sync.js.map +1 -0
- package/dist/_virtual/filter-parse.js +6 -0
- package/dist/_virtual/filter-parse.js.map +1 -0
- package/dist/_virtual/finder-pattern.js +6 -0
- package/dist/_virtual/finder-pattern.js.map +1 -0
- package/dist/_virtual/format-info.js +6 -0
- package/dist/_virtual/format-info.js.map +1 -0
- package/dist/_virtual/galois-field.js +6 -0
- package/dist/_virtual/galois-field.js.map +1 -0
- package/dist/_virtual/index.js +10 -0
- package/dist/_virtual/index.js.map +1 -0
- package/dist/_virtual/interlace.js +6 -0
- package/dist/_virtual/interlace.js.map +1 -0
- package/dist/_virtual/mask-pattern.js +6 -0
- package/dist/_virtual/mask-pattern.js.map +1 -0
- package/dist/_virtual/mode.js +6 -0
- package/dist/_virtual/mode.js.map +1 -0
- package/dist/_virtual/packer-async.js +6 -0
- package/dist/_virtual/packer-async.js.map +1 -0
- package/dist/_virtual/packer.js +6 -0
- package/dist/_virtual/packer.js.map +1 -0
- package/dist/_virtual/parser-async.js +6 -0
- package/dist/_virtual/parser-async.js.map +1 -0
- package/dist/_virtual/parser.js +6 -0
- package/dist/_virtual/parser.js.map +1 -0
- package/dist/_virtual/png-sync.js +6 -0
- package/dist/_virtual/png-sync.js.map +1 -0
- package/dist/_virtual/png.js +6 -0
- package/dist/_virtual/png.js.map +1 -0
- package/dist/_virtual/png2.js +6 -0
- package/dist/_virtual/png2.js.map +1 -0
- package/dist/_virtual/polynomial.js +6 -0
- package/dist/_virtual/polynomial.js.map +1 -0
- package/dist/_virtual/qrcode.js +6 -0
- package/dist/_virtual/qrcode.js.map +1 -0
- package/dist/_virtual/regex.js +6 -0
- package/dist/_virtual/regex.js.map +1 -0
- package/dist/_virtual/segments.js +6 -0
- package/dist/_virtual/segments.js.map +1 -0
- package/dist/_virtual/server.js +6 -0
- package/dist/_virtual/server.js.map +1 -0
- package/dist/_virtual/svg-tag.js +6 -0
- package/dist/_virtual/svg-tag.js.map +1 -0
- package/dist/_virtual/svg.js +6 -0
- package/dist/_virtual/svg.js.map +1 -0
- package/dist/_virtual/sync-inflate.js +6 -0
- package/dist/_virtual/sync-inflate.js.map +1 -0
- package/dist/_virtual/sync-reader.js +6 -0
- package/dist/_virtual/sync-reader.js.map +1 -0
- package/dist/_virtual/terminal-small.js +6 -0
- package/dist/_virtual/terminal-small.js.map +1 -0
- package/dist/_virtual/terminal.js +6 -0
- package/dist/_virtual/terminal.js.map +1 -0
- package/dist/_virtual/terminal2.js +6 -0
- package/dist/_virtual/terminal2.js.map +1 -0
- package/dist/_virtual/utf8.js +6 -0
- package/dist/_virtual/utf8.js.map +1 -0
- package/dist/_virtual/utils.js +6 -0
- package/dist/_virtual/utils.js.map +1 -0
- package/dist/_virtual/utils2.js +6 -0
- package/dist/_virtual/utils2.js.map +1 -0
- package/dist/_virtual/version-check.js +6 -0
- package/dist/_virtual/version-check.js.map +1 -0
- package/dist/_virtual/version.js +6 -0
- package/dist/_virtual/version.js.map +1 -0
- package/dist/node_modules/dijkstrajs/dijkstra.js +179 -0
- package/dist/node_modules/dijkstrajs/dijkstra.js.map +1 -0
- package/dist/node_modules/pngjs/lib/bitmapper.js +281 -0
- package/dist/node_modules/pngjs/lib/bitmapper.js.map +1 -0
- package/dist/node_modules/pngjs/lib/bitpacker.js +172 -0
- package/dist/node_modules/pngjs/lib/bitpacker.js.map +1 -0
- package/dist/node_modules/pngjs/lib/chunkstream.js +204 -0
- package/dist/node_modules/pngjs/lib/chunkstream.js.map +1 -0
- package/dist/node_modules/pngjs/lib/constants.js +44 -0
- package/dist/node_modules/pngjs/lib/constants.js.map +1 -0
- package/dist/node_modules/pngjs/lib/crc.js +53 -0
- package/dist/node_modules/pngjs/lib/crc.js.map +1 -0
- package/dist/node_modules/pngjs/lib/filter-pack.js +185 -0
- package/dist/node_modules/pngjs/lib/filter-pack.js.map +1 -0
- package/dist/node_modules/pngjs/lib/filter-parse-async.js +40 -0
- package/dist/node_modules/pngjs/lib/filter-parse-async.js.map +1 -0
- package/dist/node_modules/pngjs/lib/filter-parse-sync.js +36 -0
- package/dist/node_modules/pngjs/lib/filter-parse-sync.js.map +1 -0
- package/dist/node_modules/pngjs/lib/filter-parse.js +192 -0
- package/dist/node_modules/pngjs/lib/filter-parse.js.map +1 -0
- package/dist/node_modules/pngjs/lib/format-normaliser.js +105 -0
- package/dist/node_modules/pngjs/lib/format-normaliser.js.map +1 -0
- package/dist/node_modules/pngjs/lib/interlace.js +108 -0
- package/dist/node_modules/pngjs/lib/interlace.js.map +1 -0
- package/dist/node_modules/pngjs/lib/packer-async.js +67 -0
- package/dist/node_modules/pngjs/lib/packer-async.js.map +1 -0
- package/dist/node_modules/pngjs/lib/packer-sync.js +72 -0
- package/dist/node_modules/pngjs/lib/packer-sync.js.map +1 -0
- package/dist/node_modules/pngjs/lib/packer.js +147 -0
- package/dist/node_modules/pngjs/lib/packer.js.map +1 -0
- package/dist/node_modules/pngjs/lib/paeth-predictor.js +28 -0
- package/dist/node_modules/pngjs/lib/paeth-predictor.js.map +1 -0
- package/dist/node_modules/pngjs/lib/parser-async.js +185 -0
- package/dist/node_modules/pngjs/lib/parser-async.js.map +1 -0
- package/dist/node_modules/pngjs/lib/parser-sync.js +128 -0
- package/dist/node_modules/pngjs/lib/parser-sync.js.map +1 -0
- package/dist/node_modules/pngjs/lib/parser.js +305 -0
- package/dist/node_modules/pngjs/lib/parser.js.map +1 -0
- package/dist/node_modules/pngjs/lib/png-sync.js +27 -0
- package/dist/node_modules/pngjs/lib/png-sync.js.map +1 -0
- package/dist/node_modules/pngjs/lib/png.js +212 -0
- package/dist/node_modules/pngjs/lib/png.js.map +1 -0
- package/dist/node_modules/pngjs/lib/sync-inflate.js +184 -0
- package/dist/node_modules/pngjs/lib/sync-inflate.js.map +1 -0
- package/dist/node_modules/pngjs/lib/sync-reader.js +58 -0
- package/dist/node_modules/pngjs/lib/sync-reader.js.map +1 -0
- package/dist/node_modules/qrcode/lib/browser.js +93 -0
- package/dist/node_modules/qrcode/lib/browser.js.map +1 -0
- package/dist/node_modules/qrcode/lib/can-promise.js +20 -0
- package/dist/node_modules/qrcode/lib/can-promise.js.map +1 -0
- package/dist/node_modules/qrcode/lib/core/alignment-pattern.js +100 -0
- package/dist/node_modules/qrcode/lib/core/alignment-pattern.js.map +1 -0
- package/dist/node_modules/qrcode/lib/core/alphanumeric-data.js +74 -0
- package/dist/node_modules/qrcode/lib/core/alphanumeric-data.js.map +1 -0
- package/dist/node_modules/qrcode/lib/core/bit-buffer.js +50 -0
- package/dist/node_modules/qrcode/lib/core/bit-buffer.js.map +1 -0
- package/dist/node_modules/qrcode/lib/core/bit-matrix.js +79 -0
- package/dist/node_modules/qrcode/lib/core/bit-matrix.js.map +1 -0
- package/dist/node_modules/qrcode/lib/core/byte-data.js +45 -0
- package/dist/node_modules/qrcode/lib/core/byte-data.js.map +1 -0
- package/dist/node_modules/qrcode/lib/core/error-correction-code.js +150 -0
- package/dist/node_modules/qrcode/lib/core/error-correction-code.js.map +1 -0
- package/dist/node_modules/qrcode/lib/core/error-correction-level.js +66 -0
- package/dist/node_modules/qrcode/lib/core/error-correction-level.js.map +1 -0
- package/dist/node_modules/qrcode/lib/core/finder-pattern.js +37 -0
- package/dist/node_modules/qrcode/lib/core/finder-pattern.js.map +1 -0
- package/dist/node_modules/qrcode/lib/core/format-info.js +44 -0
- package/dist/node_modules/qrcode/lib/core/format-info.js.map +1 -0
- package/dist/node_modules/qrcode/lib/core/galois-field.js +83 -0
- package/dist/node_modules/qrcode/lib/core/galois-field.js.map +1 -0
- package/dist/node_modules/qrcode/lib/core/kanji-data.js +70 -0
- package/dist/node_modules/qrcode/lib/core/kanji-data.js.map +1 -0
- package/dist/node_modules/qrcode/lib/core/mask-pattern.js +251 -0
- package/dist/node_modules/qrcode/lib/core/mask-pattern.js.map +1 -0
- package/dist/node_modules/qrcode/lib/core/mode.js +185 -0
- package/dist/node_modules/qrcode/lib/core/mode.js.map +1 -0
- package/dist/node_modules/qrcode/lib/core/numeric-data.js +58 -0
- package/dist/node_modules/qrcode/lib/core/numeric-data.js.map +1 -0
- package/dist/node_modules/qrcode/lib/core/polynomial.js +79 -0
- package/dist/node_modules/qrcode/lib/core/polynomial.js.map +1 -0
- package/dist/node_modules/qrcode/lib/core/qrcode.js +522 -0
- package/dist/node_modules/qrcode/lib/core/qrcode.js.map +1 -0
- package/dist/node_modules/qrcode/lib/core/reed-solomon-encoder.js +71 -0
- package/dist/node_modules/qrcode/lib/core/reed-solomon-encoder.js.map +1 -0
- package/dist/node_modules/qrcode/lib/core/regex.js +45 -0
- package/dist/node_modules/qrcode/lib/core/regex.js.map +1 -0
- package/dist/node_modules/qrcode/lib/core/segments.js +354 -0
- package/dist/node_modules/qrcode/lib/core/segments.js.map +1 -0
- package/dist/node_modules/qrcode/lib/core/utils.js +77 -0
- package/dist/node_modules/qrcode/lib/core/utils.js.map +1 -0
- package/dist/node_modules/qrcode/lib/core/version-check.js +24 -0
- package/dist/node_modules/qrcode/lib/core/version-check.js.map +1 -0
- package/dist/node_modules/qrcode/lib/core/version.js +184 -0
- package/dist/node_modules/qrcode/lib/core/version.js.map +1 -0
- package/dist/node_modules/qrcode/lib/index.js +27 -0
- package/dist/node_modules/qrcode/lib/index.js.map +1 -0
- package/dist/node_modules/qrcode/lib/renderer/canvas.js +80 -0
- package/dist/node_modules/qrcode/lib/renderer/canvas.js.map +1 -0
- package/dist/node_modules/qrcode/lib/renderer/png.js +97 -0
- package/dist/node_modules/qrcode/lib/renderer/png.js.map +1 -0
- package/dist/node_modules/qrcode/lib/renderer/svg-tag.js +96 -0
- package/dist/node_modules/qrcode/lib/renderer/svg-tag.js.map +1 -0
- package/dist/node_modules/qrcode/lib/renderer/svg.js +37 -0
- package/dist/node_modules/qrcode/lib/renderer/svg.js.map +1 -0
- package/dist/node_modules/qrcode/lib/renderer/terminal/terminal-small.js +99 -0
- package/dist/node_modules/qrcode/lib/renderer/terminal/terminal-small.js.map +1 -0
- package/dist/node_modules/qrcode/lib/renderer/terminal/terminal.js +63 -0
- package/dist/node_modules/qrcode/lib/renderer/terminal/terminal.js.map +1 -0
- package/dist/node_modules/qrcode/lib/renderer/terminal.js +25 -0
- package/dist/node_modules/qrcode/lib/renderer/terminal.js.map +1 -0
- package/dist/node_modules/qrcode/lib/renderer/utf8.js +89 -0
- package/dist/node_modules/qrcode/lib/renderer/utf8.js.map +1 -0
- package/dist/node_modules/qrcode/lib/renderer/utils.js +115 -0
- package/dist/node_modules/qrcode/lib/renderer/utils.js.map +1 -0
- package/dist/node_modules/qrcode/lib/server.js +159 -0
- package/dist/node_modules/qrcode/lib/server.js.map +1 -0
- package/dist/package.json.js +3 -2
- package/dist/package.json.js.map +1 -1
- package/dist/utils/config.js +2 -2
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/qrcode.d.ts.map +1 -1
- package/dist/utils/qrcode.js +5 -9
- package/dist/utils/qrcode.js.map +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var packer = require('../../../_virtual/packer.js');
|
|
4
|
+
var constants = require('./constants.js');
|
|
5
|
+
var crc = require('./crc.js');
|
|
6
|
+
var bitpacker = require('./bitpacker.js');
|
|
7
|
+
var filterPack = require('./filter-pack.js');
|
|
8
|
+
var require$$1 = require('zlib');
|
|
9
|
+
|
|
10
|
+
var hasRequiredPacker;
|
|
11
|
+
|
|
12
|
+
function requirePacker () {
|
|
13
|
+
if (hasRequiredPacker) return packer.__module.exports;
|
|
14
|
+
hasRequiredPacker = 1;
|
|
15
|
+
|
|
16
|
+
let constants$1 = constants.__require();
|
|
17
|
+
let CrcStream = crc.__require();
|
|
18
|
+
let bitPacker = bitpacker.__require();
|
|
19
|
+
let filter = filterPack.__require();
|
|
20
|
+
let zlib = require$$1;
|
|
21
|
+
|
|
22
|
+
let Packer = (packer.__module.exports = function (options) {
|
|
23
|
+
this._options = options;
|
|
24
|
+
|
|
25
|
+
options.deflateChunkSize = options.deflateChunkSize || 32 * 1024;
|
|
26
|
+
options.deflateLevel =
|
|
27
|
+
options.deflateLevel != null ? options.deflateLevel : 9;
|
|
28
|
+
options.deflateStrategy =
|
|
29
|
+
options.deflateStrategy != null ? options.deflateStrategy : 3;
|
|
30
|
+
options.inputHasAlpha =
|
|
31
|
+
options.inputHasAlpha != null ? options.inputHasAlpha : true;
|
|
32
|
+
options.deflateFactory = options.deflateFactory || zlib.createDeflate;
|
|
33
|
+
options.bitDepth = options.bitDepth || 8;
|
|
34
|
+
// This is outputColorType
|
|
35
|
+
options.colorType =
|
|
36
|
+
typeof options.colorType === "number"
|
|
37
|
+
? options.colorType
|
|
38
|
+
: constants$1.COLORTYPE_COLOR_ALPHA;
|
|
39
|
+
options.inputColorType =
|
|
40
|
+
typeof options.inputColorType === "number"
|
|
41
|
+
? options.inputColorType
|
|
42
|
+
: constants$1.COLORTYPE_COLOR_ALPHA;
|
|
43
|
+
|
|
44
|
+
if (
|
|
45
|
+
[
|
|
46
|
+
constants$1.COLORTYPE_GRAYSCALE,
|
|
47
|
+
constants$1.COLORTYPE_COLOR,
|
|
48
|
+
constants$1.COLORTYPE_COLOR_ALPHA,
|
|
49
|
+
constants$1.COLORTYPE_ALPHA,
|
|
50
|
+
].indexOf(options.colorType) === -1
|
|
51
|
+
) {
|
|
52
|
+
throw new Error(
|
|
53
|
+
"option color type:" + options.colorType + " is not supported at present"
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
if (
|
|
57
|
+
[
|
|
58
|
+
constants$1.COLORTYPE_GRAYSCALE,
|
|
59
|
+
constants$1.COLORTYPE_COLOR,
|
|
60
|
+
constants$1.COLORTYPE_COLOR_ALPHA,
|
|
61
|
+
constants$1.COLORTYPE_ALPHA,
|
|
62
|
+
].indexOf(options.inputColorType) === -1
|
|
63
|
+
) {
|
|
64
|
+
throw new Error(
|
|
65
|
+
"option input color type:" +
|
|
66
|
+
options.inputColorType +
|
|
67
|
+
" is not supported at present"
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
if (options.bitDepth !== 8 && options.bitDepth !== 16) {
|
|
71
|
+
throw new Error(
|
|
72
|
+
"option bit depth:" + options.bitDepth + " is not supported at present"
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
Packer.prototype.getDeflateOptions = function () {
|
|
78
|
+
return {
|
|
79
|
+
chunkSize: this._options.deflateChunkSize,
|
|
80
|
+
level: this._options.deflateLevel,
|
|
81
|
+
strategy: this._options.deflateStrategy,
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
Packer.prototype.createDeflate = function () {
|
|
86
|
+
return this._options.deflateFactory(this.getDeflateOptions());
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
Packer.prototype.filterData = function (data, width, height) {
|
|
90
|
+
// convert to correct format for filtering (e.g. right bpp and bit depth)
|
|
91
|
+
let packedData = bitPacker(data, width, height, this._options);
|
|
92
|
+
|
|
93
|
+
// filter pixel data
|
|
94
|
+
let bpp = constants$1.COLORTYPE_TO_BPP_MAP[this._options.colorType];
|
|
95
|
+
let filteredData = filter(packedData, width, height, this._options, bpp);
|
|
96
|
+
return filteredData;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
Packer.prototype._packChunk = function (type, data) {
|
|
100
|
+
let len = data ? data.length : 0;
|
|
101
|
+
let buf = Buffer.alloc(len + 12);
|
|
102
|
+
|
|
103
|
+
buf.writeUInt32BE(len, 0);
|
|
104
|
+
buf.writeUInt32BE(type, 4);
|
|
105
|
+
|
|
106
|
+
if (data) {
|
|
107
|
+
data.copy(buf, 8);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
buf.writeInt32BE(
|
|
111
|
+
CrcStream.crc32(buf.slice(4, buf.length - 4)),
|
|
112
|
+
buf.length - 4
|
|
113
|
+
);
|
|
114
|
+
return buf;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
Packer.prototype.packGAMA = function (gamma) {
|
|
118
|
+
let buf = Buffer.alloc(4);
|
|
119
|
+
buf.writeUInt32BE(Math.floor(gamma * constants$1.GAMMA_DIVISION), 0);
|
|
120
|
+
return this._packChunk(constants$1.TYPE_gAMA, buf);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
Packer.prototype.packIHDR = function (width, height) {
|
|
124
|
+
let buf = Buffer.alloc(13);
|
|
125
|
+
buf.writeUInt32BE(width, 0);
|
|
126
|
+
buf.writeUInt32BE(height, 4);
|
|
127
|
+
buf[8] = this._options.bitDepth; // Bit depth
|
|
128
|
+
buf[9] = this._options.colorType; // colorType
|
|
129
|
+
buf[10] = 0; // compression
|
|
130
|
+
buf[11] = 0; // filter
|
|
131
|
+
buf[12] = 0; // interlace
|
|
132
|
+
|
|
133
|
+
return this._packChunk(constants$1.TYPE_IHDR, buf);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
Packer.prototype.packIDAT = function (data) {
|
|
137
|
+
return this._packChunk(constants$1.TYPE_IDAT, data);
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
Packer.prototype.packIEND = function () {
|
|
141
|
+
return this._packChunk(constants$1.TYPE_IEND, null);
|
|
142
|
+
};
|
|
143
|
+
return packer.__module.exports;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
exports.__require = requirePacker;
|
|
147
|
+
//# sourceMappingURL=packer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packer.js","sources":["../../../../node_modules/pngjs/lib/packer.js"],"sourcesContent":["\"use strict\";\n\nlet constants = require(\"./constants\");\nlet CrcStream = require(\"./crc\");\nlet bitPacker = require(\"./bitpacker\");\nlet filter = require(\"./filter-pack\");\nlet zlib = require(\"zlib\");\n\nlet Packer = (module.exports = function (options) {\n this._options = options;\n\n options.deflateChunkSize = options.deflateChunkSize || 32 * 1024;\n options.deflateLevel =\n options.deflateLevel != null ? options.deflateLevel : 9;\n options.deflateStrategy =\n options.deflateStrategy != null ? options.deflateStrategy : 3;\n options.inputHasAlpha =\n options.inputHasAlpha != null ? options.inputHasAlpha : true;\n options.deflateFactory = options.deflateFactory || zlib.createDeflate;\n options.bitDepth = options.bitDepth || 8;\n // This is outputColorType\n options.colorType =\n typeof options.colorType === \"number\"\n ? options.colorType\n : constants.COLORTYPE_COLOR_ALPHA;\n options.inputColorType =\n typeof options.inputColorType === \"number\"\n ? options.inputColorType\n : constants.COLORTYPE_COLOR_ALPHA;\n\n if (\n [\n constants.COLORTYPE_GRAYSCALE,\n constants.COLORTYPE_COLOR,\n constants.COLORTYPE_COLOR_ALPHA,\n constants.COLORTYPE_ALPHA,\n ].indexOf(options.colorType) === -1\n ) {\n throw new Error(\n \"option color type:\" + options.colorType + \" is not supported at present\"\n );\n }\n if (\n [\n constants.COLORTYPE_GRAYSCALE,\n constants.COLORTYPE_COLOR,\n constants.COLORTYPE_COLOR_ALPHA,\n constants.COLORTYPE_ALPHA,\n ].indexOf(options.inputColorType) === -1\n ) {\n throw new Error(\n \"option input color type:\" +\n options.inputColorType +\n \" is not supported at present\"\n );\n }\n if (options.bitDepth !== 8 && options.bitDepth !== 16) {\n throw new Error(\n \"option bit depth:\" + options.bitDepth + \" is not supported at present\"\n );\n }\n});\n\nPacker.prototype.getDeflateOptions = function () {\n return {\n chunkSize: this._options.deflateChunkSize,\n level: this._options.deflateLevel,\n strategy: this._options.deflateStrategy,\n };\n};\n\nPacker.prototype.createDeflate = function () {\n return this._options.deflateFactory(this.getDeflateOptions());\n};\n\nPacker.prototype.filterData = function (data, width, height) {\n // convert to correct format for filtering (e.g. right bpp and bit depth)\n let packedData = bitPacker(data, width, height, this._options);\n\n // filter pixel data\n let bpp = constants.COLORTYPE_TO_BPP_MAP[this._options.colorType];\n let filteredData = filter(packedData, width, height, this._options, bpp);\n return filteredData;\n};\n\nPacker.prototype._packChunk = function (type, data) {\n let len = data ? data.length : 0;\n let buf = Buffer.alloc(len + 12);\n\n buf.writeUInt32BE(len, 0);\n buf.writeUInt32BE(type, 4);\n\n if (data) {\n data.copy(buf, 8);\n }\n\n buf.writeInt32BE(\n CrcStream.crc32(buf.slice(4, buf.length - 4)),\n buf.length - 4\n );\n return buf;\n};\n\nPacker.prototype.packGAMA = function (gamma) {\n let buf = Buffer.alloc(4);\n buf.writeUInt32BE(Math.floor(gamma * constants.GAMMA_DIVISION), 0);\n return this._packChunk(constants.TYPE_gAMA, buf);\n};\n\nPacker.prototype.packIHDR = function (width, height) {\n let buf = Buffer.alloc(13);\n buf.writeUInt32BE(width, 0);\n buf.writeUInt32BE(height, 4);\n buf[8] = this._options.bitDepth; // Bit depth\n buf[9] = this._options.colorType; // colorType\n buf[10] = 0; // compression\n buf[11] = 0; // filter\n buf[12] = 0; // interlace\n\n return this._packChunk(constants.TYPE_IHDR, buf);\n};\n\nPacker.prototype.packIDAT = function (data) {\n return this._packChunk(constants.TYPE_IDAT, data);\n};\n\nPacker.prototype.packIEND = function () {\n return this._packChunk(constants.TYPE_IEND, null);\n};\n"],"names":["constants","require$$0","require$$1","require$$2","require$$3","require$$4","packerModule"],"mappings":";;;;;;;;;;;;;;;CAEA,IAAIA,WAAS,GAAGC,mBAAA,EAAsB;CACtC,IAAI,SAAS,GAAGC,aAAA,EAAgB;CAChC,IAAI,SAAS,GAAGC,mBAAA,EAAsB;CACtC,IAAI,MAAM,GAAGC,oBAAA,EAAwB;CACrC,IAAI,IAAI,GAAGC,UAAe;;AAE1B,CAAA,IAAI,MAAM,IAAIC,eAAA,CAAA,OAAc,GAAG,UAAU,OAAO,EAAE;AAClD,GAAE,IAAI,CAAC,QAAQ,GAAG,OAAO;;GAEvB,OAAO,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,IAAI,EAAE,GAAG,IAAI;GAChE,OAAO,CAAC,YAAY;KAClB,OAAO,CAAC,YAAY,IAAI,IAAI,GAAG,OAAO,CAAC,YAAY,GAAG,CAAC;GACzD,OAAO,CAAC,eAAe;KACrB,OAAO,CAAC,eAAe,IAAI,IAAI,GAAG,OAAO,CAAC,eAAe,GAAG,CAAC;GAC/D,OAAO,CAAC,aAAa;KACnB,OAAO,CAAC,aAAa,IAAI,IAAI,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI;GAC9D,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,IAAI,CAAC,aAAa;GACrE,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,CAAC;AAC1C;GACE,OAAO,CAAC,SAAS;AACnB,KAAI,OAAO,OAAO,CAAC,SAAS,KAAK;AACjC,SAAQ,OAAO,CAAC;SACRN,WAAS,CAAC,qBAAqB;GACrC,OAAO,CAAC,cAAc;AACxB,KAAI,OAAO,OAAO,CAAC,cAA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4
|
+
var hasRequiredPaethPredictor;
|
|
5
|
+
|
|
6
|
+
function requirePaethPredictor () {
|
|
7
|
+
if (hasRequiredPaethPredictor) return paethPredictor;
|
|
8
|
+
hasRequiredPaethPredictor = 1;
|
|
9
|
+
|
|
10
|
+
paethPredictor = function paethPredictor(left, above, upLeft) {
|
|
11
|
+
let paeth = left + above - upLeft;
|
|
12
|
+
let pLeft = Math.abs(paeth - left);
|
|
13
|
+
let pAbove = Math.abs(paeth - above);
|
|
14
|
+
let pUpLeft = Math.abs(paeth - upLeft);
|
|
15
|
+
|
|
16
|
+
if (pLeft <= pAbove && pLeft <= pUpLeft) {
|
|
17
|
+
return left;
|
|
18
|
+
}
|
|
19
|
+
if (pAbove <= pUpLeft) {
|
|
20
|
+
return above;
|
|
21
|
+
}
|
|
22
|
+
return upLeft;
|
|
23
|
+
};
|
|
24
|
+
return paethPredictor;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
exports.__require = requirePaethPredictor;
|
|
28
|
+
//# sourceMappingURL=paeth-predictor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paeth-predictor.js","sources":["../../../../node_modules/pngjs/lib/paeth-predictor.js"],"sourcesContent":["\"use strict\";\n\nmodule.exports = function paethPredictor(left, above, upLeft) {\n let paeth = left + above - upLeft;\n let pLeft = Math.abs(paeth - left);\n let pAbove = Math.abs(paeth - above);\n let pUpLeft = Math.abs(paeth - upLeft);\n\n if (pLeft <= pAbove && pLeft <= pUpLeft) {\n return left;\n }\n if (pAbove <= pUpLeft) {\n return above;\n }\n return upLeft;\n};\n"],"names":[],"mappings":";;;;;;;;;AAEA,CAAA,cAAc,GAAG,SAAS,cAAc,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE;AAC9D,GAAE,IAAI,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,MAAM;GACjC,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC;GAClC,IAAI,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC;GACpC,IAAI,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,MAAM,CAAC;;GAEtC,IAAI,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,OAAO,EAAE;AAC3C,KAAI,OAAO,IAAI;AACf,GAAA;AACA,GAAE,IAAI,MAAM,IAAI,OAAO,EAAE;AACzB,KAAI,OAAO,KAAK;AAChB,GAAA;AACA,GAAE,OAAO,MAAM;CACf,CAAC;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var parserAsync = require('../../../_virtual/parser-async.js');
|
|
4
|
+
var require$$0 = require('util');
|
|
5
|
+
var require$$1 = require('zlib');
|
|
6
|
+
var chunkstream = require('./chunkstream.js');
|
|
7
|
+
var filterParseAsync = require('./filter-parse-async.js');
|
|
8
|
+
var parser = require('./parser.js');
|
|
9
|
+
var bitmapper = require('./bitmapper.js');
|
|
10
|
+
var formatNormaliser = require('./format-normaliser.js');
|
|
11
|
+
|
|
12
|
+
var hasRequiredParserAsync;
|
|
13
|
+
|
|
14
|
+
function requireParserAsync () {
|
|
15
|
+
if (hasRequiredParserAsync) return parserAsync.__module.exports;
|
|
16
|
+
hasRequiredParserAsync = 1;
|
|
17
|
+
|
|
18
|
+
let util = require$$0;
|
|
19
|
+
let zlib = require$$1;
|
|
20
|
+
let ChunkStream = chunkstream.__require();
|
|
21
|
+
let FilterAsync = filterParseAsync.__require();
|
|
22
|
+
let Parser = parser.__require();
|
|
23
|
+
let bitmapper$1 = bitmapper.__require();
|
|
24
|
+
let formatNormaliser$1 = formatNormaliser.__require();
|
|
25
|
+
|
|
26
|
+
let ParserAsync = (parserAsync.__module.exports = function (options) {
|
|
27
|
+
ChunkStream.call(this);
|
|
28
|
+
|
|
29
|
+
this._parser = new Parser(options, {
|
|
30
|
+
read: this.read.bind(this),
|
|
31
|
+
error: this._handleError.bind(this),
|
|
32
|
+
metadata: this._handleMetaData.bind(this),
|
|
33
|
+
gamma: this.emit.bind(this, "gamma"),
|
|
34
|
+
palette: this._handlePalette.bind(this),
|
|
35
|
+
transColor: this._handleTransColor.bind(this),
|
|
36
|
+
finished: this._finished.bind(this),
|
|
37
|
+
inflateData: this._inflateData.bind(this),
|
|
38
|
+
simpleTransparency: this._simpleTransparency.bind(this),
|
|
39
|
+
headersFinished: this._headersFinished.bind(this),
|
|
40
|
+
});
|
|
41
|
+
this._options = options;
|
|
42
|
+
this.writable = true;
|
|
43
|
+
|
|
44
|
+
this._parser.start();
|
|
45
|
+
});
|
|
46
|
+
util.inherits(ParserAsync, ChunkStream);
|
|
47
|
+
|
|
48
|
+
ParserAsync.prototype._handleError = function (err) {
|
|
49
|
+
this.emit("error", err);
|
|
50
|
+
|
|
51
|
+
this.writable = false;
|
|
52
|
+
|
|
53
|
+
this.destroy();
|
|
54
|
+
|
|
55
|
+
if (this._inflate && this._inflate.destroy) {
|
|
56
|
+
this._inflate.destroy();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (this._filter) {
|
|
60
|
+
this._filter.destroy();
|
|
61
|
+
// For backward compatibility with Node 7 and below.
|
|
62
|
+
// Suppress errors due to _inflate calling write() even after
|
|
63
|
+
// it's destroy()'ed.
|
|
64
|
+
this._filter.on("error", function () {});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
this.errord = true;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
ParserAsync.prototype._inflateData = function (data) {
|
|
71
|
+
if (!this._inflate) {
|
|
72
|
+
if (this._bitmapInfo.interlace) {
|
|
73
|
+
this._inflate = zlib.createInflate();
|
|
74
|
+
|
|
75
|
+
this._inflate.on("error", this.emit.bind(this, "error"));
|
|
76
|
+
this._filter.on("complete", this._complete.bind(this));
|
|
77
|
+
|
|
78
|
+
this._inflate.pipe(this._filter);
|
|
79
|
+
} else {
|
|
80
|
+
let rowSize =
|
|
81
|
+
((this._bitmapInfo.width *
|
|
82
|
+
this._bitmapInfo.bpp *
|
|
83
|
+
this._bitmapInfo.depth +
|
|
84
|
+
7) >>
|
|
85
|
+
3) +
|
|
86
|
+
1;
|
|
87
|
+
let imageSize = rowSize * this._bitmapInfo.height;
|
|
88
|
+
let chunkSize = Math.max(imageSize, zlib.Z_MIN_CHUNK);
|
|
89
|
+
|
|
90
|
+
this._inflate = zlib.createInflate({ chunkSize: chunkSize });
|
|
91
|
+
let leftToInflate = imageSize;
|
|
92
|
+
|
|
93
|
+
let emitError = this.emit.bind(this, "error");
|
|
94
|
+
this._inflate.on("error", function (err) {
|
|
95
|
+
if (!leftToInflate) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
emitError(err);
|
|
100
|
+
});
|
|
101
|
+
this._filter.on("complete", this._complete.bind(this));
|
|
102
|
+
|
|
103
|
+
let filterWrite = this._filter.write.bind(this._filter);
|
|
104
|
+
this._inflate.on("data", function (chunk) {
|
|
105
|
+
if (!leftToInflate) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (chunk.length > leftToInflate) {
|
|
110
|
+
chunk = chunk.slice(0, leftToInflate);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
leftToInflate -= chunk.length;
|
|
114
|
+
|
|
115
|
+
filterWrite(chunk);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
this._inflate.on("end", this._filter.end.bind(this._filter));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
this._inflate.write(data);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
ParserAsync.prototype._handleMetaData = function (metaData) {
|
|
125
|
+
this._metaData = metaData;
|
|
126
|
+
this._bitmapInfo = Object.create(metaData);
|
|
127
|
+
|
|
128
|
+
this._filter = new FilterAsync(this._bitmapInfo);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
ParserAsync.prototype._handleTransColor = function (transColor) {
|
|
132
|
+
this._bitmapInfo.transColor = transColor;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
ParserAsync.prototype._handlePalette = function (palette) {
|
|
136
|
+
this._bitmapInfo.palette = palette;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
ParserAsync.prototype._simpleTransparency = function () {
|
|
140
|
+
this._metaData.alpha = true;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
ParserAsync.prototype._headersFinished = function () {
|
|
144
|
+
// Up until this point, we don't know if we have a tRNS chunk (alpha)
|
|
145
|
+
// so we can't emit metadata any earlier
|
|
146
|
+
this.emit("metadata", this._metaData);
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
ParserAsync.prototype._finished = function () {
|
|
150
|
+
if (this.errord) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (!this._inflate) {
|
|
155
|
+
this.emit("error", "No Inflate block");
|
|
156
|
+
} else {
|
|
157
|
+
// no more data to inflate
|
|
158
|
+
this._inflate.end();
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
ParserAsync.prototype._complete = function (filteredData) {
|
|
163
|
+
if (this.errord) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
let normalisedBitmapData;
|
|
168
|
+
|
|
169
|
+
try {
|
|
170
|
+
let bitmapData = bitmapper$1.dataToBitMap(filteredData, this._bitmapInfo);
|
|
171
|
+
|
|
172
|
+
normalisedBitmapData = formatNormaliser$1(bitmapData, this._bitmapInfo);
|
|
173
|
+
bitmapData = null;
|
|
174
|
+
} catch (ex) {
|
|
175
|
+
this._handleError(ex);
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
this.emit("parsed", normalisedBitmapData);
|
|
180
|
+
};
|
|
181
|
+
return parserAsync.__module.exports;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
exports.__require = requireParserAsync;
|
|
185
|
+
//# sourceMappingURL=parser-async.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser-async.js","sources":["../../../../node_modules/pngjs/lib/parser-async.js"],"sourcesContent":["\"use strict\";\n\nlet util = require(\"util\");\nlet zlib = require(\"zlib\");\nlet ChunkStream = require(\"./chunkstream\");\nlet FilterAsync = require(\"./filter-parse-async\");\nlet Parser = require(\"./parser\");\nlet bitmapper = require(\"./bitmapper\");\nlet formatNormaliser = require(\"./format-normaliser\");\n\nlet ParserAsync = (module.exports = function (options) {\n ChunkStream.call(this);\n\n this._parser = new Parser(options, {\n read: this.read.bind(this),\n error: this._handleError.bind(this),\n metadata: this._handleMetaData.bind(this),\n gamma: this.emit.bind(this, \"gamma\"),\n palette: this._handlePalette.bind(this),\n transColor: this._handleTransColor.bind(this),\n finished: this._finished.bind(this),\n inflateData: this._inflateData.bind(this),\n simpleTransparency: this._simpleTransparency.bind(this),\n headersFinished: this._headersFinished.bind(this),\n });\n this._options = options;\n this.writable = true;\n\n this._parser.start();\n});\nutil.inherits(ParserAsync, ChunkStream);\n\nParserAsync.prototype._handleError = function (err) {\n this.emit(\"error\", err);\n\n this.writable = false;\n\n this.destroy();\n\n if (this._inflate && this._inflate.destroy) {\n this._inflate.destroy();\n }\n\n if (this._filter) {\n this._filter.destroy();\n // For backward compatibility with Node 7 and below.\n // Suppress errors due to _inflate calling write() even after\n // it's destroy()'ed.\n this._filter.on(\"error\", function () {});\n }\n\n this.errord = true;\n};\n\nParserAsync.prototype._inflateData = function (data) {\n if (!this._inflate) {\n if (this._bitmapInfo.interlace) {\n this._inflate = zlib.createInflate();\n\n this._inflate.on(\"error\", this.emit.bind(this, \"error\"));\n this._filter.on(\"complete\", this._complete.bind(this));\n\n this._inflate.pipe(this._filter);\n } else {\n let rowSize =\n ((this._bitmapInfo.width *\n this._bitmapInfo.bpp *\n this._bitmapInfo.depth +\n 7) >>\n 3) +\n 1;\n let imageSize = rowSize * this._bitmapInfo.height;\n let chunkSize = Math.max(imageSize, zlib.Z_MIN_CHUNK);\n\n this._inflate = zlib.createInflate({ chunkSize: chunkSize });\n let leftToInflate = imageSize;\n\n let emitError = this.emit.bind(this, \"error\");\n this._inflate.on(\"error\", function (err) {\n if (!leftToInflate) {\n return;\n }\n\n emitError(err);\n });\n this._filter.on(\"complete\", this._complete.bind(this));\n\n let filterWrite = this._filter.write.bind(this._filter);\n this._inflate.on(\"data\", function (chunk) {\n if (!leftToInflate) {\n return;\n }\n\n if (chunk.length > leftToInflate) {\n chunk = chunk.slice(0, leftToInflate);\n }\n\n leftToInflate -= chunk.length;\n\n filterWrite(chunk);\n });\n\n this._inflate.on(\"end\", this._filter.end.bind(this._filter));\n }\n }\n this._inflate.write(data);\n};\n\nParserAsync.prototype._handleMetaData = function (metaData) {\n this._metaData = metaData;\n this._bitmapInfo = Object.create(metaData);\n\n this._filter = new FilterAsync(this._bitmapInfo);\n};\n\nParserAsync.prototype._handleTransColor = function (transColor) {\n this._bitmapInfo.transColor = transColor;\n};\n\nParserAsync.prototype._handlePalette = function (palette) {\n this._bitmapInfo.palette = palette;\n};\n\nParserAsync.prototype._simpleTransparency = function () {\n this._metaData.alpha = true;\n};\n\nParserAsync.prototype._headersFinished = function () {\n // Up until this point, we don't know if we have a tRNS chunk (alpha)\n // so we can't emit metadata any earlier\n this.emit(\"metadata\", this._metaData);\n};\n\nParserAsync.prototype._finished = function () {\n if (this.errord) {\n return;\n }\n\n if (!this._inflate) {\n this.emit(\"error\", \"No Inflate block\");\n } else {\n // no more data to inflate\n this._inflate.end();\n }\n};\n\nParserAsync.prototype._complete = function (filteredData) {\n if (this.errord) {\n return;\n }\n\n let normalisedBitmapData;\n\n try {\n let bitmapData = bitmapper.dataToBitMap(filteredData, this._bitmapInfo);\n\n normalisedBitmapData = formatNormaliser(bitmapData, this._bitmapInfo);\n bitmapData = null;\n } catch (ex) {\n this._handleError(ex);\n return;\n }\n\n this.emit(\"parsed\", normalisedBitmapData);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AAgB,GAAG,YAAY;AACrD;AACA;GACE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC;CACvC,CAAC;;AAED,CAAA,WAAW,CAAC,SAAS,CAAC,SAAS,GAAG,YAAY;AAC9C,GAAE,IAAI,IAAI,CAAC,MAAM,EAAE;KACf;AACJ,GAAA;;AAEA,GAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;AACtB,KAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,kBAAkB,CAAC;AAC1C,GAAA,CAAG,MAAM;AACT;AACA,KAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE;AACvB,GAAA;CACA,CAAC;;AAED,CAAA,WAAW,CAAC,SAAS,CAAC,SAAS,GAAG,UAAU,YAAY,EAAE;AAC1D,GAAE,IAAI,IAAI,CAAC,MAAM,EAAE;KACf;AACJ,GAAA;;AAEA,GAAE,IAAI,oBAAoB;;AAE1B,GAAE,IAAI;AACN,KAAI,IAAI,UAAU,GAAGJ,WAAS,CAAC,YAAY,CAAC,YAAY,EAAE,IAAI,CAAC,WAAW,CAAC;;KAEvE,oBAAoB,GAAGE,kBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC;KACrE,UAAU,GAAG,IAAI;GACrB,CAAG,CAAC,OAAO,EAAE,EAAE;AACf,KAAI,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;KACrB;AACJ,GAAA;;AAEA,GAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,oBAAoB,CAAC;CAC3C,CAAC;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var require$$1 = require('zlib');
|
|
4
|
+
var syncInflate = require('./sync-inflate.js');
|
|
5
|
+
var syncReader = require('./sync-reader.js');
|
|
6
|
+
var filterParseSync = require('./filter-parse-sync.js');
|
|
7
|
+
var parser = require('./parser.js');
|
|
8
|
+
var bitmapper = require('./bitmapper.js');
|
|
9
|
+
var formatNormaliser = require('./format-normaliser.js');
|
|
10
|
+
|
|
11
|
+
var parserSync;
|
|
12
|
+
var hasRequiredParserSync;
|
|
13
|
+
|
|
14
|
+
function requireParserSync () {
|
|
15
|
+
if (hasRequiredParserSync) return parserSync;
|
|
16
|
+
hasRequiredParserSync = 1;
|
|
17
|
+
|
|
18
|
+
let hasSyncZlib = true;
|
|
19
|
+
let zlib = require$$1;
|
|
20
|
+
let inflateSync = syncInflate.__require();
|
|
21
|
+
if (!zlib.deflateSync) {
|
|
22
|
+
hasSyncZlib = false;
|
|
23
|
+
}
|
|
24
|
+
let SyncReader = syncReader.__require();
|
|
25
|
+
let FilterSync = filterParseSync.__require();
|
|
26
|
+
let Parser = parser.__require();
|
|
27
|
+
let bitmapper$1 = bitmapper.__require();
|
|
28
|
+
let formatNormaliser$1 = formatNormaliser.__require();
|
|
29
|
+
|
|
30
|
+
parserSync = function (buffer, options) {
|
|
31
|
+
if (!hasSyncZlib) {
|
|
32
|
+
throw new Error(
|
|
33
|
+
"To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0"
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
let err;
|
|
38
|
+
function handleError(_err_) {
|
|
39
|
+
err = _err_;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
let metaData;
|
|
43
|
+
function handleMetaData(_metaData_) {
|
|
44
|
+
metaData = _metaData_;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function handleTransColor(transColor) {
|
|
48
|
+
metaData.transColor = transColor;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function handlePalette(palette) {
|
|
52
|
+
metaData.palette = palette;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function handleSimpleTransparency() {
|
|
56
|
+
metaData.alpha = true;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
let gamma;
|
|
60
|
+
function handleGamma(_gamma_) {
|
|
61
|
+
gamma = _gamma_;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
let inflateDataList = [];
|
|
65
|
+
function handleInflateData(inflatedData) {
|
|
66
|
+
inflateDataList.push(inflatedData);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
let reader = new SyncReader(buffer);
|
|
70
|
+
|
|
71
|
+
let parser = new Parser(options, {
|
|
72
|
+
read: reader.read.bind(reader),
|
|
73
|
+
error: handleError,
|
|
74
|
+
metadata: handleMetaData,
|
|
75
|
+
gamma: handleGamma,
|
|
76
|
+
palette: handlePalette,
|
|
77
|
+
transColor: handleTransColor,
|
|
78
|
+
inflateData: handleInflateData,
|
|
79
|
+
simpleTransparency: handleSimpleTransparency,
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
parser.start();
|
|
83
|
+
reader.process();
|
|
84
|
+
|
|
85
|
+
if (err) {
|
|
86
|
+
throw err;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
//join together the inflate datas
|
|
90
|
+
let inflateData = Buffer.concat(inflateDataList);
|
|
91
|
+
inflateDataList.length = 0;
|
|
92
|
+
|
|
93
|
+
let inflatedData;
|
|
94
|
+
if (metaData.interlace) {
|
|
95
|
+
inflatedData = zlib.inflateSync(inflateData);
|
|
96
|
+
} else {
|
|
97
|
+
let rowSize =
|
|
98
|
+
((metaData.width * metaData.bpp * metaData.depth + 7) >> 3) + 1;
|
|
99
|
+
let imageSize = rowSize * metaData.height;
|
|
100
|
+
inflatedData = inflateSync(inflateData, {
|
|
101
|
+
chunkSize: imageSize,
|
|
102
|
+
maxLength: imageSize,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
inflateData = null;
|
|
106
|
+
|
|
107
|
+
if (!inflatedData || !inflatedData.length) {
|
|
108
|
+
throw new Error("bad png - invalid inflate data response");
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
let unfilteredData = FilterSync.process(inflatedData, metaData);
|
|
112
|
+
inflateData = null;
|
|
113
|
+
|
|
114
|
+
let bitmapData = bitmapper$1.dataToBitMap(unfilteredData, metaData);
|
|
115
|
+
unfilteredData = null;
|
|
116
|
+
|
|
117
|
+
let normalisedBitmapData = formatNormaliser$1(bitmapData, metaData);
|
|
118
|
+
|
|
119
|
+
metaData.data = normalisedBitmapData;
|
|
120
|
+
metaData.gamma = gamma || 0;
|
|
121
|
+
|
|
122
|
+
return metaData;
|
|
123
|
+
};
|
|
124
|
+
return parserSync;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
exports.__require = requireParserSync;
|
|
128
|
+
//# sourceMappingURL=parser-sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser-sync.js","sources":["../../../../node_modules/pngjs/lib/parser-sync.js"],"sourcesContent":["\"use strict\";\n\nlet hasSyncZlib = true;\nlet zlib = require(\"zlib\");\nlet inflateSync = require(\"./sync-inflate\");\nif (!zlib.deflateSync) {\n hasSyncZlib = false;\n}\nlet SyncReader = require(\"./sync-reader\");\nlet FilterSync = require(\"./filter-parse-sync\");\nlet Parser = require(\"./parser\");\nlet bitmapper = require(\"./bitmapper\");\nlet formatNormaliser = require(\"./format-normaliser\");\n\nmodule.exports = function (buffer, options) {\n if (!hasSyncZlib) {\n throw new Error(\n \"To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0\"\n );\n }\n\n let err;\n function handleError(_err_) {\n err = _err_;\n }\n\n let metaData;\n function handleMetaData(_metaData_) {\n metaData = _metaData_;\n }\n\n function handleTransColor(transColor) {\n metaData.transColor = transColor;\n }\n\n function handlePalette(palette) {\n metaData.palette = palette;\n }\n\n function handleSimpleTransparency() {\n metaData.alpha = true;\n }\n\n let gamma;\n function handleGamma(_gamma_) {\n gamma = _gamma_;\n }\n\n let inflateDataList = [];\n function handleInflateData(inflatedData) {\n inflateDataList.push(inflatedData);\n }\n\n let reader = new SyncReader(buffer);\n\n let parser = new Parser(options, {\n read: reader.read.bind(reader),\n error: handleError,\n metadata: handleMetaData,\n gamma: handleGamma,\n palette: handlePalette,\n transColor: handleTransColor,\n inflateData: handleInflateData,\n simpleTransparency: handleSimpleTransparency,\n });\n\n parser.start();\n reader.process();\n\n if (err) {\n throw err;\n }\n\n //join together the inflate datas\n let inflateData = Buffer.concat(inflateDataList);\n inflateDataList.length = 0;\n\n let inflatedData;\n if (metaData.interlace) {\n inflatedData = zlib.inflateSync(inflateData);\n } else {\n let rowSize =\n ((metaData.width * metaData.bpp * metaData.depth + 7) >> 3) + 1;\n let imageSize = rowSize * metaData.height;\n inflatedData = inflateSync(inflateData, {\n chunkSize: imageSize,\n maxLength: imageSize,\n });\n }\n inflateData = null;\n\n if (!inflatedData || !inflatedData.length) {\n throw new Error(\"bad png - invalid inflate data response\");\n }\n\n let unfilteredData = FilterSync.process(inflatedData, metaData);\n inflateData = null;\n\n let bitmapData = bitmapper.dataToBitMap(unfilteredData, metaData);\n unfilteredData = null;\n\n let normalisedBitmapData = formatNormaliser(bitmapData, metaData);\n\n metaData.data = normalisedBitmapData;\n metaData.gamma = gamma || 0;\n\n return metaData;\n};\n"],"names":["require$$0","require$$1","require$$2","require$$3","require$$4","bitmapper","require$$5","formatNormaliser","require$$6"],"mappings":";;;;;;;;;;;;;;;;;CAEA,IAAI,WAAW,GAAG,IAAI;CACtB,IAAI,IAAI,GAAGA,UAAe;CAC1B,IAAI,WAAW,GAAGC,qBAAA,EAAyB;AAC3C,CAAA,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;GACrB,WAAW,GAAG,KAAK;AACrB,CAAA;CACA,IAAI,UAAU,GAAGC,oBAAA,EAAwB;CACzC,IAAI,UAAU,GAAGC,yBAAA,EAA8B;CAC/C,IAAI,MAAM,GAAGC,gBAAA,EAAmB;CAChC,IAAIC,WAAS,GAAGC,mBAAA,EAAsB;CACtC,IAAIC,kBAAgB,GAAGC,0BAAA,EAA8B;;AAErD,CAAA,UAAc,GAAG,UAAU,MAAM,EAAE,OAAO,EAAE;GAC1C,IAAI,CAAC,WAAW,E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