pdfjs-dist 2.0.943 → 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 (159) hide show
  1. package/bower.json +1 -1
  2. package/build/pdf.js +15329 -11095
  3. package/build/pdf.js.map +1 -1
  4. package/build/pdf.min.js +1 -1
  5. package/build/pdf.worker.js +12497 -4184
  6. package/build/pdf.worker.js.map +1 -1
  7. package/build/pdf.worker.min.js +1 -1
  8. package/image_decoders/pdf.image_decoders.js +3438 -1209
  9. package/image_decoders/pdf.image_decoders.js.map +1 -1
  10. package/image_decoders/pdf.image_decoders.min.js +1 -1
  11. package/lib/core/annotation.js +335 -109
  12. package/lib/core/arithmetic_decoder.js +274 -244
  13. package/lib/core/bidi.js +64 -5
  14. package/lib/core/ccitt.js +172 -17
  15. package/lib/core/ccitt_stream.js +14 -5
  16. package/lib/core/cff_parser.js +304 -28
  17. package/lib/core/charsets.js +4 -3
  18. package/lib/core/chunked_stream.js +379 -149
  19. package/lib/core/cmap.js +210 -40
  20. package/lib/core/colorspace.js +332 -187
  21. package/lib/core/crypto.js +289 -44
  22. package/lib/core/document.js +508 -249
  23. package/lib/core/encodings.js +18 -9
  24. package/lib/core/evaluator.js +657 -119
  25. package/lib/core/font_renderer.js +217 -34
  26. package/lib/core/fonts.js +632 -41
  27. package/lib/core/function.js +252 -26
  28. package/lib/core/glyphlist.js +2 -1
  29. package/lib/core/image.js +124 -27
  30. package/lib/core/jbig2.js +425 -65
  31. package/lib/core/jbig2_stream.js +18 -7
  32. package/lib/core/jpeg_stream.js +24 -8
  33. package/lib/core/jpg.js +208 -16
  34. package/lib/core/jpx.js +395 -5
  35. package/lib/core/jpx_stream.js +17 -5
  36. package/lib/core/metrics.js +3 -3
  37. package/lib/core/murmurhash3.js +23 -5
  38. package/lib/core/obj.js +625 -132
  39. package/lib/core/operator_list.js +104 -3
  40. package/lib/core/parser.js +262 -25
  41. package/lib/core/pattern.js +144 -12
  42. package/lib/core/pdf_manager.js +104 -70
  43. package/lib/core/primitives.js +74 -21
  44. package/lib/core/ps_parser.js +133 -44
  45. package/lib/core/standard_fonts.js +9 -9
  46. package/lib/core/stream.js +283 -31
  47. package/lib/core/type1_parser.js +138 -6
  48. package/lib/core/unicode.js +28 -1
  49. package/lib/core/worker.js +192 -57
  50. package/lib/display/annotation_layer.js +303 -123
  51. package/lib/display/api.js +1073 -574
  52. package/lib/display/api_compatibility.js +4 -1
  53. package/lib/display/canvas.js +314 -18
  54. package/lib/display/content_disposition.js +70 -23
  55. package/lib/display/dom_utils.js +112 -59
  56. package/lib/display/fetch_stream.js +95 -50
  57. package/lib/display/font_loader.js +250 -132
  58. package/lib/display/metadata.js +37 -15
  59. package/lib/display/network.js +123 -34
  60. package/lib/display/network_utils.js +23 -10
  61. package/lib/display/node_stream.js +162 -65
  62. package/lib/display/pattern_helper.js +57 -6
  63. package/lib/display/svg.js +194 -18
  64. package/lib/display/text_layer.js +128 -14
  65. package/lib/display/transport_stream.js +83 -27
  66. package/lib/display/webgl.js +63 -17
  67. package/lib/display/worker_options.js +4 -3
  68. package/lib/display/xml_parser.js +162 -52
  69. package/lib/examples/node/domstubs.js +56 -3
  70. package/lib/pdf.js +15 -2
  71. package/lib/pdf.worker.js +4 -2
  72. package/lib/shared/compatibility.js +129 -26
  73. package/lib/shared/global_scope.js +1 -1
  74. package/lib/shared/is_node.js +3 -3
  75. package/lib/shared/message_handler.js +103 -45
  76. package/lib/shared/streams_polyfill.js +20 -16
  77. package/lib/shared/url_polyfill.js +8 -2
  78. package/lib/shared/util.js +246 -84
  79. package/lib/test/unit/annotation_spec.js +99 -73
  80. package/lib/test/unit/api_spec.js +347 -113
  81. package/lib/test/unit/bidi_spec.js +6 -6
  82. package/lib/test/unit/cff_parser_spec.js +17 -5
  83. package/lib/test/unit/clitests_helper.js +7 -8
  84. package/lib/test/unit/cmap_spec.js +79 -25
  85. package/lib/test/unit/colorspace_spec.js +65 -18
  86. package/lib/test/unit/crypto_spec.js +16 -4
  87. package/lib/test/unit/custom_spec.js +40 -52
  88. package/lib/test/unit/display_svg_spec.js +32 -16
  89. package/lib/test/unit/document_spec.js +2 -2
  90. package/lib/test/unit/dom_utils_spec.js +8 -8
  91. package/lib/test/unit/encodings_spec.js +24 -44
  92. package/lib/test/unit/evaluator_spec.js +15 -8
  93. package/lib/test/unit/function_spec.js +16 -4
  94. package/lib/test/unit/jasmine-boot.js +29 -16
  95. package/lib/test/unit/message_handler_spec.js +19 -6
  96. package/lib/test/unit/metadata_spec.js +64 -11
  97. package/lib/test/unit/murmurhash3_spec.js +2 -2
  98. package/lib/test/unit/network_spec.js +19 -4
  99. package/lib/test/unit/network_utils_spec.js +6 -4
  100. package/lib/test/unit/node_stream_spec.js +50 -26
  101. package/lib/test/unit/parser_spec.js +13 -29
  102. package/lib/test/unit/pdf_find_controller_spec.js +144 -32
  103. package/lib/test/unit/pdf_find_utils_spec.js +10 -9
  104. package/lib/test/unit/pdf_history_spec.js +20 -8
  105. package/lib/test/unit/primitives_spec.js +23 -3
  106. package/lib/test/unit/stream_spec.js +8 -3
  107. package/lib/test/unit/test_utils.js +89 -26
  108. package/lib/test/unit/testreporter.js +19 -1
  109. package/lib/test/unit/type1_parser_spec.js +7 -5
  110. package/lib/test/unit/ui_utils_spec.js +162 -38
  111. package/lib/test/unit/unicode_spec.js +13 -10
  112. package/lib/test/unit/util_spec.js +89 -9
  113. package/lib/web/annotation_layer_builder.js +38 -21
  114. package/lib/web/app.js +610 -245
  115. package/lib/web/app_options.js +54 -34
  116. package/lib/web/base_viewer.js +359 -162
  117. package/lib/web/chromecom.js +159 -80
  118. package/lib/web/debugger.js +161 -17
  119. package/lib/web/download_manager.js +29 -11
  120. package/lib/web/firefox_print_service.js +16 -8
  121. package/lib/web/firefoxcom.js +127 -91
  122. package/lib/web/genericcom.js +50 -31
  123. package/lib/web/genericl10n.js +46 -34
  124. package/lib/web/grab_to_pan.js +25 -3
  125. package/lib/web/interfaces.js +108 -61
  126. package/lib/web/overlay_manager.js +67 -45
  127. package/lib/web/password_prompt.js +20 -12
  128. package/lib/web/pdf_attachment_viewer.js +37 -17
  129. package/lib/web/pdf_cursor_tools.js +38 -15
  130. package/lib/web/pdf_document_properties.js +65 -24
  131. package/lib/web/pdf_find_bar.js +48 -20
  132. package/lib/web/pdf_find_controller.js +290 -89
  133. package/lib/web/pdf_find_utils.js +19 -3
  134. package/lib/web/pdf_history.js +186 -49
  135. package/lib/web/pdf_link_service.js +127 -52
  136. package/lib/web/pdf_outline_viewer.js +71 -21
  137. package/lib/web/pdf_page_view.js +188 -63
  138. package/lib/web/pdf_presentation_mode.js +98 -33
  139. package/lib/web/pdf_print_service.js +54 -10
  140. package/lib/web/pdf_rendering_queue.js +26 -4
  141. package/lib/web/pdf_sidebar.js +116 -62
  142. package/lib/web/pdf_sidebar_resizer.js +41 -15
  143. package/lib/web/pdf_single_page_viewer.js +65 -68
  144. package/lib/web/pdf_thumbnail_view.js +102 -31
  145. package/lib/web/pdf_thumbnail_viewer.js +62 -22
  146. package/lib/web/pdf_viewer.component.js +111 -31
  147. package/lib/web/pdf_viewer.js +80 -60
  148. package/lib/web/preferences.js +61 -39
  149. package/lib/web/secondary_toolbar.js +101 -82
  150. package/lib/web/text_layer_builder.js +124 -69
  151. package/lib/web/toolbar.js +67 -27
  152. package/lib/web/ui_utils.js +284 -128
  153. package/lib/web/view_history.js +75 -51
  154. package/lib/web/viewer_compatibility.js +2 -1
  155. package/package.json +1 -1
  156. package/web/pdf_viewer.css +1 -1
  157. package/web/pdf_viewer.js +2200 -973
  158. package/web/pdf_viewer.js.map +1 -1
  159. package/lib/web/dom_events.js +0 -140
