pdfjs-dist 2.0.550 → 2.3.200

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