first commit
This commit is contained in:
10
node_modules/pdf-lib/cjs/core/streams/Ascii85Stream.d.ts
generated
vendored
Normal file
10
node_modules/pdf-lib/cjs/core/streams/Ascii85Stream.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import DecodeStream from "./DecodeStream";
|
||||
import { StreamType } from "./Stream";
|
||||
declare class Ascii85Stream extends DecodeStream {
|
||||
private stream;
|
||||
private input;
|
||||
constructor(stream: StreamType, maybeLength?: number);
|
||||
protected readBlock(): void;
|
||||
}
|
||||
export default Ascii85Stream;
|
||||
//# sourceMappingURL=Ascii85Stream.d.ts.map
|
||||
1
node_modules/pdf-lib/cjs/core/streams/Ascii85Stream.d.ts.map
generated
vendored
Normal file
1
node_modules/pdf-lib/cjs/core/streams/Ascii85Stream.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Ascii85Stream.d.ts","sourceRoot":"","sources":["../../../src/core/streams/Ascii85Stream.ts"],"names":[],"mappings":"AAQA,OAAO,YAAY,uBAAsC;AACzD,OAAO,EAAE,UAAU,EAAE,iBAAgC;AAKrD,cAAM,aAAc,SAAQ,YAAY;IACtC,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,KAAK,CAAa;gBAEd,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,EAAE,MAAM;IAapD,SAAS,CAAC,SAAS;CAgEpB;AAED,eAAe,aAAa,CAAC"}
|
||||
87
node_modules/pdf-lib/cjs/core/streams/Ascii85Stream.js
generated
vendored
Normal file
87
node_modules/pdf-lib/cjs/core/streams/Ascii85Stream.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
"use strict";
|
||||
/*
|
||||
* Copyright 2012 Mozilla Foundation
|
||||
*
|
||||
* The Ascii85Stream class contained in this file is a TypeScript port of the
|
||||
* JavaScript Ascii85Stream class in Mozilla's pdf.js project, made available
|
||||
* under the Apache 2.0 open source license.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var DecodeStream_1 = tslib_1.__importDefault(require("./DecodeStream"));
|
||||
var isSpace = function (ch) {
|
||||
return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;
|
||||
};
|
||||
var Ascii85Stream = /** @class */ (function (_super) {
|
||||
tslib_1.__extends(Ascii85Stream, _super);
|
||||
function Ascii85Stream(stream, maybeLength) {
|
||||
var _this = _super.call(this, maybeLength) || this;
|
||||
_this.stream = stream;
|
||||
_this.input = new Uint8Array(5);
|
||||
// Most streams increase in size when decoded, but Ascii85 streams
|
||||
// typically shrink by ~20%.
|
||||
if (maybeLength) {
|
||||
maybeLength = 0.8 * maybeLength;
|
||||
}
|
||||
return _this;
|
||||
}
|
||||
Ascii85Stream.prototype.readBlock = function () {
|
||||
var TILDA_CHAR = 0x7e; // '~'
|
||||
var Z_LOWER_CHAR = 0x7a; // 'z'
|
||||
var EOF = -1;
|
||||
var stream = this.stream;
|
||||
var c = stream.getByte();
|
||||
while (isSpace(c)) {
|
||||
c = stream.getByte();
|
||||
}
|
||||
if (c === EOF || c === TILDA_CHAR) {
|
||||
this.eof = true;
|
||||
return;
|
||||
}
|
||||
var bufferLength = this.bufferLength;
|
||||
var buffer;
|
||||
var i;
|
||||
// special code for z
|
||||
if (c === Z_LOWER_CHAR) {
|
||||
buffer = this.ensureBuffer(bufferLength + 4);
|
||||
for (i = 0; i < 4; ++i) {
|
||||
buffer[bufferLength + i] = 0;
|
||||
}
|
||||
this.bufferLength += 4;
|
||||
}
|
||||
else {
|
||||
var input = this.input;
|
||||
input[0] = c;
|
||||
for (i = 1; i < 5; ++i) {
|
||||
c = stream.getByte();
|
||||
while (isSpace(c)) {
|
||||
c = stream.getByte();
|
||||
}
|
||||
input[i] = c;
|
||||
if (c === EOF || c === TILDA_CHAR) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
buffer = this.ensureBuffer(bufferLength + i - 1);
|
||||
this.bufferLength += i - 1;
|
||||
// partial ending;
|
||||
if (i < 5) {
|
||||
for (; i < 5; ++i) {
|
||||
input[i] = 0x21 + 84;
|
||||
}
|
||||
this.eof = true;
|
||||
}
|
||||
var t = 0;
|
||||
for (i = 0; i < 5; ++i) {
|
||||
t = t * 85 + (input[i] - 0x21);
|
||||
}
|
||||
for (i = 3; i >= 0; --i) {
|
||||
buffer[bufferLength + i] = t & 0xff;
|
||||
t >>= 8;
|
||||
}
|
||||
}
|
||||
};
|
||||
return Ascii85Stream;
|
||||
}(DecodeStream_1.default));
|
||||
exports.default = Ascii85Stream;
|
||||
//# sourceMappingURL=Ascii85Stream.js.map
|
||||
1
node_modules/pdf-lib/cjs/core/streams/Ascii85Stream.js.map
generated
vendored
Normal file
1
node_modules/pdf-lib/cjs/core/streams/Ascii85Stream.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Ascii85Stream.js","sourceRoot":"","sources":["../../../src/core/streams/Ascii85Stream.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,wEAAyD;AAGzD,IAAM,OAAO,GAAG,UAAC,EAAU;IACzB,OAAA,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,IAAI;AAAxD,CAAwD,CAAC;AAE3D;IAA4B,yCAAY;IAItC,uBAAY,MAAkB,EAAE,WAAoB;QAApD,YACE,kBAAM,WAAW,CAAC,SAUnB;QARC,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,KAAI,CAAC,KAAK,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;QAE/B,kEAAkE;QAClE,4BAA4B;QAC5B,IAAI,WAAW,EAAE;YACf,WAAW,GAAG,GAAG,GAAG,WAAW,CAAC;SACjC;;IACH,CAAC;IAES,iCAAS,GAAnB;QACE,IAAM,UAAU,GAAG,IAAI,CAAC,CAAC,MAAM;QAC/B,IAAM,YAAY,GAAG,IAAI,CAAC,CAAC,MAAM;Q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ACD,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;YACjD,IAAI,CAAC,YAAY,IAAI,CAAC,GAAG,CAAC,CAAC;YAE3B,kBAAkB;YAClB,IAAI,CAAC,GAAG,CAAC,EAAE;gBACT,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE;oBACjB,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,EAAE,CAAC;iBACtB;gBACD,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;aACjB;YACD,IAAI,CAAC,GAAG,CAAC,CAAC;YACV,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE;gBACtB,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;aAChC;YAED,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE;gBACvB,MAAM,CAAC,YAAY,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;gBACpC,CAAC,KAAK,CAAC,CAAC;aACT;SACF;IACH,CAAC;IACH,oBAAC;AAAD,CAAC,AAjFD,CAA4B,sBAAY,GAiFvC;AAED,kBAAe,aAAa,CAAC"}
|
||||
10
node_modules/pdf-lib/cjs/core/streams/AsciiHexStream.d.ts
generated
vendored
Normal file
10
node_modules/pdf-lib/cjs/core/streams/AsciiHexStream.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import DecodeStream from "./DecodeStream";
|
||||
import { StreamType } from "./Stream";
|
||||
declare class AsciiHexStream extends DecodeStream {
|
||||
private stream;
|
||||
private firstDigit;
|
||||
constructor(stream: StreamType, maybeLength?: number);
|
||||
protected readBlock(): void;
|
||||
}
|
||||
export default AsciiHexStream;
|
||||
//# sourceMappingURL=AsciiHexStream.d.ts.map
|
||||
1
node_modules/pdf-lib/cjs/core/streams/AsciiHexStream.d.ts.map
generated
vendored
Normal file
1
node_modules/pdf-lib/cjs/core/streams/AsciiHexStream.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"AsciiHexStream.d.ts","sourceRoot":"","sources":["../../../src/core/streams/AsciiHexStream.ts"],"names":[],"mappings":"AAQA,OAAO,YAAY,uBAAsC;AACzD,OAAO,EAAE,UAAU,EAAE,iBAAgC;AAErD,cAAM,cAAe,SAAQ,YAAY;IACvC,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,UAAU,CAAS;gBAEf,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,EAAE,MAAM;IAcpD,SAAS,CAAC,SAAS;CA6CpB;AAED,eAAe,cAAc,CAAC"}
|
||||
75
node_modules/pdf-lib/cjs/core/streams/AsciiHexStream.js
generated
vendored
Normal file
75
node_modules/pdf-lib/cjs/core/streams/AsciiHexStream.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
"use strict";
|
||||
/*
|
||||
* Copyright 2012 Mozilla Foundation
|
||||
*
|
||||
* The AsciiHexStream class contained in this file is a TypeScript port of the
|
||||
* JavaScript AsciiHexStream class in Mozilla's pdf.js project, made available
|
||||
* under the Apache 2.0 open source license.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var DecodeStream_1 = tslib_1.__importDefault(require("./DecodeStream"));
|
||||
var AsciiHexStream = /** @class */ (function (_super) {
|
||||
tslib_1.__extends(AsciiHexStream, _super);
|
||||
function AsciiHexStream(stream, maybeLength) {
|
||||
var _this = _super.call(this, maybeLength) || this;
|
||||
_this.stream = stream;
|
||||
_this.firstDigit = -1;
|
||||
// Most streams increase in size when decoded, but AsciiHex streams shrink
|
||||
// by 50%.
|
||||
if (maybeLength) {
|
||||
maybeLength = 0.5 * maybeLength;
|
||||
}
|
||||
return _this;
|
||||
}
|
||||
AsciiHexStream.prototype.readBlock = function () {
|
||||
var UPSTREAM_BLOCK_SIZE = 8000;
|
||||
var bytes = this.stream.getBytes(UPSTREAM_BLOCK_SIZE);
|
||||
if (!bytes.length) {
|
||||
this.eof = true;
|
||||
return;
|
||||
}
|
||||
var maxDecodeLength = (bytes.length + 1) >> 1;
|
||||
var buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
|
||||
var bufferLength = this.bufferLength;
|
||||
var firstDigit = this.firstDigit;
|
||||
for (var i = 0, ii = bytes.length; i < ii; i++) {
|
||||
var ch = bytes[i];
|
||||
var digit = void 0;
|
||||
if (ch >= 0x30 && ch <= 0x39) {
|
||||
// '0'-'9'
|
||||
digit = ch & 0x0f;
|
||||
}
|
||||
else if ((ch >= 0x41 && ch <= 0x46) || (ch >= 0x61 && ch <= 0x66)) {
|
||||
// 'A'-'Z', 'a'-'z'
|
||||
digit = (ch & 0x0f) + 9;
|
||||
}
|
||||
else if (ch === 0x3e) {
|
||||
// '>'
|
||||
this.eof = true;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
// probably whitespace
|
||||
continue; // ignoring
|
||||
}
|
||||
if (firstDigit < 0) {
|
||||
firstDigit = digit;
|
||||
}
|
||||
else {
|
||||
buffer[bufferLength++] = (firstDigit << 4) | digit;
|
||||
firstDigit = -1;
|
||||
}
|
||||
}
|
||||
if (firstDigit >= 0 && this.eof) {
|
||||
// incomplete byte
|
||||
buffer[bufferLength++] = firstDigit << 4;
|
||||
firstDigit = -1;
|
||||
}
|
||||
this.firstDigit = firstDigit;
|
||||
this.bufferLength = bufferLength;
|
||||
};
|
||||
return AsciiHexStream;
|
||||
}(DecodeStream_1.default));
|
||||
exports.default = AsciiHexStream;
|
||||
//# sourceMappingURL=AsciiHexStream.js.map
|
||||
1
node_modules/pdf-lib/cjs/core/streams/AsciiHexStream.js.map
generated
vendored
Normal file
1
node_modules/pdf-lib/cjs/core/streams/AsciiHexStream.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
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,IAAI,CAAC;aACnB;iBAAM,IAAI,CAAC,EAAE,IAAI,IAAI,IAAI,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,IAAI,IAAI,EAAE,IAAI,IAAI,CAAC,EAAE;gBACnE,mBAAmB;gBACnB,KAAK,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;aACzB;iBAAM,IAAI,EAAE,KAAK,IAAI,EAAE;gBACtB,MAAM;gBACN,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;gBAChB,MAAM;aACP;iBAAM;gBACL,sBAAsB;gBACtB,SAAS,CAAC,WAAW;aACtB;YACD,IAAI,UAAU,GAAG,CAAC,EAAE;gBAClB,UAAU,GAAG,KAAK,CAAC;aACpB;iBAAM;gBACL,MAAM,CAAC,YAAY,EAAE,CAAC,GAAG,CAAC,UAAU,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC;gBACnD,UAAU,GAAG,CAAC,CAAC,CAAC;aACjB;SACF;QACD,IAAI,UAAU,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG,EAAE;YAC/B,kBAAkB;YAClB,MAAM,CAAC,YAAY,EAAE,CAAC,GAAG,UAAU,IAAI,CAAC,CAAC;YACzC,UAAU,GAAG,CAAC,CAAC,CAAC;SACjB;QACD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IACH,qBAAC;AAAD,CAAC,AA/DD,CAA6B,sBAAY,GA+DxC;AAED,kBAAe,cAAc,CAAC"}
|
||||
27
node_modules/pdf-lib/cjs/core/streams/DecodeStream.d.ts
generated
vendored
Normal file
27
node_modules/pdf-lib/cjs/core/streams/DecodeStream.d.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import Stream, { StreamType } from "./Stream";
|
||||
/**
|
||||
* Super class for the decoding streams
|
||||
*/
|
||||
declare class DecodeStream implements StreamType {
|
||||
protected bufferLength: number;
|
||||
protected buffer: Uint8Array;
|
||||
protected eof: boolean;
|
||||
private pos;
|
||||
private minBufferLength;
|
||||
constructor(maybeMinBufferLength?: number);
|
||||
get isEmpty(): boolean;
|
||||
getByte(): number;
|
||||
getUint16(): number;
|
||||
getInt32(): number;
|
||||
getBytes(length: number, forceClamped?: boolean): Uint8Array | Uint8ClampedArray;
|
||||
peekByte(): number;
|
||||
peekBytes(length: number, forceClamped?: boolean): Uint8Array | Uint8ClampedArray;
|
||||
skip(n: number): void;
|
||||
reset(): void;
|
||||
makeSubStream(start: number, length: number): Stream;
|
||||
decode(): Uint8Array;
|
||||
protected readBlock(): void;
|
||||
protected ensureBuffer(requested: number): Uint8Array;
|
||||
}
|
||||
export default DecodeStream;
|
||||
//# sourceMappingURL=DecodeStream.d.ts.map
|
||||
1
node_modules/pdf-lib/cjs/core/streams/DecodeStream.d.ts.map
generated
vendored
Normal file
1
node_modules/pdf-lib/cjs/core/streams/DecodeStream.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"DecodeStream.d.ts","sourceRoot":"","sources":["../../../src/core/streams/DecodeStream.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,EAAE,EAAE,UAAU,EAAE,iBAAgC;AAgB7D;;GAEG;AACH,cAAM,YAAa,YAAW,UAAU;IACtC,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC;IAC/B,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC;IAC7B,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC;IAEvB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,eAAe,CAAS;gBAEpB,oBAAoB,CAAC,EAAE,MAAM;IAczC,IAAI,OAAO,YAKV;IAED,OAAO;IAWP,SAAS;IAST,QAAQ;IAQR,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,UAAQ;IA8B7C,QAAQ;IAMR,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,UAAQ;IAM9C,IAAI,CAAC,CAAC,EAAE,MAAM;IAOd,KAAK;IAIL,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAQ3C,MAAM,IAAI,UAAU;IAKpB,SAAS,CAAC,SAAS,IAAI,IAAI;IAI3B,SAAS,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM;CAoBzC;AAED,eAAe,YAAY,CAAC"}
|
||||
149
node_modules/pdf-lib/cjs/core/streams/DecodeStream.js
generated
vendored
Normal file
149
node_modules/pdf-lib/cjs/core/streams/DecodeStream.js
generated
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var errors_1 = require("../errors");
|
||||
var Stream_1 = tslib_1.__importDefault(require("./Stream"));
|
||||
/*
|
||||
* Copyright 2012 Mozilla Foundation
|
||||
*
|
||||
* The DecodeStream class contained in this file is a TypeScript port of the
|
||||
* JavaScript DecodeStream class in Mozilla's pdf.js project, made available
|
||||
* under the Apache 2.0 open source license.
|
||||
*/
|
||||
// Lots of DecodeStreams are created whose buffers are never used. For these
|
||||
// we share a single empty buffer. This is (a) space-efficient and (b) avoids
|
||||
// having special cases that would be required if we used |null| for an empty
|
||||
// buffer.
|
||||
var emptyBuffer = new Uint8Array(0);
|
||||
/**
|
||||
* Super class for the decoding streams
|
||||
*/
|
||||
var DecodeStream = /** @class */ (function () {
|
||||
function DecodeStream(maybeMinBufferLength) {
|
||||
this.pos = 0;
|
||||
this.bufferLength = 0;
|
||||
this.eof = false;
|
||||
this.buffer = emptyBuffer;
|
||||
this.minBufferLength = 512;
|
||||
if (maybeMinBufferLength) {
|
||||
// Compute the first power of two that is as big as maybeMinBufferLength.
|
||||
while (this.minBufferLength < maybeMinBufferLength) {
|
||||
this.minBufferLength *= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
Object.defineProperty(DecodeStream.prototype, "isEmpty", {
|
||||
get: function () {
|
||||
while (!this.eof && this.bufferLength === 0) {
|
||||
this.readBlock();
|
||||
}
|
||||
return this.bufferLength === 0;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
DecodeStream.prototype.getByte = function () {
|
||||
var pos = this.pos;
|
||||
while (this.bufferLength <= pos) {
|
||||
if (this.eof) {
|
||||
return -1;
|
||||
}
|
||||
this.readBlock();
|
||||
}
|
||||
return this.buffer[this.pos++];
|
||||
};
|
||||
DecodeStream.prototype.getUint16 = function () {
|
||||
var b0 = this.getByte();
|
||||
var b1 = this.getByte();
|
||||
if (b0 === -1 || b1 === -1) {
|
||||
return -1;
|
||||
}
|
||||
return (b0 << 8) + b1;
|
||||
};
|
||||
DecodeStream.prototype.getInt32 = function () {
|
||||
var b0 = this.getByte();
|
||||
var b1 = this.getByte();
|
||||
var b2 = this.getByte();
|
||||
var b3 = this.getByte();
|
||||
return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
|
||||
};
|
||||
DecodeStream.prototype.getBytes = function (length, forceClamped) {
|
||||
if (forceClamped === void 0) { forceClamped = false; }
|
||||
var end;
|
||||
var pos = this.pos;
|
||||
if (length) {
|
||||
this.ensureBuffer(pos + length);
|
||||
end = pos + length;
|
||||
while (!this.eof && this.bufferLength < end) {
|
||||
this.readBlock();
|
||||
}
|
||||
var bufEnd = this.bufferLength;
|
||||
if (end > bufEnd) {
|
||||
end = bufEnd;
|
||||
}
|
||||
}
|
||||
else {
|
||||
while (!this.eof) {
|
||||
this.readBlock();
|
||||
}
|
||||
end = this.bufferLength;
|
||||
}
|
||||
this.pos = end;
|
||||
var subarray = this.buffer.subarray(pos, end);
|
||||
// `this.buffer` is either a `Uint8Array` or `Uint8ClampedArray` here.
|
||||
return forceClamped && !(subarray instanceof Uint8ClampedArray)
|
||||
? new Uint8ClampedArray(subarray)
|
||||
: subarray;
|
||||
};
|
||||
DecodeStream.prototype.peekByte = function () {
|
||||
var peekedByte = this.getByte();
|
||||
this.pos--;
|
||||
return peekedByte;
|
||||
};
|
||||
DecodeStream.prototype.peekBytes = function (length, forceClamped) {
|
||||
if (forceClamped === void 0) { forceClamped = false; }
|
||||
var bytes = this.getBytes(length, forceClamped);
|
||||
this.pos -= bytes.length;
|
||||
return bytes;
|
||||
};
|
||||
DecodeStream.prototype.skip = function (n) {
|
||||
if (!n) {
|
||||
n = 1;
|
||||
}
|
||||
this.pos += n;
|
||||
};
|
||||
DecodeStream.prototype.reset = function () {
|
||||
this.pos = 0;
|
||||
};
|
||||
DecodeStream.prototype.makeSubStream = function (start, length /* dict */) {
|
||||
var end = start + length;
|
||||
while (this.bufferLength <= end && !this.eof) {
|
||||
this.readBlock();
|
||||
}
|
||||
return new Stream_1.default(this.buffer, start, length /* dict */);
|
||||
};
|
||||
DecodeStream.prototype.decode = function () {
|
||||
while (!this.eof)
|
||||
this.readBlock();
|
||||
return this.buffer.subarray(0, this.bufferLength);
|
||||
};
|
||||
DecodeStream.prototype.readBlock = function () {
|
||||
throw new errors_1.MethodNotImplementedError(this.constructor.name, 'readBlock');
|
||||
};
|
||||
DecodeStream.prototype.ensureBuffer = function (requested) {
|
||||
var buffer = this.buffer;
|
||||
if (requested <= buffer.byteLength) {
|
||||
return buffer;
|
||||
}
|
||||
var size = this.minBufferLength;
|
||||
while (size < requested) {
|
||||
size *= 2;
|
||||
}
|
||||
var buffer2 = new Uint8Array(size);
|
||||
buffer2.set(buffer);
|
||||
return (this.buffer = buffer2);
|
||||
};
|
||||
return DecodeStream;
|
||||
}());
|
||||
exports.default = DecodeStream;
|
||||
//# sourceMappingURL=DecodeStream.js.map
|
||||
1
node_modules/pdf-lib/cjs/core/streams/DecodeStream.js.map
generated
vendored
Normal file
1
node_modules/pdf-lib/cjs/core/streams/DecodeStream.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"DecodeStream.js","sourceRoot":"","sources":["../../../src/core/streams/DecodeStream.ts"],"names":[],"mappings":";;;AAAA,oCAA4D;AAC5D,4DAA6D;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AI,CAAC,GAAG;YAAE,IAAI,CAAC,SAAS,EAAE,CAAC;QACnC,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IACpD,CAAC;IAES,gCAAS,GAAnB;QACE,MAAM,IAAI,kCAAyB,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAC1E,CAAC;IAES,mCAAY,GAAtB,UAAuB,SAAiB;QACtC,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,IAAI,SAAS,IAAI,MAAM,CAAC,UAAU,EAAE;YAClC,OAAO,MAAM,CAAC;SACf;QACD,IAAI,IAAI,GAAG,IAAI,CAAC,eAAe,CAAC;QAChC,OAAO,IAAI,GAAG,SAAS,EAAE;YACvB,IAAI,IAAI,CAAC,CAAC;SACX;QACD,IAAM,OAAO,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;QACrC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC;IACjC,CAAC;IAQH,mBAAC;AAAD,CAAC,AAnJD,IAmJC;AAED,kBAAe,YAAY,CAAC"}
|
||||
14
node_modules/pdf-lib/cjs/core/streams/FlateStream.d.ts
generated
vendored
Normal file
14
node_modules/pdf-lib/cjs/core/streams/FlateStream.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import DecodeStream from "./DecodeStream";
|
||||
import { StreamType } from "./Stream";
|
||||
declare class FlateStream extends DecodeStream {
|
||||
private stream;
|
||||
private codeSize;
|
||||
private codeBuf;
|
||||
constructor(stream: StreamType, maybeLength?: number);
|
||||
protected readBlock(): void;
|
||||
private getBits;
|
||||
private getCode;
|
||||
private generateHuffmanTable;
|
||||
}
|
||||
export default FlateStream;
|
||||
//# sourceMappingURL=FlateStream.d.ts.map
|
||||
1
node_modules/pdf-lib/cjs/core/streams/FlateStream.d.ts.map
generated
vendored
Normal file
1
node_modules/pdf-lib/cjs/core/streams/FlateStream.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"FlateStream.d.ts","sourceRoot":"","sources":["../../../src/core/streams/FlateStream.ts"],"names":[],"mappings":"AAiBA,OAAO,YAAY,uBAAsC;AACzD,OAAO,EAAE,UAAU,EAAE,iBAAgC;AAmGrD,cAAM,WAAY,SAAQ,YAAY;IACpC,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,OAAO,CAAS;gBAEZ,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,EAAE,MAAM;IA0BpD,SAAS,CAAC,SAAS;IAoKnB,OAAO,CAAC,OAAO;IAoBf,OAAO,CAAC,OAAO;IA+Bf,OAAO,CAAC,oBAAoB;CAyC7B;AAED,eAAe,WAAW,CAAC"}
|
||||
371
node_modules/pdf-lib/cjs/core/streams/FlateStream.js
generated
vendored
Normal file
371
node_modules/pdf-lib/cjs/core/streams/FlateStream.js
generated
vendored
Normal file
@@ -0,0 +1,371 @@
|
||||
"use strict";
|
||||
/*
|
||||
* Copyright 1996-2003 Glyph & Cog, LLC
|
||||
*
|
||||
* The flate stream implementation contained in this file is a JavaScript port
|
||||
* of XPDF's implementation, made available under the Apache 2.0 open source
|
||||
* license.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
/*
|
||||
* Copyright 2012 Mozilla Foundation
|
||||
*
|
||||
* The FlateStream class contained in this file is a TypeScript port of the
|
||||
* JavaScript FlateStream class in Mozilla's pdf.js project, made available
|
||||
* under the Apache 2.0 open source license.
|
||||
*/
|
||||
/* tslint:disable no-conditional-assignment */
|
||||
var DecodeStream_1 = tslib_1.__importDefault(require("./DecodeStream"));
|
||||
// prettier-ignore
|
||||
var codeLenCodeMap = new Int32Array([
|
||||
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15
|
||||
]);
|
||||
// prettier-ignore
|
||||
var lengthDecode = new Int32Array([
|
||||
0x00003, 0x00004, 0x00005, 0x00006, 0x00007, 0x00008, 0x00009, 0x0000a,
|
||||
0x1000b, 0x1000d, 0x1000f, 0x10011, 0x20013, 0x20017, 0x2001b, 0x2001f,
|
||||
0x30023, 0x3002b, 0x30033, 0x3003b, 0x40043, 0x40053, 0x40063, 0x40073,
|
||||
0x50083, 0x500a3, 0x500c3, 0x500e3, 0x00102, 0x00102, 0x00102
|
||||
]);
|
||||
// prettier-ignore
|
||||
var distDecode = new Int32Array([
|
||||
0x00001, 0x00002, 0x00003, 0x00004, 0x10005, 0x10007, 0x20009, 0x2000d,
|
||||
0x30011, 0x30019, 0x40021, 0x40031, 0x50041, 0x50061, 0x60081, 0x600c1,
|
||||
0x70101, 0x70181, 0x80201, 0x80301, 0x90401, 0x90601, 0xa0801, 0xa0c01,
|
||||
0xb1001, 0xb1801, 0xc2001, 0xc3001, 0xd4001, 0xd6001
|
||||
]);
|
||||
// prettier-ignore
|
||||
var fixedLitCodeTab = [new Int32Array([
|
||||
0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c0,
|
||||
0x70108, 0x80060, 0x80020, 0x900a0, 0x80000, 0x80080, 0x80040, 0x900e0,
|
||||
0x70104, 0x80058, 0x80018, 0x90090, 0x70114, 0x80078, 0x80038, 0x900d0,
|
||||
0x7010c, 0x80068, 0x80028, 0x900b0, 0x80008, 0x80088, 0x80048, 0x900f0,
|
||||
0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c8,
|
||||
0x7010a, 0x80064, 0x80024, 0x900a8, 0x80004, 0x80084, 0x80044, 0x900e8,
|
||||
0x70106, 0x8005c, 0x8001c, 0x90098, 0x70116, 0x8007c, 0x8003c, 0x900d8,
|
||||
0x7010e, 0x8006c, 0x8002c, 0x900b8, 0x8000c, 0x8008c, 0x8004c, 0x900f8,
|
||||
0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c4,
|
||||
0x70109, 0x80062, 0x80022, 0x900a4, 0x80002, 0x80082, 0x80042, 0x900e4,
|
||||
0x70105, 0x8005a, 0x8001a, 0x90094, 0x70115, 0x8007a, 0x8003a, 0x900d4,
|
||||
0x7010d, 0x8006a, 0x8002a, 0x900b4, 0x8000a, 0x8008a, 0x8004a, 0x900f4,
|
||||
0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cc,
|
||||
0x7010b, 0x80066, 0x80026, 0x900ac, 0x80006, 0x80086, 0x80046, 0x900ec,
|
||||
0x70107, 0x8005e, 0x8001e, 0x9009c, 0x70117, 0x8007e, 0x8003e, 0x900dc,
|
||||
0x7010f, 0x8006e, 0x8002e, 0x900bc, 0x8000e, 0x8008e, 0x8004e, 0x900fc,
|
||||
0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c2,
|
||||
0x70108, 0x80061, 0x80021, 0x900a2, 0x80001, 0x80081, 0x80041, 0x900e2,
|
||||
0x70104, 0x80059, 0x80019, 0x90092, 0x70114, 0x80079, 0x80039, 0x900d2,
|
||||
0x7010c, 0x80069, 0x80029, 0x900b2, 0x80009, 0x80089, 0x80049, 0x900f2,
|
||||
0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900ca,
|
||||
0x7010a, 0x80065, 0x80025, 0x900aa, 0x80005, 0x80085, 0x80045, 0x900ea,
|
||||
0x70106, 0x8005d, 0x8001d, 0x9009a, 0x70116, 0x8007d, 0x8003d, 0x900da,
|
||||
0x7010e, 0x8006d, 0x8002d, 0x900ba, 0x8000d, 0x8008d, 0x8004d, 0x900fa,
|
||||
0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c6,
|
||||
0x70109, 0x80063, 0x80023, 0x900a6, 0x80003, 0x80083, 0x80043, 0x900e6,
|
||||
0x70105, 0x8005b, 0x8001b, 0x90096, 0x70115, 0x8007b, 0x8003b, 0x900d6,
|
||||
0x7010d, 0x8006b, 0x8002b, 0x900b6, 0x8000b, 0x8008b, 0x8004b, 0x900f6,
|
||||
0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900ce,
|
||||
0x7010b, 0x80067, 0x80027, 0x900ae, 0x80007, 0x80087, 0x80047, 0x900ee,
|
||||
0x70107, 0x8005f, 0x8001f, 0x9009e, 0x70117, 0x8007f, 0x8003f, 0x900de,
|
||||
0x7010f, 0x8006f, 0x8002f, 0x900be, 0x8000f, 0x8008f, 0x8004f, 0x900fe,
|
||||
0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c1,
|
||||
0x70108, 0x80060, 0x80020, 0x900a1, 0x80000, 0x80080, 0x80040, 0x900e1,
|
||||
0x70104, 0x80058, 0x80018, 0x90091, 0x70114, 0x80078, 0x80038, 0x900d1,
|
||||
0x7010c, 0x80068, 0x80028, 0x900b1, 0x80008, 0x80088, 0x80048, 0x900f1,
|
||||
0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c9,
|
||||
0x7010a, 0x80064, 0x80024, 0x900a9, 0x80004, 0x80084, 0x80044, 0x900e9,
|
||||
0x70106, 0x8005c, 0x8001c, 0x90099, 0x70116, 0x8007c, 0x8003c, 0x900d9,
|
||||
0x7010e, 0x8006c, 0x8002c, 0x900b9, 0x8000c, 0x8008c, 0x8004c, 0x900f9,
|
||||
0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c5,
|
||||
0x70109, 0x80062, 0x80022, 0x900a5, 0x80002, 0x80082, 0x80042, 0x900e5,
|
||||
0x70105, 0x8005a, 0x8001a, 0x90095, 0x70115, 0x8007a, 0x8003a, 0x900d5,
|
||||
0x7010d, 0x8006a, 0x8002a, 0x900b5, 0x8000a, 0x8008a, 0x8004a, 0x900f5,
|
||||
0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cd,
|
||||
0x7010b, 0x80066, 0x80026, 0x900ad, 0x80006, 0x80086, 0x80046, 0x900ed,
|
||||
0x70107, 0x8005e, 0x8001e, 0x9009d, 0x70117, 0x8007e, 0x8003e, 0x900dd,
|
||||
0x7010f, 0x8006e, 0x8002e, 0x900bd, 0x8000e, 0x8008e, 0x8004e, 0x900fd,
|
||||
0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c3,
|
||||
0x70108, 0x80061, 0x80021, 0x900a3, 0x80001, 0x80081, 0x80041, 0x900e3,
|
||||
0x70104, 0x80059, 0x80019, 0x90093, 0x70114, 0x80079, 0x80039, 0x900d3,
|
||||
0x7010c, 0x80069, 0x80029, 0x900b3, 0x80009, 0x80089, 0x80049, 0x900f3,
|
||||
0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900cb,
|
||||
0x7010a, 0x80065, 0x80025, 0x900ab, 0x80005, 0x80085, 0x80045, 0x900eb,
|
||||
0x70106, 0x8005d, 0x8001d, 0x9009b, 0x70116, 0x8007d, 0x8003d, 0x900db,
|
||||
0x7010e, 0x8006d, 0x8002d, 0x900bb, 0x8000d, 0x8008d, 0x8004d, 0x900fb,
|
||||
0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c7,
|
||||
0x70109, 0x80063, 0x80023, 0x900a7, 0x80003, 0x80083, 0x80043, 0x900e7,
|
||||
0x70105, 0x8005b, 0x8001b, 0x90097, 0x70115, 0x8007b, 0x8003b, 0x900d7,
|
||||
0x7010d, 0x8006b, 0x8002b, 0x900b7, 0x8000b, 0x8008b, 0x8004b, 0x900f7,
|
||||
0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900cf,
|
||||
0x7010b, 0x80067, 0x80027, 0x900af, 0x80007, 0x80087, 0x80047, 0x900ef,
|
||||
0x70107, 0x8005f, 0x8001f, 0x9009f, 0x70117, 0x8007f, 0x8003f, 0x900df,
|
||||
0x7010f, 0x8006f, 0x8002f, 0x900bf, 0x8000f, 0x8008f, 0x8004f, 0x900ff
|
||||
]), 9];
|
||||
// prettier-ignore
|
||||
var fixedDistCodeTab = [new Int32Array([
|
||||
0x50000, 0x50010, 0x50008, 0x50018, 0x50004, 0x50014, 0x5000c, 0x5001c,
|
||||
0x50002, 0x50012, 0x5000a, 0x5001a, 0x50006, 0x50016, 0x5000e, 0x00000,
|
||||
0x50001, 0x50011, 0x50009, 0x50019, 0x50005, 0x50015, 0x5000d, 0x5001d,
|
||||
0x50003, 0x50013, 0x5000b, 0x5001b, 0x50007, 0x50017, 0x5000f, 0x00000
|
||||
]), 5];
|
||||
var FlateStream = /** @class */ (function (_super) {
|
||||
tslib_1.__extends(FlateStream, _super);
|
||||
function FlateStream(stream, maybeLength) {
|
||||
var _this = _super.call(this, maybeLength) || this;
|
||||
_this.stream = stream;
|
||||
var cmf = stream.getByte();
|
||||
var flg = stream.getByte();
|
||||
if (cmf === -1 || flg === -1) {
|
||||
throw new Error("Invalid header in flate stream: " + cmf + ", " + flg);
|
||||
}
|
||||
if ((cmf & 0x0f) !== 0x08) {
|
||||
throw new Error("Unknown compression method in flate stream: " + cmf + ", " + flg);
|
||||
}
|
||||
if (((cmf << 8) + flg) % 31 !== 0) {
|
||||
throw new Error("Bad FCHECK in flate stream: " + cmf + ", " + flg);
|
||||
}
|
||||
if (flg & 0x20) {
|
||||
throw new Error("FDICT bit set in flate stream: " + cmf + ", " + flg);
|
||||
}
|
||||
_this.codeSize = 0;
|
||||
_this.codeBuf = 0;
|
||||
return _this;
|
||||
}
|
||||
FlateStream.prototype.readBlock = function () {
|
||||
var buffer;
|
||||
var len;
|
||||
var str = this.stream;
|
||||
// read block header
|
||||
var hdr = this.getBits(3);
|
||||
if (hdr & 1) {
|
||||
this.eof = true;
|
||||
}
|
||||
hdr >>= 1;
|
||||
if (hdr === 0) {
|
||||
// uncompressed block
|
||||
var b = void 0;
|
||||
if ((b = str.getByte()) === -1) {
|
||||
throw new Error('Bad block header in flate stream');
|
||||
}
|
||||
var blockLen = b;
|
||||
if ((b = str.getByte()) === -1) {
|
||||
throw new Error('Bad block header in flate stream');
|
||||
}
|
||||
blockLen |= b << 8;
|
||||
if ((b = str.getByte()) === -1) {
|
||||
throw new Error('Bad block header in flate stream');
|
||||
}
|
||||
var check = b;
|
||||
if ((b = str.getByte()) === -1) {
|
||||
throw new Error('Bad block header in flate stream');
|
||||
}
|
||||
check |= b << 8;
|
||||
if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
|
||||
// Ignoring error for bad "empty" block (see issue 1277)
|
||||
throw new Error('Bad uncompressed block length in flate stream');
|
||||
}
|
||||
this.codeBuf = 0;
|
||||
this.codeSize = 0;
|
||||
var bufferLength = this.bufferLength;
|
||||
buffer = this.ensureBuffer(bufferLength + blockLen);
|
||||
var end = bufferLength + blockLen;
|
||||
this.bufferLength = end;
|
||||
if (blockLen === 0) {
|
||||
if (str.peekByte() === -1) {
|
||||
this.eof = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var n = bufferLength; n < end; ++n) {
|
||||
if ((b = str.getByte()) === -1) {
|
||||
this.eof = true;
|
||||
break;
|
||||
}
|
||||
buffer[n] = b;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
var litCodeTable;
|
||||
var distCodeTable;
|
||||
if (hdr === 1) {
|
||||
// compressed block, fixed codes
|
||||
litCodeTable = fixedLitCodeTab;
|
||||
distCodeTable = fixedDistCodeTab;
|
||||
}
|
||||
else if (hdr === 2) {
|
||||
// compressed block, dynamic codes
|
||||
var numLitCodes = this.getBits(5) + 257;
|
||||
var numDistCodes = this.getBits(5) + 1;
|
||||
var numCodeLenCodes = this.getBits(4) + 4;
|
||||
// build the code lengths code table
|
||||
var codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
|
||||
var i = void 0;
|
||||
for (i = 0; i < numCodeLenCodes; ++i) {
|
||||
codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
|
||||
}
|
||||
var codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
|
||||
// build the literal and distance code tables
|
||||
len = 0;
|
||||
i = 0;
|
||||
var codes = numLitCodes + numDistCodes;
|
||||
var codeLengths = new Uint8Array(codes);
|
||||
var bitsLength = void 0;
|
||||
var bitsOffset = void 0;
|
||||
var what = void 0;
|
||||
while (i < codes) {
|
||||
var code = this.getCode(codeLenCodeTab);
|
||||
if (code === 16) {
|
||||
bitsLength = 2;
|
||||
bitsOffset = 3;
|
||||
what = len;
|
||||
}
|
||||
else if (code === 17) {
|
||||
bitsLength = 3;
|
||||
bitsOffset = 3;
|
||||
what = len = 0;
|
||||
}
|
||||
else if (code === 18) {
|
||||
bitsLength = 7;
|
||||
bitsOffset = 11;
|
||||
what = len = 0;
|
||||
}
|
||||
else {
|
||||
codeLengths[i++] = len = code;
|
||||
continue;
|
||||
}
|
||||
var repeatLength = this.getBits(bitsLength) + bitsOffset;
|
||||
while (repeatLength-- > 0) {
|
||||
codeLengths[i++] = what;
|
||||
}
|
||||
}
|
||||
litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
|
||||
distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
|
||||
}
|
||||
else {
|
||||
throw new Error('Unknown block type in flate stream');
|
||||
}
|
||||
buffer = this.buffer;
|
||||
var limit = buffer ? buffer.length : 0;
|
||||
var pos = this.bufferLength;
|
||||
while (true) {
|
||||
var code1 = this.getCode(litCodeTable);
|
||||
if (code1 < 256) {
|
||||
if (pos + 1 >= limit) {
|
||||
buffer = this.ensureBuffer(pos + 1);
|
||||
limit = buffer.length;
|
||||
}
|
||||
buffer[pos++] = code1;
|
||||
continue;
|
||||
}
|
||||
if (code1 === 256) {
|
||||
this.bufferLength = pos;
|
||||
return;
|
||||
}
|
||||
code1 -= 257;
|
||||
code1 = lengthDecode[code1];
|
||||
var code2 = code1 >> 16;
|
||||
if (code2 > 0) {
|
||||
code2 = this.getBits(code2);
|
||||
}
|
||||
len = (code1 & 0xffff) + code2;
|
||||
code1 = this.getCode(distCodeTable);
|
||||
code1 = distDecode[code1];
|
||||
code2 = code1 >> 16;
|
||||
if (code2 > 0) {
|
||||
code2 = this.getBits(code2);
|
||||
}
|
||||
var dist = (code1 & 0xffff) + code2;
|
||||
if (pos + len >= limit) {
|
||||
buffer = this.ensureBuffer(pos + len);
|
||||
limit = buffer.length;
|
||||
}
|
||||
for (var k = 0; k < len; ++k, ++pos) {
|
||||
buffer[pos] = buffer[pos - dist];
|
||||
}
|
||||
}
|
||||
};
|
||||
FlateStream.prototype.getBits = function (bits) {
|
||||
var str = this.stream;
|
||||
var codeSize = this.codeSize;
|
||||
var codeBuf = this.codeBuf;
|
||||
var b;
|
||||
while (codeSize < bits) {
|
||||
if ((b = str.getByte()) === -1) {
|
||||
throw new Error('Bad encoding in flate stream');
|
||||
}
|
||||
codeBuf |= b << codeSize;
|
||||
codeSize += 8;
|
||||
}
|
||||
b = codeBuf & ((1 << bits) - 1);
|
||||
this.codeBuf = codeBuf >> bits;
|
||||
this.codeSize = codeSize -= bits;
|
||||
return b;
|
||||
};
|
||||
FlateStream.prototype.getCode = function (table) {
|
||||
var str = this.stream;
|
||||
var codes = table[0];
|
||||
var maxLen = table[1];
|
||||
var codeSize = this.codeSize;
|
||||
var codeBuf = this.codeBuf;
|
||||
var b;
|
||||
while (codeSize < maxLen) {
|
||||
if ((b = str.getByte()) === -1) {
|
||||
// premature end of stream. code might however still be valid.
|
||||
// codeSize < codeLen check below guards against incomplete codeVal.
|
||||
break;
|
||||
}
|
||||
codeBuf |= b << codeSize;
|
||||
codeSize += 8;
|
||||
}
|
||||
var code = codes[codeBuf & ((1 << maxLen) - 1)];
|
||||
if (typeof codes === 'number') {
|
||||
console.log('FLATE:', code);
|
||||
}
|
||||
var codeLen = code >> 16;
|
||||
var codeVal = code & 0xffff;
|
||||
if (codeLen < 1 || codeSize < codeLen) {
|
||||
throw new Error('Bad encoding in flate stream');
|
||||
}
|
||||
this.codeBuf = codeBuf >> codeLen;
|
||||
this.codeSize = codeSize - codeLen;
|
||||
return codeVal;
|
||||
};
|
||||
FlateStream.prototype.generateHuffmanTable = function (lengths) {
|
||||
var n = lengths.length;
|
||||
// find max code length
|
||||
var maxLen = 0;
|
||||
var i;
|
||||
for (i = 0; i < n; ++i) {
|
||||
if (lengths[i] > maxLen) {
|
||||
maxLen = lengths[i];
|
||||
}
|
||||
}
|
||||
// build the table
|
||||
var size = 1 << maxLen;
|
||||
var codes = new Int32Array(size);
|
||||
for (var len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
|
||||
for (var val = 0; val < n; ++val) {
|
||||
if (lengths[val] === len) {
|
||||
// bit-reverse the code
|
||||
var code2 = 0;
|
||||
var t = code;
|
||||
for (i = 0; i < len; ++i) {
|
||||
code2 = (code2 << 1) | (t & 1);
|
||||
t >>= 1;
|
||||
}
|
||||
// fill the table entries
|
||||
for (i = code2; i < size; i += skip) {
|
||||
codes[i] = (len << 16) | val;
|
||||
}
|
||||
++code;
|
||||
}
|
||||
}
|
||||
}
|
||||
return [codes, maxLen];
|
||||
};
|
||||
return FlateStream;
|
||||
}(DecodeStream_1.default));
|
||||
exports.default = FlateStream;
|
||||
//# sourceMappingURL=FlateStream.js.map
|
||||
1
node_modules/pdf-lib/cjs/core/streams/FlateStream.js.map
generated
vendored
Normal file
1
node_modules/pdf-lib/cjs/core/streams/FlateStream.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
13
node_modules/pdf-lib/cjs/core/streams/LZWStream.d.ts
generated
vendored
Normal file
13
node_modules/pdf-lib/cjs/core/streams/LZWStream.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import DecodeStream from "./DecodeStream";
|
||||
import { StreamType } from "./Stream";
|
||||
declare class LZWStream extends DecodeStream {
|
||||
private stream;
|
||||
private cachedData;
|
||||
private bitsCached;
|
||||
private lzwState;
|
||||
constructor(stream: StreamType, maybeLength: number | undefined, earlyChange: 0 | 1);
|
||||
protected readBlock(): void;
|
||||
private readBits;
|
||||
}
|
||||
export default LZWStream;
|
||||
//# sourceMappingURL=LZWStream.d.ts.map
|
||||
1
node_modules/pdf-lib/cjs/core/streams/LZWStream.d.ts.map
generated
vendored
Normal file
1
node_modules/pdf-lib/cjs/core/streams/LZWStream.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"LZWStream.d.ts","sourceRoot":"","sources":["../../../src/core/streams/LZWStream.ts"],"names":[],"mappings":"AAQA,OAAO,YAAY,uBAAsC;AACzD,OAAO,EAAE,UAAU,EAAE,iBAAgC;AAErD,cAAM,SAAU,SAAQ,YAAY;IAClC,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAUd;gBAGA,MAAM,EAAE,UAAU,EAClB,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,WAAW,EAAE,CAAC,GAAG,CAAC;IA0BpB,SAAS,CAAC,SAAS;IAyFnB,OAAO,CAAC,QAAQ;CAgBjB;AAED,eAAe,SAAS,CAAC"}
|
||||
137
node_modules/pdf-lib/cjs/core/streams/LZWStream.js
generated
vendored
Normal file
137
node_modules/pdf-lib/cjs/core/streams/LZWStream.js
generated
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
"use strict";
|
||||
/*
|
||||
* Copyright 2012 Mozilla Foundation
|
||||
*
|
||||
* The LZWStream class contained in this file is a TypeScript port of the
|
||||
* JavaScript LZWStream class in Mozilla's pdf.js project, made available
|
||||
* under the Apache 2.0 open source license.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var DecodeStream_1 = tslib_1.__importDefault(require("./DecodeStream"));
|
||||
var LZWStream = /** @class */ (function (_super) {
|
||||
tslib_1.__extends(LZWStream, _super);
|
||||
function LZWStream(stream, maybeLength, earlyChange) {
|
||||
var _this = _super.call(this, maybeLength) || this;
|
||||
_this.stream = stream;
|
||||
_this.cachedData = 0;
|
||||
_this.bitsCached = 0;
|
||||
var maxLzwDictionarySize = 4096;
|
||||
var lzwState = {
|
||||
earlyChange: earlyChange,
|
||||
codeLength: 9,
|
||||
nextCode: 258,
|
||||
dictionaryValues: new Uint8Array(maxLzwDictionarySize),
|
||||
dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
|
||||
dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
|
||||
currentSequence: new Uint8Array(maxLzwDictionarySize),
|
||||
currentSequenceLength: 0,
|
||||
};
|
||||
for (var i = 0; i < 256; ++i) {
|
||||
lzwState.dictionaryValues[i] = i;
|
||||
lzwState.dictionaryLengths[i] = 1;
|
||||
}
|
||||
_this.lzwState = lzwState;
|
||||
return _this;
|
||||
}
|
||||
LZWStream.prototype.readBlock = function () {
|
||||
var blockSize = 512;
|
||||
var estimatedDecodedSize = blockSize * 2;
|
||||
var decodedSizeDelta = blockSize;
|
||||
var i;
|
||||
var j;
|
||||
var q;
|
||||
var lzwState = this.lzwState;
|
||||
if (!lzwState) {
|
||||
return; // eof was found
|
||||
}
|
||||
var earlyChange = lzwState.earlyChange;
|
||||
var nextCode = lzwState.nextCode;
|
||||
var dictionaryValues = lzwState.dictionaryValues;
|
||||
var dictionaryLengths = lzwState.dictionaryLengths;
|
||||
var dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
|
||||
var codeLength = lzwState.codeLength;
|
||||
var prevCode = lzwState.prevCode;
|
||||
var currentSequence = lzwState.currentSequence;
|
||||
var currentSequenceLength = lzwState.currentSequenceLength;
|
||||
var decodedLength = 0;
|
||||
var currentBufferLength = this.bufferLength;
|
||||
var buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
|
||||
for (i = 0; i < blockSize; i++) {
|
||||
var code = this.readBits(codeLength);
|
||||
var hasPrev = currentSequenceLength > 0;
|
||||
if (!code || code < 256) {
|
||||
currentSequence[0] = code;
|
||||
currentSequenceLength = 1;
|
||||
}
|
||||
else if (code >= 258) {
|
||||
if (code < nextCode) {
|
||||
currentSequenceLength = dictionaryLengths[code];
|
||||
for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
|
||||
currentSequence[j] = dictionaryValues[q];
|
||||
q = dictionaryPrevCodes[q];
|
||||
}
|
||||
}
|
||||
else {
|
||||
currentSequence[currentSequenceLength++] = currentSequence[0];
|
||||
}
|
||||
}
|
||||
else if (code === 256) {
|
||||
codeLength = 9;
|
||||
nextCode = 258;
|
||||
currentSequenceLength = 0;
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
this.eof = true;
|
||||
delete this.lzwState;
|
||||
break;
|
||||
}
|
||||
if (hasPrev) {
|
||||
dictionaryPrevCodes[nextCode] = prevCode;
|
||||
dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
|
||||
dictionaryValues[nextCode] = currentSequence[0];
|
||||
nextCode++;
|
||||
codeLength =
|
||||
(nextCode + earlyChange) & (nextCode + earlyChange - 1)
|
||||
? codeLength
|
||||
: Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
|
||||
}
|
||||
prevCode = code;
|
||||
decodedLength += currentSequenceLength;
|
||||
if (estimatedDecodedSize < decodedLength) {
|
||||
do {
|
||||
estimatedDecodedSize += decodedSizeDelta;
|
||||
} while (estimatedDecodedSize < decodedLength);
|
||||
buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
|
||||
}
|
||||
for (j = 0; j < currentSequenceLength; j++) {
|
||||
buffer[currentBufferLength++] = currentSequence[j];
|
||||
}
|
||||
}
|
||||
lzwState.nextCode = nextCode;
|
||||
lzwState.codeLength = codeLength;
|
||||
lzwState.prevCode = prevCode;
|
||||
lzwState.currentSequenceLength = currentSequenceLength;
|
||||
this.bufferLength = currentBufferLength;
|
||||
};
|
||||
LZWStream.prototype.readBits = function (n) {
|
||||
var bitsCached = this.bitsCached;
|
||||
var cachedData = this.cachedData;
|
||||
while (bitsCached < n) {
|
||||
var c = this.stream.getByte();
|
||||
if (c === -1) {
|
||||
this.eof = true;
|
||||
return null;
|
||||
}
|
||||
cachedData = (cachedData << 8) | c;
|
||||
bitsCached += 8;
|
||||
}
|
||||
this.bitsCached = bitsCached -= n;
|
||||
this.cachedData = cachedData;
|
||||
return (cachedData >>> bitsCached) & ((1 << n) - 1);
|
||||
};
|
||||
return LZWStream;
|
||||
}(DecodeStream_1.default));
|
||||
exports.default = LZWStream;
|
||||
//# sourceMappingURL=LZWStream.js.map
|
||||
1
node_modules/pdf-lib/cjs/core/streams/LZWStream.js.map
generated
vendored
Normal file
1
node_modules/pdf-lib/cjs/core/streams/LZWStream.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"LZWStream.js","sourceRoot":"","sources":["../../../src/core/streams/LZWStream.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,wEAAyD;AAGzD;IAAwB,qCAAY;IAgBlC,mBACE,MAAkB,EAClB,WAA+B,EAC/B,WAAkB;QAHpB,YAKE,kBAAM,WAAW,CAAC,SAsBnB;QApBC,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,KAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QACpB,KAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QAEpB,IAAM,oBAAoB,GAAG,IAAI,CAAC;QAClC,IAAM,QAAQ,GAAG;YACf,WAAW,aAAA;YACX,UAAU,EAAE,CAAC;YACb,QAAQ,EAAE,GAAG;YACb,gBAAgB,EAAE,IAAI,UAAU,CAAC,oBAAoB,CAAC;YACtD,iBAAiB,EAAE,IAAI,WAAW,CAAC,oBAAoB,CAAC;YACxD,mBAAmB,EAAE,IAAI,WAAW,CAAC,oBAAoB,C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CAAS;QACxB,IAAI,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QACjC,IAAI,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QACjC,OAAO,UAAU,GAAG,CAAC,EAAE;YACrB,IAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YAChC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE;gBACZ,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;gBAChB,OAAO,IAAI,CAAC;aACb;YACD,UAAU,GAAG,CAAC,UAAU,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;YACnC,UAAU,IAAI,CAAC,CAAC;SACjB;QACD,IAAI,CAAC,UAAU,GAAG,UAAU,IAAI,CAAC,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,OAAO,CAAC,UAAU,KAAK,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACtD,CAAC;IACH,gBAAC;AAAD,CAAC,AAtJD,CAAwB,sBAAY,GAsJnC;AAED,kBAAe,SAAS,CAAC"}
|
||||
9
node_modules/pdf-lib/cjs/core/streams/RunLengthStream.d.ts
generated
vendored
Normal file
9
node_modules/pdf-lib/cjs/core/streams/RunLengthStream.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import DecodeStream from "./DecodeStream";
|
||||
import { StreamType } from "./Stream";
|
||||
declare class RunLengthStream extends DecodeStream {
|
||||
private stream;
|
||||
constructor(stream: StreamType, maybeLength?: number);
|
||||
protected readBlock(): void;
|
||||
}
|
||||
export default RunLengthStream;
|
||||
//# sourceMappingURL=RunLengthStream.d.ts.map
|
||||
1
node_modules/pdf-lib/cjs/core/streams/RunLengthStream.d.ts.map
generated
vendored
Normal file
1
node_modules/pdf-lib/cjs/core/streams/RunLengthStream.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"RunLengthStream.d.ts","sourceRoot":"","sources":["../../../src/core/streams/RunLengthStream.ts"],"names":[],"mappings":"AAQA,OAAO,YAAY,uBAAsC;AACzD,OAAO,EAAE,UAAU,EAAE,iBAAgC;AAErD,cAAM,eAAgB,SAAQ,YAAY;IACxC,OAAO,CAAC,MAAM,CAAa;gBAEf,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,EAAE,MAAM;IAKpD,SAAS,CAAC,SAAS;CAiCpB;AAED,eAAe,eAAe,CAAC"}
|
||||
55
node_modules/pdf-lib/cjs/core/streams/RunLengthStream.js
generated
vendored
Normal file
55
node_modules/pdf-lib/cjs/core/streams/RunLengthStream.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
"use strict";
|
||||
/*
|
||||
* Copyright 2012 Mozilla Foundation
|
||||
*
|
||||
* The RunLengthStream class contained in this file is a TypeScript port of the
|
||||
* JavaScript RunLengthStream class in Mozilla's pdf.js project, made available
|
||||
* under the Apache 2.0 open source license.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var tslib_1 = require("tslib");
|
||||
var DecodeStream_1 = tslib_1.__importDefault(require("./DecodeStream"));
|
||||
var RunLengthStream = /** @class */ (function (_super) {
|
||||
tslib_1.__extends(RunLengthStream, _super);
|
||||
function RunLengthStream(stream, maybeLength) {
|
||||
var _this = _super.call(this, maybeLength) || this;
|
||||
_this.stream = stream;
|
||||
return _this;
|
||||
}
|
||||
RunLengthStream.prototype.readBlock = function () {
|
||||
// The repeatHeader has following format. The first byte defines type of run
|
||||
// and amount of bytes to repeat/copy: n = 0 through 127 - copy next n bytes
|
||||
// (in addition to the second byte from the header), n = 129 through 255 -
|
||||
// duplicate the second byte from the header (257 - n) times, n = 128 - end.
|
||||
var repeatHeader = this.stream.getBytes(2);
|
||||
if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
|
||||
this.eof = true;
|
||||
return;
|
||||
}
|
||||
var buffer;
|
||||
var bufferLength = this.bufferLength;
|
||||
var n = repeatHeader[0];
|
||||
if (n < 128) {
|
||||
// copy n bytes
|
||||
buffer = this.ensureBuffer(bufferLength + n + 1);
|
||||
buffer[bufferLength++] = repeatHeader[1];
|
||||
if (n > 0) {
|
||||
var source = this.stream.getBytes(n);
|
||||
buffer.set(source, bufferLength);
|
||||
bufferLength += n;
|
||||
}
|
||||
}
|
||||
else {
|
||||
n = 257 - n;
|
||||
var b = repeatHeader[1];
|
||||
buffer = this.ensureBuffer(bufferLength + n + 1);
|
||||
for (var i = 0; i < n; i++) {
|
||||
buffer[bufferLength++] = b;
|
||||
}
|
||||
}
|
||||
this.bufferLength = bufferLength;
|
||||
};
|
||||
return RunLengthStream;
|
||||
}(DecodeStream_1.default));
|
||||
exports.default = RunLengthStream;
|
||||
//# sourceMappingURL=RunLengthStream.js.map
|
||||
1
node_modules/pdf-lib/cjs/core/streams/RunLengthStream.js.map
generated
vendored
Normal file
1
node_modules/pdf-lib/cjs/core/streams/RunLengthStream.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"RunLengthStream.js","sourceRoot":"","sources":["../../../src/core/streams/RunLengthStream.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,wEAAyD;AAGzD;IAA8B,2CAAY;IAGxC,yBAAY,MAAkB,EAAE,WAAoB;QAApD,YACE,kBAAM,WAAW,CAAC,SAEnB;QADC,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC;;IACvB,CAAC;IAES,mCAAS,GAAnB;QACE,4EAA4E;QAC5E,4EAA4E;QAC5E,0EAA0E;QAC1E,4EAA4E;QAC5E,IAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC7C,IAAI,CAAC,YAAY,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,IAAI,YAAY,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;YACvE,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;YAChB,OAAO;SACR;QAED,IAAI,MAAM,CAAC;QACX,IAAI,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QACrC,IAAI,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;QACxB,IAAI,CAAC,GAAG,GAAG,EAAE;YACX,eAAe;YACf,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;YACjD,MAAM,CAAC,YAAY,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;YACzC,IAAI,CAAC,GAAG,CAAC,EAAE;gBACT,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;gBACvC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;gBACjC,YAAY,IAAI,CAAC,CAAC;aACnB;SACF;aAAM;YACL,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;YACZ,IAAM,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;YAC1B,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;YACjD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;gBAC1B,MAAM,CAAC,YAAY,EAAE,CAAC,GAAG,CAAC,CAAC;aAC5B;SACF;QACD,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IACH,sBAAC;AAAD,CAAC,AAzCD,CAA8B,sBAAY,GAyCzC;AAED,kBAAe,eAAe,CAAC"}
|
||||
35
node_modules/pdf-lib/cjs/core/streams/Stream.d.ts
generated
vendored
Normal file
35
node_modules/pdf-lib/cjs/core/streams/Stream.d.ts
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
export interface StreamType {
|
||||
isEmpty: boolean;
|
||||
getByte(): number;
|
||||
getUint16(): number;
|
||||
getInt32(): number;
|
||||
getBytes(length: number, forceClamped?: boolean): Uint8Array | Uint8ClampedArray;
|
||||
peekByte(): number;
|
||||
peekBytes(length: number, forceClamped?: boolean): Uint8Array | Uint8ClampedArray;
|
||||
skip(n: number): void;
|
||||
reset(): void;
|
||||
makeSubStream(start: number, length: number): StreamType;
|
||||
decode(): Uint8Array;
|
||||
}
|
||||
declare class Stream implements StreamType {
|
||||
private bytes;
|
||||
private start;
|
||||
private pos;
|
||||
private end;
|
||||
constructor(buffer: Uint8Array, start?: number, length?: number);
|
||||
get length(): number;
|
||||
get isEmpty(): boolean;
|
||||
getByte(): number;
|
||||
getUint16(): number;
|
||||
getInt32(): number;
|
||||
getBytes(length: number, forceClamped?: boolean): Uint8Array | Uint8ClampedArray;
|
||||
peekByte(): number;
|
||||
peekBytes(length: number, forceClamped?: boolean): Uint8Array | Uint8ClampedArray;
|
||||
skip(n: number): void;
|
||||
reset(): void;
|
||||
moveStart(): void;
|
||||
makeSubStream(start: number, length: number): Stream;
|
||||
decode(): Uint8Array;
|
||||
}
|
||||
export default Stream;
|
||||
//# sourceMappingURL=Stream.d.ts.map
|
||||
1
node_modules/pdf-lib/cjs/core/streams/Stream.d.ts.map
generated
vendored
Normal file
1
node_modules/pdf-lib/cjs/core/streams/Stream.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Stream.d.ts","sourceRoot":"","sources":["../../../src/core/streams/Stream.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,IAAI,MAAM,CAAC;IAClB,SAAS,IAAI,MAAM,CAAC;IACpB,QAAQ,IAAI,MAAM,CAAC;IACnB,QAAQ,CACN,MAAM,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,OAAO,GACrB,UAAU,GAAG,iBAAiB,CAAC;IAClC,QAAQ,IAAI,MAAM,CAAC;IACnB,SAAS,CACP,MAAM,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,OAAO,GACrB,UAAU,GAAG,iBAAiB,CAAC;IAClC,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,IAAI,IAAI,CAAC;IACd,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC;IACzD,MAAM,IAAI,UAAU,CAAC;CACtB;AAED,cAAM,MAAO,YAAW,UAAU;IAChC,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,GAAG,CAAS;gBAER,MAAM,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;IAO/D,IAAI,MAAM,WAET;IAED,IAAI,OAAO,YAEV;IAED,OAAO;IAOP,SAAS;IAST,QAAQ;IASR,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,UAAQ;IAqB7C,QAAQ;IAMR,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,UAAQ;IAM9C,IAAI,CAAC,CAAC,EAAE,MAAM;IAOd,KAAK;IAIL,SAAS;IAIT,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAI3C,MAAM,IAAI,UAAU;CAGrB;AAED,eAAe,MAAM,CAAC"}
|
||||
106
node_modules/pdf-lib/cjs/core/streams/Stream.js
generated
vendored
Normal file
106
node_modules/pdf-lib/cjs/core/streams/Stream.js
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
"use strict";
|
||||
/*
|
||||
* Copyright 2012 Mozilla Foundation
|
||||
*
|
||||
* The Stream class contained in this file is a TypeScript port of the
|
||||
* JavaScript Stream class in Mozilla's pdf.js project, made available
|
||||
* under the Apache 2.0 open source license.
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var Stream = /** @class */ (function () {
|
||||
function Stream(buffer, start, length) {
|
||||
this.bytes = buffer;
|
||||
this.start = start || 0;
|
||||
this.pos = this.start;
|
||||
this.end = !!start && !!length ? start + length : this.bytes.length;
|
||||
}
|
||||
Object.defineProperty(Stream.prototype, "length", {
|
||||
get: function () {
|
||||
return this.end - this.start;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(Stream.prototype, "isEmpty", {
|
||||
get: function () {
|
||||
return this.length === 0;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
Stream.prototype.getByte = function () {
|
||||
if (this.pos >= this.end) {
|
||||
return -1;
|
||||
}
|
||||
return this.bytes[this.pos++];
|
||||
};
|
||||
Stream.prototype.getUint16 = function () {
|
||||
var b0 = this.getByte();
|
||||
var b1 = this.getByte();
|
||||
if (b0 === -1 || b1 === -1) {
|
||||
return -1;
|
||||
}
|
||||
return (b0 << 8) + b1;
|
||||
};
|
||||
Stream.prototype.getInt32 = function () {
|
||||
var b0 = this.getByte();
|
||||
var b1 = this.getByte();
|
||||
var b2 = this.getByte();
|
||||
var b3 = this.getByte();
|
||||
return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
|
||||
};
|
||||
// Returns subarray of original buffer, should only be read.
|
||||
Stream.prototype.getBytes = function (length, forceClamped) {
|
||||
if (forceClamped === void 0) { forceClamped = false; }
|
||||
var bytes = this.bytes;
|
||||
var pos = this.pos;
|
||||
var strEnd = this.end;
|
||||
if (!length) {
|
||||
var subarray = bytes.subarray(pos, strEnd);
|
||||
// `this.bytes` is always a `Uint8Array` here.
|
||||
return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
|
||||
}
|
||||
else {
|
||||
var end = pos + length;
|
||||
if (end > strEnd) {
|
||||
end = strEnd;
|
||||
}
|
||||
this.pos = end;
|
||||
var subarray = bytes.subarray(pos, end);
|
||||
// `this.bytes` is always a `Uint8Array` here.
|
||||
return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
|
||||
}
|
||||
};
|
||||
Stream.prototype.peekByte = function () {
|
||||
var peekedByte = this.getByte();
|
||||
this.pos--;
|
||||
return peekedByte;
|
||||
};
|
||||
Stream.prototype.peekBytes = function (length, forceClamped) {
|
||||
if (forceClamped === void 0) { forceClamped = false; }
|
||||
var bytes = this.getBytes(length, forceClamped);
|
||||
this.pos -= bytes.length;
|
||||
return bytes;
|
||||
};
|
||||
Stream.prototype.skip = function (n) {
|
||||
if (!n) {
|
||||
n = 1;
|
||||
}
|
||||
this.pos += n;
|
||||
};
|
||||
Stream.prototype.reset = function () {
|
||||
this.pos = this.start;
|
||||
};
|
||||
Stream.prototype.moveStart = function () {
|
||||
this.start = this.pos;
|
||||
};
|
||||
Stream.prototype.makeSubStream = function (start, length) {
|
||||
return new Stream(this.bytes, start, length);
|
||||
};
|
||||
Stream.prototype.decode = function () {
|
||||
return this.bytes;
|
||||
};
|
||||
return Stream;
|
||||
}());
|
||||
exports.default = Stream;
|
||||
//# sourceMappingURL=Stream.js.map
|
||||
1
node_modules/pdf-lib/cjs/core/streams/Stream.js.map
generated
vendored
Normal file
1
node_modules/pdf-lib/cjs/core/streams/Stream.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Stream.js","sourceRoot":"","sources":["../../../src/core/streams/Stream.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAsBH;IAME,gBAAY,MAAkB,EAAE,KAAc,EAAE,MAAe;QAC7D,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC;QACpB,IAAI,CAAC,KAAK,GAAG,KAAK,IAAI,CAAC,CAAC;QACxB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC;QACtB,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IACtE,CAAC;IAED,sBAAI,0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AAL;QACE,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC;IACxB,CAAC;IAED,0BAAS,GAAT;QACE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC;IACxB,CAAC;IAED,8BAAa,GAAb,UAAc,KAAa,EAAE,MAAc;QACzC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAC/C,CAAC;IAED,uBAAM,GAAN;QACE,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IACH,aAAC;AAAD,CAAC,AArGD,IAqGC;AAED,kBAAe,MAAM,CAAC"}
|
||||
4
node_modules/pdf-lib/cjs/core/streams/decode.d.ts
generated
vendored
Normal file
4
node_modules/pdf-lib/cjs/core/streams/decode.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import PDFRawStream from "../objects/PDFRawStream";
|
||||
import { StreamType } from "./Stream";
|
||||
export declare const decodePDFRawStream: ({ dict, contents }: PDFRawStream) => StreamType;
|
||||
//# sourceMappingURL=decode.d.ts.map
|
||||
1
node_modules/pdf-lib/cjs/core/streams/decode.d.ts.map
generated
vendored
Normal file
1
node_modules/pdf-lib/cjs/core/streams/decode.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../../src/core/streams/decode.ts"],"names":[],"mappings":"AASA,OAAO,YAAY,gCAAsC;AAMzD,OAAe,EAAE,UAAU,EAAE,iBAAgC;AAgC7D,eAAO,MAAM,kBAAkB,uBAAwB,YAAY,eAyBlE,CAAC"}
|
||||
59
node_modules/pdf-lib/cjs/core/streams/decode.js
generated
vendored
Normal file
59
node_modules/pdf-lib/cjs/core/streams/decode.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.decodePDFRawStream = void 0;
|
||||
var tslib_1 = require("tslib");
|
||||
var errors_1 = require("../errors");
|
||||
var PDFArray_1 = tslib_1.__importDefault(require("../objects/PDFArray"));
|
||||
var PDFDict_1 = tslib_1.__importDefault(require("../objects/PDFDict"));
|
||||
var PDFName_1 = tslib_1.__importDefault(require("../objects/PDFName"));
|
||||
var PDFNumber_1 = tslib_1.__importDefault(require("../objects/PDFNumber"));
|
||||
var Ascii85Stream_1 = tslib_1.__importDefault(require("./Ascii85Stream"));
|
||||
var AsciiHexStream_1 = tslib_1.__importDefault(require("./AsciiHexStream"));
|
||||
var FlateStream_1 = tslib_1.__importDefault(require("./FlateStream"));
|
||||
var LZWStream_1 = tslib_1.__importDefault(require("./LZWStream"));
|
||||
var RunLengthStream_1 = tslib_1.__importDefault(require("./RunLengthStream"));
|
||||
var Stream_1 = tslib_1.__importDefault(require("./Stream"));
|
||||
var decodeStream = function (stream, encoding, params) {
|
||||
if (encoding === PDFName_1.default.of('FlateDecode')) {
|
||||
return new FlateStream_1.default(stream);
|
||||
}
|
||||
if (encoding === PDFName_1.default.of('LZWDecode')) {
|
||||
var earlyChange = 1;
|
||||
if (params instanceof PDFDict_1.default) {
|
||||
var EarlyChange = params.lookup(PDFName_1.default.of('EarlyChange'));
|
||||
if (EarlyChange instanceof PDFNumber_1.default) {
|
||||
earlyChange = EarlyChange.asNumber();
|
||||
}
|
||||
}
|
||||
return new LZWStream_1.default(stream, undefined, earlyChange);
|
||||
}
|
||||
if (encoding === PDFName_1.default.of('ASCII85Decode')) {
|
||||
return new Ascii85Stream_1.default(stream);
|
||||
}
|
||||
if (encoding === PDFName_1.default.of('ASCIIHexDecode')) {
|
||||
return new AsciiHexStream_1.default(stream);
|
||||
}
|
||||
if (encoding === PDFName_1.default.of('RunLengthDecode')) {
|
||||
return new RunLengthStream_1.default(stream);
|
||||
}
|
||||
throw new errors_1.UnsupportedEncodingError(encoding.asString());
|
||||
};
|
||||
exports.decodePDFRawStream = function (_a) {
|
||||
var dict = _a.dict, contents = _a.contents;
|
||||
var stream = new Stream_1.default(contents);
|
||||
var Filter = dict.lookup(PDFName_1.default.of('Filter'));
|
||||
var DecodeParms = dict.lookup(PDFName_1.default.of('DecodeParms'));
|
||||
if (Filter instanceof PDFName_1.default) {
|
||||
stream = decodeStream(stream, Filter, DecodeParms);
|
||||
}
|
||||
else if (Filter instanceof PDFArray_1.default) {
|
||||
for (var idx = 0, len = Filter.size(); idx < len; idx++) {
|
||||
stream = decodeStream(stream, Filter.lookup(idx, PDFName_1.default), DecodeParms && DecodeParms.lookupMaybe(idx, PDFDict_1.default));
|
||||
}
|
||||
}
|
||||
else if (!!Filter) {
|
||||
throw new errors_1.UnexpectedObjectTypeError([PDFName_1.default, PDFArray_1.default], Filter);
|
||||
}
|
||||
return stream;
|
||||
};
|
||||
//# sourceMappingURL=decode.js.map
|
||||
1
node_modules/pdf-lib/cjs/core/streams/decode.js.map
generated
vendored
Normal file
1
node_modules/pdf-lib/cjs/core/streams/decode.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"decode.js","sourceRoot":"","sources":["../../../src/core/streams/decode.ts"],"names":[],"mappings":";;;;AAAA,oCAGyB;AACzB,yEAAiD;AACjD,uEAA+C;AAC/C,uEAA+C;AAE/C,2EAAmD;AAEnD,0EAA2D;AAC3D,4EAA6D;AAC7D,sEAAuD;AACvD,kEAAmD;AACnD,8EAA+D;AAC/D,4DAA6D;AAE7D,IAAM,YAAY,GAAG,UACnB,MAAkB,EAClB,QAAiB,EACjB,MAA4C;IAE5C,IAAI,QAAQ,KAAK,iBAAO,CAAC,EAAE,CAAC,aAAa,CAAC,EAAE;QAC1C,OAAO,IAAI,qBAAW,CAAC,MAAM,CAAC,CAAC;KAChC;IACD,IAAI,QAAQ,KAAK,iBAAO,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE;QACxC,IAAI,WAAW,GAAG,CAAC,CAAC;QACpB,IAAI,MAAM,YAAY,iBAAO,EAAE;YAC7B,IAAM,WAAW,GAAG,MAAM,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