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