pdfjs-dist 2.2.228 → 2.6.347

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 (229) hide show
  1. package/README.md +4 -0
  2. package/bower.json +1 -1
  3. package/build/pdf.js +8816 -19300
  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 +27185 -35746
  8. package/build/pdf.worker.js.map +1 -1
  9. package/build/pdf.worker.min.js +22 -1
  10. package/es5/build/pdf.js +26665 -0
  11. package/es5/build/pdf.js.map +1 -0
  12. package/es5/build/pdf.min.js +22 -0
  13. package/{lib/shared/global_scope.js → es5/build/pdf.worker.entry.js} +5 -10
  14. package/es5/build/pdf.worker.js +61231 -0
  15. package/es5/build/pdf.worker.js.map +1 -0
  16. package/es5/build/pdf.worker.min.js +22 -0
  17. package/es5/image_decoders/pdf.image_decoders.js +12529 -0
  18. package/es5/image_decoders/pdf.image_decoders.js.map +1 -0
  19. package/es5/image_decoders/pdf.image_decoders.min.js +22 -0
  20. package/es5/web/images/annotation-check.svg +11 -0
  21. package/es5/web/images/annotation-comment.svg +16 -0
  22. package/es5/web/images/annotation-help.svg +26 -0
  23. package/es5/web/images/annotation-insert.svg +10 -0
  24. package/es5/web/images/annotation-key.svg +11 -0
  25. package/es5/web/images/annotation-newparagraph.svg +11 -0
  26. package/es5/web/images/annotation-noicon.svg +7 -0
  27. package/es5/web/images/annotation-note.svg +42 -0
  28. package/es5/web/images/annotation-paragraph.svg +16 -0
  29. package/es5/web/images/loading-icon.gif +0 -0
  30. package/es5/web/images/shadow.png +0 -0
  31. package/es5/web/pdf_viewer.css +406 -0
  32. package/es5/web/pdf_viewer.js +7886 -0
  33. package/es5/web/pdf_viewer.js.map +1 -0
  34. package/image_decoders/pdf.image_decoders.js +1498 -4832
  35. package/image_decoders/pdf.image_decoders.js.map +1 -1
  36. package/image_decoders/pdf.image_decoders.min.js +22 -1
  37. package/lib/README.md +7 -0
  38. package/lib/core/annotation.js +1144 -927
  39. package/lib/core/arithmetic_decoder.js +81 -97
  40. package/lib/core/bidi.js +54 -46
  41. package/lib/core/ccitt.js +88 -81
  42. package/lib/core/ccitt_stream.js +15 -14
  43. package/lib/core/cff_parser.js +747 -716
  44. package/lib/core/charsets.js +4 -4
  45. package/lib/core/chunked_stream.js +462 -553
  46. package/lib/core/cmap.js +231 -277
  47. package/lib/core/colorspace.js +715 -857
  48. package/lib/core/core_utils.js +57 -52
  49. package/lib/core/crypto.js +416 -437
  50. package/lib/core/document.js +629 -670
  51. package/lib/core/encodings.js +15 -15
  52. package/lib/core/evaluator.js +3229 -2800
  53. package/lib/core/font_renderer.js +135 -178
  54. package/lib/core/fonts.js +602 -534
  55. package/lib/core/function.js +355 -279
  56. package/lib/core/glyphlist.js +4527 -4526
  57. package/lib/core/image.js +442 -439
  58. package/lib/core/image_utils.js +221 -61
  59. package/lib/core/jbig2.js +325 -316
  60. package/lib/core/jbig2_stream.js +18 -17
  61. package/lib/core/jpeg_stream.js +21 -26
  62. package/lib/core/jpg.js +289 -233
  63. package/lib/core/jpx.js +161 -143
  64. package/lib/core/jpx_stream.js +28 -28
  65. package/lib/core/metrics.js +2928 -2928
  66. package/lib/core/murmurhash3.js +87 -102
  67. package/lib/core/obj.js +1343 -1300
  68. package/lib/core/operator_list.js +90 -67
  69. package/lib/core/parser.js +990 -987
  70. package/lib/core/pattern.js +105 -77
  71. package/lib/core/pdf_manager.js +149 -316
  72. package/lib/core/primitives.js +156 -104
  73. package/lib/core/ps_parser.js +175 -214
  74. package/lib/core/standard_fonts.js +237 -236
  75. package/lib/core/stream.js +94 -74
  76. package/lib/core/type1_parser.js +89 -69
  77. package/lib/core/unicode.js +1654 -1654
  78. package/lib/core/worker.js +275 -290
  79. package/lib/core/worker_stream.js +101 -210
  80. package/lib/core/writer.js +242 -0
  81. package/lib/display/annotation_layer.js +772 -1041
  82. package/lib/display/annotation_storage.js +89 -0
  83. package/lib/display/api.js +1575 -1868
  84. package/lib/display/api_compatibility.js +12 -17
  85. package/lib/display/canvas.js +370 -222
  86. package/lib/display/content_disposition.js +40 -59
  87. package/lib/display/display_utils.js +341 -536
  88. package/lib/display/fetch_stream.js +188 -304
  89. package/lib/display/font_loader.js +282 -414
  90. package/lib/display/metadata.js +81 -99
  91. package/lib/display/network.js +362 -511
  92. package/lib/display/network_utils.js +25 -18
  93. package/lib/display/node_stream.js +283 -465
  94. package/lib/display/node_utils.js +87 -0
  95. package/lib/display/optional_content_config.js +184 -0
  96. package/lib/display/pattern_helper.js +93 -44
  97. package/lib/display/svg.js +1163 -1401
  98. package/lib/display/text_layer.js +154 -137
  99. package/lib/display/transport_stream.js +237 -375
  100. package/lib/display/webgl.js +70 -83
  101. package/lib/display/worker_options.js +3 -3
  102. package/lib/display/xml_parser.js +303 -392
  103. package/lib/examples/node/domstubs.js +37 -37
  104. package/lib/pdf.js +220 -58
  105. package/lib/pdf.worker.js +14 -6
  106. package/lib/shared/compatibility.js +3 -246
  107. package/lib/shared/is_node.js +7 -6
  108. package/lib/shared/message_handler.js +327 -332
  109. package/lib/shared/util.js +271 -306
  110. package/lib/test/unit/annotation_spec.js +1902 -763
  111. package/lib/test/unit/annotation_storage_spec.js +83 -0
  112. package/lib/test/unit/api_spec.js +790 -592
  113. package/lib/test/unit/bidi_spec.js +7 -7
  114. package/lib/test/unit/cff_parser_spec.js +73 -72
  115. package/lib/test/unit/clitests_helper.js +7 -9
  116. package/lib/test/unit/cmap_spec.js +86 -88
  117. package/lib/test/unit/colorspace_spec.js +346 -154
  118. package/lib/test/unit/core_utils_spec.js +125 -105
  119. package/lib/test/unit/crypto_spec.js +232 -185
  120. package/lib/test/unit/custom_spec.js +150 -24
  121. package/lib/test/unit/display_svg_spec.js +34 -39
  122. package/lib/test/unit/display_utils_spec.js +139 -149
  123. package/lib/test/unit/document_spec.js +128 -17
  124. package/lib/test/unit/encodings_spec.js +12 -34
  125. package/lib/test/unit/evaluator_spec.js +112 -91
  126. package/lib/test/unit/fetch_stream_spec.js +31 -29
  127. package/lib/test/unit/function_spec.js +206 -204
  128. package/lib/test/unit/jasmine-boot.js +48 -32
  129. package/lib/test/unit/message_handler_spec.js +173 -159
  130. package/lib/test/unit/metadata_spec.js +71 -71
  131. package/lib/test/unit/murmurhash3_spec.js +12 -12
  132. package/lib/test/unit/network_spec.js +13 -11
  133. package/lib/test/unit/network_utils_spec.js +158 -144
  134. package/lib/test/unit/node_stream_spec.js +76 -90
  135. package/lib/test/unit/parser_spec.js +108 -114
  136. package/lib/test/unit/pdf_find_controller_spec.js +55 -86
  137. package/lib/test/unit/pdf_find_utils_spec.js +32 -32
  138. package/lib/test/unit/pdf_history_spec.js +32 -32
  139. package/lib/test/unit/primitives_spec.js +337 -156
  140. package/lib/test/unit/stream_spec.js +16 -14
  141. package/lib/test/unit/test_utils.js +91 -304
  142. package/lib/test/unit/testreporter.js +33 -22
  143. package/lib/test/unit/type1_parser_spec.js +42 -42
  144. package/lib/test/unit/ui_utils_spec.js +299 -461
  145. package/lib/test/unit/unicode_spec.js +42 -42
  146. package/lib/test/unit/util_spec.js +129 -149
  147. package/lib/test/unit/writer_spec.js +84 -0
  148. package/lib/web/annotation_layer_builder.js +78 -111
  149. package/lib/web/app.js +1542 -1267
  150. package/lib/web/app_options.js +76 -91
  151. package/lib/web/base_tree_viewer.js +100 -0
  152. package/lib/web/base_viewer.js +869 -834
  153. package/lib/web/chromecom.js +165 -252
  154. package/lib/web/debugger.js +149 -205
  155. package/lib/web/download_manager.js +34 -58
  156. package/lib/web/firefox_print_service.js +62 -34
  157. package/lib/web/firefoxcom.js +206 -374
  158. package/lib/web/genericcom.js +26 -108
  159. package/lib/web/genericl10n.js +24 -153
  160. package/lib/web/grab_to_pan.js +30 -30
  161. package/lib/web/interfaces.js +80 -254
  162. package/lib/web/overlay_manager.js +70 -246
  163. package/lib/web/password_prompt.js +38 -64
  164. package/lib/web/pdf_attachment_viewer.js +150 -126
  165. package/lib/web/pdf_cursor_tools.js +75 -102
  166. package/lib/web/pdf_document_properties.js +229 -383
  167. package/lib/web/pdf_find_bar.js +136 -170
  168. package/lib/web/pdf_find_controller.js +492 -548
  169. package/lib/web/pdf_find_utils.js +13 -13
  170. package/lib/web/pdf_history.js +397 -406
  171. package/lib/web/pdf_layer_viewer.js +208 -0
  172. package/lib/web/pdf_link_service.js +304 -348
  173. package/lib/web/pdf_outline_viewer.js +119 -212
  174. package/lib/web/pdf_page_view.js +474 -513
  175. package/lib/web/pdf_presentation_mode.js +308 -357
  176. package/lib/web/pdf_print_service.js +96 -110
  177. package/lib/web/pdf_rendering_queue.js +87 -108
  178. package/lib/web/pdf_sidebar.js +286 -302
  179. package/lib/web/pdf_sidebar_resizer.js +92 -119
  180. package/lib/web/pdf_single_page_viewer.js +77 -126
  181. package/lib/web/pdf_thumbnail_view.js +289 -297
  182. package/lib/web/pdf_thumbnail_viewer.js +202 -206
  183. package/lib/web/pdf_viewer.component.js +20 -21
  184. package/lib/web/pdf_viewer.js +55 -115
  185. package/lib/web/preferences.js +69 -273
  186. package/lib/web/secondary_toolbar.js +164 -196
  187. package/lib/web/text_layer_builder.js +284 -319
  188. package/lib/web/toolbar.js +217 -210
  189. package/lib/web/ui_utils.js +274 -421
  190. package/lib/web/view_history.js +52 -226
  191. package/lib/web/viewer_compatibility.js +21 -6
  192. package/package.json +4 -9
  193. package/types/display/annotation_layer.d.ts +61 -0
  194. package/types/display/annotation_storage.d.ts +36 -0
  195. package/types/display/api.d.ts +1107 -0
  196. package/types/display/api_compatibility.d.ts +1 -0
  197. package/types/display/canvas.d.ts +4 -0
  198. package/types/display/content_disposition.d.ts +7 -0
  199. package/types/display/display_utils.d.ts +243 -0
  200. package/types/display/fetch_stream.d.ts +67 -0
  201. package/types/display/font_loader.d.ts +19 -0
  202. package/types/display/metadata.d.ts +9 -0
  203. package/types/display/network.d.ts +80 -0
  204. package/types/display/network_utils.d.ts +14 -0
  205. package/types/display/node_stream.d.ts +72 -0
  206. package/types/display/node_utils.d.ts +6 -0
  207. package/types/display/optional_content_config.d.ts +12 -0
  208. package/types/display/pattern_helper.d.ts +5 -0
  209. package/types/display/svg.d.ts +2 -0
  210. package/types/display/text_layer.d.ts +83 -0
  211. package/types/display/transport_stream.d.ts +57 -0
  212. package/types/display/webgl.d.ts +20 -0
  213. package/types/display/worker_options.d.ts +27 -0
  214. package/types/display/xml_parser.d.ts +35 -0
  215. package/types/pdf.d.ts +33 -0
  216. package/types/shared/compatibility.d.ts +1 -0
  217. package/types/shared/is_node.d.ts +1 -0
  218. package/types/shared/message_handler.d.ts +62 -0
  219. package/types/shared/util.d.ts +421 -0
  220. package/web/images/shadow.png +0 -0
  221. package/web/pdf_viewer.css +29 -27
  222. package/web/pdf_viewer.js +3524 -4746
  223. package/web/pdf_viewer.js.map +1 -1
  224. package/webpack.js +6 -5
  225. package/external/streams/streams-lib.js +0 -3962
  226. package/external/url/url-lib.js +0 -627
  227. package/lib/shared/streams_polyfill.js +0 -43
  228. package/lib/shared/url_polyfill.js +0 -56
  229. package/web/images/texture.png +0 -0
