pdfjs-dist 2.3.200 → 2.4.456

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