pdfjs-dist 2.0.943 → 2.4.456

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pdfjs-dist might be problematic. Click here for more details.

Files changed (192) 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 +8286 -14230
  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 +25500 -26628
  9. package/build/pdf.worker.js.map +1 -1
  10. package/build/pdf.worker.min.js +22 -1
  11. package/es5/build/pdf.js +25473 -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 +57878 -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 +407 -0
  29. package/es5/web/pdf_viewer.js +7757 -0
  30. package/es5/web/pdf_viewer.js.map +1 -0
  31. package/image_decoders/pdf.image_decoders.js +2887 -4094
  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 +855 -778
  36. package/lib/core/arithmetic_decoder.js +325 -311
  37. package/lib/core/bidi.js +117 -50
  38. package/lib/core/ccitt.js +251 -89
  39. package/lib/core/ccitt_stream.js +26 -16
  40. package/lib/core/cff_parser.js +525 -197
  41. package/lib/core/charsets.js +6 -5
  42. package/lib/core/chunked_stream.js +541 -406
  43. package/lib/core/cmap.js +368 -253
  44. package/lib/core/colorspace.js +781 -800
  45. package/lib/core/core_utils.js +152 -0
  46. package/lib/core/crypto.js +609 -422
  47. package/lib/core/document.js +649 -481
  48. package/lib/core/encodings.js +33 -24
  49. package/lib/core/evaluator.js +1471 -736
  50. package/lib/core/font_renderer.js +289 -149
  51. package/lib/core/fonts.js +1067 -413
  52. package/lib/core/function.js +517 -287
  53. package/lib/core/glyphlist.js +4529 -4527
  54. package/lib/core/image.js +232 -114
  55. package/lib/core/image_utils.js +94 -0
  56. package/lib/core/jbig2.js +711 -342
  57. package/lib/core/jbig2_stream.js +31 -19
  58. package/lib/core/jpeg_stream.js +151 -26
  59. package/lib/core/jpg.js +433 -181
  60. package/lib/core/jpx.js +551 -143
  61. package/lib/core/jpx_stream.js +40 -28
  62. package/lib/core/metrics.js +2931 -2931
  63. package/lib/core/murmurhash3.js +104 -97
  64. package/lib/core/obj.js +1561 -1053
  65. package/lib/core/operator_list.js +192 -64
  66. package/lib/core/parser.js +1162 -864
  67. package/lib/core/pattern.js +224 -75
  68. package/lib/core/pdf_manager.js +154 -285
  69. package/lib/core/primitives.js +145 -69
  70. package/lib/core/ps_parser.js +212 -162
  71. package/lib/core/standard_fonts.js +245 -244
  72. package/lib/core/stream.js +353 -81
  73. package/lib/core/type1_parser.js +218 -68
  74. package/lib/core/unicode.js +1682 -1655
  75. package/lib/core/worker.js +233 -302
  76. package/lib/core/worker_stream.js +168 -0
  77. package/lib/display/annotation_layer.js +808 -862
  78. package/lib/display/api.js +1778 -1462
  79. package/lib/display/api_compatibility.js +14 -9
  80. package/lib/display/canvas.js +463 -140
  81. package/lib/display/content_disposition.js +86 -58
  82. package/lib/display/display_utils.js +524 -0
  83. package/lib/display/fetch_stream.js +202 -274
  84. package/lib/display/font_loader.js +311 -333
  85. package/lib/display/metadata.js +98 -88
  86. package/lib/display/network.js +343 -347
  87. package/lib/display/network_utils.js +46 -26
  88. package/lib/display/node_stream.js +326 -404
  89. package/lib/display/pattern_helper.js +168 -69
  90. package/lib/display/svg.js +1296 -885
  91. package/lib/display/text_layer.js +229 -103
  92. package/lib/display/transport_stream.js +290 -250
  93. package/lib/display/webgl.js +116 -83
  94. package/lib/display/worker_options.js +6 -5
  95. package/lib/display/xml_parser.js +358 -337
  96. package/lib/examples/node/domstubs.js +95 -39
  97. package/lib/pdf.js +49 -31
  98. package/lib/pdf.worker.js +7 -5
  99. package/lib/shared/compatibility.js +3 -145
  100. package/lib/shared/is_node.js +8 -7
  101. package/lib/shared/message_handler.js +367 -314
  102. package/lib/shared/util.js +421 -415
  103. package/lib/test/unit/annotation_spec.js +1570 -690
  104. package/lib/test/unit/api_spec.js +855 -493
  105. package/lib/test/unit/bidi_spec.js +12 -12
  106. package/lib/test/unit/cff_parser_spec.js +88 -61
  107. package/lib/test/unit/clitests_helper.js +9 -12
  108. package/lib/test/unit/cmap_spec.js +140 -88
  109. package/lib/test/unit/colorspace_spec.js +204 -152
  110. package/lib/test/unit/core_utils_spec.js +211 -0
  111. package/lib/test/unit/crypto_spec.js +194 -182
  112. package/lib/test/unit/custom_spec.js +50 -64
  113. package/lib/test/unit/display_svg_spec.js +53 -38
  114. package/lib/test/unit/display_utils_spec.js +263 -0
  115. package/lib/test/unit/document_spec.js +17 -22
  116. package/lib/test/unit/encodings_spec.js +15 -57
  117. package/lib/test/unit/evaluator_spec.js +90 -83
  118. package/lib/test/unit/fetch_stream_spec.js +111 -0
  119. package/lib/test/unit/function_spec.js +219 -205
  120. package/lib/test/unit/jasmine-boot.js +68 -39
  121. package/lib/test/unit/message_handler_spec.js +187 -160
  122. package/lib/test/unit/metadata_spec.js +87 -34
  123. package/lib/test/unit/murmurhash3_spec.js +13 -13
  124. package/lib/test/unit/network_spec.js +26 -59
  125. package/lib/test/unit/network_utils_spec.js +187 -121
  126. package/lib/test/unit/node_stream_spec.js +98 -90
  127. package/lib/test/unit/parser_spec.js +173 -131
  128. package/lib/test/unit/pdf_find_controller_spec.js +148 -67
  129. package/lib/test/unit/pdf_find_utils_spec.js +35 -34
  130. package/lib/test/unit/pdf_history_spec.js +45 -33
  131. package/lib/test/unit/primitives_spec.js +161 -126
  132. package/lib/test/unit/stream_spec.js +22 -15
  133. package/lib/test/unit/test_utils.js +149 -98
  134. package/lib/test/unit/testreporter.js +36 -18
  135. package/lib/test/unit/type1_parser_spec.js +46 -44
  136. package/lib/test/unit/ui_utils_spec.js +388 -372
  137. package/lib/test/unit/unicode_spec.js +49 -46
  138. package/lib/test/unit/util_spec.js +144 -248
  139. package/lib/web/annotation_layer_builder.js +75 -95
  140. package/lib/web/app.js +1538 -1147
  141. package/lib/web/app_options.js +116 -104
  142. package/lib/web/base_viewer.js +950 -775
  143. package/lib/web/chromecom.js +217 -225
  144. package/lib/web/debugger.js +236 -148
  145. package/lib/web/download_manager.js +50 -50
  146. package/lib/web/firefox_print_service.js +51 -33
  147. package/lib/web/firefoxcom.js +225 -352
  148. package/lib/web/genericcom.js +30 -93
  149. package/lib/web/genericl10n.js +26 -143
  150. package/lib/web/grab_to_pan.js +57 -33
  151. package/lib/web/interfaces.js +105 -232
  152. package/lib/web/overlay_manager.js +73 -227
  153. package/lib/web/password_prompt.js +44 -62
  154. package/lib/web/pdf_attachment_viewer.js +118 -123
  155. package/lib/web/pdf_cursor_tools.js +89 -93
  156. package/lib/web/pdf_document_properties.js +242 -281
  157. package/lib/web/pdf_find_bar.js +157 -163
  158. package/lib/web/pdf_find_controller.js +598 -454
  159. package/lib/web/pdf_find_utils.js +32 -16
  160. package/lib/web/pdf_history.js +481 -355
  161. package/lib/web/pdf_link_service.js +355 -323
  162. package/lib/web/pdf_outline_viewer.js +167 -152
  163. package/lib/web/pdf_page_view.js +511 -457
  164. package/lib/web/pdf_presentation_mode.js +347 -335
  165. package/lib/web/pdf_print_service.js +133 -103
  166. package/lib/web/pdf_rendering_queue.js +98 -100
  167. package/lib/web/pdf_sidebar.js +323 -299
  168. package/lib/web/pdf_sidebar_resizer.js +107 -108
  169. package/lib/web/pdf_single_page_viewer.js +94 -146
  170. package/lib/web/pdf_thumbnail_view.js +319 -269
  171. package/lib/web/pdf_thumbnail_viewer.js +219 -199
  172. package/lib/web/pdf_viewer.component.js +111 -32
  173. package/lib/web/pdf_viewer.js +61 -101
  174. package/lib/web/preferences.js +87 -272
  175. package/lib/web/secondary_toolbar.js +207 -220
  176. package/lib/web/text_layer_builder.js +322 -322
  177. package/lib/web/toolbar.js +227 -180
  178. package/lib/web/ui_utils.js +476 -421
  179. package/lib/web/view_history.js +59 -208
  180. package/lib/web/viewer_compatibility.js +9 -6
  181. package/package.json +2 -9
  182. package/web/pdf_viewer.css +36 -22
  183. package/web/pdf_viewer.js +4407 -4516
  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 -441
  189. package/lib/shared/streams_polyfill.js +0 -39
  190. package/lib/shared/url_polyfill.js +0 -50
  191. package/lib/test/unit/dom_utils_spec.js +0 -89
  192. package/lib/web/dom_events.js +0 -140
