pdfjs-dist 2.1.266 → 2.5.207

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 (191) hide show
  1. package/CODE_OF_CONDUCT.md +15 -0
  2. package/README.md +4 -0
  3. package/bower.json +1 -1
  4. package/build/pdf.js +8382 -18492
  5. package/build/pdf.js.map +1 -1
  6. package/build/pdf.min.js +22 -1
  7. package/build/pdf.worker.entry.js +5 -3
  8. package/build/pdf.worker.js +20417 -29816
  9. package/build/pdf.worker.js.map +1 -1
  10. package/build/pdf.worker.min.js +22 -1
  11. package/es5/build/pdf.js +25688 -0
  12. package/es5/build/pdf.js.map +1 -0
  13. package/{lib/shared/global_scope.js → es5/build/pdf.worker.entry.js} +5 -10
  14. package/es5/build/pdf.worker.js +58239 -0
  15. package/es5/build/pdf.worker.js.map +1 -0
  16. package/es5/web/images/annotation-check.svg +11 -0
  17. package/es5/web/images/annotation-comment.svg +16 -0
  18. package/es5/web/images/annotation-help.svg +26 -0
  19. package/es5/web/images/annotation-insert.svg +10 -0
  20. package/es5/web/images/annotation-key.svg +11 -0
  21. package/es5/web/images/annotation-newparagraph.svg +11 -0
  22. package/es5/web/images/annotation-noicon.svg +7 -0
  23. package/es5/web/images/annotation-note.svg +42 -0
  24. package/es5/web/images/annotation-paragraph.svg +16 -0
  25. package/es5/web/images/loading-icon.gif +0 -0
  26. package/es5/web/images/shadow.png +0 -0
  27. package/es5/web/images/texture.png +0 -0
  28. package/es5/web/pdf_viewer.css +403 -0
  29. package/es5/web/pdf_viewer.js +7742 -0
  30. package/es5/web/pdf_viewer.js.map +1 -0
  31. package/image_decoders/pdf.image_decoders.js +1475 -4897
  32. package/image_decoders/pdf.image_decoders.js.map +1 -1
  33. package/image_decoders/pdf.image_decoders.min.js +22 -1
  34. package/lib/README.md +7 -0
  35. package/lib/core/annotation.js +750 -899
  36. package/lib/core/arithmetic_decoder.js +81 -97
  37. package/lib/core/bidi.js +54 -46
  38. package/lib/core/ccitt.js +88 -81
  39. package/lib/core/ccitt_stream.js +15 -14
  40. package/lib/core/cff_parser.js +235 -183
  41. package/lib/core/charsets.js +4 -4
  42. package/lib/core/chunked_stream.js +447 -542
  43. package/lib/core/cmap.js +222 -264
  44. package/lib/core/colorspace.js +699 -863
  45. package/lib/core/core_utils.js +152 -0
  46. package/lib/core/crypto.js +379 -437
  47. package/lib/core/document.js +573 -660
  48. package/lib/core/encodings.js +15 -15
  49. package/lib/core/evaluator.js +1103 -868
  50. package/lib/core/font_renderer.js +135 -178
  51. package/lib/core/fonts.js +570 -491
  52. package/lib/core/function.js +291 -288
  53. package/lib/core/glyphlist.js +4527 -4526
  54. package/lib/core/image.js +145 -149
  55. package/lib/core/image_utils.js +170 -0
  56. package/lib/core/jbig2.js +325 -316
  57. package/lib/core/jbig2_stream.js +18 -17
  58. package/lib/core/jpeg_stream.js +21 -26
  59. package/lib/core/jpg.js +284 -232
  60. package/lib/core/jpx.js +161 -143
  61. package/lib/core/jpx_stream.js +28 -28
  62. package/lib/core/metrics.js +2929 -2929
  63. package/lib/core/murmurhash3.js +90 -101
  64. package/lib/core/obj.js +1183 -1157
  65. package/lib/core/operator_list.js +99 -67
  66. package/lib/core/parser.js +972 -911
  67. package/lib/core/pattern.js +87 -70
  68. package/lib/core/pdf_manager.js +150 -315
  69. package/lib/core/primitives.js +83 -56
  70. package/lib/core/ps_parser.js +175 -214
  71. package/lib/core/standard_fonts.js +237 -236
  72. package/lib/core/stream.js +94 -74
  73. package/lib/core/type1_parser.js +87 -69
  74. package/lib/core/unicode.js +1654 -1654
  75. package/lib/core/worker.js +193 -390
  76. package/lib/core/worker_stream.js +168 -0
  77. package/lib/display/annotation_layer.js +741 -972
  78. package/lib/display/api.js +1500 -1791
  79. package/lib/display/api_compatibility.js +12 -17
  80. package/lib/display/canvas.js +165 -165
  81. package/lib/display/content_disposition.js +40 -59
  82. package/lib/display/display_utils.js +515 -0
  83. package/lib/display/fetch_stream.js +183 -298
  84. package/lib/display/font_loader.js +273 -413
  85. package/lib/display/metadata.js +86 -98
  86. package/lib/display/network.js +266 -359
  87. package/lib/display/network_utils.js +25 -18
  88. package/lib/display/node_stream.js +285 -458
  89. package/lib/display/pattern_helper.js +113 -65
  90. package/lib/display/svg.js +1166 -901
  91. package/lib/display/text_layer.js +156 -132
  92. package/lib/display/transport_stream.js +262 -278
  93. package/lib/display/webgl.js +70 -83
  94. package/lib/display/worker_options.js +3 -3
  95. package/lib/display/xml_parser.js +303 -392
  96. package/lib/examples/node/domstubs.js +40 -37
  97. package/lib/pdf.js +226 -59
  98. package/lib/pdf.worker.js +14 -6
  99. package/lib/shared/compatibility.js +3 -246
  100. package/lib/shared/is_node.js +7 -6
  101. package/lib/shared/message_handler.js +327 -332
  102. package/lib/shared/util.js +266 -416
  103. package/lib/test/unit/annotation_spec.js +1555 -701
  104. package/lib/test/unit/api_spec.js +802 -604
  105. package/lib/test/unit/bidi_spec.js +7 -7
  106. package/lib/test/unit/cff_parser_spec.js +84 -69
  107. package/lib/test/unit/clitests_helper.js +7 -9
  108. package/lib/test/unit/cmap_spec.js +74 -76
  109. package/lib/test/unit/colorspace_spec.js +166 -161
  110. package/lib/test/unit/core_utils_spec.js +211 -0
  111. package/lib/test/unit/crypto_spec.js +181 -181
  112. package/lib/test/unit/custom_spec.js +20 -22
  113. package/lib/test/unit/display_svg_spec.js +34 -39
  114. package/lib/test/unit/display_utils_spec.js +263 -0
  115. package/lib/test/unit/document_spec.js +16 -21
  116. package/lib/test/unit/encodings_spec.js +12 -34
  117. package/lib/test/unit/evaluator_spec.js +83 -83
  118. package/lib/test/unit/fetch_stream_spec.js +111 -0
  119. package/lib/test/unit/function_spec.js +206 -204
  120. package/lib/test/unit/jasmine-boot.js +46 -30
  121. package/lib/test/unit/message_handler_spec.js +173 -159
  122. package/lib/test/unit/metadata_spec.js +69 -69
  123. package/lib/test/unit/murmurhash3_spec.js +12 -12
  124. package/lib/test/unit/network_spec.js +13 -61
  125. package/lib/test/unit/network_utils_spec.js +183 -119
  126. package/lib/test/unit/node_stream_spec.js +78 -92
  127. package/lib/test/unit/parser_spec.js +172 -114
  128. package/lib/test/unit/pdf_find_controller_spec.js +55 -86
  129. package/lib/test/unit/pdf_find_utils_spec.js +32 -32
  130. package/lib/test/unit/pdf_history_spec.js +32 -32
  131. package/lib/test/unit/primitives_spec.js +140 -125
  132. package/lib/test/unit/stream_spec.js +16 -14
  133. package/lib/test/unit/test_utils.js +131 -143
  134. package/lib/test/unit/testreporter.js +19 -19
  135. package/lib/test/unit/type1_parser_spec.js +42 -42
  136. package/lib/test/unit/ui_utils_spec.js +297 -459
  137. package/lib/test/unit/unicode_spec.js +38 -38
  138. package/lib/test/unit/util_spec.js +121 -305
  139. package/lib/web/annotation_layer_builder.js +66 -103
  140. package/lib/web/app.js +1328 -1214
  141. package/lib/web/app_options.js +105 -107
  142. package/lib/web/base_viewer.js +824 -838
  143. package/lib/web/chromecom.js +165 -252
  144. package/lib/web/debugger.js +149 -205
  145. package/lib/web/download_manager.js +39 -55
  146. package/lib/web/firefox_print_service.js +37 -27
  147. package/lib/web/firefoxcom.js +212 -363
  148. package/lib/web/genericcom.js +26 -108
  149. package/lib/web/genericl10n.js +24 -153
  150. package/lib/web/grab_to_pan.js +32 -30
  151. package/lib/web/interfaces.js +80 -254
  152. package/lib/web/overlay_manager.js +70 -246
  153. package/lib/web/password_prompt.js +38 -64
  154. package/lib/web/pdf_attachment_viewer.js +113 -131
  155. package/lib/web/pdf_cursor_tools.js +75 -102
  156. package/lib/web/pdf_document_properties.js +221 -306
  157. package/lib/web/pdf_find_bar.js +136 -170
  158. package/lib/web/pdf_find_controller.js +491 -548
  159. package/lib/web/pdf_find_utils.js +13 -13
  160. package/lib/web/pdf_history.js +397 -406
  161. package/lib/web/pdf_link_service.js +304 -348
  162. package/lib/web/pdf_outline_viewer.js +140 -175
  163. package/lib/web/pdf_page_view.js +452 -523
  164. package/lib/web/pdf_presentation_mode.js +308 -357
  165. package/lib/web/pdf_print_service.js +90 -104
  166. package/lib/web/pdf_rendering_queue.js +84 -108
  167. package/lib/web/pdf_sidebar.js +276 -306
  168. package/lib/web/pdf_sidebar_resizer.js +92 -119
  169. package/lib/web/pdf_single_page_viewer.js +77 -126
  170. package/lib/web/pdf_thumbnail_view.js +276 -297
  171. package/lib/web/pdf_thumbnail_viewer.js +186 -206
  172. package/lib/web/pdf_viewer.component.js +20 -21
  173. package/lib/web/pdf_viewer.js +55 -115
  174. package/lib/web/preferences.js +82 -286
  175. package/lib/web/secondary_toolbar.js +164 -196
  176. package/lib/web/text_layer_builder.js +282 -339
  177. package/lib/web/toolbar.js +217 -210
  178. package/lib/web/ui_utils.js +267 -420
  179. package/lib/web/view_history.js +52 -226
  180. package/lib/web/viewer_compatibility.js +21 -6
  181. package/package.json +2 -9
  182. package/web/pdf_viewer.css +35 -25
  183. package/web/pdf_viewer.js +3489 -4855
  184. package/web/pdf_viewer.js.map +1 -1
  185. package/webpack.js +14 -5
  186. package/external/streams/streams-lib.js +0 -3962
  187. package/external/url/url-lib.js +0 -627
  188. package/lib/display/dom_utils.js +0 -494
  189. package/lib/shared/streams_polyfill.js +0 -43
  190. package/lib/shared/url_polyfill.js +0 -56
  191. package/lib/test/unit/dom_utils_spec.js +0 -89