package/lib/core/cmap.js CHANGED
@@ -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,283 +26,231 @@ Object.defineProperty(exports, "__esModule", {
26
26
  });
27
27
  exports.CMapFactory = exports.IdentityCMap = exports.CMap = void 0;
28
28
 
29
- var _util = require("../shared/util");
29
+ var _util = require("../shared/util.js");
30
30
 
31
- var _primitives = require("./primitives");
31
+ var _primitives = require("./primitives.js");
32
32
 
33
- var _parser = require("./parser");
33
+ var _parser = require("./parser.js");
34
34
 
35
- var _core_utils = require("./core_utils");
35
+ var _core_utils = require("./core_utils.js");
36
36
 
37
- var _stream = require("./stream");
37
+ var _stream = require("./stream.js");
38
38
 
39
- 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); }
39
+ var BUILT_IN_CMAPS = ["Adobe-GB1-UCS2", "Adobe-CNS1-UCS2", "Adobe-Japan1-UCS2", "Adobe-Korea1-UCS2", "78-EUC-H", "78-EUC-V", "78-H", "78-RKSJ-H", "78-RKSJ-V", "78-V", "78ms-RKSJ-H", "78ms-RKSJ-V", "83pv-RKSJ-H", "90ms-RKSJ-H", "90ms-RKSJ-V", "90msp-RKSJ-H", "90msp-RKSJ-V", "90pv-RKSJ-H", "90pv-RKSJ-V", "Add-H", "Add-RKSJ-H", "Add-RKSJ-V", "Add-V", "Adobe-CNS1-0", "Adobe-CNS1-1", "Adobe-CNS1-2", "Adobe-CNS1-3", "Adobe-CNS1-4", "Adobe-CNS1-5", "Adobe-CNS1-6", "Adobe-GB1-0", "Adobe-GB1-1", "Adobe-GB1-2", "Adobe-GB1-3", "Adobe-GB1-4", "Adobe-GB1-5", "Adobe-Japan1-0", "Adobe-Japan1-1", "Adobe-Japan1-2", "Adobe-Japan1-3", "Adobe-Japan1-4", "Adobe-Japan1-5", "Adobe-Japan1-6", "Adobe-Korea1-0", "Adobe-Korea1-1", "Adobe-Korea1-2", "B5-H", "B5-V", "B5pc-H", "B5pc-V", "CNS-EUC-H", "CNS-EUC-V", "CNS1-H", "CNS1-V", "CNS2-H", "CNS2-V", "ETHK-B5-H", "ETHK-B5-V", "ETen-B5-H", "ETen-B5-V", "ETenms-B5-H", "ETenms-B5-V", "EUC-H", "EUC-V", "Ext-H", "Ext-RKSJ-H", "Ext-RKSJ-V", "Ext-V", "GB-EUC-H", "GB-EUC-V", "GB-H", "GB-V", "GBK-EUC-H", "GBK-EUC-V", "GBK2K-H", "GBK2K-V", "GBKp-EUC-H", "GBKp-EUC-V", "GBT-EUC-H", "GBT-EUC-V", "GBT-H", "GBT-V", "GBTpc-EUC-H", "GBTpc-EUC-V", "GBpc-EUC-H", "GBpc-EUC-V", "H", "HKdla-B5-H", "HKdla-B5-V", "HKdlb-B5-H", "HKdlb-B5-V", "HKgccs-B5-H", "HKgccs-B5-V", "HKm314-B5-H", "HKm314-B5-V", "HKm471-B5-H", "HKm471-B5-V", "HKscs-B5-H", "HKscs-B5-V", "Hankaku", "Hiragana", "KSC-EUC-H", "KSC-EUC-V", "KSC-H", "KSC-Johab-H", "KSC-Johab-V", "KSC-V", "KSCms-UHC-H", "KSCms-UHC-HW-H", "KSCms-UHC-HW-V", "KSCms-UHC-V", "KSCpc-EUC-H", "KSCpc-EUC-V", "Katakana", "NWP-H", "NWP-V", "RKSJ-H", "RKSJ-V", "Roman", "UniCNS-UCS2-H", "UniCNS-UCS2-V", "UniCNS-UTF16-H", "UniCNS-UTF16-V", "UniCNS-UTF32-H", "UniCNS-UTF32-V", "UniCNS-UTF8-H", "UniCNS-UTF8-V", "UniGB-UCS2-H", "UniGB-UCS2-V", "UniGB-UTF16-H", "UniGB-UTF16-V", "UniGB-UTF32-H", "UniGB-UTF32-V", "UniGB-UTF8-H", "UniGB-UTF8-V", "UniJIS-UCS2-H", "UniJIS-UCS2-HW-H", "UniJIS-UCS2-HW-V", "UniJIS-UCS2-V", "UniJIS-UTF16-H", "UniJIS-UTF16-V", "UniJIS-UTF32-H", "UniJIS-UTF32-V", "UniJIS-UTF8-H", "UniJIS-UTF8-V", "UniJIS2004-UTF16-H", "UniJIS2004-UTF16-V", "UniJIS2004-UTF32-H", "UniJIS2004-UTF32-V", "UniJIS2004-UTF8-H", "UniJIS2004-UTF8-V", "UniJISPro-UCS2-HW-V", "UniJISPro-UCS2-V", "UniJISPro-UTF8-V", "UniJISX0213-UTF32-H", "UniJISX0213-UTF32-V", "UniJISX02132004-UTF32-H", "UniJISX02132004-UTF32-V", "UniKS-UCS2-H", "UniKS-UCS2-V", "UniKS-UTF16-H", "UniKS-UTF16-V", "UniKS-UTF32-H", "UniKS-UTF32-V", "UniKS-UTF8-H", "UniKS-UTF8-V", "V", "WP-Symbol"];
40
+ const MAX_MAP_RANGE = 2 ** 24 - 1;
40
41
 
