pdfjs-dist 2.0.550 → 2.3.200

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 (168) hide show
  1. package/CODE_OF_CONDUCT.md +15 -0
  2. package/bower.json +1 -1
  3. package/build/pdf.js +21618 -14369
  4. package/build/pdf.js.map +1 -1
  5. package/build/pdf.min.js +1 -1
  6. package/build/pdf.worker.js +22758 -11399
  7. package/build/pdf.worker.js.map +1 -1
  8. package/build/pdf.worker.min.js +1 -1
  9. package/image_decoders/pdf.image_decoders.js +11500 -0
  10. package/image_decoders/pdf.image_decoders.js.map +1 -0
  11. package/image_decoders/pdf.image_decoders.min.js +1 -0
  12. package/lib/core/annotation.js +767 -258
  13. package/lib/core/arithmetic_decoder.js +275 -245
  14. package/lib/core/bidi.js +65 -6
  15. package/lib/core/ccitt.js +173 -18
  16. package/lib/core/ccitt_stream.js +15 -6
  17. package/lib/core/cff_parser.js +433 -61
  18. package/lib/core/charsets.js +5 -4
  19. package/lib/core/chunked_stream.js +428 -157
  20. package/lib/core/cmap.js +326 -87
  21. package/lib/core/colorspace.js +874 -594
  22. package/lib/core/core_utils.js +173 -0
  23. package/lib/core/crypto.js +290 -45
  24. package/lib/core/document.js +575 -272
  25. package/lib/core/encodings.js +19 -10
  26. package/lib/core/evaluator.js +1032 -351
  27. package/lib/core/font_renderer.js +331 -97
  28. package/lib/core/fonts.js +813 -196
  29. package/lib/core/function.js +253 -27
  30. package/lib/core/glyphlist.js +5 -3
  31. package/lib/core/image.js +169 -62
  32. package/lib/core/image_utils.js +111 -0
  33. package/lib/core/jbig2.js +502 -72
  34. package/lib/core/jbig2_stream.js +19 -8
  35. package/lib/core/jpeg_stream.js +38 -13
  36. package/lib/core/jpg.js +293 -52
  37. package/lib/core/jpx.js +419 -12
  38. package/lib/core/jpx_stream.js +18 -6
  39. package/lib/core/metrics.js +15 -15
  40. package/lib/core/murmurhash3.js +56 -34
  41. package/lib/core/obj.js +1368 -500
  42. package/lib/core/operator_list.js +159 -43
  43. package/lib/core/parser.js +544 -199
  44. package/lib/core/pattern.js +170 -21
  45. package/lib/core/pdf_manager.js +324 -134
  46. package/lib/core/primitives.js +169 -61
  47. package/lib/core/ps_parser.js +134 -45
  48. package/lib/core/standard_fonts.js +17 -17
  49. package/lib/core/stream.js +327 -34
  50. package/lib/core/type1_parser.js +148 -8
  51. package/lib/core/unicode.js +32 -5
  52. package/lib/core/worker.js +215 -229
  53. package/lib/core/worker_stream.js +277 -0
  54. package/lib/display/annotation_layer.js +618 -192
  55. package/lib/display/api.js +1798 -882
  56. package/lib/display/api_compatibility.js +5 -10
  57. package/lib/display/canvas.js +366 -45
  58. package/lib/display/content_disposition.js +71 -24
  59. package/lib/display/display_utils.js +777 -0
  60. package/lib/display/fetch_stream.js +205 -87
  61. package/lib/display/font_loader.js +468 -236
  62. package/lib/display/metadata.js +38 -16
  63. package/lib/display/network.js +635 -428
  64. package/lib/display/network_utils.js +38 -19
  65. package/lib/display/node_stream.js +367 -175
  66. package/lib/display/pattern_helper.js +103 -36
  67. package/lib/display/svg.js +1232 -519
  68. package/lib/display/text_layer.js +208 -75
  69. package/lib/display/transport_stream.js +345 -94
  70. package/lib/display/webgl.js +64 -18
  71. package/lib/display/worker_options.js +5 -4
  72. package/lib/display/xml_parser.js +166 -53
  73. package/lib/examples/node/domstubs.js +60 -4
  74. package/lib/pdf.js +35 -14
  75. package/lib/pdf.worker.js +5 -3
  76. package/lib/shared/compatibility.js +170 -572
  77. package/lib/shared/global_scope.js +2 -2
  78. package/lib/shared/is_node.js +4 -4
  79. package/lib/shared/message_handler.js +216 -163
  80. package/lib/shared/streams_polyfill.js +21 -17
  81. package/lib/shared/util.js +495 -385
  82. package/lib/test/unit/annotation_spec.js +1464 -401
  83. package/lib/test/unit/api_spec.js +718 -361
  84. package/lib/test/unit/bidi_spec.js +7 -7
  85. package/lib/test/unit/cff_parser_spec.js +54 -11
  86. package/lib/test/unit/clitests_helper.js +9 -10
  87. package/lib/test/unit/cmap_spec.js +95 -41
  88. package/lib/test/unit/colorspace_spec.js +115 -63
  89. package/lib/test/unit/core_utils_spec.js +191 -0
  90. package/lib/test/unit/crypto_spec.js +17 -5
  91. package/lib/test/unit/custom_spec.js +43 -55
  92. package/lib/test/unit/display_svg_spec.js +34 -18
  93. package/lib/test/unit/display_utils_spec.js +273 -0
  94. package/lib/test/unit/document_spec.js +8 -13
  95. package/lib/test/unit/encodings_spec.js +25 -45
  96. package/lib/test/unit/evaluator_spec.js +59 -20
  97. package/lib/test/unit/fetch_stream_spec.js +111 -0
  98. package/lib/test/unit/function_spec.js +17 -5
  99. package/lib/test/unit/jasmine-boot.js +33 -20
  100. package/lib/test/unit/message_handler_spec.js +30 -13
  101. package/lib/test/unit/metadata_spec.js +71 -11
  102. package/lib/test/unit/murmurhash3_spec.js +3 -3
  103. package/lib/test/unit/network_spec.js +22 -55
  104. package/lib/test/unit/network_utils_spec.js +105 -14
  105. package/lib/test/unit/node_stream_spec.js +58 -34
  106. package/lib/test/unit/parser_spec.js +162 -71
  107. package/lib/test/unit/pdf_find_controller_spec.js +230 -0
  108. package/lib/test/unit/pdf_find_utils_spec.js +63 -0
  109. package/lib/test/unit/pdf_history_spec.js +21 -9
  110. package/lib/test/unit/primitives_spec.js +55 -22
  111. package/lib/test/unit/stream_spec.js +12 -4
  112. package/lib/test/unit/test_utils.js +273 -56
  113. package/lib/test/unit/testreporter.js +21 -3
  114. package/lib/test/unit/type1_parser_spec.js +9 -7
  115. package/lib/test/unit/ui_utils_spec.js +236 -36
  116. package/lib/test/unit/unicode_spec.js +18 -15
  117. package/lib/test/unit/util_spec.js +87 -128
  118. package/lib/web/annotation_layer_builder.js +39 -22
  119. package/lib/web/app.js +1252 -609
  120. package/lib/web/app_options.js +103 -65
  121. package/lib/web/base_viewer.js +522 -242
  122. package/lib/web/chromecom.js +259 -117
  123. package/lib/web/debugger.js +166 -22
  124. package/lib/web/download_manager.js +31 -12
  125. package/lib/web/firefox_print_service.js +27 -14
  126. package/lib/web/firefoxcom.js +318 -78
  127. package/lib/web/genericcom.js +89 -30
  128. package/lib/web/genericl10n.js +142 -30
  129. package/lib/web/grab_to_pan.js +28 -4
  130. package/lib/web/interfaces.js +174 -47
  131. package/lib/web/overlay_manager.js +235 -85
  132. package/lib/web/password_prompt.js +22 -14
  133. package/lib/web/pdf_attachment_viewer.js +38 -18
  134. package/lib/web/pdf_cursor_tools.js +39 -16
  135. package/lib/web/pdf_document_properties.js +255 -136
  136. package/lib/web/pdf_find_bar.js +84 -40
  137. package/lib/web/pdf_find_controller.js +495 -184
  138. package/lib/web/pdf_find_utils.js +111 -0
  139. package/lib/web/pdf_history.js +190 -53
  140. package/lib/web/pdf_link_service.js +144 -79
  141. package/lib/web/pdf_outline_viewer.js +124 -47
  142. package/lib/web/pdf_page_view.js +194 -74
  143. package/lib/web/pdf_presentation_mode.js +99 -34
  144. package/lib/web/pdf_print_service.js +59 -13
  145. package/lib/web/pdf_rendering_queue.js +28 -9
  146. package/lib/web/pdf_sidebar.js +144 -81
  147. package/lib/web/pdf_sidebar_resizer.js +42 -16
  148. package/lib/web/pdf_single_page_viewer.js +74 -66
  149. package/lib/web/pdf_thumbnail_view.js +104 -33
  150. package/lib/web/pdf_thumbnail_viewer.js +66 -26
  151. package/lib/web/pdf_viewer.component.js +112 -32
  152. package/lib/web/pdf_viewer.js +82 -87
  153. package/lib/web/preferences.js +284 -91
  154. package/lib/web/secondary_toolbar.js +132 -59
  155. package/lib/web/text_layer_builder.js +134 -59
  156. package/lib/web/toolbar.js +80 -43
  157. package/lib/web/ui_utils.js +400 -134
  158. package/lib/web/view_history.js +215 -67
  159. package/lib/web/viewer_compatibility.js +3 -8
  160. package/package.json +3 -2
  161. package/web/pdf_viewer.css +23 -15
  162. package/web/pdf_viewer.js +3429 -1245
  163. package/web/pdf_viewer.js.map +1 -1
  164. package/external/streams/streams-lib.js +0 -3962
  165. package/lib/display/dom_utils.js +0 -429
  166. package/lib/test/unit/dom_utils_spec.js +0 -89
  167. package/lib/test/unit/fonts_spec.js +0 -81
  168. package/lib/web/dom_events.js +0 -137