@@ -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 2018 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.
@@ -24,31 +24,21 @@
24
24
  Object.defineProperty(exports, "__esModule", {
25
25
  value: true
26
26
  });
27
- exports.toRomanNumerals = toRomanNumerals;
28
27
  exports.arrayByteLength = arrayByteLength;
29
28
  exports.arraysToBytes = arraysToBytes;
30
29
  exports.assert = assert;
31
30
  exports.bytesToString = bytesToString;
32
31
  exports.createPromiseCapability = createPromiseCapability;
33
- exports.deprecated = deprecated;
34
- exports.getInheritableProperty = getInheritableProperty;
35
- exports.getLookupTableFactory = getLookupTableFactory;
36
32
  exports.getVerbosityLevel = getVerbosityLevel;
37
33
  exports.info = info;
38
34
  exports.isArrayBuffer = isArrayBuffer;
35
+ exports.isArrayEqual = isArrayEqual;
39
36
  exports.isBool = isBool;
40
37
  exports.isEmptyObj = isEmptyObj;
41
38
  exports.isNum = isNum;
42
39
  exports.isString = isString;
43
- exports.isSpace = isSpace;
44
40
  exports.isSameOrigin = isSameOrigin;
45
41
  exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
46
- exports.isLittleEndian = isLittleEndian;
47
- exports.isEvalSupported = isEvalSupported;
48
- exports.log2 = log2;
49
- exports.readInt8 = readInt8;
50
- exports.readUint16 = readUint16;
51
- exports.readUint32 = readUint32;
52
42
  exports.removeNullCharacters = removeNullCharacters;
