author | Carsten "Tomcat" Book <cbook@mozilla.com> |
Wed, 31 May 2017 11:28:43 +0200 | |
changeset 361475 | 7b8937970f9ca85db88cb2496f2112175fd847c8 |
parent 361457 | 23243677c7dd56781ccccb70b748cec412780516 (current diff) |
parent 361474 | e676a13582cb320644c0467996a4aa804dab0255 (diff) |
child 361485 | 928bbb8a26663119a9b4253efc6b760a53ccf936 |
child 361553 | 7061759a0b572538a8b2effa703d61f383c83c32 |
child 361806 | 25fe58290e36a70f1e0d946476aec7d676340eda |
push id | 31931 |
push user | cbook@mozilla.com |
push date | Wed, 31 May 2017 09:29:10 +0000 |
treeherder | mozilla-central@7b8937970f9c [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | merge |
milestone | 55.0a1 |
first release with | nightly linux32
7b8937970f9c
/
55.0a1
/
20170531100318
/
files
nightly linux64
7b8937970f9c
/
55.0a1
/
20170531100318
/
files
nightly mac
7b8937970f9c
/
55.0a1
/
20170531030204
/
files
nightly win32
7b8937970f9c
/
55.0a1
/
20170531030204
/
files
nightly win64
7b8937970f9c
/
55.0a1
/
20170531030204
/
files
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
releases | nightly linux32
55.0a1
/
20170531100318
/
pushlog to previous
nightly linux64
55.0a1
/
20170531100318
/
pushlog to previous
nightly mac
55.0a1
/
20170531030204
/
pushlog to previous
nightly win32
55.0a1
/
20170531030204
/
pushlog to previous
nightly win64
55.0a1
/
20170531030204
/
pushlog to previous
|
--- a/browser/extensions/pdfjs/README.mozilla +++ b/browser/extensions/pdfjs/README.mozilla @@ -1,5 +1,5 @@ This is the PDF.js project output, https://github.com/mozilla/pdf.js -Current extension version is: 1.8.384 +Current extension version is: 1.8.398 -Taken from upstream commit: 8d55e6a0 +Taken from upstream commit: 96377832
--- a/browser/extensions/pdfjs/content/build/pdf.js +++ b/browser/extensions/pdfjs/content/build/pdf.js @@ -3400,18 +3400,18 @@ var _UnsupportedManager = function Unsup for (var i = 0, ii = listeners.length; i < ii; i++) { listeners[i](featureId); } } }; }(); var version, build; { - exports.version = version = '1.8.384'; - exports.build = build = '8d55e6a0'; + exports.version = version = '1.8.398'; + exports.build = build = '96377832'; } exports.getDocument = getDocument; exports.LoopbackPort = LoopbackPort; exports.PDFDataRangeTransport = PDFDataRangeTransport; exports.PDFWorker = PDFWorker; exports.PDFDocumentProxy = PDFDocumentProxy; exports.PDFPageProxy = PDFPageProxy; exports._UnsupportedManager = _UnsupportedManager; @@ -4403,18 +4403,18 @@ var _text_layer = __w_pdfjs_require__(5) var _svg = __w_pdfjs_require__(4); var isWorker = typeof window === 'undefined'; if (!_util.globalScope.PDFJS) { _util.globalScope.PDFJS = {}; } var PDFJS = _util.globalScope.PDFJS; { - PDFJS.version = '1.8.384'; - PDFJS.build = '8d55e6a0'; + PDFJS.version = '1.8.398'; + PDFJS.build = '96377832'; } PDFJS.pdfBug = false; if (PDFJS.verbosity !== undefined) { (0, _util.setVerbosityLevel)(PDFJS.verbosity); } delete PDFJS.verbosity; Object.defineProperty(PDFJS, 'verbosity', { get() { @@ -6735,18 +6735,18 @@ exports.TilingPattern = TilingPattern; /***/ }), /* 13 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var pdfjsVersion = '1.8.384'; -var pdfjsBuild = '8d55e6a0'; +var pdfjsVersion = '1.8.398'; +var pdfjsBuild = '96377832'; var pdfjsSharedUtil = __w_pdfjs_require__(0); var pdfjsDisplayGlobal = __w_pdfjs_require__(8); var pdfjsDisplayAPI = __w_pdfjs_require__(3); var pdfjsDisplayTextLayer = __w_pdfjs_require__(5); var pdfjsDisplayAnnotationLayer = __w_pdfjs_require__(2); var pdfjsDisplayDOMUtils = __w_pdfjs_require__(1); var pdfjsDisplaySVG = __w_pdfjs_require__(4); exports.PDFJS = pdfjsDisplayGlobal.PDFJS; @@ -6772,16 +6772,17 @@ exports.isValidUrl = pdfjsDisplayDOMUtil exports.createValidAbsoluteUrl = pdfjsSharedUtil.createValidAbsoluteUrl; exports.createObjectURL = pdfjsSharedUtil.createObjectURL; exports.removeNullCharacters = pdfjsSharedUtil.removeNullCharacters; exports.shadow = pdfjsSharedUtil.shadow; exports.createBlob = pdfjsSharedUtil.createBlob; exports.RenderingCancelledException = pdfjsDisplayDOMUtils.RenderingCancelledException; exports.getFilenameFromUrl = pdfjsDisplayDOMUtils.getFilenameFromUrl; exports.addLinkAttributes = pdfjsDisplayDOMUtils.addLinkAttributes; +exports.StatTimer = pdfjsSharedUtil.StatTimer; /***/ }), /* 14 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict";
--- a/browser/extensions/pdfjs/content/build/pdf.worker.js +++ b/browser/extensions/pdfjs/content/build/pdf.worker.js @@ -1186,18 +1186,23 @@ exports.warn = warn; /***/ }), /* 1 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var sharedUtil = __w_pdfjs_require__(0); -var isArray = sharedUtil.isArray; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.isStream = exports.isRefsEqual = exports.isRef = exports.isName = exports.isDict = exports.isCmd = exports.isEOF = exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.Dict = exports.Cmd = exports.EOF = undefined; + +var _util = __w_pdfjs_require__(0); + var EOF = {}; var Name = function NameClosure() { function Name(name) { this.name = name; } Name.prototype = {}; var nameCache = Object.create(null); Name.get = function Name_get(name) { @@ -1267,17 +1272,17 @@ var Dict = function DictClosure() { return xref.fetchIfRefAsync(value, suppressEncryption); } return Promise.resolve(value); }, getArray: function Dict_getArray(key1, key2, key3) { var value = this.get(key1, key2, key3); var xref = this.xref, suppressEncryption = this.suppressEncryption; - if (!isArray(value) || !xref) { + if (!(0, _util.isArray)(value) || !xref) { return value; } value = value.slice(); for (var i = 0, ii = value.length; i < ii; i++) { if (!isRef(value[i])) { continue; } value[i] = xref.fetch(value[i], suppressEncryption); @@ -1420,35 +1425,31 @@ exports.isStream = isStream; /***/ }), /* 2 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var sharedUtil = __w_pdfjs_require__(0); -var corePrimitives = __w_pdfjs_require__(1); -var coreJbig2 = __w_pdfjs_require__(27); -var coreJpg = __w_pdfjs_require__(28); -var coreJpx = __w_pdfjs_require__(14); -var Util = sharedUtil.Util; -var error = sharedUtil.error; -var info = sharedUtil.info; -var isInt = sharedUtil.isInt; -var isArray = sharedUtil.isArray; -var createObjectURL = sharedUtil.createObjectURL; -var shadow = sharedUtil.shadow; -var isSpace = sharedUtil.isSpace; -var Dict = corePrimitives.Dict; -var isDict = corePrimitives.isDict; -var isStream = corePrimitives.isStream; -var Jbig2Image = coreJbig2.Jbig2Image; -var JpegImage = coreJpg.JpegImage; -var JpxImage = coreJpx.JpxImage; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.LZWStream = exports.StringStream = exports.StreamsSequenceStream = exports.Stream = exports.RunLengthStream = exports.PredictorStream = exports.NullStream = exports.JpxStream = exports.JpegStream = exports.Jbig2Stream = exports.FlateStream = exports.DecodeStream = exports.DecryptStream = exports.CCITTFaxStream = exports.AsciiHexStream = exports.Ascii85Stream = undefined; + +var _util = __w_pdfjs_require__(0); + +var _primitives = __w_pdfjs_require__(1); + +var _jbig = __w_pdfjs_require__(27); + +var _jpg = __w_pdfjs_require__(28); + +var _jpx = __w_pdfjs_require__(14); + var Stream = function StreamClosure() { function Stream(arrayBuffer, start, length, dict) { this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer); this.start = start || 0; this.pos = this.start; this.end = start + length || this.bytes.length; this.dict = dict; } @@ -1670,17 +1671,17 @@ var StreamsSequenceStream = function Str buffer.set(chunk, bufferLength); this.bufferLength = newLength; }; StreamsSequenceStream.prototype.getBaseStreams = function StreamsSequenceStream_getBaseStreams() { var baseStreams = []; for (var i = 0, ii = this.streams.length; i < ii; i++) { var stream = this.streams[i]; if (stream.getBaseStreams) { - Util.appendToArray(baseStreams, stream.getBaseStreams()); + _util.Util.appendToArray(baseStreams, stream.getBaseStreams()); } } return baseStreams; }; return StreamsSequenceStream; }(); var FlateStream = function FlateStreamClosure() { var codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]); @@ -1689,40 +1690,40 @@ var FlateStream = function FlateStreamCl 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]; 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]; function FlateStream(str, maybeLength) { this.str = str; this.dict = str.dict; var cmf = str.getByte(); var flg = str.getByte(); if (cmf === -1 || flg === -1) { - error('Invalid header in flate stream: ' + cmf + ', ' + flg); + (0, _util.error)('Invalid header in flate stream: ' + cmf + ', ' + flg); } if ((cmf & 0x0f) !== 0x08) { - error('Unknown compression method in flate stream: ' + cmf + ', ' + flg); + (0, _util.error)('Unknown compression method in flate stream: ' + cmf + ', ' + flg); } if (((cmf << 8) + flg) % 31 !== 0) { - error('Bad FCHECK in flate stream: ' + cmf + ', ' + flg); + (0, _util.error)('Bad FCHECK in flate stream: ' + cmf + ', ' + flg); } if (flg & 0x20) { - error('FDICT bit set in flate stream: ' + cmf + ', ' + flg); + (0, _util.error)('FDICT bit set in flate stream: ' + cmf + ', ' + flg); } this.codeSize = 0; this.codeBuf = 0; DecodeStream.call(this, maybeLength); } FlateStream.prototype = Object.create(DecodeStream.prototype); FlateStream.prototype.getBits = function FlateStream_getBits(bits) { var str = this.str; var codeSize = this.codeSize; var codeBuf = this.codeBuf; var b; while (codeSize < bits) { if ((b = str.getByte()) === -1) { - error('Bad encoding in flate stream'); + (0, _util.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; @@ -1740,17 +1741,17 @@ var FlateStream = function FlateStreamCl } codeBuf |= b << codeSize; codeSize += 8; } var code = codes[codeBuf & (1 << maxLen) - 1]; var codeLen = code >> 16; var codeVal = code & 0xffff; if (codeLen < 1 || codeSize < codeLen) { - error('Bad encoding in flate stream'); + (0, _util.error)('Bad encoding in flate stream'); } this.codeBuf = codeBuf >> codeLen; this.codeSize = codeSize - codeLen; return codeVal; }; FlateStream.prototype.generateHuffmanTable = function flateStreamGenerateHuffmanTable(lengths) { var n = lengths.length; var maxLen = 0; @@ -1786,33 +1787,33 @@ var FlateStream = function FlateStreamCl var hdr = this.getBits(3); if (hdr & 1) { this.eof = true; } hdr >>= 1; if (hdr === 0) { var b; if ((b = str.getByte()) === -1) { - error('Bad block header in flate stream'); + (0, _util.error)('Bad block header in flate stream'); } var blockLen = b; if ((b = str.getByte()) === -1) { - error('Bad block header in flate stream'); + (0, _util.error)('Bad block header in flate stream'); } blockLen |= b << 8; if ((b = str.getByte()) === -1) { - error('Bad block header in flate stream'); + (0, _util.error)('Bad block header in flate stream'); } var check = b; if ((b = str.getByte()) === -1) { - error('Bad block header in flate stream'); + (0, _util.error)('Bad block header in flate stream'); } check |= b << 8; if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) { - error('Bad uncompressed block length in flate stream'); + (0, _util.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) { @@ -1871,17 +1872,17 @@ var FlateStream = function FlateStreamCl 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 { - error('Unknown block type in flate stream'); + (0, _util.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) { @@ -1917,25 +1918,25 @@ var FlateStream = function FlateStreamCl buffer[pos] = buffer[pos - dist]; } } }; return FlateStream; }(); var PredictorStream = function PredictorStreamClosure() { function PredictorStream(str, maybeLength, params) { - if (!isDict(params)) { + if (!(0, _primitives.isDict)(params)) { return str; } var predictor = this.predictor = params.get('Predictor') || 1; if (predictor <= 1) { return str; } if (predictor !== 2 && (predictor < 10 || predictor > 15)) { - error('Unsupported predictor: ' + predictor); + (0, _util.error)('Unsupported predictor: ' + predictor); } if (predictor === 2) { this.readBlock = this.readBlockTiff; } else { this.readBlock = this.readBlockPng; } this.str = str; this.dict = str.dict; @@ -2087,17 +2088,17 @@ var PredictorStream = function Predictor } else if (pb <= pc) { buffer[j++] = up + c; } else { buffer[j++] = upLeft + c; } } break; default: - error('Unsupported predictor: ' + predictor); + (0, _util.error)('Unsupported predictor: ' + predictor); } this.bufferLength += rowBytes; }; return PredictorStream; }(); var JpegStream = function JpegStreamClosure() { function JpegStream(stream, maybeLength, dict, params) { var ch; @@ -2111,84 +2112,84 @@ var JpegStream = function JpegStreamClos this.maybeLength = maybeLength; this.dict = dict; this.params = params; DecodeStream.call(this, maybeLength); } JpegStream.prototype = Object.create(DecodeStream.prototype); Object.defineProperty(JpegStream.prototype, 'bytes', { get: function JpegStream_bytes() { - return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength)); + return (0, _util.shadow)(this, 'bytes', this.stream.getBytes(this.maybeLength)); }, configurable: true }); JpegStream.prototype.ensureBuffer = function JpegStream_ensureBuffer(req) { if (this.bufferLength) { return; } - var jpegImage = new JpegImage(); + var jpegImage = new _jpg.JpegImage(); var decodeArr = this.dict.getArray('Decode', 'D'); - if (this.forceRGB && isArray(decodeArr)) { + if (this.forceRGB && (0, _util.isArray)(decodeArr)) { var bitsPerComponent = this.dict.get('BitsPerComponent') || 8; var decodeArrLength = decodeArr.length; var transform = new Int32Array(decodeArrLength); var transformNeeded = false; var maxValue = (1 << bitsPerComponent) - 1; for (var i = 0; i < decodeArrLength; i += 2) { transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0; transform[i + 1] = decodeArr[i] * maxValue | 0; if (transform[i] !== 256 || transform[i + 1] !== 0) { transformNeeded = true; } } if (transformNeeded) { jpegImage.decodeTransform = transform; } } - if (isDict(this.params)) { + if ((0, _primitives.isDict)(this.params)) { var colorTransform = this.params.get('ColorTransform'); - if (isInt(colorTransform)) { + if ((0, _util.isInt)(colorTransform)) { jpegImage.colorTransform = colorTransform; } } jpegImage.parse(this.bytes); var data = jpegImage.getData(this.drawWidth, this.drawHeight, this.forceRGB); this.buffer = data; this.bufferLength = data.length; this.eof = true; }; JpegStream.prototype.getBytes = function JpegStream_getBytes(length) { this.ensureBuffer(); return this.buffer; }; JpegStream.prototype.getIR = function JpegStream_getIR(forceDataSchema) { - return createObjectURL(this.bytes, 'image/jpeg', forceDataSchema); + return (0, _util.createObjectURL)(this.bytes, 'image/jpeg', forceDataSchema); }; return JpegStream; }(); var JpxStream = function JpxStreamClosure() { function JpxStream(stream, maybeLength, dict, params) { this.stream = stream; this.maybeLength = maybeLength; this.dict = dict; this.params = params; DecodeStream.call(this, maybeLength); } JpxStream.prototype = Object.create(DecodeStream.prototype); Object.defineProperty(JpxStream.prototype, 'bytes', { get: function JpxStream_bytes() { - return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength)); + return (0, _util.shadow)(this, 'bytes', this.stream.getBytes(this.maybeLength)); }, configurable: true }); JpxStream.prototype.ensureBuffer = function JpxStream_ensureBuffer(req) { if (this.bufferLength) { return; } - var jpxImage = new JpxImage(); + var jpxImage = new _jpx.JpxImage(); jpxImage.parse(this.bytes); var width = jpxImage.width; var height = jpxImage.height; var componentsCount = jpxImage.componentsCount; var tileCount = jpxImage.tiles.length; if (tileCount === 1) { this.buffer = jpxImage.tiles[0].items; } else { @@ -2224,29 +2225,29 @@ var Jbig2Stream = function Jbig2StreamCl this.maybeLength = maybeLength; this.dict = dict; this.params = params; DecodeStream.call(this, maybeLength); } Jbig2Stream.prototype = Object.create(DecodeStream.prototype); Object.defineProperty(Jbig2Stream.prototype, 'bytes', { get: function Jbig2Stream_bytes() { - return shadow(this, 'bytes', this.stream.getBytes(this.maybeLength)); + return (0, _util.shadow)(this, 'bytes', this.stream.getBytes(this.maybeLength)); }, configurable: true }); Jbig2Stream.prototype.ensureBuffer = function Jbig2Stream_ensureBuffer(req) { if (this.bufferLength) { return; } - var jbig2Image = new Jbig2Image(); + var jbig2Image = new _jbig.Jbig2Image(); var chunks = []; - if (isDict(this.params)) { + if ((0, _primitives.isDict)(this.params)) { var globalsStream = this.params.get('JBIG2Globals'); - if (isStream(globalsStream)) { + if ((0, _primitives.isStream)(globalsStream)) { var globals = globalsStream.getBytes(); chunks.push({ data: globals, start: 0, end: globals.length }); } } @@ -2316,17 +2317,17 @@ var Ascii85Stream = function Ascii85Stre } Ascii85Stream.prototype = Object.create(DecodeStream.prototype); Ascii85Stream.prototype.readBlock = function Ascii85Stream_readBlock() { var TILDA_CHAR = 0x7E; var Z_LOWER_CHAR = 0x7A; var EOF = -1; var str = this.str; var c = str.getByte(); - while (isSpace(c)) { + while ((0, _util.isSpace)(c)) { c = str.getByte(); } if (c === EOF || c === TILDA_CHAR) { this.eof = true; return; } var bufferLength = this.bufferLength, buffer; @@ -2337,17 +2338,17 @@ var Ascii85Stream = function Ascii85Stre buffer[bufferLength + i] = 0; } this.bufferLength += 4; } else { var input = this.input; input[0] = c; for (i = 1; i < 5; ++i) { c = str.getByte(); - while (isSpace(c)) { + while ((0, _util.isSpace)(c)) { c = str.getByte(); } input[i] = c; if (c === EOF || c === TILDA_CHAR) { break; } } buffer = this.ensureBuffer(bufferLength + i - 1); @@ -2473,17 +2474,17 @@ var CCITTFaxStream = function CCITTFaxSt var whiteTable1 = [[-1, -1], [12, ccittEOL], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [11, 1792], [11, 1792], [12, 1984], [12, 2048], [12, 2112], [12, 2176], [12, 2240], [12, 2304], [11, 1856], [11, 1856], [11, 1920], [11, 1920], [12, 2368], [12, 2432], [12, 2496], [12, 2560]]; var whiteTable2 = [[-1, -1], [-1, -1], [-1, -1], [-1, -1], [8, 29], [8, 29], [8, 30], [8, 30], [8, 45], [8, 45], [8, 46], [8, 46], [7, 22], [7, 22], [7, 22], [7, 22], [7, 23], [7, 23], [7, 23], [7, 23], [8, 47], [8, 47], [8, 48], [8, 48], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [7, 20], [7, 20], [7, 20], [7, 20], [8, 33], [8, 33], [8, 34], [8, 34], [8, 35], [8, 35], [8, 36], [8, 36], [8, 37], [8, 37], [8, 38], [8, 38], [7, 19], [7, 19], [7, 19], [7, 19], [8, 31], [8, 31], [8, 32], [8, 32], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [8, 53], [8, 53], [8, 54], [8, 54], [7, 26], [7, 26], [7, 26], [7, 26], [8, 39], [8, 39], [8, 40], [8, 40], [8, 41], [8, 41], [8, 42], [8, 42], [8, 43], [8, 43], [8, 44], [8, 44], [7, 21], [7, 21], [7, 21], [7, 21], [7, 28], [7, 28], [7, 28], [7, 28], [8, 61], [8, 61], [8, 62], [8, 62], [8, 63], [8, 63], [8, 0], [8, 0], [8, 320], [8, 320], [8, 384], [8, 384], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [7, 27], [7, 27], [7, 27], [7, 27], [8, 59], [8, 59], [8, 60], [8, 60], [9, 1472], [9, 1536], [9, 1600], [9, 1728], [7, 18], [7, 18], [7, 18], [7, 18], [7, 24], [7, 24], [7, 24], [7, 24], [8, 49], [8, 49], [8, 50], [8, 50], [8, 51], [8, 51], [8, 52], [8, 52], [7, 25], [7, 25], [7, 25], [7, 25], [8, 55], [8, 55], [8, 56], [8, 56], [8, 57], [8, 57], [8, 58], [8, 58], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [8, 448], [8, 448], [8, 512], [8, 512], [9, 704], [9, 768], [8, 640], [8, 640], [8, 576], [8, 576], [9, 832], [9, 896], [9, 960], [9, 1024], [9, 1088], [9, 1152], [9, 1216], [9, 1280], [9, 1344], [9, 1408], [7, 256], [7, 256], [7, 256], [7, 256], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7]]; var blackTable1 = [[-1, -1], [-1, -1], [12, ccittEOL], [12, ccittEOL], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [11, 1792], [11, 1792], [11, 1792], [11, 1792], [12, 1984], [12, 1984], [12, 2048], [12, 2048], [12, 2112], [12, 2112], [12, 2176], [12, 2176], [12, 2240], [12, 2240], [12, 2304], [12, 2304], [11, 1856], [11, 1856], [11, 1856], [11, 1856], [11, 1920], [11, 1920], [11, 1920], [11, 1920], [12, 2368], [12, 2368], [12, 2432], [12, 2432], [12, 2496], [12, 2496], [12, 2560], [12, 2560], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [12, 52], [12, 52], [13, 640], [13, 704], [13, 768], [13, 832], [12, 55], [12, 55], [12, 56], [12, 56], [13, 1280], [13, 1344], [13, 1408], [13, 1472], [12, 59], [12, 59], [12, 60], [12, 60], [13, 1536], [13, 1600], [11, 24], [11, 24], [11, 24], [11, 24], [11, 25], [11, 25], [11, 25], [11, 25], [13, 1664], [13, 1728], [12, 320], [12, 320], [12, 384], [12, 384], [12, 448], [12, 448], [13, 512], [13, 576], [12, 53], [12, 53], [12, 54], [12, 54], [13, 896], [13, 960], [13, 1024], [13, 1088], [13, 1152], [13, 1216], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64]]; var blackTable2 = [[8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [11, 23], [11, 23], [12, 50], [12, 51], [12, 44], [12, 45], [12, 46], [12, 47], [12, 57], [12, 58], [12, 61], [12, 256], [10, 16], [10, 16], [10, 16], [10, 16], [10, 17], [10, 17], [10, 17], [10, 17], [12, 48], [12, 49], [12, 62], [12, 63], [12, 30], [12, 31], [12, 32], [12, 33], [12, 40], [12, 41], [11, 22], [11, 22], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [12, 128], [12, 192], [12, 26], [12, 27], [12, 28], [12, 29], [11, 19], [11, 19], [11, 20], [11, 20], [12, 34], [12, 35], [12, 36], [12, 37], [12, 38], [12, 39], [11, 21], [11, 21], [12, 42], [12, 43], [10, 0], [10, 0], [10, 0], [10, 0], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12]]; var blackTable3 = [[-1, -1], [-1, -1], [-1, -1], [-1, -1], [6, 9], [6, 8], [5, 7], [5, 7], [4, 6], [4, 6], [4, 6], [4, 6], [4, 5], [4, 5], [4, 5], [4, 5], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2]]; function CCITTFaxStream(str, maybeLength, params) { this.str = str; this.dict = str.dict; - params = params || Dict.empty; + params = params || _primitives.Dict.empty; this.encoding = params.get('K') || 0; this.eoline = params.get('EndOfLine') || false; this.byteAlign = params.get('EncodedByteAlign') || false; this.columns = params.get('Columns') || 1728; this.rows = params.get('Rows') || 0; var eoblock = params.get('EndOfBlock'); if (eoblock === null || eoblock === undefined) { eoblock = true; @@ -2520,43 +2521,43 @@ var CCITTFaxStream = function CCITTFaxSt this.buffer[this.bufferLength++] = c; } }; CCITTFaxStream.prototype.addPixels = function ccittFaxStreamAddPixels(a1, blackPixels) { var codingLine = this.codingLine; var codingPos = this.codingPos; if (a1 > codingLine[codingPos]) { if (a1 > this.columns) { - info('row is wrong length'); + (0, _util.info)('row is wrong length'); this.err = true; a1 = this.columns; } if (codingPos & 1 ^ blackPixels) { ++codingPos; } codingLine[codingPos] = a1; } this.codingPos = codingPos; }; CCITTFaxStream.prototype.addPixelsNeg = function ccittFaxStreamAddPixelsNeg(a1, blackPixels) { var codingLine = this.codingLine; var codingPos = this.codingPos; if (a1 > codingLine[codingPos]) { if (a1 > this.columns) { - info('row is wrong length'); + (0, _util.info)('row is wrong length'); this.err = true; a1 = this.columns; } if (codingPos & 1 ^ blackPixels) { ++codingPos; } codingLine[codingPos] = a1; } else if (a1 < codingLine[codingPos]) { if (a1 < 0) { - info('invalid code'); + (0, _util.info)('invalid code'); this.err = true; a1 = 0; } while (codingPos > 0 && a1 < codingLine[codingPos - 1]) { --codingPos; } codingLine[codingPos] = a1; } @@ -2699,17 +2700,17 @@ var CCITTFaxStream = function CCITTFaxSt } } break; case ccittEOF: this.addPixels(columns, 0); this.eof = true; break; default: - info('bad 2d code'); + (0, _util.info)('bad 2d code'); this.addPixels(columns, 0); this.err = true; } } } else { codingLine[0] = 0; this.codingPos = 0; blackPixels = 0; @@ -2765,17 +2766,17 @@ var CCITTFaxStream = function CCITTFaxSt if (this.encoding > 0) { this.lookBits(1); this.eatBits(1); } if (this.encoding >= 0) { for (i = 0; i < 4; ++i) { code1 = this.lookBits(12); if (code1 !== 1) { - info('bad rtc code: ' + code1); + (0, _util.info)('bad rtc code: ' + code1); } this.eatBits(12); if (this.encoding > 0) { this.lookBits(1); this.eatBits(1); } } } @@ -2878,17 +2879,17 @@ var CCITTFaxStream = function CCITTFaxSt return p[1]; } } else { var result = this.findTableCode(1, 7, twoDimTable); if (result[0] && result[2]) { return result[1]; } } - info('Bad two dim code'); + (0, _util.info)('Bad two dim code'); return ccittEOF; }; CCITTFaxStream.prototype.getWhiteCode = function ccittFaxStreamGetWhiteCode() { var code = 0; var p; if (this.eoblock) { code = this.lookBits(12); if (code === ccittEOF) { @@ -2908,17 +2909,17 @@ var CCITTFaxStream = function CCITTFaxSt if (result[0]) { return result[1]; } result = this.findTableCode(11, 12, whiteTable1); if (result[0]) { return result[1]; } } - info('bad white code'); + (0, _util.info)('bad white code'); this.eatBits(1); return 1; }; CCITTFaxStream.prototype.getBlackCode = function ccittFaxStreamGetBlackCode() { var code, p; if (this.eoblock) { code = this.lookBits(13); if (code === ccittEOF) { @@ -2944,17 +2945,17 @@ var CCITTFaxStream = function CCITTFaxSt if (result[0]) { return result[1]; } result = this.findTableCode(10, 13, blackTable1); if (result[0]) { return result[1]; } } - info('bad black code'); + (0, _util.info)('bad black code'); this.eatBits(1); return 1; }; CCITTFaxStream.prototype.lookBits = function CCITTFaxStream_lookBits(n) { var c; while (this.inputBits < n) { if ((c = this.str.getByte()) === -1) { if (this.inputBits === 0) { @@ -3116,29 +3117,27 @@ exports.LZWStream = LZWStream; /***/ }), /* 3 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var sharedUtil = __w_pdfjs_require__(0); -var corePrimitives = __w_pdfjs_require__(1); -var coreFunction = __w_pdfjs_require__(7); -var error = sharedUtil.error; -var info = sharedUtil.info; -var isArray = sharedUtil.isArray; -var isString = sharedUtil.isString; -var shadow = sharedUtil.shadow; -var warn = sharedUtil.warn; -var isDict = corePrimitives.isDict; -var isName = corePrimitives.isName; -var isStream = corePrimitives.isStream; -var PDFFunction = coreFunction.PDFFunction; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.ColorSpace = undefined; + +var _util = __w_pdfjs_require__(0); + +var _primitives = __w_pdfjs_require__(1); + +var _function = __w_pdfjs_require__(7); + var ColorSpace = function ColorSpaceClosure() { function resizeRgbImage(src, bpc, w1, h1, w2, h2, alpha01, dest) { var COMPONENTS = 3; alpha01 = alpha01 !== 1 ? 0 : alpha01; var xRatio = w1 / w2; var yRatio = h1 / h2; var i, j, @@ -3157,32 +3156,32 @@ var ColorSpace = function ColorSpaceClos dest[newIndex++] = src[oldIndex++]; dest[newIndex++] = src[oldIndex++]; dest[newIndex++] = src[oldIndex++]; newIndex += alpha01; } } } function ColorSpace() { - error('should not call ColorSpace constructor'); + (0, _util.error)('should not call ColorSpace constructor'); } ColorSpace.prototype = { getRgb: function ColorSpace_getRgb(src, srcOffset) { var rgb = new Uint8Array(3); this.getRgbItem(src, srcOffset, rgb, 0); return rgb; }, getRgbItem: function ColorSpace_getRgbItem(src, srcOffset, dest, destOffset) { - error('Should not call ColorSpace.getRgbItem'); + (0, _util.error)('Should not call ColorSpace.getRgbItem'); }, getRgbBuffer: function ColorSpace_getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { - error('Should not call ColorSpace.getRgbBuffer'); + (0, _util.error)('Should not call ColorSpace.getRgbBuffer'); }, getOutputLength: function ColorSpace_getOutputLength(inputLength, alpha01) { - error('Should not call ColorSpace.getOutputLength'); + (0, _util.error)('Should not call ColorSpace.getOutputLength'); }, isPassthrough: function ColorSpace_isPassthrough(bits) { return false; }, fillRgb: function ColorSpace_fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) { var count = originalWidth * originalHeight; var rgbBuf = null; var numComponentColors = 1 << bpc; @@ -3246,17 +3245,17 @@ var ColorSpace = function ColorSpaceClos ColorSpace.parse = function ColorSpace_parse(cs, xref, res) { var IR = ColorSpace.parseToIR(cs, xref, res); if (IR instanceof AlternateCS) { return IR; } return ColorSpace.fromIR(IR); }; ColorSpace.fromIR = function ColorSpace_fromIR(IR) { - var name = isArray(IR) ? IR[0] : IR; + var name = (0, _util.isArray)(IR) ? IR[0] : IR; var whitePoint, blackPoint, gamma; switch (name) { case 'DeviceGrayCS': return this.singletons.gray; case 'DeviceRgbCS': return this.singletons.rgb; case 'DeviceCmykCS': return this.singletons.cmyk; @@ -3281,55 +3280,55 @@ var ColorSpace = function ColorSpaceClos var baseIndexedCS = IR[1]; var hiVal = IR[2]; var lookup = IR[3]; return new IndexedCS(ColorSpace.fromIR(baseIndexedCS), hiVal, lookup); case 'AlternateCS': var numComps = IR[1]; var alt = IR[2]; var tintFnIR = IR[3]; - return new AlternateCS(numComps, ColorSpace.fromIR(alt), PDFFunction.fromIR(tintFnIR)); + return new AlternateCS(numComps, ColorSpace.fromIR(alt), _function.PDFFunction.fromIR(tintFnIR)); case 'LabCS': whitePoint = IR[1]; blackPoint = IR[2]; var range = IR[3]; return new LabCS(whitePoint, blackPoint, range); default: - error('Unknown name ' + name); + (0, _util.error)('Unknown name ' + name); } return null; }; ColorSpace.parseToIR = function ColorSpace_parseToIR(cs, xref, res) { - if (isName(cs)) { + if ((0, _primitives.isName)(cs)) { var colorSpaces = res.get('ColorSpace'); - if (isDict(colorSpaces)) { + if ((0, _primitives.isDict)(colorSpaces)) { var refcs = colorSpaces.get(cs.name); if (refcs) { cs = refcs; } } } cs = xref.fetchIfRef(cs); - if (isName(cs)) { + if ((0, _primitives.isName)(cs)) { switch (cs.name) { case 'DeviceGray': case 'G': return 'DeviceGrayCS'; case 'DeviceRGB': case 'RGB': return 'DeviceRgbCS'; case 'DeviceCMYK': case 'CMYK': return 'DeviceCmykCS'; case 'Pattern': return ['PatternCS', null]; default: - error('unrecognized colorspace ' + cs.name); - } - } else if (isArray(cs)) { + (0, _util.error)('unrecognized colorspace ' + cs.name); + } + } else if ((0, _util.isArray)(cs)) { var mode = xref.fetchIfRef(cs[0]).name; var numComps, params, alt, whitePoint, blackPoint, gamma; switch (mode) { case 'DeviceGray': case 'G': return 'DeviceGrayCS'; case 'DeviceRGB': case 'RGB': @@ -3356,17 +3355,17 @@ var ColorSpace = function ColorSpaceClos numComps = dict.get('N'); alt = dict.get('Alternate'); if (alt) { var altIR = ColorSpace.parseToIR(alt, xref, res); var altCS = ColorSpace.fromIR(altIR); if (altCS.numComps === numComps) { return altIR; } - warn('ICCBased color space: Ignoring incorrect /Alternate entry.'); + (0, _util.warn)('ICCBased color space: Ignoring incorrect /Alternate entry.'); } if (numComps === 1) { return 'DeviceGrayCS'; } else if (numComps === 3) { return 'DeviceRgbCS'; } else if (numComps === 4) { return 'DeviceCmykCS'; } @@ -3377,65 +3376,65 @@ var ColorSpace = function ColorSpaceClos basePatternCS = ColorSpace.parseToIR(basePatternCS, xref, res); } return ['PatternCS', basePatternCS]; case 'Indexed': case 'I': var baseIndexedCS = ColorSpace.parseToIR(cs[1], xref, res); var hiVal = xref.fetchIfRef(cs[2]) + 1; var lookup = xref.fetchIfRef(cs[3]); - if (isStream(lookup)) { + if ((0, _primitives.isStream)(lookup)) { lookup = lookup.getBytes(); } return ['IndexedCS', baseIndexedCS, hiVal, lookup]; case 'Separation': case 'DeviceN': var name = xref.fetchIfRef(cs[1]); - numComps = isArray(name) ? name.length : 1; + numComps = (0, _util.isArray)(name) ? name.length : 1; alt = ColorSpace.parseToIR(cs[2], xref, res); - var tintFnIR = PDFFunction.getIR(xref, xref.fetchIfRef(cs[3])); + var tintFnIR = _function.PDFFunction.getIR(xref, xref.fetchIfRef(cs[3])); return ['AlternateCS', numComps, alt, tintFnIR]; case 'Lab': params = xref.fetchIfRef(cs[1]); whitePoint = params.getArray('WhitePoint'); blackPoint = params.getArray('BlackPoint'); var range = params.getArray('Range'); return ['LabCS', whitePoint, blackPoint, range]; default: - error('unimplemented color space object "' + mode + '"'); - } - } else { - error('unrecognized color space object: "' + cs + '"'); + (0, _util.error)('unimplemented color space object "' + mode + '"'); + } + } else { + (0, _util.error)('unrecognized color space object: "' + cs + '"'); } return null; }; ColorSpace.isDefaultDecode = function ColorSpace_isDefaultDecode(decode, n) { - if (!isArray(decode)) { + if (!(0, _util.isArray)(decode)) { return true; } if (n * 2 !== decode.length) { - warn('The decode map is not the correct length'); + (0, _util.warn)('The decode map is not the correct length'); return true; } for (var i = 0, ii = decode.length; i < ii; i += 2) { if (decode[i] !== 0 || decode[i + 1] !== 1) { return false; } } return true; }; ColorSpace.singletons = { get gray() { - return shadow(this, 'gray', new DeviceGrayCS()); + return (0, _util.shadow)(this, 'gray', new DeviceGrayCS()); }, get rgb() { - return shadow(this, 'rgb', new DeviceRgbCS()); + return (0, _util.shadow)(this, 'rgb', new DeviceRgbCS()); }, get cmyk() { - return shadow(this, 'cmyk', new DeviceCmykCS()); + return (0, _util.shadow)(this, 'cmyk', new DeviceCmykCS()); } }; return ColorSpace; }(); var AlternateCS = function AlternateCSClosure() { function AlternateCS(numComps, base, tintFn) { this.name = 'Alternate'; this.numComps = numComps; @@ -3509,29 +3508,29 @@ var IndexedCS = function IndexedCSClosur function IndexedCS(base, highVal, lookup) { this.name = 'Indexed'; this.numComps = 1; this.defaultColor = new Uint8Array(this.numComps); this.base = base; this.highVal = highVal; var baseNumComps = base.numComps; var length = baseNumComps * highVal; - if (isStream(lookup)) { + if ((0, _primitives.isStream)(lookup)) { this.lookup = new Uint8Array(length); var bytes = lookup.getBytes(length); this.lookup.set(bytes); - } else if (isString(lookup)) { + } else if ((0, _util.isString)(lookup)) { this.lookup = new Uint8Array(length); for (var i = 0; i < length; ++i) { this.lookup[i] = lookup.charCodeAt(i); } } else if (lookup instanceof Uint8Array || lookup instanceof Array) { this.lookup = lookup; } else { - error('Unrecognized lookup table: ' + lookup); + (0, _util.error)('Unrecognized lookup table: ' + lookup); } } IndexedCS.prototype = { getRgb: ColorSpace.prototype.getRgb, getRgbItem: function IndexedCS_getRgbItem(src, srcOffset, dest, destOffset) { var numComps = this.base.numComps; var start = src[srcOffset] * numComps; this.base.getRgbItem(this.lookup, start, dest, destOffset); @@ -3686,39 +3685,39 @@ var DeviceCmykCS = function DeviceCmykCS return DeviceCmykCS; }(); var CalGrayCS = function CalGrayCSClosure() { function CalGrayCS(whitePoint, blackPoint, gamma) { this.name = 'CalGray'; this.numComps = 1; this.defaultColor = new Float32Array(this.numComps); if (!whitePoint) { - error('WhitePoint missing - required for color space CalGray'); + (0, _util.error)('WhitePoint missing - required for color space CalGray'); } blackPoint = blackPoint || [0, 0, 0]; gamma = gamma || 1; this.XW = whitePoint[0]; this.YW = whitePoint[1]; this.ZW = whitePoint[2]; this.XB = blackPoint[0]; this.YB = blackPoint[1]; this.ZB = blackPoint[2]; this.G = gamma; if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) { - error('Invalid WhitePoint components for ' + this.name + ', no fallback available'); + (0, _util.error)('Invalid WhitePoint components for ' + this.name + ', no fallback available'); } if (this.XB < 0 || this.YB < 0 || this.ZB < 0) { - info('Invalid BlackPoint for ' + this.name + ', falling back to default'); + (0, _util.info)('Invalid BlackPoint for ' + this.name + ', falling back to default'); this.XB = this.YB = this.ZB = 0; } if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) { - warn(this.name + ', BlackPoint: XB: ' + this.XB + ', YB: ' + this.YB + ', ZB: ' + this.ZB + ', only default values are supported.'); + (0, _util.warn)(this.name + ', BlackPoint: XB: ' + this.XB + ', YB: ' + this.YB + ', ZB: ' + this.ZB + ', only default values are supported.'); } if (this.G < 1) { - info('Invalid Gamma: ' + this.G + ' for ' + this.name + ', falling back to default'); + (0, _util.info)('Invalid Gamma: ' + this.G + ' for ' + this.name + ', falling back to default'); this.G = 1; } } function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) { var A = src[srcOffset] * scale; var AG = Math.pow(A, cs.G); var L = cs.YW * AG; var val = Math.max(295.8 * Math.pow(L, 0.333333333333333333) - 40.8, 0) | 0; @@ -3760,17 +3759,17 @@ var CalRGBCS = function CalRGBCSClosure( var tempConvertMatrix1 = new Float32Array(3); var tempConvertMatrix2 = new Float32Array(3); var DECODE_L_CONSTANT = Math.pow((8 + 16) / 116, 3) / 8.0; function CalRGBCS(whitePoint, blackPoint, gamma, matrix) { this.name = 'CalRGB'; this.numComps = 3; this.defaultColor = new Float32Array(this.numComps); if (!whitePoint) { - error('WhitePoint missing - required for color space CalRGB'); + (0, _util.error)('WhitePoint missing - required for color space CalRGB'); } blackPoint = blackPoint || new Float32Array(3); gamma = gamma || new Float32Array([1, 1, 1]); matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]); var XW = whitePoint[0]; var YW = whitePoint[1]; var ZW = whitePoint[2]; this.whitePoint = whitePoint; @@ -3786,28 +3785,28 @@ var CalRGBCS = function CalRGBCSClosure( this.MZA = matrix[2]; this.MXB = matrix[3]; this.MYB = matrix[4]; this.MZB = matrix[5]; this.MXC = matrix[6]; this.MYC = matrix[7]; this.MZC = matrix[8]; if (XW < 0 || ZW < 0 || YW !== 1) { - error('Invalid WhitePoint components for ' + this.name + ', no fallback available'); + (0, _util.error)('Invalid WhitePoint components for ' + this.name + ', no fallback available'); } if (XB < 0 || YB < 0 || ZB < 0) { - info('Invalid BlackPoint for ' + this.name + ' [' + XB + ', ' + YB + ', ' + ZB + '], falling back to default'); + (0, _util.info)('Invalid BlackPoint for ' + this.name + ' [' + XB + ', ' + YB + ', ' + ZB + '], falling back to default'); this.blackPoint = new Float32Array(3); } if (this.GR < 0 || this.GG < 0 || this.GB < 0) { - info('Invalid Gamma [' + this.GR + ', ' + this.GG + ', ' + this.GB + '] for ' + this.name + ', falling back to default'); + (0, _util.info)('Invalid Gamma [' + this.GR + ', ' + this.GG + ', ' + this.GB + '] for ' + this.name + ', falling back to default'); this.GR = this.GG = this.GB = 1; } if (this.MXA < 0 || this.MYA < 0 || this.MZA < 0 || this.MXB < 0 || this.MYB < 0 || this.MZB < 0 || this.MXC < 0 || this.MYC < 0 || this.MZC < 0) { - info('Invalid Matrix for ' + this.name + ' [' + this.MXA + ', ' + this.MYA + ', ' + this.MZA + this.MXB + ', ' + this.MYB + ', ' + this.MZB + this.MXC + ', ' + this.MYC + ', ' + this.MZC + '], falling back to default'); + (0, _util.info)('Invalid Matrix for ' + this.name + ' [' + this.MXA + ', ' + this.MYA + ', ' + this.MZA + this.MXB + ', ' + this.MYB + ', ' + this.MZB + this.MXC + ', ' + this.MYC + ', ' + this.MZC + '], falling back to default'); this.MXA = this.MYB = this.MZC = 1; this.MXB = this.MYA = this.MZA = this.MXC = this.MYC = this.MZB = 0; } } function matrixProduct(a, b, result) { result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2]; result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2]; @@ -3946,39 +3945,39 @@ var CalRGBCS = function CalRGBCSClosure( return CalRGBCS; }(); var LabCS = function LabCSClosure() { function LabCS(whitePoint, blackPoint, range) { this.name = 'Lab'; this.numComps = 3; this.defaultColor = new Float32Array(this.numComps); if (!whitePoint) { - error('WhitePoint missing - required for color space Lab'); + (0, _util.error)('WhitePoint missing - required for color space Lab'); } blackPoint = blackPoint || [0, 0, 0]; range = range || [-100, 100, -100, 100]; this.XW = whitePoint[0]; this.YW = whitePoint[1]; this.ZW = whitePoint[2]; this.amin = range[0]; this.amax = range[1]; this.bmin = range[2]; this.bmax = range[3]; this.XB = blackPoint[0]; this.YB = blackPoint[1]; this.ZB = blackPoint[2]; if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) { - error('Invalid WhitePoint components, no fallback available'); + (0, _util.error)('Invalid WhitePoint components, no fallback available'); } if (this.XB < 0 || this.YB < 0 || this.ZB < 0) { - info('Invalid BlackPoint, falling back to default'); + (0, _util.info)('Invalid BlackPoint, falling back to default'); this.XB = this.YB = this.ZB = 0; } if (this.amin > this.amax || this.bmin > this.bmax) { - info('Invalid Range, falling back to defaults'); + (0, _util.info)('Invalid Range, falling back to defaults'); this.amin = -100; this.amax = 100; this.bmin = -100; this.bmax = 100; } } function fn_g(x) { var result; @@ -4052,16 +4051,19 @@ exports.ColorSpace = ColorSpace; /***/ }), /* 4 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); var ExpertEncoding = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'space', 'exclamsmall', 'Hungarumlautsmall', '', 'dollaroldstyle', 'dollarsuperior', 'ampersandsmall', 'Acutesmall', 'parenleftsuperior', 'parenrightsuperior', 'twodotenleader', 'onedotenleader', 'comma', 'hyphen', 'period', 'fraction', 'zerooldstyle', 'oneoldstyle', 'twooldstyle', 'threeoldstyle', 'fouroldstyle', 'fiveoldstyle', 'sixoldstyle', 'sevenoldstyle', 'eightoldstyle', 'nineoldstyle', 'colon', 'semicolon', 'commasuperior', 'threequartersemdash', 'periodsuperior', 'questionsmall', '', 'asuperior', 'bsuperior', 'centsuperior', 'dsuperior', 'esuperior', '', '', 'isuperior', '', '', 'lsuperior', 'msuperior', 'nsuperior', 'osuperior', '', '', 'rsuperior', 'ssuperior', 'tsuperior', '', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'parenleftinferior', '', 'parenrightinferior', 'Circumflexsmall', 'hyphensuperior', 'Gravesmall', 'Asmall', 'Bsmall', 'Csmall', 'Dsmall', 'Esmall', 'Fsmall', 'Gsmall', 'Hsmall', 'Ismall', 'Jsmall', 'Ksmall', 'Lsmall', 'Msmall', 'Nsmall', 'Osmall', 'Psmall', 'Qsmall', 'Rsmall', 'Ssmall', 'Tsmall', 'Usmall', 'Vsmall', 'Wsmall', 'Xsmall', 'Ysmall', 'Zsmall', 'colonmonetary', 'onefitted', 'rupiah', 'Tildesmall', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'exclamdownsmall', 'centoldstyle', 'Lslashsmall', '', '', 'Scaronsmall', 'Zcaronsmall', 'Dieresissmall', 'Brevesmall', 'Caronsmall', '', 'Dotaccentsmall', '', '', 'Macronsmall', '', '', 'figuredash', 'hypheninferior', '', '', 'Ogoneksmall', 'Ringsmall', 'Cedillasmall', '', '', '', 'onequarter', 'onehalf', 'threequarters', 'questiondownsmall', 'oneeighth', 'threeeighths', 'fiveeighths', 'seveneighths', 'onethird', 'twothirds', '', '', 'zerosuperior', 'onesuperior', 'twosuperior', 'threesuperior', 'foursuperior', 'fivesuperior', 'sixsuperior', 'sevensuperior', 'eightsuperior', 'ninesuperior', 'zeroinferior', 'oneinferior', 'twoinferior', 'threeinferior', 'fourinferior', 'fiveinferior', 'sixinferior', 'seveninferior', 'eightinferior', 'nineinferior', 'centinferior', 'dollarinferior', 'periodinferior', 'commainferior', 'Agravesmall', 'Aacutesmall', 'Acircumflexsmall', 'Atildesmall', 'Adieresissmall', 'Aringsmall', 'AEsmall', 'Ccedillasmall', 'Egravesmall', 'Eacutesmall', 'Ecircumflexsmall', 'Edieresissmall', 'Igravesmall', 'Iacutesmall', 'Icircumflexsmall', 'Idieresissmall', 'Ethsmall', 'Ntildesmall', 'Ogravesmall', 'Oacutesmall', 'Ocircumflexsmall', 'Otildesmall', 'Odieresissmall', 'OEsmall', 'Oslashsmall', 'Ugravesmall', 'Uacutesmall', 'Ucircumflexsmall', 'Udieresissmall', 'Yacutesmall', 'Thornsmall', 'Ydieresissmall']; var MacExpertEncoding = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'space', 'exclamsmall', 'Hungarumlautsmall', 'centoldstyle', 'dollaroldstyle', 'dollarsuperior', 'ampersandsmall', 'Acutesmall', 'parenleftsuperior', 'parenrightsuperior', 'twodotenleader', 'onedotenleader', 'comma', 'hyphen', 'period', 'fraction', 'zerooldstyle', 'oneoldstyle', 'twooldstyle', 'threeoldstyle', 'fouroldstyle', 'fiveoldstyle', 'sixoldstyle', 'sevenoldstyle', 'eightoldstyle', 'nineoldstyle', 'colon', 'semicolon', '', 'threequartersemdash', '', 'questionsmall', '', '', '', '', 'Ethsmall', '', '', 'onequarter', 'onehalf', 'threequarters', 'oneeighth', 'threeeighths', 'fiveeighths', 'seveneighths', 'onethird', 'twothirds', '', '', '', '', '', '', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'parenleftinferior', '', 'parenrightinferior', 'Circumflexsmall', 'hypheninferior', 'Gravesmall', 'Asmall', 'Bsmall', 'Csmall', 'Dsmall', 'Esmall', 'Fsmall', 'Gsmall', 'Hsmall', 'Ismall', 'Jsmall', 'Ksmall', 'Lsmall', 'Msmall', 'Nsmall', 'Osmall', 'Psmall', 'Qsmall', 'Rsmall', 'Ssmall', 'Tsmall', 'Usmall', 'Vsmall', 'Wsmall', 'Xsmall', 'Ysmall', 'Zsmall', 'colonmonetary', 'onefitted', 'rupiah', 'Tildesmall', '', '', 'asuperior', 'centsuperior', '', '', '', '', 'Aacutesmall', 'Agravesmall', 'Acircumflexsmall', 'Adieresissmall', 'Atildesmall', 'Aringsmall', 'Ccedillasmall', 'Eacutesmall', 'Egravesmall', 'Ecircumflexsmall', 'Edieresissmall', 'Iacutesmall', 'Igravesmall', 'Icircumflexsmall', 'Idieresissmall', 'Ntildesmall', 'Oacutesmall', 'Ogravesmall', 'Ocircumflexsmall', 'Odieresissmall', 'Otildesmall', 'Uacutesmall', 'Ugravesmall', 'Ucircumflexsmall', 'Udieresissmall', '', 'eightsuperior', 'fourinferior', 'threeinferior', 'sixinferior', 'eightinferior', 'seveninferior', 'Scaronsmall', '', 'centinferior', 'twoinferior', '', 'Dieresissmall', '', 'Caronsmall', 'osuperior', 'fiveinferior', '', 'commainferior', 'periodinferior', 'Yacutesmall', '', 'dollarinferior', '', 'Thornsmall', '', 'nineinferior', 'zeroinferior', 'Zcaronsmall', 'AEsmall', 'Oslashsmall', 'questiondownsmall', 'oneinferior', 'Lslashsmall', '', '', '', '', '', '', 'Cedillasmall', '', '', '', '', '', 'OEsmall', 'figuredash', 'hyphensuperior', '', '', '', '', 'exclamdownsmall', '', 'Ydieresissmall', '', 'onesuperior', 'twosuperior', 'threesuperior', 'foursuperior', 'fivesuperior', 'sixsuperior', 'sevensuperior', 'ninesuperior', 'zerosuperior', '', 'esuperior', 'rsuperior', 'tsuperior', '', '', 'isuperior', 'ssuperior', 'dsuperior', '', '', '', '', '', 'lsuperior', 'Ogoneksmall', 'Brevesmall', 'Macronsmall', 'bsuperior', 'nsuperior', 'msuperior', 'commasuperior', 'periodsuperior', 'Dotaccentsmall', 'Ringsmall']; var MacRomanEncoding = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent', 'ampersand', 'quotesingle', 'parenleft', 'parenright', 'asterisk', 'plus', 'comma', 'hyphen', 'period', 'slash', 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', 'less', 'equal', 'greater', 'question', 'at', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'bracketleft', 'backslash', 'bracketright', 'asciicircum', 'underscore', 'grave', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'braceleft', 'bar', 'braceright', 'asciitilde', '', 'Adieresis', 'Aring', 'Ccedilla', 'Eacute', 'Ntilde', 'Odieresis', 'Udieresis', 'aacute', 'agrave', 'acircumflex', 'adieresis', 'atilde', 'aring', 'ccedilla', 'eacute', 'egrave', 'ecircumflex', 'edieresis', 'iacute', 'igrave', 'icircumflex', 'idieresis', 'ntilde', 'oacute', 'ograve', 'ocircumflex', 'odieresis', 'otilde', 'uacute', 'ugrave', 'ucircumflex', 'udieresis', 'dagger', 'degree', 'cent', 'sterling', 'section', 'bullet', 'paragraph', 'germandbls', 'registered', 'copyright', 'trademark', 'acute', 'dieresis', 'notequal', 'AE', 'Oslash', 'infinity', 'plusminus', 'lessequal', 'greaterequal', 'yen', 'mu', 'partialdiff', 'summation', 'product', 'pi', 'integral', 'ordfeminine', 'ordmasculine', 'Omega', 'ae', 'oslash', 'questiondown', 'exclamdown', 'logicalnot', 'radical', 'florin', 'approxequal', 'Delta', 'guillemotleft', 'guillemotright', 'ellipsis', 'space', 'Agrave', 'Atilde', 'Otilde', 'OE', 'oe', 'endash', 'emdash', 'quotedblleft', 'quotedblright', 'quoteleft', 'quoteright', 'divide', 'lozenge', 'ydieresis', 'Ydieresis', 'fraction', 'currency', 'guilsinglleft', 'guilsinglright', 'fi', 'fl', 'daggerdbl', 'periodcentered', 'quotesinglbase', 'quotedblbase', 'perthousand', 'Acircumflex', 'Ecircumflex', 'Aacute', 'Edieresis', 'Egrave', 'Iacute', 'Icircumflex', 'Idieresis', 'Igrave', 'Oacute', 'Ocircumflex', 'apple', 'Ograve', 'Uacute', 'Ucircumflex', 'Ugrave', 'dotlessi', 'circumflex', 'tilde', 'macron', 'breve', 'dotaccent', 'ring', 'cedilla', 'hungarumlaut', 'ogonek', 'caron']; var StandardEncoding = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent', 'ampersand', 'quoteright', 'parenleft', 'parenright', 'asterisk', 'plus', 'comma', 'hyphen', 'period', 'slash', 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', 'less', 'equal', 'greater', 'question', 'at', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'bracketleft', 'backslash', 'bracketright', 'asciicircum', 'underscore', 'quoteleft', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'braceleft', 'bar', 'braceright', 'asciitilde', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'exclamdown', 'cent', 'sterling', 'fraction', 'yen', 'florin', 'section', 'currency', 'quotesingle', 'quotedblleft', 'guillemotleft', 'guilsinglleft', 'guilsinglright', 'fi', 'fl', '', 'endash', 'dagger', 'daggerdbl', 'periodcentered', '', 'paragraph', 'bullet', 'quotesinglbase', 'quotedblbase', 'quotedblright', 'guillemotright', 'ellipsis', 'perthousand', '', 'questiondown', '', 'grave', 'acute', 'circumflex', 'tilde', 'macron', 'breve', 'dotaccent', 'dieresis', '', 'ring', 'cedilla', '', 'hungarumlaut', 'ogonek', 'caron', 'emdash', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'AE', '', 'ordfeminine', '', '', '', '', 'Lslash', 'Oslash', 'OE', 'ordmasculine', '', '', '', '', '', 'ae', '', '', '', 'dotlessi', '', '', 'lslash', 'oslash', 'oe', 'germandbls']; var WinAnsiEncoding = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent', 'ampersand', 'quotesingle', 'parenleft', 'parenright', 'asterisk', 'plus', 'comma', 'hyphen', 'period', 'slash', 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', 'less', 'equal', 'greater', 'question', 'at', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'bracketleft', 'backslash', 'bracketright', 'asciicircum', 'underscore', 'grave', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'braceleft', 'bar', 'braceright', 'asciitilde', 'bullet', 'Euro', 'bullet', 'quotesinglbase', 'florin', 'quotedblbase', 'ellipsis', 'dagger', 'daggerdbl', 'circumflex', 'perthousand', 'Scaron', 'guilsinglleft', 'OE', 'bullet', 'Zcaron', 'bullet', 'bullet', 'quoteleft', 'quoteright', 'quotedblleft', 'quotedblright', 'bullet', 'endash', 'emdash', 'tilde', 'trademark', 'scaron', 'guilsinglright', 'oe', 'bullet', 'zcaron', 'Ydieresis', 'space', 'exclamdown', 'cent', 'sterling', 'currency', 'yen', 'brokenbar', 'section', 'dieresis', 'copyright', 'ordfeminine', 'guillemotleft', 'logicalnot', 'hyphen', 'registered', 'macron', 'degree', 'plusminus', 'twosuperior', 'threesuperior', 'acute', 'mu', 'paragraph', 'periodcentered', 'cedilla', 'onesuperior', 'ordmasculine', 'guillemotright', 'onequarter', 'onehalf', 'threequarters', 'questiondown', 'Agrave', 'Aacute', 'Acircumflex', 'Atilde', 'Adieresis', 'Aring', 'AE', 'Ccedilla', 'Egrave', 'Eacute', 'Ecircumflex', 'Edieresis', 'Igrave', 'Iacute', 'Icircumflex', 'Idieresis', 'Eth', 'Ntilde', 'Ograve', 'Oacute', 'Ocircumflex', 'Otilde', 'Odieresis', 'multiply', 'Oslash', 'Ugrave', 'Uacute', 'Ucircumflex', 'Udieresis', 'Yacute', 'Thorn', 'germandbls', 'agrave', 'aacute', 'acircumflex', 'atilde', 'adieresis', 'aring', 'ae', 'ccedilla', 'egrave', 'eacute', 'ecircumflex', 'edieresis', 'igrave', 'iacute', 'icircumflex', 'idieresis', 'eth', 'ntilde', 'ograve', 'oacute', 'ocircumflex', 'otilde', 'odieresis', 'divide', 'oslash', 'ugrave', 'uacute', 'ucircumflex', 'udieresis', 'yacute', 'thorn', 'ydieresis']; var SymbolSetEncoding = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'space', 'exclam', 'universal', 'numbersign', 'existential', 'percent', 'ampersand', 'suchthat', 'parenleft', 'parenright', 'asteriskmath', 'plus', 'comma', 'minus', 'period', 'slash', 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', 'less', 'equal', 'greater', 'question', 'congruent', 'Alpha', 'Beta', 'Chi', 'Delta', 'Epsilon', 'Phi', 'Gamma', 'Eta', 'Iota', 'theta1', 'Kappa', 'Lambda', 'Mu', 'Nu', 'Omicron', 'Pi', 'Theta', 'Rho', 'Sigma', 'Tau', 'Upsilon', 'sigma1', 'Omega', 'Xi', 'Psi', 'Zeta', 'bracketleft', 'therefore', 'bracketright', 'perpendicular', 'underscore', 'radicalex', 'alpha', 'beta', 'chi', 'delta', 'epsilon', 'phi', 'gamma', 'eta', 'iota', 'phi1', 'kappa', 'lambda', 'mu', 'nu', 'omicron', 'pi', 'theta', 'rho', 'sigma', 'tau', 'upsilon', 'omega1', 'omega', 'xi', 'psi', 'zeta', 'braceleft', 'bar', 'braceright', 'similar', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'Euro', 'Upsilon1', 'minute', 'lessequal', 'fraction', 'infinity', 'florin', 'club', 'diamond', 'heart', 'spade', 'arrowboth', 'arrowleft', 'arrowup', 'arrowright', 'arrowdown', 'degree', 'plusminus', 'second', 'greaterequal', 'multiply', 'proportional', 'partialdiff', 'bullet', 'divide', 'notequal', 'equivalence', 'approxequal', 'ellipsis', 'arrowvertex', 'arrowhorizex', 'carriagereturn', 'aleph', 'Ifraktur', 'Rfraktur', 'weierstrass', 'circlemultiply', 'circleplus', 'emptyset', 'intersection', 'union', 'propersuperset', 'reflexsuperset', 'notsubset', 'propersubset', 'reflexsubset', 'element', 'notelement', 'angle', 'gradient', 'registerserif', 'copyrightserif', 'trademarkserif', 'product', 'radical', 'dotmath', 'logicalnot', 'logicaland', 'logicalor', 'arrowdblboth', 'arrowdblleft', 'arrowdblup', 'arrowdblright', 'arrowdbldown', 'lozenge', 'angleleft', 'registersans', 'copyrightsans', 'trademarksans', 'summation', 'parenlefttp', 'parenleftex', 'parenleftbt', 'bracketlefttp', 'bracketleftex', 'bracketleftbt', 'bracelefttp', 'braceleftmid', 'braceleftbt', 'braceex', '', 'angleright', 'integral', 'integraltp', 'integralex', 'integralbt', 'parenrighttp', 'parenrightex', 'parenrightbt', 'bracketrighttp', 'bracketrightex', 'bracketrightbt', 'bracerighttp', 'bracerightmid', 'bracerightbt']; var ZapfDingbatsEncoding = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'space', 'a1', 'a2', 'a202', 'a3', 'a4', 'a5', 'a119', 'a118', 'a117', 'a11', 'a12', 'a13', 'a14', 'a15', 'a16', 'a105', 'a17', 'a18', 'a19', 'a20', 'a21', 'a22', 'a23', 'a24', 'a25', 'a26', 'a27', 'a28', 'a6', 'a7', 'a8', 'a9', 'a10', 'a29', 'a30', 'a31', 'a32', 'a33', 'a34', 'a35', 'a36', 'a37', 'a38', 'a39', 'a40', 'a41', 'a42', 'a43', 'a44', 'a45', 'a46', 'a47', 'a48', 'a49', 'a50', 'a51', 'a52', 'a53', 'a54', 'a55', 'a56', 'a57', 'a58', 'a59', 'a60', 'a61', 'a62', 'a63', 'a64', 'a65', 'a66', 'a67', 'a68', 'a69', 'a70', 'a71', 'a72', 'a73', 'a74', 'a203', 'a75', 'a204', 'a76', 'a77', 'a78', 'a79', 'a81', 'a82', 'a83', 'a84', 'a97', 'a98', 'a99', 'a100', '', 'a89', 'a90', 'a93', 'a94', 'a91', 'a92', 'a205', 'a85', 'a206', 'a86', 'a87', 'a88', 'a95', 'a96', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'a101', 'a102', 'a103', 'a104', 'a106', 'a107', 'a108', 'a112', 'a111', 'a110', 'a109', 'a120', 'a121', 'a122', 'a123', 'a124', 'a125', 'a126', 'a127', 'a128', 'a129', 'a130', 'a131', 'a132', 'a133', 'a134', 'a135', 'a136', 'a137', 'a138', 'a139', 'a140', 'a141', 'a142', 'a143', 'a144', 'a145', 'a146', 'a147', 'a148', 'a149', 'a150', 'a151', 'a152', 'a153', 'a154', 'a155', 'a156', 'a157', 'a158', 'a159', 'a160', 'a161', 'a163', 'a164', 'a196', 'a165', 'a192', 'a166', 'a167', 'a168', 'a169', 'a170', 'a171', 'a172', 'a173', 'a162', 'a174', 'a175', 'a176', 'a177', 'a178', 'a179', 'a193', 'a180', 'a199', 'a181', 'a200', 'a182', '', 'a201', 'a183', 'a184', 'a197', 'a185', 'a194', 'a198', 'a186', 'a195', 'a187', 'a188', 'a189', 'a190', 'a191']; function getEncoding(encodingName) { @@ -4094,145 +4096,123 @@ exports.getEncoding = getEncoding; /***/ }), /* 5 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var sharedUtil = __w_pdfjs_require__(0); -var corePrimitives = __w_pdfjs_require__(1); -var coreStream = __w_pdfjs_require__(2); -var MissingDataException = sharedUtil.MissingDataException; -var StreamType = sharedUtil.StreamType; -var assert = sharedUtil.assert; -var error = sharedUtil.error; -var info = sharedUtil.info; -var isArray = sharedUtil.isArray; -var isInt = sharedUtil.isInt; -var isNum = sharedUtil.isNum; -var isString = sharedUtil.isString; -var warn = sharedUtil.warn; -var EOF = corePrimitives.EOF; -var Cmd = corePrimitives.Cmd; -var Dict = corePrimitives.Dict; -var Name = corePrimitives.Name; -var Ref = corePrimitives.Ref; -var isEOF = corePrimitives.isEOF; -var isCmd = corePrimitives.isCmd; -var isDict = corePrimitives.isDict; -var isName = corePrimitives.isName; -var Ascii85Stream = coreStream.Ascii85Stream; -var AsciiHexStream = coreStream.AsciiHexStream; -var CCITTFaxStream = coreStream.CCITTFaxStream; -var FlateStream = coreStream.FlateStream; -var Jbig2Stream = coreStream.Jbig2Stream; -var JpegStream = coreStream.JpegStream; -var JpxStream = coreStream.JpxStream; -var LZWStream = coreStream.LZWStream; -var NullStream = coreStream.NullStream; -var PredictorStream = coreStream.PredictorStream; -var RunLengthStream = coreStream.RunLengthStream; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.Parser = exports.Linearization = exports.Lexer = undefined; + +var _stream = __w_pdfjs_require__(2); + +var _util = __w_pdfjs_require__(0); + +var _primitives = __w_pdfjs_require__(1); + var MAX_LENGTH_TO_CACHE = 1000; var Parser = function ParserClosure() { function Parser(lexer, allowStreams, xref, recoveryMode) { this.lexer = lexer; this.allowStreams = allowStreams; this.xref = xref; this.recoveryMode = recoveryMode || false; this.imageCache = Object.create(null); this.refill(); } Parser.prototype = { refill: function Parser_refill() { this.buf1 = this.lexer.getObj(); this.buf2 = this.lexer.getObj(); }, shift: function Parser_shift() { - if (isCmd(this.buf2, 'ID')) { + if ((0, _primitives.isCmd)(this.buf2, 'ID')) { this.buf1 = this.buf2; this.buf2 = null; } else { this.buf1 = this.buf2; this.buf2 = this.lexer.getObj(); } }, tryShift: function Parser_tryShift() { try { this.shift(); return true; } catch (e) { - if (e instanceof MissingDataException) { + if (e instanceof _util.MissingDataException) { throw e; } return false; } }, getObj: function Parser_getObj(cipherTransform) { var buf1 = this.buf1; this.shift(); - if (buf1 instanceof Cmd) { + if (buf1 instanceof _primitives.Cmd) { switch (buf1.cmd) { case 'BI': return this.makeInlineImage(cipherTransform); case '[': var array = []; - while (!isCmd(this.buf1, ']') && !isEOF(this.buf1)) { + while (!(0, _primitives.isCmd)(this.buf1, ']') && !(0, _primitives.isEOF)(this.buf1)) { array.push(this.getObj(cipherTransform)); } - if (isEOF(this.buf1)) { + if ((0, _primitives.isEOF)(this.buf1)) { if (!this.recoveryMode) { - error('End of file inside array'); + (0, _util.error)('End of file inside array'); } return array; } this.shift(); return array; case '<<': - var dict = new Dict(this.xref); - while (!isCmd(this.buf1, '>>') && !isEOF(this.buf1)) { - if (!isName(this.buf1)) { - info('Malformed dictionary: key must be a name object'); + var dict = new _primitives.Dict(this.xref); + while (!(0, _primitives.isCmd)(this.buf1, '>>') && !(0, _primitives.isEOF)(this.buf1)) { + if (!(0, _primitives.isName)(this.buf1)) { + (0, _util.info)('Malformed dictionary: key must be a name object'); this.shift(); continue; } var key = this.buf1.name; this.shift(); - if (isEOF(this.buf1)) { + if ((0, _primitives.isEOF)(this.buf1)) { break; } dict.set(key, this.getObj(cipherTransform)); } - if (isEOF(this.buf1)) { + if ((0, _primitives.isEOF)(this.buf1)) { if (!this.recoveryMode) { - error('End of file inside dictionary'); + (0, _util.error)('End of file inside dictionary'); } return dict; } - if (isCmd(this.buf2, 'stream')) { + if ((0, _primitives.isCmd)(this.buf2, 'stream')) { return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict; } this.shift(); return dict; default: return buf1; } } - if (isInt(buf1)) { + if ((0, _util.isInt)(buf1)) { var num = buf1; - if (isInt(this.buf1) && isCmd(this.buf2, 'R')) { - var ref = new Ref(num, this.buf1); + if ((0, _util.isInt)(this.buf1) && (0, _primitives.isCmd)(this.buf2, 'R')) { + var ref = new _primitives.Ref(num, this.buf1); this.shift(); this.shift(); return ref; } return num; } - if (isString(buf1)) { + if ((0, _util.isString)(buf1)) { var str = buf1; if (cipherTransform) { str = cipherTransform.decryptString(str); } return str; } return buf1; }, @@ -4249,17 +4229,17 @@ var Parser = function ParserClosure() { n, followingBytes; while ((ch = stream.getByte()) !== -1) { if (state === 0) { state = ch === E ? 1 : 0; } else if (state === 1) { state = ch === I ? 2 : 0; } else { - assert(state === 2); + (0, _util.assert)(state === 2); if (ch === SPACE || ch === LF || ch === CR) { n = 5; followingBytes = stream.peekBytes(n); for (i = 0; i < n; i++) { ch = followingBytes[i]; if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7F)) { state = 0; break; @@ -4341,17 +4321,17 @@ var Parser = function ParserClosure() { break; } if (foundEOI) { break; } } length = stream.pos - startPos; if (b === -1) { - warn('Inline DCTDecode image stream: ' + 'EOI marker not found, searching for /EI/ instead.'); + (0, _util.warn)('Inline DCTDecode image stream: ' + 'EOI marker not found, searching for /EI/ instead.'); stream.skip(-length); return this.findDefaultInlineStreamEnd(stream); } this.inlineStreamSkipEI(stream); return length; }, findASCII85DecodeInlineStreamEnd: function Parser_findASCII85DecodeInlineStreamEnd(stream) { var TILDE = 0x7E, @@ -4362,17 +4342,17 @@ var Parser = function ParserClosure() { while ((ch = stream.getByte()) !== -1) { if (ch === TILDE && stream.peekByte() === GT) { stream.skip(); break; } } length = stream.pos - startPos; if (ch === -1) { - warn('Inline ASCII85Decode image stream: ' + 'EOD marker not found, searching for /EI/ instead.'); + (0, _util.warn)('Inline ASCII85Decode image stream: ' + 'EOD marker not found, searching for /EI/ instead.'); stream.skip(-length); return this.findDefaultInlineStreamEnd(stream); } this.inlineStreamSkipEI(stream); return length; }, findASCIIHexDecodeInlineStreamEnd: function Parser_findASCIIHexDecodeInlineStreamEnd(stream) { var GT = 0x3E; @@ -4381,17 +4361,17 @@ var Parser = function ParserClosure() { length; while ((ch = stream.getByte()) !== -1) { if (ch === GT) { break; } } length = stream.pos - startPos; if (ch === -1) { - warn('Inline ASCIIHexDecode image stream: ' + 'EOD marker not found, searching for /EI/ instead.'); + (0, _util.warn)('Inline ASCIIHexDecode image stream: ' + 'EOD marker not found, searching for /EI/ instead.'); stream.skip(-length); return this.findDefaultInlineStreamEnd(stream); } this.inlineStreamSkipEI(stream); return length; }, inlineStreamSkipEI: function Parser_inlineStreamSkipEI(stream) { var E = 0x45, @@ -4406,35 +4386,35 @@ var Parser = function ParserClosure() { } else if (state === 2) { break; } } }, makeInlineImage: function Parser_makeInlineImage(cipherTransform) { var lexer = this.lexer; var stream = lexer.stream; - var dict = new Dict(this.xref); - while (!isCmd(this.buf1, 'ID') && !isEOF(this.buf1)) { - if (!isName(this.buf1)) { - error('Dictionary key must be a name object'); + var dict = new _primitives.Dict(this.xref); + while (!(0, _primitives.isCmd)(this.buf1, 'ID') && !(0, _primitives.isEOF)(this.buf1)) { + if (!(0, _primitives.isName)(this.buf1)) { + (0, _util.error)('Dictionary key must be a name object'); } var key = this.buf1.name; this.shift(); - if (isEOF(this.buf1)) { + if ((0, _primitives.isEOF)(this.buf1)) { break; } dict.set(key, this.getObj(cipherTransform)); } var filter = dict.get('Filter', 'F'), filterName; - if (isName(filter)) { + if ((0, _primitives.isName)(filter)) { filterName = filter.name; - } else if (isArray(filter)) { + } else if ((0, _util.isArray)(filter)) { var filterZero = this.xref.fetchIfRef(filter[0]); - if (isName(filterZero)) { + if ((0, _primitives.isName)(filterZero)) { filterName = filterZero.name; } } var startPos = stream.pos, length, i, ii; if (filterName === 'DCTDecode' || filterName === 'DCT') { @@ -4454,48 +4434,48 @@ var Parser = function ParserClosure() { var a = 1; var b = 0; for (i = 0, ii = imageBytes.length; i < ii; ++i) { a += imageBytes[i] & 0xff; b += a; } adler32 = b % 65521 << 16 | a % 65521; if (this.imageCache.adler32 === adler32) { - this.buf2 = Cmd.get('EI'); + this.buf2 = _primitives.Cmd.get('EI'); this.shift(); this.imageCache[adler32].reset(); return this.imageCache[adler32]; } } if (cipherTransform) { imageStream = cipherTransform.createStream(imageStream, length); } imageStream = this.filter(imageStream, dict, length); imageStream.dict = dict; if (adler32 !== undefined) { imageStream.cacheKey = 'inline_' + length + '_' + adler32; this.imageCache[adler32] = imageStream; } - this.buf2 = Cmd.get('EI'); + this.buf2 = _primitives.Cmd.get('EI'); this.shift(); return imageStream; }, makeStream: function Parser_makeStream(dict, cipherTransform) { var lexer = this.lexer; var stream = lexer.stream; lexer.skipToNextLine(); var pos = stream.pos - 1; var length = dict.get('Length'); - if (!isInt(length)) { - info('Bad ' + length + ' attribute in stream'); + if (!(0, _util.isInt)(length)) { + (0, _util.info)('Bad ' + length + ' attribute in stream'); length = 0; } stream.pos = pos + length; lexer.nextChar(); - if (this.tryShift() && isCmd(this.buf2, 'endstream')) { + if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, 'endstream')) { this.shift(); } else { stream.pos = pos; var SCAN_BLOCK_SIZE = 2048; var ENDSTREAM_SIGNATURE_LENGTH = 9; var ENDSTREAM_SIGNATURE = [0x65, 0x6E, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6D]; var skipped = 0, found = false, @@ -4524,17 +4504,17 @@ var Parser = function ParserClosure() { skipped += i; stream.pos += i; break; } skipped += scanLength; stream.pos += scanLength; } if (!found) { - error('Missing endstream'); + (0, _util.error)('Missing endstream'); } length = skipped; lexer.nextChar(); this.shift(); this.shift(); } this.shift(); stream = stream.makeSubStream(pos, length, dict); @@ -4543,102 +4523,102 @@ var Parser = function ParserClosure() { } stream = this.filter(stream, dict, length); stream.dict = dict; return stream; }, filter: function Parser_filter(stream, dict, length) { var filter = dict.get('Filter', 'F'); var params = dict.get('DecodeParms', 'DP'); - if (isName(filter)) { - if (isArray(params)) { + if ((0, _primitives.isName)(filter)) { + if ((0, _util.isArray)(params)) { params = this.xref.fetchIfRef(params[0]); } return this.makeFilter(stream, filter.name, length, params); } var maybeLength = length; - if (isArray(filter)) { + if ((0, _util.isArray)(filter)) { var filterArray = filter; var paramsArray = params; for (var i = 0, ii = filterArray.length; i < ii; ++i) { filter = this.xref.fetchIfRef(filterArray[i]); - if (!isName(filter)) { - error('Bad filter name: ' + filter); + if (!(0, _primitives.isName)(filter)) { + (0, _util.error)('Bad filter name: ' + filter); } params = null; - if (isArray(paramsArray) && i in paramsArray) { + if ((0, _util.isArray)(paramsArray) && i in paramsArray) { params = this.xref.fetchIfRef(paramsArray[i]); } stream = this.makeFilter(stream, filter.name, maybeLength, params); maybeLength = null; } } return stream; }, makeFilter: function Parser_makeFilter(stream, name, maybeLength, params) { if (maybeLength === 0) { - warn('Empty "' + name + '" stream.'); - return new NullStream(stream); + (0, _util.warn)('Empty "' + name + '" stream.'); + return new _stream.NullStream(stream); } try { var xrefStreamStats = this.xref.stats.streamTypes; if (name === 'FlateDecode' || name === 'Fl') { - xrefStreamStats[StreamType.FLATE] = true; + xrefStreamStats[_util.StreamType.FLATE] = true; if (params) { - return new PredictorStream(new FlateStream(stream, maybeLength), maybeLength, params); - } - return new FlateStream(stream, maybeLength); + return new _stream.PredictorStream(new _stream.FlateStream(stream, maybeLength), maybeLength, params); + } + return new _stream.FlateStream(stream, maybeLength); } if (name === 'LZWDecode' || name === 'LZW') { - xrefStreamStats[StreamType.LZW] = true; + xrefStreamStats[_util.StreamType.LZW] = true; var earlyChange = 1; if (params) { if (params.has('EarlyChange')) { earlyChange = params.get('EarlyChange'); } - return new PredictorStream(new LZWStream(stream, maybeLength, earlyChange), maybeLength, params); - } - return new LZWStream(stream, maybeLength, earlyChange); + return new _stream.PredictorStream(new _stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params); + } + return new _stream.LZWStream(stream, maybeLength, earlyChange); } if (name === 'DCTDecode' || name === 'DCT') { - xrefStreamStats[StreamType.DCT] = true; - return new JpegStream(stream, maybeLength, stream.dict, params); + xrefStreamStats[_util.StreamType.DCT] = true; + return new _stream.JpegStream(stream, maybeLength, stream.dict, params); } if (name === 'JPXDecode' || name === 'JPX') { - xrefStreamStats[StreamType.JPX] = true; - return new JpxStream(stream, maybeLength, stream.dict, params); + xrefStreamStats[_util.StreamType.JPX] = true; + return new _stream.JpxStream(stream, maybeLength, stream.dict, params); } if (name === 'ASCII85Decode' || name === 'A85') { - xrefStreamStats[StreamType.A85] = true; - return new Ascii85Stream(stream, maybeLength); + xrefStreamStats[_util.StreamType.A85] = true; + return new _stream.Ascii85Stream(stream, maybeLength); } if (name === 'ASCIIHexDecode' || name === 'AHx') { - xrefStreamStats[StreamType.AHX] = true; - return new AsciiHexStream(stream, maybeLength); + xrefStreamStats[_util.StreamType.AHX] = true; + return new _stream.AsciiHexStream(stream, maybeLength); } if (name === 'CCITTFaxDecode' || name === 'CCF') { - xrefStreamStats[StreamType.CCF] = true; - return new CCITTFaxStream(stream, maybeLength, params); + xrefStreamStats[_util.StreamType.CCF] = true; + return new _stream.CCITTFaxStream(stream, maybeLength, params); } if (name === 'RunLengthDecode' || name === 'RL') { - xrefStreamStats[StreamType.RL] = true; - return new RunLengthStream(stream, maybeLength); + xrefStreamStats[_util.StreamType.RL] = true; + return new _stream.RunLengthStream(stream, maybeLength); } if (name === 'JBIG2Decode') { - xrefStreamStats[StreamType.JBIG] = true; - return new Jbig2Stream(stream, maybeLength, stream.dict, params); - } - warn('filter "' + name + '" not supported yet'); + xrefStreamStats[_util.StreamType.JBIG] = true; + return new _stream.Jbig2Stream(stream, maybeLength, stream.dict, params); + } + (0, _util.warn)('filter "' + name + '" not supported yet'); return stream; } catch (ex) { - if (ex instanceof MissingDataException) { + if (ex instanceof _util.MissingDataException) { throw ex; } - warn('Invalid stream: \"' + ex + '\"'); - return new NullStream(stream); + (0, _util.warn)('Invalid stream: \"' + ex + '\"'); + return new _stream.NullStream(stream); } } }; return Parser; }(); var Lexer = function LexerClosure() { function Lexer(stream, knownCommands) { this.stream = stream; @@ -4682,17 +4662,17 @@ var Lexer = function LexerClosure() { ch = this.nextChar(); } if (ch === 0x0A || ch === 0x0D) { do { ch = this.nextChar(); } while (ch === 0x0A || ch === 0x0D); } if (ch < 0x30 || ch > 0x39) { - error(`Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`); + (0, _util.error)(`Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`); } var baseValue = ch - 0x30; var powerValue = 0; var powerValueSign = 1; while ((ch = this.nextChar()) >= 0) { if (0x30 <= ch && ch <= 0x39) { var currentDigit = ch - 0x30; if (eNotation) { @@ -4705,17 +4685,17 @@ var Lexer = function LexerClosure() { } } else if (ch === 0x2E) { if (divideBy === 0) { divideBy = 1; } else { break; } } else if (ch === 0x2D) { - warn('Badly formatted number'); + (0, _util.warn)('Badly formatted number'); } else if (ch === 0x45 || ch === 0x65) { ch = this.peekChar(); if (ch === 0x2B || ch === 0x2D) { powerValueSign = ch === 0x2D ? -1 : 1; this.nextChar(); } else if (ch < 0x30 || ch > 0x39) { break; } @@ -4737,17 +4717,17 @@ var Lexer = function LexerClosure() { var done = false; var strBuf = this.strBuf; strBuf.length = 0; var ch = this.nextChar(); while (true) { var charBuffered = false; switch (ch | 0) { case -1: - warn('Unterminated string'); + (0, _util.warn)('Unterminated string'); done = true; break; case 0x28: ++numParen; strBuf.push('('); break; case 0x29: if (--numParen === 0) { @@ -4756,17 +4736,17 @@ var Lexer = function LexerClosure() { } else { strBuf.push(')'); } break; case 0x5C: ch = this.nextChar(); switch (ch) { case -1: - warn('Unterminated string'); + (0, _util.warn)('Unterminated string'); done = true; break; case 0x6E: strBuf.push('\n'); break; case 0x72: strBuf.push('\r'); break; @@ -4833,93 +4813,93 @@ var Lexer = function LexerClosure() { getName: function Lexer_getName() { var ch, previousCh; var strBuf = this.strBuf; strBuf.length = 0; while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) { if (ch === 0x23) { ch = this.nextChar(); if (specialChars[ch]) { - warn('Lexer_getName: ' + 'NUMBER SIGN (#) should be followed by a hexadecimal number.'); + (0, _util.warn)('Lexer_getName: ' + 'NUMBER SIGN (#) should be followed by a hexadecimal number.'); strBuf.push('#'); break; } var x = toHexDigit(ch); if (x !== -1) { previousCh = ch; ch = this.nextChar(); var x2 = toHexDigit(ch); if (x2 === -1) { - warn('Lexer_getName: Illegal digit (' + String.fromCharCode(ch) + ') in hexadecimal number.'); + (0, _util.warn)('Lexer_getName: Illegal digit (' + String.fromCharCode(ch) + ') in hexadecimal number.'); strBuf.push('#', String.fromCharCode(previousCh)); if (specialChars[ch]) { break; } strBuf.push(String.fromCharCode(ch)); continue; } strBuf.push(String.fromCharCode(x << 4 | x2)); } else { strBuf.push('#', String.fromCharCode(ch)); } } else { strBuf.push(String.fromCharCode(ch)); } } if (strBuf.length > 127) { - warn('name token is longer than allowed by the spec: ' + strBuf.length); - } - return Name.get(strBuf.join('')); + (0, _util.warn)('name token is longer than allowed by the spec: ' + strBuf.length); + } + return _primitives.Name.get(strBuf.join('')); }, getHexString: function Lexer_getHexString() { var strBuf = this.strBuf; strBuf.length = 0; var ch = this.currentChar; var isFirstHex = true; var firstDigit; var secondDigit; while (true) { if (ch < 0) { - warn('Unterminated hex string'); + (0, _util.warn)('Unterminated hex string'); break; } else if (ch === 0x3E) { this.nextChar(); break; } else if (specialChars[ch] === 1) { ch = this.nextChar(); continue; } else { if (isFirstHex) { firstDigit = toHexDigit(ch); if (firstDigit === -1) { - warn('Ignoring invalid character "' + ch + '" in hex string'); + (0, _util.warn)('Ignoring invalid character "' + ch + '" in hex string'); ch = this.nextChar(); continue; } } else { secondDigit = toHexDigit(ch); if (secondDigit === -1) { - warn('Ignoring invalid character "' + ch + '" in hex string'); + (0, _util.warn)('Ignoring invalid character "' + ch + '" in hex string'); ch = this.nextChar(); continue; } strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit)); } isFirstHex = !isFirstHex; ch = this.nextChar(); } } return strBuf.join(''); }, getObj: function Lexer_getObj() { var comment = false; var ch = this.currentChar; while (true) { if (ch < 0) { - return EOF; + return _primitives.EOF; } if (comment) { if (ch === 0x0A || ch === 0x0D) { comment = false; } } else if (ch === 0x25) { comment = true; } else if (specialChars[ch] !== 1) { @@ -4943,69 +4923,69 @@ var Lexer = function LexerClosure() { case 0x2E: return this.getNumber(); case 0x28: return this.getString(); case 0x2F: return this.getName(); case 0x5B: this.nextChar(); - return Cmd.get('['); + return _primitives.Cmd.get('['); case 0x5D: this.nextChar(); - return Cmd.get(']'); + return _primitives.Cmd.get(']'); case 0x3C: ch = this.nextChar(); if (ch === 0x3C) { this.nextChar(); - return Cmd.get('<<'); + return _primitives.Cmd.get('<<'); } return this.getHexString(); case 0x3E: ch = this.nextChar(); if (ch === 0x3E) { this.nextChar(); - return Cmd.get('>>'); - } - return Cmd.get('>'); + return _primitives.Cmd.get('>>'); + } + return _primitives.Cmd.get('>'); case 0x7B: this.nextChar(); - return Cmd.get('{'); + return _primitives.Cmd.get('{'); case 0x7D: this.nextChar(); - return Cmd.get('}'); + return _primitives.Cmd.get('}'); case 0x29: this.nextChar(); - error('Illegal character: ' + ch); + (0, _util.error)('Illegal character: ' + ch); break; } var str = String.fromCharCode(ch); var knownCommands = this.knownCommands; var knownCommandFound = knownCommands && knownCommands[str] !== undefined; while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) { var possibleCommand = str + String.fromCharCode(ch); if (knownCommandFound && knownCommands[possibleCommand] === undefined) { break; } if (str.length === 128) { - error('Command token too long: ' + str.length); + (0, _util.error)('Command token too long: ' + str.length); } str = possibleCommand; knownCommandFound = knownCommands && knownCommands[str] !== undefined; } if (str === 'true') { return true; } if (str === 'false') { return false; } if (str === 'null') { return null; } - return Cmd.get(str); + return _primitives.Cmd.get(str); }, skipToNextLine: function Lexer_skipToNextLine() { var ch = this.currentChar; while (ch >= 0) { if (ch === 0x0D) { ch = this.nextChar(); if (ch === 0x0A) { this.nextChar(); @@ -5020,42 +5000,42 @@ var Lexer = function LexerClosure() { } }; return Lexer; }(); var Linearization = { create: function LinearizationCreate(stream) { function getInt(name, allowZeroValue) { var obj = linDict.get(name); - if (isInt(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) { + if ((0, _util.isInt)(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) { return obj; } throw new Error('The "' + name + '" parameter in the linearization ' + 'dictionary is invalid.'); } function getHints() { var hints = linDict.get('H'), hintsLength, item; - if (isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) { + if ((0, _util.isArray)(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) { for (var index = 0; index < hintsLength; index++) { - if (!(isInt(item = hints[index]) && item > 0)) { + if (!((0, _util.isInt)(item = hints[index]) && item > 0)) { throw new Error('Hint (' + index + ') in the linearization dictionary is invalid.'); } } return hints; } throw new Error('Hint array in the linearization dictionary is invalid.'); } var parser = new Parser(new Lexer(stream), false, null); var obj1 = parser.getObj(); var obj2 = parser.getObj(); var obj3 = parser.getObj(); var linDict = parser.getObj(); var obj, length; - if (!(isInt(obj1) && isInt(obj2) && isCmd(obj3, 'obj') && isDict(linDict) && isNum(obj = linDict.get('Linearized')) && obj > 0)) { + if (!((0, _util.isInt)(obj1) && (0, _util.isInt)(obj2) && (0, _primitives.isCmd)(obj3, 'obj') && (0, _primitives.isDict)(linDict) && (0, _util.isNum)(obj = linDict.get('Linearized')) && obj > 0)) { return null; } else if ((length = getInt('L')) !== stream.length) { throw new Error('The "L" parameter in the linearization dictionary ' + 'does not equal the stream length.'); } return { length, hints: getHints(), objectNumberFirst: getInt('O'), @@ -5069,20 +5049,17 @@ var Linearization = { exports.Lexer = Lexer; exports.Linearization = Linearization; exports.Parser = Parser; /***/ }), /* 6 */ /***/ (function(module, exports, __w_pdfjs_require__) { -"use strict"; - -var sharedUtil = __w_pdfjs_require__(0); -var getLookupTableFactory = sharedUtil.getLookupTableFactory; +var getLookupTableFactory = __w_pdfjs_require__(0).getLookupTableFactory; var getGlyphsUnicode = getLookupTableFactory(function (t) { t['A'] = 0x0041; t['AE'] = 0x00C6; t['AEacute'] = 0x01FC; t['AEmacron'] = 0x01E2; t['AEsmall'] = 0xF7E6; t['Aacute'] = 0x00C1; t['Aacutesmall'] = 0xF7E1; @@ -9611,27 +9588,27 @@ exports.getDingbatsGlyphsUnicode = getDi /***/ }), /* 7 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var sharedUtil = __w_pdfjs_require__(0); -var corePrimitives = __w_pdfjs_require__(1); -var corePsParser = __w_pdfjs_require__(33); -var error = sharedUtil.error; -var info = sharedUtil.info; -var isArray = sharedUtil.isArray; -var isBool = sharedUtil.isBool; -var isDict = corePrimitives.isDict; -var isStream = corePrimitives.isStream; -var PostScriptLexer = corePsParser.PostScriptLexer; -var PostScriptParser = corePsParser.PostScriptParser; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PostScriptCompiler = exports.PostScriptEvaluator = exports.PDFFunction = exports.isPDFFunction = undefined; + +var _util = __w_pdfjs_require__(0); + +var _primitives = __w_pdfjs_require__(1); + +var _ps_parser = __w_pdfjs_require__(33); + var PDFFunction = function PDFFunctionClosure() { var CONSTRUCT_SAMPLED = 0; var CONSTRUCT_INTERPOLATED = 2; var CONSTRUCT_STICHED = 3; var CONSTRUCT_POSTSCRIPT = 4; return { getSampleArray: function PDFFunction_getSampleArray(size, outputSize, bps, str) { var i, ii; @@ -9662,17 +9639,17 @@ var PDFFunction = function PDFFunctionCl var dict = fn.dict; if (!dict) { dict = fn; } var types = [this.constructSampled, null, this.constructInterpolated, this.constructStiched, this.constructPostScript]; var typeNum = dict.get('FunctionType'); var typeFn = types[typeNum]; if (!typeFn) { - error('Unknown type of function'); + (0, _util.error)('Unknown type of function'); } return typeFn.call(this, fn, dict, xref); }, fromIR: function PDFFunction_fromIR(IR) { var type = IR[0]; switch (type) { case CONSTRUCT_SAMPLED: return this.constructSampledFromIR(IR); @@ -9684,17 +9661,17 @@ var PDFFunction = function PDFFunctionCl return this.constructPostScriptFromIR(IR); } }, parse: function PDFFunction_parse(xref, fn) { var IR = this.getIR(xref, fn); return this.fromIR(IR); }, parseArray: function PDFFunction_parseArray(xref, fnObj) { - if (!isArray(fnObj)) { + if (!(0, _util.isArray)(fnObj)) { return this.parse(xref, fnObj); } var fnArray = []; for (var j = 0, jj = fnObj.length; j < jj; j++) { var obj = xref.fetchIfRef(fnObj[j]); fnArray.push(PDFFunction.parse(xref, obj)); } return function (src, srcOffset, dest, destOffset) { @@ -9712,27 +9689,27 @@ var PDFFunction = function PDFFunctionCl out[index] = [arr[i], arr[i + 1]]; ++index; } return out; } var domain = dict.getArray('Domain'); var range = dict.getArray('Range'); if (!domain || !range) { - error('No domain or range'); + (0, _util.error)('No domain or range'); } var inputSize = domain.length / 2; var outputSize = range.length / 2; domain = toMultiArray(domain); range = toMultiArray(range); var size = dict.get('Size'); var bps = dict.get('BitsPerSample'); var order = dict.get('Order') || 1; if (order !== 1) { - info('No support for cubic spline interpolation: ' + order); + (0, _util.info)('No support for cubic spline interpolation: ' + order); } var encode = dict.getArray('Encode'); if (!encode) { encode = []; for (var i = 0; i < inputSize; ++i) { encode.push(0); encode.push(size[i] - 1); } @@ -9802,18 +9779,18 @@ var PDFFunction = function PDFFunctionCl dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]); } }; }, constructInterpolated: function PDFFunction_constructInterpolated(str, dict) { var c0 = dict.getArray('C0') || [0]; var c1 = dict.getArray('C1') || [1]; var n = dict.get('N'); - if (!isArray(c0) || !isArray(c1)) { - error('Illegal dictionary for interpolated function'); + if (!(0, _util.isArray)(c0) || !(0, _util.isArray)(c1)) { + (0, _util.error)('Illegal dictionary for interpolated function'); } var length = c0.length; var diff = []; for (var i = 0; i < length; ++i) { diff.push(c1[i] - c0[i]); } return [CONSTRUCT_INTERPOLATED, c0, diff, n]; }, @@ -9827,21 +9804,21 @@ var PDFFunction = function PDFFunctionCl for (var j = 0; j < length; ++j) { dest[destOffset + j] = c0[j] + x * diff[j]; } }; }, constructStiched: function PDFFunction_constructStiched(fn, dict, xref) { var domain = dict.getArray('Domain'); if (!domain) { - error('No domain'); + (0, _util.error)('No domain'); } var inputSize = domain.length / 2; if (inputSize !== 1) { - error('Bad domain for stiched function'); + (0, _util.error)('Bad domain for stiched function'); } var fnRefs = dict.get('Functions'); var fns = []; for (var i = 0, ii = fnRefs.length; i < ii; ++i) { fns.push(PDFFunction.getIR(xref, xref.fetchIfRef(fnRefs[i]))); } var bounds = dict.getArray('Bounds'); var encode = dict.getArray('Encode'); @@ -9885,35 +9862,35 @@ var PDFFunction = function PDFFunctionCl tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin); fns[i](tmpBuf, 0, dest, destOffset); }; }, constructPostScript: function PDFFunction_constructPostScript(fn, dict, xref) { var domain = dict.getArray('Domain'); var range = dict.getArray('Range'); if (!domain) { - error('No domain.'); + (0, _util.error)('No domain.'); } if (!range) { - error('No range.'); - } - var lexer = new PostScriptLexer(fn); - var parser = new PostScriptParser(lexer); + (0, _util.error)('No range.'); + } + var lexer = new _ps_parser.PostScriptLexer(fn); + var parser = new _ps_parser.PostScriptParser(lexer); var code = parser.parse(); return [CONSTRUCT_POSTSCRIPT, domain, range, code]; }, constructPostScriptFromIR: function PDFFunction_constructPostScriptFromIR(IR) { var domain = IR[1]; var range = IR[2]; var code = IR[3]; var compiled = new PostScriptCompiler().compile(code, domain, range); if (compiled) { return new Function('src', 'srcOffset', 'dest', 'destOffset', compiled); } - info('Unable to compile PS function'); + (0, _util.info)('Unable to compile PS function'); var numOutputs = range.length >> 1; var numInputs = domain.length >> 1; var evaluator = new PostScriptEvaluator(code); var cache = Object.create(null); var MAX_CACHE_SIZE = 2048 * 4; var cache_available = MAX_CACHE_SIZE; var tmpBuf = new Float32Array(numInputs); return function constructPostScriptFromIRResult(src, srcOffset, dest, destOffset) { @@ -9954,46 +9931,46 @@ var PDFFunction = function PDFFunctionCl }; } }; }(); function isPDFFunction(v) { var fnDict; if (typeof v !== 'object') { return false; - } else if (isDict(v)) { + } else if ((0, _primitives.isDict)(v)) { fnDict = v; - } else if (isStream(v)) { + } else if ((0, _primitives.isStream)(v)) { fnDict = v.dict; } else { return false; } return fnDict.has('FunctionType'); } var PostScriptStack = function PostScriptStackClosure() { var MAX_STACK_SIZE = 100; function PostScriptStack(initialStack) { this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0); } PostScriptStack.prototype = { push: function PostScriptStack_push(value) { if (this.stack.length >= MAX_STACK_SIZE) { - error('PostScript function stack overflow.'); + (0, _util.error)('PostScript function stack overflow.'); } this.stack.push(value); }, pop: function PostScriptStack_pop() { if (this.stack.length <= 0) { - error('PostScript function stack underflow.'); + (0, _util.error)('PostScript function stack underflow.'); } return this.stack.pop(); }, copy: function PostScriptStack_copy(n) { if (this.stack.length + n >= MAX_STACK_SIZE) { - error('PostScript function stack overflow.'); + (0, _util.error)('PostScript function stack overflow.'); } var stack = this.stack; for (var i = stack.length - n, j = n - 1; j >= 0; j--, i++) { stack.push(stack[i]); } }, index: function PostScriptStack_index(n) { this.push(this.stack[this.stack.length - n - 1]); @@ -10061,17 +10038,17 @@ var PostScriptEvaluator = function PostS case 'add': b = stack.pop(); a = stack.pop(); stack.push(a + b); break; case 'and': b = stack.pop(); a = stack.pop(); - if (isBool(a) && isBool(b)) { + if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) { stack.push(a && b); } else { stack.push(a & b); } break; case 'atan': a = stack.pop(); stack.push(Math.atan(a)); @@ -10184,26 +10161,26 @@ var PostScriptEvaluator = function PostS stack.push(a !== b); break; case 'neg': a = stack.pop(); stack.push(-a); break; case 'not': a = stack.pop(); - if (isBool(a)) { + if ((0, _util.isBool)(a)) { stack.push(!a); } else { stack.push(~a); } break; case 'or': b = stack.pop(); a = stack.pop(); - if (isBool(a) && isBool(b)) { + if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) { stack.push(a || b); } else { stack.push(a | b); } break; case 'pop': stack.pop(); break; @@ -10235,24 +10212,24 @@ var PostScriptEvaluator = function PostS case 'truncate': a = stack.pop(); a = a < 0 ? Math.ceil(a) : Math.floor(a); stack.push(a); break; case 'xor': b = stack.pop(); a = stack.pop(); - if (isBool(a) && isBool(b)) { + if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) { stack.push(a !== b); } else { stack.push(a ^ b); } break; default: - error('Unknown operator ' + operator); + (0, _util.error)('Unknown operator ' + operator); break; } } return stack.stack; } }; return PostScriptEvaluator; }(); @@ -10580,20 +10557,17 @@ exports.isPDFFunction = isPDFFunction; exports.PDFFunction = PDFFunction; exports.PostScriptEvaluator = PostScriptEvaluator; exports.PostScriptCompiler = PostScriptCompiler; /***/ }), /* 8 */ /***/ (function(module, exports, __w_pdfjs_require__) { -"use strict"; - -var sharedUtil = __w_pdfjs_require__(0); -var getLookupTableFactory = sharedUtil.getLookupTableFactory; +var getLookupTableFactory = __w_pdfjs_require__(0).getLookupTableFactory; var getSpecialPUASymbols = getLookupTableFactory(function (t) { t[63721] = 0x00A9; t[63193] = 0x00A9; t[63720] = 0x00AE; t[63194] = 0x00AE; t[63722] = 0x2122; t[63195] = 0x2122; t[63729] = 0x23A7; @@ -12561,16 +12535,19 @@ exports.getUnicodeForGlyph = getUnicodeF /***/ }), /* 9 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); var ArithmeticDecoder = function ArithmeticDecoderClosure() { var QeTable = [{ qe: 0x5601, nmps: 1, nlps: 1, switchFlag: 1 }, { qe: 0x3401, @@ -12898,32 +12875,27 @@ exports.ArithmeticDecoder = ArithmeticDe /***/ }), /* 10 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var sharedUtil = __w_pdfjs_require__(0); -var coreCharsets = __w_pdfjs_require__(21); -var coreEncodings = __w_pdfjs_require__(4); -var error = sharedUtil.error; -var info = sharedUtil.info; -var bytesToString = sharedUtil.bytesToString; -var warn = sharedUtil.warn; -var isArray = sharedUtil.isArray; -var Util = sharedUtil.Util; -var stringToBytes = sharedUtil.stringToBytes; -var assert = sharedUtil.assert; -var ISOAdobeCharset = coreCharsets.ISOAdobeCharset; -var ExpertCharset = coreCharsets.ExpertCharset; -var ExpertSubsetCharset = coreCharsets.ExpertSubsetCharset; -var StandardEncoding = coreEncodings.StandardEncoding; -var ExpertEncoding = coreEncodings.ExpertEncoding; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.CFFCompiler = exports.CFFPrivateDict = exports.CFFTopDict = exports.CFFCharset = exports.CFFIndex = exports.CFFStrings = exports.CFFHeader = exports.CFF = exports.CFFParser = exports.CFFStandardStrings = undefined; + +var _util = __w_pdfjs_require__(0); + +var _charsets = __w_pdfjs_require__(21); + +var _encodings = __w_pdfjs_require__(4); + var MAX_SUBR_NESTING = 10; var CFFStandardStrings = ['.notdef', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent', 'ampersand', 'quoteright', 'parenleft', 'parenright', 'asterisk', 'plus', 'comma', 'hyphen', 'period', 'slash', 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', 'less', 'equal', 'greater', 'question', 'at', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'bracketleft', 'backslash', 'bracketright', 'asciicircum', 'underscore', 'quoteleft', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'braceleft', 'bar', 'braceright', 'asciitilde', 'exclamdown', 'cent', 'sterling', 'fraction', 'yen', 'florin', 'section', 'currency', 'quotesingle', 'quotedblleft', 'guillemotleft', 'guilsinglleft', 'guilsinglright', 'fi', 'fl', 'endash', 'dagger', 'daggerdbl', 'periodcentered', 'paragraph', 'bullet', 'quotesinglbase', 'quotedblbase', 'quotedblright', 'guillemotright', 'ellipsis', 'perthousand', 'questiondown', 'grave', 'acute', 'circumflex', 'tilde', 'macron', 'breve', 'dotaccent', 'dieresis', 'ring', 'cedilla', 'hungarumlaut', 'ogonek', 'caron', 'emdash', 'AE', 'ordfeminine', 'Lslash', 'Oslash', 'OE', 'ordmasculine', 'ae', 'dotlessi', 'lslash', 'oslash', 'oe', 'germandbls', 'onesuperior', 'logicalnot', 'mu', 'trademark', 'Eth', 'onehalf', 'plusminus', 'Thorn', 'onequarter', 'divide', 'brokenbar', 'degree', 'thorn', 'threequarters', 'twosuperior', 'registered', 'minus', 'eth', 'multiply', 'threesuperior', 'copyright', 'Aacute', 'Acircumflex', 'Adieresis', 'Agrave', 'Aring', 'Atilde', 'Ccedilla', 'Eacute', 'Ecircumflex', 'Edieresis', 'Egrave', 'Iacute', 'Icircumflex', 'Idieresis', 'Igrave', 'Ntilde', 'Oacute', 'Ocircumflex', 'Odieresis', 'Ograve', 'Otilde', 'Scaron', 'Uacute', 'Ucircumflex', 'Udieresis', 'Ugrave', 'Yacute', 'Ydieresis', 'Zcaron', 'aacute', 'acircumflex', 'adieresis', 'agrave', 'aring', 'atilde', 'ccedilla', 'eacute', 'ecircumflex', 'edieresis', 'egrave', 'iacute', 'icircumflex', 'idieresis', 'igrave', 'ntilde', 'oacute', 'ocircumflex', 'odieresis', 'ograve', 'otilde', 'scaron', 'uacute', 'ucircumflex', 'udieresis', 'ugrave', 'yacute', 'ydieresis', 'zcaron', 'exclamsmall', 'Hungarumlautsmall', 'dollaroldstyle', 'dollarsuperior', 'ampersandsmall', 'Acutesmall', 'parenleftsuperior', 'parenrightsuperior', 'twodotenleader', 'onedotenleader', 'zerooldstyle', 'oneoldstyle', 'twooldstyle', 'threeoldstyle', 'fouroldstyle', 'fiveoldstyle', 'sixoldstyle', 'sevenoldstyle', 'eightoldstyle', 'nineoldstyle', 'commasuperior', 'threequartersemdash', 'periodsuperior', 'questionsmall', 'asuperior', 'bsuperior', 'centsuperior', 'dsuperior', 'esuperior', 'isuperior', 'lsuperior', 'msuperior', 'nsuperior', 'osuperior', 'rsuperior', 'ssuperior', 'tsuperior', 'ff', 'ffi', 'ffl', 'parenleftinferior', 'parenrightinferior', 'Circumflexsmall', 'hyphensuperior', 'Gravesmall', 'Asmall', 'Bsmall', 'Csmall', 'Dsmall', 'Esmall', 'Fsmall', 'Gsmall', 'Hsmall', 'Ismall', 'Jsmall', 'Ksmall', 'Lsmall', 'Msmall', 'Nsmall', 'Osmall', 'Psmall', 'Qsmall', 'Rsmall', 'Ssmall', 'Tsmall', 'Usmall', 'Vsmall', 'Wsmall', 'Xsmall', 'Ysmall', 'Zsmall', 'colonmonetary', 'onefitted', 'rupiah', 'Tildesmall', 'exclamdownsmall', 'centoldstyle', 'Lslashsmall', 'Scaronsmall', 'Zcaronsmall', 'Dieresissmall', 'Brevesmall', 'Caronsmall', 'Dotaccentsmall', 'Macronsmall', 'figuredash', 'hypheninferior', 'Ogoneksmall', 'Ringsmall', 'Cedillasmall', 'questiondownsmall', 'oneeighth', 'threeeighths', 'fiveeighths', 'seveneighths', 'onethird', 'twothirds', 'zerosuperior', 'foursuperior', 'fivesuperior', 'sixsuperior', 'sevensuperior', 'eightsuperior', 'ninesuperior', 'zeroinferior', 'oneinferior', 'twoinferior', 'threeinferior', 'fourinferior', 'fiveinferior', 'sixinferior', 'seveninferior', 'eightinferior', 'nineinferior', 'centinferior', 'dollarinferior', 'periodinferior', 'commainferior', 'Agravesmall', 'Aacutesmall', 'Acircumflexsmall', 'Atildesmall', 'Adieresissmall', 'Aringsmall', 'AEsmall', 'Ccedillasmall', 'Egravesmall', 'Eacutesmall', 'Ecircumflexsmall', 'Edieresissmall', 'Igravesmall', 'Iacutesmall', 'Icircumflexsmall', 'Idieresissmall', 'Ethsmall', 'Ntildesmall', 'Ogravesmall', 'Oacutesmall', 'Ocircumflexsmall', 'Otildesmall', 'Odieresissmall', 'OEsmall', 'Oslashsmall', 'Ugravesmall', 'Uacutesmall', 'Ucircumflexsmall', 'Udieresissmall', 'Yacutesmall', 'Thornsmall', 'Ydieresissmall', '001.000', '001.001', '001.002', '001.003', 'Black', 'Bold', 'Book', 'Light', 'Medium', 'Regular', 'Roman', 'Semibold']; var CFFParser = function CFFParserClosure() { var CharstringValidationData = [null, { id: 'hstem', min: 2, stackClearing: true, stem: true @@ -13194,19 +13166,19 @@ var CFFParser = function CFFParserClosur parseHeader: function CFFParser_parseHeader() { var bytes = this.bytes; var bytesLength = bytes.length; var offset = 0; while (offset < bytesLength && bytes[offset] !== 1) { ++offset; } if (offset >= bytesLength) { - error('Invalid CFF header'); + (0, _util.error)('Invalid CFF header'); } else if (offset !== 0) { - info('cff data is shifted'); + (0, _util.info)('cff data is shifted'); bytes = bytes.subarray(offset); this.bytes = bytes; } var major = bytes[0]; var minor = bytes[1]; var hdrSize = bytes[2]; var offSize = bytes[3]; var header = new CFFHeader(major, minor, hdrSize, offSize); @@ -13233,17 +13205,17 @@ var CFFParser = function CFFParserClosur return value; } else if (value >= 32 && value <= 246) { return value - 139; } else if (value >= 247 && value <= 250) { return (value - 247) * 256 + dict[pos++] + 108; } else if (value >= 251 && value <= 254) { return -((value - 251) * 256) - dict[pos++] - 108; } - warn('CFFParser_parseDict: "' + value + '" is a reserved command.'); + (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.'); return NaN; } function parseFloatOperand() { var str = ''; var eof = 15; var lookup = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', 'E', 'E-', null, '-']; var length = dict.length; while (pos < length) { @@ -13323,25 +13295,25 @@ var CFFParser = function CFFParserClosur continue; } if (c < 33 || c > 126 || c === 91 || c === 93 || c === 40 || c === 41 || c === 123 || c === 125 || c === 60 || c === 62 || c === 47 || c === 37 || c === 35) { data[j] = 95; continue; } data[j] = c; } - names.push(bytesToString(data)); + names.push((0, _util.bytesToString)(data)); } return names; }, parseStringIndex: function CFFParser_parseStringIndex(index) { var strings = new CFFStrings(); for (var i = 0, ii = index.count; i < ii; ++i) { var data = index.get(i); - strings.add(bytesToString(data)); + strings.add((0, _util.bytesToString)(data)); } return strings; }, createDict: function CFFParser_createDict(Type, dict, strings) { var cffDict = new Type(strings); for (var i = 0, ii = dict.length; i < ii; ++i) { var pair = dict[i]; var key = pair[0]; @@ -13402,29 +13374,29 @@ var CFFParser = function CFFParserClosur var subrsIndex; if (value === 10) { subrsIndex = localSubrIndex; } else { subrsIndex = globalSubrIndex; } if (!subrsIndex) { validationCommand = CharstringValidationData[value]; - warn('Missing subrsIndex for ' + validationCommand.id); + (0, _util.warn)('Missing subrsIndex for ' + validationCommand.id); return false; } var bias = 32768; if (subrsIndex.count < 1240) { bias = 107; } else if (subrsIndex.count < 33900) { bias = 1131; } var subrNumber = stack[--stackSize] + bias; if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) { validationCommand = CharstringValidationData[value]; - warn('Out of bounds subrIndex for ' + validationCommand.id); + (0, _util.warn)('Out of bounds subrIndex for ' + validationCommand.id); return false; } state.stackSize = stackSize; state.callDepth++; var valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex); if (!valid) { return false; } @@ -13438,27 +13410,27 @@ var CFFParser = function CFFParserClosur validationCommand = CharstringValidationData[value]; } if (validationCommand) { if (validationCommand.stem) { state.hints += stackSize >> 1; } if ('min' in validationCommand) { if (!state.undefStack && stackSize < validationCommand.min) { - warn('Not enough parameters for ' + validationCommand.id + '; actual: ' + stackSize + ', expected: ' + validationCommand.min); + (0, _util.warn)('Not enough parameters for ' + validationCommand.id + '; actual: ' + stackSize + ', expected: ' + validationCommand.min); return false; } } if (state.firstStackClearing && validationCommand.stackClearing) { state.firstStackClearing = false; stackSize -= validationCommand.min; if (stackSize >= 2 && validationCommand.stem) { stackSize %= 2; } else if (stackSize > 1) { - warn('Found too many parameters for stack-clearing command'); + (0, _util.warn)('Found too many parameters for stack-clearing command'); } if (stackSize > 0 && stack[stackSize - 1] >= 0) { state.width = stack[stackSize - 1]; } } if ('stackDelta' in validationCommand) { if ('stackFn' in validationCommand) { validationCommand.stackFn(stack, stackSize); @@ -13495,21 +13467,21 @@ var CFFParser = function CFFParserClosur seac: null, width: null }; var valid = true; var localSubrToUse = null; if (fdSelect && fdArray.length) { var fdIndex = fdSelect.getFDIndex(i); if (fdIndex === -1) { - warn('Glyph index is not in fd select.'); + (0, _util.warn)('Glyph index is not in fd select.'); valid = false; } if (fdIndex >= fdArray.length) { - warn('Invalid fd index for glyph index.'); + (0, _util.warn)('Invalid fd index for glyph index.'); valid = false; } if (valid) { localSubrToUse = fdArray[fdIndex].privateDict.subrsIndex; } } else if (localSubrIndex) { localSubrToUse = localSubrIndex; } @@ -13538,17 +13510,17 @@ var CFFParser = function CFFParserClosur parentDict.privateDict = privateDict; }, parsePrivateDict: function CFFParser_parsePrivateDict(parentDict) { if (!parentDict.hasName('Private')) { this.emptyPrivateDictionary(parentDict); return; } var privateOffset = parentDict.getByName('Private'); - if (!isArray(privateOffset) || privateOffset.length !== 2) { + if (!(0, _util.isArray)(privateOffset) || privateOffset.length !== 2) { parentDict.removeByName('Private'); return; } var size = privateOffset[0]; var offset = privateOffset[1]; if (size === 0 || offset >= this.bytes.length) { this.emptyPrivateDictionary(parentDict); return; @@ -13567,21 +13539,21 @@ var CFFParser = function CFFParserClosur this.emptyPrivateDictionary(parentDict); return; } var subrsIndex = this.parseIndex(relativeOffset); privateDict.subrsIndex = subrsIndex.obj; }, parseCharsets: function CFFParser_parseCharsets(pos, length, strings, cid) { if (pos === 0) { - return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, ISOAdobeCharset); + return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset); } else if (pos === 1) { - return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, ExpertCharset); + return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset); } else if (pos === 2) { - return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, ExpertSubsetCharset); + return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset); } var bytes = this.bytes; var start = pos; var format = bytes[pos++]; var charset = ['.notdef']; var id, count, i; length -= 1; switch (format) { @@ -13605,17 +13577,17 @@ var CFFParser = function CFFParserClosur id = bytes[pos++] << 8 | bytes[pos++]; count = bytes[pos++] << 8 | bytes[pos++]; for (i = 0; i <= count; i++) { charset.push(cid ? id++ : strings.get(id++)); } } break; default: - error('Unknown charset format'); + (0, _util.error)('Unknown charset format'); } var end = pos; var raw = bytes.subarray(start, end); return new CFFCharset(false, format, charset, raw); }, parseEncoding: function CFFParser_parseEncoding(pos, properties, strings, charset) { var encoding = Object.create(null); var bytes = this.bytes; @@ -13628,17 +13600,17 @@ var CFFParser = function CFFParserClosur var code = bytes[pos++]; var sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff); encoding[code] = charset.indexOf(strings.get(sid)); } } if (pos === 0 || pos === 1) { predefined = true; format = pos; - var baseEncoding = pos ? ExpertEncoding : StandardEncoding; + var baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding; for (i = 0, ii = charset.length; i < ii; i++) { var index = baseEncoding.indexOf(charset[i]); if (index !== -1) { encoding[index] = i; } } } else { var dataStart = pos; @@ -13657,17 +13629,17 @@ var CFFParser = function CFFParserClosur var start = bytes[pos++]; var left = bytes[pos++]; for (var j = start; j <= start + left; j++) { encoding[j] = gid++; } } break; default: - error('Unknown encoding format: ' + format + ' in CFF'); + (0, _util.error)('Unknown encoding format: ' + format + ' in CFF'); break; } var dataEnd = pos; if (format & 0x80) { bytes[dataStart] &= 0x7f; readSupplement(); } raw = bytes.subarray(dataStart, dataEnd); @@ -13691,37 +13663,37 @@ var CFFParser = function CFFParserClosur } rawBytes = bytes.subarray(start, pos); break; case 3: var rangesCount = bytes[pos++] << 8 | bytes[pos++]; for (i = 0; i < rangesCount; ++i) { var first = bytes[pos++] << 8 | bytes[pos++]; if (i === 0 && first !== 0) { - warn('parseFDSelect: The first range must have a first GID of 0' + ' -- trying to recover.'); + (0, _util.warn)('parseFDSelect: The first range must have a first GID of 0' + ' -- trying to recover.'); invalidFirstGID = true; first = 0; } var fdIndex = bytes[pos++]; var next = bytes[pos] << 8 | bytes[pos + 1]; for (var j = first; j < next; ++j) { fdSelect.push(fdIndex); } } pos += 2; rawBytes = bytes.subarray(start, pos); if (invalidFirstGID) { rawBytes[3] = rawBytes[4] = 0; } break; default: - error('parseFDSelect: Unknown format "' + format + '".'); - break; - } - assert(fdSelect.length === length, 'parseFDSelect: Invalid font data.'); + (0, _util.error)('parseFDSelect: Unknown format "' + format + '".'); + break; + } + (0, _util.assert)(fdSelect.length === length, 'parseFDSelect: Invalid font data.'); return new CFFFDSelect(fdSelect, rawBytes); } }; return CFFParser; }(); var CFF = function CFFClosure() { function CFF() { this.header = null; @@ -13810,39 +13782,39 @@ var CFFDict = function CFFDictClosure() return false; } var valueLength = value.length; if (valueLength === 0) { return true; } for (var i = 0; i < valueLength; i++) { if (isNaN(value[i])) { - warn('Invalid CFFDict value: "' + value + '" for key "' + key + '".'); + (0, _util.warn)('Invalid CFFDict value: "' + value + '" for key "' + key + '".'); return true; } } var type = this.types[key]; if (type === 'num' || type === 'sid' || type === 'offset') { value = value[0]; } this.values[key] = value; return true; }, setByName: function CFFDict_setByName(name, value) { if (!(name in this.nameToKeyMap)) { - error('Invalid dictionary name "' + name + '"'); + (0, _util.error)('Invalid dictionary name "' + name + '"'); } this.values[this.nameToKeyMap[name]] = value; }, hasName: function CFFDict_hasName(name) { return this.nameToKeyMap[name] in this.values; }, getByName: function CFFDict_getByName(name) { if (!(name in this.nameToKeyMap)) { - error('Invalid dictionary name "' + name + '"'); + (0, _util.error)('Invalid dictionary name "' + name + '"'); } var key = this.nameToKeyMap[name]; if (!(key in this.values)) { return this.defaults[key]; } return this.values[key]; }, removeByName: function CFFDict_removeByName(name) { @@ -13855,22 +13827,22 @@ var CFFDict = function CFFDictClosure() nameToKeyMap: {}, defaults: {}, types: {}, opcodes: {}, order: [] }; for (var i = 0, ii = layout.length; i < ii; ++i) { var entry = layout[i]; - var key = isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0]; + var key = (0, _util.isArray)(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0]; tables.keyToNameMap[key] = entry[1]; tables.nameToKeyMap[entry[1]] = key; tables.types[key] = entry[2]; tables.defaults[key] = entry[3]; - tables.opcodes[key] = isArray(entry[0]) ? entry[0] : [entry[0]]; + tables.opcodes[key] = (0, _util.isArray)(entry[0]) ? entry[0] : [entry[0]]; tables.order.push(key); } return tables; }; return CFFDict; }(); var CFFTopDict = function CFFTopDictClosure() { var layout = [[[12, 30], 'ROS', ['sid', 'sid', 'num'], null], [[12, 20], 'SyntheticBase', 'num', null], [0, 'version', 'sid', null], [1, 'Notice', 'sid', null], [[12, 0], 'Copyright', 'sid', null], [2, 'FullName', 'sid', null], [3, 'FamilyName', 'sid', null], [4, 'Weight', 'sid', null], [[12, 1], 'isFixedPitch', 'num', 0], [[12, 2], 'ItalicAngle', 'num', 0], [[12, 3], 'UnderlinePosition', 'num', -100], [[12, 4], 'UnderlineThickness', 'num', 50], [[12, 5], 'PaintType', 'num', 0], [[12, 6], 'CharstringType', 'num', 2], [[12, 7], 'FontMatrix', ['num', 'num', 'num', 'num', 'num', 'num'], [0.001, 0, 0, 0.001, 0, 0]], [13, 'UniqueID', 'num', null], [5, 'FontBBox', ['num', 'num', 'num', 'num'], [0, 0, 0, 0]], [[12, 8], 'StrokeWidth', 'num', 0], [14, 'XUID', 'array', null], [15, 'charset', 'offset', 0], [16, 'Encoding', 'offset', 0], [17, 'CharStrings', 'offset', 0], [18, 'Private', ['offset', 'offset'], null], [[12, 21], 'PostScript', 'sid', null], [[12, 22], 'BaseFontName', 'sid', null], [[12, 23], 'BaseFontBlend', 'delta', null], [[12, 31], 'CIDFontVersion', 'num', 0], [[12, 32], 'CIDFontRevision', 'num', 0], [[12, 33], 'CIDFontType', 'num', 0], [[12, 34], 'CIDCount', 'num', 8720], [[12, 35], 'UIDBase', 'num', null], [[12, 37], 'FDSelect', 'offset', null], [[12, 36], 'FDArray', 'offset', null], [[12, 38], 'FontName', 'sid', null]]; @@ -13941,40 +13913,40 @@ var CFFOffsetTracker = function CFFOffse this.offsets = Object.create(null); } CFFOffsetTracker.prototype = { isTracking: function CFFOffsetTracker_isTracking(key) { return key in this.offsets; }, track: function CFFOffsetTracker_track(key, location) { if (key in this.offsets) { - error('Already tracking location of ' + key); + (0, _util.error)('Already tracking location of ' + key); } this.offsets[key] = location; }, offset: function CFFOffsetTracker_offset(value) { for (var key in this.offsets) { this.offsets[key] += value; } }, setEntryLocation: function CFFOffsetTracker_setEntryLocation(key, values, output) { if (!(key in this.offsets)) { - error('Not tracking location of ' + key); + (0, _util.error)('Not tracking location of ' + key); } var data = output.data; var dataOffset = this.offsets[key]; var size = 5; for (var i = 0, ii = values.length; i < ii; ++i) { var offset0 = i * size + dataOffset; var offset1 = offset0 + 1; var offset2 = offset0 + 2; var offset3 = offset0 + 3; var offset4 = offset0 + 4; if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) { - error('writing to an offset that is not empty'); + (0, _util.error)('writing to an offset that is not empty'); } var value = values[i]; data[offset0] = 0x1d; data[offset1] = value >> 24 & 0xFF; data[offset2] = value >> 16 & 0xFF; data[offset3] = value >> 8 & 0xFF; data[offset4] = value & 0xFF; } @@ -14004,17 +13976,17 @@ var CFFCompiler = function CFFCompilerCl if (cff.isCIDFont) { if (cff.topDict.hasName('FontMatrix')) { var base = cff.topDict.getByName('FontMatrix'); cff.topDict.removeByName('FontMatrix'); for (var i = 0, ii = cff.fdArray.length; i < ii; i++) { var subDict = cff.fdArray[i]; var matrix = base.slice(0); if (subDict.hasName('FontMatrix')) { - matrix = Util.transform(matrix, subDict.getByName('FontMatrix')); + matrix = _util.Util.transform(matrix, subDict.getByName('FontMatrix')); } subDict.setByName('FontMatrix', matrix); } } } var compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont); output.add(compiled.output); var topDictTracker = compiled.trackers[0]; @@ -14109,17 +14081,17 @@ var CFFCompiler = function CFFCompilerCl return code; }, compileHeader: function CFFCompiler_compileHeader(header) { return [header.major, header.minor, header.hdrSize, header.offSize]; }, compileNameIndex: function CFFCompiler_compileNameIndex(names) { var nameIndex = new CFFIndex(); for (var i = 0, ii = names.length; i < ii; ++i) { - nameIndex.add(stringToBytes(names[i])); + nameIndex.add((0, _util.stringToBytes)(names[i])); } return this.compileIndex(nameIndex); }, compileTopDicts: function CFFCompiler_compileTopDicts(dicts, length, removeCidKeys) { var fontDictTrackers = []; var fdArrayIndex = new CFFIndex(); for (var i = 0, ii = dicts.length; i < ii; ++i) { var fontDict = dicts[i]; @@ -14140,17 +14112,17 @@ var CFFCompiler = function CFFCompilerCl return { trackers: fontDictTrackers, output: fdArrayIndex }; }, compilePrivateDicts: function CFFCompiler_compilePrivateDicts(dicts, trackers, output) { for (var i = 0, ii = dicts.length; i < ii; ++i) { var fontDict = dicts[i]; - assert(fontDict.privateDict && fontDict.hasName('Private'), 'There must be an private dictionary.'); + (0, _util.assert)(fontDict.privateDict && fontDict.hasName('Private'), 'There must be an private dictionary.'); var privateDict = fontDict.privateDict; var privateDictTracker = new CFFOffsetTracker(); var privateDictData = this.compileDict(privateDict, privateDictTracker); var outputLength = output.length; privateDictTracker.offset(outputLength); if (!privateDictData.length) { outputLength = 0; } @@ -14168,20 +14140,20 @@ var CFFCompiler = function CFFCompilerCl var order = dict.order; for (var i = 0; i < order.length; ++i) { var key = order[i]; if (!(key in dict.values)) { continue; } var values = dict.values[key]; var types = dict.types[key]; - if (!isArray(types)) { + if (!(0, _util.isArray)(types)) { types = [types]; } - if (!isArray(values)) { + if (!(0, _util.isArray)(values)) { values = [values]; } if (values.length === 0) { continue; } for (var j = 0, jj = types.length; j < jj; ++j) { var type = types[j]; var value = values[j]; @@ -14200,28 +14172,28 @@ var CFFCompiler = function CFFCompilerCl case 'array': case 'delta': out = out.concat(this.encodeNumber(value)); for (var k = 1, kk = values.length; k < kk; ++k) { out = out.concat(this.encodeNumber(values[k])); } break; default: - error('Unknown data type of ' + type); + (0, _util.error)('Unknown data type of ' + type); break; } } out = out.concat(dict.opcodes[key]); } return out; }, compileStringIndex: function CFFCompiler_compileStringIndex(strings) { var stringIndex = new CFFIndex(); for (var i = 0, ii = strings.length; i < ii; ++i) { - stringIndex.add(stringToBytes(strings[i])); + stringIndex.add((0, _util.stringToBytes)(strings[i])); } return this.compileIndex(stringIndex); }, compileGlobalSubrIndex: function CFFCompiler_compileGlobalSubrIndex() { var globalSubrIndex = this.cff.globalSubrIndex; this.out.writeByteArray(this.compileIndex(globalSubrIndex)); }, compileCharStrings: function CFFCompiler_compileCharStrings(charStrings) { @@ -14308,24 +14280,23 @@ exports.CFFCompiler = CFFCompiler; /***/ }), /* 11 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var sharedUtil = __w_pdfjs_require__(0); -var MissingDataException = sharedUtil.MissingDataException; -var arrayByteLength = sharedUtil.arrayByteLength; -var arraysToBytes = sharedUtil.arraysToBytes; -var assert = sharedUtil.assert; -var createPromiseCapability = sharedUtil.createPromiseCapability; -var isInt = sharedUtil.isInt; -var isEmptyObj = sharedUtil.isEmptyObj; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.ChunkedStreamManager = exports.ChunkedStream = undefined; + +var _util = __w_pdfjs_require__(0); + var ChunkedStream = function ChunkedStreamClosure() { function ChunkedStream(length, chunkSize, manager) { this.bytes = new Uint8Array(length); this.start = 0; this.pos = 0; this.end = length; this.chunkSize = chunkSize; this.loadedChunks = []; @@ -14348,19 +14319,19 @@ var ChunkedStream = function ChunkedStre getBaseStreams: function ChunkedStream_getBaseStreams() { return [this]; }, allChunksLoaded: function ChunkedStream_allChunksLoaded() { return this.numChunksLoaded === this.numChunks; }, onReceiveData: function ChunkedStream_onReceiveData(begin, chunk) { var end = begin + chunk.byteLength; - assert(begin % this.chunkSize === 0, 'Bad begin offset: ' + begin); + (0, _util.assert)(begin % this.chunkSize === 0, 'Bad begin offset: ' + begin); var length = this.bytes.length; - assert(end % this.chunkSize === 0 || end === length, 'Bad end offset: ' + end); + (0, _util.assert)(end % this.chunkSize === 0 || end === length, 'Bad end offset: ' + end); this.bytes.set(new Uint8Array(chunk), begin); var chunkSize = this.chunkSize; var beginChunk = Math.floor(begin / chunkSize); var endChunk = Math.floor((end - 1) / chunkSize) + 1; var curChunk; for (curChunk = beginChunk; curChunk < endChunk; ++curChunk) { if (!this.loadedChunks[curChunk]) { this.loadedChunks[curChunk] = true; @@ -14384,33 +14355,33 @@ var ChunkedStream = function ChunkedStre } }, ensureByte: function ChunkedStream_ensureByte(pos) { var chunk = Math.floor(pos / this.chunkSize); if (chunk === this.lastSuccessfulEnsureByteChunk) { return; } if (!this.loadedChunks[chunk]) { - throw new MissingDataException(pos, pos + 1); + throw new _util.MissingDataException(pos, pos + 1); } this.lastSuccessfulEnsureByteChunk = chunk; }, ensureRange: function ChunkedStream_ensureRange(begin, end) { if (begin >= end) { return; } if (end <= this.progressiveDataLength) { return; } var chunkSize = this.chunkSize; var beginChunk = Math.floor(begin / chunkSize); var endChunk = Math.floor((end - 1) / chunkSize) + 1; for (var chunk = beginChunk; chunk < endChunk; ++chunk) { if (!this.loadedChunks[chunk]) { - throw new MissingDataException(begin, end); + throw new _util.MissingDataException(begin, end); } } }, nextEmptyChunk: function ChunkedStream_nextEmptyChunk(beginChunk) { var chunk, numChunks = this.numChunks; for (var i = 0; i < numChunks; ++i) { chunk = (beginChunk + i) % numChunks; @@ -14531,17 +14502,17 @@ var ChunkedStreamManager = function Chun this.disableAutoFetch = args.disableAutoFetch; this.msgHandler = args.msgHandler; this.currRequestId = 0; this.chunksNeededByRequest = Object.create(null); this.requestsByChunk = Object.create(null); this.promisesByRequest = Object.create(null); this.progressiveDataLength = 0; this.aborted = false; - this._loadedStreamCapability = createPromiseCapability(); + this._loadedStreamCapability = (0, _util.createPromiseCapability)(); } ChunkedStreamManager.prototype = { onLoadedStream: function ChunkedStreamManager_getLoadedStream() { return this._loadedStreamCapability.promise; }, sendRequest: function ChunkedStreamManager_sendRequest(begin, end) { var rangeReader = this.pdfNetworkStream.getRangeReader(begin, end); if (!rangeReader.isStreamingSupported) { @@ -14551,24 +14522,24 @@ var ChunkedStreamManager = function Chun loaded = 0; var manager = this; var promise = new Promise(function (resolve, reject) { var readChunk = function (chunk) { try { if (!chunk.done) { var data = chunk.value; chunks.push(data); - loaded += arrayByteLength(data); + loaded += (0, _util.arrayByteLength)(data); if (rangeReader.isStreamingSupported) { manager.onProgress({ loaded }); } rangeReader.read().then(readChunk, reject); return; } - var chunkData = arraysToBytes(chunks); + var chunkData = (0, _util.arraysToBytes)(chunks); chunks = null; resolve(chunkData); } catch (e) { reject(e); } }; rangeReader.read().then(readChunk, reject); }); @@ -14592,20 +14563,20 @@ var ChunkedStreamManager = function Chun var i, ii; var chunksNeeded = Object.create(null); this.chunksNeededByRequest[requestId] = chunksNeeded; for (i = 0, ii = chunks.length; i < ii; i++) { if (!this.stream.hasChunk(chunks[i])) { chunksNeeded[chunks[i]] = true; } } - if (isEmptyObj(chunksNeeded)) { + if ((0, _util.isEmptyObj)(chunksNeeded)) { return Promise.resolve(); } - var capability = createPromiseCapability(); + var capability = (0, _util.createPromiseCapability)(); this.promisesByRequest[requestId] = capability; var chunksToRequest = []; for (var chunk in chunksNeeded) { chunk = chunk | 0; if (!(chunk in this.requestsByChunk)) { this.requestsByChunk[chunk] = []; chunksToRequest.push(chunk); } @@ -14708,33 +14679,33 @@ var ChunkedStreamManager = function Chun var requestIds = this.requestsByChunk[chunk] || []; delete this.requestsByChunk[chunk]; for (i = 0; i < requestIds.length; ++i) { requestId = requestIds[i]; var chunksNeeded = this.chunksNeededByRequest[requestId]; if (chunk in chunksNeeded) { delete chunksNeeded[chunk]; } - if (!isEmptyObj(chunksNeeded)) { + if (!(0, _util.isEmptyObj)(chunksNeeded)) { continue; } loadedRequests.push(requestId); } } - if (!this.disableAutoFetch && isEmptyObj(this.requestsByChunk)) { + if (!this.disableAutoFetch && (0, _util.isEmptyObj)(this.requestsByChunk)) { var nextEmptyChunk; if (this.stream.numChunksLoaded === 1) { var lastChunk = this.stream.numChunks - 1; if (!this.stream.hasChunk(lastChunk)) { nextEmptyChunk = lastChunk; } } else { nextEmptyChunk = this.stream.nextEmptyChunk(endChunk); } - if (isInt(nextEmptyChunk)) { + if ((0, _util.isInt)(nextEmptyChunk)) { this._requestChunks([nextEmptyChunk]); } } for (i = 0; i < loadedRequests.length; ++i) { requestId = loadedRequests[i]; var capability = this.promisesByRequest[requestId]; delete this.promisesByRequest[requestId]; capability.resolve(); @@ -14773,32 +14744,27 @@ exports.ChunkedStreamManager = ChunkedSt /***/ }), /* 12 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var sharedUtil = __w_pdfjs_require__(0); -var corePrimitives = __w_pdfjs_require__(1); -var coreStream = __w_pdfjs_require__(2); -var PasswordException = sharedUtil.PasswordException; -var PasswordResponses = sharedUtil.PasswordResponses; -var bytesToString = sharedUtil.bytesToString; -var warn = sharedUtil.warn; -var error = sharedUtil.error; -var assert = sharedUtil.assert; -var isInt = sharedUtil.isInt; -var stringToBytes = sharedUtil.stringToBytes; -var utf8StringToString = sharedUtil.utf8StringToString; -var Name = corePrimitives.Name; -var isName = corePrimitives.isName; -var isDict = corePrimitives.isDict; -var DecryptStream = coreStream.DecryptStream; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.calculateSHA512 = exports.calculateSHA384 = exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = undefined; + +var _util = __w_pdfjs_require__(0); + +var _primitives = __w_pdfjs_require__(1); + +var _stream = __w_pdfjs_require__(2); + var ARCFourCipher = function ARCFourCipherClosure() { function ARCFourCipher(key) { this.a = 0; this.b = 0; var s = new Uint8Array(256); var i, j = 0, tmp, @@ -16053,25 +16019,25 @@ var PDF20 = function PDF20Closure() { var CipherTransform = function CipherTransformClosure() { function CipherTransform(stringCipherConstructor, streamCipherConstructor) { this.StringCipherConstructor = stringCipherConstructor; this.StreamCipherConstructor = streamCipherConstructor; } CipherTransform.prototype = { createStream: function CipherTransform_createStream(stream, length) { var cipher = new this.StreamCipherConstructor(); - return new DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) { + return new _stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) { return cipher.decryptBlock(data, finalize); }); }, decryptString: function CipherTransform_decryptString(s) { var cipher = new this.StringCipherConstructor(); - var data = stringToBytes(s); + var data = (0, _util.stringToBytes)(s); data = cipher.decryptBlock(data, true); - return bytesToString(data); + return (0, _util.bytesToString)(data); } }; return CipherTransform; }(); var CipherTransformFactory = function CipherTransformFactoryClosure() { var defaultPasswordBytes = new Uint8Array([0x28, 0xBF, 0x4E, 0x5E, 0x4E, 0x75, 0x8A, 0x41, 0x64, 0x00, 0x4E, 0x56, 0xFF, 0xFA, 0x01, 0x08, 0x2E, 0x2E, 0x00, 0xB6, 0xD0, 0x68, 0x3E, 0x80, 0x2F, 0x0C, 0xA9, 0xFE, 0x64, 0x53, 0x69, 0x7A]); function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) { if (password) { @@ -16202,93 +16168,93 @@ var CipherTransformFactory = function Ci userPassword = cipher.encryptBlock(userPassword); } } else { cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes)); userPassword = cipher.encryptBlock(ownerPassword); } return userPassword; } - var identityName = Name.get('Identity'); + var identityName = _primitives.Name.get('Identity'); function CipherTransformFactory(dict, fileId, password) { var filter = dict.get('Filter'); - if (!isName(filter, 'Standard')) { - error('unknown encryption method'); + if (!(0, _primitives.isName)(filter, 'Standard')) { + (0, _util.error)('unknown encryption method'); } this.dict = dict; var algorithm = dict.get('V'); - if (!isInt(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) { - error('unsupported encryption algorithm'); + if (!(0, _util.isInt)(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) { + (0, _util.error)('unsupported encryption algorithm'); } this.algorithm = algorithm; var keyLength = dict.get('Length'); if (!keyLength) { if (algorithm <= 3) { keyLength = 40; } else { var cfDict = dict.get('CF'); var streamCryptoName = dict.get('StmF'); - if (isDict(cfDict) && isName(streamCryptoName)) { + if ((0, _primitives.isDict)(cfDict) && (0, _primitives.isName)(streamCryptoName)) { cfDict.suppressEncryption = true; var handlerDict = cfDict.get(streamCryptoName.name); keyLength = handlerDict && handlerDict.get('Length') || 128; if (keyLength < 40) { keyLength <<= 3; } } } } - if (!isInt(keyLength) || keyLength < 40 || keyLength % 8 !== 0) { - error('invalid key length'); - } - var ownerPassword = stringToBytes(dict.get('O')).subarray(0, 32); - var userPassword = stringToBytes(dict.get('U')).subarray(0, 32); + if (!(0, _util.isInt)(keyLength) || keyLength < 40 || keyLength % 8 !== 0) { + (0, _util.error)('invalid key length'); + } + var ownerPassword = (0, _util.stringToBytes)(dict.get('O')).subarray(0, 32); + var userPassword = (0, _util.stringToBytes)(dict.get('U')).subarray(0, 32); var flags = dict.get('P'); var revision = dict.get('R'); var encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get('EncryptMetadata') !== false; this.encryptMetadata = encryptMetadata; - var fileIdBytes = stringToBytes(fileId); + var fileIdBytes = (0, _util.stringToBytes)(fileId); var passwordBytes; if (password) { if (revision === 6) { try { - password = utf8StringToString(password); + password = (0, _util.utf8StringToString)(password); } catch (ex) { - warn('CipherTransformFactory: ' + 'Unable to convert UTF8 encoded password.'); - } - } - passwordBytes = stringToBytes(password); + (0, _util.warn)('CipherTransformFactory: ' + 'Unable to convert UTF8 encoded password.'); + } + } + passwordBytes = (0, _util.stringToBytes)(password); } var encryptionKey; if (algorithm !== 5) { encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata); } else { - var ownerValidationSalt = stringToBytes(dict.get('O')).subarray(32, 40); - var ownerKeySalt = stringToBytes(dict.get('O')).subarray(40, 48); - var uBytes = stringToBytes(dict.get('U')).subarray(0, 48); - var userValidationSalt = stringToBytes(dict.get('U')).subarray(32, 40); - var userKeySalt = stringToBytes(dict.get('U')).subarray(40, 48); - var ownerEncryption = stringToBytes(dict.get('OE')); - var userEncryption = stringToBytes(dict.get('UE')); - var perms = stringToBytes(dict.get('Perms')); + var ownerValidationSalt = (0, _util.stringToBytes)(dict.get('O')).subarray(32, 40); + var ownerKeySalt = (0, _util.stringToBytes)(dict.get('O')).subarray(40, 48); + var uBytes = (0, _util.stringToBytes)(dict.get('U')).subarray(0, 48); + var userValidationSalt = (0, _util.stringToBytes)(dict.get('U')).subarray(32, 40); + var userKeySalt = (0, _util.stringToBytes)(dict.get('U')).subarray(40, 48); + var ownerEncryption = (0, _util.stringToBytes)(dict.get('OE')); + var userEncryption = (0, _util.stringToBytes)(dict.get('UE')); + var perms = (0, _util.stringToBytes)(dict.get('Perms')); encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms); } if (!encryptionKey && !password) { - throw new PasswordException('No password given', PasswordResponses.NEED_PASSWORD); + throw new _util.PasswordException('No password given', _util.PasswordResponses.NEED_PASSWORD); } else if (!encryptionKey && password) { var decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength); encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata); } if (!encryptionKey) { - throw new PasswordException('Incorrect Password', PasswordResponses.INCORRECT_PASSWORD); + throw new _util.PasswordException('Incorrect Password', _util.PasswordResponses.INCORRECT_PASSWORD); } this.encryptionKey = encryptionKey; if (algorithm >= 4) { var cf = dict.get('CF'); - if (isDict(cf)) { + if ((0, _primitives.isDict)(cf)) { cf.suppressEncryption = true; } this.cf = cf; this.stmf = dict.get('StmF') || identityName; this.strf = dict.get('StrF') || identityName; this.eff = dict.get('EFF') || this.stmf; } } @@ -16309,17 +16275,17 @@ var CipherTransformFactory = function Ci key[i++] = 0x41; key[i++] = 0x6C; key[i++] = 0x54; } var hash = calculateMD5(key, 0, i); return hash.subarray(0, Math.min(encryptionKey.length + 5, 16)); } function buildCipherConstructor(cf, name, num, gen, key) { - assert(isName(name), 'Invalid crypt filter name.'); + (0, _util.assert)((0, _primitives.isName)(name), 'Invalid crypt filter name.'); var cryptFilter = cf.get(name.name); var cfm; if (cryptFilter !== null && cryptFilter !== undefined) { cfm = cryptFilter.get('CFM'); } if (!cfm || cfm.name === 'None') { return function cipherTransformFactoryBuildCipherConstructorNone() { return new NullCipher(); @@ -16335,17 +16301,17 @@ var CipherTransformFactory = function Ci return new AES128Cipher(buildObjectKey(num, gen, key, true)); }; } if (cfm.name === 'AESV3') { return function cipherTransformFactoryBuildCipherConstructorAESV3() { return new AES256Cipher(key); }; } - error('Unknown crypto method'); + (0, _util.error)('Unknown crypto method'); } CipherTransformFactory.prototype = { createCipherTransform: function CipherTransformFactory_createCipherTransform(num, gen) { if (this.algorithm === 4 || this.algorithm === 5) { return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey)); } var key = buildObjectKey(num, gen, this.encryptionKey, false); var cipherConstructor = function buildCipherCipherConstructor() { @@ -16369,138 +16335,99 @@ exports.calculateSHA512 = calculateSHA51 /***/ }), /* 13 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var sharedUtil = __w_pdfjs_require__(0); -var corePrimitives = __w_pdfjs_require__(1); -var coreStream = __w_pdfjs_require__(2); -var coreParser = __w_pdfjs_require__(5); -var coreImage = __w_pdfjs_require__(26); -var coreColorSpace = __w_pdfjs_require__(3); -var coreMurmurHash3 = __w_pdfjs_require__(30); -var coreFonts = __w_pdfjs_require__(25); -var coreFunction = __w_pdfjs_require__(7); -var corePattern = __w_pdfjs_require__(31); -var coreCMap = __w_pdfjs_require__(22); -var coreMetrics = __w_pdfjs_require__(29); -var coreBidi = __w_pdfjs_require__(20); -var coreEncodings = __w_pdfjs_require__(4); -var coreStandardFonts = __w_pdfjs_require__(16); -var coreUnicode = __w_pdfjs_require__(8); -var coreGlyphList = __w_pdfjs_require__(6); -var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX; -var IDENTITY_MATRIX = sharedUtil.IDENTITY_MATRIX; -var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES; -var ImageKind = sharedUtil.ImageKind; -var OPS = sharedUtil.OPS; -var NativeImageDecoding = sharedUtil.NativeImageDecoding; -var TextRenderingMode = sharedUtil.TextRenderingMode; -var CMapCompressionType = sharedUtil.CMapCompressionType; -var Util = sharedUtil.Util; -var assert = sharedUtil.assert; -var createPromiseCapability = sharedUtil.createPromiseCapability; -var error = sharedUtil.error; -var info = sharedUtil.info; -var isArray = sharedUtil.isArray; -var isNum = sharedUtil.isNum; -var isString = sharedUtil.isString; -var getLookupTableFactory = sharedUtil.getLookupTableFactory; -var warn = sharedUtil.warn; -var Dict = corePrimitives.Dict; -var Name = corePrimitives.Name; -var isEOF = corePrimitives.isEOF; -var isCmd = corePrimitives.isCmd; -var isDict = corePrimitives.isDict; -var isName = corePrimitives.isName; -var isRef = corePrimitives.isRef; -var isStream = corePrimitives.isStream; -var DecodeStream = coreStream.DecodeStream; -var JpegStream = coreStream.JpegStream; -var Stream = coreStream.Stream; -var Lexer = coreParser.Lexer; -var Parser = coreParser.Parser; -var PDFImage = coreImage.PDFImage; -var ColorSpace = coreColorSpace.ColorSpace; -var MurmurHash3_64 = coreMurmurHash3.MurmurHash3_64; -var ErrorFont = coreFonts.ErrorFont; -var FontFlags = coreFonts.FontFlags; -var Font = coreFonts.Font; -var IdentityToUnicodeMap = coreFonts.IdentityToUnicodeMap; -var ToUnicodeMap = coreFonts.ToUnicodeMap; -var getFontType = coreFonts.getFontType; -var isPDFFunction = coreFunction.isPDFFunction; -var PDFFunction = coreFunction.PDFFunction; -var Pattern = corePattern.Pattern; -var getTilingPatternIR = corePattern.getTilingPatternIR; -var CMapFactory = coreCMap.CMapFactory; -var IdentityCMap = coreCMap.IdentityCMap; -var getMetrics = coreMetrics.getMetrics; -var bidi = coreBidi.bidi; -var WinAnsiEncoding = coreEncodings.WinAnsiEncoding; -var StandardEncoding = coreEncodings.StandardEncoding; -var MacRomanEncoding = coreEncodings.MacRomanEncoding; -var SymbolSetEncoding = coreEncodings.SymbolSetEncoding; -var ZapfDingbatsEncoding = coreEncodings.ZapfDingbatsEncoding; -var getEncoding = coreEncodings.getEncoding; -var getStdFontMap = coreStandardFonts.getStdFontMap; -var getSerifFonts = coreStandardFonts.getSerifFonts; -var getSymbolsFonts = coreStandardFonts.getSymbolsFonts; -var getNormalizedUnicodes = coreUnicode.getNormalizedUnicodes; -var reverseIfRtl = coreUnicode.reverseIfRtl; -var getUnicodeForGlyph = coreUnicode.getUnicodeForGlyph; -var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PartialEvaluator = exports.OperatorList = undefined; + +var _util = __w_pdfjs_require__(0); + +var _cmap = __w_pdfjs_require__(22); + +var _stream = __w_pdfjs_require__(2); + +var _primitives = __w_pdfjs_require__(1); + +var _fonts = __w_pdfjs_require__(25); + +var _encodings = __w_pdfjs_require__(4); + +var _unicode = __w_pdfjs_require__(8); + +var _standard_fonts = __w_pdfjs_require__(16); + +var _pattern = __w_pdfjs_require__(31); + +var _function = __w_pdfjs_require__(7); + +var _parser = __w_pdfjs_require__(5); + +var _bidi = __w_pdfjs_require__(20); + +var _colorspace = __w_pdfjs_require__(3); + +var _glyphlist = __w_pdfjs_require__(6); + +var _metrics = __w_pdfjs_require__(29); + +var _murmurhash = __w_pdfjs_require__(30); + +var _image = __w_pdfjs_require__(26); + var PartialEvaluator = function PartialEvaluatorClosure() { const DefaultPartialEvaluatorOptions = { forceDataSchema: false, maxImageSize: -1, disableFontFace: false, - nativeImageDecoderSupport: NativeImageDecoding.DECODE, + nativeImageDecoderSupport: _util.NativeImageDecoding.DECODE, ignoreErrors: false }; function NativeImageDecoder(xref, resources, handler, forceDataSchema) { this.xref = xref; this.resources = resources; this.handler = handler; this.forceDataSchema = forceDataSchema; } NativeImageDecoder.prototype = { canDecode(image) { - return image instanceof JpegStream && NativeImageDecoder.isDecodable(image, this.xref, this.resources); + return image instanceof _stream.JpegStream && NativeImageDecoder.isDecodable(image, this.xref, this.resources); }, decode(image) { var dict = image.dict; var colorSpace = dict.get('ColorSpace', 'CS'); - colorSpace = ColorSpace.parse(colorSpace, this.xref, this.resources); + colorSpace = _colorspace.ColorSpace.parse(colorSpace, this.xref, this.resources); var numComps = colorSpace.numComps; var decodePromise = this.handler.sendWithPromise('JpegDecode', [image.getIR(this.forceDataSchema), numComps]); return decodePromise.then(function (message) { var data = message.data; - return new Stream(data, 0, data.length, image.dict); + return new _stream.Stream(data, 0, data.length, image.dict); }); } }; NativeImageDecoder.isSupported = function NativeImageDecoder_isSupported(image, xref, res) { var dict = image.dict; if (dict.has('DecodeParms') || dict.has('DP')) { return false; } - var cs = ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res); + var cs = _colorspace.ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res); return (cs.name === 'DeviceGray' || cs.name === 'DeviceRGB') && cs.isDefaultDecode(dict.getArray('Decode', 'D')); }; NativeImageDecoder.isDecodable = function NativeImageDecoder_isDecodable(image, xref, res) { var dict = image.dict; if (dict.has('DecodeParms') || dict.has('DP')) { return false; } - var cs = ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res); + var cs = _colorspace.ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res); return (cs.numComps === 1 || cs.numComps === 3) && cs.isDefaultDecode(dict.getArray('Decode', 'D')); }; function PartialEvaluator({ pdfManager, xref, handler, pageIndex, idFactory, fontCache, builtInCMapCache, options = null }) { this.pdfManager = pdfManager; this.xref = xref; this.handler = handler; this.pageIndex = pageIndex; this.idFactory = idFactory; @@ -16508,17 +16435,17 @@ var PartialEvaluator = function PartialE this.builtInCMapCache = builtInCMapCache; this.options = options || DefaultPartialEvaluatorOptions; this.fetchBuiltInCMap = name => { var cachedCMap = this.builtInCMapCache[name]; if (cachedCMap) { return Promise.resolve(cachedCMap); } return this.handler.sendWithPromise('FetchBuiltInCMap', { name }).then(data => { - if (data.compressionType !== CMapCompressionType.NONE) { + if (data.compressionType !== _util.CMapCompressionType.NONE) { this.builtInCMapCache[name] = data; } return data; }); }; } var TIME_SLOT_DURATION_MS = 20; var CHECK_TIME_EVERY = 100; @@ -16534,17 +16461,17 @@ var PartialEvaluator = function PartialE return this.endTime <= Date.now(); }, reset: function TimeSlotManager_reset() { this.endTime = Date.now() + TIME_SLOT_DURATION_MS; this.checked = 0; } }; function normalizeBlendMode(value) { - if (!isName(value)) { + if (!(0, _primitives.isName)(value)) { return 'source-over'; } switch (value.name) { case 'Normal': case 'Compatible': return 'source-over'; case 'Multiply': return 'multiply'; @@ -16572,78 +16499,78 @@ var PartialEvaluator = function PartialE return 'hue'; case 'Saturation': return 'saturation'; case 'Color': return 'color'; case 'Luminosity': return 'luminosity'; } - warn('Unsupported blend mode: ' + value.name); + (0, _util.warn)('Unsupported blend mode: ' + value.name); return 'source-over'; } var deferred = Promise.resolve(); var TILING_PATTERN = 1, SHADING_PATTERN = 2; PartialEvaluator.prototype = { clone(newOptions = DefaultPartialEvaluatorOptions) { var newEvaluator = Object.create(this); newEvaluator.options = newOptions; return newEvaluator; }, hasBlendModes: function PartialEvaluator_hasBlendModes(resources) { - if (!isDict(resources)) { + if (!(0, _primitives.isDict)(resources)) { return false; } var processed = Object.create(null); if (resources.objId) { processed[resources.objId] = true; } var nodes = [resources], xref = this.xref; while (nodes.length) { var key, i, ii; var node = nodes.shift(); var graphicStates = node.get('ExtGState'); - if (isDict(graphicStates)) { + if ((0, _primitives.isDict)(graphicStates)) { var graphicStatesKeys = graphicStates.getKeys(); for (i = 0, ii = graphicStatesKeys.length; i < ii; i++) { key = graphicStatesKeys[i]; var graphicState = graphicStates.get(key); var bm = graphicState.get('BM'); - if (isName(bm) && bm.name !== 'Normal') { + if ((0, _primitives.isName)(bm) && bm.name !== 'Normal') { return true; } } } var xObjects = node.get('XObject'); - if (!isDict(xObjects)) { + if (!(0, _primitives.isDict)(xObjects)) { continue; } var xObjectsKeys = xObjects.getKeys(); for (i = 0, ii = xObjectsKeys.length; i < ii; i++) { key = xObjectsKeys[i]; var xObject = xObjects.getRaw(key); - if (isRef(xObject)) { + if ((0, _primitives.isRef)(xObject)) { if (processed[xObject.toString()]) { continue; } xObject = xref.fetch(xObject); } - if (!isStream(xObject)) { + if (!(0, _primitives.isStream)(xObject)) { continue; } if (xObject.dict.objId) { if (processed[xObject.dict.objId]) { continue; } processed[xObject.dict.objId] = true; } var xResources = xObject.dict.get('Resources'); - if (isDict(xResources) && (!xResources.objId || !processed[xResources.objId])) { + if ((0, _primitives.isDict)(xResources) && (!xResources.objId || !processed[xResources.objId])) { nodes.push(xResources); if (xResources.objId) { processed[xResources.objId] = true; } } } } return false; @@ -16658,150 +16585,150 @@ var PartialEvaluator = function PartialE matrix, bbox, smask, isolated: false, knockout: false }; var groupSubtype = group.get('S'); var colorSpace; - if (isName(groupSubtype, 'Transparency')) { + if ((0, _primitives.isName)(groupSubtype, 'Transparency')) { groupOptions.isolated = group.get('I') || false; groupOptions.knockout = group.get('K') || false; - colorSpace = group.has('CS') ? ColorSpace.parse(group.get('CS'), this.xref, resources) : null; + colorSpace = group.has('CS') ? _colorspace.ColorSpace.parse(group.get('CS'), this.xref, resources) : null; } if (smask && smask.backdrop) { - colorSpace = colorSpace || ColorSpace.singletons.rgb; + colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb; smask.backdrop = colorSpace.getRgb(smask.backdrop, 0); } - operatorList.addOp(OPS.beginGroup, [groupOptions]); - } - operatorList.addOp(OPS.paintFormXObjectBegin, [matrix, bbox]); + operatorList.addOp(_util.OPS.beginGroup, [groupOptions]); + } + operatorList.addOp(_util.OPS.paintFormXObjectBegin, [matrix, bbox]); return this.getOperatorList({ stream: xobj, task, resources: dict.get('Resources') || resources, operatorList, initialState }).then(function () { - operatorList.addOp(OPS.paintFormXObjectEnd, []); + operatorList.addOp(_util.OPS.paintFormXObjectEnd, []); if (group) { - operatorList.addOp(OPS.endGroup, [groupOptions]); + operatorList.addOp(_util.OPS.endGroup, [groupOptions]); } }); }, buildPaintImageXObject: function PartialEvaluator_buildPaintImageXObject(resources, image, inline, operatorList, cacheKey, imageCache) { var dict = image.dict; var w = dict.get('Width', 'W'); var h = dict.get('Height', 'H'); - if (!(w && isNum(w)) || !(h && isNum(h))) { - warn('Image dimensions are missing, or not numbers.'); + if (!(w && (0, _util.isNum)(w)) || !(h && (0, _util.isNum)(h))) { + (0, _util.warn)('Image dimensions are missing, or not numbers.'); return; } var maxImageSize = this.options.maxImageSize; if (maxImageSize !== -1 && w * h > maxImageSize) { - warn('Image exceeded maximum allowed size and was removed.'); + (0, _util.warn)('Image exceeded maximum allowed size and was removed.'); return; } var imageMask = dict.get('ImageMask', 'IM') || false; var imgData, args; if (imageMask) { var width = dict.get('Width', 'W'); var height = dict.get('Height', 'H'); var bitStrideLength = width + 7 >> 3; var imgArray = image.getBytes(bitStrideLength * height); var decode = dict.getArray('Decode', 'D'); var inverseDecode = !!decode && decode[0] > 0; - imgData = PDFImage.createMask(imgArray, width, height, image instanceof DecodeStream, inverseDecode); + imgData = _image.PDFImage.createMask(imgArray, width, height, image instanceof _stream.DecodeStream, inverseDecode); imgData.cached = true; args = [imgData]; - operatorList.addOp(OPS.paintImageMaskXObject, args); + operatorList.addOp(_util.OPS.paintImageMaskXObject, args); if (cacheKey) { imageCache[cacheKey] = { - fn: OPS.paintImageMaskXObject, + fn: _util.OPS.paintImageMaskXObject, args }; } return; } var softMask = dict.get('SMask', 'SM') || false; var mask = dict.get('Mask') || false; var SMALL_IMAGE_DIMENSIONS = 200; - if (inline && !softMask && !mask && !(image instanceof JpegStream) && w + h < SMALL_IMAGE_DIMENSIONS) { - var imageObj = new PDFImage(this.xref, resources, image, inline, null, null); + if (inline && !softMask && !mask && !(image instanceof _stream.JpegStream) && w + h < SMALL_IMAGE_DIMENSIONS) { + var imageObj = new _image.PDFImage(this.xref, resources, image, inline, null, null); imgData = imageObj.createImageData(true); - operatorList.addOp(OPS.paintInlineImageXObject, [imgData]); + operatorList.addOp(_util.OPS.paintInlineImageXObject, [imgData]); return; } var nativeImageDecoderSupport = this.options.nativeImageDecoderSupport; var objId = 'img_' + this.idFactory.createObjId(); operatorList.addDependency(objId); args = [objId, w, h]; - if (nativeImageDecoderSupport !== NativeImageDecoding.NONE && !softMask && !mask && image instanceof JpegStream && NativeImageDecoder.isSupported(image, this.xref, resources)) { - operatorList.addOp(OPS.paintJpegXObject, args); + if (nativeImageDecoderSupport !== _util.NativeImageDecoding.NONE && !softMask && !mask && image instanceof _stream.JpegStream && NativeImageDecoder.isSupported(image, this.xref, resources)) { + operatorList.addOp(_util.OPS.paintJpegXObject, args); this.handler.send('obj', [objId, this.pageIndex, 'JpegStream', image.getIR(this.options.forceDataSchema)]); if (cacheKey) { imageCache[cacheKey] = { - fn: OPS.paintJpegXObject, + fn: _util.OPS.paintJpegXObject, args }; } return; } var nativeImageDecoder = null; - if (nativeImageDecoderSupport === NativeImageDecoding.DECODE && (image instanceof JpegStream || mask instanceof JpegStream || softMask instanceof JpegStream)) { + if (nativeImageDecoderSupport === _util.NativeImageDecoding.DECODE && (image instanceof _stream.JpegStream || mask instanceof _stream.JpegStream || softMask instanceof _stream.JpegStream)) { nativeImageDecoder = new NativeImageDecoder(this.xref, resources, this.handler, this.options.forceDataSchema); } - PDFImage.buildImage(this.handler, this.xref, resources, image, inline, nativeImageDecoder).then(imageObj => { + _image.PDFImage.buildImage(this.handler, this.xref, resources, image, inline, nativeImageDecoder).then(imageObj => { var imgData = imageObj.createImageData(false); this.handler.send('obj', [objId, this.pageIndex, 'Image', imgData], [imgData.data.buffer]); }).catch(reason => { - warn('Unable to decode image: ' + reason); + (0, _util.warn)('Unable to decode image: ' + reason); this.handler.send('obj', [objId, this.pageIndex, 'Image', null]); }); - operatorList.addOp(OPS.paintImageXObject, args); + operatorList.addOp(_util.OPS.paintImageXObject, args); if (cacheKey) { imageCache[cacheKey] = { - fn: OPS.paintImageXObject, + fn: _util.OPS.paintImageXObject, args }; } }, handleSMask: function PartialEvaluator_handleSmask(smask, resources, operatorList, task, stateManager) { var smaskContent = smask.get('G'); var smaskOptions = { subtype: smask.get('S').name, backdrop: smask.get('BC') }; var transferObj = smask.get('TR'); - if (isPDFFunction(transferObj)) { - var transferFn = PDFFunction.parse(this.xref, transferObj); + if ((0, _function.isPDFFunction)(transferObj)) { + var transferFn = _function.PDFFunction.parse(this.xref, transferObj); var transferMap = new Uint8Array(256); var tmp = new Float32Array(1); for (var i = 0; i < 256; i++) { tmp[0] = i / 255; transferFn(tmp, 0, tmp, 0); transferMap[i] = tmp[0] * 255 | 0; } smaskOptions.transferMap = transferMap; } return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone()); }, handleTilingType: function PartialEvaluator_handleTilingType(fn, args, resources, pattern, patternDict, operatorList, task) { var tilingOpList = new OperatorList(); var resourcesArray = [patternDict.get('Resources'), resources]; - var patternResources = Dict.merge(this.xref, resourcesArray); + var patternResources = _primitives.Dict.merge(this.xref, resourcesArray); return this.getOperatorList({ stream: pattern, task, resources: patternResources, operatorList: tilingOpList }).then(function () { operatorList.addDependencies(tilingOpList.dependencies); - operatorList.addOp(fn, getTilingPatternIR({ + operatorList.addOp(fn, (0, _pattern.getTilingPatternIR)({ fnArray: tilingOpList.fnArray, argsArray: tilingOpList.argsArray }, patternDict, args)); }); }, handleSetFont: function PartialEvaluator_handleSetFont(resources, fontArgs, fontRef, operatorList, task, state) { var fontName; if (fontArgs) { @@ -16810,29 +16737,29 @@ var PartialEvaluator = function PartialE } return this.loadFont(fontName, fontRef, resources).then(translated => { if (!translated.font.isType3Font) { return translated; } return translated.loadType3Data(this, resources, operatorList, task).then(function () { return translated; }).catch(reason => { - this.handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.font }); - return new TranslatedFont('g_font_error', new ErrorFont('Type3 font load error: ' + reason), translated.font); + this.handler.send('UnsupportedFeature', { featureId: _util.UNSUPPORTED_FEATURES.font }); + return new TranslatedFont('g_font_error', new _fonts.ErrorFont('Type3 font load error: ' + reason), translated.font); }); }).then(translated => { state.font = translated.font; translated.send(this.handler); return translated.loadedName; }); }, handleText: function PartialEvaluator_handleText(chars, state) { var font = state.font; var glyphs = font.charsToGlyphs(chars); - var isAddToPathSet = !!(state.textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG); + var isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG); if (font.data && (isAddToPathSet || this.options.disableFontFace)) { var buildPath = fontChar => { if (!font.renderer.hasBuiltPath(fontChar)) { var path = font.renderer.getPathJs(fontChar); this.handler.send('commonobj', [font.loadedName + '_path_' + fontChar, 'FontPath', path]); } }; for (var i = 0, ii = glyphs.length; i < ii; i++) { @@ -16874,202 +16801,202 @@ var PartialEvaluator = function PartialE gStateObj.push([key, [loadedName, value[1]]]); }); }); break; case 'BM': gStateObj.push([key, normalizeBlendMode(value)]); break; case 'SMask': - if (isName(value, 'None')) { + if ((0, _primitives.isName)(value, 'None')) { gStateObj.push([key, false]); break; } - if (isDict(value)) { + if ((0, _primitives.isDict)(value)) { promise = promise.then(() => { return this.handleSMask(value, resources, operatorList, task, stateManager); }); gStateObj.push([key, true]); } else { - warn('Unsupported SMask type'); + (0, _util.warn)('Unsupported SMask type'); } break; case 'OP': case 'op': case 'OPM': case 'BG': case 'BG2': case 'UCR': case 'UCR2': case 'TR': case 'TR2': case 'HT': case 'SM': case 'SA': case 'AIS': case 'TK': - info('graphic state operator ' + key); + (0, _util.info)('graphic state operator ' + key); break; default: - info('Unknown graphic state operator ' + key); + (0, _util.info)('Unknown graphic state operator ' + key); break; } } return promise.then(function () { if (gStateObj.length > 0) { - operatorList.addOp(OPS.setGState, [gStateObj]); + operatorList.addOp(_util.OPS.setGState, [gStateObj]); } }); }, loadFont: function PartialEvaluator_loadFont(fontName, font, resources) { function errorFont() { - return Promise.resolve(new TranslatedFont('g_font_error', new ErrorFont('Font ' + fontName + ' is not available'), font)); + return Promise.resolve(new TranslatedFont('g_font_error', new _fonts.ErrorFont('Font ' + fontName + ' is not available'), font)); } var fontRef, xref = this.xref; if (font) { - assert(isRef(font)); + (0, _util.assert)((0, _primitives.isRef)(font)); fontRef = font; } else { var fontRes = resources.get('Font'); if (fontRes) { fontRef = fontRes.getRaw(fontName); } else { - warn('fontRes not available'); + (0, _util.warn)('fontRes not available'); return errorFont(); } } if (!fontRef) { - warn('fontRef not available'); + (0, _util.warn)('fontRef not available'); return errorFont(); } if (this.fontCache.has(fontRef)) { return this.fontCache.get(fontRef); } font = xref.fetchIfRef(fontRef); - if (!isDict(font)) { + if (!(0, _primitives.isDict)(font)) { return errorFont(); } if (font.translated) { return font.translated; } - var fontCapability = createPromiseCapability(); + var fontCapability = (0, _util.createPromiseCapability)(); var preEvaluatedFont = this.preEvaluateFont(font); var descriptor = preEvaluatedFont.descriptor; - var fontRefIsRef = isRef(fontRef), + var fontRefIsRef = (0, _primitives.isRef)(fontRef), fontID; if (fontRefIsRef) { fontID = fontRef.toString(); } - if (isDict(descriptor)) { + if ((0, _primitives.isDict)(descriptor)) { if (!descriptor.fontAliases) { descriptor.fontAliases = Object.create(null); } var fontAliases = descriptor.fontAliases; var hash = preEvaluatedFont.hash; if (fontAliases[hash]) { var aliasFontRef = fontAliases[hash].aliasRef; if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) { this.fontCache.putAlias(fontRef, aliasFontRef); return this.fontCache.get(fontRef); } } else { - fontAliases[hash] = { fontID: Font.getFontID() }; + fontAliases[hash] = { fontID: _fonts.Font.getFontID() }; } if (fontRefIsRef) { fontAliases[hash].aliasRef = fontRef; } fontID = fontAliases[hash].fontID; } if (fontRefIsRef) { this.fontCache.put(fontRef, fontCapability.promise); } else { if (!fontID) { fontID = this.idFactory.createObjId(); } this.fontCache.put('id_' + fontID, fontCapability.promise); } - assert(fontID, 'The "fontID" must be defined.'); + (0, _util.assert)(fontID, 'The "fontID" must be defined.'); font.loadedName = 'g_' + this.pdfManager.docId + '_f' + fontID; font.translated = fontCapability.promise; var translatedPromise; try { translatedPromise = this.translateFont(preEvaluatedFont); } catch (e) { translatedPromise = Promise.reject(e); } translatedPromise.then(function (translatedFont) { if (translatedFont.fontType !== undefined) { var xrefFontStats = xref.stats.fontTypes; xrefFontStats[translatedFont.fontType] = true; } fontCapability.resolve(new TranslatedFont(font.loadedName, translatedFont, font)); }).catch(reason => { - this.handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.font }); + this.handler.send('UnsupportedFeature', { featureId: _util.UNSUPPORTED_FEATURES.font }); try { var descriptor = preEvaluatedFont.descriptor; var fontFile3 = descriptor && descriptor.get('FontFile3'); var subtype = fontFile3 && fontFile3.get('Subtype'); - var fontType = getFontType(preEvaluatedFont.type, subtype && subtype.name); + var fontType = (0, _fonts.getFontType)(preEvaluatedFont.type, subtype && subtype.name); var xrefFontStats = xref.stats.fontTypes; xrefFontStats[fontType] = true; } catch (ex) {} - fontCapability.resolve(new TranslatedFont(font.loadedName, new ErrorFont(reason instanceof Error ? reason.message : reason), font)); + fontCapability.resolve(new TranslatedFont(font.loadedName, new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason), font)); }); return fontCapability.promise; }, buildPath: function PartialEvaluator_buildPath(operatorList, fn, args) { var lastIndex = operatorList.length - 1; if (!args) { args = []; } - if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== OPS.constructPath) { - operatorList.addOp(OPS.constructPath, [[fn], args]); + if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) { + operatorList.addOp(_util.OPS.constructPath, [[fn], args]); } else { var opArgs = operatorList.argsArray[lastIndex]; opArgs[0].push(fn); Array.prototype.push.apply(opArgs[1], args); } }, handleColorN: function PartialEvaluator_handleColorN(operatorList, fn, args, cs, patterns, resources, task) { var patternName = args[args.length - 1]; var pattern; - if (isName(patternName) && (pattern = patterns.get(patternName.name))) { - var dict = isStream(pattern) ? pattern.dict : pattern; + if ((0, _primitives.isName)(patternName) && (pattern = patterns.get(patternName.name))) { + var dict = (0, _primitives.isStream)(pattern) ? pattern.dict : pattern; var typeNum = dict.get('PatternType'); if (typeNum === TILING_PATTERN) { var color = cs.base ? cs.base.getRgb(args, 0) : null; return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task); } else if (typeNum === SHADING_PATTERN) { var shading = dict.get('Shading'); var matrix = dict.getArray('Matrix'); - pattern = Pattern.parseShading(shading, matrix, this.xref, resources, this.handler); + pattern = _pattern.Pattern.parseShading(shading, matrix, this.xref, resources, this.handler); operatorList.addOp(fn, pattern.getIR()); return Promise.resolve(); } return Promise.reject(new Error('Unknown PatternType: ' + typeNum)); } operatorList.addOp(fn, args); return Promise.resolve(); }, getOperatorList({ stream, task, resources, operatorList, initialState = null }) { - resources = resources || Dict.empty; + resources = resources || _primitives.Dict.empty; initialState = initialState || new EvalState(); - assert(operatorList, 'getOperatorList: missing "operatorList" parameter'); + (0, _util.assert)(operatorList, 'getOperatorList: missing "operatorList" parameter'); var self = this; var xref = this.xref; var imageCache = Object.create(null); - var xobjs = resources.get('XObject') || Dict.empty; - var patterns = resources.get('Pattern') || Dict.empty; + var xobjs = resources.get('XObject') || _primitives.Dict.empty; + var patterns = resources.get('Pattern') || _primitives.Dict.empty; var stateManager = new StateManager(initialState); var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager); var timeSlotManager = new TimeSlotManager(); function closePendingRestoreOPS(argument) { for (var i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) { - operatorList.addOp(OPS.restore, []); + operatorList.addOp(_util.OPS.restore, []); } } return new Promise(function promiseBody(resolve, reject) { var next = function (promise) { promise.then(function () { try { promiseBody(resolve, reject); } catch (ex) { @@ -17087,240 +17014,240 @@ var PartialEvaluator = function PartialE while (!(stop = timeSlotManager.check())) { operation.args = null; if (!preprocessor.read(operation)) { break; } var args = operation.args; var fn = operation.fn; switch (fn | 0) { - case OPS.paintXObject: + case _util.OPS.paintXObject: if (args[0].code) { break; } var name = args[0].name; if (!name) { - warn('XObject must be referred to by name.'); + (0, _util.warn)('XObject must be referred to by name.'); continue; } if (imageCache[name] !== undefined) { operatorList.addOp(imageCache[name].fn, imageCache[name].args); args = null; continue; } var xobj = xobjs.get(name); if (xobj) { - assert(isStream(xobj), 'XObject should be a stream'); + (0, _util.assert)((0, _primitives.isStream)(xobj), 'XObject should be a stream'); var type = xobj.dict.get('Subtype'); - assert(isName(type), 'XObject should have a Name subtype'); + (0, _util.assert)((0, _primitives.isName)(type), 'XObject should have a Name subtype'); if (type.name === 'Form') { stateManager.save(); next(self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone()).then(function () { stateManager.restore(); })); return; } else if (type.name === 'Image') { self.buildPaintImageXObject(resources, xobj, false, operatorList, name, imageCache); args = null; continue; } else if (type.name === 'PS') { - info('Ignored XObject subtype PS'); + (0, _util.info)('Ignored XObject subtype PS'); continue; } else { - error('Unhandled XObject subtype ' + type.name); - } - } - break; - case OPS.setFont: + (0, _util.error)('Unhandled XObject subtype ' + type.name); + } + } + break; + case _util.OPS.setFont: var fontSize = args[1]; next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state).then(function (loadedName) { operatorList.addDependency(loadedName); - operatorList.addOp(OPS.setFont, [loadedName, fontSize]); + operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]); })); return; - case OPS.endInlineImage: + case _util.OPS.endInlineImage: var cacheKey = args[0].cacheKey; if (cacheKey) { var cacheEntry = imageCache[cacheKey]; if (cacheEntry !== undefined) { operatorList.addOp(cacheEntry.fn, cacheEntry.args); args = null; continue; } } self.buildPaintImageXObject(resources, args[0], true, operatorList, cacheKey, imageCache); args = null; continue; - case OPS.showText: + case _util.OPS.showText: args[0] = self.handleText(args[0], stateManager.state); break; - case OPS.showSpacedText: + case _util.OPS.showSpacedText: var arr = args[0]; var combinedGlyphs = []; var arrLength = arr.length; var state = stateManager.state; for (i = 0; i < arrLength; ++i) { var arrItem = arr[i]; - if (isString(arrItem)) { + if ((0, _util.isString)(arrItem)) { Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state)); - } else if (isNum(arrItem)) { + } else if ((0, _util.isNum)(arrItem)) { combinedGlyphs.push(arrItem); } } args[0] = combinedGlyphs; - fn = OPS.showText; - break; - case OPS.nextLineShowText: - operatorList.addOp(OPS.nextLine); + fn = _util.OPS.showText; + break; + case _util.OPS.nextLineShowText: + operatorList.addOp(_util.OPS.nextLine); args[0] = self.handleText(args[0], stateManager.state); - fn = OPS.showText; - break; - case OPS.nextLineSetSpacingShowText: - operatorList.addOp(OPS.nextLine); - operatorList.addOp(OPS.setWordSpacing, [args.shift()]); - operatorList.addOp(OPS.setCharSpacing, [args.shift()]); + fn = _util.OPS.showText; + break; + case _util.OPS.nextLineSetSpacingShowText: + operatorList.addOp(_util.OPS.nextLine); + operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]); + operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]); args[0] = self.handleText(args[0], stateManager.state); - fn = OPS.showText; - break; - case OPS.setTextRenderingMode: + fn = _util.OPS.showText; + break; + case _util.OPS.setTextRenderingMode: stateManager.state.textRenderingMode = args[0]; break; - case OPS.setFillColorSpace: - stateManager.state.fillColorSpace = ColorSpace.parse(args[0], xref, resources); + case _util.OPS.setFillColorSpace: + stateManager.state.fillColorSpace = _colorspace.ColorSpace.parse(args[0], xref, resources); continue; - case OPS.setStrokeColorSpace: - stateManager.state.strokeColorSpace = ColorSpace.parse(args[0], xref, resources); + case _util.OPS.setStrokeColorSpace: + stateManager.state.strokeColorSpace = _colorspace.ColorSpace.parse(args[0], xref, resources); continue; - case OPS.setFillColor: + case _util.OPS.setFillColor: cs = stateManager.state.fillColorSpace; args = cs.getRgb(args, 0); - fn = OPS.setFillRGBColor; - break; - case OPS.setStrokeColor: + fn = _util.OPS.setFillRGBColor; + break; + case _util.OPS.setStrokeColor: cs = stateManager.state.strokeColorSpace; args = cs.getRgb(args, 0); - fn = OPS.setStrokeRGBColor; - break; - case OPS.setFillGray: - stateManager.state.fillColorSpace = ColorSpace.singletons.gray; - args = ColorSpace.singletons.gray.getRgb(args, 0); - fn = OPS.setFillRGBColor; - break; - case OPS.setStrokeGray: - stateManager.state.strokeColorSpace = ColorSpace.singletons.gray; - args = ColorSpace.singletons.gray.getRgb(args, 0); - fn = OPS.setStrokeRGBColor; - break; - case OPS.setFillCMYKColor: - stateManager.state.fillColorSpace = ColorSpace.singletons.cmyk; - args = ColorSpace.singletons.cmyk.getRgb(args, 0); - fn = OPS.setFillRGBColor; - break; - case OPS.setStrokeCMYKColor: - stateManager.state.strokeColorSpace = ColorSpace.singletons.cmyk; - args = ColorSpace.singletons.cmyk.getRgb(args, 0); - fn = OPS.setStrokeRGBColor; - break; - case OPS.setFillRGBColor: - stateManager.state.fillColorSpace = ColorSpace.singletons.rgb; - args = ColorSpace.singletons.rgb.getRgb(args, 0); - break; - case OPS.setStrokeRGBColor: - stateManager.state.strokeColorSpace = ColorSpace.singletons.rgb; - args = ColorSpace.singletons.rgb.getRgb(args, 0); - break; - case OPS.setFillColorN: + fn = _util.OPS.setStrokeRGBColor; + break; + case _util.OPS.setFillGray: + stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray; + args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0); + fn = _util.OPS.setFillRGBColor; + break; + case _util.OPS.setStrokeGray: + stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray; + args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0); + fn = _util.OPS.setStrokeRGBColor; + break; + case _util.OPS.setFillCMYKColor: + stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk; + args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0); + fn = _util.OPS.setFillRGBColor; + break; + case _util.OPS.setStrokeCMYKColor: + stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk; + args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0); + fn = _util.OPS.setStrokeRGBColor; + break; + case _util.OPS.setFillRGBColor: + stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb; + args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0); + break; + case _util.OPS.setStrokeRGBColor: + stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb; + args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0); + break; + case _util.OPS.setFillColorN: cs = stateManager.state.fillColorSpace; if (cs.name === 'Pattern') { - next(self.handleColorN(operatorList, OPS.setFillColorN, args, cs, patterns, resources, task)); + next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task)); return; } args = cs.getRgb(args, 0); - fn = OPS.setFillRGBColor; - break; - case OPS.setStrokeColorN: + fn = _util.OPS.setFillRGBColor; + break; + case _util.OPS.setStrokeColorN: cs = stateManager.state.strokeColorSpace; if (cs.name === 'Pattern') { - next(self.handleColorN(operatorList, OPS.setStrokeColorN, args, cs, patterns, resources, task)); + next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task)); return; } args = cs.getRgb(args, 0); - fn = OPS.setStrokeRGBColor; - break; - case OPS.shadingFill: + fn = _util.OPS.setStrokeRGBColor; + break; + case _util.OPS.shadingFill: var shadingRes = resources.get('Shading'); - assert(shadingRes, 'No shading resource found'); + (0, _util.assert)(shadingRes, 'No shading resource found'); var shading = shadingRes.get(args[0].name); - assert(shading, 'No shading object found'); - var shadingFill = Pattern.parseShading(shading, null, xref, resources, self.handler); + (0, _util.assert)(shading, 'No shading object found'); + var shadingFill = _pattern.Pattern.parseShading(shading, null, xref, resources, self.handler); var patternIR = shadingFill.getIR(); args = [patternIR]; - fn = OPS.shadingFill; - break; - case OPS.setGState: + fn = _util.OPS.shadingFill; + break; + case _util.OPS.setGState: var dictName = args[0]; var extGState = resources.get('ExtGState'); - if (!isDict(extGState) || !extGState.has(dictName.name)) { + if (!(0, _primitives.isDict)(extGState) || !extGState.has(dictName.name)) { break; } var gState = extGState.get(dictName.name); next(self.setGState(resources, gState, operatorList, task, stateManager)); return; - case OPS.moveTo: - case OPS.lineTo: - case OPS.curveTo: - case OPS.curveTo2: - case OPS.curveTo3: - case OPS.closePath: + case _util.OPS.moveTo: + case _util.OPS.lineTo: + case _util.OPS.curveTo: + case _util.OPS.curveTo2: + case _util.OPS.curveTo3: + case _util.OPS.closePath: self.buildPath(operatorList, fn, args); continue; - case OPS.rectangle: + case _util.OPS.rectangle: self.buildPath(operatorList, fn, args); continue; - case OPS.markPoint: - case OPS.markPointProps: - case OPS.beginMarkedContent: - case OPS.beginMarkedContentProps: - case OPS.endMarkedContent: - case OPS.beginCompat: - case OPS.endCompat: + case _util.OPS.markPoint: + case _util.OPS.markPointProps: + case _util.OPS.beginMarkedContent: + case _util.OPS.beginMarkedContentProps: + case _util.OPS.endMarkedContent: + case _util.OPS.beginCompat: + case _util.OPS.endCompat: continue; default: if (args !== null) { for (i = 0, ii = args.length; i < ii; i++) { - if (args[i] instanceof Dict) { + if (args[i] instanceof _primitives.Dict) { break; } } if (i < ii) { - warn('getOperatorList - ignoring operator: ' + fn); + (0, _util.warn)('getOperatorList - ignoring operator: ' + fn); continue; } } } operatorList.addOp(fn, args); } if (stop) { next(deferred); return; } closePendingRestoreOPS(); resolve(); }).catch(reason => { if (this.options.ignoreErrors) { - this.handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.unknown }); - warn('getOperatorList - ignoring errors during task: ' + task.name); + this.handler.send('UnsupportedFeature', { featureId: _util.UNSUPPORTED_FEATURES.unknown }); + (0, _util.warn)('getOperatorList - ignoring errors during task: ' + task.name); closePendingRestoreOPS(); return; } throw reason; }); }, getTextContent({ stream, task, resources, stateManager = null, normalizeWhitespace = false, combineTextItems = false }) { - resources = resources || Dict.empty; + resources = resources || _primitives.Dict.empty; stateManager = stateManager || new StateManager(new TextState()); var WhitespaceRegexp = /\s/g; var textContent = { items: [], styles: Object.create(null) }; var textContentItem = { initialized: false, @@ -17358,24 +17285,24 @@ var PartialEvaluator = function PartialE fontFamily: font.fallbackName, ascent: font.ascent, descent: font.descent, vertical: font.vertical }; } textContentItem.fontName = font.loadedName; var tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise]; - if (font.isType3Font && textState.fontMatrix !== FONT_IDENTITY_MATRIX && textState.fontSize === 1) { + if (font.isType3Font && textState.fontMatrix !== _util.FONT_IDENTITY_MATRIX && textState.fontSize === 1) { var glyphHeight = font.bbox[3] - font.bbox[1]; if (glyphHeight > 0) { glyphHeight = glyphHeight * textState.fontMatrix[3]; tsm[3] *= glyphHeight; } } - var trm = Util.transform(textState.ctm, Util.transform(textState.textMatrix, tsm)); + var trm = _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm)); textContentItem.transform = trm; if (!font.vertical) { textContentItem.width = 0; textContentItem.height = Math.sqrt(trm[2] * trm[2] + trm[3] * trm[3]); textContentItem.vertical = false; } else { textContentItem.width = Math.sqrt(trm[0] * trm[0] + trm[1] * trm[1]); textContentItem.height = 0; @@ -17413,30 +17340,30 @@ var PartialEvaluator = function PartialE code; while (i < ii && (code = str.charCodeAt(i)) >= 0x20 && code <= 0x7F) { i++; } return i < ii ? str.replace(WhitespaceRegexp, ' ') : str; } function runBidiTransform(textChunk) { var str = textChunk.str.join(''); - var bidiResult = bidi(str, -1, textChunk.vertical); + var bidiResult = (0, _bidi.bidi)(str, -1, textChunk.vertical); return { str: normalizeWhitespace ? replaceWhitespace(bidiResult.str) : bidiResult.str, dir: bidiResult.dir, width: textChunk.width, height: textChunk.height, transform: textChunk.transform, fontName: textChunk.fontName }; } function handleSetFont(fontName, fontRef) { return self.loadFont(fontName, fontRef, resources).then(function (translated) { textState.font = translated.font; - textState.fontMatrix = translated.font.fontMatrix || FONT_IDENTITY_MATRIX; + textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX; }); } function buildTextContentItem(chars) { var font = textState.font; var textChunk = ensureTextContentItem(); var width = 0; var height = 0; var glyphs = font.charsToGlyphs(chars); @@ -17444,21 +17371,21 @@ var PartialEvaluator = function PartialE var glyph = glyphs[i]; var glyphWidth = null; if (font.vertical && glyph.vmetric) { glyphWidth = glyph.vmetric[0]; } else { glyphWidth = glyph.width; } var glyphUnicode = glyph.unicode; - var NormalizedUnicodes = getNormalizedUnicodes(); + var NormalizedUnicodes = (0, _unicode.getNormalizedUnicodes)(); if (NormalizedUnicodes[glyphUnicode] !== undefined) { glyphUnicode = NormalizedUnicodes[glyphUnicode]; } - glyphUnicode = reverseIfRtl(glyphUnicode); + glyphUnicode = (0, _unicode.reverseIfRtl)(glyphUnicode); var charSpacing = textState.charSpacing; if (glyph.isSpace) { var wordSpacing = textState.wordSpacing; charSpacing += wordSpacing; if (wordSpacing > 0) { addFakeSpaces(wordSpacing, textChunk.str); } } @@ -17530,96 +17457,96 @@ var PartialEvaluator = function PartialE if (!preprocessor.read(operation)) { break; } textState = stateManager.state; var fn = operation.fn; args = operation.args; var advance, diff; switch (fn | 0) { - case OPS.setFont: + case _util.OPS.setFont: var fontNameArg = args[0].name, fontSizeArg = args[1]; if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) { break; } flushTextContentItem(); textState.fontName = fontNameArg; textState.fontSize = fontSizeArg; next(handleSetFont(fontNameArg, null)); return; - case OPS.setTextRise: + case _util.OPS.setTextRise: flushTextContentItem(); textState.textRise = args[0]; break; - case OPS.setHScale: + case _util.OPS.setHScale: flushTextContentItem(); textState.textHScale = args[0] / 100; break; - case OPS.setLeading: + case _util.OPS.setLeading: flushTextContentItem(); textState.leading = args[0]; break; - case OPS.moveText: + case _util.OPS.moveText: var isSameTextLine = !textState.font ? false : (textState.font.vertical ? args[0] : args[1]) === 0; advance = args[0] - args[1]; if (combineTextItems && isSameTextLine && textContentItem.initialized && advance > 0 && advance <= textContentItem.fakeMultiSpaceMax) { textState.translateTextLineMatrix(args[0], args[1]); textContentItem.width += args[0] - textContentItem.lastAdvanceWidth; textContentItem.height += args[1] - textContentItem.lastAdvanceHeight; diff = args[0] - textContentItem.lastAdvanceWidth - (args[1] - textContentItem.lastAdvanceHeight); addFakeSpaces(diff, textContentItem.str); break; } flushTextContentItem(); textState.translateTextLineMatrix(args[0], args[1]); textState.textMatrix = textState.textLineMatrix.slice(); break; - case OPS.setLeadingMoveText: + case _util.OPS.setLeadingMoveText: flushTextContentItem(); textState.leading = -args[1]; textState.translateTextLineMatrix(args[0], args[1]); textState.textMatrix = textState.textLineMatrix.slice(); break; - case OPS.nextLine: + case _util.OPS.nextLine: flushTextContentItem(); textState.carriageReturn(); break; - case OPS.setTextMatrix: + case _util.OPS.setTextMatrix: advance = textState.calcTextLineMatrixAdvance(args[0], args[1], args[2], args[3], args[4], args[5]); if (combineTextItems && advance !== null && textContentItem.initialized && advance.value > 0 && advance.value <= textContentItem.fakeMultiSpaceMax) { textState.translateTextLineMatrix(advance.width, advance.height); textContentItem.width += advance.width - textContentItem.lastAdvanceWidth; textContentItem.height += advance.height - textContentItem.lastAdvanceHeight; diff = advance.width - textContentItem.lastAdvanceWidth - (advance.height - textContentItem.lastAdvanceHeight); addFakeSpaces(diff, textContentItem.str); break; } flushTextContentItem(); textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]); textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]); break; - case OPS.setCharSpacing: + case _util.OPS.setCharSpacing: textState.charSpacing = args[0]; break; - case OPS.setWordSpacing: + case _util.OPS.setWordSpacing: textState.wordSpacing = args[0]; break; - case OPS.beginText: + case _util.OPS.beginText: flushTextContentItem(); - textState.textMatrix = IDENTITY_MATRIX.slice(); - textState.textLineMatrix = IDENTITY_MATRIX.slice(); - break; - case OPS.showSpacedText: + textState.textMatrix = _util.IDENTITY_MATRIX.slice(); + textState.textLineMatrix = _util.IDENTITY_MATRIX.slice(); + break; + case _util.OPS.showSpacedText: var items = args[0]; var offset; for (var j = 0, jj = items.length; j < jj; j++) { if (typeof items[j] === 'string') { buildTextContentItem(items[j]); - } else if (isNum(items[j])) { + } else if ((0, _util.isNum)(items[j])) { ensureTextContentItem(); advance = items[j] * textState.fontSize / 1000; var breakTextRun = false; if (textState.font.vertical) { offset = advance; textState.translateTextMatrix(0, offset); breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax; if (!breakTextRun) { @@ -17637,88 +17564,88 @@ var PartialEvaluator = function PartialE if (breakTextRun) { flushTextContentItem(); } else if (advance > 0) { addFakeSpaces(advance, textContentItem.str); } } } break; - case OPS.showText: + case _util.OPS.showText: buildTextContentItem(args[0]); break; - case OPS.nextLineShowText: + case _util.OPS.nextLineShowText: flushTextContentItem(); textState.carriageReturn(); buildTextContentItem(args[0]); break; - case OPS.nextLineSetSpacingShowText: + case _util.OPS.nextLineSetSpacingShowText: flushTextContentItem(); textState.wordSpacing = args[0]; textState.charSpacing = args[1]; textState.carriageReturn(); buildTextContentItem(args[2]); break; - case OPS.paintXObject: + case _util.OPS.paintXObject: flushTextContentItem(); if (args[0].code) { break; } if (!xobjs) { - xobjs = resources.get('XObject') || Dict.empty; + xobjs = resources.get('XObject') || _primitives.Dict.empty; } var name = args[0].name; if (xobjsCache.key === name) { if (xobjsCache.texts) { - Util.appendToArray(textContent.items, xobjsCache.texts.items); - Util.extendObj(textContent.styles, xobjsCache.texts.styles); + _util.Util.appendToArray(textContent.items, xobjsCache.texts.items); + _util.Util.extendObj(textContent.styles, xobjsCache.texts.styles); } break; } var xobj = xobjs.get(name); if (!xobj) { break; } - assert(isStream(xobj), 'XObject should be a stream'); + (0, _util.assert)((0, _primitives.isStream)(xobj), 'XObject should be a stream'); var type = xobj.dict.get('Subtype'); - assert(isName(type), 'XObject should have a Name subtype'); + (0, _util.assert)((0, _primitives.isName)(type), 'XObject should have a Name subtype'); if (type.name !== 'Form') { xobjsCache.key = name; xobjsCache.texts = null; break; } var currentState = stateManager.state.clone(); var xObjStateManager = new StateManager(currentState); var matrix = xobj.dict.getArray('Matrix'); - if (isArray(matrix) && matrix.length === 6) { + if ((0, _util.isArray)(matrix) && matrix.length === 6) { xObjStateManager.transform(matrix); } next(self.getTextContent({ stream: xobj, task, resources: xobj.dict.get('Resources') || resources, stateManager: xObjStateManager, normalizeWhitespace, combineTextItems }).then(function (formTextContent) { - Util.appendToArray(textContent.items, formTextContent.items); - Util.extendObj(textContent.styles, formTextContent.styles); + _util.Util.appendToArray(textContent.items, formTextContent.items); + _util.Util.extendObj(textContent.styles, formTextContent.styles); xobjsCache.key = name; xobjsCache.texts = formTextContent; })); return; - case OPS.setGState: + case _util.OPS.setGState: flushTextContentItem(); var dictName = args[0]; var extGState = resources.get('ExtGState'); - if (!isDict(extGState) || !isName(dictName)) { + if (!(0, _primitives.isDict)(extGState) || !(0, _primitives.isName)(dictName)) { break; } var gState = extGState.get(dictName.name); - if (!isDict(gState)) { + if (!(0, _primitives.isDict)(gState)) { break; } var gStateFont = gState.get('Font'); if (gStateFont) { textState.fontName = null; textState.fontSize = gStateFont[1]; next(handleSetFont(null, gStateFont[0])); return; @@ -17729,88 +17656,88 @@ var PartialEvaluator = function PartialE if (stop) { next(deferred); return; } flushTextContentItem(); resolve(textContent); }).catch(reason => { if (this.options.ignoreErrors) { - warn('getTextContent - ignoring errors during task: ' + task.name); + (0, _util.warn)('getTextContent - ignoring errors during task: ' + task.name); flushTextContentItem(); return textContent; } throw reason; }); }, extractDataStructures: function PartialEvaluator_extractDataStructures(dict, baseDict, properties) { var xref = this.xref; var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode'); var toUnicodePromise = toUnicode ? this.readToUnicode(toUnicode) : Promise.resolve(undefined); if (properties.composite) { var cidSystemInfo = dict.get('CIDSystemInfo'); - if (isDict(cidSystemInfo)) { + if ((0, _primitives.isDict)(cidSystemInfo)) { properties.cidSystemInfo = { registry: cidSystemInfo.get('Registry'), ordering: cidSystemInfo.get('Ordering'), supplement: cidSystemInfo.get('Supplement') }; } var cidToGidMap = dict.get('CIDToGIDMap'); - if (isStream(cidToGidMap)) { + if ((0, _primitives.isStream)(cidToGidMap)) { properties.cidToGidMap = this.readCidToGidMap(cidToGidMap); } } var differences = []; var baseEncodingName = null; var encoding; if (dict.has('Encoding')) { encoding = dict.get('Encoding'); - if (isDict(encoding)) { + if ((0, _primitives.isDict)(encoding)) { baseEncodingName = encoding.get('BaseEncoding'); - baseEncodingName = isName(baseEncodingName) ? baseEncodingName.name : null; + baseEncodingName = (0, _primitives.isName)(baseEncodingName) ? baseEncodingName.name : null; if (encoding.has('Differences')) { var diffEncoding = encoding.get('Differences'); var index = 0; for (var j = 0, jj = diffEncoding.length; j < jj; j++) { var data = xref.fetchIfRef(diffEncoding[j]); - if (isNum(data)) { + if ((0, _util.isNum)(data)) { index = data; - } else if (isName(data)) { + } else if ((0, _primitives.isName)(data)) { differences[index++] = data.name; } else { - error('Invalid entry in \'Differences\' array: ' + data); - } - } - } - } else if (isName(encoding)) { + (0, _util.error)('Invalid entry in \'Differences\' array: ' + data); + } + } + } + } else if ((0, _primitives.isName)(encoding)) { baseEncodingName = encoding.name; } else { - error('Encoding is not a Name nor a Dict'); + (0, _util.error)('Encoding is not a Name nor a Dict'); } if (baseEncodingName !== 'MacRomanEncoding' && baseEncodingName !== 'MacExpertEncoding' && baseEncodingName !== 'WinAnsiEncoding') { baseEncodingName = null; } } if (baseEncodingName) { - properties.defaultEncoding = getEncoding(baseEncodingName).slice(); - } else { - var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic); - var isNonsymbolicFont = !!(properties.flags & FontFlags.Nonsymbolic); - encoding = StandardEncoding; + properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName).slice(); + } else { + var isSymbolicFont = !!(properties.flags & _fonts.FontFlags.Symbolic); + var isNonsymbolicFont = !!(properties.flags & _fonts.FontFlags.Nonsymbolic); + encoding = _encodings.StandardEncoding; if (properties.type === 'TrueType' && !isNonsymbolicFont) { - encoding = WinAnsiEncoding; + encoding = _encodings.WinAnsiEncoding; } if (isSymbolicFont) { - encoding = MacRomanEncoding; + encoding = _encodings.MacRomanEncoding; if (!properties.file) { if (/Symbol/i.test(properties.name)) { - encoding = SymbolSetEncoding; + encoding = _encodings.SymbolSetEncoding; } else if (/Dingbats/i.test(properties.name)) { - encoding = ZapfDingbatsEncoding; + encoding = _encodings.ZapfDingbatsEncoding; } } } properties.defaultEncoding = encoding; } properties.differences = differences; properties.baseEncodingName = baseEncodingName; properties.hasEncoding = !!baseEncodingName || differences.length > 0; @@ -17836,17 +17763,17 @@ var PartialEvaluator = function PartialE var differences = properties.differences; for (charcode in differences) { glyphName = differences[charcode]; if (glyphName === '.notdef') { continue; } encoding[charcode] = glyphName; } - var glyphsUnicodeMap = getGlyphsUnicode(); + var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); for (charcode in encoding) { glyphName = encoding[charcode]; if (glyphName === '') { continue; } else if (glyphsUnicodeMap[glyphName] === undefined) { var code = 0; switch (glyphName[0]) { case 'G': @@ -17861,98 +17788,98 @@ var PartialEvaluator = function PartialE break; case 'C': case 'c': if (glyphName.length >= 3) { code = +glyphName.substr(1); } break; default: - var unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap); + var unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap); if (unicode !== -1) { code = unicode; } } if (code) { if (baseEncodingName && code === +charcode) { - var baseEncoding = getEncoding(baseEncodingName); + var baseEncoding = (0, _encodings.getEncoding)(baseEncodingName); if (baseEncoding && (glyphName = baseEncoding[charcode])) { toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]); continue; } } toUnicode[charcode] = String.fromCharCode(code); } continue; } toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]); } - return Promise.resolve(new ToUnicodeMap(toUnicode)); - } - if (properties.composite && (properties.cMap.builtInCMap && !(properties.cMap instanceof IdentityCMap) || properties.cidSystemInfo.registry === 'Adobe' && (properties.cidSystemInfo.ordering === 'GB1' || properties.cidSystemInfo.ordering === 'CNS1' || properties.cidSystemInfo.ordering === 'Japan1' || properties.cidSystemInfo.ordering === 'Korea1'))) { + return Promise.resolve(new _fonts.ToUnicodeMap(toUnicode)); + } + if (properties.composite && (properties.cMap.builtInCMap && !(properties.cMap instanceof _cmap.IdentityCMap) || properties.cidSystemInfo.registry === 'Adobe' && (properties.cidSystemInfo.ordering === 'GB1' || properties.cidSystemInfo.ordering === 'CNS1' || properties.cidSystemInfo.ordering === 'Japan1' || properties.cidSystemInfo.ordering === 'Korea1'))) { var registry = properties.cidSystemInfo.registry; var ordering = properties.cidSystemInfo.ordering; - var ucs2CMapName = Name.get(registry + '-' + ordering + '-UCS2'); - return CMapFactory.create({ + var ucs2CMapName = _primitives.Name.get(registry + '-' + ordering + '-UCS2'); + return _cmap.CMapFactory.create({ encoding: ucs2CMapName, fetchBuiltInCMap: this.fetchBuiltInCMap, useCMap: null }).then(function (ucs2CMap) { var cMap = properties.cMap; toUnicode = []; cMap.forEach(function (charcode, cid) { - assert(cid <= 0xffff, 'Max size of CID is 65,535'); + (0, _util.assert)(cid <= 0xffff, 'Max size of CID is 65,535'); var ucs2 = ucs2CMap.lookup(cid); if (ucs2) { toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1)); } }); - return new ToUnicodeMap(toUnicode); - }); - } - return Promise.resolve(new IdentityToUnicodeMap(properties.firstChar, properties.lastChar)); + return new _fonts.ToUnicodeMap(toUnicode); + }); + } + return Promise.resolve(new _fonts.IdentityToUnicodeMap(properties.firstChar, properties.lastChar)); }, readToUnicode: function PartialEvaluator_readToUnicode(toUnicode) { var cmapObj = toUnicode; - if (isName(cmapObj)) { - return CMapFactory.create({ + if ((0, _primitives.isName)(cmapObj)) { + return _cmap.CMapFactory.create({ encoding: cmapObj, fetchBuiltInCMap: this.fetchBuiltInCMap, useCMap: null }).then(function (cmap) { - if (cmap instanceof IdentityCMap) { - return new IdentityToUnicodeMap(0, 0xFFFF); - } - return new ToUnicodeMap(cmap.getMap()); - }); - } else if (isStream(cmapObj)) { - return CMapFactory.create({ + if (cmap instanceof _cmap.IdentityCMap) { + return new _fonts.IdentityToUnicodeMap(0, 0xFFFF); + } + return new _fonts.ToUnicodeMap(cmap.getMap()); + }); + } else if ((0, _primitives.isStream)(cmapObj)) { + return _cmap.CMapFactory.create({ encoding: cmapObj, fetchBuiltInCMap: this.fetchBuiltInCMap, useCMap: null }).then(function (cmap) { - if (cmap instanceof IdentityCMap) { - return new IdentityToUnicodeMap(0, 0xFFFF); + if (cmap instanceof _cmap.IdentityCMap) { + return new _fonts.IdentityToUnicodeMap(0, 0xFFFF); } var map = new Array(cmap.length); cmap.forEach(function (charCode, token) { var str = []; for (var k = 0; k < token.length; k += 2) { var w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1); if ((w1 & 0xF800) !== 0xD800) { str.push(w1); continue; } k += 2; var w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1); str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000); } map[charCode] = String.fromCharCode.apply(String, str); }); - return new ToUnicodeMap(map); + return new _fonts.ToUnicodeMap(map); }); } return Promise.resolve(null); }, readCidToGidMap: function PartialEvaluator_readCidToGidMap(cidToGidStream) { var glyphsData = cidToGidStream.getBytes(); var result = []; for (var j = 0, jj = glyphsData.length; j < jj; j++) { @@ -17974,17 +17901,17 @@ var PartialEvaluator = function PartialE var i, ii, j, jj, start, code, widths; if (properties.composite) { defaultWidth = dict.get('DW') || 1000; widths = dict.get('W'); if (widths) { for (i = 0, ii = widths.length; i < ii; i++) { start = xref.fetchIfRef(widths[i++]); code = xref.fetchIfRef(widths[i]); - if (isArray(code)) { + if ((0, _util.isArray)(code)) { for (j = 0, jj = code.length; j < jj; j++) { glyphsWidths[start++] = xref.fetchIfRef(code[j]); } } else { var width = xref.fetchIfRef(widths[++i]); for (j = start; j <= code; j++) { glyphsWidths[j] = width; } @@ -17994,17 +17921,17 @@ var PartialEvaluator = function PartialE if (properties.vertical) { var vmetrics = dict.getArray('DW2') || [880, -1000]; defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]]; vmetrics = dict.get('W2'); if (vmetrics) { for (i = 0, ii = vmetrics.length; i < ii; i++) { start = xref.fetchIfRef(vmetrics[i++]); code = xref.fetchIfRef(vmetrics[i]); - if (isArray(code)) { + if ((0, _util.isArray)(code)) { for (j = 0, jj = code.length; j < jj; j++) { glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])]; } } else { var vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])]; for (j = start; j <= code; j++) { glyphsVMetrics[j] = vmetric; } @@ -18018,17 +17945,17 @@ var PartialEvaluator = function PartialE if (widths) { j = firstChar; for (i = 0, ii = widths.length; i < ii; i++) { glyphsWidths[j++] = xref.fetchIfRef(widths[i]); } defaultWidth = parseFloat(descriptor.get('MissingWidth')) || 0; } else { var baseFontName = dict.get('BaseFont'); - if (isName(baseFontName)) { + if ((0, _primitives.isName)(baseFontName)) { var metrics = this.getBaseFontMetrics(baseFontName.name); glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties); defaultWidth = metrics.defaultWidth; } } } var isMonospace = true; var firstWidth = defaultWidth; @@ -18042,43 +17969,43 @@ var PartialEvaluator = function PartialE continue; } if (firstWidth !== glyphWidth) { isMonospace = false; break; } } if (isMonospace) { - properties.flags |= FontFlags.FixedPitch; + properties.flags |= _fonts.FontFlags.FixedPitch; } properties.defaultWidth = defaultWidth; properties.widths = glyphsWidths; properties.defaultVMetrics = defaultVMetrics; properties.vmetrics = glyphsVMetrics; }, isSerifFont: function PartialEvaluator_isSerifFont(baseFontName) { var fontNameWoStyle = baseFontName.split('-')[0]; - return fontNameWoStyle in getSerifFonts() || fontNameWoStyle.search(/serif/gi) !== -1; + return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || fontNameWoStyle.search(/serif/gi) !== -1; }, getBaseFontMetrics: function PartialEvaluator_getBaseFontMetrics(name) { var defaultWidth = 0; var widths = []; var monospace = false; - var stdFontMap = getStdFontMap(); + var stdFontMap = (0, _standard_fonts.getStdFontMap)(); var lookupName = stdFontMap[name] || name; - var Metrics = getMetrics(); + var Metrics = (0, _metrics.getMetrics)(); if (!(lookupName in Metrics)) { if (this.isSerifFont(name)) { lookupName = 'Times-Roman'; } else { lookupName = 'Helvetica'; } } var glyphWidths = Metrics[lookupName]; - if (isNum(glyphWidths)) { + if ((0, _util.isNum)(glyphWidths)) { defaultWidth = glyphWidths; monospace = true; } else { widths = glyphWidths(); } return { defaultWidth, monospace, @@ -18099,64 +18026,64 @@ var PartialEvaluator = function PartialE continue; } } return widths; }, preEvaluateFont: function PartialEvaluator_preEvaluateFont(dict) { var baseDict = dict; var type = dict.get('Subtype'); - assert(isName(type), 'invalid font Subtype'); + (0, _util.assert)((0, _primitives.isName)(type), 'invalid font Subtype'); var composite = false; var uint8array; if (type.name === 'Type0') { var df = dict.get('DescendantFonts'); - assert(df, 'Descendant fonts are not specified'); - dict = isArray(df) ? this.xref.fetchIfRef(df[0]) : df; + (0, _util.assert)(df, 'Descendant fonts are not specified'); + dict = (0, _util.isArray)(df) ? this.xref.fetchIfRef(df[0]) : df; type = dict.get('Subtype'); - assert(isName(type), 'invalid font Subtype'); + (0, _util.assert)((0, _primitives.isName)(type), 'invalid font Subtype'); composite = true; } var descriptor = dict.get('FontDescriptor'); if (descriptor) { - var hash = new MurmurHash3_64(); + var hash = new _murmurhash.MurmurHash3_64(); var encoding = baseDict.getRaw('Encoding'); - if (isName(encoding)) { + if ((0, _primitives.isName)(encoding)) { hash.update(encoding.name); - } else if (isRef(encoding)) { + } else if ((0, _primitives.isRef)(encoding)) { hash.update(encoding.toString()); - } else if (isDict(encoding)) { + } else if ((0, _primitives.isDict)(encoding)) { var keys = encoding.getKeys(); for (var i = 0, ii = keys.length; i < ii; i++) { var entry = encoding.getRaw(keys[i]); - if (isName(entry)) { + if ((0, _primitives.isName)(entry)) { hash.update(entry.name); - } else if (isRef(entry)) { + } else if ((0, _primitives.isRef)(entry)) { hash.update(entry.toString()); - } else if (isArray(entry)) { + } else if ((0, _util.isArray)(entry)) { var diffLength = entry.length, diffBuf = new Array(diffLength); for (var j = 0; j < diffLength; j++) { var diffEntry = entry[j]; - if (isName(diffEntry)) { + if ((0, _primitives.isName)(diffEntry)) { diffBuf[j] = diffEntry.name; - } else if (isNum(diffEntry) || isRef(diffEntry)) { + } else if ((0, _util.isNum)(diffEntry) || (0, _primitives.isRef)(diffEntry)) { diffBuf[j] = diffEntry.toString(); } } hash.update(diffBuf.join()); } } } var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode'); - if (isStream(toUnicode)) { + if ((0, _primitives.isStream)(toUnicode)) { var stream = toUnicode.str || toUnicode; uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start); hash.update(uint8array); - } else if (isName(toUnicode)) { + } else if ((0, _primitives.isName)(toUnicode)) { hash.update(toUnicode.name); } var widths = dict.get('Widths') || baseDict.get('Widths'); if (widths) { uint8array = new Uint8Array(new Uint32Array(widths).buffer); hash.update(uint8array); } } @@ -18174,63 +18101,63 @@ var PartialEvaluator = function PartialE var dict = preEvaluatedFont.dict; var composite = preEvaluatedFont.composite; var descriptor = preEvaluatedFont.descriptor; var type = preEvaluatedFont.type; var maxCharIndex = composite ? 0xFFFF : 0xFF; var properties; if (!descriptor) { if (type === 'Type3') { - descriptor = new Dict(null); - descriptor.set('FontName', Name.get(type)); + descriptor = new _primitives.Dict(null); + descriptor.set('FontName', _primitives.Name.get(type)); descriptor.set('FontBBox', dict.getArray('FontBBox')); } else { var baseFontName = dict.get('BaseFont'); - assert(isName(baseFontName), 'Base font is not specified'); + (0, _util.assert)((0, _primitives.isName)(baseFontName), 'Base font is not specified'); baseFontName = baseFontName.name.replace(/[,_]/g, '-'); var metrics = this.getBaseFontMetrics(baseFontName); var fontNameWoStyle = baseFontName.split('-')[0]; - var flags = (this.isSerifFont(fontNameWoStyle) ? FontFlags.Serif : 0) | (metrics.monospace ? FontFlags.FixedPitch : 0) | (getSymbolsFonts()[fontNameWoStyle] ? FontFlags.Symbolic : FontFlags.Nonsymbolic); + var flags = (this.isSerifFont(fontNameWoStyle) ? _fonts.FontFlags.Serif : 0) | (metrics.monospace ? _fonts.FontFlags.FixedPitch : 0) | ((0, _standard_fonts.getSymbolsFonts)()[fontNameWoStyle] ? _fonts.FontFlags.Symbolic : _fonts.FontFlags.Nonsymbolic); properties = { type, name: baseFontName, widths: metrics.widths, defaultWidth: metrics.defaultWidth, flags, firstChar: 0, lastChar: maxCharIndex }; return this.extractDataStructures(dict, dict, properties).then(properties => { properties.widths = this.buildCharCodeToWidth(metrics.widths, properties); - return new Font(baseFontName, null, properties); + return new _fonts.Font(baseFontName, null, properties); }); } } var firstChar = dict.get('FirstChar') || 0; var lastChar = dict.get('LastChar') || maxCharIndex; var fontName = descriptor.get('FontName'); var baseFont = dict.get('BaseFont'); - if (isString(fontName)) { - fontName = Name.get(fontName); - } - if (isString(baseFont)) { - baseFont = Name.get(baseFont); + if ((0, _util.isString)(fontName)) { + fontName = _primitives.Name.get(fontName); + } + if ((0, _util.isString)(baseFont)) { + baseFont = _primitives.Name.get(baseFont); } if (type !== 'Type3') { var fontNameStr = fontName && fontName.name; var baseFontStr = baseFont && baseFont.name; if (fontNameStr !== baseFontStr) { - info('The FontDescriptor\'s FontName is "' + fontNameStr + '" but should be the same as the Font\'s BaseFont "' + baseFontStr + '"'); + (0, _util.info)('The FontDescriptor\'s FontName is "' + fontNameStr + '" but should be the same as the Font\'s BaseFont "' + baseFontStr + '"'); if (fontNameStr && baseFontStr && baseFontStr.indexOf(fontNameStr) === 0) { fontName = baseFont; } } } fontName = fontName || baseFont; - assert(isName(fontName), 'invalid font name'); + (0, _util.assert)((0, _primitives.isName)(fontName), 'invalid font name'); var fontFile = descriptor.get('FontFile', 'FontFile2', 'FontFile3'); if (fontFile) { if (fontFile.dict) { var subtype = fontFile.dict.get('Subtype'); if (subtype) { subtype = subtype.name; } var length1 = fontFile.dict.get('Length1'); @@ -18245,35 +18172,35 @@ var PartialEvaluator = function PartialE file: fontFile, length1, length2, length3, loadedName: baseDict.loadedName, composite, wideChars: composite, fixedPitch: false, - fontMatrix: dict.getArray('FontMatrix') || FONT_IDENTITY_MATRIX, + fontMatrix: dict.getArray('FontMatrix') || _util.FONT_IDENTITY_MATRIX, firstChar: firstChar || 0, lastChar: lastChar || maxCharIndex, bbox: descriptor.getArray('FontBBox'), ascent: descriptor.get('Ascent'), descent: descriptor.get('Descent'), xHeight: descriptor.get('XHeight'), capHeight: descriptor.get('CapHeight'), flags: descriptor.get('Flags'), italicAngle: descriptor.get('ItalicAngle'), coded: false }; var cMapPromise; if (composite) { var cidEncoding = baseDict.get('Encoding'); - if (isName(cidEncoding)) { + if ((0, _primitives.isName)(cidEncoding)) { properties.cidEncoding = cidEncoding.name; } - cMapPromise = CMapFactory.create({ + cMapPromise = _cmap.CMapFactory.create({ encoding: cidEncoding, fetchBuiltInCMap: this.fetchBuiltInCMap, useCMap: null }).then(function (cMap) { properties.cMap = cMap; properties.vertical = properties.cMap.vertical; }); } else { @@ -18281,17 +18208,17 @@ var PartialEvaluator = function PartialE } return cMapPromise.then(() => { return this.extractDataStructures(dict, baseDict, properties); }).then(properties => { this.extractWidths(dict, descriptor, properties); if (type === 'Type3') { properties.isType3Font = true; } - return new Font(fontName.name, fontFile, properties); + return new _fonts.Font(fontName.name, fontFile, properties); }); } }; return PartialEvaluator; }(); var TranslatedFont = function TranslatedFontClosure() { function TranslatedFont(loadedName, font, dict) { this.loadedName = loadedName; @@ -18305,17 +18232,17 @@ var TranslatedFont = function Translated if (this.sent) { return; } var fontData = this.font.exportData(); handler.send('commonobj', [this.loadedName, 'Font', fontData]); this.sent = true; }, loadType3Data(evaluator, resources, parentOperatorList, task) { - assert(this.font.isType3Font); + (0, _util.assert)(this.font.isType3Font); if (this.type3Loaded) { return this.type3Loaded; } var type3Options = Object.create(evaluator.options); type3Options.ignoreErrors = false; var type3Evaluator = evaluator.clone(type3Options); var translatedFont = this.font; var loadCharProcsPromise = Promise.resolve(); @@ -18332,17 +18259,17 @@ var TranslatedFont = function Translated stream: glyphStream, task, resources: fontResources, operatorList }).then(function () { charProcOperatorList[key] = operatorList.getIR(); parentOperatorList.addDependencies(operatorList.dependencies); }).catch(function (reason) { - warn(`Type3 font resource "${key}" is not available.`); + (0, _util.warn)(`Type3 font resource "${key}" is not available.`); var operatorList = new OperatorList(); charProcOperatorList[key] = operatorList.getIR(); }); }); } this.type3Loaded = loadCharProcsPromise.then(function () { translatedFont.charProcOperatorList = charProcOperatorList; }); @@ -18355,19 +18282,19 @@ var OperatorList = function OperatorList var CHUNK_SIZE = 1000; var CHUNK_SIZE_ABOUT = CHUNK_SIZE - 5; function getTransfers(queue) { var transfers = []; var fnArray = queue.fnArray, argsArray = queue.argsArray; for (var i = 0, ii = queue.length; i < ii; i++) { switch (fnArray[i]) { - case OPS.paintInlineImageXObject: - case OPS.paintInlineImageXObjectGroup: - case OPS.paintImageMaskXObject: + case _util.OPS.paintInlineImageXObject: + case _util.OPS.paintInlineImageXObjectGroup: + case _util.OPS.paintImageMaskXObject: var arg = argsArray[i][0]; if (!arg.cached) { transfers.push(arg.data.buffer); } break; } } return transfers; @@ -18389,35 +18316,35 @@ var OperatorList = function OperatorList return this._totalLength + this.length; }, addOp(fn, args) { this.fnArray.push(fn); this.argsArray.push(args); if (this.messageHandler) { if (this.fnArray.length >= CHUNK_SIZE) { this.flush(); - } else if (this.fnArray.length >= CHUNK_SIZE_ABOUT && (fn === OPS.restore || fn === OPS.endText)) { + } else if (this.fnArray.length >= CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) { this.flush(); } } }, addDependency(dependency) { if (dependency in this.dependencies) { return; } this.dependencies[dependency] = true; - this.addOp(OPS.dependency, [dependency]); + this.addOp(_util.OPS.dependency, [dependency]); }, addDependencies(dependencies) { for (var key in dependencies) { this.addDependency(key); } }, addOpList(opList) { - Util.extendObj(this.dependencies, opList.dependencies); + _util.Util.extendObj(this.dependencies, opList.dependencies); for (var i = 0, ii = opList.length; i < ii; i++) { this.addOp(opList.fnArray[i], opList.argsArray[i]); } }, getIR() { return { fnArray: this.fnArray, argsArray: this.argsArray, @@ -18461,30 +18388,30 @@ var StateManager = function StateManager }, restore() { var prev = this.stateStack.pop(); if (prev) { this.state = prev; } }, transform(args) { - this.state.ctm = Util.transform(this.state.ctm, args); + this.state.ctm = _util.Util.transform(this.state.ctm, args); } }; return StateManager; }(); var TextState = function TextStateClosure() { function TextState() { - this.ctm = new Float32Array(IDENTITY_MATRIX); + this.ctm = new Float32Array(_util.IDENTITY_MATRIX); this.fontName = null; this.fontSize = 0; this.font = null; - this.fontMatrix = FONT_IDENTITY_MATRIX; - this.textMatrix = IDENTITY_MATRIX.slice(); - this.textLineMatrix = IDENTITY_MATRIX.slice(); + this.fontMatrix = _util.FONT_IDENTITY_MATRIX; + this.textMatrix = _util.IDENTITY_MATRIX.slice(); + this.textLineMatrix = _util.IDENTITY_MATRIX.slice(); this.charSpacing = 0; this.wordSpacing = 0; this.leading = 0; this.textHScale = 1; this.textRise = 0; } TextState.prototype = { setTextMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) { @@ -18542,17 +18469,17 @@ var TextState = function TextStateClosur return { width: tx, height: ty, value: font.vertical ? ty : tx }; }, calcRenderMatrix: function TextState_calcRendeMatrix(ctm) { var tsm = [this.fontSize * this.textHScale, 0, 0, this.fontSize, 0, this.textRise]; - return Util.transform(ctm, Util.transform(this.textMatrix, tsm)); + return _util.Util.transform(ctm, _util.Util.transform(this.textMatrix, tsm)); }, carriageReturn: function TextState_carriageReturn() { this.translateTextLineMatrix(0, -this.leading); this.textMatrix = this.textLineMatrix.slice(); }, clone: function TextState_clone() { var clone = Object.create(this); clone.textMatrix = this.textMatrix.slice(); @@ -18560,426 +18487,426 @@ var TextState = function TextStateClosur clone.fontMatrix = this.fontMatrix.slice(); return clone; } }; return TextState; }(); var EvalState = function EvalStateClosure() { function EvalState() { - this.ctm = new Float32Array(IDENTITY_MATRIX); + this.ctm = new Float32Array(_util.IDENTITY_MATRIX); this.font = null; - this.textRenderingMode = TextRenderingMode.FILL; - this.fillColorSpace = ColorSpace.singletons.gray; - this.strokeColorSpace = ColorSpace.singletons.gray; + this.textRenderingMode = _util.TextRenderingMode.FILL; + this.fillColorSpace = _colorspace.ColorSpace.singletons.gray; + this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray; } EvalState.prototype = { clone: function CanvasExtraState_clone() { return Object.create(this); } }; return EvalState; }(); var EvaluatorPreprocessor = function EvaluatorPreprocessorClosure() { - var getOPMap = getLookupTableFactory(function (t) { + var getOPMap = (0, _util.getLookupTableFactory)(function (t) { t['w'] = { - id: OPS.setLineWidth, + id: _util.OPS.setLineWidth, numArgs: 1, variableArgs: false }; t['J'] = { - id: OPS.setLineCap, + id: _util.OPS.setLineCap, numArgs: 1, variableArgs: false }; t['j'] = { - id: OPS.setLineJoin, + id: _util.OPS.setLineJoin, numArgs: 1, variableArgs: false }; t['M'] = { - id: OPS.setMiterLimit, + id: _util.OPS.setMiterLimit, numArgs: 1, variableArgs: false }; t['d'] = { - id: OPS.setDash, + id: _util.OPS.setDash, numArgs: 2, variableArgs: false }; t['ri'] = { - id: OPS.setRenderingIntent, + id: _util.OPS.setRenderingIntent, numArgs: 1, variableArgs: false }; t['i'] = { - id: OPS.setFlatness, + id: _util.OPS.setFlatness, numArgs: 1, variableArgs: false }; t['gs'] = { - id: OPS.setGState, + id: _util.OPS.setGState, numArgs: 1, variableArgs: false }; t['q'] = { - id: OPS.save, + id: _util.OPS.save, numArgs: 0, variableArgs: false }; t['Q'] = { - id: OPS.restore, + id: _util.OPS.restore, numArgs: 0, variableArgs: false }; t['cm'] = { - id: OPS.transform, + id: _util.OPS.transform, numArgs: 6, variableArgs: false }; t['m'] = { - id: OPS.moveTo, + id: _util.OPS.moveTo, numArgs: 2, variableArgs: false }; t['l'] = { - id: OPS.lineTo, + id: _util.OPS.lineTo, numArgs: 2, variableArgs: false }; t['c'] = { - id: OPS.curveTo, + id: _util.OPS.curveTo, numArgs: 6, variableArgs: false }; t['v'] = { - id: OPS.curveTo2, + id: _util.OPS.curveTo2, numArgs: 4, variableArgs: false }; t['y'] = { - id: OPS.curveTo3, + id: _util.OPS.curveTo3, numArgs: 4, variableArgs: false }; t['h'] = { - id: OPS.closePath, + id: _util.OPS.closePath, numArgs: 0, variableArgs: false }; t['re'] = { - id: OPS.rectangle, + id: _util.OPS.rectangle, numArgs: 4, variableArgs: false }; t['S'] = { - id: OPS.stroke, + id: _util.OPS.stroke, numArgs: 0, variableArgs: false }; t['s'] = { - id: OPS.closeStroke, + id: _util.OPS.closeStroke, numArgs: 0, variableArgs: false }; t['f'] = { - id: OPS.fill, + id: _util.OPS.fill, numArgs: 0, variableArgs: false }; t['F'] = { - id: OPS.fill, + id: _util.OPS.fill, numArgs: 0, variableArgs: false }; t['f*'] = { - id: OPS.eoFill, + id: _util.OPS.eoFill, numArgs: 0, variableArgs: false }; t['B'] = { - id: OPS.fillStroke, + id: _util.OPS.fillStroke, numArgs: 0, variableArgs: false }; t['B*'] = { - id: OPS.eoFillStroke, + id: _util.OPS.eoFillStroke, numArgs: 0, variableArgs: false }; t['b'] = { - id: OPS.closeFillStroke, + id: _util.OPS.closeFillStroke, numArgs: 0, variableArgs: false }; t['b*'] = { - id: OPS.closeEOFillStroke, + id: _util.OPS.closeEOFillStroke, numArgs: 0, variableArgs: false }; t['n'] = { - id: OPS.endPath, + id: _util.OPS.endPath, numArgs: 0, variableArgs: false }; t['W'] = { - id: OPS.clip, + id: _util.OPS.clip, numArgs: 0, variableArgs: false }; t['W*'] = { - id: OPS.eoClip, + id: _util.OPS.eoClip, numArgs: 0, variableArgs: false }; t['BT'] = { - id: OPS.beginText, + id: _util.OPS.beginText, numArgs: 0, variableArgs: false }; t['ET'] = { - id: OPS.endText, + id: _util.OPS.endText, numArgs: 0, variableArgs: false }; t['Tc'] = { - id: OPS.setCharSpacing, + id: _util.OPS.setCharSpacing, numArgs: 1, variableArgs: false }; t['Tw'] = { - id: OPS.setWordSpacing, + id: _util.OPS.setWordSpacing, numArgs: 1, variableArgs: false }; t['Tz'] = { - id: OPS.setHScale, + id: _util.OPS.setHScale, numArgs: 1, variableArgs: false }; t['TL'] = { - id: OPS.setLeading, + id: _util.OPS.setLeading, numArgs: 1, variableArgs: false }; t['Tf'] = { - id: OPS.setFont, + id: _util.OPS.setFont, numArgs: 2, variableArgs: false }; t['Tr'] = { - id: OPS.setTextRenderingMode, + id: _util.OPS.setTextRenderingMode, numArgs: 1, variableArgs: false }; t['Ts'] = { - id: OPS.setTextRise, + id: _util.OPS.setTextRise, numArgs: 1, variableArgs: false }; t['Td'] = { - id: OPS.moveText, + id: _util.OPS.moveText, numArgs: 2, variableArgs: false }; t['TD'] = { - id: OPS.setLeadingMoveText, + id: _util.OPS.setLeadingMoveText, numArgs: 2, variableArgs: false }; t['Tm'] = { - id: OPS.setTextMatrix, + id: _util.OPS.setTextMatrix, numArgs: 6, variableArgs: false }; t['T*'] = { - id: OPS.nextLine, + id: _util.OPS.nextLine, numArgs: 0, variableArgs: false }; t['Tj'] = { - id: OPS.showText, + id: _util.OPS.showText, numArgs: 1, variableArgs: false }; t['TJ'] = { - id: OPS.showSpacedText, + id: _util.OPS.showSpacedText, numArgs: 1, variableArgs: false }; t['\''] = { - id: OPS.nextLineShowText, + id: _util.OPS.nextLineShowText, numArgs: 1, variableArgs: false }; t['"'] = { - id: OPS.nextLineSetSpacingShowText, + id: _util.OPS.nextLineSetSpacingShowText, numArgs: 3, variableArgs: false }; t['d0'] = { - id: OPS.setCharWidth, + id: _util.OPS.setCharWidth, numArgs: 2, variableArgs: false }; t['d1'] = { - id: OPS.setCharWidthAndBounds, + id: _util.OPS.setCharWidthAndBounds, numArgs: 6, variableArgs: false }; t['CS'] = { - id: OPS.setStrokeColorSpace, + id: _util.OPS.setStrokeColorSpace, numArgs: 1, variableArgs: false }; t['cs'] = { - id: OPS.setFillColorSpace, + id: _util.OPS.setFillColorSpace, numArgs: 1, variableArgs: false }; t['SC'] = { - id: OPS.setStrokeColor, + id: _util.OPS.setStrokeColor, numArgs: 4, variableArgs: true }; t['SCN'] = { - id: OPS.setStrokeColorN, + id: _util.OPS.setStrokeColorN, numArgs: 33, variableArgs: true }; t['sc'] = { - id: OPS.setFillColor, + id: _util.OPS.setFillColor, numArgs: 4, variableArgs: true }; t['scn'] = { - id: OPS.setFillColorN, + id: _util.OPS.setFillColorN, numArgs: 33, variableArgs: true }; t['G'] = { - id: OPS.setStrokeGray, + id: _util.OPS.setStrokeGray, numArgs: 1, variableArgs: false }; t['g'] = { - id: OPS.setFillGray, + id: _util.OPS.setFillGray, numArgs: 1, variableArgs: false }; t['RG'] = { - id: OPS.setStrokeRGBColor, + id: _util.OPS.setStrokeRGBColor, numArgs: 3, variableArgs: false }; t['rg'] = { - id: OPS.setFillRGBColor, + id: _util.OPS.setFillRGBColor, numArgs: 3, variableArgs: false }; t['K'] = { - id: OPS.setStrokeCMYKColor, + id: _util.OPS.setStrokeCMYKColor, numArgs: 4, variableArgs: false }; t['k'] = { - id: OPS.setFillCMYKColor, + id: _util.OPS.setFillCMYKColor, numArgs: 4, variableArgs: false }; t['sh'] = { - id: OPS.shadingFill, + id: _util.OPS.shadingFill, numArgs: 1, variableArgs: false }; t['BI'] = { - id: OPS.beginInlineImage, + id: _util.OPS.beginInlineImage, numArgs: 0, variableArgs: false }; t['ID'] = { - id: OPS.beginImageData, + id: _util.OPS.beginImageData, numArgs: 0, variableArgs: false }; t['EI'] = { - id: OPS.endInlineImage, + id: _util.OPS.endInlineImage, numArgs: 1, variableArgs: false }; t['Do'] = { - id: OPS.paintXObject, + id: _util.OPS.paintXObject, numArgs: 1, variableArgs: false }; t['MP'] = { - id: OPS.markPoint, + id: _util.OPS.markPoint, numArgs: 1, variableArgs: false }; t['DP'] = { - id: OPS.markPointProps, + id: _util.OPS.markPointProps, numArgs: 2, variableArgs: false }; t['BMC'] = { - id: OPS.beginMarkedContent, + id: _util.OPS.beginMarkedContent, numArgs: 1, variableArgs: false }; t['BDC'] = { - id: OPS.beginMarkedContentProps, + id: _util.OPS.beginMarkedContentProps, numArgs: 2, variableArgs: false }; t['EMC'] = { - id: OPS.endMarkedContent, + id: _util.OPS.endMarkedContent, numArgs: 0, variableArgs: false }; t['BX'] = { - id: OPS.beginCompat, + id: _util.OPS.beginCompat, numArgs: 0, variableArgs: false }; t['EX'] = { - id: OPS.endCompat, + id: _util.OPS.endCompat, numArgs: 0, variableArgs: false }; t['BM'] = null; t['BD'] = null; t['true'] = null; t['fa'] = null; t['fal'] = null; t['fals'] = null; t['false'] = null; t['nu'] = null; t['nul'] = null; t['null'] = null; }); function EvaluatorPreprocessor(stream, xref, stateManager) { this.opMap = getOPMap(); - this.parser = new Parser(new Lexer(stream, this.opMap), false, xref); + this.parser = new _parser.Parser(new _parser.Lexer(stream, this.opMap), false, xref); this.stateManager = stateManager; this.nonProcessedArgs = []; } EvaluatorPreprocessor.prototype = { get savedStatesDepth() { return this.stateManager.stateStack.length; }, read: function EvaluatorPreprocessor_read(operation) { var args = operation.args; while (true) { var obj = this.parser.getObj(); - if (isCmd(obj)) { + if ((0, _primitives.isCmd)(obj)) { var cmd = obj.cmd; var opSpec = this.opMap[cmd]; if (!opSpec) { - warn('Unknown command "' + cmd + '"'); + (0, _util.warn)('Unknown command "' + cmd + '"'); continue; } var fn = opSpec.id; var numArgs = opSpec.numArgs; var argsLength = args !== null ? args.length : 0; if (!opSpec.variableArgs) { if (argsLength !== numArgs) { var nonProcessedArgs = this.nonProcessedArgs; @@ -18991,51 +18918,51 @@ var EvaluatorPreprocessor = function Eva if (args === null) { args = []; } args.unshift(nonProcessedArgs.pop()); argsLength++; } } if (argsLength < numArgs) { - warn('Skipping command ' + fn + ': expected ' + numArgs + ' args, but received ' + argsLength + ' args.'); + (0, _util.warn)('Skipping command ' + fn + ': expected ' + numArgs + ' args, but received ' + argsLength + ' args.'); if (args !== null) { args.length = 0; } continue; } } else if (argsLength > numArgs) { - info('Command ' + fn + ': expected [0,' + numArgs + '] args, but received ' + argsLength + ' args.'); + (0, _util.info)('Command ' + fn + ': expected [0,' + numArgs + '] args, but received ' + argsLength + ' args.'); } this.preprocessCommand(fn, args); operation.fn = fn; operation.args = args; return true; } - if (isEOF(obj)) { + if ((0, _primitives.isEOF)(obj)) { return false; } if (obj !== null) { if (args === null) { args = []; } args.push(obj); - assert(args.length <= 33, 'Too many arguments'); + (0, _util.assert)(args.length <= 33, 'Too many arguments'); } } }, preprocessCommand: function EvaluatorPreprocessor_preprocessCommand(fn, args) { switch (fn | 0) { - case OPS.save: + case _util.OPS.save: this.stateManager.save(); break; - case OPS.restore: + case _util.OPS.restore: this.stateManager.restore(); break; - case OPS.transform: + case _util.OPS.transform: this.stateManager.transform(args); break; } } }; return EvaluatorPreprocessor; }(); var QueueOptimizer = function QueueOptimizerClosure() { @@ -19048,39 +18975,39 @@ var QueueOptimizer = function QueueOptim state[pattern[pattern.length - 1]] = fn; } function handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray) { var iFirstPIMXO = iFirstSave + 2; for (var i = 0; i < count; i++) { var arg = argsArray[iFirstPIMXO + 4 * i]; var imageMask = arg.length === 1 && arg[0]; if (imageMask && imageMask.width === 1 && imageMask.height === 1 && (!imageMask.data.length || imageMask.data.length === 1 && imageMask.data[0] === 0)) { - fnArray[iFirstPIMXO + 4 * i] = OPS.paintSolidColorImageMask; + fnArray[iFirstPIMXO + 4 * i] = _util.OPS.paintSolidColorImageMask; continue; } break; } return count - i; } var InitialState = []; - addState(InitialState, [OPS.save, OPS.transform, OPS.paintInlineImageXObject, OPS.restore], function foundInlineImageGroup(context) { + addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], function foundInlineImageGroup(context) { var MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10; var MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200; var MAX_WIDTH = 1000; var IMAGE_PADDING = 1; var fnArray = context.fnArray, argsArray = context.argsArray; var curr = context.iCurr; var iFirstSave = curr - 3; var iFirstTransform = curr - 2; var iFirstPIIXO = curr - 1; var i = iFirstSave + 4; var ii = fnArray.length; while (i + 3 < ii) { - if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintInlineImageXObject || fnArray[i + 3] !== OPS.restore) { + if (fnArray[i] !== _util.OPS.save || fnArray[i + 1] !== _util.OPS.transform || fnArray[i + 2] !== _util.OPS.paintInlineImageXObject || fnArray[i + 3] !== _util.OPS.restore) { break; } i += 4; } var count = Math.min((i - iFirstSave) / 4, MAX_IMAGES_IN_INLINE_IMAGES_BLOCK); if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) { return i; } @@ -19132,39 +19059,39 @@ var QueueOptimizer = function QueueOptim data[offset - 1] = data[offset + 3]; data[offset + rowSize] = data[offset + rowSize - 4]; data[offset + rowSize + 1] = data[offset + rowSize - 3]; data[offset + rowSize + 2] = data[offset + rowSize - 2]; data[offset + rowSize + 3] = data[offset + rowSize - 1]; offset -= imgRowSize; } } - fnArray.splice(iFirstSave, count * 4, OPS.paintInlineImageXObjectGroup); + fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup); argsArray.splice(iFirstSave, count * 4, [{ width: imgWidth, height: imgHeight, - kind: ImageKind.RGBA_32BPP, + kind: _util.ImageKind.RGBA_32BPP, data: imgData }, map]); return iFirstSave + 1; }); - addState(InitialState, [OPS.save, OPS.transform, OPS.paintImageMaskXObject, OPS.restore], function foundImageMaskGroup(context) { + addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], function foundImageMaskGroup(context) { var MIN_IMAGES_IN_MASKS_BLOCK = 10; var MAX_IMAGES_IN_MASKS_BLOCK = 100; var MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000; var fnArray = context.fnArray, argsArray = context.argsArray; var curr = context.iCurr; var iFirstSave = curr - 3; var iFirstTransform = curr - 2; var iFirstPIMXO = curr - 1; var i = iFirstSave + 4; var ii = fnArray.length; while (i + 3 < ii) { - if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintImageMaskXObject || fnArray[i + 3] !== OPS.restore) { + if (fnArray[i] !== _util.OPS.save || fnArray[i + 1] !== _util.OPS.transform || fnArray[i + 2] !== _util.OPS.paintImageMaskXObject || fnArray[i + 3] !== _util.OPS.restore) { break; } i += 4; } var count = (i - iFirstSave) / 4; count = handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray); if (count < MIN_IMAGES_IN_MASKS_BLOCK) { return i; @@ -19195,37 +19122,37 @@ var QueueOptimizer = function QueueOptim count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK); var positions = new Float32Array(count * 2); iTransform = iFirstTransform; for (q = 0; q < count; q++, iTransform += 4) { transformArgs = argsArray[iTransform]; positions[q << 1] = transformArgs[4]; positions[(q << 1) + 1] = transformArgs[5]; } - fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectRepeat); + fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat); argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg3, positions]); } else { count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK); var images = []; for (q = 0; q < count; q++) { transformArgs = argsArray[iFirstTransform + (q << 2)]; var maskParams = argsArray[iFirstPIMXO + (q << 2)][0]; images.push({ data: maskParams.data, width: maskParams.width, height: maskParams.height, transform: transformArgs }); } - fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectGroup); + fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup); argsArray.splice(iFirstSave, count * 4, [images]); } return iFirstSave + 1; }); - addState(InitialState, [OPS.save, OPS.transform, OPS.paintImageXObject, OPS.restore], function (context) { + addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) { var MIN_IMAGES_IN_BLOCK = 3; var MAX_IMAGES_IN_BLOCK = 1000; var fnArray = context.fnArray, argsArray = context.argsArray; var curr = context.iCurr; var iFirstSave = curr - 3; var iFirstTransform = curr - 2; var iFirstPIXO = curr - 1; @@ -19234,17 +19161,17 @@ var QueueOptimizer = function QueueOptim return iFirstRestore + 1; } var firstPIXOArg0 = argsArray[iFirstPIXO][0]; var firstTransformArg0 = argsArray[iFirstTransform][0]; var firstTransformArg3 = argsArray[iFirstTransform][3]; var i = iFirstSave + 4; var ii = fnArray.length; while (i + 3 < ii) { - if (fnArray[i] !== OPS.save || fnArray[i + 1] !== OPS.transform || fnArray[i + 2] !== OPS.paintImageXObject || fnArray[i + 3] !== OPS.restore) { + if (fnArray[i] !== _util.OPS.save || fnArray[i + 1] !== _util.OPS.transform || fnArray[i + 2] !== _util.OPS.paintImageXObject || fnArray[i + 3] !== _util.OPS.restore) { break; } if (argsArray[i + 1][0] !== firstTransformArg0 || argsArray[i + 1][1] !== 0 || argsArray[i + 1][2] !== 0 || argsArray[i + 1][3] !== firstTransformArg3) { break; } if (argsArray[i + 2][0] !== firstPIXOArg0) { break; } @@ -19257,37 +19184,37 @@ var QueueOptimizer = function QueueOptim var positions = new Float32Array(count * 2); var iTransform = iFirstTransform; for (var q = 0; q < count; q++, iTransform += 4) { var transformArgs = argsArray[iTransform]; positions[q << 1] = transformArgs[4]; positions[(q << 1) + 1] = transformArgs[5]; } var args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions]; - fnArray.splice(iFirstSave, count * 4, OPS.paintImageXObjectRepeat); + fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat); argsArray.splice(iFirstSave, count * 4, args); return iFirstSave + 1; }); - addState(InitialState, [OPS.beginText, OPS.setFont, OPS.setTextMatrix, OPS.showText, OPS.endText], function (context) { + addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], function (context) { var MIN_CHARS_IN_BLOCK = 3; var MAX_CHARS_IN_BLOCK = 1000; var fnArray = context.fnArray, argsArray = context.argsArray; var curr = context.iCurr; var iFirstBeginText = curr - 4; var iFirstSetFont = curr - 3; var iFirstSetTextMatrix = curr - 2; var iFirstShowText = curr - 1; var iFirstEndText = curr; var firstSetFontArg0 = argsArray[iFirstSetFont][0]; var firstSetFontArg1 = argsArray[iFirstSetFont][1]; var i = iFirstBeginText + 5; var ii = fnArray.length; while (i + 4 < ii) { - if (fnArray[i] !== OPS.beginText || fnArray[i + 1] !== OPS.setFont || fnArray[i + 2] !== OPS.setTextMatrix || fnArray[i + 3] !== OPS.showText || fnArray[i + 4] !== OPS.endText) { + if (fnArray[i] !== _util.OPS.beginText || fnArray[i + 1] !== _util.OPS.setFont || fnArray[i + 2] !== _util.OPS.setTextMatrix || fnArray[i + 3] !== _util.OPS.showText || fnArray[i + 4] !== _util.OPS.endText) { break; } if (argsArray[i + 1][0] !== firstSetFontArg0 || argsArray[i + 1][1] !== firstSetFontArg1) { break; } i += 5; } var count = Math.min((i - iFirstBeginText) / 5, MAX_CHARS_IN_BLOCK); @@ -19340,100 +19267,100 @@ exports.PartialEvaluator = PartialEvalua /***/ }), /* 14 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var sharedUtil = __w_pdfjs_require__(0); -var coreArithmeticDecoder = __w_pdfjs_require__(9); -var info = sharedUtil.info; -var warn = sharedUtil.warn; -var error = sharedUtil.error; -var log2 = sharedUtil.log2; -var readUint16 = sharedUtil.readUint16; -var readUint32 = sharedUtil.readUint32; -var ArithmeticDecoder = coreArithmeticDecoder.ArithmeticDecoder; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.JpxImage = undefined; + +var _util = __w_pdfjs_require__(0); + +var _arithmetic_decoder = __w_pdfjs_require__(9); + var JpxImage = function JpxImageClosure() { var SubbandsGainLog2 = { 'LL': 0, 'LH': 1, 'HL': 1, 'HH': 2 }; function JpxImage() { this.failOnCorruptedImage = false; } JpxImage.prototype = { parse: function JpxImage_parse(data) { - var head = readUint16(data, 0); + var head = (0, _util.readUint16)(data, 0); if (head === 0xFF4F) { this.parseCodestream(data, 0, data.length); return; } var position = 0, length = data.length; while (position < length) { var headerSize = 8; - var lbox = readUint32(data, position); - var tbox = readUint32(data, position + 4); + var lbox = (0, _util.readUint32)(data, position); + var tbox = (0, _util.readUint32)(data, position + 4); position += headerSize; if (lbox === 1) { - lbox = readUint32(data, position) * 4294967296 + readUint32(data, position + 4); + lbox = (0, _util.readUint32)(data, position) * 4294967296 + (0, _util.readUint32)(data, position + 4); position += 8; headerSize += 8; } if (lbox === 0) { lbox = length - position + headerSize; } if (lbox < headerSize) { - error('JPX Error: Invalid box field size'); + (0, _util.error)('JPX Error: Invalid box field size'); } var dataLength = lbox - headerSize; var jumpDataLength = true; switch (tbox) { case 0x6A703268: jumpDataLength = false; break; case 0x636F6C72: var method = data[position]; if (method === 1) { - var colorspace = readUint32(data, position + 3); + var colorspace = (0, _util.readUint32)(data, position + 3); switch (colorspace) { case 16: case 17: case 18: break; default: - warn('Unknown colorspace ' + colorspace); + (0, _util.warn)('Unknown colorspace ' + colorspace); break; } } else if (method === 2) { - info('ICC profile not supported'); + (0, _util.info)('ICC profile not supported'); } break; case 0x6A703263: this.parseCodestream(data, position, position + dataLength); break; case 0x6A502020: - if (readUint32(data, position) !== 0x0d0a870a) { - warn('Invalid JP2 signature'); + if ((0, _util.readUint32)(data, position) !== 0x0d0a870a) { + (0, _util.warn)('Invalid JP2 signature'); } break; case 0x6A501A1A: case 0x66747970: case 0x72726571: case 0x72657320: case 0x69686472: break; default: var headerType = String.fromCharCode(tbox >> 24 & 0xFF, tbox >> 16 & 0xFF, tbox >> 8 & 0xFF, tbox & 0xFF); - warn('Unsupported header type ' + tbox + ' (' + headerType + ')'); + (0, _util.warn)('Unsupported header type ' + tbox + ' (' + headerType + ')'); break; } if (jumpDataLength) { position += dataLength; } } }, parseImageProperties: function JpxImage_parseImageProperties(stream) { @@ -19452,51 +19379,51 @@ var JpxImage = function JpxImageClosure( var Csiz = stream.getUint16(); this.width = Xsiz - XOsiz; this.height = Ysiz - YOsiz; this.componentsCount = Csiz; this.bitsPerComponent = 8; return; } } - error('JPX Error: No size marker found in JPX stream'); + (0, _util.error)('JPX Error: No size marker found in JPX stream'); }, parseCodestream: function JpxImage_parseCodestream(data, start, end) { var context = {}; var doNotRecover = false; try { var position = start; while (position + 1 < end) { - var code = readUint16(data, position); + var code = (0, _util.readUint16)(data, position); position += 2; var length = 0, j, sqcd, spqcds, spqcdSize, scalarExpounded, tile; switch (code) { case 0xFF4F: context.mainHeader = true; break; case 0xFFD9: break; case 0xFF51: - length = readUint16(data, position); + length = (0, _util.readUint16)(data, position); var siz = {}; - siz.Xsiz = readUint32(data, position + 4); - siz.Ysiz = readUint32(data, position + 8); - siz.XOsiz = readUint32(data, position + 12); - siz.YOsiz = readUint32(data, position + 16); - siz.XTsiz = readUint32(data, position + 20); - siz.YTsiz = readUint32(data, position + 24); - siz.XTOsiz = readUint32(data, position + 28); - siz.YTOsiz = readUint32(data, position + 32); - var componentsCount = readUint16(data, position + 36); + siz.Xsiz = (0, _util.readUint32)(data, position + 4); + siz.Ysiz = (0, _util.readUint32)(data, position + 8); + siz.XOsiz = (0, _util.readUint32)(data, position + 12); + siz.YOsiz = (0, _util.readUint32)(data, position + 16); + siz.XTsiz = (0, _util.readUint32)(data, position + 20); + siz.YTsiz = (0, _util.readUint32)(data, position + 24); + siz.XTOsiz = (0, _util.readUint32)(data, position + 28); + siz.YTOsiz = (0, _util.readUint32)(data, position + 32); + var componentsCount = (0, _util.readUint16)(data, position + 36); siz.Csiz = componentsCount; var components = []; j = position + 38; for (var i = 0; i < componentsCount; i++) { var component = { precision: (data[j] & 0x7F) + 1, isSigned: !!(data[j] & 0x80), XRsiz: data[j + 1], @@ -19507,17 +19434,17 @@ var JpxImage = function JpxImageClosure( } context.SIZ = siz; context.components = components; calculateTileGrids(context, components); context.QCC = []; context.COC = []; break; case 0xFF5C: - length = readUint16(data, position); + length = (0, _util.readUint16)(data, position); var qcd = {}; j = position + 2; sqcd = data[j++]; switch (sqcd & 0x1F) { case 0: spqcdSize = 8; scalarExpounded = true; break; @@ -19552,24 +19479,24 @@ var JpxImage = function JpxImageClosure( if (context.mainHeader) { context.QCD = qcd; } else { context.currentTile.QCD = qcd; context.currentTile.QCC = []; } break; case 0xFF5D: - length = readUint16(data, position); + length = (0, _util.readUint16)(data, position); var qcc = {}; j = position + 2; var cqcc; if (context.SIZ.Csiz < 257) { cqcc = data[j++]; } else { - cqcc = readUint16(data, j); + cqcc = (0, _util.readUint16)(data, j); j += 2; } sqcd = data[j++]; switch (sqcd & 0x1F) { case 0: spqcdSize = 8; scalarExpounded = true; break; @@ -19603,25 +19530,25 @@ var JpxImage = function JpxImageClosure( qcc.SPqcds = spqcds; if (context.mainHeader) { context.QCC[cqcc] = qcc; } else { context.currentTile.QCC[cqcc] = qcc; } break; case 0xFF52: - length = readUint16(data, position); + length = (0, _util.readUint16)(data, position); var cod = {}; j = position + 2; var scod = data[j++]; cod.entropyCoderWithCustomPrecincts = !!(scod & 1); cod.sopMarkerUsed = !!(scod & 2); cod.ephMarkerUsed = !!(scod & 4); cod.progressionOrder = data[j++]; - cod.layersCount = readUint16(data, j); + cod.layersCount = (0, _util.readUint16)(data, j); j += 2; cod.multipleComponentTransform = data[j++]; cod.decompositionLevelsCount = data[j++]; cod.xcb = (data[j++] & 0xF) + 2; cod.ycb = (data[j++] & 0xF) + 2; var blockStyle = data[j++]; cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1); cod.resetContextProbabilities = !!(blockStyle & 2); @@ -19664,20 +19591,20 @@ var JpxImage = function JpxImageClosure( if (context.mainHeader) { context.COD = cod; } else { context.currentTile.COD = cod; context.currentTile.COC = []; } break; case 0xFF90: - length = readUint16(data, position); + length = (0, _util.readUint16)(data, position); tile = {}; - tile.index = readUint16(data, position + 2); - tile.length = readUint32(data, position + 4); + tile.index = (0, _util.readUint16)(data, position + 2); + tile.length = (0, _util.readUint32)(data, position + 4); tile.dataEnd = tile.length + position - 2; tile.partIndex = data[position + 8]; tile.partsCount = data[position + 9]; context.mainHeader = false; if (tile.partIndex === 0) { tile.COD = context.COD; tile.COC = context.COC.slice(0); tile.QCD = context.QCD; @@ -19693,30 +19620,30 @@ var JpxImage = function JpxImageClosure( } length = tile.dataEnd - position; parseTilePackets(context, data, position, length); break; case 0xFF55: case 0xFF57: case 0xFF58: case 0xFF64: - length = readUint16(data, position); + length = (0, _util.readUint16)(data, position); break; case 0xFF53: throw new Error('Codestream code 0xFF53 (COC) is ' + 'not implemented'); default: throw new Error('Unknown codestream code: ' + code.toString(16)); } position += length; } } catch (e) { if (doNotRecover || this.failOnCorruptedImage) { - error('JPX Error: ' + e.message); - } else { - warn('JPX: Trying to recover from: ' + e.message); + (0, _util.error)('JPX Error: ' + e.message); + } else { + (0, _util.warn)('JPX: Trying to recover from: ' + e.message); } } this.tiles = transformComponents(context); this.width = context.SIZ.Xsiz - context.SIZ.XOsiz; this.height = context.SIZ.Ysiz - context.SIZ.YOsiz; this.componentsCount = context.SIZ.Csiz; } }; @@ -19915,17 +19842,17 @@ var JpxImage = function JpxImageClosure( return packet; } k = 0; } i = 0; } r = 0; } - error('JPX Error: Out of packets'); + (0, _util.error)('JPX Error: Out of packets'); }; } function ResolutionLayerComponentPositionIterator(context) { var siz = context.SIZ; var tileIndex = context.currentTile.index; var tile = context.tiles[tileIndex]; var layersCount = tile.codingStyleDefaultParameters.layersCount; var componentsCount = siz.Csiz; @@ -19953,17 +19880,17 @@ var JpxImage = function JpxImageClosure( return packet; } k = 0; } i = 0; } l = 0; } - error('JPX Error: Out of packets'); + (0, _util.error)('JPX Error: Out of packets'); }; } function ResolutionPositionComponentLayerIterator(context) { var siz = context.SIZ; var tileIndex = context.currentTile.index; var tile = context.tiles[tileIndex]; var layersCount = tile.codingStyleDefaultParameters.layersCount; var componentsCount = siz.Csiz; @@ -20007,17 +19934,17 @@ var JpxImage = function JpxImageClosure( return packet; } l = 0; } c = 0; } p = 0; } - error('JPX Error: Out of packets'); + (0, _util.error)('JPX Error: Out of packets'); }; } function PositionComponentResolutionLayerIterator(context) { var siz = context.SIZ; var tileIndex = context.currentTile.index; var tile = context.tiles[tileIndex]; var layersCount = tile.codingStyleDefaultParameters.layersCount; var componentsCount = siz.Csiz; @@ -20049,17 +19976,17 @@ var JpxImage = function JpxImageClosure( l = 0; } r = 0; } c = 0; } px = 0; } - error('JPX Error: Out of packets'); + (0, _util.error)('JPX Error: Out of packets'); }; } function ComponentPositionResolutionLayerIterator(context) { var siz = context.SIZ; var tileIndex = context.currentTile.index; var tile = context.tiles[tileIndex]; var layersCount = tile.codingStyleDefaultParameters.layersCount; var componentsCount = siz.Csiz; @@ -20091,17 +20018,17 @@ var JpxImage = function JpxImageClosure( l = 0; } r = 0; } px = 0; } py = 0; } - error('JPX Error: Out of packets'); + (0, _util.error)('JPX Error: Out of packets'); }; } function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) { var posX = pxIndex * precinctIterationSizes.minWidth; var posY = pyIndex * precinctIterationSizes.minHeight; if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) { return null; } @@ -20243,17 +20170,17 @@ var JpxImage = function JpxImageClosure( break; case 3: tile.packetsIterator = new PositionComponentResolutionLayerIterator(context); break; case 4: tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context); break; default: - error('JPX Error: Unsupported progression order ' + progressionOrder); + (0, _util.error)('JPX Error: Unsupported progression order ' + progressionOrder); } } function parseTilePackets(context, data, offset, dataLength) { var position = 0; var buffer, bufferSize = 0, skipNextBit = false; function readBits(count) { @@ -20386,17 +20313,17 @@ var JpxImage = function JpxImageClosure( } } codeblock.zeroBitPlanes = zeroBitPlanesTree.value; } var codingpasses = readCodingpasses(); while (readBits(1)) { codeblock.Lblock++; } - var codingpassesLog2 = log2(codingpasses); + var codingpassesLog2 = (0, _util.log2)(codingpasses); var bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock; var codedDataLength = readBits(bits); queue.push({ codeblock, codingpasses, dataLength: codedDataLength }); } @@ -20453,17 +20380,17 @@ var JpxImage = function JpxImageClosure( var encodedData = new Uint8Array(totalLength); var position = 0; for (j = 0, jj = data.length; j < jj; j++) { dataItem = data[j]; var chunk = dataItem.data.subarray(dataItem.start, dataItem.end); encodedData.set(chunk, position); position += chunk.length; } - var decoder = new ArithmeticDecoder(encodedData, 0, totalLength); + var decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength); bitModel.setDecoder(decoder); for (j = 0; j < codingpasses; j++) { switch (currentCodingpassType) { case 0: bitModel.runSignificancePropagationPass(); break; case 1: bitModel.runMagnitudeRefinementPass(); @@ -20666,17 +20593,17 @@ var JpxImage = function JpxImageClosure( component.quantizationParameters = qcdOrQcc; var codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD; component.codingStyleParameters = codOrCoc; } tile.codingStyleDefaultParameters = context.currentTile.COD; } var TagTree = function TagTreeClosure() { function TagTree(width, height) { - var levelsLength = log2(Math.max(width, height)) + 1; + var levelsLength = (0, _util.log2)(Math.max(width, height)) + 1; this.levels = []; for (var i = 0; i < levelsLength; i++) { var level = { width, height, items: [] }; this.levels.push(level); @@ -20725,17 +20652,17 @@ var JpxImage = function JpxImageClosure( level.items[level.index] = value; return true; } }; return TagTree; }(); var InclusionTree = function InclusionTreeClosure() { function InclusionTree(width, height, defaultValue) { - var levelsLength = log2(Math.max(width, height)) + 1; + var levelsLength = (0, _util.log2)(Math.max(width, height)) + 1; this.levels = []; for (var i = 0; i < levelsLength; i++) { var items = new Uint8Array(width * height); for (var j = 0, jj = items.length; j < jj; j++) { items[j] = defaultValue; } var level = { width, @@ -21063,17 +20990,17 @@ var JpxImage = function JpxImageClosure( } } }, checkSegmentationSymbol: function BitModel_checkSegmentationSymbol() { var decoder = this.decoder; var contexts = this.contexts; var symbol = decoder.readBit(contexts, UNIFORM_CONTEXT) << 3 | decoder.readBit(contexts, UNIFORM_CONTEXT) << 2 | decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT); if (symbol !== 0xA) { - error('JPX Error: Invalid segmentation symbol'); + (0, _util.error)('JPX Error: Invalid segmentation symbol'); } } }; return BitModel; }(); var Transform = function TransformClosure() { function Transform() {} Transform.prototype.calculate = function transformCalculate(subbands, u0, v0) { @@ -21275,190 +21202,168 @@ exports.JpxImage = JpxImage; /***/ }), /* 15 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var sharedUtil = __w_pdfjs_require__(0); -var corePrimitives = __w_pdfjs_require__(1); -var coreCrypto = __w_pdfjs_require__(12); -var coreParser = __w_pdfjs_require__(5); -var coreChunkedStream = __w_pdfjs_require__(11); -var coreColorSpace = __w_pdfjs_require__(3); -var InvalidPDFException = sharedUtil.InvalidPDFException; -var MissingDataException = sharedUtil.MissingDataException; -var XRefParseException = sharedUtil.XRefParseException; -var assert = sharedUtil.assert; -var bytesToString = sharedUtil.bytesToString; -var createPromiseCapability = sharedUtil.createPromiseCapability; -var error = sharedUtil.error; -var info = sharedUtil.info; -var isArray = sharedUtil.isArray; -var isBool = sharedUtil.isBool; -var isInt = sharedUtil.isInt; -var isString = sharedUtil.isString; -var shadow = sharedUtil.shadow; -var stringToPDFString = sharedUtil.stringToPDFString; -var stringToUTF8String = sharedUtil.stringToUTF8String; -var warn = sharedUtil.warn; -var createValidAbsoluteUrl = sharedUtil.createValidAbsoluteUrl; -var Util = sharedUtil.Util; -var Dict = corePrimitives.Dict; -var Ref = corePrimitives.Ref; -var RefSet = corePrimitives.RefSet; -var RefSetCache = corePrimitives.RefSetCache; -var isName = corePrimitives.isName; -var isCmd = corePrimitives.isCmd; -var isDict = corePrimitives.isDict; -var isRef = corePrimitives.isRef; -var isRefsEqual = corePrimitives.isRefsEqual; -var isStream = corePrimitives.isStream; -var CipherTransformFactory = coreCrypto.CipherTransformFactory; -var Lexer = coreParser.Lexer; -var Parser = coreParser.Parser; -var ChunkedStream = coreChunkedStream.ChunkedStream; -var ColorSpace = coreColorSpace.ColorSpace; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.FileSpec = exports.XRef = exports.ObjectLoader = exports.Catalog = undefined; + +var _util = __w_pdfjs_require__(0); + +var _primitives = __w_pdfjs_require__(1); + +var _parser = __w_pdfjs_require__(5); + +var _chunked_stream = __w_pdfjs_require__(11); + +var _crypto = __w_pdfjs_require__(12); + +var _colorspace = __w_pdfjs_require__(3); + var Catalog = function CatalogClosure() { function Catalog(pdfManager, xref, pageFactory) { this.pdfManager = pdfManager; this.xref = xref; this.catDict = xref.getCatalogObj(); - assert(isDict(this.catDict), 'catalog object is not a dictionary'); - this.fontCache = new RefSetCache(); + (0, _util.assert)((0, _primitives.isDict)(this.catDict), 'catalog object is not a dictionary'); + this.fontCache = new _primitives.RefSetCache(); this.builtInCMapCache = Object.create(null); - this.pageKidsCountCache = new RefSetCache(); + this.pageKidsCountCache = new _primitives.RefSetCache(); this.pageFactory = pageFactory; this.pagePromises = []; } Catalog.prototype = { get metadata() { var streamRef = this.catDict.getRaw('Metadata'); - if (!isRef(streamRef)) { - return shadow(this, 'metadata', null); + if (!(0, _primitives.isRef)(streamRef)) { + return (0, _util.shadow)(this, 'metadata', null); } var encryptMetadata = !this.xref.encrypt ? false : this.xref.encrypt.encryptMetadata; var stream = this.xref.fetch(streamRef, !encryptMetadata); var metadata; - if (stream && isDict(stream.dict)) { + if (stream && (0, _primitives.isDict)(stream.dict)) { var type = stream.dict.get('Type'); var subtype = stream.dict.get('Subtype'); - if (isName(type, 'Metadata') && isName(subtype, 'XML')) { + if ((0, _primitives.isName)(type, 'Metadata') && (0, _primitives.isName)(subtype, 'XML')) { try { - metadata = stringToUTF8String(bytesToString(stream.getBytes())); + metadata = (0, _util.stringToUTF8String)((0, _util.bytesToString)(stream.getBytes())); } catch (e) { - if (e instanceof MissingDataException) { + if (e instanceof _util.MissingDataException) { throw e; } - info('Skipping invalid metadata.'); - } - } - } - return shadow(this, 'metadata', metadata); + (0, _util.info)('Skipping invalid metadata.'); + } + } + } + return (0, _util.shadow)(this, 'metadata', metadata); }, get toplevelPagesDict() { var pagesObj = this.catDict.get('Pages'); - assert(isDict(pagesObj), 'invalid top-level pages dictionary'); - return shadow(this, 'toplevelPagesDict', pagesObj); + (0, _util.assert)((0, _primitives.isDict)(pagesObj), 'invalid top-level pages dictionary'); + return (0, _util.shadow)(this, 'toplevelPagesDict', pagesObj); }, get documentOutline() { var obj = null; try { obj = this.readDocumentOutline(); } catch (ex) { - if (ex instanceof MissingDataException) { + if (ex instanceof _util.MissingDataException) { throw ex; } - warn('Unable to read document outline'); - } - return shadow(this, 'documentOutline', obj); + (0, _util.warn)('Unable to read document outline'); + } + return (0, _util.shadow)(this, 'documentOutline', obj); }, readDocumentOutline: function Catalog_readDocumentOutline() { var obj = this.catDict.get('Outlines'); - if (!isDict(obj)) { + if (!(0, _primitives.isDict)(obj)) { return null; } obj = obj.getRaw('First'); - if (!isRef(obj)) { + if (!(0, _primitives.isRef)(obj)) { return null; } var root = { items: [] }; var queue = [{ obj, parent: root }]; - var processed = new RefSet(); + var processed = new _primitives.RefSet(); processed.put(obj); var xref = this.xref, blackColor = new Uint8Array(3); while (queue.length > 0) { var i = queue.shift(); var outlineDict = xref.fetchIfRef(i.obj); if (outlineDict === null) { continue; } - assert(outlineDict.has('Title'), 'Invalid outline item'); + (0, _util.assert)(outlineDict.has('Title'), 'Invalid outline item'); var data = { url: null, dest: null }; Catalog.parseDestDictionary({ destDict: outlineDict, resultObj: data, docBaseUrl: this.pdfManager.docBaseUrl }); var title = outlineDict.get('Title'); var flags = outlineDict.get('F') || 0; var color = outlineDict.getArray('C'), rgbColor = blackColor; - if (isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) { - rgbColor = ColorSpace.singletons.rgb.getRgb(color, 0); + if ((0, _util.isArray)(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) { + rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0); } var outlineItem = { dest: data.dest, url: data.url, unsafeUrl: data.unsafeUrl, newWindow: data.newWindow, - title: stringToPDFString(title), + title: (0, _util.stringToPDFString)(title), color: rgbColor, count: outlineDict.get('Count'), bold: !!(flags & 2), italic: !!(flags & 1), items: [] }; i.parent.items.push(outlineItem); obj = outlineDict.getRaw('First'); - if (isRef(obj) && !processed.has(obj)) { + if ((0, _primitives.isRef)(obj) && !processed.has(obj)) { queue.push({ obj, parent: outlineItem }); processed.put(obj); } obj = outlineDict.getRaw('Next'); - if (isRef(obj) && !processed.has(obj)) { + if ((0, _primitives.isRef)(obj) && !processed.has(obj)) { queue.push({ obj, parent: i.parent }); processed.put(obj); } } return root.items.length > 0 ? root.items : null; }, get numPages() { var obj = this.toplevelPagesDict.get('Count'); - assert(isInt(obj), 'page count in top level pages object is not an integer'); - return shadow(this, 'num', obj); + (0, _util.assert)((0, _util.isInt)(obj), 'page count in top level pages object is not an integer'); + return (0, _util.shadow)(this, 'num', obj); }, get destinations() { function fetchDestination(dest) { - return isDict(dest) ? dest.get('D') : dest; + return (0, _primitives.isDict)(dest) ? dest.get('D') : dest; } var xref = this.xref; var dests = {}, nameTreeRef, nameDictionaryRef; var obj = this.catDict.get('Names'); if (obj && obj.has('Dests')) { nameTreeRef = obj.getRaw('Dests'); @@ -21476,21 +21381,21 @@ var Catalog = function CatalogClosure() } if (nameTreeRef) { var nameTree = new NameTree(nameTreeRef, xref); var names = nameTree.getAll(); for (var name in names) { dests[name] = fetchDestination(names[name]); } } - return shadow(this, 'destinations', dests); + return (0, _util.shadow)(this, 'destinations', dests); }, getDestination: function Catalog_getDestination(destinationId) { function fetchDestination(dest) { - return isDict(dest) ? dest.get('D') : dest; + return (0, _primitives.isDict)(dest) ? dest.get('D') : dest; } var xref = this.xref; var dest = null, nameTreeRef, nameDictionaryRef; var obj = this.catDict.get('Names'); if (obj && obj.has('Dests')) { nameTreeRef = obj.getRaw('Dests'); @@ -21509,75 +21414,75 @@ var Catalog = function CatalogClosure() } return dest; }, get pageLabels() { var obj = null; try { obj = this.readPageLabels(); } catch (ex) { - if (ex instanceof MissingDataException) { + if (ex instanceof _util.MissingDataException) { throw ex; } - warn('Unable to read page labels.'); - } - return shadow(this, 'pageLabels', obj); + (0, _util.warn)('Unable to read page labels.'); + } + return (0, _util.shadow)(this, 'pageLabels', obj); }, readPageLabels: function Catalog_readPageLabels() { var obj = this.catDict.getRaw('PageLabels'); if (!obj) { return null; } var pageLabels = new Array(this.numPages); var style = null; var prefix = ''; var numberTree = new NumberTree(obj, this.xref); var nums = numberTree.getAll(); var currentLabel = '', currentIndex = 1; for (var i = 0, ii = this.numPages; i < ii; i++) { if (i in nums) { var labelDict = nums[i]; - assert(isDict(labelDict), 'The PageLabel is not a dictionary.'); + (0, _util.assert)((0, _primitives.isDict)(labelDict), 'The PageLabel is not a dictionary.'); var type = labelDict.get('Type'); - assert(!type || isName(type, 'PageLabel'), 'Invalid type in PageLabel dictionary.'); + (0, _util.assert)(!type || (0, _primitives.isName)(type, 'PageLabel'), 'Invalid type in PageLabel dictionary.'); var s = labelDict.get('S'); - assert(!s || isName(s), 'Invalid style in PageLabel dictionary.'); + (0, _util.assert)(!s || (0, _primitives.isName)(s), 'Invalid style in PageLabel dictionary.'); style = s ? s.name : null; var p = labelDict.get('P'); - assert(!p || isString(p), 'Invalid prefix in PageLabel dictionary.'); - prefix = p ? stringToPDFString(p) : ''; + (0, _util.assert)(!p || (0, _util.isString)(p), 'Invalid prefix in PageLabel dictionary.'); + prefix = p ? (0, _util.stringToPDFString)(p) : ''; var st = labelDict.get('St'); - assert(!st || isInt(st) && st >= 1, 'Invalid start in PageLabel dictionary.'); + (0, _util.assert)(!st || (0, _util.isInt)(st) && st >= 1, 'Invalid start in PageLabel dictionary.'); currentIndex = st || 1; } switch (style) { case 'D': currentLabel = currentIndex; break; case 'R': case 'r': - currentLabel = Util.toRoman(currentIndex, style === 'r'); + currentLabel = _util.Util.toRoman(currentIndex, style === 'r'); break; case 'A': case 'a': var LIMIT = 26; var A_UPPER_CASE = 0x41, A_LOWER_CASE = 0x61; var baseCharCode = style === 'a' ? A_LOWER_CASE : A_UPPER_CASE; var letterIndex = currentIndex - 1; var character = String.fromCharCode(baseCharCode + letterIndex % LIMIT); var charBuf = []; for (var j = 0, jj = letterIndex / LIMIT | 0; j <= jj; j++) { charBuf.push(character); } currentLabel = charBuf.join(''); break; default: - assert(!style, 'Invalid style "' + style + '" in PageLabel dictionary.'); + (0, _util.assert)(!style, 'Invalid style "' + style + '" in PageLabel dictionary.'); } pageLabels[i] = prefix + currentLabel; currentLabel = ''; currentIndex++; } return pageLabels; }, get attachments() { @@ -21591,61 +21496,61 @@ var Catalog = function CatalogClosure() if (nameTreeRef) { var nameTree = new NameTree(nameTreeRef, xref); var names = nameTree.getAll(); for (var name in names) { var fs = new FileSpec(names[name], xref); if (!attachments) { attachments = Object.create(null); } - attachments[stringToPDFString(name)] = fs.serializable; - } - } - return shadow(this, 'attachments', attachments); + attachments[(0, _util.stringToPDFString)(name)] = fs.serializable; + } + } + return (0, _util.shadow)(this, 'attachments', attachments); }, get javaScript() { var xref = this.xref; var obj = this.catDict.get('Names'); var javaScript = []; function appendIfJavaScriptDict(jsDict) { var type = jsDict.get('S'); - if (!isName(type, 'JavaScript')) { + if (!(0, _primitives.isName)(type, 'JavaScript')) { return; } var js = jsDict.get('JS'); - if (isStream(js)) { - js = bytesToString(js.getBytes()); - } else if (!isString(js)) { + if ((0, _primitives.isStream)(js)) { + js = (0, _util.bytesToString)(js.getBytes()); + } else if (!(0, _util.isString)(js)) { return; } - javaScript.push(stringToPDFString(js)); + javaScript.push((0, _util.stringToPDFString)(js)); } if (obj && obj.has('JavaScript')) { var nameTree = new NameTree(obj.getRaw('JavaScript'), xref); var names = nameTree.getAll(); for (var name in names) { var jsDict = names[name]; - if (isDict(jsDict)) { + if ((0, _primitives.isDict)(jsDict)) { appendIfJavaScriptDict(jsDict); } } } var openactionDict = this.catDict.get('OpenAction'); - if (isDict(openactionDict, 'Action')) { + if ((0, _primitives.isDict)(openactionDict, 'Action')) { var actionType = openactionDict.get('S'); - if (isName(actionType, 'Named')) { + if ((0, _primitives.isName)(actionType, 'Named')) { var action = openactionDict.get('N'); - if (isName(action, 'Print')) { + if ((0, _primitives.isName)(action, 'Print')) { javaScript.push('print({});'); } } else { appendIfJavaScriptDict(openactionDict); } } - return shadow(this, 'javaScript', javaScript); + return (0, _util.shadow)(this, 'javaScript', javaScript); }, cleanup: function Catalog_cleanup() { this.pageKidsCountCache.clear(); var promises = []; this.fontCache.forEach(function (promise) { promises.push(promise); }); return Promise.all(promises).then(translatedFonts => { @@ -21661,115 +21566,115 @@ var Catalog = function CatalogClosure() if (!(pageIndex in this.pagePromises)) { this.pagePromises[pageIndex] = this.getPageDict(pageIndex).then(([dict, ref]) => { return this.pageFactory.createPage(pageIndex, dict, ref, this.fontCache, this.builtInCMapCache); }); } return this.pagePromises[pageIndex]; }, getPageDict: function Catalog_getPageDict(pageIndex) { - var capability = createPromiseCapability(); + var capability = (0, _util.createPromiseCapability)(); var nodesToVisit = [this.catDict.getRaw('Pages')]; var count, currentPageIndex = 0; var xref = this.xref, pageKidsCountCache = this.pageKidsCountCache; function next() { while (nodesToVisit.length) { var currentNode = nodesToVisit.pop(); - if (isRef(currentNode)) { + if ((0, _primitives.isRef)(currentNode)) { count = pageKidsCountCache.get(currentNode); if (count > 0 && currentPageIndex + count < pageIndex) { currentPageIndex += count; continue; } xref.fetchAsync(currentNode).then(function (obj) { - if (isDict(obj, 'Page') || isDict(obj) && !obj.has('Kids')) { + if ((0, _primitives.isDict)(obj, 'Page') || (0, _primitives.isDict)(obj) && !obj.has('Kids')) { if (pageIndex === currentPageIndex) { if (currentNode && !pageKidsCountCache.has(currentNode)) { pageKidsCountCache.put(currentNode, 1); } capability.resolve([obj, currentNode]); } else { currentPageIndex++; next(); } return; } nodesToVisit.push(obj); next(); }, capability.reject); return; } - assert(isDict(currentNode), 'page dictionary kid reference points to wrong type of object'); + (0, _util.assert)((0, _primitives.isDict)(currentNode), 'page dictionary kid reference points to wrong type of object'); count = currentNode.get('Count'); var objId = currentNode.objId; if (objId && !pageKidsCountCache.has(objId)) { pageKidsCountCache.put(objId, count); } if (currentPageIndex + count <= pageIndex) { currentPageIndex += count; continue; } var kids = currentNode.get('Kids'); - assert(isArray(kids), 'page dictionary kids object is not an array'); + (0, _util.assert)((0, _util.isArray)(kids), 'page dictionary kids object is not an array'); for (var last = kids.length - 1; last >= 0; last--) { nodesToVisit.push(kids[last]); } } capability.reject('Page index ' + pageIndex + ' not found.'); } next(); return capability.promise; }, getPageIndex: function Catalog_getPageIndex(pageRef) { var xref = this.xref; function pagesBeforeRef(kidRef) { var total = 0; var parentRef; return xref.fetchAsync(kidRef).then(function (node) { - if (isRefsEqual(kidRef, pageRef) && !isDict(node, 'Page') && !(isDict(node) && !node.has('Type') && node.has('Contents'))) { + if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, 'Page') && !((0, _primitives.isDict)(node) && !node.has('Type') && node.has('Contents'))) { throw new Error('The reference does not point to a /Page Dict.'); } if (!node) { return null; } - assert(isDict(node), 'node must be a Dict.'); + (0, _util.assert)((0, _primitives.isDict)(node), 'node must be a Dict.'); parentRef = node.getRaw('Parent'); return node.getAsync('Parent'); }).then(function (parent) { if (!parent) { return null; } - assert(isDict(parent), 'parent must be a Dict.'); + (0, _util.assert)((0, _primitives.isDict)(parent), 'parent must be a Dict.'); return parent.getAsync('Kids'); }).then(function (kids) { if (!kids) { return null; } var kidPromises = []; var found = false; for (var i = 0; i < kids.length; i++) { var kid = kids[i]; - assert(isRef(kid), 'kid must be a Ref.'); + (0, _util.assert)((0, _primitives.isRef)(kid), 'kid must be a Ref.'); if (kid.num === kidRef.num) { found = true; break; } kidPromises.push(xref.fetchAsync(kid).then(function (kid) { if (kid.has('Count')) { var count = kid.get('Count'); total += count; } else { total++; } })); } if (!found) { - error('kid ref not found in parents kids'); + (0, _util.error)('kid ref not found in parents kids'); } return Promise.all(kidPromises).then(function () { return [total, parentRef]; }); }); } var total = 0; function next(ref) { @@ -21790,122 +21695,122 @@ var Catalog = function CatalogClosure() function addDefaultProtocolToUrl(url) { if (url.indexOf('www.') === 0) { return 'http://' + url; } return url; } function tryConvertUrlEncoding(url) { try { - return stringToUTF8String(url); + return (0, _util.stringToUTF8String)(url); } catch (e) { return url; } } var destDict = params.destDict; - if (!isDict(destDict)) { - warn('Catalog_parseDestDictionary: "destDict" must be a dictionary.'); + if (!(0, _primitives.isDict)(destDict)) { + (0, _util.warn)('Catalog_parseDestDictionary: "destDict" must be a dictionary.'); return; } var resultObj = params.resultObj; if (typeof resultObj !== 'object') { - warn('Catalog_parseDestDictionary: "resultObj" must be an object.'); + (0, _util.warn)('Catalog_parseDestDictionary: "resultObj" must be an object.'); return; } var docBaseUrl = params.docBaseUrl || null; var action = destDict.get('A'), url, dest; - if (isDict(action)) { + if ((0, _primitives.isDict)(action)) { var linkType = action.get('S').name; switch (linkType) { case 'URI': url = action.get('URI'); - if (isName(url)) { + if ((0, _primitives.isName)(url)) { url = '/' + url.name; - } else if (isString(url)) { + } else if ((0, _util.isString)(url)) { url = addDefaultProtocolToUrl(url); } break; case 'GoTo': dest = action.get('D'); break; case 'Launch': case 'GoToR': var urlDict = action.get('F'); - if (isDict(urlDict)) { + if ((0, _primitives.isDict)(urlDict)) { url = urlDict.get('F') || null; - } else if (isString(urlDict)) { + } else if ((0, _util.isString)(urlDict)) { url = urlDict; } var remoteDest = action.get('D'); if (remoteDest) { - if (isName(remoteDest)) { + if ((0, _primitives.isName)(remoteDest)) { remoteDest = remoteDest.name; } - if (isString(url)) { + if ((0, _util.isString)(url)) { let baseUrl = url.split('#')[0]; - if (isString(remoteDest)) { + if ((0, _util.isString)(remoteDest)) { url = baseUrl + '#' + remoteDest; - } else if (isArray(remoteDest)) { + } else if ((0, _util.isArray)(remoteDest)) { url = baseUrl + '#' + JSON.stringify(remoteDest); } } } var newWindow = action.get('NewWindow'); - if (isBool(newWindow)) { + if ((0, _util.isBool)(newWindow)) { resultObj.newWindow = newWindow; } break; case 'Named': var namedAction = action.get('N'); - if (isName(namedAction)) { + if ((0, _primitives.isName)(namedAction)) { resultObj.action = namedAction.name; } break; case 'JavaScript': var jsAction = action.get('JS'), js; - if (isStream(jsAction)) { - js = bytesToString(jsAction.getBytes()); - } else if (isString(jsAction)) { + if ((0, _primitives.isStream)(jsAction)) { + js = (0, _util.bytesToString)(jsAction.getBytes()); + } else if ((0, _util.isString)(jsAction)) { js = jsAction; } if (js) { var URL_OPEN_METHODS = ['app.launchURL', 'window.open']; var regex = new RegExp('^\\s*(' + URL_OPEN_METHODS.join('|').split('.').join('\\.') + ')\\((?:\'|\")([^\'\"]*)(?:\'|\")(?:,\\s*(\\w+)\\)|\\))', 'i'); - var jsUrl = regex.exec(stringToPDFString(js)); + var jsUrl = regex.exec((0, _util.stringToPDFString)(js)); if (jsUrl && jsUrl[2]) { url = jsUrl[2]; if (jsUrl[3] === 'true' && jsUrl[1] === 'app.launchURL') { resultObj.newWindow = true; } break; } } default: - warn('Catalog_parseDestDictionary: Unrecognized link type "' + linkType + '".'); + (0, _util.warn)('Catalog_parseDestDictionary: Unrecognized link type "' + linkType + '".'); break; } } else if (destDict.has('Dest')) { dest = destDict.get('Dest'); } - if (isString(url)) { + if ((0, _util.isString)(url)) { url = tryConvertUrlEncoding(url); - var absoluteUrl = createValidAbsoluteUrl(url, docBaseUrl); + var absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl); if (absoluteUrl) { resultObj.url = absoluteUrl.href; } resultObj.unsafeUrl = url; } if (dest) { - if (isName(dest)) { + if ((0, _primitives.isName)(dest)) { dest = dest.name; } - if (isString(dest) || isArray(dest)) { + if ((0, _util.isString)(dest) || (0, _util.isArray)(dest)) { resultObj.dest = dest; } } }; return Catalog; }(); var XRef = function XRefClosure() { function XRef(stream, pdfManager) { @@ -21923,108 +21828,108 @@ var XRef = function XRefClosure() { setStartXRef: function XRef_setStartXRef(startXRef) { this.startXRefQueue = [startXRef]; }, parse: function XRef_parse(recoveryMode) { var trailerDict; if (!recoveryMode) { trailerDict = this.readXRef(); } else { - warn('Indexing all PDF objects'); + (0, _util.warn)('Indexing all PDF objects'); trailerDict = this.indexObjects(); } trailerDict.assignXref(this); this.trailer = trailerDict; var encrypt = trailerDict.get('Encrypt'); - if (isDict(encrypt)) { + if ((0, _primitives.isDict)(encrypt)) { var ids = trailerDict.get('ID'); var fileId = ids && ids.length ? ids[0] : ''; encrypt.suppressEncryption = true; - this.encrypt = new CipherTransformFactory(encrypt, fileId, this.pdfManager.password); + this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password); } if (!(this.root = trailerDict.get('Root'))) { - error('Invalid root reference'); + (0, _util.error)('Invalid root reference'); } }, processXRefTable: function XRef_processXRefTable(parser) { if (!('tableState' in this)) { this.tableState = { entryNum: 0, streamPos: parser.lexer.stream.pos, parserBuf1: parser.buf1, parserBuf2: parser.buf2 }; } var obj = this.readXRefTable(parser); - if (!isCmd(obj, 'trailer')) { - error('Invalid XRef table: could not find trailer dictionary'); + if (!(0, _primitives.isCmd)(obj, 'trailer')) { + (0, _util.error)('Invalid XRef table: could not find trailer dictionary'); } var dict = parser.getObj(); - if (!isDict(dict) && dict.dict) { + if (!(0, _primitives.isDict)(dict) && dict.dict) { dict = dict.dict; } - if (!isDict(dict)) { - error('Invalid XRef table: could not parse trailer dictionary'); + if (!(0, _primitives.isDict)(dict)) { + (0, _util.error)('Invalid XRef table: could not parse trailer dictionary'); } delete this.tableState; return dict; }, readXRefTable: function XRef_readXRefTable(parser) { var stream = parser.lexer.stream; var tableState = this.tableState; stream.pos = tableState.streamPos; parser.buf1 = tableState.parserBuf1; parser.buf2 = tableState.parserBuf2; var obj; while (true) { if (!('firstEntryNum' in tableState) || !('entryCount' in tableState)) { - if (isCmd(obj = parser.getObj(), 'trailer')) { + if ((0, _primitives.isCmd)(obj = parser.getObj(), 'trailer')) { break; } tableState.firstEntryNum = obj; tableState.entryCount = parser.getObj(); } var first = tableState.firstEntryNum; var count = tableState.entryCount; - if (!isInt(first) || !isInt(count)) { - error('Invalid XRef table: wrong types in subsection header'); + if (!(0, _util.isInt)(first) || !(0, _util.isInt)(count)) { + (0, _util.error)('Invalid XRef table: wrong types in subsection header'); } for (var i = tableState.entryNum; i < count; i++) { tableState.streamPos = stream.pos; tableState.entryNum = i; tableState.parserBuf1 = parser.buf1; tableState.parserBuf2 = parser.buf2; var entry = {}; entry.offset = parser.getObj(); entry.gen = parser.getObj(); var type = parser.getObj(); - if (isCmd(type, 'f')) { + if ((0, _primitives.isCmd)(type, 'f')) { entry.free = true; - } else if (isCmd(type, 'n')) { + } else if ((0, _primitives.isCmd)(type, 'n')) { entry.uncompressed = true; } - if (!isInt(entry.offset) || !isInt(entry.gen) || !(entry.free || entry.uncompressed)) { - error('Invalid entry in XRef subsection: ' + first + ', ' + count); + if (!(0, _util.isInt)(entry.offset) || !(0, _util.isInt)(entry.gen) || !(entry.free || entry.uncompressed)) { + (0, _util.error)('Invalid entry in XRef subsection: ' + first + ', ' + count); } if (i === 0 && entry.free && first === 1) { first = 0; } if (!this.entries[i + first]) { this.entries[i + first] = entry; } } tableState.entryNum = 0; tableState.streamPos = stream.pos; tableState.parserBuf1 = parser.buf1; tableState.parserBuf2 = parser.buf2; delete tableState.firstEntryNum; delete tableState.entryCount; } if (this.entries[0] && !this.entries[0].free) { - error('Invalid XRef table: unexpected first object'); + (0, _util.error)('Invalid XRef table: unexpected first object'); } return obj; }, processXRefStream: function XRef_processXRefStream(stream) { if (!('streamState' in this)) { var streamParameters = stream.dict; var byteWidths = streamParameters.get('W'); var range = streamParameters.get('Index'); @@ -22049,21 +21954,21 @@ var XRef = function XRefClosure() { var byteWidths = streamState.byteWidths; var typeFieldWidth = byteWidths[0]; var offsetFieldWidth = byteWidths[1]; var generationFieldWidth = byteWidths[2]; var entryRanges = streamState.entryRanges; while (entryRanges.length > 0) { var first = entryRanges[0]; var n = entryRanges[1]; - if (!isInt(first) || !isInt(n)) { - error('Invalid XRef range fields: ' + first + ', ' + n); - } - if (!isInt(typeFieldWidth) || !isInt(offsetFieldWidth) || !isInt(generationFieldWidth)) { - error('Invalid XRef entry fields length: ' + first + ', ' + n); + if (!(0, _util.isInt)(first) || !(0, _util.isInt)(n)) { + (0, _util.error)('Invalid XRef range fields: ' + first + ', ' + n); + } + if (!(0, _util.isInt)(typeFieldWidth) || !(0, _util.isInt)(offsetFieldWidth) || !(0, _util.isInt)(generationFieldWidth)) { + (0, _util.error)('Invalid XRef entry fields length: ' + first + ', ' + n); } for (i = streamState.entryNum; i < n; ++i) { streamState.entryNum = i; streamState.streamPos = stream.pos; var type = 0, offset = 0, generation = 0; for (j = 0; j < typeFieldWidth; ++j) { @@ -22086,17 +21991,17 @@ var XRef = function XRefClosure() { entry.free = true; break; case 1: entry.uncompressed = true; break; case 2: break; default: - error('Invalid XRef entry type: ' + type); + (0, _util.error)('Invalid XRef entry type: ' + type); } if (!this.entries[first + i]) { this.entries[first + i] = entry; } } streamState.entryNum = 0; streamState.streamPos = stream.pos; entryRanges.splice(0, 2); @@ -22199,221 +22104,221 @@ var XRef = function XRefClosure() { var i, ii; for (i = 0, ii = xrefStms.length; i < ii; ++i) { this.startXRefQueue.push(xrefStms[i]); this.readXRef(true); } var dict; for (i = 0, ii = trailers.length; i < ii; ++i) { stream.pos = trailers[i]; - var parser = new Parser(new Lexer(stream), true, this, true); + var parser = new _parser.Parser(new _parser.Lexer(stream), true, this, true); var obj = parser.getObj(); - if (!isCmd(obj, 'trailer')) { + if (!(0, _primitives.isCmd)(obj, 'trailer')) { continue; } dict = parser.getObj(); - if (!isDict(dict)) { + if (!(0, _primitives.isDict)(dict)) { continue; } if (dict.has('ID')) { return dict; } } if (dict) { return dict; } - throw new InvalidPDFException('Invalid PDF structure'); + throw new _util.InvalidPDFException('Invalid PDF structure'); }, readXRef: function XRef_readXRef(recoveryMode) { var stream = this.stream; try { while (this.startXRefQueue.length) { var startXRef = this.startXRefQueue[0]; stream.pos = startXRef + stream.start; - var parser = new Parser(new Lexer(stream), true, this); + var parser = new _parser.Parser(new _parser.Lexer(stream), true, this); var obj = parser.getObj(); var dict; - if (isCmd(obj, 'xref')) { + if ((0, _primitives.isCmd)(obj, 'xref')) { dict = this.processXRefTable(parser); if (!this.topDict) { this.topDict = dict; } obj = dict.get('XRefStm'); - if (isInt(obj)) { + if ((0, _util.isInt)(obj)) { var pos = obj; if (!(pos in this.xrefstms)) { this.xrefstms[pos] = 1; this.startXRefQueue.push(pos); } } - } else if (isInt(obj)) { - if (!isInt(parser.getObj()) || !isCmd(parser.getObj(), 'obj') || !isStream(obj = parser.getObj())) { - error('Invalid XRef stream'); + } else if ((0, _util.isInt)(obj)) { + if (!(0, _util.isInt)(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), 'obj') || !(0, _primitives.isStream)(obj = parser.getObj())) { + (0, _util.error)('Invalid XRef stream'); } dict = this.processXRefStream(obj); if (!this.topDict) { this.topDict = dict; } if (!dict) { - error('Failed to read XRef stream'); + (0, _util.error)('Failed to read XRef stream'); } } else { - error('Invalid XRef stream header'); + (0, _util.error)('Invalid XRef stream header'); } obj = dict.get('Prev'); - if (isInt(obj)) { + if ((0, _util.isInt)(obj)) { this.startXRefQueue.push(obj); - } else if (isRef(obj)) { + } else if ((0, _primitives.isRef)(obj)) { this.startXRefQueue.push(obj.num); } this.startXRefQueue.shift(); } return this.topDict; } catch (e) { - if (e instanceof MissingDataException) { + if (e instanceof _util.MissingDataException) { throw e; } - info('(while reading XRef): ' + e); + (0, _util.info)('(while reading XRef): ' + e); } if (recoveryMode) { return; } - throw new XRefParseException(); + throw new _util.XRefParseException(); }, getEntry: function XRef_getEntry(i) { var xrefEntry = this.entries[i]; if (xrefEntry && !xrefEntry.free && xrefEntry.offset) { return xrefEntry; } return null; }, fetchIfRef: function XRef_fetchIfRef(obj, suppressEncryption) { - if (!isRef(obj)) { + if (!(0, _primitives.isRef)(obj)) { return obj; } return this.fetch(obj, suppressEncryption); }, fetch: function XRef_fetch(ref, suppressEncryption) { - assert(isRef(ref), 'ref object is not a reference'); + (0, _util.assert)((0, _primitives.isRef)(ref), 'ref object is not a reference'); var num = ref.num; if (num in this.cache) { var cacheEntry = this.cache[num]; - if (cacheEntry instanceof Dict && !cacheEntry.objId) { + if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) { cacheEntry.objId = ref.toString(); } return cacheEntry; } var xrefEntry = this.getEntry(num); if (xrefEntry === null) { return this.cache[num] = null; } if (xrefEntry.uncompressed) { xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption); } else { xrefEntry = this.fetchCompressed(xrefEntry, suppressEncryption); } - if (isDict(xrefEntry)) { + if ((0, _primitives.isDict)(xrefEntry)) { xrefEntry.objId = ref.toString(); - } else if (isStream(xrefEntry)) { + } else if ((0, _primitives.isStream)(xrefEntry)) { xrefEntry.dict.objId = ref.toString(); } return xrefEntry; }, fetchUncompressed: function XRef_fetchUncompressed(ref, xrefEntry, suppressEncryption) { var gen = ref.gen; var num = ref.num; if (xrefEntry.gen !== gen) { - error('inconsistent generation in XRef'); + (0, _util.error)('inconsistent generation in XRef'); } var stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start); - var parser = new Parser(new Lexer(stream), true, this); + var parser = new _parser.Parser(new _parser.Lexer(stream), true, this); var obj1 = parser.getObj(); var obj2 = parser.getObj(); var obj3 = parser.getObj(); - if (!isInt(obj1) || parseInt(obj1, 10) !== num || !isInt(obj2) || parseInt(obj2, 10) !== gen || !isCmd(obj3)) { - error('bad XRef entry'); - } - if (!isCmd(obj3, 'obj')) { + if (!(0, _util.isInt)(obj1) || parseInt(obj1, 10) !== num || !(0, _util.isInt)(obj2) || parseInt(obj2, 10) !== gen || !(0, _primitives.isCmd)(obj3)) { + (0, _util.error)('bad XRef entry'); + } + if (!(0, _primitives.isCmd)(obj3, 'obj')) { if (obj3.cmd.indexOf('obj') === 0) { num = parseInt(obj3.cmd.substring(3), 10); if (!isNaN(num)) { return num; } } - error('bad XRef entry'); + (0, _util.error)('bad XRef entry'); } if (this.encrypt && !suppressEncryption) { xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen)); } else { xrefEntry = parser.getObj(); } - if (!isStream(xrefEntry)) { + if (!(0, _primitives.isStream)(xrefEntry)) { this.cache[num] = xrefEntry; } return xrefEntry; }, fetchCompressed: function XRef_fetchCompressed(xrefEntry, suppressEncryption) { var tableOffset = xrefEntry.offset; - var stream = this.fetch(new Ref(tableOffset, 0)); - if (!isStream(stream)) { - error('bad ObjStm stream'); + var stream = this.fetch(new _primitives.Ref(tableOffset, 0)); + if (!(0, _primitives.isStream)(stream)) { + (0, _util.error)('bad ObjStm stream'); } var first = stream.dict.get('First'); var n = stream.dict.get('N'); - if (!isInt(first) || !isInt(n)) { - error('invalid first and n parameters for ObjStm stream'); - } - var parser = new Parser(new Lexer(stream), false, this); + if (!(0, _util.isInt)(first) || !(0, _util.isInt)(n)) { + (0, _util.error)('invalid first and n parameters for ObjStm stream'); + } + var parser = new _parser.Parser(new _parser.Lexer(stream), false, this); parser.allowStreams = true; var i, entries = [], num, nums = []; for (i = 0; i < n; ++i) { num = parser.getObj(); - if (!isInt(num)) { - error('invalid object number in the ObjStm stream: ' + num); + if (!(0, _util.isInt)(num)) { + (0, _util.error)('invalid object number in the ObjStm stream: ' + num); } nums.push(num); var offset = parser.getObj(); - if (!isInt(offset)) { - error('invalid object offset in the ObjStm stream: ' + offset); + if (!(0, _util.isInt)(offset)) { + (0, _util.error)('invalid object offset in the ObjStm stream: ' + offset); } } for (i = 0; i < n; ++i) { entries.push(parser.getObj()); - if (isCmd(parser.buf1, 'endobj')) { + if ((0, _primitives.isCmd)(parser.buf1, 'endobj')) { parser.shift(); } num = nums[i]; var entry = this.entries[num]; if (entry && entry.offset === tableOffset && entry.gen === i) { this.cache[num] = entries[i]; } } xrefEntry = entries[xrefEntry.gen]; if (xrefEntry === undefined) { - error('bad XRef entry for compressed object'); + (0, _util.error)('bad XRef entry for compressed object'); } return xrefEntry; }, fetchIfRefAsync: function XRef_fetchIfRefAsync(obj, suppressEncryption) { - if (!isRef(obj)) { + if (!(0, _primitives.isRef)(obj)) { return Promise.resolve(obj); } return this.fetchAsync(obj, suppressEncryption); }, fetchAsync: function XRef_fetchAsync(ref, suppressEncryption) { var streamManager = this.stream.manager; var xref = this; return new Promise(function tryFetch(resolve, reject) { try { resolve(xref.fetch(ref, suppressEncryption)); } catch (e) { - if (e instanceof MissingDataException) { + if (e instanceof _util.MissingDataException) { streamManager.requestRange(e.begin, e.end).then(function () { tryFetch(resolve, reject); }, reject); return; } reject(e); } }); @@ -22430,37 +22335,37 @@ var NameOrNumberTree = function NameOrNu } NameOrNumberTree.prototype = { getAll: function NameOrNumberTree_getAll() { var dict = Object.create(null); if (!this.root) { return dict; } var xref = this.xref; - var processed = new RefSet(); + var processed = new _primitives.RefSet(); processed.put(this.root); var queue = [this.root]; while (queue.length > 0) { var i, n; var obj = xref.fetchIfRef(queue.shift()); - if (!isDict(obj)) { + if (!(0, _primitives.isDict)(obj)) { continue; } if (obj.has('Kids')) { var kids = obj.get('Kids'); for (i = 0, n = kids.length; i < n; i++) { var kid = kids[i]; - assert(!processed.has(kid), 'Duplicate entry in "' + this._type + '" tree.'); + (0, _util.assert)(!processed.has(kid), 'Duplicate entry in "' + this._type + '" tree.'); queue.push(kid); processed.put(kid); } continue; } var entries = obj.get(this._type); - if (isArray(entries)) { + if ((0, _util.isArray)(entries)) { for (i = 0, n = entries.length; i < n; i += 2) { dict[xref.fetchIfRef(entries[i])] = xref.fetchIfRef(entries[i + 1]); } } } return dict; }, get: function NameOrNumberTree_get(key) { @@ -22469,21 +22374,21 @@ var NameOrNumberTree = function NameOrNu } var xref = this.xref; var kidsOrEntries = xref.fetchIfRef(this.root); var loopCount = 0; var MAX_LEVELS = 10; var l, r, m; while (kidsOrEntries.has('Kids')) { if (++loopCount > MAX_LEVELS) { - warn('Search depth limit reached for "' + this._type + '" tree.'); + (0, _util.warn)('Search depth limit reached for "' + this._type + '" tree.'); return null; } var kids = kidsOrEntries.get('Kids'); - if (!isArray(kids)) { + if (!(0, _util.isArray)(kids)) { return null; } l = 0; r = kids.length - 1; while (l <= r) { m = l + r >> 1; var kid = xref.fetchIfRef(kids[m]); var limits = kid.get('Limits'); @@ -22496,17 +22401,17 @@ var NameOrNumberTree = function NameOrNu break; } } if (l > r) { return null; } } var entries = kidsOrEntries.get(this._type); - if (isArray(entries)) { + if ((0, _util.isArray)(entries)) { l = 0; r = entries.length - 2; while (l <= r) { m = l + r & ~1; var currentKey = xref.fetchIfRef(entries[m]); if (key < currentKey) { r = m - 2; } else if (key > currentKey) { @@ -22522,46 +22427,46 @@ var NameOrNumberTree = function NameOrNu return NameOrNumberTree; }(); var NameTree = function NameTreeClosure() { function NameTree(root, xref) { this.root = root; this.xref = xref; this._type = 'Names'; } - Util.inherit(NameTree, NameOrNumberTree, {}); + _util.Util.inherit(NameTree, NameOrNumberTree, {}); return NameTree; }(); var NumberTree = function NumberTreeClosure() { function NumberTree(root, xref) { this.root = root; this.xref = xref; this._type = 'Nums'; } - Util.inherit(NumberTree, NameOrNumberTree, {}); + _util.Util.inherit(NumberTree, NameOrNumberTree, {}); return NumberTree; }(); var FileSpec = function FileSpecClosure() { function FileSpec(root, xref) { - if (!root || !isDict(root)) { + if (!root || !(0, _primitives.isDict)(root)) { return; } this.xref = xref; this.root = root; if (root.has('FS')) { this.fs = root.get('FS'); } - this.description = root.has('Desc') ? stringToPDFString(root.get('Desc')) : ''; + this.description = root.has('Desc') ? (0, _util.stringToPDFString)(root.get('Desc')) : ''; if (root.has('RF')) { - warn('Related file specifications are not supported'); + (0, _util.warn)('Related file specifications are not supported'); } this.contentAvailable = true; if (!root.has('EF')) { this.contentAvailable = false; - warn('Non-embedded file specifications are not supported'); + (0, _util.warn)('Non-embedded file specifications are not supported'); } } function pickPlatformItem(dict) { if (dict.has('UF')) { return dict.get('UF'); } else if (dict.has('F')) { return dict.get('F'); } else if (dict.has('Unix')) { @@ -22572,70 +22477,70 @@ var FileSpec = function FileSpecClosure( return dict.get('DOS'); } return null; } FileSpec.prototype = { get filename() { if (!this._filename && this.root) { var filename = pickPlatformItem(this.root) || 'unnamed'; - this._filename = stringToPDFString(filename).replace(/\\\\/g, '\\').replace(/\\\//g, '/').replace(/\\/g, '/'); + this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\/g, '\\').replace(/\\\//g, '/').replace(/\\/g, '/'); } return this._filename; }, get content() { if (!this.contentAvailable) { return null; } if (!this.contentRef && this.root) { this.contentRef = pickPlatformItem(this.root.get('EF')); } var content = null; if (this.contentRef) { var xref = this.xref; var fileObj = xref.fetchIfRef(this.contentRef); - if (fileObj && isStream(fileObj)) { + if (fileObj && (0, _primitives.isStream)(fileObj)) { content = fileObj.getBytes(); } else { - warn('Embedded file specification points to non-existing/invalid ' + 'content'); - } - } else { - warn('Embedded file specification does not have a content'); + (0, _util.warn)('Embedded file specification points to non-existing/invalid ' + 'content'); + } + } else { + (0, _util.warn)('Embedded file specification does not have a content'); } return content; }, get serializable() { return { filename: this.filename, content: this.content }; } }; return FileSpec; }(); var ObjectLoader = function () { function mayHaveChildren(value) { - return isRef(value) || isDict(value) || isArray(value) || isStream(value); + return (0, _primitives.isRef)(value) || (0, _primitives.isDict)(value) || (0, _util.isArray)(value) || (0, _primitives.isStream)(value); } function addChildren(node, nodesToVisit) { var value; - if (isDict(node) || isStream(node)) { + if ((0, _primitives.isDict)(node) || (0, _primitives.isStream)(node)) { var map; - if (isDict(node)) { + if ((0, _primitives.isDict)(node)) { map = node.map; } else { map = node.dict.map; } for (var key in map) { value = map[key]; if (mayHaveChildren(value)) { nodesToVisit.push(value); } } - } else if (isArray(node)) { + } else if ((0, _util.isArray)(node)) { for (var i = 0, ii = node.length; i < ii; i++) { value = node[i]; if (mayHaveChildren(value)) { nodesToVisit.push(value); } } } } @@ -22644,44 +22549,44 @@ var ObjectLoader = function () { this.keys = keys; this.xref = xref; this.refSet = null; this.capability = null; } ObjectLoader.prototype = { load: function ObjectLoader_load() { var keys = this.keys; - this.capability = createPromiseCapability(); - if (!(this.xref.stream instanceof ChunkedStream) || this.xref.stream.getMissingChunks().length === 0) { + this.capability = (0, _util.createPromiseCapability)(); + if (!(this.xref.stream instanceof _chunked_stream.ChunkedStream) || this.xref.stream.getMissingChunks().length === 0) { this.capability.resolve(); return this.capability.promise; } - this.refSet = new RefSet(); + this.refSet = new _primitives.RefSet(); var nodesToVisit = []; for (var i = 0; i < keys.length; i++) { nodesToVisit.push(this.obj[keys[i]]); } this._walk(nodesToVisit); return this.capability.promise; }, _walk: function ObjectLoader_walk(nodesToVisit) { var nodesToRevisit = []; var pendingRequests = []; while (nodesToVisit.length) { var currentNode = nodesToVisit.pop(); - if (isRef(currentNode)) { + if ((0, _primitives.isRef)(currentNode)) { if (this.refSet.has(currentNode)) { continue; } try { var ref = currentNode; this.refSet.put(ref); currentNode = this.xref.fetch(currentNode); } catch (e) { - if (!(e instanceof MissingDataException)) { + if (!(e instanceof _util.MissingDataException)) { throw e; } nodesToRevisit.push(currentNode); pendingRequests.push({ begin: e.begin, end: e.end }); } @@ -22705,17 +22610,17 @@ var ObjectLoader = function () { } addChildren(currentNode, nodesToVisit); } if (pendingRequests.length) { this.xref.stream.manager.requestRanges(pendingRequests).then(() => { nodesToVisit = nodesToRevisit; for (var i = 0; i < nodesToRevisit.length; i++) { var node = nodesToRevisit[i]; - if (isRef(node)) { + if ((0, _primitives.isRef)(node)) { this.refSet.remove(node); } } this._walk(nodesToVisit); }, this.capability.reject); return; } this.refSet = null; @@ -22731,19 +22636,24 @@ exports.FileSpec = FileSpec; /***/ }), /* 16 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var sharedUtil = __w_pdfjs_require__(0); -var getLookupTableFactory = sharedUtil.getLookupTableFactory; -var getStdFontMap = getLookupTableFactory(function (t) { +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getSupplementalGlyphMapForArialBlack = exports.getGlyphMapForStandardFonts = exports.getSymbolsFonts = exports.getSerifFonts = exports.getNonStdFontMap = exports.getStdFontMap = undefined; + +var _util = __w_pdfjs_require__(0); + +var getStdFontMap = (0, _util.getLookupTableFactory)(function (t) { t['ArialNarrow'] = 'Helvetica'; t['ArialNarrow-Bold'] = 'Helvetica-Bold'; t['ArialNarrow-BoldItalic'] = 'Helvetica-BoldOblique'; t['ArialNarrow-Italic'] = 'Helvetica-Oblique'; t['ArialBlack'] = 'Helvetica'; t['ArialBlack-Bold'] = 'Helvetica-Bold'; t['ArialBlack-BoldItalic'] = 'Helvetica-BoldOblique'; t['ArialBlack-Italic'] = 'Helvetica-Oblique'; @@ -22790,17 +22700,17 @@ var getStdFontMap = getLookupTableFactor t['TimesNewRomanPS-BoldMT'] = 'Times-Bold'; t['TimesNewRomanPS-Italic'] = 'Times-Italic'; t['TimesNewRomanPS-ItalicMT'] = 'Times-Italic'; t['TimesNewRomanPSMT'] = 'Times-Roman'; t['TimesNewRomanPSMT-Bold'] = 'Times-Bold'; t['TimesNewRomanPSMT-BoldItalic'] = 'Times-BoldItalic'; t['TimesNewRomanPSMT-Italic'] = 'Times-Italic'; }); -var getNonStdFontMap = getLookupTableFactory(function (t) { +var getNonStdFontMap = (0, _util.getLookupTableFactory)(function (t) { t['CenturyGothic'] = 'Helvetica'; t['CenturyGothic-Bold'] = 'Helvetica-Bold'; t['CenturyGothic-BoldItalic'] = 'Helvetica-BoldOblique'; t['CenturyGothic-Italic'] = 'Helvetica-Oblique'; t['ComicSansMS'] = 'Comic Sans MS'; t['ComicSansMS-Bold'] = 'Comic Sans MS-Bold'; t['ComicSansMS-BoldItalic'] = 'Comic Sans MS-BoldItalic'; t['ComicSansMS-Italic'] = 'Comic Sans MS-Italic'; @@ -22822,17 +22732,17 @@ var getNonStdFontMap = getLookupTableFac t['MS-PGothic-Italic'] = 'MS PGothic-Italic'; t['MS-PMincho'] = 'MS PMincho'; t['MS-PMincho-Bold'] = 'MS PMincho-Bold'; t['MS-PMincho-BoldItalic'] = 'MS PMincho-BoldItalic'; t['MS-PMincho-Italic'] = 'MS PMincho-Italic'; t['NuptialScript'] = 'Times-Italic'; t['Wingdings'] = 'ZapfDingbats'; }); -var getSerifFonts = getLookupTableFactory(function (t) { +var getSerifFonts = (0, _util.getLookupTableFactory)(function (t) { t['Adobe Jenson'] = true; t['Adobe Text'] = true; t['Albertus'] = true; t['Aldus'] = true; t['Alexandria'] = true; t['Algerian'] = true; t['American Typewriter'] = true; t['Antiqua'] = true; @@ -22957,22 +22867,22 @@ var getSerifFonts = getLookupTableFactor t['Vera Serif'] = true; t['Versailles'] = true; t['Wanted'] = true; t['Weiss'] = true; t['Wide Latin'] = true; t['Windsor'] = true; t['XITS'] = true; }); -var getSymbolsFonts = getLookupTableFactory(function (t) { +var getSymbolsFonts = (0, _util.getLookupTableFactory)(function (t) { t['Dingbats'] = true; t['Symbol'] = true; t['ZapfDingbats'] = true; }); -var getGlyphMapForStandardFonts = getLookupTableFactory(function (t) { +var getGlyphMapForStandardFonts = (0, _util.getLookupTableFactory)(function (t) { t[2] = 10; t[3] = 32; t[4] = 33; t[5] = 34; t[6] = 35; t[7] = 36; t[8] = 37; t[9] = 38; @@ -23357,17 +23267,17 @@ var getGlyphMapForStandardFonts = getLoo t[3181] = 7622; t[3182] = 7623; t[3282] = 11799; t[3316] = 578; t[3379] = 42785; t[3393] = 1159; t[3416] = 8377; }); -var getSupplementalGlyphMapForArialBlack = getLookupTableFactory(function (t) { +var getSupplementalGlyphMapForArialBlack = (0, _util.getLookupTableFactory)(function (t) { t[227] = 322; t[264] = 261; t[291] = 346; }); exports.getStdFontMap = getStdFontMap; exports.getNonStdFontMap = getNonStdFontMap; exports.getSerifFonts = getSerifFonts; exports.getSymbolsFonts = getSymbolsFonts; @@ -23376,43 +23286,32 @@ exports.getSupplementalGlyphMapForArialB /***/ }), /* 17 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var sharedUtil = __w_pdfjs_require__(0); -var corePrimitives = __w_pdfjs_require__(1); -var corePdfManager = __w_pdfjs_require__(32); -var UNSUPPORTED_FEATURES = sharedUtil.UNSUPPORTED_FEATURES; -var InvalidPDFException = sharedUtil.InvalidPDFException; -var MessageHandler = sharedUtil.MessageHandler; -var MissingPDFException = sharedUtil.MissingPDFException; -var UnexpectedResponseException = sharedUtil.UnexpectedResponseException; -var PasswordException = sharedUtil.PasswordException; -var UnknownErrorException = sharedUtil.UnknownErrorException; -var XRefParseException = sharedUtil.XRefParseException; -var arrayByteLength = sharedUtil.arrayByteLength; -var arraysToBytes = sharedUtil.arraysToBytes; -var assert = sharedUtil.assert; -var createPromiseCapability = sharedUtil.createPromiseCapability; -var info = sharedUtil.info; -var warn = sharedUtil.warn; -var setVerbosityLevel = sharedUtil.setVerbosityLevel; -var isNodeJS = sharedUtil.isNodeJS; -var Ref = corePrimitives.Ref; -var LocalPdfManager = corePdfManager.LocalPdfManager; -var NetworkPdfManager = corePdfManager.NetworkPdfManager; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.WorkerMessageHandler = exports.WorkerTask = exports.setPDFNetworkStreamClass = undefined; + +var _util = __w_pdfjs_require__(0); + +var _pdf_manager = __w_pdfjs_require__(32); + +var _primitives = __w_pdfjs_require__(1); + var WorkerTask = function WorkerTaskClosure() { function WorkerTask(name) { this.name = name; this.terminated = false; - this._capability = createPromiseCapability(); + this._capability = (0, _util.createPromiseCapability)(); } WorkerTask.prototype = { get finished() { return this._capability.promise; }, finish() { this._capability.resolve(); }, @@ -23422,16 +23321,17 @@ var WorkerTask = function WorkerTaskClos ensureNotTerminated() { if (this.terminated) { throw new Error('Worker task was terminated'); } } }; return WorkerTask; }(); +; var PDFWorkerStream = function PDFWorkerStreamClosure() { function PDFWorkerStream(params, msgHandler) { this._queuedChunks = []; var initialData = params.initialData; if (initialData && initialData.length > 0) { this._queuedChunks.push(initialData); } this._msgHandler = msgHandler; @@ -23454,17 +23354,17 @@ var PDFWorkerStream = function PDFWorker } else { var found = this._rangeReaders.some(function (rangeReader) { if (rangeReader._begin !== args.begin) { return false; } rangeReader._enqueue(args.chunk); return true; }); - assert(found); + (0, _util.assert)(found); } }, _onProgress: function PDFWorkerStream_onProgress(evt) { if (this._rangeReaders.length > 0) { var firstReader = this._rangeReaders[0]; if (firstReader.onProgress) { firstReader.onProgress({ loaded: evt.loaded }); } @@ -23472,17 +23372,17 @@ var PDFWorkerStream = function PDFWorker }, _removeRangeReader: function PDFWorkerStream_removeRangeReader(reader) { var i = this._rangeReaders.indexOf(reader); if (i >= 0) { this._rangeReaders.splice(i, 1); } }, getFullReader: function PDFWorkerStream_getFullReader() { - assert(!this._fullRequestReader); + (0, _util.assert)(!this._fullRequestReader); var queuedChunks = this._queuedChunks; this._queuedChunks = null; return new PDFWorkerStreamReader(this, queuedChunks); }, getRangeReader: function PDFWorkerStream_getRangeReader(begin, end) { var reader = new PDFWorkerStreamRangeReader(this, begin, end); this._msgHandler.send('RequestDataRange', { begin, @@ -23546,17 +23446,17 @@ var PDFWorkerStream = function PDFWorker }); } if (this._done) { return Promise.resolve({ value: undefined, done: true }); } - var requestCapability = createPromiseCapability(); + var requestCapability = (0, _util.createPromiseCapability)(); this._requests.push(requestCapability); return requestCapability.promise; }, cancel: function PDFWorkerStreamReader_cancel(reason) { this._done = true; this._requests.forEach(function (requestCapability) { requestCapability.resolve({ value: undefined, @@ -23610,17 +23510,17 @@ var PDFWorkerStream = function PDFWorker }); } if (this._done) { return Promise.resolve({ value: undefined, done: true }); } - var requestCapability = createPromiseCapability(); + var requestCapability = (0, _util.createPromiseCapability)(); this._requests.push(requestCapability); return requestCapability.promise; }, cancel: function PDFWorkerStreamRangeReader_cancel(reason) { this._done = true; this._requests.forEach(function (requestCapability) { requestCapability.resolve({ value: undefined, @@ -23663,47 +23563,47 @@ var WorkerMessageHandler = { return; } handler.send('test', { supportTypedArray: true, supportTransfers }); }); handler.on('configure', function wphConfigure(data) { - setVerbosityLevel(data.verbosity); + (0, _util.setVerbosityLevel)(data.verbosity); }); handler.on('GetDocRequest', function wphSetupDoc(data) { return WorkerMessageHandler.createDocumentHandler(data, port); }); }, createDocumentHandler(docParams, port) { var pdfManager; var terminated = false; var cancelXHRs = null; var WorkerTasks = []; var docId = docParams.docId; var docBaseUrl = docParams.docBaseUrl; var workerHandlerName = docParams.docId + '_worker'; - var handler = new MessageHandler(workerHandlerName, docId, port); + var handler = new _util.MessageHandler(workerHandlerName, docId, port); handler.postMessageTransfers = docParams.postMessageTransfers; function ensureNotTerminated() { if (terminated) { throw new Error('Worker was terminated'); } } function startWorkerTask(task) { WorkerTasks.push(task); } function finishWorkerTask(task) { task.finish(); var i = WorkerTasks.indexOf(task); WorkerTasks.splice(i, 1); } function loadDocument(recoveryMode) { - var loadDocumentCapability = createPromiseCapability(); + var loadDocumentCapability = (0, _util.createPromiseCapability)(); var parseSuccess = function parseSuccess() { var numPagesPromise = pdfManager.ensureDoc('numPages'); var fingerprintPromise = pdfManager.ensureDoc('fingerprint'); var encryptedPromise = pdfManager.ensureXRef('encrypt'); Promise.all([numPagesPromise, fingerprintPromise, encryptedPromise]).then(function onDocReady(results) { var doc = { numPages: results[0], fingerprint: results[1], @@ -23718,34 +23618,34 @@ var WorkerMessageHandler = { pdfManager.ensureDoc('checkHeader', []).then(function () { pdfManager.ensureDoc('parseStartXRef', []).then(function () { pdfManager.ensureDoc('parse', [recoveryMode]).then(parseSuccess, parseFailure); }, parseFailure); }, parseFailure); return loadDocumentCapability.promise; } function getPdfManager(data, evaluatorOptions) { - var pdfManagerCapability = createPromiseCapability(); + var pdfManagerCapability = (0, _util.createPromiseCapability)(); var pdfManager; var source = data.source; if (source.data) { try { - pdfManager = new LocalPdfManager(docId, source.data, source.password, evaluatorOptions, docBaseUrl); + pdfManager = new _pdf_manager.LocalPdfManager(docId, source.data, source.password, evaluatorOptions, docBaseUrl); pdfManagerCapability.resolve(pdfManager); } catch (ex) { pdfManagerCapability.reject(ex); } return pdfManagerCapability.promise; } var pdfStream; try { if (source.chunkedViewerLoading) { pdfStream = new PDFWorkerStream(source, handler); } else { - assert(PDFNetworkStream, 'pdfjs/core/network module is not loaded'); + (0, _util.assert)(PDFNetworkStream, './network module is not loaded'); pdfStream = new PDFNetworkStream(data); } } catch (ex) { pdfManagerCapability.reject(ex); return pdfManagerCapability.promise; } var fullRequest = pdfStream.getFullReader(); fullRequest.headersReady.then(function () { @@ -23756,39 +23656,39 @@ var WorkerMessageHandler = { total: evt.total }); }; } if (!fullRequest.isRangeSupported) { return; } var disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported; - pdfManager = new NetworkPdfManager(docId, pdfStream, { + pdfManager = new _pdf_manager.NetworkPdfManager(docId, pdfStream, { msgHandler: handler, url: source.url, password: source.password, length: fullRequest.contentLength, disableAutoFetch, rangeChunkSize: source.rangeChunkSize }, evaluatorOptions, docBaseUrl); pdfManagerCapability.resolve(pdfManager); cancelXHRs = null; }).catch(function (reason) { pdfManagerCapability.reject(reason); cancelXHRs = null; }); var cachedChunks = [], loaded = 0; var flushChunks = function () { - var pdfFile = arraysToBytes(cachedChunks); + var pdfFile = (0, _util.arraysToBytes)(cachedChunks); if (source.length && pdfFile.length !== source.length) { - warn('reported HTTP length is different from actual'); + (0, _util.warn)('reported HTTP length is different from actual'); } try { - pdfManager = new LocalPdfManager(docId, pdfFile, source.password, evaluatorOptions, docBaseUrl); + pdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, source.password, evaluatorOptions, docBaseUrl); pdfManagerCapability.resolve(pdfManager); } catch (ex) { pdfManagerCapability.reject(ex); } cachedChunks = []; }; var readPromise = new Promise(function (resolve, reject) { var readChunk = function (chunk) { @@ -23797,17 +23697,17 @@ var WorkerMessageHandler = { if (chunk.done) { if (!pdfManager) { flushChunks(); } cancelXHRs = null; return; } var data = chunk.value; - loaded += arrayByteLength(data); + loaded += (0, _util.arrayByteLength)(data); if (!fullRequest.isStreamingSupported) { handler.send('DocProgress', { loaded, total: Math.max(loaded, fullRequest.contentLength || 0) }); } if (pdfManager) { pdfManager.sendProgressiveData(data); @@ -23831,42 +23731,42 @@ var WorkerMessageHandler = { return pdfManagerCapability.promise; } function setupDoc(data) { function onSuccess(doc) { ensureNotTerminated(); handler.send('GetDoc', { pdfInfo: doc }); } function onFailure(e) { - if (e instanceof PasswordException) { + if (e instanceof _util.PasswordException) { var task = new WorkerTask('PasswordException: response ' + e.code); startWorkerTask(task); handler.sendWithPromise('PasswordRequest', e).then(function (data) { finishWorkerTask(task); pdfManager.updatePassword(data.password); pdfManagerReady(); }).catch(function (ex) { finishWorkerTask(task); handler.send('PasswordException', ex); }.bind(null, e)); - } else if (e instanceof InvalidPDFException) { + } else if (e instanceof _util.InvalidPDFException) { handler.send('InvalidPDF', e); - } else if (e instanceof MissingPDFException) { + } else if (e instanceof _util.MissingPDFException) { handler.send('MissingPDF', e); - } else if (e instanceof UnexpectedResponseException) { + } else if (e instanceof _util.UnexpectedResponseException) { handler.send('UnexpectedResponse', e); } else { - handler.send('UnknownError', new UnknownErrorException(e.message, e.toString())); + handler.send('UnknownError', new _util.UnknownErrorException(e.message, e.toString())); } } function pdfManagerReady() { ensureNotTerminated(); loadDocument(false).then(onSuccess, function loadFailure(ex) { ensureNotTerminated(); - if (!(ex instanceof XRefParseException)) { + if (!(ex instanceof _util.XRefParseException)) { onFailure(ex); return; } pdfManager.requestLoadedStream(); pdfManager.onLoadedStream().then(function () { ensureNotTerminated(); loadDocument(true).then(onSuccess, onFailure); }); @@ -23904,17 +23804,17 @@ var WorkerMessageHandler = { ref: results[1], userUnit: results[2], view: results[3] }; }); }); }); handler.on('GetPageIndex', function wphSetupGetPageIndex(data) { - var ref = new Ref(data.ref.num, data.ref.gen); + var ref = new _primitives.Ref(data.ref.num, data.ref.gen); var catalog = pdfManager.pdfDocument.catalog; return catalog.getPageIndex(ref); }); handler.on('GetDestinations', function wphSetupGetDestinations(data) { return pdfManager.ensureCatalog('destinations'); }); handler.on('GetDestination', function wphSetupGetDestination(data) { return pdfManager.ensureCatalog('getDestination', [data.id]); @@ -23957,23 +23857,23 @@ var WorkerMessageHandler = { var start = Date.now(); page.getOperatorList({ handler, task, intent: data.intent, renderInteractiveForms: data.renderInteractiveForms }).then(function (operatorList) { finishWorkerTask(task); - info('page=' + pageNum + ' - getOperatorList: time=' + (Date.now() - start) + 'ms, len=' + operatorList.totalLength); + (0, _util.info)('page=' + pageNum + ' - getOperatorList: time=' + (Date.now() - start) + 'ms, len=' + operatorList.totalLength); }, function (e) { finishWorkerTask(task); if (task.terminated) { return; } - handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.unknown }); + handler.send('UnsupportedFeature', { featureId: _util.UNSUPPORTED_FEATURES.unknown }); var minimumStackMessage = 'worker.js: while trying to getPage() and getOperatorList()'; var wrappedException; if (typeof e === 'string') { wrappedException = { message: e, stack: minimumStackMessage }; } else if (typeof e === 'object') { @@ -24004,17 +23904,17 @@ var WorkerMessageHandler = { var start = Date.now(); return page.extractTextContent({ handler, task, normalizeWhitespace: data.normalizeWhitespace, combineTextItems: data.combineTextItems }).then(function (textContent) { finishWorkerTask(task); - info('text indexing: page=' + pageNum + ' - time=' + (Date.now() - start) + 'ms'); + (0, _util.info)('text indexing: page=' + pageNum + ' - time=' + (Date.now() - start) + 'ms'); return textContent; }, function (reason) { finishWorkerTask(task); if (task.terminated) { return; } throw reason; }); @@ -24044,25 +23944,25 @@ var WorkerMessageHandler = { }); handler.on('Ready', function wphReady(data) { setupDoc(docParams); docParams = null; }); return workerHandlerName; }, initializeFromPort(port) { - var handler = new MessageHandler('worker', 'main', port); + var handler = new _util.MessageHandler('worker', 'main', port); WorkerMessageHandler.setup(handler, port); handler.send('ready', null); } }; function isMessagePort(maybePort) { return typeof maybePort.postMessage === 'function' && 'onmessage' in maybePort; } -if (typeof window === 'undefined' && !isNodeJS() && typeof self !== 'undefined' && isMessagePort(self)) { +if (typeof window === 'undefined' && !(0, _util.isNodeJS)() && typeof self !== 'undefined' && isMessagePort(self)) { WorkerMessageHandler.initializeFromPort(self); } exports.setPDFNetworkStreamClass = setPDFNetworkStreamClass; exports.WorkerTask = WorkerTask; exports.WorkerMessageHandler = WorkerMessageHandler; /***/ }), /* 18 */ @@ -24084,79 +23984,68 @@ module.exports = g; /***/ }), /* 19 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var sharedUtil = __w_pdfjs_require__(0); -var corePrimitives = __w_pdfjs_require__(1); -var coreStream = __w_pdfjs_require__(2); -var coreColorSpace = __w_pdfjs_require__(3); -var coreObj = __w_pdfjs_require__(15); -var coreEvaluator = __w_pdfjs_require__(13); -var AnnotationBorderStyleType = sharedUtil.AnnotationBorderStyleType; -var AnnotationFieldFlag = sharedUtil.AnnotationFieldFlag; -var AnnotationFlag = sharedUtil.AnnotationFlag; -var AnnotationType = sharedUtil.AnnotationType; -var OPS = sharedUtil.OPS; -var Util = sharedUtil.Util; -var isArray = sharedUtil.isArray; -var isInt = sharedUtil.isInt; -var stringToBytes = sharedUtil.stringToBytes; -var stringToPDFString = sharedUtil.stringToPDFString; -var warn = sharedUtil.warn; -var Dict = corePrimitives.Dict; -var isDict = corePrimitives.isDict; -var isName = corePrimitives.isName; -var isRef = corePrimitives.isRef; -var isStream = corePrimitives.isStream; -var Stream = coreStream.Stream; -var ColorSpace = coreColorSpace.ColorSpace; -var Catalog = coreObj.Catalog; -var ObjectLoader = coreObj.ObjectLoader; -var FileSpec = coreObj.FileSpec; -var OperatorList = coreEvaluator.OperatorList; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = undefined; + +var _util = __w_pdfjs_require__(0); + +var _obj = __w_pdfjs_require__(15); + +var _primitives = __w_pdfjs_require__(1); + +var _colorspace = __w_pdfjs_require__(3); + +var _evaluator = __w_pdfjs_require__(13); + +var _stream = __w_pdfjs_require__(2); + function AnnotationFactory() {} AnnotationFactory.prototype = { create: function AnnotationFactory_create(xref, ref, pdfManager, idFactory) { var dict = xref.fetchIfRef(ref); - if (!isDict(dict)) { + if (!(0, _primitives.isDict)(dict)) { return; } - var id = isRef(ref) ? ref.toString() : 'annot_' + idFactory.createObjId(); + var id = (0, _primitives.isRef)(ref) ? ref.toString() : 'annot_' + idFactory.createObjId(); var subtype = dict.get('Subtype'); - subtype = isName(subtype) ? subtype.name : null; + subtype = (0, _primitives.isName)(subtype) ? subtype.name : null; var parameters = { xref, dict, - ref: isRef(ref) ? ref : null, + ref: (0, _primitives.isRef)(ref) ? ref : null, subtype, id, pdfManager }; switch (subtype) { case 'Link': return new LinkAnnotation(parameters); case 'Text': return new TextAnnotation(parameters); case 'Widget': - var fieldType = Util.getInheritableProperty(dict, 'FT'); - fieldType = isName(fieldType) ? fieldType.name : null; + var fieldType = _util.Util.getInheritableProperty(dict, 'FT'); + fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null; switch (fieldType) { case 'Tx': return new TextWidgetAnnotation(parameters); case 'Btn': return new ButtonWidgetAnnotation(parameters); case 'Ch': return new ChoiceWidgetAnnotation(parameters); } - warn('Unimplemented widget field type "' + fieldType + '", ' + 'falling back to base field type.'); + (0, _util.warn)('Unimplemented widget field type "' + fieldType + '", ' + 'falling back to base field type.'); return new WidgetAnnotation(parameters); case 'Popup': return new PopupAnnotation(parameters); case 'Line': return new LineAnnotation(parameters); case 'Highlight': return new HighlightAnnotation(parameters); case 'Underline': @@ -24164,27 +24053,27 @@ AnnotationFactory.prototype = { case 'Squiggly': return new SquigglyAnnotation(parameters); case 'StrikeOut': return new StrikeOutAnnotation(parameters); case 'FileAttachment': return new FileAttachmentAnnotation(parameters); default: if (!subtype) { - warn('Annotation is missing the required /Subtype.'); - } else { - warn('Unimplemented annotation type "' + subtype + '", ' + 'falling back to base annotation.'); + (0, _util.warn)('Annotation is missing the required /Subtype.'); + } else { + (0, _util.warn)('Unimplemented annotation type "' + subtype + '", ' + 'falling back to base annotation.'); } return new Annotation(parameters); } } }; var Annotation = function AnnotationClosure() { function getTransformMatrix(rect, bbox, matrix) { - var bounds = Util.getAxialAlignedBoundingBox(bbox, matrix); + var bounds = _util.Util.getAxialAlignedBoundingBox(bbox, matrix); var minX = bounds[0]; var minY = bounds[1]; var maxX = bounds[2]; var maxY = bounds[3]; if (minX === maxX || minY === maxY) { return [1, 0, 0, 1, rect[0], rect[1]]; } var xRatio = (rect[2] - rect[0]) / (maxX - minX); @@ -24207,207 +24096,207 @@ var Annotation = function AnnotationClos this.data.borderStyle = this.borderStyle; this.data.hasAppearance = !!this.appearance; } Annotation.prototype = { _hasFlag: function Annotation_hasFlag(flags, flag) { return !!(flags & flag); }, _isViewable: function Annotation_isViewable(flags) { - return !this._hasFlag(flags, AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, AnnotationFlag.HIDDEN) && !this._hasFlag(flags, AnnotationFlag.NOVIEW); + return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.HIDDEN) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW); }, _isPrintable: function AnnotationFlag_isPrintable(flags) { - return this._hasFlag(flags, AnnotationFlag.PRINT) && !this._hasFlag(flags, AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, AnnotationFlag.HIDDEN); + return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.HIDDEN); }, get viewable() { if (this.flags === 0) { return true; } return this._isViewable(this.flags); }, get printable() { if (this.flags === 0) { return false; } return this._isPrintable(this.flags); }, setFlags: function Annotation_setFlags(flags) { - this.flags = isInt(flags) && flags > 0 ? flags : 0; + this.flags = (0, _util.isInt)(flags) && flags > 0 ? flags : 0; }, hasFlag: function Annotation_hasFlag(flag) { return this._hasFlag(this.flags, flag); }, setRectangle: function Annotation_setRectangle(rectangle) { - if (isArray(rectangle) && rectangle.length === 4) { - this.rectangle = Util.normalizeRect(rectangle); + if ((0, _util.isArray)(rectangle) && rectangle.length === 4) { + this.rectangle = _util.Util.normalizeRect(rectangle); } else { this.rectangle = [0, 0, 0, 0]; } }, setColor: function Annotation_setColor(color) { var rgbColor = new Uint8Array(3); - if (!isArray(color)) { + if (!(0, _util.isArray)(color)) { this.color = rgbColor; return; } switch (color.length) { case 0: this.color = null; break; case 1: - ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0); + _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0); this.color = rgbColor; break; case 3: - ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0); + _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0); this.color = rgbColor; break; case 4: - ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0); + _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0); this.color = rgbColor; break; default: this.color = rgbColor; break; } }, setBorderStyle: function Annotation_setBorderStyle(borderStyle) { this.borderStyle = new AnnotationBorderStyle(); - if (!isDict(borderStyle)) { + if (!(0, _primitives.isDict)(borderStyle)) { return; } if (borderStyle.has('BS')) { var dict = borderStyle.get('BS'); var dictType = dict.get('Type'); - if (!dictType || isName(dictType, 'Border')) { + if (!dictType || (0, _primitives.isName)(dictType, 'Border')) { this.borderStyle.setWidth(dict.get('W')); this.borderStyle.setStyle(dict.get('S')); this.borderStyle.setDashArray(dict.getArray('D')); } } else if (borderStyle.has('Border')) { var array = borderStyle.getArray('Border'); - if (isArray(array) && array.length >= 3) { + if ((0, _util.isArray)(array) && array.length >= 3) { this.borderStyle.setHorizontalCornerRadius(array[0]); this.borderStyle.setVerticalCornerRadius(array[1]); this.borderStyle.setWidth(array[2]); if (array.length === 4) { this.borderStyle.setDashArray(array[3]); } } } else { this.borderStyle.setWidth(0); } }, setAppearance: function Annotation_setAppearance(dict) { this.appearance = null; var appearanceStates = dict.get('AP'); - if (!isDict(appearanceStates)) { + if (!(0, _primitives.isDict)(appearanceStates)) { return; } var normalAppearanceState = appearanceStates.get('N'); - if (isStream(normalAppearanceState)) { + if ((0, _primitives.isStream)(normalAppearanceState)) { this.appearance = normalAppearanceState; return; } - if (!isDict(normalAppearanceState)) { + if (!(0, _primitives.isDict)(normalAppearanceState)) { return; } var as = dict.get('AS'); - if (!isName(as) || !normalAppearanceState.has(as.name)) { + if (!(0, _primitives.isName)(as) || !normalAppearanceState.has(as.name)) { return; } this.appearance = normalAppearanceState.get(as.name); }, _preparePopup: function Annotation_preparePopup(dict) { if (!dict.has('C')) { this.data.color = null; } this.data.hasPopup = dict.has('Popup'); - this.data.title = stringToPDFString(dict.get('T') || ''); - this.data.contents = stringToPDFString(dict.get('Contents') || ''); + this.data.title = (0, _util.stringToPDFString)(dict.get('T') || ''); + this.data.contents = (0, _util.stringToPDFString)(dict.get('Contents') || ''); }, loadResources: function Annotation_loadResources(keys) { return this.appearance.dict.getAsync('Resources').then(resources => { if (!resources) { return; } - var objectLoader = new ObjectLoader(resources.map, keys, resources.xref); + var objectLoader = new _obj.ObjectLoader(resources.map, keys, resources.xref); return objectLoader.load().then(function () { return resources; }); }); }, getOperatorList: function Annotation_getOperatorList(evaluator, task, renderForms) { if (!this.appearance) { - return Promise.resolve(new OperatorList()); + return Promise.resolve(new _evaluator.OperatorList()); } var data = this.data; var appearanceDict = this.appearance.dict; var resourcesPromise = this.loadResources(['ExtGState', 'ColorSpace', 'Pattern', 'Shading', 'XObject', 'Font']); var bbox = appearanceDict.getArray('BBox') || [0, 0, 1, 1]; var matrix = appearanceDict.getArray('Matrix') || [1, 0, 0, 1, 0, 0]; var transform = getTransformMatrix(data.rect, bbox, matrix); return resourcesPromise.then(resources => { - var opList = new OperatorList(); - opList.addOp(OPS.beginAnnotation, [data.rect, transform, matrix]); + var opList = new _evaluator.OperatorList(); + opList.addOp(_util.OPS.beginAnnotation, [data.rect, transform, matrix]); return evaluator.getOperatorList({ stream: this.appearance, task, resources, operatorList: opList }).then(() => { - opList.addOp(OPS.endAnnotation, []); + opList.addOp(_util.OPS.endAnnotation, []); this.appearance.reset(); return opList; }); }); } }; return Annotation; }(); var AnnotationBorderStyle = function AnnotationBorderStyleClosure() { function AnnotationBorderStyle() { this.width = 1; - this.style = AnnotationBorderStyleType.SOLID; + this.style = _util.AnnotationBorderStyleType.SOLID; this.dashArray = [3]; this.horizontalCornerRadius = 0; this.verticalCornerRadius = 0; } AnnotationBorderStyle.prototype = { setWidth: function AnnotationBorderStyle_setWidth(width) { if (width === (width | 0)) { this.width = width; } }, setStyle: function AnnotationBorderStyle_setStyle(style) { if (!style) { return; } switch (style.name) { case 'S': - this.style = AnnotationBorderStyleType.SOLID; + this.style = _util.AnnotationBorderStyleType.SOLID; break; case 'D': - this.style = AnnotationBorderStyleType.DASHED; + this.style = _util.AnnotationBorderStyleType.DASHED; break; case 'B': - this.style = AnnotationBorderStyleType.BEVELED; + this.style = _util.AnnotationBorderStyleType.BEVELED; break; case 'I': - this.style = AnnotationBorderStyleType.INSET; + this.style = _util.AnnotationBorderStyleType.INSET; break; case 'U': - this.style = AnnotationBorderStyleType.UNDERLINE; + this.style = _util.AnnotationBorderStyleType.UNDERLINE; break; default: break; } }, setDashArray: function AnnotationBorderStyle_setDashArray(dashArray) { - if (isArray(dashArray) && dashArray.length > 0) { + if ((0, _util.isArray)(dashArray) && dashArray.length > 0) { var isValid = true; var allZeros = true; for (var i = 0, len = dashArray.length; i < len; i++) { var element = dashArray[i]; var validNumber = +element >= 0; if (!validNumber) { isValid = false; break; @@ -24437,323 +24326,328 @@ var AnnotationBorderStyle = function Ann }; return AnnotationBorderStyle; }(); var WidgetAnnotation = function WidgetAnnotationClosure() { function WidgetAnnotation(params) { Annotation.call(this, params); var dict = params.dict; var data = this.data; - data.annotationType = AnnotationType.WIDGET; + data.annotationType = _util.AnnotationType.WIDGET; data.fieldName = this._constructFieldName(dict); - data.fieldValue = Util.getInheritableProperty(dict, 'V', true); - data.alternativeText = stringToPDFString(dict.get('TU') || ''); - data.defaultAppearance = Util.getInheritableProperty(dict, 'DA') || ''; - var fieldType = Util.getInheritableProperty(dict, 'FT'); - data.fieldType = isName(fieldType) ? fieldType.name : null; - this.fieldResources = Util.getInheritableProperty(dict, 'DR') || Dict.empty; - data.fieldFlags = Util.getInheritableProperty(dict, 'Ff'); - if (!isInt(data.fieldFlags) || data.fieldFlags < 0) { + data.fieldValue = _util.Util.getInheritableProperty(dict, 'V', true); + data.alternativeText = (0, _util.stringToPDFString)(dict.get('TU') || ''); + data.defaultAppearance = _util.Util.getInheritableProperty(dict, 'DA') || ''; + var fieldType = _util.Util.getInheritableProperty(dict, 'FT'); + data.fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null; + this.fieldResources = _util.Util.getInheritableProperty(dict, 'DR') || _primitives.Dict.empty; + data.fieldFlags = _util.Util.getInheritableProperty(dict, 'Ff'); + if (!(0, _util.isInt)(data.fieldFlags) || data.fieldFlags < 0) { data.fieldFlags = 0; } - data.readOnly = this.hasFieldFlag(AnnotationFieldFlag.READONLY); + data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY); if (data.fieldType === 'Sig') { - this.setFlags(AnnotationFlag.HIDDEN); - } - } - Util.inherit(WidgetAnnotation, Annotation, { + this.setFlags(_util.AnnotationFlag.HIDDEN); + } + } + _util.Util.inherit(WidgetAnnotation, Annotation, { _constructFieldName: function WidgetAnnotation_constructFieldName(dict) { if (!dict.has('T') && !dict.has('Parent')) { - warn('Unknown field name, falling back to empty field name.'); + (0, _util.warn)('Unknown field name, falling back to empty field name.'); return ''; } if (!dict.has('Parent')) { - return stringToPDFString(dict.get('T')); + return (0, _util.stringToPDFString)(dict.get('T')); } var fieldName = []; if (dict.has('T')) { - fieldName.unshift(stringToPDFString(dict.get('T'))); + fieldName.unshift((0, _util.stringToPDFString)(dict.get('T'))); } var loopDict = dict; while (loopDict.has('Parent')) { loopDict = loopDict.get('Parent'); - if (!isDict(loopDict)) { + if (!(0, _primitives.isDict)(loopDict)) { break; } if (loopDict.has('T')) { - fieldName.unshift(stringToPDFString(loopDict.get('T'))); + fieldName.unshift((0, _util.stringToPDFString)(loopDict.get('T'))); } } return fieldName.join('.'); }, hasFieldFlag: function WidgetAnnotation_hasFieldFlag(flag) { return !!(this.data.fieldFlags & flag); } }); return WidgetAnnotation; }(); var TextWidgetAnnotation = function TextWidgetAnnotationClosure() { function TextWidgetAnnotation(params) { WidgetAnnotation.call(this, params); - this.data.fieldValue = stringToPDFString(this.data.fieldValue || ''); - var alignment = Util.getInheritableProperty(params.dict, 'Q'); - if (!isInt(alignment) || alignment < 0 || alignment > 2) { + this.data.fieldValue = (0, _util.stringToPDFString)(this.data.fieldValue || ''); + var alignment = _util.Util.getInheritableProperty(params.dict, 'Q'); + if (!(0, _util.isInt)(alignment) || alignment < 0 || alignment > 2) { alignment = null; } this.data.textAlignment = alignment; - var maximumLength = Util.getInheritableProperty(params.dict, 'MaxLen'); - if (!isInt(maximumLength) || maximumLength < 0) { + var maximumLength = _util.Util.getInheritableProperty(params.dict, 'MaxLen'); + if (!(0, _util.isInt)(maximumLength) || maximumLength < 0) { maximumLength = null; } this.data.maxLen = maximumLength; - this.data.multiLine = this.hasFieldFlag(AnnotationFieldFlag.MULTILINE); - this.data.comb = this.hasFieldFlag(AnnotationFieldFlag.COMB) && !this.hasFieldFlag(AnnotationFieldFlag.MULTILINE) && !this.hasFieldFlag(AnnotationFieldFlag.PASSWORD) && !this.hasFieldFlag(AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== null; - } - Util.inherit(TextWidgetAnnotation, WidgetAnnotation, { + this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE); + this.data.comb = this.hasFieldFlag(_util.AnnotationFieldFlag.COMB) && !this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD) && !this.hasFieldFlag(_util.AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== null; + } + _util.Util.inherit(TextWidgetAnnotation, WidgetAnnotation, { getOperatorList: function TextWidgetAnnotation_getOperatorList(evaluator, task, renderForms) { - var operatorList = new OperatorList(); + var operatorList = new _evaluator.OperatorList(); if (renderForms) { return Promise.resolve(operatorList); } if (this.appearance) { return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms); } if (!this.data.defaultAppearance) { return Promise.resolve(operatorList); } - var stream = new Stream(stringToBytes(this.data.defaultAppearance)); + var stream = new _stream.Stream((0, _util.stringToBytes)(this.data.defaultAppearance)); return evaluator.getOperatorList({ stream, task, resources: this.fieldResources, operatorList }).then(function () { return operatorList; }); } }); return TextWidgetAnnotation; }(); var ButtonWidgetAnnotation = function ButtonWidgetAnnotationClosure() { function ButtonWidgetAnnotation(params) { WidgetAnnotation.call(this, params); - this.data.checkBox = !this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON); + this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON); if (this.data.checkBox) { - if (!isName(this.data.fieldValue)) { + if (!(0, _primitives.isName)(this.data.fieldValue)) { return; } this.data.fieldValue = this.data.fieldValue.name; } - this.data.radioButton = this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON); + this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON); if (this.data.radioButton) { this.data.fieldValue = this.data.buttonValue = null; var fieldParent = params.dict.get('Parent'); - if (isDict(fieldParent) && fieldParent.has('V')) { + if ((0, _primitives.isDict)(fieldParent) && fieldParent.has('V')) { var fieldParentValue = fieldParent.get('V'); - if (isName(fieldParentValue)) { + if ((0, _primitives.isName)(fieldParentValue)) { this.data.fieldValue = fieldParentValue.name; } } var appearanceStates = params.dict.get('AP'); - if (!isDict(appearanceStates)) { + if (!(0, _primitives.isDict)(appearanceStates)) { return; } var normalAppearanceState = appearanceStates.get('N'); - if (!isDict(normalAppearanceState)) { + if (!(0, _primitives.isDict)(normalAppearanceState)) { return; } var keys = normalAppearanceState.getKeys(); for (var i = 0, ii = keys.length; i < ii; i++) { if (keys[i] !== 'Off') { this.data.buttonValue = keys[i]; break; } } } } - Util.inherit(ButtonWidgetAnnotation, WidgetAnnotation, { + _util.Util.inherit(ButtonWidgetAnnotation, WidgetAnnotation, { getOperatorList: function ButtonWidgetAnnotation_getOperatorList(evaluator, task, renderForms) { - var operatorList = new OperatorList(); + var operatorList = new _evaluator.OperatorList(); if (renderForms) { return Promise.resolve(operatorList); } if (this.appearance) { return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms); } return Promise.resolve(operatorList); } }); return ButtonWidgetAnnotation; }(); var ChoiceWidgetAnnotation = function ChoiceWidgetAnnotationClosure() { function ChoiceWidgetAnnotation(params) { WidgetAnnotation.call(this, params); this.data.options = []; - var options = Util.getInheritableProperty(params.dict, 'Opt'); - if (isArray(options)) { + var options = _util.Util.getInheritableProperty(params.dict, 'Opt'); + if ((0, _util.isArray)(options)) { var xref = params.xref; for (var i = 0, ii = options.length; i < ii; i++) { var option = xref.fetchIfRef(options[i]); - var isOptionArray = isArray(option); + var isOptionArray = (0, _util.isArray)(option); this.data.options[i] = { exportValue: isOptionArray ? xref.fetchIfRef(option[0]) : option, displayValue: isOptionArray ? xref.fetchIfRef(option[1]) : option }; } } - if (!isArray(this.data.fieldValue)) { + if (!(0, _util.isArray)(this.data.fieldValue)) { this.data.fieldValue = [this.data.fieldValue]; } - this.data.combo = this.hasFieldFlag(AnnotationFieldFlag.COMBO); - this.data.multiSelect = this.hasFieldFlag(AnnotationFieldFlag.MULTISELECT); - } - Util.inherit(ChoiceWidgetAnnotation, WidgetAnnotation, { + this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO); + this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT); + } + _util.Util.inherit(ChoiceWidgetAnnotation, WidgetAnnotation, { getOperatorList: function ChoiceWidgetAnnotation_getOperatorList(evaluator, task, renderForms) { - var operatorList = new OperatorList(); + var operatorList = new _evaluator.OperatorList(); if (renderForms) { return Promise.resolve(operatorList); } return Annotation.prototype.getOperatorList.call(this, evaluator, task, renderForms); } }); return ChoiceWidgetAnnotation; }(); var TextAnnotation = function TextAnnotationClosure() { var DEFAULT_ICON_SIZE = 22; function TextAnnotation(parameters) { Annotation.call(this, parameters); - this.data.annotationType = AnnotationType.TEXT; + this.data.annotationType = _util.AnnotationType.TEXT; if (this.data.hasAppearance) { this.data.name = 'NoIcon'; } else { this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE; this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE; this.data.name = parameters.dict.has('Name') ? parameters.dict.get('Name').name : 'Note'; } this._preparePopup(parameters.dict); } - Util.inherit(TextAnnotation, Annotation, {}); + _util.Util.inherit(TextAnnotation, Annotation, {}); return TextAnnotation; }(); var LinkAnnotation = function LinkAnnotationClosure() { function LinkAnnotation(params) { Annotation.call(this, params); var data = this.data; - data.annotationType = AnnotationType.LINK; - Catalog.parseDestDictionary({ + data.annotationType = _util.AnnotationType.LINK; + _obj.Catalog.parseDestDictionary({ destDict: params.dict, resultObj: data, docBaseUrl: params.pdfManager.docBaseUrl }); } - Util.inherit(LinkAnnotation, Annotation, {}); + _util.Util.inherit(LinkAnnotation, Annotation, {}); return LinkAnnotation; }(); var PopupAnnotation = function PopupAnnotationClosure() { function PopupAnnotation(parameters) { Annotation.call(this, parameters); - this.data.annotationType = AnnotationType.POPUP; + this.data.annotationType = _util.AnnotationType.POPUP; var dict = parameters.dict; var parentItem = dict.get('Parent'); if (!parentItem) { - warn('Popup annotation has a missing or invalid parent annotation.'); + (0, _util.warn)('Popup annotation has a missing or invalid parent annotation.'); return; } var parentSubtype = parentItem.get('Subtype'); - this.data.parentType = isName(parentSubtype) ? parentSubtype.name : null; + this.data.parentType = (0, _primitives.isName)(parentSubtype) ? parentSubtype.name : null; this.data.parentId = dict.getRaw('Parent').toString(); - this.data.title = stringToPDFString(parentItem.get('T') || ''); - this.data.contents = stringToPDFString(parentItem.get('Contents') || ''); + this.data.title = (0, _util.stringToPDFString)(parentItem.get('T') || ''); + this.data.contents = (0, _util.stringToPDFString)(parentItem.get('Contents') || ''); if (!parentItem.has('C')) { this.data.color = null; } else { this.setColor(parentItem.getArray('C')); this.data.color = this.color; } if (!this.viewable) { var parentFlags = parentItem.get('F'); if (this._isViewable(parentFlags)) { this.setFlags(parentFlags); } } } - Util.inherit(PopupAnnotation, Annotation, {}); + _util.Util.inherit(PopupAnnotation, Annotation, {}); return PopupAnnotation; }(); var LineAnnotation = function LineAnnotationClosure() { function LineAnnotation(parameters) { Annotation.call(this, parameters); - this.data.annotationType = AnnotationType.LINE; + this.data.annotationType = _util.AnnotationType.LINE; var dict = parameters.dict; - this.data.lineCoordinates = Util.normalizeRect(dict.getArray('L')); + this.data.lineCoordinates = _util.Util.normalizeRect(dict.getArray('L')); this._preparePopup(dict); } - Util.inherit(LineAnnotation, Annotation, {}); + _util.Util.inherit(LineAnnotation, Annotation, {}); return LineAnnotation; }(); var HighlightAnnotation = function HighlightAnnotationClosure() { function HighlightAnnotation(parameters) { Annotation.call(this, parameters); - this.data.annotationType = AnnotationType.HIGHLIGHT; + this.data.annotationType = _util.AnnotationType.HIGHLIGHT; this._preparePopup(parameters.dict); } - Util.inherit(HighlightAnnotation, Annotation, {}); + _util.Util.inherit(HighlightAnnotation, Annotation, {}); return HighlightAnnotation; }(); var UnderlineAnnotation = function UnderlineAnnotationClosure() { function UnderlineAnnotation(parameters) { Annotation.call(this, parameters); - this.data.annotationType = AnnotationType.UNDERLINE; + this.data.annotationType = _util.AnnotationType.UNDERLINE; this._preparePopup(parameters.dict); } - Util.inherit(UnderlineAnnotation, Annotation, {}); + _util.Util.inherit(UnderlineAnnotation, Annotation, {}); return UnderlineAnnotation; }(); var SquigglyAnnotation = function SquigglyAnnotationClosure() { function SquigglyAnnotation(parameters) { Annotation.call(this, parameters); - this.data.annotationType = AnnotationType.SQUIGGLY; + this.data.annotationType = _util.AnnotationType.SQUIGGLY; this._preparePopup(parameters.dict); } - Util.inherit(SquigglyAnnotation, Annotation, {}); + _util.Util.inherit(SquigglyAnnotation, Annotation, {}); return SquigglyAnnotation; }(); var StrikeOutAnnotation = function StrikeOutAnnotationClosure() { function StrikeOutAnnotation(parameters) { Annotation.call(this, parameters); - this.data.annotationType = AnnotationType.STRIKEOUT; + this.data.annotationType = _util.AnnotationType.STRIKEOUT; this._preparePopup(parameters.dict); } - Util.inherit(StrikeOutAnnotation, Annotation, {}); + _util.Util.inherit(StrikeOutAnnotation, Annotation, {}); return StrikeOutAnnotation; }(); var FileAttachmentAnnotation = function FileAttachmentAnnotationClosure() { function FileAttachmentAnnotation(parameters) { Annotation.call(this, parameters); - var file = new FileSpec(parameters.dict.get('FS'), parameters.xref); - this.data.annotationType = AnnotationType.FILEATTACHMENT; + var file = new _obj.FileSpec(parameters.dict.get('FS'), parameters.xref); + this.data.annotationType = _util.AnnotationType.FILEATTACHMENT; this.data.file = file.serializable; this._preparePopup(parameters.dict); } - Util.inherit(FileAttachmentAnnotation, Annotation, {}); + _util.Util.inherit(FileAttachmentAnnotation, Annotation, {}); return FileAttachmentAnnotation; }(); exports.Annotation = Annotation; exports.AnnotationBorderStyle = AnnotationBorderStyle; exports.AnnotationFactory = AnnotationFactory; /***/ }), /* 20 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var sharedUtil = __w_pdfjs_require__(0); -var warn = sharedUtil.warn; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.bidi = undefined; + +var _util = __w_pdfjs_require__(0); + var baseTypes = ['BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'S', 'B', 'S', 'WS', 'B', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'B', 'B', 'B', 'S', 'WS', 'ON', 'ON', 'ET', 'ET', 'ET', 'ON', 'ON', 'ON', 'ON', 'ON', 'ES', 'CS', 'ES', 'CS', 'CS', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'CS', 'ON', 'ON', 'ON', 'ON', 'ON', 'ON', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'ON', 'ON', 'ON', 'ON', 'ON', 'ON', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'ON', 'ON', 'ON', 'ON', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'B', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'CS', 'ON', 'ET', 'ET', 'ET', 'ET', 'ON', 'ON', 'ON', 'ON', 'L', 'ON', 'ON', 'BN', 'ON', 'ON', 'ET', 'ET', 'EN', 'EN', 'ON', 'L', 'ON', 'ON', 'ON', 'EN', 'L', 'ON', 'ON', 'ON', 'ON', 'ON', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'ON', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'ON', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L']; var arabicTypes = ['AN', 'AN', 'AN', 'AN', 'AN', 'AN', 'ON', 'ON', 'AL', 'ET', 'ET', 'AL', 'CS', 'AL', 'ON', 'ON', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'AL', 'AL', '', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'AN', 'AN', 'AN', 'AN', 'AN', 'AN', 'AN', 'AN', 'AN', 'AN', 'ET', 'AN', 'AN', 'AL', 'AL', 'AL', 'NSM', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'AN', 'ON', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'AL', 'AL', 'NSM', 'NSM', 'ON', 'NSM', 'NSM', 'NSM', 'NSM', 'AL', 'AL', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL']; function isOdd(i) { return (i & 1) !== 0; } function isEven(i) { return (i & 1) === 0; } @@ -24801,17 +24695,17 @@ function bidi(str, startLevel, vertical) var charType = 'L'; if (charCode <= 0x00ff) { charType = baseTypes[charCode]; } else if (0x0590 <= charCode && charCode <= 0x05f4) { charType = 'R'; } else if (0x0600 <= charCode && charCode <= 0x06ff) { charType = arabicTypes[charCode & 0xff]; if (!charType) { - warn('Bidi: invalid Unicode character ' + charCode.toString(16)); + (0, _util.warn)('Bidi: invalid Unicode character ' + charCode.toString(16)); } } else if (0x0700 <= charCode && charCode <= 0x08AC) { charType = 'AL'; } if (charType === 'R' || charType === 'AL' || charType === 'AN') { numBidi++; } types[i] = charType; @@ -24982,48 +24876,46 @@ exports.bidi = bidi; /***/ }), /* 21 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); var ISOAdobeCharset = ['.notdef', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent', 'ampersand', 'quoteright', 'parenleft', 'parenright', 'asterisk', 'plus', 'comma', 'hyphen', 'period', 'slash', 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', 'less', 'equal', 'greater', 'question', 'at', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'bracketleft', 'backslash', 'bracketright', 'asciicircum', 'underscore', 'quoteleft', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'braceleft', 'bar', 'braceright', 'asciitilde', 'exclamdown', 'cent', 'sterling', 'fraction', 'yen', 'florin', 'section', 'currency', 'quotesingle', 'quotedblleft', 'guillemotleft', 'guilsinglleft', 'guilsinglright', 'fi', 'fl', 'endash', 'dagger', 'daggerdbl', 'periodcentered', 'paragraph', 'bullet', 'quotesinglbase', 'quotedblbase', 'quotedblright', 'guillemotright', 'ellipsis', 'perthousand', 'questiondown', 'grave', 'acute', 'circumflex', 'tilde', 'macron', 'breve', 'dotaccent', 'dieresis', 'ring', 'cedilla', 'hungarumlaut', 'ogonek', 'caron', 'emdash', 'AE', 'ordfeminine', 'Lslash', 'Oslash', 'OE', 'ordmasculine', 'ae', 'dotlessi', 'lslash', 'oslash', 'oe', 'germandbls', 'onesuperior', 'logicalnot', 'mu', 'trademark', 'Eth', 'onehalf', 'plusminus', 'Thorn', 'onequarter', 'divide', 'brokenbar', 'degree', 'thorn', 'threequarters', 'twosuperior', 'registered', 'minus', 'eth', 'multiply', 'threesuperior', 'copyright', 'Aacute', 'Acircumflex', 'Adieresis', 'Agrave', 'Aring', 'Atilde', 'Ccedilla', 'Eacute', 'Ecircumflex', 'Edieresis', 'Egrave', 'Iacute', 'Icircumflex', 'Idieresis', 'Igrave', 'Ntilde', 'Oacute', 'Ocircumflex', 'Odieresis', 'Ograve', 'Otilde', 'Scaron', 'Uacute', 'Ucircumflex', 'Udieresis', 'Ugrave', 'Yacute', 'Ydieresis', 'Zcaron', 'aacute', 'acircumflex', 'adieresis', 'agrave', 'aring', 'atilde', 'ccedilla', 'eacute', 'ecircumflex', 'edieresis', 'egrave', 'iacute', 'icircumflex', 'idieresis', 'igrave', 'ntilde', 'oacute', 'ocircumflex', 'odieresis', 'ograve', 'otilde', 'scaron', 'uacute', 'ucircumflex', 'udieresis', 'ugrave', 'yacute', 'ydieresis', 'zcaron']; var ExpertCharset = ['.notdef', 'space', 'exclamsmall', 'Hungarumlautsmall', 'dollaroldstyle', 'dollarsuperior', 'ampersandsmall', 'Acutesmall', 'parenleftsuperior', 'parenrightsuperior', 'twodotenleader', 'onedotenleader', 'comma', 'hyphen', 'period', 'fraction', 'zerooldstyle', 'oneoldstyle', 'twooldstyle', 'threeoldstyle', 'fouroldstyle', 'fiveoldstyle', 'sixoldstyle', 'sevenoldstyle', 'eightoldstyle', 'nineoldstyle', 'colon', 'semicolon', 'commasuperior', 'threequartersemdash', 'periodsuperior', 'questionsmall', 'asuperior', 'bsuperior', 'centsuperior', 'dsuperior', 'esuperior', 'isuperior', 'lsuperior', 'msuperior', 'nsuperior', 'osuperior', 'rsuperior', 'ssuperior', 'tsuperior', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'parenleftinferior', 'parenrightinferior', 'Circumflexsmall', 'hyphensuperior', 'Gravesmall', 'Asmall', 'Bsmall', 'Csmall', 'Dsmall', 'Esmall', 'Fsmall', 'Gsmall', 'Hsmall', 'Ismall', 'Jsmall', 'Ksmall', 'Lsmall', 'Msmall', 'Nsmall', 'Osmall', 'Psmall', 'Qsmall', 'Rsmall', 'Ssmall', 'Tsmall', 'Usmall', 'Vsmall', 'Wsmall', 'Xsmall', 'Ysmall', 'Zsmall', 'colonmonetary', 'onefitted', 'rupiah', 'Tildesmall', 'exclamdownsmall', 'centoldstyle', 'Lslashsmall', 'Scaronsmall', 'Zcaronsmall', 'Dieresissmall', 'Brevesmall', 'Caronsmall', 'Dotaccentsmall', 'Macronsmall', 'figuredash', 'hypheninferior', 'Ogoneksmall', 'Ringsmall', 'Cedillasmall', 'onequarter', 'onehalf', 'threequarters', 'questiondownsmall', 'oneeighth', 'threeeighths', 'fiveeighths', 'seveneighths', 'onethird', 'twothirds', 'zerosuperior', 'onesuperior', 'twosuperior', 'threesuperior', 'foursuperior', 'fivesuperior', 'sixsuperior', 'sevensuperior', 'eightsuperior', 'ninesuperior', 'zeroinferior', 'oneinferior', 'twoinferior', 'threeinferior', 'fourinferior', 'fiveinferior', 'sixinferior', 'seveninferior', 'eightinferior', 'nineinferior', 'centinferior', 'dollarinferior', 'periodinferior', 'commainferior', 'Agravesmall', 'Aacutesmall', 'Acircumflexsmall', 'Atildesmall', 'Adieresissmall', 'Aringsmall', 'AEsmall', 'Ccedillasmall', 'Egravesmall', 'Eacutesmall', 'Ecircumflexsmall', 'Edieresissmall', 'Igravesmall', 'Iacutesmall', 'Icircumflexsmall', 'Idieresissmall', 'Ethsmall', 'Ntildesmall', 'Ogravesmall', 'Oacutesmall', 'Ocircumflexsmall', 'Otildesmall', 'Odieresissmall', 'OEsmall', 'Oslashsmall', 'Ugravesmall', 'Uacutesmall', 'Ucircumflexsmall', 'Udieresissmall', 'Yacutesmall', 'Thornsmall', 'Ydieresissmall']; var ExpertSubsetCharset = ['.notdef', 'space', 'dollaroldstyle', 'dollarsuperior', 'parenleftsuperior', 'parenrightsuperior', 'twodotenleader', 'onedotenleader', 'comma', 'hyphen', 'period', 'fraction', 'zerooldstyle', 'oneoldstyle', 'twooldstyle', 'threeoldstyle', 'fouroldstyle', 'fiveoldstyle', 'sixoldstyle', 'sevenoldstyle', 'eightoldstyle', 'nineoldstyle', 'colon', 'semicolon', 'commasuperior', 'threequartersemdash', 'periodsuperior', 'asuperior', 'bsuperior', 'centsuperior', 'dsuperior', 'esuperior', 'isuperior', 'lsuperior', 'msuperior', 'nsuperior', 'osuperior', 'rsuperior', 'ssuperior', 'tsuperior', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'parenleftinferior', 'parenrightinferior', 'hyphensuperior', 'colonmonetary', 'onefitted', 'rupiah', 'centoldstyle', 'figuredash', 'hypheninferior', 'onequarter', 'onehalf', 'threequarters', 'oneeighth', 'threeeighths', 'fiveeighths', 'seveneighths', 'onethird', 'twothirds', 'zerosuperior', 'onesuperior', 'twosuperior', 'threesuperior', 'foursuperior', 'fivesuperior', 'sixsuperior', 'sevensuperior', 'eightsuperior', 'ninesuperior', 'zeroinferior', 'oneinferior', 'twoinferior', 'threeinferior', 'fourinferior', 'fiveinferior', 'sixinferior', 'seveninferior', 'eightinferior', 'nineinferior', 'centinferior', 'dollarinferior', 'periodinferior', 'commainferior']; exports.ISOAdobeCharset = ISOAdobeCharset; exports.ExpertCharset = ExpertCharset; exports.ExpertSubsetCharset = ExpertSubsetCharset; /***/ }), /* 22 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var sharedUtil = __w_pdfjs_require__(0); -var corePrimitives = __w_pdfjs_require__(1); -var coreStream = __w_pdfjs_require__(2); -var coreParser = __w_pdfjs_require__(5); -var Util = sharedUtil.Util; -var assert = sharedUtil.assert; -var warn = sharedUtil.warn; -var error = sharedUtil.error; -var isInt = sharedUtil.isInt; -var isString = sharedUtil.isString; -var MissingDataException = sharedUtil.MissingDataException; -var CMapCompressionType = sharedUtil.CMapCompressionType; -var isEOF = corePrimitives.isEOF; -var isName = corePrimitives.isName; -var isCmd = corePrimitives.isCmd; -var isStream = corePrimitives.isStream; -var Stream = coreStream.Stream; -var Lexer = coreParser.Lexer; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.CMapFactory = exports.IdentityCMap = exports.CMap = undefined; + +var _util = __w_pdfjs_require__(0); + +var _primitives = __w_pdfjs_require__(1); + +var _parser = __w_pdfjs_require__(5); + +var _stream = __w_pdfjs_require__(2); + var BUILT_IN_CMAPS = ['Adobe-GB1-UCS2', 'Adobe-CNS1-UCS2', 'Adobe-Japan1-UCS2', 'Adobe-Korea1-UCS2', '78-EUC-H', '78-EUC-V', '78-H', '78-RKSJ-H', '78-RKSJ-V', '78-V', '78ms-RKSJ-H', '78ms-RKSJ-V', '83pv-RKSJ-H', '90ms-RKSJ-H', '90ms-RKSJ-V', '90msp-RKSJ-H', '90msp-RKSJ-V', '90pv-RKSJ-H', '90pv-RKSJ-V', 'Add-H', 'Add-RKSJ-H', 'Add-RKSJ-V', 'Add-V', 'Adobe-CNS1-0', 'Adobe-CNS1-1', 'Adobe-CNS1-2', 'Adobe-CNS1-3', 'Adobe-CNS1-4', 'Adobe-CNS1-5', 'Adobe-CNS1-6', 'Adobe-GB1-0', 'Adobe-GB1-1', 'Adobe-GB1-2', 'Adobe-GB1-3', 'Adobe-GB1-4', 'Adobe-GB1-5', 'Adobe-Japan1-0', 'Adobe-Japan1-1', 'Adobe-Japan1-2', 'Adobe-Japan1-3', 'Adobe-Japan1-4', 'Adobe-Japan1-5', 'Adobe-Japan1-6', 'Adobe-Korea1-0', 'Adobe-Korea1-1', 'Adobe-Korea1-2', 'B5-H', 'B5-V', 'B5pc-H', 'B5pc-V', 'CNS-EUC-H', 'CNS-EUC-V', 'CNS1-H', 'CNS1-V', 'CNS2-H', 'CNS2-V', 'ETHK-B5-H', 'ETHK-B5-V', 'ETen-B5-H', 'ETen-B5-V', 'ETenms-B5-H', 'ETenms-B5-V', 'EUC-H', 'EUC-V', 'Ext-H', 'Ext-RKSJ-H', 'Ext-RKSJ-V', 'Ext-V', 'GB-EUC-H', 'GB-EUC-V', 'GB-H', 'GB-V', 'GBK-EUC-H', 'GBK-EUC-V', 'GBK2K-H', 'GBK2K-V', 'GBKp-EUC-H', 'GBKp-EUC-V', 'GBT-EUC-H', 'GBT-EUC-V', 'GBT-H', 'GBT-V', 'GBTpc-EUC-H', 'GBTpc-EUC-V', 'GBpc-EUC-H', 'GBpc-EUC-V', 'H', 'HKdla-B5-H', 'HKdla-B5-V', 'HKdlb-B5-H', 'HKdlb-B5-V', 'HKgccs-B5-H', 'HKgccs-B5-V', 'HKm314-B5-H', 'HKm314-B5-V', 'HKm471-B5-H', 'HKm471-B5-V', 'HKscs-B5-H', 'HKscs-B5-V', 'Hankaku', 'Hiragana', 'KSC-EUC-H', 'KSC-EUC-V', 'KSC-H', 'KSC-Johab-H', 'KSC-Johab-V', 'KSC-V', 'KSCms-UHC-H', 'KSCms-UHC-HW-H', 'KSCms-UHC-HW-V', 'KSCms-UHC-V', 'KSCpc-EUC-H', 'KSCpc-EUC-V', 'Katakana', 'NWP-H', 'NWP-V', 'RKSJ-H', 'RKSJ-V', 'Roman', 'UniCNS-UCS2-H', 'UniCNS-UCS2-V', 'UniCNS-UTF16-H', 'UniCNS-UTF16-V', 'UniCNS-UTF32-H', 'UniCNS-UTF32-V', 'UniCNS-UTF8-H', 'UniCNS-UTF8-V', 'UniGB-UCS2-H', 'UniGB-UCS2-V', 'UniGB-UTF16-H', 'UniGB-UTF16-V', 'UniGB-UTF32-H', 'UniGB-UTF32-V', 'UniGB-UTF8-H', 'UniGB-UTF8-V', 'UniJIS-UCS2-H', 'UniJIS-UCS2-HW-H', 'UniJIS-UCS2-HW-V', 'UniJIS-UCS2-V', 'UniJIS-UTF16-H', 'UniJIS-UTF16-V', 'UniJIS-UTF32-H', 'UniJIS-UTF32-V', 'UniJIS-UTF8-H', 'UniJIS-UTF8-V', 'UniJIS2004-UTF16-H', 'UniJIS2004-UTF16-V', 'UniJIS2004-UTF32-H', 'UniJIS2004-UTF32-V', 'UniJIS2004-UTF8-H', 'UniJIS2004-UTF8-V', 'UniJISPro-UCS2-HW-V', 'UniJISPro-UCS2-V', 'UniJISPro-UTF8-V', 'UniJISX0213-UTF32-H', 'UniJISX0213-UTF32-V', 'UniJISX02132004-UTF32-H', 'UniJISX02132004-UTF32-V', 'UniKS-UCS2-H', 'UniKS-UCS2-V', 'UniKS-UTF16-H', 'UniKS-UTF16-V', 'UniKS-UTF32-H', 'UniKS-UTF32-V', 'UniKS-UTF8-H', 'UniKS-UTF8-V', 'V', 'WP-Symbol']; var CMap = function CMapClosure() { function CMap(builtInCMap) { this.codespaceRanges = [[], [], [], []]; this.numCodespaceRanges = 0; this._map = []; this.name = ''; this.vertical = false; @@ -25135,58 +25027,58 @@ var CMap = function CMapClosure() { return CMap; }(); var IdentityCMap = function IdentityCMapClosure() { function IdentityCMap(vertical, n) { CMap.call(this); this.vertical = vertical; this.addCodespaceRange(n, 0, 0xffff); } - Util.inherit(IdentityCMap, CMap, {}); + _util.Util.inherit(IdentityCMap, CMap, {}); IdentityCMap.prototype = { addCodespaceRange: CMap.prototype.addCodespaceRange, mapCidRange(low, high, dstLow) { - error('should not call mapCidRange'); + (0, _util.error)('should not call mapCidRange'); }, mapBfRange(low, high, dstLow) { - error('should not call mapBfRange'); + (0, _util.error)('should not call mapBfRange'); }, mapBfRangeToArray(low, high, array) { - error('should not call mapBfRangeToArray'); + (0, _util.error)('should not call mapBfRangeToArray'); }, mapOne(src, dst) { - error('should not call mapCidOne'); + (0, _util.error)('should not call mapCidOne'); }, lookup(code) { - return isInt(code) && code <= 0xffff ? code : undefined; + return (0, _util.isInt)(code) && code <= 0xffff ? code : undefined; }, contains(code) { - return isInt(code) && code <= 0xffff; + return (0, _util.isInt)(code) && code <= 0xffff; }, forEach(callback) { for (var i = 0; i <= 0xffff; i++) { callback(i, i); } }, charCodeOf(value) { - return isInt(value) && value <= 0xffff ? value : -1; + return (0, _util.isInt)(value) && value <= 0xffff ? value : -1; }, getMap() { var map = new Array(0x10000); for (var i = 0; i <= 0xffff; i++) { map[i] = i; } return map; }, readCharCode: CMap.prototype.readCharCode, get length() { return 0x10000; }, get isIdentityCMap() { - error('should not access .isIdentityCMap'); + (0, _util.error)('should not access .isIdentityCMap'); } }; return IdentityCMap; }(); var BinaryCMapReader = function BinaryCMapReaderClosure() { function hexToInt(a, size) { var n = 0; for (var i = 0; i <= size; i++) { @@ -25235,17 +25127,17 @@ var BinaryCMapReader = function BinaryCM return this.buffer[this.pos++]; }, readNumber() { var n = 0; var last; do { var b = this.readByte(); if (b < 0) { - error('unexpected EOF in bcmap'); + (0, _util.error)('unexpected EOF in bcmap'); } last = !(b & 0x80); n = n << 7 | b & 0x7F; } while (!last); return n; }, readSigned() { var n = this.readNumber(); @@ -25257,17 +25149,17 @@ var BinaryCMapReader = function BinaryCM }, readHexNumber(num, size) { var last; var stack = this.tmpBuf, sp = 0; do { var b = this.readByte(); if (b < 0) { - error('unexpected EOF in bcmap'); + (0, _util.error)('unexpected EOF in bcmap'); } last = !(b & 0x80); stack[sp++] = b & 0x7F; } while (!last); var i = size, buffer = 0, bufferSize = 0; while (i >= 0) { @@ -25322,17 +25214,17 @@ var BinaryCMapReader = function BinaryCM case 1: useCMap = stream.readString(); break; } continue; } var sequence = !!(b & 0x10); var dataSize = b & 15; - assert(dataSize + 1 <= MAX_NUM_SIZE); + (0, _util.assert)(dataSize + 1 <= MAX_NUM_SIZE); var ucs2DataSize = 1; var subitemsCount = stream.readNumber(); var i; switch (type) { case 0: stream.readHex(start, dataSize); stream.readHexNumber(end, dataSize); addHex(end, start, dataSize); @@ -25450,166 +25342,166 @@ var CMapFactory = function CMapFactoryCl function strToInt(str) { var a = 0; for (var i = 0; i < str.length; i++) { a = a << 8 | str.charCodeAt(i); } return a >>> 0; } function expectString(obj) { - if (!isString(obj)) { - error('Malformed CMap: expected string.'); + if (!(0, _util.isString)(obj)) { + (0, _util.error)('Malformed CMap: expected string.'); } } function expectInt(obj) { - if (!isInt(obj)) { - error('Malformed CMap: expected int.'); + if (!(0, _util.isInt)(obj)) { + (0, _util.error)('Malformed CMap: expected int.'); } } function parseBfChar(cMap, lexer) { while (true) { var obj = lexer.getObj(); - if (isEOF(obj)) { - break; - } - if (isCmd(obj, 'endbfchar')) { + if ((0, _primitives.isEOF)(obj)) { + break; + } + if ((0, _primitives.isCmd)(obj, 'endbfchar')) { return; } expectString(obj); var src = strToInt(obj); obj = lexer.getObj(); expectString(obj); var dst = obj; cMap.mapOne(src, dst); } } function parseBfRange(cMap, lexer) { while (true) { var obj = lexer.getObj(); - if (isEOF(obj)) { - break; - } - if (isCmd(obj, 'endbfrange')) { + if ((0, _primitives.isEOF)(obj)) { + break; + } + if ((0, _primitives.isCmd)(obj, 'endbfrange')) { return; } expectString(obj); var low = strToInt(obj); obj = lexer.getObj(); expectString(obj); var high = strToInt(obj); obj = lexer.getObj(); - if (isInt(obj) || isString(obj)) { - var dstLow = isInt(obj) ? String.fromCharCode(obj) : obj; + if ((0, _util.isInt)(obj) || (0, _util.isString)(obj)) { + var dstLow = (0, _util.isInt)(obj) ? String.fromCharCode(obj) : obj; cMap.mapBfRange(low, high, dstLow); - } else if (isCmd(obj, '[')) { + } else if ((0, _primitives.isCmd)(obj, '[')) { obj = lexer.getObj(); var array = []; - while (!isCmd(obj, ']') && !isEOF(obj)) { + while (!(0, _primitives.isCmd)(obj, ']') && !(0, _primitives.isEOF)(obj)) { array.push(obj); obj = lexer.getObj(); } cMap.mapBfRangeToArray(low, high, array); } else { break; } } - error('Invalid bf range.'); + (0, _util.error)('Invalid bf range.'); } function parseCidChar(cMap, lexer) { while (true) { var obj = lexer.getObj(); - if (isEOF(obj)) { - break; - } - if (isCmd(obj, 'endcidchar')) { + if ((0, _primitives.isEOF)(obj)) { + break; + } + if ((0, _primitives.isCmd)(obj, 'endcidchar')) { return; } expectString(obj); var src = strToInt(obj); obj = lexer.getObj(); expectInt(obj); var dst = obj; cMap.mapOne(src, dst); } } function parseCidRange(cMap, lexer) { while (true) { var obj = lexer.getObj(); - if (isEOF(obj)) { - break; - } - if (isCmd(obj, 'endcidrange')) { + if ((0, _primitives.isEOF)(obj)) { + break; + } + if ((0, _primitives.isCmd)(obj, 'endcidrange')) { return; } expectString(obj); var low = strToInt(obj); obj = lexer.getObj(); expectString(obj); var high = strToInt(obj); obj = lexer.getObj(); expectInt(obj); var dstLow = obj; cMap.mapCidRange(low, high, dstLow); } } function parseCodespaceRange(cMap, lexer) { while (true) { var obj = lexer.getObj(); - if (isEOF(obj)) { - break; - } - if (isCmd(obj, 'endcodespacerange')) { - return; - } - if (!isString(obj)) { + if ((0, _primitives.isEOF)(obj)) { + break; + } + if ((0, _primitives.isCmd)(obj, 'endcodespacerange')) { + return; + } + if (!(0, _util.isString)(obj)) { break; } var low = strToInt(obj); obj = lexer.getObj(); - if (!isString(obj)) { + if (!(0, _util.isString)(obj)) { break; } var high = strToInt(obj); cMap.addCodespaceRange(obj.length, low, high); } - error('Invalid codespace range.'); + (0, _util.error)('Invalid codespace range.'); } function parseWMode(cMap, lexer) { var obj = lexer.getObj(); - if (isInt(obj)) { + if ((0, _util.isInt)(obj)) { cMap.vertical = !!obj; } } function parseCMapName(cMap, lexer) { var obj = lexer.getObj(); - if (isName(obj) && isString(obj.name)) { + if ((0, _primitives.isName)(obj) && (0, _util.isString)(obj.name)) { cMap.name = obj.name; } } function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) { var previous; var embededUseCMap; objLoop: while (true) { try { var obj = lexer.getObj(); - if (isEOF(obj)) { - break; - } else if (isName(obj)) { + if ((0, _primitives.isEOF)(obj)) { + break; + } else if ((0, _primitives.isName)(obj)) { if (obj.name === 'WMode') { parseWMode(cMap, lexer); } else if (obj.name === 'CMapName') { parseCMapName(cMap, lexer); } previous = obj; - } else if (isCmd(obj)) { + } else if ((0, _primitives.isCmd)(obj)) { switch (obj.cmd) { case 'endcmap': break objLoop; case 'usecmap': - if (isName(previous)) { + if ((0, _primitives.isName)(previous)) { embededUseCMap = previous.name; } break; case 'begincodespacerange': parseCodespaceRange(cMap, lexer); break; case 'beginbfchar': parseBfChar(cMap, lexer); @@ -25621,20 +25513,20 @@ var CMapFactory = function CMapFactoryCl parseBfRange(cMap, lexer); break; case 'begincidrange': parseCidRange(cMap, lexer); break; } } } catch (ex) { - if (ex instanceof MissingDataException) { + if (ex instanceof _util.MissingDataException) { throw ex; } - warn('Invalid cMap data: ' + ex); + (0, _util.warn)('Invalid cMap data: ' + ex); continue; } } if (!useCMap && embededUseCMap) { useCMap = embededUseCMap; } if (useCMap) { return extendCMap(cMap, fetchBuiltInCMap, useCMap); @@ -25663,101 +25555,84 @@ var CMapFactory = function CMapFactoryCl if (name === 'Identity-H') { return Promise.resolve(new IdentityCMap(false, 2)); } else if (name === 'Identity-V') { return Promise.resolve(new IdentityCMap(true, 2)); } if (BUILT_IN_CMAPS.indexOf(name) === -1) { return Promise.reject(new Error('Unknown CMap name: ' + name)); } - assert(fetchBuiltInCMap, 'Built-in CMap parameters are not provided.'); + (0, _util.assert)(fetchBuiltInCMap, 'Built-in CMap parameters are not provided.'); return fetchBuiltInCMap(name).then(function (data) { var cMapData = data.cMapData, compressionType = data.compressionType; var cMap = new CMap(true); - if (compressionType === CMapCompressionType.BINARY) { + if (compressionType === _util.CMapCompressionType.BINARY) { return new BinaryCMapReader().process(cMapData, cMap, function (useCMap) { return extendCMap(cMap, fetchBuiltInCMap, useCMap); }); } - assert(compressionType === CMapCompressionType.NONE, 'TODO: Only BINARY/NONE CMap compression is currently supported.'); - var lexer = new Lexer(new Stream(cMapData)); + (0, _util.assert)(compressionType === _util.CMapCompressionType.NONE, 'TODO: Only BINARY/NONE CMap compression is currently supported.'); + var lexer = new _parser.Lexer(new _stream.Stream(cMapData)); return parseCMap(cMap, lexer, fetchBuiltInCMap, null); }); } return { create(params) { var encoding = params.encoding; var fetchBuiltInCMap = params.fetchBuiltInCMap; var useCMap = params.useCMap; - if (isName(encoding)) { + if ((0, _primitives.isName)(encoding)) { return createBuiltInCMap(encoding.name, fetchBuiltInCMap); - } else if (isStream(encoding)) { + } else if ((0, _primitives.isStream)(encoding)) { var cMap = new CMap(); - var lexer = new Lexer(encoding); + var lexer = new _parser.Lexer(encoding); return parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap).then(function (parsedCMap) { if (parsedCMap.isIdentityCMap) { return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap); } return parsedCMap; }); } return Promise.reject(new Error('Encoding required.')); } }; }(); exports.CMap = CMap; +exports.IdentityCMap = IdentityCMap; exports.CMapFactory = CMapFactory; -exports.IdentityCMap = IdentityCMap; /***/ }), /* 23 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; -var sharedUtil = __w_pdfjs_require__(0); -var corePrimitives = __w_pdfjs_require__(1); -var coreStream = __w_pdfjs_require__(2); -var coreObj = __w_pdfjs_require__(15); -var coreParser = __w_pdfjs_require__(5); -var coreCrypto = __w_pdfjs_require__(12); -var coreEvaluator = __w_pdfjs_require__(13); -var coreAnnotation = __w_pdfjs_require__(19); -var OPS = sharedUtil.OPS; -var MissingDataException = sharedUtil.MissingDataException; -var Util = sharedUtil.Util; -var assert = sharedUtil.assert; -var error = sharedUtil.error; -var info = sharedUtil.info; -var isArray = sharedUtil.isArray; -var isArrayBuffer = sharedUtil.isArrayBuffer; -var isNum = sharedUtil.isNum; -var isString = sharedUtil.isString; -var shadow = sharedUtil.shadow; -var stringToBytes = sharedUtil.stringToBytes; -var stringToPDFString = sharedUtil.stringToPDFString; -var warn = sharedUtil.warn; -var isSpace = sharedUtil.isSpace; -var Dict = corePrimitives.Dict; -var isDict = corePrimitives.isDict; -var isName = corePrimitives.isName; -var isStream = corePrimitives.isStream; -var NullStream = coreStream.NullStream; -var Stream = coreStream.Stream; -var StreamsSequenceStream = coreStream.StreamsSequenceStream; -var Catalog = coreObj.Catalog; -var ObjectLoader = coreObj.ObjectLoader; -var XRef = coreObj.XRef; -var Linearization = coreParser.Linearization; -var calculateMD5 = coreCrypto.calculateMD5; -var OperatorList = coreEvaluator.OperatorList; -var PartialEvaluator = coreEvaluator.PartialEvaluator; -var AnnotationFactory = coreAnnotation.AnnotationFactory; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.PDFDocument = exports.Page = undefined; + +var _util = __w_pdfjs_require__(0); + +var _obj = __w_pdfjs_require__(15); + +var _primitives = __w_pdfjs_require__(1); + +var _stream = __w_pdfjs_require__(2); + +var _evaluator = __w_pdfjs_require__(13); + +var _annotation = __w_pdfjs_require__(19); + +var _crypto = __w_pdfjs_require__(12); + +var _parser = __w_pdfjs_require__(5); + var Page = function PageClosure() { var DEFAULT_USER_UNIT = 1.0; var LETTER_SIZE_MEDIABOX = [0, 0, 612, 792]; function isAnnotationRenderable(annotation, intent) { return intent === 'display' && annotation.viewable || intent === 'print' && annotation.printable; } function Page(pdfManager, xref, pageIndex, pageDict, ref, fontCache, builtInCMapCache) { this.pdfManager = pdfManager; @@ -25791,120 +25666,120 @@ var Page = function PageClosure() { var value = getArray ? dict.getArray(key) : dict.get(key); if (value !== undefined) { if (!valueArray) { valueArray = []; } valueArray.push(value); } if (++loopCount > MAX_LOOP_COUNT) { - warn('getInheritedPageProp: maximum loop count exceeded for ' + key); + (0, _util.warn)('getInheritedPageProp: maximum loop count exceeded for ' + key); return valueArray ? valueArray[0] : undefined; } dict = dict.get('Parent'); } if (!valueArray) { return undefined; } - if (valueArray.length === 1 || !isDict(valueArray[0])) { + if (valueArray.length === 1 || !(0, _primitives.isDict)(valueArray[0])) { return valueArray[0]; } - return Dict.merge(this.xref, valueArray); + return _primitives.Dict.merge(this.xref, valueArray); }, get content() { return this.getPageProp('Contents'); }, get resources() { - return shadow(this, 'resources', this.getInheritedPageProp('Resources') || Dict.empty); + return (0, _util.shadow)(this, 'resources', this.getInheritedPageProp('Resources') || _primitives.Dict.empty); }, get mediaBox() { var mediaBox = this.getInheritedPageProp('MediaBox', true); - if (!isArray(mediaBox) || mediaBox.length !== 4) { - return shadow(this, 'mediaBox', LETTER_SIZE_MEDIABOX); - } - return shadow(this, 'mediaBox', mediaBox); + if (!(0, _util.isArray)(mediaBox) || mediaBox.length !== 4) { + return (0, _util.shadow)(this, 'mediaBox', LETTER_SIZE_MEDIABOX); + } + return (0, _util.shadow)(this, 'mediaBox', mediaBox); }, get cropBox() { var cropBox = this.getInheritedPageProp('CropBox', true); - if (!isArray(cropBox) || cropBox.length !== 4) { - return shadow(this, 'cropBox', this.mediaBox); - } - return shadow(this, 'cropBox', cropBox); + if (!(0, _util.isArray)(cropBox) || cropBox.length !== 4) { + return (0, _util.shadow)(this, 'cropBox', this.mediaBox); + } + return (0, _util.shadow)(this, 'cropBox', cropBox); }, get userUnit() { var obj = this.getPageProp('UserUnit'); - if (!isNum(obj) || obj <= 0) { + if (!(0, _util.isNum)(obj) || obj <= 0) { obj = DEFAULT_USER_UNIT; } - return shadow(this, 'userUnit', obj); + return (0, _util.shadow)(this, 'userUnit', obj); }, get view() { var mediaBox = this.mediaBox, cropBox = this.cropBox; if (mediaBox === cropBox) { - return shadow(this, 'view', mediaBox); - } - var intersection = Util.intersect(cropBox, mediaBox); - return shadow(this, 'view', intersection || mediaBox); + return (0, _util.shadow)(this, 'view', mediaBox); + } + var intersection = _util.Util.intersect(cropBox, mediaBox); + return (0, _util.shadow)(this, 'view', intersection || mediaBox); }, get rotate() { var rotate = this.getInheritedPageProp('Rotate') || 0; if (rotate % 90 !== 0) { rotate = 0; } else if (rotate >= 360) { rotate = rotate % 360; } else if (rotate < 0) { rotate = (rotate % 360 + 360) % 360; } - return shadow(this, 'rotate', rotate); + return (0, _util.shadow)(this, 'rotate', rotate); }, getContentStream: function Page_getContentStream() { var content = this.content; var stream; - if (isArray(content)) { + if ((0, _util.isArray)(content)) { var xref = this.xref; var i, n = content.length; var streams = []; for (i = 0; i < n; ++i) { streams.push(xref.fetchIfRef(content[i])); } - stream = new StreamsSequenceStream(streams); - } else if (isStream(content)) { + stream = new _stream.StreamsSequenceStream(streams); + } else if ((0, _primitives.isStream)(content)) { stream = content; } else { - stream = new NullStream(); + stream = new _stream.NullStream(); } return stream; }, loadResources: function Page_loadResources(keys) { if (!this.resourcesPromise) { this.resourcesPromise = this.pdfManager.ensure(this, 'resources'); } return this.resourcesPromise.then(() => { - var objectLoader = new ObjectLoader(this.resources.map, keys, this.xref); + var objectLoader = new _obj.ObjectLoader(this.resources.map, keys, this.xref); return objectLoader.load(); }); }, getOperatorList({ handler, task, intent, renderInteractiveForms }) { var contentStreamPromise = this.pdfManager.ensure(this, 'getContentStream'); var resourcesPromise = this.loadResources(['ExtGState', 'ColorSpace', 'Pattern', 'Shading', 'XObject', 'Font']); - var partialEvaluator = new PartialEvaluator({ + var partialEvaluator = new _evaluator.PartialEvaluator({ pdfManager: this.pdfManager, xref: this.xref, handler, pageIndex: this.pageIndex, idFactory: this.idFactory, fontCache: this.fontCache, builtInCMapCache: this.builtInCMapCache, options: this.evaluatorOptions }); var dataPromises = Promise.all([contentStreamPromise, resourcesPromise]); var pageListPromise = dataPromises.then(([contentStream]) => { - var opList = new OperatorList(intent, handler, this.pageIndex); + var opList = new _evaluator.OperatorList(intent, handler, this.pageIndex); handler.send('StartRenderPage', { transparency: partialEvaluator.hasBlendModes(this.resources), pageIndex: this.pageIndex, intent }); return partialEvaluator.getOperatorList({ stream: contentStream, task, @@ -25924,32 +25799,32 @@ var Page = function PageClosure() { ii, opListPromises = []; for (i = 0, ii = annotations.length; i < ii; i++) { if (isAnnotationRenderable(annotations[i], intent)) { opListPromises.push(annotations[i].getOperatorList(partialEvaluator, task, renderInteractiveForms)); } } return Promise.all(opListPromises).then(function (opLists) { - pageOpList.addOp(OPS.beginAnnotations, []); + pageOpList.addOp(_util.OPS.beginAnnotations, []); for (i = 0, ii = opLists.length; i < ii; i++) { pageOpList.addOpList(opLists[i]); } - pageOpList.addOp(OPS.endAnnotations, []); + pageOpList.addOp(_util.OPS.endAnnotations, []); pageOpList.flush(true); return pageOpList; }); }); }, extractTextContent({ handler, task, normalizeWhitespace, combineTextItems }) { var contentStreamPromise = this.pdfManager.ensure(this, 'getContentStream'); var resourcesPromise = this.loadResources(['ExtGState', 'XObject', 'Font']); var dataPromises = Promise.all([contentStreamPromise, resourcesPromise]); return dataPromises.then(([contentStream]) => { - var partialEvaluator = new PartialEvaluator({ + var partialEvaluator = new _evaluator.PartialEvaluator({ pdfManager: this.pdfManager, xref: this.xref, handler, pageIndex: this.pageIndex, idFactory: this.idFactory, fontCache: this.fontCache, builtInCMapCache: this.builtInCMapCache, options: this.evaluatorOptions @@ -25971,45 +25846,45 @@ var Page = function PageClosure() { annotationsData.push(annotations[i].data); } } return annotationsData; }, get annotations() { var annotations = []; var annotationRefs = this.getInheritedPageProp('Annots') || []; - var annotationFactory = new AnnotationFactory(); + var annotationFactory = new _annotation.AnnotationFactory(); for (var i = 0, n = annotationRefs.length; i < n; ++i) { var annotationRef = annotationRefs[i]; var annotation = annotationFactory.create(this.xref, annotationRef, this.pdfManager, this.idFactory); if (annotation) { annotations.push(annotation); } } - return shadow(this, 'annotations', annotations); + return (0, _util.shadow)(this, 'annotations', annotations); } }; return Page; }(); var PDFDocument = function PDFDocumentClosure() { var FINGERPRINT_FIRST_BYTES = 1024; var EMPTY_FINGERPRINT = '\x00\x00\x00\x00\x00\x00\x00' + '\x00\x00\x00\x00\x00\x00\x00\x00\x00'; function PDFDocument(pdfManager, arg) { var stream; - if (isStream(arg)) { + if ((0, _primitives.isStream)(arg)) { stream = arg; - } else if (isArrayBuffer(arg)) { - stream = new Stream(arg); - } else { - error('PDFDocument: Unknown argument type'); - } - assert(stream.length > 0, 'stream must have data'); + } else if ((0, _util.isArrayBuffer)(arg)) { + stream = new _stream.Stream(arg); + } else { + (0, _util.error)('PDFDocument: Unknown argument type'); + } + (0, _util.assert)(stream.length > 0, 'stream must have data'); this.pdfManager = pdfManager; this.stream = stream; - this.xref = new XRef(stream, pdfManager); + this.xref = new _obj.XRef(stream, pdfManager); } function find(stream, needle, limit, backwards) { var pos = stream.pos; var end = stream.end; var strBuf = []; if (pos + limit > end) { limit = end - pos; } @@ -26022,66 +25897,66 @@ var PDFDocument = function PDFDocumentCl if (index === -1) { return false; } stream.pos += index; return true; } var DocumentInfoValidators = { get entries() { - return shadow(this, 'entries', { - Title: isString, - Author: isString, - Subject: isString, - Keywords: isString, - Creator: isString, - Producer: isString, - CreationDate: isString, - ModDate: isString, - Trapped: isName + return (0, _util.shadow)(this, 'entries', { + Title: _util.isString, + Author: _util.isString, + Subject: _util.isString, + Keywords: _util.isString, + Creator: _util.isString, + Producer: _util.isString, + CreationDate: _util.isString, + ModDate: _util.isString, + Trapped: _primitives.isName }); } }; PDFDocument.prototype = { parse: function PDFDocument_parse(recoveryMode) { this.setup(recoveryMode); var version = this.catalog.catDict.get('Version'); - if (isName(version)) { + if ((0, _primitives.isName)(version)) { this.pdfFormatVersion = version.name; } try { this.acroForm = this.catalog.catDict.get('AcroForm'); if (this.acroForm) { this.xfa = this.acroForm.get('XFA'); var fields = this.acroForm.get('Fields'); - if ((!fields || !isArray(fields) || fields.length === 0) && !this.xfa) { + if ((!fields || !(0, _util.isArray)(fields) || fields.length === 0) && !this.xfa) { this.acroForm = null; } } } catch (ex) { - if (ex instanceof MissingDataException) { + if (ex instanceof _util.MissingDataException) { throw ex; } - info('Something wrong with AcroForm entry'); + (0, _util.info)('Something wrong with AcroForm entry'); this.acroForm = null; } }, get linearization() { var linearization = null; if (this.stream.length) { try { - linearization = Linearization.create(this.stream); + linearization = _parser.Linearization.create(this.stream); } catch (err) { - if (err instanceof MissingDataException) { + if (err instanceof _util.MissingDataException) { throw err; } - info(err); - } - } - return shadow(this