41
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
42
+ class CMap {
43
+ constructor(builtInCMap = false) {
44
+ this.codespaceRanges = [[], [], [], []];
45
+ this.numCodespaceRanges = 0;
46
+ this._map = [];
47
+ this.name = "";
48
+ this.vertical = false;
49
+ this.useCMap = null;
50
+ this.builtInCMap = builtInCMap;
51
+ }
42
52
 
43
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
53
+ addCodespaceRange(n, low, high) {
54
+ this.codespaceRanges[n - 1].push(low, high);
55
+ this.numCodespaceRanges++;
56
+ }
44
57
 
45
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
58
+ mapCidRange(low, high, dstLow) {
59
+ if (high - low > MAX_MAP_RANGE) {
60
+ throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");
61
+ }
46
62
 
47
- 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); }
63
+ while (low <= high) {
64
+ this._map[low++] = dstLow++;
65
+ }
66
+ }
48
67
 
49
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
68
+ mapBfRange(low, high, dstLow) {
69
+ if (high - low > MAX_MAP_RANGE) {
70
+ throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");
71
+ }
50
72
 
51
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
73
+ var lastByte = dstLow.length - 1;
52
74
 
53
- 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); } }
75
+ while (low <= high) {
76
+ this._map[low++] = dstLow;
77
+ dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1);
78
+ }
79
+ }
54
80
 
