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
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 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.
@@ -26,281 +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 _stream = require("./stream");
35
+ var _core_utils = require("./core_utils.js");
36
36
 
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); }
37
+ var _stream = require("./stream.js");
38
38
 
39
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
40
-
41
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
42
-
43
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
44
-
45
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
46
-
47
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
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 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'];
56
-
57
- var CMap =
58
- /*#__PURE__*/
59
- function () {
60
- function CMap() {
61
- var builtInCMap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
62
-
63
- _classCallCheck(this, CMap);
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;
64
41
 
42
+ class CMap {
43
+ constructor(builtInCMap = false) {
65
44
  this.codespaceRanges = [[], [], [], []];
66
45
  this.numCodespaceRanges = 0;
67
46
  this._map = [];
68
- this.name = '';
47
+ this.name = "";
69
48
  this.vertical = false;
70
49
  this.useCMap = null;
71
50
  this.builtInCMap = builtInCMap;
72
51
  }
73
52
 
74
- _createClass(CMap, [{
75
- key: "addCodespaceRange",
76
- value: function addCodespaceRange(n, low, high) {
77
- this.codespaceRanges[n - 1].push(low, high);
78
- this.numCodespaceRanges++;
53
+ addCodespaceRange(n, low, high) {
54
+ this.codespaceRanges[n - 1].push(low, high);
55
+ this.numCodespaceRanges++;
56
+ }
57
+
58
+ mapCidRange(low, high, dstLow) {
59
+ if (high - low > MAX_MAP_RANGE) {
60
+ throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");
79
61
  }
80
- }, {
81
- key: "mapCidRange",
82
- value: function mapCidRange(low, high, dstLow) {
83
- while (low <= high) {
84
- this._map[low++] = dstLow++;
85
- }
62
+
63
+ while (low <= high) {
64
+ this._map[low++] = dstLow++;
86
65
  }
87
- }, {
88
- key: "mapBfRange",
89
- value: function mapBfRange(low, high, dstLow) {
90
- var lastByte = dstLow.length - 1;
66
+ }
91
67
 
92
- while (low <= high) {
93
- this._map[low++] = dstLow;
94
- dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1);
95
- }
68
+ mapBfRange(low, high, dstLow) {
69
+ if (high - low > MAX_MAP_RANGE) {
70
+ throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");
96
71
  }
97
- }, {
98
- key: "mapBfRangeToArray",
99
- value: function mapBfRangeToArray(low, high, array) {
100
- var i = 0,
101
- ii = array.length;
102
72
 
103
- while (low <= high && i < ii) {
104
- this._map[low] = array[i++];
105
- ++low;
106
- }
73
+ var lastByte = dstLow.length - 1;
74
+
75
+ while (low <= high) {
76
+ this._map[low++] = dstLow;
77
+ dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1);
107
78
  }
108
- }, {
109
- key: "mapOne",
110
- value: function mapOne(src, dst) {
111
- this._map[src] = dst;
112
- }
113
- }, {
114
- key: "lookup",
115
- value: function lookup(code) {
116
- return this._map[code];
117
- }
118
- }, {
119
- key: "contains",
120
- value: function contains(code) {
121
- return this._map[code] !== undefined;
122
- }
123
- }, {
124
- key: "forEach",
125
- value: function forEach(callback) {
126
- var map = this._map;
127
- var length = map.length;
128
-
129
- if (length <= 0x10000) {
130
- for (var i = 0; i < length; i++) {
131
- if (map[i] !== undefined) {
132
- callback(i, map[i]);
133
- }
134
- }
135
- } else {
136
- for (var _i in map) {
137
- callback(_i, map[_i]);
138
- }
139
- }
79
+ }
80
+
81
+ mapBfRangeToArray(low, high, array) {
82
+ if (high - low > MAX_MAP_RANGE) {
83
+ throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");
140
84
  }
141
- }, {
142
- key: "charCodeOf",
143
- value: function charCodeOf(value) {
144
- var map = this._map;
145
85
 
146
- if (map.length <= 0x10000) {
147
- return map.indexOf(value);
148
- }
86
+ const ii = array.length;
87
+ let i = 0;
88
+
89
+ while (low <= high && i < ii) {
90
+ this._map[low] = array[i++];
91
+ ++low;
92
+ }
93
+ }
149
94
 
150
- for (var charCode in map) {
151
- if (map[charCode] === value) {
152
- return charCode | 0;
95
+ mapOne(src, dst) {
96
+ this._map[src] = dst;
97
+ }
98
+
99
+ lookup(code) {
100
+ return this._map[code];
101
+ }
102
+
103
+ contains(code) {
104
+ return this._map[code] !== undefined;
105
+ }
106
+
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]);
153
115
  }
154
116
  }
117
+ } else {
118
+ for (const i in map) {
119
+ callback(i, map[i]);
120
+ }
121
+ }
122
+ }
123
+
124
+ charCodeOf(value) {
125
+ const map = this._map;
155
126
 
156
- return -1;
127
+ if (map.length <= 0x10000) {
128
+ return map.indexOf(value);
157
129
  }
158
- }, {
159
- key: "getMap",
160
- value: function getMap() {
161
- return this._map;
130
+
131
+ for (const charCode in map) {
132
+ if (map[charCode] === value) {
133
+ return charCode | 0;
134
+ }
162
135
  }
163
- }, {
164
- key: "readCharCode",
165
- value: function readCharCode(str, offset, out) {
166
- var c = 0;
167
- var codespaceRanges = this.codespaceRanges;
168
136
 
169
- for (var n = 0, nn = codespaceRanges.length; n < nn; n++) {
170
- c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
171
- var codespaceRange = codespaceRanges[n];
137
+ return -1;
138
+ }
139
+
140
+ getMap() {
141
+ return this._map;
142
+ }
172
143
 
173
- for (var k = 0, kk = codespaceRange.length; k < kk;) {
174
- var low = codespaceRange[k++];
175
- var high = codespaceRange[k++];
144
+ readCharCode(str, offset, out) {
145
+ let c = 0;
146
+ const codespaceRanges = this.codespaceRanges;
176
147
 
177
- if (c >= low && c <= high) {
178
- out.charcode = c;
179
- out.length = n + 1;
180
- return;
181
- }
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];
151
+
152
+ for (let k = 0, kk = codespaceRange.length; k < kk;) {
153
+ const low = codespaceRange[k++];
154
+ const high = codespaceRange[k++];
155
+
156
+ if (c >= low && c <= high) {
157
+ out.charcode = c;
158
+ out.length = n + 1;
159
+ return;
182
160
  }
183
161
  }
162
+ }
163
+
164
+ out.charcode = 0;
165
+ out.length = 1;
166
+ }
184
167
 
185
- out.charcode = 0;
186
- out.length = 1;
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;
187
175
  }
188
- }, {
189
- key: "length",
190
- get: function get() {
191
- return this._map.length;
176
+
177
+ if (this._map.length !== 0x10000) {
178
+ return false;
192
179
  }
193
- }, {
194
- key: "isIdentityCMap",
195
- get: function get() {
196
- if (!(this.name === 'Identity-H' || this.name === 'Identity-V')) {
197
- return false;
198
- }
199
180
 
200
- if (this._map.length !== 0x10000) {
181
+ for (let i = 0; i < 0x10000; i++) {
182
+ if (this._map[i] !== i) {
201
183
  return false;
202
184
  }
203
-
204
- for (var i = 0; i < 0x10000; i++) {
205
- if (this._map[i] !== i) {
206
- return false;
207
- }
208
- }
209
-
210
- return true;
211
185
  }
212
- }]);
213
186
 
214
- return CMap;
215
- }();
187
+ return true;
188
+ }
189
+
190
+ }
216
191
 
217
192
  exports.CMap = CMap;
218
193
 
219
- var IdentityCMap =
220
- /*#__PURE__*/
221
- function (_CMap) {
222
- _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
+ }
223
200
 
224
- function IdentityCMap(vertical, n) {
225
- var _this;
201
+ mapCidRange(low, high, dstLow) {
202
+ (0, _util.unreachable)("should not call mapCidRange");
203
+ }
226
204
 
227
- _classCallCheck(this, IdentityCMap);
205
+ mapBfRange(low, high, dstLow) {
206
+ (0, _util.unreachable)("should not call mapBfRange");
207
+ }
228
208
 
229
- _this = _possibleConstructorReturn(this, _getPrototypeOf(IdentityCMap).call(this));
230
- _this.vertical = vertical;
209
+ mapBfRangeToArray(low, high, array) {
210
+ (0, _util.unreachable)("should not call mapBfRangeToArray");
211
+ }
231
212
 
232
- _this.addCodespaceRange(n, 0, 0xffff);
213
+ mapOne(src, dst) {
214
+ (0, _util.unreachable)("should not call mapCidOne");
215
+ }
233
216
 
234
- return _this;
217
+ lookup(code) {
218
+ return Number.isInteger(code) && code <= 0xffff ? code : undefined;
235
219
  }
236
220
 
237
- _createClass(IdentityCMap, [{
238
- key: "mapCidRange",
239
- value: function mapCidRange(low, high, dstLow) {
240
- (0, _util.unreachable)('should not call mapCidRange');
241
- }
242
- }, {
243
- key: "mapBfRange",
244
- value: function mapBfRange(low, high, dstLow) {
245
- (0, _util.unreachable)('should not call mapBfRange');
246
- }
247
- }, {
248
- key: "mapBfRangeToArray",
249
- value: function mapBfRangeToArray(low, high, array) {
250
- (0, _util.unreachable)('should not call mapBfRangeToArray');
251
- }
252
- }, {
253
- key: "mapOne",
254
- value: function mapOne(src, dst) {
255
- (0, _util.unreachable)('should not call mapCidOne');
256
- }
257
- }, {
258
- key: "lookup",
259
- value: function lookup(code) {
260
- return Number.isInteger(code) && code <= 0xffff ? code : undefined;
261
- }
262
- }, {
263
- key: "contains",
264
- value: function contains(code) {
265
- return Number.isInteger(code) && code <= 0xffff;
266
- }
267
- }, {
268
- key: "forEach",
269
- value: function forEach(callback) {
270
- for (var i = 0; i <= 0xffff; i++) {
271
- callback(i, i);
272
- }
273
- }
274
- }, {
275
- key: "charCodeOf",
276
- value: function charCodeOf(value) {
277
- 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);
278
228
  }
279
- }, {
280
- key: "getMap",
281
- value: function getMap() {
282
- var map = new Array(0x10000);
229
+ }
283
230
 
284
- for (var i = 0; i <= 0xffff; i++) {
285
- map[i] = i;
286
- }
231
+ charCodeOf(value) {
232
+ return Number.isInteger(value) && value <= 0xffff ? value : -1;
233
+ }
287
234
 
288
- return map;
289
- }
290
- }, {
291
- key: "length",
292
- get: function get() {
293
- return 0x10000;
294
- }
295
- }, {
296
- key: "isIdentityCMap",
297
- get: function get() {
298
- (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;
299
240
  }
300
- }]);
301
241
 
302
- return IdentityCMap;
303
- }(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
+ }
304
254
 
305
255
  exports.IdentityCMap = IdentityCMap;
306
256
 
@@ -358,14 +308,15 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
358
308
  }
359
309
 
360
310
  BinaryCMapStream.prototype = {
361
- readByte: function readByte() {
311
+ readByte() {
362
312
  if (this.pos >= this.end) {
363
313
  return -1;
364
314
  }
365
315
 
366
316
  return this.buffer[this.pos++];
367
317
  },
368
- readNumber: function readNumber() {
318
+
319
+ readNumber() {
369
320
  var n = 0;
370
321
  var last;
371
322
 
@@ -373,24 +324,27 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
373
324
  var b = this.readByte();
374
325
 
375
326
  if (b < 0) {
376
- throw new _util.FormatError('unexpected EOF in bcmap');
327
+ throw new _util.FormatError("unexpected EOF in bcmap");
377
328
  }
378
329
 
379
330
  last = !(b & 0x80);
380
- n = n << 7 | b & 0x7F;
331
+ n = n << 7 | b & 0x7f;
381
332
  } while (!last);
382
333
 
383
334
  return n;
384
335
  },
385
- readSigned: function readSigned() {
336
+
337
+ readSigned() {
386
338
  var n = this.readNumber();
387
339
  return n & 1 ? ~(n >>> 1) : n >>> 1;
388
340
  },
389
- readHex: function readHex(num, size) {
341
+
342
+ readHex(num, size) {
390
343
  num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
391
344
  this.pos += size + 1;
392
345
  },
393
- readHexNumber: function readHexNumber(num, size) {
346
+
347
+ readHexNumber(num, size) {
394
348
  var last;
395
349
  var stack = this.tmpBuf,
396
350
  sp = 0;
@@ -399,11 +353,11 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
399
353
  var b = this.readByte();
400
354
 
401
355
  if (b < 0) {
402
- throw new _util.FormatError('unexpected EOF in bcmap');
356
+ throw new _util.FormatError("unexpected EOF in bcmap");
403
357
  }
404
358
 
405
359
  last = !(b & 0x80);
406
- stack[sp++] = b & 0x7F;
360
+ stack[sp++] = b & 0x7f;
407
361
  } while (!last);
408
362
 
409
363
  var i = size,
@@ -422,7 +376,8 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
422
376
  bufferSize -= 8;
423
377
  }
424
378
  },
425
- readHexSigned: function readHexSigned(num, size) {
379
+
380
+ readHexSigned(num, size) {
426
381
  this.readHexNumber(num, size);
427
382
  var sign = num[size] & 1 ? 255 : 0;
428
383
  var c = 0;
@@ -432,9 +387,10 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
432
387
  num[i] = c >> 1 ^ sign;
433
388
  }
434
389
  },
435
- readString: function readString() {
390
+
391
+ readString() {
436
392
  var len = this.readNumber();
437
- var s = '';
393
+ var s = "";
438
394
 
439
395
  for (var i = 0; i < len; i++) {
440
396
  s += String.fromCharCode(this.readNumber());
@@ -442,6 +398,7 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
442
398
 
443
399
  return s;
444
400
  }
401
+
445
402
  };
446
403
 
447
404
  function processBinaryCMap(data, cMap, extend) {
@@ -462,7 +419,7 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
462
419
  var type = b >> 5;
463
420
 
464
421
  if (type === 7) {
465
- switch (b & 0x1F) {
422
+ switch (b & 0x1f) {
466
423
  case 0:
467
424
  stream.readString();
468
425
  break;
@@ -479,7 +436,7 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
479
436
  var dataSize = b & 15;
480
437
 
481
438
  if (dataSize + 1 > MAX_NUM_SIZE) {
482
- throw new Error('processBinaryCMap: Invalid dataSize.');
439
+ throw new Error("processBinaryCMap: Invalid dataSize.");
483
440
  }
484
441
 
485
442
  var ucs2DataSize = 1;
@@ -612,7 +569,7 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
612
569
  break;
613
570
 
614
571
  default:
615
- reject(new Error('processBinaryCMap: Unknown type: ' + type));
572
+ reject(new Error("processBinaryCMap: Unknown type: " + type));
616
573
  return;
617
574
  }
618
575
  }
@@ -647,13 +604,13 @@ var CMapFactory = function CMapFactoryClosure() {
647
604
 
648
605
  function expectString(obj) {
649
606
  if (!(0, _util.isString)(obj)) {
650
- throw new _util.FormatError('Malformed CMap: expected string.');
607
+ throw new _util.FormatError("Malformed CMap: expected string.");
651
608
  }
652
609
  }
653
610
 
654
611
  function expectInt(obj) {
655
612
  if (!Number.isInteger(obj)) {
656
- throw new _util.FormatError('Malformed CMap: expected int.');
613
+ throw new _util.FormatError("Malformed CMap: expected int.");
657
614
  }
658
615
  }
659
616
 
@@ -665,7 +622,7 @@ var CMapFactory = function CMapFactoryClosure() {
665
622
  break;
666
623
  }
667
624
 
668
- if ((0, _primitives.isCmd)(obj, 'endbfchar')) {
625
+ if ((0, _primitives.isCmd)(obj, "endbfchar")) {
669
626
  return;
670
627
  }
671
628
 
@@ -686,7 +643,7 @@ var CMapFactory = function CMapFactoryClosure() {
686
643
  break;
687
644
  }
688
645
 
689
- if ((0, _primitives.isCmd)(obj, 'endbfrange')) {
646
+ if ((0, _primitives.isCmd)(obj, "endbfrange")) {
690
647
  return;
691
648
  }
692
649
 
@@ -700,11 +657,11 @@ var CMapFactory = function CMapFactoryClosure() {
700
657
  if (Number.isInteger(obj) || (0, _util.isString)(obj)) {
701
658
  var dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
702
659
  cMap.mapBfRange(low, high, dstLow);
703
- } else if ((0, _primitives.isCmd)(obj, '[')) {
660
+ } else if ((0, _primitives.isCmd)(obj, "[")) {
704
661
  obj = lexer.getObj();
705
662
  var array = [];
706
663
 
707
- while (!(0, _primitives.isCmd)(obj, ']') && !(0, _primitives.isEOF)(obj)) {
664
+ while (!(0, _primitives.isCmd)(obj, "]") && !(0, _primitives.isEOF)(obj)) {
708
665
  array.push(obj);
709
666
  obj = lexer.getObj();
710
667
  }
@@ -715,7 +672,7 @@ var CMapFactory = function CMapFactoryClosure() {
715
672
  }
716
673
  }
717
674
 
718
- throw new _util.FormatError('Invalid bf range.');
675
+ throw new _util.FormatError("Invalid bf range.");
719
676
  }
720
677
 
721
678
  function parseCidChar(cMap, lexer) {
@@ -726,7 +683,7 @@ var CMapFactory = function CMapFactoryClosure() {
726
683
  break;
727
684
  }
728
685
 
729
- if ((0, _primitives.isCmd)(obj, 'endcidchar')) {
686
+ if ((0, _primitives.isCmd)(obj, "endcidchar")) {
730
687
  return;
731
688
  }
732
689
 
@@ -747,7 +704,7 @@ var CMapFactory = function CMapFactoryClosure() {
747
704
  break;
748
705
  }
749
706
 
750
- if ((0, _primitives.isCmd)(obj, 'endcidrange')) {
707
+ if ((0, _primitives.isCmd)(obj, "endcidrange")) {
751
708
  return;
752
709
  }
753
710
 
@@ -771,7 +728,7 @@ var CMapFactory = function CMapFactoryClosure() {
771
728
  break;
772
729
  }
773
730
 
774
- if ((0, _primitives.isCmd)(obj, 'endcodespacerange')) {
731
+ if ((0, _primitives.isCmd)(obj, "endcodespacerange")) {
775
732
  return;
776
733
  }
777
734
 
@@ -790,7 +747,7 @@ var CMapFactory = function CMapFactoryClosure() {
790
747
  cMap.addCodespaceRange(obj.length, low, high);
791
748
  }
792
749
 
793
- throw new _util.FormatError('Invalid codespace range.');
750
+ throw new _util.FormatError("Invalid codespace range.");
794
751
  }
795
752
 
796
753
  function parseWMode(cMap, lexer) {
@@ -820,52 +777,52 @@ var CMapFactory = function CMapFactoryClosure() {
820
777
  if ((0, _primitives.isEOF)(obj)) {
821
778
  break;
822
779
  } else if ((0, _primitives.isName)(obj)) {
823
- if (obj.name === 'WMode') {
780
+ if (obj.name === "WMode") {
824
781
  parseWMode(cMap, lexer);
825
- } else if (obj.name === 'CMapName') {
782
+ } else if (obj.name === "CMapName") {
826
783
  parseCMapName(cMap, lexer);
827
784
  }
828
785
 
829
786
  previous = obj;
830
787
  } else if ((0, _primitives.isCmd)(obj)) {
831
788
  switch (obj.cmd) {
832
- case 'endcmap':
789
+ case "endcmap":
833
790
  break objLoop;
834
791
 
835
- case 'usecmap':
792
+ case "usecmap":
836
793
  if ((0, _primitives.isName)(previous)) {
837
794
  embeddedUseCMap = previous.name;
838
795
  }
839
796
 
840
797
  break;
841
798
 
842
- case 'begincodespacerange':
799
+ case "begincodespacerange":
843
800
  parseCodespaceRange(cMap, lexer);
844
801
  break;
845
802
 
846
- case 'beginbfchar':
803
+ case "beginbfchar":
847
804
  parseBfChar(cMap, lexer);
848
805
  break;
849
806
 
850
- case 'begincidchar':
807
+ case "begincidchar":
851
808
  parseCidChar(cMap, lexer);
852
809
  break;
853
810
 
854
- case 'beginbfrange':
811
+ case "beginbfrange":
855
812
  parseBfRange(cMap, lexer);
856
813
  break;
857
814
 
858
- case 'begincidrange':
815
+ case "begincidrange":
859
816
  parseCidRange(cMap, lexer);
860
817
  break;
861
818
  }
862
819
  }
863
820
  } catch (ex) {
864
- if (ex instanceof _util.MissingDataException) {
821
+ if (ex instanceof _core_utils.MissingDataException) {
865
822
  throw ex;
866
823
  }
867
824
 
868
- (0, _util.warn)('Invalid cMap data: ' + ex);
825
+ (0, _util.warn)("Invalid cMap data: " + ex);
869
826
  continue;
870
827
  }
871
828
  }
@@ -905,18 +862,18 @@ var CMapFactory = function CMapFactoryClosure() {
905
862
  }
906
863
 
907
864
  function createBuiltInCMap(name, fetchBuiltInCMap) {
908
- if (name === 'Identity-H') {
865
+ if (name === "Identity-H") {
909
866
  return Promise.resolve(new IdentityCMap(false, 2));
910
- } else if (name === 'Identity-V') {
867
+ } else if (name === "Identity-V") {
911
868
  return Promise.resolve(new IdentityCMap(true, 2));
912
869
  }
913
870
 
914
871
  if (!BUILT_IN_CMAPS.includes(name)) {
915
- return Promise.reject(new Error('Unknown CMap name: ' + name));
872
+ return Promise.reject(new Error("Unknown CMap name: " + name));
916
873
  }
917
874
 
918
875
  if (!fetchBuiltInCMap) {
919
- 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."));
920
877
  }
921
878
 
922
879
  return fetchBuiltInCMap(name).then(function (data) {
@@ -935,12 +892,12 @@ var CMapFactory = function CMapFactoryClosure() {
935
892
  return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
936
893
  }
937
894
 
938
- 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."));
939
896
  });
940
897
  }
941
898
 
942
899
  return {
943
- create: function create(params) {
900
+ async create(params) {
944
901
  var encoding = params.encoding;
945
902
  var fetchBuiltInCMap = params.fetchBuiltInCMap;
946
903
  var useCMap = params.useCMap;
@@ -959,8 +916,9 @@ var CMapFactory = function CMapFactoryClosure() {
959
916
  });
960
917
  }
961
918
 
962
- return Promise.reject(new Error('Encoding required.'));
919
+ throw new Error("Encoding required.");
963
920
  }
921
+
964
922
  };
965
923
  }();
966
924