pdfjs-dist 2.0.487 → 2.1.266

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pdfjs-dist might be problematic. Click here for more details.

Files changed (161) hide show
  1. package/bower.json +1 -1
  2. package/build/pdf.js +15564 -9476
  3. package/build/pdf.js.map +1 -1
  4. package/build/pdf.min.js +1 -1
  5. package/build/pdf.worker.js +46644 -36309
  6. package/build/pdf.worker.js.map +1 -1
  7. package/build/pdf.worker.min.js +1 -1
  8. package/external/url/url-lib.js +627 -0
  9. package/image_decoders/pdf.image_decoders.js +11430 -0
  10. package/image_decoders/pdf.image_decoders.js.map +1 -0
  11. package/image_decoders/pdf.image_decoders.min.js +1 -0
  12. package/lib/core/annotation.js +406 -131
  13. package/lib/core/arithmetic_decoder.js +275 -245
  14. package/lib/core/bidi.js +65 -6
  15. package/lib/core/ccitt.js +173 -18
  16. package/lib/core/ccitt_stream.js +15 -6
  17. package/lib/core/cff_parser.js +376 -53
  18. package/lib/core/charsets.js +5 -4
  19. package/lib/core/chunked_stream.js +387 -149
  20. package/lib/core/cmap.js +310 -75
  21. package/lib/core/colorspace.js +874 -594
  22. package/lib/core/crypto.js +290 -45
  23. package/lib/core/document.js +545 -260
  24. package/lib/core/encodings.js +19 -10
  25. package/lib/core/evaluator.js +725 -147
  26. package/lib/core/font_renderer.js +360 -91
  27. package/lib/core/fonts.js +791 -186
  28. package/lib/core/function.js +284 -71
  29. package/lib/core/glyphlist.js +3 -2
  30. package/lib/core/image.js +168 -61
  31. package/lib/core/jbig2.js +479 -66
  32. package/lib/core/jbig2_stream.js +19 -8
  33. package/lib/core/jpeg_stream.js +38 -13
  34. package/lib/core/jpg.js +252 -29
  35. package/lib/core/jpx.js +396 -6
  36. package/lib/core/jpx_stream.js +18 -6
  37. package/lib/core/metrics.js +4 -4
  38. package/lib/core/murmurhash3.js +24 -6
  39. package/lib/core/obj.js +1137 -475
  40. package/lib/core/operator_list.js +108 -6
  41. package/lib/core/parser.js +321 -68
  42. package/lib/core/pattern.js +145 -13
  43. package/lib/core/pdf_manager.js +321 -133
  44. package/lib/core/primitives.js +75 -22
  45. package/lib/core/ps_parser.js +134 -45
  46. package/lib/core/standard_fonts.js +10 -10
  47. package/lib/core/stream.js +313 -34
  48. package/lib/core/type1_parser.js +143 -13
  49. package/lib/core/unicode.js +31 -4
  50. package/lib/core/worker.js +210 -66
  51. package/lib/display/annotation_layer.js +361 -123
  52. package/lib/display/api.js +1454 -729
  53. package/lib/display/api_compatibility.js +11 -13
  54. package/lib/display/canvas.js +324 -29
  55. package/lib/display/content_disposition.js +83 -32
  56. package/lib/display/dom_utils.js +226 -41
  57. package/lib/display/fetch_stream.js +208 -84
  58. package/lib/display/font_loader.js +465 -236
  59. package/lib/display/metadata.js +38 -16
  60. package/lib/display/network.js +216 -51
  61. package/lib/display/network_utils.js +32 -19
  62. package/lib/display/node_stream.js +352 -169
  63. package/lib/display/pattern_helper.js +58 -7
  64. package/lib/display/svg.js +242 -29
  65. package/lib/display/text_layer.js +132 -18
  66. package/lib/display/transport_stream.js +171 -42
  67. package/lib/display/webgl.js +64 -18
  68. package/lib/display/worker_options.js +5 -4
  69. package/lib/display/xml_parser.js +166 -53
  70. package/lib/examples/node/domstubs.js +57 -4
  71. package/lib/pdf.js +21 -4
  72. package/lib/pdf.worker.js +5 -3
  73. package/lib/shared/compatibility.js +158 -564
  74. package/lib/shared/global_scope.js +2 -2
  75. package/lib/shared/is_node.js +4 -4
  76. package/lib/shared/message_handler.js +521 -0
  77. package/lib/shared/streams_polyfill.js +21 -17
  78. package/lib/shared/url_polyfill.js +56 -0
  79. package/lib/shared/util.js +295 -650
  80. package/lib/test/unit/annotation_spec.js +629 -345
  81. package/lib/test/unit/api_spec.js +555 -253
  82. package/lib/test/unit/bidi_spec.js +7 -7
  83. package/lib/test/unit/cff_parser_spec.js +40 -11
  84. package/lib/test/unit/clitests_helper.js +9 -7
  85. package/lib/test/unit/cmap_spec.js +80 -26
  86. package/lib/test/unit/colorspace_spec.js +99 -52
  87. package/lib/test/unit/crypto_spec.js +17 -5
  88. package/lib/test/unit/custom_spec.js +41 -53
  89. package/lib/test/unit/display_svg_spec.js +33 -17
  90. package/lib/test/unit/document_spec.js +3 -3
  91. package/lib/test/unit/dom_utils_spec.js +9 -9
  92. package/lib/test/unit/encodings_spec.js +25 -45
  93. package/lib/test/unit/evaluator_spec.js +34 -9
  94. package/lib/test/unit/function_spec.js +17 -5
  95. package/lib/test/unit/jasmine-boot.js +31 -18
  96. package/lib/test/unit/{util_stream_spec.js → message_handler_spec.js} +41 -69
  97. package/lib/test/unit/metadata_spec.js +71 -11
  98. package/lib/test/unit/murmurhash3_spec.js +3 -3
  99. package/lib/test/unit/network_spec.js +20 -5
  100. package/lib/test/unit/network_utils_spec.js +41 -14
  101. package/lib/test/unit/node_stream_spec.js +51 -27
  102. package/lib/test/unit/parser_spec.js +35 -8
  103. package/lib/test/unit/pdf_find_controller_spec.js +230 -0
  104. package/lib/test/unit/pdf_find_utils_spec.js +63 -0
  105. package/lib/test/unit/pdf_history_spec.js +21 -9
  106. package/lib/test/unit/primitives_spec.js +24 -4
  107. package/lib/test/unit/stream_spec.js +12 -4
  108. package/lib/test/unit/test_utils.js +90 -27
  109. package/lib/test/unit/testreporter.js +21 -3
  110. package/lib/test/unit/type1_parser_spec.js +8 -6
  111. package/lib/test/unit/ui_utils_spec.js +452 -14
  112. package/lib/test/unit/unicode_spec.js +14 -11
  113. package/lib/test/unit/util_spec.js +131 -9
  114. package/lib/web/annotation_layer_builder.js +39 -22
  115. package/lib/web/app.js +1240 -582
  116. package/lib/web/app_options.js +71 -41
  117. package/lib/web/base_viewer.js +508 -179
  118. package/lib/web/chromecom.js +261 -117
  119. package/lib/web/debugger.js +166 -22
  120. package/lib/web/download_manager.js +31 -13
  121. package/lib/web/firefox_print_service.js +17 -9
  122. package/lib/web/firefoxcom.js +283 -79
  123. package/lib/web/genericcom.js +89 -30
  124. package/lib/web/genericl10n.js +142 -30
  125. package/lib/web/grab_to_pan.js +26 -4
  126. package/lib/web/interfaces.js +170 -47
  127. package/lib/web/overlay_manager.js +235 -85
  128. package/lib/web/password_prompt.js +21 -13
  129. package/lib/web/pdf_attachment_viewer.js +38 -18
  130. package/lib/web/pdf_cursor_tools.js +39 -16
  131. package/lib/web/pdf_document_properties.js +80 -30
  132. package/lib/web/pdf_find_bar.js +84 -40
  133. package/lib/web/pdf_find_controller.js +495 -184
  134. package/lib/web/pdf_find_utils.js +111 -0
  135. package/lib/web/pdf_history.js +190 -53
  136. package/lib/web/pdf_link_service.js +137 -76
  137. package/lib/web/pdf_outline_viewer.js +73 -22
  138. package/lib/web/pdf_page_view.js +196 -63
  139. package/lib/web/pdf_presentation_mode.js +99 -34
  140. package/lib/web/pdf_print_service.js +57 -11
  141. package/lib/web/pdf_rendering_queue.js +27 -5
  142. package/lib/web/pdf_sidebar.js +120 -67
  143. package/lib/web/pdf_sidebar_resizer.js +42 -16
  144. package/lib/web/pdf_single_page_viewer.js +74 -66
  145. package/lib/web/pdf_thumbnail_view.js +103 -32
  146. package/lib/web/pdf_thumbnail_viewer.js +64 -24
  147. package/lib/web/pdf_viewer.component.js +112 -32
  148. package/lib/web/pdf_viewer.js +91 -52
  149. package/lib/web/preferences.js +275 -80
  150. package/lib/web/secondary_toolbar.js +165 -40
  151. package/lib/web/text_layer_builder.js +162 -65
  152. package/lib/web/toolbar.js +78 -43
  153. package/lib/web/ui_utils.js +462 -136
  154. package/lib/web/view_history.js +215 -67
  155. package/lib/web/viewer_compatibility.js +4 -13
  156. package/package.json +5 -4
  157. package/web/pdf_viewer.css +58 -1
  158. package/web/pdf_viewer.js +6346 -3919
  159. package/web/pdf_viewer.js.map +1 -1
  160. package/lib/test/unit/fonts_spec.js +0 -81
  161. package/lib/web/dom_events.js +0 -137