55
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
81
+ mapBfRangeToArray(low, high, array) {
82
+ if (high - low > MAX_MAP_RANGE) {
83
+ throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");
84
+ }
56
85
 
57
- var BUILT_IN_CMAPS = ['Adobe-GB1-UCS2', 'Adobe-CNS1-UCS2', 'Adobe-Japan1-UCS2', 'Adobe-Korea1-UCS2', '78-EUC-H', '78-EUC-V', '78-H', '78-RKSJ-H', '78-RKSJ-V', '78-V', '78ms-RKSJ-H', '78ms-RKSJ-V', '83pv-RKSJ-H', '90ms-RKSJ-H', '90ms-RKSJ-V', '90msp-RKSJ-H', '90msp-RKSJ-V', '90pv-RKSJ-H', '90pv-RKSJ-V', 'Add-H', 'Add-RKSJ-H', 'Add-RKSJ-V', 'Add-V', 'Adobe-CNS1-0', 'Adobe-CNS1-1', 'Adobe-CNS1-2', 'Adobe-CNS1-3', 'Adobe-CNS1-4', 'Adobe-CNS1-5', 'Adobe-CNS1-6', 'Adobe-GB1-0', 'Adobe-GB1-1', 'Adobe-GB1-2', 'Adobe-GB1-3', 'Adobe-GB1-4', 'Adobe-GB1-5', 'Adobe-Japan1-0', 'Adobe-Japan1-1', 'Adobe-Japan1-2', 'Adobe-Japan1-3', 'Adobe-Japan1-4', 'Adobe-Japan1-5', 'Adobe-Japan1-6', 'Adobe-Korea1-0', 'Adobe-Korea1-1', 'Adobe-Korea1-2', 'B5-H', 'B5-V', 'B5pc-H', 'B5pc-V', 'CNS-EUC-H', 'CNS-EUC-V', 'CNS1-H', 'CNS1-V', 'CNS2-H', 'CNS2-V', 'ETHK-B5-H', 'ETHK-B5-V', 'ETen-B5-H', 'ETen-B5-V', 'ETenms-B5-H', 'ETenms-B5-V', 'EUC-H', 'EUC-V', 'Ext-H', 'Ext-RKSJ-H', 'Ext-RKSJ-V', 'Ext-V', 'GB-EUC-H', 'GB-EUC-V', 'GB-H', 'GB-V', 'GBK-EUC-H', 'GBK-EUC-V', 'GBK2K-H', 'GBK2K-V', 'GBKp-EUC-H', 'GBKp-EUC-V', 'GBT-EUC-H', 'GBT-EUC-V', 'GBT-H', 'GBT-V', 'GBTpc-EUC-H', 'GBTpc-EUC-V', 'GBpc-EUC-H', 'GBpc-EUC-V', 'H', 'HKdla-B5-H', 'HKdla-B5-V', 'HKdlb-B5-H', 'HKdlb-B5-V', 'HKgccs-B5-H', 'HKgccs-B5-V', 'HKm314-B5-H', 'HKm314-B5-V', 'HKm471-B5-H', 'HKm471-B5-V', 'HKscs-B5-H', 'HKscs-B5-V', 'Hankaku', 'Hiragana', 'KSC-EUC-H', 'KSC-EUC-V', 'KSC-H', 'KSC-Johab-H', 'KSC-Johab-V', 'KSC-V', 'KSCms-UHC-H', 'KSCms-UHC-HW-H', 'KSCms-UHC-HW-V', 'KSCms-UHC-V', 'KSCpc-EUC-H', 'KSCpc-EUC-V', 'Katakana', 'NWP-H', 'NWP-V', 'RKSJ-H', 'RKSJ-V', 'Roman', 'UniCNS-UCS2-H', 'UniCNS-UCS2-V', 'UniCNS-UTF16-H', 'UniCNS-UTF16-V', 'UniCNS-UTF32-H', 'UniCNS-UTF32-V', 'UniCNS-UTF8-H', 'UniCNS-UTF8-V', 'UniGB-UCS2-H', 'UniGB-UCS2-V', 'UniGB-UTF16-H', 'UniGB-UTF16-V', 'UniGB-UTF32-H', 'UniGB-UTF32-V', 'UniGB-UTF8-H', 'UniGB-UTF8-V', 'UniJIS-UCS2-H', 'UniJIS-UCS2-HW-H', 'UniJIS-UCS2-HW-V', 'UniJIS-UCS2-V', 'UniJIS-UTF16-H', 'UniJIS-UTF16-V', 'UniJIS-UTF32-H', 'UniJIS-UTF32-V', 'UniJIS-UTF8-H', 'UniJIS-UTF8-V', 'UniJIS2004-UTF16-H', 'UniJIS2004-UTF16-V', 'UniJIS2004-UTF32-H', 'UniJIS2004-UTF32-V', 'UniJIS2004-UTF8-H', 'UniJIS2004-UTF8-V', 'UniJISPro-UCS2-HW-V', 'UniJISPro-UCS2-V', 'UniJISPro-UTF8-V', 'UniJISX0213-UTF32-H', 'UniJISX0213-UTF32-V', 'UniJISX02132004-UTF32-H', 'UniJISX02132004-UTF32-V', 'UniKS-UCS2-H', 'UniKS-UCS2-V', 'UniKS-UTF16-H', 'UniKS-UTF16-V', 'UniKS-UTF32-H', 'UniKS-UTF32-V', 'UniKS-UTF8-H', 'UniKS-UTF8-V', 'V', 'WP-Symbol'];
86
+ const ii = array.length;
87
+ let i = 0;
58
88
 
59
- var CMap =
60
- /*#__PURE__*/
61
- function () {
62
- function CMap() {
63
- var builtInCMap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
89
+ while (low <= high && i < ii) {
90
+ this._map[low] = array[i++];
91
+ ++low;
92
+ }
93
+ }
64
94
 
65
- _classCallCheck(this, CMap);
95
+ mapOne(src, dst) {
96
+ this._map[src] = dst;
97
+ }
66
98
 
67
- this.codespaceRanges = [[], [], [], []];
68
- this.numCodespaceRanges = 0;
69
- this._map = [];
70
- this.name = '';
71
- this.vertical = false;
72
- this.useCMap = null;
73
- this.builtInCMap = builtInCMap;
99
+ lookup(code) {
100
+ return this._map[code];
74
101
  }
75
102
 
76
- _createClass(CMap, [{
77
- key: "addCodespaceRange",
78
- value: function addCodespaceRange(n, low, high) {
79
- this.codespaceRanges[n - 1].push(low, high);
80
- this.numCodespaceRanges++;
81
- }
82
- }, {
83
- key: "mapCidRange",
84
- value: function mapCidRange(low, high, dstLow) {
85
- while (low <= high) {
86
- this._map[low++] = dstLow++;
87
- }
88
- }
89
- }, {
90
- key: "mapBfRange",
91
- value: function mapBfRange(low, high, dstLow) {
92
- var lastByte = dstLow.length - 1;
103
+ contains(code) {
104
+ return this._map[code] !== undefined;
105
+ }
93
106
 
94
- while (low <= high) {
95
- this._map[low++] = dstLow;
96
- dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1);
107
+ forEach(callback) {
108
+ const map = this._map;
109
+ const length = map.length;
110
+
111
+ if (length <= 0x10000) {
112
+ for (let i = 0; i < length; i++) {
113
+ if (map[i] !== undefined) {
114
+ callback(i, map[i]);
115
+ }
116
+ }
117
+ } else {
118
+ for (const i in map) {
119
+ callback(i, map[i]);
97
120
  }
98
121
  }
99
- }, {
100
- key: "mapBfRangeToArray",
101
- value: function mapBfRangeToArray(low, high, array) {
102
- var i = 0,
103
- ii = array.length;
122
+ }
104
123
 
105
- while (low <= high && i < ii) {
106
- this._map[low] = array[i++];
107
- ++low;
108
- }
124
+ charCodeOf(value) {
125
+ const map = this._map;
126
+
127
+ if (map.length <= 0x10000) {
128
+ return map.indexOf(value);
109
129
  }
110
- }, {
111
- key: "mapOne",
112
- value: function mapOne(src, dst) {
113
- this._map[src] = dst;
114
- }
115
- }, {
116
- key: "lookup",
117
- value: function lookup(code) {
118
- return this._map[code];
119
- }
120
- }, {
121
- key: "contains",
122
- value: function contains(code) {
123
- return this._map[code] !== undefined;
124
- }
125
- }, {
126
- key: "forEach",
127
- value: function forEach(callback) {
128
- var map = this._map;
129
- var length = map.length;
130
-
131
- if (length <= 0x10000) {
132
- for (var i = 0; i < length; i++) {
133
- if (map[i] !== undefined) {
134
- callback(i, map[i]);
135
- }
136
- }
137
- } else {
138
- for (var _i in map) {
139
- callback(_i, map[_i]);
140
- }
130
+
131
+ for (const charCode in map) {
132
+ if (map[charCode] === value) {
133
+ return charCode | 0;
141
134
  }
142
135
  }
143
- }, {
144
- key: "charCodeOf",
145
- value: function charCodeOf(value) {
146
- var map = this._map;
147
136
 
148
- if (map.length <= 0x10000) {
149
- return map.indexOf(value);
150
- }
137
+ return -1;
138
+ }
151
139
 
152
- for (var charCode in map) {
153
- if (map[charCode] === value) {
154
- return charCode | 0;
155
- }
156
- }
140
+ getMap() {
141
+ return this._map;
142
+ }
157
143
 
158
- return -1;
159
- }
160
- }, {
161
- key: "getMap",
162
- value: function getMap() {
163
- return this._map;
164
- }
165
- }, {
166
- key: "readCharCode",
167
- value: function readCharCode(str, offset, out) {
168
- var c = 0;
169
- var codespaceRanges = this.codespaceRanges;
144
+ readCharCode(str, offset, out) {
145
+ let c = 0;
146
+ const codespaceRanges = this.codespaceRanges;
170
147
 
171
- for (var n = 0, nn = codespaceRanges.length; n < nn; n++) {
172
- c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
173
- var codespaceRange = codespaceRanges[n];
148
+ for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
149
+ c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
150
+ const codespaceRange = codespaceRanges[n];
174
151
 
175
- for (var k = 0, kk = codespaceRange.length; k < kk;) {
176
- var low = codespaceRange[k++];
177
- var high = codespaceRange[k++];
152
+ for (let k = 0, kk = codespaceRange.length; k < kk;) {
153
+ const low = codespaceRange[k++];
154
+ const high = codespaceRange[k++];
178
155
 
179
- if (c >= low && c <= high) {
180
- out.charcode = c;
181
- out.length = n + 1;
182
- return;
183
- }
156
+ if (c >= low && c <= high) {
157
+ out.charcode = c;
158
+ out.length = n + 1;
159
+ return;
184
160
  }
185
161
  }
162
+ }
186
163
 
187
- out.charcode = 0;
188
- out.length = 1;
164
+ out.charcode = 0;
165
+ out.length = 1;
166
+ }
167
+
168
+ get length() {
169
+ return this._map.length;
170
+ }
171
+
172
+ get isIdentityCMap() {
173
+ if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
174
+ return false;
189
175
  }
190
- }, {
191
- key: "length",
192
- get: function get() {
193
- return this._map.length;
176
+
177
+ if (this._map.length !== 0x10000) {
178
+ return false;
194
179
  }
195
- }, {
196
- key: "isIdentityCMap",
197
- get: function get() {
198
- if (!(this.name === 'Identity-H' || this.name === 'Identity-V')) {
199
- return false;
200
- }
201
180
 
202
- if (this._map.length !== 0x10000) {
181
+ for (let i = 0; i < 0x10000; i++) {
182
+ if (this._map[i] !== i) {
203
183
  return false;
204
184
  }
205
-
206
- for (var i = 0; i < 0x10000; i++) {
207
- if (this._map[i] !== i) {
208
- return false;
209
- }
210
- }
211
-
212
- return true;
213
185
  }
214
- }]);
215
186
 
216
- return CMap;
217
- }();
187
+ return true;
188
+ }
189
+
190
+ }
218
191
 
219
192
  exports.CMap = CMap;
220
193
 
221
- var IdentityCMap =
222
- /*#__PURE__*/
223
- function (_CMap) {
224
- _inherits(IdentityCMap, _CMap);
194
+ class IdentityCMap extends CMap {
195
+ constructor(vertical, n) {
196
+ super();
197
+ this.vertical = vertical;
198
+ this.addCodespaceRange(n, 0, 0xffff);
199
+ }
225
200
 
226
- function IdentityCMap(vertical, n) {
227
- var _this;
201
+ mapCidRange(low, high, dstLow) {
202
+ (0, _util.unreachable)("should not call mapCidRange");
203
+ }
228
204
 
229
- _classCallCheck(this, IdentityCMap);
205
+ mapBfRange(low, high, dstLow) {
206
+ (0, _util.unreachable)("should not call mapBfRange");
207
+ }
230
208
 
231
- _this = _possibleConstructorReturn(this, _getPrototypeOf(IdentityCMap).call(this));
232
- _this.vertical = vertical;
209
+ mapBfRangeToArray(low, high, array) {
210
+ (0, _util.unreachable)("should not call mapBfRangeToArray");
211
+ }
233
212
 
234
- _this.addCodespaceRange(n, 0, 0xffff);
213
+ mapOne(src, dst) {
214
+ (0, _util.unreachable)("should not call mapCidOne");
215
+ }
235
216
 
236
- return _this;
217
+ lookup(code) {
218
+ return Number.isInteger(code) && code <= 0xffff ? code : undefined;
237
219
  }
238
220
 
239
- _createClass(IdentityCMap, [{
240
- key: "mapCidRange",
241
- value: function mapCidRange(low, high, dstLow) {
242
- (0, _util.unreachable)('should not call mapCidRange');
243
- }
244
- }, {
245
- key: "mapBfRange",
246
- value: function mapBfRange(low, high, dstLow) {
247
- (0, _util.unreachable)('should not call mapBfRange');
248
- }
249
- }, {
250
- key: "mapBfRangeToArray",
251
- value: function mapBfRangeToArray(low, high, array) {
252
- (0, _util.unreachable)('should not call mapBfRangeToArray');
253
- }
254
- }, {
255
- key: "mapOne",
256
- value: function mapOne(src, dst) {
257
- (0, _util.unreachable)('should not call mapCidOne');
258
- }
259
- }, {
260
- key: "lookup",
261
- value: function lookup(code) {
262
- return Number.isInteger(code) && code <= 0xffff ? code : undefined;
263
- }
264
- }, {
265
- key: "contains",
266
- value: function contains(code) {
267
- return Number.isInteger(code) && code <= 0xffff;
268
- }
269
- }, {
270
- key: "forEach",
271
- value: function forEach(callback) {
272
- for (var i = 0; i <= 0xffff; i++) {
273
- callback(i, i);
274
- }
275
- }
276
- }, {
277
- key: "charCodeOf",
278
- value: function charCodeOf(value) {
279
- return Number.isInteger(value) && value <= 0xffff ? value : -1;
221
+ contains(code) {
222
+ return Number.isInteger(code) && code <= 0xffff;
223
+ }
224
+
225
+ forEach(callback) {
226
+ for (let i = 0; i <= 0xffff; i++) {
227
+ callback(i, i);
280
228
  }
281
- }, {
282
- key: "getMap",
283
- value: function getMap() {
284
- var map = new Array(0x10000);
229
+ }
285
230
 
286
- for (var i = 0; i <= 0xffff; i++) {
287
- map[i] = i;
288
- }
231
+ charCodeOf(value) {
232
+ return Number.isInteger(value) && value <= 0xffff ? value : -1;
233
+ }
289
234
 
290
- return map;
291
- }
292
- }, {
293
- key: "length",
294
- get: function get() {
295
- return 0x10000;
296
- }
297
- }, {
298
- key: "isIdentityCMap",
299
- get: function get() {
300
- (0, _util.unreachable)('should not access .isIdentityCMap');
235
+ getMap() {
236
+ const map = new Array(0x10000);
237
+
238
+ for (let i = 0; i <= 0xffff; i++) {
239
+ map[i] = i;
301
240
  }
302
- }]);
303
241
 
304
- return IdentityCMap;
305
- }(CMap);
242
+ return map;
243
+ }
244
+
245
+ get length() {
246
+ return 0x10000;
247
+ }
248
+
249
+ get isIdentityCMap() {
250
+ (0, _util.unreachable)("should not access .isIdentityCMap");
251
+ }
252
+
253
+ }
306
254
 
307
255
  exports.IdentityCMap = IdentityCMap;
308
256
 
@@ -360,14 +308,15 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
360
308
  }
361
309
 
362
310
  BinaryCMapStream.prototype = {
363
- readByte: function readByte() {
311
+ readByte() {
364
312
  if (this.pos >= this.end) {
365
313
  return -1;
366
314
  }
367
315
 
368
316
  return this.buffer[this.pos++];
369
317
  },
370
- readNumber: function readNumber() {
318
+
319
+ readNumber() {
371
320
  var n = 0;
372
321
  var last;
373
322
 
@@ -375,24 +324,27 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
375
324
  var b = this.readByte();
376
325
 
377
326
  if (b < 0) {
378
- throw new _util.FormatError('unexpected EOF in bcmap');
327
+ throw new _util.FormatError("unexpected EOF in bcmap");
379
328
  }
380
329
 
381
330
  last = !(b & 0x80);
382
- n = n << 7 | b & 0x7F;
331
+ n = n << 7 | b & 0x7f;
383
332
  } while (!last);
384
333
 
385
334
  return n;
386
335
  },
387
- readSigned: function readSigned() {
336
+
337
+ readSigned() {
388
338
  var n = this.readNumber();
389
339
  return n & 1 ? ~(n >>> 1) : n >>> 1;
390
340
  },
391
- readHex: function readHex(num, size) {
341
+
342
+ readHex(num, size) {
392
343
  num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
393
344
  this.pos += size + 1;
394
345
  },
395
- readHexNumber: function readHexNumber(num, size) {
346
+
347
+ readHexNumber(num, size) {
396
348
  var last;
397
349
  var stack = this.tmpBuf,
398
350
  sp = 0;
@@ -401,11 +353,11 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
401
353
  var b = this.readByte();
402
354
 
403
355
  if (b < 0) {
404
- throw new _util.FormatError('unexpected EOF in bcmap');
356
+ throw new _util.FormatError("unexpected EOF in bcmap");
405
357
  }
406
358
 
407
359
  last = !(b & 0x80);
408
- stack[sp++] = b & 0x7F;
360
+ stack[sp++] = b & 0x7f;
409
361
  } while (!last);
410
362
 
411
363
  var i = size,
@@ -424,7 +376,8 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
424
376
  bufferSize -= 8;
425
377
  }
426
378
  },
427
- readHexSigned: function readHexSigned(num, size) {
379
+
380
+ readHexSigned(num, size) {
428
381
  this.readHexNumber(num, size);
429
382
  var sign = num[size] & 1 ? 255 : 0;
430
383
  var c = 0;
@@ -434,9 +387,10 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
434
387
  num[i] = c >> 1 ^ sign;
435
388
  }
436
389
  },
437
- readString: function readString() {
390
+
391
+ readString() {
438
392
  var len = this.readNumber();
439
- var s = '';
393
+ var s = "";
440
394
 
441
395
  for (var i = 0; i < len; i++) {
442
396
  s += String.fromCharCode(this.readNumber());
@@ -444,6 +398,7 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
444
398
 
445
399
  return s;
446
400
  }
401
+
447
402
  };
448
403
 
449
404
  function processBinaryCMap(data, cMap, extend) {
@@ -454,9 +409,7 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
454
409
  var useCMap = null;
455
410
  var start = new Uint8Array(MAX_NUM_SIZE);
456
411
  var end = new Uint8Array(MAX_NUM_SIZE);
457
-
458
- var _char = new Uint8Array(MAX_NUM_SIZE);
459
-
412
+ var char = new Uint8Array(MAX_NUM_SIZE);
460
413
  var charCode = new Uint8Array(MAX_NUM_SIZE);
461
414
  var tmp = new Uint8Array(MAX_NUM_SIZE);
462
415
  var code;
@@ -466,7 +419,7 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
466
419
  var type = b >> 5;
467
420
 
468
421
  if (type === 7) {
469
- switch (b & 0x1F) {
422
+ switch (b & 0x1f) {
470
423
  case 0:
471
424
  stream.readString();
472
425
  break;
@@ -483,7 +436,7 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
483
436
  var dataSize = b & 15;
484
437
 
485
438
  if (dataSize + 1 > MAX_NUM_SIZE) {
486
- throw new Error('processBinaryCMap: Invalid dataSize.');
439
+ throw new Error("processBinaryCMap: Invalid dataSize.");
487
440
  }
488
441
 
489
442
  var ucs2DataSize = 1;
@@ -526,20 +479,20 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
526
479
  break;
527
480
 
528
481
  case 2:
529
- stream.readHex(_char, dataSize);
482
+ stream.readHex(char, dataSize);
530
483
  code = stream.readNumber();
531
- cMap.mapOne(hexToInt(_char, dataSize), code);
484
+ cMap.mapOne(hexToInt(char, dataSize), code);
532
485
 
533
486
  for (i = 1; i < subitemsCount; i++) {
534
- incHex(_char, dataSize);
487
+ incHex(char, dataSize);
535
488
 
536
489
  if (!sequence) {
537
490
  stream.readHexNumber(tmp, dataSize);
538
- addHex(_char, tmp, dataSize);
491
+ addHex(char, tmp, dataSize);
539
492
  }
540
493
 
541
494
  code = stream.readSigned() + (code + 1);
542
- cMap.mapOne(hexToInt(_char, dataSize), code);
495
+ cMap.mapOne(hexToInt(char, dataSize), code);
543
496
  }
544
497
 
545
498
  break;
@@ -570,22 +523,22 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
570
523
  break;
571
524
 
572
525
  case 4:
573
- stream.readHex(_char, ucs2DataSize);
526
+ stream.readHex(char, ucs2DataSize);
574
527
  stream.readHex(charCode, dataSize);
575
- cMap.mapOne(hexToInt(_char, ucs2DataSize), hexToStr(charCode, dataSize));
528
+ cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
576
529
 
577
530
  for (i = 1; i < subitemsCount; i++) {
578
- incHex(_char, ucs2DataSize);
531
+ incHex(char, ucs2DataSize);
579
532
 
580
533
  if (!sequence) {
581
534
  stream.readHexNumber(tmp, ucs2DataSize);
582
- addHex(_char, tmp, ucs2DataSize);
535
+ addHex(char, tmp, ucs2DataSize);
583
536
  }
584
537
 
585
538
  incHex(charCode, dataSize);
586
539
  stream.readHexSigned(tmp, dataSize);
587
540
  addHex(charCode, tmp, dataSize);
588
- cMap.mapOne(hexToInt(_char, ucs2DataSize), hexToStr(charCode, dataSize));
541
+ cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
589
542
  }
590
543
 
591
544
  break;
@@ -616,7 +569,7 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
616
569
  break;
617
570
 
618
571
  default:
619
- reject(new Error('processBinaryCMap: Unknown type: ' + type));
572
+ reject(new Error("processBinaryCMap: Unknown type: " + type));
620
573
  return;
621
574
  }
622
575
  }
@@ -651,13 +604,13 @@ var CMapFactory = function CMapFactoryClosure() {
651
604
 
652
605
  function expectString(obj) {
653
606
  if (!(0, _util.isString)(obj)) {
654
- throw new _util.FormatError('Malformed CMap: expected string.');
607
+ throw new _util.FormatError("Malformed CMap: expected string.");
655
608
  }
656
609
  }
657
610
 
658
611
  function expectInt(obj) {
659
612
  if (!Number.isInteger(obj)) {
660
- throw new _util.FormatError('Malformed CMap: expected int.');
613
+ throw new _util.FormatError("Malformed CMap: expected int.");
661
614
  }
662
615
  }
663
616
 
@@ -669,7 +622,7 @@ var CMapFactory = function CMapFactoryClosure() {
669
622
  break;
670
623
  }
671
624
 
672
- if ((0, _primitives.isCmd)(obj, 'endbfchar')) {
625
+ if ((0, _primitives.isCmd)(obj, "endbfchar")) {
673
626
  return;
674
627
  }
675
628
 
@@ -690,7 +643,7 @@ var CMapFactory = function CMapFactoryClosure() {
690
643
  break;
691
644
  }
692
645
 
693
- if ((0, _primitives.isCmd)(obj, 'endbfrange')) {
646
+ if ((0, _primitives.isCmd)(obj, "endbfrange")) {
694
647
  return;
695
648
  }
696
649
 
@@ -704,11 +657,11 @@ var CMapFactory = function CMapFactoryClosure() {
704
657
  if (Number.isInteger(obj) || (0, _util.isString)(obj)) {
705
658
  var dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
706
659
  cMap.mapBfRange(low, high, dstLow);
707
- } else if ((0, _primitives.isCmd)(obj, '[')) {
660
+ } else if ((0, _primitives.isCmd)(obj, "[")) {
708
661
  obj = lexer.getObj();
709
662
  var array = [];
710
663
 
711
- while (!(0, _primitives.isCmd)(obj, ']') && !(0, _primitives.isEOF)(obj)) {
664
+ while (!(0, _primitives.isCmd)(obj, "]") && !(0, _primitives.isEOF)(obj)) {
712
665
  array.push(obj);
713
666
  obj = lexer.getObj();
714
667
  }
@@ -719,7 +672,7 @@ var CMapFactory = function CMapFactoryClosure() {
719
672
  }
720
673
  }
721
674
 
722
- throw new _util.FormatError('Invalid bf range.');
675
+ throw new _util.FormatError("Invalid bf range.");
723
676
  }
724
677
 
725
678
  function parseCidChar(cMap, lexer) {
@@ -730,7 +683,7 @@ var CMapFactory = function CMapFactoryClosure() {
730
683
  break;
731
684
  }
732
685
 
733
- if ((0, _primitives.isCmd)(obj, 'endcidchar')) {
686
+ if ((0, _primitives.isCmd)(obj, "endcidchar")) {
734
687
  return;
735
688
  }
736
689
 
@@ -751,7 +704,7 @@ var CMapFactory = function CMapFactoryClosure() {
751
704
  break;
752
705
  }
753
706
 
754
- if ((0, _primitives.isCmd)(obj, 'endcidrange')) {
707
+ if ((0, _primitives.isCmd)(obj, "endcidrange")) {
755
708
  return;
756
709
  }
757
710
 
@@ -775,7 +728,7 @@ var CMapFactory = function CMapFactoryClosure() {
775
728
  break;
776
729
  }
777
730
 
778
- if ((0, _primitives.isCmd)(obj, 'endcodespacerange')) {
731
+ if ((0, _primitives.isCmd)(obj, "endcodespacerange")) {
779
732
  return;
780
733
  }
781
734
 
@@ -794,7 +747,7 @@ var CMapFactory = function CMapFactoryClosure() {
794
747
  cMap.addCodespaceRange(obj.length, low, high);
795
748
  }
796
749
 
797
- throw new _util.FormatError('Invalid codespace range.');
750
+ throw new _util.FormatError("Invalid codespace range.");
798
751
  }
799
752
 
800
753
  function parseWMode(cMap, lexer) {
@@ -824,42 +777,42 @@ var CMapFactory = function CMapFactoryClosure() {
824
777
  if ((0, _primitives.isEOF)(obj)) {
825
778
  break;
826
779
  } else if ((0, _primitives.isName)(obj)) {
827
- if (obj.name === 'WMode') {
780
+ if (obj.name === "WMode") {
828
781
  parseWMode(cMap, lexer);
829
- } else if (obj.name === 'CMapName') {
782
+ } else if (obj.name === "CMapName") {
830
783
  parseCMapName(cMap, lexer);
831
784
  }
832
785
 
833
786
  previous = obj;
834
787
  } else if ((0, _primitives.isCmd)(obj)) {
835
788
  switch (obj.cmd) {
836
- case 'endcmap':
789
+ case "endcmap":
837
790
  break objLoop;
838
791
 
839
- case 'usecmap':
792
+ case "usecmap":
840
793
  if ((0, _primitives.isName)(previous)) {
841
794
  embeddedUseCMap = previous.name;
842
795
  }
843
796
 
844
797
  break;
845
798
 
846
- case 'begincodespacerange':
799
+ case "begincodespacerange":
847
800
  parseCodespaceRange(cMap, lexer);
848
801
  break;
849
802
 
850
- case 'beginbfchar':
803
+ case "beginbfchar":
851
804
  parseBfChar(cMap, lexer);
852
805
  break;
853
806
 
854
- case 'begincidchar':
807
+ case "begincidchar":
855
808
  parseCidChar(cMap, lexer);
856
809
  break;
857
810
 
858
- case 'beginbfrange':
811
+ case "beginbfrange":
859
812
  parseBfRange(cMap, lexer);
860
813
  break;
861
814
 
862
- case 'begincidrange':
815
+ case "begincidrange":
863
816
  parseCidRange(cMap, lexer);
864
817
  break;
865
818
  }
@@ -869,7 +822,7 @@ var CMapFactory = function CMapFactoryClosure() {
869
822
  throw ex;
870
823
  }
871
824
 
872
- (0, _util.warn)('Invalid cMap data: ' + ex);
825
+ (0, _util.warn)("Invalid cMap data: " + ex);
873
826
  continue;
874
827
  }
875
828
  }
@@ -909,18 +862,18 @@ var CMapFactory = function CMapFactoryClosure() {
909
862
  }
910
863
 
911
864
  function createBuiltInCMap(name, fetchBuiltInCMap) {
912
- if (name === 'Identity-H') {
865
+ if (name === "Identity-H") {
913
866
  return Promise.resolve(new IdentityCMap(false, 2));
914
- } else if (name === 'Identity-V') {
867
+ } else if (name === "Identity-V") {
915
868
  return Promise.resolve(new IdentityCMap(true, 2));
916
869
  }
917
870
 
918
871
  if (!BUILT_IN_CMAPS.includes(name)) {
919
- return Promise.reject(new Error('Unknown CMap name: ' + name));
872
+ return Promise.reject(new Error("Unknown CMap name: " + name));
920
873
  }
921
874
 
922
875
  if (!fetchBuiltInCMap) {
923
- return Promise.reject(new Error('Built-in CMap parameters are not provided.'));
876
+ return Promise.reject(new Error("Built-in CMap parameters are not provided."));
924
877
  }
925
878
 
926
879
  return fetchBuiltInCMap(name).then(function (data) {
@@ -939,12 +892,12 @@ var CMapFactory = function CMapFactoryClosure() {
939
892
  return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
940
893
  }
941
894
 
942
- return Promise.reject(new Error('TODO: Only BINARY/NONE CMap compression is currently supported.'));
895
+ return Promise.reject(new Error("TODO: Only BINARY/NONE CMap compression is currently supported."));
943
896
  });
944
897
  }
945
898
 
946
899
  return {
947
- create: function create(params) {
900
+ async create(params) {
948
901
  var encoding = params.encoding;
949
902
  var fetchBuiltInCMap = params.fetchBuiltInCMap;
950
903
  var useCMap = params.useCMap;
@@ -963,8 +916,9 @@ var CMapFactory = function CMapFactoryClosure() {
963
916
  });
964
917
  }
965
918
 
966
- return Promise.reject(new Error('Encoding required.'));
919
+ throw new Error("Encoding required.");
967
920
  }
921
+
968
922
  };
969
923
  }();
970
924