@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 @@
|
|
|
1
|
+
{"version":3,"file":"bitpacker.js","sources":["../../../../node_modules/pngjs/lib/bitpacker.js"],"sourcesContent":["\"use strict\";\n\nlet constants = require(\"./constants\");\n\nmodule.exports = function (dataIn, width, height, options) {\n let outHasAlpha =\n [constants.COLORTYPE_COLOR_ALPHA, constants.COLORTYPE_ALPHA].indexOf(\n options.colorType\n ) !== -1;\n if (options.colorType === options.inputColorType) {\n let bigEndian = (function () {\n let buffer = new ArrayBuffer(2);\n new DataView(buffer).setInt16(0, 256, true /* littleEndian */);\n // Int16Array uses the platform's endianness.\n return new Int16Array(buffer)[0] !== 256;\n })();\n // If no need to convert to grayscale and alpha is present/absent in both, take a fast route\n if (options.bitDepth === 8 || (options.bitDepth === 16 && bigEndian)) {\n return dataIn;\n }\n }\n\n // map to a UInt16 array if data is 16bit, fix endianness below\n let data = options.bitDepth !== 16 ? dataIn : new Uint16Array(dataIn.buffer);\n\n let maxValue = 255;\n let inBpp = constants.COLORTYPE_TO_BPP_MAP[options.inputColorType];\n if (inBpp === 4 && !options.inputHasAlpha) {\n inBpp = 3;\n }\n let outBpp = constants.COLORTYPE_TO_BPP_MAP[options.colorType];\n if (options.bitDepth === 16) {\n maxValue = 65535;\n outBpp *= 2;\n }\n let outData = Buffer.alloc(width * height * outBpp);\n\n let inIndex = 0;\n let outIndex = 0;\n\n let bgColor = options.bgColor || {};\n if (bgColor.red === undefined) {\n bgColor.red = maxValue;\n }\n if (bgColor.green === undefined) {\n bgColor.green = maxValue;\n }\n if (bgColor.blue === undefined) {\n bgColor.blue = maxValue;\n }\n\n function getRGBA() {\n let red;\n let green;\n let blue;\n let alpha = maxValue;\n switch (options.inputColorType) {\n case constants.COLORTYPE_COLOR_ALPHA:\n alpha = data[inIndex + 3];\n red = data[inIndex];\n green = data[inIndex + 1];\n blue = data[inIndex + 2];\n break;\n case constants.COLORTYPE_COLOR:\n red = data[inIndex];\n green = data[inIndex + 1];\n blue = data[inIndex + 2];\n break;\n case constants.COLORTYPE_ALPHA:\n alpha = data[inIndex + 1];\n red = data[inIndex];\n green = red;\n blue = red;\n break;\n case constants.COLORTYPE_GRAYSCALE:\n red = data[inIndex];\n green = red;\n blue = red;\n break;\n default:\n throw new Error(\n \"input color type:\" +\n options.inputColorType +\n \" is not supported at present\"\n );\n }\n\n if (options.inputHasAlpha) {\n if (!outHasAlpha) {\n alpha /= maxValue;\n red = Math.min(\n Math.max(Math.round((1 - alpha) * bgColor.red + alpha * red), 0),\n maxValue\n );\n green = Math.min(\n Math.max(Math.round((1 - alpha) * bgColor.green + alpha * green), 0),\n maxValue\n );\n blue = Math.min(\n Math.max(Math.round((1 - alpha) * bgColor.blue + alpha * blue), 0),\n maxValue\n );\n }\n }\n return { red: red, green: green, blue: blue, alpha: alpha };\n }\n\n for (let y = 0; y < height; y++) {\n for (let x = 0; x < width; x++) {\n let rgba = getRGBA(data, inIndex);\n\n switch (options.colorType) {\n case constants.COLORTYPE_COLOR_ALPHA:\n case constants.COLORTYPE_COLOR:\n if (options.bitDepth === 8) {\n outData[outIndex] = rgba.red;\n outData[outIndex + 1] = rgba.green;\n outData[outIndex + 2] = rgba.blue;\n if (outHasAlpha) {\n outData[outIndex + 3] = rgba.alpha;\n }\n } else {\n outData.writeUInt16BE(rgba.red, outIndex);\n outData.writeUInt16BE(rgba.green, outIndex + 2);\n outData.writeUInt16BE(rgba.blue, outIndex + 4);\n if (outHasAlpha) {\n outData.writeUInt16BE(rgba.alpha, outIndex + 6);\n }\n }\n break;\n case constants.COLORTYPE_ALPHA:\n case constants.COLORTYPE_GRAYSCALE: {\n // Convert to grayscale and alpha\n let grayscale = (rgba.red + rgba.green + rgba.blue) / 3;\n if (options.bitDepth === 8) {\n outData[outIndex] = grayscale;\n if (outHasAlpha) {\n outData[outIndex + 1] = rgba.alpha;\n }\n } else {\n outData.writeUInt16BE(grayscale, outIndex);\n if (outHasAlpha) {\n outData.writeUInt16BE(rgba.alpha, outIndex + 2);\n }\n }\n break;\n }\n default:\n throw new Error(\"unrecognised color Type \" + options.colorType);\n }\n\n inIndex += inBpp;\n outIndex += outBpp;\n }\n }\n\n return outData;\n};\n"],"names":["constants","require$$0"],"mappings":";;;;;;;;;;;CAEA,IAAIA,WAAS,GAAGC,mBAAA,EAAsB;;AAEtC,CAAA,SAAc,GAAG,UAAU,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE;AAC3D,GAAE,IAAI,WAAW;KACb,CAACD,WAAS,CAAC,qBAAqB,EAAEA,WAAS,CAAC,eAAe,CAAC,CAAC,OAAO;AACxE,OAAM,OAAO,CAAC;MACT,KAAK,EAAE;GACV,IAAI,OAAO,CAAC,SAAS,KAAK,OAAO,CAAC,cAAc,EAAE;AACpD,KAAI,IAAI,SAAS,GAAG,CAAC,YAAY;AACjC,OAAM,IAAI,MAAM,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC;AACrC,OAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,oBAAoB;AACpE;OACM,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG;AAC9C,KAAA,CAAK,GAAG;AACR;AACA,KAAI,IAAI,OAAO,CAAC,QAAQ,KAAK,CAAC,KAAK,OAAO,CAAC,QAAQ,KAAK,EAAE,IAAI,SAAS,CAAC,EAAE;AAC1E,OAAM,OAAO,MAAM;AACnB,KAAA;AACA,GAAA;;AAEA;AACA,GAAE,IAAI,IAAI,GAAG,OAAO,CAAC,QAAQ,KAAK,EAAE,GAAG,MAAM,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC;;GAE5E,IAAI,QAAQ,GAAG,GAAG;GAClB,IAAI,K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AI,CAAC,IAAI,EAAE,QAAQ,GAAG,CAAC,CAAC;aAC9C,IAAI,WAAW,EAAE;eACf,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,GAAG,CAAC,CAAC;AAC7D,aAAA;AACA,WAAA;WACU;SACF,KAAKA,WAAS,CAAC,eAAe;AACtC,SAAQ,KAAKA,WAAS,CAAC,mBAAmB,EAAE;AAC5C;AACA,WAAU,IAAI,SAAS,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,IAAI,CAAC;AACjE,WAAU,IAAI,OAAO,CAAC,QAAQ,KAAK,CAAC,EAAE;AACtC,aAAY,OAAO,CAAC,QAAQ,CAAC,GAAG,SAAS;aAC7B,IAAI,WAAW,EAAE;eACf,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK;AAChD,aAAA;AACA,WAAA,CAAW,MAAM;AACjB,aAAY,OAAO,CAAC,aAAa,CAAC,SAAS,EAAE,QAAQ,CAAC;aAC1C,IAAI,WAAW,EAAE;eACf,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,GAAG,CAAC,CAAC;AAC7D,aAAA;AACA,WAAA;WACU;AACV,SAAA;SACQ;WACE,MAAM,IAAI,KAAK,CAAC,0BAA0B,GAAG,OAAO,CAAC,SAAS,CAAC;AACzE;;OAEM,OAAO,IAAI,KAAK;OAChB,QAAQ,IAAI,MAAM;AACxB,KAAA;AACA,GAAA;;AAEA,GAAE,OAAO,OAAO;CAChB,CAAC;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkstream = require('../../../_virtual/chunkstream.js');
|
|
4
|
+
var require$$0 = require('util');
|
|
5
|
+
var require$$1 = require('stream');
|
|
6
|
+
|
|
7
|
+
var hasRequiredChunkstream;
|
|
8
|
+
|
|
9
|
+
function requireChunkstream () {
|
|
10
|
+
if (hasRequiredChunkstream) return chunkstream.__module.exports;
|
|
11
|
+
hasRequiredChunkstream = 1;
|
|
12
|
+
|
|
13
|
+
let util = require$$0;
|
|
14
|
+
let Stream = require$$1;
|
|
15
|
+
|
|
16
|
+
let ChunkStream = (chunkstream.__module.exports = function () {
|
|
17
|
+
Stream.call(this);
|
|
18
|
+
|
|
19
|
+
this._buffers = [];
|
|
20
|
+
this._buffered = 0;
|
|
21
|
+
|
|
22
|
+
this._reads = [];
|
|
23
|
+
this._paused = false;
|
|
24
|
+
|
|
25
|
+
this._encoding = "utf8";
|
|
26
|
+
this.writable = true;
|
|
27
|
+
});
|
|
28
|
+
util.inherits(ChunkStream, Stream);
|
|
29
|
+
|
|
30
|
+
ChunkStream.prototype.read = function (length, callback) {
|
|
31
|
+
this._reads.push({
|
|
32
|
+
length: Math.abs(length), // if length < 0 then at most this length
|
|
33
|
+
allowLess: length < 0,
|
|
34
|
+
func: callback,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
process.nextTick(
|
|
38
|
+
function () {
|
|
39
|
+
this._process();
|
|
40
|
+
|
|
41
|
+
// its paused and there is not enought data then ask for more
|
|
42
|
+
if (this._paused && this._reads && this._reads.length > 0) {
|
|
43
|
+
this._paused = false;
|
|
44
|
+
|
|
45
|
+
this.emit("drain");
|
|
46
|
+
}
|
|
47
|
+
}.bind(this)
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
ChunkStream.prototype.write = function (data, encoding) {
|
|
52
|
+
if (!this.writable) {
|
|
53
|
+
this.emit("error", new Error("Stream not writable"));
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
let dataBuffer;
|
|
58
|
+
if (Buffer.isBuffer(data)) {
|
|
59
|
+
dataBuffer = data;
|
|
60
|
+
} else {
|
|
61
|
+
dataBuffer = Buffer.from(data, encoding || this._encoding);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
this._buffers.push(dataBuffer);
|
|
65
|
+
this._buffered += dataBuffer.length;
|
|
66
|
+
|
|
67
|
+
this._process();
|
|
68
|
+
|
|
69
|
+
// ok if there are no more read requests
|
|
70
|
+
if (this._reads && this._reads.length === 0) {
|
|
71
|
+
this._paused = true;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return this.writable && !this._paused;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
ChunkStream.prototype.end = function (data, encoding) {
|
|
78
|
+
if (data) {
|
|
79
|
+
this.write(data, encoding);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
this.writable = false;
|
|
83
|
+
|
|
84
|
+
// already destroyed
|
|
85
|
+
if (!this._buffers) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// enqueue or handle end
|
|
90
|
+
if (this._buffers.length === 0) {
|
|
91
|
+
this._end();
|
|
92
|
+
} else {
|
|
93
|
+
this._buffers.push(null);
|
|
94
|
+
this._process();
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
ChunkStream.prototype.destroySoon = ChunkStream.prototype.end;
|
|
99
|
+
|
|
100
|
+
ChunkStream.prototype._end = function () {
|
|
101
|
+
if (this._reads.length > 0) {
|
|
102
|
+
this.emit("error", new Error("Unexpected end of input"));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
this.destroy();
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
ChunkStream.prototype.destroy = function () {
|
|
109
|
+
if (!this._buffers) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
this.writable = false;
|
|
114
|
+
this._reads = null;
|
|
115
|
+
this._buffers = null;
|
|
116
|
+
|
|
117
|
+
this.emit("close");
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
ChunkStream.prototype._processReadAllowingLess = function (read) {
|
|
121
|
+
// ok there is any data so that we can satisfy this request
|
|
122
|
+
this._reads.shift(); // == read
|
|
123
|
+
|
|
124
|
+
// first we need to peek into first buffer
|
|
125
|
+
let smallerBuf = this._buffers[0];
|
|
126
|
+
|
|
127
|
+
// ok there is more data than we need
|
|
128
|
+
if (smallerBuf.length > read.length) {
|
|
129
|
+
this._buffered -= read.length;
|
|
130
|
+
this._buffers[0] = smallerBuf.slice(read.length);
|
|
131
|
+
|
|
132
|
+
read.func.call(this, smallerBuf.slice(0, read.length));
|
|
133
|
+
} else {
|
|
134
|
+
// ok this is less than maximum length so use it all
|
|
135
|
+
this._buffered -= smallerBuf.length;
|
|
136
|
+
this._buffers.shift(); // == smallerBuf
|
|
137
|
+
|
|
138
|
+
read.func.call(this, smallerBuf);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
ChunkStream.prototype._processRead = function (read) {
|
|
143
|
+
this._reads.shift(); // == read
|
|
144
|
+
|
|
145
|
+
let pos = 0;
|
|
146
|
+
let count = 0;
|
|
147
|
+
let data = Buffer.alloc(read.length);
|
|
148
|
+
|
|
149
|
+
// create buffer for all data
|
|
150
|
+
while (pos < read.length) {
|
|
151
|
+
let buf = this._buffers[count++];
|
|
152
|
+
let len = Math.min(buf.length, read.length - pos);
|
|
153
|
+
|
|
154
|
+
buf.copy(data, pos, 0, len);
|
|
155
|
+
pos += len;
|
|
156
|
+
|
|
157
|
+
// last buffer wasn't used all so just slice it and leave
|
|
158
|
+
if (len !== buf.length) {
|
|
159
|
+
this._buffers[--count] = buf.slice(len);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// remove all used buffers
|
|
164
|
+
if (count > 0) {
|
|
165
|
+
this._buffers.splice(0, count);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
this._buffered -= read.length;
|
|
169
|
+
|
|
170
|
+
read.func.call(this, data);
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
ChunkStream.prototype._process = function () {
|
|
174
|
+
try {
|
|
175
|
+
// as long as there is any data and read requests
|
|
176
|
+
while (this._buffered > 0 && this._reads && this._reads.length > 0) {
|
|
177
|
+
let read = this._reads[0];
|
|
178
|
+
|
|
179
|
+
// read any data (but no more than length)
|
|
180
|
+
if (read.allowLess) {
|
|
181
|
+
this._processReadAllowingLess(read);
|
|
182
|
+
} else if (this._buffered >= read.length) {
|
|
183
|
+
// ok we can meet some expectations
|
|
184
|
+
|
|
185
|
+
this._processRead(read);
|
|
186
|
+
} else {
|
|
187
|
+
// not enought data to satisfy first request in queue
|
|
188
|
+
// so we need to wait for more
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (this._buffers && !this.writable) {
|
|
194
|
+
this._end();
|
|
195
|
+
}
|
|
196
|
+
} catch (ex) {
|
|
197
|
+
this.emit("error", ex);
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
return chunkstream.__module.exports;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
exports.__require = requireChunkstream;
|
|
204
|
+
//# sourceMappingURL=chunkstream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunkstream.js","sources":["../../../../node_modules/pngjs/lib/chunkstream.js"],"sourcesContent":["\"use strict\";\n\nlet util = require(\"util\");\nlet Stream = require(\"stream\");\n\nlet ChunkStream = (module.exports = function () {\n Stream.call(this);\n\n this._buffers = [];\n this._buffered = 0;\n\n this._reads = [];\n this._paused = false;\n\n this._encoding = \"utf8\";\n this.writable = true;\n});\nutil.inherits(ChunkStream, Stream);\n\nChunkStream.prototype.read = function (length, callback) {\n this._reads.push({\n length: Math.abs(length), // if length < 0 then at most this length\n allowLess: length < 0,\n func: callback,\n });\n\n process.nextTick(\n function () {\n this._process();\n\n // its paused and there is not enought data then ask for more\n if (this._paused && this._reads && this._reads.length > 0) {\n this._paused = false;\n\n this.emit(\"drain\");\n }\n }.bind(this)\n );\n};\n\nChunkStream.prototype.write = function (data, encoding) {\n if (!this.writable) {\n this.emit(\"error\", new Error(\"Stream not writable\"));\n return false;\n }\n\n let dataBuffer;\n if (Buffer.isBuffer(data)) {\n dataBuffer = data;\n } else {\n dataBuffer = Buffer.from(data, encoding || this._encoding);\n }\n\n this._buffers.push(dataBuffer);\n this._buffered += dataBuffer.length;\n\n this._process();\n\n // ok if there are no more read requests\n if (this._reads && this._reads.length === 0) {\n this._paused = true;\n }\n\n return this.writable && !this._paused;\n};\n\nChunkStream.prototype.end = function (data, encoding) {\n if (data) {\n this.write(data, encoding);\n }\n\n this.writable = false;\n\n // already destroyed\n if (!this._buffers) {\n return;\n }\n\n // enqueue or handle end\n if (this._buffers.length === 0) {\n this._end();\n } else {\n this._buffers.push(null);\n this._process();\n }\n};\n\nChunkStream.prototype.destroySoon = ChunkStream.prototype.end;\n\nChunkStream.prototype._end = function () {\n if (this._reads.length > 0) {\n this.emit(\"error\", new Error(\"Unexpected end of input\"));\n }\n\n this.destroy();\n};\n\nChunkStream.prototype.destroy = function () {\n if (!this._buffers) {\n return;\n }\n\n this.writable = false;\n this._reads = null;\n this._buffers = null;\n\n this.emit(\"close\");\n};\n\nChunkStream.prototype._processReadAllowingLess = function (read) {\n // ok there is any data so that we can satisfy this request\n this._reads.shift(); // == read\n\n // first we need to peek into first buffer\n let smallerBuf = this._buffers[0];\n\n // ok there is more data than we need\n if (smallerBuf.length > read.length) {\n this._buffered -= read.length;\n this._buffers[0] = smallerBuf.slice(read.length);\n\n read.func.call(this, smallerBuf.slice(0, read.length));\n } else {\n // ok this is less than maximum length so use it all\n this._buffered -= smallerBuf.length;\n this._buffers.shift(); // == smallerBuf\n\n read.func.call(this, smallerBuf);\n }\n};\n\nChunkStream.prototype._processRead = function (read) {\n this._reads.shift(); // == read\n\n let pos = 0;\n let count = 0;\n let data = Buffer.alloc(read.length);\n\n // create buffer for all data\n while (pos < read.length) {\n let buf = this._buffers[count++];\n let len = Math.min(buf.length, read.length - pos);\n\n buf.copy(data, pos, 0, len);\n pos += len;\n\n // last buffer wasn't used all so just slice it and leave\n if (len !== buf.length) {\n this._buffers[--count] = buf.slice(len);\n }\n }\n\n // remove all used buffers\n if (count > 0) {\n this._buffers.splice(0, count);\n }\n\n this._buffered -= read.length;\n\n read.func.call(this, data);\n};\n\nChunkStream.prototype._process = function () {\n try {\n // as long as there is any data and read requests\n while (this._buffered > 0 && this._reads && this._reads.length > 0) {\n let read = this._reads[0];\n\n // read any data (but no more than length)\n if (read.allowLess) {\n this._processReadAllowingLess(read);\n } else if (this._buffered >= read.length) {\n // ok we can meet some expectations\n\n this._processRead(read);\n } else {\n // not enought data to satisfy first request in queue\n // so we need to wait for more\n break;\n }\n }\n\n if (this._buffers && !this.writable) {\n this._end();\n }\n } catch (ex) {\n this.emit(\"error\", ex);\n }\n};\n"],"names":["chunkstreamModule"],"mappings":";;;;;;;;;;;;CAEA,IAAI,IAAI,GAAG,UAAe;CAC1B,IAAI,MAAM,GAAG,UAAiB;;AAE9B,CAAA,IAAI,WAAW,IAAIA,oBAAA,CAAA,OAAc,GAAG,YAAY;AAChD,GAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;;AAEnB,GAAE,IAAI,CAAC,QAAQ,GAAG,EAAE;AACpB,GAAE,IAAI,CAAC,SAAS,GAAG,CAAC;;AAEpB,GAAE,IAAI,CAAC,MAAM,GAAG,EAAE;AAClB,GAAE,IAAI,CAAC,OAAO,GAAG,KAAK;;AAEtB,GAAE,IAAI,CAAC,SAAS,GAAG,MAAM;AACzB,GAAE,IAAI,CAAC,QAAQ,GAAG,IAAI;AACtB,CAAA,CAAC,CAAC;AACF,CAAA,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;;CAElC,WAAW,CAAC,SAAS,CAAC,IAAI,GAAG,UAAU,MAAM,EAAE,QAAQ,EAAE;AACzD,GAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;AACnB,KAAI,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC;AAC5B,KAAI,SAAS,E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AAI,EAAE;AACjB,KAAA;GACA,CAAG,CAAC,OAAO,EAAE,EAAE;AACf,KAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;AAC1B,GAAA;CACA,CAAC;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var constants;
|
|
4
|
+
var hasRequiredConstants;
|
|
5
|
+
|
|
6
|
+
function requireConstants () {
|
|
7
|
+
if (hasRequiredConstants) return constants;
|
|
8
|
+
hasRequiredConstants = 1;
|
|
9
|
+
|
|
10
|
+
constants = {
|
|
11
|
+
PNG_SIGNATURE: [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a],
|
|
12
|
+
|
|
13
|
+
TYPE_IHDR: 0x49484452,
|
|
14
|
+
TYPE_IEND: 0x49454e44,
|
|
15
|
+
TYPE_IDAT: 0x49444154,
|
|
16
|
+
TYPE_PLTE: 0x504c5445,
|
|
17
|
+
TYPE_tRNS: 0x74524e53, // eslint-disable-line camelcase
|
|
18
|
+
TYPE_gAMA: 0x67414d41, // eslint-disable-line camelcase
|
|
19
|
+
|
|
20
|
+
// color-type bits
|
|
21
|
+
COLORTYPE_GRAYSCALE: 0,
|
|
22
|
+
COLORTYPE_PALETTE: 1,
|
|
23
|
+
COLORTYPE_COLOR: 2,
|
|
24
|
+
COLORTYPE_ALPHA: 4, // e.g. grayscale and alpha
|
|
25
|
+
|
|
26
|
+
// color-type combinations
|
|
27
|
+
COLORTYPE_PALETTE_COLOR: 3,
|
|
28
|
+
COLORTYPE_COLOR_ALPHA: 6,
|
|
29
|
+
|
|
30
|
+
COLORTYPE_TO_BPP_MAP: {
|
|
31
|
+
0: 1,
|
|
32
|
+
2: 3,
|
|
33
|
+
3: 1,
|
|
34
|
+
4: 2,
|
|
35
|
+
6: 4,
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
GAMMA_DIVISION: 100000,
|
|
39
|
+
};
|
|
40
|
+
return constants;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
exports.__require = requireConstants;
|
|
44
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../node_modules/pngjs/lib/constants.js"],"sourcesContent":["\"use strict\";\n\nmodule.exports = {\n PNG_SIGNATURE: [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a],\n\n TYPE_IHDR: 0x49484452,\n TYPE_IEND: 0x49454e44,\n TYPE_IDAT: 0x49444154,\n TYPE_PLTE: 0x504c5445,\n TYPE_tRNS: 0x74524e53, // eslint-disable-line camelcase\n TYPE_gAMA: 0x67414d41, // eslint-disable-line camelcase\n\n // color-type bits\n COLORTYPE_GRAYSCALE: 0,\n COLORTYPE_PALETTE: 1,\n COLORTYPE_COLOR: 2,\n COLORTYPE_ALPHA: 4, // e.g. grayscale and alpha\n\n // color-type combinations\n COLORTYPE_PALETTE_COLOR: 3,\n COLORTYPE_COLOR_ALPHA: 6,\n\n COLORTYPE_TO_BPP_MAP: {\n 0: 1,\n 2: 3,\n 3: 1,\n 4: 2,\n 6: 4,\n },\n\n GAMMA_DIVISION: 100000,\n};\n"],"names":[],"mappings":";;;;;;;;;AAEA,CAAA,SAAc,GAAG;AACjB,GAAE,aAAa,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;;GAE/D,SAAS,EAAE,UAAU;GACrB,SAAS,EAAE,UAAU;GACrB,SAAS,EAAE,UAAU;GACrB,SAAS,EAAE,UAAU;GACrB,SAAS,EAAE,UAAU;GACrB,SAAS,EAAE,UAAU;;AAEvB;GACE,mBAAmB,EAAE,CAAC;GACtB,iBAAiB,EAAE,CAAC;GACpB,eAAe,EAAE,CAAC;GAClB,eAAe,EAAE,CAAC;;AAEpB;GACE,uBAAuB,EAAE,CAAC;GAC1B,qBAAqB,EAAE,CAAC;;AAE1B,GAAE,oBAAoB,EAAE;KACpB,CAAC,EAAE,CAAC;KACJ,CAAC,EAAE,CAAC;KACJ,CAAC,EAAE,CAAC;KACJ,CAAC,EAAE,CAAC;KACJ,CAAC,EAAE,CAAC;IACL;;GAED,cAAc,EAAE,MAAM;EACvB;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var crc = require('../../../_virtual/crc.js');
|
|
4
|
+
|
|
5
|
+
var hasRequiredCrc;
|
|
6
|
+
|
|
7
|
+
function requireCrc () {
|
|
8
|
+
if (hasRequiredCrc) return crc.__module.exports;
|
|
9
|
+
hasRequiredCrc = 1;
|
|
10
|
+
|
|
11
|
+
let crcTable = [];
|
|
12
|
+
|
|
13
|
+
(function () {
|
|
14
|
+
for (let i = 0; i < 256; i++) {
|
|
15
|
+
let currentCrc = i;
|
|
16
|
+
for (let j = 0; j < 8; j++) {
|
|
17
|
+
if (currentCrc & 1) {
|
|
18
|
+
currentCrc = 0xedb88320 ^ (currentCrc >>> 1);
|
|
19
|
+
} else {
|
|
20
|
+
currentCrc = currentCrc >>> 1;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
crcTable[i] = currentCrc;
|
|
24
|
+
}
|
|
25
|
+
})();
|
|
26
|
+
|
|
27
|
+
let CrcCalculator = (crc.__module.exports = function () {
|
|
28
|
+
this._crc = -1;
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
CrcCalculator.prototype.write = function (data) {
|
|
32
|
+
for (let i = 0; i < data.length; i++) {
|
|
33
|
+
this._crc = crcTable[(this._crc ^ data[i]) & 0xff] ^ (this._crc >>> 8);
|
|
34
|
+
}
|
|
35
|
+
return true;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
CrcCalculator.prototype.crc32 = function () {
|
|
39
|
+
return this._crc ^ -1;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
CrcCalculator.crc32 = function (buf) {
|
|
43
|
+
let crc = -1;
|
|
44
|
+
for (let i = 0; i < buf.length; i++) {
|
|
45
|
+
crc = crcTable[(crc ^ buf[i]) & 0xff] ^ (crc >>> 8);
|
|
46
|
+
}
|
|
47
|
+
return crc ^ -1;
|
|
48
|
+
};
|
|
49
|
+
return crc.__module.exports;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
exports.__require = requireCrc;
|
|
53
|
+
//# sourceMappingURL=crc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crc.js","sources":["../../../../node_modules/pngjs/lib/crc.js"],"sourcesContent":["\"use strict\";\n\nlet crcTable = [];\n\n(function () {\n for (let i = 0; i < 256; i++) {\n let currentCrc = i;\n for (let j = 0; j < 8; j++) {\n if (currentCrc & 1) {\n currentCrc = 0xedb88320 ^ (currentCrc >>> 1);\n } else {\n currentCrc = currentCrc >>> 1;\n }\n }\n crcTable[i] = currentCrc;\n }\n})();\n\nlet CrcCalculator = (module.exports = function () {\n this._crc = -1;\n});\n\nCrcCalculator.prototype.write = function (data) {\n for (let i = 0; i < data.length; i++) {\n this._crc = crcTable[(this._crc ^ data[i]) & 0xff] ^ (this._crc >>> 8);\n }\n return true;\n};\n\nCrcCalculator.prototype.crc32 = function () {\n return this._crc ^ -1;\n};\n\nCrcCalculator.crc32 = function (buf) {\n let crc = -1;\n for (let i = 0; i < buf.length; i++) {\n crc = crcTable[(crc ^ buf[i]) & 0xff] ^ (crc >>> 8);\n }\n return crc ^ -1;\n};\n"],"names":["crcModule"],"mappings":";;;;;;;;;;CAEA,IAAI,QAAQ,GAAG,EAAE;;AAEjB,CAAA,CAAC,YAAY;AACb,GAAE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;KAC5B,IAAI,UAAU,GAAG,CAAC;AACtB,KAAI,KAAK,IAAI,CAAC,GAA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AAI,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC;AACvD,GAAA;AACA,GAAE,OAAO,GAAG,GAAG,EAAE;CACjB,CAAC;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var paethPredictor = require('./paeth-predictor.js');
|
|
4
|
+
|
|
5
|
+
var filterPack;
|
|
6
|
+
var hasRequiredFilterPack;
|
|
7
|
+
|
|
8
|
+
function requireFilterPack () {
|
|
9
|
+
if (hasRequiredFilterPack) return filterPack;
|
|
10
|
+
hasRequiredFilterPack = 1;
|
|
11
|
+
|
|
12
|
+
let paethPredictor$1 = paethPredictor.__require();
|
|
13
|
+
|
|
14
|
+
function filterNone(pxData, pxPos, byteWidth, rawData, rawPos) {
|
|
15
|
+
for (let x = 0; x < byteWidth; x++) {
|
|
16
|
+
rawData[rawPos + x] = pxData[pxPos + x];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function filterSumNone(pxData, pxPos, byteWidth) {
|
|
21
|
+
let sum = 0;
|
|
22
|
+
let length = pxPos + byteWidth;
|
|
23
|
+
|
|
24
|
+
for (let i = pxPos; i < length; i++) {
|
|
25
|
+
sum += Math.abs(pxData[i]);
|
|
26
|
+
}
|
|
27
|
+
return sum;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function filterSub(pxData, pxPos, byteWidth, rawData, rawPos, bpp) {
|
|
31
|
+
for (let x = 0; x < byteWidth; x++) {
|
|
32
|
+
let left = x >= bpp ? pxData[pxPos + x - bpp] : 0;
|
|
33
|
+
let val = pxData[pxPos + x] - left;
|
|
34
|
+
|
|
35
|
+
rawData[rawPos + x] = val;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function filterSumSub(pxData, pxPos, byteWidth, bpp) {
|
|
40
|
+
let sum = 0;
|
|
41
|
+
for (let x = 0; x < byteWidth; x++) {
|
|
42
|
+
let left = x >= bpp ? pxData[pxPos + x - bpp] : 0;
|
|
43
|
+
let val = pxData[pxPos + x] - left;
|
|
44
|
+
|
|
45
|
+
sum += Math.abs(val);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return sum;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function filterUp(pxData, pxPos, byteWidth, rawData, rawPos) {
|
|
52
|
+
for (let x = 0; x < byteWidth; x++) {
|
|
53
|
+
let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0;
|
|
54
|
+
let val = pxData[pxPos + x] - up;
|
|
55
|
+
|
|
56
|
+
rawData[rawPos + x] = val;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function filterSumUp(pxData, pxPos, byteWidth) {
|
|
61
|
+
let sum = 0;
|
|
62
|
+
let length = pxPos + byteWidth;
|
|
63
|
+
for (let x = pxPos; x < length; x++) {
|
|
64
|
+
let up = pxPos > 0 ? pxData[x - byteWidth] : 0;
|
|
65
|
+
let val = pxData[x] - up;
|
|
66
|
+
|
|
67
|
+
sum += Math.abs(val);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return sum;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function filterAvg(pxData, pxPos, byteWidth, rawData, rawPos, bpp) {
|
|
74
|
+
for (let x = 0; x < byteWidth; x++) {
|
|
75
|
+
let left = x >= bpp ? pxData[pxPos + x - bpp] : 0;
|
|
76
|
+
let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0;
|
|
77
|
+
let val = pxData[pxPos + x] - ((left + up) >> 1);
|
|
78
|
+
|
|
79
|
+
rawData[rawPos + x] = val;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function filterSumAvg(pxData, pxPos, byteWidth, bpp) {
|
|
84
|
+
let sum = 0;
|
|
85
|
+
for (let x = 0; x < byteWidth; x++) {
|
|
86
|
+
let left = x >= bpp ? pxData[pxPos + x - bpp] : 0;
|
|
87
|
+
let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0;
|
|
88
|
+
let val = pxData[pxPos + x] - ((left + up) >> 1);
|
|
89
|
+
|
|
90
|
+
sum += Math.abs(val);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return sum;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function filterPaeth(pxData, pxPos, byteWidth, rawData, rawPos, bpp) {
|
|
97
|
+
for (let x = 0; x < byteWidth; x++) {
|
|
98
|
+
let left = x >= bpp ? pxData[pxPos + x - bpp] : 0;
|
|
99
|
+
let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0;
|
|
100
|
+
let upleft =
|
|
101
|
+
pxPos > 0 && x >= bpp ? pxData[pxPos + x - (byteWidth + bpp)] : 0;
|
|
102
|
+
let val = pxData[pxPos + x] - paethPredictor$1(left, up, upleft);
|
|
103
|
+
|
|
104
|
+
rawData[rawPos + x] = val;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function filterSumPaeth(pxData, pxPos, byteWidth, bpp) {
|
|
109
|
+
let sum = 0;
|
|
110
|
+
for (let x = 0; x < byteWidth; x++) {
|
|
111
|
+
let left = x >= bpp ? pxData[pxPos + x - bpp] : 0;
|
|
112
|
+
let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0;
|
|
113
|
+
let upleft =
|
|
114
|
+
pxPos > 0 && x >= bpp ? pxData[pxPos + x - (byteWidth + bpp)] : 0;
|
|
115
|
+
let val = pxData[pxPos + x] - paethPredictor$1(left, up, upleft);
|
|
116
|
+
|
|
117
|
+
sum += Math.abs(val);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return sum;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
let filters = {
|
|
124
|
+
0: filterNone,
|
|
125
|
+
1: filterSub,
|
|
126
|
+
2: filterUp,
|
|
127
|
+
3: filterAvg,
|
|
128
|
+
4: filterPaeth,
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
let filterSums = {
|
|
132
|
+
0: filterSumNone,
|
|
133
|
+
1: filterSumSub,
|
|
134
|
+
2: filterSumUp,
|
|
135
|
+
3: filterSumAvg,
|
|
136
|
+
4: filterSumPaeth,
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
filterPack = function (pxData, width, height, options, bpp) {
|
|
140
|
+
let filterTypes;
|
|
141
|
+
if (!("filterType" in options) || options.filterType === -1) {
|
|
142
|
+
filterTypes = [0, 1, 2, 3, 4];
|
|
143
|
+
} else if (typeof options.filterType === "number") {
|
|
144
|
+
filterTypes = [options.filterType];
|
|
145
|
+
} else {
|
|
146
|
+
throw new Error("unrecognised filter types");
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (options.bitDepth === 16) {
|
|
150
|
+
bpp *= 2;
|
|
151
|
+
}
|
|
152
|
+
let byteWidth = width * bpp;
|
|
153
|
+
let rawPos = 0;
|
|
154
|
+
let pxPos = 0;
|
|
155
|
+
let rawData = Buffer.alloc((byteWidth + 1) * height);
|
|
156
|
+
|
|
157
|
+
let sel = filterTypes[0];
|
|
158
|
+
|
|
159
|
+
for (let y = 0; y < height; y++) {
|
|
160
|
+
if (filterTypes.length > 1) {
|
|
161
|
+
// find best filter for this line (with lowest sum of values)
|
|
162
|
+
let min = Infinity;
|
|
163
|
+
|
|
164
|
+
for (let i = 0; i < filterTypes.length; i++) {
|
|
165
|
+
let sum = filterSums[filterTypes[i]](pxData, pxPos, byteWidth, bpp);
|
|
166
|
+
if (sum < min) {
|
|
167
|
+
sel = filterTypes[i];
|
|
168
|
+
min = sum;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
rawData[rawPos] = sel;
|
|
174
|
+
rawPos++;
|
|
175
|
+
filters[sel](pxData, pxPos, byteWidth, rawData, rawPos, bpp);
|
|
176
|
+
rawPos += byteWidth;
|
|
177
|
+
pxPos += byteWidth;
|
|
178
|
+
}
|
|
179
|
+
return rawData;
|
|
180
|
+
};
|
|
181
|
+
return filterPack;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
exports.__require = requireFilterPack;
|
|
185
|
+
//# sourceMappingURL=filter-pack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-pack.js","sources":["../../../../node_modules/pngjs/lib/filter-pack.js"],"sourcesContent":["\"use strict\";\n\nlet paethPredictor = require(\"./paeth-predictor\");\n\nfunction filterNone(pxData, pxPos, byteWidth, rawData, rawPos) {\n for (let x = 0; x < byteWidth; x++) {\n rawData[rawPos + x] = pxData[pxPos + x];\n }\n}\n\nfunction filterSumNone(pxData, pxPos, byteWidth) {\n let sum = 0;\n let length = pxPos + byteWidth;\n\n for (let i = pxPos; i < length; i++) {\n sum += Math.abs(pxData[i]);\n }\n return sum;\n}\n\nfunction filterSub(pxData, pxPos, byteWidth, rawData, rawPos, bpp) {\n for (let x = 0; x < byteWidth; x++) {\n let left = x >= bpp ? pxData[pxPos + x - bpp] : 0;\n let val = pxData[pxPos + x] - left;\n\n rawData[rawPos + x] = val;\n }\n}\n\nfunction filterSumSub(pxData, pxPos, byteWidth, bpp) {\n let sum = 0;\n for (let x = 0; x < byteWidth; x++) {\n let left = x >= bpp ? pxData[pxPos + x - bpp] : 0;\n let val = pxData[pxPos + x] - left;\n\n sum += Math.abs(val);\n }\n\n return sum;\n}\n\nfunction filterUp(pxData, pxPos, byteWidth, rawData, rawPos) {\n for (let x = 0; x < byteWidth; x++) {\n let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0;\n let val = pxData[pxPos + x] - up;\n\n rawData[rawPos + x] = val;\n }\n}\n\nfunction filterSumUp(pxData, pxPos, byteWidth) {\n let sum = 0;\n let length = pxPos + byteWidth;\n for (let x = pxPos; x < length; x++) {\n let up = pxPos > 0 ? pxData[x - byteWidth] : 0;\n let val = pxData[x] - up;\n\n sum += Math.abs(val);\n }\n\n return sum;\n}\n\nfunction filterAvg(pxData, pxPos, byteWidth, rawData, rawPos, bpp) {\n for (let x = 0; x < byteWidth; x++) {\n let left = x >= bpp ? pxData[pxPos + x - bpp] : 0;\n let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0;\n let val = pxData[pxPos + x] - ((left + up) >> 1);\n\n rawData[rawPos + x] = val;\n }\n}\n\nfunction filterSumAvg(pxData, pxPos, byteWidth, bpp) {\n let sum = 0;\n for (let x = 0; x < byteWidth; x++) {\n let left = x >= bpp ? pxData[pxPos + x - bpp] : 0;\n let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0;\n let val = pxData[pxPos + x] - ((left + up) >> 1);\n\n sum += Math.abs(val);\n }\n\n return sum;\n}\n\nfunction filterPaeth(pxData, pxPos, byteWidth, rawData, rawPos, bpp) {\n for (let x = 0; x < byteWidth; x++) {\n let left = x >= bpp ? pxData[pxPos + x - bpp] : 0;\n let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0;\n let upleft =\n pxPos > 0 && x >= bpp ? pxData[pxPos + x - (byteWidth + bpp)] : 0;\n let val = pxData[pxPos + x] - paethPredictor(left, up, upleft);\n\n rawData[rawPos + x] = val;\n }\n}\n\nfunction filterSumPaeth(pxData, pxPos, byteWidth, bpp) {\n let sum = 0;\n for (let x = 0; x < byteWidth; x++) {\n let left = x >= bpp ? pxData[pxPos + x - bpp] : 0;\n let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0;\n let upleft =\n pxPos > 0 && x >= bpp ? pxData[pxPos + x - (byteWidth + bpp)] : 0;\n let val = pxData[pxPos + x] - paethPredictor(left, up, upleft);\n\n sum += Math.abs(val);\n }\n\n return sum;\n}\n\nlet filters = {\n 0: filterNone,\n 1: filterSub,\n 2: filterUp,\n 3: filterAvg,\n 4: filterPaeth,\n};\n\nlet filterSums = {\n 0: filterSumNone,\n 1: filterSumSub,\n 2: filterSumUp,\n 3: filterSumAvg,\n 4: filterSumPaeth,\n};\n\nmodule.exports = function (pxData, width, height, options, bpp) {\n let filterTypes;\n if (!(\"filterType\" in options) || options.filterType === -1) {\n filterTypes = [0, 1, 2, 3, 4];\n } else if (typeof options.filterType === \"number\") {\n filterTypes = [options.filterType];\n } else {\n throw new Error(\"unrecognised filter types\");\n }\n\n if (options.bitDepth === 16) {\n bpp *= 2;\n }\n let byteWidth = width * bpp;\n let rawPos = 0;\n let pxPos = 0;\n let rawData = Buffer.alloc((byteWidth + 1) * height);\n\n let sel = filterTypes[0];\n\n for (let y = 0; y < height; y++) {\n if (filterTypes.length > 1) {\n // find best filter for this line (with lowest sum of values)\n let min = Infinity;\n\n for (let i = 0; i < filterTypes.length; i++) {\n let sum = filterSums[filterTypes[i]](pxData, pxPos, byteWidth, bpp);\n if (sum < min) {\n sel = filterTypes[i];\n min = sum;\n }\n }\n }\n\n rawData[rawPos] = sel;\n rawPos++;\n filters[sel](pxData, pxPos, byteWidth, rawData, rawPos, bpp);\n rawPos += byteWidth;\n pxPos += byteWidth;\n }\n return rawData;\n};\n"],"names":["paethPredictor","require$$0"],"mappings":";;;;;;;;;;;CAEA,IAAIA,gBAAc,GAAGC,wBAAA,EAA4B;;CAEjD,SAAS,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE;AAC/D,GAAE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,EAAE;AACtC,KAAI,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC;AAC3C,GAAA;AACA,CAAA;;AAEA,CAAA,SAAS,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE;GAC/C,IAAI,GAAG,GAAG,CAAC;AACb,GAAE,IAAI,MAAM,GAAG,KAAK,GAAG,SAAS;;AAEhC,GAAE,KAAK,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;KACnC,GAAG,I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AAI,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;AAChC;OACM,IAAI,GAAG,GAAG,QAAQ;;AAExB,OAAM,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACnD,SAAQ,IAAI,GAAG,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,CAAC;AAC3E,SAAQ,IAAI,GAAG,GAAG,GAAG,EAAE;AACvB,WAAU,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC;WACpB,GAAG,GAAG,GAAG;AACnB,SAAA;AACA,OAAA;AACA,KAAA;;AAEA,KAAI,OAAO,CAAC,MAAM,CAAC,GAAG,GAAG;AACzB,KAAI,MAAM,EAAE;AACZ,KAAI,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC;KAC5D,MAAM,IAAI,SAAS;KACnB,KAAK,IAAI,SAAS;AACtB,GAAA;AACA,GAAE,OAAO,OAAO;CAChB,CAAC;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var filterParseAsync = require('../../../_virtual/filter-parse-async.js');
|
|
4
|
+
var require$$0 = require('util');
|
|
5
|
+
var chunkstream = require('./chunkstream.js');
|
|
6
|
+
var filterParse = require('./filter-parse.js');
|
|
7
|
+
|
|
8
|
+
var hasRequiredFilterParseAsync;
|
|
9
|
+
|
|
10
|
+
function requireFilterParseAsync () {
|
|
11
|
+
if (hasRequiredFilterParseAsync) return filterParseAsync.__module.exports;
|
|
12
|
+
hasRequiredFilterParseAsync = 1;
|
|
13
|
+
|
|
14
|
+
let util = require$$0;
|
|
15
|
+
let ChunkStream = chunkstream.__require();
|
|
16
|
+
let Filter = filterParse.__require();
|
|
17
|
+
|
|
18
|
+
let FilterAsync = (filterParseAsync.__module.exports = function (bitmapInfo) {
|
|
19
|
+
ChunkStream.call(this);
|
|
20
|
+
|
|
21
|
+
let buffers = [];
|
|
22
|
+
let that = this;
|
|
23
|
+
this._filter = new Filter(bitmapInfo, {
|
|
24
|
+
read: this.read.bind(this),
|
|
25
|
+
write: function (buffer) {
|
|
26
|
+
buffers.push(buffer);
|
|
27
|
+
},
|
|
28
|
+
complete: function () {
|
|
29
|
+
that.emit("complete", Buffer.concat(buffers));
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
this._filter.start();
|
|
34
|
+
});
|
|
35
|
+
util.inherits(FilterAsync, ChunkStream);
|
|
36
|
+
return filterParseAsync.__module.exports;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
exports.__require = requireFilterParseAsync;
|
|
40
|
+
//# sourceMappingURL=filter-parse-async.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-parse-async.js","sources":["../../../../node_modules/pngjs/lib/filter-parse-async.js"],"sourcesContent":["\"use strict\";\n\nlet util = require(\"util\");\nlet ChunkStream = require(\"./chunkstream\");\nlet Filter = require(\"./filter-parse\");\n\nlet FilterAsync = (module.exports = function (bitmapInfo) {\n ChunkStream.call(this);\n\n let buffers = [];\n let that = this;\n this._filter = new Filter(bitmapInfo, {\n read: this.read.bind(this),\n write: function (buffer) {\n buffers.push(buffer);\n },\n complete: function () {\n that.emit(\"complete\", Buffer.concat(buffers));\n },\n });\n\n this._filter.start();\n});\nutil.inherits(FilterAsync, ChunkStream);\n"],"names":["require$$1","require$$2","filterParseAsyncModule"],"mappings":";;;;;;;;;;;;;CAEA,IAAI,IAAI,GAAG,UAAe;CAC1B,IAAI,WAAW,GAAGA,qBAAA,EAAwB;CAC1C,IAAI,MAAM,GAAGC,qBAAA,EAAyB;;AAEtC,CAAA,IAAI,WAAW,IAAIC,yBAAA,CAAA,OAAc,GAAG,UAAU,UAAU,EAAE;AAC1D,GAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC;;GAEtB,IAAI,OAAO,GAAG,EAAE;GAChB,IAAI,IAAI,GAAG,IAAI;GACf,IAAI,CAAC,OAAO,GAAG,IAAI,MAAM,CAAC,UAAU,EAAE;KACpC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AAC9B,KAAI,KAAK,EAAE,UAAU,MAAM,EAAE;AAC7B,OAAM,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;KAC1B,CAAK;KACD,QAAQ,EAAE,YAAY;AAC1B,OAAM,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;KACnD,CAAK;AACL,IAAG,CAAC;;AAEJ,GAAE,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;AACtB,CAAA,CAAC,CAAC;AACF,CAAA,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var filterParseSync = require('../../../_virtual/filter-parse-sync.js');
|
|
4
|
+
var syncReader = require('./sync-reader.js');
|
|
5
|
+
var filterParse = require('./filter-parse.js');
|
|
6
|
+
|
|
7
|
+
var hasRequiredFilterParseSync;
|
|
8
|
+
|
|
9
|
+
function requireFilterParseSync () {
|
|
10
|
+
if (hasRequiredFilterParseSync) return filterParseSync.__exports;
|
|
11
|
+
hasRequiredFilterParseSync = 1;
|
|
12
|
+
|
|
13
|
+
let SyncReader = syncReader.__require();
|
|
14
|
+
let Filter = filterParse.__require();
|
|
15
|
+
|
|
16
|
+
filterParseSync.__exports.process = function (inBuffer, bitmapInfo) {
|
|
17
|
+
let outBuffers = [];
|
|
18
|
+
let reader = new SyncReader(inBuffer);
|
|
19
|
+
let filter = new Filter(bitmapInfo, {
|
|
20
|
+
read: reader.read.bind(reader),
|
|
21
|
+
write: function (bufferPart) {
|
|
22
|
+
outBuffers.push(bufferPart);
|
|
23
|
+
},
|
|
24
|
+
complete: function () {},
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
filter.start();
|
|
28
|
+
reader.process();
|
|
29
|
+
|
|
30
|
+
return Buffer.concat(outBuffers);
|
|
31
|
+
};
|
|
32
|
+
return filterParseSync.__exports;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
exports.__require = requireFilterParseSync;
|
|
36
|
+
//# sourceMappingURL=filter-parse-sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-parse-sync.js","sources":["../../../../node_modules/pngjs/lib/filter-parse-sync.js"],"sourcesContent":["\"use strict\";\n\nlet SyncReader = require(\"./sync-reader\");\nlet Filter = require(\"./filter-parse\");\n\nexports.process = function (inBuffer, bitmapInfo) {\n let outBuffers = [];\n let reader = new SyncReader(inBuffer);\n let filter = new Filter(bitmapInfo, {\n read: reader.read.bind(reader),\n write: function (bufferPart) {\n outBuffers.push(bufferPart);\n },\n complete: function () {},\n });\n\n filter.start();\n reader.process();\n\n return Buffer.concat(outBuffers);\n};\n"],"names":["require$$0","require$$1","filterParseSync"],"mappings":";;;;;;;;;;;;CAEA,IAAI,UAAU,GAAGA,oBAAA,EAAwB;CACzC,IAAI,MAAM,GAAGC,qBAAA,EAAyB;;AAEtC,CAAAC,yBAAA,CAAA,OAAe,GAAG,UAAU,QAAQ,EAAE,UAAU,EAAE;GAChD,IAAI,UAAU,GAAG,EAAE;AACrB,GAAE,IAAI,MAAM,GAAG,IAAI,UAAU,CAAC,QAAQ,CAAC;AACvC,GAAE,IAAI,MAAM,GAAG,IAAI,MAAM,CAAC,UAAU,EAAE;KAClC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;AAClC,KAAI,KAAK,EAAE,UAAU,UAAU,EAAE;AACjC,OAAM,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC;KACjC,CAAK;KACD,QAAQ,EAAE,YAAY,CAAA,CAAE;AAC5B,IAAG,CAAC;;GAEF,MAAM,CAAC,KAAK,EAAE;GACd,MAAM,CAAC,OAAO,EAAE;;AAElB,GAAE,OAAO,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;CAClC,CAAC;;;;;;","x_google_ignoreList":[0]}
|