@@ -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 2017 Mozilla Foundation
5
+ * Copyright 2019 Mozilla Foundation
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
8
8
  * you may not use this file except in compliance with the License.
@@ -24,244 +24,257 @@
24
24
  Object.defineProperty(exports, "__esModule", {
25
25
  value: true
26
26
  });
27
- var ArithmeticDecoder = function ArithmeticDecoderClosure() {
28
- var QeTable = [{
29
- qe: 0x5601,
30
- nmps: 1,
31
- nlps: 1,
32
- switchFlag: 1
33
- }, {
34
- qe: 0x3401,
35
- nmps: 2,
36
- nlps: 6,
37
- switchFlag: 0
38
- }, {
39
- qe: 0x1801,
40
- nmps: 3,
41
- nlps: 9,
42
- switchFlag: 0
43
- }, {
44
- qe: 0x0AC1,
45
- nmps: 4,
46
- nlps: 12,
47
- switchFlag: 0
48
- }, {
49
- qe: 0x0521,
50
- nmps: 5,
51
- nlps: 29,
52
- switchFlag: 0
53
- }, {
54
- qe: 0x0221,
55
- nmps: 38,
56
- nlps: 33,
57
- switchFlag: 0
58
- }, {
59
- qe: 0x5601,
60
- nmps: 7,
61
- nlps: 6,
62
- switchFlag: 1
63
- }, {
64
- qe: 0x5401,
65
- nmps: 8,
66
- nlps: 14,
67
- switchFlag: 0
68
- }, {
69
- qe: 0x4801,
70
- nmps: 9,
71
- nlps: 14,
72
- switchFlag: 0
73
- }, {
74
- qe: 0x3801,
75
- nmps: 10,
76
- nlps: 14,
77
- switchFlag: 0
78
- }, {
79
- qe: 0x3001,
80
- nmps: 11,
81
- nlps: 17,
82
- switchFlag: 0
83
- }, {
84
- qe: 0x2401,
85
- nmps: 12,
86
- nlps: 18,
87
- switchFlag: 0
88
- }, {
89
- qe: 0x1C01,
90
- nmps: 13,
91
- nlps: 20,
92
- switchFlag: 0
93
- }, {
94
- qe: 0x1601,
95
- nmps: 29,
96
- nlps: 21,
97
- switchFlag: 0
98
- }, {
99
- qe: 0x5601,
100
- nmps: 15,
101
- nlps: 14,
102
- switchFlag: 1
103
- }, {
104
- qe: 0x5401,
105
- nmps: 16,
106
- nlps: 14,
107
- switchFlag: 0
108
- }, {
109
- qe: 0x5101,
110
- nmps: 17,
111
- nlps: 15,
112
- switchFlag: 0
113
- }, {
114
- qe: 0x4801,
115
- nmps: 18,
116
- nlps: 16,
117
- switchFlag: 0
118
- }, {
119
- qe: 0x3801,
120
- nmps: 19,
121
- nlps: 17,
122
- switchFlag: 0
123
- }, {
124
- qe: 0x3401,
125
- nmps: 20,
126
- nlps: 18,
127
- switchFlag: 0
128
- }, {
129
- qe: 0x3001,
130
- nmps: 21,
131
- nlps: 19,
132
- switchFlag: 0
133
- }, {
134
- qe: 0x2801,
135
- nmps: 22,
136
- nlps: 19,
137
- switchFlag: 0
138
- }, {
139
- qe: 0x2401,
140
- nmps: 23,
141
- nlps: 20,
142
- switchFlag: 0
143
- }, {
144
- qe: 0x2201,
145
- nmps: 24,
146
- nlps: 21,
147
- switchFlag: 0
148
- }, {
149
- qe: 0x1C01,
150
- nmps: 25,
151
- nlps: 22,
152
- switchFlag: 0
153
- }, {
154
- qe: 0x1801,
155
- nmps: 26,
156
- nlps: 23,
157
- switchFlag: 0
158
- }, {
159
- qe: 0x1601,
160
- nmps: 27,
161
- nlps: 24,
162
- switchFlag: 0
163
- }, {
164
- qe: 0x1401,
165
- nmps: 28,
166
- nlps: 25,
167
- switchFlag: 0
168
- }, {
169
- qe: 0x1201,
170
- nmps: 29,
171
- nlps: 26,
172
- switchFlag: 0
173
- }, {
174
- qe: 0x1101,
175
- nmps: 30,
176
- nlps: 27,
177
- switchFlag: 0
178
- }, {
179
- qe: 0x0AC1,
180
- nmps: 31,
181
- nlps: 28,
182
- switchFlag: 0
183
- }, {
184
- qe: 0x09C1,
185
- nmps: 32,
186
- nlps: 29,
187
- switchFlag: 0
188
- }, {
189
- qe: 0x08A1,
190
- nmps: 33,
191
- nlps: 30,
192
- switchFlag: 0
193
- }, {
194
- qe: 0x0521,
195
- nmps: 34,
196
- nlps: 31,
197
- switchFlag: 0
198
- }, {
199
- qe: 0x0441,
200
- nmps: 35,
201
- nlps: 32,
202
- switchFlag: 0
203
- }, {
204
- qe: 0x02A1,
205
- nmps: 36,
206
- nlps: 33,
207
- switchFlag: 0
208
- }, {
209
- qe: 0x0221,
210
- nmps: 37,
211
- nlps: 34,
212
- switchFlag: 0
213
- }, {
214
- qe: 0x0141,
215
- nmps: 38,
216
- nlps: 35,
217
- switchFlag: 0
218
- }, {
219
- qe: 0x0111,
220
- nmps: 39,
221
- nlps: 36,
222
- switchFlag: 0
223
- }, {
224
- qe: 0x0085,
225
- nmps: 40,
226
- nlps: 37,
227
- switchFlag: 0
228
- }, {
229
- qe: 0x0049,
230
- nmps: 41,
231
- nlps: 38,
232
- switchFlag: 0
233
- }, {
234
- qe: 0x0025,
235
- nmps: 42,
236
- nlps: 39,
237
- switchFlag: 0
238
- }, {
239
- qe: 0x0015,
240
- nmps: 43,
241
- nlps: 40,
242
- switchFlag: 0
243
- }, {
244
- qe: 0x0009,
245
- nmps: 44,
246
- nlps: 41,
247
- switchFlag: 0
248
- }, {
249
- qe: 0x0005,
250
- nmps: 45,
251
- nlps: 42,
252
- switchFlag: 0
253
- }, {
254
- qe: 0x0001,
255
- nmps: 45,
256
- nlps: 43,
257
- switchFlag: 0
258
- }, {
259
- qe: 0x5601,
260
- nmps: 46,
261
- nlps: 46,
262
- switchFlag: 0
263
- }];
27
+ exports.ArithmeticDecoder = void 0;
28
+
29
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
30
+
31
+ 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); } }
32
+
33
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
34
+
35
+ var QeTable = [{
36
+ qe: 0x5601,
37
+ nmps: 1,
38
+ nlps: 1,
39
+ switchFlag: 1
40
+ }, {
41
+ qe: 0x3401,
42
+ nmps: 2,
43
+ nlps: 6,
44
+ switchFlag: 0
45
+ }, {
46
+ qe: 0x1801,
47
+ nmps: 3,
48
+ nlps: 9,
49
+ switchFlag: 0
50
+ }, {
51
+ qe: 0x0AC1,
52
+ nmps: 4,
53
+ nlps: 12,
54
+ switchFlag: 0
55
+ }, {
56
+ qe: 0x0521,
57
+ nmps: 5,
58
+ nlps: 29,
59
+ switchFlag: 0
60
+ }, {
61
+ qe: 0x0221,
62
+ nmps: 38,
63
+ nlps: 33,
64
+ switchFlag: 0
65
+ }, {
66
+ qe: 0x5601,
67
+ nmps: 7,
68
+ nlps: 6,
69
+ switchFlag: 1
70
+ }, {
71
+ qe: 0x5401,
72
+ nmps: 8,
73
+ nlps: 14,
74
+ switchFlag: 0
75
+ }, {
76
+ qe: 0x4801,
77
+ nmps: 9,
78
+ nlps: 14,
79
+ switchFlag: 0
80
+ }, {
81
+ qe: 0x3801,
82
+ nmps: 10,
83
+ nlps: 14,
84
+ switchFlag: 0
85
+ }, {
86
+ qe: 0x3001,
87
+ nmps: 11,
88
+ nlps: 17,
89
+ switchFlag: 0
90
+ }, {
91
+ qe: 0x2401,
92
+ nmps: 12,
93
+ nlps: 18,
94
+ switchFlag: 0
95
+ }, {
96
+ qe: 0x1C01,
97
+ nmps: 13,
98
+ nlps: 20,
99
+ switchFlag: 0
100
+ }, {
101
+ qe: 0x1601,
102
+ nmps: 29,
103
+ nlps: 21,
104
+ switchFlag: 0
105
+ }, {
106
+ qe: 0x5601,
107
+ nmps: 15,
108
+ nlps: 14,
109
+ switchFlag: 1
110
+ }, {
111
+ qe: 0x5401,
112
+ nmps: 16,
113
+ nlps: 14,
114
+ switchFlag: 0
115
+ }, {
116
+ qe: 0x5101,
117
+ nmps: 17,
118
+ nlps: 15,
119
+ switchFlag: 0
120
+ }, {
121
+ qe: 0x4801,
122
+ nmps: 18,
123
+ nlps: 16,
124
+ switchFlag: 0
125
+ }, {
126
+ qe: 0x3801,
127
+ nmps: 19,
128
+ nlps: 17,
129
+ switchFlag: 0
130
+ }, {
131
+ qe: 0x3401,
132
+ nmps: 20,
133
+ nlps: 18,
134
+ switchFlag: 0
135
+ }, {
136
+ qe: 0x3001,
137
+ nmps: 21,
138
+ nlps: 19,
139
+ switchFlag: 0
140
+ }, {
141
+ qe: 0x2801,
142
+ nmps: 22,
143
+ nlps: 19,
144
+ switchFlag: 0
145
+ }, {
146
+ qe: 0x2401,
147
+ nmps: 23,
148
+ nlps: 20,
149
+ switchFlag: 0
150
+ }, {
151
+ qe: 0x2201,
152
+ nmps: 24,
153
+ nlps: 21,
154
+ switchFlag: 0
155
+ }, {
156
+ qe: 0x1C01,
157
+ nmps: 25,
158
+ nlps: 22,
159
+ switchFlag: 0
160
+ }, {
161
+ qe: 0x1801,
162
+ nmps: 26,
163
+ nlps: 23,
164
+ switchFlag: 0
165
+ }, {
166
+ qe: 0x1601,
167
+ nmps: 27,
168
+ nlps: 24,
169
+ switchFlag: 0
170
+ }, {
171
+ qe: 0x1401,
172
+ nmps: 28,
173
+ nlps: 25,
174
+ switchFlag: 0
175
+ }, {
176
+ qe: 0x1201,
177
+ nmps: 29,
178
+ nlps: 26,
179
+ switchFlag: 0
180
+ }, {
181
+ qe: 0x1101,
182
+ nmps: 30,
183
+ nlps: 27,
184
+ switchFlag: 0
185
+ }, {
186
+ qe: 0x0AC1,
187
+ nmps: 31,
188
+ nlps: 28,
189
+ switchFlag: 0
190
+ }, {
191
+ qe: 0x09C1,
192
+ nmps: 32,
193
+ nlps: 29,
194
+ switchFlag: 0
195
+ }, {
196
+ qe: 0x08A1,
197
+ nmps: 33,
198
+ nlps: 30,
199
+ switchFlag: 0
200
+ }, {
201
+ qe: 0x0521,
202
+ nmps: 34,
203
+ nlps: 31,
204
+ switchFlag: 0
205
+ }, {
206
+ qe: 0x0441,
207
+ nmps: 35,
208
+ nlps: 32,
209
+ switchFlag: 0
210
+ }, {
211
+ qe: 0x02A1,
212
+ nmps: 36,
213
+ nlps: 33,
214
+ switchFlag: 0
215
+ }, {
216
+ qe: 0x0221,
217
+ nmps: 37,
218
+ nlps: 34,
219
+ switchFlag: 0
220
+ }, {
221
+ qe: 0x0141,
222
+ nmps: 38,
223
+ nlps: 35,
224
+ switchFlag: 0
225
+ }, {
226
+ qe: 0x0111,
227
+ nmps: 39,
228
+ nlps: 36,
229
+ switchFlag: 0
230
+ }, {
231
+ qe: 0x0085,
232
+ nmps: 40,
233
+ nlps: 37,
234
+ switchFlag: 0
235
+ }, {
236
+ qe: 0x0049,
237
+ nmps: 41,
238
+ nlps: 38,
239
+ switchFlag: 0
240
+ }, {
241
+ qe: 0x0025,
242
+ nmps: 42,
243
+ nlps: 39,
244
+ switchFlag: 0
245
+ }, {
246
+ qe: 0x0015,
247
+ nmps: 43,
248
+ nlps: 40,
249
+ switchFlag: 0
250
+ }, {
251
+ qe: 0x0009,
252
+ nmps: 44,
253
+ nlps: 41,
254
+ switchFlag: 0
255
+ }, {
256
+ qe: 0x0005,
257
+ nmps: 45,
258
+ nlps: 42,
259
+ switchFlag: 0
260
+ }, {
261
+ qe: 0x0001,
262
+ nmps: 45,
263
+ nlps: 43,
264
+ switchFlag: 0
265
+ }, {
266
+ qe: 0x5601,
267
+ nmps: 46,
268
+ nlps: 46,
269
+ switchFlag: 0
270
+ }];
271
+
272
+ var ArithmeticDecoder =
273
+ /*#__PURE__*/
274
+ function () {
264
275
  function ArithmeticDecoder(data, start, end) {
276
+ _classCallCheck(this, ArithmeticDecoder);
277
+
265
278
  this.data = data;
266
279
  this.bp = start;
267
280
  this.dataEnd = end;
@@ -273,13 +286,15 @@ var ArithmeticDecoder = function ArithmeticDecoderClosure() {
273
286
  this.ct -= 7;
274
287
  this.a = 0x8000;
275
288
  }
276
- ArithmeticDecoder.prototype = {
277
- byteIn: function ArithmeticDecoder_byteIn() {
289
+
290
+ _createClass(ArithmeticDecoder, [{
291
+ key: "byteIn",
292
+ value: function byteIn() {
278
293
  var data = this.data;
279
294
  var bp = this.bp;
295
+
280
296
  if (data[bp] === 0xFF) {
281
- var b1 = data[bp + 1];
282
- if (b1 > 0x8F) {
297
+ if (data[bp + 1] > 0x8F) {
283
298
  this.clow += 0xFF00;
284
299
  this.ct = 8;
285
300
  } else {
@@ -294,18 +309,22 @@ var ArithmeticDecoder = function ArithmeticDecoderClosure() {
294
309
  this.ct = 8;
295
310
  this.bp = bp;
296
311
  }
312
+
297
313
  if (this.clow > 0xFFFF) {
298
314
  this.chigh += this.clow >> 16;
299
315
  this.clow &= 0xFFFF;
300
316
  }
301
- },
302
- readBit: function ArithmeticDecoder_readBit(contexts, pos) {
317
+ }
318
+ }, {
319
+ key: "readBit",
320
+ value: function readBit(contexts, pos) {
303
321
  var cx_index = contexts[pos] >> 1,
304
322
  cx_mps = contexts[pos] & 1;
305
323
  var qeTableIcx = QeTable[cx_index];
306
324
  var qeIcx = qeTableIcx.qe;
307
325
  var d;
308
326
  var a = this.a - qeIcx;
327
+
309
328
  if (this.chigh < qeIcx) {
310
329
  if (a < qeIcx) {
311
330
  a = qeIcx;
@@ -314,42 +333,53 @@ var ArithmeticDecoder = function ArithmeticDecoderClosure() {
314
333
  } else {
315
334
  a = qeIcx;
316
335
  d = 1 ^ cx_mps;
336
+
317
337
  if (qeTableIcx.switchFlag === 1) {
318
338
  cx_mps = d;
319
339
  }
340
+
320
341
  cx_index = qeTableIcx.nlps;
321
342
  }
322
343
  } else {
323
344
  this.chigh -= qeIcx;
345
+
324
346
  if ((a & 0x8000) !== 0) {
325
347
  this.a = a;
326
348
  return cx_mps;
327
349
  }
350
+
328
351
  if (a < qeIcx) {
329
352
  d = 1 ^ cx_mps;
353
+
330
354
  if (qeTableIcx.switchFlag === 1) {
331
355
  cx_mps = d;
332
356
  }
357
+
333
358
  cx_index = qeTableIcx.nlps;
334
359
  } else {
335
360
  d = cx_mps;
336
361
  cx_index = qeTableIcx.nmps;
337
362
  }
338
363
  }
364
+
339
365
  do {
340
366
  if (this.ct === 0) {
341
367
  this.byteIn();
342
368
  }
369
+
343
370
  a <<= 1;
344
371
  this.chigh = this.chigh << 1 & 0xFFFF | this.clow >> 15 & 1;
345
372
  this.clow = this.clow << 1 & 0xFFFF;
346
373
  this.ct--;
347
374
  } while ((a & 0x8000) === 0);
375
+
348
376
  this.a = a;
349
377
  contexts[pos] = cx_index << 1 | cx_mps;
350
378
  return d;
351
379
  }
352
- };
380
+ }]);
381
+
353
382
  return ArithmeticDecoder;
354
383
  }();
384
+
355
385
  exports.ArithmeticDecoder = ArithmeticDecoder;