53
43
  exports.setVerbosityLevel = setVerbosityLevel;
54
44
  exports.shadow = shadow;
@@ -59,39 +49,15 @@ exports.stringToUTF8String = stringToUTF8String;
59
49
  exports.utf8StringToString = utf8StringToString;
60
50
  exports.warn = warn;
61
51
  exports.unreachable = unreachable;
62
- Object.defineProperty(exports, "ReadableStream", {
63
- enumerable: true,
64
- get: function get() {
65
- return _streams_polyfill.ReadableStream;
66
- }
67
- });
68
- Object.defineProperty(exports, "URL", {
69
- enumerable: true,
70
- get: function get() {
71
- return _url_polyfill.URL;
72
- }
73
- });
74
- exports.createObjectURL = exports.FormatError = exports.XRefParseException = exports.XRefEntryException = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.NativeImageDecoding = exports.MissingPDFException = exports.MissingDataException = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = void 0;
52
+ exports.IsEvalSupportedCached = exports.IsLittleEndianCached = exports.createObjectURL = exports.FormatError = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.MissingPDFException = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = exports.BaseException = void 0;
75
53
 
76
- require("./compatibility");
54
+ require("./compatibility.js");
77
55
 
78
- var _streams_polyfill = require("./streams_polyfill");
79
-
80
- var _url_polyfill = require("./url_polyfill");
81
-
82
- 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); }
83
-
84
- var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
56
+ const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
85
57
  exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
86
- var FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
58
+ const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
87
59
  exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