@@ -19,83 +19,119 @@
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.AnnotationLayer = undefined;
27
+ exports.AnnotationLayer = void 0;
28
28
 
29
- var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
29
+ var _dom_utils = require("./dom_utils");
30
30
 
31
- 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; }; }();
31
+ var _util = require("../shared/util");
32
32
 
33
- var _dom_utils = require('./dom_utils');
33
+ function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
34
34
 
35
- var _util = require('../shared/util');
35
+ function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
36
36
 
37
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
37
+ 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); }
38
38
 
39
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
39
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
40
+
41
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
42
+
43
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
44
+
45
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
46
+
47
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
40
48
 
41
49
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
42
50
 
43
- var AnnotationElementFactory = function () {
51
+ 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); } }
52
+
53
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
54
+
55
+ var AnnotationElementFactory =
56
+ /*#__PURE__*/
57
+ function () {
44
58
  function AnnotationElementFactory() {
45
59
  _classCallCheck(this, AnnotationElementFactory);
46
60
  }
47
61
 
48
62
  _createClass(AnnotationElementFactory, null, [{
49
- key: 'create',
63
+ key: "create",
50
64
  value: function create(parameters) {
51
65
  var subtype = parameters.data.annotationType;
66
+
52
67
  switch (subtype) {
53
68
  case _util.AnnotationType.LINK:
54
69
  return new LinkAnnotationElement(parameters);
70
+
55
71
  case _util.AnnotationType.TEXT:
56
72
  return new TextAnnotationElement(parameters);
73
+
57
74
  case _util.AnnotationType.WIDGET:
58
75
  var fieldType = parameters.data.fieldType;
76
+
59
77
  switch (fieldType) {
60
78
  case 'Tx':
61
79
  return new TextWidgetAnnotationElement(parameters);
80
+
62
81
  case 'Btn':
63
82
  if (parameters.data.radioButton) {
64
83
  return new RadioButtonWidgetAnnotationElement(parameters);
65
84
  } else if (parameters.data.checkBox) {
66
85
  return new CheckboxWidgetAnnotationElement(parameters);
67
86
  }
87
+
68
88
  return new PushButtonWidgetAnnotationElement(parameters);
89
+
69
90
  case 'Ch':
70
91
  return new ChoiceWidgetAnnotationElement(parameters);
71
92
  }
93
+
72
94
  return new WidgetAnnotationElement(parameters);
95
+
73
96
  case _util.AnnotationType.POPUP:
74
97
  return new PopupAnnotationElement(parameters);
98
+
75
99
  case _util.AnnotationType.LINE:
76
100
  return new LineAnnotationElement(parameters);
101
+
77
102
  case _util.AnnotationType.SQUARE:
78
103
  return new SquareAnnotationElement(parameters);
104
+
79
105
  case _util.AnnotationType.CIRCLE:
80
106
  return new CircleAnnotationElement(parameters);
107
+
81
108
  case _util.AnnotationType.POLYLINE:
82
109
  return new PolylineAnnotationElement(parameters);
110
+
83
111
  case _util.AnnotationType.INK:
84
112
  return new InkAnnotationElement(parameters);
113
+
85
114
  case _util.AnnotationType.POLYGON:
86
115
  return new PolygonAnnotationElement(parameters);
116
+
87
117
  case _util.AnnotationType.HIGHLIGHT:
88
118
  return new HighlightAnnotationElement(parameters);
119
+
89
120
  case _util.AnnotationType.UNDERLINE:
90
121
  return new UnderlineAnnotationElement(parameters);
122
+
91
123
  case _util.AnnotationType.SQUIGGLY:
92
124
  return new SquigglyAnnotationElement(parameters);
125
+
93
126
  case _util.AnnotationType.STRIKEOUT:
94
127
  return new StrikeOutAnnotationElement(parameters);
128
+
95
129
  case _util.AnnotationType.STAMP:
96
130
  return new StampAnnotationElement(parameters);
131
+
97
132
  case _util.AnnotationType.FILEATTACHMENT:
98
133
  return new FileAttachmentAnnotationElement(parameters);
134
+
99
135
  default:
100
136
  return new AnnotationElement(parameters);
101
137
  }
@@ -105,7 +141,9 @@ var AnnotationElementFactory = function () {
105
141
  return AnnotationElementFactory;
106
142
  }();
107
143
 
108
- var AnnotationElement = function () {
144
+ var AnnotationElement =
145
+ /*#__PURE__*/
146
+ function () {
109
147
  function AnnotationElement(parameters) {
110
148
  var isRenderable = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
111
149
  var ignoreBorder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
@@ -122,16 +160,16 @@ var AnnotationElement = function () {
122
160
  this.imageResourcesPath = parameters.imageResourcesPath;
123
161
  this.renderInteractiveForms = parameters.renderInteractiveForms;
124
162
  this.svgFactory = parameters.svgFactory;
163
+
125
164
  if (isRenderable) {
126
165
  this.container = this._createContainer(ignoreBorder);
127
166
  }
128
167
  }
129
168
 
130
169
  _createClass(AnnotationElement, [{
131
- key: '_createContainer',
170
+ key: "_createContainer",
132
171
  value: function _createContainer() {
133
172
  var ignoreBorder = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
134
-
135
173
  var data = this.data,
136
174
  page = this.page,
137
175
  viewport = this.viewport;
@@ -139,46 +177,60 @@ var AnnotationElement = function () {
139
177
  var width = data.rect[2] - data.rect[0];
140
178
  var height = data.rect[3] - data.rect[1];
141
179
  container.setAttribute('data-annotation-id', data.id);
180
+
142
181
  var rect = _util.Util.normalizeRect([data.rect[0], page.view[3] - data.rect[1] + page.view[1], data.rect[2], page.view[3] - data.rect[3] + page.view[1]]);
182
+
143
183
  container.style.transform = 'matrix(' + viewport.transform.join(',') + ')';
144
184
  container.style.transformOrigin = -rect[0] + 'px ' + -rect[1] + 'px';
185
+
145
186
  if (!ignoreBorder && data.borderStyle.width > 0) {
146
187
  container.style.borderWidth = data.borderStyle.width + 'px';
188
+
147
189
  if (data.borderStyle.style !== _util.AnnotationBorderStyleType.UNDERLINE) {
148
190
  width = width - 2 * data.borderStyle.width;
149
191
  height = height - 2 * data.borderStyle.width;
150
192
  }
193
+
151
194
  var horizontalRadius = data.borderStyle.horizontalCornerRadius;
152
195
  var verticalRadius = data.borderStyle.verticalCornerRadius;
196
+
153
197
  if (horizontalRadius > 0 || verticalRadius > 0) {
154
198
  var radius = horizontalRadius + 'px / ' + verticalRadius + 'px';
155
199
  container.style.borderRadius = radius;
156
200
  }
201
+
157
202
  switch (data.borderStyle.style) {
158
203
  case _util.AnnotationBorderStyleType.SOLID:
159
204
  container.style.borderStyle = 'solid';
160
205
  break;
206
+
161
207
  case _util.AnnotationBorderStyleType.DASHED:
162
208
  container.style.borderStyle = 'dashed';
163
209
  break;
210
+
164
211
  case _util.AnnotationBorderStyleType.BEVELED:
165
212
  (0, _util.warn)('Unimplemented border style: beveled');
166
213
  break;
214
+
167
215
  case _util.AnnotationBorderStyleType.INSET:
168
216
  (0, _util.warn)('Unimplemented border style: inset');
169
217
  break;
218
+
170
219
  case _util.AnnotationBorderStyleType.UNDERLINE:
171
220
  container.style.borderBottomStyle = 'solid';
172
221
  break;
222
+
173
223
  default:
174
224
  break;
175
225
  }
226
+
176
227
  if (data.color) {
177
228
  container.style.borderColor = _util.Util.makeCssRgb(data.color[0] | 0, data.color[1] | 0, data.color[2] | 0);
178
229
  } else {
179
230
  container.style.borderWidth = 0;
180
231
  }
181
232
  }
233
+
182
234
  container.style.left = rect[0] + 'px';
183
235
  container.style.top = rect[1] + 'px';
184
236
  container.style.width = width + 'px';
@@ -186,7 +238,7 @@ var AnnotationElement = function () {
186
238
  return container;
187
239
  }
188
240
  }, {
189
- key: '_createPopup',
241
+ key: "_createPopup",
190
242
  value: function _createPopup(container, trigger, data) {
191
243
  if (!trigger) {
192
244
  trigger = document.createElement('div');
@@ -194,6 +246,7 @@ var AnnotationElement = function () {
194
246
  trigger.style.width = container.style.width;
195
247
  container.appendChild(trigger);
196
248
  }
249
+
197
250
  var popupElement = new PopupElement({
198
251
  container: container,
199
252
  trigger: trigger,
@@ -207,7 +260,7 @@ var AnnotationElement = function () {
207
260
  container.appendChild(popup);
208
261
  }
209
262
  }, {
210
- key: 'render',
263
+ key: "render",
211
264
  value: function render() {
212
265
  (0, _util.unreachable)('Abstract method `AnnotationElement.render` called');
213
266
  }
@@ -216,29 +269,31 @@ var AnnotationElement = function () {
216
269
  return AnnotationElement;
217
270
  }();
218
271
 
219
- var LinkAnnotationElement = function (_AnnotationElement) {
272
+ var LinkAnnotationElement =
273
+ /*#__PURE__*/
274
+ function (_AnnotationElement) {
220
275
  _inherits(LinkAnnotationElement, _AnnotationElement);
221
276
 
222
277
  function LinkAnnotationElement(parameters) {
223
278
  _classCallCheck(this, LinkAnnotationElement);
224
279
 
225
280
  var isRenderable = !!(parameters.data.url || parameters.data.dest || parameters.data.action);
226
- return _possibleConstructorReturn(this, (LinkAnnotationElement.__proto__ || Object.getPrototypeOf(LinkAnnotationElement)).call(this, parameters, isRenderable));
281
+ return _possibleConstructorReturn(this, _getPrototypeOf(LinkAnnotationElement).call(this, parameters, isRenderable));
227
282
  }
228
283
 
229
284
  _createClass(LinkAnnotationElement, [{
230
- key: 'render',
285
+ key: "render",
231
286
  value: function render() {
232
287
  this.container.className = 'linkAnnotation';
233
288
  var data = this.data,
234
289
  linkService = this.linkService;
235
-
236
290
  var link = document.createElement('a');
237
291
  (0, _dom_utils.addLinkAttributes)(link, {
238
292
  url: data.url,
239
293
  target: data.newWindow ? _dom_utils.LinkTarget.BLANK : linkService.externalLinkTarget,
240
294
  rel: linkService.externalLinkRel
241
295
  });
296
+
242
297
  if (!data.url) {
243
298
  if (data.action) {
244
299
  this._bindNamedAction(link, data.action);
@@ -246,35 +301,42 @@ var LinkAnnotationElement = function (_AnnotationElement) {
246
301
  this._bindLink(link, data.dest);
247
302
  }
248
303
  }
304
+
249
305
  this.container.appendChild(link);
250
306
  return this.container;
251
307
  }
252
308
  }, {
253
- key: '_bindLink',
309
+ key: "_bindLink",
254
310
  value: function _bindLink(link, destination) {
255
- var _this2 = this;
311
+ var _this = this;
256
312
 
257
313
  link.href = this.linkService.getDestinationHash(destination);
314
+
258
315
  link.onclick = function () {
259
316
  if (destination) {
260
- _this2.linkService.navigateTo(destination);
317
+ _this.linkService.navigateTo(destination);
261
318
  }
319
+
262
320
  return false;
263
321
  };
322
+
264
323
  if (destination) {
265
324
  link.className = 'internalLink';
266
325
  }
267
326
  }
268
327
  }, {
269
- key: '_bindNamedAction',
328
+ key: "_bindNamedAction",
270
329
  value: function _bindNamedAction(link, action) {
271
- var _this3 = this;
330
+ var _this2 = this;
272
331
 
273
332
  link.href = this.linkService.getAnchorUrl('');
333
+
274
334
  link.onclick = function () {
275
- _this3.linkService.executeNamedAction(action);
335
+ _this2.linkService.executeNamedAction(action);
336
+
276
337
  return false;
277
338
  };
339
+
278
340
  link.className = 'internalLink';
279
341
  }
280
342
  }]);
@@ -282,18 +344,20 @@ var LinkAnnotationElement = function (_AnnotationElement) {
282
344
  return LinkAnnotationElement;
283
345
  }(AnnotationElement);
284
346
 
285
- var TextAnnotationElement = function (_AnnotationElement2) {
347
+ var TextAnnotationElement =
348
+ /*#__PURE__*/
349
+ function (_AnnotationElement2) {
286
350
  _inherits(TextAnnotationElement, _AnnotationElement2);
287
351
 
288
352
  function TextAnnotationElement(parameters) {
289
353
  _classCallCheck(this, TextAnnotationElement);
290
354
 
291
355
  var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
292
- return _possibleConstructorReturn(this, (TextAnnotationElement.__proto__ || Object.getPrototypeOf(TextAnnotationElement)).call(this, parameters, isRenderable));
356
+ return _possibleConstructorReturn(this, _getPrototypeOf(TextAnnotationElement).call(this, parameters, isRenderable));
293
357
  }
294
358
 
295
359
  _createClass(TextAnnotationElement, [{
296
- key: 'render',
360
+ key: "render",
297
361
  value: function render() {
298
362
  this.container.className = 'textAnnotation';
299
363
  var image = document.createElement('img');
@@ -302,10 +366,14 @@ var TextAnnotationElement = function (_AnnotationElement2) {
302
366
  image.src = this.imageResourcesPath + 'annotation-' + this.data.name.toLowerCase() + '.svg';
303
367
  image.alt = '[{{type}} Annotation]';
304
368
  image.dataset.l10nId = 'text_annotation_type';
305
- image.dataset.l10nArgs = JSON.stringify({ type: this.data.name });
369
+ image.dataset.l10nArgs = JSON.stringify({
370
+ type: this.data.name
371
+ });
372
+
306
373
  if (!this.data.hasPopup) {
307
374
  this._createPopup(this.container, image, this.data);
308
375
  }
376
+
309
377
  this.container.appendChild(image);
310
378
  return this.container;
311
379
  }
@@ -314,17 +382,19 @@ var TextAnnotationElement = function (_AnnotationElement2) {
314
382
  return TextAnnotationElement;
315
383
  }(AnnotationElement);
316
384
 
317
- var WidgetAnnotationElement = function (_AnnotationElement3) {
385
+ var WidgetAnnotationElement =
386
+ /*#__PURE__*/
387
+ function (_AnnotationElement3) {
318
388
  _inherits(WidgetAnnotationElement, _AnnotationElement3);
319
389
 
320
390
  function WidgetAnnotationElement() {
321
391
  _classCallCheck(this, WidgetAnnotationElement);
322
392
 
323
- return _possibleConstructorReturn(this, (WidgetAnnotationElement.__proto__ || Object.getPrototypeOf(WidgetAnnotationElement)).apply(this, arguments));
393
+ return _possibleConstructorReturn(this, _getPrototypeOf(WidgetAnnotationElement).apply(this, arguments));
324
394
  }
325
395
 
326
396
  _createClass(WidgetAnnotationElement, [{
327
- key: 'render',
397
+ key: "render",
328
398
  value: function render() {
329
399
  return this.container;
330
400
  }
@@ -333,22 +403,25 @@ var WidgetAnnotationElement = function (_AnnotationElement3) {
333
403
  return WidgetAnnotationElement;
334
404
  }(AnnotationElement);
335
405
 
336
- var TextWidgetAnnotationElement = function (_WidgetAnnotationElem) {
406
+ var TextWidgetAnnotationElement =
407
+ /*#__PURE__*/
408
+ function (_WidgetAnnotationElem) {
337
409
  _inherits(TextWidgetAnnotationElement, _WidgetAnnotationElem);
338
410
 
339
411
  function TextWidgetAnnotationElement(parameters) {
340
412
  _classCallCheck(this, TextWidgetAnnotationElement);
341
413
 
342
414
  var isRenderable = parameters.renderInteractiveForms || !parameters.data.hasAppearance && !!parameters.data.fieldValue;
343
- return _possibleConstructorReturn(this, (TextWidgetAnnotationElement.__proto__ || Object.getPrototypeOf(TextWidgetAnnotationElement)).call(this, parameters, isRenderable));
415
+ return _possibleConstructorReturn(this, _getPrototypeOf(TextWidgetAnnotationElement).call(this, parameters, isRenderable));
344
416
  }
345
417
 
346
418
  _createClass(TextWidgetAnnotationElement, [{
347
- key: 'render',
419
+ key: "render",
348
420
  value: function render() {
349
421
  var TEXT_ALIGNMENT = ['left', 'center', 'right'];
350
422
  this.container.className = 'textWidgetAnnotation';
351
423
  var element = null;
424
+
352
425
  if (this.renderInteractiveForms) {
353
426
  if (this.data.multiLine) {
354
427
  element = document.createElement('textarea');
@@ -358,10 +431,13 @@ var TextWidgetAnnotationElement = function (_WidgetAnnotationElem) {
358
431
  element.type = 'text';
359
432
  element.setAttribute('value', this.data.fieldValue);
360
433
  }
434
+
361
435
  element.disabled = this.data.readOnly;
436
+
362
437
  if (this.data.maxLen !== null) {
363
438
  element.maxLength = this.data.maxLen;
364
439
  }
440
+
365
441
  if (this.data.comb) {
366
442
  var fieldWidth = this.data.rect[2] - this.data.rect[0];
367
443
  var combWidth = fieldWidth / this.data.maxLen;
@@ -374,26 +450,32 @@ var TextWidgetAnnotationElement = function (_WidgetAnnotationElem) {
374
450
  element.style.verticalAlign = 'middle';
375
451
  element.style.display = 'table-cell';
376
452
  var font = null;
377
- if (this.data.fontRefName) {
378
- font = this.page.commonObjs.getData(this.data.fontRefName);
453
+
454
+ if (this.data.fontRefName && this.page.commonObjs.has(this.data.fontRefName)) {
455
+ font = this.page.commonObjs.get(this.data.fontRefName);
379
456
  }
457
+
380
458
  this._setTextStyle(element, font);
381
459
  }
460
+
382
461
  if (this.data.textAlignment !== null) {
383
462
  element.style.textAlign = TEXT_ALIGNMENT[this.data.textAlignment];
384
463
  }
464
+
385
465
  this.container.appendChild(element);
386
466
  return this.container;
387
467
  }
388
468
  }, {
389
- key: '_setTextStyle',
469
+ key: "_setTextStyle",
390
470
  value: function _setTextStyle(element, font) {
391
471
  var style = element.style;
392
472
  style.fontSize = this.data.fontSize + 'px';
393
473
  style.direction = this.data.fontDirection < 0 ? 'rtl' : 'ltr';
474
+
394
475
  if (!font) {
395
476
  return;
396
477
  }
478
+
397
479
  style.fontWeight = font.black ? font.bold ? '900' : 'bold' : font.bold ? 'bold' : 'normal';
398
480
  style.fontStyle = font.italic ? 'italic' : 'normal';
399
481
  var fontFamily = font.loadedName ? '"' + font.loadedName + '", ' : '';
@@ -405,25 +487,29 @@ var TextWidgetAnnotationElement = function (_WidgetAnnotationElem) {
405
487
  return TextWidgetAnnotationElement;
406
488
  }(WidgetAnnotationElement);
407
489
 
408
- var CheckboxWidgetAnnotationElement = function (_WidgetAnnotationElem2) {
490
+ var CheckboxWidgetAnnotationElement =
491
+ /*#__PURE__*/
492
+ function (_WidgetAnnotationElem2) {
409
493
  _inherits(CheckboxWidgetAnnotationElement, _WidgetAnnotationElem2);
410
494
 
411
495
  function CheckboxWidgetAnnotationElement(parameters) {
412
496
  _classCallCheck(this, CheckboxWidgetAnnotationElement);
413
497
 
414
- return _possibleConstructorReturn(this, (CheckboxWidgetAnnotationElement.__proto__ || Object.getPrototypeOf(CheckboxWidgetAnnotationElement)).call(this, parameters, parameters.renderInteractiveForms));
498
+ return _possibleConstructorReturn(this, _getPrototypeOf(CheckboxWidgetAnnotationElement).call(this, parameters, parameters.renderInteractiveForms));
415
499
  }
416
500
 
417
501
  _createClass(CheckboxWidgetAnnotationElement, [{
418
- key: 'render',
502
+ key: "render",
419
503
  value: function render() {
420
504
  this.container.className = 'buttonWidgetAnnotation checkBox';
421
505
  var element = document.createElement('input');
422
506
  element.disabled = this.data.readOnly;
423
507
  element.type = 'checkbox';
508
+
424
509
  if (this.data.fieldValue && this.data.fieldValue !== 'Off') {
425
510
  element.setAttribute('checked', true);
426
511
  }
512
+
427
513
  this.container.appendChild(element);
428
514
  return this.container;
429
515
  }
@@ -432,26 +518,30 @@ var CheckboxWidgetAnnotationElement = function (_WidgetAnnotationElem2) {
432
518
  return CheckboxWidgetAnnotationElement;
433
519
  }(WidgetAnnotationElement);
434
520
 
435
- var RadioButtonWidgetAnnotationElement = function (_WidgetAnnotationElem3) {
521
+ var RadioButtonWidgetAnnotationElement =
522
+ /*#__PURE__*/
523
+ function (_WidgetAnnotationElem3) {
436
524
  _inherits(RadioButtonWidgetAnnotationElement, _WidgetAnnotationElem3);
437
525
 
438
526
  function RadioButtonWidgetAnnotationElement(parameters) {
439
527
  _classCallCheck(this, RadioButtonWidgetAnnotationElement);
440
528
 
441
- return _possibleConstructorReturn(this, (RadioButtonWidgetAnnotationElement.__proto__ || Object.getPrototypeOf(RadioButtonWidgetAnnotationElement)).call(this, parameters, parameters.renderInteractiveForms));
529
+ return _possibleConstructorReturn(this, _getPrototypeOf(RadioButtonWidgetAnnotationElement).call(this, parameters, parameters.renderInteractiveForms));
442
530
  }
443
531
 
444
532
  _createClass(RadioButtonWidgetAnnotationElement, [{
445
- key: 'render',
533
+ key: "render",
446
534
  value: function render() {
447
535
  this.container.className = 'buttonWidgetAnnotation radioButton';
448
536
  var element = document.createElement('input');
449
537
  element.disabled = this.data.readOnly;
450
538
  element.type = 'radio';
451
539
  element.name = this.data.fieldName;
540
+
452
541
  if (this.data.fieldValue === this.data.buttonValue) {
453
542
  element.setAttribute('checked', true);
454
543
  }
544
+
455
545
  this.container.appendChild(element);
456
546
  return this.container;
457
547
  }
@@ -460,19 +550,22 @@ var RadioButtonWidgetAnnotationElement = function (_WidgetAnnotationElem3) {
460
550
  return RadioButtonWidgetAnnotationElement;
461
551
  }(WidgetAnnotationElement);
462
552
 
463
- var PushButtonWidgetAnnotationElement = function (_LinkAnnotationElemen) {
553
+ var PushButtonWidgetAnnotationElement =
554
+ /*#__PURE__*/
555
+ function (_LinkAnnotationElemen) {
464
556
  _inherits(PushButtonWidgetAnnotationElement, _LinkAnnotationElemen);
465
557
 
466
558
  function PushButtonWidgetAnnotationElement() {
467
559
  _classCallCheck(this, PushButtonWidgetAnnotationElement);
468
560
 
469
- return _possibleConstructorReturn(this, (PushButtonWidgetAnnotationElement.__proto__ || Object.getPrototypeOf(PushButtonWidgetAnnotationElement)).apply(this, arguments));
561
+ return _possibleConstructorReturn(this, _getPrototypeOf(PushButtonWidgetAnnotationElement).apply(this, arguments));
470
562
  }
471
563
 
472
564
  _createClass(PushButtonWidgetAnnotationElement, [{
473
- key: 'render',
565
+ key: "render",
474
566
  value: function render() {
475
- var container = _get(PushButtonWidgetAnnotationElement.prototype.__proto__ || Object.getPrototypeOf(PushButtonWidgetAnnotationElement.prototype), 'render', this).call(this);
567
+ var container = _get(_getPrototypeOf(PushButtonWidgetAnnotationElement.prototype), "render", this).call(this);
568
+
476
569
  container.className = 'buttonWidgetAnnotation pushButton';
477
570
  return container;
478
571
  }
@@ -481,37 +574,45 @@ var PushButtonWidgetAnnotationElement = function (_LinkAnnotationElemen) {
481
574
  return PushButtonWidgetAnnotationElement;
482
575
  }(LinkAnnotationElement);
483
576
 
484
- var ChoiceWidgetAnnotationElement = function (_WidgetAnnotationElem4) {
577
+ var ChoiceWidgetAnnotationElement =
578
+ /*#__PURE__*/
579
+ function (_WidgetAnnotationElem4) {
485
580
  _inherits(ChoiceWidgetAnnotationElement, _WidgetAnnotationElem4);
486
581
 
487
582
  function ChoiceWidgetAnnotationElement(parameters) {
488
583
  _classCallCheck(this, ChoiceWidgetAnnotationElement);
489
584
 
490
- return _possibleConstructorReturn(this, (ChoiceWidgetAnnotationElement.__proto__ || Object.getPrototypeOf(ChoiceWidgetAnnotationElement)).call(this, parameters, parameters.renderInteractiveForms));
585
+ return _possibleConstructorReturn(this, _getPrototypeOf(ChoiceWidgetAnnotationElement).call(this, parameters, parameters.renderInteractiveForms));
491
586
  }
492
587
 
493
588
  _createClass(ChoiceWidgetAnnotationElement, [{
494
- key: 'render',
589
+ key: "render",
495
590
  value: function render() {
496
591
  this.container.className = 'choiceWidgetAnnotation';
497
592
  var selectElement = document.createElement('select');
498
593
  selectElement.disabled = this.data.readOnly;
594
+
499
595
  if (!this.data.combo) {
500
596
  selectElement.size = this.data.options.length;
597
+
501
598
  if (this.data.multiSelect) {
502
599
  selectElement.multiple = true;
503
600
  }
504
601
  }
602
+
505
603
  for (var i = 0, ii = this.data.options.length; i < ii; i++) {
506
604
  var option = this.data.options[i];
507
605
  var optionElement = document.createElement('option');
508
606
  optionElement.textContent = option.displayValue;
509
607
  optionElement.value = option.exportValue;
608
+
510
609
  if (this.data.fieldValue.includes(option.displayValue)) {
511
610
  optionElement.setAttribute('selected', true);
512
611
  }
612
+
513
613
  selectElement.appendChild(optionElement);
514
614
  }
615
+
515
616
  this.container.appendChild(selectElement);
516
617
  return this.container;
517
618
  }
@@ -520,29 +621,35 @@ var ChoiceWidgetAnnotationElement = function (_WidgetAnnotationElem4) {
520
621
  return ChoiceWidgetAnnotationElement;
521
622
  }(WidgetAnnotationElement);
522
623
 
523
- var PopupAnnotationElement = function (_AnnotationElement4) {
624
+ var PopupAnnotationElement =
625
+ /*#__PURE__*/
626
+ function (_AnnotationElement4) {
524
627
  _inherits(PopupAnnotationElement, _AnnotationElement4);
525
628
 
526
629
  function PopupAnnotationElement(parameters) {
527
630
  _classCallCheck(this, PopupAnnotationElement);
528
631
 
529
632
  var isRenderable = !!(parameters.data.title || parameters.data.contents);
530
- return _possibleConstructorReturn(this, (PopupAnnotationElement.__proto__ || Object.getPrototypeOf(PopupAnnotationElement)).call(this, parameters, isRenderable));
633
+ return _possibleConstructorReturn(this, _getPrototypeOf(PopupAnnotationElement).call(this, parameters, isRenderable));
531
634
  }
532
635
 
533
636
  _createClass(PopupAnnotationElement, [{
534
- key: 'render',
637
+ key: "render",
535
638
  value: function render() {
536
639
  var IGNORE_TYPES = ['Line', 'Square', 'Circle', 'PolyLine', 'Polygon', 'Ink'];
537
640
  this.container.className = 'popupAnnotation';
641
+
538
642
  if (IGNORE_TYPES.includes(this.data.parentType)) {
539
643
  return this.container;
540
644
  }
645
+
541
646
  var selector = '[data-annotation-id="' + this.data.parentId + '"]';
542
647
  var parentElement = this.layer.querySelector(selector);
648
+
543
649
  if (!parentElement) {
544
650
  return this.container;
545
651
  }
652
+
546
653
  var popup = new PopupElement({
547
654
  container: this.container,
548
655
  trigger: parentElement,
@@ -562,7 +669,9 @@ var PopupAnnotationElement = function (_AnnotationElement4) {
562
669
  return PopupAnnotationElement;
563
670
  }(AnnotationElement);
564
671
 
565
- var PopupElement = function () {
672
+ var PopupElement =
673
+ /*#__PURE__*/
674
+ function () {
566
675
  function PopupElement(parameters) {
567
676
  _classCallCheck(this, PopupElement);
568
677
 
@@ -576,7 +685,7 @@ var PopupElement = function () {
576
685
  }
577
686
 
578
687
  _createClass(PopupElement, [{
579
- key: 'render',
688
+ key: "render",
580
689
  value: function render() {
581
690
  var BACKGROUND_ENLIGHT = 0.7;
582
691
  var wrapper = document.createElement('div');
@@ -586,13 +695,16 @@ var PopupElement = function () {
586
695
  var popup = document.createElement('div');
587
696
  popup.className = 'popup';
588
697
  var color = this.color;
698
+
589
699
  if (color) {
590
700
  var r = BACKGROUND_ENLIGHT * (255 - color[0]) + color[0];
591
701
  var g = BACKGROUND_ENLIGHT * (255 - color[1]) + color[1];
592
702
  var b = BACKGROUND_ENLIGHT * (255 - color[2]) + color[2];
593
703
  popup.style.backgroundColor = _util.Util.makeCssRgb(r | 0, g | 0, b | 0);
594
704
  }
705
+
595
706
  var contents = this._formatContents(this.contents);
707
+
596
708
  var title = document.createElement('h1');
597
709
  title.textContent = this.title;
598
710
  this.trigger.addEventListener('click', this._toggle.bind(this));
@@ -605,21 +717,24 @@ var PopupElement = function () {
605
717
  return wrapper;
606
718
  }
607
719
  }, {
608
- key: '_formatContents',
720
+ key: "_formatContents",
609
721
  value: function _formatContents(contents) {
610
722
  var p = document.createElement('p');
611
723
  var lines = contents.split(/(?:\r\n?|\n)/);
724
+
612
725
  for (var i = 0, ii = lines.length; i < ii; ++i) {
613
726
  var line = lines[i];
614
727
  p.appendChild(document.createTextNode(line));
728
+
615
729
  if (i < ii - 1) {
616
730
  p.appendChild(document.createElement('br'));
617
731
  }
618
732
  }
733
+
619
734
  return p;
620
735
  }
621
736
  }, {
622
- key: '_toggle',
737
+ key: "_toggle",
623
738
  value: function _toggle() {
624
739
  if (this.pinned) {
625
740
  this._hide(true);
@@ -628,26 +743,28 @@ var PopupElement = function () {
628
743
  }
629
744
  }
630
745
  }, {
631
- key: '_show',
746
+ key: "_show",
632
747
  value: function _show() {
633
748
  var pin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
634
749
 
635
750
  if (pin) {
636
751
  this.pinned = true;
637
752
  }
753
+
638
754
  if (this.hideElement.hasAttribute('hidden')) {
639
755
  this.hideElement.removeAttribute('hidden');
640
756
  this.container.style.zIndex += 1;
641
757
  }
642
758
  }
643
759
  }, {
644
- key: '_hide',
760
+ key: "_hide",
645
761
  value: function _hide() {
646
762
  var unpin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
647
763
 
648
764
  if (unpin) {
649
765
  this.pinned = false;
650
766
  }
767
+
651
768
  if (!this.hideElement.hasAttribute('hidden') && !this.pinned) {
652
769
  this.hideElement.setAttribute('hidden', true);
653
770
  this.container.style.zIndex -= 1;
@@ -658,18 +775,20 @@ var PopupElement = function () {
658
775
  return PopupElement;
659
776
  }();
660
777
 
661
- var LineAnnotationElement = function (_AnnotationElement5) {
778
+ var LineAnnotationElement =
779
+ /*#__PURE__*/
780
+ function (_AnnotationElement5) {
662
781
  _inherits(LineAnnotationElement, _AnnotationElement5);
663
782
 
664
783
  function LineAnnotationElement(parameters) {
665
784
  _classCallCheck(this, LineAnnotationElement);
666
785
 
667
786
  var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
668
- return _possibleConstructorReturn(this, (LineAnnotationElement.__proto__ || Object.getPrototypeOf(LineAnnotationElement)).call(this, parameters, isRenderable, true));
787
+ return _possibleConstructorReturn(this, _getPrototypeOf(LineAnnotationElement).call(this, parameters, isRenderable, true));
669
788
  }
670
789
 
671
790
  _createClass(LineAnnotationElement, [{
672
- key: 'render',
791
+ key: "render",
673
792
  value: function render() {
674
793
  this.container.className = 'lineAnnotation';
675
794
  var data = this.data;
@@ -685,7 +804,9 @@ var LineAnnotationElement = function (_AnnotationElement5) {
685
804
  line.setAttribute('stroke', 'transparent');
686
805
  svg.appendChild(line);
687
806
  this.container.append(svg);
807
+
688
808
  this._createPopup(this.container, line, data);
809
+
689
810
  return this.container;
690
811
  }
691
812
  }]);
@@ -693,18 +814,20 @@ var LineAnnotationElement = function (_AnnotationElement5) {
693
814
  return LineAnnotationElement;
694
815
  }(AnnotationElement);
695
816
 
696
- var SquareAnnotationElement = function (_AnnotationElement6) {
817
+ var SquareAnnotationElement =
818
+ /*#__PURE__*/
819
+ function (_AnnotationElement6) {
697
820
  _inherits(SquareAnnotationElement, _AnnotationElement6);
698
821
 
699
822
  function SquareAnnotationElement(parameters) {
700
823
  _classCallCheck(this, SquareAnnotationElement);
701
824
 
702
825
  var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
703
- return _possibleConstructorReturn(this, (SquareAnnotationElement.__proto__ || Object.getPrototypeOf(SquareAnnotationElement)).call(this, parameters, isRenderable, true));
826
+ return _possibleConstructorReturn(this, _getPrototypeOf(SquareAnnotationElement).call(this, parameters, isRenderable, true));
704
827
  }
705
828
 
706
829
  _createClass(SquareAnnotationElement, [{
707
- key: 'render',
830
+ key: "render",
708
831
  value: function render() {
709
832
  this.container.className = 'squareAnnotation';
710
833
  var data = this.data;
@@ -722,7 +845,9 @@ var SquareAnnotationElement = function (_AnnotationElement6) {
722
845
  square.setAttribute('fill', 'none');
723
846
  svg.appendChild(square);
724
847
  this.container.append(svg);
848
+
725
849
  this._createPopup(this.container, square, data);
850
+
726
851
  return this.container;
727
852
  }
728
853
  }]);
@@ -730,18 +855,20 @@ var SquareAnnotationElement = function (_AnnotationElement6) {
730
855
  return SquareAnnotationElement;
731
856
  }(AnnotationElement);
732
857
 
733
- var CircleAnnotationElement = function (_AnnotationElement7) {
858
+ var CircleAnnotationElement =
859
+ /*#__PURE__*/
860
+ function (_AnnotationElement7) {
734
861
  _inherits(CircleAnnotationElement, _AnnotationElement7);
735
862
 
736
863
  function CircleAnnotationElement(parameters) {
737
864
  _classCallCheck(this, CircleAnnotationElement);
738
865
 
739
866
  var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
740
- return _possibleConstructorReturn(this, (CircleAnnotationElement.__proto__ || Object.getPrototypeOf(CircleAnnotationElement)).call(this, parameters, isRenderable, true));
867
+ return _possibleConstructorReturn(this, _getPrototypeOf(CircleAnnotationElement).call(this, parameters, isRenderable, true));
741
868
  }
742
869
 
743
870
  _createClass(CircleAnnotationElement, [{
744
- key: 'render',
871
+ key: "render",
745
872
  value: function render() {
746
873
  this.container.className = 'circleAnnotation';
747
874
  var data = this.data;
@@ -759,7 +886,9 @@ var CircleAnnotationElement = function (_AnnotationElement7) {
759
886
  circle.setAttribute('fill', 'none');
760
887
  svg.appendChild(circle);
761
888
  this.container.append(svg);
889
+
762
890
  this._createPopup(this.container, circle, data);
891
+
763
892
  return this.container;
764
893
  }
765
894
  }]);
@@ -767,23 +896,25 @@ var CircleAnnotationElement = function (_AnnotationElement7) {
767
896
  return CircleAnnotationElement;
768
897
  }(AnnotationElement);
769
898
 
770
- var PolylineAnnotationElement = function (_AnnotationElement8) {
899
+ var PolylineAnnotationElement =
900
+ /*#__PURE__*/
901
+ function (_AnnotationElement8) {
771
902
  _inherits(PolylineAnnotationElement, _AnnotationElement8);
772
903
 
773
904
  function PolylineAnnotationElement(parameters) {
905
+ var _this3;
906
+
774
907
  _classCallCheck(this, PolylineAnnotationElement);
775
908
 
776
909
  var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
777
-
778
- var _this15 = _possibleConstructorReturn(this, (PolylineAnnotationElement.__proto__ || Object.getPrototypeOf(PolylineAnnotationElement)).call(this, parameters, isRenderable, true));
779
-
780
- _this15.containerClassName = 'polylineAnnotation';
781
- _this15.svgElementName = 'svg:polyline';
782
- return _this15;
910
+ _this3 = _possibleConstructorReturn(this, _getPrototypeOf(PolylineAnnotationElement).call(this, parameters, isRenderable, true));
911
+ _this3.containerClassName = 'polylineAnnotation';
912
+ _this3.svgElementName = 'svg:polyline';
913
+ return _this3;
783
914
  }
784
915
 
785
916
  _createClass(PolylineAnnotationElement, [{
786
- key: 'render',
917
+ key: "render",
787
918
  value: function render() {
788
919
  this.container.className = this.containerClassName;
789
920
  var data = this.data;
@@ -792,11 +923,13 @@ var PolylineAnnotationElement = function (_AnnotationElement8) {
792
923
  var svg = this.svgFactory.create(width, height);
793
924
  var vertices = data.vertices;
794
925
  var points = [];
926
+
795
927
  for (var i = 0, ii = vertices.length; i < ii; i++) {
796
928
  var x = vertices[i].x - data.rect[0];
797
929
  var y = data.rect[3] - vertices[i].y;
798
930
  points.push(x + ',' + y);
799
931
  }
932
+
800
933
  points = points.join(' ');
801
934
  var borderWidth = data.borderStyle.width;
802
935
  var polyline = this.svgFactory.createElement(this.svgElementName);
@@ -806,7 +939,9 @@ var PolylineAnnotationElement = function (_AnnotationElement8) {
806
939
  polyline.setAttribute('fill', 'none');
807
940
  svg.appendChild(polyline);
808
941
  this.container.append(svg);
942
+
809
943
  this._createPopup(this.container, polyline, data);
944
+
810
945
  return this.container;
811
946
  }
812
947
  }]);
@@ -814,39 +949,44 @@ var PolylineAnnotationElement = function (_AnnotationElement8) {
814
949
  return PolylineAnnotationElement;
815
950
  }(AnnotationElement);
816
951
 
817
- var PolygonAnnotationElement = function (_PolylineAnnotationEl) {
952
+ var PolygonAnnotationElement =
953
+ /*#__PURE__*/
954
+ function (_PolylineAnnotationEl) {
818
955
  _inherits(PolygonAnnotationElement, _PolylineAnnotationEl);
819
956
 
820
957
  function PolygonAnnotationElement(parameters) {
821
- _classCallCheck(this, PolygonAnnotationElement);
958
+ var _this4;
822
959
 
823
- var _this16 = _possibleConstructorReturn(this, (PolygonAnnotationElement.__proto__ || Object.getPrototypeOf(PolygonAnnotationElement)).call(this, parameters));
960
+ _classCallCheck(this, PolygonAnnotationElement);
824
961
 
825
- _this16.containerClassName = 'polygonAnnotation';
826
- _this16.svgElementName = 'svg:polygon';
827
- return _this16;
962
+ _this4 = _possibleConstructorReturn(this, _getPrototypeOf(PolygonAnnotationElement).call(this, parameters));
963
+ _this4.containerClassName = 'polygonAnnotation';
964
+ _this4.svgElementName = 'svg:polygon';
965
+ return _this4;
828
966
  }
829
967
 
830
968
  return PolygonAnnotationElement;
831
969
  }(PolylineAnnotationElement);
832
970
 
833
- var InkAnnotationElement = function (_AnnotationElement9) {
971
+ var InkAnnotationElement =
972
+ /*#__PURE__*/
973
+ function (_AnnotationElement9) {
834
974
  _inherits(InkAnnotationElement, _AnnotationElement9);
835
975
 
836
976
  function InkAnnotationElement(parameters) {
977
+ var _this5;
978
+
837
979
  _classCallCheck(this, InkAnnotationElement);
838
980
 
839
981
  var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
840
-
841
- var _this17 = _possibleConstructorReturn(this, (InkAnnotationElement.__proto__ || Object.getPrototypeOf(InkAnnotationElement)).call(this, parameters, isRenderable, true));
842
-
843
- _this17.containerClassName = 'inkAnnotation';
844
- _this17.svgElementName = 'svg:polyline';
845
- return _this17;
982
+ _this5 = _possibleConstructorReturn(this, _getPrototypeOf(InkAnnotationElement).call(this, parameters, isRenderable, true));
983
+ _this5.containerClassName = 'inkAnnotation';
984
+ _this5.svgElementName = 'svg:polyline';
985
+ return _this5;
846
986
  }
847
987
 
848
988
  _createClass(InkAnnotationElement, [{
849
- key: 'render',
989
+ key: "render",
850
990
  value: function render() {
851
991
  this.container.className = this.containerClassName;
852
992
  var data = this.data;
@@ -854,14 +994,17 @@ var InkAnnotationElement = function (_AnnotationElement9) {
854
994
  var height = data.rect[3] - data.rect[1];
855
995
  var svg = this.svgFactory.create(width, height);
856
996
  var inkLists = data.inkLists;
997
+
857
998
  for (var i = 0, ii = inkLists.length; i < ii; i++) {
858
999
  var inkList = inkLists[i];
859
1000
  var points = [];
1001
+
860
1002
  for (var j = 0, jj = inkList.length; j < jj; j++) {
861
1003
  var x = inkList[j].x - data.rect[0];
862
1004
  var y = data.rect[3] - inkList[j].y;
863
1005
  points.push(x + ',' + y);
864
1006
  }
1007
+
865
1008
  points = points.join(' ');
866
1009
  var borderWidth = data.borderStyle.width;
867
1010
  var polyline = this.svgFactory.createElement(this.svgElementName);
@@ -869,9 +1012,12 @@ var InkAnnotationElement = function (_AnnotationElement9) {
869
1012
  polyline.setAttribute('stroke-width', borderWidth);
870
1013
  polyline.setAttribute('stroke', 'transparent');
871
1014
  polyline.setAttribute('fill', 'none');
1015
+
872
1016
  this._createPopup(this.container, polyline, data);
1017
+
873
1018
  svg.appendChild(polyline);
874
1019
  }
1020
+
875
1021
  this.container.append(svg);
876
1022
  return this.container;
877
1023
  }
@@ -880,23 +1026,27 @@ var InkAnnotationElement = function (_AnnotationElement9) {
880
1026
  return InkAnnotationElement;
881
1027
  }(AnnotationElement);
882
1028
 
883
- var HighlightAnnotationElement = function (_AnnotationElement10) {
1029
+ var HighlightAnnotationElement =
1030
+ /*#__PURE__*/
1031
+ function (_AnnotationElement10) {
884
1032
  _inherits(HighlightAnnotationElement, _AnnotationElement10);
885
1033
 
886
1034
  function HighlightAnnotationElement(parameters) {
887
1035
  _classCallCheck(this, HighlightAnnotationElement);
888
1036
 
889
1037
  var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
890
- return _possibleConstructorReturn(this, (HighlightAnnotationElement.__proto__ || Object.getPrototypeOf(HighlightAnnotationElement)).call(this, parameters, isRenderable, true));
1038
+ return _possibleConstructorReturn(this, _getPrototypeOf(HighlightAnnotationElement).call(this, parameters, isRenderable, true));
891
1039
  }
892
1040
 
893
1041
  _createClass(HighlightAnnotationElement, [{
894
- key: 'render',
1042
+ key: "render",
895
1043
  value: function render() {
896
1044
  this.container.className = 'highlightAnnotation';
1045
+
897
1046
  if (!this.data.hasPopup) {
898
1047
  this._createPopup(this.container, null, this.data);
899
1048
  }
1049
+
900
1050
  return this.container;
901
1051
  }
902
1052
  }]);
@@ -904,23 +1054,27 @@ var HighlightAnnotationElement = function (_AnnotationElement10) {
904
1054
  return HighlightAnnotationElement;
905
1055
  }(AnnotationElement);
906
1056
 
907
- var UnderlineAnnotationElement = function (_AnnotationElement11) {
1057
+ var UnderlineAnnotationElement =
1058
+ /*#__PURE__*/
1059
+ function (_AnnotationElement11) {
908
1060
  _inherits(UnderlineAnnotationElement, _AnnotationElement11);
909
1061
 
910
1062
  function UnderlineAnnotationElement(parameters) {
911
1063
  _classCallCheck(this, UnderlineAnnotationElement);
912
1064
 
913
1065
  var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
914
- return _possibleConstructorReturn(this, (UnderlineAnnotationElement.__proto__ || Object.getPrototypeOf(UnderlineAnnotationElement)).call(this, parameters, isRenderable, true));
1066
+ return _possibleConstructorReturn(this, _getPrototypeOf(UnderlineAnnotationElement).call(this, parameters, isRenderable, true));
915
1067
  }
916
1068
 
917
1069
  _createClass(UnderlineAnnotationElement, [{
918
- key: 'render',
1070
+ key: "render",
919
1071
  value: function render() {
920
1072
  this.container.className = 'underlineAnnotation';
1073
+
921
1074
  if (!this.data.hasPopup) {
922
1075
  this._createPopup(this.container, null, this.data);
923
1076
  }
1077
+
924
1078
  return this.container;
925
1079
  }
926
1080
  }]);
@@ -928,23 +1082,27 @@ var UnderlineAnnotationElement = function (_AnnotationElement11) {
928
1082
  return UnderlineAnnotationElement;
929
1083
  }(AnnotationElement);
930
1084
 
931
- var SquigglyAnnotationElement = function (_AnnotationElement12) {
1085
+ var SquigglyAnnotationElement =
1086
+ /*#__PURE__*/
1087
+ function (_AnnotationElement12) {
932
1088
  _inherits(SquigglyAnnotationElement, _AnnotationElement12);
933
1089
 
934
1090
  function SquigglyAnnotationElement(parameters) {
935
1091
  _classCallCheck(this, SquigglyAnnotationElement);
936
1092
 
937
1093
  var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
938
- return _possibleConstructorReturn(this, (SquigglyAnnotationElement.__proto__ || Object.getPrototypeOf(SquigglyAnnotationElement)).call(this, parameters, isRenderable, true));
1094
+ return _possibleConstructorReturn(this, _getPrototypeOf(SquigglyAnnotationElement).call(this, parameters, isRenderable, true));
939
1095
  }
940
1096
 
941
1097
  _createClass(SquigglyAnnotationElement, [{
942
- key: 'render',
1098
+ key: "render",
943
1099
  value: function render() {
944
1100
  this.container.className = 'squigglyAnnotation';
1101
+
945
1102
  if (!this.data.hasPopup) {
946
1103
  this._createPopup(this.container, null, this.data);
947
1104
  }
1105
+
948
1106
  return this.container;
949
1107
  }
950
1108
  }]);
@@ -952,23 +1110,27 @@ var SquigglyAnnotationElement = function (_AnnotationElement12) {
952
1110
  return SquigglyAnnotationElement;
953
1111
  }(AnnotationElement);
954
1112
 
955
- var StrikeOutAnnotationElement = function (_AnnotationElement13) {
1113
+ var StrikeOutAnnotationElement =
1114
+ /*#__PURE__*/
1115
+ function (_AnnotationElement13) {
956
1116
  _inherits(StrikeOutAnnotationElement, _AnnotationElement13);
957
1117
 
958
1118
  function StrikeOutAnnotationElement(parameters) {
959
1119
  _classCallCheck(this, StrikeOutAnnotationElement);
960
1120
 
961
1121
  var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
962
- return _possibleConstructorReturn(this, (StrikeOutAnnotationElement.__proto__ || Object.getPrototypeOf(StrikeOutAnnotationElement)).call(this, parameters, isRenderable, true));
1122
+ return _possibleConstructorReturn(this, _getPrototypeOf(StrikeOutAnnotationElement).call(this, parameters, isRenderable, true));
963
1123
  }
964
1124
 
965
1125
  _createClass(StrikeOutAnnotationElement, [{
966
- key: 'render',
1126
+ key: "render",
967
1127
  value: function render() {
968
1128
  this.container.className = 'strikeoutAnnotation';
1129
+
969
1130
  if (!this.data.hasPopup) {
970
1131
  this._createPopup(this.container, null, this.data);
971
1132
  }
1133
+
972
1134
  return this.container;
973
1135
  }
974
1136
  }]);
@@ -976,23 +1138,27 @@ var StrikeOutAnnotationElement = function (_AnnotationElement13) {
976
1138
  return StrikeOutAnnotationElement;
977
1139
  }(AnnotationElement);
978
1140
 
979
- var StampAnnotationElement = function (_AnnotationElement14) {
1141
+ var StampAnnotationElement =
1142
+ /*#__PURE__*/
1143
+ function (_AnnotationElement14) {
980
1144
  _inherits(StampAnnotationElement, _AnnotationElement14);
981
1145
 
982
1146
  function StampAnnotationElement(parameters) {
983
1147
  _classCallCheck(this, StampAnnotationElement);
984
1148
 
985
1149
  var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents);
986
- return _possibleConstructorReturn(this, (StampAnnotationElement.__proto__ || Object.getPrototypeOf(StampAnnotationElement)).call(this, parameters, isRenderable, true));
1150
+ return _possibleConstructorReturn(this, _getPrototypeOf(StampAnnotationElement).call(this, parameters, isRenderable, true));
987
1151
  }
988
1152
 
989
1153
  _createClass(StampAnnotationElement, [{
990
- key: 'render',
1154
+ key: "render",
991
1155
  value: function render() {
992
1156
  this.container.className = 'stampAnnotation';
1157
+
993
1158
  if (!this.data.hasPopup) {
994
1159
  this._createPopup(this.container, null, this.data);
995
1160
  }
1161
+
996
1162
  return this.container;
997
1163
  }
998
1164
  }]);
@@ -1000,52 +1166,59 @@ var StampAnnotationElement = function (_AnnotationElement14) {
1000
1166
  return StampAnnotationElement;
1001
1167
  }(AnnotationElement);
1002
1168
 
1003
- var FileAttachmentAnnotationElement = function (_AnnotationElement15) {
1169
+ var FileAttachmentAnnotationElement =
1170
+ /*#__PURE__*/
1171
+ function (_AnnotationElement15) {
1004
1172
  _inherits(FileAttachmentAnnotationElement, _AnnotationElement15);
1005
1173
 
1006
1174
  function FileAttachmentAnnotationElement(parameters) {
1007
- _classCallCheck(this, FileAttachmentAnnotationElement);
1175
+ var _this6;
1008
1176
 
1009
- var _this23 = _possibleConstructorReturn(this, (FileAttachmentAnnotationElement.__proto__ || Object.getPrototypeOf(FileAttachmentAnnotationElement)).call(this, parameters, true));
1177
+ _classCallCheck(this, FileAttachmentAnnotationElement);
1010
1178
 
1011
- var _this23$data$file = _this23.data.file,
1012
- filename = _this23$data$file.filename,
1013
- content = _this23$data$file.content;
1179
+ _this6 = _possibleConstructorReturn(this, _getPrototypeOf(FileAttachmentAnnotationElement).call(this, parameters, true));
1180
+ var _this6$data$file = _this6.data.file,
1181
+ filename = _this6$data$file.filename,
1182
+ content = _this6$data$file.content;
1183
+ _this6.filename = (0, _dom_utils.getFilenameFromUrl)(filename);
1184
+ _this6.content = content;
1014
1185
 
1015
- _this23.filename = (0, _dom_utils.getFilenameFromUrl)(filename);
1016
- _this23.content = content;
1017
- if (_this23.linkService.eventBus) {
1018
- _this23.linkService.eventBus.dispatch('fileattachmentannotation', {
1019
- source: _this23,
1186
+ if (_this6.linkService.eventBus) {
1187
+ _this6.linkService.eventBus.dispatch('fileattachmentannotation', {
1188
+ source: _assertThisInitialized(_assertThisInitialized(_this6)),
1020
1189
  id: (0, _util.stringToPDFString)(filename),
1021
1190
  filename: filename,
1022
1191
  content: content
1023
1192
  });
1024
1193
  }
1025
- return _this23;
1194
+
1195
+ return _this6;
1026
1196
  }
1027
1197
 
1028
1198
  _createClass(FileAttachmentAnnotationElement, [{
1029
- key: 'render',
1199
+ key: "render",
1030
1200
  value: function render() {
1031
1201
  this.container.className = 'fileAttachmentAnnotation';
1032
1202
  var trigger = document.createElement('div');
1033
1203
  trigger.style.height = this.container.style.height;
1034
1204
  trigger.style.width = this.container.style.width;
1035
1205
  trigger.addEventListener('dblclick', this._download.bind(this));
1206
+
1036
1207
  if (!this.data.hasPopup && (this.data.title || this.data.contents)) {
1037
1208
  this._createPopup(this.container, trigger, this.data);
1038
1209
  }
1210
+
1039
1211
  this.container.appendChild(trigger);
1040
1212
  return this.container;
1041
1213
  }
1042
1214
  }, {
1043
- key: '_download',
1215
+ key: "_download",
1044
1216
  value: function _download() {
1045
1217
  if (!this.downloadManager) {
1046
1218
  (0, _util.warn)('Download cannot be started due to unavailable download manager');
1047
1219
  return;
1048
1220
  }
1221
+
1049
1222
  this.downloadManager.downloadData(this.content, this.filename, '');
1050
1223
  }
1051
1224
  }]);
@@ -1053,19 +1226,23 @@ var FileAttachmentAnnotationElement = function (_AnnotationElement15) {
1053
1226
  return FileAttachmentAnnotationElement;
1054
1227
  }(AnnotationElement);
1055
1228
 
1056
- var AnnotationLayer = function () {
1229
+ var AnnotationLayer =
1230
+ /*#__PURE__*/
1231
+ function () {
1057
1232
  function AnnotationLayer() {
1058
1233
  _classCallCheck(this, AnnotationLayer);
1059
1234
  }
1060
1235
 
1061
1236
  _createClass(AnnotationLayer, null, [{
1062
- key: 'render',
1237
+ key: "render",
1063
1238
  value: function render(parameters) {
1064
1239
  for (var i = 0, ii = parameters.annotations.length; i < ii; i++) {
1065
1240
  var data = parameters.annotations[i];
1241
+
1066
1242
  if (!data) {
1067
1243
  continue;
1068
1244
  }
1245
+
1069
1246
  var element = AnnotationElementFactory.create({
1070
1247
  data: data,
1071
1248
  layer: parameters.div,
@@ -1077,21 +1254,24 @@ var AnnotationLayer = function () {
1077
1254
  renderInteractiveForms: parameters.renderInteractiveForms || false,
1078
1255
  svgFactory: new _dom_utils.DOMSVGFactory()
1079
1256
  });
1257
+
1080
1258
  if (element.isRenderable) {
1081
1259
  parameters.div.appendChild(element.render());
1082
1260
  }
1083
1261
  }
1084
1262
  }
1085
1263
  }, {
1086
- key: 'update',
1264
+ key: "update",
1087
1265
  value: function update(parameters) {
1088
1266
  for (var i = 0, ii = parameters.annotations.length; i < ii; i++) {
1089
1267
  var data = parameters.annotations[i];
1090
1268
  var element = parameters.div.querySelector('[data-annotation-id="' + data.id + '"]');
1269
+
1091
1270
  if (element) {
1092
1271
  element.style.transform = 'matrix(' + parameters.viewport.transform.join(',') + ')';
1093
1272
  }
1094
1273
  }
1274
+
1095
1275
  parameters.div.removeAttribute('hidden');
1096
1276
  }
1097
1277
  }]);