@@ -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.
@@ -19,213 +19,272 @@
19
19
  * @licend The above is the entire license notice for the
20
20
  * Javascript code in this page
21
21
  */
22
- 'use strict';
22
+ "use strict";
23
23
 
24
24
  Object.defineProperty(exports, "__esModule", {
25
25
  value: true
26
26
  });
27
- exports.PDFDataTransportStream = undefined;
27
+ exports.PDFDataTransportStream = void 0;
28
28
 
29
- var _regenerator = require('babel-runtime/regenerator');
30
-
31
- var _regenerator2 = _interopRequireDefault(_regenerator);
32
-
33
- var _util = require('../shared/util');
34
-
35
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
36
-
37
- function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
38
-
39
- var PDFDataTransportStream = function PDFDataTransportStreamClosure() {
40
- function PDFDataTransportStream(params, pdfDataRangeTransport) {
41
- var _this = this;
29
+ var _util = require("../shared/util.js");
42
30
 
31
+ class PDFDataTransportStream {
32
+ constructor(params, pdfDataRangeTransport) {
43
33
  (0, _util.assert)(pdfDataRangeTransport);
44
34
  this._queuedChunks = [];
45
- var initialData = params.initialData;
35
+ this._progressiveDone = params.progressiveDone || false;
36
+ const initialData = params.initialData;
37
+
46
38
  if (initialData && initialData.length > 0) {
47
- var buffer = new Uint8Array(initialData).buffer;
39
+ const buffer = new Uint8Array(initialData).buffer;
40
+
48
41
  this._queuedChunks.push(buffer);
49
42
  }
43
+
50
44
  this._pdfDataRangeTransport = pdfDataRangeTransport;
51
45
  this._isStreamingSupported = !params.disableStream;
52
46
  this._isRangeSupported = !params.disableRange;
53
47
  this._contentLength = params.length;
54
48
  this._fullRequestReader = null;
55
49
  this._rangeReaders = [];
56
- this._pdfDataRangeTransport.addRangeListener(function (begin, chunk) {
57
- _this._onReceiveData({
58
- begin: begin,
59
- chunk: chunk
50
+
51
+ this._pdfDataRangeTransport.addRangeListener((begin, chunk) => {
52
+ this._onReceiveData({
53
+ begin,
54
+ chunk
60
55
  });
61
56
  });
62
- this._pdfDataRangeTransport.addProgressListener(function (loaded) {
63
- _this._onProgress({ loaded: loaded });
57
+
58
+ this._pdfDataRangeTransport.addProgressListener((loaded, total) => {
59
+ this._onProgress({
60
+ loaded,
61
+ total
62
+ });
64
63
  });
65
- this._pdfDataRangeTransport.addProgressiveReadListener(function (chunk) {
66
- _this._onReceiveData({ chunk: chunk });
64
+
65
+ this._pdfDataRangeTransport.addProgressiveReadListener(chunk => {
66
+ this._onReceiveData({
67
+ chunk
68
+ });
69
+ });
70
+
71
+ this._pdfDataRangeTransport.addProgressiveDoneListener(() => {
72
+ this._onProgressiveDone();
67
73
  });
74
+
68
75
  this._pdfDataRangeTransport.transportReady();
69
76
  }
70
- PDFDataTransportStream.prototype = {
71
- _onReceiveData: function PDFDataTransportStream_onReceiveData(args) {
72
- var buffer = new Uint8Array(args.chunk).buffer;
73
- if (args.begin === undefined) {
74
- if (this._fullRequestReader) {
75
- this._fullRequestReader._enqueue(buffer);
76
- } else {
77
- this._queuedChunks.push(buffer);
78
- }
77
+
78
+ _onReceiveData(args) {
79
+ const buffer = new Uint8Array(args.chunk).buffer;
80
+
81
+ if (args.begin === undefined) {
82
+ if (this._fullRequestReader) {
83
+ this._fullRequestReader._enqueue(buffer);
79
84
  } else {
80
- var found = this._rangeReaders.some(function (rangeReader) {
81
- if (rangeReader._begin !== args.begin) {
82
- return false;
83
- }
84
- rangeReader._enqueue(buffer);
85
- return true;
86
- });
87
- (0, _util.assert)(found);
85
+ this._queuedChunks.push(buffer);
88
86
  }
89
- },
90
- _onProgress: function PDFDataTransportStream_onDataProgress(evt) {
91
- if (this._rangeReaders.length > 0) {
92
- var firstReader = this._rangeReaders[0];
93
- if (firstReader.onProgress) {
94
- firstReader.onProgress({ loaded: evt.loaded });
87
+ } else {
88
+ const found = this._rangeReaders.some(function (rangeReader) {
89
+ if (rangeReader._begin !== args.begin) {
90
+ return false;
95
91
  }
92
+
93
+ rangeReader._enqueue(buffer);
94
+
95
+ return true;
96
+ });
97
+
98
+ (0, _util.assert)(found);
99
+ }
100
+ }
101
+
102
+ get _progressiveDataLength() {
103
+ return this._fullRequestReader ? this._fullRequestReader._loaded : 0;
104
+ }
105
+
106
+ _onProgress(evt) {
107
+ if (evt.total === undefined) {
108
+ const firstReader = this._rangeReaders[0];
109
+
110
+ if (firstReader && firstReader.onProgress) {
111
+ firstReader.onProgress({
112
+ loaded: evt.loaded
113
+ });
96
114
  }
97
- },
98
- _removeRangeReader: function PDFDataTransportStream_removeRangeReader(reader) {
99
- var i = this._rangeReaders.indexOf(reader);
100
- if (i >= 0) {
101
- this._rangeReaders.splice(i, 1);
102
- }
103
- },
104
- getFullReader: function PDFDataTransportStream_getFullReader() {
105
- (0, _util.assert)(!this._fullRequestReader);
106
- var queuedChunks = this._queuedChunks;
107
- this._queuedChunks = null;
108
- return new PDFDataTransportStreamReader(this, queuedChunks);
109
- },
110
- getRangeReader: function PDFDataTransportStream_getRangeReader(begin, end) {
111
- var reader = new PDFDataTransportStreamRangeReader(this, begin, end);
112
- this._pdfDataRangeTransport.requestDataRange(begin, end);
113
- this._rangeReaders.push(reader);
114
- return reader;
115
- },
116
- cancelAllRequests: function PDFDataTransportStream_cancelAllRequests(reason) {
117
- if (this._fullRequestReader) {
118
- this._fullRequestReader.cancel(reason);
115
+ } else {
116
+ const fullReader = this._fullRequestReader;
117
+
118
+ if (fullReader && fullReader.onProgress) {
119
+ fullReader.onProgress({
120
+ loaded: evt.loaded,
121
+ total: evt.total
122
+ });
119
123
  }
120
- var readers = this._rangeReaders.slice(0);
121
- readers.forEach(function (rangeReader) {
122
- rangeReader.cancel(reason);
123
- });
124
- this._pdfDataRangeTransport.abort();
125
124
  }
126
- };
127
- function PDFDataTransportStreamReader(stream, queuedChunks) {
125
+ }
126
+
127
+ _onProgressiveDone() {
128
+ if (this._fullRequestReader) {
129
+ this._fullRequestReader.progressiveDone();
130
+ }
131
+
132
+ this._progressiveDone = true;
133
+ }
134
+
135
+ _removeRangeReader(reader) {
136
+ const i = this._rangeReaders.indexOf(reader);
137
+
138
+ if (i >= 0) {
139
+ this._rangeReaders.splice(i, 1);
140
+ }
141
+ }
142
+
143
+ getFullReader() {
144
+ (0, _util.assert)(!this._fullRequestReader);
145
+ const queuedChunks = this._queuedChunks;
146
+ this._queuedChunks = null;
147
+ return new PDFDataTransportStreamReader(this, queuedChunks, this._progressiveDone);
148
+ }
149
+
150
+ getRangeReader(begin, end) {
151
+ if (end <= this._progressiveDataLength) {
152
+ return null;
153
+ }
154
+
155
+ const reader = new PDFDataTransportStreamRangeReader(this, begin, end);
156
+
157
+ this._pdfDataRangeTransport.requestDataRange(begin, end);
158
+
159
+ this._rangeReaders.push(reader);
160
+
161
+ return reader;
162
+ }
163
+
164
+ cancelAllRequests(reason) {
165
+ if (this._fullRequestReader) {
166
+ this._fullRequestReader.cancel(reason);
167
+ }
168
+
169
+ const readers = this._rangeReaders.slice(0);
170
+
171
+ readers.forEach(function (rangeReader) {
172
+ rangeReader.cancel(reason);
173
+ });
174
+
175
+ this._pdfDataRangeTransport.abort();
176
+ }
177
+
178
+ }
179
+
180
+ exports.PDFDataTransportStream = PDFDataTransportStream;
181
+
182
+ class PDFDataTransportStreamReader {
183
+ constructor(stream, queuedChunks, progressiveDone = false) {
128
184
  this._stream = stream;
129
- this._done = false;
185
+ this._done = progressiveDone || false;
130
186
  this._filename = null;
131
187
  this._queuedChunks = queuedChunks || [];
188
+ this._loaded = 0;
189
+
190
+ for (const chunk of this._queuedChunks) {
191
+ this._loaded += chunk.byteLength;
192
+ }
193
+
132
194
  this._requests = [];
133
195
  this._headersReady = Promise.resolve();
134
196
  stream._fullRequestReader = this;
135
197
  this.onProgress = null;
136
198
  }
137
- PDFDataTransportStreamReader.prototype = {
138
- _enqueue: function PDFDataTransportStreamReader_enqueue(chunk) {
139
- if (this._done) {
140
- return;
141
- }
142
- if (this._requests.length > 0) {
143
- var requestCapability = this._requests.shift();
144
- requestCapability.resolve({
145
- value: chunk,
146
- done: false
147
- });
148
- return;
149
- }
199
+
200
+ _enqueue(chunk) {
201
+ if (this._done) {
202
+ return;
203
+ }
204
+
205
+ if (this._requests.length > 0) {
206
+ const requestCapability = this._requests.shift();
207
+
208
+ requestCapability.resolve({
209
+ value: chunk,
210
+ done: false
211
+ });
212
+ } else {
150
213
  this._queuedChunks.push(chunk);
151
- },
152
- get headersReady() {
153
- return this._headersReady;
154
- },
155
- get filename() {
156
- return this._filename;
157
- },
158
- get isRangeSupported() {
159
- return this._stream._isRangeSupported;
160
- },
161
- get isStreamingSupported() {
162
- return this._stream._isStreamingSupported;
163
- },
164
- get contentLength() {
165
- return this._stream._contentLength;
166
- },
167
- read: function () {
168
- var _ref = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee() {
169
- var chunk, requestCapability;
170
- return _regenerator2.default.wrap(function _callee$(_context) {
171
- while (1) {
172
- switch (_context.prev = _context.next) {
173
- case 0:
174
- if (!(this._queuedChunks.length > 0)) {
175
- _context.next = 3;
176
- break;
177
- }
178
-
179
- chunk = this._queuedChunks.shift();
180
- return _context.abrupt('return', {
181
- value: chunk,
182
- done: false
183
- });
184
-
185
- case 3:
186
- if (!this._done) {
187
- _context.next = 5;
188
- break;
189
- }
190
-
191
- return _context.abrupt('return', {
192
- value: undefined,
193
- done: true
194
- });
195
-
196
- case 5:
197
- requestCapability = (0, _util.createPromiseCapability)();
198
-
199
- this._requests.push(requestCapability);
200
- return _context.abrupt('return', requestCapability.promise);
201
-
202
- case 8:
203
- case 'end':
204
- return _context.stop();
205
- }
206
- }
207
- }, _callee, this);
208
- }));
209
-
210
- function read() {
211
- return _ref.apply(this, arguments);
212
- }
214
+ }
213
215
 
214
- return read;
215
- }(),
216
+ this._loaded += chunk.byteLength;
217
+ }
216
218
 
217
- cancel: function PDFDataTransportStreamReader_cancel(reason) {
218
- this._done = true;
219
- this._requests.forEach(function (requestCapability) {
220
- requestCapability.resolve({
221
- value: undefined,
222
- done: true
223
- });
219
+ get headersReady() {
220
+ return this._headersReady;
221
+ }
222
+
223
+ get filename() {
224
+ return this._filename;
225
+ }
226
+
227
+ get isRangeSupported() {
228
+ return this._stream._isRangeSupported;
229
+ }
230
+
231
+ get isStreamingSupported() {
232
+ return this._stream._isStreamingSupported;
233
+ }
234
+
235
+ get contentLength() {
236
+ return this._stream._contentLength;
237
+ }
238
+
239
+ async read() {
240
+ if (this._queuedChunks.length > 0) {
241
+ const chunk = this._queuedChunks.shift();
242
+
243
+ return {
244
+ value: chunk,
245
+ done: false
246
+ };
247
+ }
248
+
249
+ if (this._done) {
250
+ return {
251
+ value: undefined,
252
+ done: true
253
+ };
254
+ }
255
+
256
+ const requestCapability = (0, _util.createPromiseCapability)();
257
+
258
+ this._requests.push(requestCapability);
259
+
260
+ return requestCapability.promise;
261
+ }
262
+
263
+ cancel(reason) {
264
+ this._done = true;
265
+
266
+ this._requests.forEach(function (requestCapability) {
267
+ requestCapability.resolve({
268
+ value: undefined,
269
+ done: true
224
270
  });
225
- this._requests = [];
271
+ });
272
+
273
+ this._requests = [];
274
+ }
275
+
276
+ progressiveDone() {
277
+ if (this._done) {
278
+ return;
226
279
  }
227
- };
228
- function PDFDataTransportStreamRangeReader(stream, begin, end) {
280
+
281
+ this._done = true;
282
+ }
283
+
284
+ }
285
+
286
+ class PDFDataTransportStreamRangeReader {
287
+ constructor(stream, begin, end) {
229
288
  this._stream = stream;
230
289
  this._begin = begin;
231
290
  this._end = end;
@@ -234,97 +293,78 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() {
234
293
  this._done = false;
235
294
  this.onProgress = null;
236
295
  }
237
- PDFDataTransportStreamRangeReader.prototype = {
238
- _enqueue: function PDFDataTransportStreamRangeReader_enqueue(chunk) {
239
- if (this._done) {
240
- return;
241
- }
242
- if (this._requests.length === 0) {
243
- this._queuedChunk = chunk;
244
- } else {
245
- var requestsCapability = this._requests.shift();
246
- requestsCapability.resolve({
247
- value: chunk,
248
- done: false
249
- });
250
- this._requests.forEach(function (requestCapability) {
251
- requestCapability.resolve({
252
- value: undefined,
253
- done: true
254
- });
255
- });
256
- this._requests = [];
257
- }
258
- this._done = true;
259
- this._stream._removeRangeReader(this);
260
- },
261
- get isStreamingSupported() {
262
- return false;
263
- },
264
- read: function () {
265
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee2() {
266
- var chunk, requestCapability;
267
- return _regenerator2.default.wrap(function _callee2$(_context2) {
268
- while (1) {
269
- switch (_context2.prev = _context2.next) {
270
- case 0:
271
- if (!this._queuedChunk) {
272
- _context2.next = 4;
273
- break;
274
- }
275
-
276
- chunk = this._queuedChunk;
277
-
278
- this._queuedChunk = null;
279
- return _context2.abrupt('return', {
280
- value: chunk,
281
- done: false
282
- });
283
-
284
- case 4:
285
- if (!this._done) {
286
- _context2.next = 6;
287
- break;
288
- }
289
-
290
- return _context2.abrupt('return', {
291
- value: undefined,
292
- done: true
293
- });
294
-
295
- case 6:
296
- requestCapability = (0, _util.createPromiseCapability)();
297
-
298
- this._requests.push(requestCapability);
299
- return _context2.abrupt('return', requestCapability.promise);
300
-
301
- case 9:
302
- case 'end':
303
- return _context2.stop();
304
- }
305
- }
306
- }, _callee2, this);
307
- }));
308
-
309
- function read() {
310
- return _ref2.apply(this, arguments);
311
- }
312
296
 
313
- return read;
314
- }(),
297
+ _enqueue(chunk) {
298
+ if (this._done) {
299
+ return;
300
+ }
301
+
302
+ if (this._requests.length === 0) {
303
+ this._queuedChunk = chunk;
304
+ } else {
305
+ const requestsCapability = this._requests.shift();
306
+
307
+ requestsCapability.resolve({
308
+ value: chunk,
309
+ done: false
310
+ });
315
311
 
316
- cancel: function PDFDataTransportStreamRangeReader_cancel(reason) {
317
- this._done = true;
318
312
  this._requests.forEach(function (requestCapability) {
319
313
  requestCapability.resolve({
320
314
  value: undefined,
321
315
  done: true
322
316
  });
323
317
  });
318
+
324
319
  this._requests = [];
325
- this._stream._removeRangeReader(this);
326
320
  }
327
- };
328
- return PDFDataTransportStream;
329
- }();
330
- exports.PDFDataTransportStream = PDFDataTransportStream;
321
+
322
+ this._done = true;
323
+
324
+ this._stream._removeRangeReader(this);
325
+ }
326
+
327
+ get isStreamingSupported() {
328
+ return false;
329
+ }
330
+
331
+ async read() {
332
+ if (this._queuedChunk) {
333
+ const chunk = this._queuedChunk;
334
+ this._queuedChunk = null;
335
+ return {
336
+ value: chunk,
337
+ done: false
338
+ };
339
+ }
340
+
341
+ if (this._done) {
342
+ return {
343
+ value: undefined,
344
+ done: true
345
+ };
346
+ }
347
+
348
+ const requestCapability = (0, _util.createPromiseCapability)();
349
+
350
+ this._requests.push(requestCapability);
351
+
352
+ return requestCapability.promise;
353
+ }
354
+
355
+ cancel(reason) {
356
+ this._done = true;
357
+
358
+ this._requests.forEach(function (requestCapability) {
359
+ requestCapability.resolve({
360
+ value: undefined,
361
+ done: true
362
+ });
363
+ });
364
+
365
+ this._requests = [];
366
+
367
+ this._stream._removeRangeReader(this);
368
+ }
369
+
370
+ }