88
- var NativeImageDecoding = {
89
- NONE: 'none',
90
- DECODE: 'decode',
91
- DISPLAY: 'display'
92
- };
93
- exports.NativeImageDecoding = NativeImageDecoding;
94
- var PermissionFlag = {
60
+ const PermissionFlag = {
95
61
  PRINT: 0x04,
96
62
  MODIFY_CONTENTS: 0x08,
97
63
  COPY: 0x10,
@@ -102,7 +68,7 @@ var PermissionFlag = {
102
68
  PRINT_HIGH_QUALITY: 0x800
103
69
  };
104
70
  exports.PermissionFlag = PermissionFlag;
105
- var TextRenderingMode = {
71
+ const TextRenderingMode = {
106
72
  FILL: 0,
107
73
  STROKE: 1,
108
74
  FILL_STROKE: 2,
@@ -115,13 +81,13 @@ var TextRenderingMode = {
115
81
  ADD_TO_PATH_FLAG: 4
116
82
  };
117
83
  exports.TextRenderingMode = TextRenderingMode;
118
- var ImageKind = {
84
+ const ImageKind = {
119
85
  GRAYSCALE_1BPP: 1,
120
86
  RGB_24BPP: 2,
121
87
  RGBA_32BPP: 3
122
88
  };
123
89
  exports.ImageKind = ImageKind;
124
- var AnnotationType = {
90
+ const AnnotationType = {
125
91
  TEXT: 1,
126
92
  LINK: 2,
127
93
  FREETEXT: 3,
@@ -150,7 +116,30 @@ var AnnotationType = {
150
116
  REDACT: 26
151
117
  };
152
118
  exports.AnnotationType = AnnotationType;
153
- var AnnotationFlag = {
119
+ const AnnotationStateModelType = {
120
+ MARKED: "Marked",
121
+ REVIEW: "Review"
122
+ };
123
+ exports.AnnotationStateModelType = AnnotationStateModelType;
124
+ const AnnotationMarkedState = {
125
+ MARKED: "Marked",
126
+ UNMARKED: "Unmarked"
127
+ };
128
+ exports.AnnotationMarkedState = AnnotationMarkedState;
129
+ const AnnotationReviewState = {
130
+ ACCEPTED: "Accepted",
131
+ REJECTED: "Rejected",
132
+ CANCELLED: "Cancelled",
133
+ COMPLETED: "Completed",
134
+ NONE: "None"
135
+ };
136
+ exports.AnnotationReviewState = AnnotationReviewState;
137
+ const AnnotationReplyType = {
138
+ GROUP: "Group",
139
+ REPLY: "R"
140
+ };
141
+ exports.AnnotationReplyType = AnnotationReplyType;
142
+ const AnnotationFlag = {
154
143
  INVISIBLE: 0x01,
155
144
  HIDDEN: 0x02,
156
145
  PRINT: 0x04,
@@ -163,7 +152,7 @@ var AnnotationFlag = {
163
152
  LOCKEDCONTENTS: 0x200
164
153
  };
165
154
  exports.AnnotationFlag = AnnotationFlag;
166
- var AnnotationFieldFlag = {
155
+ const AnnotationFieldFlag = {
167
156
  READONLY: 0x0000001,
168
157
  REQUIRED: 0x0000002,
169
158
  NOEXPORT: 0x0000004,
@@ -185,7 +174,7 @@ var AnnotationFieldFlag = {
185
174
  COMMITONSELCHANGE: 0x4000000
186
175
  };
187
176
  exports.AnnotationFieldFlag = AnnotationFieldFlag;
188
- var AnnotationBorderStyleType = {
177
+ const AnnotationBorderStyleType = {
189
178
  SOLID: 1,
190
179
  DASHED: 2,
191
180
  BEVELED: 3,
@@ -193,46 +182,46 @@ var AnnotationBorderStyleType = {
193
182
  UNDERLINE: 5
194
183
  };
195
184
  exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
196
- var StreamType = {
197
- UNKNOWN: 0,
198
- FLATE: 1,
199
- LZW: 2,
200
- DCT: 3,
201
- JPX: 4,
202
- JBIG: 5,
203
- A85: 6,
204
- AHX: 7,
205
- CCF: 8,
206
- RL: 9
185
+ const StreamType = {
186
+ UNKNOWN: "UNKNOWN",
187
+ FLATE: "FLATE",
188
+ LZW: "LZW",
189
+ DCT: "DCT",
190
+ JPX: "JPX",
191
+ JBIG: "JBIG",
192
+ A85: "A85",
193
+ AHX: "AHX",
194
+ CCF: "CCF",
195
+ RLX: "RLX"
207
196
  };
208
197
  exports.StreamType = StreamType;
209
- var FontType = {
210
- UNKNOWN: 0,
211
- TYPE1: 1,
212
- TYPE1C: 2,
213
- CIDFONTTYPE0: 3,
214
- CIDFONTTYPE0C: 4,
215
- TRUETYPE: 5,
216
- CIDFONTTYPE2: 6,
217
- TYPE3: 7,
218
- OPENTYPE: 8,
219
- TYPE0: 9,
220
- MMTYPE1: 10
198
+ const FontType = {
199
+ UNKNOWN: "UNKNOWN",
200
+ TYPE1: "TYPE1",
201
+ TYPE1C: "TYPE1C",
202
+ CIDFONTTYPE0: "CIDFONTTYPE0",
203
+ CIDFONTTYPE0C: "CIDFONTTYPE0C",
204
+ TRUETYPE: "TRUETYPE",
205
+ CIDFONTTYPE2: "CIDFONTTYPE2",
206
+ TYPE3: "TYPE3",
207
+ OPENTYPE: "OPENTYPE",
208
+ TYPE0: "TYPE0",
209
+ MMTYPE1: "MMTYPE1"
221
210
  };
222
211
  exports.FontType = FontType;
223
- var VerbosityLevel = {
212
+ const VerbosityLevel = {
224
213
  ERRORS: 0,
225
214
  WARNINGS: 1,
226
215
  INFOS: 5
227
216
  };
228
217
  exports.VerbosityLevel = VerbosityLevel;
229
- var CMapCompressionType = {
218
+ const CMapCompressionType = {
230
219
  NONE: 0,
231
220
  BINARY: 1,
232
221
  STREAM: 2
233
222
  };
234
223
  exports.CMapCompressionType = CMapCompressionType;
235
- var OPS = {
224
+ const OPS = {
236
225
  dependency: 1,
237
226
  setLineWidth: 2,
238
227
  setLineCap: 3,
@@ -326,21 +315,33 @@ var OPS = {
326
315
  constructPath: 91
327
316
  };
328
317
  exports.OPS = OPS;
329
- var UNSUPPORTED_FEATURES = {
330
- unknown: 'unknown',
331
- forms: 'forms',
332
- javaScript: 'javaScript',
333
- smask: 'smask',
334
- shadingPattern: 'shadingPattern',
335
- font: 'font'
318
+ const UNSUPPORTED_FEATURES = {
319
+ unknown: "unknown",
320
+ forms: "forms",
321
+ javaScript: "javaScript",
322
+ smask: "smask",
323
+ shadingPattern: "shadingPattern",
324
+ font: "font",
325
+ errorTilingPattern: "errorTilingPattern",
326
+ errorExtGState: "errorExtGState",
327
+ errorXObject: "errorXObject",
328
+ errorFontLoadType3: "errorFontLoadType3",
329
+ errorFontState: "errorFontState",
330
+ errorFontMissing: "errorFontMissing",
331
+ errorFontTranslate: "errorFontTranslate",
332
+ errorColorSpace: "errorColorSpace",
333
+ errorOperatorList: "errorOperatorList",
334
+ errorFontToUnicode: "errorFontToUnicode",
335
+ errorFontLoadNative: "errorFontLoadNative",
336
+ errorFontGetPath: "errorFontGetPath"
336
337
  };
337
338
  exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
338
- var PasswordResponses = {
339
+ const PasswordResponses = {
339
340
  NEED_PASSWORD: 1,
340
341
  INCORRECT_PASSWORD: 2
341
342
  };
342
343
  exports.PasswordResponses = PasswordResponses;
343
- var verbosity = VerbosityLevel.WARNINGS;
344
+ let verbosity = VerbosityLevel.WARNINGS;
344
345
 
345
346
  function setVerbosityLevel(level) {
346
347
  if (Number.isInteger(level)) {
@@ -354,20 +355,16 @@ function getVerbosityLevel() {
354
355
 
355
356
  function info(msg) {
356
357
  if (verbosity >= VerbosityLevel.INFOS) {
357
- console.log('Info: ' + msg);
358
+ console.log(`Info: ${msg}`);
358
359
  }
359
360
  }
360
361
 
361
362
  function warn(msg) {
362
363
  if (verbosity >= VerbosityLevel.WARNINGS) {
363
- console.log('Warning: ' + msg);
364
+ console.log(`Warning: ${msg}`);
364
365
  }
365
366
  }
366
367
 
367
- function deprecated(details) {
368
- console.log('Deprecated API usage: ' + details);
369
- }
370
-
371
368
  function unreachable(msg) {
372
369
  throw new Error(msg);
373
370
  }
@@ -379,17 +376,19 @@ function assert(cond, msg) {
379
376
  }
380
377
 
381
378
  function isSameOrigin(baseUrl, otherUrl) {
379
+ let base;
380
+
382
381
  try {
383
- var base = new _url_polyfill.URL(baseUrl);
382
+ base = new URL(baseUrl);
384
383
 
385
- if (!base.origin || base.origin === 'null') {
384
+ if (!base.origin || base.origin === "null") {
386
385
  return false;
387
386
  }
388
387
  } catch (e) {
389
388
  return false;
390
389
  }
391
390
 
392
- var other = new _url_polyfill.URL(otherUrl, base);
391
+ const other = new URL(otherUrl, base);
393
392
  return base.origin === other.origin;
394
393
  }
395
394
 
@@ -399,11 +398,11 @@ function _isValidProtocol(url) {
399
398
  }
400
399
 
401
400
  switch (url.protocol) {
402
- case 'http:':
403
- case 'https:':
404
- case 'ftp:':
405
- case 'mailto:':
406
- case 'tel:':
401
+ case "http:":
402
+ case "https:":
403
+ case "ftp:":
404
+ case "mailto:":
405
+ case "tel:":
407
406
  return true;
408
407
 
409
408
  default:
@@ -417,7 +416,7 @@ function createValidAbsoluteUrl(url, baseUrl) {
417
416
  }
418
417
 
419
418
  try {
420
- var absoluteUrl = baseUrl ? new _url_polyfill.URL(url, baseUrl) : new _url_polyfill.URL(url);
419
+ const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
421
420
 
422
421
  if (_isValidProtocol(absoluteUrl)) {
423
422
  return absoluteUrl;
@@ -429,7 +428,7 @@ function createValidAbsoluteUrl(url, baseUrl) {
429
428
 
430
429
  function shadow(obj, prop, value) {
431
430
  Object.defineProperty(obj, prop, {
432
- value: value,
431
+ value,
433
432
  enumerable: true,
434
433
  configurable: true,
435
434
  writable: false
@@ -437,191 +436,106 @@ function shadow(obj, prop, value) {
437
436
  return value;
438
437
  }
439
438
 
440
- function getLookupTableFactory(initializer) {
441
- var lookup;
442
- return function () {
443
- if (initializer) {
444
- lookup = Object.create(null);
445
- initializer(lookup);
446
- initializer = null;
439
+ const BaseException = function BaseExceptionClosure() {
440
+ function BaseException(message) {
441
+ if (this.constructor === BaseException) {
442
+ unreachable("Cannot initialize BaseException.");
447
443
  }
448
444
 
449
- return lookup;
450
- };
451
- }
445
+ this.message = message;
446
+ this.name = this.constructor.name;
447
+ }
448
+
449
+ BaseException.prototype = new Error();
450
+ BaseException.constructor = BaseException;
451
+ return BaseException;
452
+ }();
453
+
454
+ exports.BaseException = BaseException;
452
455
 
453
- var PasswordException = function PasswordExceptionClosure() {
454
- function PasswordException(msg, code) {
455
- this.name = 'PasswordException';
456
- this.message = msg;
456
+ class PasswordException extends BaseException {
457
+ constructor(msg, code) {
458
+ super(msg);
457
459
  this.code = code;
458
460
  }
459
461
 
460
- PasswordException.prototype = new Error();
461
- PasswordException.constructor = PasswordException;
462
- return PasswordException;
463
- }();
462
+ }
464
463
 
465
464
  exports.PasswordException = PasswordException;
466
465
 
467
- var UnknownErrorException = function UnknownErrorExceptionClosure() {
468
- function UnknownErrorException(msg, details) {
469
- this.name = 'UnknownErrorException';
470
- this.message = msg;
466
+ class UnknownErrorException extends BaseException {
467
+ constructor(msg, details) {
468
+ super(msg);
471
469
  this.details = details;
472
470
  }
473
471
 
474
- UnknownErrorException.prototype = new Error();
475
- UnknownErrorException.constructor = UnknownErrorException;
476
- return UnknownErrorException;
477
- }();
472
+ }
478
473
 
479
474
  exports.UnknownErrorException = UnknownErrorException;
480
475
 
481
- var InvalidPDFException = function InvalidPDFExceptionClosure() {
482
- function InvalidPDFException(msg) {
483
- this.name = 'InvalidPDFException';
484
- this.message = msg;
485
- }
486
-
487
- InvalidPDFException.prototype = new Error();
488
- InvalidPDFException.constructor = InvalidPDFException;
489
- return InvalidPDFException;
490
- }();
476
+ class InvalidPDFException extends BaseException {}
491
477
 
492
478
  exports.InvalidPDFException = InvalidPDFException;
493
479
 
494
- var MissingPDFException = function MissingPDFExceptionClosure() {
495
- function MissingPDFException(msg) {
496
- this.name = 'MissingPDFException';
497
- this.message = msg;
498
- }
499
-
500
- MissingPDFException.prototype = new Error();
501
- MissingPDFException.constructor = MissingPDFException;
502
- return MissingPDFException;
503
- }();
480
+ class MissingPDFException extends BaseException {}
504
481
 
505
482
  exports.MissingPDFException = MissingPDFException;
506
483
 
507
- var UnexpectedResponseException = function UnexpectedResponseExceptionClosure() {
508
- function UnexpectedResponseException(msg, status) {
509
- this.name = 'UnexpectedResponseException';
510
- this.message = msg;
484
+ class UnexpectedResponseException extends BaseException {
485
+ constructor(msg, status) {
486
+ super(msg);
511
487
  this.status = status;
512
488
  }
513
489
 
514
- UnexpectedResponseException.prototype = new Error();
515
- UnexpectedResponseException.constructor = UnexpectedResponseException;
516
- return UnexpectedResponseException;
517
- }();
490
+ }
518
491
 
519
492
  exports.UnexpectedResponseException = UnexpectedResponseException;
520
493
 
521
- var MissingDataException = function MissingDataExceptionClosure() {
522
- function MissingDataException(begin, end) {
523
- this.begin = begin;
524
- this.end = end;
525
- this.message = 'Missing data [' + begin + ', ' + end + ')';
526
- }
527
-
528
- MissingDataException.prototype = new Error();
529
- MissingDataException.prototype.name = 'MissingDataException';
530
- MissingDataException.constructor = MissingDataException;
531
- return MissingDataException;
532
- }();
533
-
534
- exports.MissingDataException = MissingDataException;
535
-
536
- var XRefEntryException = function XRefEntryExceptionClosure() {
537
- function XRefEntryException(msg) {
538
- this.message = msg;
539
- }
540
-
541
- XRefEntryException.prototype = new Error();
542
- XRefEntryException.prototype.name = 'XRefEntryException';
543
- XRefEntryException.constructor = XRefEntryException;
544
- return XRefEntryException;
545
- }();
546
-
547
- exports.XRefEntryException = XRefEntryException;
548
-
549
- var XRefParseException = function XRefParseExceptionClosure() {
550
- function XRefParseException(msg) {
551
- this.message = msg;
552
- }
553
-
554
- XRefParseException.prototype = new Error();
555
- XRefParseException.prototype.name = 'XRefParseException';
556
- XRefParseException.constructor = XRefParseException;
557
- return XRefParseException;
558
- }();
559
-
560
- exports.XRefParseException = XRefParseException;
561
-
562
- var FormatError = function FormatErrorClosure() {
563
- function FormatError(msg) {
564
- this.message = msg;
565
- }
566
-
567
- FormatError.prototype = new Error();
568
- FormatError.prototype.name = 'FormatError';
569
- FormatError.constructor = FormatError;
570
- return FormatError;
571
- }();
494
+ class FormatError extends BaseException {}
572
495
 
573
496
  exports.FormatError = FormatError;
574
497
 
575
- var AbortException = function AbortExceptionClosure() {
576
- function AbortException(msg) {
577
- this.name = 'AbortException';
578
- this.message = msg;
579
- }
580
-
581
- AbortException.prototype = new Error();
582
- AbortException.constructor = AbortException;
583
- return AbortException;
584
- }();
498
+ class AbortException extends BaseException {}
585
499
 
586
500
  exports.AbortException = AbortException;
587
- var NullCharactersRegExp = /\x00/g;
501
+ const NullCharactersRegExp = /\x00/g;
588
502
 
589
503
  function removeNullCharacters(str) {
590
- if (typeof str !== 'string') {
591
- warn('The argument for removeNullCharacters must be a string.');
504
+ if (typeof str !== "string") {
505
+ warn("The argument for removeNullCharacters must be a string.");
592
506
  return str;
593
507
  }
594
508
 
595
- return str.replace(NullCharactersRegExp, '');
509
+ return str.replace(NullCharactersRegExp, "");
596
510
  }
597
511
 
598
512
  function bytesToString(bytes) {
599
- assert(bytes !== null && _typeof(bytes) === 'object' && bytes.length !== undefined, 'Invalid argument for bytesToString');
600
- var length = bytes.length;
601
- var MAX_ARGUMENT_COUNT = 8192;
513
+ assert(bytes !== null && typeof bytes === "object" && bytes.length !== undefined, "Invalid argument for bytesToString");
514
+ const length = bytes.length;
515
+ const MAX_ARGUMENT_COUNT = 8192;
602
516
 
603
517
  if (length < MAX_ARGUMENT_COUNT) {
604
518
  return String.fromCharCode.apply(null, bytes);
605
519
  }
606
520
 
607
- var strBuf = [];
521
+ const strBuf = [];
608
522
 
609
- for (var i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
610
- var chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
611
- var chunk = bytes.subarray(i, chunkEnd);
523
+ for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
524
+ const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
525
+ const chunk = bytes.subarray(i, chunkEnd);
612
526
  strBuf.push(String.fromCharCode.apply(null, chunk));
613
527
  }
614
528
 
615
- return strBuf.join('');
529
+ return strBuf.join("");
616
530
  }
617
531
 
618
532
  function stringToBytes(str) {
619
- assert(typeof str === 'string', 'Invalid argument for stringToBytes');
620
- var length = str.length;
621
- var bytes = new Uint8Array(length);
533
+ assert(typeof str === "string", "Invalid argument for stringToBytes");
534
+ const length = str.length;
535
+ const bytes = new Uint8Array(length);
622
536
 
623
- for (var i = 0; i < length; ++i) {
624
- bytes[i] = str.charCodeAt(i) & 0xFF;
537
+ for (let i = 0; i < length; ++i) {
538
+ bytes[i] = str.charCodeAt(i) & 0xff;
625
539
  }
626
540
 
627
541
  return bytes;
@@ -632,41 +546,38 @@ function arrayByteLength(arr) {
632
546
  return arr.length;
633
547
  }
634
548
 
635
- assert(arr.byteLength !== undefined);
549
+ assert(arr.byteLength !== undefined, "arrayByteLength - invalid argument.");
636
550
  return arr.byteLength;
637
551
  }
638
552
 
639
553
  function arraysToBytes(arr) {
640
- if (arr.length === 1 && arr[0] instanceof Uint8Array) {
554
+ const length = arr.length;
555
+
556
+ if (length === 1 && arr[0] instanceof Uint8Array) {
641
557
  return arr[0];
642
558
  }
643
559
 
644
- var resultLength = 0;
645
- var i,
646
- ii = arr.length;
647
- var item, itemLength;
560
+ let resultLength = 0;
648
561
 
649
- for (i = 0; i < ii; i++) {
650
- item = arr[i];
651
- itemLength = arrayByteLength(item);
652
- resultLength += itemLength;
562
+ for (let i = 0; i < length; i++) {
563
+ resultLength += arrayByteLength(arr[i]);
653
564
  }
654
565
 
655
- var pos = 0;
656
- var data = new Uint8Array(resultLength);
566
+ let pos = 0;
567
+ const data = new Uint8Array(resultLength);
657
568
 
658
- for (i = 0; i < ii; i++) {
659
- item = arr[i];
569
+ for (let i = 0; i < length; i++) {
570
+ let item = arr[i];
660
571
 
661
572
  if (!(item instanceof Uint8Array)) {
662
- if (typeof item === 'string') {
573
+ if (typeof item === "string") {
663
574
  item = stringToBytes(item);
664
575
  } else {
665
576
  item = new Uint8Array(item);
666
577
  }
667
578
  }
668
579
 
669
- itemLength = item.byteLength;
580
+ const itemLength = item.byteLength;
670
581
  data.set(item, pos);
671
582
  pos += itemLength;
672
583
  }
@@ -678,140 +589,96 @@ function string32(value) {
678
589
  return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
679
590
  }
680
591
 
681
- function log2(x) {
682
- if (x <= 0) {
683
- return 0;
684
- }
685
-
686
- return Math.ceil(Math.log2(x));
687
- }
688
-
689
- function readInt8(data, start) {
690
- return data[start] << 24 >> 24;
691
- }
692
-
693
- function readUint16(data, offset) {
694
- return data[offset] << 8 | data[offset + 1];
695
- }
696
-
697
- function readUint32(data, offset) {
698
- return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
699
- }
700
-
701
592
  function isLittleEndian() {
702
- var buffer8 = new Uint8Array(4);
593
+ const buffer8 = new Uint8Array(4);
703
594
  buffer8[0] = 1;
704
- var view32 = new Uint32Array(buffer8.buffer, 0, 1);
595
+ const view32 = new Uint32Array(buffer8.buffer, 0, 1);
705
596
  return view32[0] === 1;
706
597
  }
707
598
 
599
+ const IsLittleEndianCached = {
600
+ get value() {
601
+ return shadow(this, "value", isLittleEndian());
602
+ }
603
+
604
+ };
605
+ exports.IsLittleEndianCached = IsLittleEndianCached;
606
+
708
607
  function isEvalSupported() {
709
608
  try {
710
- new Function('');
609
+ new Function("");
711
610
  return true;
712
611
  } catch (e) {
713
612
  return false;
714
613
  }
715
614
  }
716
615
 
717
- function getInheritableProperty(_ref) {
718
- var dict = _ref.dict,
719
- key = _ref.key,
720
- _ref$getArray = _ref.getArray,
721
- getArray = _ref$getArray === void 0 ? false : _ref$getArray,
722
- _ref$stopWhenFound = _ref.stopWhenFound,
723
- stopWhenFound = _ref$stopWhenFound === void 0 ? true : _ref$stopWhenFound;
724
- var LOOP_LIMIT = 100;
725
- var loopCount = 0;
726
- var values;
727
-
728
- while (dict) {
729
- var value = getArray ? dict.getArray(key) : dict.get(key);
730
-
731
- if (value !== undefined) {
732
- if (stopWhenFound) {
733
- return value;
734
- }
735
-
736
- if (!values) {
737
- values = [];
738
- }
739
-
740
- values.push(value);
741
- }
742
-
743
- if (++loopCount > LOOP_LIMIT) {
744
- warn("getInheritableProperty: maximum loop count exceeded for \"".concat(key, "\""));
745
- break;
746
- }
747
-
748
- dict = dict.get('Parent');
616
+ const IsEvalSupportedCached = {
617
+ get value() {
618
+ return shadow(this, "value", isEvalSupported());
749
619
  }
750
620
 
751
- return values;
752
- }
753
-
754
- var Util = function UtilClosure() {
755
- function Util() {}
756
-
757
- var rgbBuf = ['rgb(', 0, ',', 0, ',', 0, ')'];
621
+ };
622
+ exports.IsEvalSupportedCached = IsEvalSupportedCached;
623
+ const rgbBuf = ["rgb(", 0, ",", 0, ",", 0, ")"];
758
624
 
759
- Util.makeCssRgb = function Util_makeCssRgb(r, g, b) {
625
+ class Util {
626
+ static makeCssRgb(r, g, b) {
760
627
  rgbBuf[1] = r;
761
628
  rgbBuf[3] = g;
762
629
  rgbBuf[5] = b;
763
- return rgbBuf.join('');
764
- };
630
+ return rgbBuf.join("");
631
+ }
765
632
 
766
- Util.transform = function Util_transform(m1, m2) {
633
+ static transform(m1, m2) {
767
634
  return [m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2[3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5]];
768
- };
635
+ }
769
636
 
770
- Util.applyTransform = function Util_applyTransform(p, m) {
771
- var xt = p[0] * m[0] + p[1] * m[2] + m[4];
772
- var yt = p[0] * m[1] + p[1] * m[3] + m[5];
637
+ static applyTransform(p, m) {
638
+ const xt = p[0] * m[0] + p[1] * m[2] + m[4];
639
+ const yt = p[0] * m[1] + p[1] * m[3] + m[5];
773
640
  return [xt, yt];
774
- };
641
+ }
775
642
 
776
- Util.applyInverseTransform = function Util_applyInverseTransform(p, m) {
777
- var d = m[0] * m[3] - m[1] * m[2];
778
- var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
779
- var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
643
+ static applyInverseTransform(p, m) {
644
+ const d = m[0] * m[3] - m[1] * m[2];
645
+ const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
646
+ const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
780
647
  return [xt, yt];
781
- };
648
+ }
782
649
 
783
- Util.getAxialAlignedBoundingBox = function Util_getAxialAlignedBoundingBox(r, m) {
784
- var p1 = Util.applyTransform(r, m);
785
- var p2 = Util.applyTransform(r.slice(2, 4), m);
786
- var p3 = Util.applyTransform([r[0], r[3]], m);
787
- var p4 = Util.applyTransform([r[2], r[1]], m);
650
+ static getAxialAlignedBoundingBox(r, m) {
651
+ const p1 = Util.applyTransform(r, m);
652
+ const p2 = Util.applyTransform(r.slice(2, 4), m);
653
+ const p3 = Util.applyTransform([r[0], r[3]], m);
654
+ const p4 = Util.applyTransform([r[2], r[1]], m);
788
655
  return [Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math.max(p1[1], p2[1], p3[1], p4[1])];
789
- };
656
+ }
790
657
 
791
- Util.inverseTransform = function Util_inverseTransform(m) {
792
- var d = m[0] * m[3] - m[1] * m[2];
658
+ static inverseTransform(m) {
659
+ const d = m[0] * m[3] - m[1] * m[2];
793
660
  return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d, (m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d];
794
- };
661
+ }
795
662
 
796
- Util.apply3dTransform = function Util_apply3dTransform(m, v) {
663
+ static apply3dTransform(m, v) {
797
664
  return [m[0] * v[0] + m[1] * v[1] + m[2] * v[2], m[3] * v[0] + m[4] * v[1] + m[5] * v[2], m[6] * v[0] + m[7] * v[1] + m[8] * v[2]];
798
- };
665
+ }
799
666
 
800
- Util.singularValueDecompose2dScale = function Util_singularValueDecompose2dScale(m) {
801
- var transpose = [m[0], m[2], m[1], m[3]];
802
- var a = m[0] * transpose[0] + m[1] * transpose[2];
803
- var b = m[0] * transpose[1] + m[1] * transpose[3];
804
- var c = m[2] * transpose[0] + m[3] * transpose[2];
805
- var d = m[2] * transpose[1] + m[3] * transpose[3];
806
- var first = (a + d) / 2;
807
- var second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2;
808
- var sx = first + second || 1;
809
- var sy = first - second || 1;
667
+ static singularValueDecompose2dScale(m) {
668
+ const transpose = [m[0], m[2], m[1], m[3]];
669
+ const a = m[0] * transpose[0] + m[1] * transpose[2];
670
+ const b = m[0] * transpose[1] + m[1] * transpose[3];
671
+ const c = m[2] * transpose[0] + m[3] * transpose[2];
672
+ const d = m[2] * transpose[1] + m[3] * transpose[3];
673
+ const first = (a + d) / 2;
674
+ const second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2;
675
+ const sx = first + second || 1;
676
+ const sy = first - second || 1;
810
677
  return [Math.sqrt(sx), Math.sqrt(sy)];
811
- };
678
+ }
812
679
 
813
- Util.normalizeRect = function Util_normalizeRect(rect) {
814
- var r = rect.slice(0);
680
+ static normalizeRect(rect) {
681
+ const r = rect.slice(0);
815
682
 
816
683
  if (rect[0] > rect[2]) {
817
684
  r[0] = rect[2];
@@ -824,16 +691,16 @@ var Util = function UtilClosure() {
824
691
  }
825
692
 
826
693
  return r;
827
- };
694
+ }
828
695
 
829
- Util.intersect = function Util_intersect(rect1, rect2) {
696
+ static intersect(rect1, rect2) {
830
697
  function compare(a, b) {
831
698
  return a - b;
832
699
  }
833
700
 
834
- var orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare),
835
- orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare),
836
- result = [];
701
+ const orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare);
702
+ const orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare);
703
+ const result = [];
837
704
  rect1 = Util.normalizeRect(rect1);
838
705
  rect2 = Util.normalizeRect(rect2);
839
706
 
@@ -841,66 +708,44 @@ var Util = function UtilClosure() {
841
708
  result[0] = orderedX[1];
842
709
  result[2] = orderedX[2];
843
710
  } else {
844
- return false;
711
+ return null;
845
712
  }
846
713
 
847
714
  if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
848
715
  result[1] = orderedY[1];
849
716
  result[3] = orderedY[2];
850
717
  } else {
851
- return false;
718
+ return null;
852
719
  }
853
720
 
854
721
  return result;
855
- };
856
-
857
- return Util;
858
- }();
859
-
860
- exports.Util = Util;
861
- var ROMAN_NUMBER_MAP = ['', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM', '', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC', '', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX'];
862
-
863
- function toRomanNumerals(number) {
864
- var lowerCase = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
865
- assert(Number.isInteger(number) && number > 0, 'The number should be a positive integer.');
866
- var pos,
867
- romanBuf = [];
868
-
869
- while (number >= 1000) {
870
- number -= 1000;
871
- romanBuf.push('M');
872
722
  }
873
723
 
874
- pos = number / 100 | 0;
875
- number %= 100;
876
- romanBuf.push(ROMAN_NUMBER_MAP[pos]);
877
- pos = number / 10 | 0;
878
- number %= 10;
879
- romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
880
- romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
881
- var romanStr = romanBuf.join('');
882
- return lowerCase ? romanStr.toLowerCase() : romanStr;
883
724
  }
884
725
 
885
- var PDFStringTranslateTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2D8, 0x2C7, 0x2C6, 0x2D9, 0x2DD, 0x2DB, 0x2DA, 0x2DC, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192, 0x2044, 0x2039, 0x203A, 0x2212, 0x2030, 0x201E, 0x201C, 0x201D, 0x2018, 0x2019, 0x201A, 0x2122, 0xFB01, 0xFB02, 0x141, 0x152, 0x160, 0x178, 0x17D, 0x131, 0x142, 0x153, 0x161, 0x17E, 0, 0x20AC];
726
+ exports.Util = Util;
727
+ const PDFStringTranslateTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2D8, 0x2C7, 0x2C6, 0x2D9, 0x2DD, 0x2DB, 0x2DA, 0x2DC, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192, 0x2044, 0x2039, 0x203A, 0x2212, 0x2030, 0x201E, 0x201C, 0x201D, 0x2018, 0x2019, 0x201A, 0x2122, 0xFB01, 0xFB02, 0x141, 0x152, 0x160, 0x178, 0x17D, 0x131, 0x142, 0x153, 0x161, 0x17E, 0, 0x20AC];
886
728
 
887
729
  function stringToPDFString(str) {
888
- var i,
889
- n = str.length,
890
- strBuf = [];
730
+ const length = str.length,
731
+ strBuf = [];
891
732
 
892
- if (str[0] === '\xFE' && str[1] === '\xFF') {
893
- for (i = 2; i < n; i += 2) {
733
+ if (str[0] === "\xFE" && str[1] === "\xFF") {
734
+ for (let i = 2; i < length; i += 2) {
894
735
  strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
895
736
  }
737
+ } else if (str[0] === "\xFF" && str[1] === "\xFE") {
738
+ for (let i = 2; i < length; i += 2) {
739
+ strBuf.push(String.fromCharCode(str.charCodeAt(i + 1) << 8 | str.charCodeAt(i)));
740
+ }
896
741
  } else {
897
- for (i = 0; i < n; ++i) {
898
- var code = PDFStringTranslateTable[str.charCodeAt(i)];
742
+ for (let i = 0; i < length; ++i) {
743
+ const code = PDFStringTranslateTable[str.charCodeAt(i)];
899
744
  strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
900
745
  }
901
746
  }
902
747
 
903
- return strBuf.join('');
748
+ return strBuf.join("");
904
749
  }
905
750
 
906
751
  function stringToUTF8String(str) {
@@ -912,7 +757,7 @@ function utf8StringToString(str) {
912
757
  }
913
758
 
914
759
  function isEmptyObj(obj) {
915
- for (var key in obj) {
760
+ for (const key in obj) {
916
761
  return false;
917
762
  }
918
763
 
@@ -920,32 +765,39 @@ function isEmptyObj(obj) {
920
765
  }
921
766
 
922
767
  function isBool(v) {
923
- return typeof v === 'boolean';
768
+ return typeof v === "boolean";
924
769
  }
925
770
 
926
771
  function isNum(v) {
927
- return typeof v === 'number';
772
+ return typeof v === "number";
928
773
  }
929
774
 
930
775
  function isString(v) {
931
- return typeof v === 'string';
776
+ return typeof v === "string";
932
777
  }
933
778
 
934
779
  function isArrayBuffer(v) {
935
- return _typeof(v) === 'object' && v !== null && v.byteLength !== undefined;
780
+ return typeof v === "object" && v !== null && v.byteLength !== undefined;
936
781
  }
937
782
 
938
- function isSpace(ch) {
939
- return ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A;
783
+ function isArrayEqual(arr1, arr2) {
784
+ if (arr1.length !== arr2.length) {
785
+ return false;
786
+ }
787
+
788
+ return arr1.every(function (element, index) {
789
+ return element === arr2[index];
790
+ });
940
791
  }
941
792
 
942
793
  function createPromiseCapability() {
943
- var capability = Object.create(null);
944
- var isSettled = false;
945
- Object.defineProperty(capability, 'settled', {
946
- get: function get() {
794
+ const capability = Object.create(null);
795
+ let isSettled = false;
796
+ Object.defineProperty(capability, "settled", {
797
+ get() {
947
798
  return isSettled;
948
799
  }
800
+
949
801
  });
950
802
  capability.promise = new Promise(function (resolve, reject) {
951
803
  capability.resolve = function (data) {
@@ -961,28 +813,26 @@ function createPromiseCapability() {
961
813
  return capability;
962
814
  }
963
815
 
964
- var createObjectURL = function createObjectURLClosure() {
965
- var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
966
- return function createObjectURL(data, contentType) {
967
- var forceDataSchema = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
968
-
969
- if (!forceDataSchema && _url_polyfill.URL.createObjectURL) {
970
- var blob = new Blob([data], {
816
+ const createObjectURL = function createObjectURLClosure() {
817
+ const digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
818
+ return function createObjectURL(data, contentType, forceDataSchema = false) {
819
+ if (!forceDataSchema && URL.createObjectURL) {
820
+ const blob = new Blob([data], {
971
821
  type: contentType
972
822
  });
973
- return _url_polyfill.URL.createObjectURL(blob);
823
+ return URL.createObjectURL(blob);
974
824
  }
975
825
 
976
- var buffer = 'data:' + contentType + ';base64,';
826
+ let buffer = `data:${contentType};base64,`;
977
827
 
978
- for (var i = 0, ii = data.length; i < ii; i += 3) {
979
- var b1 = data[i] & 0xFF;
980
- var b2 = data[i + 1] & 0xFF;
981
- var b3 = data[i + 2] & 0xFF;
982
- var d1 = b1 >> 2,
983
- d2 = (b1 & 3) << 4 | b2 >> 4;
984
- var d3 = i + 1 < ii ? (b2 & 0xF) << 2 | b3 >> 6 : 64;
985
- var d4 = i + 2 < ii ? b3 & 0x3F : 64;
828
+ for (let i = 0, ii = data.length; i < ii; i += 3) {
829
+ const b1 = data[i] & 0xff;
830
+ const b2 = data[i + 1] & 0xff;
831
+ const b3 = data[i + 2] & 0xff;
832
+ const d1 = b1 >> 2,
833
+ d2 = (b1 & 3) << 4 | b2 >> 4;
834
+ const d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64;
835
+ const d4 = i + 2 < ii ? b3 & 0x3f : 64;
986
836
  buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
987
837
  }
988
838