@@ -2,7 +2,7 @@
2
2
  * @licstart The following is the entire license notice for the
3
3
  * Javascript code in this page
4
4
  *
5
- * Copyright 2017 Mozilla Foundation
5
+ * Copyright 2018 Mozilla Foundation
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
8
8
  * you may not use this file except in compliance with the License.
@@ -19,15 +19,15 @@
19
19
  * @licend The above is the entire license notice for the
20
20
  * Javascript code in this page
21
21
  */
22
- 'use strict';
22
+ "use strict";
23
23
 
24
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
24
+ var _util = require("../../shared/util");
25
25
 
26
- var _util = require('../../shared/util');
26
+ var _primitives = require("../../core/primitives");
27
27
 
28
- var _primitives = require('../../core/primitives');
28
+ var _test_utils = require("./test_utils");
29
29
 
30
- var _test_utils = require('./test_utils');
30
+ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
31
31
 
32
32
  describe('util', function () {
33
33
  describe('bytesToString', function () {
@@ -43,9 +43,11 @@ describe('util', function () {
43
43
  it('handles array arguments with a length exceeding the maximum', function () {
44
44
  var length = 10000;
45
45
  var bytes = new Uint8Array(length);
46
+
46
47
  for (var i = 0; i < length; i++) {
47
48
  bytes[i] = 'a'.charCodeAt(0);
48
49
  }
50
+
49
51
  var string = Array(length + 1).join('a');
50
52
  expect((0, _util.bytesToString)(bytes)).toEqual(string);
51
53
  });
@@ -148,11 +150,13 @@ describe('util', function () {
148
150
  var dict = new _primitives.Dict();
149
151
  var currentDict = dict;
150
152
  var parentDict = null;
153
+
151
154
  for (var i = 0; i < 150; i++) {
152
155
  parentDict = new _primitives.Dict();
153
156
  currentDict.set('Parent', parentDict);
154
157
  currentDict = parentDict;
155
158
  }
159
+
156
160
  parentDict.set('foo', 'bar');
157
161
  expect((0, _util.getInheritableProperty)({
158
162
  dict: dict,
@@ -198,7 +202,9 @@ describe('util', function () {
198
202
  expect((0, _util.isEmptyObj)({})).toEqual(true);
199
203
  });
200
204
  it('handles non-empty objects', function () {
201
- expect((0, _util.isEmptyObj)({ foo: 'bar' })).toEqual(false);
205
+ expect((0, _util.isEmptyObj)({
206
+ foo: 'bar'
207
+ })).toEqual(false);
202
208
  });
203
209
  });
204
210
  describe('isNum', function () {
@@ -253,6 +259,13 @@ describe('util', function () {
253
259
  expect((0, _util.log2)(3.14)).toEqual(2);
254
260
  });
255
261
  });
262
+ describe('string32', function () {
263
+ it('converts unsigned 32-bit integers to strings', function () {
264
+ expect((0, _util.string32)(0x74727565)).toEqual('true');
265
+ expect((0, _util.string32)(0x74797031)).toEqual('typ1');
266
+ expect((0, _util.string32)(0x4F54544F)).toEqual('OTTO');
267
+ });
268
+ });
256
269
  describe('stringToBytes', function () {
257
270
  it('handles non-string arguments', function () {
258
271
  expect(function () {
@@ -267,7 +280,7 @@ describe('util', function () {
267
280
  describe('stringToPDFString', function () {
268
281
  it('handles ISO Latin 1 strings', function () {
269
282
  var str = '\x8Dstring\x8E';
270
- expect((0, _util.stringToPDFString)(str)).toEqual('\u201Cstring\u201D');
283
+ expect((0, _util.stringToPDFString)(str)).toEqual("\u201Cstring\u201D");
271
284
  });
272
285
  it('handles UTF-16BE strings', function () {
273
286
  var str = '\xFE\xFF\x00\x73\x00\x74\x00\x72\x00\x69\x00\x6E\x00\x67';
@@ -293,11 +306,120 @@ describe('util', function () {
293
306
  describe('ReadableStream', function () {
294
307
  it('should return an Object', function () {
295
308
  var readable = new _util.ReadableStream();
296
- expect(typeof readable === 'undefined' ? 'undefined' : _typeof(readable)).toEqual('object');
309
+ expect(_typeof(readable)).toEqual('object');
297
310
  });
298
311
  it('should have property getReader', function () {
299
312
  var readable = new _util.ReadableStream();
300
313
  expect(_typeof(readable.getReader)).toEqual('function');
301
314
  });
302
315
  });
316
+ describe('toRomanNumerals', function () {
317
+ it('handles invalid arguments', function () {
318
+ var _arr = ['foo', -1, 0];
319
+
320
+ var _loop = function _loop() {
321
+ var input = _arr[_i];
322
+ expect(function () {
323
+ (0, _util.toRomanNumerals)(input);
324
+ }).toThrow(new Error('The number should be a positive integer.'));
325
+ };
326
+
327
+ for (var _i = 0; _i < _arr.length; _i++) {
328
+ _loop();
329
+ }
330
+ });
331
+ it('converts numbers to uppercase Roman numerals', function () {
332
+ expect((0, _util.toRomanNumerals)(1)).toEqual('I');
333
+ expect((0, _util.toRomanNumerals)(6)).toEqual('VI');
334
+ expect((0, _util.toRomanNumerals)(7)).toEqual('VII');
335
+ expect((0, _util.toRomanNumerals)(8)).toEqual('VIII');
336
+ expect((0, _util.toRomanNumerals)(10)).toEqual('X');
337
+ expect((0, _util.toRomanNumerals)(40)).toEqual('XL');
338
+ expect((0, _util.toRomanNumerals)(100)).toEqual('C');
339
+ expect((0, _util.toRomanNumerals)(500)).toEqual('D');
340
+ expect((0, _util.toRomanNumerals)(1000)).toEqual('M');
341
+ expect((0, _util.toRomanNumerals)(2019)).toEqual('MMXIX');
342
+ });
343
+ it('converts numbers to lowercase Roman numerals', function () {
344
+ expect((0, _util.toRomanNumerals)(1, true)).toEqual('i');
345
+ expect((0, _util.toRomanNumerals)(6, true)).toEqual('vi');
346
+ expect((0, _util.toRomanNumerals)(7, true)).toEqual('vii');
347
+ expect((0, _util.toRomanNumerals)(8, true)).toEqual('viii');
348
+ expect((0, _util.toRomanNumerals)(10, true)).toEqual('x');
349
+ expect((0, _util.toRomanNumerals)(40, true)).toEqual('xl');
350
+ expect((0, _util.toRomanNumerals)(100, true)).toEqual('c');
351
+ expect((0, _util.toRomanNumerals)(500, true)).toEqual('d');
352
+ expect((0, _util.toRomanNumerals)(1000, true)).toEqual('m');
353
+ expect((0, _util.toRomanNumerals)(2019, true)).toEqual('mmxix');
354
+ });
355
+ });
356
+ describe('URL', function () {
357
+ it('should return an Object', function () {
358
+ var url = new _util.URL('https://example.com');
359
+ expect(_typeof(url)).toEqual('object');
360
+ });
361
+ it('should have property `href`', function () {
362
+ var url = new _util.URL('https://example.com');
363
+ expect(_typeof(url.href)).toEqual('string');
364
+ });
365
+ });
366
+ describe('isSameOrigin', function () {
367
+ it('handles invalid base URLs', function () {
368
+ expect((0, _util.isSameOrigin)('/foo', '/bar')).toEqual(false);
369
+ expect((0, _util.isSameOrigin)('blob:foo', '/bar')).toEqual(false);
370
+ });
371
+ it('correctly checks if the origin of both URLs matches', function () {
372
+ expect((0, _util.isSameOrigin)('https://www.mozilla.org/foo', 'https://www.mozilla.org/bar')).toEqual(true);
373
+ expect((0, _util.isSameOrigin)('https://www.mozilla.org/foo', 'https://www.example.com/bar')).toEqual(false);
374
+ });
375
+ });
376
+ describe('createValidAbsoluteUrl', function () {
377
+ it('handles invalid URLs', function () {
378
+ expect((0, _util.createValidAbsoluteUrl)(undefined, undefined)).toEqual(null);
379
+ expect((0, _util.createValidAbsoluteUrl)(null, null)).toEqual(null);
380
+ expect((0, _util.createValidAbsoluteUrl)('/foo', '/bar')).toEqual(null);
381
+ });
382
+ it('handles URLs that do not use a whitelisted protocol', function () {
383
+ expect((0, _util.createValidAbsoluteUrl)('magnet:?foo', null)).toEqual(null);
384
+ });
385
+ it('correctly creates a valid URL for whitelisted protocols', function () {
386
+ expect((0, _util.createValidAbsoluteUrl)('http://www.mozilla.org/foo', null)).toEqual(new _util.URL('http://www.mozilla.org/foo'));
387
+ expect((0, _util.createValidAbsoluteUrl)('/foo', 'http://www.mozilla.org')).toEqual(new _util.URL('http://www.mozilla.org/foo'));
388
+ expect((0, _util.createValidAbsoluteUrl)('https://www.mozilla.org/foo', null)).toEqual(new _util.URL('https://www.mozilla.org/foo'));
389
+ expect((0, _util.createValidAbsoluteUrl)('/foo', 'https://www.mozilla.org')).toEqual(new _util.URL('https://www.mozilla.org/foo'));
390
+ expect((0, _util.createValidAbsoluteUrl)('ftp://www.mozilla.org/foo', null)).toEqual(new _util.URL('ftp://www.mozilla.org/foo'));
391
+ expect((0, _util.createValidAbsoluteUrl)('/foo', 'ftp://www.mozilla.org')).toEqual(new _util.URL('ftp://www.mozilla.org/foo'));
392
+ expect((0, _util.createValidAbsoluteUrl)('mailto:foo@bar.baz', null)).toEqual(new _util.URL('mailto:foo@bar.baz'));
393
+ expect((0, _util.createValidAbsoluteUrl)('/foo', 'mailto:foo@bar.baz')).toEqual(null);
394
+ expect((0, _util.createValidAbsoluteUrl)('tel:+0123456789', null)).toEqual(new _util.URL('tel:+0123456789'));
395
+ expect((0, _util.createValidAbsoluteUrl)('/foo', 'tel:0123456789')).toEqual(null);
396
+ });
397
+ });
398
+ describe('createPromiseCapability', function () {
399
+ it('should resolve with correct data', function (done) {
400
+ var promiseCapability = (0, _util.createPromiseCapability)();
401
+ expect(promiseCapability.settled).toEqual(false);
402
+ promiseCapability.resolve({
403
+ test: 'abc'
404
+ });
405
+ promiseCapability.promise.then(function (data) {
406
+ expect(promiseCapability.settled).toEqual(true);
407
+ expect(data).toEqual({
408
+ test: 'abc'
409
+ });
410
+ done();
411
+ }, done.fail);
412
+ });
413
+ it('should reject with correct reason', function (done) {
414
+ var promiseCapability = (0, _util.createPromiseCapability)();
415
+ expect(promiseCapability.settled).toEqual(false);
416
+ promiseCapability.reject(new Error('reason'));
417
+ promiseCapability.promise.then(done.fail, function (reason) {
418
+ expect(promiseCapability.settled).toEqual(true);
419
+ expect(reason instanceof Error).toEqual(true);
420
+ expect(reason.message).toEqual('reason');
421
+ done();
422
+ });
423
+ });
424
+ });
303
425
  });
@@ -2,7 +2,7 @@
2
2
  * @licstart The following is the entire license notice for the
3
3
  * Javascript code in this page
4
4
  *
5
- * Copyright 2017 Mozilla Foundation
5
+ * Copyright 2018 Mozilla Foundation
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
8
8
  * you may not use this file except in compliance with the License.
@@ -19,35 +19,39 @@
19
19
  * @licend The above is the entire license notice for the
20
20
  * Javascript code in this page
21
21
  */
22
- 'use strict';
22
+ "use strict";
23
23
 
24
24
  Object.defineProperty(exports, "__esModule", {
25
25
  value: true
26
26
  });
27
- exports.DefaultAnnotationLayerFactory = exports.AnnotationLayerBuilder = undefined;
27
+ exports.DefaultAnnotationLayerFactory = exports.AnnotationLayerBuilder = void 0;
28
28
 
29
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
29
+ var _pdf = require("../pdf");
30
30
 
31
- var _pdf = require('../pdf');
31
+ var _ui_utils = require("./ui_utils");
32
32
 
33
- var _ui_utils = require('./ui_utils');
34
-
35
- var _pdf_link_service = require('./pdf_link_service');
33
+ var _pdf_link_service = require("./pdf_link_service");
36
34
 
37
35
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
38
36
 
39
- var AnnotationLayerBuilder = function () {
37
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
38
+
39
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
40
+
41
+ var AnnotationLayerBuilder =
42
+ /*#__PURE__*/
43
+ function () {
40
44
  function AnnotationLayerBuilder(_ref) {
41
45
  var pageDiv = _ref.pageDiv,
42
46
  pdfPage = _ref.pdfPage,
43
47
  linkService = _ref.linkService,
44
48
  downloadManager = _ref.downloadManager,
45
49
  _ref$imageResourcesPa = _ref.imageResourcesPath,
46
- imageResourcesPath = _ref$imageResourcesPa === undefined ? '' : _ref$imageResourcesPa,
50
+ imageResourcesPath = _ref$imageResourcesPa === void 0 ? '' : _ref$imageResourcesPa,
47
51
  _ref$renderInteractiv = _ref.renderInteractiveForms,
48
- renderInteractiveForms = _ref$renderInteractiv === undefined ? false : _ref$renderInteractiv,
52
+ renderInteractiveForms = _ref$renderInteractiv === void 0 ? false : _ref$renderInteractiv,
49
53
  _ref$l10n = _ref.l10n,
50
- l10n = _ref$l10n === undefined ? _ui_utils.NullL10n : _ref$l10n;
54
+ l10n = _ref$l10n === void 0 ? _ui_utils.NullL10n : _ref$l10n;
51
55
 
52
56
  _classCallCheck(this, AnnotationLayerBuilder);
53
57
 
@@ -63,18 +67,22 @@ var AnnotationLayerBuilder = function () {
63
67
  }
64
68
 
65
69
  _createClass(AnnotationLayerBuilder, [{
66
- key: 'render',
70
+ key: "render",
67
71
  value: function render(viewport) {
68
72
  var _this = this;
69
73
 
70
74
  var intent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'display';
71
-
72
- this.pdfPage.getAnnotations({ intent: intent }).then(function (annotations) {
75
+ this.pdfPage.getAnnotations({
76
+ intent: intent
77
+ }).then(function (annotations) {
73
78
  if (_this._cancelled) {
74
79
  return;
75
80
  }
81
+
76
82
  var parameters = {
77
- viewport: viewport.clone({ dontFlip: true }),
83
+ viewport: viewport.clone({
84
+ dontFlip: true
85
+ }),
78
86
  div: _this.div,
79
87
  annotations: annotations,
80
88
  page: _this.pdfPage,
@@ -83,32 +91,39 @@ var AnnotationLayerBuilder = function () {
83
91
  linkService: _this.linkService,
84
92
  downloadManager: _this.downloadManager
85
93
  };
94
+
86
95
  if (_this.div) {
87
96
  _pdf.AnnotationLayer.update(parameters);
88
97
  } else {
89
98
  if (annotations.length === 0) {
90
99
  return;
91
100
  }
101
+
92
102
  _this.div = document.createElement('div');
93
103
  _this.div.className = 'annotationLayer';
104
+
94
105
  _this.pageDiv.appendChild(_this.div);
106
+
95
107
  parameters.div = _this.div;
108
+
96
109
  _pdf.AnnotationLayer.render(parameters);
110
+
97
111
  _this.l10n.translate(_this.div);
98
112
  }
99
113
  });
100
114
  }
101
115
  }, {
102
- key: 'cancel',
116
+ key: "cancel",
103
117
  value: function cancel() {
104
118
  this._cancelled = true;
105
119
  }
106
120
  }, {
107
- key: 'hide',
121
+ key: "hide",
108
122
  value: function hide() {
109
123
  if (!this.div) {
110
124
  return;
111
125
  }
126
+
112
127
  this.div.setAttribute('hidden', 'true');
113
128
  }
114
129
  }]);
@@ -116,18 +131,21 @@ var AnnotationLayerBuilder = function () {
116
131
  return AnnotationLayerBuilder;
117
132
  }();
118
133
 
119
- var DefaultAnnotationLayerFactory = function () {
134
+ exports.AnnotationLayerBuilder = AnnotationLayerBuilder;
135
+
136
+ var DefaultAnnotationLayerFactory =
137
+ /*#__PURE__*/
138
+ function () {
120
139
  function DefaultAnnotationLayerFactory() {
121
140
  _classCallCheck(this, DefaultAnnotationLayerFactory);
122
141
  }
123
142
 
124
143
  _createClass(DefaultAnnotationLayerFactory, [{
125
- key: 'createAnnotationLayerBuilder',
144
+ key: "createAnnotationLayerBuilder",
126
145
  value: function createAnnotationLayerBuilder(pageDiv, pdfPage) {
127
146
  var imageResourcesPath = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
128
147
  var renderInteractiveForms = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
129
148
  var l10n = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : _ui_utils.NullL10n;
130
-
131
149
  return new AnnotationLayerBuilder({
132
150
  pageDiv: pageDiv,
133
151
  pdfPage: pdfPage,
@@ -142,5 +160,4 @@ var DefaultAnnotationLayerFactory = function () {
142
160
  return DefaultAnnotationLayerFactory;
143
161
  }();
144
162
 
145
- exports.AnnotationLayerBuilder = AnnotationLayerBuilder;
146
163
  exports.DefaultAnnotationLayerFactory = DefaultAnnotationLayerFactory;