1/**
2 * @licstart The following is the entire license notice for the
3 * Javascript code in this page
4 *
5 * Copyright 2019 Mozilla Foundation
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 *     http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 * @licend The above is the entire license notice for the
20 * Javascript code in this page
21 */
22
23(function webpackUniversalModuleDefinition(root, factory) {
24	if(typeof exports === 'object' && typeof module === 'object')
25		module.exports = factory();
26	else if(typeof define === 'function' && define.amd)
27		define("pdfjs-dist/build/pdf.worker", [], factory);
28	else if(typeof exports === 'object')
29		exports["pdfjs-dist/build/pdf.worker"] = factory();
30	else
31		root["pdfjs-dist/build/pdf.worker"] = root.pdfjsWorker = factory();
32})(this, function() {
33return /******/ (function(modules) { // webpackBootstrap
34/******/ 	// The module cache
35/******/ 	var installedModules = {};
36/******/
37/******/ 	// The require function
38/******/ 	function __w_pdfjs_require__(moduleId) {
39/******/
40/******/ 		// Check if module is in cache
41/******/ 		if(installedModules[moduleId]) {
42/******/ 			return installedModules[moduleId].exports;
43/******/ 		}
44/******/ 		// Create a new module (and put it into the cache)
45/******/ 		var module = installedModules[moduleId] = {
46/******/ 			i: moduleId,
47/******/ 			l: false,
48/******/ 			exports: {}
49/******/ 		};
50/******/
51/******/ 		// Execute the module function
52/******/ 		modules[moduleId].call(module.exports, module, module.exports, __w_pdfjs_require__);
53/******/
54/******/ 		// Flag the module as loaded
55/******/ 		module.l = true;
56/******/
57/******/ 		// Return the exports of the module
58/******/ 		return module.exports;
59/******/ 	}
60/******/
61/******/
62/******/ 	// expose the modules object (__webpack_modules__)
63/******/ 	__w_pdfjs_require__.m = modules;
64/******/
65/******/ 	// expose the module cache
66/******/ 	__w_pdfjs_require__.c = installedModules;
67/******/
68/******/ 	// define getter function for harmony exports
69/******/ 	__w_pdfjs_require__.d = function(exports, name, getter) {
70/******/ 		if(!__w_pdfjs_require__.o(exports, name)) {
71/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
72/******/ 		}
73/******/ 	};
74/******/
75/******/ 	// define __esModule on exports
76/******/ 	__w_pdfjs_require__.r = function(exports) {
77/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
78/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
79/******/ 		}
80/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
81/******/ 	};
82/******/
83/******/ 	// create a fake namespace object
84/******/ 	// mode & 1: value is a module id, require it
85/******/ 	// mode & 2: merge all properties of value into the ns
86/******/ 	// mode & 4: return value when already ns object
87/******/ 	// mode & 8|1: behave like require
88/******/ 	__w_pdfjs_require__.t = function(value, mode) {
89/******/ 		if(mode & 1) value = __w_pdfjs_require__(value);
90/******/ 		if(mode & 8) return value;
91/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
92/******/ 		var ns = Object.create(null);
93/******/ 		__w_pdfjs_require__.r(ns);
94/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
95/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __w_pdfjs_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
96/******/ 		return ns;
97/******/ 	};
98/******/
99/******/ 	// getDefaultExport function for compatibility with non-harmony modules
100/******/ 	__w_pdfjs_require__.n = function(module) {
101/******/ 		var getter = module && module.__esModule ?
102/******/ 			function getDefault() { return module['default']; } :
103/******/ 			function getModuleExports() { return module; };
104/******/ 		__w_pdfjs_require__.d(getter, 'a', getter);
105/******/ 		return getter;
106/******/ 	};
107/******/
108/******/ 	// Object.prototype.hasOwnProperty.call
109/******/ 	__w_pdfjs_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
110/******/
111/******/ 	// __webpack_public_path__
112/******/ 	__w_pdfjs_require__.p = "";
113/******/
114/******/
115/******/ 	// Load entry module and return exports
116/******/ 	return __w_pdfjs_require__(__w_pdfjs_require__.s = 0);
117/******/ })
118/************************************************************************/
119/******/ ([
120/* 0 */
121/***/ (function(module, exports, __w_pdfjs_require__) {
122
123"use strict";
124
125
126var pdfjsVersion = '2.2.228';
127var pdfjsBuild = 'd7afb74a';
128
129var pdfjsCoreWorker = __w_pdfjs_require__(1);
130
131exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
132
133/***/ }),
134/* 1 */
135/***/ (function(module, exports, __w_pdfjs_require__) {
136
137"use strict";
138
139
140Object.defineProperty(exports, "__esModule", {
141  value: true
142});
143exports.WorkerMessageHandler = exports.WorkerTask = void 0;
144
145var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2));
146
147var _util = __w_pdfjs_require__(5);
148
149var _primitives = __w_pdfjs_require__(151);
150
151var _pdf_manager = __w_pdfjs_require__(152);
152
153var _is_node = _interopRequireDefault(__w_pdfjs_require__(8));
154
155var _message_handler = __w_pdfjs_require__(191);
156
157var _worker_stream = __w_pdfjs_require__(192);
158
159var _core_utils = __w_pdfjs_require__(154);
160
161function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
162
163function _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); }
164
165function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
166
167function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
168
169function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
170
171function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
172
173function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
174
175function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
176
177var WorkerTask = function WorkerTaskClosure() {
178  function WorkerTask(name) {
179    this.name = name;
180    this.terminated = false;
181    this._capability = (0, _util.createPromiseCapability)();
182  }
183
184  WorkerTask.prototype = {
185    get finished() {
186      return this._capability.promise;
187    },
188
189    finish: function finish() {
190      this._capability.resolve();
191    },
192    terminate: function terminate() {
193      this.terminated = true;
194    },
195    ensureNotTerminated: function ensureNotTerminated() {
196      if (this.terminated) {
197        throw new Error('Worker task was terminated');
198      }
199    }
200  };
201  return WorkerTask;
202}();
203
204exports.WorkerTask = WorkerTask;
205var WorkerMessageHandler = {
206  setup: function setup(handler, port) {
207    var testMessageProcessed = false;
208    handler.on('test', function wphSetupTest(data) {
209      if (testMessageProcessed) {
210        return;
211      }
212
213      testMessageProcessed = true;
214
215      if (!(data instanceof Uint8Array)) {
216        handler.send('test', false);
217        return;
218      }
219
220      var supportTransfers = data[0] === 255;
221      handler.postMessageTransfers = supportTransfers;
222      var xhr = new XMLHttpRequest();
223      var responseExists = 'response' in xhr;
224
225      try {
226        xhr.responseType;
227      } catch (e) {
228        responseExists = false;
229      }
230
231      if (!responseExists) {
232        handler.send('test', false);
233        return;
234      }
235
236      handler.send('test', {
237        supportTypedArray: true,
238        supportTransfers: supportTransfers
239      });
240    });
241    handler.on('configure', function wphConfigure(data) {
242      (0, _util.setVerbosityLevel)(data.verbosity);
243    });
244    handler.on('GetDocRequest', function wphSetupDoc(data) {
245      return WorkerMessageHandler.createDocumentHandler(data, port);
246    });
247  },
248  createDocumentHandler: function createDocumentHandler(docParams, port) {
249    var pdfManager;
250    var terminated = false;
251    var cancelXHRs = null;
252    var WorkerTasks = [];
253    var verbosity = (0, _util.getVerbosityLevel)();
254    var apiVersion = docParams.apiVersion;
255    var workerVersion = '2.2.228';
256
257    if (apiVersion !== workerVersion) {
258      throw new Error("The API version \"".concat(apiVersion, "\" does not match ") + "the Worker version \"".concat(workerVersion, "\"."));
259    }
260
261    var docId = docParams.docId;
262    var docBaseUrl = docParams.docBaseUrl;
263    var workerHandlerName = docParams.docId + '_worker';
264    var handler = new _message_handler.MessageHandler(workerHandlerName, docId, port);
265    handler.postMessageTransfers = docParams.postMessageTransfers;
266
267    function ensureNotTerminated() {
268      if (terminated) {
269        throw new Error('Worker was terminated');
270      }
271    }
272
273    function startWorkerTask(task) {
274      WorkerTasks.push(task);
275    }
276
277    function finishWorkerTask(task) {
278      task.finish();
279      var i = WorkerTasks.indexOf(task);
280      WorkerTasks.splice(i, 1);
281    }
282
283    function loadDocument(_x) {
284      return _loadDocument.apply(this, arguments);
285    }
286
287    function _loadDocument() {
288      _loadDocument = _asyncToGenerator(
289      /*#__PURE__*/
290      _regenerator["default"].mark(function _callee(recoveryMode) {
291        var _ref4, _ref5, numPages, fingerprint;
292
293        return _regenerator["default"].wrap(function _callee$(_context) {
294          while (1) {
295            switch (_context.prev = _context.next) {
296              case 0:
297                _context.next = 2;
298                return pdfManager.ensureDoc('checkHeader');
299
300              case 2:
301                _context.next = 4;
302                return pdfManager.ensureDoc('parseStartXRef');
303
304              case 4:
305                _context.next = 6;
306                return pdfManager.ensureDoc('parse', [recoveryMode]);
307
308              case 6:
309                if (recoveryMode) {
310                  _context.next = 9;
311                  break;
312                }
313
314                _context.next = 9;
315                return pdfManager.ensureDoc('checkFirstPage');
316
317              case 9:
318                _context.next = 11;
319                return Promise.all([pdfManager.ensureDoc('numPages'), pdfManager.ensureDoc('fingerprint')]);
320
321              case 11:
322                _ref4 = _context.sent;
323                _ref5 = _slicedToArray(_ref4, 2);
324                numPages = _ref5[0];
325                fingerprint = _ref5[1];
326                return _context.abrupt("return", {
327                  numPages: numPages,
328                  fingerprint: fingerprint
329                });
330
331              case 16:
332              case "end":
333                return _context.stop();
334            }
335          }
336        }, _callee);
337      }));
338      return _loadDocument.apply(this, arguments);
339    }
340
341    function getPdfManager(data, evaluatorOptions) {
342      var pdfManagerCapability = (0, _util.createPromiseCapability)();
343      var pdfManager;
344      var source = data.source;
345
346      if (source.data) {
347        try {
348          pdfManager = new _pdf_manager.LocalPdfManager(docId, source.data, source.password, evaluatorOptions, docBaseUrl);
349          pdfManagerCapability.resolve(pdfManager);
350        } catch (ex) {
351          pdfManagerCapability.reject(ex);
352        }
353
354        return pdfManagerCapability.promise;
355      }
356
357      var pdfStream,
358          cachedChunks = [];
359
360      try {
361        pdfStream = new _worker_stream.PDFWorkerStream(handler);
362      } catch (ex) {
363        pdfManagerCapability.reject(ex);
364        return pdfManagerCapability.promise;
365      }
366
367      var fullRequest = pdfStream.getFullReader();
368      fullRequest.headersReady.then(function () {
369        if (!fullRequest.isRangeSupported) {
370          return;
371        }
372
373        var disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported;
374        pdfManager = new _pdf_manager.NetworkPdfManager(docId, pdfStream, {
375          msgHandler: handler,
376          password: source.password,
377          length: fullRequest.contentLength,
378          disableAutoFetch: disableAutoFetch,
379          rangeChunkSize: source.rangeChunkSize
380        }, evaluatorOptions, docBaseUrl);
381
382        for (var i = 0; i < cachedChunks.length; i++) {
383          pdfManager.sendProgressiveData(cachedChunks[i]);
384        }
385
386        cachedChunks = [];
387        pdfManagerCapability.resolve(pdfManager);
388        cancelXHRs = null;
389      })["catch"](function (reason) {
390        pdfManagerCapability.reject(reason);
391        cancelXHRs = null;
392      });
393      var loaded = 0;
394
395      var flushChunks = function flushChunks() {
396        var pdfFile = (0, _util.arraysToBytes)(cachedChunks);
397
398        if (source.length && pdfFile.length !== source.length) {
399          (0, _util.warn)('reported HTTP length is different from actual');
400        }
401
402        try {
403          pdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, source.password, evaluatorOptions, docBaseUrl);
404          pdfManagerCapability.resolve(pdfManager);
405        } catch (ex) {
406          pdfManagerCapability.reject(ex);
407        }
408
409        cachedChunks = [];
410      };
411
412      var readPromise = new Promise(function (resolve, reject) {
413        var readChunk = function readChunk(chunk) {
414          try {
415            ensureNotTerminated();
416
417            if (chunk.done) {
418              if (!pdfManager) {
419                flushChunks();
420              }
421
422              cancelXHRs = null;
423              return;
424            }
425
426            var data = chunk.value;
427            loaded += (0, _util.arrayByteLength)(data);
428
429            if (!fullRequest.isStreamingSupported) {
430              handler.send('DocProgress', {
431                loaded: loaded,
432                total: Math.max(loaded, fullRequest.contentLength || 0)
433              });
434            }
435
436            if (pdfManager) {
437              pdfManager.sendProgressiveData(data);
438            } else {
439              cachedChunks.push(data);
440            }
441
442            fullRequest.read().then(readChunk, reject);
443          } catch (e) {
444            reject(e);
445          }
446        };
447
448        fullRequest.read().then(readChunk, reject);
449      });
450      readPromise["catch"](function (e) {
451        pdfManagerCapability.reject(e);
452        cancelXHRs = null;
453      });
454
455      cancelXHRs = function cancelXHRs() {
456        pdfStream.cancelAllRequests('abort');
457      };
458
459      return pdfManagerCapability.promise;
460    }
461
462    function setupDoc(data) {
463      function onSuccess(doc) {
464        ensureNotTerminated();
465        handler.send('GetDoc', {
466          pdfInfo: doc
467        });
468      }
469
470      function onFailure(e) {
471        ensureNotTerminated();
472
473        if (e instanceof _util.PasswordException) {
474          var task = new WorkerTask('PasswordException: response ' + e.code);
475          startWorkerTask(task);
476          handler.sendWithPromise('PasswordRequest', e).then(function (data) {
477            finishWorkerTask(task);
478            pdfManager.updatePassword(data.password);
479            pdfManagerReady();
480          })["catch"](function (boundException) {
481            finishWorkerTask(task);
482            handler.send('PasswordException', boundException);
483          }.bind(null, e));
484        } else if (e instanceof _util.InvalidPDFException) {
485          handler.send('InvalidPDF', e);
486        } else if (e instanceof _util.MissingPDFException) {
487          handler.send('MissingPDF', e);
488        } else if (e instanceof _util.UnexpectedResponseException) {
489          handler.send('UnexpectedResponse', e);
490        } else {
491          handler.send('UnknownError', new _util.UnknownErrorException(e.message, e.toString()));
492        }
493      }
494
495      function pdfManagerReady() {
496        ensureNotTerminated();
497        loadDocument(false).then(onSuccess, function loadFailure(ex) {
498          ensureNotTerminated();
499
500          if (!(ex instanceof _core_utils.XRefParseException)) {
501            onFailure(ex);
502            return;
503          }
504
505          pdfManager.requestLoadedStream();
506          pdfManager.onLoadedStream().then(function () {
507            ensureNotTerminated();
508            loadDocument(true).then(onSuccess, onFailure);
509          });
510        }, onFailure);
511      }
512
513      ensureNotTerminated();
514      var evaluatorOptions = {
515        forceDataSchema: data.disableCreateObjectURL,
516        maxImageSize: data.maxImageSize,
517        disableFontFace: data.disableFontFace,
518        nativeImageDecoderSupport: data.nativeImageDecoderSupport,
519        ignoreErrors: data.ignoreErrors,
520        isEvalSupported: data.isEvalSupported
521      };
522      getPdfManager(data, evaluatorOptions).then(function (newPdfManager) {
523        if (terminated) {
524          newPdfManager.terminate();
525          throw new Error('Worker was terminated');
526        }
527
528        pdfManager = newPdfManager;
529        pdfManager.onLoadedStream().then(function (stream) {
530          handler.send('DataLoaded', {
531            length: stream.bytes.byteLength
532          });
533        });
534      }).then(pdfManagerReady, onFailure);
535    }
536
537    handler.on('GetPage', function wphSetupGetPage(data) {
538      return pdfManager.getPage(data.pageIndex).then(function (page) {
539        return Promise.all([pdfManager.ensure(page, 'rotate'), pdfManager.ensure(page, 'ref'), pdfManager.ensure(page, 'userUnit'), pdfManager.ensure(page, 'view')]).then(function (_ref) {
540          var _ref2 = _slicedToArray(_ref, 4),
541              rotate = _ref2[0],
542              ref = _ref2[1],
543              userUnit = _ref2[2],
544              view = _ref2[3];
545
546          return {
547            rotate: rotate,
548            ref: ref,
549            userUnit: userUnit,
550            view: view
551          };
552        });
553      });
554    });
555    handler.on('GetPageIndex', function wphSetupGetPageIndex(data) {
556      var ref = _primitives.Ref.get(data.ref.num, data.ref.gen);
557
558      var catalog = pdfManager.pdfDocument.catalog;
559      return catalog.getPageIndex(ref);
560    });
561    handler.on('GetDestinations', function wphSetupGetDestinations(data) {
562      return pdfManager.ensureCatalog('destinations');
563    });
564    handler.on('GetDestination', function wphSetupGetDestination(data) {
565      return pdfManager.ensureCatalog('getDestination', [data.id]);
566    });
567    handler.on('GetPageLabels', function wphSetupGetPageLabels(data) {
568      return pdfManager.ensureCatalog('pageLabels');
569    });
570    handler.on('GetPageLayout', function wphSetupGetPageLayout(data) {
571      return pdfManager.ensureCatalog('pageLayout');
572    });
573    handler.on('GetPageMode', function wphSetupGetPageMode(data) {
574      return pdfManager.ensureCatalog('pageMode');
575    });
576    handler.on('GetViewerPreferences', function (data) {
577      return pdfManager.ensureCatalog('viewerPreferences');
578    });
579    handler.on('GetOpenActionDestination', function (data) {
580      return pdfManager.ensureCatalog('openActionDestination');
581    });
582    handler.on('GetAttachments', function wphSetupGetAttachments(data) {
583      return pdfManager.ensureCatalog('attachments');
584    });
585    handler.on('GetJavaScript', function wphSetupGetJavaScript(data) {
586      return pdfManager.ensureCatalog('javaScript');
587    });
588    handler.on('GetOutline', function wphSetupGetOutline(data) {
589      return pdfManager.ensureCatalog('documentOutline');
590    });
591    handler.on('GetPermissions', function (data) {
592      return pdfManager.ensureCatalog('permissions');
593    });
594    handler.on('GetMetadata', function wphSetupGetMetadata(data) {
595      return Promise.all([pdfManager.ensureDoc('documentInfo'), pdfManager.ensureCatalog('metadata')]);
596    });
597    handler.on('GetData', function wphSetupGetData(data) {
598      pdfManager.requestLoadedStream();
599      return pdfManager.onLoadedStream().then(function (stream) {
600        return stream.bytes;
601      });
602    });
603    handler.on('GetStats', function wphSetupGetStats(data) {
604      return pdfManager.pdfDocument.xref.stats;
605    });
606    handler.on('GetAnnotations', function (_ref3) {
607      var pageIndex = _ref3.pageIndex,
608          intent = _ref3.intent;
609      return pdfManager.getPage(pageIndex).then(function (page) {
610        return page.getAnnotationsData(intent);
611      });
612    });
613    handler.on('RenderPageRequest', function wphSetupRenderPage(data) {
614      var pageIndex = data.pageIndex;
615      pdfManager.getPage(pageIndex).then(function (page) {
616        var task = new WorkerTask('RenderPageRequest: page ' + pageIndex);
617        startWorkerTask(task);
618        var start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
619        page.getOperatorList({
620          handler: handler,
621          task: task,
622          intent: data.intent,
623          renderInteractiveForms: data.renderInteractiveForms
624        }).then(function (operatorList) {
625          finishWorkerTask(task);
626
627          if (start) {
628            (0, _util.info)("page=".concat(pageIndex + 1, " - getOperatorList: time=") + "".concat(Date.now() - start, "ms, len=").concat(operatorList.totalLength));
629          }
630        }, function (e) {
631          finishWorkerTask(task);
632
633          if (task.terminated) {
634            return;
635          }
636
637          handler.send('UnsupportedFeature', {
638            featureId: _util.UNSUPPORTED_FEATURES.unknown
639          });
640          var minimumStackMessage = 'worker.js: while trying to getPage() and getOperatorList()';
641          var wrappedException;
642
643          if (typeof e === 'string') {
644            wrappedException = {
645              message: e,
646              stack: minimumStackMessage
647            };
648          } else if (_typeof(e) === 'object') {
649            wrappedException = {
650              message: e.message || e.toString(),
651              stack: e.stack || minimumStackMessage
652            };
653          } else {
654            wrappedException = {
655              message: 'Unknown exception type: ' + _typeof(e),
656              stack: minimumStackMessage
657            };
658          }
659
660          handler.send('PageError', {
661            pageIndex: pageIndex,
662            error: wrappedException,
663            intent: data.intent
664          });
665        });
666      });
667    }, this);
668    handler.on('GetTextContent', function wphExtractText(data, sink) {
669      var pageIndex = data.pageIndex;
670
671      sink.onPull = function (desiredSize) {};
672
673      sink.onCancel = function (reason) {};
674
675      pdfManager.getPage(pageIndex).then(function (page) {
676        var task = new WorkerTask('GetTextContent: page ' + pageIndex);
677        startWorkerTask(task);
678        var start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
679        page.extractTextContent({
680          handler: handler,
681          task: task,
682          sink: sink,
683          normalizeWhitespace: data.normalizeWhitespace,
684          combineTextItems: data.combineTextItems
685        }).then(function () {
686          finishWorkerTask(task);
687
688          if (start) {
689            (0, _util.info)("page=".concat(pageIndex + 1, " - getTextContent: time=") + "".concat(Date.now() - start, "ms"));
690          }
691
692          sink.close();
693        }, function (reason) {
694          finishWorkerTask(task);
695
696          if (task.terminated) {
697            return;
698          }
699
700          sink.error(reason);
701          throw reason;
702        });
703      });
704    });
705    handler.on('FontFallback', function (data) {
706      return pdfManager.fontFallback(data.id, handler);
707    });
708    handler.on('Cleanup', function wphCleanup(data) {
709      return pdfManager.cleanup();
710    });
711    handler.on('Terminate', function wphTerminate(data) {
712      terminated = true;
713
714      if (pdfManager) {
715        pdfManager.terminate();
716        pdfManager = null;
717      }
718
719      if (cancelXHRs) {
720        cancelXHRs();
721      }
722
723      (0, _primitives.clearPrimitiveCaches)();
724      var waitOn = [];
725      WorkerTasks.forEach(function (task) {
726        waitOn.push(task.finished);
727        task.terminate();
728      });
729      return Promise.all(waitOn).then(function () {
730        handler.destroy();
731        handler = null;
732      });
733    });
734    handler.on('Ready', function wphReady(data) {
735      setupDoc(docParams);
736      docParams = null;
737    });
738    return workerHandlerName;
739  },
740  initializeFromPort: function initializeFromPort(port) {
741    var handler = new _message_handler.MessageHandler('worker', 'main', port);
742    WorkerMessageHandler.setup(handler, port);
743    handler.send('ready', null);
744  }
745};
746exports.WorkerMessageHandler = WorkerMessageHandler;
747
748function isMessagePort(maybePort) {
749  return typeof maybePort.postMessage === 'function' && 'onmessage' in maybePort;
750}
751
752if (typeof window === 'undefined' && !(0, _is_node["default"])() && typeof self !== 'undefined' && isMessagePort(self)) {
753  WorkerMessageHandler.initializeFromPort(self);
754}
755
756/***/ }),
757/* 2 */
758/***/ (function(module, exports, __w_pdfjs_require__) {
759
760"use strict";
761
762
763module.exports = __w_pdfjs_require__(3);
764
765/***/ }),
766/* 3 */
767/***/ (function(module, exports, __w_pdfjs_require__) {
768
769"use strict";
770/* WEBPACK VAR INJECTION */(function(module) {
771
772function _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); }
773
774var runtime = function (exports) {
775  "use strict";
776
777  var Op = Object.prototype;
778  var hasOwn = Op.hasOwnProperty;
779  var undefined;
780  var $Symbol = typeof Symbol === "function" ? Symbol : {};
781  var iteratorSymbol = $Symbol.iterator || "@@iterator";
782  var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
783  var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
784
785  function wrap(innerFn, outerFn, self, tryLocsList) {
786    var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
787    var generator = Object.create(protoGenerator.prototype);
788    var context = new Context(tryLocsList || []);
789    generator._invoke = makeInvokeMethod(innerFn, self, context);
790    return generator;
791  }
792
793  exports.wrap = wrap;
794
795  function tryCatch(fn, obj, arg) {
796    try {
797      return {
798        type: "normal",
799        arg: fn.call(obj, arg)
800      };
801    } catch (err) {
802      return {
803        type: "throw",
804        arg: err
805      };
806    }
807  }
808
809  var GenStateSuspendedStart = "suspendedStart";
810  var GenStateSuspendedYield = "suspendedYield";
811  var GenStateExecuting = "executing";
812  var GenStateCompleted = "completed";
813  var ContinueSentinel = {};
814
815  function Generator() {}
816
817  function GeneratorFunction() {}
818
819  function GeneratorFunctionPrototype() {}
820
821  var IteratorPrototype = {};
822
823  IteratorPrototype[iteratorSymbol] = function () {
824    return this;
825  };
826
827  var getProto = Object.getPrototypeOf;
828  var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
829
830  if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
831    IteratorPrototype = NativeIteratorPrototype;
832  }
833
834  var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
835  GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
836  GeneratorFunctionPrototype.constructor = GeneratorFunction;
837  GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction";
838
839  function defineIteratorMethods(prototype) {
840    ["next", "throw", "return"].forEach(function (method) {
841      prototype[method] = function (arg) {
842        return this._invoke(method, arg);
843      };
844    });
845  }
846
847  exports.isGeneratorFunction = function (genFun) {
848    var ctor = typeof genFun === "function" && genFun.constructor;
849    return ctor ? ctor === GeneratorFunction || (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
850  };
851
852  exports.mark = function (genFun) {
853    if (Object.setPrototypeOf) {
854      Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
855    } else {
856      genFun.__proto__ = GeneratorFunctionPrototype;
857
858      if (!(toStringTagSymbol in genFun)) {
859        genFun[toStringTagSymbol] = "GeneratorFunction";
860      }
861    }
862
863    genFun.prototype = Object.create(Gp);
864    return genFun;
865  };
866
867  exports.awrap = function (arg) {
868    return {
869      __await: arg
870    };
871  };
872
873  function AsyncIterator(generator) {
874    function invoke(method, arg, resolve, reject) {
875      var record = tryCatch(generator[method], generator, arg);
876
877      if (record.type === "throw") {
878        reject(record.arg);
879      } else {
880        var result = record.arg;
881        var value = result.value;
882
883        if (value && _typeof(value) === "object" && hasOwn.call(value, "__await")) {
884          return Promise.resolve(value.__await).then(function (value) {
885            invoke("next", value, resolve, reject);
886          }, function (err) {
887            invoke("throw", err, resolve, reject);
888          });
889        }
890
891        return Promise.resolve(value).then(function (unwrapped) {
892          result.value = unwrapped;
893          resolve(result);
894        }, function (error) {
895          return invoke("throw", error, resolve, reject);
896        });
897      }
898    }
899
900    var previousPromise;
901
902    function enqueue(method, arg) {
903      function callInvokeWithMethodAndArg() {
904        return new Promise(function (resolve, reject) {
905          invoke(method, arg, resolve, reject);
906        });
907      }
908
909      return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
910    }
911
912    this._invoke = enqueue;
913  }
914
915  defineIteratorMethods(AsyncIterator.prototype);
916
917  AsyncIterator.prototype[asyncIteratorSymbol] = function () {
918    return this;
919  };
920
921  exports.AsyncIterator = AsyncIterator;
922
923  exports.async = function (innerFn, outerFn, self, tryLocsList) {
924    var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList));
925    return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
926      return result.done ? result.value : iter.next();
927    });
928  };
929
930  function makeInvokeMethod(innerFn, self, context) {
931    var state = GenStateSuspendedStart;
932    return function invoke(method, arg) {
933      if (state === GenStateExecuting) {
934        throw new Error("Generator is already running");
935      }
936
937      if (state === GenStateCompleted) {
938        if (method === "throw") {
939          throw arg;
940        }
941
942        return doneResult();
943      }
944
945      context.method = method;
946      context.arg = arg;
947
948      while (true) {
949        var delegate = context.delegate;
950
951        if (delegate) {
952          var delegateResult = maybeInvokeDelegate(delegate, context);
953
954          if (delegateResult) {
955            if (delegateResult === ContinueSentinel) continue;
956            return delegateResult;
957          }
958        }
959
960        if (context.method === "next") {
961          context.sent = context._sent = context.arg;
962        } else if (context.method === "throw") {
963          if (state === GenStateSuspendedStart) {
964            state = GenStateCompleted;
965            throw context.arg;
966          }
967
968          context.dispatchException(context.arg);
969        } else if (context.method === "return") {
970          context.abrupt("return", context.arg);
971        }
972
973        state = GenStateExecuting;
974        var record = tryCatch(innerFn, self, context);
975
976        if (record.type === "normal") {
977          state = context.done ? GenStateCompleted : GenStateSuspendedYield;
978
979          if (record.arg === ContinueSentinel) {
980            continue;
981          }
982
983          return {
984            value: record.arg,
985            done: context.done
986          };
987        } else if (record.type === "throw") {
988          state = GenStateCompleted;
989          context.method = "throw";
990          context.arg = record.arg;
991        }
992      }
993    };
994  }
995
996  function maybeInvokeDelegate(delegate, context) {
997    var method = delegate.iterator[context.method];
998
999    if (method === undefined) {
1000      context.delegate = null;
1001
1002      if (context.method === "throw") {
1003        if (delegate.iterator["return"]) {
1004          context.method = "return";
1005          context.arg = undefined;
1006          maybeInvokeDelegate(delegate, context);
1007
1008          if (context.method === "throw") {
1009            return ContinueSentinel;
1010          }
1011        }
1012
1013        context.method = "throw";
1014        context.arg = new TypeError("The iterator does not provide a 'throw' method");
1015      }
1016
1017      return ContinueSentinel;
1018    }
1019
1020    var record = tryCatch(method, delegate.iterator, context.arg);
1021
1022    if (record.type === "throw") {
1023      context.method = "throw";
1024      context.arg = record.arg;
1025      context.delegate = null;
1026      return ContinueSentinel;
1027    }
1028
1029    var info = record.arg;
1030
1031    if (!info) {
1032      context.method = "throw";
1033      context.arg = new TypeError("iterator result is not an object");
1034      context.delegate = null;
1035      return ContinueSentinel;
1036    }
1037
1038    if (info.done) {
1039      context[delegate.resultName] = info.value;
1040      context.next = delegate.nextLoc;
1041
1042      if (context.method !== "return") {
1043        context.method = "next";
1044        context.arg = undefined;
1045      }
1046    } else {
1047      return info;
1048    }
1049
1050    context.delegate = null;
1051    return ContinueSentinel;
1052  }
1053
1054  defineIteratorMethods(Gp);
1055  Gp[toStringTagSymbol] = "Generator";
1056
1057  Gp[iteratorSymbol] = function () {
1058    return this;
1059  };
1060
1061  Gp.toString = function () {
1062    return "[object Generator]";
1063  };
1064
1065  function pushTryEntry(locs) {
1066    var entry = {
1067      tryLoc: locs[0]
1068    };
1069
1070    if (1 in locs) {
1071      entry.catchLoc = locs[1];
1072    }
1073
1074    if (2 in locs) {
1075      entry.finallyLoc = locs[2];
1076      entry.afterLoc = locs[3];
1077    }
1078
1079    this.tryEntries.push(entry);
1080  }
1081
1082  function resetTryEntry(entry) {
1083    var record = entry.completion || {};
1084    record.type = "normal";
1085    delete record.arg;
1086    entry.completion = record;
1087  }
1088
1089  function Context(tryLocsList) {
1090    this.tryEntries = [{
1091      tryLoc: "root"
1092    }];
1093    tryLocsList.forEach(pushTryEntry, this);
1094    this.reset(true);
1095  }
1096
1097  exports.keys = function (object) {
1098    var keys = [];
1099
1100    for (var key in object) {
1101      keys.push(key);
1102    }
1103
1104    keys.reverse();
1105    return function next() {
1106      while (keys.length) {
1107        var key = keys.pop();
1108
1109        if (key in object) {
1110          next.value = key;
1111          next.done = false;
1112          return next;
1113        }
1114      }
1115
1116      next.done = true;
1117      return next;
1118    };
1119  };
1120
1121  function values(iterable) {
1122    if (iterable) {
1123      var iteratorMethod = iterable[iteratorSymbol];
1124
1125      if (iteratorMethod) {
1126        return iteratorMethod.call(iterable);
1127      }
1128
1129      if (typeof iterable.next === "function") {
1130        return iterable;
1131      }
1132
1133      if (!isNaN(iterable.length)) {
1134        var i = -1,
1135            next = function next() {
1136          while (++i < iterable.length) {
1137            if (hasOwn.call(iterable, i)) {
1138              next.value = iterable[i];
1139              next.done = false;
1140              return next;
1141            }
1142          }
1143
1144          next.value = undefined;
1145          next.done = true;
1146          return next;
1147        };
1148
1149        return next.next = next;
1150      }
1151    }
1152
1153    return {
1154      next: doneResult
1155    };
1156  }
1157
1158  exports.values = values;
1159
1160  function doneResult() {
1161    return {
1162      value: undefined,
1163      done: true
1164    };
1165  }
1166
1167  Context.prototype = {
1168    constructor: Context,
1169    reset: function reset(skipTempReset) {
1170      this.prev = 0;
1171      this.next = 0;
1172      this.sent = this._sent = undefined;
1173      this.done = false;
1174      this.delegate = null;
1175      this.method = "next";
1176      this.arg = undefined;
1177      this.tryEntries.forEach(resetTryEntry);
1178
1179      if (!skipTempReset) {
1180        for (var name in this) {
1181          if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
1182            this[name] = undefined;
1183          }
1184        }
1185      }
1186    },
1187    stop: function stop() {
1188      this.done = true;
1189      var rootEntry = this.tryEntries[0];
1190      var rootRecord = rootEntry.completion;
1191
1192      if (rootRecord.type === "throw") {
1193        throw rootRecord.arg;
1194      }
1195
1196      return this.rval;
1197    },
1198    dispatchException: function dispatchException(exception) {
1199      if (this.done) {
1200        throw exception;
1201      }
1202
1203      var context = this;
1204
1205      function handle(loc, caught) {
1206        record.type = "throw";
1207        record.arg = exception;
1208        context.next = loc;
1209
1210        if (caught) {
1211          context.method = "next";
1212          context.arg = undefined;
1213        }
1214
1215        return !!caught;
1216      }
1217
1218      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1219        var entry = this.tryEntries[i];
1220        var record = entry.completion;
1221
1222        if (entry.tryLoc === "root") {
1223          return handle("end");
1224        }
1225
1226        if (entry.tryLoc <= this.prev) {
1227          var hasCatch = hasOwn.call(entry, "catchLoc");
1228          var hasFinally = hasOwn.call(entry, "finallyLoc");
1229
1230          if (hasCatch && hasFinally) {
1231            if (this.prev < entry.catchLoc) {
1232              return handle(entry.catchLoc, true);
1233            } else if (this.prev < entry.finallyLoc) {
1234              return handle(entry.finallyLoc);
1235            }
1236          } else if (hasCatch) {
1237            if (this.prev < entry.catchLoc) {
1238              return handle(entry.catchLoc, true);
1239            }
1240          } else if (hasFinally) {
1241            if (this.prev < entry.finallyLoc) {
1242              return handle(entry.finallyLoc);
1243            }
1244          } else {
1245            throw new Error("try statement without catch or finally");
1246          }
1247        }
1248      }
1249    },
1250    abrupt: function abrupt(type, arg) {
1251      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1252        var entry = this.tryEntries[i];
1253
1254        if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
1255          var finallyEntry = entry;
1256          break;
1257        }
1258      }
1259
1260      if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
1261        finallyEntry = null;
1262      }
1263
1264      var record = finallyEntry ? finallyEntry.completion : {};
1265      record.type = type;
1266      record.arg = arg;
1267
1268      if (finallyEntry) {
1269        this.method = "next";
1270        this.next = finallyEntry.finallyLoc;
1271        return ContinueSentinel;
1272      }
1273
1274      return this.complete(record);
1275    },
1276    complete: function complete(record, afterLoc) {
1277      if (record.type === "throw") {
1278        throw record.arg;
1279      }
1280
1281      if (record.type === "break" || record.type === "continue") {
1282        this.next = record.arg;
1283      } else if (record.type === "return") {
1284        this.rval = this.arg = record.arg;
1285        this.method = "return";
1286        this.next = "end";
1287      } else if (record.type === "normal" && afterLoc) {
1288        this.next = afterLoc;
1289      }
1290
1291      return ContinueSentinel;
1292    },
1293    finish: function finish(finallyLoc) {
1294      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1295        var entry = this.tryEntries[i];
1296
1297        if (entry.finallyLoc === finallyLoc) {
1298          this.complete(entry.completion, entry.afterLoc);
1299          resetTryEntry(entry);
1300          return ContinueSentinel;
1301        }
1302      }
1303    },
1304    "catch": function _catch(tryLoc) {
1305      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
1306        var entry = this.tryEntries[i];
1307
1308        if (entry.tryLoc === tryLoc) {
1309          var record = entry.completion;
1310
1311          if (record.type === "throw") {
1312            var thrown = record.arg;
1313            resetTryEntry(entry);
1314          }
1315
1316          return thrown;
1317        }
1318      }
1319
1320      throw new Error("illegal catch attempt");
1321    },
1322    delegateYield: function delegateYield(iterable, resultName, nextLoc) {
1323      this.delegate = {
1324        iterator: values(iterable),
1325        resultName: resultName,
1326        nextLoc: nextLoc
1327      };
1328
1329      if (this.method === "next") {
1330        this.arg = undefined;
1331      }
1332
1333      return ContinueSentinel;
1334    }
1335  };
1336  return exports;
1337}(( false ? undefined : _typeof(module)) === "object" ? module.exports : {});
1338
1339try {
1340  regeneratorRuntime = runtime;
1341} catch (accidentalStrictMode) {
1342  Function("r", "regeneratorRuntime = r")(runtime);
1343}
1344/* WEBPACK VAR INJECTION */}.call(this, __w_pdfjs_require__(4)(module)))
1345
1346/***/ }),
1347/* 4 */
1348/***/ (function(module, exports, __w_pdfjs_require__) {
1349
1350"use strict";
1351
1352
1353module.exports = function (module) {
1354  if (!module.webpackPolyfill) {
1355    module.deprecate = function () {};
1356
1357    module.paths = [];
1358    if (!module.children) module.children = [];
1359    Object.defineProperty(module, "loaded", {
1360      enumerable: true,
1361      get: function get() {
1362        return module.l;
1363      }
1364    });
1365    Object.defineProperty(module, "id", {
1366      enumerable: true,
1367      get: function get() {
1368        return module.i;
1369      }
1370    });
1371    module.webpackPolyfill = 1;
1372  }
1373
1374  return module;
1375};
1376
1377/***/ }),
1378/* 5 */
1379/***/ (function(module, exports, __w_pdfjs_require__) {
1380
1381"use strict";
1382
1383
1384Object.defineProperty(exports, "__esModule", {
1385  value: true
1386});
1387exports.arrayByteLength = arrayByteLength;
1388exports.arraysToBytes = arraysToBytes;
1389exports.assert = assert;
1390exports.bytesToString = bytesToString;
1391exports.createPromiseCapability = createPromiseCapability;
1392exports.getVerbosityLevel = getVerbosityLevel;
1393exports.info = info;
1394exports.isArrayBuffer = isArrayBuffer;
1395exports.isArrayEqual = isArrayEqual;
1396exports.isBool = isBool;
1397exports.isEmptyObj = isEmptyObj;
1398exports.isNum = isNum;
1399exports.isString = isString;
1400exports.isSpace = isSpace;
1401exports.isSameOrigin = isSameOrigin;
1402exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
1403exports.isLittleEndian = isLittleEndian;
1404exports.isEvalSupported = isEvalSupported;
1405exports.log2 = log2;
1406exports.readInt8 = readInt8;
1407exports.readUint16 = readUint16;
1408exports.readUint32 = readUint32;
1409exports.removeNullCharacters = removeNullCharacters;
1410exports.setVerbosityLevel = setVerbosityLevel;
1411exports.shadow = shadow;
1412exports.string32 = string32;
1413exports.stringToBytes = stringToBytes;
1414exports.stringToPDFString = stringToPDFString;
1415exports.stringToUTF8String = stringToUTF8String;
1416exports.utf8StringToString = utf8StringToString;
1417exports.warn = warn;
1418exports.unreachable = unreachable;
1419Object.defineProperty(exports, "ReadableStream", {
1420  enumerable: true,
1421  get: function get() {
1422    return _streams_polyfill.ReadableStream;
1423  }
1424});
1425Object.defineProperty(exports, "URL", {
1426  enumerable: true,
1427  get: function get() {
1428    return _url_polyfill.URL;
1429  }
1430});
1431exports.createObjectURL = exports.FormatError = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.NativeImageDecoding = exports.MissingPDFException = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = void 0;
1432
1433__w_pdfjs_require__(6);
1434
1435var _streams_polyfill = __w_pdfjs_require__(147);
1436
1437var _url_polyfill = __w_pdfjs_require__(149);
1438
1439function _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); }
1440
1441var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
1442exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
1443var FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
1444exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
1445var NativeImageDecoding = {
1446  NONE: 'none',
1447  DECODE: 'decode',
1448  DISPLAY: 'display'
1449};
1450exports.NativeImageDecoding = NativeImageDecoding;
1451var PermissionFlag = {
1452  PRINT: 0x04,
1453  MODIFY_CONTENTS: 0x08,
1454  COPY: 0x10,
1455  MODIFY_ANNOTATIONS: 0x20,
1456  FILL_INTERACTIVE_FORMS: 0x100,
1457  COPY_FOR_ACCESSIBILITY: 0x200,
1458  ASSEMBLE: 0x400,
1459  PRINT_HIGH_QUALITY: 0x800
1460};
1461exports.PermissionFlag = PermissionFlag;
1462var TextRenderingMode = {
1463  FILL: 0,
1464  STROKE: 1,
1465  FILL_STROKE: 2,
1466  INVISIBLE: 3,
1467  FILL_ADD_TO_PATH: 4,
1468  STROKE_ADD_TO_PATH: 5,
1469  FILL_STROKE_ADD_TO_PATH: 6,
1470  ADD_TO_PATH: 7,
1471  FILL_STROKE_MASK: 3,
1472  ADD_TO_PATH_FLAG: 4
1473};
1474exports.TextRenderingMode = TextRenderingMode;
1475var ImageKind = {
1476  GRAYSCALE_1BPP: 1,
1477  RGB_24BPP: 2,
1478  RGBA_32BPP: 3
1479};
1480exports.ImageKind = ImageKind;
1481var AnnotationType = {
1482  TEXT: 1,
1483  LINK: 2,
1484  FREETEXT: 3,
1485  LINE: 4,
1486  SQUARE: 5,
1487  CIRCLE: 6,
1488  POLYGON: 7,
1489  POLYLINE: 8,
1490  HIGHLIGHT: 9,
1491  UNDERLINE: 10,
1492  SQUIGGLY: 11,
1493  STRIKEOUT: 12,
1494  STAMP: 13,
1495  CARET: 14,
1496  INK: 15,
1497  POPUP: 16,
1498  FILEATTACHMENT: 17,
1499  SOUND: 18,
1500  MOVIE: 19,
1501  WIDGET: 20,
1502  SCREEN: 21,
1503  PRINTERMARK: 22,
1504  TRAPNET: 23,
1505  WATERMARK: 24,
1506  THREED: 25,
1507  REDACT: 26
1508};
1509exports.AnnotationType = AnnotationType;
1510var AnnotationFlag = {
1511  INVISIBLE: 0x01,
1512  HIDDEN: 0x02,
1513  PRINT: 0x04,
1514  NOZOOM: 0x08,
1515  NOROTATE: 0x10,
1516  NOVIEW: 0x20,
1517  READONLY: 0x40,
1518  LOCKED: 0x80,
1519  TOGGLENOVIEW: 0x100,
1520  LOCKEDCONTENTS: 0x200
1521};
1522exports.AnnotationFlag = AnnotationFlag;
1523var AnnotationFieldFlag = {
1524  READONLY: 0x0000001,
1525  REQUIRED: 0x0000002,
1526  NOEXPORT: 0x0000004,
1527  MULTILINE: 0x0001000,
1528  PASSWORD: 0x0002000,
1529  NOTOGGLETOOFF: 0x0004000,
1530  RADIO: 0x0008000,
1531  PUSHBUTTON: 0x0010000,
1532  COMBO: 0x0020000,
1533  EDIT: 0x0040000,
1534  SORT: 0x0080000,
1535  FILESELECT: 0x0100000,
1536  MULTISELECT: 0x0200000,
1537  DONOTSPELLCHECK: 0x0400000,
1538  DONOTSCROLL: 0x0800000,
1539  COMB: 0x1000000,
1540  RICHTEXT: 0x2000000,
1541  RADIOSINUNISON: 0x2000000,
1542  COMMITONSELCHANGE: 0x4000000
1543};
1544exports.AnnotationFieldFlag = AnnotationFieldFlag;
1545var AnnotationBorderStyleType = {
1546  SOLID: 1,
1547  DASHED: 2,
1548  BEVELED: 3,
1549  INSET: 4,
1550  UNDERLINE: 5
1551};
1552exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
1553var StreamType = {
1554  UNKNOWN: 0,
1555  FLATE: 1,
1556  LZW: 2,
1557  DCT: 3,
1558  JPX: 4,
1559  JBIG: 5,
1560  A85: 6,
1561  AHX: 7,
1562  CCF: 8,
1563  RL: 9
1564};
1565exports.StreamType = StreamType;
1566var FontType = {
1567  UNKNOWN: 0,
1568  TYPE1: 1,
1569  TYPE1C: 2,
1570  CIDFONTTYPE0: 3,
1571  CIDFONTTYPE0C: 4,
1572  TRUETYPE: 5,
1573  CIDFONTTYPE2: 6,
1574  TYPE3: 7,
1575  OPENTYPE: 8,
1576  TYPE0: 9,
1577  MMTYPE1: 10
1578};
1579exports.FontType = FontType;
1580var VerbosityLevel = {
1581  ERRORS: 0,
1582  WARNINGS: 1,
1583  INFOS: 5
1584};
1585exports.VerbosityLevel = VerbosityLevel;
1586var CMapCompressionType = {
1587  NONE: 0,
1588  BINARY: 1,
1589  STREAM: 2
1590};
1591exports.CMapCompressionType = CMapCompressionType;
1592var OPS = {
1593  dependency: 1,
1594  setLineWidth: 2,
1595  setLineCap: 3,
1596  setLineJoin: 4,
1597  setMiterLimit: 5,
1598  setDash: 6,
1599  setRenderingIntent: 7,
1600  setFlatness: 8,
1601  setGState: 9,
1602  save: 10,
1603  restore: 11,
1604  transform: 12,
1605  moveTo: 13,
1606  lineTo: 14,
1607  curveTo: 15,
1608  curveTo2: 16,
1609  curveTo3: 17,
1610  closePath: 18,
1611  rectangle: 19,
1612  stroke: 20,
1613  closeStroke: 21,
1614  fill: 22,
1615  eoFill: 23,
1616  fillStroke: 24,
1617  eoFillStroke: 25,
1618  closeFillStroke: 26,
1619  closeEOFillStroke: 27,
1620  endPath: 28,
1621  clip: 29,
1622  eoClip: 30,
1623  beginText: 31,
1624  endText: 32,
1625  setCharSpacing: 33,
1626  setWordSpacing: 34,
1627  setHScale: 35,
1628  setLeading: 36,
1629  setFont: 37,
1630  setTextRenderingMode: 38,
1631  setTextRise: 39,
1632  moveText: 40,
1633  setLeadingMoveText: 41,
1634  setTextMatrix: 42,
1635  nextLine: 43,
1636  showText: 44,
1637  showSpacedText: 45,
1638  nextLineShowText: 46,
1639  nextLineSetSpacingShowText: 47,
1640  setCharWidth: 48,
1641  setCharWidthAndBounds: 49,
1642  setStrokeColorSpace: 50,
1643  setFillColorSpace: 51,
1644  setStrokeColor: 52,
1645  setStrokeColorN: 53,
1646  setFillColor: 54,
1647  setFillColorN: 55,
1648  setStrokeGray: 56,
1649  setFillGray: 57,
1650  setStrokeRGBColor: 58,
1651  setFillRGBColor: 59,
1652  setStrokeCMYKColor: 60,
1653  setFillCMYKColor: 61,
1654  shadingFill: 62,
1655  beginInlineImage: 63,
1656  beginImageData: 64,
1657  endInlineImage: 65,
1658  paintXObject: 66,
1659  markPoint: 67,
1660  markPointProps: 68,
1661  beginMarkedContent: 69,
1662  beginMarkedContentProps: 70,
1663  endMarkedContent: 71,
1664  beginCompat: 72,
1665  endCompat: 73,
1666  paintFormXObjectBegin: 74,
1667  paintFormXObjectEnd: 75,
1668  beginGroup: 76,
1669  endGroup: 77,
1670  beginAnnotations: 78,
1671  endAnnotations: 79,
1672  beginAnnotation: 80,
1673  endAnnotation: 81,
1674  paintJpegXObject: 82,
1675  paintImageMaskXObject: 83,
1676  paintImageMaskXObjectGroup: 84,
1677  paintImageXObject: 85,
1678  paintInlineImageXObject: 86,
1679  paintInlineImageXObjectGroup: 87,
1680  paintImageXObjectRepeat: 88,
1681  paintImageMaskXObjectRepeat: 89,
1682  paintSolidColorImageMask: 90,
1683  constructPath: 91
1684};
1685exports.OPS = OPS;
1686var UNSUPPORTED_FEATURES = {
1687  unknown: 'unknown',
1688  forms: 'forms',
1689  javaScript: 'javaScript',
1690  smask: 'smask',
1691  shadingPattern: 'shadingPattern',
1692  font: 'font'
1693};
1694exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
1695var PasswordResponses = {
1696  NEED_PASSWORD: 1,
1697  INCORRECT_PASSWORD: 2
1698};
1699exports.PasswordResponses = PasswordResponses;
1700var verbosity = VerbosityLevel.WARNINGS;
1701
1702function setVerbosityLevel(level) {
1703  if (Number.isInteger(level)) {
1704    verbosity = level;
1705  }
1706}
1707
1708function getVerbosityLevel() {
1709  return verbosity;
1710}
1711
1712function info(msg) {
1713  if (verbosity >= VerbosityLevel.INFOS) {
1714    console.log('Info: ' + msg);
1715  }
1716}
1717
1718function warn(msg) {
1719  if (verbosity >= VerbosityLevel.WARNINGS) {
1720    console.log('Warning: ' + msg);
1721  }
1722}
1723
1724function unreachable(msg) {
1725  throw new Error(msg);
1726}
1727
1728function assert(cond, msg) {
1729  if (!cond) {
1730    unreachable(msg);
1731  }
1732}
1733
1734function isSameOrigin(baseUrl, otherUrl) {
1735  try {
1736    var base = new _url_polyfill.URL(baseUrl);
1737
1738    if (!base.origin || base.origin === 'null') {
1739      return false;
1740    }
1741  } catch (e) {
1742    return false;
1743  }
1744
1745  var other = new _url_polyfill.URL(otherUrl, base);
1746  return base.origin === other.origin;
1747}
1748
1749function _isValidProtocol(url) {
1750  if (!url) {
1751    return false;
1752  }
1753
1754  switch (url.protocol) {
1755    case 'http:':
1756    case 'https:':
1757    case 'ftp:':
1758    case 'mailto:':
1759    case 'tel:':
1760      return true;
1761
1762    default:
1763      return false;
1764  }
1765}
1766
1767function createValidAbsoluteUrl(url, baseUrl) {
1768  if (!url) {
1769    return null;
1770  }
1771
1772  try {
1773    var absoluteUrl = baseUrl ? new _url_polyfill.URL(url, baseUrl) : new _url_polyfill.URL(url);
1774
1775    if (_isValidProtocol(absoluteUrl)) {
1776      return absoluteUrl;
1777    }
1778  } catch (ex) {}
1779
1780  return null;
1781}
1782
1783function shadow(obj, prop, value) {
1784  Object.defineProperty(obj, prop, {
1785    value: value,
1786    enumerable: true,
1787    configurable: true,
1788    writable: false
1789  });
1790  return value;
1791}
1792
1793var PasswordException = function PasswordExceptionClosure() {
1794  function PasswordException(msg, code) {
1795    this.name = 'PasswordException';
1796    this.message = msg;
1797    this.code = code;
1798  }
1799
1800  PasswordException.prototype = new Error();
1801  PasswordException.constructor = PasswordException;
1802  return PasswordException;
1803}();
1804
1805exports.PasswordException = PasswordException;
1806
1807var UnknownErrorException = function UnknownErrorExceptionClosure() {
1808  function UnknownErrorException(msg, details) {
1809    this.name = 'UnknownErrorException';
1810    this.message = msg;
1811    this.details = details;
1812  }
1813
1814  UnknownErrorException.prototype = new Error();
1815  UnknownErrorException.constructor = UnknownErrorException;
1816  return UnknownErrorException;
1817}();
1818
1819exports.UnknownErrorException = UnknownErrorException;
1820
1821var InvalidPDFException = function InvalidPDFExceptionClosure() {
1822  function InvalidPDFException(msg) {
1823    this.name = 'InvalidPDFException';
1824    this.message = msg;
1825  }
1826
1827  InvalidPDFException.prototype = new Error();
1828  InvalidPDFException.constructor = InvalidPDFException;
1829  return InvalidPDFException;
1830}();
1831
1832exports.InvalidPDFException = InvalidPDFException;
1833
1834var MissingPDFException = function MissingPDFExceptionClosure() {
1835  function MissingPDFException(msg) {
1836    this.name = 'MissingPDFException';
1837    this.message = msg;
1838  }
1839
1840  MissingPDFException.prototype = new Error();
1841  MissingPDFException.constructor = MissingPDFException;
1842  return MissingPDFException;
1843}();
1844
1845exports.MissingPDFException = MissingPDFException;
1846
1847var UnexpectedResponseException = function UnexpectedResponseExceptionClosure() {
1848  function UnexpectedResponseException(msg, status) {
1849    this.name = 'UnexpectedResponseException';
1850    this.message = msg;
1851    this.status = status;
1852  }
1853
1854  UnexpectedResponseException.prototype = new Error();
1855  UnexpectedResponseException.constructor = UnexpectedResponseException;
1856  return UnexpectedResponseException;
1857}();
1858
1859exports.UnexpectedResponseException = UnexpectedResponseException;
1860
1861var FormatError = function FormatErrorClosure() {
1862  function FormatError(msg) {
1863    this.message = msg;
1864  }
1865
1866  FormatError.prototype = new Error();
1867  FormatError.prototype.name = 'FormatError';
1868  FormatError.constructor = FormatError;
1869  return FormatError;
1870}();
1871
1872exports.FormatError = FormatError;
1873
1874var AbortException = function AbortExceptionClosure() {
1875  function AbortException(msg) {
1876    this.name = 'AbortException';
1877    this.message = msg;
1878  }
1879
1880  AbortException.prototype = new Error();
1881  AbortException.constructor = AbortException;
1882  return AbortException;
1883}();
1884
1885exports.AbortException = AbortException;
1886var NullCharactersRegExp = /\x00/g;
1887
1888function removeNullCharacters(str) {
1889  if (typeof str !== 'string') {
1890    warn('The argument for removeNullCharacters must be a string.');
1891    return str;
1892  }
1893
1894  return str.replace(NullCharactersRegExp, '');
1895}
1896
1897function bytesToString(bytes) {
1898  assert(bytes !== null && _typeof(bytes) === 'object' && bytes.length !== undefined, 'Invalid argument for bytesToString');
1899  var length = bytes.length;
1900  var MAX_ARGUMENT_COUNT = 8192;
1901
1902  if (length < MAX_ARGUMENT_COUNT) {
1903    return String.fromCharCode.apply(null, bytes);
1904  }
1905
1906  var strBuf = [];
1907
1908  for (var i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
1909    var chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
1910    var chunk = bytes.subarray(i, chunkEnd);
1911    strBuf.push(String.fromCharCode.apply(null, chunk));
1912  }
1913
1914  return strBuf.join('');
1915}
1916
1917function stringToBytes(str) {
1918  assert(typeof str === 'string', 'Invalid argument for stringToBytes');
1919  var length = str.length;
1920  var bytes = new Uint8Array(length);
1921
1922  for (var i = 0; i < length; ++i) {
1923    bytes[i] = str.charCodeAt(i) & 0xFF;
1924  }
1925
1926  return bytes;
1927}
1928
1929function arrayByteLength(arr) {
1930  if (arr.length !== undefined) {
1931    return arr.length;
1932  }
1933
1934  assert(arr.byteLength !== undefined);
1935  return arr.byteLength;
1936}
1937
1938function arraysToBytes(arr) {
1939  if (arr.length === 1 && arr[0] instanceof Uint8Array) {
1940    return arr[0];
1941  }
1942
1943  var resultLength = 0;
1944  var i,
1945      ii = arr.length;
1946  var item, itemLength;
1947
1948  for (i = 0; i < ii; i++) {
1949    item = arr[i];
1950    itemLength = arrayByteLength(item);
1951    resultLength += itemLength;
1952  }
1953
1954  var pos = 0;
1955  var data = new Uint8Array(resultLength);
1956
1957  for (i = 0; i < ii; i++) {
1958    item = arr[i];
1959
1960    if (!(item instanceof Uint8Array)) {
1961      if (typeof item === 'string') {
1962        item = stringToBytes(item);
1963      } else {
1964        item = new Uint8Array(item);
1965      }
1966    }
1967
1968    itemLength = item.byteLength;
1969    data.set(item, pos);
1970    pos += itemLength;
1971  }
1972
1973  return data;
1974}
1975
1976function string32(value) {
1977  return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
1978}
1979
1980function log2(x) {
1981  if (x <= 0) {
1982    return 0;
1983  }
1984
1985  return Math.ceil(Math.log2(x));
1986}
1987
1988function readInt8(data, start) {
1989  return data[start] << 24 >> 24;
1990}
1991
1992function readUint16(data, offset) {
1993  return data[offset] << 8 | data[offset + 1];
1994}
1995
1996function readUint32(data, offset) {
1997  return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
1998}
1999
2000function isLittleEndian() {
2001  var buffer8 = new Uint8Array(4);
2002  buffer8[0] = 1;
2003  var view32 = new Uint32Array(buffer8.buffer, 0, 1);
2004  return view32[0] === 1;
2005}
2006
2007function isEvalSupported() {
2008  try {
2009    new Function('');
2010    return true;
2011  } catch (e) {
2012    return false;
2013  }
2014}
2015
2016var Util = function UtilClosure() {
2017  function Util() {}
2018
2019  var rgbBuf = ['rgb(', 0, ',', 0, ',', 0, ')'];
2020
2021  Util.makeCssRgb = function Util_makeCssRgb(r, g, b) {
2022    rgbBuf[1] = r;
2023    rgbBuf[3] = g;
2024    rgbBuf[5] = b;
2025    return rgbBuf.join('');
2026  };
2027
2028  Util.transform = function Util_transform(m1, m2) {
2029    return [m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2[3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5]];
2030  };
2031
2032  Util.applyTransform = function Util_applyTransform(p, m) {
2033    var xt = p[0] * m[0] + p[1] * m[2] + m[4];
2034    var yt = p[0] * m[1] + p[1] * m[3] + m[5];
2035    return [xt, yt];
2036  };
2037
2038  Util.applyInverseTransform = function Util_applyInverseTransform(p, m) {
2039    var d = m[0] * m[3] - m[1] * m[2];
2040    var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
2041    var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
2042    return [xt, yt];
2043  };
2044
2045  Util.getAxialAlignedBoundingBox = function Util_getAxialAlignedBoundingBox(r, m) {
2046    var p1 = Util.applyTransform(r, m);
2047    var p2 = Util.applyTransform(r.slice(2, 4), m);
2048    var p3 = Util.applyTransform([r[0], r[3]], m);
2049    var p4 = Util.applyTransform([r[2], r[1]], m);
2050    return [Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math.max(p1[1], p2[1], p3[1], p4[1])];
2051  };
2052
2053  Util.inverseTransform = function Util_inverseTransform(m) {
2054    var d = m[0] * m[3] - m[1] * m[2];
2055    return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d, (m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d];
2056  };
2057
2058  Util.apply3dTransform = function Util_apply3dTransform(m, v) {
2059    return [m[0] * v[0] + m[1] * v[1] + m[2] * v[2], m[3] * v[0] + m[4] * v[1] + m[5] * v[2], m[6] * v[0] + m[7] * v[1] + m[8] * v[2]];
2060  };
2061
2062  Util.singularValueDecompose2dScale = function Util_singularValueDecompose2dScale(m) {
2063    var transpose = [m[0], m[2], m[1], m[3]];
2064    var a = m[0] * transpose[0] + m[1] * transpose[2];
2065    var b = m[0] * transpose[1] + m[1] * transpose[3];
2066    var c = m[2] * transpose[0] + m[3] * transpose[2];
2067    var d = m[2] * transpose[1] + m[3] * transpose[3];
2068    var first = (a + d) / 2;
2069    var second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2;
2070    var sx = first + second || 1;
2071    var sy = first - second || 1;
2072    return [Math.sqrt(sx), Math.sqrt(sy)];
2073  };
2074
2075  Util.normalizeRect = function Util_normalizeRect(rect) {
2076    var r = rect.slice(0);
2077
2078    if (rect[0] > rect[2]) {
2079      r[0] = rect[2];
2080      r[2] = rect[0];
2081    }
2082
2083    if (rect[1] > rect[3]) {
2084      r[1] = rect[3];
2085      r[3] = rect[1];
2086    }
2087
2088    return r;
2089  };
2090
2091  Util.intersect = function Util_intersect(rect1, rect2) {
2092    function compare(a, b) {
2093      return a - b;
2094    }
2095
2096    var orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare),
2097        orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare),
2098        result = [];
2099    rect1 = Util.normalizeRect(rect1);
2100    rect2 = Util.normalizeRect(rect2);
2101
2102    if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
2103      result[0] = orderedX[1];
2104      result[2] = orderedX[2];
2105    } else {
2106      return false;
2107    }
2108
2109    if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
2110      result[1] = orderedY[1];
2111      result[3] = orderedY[2];
2112    } else {
2113      return false;
2114    }
2115
2116    return result;
2117  };
2118
2119  return Util;
2120}();
2121
2122exports.Util = Util;
2123var PDFStringTranslateTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2D8, 0x2C7, 0x2C6, 0x2D9, 0x2DD, 0x2DB, 0x2DA, 0x2DC, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192, 0x2044, 0x2039, 0x203A, 0x2212, 0x2030, 0x201E, 0x201C, 0x201D, 0x2018, 0x2019, 0x201A, 0x2122, 0xFB01, 0xFB02, 0x141, 0x152, 0x160, 0x178, 0x17D, 0x131, 0x142, 0x153, 0x161, 0x17E, 0, 0x20AC];
2124
2125function stringToPDFString(str) {
2126  var i,
2127      n = str.length,
2128      strBuf = [];
2129
2130  if (str[0] === '\xFE' && str[1] === '\xFF') {
2131    for (i = 2; i < n; i += 2) {
2132      strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
2133    }
2134  } else {
2135    for (i = 0; i < n; ++i) {
2136      var code = PDFStringTranslateTable[str.charCodeAt(i)];
2137      strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
2138    }
2139  }
2140
2141  return strBuf.join('');
2142}
2143
2144function stringToUTF8String(str) {
2145  return decodeURIComponent(escape(str));
2146}
2147
2148function utf8StringToString(str) {
2149  return unescape(encodeURIComponent(str));
2150}
2151
2152function isEmptyObj(obj) {
2153  for (var key in obj) {
2154    return false;
2155  }
2156
2157  return true;
2158}
2159
2160function isBool(v) {
2161  return typeof v === 'boolean';
2162}
2163
2164function isNum(v) {
2165  return typeof v === 'number';
2166}
2167
2168function isString(v) {
2169  return typeof v === 'string';
2170}
2171
2172function isArrayBuffer(v) {
2173  return _typeof(v) === 'object' && v !== null && v.byteLength !== undefined;
2174}
2175
2176function isArrayEqual(arr1, arr2) {
2177  if (arr1.length !== arr2.length) {
2178    return false;
2179  }
2180
2181  return arr1.every(function (element, index) {
2182    return element === arr2[index];
2183  });
2184}
2185
2186function isSpace(ch) {
2187  return ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A;
2188}
2189
2190function createPromiseCapability() {
2191  var capability = Object.create(null);
2192  var isSettled = false;
2193  Object.defineProperty(capability, 'settled', {
2194    get: function get() {
2195      return isSettled;
2196    }
2197  });
2198  capability.promise = new Promise(function (resolve, reject) {
2199    capability.resolve = function (data) {
2200      isSettled = true;
2201      resolve(data);
2202    };
2203
2204    capability.reject = function (reason) {
2205      isSettled = true;
2206      reject(reason);
2207    };
2208  });
2209  return capability;
2210}
2211
2212var createObjectURL = function createObjectURLClosure() {
2213  var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
2214  return function createObjectURL(data, contentType) {
2215    var forceDataSchema = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
2216
2217    if (!forceDataSchema && _url_polyfill.URL.createObjectURL) {
2218      var blob = new Blob([data], {
2219        type: contentType
2220      });
2221      return _url_polyfill.URL.createObjectURL(blob);
2222    }
2223
2224    var buffer = 'data:' + contentType + ';base64,';
2225
2226    for (var i = 0, ii = data.length; i < ii; i += 3) {
2227      var b1 = data[i] & 0xFF;
2228      var b2 = data[i + 1] & 0xFF;
2229      var b3 = data[i + 2] & 0xFF;
2230      var d1 = b1 >> 2,
2231          d2 = (b1 & 3) << 4 | b2 >> 4;
2232      var d3 = i + 1 < ii ? (b2 & 0xF) << 2 | b3 >> 6 : 64;
2233      var d4 = i + 2 < ii ? b3 & 0x3F : 64;
2234      buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
2235    }
2236
2237    return buffer;
2238  };
2239}();
2240
2241exports.createObjectURL = createObjectURL;
2242
2243/***/ }),
2244/* 6 */
2245/***/ (function(module, exports, __w_pdfjs_require__) {
2246
2247"use strict";
2248
2249
2250function _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); }
2251
2252var globalScope = __w_pdfjs_require__(7);
2253
2254if (!globalScope._pdfjsCompatibilityChecked) {
2255  globalScope._pdfjsCompatibilityChecked = true;
2256
2257  var isNodeJS = __w_pdfjs_require__(8);
2258
2259  var hasDOM = (typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' && (typeof document === "undefined" ? "undefined" : _typeof(document)) === 'object';
2260
2261  (function checkNodeBtoa() {
2262    if (globalScope.btoa || !isNodeJS()) {
2263      return;
2264    }
2265
2266    globalScope.btoa = function (chars) {
2267      return Buffer.from(chars, 'binary').toString('base64');
2268    };
2269  })();
2270
2271  (function checkNodeAtob() {
2272    if (globalScope.atob || !isNodeJS()) {
2273      return;
2274    }
2275
2276    globalScope.atob = function (input) {
2277      return Buffer.from(input, 'base64').toString('binary');
2278    };
2279  })();
2280
2281  (function checkChildNodeRemove() {
2282    if (!hasDOM) {
2283      return;
2284    }
2285
2286    if (typeof Element.prototype.remove !== 'undefined') {
2287      return;
2288    }
2289
2290    Element.prototype.remove = function () {
2291      if (this.parentNode) {
2292        this.parentNode.removeChild(this);
2293      }
2294    };
2295  })();
2296
2297  (function checkDOMTokenListAddRemove() {
2298    if (!hasDOM || isNodeJS()) {
2299      return;
2300    }
2301
2302    var div = document.createElement('div');
2303    div.classList.add('testOne', 'testTwo');
2304
2305    if (div.classList.contains('testOne') === true && div.classList.contains('testTwo') === true) {
2306      return;
2307    }
2308
2309    var OriginalDOMTokenListAdd = DOMTokenList.prototype.add;
2310    var OriginalDOMTokenListRemove = DOMTokenList.prototype.remove;
2311
2312    DOMTokenList.prototype.add = function () {
2313      for (var _len = arguments.length, tokens = new Array(_len), _key = 0; _key < _len; _key++) {
2314        tokens[_key] = arguments[_key];
2315      }
2316
2317      for (var _i = 0, _tokens = tokens; _i < _tokens.length; _i++) {
2318        var token = _tokens[_i];
2319        OriginalDOMTokenListAdd.call(this, token);
2320      }
2321    };
2322
2323    DOMTokenList.prototype.remove = function () {
2324      for (var _len2 = arguments.length, tokens = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
2325        tokens[_key2] = arguments[_key2];
2326      }
2327
2328      for (var _i2 = 0, _tokens2 = tokens; _i2 < _tokens2.length; _i2++) {
2329        var token = _tokens2[_i2];
2330        OriginalDOMTokenListRemove.call(this, token);
2331      }
2332    };
2333  })();
2334
2335  (function checkDOMTokenListToggle() {
2336    if (!hasDOM || isNodeJS()) {
2337      return;
2338    }
2339
2340    var div = document.createElement('div');
2341
2342    if (div.classList.toggle('test', 0) === false) {
2343      return;
2344    }
2345
2346    DOMTokenList.prototype.toggle = function (token) {
2347      var force = arguments.length > 1 ? !!arguments[1] : !this.contains(token);
2348      return this[force ? 'add' : 'remove'](token), force;
2349    };
2350  })();
2351
2352  (function checkStringStartsWith() {
2353    if (String.prototype.startsWith) {
2354      return;
2355    }
2356
2357    __w_pdfjs_require__(9);
2358  })();
2359
2360  (function checkStringEndsWith() {
2361    if (String.prototype.endsWith) {
2362      return;
2363    }
2364
2365    __w_pdfjs_require__(40);
2366  })();
2367
2368  (function checkStringIncludes() {
2369    if (String.prototype.includes) {
2370      return;
2371    }
2372
2373    __w_pdfjs_require__(42);
2374  })();
2375
2376  (function checkArrayIncludes() {
2377    if (Array.prototype.includes) {
2378      return;
2379    }
2380
2381    __w_pdfjs_require__(44);
2382  })();
2383
2384  (function checkArrayFrom() {
2385    if (Array.from) {
2386      return;
2387    }
2388
2389    __w_pdfjs_require__(51);
2390  })();
2391
2392  (function checkObjectAssign() {
2393    if (Object.assign) {
2394      return;
2395    }
2396
2397    __w_pdfjs_require__(74);
2398  })();
2399
2400  (function checkMathLog2() {
2401    if (Math.log2) {
2402      return;
2403    }
2404
2405    Math.log2 = __w_pdfjs_require__(79);
2406  })();
2407
2408  (function checkNumberIsNaN() {
2409    if (Number.isNaN) {
2410      return;
2411    }
2412
2413    Number.isNaN = __w_pdfjs_require__(81);
2414  })();
2415
2416  (function checkNumberIsInteger() {
2417    if (Number.isInteger) {
2418      return;
2419    }
2420
2421    Number.isInteger = __w_pdfjs_require__(83);
2422  })();
2423
2424  (function checkPromise() {
2425    if (globalScope.Promise && globalScope.Promise.prototype && globalScope.Promise.prototype["finally"]) {
2426      return;
2427    }
2428
2429    globalScope.Promise = __w_pdfjs_require__(86);
2430  })();
2431
2432  (function checkWeakMap() {
2433    if (globalScope.WeakMap) {
2434      return;
2435    }
2436
2437    globalScope.WeakMap = __w_pdfjs_require__(106);
2438  })();
2439
2440  (function checkWeakSet() {
2441    if (globalScope.WeakSet) {
2442      return;
2443    }
2444
2445    globalScope.WeakSet = __w_pdfjs_require__(123);
2446  })();
2447
2448  (function checkStringCodePointAt() {
2449    if (String.codePointAt) {
2450      return;
2451    }
2452
2453    String.codePointAt = __w_pdfjs_require__(127);
2454  })();
2455
2456  (function checkStringFromCodePoint() {
2457    if (String.fromCodePoint) {
2458      return;
2459    }
2460
2461    String.fromCodePoint = __w_pdfjs_require__(129);
2462  })();
2463
2464  (function checkSymbol() {
2465    if (globalScope.Symbol) {
2466      return;
2467    }
2468
2469    __w_pdfjs_require__(131);
2470  })();
2471
2472  (function checkStringPadStart() {
2473    if (String.prototype.padStart) {
2474      return;
2475    }
2476
2477    __w_pdfjs_require__(138);
2478  })();
2479
2480  (function checkStringPadEnd() {
2481    if (String.prototype.padEnd) {
2482      return;
2483    }
2484
2485    __w_pdfjs_require__(142);
2486  })();
2487
2488  (function checkObjectValues() {
2489    if (Object.values) {
2490      return;
2491    }
2492
2493    Object.values = __w_pdfjs_require__(144);
2494  })();
2495}
2496
2497/***/ }),
2498/* 7 */
2499/***/ (function(module, exports, __w_pdfjs_require__) {
2500
2501"use strict";
2502
2503
2504module.exports = typeof window !== 'undefined' && window.Math === Math ? window : typeof global !== 'undefined' && global.Math === Math ? global : typeof self !== 'undefined' && self.Math === Math ? self : {};
2505
2506/***/ }),
2507/* 8 */
2508/***/ (function(module, exports, __w_pdfjs_require__) {
2509
2510"use strict";
2511
2512
2513function _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); }
2514
2515module.exports = function isNodeJS() {
2516  return (typeof process === "undefined" ? "undefined" : _typeof(process)) === 'object' && process + '' === '[object process]' && !process.versions['nw'] && !process.versions['electron'];
2517};
2518
2519/***/ }),
2520/* 9 */
2521/***/ (function(module, exports, __w_pdfjs_require__) {
2522
2523"use strict";
2524
2525
2526__w_pdfjs_require__(10);
2527
2528module.exports = __w_pdfjs_require__(13).String.startsWith;
2529
2530/***/ }),
2531/* 10 */
2532/***/ (function(module, exports, __w_pdfjs_require__) {
2533
2534"use strict";
2535
2536
2537var $export = __w_pdfjs_require__(11);
2538
2539var toLength = __w_pdfjs_require__(32);
2540
2541var context = __w_pdfjs_require__(34);
2542
2543var STARTS_WITH = 'startsWith';
2544var $startsWith = ''[STARTS_WITH];
2545$export($export.P + $export.F * __w_pdfjs_require__(39)(STARTS_WITH), 'String', {
2546  startsWith: function startsWith(searchString) {
2547    var that = context(this, searchString, STARTS_WITH);
2548    var index = toLength(Math.min(arguments.length > 1 ? arguments[1] : undefined, that.length));
2549    var search = String(searchString);
2550    return $startsWith ? $startsWith.call(that, search, index) : that.slice(index, index + search.length) === search;
2551  }
2552});
2553
2554/***/ }),
2555/* 11 */
2556/***/ (function(module, exports, __w_pdfjs_require__) {
2557
2558"use strict";
2559
2560
2561var global = __w_pdfjs_require__(12);
2562
2563var core = __w_pdfjs_require__(13);
2564
2565var hide = __w_pdfjs_require__(14);
2566
2567var redefine = __w_pdfjs_require__(24);
2568
2569var ctx = __w_pdfjs_require__(30);
2570
2571var PROTOTYPE = 'prototype';
2572
2573var $export = function $export(type, name, source) {
2574  var IS_FORCED = type & $export.F;
2575  var IS_GLOBAL = type & $export.G;
2576  var IS_STATIC = type & $export.S;
2577  var IS_PROTO = type & $export.P;
2578  var IS_BIND = type & $export.B;
2579  var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE];
2580  var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
2581  var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});
2582  var key, own, out, exp;
2583  if (IS_GLOBAL) source = name;
2584
2585  for (key in source) {
2586    own = !IS_FORCED && target && target[key] !== undefined;
2587    out = (own ? target : source)[key];
2588    exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
2589    if (target) redefine(target, key, out, type & $export.U);
2590    if (exports[key] != out) hide(exports, key, exp);
2591    if (IS_PROTO && expProto[key] != out) expProto[key] = out;
2592  }
2593};
2594
2595global.core = core;
2596$export.F = 1;
2597$export.G = 2;
2598$export.S = 4;
2599$export.P = 8;
2600$export.B = 16;
2601$export.W = 32;
2602$export.U = 64;
2603$export.R = 128;
2604module.exports = $export;
2605
2606/***/ }),
2607/* 12 */
2608/***/ (function(module, exports, __w_pdfjs_require__) {
2609
2610"use strict";
2611
2612
2613var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
2614if (typeof __g == 'number') __g = global;
2615
2616/***/ }),
2617/* 13 */
2618/***/ (function(module, exports, __w_pdfjs_require__) {
2619
2620"use strict";
2621
2622
2623var core = module.exports = {
2624  version: '2.6.9'
2625};
2626if (typeof __e == 'number') __e = core;
2627
2628/***/ }),
2629/* 14 */
2630/***/ (function(module, exports, __w_pdfjs_require__) {
2631
2632"use strict";
2633
2634
2635var dP = __w_pdfjs_require__(15);
2636
2637var createDesc = __w_pdfjs_require__(23);
2638
2639module.exports = __w_pdfjs_require__(19) ? function (object, key, value) {
2640  return dP.f(object, key, createDesc(1, value));
2641} : function (object, key, value) {
2642  object[key] = value;
2643  return object;
2644};
2645
2646/***/ }),
2647/* 15 */
2648/***/ (function(module, exports, __w_pdfjs_require__) {
2649
2650"use strict";
2651
2652
2653var anObject = __w_pdfjs_require__(16);
2654
2655var IE8_DOM_DEFINE = __w_pdfjs_require__(18);
2656
2657var toPrimitive = __w_pdfjs_require__(22);
2658
2659var dP = Object.defineProperty;
2660exports.f = __w_pdfjs_require__(19) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
2661  anObject(O);
2662  P = toPrimitive(P, true);
2663  anObject(Attributes);
2664  if (IE8_DOM_DEFINE) try {
2665    return dP(O, P, Attributes);
2666  } catch (e) {}
2667  if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
2668  if ('value' in Attributes) O[P] = Attributes.value;
2669  return O;
2670};
2671
2672/***/ }),
2673/* 16 */
2674/***/ (function(module, exports, __w_pdfjs_require__) {
2675
2676"use strict";
2677
2678
2679var isObject = __w_pdfjs_require__(17);
2680
2681module.exports = function (it) {
2682  if (!isObject(it)) throw TypeError(it + ' is not an object!');
2683  return it;
2684};
2685
2686/***/ }),
2687/* 17 */
2688/***/ (function(module, exports, __w_pdfjs_require__) {
2689
2690"use strict";
2691
2692
2693function _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); }
2694
2695module.exports = function (it) {
2696  return _typeof(it) === 'object' ? it !== null : typeof it === 'function';
2697};
2698
2699/***/ }),
2700/* 18 */
2701/***/ (function(module, exports, __w_pdfjs_require__) {
2702
2703"use strict";
2704
2705
2706module.exports = !__w_pdfjs_require__(19) && !__w_pdfjs_require__(20)(function () {
2707  return Object.defineProperty(__w_pdfjs_require__(21)('div'), 'a', {
2708    get: function get() {
2709      return 7;
2710    }
2711  }).a != 7;
2712});
2713
2714/***/ }),
2715/* 19 */
2716/***/ (function(module, exports, __w_pdfjs_require__) {
2717
2718"use strict";
2719
2720
2721module.exports = !__w_pdfjs_require__(20)(function () {
2722  return Object.defineProperty({}, 'a', {
2723    get: function get() {
2724      return 7;
2725    }
2726  }).a != 7;
2727});
2728
2729/***/ }),
2730/* 20 */
2731/***/ (function(module, exports, __w_pdfjs_require__) {
2732
2733"use strict";
2734
2735
2736module.exports = function (exec) {
2737  try {
2738    return !!exec();
2739  } catch (e) {
2740    return true;
2741  }
2742};
2743
2744/***/ }),
2745/* 21 */
2746/***/ (function(module, exports, __w_pdfjs_require__) {
2747
2748"use strict";
2749
2750
2751var isObject = __w_pdfjs_require__(17);
2752
2753var document = __w_pdfjs_require__(12).document;
2754
2755var is = isObject(document) && isObject(document.createElement);
2756
2757module.exports = function (it) {
2758  return is ? document.createElement(it) : {};
2759};
2760
2761/***/ }),
2762/* 22 */
2763/***/ (function(module, exports, __w_pdfjs_require__) {
2764
2765"use strict";
2766
2767
2768var isObject = __w_pdfjs_require__(17);
2769
2770module.exports = function (it, S) {
2771  if (!isObject(it)) return it;
2772  var fn, val;
2773  if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
2774  if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
2775  if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
2776  throw TypeError("Can't convert object to primitive value");
2777};
2778
2779/***/ }),
2780/* 23 */
2781/***/ (function(module, exports, __w_pdfjs_require__) {
2782
2783"use strict";
2784
2785
2786module.exports = function (bitmap, value) {
2787  return {
2788    enumerable: !(bitmap & 1),
2789    configurable: !(bitmap & 2),
2790    writable: !(bitmap & 4),
2791    value: value
2792  };
2793};
2794
2795/***/ }),
2796/* 24 */
2797/***/ (function(module, exports, __w_pdfjs_require__) {
2798
2799"use strict";
2800
2801
2802var global = __w_pdfjs_require__(12);
2803
2804var hide = __w_pdfjs_require__(14);
2805
2806var has = __w_pdfjs_require__(25);
2807
2808var SRC = __w_pdfjs_require__(26)('src');
2809
2810var $toString = __w_pdfjs_require__(27);
2811
2812var TO_STRING = 'toString';
2813var TPL = ('' + $toString).split(TO_STRING);
2814
2815__w_pdfjs_require__(13).inspectSource = function (it) {
2816  return $toString.call(it);
2817};
2818
2819(module.exports = function (O, key, val, safe) {
2820  var isFunction = typeof val == 'function';
2821  if (isFunction) has(val, 'name') || hide(val, 'name', key);
2822  if (O[key] === val) return;
2823  if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
2824
2825  if (O === global) {
2826    O[key] = val;
2827  } else if (!safe) {
2828    delete O[key];
2829    hide(O, key, val);
2830  } else if (O[key]) {
2831    O[key] = val;
2832  } else {
2833    hide(O, key, val);
2834  }
2835})(Function.prototype, TO_STRING, function toString() {
2836  return typeof this == 'function' && this[SRC] || $toString.call(this);
2837});
2838
2839/***/ }),
2840/* 25 */
2841/***/ (function(module, exports, __w_pdfjs_require__) {
2842
2843"use strict";
2844
2845
2846var hasOwnProperty = {}.hasOwnProperty;
2847
2848module.exports = function (it, key) {
2849  return hasOwnProperty.call(it, key);
2850};
2851
2852/***/ }),
2853/* 26 */
2854/***/ (function(module, exports, __w_pdfjs_require__) {
2855
2856"use strict";
2857
2858
2859var id = 0;
2860var px = Math.random();
2861
2862module.exports = function (key) {
2863  return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
2864};
2865
2866/***/ }),
2867/* 27 */
2868/***/ (function(module, exports, __w_pdfjs_require__) {
2869
2870"use strict";
2871
2872
2873module.exports = __w_pdfjs_require__(28)('native-function-to-string', Function.toString);
2874
2875/***/ }),
2876/* 28 */
2877/***/ (function(module, exports, __w_pdfjs_require__) {
2878
2879"use strict";
2880
2881
2882var core = __w_pdfjs_require__(13);
2883
2884var global = __w_pdfjs_require__(12);
2885
2886var SHARED = '__core-js_shared__';
2887var store = global[SHARED] || (global[SHARED] = {});
2888(module.exports = function (key, value) {
2889  return store[key] || (store[key] = value !== undefined ? value : {});
2890})('versions', []).push({
2891  version: core.version,
2892  mode: __w_pdfjs_require__(29) ? 'pure' : 'global',
2893  copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
2894});
2895
2896/***/ }),
2897/* 29 */
2898/***/ (function(module, exports, __w_pdfjs_require__) {
2899
2900"use strict";
2901
2902
2903module.exports = false;
2904
2905/***/ }),
2906/* 30 */
2907/***/ (function(module, exports, __w_pdfjs_require__) {
2908
2909"use strict";
2910
2911
2912var aFunction = __w_pdfjs_require__(31);
2913
2914module.exports = function (fn, that, length) {
2915  aFunction(fn);
2916  if (that === undefined) return fn;
2917
2918  switch (length) {
2919    case 1:
2920      return function (a) {
2921        return fn.call(that, a);
2922      };
2923
2924    case 2:
2925      return function (a, b) {
2926        return fn.call(that, a, b);
2927      };
2928
2929    case 3:
2930      return function (a, b, c) {
2931        return fn.call(that, a, b, c);
2932      };
2933  }
2934
2935  return function () {
2936    return fn.apply(that, arguments);
2937  };
2938};
2939
2940/***/ }),
2941/* 31 */
2942/***/ (function(module, exports, __w_pdfjs_require__) {
2943
2944"use strict";
2945
2946
2947module.exports = function (it) {
2948  if (typeof it != 'function') throw TypeError(it + ' is not a function!');
2949  return it;
2950};
2951
2952/***/ }),
2953/* 32 */
2954/***/ (function(module, exports, __w_pdfjs_require__) {
2955
2956"use strict";
2957
2958
2959var toInteger = __w_pdfjs_require__(33);
2960
2961var min = Math.min;
2962
2963module.exports = function (it) {
2964  return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0;
2965};
2966
2967/***/ }),
2968/* 33 */
2969/***/ (function(module, exports, __w_pdfjs_require__) {
2970
2971"use strict";
2972
2973
2974var ceil = Math.ceil;
2975var floor = Math.floor;
2976
2977module.exports = function (it) {
2978  return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
2979};
2980
2981/***/ }),
2982/* 34 */
2983/***/ (function(module, exports, __w_pdfjs_require__) {
2984
2985"use strict";
2986
2987
2988var isRegExp = __w_pdfjs_require__(35);
2989
2990var defined = __w_pdfjs_require__(38);
2991
2992module.exports = function (that, searchString, NAME) {
2993  if (isRegExp(searchString)) throw TypeError('String#' + NAME + " doesn't accept regex!");
2994  return String(defined(that));
2995};
2996
2997/***/ }),
2998/* 35 */
2999/***/ (function(module, exports, __w_pdfjs_require__) {
3000
3001"use strict";
3002
3003
3004var isObject = __w_pdfjs_require__(17);
3005
3006var cof = __w_pdfjs_require__(36);
3007
3008var MATCH = __w_pdfjs_require__(37)('match');
3009
3010module.exports = function (it) {
3011  var isRegExp;
3012  return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp');
3013};
3014
3015/***/ }),
3016/* 36 */
3017/***/ (function(module, exports, __w_pdfjs_require__) {
3018
3019"use strict";
3020
3021
3022var toString = {}.toString;
3023
3024module.exports = function (it) {
3025  return toString.call(it).slice(8, -1);
3026};
3027
3028/***/ }),
3029/* 37 */
3030/***/ (function(module, exports, __w_pdfjs_require__) {
3031
3032"use strict";
3033
3034
3035var store = __w_pdfjs_require__(28)('wks');
3036
3037var uid = __w_pdfjs_require__(26);
3038
3039var _Symbol = __w_pdfjs_require__(12).Symbol;
3040
3041var USE_SYMBOL = typeof _Symbol == 'function';
3042
3043var $exports = module.exports = function (name) {
3044  return store[name] || (store[name] = USE_SYMBOL && _Symbol[name] || (USE_SYMBOL ? _Symbol : uid)('Symbol.' + name));
3045};
3046
3047$exports.store = store;
3048
3049/***/ }),
3050/* 38 */
3051/***/ (function(module, exports, __w_pdfjs_require__) {
3052
3053"use strict";
3054
3055
3056module.exports = function (it) {
3057  if (it == undefined) throw TypeError("Can't call method on  " + it);
3058  return it;
3059};
3060
3061/***/ }),
3062/* 39 */
3063/***/ (function(module, exports, __w_pdfjs_require__) {
3064
3065"use strict";
3066
3067
3068var MATCH = __w_pdfjs_require__(37)('match');
3069
3070module.exports = function (KEY) {
3071  var re = /./;
3072
3073  try {
3074    '/./'[KEY](re);
3075  } catch (e) {
3076    try {
3077      re[MATCH] = false;
3078      return !'/./'[KEY](re);
3079    } catch (f) {}
3080  }
3081
3082  return true;
3083};
3084
3085/***/ }),
3086/* 40 */
3087/***/ (function(module, exports, __w_pdfjs_require__) {
3088
3089"use strict";
3090
3091
3092__w_pdfjs_require__(41);
3093
3094module.exports = __w_pdfjs_require__(13).String.endsWith;
3095
3096/***/ }),
3097/* 41 */
3098/***/ (function(module, exports, __w_pdfjs_require__) {
3099
3100"use strict";
3101
3102
3103var $export = __w_pdfjs_require__(11);
3104
3105var toLength = __w_pdfjs_require__(32);
3106
3107var context = __w_pdfjs_require__(34);
3108
3109var ENDS_WITH = 'endsWith';
3110var $endsWith = ''[ENDS_WITH];
3111$export($export.P + $export.F * __w_pdfjs_require__(39)(ENDS_WITH), 'String', {
3112  endsWith: function endsWith(searchString) {
3113    var that = context(this, searchString, ENDS_WITH);
3114    var endPosition = arguments.length > 1 ? arguments[1] : undefined;
3115    var len = toLength(that.length);
3116    var end = endPosition === undefined ? len : Math.min(toLength(endPosition), len);
3117    var search = String(searchString);
3118    return $endsWith ? $endsWith.call(that, search, end) : that.slice(end - search.length, end) === search;
3119  }
3120});
3121
3122/***/ }),
3123/* 42 */
3124/***/ (function(module, exports, __w_pdfjs_require__) {
3125
3126"use strict";
3127
3128
3129__w_pdfjs_require__(43);
3130
3131module.exports = __w_pdfjs_require__(13).String.includes;
3132
3133/***/ }),
3134/* 43 */
3135/***/ (function(module, exports, __w_pdfjs_require__) {
3136
3137"use strict";
3138
3139
3140var $export = __w_pdfjs_require__(11);
3141
3142var context = __w_pdfjs_require__(34);
3143
3144var INCLUDES = 'includes';
3145$export($export.P + $export.F * __w_pdfjs_require__(39)(INCLUDES), 'String', {
3146  includes: function includes(searchString) {
3147    return !!~context(this, searchString, INCLUDES).indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined);
3148  }
3149});
3150
3151/***/ }),
3152/* 44 */
3153/***/ (function(module, exports, __w_pdfjs_require__) {
3154
3155"use strict";
3156
3157
3158__w_pdfjs_require__(45);
3159
3160module.exports = __w_pdfjs_require__(13).Array.includes;
3161
3162/***/ }),
3163/* 45 */
3164/***/ (function(module, exports, __w_pdfjs_require__) {
3165
3166"use strict";
3167
3168
3169var $export = __w_pdfjs_require__(11);
3170
3171var $includes = __w_pdfjs_require__(46)(true);
3172
3173$export($export.P, 'Array', {
3174  includes: function includes(el) {
3175    return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
3176  }
3177});
3178
3179__w_pdfjs_require__(50)('includes');
3180
3181/***/ }),
3182/* 46 */
3183/***/ (function(module, exports, __w_pdfjs_require__) {
3184
3185"use strict";
3186
3187
3188var toIObject = __w_pdfjs_require__(47);
3189
3190var toLength = __w_pdfjs_require__(32);
3191
3192var toAbsoluteIndex = __w_pdfjs_require__(49);
3193
3194module.exports = function (IS_INCLUDES) {
3195  return function ($this, el, fromIndex) {
3196    var O = toIObject($this);
3197    var length = toLength(O.length);
3198    var index = toAbsoluteIndex(fromIndex, length);
3199    var value;
3200    if (IS_INCLUDES && el != el) while (length > index) {
3201      value = O[index++];
3202      if (value != value) return true;
3203    } else for (; length > index; index++) {
3204      if (IS_INCLUDES || index in O) {
3205        if (O[index] === el) return IS_INCLUDES || index || 0;
3206      }
3207    }
3208    return !IS_INCLUDES && -1;
3209  };
3210};
3211
3212/***/ }),
3213/* 47 */
3214/***/ (function(module, exports, __w_pdfjs_require__) {
3215
3216"use strict";
3217
3218
3219var IObject = __w_pdfjs_require__(48);
3220
3221var defined = __w_pdfjs_require__(38);
3222
3223module.exports = function (it) {
3224  return IObject(defined(it));
3225};
3226
3227/***/ }),
3228/* 48 */
3229/***/ (function(module, exports, __w_pdfjs_require__) {
3230
3231"use strict";
3232
3233
3234var cof = __w_pdfjs_require__(36);
3235
3236module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
3237  return cof(it) == 'String' ? it.split('') : Object(it);
3238};
3239
3240/***/ }),
3241/* 49 */
3242/***/ (function(module, exports, __w_pdfjs_require__) {
3243
3244"use strict";
3245
3246
3247var toInteger = __w_pdfjs_require__(33);
3248
3249var max = Math.max;
3250var min = Math.min;
3251
3252module.exports = function (index, length) {
3253  index = toInteger(index);
3254  return index < 0 ? max(index + length, 0) : min(index, length);
3255};
3256
3257/***/ }),
3258/* 50 */
3259/***/ (function(module, exports, __w_pdfjs_require__) {
3260
3261"use strict";
3262
3263
3264var UNSCOPABLES = __w_pdfjs_require__(37)('unscopables');
3265
3266var ArrayProto = Array.prototype;
3267if (ArrayProto[UNSCOPABLES] == undefined) __w_pdfjs_require__(14)(ArrayProto, UNSCOPABLES, {});
3268
3269module.exports = function (key) {
3270  ArrayProto[UNSCOPABLES][key] = true;
3271};
3272
3273/***/ }),
3274/* 51 */
3275/***/ (function(module, exports, __w_pdfjs_require__) {
3276
3277"use strict";
3278
3279
3280__w_pdfjs_require__(52);
3281
3282__w_pdfjs_require__(67);
3283
3284module.exports = __w_pdfjs_require__(13).Array.from;
3285
3286/***/ }),
3287/* 52 */
3288/***/ (function(module, exports, __w_pdfjs_require__) {
3289
3290"use strict";
3291
3292
3293var $at = __w_pdfjs_require__(53)(true);
3294
3295__w_pdfjs_require__(54)(String, 'String', function (iterated) {
3296  this._t = String(iterated);
3297  this._i = 0;
3298}, function () {
3299  var O = this._t;
3300  var index = this._i;
3301  var point;
3302  if (index >= O.length) return {
3303    value: undefined,
3304    done: true
3305  };
3306  point = $at(O, index);
3307  this._i += point.length;
3308  return {
3309    value: point,
3310    done: false
3311  };
3312});
3313
3314/***/ }),
3315/* 53 */
3316/***/ (function(module, exports, __w_pdfjs_require__) {
3317
3318"use strict";
3319
3320
3321var toInteger = __w_pdfjs_require__(33);
3322
3323var defined = __w_pdfjs_require__(38);
3324
3325module.exports = function (TO_STRING) {
3326  return function (that, pos) {
3327    var s = String(defined(that));
3328    var i = toInteger(pos);
3329    var l = s.length;
3330    var a, b;
3331    if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
3332    a = s.charCodeAt(i);
3333    return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff ? TO_STRING ? s.charAt(i) : a : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
3334  };
3335};
3336
3337/***/ }),
3338/* 54 */
3339/***/ (function(module, exports, __w_pdfjs_require__) {
3340
3341"use strict";
3342
3343
3344var LIBRARY = __w_pdfjs_require__(29);
3345
3346var $export = __w_pdfjs_require__(11);
3347
3348var redefine = __w_pdfjs_require__(24);
3349
3350var hide = __w_pdfjs_require__(14);
3351
3352var Iterators = __w_pdfjs_require__(55);
3353
3354var $iterCreate = __w_pdfjs_require__(56);
3355
3356var setToStringTag = __w_pdfjs_require__(64);
3357
3358var getPrototypeOf = __w_pdfjs_require__(65);
3359
3360var ITERATOR = __w_pdfjs_require__(37)('iterator');
3361
3362var BUGGY = !([].keys && 'next' in [].keys());
3363var FF_ITERATOR = '@@iterator';
3364var KEYS = 'keys';
3365var VALUES = 'values';
3366
3367var returnThis = function returnThis() {
3368  return this;
3369};
3370
3371module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
3372  $iterCreate(Constructor, NAME, next);
3373
3374  var getMethod = function getMethod(kind) {
3375    if (!BUGGY && kind in proto) return proto[kind];
3376
3377    switch (kind) {
3378      case KEYS:
3379        return function keys() {
3380          return new Constructor(this, kind);
3381        };
3382
3383      case VALUES:
3384        return function values() {
3385          return new Constructor(this, kind);
3386        };
3387    }
3388
3389    return function entries() {
3390      return new Constructor(this, kind);
3391    };
3392  };
3393
3394  var TAG = NAME + ' Iterator';
3395  var DEF_VALUES = DEFAULT == VALUES;
3396  var VALUES_BUG = false;
3397  var proto = Base.prototype;
3398  var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
3399  var $default = $native || getMethod(DEFAULT);
3400  var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
3401  var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
3402  var methods, key, IteratorPrototype;
3403
3404  if ($anyNative) {
3405    IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));
3406
3407    if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
3408      setToStringTag(IteratorPrototype, TAG, true);
3409      if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);
3410    }
3411  }
3412
3413  if (DEF_VALUES && $native && $native.name !== VALUES) {
3414    VALUES_BUG = true;
3415
3416    $default = function values() {
3417      return $native.call(this);
3418    };
3419  }
3420
3421  if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
3422    hide(proto, ITERATOR, $default);
3423  }
3424
3425  Iterators[NAME] = $default;
3426  Iterators[TAG] = returnThis;
3427
3428  if (DEFAULT) {
3429    methods = {
3430      values: DEF_VALUES ? $default : getMethod(VALUES),
3431      keys: IS_SET ? $default : getMethod(KEYS),
3432      entries: $entries
3433    };
3434    if (FORCED) for (key in methods) {
3435      if (!(key in proto)) redefine(proto, key, methods[key]);
3436    } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
3437  }
3438
3439  return methods;
3440};
3441
3442/***/ }),
3443/* 55 */
3444/***/ (function(module, exports, __w_pdfjs_require__) {
3445
3446"use strict";
3447
3448
3449module.exports = {};
3450
3451/***/ }),
3452/* 56 */
3453/***/ (function(module, exports, __w_pdfjs_require__) {
3454
3455"use strict";
3456
3457
3458var create = __w_pdfjs_require__(57);
3459
3460var descriptor = __w_pdfjs_require__(23);
3461
3462var setToStringTag = __w_pdfjs_require__(64);
3463
3464var IteratorPrototype = {};
3465
3466__w_pdfjs_require__(14)(IteratorPrototype, __w_pdfjs_require__(37)('iterator'), function () {
3467  return this;
3468});
3469
3470module.exports = function (Constructor, NAME, next) {
3471  Constructor.prototype = create(IteratorPrototype, {
3472    next: descriptor(1, next)
3473  });
3474  setToStringTag(Constructor, NAME + ' Iterator');
3475};
3476
3477/***/ }),
3478/* 57 */
3479/***/ (function(module, exports, __w_pdfjs_require__) {
3480
3481"use strict";
3482
3483
3484var anObject = __w_pdfjs_require__(16);
3485
3486var dPs = __w_pdfjs_require__(58);
3487
3488var enumBugKeys = __w_pdfjs_require__(62);
3489
3490var IE_PROTO = __w_pdfjs_require__(61)('IE_PROTO');
3491
3492var Empty = function Empty() {};
3493
3494var PROTOTYPE = 'prototype';
3495
3496var _createDict = function createDict() {
3497  var iframe = __w_pdfjs_require__(21)('iframe');
3498
3499  var i = enumBugKeys.length;
3500  var lt = '<';
3501  var gt = '>';
3502  var iframeDocument;
3503  iframe.style.display = 'none';
3504
3505  __w_pdfjs_require__(63).appendChild(iframe);
3506
3507  iframe.src = 'javascript:';
3508  iframeDocument = iframe.contentWindow.document;
3509  iframeDocument.open();
3510  iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
3511  iframeDocument.close();
3512  _createDict = iframeDocument.F;
3513
3514  while (i--) {
3515    delete _createDict[PROTOTYPE][enumBugKeys[i]];
3516  }
3517
3518  return _createDict();
3519};
3520
3521module.exports = Object.create || function create(O, Properties) {
3522  var result;
3523
3524  if (O !== null) {
3525    Empty[PROTOTYPE] = anObject(O);
3526    result = new Empty();
3527    Empty[PROTOTYPE] = null;
3528    result[IE_PROTO] = O;
3529  } else result = _createDict();
3530
3531  return Properties === undefined ? result : dPs(result, Properties);
3532};
3533
3534/***/ }),
3535/* 58 */
3536/***/ (function(module, exports, __w_pdfjs_require__) {
3537
3538"use strict";
3539
3540
3541var dP = __w_pdfjs_require__(15);
3542
3543var anObject = __w_pdfjs_require__(16);
3544
3545var getKeys = __w_pdfjs_require__(59);
3546
3547module.exports = __w_pdfjs_require__(19) ? Object.defineProperties : function defineProperties(O, Properties) {
3548  anObject(O);
3549  var keys = getKeys(Properties);
3550  var length = keys.length;
3551  var i = 0;
3552  var P;
3553
3554  while (length > i) {
3555    dP.f(O, P = keys[i++], Properties[P]);
3556  }
3557
3558  return O;
3559};
3560
3561/***/ }),
3562/* 59 */
3563/***/ (function(module, exports, __w_pdfjs_require__) {
3564
3565"use strict";
3566
3567
3568var $keys = __w_pdfjs_require__(60);
3569
3570var enumBugKeys = __w_pdfjs_require__(62);
3571
3572module.exports = Object.keys || function keys(O) {
3573  return $keys(O, enumBugKeys);
3574};
3575
3576/***/ }),
3577/* 60 */
3578/***/ (function(module, exports, __w_pdfjs_require__) {
3579
3580"use strict";
3581
3582
3583var has = __w_pdfjs_require__(25);
3584
3585var toIObject = __w_pdfjs_require__(47);
3586
3587var arrayIndexOf = __w_pdfjs_require__(46)(false);
3588
3589var IE_PROTO = __w_pdfjs_require__(61)('IE_PROTO');
3590
3591module.exports = function (object, names) {
3592  var O = toIObject(object);
3593  var i = 0;
3594  var result = [];
3595  var key;
3596
3597  for (key in O) {
3598    if (key != IE_PROTO) has(O, key) && result.push(key);
3599  }
3600
3601  while (names.length > i) {
3602    if (has(O, key = names[i++])) {
3603      ~arrayIndexOf(result, key) || result.push(key);
3604    }
3605  }
3606
3607  return result;
3608};
3609
3610/***/ }),
3611/* 61 */
3612/***/ (function(module, exports, __w_pdfjs_require__) {
3613
3614"use strict";
3615
3616
3617var shared = __w_pdfjs_require__(28)('keys');
3618
3619var uid = __w_pdfjs_require__(26);
3620
3621module.exports = function (key) {
3622  return shared[key] || (shared[key] = uid(key));
3623};
3624
3625/***/ }),
3626/* 62 */
3627/***/ (function(module, exports, __w_pdfjs_require__) {
3628
3629"use strict";
3630
3631
3632module.exports = 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'.split(',');
3633
3634/***/ }),
3635/* 63 */
3636/***/ (function(module, exports, __w_pdfjs_require__) {
3637
3638"use strict";
3639
3640
3641var document = __w_pdfjs_require__(12).document;
3642
3643module.exports = document && document.documentElement;
3644
3645/***/ }),
3646/* 64 */
3647/***/ (function(module, exports, __w_pdfjs_require__) {
3648
3649"use strict";
3650
3651
3652var def = __w_pdfjs_require__(15).f;
3653
3654var has = __w_pdfjs_require__(25);
3655
3656var TAG = __w_pdfjs_require__(37)('toStringTag');
3657
3658module.exports = function (it, tag, stat) {
3659  if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, {
3660    configurable: true,
3661    value: tag
3662  });
3663};
3664
3665/***/ }),
3666/* 65 */
3667/***/ (function(module, exports, __w_pdfjs_require__) {
3668
3669"use strict";
3670
3671
3672var has = __w_pdfjs_require__(25);
3673
3674var toObject = __w_pdfjs_require__(66);
3675
3676var IE_PROTO = __w_pdfjs_require__(61)('IE_PROTO');
3677
3678var ObjectProto = Object.prototype;
3679
3680module.exports = Object.getPrototypeOf || function (O) {
3681  O = toObject(O);
3682  if (has(O, IE_PROTO)) return O[IE_PROTO];
3683
3684  if (typeof O.constructor == 'function' && O instanceof O.constructor) {
3685    return O.constructor.prototype;
3686  }
3687
3688  return O instanceof Object ? ObjectProto : null;
3689};
3690
3691/***/ }),
3692/* 66 */
3693/***/ (function(module, exports, __w_pdfjs_require__) {
3694
3695"use strict";
3696
3697
3698var defined = __w_pdfjs_require__(38);
3699
3700module.exports = function (it) {
3701  return Object(defined(it));
3702};
3703
3704/***/ }),
3705/* 67 */
3706/***/ (function(module, exports, __w_pdfjs_require__) {
3707
3708"use strict";
3709
3710
3711var ctx = __w_pdfjs_require__(30);
3712
3713var $export = __w_pdfjs_require__(11);
3714
3715var toObject = __w_pdfjs_require__(66);
3716
3717var call = __w_pdfjs_require__(68);
3718
3719var isArrayIter = __w_pdfjs_require__(69);
3720
3721var toLength = __w_pdfjs_require__(32);
3722
3723var createProperty = __w_pdfjs_require__(70);
3724
3725var getIterFn = __w_pdfjs_require__(71);
3726
3727$export($export.S + $export.F * !__w_pdfjs_require__(73)(function (iter) {
3728  Array.from(iter);
3729}), 'Array', {
3730  from: function from(arrayLike) {
3731    var O = toObject(arrayLike);
3732    var C = typeof this == 'function' ? this : Array;
3733    var aLen = arguments.length;
3734    var mapfn = aLen > 1 ? arguments[1] : undefined;
3735    var mapping = mapfn !== undefined;
3736    var index = 0;
3737    var iterFn = getIterFn(O);
3738    var length, result, step, iterator;
3739    if (mapping) mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2);
3740
3741    if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) {
3742      for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) {
3743        createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value);
3744      }
3745    } else {
3746      length = toLength(O.length);
3747
3748      for (result = new C(length); length > index; index++) {
3749        createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
3750      }
3751    }
3752
3753    result.length = index;
3754    return result;
3755  }
3756});
3757
3758/***/ }),
3759/* 68 */
3760/***/ (function(module, exports, __w_pdfjs_require__) {
3761
3762"use strict";
3763
3764
3765var anObject = __w_pdfjs_require__(16);
3766
3767module.exports = function (iterator, fn, value, entries) {
3768  try {
3769    return entries ? fn(anObject(value)[0], value[1]) : fn(value);
3770  } catch (e) {
3771    var ret = iterator['return'];
3772    if (ret !== undefined) anObject(ret.call(iterator));
3773    throw e;
3774  }
3775};
3776
3777/***/ }),
3778/* 69 */
3779/***/ (function(module, exports, __w_pdfjs_require__) {
3780
3781"use strict";
3782
3783
3784var Iterators = __w_pdfjs_require__(55);
3785
3786var ITERATOR = __w_pdfjs_require__(37)('iterator');
3787
3788var ArrayProto = Array.prototype;
3789
3790module.exports = function (it) {
3791  return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
3792};
3793
3794/***/ }),
3795/* 70 */
3796/***/ (function(module, exports, __w_pdfjs_require__) {
3797
3798"use strict";
3799
3800
3801var $defineProperty = __w_pdfjs_require__(15);
3802
3803var createDesc = __w_pdfjs_require__(23);
3804
3805module.exports = function (object, index, value) {
3806  if (index in object) $defineProperty.f(object, index, createDesc(0, value));else object[index] = value;
3807};
3808
3809/***/ }),
3810/* 71 */
3811/***/ (function(module, exports, __w_pdfjs_require__) {
3812
3813"use strict";
3814
3815
3816var classof = __w_pdfjs_require__(72);
3817
3818var ITERATOR = __w_pdfjs_require__(37)('iterator');
3819
3820var Iterators = __w_pdfjs_require__(55);
3821
3822module.exports = __w_pdfjs_require__(13).getIteratorMethod = function (it) {
3823  if (it != undefined) return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)];
3824};
3825
3826/***/ }),
3827/* 72 */
3828/***/ (function(module, exports, __w_pdfjs_require__) {
3829
3830"use strict";
3831
3832
3833var cof = __w_pdfjs_require__(36);
3834
3835var TAG = __w_pdfjs_require__(37)('toStringTag');
3836
3837var ARG = cof(function () {
3838  return arguments;
3839}()) == 'Arguments';
3840
3841var tryGet = function tryGet(it, key) {
3842  try {
3843    return it[key];
3844  } catch (e) {}
3845};
3846
3847module.exports = function (it) {
3848  var O, T, B;
3849  return it === undefined ? 'Undefined' : it === null ? 'Null' : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T : ARG ? cof(O) : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
3850};
3851
3852/***/ }),
3853/* 73 */
3854/***/ (function(module, exports, __w_pdfjs_require__) {
3855
3856"use strict";
3857
3858
3859var ITERATOR = __w_pdfjs_require__(37)('iterator');
3860
3861var SAFE_CLOSING = false;
3862
3863try {
3864  var riter = [7][ITERATOR]();
3865
3866  riter['return'] = function () {
3867    SAFE_CLOSING = true;
3868  };
3869
3870  Array.from(riter, function () {
3871    throw 2;
3872  });
3873} catch (e) {}
3874
3875module.exports = function (exec, skipClosing) {
3876  if (!skipClosing && !SAFE_CLOSING) return false;
3877  var safe = false;
3878
3879  try {
3880    var arr = [7];
3881    var iter = arr[ITERATOR]();
3882
3883    iter.next = function () {
3884      return {
3885        done: safe = true
3886      };
3887    };
3888
3889    arr[ITERATOR] = function () {
3890      return iter;
3891    };
3892
3893    exec(arr);
3894  } catch (e) {}
3895
3896  return safe;
3897};
3898
3899/***/ }),
3900/* 74 */
3901/***/ (function(module, exports, __w_pdfjs_require__) {
3902
3903"use strict";
3904
3905
3906__w_pdfjs_require__(75);
3907
3908module.exports = __w_pdfjs_require__(13).Object.assign;
3909
3910/***/ }),
3911/* 75 */
3912/***/ (function(module, exports, __w_pdfjs_require__) {
3913
3914"use strict";
3915
3916
3917var $export = __w_pdfjs_require__(11);
3918
3919$export($export.S + $export.F, 'Object', {
3920  assign: __w_pdfjs_require__(76)
3921});
3922
3923/***/ }),
3924/* 76 */
3925/***/ (function(module, exports, __w_pdfjs_require__) {
3926
3927"use strict";
3928
3929
3930var DESCRIPTORS = __w_pdfjs_require__(19);
3931
3932var getKeys = __w_pdfjs_require__(59);
3933
3934var gOPS = __w_pdfjs_require__(77);
3935
3936var pIE = __w_pdfjs_require__(78);
3937
3938var toObject = __w_pdfjs_require__(66);
3939
3940var IObject = __w_pdfjs_require__(48);
3941
3942var $assign = Object.assign;
3943module.exports = !$assign || __w_pdfjs_require__(20)(function () {
3944  var A = {};
3945  var B = {};
3946  var S = Symbol();
3947  var K = 'abcdefghijklmnopqrst';
3948  A[S] = 7;
3949  K.split('').forEach(function (k) {
3950    B[k] = k;
3951  });
3952  return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
3953}) ? function assign(target, source) {
3954  var T = toObject(target);
3955  var aLen = arguments.length;
3956  var index = 1;
3957  var getSymbols = gOPS.f;
3958  var isEnum = pIE.f;
3959
3960  while (aLen > index) {
3961    var S = IObject(arguments[index++]);
3962    var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);
3963    var length = keys.length;
3964    var j = 0;
3965    var key;
3966
3967    while (length > j) {
3968      key = keys[j++];
3969      if (!DESCRIPTORS || isEnum.call(S, key)) T[key] = S[key];
3970    }
3971  }
3972
3973  return T;
3974} : $assign;
3975
3976/***/ }),
3977/* 77 */
3978/***/ (function(module, exports, __w_pdfjs_require__) {
3979
3980"use strict";
3981
3982
3983exports.f = Object.getOwnPropertySymbols;
3984
3985/***/ }),
3986/* 78 */
3987/***/ (function(module, exports, __w_pdfjs_require__) {
3988
3989"use strict";
3990
3991
3992exports.f = {}.propertyIsEnumerable;
3993
3994/***/ }),
3995/* 79 */
3996/***/ (function(module, exports, __w_pdfjs_require__) {
3997
3998"use strict";
3999
4000
4001__w_pdfjs_require__(80);
4002
4003module.exports = __w_pdfjs_require__(13).Math.log2;
4004
4005/***/ }),
4006/* 80 */
4007/***/ (function(module, exports, __w_pdfjs_require__) {
4008
4009"use strict";
4010
4011
4012var $export = __w_pdfjs_require__(11);
4013
4014$export($export.S, 'Math', {
4015  log2: function log2(x) {
4016    return Math.log(x) / Math.LN2;
4017  }
4018});
4019
4020/***/ }),
4021/* 81 */
4022/***/ (function(module, exports, __w_pdfjs_require__) {
4023
4024"use strict";
4025
4026
4027__w_pdfjs_require__(82);
4028
4029module.exports = __w_pdfjs_require__(13).Number.isNaN;
4030
4031/***/ }),
4032/* 82 */
4033/***/ (function(module, exports, __w_pdfjs_require__) {
4034
4035"use strict";
4036
4037
4038var $export = __w_pdfjs_require__(11);
4039
4040$export($export.S, 'Number', {
4041  isNaN: function isNaN(number) {
4042    return number != number;
4043  }
4044});
4045
4046/***/ }),
4047/* 83 */
4048/***/ (function(module, exports, __w_pdfjs_require__) {
4049
4050"use strict";
4051
4052
4053__w_pdfjs_require__(84);
4054
4055module.exports = __w_pdfjs_require__(13).Number.isInteger;
4056
4057/***/ }),
4058/* 84 */
4059/***/ (function(module, exports, __w_pdfjs_require__) {
4060
4061"use strict";
4062
4063
4064var $export = __w_pdfjs_require__(11);
4065
4066$export($export.S, 'Number', {
4067  isInteger: __w_pdfjs_require__(85)
4068});
4069
4070/***/ }),
4071/* 85 */
4072/***/ (function(module, exports, __w_pdfjs_require__) {
4073
4074"use strict";
4075
4076
4077var isObject = __w_pdfjs_require__(17);
4078
4079var floor = Math.floor;
4080
4081module.exports = function isInteger(it) {
4082  return !isObject(it) && isFinite(it) && floor(it) === it;
4083};
4084
4085/***/ }),
4086/* 86 */
4087/***/ (function(module, exports, __w_pdfjs_require__) {
4088
4089"use strict";
4090
4091
4092__w_pdfjs_require__(87);
4093
4094__w_pdfjs_require__(52);
4095
4096__w_pdfjs_require__(88);
4097
4098__w_pdfjs_require__(91);
4099
4100__w_pdfjs_require__(104);
4101
4102__w_pdfjs_require__(105);
4103
4104module.exports = __w_pdfjs_require__(13).Promise;
4105
4106/***/ }),
4107/* 87 */
4108/***/ (function(module, exports, __w_pdfjs_require__) {
4109
4110"use strict";
4111
4112
4113var classof = __w_pdfjs_require__(72);
4114
4115var test = {};
4116test[__w_pdfjs_require__(37)('toStringTag')] = 'z';
4117
4118if (test + '' != '[object z]') {
4119  __w_pdfjs_require__(24)(Object.prototype, 'toString', function toString() {
4120    return '[object ' + classof(this) + ']';
4121  }, true);
4122}
4123
4124/***/ }),
4125/* 88 */
4126/***/ (function(module, exports, __w_pdfjs_require__) {
4127
4128"use strict";
4129
4130
4131var $iterators = __w_pdfjs_require__(89);
4132
4133var getKeys = __w_pdfjs_require__(59);
4134
4135var redefine = __w_pdfjs_require__(24);
4136
4137var global = __w_pdfjs_require__(12);
4138
4139var hide = __w_pdfjs_require__(14);
4140
4141var Iterators = __w_pdfjs_require__(55);
4142
4143var wks = __w_pdfjs_require__(37);
4144
4145var ITERATOR = wks('iterator');
4146var TO_STRING_TAG = wks('toStringTag');
4147var ArrayValues = Iterators.Array;
4148var DOMIterables = {
4149  CSSRuleList: true,
4150  CSSStyleDeclaration: false,
4151  CSSValueList: false,
4152  ClientRectList: false,
4153  DOMRectList: false,
4154  DOMStringList: false,
4155  DOMTokenList: true,
4156  DataTransferItemList: false,
4157  FileList: false,
4158  HTMLAllCollection: false,
4159  HTMLCollection: false,
4160  HTMLFormElement: false,
4161  HTMLSelectElement: false,
4162  MediaList: true,
4163  MimeTypeArray: false,
4164  NamedNodeMap: false,
4165  NodeList: true,
4166  PaintRequestList: false,
4167  Plugin: false,
4168  PluginArray: false,
4169  SVGLengthList: false,
4170  SVGNumberList: false,
4171  SVGPathSegList: false,
4172  SVGPointList: false,
4173  SVGStringList: false,
4174  SVGTransformList: false,
4175  SourceBufferList: false,
4176  StyleSheetList: true,
4177  TextTrackCueList: false,
4178  TextTrackList: false,
4179  TouchList: false
4180};
4181
4182for (var collections = getKeys(DOMIterables), i = 0; i < collections.length; i++) {
4183  var NAME = collections[i];
4184  var explicit = DOMIterables[NAME];
4185  var Collection = global[NAME];
4186  var proto = Collection && Collection.prototype;
4187  var key;
4188
4189  if (proto) {
4190    if (!proto[ITERATOR]) hide(proto, ITERATOR, ArrayValues);
4191    if (!proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);
4192    Iterators[NAME] = ArrayValues;
4193    if (explicit) for (key in $iterators) {
4194      if (!proto[key]) redefine(proto, key, $iterators[key], true);
4195    }
4196  }
4197}
4198
4199/***/ }),
4200/* 89 */
4201/***/ (function(module, exports, __w_pdfjs_require__) {
4202
4203"use strict";
4204
4205
4206var addToUnscopables = __w_pdfjs_require__(50);
4207
4208var step = __w_pdfjs_require__(90);
4209
4210var Iterators = __w_pdfjs_require__(55);
4211
4212var toIObject = __w_pdfjs_require__(47);
4213
4214module.exports = __w_pdfjs_require__(54)(Array, 'Array', function (iterated, kind) {
4215  this._t = toIObject(iterated);
4216  this._i = 0;
4217  this._k = kind;
4218}, function () {
4219  var O = this._t;
4220  var kind = this._k;
4221  var index = this._i++;
4222
4223  if (!O || index >= O.length) {
4224    this._t = undefined;
4225    return step(1);
4226  }
4227
4228  if (kind == 'keys') return step(0, index);
4229  if (kind == 'values') return step(0, O[index]);
4230  return step(0, [index, O[index]]);
4231}, 'values');
4232Iterators.Arguments = Iterators.Array;
4233addToUnscopables('keys');
4234addToUnscopables('values');
4235addToUnscopables('entries');
4236
4237/***/ }),
4238/* 90 */
4239/***/ (function(module, exports, __w_pdfjs_require__) {
4240
4241"use strict";
4242
4243
4244module.exports = function (done, value) {
4245  return {
4246    value: value,
4247    done: !!done
4248  };
4249};
4250
4251/***/ }),
4252/* 91 */
4253/***/ (function(module, exports, __w_pdfjs_require__) {
4254
4255"use strict";
4256
4257
4258var LIBRARY = __w_pdfjs_require__(29);
4259
4260var global = __w_pdfjs_require__(12);
4261
4262var ctx = __w_pdfjs_require__(30);
4263
4264var classof = __w_pdfjs_require__(72);
4265
4266var $export = __w_pdfjs_require__(11);
4267
4268var isObject = __w_pdfjs_require__(17);
4269
4270var aFunction = __w_pdfjs_require__(31);
4271
4272var anInstance = __w_pdfjs_require__(92);
4273
4274var forOf = __w_pdfjs_require__(93);
4275
4276var speciesConstructor = __w_pdfjs_require__(94);
4277
4278var task = __w_pdfjs_require__(95).set;
4279
4280var microtask = __w_pdfjs_require__(97)();
4281
4282var newPromiseCapabilityModule = __w_pdfjs_require__(98);
4283
4284var perform = __w_pdfjs_require__(99);
4285
4286var userAgent = __w_pdfjs_require__(100);
4287
4288var promiseResolve = __w_pdfjs_require__(101);
4289
4290var PROMISE = 'Promise';
4291var TypeError = global.TypeError;
4292var process = global.process;
4293var versions = process && process.versions;
4294var v8 = versions && versions.v8 || '';
4295var $Promise = global[PROMISE];
4296var isNode = classof(process) == 'process';
4297
4298var empty = function empty() {};
4299
4300var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper;
4301var newPromiseCapability = newGenericPromiseCapability = newPromiseCapabilityModule.f;
4302var USE_NATIVE = !!function () {
4303  try {
4304    var promise = $Promise.resolve(1);
4305
4306    var FakePromise = (promise.constructor = {})[__w_pdfjs_require__(37)('species')] = function (exec) {
4307      exec(empty, empty);
4308    };
4309
4310    return (isNode || typeof PromiseRejectionEvent == 'function') && promise.then(empty) instanceof FakePromise && v8.indexOf('6.6') !== 0 && userAgent.indexOf('Chrome/66') === -1;
4311  } catch (e) {}
4312}();
4313
4314var isThenable = function isThenable(it) {
4315  var then;
4316  return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
4317};
4318
4319var notify = function notify(promise, isReject) {
4320  if (promise._n) return;
4321  promise._n = true;
4322  var chain = promise._c;
4323  microtask(function () {
4324    var value = promise._v;
4325    var ok = promise._s == 1;
4326    var i = 0;
4327
4328    var run = function run(reaction) {
4329      var handler = ok ? reaction.ok : reaction.fail;
4330      var resolve = reaction.resolve;
4331      var reject = reaction.reject;
4332      var domain = reaction.domain;
4333      var result, then, exited;
4334
4335      try {
4336        if (handler) {
4337          if (!ok) {
4338            if (promise._h == 2) onHandleUnhandled(promise);
4339            promise._h = 1;
4340          }
4341
4342          if (handler === true) result = value;else {
4343            if (domain) domain.enter();
4344            result = handler(value);
4345
4346            if (domain) {
4347              domain.exit();
4348              exited = true;
4349            }
4350          }
4351
4352          if (result === reaction.promise) {
4353            reject(TypeError('Promise-chain cycle'));
4354          } else if (then = isThenable(result)) {
4355            then.call(result, resolve, reject);
4356          } else resolve(result);
4357        } else reject(value);
4358      } catch (e) {
4359        if (domain && !exited) domain.exit();
4360        reject(e);
4361      }
4362    };
4363
4364    while (chain.length > i) {
4365      run(chain[i++]);
4366    }
4367
4368    promise._c = [];
4369    promise._n = false;
4370    if (isReject && !promise._h) onUnhandled(promise);
4371  });
4372};
4373
4374var onUnhandled = function onUnhandled(promise) {
4375  task.call(global, function () {
4376    var value = promise._v;
4377    var unhandled = isUnhandled(promise);
4378    var result, handler, console;
4379
4380    if (unhandled) {
4381      result = perform(function () {
4382        if (isNode) {
4383          process.emit('unhandledRejection', value, promise);
4384        } else if (handler = global.onunhandledrejection) {
4385          handler({
4386            promise: promise,
4387            reason: value
4388          });
4389        } else if ((console = global.console) && console.error) {
4390          console.error('Unhandled promise rejection', value);
4391        }
4392      });
4393      promise._h = isNode || isUnhandled(promise) ? 2 : 1;
4394    }
4395
4396    promise._a = undefined;
4397    if (unhandled && result.e) throw result.v;
4398  });
4399};
4400
4401var isUnhandled = function isUnhandled(promise) {
4402  return promise._h !== 1 && (promise._a || promise._c).length === 0;
4403};
4404
4405var onHandleUnhandled = function onHandleUnhandled(promise) {
4406  task.call(global, function () {
4407    var handler;
4408
4409    if (isNode) {
4410      process.emit('rejectionHandled', promise);
4411    } else if (handler = global.onrejectionhandled) {
4412      handler({
4413        promise: promise,
4414        reason: promise._v
4415      });
4416    }
4417  });
4418};
4419
4420var $reject = function $reject(value) {
4421  var promise = this;
4422  if (promise._d) return;
4423  promise._d = true;
4424  promise = promise._w || promise;
4425  promise._v = value;
4426  promise._s = 2;
4427  if (!promise._a) promise._a = promise._c.slice();
4428  notify(promise, true);
4429};
4430
4431var $resolve = function $resolve(value) {
4432  var promise = this;
4433  var then;
4434  if (promise._d) return;
4435  promise._d = true;
4436  promise = promise._w || promise;
4437
4438  try {
4439    if (promise === value) throw TypeError("Promise can't be resolved itself");
4440
4441    if (then = isThenable(value)) {
4442      microtask(function () {
4443        var wrapper = {
4444          _w: promise,
4445          _d: false
4446        };
4447
4448        try {
4449          then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
4450        } catch (e) {
4451          $reject.call(wrapper, e);
4452        }
4453      });
4454    } else {
4455      promise._v = value;
4456      promise._s = 1;
4457      notify(promise, false);
4458    }
4459  } catch (e) {
4460    $reject.call({
4461      _w: promise,
4462      _d: false
4463    }, e);
4464  }
4465};
4466
4467if (!USE_NATIVE) {
4468  $Promise = function Promise(executor) {
4469    anInstance(this, $Promise, PROMISE, '_h');
4470    aFunction(executor);
4471    Internal.call(this);
4472
4473    try {
4474      executor(ctx($resolve, this, 1), ctx($reject, this, 1));
4475    } catch (err) {
4476      $reject.call(this, err);
4477    }
4478  };
4479
4480  Internal = function Promise(executor) {
4481    this._c = [];
4482    this._a = undefined;
4483    this._s = 0;
4484    this._d = false;
4485    this._v = undefined;
4486    this._h = 0;
4487    this._n = false;
4488  };
4489
4490  Internal.prototype = __w_pdfjs_require__(102)($Promise.prototype, {
4491    then: function then(onFulfilled, onRejected) {
4492      var reaction = newPromiseCapability(speciesConstructor(this, $Promise));
4493      reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
4494      reaction.fail = typeof onRejected == 'function' && onRejected;
4495      reaction.domain = isNode ? process.domain : undefined;
4496
4497      this._c.push(reaction);
4498
4499      if (this._a) this._a.push(reaction);
4500      if (this._s) notify(this, false);
4501      return reaction.promise;
4502    },
4503    'catch': function _catch(onRejected) {
4504      return this.then(undefined, onRejected);
4505    }
4506  });
4507
4508  OwnPromiseCapability = function OwnPromiseCapability() {
4509    var promise = new Internal();
4510    this.promise = promise;
4511    this.resolve = ctx($resolve, promise, 1);
4512    this.reject = ctx($reject, promise, 1);
4513  };
4514
4515  newPromiseCapabilityModule.f = newPromiseCapability = function newPromiseCapability(C) {
4516    return C === $Promise || C === Wrapper ? new OwnPromiseCapability(C) : newGenericPromiseCapability(C);
4517  };
4518}
4519
4520$export($export.G + $export.W + $export.F * !USE_NATIVE, {
4521  Promise: $Promise
4522});
4523
4524__w_pdfjs_require__(64)($Promise, PROMISE);
4525
4526__w_pdfjs_require__(103)(PROMISE);
4527
4528Wrapper = __w_pdfjs_require__(13)[PROMISE];
4529$export($export.S + $export.F * !USE_NATIVE, PROMISE, {
4530  reject: function reject(r) {
4531    var capability = newPromiseCapability(this);
4532    var $$reject = capability.reject;
4533    $$reject(r);
4534    return capability.promise;
4535  }
4536});
4537$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, {
4538  resolve: function resolve(x) {
4539    return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x);
4540  }
4541});
4542$export($export.S + $export.F * !(USE_NATIVE && __w_pdfjs_require__(73)(function (iter) {
4543  $Promise.all(iter)['catch'](empty);
4544})), PROMISE, {
4545  all: function all(iterable) {
4546    var C = this;
4547    var capability = newPromiseCapability(C);
4548    var resolve = capability.resolve;
4549    var reject = capability.reject;
4550    var result = perform(function () {
4551      var values = [];
4552      var index = 0;
4553      var remaining = 1;
4554      forOf(iterable, false, function (promise) {
4555        var $index = index++;
4556        var alreadyCalled = false;
4557        values.push(undefined);
4558        remaining++;
4559        C.resolve(promise).then(function (value) {
4560          if (alreadyCalled) return;
4561          alreadyCalled = true;
4562          values[$index] = value;
4563          --remaining || resolve(values);
4564        }, reject);
4565      });
4566      --remaining || resolve(values);
4567    });
4568    if (result.e) reject(result.v);
4569    return capability.promise;
4570  },
4571  race: function race(iterable) {
4572    var C = this;
4573    var capability = newPromiseCapability(C);
4574    var reject = capability.reject;
4575    var result = perform(function () {
4576      forOf(iterable, false, function (promise) {
4577        C.resolve(promise).then(capability.resolve, reject);
4578      });
4579    });
4580    if (result.e) reject(result.v);
4581    return capability.promise;
4582  }
4583});
4584
4585/***/ }),
4586/* 92 */
4587/***/ (function(module, exports, __w_pdfjs_require__) {
4588
4589"use strict";
4590
4591
4592module.exports = function (it, Constructor, name, forbiddenField) {
4593  if (!(it instanceof Constructor) || forbiddenField !== undefined && forbiddenField in it) {
4594    throw TypeError(name + ': incorrect invocation!');
4595  }
4596
4597  return it;
4598};
4599
4600/***/ }),
4601/* 93 */
4602/***/ (function(module, exports, __w_pdfjs_require__) {
4603
4604"use strict";
4605
4606
4607var ctx = __w_pdfjs_require__(30);
4608
4609var call = __w_pdfjs_require__(68);
4610
4611var isArrayIter = __w_pdfjs_require__(69);
4612
4613var anObject = __w_pdfjs_require__(16);
4614
4615var toLength = __w_pdfjs_require__(32);
4616
4617var getIterFn = __w_pdfjs_require__(71);
4618
4619var BREAK = {};
4620var RETURN = {};
4621
4622var _exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {
4623  var iterFn = ITERATOR ? function () {
4624    return iterable;
4625  } : getIterFn(iterable);
4626  var f = ctx(fn, that, entries ? 2 : 1);
4627  var index = 0;
4628  var length, step, iterator, result;
4629  if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');
4630  if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) {
4631    result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
4632    if (result === BREAK || result === RETURN) return result;
4633  } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {
4634    result = call(iterator, f, step.value, entries);
4635    if (result === BREAK || result === RETURN) return result;
4636  }
4637};
4638
4639_exports.BREAK = BREAK;
4640_exports.RETURN = RETURN;
4641
4642/***/ }),
4643/* 94 */
4644/***/ (function(module, exports, __w_pdfjs_require__) {
4645
4646"use strict";
4647
4648
4649var anObject = __w_pdfjs_require__(16);
4650
4651var aFunction = __w_pdfjs_require__(31);
4652
4653var SPECIES = __w_pdfjs_require__(37)('species');
4654
4655module.exports = function (O, D) {
4656  var C = anObject(O).constructor;
4657  var S;
4658  return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);
4659};
4660
4661/***/ }),
4662/* 95 */
4663/***/ (function(module, exports, __w_pdfjs_require__) {
4664
4665"use strict";
4666
4667
4668var ctx = __w_pdfjs_require__(30);
4669
4670var invoke = __w_pdfjs_require__(96);
4671
4672var html = __w_pdfjs_require__(63);
4673
4674var cel = __w_pdfjs_require__(21);
4675
4676var global = __w_pdfjs_require__(12);
4677
4678var process = global.process;
4679var setTask = global.setImmediate;
4680var clearTask = global.clearImmediate;
4681var MessageChannel = global.MessageChannel;
4682var Dispatch = global.Dispatch;
4683var counter = 0;
4684var queue = {};
4685var ONREADYSTATECHANGE = 'onreadystatechange';
4686var defer, channel, port;
4687
4688var run = function run() {
4689  var id = +this;
4690
4691  if (queue.hasOwnProperty(id)) {
4692    var fn = queue[id];
4693    delete queue[id];
4694    fn();
4695  }
4696};
4697
4698var listener = function listener(event) {
4699  run.call(event.data);
4700};
4701
4702if (!setTask || !clearTask) {
4703  setTask = function setImmediate(fn) {
4704    var args = [];
4705    var i = 1;
4706
4707    while (arguments.length > i) {
4708      args.push(arguments[i++]);
4709    }
4710
4711    queue[++counter] = function () {
4712      invoke(typeof fn == 'function' ? fn : Function(fn), args);
4713    };
4714
4715    defer(counter);
4716    return counter;
4717  };
4718
4719  clearTask = function clearImmediate(id) {
4720    delete queue[id];
4721  };
4722
4723  if (__w_pdfjs_require__(36)(process) == 'process') {
4724    defer = function defer(id) {
4725      process.nextTick(ctx(run, id, 1));
4726    };
4727  } else if (Dispatch && Dispatch.now) {
4728    defer = function defer(id) {
4729      Dispatch.now(ctx(run, id, 1));
4730    };
4731  } else if (MessageChannel) {
4732    channel = new MessageChannel();
4733    port = channel.port2;
4734    channel.port1.onmessage = listener;
4735    defer = ctx(port.postMessage, port, 1);
4736  } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) {
4737    defer = function defer(id) {
4738      global.postMessage(id + '', '*');
4739    };
4740
4741    global.addEventListener('message', listener, false);
4742  } else if (ONREADYSTATECHANGE in cel('script')) {
4743    defer = function defer(id) {
4744      html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () {
4745        html.removeChild(this);
4746        run.call(id);
4747      };
4748    };
4749  } else {
4750    defer = function defer(id) {
4751      setTimeout(ctx(run, id, 1), 0);
4752    };
4753  }
4754}
4755
4756module.exports = {
4757  set: setTask,
4758  clear: clearTask
4759};
4760
4761/***/ }),
4762/* 96 */
4763/***/ (function(module, exports, __w_pdfjs_require__) {
4764
4765"use strict";
4766
4767
4768module.exports = function (fn, args, that) {
4769  var un = that === undefined;
4770
4771  switch (args.length) {
4772    case 0:
4773      return un ? fn() : fn.call(that);
4774
4775    case 1:
4776      return un ? fn(args[0]) : fn.call(that, args[0]);
4777
4778    case 2:
4779      return un ? fn(args[0], args[1]) : fn.call(that, args[0], args[1]);
4780
4781    case 3:
4782      return un ? fn(args[0], args[1], args[2]) : fn.call(that, args[0], args[1], args[2]);
4783
4784    case 4:
4785      return un ? fn(args[0], args[1], args[2], args[3]) : fn.call(that, args[0], args[1], args[2], args[3]);
4786  }
4787
4788  return fn.apply(that, args);
4789};
4790
4791/***/ }),
4792/* 97 */
4793/***/ (function(module, exports, __w_pdfjs_require__) {
4794
4795"use strict";
4796
4797
4798var global = __w_pdfjs_require__(12);
4799
4800var macrotask = __w_pdfjs_require__(95).set;
4801
4802var Observer = global.MutationObserver || global.WebKitMutationObserver;
4803var process = global.process;
4804var Promise = global.Promise;
4805var isNode = __w_pdfjs_require__(36)(process) == 'process';
4806
4807module.exports = function () {
4808  var head, last, notify;
4809
4810  var flush = function flush() {
4811    var parent, fn;
4812    if (isNode && (parent = process.domain)) parent.exit();
4813
4814    while (head) {
4815      fn = head.fn;
4816      head = head.next;
4817
4818      try {
4819        fn();
4820      } catch (e) {
4821        if (head) notify();else last = undefined;
4822        throw e;
4823      }
4824    }
4825
4826    last = undefined;
4827    if (parent) parent.enter();
4828  };
4829
4830  if (isNode) {
4831    notify = function notify() {
4832      process.nextTick(flush);
4833    };
4834  } else if (Observer && !(global.navigator && global.navigator.standalone)) {
4835    var toggle = true;
4836    var node = document.createTextNode('');
4837    new Observer(flush).observe(node, {
4838      characterData: true
4839    });
4840
4841    notify = function notify() {
4842      node.data = toggle = !toggle;
4843    };
4844  } else if (Promise && Promise.resolve) {
4845    var promise = Promise.resolve(undefined);
4846
4847    notify = function notify() {
4848      promise.then(flush);
4849    };
4850  } else {
4851    notify = function notify() {
4852      macrotask.call(global, flush);
4853    };
4854  }
4855
4856  return function (fn) {
4857    var task = {
4858      fn: fn,
4859      next: undefined
4860    };
4861    if (last) last.next = task;
4862
4863    if (!head) {
4864      head = task;
4865      notify();
4866    }
4867
4868    last = task;
4869  };
4870};
4871
4872/***/ }),
4873/* 98 */
4874/***/ (function(module, exports, __w_pdfjs_require__) {
4875
4876"use strict";
4877
4878
4879var aFunction = __w_pdfjs_require__(31);
4880
4881function PromiseCapability(C) {
4882  var resolve, reject;
4883  this.promise = new C(function ($$resolve, $$reject) {
4884    if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
4885    resolve = $$resolve;
4886    reject = $$reject;
4887  });
4888  this.resolve = aFunction(resolve);
4889  this.reject = aFunction(reject);
4890}
4891
4892module.exports.f = function (C) {
4893  return new PromiseCapability(C);
4894};
4895
4896/***/ }),
4897/* 99 */
4898/***/ (function(module, exports, __w_pdfjs_require__) {
4899
4900"use strict";
4901
4902
4903module.exports = function (exec) {
4904  try {
4905    return {
4906      e: false,
4907      v: exec()
4908    };
4909  } catch (e) {
4910    return {
4911      e: true,
4912      v: e
4913    };
4914  }
4915};
4916
4917/***/ }),
4918/* 100 */
4919/***/ (function(module, exports, __w_pdfjs_require__) {
4920
4921"use strict";
4922
4923
4924var global = __w_pdfjs_require__(12);
4925
4926var navigator = global.navigator;
4927module.exports = navigator && navigator.userAgent || '';
4928
4929/***/ }),
4930/* 101 */
4931/***/ (function(module, exports, __w_pdfjs_require__) {
4932
4933"use strict";
4934
4935
4936var anObject = __w_pdfjs_require__(16);
4937
4938var isObject = __w_pdfjs_require__(17);
4939
4940var newPromiseCapability = __w_pdfjs_require__(98);
4941
4942module.exports = function (C, x) {
4943  anObject(C);
4944  if (isObject(x) && x.constructor === C) return x;
4945  var promiseCapability = newPromiseCapability.f(C);
4946  var resolve = promiseCapability.resolve;
4947  resolve(x);
4948  return promiseCapability.promise;
4949};
4950
4951/***/ }),
4952/* 102 */
4953/***/ (function(module, exports, __w_pdfjs_require__) {
4954
4955"use strict";
4956
4957
4958var redefine = __w_pdfjs_require__(24);
4959
4960module.exports = function (target, src, safe) {
4961  for (var key in src) {
4962    redefine(target, key, src[key], safe);
4963  }
4964
4965  return target;
4966};
4967
4968/***/ }),
4969/* 103 */
4970/***/ (function(module, exports, __w_pdfjs_require__) {
4971
4972"use strict";
4973
4974
4975var global = __w_pdfjs_require__(12);
4976
4977var dP = __w_pdfjs_require__(15);
4978
4979var DESCRIPTORS = __w_pdfjs_require__(19);
4980
4981var SPECIES = __w_pdfjs_require__(37)('species');
4982
4983module.exports = function (KEY) {
4984  var C = global[KEY];
4985  if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, {
4986    configurable: true,
4987    get: function get() {
4988      return this;
4989    }
4990  });
4991};
4992
4993/***/ }),
4994/* 104 */
4995/***/ (function(module, exports, __w_pdfjs_require__) {
4996
4997"use strict";
4998
4999
5000var $export = __w_pdfjs_require__(11);
5001
5002var core = __w_pdfjs_require__(13);
5003
5004var global = __w_pdfjs_require__(12);
5005
5006var speciesConstructor = __w_pdfjs_require__(94);
5007
5008var promiseResolve = __w_pdfjs_require__(101);
5009
5010$export($export.P + $export.R, 'Promise', {
5011  'finally': function _finally(onFinally) {
5012    var C = speciesConstructor(this, core.Promise || global.Promise);
5013    var isFunction = typeof onFinally == 'function';
5014    return this.then(isFunction ? function (x) {
5015      return promiseResolve(C, onFinally()).then(function () {
5016        return x;
5017      });
5018    } : onFinally, isFunction ? function (e) {
5019      return promiseResolve(C, onFinally()).then(function () {
5020        throw e;
5021      });
5022    } : onFinally);
5023  }
5024});
5025
5026/***/ }),
5027/* 105 */
5028/***/ (function(module, exports, __w_pdfjs_require__) {
5029
5030"use strict";
5031
5032
5033var $export = __w_pdfjs_require__(11);
5034
5035var newPromiseCapability = __w_pdfjs_require__(98);
5036
5037var perform = __w_pdfjs_require__(99);
5038
5039$export($export.S, 'Promise', {
5040  'try': function _try(callbackfn) {
5041    var promiseCapability = newPromiseCapability.f(this);
5042    var result = perform(callbackfn);
5043    (result.e ? promiseCapability.reject : promiseCapability.resolve)(result.v);
5044    return promiseCapability.promise;
5045  }
5046});
5047
5048/***/ }),
5049/* 106 */
5050/***/ (function(module, exports, __w_pdfjs_require__) {
5051
5052"use strict";
5053
5054
5055__w_pdfjs_require__(87);
5056
5057__w_pdfjs_require__(88);
5058
5059__w_pdfjs_require__(107);
5060
5061__w_pdfjs_require__(119);
5062
5063__w_pdfjs_require__(121);
5064
5065module.exports = __w_pdfjs_require__(13).WeakMap;
5066
5067/***/ }),
5068/* 107 */
5069/***/ (function(module, exports, __w_pdfjs_require__) {
5070
5071"use strict";
5072
5073
5074var global = __w_pdfjs_require__(12);
5075
5076var each = __w_pdfjs_require__(108)(0);
5077
5078var redefine = __w_pdfjs_require__(24);
5079
5080var meta = __w_pdfjs_require__(112);
5081
5082var assign = __w_pdfjs_require__(76);
5083
5084var weak = __w_pdfjs_require__(113);
5085
5086var isObject = __w_pdfjs_require__(17);
5087
5088var validate = __w_pdfjs_require__(114);
5089
5090var NATIVE_WEAK_MAP = __w_pdfjs_require__(114);
5091
5092var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global;
5093var WEAK_MAP = 'WeakMap';
5094var getWeak = meta.getWeak;
5095var isExtensible = Object.isExtensible;
5096var uncaughtFrozenStore = weak.ufstore;
5097var InternalMap;
5098
5099var wrapper = function wrapper(get) {
5100  return function WeakMap() {
5101    return get(this, arguments.length > 0 ? arguments[0] : undefined);
5102  };
5103};
5104
5105var methods = {
5106  get: function get(key) {
5107    if (isObject(key)) {
5108      var data = getWeak(key);
5109      if (data === true) return uncaughtFrozenStore(validate(this, WEAK_MAP)).get(key);
5110      return data ? data[this._i] : undefined;
5111    }
5112  },
5113  set: function set(key, value) {
5114    return weak.def(validate(this, WEAK_MAP), key, value);
5115  }
5116};
5117
5118var $WeakMap = module.exports = __w_pdfjs_require__(115)(WEAK_MAP, wrapper, methods, weak, true, true);
5119
5120if (NATIVE_WEAK_MAP && IS_IE11) {
5121  InternalMap = weak.getConstructor(wrapper, WEAK_MAP);
5122  assign(InternalMap.prototype, methods);
5123  meta.NEED = true;
5124  each(['delete', 'has', 'get', 'set'], function (key) {
5125    var proto = $WeakMap.prototype;
5126    var method = proto[key];
5127    redefine(proto, key, function (a, b) {
5128      if (isObject(a) && !isExtensible(a)) {
5129        if (!this._f) this._f = new InternalMap();
5130
5131        var result = this._f[key](a, b);
5132
5133        return key == 'set' ? this : result;
5134      }
5135
5136      return method.call(this, a, b);
5137    });
5138  });
5139}
5140
5141/***/ }),
5142/* 108 */
5143/***/ (function(module, exports, __w_pdfjs_require__) {
5144
5145"use strict";
5146
5147
5148var ctx = __w_pdfjs_require__(30);
5149
5150var IObject = __w_pdfjs_require__(48);
5151
5152var toObject = __w_pdfjs_require__(66);
5153
5154var toLength = __w_pdfjs_require__(32);
5155
5156var asc = __w_pdfjs_require__(109);
5157
5158module.exports = function (TYPE, $create) {
5159  var IS_MAP = TYPE == 1;
5160  var IS_FILTER = TYPE == 2;
5161  var IS_SOME = TYPE == 3;
5162  var IS_EVERY = TYPE == 4;
5163  var IS_FIND_INDEX = TYPE == 6;
5164  var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
5165  var create = $create || asc;
5166  return function ($this, callbackfn, that) {
5167    var O = toObject($this);
5168    var self = IObject(O);
5169    var f = ctx(callbackfn, that, 3);
5170    var length = toLength(self.length);
5171    var index = 0;
5172    var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
5173    var val, res;
5174
5175    for (; length > index; index++) {
5176      if (NO_HOLES || index in self) {
5177        val = self[index];
5178        res = f(val, index, O);
5179
5180        if (TYPE) {
5181          if (IS_MAP) result[index] = res;else if (res) switch (TYPE) {
5182            case 3:
5183              return true;
5184
5185            case 5:
5186              return val;
5187
5188            case 6:
5189              return index;
5190
5191            case 2:
5192              result.push(val);
5193          } else if (IS_EVERY) return false;
5194        }
5195      }
5196    }
5197
5198    return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
5199  };
5200};
5201
5202/***/ }),
5203/* 109 */
5204/***/ (function(module, exports, __w_pdfjs_require__) {
5205
5206"use strict";
5207
5208
5209var speciesConstructor = __w_pdfjs_require__(110);
5210
5211module.exports = function (original, length) {
5212  return new (speciesConstructor(original))(length);
5213};
5214
5215/***/ }),
5216/* 110 */
5217/***/ (function(module, exports, __w_pdfjs_require__) {
5218
5219"use strict";
5220
5221
5222var isObject = __w_pdfjs_require__(17);
5223
5224var isArray = __w_pdfjs_require__(111);
5225
5226var SPECIES = __w_pdfjs_require__(37)('species');
5227
5228module.exports = function (original) {
5229  var C;
5230
5231  if (isArray(original)) {
5232    C = original.constructor;
5233    if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
5234
5235    if (isObject(C)) {
5236      C = C[SPECIES];
5237      if (C === null) C = undefined;
5238    }
5239  }
5240
5241  return C === undefined ? Array : C;
5242};
5243
5244/***/ }),
5245/* 111 */
5246/***/ (function(module, exports, __w_pdfjs_require__) {
5247
5248"use strict";
5249
5250
5251var cof = __w_pdfjs_require__(36);
5252
5253module.exports = Array.isArray || function isArray(arg) {
5254  return cof(arg) == 'Array';
5255};
5256
5257/***/ }),
5258/* 112 */
5259/***/ (function(module, exports, __w_pdfjs_require__) {
5260
5261"use strict";
5262
5263
5264function _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); }
5265
5266var META = __w_pdfjs_require__(26)('meta');
5267
5268var isObject = __w_pdfjs_require__(17);
5269
5270var has = __w_pdfjs_require__(25);
5271
5272var setDesc = __w_pdfjs_require__(15).f;
5273
5274var id = 0;
5275
5276var isExtensible = Object.isExtensible || function () {
5277  return true;
5278};
5279
5280var FREEZE = !__w_pdfjs_require__(20)(function () {
5281  return isExtensible(Object.preventExtensions({}));
5282});
5283
5284var setMeta = function setMeta(it) {
5285  setDesc(it, META, {
5286    value: {
5287      i: 'O' + ++id,
5288      w: {}
5289    }
5290  });
5291};
5292
5293var fastKey = function fastKey(it, create) {
5294  if (!isObject(it)) return _typeof(it) == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
5295
5296  if (!has(it, META)) {
5297    if (!isExtensible(it)) return 'F';
5298    if (!create) return 'E';
5299    setMeta(it);
5300  }
5301
5302  return it[META].i;
5303};
5304
5305var getWeak = function getWeak(it, create) {
5306  if (!has(it, META)) {
5307    if (!isExtensible(it)) return true;
5308    if (!create) return false;
5309    setMeta(it);
5310  }
5311
5312  return it[META].w;
5313};
5314
5315var onFreeze = function onFreeze(it) {
5316  if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);
5317  return it;
5318};
5319
5320var meta = module.exports = {
5321  KEY: META,
5322  NEED: false,
5323  fastKey: fastKey,
5324  getWeak: getWeak,
5325  onFreeze: onFreeze
5326};
5327
5328/***/ }),
5329/* 113 */
5330/***/ (function(module, exports, __w_pdfjs_require__) {
5331
5332"use strict";
5333
5334
5335var redefineAll = __w_pdfjs_require__(102);
5336
5337var getWeak = __w_pdfjs_require__(112).getWeak;
5338
5339var anObject = __w_pdfjs_require__(16);
5340
5341var isObject = __w_pdfjs_require__(17);
5342
5343var anInstance = __w_pdfjs_require__(92);
5344
5345var forOf = __w_pdfjs_require__(93);
5346
5347var createArrayMethod = __w_pdfjs_require__(108);
5348
5349var $has = __w_pdfjs_require__(25);
5350
5351var validate = __w_pdfjs_require__(114);
5352
5353var arrayFind = createArrayMethod(5);
5354var arrayFindIndex = createArrayMethod(6);
5355var id = 0;
5356
5357var uncaughtFrozenStore = function uncaughtFrozenStore(that) {
5358  return that._l || (that._l = new UncaughtFrozenStore());
5359};
5360
5361var UncaughtFrozenStore = function UncaughtFrozenStore() {
5362  this.a = [];
5363};
5364
5365var findUncaughtFrozen = function findUncaughtFrozen(store, key) {
5366  return arrayFind(store.a, function (it) {
5367    return it[0] === key;
5368  });
5369};
5370
5371UncaughtFrozenStore.prototype = {
5372  get: function get(key) {
5373    var entry = findUncaughtFrozen(this, key);
5374    if (entry) return entry[1];
5375  },
5376  has: function has(key) {
5377    return !!findUncaughtFrozen(this, key);
5378  },
5379  set: function set(key, value) {
5380    var entry = findUncaughtFrozen(this, key);
5381    if (entry) entry[1] = value;else this.a.push([key, value]);
5382  },
5383  'delete': function _delete(key) {
5384    var index = arrayFindIndex(this.a, function (it) {
5385      return it[0] === key;
5386    });
5387    if (~index) this.a.splice(index, 1);
5388    return !!~index;
5389  }
5390};
5391module.exports = {
5392  getConstructor: function getConstructor(wrapper, NAME, IS_MAP, ADDER) {
5393    var C = wrapper(function (that, iterable) {
5394      anInstance(that, C, NAME, '_i');
5395      that._t = NAME;
5396      that._i = id++;
5397      that._l = undefined;
5398      if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);
5399    });
5400    redefineAll(C.prototype, {
5401      'delete': function _delete(key) {
5402        if (!isObject(key)) return false;
5403        var data = getWeak(key);
5404        if (data === true) return uncaughtFrozenStore(validate(this, NAME))['delete'](key);
5405        return data && $has(data, this._i) && delete data[this._i];
5406      },
5407      has: function has(key) {
5408        if (!isObject(key)) return false;
5409        var data = getWeak(key);
5410        if (data === true) return uncaughtFrozenStore(validate(this, NAME)).has(key);
5411        return data && $has(data, this._i);
5412      }
5413    });
5414    return C;
5415  },
5416  def: function def(that, key, value) {
5417    var data = getWeak(anObject(key), true);
5418    if (data === true) uncaughtFrozenStore(that).set(key, value);else data[that._i] = value;
5419    return that;
5420  },
5421  ufstore: uncaughtFrozenStore
5422};
5423
5424/***/ }),
5425/* 114 */
5426/***/ (function(module, exports, __w_pdfjs_require__) {
5427
5428"use strict";
5429
5430
5431var isObject = __w_pdfjs_require__(17);
5432
5433module.exports = function (it, TYPE) {
5434  if (!isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!');
5435  return it;
5436};
5437
5438/***/ }),
5439/* 115 */
5440/***/ (function(module, exports, __w_pdfjs_require__) {
5441
5442"use strict";
5443
5444
5445var global = __w_pdfjs_require__(12);
5446
5447var $export = __w_pdfjs_require__(11);
5448
5449var redefine = __w_pdfjs_require__(24);
5450
5451var redefineAll = __w_pdfjs_require__(102);
5452
5453var meta = __w_pdfjs_require__(112);
5454
5455var forOf = __w_pdfjs_require__(93);
5456
5457var anInstance = __w_pdfjs_require__(92);
5458
5459var isObject = __w_pdfjs_require__(17);
5460
5461var fails = __w_pdfjs_require__(20);
5462
5463var $iterDetect = __w_pdfjs_require__(73);
5464
5465var setToStringTag = __w_pdfjs_require__(64);
5466
5467var inheritIfRequired = __w_pdfjs_require__(116);
5468
5469module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) {
5470  var Base = global[NAME];
5471  var C = Base;
5472  var ADDER = IS_MAP ? 'set' : 'add';
5473  var proto = C && C.prototype;
5474  var O = {};
5475
5476  var fixMethod = function fixMethod(KEY) {
5477    var fn = proto[KEY];
5478    redefine(proto, KEY, KEY == 'delete' ? function (a) {
5479      return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
5480    } : KEY == 'has' ? function has(a) {
5481      return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
5482    } : KEY == 'get' ? function get(a) {
5483      return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a);
5484    } : KEY == 'add' ? function add(a) {
5485      fn.call(this, a === 0 ? 0 : a);
5486      return this;
5487    } : function set(a, b) {
5488      fn.call(this, a === 0 ? 0 : a, b);
5489      return this;
5490    });
5491  };
5492
5493  if (typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function () {
5494    new C().entries().next();
5495  }))) {
5496    C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
5497    redefineAll(C.prototype, methods);
5498    meta.NEED = true;
5499  } else {
5500    var instance = new C();
5501    var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;
5502    var THROWS_ON_PRIMITIVES = fails(function () {
5503      instance.has(1);
5504    });
5505    var ACCEPT_ITERABLES = $iterDetect(function (iter) {
5506      new C(iter);
5507    });
5508    var BUGGY_ZERO = !IS_WEAK && fails(function () {
5509      var $instance = new C();
5510      var index = 5;
5511
5512      while (index--) {
5513        $instance[ADDER](index, index);
5514      }
5515
5516      return !$instance.has(-0);
5517    });
5518
5519    if (!ACCEPT_ITERABLES) {
5520      C = wrapper(function (target, iterable) {
5521        anInstance(target, C, NAME);
5522        var that = inheritIfRequired(new Base(), target, C);
5523        if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);
5524        return that;
5525      });
5526      C.prototype = proto;
5527      proto.constructor = C;
5528    }
5529
5530    if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {
5531      fixMethod('delete');
5532      fixMethod('has');
5533      IS_MAP && fixMethod('get');
5534    }
5535
5536    if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER);
5537    if (IS_WEAK && proto.clear) delete proto.clear;
5538  }
5539
5540  setToStringTag(C, NAME);
5541  O[NAME] = C;
5542  $export($export.G + $export.W + $export.F * (C != Base), O);
5543  if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP);
5544  return C;
5545};
5546
5547/***/ }),
5548/* 116 */
5549/***/ (function(module, exports, __w_pdfjs_require__) {
5550
5551"use strict";
5552
5553
5554var isObject = __w_pdfjs_require__(17);
5555
5556var setPrototypeOf = __w_pdfjs_require__(117).set;
5557
5558module.exports = function (that, target, C) {
5559  var S = target.constructor;
5560  var P;
5561
5562  if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf) {
5563    setPrototypeOf(that, P);
5564  }
5565
5566  return that;
5567};
5568
5569/***/ }),
5570/* 117 */
5571/***/ (function(module, exports, __w_pdfjs_require__) {
5572
5573"use strict";
5574
5575
5576var isObject = __w_pdfjs_require__(17);
5577
5578var anObject = __w_pdfjs_require__(16);
5579
5580var check = function check(O, proto) {
5581  anObject(O);
5582  if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!");
5583};
5584
5585module.exports = {
5586  set: Object.setPrototypeOf || ('__proto__' in {} ? function (test, buggy, set) {
5587    try {
5588      set = __w_pdfjs_require__(30)(Function.call, __w_pdfjs_require__(118).f(Object.prototype, '__proto__').set, 2);
5589      set(test, []);
5590      buggy = !(test instanceof Array);
5591    } catch (e) {
5592      buggy = true;
5593    }
5594
5595    return function setPrototypeOf(O, proto) {
5596      check(O, proto);
5597      if (buggy) O.__proto__ = proto;else set(O, proto);
5598      return O;
5599    };
5600  }({}, false) : undefined),
5601  check: check
5602};
5603
5604/***/ }),
5605/* 118 */
5606/***/ (function(module, exports, __w_pdfjs_require__) {
5607
5608"use strict";
5609
5610
5611var pIE = __w_pdfjs_require__(78);
5612
5613var createDesc = __w_pdfjs_require__(23);
5614
5615var toIObject = __w_pdfjs_require__(47);
5616
5617var toPrimitive = __w_pdfjs_require__(22);
5618
5619var has = __w_pdfjs_require__(25);
5620
5621var IE8_DOM_DEFINE = __w_pdfjs_require__(18);
5622
5623var gOPD = Object.getOwnPropertyDescriptor;
5624exports.f = __w_pdfjs_require__(19) ? gOPD : function getOwnPropertyDescriptor(O, P) {
5625  O = toIObject(O);
5626  P = toPrimitive(P, true);
5627  if (IE8_DOM_DEFINE) try {
5628    return gOPD(O, P);
5629  } catch (e) {}
5630  if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);
5631};
5632
5633/***/ }),
5634/* 119 */
5635/***/ (function(module, exports, __w_pdfjs_require__) {
5636
5637"use strict";
5638
5639
5640__w_pdfjs_require__(120)('WeakMap');
5641
5642/***/ }),
5643/* 120 */
5644/***/ (function(module, exports, __w_pdfjs_require__) {
5645
5646"use strict";
5647
5648
5649var $export = __w_pdfjs_require__(11);
5650
5651module.exports = function (COLLECTION) {
5652  $export($export.S, COLLECTION, {
5653    of: function of() {
5654      var length = arguments.length;
5655      var A = new Array(length);
5656
5657      while (length--) {
5658        A[length] = arguments[length];
5659      }
5660
5661      return new this(A);
5662    }
5663  });
5664};
5665
5666/***/ }),
5667/* 121 */
5668/***/ (function(module, exports, __w_pdfjs_require__) {
5669
5670"use strict";
5671
5672
5673__w_pdfjs_require__(122)('WeakMap');
5674
5675/***/ }),
5676/* 122 */
5677/***/ (function(module, exports, __w_pdfjs_require__) {
5678
5679"use strict";
5680
5681
5682var $export = __w_pdfjs_require__(11);
5683
5684var aFunction = __w_pdfjs_require__(31);
5685
5686var ctx = __w_pdfjs_require__(30);
5687
5688var forOf = __w_pdfjs_require__(93);
5689
5690module.exports = function (COLLECTION) {
5691  $export($export.S, COLLECTION, {
5692    from: function from(source) {
5693      var mapFn = arguments[1];
5694      var mapping, A, n, cb;
5695      aFunction(this);
5696      mapping = mapFn !== undefined;
5697      if (mapping) aFunction(mapFn);
5698      if (source == undefined) return new this();
5699      A = [];
5700
5701      if (mapping) {
5702        n = 0;
5703        cb = ctx(mapFn, arguments[2], 2);
5704        forOf(source, false, function (nextItem) {
5705          A.push(cb(nextItem, n++));
5706        });
5707      } else {
5708        forOf(source, false, A.push, A);
5709      }
5710
5711      return new this(A);
5712    }
5713  });
5714};
5715
5716/***/ }),
5717/* 123 */
5718/***/ (function(module, exports, __w_pdfjs_require__) {
5719
5720"use strict";
5721
5722
5723__w_pdfjs_require__(87);
5724
5725__w_pdfjs_require__(88);
5726
5727__w_pdfjs_require__(124);
5728
5729__w_pdfjs_require__(125);
5730
5731__w_pdfjs_require__(126);
5732
5733module.exports = __w_pdfjs_require__(13).WeakSet;
5734
5735/***/ }),
5736/* 124 */
5737/***/ (function(module, exports, __w_pdfjs_require__) {
5738
5739"use strict";
5740
5741
5742var weak = __w_pdfjs_require__(113);
5743
5744var validate = __w_pdfjs_require__(114);
5745
5746var WEAK_SET = 'WeakSet';
5747
5748__w_pdfjs_require__(115)(WEAK_SET, function (get) {
5749  return function WeakSet() {
5750    return get(this, arguments.length > 0 ? arguments[0] : undefined);
5751  };
5752}, {
5753  add: function add(value) {
5754    return weak.def(validate(this, WEAK_SET), value, true);
5755  }
5756}, weak, false, true);
5757
5758/***/ }),
5759/* 125 */
5760/***/ (function(module, exports, __w_pdfjs_require__) {
5761
5762"use strict";
5763
5764
5765__w_pdfjs_require__(120)('WeakSet');
5766
5767/***/ }),
5768/* 126 */
5769/***/ (function(module, exports, __w_pdfjs_require__) {
5770
5771"use strict";
5772
5773
5774__w_pdfjs_require__(122)('WeakSet');
5775
5776/***/ }),
5777/* 127 */
5778/***/ (function(module, exports, __w_pdfjs_require__) {
5779
5780"use strict";
5781
5782
5783__w_pdfjs_require__(128);
5784
5785module.exports = __w_pdfjs_require__(13).String.codePointAt;
5786
5787/***/ }),
5788/* 128 */
5789/***/ (function(module, exports, __w_pdfjs_require__) {
5790
5791"use strict";
5792
5793
5794var $export = __w_pdfjs_require__(11);
5795
5796var $at = __w_pdfjs_require__(53)(false);
5797
5798$export($export.P, 'String', {
5799  codePointAt: function codePointAt(pos) {
5800    return $at(this, pos);
5801  }
5802});
5803
5804/***/ }),
5805/* 129 */
5806/***/ (function(module, exports, __w_pdfjs_require__) {
5807
5808"use strict";
5809
5810
5811__w_pdfjs_require__(130);
5812
5813module.exports = __w_pdfjs_require__(13).String.fromCodePoint;
5814
5815/***/ }),
5816/* 130 */
5817/***/ (function(module, exports, __w_pdfjs_require__) {
5818
5819"use strict";
5820
5821
5822var $export = __w_pdfjs_require__(11);
5823
5824var toAbsoluteIndex = __w_pdfjs_require__(49);
5825
5826var fromCharCode = String.fromCharCode;
5827var $fromCodePoint = String.fromCodePoint;
5828$export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {
5829  fromCodePoint: function fromCodePoint(x) {
5830    var res = [];
5831    var aLen = arguments.length;
5832    var i = 0;
5833    var code;
5834
5835    while (aLen > i) {
5836      code = +arguments[i++];
5837      if (toAbsoluteIndex(code, 0x10ffff) !== code) throw RangeError(code + ' is not a valid code point');
5838      res.push(code < 0x10000 ? fromCharCode(code) : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00));
5839    }
5840
5841    return res.join('');
5842  }
5843});
5844
5845/***/ }),
5846/* 131 */
5847/***/ (function(module, exports, __w_pdfjs_require__) {
5848
5849"use strict";
5850
5851
5852__w_pdfjs_require__(132);
5853
5854__w_pdfjs_require__(87);
5855
5856module.exports = __w_pdfjs_require__(13).Symbol;
5857
5858/***/ }),
5859/* 132 */
5860/***/ (function(module, exports, __w_pdfjs_require__) {
5861
5862"use strict";
5863
5864
5865function _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); }
5866
5867var global = __w_pdfjs_require__(12);
5868
5869var has = __w_pdfjs_require__(25);
5870
5871var DESCRIPTORS = __w_pdfjs_require__(19);
5872
5873var $export = __w_pdfjs_require__(11);
5874
5875var redefine = __w_pdfjs_require__(24);
5876
5877var META = __w_pdfjs_require__(112).KEY;
5878
5879var $fails = __w_pdfjs_require__(20);
5880
5881var shared = __w_pdfjs_require__(28);
5882
5883var setToStringTag = __w_pdfjs_require__(64);
5884
5885var uid = __w_pdfjs_require__(26);
5886
5887var wks = __w_pdfjs_require__(37);
5888
5889var wksExt = __w_pdfjs_require__(133);
5890
5891var wksDefine = __w_pdfjs_require__(134);
5892
5893var enumKeys = __w_pdfjs_require__(135);
5894
5895var isArray = __w_pdfjs_require__(111);
5896
5897var anObject = __w_pdfjs_require__(16);
5898
5899var isObject = __w_pdfjs_require__(17);
5900
5901var toObject = __w_pdfjs_require__(66);
5902
5903var toIObject = __w_pdfjs_require__(47);
5904
5905var toPrimitive = __w_pdfjs_require__(22);
5906
5907var createDesc = __w_pdfjs_require__(23);
5908
5909var _create = __w_pdfjs_require__(57);
5910
5911var gOPNExt = __w_pdfjs_require__(136);
5912
5913var $GOPD = __w_pdfjs_require__(118);
5914
5915var $GOPS = __w_pdfjs_require__(77);
5916
5917var $DP = __w_pdfjs_require__(15);
5918
5919var $keys = __w_pdfjs_require__(59);
5920
5921var gOPD = $GOPD.f;
5922var dP = $DP.f;
5923var gOPN = gOPNExt.f;
5924var $Symbol = global.Symbol;
5925var $JSON = global.JSON;
5926
5927var _stringify = $JSON && $JSON.stringify;
5928
5929var PROTOTYPE = 'prototype';
5930var HIDDEN = wks('_hidden');
5931var TO_PRIMITIVE = wks('toPrimitive');
5932var isEnum = {}.propertyIsEnumerable;
5933var SymbolRegistry = shared('symbol-registry');
5934var AllSymbols = shared('symbols');
5935var OPSymbols = shared('op-symbols');
5936var ObjectProto = Object[PROTOTYPE];
5937var USE_NATIVE = typeof $Symbol == 'function' && !!$GOPS.f;
5938var QObject = global.QObject;
5939var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
5940var setSymbolDesc = DESCRIPTORS && $fails(function () {
5941  return _create(dP({}, 'a', {
5942    get: function get() {
5943      return dP(this, 'a', {
5944        value: 7
5945      }).a;
5946    }
5947  })).a != 7;
5948}) ? function (it, key, D) {
5949  var protoDesc = gOPD(ObjectProto, key);
5950  if (protoDesc) delete ObjectProto[key];
5951  dP(it, key, D);
5952  if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc);
5953} : dP;
5954
5955var wrap = function wrap(tag) {
5956  var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
5957
5958  sym._k = tag;
5959  return sym;
5960};
5961
5962var isSymbol = USE_NATIVE && _typeof($Symbol.iterator) == 'symbol' ? function (it) {
5963  return _typeof(it) == 'symbol';
5964} : function (it) {
5965  return it instanceof $Symbol;
5966};
5967
5968var $defineProperty = function defineProperty(it, key, D) {
5969  if (it === ObjectProto) $defineProperty(OPSymbols, key, D);
5970  anObject(it);
5971  key = toPrimitive(key, true);
5972  anObject(D);
5973
5974  if (has(AllSymbols, key)) {
5975    if (!D.enumerable) {
5976      if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {}));
5977      it[HIDDEN][key] = true;
5978    } else {
5979      if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;
5980      D = _create(D, {
5981        enumerable: createDesc(0, false)
5982      });
5983    }
5984
5985    return setSymbolDesc(it, key, D);
5986  }
5987
5988  return dP(it, key, D);
5989};
5990
5991var $defineProperties = function defineProperties(it, P) {
5992  anObject(it);
5993  var keys = enumKeys(P = toIObject(P));
5994  var i = 0;
5995  var l = keys.length;
5996  var key;
5997
5998  while (l > i) {
5999    $defineProperty(it, key = keys[i++], P[key]);
6000  }
6001
6002  return it;
6003};
6004
6005var $create = function create(it, P) {
6006  return P === undefined ? _create(it) : $defineProperties(_create(it), P);
6007};
6008
6009var $propertyIsEnumerable = function propertyIsEnumerable(key) {
6010  var E = isEnum.call(this, key = toPrimitive(key, true));
6011  if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false;
6012  return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
6013};
6014
6015var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {
6016  it = toIObject(it);
6017  key = toPrimitive(key, true);
6018  if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return;
6019  var D = gOPD(it, key);
6020  if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;
6021  return D;
6022};
6023
6024var $getOwnPropertyNames = function getOwnPropertyNames(it) {
6025  var names = gOPN(toIObject(it));
6026  var result = [];
6027  var i = 0;
6028  var key;
6029
6030  while (names.length > i) {
6031    if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);
6032  }
6033
6034  return result;
6035};
6036
6037var $getOwnPropertySymbols = function getOwnPropertySymbols(it) {
6038  var IS_OP = it === ObjectProto;
6039  var names = gOPN(IS_OP ? OPSymbols : toIObject(it));
6040  var result = [];
6041  var i = 0;
6042  var key;
6043
6044  while (names.length > i) {
6045    if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]);
6046  }
6047
6048  return result;
6049};
6050
6051if (!USE_NATIVE) {
6052  $Symbol = function _Symbol() {
6053    if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');
6054    var tag = uid(arguments.length > 0 ? arguments[0] : undefined);
6055
6056    var $set = function $set(value) {
6057      if (this === ObjectProto) $set.call(OPSymbols, value);
6058      if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
6059      setSymbolDesc(this, tag, createDesc(1, value));
6060    };
6061
6062    if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, {
6063      configurable: true,
6064      set: $set
6065    });
6066    return wrap(tag);
6067  };
6068
6069  redefine($Symbol[PROTOTYPE], 'toString', function toString() {
6070    return this._k;
6071  });
6072  $GOPD.f = $getOwnPropertyDescriptor;
6073  $DP.f = $defineProperty;
6074  __w_pdfjs_require__(137).f = gOPNExt.f = $getOwnPropertyNames;
6075  __w_pdfjs_require__(78).f = $propertyIsEnumerable;
6076  $GOPS.f = $getOwnPropertySymbols;
6077
6078  if (DESCRIPTORS && !__w_pdfjs_require__(29)) {
6079    redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
6080  }
6081
6082  wksExt.f = function (name) {
6083    return wrap(wks(name));
6084  };
6085}
6086
6087$export($export.G + $export.W + $export.F * !USE_NATIVE, {
6088  Symbol: $Symbol
6089});
6090
6091for (var es6Symbols = 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'.split(','), j = 0; es6Symbols.length > j;) {
6092  wks(es6Symbols[j++]);
6093}
6094
6095for (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) {
6096  wksDefine(wellKnownSymbols[k++]);
6097}
6098
6099$export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
6100  'for': function _for(key) {
6101    return has(SymbolRegistry, key += '') ? SymbolRegistry[key] : SymbolRegistry[key] = $Symbol(key);
6102  },
6103  keyFor: function keyFor(sym) {
6104    if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');
6105
6106    for (var key in SymbolRegistry) {
6107      if (SymbolRegistry[key] === sym) return key;
6108    }
6109  },
6110  useSetter: function useSetter() {
6111    setter = true;
6112  },
6113  useSimple: function useSimple() {
6114    setter = false;
6115  }
6116});
6117$export($export.S + $export.F * !USE_NATIVE, 'Object', {
6118  create: $create,
6119  defineProperty: $defineProperty,
6120  defineProperties: $defineProperties,
6121  getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
6122  getOwnPropertyNames: $getOwnPropertyNames,
6123  getOwnPropertySymbols: $getOwnPropertySymbols
6124});
6125var FAILS_ON_PRIMITIVES = $fails(function () {
6126  $GOPS.f(1);
6127});
6128$export($export.S + $export.F * FAILS_ON_PRIMITIVES, 'Object', {
6129  getOwnPropertySymbols: function getOwnPropertySymbols(it) {
6130    return $GOPS.f(toObject(it));
6131  }
6132});
6133$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () {
6134  var S = $Symbol();
6135  return _stringify([S]) != '[null]' || _stringify({
6136    a: S
6137  }) != '{}' || _stringify(Object(S)) != '{}';
6138})), 'JSON', {
6139  stringify: function stringify(it) {
6140    var args = [it];
6141    var i = 1;
6142    var replacer, $replacer;
6143
6144    while (arguments.length > i) {
6145      args.push(arguments[i++]);
6146    }
6147
6148    $replacer = replacer = args[1];
6149    if (!isObject(replacer) && it === undefined || isSymbol(it)) return;
6150    if (!isArray(replacer)) replacer = function replacer(key, value) {
6151      if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
6152      if (!isSymbol(value)) return value;
6153    };
6154    args[1] = replacer;
6155    return _stringify.apply($JSON, args);
6156  }
6157});
6158$Symbol[PROTOTYPE][TO_PRIMITIVE] || __w_pdfjs_require__(14)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
6159setToStringTag($Symbol, 'Symbol');
6160setToStringTag(Math, 'Math', true);
6161setToStringTag(global.JSON, 'JSON', true);
6162
6163/***/ }),
6164/* 133 */
6165/***/ (function(module, exports, __w_pdfjs_require__) {
6166
6167"use strict";
6168
6169
6170exports.f = __w_pdfjs_require__(37);
6171
6172/***/ }),
6173/* 134 */
6174/***/ (function(module, exports, __w_pdfjs_require__) {
6175
6176"use strict";
6177
6178
6179var global = __w_pdfjs_require__(12);
6180
6181var core = __w_pdfjs_require__(13);
6182
6183var LIBRARY = __w_pdfjs_require__(29);
6184
6185var wksExt = __w_pdfjs_require__(133);
6186
6187var defineProperty = __w_pdfjs_require__(15).f;
6188
6189module.exports = function (name) {
6190  var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
6191  if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, {
6192    value: wksExt.f(name)
6193  });
6194};
6195
6196/***/ }),
6197/* 135 */
6198/***/ (function(module, exports, __w_pdfjs_require__) {
6199
6200"use strict";
6201
6202
6203var getKeys = __w_pdfjs_require__(59);
6204
6205var gOPS = __w_pdfjs_require__(77);
6206
6207var pIE = __w_pdfjs_require__(78);
6208
6209module.exports = function (it) {
6210  var result = getKeys(it);
6211  var getSymbols = gOPS.f;
6212
6213  if (getSymbols) {
6214    var symbols = getSymbols(it);
6215    var isEnum = pIE.f;
6216    var i = 0;
6217    var key;
6218
6219    while (symbols.length > i) {
6220      if (isEnum.call(it, key = symbols[i++])) result.push(key);
6221    }
6222  }
6223
6224  return result;
6225};
6226
6227/***/ }),
6228/* 136 */
6229/***/ (function(module, exports, __w_pdfjs_require__) {
6230
6231"use strict";
6232
6233
6234function _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); }
6235
6236var toIObject = __w_pdfjs_require__(47);
6237
6238var gOPN = __w_pdfjs_require__(137).f;
6239
6240var toString = {}.toString;
6241var windowNames = (typeof window === "undefined" ? "undefined" : _typeof(window)) == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
6242
6243var getWindowNames = function getWindowNames(it) {
6244  try {
6245    return gOPN(it);
6246  } catch (e) {
6247    return windowNames.slice();
6248  }
6249};
6250
6251module.exports.f = function getOwnPropertyNames(it) {
6252  return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
6253};
6254
6255/***/ }),
6256/* 137 */
6257/***/ (function(module, exports, __w_pdfjs_require__) {
6258
6259"use strict";
6260
6261
6262var $keys = __w_pdfjs_require__(60);
6263
6264var hiddenKeys = __w_pdfjs_require__(62).concat('length', 'prototype');
6265
6266exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
6267  return $keys(O, hiddenKeys);
6268};
6269
6270/***/ }),
6271/* 138 */
6272/***/ (function(module, exports, __w_pdfjs_require__) {
6273
6274"use strict";
6275
6276
6277__w_pdfjs_require__(139);
6278
6279module.exports = __w_pdfjs_require__(13).String.padStart;
6280
6281/***/ }),
6282/* 139 */
6283/***/ (function(module, exports, __w_pdfjs_require__) {
6284
6285"use strict";
6286
6287
6288var $export = __w_pdfjs_require__(11);
6289
6290var $pad = __w_pdfjs_require__(140);
6291
6292var userAgent = __w_pdfjs_require__(100);
6293
6294var WEBKIT_BUG = /Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(userAgent);
6295$export($export.P + $export.F * WEBKIT_BUG, 'String', {
6296  padStart: function padStart(maxLength) {
6297    return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true);
6298  }
6299});
6300
6301/***/ }),
6302/* 140 */
6303/***/ (function(module, exports, __w_pdfjs_require__) {
6304
6305"use strict";
6306
6307
6308var toLength = __w_pdfjs_require__(32);
6309
6310var repeat = __w_pdfjs_require__(141);
6311
6312var defined = __w_pdfjs_require__(38);
6313
6314module.exports = function (that, maxLength, fillString, left) {
6315  var S = String(defined(that));
6316  var stringLength = S.length;
6317  var fillStr = fillString === undefined ? ' ' : String(fillString);
6318  var intMaxLength = toLength(maxLength);
6319  if (intMaxLength <= stringLength || fillStr == '') return S;
6320  var fillLen = intMaxLength - stringLength;
6321  var stringFiller = repeat.call(fillStr, Math.ceil(fillLen / fillStr.length));
6322  if (stringFiller.length > fillLen) stringFiller = stringFiller.slice(0, fillLen);
6323  return left ? stringFiller + S : S + stringFiller;
6324};
6325
6326/***/ }),
6327/* 141 */
6328/***/ (function(module, exports, __w_pdfjs_require__) {
6329
6330"use strict";
6331
6332
6333var toInteger = __w_pdfjs_require__(33);
6334
6335var defined = __w_pdfjs_require__(38);
6336
6337module.exports = function repeat(count) {
6338  var str = String(defined(this));
6339  var res = '';
6340  var n = toInteger(count);
6341  if (n < 0 || n == Infinity) throw RangeError("Count can't be negative");
6342
6343  for (; n > 0; (n >>>= 1) && (str += str)) {
6344    if (n & 1) res += str;
6345  }
6346
6347  return res;
6348};
6349
6350/***/ }),
6351/* 142 */
6352/***/ (function(module, exports, __w_pdfjs_require__) {
6353
6354"use strict";
6355
6356
6357__w_pdfjs_require__(143);
6358
6359module.exports = __w_pdfjs_require__(13).String.padEnd;
6360
6361/***/ }),
6362/* 143 */
6363/***/ (function(module, exports, __w_pdfjs_require__) {
6364
6365"use strict";
6366
6367
6368var $export = __w_pdfjs_require__(11);
6369
6370var $pad = __w_pdfjs_require__(140);
6371
6372var userAgent = __w_pdfjs_require__(100);
6373
6374var WEBKIT_BUG = /Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(userAgent);
6375$export($export.P + $export.F * WEBKIT_BUG, 'String', {
6376  padEnd: function padEnd(maxLength) {
6377    return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false);
6378  }
6379});
6380
6381/***/ }),
6382/* 144 */
6383/***/ (function(module, exports, __w_pdfjs_require__) {
6384
6385"use strict";
6386
6387
6388__w_pdfjs_require__(145);
6389
6390module.exports = __w_pdfjs_require__(13).Object.values;
6391
6392/***/ }),
6393/* 145 */
6394/***/ (function(module, exports, __w_pdfjs_require__) {
6395
6396"use strict";
6397
6398
6399var $export = __w_pdfjs_require__(11);
6400
6401var $values = __w_pdfjs_require__(146)(false);
6402
6403$export($export.S, 'Object', {
6404  values: function values(it) {
6405    return $values(it);
6406  }
6407});
6408
6409/***/ }),
6410/* 146 */
6411/***/ (function(module, exports, __w_pdfjs_require__) {
6412
6413"use strict";
6414
6415
6416var DESCRIPTORS = __w_pdfjs_require__(19);
6417
6418var getKeys = __w_pdfjs_require__(59);
6419
6420var toIObject = __w_pdfjs_require__(47);
6421
6422var isEnum = __w_pdfjs_require__(78).f;
6423
6424module.exports = function (isEntries) {
6425  return function (it) {
6426    var O = toIObject(it);
6427    var keys = getKeys(O);
6428    var length = keys.length;
6429    var i = 0;
6430    var result = [];
6431    var key;
6432
6433    while (length > i) {
6434      key = keys[i++];
6435
6436      if (!DESCRIPTORS || isEnum.call(O, key)) {
6437        result.push(isEntries ? [key, O[key]] : O[key]);
6438      }
6439    }
6440
6441    return result;
6442  };
6443};
6444
6445/***/ }),
6446/* 147 */
6447/***/ (function(module, exports, __w_pdfjs_require__) {
6448
6449"use strict";
6450
6451
6452{
6453  var isReadableStreamSupported = false;
6454
6455  if (typeof ReadableStream !== 'undefined') {
6456    try {
6457      new ReadableStream({
6458        start: function start(controller) {
6459          controller.close();
6460        }
6461      });
6462      isReadableStreamSupported = true;
6463    } catch (e) {}
6464  }
6465
6466  if (isReadableStreamSupported) {
6467    exports.ReadableStream = ReadableStream;
6468  } else {
6469    exports.ReadableStream = __w_pdfjs_require__(148).ReadableStream;
6470  }
6471}
6472
6473/***/ }),
6474/* 148 */
6475/***/ (function(module, exports, __w_pdfjs_require__) {
6476
6477"use strict";
6478
6479
6480function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
6481
6482(function (e, a) {
6483  for (var i in a) {
6484    e[i] = a[i];
6485  }
6486})(exports, function (modules) {
6487  var installedModules = {};
6488
6489  function __w_pdfjs_require__(moduleId) {
6490    if (installedModules[moduleId]) return installedModules[moduleId].exports;
6491    var module = installedModules[moduleId] = {
6492      i: moduleId,
6493      l: false,
6494      exports: {}
6495    };
6496    modules[moduleId].call(module.exports, module, module.exports, __w_pdfjs_require__);
6497    module.l = true;
6498    return module.exports;
6499  }
6500
6501  __w_pdfjs_require__.m = modules;
6502  __w_pdfjs_require__.c = installedModules;
6503
6504  __w_pdfjs_require__.i = function (value) {
6505    return value;
6506  };
6507
6508  __w_pdfjs_require__.d = function (exports, name, getter) {
6509    if (!__w_pdfjs_require__.o(exports, name)) {
6510      Object.defineProperty(exports, name, {
6511        configurable: false,
6512        enumerable: true,
6513        get: getter
6514      });
6515    }
6516  };
6517
6518  __w_pdfjs_require__.n = function (module) {
6519    var getter = module && module.__esModule ? function getDefault() {
6520      return module['default'];
6521    } : function getModuleExports() {
6522      return module;
6523    };
6524
6525    __w_pdfjs_require__.d(getter, 'a', getter);
6526
6527    return getter;
6528  };
6529
6530  __w_pdfjs_require__.o = function (object, property) {
6531    return Object.prototype.hasOwnProperty.call(object, property);
6532  };
6533
6534  __w_pdfjs_require__.p = "";
6535  return __w_pdfjs_require__(__w_pdfjs_require__.s = 7);
6536}([function (module, exports, __w_pdfjs_require__) {
6537  "use strict";
6538
6539  var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
6540    return _typeof2(obj);
6541  } : function (obj) {
6542    return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj);
6543  };
6544
6545  var _require = __w_pdfjs_require__(1),
6546      assert = _require.assert;
6547
6548  function IsPropertyKey(argument) {
6549    return typeof argument === 'string' || (typeof argument === 'undefined' ? 'undefined' : _typeof(argument)) === 'symbol';
6550  }
6551
6552  exports.typeIsObject = function (x) {
6553    return (typeof x === 'undefined' ? 'undefined' : _typeof(x)) === 'object' && x !== null || typeof x === 'function';
6554  };
6555
6556  exports.createDataProperty = function (o, p, v) {
6557    assert(exports.typeIsObject(o));
6558    Object.defineProperty(o, p, {
6559      value: v,
6560      writable: true,
6561      enumerable: true,
6562      configurable: true
6563    });
6564  };
6565
6566  exports.createArrayFromList = function (elements) {
6567    return elements.slice();
6568  };
6569
6570  exports.ArrayBufferCopy = function (dest, destOffset, src, srcOffset, n) {
6571    new Uint8Array(dest).set(new Uint8Array(src, srcOffset, n), destOffset);
6572  };
6573
6574  exports.CreateIterResultObject = function (value, done) {
6575    assert(typeof done === 'boolean');
6576    var obj = {};
6577    Object.defineProperty(obj, 'value', {
6578      value: value,
6579      enumerable: true,
6580      writable: true,
6581      configurable: true
6582    });
6583    Object.defineProperty(obj, 'done', {
6584      value: done,
6585      enumerable: true,
6586      writable: true,
6587      configurable: true
6588    });
6589    return obj;
6590  };
6591
6592  exports.IsFiniteNonNegativeNumber = function (v) {
6593    if (Number.isNaN(v)) {
6594      return false;
6595    }
6596
6597    if (v === Infinity) {
6598      return false;
6599    }
6600
6601    if (v < 0) {
6602      return false;
6603    }
6604
6605    return true;
6606  };
6607
6608  function Call(F, V, args) {
6609    if (typeof F !== 'function') {
6610      throw new TypeError('Argument is not a function');
6611    }
6612
6613    return Function.prototype.apply.call(F, V, args);
6614  }
6615
6616  exports.InvokeOrNoop = function (O, P, args) {
6617    assert(O !== undefined);
6618    assert(IsPropertyKey(P));
6619    assert(Array.isArray(args));
6620    var method = O[P];
6621
6622    if (method === undefined) {
6623      return undefined;
6624    }
6625
6626    return Call(method, O, args);
6627  };
6628
6629  exports.PromiseInvokeOrNoop = function (O, P, args) {
6630    assert(O !== undefined);
6631    assert(IsPropertyKey(P));
6632    assert(Array.isArray(args));
6633
6634    try {
6635      return Promise.resolve(exports.InvokeOrNoop(O, P, args));
6636    } catch (returnValueE) {
6637      return Promise.reject(returnValueE);
6638    }
6639  };
6640
6641  exports.PromiseInvokeOrPerformFallback = function (O, P, args, F, argsF) {
6642    assert(O !== undefined);
6643    assert(IsPropertyKey(P));
6644    assert(Array.isArray(args));
6645    assert(Array.isArray(argsF));
6646    var method = void 0;
6647
6648    try {
6649      method = O[P];
6650    } catch (methodE) {
6651      return Promise.reject(methodE);
6652    }
6653
6654    if (method === undefined) {
6655      return F.apply(null, argsF);
6656    }
6657
6658    try {
6659      return Promise.resolve(Call(method, O, args));
6660    } catch (e) {
6661      return Promise.reject(e);
6662    }
6663  };
6664
6665  exports.TransferArrayBuffer = function (O) {
6666    return O.slice();
6667  };
6668
6669  exports.ValidateAndNormalizeHighWaterMark = function (highWaterMark) {
6670    highWaterMark = Number(highWaterMark);
6671
6672    if (Number.isNaN(highWaterMark) || highWaterMark < 0) {
6673      throw new RangeError('highWaterMark property of a queuing strategy must be non-negative and non-NaN');
6674    }
6675
6676    return highWaterMark;
6677  };
6678
6679  exports.ValidateAndNormalizeQueuingStrategy = function (size, highWaterMark) {
6680    if (size !== undefined && typeof size !== 'function') {
6681      throw new TypeError('size property of a queuing strategy must be a function');
6682    }
6683
6684    highWaterMark = exports.ValidateAndNormalizeHighWaterMark(highWaterMark);
6685    return {
6686      size: size,
6687      highWaterMark: highWaterMark
6688    };
6689  };
6690}, function (module, exports, __w_pdfjs_require__) {
6691  "use strict";
6692
6693  function rethrowAssertionErrorRejection(e) {
6694    if (e && e.constructor === AssertionError) {
6695      setTimeout(function () {
6696        throw e;
6697      }, 0);
6698    }
6699  }
6700
6701  function AssertionError(message) {
6702    this.name = 'AssertionError';
6703    this.message = message || '';
6704    this.stack = new Error().stack;
6705  }
6706
6707  AssertionError.prototype = Object.create(Error.prototype);
6708  AssertionError.prototype.constructor = AssertionError;
6709
6710  function assert(value, message) {
6711    if (!value) {
6712      throw new AssertionError(message);
6713    }
6714  }
6715
6716  module.exports = {
6717    rethrowAssertionErrorRejection: rethrowAssertionErrorRejection,
6718    AssertionError: AssertionError,
6719    assert: assert
6720  };
6721}, function (module, exports, __w_pdfjs_require__) {
6722  "use strict";
6723
6724  var _createClass = function () {
6725    function defineProperties(target, props) {
6726      for (var i = 0; i < props.length; i++) {
6727        var descriptor = props[i];
6728        descriptor.enumerable = descriptor.enumerable || false;
6729        descriptor.configurable = true;
6730        if ("value" in descriptor) descriptor.writable = true;
6731        Object.defineProperty(target, descriptor.key, descriptor);
6732      }
6733    }
6734
6735    return function (Constructor, protoProps, staticProps) {
6736      if (protoProps) defineProperties(Constructor.prototype, protoProps);
6737      if (staticProps) defineProperties(Constructor, staticProps);
6738      return Constructor;
6739    };
6740  }();
6741
6742  function _classCallCheck(instance, Constructor) {
6743    if (!(instance instanceof Constructor)) {
6744      throw new TypeError("Cannot call a class as a function");
6745    }
6746  }
6747
6748  var _require = __w_pdfjs_require__(0),
6749      InvokeOrNoop = _require.InvokeOrNoop,
6750      PromiseInvokeOrNoop = _require.PromiseInvokeOrNoop,
6751      ValidateAndNormalizeQueuingStrategy = _require.ValidateAndNormalizeQueuingStrategy,
6752      typeIsObject = _require.typeIsObject;
6753
6754  var _require2 = __w_pdfjs_require__(1),
6755      assert = _require2.assert,
6756      rethrowAssertionErrorRejection = _require2.rethrowAssertionErrorRejection;
6757
6758  var _require3 = __w_pdfjs_require__(3),
6759      DequeueValue = _require3.DequeueValue,
6760      EnqueueValueWithSize = _require3.EnqueueValueWithSize,
6761      PeekQueueValue = _require3.PeekQueueValue,
6762      ResetQueue = _require3.ResetQueue;
6763
6764  var WritableStream = function () {
6765    function WritableStream() {
6766      var underlyingSink = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6767
6768      var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
6769          size = _ref.size,
6770          _ref$highWaterMark = _ref.highWaterMark,
6771          highWaterMark = _ref$highWaterMark === undefined ? 1 : _ref$highWaterMark;
6772
6773      _classCallCheck(this, WritableStream);
6774
6775      this._state = 'writable';
6776      this._storedError = undefined;
6777      this._writer = undefined;
6778      this._writableStreamController = undefined;
6779      this._writeRequests = [];
6780      this._inFlightWriteRequest = undefined;
6781      this._closeRequest = undefined;
6782      this._inFlightCloseRequest = undefined;
6783      this._pendingAbortRequest = undefined;
6784      this._backpressure = false;
6785      var type = underlyingSink.type;
6786
6787      if (type !== undefined) {
6788        throw new RangeError('Invalid type is specified');
6789      }
6790
6791      this._writableStreamController = new WritableStreamDefaultController(this, underlyingSink, size, highWaterMark);
6792
6793      this._writableStreamController.__startSteps();
6794    }
6795
6796    _createClass(WritableStream, [{
6797      key: 'abort',
6798      value: function abort(reason) {
6799        if (IsWritableStream(this) === false) {
6800          return Promise.reject(streamBrandCheckException('abort'));
6801        }
6802
6803        if (IsWritableStreamLocked(this) === true) {
6804          return Promise.reject(new TypeError('Cannot abort a stream that already has a writer'));
6805        }
6806
6807        return WritableStreamAbort(this, reason);
6808      }
6809    }, {
6810      key: 'getWriter',
6811      value: function getWriter() {
6812        if (IsWritableStream(this) === false) {
6813          throw streamBrandCheckException('getWriter');
6814        }
6815
6816        return AcquireWritableStreamDefaultWriter(this);
6817      }
6818    }, {
6819      key: 'locked',
6820      get: function get() {
6821        if (IsWritableStream(this) === false) {
6822          throw streamBrandCheckException('locked');
6823        }
6824
6825        return IsWritableStreamLocked(this);
6826      }
6827    }]);
6828
6829    return WritableStream;
6830  }();
6831
6832  module.exports = {
6833    AcquireWritableStreamDefaultWriter: AcquireWritableStreamDefaultWriter,
6834    IsWritableStream: IsWritableStream,
6835    IsWritableStreamLocked: IsWritableStreamLocked,
6836    WritableStream: WritableStream,
6837    WritableStreamAbort: WritableStreamAbort,
6838    WritableStreamDefaultControllerError: WritableStreamDefaultControllerError,
6839    WritableStreamDefaultWriterCloseWithErrorPropagation: WritableStreamDefaultWriterCloseWithErrorPropagation,
6840    WritableStreamDefaultWriterRelease: WritableStreamDefaultWriterRelease,
6841    WritableStreamDefaultWriterWrite: WritableStreamDefaultWriterWrite,
6842    WritableStreamCloseQueuedOrInFlight: WritableStreamCloseQueuedOrInFlight
6843  };
6844
6845  function AcquireWritableStreamDefaultWriter(stream) {
6846    return new WritableStreamDefaultWriter(stream);
6847  }
6848
6849  function IsWritableStream(x) {
6850    if (!typeIsObject(x)) {
6851      return false;
6852    }
6853
6854    if (!Object.prototype.hasOwnProperty.call(x, '_writableStreamController')) {
6855      return false;
6856    }
6857
6858    return true;
6859  }
6860
6861  function IsWritableStreamLocked(stream) {
6862    assert(IsWritableStream(stream) === true, 'IsWritableStreamLocked should only be used on known writable streams');
6863
6864    if (stream._writer === undefined) {
6865      return false;
6866    }
6867
6868    return true;
6869  }
6870
6871  function WritableStreamAbort(stream, reason) {
6872    var state = stream._state;
6873
6874    if (state === 'closed') {
6875      return Promise.resolve(undefined);
6876    }
6877
6878    if (state === 'errored') {
6879      return Promise.reject(stream._storedError);
6880    }
6881
6882    var error = new TypeError('Requested to abort');
6883
6884    if (stream._pendingAbortRequest !== undefined) {
6885      return Promise.reject(error);
6886    }
6887
6888    assert(state === 'writable' || state === 'erroring', 'state must be writable or erroring');
6889    var wasAlreadyErroring = false;
6890
6891    if (state === 'erroring') {
6892      wasAlreadyErroring = true;
6893      reason = undefined;
6894    }
6895
6896    var promise = new Promise(function (resolve, reject) {
6897      stream._pendingAbortRequest = {
6898        _resolve: resolve,
6899        _reject: reject,
6900        _reason: reason,
6901        _wasAlreadyErroring: wasAlreadyErroring
6902      };
6903    });
6904
6905    if (wasAlreadyErroring === false) {
6906      WritableStreamStartErroring(stream, error);
6907    }
6908
6909    return promise;
6910  }
6911
6912  function WritableStreamAddWriteRequest(stream) {
6913    assert(IsWritableStreamLocked(stream) === true);
6914    assert(stream._state === 'writable');
6915    var promise = new Promise(function (resolve, reject) {
6916      var writeRequest = {
6917        _resolve: resolve,
6918        _reject: reject
6919      };
6920
6921      stream._writeRequests.push(writeRequest);
6922    });
6923    return promise;
6924  }
6925
6926  function WritableStreamDealWithRejection(stream, error) {
6927    var state = stream._state;
6928
6929    if (state === 'writable') {
6930      WritableStreamStartErroring(stream, error);
6931      return;
6932    }
6933
6934    assert(state === 'erroring');
6935    WritableStreamFinishErroring(stream);
6936  }
6937
6938  function WritableStreamStartErroring(stream, reason) {
6939    assert(stream._storedError === undefined, 'stream._storedError === undefined');
6940    assert(stream._state === 'writable', 'state must be writable');
6941    var controller = stream._writableStreamController;
6942    assert(controller !== undefined, 'controller must not be undefined');
6943    stream._state = 'erroring';
6944    stream._storedError = reason;
6945    var writer = stream._writer;
6946
6947    if (writer !== undefined) {
6948      WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, reason);
6949    }
6950
6951    if (WritableStreamHasOperationMarkedInFlight(stream) === false && controller._started === true) {
6952      WritableStreamFinishErroring(stream);
6953    }
6954  }
6955
6956  function WritableStreamFinishErroring(stream) {
6957    assert(stream._state === 'erroring', 'stream._state === erroring');
6958    assert(WritableStreamHasOperationMarkedInFlight(stream) === false, 'WritableStreamHasOperationMarkedInFlight(stream) === false');
6959    stream._state = 'errored';
6960
6961    stream._writableStreamController.__errorSteps();
6962
6963    var storedError = stream._storedError;
6964
6965    for (var i = 0; i < stream._writeRequests.length; i++) {
6966      var writeRequest = stream._writeRequests[i];
6967
6968      writeRequest._reject(storedError);
6969    }
6970
6971    stream._writeRequests = [];
6972
6973    if (stream._pendingAbortRequest === undefined) {
6974      WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
6975      return;
6976    }
6977
6978    var abortRequest = stream._pendingAbortRequest;
6979    stream._pendingAbortRequest = undefined;
6980
6981    if (abortRequest._wasAlreadyErroring === true) {
6982      abortRequest._reject(storedError);
6983
6984      WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
6985      return;
6986    }
6987
6988    var promise = stream._writableStreamController.__abortSteps(abortRequest._reason);
6989
6990    promise.then(function () {
6991      abortRequest._resolve();
6992
6993      WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
6994    }, function (reason) {
6995      abortRequest._reject(reason);
6996
6997      WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream);
6998    });
6999  }
7000
7001  function WritableStreamFinishInFlightWrite(stream) {
7002    assert(stream._inFlightWriteRequest !== undefined);
7003
7004    stream._inFlightWriteRequest._resolve(undefined);
7005
7006    stream._inFlightWriteRequest = undefined;
7007  }
7008
7009  function WritableStreamFinishInFlightWriteWithError(stream, error) {
7010    assert(stream._inFlightWriteRequest !== undefined);
7011
7012    stream._inFlightWriteRequest._reject(error);
7013
7014    stream._inFlightWriteRequest = undefined;
7015    assert(stream._state === 'writable' || stream._state === 'erroring');
7016    WritableStreamDealWithRejection(stream, error);
7017  }
7018
7019  function WritableStreamFinishInFlightClose(stream) {
7020    assert(stream._inFlightCloseRequest !== undefined);
7021
7022    stream._inFlightCloseRequest._resolve(undefined);
7023
7024    stream._inFlightCloseRequest = undefined;
7025    var state = stream._state;
7026    assert(state === 'writable' || state === 'erroring');
7027
7028    if (state === 'erroring') {
7029      stream._storedError = undefined;
7030
7031      if (stream._pendingAbortRequest !== undefined) {
7032        stream._pendingAbortRequest._resolve();
7033
7034        stream._pendingAbortRequest = undefined;
7035      }
7036    }
7037
7038    stream._state = 'closed';
7039    var writer = stream._writer;
7040
7041    if (writer !== undefined) {
7042      defaultWriterClosedPromiseResolve(writer);
7043    }
7044
7045    assert(stream._pendingAbortRequest === undefined, 'stream._pendingAbortRequest === undefined');
7046    assert(stream._storedError === undefined, 'stream._storedError === undefined');
7047  }
7048
7049  function WritableStreamFinishInFlightCloseWithError(stream, error) {
7050    assert(stream._inFlightCloseRequest !== undefined);
7051
7052    stream._inFlightCloseRequest._reject(error);
7053
7054    stream._inFlightCloseRequest = undefined;
7055    assert(stream._state === 'writable' || stream._state === 'erroring');
7056
7057    if (stream._pendingAbortRequest !== undefined) {
7058      stream._pendingAbortRequest._reject(error);
7059
7060      stream._pendingAbortRequest = undefined;
7061    }
7062
7063    WritableStreamDealWithRejection(stream, error);
7064  }
7065
7066  function WritableStreamCloseQueuedOrInFlight(stream) {
7067    if (stream._closeRequest === undefined && stream._inFlightCloseRequest === undefined) {
7068      return false;
7069    }
7070
7071    return true;
7072  }
7073
7074  function WritableStreamHasOperationMarkedInFlight(stream) {
7075    if (stream._inFlightWriteRequest === undefined && stream._inFlightCloseRequest === undefined) {
7076      return false;
7077    }
7078
7079    return true;
7080  }
7081
7082  function WritableStreamMarkCloseRequestInFlight(stream) {
7083    assert(stream._inFlightCloseRequest === undefined);
7084    assert(stream._closeRequest !== undefined);
7085    stream._inFlightCloseRequest = stream._closeRequest;
7086    stream._closeRequest = undefined;
7087  }
7088
7089  function WritableStreamMarkFirstWriteRequestInFlight(stream) {
7090    assert(stream._inFlightWriteRequest === undefined, 'there must be no pending write request');
7091    assert(stream._writeRequests.length !== 0, 'writeRequests must not be empty');
7092    stream._inFlightWriteRequest = stream._writeRequests.shift();
7093  }
7094
7095  function WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream) {
7096    assert(stream._state === 'errored', '_stream_.[[state]] is `"errored"`');
7097
7098    if (stream._closeRequest !== undefined) {
7099      assert(stream._inFlightCloseRequest === undefined);
7100
7101      stream._closeRequest._reject(stream._storedError);
7102
7103      stream._closeRequest = undefined;
7104    }
7105
7106    var writer = stream._writer;
7107
7108    if (writer !== undefined) {
7109      defaultWriterClosedPromiseReject(writer, stream._storedError);
7110
7111      writer._closedPromise["catch"](function () {});
7112    }
7113  }
7114
7115  function WritableStreamUpdateBackpressure(stream, backpressure) {
7116    assert(stream._state === 'writable');
7117    assert(WritableStreamCloseQueuedOrInFlight(stream) === false);
7118    var writer = stream._writer;
7119
7120    if (writer !== undefined && backpressure !== stream._backpressure) {
7121      if (backpressure === true) {
7122        defaultWriterReadyPromiseReset(writer);
7123      } else {
7124        assert(backpressure === false);
7125        defaultWriterReadyPromiseResolve(writer);
7126      }
7127    }
7128
7129    stream._backpressure = backpressure;
7130  }
7131
7132  var WritableStreamDefaultWriter = function () {
7133    function WritableStreamDefaultWriter(stream) {
7134      _classCallCheck(this, WritableStreamDefaultWriter);
7135
7136      if (IsWritableStream(stream) === false) {
7137        throw new TypeError('WritableStreamDefaultWriter can only be constructed with a WritableStream instance');
7138      }
7139
7140      if (IsWritableStreamLocked(stream) === true) {
7141        throw new TypeError('This stream has already been locked for exclusive writing by another writer');
7142      }
7143
7144      this._ownerWritableStream = stream;
7145      stream._writer = this;
7146      var state = stream._state;
7147
7148      if (state === 'writable') {
7149        if (WritableStreamCloseQueuedOrInFlight(stream) === false && stream._backpressure === true) {
7150          defaultWriterReadyPromiseInitialize(this);
7151        } else {
7152          defaultWriterReadyPromiseInitializeAsResolved(this);
7153        }
7154
7155        defaultWriterClosedPromiseInitialize(this);
7156      } else if (state === 'erroring') {
7157        defaultWriterReadyPromiseInitializeAsRejected(this, stream._storedError);
7158
7159        this._readyPromise["catch"](function () {});
7160
7161        defaultWriterClosedPromiseInitialize(this);
7162      } else if (state === 'closed') {
7163        defaultWriterReadyPromiseInitializeAsResolved(this);
7164        defaultWriterClosedPromiseInitializeAsResolved(this);
7165      } else {
7166        assert(state === 'errored', 'state must be errored');
7167        var storedError = stream._storedError;
7168        defaultWriterReadyPromiseInitializeAsRejected(this, storedError);
7169
7170        this._readyPromise["catch"](function () {});
7171
7172        defaultWriterClosedPromiseInitializeAsRejected(this, storedError);
7173
7174        this._closedPromise["catch"](function () {});
7175      }
7176    }
7177
7178    _createClass(WritableStreamDefaultWriter, [{
7179      key: 'abort',
7180      value: function abort(reason) {
7181        if (IsWritableStreamDefaultWriter(this) === false) {
7182          return Promise.reject(defaultWriterBrandCheckException('abort'));
7183        }
7184
7185        if (this._ownerWritableStream === undefined) {
7186          return Promise.reject(defaultWriterLockException('abort'));
7187        }
7188
7189        return WritableStreamDefaultWriterAbort(this, reason);
7190      }
7191    }, {
7192      key: 'close',
7193      value: function close() {
7194        if (IsWritableStreamDefaultWriter(this) === false) {
7195          return Promise.reject(defaultWriterBrandCheckException('close'));
7196        }
7197
7198        var stream = this._ownerWritableStream;
7199
7200        if (stream === undefined) {
7201          return Promise.reject(defaultWriterLockException('close'));
7202        }
7203
7204        if (WritableStreamCloseQueuedOrInFlight(stream) === true) {
7205          return Promise.reject(new TypeError('cannot close an already-closing stream'));
7206        }
7207
7208        return WritableStreamDefaultWriterClose(this);
7209      }
7210    }, {
7211      key: 'releaseLock',
7212      value: function releaseLock() {
7213        if (IsWritableStreamDefaultWriter(this) === false) {
7214          throw defaultWriterBrandCheckException('releaseLock');
7215        }
7216
7217        var stream = this._ownerWritableStream;
7218
7219        if (stream === undefined) {
7220          return;
7221        }
7222
7223        assert(stream._writer !== undefined);
7224        WritableStreamDefaultWriterRelease(this);
7225      }
7226    }, {
7227      key: 'write',
7228      value: function write(chunk) {
7229        if (IsWritableStreamDefaultWriter(this) === false) {
7230          return Promise.reject(defaultWriterBrandCheckException('write'));
7231        }
7232
7233        if (this._ownerWritableStream === undefined) {
7234          return Promise.reject(defaultWriterLockException('write to'));
7235        }
7236
7237        return WritableStreamDefaultWriterWrite(this, chunk);
7238      }
7239    }, {
7240      key: 'closed',
7241      get: function get() {
7242        if (IsWritableStreamDefaultWriter(this) === false) {
7243          return Promise.reject(defaultWriterBrandCheckException('closed'));
7244        }
7245
7246        return this._closedPromise;
7247      }
7248    }, {
7249      key: 'desiredSize',
7250      get: function get() {
7251        if (IsWritableStreamDefaultWriter(this) === false) {
7252          throw defaultWriterBrandCheckException('desiredSize');
7253        }
7254
7255        if (this._ownerWritableStream === undefined) {
7256          throw defaultWriterLockException('desiredSize');
7257        }
7258
7259        return WritableStreamDefaultWriterGetDesiredSize(this);
7260      }
7261    }, {
7262      key: 'ready',
7263      get: function get() {
7264        if (IsWritableStreamDefaultWriter(this) === false) {
7265          return Promise.reject(defaultWriterBrandCheckException('ready'));
7266        }
7267
7268        return this._readyPromise;
7269      }
7270    }]);
7271
7272    return WritableStreamDefaultWriter;
7273  }();
7274
7275  function IsWritableStreamDefaultWriter(x) {
7276    if (!typeIsObject(x)) {
7277      return false;
7278    }
7279
7280    if (!Object.prototype.hasOwnProperty.call(x, '_ownerWritableStream')) {
7281      return false;
7282    }
7283
7284    return true;
7285  }
7286
7287  function WritableStreamDefaultWriterAbort(writer, reason) {
7288    var stream = writer._ownerWritableStream;
7289    assert(stream !== undefined);
7290    return WritableStreamAbort(stream, reason);
7291  }
7292
7293  function WritableStreamDefaultWriterClose(writer) {
7294    var stream = writer._ownerWritableStream;
7295    assert(stream !== undefined);
7296    var state = stream._state;
7297
7298    if (state === 'closed' || state === 'errored') {
7299      return Promise.reject(new TypeError('The stream (in ' + state + ' state) is not in the writable state and cannot be closed'));
7300    }
7301
7302    assert(state === 'writable' || state === 'erroring');
7303    assert(WritableStreamCloseQueuedOrInFlight(stream) === false);
7304    var promise = new Promise(function (resolve, reject) {
7305      var closeRequest = {
7306        _resolve: resolve,
7307        _reject: reject
7308      };
7309      stream._closeRequest = closeRequest;
7310    });
7311
7312    if (stream._backpressure === true && state === 'writable') {
7313      defaultWriterReadyPromiseResolve(writer);
7314    }
7315
7316    WritableStreamDefaultControllerClose(stream._writableStreamController);
7317    return promise;
7318  }
7319
7320  function WritableStreamDefaultWriterCloseWithErrorPropagation(writer) {
7321    var stream = writer._ownerWritableStream;
7322    assert(stream !== undefined);
7323    var state = stream._state;
7324
7325    if (WritableStreamCloseQueuedOrInFlight(stream) === true || state === 'closed') {
7326      return Promise.resolve();
7327    }
7328
7329    if (state === 'errored') {
7330      return Promise.reject(stream._storedError);
7331    }
7332
7333    assert(state === 'writable' || state === 'erroring');
7334    return WritableStreamDefaultWriterClose(writer);
7335  }
7336
7337  function WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer, error) {
7338    if (writer._closedPromiseState === 'pending') {
7339      defaultWriterClosedPromiseReject(writer, error);
7340    } else {
7341      defaultWriterClosedPromiseResetToRejected(writer, error);
7342    }
7343
7344    writer._closedPromise["catch"](function () {});
7345  }
7346
7347  function WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, error) {
7348    if (writer._readyPromiseState === 'pending') {
7349      defaultWriterReadyPromiseReject(writer, error);
7350    } else {
7351      defaultWriterReadyPromiseResetToRejected(writer, error);
7352    }
7353
7354    writer._readyPromise["catch"](function () {});
7355  }
7356
7357  function WritableStreamDefaultWriterGetDesiredSize(writer) {
7358    var stream = writer._ownerWritableStream;
7359    var state = stream._state;
7360
7361    if (state === 'errored' || state === 'erroring') {
7362      return null;
7363    }
7364
7365    if (state === 'closed') {
7366      return 0;
7367    }
7368
7369    return WritableStreamDefaultControllerGetDesiredSize(stream._writableStreamController);
7370  }
7371
7372  function WritableStreamDefaultWriterRelease(writer) {
7373    var stream = writer._ownerWritableStream;
7374    assert(stream !== undefined);
7375    assert(stream._writer === writer);
7376    var releasedError = new TypeError('Writer was released and can no longer be used to monitor the stream\'s closedness');
7377    WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, releasedError);
7378    WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer, releasedError);
7379    stream._writer = undefined;
7380    writer._ownerWritableStream = undefined;
7381  }
7382
7383  function WritableStreamDefaultWriterWrite(writer, chunk) {
7384    var stream = writer._ownerWritableStream;
7385    assert(stream !== undefined);
7386    var controller = stream._writableStreamController;
7387    var chunkSize = WritableStreamDefaultControllerGetChunkSize(controller, chunk);
7388
7389    if (stream !== writer._ownerWritableStream) {
7390      return Promise.reject(defaultWriterLockException('write to'));
7391    }
7392
7393    var state = stream._state;
7394
7395    if (state === 'errored') {
7396      return Promise.reject(stream._storedError);
7397    }
7398
7399    if (WritableStreamCloseQueuedOrInFlight(stream) === true || state === 'closed') {
7400      return Promise.reject(new TypeError('The stream is closing or closed and cannot be written to'));
7401    }
7402
7403    if (state === 'erroring') {
7404      return Promise.reject(stream._storedError);
7405    }
7406
7407    assert(state === 'writable');
7408    var promise = WritableStreamAddWriteRequest(stream);
7409    WritableStreamDefaultControllerWrite(controller, chunk, chunkSize);
7410    return promise;
7411  }
7412
7413  var WritableStreamDefaultController = function () {
7414    function WritableStreamDefaultController(stream, underlyingSink, size, highWaterMark) {
7415      _classCallCheck(this, WritableStreamDefaultController);
7416
7417      if (IsWritableStream(stream) === false) {
7418        throw new TypeError('WritableStreamDefaultController can only be constructed with a WritableStream instance');
7419      }
7420
7421      if (stream._writableStreamController !== undefined) {
7422        throw new TypeError('WritableStreamDefaultController instances can only be created by the WritableStream constructor');
7423      }
7424
7425      this._controlledWritableStream = stream;
7426      this._underlyingSink = underlyingSink;
7427      this._queue = undefined;
7428      this._queueTotalSize = undefined;
7429      ResetQueue(this);
7430      this._started = false;
7431      var normalizedStrategy = ValidateAndNormalizeQueuingStrategy(size, highWaterMark);
7432      this._strategySize = normalizedStrategy.size;
7433      this._strategyHWM = normalizedStrategy.highWaterMark;
7434      var backpressure = WritableStreamDefaultControllerGetBackpressure(this);
7435      WritableStreamUpdateBackpressure(stream, backpressure);
7436    }
7437
7438    _createClass(WritableStreamDefaultController, [{
7439      key: 'error',
7440      value: function error(e) {
7441        if (IsWritableStreamDefaultController(this) === false) {
7442          throw new TypeError('WritableStreamDefaultController.prototype.error can only be used on a WritableStreamDefaultController');
7443        }
7444
7445        var state = this._controlledWritableStream._state;
7446
7447        if (state !== 'writable') {
7448          return;
7449        }
7450
7451        WritableStreamDefaultControllerError(this, e);
7452      }
7453    }, {
7454      key: '__abortSteps',
7455      value: function __abortSteps(reason) {
7456        return PromiseInvokeOrNoop(this._underlyingSink, 'abort', [reason]);
7457      }
7458    }, {
7459      key: '__errorSteps',
7460      value: function __errorSteps() {
7461        ResetQueue(this);
7462      }
7463    }, {
7464      key: '__startSteps',
7465      value: function __startSteps() {
7466        var _this = this;
7467
7468        var startResult = InvokeOrNoop(this._underlyingSink, 'start', [this]);
7469        var stream = this._controlledWritableStream;
7470        Promise.resolve(startResult).then(function () {
7471          assert(stream._state === 'writable' || stream._state === 'erroring');
7472          _this._started = true;
7473          WritableStreamDefaultControllerAdvanceQueueIfNeeded(_this);
7474        }, function (r) {
7475          assert(stream._state === 'writable' || stream._state === 'erroring');
7476          _this._started = true;
7477          WritableStreamDealWithRejection(stream, r);
7478        })["catch"](rethrowAssertionErrorRejection);
7479      }
7480    }]);
7481
7482    return WritableStreamDefaultController;
7483  }();
7484
7485  function WritableStreamDefaultControllerClose(controller) {
7486    EnqueueValueWithSize(controller, 'close', 0);
7487    WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
7488  }
7489
7490  function WritableStreamDefaultControllerGetChunkSize(controller, chunk) {
7491    var strategySize = controller._strategySize;
7492
7493    if (strategySize === undefined) {
7494      return 1;
7495    }
7496
7497    try {
7498      return strategySize(chunk);
7499    } catch (chunkSizeE) {
7500      WritableStreamDefaultControllerErrorIfNeeded(controller, chunkSizeE);
7501      return 1;
7502    }
7503  }
7504
7505  function WritableStreamDefaultControllerGetDesiredSize(controller) {
7506    return controller._strategyHWM - controller._queueTotalSize;
7507  }
7508
7509  function WritableStreamDefaultControllerWrite(controller, chunk, chunkSize) {
7510    var writeRecord = {
7511      chunk: chunk
7512    };
7513
7514    try {
7515      EnqueueValueWithSize(controller, writeRecord, chunkSize);
7516    } catch (enqueueE) {
7517      WritableStreamDefaultControllerErrorIfNeeded(controller, enqueueE);
7518      return;
7519    }
7520
7521    var stream = controller._controlledWritableStream;
7522
7523    if (WritableStreamCloseQueuedOrInFlight(stream) === false && stream._state === 'writable') {
7524      var backpressure = WritableStreamDefaultControllerGetBackpressure(controller);
7525      WritableStreamUpdateBackpressure(stream, backpressure);
7526    }
7527
7528    WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
7529  }
7530
7531  function IsWritableStreamDefaultController(x) {
7532    if (!typeIsObject(x)) {
7533      return false;
7534    }
7535
7536    if (!Object.prototype.hasOwnProperty.call(x, '_underlyingSink')) {
7537      return false;
7538    }
7539
7540    return true;
7541  }
7542
7543  function WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller) {
7544    var stream = controller._controlledWritableStream;
7545
7546    if (controller._started === false) {
7547      return;
7548    }
7549
7550    if (stream._inFlightWriteRequest !== undefined) {
7551      return;
7552    }
7553
7554    var state = stream._state;
7555
7556    if (state === 'closed' || state === 'errored') {
7557      return;
7558    }
7559
7560    if (state === 'erroring') {
7561      WritableStreamFinishErroring(stream);
7562      return;
7563    }
7564
7565    if (controller._queue.length === 0) {
7566      return;
7567    }
7568
7569    var writeRecord = PeekQueueValue(controller);
7570
7571    if (writeRecord === 'close') {
7572      WritableStreamDefaultControllerProcessClose(controller);
7573    } else {
7574      WritableStreamDefaultControllerProcessWrite(controller, writeRecord.chunk);
7575    }
7576  }
7577
7578  function WritableStreamDefaultControllerErrorIfNeeded(controller, error) {
7579    if (controller._controlledWritableStream._state === 'writable') {
7580      WritableStreamDefaultControllerError(controller, error);
7581    }
7582  }
7583
7584  function WritableStreamDefaultControllerProcessClose(controller) {
7585    var stream = controller._controlledWritableStream;
7586    WritableStreamMarkCloseRequestInFlight(stream);
7587    DequeueValue(controller);
7588    assert(controller._queue.length === 0, 'queue must be empty once the final write record is dequeued');
7589    var sinkClosePromise = PromiseInvokeOrNoop(controller._underlyingSink, 'close', []);
7590    sinkClosePromise.then(function () {
7591      WritableStreamFinishInFlightClose(stream);
7592    }, function (reason) {
7593      WritableStreamFinishInFlightCloseWithError(stream, reason);
7594    })["catch"](rethrowAssertionErrorRejection);
7595  }
7596
7597  function WritableStreamDefaultControllerProcessWrite(controller, chunk) {
7598    var stream = controller._controlledWritableStream;
7599    WritableStreamMarkFirstWriteRequestInFlight(stream);
7600    var sinkWritePromise = PromiseInvokeOrNoop(controller._underlyingSink, 'write', [chunk, controller]);
7601    sinkWritePromise.then(function () {
7602      WritableStreamFinishInFlightWrite(stream);
7603      var state = stream._state;
7604      assert(state === 'writable' || state === 'erroring');
7605      DequeueValue(controller);
7606
7607      if (WritableStreamCloseQueuedOrInFlight(stream) === false && state === 'writable') {
7608        var backpressure = WritableStreamDefaultControllerGetBackpressure(controller);
7609        WritableStreamUpdateBackpressure(stream, backpressure);
7610      }
7611
7612      WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller);
7613    }, function (reason) {
7614      WritableStreamFinishInFlightWriteWithError(stream, reason);
7615    })["catch"](rethrowAssertionErrorRejection);
7616  }
7617
7618  function WritableStreamDefaultControllerGetBackpressure(controller) {
7619    var desiredSize = WritableStreamDefaultControllerGetDesiredSize(controller);
7620    return desiredSize <= 0;
7621  }
7622
7623  function WritableStreamDefaultControllerError(controller, error) {
7624    var stream = controller._controlledWritableStream;
7625    assert(stream._state === 'writable');
7626    WritableStreamStartErroring(stream, error);
7627  }
7628
7629  function streamBrandCheckException(name) {
7630    return new TypeError('WritableStream.prototype.' + name + ' can only be used on a WritableStream');
7631  }
7632
7633  function defaultWriterBrandCheckException(name) {
7634    return new TypeError('WritableStreamDefaultWriter.prototype.' + name + ' can only be used on a WritableStreamDefaultWriter');
7635  }
7636
7637  function defaultWriterLockException(name) {
7638    return new TypeError('Cannot ' + name + ' a stream using a released writer');
7639  }
7640
7641  function defaultWriterClosedPromiseInitialize(writer) {
7642    writer._closedPromise = new Promise(function (resolve, reject) {
7643      writer._closedPromise_resolve = resolve;
7644      writer._closedPromise_reject = reject;
7645      writer._closedPromiseState = 'pending';
7646    });
7647  }
7648
7649  function defaultWriterClosedPromiseInitializeAsRejected(writer, reason) {
7650    writer._closedPromise = Promise.reject(reason);
7651    writer._closedPromise_resolve = undefined;
7652    writer._closedPromise_reject = undefined;
7653    writer._closedPromiseState = 'rejected';
7654  }
7655
7656  function defaultWriterClosedPromiseInitializeAsResolved(writer) {
7657    writer._closedPromise = Promise.resolve(undefined);
7658    writer._closedPromise_resolve = undefined;
7659    writer._closedPromise_reject = undefined;
7660    writer._closedPromiseState = 'resolved';
7661  }
7662
7663  function defaultWriterClosedPromiseReject(writer, reason) {
7664    assert(writer._closedPromise_resolve !== undefined, 'writer._closedPromise_resolve !== undefined');
7665    assert(writer._closedPromise_reject !== undefined, 'writer._closedPromise_reject !== undefined');
7666    assert(writer._closedPromiseState === 'pending', 'writer._closedPromiseState is pending');
7667
7668    writer._closedPromise_reject(reason);
7669
7670    writer._closedPromise_resolve = undefined;
7671    writer._closedPromise_reject = undefined;
7672    writer._closedPromiseState = 'rejected';
7673  }
7674
7675  function defaultWriterClosedPromiseResetToRejected(writer, reason) {
7676    assert(writer._closedPromise_resolve === undefined, 'writer._closedPromise_resolve === undefined');
7677    assert(writer._closedPromise_reject === undefined, 'writer._closedPromise_reject === undefined');
7678    assert(writer._closedPromiseState !== 'pending', 'writer._closedPromiseState is not pending');
7679    writer._closedPromise = Promise.reject(reason);
7680    writer._closedPromiseState = 'rejected';
7681  }
7682
7683  function defaultWriterClosedPromiseResolve(writer) {
7684    assert(writer._closedPromise_resolve !== undefined, 'writer._closedPromise_resolve !== undefined');
7685    assert(writer._closedPromise_reject !== undefined, 'writer._closedPromise_reject !== undefined');
7686    assert(writer._closedPromiseState === 'pending', 'writer._closedPromiseState is pending');
7687
7688    writer._closedPromise_resolve(undefined);
7689
7690    writer._closedPromise_resolve = undefined;
7691    writer._closedPromise_reject = undefined;
7692    writer._closedPromiseState = 'resolved';
7693  }
7694
7695  function defaultWriterReadyPromiseInitialize(writer) {
7696    writer._readyPromise = new Promise(function (resolve, reject) {
7697      writer._readyPromise_resolve = resolve;
7698      writer._readyPromise_reject = reject;
7699    });
7700    writer._readyPromiseState = 'pending';
7701  }
7702
7703  function defaultWriterReadyPromiseInitializeAsRejected(writer, reason) {
7704    writer._readyPromise = Promise.reject(reason);
7705    writer._readyPromise_resolve = undefined;
7706    writer._readyPromise_reject = undefined;
7707    writer._readyPromiseState = 'rejected';
7708  }
7709
7710  function defaultWriterReadyPromiseInitializeAsResolved(writer) {
7711    writer._readyPromise = Promise.resolve(undefined);
7712    writer._readyPromise_resolve = undefined;
7713    writer._readyPromise_reject = undefined;
7714    writer._readyPromiseState = 'fulfilled';
7715  }
7716
7717  function defaultWriterReadyPromiseReject(writer, reason) {
7718    assert(writer._readyPromise_resolve !== undefined, 'writer._readyPromise_resolve !== undefined');
7719    assert(writer._readyPromise_reject !== undefined, 'writer._readyPromise_reject !== undefined');
7720
7721    writer._readyPromise_reject(reason);
7722
7723    writer._readyPromise_resolve = undefined;
7724    writer._readyPromise_reject = undefined;
7725    writer._readyPromiseState = 'rejected';
7726  }
7727
7728  function defaultWriterReadyPromiseReset(writer) {
7729    assert(writer._readyPromise_resolve === undefined, 'writer._readyPromise_resolve === undefined');
7730    assert(writer._readyPromise_reject === undefined, 'writer._readyPromise_reject === undefined');
7731    writer._readyPromise = new Promise(function (resolve, reject) {
7732      writer._readyPromise_resolve = resolve;
7733      writer._readyPromise_reject = reject;
7734    });
7735    writer._readyPromiseState = 'pending';
7736  }
7737
7738  function defaultWriterReadyPromiseResetToRejected(writer, reason) {
7739    assert(writer._readyPromise_resolve === undefined, 'writer._readyPromise_resolve === undefined');
7740    assert(writer._readyPromise_reject === undefined, 'writer._readyPromise_reject === undefined');
7741    writer._readyPromise = Promise.reject(reason);
7742    writer._readyPromiseState = 'rejected';
7743  }
7744
7745  function defaultWriterReadyPromiseResolve(writer) {
7746    assert(writer._readyPromise_resolve !== undefined, 'writer._readyPromise_resolve !== undefined');
7747    assert(writer._readyPromise_reject !== undefined, 'writer._readyPromise_reject !== undefined');
7748
7749    writer._readyPromise_resolve(undefined);
7750
7751    writer._readyPromise_resolve = undefined;
7752    writer._readyPromise_reject = undefined;
7753    writer._readyPromiseState = 'fulfilled';
7754  }
7755}, function (module, exports, __w_pdfjs_require__) {
7756  "use strict";
7757
7758  var _require = __w_pdfjs_require__(0),
7759      IsFiniteNonNegativeNumber = _require.IsFiniteNonNegativeNumber;
7760
7761  var _require2 = __w_pdfjs_require__(1),
7762      assert = _require2.assert;
7763
7764  exports.DequeueValue = function (container) {
7765    assert('_queue' in container && '_queueTotalSize' in container, 'Spec-level failure: DequeueValue should only be used on containers with [[queue]] and [[queueTotalSize]].');
7766    assert(container._queue.length > 0, 'Spec-level failure: should never dequeue from an empty queue.');
7767
7768    var pair = container._queue.shift();
7769
7770    container._queueTotalSize -= pair.size;
7771
7772    if (container._queueTotalSize < 0) {
7773      container._queueTotalSize = 0;
7774    }
7775
7776    return pair.value;
7777  };
7778
7779  exports.EnqueueValueWithSize = function (container, value, size) {
7780    assert('_queue' in container && '_queueTotalSize' in container, 'Spec-level failure: EnqueueValueWithSize should only be used on containers with [[queue]] and ' + '[[queueTotalSize]].');
7781    size = Number(size);
7782
7783    if (!IsFiniteNonNegativeNumber(size)) {
7784      throw new RangeError('Size must be a finite, non-NaN, non-negative number.');
7785    }
7786
7787    container._queue.push({
7788      value: value,
7789      size: size
7790    });
7791
7792    container._queueTotalSize += size;
7793  };
7794
7795  exports.PeekQueueValue = function (container) {
7796    assert('_queue' in container && '_queueTotalSize' in container, 'Spec-level failure: PeekQueueValue should only be used on containers with [[queue]] and [[queueTotalSize]].');
7797    assert(container._queue.length > 0, 'Spec-level failure: should never peek at an empty queue.');
7798    var pair = container._queue[0];
7799    return pair.value;
7800  };
7801
7802  exports.ResetQueue = function (container) {
7803    assert('_queue' in container && '_queueTotalSize' in container, 'Spec-level failure: ResetQueue should only be used on containers with [[queue]] and [[queueTotalSize]].');
7804    container._queue = [];
7805    container._queueTotalSize = 0;
7806  };
7807}, function (module, exports, __w_pdfjs_require__) {
7808  "use strict";
7809
7810  var _createClass = function () {
7811    function defineProperties(target, props) {
7812      for (var i = 0; i < props.length; i++) {
7813        var descriptor = props[i];
7814        descriptor.enumerable = descriptor.enumerable || false;
7815        descriptor.configurable = true;
7816        if ("value" in descriptor) descriptor.writable = true;
7817        Object.defineProperty(target, descriptor.key, descriptor);
7818      }
7819    }
7820
7821    return function (Constructor, protoProps, staticProps) {
7822      if (protoProps) defineProperties(Constructor.prototype, protoProps);
7823      if (staticProps) defineProperties(Constructor, staticProps);
7824      return Constructor;
7825    };
7826  }();
7827
7828  function _classCallCheck(instance, Constructor) {
7829    if (!(instance instanceof Constructor)) {
7830      throw new TypeError("Cannot call a class as a function");
7831    }
7832  }
7833
7834  var _require = __w_pdfjs_require__(0),
7835      ArrayBufferCopy = _require.ArrayBufferCopy,
7836      CreateIterResultObject = _require.CreateIterResultObject,
7837      IsFiniteNonNegativeNumber = _require.IsFiniteNonNegativeNumber,
7838      InvokeOrNoop = _require.InvokeOrNoop,
7839      PromiseInvokeOrNoop = _require.PromiseInvokeOrNoop,
7840      TransferArrayBuffer = _require.TransferArrayBuffer,
7841      ValidateAndNormalizeQueuingStrategy = _require.ValidateAndNormalizeQueuingStrategy,
7842      ValidateAndNormalizeHighWaterMark = _require.ValidateAndNormalizeHighWaterMark;
7843
7844  var _require2 = __w_pdfjs_require__(0),
7845      createArrayFromList = _require2.createArrayFromList,
7846      createDataProperty = _require2.createDataProperty,
7847      typeIsObject = _require2.typeIsObject;
7848
7849  var _require3 = __w_pdfjs_require__(1),
7850      assert = _require3.assert,
7851      rethrowAssertionErrorRejection = _require3.rethrowAssertionErrorRejection;
7852
7853  var _require4 = __w_pdfjs_require__(3),
7854      DequeueValue = _require4.DequeueValue,
7855      EnqueueValueWithSize = _require4.EnqueueValueWithSize,
7856      ResetQueue = _require4.ResetQueue;
7857
7858  var _require5 = __w_pdfjs_require__(2),
7859      AcquireWritableStreamDefaultWriter = _require5.AcquireWritableStreamDefaultWriter,
7860      IsWritableStream = _require5.IsWritableStream,
7861      IsWritableStreamLocked = _require5.IsWritableStreamLocked,
7862      WritableStreamAbort = _require5.WritableStreamAbort,
7863      WritableStreamDefaultWriterCloseWithErrorPropagation = _require5.WritableStreamDefaultWriterCloseWithErrorPropagation,
7864      WritableStreamDefaultWriterRelease = _require5.WritableStreamDefaultWriterRelease,
7865      WritableStreamDefaultWriterWrite = _require5.WritableStreamDefaultWriterWrite,
7866      WritableStreamCloseQueuedOrInFlight = _require5.WritableStreamCloseQueuedOrInFlight;
7867
7868  var ReadableStream = function () {
7869    function ReadableStream() {
7870      var underlyingSource = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7871
7872      var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
7873          size = _ref.size,
7874          highWaterMark = _ref.highWaterMark;
7875
7876      _classCallCheck(this, ReadableStream);
7877
7878      this._state = 'readable';
7879      this._reader = undefined;
7880      this._storedError = undefined;
7881      this._disturbed = false;
7882      this._readableStreamController = undefined;
7883      var type = underlyingSource.type;
7884      var typeString = String(type);
7885
7886      if (typeString === 'bytes') {
7887        if (highWaterMark === undefined) {
7888          highWaterMark = 0;
7889        }
7890
7891        this._readableStreamController = new ReadableByteStreamController(this, underlyingSource, highWaterMark);
7892      } else if (type === undefined) {
7893        if (highWaterMark === undefined) {
7894          highWaterMark = 1;
7895        }
7896
7897        this._readableStreamController = new ReadableStreamDefaultController(this, underlyingSource, size, highWaterMark);
7898      } else {
7899        throw new RangeError('Invalid type is specified');
7900      }
7901    }
7902
7903    _createClass(ReadableStream, [{
7904      key: 'cancel',
7905      value: function cancel(reason) {
7906        if (IsReadableStream(this) === false) {
7907          return Promise.reject(streamBrandCheckException('cancel'));
7908        }
7909
7910        if (IsReadableStreamLocked(this) === true) {
7911          return Promise.reject(new TypeError('Cannot cancel a stream that already has a reader'));
7912        }
7913
7914        return ReadableStreamCancel(this, reason);
7915      }
7916    }, {
7917      key: 'getReader',
7918      value: function getReader() {
7919        var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
7920            mode = _ref2.mode;
7921
7922        if (IsReadableStream(this) === false) {
7923          throw streamBrandCheckException('getReader');
7924        }
7925
7926        if (mode === undefined) {
7927          return AcquireReadableStreamDefaultReader(this);
7928        }
7929
7930        mode = String(mode);
7931
7932        if (mode === 'byob') {
7933          return AcquireReadableStreamBYOBReader(this);
7934        }
7935
7936        throw new RangeError('Invalid mode is specified');
7937      }
7938    }, {
7939      key: 'pipeThrough',
7940      value: function pipeThrough(_ref3, options) {
7941        var writable = _ref3.writable,
7942            readable = _ref3.readable;
7943        var promise = this.pipeTo(writable, options);
7944        ifIsObjectAndHasAPromiseIsHandledInternalSlotSetPromiseIsHandledToTrue(promise);
7945        return readable;
7946      }
7947    }, {
7948      key: 'pipeTo',
7949      value: function pipeTo(dest) {
7950        var _this = this;
7951
7952        var _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
7953            preventClose = _ref4.preventClose,
7954            preventAbort = _ref4.preventAbort,
7955            preventCancel = _ref4.preventCancel;
7956
7957        if (IsReadableStream(this) === false) {
7958          return Promise.reject(streamBrandCheckException('pipeTo'));
7959        }
7960
7961        if (IsWritableStream(dest) === false) {
7962          return Promise.reject(new TypeError('ReadableStream.prototype.pipeTo\'s first argument must be a WritableStream'));
7963        }
7964
7965        preventClose = Boolean(preventClose);
7966        preventAbort = Boolean(preventAbort);
7967        preventCancel = Boolean(preventCancel);
7968
7969        if (IsReadableStreamLocked(this) === true) {
7970          return Promise.reject(new TypeError('ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream'));
7971        }
7972
7973        if (IsWritableStreamLocked(dest) === true) {
7974          return Promise.reject(new TypeError('ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream'));
7975        }
7976
7977        var reader = AcquireReadableStreamDefaultReader(this);
7978        var writer = AcquireWritableStreamDefaultWriter(dest);
7979        var shuttingDown = false;
7980        var currentWrite = Promise.resolve();
7981        return new Promise(function (resolve, reject) {
7982          function pipeLoop() {
7983            currentWrite = Promise.resolve();
7984
7985            if (shuttingDown === true) {
7986              return Promise.resolve();
7987            }
7988
7989            return writer._readyPromise.then(function () {
7990              return ReadableStreamDefaultReaderRead(reader).then(function (_ref5) {
7991                var value = _ref5.value,
7992                    done = _ref5.done;
7993
7994                if (done === true) {
7995                  return;
7996                }
7997
7998                currentWrite = WritableStreamDefaultWriterWrite(writer, value)["catch"](function () {});
7999              });
8000            }).then(pipeLoop);
8001          }
8002
8003          isOrBecomesErrored(_this, reader._closedPromise, function (storedError) {
8004            if (preventAbort === false) {
8005              shutdownWithAction(function () {
8006                return WritableStreamAbort(dest, storedError);
8007              }, true, storedError);
8008            } else {
8009              shutdown(true, storedError);
8010            }
8011          });
8012          isOrBecomesErrored(dest, writer._closedPromise, function (storedError) {
8013            if (preventCancel === false) {
8014              shutdownWithAction(function () {
8015                return ReadableStreamCancel(_this, storedError);
8016              }, true, storedError);
8017            } else {
8018              shutdown(true, storedError);
8019            }
8020          });
8021          isOrBecomesClosed(_this, reader._closedPromise, function () {
8022            if (preventClose === false) {
8023              shutdownWithAction(function () {
8024                return WritableStreamDefaultWriterCloseWithErrorPropagation(writer);
8025              });
8026            } else {
8027              shutdown();
8028            }
8029          });
8030
8031          if (WritableStreamCloseQueuedOrInFlight(dest) === true || dest._state === 'closed') {
8032            var destClosed = new TypeError('the destination writable stream closed before all data could be piped to it');
8033
8034            if (preventCancel === false) {
8035              shutdownWithAction(function () {
8036                return ReadableStreamCancel(_this, destClosed);
8037              }, true, destClosed);
8038            } else {
8039              shutdown(true, destClosed);
8040            }
8041          }
8042
8043          pipeLoop()["catch"](function (err) {
8044            currentWrite = Promise.resolve();
8045            rethrowAssertionErrorRejection(err);
8046          });
8047
8048          function waitForWritesToFinish() {
8049            var oldCurrentWrite = currentWrite;
8050            return currentWrite.then(function () {
8051              return oldCurrentWrite !== currentWrite ? waitForWritesToFinish() : undefined;
8052            });
8053          }
8054
8055          function isOrBecomesErrored(stream, promise, action) {
8056            if (stream._state === 'errored') {
8057              action(stream._storedError);
8058            } else {
8059              promise["catch"](action)["catch"](rethrowAssertionErrorRejection);
8060            }
8061          }
8062
8063          function isOrBecomesClosed(stream, promise, action) {
8064            if (stream._state === 'closed') {
8065              action();
8066            } else {
8067              promise.then(action)["catch"](rethrowAssertionErrorRejection);
8068            }
8069          }
8070
8071          function shutdownWithAction(action, originalIsError, originalError) {
8072            if (shuttingDown === true) {
8073              return;
8074            }
8075
8076            shuttingDown = true;
8077
8078            if (dest._state === 'writable' && WritableStreamCloseQueuedOrInFlight(dest) === false) {
8079              waitForWritesToFinish().then(doTheRest);
8080            } else {
8081              doTheRest();
8082            }
8083
8084            function doTheRest() {
8085              action().then(function () {
8086                return finalize(originalIsError, originalError);
8087              }, function (newError) {
8088                return finalize(true, newError);
8089              })["catch"](rethrowAssertionErrorRejection);
8090            }
8091          }
8092
8093          function shutdown(isError, error) {
8094            if (shuttingDown === true) {
8095              return;
8096            }
8097
8098            shuttingDown = true;
8099
8100            if (dest._state === 'writable' && WritableStreamCloseQueuedOrInFlight(dest) === false) {
8101              waitForWritesToFinish().then(function () {
8102                return finalize(isError, error);
8103              })["catch"](rethrowAssertionErrorRejection);
8104            } else {
8105              finalize(isError, error);
8106            }
8107          }
8108
8109          function finalize(isError, error) {
8110            WritableStreamDefaultWriterRelease(writer);
8111            ReadableStreamReaderGenericRelease(reader);
8112
8113            if (isError) {
8114              reject(error);
8115            } else {
8116              resolve(undefined);
8117            }
8118          }
8119        });
8120      }
8121    }, {
8122      key: 'tee',
8123      value: function tee() {
8124        if (IsReadableStream(this) === false) {
8125          throw streamBrandCheckException('tee');
8126        }
8127
8128        var branches = ReadableStreamTee(this, false);
8129        return createArrayFromList(branches);
8130      }
8131    }, {
8132      key: 'locked',
8133      get: function get() {
8134        if (IsReadableStream(this) === false) {
8135          throw streamBrandCheckException('locked');
8136        }
8137
8138        return IsReadableStreamLocked(this);
8139      }
8140    }]);
8141
8142    return ReadableStream;
8143  }();
8144
8145  module.exports = {
8146    ReadableStream: ReadableStream,
8147    IsReadableStreamDisturbed: IsReadableStreamDisturbed,
8148    ReadableStreamDefaultControllerClose: ReadableStreamDefaultControllerClose,
8149    ReadableStreamDefaultControllerEnqueue: ReadableStreamDefaultControllerEnqueue,
8150    ReadableStreamDefaultControllerError: ReadableStreamDefaultControllerError,
8151    ReadableStreamDefaultControllerGetDesiredSize: ReadableStreamDefaultControllerGetDesiredSize
8152  };
8153
8154  function AcquireReadableStreamBYOBReader(stream) {
8155    return new ReadableStreamBYOBReader(stream);
8156  }
8157
8158  function AcquireReadableStreamDefaultReader(stream) {
8159    return new ReadableStreamDefaultReader(stream);
8160  }
8161
8162  function IsReadableStream(x) {
8163    if (!typeIsObject(x)) {
8164      return false;
8165    }
8166
8167    if (!Object.prototype.hasOwnProperty.call(x, '_readableStreamController')) {
8168      return false;
8169    }
8170
8171    return true;
8172  }
8173
8174  function IsReadableStreamDisturbed(stream) {
8175    assert(IsReadableStream(stream) === true, 'IsReadableStreamDisturbed should only be used on known readable streams');
8176    return stream._disturbed;
8177  }
8178
8179  function IsReadableStreamLocked(stream) {
8180    assert(IsReadableStream(stream) === true, 'IsReadableStreamLocked should only be used on known readable streams');
8181
8182    if (stream._reader === undefined) {
8183      return false;
8184    }
8185
8186    return true;
8187  }
8188
8189  function ReadableStreamTee(stream, cloneForBranch2) {
8190    assert(IsReadableStream(stream) === true);
8191    assert(typeof cloneForBranch2 === 'boolean');
8192    var reader = AcquireReadableStreamDefaultReader(stream);
8193    var teeState = {
8194      closedOrErrored: false,
8195      canceled1: false,
8196      canceled2: false,
8197      reason1: undefined,
8198      reason2: undefined
8199    };
8200    teeState.promise = new Promise(function (resolve) {
8201      teeState._resolve = resolve;
8202    });
8203    var pull = create_ReadableStreamTeePullFunction();
8204    pull._reader = reader;
8205    pull._teeState = teeState;
8206    pull._cloneForBranch2 = cloneForBranch2;
8207    var cancel1 = create_ReadableStreamTeeBranch1CancelFunction();
8208    cancel1._stream = stream;
8209    cancel1._teeState = teeState;
8210    var cancel2 = create_ReadableStreamTeeBranch2CancelFunction();
8211    cancel2._stream = stream;
8212    cancel2._teeState = teeState;
8213    var underlyingSource1 = Object.create(Object.prototype);
8214    createDataProperty(underlyingSource1, 'pull', pull);
8215    createDataProperty(underlyingSource1, 'cancel', cancel1);
8216    var branch1Stream = new ReadableStream(underlyingSource1);
8217    var underlyingSource2 = Object.create(Object.prototype);
8218    createDataProperty(underlyingSource2, 'pull', pull);
8219    createDataProperty(underlyingSource2, 'cancel', cancel2);
8220    var branch2Stream = new ReadableStream(underlyingSource2);
8221    pull._branch1 = branch1Stream._readableStreamController;
8222    pull._branch2 = branch2Stream._readableStreamController;
8223
8224    reader._closedPromise["catch"](function (r) {
8225      if (teeState.closedOrErrored === true) {
8226        return;
8227      }
8228
8229      ReadableStreamDefaultControllerError(pull._branch1, r);
8230      ReadableStreamDefaultControllerError(pull._branch2, r);
8231      teeState.closedOrErrored = true;
8232    });
8233
8234    return [branch1Stream, branch2Stream];
8235  }
8236
8237  function create_ReadableStreamTeePullFunction() {
8238    function f() {
8239      var reader = f._reader,
8240          branch1 = f._branch1,
8241          branch2 = f._branch2,
8242          teeState = f._teeState;
8243      return ReadableStreamDefaultReaderRead(reader).then(function (result) {
8244        assert(typeIsObject(result));
8245        var value = result.value;
8246        var done = result.done;
8247        assert(typeof done === 'boolean');
8248
8249        if (done === true && teeState.closedOrErrored === false) {
8250          if (teeState.canceled1 === false) {
8251            ReadableStreamDefaultControllerClose(branch1);
8252          }
8253
8254          if (teeState.canceled2 === false) {
8255            ReadableStreamDefaultControllerClose(branch2);
8256          }
8257
8258          teeState.closedOrErrored = true;
8259        }
8260
8261        if (teeState.closedOrErrored === true) {
8262          return;
8263        }
8264
8265        var value1 = value;
8266        var value2 = value;
8267
8268        if (teeState.canceled1 === false) {
8269          ReadableStreamDefaultControllerEnqueue(branch1, value1);
8270        }
8271
8272        if (teeState.canceled2 === false) {
8273          ReadableStreamDefaultControllerEnqueue(branch2, value2);
8274        }
8275      });
8276    }
8277
8278    return f;
8279  }
8280
8281  function create_ReadableStreamTeeBranch1CancelFunction() {
8282    function f(reason) {
8283      var stream = f._stream,
8284          teeState = f._teeState;
8285      teeState.canceled1 = true;
8286      teeState.reason1 = reason;
8287
8288      if (teeState.canceled2 === true) {
8289        var compositeReason = createArrayFromList([teeState.reason1, teeState.reason2]);
8290        var cancelResult = ReadableStreamCancel(stream, compositeReason);
8291
8292        teeState._resolve(cancelResult);
8293      }
8294
8295      return teeState.promise;
8296    }
8297
8298    return f;
8299  }
8300
8301  function create_ReadableStreamTeeBranch2CancelFunction() {
8302    function f(reason) {
8303      var stream = f._stream,
8304          teeState = f._teeState;
8305      teeState.canceled2 = true;
8306      teeState.reason2 = reason;
8307
8308      if (teeState.canceled1 === true) {
8309        var compositeReason = createArrayFromList([teeState.reason1, teeState.reason2]);
8310        var cancelResult = ReadableStreamCancel(stream, compositeReason);
8311
8312        teeState._resolve(cancelResult);
8313      }
8314
8315      return teeState.promise;
8316    }
8317
8318    return f;
8319  }
8320
8321  function ReadableStreamAddReadIntoRequest(stream) {
8322    assert(IsReadableStreamBYOBReader(stream._reader) === true);
8323    assert(stream._state === 'readable' || stream._state === 'closed');
8324    var promise = new Promise(function (resolve, reject) {
8325      var readIntoRequest = {
8326        _resolve: resolve,
8327        _reject: reject
8328      };
8329
8330      stream._reader._readIntoRequests.push(readIntoRequest);
8331    });
8332    return promise;
8333  }
8334
8335  function ReadableStreamAddReadRequest(stream) {
8336    assert(IsReadableStreamDefaultReader(stream._reader) === true);
8337    assert(stream._state === 'readable');
8338    var promise = new Promise(function (resolve, reject) {
8339      var readRequest = {
8340        _resolve: resolve,
8341        _reject: reject
8342      };
8343
8344      stream._reader._readRequests.push(readRequest);
8345    });
8346    return promise;
8347  }
8348
8349  function ReadableStreamCancel(stream, reason) {
8350    stream._disturbed = true;
8351
8352    if (stream._state === 'closed') {
8353      return Promise.resolve(undefined);
8354    }
8355
8356    if (stream._state === 'errored') {
8357      return Promise.reject(stream._storedError);
8358    }
8359
8360    ReadableStreamClose(stream);
8361
8362    var sourceCancelPromise = stream._readableStreamController.__cancelSteps(reason);
8363
8364    return sourceCancelPromise.then(function () {
8365      return undefined;
8366    });
8367  }
8368
8369  function ReadableStreamClose(stream) {
8370    assert(stream._state === 'readable');
8371    stream._state = 'closed';
8372    var reader = stream._reader;
8373
8374    if (reader === undefined) {
8375      return undefined;
8376    }
8377
8378    if (IsReadableStreamDefaultReader(reader) === true) {
8379      for (var i = 0; i < reader._readRequests.length; i++) {
8380        var _resolve = reader._readRequests[i]._resolve;
8381
8382        _resolve(CreateIterResultObject(undefined, true));
8383      }
8384
8385      reader._readRequests = [];
8386    }
8387
8388    defaultReaderClosedPromiseResolve(reader);
8389    return undefined;
8390  }
8391
8392  function ReadableStreamError(stream, e) {
8393    assert(IsReadableStream(stream) === true, 'stream must be ReadableStream');
8394    assert(stream._state === 'readable', 'state must be readable');
8395    stream._state = 'errored';
8396    stream._storedError = e;
8397    var reader = stream._reader;
8398
8399    if (reader === undefined) {
8400      return undefined;
8401    }
8402
8403    if (IsReadableStreamDefaultReader(reader) === true) {
8404      for (var i = 0; i < reader._readRequests.length; i++) {
8405        var readRequest = reader._readRequests[i];
8406
8407        readRequest._reject(e);
8408      }
8409
8410      reader._readRequests = [];
8411    } else {
8412      assert(IsReadableStreamBYOBReader(reader), 'reader must be ReadableStreamBYOBReader');
8413
8414      for (var _i = 0; _i < reader._readIntoRequests.length; _i++) {
8415        var readIntoRequest = reader._readIntoRequests[_i];
8416
8417        readIntoRequest._reject(e);
8418      }
8419
8420      reader._readIntoRequests = [];
8421    }
8422
8423    defaultReaderClosedPromiseReject(reader, e);
8424
8425    reader._closedPromise["catch"](function () {});
8426  }
8427
8428  function ReadableStreamFulfillReadIntoRequest(stream, chunk, done) {
8429    var reader = stream._reader;
8430    assert(reader._readIntoRequests.length > 0);
8431
8432    var readIntoRequest = reader._readIntoRequests.shift();
8433
8434    readIntoRequest._resolve(CreateIterResultObject(chunk, done));
8435  }
8436
8437  function ReadableStreamFulfillReadRequest(stream, chunk, done) {
8438    var reader = stream._reader;
8439    assert(reader._readRequests.length > 0);
8440
8441    var readRequest = reader._readRequests.shift();
8442
8443    readRequest._resolve(CreateIterResultObject(chunk, done));
8444  }
8445
8446  function ReadableStreamGetNumReadIntoRequests(stream) {
8447    return stream._reader._readIntoRequests.length;
8448  }
8449
8450  function ReadableStreamGetNumReadRequests(stream) {
8451    return stream._reader._readRequests.length;
8452  }
8453
8454  function ReadableStreamHasBYOBReader(stream) {
8455    var reader = stream._reader;
8456
8457    if (reader === undefined) {
8458      return false;
8459    }
8460
8461    if (IsReadableStreamBYOBReader(reader) === false) {
8462      return false;
8463    }
8464
8465    return true;
8466  }
8467
8468  function ReadableStreamHasDefaultReader(stream) {
8469    var reader = stream._reader;
8470
8471    if (reader === undefined) {
8472      return false;
8473    }
8474
8475    if (IsReadableStreamDefaultReader(reader) === false) {
8476      return false;
8477    }
8478
8479    return true;
8480  }
8481
8482  var ReadableStreamDefaultReader = function () {
8483    function ReadableStreamDefaultReader(stream) {
8484      _classCallCheck(this, ReadableStreamDefaultReader);
8485
8486      if (IsReadableStream(stream) === false) {
8487        throw new TypeError('ReadableStreamDefaultReader can only be constructed with a ReadableStream instance');
8488      }
8489
8490      if (IsReadableStreamLocked(stream) === true) {
8491        throw new TypeError('This stream has already been locked for exclusive reading by another reader');
8492      }
8493
8494      ReadableStreamReaderGenericInitialize(this, stream);
8495      this._readRequests = [];
8496    }
8497
8498    _createClass(ReadableStreamDefaultReader, [{
8499      key: 'cancel',
8500      value: function cancel(reason) {
8501        if (IsReadableStreamDefaultReader(this) === false) {
8502          return Promise.reject(defaultReaderBrandCheckException('cancel'));
8503        }
8504
8505        if (this._ownerReadableStream === undefined) {
8506          return Promise.reject(readerLockException('cancel'));
8507        }
8508
8509        return ReadableStreamReaderGenericCancel(this, reason);
8510      }
8511    }, {
8512      key: 'read',
8513      value: function read() {
8514        if (IsReadableStreamDefaultReader(this) === false) {
8515          return Promise.reject(defaultReaderBrandCheckException('read'));
8516        }
8517
8518        if (this._ownerReadableStream === undefined) {
8519          return Promise.reject(readerLockException('read from'));
8520        }
8521
8522        return ReadableStreamDefaultReaderRead(this);
8523      }
8524    }, {
8525      key: 'releaseLock',
8526      value: function releaseLock() {
8527        if (IsReadableStreamDefaultReader(this) === false) {
8528          throw defaultReaderBrandCheckException('releaseLock');
8529        }
8530
8531        if (this._ownerReadableStream === undefined) {
8532          return;
8533        }
8534
8535        if (this._readRequests.length > 0) {
8536          throw new TypeError('Tried to release a reader lock when that reader has pending read() calls un-settled');
8537        }
8538
8539        ReadableStreamReaderGenericRelease(this);
8540      }
8541    }, {
8542      key: 'closed',
8543      get: function get() {
8544        if (IsReadableStreamDefaultReader(this) === false) {
8545          return Promise.reject(defaultReaderBrandCheckException('closed'));
8546        }
8547
8548        return this._closedPromise;
8549      }
8550    }]);
8551
8552    return ReadableStreamDefaultReader;
8553  }();
8554
8555  var ReadableStreamBYOBReader = function () {
8556    function ReadableStreamBYOBReader(stream) {
8557      _classCallCheck(this, ReadableStreamBYOBReader);
8558
8559      if (!IsReadableStream(stream)) {
8560        throw new TypeError('ReadableStreamBYOBReader can only be constructed with a ReadableStream instance given a ' + 'byte source');
8561      }
8562
8563      if (IsReadableByteStreamController(stream._readableStreamController) === false) {
8564        throw new TypeError('Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte ' + 'source');
8565      }
8566
8567      if (IsReadableStreamLocked(stream)) {
8568        throw new TypeError('This stream has already been locked for exclusive reading by another reader');
8569      }
8570
8571      ReadableStreamReaderGenericInitialize(this, stream);
8572      this._readIntoRequests = [];
8573    }
8574
8575    _createClass(ReadableStreamBYOBReader, [{
8576      key: 'cancel',
8577      value: function cancel(reason) {
8578        if (!IsReadableStreamBYOBReader(this)) {
8579          return Promise.reject(byobReaderBrandCheckException('cancel'));
8580        }
8581
8582        if (this._ownerReadableStream === undefined) {
8583          return Promise.reject(readerLockException('cancel'));
8584        }
8585
8586        return ReadableStreamReaderGenericCancel(this, reason);
8587      }
8588    }, {
8589      key: 'read',
8590      value: function read(view) {
8591        if (!IsReadableStreamBYOBReader(this)) {
8592          return Promise.reject(byobReaderBrandCheckException('read'));
8593        }
8594
8595        if (this._ownerReadableStream === undefined) {
8596          return Promise.reject(readerLockException('read from'));
8597        }
8598
8599        if (!ArrayBuffer.isView(view)) {
8600          return Promise.reject(new TypeError('view must be an array buffer view'));
8601        }
8602
8603        if (view.byteLength === 0) {
8604          return Promise.reject(new TypeError('view must have non-zero byteLength'));
8605        }
8606
8607        return ReadableStreamBYOBReaderRead(this, view);
8608      }
8609    }, {
8610      key: 'releaseLock',
8611      value: function releaseLock() {
8612        if (!IsReadableStreamBYOBReader(this)) {
8613          throw byobReaderBrandCheckException('releaseLock');
8614        }
8615
8616        if (this._ownerReadableStream === undefined) {
8617          return;
8618        }
8619
8620        if (this._readIntoRequests.length > 0) {
8621          throw new TypeError('Tried to release a reader lock when that reader has pending read() calls un-settled');
8622        }
8623
8624        ReadableStreamReaderGenericRelease(this);
8625      }
8626    }, {
8627      key: 'closed',
8628      get: function get() {
8629        if (!IsReadableStreamBYOBReader(this)) {
8630          return Promise.reject(byobReaderBrandCheckException('closed'));
8631        }
8632
8633        return this._closedPromise;
8634      }
8635    }]);
8636
8637    return ReadableStreamBYOBReader;
8638  }();
8639
8640  function IsReadableStreamBYOBReader(x) {
8641    if (!typeIsObject(x)) {
8642      return false;
8643    }
8644
8645    if (!Object.prototype.hasOwnProperty.call(x, '_readIntoRequests')) {
8646      return false;
8647    }
8648
8649    return true;
8650  }
8651
8652  function IsReadableStreamDefaultReader(x) {
8653    if (!typeIsObject(x)) {
8654      return false;
8655    }
8656
8657    if (!Object.prototype.hasOwnProperty.call(x, '_readRequests')) {
8658      return false;
8659    }
8660
8661    return true;
8662  }
8663
8664  function ReadableStreamReaderGenericInitialize(reader, stream) {
8665    reader._ownerReadableStream = stream;
8666    stream._reader = reader;
8667
8668    if (stream._state === 'readable') {
8669      defaultReaderClosedPromiseInitialize(reader);
8670    } else if (stream._state === 'closed') {
8671      defaultReaderClosedPromiseInitializeAsResolved(reader);
8672    } else {
8673      assert(stream._state === 'errored', 'state must be errored');
8674      defaultReaderClosedPromiseInitializeAsRejected(reader, stream._storedError);
8675
8676      reader._closedPromise["catch"](function () {});
8677    }
8678  }
8679
8680  function ReadableStreamReaderGenericCancel(reader, reason) {
8681    var stream = reader._ownerReadableStream;
8682    assert(stream !== undefined);
8683    return ReadableStreamCancel(stream, reason);
8684  }
8685
8686  function ReadableStreamReaderGenericRelease(reader) {
8687    assert(reader._ownerReadableStream !== undefined);
8688    assert(reader._ownerReadableStream._reader === reader);
8689
8690    if (reader._ownerReadableStream._state === 'readable') {
8691      defaultReaderClosedPromiseReject(reader, new TypeError('Reader was released and can no longer be used to monitor the stream\'s closedness'));
8692    } else {
8693      defaultReaderClosedPromiseResetToRejected(reader, new TypeError('Reader was released and can no longer be used to monitor the stream\'s closedness'));
8694    }
8695
8696    reader._closedPromise["catch"](function () {});
8697
8698    reader._ownerReadableStream._reader = undefined;
8699    reader._ownerReadableStream = undefined;
8700  }
8701
8702  function ReadableStreamBYOBReaderRead(reader, view) {
8703    var stream = reader._ownerReadableStream;
8704    assert(stream !== undefined);
8705    stream._disturbed = true;
8706
8707    if (stream._state === 'errored') {
8708      return Promise.reject(stream._storedError);
8709    }
8710
8711    return ReadableByteStreamControllerPullInto(stream._readableStreamController, view);
8712  }
8713
8714  function ReadableStreamDefaultReaderRead(reader) {
8715    var stream = reader._ownerReadableStream;
8716    assert(stream !== undefined);
8717    stream._disturbed = true;
8718
8719    if (stream._state === 'closed') {
8720      return Promise.resolve(CreateIterResultObject(undefined, true));
8721    }
8722
8723    if (stream._state === 'errored') {
8724      return Promise.reject(stream._storedError);
8725    }
8726
8727    assert(stream._state === 'readable');
8728    return stream._readableStreamController.__pullSteps();
8729  }
8730
8731  var ReadableStreamDefaultController = function () {
8732    function ReadableStreamDefaultController(stream, underlyingSource, size, highWaterMark) {
8733      _classCallCheck(this, ReadableStreamDefaultController);
8734
8735      if (IsReadableStream(stream) === false) {
8736        throw new TypeError('ReadableStreamDefaultController can only be constructed with a ReadableStream instance');
8737      }
8738
8739      if (stream._readableStreamController !== undefined) {
8740        throw new TypeError('ReadableStreamDefaultController instances can only be created by the ReadableStream constructor');
8741      }
8742
8743      this._controlledReadableStream = stream;
8744      this._underlyingSource = underlyingSource;
8745      this._queue = undefined;
8746      this._queueTotalSize = undefined;
8747      ResetQueue(this);
8748      this._started = false;
8749      this._closeRequested = false;
8750      this._pullAgain = false;
8751      this._pulling = false;
8752      var normalizedStrategy = ValidateAndNormalizeQueuingStrategy(size, highWaterMark);
8753      this._strategySize = normalizedStrategy.size;
8754      this._strategyHWM = normalizedStrategy.highWaterMark;
8755      var controller = this;
8756      var startResult = InvokeOrNoop(underlyingSource, 'start', [this]);
8757      Promise.resolve(startResult).then(function () {
8758        controller._started = true;
8759        assert(controller._pulling === false);
8760        assert(controller._pullAgain === false);
8761        ReadableStreamDefaultControllerCallPullIfNeeded(controller);
8762      }, function (r) {
8763        ReadableStreamDefaultControllerErrorIfNeeded(controller, r);
8764      })["catch"](rethrowAssertionErrorRejection);
8765    }
8766
8767    _createClass(ReadableStreamDefaultController, [{
8768      key: 'close',
8769      value: function close() {
8770        if (IsReadableStreamDefaultController(this) === false) {
8771          throw defaultControllerBrandCheckException('close');
8772        }
8773
8774        if (this._closeRequested === true) {
8775          throw new TypeError('The stream has already been closed; do not close it again!');
8776        }
8777
8778        var state = this._controlledReadableStream._state;
8779
8780        if (state !== 'readable') {
8781          throw new TypeError('The stream (in ' + state + ' state) is not in the readable state and cannot be closed');
8782        }
8783
8784        ReadableStreamDefaultControllerClose(this);
8785      }
8786    }, {
8787      key: 'enqueue',
8788      value: function enqueue(chunk) {
8789        if (IsReadableStreamDefaultController(this) === false) {
8790          throw defaultControllerBrandCheckException('enqueue');
8791        }
8792
8793        if (this._closeRequested === true) {
8794          throw new TypeError('stream is closed or draining');
8795        }
8796
8797        var state = this._controlledReadableStream._state;
8798
8799        if (state !== 'readable') {
8800          throw new TypeError('The stream (in ' + state + ' state) is not in the readable state and cannot be enqueued to');
8801        }
8802
8803        return ReadableStreamDefaultControllerEnqueue(this, chunk);
8804      }
8805    }, {
8806      key: 'error',
8807      value: function error(e) {
8808        if (IsReadableStreamDefaultController(this) === false) {
8809          throw defaultControllerBrandCheckException('error');
8810        }
8811
8812        var stream = this._controlledReadableStream;
8813
8814        if (stream._state !== 'readable') {
8815          throw new TypeError('The stream is ' + stream._state + ' and so cannot be errored');
8816        }
8817
8818        ReadableStreamDefaultControllerError(this, e);
8819      }
8820    }, {
8821      key: '__cancelSteps',
8822      value: function __cancelSteps(reason) {
8823        ResetQueue(this);
8824        return PromiseInvokeOrNoop(this._underlyingSource, 'cancel', [reason]);
8825      }
8826    }, {
8827      key: '__pullSteps',
8828      value: function __pullSteps() {
8829        var stream = this._controlledReadableStream;
8830
8831        if (this._queue.length > 0) {
8832          var chunk = DequeueValue(this);
8833
8834          if (this._closeRequested === true && this._queue.length === 0) {
8835            ReadableStreamClose(stream);
8836          } else {
8837            ReadableStreamDefaultControllerCallPullIfNeeded(this);
8838          }
8839
8840          return Promise.resolve(CreateIterResultObject(chunk, false));
8841        }
8842
8843        var pendingPromise = ReadableStreamAddReadRequest(stream);
8844        ReadableStreamDefaultControllerCallPullIfNeeded(this);
8845        return pendingPromise;
8846      }
8847    }, {
8848      key: 'desiredSize',
8849      get: function get() {
8850        if (IsReadableStreamDefaultController(this) === false) {
8851          throw defaultControllerBrandCheckException('desiredSize');
8852        }
8853
8854        return ReadableStreamDefaultControllerGetDesiredSize(this);
8855      }
8856    }]);
8857
8858    return ReadableStreamDefaultController;
8859  }();
8860
8861  function IsReadableStreamDefaultController(x) {
8862    if (!typeIsObject(x)) {
8863      return false;
8864    }
8865
8866    if (!Object.prototype.hasOwnProperty.call(x, '_underlyingSource')) {
8867      return false;
8868    }
8869
8870    return true;
8871  }
8872
8873  function ReadableStreamDefaultControllerCallPullIfNeeded(controller) {
8874    var shouldPull = ReadableStreamDefaultControllerShouldCallPull(controller);
8875
8876    if (shouldPull === false) {
8877      return undefined;
8878    }
8879
8880    if (controller._pulling === true) {
8881      controller._pullAgain = true;
8882      return undefined;
8883    }
8884
8885    assert(controller._pullAgain === false);
8886    controller._pulling = true;
8887    var pullPromise = PromiseInvokeOrNoop(controller._underlyingSource, 'pull', [controller]);
8888    pullPromise.then(function () {
8889      controller._pulling = false;
8890
8891      if (controller._pullAgain === true) {
8892        controller._pullAgain = false;
8893        return ReadableStreamDefaultControllerCallPullIfNeeded(controller);
8894      }
8895
8896      return undefined;
8897    }, function (e) {
8898      ReadableStreamDefaultControllerErrorIfNeeded(controller, e);
8899    })["catch"](rethrowAssertionErrorRejection);
8900    return undefined;
8901  }
8902
8903  function ReadableStreamDefaultControllerShouldCallPull(controller) {
8904    var stream = controller._controlledReadableStream;
8905
8906    if (stream._state === 'closed' || stream._state === 'errored') {
8907      return false;
8908    }
8909
8910    if (controller._closeRequested === true) {
8911      return false;
8912    }
8913
8914    if (controller._started === false) {
8915      return false;
8916    }
8917
8918    if (IsReadableStreamLocked(stream) === true && ReadableStreamGetNumReadRequests(stream) > 0) {
8919      return true;
8920    }
8921
8922    var desiredSize = ReadableStreamDefaultControllerGetDesiredSize(controller);
8923
8924    if (desiredSize > 0) {
8925      return true;
8926    }
8927
8928    return false;
8929  }
8930
8931  function ReadableStreamDefaultControllerClose(controller) {
8932    var stream = controller._controlledReadableStream;
8933    assert(controller._closeRequested === false);
8934    assert(stream._state === 'readable');
8935    controller._closeRequested = true;
8936
8937    if (controller._queue.length === 0) {
8938      ReadableStreamClose(stream);
8939    }
8940  }
8941
8942  function ReadableStreamDefaultControllerEnqueue(controller, chunk) {
8943    var stream = controller._controlledReadableStream;
8944    assert(controller._closeRequested === false);
8945    assert(stream._state === 'readable');
8946
8947    if (IsReadableStreamLocked(stream) === true && ReadableStreamGetNumReadRequests(stream) > 0) {
8948      ReadableStreamFulfillReadRequest(stream, chunk, false);
8949    } else {
8950      var chunkSize = 1;
8951
8952      if (controller._strategySize !== undefined) {
8953        var strategySize = controller._strategySize;
8954
8955        try {
8956          chunkSize = strategySize(chunk);
8957        } catch (chunkSizeE) {
8958          ReadableStreamDefaultControllerErrorIfNeeded(controller, chunkSizeE);
8959          throw chunkSizeE;
8960        }
8961      }
8962
8963      try {
8964        EnqueueValueWithSize(controller, chunk, chunkSize);
8965      } catch (enqueueE) {
8966        ReadableStreamDefaultControllerErrorIfNeeded(controller, enqueueE);
8967        throw enqueueE;
8968      }
8969    }
8970
8971    ReadableStreamDefaultControllerCallPullIfNeeded(controller);
8972    return undefined;
8973  }
8974
8975  function ReadableStreamDefaultControllerError(controller, e) {
8976    var stream = controller._controlledReadableStream;
8977    assert(stream._state === 'readable');
8978    ResetQueue(controller);
8979    ReadableStreamError(stream, e);
8980  }
8981
8982  function ReadableStreamDefaultControllerErrorIfNeeded(controller, e) {
8983    if (controller._controlledReadableStream._state === 'readable') {
8984      ReadableStreamDefaultControllerError(controller, e);
8985    }
8986  }
8987
8988  function ReadableStreamDefaultControllerGetDesiredSize(controller) {
8989    var stream = controller._controlledReadableStream;
8990    var state = stream._state;
8991
8992    if (state === 'errored') {
8993      return null;
8994    }
8995
8996    if (state === 'closed') {
8997      return 0;
8998    }
8999
9000    return controller._strategyHWM - controller._queueTotalSize;
9001  }
9002
9003  var ReadableStreamBYOBRequest = function () {
9004    function ReadableStreamBYOBRequest(controller, view) {
9005      _classCallCheck(this, ReadableStreamBYOBRequest);
9006
9007      this._associatedReadableByteStreamController = controller;
9008      this._view = view;
9009    }
9010
9011    _createClass(ReadableStreamBYOBRequest, [{
9012      key: 'respond',
9013      value: function respond(bytesWritten) {
9014        if (IsReadableStreamBYOBRequest(this) === false) {
9015          throw byobRequestBrandCheckException('respond');
9016        }
9017
9018        if (this._associatedReadableByteStreamController === undefined) {
9019          throw new TypeError('This BYOB request has been invalidated');
9020        }
9021
9022        ReadableByteStreamControllerRespond(this._associatedReadableByteStreamController, bytesWritten);
9023      }
9024    }, {
9025      key: 'respondWithNewView',
9026      value: function respondWithNewView(view) {
9027        if (IsReadableStreamBYOBRequest(this) === false) {
9028          throw byobRequestBrandCheckException('respond');
9029        }
9030
9031        if (this._associatedReadableByteStreamController === undefined) {
9032          throw new TypeError('This BYOB request has been invalidated');
9033        }
9034
9035        if (!ArrayBuffer.isView(view)) {
9036          throw new TypeError('You can only respond with array buffer views');
9037        }
9038
9039        ReadableByteStreamControllerRespondWithNewView(this._associatedReadableByteStreamController, view);
9040      }
9041    }, {
9042      key: 'view',
9043      get: function get() {
9044        return this._view;
9045      }
9046    }]);
9047
9048    return ReadableStreamBYOBRequest;
9049  }();
9050
9051  var ReadableByteStreamController = function () {
9052    function ReadableByteStreamController(stream, underlyingByteSource, highWaterMark) {
9053      _classCallCheck(this, ReadableByteStreamController);
9054
9055      if (IsReadableStream(stream) === false) {
9056        throw new TypeError('ReadableByteStreamController can only be constructed with a ReadableStream instance given ' + 'a byte source');
9057      }
9058
9059      if (stream._readableStreamController !== undefined) {
9060        throw new TypeError('ReadableByteStreamController instances can only be created by the ReadableStream constructor given a byte ' + 'source');
9061      }
9062
9063      this._controlledReadableStream = stream;
9064      this._underlyingByteSource = underlyingByteSource;
9065      this._pullAgain = false;
9066      this._pulling = false;
9067      ReadableByteStreamControllerClearPendingPullIntos(this);
9068      this._queue = this._queueTotalSize = undefined;
9069      ResetQueue(this);
9070      this._closeRequested = false;
9071      this._started = false;
9072      this._strategyHWM = ValidateAndNormalizeHighWaterMark(highWaterMark);
9073      var autoAllocateChunkSize = underlyingByteSource.autoAllocateChunkSize;
9074
9075      if (autoAllocateChunkSize !== undefined) {
9076        if (Number.isInteger(autoAllocateChunkSize) === false || autoAllocateChunkSize <= 0) {
9077          throw new RangeError('autoAllocateChunkSize must be a positive integer');
9078        }
9079      }
9080
9081      this._autoAllocateChunkSize = autoAllocateChunkSize;
9082      this._pendingPullIntos = [];
9083      var controller = this;
9084      var startResult = InvokeOrNoop(underlyingByteSource, 'start', [this]);
9085      Promise.resolve(startResult).then(function () {
9086        controller._started = true;
9087        assert(controller._pulling === false);
9088        assert(controller._pullAgain === false);
9089        ReadableByteStreamControllerCallPullIfNeeded(controller);
9090      }, function (r) {
9091        if (stream._state === 'readable') {
9092          ReadableByteStreamControllerError(controller, r);
9093        }
9094      })["catch"](rethrowAssertionErrorRejection);
9095    }
9096
9097    _createClass(ReadableByteStreamController, [{
9098      key: 'close',
9099      value: function close() {
9100        if (IsReadableByteStreamController(this) === false) {
9101          throw byteStreamControllerBrandCheckException('close');
9102        }
9103
9104        if (this._closeRequested === true) {
9105          throw new TypeError('The stream has already been closed; do not close it again!');
9106        }
9107
9108        var state = this._controlledReadableStream._state;
9109
9110        if (state !== 'readable') {
9111          throw new TypeError('The stream (in ' + state + ' state) is not in the readable state and cannot be closed');
9112        }
9113
9114        ReadableByteStreamControllerClose(this);
9115      }
9116    }, {
9117      key: 'enqueue',
9118      value: function enqueue(chunk) {
9119        if (IsReadableByteStreamController(this) === false) {
9120          throw byteStreamControllerBrandCheckException('enqueue');
9121        }
9122
9123        if (this._closeRequested === true) {
9124          throw new TypeError('stream is closed or draining');
9125        }
9126
9127        var state = this._controlledReadableStream._state;
9128
9129        if (state !== 'readable') {
9130          throw new TypeError('The stream (in ' + state + ' state) is not in the readable state and cannot be enqueued to');
9131        }
9132
9133        if (!ArrayBuffer.isView(chunk)) {
9134          throw new TypeError('You can only enqueue array buffer views when using a ReadableByteStreamController');
9135        }
9136
9137        ReadableByteStreamControllerEnqueue(this, chunk);
9138      }
9139    }, {
9140      key: 'error',
9141      value: function error(e) {
9142        if (IsReadableByteStreamController(this) === false) {
9143          throw byteStreamControllerBrandCheckException('error');
9144        }
9145
9146        var stream = this._controlledReadableStream;
9147
9148        if (stream._state !== 'readable') {
9149          throw new TypeError('The stream is ' + stream._state + ' and so cannot be errored');
9150        }
9151
9152        ReadableByteStreamControllerError(this, e);
9153      }
9154    }, {
9155      key: '__cancelSteps',
9156      value: function __cancelSteps(reason) {
9157        if (this._pendingPullIntos.length > 0) {
9158          var firstDescriptor = this._pendingPullIntos[0];
9159          firstDescriptor.bytesFilled = 0;
9160        }
9161
9162        ResetQueue(this);
9163        return PromiseInvokeOrNoop(this._underlyingByteSource, 'cancel', [reason]);
9164      }
9165    }, {
9166      key: '__pullSteps',
9167      value: function __pullSteps() {
9168        var stream = this._controlledReadableStream;
9169        assert(ReadableStreamHasDefaultReader(stream) === true);
9170
9171        if (this._queueTotalSize > 0) {
9172          assert(ReadableStreamGetNumReadRequests(stream) === 0);
9173
9174          var entry = this._queue.shift();
9175
9176          this._queueTotalSize -= entry.byteLength;
9177          ReadableByteStreamControllerHandleQueueDrain(this);
9178          var view = void 0;
9179
9180          try {
9181            view = new Uint8Array(entry.buffer, entry.byteOffset, entry.byteLength);
9182          } catch (viewE) {
9183            return Promise.reject(viewE);
9184          }
9185
9186          return Promise.resolve(CreateIterResultObject(view, false));
9187        }
9188
9189        var autoAllocateChunkSize = this._autoAllocateChunkSize;
9190
9191        if (autoAllocateChunkSize !== undefined) {
9192          var buffer = void 0;
9193
9194          try {
9195            buffer = new ArrayBuffer(autoAllocateChunkSize);
9196          } catch (bufferE) {
9197            return Promise.reject(bufferE);
9198          }
9199
9200          var pullIntoDescriptor = {
9201            buffer: buffer,
9202            byteOffset: 0,
9203            byteLength: autoAllocateChunkSize,
9204            bytesFilled: 0,
9205            elementSize: 1,
9206            ctor: Uint8Array,
9207            readerType: 'default'
9208          };
9209
9210          this._pendingPullIntos.push(pullIntoDescriptor);
9211        }
9212
9213        var promise = ReadableStreamAddReadRequest(stream);
9214        ReadableByteStreamControllerCallPullIfNeeded(this);
9215        return promise;
9216      }
9217    }, {
9218      key: 'byobRequest',
9219      get: function get() {
9220        if (IsReadableByteStreamController(this) === false) {
9221          throw byteStreamControllerBrandCheckException('byobRequest');
9222        }
9223
9224        if (this._byobRequest === undefined && this._pendingPullIntos.length > 0) {
9225          var firstDescriptor = this._pendingPullIntos[0];
9226          var view = new Uint8Array(firstDescriptor.buffer, firstDescriptor.byteOffset + firstDescriptor.bytesFilled, firstDescriptor.byteLength - firstDescriptor.bytesFilled);
9227          this._byobRequest = new ReadableStreamBYOBRequest(this, view);
9228        }
9229
9230        return this._byobRequest;
9231      }
9232    }, {
9233      key: 'desiredSize',
9234      get: function get() {
9235        if (IsReadableByteStreamController(this) === false) {
9236          throw byteStreamControllerBrandCheckException('desiredSize');
9237        }
9238
9239        return ReadableByteStreamControllerGetDesiredSize(this);
9240      }
9241    }]);
9242
9243    return ReadableByteStreamController;
9244  }();
9245
9246  function IsReadableByteStreamController(x) {
9247    if (!typeIsObject(x)) {
9248      return false;
9249    }
9250
9251    if (!Object.prototype.hasOwnProperty.call(x, '_underlyingByteSource')) {
9252      return false;
9253    }
9254
9255    return true;
9256  }
9257
9258  function IsReadableStreamBYOBRequest(x) {
9259    if (!typeIsObject(x)) {
9260      return false;
9261    }
9262
9263    if (!Object.prototype.hasOwnProperty.call(x, '_associatedReadableByteStreamController')) {
9264      return false;
9265    }
9266
9267    return true;
9268  }
9269
9270  function ReadableByteStreamControllerCallPullIfNeeded(controller) {
9271    var shouldPull = ReadableByteStreamControllerShouldCallPull(controller);
9272
9273    if (shouldPull === false) {
9274      return undefined;
9275    }
9276
9277    if (controller._pulling === true) {
9278      controller._pullAgain = true;
9279      return undefined;
9280    }
9281
9282    assert(controller._pullAgain === false);
9283    controller._pulling = true;
9284    var pullPromise = PromiseInvokeOrNoop(controller._underlyingByteSource, 'pull', [controller]);
9285    pullPromise.then(function () {
9286      controller._pulling = false;
9287
9288      if (controller._pullAgain === true) {
9289        controller._pullAgain = false;
9290        ReadableByteStreamControllerCallPullIfNeeded(controller);
9291      }
9292    }, function (e) {
9293      if (controller._controlledReadableStream._state === 'readable') {
9294        ReadableByteStreamControllerError(controller, e);
9295      }
9296    })["catch"](rethrowAssertionErrorRejection);
9297    return undefined;
9298  }
9299
9300  function ReadableByteStreamControllerClearPendingPullIntos(controller) {
9301    ReadableByteStreamControllerInvalidateBYOBRequest(controller);
9302    controller._pendingPullIntos = [];
9303  }
9304
9305  function ReadableByteStreamControllerCommitPullIntoDescriptor(stream, pullIntoDescriptor) {
9306    assert(stream._state !== 'errored', 'state must not be errored');
9307    var done = false;
9308
9309    if (stream._state === 'closed') {
9310      assert(pullIntoDescriptor.bytesFilled === 0);
9311      done = true;
9312    }
9313
9314    var filledView = ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor);
9315
9316    if (pullIntoDescriptor.readerType === 'default') {
9317      ReadableStreamFulfillReadRequest(stream, filledView, done);
9318    } else {
9319      assert(pullIntoDescriptor.readerType === 'byob');
9320      ReadableStreamFulfillReadIntoRequest(stream, filledView, done);
9321    }
9322  }
9323
9324  function ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor) {
9325    var bytesFilled = pullIntoDescriptor.bytesFilled;
9326    var elementSize = pullIntoDescriptor.elementSize;
9327    assert(bytesFilled <= pullIntoDescriptor.byteLength);
9328    assert(bytesFilled % elementSize === 0);
9329    return new pullIntoDescriptor.ctor(pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, bytesFilled / elementSize);
9330  }
9331
9332  function ReadableByteStreamControllerEnqueueChunkToQueue(controller, buffer, byteOffset, byteLength) {
9333    controller._queue.push({
9334      buffer: buffer,
9335      byteOffset: byteOffset,
9336      byteLength: byteLength
9337    });
9338
9339    controller._queueTotalSize += byteLength;
9340  }
9341
9342  function ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) {
9343    var elementSize = pullIntoDescriptor.elementSize;
9344    var currentAlignedBytes = pullIntoDescriptor.bytesFilled - pullIntoDescriptor.bytesFilled % elementSize;
9345    var maxBytesToCopy = Math.min(controller._queueTotalSize, pullIntoDescriptor.byteLength - pullIntoDescriptor.bytesFilled);
9346    var maxBytesFilled = pullIntoDescriptor.bytesFilled + maxBytesToCopy;
9347    var maxAlignedBytes = maxBytesFilled - maxBytesFilled % elementSize;
9348    var totalBytesToCopyRemaining = maxBytesToCopy;
9349    var ready = false;
9350
9351    if (maxAlignedBytes > currentAlignedBytes) {
9352      totalBytesToCopyRemaining = maxAlignedBytes - pullIntoDescriptor.bytesFilled;
9353      ready = true;
9354    }
9355
9356    var queue = controller._queue;
9357
9358    while (totalBytesToCopyRemaining > 0) {
9359      var headOfQueue = queue[0];
9360      var bytesToCopy = Math.min(totalBytesToCopyRemaining, headOfQueue.byteLength);
9361      var destStart = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;
9362      ArrayBufferCopy(pullIntoDescriptor.buffer, destStart, headOfQueue.buffer, headOfQueue.byteOffset, bytesToCopy);
9363
9364      if (headOfQueue.byteLength === bytesToCopy) {
9365        queue.shift();
9366      } else {
9367        headOfQueue.byteOffset += bytesToCopy;
9368        headOfQueue.byteLength -= bytesToCopy;
9369      }
9370
9371      controller._queueTotalSize -= bytesToCopy;
9372      ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesToCopy, pullIntoDescriptor);
9373      totalBytesToCopyRemaining -= bytesToCopy;
9374    }
9375
9376    if (ready === false) {
9377      assert(controller._queueTotalSize === 0, 'queue must be empty');
9378      assert(pullIntoDescriptor.bytesFilled > 0);
9379      assert(pullIntoDescriptor.bytesFilled < pullIntoDescriptor.elementSize);
9380    }
9381
9382    return ready;
9383  }
9384
9385  function ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, size, pullIntoDescriptor) {
9386    assert(controller._pendingPullIntos.length === 0 || controller._pendingPullIntos[0] === pullIntoDescriptor);
9387    ReadableByteStreamControllerInvalidateBYOBRequest(controller);
9388    pullIntoDescriptor.bytesFilled += size;
9389  }
9390
9391  function ReadableByteStreamControllerHandleQueueDrain(controller) {
9392    assert(controller._controlledReadableStream._state === 'readable');
9393
9394    if (controller._queueTotalSize === 0 && controller._closeRequested === true) {
9395      ReadableStreamClose(controller._controlledReadableStream);
9396    } else {
9397      ReadableByteStreamControllerCallPullIfNeeded(controller);
9398    }
9399  }
9400
9401  function ReadableByteStreamControllerInvalidateBYOBRequest(controller) {
9402    if (controller._byobRequest === undefined) {
9403      return;
9404    }
9405
9406    controller._byobRequest._associatedReadableByteStreamController = undefined;
9407    controller._byobRequest._view = undefined;
9408    controller._byobRequest = undefined;
9409  }
9410
9411  function ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller) {
9412    assert(controller._closeRequested === false);
9413
9414    while (controller._pendingPullIntos.length > 0) {
9415      if (controller._queueTotalSize === 0) {
9416        return;
9417      }
9418
9419      var pullIntoDescriptor = controller._pendingPullIntos[0];
9420
9421      if (ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) === true) {
9422        ReadableByteStreamControllerShiftPendingPullInto(controller);
9423        ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableStream, pullIntoDescriptor);
9424      }
9425    }
9426  }
9427
9428  function ReadableByteStreamControllerPullInto(controller, view) {
9429    var stream = controller._controlledReadableStream;
9430    var elementSize = 1;
9431
9432    if (view.constructor !== DataView) {
9433      elementSize = view.constructor.BYTES_PER_ELEMENT;
9434    }
9435
9436    var ctor = view.constructor;
9437    var pullIntoDescriptor = {
9438      buffer: view.buffer,
9439      byteOffset: view.byteOffset,
9440      byteLength: view.byteLength,
9441      bytesFilled: 0,
9442      elementSize: elementSize,
9443      ctor: ctor,
9444      readerType: 'byob'
9445    };
9446
9447    if (controller._pendingPullIntos.length > 0) {
9448      pullIntoDescriptor.buffer = TransferArrayBuffer(pullIntoDescriptor.buffer);
9449
9450      controller._pendingPullIntos.push(pullIntoDescriptor);
9451
9452      return ReadableStreamAddReadIntoRequest(stream);
9453    }
9454
9455    if (stream._state === 'closed') {
9456      var emptyView = new view.constructor(pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, 0);
9457      return Promise.resolve(CreateIterResultObject(emptyView, true));
9458    }
9459
9460    if (controller._queueTotalSize > 0) {
9461      if (ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) === true) {
9462        var filledView = ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor);
9463        ReadableByteStreamControllerHandleQueueDrain(controller);
9464        return Promise.resolve(CreateIterResultObject(filledView, false));
9465      }
9466
9467      if (controller._closeRequested === true) {
9468        var e = new TypeError('Insufficient bytes to fill elements in the given buffer');
9469        ReadableByteStreamControllerError(controller, e);
9470        return Promise.reject(e);
9471      }
9472    }
9473
9474    pullIntoDescriptor.buffer = TransferArrayBuffer(pullIntoDescriptor.buffer);
9475
9476    controller._pendingPullIntos.push(pullIntoDescriptor);
9477
9478    var promise = ReadableStreamAddReadIntoRequest(stream);
9479    ReadableByteStreamControllerCallPullIfNeeded(controller);
9480    return promise;
9481  }
9482
9483  function ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor) {
9484    firstDescriptor.buffer = TransferArrayBuffer(firstDescriptor.buffer);
9485    assert(firstDescriptor.bytesFilled === 0, 'bytesFilled must be 0');
9486    var stream = controller._controlledReadableStream;
9487
9488    if (ReadableStreamHasBYOBReader(stream) === true) {
9489      while (ReadableStreamGetNumReadIntoRequests(stream) > 0) {
9490        var pullIntoDescriptor = ReadableByteStreamControllerShiftPendingPullInto(controller);
9491        ReadableByteStreamControllerCommitPullIntoDescriptor(stream, pullIntoDescriptor);
9492      }
9493    }
9494  }
9495
9496  function ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, pullIntoDescriptor) {
9497    if (pullIntoDescriptor.bytesFilled + bytesWritten > pullIntoDescriptor.byteLength) {
9498      throw new RangeError('bytesWritten out of range');
9499    }
9500
9501    ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesWritten, pullIntoDescriptor);
9502
9503    if (pullIntoDescriptor.bytesFilled < pullIntoDescriptor.elementSize) {
9504      return;
9505    }
9506
9507    ReadableByteStreamControllerShiftPendingPullInto(controller);
9508    var remainderSize = pullIntoDescriptor.bytesFilled % pullIntoDescriptor.elementSize;
9509
9510    if (remainderSize > 0) {
9511      var end = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled;
9512      var remainder = pullIntoDescriptor.buffer.slice(end - remainderSize, end);
9513      ReadableByteStreamControllerEnqueueChunkToQueue(controller, remainder, 0, remainder.byteLength);
9514    }
9515
9516    pullIntoDescriptor.buffer = TransferArrayBuffer(pullIntoDescriptor.buffer);
9517    pullIntoDescriptor.bytesFilled -= remainderSize;
9518    ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableStream, pullIntoDescriptor);
9519    ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);
9520  }
9521
9522  function ReadableByteStreamControllerRespondInternal(controller, bytesWritten) {
9523    var firstDescriptor = controller._pendingPullIntos[0];
9524    var stream = controller._controlledReadableStream;
9525
9526    if (stream._state === 'closed') {
9527      if (bytesWritten !== 0) {
9528        throw new TypeError('bytesWritten must be 0 when calling respond() on a closed stream');
9529      }
9530
9531      ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor);
9532    } else {
9533      assert(stream._state === 'readable');
9534      ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, firstDescriptor);
9535    }
9536  }
9537
9538  function ReadableByteStreamControllerShiftPendingPullInto(controller) {
9539    var descriptor = controller._pendingPullIntos.shift();
9540
9541    ReadableByteStreamControllerInvalidateBYOBRequest(controller);
9542    return descriptor;
9543  }
9544
9545  function ReadableByteStreamControllerShouldCallPull(controller) {
9546    var stream = controller._controlledReadableStream;
9547
9548    if (stream._state !== 'readable') {
9549      return false;
9550    }
9551
9552    if (controller._closeRequested === true) {
9553      return false;
9554    }
9555
9556    if (controller._started === false) {
9557      return false;
9558    }
9559
9560    if (ReadableStreamHasDefaultReader(stream) === true && ReadableStreamGetNumReadRequests(stream) > 0) {
9561      return true;
9562    }
9563
9564    if (ReadableStreamHasBYOBReader(stream) === true && ReadableStreamGetNumReadIntoRequests(stream) > 0) {
9565      return true;
9566    }
9567
9568    if (ReadableByteStreamControllerGetDesiredSize(controller) > 0) {
9569      return true;
9570    }
9571
9572    return false;
9573  }
9574
9575  function ReadableByteStreamControllerClose(controller) {
9576    var stream = controller._controlledReadableStream;
9577    assert(controller._closeRequested === false);
9578    assert(stream._state === 'readable');
9579
9580    if (controller._queueTotalSize > 0) {
9581      controller._closeRequested = true;
9582      return;
9583    }
9584
9585    if (controller._pendingPullIntos.length > 0) {
9586      var firstPendingPullInto = controller._pendingPullIntos[0];
9587
9588      if (firstPendingPullInto.bytesFilled > 0) {
9589        var e = new TypeError('Insufficient bytes to fill elements in the given buffer');
9590        ReadableByteStreamControllerError(controller, e);
9591        throw e;
9592      }
9593    }
9594
9595    ReadableStreamClose(stream);
9596  }
9597
9598  function ReadableByteStreamControllerEnqueue(controller, chunk) {
9599    var stream = controller._controlledReadableStream;
9600    assert(controller._closeRequested === false);
9601    assert(stream._state === 'readable');
9602    var buffer = chunk.buffer;
9603    var byteOffset = chunk.byteOffset;
9604    var byteLength = chunk.byteLength;
9605    var transferredBuffer = TransferArrayBuffer(buffer);
9606
9607    if (ReadableStreamHasDefaultReader(stream) === true) {
9608      if (ReadableStreamGetNumReadRequests(stream) === 0) {
9609        ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);
9610      } else {
9611        assert(controller._queue.length === 0);
9612        var transferredView = new Uint8Array(transferredBuffer, byteOffset, byteLength);
9613        ReadableStreamFulfillReadRequest(stream, transferredView, false);
9614      }
9615    } else if (ReadableStreamHasBYOBReader(stream) === true) {
9616      ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);
9617      ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller);
9618    } else {
9619      assert(IsReadableStreamLocked(stream) === false, 'stream must not be locked');
9620      ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength);
9621    }
9622  }
9623
9624  function ReadableByteStreamControllerError(controller, e) {
9625    var stream = controller._controlledReadableStream;
9626    assert(stream._state === 'readable');
9627    ReadableByteStreamControllerClearPendingPullIntos(controller);
9628    ResetQueue(controller);
9629    ReadableStreamError(stream, e);
9630  }
9631
9632  function ReadableByteStreamControllerGetDesiredSize(controller) {
9633    var stream = controller._controlledReadableStream;
9634    var state = stream._state;
9635
9636    if (state === 'errored') {
9637      return null;
9638    }
9639
9640    if (state === 'closed') {
9641      return 0;
9642    }
9643
9644    return controller._strategyHWM - controller._queueTotalSize;
9645  }
9646
9647  function ReadableByteStreamControllerRespond(controller, bytesWritten) {
9648    bytesWritten = Number(bytesWritten);
9649
9650    if (IsFiniteNonNegativeNumber(bytesWritten) === false) {
9651      throw new RangeError('bytesWritten must be a finite');
9652    }
9653
9654    assert(controller._pendingPullIntos.length > 0);
9655    ReadableByteStreamControllerRespondInternal(controller, bytesWritten);
9656  }
9657
9658  function ReadableByteStreamControllerRespondWithNewView(controller, view) {
9659    assert(controller._pendingPullIntos.length > 0);
9660    var firstDescriptor = controller._pendingPullIntos[0];
9661
9662    if (firstDescriptor.byteOffset + firstDescriptor.bytesFilled !== view.byteOffset) {
9663      throw new RangeError('The region specified by view does not match byobRequest');
9664    }
9665
9666    if (firstDescriptor.byteLength !== view.byteLength) {
9667      throw new RangeError('The buffer of view has different capacity than byobRequest');
9668    }
9669
9670    firstDescriptor.buffer = view.buffer;
9671    ReadableByteStreamControllerRespondInternal(controller, view.byteLength);
9672  }
9673
9674  function streamBrandCheckException(name) {
9675    return new TypeError('ReadableStream.prototype.' + name + ' can only be used on a ReadableStream');
9676  }
9677
9678  function readerLockException(name) {
9679    return new TypeError('Cannot ' + name + ' a stream using a released reader');
9680  }
9681
9682  function defaultReaderBrandCheckException(name) {
9683    return new TypeError('ReadableStreamDefaultReader.prototype.' + name + ' can only be used on a ReadableStreamDefaultReader');
9684  }
9685
9686  function defaultReaderClosedPromiseInitialize(reader) {
9687    reader._closedPromise = new Promise(function (resolve, reject) {
9688      reader._closedPromise_resolve = resolve;
9689      reader._closedPromise_reject = reject;
9690    });
9691  }
9692
9693  function defaultReaderClosedPromiseInitializeAsRejected(reader, reason) {
9694    reader._closedPromise = Promise.reject(reason);
9695    reader._closedPromise_resolve = undefined;
9696    reader._closedPromise_reject = undefined;
9697  }
9698
9699  function defaultReaderClosedPromiseInitializeAsResolved(reader) {
9700    reader._closedPromise = Promise.resolve(undefined);
9701    reader._closedPromise_resolve = undefined;
9702    reader._closedPromise_reject = undefined;
9703  }
9704
9705  function defaultReaderClosedPromiseReject(reader, reason) {
9706    assert(reader._closedPromise_resolve !== undefined);
9707    assert(reader._closedPromise_reject !== undefined);
9708
9709    reader._closedPromise_reject(reason);
9710
9711    reader._closedPromise_resolve = undefined;
9712    reader._closedPromise_reject = undefined;
9713  }
9714
9715  function defaultReaderClosedPromiseResetToRejected(reader, reason) {
9716    assert(reader._closedPromise_resolve === undefined);
9717    assert(reader._closedPromise_reject === undefined);
9718    reader._closedPromise = Promise.reject(reason);
9719  }
9720
9721  function defaultReaderClosedPromiseResolve(reader) {
9722    assert(reader._closedPromise_resolve !== undefined);
9723    assert(reader._closedPromise_reject !== undefined);
9724
9725    reader._closedPromise_resolve(undefined);
9726
9727    reader._closedPromise_resolve = undefined;
9728    reader._closedPromise_reject = undefined;
9729  }
9730
9731  function byobReaderBrandCheckException(name) {
9732    return new TypeError('ReadableStreamBYOBReader.prototype.' + name + ' can only be used on a ReadableStreamBYOBReader');
9733  }
9734
9735  function defaultControllerBrandCheckException(name) {
9736    return new TypeError('ReadableStreamDefaultController.prototype.' + name + ' can only be used on a ReadableStreamDefaultController');
9737  }
9738
9739  function byobRequestBrandCheckException(name) {
9740    return new TypeError('ReadableStreamBYOBRequest.prototype.' + name + ' can only be used on a ReadableStreamBYOBRequest');
9741  }
9742
9743  function byteStreamControllerBrandCheckException(name) {
9744    return new TypeError('ReadableByteStreamController.prototype.' + name + ' can only be used on a ReadableByteStreamController');
9745  }
9746
9747  function ifIsObjectAndHasAPromiseIsHandledInternalSlotSetPromiseIsHandledToTrue(promise) {
9748    try {
9749      Promise.prototype.then.call(promise, undefined, function () {});
9750    } catch (e) {}
9751  }
9752}, function (module, exports, __w_pdfjs_require__) {
9753  "use strict";
9754
9755  var transformStream = __w_pdfjs_require__(6);
9756
9757  var readableStream = __w_pdfjs_require__(4);
9758
9759  var writableStream = __w_pdfjs_require__(2);
9760
9761  exports.TransformStream = transformStream.TransformStream;
9762  exports.ReadableStream = readableStream.ReadableStream;
9763  exports.IsReadableStreamDisturbed = readableStream.IsReadableStreamDisturbed;
9764  exports.ReadableStreamDefaultControllerClose = readableStream.ReadableStreamDefaultControllerClose;
9765  exports.ReadableStreamDefaultControllerEnqueue = readableStream.ReadableStreamDefaultControllerEnqueue;
9766  exports.ReadableStreamDefaultControllerError = readableStream.ReadableStreamDefaultControllerError;
9767  exports.ReadableStreamDefaultControllerGetDesiredSize = readableStream.ReadableStreamDefaultControllerGetDesiredSize;
9768  exports.AcquireWritableStreamDefaultWriter = writableStream.AcquireWritableStreamDefaultWriter;
9769  exports.IsWritableStream = writableStream.IsWritableStream;
9770  exports.IsWritableStreamLocked = writableStream.IsWritableStreamLocked;
9771  exports.WritableStream = writableStream.WritableStream;
9772  exports.WritableStreamAbort = writableStream.WritableStreamAbort;
9773  exports.WritableStreamDefaultControllerError = writableStream.WritableStreamDefaultControllerError;
9774  exports.WritableStreamDefaultWriterCloseWithErrorPropagation = writableStream.WritableStreamDefaultWriterCloseWithErrorPropagation;
9775  exports.WritableStreamDefaultWriterRelease = writableStream.WritableStreamDefaultWriterRelease;
9776  exports.WritableStreamDefaultWriterWrite = writableStream.WritableStreamDefaultWriterWrite;
9777}, function (module, exports, __w_pdfjs_require__) {
9778  "use strict";
9779
9780  var _createClass = function () {
9781    function defineProperties(target, props) {
9782      for (var i = 0; i < props.length; i++) {
9783        var descriptor = props[i];
9784        descriptor.enumerable = descriptor.enumerable || false;
9785        descriptor.configurable = true;
9786        if ("value" in descriptor) descriptor.writable = true;
9787        Object.defineProperty(target, descriptor.key, descriptor);
9788      }
9789    }
9790
9791    return function (Constructor, protoProps, staticProps) {
9792      if (protoProps) defineProperties(Constructor.prototype, protoProps);
9793      if (staticProps) defineProperties(Constructor, staticProps);
9794      return Constructor;
9795    };
9796  }();
9797
9798  function _classCallCheck(instance, Constructor) {
9799    if (!(instance instanceof Constructor)) {
9800      throw new TypeError("Cannot call a class as a function");
9801    }
9802  }
9803
9804  var _require = __w_pdfjs_require__(1),
9805      assert = _require.assert;
9806
9807  var _require2 = __w_pdfjs_require__(0),
9808      InvokeOrNoop = _require2.InvokeOrNoop,
9809      PromiseInvokeOrPerformFallback = _require2.PromiseInvokeOrPerformFallback,
9810      PromiseInvokeOrNoop = _require2.PromiseInvokeOrNoop,
9811      typeIsObject = _require2.typeIsObject;
9812
9813  var _require3 = __w_pdfjs_require__(4),
9814      ReadableStream = _require3.ReadableStream,
9815      ReadableStreamDefaultControllerClose = _require3.ReadableStreamDefaultControllerClose,
9816      ReadableStreamDefaultControllerEnqueue = _require3.ReadableStreamDefaultControllerEnqueue,
9817      ReadableStreamDefaultControllerError = _require3.ReadableStreamDefaultControllerError,
9818      ReadableStreamDefaultControllerGetDesiredSize = _require3.ReadableStreamDefaultControllerGetDesiredSize;
9819
9820  var _require4 = __w_pdfjs_require__(2),
9821      WritableStream = _require4.WritableStream,
9822      WritableStreamDefaultControllerError = _require4.WritableStreamDefaultControllerError;
9823
9824  function TransformStreamCloseReadable(transformStream) {
9825    if (transformStream._errored === true) {
9826      throw new TypeError('TransformStream is already errored');
9827    }
9828
9829    if (transformStream._readableClosed === true) {
9830      throw new TypeError('Readable side is already closed');
9831    }
9832
9833    TransformStreamCloseReadableInternal(transformStream);
9834  }
9835
9836  function TransformStreamEnqueueToReadable(transformStream, chunk) {
9837    if (transformStream._errored === true) {
9838      throw new TypeError('TransformStream is already errored');
9839    }
9840
9841    if (transformStream._readableClosed === true) {
9842      throw new TypeError('Readable side is already closed');
9843    }
9844
9845    var controller = transformStream._readableController;
9846
9847    try {
9848      ReadableStreamDefaultControllerEnqueue(controller, chunk);
9849    } catch (e) {
9850      transformStream._readableClosed = true;
9851      TransformStreamErrorIfNeeded(transformStream, e);
9852      throw transformStream._storedError;
9853    }
9854
9855    var desiredSize = ReadableStreamDefaultControllerGetDesiredSize(controller);
9856    var maybeBackpressure = desiredSize <= 0;
9857
9858    if (maybeBackpressure === true && transformStream._backpressure === false) {
9859      TransformStreamSetBackpressure(transformStream, true);
9860    }
9861  }
9862
9863  function TransformStreamError(transformStream, e) {
9864    if (transformStream._errored === true) {
9865      throw new TypeError('TransformStream is already errored');
9866    }
9867
9868    TransformStreamErrorInternal(transformStream, e);
9869  }
9870
9871  function TransformStreamCloseReadableInternal(transformStream) {
9872    assert(transformStream._errored === false);
9873    assert(transformStream._readableClosed === false);
9874
9875    try {
9876      ReadableStreamDefaultControllerClose(transformStream._readableController);
9877    } catch (e) {
9878      assert(false);
9879    }
9880
9881    transformStream._readableClosed = true;
9882  }
9883
9884  function TransformStreamErrorIfNeeded(transformStream, e) {
9885    if (transformStream._errored === false) {
9886      TransformStreamErrorInternal(transformStream, e);
9887    }
9888  }
9889
9890  function TransformStreamErrorInternal(transformStream, e) {
9891    assert(transformStream._errored === false);
9892    transformStream._errored = true;
9893    transformStream._storedError = e;
9894
9895    if (transformStream._writableDone === false) {
9896      WritableStreamDefaultControllerError(transformStream._writableController, e);
9897    }
9898
9899    if (transformStream._readableClosed === false) {
9900      ReadableStreamDefaultControllerError(transformStream._readableController, e);
9901    }
9902  }
9903
9904  function TransformStreamReadableReadyPromise(transformStream) {
9905    assert(transformStream._backpressureChangePromise !== undefined, '_backpressureChangePromise should have been initialized');
9906
9907    if (transformStream._backpressure === false) {
9908      return Promise.resolve();
9909    }
9910
9911    assert(transformStream._backpressure === true, '_backpressure should have been initialized');
9912    return transformStream._backpressureChangePromise;
9913  }
9914
9915  function TransformStreamSetBackpressure(transformStream, backpressure) {
9916    assert(transformStream._backpressure !== backpressure, 'TransformStreamSetBackpressure() should be called only when backpressure is changed');
9917
9918    if (transformStream._backpressureChangePromise !== undefined) {
9919      transformStream._backpressureChangePromise_resolve(backpressure);
9920    }
9921
9922    transformStream._backpressureChangePromise = new Promise(function (resolve) {
9923      transformStream._backpressureChangePromise_resolve = resolve;
9924    });
9925
9926    transformStream._backpressureChangePromise.then(function (resolution) {
9927      assert(resolution !== backpressure, '_backpressureChangePromise should be fulfilled only when backpressure is changed');
9928    });
9929
9930    transformStream._backpressure = backpressure;
9931  }
9932
9933  function TransformStreamDefaultTransform(chunk, transformStreamController) {
9934    var transformStream = transformStreamController._controlledTransformStream;
9935    TransformStreamEnqueueToReadable(transformStream, chunk);
9936    return Promise.resolve();
9937  }
9938
9939  function TransformStreamTransform(transformStream, chunk) {
9940    assert(transformStream._errored === false);
9941    assert(transformStream._transforming === false);
9942    assert(transformStream._backpressure === false);
9943    transformStream._transforming = true;
9944    var transformer = transformStream._transformer;
9945    var controller = transformStream._transformStreamController;
9946    var transformPromise = PromiseInvokeOrPerformFallback(transformer, 'transform', [chunk, controller], TransformStreamDefaultTransform, [chunk, controller]);
9947    return transformPromise.then(function () {
9948      transformStream._transforming = false;
9949      return TransformStreamReadableReadyPromise(transformStream);
9950    }, function (e) {
9951      TransformStreamErrorIfNeeded(transformStream, e);
9952      return Promise.reject(e);
9953    });
9954  }
9955
9956  function IsTransformStreamDefaultController(x) {
9957    if (!typeIsObject(x)) {
9958      return false;
9959    }
9960
9961    if (!Object.prototype.hasOwnProperty.call(x, '_controlledTransformStream')) {
9962      return false;
9963    }
9964
9965    return true;
9966  }
9967
9968  function IsTransformStream(x) {
9969    if (!typeIsObject(x)) {
9970      return false;
9971    }
9972
9973    if (!Object.prototype.hasOwnProperty.call(x, '_transformStreamController')) {
9974      return false;
9975    }
9976
9977    return true;
9978  }
9979
9980  var TransformStreamSink = function () {
9981    function TransformStreamSink(transformStream, startPromise) {
9982      _classCallCheck(this, TransformStreamSink);
9983
9984      this._transformStream = transformStream;
9985      this._startPromise = startPromise;
9986    }
9987
9988    _createClass(TransformStreamSink, [{
9989      key: 'start',
9990      value: function start(c) {
9991        var transformStream = this._transformStream;
9992        transformStream._writableController = c;
9993        return this._startPromise.then(function () {
9994          return TransformStreamReadableReadyPromise(transformStream);
9995        });
9996      }
9997    }, {
9998      key: 'write',
9999      value: function write(chunk) {
10000        var transformStream = this._transformStream;
10001        return TransformStreamTransform(transformStream, chunk);
10002      }
10003    }, {
10004      key: 'abort',
10005      value: function abort() {
10006        var transformStream = this._transformStream;
10007        transformStream._writableDone = true;
10008        TransformStreamErrorInternal(transformStream, new TypeError('Writable side aborted'));
10009      }
10010    }, {
10011      key: 'close',
10012      value: function close() {
10013        var transformStream = this._transformStream;
10014        assert(transformStream._transforming === false);
10015        transformStream._writableDone = true;
10016        var flushPromise = PromiseInvokeOrNoop(transformStream._transformer, 'flush', [transformStream._transformStreamController]);
10017        return flushPromise.then(function () {
10018          if (transformStream._errored === true) {
10019            return Promise.reject(transformStream._storedError);
10020          }
10021
10022          if (transformStream._readableClosed === false) {
10023            TransformStreamCloseReadableInternal(transformStream);
10024          }
10025
10026          return Promise.resolve();
10027        })["catch"](function (r) {
10028          TransformStreamErrorIfNeeded(transformStream, r);
10029          return Promise.reject(transformStream._storedError);
10030        });
10031      }
10032    }]);
10033
10034    return TransformStreamSink;
10035  }();
10036
10037  var TransformStreamSource = function () {
10038    function TransformStreamSource(transformStream, startPromise) {
10039      _classCallCheck(this, TransformStreamSource);
10040
10041      this._transformStream = transformStream;
10042      this._startPromise = startPromise;
10043    }
10044
10045    _createClass(TransformStreamSource, [{
10046      key: 'start',
10047      value: function start(c) {
10048        var transformStream = this._transformStream;
10049        transformStream._readableController = c;
10050        return this._startPromise.then(function () {
10051          assert(transformStream._backpressureChangePromise !== undefined, '_backpressureChangePromise should have been initialized');
10052
10053          if (transformStream._backpressure === true) {
10054            return Promise.resolve();
10055          }
10056
10057          assert(transformStream._backpressure === false, '_backpressure should have been initialized');
10058          return transformStream._backpressureChangePromise;
10059        });
10060      }
10061    }, {
10062      key: 'pull',
10063      value: function pull() {
10064        var transformStream = this._transformStream;
10065        assert(transformStream._backpressure === true, 'pull() should be never called while _backpressure is false');
10066        assert(transformStream._backpressureChangePromise !== undefined, '_backpressureChangePromise should have been initialized');
10067        TransformStreamSetBackpressure(transformStream, false);
10068        return transformStream._backpressureChangePromise;
10069      }
10070    }, {
10071      key: 'cancel',
10072      value: function cancel() {
10073        var transformStream = this._transformStream;
10074        transformStream._readableClosed = true;
10075        TransformStreamErrorInternal(transformStream, new TypeError('Readable side canceled'));
10076      }
10077    }]);
10078
10079    return TransformStreamSource;
10080  }();
10081
10082  var TransformStreamDefaultController = function () {
10083    function TransformStreamDefaultController(transformStream) {
10084      _classCallCheck(this, TransformStreamDefaultController);
10085
10086      if (IsTransformStream(transformStream) === false) {
10087        throw new TypeError('TransformStreamDefaultController can only be ' + 'constructed with a TransformStream instance');
10088      }
10089
10090      if (transformStream._transformStreamController !== undefined) {
10091        throw new TypeError('TransformStreamDefaultController instances can ' + 'only be created by the TransformStream constructor');
10092      }
10093
10094      this._controlledTransformStream = transformStream;
10095    }
10096
10097    _createClass(TransformStreamDefaultController, [{
10098      key: 'enqueue',
10099      value: function enqueue(chunk) {
10100        if (IsTransformStreamDefaultController(this) === false) {
10101          throw defaultControllerBrandCheckException('enqueue');
10102        }
10103
10104        TransformStreamEnqueueToReadable(this._controlledTransformStream, chunk);
10105      }
10106    }, {
10107      key: 'close',
10108      value: function close() {
10109        if (IsTransformStreamDefaultController(this) === false) {
10110          throw defaultControllerBrandCheckException('close');
10111        }
10112
10113        TransformStreamCloseReadable(this._controlledTransformStream);
10114      }
10115    }, {
10116      key: 'error',
10117      value: function error(reason) {
10118        if (IsTransformStreamDefaultController(this) === false) {
10119          throw defaultControllerBrandCheckException('error');
10120        }
10121
10122        TransformStreamError(this._controlledTransformStream, reason);
10123      }
10124    }, {
10125      key: 'desiredSize',
10126      get: function get() {
10127        if (IsTransformStreamDefaultController(this) === false) {
10128          throw defaultControllerBrandCheckException('desiredSize');
10129        }
10130
10131        var transformStream = this._controlledTransformStream;
10132        var readableController = transformStream._readableController;
10133        return ReadableStreamDefaultControllerGetDesiredSize(readableController);
10134      }
10135    }]);
10136
10137    return TransformStreamDefaultController;
10138  }();
10139
10140  var TransformStream = function () {
10141    function TransformStream() {
10142      var transformer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
10143
10144      _classCallCheck(this, TransformStream);
10145
10146      this._transformer = transformer;
10147      var readableStrategy = transformer.readableStrategy,
10148          writableStrategy = transformer.writableStrategy;
10149      this._transforming = false;
10150      this._errored = false;
10151      this._storedError = undefined;
10152      this._writableController = undefined;
10153      this._readableController = undefined;
10154      this._transformStreamController = undefined;
10155      this._writableDone = false;
10156      this._readableClosed = false;
10157      this._backpressure = undefined;
10158      this._backpressureChangePromise = undefined;
10159      this._backpressureChangePromise_resolve = undefined;
10160      this._transformStreamController = new TransformStreamDefaultController(this);
10161      var startPromise_resolve = void 0;
10162      var startPromise = new Promise(function (resolve) {
10163        startPromise_resolve = resolve;
10164      });
10165      var source = new TransformStreamSource(this, startPromise);
10166      this._readable = new ReadableStream(source, readableStrategy);
10167      var sink = new TransformStreamSink(this, startPromise);
10168      this._writable = new WritableStream(sink, writableStrategy);
10169      assert(this._writableController !== undefined);
10170      assert(this._readableController !== undefined);
10171      var desiredSize = ReadableStreamDefaultControllerGetDesiredSize(this._readableController);
10172      TransformStreamSetBackpressure(this, desiredSize <= 0);
10173      var transformStream = this;
10174      var startResult = InvokeOrNoop(transformer, 'start', [transformStream._transformStreamController]);
10175      startPromise_resolve(startResult);
10176      startPromise["catch"](function (e) {
10177        if (transformStream._errored === false) {
10178          transformStream._errored = true;
10179          transformStream._storedError = e;
10180        }
10181      });
10182    }
10183
10184    _createClass(TransformStream, [{
10185      key: 'readable',
10186      get: function get() {
10187        if (IsTransformStream(this) === false) {
10188          throw streamBrandCheckException('readable');
10189        }
10190
10191        return this._readable;
10192      }
10193    }, {
10194      key: 'writable',
10195      get: function get() {
10196        if (IsTransformStream(this) === false) {
10197          throw streamBrandCheckException('writable');
10198        }
10199
10200        return this._writable;
10201      }
10202    }]);
10203
10204    return TransformStream;
10205  }();
10206
10207  module.exports = {
10208    TransformStream: TransformStream
10209  };
10210
10211  function defaultControllerBrandCheckException(name) {
10212    return new TypeError('TransformStreamDefaultController.prototype.' + name + ' can only be used on a TransformStreamDefaultController');
10213  }
10214
10215  function streamBrandCheckException(name) {
10216    return new TypeError('TransformStream.prototype.' + name + ' can only be used on a TransformStream');
10217  }
10218}, function (module, exports, __w_pdfjs_require__) {
10219  module.exports = __w_pdfjs_require__(5);
10220}]));
10221
10222/***/ }),
10223/* 149 */
10224/***/ (function(module, exports, __w_pdfjs_require__) {
10225
10226"use strict";
10227
10228
10229function _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); }
10230
10231{
10232  var isURLSupported = false;
10233
10234  try {
10235    if (typeof URL === 'function' && _typeof(URL.prototype) === 'object' && 'origin' in URL.prototype) {
10236      var u = new URL('b', 'http://a');
10237      u.pathname = 'c%20d';
10238      isURLSupported = u.href === 'http://a/c%20d';
10239    }
10240  } catch (ex) {}
10241
10242  if (isURLSupported) {
10243    exports.URL = URL;
10244  } else {
10245    var PolyfillURL = __w_pdfjs_require__(150).URL;
10246
10247    var OriginalURL = __w_pdfjs_require__(7).URL;
10248
10249    if (OriginalURL) {
10250      PolyfillURL.createObjectURL = function (blob) {
10251        return OriginalURL.createObjectURL.apply(OriginalURL, arguments);
10252      };
10253
10254      PolyfillURL.revokeObjectURL = function (url) {
10255        OriginalURL.revokeObjectURL(url);
10256      };
10257    }
10258
10259    exports.URL = PolyfillURL;
10260  }
10261}
10262
10263/***/ }),
10264/* 150 */
10265/***/ (function(module, exports, __w_pdfjs_require__) {
10266
10267"use strict";
10268
10269
10270(function URLConstructorClosure() {
10271  'use strict';
10272
10273  var relative = Object.create(null);
10274  relative['ftp'] = 21;
10275  relative['file'] = 0;
10276  relative['gopher'] = 70;
10277  relative['http'] = 80;
10278  relative['https'] = 443;
10279  relative['ws'] = 80;
10280  relative['wss'] = 443;
10281  var relativePathDotMapping = Object.create(null);
10282  relativePathDotMapping['%2e'] = '.';
10283  relativePathDotMapping['.%2e'] = '..';
10284  relativePathDotMapping['%2e.'] = '..';
10285  relativePathDotMapping['%2e%2e'] = '..';
10286
10287  function isRelativeScheme(scheme) {
10288    return relative[scheme] !== undefined;
10289  }
10290
10291  function invalid() {
10292    clear.call(this);
10293    this._isInvalid = true;
10294  }
10295
10296  function IDNAToASCII(h) {
10297    if (h === '') {
10298      invalid.call(this);
10299    }
10300
10301    return h.toLowerCase();
10302  }
10303
10304  function percentEscape(c) {
10305    var unicode = c.charCodeAt(0);
10306
10307    if (unicode > 0x20 && unicode < 0x7F && [0x22, 0x23, 0x3C, 0x3E, 0x3F, 0x60].indexOf(unicode) === -1) {
10308      return c;
10309    }
10310
10311    return encodeURIComponent(c);
10312  }
10313
10314  function percentEscapeQuery(c) {
10315    var unicode = c.charCodeAt(0);
10316
10317    if (unicode > 0x20 && unicode < 0x7F && [0x22, 0x23, 0x3C, 0x3E, 0x60].indexOf(unicode) === -1) {
10318      return c;
10319    }
10320
10321    return encodeURIComponent(c);
10322  }
10323
10324  var EOF,
10325      ALPHA = /[a-zA-Z]/,
10326      ALPHANUMERIC = /[a-zA-Z0-9\+\-\.]/;
10327
10328  function parse(input, stateOverride, base) {
10329    function err(message) {
10330      errors.push(message);
10331    }
10332
10333    var state = stateOverride || 'scheme start',
10334        cursor = 0,
10335        buffer = '',
10336        seenAt = false,
10337        seenBracket = false,
10338        errors = [];
10339
10340    loop: while ((input[cursor - 1] !== EOF || cursor === 0) && !this._isInvalid) {
10341      var c = input[cursor];
10342
10343      switch (state) {
10344        case 'scheme start':
10345          if (c && ALPHA.test(c)) {
10346            buffer += c.toLowerCase();
10347            state = 'scheme';
10348          } else if (!stateOverride) {
10349            buffer = '';
10350            state = 'no scheme';
10351            continue;
10352          } else {
10353            err('Invalid scheme.');
10354            break loop;
10355          }
10356
10357          break;
10358
10359        case 'scheme':
10360          if (c && ALPHANUMERIC.test(c)) {
10361            buffer += c.toLowerCase();
10362          } else if (c === ':') {
10363            this._scheme = buffer;
10364            buffer = '';
10365
10366            if (stateOverride) {
10367              break loop;
10368            }
10369
10370            if (isRelativeScheme(this._scheme)) {
10371              this._isRelative = true;
10372            }
10373
10374            if (this._scheme === 'file') {
10375              state = 'relative';
10376            } else if (this._isRelative && base && base._scheme === this._scheme) {
10377              state = 'relative or authority';
10378            } else if (this._isRelative) {
10379              state = 'authority first slash';
10380            } else {
10381              state = 'scheme data';
10382            }
10383          } else if (!stateOverride) {
10384            buffer = '';
10385            cursor = 0;
10386            state = 'no scheme';
10387            continue;
10388          } else if (c === EOF) {
10389            break loop;
10390          } else {
10391            err('Code point not allowed in scheme: ' + c);
10392            break loop;
10393          }
10394
10395          break;
10396
10397        case 'scheme data':
10398          if (c === '?') {
10399            this._query = '?';
10400            state = 'query';
10401          } else if (c === '#') {
10402            this._fragment = '#';
10403            state = 'fragment';
10404          } else {
10405            if (c !== EOF && c !== '\t' && c !== '\n' && c !== '\r') {
10406              this._schemeData += percentEscape(c);
10407            }
10408          }
10409
10410          break;
10411
10412        case 'no scheme':
10413          if (!base || !isRelativeScheme(base._scheme)) {
10414            err('Missing scheme.');
10415            invalid.call(this);
10416          } else {
10417            state = 'relative';
10418            continue;
10419          }
10420
10421          break;
10422
10423        case 'relative or authority':
10424          if (c === '/' && input[cursor + 1] === '/') {
10425            state = 'authority ignore slashes';
10426          } else {
10427            err('Expected /, got: ' + c);
10428            state = 'relative';
10429            continue;
10430          }
10431
10432          break;
10433
10434        case 'relative':
10435          this._isRelative = true;
10436
10437          if (this._scheme !== 'file') {
10438            this._scheme = base._scheme;
10439          }
10440
10441          if (c === EOF) {
10442            this._host = base._host;
10443            this._port = base._port;
10444            this._path = base._path.slice();
10445            this._query = base._query;
10446            this._username = base._username;
10447            this._password = base._password;
10448            break loop;
10449          } else if (c === '/' || c === '\\') {
10450            if (c === '\\') {
10451              err('\\ is an invalid code point.');
10452            }
10453
10454            state = 'relative slash';
10455          } else if (c === '?') {
10456            this._host = base._host;
10457            this._port = base._port;
10458            this._path = base._path.slice();
10459            this._query = '?';
10460            this._username = base._username;
10461            this._password = base._password;
10462            state = 'query';
10463          } else if (c === '#') {
10464            this._host = base._host;
10465            this._port = base._port;
10466            this._path = base._path.slice();
10467            this._query = base._query;
10468            this._fragment = '#';
10469            this._username = base._username;
10470            this._password = base._password;
10471            state = 'fragment';
10472          } else {
10473            var nextC = input[cursor + 1];
10474            var nextNextC = input[cursor + 2];
10475
10476            if (this._scheme !== 'file' || !ALPHA.test(c) || nextC !== ':' && nextC !== '|' || nextNextC !== EOF && nextNextC !== '/' && nextNextC !== '\\' && nextNextC !== '?' && nextNextC !== '#') {
10477              this._host = base._host;
10478              this._port = base._port;
10479              this._username = base._username;
10480              this._password = base._password;
10481              this._path = base._path.slice();
10482
10483              this._path.pop();
10484            }
10485
10486            state = 'relative path';
10487            continue;
10488          }
10489
10490          break;
10491
10492        case 'relative slash':
10493          if (c === '/' || c === '\\') {
10494            if (c === '\\') {
10495              err('\\ is an invalid code point.');
10496            }
10497
10498            if (this._scheme === 'file') {
10499              state = 'file host';
10500            } else {
10501              state = 'authority ignore slashes';
10502            }
10503          } else {
10504            if (this._scheme !== 'file') {
10505              this._host = base._host;
10506              this._port = base._port;
10507              this._username = base._username;
10508              this._password = base._password;
10509            }
10510
10511            state = 'relative path';
10512            continue;
10513          }
10514
10515          break;
10516
10517        case 'authority first slash':
10518          if (c === '/') {
10519            state = 'authority second slash';
10520          } else {
10521            err('Expected \'/\', got: ' + c);
10522            state = 'authority ignore slashes';
10523            continue;
10524          }
10525
10526          break;
10527
10528        case 'authority second slash':
10529          state = 'authority ignore slashes';
10530
10531          if (c !== '/') {
10532            err('Expected \'/\', got: ' + c);
10533            continue;
10534          }
10535
10536          break;
10537
10538        case 'authority ignore slashes':
10539          if (c !== '/' && c !== '\\') {
10540            state = 'authority';
10541            continue;
10542          } else {
10543            err('Expected authority, got: ' + c);
10544          }
10545
10546          break;
10547
10548        case 'authority':
10549          if (c === '@') {
10550            if (seenAt) {
10551              err('@ already seen.');
10552              buffer += '%40';
10553            }
10554
10555            seenAt = true;
10556
10557            for (var i = 0; i < buffer.length; i++) {
10558              var cp = buffer[i];
10559
10560              if (cp === '\t' || cp === '\n' || cp === '\r') {
10561                err('Invalid whitespace in authority.');
10562                continue;
10563              }
10564
10565              if (cp === ':' && this._password === null) {
10566                this._password = '';
10567                continue;
10568              }
10569
10570              var tempC = percentEscape(cp);
10571
10572              if (this._password !== null) {
10573                this._password += tempC;
10574              } else {
10575                this._username += tempC;
10576              }
10577            }
10578
10579            buffer = '';
10580          } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
10581            cursor -= buffer.length;
10582            buffer = '';
10583            state = 'host';
10584            continue;
10585          } else {
10586            buffer += c;
10587          }
10588
10589          break;
10590
10591        case 'file host':
10592          if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
10593            if (buffer.length === 2 && ALPHA.test(buffer[0]) && (buffer[1] === ':' || buffer[1] === '|')) {
10594              state = 'relative path';
10595            } else if (buffer.length === 0) {
10596              state = 'relative path start';
10597            } else {
10598              this._host = IDNAToASCII.call(this, buffer);
10599              buffer = '';
10600              state = 'relative path start';
10601            }
10602
10603            continue;
10604          } else if (c === '\t' || c === '\n' || c === '\r') {
10605            err('Invalid whitespace in file host.');
10606          } else {
10607            buffer += c;
10608          }
10609
10610          break;
10611
10612        case 'host':
10613        case 'hostname':
10614          if (c === ':' && !seenBracket) {
10615            this._host = IDNAToASCII.call(this, buffer);
10616            buffer = '';
10617            state = 'port';
10618
10619            if (stateOverride === 'hostname') {
10620              break loop;
10621            }
10622          } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') {
10623            this._host = IDNAToASCII.call(this, buffer);
10624            buffer = '';
10625            state = 'relative path start';
10626
10627            if (stateOverride) {
10628              break loop;
10629            }
10630
10631            continue;
10632          } else if (c !== '\t' && c !== '\n' && c !== '\r') {
10633            if (c === '[') {
10634              seenBracket = true;
10635            } else if (c === ']') {
10636              seenBracket = false;
10637            }
10638
10639            buffer += c;
10640          } else {
10641            err('Invalid code point in host/hostname: ' + c);
10642          }
10643
10644          break;
10645
10646        case 'port':
10647          if (/[0-9]/.test(c)) {
10648            buffer += c;
10649          } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#' || stateOverride) {
10650            if (buffer !== '') {
10651              var temp = parseInt(buffer, 10);
10652
10653              if (temp !== relative[this._scheme]) {
10654                this._port = temp + '';
10655              }
10656
10657              buffer = '';
10658            }
10659
10660            if (stateOverride) {
10661              break loop;
10662            }
10663
10664            state = 'relative path start';
10665            continue;
10666          } else if (c === '\t' || c === '\n' || c === '\r') {
10667            err('Invalid code point in port: ' + c);
10668          } else {
10669            invalid.call(this);
10670          }
10671
10672          break;
10673
10674        case 'relative path start':
10675          if (c === '\\') {
10676            err('\'\\\' not allowed in path.');
10677          }
10678
10679          state = 'relative path';
10680
10681          if (c !== '/' && c !== '\\') {
10682            continue;
10683          }
10684
10685          break;
10686
10687        case 'relative path':
10688          if (c === EOF || c === '/' || c === '\\' || !stateOverride && (c === '?' || c === '#')) {
10689            if (c === '\\') {
10690              err('\\ not allowed in relative path.');
10691            }
10692
10693            var tmp;
10694
10695            if (tmp = relativePathDotMapping[buffer.toLowerCase()]) {
10696              buffer = tmp;
10697            }
10698
10699            if (buffer === '..') {
10700              this._path.pop();
10701
10702              if (c !== '/' && c !== '\\') {
10703                this._path.push('');
10704              }
10705            } else if (buffer === '.' && c !== '/' && c !== '\\') {
10706              this._path.push('');
10707            } else if (buffer !== '.') {
10708              if (this._scheme === 'file' && this._path.length === 0 && buffer.length === 2 && ALPHA.test(buffer[0]) && buffer[1] === '|') {
10709                buffer = buffer[0] + ':';
10710              }
10711
10712              this._path.push(buffer);
10713            }
10714
10715            buffer = '';
10716
10717            if (c === '?') {
10718              this._query = '?';
10719              state = 'query';
10720            } else if (c === '#') {
10721              this._fragment = '#';
10722              state = 'fragment';
10723            }
10724          } else if (c !== '\t' && c !== '\n' && c !== '\r') {
10725            buffer += percentEscape(c);
10726          }
10727
10728          break;
10729
10730        case 'query':
10731          if (!stateOverride && c === '#') {
10732            this._fragment = '#';
10733            state = 'fragment';
10734          } else if (c !== EOF && c !== '\t' && c !== '\n' && c !== '\r') {
10735            this._query += percentEscapeQuery(c);
10736          }
10737
10738          break;
10739
10740        case 'fragment':
10741          if (c !== EOF && c !== '\t' && c !== '\n' && c !== '\r') {
10742            this._fragment += c;
10743          }
10744
10745          break;
10746      }
10747
10748      cursor++;
10749    }
10750  }
10751
10752  function clear() {
10753    this._scheme = '';
10754    this._schemeData = '';
10755    this._username = '';
10756    this._password = null;
10757    this._host = '';
10758    this._port = '';
10759    this._path = [];
10760    this._query = '';
10761    this._fragment = '';
10762    this._isInvalid = false;
10763    this._isRelative = false;
10764  }
10765
10766  function JURL(url, base) {
10767    if (base !== undefined && !(base instanceof JURL)) {
10768      base = new JURL(String(base));
10769    }
10770
10771    this._url = url;
10772    clear.call(this);
10773    var input = url.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g, '');
10774    parse.call(this, input, null, base);
10775  }
10776
10777  JURL.prototype = {
10778    toString: function toString() {
10779      return this.href;
10780    },
10781
10782    get href() {
10783      if (this._isInvalid) {
10784        return this._url;
10785      }
10786
10787      var authority = '';
10788
10789      if (this._username !== '' || this._password !== null) {
10790        authority = this._username + (this._password !== null ? ':' + this._password : '') + '@';
10791      }
10792
10793      return this.protocol + (this._isRelative ? '//' + authority + this.host : '') + this.pathname + this._query + this._fragment;
10794    },
10795
10796    set href(value) {
10797      clear.call(this);
10798      parse.call(this, value);
10799    },
10800
10801    get protocol() {
10802      return this._scheme + ':';
10803    },
10804
10805    set protocol(value) {
10806      if (this._isInvalid) {
10807        return;
10808      }
10809
10810      parse.call(this, value + ':', 'scheme start');
10811    },
10812
10813    get host() {
10814      return this._isInvalid ? '' : this._port ? this._host + ':' + this._port : this._host;
10815    },
10816
10817    set host(value) {
10818      if (this._isInvalid || !this._isRelative) {
10819        return;
10820      }
10821
10822      parse.call(this, value, 'host');
10823    },
10824
10825    get hostname() {
10826      return this._host;
10827    },
10828
10829    set hostname(value) {
10830      if (this._isInvalid || !this._isRelative) {
10831        return;
10832      }
10833
10834      parse.call(this, value, 'hostname');
10835    },
10836
10837    get port() {
10838      return this._port;
10839    },
10840
10841    set port(value) {
10842      if (this._isInvalid || !this._isRelative) {
10843        return;
10844      }
10845
10846      parse.call(this, value, 'port');
10847    },
10848
10849    get pathname() {
10850      return this._isInvalid ? '' : this._isRelative ? '/' + this._path.join('/') : this._schemeData;
10851    },
10852
10853    set pathname(value) {
10854      if (this._isInvalid || !this._isRelative) {
10855        return;
10856      }
10857
10858      this._path = [];
10859      parse.call(this, value, 'relative path start');
10860    },
10861
10862    get search() {
10863      return this._isInvalid || !this._query || this._query === '?' ? '' : this._query;
10864    },
10865
10866    set search(value) {
10867      if (this._isInvalid || !this._isRelative) {
10868        return;
10869      }
10870
10871      this._query = '?';
10872
10873      if (value[0] === '?') {
10874        value = value.slice(1);
10875      }
10876
10877      parse.call(this, value, 'query');
10878    },
10879
10880    get hash() {
10881      return this._isInvalid || !this._fragment || this._fragment === '#' ? '' : this._fragment;
10882    },
10883
10884    set hash(value) {
10885      if (this._isInvalid) {
10886        return;
10887      }
10888
10889      this._fragment = '#';
10890
10891      if (value[0] === '#') {
10892        value = value.slice(1);
10893      }
10894
10895      parse.call(this, value, 'fragment');
10896    },
10897
10898    get origin() {
10899      var host;
10900
10901      if (this._isInvalid || !this._scheme) {
10902        return '';
10903      }
10904
10905      switch (this._scheme) {
10906        case 'data':
10907        case 'file':
10908        case 'javascript':
10909        case 'mailto':
10910          return 'null';
10911
10912        case 'blob':
10913          try {
10914            return new JURL(this._schemeData).origin || 'null';
10915          } catch (_) {}
10916
10917          return 'null';
10918      }
10919
10920      host = this.host;
10921
10922      if (!host) {
10923        return '';
10924      }
10925
10926      return this._scheme + '://' + host;
10927    }
10928
10929  };
10930  exports.URL = JURL;
10931})();
10932
10933/***/ }),
10934/* 151 */
10935/***/ (function(module, exports, __w_pdfjs_require__) {
10936
10937"use strict";
10938
10939
10940Object.defineProperty(exports, "__esModule", {
10941  value: true
10942});
10943exports.clearPrimitiveCaches = clearPrimitiveCaches;
10944exports.isEOF = isEOF;
10945exports.isCmd = isCmd;
10946exports.isDict = isDict;
10947exports.isName = isName;
10948exports.isRef = isRef;
10949exports.isRefsEqual = isRefsEqual;
10950exports.isStream = isStream;
10951exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.Dict = exports.Cmd = exports.EOF = void 0;
10952
10953var _util = __w_pdfjs_require__(5);
10954
10955function _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); }
10956
10957var EOF = {};
10958exports.EOF = EOF;
10959
10960var Name = function NameClosure() {
10961  var nameCache = Object.create(null);
10962
10963  function Name(name) {
10964    this.name = name;
10965  }
10966
10967  Name.prototype = {};
10968
10969  Name.get = function Name_get(name) {
10970    var nameValue = nameCache[name];
10971    return nameValue ? nameValue : nameCache[name] = new Name(name);
10972  };
10973
10974  Name._clearCache = function () {
10975    nameCache = Object.create(null);
10976  };
10977
10978  return Name;
10979}();
10980
10981exports.Name = Name;
10982
10983var Cmd = function CmdClosure() {
10984  var cmdCache = Object.create(null);
10985
10986  function Cmd(cmd) {
10987    this.cmd = cmd;
10988  }
10989
10990  Cmd.prototype = {};
10991
10992  Cmd.get = function Cmd_get(cmd) {
10993    var cmdValue = cmdCache[cmd];
10994    return cmdValue ? cmdValue : cmdCache[cmd] = new Cmd(cmd);
10995  };
10996
10997  Cmd._clearCache = function () {
10998    cmdCache = Object.create(null);
10999  };
11000
11001  return Cmd;
11002}();
11003
11004exports.Cmd = Cmd;
11005
11006var Dict = function DictClosure() {
11007  var nonSerializable = function nonSerializableClosure() {
11008    return nonSerializable;
11009  };
11010
11011  function Dict(xref) {
11012    this._map = Object.create(null);
11013    this.xref = xref;
11014    this.objId = null;
11015    this.suppressEncryption = false;
11016    this.__nonSerializable__ = nonSerializable;
11017  }
11018
11019  Dict.prototype = {
11020    assignXref: function Dict_assignXref(newXref) {
11021      this.xref = newXref;
11022    },
11023    get: function Dict_get(key1, key2, key3) {
11024      var value;
11025      var xref = this.xref,
11026          suppressEncryption = this.suppressEncryption;
11027
11028      if (typeof (value = this._map[key1]) !== 'undefined' || key1 in this._map || typeof key2 === 'undefined') {
11029        return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
11030      }
11031
11032      if (typeof (value = this._map[key2]) !== 'undefined' || key2 in this._map || typeof key3 === 'undefined') {
11033        return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
11034      }
11035
11036      value = this._map[key3] || null;
11037      return xref ? xref.fetchIfRef(value, suppressEncryption) : value;
11038    },
11039    getAsync: function Dict_getAsync(key1, key2, key3) {
11040      var value;
11041      var xref = this.xref,
11042          suppressEncryption = this.suppressEncryption;
11043
11044      if (typeof (value = this._map[key1]) !== 'undefined' || key1 in this._map || typeof key2 === 'undefined') {
11045        if (xref) {
11046          return xref.fetchIfRefAsync(value, suppressEncryption);
11047        }
11048
11049        return Promise.resolve(value);
11050      }
11051
11052      if (typeof (value = this._map[key2]) !== 'undefined' || key2 in this._map || typeof key3 === 'undefined') {
11053        if (xref) {
11054          return xref.fetchIfRefAsync(value, suppressEncryption);
11055        }
11056
11057        return Promise.resolve(value);
11058      }
11059
11060      value = this._map[key3] || null;
11061
11062      if (xref) {
11063        return xref.fetchIfRefAsync(value, suppressEncryption);
11064      }
11065
11066      return Promise.resolve(value);
11067    },
11068    getArray: function Dict_getArray(key1, key2, key3) {
11069      var value = this.get(key1, key2, key3);
11070      var xref = this.xref,
11071          suppressEncryption = this.suppressEncryption;
11072
11073      if (!Array.isArray(value) || !xref) {
11074        return value;
11075      }
11076
11077      value = value.slice();
11078
11079      for (var i = 0, ii = value.length; i < ii; i++) {
11080        if (!isRef(value[i])) {
11081          continue;
11082        }
11083
11084        value[i] = xref.fetch(value[i], suppressEncryption);
11085      }
11086
11087      return value;
11088    },
11089    getRaw: function Dict_getRaw(key) {
11090      return this._map[key];
11091    },
11092    getKeys: function Dict_getKeys() {
11093      return Object.keys(this._map);
11094    },
11095    set: function Dict_set(key, value) {
11096      this._map[key] = value;
11097    },
11098    has: function Dict_has(key) {
11099      return key in this._map;
11100    },
11101    forEach: function Dict_forEach(callback) {
11102      for (var key in this._map) {
11103        callback(key, this.get(key));
11104      }
11105    }
11106  };
11107  Dict.empty = new Dict(null);
11108
11109  Dict.merge = function (xref, dictArray) {
11110    var mergedDict = new Dict(xref);
11111
11112    for (var i = 0, ii = dictArray.length; i < ii; i++) {
11113      var dict = dictArray[i];
11114
11115      if (!isDict(dict)) {
11116        continue;
11117      }
11118
11119      for (var keyName in dict._map) {
11120        if (mergedDict._map[keyName] !== undefined) {
11121          continue;
11122        }
11123
11124        mergedDict._map[keyName] = dict._map[keyName];
11125      }
11126    }
11127
11128    return mergedDict;
11129  };
11130
11131  return Dict;
11132}();
11133
11134exports.Dict = Dict;
11135
11136var Ref = function RefClosure() {
11137  var refCache = Object.create(null);
11138
11139  function Ref(num, gen) {
11140    this.num = num;
11141    this.gen = gen;
11142  }
11143
11144  Ref.prototype = {
11145    toString: function Ref_toString() {
11146      if (this.gen === 0) {
11147        return "".concat(this.num, "R");
11148      }
11149
11150      return "".concat(this.num, "R").concat(this.gen);
11151    }
11152  };
11153
11154  Ref.get = function (num, gen) {
11155    var key = gen === 0 ? "".concat(num, "R") : "".concat(num, "R").concat(gen);
11156    var refValue = refCache[key];
11157    return refValue ? refValue : refCache[key] = new Ref(num, gen);
11158  };
11159
11160  Ref._clearCache = function () {
11161    refCache = Object.create(null);
11162  };
11163
11164  return Ref;
11165}();
11166
11167exports.Ref = Ref;
11168
11169var RefSet = function RefSetClosure() {
11170  function RefSet() {
11171    this.dict = Object.create(null);
11172  }
11173
11174  RefSet.prototype = {
11175    has: function RefSet_has(ref) {
11176      return ref.toString() in this.dict;
11177    },
11178    put: function RefSet_put(ref) {
11179      this.dict[ref.toString()] = true;
11180    },
11181    remove: function RefSet_remove(ref) {
11182      delete this.dict[ref.toString()];
11183    }
11184  };
11185  return RefSet;
11186}();
11187
11188exports.RefSet = RefSet;
11189
11190var RefSetCache = function RefSetCacheClosure() {
11191  function RefSetCache() {
11192    this.dict = Object.create(null);
11193  }
11194
11195  RefSetCache.prototype = {
11196    get: function RefSetCache_get(ref) {
11197      return this.dict[ref.toString()];
11198    },
11199    has: function RefSetCache_has(ref) {
11200      return ref.toString() in this.dict;
11201    },
11202    put: function RefSetCache_put(ref, obj) {
11203      this.dict[ref.toString()] = obj;
11204    },
11205    putAlias: function RefSetCache_putAlias(ref, aliasRef) {
11206      this.dict[ref.toString()] = this.get(aliasRef);
11207    },
11208    forEach: function RefSetCache_forEach(fn, thisArg) {
11209      for (var i in this.dict) {
11210        fn.call(thisArg, this.dict[i]);
11211      }
11212    },
11213    clear: function RefSetCache_clear() {
11214      this.dict = Object.create(null);
11215    }
11216  };
11217  return RefSetCache;
11218}();
11219
11220exports.RefSetCache = RefSetCache;
11221
11222function isEOF(v) {
11223  return v === EOF;
11224}
11225
11226function isName(v, name) {
11227  return v instanceof Name && (name === undefined || v.name === name);
11228}
11229
11230function isCmd(v, cmd) {
11231  return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
11232}
11233
11234function isDict(v, type) {
11235  return v instanceof Dict && (type === undefined || isName(v.get('Type'), type));
11236}
11237
11238function isRef(v) {
11239  return v instanceof Ref;
11240}
11241
11242function isRefsEqual(v1, v2) {
11243  return v1.num === v2.num && v1.gen === v2.gen;
11244}
11245
11246function isStream(v) {
11247  return _typeof(v) === 'object' && v !== null && v.getBytes !== undefined;
11248}
11249
11250function clearPrimitiveCaches() {
11251  Cmd._clearCache();
11252
11253  Name._clearCache();
11254
11255  Ref._clearCache();
11256}
11257
11258/***/ }),
11259/* 152 */
11260/***/ (function(module, exports, __w_pdfjs_require__) {
11261
11262"use strict";
11263
11264
11265Object.defineProperty(exports, "__esModule", {
11266  value: true
11267});
11268exports.NetworkPdfManager = exports.LocalPdfManager = void 0;
11269
11270var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2));
11271
11272var _util = __w_pdfjs_require__(5);
11273
11274var _chunked_stream = __w_pdfjs_require__(153);
11275
11276var _core_utils = __w_pdfjs_require__(154);
11277
11278var _document = __w_pdfjs_require__(155);
11279
11280var _stream = __w_pdfjs_require__(158);
11281
11282function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11283
11284function _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); }
11285
11286function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
11287
11288function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
11289
11290function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
11291
11292function _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); }
11293
11294function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
11295
11296function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
11297
11298function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
11299
11300function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
11301
11302function _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); } }
11303
11304function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
11305
11306var BasePdfManager =
11307/*#__PURE__*/
11308function () {
11309  function BasePdfManager() {
11310    _classCallCheck(this, BasePdfManager);
11311
11312    if (this.constructor === BasePdfManager) {
11313      (0, _util.unreachable)('Cannot initialize BasePdfManager.');
11314    }
11315  }
11316
11317  _createClass(BasePdfManager, [{
11318    key: "onLoadedStream",
11319    value: function onLoadedStream() {
11320      (0, _util.unreachable)('Abstract method `onLoadedStream` called');
11321    }
11322  }, {
11323    key: "ensureDoc",
11324    value: function ensureDoc(prop, args) {
11325      return this.ensure(this.pdfDocument, prop, args);
11326    }
11327  }, {
11328    key: "ensureXRef",
11329    value: function ensureXRef(prop, args) {
11330      return this.ensure(this.pdfDocument.xref, prop, args);
11331    }
11332  }, {
11333    key: "ensureCatalog",
11334    value: function ensureCatalog(prop, args) {
11335      return this.ensure(this.pdfDocument.catalog, prop, args);
11336    }
11337  }, {
11338    key: "getPage",
11339    value: function getPage(pageIndex) {
11340      return this.pdfDocument.getPage(pageIndex);
11341    }
11342  }, {
11343    key: "fontFallback",
11344    value: function fontFallback(id, handler) {
11345      return this.pdfDocument.fontFallback(id, handler);
11346    }
11347  }, {
11348    key: "cleanup",
11349    value: function cleanup() {
11350      return this.pdfDocument.cleanup();
11351    }
11352  }, {
11353    key: "ensure",
11354    value: function () {
11355      var _ensure = _asyncToGenerator(
11356      /*#__PURE__*/
11357      _regenerator["default"].mark(function _callee(obj, prop, args) {
11358        return _regenerator["default"].wrap(function _callee$(_context) {
11359          while (1) {
11360            switch (_context.prev = _context.next) {
11361              case 0:
11362                (0, _util.unreachable)('Abstract method `ensure` called');
11363
11364              case 1:
11365              case "end":
11366                return _context.stop();
11367            }
11368          }
11369        }, _callee);
11370      }));
11371
11372      function ensure(_x, _x2, _x3) {
11373        return _ensure.apply(this, arguments);
11374      }
11375
11376      return ensure;
11377    }()
11378  }, {
11379    key: "requestRange",
11380    value: function requestRange(begin, end) {
11381      (0, _util.unreachable)('Abstract method `requestRange` called');
11382    }
11383  }, {
11384    key: "requestLoadedStream",
11385    value: function requestLoadedStream() {
11386      (0, _util.unreachable)('Abstract method `requestLoadedStream` called');
11387    }
11388  }, {
11389    key: "sendProgressiveData",
11390    value: function sendProgressiveData(chunk) {
11391      (0, _util.unreachable)('Abstract method `sendProgressiveData` called');
11392    }
11393  }, {
11394    key: "updatePassword",
11395    value: function updatePassword(password) {
11396      this._password = password;
11397    }
11398  }, {
11399    key: "terminate",
11400    value: function terminate() {
11401      (0, _util.unreachable)('Abstract method `terminate` called');
11402    }
11403  }, {
11404    key: "docId",
11405    get: function get() {
11406      return this._docId;
11407    }
11408  }, {
11409    key: "password",
11410    get: function get() {
11411      return this._password;
11412    }
11413  }, {
11414    key: "docBaseUrl",
11415    get: function get() {
11416      var docBaseUrl = null;
11417
11418      if (this._docBaseUrl) {
11419        var absoluteUrl = (0, _util.createValidAbsoluteUrl)(this._docBaseUrl);
11420
11421        if (absoluteUrl) {
11422          docBaseUrl = absoluteUrl.href;
11423        } else {
11424          (0, _util.warn)("Invalid absolute docBaseUrl: \"".concat(this._docBaseUrl, "\"."));
11425        }
11426      }
11427
11428      return (0, _util.shadow)(this, 'docBaseUrl', docBaseUrl);
11429    }
11430  }]);
11431
11432  return BasePdfManager;
11433}();
11434
11435var LocalPdfManager =
11436/*#__PURE__*/
11437function (_BasePdfManager) {
11438  _inherits(LocalPdfManager, _BasePdfManager);
11439
11440  function LocalPdfManager(docId, data, password, evaluatorOptions, docBaseUrl) {
11441    var _this;
11442
11443    _classCallCheck(this, LocalPdfManager);
11444
11445    _this = _possibleConstructorReturn(this, _getPrototypeOf(LocalPdfManager).call(this));
11446    _this._docId = docId;
11447    _this._password = password;
11448    _this._docBaseUrl = docBaseUrl;
11449    _this.evaluatorOptions = evaluatorOptions;
11450    var stream = new _stream.Stream(data);
11451    _this.pdfDocument = new _document.PDFDocument(_assertThisInitialized(_this), stream);
11452    _this._loadedStreamPromise = Promise.resolve(stream);
11453    return _this;
11454  }
11455
11456  _createClass(LocalPdfManager, [{
11457    key: "ensure",
11458    value: function () {
11459      var _ensure2 = _asyncToGenerator(
11460      /*#__PURE__*/
11461      _regenerator["default"].mark(function _callee2(obj, prop, args) {
11462        var value;
11463        return _regenerator["default"].wrap(function _callee2$(_context2) {
11464          while (1) {
11465            switch (_context2.prev = _context2.next) {
11466              case 0:
11467                value = obj[prop];
11468
11469                if (!(typeof value === 'function')) {
11470                  _context2.next = 3;
11471                  break;
11472                }
11473
11474                return _context2.abrupt("return", value.apply(obj, args));
11475
11476              case 3:
11477                return _context2.abrupt("return", value);
11478
11479              case 4:
11480              case "end":
11481                return _context2.stop();
11482            }
11483          }
11484        }, _callee2);
11485      }));
11486
11487      function ensure(_x4, _x5, _x6) {
11488        return _ensure2.apply(this, arguments);
11489      }
11490
11491      return ensure;
11492    }()
11493  }, {
11494    key: "requestRange",
11495    value: function requestRange(begin, end) {
11496      return Promise.resolve();
11497    }
11498  }, {
11499    key: "requestLoadedStream",
11500    value: function requestLoadedStream() {}
11501  }, {
11502    key: "onLoadedStream",
11503    value: function onLoadedStream() {
11504      return this._loadedStreamPromise;
11505    }
11506  }, {
11507    key: "terminate",
11508    value: function terminate() {}
11509  }]);
11510
11511  return LocalPdfManager;
11512}(BasePdfManager);
11513
11514exports.LocalPdfManager = LocalPdfManager;
11515
11516var NetworkPdfManager =
11517/*#__PURE__*/
11518function (_BasePdfManager2) {
11519  _inherits(NetworkPdfManager, _BasePdfManager2);
11520
11521  function NetworkPdfManager(docId, pdfNetworkStream, args, evaluatorOptions, docBaseUrl) {
11522    var _this2;
11523
11524    _classCallCheck(this, NetworkPdfManager);
11525
11526    _this2 = _possibleConstructorReturn(this, _getPrototypeOf(NetworkPdfManager).call(this));
11527    _this2._docId = docId;
11528    _this2._password = args.password;
11529    _this2._docBaseUrl = docBaseUrl;
11530    _this2.msgHandler = args.msgHandler;
11531    _this2.evaluatorOptions = evaluatorOptions;
11532    _this2.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, {
11533      msgHandler: args.msgHandler,
11534      length: args.length,
11535      disableAutoFetch: args.disableAutoFetch,
11536      rangeChunkSize: args.rangeChunkSize
11537    });
11538    _this2.pdfDocument = new _document.PDFDocument(_assertThisInitialized(_this2), _this2.streamManager.getStream());
11539    return _this2;
11540  }
11541
11542  _createClass(NetworkPdfManager, [{
11543    key: "ensure",
11544    value: function () {
11545      var _ensure3 = _asyncToGenerator(
11546      /*#__PURE__*/
11547      _regenerator["default"].mark(function _callee3(obj, prop, args) {
11548        var value;
11549        return _regenerator["default"].wrap(function _callee3$(_context3) {
11550          while (1) {
11551            switch (_context3.prev = _context3.next) {
11552              case 0:
11553                _context3.prev = 0;
11554                value = obj[prop];
11555
11556                if (!(typeof value === 'function')) {
11557                  _context3.next = 4;
11558                  break;
11559                }
11560
11561                return _context3.abrupt("return", value.apply(obj, args));
11562
11563              case 4:
11564                return _context3.abrupt("return", value);
11565
11566              case 7:
11567                _context3.prev = 7;
11568                _context3.t0 = _context3["catch"](0);
11569
11570                if (_context3.t0 instanceof _core_utils.MissingDataException) {
11571                  _context3.next = 11;
11572                  break;
11573                }
11574
11575                throw _context3.t0;
11576
11577              case 11:
11578                _context3.next = 13;
11579                return this.requestRange(_context3.t0.begin, _context3.t0.end);
11580
11581              case 13:
11582                return _context3.abrupt("return", this.ensure(obj, prop, args));
11583
11584              case 14:
11585              case "end":
11586                return _context3.stop();
11587            }
11588          }
11589        }, _callee3, this, [[0, 7]]);
11590      }));
11591
11592      function ensure(_x7, _x8, _x9) {
11593        return _ensure3.apply(this, arguments);
11594      }
11595
11596      return ensure;
11597    }()
11598  }, {
11599    key: "requestRange",
11600    value: function requestRange(begin, end) {
11601      return this.streamManager.requestRange(begin, end);
11602    }
11603  }, {
11604    key: "requestLoadedStream",
11605    value: function requestLoadedStream() {
11606      this.streamManager.requestAllChunks();
11607    }
11608  }, {
11609    key: "sendProgressiveData",
11610    value: function sendProgressiveData(chunk) {
11611      this.streamManager.onReceiveData({
11612        chunk: chunk
11613      });
11614    }
11615  }, {
11616    key: "onLoadedStream",
11617    value: function onLoadedStream() {
11618      return this.streamManager.onLoadedStream();
11619    }
11620  }, {
11621    key: "terminate",
11622    value: function terminate() {
11623      this.streamManager.abort();
11624    }
11625  }]);
11626
11627  return NetworkPdfManager;
11628}(BasePdfManager);
11629
11630exports.NetworkPdfManager = NetworkPdfManager;
11631
11632/***/ }),
11633/* 153 */
11634/***/ (function(module, exports, __w_pdfjs_require__) {
11635
11636"use strict";
11637
11638
11639Object.defineProperty(exports, "__esModule", {
11640  value: true
11641});
11642exports.ChunkedStreamManager = exports.ChunkedStream = void 0;
11643
11644var _util = __w_pdfjs_require__(5);
11645
11646var _core_utils = __w_pdfjs_require__(154);
11647
11648function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
11649
11650function _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); } }
11651
11652function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
11653
11654var ChunkedStream =
11655/*#__PURE__*/
11656function () {
11657  function ChunkedStream(length, chunkSize, manager) {
11658    _classCallCheck(this, ChunkedStream);
11659
11660    this.bytes = new Uint8Array(length);
11661    this.start = 0;
11662    this.pos = 0;
11663    this.end = length;
11664    this.chunkSize = chunkSize;
11665    this.loadedChunks = [];
11666    this.numChunksLoaded = 0;
11667    this.numChunks = Math.ceil(length / chunkSize);
11668    this.manager = manager;
11669    this.progressiveDataLength = 0;
11670    this.lastSuccessfulEnsureByteChunk = -1;
11671  }
11672
11673  _createClass(ChunkedStream, [{
11674    key: "getMissingChunks",
11675    value: function getMissingChunks() {
11676      var chunks = [];
11677
11678      for (var chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
11679        if (!this.loadedChunks[chunk]) {
11680          chunks.push(chunk);
11681        }
11682      }
11683
11684      return chunks;
11685    }
11686  }, {
11687    key: "getBaseStreams",
11688    value: function getBaseStreams() {
11689      return [this];
11690    }
11691  }, {
11692    key: "allChunksLoaded",
11693    value: function allChunksLoaded() {
11694      return this.numChunksLoaded === this.numChunks;
11695    }
11696  }, {
11697    key: "onReceiveData",
11698    value: function onReceiveData(begin, chunk) {
11699      var chunkSize = this.chunkSize;
11700
11701      if (begin % chunkSize !== 0) {
11702        throw new Error("Bad begin offset: ".concat(begin));
11703      }
11704
11705      var end = begin + chunk.byteLength;
11706
11707      if (end % chunkSize !== 0 && end !== this.bytes.length) {
11708        throw new Error("Bad end offset: ".concat(end));
11709      }
11710
11711      this.bytes.set(new Uint8Array(chunk), begin);
11712      var beginChunk = Math.floor(begin / chunkSize);
11713      var endChunk = Math.floor((end - 1) / chunkSize) + 1;
11714
11715      for (var curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
11716        if (!this.loadedChunks[curChunk]) {
11717          this.loadedChunks[curChunk] = true;
11718          ++this.numChunksLoaded;
11719        }
11720      }
11721    }
11722  }, {
11723    key: "onReceiveProgressiveData",
11724    value: function onReceiveProgressiveData(data) {
11725      var position = this.progressiveDataLength;
11726      var beginChunk = Math.floor(position / this.chunkSize);
11727      this.bytes.set(new Uint8Array(data), position);
11728      position += data.byteLength;
11729      this.progressiveDataLength = position;
11730      var endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
11731
11732      for (var curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
11733        if (!this.loadedChunks[curChunk]) {
11734          this.loadedChunks[curChunk] = true;
11735          ++this.numChunksLoaded;
11736        }
11737      }
11738    }
11739  }, {
11740    key: "ensureByte",
11741    value: function ensureByte(pos) {
11742      if (pos < this.progressiveDataLength) {
11743        return;
11744      }
11745
11746      var chunk = Math.floor(pos / this.chunkSize);
11747
11748      if (chunk === this.lastSuccessfulEnsureByteChunk) {
11749        return;
11750      }
11751
11752      if (!this.loadedChunks[chunk]) {
11753        throw new _core_utils.MissingDataException(pos, pos + 1);
11754      }
11755
11756      this.lastSuccessfulEnsureByteChunk = chunk;
11757    }
11758  }, {
11759    key: "ensureRange",
11760    value: function ensureRange(begin, end) {
11761      if (begin >= end) {
11762        return;
11763      }
11764
11765      if (end <= this.progressiveDataLength) {
11766        return;
11767      }
11768
11769      var chunkSize = this.chunkSize;
11770      var beginChunk = Math.floor(begin / chunkSize);
11771      var endChunk = Math.floor((end - 1) / chunkSize) + 1;
11772
11773      for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
11774        if (!this.loadedChunks[chunk]) {
11775          throw new _core_utils.MissingDataException(begin, end);
11776        }
11777      }
11778    }
11779  }, {
11780    key: "nextEmptyChunk",
11781    value: function nextEmptyChunk(beginChunk) {
11782      var numChunks = this.numChunks;
11783
11784      for (var i = 0; i < numChunks; ++i) {
11785        var chunk = (beginChunk + i) % numChunks;
11786
11787        if (!this.loadedChunks[chunk]) {
11788          return chunk;
11789        }
11790      }
11791
11792      return null;
11793    }
11794  }, {
11795    key: "hasChunk",
11796    value: function hasChunk(chunk) {
11797      return !!this.loadedChunks[chunk];
11798    }
11799  }, {
11800    key: "getByte",
11801    value: function getByte() {
11802      var pos = this.pos;
11803
11804      if (pos >= this.end) {
11805        return -1;
11806      }
11807
11808      this.ensureByte(pos);
11809      return this.bytes[this.pos++];
11810    }
11811  }, {
11812    key: "getUint16",
11813    value: function getUint16() {
11814      var b0 = this.getByte();
11815      var b1 = this.getByte();
11816
11817      if (b0 === -1 || b1 === -1) {
11818        return -1;
11819      }
11820
11821      return (b0 << 8) + b1;
11822    }
11823  }, {
11824    key: "getInt32",
11825    value: function getInt32() {
11826      var b0 = this.getByte();
11827      var b1 = this.getByte();
11828      var b2 = this.getByte();
11829      var b3 = this.getByte();
11830      return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
11831    }
11832  }, {
11833    key: "getBytes",
11834    value: function getBytes(length) {
11835      var forceClamped = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
11836      var bytes = this.bytes;
11837      var pos = this.pos;
11838      var strEnd = this.end;
11839
11840      if (!length) {
11841        this.ensureRange(pos, strEnd);
11842
11843        var _subarray = bytes.subarray(pos, strEnd);
11844
11845        return forceClamped ? new Uint8ClampedArray(_subarray) : _subarray;
11846      }
11847
11848      var end = pos + length;
11849
11850      if (end > strEnd) {
11851        end = strEnd;
11852      }
11853
11854      this.ensureRange(pos, end);
11855      this.pos = end;
11856      var subarray = bytes.subarray(pos, end);
11857      return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
11858    }
11859  }, {
11860    key: "peekByte",
11861    value: function peekByte() {
11862      var peekedByte = this.getByte();
11863      this.pos--;
11864      return peekedByte;
11865    }
11866  }, {
11867    key: "peekBytes",
11868    value: function peekBytes(length) {
11869      var forceClamped = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
11870      var bytes = this.getBytes(length, forceClamped);
11871      this.pos -= bytes.length;
11872      return bytes;
11873    }
11874  }, {
11875    key: "getByteRange",
11876    value: function getByteRange(begin, end) {
11877      this.ensureRange(begin, end);
11878      return this.bytes.subarray(begin, end);
11879    }
11880  }, {
11881    key: "skip",
11882    value: function skip(n) {
11883      if (!n) {
11884        n = 1;
11885      }
11886
11887      this.pos += n;
11888    }
11889  }, {
11890    key: "reset",
11891    value: function reset() {
11892      this.pos = this.start;
11893    }
11894  }, {
11895    key: "moveStart",
11896    value: function moveStart() {
11897      this.start = this.pos;
11898    }
11899  }, {
11900    key: "makeSubStream",
11901    value: function makeSubStream(start, length, dict) {
11902      if (length) {
11903        this.ensureRange(start, start + length);
11904      } else {
11905        this.ensureByte(start);
11906      }
11907
11908      function ChunkedStreamSubstream() {}
11909
11910      ChunkedStreamSubstream.prototype = Object.create(this);
11911
11912      ChunkedStreamSubstream.prototype.getMissingChunks = function () {
11913        var chunkSize = this.chunkSize;
11914        var beginChunk = Math.floor(this.start / chunkSize);
11915        var endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
11916        var missingChunks = [];
11917
11918        for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
11919          if (!this.loadedChunks[chunk]) {
11920            missingChunks.push(chunk);
11921          }
11922        }
11923
11924        return missingChunks;
11925      };
11926
11927      var subStream = new ChunkedStreamSubstream();
11928      subStream.pos = subStream.start = start;
11929      subStream.end = start + length || this.end;
11930      subStream.dict = dict;
11931      return subStream;
11932    }
11933  }, {
11934    key: "length",
11935    get: function get() {
11936      return this.end - this.start;
11937    }
11938  }, {
11939    key: "isEmpty",
11940    get: function get() {
11941      return this.length === 0;
11942    }
11943  }]);
11944
11945  return ChunkedStream;
11946}();
11947
11948exports.ChunkedStream = ChunkedStream;
11949
11950var ChunkedStreamManager =
11951/*#__PURE__*/
11952function () {
11953  function ChunkedStreamManager(pdfNetworkStream, args) {
11954    _classCallCheck(this, ChunkedStreamManager);
11955
11956    this.length = args.length;
11957    this.chunkSize = args.rangeChunkSize;
11958    this.stream = new ChunkedStream(this.length, this.chunkSize, this);
11959    this.pdfNetworkStream = pdfNetworkStream;
11960    this.disableAutoFetch = args.disableAutoFetch;
11961    this.msgHandler = args.msgHandler;
11962    this.currRequestId = 0;
11963    this.chunksNeededByRequest = Object.create(null);
11964    this.requestsByChunk = Object.create(null);
11965    this.promisesByRequest = Object.create(null);
11966    this.progressiveDataLength = 0;
11967    this.aborted = false;
11968    this._loadedStreamCapability = (0, _util.createPromiseCapability)();
11969  }
11970
11971  _createClass(ChunkedStreamManager, [{
11972    key: "onLoadedStream",
11973    value: function onLoadedStream() {
11974      return this._loadedStreamCapability.promise;
11975    }
11976  }, {
11977    key: "sendRequest",
11978    value: function sendRequest(begin, end) {
11979      var _this = this;
11980
11981      var rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
11982
11983      if (!rangeReader.isStreamingSupported) {
11984        rangeReader.onProgress = this.onProgress.bind(this);
11985      }
11986
11987      var chunks = [],
11988          loaded = 0;
11989      var promise = new Promise(function (resolve, reject) {
11990        var readChunk = function readChunk(chunk) {
11991          try {
11992            if (!chunk.done) {
11993              var data = chunk.value;
11994              chunks.push(data);
11995              loaded += (0, _util.arrayByteLength)(data);
11996
11997              if (rangeReader.isStreamingSupported) {
11998                _this.onProgress({
11999                  loaded: loaded
12000                });
12001              }
12002
12003              rangeReader.read().then(readChunk, reject);
12004              return;
12005            }
12006
12007            var chunkData = (0, _util.arraysToBytes)(chunks);
12008            chunks = null;
12009            resolve(chunkData);
12010          } catch (e) {
12011            reject(e);
12012          }
12013        };
12014
12015        rangeReader.read().then(readChunk, reject);
12016      });
12017      promise.then(function (data) {
12018        if (_this.aborted) {
12019          return;
12020        }
12021
12022        _this.onReceiveData({
12023          chunk: data,
12024          begin: begin
12025        });
12026      });
12027    }
12028  }, {
12029    key: "requestAllChunks",
12030    value: function requestAllChunks() {
12031      var missingChunks = this.stream.getMissingChunks();
12032
12033      this._requestChunks(missingChunks);
12034
12035      return this._loadedStreamCapability.promise;
12036    }
12037  }, {
12038    key: "_requestChunks",
12039    value: function _requestChunks(chunks) {
12040      var requestId = this.currRequestId++;
12041      var chunksNeeded = Object.create(null);
12042      this.chunksNeededByRequest[requestId] = chunksNeeded;
12043      var _iteratorNormalCompletion = true;
12044      var _didIteratorError = false;
12045      var _iteratorError = undefined;
12046
12047      try {
12048        for (var _iterator = chunks[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
12049          var _chunk = _step.value;
12050
12051          if (!this.stream.hasChunk(_chunk)) {
12052            chunksNeeded[_chunk] = true;
12053          }
12054        }
12055      } catch (err) {
12056        _didIteratorError = true;
12057        _iteratorError = err;
12058      } finally {
12059        try {
12060          if (!_iteratorNormalCompletion && _iterator["return"] != null) {
12061            _iterator["return"]();
12062          }
12063        } finally {
12064          if (_didIteratorError) {
12065            throw _iteratorError;
12066          }
12067        }
12068      }
12069
12070      if ((0, _util.isEmptyObj)(chunksNeeded)) {
12071        return Promise.resolve();
12072      }
12073
12074      var capability = (0, _util.createPromiseCapability)();
12075      this.promisesByRequest[requestId] = capability;
12076      var chunksToRequest = [];
12077
12078      for (var chunk in chunksNeeded) {
12079        chunk = chunk | 0;
12080
12081        if (!(chunk in this.requestsByChunk)) {
12082          this.requestsByChunk[chunk] = [];
12083          chunksToRequest.push(chunk);
12084        }
12085
12086        this.requestsByChunk[chunk].push(requestId);
12087      }
12088
12089      if (!chunksToRequest.length) {
12090        return capability.promise;
12091      }
12092
12093      var groupedChunksToRequest = this.groupChunks(chunksToRequest);
12094      var _iteratorNormalCompletion2 = true;
12095      var _didIteratorError2 = false;
12096      var _iteratorError2 = undefined;
12097
12098      try {
12099        for (var _iterator2 = groupedChunksToRequest[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
12100          var groupedChunk = _step2.value;
12101          var begin = groupedChunk.beginChunk * this.chunkSize;
12102          var end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
12103          this.sendRequest(begin, end);
12104        }
12105      } catch (err) {
12106        _didIteratorError2 = true;
12107        _iteratorError2 = err;
12108      } finally {
12109        try {
12110          if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) {
12111            _iterator2["return"]();
12112          }
12113        } finally {
12114          if (_didIteratorError2) {
12115            throw _iteratorError2;
12116          }
12117        }
12118      }
12119
12120      return capability.promise;
12121    }
12122  }, {
12123    key: "getStream",
12124    value: function getStream() {
12125      return this.stream;
12126    }
12127  }, {
12128    key: "requestRange",
12129    value: function requestRange(begin, end) {
12130      end = Math.min(end, this.length);
12131      var beginChunk = this.getBeginChunk(begin);
12132      var endChunk = this.getEndChunk(end);
12133      var chunks = [];
12134
12135      for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
12136        chunks.push(chunk);
12137      }
12138
12139      return this._requestChunks(chunks);
12140    }
12141  }, {
12142    key: "requestRanges",
12143    value: function requestRanges() {
12144      var ranges = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
12145      var chunksToRequest = [];
12146      var _iteratorNormalCompletion3 = true;
12147      var _didIteratorError3 = false;
12148      var _iteratorError3 = undefined;
12149
12150      try {
12151        for (var _iterator3 = ranges[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
12152          var range = _step3.value;
12153          var beginChunk = this.getBeginChunk(range.begin);
12154          var endChunk = this.getEndChunk(range.end);
12155
12156          for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
12157            if (!chunksToRequest.includes(chunk)) {
12158              chunksToRequest.push(chunk);
12159            }
12160          }
12161        }
12162      } catch (err) {
12163        _didIteratorError3 = true;
12164        _iteratorError3 = err;
12165      } finally {
12166        try {
12167          if (!_iteratorNormalCompletion3 && _iterator3["return"] != null) {
12168            _iterator3["return"]();
12169          }
12170        } finally {
12171          if (_didIteratorError3) {
12172            throw _iteratorError3;
12173          }
12174        }
12175      }
12176
12177      chunksToRequest.sort(function (a, b) {
12178        return a - b;
12179      });
12180      return this._requestChunks(chunksToRequest);
12181    }
12182  }, {
12183    key: "groupChunks",
12184    value: function groupChunks(chunks) {
12185      var groupedChunks = [];
12186      var beginChunk = -1;
12187      var prevChunk = -1;
12188
12189      for (var i = 0, ii = chunks.length; i < ii; ++i) {
12190        var chunk = chunks[i];
12191
12192        if (beginChunk < 0) {
12193          beginChunk = chunk;
12194        }
12195
12196        if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
12197          groupedChunks.push({
12198            beginChunk: beginChunk,
12199            endChunk: prevChunk + 1
12200          });
12201          beginChunk = chunk;
12202        }
12203
12204        if (i + 1 === chunks.length) {
12205          groupedChunks.push({
12206            beginChunk: beginChunk,
12207            endChunk: chunk + 1
12208          });
12209        }
12210
12211        prevChunk = chunk;
12212      }
12213
12214      return groupedChunks;
12215    }
12216  }, {
12217    key: "onProgress",
12218    value: function onProgress(args) {
12219      this.msgHandler.send('DocProgress', {
12220        loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded,
12221        total: this.length
12222      });
12223    }
12224  }, {
12225    key: "onReceiveData",
12226    value: function onReceiveData(args) {
12227      var chunk = args.chunk;
12228      var isProgressive = args.begin === undefined;
12229      var begin = isProgressive ? this.progressiveDataLength : args.begin;
12230      var end = begin + chunk.byteLength;
12231      var beginChunk = Math.floor(begin / this.chunkSize);
12232      var endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
12233
12234      if (isProgressive) {
12235        this.stream.onReceiveProgressiveData(chunk);
12236        this.progressiveDataLength = end;
12237      } else {
12238        this.stream.onReceiveData(begin, chunk);
12239      }
12240
12241      if (this.stream.allChunksLoaded()) {
12242        this._loadedStreamCapability.resolve(this.stream);
12243      }
12244
12245      var loadedRequests = [];
12246
12247      for (var _chunk2 = beginChunk; _chunk2 < endChunk; ++_chunk2) {
12248        var requestIds = this.requestsByChunk[_chunk2] || [];
12249        delete this.requestsByChunk[_chunk2];
12250        var _iteratorNormalCompletion4 = true;
12251        var _didIteratorError4 = false;
12252        var _iteratorError4 = undefined;
12253
12254        try {
12255          for (var _iterator4 = requestIds[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
12256            var requestId = _step4.value;
12257            var chunksNeeded = this.chunksNeededByRequest[requestId];
12258
12259            if (_chunk2 in chunksNeeded) {
12260              delete chunksNeeded[_chunk2];
12261            }
12262
12263            if (!(0, _util.isEmptyObj)(chunksNeeded)) {
12264              continue;
12265            }
12266
12267            loadedRequests.push(requestId);
12268          }
12269        } catch (err) {
12270          _didIteratorError4 = true;
12271          _iteratorError4 = err;
12272        } finally {
12273          try {
12274            if (!_iteratorNormalCompletion4 && _iterator4["return"] != null) {
12275              _iterator4["return"]();
12276            }
12277          } finally {
12278            if (_didIteratorError4) {
12279              throw _iteratorError4;
12280            }
12281          }
12282        }
12283      }
12284
12285      if (!this.disableAutoFetch && (0, _util.isEmptyObj)(this.requestsByChunk)) {
12286        var nextEmptyChunk;
12287
12288        if (this.stream.numChunksLoaded === 1) {
12289          var lastChunk = this.stream.numChunks - 1;
12290
12291          if (!this.stream.hasChunk(lastChunk)) {
12292            nextEmptyChunk = lastChunk;
12293          }
12294        } else {
12295          nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
12296        }
12297
12298        if (Number.isInteger(nextEmptyChunk)) {
12299          this._requestChunks([nextEmptyChunk]);
12300        }
12301      }
12302
12303      for (var _i = 0, _loadedRequests = loadedRequests; _i < _loadedRequests.length; _i++) {
12304        var _requestId = _loadedRequests[_i];
12305        var capability = this.promisesByRequest[_requestId];
12306        delete this.promisesByRequest[_requestId];
12307        capability.resolve();
12308      }
12309
12310      this.msgHandler.send('DocProgress', {
12311        loaded: this.stream.numChunksLoaded * this.chunkSize,
12312        total: this.length
12313      });
12314    }
12315  }, {
12316    key: "onError",
12317    value: function onError(err) {
12318      this._loadedStreamCapability.reject(err);
12319    }
12320  }, {
12321    key: "getBeginChunk",
12322    value: function getBeginChunk(begin) {
12323      return Math.floor(begin / this.chunkSize);
12324    }
12325  }, {
12326    key: "getEndChunk",
12327    value: function getEndChunk(end) {
12328      return Math.floor((end - 1) / this.chunkSize) + 1;
12329    }
12330  }, {
12331    key: "abort",
12332    value: function abort() {
12333      this.aborted = true;
12334
12335      if (this.pdfNetworkStream) {
12336        this.pdfNetworkStream.cancelAllRequests('abort');
12337      }
12338
12339      for (var requestId in this.promisesByRequest) {
12340        this.promisesByRequest[requestId].reject(new Error('Request was aborted'));
12341      }
12342    }
12343  }]);
12344
12345  return ChunkedStreamManager;
12346}();
12347
12348exports.ChunkedStreamManager = ChunkedStreamManager;
12349
12350/***/ }),
12351/* 154 */
12352/***/ (function(module, exports, __w_pdfjs_require__) {
12353
12354"use strict";
12355
12356
12357Object.defineProperty(exports, "__esModule", {
12358  value: true
12359});
12360exports.getLookupTableFactory = getLookupTableFactory;
12361exports.getInheritableProperty = getInheritableProperty;
12362exports.toRomanNumerals = toRomanNumerals;
12363exports.XRefParseException = exports.XRefEntryException = exports.MissingDataException = void 0;
12364
12365var _util = __w_pdfjs_require__(5);
12366
12367function getLookupTableFactory(initializer) {
12368  var lookup;
12369  return function () {
12370    if (initializer) {
12371      lookup = Object.create(null);
12372      initializer(lookup);
12373      initializer = null;
12374    }
12375
12376    return lookup;
12377  };
12378}
12379
12380var MissingDataException = function MissingDataExceptionClosure() {
12381  function MissingDataException(begin, end) {
12382    this.begin = begin;
12383    this.end = end;
12384    this.message = "Missing data [".concat(begin, ", ").concat(end, ")");
12385  }
12386
12387  MissingDataException.prototype = new Error();
12388  MissingDataException.prototype.name = 'MissingDataException';
12389  MissingDataException.constructor = MissingDataException;
12390  return MissingDataException;
12391}();
12392
12393exports.MissingDataException = MissingDataException;
12394
12395var XRefEntryException = function XRefEntryExceptionClosure() {
12396  function XRefEntryException(msg) {
12397    this.message = msg;
12398  }
12399
12400  XRefEntryException.prototype = new Error();
12401  XRefEntryException.prototype.name = 'XRefEntryException';
12402  XRefEntryException.constructor = XRefEntryException;
12403  return XRefEntryException;
12404}();
12405
12406exports.XRefEntryException = XRefEntryException;
12407
12408var XRefParseException = function XRefParseExceptionClosure() {
12409  function XRefParseException(msg) {
12410    this.message = msg;
12411  }
12412
12413  XRefParseException.prototype = new Error();
12414  XRefParseException.prototype.name = 'XRefParseException';
12415  XRefParseException.constructor = XRefParseException;
12416  return XRefParseException;
12417}();
12418
12419exports.XRefParseException = XRefParseException;
12420
12421function getInheritableProperty(_ref) {
12422  var dict = _ref.dict,
12423      key = _ref.key,
12424      _ref$getArray = _ref.getArray,
12425      getArray = _ref$getArray === void 0 ? false : _ref$getArray,
12426      _ref$stopWhenFound = _ref.stopWhenFound,
12427      stopWhenFound = _ref$stopWhenFound === void 0 ? true : _ref$stopWhenFound;
12428  var LOOP_LIMIT = 100;
12429  var loopCount = 0;
12430  var values;
12431
12432  while (dict) {
12433    var value = getArray ? dict.getArray(key) : dict.get(key);
12434
12435    if (value !== undefined) {
12436      if (stopWhenFound) {
12437        return value;
12438      }
12439
12440      if (!values) {
12441        values = [];
12442      }
12443
12444      values.push(value);
12445    }
12446
12447    if (++loopCount > LOOP_LIMIT) {
12448      (0, _util.warn)("getInheritableProperty: maximum loop count exceeded for \"".concat(key, "\""));
12449      break;
12450    }
12451
12452    dict = dict.get('Parent');
12453  }
12454
12455  return values;
12456}
12457
12458var ROMAN_NUMBER_MAP = ['', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM', '', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC', '', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX'];
12459
12460function toRomanNumerals(number) {
12461  var lowerCase = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
12462  (0, _util.assert)(Number.isInteger(number) && number > 0, 'The number should be a positive integer.');
12463  var pos,
12464      romanBuf = [];
12465
12466  while (number >= 1000) {
12467    number -= 1000;
12468    romanBuf.push('M');
12469  }
12470
12471  pos = number / 100 | 0;
12472  number %= 100;
12473  romanBuf.push(ROMAN_NUMBER_MAP[pos]);
12474  pos = number / 10 | 0;
12475  number %= 10;
12476  romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
12477  romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
12478  var romanStr = romanBuf.join('');
12479  return lowerCase ? romanStr.toLowerCase() : romanStr;
12480}
12481
12482/***/ }),
12483/* 155 */
12484/***/ (function(module, exports, __w_pdfjs_require__) {
12485
12486"use strict";
12487
12488
12489Object.defineProperty(exports, "__esModule", {
12490  value: true
12491});
12492exports.PDFDocument = exports.Page = void 0;
12493
12494var _util = __w_pdfjs_require__(5);
12495
12496var _obj = __w_pdfjs_require__(156);
12497
12498var _primitives = __w_pdfjs_require__(151);
12499
12500var _core_utils = __w_pdfjs_require__(154);
12501
12502var _stream2 = __w_pdfjs_require__(158);
12503
12504var _annotation = __w_pdfjs_require__(170);
12505
12506var _crypto = __w_pdfjs_require__(168);
12507
12508var _parser = __w_pdfjs_require__(157);
12509
12510var _operator_list = __w_pdfjs_require__(171);
12511
12512var _evaluator = __w_pdfjs_require__(172);
12513
12514var _function = __w_pdfjs_require__(186);
12515
12516function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
12517
12518function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
12519
12520function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
12521
12522function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12523
12524function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
12525
12526function _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); } }
12527
12528function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
12529
12530var DEFAULT_USER_UNIT = 1.0;
12531var LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
12532
12533function isAnnotationRenderable(annotation, intent) {
12534  return intent === 'display' && annotation.viewable || intent === 'print' && annotation.printable;
12535}
12536
12537var Page =
12538/*#__PURE__*/
12539function () {
12540  function Page(_ref) {
12541    var pdfManager = _ref.pdfManager,
12542        xref = _ref.xref,
12543        pageIndex = _ref.pageIndex,
12544        pageDict = _ref.pageDict,
12545        ref = _ref.ref,
12546        fontCache = _ref.fontCache,
12547        builtInCMapCache = _ref.builtInCMapCache,
12548        pdfFunctionFactory = _ref.pdfFunctionFactory;
12549
12550    _classCallCheck(this, Page);
12551
12552    this.pdfManager = pdfManager;
12553    this.pageIndex = pageIndex;
12554    this.pageDict = pageDict;
12555    this.xref = xref;
12556    this.ref = ref;
12557    this.fontCache = fontCache;
12558    this.builtInCMapCache = builtInCMapCache;
12559    this.pdfFunctionFactory = pdfFunctionFactory;
12560    this.evaluatorOptions = pdfManager.evaluatorOptions;
12561    this.resourcesPromise = null;
12562    var idCounters = {
12563      obj: 0
12564    };
12565    this.idFactory = {
12566      createObjId: function createObjId() {
12567        return "p".concat(pageIndex, "_").concat(++idCounters.obj);
12568      },
12569      getDocId: function getDocId() {
12570        return "g_".concat(pdfManager.docId);
12571      }
12572    };
12573  }
12574
12575  _createClass(Page, [{
12576    key: "_getInheritableProperty",
12577    value: function _getInheritableProperty(key) {
12578      var getArray = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
12579      var value = (0, _core_utils.getInheritableProperty)({
12580        dict: this.pageDict,
12581        key: key,
12582        getArray: getArray,
12583        stopWhenFound: false
12584      });
12585
12586      if (!Array.isArray(value)) {
12587        return value;
12588      }
12589
12590      if (value.length === 1 || !(0, _primitives.isDict)(value[0])) {
12591        return value[0];
12592      }
12593
12594      return _primitives.Dict.merge(this.xref, value);
12595    }
12596  }, {
12597    key: "getContentStream",
12598    value: function getContentStream() {
12599      var content = this.content;
12600      var stream;
12601
12602      if (Array.isArray(content)) {
12603        var xref = this.xref;
12604        var streams = [];
12605        var _iteratorNormalCompletion = true;
12606        var _didIteratorError = false;
12607        var _iteratorError = undefined;
12608
12609        try {
12610          for (var _iterator = content[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
12611            var _stream = _step.value;
12612            streams.push(xref.fetchIfRef(_stream));
12613          }
12614        } catch (err) {
12615          _didIteratorError = true;
12616          _iteratorError = err;
12617        } finally {
12618          try {
12619            if (!_iteratorNormalCompletion && _iterator["return"] != null) {
12620              _iterator["return"]();
12621            }
12622          } finally {
12623            if (_didIteratorError) {
12624              throw _iteratorError;
12625            }
12626          }
12627        }
12628
12629        stream = new _stream2.StreamsSequenceStream(streams);
12630      } else if ((0, _primitives.isStream)(content)) {
12631        stream = content;
12632      } else {
12633        stream = new _stream2.NullStream();
12634      }
12635
12636      return stream;
12637    }
12638  }, {
12639    key: "loadResources",
12640    value: function loadResources(keys) {
12641      var _this = this;
12642
12643      if (!this.resourcesPromise) {
12644        this.resourcesPromise = this.pdfManager.ensure(this, 'resources');
12645      }
12646
12647      return this.resourcesPromise.then(function () {
12648        var objectLoader = new _obj.ObjectLoader(_this.resources, keys, _this.xref);
12649        return objectLoader.load();
12650      });
12651    }
12652  }, {
12653    key: "getOperatorList",
12654    value: function getOperatorList(_ref2) {
12655      var _this2 = this;
12656
12657      var handler = _ref2.handler,
12658          task = _ref2.task,
12659          intent = _ref2.intent,
12660          renderInteractiveForms = _ref2.renderInteractiveForms;
12661      var contentStreamPromise = this.pdfManager.ensure(this, 'getContentStream');
12662      var resourcesPromise = this.loadResources(['ExtGState', 'ColorSpace', 'Pattern', 'Shading', 'XObject', 'Font']);
12663      var partialEvaluator = new _evaluator.PartialEvaluator({
12664        xref: this.xref,
12665        handler: handler,
12666        pageIndex: this.pageIndex,
12667        idFactory: this.idFactory,
12668        fontCache: this.fontCache,
12669        builtInCMapCache: this.builtInCMapCache,
12670        options: this.evaluatorOptions,
12671        pdfFunctionFactory: this.pdfFunctionFactory
12672      });
12673      var dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
12674      var pageListPromise = dataPromises.then(function (_ref3) {
12675        var _ref4 = _slicedToArray(_ref3, 1),
12676            contentStream = _ref4[0];
12677
12678        var opList = new _operator_list.OperatorList(intent, handler, _this2.pageIndex);
12679        handler.send('StartRenderPage', {
12680          transparency: partialEvaluator.hasBlendModes(_this2.resources),
12681          pageIndex: _this2.pageIndex,
12682          intent: intent
12683        });
12684        return partialEvaluator.getOperatorList({
12685          stream: contentStream,
12686          task: task,
12687          resources: _this2.resources,
12688          operatorList: opList
12689        }).then(function () {
12690          return opList;
12691        });
12692      });
12693      return Promise.all([pageListPromise, this._parsedAnnotations]).then(function (_ref5) {
12694        var _ref6 = _slicedToArray(_ref5, 2),
12695            pageOpList = _ref6[0],
12696            annotations = _ref6[1];
12697
12698        if (annotations.length === 0) {
12699          pageOpList.flush(true);
12700          return pageOpList;
12701        }
12702
12703        var opListPromises = [];
12704        var _iteratorNormalCompletion2 = true;
12705        var _didIteratorError2 = false;
12706        var _iteratorError2 = undefined;
12707
12708        try {
12709          for (var _iterator2 = annotations[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
12710            var annotation = _step2.value;
12711
12712            if (isAnnotationRenderable(annotation, intent)) {
12713              opListPromises.push(annotation.getOperatorList(partialEvaluator, task, renderInteractiveForms));
12714            }
12715          }
12716        } catch (err) {
12717          _didIteratorError2 = true;
12718          _iteratorError2 = err;
12719        } finally {
12720          try {
12721            if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) {
12722              _iterator2["return"]();
12723            }
12724          } finally {
12725            if (_didIteratorError2) {
12726              throw _iteratorError2;
12727            }
12728          }
12729        }
12730
12731        return Promise.all(opListPromises).then(function (opLists) {
12732          pageOpList.addOp(_util.OPS.beginAnnotations, []);
12733          var _iteratorNormalCompletion3 = true;
12734          var _didIteratorError3 = false;
12735          var _iteratorError3 = undefined;
12736
12737          try {
12738            for (var _iterator3 = opLists[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
12739              var opList = _step3.value;
12740              pageOpList.addOpList(opList);
12741            }
12742          } catch (err) {
12743            _didIteratorError3 = true;
12744            _iteratorError3 = err;
12745          } finally {
12746            try {
12747              if (!_iteratorNormalCompletion3 && _iterator3["return"] != null) {
12748                _iterator3["return"]();
12749              }
12750            } finally {
12751              if (_didIteratorError3) {
12752                throw _iteratorError3;
12753              }
12754            }
12755          }
12756
12757          pageOpList.addOp(_util.OPS.endAnnotations, []);
12758          pageOpList.flush(true);
12759          return pageOpList;
12760        });
12761      });
12762    }
12763  }, {
12764    key: "extractTextContent",
12765    value: function extractTextContent(_ref7) {
12766      var _this3 = this;
12767
12768      var handler = _ref7.handler,
12769          task = _ref7.task,
12770          normalizeWhitespace = _ref7.normalizeWhitespace,
12771          sink = _ref7.sink,
12772          combineTextItems = _ref7.combineTextItems;
12773      var contentStreamPromise = this.pdfManager.ensure(this, 'getContentStream');
12774      var resourcesPromise = this.loadResources(['ExtGState', 'XObject', 'Font']);
12775      var dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
12776      return dataPromises.then(function (_ref8) {
12777        var _ref9 = _slicedToArray(_ref8, 1),
12778            contentStream = _ref9[0];
12779
12780        var partialEvaluator = new _evaluator.PartialEvaluator({
12781          xref: _this3.xref,
12782          handler: handler,
12783          pageIndex: _this3.pageIndex,
12784          idFactory: _this3.idFactory,
12785          fontCache: _this3.fontCache,
12786          builtInCMapCache: _this3.builtInCMapCache,
12787          options: _this3.evaluatorOptions,
12788          pdfFunctionFactory: _this3.pdfFunctionFactory
12789        });
12790        return partialEvaluator.getTextContent({
12791          stream: contentStream,
12792          task: task,
12793          resources: _this3.resources,
12794          normalizeWhitespace: normalizeWhitespace,
12795          combineTextItems: combineTextItems,
12796          sink: sink
12797        });
12798      });
12799    }
12800  }, {
12801    key: "getAnnotationsData",
12802    value: function getAnnotationsData(intent) {
12803      return this._parsedAnnotations.then(function (annotations) {
12804        var annotationsData = [];
12805
12806        for (var i = 0, ii = annotations.length; i < ii; i++) {
12807          if (!intent || isAnnotationRenderable(annotations[i], intent)) {
12808            annotationsData.push(annotations[i].data);
12809          }
12810        }
12811
12812        return annotationsData;
12813      });
12814    }
12815  }, {
12816    key: "content",
12817    get: function get() {
12818      return this.pageDict.get('Contents');
12819    }
12820  }, {
12821    key: "resources",
12822    get: function get() {
12823      return (0, _util.shadow)(this, 'resources', this._getInheritableProperty('Resources') || _primitives.Dict.empty);
12824    }
12825  }, {
12826    key: "mediaBox",
12827    get: function get() {
12828      var mediaBox = this._getInheritableProperty('MediaBox', true);
12829
12830      if (!Array.isArray(mediaBox) || mediaBox.length !== 4) {
12831        return (0, _util.shadow)(this, 'mediaBox', LETTER_SIZE_MEDIABOX);
12832      }
12833
12834      return (0, _util.shadow)(this, 'mediaBox', mediaBox);
12835    }
12836  }, {
12837    key: "cropBox",
12838    get: function get() {
12839      var cropBox = this._getInheritableProperty('CropBox', true);
12840
12841      if (!Array.isArray(cropBox) || cropBox.length !== 4) {
12842        return (0, _util.shadow)(this, 'cropBox', this.mediaBox);
12843      }
12844
12845      return (0, _util.shadow)(this, 'cropBox', cropBox);
12846    }
12847  }, {
12848    key: "userUnit",
12849    get: function get() {
12850      var obj = this.pageDict.get('UserUnit');
12851
12852      if (!(0, _util.isNum)(obj) || obj <= 0) {
12853        obj = DEFAULT_USER_UNIT;
12854      }
12855
12856      return (0, _util.shadow)(this, 'userUnit', obj);
12857    }
12858  }, {
12859    key: "view",
12860    get: function get() {
12861      var mediaBox = this.mediaBox,
12862          cropBox = this.cropBox;
12863
12864      if (mediaBox === cropBox) {
12865        return (0, _util.shadow)(this, 'view', mediaBox);
12866      }
12867
12868      var intersection = _util.Util.intersect(cropBox, mediaBox);
12869
12870      return (0, _util.shadow)(this, 'view', intersection || mediaBox);
12871    }
12872  }, {
12873    key: "rotate",
12874    get: function get() {
12875      var rotate = this._getInheritableProperty('Rotate') || 0;
12876
12877      if (rotate % 90 !== 0) {
12878        rotate = 0;
12879      } else if (rotate >= 360) {
12880        rotate = rotate % 360;
12881      } else if (rotate < 0) {
12882        rotate = (rotate % 360 + 360) % 360;
12883      }
12884
12885      return (0, _util.shadow)(this, 'rotate', rotate);
12886    }
12887  }, {
12888    key: "annotations",
12889    get: function get() {
12890      return (0, _util.shadow)(this, 'annotations', this._getInheritableProperty('Annots') || []);
12891    }
12892  }, {
12893    key: "_parsedAnnotations",
12894    get: function get() {
12895      var _this4 = this;
12896
12897      var parsedAnnotations = this.pdfManager.ensure(this, 'annotations').then(function () {
12898        var annotationRefs = _this4.annotations;
12899        var annotationPromises = [];
12900
12901        for (var i = 0, ii = annotationRefs.length; i < ii; i++) {
12902          annotationPromises.push(_annotation.AnnotationFactory.create(_this4.xref, annotationRefs[i], _this4.pdfManager, _this4.idFactory));
12903        }
12904
12905        return Promise.all(annotationPromises).then(function (annotations) {
12906          return annotations.filter(function isDefined(annotation) {
12907            return !!annotation;
12908          });
12909        }, function (reason) {
12910          (0, _util.warn)("_parsedAnnotations: \"".concat(reason, "\"."));
12911          return [];
12912        });
12913      });
12914      return (0, _util.shadow)(this, '_parsedAnnotations', parsedAnnotations);
12915    }
12916  }]);
12917
12918  return Page;
12919}();
12920
12921exports.Page = Page;
12922var FINGERPRINT_FIRST_BYTES = 1024;
12923var EMPTY_FINGERPRINT = '\x00\x00\x00\x00\x00\x00\x00' + '\x00\x00\x00\x00\x00\x00\x00\x00\x00';
12924
12925function find(stream, needle, limit) {
12926  var backwards = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
12927  (0, _util.assert)(limit > 0, 'The "limit" must be a positive integer.');
12928  var str = (0, _util.bytesToString)(stream.peekBytes(limit));
12929  var index = backwards ? str.lastIndexOf(needle) : str.indexOf(needle);
12930
12931  if (index === -1) {
12932    return false;
12933  }
12934
12935  stream.pos += index;
12936  return true;
12937}
12938
12939var PDFDocument =
12940/*#__PURE__*/
12941function () {
12942  function PDFDocument(pdfManager, arg) {
12943    _classCallCheck(this, PDFDocument);
12944
12945    var stream;
12946
12947    if ((0, _primitives.isStream)(arg)) {
12948      stream = arg;
12949    } else if ((0, _util.isArrayBuffer)(arg)) {
12950      stream = new _stream2.Stream(arg);
12951    } else {
12952      throw new Error('PDFDocument: Unknown argument type');
12953    }
12954
12955    if (stream.length <= 0) {
12956      throw new Error('PDFDocument: Stream must have data');
12957    }
12958
12959    this.pdfManager = pdfManager;
12960    this.stream = stream;
12961    this.xref = new _obj.XRef(stream, pdfManager);
12962    this.pdfFunctionFactory = new _function.PDFFunctionFactory({
12963      xref: this.xref,
12964      isEvalSupported: pdfManager.evaluatorOptions.isEvalSupported
12965    });
12966    this._pagePromises = [];
12967  }
12968
12969  _createClass(PDFDocument, [{
12970    key: "parse",
12971    value: function parse(recoveryMode) {
12972      this.setup(recoveryMode);
12973      var version = this.catalog.catDict.get('Version');
12974
12975      if ((0, _primitives.isName)(version)) {
12976        this.pdfFormatVersion = version.name;
12977      }
12978
12979      try {
12980        this.acroForm = this.catalog.catDict.get('AcroForm');
12981
12982        if (this.acroForm) {
12983          this.xfa = this.acroForm.get('XFA');
12984          var fields = this.acroForm.get('Fields');
12985
12986          if ((!Array.isArray(fields) || fields.length === 0) && !this.xfa) {
12987            this.acroForm = null;
12988          }
12989        }
12990      } catch (ex) {
12991        if (ex instanceof _core_utils.MissingDataException) {
12992          throw ex;
12993        }
12994
12995        (0, _util.info)('Cannot fetch AcroForm entry; assuming no AcroForms are present');
12996        this.acroForm = null;
12997      }
12998
12999      try {
13000        var collection = this.catalog.catDict.get('Collection');
13001
13002        if ((0, _primitives.isDict)(collection) && collection.getKeys().length > 0) {
13003          this.collection = collection;
13004        }
13005      } catch (ex) {
13006        if (ex instanceof _core_utils.MissingDataException) {
13007          throw ex;
13008        }
13009
13010        (0, _util.info)('Cannot fetch Collection dictionary.');
13011      }
13012    }
13013  }, {
13014    key: "checkHeader",
13015    value: function checkHeader() {
13016      var stream = this.stream;
13017      stream.reset();
13018
13019      if (!find(stream, '%PDF-', 1024)) {
13020        return;
13021      }
13022
13023      stream.moveStart();
13024      var MAX_PDF_VERSION_LENGTH = 12;
13025      var version = '',
13026          ch;
13027
13028      while ((ch = stream.getByte()) > 0x20) {
13029        if (version.length >= MAX_PDF_VERSION_LENGTH) {
13030          break;
13031        }
13032
13033        version += String.fromCharCode(ch);
13034      }
13035
13036      if (!this.pdfFormatVersion) {
13037        this.pdfFormatVersion = version.substring(5);
13038      }
13039    }
13040  }, {
13041    key: "parseStartXRef",
13042    value: function parseStartXRef() {
13043      this.xref.setStartXRef(this.startXRef);
13044    }
13045  }, {
13046    key: "setup",
13047    value: function setup(recoveryMode) {
13048      this.xref.parse(recoveryMode);
13049      this.catalog = new _obj.Catalog(this.pdfManager, this.xref);
13050    }
13051  }, {
13052    key: "_getLinearizationPage",
13053    value: function _getLinearizationPage(pageIndex) {
13054      var catalog = this.catalog,
13055          linearization = this.linearization;
13056      (0, _util.assert)(linearization && linearization.pageFirst === pageIndex);
13057
13058      var ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);
13059
13060      return this.xref.fetchAsync(ref).then(function (obj) {
13061        if ((0, _primitives.isDict)(obj, 'Page') || (0, _primitives.isDict)(obj) && !obj.has('Type') && obj.has('Contents')) {
13062          if (ref && !catalog.pageKidsCountCache.has(ref)) {
13063            catalog.pageKidsCountCache.put(ref, 1);
13064          }
13065
13066          return [obj, ref];
13067        }
13068
13069        throw new _util.FormatError('The Linearization dictionary doesn\'t point ' + 'to a valid Page dictionary.');
13070      })["catch"](function (reason) {
13071        (0, _util.info)(reason);
13072        return catalog.getPageDict(pageIndex);
13073      });
13074    }
13075  }, {
13076    key: "getPage",
13077    value: function getPage(pageIndex) {
13078      var _this5 = this;
13079
13080      if (this._pagePromises[pageIndex] !== undefined) {
13081        return this._pagePromises[pageIndex];
13082      }
13083
13084      var catalog = this.catalog,
13085          linearization = this.linearization;
13086      var promise = linearization && linearization.pageFirst === pageIndex ? this._getLinearizationPage(pageIndex) : catalog.getPageDict(pageIndex);
13087      return this._pagePromises[pageIndex] = promise.then(function (_ref10) {
13088        var _ref11 = _slicedToArray(_ref10, 2),
13089            pageDict = _ref11[0],
13090            ref = _ref11[1];
13091
13092        return new Page({
13093          pdfManager: _this5.pdfManager,
13094          xref: _this5.xref,
13095          pageIndex: pageIndex,
13096          pageDict: pageDict,
13097          ref: ref,
13098          fontCache: catalog.fontCache,
13099          builtInCMapCache: catalog.builtInCMapCache,
13100          pdfFunctionFactory: _this5.pdfFunctionFactory
13101        });
13102      });
13103    }
13104  }, {
13105    key: "checkFirstPage",
13106    value: function checkFirstPage() {
13107      var _this6 = this;
13108
13109      return this.getPage(0)["catch"](function (reason) {
13110        if (reason instanceof _core_utils.XRefEntryException) {
13111          _this6._pagePromises.length = 0;
13112
13113          _this6.cleanup();
13114
13115          throw new _core_utils.XRefParseException();
13116        }
13117      });
13118    }
13119  }, {
13120    key: "fontFallback",
13121    value: function fontFallback(id, handler) {
13122      return this.catalog.fontFallback(id, handler);
13123    }
13124  }, {
13125    key: "cleanup",
13126    value: function cleanup() {
13127      return this.catalog.cleanup();
13128    }
13129  }, {
13130    key: "linearization",
13131    get: function get() {
13132      var linearization = null;
13133
13134      try {
13135        linearization = _parser.Linearization.create(this.stream);
13136      } catch (err) {
13137        if (err instanceof _core_utils.MissingDataException) {
13138          throw err;
13139        }
13140
13141        (0, _util.info)(err);
13142      }
13143
13144      return (0, _util.shadow)(this, 'linearization', linearization);
13145    }
13146  }, {
13147    key: "startXRef",
13148    get: function get() {
13149      var stream = this.stream;
13150      var startXRef = 0;
13151
13152      if (this.linearization) {
13153        stream.reset();
13154
13155        if (find(stream, 'endobj', 1024)) {
13156          startXRef = stream.pos + 6;
13157        }
13158      } else {
13159        var step = 1024;
13160        var startXRefLength = 'startxref'.length;
13161        var found = false,
13162            pos = stream.end;
13163
13164        while (!found && pos > 0) {
13165          pos -= step - startXRefLength;
13166
13167          if (pos < 0) {
13168            pos = 0;
13169          }
13170
13171          stream.pos = pos;
13172          found = find(stream, 'startxref', step, true);
13173        }
13174
13175        if (found) {
13176          stream.skip(9);
13177          var ch;
13178
13179          do {
13180            ch = stream.getByte();
13181          } while ((0, _util.isSpace)(ch));
13182
13183          var str = '';
13184
13185          while (ch >= 0x20 && ch <= 0x39) {
13186            str += String.fromCharCode(ch);
13187            ch = stream.getByte();
13188          }
13189
13190          startXRef = parseInt(str, 10);
13191
13192          if (isNaN(startXRef)) {
13193            startXRef = 0;
13194          }
13195        }
13196      }
13197
13198      return (0, _util.shadow)(this, 'startXRef', startXRef);
13199    }
13200  }, {
13201    key: "numPages",
13202    get: function get() {
13203      var linearization = this.linearization;
13204      var num = linearization ? linearization.numPages : this.catalog.numPages;
13205      return (0, _util.shadow)(this, 'numPages', num);
13206    }
13207  }, {
13208    key: "documentInfo",
13209    get: function get() {
13210      var DocumentInfoValidators = {
13211        Title: _util.isString,
13212        Author: _util.isString,
13213        Subject: _util.isString,
13214        Keywords: _util.isString,
13215        Creator: _util.isString,
13216        Producer: _util.isString,
13217        CreationDate: _util.isString,
13218        ModDate: _util.isString,
13219        Trapped: _primitives.isName
13220      };
13221      var docInfo = {
13222        PDFFormatVersion: this.pdfFormatVersion,
13223        IsLinearized: !!this.linearization,
13224        IsAcroFormPresent: !!this.acroForm,
13225        IsXFAPresent: !!this.xfa,
13226        IsCollectionPresent: !!this.collection
13227      };
13228      var infoDict;
13229
13230      try {
13231        infoDict = this.xref.trailer.get('Info');
13232      } catch (err) {
13233        if (err instanceof _core_utils.MissingDataException) {
13234          throw err;
13235        }
13236
13237        (0, _util.info)('The document information dictionary is invalid.');
13238      }
13239
13240      if ((0, _primitives.isDict)(infoDict)) {
13241        var _iteratorNormalCompletion4 = true;
13242        var _didIteratorError4 = false;
13243        var _iteratorError4 = undefined;
13244
13245        try {
13246          for (var _iterator4 = infoDict.getKeys()[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
13247            var key = _step4.value;
13248            var value = infoDict.get(key);
13249
13250            if (DocumentInfoValidators[key]) {
13251              if (DocumentInfoValidators[key](value)) {
13252                docInfo[key] = typeof value !== 'string' ? value : (0, _util.stringToPDFString)(value);
13253              } else {
13254                (0, _util.info)("Bad value in document info for \"".concat(key, "\"."));
13255              }
13256            } else if (typeof key === 'string') {
13257              var customValue = void 0;
13258
13259              if ((0, _util.isString)(value)) {
13260                customValue = (0, _util.stringToPDFString)(value);
13261              } else if ((0, _primitives.isName)(value) || (0, _util.isNum)(value) || (0, _util.isBool)(value)) {
13262                customValue = value;
13263              } else {
13264                (0, _util.info)("Unsupported value in document info for (custom) \"".concat(key, "\"."));
13265                continue;
13266              }
13267
13268              if (!docInfo['Custom']) {
13269                docInfo['Custom'] = Object.create(null);
13270              }
13271
13272              docInfo['Custom'][key] = customValue;
13273            }
13274          }
13275        } catch (err) {
13276          _didIteratorError4 = true;
13277          _iteratorError4 = err;
13278        } finally {
13279          try {
13280            if (!_iteratorNormalCompletion4 && _iterator4["return"] != null) {
13281              _iterator4["return"]();
13282            }
13283          } finally {
13284            if (_didIteratorError4) {
13285              throw _iteratorError4;
13286            }
13287          }
13288        }
13289      }
13290
13291      return (0, _util.shadow)(this, 'documentInfo', docInfo);
13292    }
13293  }, {
13294    key: "fingerprint",
13295    get: function get() {
13296      var hash;
13297      var idArray = this.xref.trailer.get('ID');
13298
13299      if (Array.isArray(idArray) && idArray[0] && (0, _util.isString)(idArray[0]) && idArray[0] !== EMPTY_FINGERPRINT) {
13300        hash = (0, _util.stringToBytes)(idArray[0]);
13301      } else {
13302        if (this.stream.ensureRange) {
13303          this.stream.ensureRange(0, Math.min(FINGERPRINT_FIRST_BYTES, this.stream.end));
13304        }
13305
13306        hash = (0, _crypto.calculateMD5)(this.stream.bytes.subarray(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
13307      }
13308
13309      var fingerprint = '';
13310
13311      for (var i = 0, ii = hash.length; i < ii; i++) {
13312        var hex = hash[i].toString(16);
13313        fingerprint += hex.length === 1 ? '0' + hex : hex;
13314      }
13315
13316      return (0, _util.shadow)(this, 'fingerprint', fingerprint);
13317    }
13318  }]);
13319
13320  return PDFDocument;
13321}();
13322
13323exports.PDFDocument = PDFDocument;
13324
13325/***/ }),
13326/* 156 */
13327/***/ (function(module, exports, __w_pdfjs_require__) {
13328
13329"use strict";
13330
13331
13332Object.defineProperty(exports, "__esModule", {
13333  value: true
13334});
13335exports.FileSpec = exports.XRef = exports.ObjectLoader = exports.Catalog = void 0;
13336
13337var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2));
13338
13339var _util = __w_pdfjs_require__(5);
13340
13341var _primitives = __w_pdfjs_require__(151);
13342
13343var _parser = __w_pdfjs_require__(157);
13344
13345var _core_utils = __w_pdfjs_require__(154);
13346
13347var _chunked_stream = __w_pdfjs_require__(153);
13348
13349var _crypto = __w_pdfjs_require__(168);
13350
13351var _colorspace = __w_pdfjs_require__(169);
13352
13353function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13354
13355function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
13356
13357function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
13358
13359function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
13360
13361function _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); }
13362
13363function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
13364
13365function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
13366
13367function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
13368
13369function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
13370
13371function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
13372
13373function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
13374
13375function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13376
13377function _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); }
13378
13379function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
13380
13381function _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); } }
13382
13383function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
13384
13385function fetchDestination(dest) {
13386  return (0, _primitives.isDict)(dest) ? dest.get('D') : dest;
13387}
13388
13389var Catalog =
13390/*#__PURE__*/
13391function () {
13392  function Catalog(pdfManager, xref) {
13393    _classCallCheck(this, Catalog);
13394
13395    this.pdfManager = pdfManager;
13396    this.xref = xref;
13397    this.catDict = xref.getCatalogObj();
13398
13399    if (!(0, _primitives.isDict)(this.catDict)) {
13400      throw new _util.FormatError('Catalog object is not a dictionary.');
13401    }
13402
13403    this.fontCache = new _primitives.RefSetCache();
13404    this.builtInCMapCache = new Map();
13405    this.pageKidsCountCache = new _primitives.RefSetCache();
13406  }
13407
13408  _createClass(Catalog, [{
13409    key: "_readDocumentOutline",
13410    value: function _readDocumentOutline() {
13411      var obj = this.catDict.get('Outlines');
13412
13413      if (!(0, _primitives.isDict)(obj)) {
13414        return null;
13415      }
13416
13417      obj = obj.getRaw('First');
13418
13419      if (!(0, _primitives.isRef)(obj)) {
13420        return null;
13421      }
13422
13423      var root = {
13424        items: []
13425      };
13426      var queue = [{
13427        obj: obj,
13428        parent: root
13429      }];
13430      var processed = new _primitives.RefSet();
13431      processed.put(obj);
13432      var xref = this.xref,
13433          blackColor = new Uint8ClampedArray(3);
13434
13435      while (queue.length > 0) {
13436        var i = queue.shift();
13437        var outlineDict = xref.fetchIfRef(i.obj);
13438
13439        if (outlineDict === null) {
13440          continue;
13441        }
13442
13443        if (!outlineDict.has('Title')) {
13444          throw new _util.FormatError('Invalid outline item encountered.');
13445        }
13446
13447        var data = {
13448          url: null,
13449          dest: null
13450        };
13451        Catalog.parseDestDictionary({
13452          destDict: outlineDict,
13453          resultObj: data,
13454          docBaseUrl: this.pdfManager.docBaseUrl
13455        });
13456        var title = outlineDict.get('Title');
13457        var flags = outlineDict.get('F') || 0;
13458        var color = outlineDict.getArray('C');
13459        var count = outlineDict.get('Count');
13460        var rgbColor = blackColor;
13461
13462        if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
13463          rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0);
13464        }
13465
13466        var outlineItem = {
13467          dest: data.dest,
13468          url: data.url,
13469          unsafeUrl: data.unsafeUrl,
13470          newWindow: data.newWindow,
13471          title: (0, _util.stringToPDFString)(title),
13472          color: rgbColor,
13473          count: Number.isInteger(count) ? count : undefined,
13474          bold: !!(flags & 2),
13475          italic: !!(flags & 1),
13476          items: []
13477        };
13478        i.parent.items.push(outlineItem);
13479        obj = outlineDict.getRaw('First');
13480
13481        if ((0, _primitives.isRef)(obj) && !processed.has(obj)) {
13482          queue.push({
13483            obj: obj,
13484            parent: outlineItem
13485          });
13486          processed.put(obj);
13487        }
13488
13489        obj = outlineDict.getRaw('Next');
13490
13491        if ((0, _primitives.isRef)(obj) && !processed.has(obj)) {
13492          queue.push({
13493            obj: obj,
13494            parent: i.parent
13495          });
13496          processed.put(obj);
13497        }
13498      }
13499
13500      return root.items.length > 0 ? root.items : null;
13501    }
13502  }, {
13503    key: "_readPermissions",
13504    value: function _readPermissions() {
13505      var encrypt = this.xref.trailer.get('Encrypt');
13506
13507      if (!(0, _primitives.isDict)(encrypt)) {
13508        return null;
13509      }
13510
13511      var flags = encrypt.get('P');
13512
13513      if (!(0, _util.isNum)(flags)) {
13514        return null;
13515      }
13516
13517      flags += Math.pow(2, 32);
13518      var permissions = [];
13519
13520      for (var key in _util.PermissionFlag) {
13521        var value = _util.PermissionFlag[key];
13522
13523        if (flags & value) {
13524          permissions.push(value);
13525        }
13526      }
13527
13528      return permissions;
13529    }
13530  }, {
13531    key: "getDestination",
13532    value: function getDestination(destinationId) {
13533      var obj = this._readDests();
13534
13535      if (obj instanceof NameTree || obj instanceof _primitives.Dict) {
13536        return fetchDestination(obj.get(destinationId) || null);
13537      }
13538
13539      return null;
13540    }
13541  }, {
13542    key: "_readDests",
13543    value: function _readDests() {
13544      var obj = this.catDict.get('Names');
13545
13546      if (obj && obj.has('Dests')) {
13547        return new NameTree(obj.getRaw('Dests'), this.xref);
13548      } else if (this.catDict.has('Dests')) {
13549        return this.catDict.get('Dests');
13550      }
13551
13552      return undefined;
13553    }
13554  }, {
13555    key: "_readPageLabels",
13556    value: function _readPageLabels() {
13557      var obj = this.catDict.getRaw('PageLabels');
13558
13559      if (!obj) {
13560        return null;
13561      }
13562
13563      var pageLabels = new Array(this.numPages);
13564      var style = null,
13565          prefix = '';
13566      var numberTree = new NumberTree(obj, this.xref);
13567      var nums = numberTree.getAll();
13568      var currentLabel = '',
13569          currentIndex = 1;
13570
13571      for (var i = 0, ii = this.numPages; i < ii; i++) {
13572        if (i in nums) {
13573          var labelDict = nums[i];
13574
13575          if (!(0, _primitives.isDict)(labelDict)) {
13576            throw new _util.FormatError('PageLabel is not a dictionary.');
13577          }
13578
13579          if (labelDict.has('Type') && !(0, _primitives.isName)(labelDict.get('Type'), 'PageLabel')) {
13580            throw new _util.FormatError('Invalid type in PageLabel dictionary.');
13581          }
13582
13583          if (labelDict.has('S')) {
13584            var s = labelDict.get('S');
13585
13586            if (!(0, _primitives.isName)(s)) {
13587              throw new _util.FormatError('Invalid style in PageLabel dictionary.');
13588            }
13589
13590            style = s.name;
13591          } else {
13592            style = null;
13593          }
13594
13595          if (labelDict.has('P')) {
13596            var p = labelDict.get('P');
13597
13598            if (!(0, _util.isString)(p)) {
13599              throw new _util.FormatError('Invalid prefix in PageLabel dictionary.');
13600            }
13601
13602            prefix = (0, _util.stringToPDFString)(p);
13603          } else {
13604            prefix = '';
13605          }
13606
13607          if (labelDict.has('St')) {
13608            var st = labelDict.get('St');
13609
13610            if (!(Number.isInteger(st) && st >= 1)) {
13611              throw new _util.FormatError('Invalid start in PageLabel dictionary.');
13612            }
13613
13614            currentIndex = st;
13615          } else {
13616            currentIndex = 1;
13617          }
13618        }
13619
13620        switch (style) {
13621          case 'D':
13622            currentLabel = currentIndex;
13623            break;
13624
13625          case 'R':
13626          case 'r':
13627            currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === 'r');
13628            break;
13629
13630          case 'A':
13631          case 'a':
13632            var LIMIT = 26;
13633            var A_UPPER_CASE = 0x41,
13634                A_LOWER_CASE = 0x61;
13635            var baseCharCode = style === 'a' ? A_LOWER_CASE : A_UPPER_CASE;
13636            var letterIndex = currentIndex - 1;
13637            var character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
13638            var charBuf = [];
13639
13640            for (var j = 0, jj = letterIndex / LIMIT | 0; j <= jj; j++) {
13641              charBuf.push(character);
13642            }
13643
13644            currentLabel = charBuf.join('');
13645            break;
13646
13647          default:
13648            if (style) {
13649              throw new _util.FormatError("Invalid style \"".concat(style, "\" in PageLabel dictionary."));
13650            }
13651
13652            currentLabel = '';
13653        }
13654
13655        pageLabels[i] = prefix + currentLabel;
13656        currentIndex++;
13657      }
13658
13659      return pageLabels;
13660    }
13661  }, {
13662    key: "fontFallback",
13663    value: function fontFallback(id, handler) {
13664      var promises = [];
13665      this.fontCache.forEach(function (promise) {
13666        promises.push(promise);
13667      });
13668      return Promise.all(promises).then(function (translatedFonts) {
13669        var _iteratorNormalCompletion = true;
13670        var _didIteratorError = false;
13671        var _iteratorError = undefined;
13672
13673        try {
13674          for (var _iterator = translatedFonts[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
13675            var translatedFont = _step.value;
13676
13677            if (translatedFont.loadedName === id) {
13678              translatedFont.fallback(handler);
13679              return;
13680            }
13681          }
13682        } catch (err) {
13683          _didIteratorError = true;
13684          _iteratorError = err;
13685        } finally {
13686          try {
13687            if (!_iteratorNormalCompletion && _iterator["return"] != null) {
13688              _iterator["return"]();
13689            }
13690          } finally {
13691            if (_didIteratorError) {
13692              throw _iteratorError;
13693            }
13694          }
13695        }
13696      });
13697    }
13698  }, {
13699    key: "cleanup",
13700    value: function cleanup() {
13701      var _this = this;
13702
13703      (0, _primitives.clearPrimitiveCaches)();
13704      this.pageKidsCountCache.clear();
13705      var promises = [];
13706      this.fontCache.forEach(function (promise) {
13707        promises.push(promise);
13708      });
13709      return Promise.all(promises).then(function (translatedFonts) {
13710        for (var i = 0, ii = translatedFonts.length; i < ii; i++) {
13711          var font = translatedFonts[i].dict;
13712          delete font.translated;
13713        }
13714
13715        _this.fontCache.clear();
13716
13717        _this.builtInCMapCache.clear();
13718      });
13719    }
13720  }, {
13721    key: "getPageDict",
13722    value: function getPageDict(pageIndex) {
13723      var capability = (0, _util.createPromiseCapability)();
13724      var nodesToVisit = [this.catDict.getRaw('Pages')];
13725      var xref = this.xref,
13726          pageKidsCountCache = this.pageKidsCountCache;
13727      var count,
13728          currentPageIndex = 0;
13729
13730      function next() {
13731        var _loop = function _loop() {
13732          var currentNode = nodesToVisit.pop();
13733
13734          if ((0, _primitives.isRef)(currentNode)) {
13735            count = pageKidsCountCache.get(currentNode);
13736
13737            if (count > 0 && currentPageIndex + count < pageIndex) {
13738              currentPageIndex += count;
13739              return "continue";
13740            }
13741
13742            xref.fetchAsync(currentNode).then(function (obj) {
13743              if ((0, _primitives.isDict)(obj, 'Page') || (0, _primitives.isDict)(obj) && !obj.has('Kids')) {
13744                if (pageIndex === currentPageIndex) {
13745                  if (currentNode && !pageKidsCountCache.has(currentNode)) {
13746                    pageKidsCountCache.put(currentNode, 1);
13747                  }
13748
13749                  capability.resolve([obj, currentNode]);
13750                } else {
13751                  currentPageIndex++;
13752                  next();
13753                }
13754
13755                return;
13756              }
13757
13758              nodesToVisit.push(obj);
13759              next();
13760            }, capability.reject);
13761            return {
13762              v: void 0
13763            };
13764          }
13765
13766          if (!(0, _primitives.isDict)(currentNode)) {
13767            capability.reject(new _util.FormatError('Page dictionary kid reference points to wrong type of object.'));
13768            return {
13769              v: void 0
13770            };
13771          }
13772
13773          count = currentNode.get('Count');
13774
13775          if (Number.isInteger(count) && count >= 0) {
13776            var objId = currentNode.objId;
13777
13778            if (objId && !pageKidsCountCache.has(objId)) {
13779              pageKidsCountCache.put(objId, count);
13780            }
13781
13782            if (currentPageIndex + count <= pageIndex) {
13783              currentPageIndex += count;
13784              return "continue";
13785            }
13786          }
13787
13788          var kids = currentNode.get('Kids');
13789
13790          if (!Array.isArray(kids)) {
13791            if ((0, _primitives.isName)(currentNode.get('Type'), 'Page') || !currentNode.has('Type') && currentNode.has('Contents')) {
13792              if (currentPageIndex === pageIndex) {
13793                capability.resolve([currentNode, null]);
13794                return {
13795                  v: void 0
13796                };
13797              }
13798
13799              currentPageIndex++;
13800              return "continue";
13801            }
13802
13803            capability.reject(new _util.FormatError('Page dictionary kids object is not an array.'));
13804            return {
13805              v: void 0
13806            };
13807          }
13808
13809          for (var last = kids.length - 1; last >= 0; last--) {
13810            nodesToVisit.push(kids[last]);
13811          }
13812        };
13813
13814        while (nodesToVisit.length) {
13815          var _ret = _loop();
13816
13817          switch (_ret) {
13818            case "continue":
13819              continue;
13820
13821            default:
13822              if (_typeof(_ret) === "object") return _ret.v;
13823          }
13824        }
13825
13826        capability.reject(new Error("Page index ".concat(pageIndex, " not found.")));
13827      }
13828
13829      next();
13830      return capability.promise;
13831    }
13832  }, {
13833    key: "getPageIndex",
13834    value: function getPageIndex(pageRef) {
13835      var xref = this.xref;
13836
13837      function pagesBeforeRef(kidRef) {
13838        var total = 0,
13839            parentRef;
13840        return xref.fetchAsync(kidRef).then(function (node) {
13841          if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, 'Page') && !((0, _primitives.isDict)(node) && !node.has('Type') && node.has('Contents'))) {
13842            throw new _util.FormatError('The reference does not point to a /Page dictionary.');
13843          }
13844
13845          if (!node) {
13846            return null;
13847          }
13848
13849          if (!(0, _primitives.isDict)(node)) {
13850            throw new _util.FormatError('Node must be a dictionary.');
13851          }
13852
13853          parentRef = node.getRaw('Parent');
13854          return node.getAsync('Parent');
13855        }).then(function (parent) {
13856          if (!parent) {
13857            return null;
13858          }
13859
13860          if (!(0, _primitives.isDict)(parent)) {
13861            throw new _util.FormatError('Parent must be a dictionary.');
13862          }
13863
13864          return parent.getAsync('Kids');
13865        }).then(function (kids) {
13866          if (!kids) {
13867            return null;
13868          }
13869
13870          var kidPromises = [];
13871          var found = false;
13872
13873          for (var i = 0, ii = kids.length; i < ii; i++) {
13874            var kid = kids[i];
13875
13876            if (!(0, _primitives.isRef)(kid)) {
13877              throw new _util.FormatError('Kid must be a reference.');
13878            }
13879
13880            if ((0, _primitives.isRefsEqual)(kid, kidRef)) {
13881              found = true;
13882              break;
13883            }
13884
13885            kidPromises.push(xref.fetchAsync(kid).then(function (kid) {
13886              if (!(0, _primitives.isDict)(kid)) {
13887                throw new _util.FormatError('Kid node must be a dictionary.');
13888              }
13889
13890              if (kid.has('Count')) {
13891                total += kid.get('Count');
13892              } else {
13893                total++;
13894              }
13895            }));
13896          }
13897
13898          if (!found) {
13899            throw new _util.FormatError('Kid reference not found in parent\'s kids.');
13900          }
13901
13902          return Promise.all(kidPromises).then(function () {
13903            return [total, parentRef];
13904          });
13905        });
13906      }
13907
13908      var total = 0;
13909
13910      function next(ref) {
13911        return pagesBeforeRef(ref).then(function (args) {
13912          if (!args) {
13913            return total;
13914          }
13915
13916          var _args = _slicedToArray(args, 2),
13917              count = _args[0],
13918              parentRef = _args[1];
13919
13920          total += count;
13921          return next(parentRef);
13922        });
13923      }
13924
13925      return next(pageRef);
13926    }
13927  }, {
13928    key: "metadata",
13929    get: function get() {
13930      var streamRef = this.catDict.getRaw('Metadata');
13931
13932      if (!(0, _primitives.isRef)(streamRef)) {
13933        return (0, _util.shadow)(this, 'metadata', null);
13934      }
13935
13936      var suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata);
13937      var stream = this.xref.fetch(streamRef, suppressEncryption);
13938      var metadata;
13939
13940      if (stream && (0, _primitives.isDict)(stream.dict)) {
13941        var type = stream.dict.get('Type');
13942        var subtype = stream.dict.get('Subtype');
13943
13944        if ((0, _primitives.isName)(type, 'Metadata') && (0, _primitives.isName)(subtype, 'XML')) {
13945          try {
13946            metadata = (0, _util.stringToUTF8String)((0, _util.bytesToString)(stream.getBytes()));
13947          } catch (e) {
13948            if (e instanceof _core_utils.MissingDataException) {
13949              throw e;
13950            }
13951
13952            (0, _util.info)('Skipping invalid metadata.');
13953          }
13954        }
13955      }
13956
13957      return (0, _util.shadow)(this, 'metadata', metadata);
13958    }
13959  }, {
13960    key: "toplevelPagesDict",
13961    get: function get() {
13962      var pagesObj = this.catDict.get('Pages');
13963
13964      if (!(0, _primitives.isDict)(pagesObj)) {
13965        throw new _util.FormatError('Invalid top-level pages dictionary.');
13966      }
13967
13968      return (0, _util.shadow)(this, 'toplevelPagesDict', pagesObj);
13969    }
13970  }, {
13971    key: "documentOutline",
13972    get: function get() {
13973      var obj = null;
13974
13975      try {
13976        obj = this._readDocumentOutline();
13977      } catch (ex) {
13978        if (ex instanceof _core_utils.MissingDataException) {
13979          throw ex;
13980        }
13981
13982        (0, _util.warn)('Unable to read document outline.');
13983      }
13984
13985      return (0, _util.shadow)(this, 'documentOutline', obj);
13986    }
13987  }, {
13988    key: "permissions",
13989    get: function get() {
13990      var permissions = null;
13991
13992      try {
13993        permissions = this._readPermissions();
13994      } catch (ex) {
13995        if (ex instanceof _core_utils.MissingDataException) {
13996          throw ex;
13997        }
13998
13999        (0, _util.warn)('Unable to read permissions.');
14000      }
14001
14002      return (0, _util.shadow)(this, 'permissions', permissions);
14003    }
14004  }, {
14005    key: "numPages",
14006    get: function get() {
14007      var obj = this.toplevelPagesDict.get('Count');
14008
14009      if (!Number.isInteger(obj)) {
14010        throw new _util.FormatError('Page count in top-level pages dictionary is not an integer.');
14011      }
14012
14013      return (0, _util.shadow)(this, 'numPages', obj);
14014    }
14015  }, {
14016    key: "destinations",
14017    get: function get() {
14018      var obj = this._readDests(),
14019          dests = Object.create(null);
14020
14021      if (obj instanceof NameTree) {
14022        var names = obj.getAll();
14023
14024        for (var name in names) {
14025          dests[name] = fetchDestination(names[name]);
14026        }
14027      } else if (obj instanceof _primitives.Dict) {
14028        obj.forEach(function (key, value) {
14029          if (value) {
14030            dests[key] = fetchDestination(value);
14031          }
14032        });
14033      }
14034
14035      return (0, _util.shadow)(this, 'destinations', dests);
14036    }
14037  }, {
14038    key: "pageLabels",
14039    get: function get() {
14040      var obj = null;
14041
14042      try {
14043        obj = this._readPageLabels();
14044      } catch (ex) {
14045        if (ex instanceof _core_utils.MissingDataException) {
14046          throw ex;
14047        }
14048
14049        (0, _util.warn)('Unable to read page labels.');
14050      }
14051
14052      return (0, _util.shadow)(this, 'pageLabels', obj);
14053    }
14054  }, {
14055    key: "pageLayout",
14056    get: function get() {
14057      var obj = this.catDict.get('PageLayout');
14058      var pageLayout = '';
14059
14060      if ((0, _primitives.isName)(obj)) {
14061        switch (obj.name) {
14062          case 'SinglePage':
14063          case 'OneColumn':
14064          case 'TwoColumnLeft':
14065          case 'TwoColumnRight':
14066          case 'TwoPageLeft':
14067          case 'TwoPageRight':
14068            pageLayout = obj.name;
14069        }
14070      }
14071
14072      return (0, _util.shadow)(this, 'pageLayout', pageLayout);
14073    }
14074  }, {
14075    key: "pageMode",
14076    get: function get() {
14077      var obj = this.catDict.get('PageMode');
14078      var pageMode = 'UseNone';
14079
14080      if ((0, _primitives.isName)(obj)) {
14081        switch (obj.name) {
14082          case 'UseNone':
14083          case 'UseOutlines':
14084          case 'UseThumbs':
14085          case 'FullScreen':
14086          case 'UseOC':
14087          case 'UseAttachments':
14088            pageMode = obj.name;
14089        }
14090      }
14091
14092      return (0, _util.shadow)(this, 'pageMode', pageMode);
14093    }
14094  }, {
14095    key: "viewerPreferences",
14096    get: function get() {
14097      var _this2 = this;
14098
14099      var ViewerPreferencesValidators = {
14100        HideToolbar: _util.isBool,
14101        HideMenubar: _util.isBool,
14102        HideWindowUI: _util.isBool,
14103        FitWindow: _util.isBool,
14104        CenterWindow: _util.isBool,
14105        DisplayDocTitle: _util.isBool,
14106        NonFullScreenPageMode: _primitives.isName,
14107        Direction: _primitives.isName,
14108        ViewArea: _primitives.isName,
14109        ViewClip: _primitives.isName,
14110        PrintArea: _primitives.isName,
14111        PrintClip: _primitives.isName,
14112        PrintScaling: _primitives.isName,
14113        Duplex: _primitives.isName,
14114        PickTrayByPDFSize: _util.isBool,
14115        PrintPageRange: Array.isArray,
14116        NumCopies: Number.isInteger
14117      };
14118      var obj = this.catDict.get('ViewerPreferences');
14119      var prefs = Object.create(null);
14120
14121      if ((0, _primitives.isDict)(obj)) {
14122        for (var key in ViewerPreferencesValidators) {
14123          if (!obj.has(key)) {
14124            continue;
14125          }
14126
14127          var value = obj.get(key);
14128
14129          if (!ViewerPreferencesValidators[key](value)) {
14130            (0, _util.info)("Bad value in ViewerPreferences for \"".concat(key, "\"."));
14131            continue;
14132          }
14133
14134          var prefValue = void 0;
14135
14136          switch (key) {
14137            case 'NonFullScreenPageMode':
14138              switch (value.name) {
14139                case 'UseNone':
14140                case 'UseOutlines':
14141                case 'UseThumbs':
14142                case 'UseOC':
14143                  prefValue = value.name;
14144                  break;
14145
14146                default:
14147                  prefValue = 'UseNone';
14148              }
14149
14150              break;
14151
14152            case 'Direction':
14153              switch (value.name) {
14154                case 'L2R':
14155                case 'R2L':
14156                  prefValue = value.name;
14157                  break;
14158
14159                default:
14160                  prefValue = 'L2R';
14161              }
14162
14163              break;
14164
14165            case 'ViewArea':
14166            case 'ViewClip':
14167            case 'PrintArea':
14168            case 'PrintClip':
14169              switch (value.name) {
14170                case 'MediaBox':
14171                case 'CropBox':
14172                case 'BleedBox':
14173                case 'TrimBox':
14174                case 'ArtBox':
14175                  prefValue = value.name;
14176                  break;
14177
14178                default:
14179                  prefValue = 'CropBox';
14180              }
14181
14182              break;
14183
14184            case 'PrintScaling':
14185              switch (value.name) {
14186                case 'None':
14187                case 'AppDefault':
14188                  prefValue = value.name;
14189                  break;
14190
14191                default:
14192                  prefValue = 'AppDefault';
14193              }
14194
14195              break;
14196
14197            case 'Duplex':
14198              switch (value.name) {
14199                case 'Simplex':
14200                case 'DuplexFlipShortEdge':
14201                case 'DuplexFlipLongEdge':
14202                  prefValue = value.name;
14203                  break;
14204
14205                default:
14206                  prefValue = 'None';
14207              }
14208
14209              break;
14210
14211            case 'PrintPageRange':
14212              var length = value.length;
14213
14214              if (length % 2 !== 0) {
14215                break;
14216              }
14217
14218              var isValid = value.every(function (page, i, arr) {
14219                return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= _this2.numPages;
14220              });
14221
14222              if (isValid) {
14223                prefValue = value;
14224              }
14225
14226              break;
14227
14228            case 'NumCopies':
14229              if (value > 0) {
14230                prefValue = value;
14231              }
14232
14233              break;
14234
14235            default:
14236              (0, _util.assert)(typeof value === 'boolean');
14237              prefValue = value;
14238          }
14239
14240          if (prefValue !== undefined) {
14241            prefs[key] = prefValue;
14242          } else {
14243            (0, _util.info)("Bad value in ViewerPreferences for \"".concat(key, "\"."));
14244          }
14245        }
14246      }
14247
14248      return (0, _util.shadow)(this, 'viewerPreferences', prefs);
14249    }
14250  }, {
14251    key: "openActionDestination",
14252    get: function get() {
14253      var obj = this.catDict.get('OpenAction');
14254      var openActionDest = null;
14255
14256      if ((0, _primitives.isDict)(obj)) {
14257        var destDict = new _primitives.Dict(this.xref);
14258        destDict.set('A', obj);
14259        var resultObj = {
14260          url: null,
14261          dest: null
14262        };
14263        Catalog.parseDestDictionary({
14264          destDict: destDict,
14265          resultObj: resultObj
14266        });
14267
14268        if (Array.isArray(resultObj.dest)) {
14269          openActionDest = resultObj.dest;
14270        }
14271      } else if (Array.isArray(obj)) {
14272        openActionDest = obj;
14273      }
14274
14275      return (0, _util.shadow)(this, 'openActionDestination', openActionDest);
14276    }
14277  }, {
14278    key: "attachments",
14279    get: function get() {
14280      var obj = this.catDict.get('Names');
14281      var attachments = null;
14282
14283      if (obj && obj.has('EmbeddedFiles')) {
14284        var nameTree = new NameTree(obj.getRaw('EmbeddedFiles'), this.xref);
14285        var names = nameTree.getAll();
14286
14287        for (var name in names) {
14288          var fs = new FileSpec(names[name], this.xref);
14289
14290          if (!attachments) {
14291            attachments = Object.create(null);
14292          }
14293
14294          attachments[(0, _util.stringToPDFString)(name)] = fs.serializable;
14295        }
14296      }
14297
14298      return (0, _util.shadow)(this, 'attachments', attachments);
14299    }
14300  }, {
14301    key: "javaScript",
14302    get: function get() {
14303      var obj = this.catDict.get('Names');
14304      var javaScript = null;
14305
14306      function appendIfJavaScriptDict(jsDict) {
14307        var type = jsDict.get('S');
14308
14309        if (!(0, _primitives.isName)(type, 'JavaScript')) {
14310          return;
14311        }
14312
14313        var js = jsDict.get('JS');
14314
14315        if ((0, _primitives.isStream)(js)) {
14316          js = (0, _util.bytesToString)(js.getBytes());
14317        } else if (!(0, _util.isString)(js)) {
14318          return;
14319        }
14320
14321        if (!javaScript) {
14322          javaScript = [];
14323        }
14324
14325        javaScript.push((0, _util.stringToPDFString)(js));
14326      }
14327
14328      if (obj && obj.has('JavaScript')) {
14329        var nameTree = new NameTree(obj.getRaw('JavaScript'), this.xref);
14330        var names = nameTree.getAll();
14331
14332        for (var name in names) {
14333          var jsDict = names[name];
14334
14335          if ((0, _primitives.isDict)(jsDict)) {
14336            appendIfJavaScriptDict(jsDict);
14337          }
14338        }
14339      }
14340
14341      var openActionDict = this.catDict.get('OpenAction');
14342
14343      if ((0, _primitives.isDict)(openActionDict, 'Action')) {
14344        var actionType = openActionDict.get('S');
14345
14346        if ((0, _primitives.isName)(actionType, 'Named')) {
14347          var action = openActionDict.get('N');
14348
14349          if ((0, _primitives.isName)(action, 'Print')) {
14350            if (!javaScript) {
14351              javaScript = [];
14352            }
14353
14354            javaScript.push('print({});');
14355          }
14356        } else {
14357          appendIfJavaScriptDict(openActionDict);
14358        }
14359      }
14360
14361      return (0, _util.shadow)(this, 'javaScript', javaScript);
14362    }
14363  }], [{
14364    key: "parseDestDictionary",
14365    value: function parseDestDictionary(params) {
14366      function addDefaultProtocolToUrl(url) {
14367        return url.startsWith('www.') ? "http://".concat(url) : url;
14368      }
14369
14370      function tryConvertUrlEncoding(url) {
14371        try {
14372          return (0, _util.stringToUTF8String)(url);
14373        } catch (e) {
14374          return url;
14375        }
14376      }
14377
14378      var destDict = params.destDict;
14379
14380      if (!(0, _primitives.isDict)(destDict)) {
14381        (0, _util.warn)('parseDestDictionary: `destDict` must be a dictionary.');
14382        return;
14383      }
14384
14385      var resultObj = params.resultObj;
14386
14387      if (_typeof(resultObj) !== 'object') {
14388        (0, _util.warn)('parseDestDictionary: `resultObj` must be an object.');
14389        return;
14390      }
14391
14392      var docBaseUrl = params.docBaseUrl || null;
14393      var action = destDict.get('A'),
14394          url,
14395          dest;
14396
14397      if (!(0, _primitives.isDict)(action) && destDict.has('Dest')) {
14398        action = destDict.get('Dest');
14399      }
14400
14401      if ((0, _primitives.isDict)(action)) {
14402        var actionType = action.get('S');
14403
14404        if (!(0, _primitives.isName)(actionType)) {
14405          (0, _util.warn)('parseDestDictionary: Invalid type in Action dictionary.');
14406          return;
14407        }
14408
14409        var actionName = actionType.name;
14410
14411        switch (actionName) {
14412          case 'URI':
14413            url = action.get('URI');
14414
14415            if ((0, _primitives.isName)(url)) {
14416              url = '/' + url.name;
14417            } else if ((0, _util.isString)(url)) {
14418              url = addDefaultProtocolToUrl(url);
14419            }
14420
14421            break;
14422
14423          case 'GoTo':
14424            dest = action.get('D');
14425            break;
14426
14427          case 'Launch':
14428          case 'GoToR':
14429            var urlDict = action.get('F');
14430
14431            if ((0, _primitives.isDict)(urlDict)) {
14432              url = urlDict.get('F') || null;
14433            } else if ((0, _util.isString)(urlDict)) {
14434              url = urlDict;
14435            }
14436
14437            var remoteDest = action.get('D');
14438
14439            if (remoteDest) {
14440              if ((0, _primitives.isName)(remoteDest)) {
14441                remoteDest = remoteDest.name;
14442              }
14443
14444              if ((0, _util.isString)(url)) {
14445                var baseUrl = url.split('#')[0];
14446
14447                if ((0, _util.isString)(remoteDest)) {
14448                  url = baseUrl + '#' + remoteDest;
14449                } else if (Array.isArray(remoteDest)) {
14450                  url = baseUrl + '#' + JSON.stringify(remoteDest);
14451                }
14452              }
14453            }
14454
14455            var newWindow = action.get('NewWindow');
14456
14457            if ((0, _util.isBool)(newWindow)) {
14458              resultObj.newWindow = newWindow;
14459            }
14460
14461            break;
14462
14463          case 'Named':
14464            var namedAction = action.get('N');
14465
14466            if ((0, _primitives.isName)(namedAction)) {
14467              resultObj.action = namedAction.name;
14468            }
14469
14470            break;
14471
14472          case 'JavaScript':
14473            var jsAction = action.get('JS');
14474            var js;
14475
14476            if ((0, _primitives.isStream)(jsAction)) {
14477              js = (0, _util.bytesToString)(jsAction.getBytes());
14478            } else if ((0, _util.isString)(jsAction)) {
14479              js = jsAction;
14480            }
14481
14482            if (js) {
14483              var URL_OPEN_METHODS = ['app.launchURL', 'window.open'];
14484              var regex = new RegExp('^\\s*(' + URL_OPEN_METHODS.join('|').split('.').join('\\.') + ')\\((?:\'|\")([^\'\"]*)(?:\'|\")(?:,\\s*(\\w+)\\)|\\))', 'i');
14485              var jsUrl = regex.exec((0, _util.stringToPDFString)(js));
14486
14487              if (jsUrl && jsUrl[2]) {
14488                url = jsUrl[2];
14489
14490                if (jsUrl[3] === 'true' && jsUrl[1] === 'app.launchURL') {
14491                  resultObj.newWindow = true;
14492                }
14493
14494                break;
14495              }
14496            }
14497
14498          default:
14499            (0, _util.warn)("parseDestDictionary: unsupported action type \"".concat(actionName, "\"."));
14500            break;
14501        }
14502      } else if (destDict.has('Dest')) {
14503        dest = destDict.get('Dest');
14504      }
14505
14506      if ((0, _util.isString)(url)) {
14507        url = tryConvertUrlEncoding(url);
14508        var absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl);
14509
14510        if (absoluteUrl) {
14511          resultObj.url = absoluteUrl.href;
14512        }
14513
14514        resultObj.unsafeUrl = url;
14515      }
14516
14517      if (dest) {
14518        if ((0, _primitives.isName)(dest)) {
14519          dest = dest.name;
14520        }
14521
14522        if ((0, _util.isString)(dest) || Array.isArray(dest)) {
14523          resultObj.dest = dest;
14524        }
14525      }
14526    }
14527  }]);
14528
14529  return Catalog;
14530}();
14531
14532exports.Catalog = Catalog;
14533
14534var XRef = function XRefClosure() {
14535  function XRef(stream, pdfManager) {
14536    this.stream = stream;
14537    this.pdfManager = pdfManager;
14538    this.entries = [];
14539    this.xrefstms = Object.create(null);
14540    this.cache = [];
14541    this.stats = {
14542      streamTypes: [],
14543      fontTypes: []
14544    };
14545  }
14546
14547  XRef.prototype = {
14548    setStartXRef: function XRef_setStartXRef(startXRef) {
14549      this.startXRefQueue = [startXRef];
14550    },
14551    parse: function XRef_parse(recoveryMode) {
14552      var trailerDict;
14553
14554      if (!recoveryMode) {
14555        trailerDict = this.readXRef();
14556      } else {
14557        (0, _util.warn)('Indexing all PDF objects');
14558        trailerDict = this.indexObjects();
14559      }
14560
14561      trailerDict.assignXref(this);
14562      this.trailer = trailerDict;
14563      var encrypt;
14564
14565      try {
14566        encrypt = trailerDict.get('Encrypt');
14567      } catch (ex) {
14568        if (ex instanceof _core_utils.MissingDataException) {
14569          throw ex;
14570        }
14571
14572        (0, _util.warn)("XRef.parse - Invalid \"Encrypt\" reference: \"".concat(ex, "\"."));
14573      }
14574
14575      if ((0, _primitives.isDict)(encrypt)) {
14576        var ids = trailerDict.get('ID');
14577        var fileId = ids && ids.length ? ids[0] : '';
14578        encrypt.suppressEncryption = true;
14579        this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
14580      }
14581
14582      var root;
14583
14584      try {
14585        root = trailerDict.get('Root');
14586      } catch (ex) {
14587        if (ex instanceof _core_utils.MissingDataException) {
14588          throw ex;
14589        }
14590
14591        (0, _util.warn)("XRef.parse - Invalid \"Root\" reference: \"".concat(ex, "\"."));
14592      }
14593
14594      if ((0, _primitives.isDict)(root) && root.has('Pages')) {
14595        this.root = root;
14596      } else {
14597        if (!recoveryMode) {
14598          throw new _core_utils.XRefParseException();
14599        }
14600
14601        throw new _util.FormatError('Invalid root reference');
14602      }
14603    },
14604    processXRefTable: function XRef_processXRefTable(parser) {
14605      if (!('tableState' in this)) {
14606        this.tableState = {
14607          entryNum: 0,
14608          streamPos: parser.lexer.stream.pos,
14609          parserBuf1: parser.buf1,
14610          parserBuf2: parser.buf2
14611        };
14612      }
14613
14614      var obj = this.readXRefTable(parser);
14615
14616      if (!(0, _primitives.isCmd)(obj, 'trailer')) {
14617        throw new _util.FormatError('Invalid XRef table: could not find trailer dictionary');
14618      }
14619
14620      var dict = parser.getObj();
14621
14622      if (!(0, _primitives.isDict)(dict) && dict.dict) {
14623        dict = dict.dict;
14624      }
14625
14626      if (!(0, _primitives.isDict)(dict)) {
14627        throw new _util.FormatError('Invalid XRef table: could not parse trailer dictionary');
14628      }
14629
14630      delete this.tableState;
14631      return dict;
14632    },
14633    readXRefTable: function XRef_readXRefTable(parser) {
14634      var stream = parser.lexer.stream;
14635      var tableState = this.tableState;
14636      stream.pos = tableState.streamPos;
14637      parser.buf1 = tableState.parserBuf1;
14638      parser.buf2 = tableState.parserBuf2;
14639      var obj;
14640
14641      while (true) {
14642        if (!('firstEntryNum' in tableState) || !('entryCount' in tableState)) {
14643          if ((0, _primitives.isCmd)(obj = parser.getObj(), 'trailer')) {
14644            break;
14645          }
14646
14647          tableState.firstEntryNum = obj;
14648          tableState.entryCount = parser.getObj();
14649        }
14650
14651        var first = tableState.firstEntryNum;
14652        var count = tableState.entryCount;
14653
14654        if (!Number.isInteger(first) || !Number.isInteger(count)) {
14655          throw new _util.FormatError('Invalid XRef table: wrong types in subsection header');
14656        }
14657
14658        for (var i = tableState.entryNum; i < count; i++) {
14659          tableState.streamPos = stream.pos;
14660          tableState.entryNum = i;
14661          tableState.parserBuf1 = parser.buf1;
14662          tableState.parserBuf2 = parser.buf2;
14663          var entry = {};
14664          entry.offset = parser.getObj();
14665          entry.gen = parser.getObj();
14666          var type = parser.getObj();
14667
14668          if (type instanceof _primitives.Cmd) {
14669            switch (type.cmd) {
14670              case 'f':
14671                entry.free = true;
14672                break;
14673
14674              case 'n':
14675                entry.uncompressed = true;
14676                break;
14677            }
14678          }
14679
14680          if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {
14681            throw new _util.FormatError("Invalid entry in XRef subsection: ".concat(first, ", ").concat(count));
14682          }
14683
14684          if (i === 0 && entry.free && first === 1) {
14685            first = 0;
14686          }
14687
14688          if (!this.entries[i + first]) {
14689            this.entries[i + first] = entry;
14690          }
14691        }
14692
14693        tableState.entryNum = 0;
14694        tableState.streamPos = stream.pos;
14695        tableState.parserBuf1 = parser.buf1;
14696        tableState.parserBuf2 = parser.buf2;
14697        delete tableState.firstEntryNum;
14698        delete tableState.entryCount;
14699      }
14700
14701      if (this.entries[0] && !this.entries[0].free) {
14702        throw new _util.FormatError('Invalid XRef table: unexpected first object');
14703      }
14704
14705      return obj;
14706    },
14707    processXRefStream: function XRef_processXRefStream(stream) {
14708      if (!('streamState' in this)) {
14709        var streamParameters = stream.dict;
14710        var byteWidths = streamParameters.get('W');
14711        var range = streamParameters.get('Index');
14712
14713        if (!range) {
14714          range = [0, streamParameters.get('Size')];
14715        }
14716
14717        this.streamState = {
14718          entryRanges: range,
14719          byteWidths: byteWidths,
14720          entryNum: 0,
14721          streamPos: stream.pos
14722        };
14723      }
14724
14725      this.readXRefStream(stream);
14726      delete this.streamState;
14727      return stream.dict;
14728    },
14729    readXRefStream: function XRef_readXRefStream(stream) {
14730      var i, j;
14731      var streamState = this.streamState;
14732      stream.pos = streamState.streamPos;
14733      var byteWidths = streamState.byteWidths;
14734      var typeFieldWidth = byteWidths[0];
14735      var offsetFieldWidth = byteWidths[1];
14736      var generationFieldWidth = byteWidths[2];
14737      var entryRanges = streamState.entryRanges;
14738
14739      while (entryRanges.length > 0) {
14740        var first = entryRanges[0];
14741        var n = entryRanges[1];
14742
14743        if (!Number.isInteger(first) || !Number.isInteger(n)) {
14744          throw new _util.FormatError("Invalid XRef range fields: ".concat(first, ", ").concat(n));
14745        }
14746
14747        if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {
14748          throw new _util.FormatError("Invalid XRef entry fields length: ".concat(first, ", ").concat(n));
14749        }
14750
14751        for (i = streamState.entryNum; i < n; ++i) {
14752          streamState.entryNum = i;
14753          streamState.streamPos = stream.pos;
14754          var type = 0,
14755              offset = 0,
14756              generation = 0;
14757
14758          for (j = 0; j < typeFieldWidth; ++j) {
14759            type = type << 8 | stream.getByte();
14760          }
14761
14762          if (typeFieldWidth === 0) {
14763            type = 1;
14764          }
14765
14766          for (j = 0; j < offsetFieldWidth; ++j) {
14767            offset = offset << 8 | stream.getByte();
14768          }
14769
14770          for (j = 0; j < generationFieldWidth; ++j) {
14771            generation = generation << 8 | stream.getByte();
14772          }
14773
14774          var entry = {};
14775          entry.offset = offset;
14776          entry.gen = generation;
14777
14778          switch (type) {
14779            case 0:
14780              entry.free = true;
14781              break;
14782
14783            case 1:
14784              entry.uncompressed = true;
14785              break;
14786
14787            case 2:
14788              break;
14789
14790            default:
14791              throw new _util.FormatError("Invalid XRef entry type: ".concat(type));
14792          }
14793
14794          if (!this.entries[first + i]) {
14795            this.entries[first + i] = entry;
14796          }
14797        }
14798
14799        streamState.entryNum = 0;
14800        streamState.streamPos = stream.pos;
14801        entryRanges.splice(0, 2);
14802      }
14803    },
14804    indexObjects: function XRef_indexObjects() {
14805      var TAB = 0x9,
14806          LF = 0xA,
14807          CR = 0xD,
14808          SPACE = 0x20;
14809      var PERCENT = 0x25,
14810          LT = 0x3C;
14811
14812      function readToken(data, offset) {
14813        var token = '',
14814            ch = data[offset];
14815
14816        while (ch !== LF && ch !== CR && ch !== LT) {
14817          if (++offset >= data.length) {
14818            break;
14819          }
14820
14821          token += String.fromCharCode(ch);
14822          ch = data[offset];
14823        }
14824
14825        return token;
14826      }
14827
14828      function skipUntil(data, offset, what) {
14829        var length = what.length,
14830            dataLength = data.length;
14831        var skipped = 0;
14832
14833        while (offset < dataLength) {
14834          var i = 0;
14835
14836          while (i < length && data[offset + i] === what[i]) {
14837            ++i;
14838          }
14839
14840          if (i >= length) {
14841            break;
14842          }
14843
14844          offset++;
14845          skipped++;
14846        }
14847
14848        return skipped;
14849      }
14850
14851      var objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
14852      var endobjRegExp = /\bendobj[\b\s]$/;
14853      var nestedObjRegExp = /\s+(\d+\s+\d+\s+obj[\b\s<])$/;
14854      var CHECK_CONTENT_LENGTH = 25;
14855      var trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
14856      var startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
14857      var objBytes = new Uint8Array([111, 98, 106]);
14858      var xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
14859      this.entries.length = 0;
14860      var stream = this.stream;
14861      stream.pos = 0;
14862      var buffer = stream.getBytes();
14863      var position = stream.start,
14864          length = buffer.length;
14865      var trailers = [],
14866          xrefStms = [];
14867
14868      while (position < length) {
14869        var ch = buffer[position];
14870
14871        if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
14872          ++position;
14873          continue;
14874        }
14875
14876        if (ch === PERCENT) {
14877          do {
14878            ++position;
14879
14880            if (position >= length) {
14881              break;
14882            }
14883
14884            ch = buffer[position];
14885          } while (ch !== LF && ch !== CR);
14886
14887          continue;
14888        }
14889
14890        var token = readToken(buffer, position);
14891        var m;
14892
14893        if (token.startsWith('xref') && (token.length === 4 || /\s/.test(token[4]))) {
14894          position += skipUntil(buffer, position, trailerBytes);
14895          trailers.push(position);
14896          position += skipUntil(buffer, position, startxrefBytes);
14897        } else if (m = objRegExp.exec(token)) {
14898          var num = m[1] | 0,
14899              gen = m[2] | 0;
14900
14901          if (typeof this.entries[num] === 'undefined') {
14902            this.entries[num] = {
14903              offset: position - stream.start,
14904              gen: gen,
14905              uncompressed: true
14906            };
14907          }
14908
14909          var contentLength = void 0,
14910              startPos = position + token.length;
14911
14912          while (startPos < buffer.length) {
14913            var endPos = startPos + skipUntil(buffer, startPos, objBytes) + 4;
14914            contentLength = endPos - position;
14915            var checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, startPos);
14916            var tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos));
14917
14918            if (endobjRegExp.test(tokenStr)) {
14919              break;
14920            } else {
14921              var objToken = nestedObjRegExp.exec(tokenStr);
14922
14923              if (objToken && objToken[1]) {
14924                (0, _util.warn)('indexObjects: Found new "obj" inside of another "obj", ' + 'caused by missing "endobj" -- trying to recover.');
14925                contentLength -= objToken[1].length;
14926                break;
14927              }
14928            }
14929
14930            startPos = endPos;
14931          }
14932
14933          var content = buffer.subarray(position, position + contentLength);
14934          var xrefTagOffset = skipUntil(content, 0, xrefBytes);
14935
14936          if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
14937            xrefStms.push(position - stream.start);
14938            this.xrefstms[position - stream.start] = 1;
14939          }
14940
14941          position += contentLength;
14942        } else if (token.startsWith('trailer') && (token.length === 7 || /\s/.test(token[7]))) {
14943          trailers.push(position);
14944          position += skipUntil(buffer, position, startxrefBytes);
14945        } else {
14946          position += token.length + 1;
14947        }
14948      }
14949
14950      var i, ii;
14951
14952      for (i = 0, ii = xrefStms.length; i < ii; ++i) {
14953        this.startXRefQueue.push(xrefStms[i]);
14954        this.readXRef(true);
14955      }
14956
14957      var trailerDict;
14958
14959      for (i = 0, ii = trailers.length; i < ii; ++i) {
14960        stream.pos = trailers[i];
14961        var parser = new _parser.Parser({
14962          lexer: new _parser.Lexer(stream),
14963          xref: this,
14964          allowStreams: true,
14965          recoveryMode: true
14966        });
14967        var obj = parser.getObj();
14968
14969        if (!(0, _primitives.isCmd)(obj, 'trailer')) {
14970          continue;
14971        }
14972
14973        var dict = parser.getObj();
14974
14975        if (!(0, _primitives.isDict)(dict)) {
14976          continue;
14977        }
14978
14979        var rootDict = void 0;
14980
14981        try {
14982          rootDict = dict.get('Root');
14983        } catch (ex) {
14984          if (ex instanceof _core_utils.MissingDataException) {
14985            throw ex;
14986          }
14987
14988          continue;
14989        }
14990
14991        if (!(0, _primitives.isDict)(rootDict) || !rootDict.has('Pages')) {
14992          continue;
14993        }
14994
14995        if (dict.has('ID')) {
14996          return dict;
14997        }
14998
14999        trailerDict = dict;
15000      }
15001
15002      if (trailerDict) {
15003        return trailerDict;
15004      }
15005
15006      throw new _util.InvalidPDFException('Invalid PDF structure');
15007    },
15008    readXRef: function XRef_readXRef(recoveryMode) {
15009      var stream = this.stream;
15010      var startXRefParsedCache = Object.create(null);
15011
15012      try {
15013        while (this.startXRefQueue.length) {
15014          var startXRef = this.startXRefQueue[0];
15015
15016          if (startXRefParsedCache[startXRef]) {
15017            (0, _util.warn)('readXRef - skipping XRef table since it was already parsed.');
15018            this.startXRefQueue.shift();
15019            continue;
15020          }
15021
15022          startXRefParsedCache[startXRef] = true;
15023          stream.pos = startXRef + stream.start;
15024          var parser = new _parser.Parser({
15025            lexer: new _parser.Lexer(stream),
15026            xref: this,
15027            allowStreams: true
15028          });
15029          var obj = parser.getObj();
15030          var dict;
15031
15032          if ((0, _primitives.isCmd)(obj, 'xref')) {
15033            dict = this.processXRefTable(parser);
15034
15035            if (!this.topDict) {
15036              this.topDict = dict;
15037            }
15038
15039            obj = dict.get('XRefStm');
15040
15041            if (Number.isInteger(obj)) {
15042              var pos = obj;
15043
15044              if (!(pos in this.xrefstms)) {
15045                this.xrefstms[pos] = 1;
15046                this.startXRefQueue.push(pos);
15047              }
15048            }
15049          } else if (Number.isInteger(obj)) {
15050            if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), 'obj') || !(0, _primitives.isStream)(obj = parser.getObj())) {
15051              throw new _util.FormatError('Invalid XRef stream');
15052            }
15053
15054            dict = this.processXRefStream(obj);
15055
15056            if (!this.topDict) {
15057              this.topDict = dict;
15058            }
15059
15060            if (!dict) {
15061              throw new _util.FormatError('Failed to read XRef stream');
15062            }
15063          } else {
15064            throw new _util.FormatError('Invalid XRef stream header');
15065          }
15066
15067          obj = dict.get('Prev');
15068
15069          if (Number.isInteger(obj)) {
15070            this.startXRefQueue.push(obj);
15071          } else if ((0, _primitives.isRef)(obj)) {
15072            this.startXRefQueue.push(obj.num);
15073          }
15074
15075          this.startXRefQueue.shift();
15076        }
15077
15078        return this.topDict;
15079      } catch (e) {
15080        if (e instanceof _core_utils.MissingDataException) {
15081          throw e;
15082        }
15083
15084        (0, _util.info)('(while reading XRef): ' + e);
15085      }
15086
15087      if (recoveryMode) {
15088        return undefined;
15089      }
15090
15091      throw new _core_utils.XRefParseException();
15092    },
15093    getEntry: function XRef_getEntry(i) {
15094      var xrefEntry = this.entries[i];
15095
15096      if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
15097        return xrefEntry;
15098      }
15099
15100      return null;
15101    },
15102    fetchIfRef: function XRef_fetchIfRef(obj, suppressEncryption) {
15103      if (!(0, _primitives.isRef)(obj)) {
15104        return obj;
15105      }
15106
15107      return this.fetch(obj, suppressEncryption);
15108    },
15109    fetch: function XRef_fetch(ref, suppressEncryption) {
15110      if (!(0, _primitives.isRef)(ref)) {
15111        throw new Error('ref object is not a reference');
15112      }
15113
15114      var num = ref.num;
15115
15116      if (num in this.cache) {
15117        var cacheEntry = this.cache[num];
15118
15119        if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
15120          cacheEntry.objId = ref.toString();
15121        }
15122
15123        return cacheEntry;
15124      }
15125
15126      var xrefEntry = this.getEntry(num);
15127
15128      if (xrefEntry === null) {
15129        return this.cache[num] = null;
15130      }
15131
15132      if (xrefEntry.uncompressed) {
15133        xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
15134      } else {
15135        xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption);
15136      }
15137
15138      if ((0, _primitives.isDict)(xrefEntry)) {
15139        xrefEntry.objId = ref.toString();
15140      } else if ((0, _primitives.isStream)(xrefEntry)) {
15141        xrefEntry.dict.objId = ref.toString();
15142      }
15143
15144      return xrefEntry;
15145    },
15146    fetchUncompressed: function fetchUncompressed(ref, xrefEntry) {
15147      var suppressEncryption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
15148      var gen = ref.gen;
15149      var num = ref.num;
15150
15151      if (xrefEntry.gen !== gen) {
15152        throw new _core_utils.XRefEntryException("Inconsistent generation in XRef: ".concat(ref));
15153      }
15154
15155      var stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
15156      var parser = new _parser.Parser({
15157        lexer: new _parser.Lexer(stream),
15158        xref: this,
15159        allowStreams: true
15160      });
15161      var obj1 = parser.getObj();
15162      var obj2 = parser.getObj();
15163      var obj3 = parser.getObj();
15164
15165      if (!Number.isInteger(obj1)) {
15166        obj1 = parseInt(obj1, 10);
15167      }
15168
15169      if (!Number.isInteger(obj2)) {
15170        obj2 = parseInt(obj2, 10);
15171      }
15172
15173      if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) {
15174        throw new _core_utils.XRefEntryException("Bad (uncompressed) XRef entry: ".concat(ref));
15175      }
15176
15177      if (obj3.cmd !== 'obj') {
15178        if (obj3.cmd.startsWith('obj')) {
15179          num = parseInt(obj3.cmd.substring(3), 10);
15180
15181          if (!Number.isNaN(num)) {
15182            return num;
15183          }
15184        }
15185
15186        throw new _core_utils.XRefEntryException("Bad (uncompressed) XRef entry: ".concat(ref));
15187      }
15188
15189      if (this.encrypt && !suppressEncryption) {
15190        xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
15191      } else {
15192        xrefEntry = parser.getObj();
15193      }
15194
15195      if (!(0, _primitives.isStream)(xrefEntry)) {
15196        this.cache[num] = xrefEntry;
15197      }
15198
15199      return xrefEntry;
15200    },
15201    fetchCompressed: function fetchCompressed(ref, xrefEntry) {
15202      var suppressEncryption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
15203      var tableOffset = xrefEntry.offset;
15204      var stream = this.fetch(_primitives.Ref.get(tableOffset, 0));
15205
15206      if (!(0, _primitives.isStream)(stream)) {
15207        throw new _util.FormatError('bad ObjStm stream');
15208      }
15209
15210      var first = stream.dict.get('First');
15211      var n = stream.dict.get('N');
15212
15213      if (!Number.isInteger(first) || !Number.isInteger(n)) {
15214        throw new _util.FormatError('invalid first and n parameters for ObjStm stream');
15215      }
15216
15217      var parser = new _parser.Parser({
15218        lexer: new _parser.Lexer(stream),
15219        xref: this,
15220        allowStreams: true
15221      });
15222      var i,
15223          entries = [],
15224          num,
15225          nums = [];
15226
15227      for (i = 0; i < n; ++i) {
15228        num = parser.getObj();
15229
15230        if (!Number.isInteger(num)) {
15231          throw new _util.FormatError("invalid object number in the ObjStm stream: ".concat(num));
15232        }
15233
15234        nums.push(num);
15235        var offset = parser.getObj();
15236
15237        if (!Number.isInteger(offset)) {
15238          throw new _util.FormatError("invalid object offset in the ObjStm stream: ".concat(offset));
15239        }
15240      }
15241
15242      for (i = 0; i < n; ++i) {
15243        entries.push(parser.getObj());
15244
15245        if ((0, _primitives.isCmd)(parser.buf1, 'endobj')) {
15246          parser.shift();
15247        }
15248
15249        num = nums[i];
15250        var entry = this.entries[num];
15251
15252        if (entry && entry.offset === tableOffset && entry.gen === i) {
15253          this.cache[num] = entries[i];
15254        }
15255      }
15256
15257      xrefEntry = entries[xrefEntry.gen];
15258
15259      if (xrefEntry === undefined) {
15260        throw new _core_utils.XRefEntryException("Bad (compressed) XRef entry: ".concat(ref));
15261      }
15262
15263      return xrefEntry;
15264    },
15265    fetchIfRefAsync: function () {
15266      var _fetchIfRefAsync = _asyncToGenerator(
15267      /*#__PURE__*/
15268      _regenerator["default"].mark(function _callee(obj, suppressEncryption) {
15269        return _regenerator["default"].wrap(function _callee$(_context) {
15270          while (1) {
15271            switch (_context.prev = _context.next) {
15272              case 0:
15273                if ((0, _primitives.isRef)(obj)) {
15274                  _context.next = 2;
15275                  break;
15276                }
15277
15278                return _context.abrupt("return", obj);
15279
15280              case 2:
15281                return _context.abrupt("return", this.fetchAsync(obj, suppressEncryption));
15282
15283              case 3:
15284              case "end":
15285                return _context.stop();
15286            }
15287          }
15288        }, _callee, this);
15289      }));
15290
15291      function fetchIfRefAsync(_x, _x2) {
15292        return _fetchIfRefAsync.apply(this, arguments);
15293      }
15294
15295      return fetchIfRefAsync;
15296    }(),
15297    fetchAsync: function () {
15298      var _fetchAsync = _asyncToGenerator(
15299      /*#__PURE__*/
15300      _regenerator["default"].mark(function _callee2(ref, suppressEncryption) {
15301        return _regenerator["default"].wrap(function _callee2$(_context2) {
15302          while (1) {
15303            switch (_context2.prev = _context2.next) {
15304              case 0:
15305                _context2.prev = 0;
15306                return _context2.abrupt("return", this.fetch(ref, suppressEncryption));
15307
15308              case 4:
15309                _context2.prev = 4;
15310                _context2.t0 = _context2["catch"](0);
15311
15312                if (_context2.t0 instanceof _core_utils.MissingDataException) {
15313                  _context2.next = 8;
15314                  break;
15315                }
15316
15317                throw _context2.t0;
15318
15319              case 8:
15320                _context2.next = 10;
15321                return this.pdfManager.requestRange(_context2.t0.begin, _context2.t0.end);
15322
15323              case 10:
15324                return _context2.abrupt("return", this.fetchAsync(ref, suppressEncryption));
15325
15326              case 11:
15327              case "end":
15328                return _context2.stop();
15329            }
15330          }
15331        }, _callee2, this, [[0, 4]]);
15332      }));
15333
15334      function fetchAsync(_x3, _x4) {
15335        return _fetchAsync.apply(this, arguments);
15336      }
15337
15338      return fetchAsync;
15339    }(),
15340    getCatalogObj: function XRef_getCatalogObj() {
15341      return this.root;
15342    }
15343  };
15344  return XRef;
15345}();
15346
15347exports.XRef = XRef;
15348
15349var NameOrNumberTree =
15350/*#__PURE__*/
15351function () {
15352  function NameOrNumberTree(root, xref, type) {
15353    _classCallCheck(this, NameOrNumberTree);
15354
15355    if (this.constructor === NameOrNumberTree) {
15356      (0, _util.unreachable)('Cannot initialize NameOrNumberTree.');
15357    }
15358
15359    this.root = root;
15360    this.xref = xref;
15361    this._type = type;
15362  }
15363
15364  _createClass(NameOrNumberTree, [{
15365    key: "getAll",
15366    value: function getAll() {
15367      var dict = Object.create(null);
15368
15369      if (!this.root) {
15370        return dict;
15371      }
15372
15373      var xref = this.xref;
15374      var processed = new _primitives.RefSet();
15375      processed.put(this.root);
15376      var queue = [this.root];
15377
15378      while (queue.length > 0) {
15379        var obj = xref.fetchIfRef(queue.shift());
15380
15381        if (!(0, _primitives.isDict)(obj)) {
15382          continue;
15383        }
15384
15385        if (obj.has('Kids')) {
15386          var kids = obj.get('Kids');
15387
15388          for (var i = 0, ii = kids.length; i < ii; i++) {
15389            var kid = kids[i];
15390
15391            if (processed.has(kid)) {
15392              throw new _util.FormatError("Duplicate entry in \"".concat(this._type, "\" tree."));
15393            }
15394
15395            queue.push(kid);
15396            processed.put(kid);
15397          }
15398
15399          continue;
15400        }
15401
15402        var entries = obj.get(this._type);
15403
15404        if (Array.isArray(entries)) {
15405          for (var _i2 = 0, _ii = entries.length; _i2 < _ii; _i2 += 2) {
15406            dict[xref.fetchIfRef(entries[_i2])] = xref.fetchIfRef(entries[_i2 + 1]);
15407          }
15408        }
15409      }
15410
15411      return dict;
15412    }
15413  }, {
15414    key: "get",
15415    value: function get(key) {
15416      if (!this.root) {
15417        return null;
15418      }
15419
15420      var xref = this.xref;
15421      var kidsOrEntries = xref.fetchIfRef(this.root);
15422      var loopCount = 0;
15423      var MAX_LEVELS = 10;
15424
15425      while (kidsOrEntries.has('Kids')) {
15426        if (++loopCount > MAX_LEVELS) {
15427          (0, _util.warn)("Search depth limit reached for \"".concat(this._type, "\" tree."));
15428          return null;
15429        }
15430
15431        var kids = kidsOrEntries.get('Kids');
15432
15433        if (!Array.isArray(kids)) {
15434          return null;
15435        }
15436
15437        var l = 0,
15438            r = kids.length - 1;
15439
15440        while (l <= r) {
15441          var m = l + r >> 1;
15442          var kid = xref.fetchIfRef(kids[m]);
15443          var limits = kid.get('Limits');
15444
15445          if (key < xref.fetchIfRef(limits[0])) {
15446            r = m - 1;
15447          } else if (key > xref.fetchIfRef(limits[1])) {
15448            l = m + 1;
15449          } else {
15450            kidsOrEntries = xref.fetchIfRef(kids[m]);
15451            break;
15452          }
15453        }
15454
15455        if (l > r) {
15456          return null;
15457        }
15458      }
15459
15460      var entries = kidsOrEntries.get(this._type);
15461
15462      if (Array.isArray(entries)) {
15463        var _l = 0,
15464            _r = entries.length - 2;
15465
15466        while (_l <= _r) {
15467          var tmp = _l + _r >> 1,
15468              _m = tmp + (tmp & 1);
15469
15470          var currentKey = xref.fetchIfRef(entries[_m]);
15471
15472          if (key < currentKey) {
15473            _r = _m - 2;
15474          } else if (key > currentKey) {
15475            _l = _m + 2;
15476          } else {
15477            return xref.fetchIfRef(entries[_m + 1]);
15478          }
15479        }
15480
15481        (0, _util.info)("Falling back to an exhaustive search, for key \"".concat(key, "\", ") + "in \"".concat(this._type, "\" tree."));
15482
15483        for (var _m2 = 0, mm = entries.length; _m2 < mm; _m2 += 2) {
15484          var _currentKey = xref.fetchIfRef(entries[_m2]);
15485
15486          if (_currentKey === key) {
15487            (0, _util.warn)("The \"".concat(key, "\" key was found at an incorrect, ") + "i.e. out-of-order, position in \"".concat(this._type, "\" tree."));
15488            return xref.fetchIfRef(entries[_m2 + 1]);
15489          }
15490        }
15491      }
15492
15493      return null;
15494    }
15495  }]);
15496
15497  return NameOrNumberTree;
15498}();
15499
15500var NameTree =
15501/*#__PURE__*/
15502function (_NameOrNumberTree) {
15503  _inherits(NameTree, _NameOrNumberTree);
15504
15505  function NameTree(root, xref) {
15506    _classCallCheck(this, NameTree);
15507
15508    return _possibleConstructorReturn(this, _getPrototypeOf(NameTree).call(this, root, xref, 'Names'));
15509  }
15510
15511  return NameTree;
15512}(NameOrNumberTree);
15513
15514var NumberTree =
15515/*#__PURE__*/
15516function (_NameOrNumberTree2) {
15517  _inherits(NumberTree, _NameOrNumberTree2);
15518
15519  function NumberTree(root, xref) {
15520    _classCallCheck(this, NumberTree);
15521
15522    return _possibleConstructorReturn(this, _getPrototypeOf(NumberTree).call(this, root, xref, 'Nums'));
15523  }
15524
15525  return NumberTree;
15526}(NameOrNumberTree);
15527
15528var FileSpec = function FileSpecClosure() {
15529  function FileSpec(root, xref) {
15530    if (!root || !(0, _primitives.isDict)(root)) {
15531      return;
15532    }
15533
15534    this.xref = xref;
15535    this.root = root;
15536
15537    if (root.has('FS')) {
15538      this.fs = root.get('FS');
15539    }
15540
15541    this.description = root.has('Desc') ? (0, _util.stringToPDFString)(root.get('Desc')) : '';
15542
15543    if (root.has('RF')) {
15544      (0, _util.warn)('Related file specifications are not supported');
15545    }
15546
15547    this.contentAvailable = true;
15548
15549    if (!root.has('EF')) {
15550      this.contentAvailable = false;
15551      (0, _util.warn)('Non-embedded file specifications are not supported');
15552    }
15553  }
15554
15555  function pickPlatformItem(dict) {
15556    if (dict.has('UF')) {
15557      return dict.get('UF');
15558    } else if (dict.has('F')) {
15559      return dict.get('F');
15560    } else if (dict.has('Unix')) {
15561      return dict.get('Unix');
15562    } else if (dict.has('Mac')) {
15563      return dict.get('Mac');
15564    } else if (dict.has('DOS')) {
15565      return dict.get('DOS');
15566    }
15567
15568    return null;
15569  }
15570
15571  FileSpec.prototype = {
15572    get filename() {
15573      if (!this._filename && this.root) {
15574        var filename = pickPlatformItem(this.root) || 'unnamed';
15575        this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\/g, '\\').replace(/\\\//g, '/').replace(/\\/g, '/');
15576      }
15577
15578      return this._filename;
15579    },
15580
15581    get content() {
15582      if (!this.contentAvailable) {
15583        return null;
15584      }
15585
15586      if (!this.contentRef && this.root) {
15587        this.contentRef = pickPlatformItem(this.root.get('EF'));
15588      }
15589
15590      var content = null;
15591
15592      if (this.contentRef) {
15593        var xref = this.xref;
15594        var fileObj = xref.fetchIfRef(this.contentRef);
15595
15596        if (fileObj && (0, _primitives.isStream)(fileObj)) {
15597          content = fileObj.getBytes();
15598        } else {
15599          (0, _util.warn)('Embedded file specification points to non-existing/invalid ' + 'content');
15600        }
15601      } else {
15602        (0, _util.warn)('Embedded file specification does not have a content');
15603      }
15604
15605      return content;
15606    },
15607
15608    get serializable() {
15609      return {
15610        filename: this.filename,
15611        content: this.content
15612      };
15613    }
15614
15615  };
15616  return FileSpec;
15617}();
15618
15619exports.FileSpec = FileSpec;
15620
15621var ObjectLoader = function () {
15622  function mayHaveChildren(value) {
15623    return (0, _primitives.isRef)(value) || (0, _primitives.isDict)(value) || Array.isArray(value) || (0, _primitives.isStream)(value);
15624  }
15625
15626  function addChildren(node, nodesToVisit) {
15627    if ((0, _primitives.isDict)(node) || (0, _primitives.isStream)(node)) {
15628      var dict = (0, _primitives.isDict)(node) ? node : node.dict;
15629      var dictKeys = dict.getKeys();
15630
15631      for (var i = 0, ii = dictKeys.length; i < ii; i++) {
15632        var rawValue = dict.getRaw(dictKeys[i]);
15633
15634        if (mayHaveChildren(rawValue)) {
15635          nodesToVisit.push(rawValue);
15636        }
15637      }
15638    } else if (Array.isArray(node)) {
15639      for (var _i3 = 0, _ii2 = node.length; _i3 < _ii2; _i3++) {
15640        var value = node[_i3];
15641
15642        if (mayHaveChildren(value)) {
15643          nodesToVisit.push(value);
15644        }
15645      }
15646    }
15647  }
15648
15649  function ObjectLoader(dict, keys, xref) {
15650    this.dict = dict;
15651    this.keys = keys;
15652    this.xref = xref;
15653    this.refSet = null;
15654    this.capability = null;
15655  }
15656
15657  ObjectLoader.prototype = {
15658    load: function load() {
15659      this.capability = (0, _util.createPromiseCapability)();
15660
15661      if (!(this.xref.stream instanceof _chunked_stream.ChunkedStream) || this.xref.stream.getMissingChunks().length === 0) {
15662        this.capability.resolve();
15663        return this.capability.promise;
15664      }
15665
15666      var keys = this.keys,
15667          dict = this.dict;
15668      this.refSet = new _primitives.RefSet();
15669      var nodesToVisit = [];
15670
15671      for (var i = 0, ii = keys.length; i < ii; i++) {
15672        var rawValue = dict.getRaw(keys[i]);
15673
15674        if (rawValue !== undefined) {
15675          nodesToVisit.push(rawValue);
15676        }
15677      }
15678
15679      this._walk(nodesToVisit);
15680
15681      return this.capability.promise;
15682    },
15683    _walk: function _walk(nodesToVisit) {
15684      var _this3 = this;
15685
15686      var nodesToRevisit = [];
15687      var pendingRequests = [];
15688
15689      while (nodesToVisit.length) {
15690        var currentNode = nodesToVisit.pop();
15691
15692        if ((0, _primitives.isRef)(currentNode)) {
15693          if (this.refSet.has(currentNode)) {
15694            continue;
15695          }
15696
15697          try {
15698            this.refSet.put(currentNode);
15699            currentNode = this.xref.fetch(currentNode);
15700          } catch (ex) {
15701            if (!(ex instanceof _core_utils.MissingDataException)) {
15702              throw ex;
15703            }
15704
15705            nodesToRevisit.push(currentNode);
15706            pendingRequests.push({
15707              begin: ex.begin,
15708              end: ex.end
15709            });
15710          }
15711        }
15712
15713        if (currentNode && currentNode.getBaseStreams) {
15714          var baseStreams = currentNode.getBaseStreams();
15715          var foundMissingData = false;
15716
15717          for (var i = 0, ii = baseStreams.length; i < ii; i++) {
15718            var stream = baseStreams[i];
15719
15720            if (stream.getMissingChunks && stream.getMissingChunks().length) {
15721              foundMissingData = true;
15722              pendingRequests.push({
15723                begin: stream.start,
15724                end: stream.end
15725              });
15726            }
15727          }
15728
15729          if (foundMissingData) {
15730            nodesToRevisit.push(currentNode);
15731          }
15732        }
15733
15734        addChildren(currentNode, nodesToVisit);
15735      }
15736
15737      if (pendingRequests.length) {
15738        this.xref.stream.manager.requestRanges(pendingRequests).then(function () {
15739          for (var _i4 = 0, _ii3 = nodesToRevisit.length; _i4 < _ii3; _i4++) {
15740            var node = nodesToRevisit[_i4];
15741
15742            if ((0, _primitives.isRef)(node)) {
15743              _this3.refSet.remove(node);
15744            }
15745          }
15746
15747          _this3._walk(nodesToRevisit);
15748        }, this.capability.reject);
15749        return;
15750      }
15751
15752      this.refSet = null;
15753      this.capability.resolve();
15754    }
15755  };
15756  return ObjectLoader;
15757}();
15758
15759exports.ObjectLoader = ObjectLoader;
15760
15761/***/ }),
15762/* 157 */
15763/***/ (function(module, exports, __w_pdfjs_require__) {
15764
15765"use strict";
15766
15767
15768Object.defineProperty(exports, "__esModule", {
15769  value: true
15770});
15771exports.Parser = exports.Linearization = exports.Lexer = void 0;
15772
15773var _stream = __w_pdfjs_require__(158);
15774
15775var _util = __w_pdfjs_require__(5);
15776
15777var _primitives = __w_pdfjs_require__(151);
15778
15779var _ccitt_stream = __w_pdfjs_require__(159);
15780
15781var _jbig2_stream = __w_pdfjs_require__(161);
15782
15783var _jpeg_stream = __w_pdfjs_require__(164);
15784
15785var _jpx_stream = __w_pdfjs_require__(166);
15786
15787var _core_utils = __w_pdfjs_require__(154);
15788
15789function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
15790
15791function _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); } }
15792
15793function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
15794
15795var MAX_LENGTH_TO_CACHE = 1000;
15796var MAX_ADLER32_LENGTH = 5552;
15797
15798function computeAdler32(bytes) {
15799  var bytesLength = bytes.length;
15800  var a = 1,
15801      b = 0;
15802
15803  for (var i = 0; i < bytesLength; ++i) {
15804    a += bytes[i] & 0xFF;
15805    b += a;
15806  }
15807
15808  return b % 65521 << 16 | a % 65521;
15809}
15810
15811var Parser =
15812/*#__PURE__*/
15813function () {
15814  function Parser(_ref) {
15815    var lexer = _ref.lexer,
15816        xref = _ref.xref,
15817        _ref$allowStreams = _ref.allowStreams,
15818        allowStreams = _ref$allowStreams === void 0 ? false : _ref$allowStreams,
15819        _ref$recoveryMode = _ref.recoveryMode,
15820        recoveryMode = _ref$recoveryMode === void 0 ? false : _ref$recoveryMode;
15821
15822    _classCallCheck(this, Parser);
15823
15824    this.lexer = lexer;
15825    this.xref = xref;
15826    this.allowStreams = allowStreams;
15827    this.recoveryMode = recoveryMode;
15828    this.imageCache = Object.create(null);
15829    this.refill();
15830  }
15831
15832  _createClass(Parser, [{
15833    key: "refill",
15834    value: function refill() {
15835      this.buf1 = this.lexer.getObj();
15836      this.buf2 = this.lexer.getObj();
15837    }
15838  }, {
15839    key: "shift",
15840    value: function shift() {
15841      if ((0, _primitives.isCmd)(this.buf2, 'ID')) {
15842        this.buf1 = this.buf2;
15843        this.buf2 = null;
15844      } else {
15845        this.buf1 = this.buf2;
15846        this.buf2 = this.lexer.getObj();
15847      }
15848    }
15849  }, {
15850    key: "tryShift",
15851    value: function tryShift() {
15852      try {
15853        this.shift();
15854        return true;
15855      } catch (e) {
15856        if (e instanceof _core_utils.MissingDataException) {
15857          throw e;
15858        }
15859
15860        return false;
15861      }
15862    }
15863  }, {
15864    key: "getObj",
15865    value: function getObj(cipherTransform) {
15866      var buf1 = this.buf1;
15867      this.shift();
15868
15869      if (buf1 instanceof _primitives.Cmd) {
15870        switch (buf1.cmd) {
15871          case 'BI':
15872            return this.makeInlineImage(cipherTransform);
15873
15874          case '[':
15875            var array = [];
15876
15877            while (!(0, _primitives.isCmd)(this.buf1, ']') && !(0, _primitives.isEOF)(this.buf1)) {
15878              array.push(this.getObj(cipherTransform));
15879            }
15880
15881            if ((0, _primitives.isEOF)(this.buf1)) {
15882              if (!this.recoveryMode) {
15883                throw new _util.FormatError('End of file inside array');
15884              }
15885
15886              return array;
15887            }
15888
15889            this.shift();
15890            return array;
15891
15892          case '<<':
15893            var dict = new _primitives.Dict(this.xref);
15894
15895            while (!(0, _primitives.isCmd)(this.buf1, '>>') && !(0, _primitives.isEOF)(this.buf1)) {
15896              if (!(0, _primitives.isName)(this.buf1)) {
15897                (0, _util.info)('Malformed dictionary: key must be a name object');
15898                this.shift();
15899                continue;
15900              }
15901
15902              var key = this.buf1.name;
15903              this.shift();
15904
15905              if ((0, _primitives.isEOF)(this.buf1)) {
15906                break;
15907              }
15908
15909              dict.set(key, this.getObj(cipherTransform));
15910            }
15911
15912            if ((0, _primitives.isEOF)(this.buf1)) {
15913              if (!this.recoveryMode) {
15914                throw new _util.FormatError('End of file inside dictionary');
15915              }
15916
15917              return dict;
15918            }
15919
15920            if ((0, _primitives.isCmd)(this.buf2, 'stream')) {
15921              return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
15922            }
15923
15924            this.shift();
15925            return dict;
15926
15927          default:
15928            return buf1;
15929        }
15930      }
15931
15932      if (Number.isInteger(buf1)) {
15933        var num = buf1;
15934
15935        if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, 'R')) {
15936          var ref = _primitives.Ref.get(num, this.buf1);
15937
15938          this.shift();
15939          this.shift();
15940          return ref;
15941        }
15942
15943        return num;
15944      }
15945
15946      if ((0, _util.isString)(buf1)) {
15947        var str = buf1;
15948
15949        if (cipherTransform) {
15950          str = cipherTransform.decryptString(str);
15951        }
15952
15953        return str;
15954      }
15955
15956      return buf1;
15957    }
15958  }, {
15959    key: "findDefaultInlineStreamEnd",
15960    value: function findDefaultInlineStreamEnd(stream) {
15961      var E = 0x45,
15962          I = 0x49,
15963          SPACE = 0x20,
15964          LF = 0xA,
15965          CR = 0xD;
15966      var n = 10,
15967          NUL = 0x0;
15968      var startPos = stream.pos,
15969          state = 0,
15970          ch,
15971          maybeEIPos;
15972
15973      while ((ch = stream.getByte()) !== -1) {
15974        if (state === 0) {
15975          state = ch === E ? 1 : 0;
15976        } else if (state === 1) {
15977          state = ch === I ? 2 : 0;
15978        } else {
15979          (0, _util.assert)(state === 2);
15980
15981          if (ch === SPACE || ch === LF || ch === CR) {
15982            maybeEIPos = stream.pos;
15983            var followingBytes = stream.peekBytes(n);
15984
15985            for (var i = 0, ii = followingBytes.length; i < ii; i++) {
15986              ch = followingBytes[i];
15987
15988              if (ch === NUL && followingBytes[i + 1] !== NUL) {
15989                continue;
15990              }
15991
15992              if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7F)) {
15993                state = 0;
15994                break;
15995              }
15996            }
15997
15998            if (state === 2) {
15999              break;
16000            }
16001          } else {
16002            state = 0;
16003          }
16004        }
16005      }
16006
16007      if (ch === -1) {
16008        (0, _util.warn)('findDefaultInlineStreamEnd: ' + 'Reached the end of the stream without finding a valid EI marker');
16009
16010        if (maybeEIPos) {
16011          (0, _util.warn)('... trying to recover by using the last "EI" occurrence.');
16012          stream.skip(-(stream.pos - maybeEIPos));
16013        }
16014      }
16015
16016      var endOffset = 4;
16017      stream.skip(-endOffset);
16018      ch = stream.peekByte();
16019      stream.skip(endOffset);
16020
16021      if (!(0, _util.isSpace)(ch)) {
16022        endOffset--;
16023      }
16024
16025      return stream.pos - endOffset - startPos;
16026    }
16027  }, {
16028    key: "findDCTDecodeInlineStreamEnd",
16029    value: function findDCTDecodeInlineStreamEnd(stream) {
16030      var startPos = stream.pos,
16031          foundEOI = false,
16032          b,
16033          markerLength,
16034          length;
16035
16036      while ((b = stream.getByte()) !== -1) {
16037        if (b !== 0xFF) {
16038          continue;
16039        }
16040
16041        switch (stream.getByte()) {
16042          case 0x00:
16043            break;
16044
16045          case 0xFF:
16046            stream.skip(-1);
16047            break;
16048
16049          case 0xD9:
16050            foundEOI = true;
16051            break;
16052
16053          case 0xC0:
16054          case 0xC1:
16055          case 0xC2:
16056          case 0xC3:
16057          case 0xC5:
16058          case 0xC6:
16059          case 0xC7:
16060          case 0xC9:
16061          case 0xCA:
16062          case 0xCB:
16063          case 0xCD:
16064          case 0xCE:
16065          case 0xCF:
16066          case 0xC4:
16067          case 0xCC:
16068          case 0xDA:
16069          case 0xDB:
16070          case 0xDC:
16071          case 0xDD:
16072          case 0xDE:
16073          case 0xDF:
16074          case 0xE0:
16075          case 0xE1:
16076          case 0xE2:
16077          case 0xE3:
16078          case 0xE4:
16079          case 0xE5:
16080          case 0xE6:
16081          case 0xE7:
16082          case 0xE8:
16083          case 0xE9:
16084          case 0xEA:
16085          case 0xEB:
16086          case 0xEC:
16087          case 0xED:
16088          case 0xEE:
16089          case 0xEF:
16090          case 0xFE:
16091            markerLength = stream.getUint16();
16092
16093            if (markerLength > 2) {
16094              stream.skip(markerLength - 2);
16095            } else {
16096              stream.skip(-2);
16097            }
16098
16099            break;
16100        }
16101
16102        if (foundEOI) {
16103          break;
16104        }
16105      }
16106
16107      length = stream.pos - startPos;
16108
16109      if (b === -1) {
16110        (0, _util.warn)('Inline DCTDecode image stream: ' + 'EOI marker not found, searching for /EI/ instead.');
16111        stream.skip(-length);
16112        return this.findDefaultInlineStreamEnd(stream);
16113      }
16114
16115      this.inlineStreamSkipEI(stream);
16116      return length;
16117    }
16118  }, {
16119    key: "findASCII85DecodeInlineStreamEnd",
16120    value: function findASCII85DecodeInlineStreamEnd(stream) {
16121      var TILDE = 0x7E,
16122          GT = 0x3E;
16123      var startPos = stream.pos,
16124          ch,
16125          length;
16126
16127      while ((ch = stream.getByte()) !== -1) {
16128        if (ch === TILDE) {
16129          ch = stream.peekByte();
16130
16131          while ((0, _util.isSpace)(ch)) {
16132            stream.skip();
16133            ch = stream.peekByte();
16134          }
16135
16136          if (ch === GT) {
16137            stream.skip();
16138            break;
16139          }
16140        }
16141      }
16142
16143      length = stream.pos - startPos;
16144
16145      if (ch === -1) {
16146        (0, _util.warn)('Inline ASCII85Decode image stream: ' + 'EOD marker not found, searching for /EI/ instead.');
16147        stream.skip(-length);
16148        return this.findDefaultInlineStreamEnd(stream);
16149      }
16150
16151      this.inlineStreamSkipEI(stream);
16152      return length;
16153    }
16154  }, {
16155    key: "findASCIIHexDecodeInlineStreamEnd",
16156    value: function findASCIIHexDecodeInlineStreamEnd(stream) {
16157      var GT = 0x3E;
16158      var startPos = stream.pos,
16159          ch,
16160          length;
16161
16162      while ((ch = stream.getByte()) !== -1) {
16163        if (ch === GT) {
16164          break;
16165        }
16166      }
16167
16168      length = stream.pos - startPos;
16169
16170      if (ch === -1) {
16171        (0, _util.warn)('Inline ASCIIHexDecode image stream: ' + 'EOD marker not found, searching for /EI/ instead.');
16172        stream.skip(-length);
16173        return this.findDefaultInlineStreamEnd(stream);
16174      }
16175
16176      this.inlineStreamSkipEI(stream);
16177      return length;
16178    }
16179  }, {
16180    key: "inlineStreamSkipEI",
16181    value: function inlineStreamSkipEI(stream) {
16182      var E = 0x45,
16183          I = 0x49;
16184      var state = 0,
16185          ch;
16186
16187      while ((ch = stream.getByte()) !== -1) {
16188        if (state === 0) {
16189          state = ch === E ? 1 : 0;
16190        } else if (state === 1) {
16191          state = ch === I ? 2 : 0;
16192        } else if (state === 2) {
16193          break;
16194        }
16195      }
16196    }
16197  }, {
16198    key: "makeInlineImage",
16199    value: function makeInlineImage(cipherTransform) {
16200      var lexer = this.lexer;
16201      var stream = lexer.stream;
16202      var dict = new _primitives.Dict(this.xref);
16203      var dictLength;
16204
16205      while (!(0, _primitives.isCmd)(this.buf1, 'ID') && !(0, _primitives.isEOF)(this.buf1)) {
16206        if (!(0, _primitives.isName)(this.buf1)) {
16207          throw new _util.FormatError('Dictionary key must be a name object');
16208        }
16209
16210        var key = this.buf1.name;
16211        this.shift();
16212
16213        if ((0, _primitives.isEOF)(this.buf1)) {
16214          break;
16215        }
16216
16217        dict.set(key, this.getObj(cipherTransform));
16218      }
16219
16220      if (lexer.beginInlineImagePos !== -1) {
16221        dictLength = stream.pos - lexer.beginInlineImagePos;
16222      }
16223
16224      var filter = dict.get('Filter', 'F');
16225      var filterName;
16226
16227      if ((0, _primitives.isName)(filter)) {
16228        filterName = filter.name;
16229      } else if (Array.isArray(filter)) {
16230        var filterZero = this.xref.fetchIfRef(filter[0]);
16231
16232        if ((0, _primitives.isName)(filterZero)) {
16233          filterName = filterZero.name;
16234        }
16235      }
16236
16237      var startPos = stream.pos;
16238      var length;
16239
16240      if (filterName === 'DCTDecode' || filterName === 'DCT') {
16241        length = this.findDCTDecodeInlineStreamEnd(stream);
16242      } else if (filterName === 'ASCII85Decode' || filterName === 'A85') {
16243        length = this.findASCII85DecodeInlineStreamEnd(stream);
16244      } else if (filterName === 'ASCIIHexDecode' || filterName === 'AHx') {
16245        length = this.findASCIIHexDecodeInlineStreamEnd(stream);
16246      } else {
16247        length = this.findDefaultInlineStreamEnd(stream);
16248      }
16249
16250      var imageStream = stream.makeSubStream(startPos, length, dict);
16251      var cacheKey;
16252
16253      if (length < MAX_LENGTH_TO_CACHE && dictLength < MAX_ADLER32_LENGTH) {
16254        var imageBytes = imageStream.getBytes();
16255        imageStream.reset();
16256        var initialStreamPos = stream.pos;
16257        stream.pos = lexer.beginInlineImagePos;
16258        var dictBytes = stream.getBytes(dictLength);
16259        stream.pos = initialStreamPos;
16260        cacheKey = computeAdler32(imageBytes) + '_' + computeAdler32(dictBytes);
16261        var cacheEntry = this.imageCache[cacheKey];
16262
16263        if (cacheEntry !== undefined) {
16264          this.buf2 = _primitives.Cmd.get('EI');
16265          this.shift();
16266          cacheEntry.reset();
16267          return cacheEntry;
16268        }
16269      }
16270
16271      if (cipherTransform) {
16272        imageStream = cipherTransform.createStream(imageStream, length);
16273      }
16274
16275      imageStream = this.filter(imageStream, dict, length);
16276      imageStream.dict = dict;
16277
16278      if (cacheKey !== undefined) {
16279        imageStream.cacheKey = "inline_".concat(length, "_").concat(cacheKey);
16280        this.imageCache[cacheKey] = imageStream;
16281      }
16282
16283      this.buf2 = _primitives.Cmd.get('EI');
16284      this.shift();
16285      return imageStream;
16286    }
16287  }, {
16288    key: "_findStreamLength",
16289    value: function _findStreamLength(startPos, signature) {
16290      var stream = this.lexer.stream;
16291      stream.pos = startPos;
16292      var SCAN_BLOCK_LENGTH = 2048;
16293      var signatureLength = signature.length;
16294
16295      while (stream.pos < stream.end) {
16296        var scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
16297        var scanLength = scanBytes.length - signatureLength;
16298
16299        if (scanLength <= 0) {
16300          break;
16301        }
16302
16303        var pos = 0;
16304
16305        while (pos < scanLength) {
16306          var j = 0;
16307
16308          while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
16309            j++;
16310          }
16311
16312          if (j >= signatureLength) {
16313            stream.pos += pos;
16314            return stream.pos - startPos;
16315          }
16316
16317          pos++;
16318        }
16319
16320        stream.pos += scanLength;
16321      }
16322
16323      return -1;
16324    }
16325  }, {
16326    key: "makeStream",
16327    value: function makeStream(dict, cipherTransform) {
16328      var lexer = this.lexer;
16329      var stream = lexer.stream;
16330      lexer.skipToNextLine();
16331      var startPos = stream.pos - 1;
16332      var length = dict.get('Length');
16333
16334      if (!Number.isInteger(length)) {
16335        (0, _util.info)("Bad length \"".concat(length, "\" in stream"));
16336        length = 0;
16337      }
16338
16339      stream.pos = startPos + length;
16340      lexer.nextChar();
16341
16342      if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, 'endstream')) {
16343        this.shift();
16344      } else {
16345        var ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6E, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6D]);
16346
16347        var actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE);
16348
16349        if (actualLength < 0) {
16350          var MAX_TRUNCATION = 1;
16351
16352          for (var i = 1; i <= MAX_TRUNCATION; i++) {
16353            var end = ENDSTREAM_SIGNATURE.length - i;
16354            var TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end);
16355
16356            var maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE);
16357
16358            if (maybeLength >= 0) {
16359              var lastByte = stream.peekBytes(end + 1)[end];
16360
16361              if (!(0, _util.isSpace)(lastByte)) {
16362                break;
16363              }
16364
16365              (0, _util.info)("Found \"".concat((0, _util.bytesToString)(TRUNCATED_SIGNATURE), "\" when ") + 'searching for endstream command.');
16366              actualLength = maybeLength;
16367              break;
16368            }
16369          }
16370
16371          if (actualLength < 0) {
16372            throw new _util.FormatError('Missing endstream command.');
16373          }
16374        }
16375
16376        length = actualLength;
16377        lexer.nextChar();
16378        this.shift();
16379        this.shift();
16380      }
16381
16382      this.shift();
16383      stream = stream.makeSubStream(startPos, length, dict);
16384
16385      if (cipherTransform) {
16386        stream = cipherTransform.createStream(stream, length);
16387      }
16388
16389      stream = this.filter(stream, dict, length);
16390      stream.dict = dict;
16391      return stream;
16392    }
16393  }, {
16394    key: "filter",
16395    value: function filter(stream, dict, length) {
16396      var filter = dict.get('Filter', 'F');
16397      var params = dict.get('DecodeParms', 'DP');
16398
16399      if ((0, _primitives.isName)(filter)) {
16400        if (Array.isArray(params)) {
16401          (0, _util.warn)('/DecodeParms should not contain an Array, ' + 'when /Filter contains a Name.');
16402        }
16403
16404        return this.makeFilter(stream, filter.name, length, params);
16405      }
16406
16407      var maybeLength = length;
16408
16409      if (Array.isArray(filter)) {
16410        var filterArray = filter;
16411        var paramsArray = params;
16412
16413        for (var i = 0, ii = filterArray.length; i < ii; ++i) {
16414          filter = this.xref.fetchIfRef(filterArray[i]);
16415
16416          if (!(0, _primitives.isName)(filter)) {
16417            throw new _util.FormatError("Bad filter name \"".concat(filter, "\""));
16418          }
16419
16420          params = null;
16421
16422          if (Array.isArray(paramsArray) && i in paramsArray) {
16423            params = this.xref.fetchIfRef(paramsArray[i]);
16424          }
16425
16426          stream = this.makeFilter(stream, filter.name, maybeLength, params);
16427          maybeLength = null;
16428        }
16429      }
16430
16431      return stream;
16432    }
16433  }, {
16434    key: "makeFilter",
16435    value: function makeFilter(stream, name, maybeLength, params) {
16436      if (maybeLength === 0) {
16437        (0, _util.warn)("Empty \"".concat(name, "\" stream."));
16438        return new _stream.NullStream();
16439      }
16440
16441      try {
16442        var xrefStreamStats = this.xref.stats.streamTypes;
16443
16444        if (name === 'FlateDecode' || name === 'Fl') {
16445          xrefStreamStats[_util.StreamType.FLATE] = true;
16446
16447          if (params) {
16448            return new _stream.PredictorStream(new _stream.FlateStream(stream, maybeLength), maybeLength, params);
16449          }
16450
16451          return new _stream.FlateStream(stream, maybeLength);
16452        }
16453
16454        if (name === 'LZWDecode' || name === 'LZW') {
16455          xrefStreamStats[_util.StreamType.LZW] = true;
16456          var earlyChange = 1;
16457
16458          if (params) {
16459            if (params.has('EarlyChange')) {
16460              earlyChange = params.get('EarlyChange');
16461            }
16462
16463            return new _stream.PredictorStream(new _stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
16464          }
16465
16466          return new _stream.LZWStream(stream, maybeLength, earlyChange);
16467        }
16468
16469        if (name === 'DCTDecode' || name === 'DCT') {
16470          xrefStreamStats[_util.StreamType.DCT] = true;
16471          return new _jpeg_stream.JpegStream(stream, maybeLength, stream.dict, params);
16472        }
16473
16474        if (name === 'JPXDecode' || name === 'JPX') {
16475          xrefStreamStats[_util.StreamType.JPX] = true;
16476          return new _jpx_stream.JpxStream(stream, maybeLength, stream.dict, params);
16477        }
16478
16479        if (name === 'ASCII85Decode' || name === 'A85') {
16480          xrefStreamStats[_util.StreamType.A85] = true;
16481          return new _stream.Ascii85Stream(stream, maybeLength);
16482        }
16483
16484        if (name === 'ASCIIHexDecode' || name === 'AHx') {
16485          xrefStreamStats[_util.StreamType.AHX] = true;
16486          return new _stream.AsciiHexStream(stream, maybeLength);
16487        }
16488
16489        if (name === 'CCITTFaxDecode' || name === 'CCF') {
16490          xrefStreamStats[_util.StreamType.CCF] = true;
16491          return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params);
16492        }
16493
16494        if (name === 'RunLengthDecode' || name === 'RL') {
16495          xrefStreamStats[_util.StreamType.RL] = true;
16496          return new _stream.RunLengthStream(stream, maybeLength);
16497        }
16498
16499        if (name === 'JBIG2Decode') {
16500          xrefStreamStats[_util.StreamType.JBIG] = true;
16501          return new _jbig2_stream.Jbig2Stream(stream, maybeLength, stream.dict, params);
16502        }
16503
16504        (0, _util.warn)("Filter \"".concat(name, "\" is not supported."));
16505        return stream;
16506      } catch (ex) {
16507        if (ex instanceof _core_utils.MissingDataException) {
16508          throw ex;
16509        }
16510
16511        (0, _util.warn)("Invalid stream: \"".concat(ex, "\""));
16512        return new _stream.NullStream();
16513      }
16514    }
16515  }]);
16516
16517  return Parser;
16518}();
16519
16520exports.Parser = Parser;
16521var specialChars = [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
16522
16523function toHexDigit(ch) {
16524  if (ch >= 0x30 && ch <= 0x39) {
16525    return ch & 0x0F;
16526  }
16527
16528  if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
16529    return (ch & 0x0F) + 9;
16530  }
16531
16532  return -1;
16533}
16534
16535var Lexer =
16536/*#__PURE__*/
16537function () {
16538  function Lexer(stream) {
16539    var knownCommands = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
16540
16541    _classCallCheck(this, Lexer);
16542
16543    this.stream = stream;
16544    this.nextChar();
16545    this.strBuf = [];
16546    this.knownCommands = knownCommands;
16547    this.beginInlineImagePos = -1;
16548  }
16549
16550  _createClass(Lexer, [{
16551    key: "nextChar",
16552    value: function nextChar() {
16553      return this.currentChar = this.stream.getByte();
16554    }
16555  }, {
16556    key: "peekChar",
16557    value: function peekChar() {
16558      return this.stream.peekByte();
16559    }
16560  }, {
16561    key: "getNumber",
16562    value: function getNumber() {
16563      var ch = this.currentChar;
16564      var eNotation = false;
16565      var divideBy = 0;
16566      var sign = 0;
16567
16568      if (ch === 0x2D) {
16569        sign = -1;
16570        ch = this.nextChar();
16571
16572        if (ch === 0x2D) {
16573          ch = this.nextChar();
16574        }
16575      } else if (ch === 0x2B) {
16576        sign = 1;
16577        ch = this.nextChar();
16578      }
16579
16580      if (ch === 0x0A || ch === 0x0D) {
16581        do {
16582          ch = this.nextChar();
16583        } while (ch === 0x0A || ch === 0x0D);
16584      }
16585
16586      if (ch === 0x2E) {
16587        divideBy = 10;
16588        ch = this.nextChar();
16589      }
16590
16591      if (ch < 0x30 || ch > 0x39) {
16592        if (divideBy === 10 && sign === 0 && ((0, _util.isSpace)(ch) || ch === -1)) {
16593          (0, _util.warn)('Lexer.getNumber - treating a single decimal point as zero.');
16594          return 0;
16595        }
16596
16597        throw new _util.FormatError("Invalid number: ".concat(String.fromCharCode(ch), " (charCode ").concat(ch, ")"));
16598      }
16599
16600      sign = sign || 1;
16601      var baseValue = ch - 0x30;
16602      var powerValue = 0;
16603      var powerValueSign = 1;
16604
16605      while ((ch = this.nextChar()) >= 0) {
16606        if (0x30 <= ch && ch <= 0x39) {
16607          var currentDigit = ch - 0x30;
16608
16609          if (eNotation) {
16610            powerValue = powerValue * 10 + currentDigit;
16611          } else {
16612            if (divideBy !== 0) {
16613              divideBy *= 10;
16614            }
16615
16616            baseValue = baseValue * 10 + currentDigit;
16617          }
16618        } else if (ch === 0x2E) {
16619          if (divideBy === 0) {
16620            divideBy = 1;
16621          } else {
16622            break;
16623          }
16624        } else if (ch === 0x2D) {
16625          (0, _util.warn)('Badly formatted number: minus sign in the middle');
16626        } else if (ch === 0x45 || ch === 0x65) {
16627          ch = this.peekChar();
16628
16629          if (ch === 0x2B || ch === 0x2D) {
16630            powerValueSign = ch === 0x2D ? -1 : 1;
16631            this.nextChar();
16632          } else if (ch < 0x30 || ch > 0x39) {
16633            break;
16634          }
16635
16636          eNotation = true;
16637        } else {
16638          break;
16639        }
16640      }
16641
16642      if (divideBy !== 0) {
16643        baseValue /= divideBy;
16644      }
16645
16646      if (eNotation) {
16647        baseValue *= Math.pow(10, powerValueSign * powerValue);
16648      }
16649
16650      return sign * baseValue;
16651    }
16652  }, {
16653    key: "getString",
16654    value: function getString() {
16655      var numParen = 1;
16656      var done = false;
16657      var strBuf = this.strBuf;
16658      strBuf.length = 0;
16659      var ch = this.nextChar();
16660
16661      while (true) {
16662        var charBuffered = false;
16663
16664        switch (ch | 0) {
16665          case -1:
16666            (0, _util.warn)('Unterminated string');
16667            done = true;
16668            break;
16669
16670          case 0x28:
16671            ++numParen;
16672            strBuf.push('(');
16673            break;
16674
16675          case 0x29:
16676            if (--numParen === 0) {
16677              this.nextChar();
16678              done = true;
16679            } else {
16680              strBuf.push(')');
16681            }
16682
16683            break;
16684
16685          case 0x5C:
16686            ch = this.nextChar();
16687
16688            switch (ch) {
16689              case -1:
16690                (0, _util.warn)('Unterminated string');
16691                done = true;
16692                break;
16693
16694              case 0x6E:
16695                strBuf.push('\n');
16696                break;
16697
16698              case 0x72:
16699                strBuf.push('\r');
16700                break;
16701
16702              case 0x74:
16703                strBuf.push('\t');
16704                break;
16705
16706              case 0x62:
16707                strBuf.push('\b');
16708                break;
16709
16710              case 0x66:
16711                strBuf.push('\f');
16712                break;
16713
16714              case 0x5C:
16715              case 0x28:
16716              case 0x29:
16717                strBuf.push(String.fromCharCode(ch));
16718                break;
16719
16720              case 0x30:
16721              case 0x31:
16722              case 0x32:
16723              case 0x33:
16724              case 0x34:
16725              case 0x35:
16726              case 0x36:
16727              case 0x37:
16728                var x = ch & 0x0F;
16729                ch = this.nextChar();
16730                charBuffered = true;
16731
16732                if (ch >= 0x30 && ch <= 0x37) {
16733                  x = (x << 3) + (ch & 0x0F);
16734                  ch = this.nextChar();
16735
16736                  if (ch >= 0x30 && ch <= 0x37) {
16737                    charBuffered = false;
16738                    x = (x << 3) + (ch & 0x0F);
16739                  }
16740                }
16741
16742                strBuf.push(String.fromCharCode(x));
16743                break;
16744
16745              case 0x0D:
16746                if (this.peekChar() === 0x0A) {
16747                  this.nextChar();
16748                }
16749
16750                break;
16751
16752              case 0x0A:
16753                break;
16754
16755              default:
16756                strBuf.push(String.fromCharCode(ch));
16757                break;
16758            }
16759
16760            break;
16761
16762          default:
16763            strBuf.push(String.fromCharCode(ch));
16764            break;
16765        }
16766
16767        if (done) {
16768          break;
16769        }
16770
16771        if (!charBuffered) {
16772          ch = this.nextChar();
16773        }
16774      }
16775
16776      return strBuf.join('');
16777    }
16778  }, {
16779    key: "getName",
16780    value: function getName() {
16781      var ch, previousCh;
16782      var strBuf = this.strBuf;
16783      strBuf.length = 0;
16784
16785      while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
16786        if (ch === 0x23) {
16787          ch = this.nextChar();
16788
16789          if (specialChars[ch]) {
16790            (0, _util.warn)('Lexer_getName: ' + 'NUMBER SIGN (#) should be followed by a hexadecimal number.');
16791            strBuf.push('#');
16792            break;
16793          }
16794
16795          var x = toHexDigit(ch);
16796
16797          if (x !== -1) {
16798            previousCh = ch;
16799            ch = this.nextChar();
16800            var x2 = toHexDigit(ch);
16801
16802            if (x2 === -1) {
16803              (0, _util.warn)("Lexer_getName: Illegal digit (".concat(String.fromCharCode(ch), ") ") + 'in hexadecimal number.');
16804              strBuf.push('#', String.fromCharCode(previousCh));
16805
16806              if (specialChars[ch]) {
16807                break;
16808              }
16809
16810              strBuf.push(String.fromCharCode(ch));
16811              continue;
16812            }
16813
16814            strBuf.push(String.fromCharCode(x << 4 | x2));
16815          } else {
16816            strBuf.push('#', String.fromCharCode(ch));
16817          }
16818        } else {
16819          strBuf.push(String.fromCharCode(ch));
16820        }
16821      }
16822
16823      if (strBuf.length > 127) {
16824        (0, _util.warn)("Name token is longer than allowed by the spec: ".concat(strBuf.length));
16825      }
16826
16827      return _primitives.Name.get(strBuf.join(''));
16828    }
16829  }, {
16830    key: "getHexString",
16831    value: function getHexString() {
16832      var strBuf = this.strBuf;
16833      strBuf.length = 0;
16834      var ch = this.currentChar;
16835      var isFirstHex = true;
16836      var firstDigit, secondDigit;
16837
16838      while (true) {
16839        if (ch < 0) {
16840          (0, _util.warn)('Unterminated hex string');
16841          break;
16842        } else if (ch === 0x3E) {
16843          this.nextChar();
16844          break;
16845        } else if (specialChars[ch] === 1) {
16846          ch = this.nextChar();
16847          continue;
16848        } else {
16849          if (isFirstHex) {
16850            firstDigit = toHexDigit(ch);
16851
16852            if (firstDigit === -1) {
16853              (0, _util.warn)("Ignoring invalid character \"".concat(ch, "\" in hex string"));
16854              ch = this.nextChar();
16855              continue;
16856            }
16857          } else {
16858            secondDigit = toHexDigit(ch);
16859
16860            if (secondDigit === -1) {
16861              (0, _util.warn)("Ignoring invalid character \"".concat(ch, "\" in hex string"));
16862              ch = this.nextChar();
16863              continue;
16864            }
16865
16866            strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
16867          }
16868
16869          isFirstHex = !isFirstHex;
16870          ch = this.nextChar();
16871        }
16872      }
16873
16874      return strBuf.join('');
16875    }
16876  }, {
16877    key: "getObj",
16878    value: function getObj() {
16879      var comment = false;
16880      var ch = this.currentChar;
16881
16882      while (true) {
16883        if (ch < 0) {
16884          return _primitives.EOF;
16885        }
16886
16887        if (comment) {
16888          if (ch === 0x0A || ch === 0x0D) {
16889            comment = false;
16890          }
16891        } else if (ch === 0x25) {
16892          comment = true;
16893        } else if (specialChars[ch] !== 1) {
16894          break;
16895        }
16896
16897        ch = this.nextChar();
16898      }
16899
16900      switch (ch | 0) {
16901        case 0x30:
16902        case 0x31:
16903        case 0x32:
16904        case 0x33:
16905        case 0x34:
16906        case 0x35:
16907        case 0x36:
16908        case 0x37:
16909        case 0x38:
16910        case 0x39:
16911        case 0x2B:
16912        case 0x2D:
16913        case 0x2E:
16914          return this.getNumber();
16915
16916        case 0x28:
16917          return this.getString();
16918
16919        case 0x2F:
16920          return this.getName();
16921
16922        case 0x5B:
16923          this.nextChar();
16924          return _primitives.Cmd.get('[');
16925
16926        case 0x5D:
16927          this.nextChar();
16928          return _primitives.Cmd.get(']');
16929
16930        case 0x3C:
16931          ch = this.nextChar();
16932
16933          if (ch === 0x3C) {
16934            this.nextChar();
16935            return _primitives.Cmd.get('<<');
16936          }
16937
16938          return this.getHexString();
16939
16940        case 0x3E:
16941          ch = this.nextChar();
16942
16943          if (ch === 0x3E) {
16944            this.nextChar();
16945            return _primitives.Cmd.get('>>');
16946          }
16947
16948          return _primitives.Cmd.get('>');
16949
16950        case 0x7B:
16951          this.nextChar();
16952          return _primitives.Cmd.get('{');
16953
16954        case 0x7D:
16955          this.nextChar();
16956          return _primitives.Cmd.get('}');
16957
16958        case 0x29:
16959          this.nextChar();
16960          throw new _util.FormatError("Illegal character: ".concat(ch));
16961      }
16962
16963      var str = String.fromCharCode(ch);
16964      var knownCommands = this.knownCommands;
16965      var knownCommandFound = knownCommands && knownCommands[str] !== undefined;
16966
16967      while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
16968        var possibleCommand = str + String.fromCharCode(ch);
16969
16970        if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
16971          break;
16972        }
16973
16974        if (str.length === 128) {
16975          throw new _util.FormatError("Command token too long: ".concat(str.length));
16976        }
16977
16978        str = possibleCommand;
16979        knownCommandFound = knownCommands && knownCommands[str] !== undefined;
16980      }
16981
16982      if (str === 'true') {
16983        return true;
16984      }
16985
16986      if (str === 'false') {
16987        return false;
16988      }
16989
16990      if (str === 'null') {
16991        return null;
16992      }
16993
16994      if (str === 'BI') {
16995        this.beginInlineImagePos = this.stream.pos;
16996      }
16997
16998      return _primitives.Cmd.get(str);
16999    }
17000  }, {
17001    key: "skipToNextLine",
17002    value: function skipToNextLine() {
17003      var ch = this.currentChar;
17004
17005      while (ch >= 0) {
17006        if (ch === 0x0D) {
17007          ch = this.nextChar();
17008
17009          if (ch === 0x0A) {
17010            this.nextChar();
17011          }
17012
17013          break;
17014        } else if (ch === 0x0A) {
17015          this.nextChar();
17016          break;
17017        }
17018
17019        ch = this.nextChar();
17020      }
17021    }
17022  }]);
17023
17024  return Lexer;
17025}();
17026
17027exports.Lexer = Lexer;
17028
17029var Linearization =
17030/*#__PURE__*/
17031function () {
17032  function Linearization() {
17033    _classCallCheck(this, Linearization);
17034  }
17035
17036  _createClass(Linearization, null, [{
17037    key: "create",
17038    value: function create(stream) {
17039      function getInt(linDict, name) {
17040        var allowZeroValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
17041        var obj = linDict.get(name);
17042
17043        if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
17044          return obj;
17045        }
17046
17047        throw new Error("The \"".concat(name, "\" parameter in the linearization ") + 'dictionary is invalid.');
17048      }
17049
17050      function getHints(linDict) {
17051        var hints = linDict.get('H');
17052        var hintsLength;
17053
17054        if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
17055          for (var index = 0; index < hintsLength; index++) {
17056            var hint = hints[index];
17057
17058            if (!(Number.isInteger(hint) && hint > 0)) {
17059              throw new Error("Hint (".concat(index, ") in the linearization dictionary ") + 'is invalid.');
17060            }
17061          }
17062
17063          return hints;
17064        }
17065
17066        throw new Error('Hint array in the linearization dictionary is invalid.');
17067      }
17068
17069      var parser = new Parser({
17070        lexer: new Lexer(stream),
17071        xref: null
17072      });
17073      var obj1 = parser.getObj();
17074      var obj2 = parser.getObj();
17075      var obj3 = parser.getObj();
17076      var linDict = parser.getObj();
17077      var obj, length;
17078
17079      if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && (0, _primitives.isCmd)(obj3, 'obj') && (0, _primitives.isDict)(linDict) && (0, _util.isNum)(obj = linDict.get('Linearized')) && obj > 0)) {
17080        return null;
17081      } else if ((length = getInt(linDict, 'L')) !== stream.length) {
17082        throw new Error('The "L" parameter in the linearization dictionary ' + 'does not equal the stream length.');
17083      }
17084
17085      return {
17086        length: length,
17087        hints: getHints(linDict),
17088        objectNumberFirst: getInt(linDict, 'O'),
17089        endFirst: getInt(linDict, 'E'),
17090        numPages: getInt(linDict, 'N'),
17091        mainXRefEntriesOffset: getInt(linDict, 'T'),
17092        pageFirst: linDict.has('P') ? getInt(linDict, 'P', true) : 0
17093      };
17094    }
17095  }]);
17096
17097  return Linearization;
17098}();
17099
17100exports.Linearization = Linearization;
17101
17102/***/ }),
17103/* 158 */
17104/***/ (function(module, exports, __w_pdfjs_require__) {
17105
17106"use strict";
17107
17108
17109Object.defineProperty(exports, "__esModule", {
17110  value: true
17111});
17112exports.LZWStream = exports.StringStream = exports.StreamsSequenceStream = exports.Stream = exports.RunLengthStream = exports.PredictorStream = exports.NullStream = exports.FlateStream = exports.DecodeStream = exports.DecryptStream = exports.AsciiHexStream = exports.Ascii85Stream = void 0;
17113
17114var _util = __w_pdfjs_require__(5);
17115
17116var _primitives = __w_pdfjs_require__(151);
17117
17118function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
17119
17120function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
17121
17122function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
17123
17124function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
17125
17126var Stream = function StreamClosure() {
17127  function Stream(arrayBuffer, start, length, dict) {
17128    this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
17129    this.start = start || 0;
17130    this.pos = this.start;
17131    this.end = start + length || this.bytes.length;
17132    this.dict = dict;
17133  }
17134
17135  Stream.prototype = {
17136    get length() {
17137      return this.end - this.start;
17138    },
17139
17140    get isEmpty() {
17141      return this.length === 0;
17142    },
17143
17144    getByte: function Stream_getByte() {
17145      if (this.pos >= this.end) {
17146        return -1;
17147      }
17148
17149      return this.bytes[this.pos++];
17150    },
17151    getUint16: function Stream_getUint16() {
17152      var b0 = this.getByte();
17153      var b1 = this.getByte();
17154
17155      if (b0 === -1 || b1 === -1) {
17156        return -1;
17157      }
17158
17159      return (b0 << 8) + b1;
17160    },
17161    getInt32: function Stream_getInt32() {
17162      var b0 = this.getByte();
17163      var b1 = this.getByte();
17164      var b2 = this.getByte();
17165      var b3 = this.getByte();
17166      return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
17167    },
17168    getBytes: function getBytes(length) {
17169      var forceClamped = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
17170      var bytes = this.bytes;
17171      var pos = this.pos;
17172      var strEnd = this.end;
17173
17174      if (!length) {
17175        var _subarray = bytes.subarray(pos, strEnd);
17176
17177        return forceClamped ? new Uint8ClampedArray(_subarray) : _subarray;
17178      }
17179
17180      var end = pos + length;
17181
17182      if (end > strEnd) {
17183        end = strEnd;
17184      }
17185
17186      this.pos = end;
17187      var subarray = bytes.subarray(pos, end);
17188      return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
17189    },
17190    peekByte: function Stream_peekByte() {
17191      var peekedByte = this.getByte();
17192      this.pos--;
17193      return peekedByte;
17194    },
17195    peekBytes: function peekBytes(length) {
17196      var forceClamped = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
17197      var bytes = this.getBytes(length, forceClamped);
17198      this.pos -= bytes.length;
17199      return bytes;
17200    },
17201    skip: function Stream_skip(n) {
17202      if (!n) {
17203        n = 1;
17204      }
17205
17206      this.pos += n;
17207    },
17208    reset: function Stream_reset() {
17209      this.pos = this.start;
17210    },
17211    moveStart: function Stream_moveStart() {
17212      this.start = this.pos;
17213    },
17214    makeSubStream: function Stream_makeSubStream(start, length, dict) {
17215      return new Stream(this.bytes.buffer, start, length, dict);
17216    }
17217  };
17218  return Stream;
17219}();
17220
17221exports.Stream = Stream;
17222
17223var StringStream = function StringStreamClosure() {
17224  function StringStream(str) {
17225    var bytes = (0, _util.stringToBytes)(str);
17226    Stream.call(this, bytes);
17227  }
17228
17229  StringStream.prototype = Stream.prototype;
17230  return StringStream;
17231}();
17232
17233exports.StringStream = StringStream;
17234
17235var DecodeStream = function DecodeStreamClosure() {
17236  var emptyBuffer = new Uint8Array(0);
17237
17238  function DecodeStream(maybeMinBufferLength) {
17239    this._rawMinBufferLength = maybeMinBufferLength || 0;
17240    this.pos = 0;
17241    this.bufferLength = 0;
17242    this.eof = false;
17243    this.buffer = emptyBuffer;
17244    this.minBufferLength = 512;
17245
17246    if (maybeMinBufferLength) {
17247      while (this.minBufferLength < maybeMinBufferLength) {
17248        this.minBufferLength *= 2;
17249      }
17250    }
17251  }
17252
17253  DecodeStream.prototype = {
17254    get isEmpty() {
17255      while (!this.eof && this.bufferLength === 0) {
17256        this.readBlock();
17257      }
17258
17259      return this.bufferLength === 0;
17260    },
17261
17262    ensureBuffer: function DecodeStream_ensureBuffer(requested) {
17263      var buffer = this.buffer;
17264
17265      if (requested <= buffer.byteLength) {
17266        return buffer;
17267      }
17268
17269      var size = this.minBufferLength;
17270
17271      while (size < requested) {
17272        size *= 2;
17273      }
17274
17275      var buffer2 = new Uint8Array(size);
17276      buffer2.set(buffer);
17277      return this.buffer = buffer2;
17278    },
17279    getByte: function DecodeStream_getByte() {
17280      var pos = this.pos;
17281
17282      while (this.bufferLength <= pos) {
17283        if (this.eof) {
17284          return -1;
17285        }
17286
17287        this.readBlock();
17288      }
17289
17290      return this.buffer[this.pos++];
17291    },
17292    getUint16: function DecodeStream_getUint16() {
17293      var b0 = this.getByte();
17294      var b1 = this.getByte();
17295
17296      if (b0 === -1 || b1 === -1) {
17297        return -1;
17298      }
17299
17300      return (b0 << 8) + b1;
17301    },
17302    getInt32: function DecodeStream_getInt32() {
17303      var b0 = this.getByte();
17304      var b1 = this.getByte();
17305      var b2 = this.getByte();
17306      var b3 = this.getByte();
17307      return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
17308    },
17309    getBytes: function getBytes(length) {
17310      var forceClamped = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
17311      var end,
17312          pos = this.pos;
17313
17314      if (length) {
17315        this.ensureBuffer(pos + length);
17316        end = pos + length;
17317
17318        while (!this.eof && this.bufferLength < end) {
17319          this.readBlock();
17320        }
17321
17322        var bufEnd = this.bufferLength;
17323
17324        if (end > bufEnd) {
17325          end = bufEnd;
17326        }
17327      } else {
17328        while (!this.eof) {
17329          this.readBlock();
17330        }
17331
17332        end = this.bufferLength;
17333      }
17334
17335      this.pos = end;
17336      var subarray = this.buffer.subarray(pos, end);
17337      return forceClamped && !(subarray instanceof Uint8ClampedArray) ? new Uint8ClampedArray(subarray) : subarray;
17338    },
17339    peekByte: function DecodeStream_peekByte() {
17340      var peekedByte = this.getByte();
17341      this.pos--;
17342      return peekedByte;
17343    },
17344    peekBytes: function peekBytes(length) {
17345      var forceClamped = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
17346      var bytes = this.getBytes(length, forceClamped);
17347      this.pos -= bytes.length;
17348      return bytes;
17349    },
17350    makeSubStream: function DecodeStream_makeSubStream(start, length, dict) {
17351      var end = start + length;
17352
17353      while (this.bufferLength <= end && !this.eof) {
17354        this.readBlock();
17355      }
17356
17357      return new Stream(this.buffer, start, length, dict);
17358    },
17359    skip: function DecodeStream_skip(n) {
17360      if (!n) {
17361        n = 1;
17362      }
17363
17364      this.pos += n;
17365    },
17366    reset: function DecodeStream_reset() {
17367      this.pos = 0;
17368    },
17369    getBaseStreams: function DecodeStream_getBaseStreams() {
17370      if (this.str && this.str.getBaseStreams) {
17371        return this.str.getBaseStreams();
17372      }
17373
17374      return [];
17375    }
17376  };
17377  return DecodeStream;
17378}();
17379
17380exports.DecodeStream = DecodeStream;
17381
17382var StreamsSequenceStream = function StreamsSequenceStreamClosure() {
17383  function StreamsSequenceStream(streams) {
17384    this.streams = streams;
17385    var maybeLength = 0;
17386
17387    for (var i = 0, ii = streams.length; i < ii; i++) {
17388      var stream = streams[i];
17389
17390      if (stream instanceof DecodeStream) {
17391        maybeLength += stream._rawMinBufferLength;
17392      } else {
17393        maybeLength += stream.length;
17394      }
17395    }
17396
17397    DecodeStream.call(this, maybeLength);
17398  }
17399
17400  StreamsSequenceStream.prototype = Object.create(DecodeStream.prototype);
17401
17402  StreamsSequenceStream.prototype.readBlock = function streamSequenceStreamReadBlock() {
17403    var streams = this.streams;
17404
17405    if (streams.length === 0) {
17406      this.eof = true;
17407      return;
17408    }
17409
17410    var stream = streams.shift();
17411    var chunk = stream.getBytes();
17412    var bufferLength = this.bufferLength;
17413    var newLength = bufferLength + chunk.length;
17414    var buffer = this.ensureBuffer(newLength);
17415    buffer.set(chunk, bufferLength);
17416    this.bufferLength = newLength;
17417  };
17418
17419  StreamsSequenceStream.prototype.getBaseStreams = function StreamsSequenceStream_getBaseStreams() {
17420    var baseStreams = [];
17421
17422    for (var i = 0, ii = this.streams.length; i < ii; i++) {
17423      var stream = this.streams[i];
17424
17425      if (stream.getBaseStreams) {
17426        baseStreams.push.apply(baseStreams, _toConsumableArray(stream.getBaseStreams()));
17427      }
17428    }
17429
17430    return baseStreams;
17431  };
17432
17433  return StreamsSequenceStream;
17434}();
17435
17436exports.StreamsSequenceStream = StreamsSequenceStream;
17437
17438var FlateStream = function FlateStreamClosure() {
17439  var codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
17440  var lengthDecode = new Int32Array([0x00003, 0x00004, 0x00005, 0x00006, 0x00007, 0x00008, 0x00009, 0x0000a, 0x1000b, 0x1000d, 0x1000f, 0x10011, 0x20013, 0x20017, 0x2001b, 0x2001f, 0x30023, 0x3002b, 0x30033, 0x3003b, 0x40043, 0x40053, 0x40063, 0x40073, 0x50083, 0x500a3, 0x500c3, 0x500e3, 0x00102, 0x00102, 0x00102]);
17441  var distDecode = new Int32Array([0x00001, 0x00002, 0x00003, 0x00004, 0x10005, 0x10007, 0x20009, 0x2000d, 0x30011, 0x30019, 0x40021, 0x40031, 0x50041, 0x50061, 0x60081, 0x600c1, 0x70101, 0x70181, 0x80201, 0x80301, 0x90401, 0x90601, 0xa0801, 0xa0c01, 0xb1001, 0xb1801, 0xc2001, 0xc3001, 0xd4001, 0xd6001]);
17442  var fixedLitCodeTab = [new Int32Array([0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c0, 0x70108, 0x80060, 0x80020, 0x900a0, 0x80000, 0x80080, 0x80040, 0x900e0, 0x70104, 0x80058, 0x80018, 0x90090, 0x70114, 0x80078, 0x80038, 0x900d0, 0x7010c, 0x80068, 0x80028, 0x900b0, 0x80008, 0x80088, 0x80048, 0x900f0, 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c8, 0x7010a, 0x80064, 0x80024, 0x900a8, 0x80004, 0x80084, 0x80044, 0x900e8, 0x70106, 0x8005c, 0x8001c, 0x90098, 0x70116, 0x8007c, 0x8003c, 0x900d8, 0x7010e, 0x8006c, 0x8002c, 0x900b8, 0x8000c, 0x8008c, 0x8004c, 0x900f8, 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c4, 0x70109, 0x80062, 0x80022, 0x900a4, 0x80002, 0x80082, 0x80042, 0x900e4, 0x70105, 0x8005a, 0x8001a, 0x90094, 0x70115, 0x8007a, 0x8003a, 0x900d4, 0x7010d, 0x8006a, 0x8002a, 0x900b4, 0x8000a, 0x8008a, 0x8004a, 0x900f4, 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cc, 0x7010b, 0x80066, 0x80026, 0x900ac, 0x80006, 0x80086, 0x80046, 0x900ec, 0x70107, 0x8005e, 0x8001e, 0x9009c, 0x70117, 0x8007e, 0x8003e, 0x900dc, 0x7010f, 0x8006e, 0x8002e, 0x900bc, 0x8000e, 0x8008e, 0x8004e, 0x900fc, 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c2, 0x70108, 0x80061, 0x80021, 0x900a2, 0x80001, 0x80081, 0x80041, 0x900e2, 0x70104, 0x80059, 0x80019, 0x90092, 0x70114, 0x80079, 0x80039, 0x900d2, 0x7010c, 0x80069, 0x80029, 0x900b2, 0x80009, 0x80089, 0x80049, 0x900f2, 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900ca, 0x7010a, 0x80065, 0x80025, 0x900aa, 0x80005, 0x80085, 0x80045, 0x900ea, 0x70106, 0x8005d, 0x8001d, 0x9009a, 0x70116, 0x8007d, 0x8003d, 0x900da, 0x7010e, 0x8006d, 0x8002d, 0x900ba, 0x8000d, 0x8008d, 0x8004d, 0x900fa, 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c6, 0x70109, 0x80063, 0x80023, 0x900a6, 0x80003, 0x80083, 0x80043, 0x900e6, 0x70105, 0x8005b, 0x8001b, 0x90096, 0x70115, 0x8007b, 0x8003b, 0x900d6, 0x7010d, 0x8006b, 0x8002b, 0x900b6, 0x8000b, 0x8008b, 0x8004b, 0x900f6, 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900ce, 0x7010b, 0x80067, 0x80027, 0x900ae, 0x80007, 0x80087, 0x80047, 0x900ee, 0x70107, 0x8005f, 0x8001f, 0x9009e, 0x70117, 0x8007f, 0x8003f, 0x900de, 0x7010f, 0x8006f, 0x8002f, 0x900be, 0x8000f, 0x8008f, 0x8004f, 0x900fe, 0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c1, 0x70108, 0x80060, 0x80020, 0x900a1, 0x80000, 0x80080, 0x80040, 0x900e1, 0x70104, 0x80058, 0x80018, 0x90091, 0x70114, 0x80078, 0x80038, 0x900d1, 0x7010c, 0x80068, 0x80028, 0x900b1, 0x80008, 0x80088, 0x80048, 0x900f1, 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c9, 0x7010a, 0x80064, 0x80024, 0x900a9, 0x80004, 0x80084, 0x80044, 0x900e9, 0x70106, 0x8005c, 0x8001c, 0x90099, 0x70116, 0x8007c, 0x8003c, 0x900d9, 0x7010e, 0x8006c, 0x8002c, 0x900b9, 0x8000c, 0x8008c, 0x8004c, 0x900f9, 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c5, 0x70109, 0x80062, 0x80022, 0x900a5, 0x80002, 0x80082, 0x80042, 0x900e5, 0x70105, 0x8005a, 0x8001a, 0x90095, 0x70115, 0x8007a, 0x8003a, 0x900d5, 0x7010d, 0x8006a, 0x8002a, 0x900b5, 0x8000a, 0x8008a, 0x8004a, 0x900f5, 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cd, 0x7010b, 0x80066, 0x80026, 0x900ad, 0x80006, 0x80086, 0x80046, 0x900ed, 0x70107, 0x8005e, 0x8001e, 0x9009d, 0x70117, 0x8007e, 0x8003e, 0x900dd, 0x7010f, 0x8006e, 0x8002e, 0x900bd, 0x8000e, 0x8008e, 0x8004e, 0x900fd, 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c3, 0x70108, 0x80061, 0x80021, 0x900a3, 0x80001, 0x80081, 0x80041, 0x900e3, 0x70104, 0x80059, 0x80019, 0x90093, 0x70114, 0x80079, 0x80039, 0x900d3, 0x7010c, 0x80069, 0x80029, 0x900b3, 0x80009, 0x80089, 0x80049, 0x900f3, 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900cb, 0x7010a, 0x80065, 0x80025, 0x900ab, 0x80005, 0x80085, 0x80045, 0x900eb, 0x70106, 0x8005d, 0x8001d, 0x9009b, 0x70116, 0x8007d, 0x8003d, 0x900db, 0x7010e, 0x8006d, 0x8002d, 0x900bb, 0x8000d, 0x8008d, 0x8004d, 0x900fb, 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c7, 0x70109, 0x80063, 0x80023, 0x900a7, 0x80003, 0x80083, 0x80043, 0x900e7, 0x70105, 0x8005b, 0x8001b, 0x90097, 0x70115, 0x8007b, 0x8003b, 0x900d7, 0x7010d, 0x8006b, 0x8002b, 0x900b7, 0x8000b, 0x8008b, 0x8004b, 0x900f7, 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900cf, 0x7010b, 0x80067, 0x80027, 0x900af, 0x80007, 0x80087, 0x80047, 0x900ef, 0x70107, 0x8005f, 0x8001f, 0x9009f, 0x70117, 0x8007f, 0x8003f, 0x900df, 0x7010f, 0x8006f, 0x8002f, 0x900bf, 0x8000f, 0x8008f, 0x8004f, 0x900ff]), 9];
17443  var fixedDistCodeTab = [new Int32Array([0x50000, 0x50010, 0x50008, 0x50018, 0x50004, 0x50014, 0x5000c, 0x5001c, 0x50002, 0x50012, 0x5000a, 0x5001a, 0x50006, 0x50016, 0x5000e, 0x00000, 0x50001, 0x50011, 0x50009, 0x50019, 0x50005, 0x50015, 0x5000d, 0x5001d, 0x50003, 0x50013, 0x5000b, 0x5001b, 0x50007, 0x50017, 0x5000f, 0x00000]), 5];
17444
17445  function FlateStream(str, maybeLength) {
17446    this.str = str;
17447    this.dict = str.dict;
17448    var cmf = str.getByte();
17449    var flg = str.getByte();
17450
17451    if (cmf === -1 || flg === -1) {
17452      throw new _util.FormatError("Invalid header in flate stream: ".concat(cmf, ", ").concat(flg));
17453    }
17454
17455    if ((cmf & 0x0f) !== 0x08) {
17456      throw new _util.FormatError("Unknown compression method in flate stream: ".concat(cmf, ", ").concat(flg));
17457    }
17458
17459    if (((cmf << 8) + flg) % 31 !== 0) {
17460      throw new _util.FormatError("Bad FCHECK in flate stream: ".concat(cmf, ", ").concat(flg));
17461    }
17462
17463    if (flg & 0x20) {
17464      throw new _util.FormatError("FDICT bit set in flate stream: ".concat(cmf, ", ").concat(flg));
17465    }
17466
17467    this.codeSize = 0;
17468    this.codeBuf = 0;
17469    DecodeStream.call(this, maybeLength);
17470  }
17471
17472  FlateStream.prototype = Object.create(DecodeStream.prototype);
17473
17474  FlateStream.prototype.getBits = function FlateStream_getBits(bits) {
17475    var str = this.str;
17476    var codeSize = this.codeSize;
17477    var codeBuf = this.codeBuf;
17478    var b;
17479
17480    while (codeSize < bits) {
17481      if ((b = str.getByte()) === -1) {
17482        throw new _util.FormatError('Bad encoding in flate stream');
17483      }
17484
17485      codeBuf |= b << codeSize;
17486      codeSize += 8;
17487    }
17488
17489    b = codeBuf & (1 << bits) - 1;
17490    this.codeBuf = codeBuf >> bits;
17491    this.codeSize = codeSize -= bits;
17492    return b;
17493  };
17494
17495  FlateStream.prototype.getCode = function FlateStream_getCode(table) {
17496    var str = this.str;
17497    var codes = table[0];
17498    var maxLen = table[1];
17499    var codeSize = this.codeSize;
17500    var codeBuf = this.codeBuf;
17501    var b;
17502
17503    while (codeSize < maxLen) {
17504      if ((b = str.getByte()) === -1) {
17505        break;
17506      }
17507
17508      codeBuf |= b << codeSize;
17509      codeSize += 8;
17510    }
17511
17512    var code = codes[codeBuf & (1 << maxLen) - 1];
17513    var codeLen = code >> 16;
17514    var codeVal = code & 0xffff;
17515
17516    if (codeLen < 1 || codeSize < codeLen) {
17517      throw new _util.FormatError('Bad encoding in flate stream');
17518    }
17519
17520    this.codeBuf = codeBuf >> codeLen;
17521    this.codeSize = codeSize - codeLen;
17522    return codeVal;
17523  };
17524
17525  FlateStream.prototype.generateHuffmanTable = function flateStreamGenerateHuffmanTable(lengths) {
17526    var n = lengths.length;
17527    var maxLen = 0;
17528    var i;
17529
17530    for (i = 0; i < n; ++i) {
17531      if (lengths[i] > maxLen) {
17532        maxLen = lengths[i];
17533      }
17534    }
17535
17536    var size = 1 << maxLen;
17537    var codes = new Int32Array(size);
17538
17539    for (var len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
17540      for (var val = 0; val < n; ++val) {
17541        if (lengths[val] === len) {
17542          var code2 = 0;
17543          var t = code;
17544
17545          for (i = 0; i < len; ++i) {
17546            code2 = code2 << 1 | t & 1;
17547            t >>= 1;
17548          }
17549
17550          for (i = code2; i < size; i += skip) {
17551            codes[i] = len << 16 | val;
17552          }
17553
17554          ++code;
17555        }
17556      }
17557    }
17558
17559    return [codes, maxLen];
17560  };
17561
17562  FlateStream.prototype.readBlock = function FlateStream_readBlock() {
17563    var buffer, len;
17564    var str = this.str;
17565    var hdr = this.getBits(3);
17566
17567    if (hdr & 1) {
17568      this.eof = true;
17569    }
17570
17571    hdr >>= 1;
17572
17573    if (hdr === 0) {
17574      var b;
17575
17576      if ((b = str.getByte()) === -1) {
17577        throw new _util.FormatError('Bad block header in flate stream');
17578      }
17579
17580      var blockLen = b;
17581
17582      if ((b = str.getByte()) === -1) {
17583        throw new _util.FormatError('Bad block header in flate stream');
17584      }
17585
17586      blockLen |= b << 8;
17587
17588      if ((b = str.getByte()) === -1) {
17589        throw new _util.FormatError('Bad block header in flate stream');
17590      }
17591
17592      var check = b;
17593
17594      if ((b = str.getByte()) === -1) {
17595        throw new _util.FormatError('Bad block header in flate stream');
17596      }
17597
17598      check |= b << 8;
17599
17600      if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
17601        throw new _util.FormatError('Bad uncompressed block length in flate stream');
17602      }
17603
17604      this.codeBuf = 0;
17605      this.codeSize = 0;
17606      var bufferLength = this.bufferLength;
17607      buffer = this.ensureBuffer(bufferLength + blockLen);
17608      var end = bufferLength + blockLen;
17609      this.bufferLength = end;
17610
17611      if (blockLen === 0) {
17612        if (str.peekByte() === -1) {
17613          this.eof = true;
17614        }
17615      } else {
17616        for (var n = bufferLength; n < end; ++n) {
17617          if ((b = str.getByte()) === -1) {
17618            this.eof = true;
17619            break;
17620          }
17621
17622          buffer[n] = b;
17623        }
17624      }
17625
17626      return;
17627    }
17628
17629    var litCodeTable;
17630    var distCodeTable;
17631
17632    if (hdr === 1) {
17633      litCodeTable = fixedLitCodeTab;
17634      distCodeTable = fixedDistCodeTab;
17635    } else if (hdr === 2) {
17636      var numLitCodes = this.getBits(5) + 257;
17637      var numDistCodes = this.getBits(5) + 1;
17638      var numCodeLenCodes = this.getBits(4) + 4;
17639      var codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
17640      var i;
17641
17642      for (i = 0; i < numCodeLenCodes; ++i) {
17643        codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
17644      }
17645
17646      var codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
17647      len = 0;
17648      i = 0;
17649      var codes = numLitCodes + numDistCodes;
17650      var codeLengths = new Uint8Array(codes);
17651      var bitsLength, bitsOffset, what;
17652
17653      while (i < codes) {
17654        var code = this.getCode(codeLenCodeTab);
17655
17656        if (code === 16) {
17657          bitsLength = 2;
17658          bitsOffset = 3;
17659          what = len;
17660        } else if (code === 17) {
17661          bitsLength = 3;
17662          bitsOffset = 3;
17663          what = len = 0;
17664        } else if (code === 18) {
17665          bitsLength = 7;
17666          bitsOffset = 11;
17667          what = len = 0;
17668        } else {
17669          codeLengths[i++] = len = code;
17670          continue;
17671        }
17672
17673        var repeatLength = this.getBits(bitsLength) + bitsOffset;
17674
17675        while (repeatLength-- > 0) {
17676          codeLengths[i++] = what;
17677        }
17678      }
17679
17680      litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
17681      distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
17682    } else {
17683      throw new _util.FormatError('Unknown block type in flate stream');
17684    }
17685
17686    buffer = this.buffer;
17687    var limit = buffer ? buffer.length : 0;
17688    var pos = this.bufferLength;
17689
17690    while (true) {
17691      var code1 = this.getCode(litCodeTable);
17692
17693      if (code1 < 256) {
17694        if (pos + 1 >= limit) {
17695          buffer = this.ensureBuffer(pos + 1);
17696          limit = buffer.length;
17697        }
17698
17699        buffer[pos++] = code1;
17700        continue;
17701      }
17702
17703      if (code1 === 256) {
17704        this.bufferLength = pos;
17705        return;
17706      }
17707
17708      code1 -= 257;
17709      code1 = lengthDecode[code1];
17710      var code2 = code1 >> 16;
17711
17712      if (code2 > 0) {
17713        code2 = this.getBits(code2);
17714      }
17715
17716      len = (code1 & 0xffff) + code2;
17717      code1 = this.getCode(distCodeTable);
17718      code1 = distDecode[code1];
17719      code2 = code1 >> 16;
17720
17721      if (code2 > 0) {
17722        code2 = this.getBits(code2);
17723      }
17724
17725      var dist = (code1 & 0xffff) + code2;
17726
17727      if (pos + len >= limit) {
17728        buffer = this.ensureBuffer(pos + len);
17729        limit = buffer.length;
17730      }
17731
17732      for (var k = 0; k < len; ++k, ++pos) {
17733        buffer[pos] = buffer[pos - dist];
17734      }
17735    }
17736  };
17737
17738  return FlateStream;
17739}();
17740
17741exports.FlateStream = FlateStream;
17742
17743var PredictorStream = function PredictorStreamClosure() {
17744  function PredictorStream(str, maybeLength, params) {
17745    if (!(0, _primitives.isDict)(params)) {
17746      return str;
17747    }
17748
17749    var predictor = this.predictor = params.get('Predictor') || 1;
17750
17751    if (predictor <= 1) {
17752      return str;
17753    }
17754
17755    if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
17756      throw new _util.FormatError("Unsupported predictor: ".concat(predictor));
17757    }
17758
17759    if (predictor === 2) {
17760      this.readBlock = this.readBlockTiff;
17761    } else {
17762      this.readBlock = this.readBlockPng;
17763    }
17764
17765    this.str = str;
17766    this.dict = str.dict;
17767    var colors = this.colors = params.get('Colors') || 1;
17768    var bits = this.bits = params.get('BitsPerComponent') || 8;
17769    var columns = this.columns = params.get('Columns') || 1;
17770    this.pixBytes = colors * bits + 7 >> 3;
17771    this.rowBytes = columns * colors * bits + 7 >> 3;
17772    DecodeStream.call(this, maybeLength);
17773    return this;
17774  }
17775
17776  PredictorStream.prototype = Object.create(DecodeStream.prototype);
17777
17778  PredictorStream.prototype.readBlockTiff = function predictorStreamReadBlockTiff() {
17779    var rowBytes = this.rowBytes;
17780    var bufferLength = this.bufferLength;
17781    var buffer = this.ensureBuffer(bufferLength + rowBytes);
17782    var bits = this.bits;
17783    var colors = this.colors;
17784    var rawBytes = this.str.getBytes(rowBytes);
17785    this.eof = !rawBytes.length;
17786
17787    if (this.eof) {
17788      return;
17789    }
17790
17791    var inbuf = 0,
17792        outbuf = 0;
17793    var inbits = 0,
17794        outbits = 0;
17795    var pos = bufferLength;
17796    var i;
17797
17798    if (bits === 1 && colors === 1) {
17799      for (i = 0; i < rowBytes; ++i) {
17800        var c = rawBytes[i] ^ inbuf;
17801        c ^= c >> 1;
17802        c ^= c >> 2;
17803        c ^= c >> 4;
17804        inbuf = (c & 1) << 7;
17805        buffer[pos++] = c;
17806      }
17807    } else if (bits === 8) {
17808      for (i = 0; i < colors; ++i) {
17809        buffer[pos++] = rawBytes[i];
17810      }
17811
17812      for (; i < rowBytes; ++i) {
17813        buffer[pos] = buffer[pos - colors] + rawBytes[i];
17814        pos++;
17815      }
17816    } else if (bits === 16) {
17817      var bytesPerPixel = colors * 2;
17818
17819      for (i = 0; i < bytesPerPixel; ++i) {
17820        buffer[pos++] = rawBytes[i];
17821      }
17822
17823      for (; i < rowBytes; i += 2) {
17824        var sum = ((rawBytes[i] & 0xFF) << 8) + (rawBytes[i + 1] & 0xFF) + ((buffer[pos - bytesPerPixel] & 0xFF) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xFF);
17825        buffer[pos++] = sum >> 8 & 0xFF;
17826        buffer[pos++] = sum & 0xFF;
17827      }
17828    } else {
17829      var compArray = new Uint8Array(colors + 1);
17830      var bitMask = (1 << bits) - 1;
17831      var j = 0,
17832          k = bufferLength;
17833      var columns = this.columns;
17834
17835      for (i = 0; i < columns; ++i) {
17836        for (var kk = 0; kk < colors; ++kk) {
17837          if (inbits < bits) {
17838            inbuf = inbuf << 8 | rawBytes[j++] & 0xFF;
17839            inbits += 8;
17840          }
17841
17842          compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
17843          inbits -= bits;
17844          outbuf = outbuf << bits | compArray[kk];
17845          outbits += bits;
17846
17847          if (outbits >= 8) {
17848            buffer[k++] = outbuf >> outbits - 8 & 0xFF;
17849            outbits -= 8;
17850          }
17851        }
17852      }
17853
17854      if (outbits > 0) {
17855        buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
17856      }
17857    }
17858
17859    this.bufferLength += rowBytes;
17860  };
17861
17862  PredictorStream.prototype.readBlockPng = function predictorStreamReadBlockPng() {
17863    var rowBytes = this.rowBytes;
17864    var pixBytes = this.pixBytes;
17865    var predictor = this.str.getByte();
17866    var rawBytes = this.str.getBytes(rowBytes);
17867    this.eof = !rawBytes.length;
17868
17869    if (this.eof) {
17870      return;
17871    }
17872
17873    var bufferLength = this.bufferLength;
17874    var buffer = this.ensureBuffer(bufferLength + rowBytes);
17875    var prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
17876
17877    if (prevRow.length === 0) {
17878      prevRow = new Uint8Array(rowBytes);
17879    }
17880
17881    var i,
17882        j = bufferLength,
17883        up,
17884        c;
17885
17886    switch (predictor) {
17887      case 0:
17888        for (i = 0; i < rowBytes; ++i) {
17889          buffer[j++] = rawBytes[i];
17890        }
17891
17892        break;
17893
17894      case 1:
17895        for (i = 0; i < pixBytes; ++i) {
17896          buffer[j++] = rawBytes[i];
17897        }
17898
17899        for (; i < rowBytes; ++i) {
17900          buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xFF;
17901          j++;
17902        }
17903
17904        break;
17905
17906      case 2:
17907        for (i = 0; i < rowBytes; ++i) {
17908          buffer[j++] = prevRow[i] + rawBytes[i] & 0xFF;
17909        }
17910
17911        break;
17912
17913      case 3:
17914        for (i = 0; i < pixBytes; ++i) {
17915          buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
17916        }
17917
17918        for (; i < rowBytes; ++i) {
17919          buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xFF;
17920          j++;
17921        }
17922
17923        break;
17924
17925      case 4:
17926        for (i = 0; i < pixBytes; ++i) {
17927          up = prevRow[i];
17928          c = rawBytes[i];
17929          buffer[j++] = up + c;
17930        }
17931
17932        for (; i < rowBytes; ++i) {
17933          up = prevRow[i];
17934          var upLeft = prevRow[i - pixBytes];
17935          var left = buffer[j - pixBytes];
17936          var p = left + up - upLeft;
17937          var pa = p - left;
17938
17939          if (pa < 0) {
17940            pa = -pa;
17941          }
17942
17943          var pb = p - up;
17944
17945          if (pb < 0) {
17946            pb = -pb;
17947          }
17948
17949          var pc = p - upLeft;
17950
17951          if (pc < 0) {
17952            pc = -pc;
17953          }
17954
17955          c = rawBytes[i];
17956
17957          if (pa <= pb && pa <= pc) {
17958            buffer[j++] = left + c;
17959          } else if (pb <= pc) {
17960            buffer[j++] = up + c;
17961          } else {
17962            buffer[j++] = upLeft + c;
17963          }
17964        }
17965
17966        break;
17967
17968      default:
17969        throw new _util.FormatError("Unsupported predictor: ".concat(predictor));
17970    }
17971
17972    this.bufferLength += rowBytes;
17973  };
17974
17975  return PredictorStream;
17976}();
17977
17978exports.PredictorStream = PredictorStream;
17979
17980var DecryptStream = function DecryptStreamClosure() {
17981  function DecryptStream(str, maybeLength, decrypt) {
17982    this.str = str;
17983    this.dict = str.dict;
17984    this.decrypt = decrypt;
17985    this.nextChunk = null;
17986    this.initialized = false;
17987    DecodeStream.call(this, maybeLength);
17988  }
17989
17990  var chunkSize = 512;
17991  DecryptStream.prototype = Object.create(DecodeStream.prototype);
17992
17993  DecryptStream.prototype.readBlock = function DecryptStream_readBlock() {
17994    var chunk;
17995
17996    if (this.initialized) {
17997      chunk = this.nextChunk;
17998    } else {
17999      chunk = this.str.getBytes(chunkSize);
18000      this.initialized = true;
18001    }
18002
18003    if (!chunk || chunk.length === 0) {
18004      this.eof = true;
18005      return;
18006    }
18007
18008    this.nextChunk = this.str.getBytes(chunkSize);
18009    var hasMoreData = this.nextChunk && this.nextChunk.length > 0;
18010    var decrypt = this.decrypt;
18011    chunk = decrypt(chunk, !hasMoreData);
18012    var bufferLength = this.bufferLength;
18013    var i,
18014        n = chunk.length;
18015    var buffer = this.ensureBuffer(bufferLength + n);
18016
18017    for (i = 0; i < n; i++) {
18018      buffer[bufferLength++] = chunk[i];
18019    }
18020
18021    this.bufferLength = bufferLength;
18022  };
18023
18024  return DecryptStream;
18025}();
18026
18027exports.DecryptStream = DecryptStream;
18028
18029var Ascii85Stream = function Ascii85StreamClosure() {
18030  function Ascii85Stream(str, maybeLength) {
18031    this.str = str;
18032    this.dict = str.dict;
18033    this.input = new Uint8Array(5);
18034
18035    if (maybeLength) {
18036      maybeLength = 0.8 * maybeLength;
18037    }
18038
18039    DecodeStream.call(this, maybeLength);
18040  }
18041
18042  Ascii85Stream.prototype = Object.create(DecodeStream.prototype);
18043
18044  Ascii85Stream.prototype.readBlock = function Ascii85Stream_readBlock() {
18045    var TILDA_CHAR = 0x7E;
18046    var Z_LOWER_CHAR = 0x7A;
18047    var EOF = -1;
18048    var str = this.str;
18049    var c = str.getByte();
18050
18051    while ((0, _util.isSpace)(c)) {
18052      c = str.getByte();
18053    }
18054
18055    if (c === EOF || c === TILDA_CHAR) {
18056      this.eof = true;
18057      return;
18058    }
18059
18060    var bufferLength = this.bufferLength,
18061        buffer;
18062    var i;
18063
18064    if (c === Z_LOWER_CHAR) {
18065      buffer = this.ensureBuffer(bufferLength + 4);
18066
18067      for (i = 0; i < 4; ++i) {
18068        buffer[bufferLength + i] = 0;
18069      }
18070
18071      this.bufferLength += 4;
18072    } else {
18073      var input = this.input;
18074      input[0] = c;
18075
18076      for (i = 1; i < 5; ++i) {
18077        c = str.getByte();
18078
18079        while ((0, _util.isSpace)(c)) {
18080          c = str.getByte();
18081        }
18082
18083        input[i] = c;
18084
18085        if (c === EOF || c === TILDA_CHAR) {
18086          break;
18087        }
18088      }
18089
18090      buffer = this.ensureBuffer(bufferLength + i - 1);
18091      this.bufferLength += i - 1;
18092
18093      if (i < 5) {
18094        for (; i < 5; ++i) {
18095          input[i] = 0x21 + 84;
18096        }
18097
18098        this.eof = true;
18099      }
18100
18101      var t = 0;
18102
18103      for (i = 0; i < 5; ++i) {
18104        t = t * 85 + (input[i] - 0x21);
18105      }
18106
18107      for (i = 3; i >= 0; --i) {
18108        buffer[bufferLength + i] = t & 0xFF;
18109        t >>= 8;
18110      }
18111    }
18112  };
18113
18114  return Ascii85Stream;
18115}();
18116
18117exports.Ascii85Stream = Ascii85Stream;
18118
18119var AsciiHexStream = function AsciiHexStreamClosure() {
18120  function AsciiHexStream(str, maybeLength) {
18121    this.str = str;
18122    this.dict = str.dict;
18123    this.firstDigit = -1;
18124
18125    if (maybeLength) {
18126      maybeLength = 0.5 * maybeLength;
18127    }
18128
18129    DecodeStream.call(this, maybeLength);
18130  }
18131
18132  AsciiHexStream.prototype = Object.create(DecodeStream.prototype);
18133
18134  AsciiHexStream.prototype.readBlock = function AsciiHexStream_readBlock() {
18135    var UPSTREAM_BLOCK_SIZE = 8000;
18136    var bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
18137
18138    if (!bytes.length) {
18139      this.eof = true;
18140      return;
18141    }
18142
18143    var maxDecodeLength = bytes.length + 1 >> 1;
18144    var buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
18145    var bufferLength = this.bufferLength;
18146    var firstDigit = this.firstDigit;
18147
18148    for (var i = 0, ii = bytes.length; i < ii; i++) {
18149      var ch = bytes[i],
18150          digit;
18151
18152      if (ch >= 0x30 && ch <= 0x39) {
18153        digit = ch & 0x0F;
18154      } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
18155        digit = (ch & 0x0F) + 9;
18156      } else if (ch === 0x3E) {
18157        this.eof = true;
18158        break;
18159      } else {
18160        continue;
18161      }
18162
18163      if (firstDigit < 0) {
18164        firstDigit = digit;
18165      } else {
18166        buffer[bufferLength++] = firstDigit << 4 | digit;
18167        firstDigit = -1;
18168      }
18169    }
18170
18171    if (firstDigit >= 0 && this.eof) {
18172      buffer[bufferLength++] = firstDigit << 4;
18173      firstDigit = -1;
18174    }
18175
18176    this.firstDigit = firstDigit;
18177    this.bufferLength = bufferLength;
18178  };
18179
18180  return AsciiHexStream;
18181}();
18182
18183exports.AsciiHexStream = AsciiHexStream;
18184
18185var RunLengthStream = function RunLengthStreamClosure() {
18186  function RunLengthStream(str, maybeLength) {
18187    this.str = str;
18188    this.dict = str.dict;
18189    DecodeStream.call(this, maybeLength);
18190  }
18191
18192  RunLengthStream.prototype = Object.create(DecodeStream.prototype);
18193
18194  RunLengthStream.prototype.readBlock = function RunLengthStream_readBlock() {
18195    var repeatHeader = this.str.getBytes(2);
18196
18197    if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
18198      this.eof = true;
18199      return;
18200    }
18201
18202    var buffer;
18203    var bufferLength = this.bufferLength;
18204    var n = repeatHeader[0];
18205
18206    if (n < 128) {
18207      buffer = this.ensureBuffer(bufferLength + n + 1);
18208      buffer[bufferLength++] = repeatHeader[1];
18209
18210      if (n > 0) {
18211        var source = this.str.getBytes(n);
18212        buffer.set(source, bufferLength);
18213        bufferLength += n;
18214      }
18215    } else {
18216      n = 257 - n;
18217      var b = repeatHeader[1];
18218      buffer = this.ensureBuffer(bufferLength + n + 1);
18219
18220      for (var i = 0; i < n; i++) {
18221        buffer[bufferLength++] = b;
18222      }
18223    }
18224
18225    this.bufferLength = bufferLength;
18226  };
18227
18228  return RunLengthStream;
18229}();
18230
18231exports.RunLengthStream = RunLengthStream;
18232
18233var LZWStream = function LZWStreamClosure() {
18234  function LZWStream(str, maybeLength, earlyChange) {
18235    this.str = str;
18236    this.dict = str.dict;
18237    this.cachedData = 0;
18238    this.bitsCached = 0;
18239    var maxLzwDictionarySize = 4096;
18240    var lzwState = {
18241      earlyChange: earlyChange,
18242      codeLength: 9,
18243      nextCode: 258,
18244      dictionaryValues: new Uint8Array(maxLzwDictionarySize),
18245      dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
18246      dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
18247      currentSequence: new Uint8Array(maxLzwDictionarySize),
18248      currentSequenceLength: 0
18249    };
18250
18251    for (var i = 0; i < 256; ++i) {
18252      lzwState.dictionaryValues[i] = i;
18253      lzwState.dictionaryLengths[i] = 1;
18254    }
18255
18256    this.lzwState = lzwState;
18257    DecodeStream.call(this, maybeLength);
18258  }
18259
18260  LZWStream.prototype = Object.create(DecodeStream.prototype);
18261
18262  LZWStream.prototype.readBits = function LZWStream_readBits(n) {
18263    var bitsCached = this.bitsCached;
18264    var cachedData = this.cachedData;
18265
18266    while (bitsCached < n) {
18267      var c = this.str.getByte();
18268
18269      if (c === -1) {
18270        this.eof = true;
18271        return null;
18272      }
18273
18274      cachedData = cachedData << 8 | c;
18275      bitsCached += 8;
18276    }
18277
18278    this.bitsCached = bitsCached -= n;
18279    this.cachedData = cachedData;
18280    this.lastCode = null;
18281    return cachedData >>> bitsCached & (1 << n) - 1;
18282  };
18283
18284  LZWStream.prototype.readBlock = function LZWStream_readBlock() {
18285    var blockSize = 512;
18286    var estimatedDecodedSize = blockSize * 2,
18287        decodedSizeDelta = blockSize;
18288    var i, j, q;
18289    var lzwState = this.lzwState;
18290
18291    if (!lzwState) {
18292      return;
18293    }
18294
18295    var earlyChange = lzwState.earlyChange;
18296    var nextCode = lzwState.nextCode;
18297    var dictionaryValues = lzwState.dictionaryValues;
18298    var dictionaryLengths = lzwState.dictionaryLengths;
18299    var dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
18300    var codeLength = lzwState.codeLength;
18301    var prevCode = lzwState.prevCode;
18302    var currentSequence = lzwState.currentSequence;
18303    var currentSequenceLength = lzwState.currentSequenceLength;
18304    var decodedLength = 0;
18305    var currentBufferLength = this.bufferLength;
18306    var buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
18307
18308    for (i = 0; i < blockSize; i++) {
18309      var code = this.readBits(codeLength);
18310      var hasPrev = currentSequenceLength > 0;
18311
18312      if (code < 256) {
18313        currentSequence[0] = code;
18314        currentSequenceLength = 1;
18315      } else if (code >= 258) {
18316        if (code < nextCode) {
18317          currentSequenceLength = dictionaryLengths[code];
18318
18319          for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
18320            currentSequence[j] = dictionaryValues[q];
18321            q = dictionaryPrevCodes[q];
18322          }
18323        } else {
18324          currentSequence[currentSequenceLength++] = currentSequence[0];
18325        }
18326      } else if (code === 256) {
18327        codeLength = 9;
18328        nextCode = 258;
18329        currentSequenceLength = 0;
18330        continue;
18331      } else {
18332        this.eof = true;
18333        delete this.lzwState;
18334        break;
18335      }
18336
18337      if (hasPrev) {
18338        dictionaryPrevCodes[nextCode] = prevCode;
18339        dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
18340        dictionaryValues[nextCode] = currentSequence[0];
18341        nextCode++;
18342        codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
18343      }
18344
18345      prevCode = code;
18346      decodedLength += currentSequenceLength;
18347
18348      if (estimatedDecodedSize < decodedLength) {
18349        do {
18350          estimatedDecodedSize += decodedSizeDelta;
18351        } while (estimatedDecodedSize < decodedLength);
18352
18353        buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
18354      }
18355
18356      for (j = 0; j < currentSequenceLength; j++) {
18357        buffer[currentBufferLength++] = currentSequence[j];
18358      }
18359    }
18360
18361    lzwState.nextCode = nextCode;
18362    lzwState.codeLength = codeLength;
18363    lzwState.prevCode = prevCode;
18364    lzwState.currentSequenceLength = currentSequenceLength;
18365    this.bufferLength = currentBufferLength;
18366  };
18367
18368  return LZWStream;
18369}();
18370
18371exports.LZWStream = LZWStream;
18372
18373var NullStream = function NullStreamClosure() {
18374  function NullStream() {
18375    Stream.call(this, new Uint8Array(0));
18376  }
18377
18378  NullStream.prototype = Stream.prototype;
18379  return NullStream;
18380}();
18381
18382exports.NullStream = NullStream;
18383
18384/***/ }),
18385/* 159 */
18386/***/ (function(module, exports, __w_pdfjs_require__) {
18387
18388"use strict";
18389
18390
18391Object.defineProperty(exports, "__esModule", {
18392  value: true
18393});
18394exports.CCITTFaxStream = void 0;
18395
18396var _primitives = __w_pdfjs_require__(151);
18397
18398var _ccitt = __w_pdfjs_require__(160);
18399
18400var _stream = __w_pdfjs_require__(158);
18401
18402var CCITTFaxStream = function CCITTFaxStreamClosure() {
18403  function CCITTFaxStream(str, maybeLength, params) {
18404    this.str = str;
18405    this.dict = str.dict;
18406
18407    if (!(0, _primitives.isDict)(params)) {
18408      params = _primitives.Dict.empty;
18409    }
18410
18411    var source = {
18412      next: function next() {
18413        return str.getByte();
18414      }
18415    };
18416    this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, {
18417      K: params.get('K'),
18418      EndOfLine: params.get('EndOfLine'),
18419      EncodedByteAlign: params.get('EncodedByteAlign'),
18420      Columns: params.get('Columns'),
18421      Rows: params.get('Rows'),
18422      EndOfBlock: params.get('EndOfBlock'),
18423      BlackIs1: params.get('BlackIs1')
18424    });
18425
18426    _stream.DecodeStream.call(this, maybeLength);
18427  }
18428
18429  CCITTFaxStream.prototype = Object.create(_stream.DecodeStream.prototype);
18430
18431  CCITTFaxStream.prototype.readBlock = function () {
18432    while (!this.eof) {
18433      var c = this.ccittFaxDecoder.readNextChar();
18434
18435      if (c === -1) {
18436        this.eof = true;
18437        return;
18438      }
18439
18440      this.ensureBuffer(this.bufferLength + 1);
18441      this.buffer[this.bufferLength++] = c;
18442    }
18443  };
18444
18445  return CCITTFaxStream;
18446}();
18447
18448exports.CCITTFaxStream = CCITTFaxStream;
18449
18450/***/ }),
18451/* 160 */
18452/***/ (function(module, exports, __w_pdfjs_require__) {
18453
18454"use strict";
18455
18456
18457Object.defineProperty(exports, "__esModule", {
18458  value: true
18459});
18460exports.CCITTFaxDecoder = void 0;
18461
18462var _util = __w_pdfjs_require__(5);
18463
18464var CCITTFaxDecoder = function CCITTFaxDecoder() {
18465  var ccittEOL = -2;
18466  var ccittEOF = -1;
18467  var twoDimPass = 0;
18468  var twoDimHoriz = 1;
18469  var twoDimVert0 = 2;
18470  var twoDimVertR1 = 3;
18471  var twoDimVertL1 = 4;
18472  var twoDimVertR2 = 5;
18473  var twoDimVertL2 = 6;
18474  var twoDimVertR3 = 7;
18475  var twoDimVertL3 = 8;
18476  var twoDimTable = [[-1, -1], [-1, -1], [7, twoDimVertL3], [7, twoDimVertR3], [6, twoDimVertL2], [6, twoDimVertL2], [6, twoDimVertR2], [6, twoDimVertR2], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0]];
18477  var whiteTable1 = [[-1, -1], [12, ccittEOL], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [11, 1792], [11, 1792], [12, 1984], [12, 2048], [12, 2112], [12, 2176], [12, 2240], [12, 2304], [11, 1856], [11, 1856], [11, 1920], [11, 1920], [12, 2368], [12, 2432], [12, 2496], [12, 2560]];
18478  var whiteTable2 = [[-1, -1], [-1, -1], [-1, -1], [-1, -1], [8, 29], [8, 29], [8, 30], [8, 30], [8, 45], [8, 45], [8, 46], [8, 46], [7, 22], [7, 22], [7, 22], [7, 22], [7, 23], [7, 23], [7, 23], [7, 23], [8, 47], [8, 47], [8, 48], [8, 48], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [7, 20], [7, 20], [7, 20], [7, 20], [8, 33], [8, 33], [8, 34], [8, 34], [8, 35], [8, 35], [8, 36], [8, 36], [8, 37], [8, 37], [8, 38], [8, 38], [7, 19], [7, 19], [7, 19], [7, 19], [8, 31], [8, 31], [8, 32], [8, 32], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [8, 53], [8, 53], [8, 54], [8, 54], [7, 26], [7, 26], [7, 26], [7, 26], [8, 39], [8, 39], [8, 40], [8, 40], [8, 41], [8, 41], [8, 42], [8, 42], [8, 43], [8, 43], [8, 44], [8, 44], [7, 21], [7, 21], [7, 21], [7, 21], [7, 28], [7, 28], [7, 28], [7, 28], [8, 61], [8, 61], [8, 62], [8, 62], [8, 63], [8, 63], [8, 0], [8, 0], [8, 320], [8, 320], [8, 384], [8, 384], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [7, 27], [7, 27], [7, 27], [7, 27], [8, 59], [8, 59], [8, 60], [8, 60], [9, 1472], [9, 1536], [9, 1600], [9, 1728], [7, 18], [7, 18], [7, 18], [7, 18], [7, 24], [7, 24], [7, 24], [7, 24], [8, 49], [8, 49], [8, 50], [8, 50], [8, 51], [8, 51], [8, 52], [8, 52], [7, 25], [7, 25], [7, 25], [7, 25], [8, 55], [8, 55], [8, 56], [8, 56], [8, 57], [8, 57], [8, 58], [8, 58], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [8, 448], [8, 448], [8, 512], [8, 512], [9, 704], [9, 768], [8, 640], [8, 640], [8, 576], [8, 576], [9, 832], [9, 896], [9, 960], [9, 1024], [9, 1088], [9, 1152], [9, 1216], [9, 1280], [9, 1344], [9, 1408], [7, 256], [7, 256], [7, 256], [7, 256], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7]];
18479  var blackTable1 = [[-1, -1], [-1, -1], [12, ccittEOL], [12, ccittEOL], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [11, 1792], [11, 1792], [11, 1792], [11, 1792], [12, 1984], [12, 1984], [12, 2048], [12, 2048], [12, 2112], [12, 2112], [12, 2176], [12, 2176], [12, 2240], [12, 2240], [12, 2304], [12, 2304], [11, 1856], [11, 1856], [11, 1856], [11, 1856], [11, 1920], [11, 1920], [11, 1920], [11, 1920], [12, 2368], [12, 2368], [12, 2432], [12, 2432], [12, 2496], [12, 2496], [12, 2560], [12, 2560], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [12, 52], [12, 52], [13, 640], [13, 704], [13, 768], [13, 832], [12, 55], [12, 55], [12, 56], [12, 56], [13, 1280], [13, 1344], [13, 1408], [13, 1472], [12, 59], [12, 59], [12, 60], [12, 60], [13, 1536], [13, 1600], [11, 24], [11, 24], [11, 24], [11, 24], [11, 25], [11, 25], [11, 25], [11, 25], [13, 1664], [13, 1728], [12, 320], [12, 320], [12, 384], [12, 384], [12, 448], [12, 448], [13, 512], [13, 576], [12, 53], [12, 53], [12, 54], [12, 54], [13, 896], [13, 960], [13, 1024], [13, 1088], [13, 1152], [13, 1216], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64]];
18480  var blackTable2 = [[8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [11, 23], [11, 23], [12, 50], [12, 51], [12, 44], [12, 45], [12, 46], [12, 47], [12, 57], [12, 58], [12, 61], [12, 256], [10, 16], [10, 16], [10, 16], [10, 16], [10, 17], [10, 17], [10, 17], [10, 17], [12, 48], [12, 49], [12, 62], [12, 63], [12, 30], [12, 31], [12, 32], [12, 33], [12, 40], [12, 41], [11, 22], [11, 22], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [12, 128], [12, 192], [12, 26], [12, 27], [12, 28], [12, 29], [11, 19], [11, 19], [11, 20], [11, 20], [12, 34], [12, 35], [12, 36], [12, 37], [12, 38], [12, 39], [11, 21], [11, 21], [12, 42], [12, 43], [10, 0], [10, 0], [10, 0], [10, 0], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12]];
18481  var blackTable3 = [[-1, -1], [-1, -1], [-1, -1], [-1, -1], [6, 9], [6, 8], [5, 7], [5, 7], [4, 6], [4, 6], [4, 6], [4, 6], [4, 5], [4, 5], [4, 5], [4, 5], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2]];
18482
18483  function CCITTFaxDecoder(source) {
18484    var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
18485
18486    if (!source || typeof source.next !== 'function') {
18487      throw new Error('CCITTFaxDecoder - invalid "source" parameter.');
18488    }
18489
18490    this.source = source;
18491    this.eof = false;
18492    this.encoding = options['K'] || 0;
18493    this.eoline = options['EndOfLine'] || false;
18494    this.byteAlign = options['EncodedByteAlign'] || false;
18495    this.columns = options['Columns'] || 1728;
18496    this.rows = options['Rows'] || 0;
18497    var eoblock = options['EndOfBlock'];
18498
18499    if (eoblock === null || eoblock === undefined) {
18500      eoblock = true;
18501    }
18502
18503    this.eoblock = eoblock;
18504    this.black = options['BlackIs1'] || false;
18505    this.codingLine = new Uint32Array(this.columns + 1);
18506    this.refLine = new Uint32Array(this.columns + 2);
18507    this.codingLine[0] = this.columns;
18508    this.codingPos = 0;
18509    this.row = 0;
18510    this.nextLine2D = this.encoding < 0;
18511    this.inputBits = 0;
18512    this.inputBuf = 0;
18513    this.outputBits = 0;
18514    this.rowsDone = false;
18515    var code1;
18516
18517    while ((code1 = this._lookBits(12)) === 0) {
18518      this._eatBits(1);
18519    }
18520
18521    if (code1 === 1) {
18522      this._eatBits(12);
18523    }
18524
18525    if (this.encoding > 0) {
18526      this.nextLine2D = !this._lookBits(1);
18527
18528      this._eatBits(1);
18529    }
18530  }
18531
18532  CCITTFaxDecoder.prototype = {
18533    readNextChar: function readNextChar() {
18534      if (this.eof) {
18535        return -1;
18536      }
18537
18538      var refLine = this.refLine;
18539      var codingLine = this.codingLine;
18540      var columns = this.columns;
18541      var refPos, blackPixels, bits, i;
18542
18543      if (this.outputBits === 0) {
18544        if (this.rowsDone) {
18545          this.eof = true;
18546        }
18547
18548        if (this.eof) {
18549          return -1;
18550        }
18551
18552        this.err = false;
18553        var code1, code2, code3;
18554
18555        if (this.nextLine2D) {
18556          for (i = 0; codingLine[i] < columns; ++i) {
18557            refLine[i] = codingLine[i];
18558          }
18559
18560          refLine[i++] = columns;
18561          refLine[i] = columns;
18562          codingLine[0] = 0;
18563          this.codingPos = 0;
18564          refPos = 0;
18565          blackPixels = 0;
18566
18567          while (codingLine[this.codingPos] < columns) {
18568            code1 = this._getTwoDimCode();
18569
18570            switch (code1) {
18571              case twoDimPass:
18572                this._addPixels(refLine[refPos + 1], blackPixels);
18573
18574                if (refLine[refPos + 1] < columns) {
18575                  refPos += 2;
18576                }
18577
18578                break;
18579
18580              case twoDimHoriz:
18581                code1 = code2 = 0;
18582
18583                if (blackPixels) {
18584                  do {
18585                    code1 += code3 = this._getBlackCode();
18586                  } while (code3 >= 64);
18587
18588                  do {
18589                    code2 += code3 = this._getWhiteCode();
18590                  } while (code3 >= 64);
18591                } else {
18592                  do {
18593                    code1 += code3 = this._getWhiteCode();
18594                  } while (code3 >= 64);
18595
18596                  do {
18597                    code2 += code3 = this._getBlackCode();
18598                  } while (code3 >= 64);
18599                }
18600
18601                this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
18602
18603                if (codingLine[this.codingPos] < columns) {
18604                  this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
18605                }
18606
18607                while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
18608                  refPos += 2;
18609                }
18610
18611                break;
18612
18613              case twoDimVertR3:
18614                this._addPixels(refLine[refPos] + 3, blackPixels);
18615
18616                blackPixels ^= 1;
18617
18618                if (codingLine[this.codingPos] < columns) {
18619                  ++refPos;
18620
18621                  while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
18622                    refPos += 2;
18623                  }
18624                }
18625
18626                break;
18627
18628              case twoDimVertR2:
18629                this._addPixels(refLine[refPos] + 2, blackPixels);
18630
18631                blackPixels ^= 1;
18632
18633                if (codingLine[this.codingPos] < columns) {
18634                  ++refPos;
18635
18636                  while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
18637                    refPos += 2;
18638                  }
18639                }
18640
18641                break;
18642
18643              case twoDimVertR1:
18644                this._addPixels(refLine[refPos] + 1, blackPixels);
18645
18646                blackPixels ^= 1;
18647
18648                if (codingLine[this.codingPos] < columns) {
18649                  ++refPos;
18650
18651                  while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
18652                    refPos += 2;
18653                  }
18654                }
18655
18656                break;
18657
18658              case twoDimVert0:
18659                this._addPixels(refLine[refPos], blackPixels);
18660
18661                blackPixels ^= 1;
18662
18663                if (codingLine[this.codingPos] < columns) {
18664                  ++refPos;
18665
18666                  while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
18667                    refPos += 2;
18668                  }
18669                }
18670
18671                break;
18672
18673              case twoDimVertL3:
18674                this._addPixelsNeg(refLine[refPos] - 3, blackPixels);
18675
18676                blackPixels ^= 1;
18677
18678                if (codingLine[this.codingPos] < columns) {
18679                  if (refPos > 0) {
18680                    --refPos;
18681                  } else {
18682                    ++refPos;
18683                  }
18684
18685                  while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
18686                    refPos += 2;
18687                  }
18688                }
18689
18690                break;
18691
18692              case twoDimVertL2:
18693                this._addPixelsNeg(refLine[refPos] - 2, blackPixels);
18694
18695                blackPixels ^= 1;
18696
18697                if (codingLine[this.codingPos] < columns) {
18698                  if (refPos > 0) {
18699                    --refPos;
18700                  } else {
18701                    ++refPos;
18702                  }
18703
18704                  while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
18705                    refPos += 2;
18706                  }
18707                }
18708
18709                break;
18710
18711              case twoDimVertL1:
18712                this._addPixelsNeg(refLine[refPos] - 1, blackPixels);
18713
18714                blackPixels ^= 1;
18715
18716                if (codingLine[this.codingPos] < columns) {
18717                  if (refPos > 0) {
18718                    --refPos;
18719                  } else {
18720                    ++refPos;
18721                  }
18722
18723                  while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
18724                    refPos += 2;
18725                  }
18726                }
18727
18728                break;
18729
18730              case ccittEOF:
18731                this._addPixels(columns, 0);
18732
18733                this.eof = true;
18734                break;
18735
18736              default:
18737                (0, _util.info)('bad 2d code');
18738
18739                this._addPixels(columns, 0);
18740
18741                this.err = true;
18742            }
18743          }
18744        } else {
18745          codingLine[0] = 0;
18746          this.codingPos = 0;
18747          blackPixels = 0;
18748
18749          while (codingLine[this.codingPos] < columns) {
18750            code1 = 0;
18751
18752            if (blackPixels) {
18753              do {
18754                code1 += code3 = this._getBlackCode();
18755              } while (code3 >= 64);
18756            } else {
18757              do {
18758                code1 += code3 = this._getWhiteCode();
18759              } while (code3 >= 64);
18760            }
18761
18762            this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
18763
18764            blackPixels ^= 1;
18765          }
18766        }
18767
18768        var gotEOL = false;
18769
18770        if (this.byteAlign) {
18771          this.inputBits &= ~7;
18772        }
18773
18774        if (!this.eoblock && this.row === this.rows - 1) {
18775          this.rowsDone = true;
18776        } else {
18777          code1 = this._lookBits(12);
18778
18779          if (this.eoline) {
18780            while (code1 !== ccittEOF && code1 !== 1) {
18781              this._eatBits(1);
18782
18783              code1 = this._lookBits(12);
18784            }
18785          } else {
18786            while (code1 === 0) {
18787              this._eatBits(1);
18788
18789              code1 = this._lookBits(12);
18790            }
18791          }
18792
18793          if (code1 === 1) {
18794            this._eatBits(12);
18795
18796            gotEOL = true;
18797          } else if (code1 === ccittEOF) {
18798            this.eof = true;
18799          }
18800        }
18801
18802        if (!this.eof && this.encoding > 0 && !this.rowsDone) {
18803          this.nextLine2D = !this._lookBits(1);
18804
18805          this._eatBits(1);
18806        }
18807
18808        if (this.eoblock && gotEOL && this.byteAlign) {
18809          code1 = this._lookBits(12);
18810
18811          if (code1 === 1) {
18812            this._eatBits(12);
18813
18814            if (this.encoding > 0) {
18815              this._lookBits(1);
18816
18817              this._eatBits(1);
18818            }
18819
18820            if (this.encoding >= 0) {
18821              for (i = 0; i < 4; ++i) {
18822                code1 = this._lookBits(12);
18823
18824                if (code1 !== 1) {
18825                  (0, _util.info)('bad rtc code: ' + code1);
18826                }
18827
18828                this._eatBits(12);
18829
18830                if (this.encoding > 0) {
18831                  this._lookBits(1);
18832
18833                  this._eatBits(1);
18834                }
18835              }
18836            }
18837
18838            this.eof = true;
18839          }
18840        } else if (this.err && this.eoline) {
18841          while (true) {
18842            code1 = this._lookBits(13);
18843
18844            if (code1 === ccittEOF) {
18845              this.eof = true;
18846              return -1;
18847            }
18848
18849            if (code1 >> 1 === 1) {
18850              break;
18851            }
18852
18853            this._eatBits(1);
18854          }
18855
18856          this._eatBits(12);
18857
18858          if (this.encoding > 0) {
18859            this._eatBits(1);
18860
18861            this.nextLine2D = !(code1 & 1);
18862          }
18863        }
18864
18865        if (codingLine[0] > 0) {
18866          this.outputBits = codingLine[this.codingPos = 0];
18867        } else {
18868          this.outputBits = codingLine[this.codingPos = 1];
18869        }
18870
18871        this.row++;
18872      }
18873
18874      var c;
18875
18876      if (this.outputBits >= 8) {
18877        c = this.codingPos & 1 ? 0 : 0xFF;
18878        this.outputBits -= 8;
18879
18880        if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
18881          this.codingPos++;
18882          this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
18883        }
18884      } else {
18885        bits = 8;
18886        c = 0;
18887
18888        do {
18889          if (this.outputBits > bits) {
18890            c <<= bits;
18891
18892            if (!(this.codingPos & 1)) {
18893              c |= 0xFF >> 8 - bits;
18894            }
18895
18896            this.outputBits -= bits;
18897            bits = 0;
18898          } else {
18899            c <<= this.outputBits;
18900
18901            if (!(this.codingPos & 1)) {
18902              c |= 0xFF >> 8 - this.outputBits;
18903            }
18904
18905            bits -= this.outputBits;
18906            this.outputBits = 0;
18907
18908            if (codingLine[this.codingPos] < columns) {
18909              this.codingPos++;
18910              this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
18911            } else if (bits > 0) {
18912              c <<= bits;
18913              bits = 0;
18914            }
18915          }
18916        } while (bits);
18917      }
18918
18919      if (this.black) {
18920        c ^= 0xFF;
18921      }
18922
18923      return c;
18924    },
18925    _addPixels: function _addPixels(a1, blackPixels) {
18926      var codingLine = this.codingLine;
18927      var codingPos = this.codingPos;
18928
18929      if (a1 > codingLine[codingPos]) {
18930        if (a1 > this.columns) {
18931          (0, _util.info)('row is wrong length');
18932          this.err = true;
18933          a1 = this.columns;
18934        }
18935
18936        if (codingPos & 1 ^ blackPixels) {
18937          ++codingPos;
18938        }
18939
18940        codingLine[codingPos] = a1;
18941      }
18942
18943      this.codingPos = codingPos;
18944    },
18945    _addPixelsNeg: function _addPixelsNeg(a1, blackPixels) {
18946      var codingLine = this.codingLine;
18947      var codingPos = this.codingPos;
18948
18949      if (a1 > codingLine[codingPos]) {
18950        if (a1 > this.columns) {
18951          (0, _util.info)('row is wrong length');
18952          this.err = true;
18953          a1 = this.columns;
18954        }
18955
18956        if (codingPos & 1 ^ blackPixels) {
18957          ++codingPos;
18958        }
18959
18960        codingLine[codingPos] = a1;
18961      } else if (a1 < codingLine[codingPos]) {
18962        if (a1 < 0) {
18963          (0, _util.info)('invalid code');
18964          this.err = true;
18965          a1 = 0;
18966        }
18967
18968        while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
18969          --codingPos;
18970        }
18971
18972        codingLine[codingPos] = a1;
18973      }
18974
18975      this.codingPos = codingPos;
18976    },
18977    _findTableCode: function _findTableCode(start, end, table, limit) {
18978      var limitValue = limit || 0;
18979
18980      for (var i = start; i <= end; ++i) {
18981        var code = this._lookBits(i);
18982
18983        if (code === ccittEOF) {
18984          return [true, 1, false];
18985        }
18986
18987        if (i < end) {
18988          code <<= end - i;
18989        }
18990
18991        if (!limitValue || code >= limitValue) {
18992          var p = table[code - limitValue];
18993
18994          if (p[0] === i) {
18995            this._eatBits(i);
18996
18997            return [true, p[1], true];
18998          }
18999        }
19000      }
19001
19002      return [false, 0, false];
19003    },
19004    _getTwoDimCode: function _getTwoDimCode() {
19005      var code = 0;
19006      var p;
19007
19008      if (this.eoblock) {
19009        code = this._lookBits(7);
19010        p = twoDimTable[code];
19011
19012        if (p && p[0] > 0) {
19013          this._eatBits(p[0]);
19014
19015          return p[1];
19016        }
19017      } else {
19018        var result = this._findTableCode(1, 7, twoDimTable);
19019
19020        if (result[0] && result[2]) {
19021          return result[1];
19022        }
19023      }
19024
19025      (0, _util.info)('Bad two dim code');
19026      return ccittEOF;
19027    },
19028    _getWhiteCode: function _getWhiteCode() {
19029      var code = 0;
19030      var p;
19031
19032      if (this.eoblock) {
19033        code = this._lookBits(12);
19034
19035        if (code === ccittEOF) {
19036          return 1;
19037        }
19038
19039        if (code >> 5 === 0) {
19040          p = whiteTable1[code];
19041        } else {
19042          p = whiteTable2[code >> 3];
19043        }
19044
19045        if (p[0] > 0) {
19046          this._eatBits(p[0]);
19047
19048          return p[1];
19049        }
19050      } else {
19051        var result = this._findTableCode(1, 9, whiteTable2);
19052
19053        if (result[0]) {
19054          return result[1];
19055        }
19056
19057        result = this._findTableCode(11, 12, whiteTable1);
19058
19059        if (result[0]) {
19060          return result[1];
19061        }
19062      }
19063
19064      (0, _util.info)('bad white code');
19065
19066      this._eatBits(1);
19067
19068      return 1;
19069    },
19070    _getBlackCode: function _getBlackCode() {
19071      var code, p;
19072
19073      if (this.eoblock) {
19074        code = this._lookBits(13);
19075
19076        if (code === ccittEOF) {
19077          return 1;
19078        }
19079
19080        if (code >> 7 === 0) {
19081          p = blackTable1[code];
19082        } else if (code >> 9 === 0 && code >> 7 !== 0) {
19083          p = blackTable2[(code >> 1) - 64];
19084        } else {
19085          p = blackTable3[code >> 7];
19086        }
19087
19088        if (p[0] > 0) {
19089          this._eatBits(p[0]);
19090
19091          return p[1];
19092        }
19093      } else {
19094        var result = this._findTableCode(2, 6, blackTable3);
19095
19096        if (result[0]) {
19097          return result[1];
19098        }
19099
19100        result = this._findTableCode(7, 12, blackTable2, 64);
19101
19102        if (result[0]) {
19103          return result[1];
19104        }
19105
19106        result = this._findTableCode(10, 13, blackTable1);
19107
19108        if (result[0]) {
19109          return result[1];
19110        }
19111      }
19112
19113      (0, _util.info)('bad black code');
19114
19115      this._eatBits(1);
19116
19117      return 1;
19118    },
19119    _lookBits: function _lookBits(n) {
19120      var c;
19121
19122      while (this.inputBits < n) {
19123        if ((c = this.source.next()) === -1) {
19124          if (this.inputBits === 0) {
19125            return ccittEOF;
19126          }
19127
19128          return this.inputBuf << n - this.inputBits & 0xFFFF >> 16 - n;
19129        }
19130
19131        this.inputBuf = this.inputBuf << 8 | c;
19132        this.inputBits += 8;
19133      }
19134
19135      return this.inputBuf >> this.inputBits - n & 0xFFFF >> 16 - n;
19136    },
19137    _eatBits: function _eatBits(n) {
19138      if ((this.inputBits -= n) < 0) {
19139        this.inputBits = 0;
19140      }
19141    }
19142  };
19143  return CCITTFaxDecoder;
19144}();
19145
19146exports.CCITTFaxDecoder = CCITTFaxDecoder;
19147
19148/***/ }),
19149/* 161 */
19150/***/ (function(module, exports, __w_pdfjs_require__) {
19151
19152"use strict";
19153
19154
19155Object.defineProperty(exports, "__esModule", {
19156  value: true
19157});
19158exports.Jbig2Stream = void 0;
19159
19160var _primitives = __w_pdfjs_require__(151);
19161
19162var _stream = __w_pdfjs_require__(158);
19163
19164var _jbig = __w_pdfjs_require__(162);
19165
19166var _util = __w_pdfjs_require__(5);
19167
19168var Jbig2Stream = function Jbig2StreamClosure() {
19169  function Jbig2Stream(stream, maybeLength, dict, params) {
19170    this.stream = stream;
19171    this.maybeLength = maybeLength;
19172    this.dict = dict;
19173    this.params = params;
19174
19175    _stream.DecodeStream.call(this, maybeLength);
19176  }
19177
19178  Jbig2Stream.prototype = Object.create(_stream.DecodeStream.prototype);
19179  Object.defineProperty(Jbig2Stream.prototype, 'bytes', {
19180    get: function get() {
19181      return (0, _util.shadow)(this, 'bytes', this.stream.getBytes(this.maybeLength));
19182    },
19183    configurable: true
19184  });
19185
19186  Jbig2Stream.prototype.ensureBuffer = function (requested) {};
19187
19188  Jbig2Stream.prototype.readBlock = function () {
19189    if (this.eof) {
19190      return;
19191    }
19192
19193    var jbig2Image = new _jbig.Jbig2Image();
19194    var chunks = [];
19195
19196    if ((0, _primitives.isDict)(this.params)) {
19197      var globalsStream = this.params.get('JBIG2Globals');
19198
19199      if ((0, _primitives.isStream)(globalsStream)) {
19200        var globals = globalsStream.getBytes();
19201        chunks.push({
19202          data: globals,
19203          start: 0,
19204          end: globals.length
19205        });
19206      }
19207    }
19208
19209    chunks.push({
19210      data: this.bytes,
19211      start: 0,
19212      end: this.bytes.length
19213    });
19214    var data = jbig2Image.parseChunks(chunks);
19215    var dataLength = data.length;
19216
19217    for (var i = 0; i < dataLength; i++) {
19218      data[i] ^= 0xFF;
19219    }
19220
19221    this.buffer = data;
19222    this.bufferLength = dataLength;
19223    this.eof = true;
19224  };
19225
19226  return Jbig2Stream;
19227}();
19228
19229exports.Jbig2Stream = Jbig2Stream;
19230
19231/***/ }),
19232/* 162 */
19233/***/ (function(module, exports, __w_pdfjs_require__) {
19234
19235"use strict";
19236
19237
19238Object.defineProperty(exports, "__esModule", {
19239  value: true
19240});
19241exports.Jbig2Image = void 0;
19242
19243var _util = __w_pdfjs_require__(5);
19244
19245var _arithmetic_decoder = __w_pdfjs_require__(163);
19246
19247var _ccitt = __w_pdfjs_require__(160);
19248
19249var Jbig2Error = function Jbig2ErrorClosure() {
19250  function Jbig2Error(msg) {
19251    this.message = 'JBIG2 error: ' + msg;
19252  }
19253
19254  Jbig2Error.prototype = new Error();
19255  Jbig2Error.prototype.name = 'Jbig2Error';
19256  Jbig2Error.constructor = Jbig2Error;
19257  return Jbig2Error;
19258}();
19259
19260var Jbig2Image = function Jbig2ImageClosure() {
19261  function ContextCache() {}
19262
19263  ContextCache.prototype = {
19264    getContexts: function getContexts(id) {
19265      if (id in this) {
19266        return this[id];
19267      }
19268
19269      return this[id] = new Int8Array(1 << 16);
19270    }
19271  };
19272
19273  function DecodingContext(data, start, end) {
19274    this.data = data;
19275    this.start = start;
19276    this.end = end;
19277  }
19278
19279  DecodingContext.prototype = {
19280    get decoder() {
19281      var decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end);
19282      return (0, _util.shadow)(this, 'decoder', decoder);
19283    },
19284
19285    get contextCache() {
19286      var cache = new ContextCache();
19287      return (0, _util.shadow)(this, 'contextCache', cache);
19288    }
19289
19290  };
19291
19292  function decodeInteger(contextCache, procedure, decoder) {
19293    var contexts = contextCache.getContexts(procedure);
19294    var prev = 1;
19295
19296    function readBits(length) {
19297      var v = 0;
19298
19299      for (var i = 0; i < length; i++) {
19300        var bit = decoder.readBit(contexts, prev);
19301        prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
19302        v = v << 1 | bit;
19303      }
19304
19305      return v >>> 0;
19306    }
19307
19308    var sign = readBits(1);
19309    var value = readBits(1) ? readBits(1) ? readBits(1) ? readBits(1) ? readBits(1) ? readBits(32) + 4436 : readBits(12) + 340 : readBits(8) + 84 : readBits(6) + 20 : readBits(4) + 4 : readBits(2);
19310    return sign === 0 ? value : value > 0 ? -value : null;
19311  }
19312
19313  function decodeIAID(contextCache, decoder, codeLength) {
19314    var contexts = contextCache.getContexts('IAID');
19315    var prev = 1;
19316
19317    for (var i = 0; i < codeLength; i++) {
19318      var bit = decoder.readBit(contexts, prev);
19319      prev = prev << 1 | bit;
19320    }
19321
19322    if (codeLength < 31) {
19323      return prev & (1 << codeLength) - 1;
19324    }
19325
19326    return prev & 0x7FFFFFFF;
19327  }
19328
19329  var SegmentTypes = ['SymbolDictionary', null, null, null, 'IntermediateTextRegion', null, 'ImmediateTextRegion', 'ImmediateLosslessTextRegion', null, null, null, null, null, null, null, null, 'PatternDictionary', null, null, null, 'IntermediateHalftoneRegion', null, 'ImmediateHalftoneRegion', 'ImmediateLosslessHalftoneRegion', null, null, null, null, null, null, null, null, null, null, null, null, 'IntermediateGenericRegion', null, 'ImmediateGenericRegion', 'ImmediateLosslessGenericRegion', 'IntermediateGenericRefinementRegion', null, 'ImmediateGenericRefinementRegion', 'ImmediateLosslessGenericRefinementRegion', null, null, null, null, 'PageInformation', 'EndOfPage', 'EndOfStripe', 'EndOfFile', 'Profiles', 'Tables', null, null, null, null, null, null, null, null, 'Extension'];
19330  var CodingTemplates = [[{
19331    x: -1,
19332    y: -2
19333  }, {
19334    x: 0,
19335    y: -2
19336  }, {
19337    x: 1,
19338    y: -2
19339  }, {
19340    x: -2,
19341    y: -1
19342  }, {
19343    x: -1,
19344    y: -1
19345  }, {
19346    x: 0,
19347    y: -1
19348  }, {
19349    x: 1,
19350    y: -1
19351  }, {
19352    x: 2,
19353    y: -1
19354  }, {
19355    x: -4,
19356    y: 0
19357  }, {
19358    x: -3,
19359    y: 0
19360  }, {
19361    x: -2,
19362    y: 0
19363  }, {
19364    x: -1,
19365    y: 0
19366  }], [{
19367    x: -1,
19368    y: -2
19369  }, {
19370    x: 0,
19371    y: -2
19372  }, {
19373    x: 1,
19374    y: -2
19375  }, {
19376    x: 2,
19377    y: -2
19378  }, {
19379    x: -2,
19380    y: -1
19381  }, {
19382    x: -1,
19383    y: -1
19384  }, {
19385    x: 0,
19386    y: -1
19387  }, {
19388    x: 1,
19389    y: -1
19390  }, {
19391    x: 2,
19392    y: -1
19393  }, {
19394    x: -3,
19395    y: 0
19396  }, {
19397    x: -2,
19398    y: 0
19399  }, {
19400    x: -1,
19401    y: 0
19402  }], [{
19403    x: -1,
19404    y: -2
19405  }, {
19406    x: 0,
19407    y: -2
19408  }, {
19409    x: 1,
19410    y: -2
19411  }, {
19412    x: -2,
19413    y: -1
19414  }, {
19415    x: -1,
19416    y: -1
19417  }, {
19418    x: 0,
19419    y: -1
19420  }, {
19421    x: 1,
19422    y: -1
19423  }, {
19424    x: -2,
19425    y: 0
19426  }, {
19427    x: -1,
19428    y: 0
19429  }], [{
19430    x: -3,
19431    y: -1
19432  }, {
19433    x: -2,
19434    y: -1
19435  }, {
19436    x: -1,
19437    y: -1
19438  }, {
19439    x: 0,
19440    y: -1
19441  }, {
19442    x: 1,
19443    y: -1
19444  }, {
19445    x: -4,
19446    y: 0
19447  }, {
19448    x: -3,
19449    y: 0
19450  }, {
19451    x: -2,
19452    y: 0
19453  }, {
19454    x: -1,
19455    y: 0
19456  }]];
19457  var RefinementTemplates = [{
19458    coding: [{
19459      x: 0,
19460      y: -1
19461    }, {
19462      x: 1,
19463      y: -1
19464    }, {
19465      x: -1,
19466      y: 0
19467    }],
19468    reference: [{
19469      x: 0,
19470      y: -1
19471    }, {
19472      x: 1,
19473      y: -1
19474    }, {
19475      x: -1,
19476      y: 0
19477    }, {
19478      x: 0,
19479      y: 0
19480    }, {
19481      x: 1,
19482      y: 0
19483    }, {
19484      x: -1,
19485      y: 1
19486    }, {
19487      x: 0,
19488      y: 1
19489    }, {
19490      x: 1,
19491      y: 1
19492    }]
19493  }, {
19494    coding: [{
19495      x: -1,
19496      y: -1
19497    }, {
19498      x: 0,
19499      y: -1
19500    }, {
19501      x: 1,
19502      y: -1
19503    }, {
19504      x: -1,
19505      y: 0
19506    }],
19507    reference: [{
19508      x: 0,
19509      y: -1
19510    }, {
19511      x: -1,
19512      y: 0
19513    }, {
19514      x: 0,
19515      y: 0
19516    }, {
19517      x: 1,
19518      y: 0
19519    }, {
19520      x: 0,
19521      y: 1
19522    }, {
19523      x: 1,
19524      y: 1
19525    }]
19526  }];
19527  var ReusedContexts = [0x9B25, 0x0795, 0x00E5, 0x0195];
19528  var RefinementReusedContexts = [0x0020, 0x0008];
19529
19530  function decodeBitmapTemplate0(width, height, decodingContext) {
19531    var decoder = decodingContext.decoder;
19532    var contexts = decodingContext.contextCache.getContexts('GB');
19533    var contextLabel,
19534        i,
19535        j,
19536        pixel,
19537        row,
19538        row1,
19539        row2,
19540        bitmap = [];
19541    var OLD_PIXEL_MASK = 0x7BF7;
19542
19543    for (i = 0; i < height; i++) {
19544      row = bitmap[i] = new Uint8Array(width);
19545      row1 = i < 1 ? row : bitmap[i - 1];
19546      row2 = i < 2 ? row : bitmap[i - 2];
19547      contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
19548
19549      for (j = 0; j < width; j++) {
19550        row[j] = pixel = decoder.readBit(contexts, contextLabel);
19551        contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
19552      }
19553    }
19554
19555    return bitmap;
19556  }
19557
19558  function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
19559    if (mmr) {
19560      var input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
19561      return decodeMMRBitmap(input, width, height, false);
19562    }
19563
19564    if (templateIndex === 0 && !skip && !prediction && at.length === 4 && at[0].x === 3 && at[0].y === -1 && at[1].x === -3 && at[1].y === -1 && at[2].x === 2 && at[2].y === -2 && at[3].x === -2 && at[3].y === -2) {
19565      return decodeBitmapTemplate0(width, height, decodingContext);
19566    }
19567
19568    var useskip = !!skip;
19569    var template = CodingTemplates[templateIndex].concat(at);
19570    template.sort(function (a, b) {
19571      return a.y - b.y || a.x - b.x;
19572    });
19573    var templateLength = template.length;
19574    var templateX = new Int8Array(templateLength);
19575    var templateY = new Int8Array(templateLength);
19576    var changingTemplateEntries = [];
19577    var reuseMask = 0,
19578        minX = 0,
19579        maxX = 0,
19580        minY = 0;
19581    var c, k;
19582
19583    for (k = 0; k < templateLength; k++) {
19584      templateX[k] = template[k].x;
19585      templateY[k] = template[k].y;
19586      minX = Math.min(minX, template[k].x);
19587      maxX = Math.max(maxX, template[k].x);
19588      minY = Math.min(minY, template[k].y);
19589
19590      if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
19591        reuseMask |= 1 << templateLength - 1 - k;
19592      } else {
19593        changingTemplateEntries.push(k);
19594      }
19595    }
19596
19597    var changingEntriesLength = changingTemplateEntries.length;
19598    var changingTemplateX = new Int8Array(changingEntriesLength);
19599    var changingTemplateY = new Int8Array(changingEntriesLength);
19600    var changingTemplateBit = new Uint16Array(changingEntriesLength);
19601
19602    for (c = 0; c < changingEntriesLength; c++) {
19603      k = changingTemplateEntries[c];
19604      changingTemplateX[c] = template[k].x;
19605      changingTemplateY[c] = template[k].y;
19606      changingTemplateBit[c] = 1 << templateLength - 1 - k;
19607    }
19608
19609    var sbb_left = -minX;
19610    var sbb_top = -minY;
19611    var sbb_right = width - maxX;
19612    var pseudoPixelContext = ReusedContexts[templateIndex];
19613    var row = new Uint8Array(width);
19614    var bitmap = [];
19615    var decoder = decodingContext.decoder;
19616    var contexts = decodingContext.contextCache.getContexts('GB');
19617    var ltp = 0,
19618        j,
19619        i0,
19620        j0,
19621        contextLabel = 0,
19622        bit,
19623        shift;
19624
19625    for (var i = 0; i < height; i++) {
19626      if (prediction) {
19627        var sltp = decoder.readBit(contexts, pseudoPixelContext);
19628        ltp ^= sltp;
19629
19630        if (ltp) {
19631          bitmap.push(row);
19632          continue;
19633        }
19634      }
19635
19636      row = new Uint8Array(row);
19637      bitmap.push(row);
19638
19639      for (j = 0; j < width; j++) {
19640        if (useskip && skip[i][j]) {
19641          row[j] = 0;
19642          continue;
19643        }
19644
19645        if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
19646          contextLabel = contextLabel << 1 & reuseMask;
19647
19648          for (k = 0; k < changingEntriesLength; k++) {
19649            i0 = i + changingTemplateY[k];
19650            j0 = j + changingTemplateX[k];
19651            bit = bitmap[i0][j0];
19652
19653            if (bit) {
19654              bit = changingTemplateBit[k];
19655              contextLabel |= bit;
19656            }
19657          }
19658        } else {
19659          contextLabel = 0;
19660          shift = templateLength - 1;
19661
19662          for (k = 0; k < templateLength; k++, shift--) {
19663            j0 = j + templateX[k];
19664
19665            if (j0 >= 0 && j0 < width) {
19666              i0 = i + templateY[k];
19667
19668              if (i0 >= 0) {
19669                bit = bitmap[i0][j0];
19670
19671                if (bit) {
19672                  contextLabel |= bit << shift;
19673                }
19674              }
19675            }
19676          }
19677        }
19678
19679        var pixel = decoder.readBit(contexts, contextLabel);
19680        row[j] = pixel;
19681      }
19682    }
19683
19684    return bitmap;
19685  }
19686
19687  function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
19688    var codingTemplate = RefinementTemplates[templateIndex].coding;
19689
19690    if (templateIndex === 0) {
19691      codingTemplate = codingTemplate.concat([at[0]]);
19692    }
19693
19694    var codingTemplateLength = codingTemplate.length;
19695    var codingTemplateX = new Int32Array(codingTemplateLength);
19696    var codingTemplateY = new Int32Array(codingTemplateLength);
19697    var k;
19698
19699    for (k = 0; k < codingTemplateLength; k++) {
19700      codingTemplateX[k] = codingTemplate[k].x;
19701      codingTemplateY[k] = codingTemplate[k].y;
19702    }
19703
19704    var referenceTemplate = RefinementTemplates[templateIndex].reference;
19705
19706    if (templateIndex === 0) {
19707      referenceTemplate = referenceTemplate.concat([at[1]]);
19708    }
19709
19710    var referenceTemplateLength = referenceTemplate.length;
19711    var referenceTemplateX = new Int32Array(referenceTemplateLength);
19712    var referenceTemplateY = new Int32Array(referenceTemplateLength);
19713
19714    for (k = 0; k < referenceTemplateLength; k++) {
19715      referenceTemplateX[k] = referenceTemplate[k].x;
19716      referenceTemplateY[k] = referenceTemplate[k].y;
19717    }
19718
19719    var referenceWidth = referenceBitmap[0].length;
19720    var referenceHeight = referenceBitmap.length;
19721    var pseudoPixelContext = RefinementReusedContexts[templateIndex];
19722    var bitmap = [];
19723    var decoder = decodingContext.decoder;
19724    var contexts = decodingContext.contextCache.getContexts('GR');
19725    var ltp = 0;
19726
19727    for (var i = 0; i < height; i++) {
19728      if (prediction) {
19729        var sltp = decoder.readBit(contexts, pseudoPixelContext);
19730        ltp ^= sltp;
19731
19732        if (ltp) {
19733          throw new Jbig2Error('prediction is not supported');
19734        }
19735      }
19736
19737      var row = new Uint8Array(width);
19738      bitmap.push(row);
19739
19740      for (var j = 0; j < width; j++) {
19741        var i0, j0;
19742        var contextLabel = 0;
19743
19744        for (k = 0; k < codingTemplateLength; k++) {
19745          i0 = i + codingTemplateY[k];
19746          j0 = j + codingTemplateX[k];
19747
19748          if (i0 < 0 || j0 < 0 || j0 >= width) {
19749            contextLabel <<= 1;
19750          } else {
19751            contextLabel = contextLabel << 1 | bitmap[i0][j0];
19752          }
19753        }
19754
19755        for (k = 0; k < referenceTemplateLength; k++) {
19756          i0 = i + referenceTemplateY[k] - offsetY;
19757          j0 = j + referenceTemplateX[k] - offsetX;
19758
19759          if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
19760            contextLabel <<= 1;
19761          } else {
19762            contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
19763          }
19764        }
19765
19766        var pixel = decoder.readBit(contexts, contextLabel);
19767        row[j] = pixel;
19768      }
19769    }
19770
19771    return bitmap;
19772  }
19773
19774  function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) {
19775    if (huffman && refinement) {
19776      throw new Jbig2Error('symbol refinement with Huffman is not supported');
19777    }
19778
19779    var newSymbols = [];
19780    var currentHeight = 0;
19781    var symbolCodeLength = (0, _util.log2)(symbols.length + numberOfNewSymbols);
19782    var decoder = decodingContext.decoder;
19783    var contextCache = decodingContext.contextCache;
19784    var tableB1, symbolWidths;
19785
19786    if (huffman) {
19787      tableB1 = getStandardTable(1);
19788      symbolWidths = [];
19789      symbolCodeLength = Math.max(symbolCodeLength, 1);
19790    }
19791
19792    while (newSymbols.length < numberOfNewSymbols) {
19793      var deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, 'IADH', decoder);
19794      currentHeight += deltaHeight;
19795      var currentWidth = 0,
19796          totalWidth = 0;
19797      var firstSymbol = huffman ? symbolWidths.length : 0;
19798
19799      while (true) {
19800        var deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, 'IADW', decoder);
19801
19802        if (deltaWidth === null) {
19803          break;
19804        }
19805
19806        currentWidth += deltaWidth;
19807        totalWidth += currentWidth;
19808        var bitmap;
19809
19810        if (refinement) {
19811          var numberOfInstances = decodeInteger(contextCache, 'IAAI', decoder);
19812
19813          if (numberOfInstances > 1) {
19814            bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);
19815          } else {
19816            var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
19817            var rdx = decodeInteger(contextCache, 'IARDX', decoder);
19818            var rdy = decodeInteger(contextCache, 'IARDY', decoder);
19819            var symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
19820            bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
19821          }
19822
19823          newSymbols.push(bitmap);
19824        } else if (huffman) {
19825          symbolWidths.push(currentWidth);
19826        } else {
19827          bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
19828          newSymbols.push(bitmap);
19829        }
19830      }
19831
19832      if (huffman && !refinement) {
19833        var bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);
19834        huffmanInput.byteAlign();
19835        var collectiveBitmap = void 0;
19836
19837        if (bitmapSize === 0) {
19838          collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight);
19839        } else {
19840          var originalEnd = huffmanInput.end;
19841          var bitmapEnd = huffmanInput.position + bitmapSize;
19842          huffmanInput.end = bitmapEnd;
19843          collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false);
19844          huffmanInput.end = originalEnd;
19845          huffmanInput.position = bitmapEnd;
19846        }
19847
19848        var numberOfSymbolsDecoded = symbolWidths.length;
19849
19850        if (firstSymbol === numberOfSymbolsDecoded - 1) {
19851          newSymbols.push(collectiveBitmap);
19852        } else {
19853          var _i = void 0,
19854              y = void 0,
19855              xMin = 0,
19856              xMax = void 0,
19857              bitmapWidth = void 0,
19858              symbolBitmap = void 0;
19859
19860          for (_i = firstSymbol; _i < numberOfSymbolsDecoded; _i++) {
19861            bitmapWidth = symbolWidths[_i];
19862            xMax = xMin + bitmapWidth;
19863            symbolBitmap = [];
19864
19865            for (y = 0; y < currentHeight; y++) {
19866              symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
19867            }
19868
19869            newSymbols.push(symbolBitmap);
19870            xMin = xMax;
19871          }
19872        }
19873      }
19874    }
19875
19876    var exportedSymbols = [];
19877    var flags = [],
19878        currentFlag = false;
19879    var totalSymbolsLength = symbols.length + numberOfNewSymbols;
19880
19881    while (flags.length < totalSymbolsLength) {
19882      var runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, 'IAEX', decoder);
19883
19884      while (runLength--) {
19885        flags.push(currentFlag);
19886      }
19887
19888      currentFlag = !currentFlag;
19889    }
19890
19891    for (var i = 0, ii = symbols.length; i < ii; i++) {
19892      if (flags[i]) {
19893        exportedSymbols.push(symbols[i]);
19894      }
19895    }
19896
19897    for (var j = 0; j < numberOfNewSymbols; i++, j++) {
19898      if (flags[i]) {
19899        exportedSymbols.push(newSymbols[j]);
19900      }
19901    }
19902
19903    return exportedSymbols;
19904  }
19905
19906  function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) {
19907    if (huffman && refinement) {
19908      throw new Jbig2Error('refinement with Huffman is not supported');
19909    }
19910
19911    var bitmap = [];
19912    var i, row;
19913
19914    for (i = 0; i < height; i++) {
19915      row = new Uint8Array(width);
19916
19917      if (defaultPixelValue) {
19918        for (var j = 0; j < width; j++) {
19919          row[j] = defaultPixelValue;
19920        }
19921      }
19922
19923      bitmap.push(row);
19924    }
19925
19926    var decoder = decodingContext.decoder;
19927    var contextCache = decodingContext.contextCache;
19928    var stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, 'IADT', decoder);
19929    var firstS = 0;
19930    i = 0;
19931
19932    while (i < numberOfSymbolInstances) {
19933      var deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, 'IADT', decoder);
19934      stripT += deltaT;
19935      var deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, 'IAFS', decoder);
19936      firstS += deltaFirstS;
19937      var currentS = firstS;
19938
19939      do {
19940        var currentT = 0;
19941
19942        if (stripSize > 1) {
19943          currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, 'IAIT', decoder);
19944        }
19945
19946        var t = stripSize * stripT + currentT;
19947        var symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength);
19948        var applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, 'IARI', decoder));
19949        var symbolBitmap = inputSymbols[symbolId];
19950        var symbolWidth = symbolBitmap[0].length;
19951        var symbolHeight = symbolBitmap.length;
19952
19953        if (applyRefinement) {
19954          var rdw = decodeInteger(contextCache, 'IARDW', decoder);
19955          var rdh = decodeInteger(contextCache, 'IARDH', decoder);
19956          var rdx = decodeInteger(contextCache, 'IARDX', decoder);
19957          var rdy = decodeInteger(contextCache, 'IARDY', decoder);
19958          symbolWidth += rdw;
19959          symbolHeight += rdh;
19960          symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
19961        }
19962
19963        var offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
19964        var offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
19965        var s2, t2, symbolRow;
19966
19967        if (transposed) {
19968          for (s2 = 0; s2 < symbolHeight; s2++) {
19969            row = bitmap[offsetS + s2];
19970
19971            if (!row) {
19972              continue;
19973            }
19974
19975            symbolRow = symbolBitmap[s2];
19976            var maxWidth = Math.min(width - offsetT, symbolWidth);
19977
19978            switch (combinationOperator) {
19979              case 0:
19980                for (t2 = 0; t2 < maxWidth; t2++) {
19981                  row[offsetT + t2] |= symbolRow[t2];
19982                }
19983
19984                break;
19985
19986              case 2:
19987                for (t2 = 0; t2 < maxWidth; t2++) {
19988                  row[offsetT + t2] ^= symbolRow[t2];
19989                }
19990
19991                break;
19992
19993              default:
19994                throw new Jbig2Error("operator ".concat(combinationOperator, " is not supported"));
19995            }
19996          }
19997
19998          currentS += symbolHeight - 1;
19999        } else {
20000          for (t2 = 0; t2 < symbolHeight; t2++) {
20001            row = bitmap[offsetT + t2];
20002
20003            if (!row) {
20004              continue;
20005            }
20006
20007            symbolRow = symbolBitmap[t2];
20008
20009            switch (combinationOperator) {
20010              case 0:
20011                for (s2 = 0; s2 < symbolWidth; s2++) {
20012                  row[offsetS + s2] |= symbolRow[s2];
20013                }
20014
20015                break;
20016
20017              case 2:
20018                for (s2 = 0; s2 < symbolWidth; s2++) {
20019                  row[offsetS + s2] ^= symbolRow[s2];
20020                }
20021
20022                break;
20023
20024              default:
20025                throw new Jbig2Error("operator ".concat(combinationOperator, " is not supported"));
20026            }
20027          }
20028
20029          currentS += symbolWidth - 1;
20030        }
20031
20032        i++;
20033        var deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, 'IADS', decoder);
20034
20035        if (deltaS === null) {
20036          break;
20037        }
20038
20039        currentS += deltaS + dsOffset;
20040      } while (true);
20041    }
20042
20043    return bitmap;
20044  }
20045
20046  function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {
20047    var at = [];
20048
20049    if (!mmr) {
20050      at.push({
20051        x: -patternWidth,
20052        y: 0
20053      });
20054
20055      if (template === 0) {
20056        at.push({
20057          x: -3,
20058          y: -1
20059        });
20060        at.push({
20061          x: 2,
20062          y: -2
20063        });
20064        at.push({
20065          x: -2,
20066          y: -2
20067        });
20068      }
20069    }
20070
20071    var collectiveWidth = (maxPatternIndex + 1) * patternWidth;
20072    var collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);
20073    var patterns = [],
20074        i = 0,
20075        patternBitmap,
20076        xMin,
20077        xMax,
20078        y;
20079
20080    while (i <= maxPatternIndex) {
20081      patternBitmap = [];
20082      xMin = patternWidth * i;
20083      xMax = xMin + patternWidth;
20084
20085      for (y = 0; y < patternHeight; y++) {
20086        patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
20087      }
20088
20089      patterns.push(patternBitmap);
20090      i++;
20091    }
20092
20093    return patterns;
20094  }
20095
20096  function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {
20097    var skip = null;
20098
20099    if (enableSkip) {
20100      throw new Jbig2Error('skip is not supported');
20101    }
20102
20103    if (combinationOperator !== 0) {
20104      throw new Jbig2Error('operator ' + combinationOperator + ' is not supported in halftone region');
20105    }
20106
20107    var regionBitmap = [];
20108    var i, j, row;
20109
20110    for (i = 0; i < regionHeight; i++) {
20111      row = new Uint8Array(regionWidth);
20112
20113      if (defaultPixelValue) {
20114        for (j = 0; j < regionWidth; j++) {
20115          row[j] = defaultPixelValue;
20116        }
20117      }
20118
20119      regionBitmap.push(row);
20120    }
20121
20122    var numberOfPatterns = patterns.length;
20123    var pattern0 = patterns[0];
20124    var patternWidth = pattern0[0].length,
20125        patternHeight = pattern0.length;
20126    var bitsPerValue = (0, _util.log2)(numberOfPatterns);
20127    var at = [];
20128
20129    if (!mmr) {
20130      at.push({
20131        x: template <= 1 ? 3 : 2,
20132        y: -1
20133      });
20134
20135      if (template === 0) {
20136        at.push({
20137          x: -3,
20138          y: -1
20139        });
20140        at.push({
20141          x: 2,
20142          y: -2
20143        });
20144        at.push({
20145          x: -2,
20146          y: -2
20147        });
20148      }
20149    }
20150
20151    var grayScaleBitPlanes = [],
20152        mmrInput,
20153        bitmap;
20154
20155    if (mmr) {
20156      mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
20157    }
20158
20159    for (i = bitsPerValue - 1; i >= 0; i--) {
20160      if (mmr) {
20161        bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true);
20162      } else {
20163        bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext);
20164      }
20165
20166      grayScaleBitPlanes[i] = bitmap;
20167    }
20168
20169    var mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow;
20170
20171    for (mg = 0; mg < gridHeight; mg++) {
20172      for (ng = 0; ng < gridWidth; ng++) {
20173        bit = 0;
20174        patternIndex = 0;
20175
20176        for (j = bitsPerValue - 1; j >= 0; j--) {
20177          bit = grayScaleBitPlanes[j][mg][ng] ^ bit;
20178          patternIndex |= bit << j;
20179        }
20180
20181        patternBitmap = patterns[patternIndex];
20182        x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8;
20183        y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8;
20184
20185        if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) {
20186          for (i = 0; i < patternHeight; i++) {
20187            regionRow = regionBitmap[y + i];
20188            patternRow = patternBitmap[i];
20189
20190            for (j = 0; j < patternWidth; j++) {
20191              regionRow[x + j] |= patternRow[j];
20192            }
20193          }
20194        } else {
20195          var regionX = void 0,
20196              regionY = void 0;
20197
20198          for (i = 0; i < patternHeight; i++) {
20199            regionY = y + i;
20200
20201            if (regionY < 0 || regionY >= regionHeight) {
20202              continue;
20203            }
20204
20205            regionRow = regionBitmap[regionY];
20206            patternRow = patternBitmap[i];
20207
20208            for (j = 0; j < patternWidth; j++) {
20209              regionX = x + j;
20210
20211              if (regionX >= 0 && regionX < regionWidth) {
20212                regionRow[regionX] |= patternRow[j];
20213              }
20214            }
20215          }
20216        }
20217      }
20218    }
20219
20220    return regionBitmap;
20221  }
20222
20223  function readSegmentHeader(data, start) {
20224    var segmentHeader = {};
20225    segmentHeader.number = (0, _util.readUint32)(data, start);
20226    var flags = data[start + 4];
20227    var segmentType = flags & 0x3F;
20228
20229    if (!SegmentTypes[segmentType]) {
20230      throw new Jbig2Error('invalid segment type: ' + segmentType);
20231    }
20232
20233    segmentHeader.type = segmentType;
20234    segmentHeader.typeName = SegmentTypes[segmentType];
20235    segmentHeader.deferredNonRetain = !!(flags & 0x80);
20236    var pageAssociationFieldSize = !!(flags & 0x40);
20237    var referredFlags = data[start + 5];
20238    var referredToCount = referredFlags >> 5 & 7;
20239    var retainBits = [referredFlags & 31];
20240    var position = start + 6;
20241
20242    if (referredFlags === 7) {
20243      referredToCount = (0, _util.readUint32)(data, position - 1) & 0x1FFFFFFF;
20244      position += 3;
20245      var bytes = referredToCount + 7 >> 3;
20246      retainBits[0] = data[position++];
20247
20248      while (--bytes > 0) {
20249        retainBits.push(data[position++]);
20250      }
20251    } else if (referredFlags === 5 || referredFlags === 6) {
20252      throw new Jbig2Error('invalid referred-to flags');
20253    }
20254
20255    segmentHeader.retainBits = retainBits;
20256    var referredToSegmentNumberSize = segmentHeader.number <= 256 ? 1 : segmentHeader.number <= 65536 ? 2 : 4;
20257    var referredTo = [];
20258    var i, ii;
20259
20260    for (i = 0; i < referredToCount; i++) {
20261      var number = referredToSegmentNumberSize === 1 ? data[position] : referredToSegmentNumberSize === 2 ? (0, _util.readUint16)(data, position) : (0, _util.readUint32)(data, position);
20262      referredTo.push(number);
20263      position += referredToSegmentNumberSize;
20264    }
20265
20266    segmentHeader.referredTo = referredTo;
20267
20268    if (!pageAssociationFieldSize) {
20269      segmentHeader.pageAssociation = data[position++];
20270    } else {
20271      segmentHeader.pageAssociation = (0, _util.readUint32)(data, position);
20272      position += 4;
20273    }
20274
20275    segmentHeader.length = (0, _util.readUint32)(data, position);
20276    position += 4;
20277
20278    if (segmentHeader.length === 0xFFFFFFFF) {
20279      if (segmentType === 38) {
20280        var genericRegionInfo = readRegionSegmentInformation(data, position);
20281        var genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
20282        var genericRegionMmr = !!(genericRegionSegmentFlags & 1);
20283        var searchPatternLength = 6;
20284        var searchPattern = new Uint8Array(searchPatternLength);
20285
20286        if (!genericRegionMmr) {
20287          searchPattern[0] = 0xFF;
20288          searchPattern[1] = 0xAC;
20289        }
20290
20291        searchPattern[2] = genericRegionInfo.height >>> 24 & 0xFF;
20292        searchPattern[3] = genericRegionInfo.height >> 16 & 0xFF;
20293        searchPattern[4] = genericRegionInfo.height >> 8 & 0xFF;
20294        searchPattern[5] = genericRegionInfo.height & 0xFF;
20295
20296        for (i = position, ii = data.length; i < ii; i++) {
20297          var j = 0;
20298
20299          while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
20300            j++;
20301          }
20302
20303          if (j === searchPatternLength) {
20304            segmentHeader.length = i + searchPatternLength;
20305            break;
20306          }
20307        }
20308
20309        if (segmentHeader.length === 0xFFFFFFFF) {
20310          throw new Jbig2Error('segment end was not found');
20311        }
20312      } else {
20313        throw new Jbig2Error('invalid unknown segment length');
20314      }
20315    }
20316
20317    segmentHeader.headerEnd = position;
20318    return segmentHeader;
20319  }
20320
20321  function readSegments(header, data, start, end) {
20322    var segments = [];
20323    var position = start;
20324
20325    while (position < end) {
20326      var segmentHeader = readSegmentHeader(data, position);
20327      position = segmentHeader.headerEnd;
20328      var segment = {
20329        header: segmentHeader,
20330        data: data
20331      };
20332
20333      if (!header.randomAccess) {
20334        segment.start = position;
20335        position += segmentHeader.length;
20336        segment.end = position;
20337      }
20338
20339      segments.push(segment);
20340
20341      if (segmentHeader.type === 51) {
20342        break;
20343      }
20344    }
20345
20346    if (header.randomAccess) {
20347      for (var i = 0, ii = segments.length; i < ii; i++) {
20348        segments[i].start = position;
20349        position += segments[i].header.length;
20350        segments[i].end = position;
20351      }
20352    }
20353
20354    return segments;
20355  }
20356
20357  function readRegionSegmentInformation(data, start) {
20358    return {
20359      width: (0, _util.readUint32)(data, start),
20360      height: (0, _util.readUint32)(data, start + 4),
20361      x: (0, _util.readUint32)(data, start + 8),
20362      y: (0, _util.readUint32)(data, start + 12),
20363      combinationOperator: data[start + 16] & 7
20364    };
20365  }
20366
20367  var RegionSegmentInformationFieldLength = 17;
20368
20369  function processSegment(segment, visitor) {
20370    var header = segment.header;
20371    var data = segment.data,
20372        position = segment.start,
20373        end = segment.end;
20374    var args, at, i, atLength;
20375
20376    switch (header.type) {
20377      case 0:
20378        var dictionary = {};
20379        var dictionaryFlags = (0, _util.readUint16)(data, position);
20380        dictionary.huffman = !!(dictionaryFlags & 1);
20381        dictionary.refinement = !!(dictionaryFlags & 2);
20382        dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
20383        dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
20384        dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
20385        dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
20386        dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
20387        dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
20388        dictionary.template = dictionaryFlags >> 10 & 3;
20389        dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
20390        position += 2;
20391
20392        if (!dictionary.huffman) {
20393          atLength = dictionary.template === 0 ? 4 : 1;
20394          at = [];
20395
20396          for (i = 0; i < atLength; i++) {
20397            at.push({
20398              x: (0, _util.readInt8)(data, position),
20399              y: (0, _util.readInt8)(data, position + 1)
20400            });
20401            position += 2;
20402          }
20403
20404          dictionary.at = at;
20405        }
20406
20407        if (dictionary.refinement && !dictionary.refinementTemplate) {
20408          at = [];
20409
20410          for (i = 0; i < 2; i++) {
20411            at.push({
20412              x: (0, _util.readInt8)(data, position),
20413              y: (0, _util.readInt8)(data, position + 1)
20414            });
20415            position += 2;
20416          }
20417
20418          dictionary.refinementAt = at;
20419        }
20420
20421        dictionary.numberOfExportedSymbols = (0, _util.readUint32)(data, position);
20422        position += 4;
20423        dictionary.numberOfNewSymbols = (0, _util.readUint32)(data, position);
20424        position += 4;
20425        args = [dictionary, header.number, header.referredTo, data, position, end];
20426        break;
20427
20428      case 6:
20429      case 7:
20430        var textRegion = {};
20431        textRegion.info = readRegionSegmentInformation(data, position);
20432        position += RegionSegmentInformationFieldLength;
20433        var textRegionSegmentFlags = (0, _util.readUint16)(data, position);
20434        position += 2;
20435        textRegion.huffman = !!(textRegionSegmentFlags & 1);
20436        textRegion.refinement = !!(textRegionSegmentFlags & 2);
20437        textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3;
20438        textRegion.stripSize = 1 << textRegion.logStripSize;
20439        textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
20440        textRegion.transposed = !!(textRegionSegmentFlags & 64);
20441        textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
20442        textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
20443        textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
20444        textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
20445
20446        if (textRegion.huffman) {
20447          var textRegionHuffmanFlags = (0, _util.readUint16)(data, position);
20448          position += 2;
20449          textRegion.huffmanFS = textRegionHuffmanFlags & 3;
20450          textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
20451          textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
20452          textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
20453          textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
20454          textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
20455          textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
20456          textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000);
20457        }
20458
20459        if (textRegion.refinement && !textRegion.refinementTemplate) {
20460          at = [];
20461
20462          for (i = 0; i < 2; i++) {
20463            at.push({
20464              x: (0, _util.readInt8)(data, position),
20465              y: (0, _util.readInt8)(data, position + 1)
20466            });
20467            position += 2;
20468          }
20469
20470          textRegion.refinementAt = at;
20471        }
20472
20473        textRegion.numberOfSymbolInstances = (0, _util.readUint32)(data, position);
20474        position += 4;
20475        args = [textRegion, header.referredTo, data, position, end];
20476        break;
20477
20478      case 16:
20479        var patternDictionary = {};
20480        var patternDictionaryFlags = data[position++];
20481        patternDictionary.mmr = !!(patternDictionaryFlags & 1);
20482        patternDictionary.template = patternDictionaryFlags >> 1 & 3;
20483        patternDictionary.patternWidth = data[position++];
20484        patternDictionary.patternHeight = data[position++];
20485        patternDictionary.maxPatternIndex = (0, _util.readUint32)(data, position);
20486        position += 4;
20487        args = [patternDictionary, header.number, data, position, end];
20488        break;
20489
20490      case 22:
20491      case 23:
20492        var halftoneRegion = {};
20493        halftoneRegion.info = readRegionSegmentInformation(data, position);
20494        position += RegionSegmentInformationFieldLength;
20495        var halftoneRegionFlags = data[position++];
20496        halftoneRegion.mmr = !!(halftoneRegionFlags & 1);
20497        halftoneRegion.template = halftoneRegionFlags >> 1 & 3;
20498        halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);
20499        halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7;
20500        halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1;
20501        halftoneRegion.gridWidth = (0, _util.readUint32)(data, position);
20502        position += 4;
20503        halftoneRegion.gridHeight = (0, _util.readUint32)(data, position);
20504        position += 4;
20505        halftoneRegion.gridOffsetX = (0, _util.readUint32)(data, position) & 0xFFFFFFFF;
20506        position += 4;
20507        halftoneRegion.gridOffsetY = (0, _util.readUint32)(data, position) & 0xFFFFFFFF;
20508        position += 4;
20509        halftoneRegion.gridVectorX = (0, _util.readUint16)(data, position);
20510        position += 2;
20511        halftoneRegion.gridVectorY = (0, _util.readUint16)(data, position);
20512        position += 2;
20513        args = [halftoneRegion, header.referredTo, data, position, end];
20514        break;
20515
20516      case 38:
20517      case 39:
20518        var genericRegion = {};
20519        genericRegion.info = readRegionSegmentInformation(data, position);
20520        position += RegionSegmentInformationFieldLength;
20521        var genericRegionSegmentFlags = data[position++];
20522        genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
20523        genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
20524        genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
20525
20526        if (!genericRegion.mmr) {
20527          atLength = genericRegion.template === 0 ? 4 : 1;
20528          at = [];
20529
20530          for (i = 0; i < atLength; i++) {
20531            at.push({
20532              x: (0, _util.readInt8)(data, position),
20533              y: (0, _util.readInt8)(data, position + 1)
20534            });
20535            position += 2;
20536          }
20537
20538          genericRegion.at = at;
20539        }
20540
20541        args = [genericRegion, data, position, end];
20542        break;
20543
20544      case 48:
20545        var pageInfo = {
20546          width: (0, _util.readUint32)(data, position),
20547          height: (0, _util.readUint32)(data, position + 4),
20548          resolutionX: (0, _util.readUint32)(data, position + 8),
20549          resolutionY: (0, _util.readUint32)(data, position + 12)
20550        };
20551
20552        if (pageInfo.height === 0xFFFFFFFF) {
20553          delete pageInfo.height;
20554        }
20555
20556        var pageSegmentFlags = data[position + 16];
20557        (0, _util.readUint16)(data, position + 17);
20558        pageInfo.lossless = !!(pageSegmentFlags & 1);
20559        pageInfo.refinement = !!(pageSegmentFlags & 2);
20560        pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
20561        pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
20562        pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
20563        pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
20564        args = [pageInfo];
20565        break;
20566
20567      case 49:
20568        break;
20569
20570      case 50:
20571        break;
20572
20573      case 51:
20574        break;
20575
20576      case 53:
20577        args = [header.number, data, position, end];
20578        break;
20579
20580      case 62:
20581        break;
20582
20583      default:
20584        throw new Jbig2Error("segment type ".concat(header.typeName, "(").concat(header.type, ")") + ' is not implemented');
20585    }
20586
20587    var callbackName = 'on' + header.typeName;
20588
20589    if (callbackName in visitor) {
20590      visitor[callbackName].apply(visitor, args);
20591    }
20592  }
20593
20594  function processSegments(segments, visitor) {
20595    for (var i = 0, ii = segments.length; i < ii; i++) {
20596      processSegment(segments[i], visitor);
20597    }
20598  }
20599
20600  function parseJbig2Chunks(chunks) {
20601    var visitor = new SimpleSegmentVisitor();
20602
20603    for (var i = 0, ii = chunks.length; i < ii; i++) {
20604      var chunk = chunks[i];
20605      var segments = readSegments({}, chunk.data, chunk.start, chunk.end);
20606      processSegments(segments, visitor);
20607    }
20608
20609    return visitor.buffer;
20610  }
20611
20612  function parseJbig2(data) {
20613    var position = 0,
20614        end = data.length;
20615
20616    if (data[position] !== 0x97 || data[position + 1] !== 0x4A || data[position + 2] !== 0x42 || data[position + 3] !== 0x32 || data[position + 4] !== 0x0D || data[position + 5] !== 0x0A || data[position + 6] !== 0x1A || data[position + 7] !== 0x0A) {
20617      throw new Jbig2Error('parseJbig2 - invalid header.');
20618    }
20619
20620    var header = Object.create(null);
20621    position += 8;
20622    var flags = data[position++];
20623    header.randomAccess = !(flags & 1);
20624
20625    if (!(flags & 2)) {
20626      header.numberOfPages = (0, _util.readUint32)(data, position);
20627      position += 4;
20628    }
20629
20630    var segments = readSegments(header, data, position, end);
20631    var visitor = new SimpleSegmentVisitor();
20632    processSegments(segments, visitor);
20633    var _visitor$currentPageI = visitor.currentPageInfo,
20634        width = _visitor$currentPageI.width,
20635        height = _visitor$currentPageI.height;
20636    var bitPacked = visitor.buffer;
20637    var imgData = new Uint8ClampedArray(width * height);
20638    var q = 0,
20639        k = 0;
20640
20641    for (var i = 0; i < height; i++) {
20642      var mask = 0,
20643          buffer = void 0;
20644
20645      for (var j = 0; j < width; j++) {
20646        if (!mask) {
20647          mask = 128;
20648          buffer = bitPacked[k++];
20649        }
20650
20651        imgData[q++] = buffer & mask ? 0 : 255;
20652        mask >>= 1;
20653      }
20654    }
20655
20656    return {
20657      imgData: imgData,
20658      width: width,
20659      height: height
20660    };
20661  }
20662
20663  function SimpleSegmentVisitor() {}
20664
20665  SimpleSegmentVisitor.prototype = {
20666    onPageInformation: function SimpleSegmentVisitor_onPageInformation(info) {
20667      this.currentPageInfo = info;
20668      var rowSize = info.width + 7 >> 3;
20669      var buffer = new Uint8ClampedArray(rowSize * info.height);
20670
20671      if (info.defaultPixelValue) {
20672        for (var i = 0, ii = buffer.length; i < ii; i++) {
20673          buffer[i] = 0xFF;
20674        }
20675      }
20676
20677      this.buffer = buffer;
20678    },
20679    drawBitmap: function SimpleSegmentVisitor_drawBitmap(regionInfo, bitmap) {
20680      var pageInfo = this.currentPageInfo;
20681      var width = regionInfo.width,
20682          height = regionInfo.height;
20683      var rowSize = pageInfo.width + 7 >> 3;
20684      var combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
20685      var buffer = this.buffer;
20686      var mask0 = 128 >> (regionInfo.x & 7);
20687      var offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
20688      var i, j, mask, offset;
20689
20690      switch (combinationOperator) {
20691        case 0:
20692          for (i = 0; i < height; i++) {
20693            mask = mask0;
20694            offset = offset0;
20695
20696            for (j = 0; j < width; j++) {
20697              if (bitmap[i][j]) {
20698                buffer[offset] |= mask;
20699              }
20700
20701              mask >>= 1;
20702
20703              if (!mask) {
20704                mask = 128;
20705                offset++;
20706              }
20707            }
20708
20709            offset0 += rowSize;
20710          }
20711
20712          break;
20713
20714        case 2:
20715          for (i = 0; i < height; i++) {
20716            mask = mask0;
20717            offset = offset0;
20718
20719            for (j = 0; j < width; j++) {
20720              if (bitmap[i][j]) {
20721                buffer[offset] ^= mask;
20722              }
20723
20724              mask >>= 1;
20725
20726              if (!mask) {
20727                mask = 128;
20728                offset++;
20729              }
20730            }
20731
20732            offset0 += rowSize;
20733          }
20734
20735          break;
20736
20737        default:
20738          throw new Jbig2Error("operator ".concat(combinationOperator, " is not supported"));
20739      }
20740    },
20741    onImmediateGenericRegion: function SimpleSegmentVisitor_onImmediateGenericRegion(region, data, start, end) {
20742      var regionInfo = region.info;
20743      var decodingContext = new DecodingContext(data, start, end);
20744      var bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
20745      this.drawBitmap(regionInfo, bitmap);
20746    },
20747    onImmediateLosslessGenericRegion: function SimpleSegmentVisitor_onImmediateLosslessGenericRegion() {
20748      this.onImmediateGenericRegion.apply(this, arguments);
20749    },
20750    onSymbolDictionary: function SimpleSegmentVisitor_onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
20751      var huffmanTables, huffmanInput;
20752
20753      if (dictionary.huffman) {
20754        huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables);
20755        huffmanInput = new Reader(data, start, end);
20756      }
20757
20758      var symbols = this.symbols;
20759
20760      if (!symbols) {
20761        this.symbols = symbols = {};
20762      }
20763
20764      var inputSymbols = [];
20765
20766      for (var i = 0, ii = referredSegments.length; i < ii; i++) {
20767        var referredSymbols = symbols[referredSegments[i]];
20768
20769        if (referredSymbols) {
20770          inputSymbols = inputSymbols.concat(referredSymbols);
20771        }
20772      }
20773
20774      var decodingContext = new DecodingContext(data, start, end);
20775      symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput);
20776    },
20777    onImmediateTextRegion: function SimpleSegmentVisitor_onImmediateTextRegion(region, referredSegments, data, start, end) {
20778      var regionInfo = region.info;
20779      var huffmanTables, huffmanInput;
20780      var symbols = this.symbols;
20781      var inputSymbols = [];
20782
20783      for (var i = 0, ii = referredSegments.length; i < ii; i++) {
20784        var referredSymbols = symbols[referredSegments[i]];
20785
20786        if (referredSymbols) {
20787          inputSymbols = inputSymbols.concat(referredSymbols);
20788        }
20789      }
20790
20791      var symbolCodeLength = (0, _util.log2)(inputSymbols.length);
20792
20793      if (region.huffman) {
20794        huffmanInput = new Reader(data, start, end);
20795        huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput);
20796      }
20797
20798      var decodingContext = new DecodingContext(data, start, end);
20799      var bitmap = decodeTextRegion(region.huffman, region.refinement, regionInfo.width, regionInfo.height, region.defaultPixelValue, region.numberOfSymbolInstances, region.stripSize, inputSymbols, symbolCodeLength, region.transposed, region.dsOffset, region.referenceCorner, region.combinationOperator, huffmanTables, region.refinementTemplate, region.refinementAt, decodingContext, region.logStripSize, huffmanInput);
20800      this.drawBitmap(regionInfo, bitmap);
20801    },
20802    onImmediateLosslessTextRegion: function SimpleSegmentVisitor_onImmediateLosslessTextRegion() {
20803      this.onImmediateTextRegion.apply(this, arguments);
20804    },
20805    onPatternDictionary: function onPatternDictionary(dictionary, currentSegment, data, start, end) {
20806      var patterns = this.patterns;
20807
20808      if (!patterns) {
20809        this.patterns = patterns = {};
20810      }
20811
20812      var decodingContext = new DecodingContext(data, start, end);
20813      patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext);
20814    },
20815    onImmediateHalftoneRegion: function onImmediateHalftoneRegion(region, referredSegments, data, start, end) {
20816      var patterns = this.patterns[referredSegments[0]];
20817      var regionInfo = region.info;
20818      var decodingContext = new DecodingContext(data, start, end);
20819      var bitmap = decodeHalftoneRegion(region.mmr, patterns, region.template, regionInfo.width, regionInfo.height, region.defaultPixelValue, region.enableSkip, region.combinationOperator, region.gridWidth, region.gridHeight, region.gridOffsetX, region.gridOffsetY, region.gridVectorX, region.gridVectorY, decodingContext);
20820      this.drawBitmap(regionInfo, bitmap);
20821    },
20822    onImmediateLosslessHalftoneRegion: function onImmediateLosslessHalftoneRegion() {
20823      this.onImmediateHalftoneRegion.apply(this, arguments);
20824    },
20825    onTables: function onTables(currentSegment, data, start, end) {
20826      var customTables = this.customTables;
20827
20828      if (!customTables) {
20829        this.customTables = customTables = {};
20830      }
20831
20832      customTables[currentSegment] = decodeTablesSegment(data, start, end);
20833    }
20834  };
20835
20836  function HuffmanLine(lineData) {
20837    if (lineData.length === 2) {
20838      this.isOOB = true;
20839      this.rangeLow = 0;
20840      this.prefixLength = lineData[0];
20841      this.rangeLength = 0;
20842      this.prefixCode = lineData[1];
20843      this.isLowerRange = false;
20844    } else {
20845      this.isOOB = false;
20846      this.rangeLow = lineData[0];
20847      this.prefixLength = lineData[1];
20848      this.rangeLength = lineData[2];
20849      this.prefixCode = lineData[3];
20850      this.isLowerRange = lineData[4] === 'lower';
20851    }
20852  }
20853
20854  function HuffmanTreeNode(line) {
20855    this.children = [];
20856
20857    if (line) {
20858      this.isLeaf = true;
20859      this.rangeLength = line.rangeLength;
20860      this.rangeLow = line.rangeLow;
20861      this.isLowerRange = line.isLowerRange;
20862      this.isOOB = line.isOOB;
20863    } else {
20864      this.isLeaf = false;
20865    }
20866  }
20867
20868  HuffmanTreeNode.prototype = {
20869    buildTree: function buildTree(line, shift) {
20870      var bit = line.prefixCode >> shift & 1;
20871
20872      if (shift <= 0) {
20873        this.children[bit] = new HuffmanTreeNode(line);
20874      } else {
20875        var node = this.children[bit];
20876
20877        if (!node) {
20878          this.children[bit] = node = new HuffmanTreeNode(null);
20879        }
20880
20881        node.buildTree(line, shift - 1);
20882      }
20883    },
20884    decodeNode: function decodeNode(reader) {
20885      if (this.isLeaf) {
20886        if (this.isOOB) {
20887          return null;
20888        }
20889
20890        var htOffset = reader.readBits(this.rangeLength);
20891        return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);
20892      }
20893
20894      var node = this.children[reader.readBit()];
20895
20896      if (!node) {
20897        throw new Jbig2Error('invalid Huffman data');
20898      }
20899
20900      return node.decodeNode(reader);
20901    }
20902  };
20903
20904  function HuffmanTable(lines, prefixCodesDone) {
20905    if (!prefixCodesDone) {
20906      this.assignPrefixCodes(lines);
20907    }
20908
20909    this.rootNode = new HuffmanTreeNode(null);
20910    var i,
20911        ii = lines.length,
20912        line;
20913
20914    for (i = 0; i < ii; i++) {
20915      line = lines[i];
20916
20917      if (line.prefixLength > 0) {
20918        this.rootNode.buildTree(line, line.prefixLength - 1);
20919      }
20920    }
20921  }
20922
20923  HuffmanTable.prototype = {
20924    decode: function decode(reader) {
20925      return this.rootNode.decodeNode(reader);
20926    },
20927    assignPrefixCodes: function assignPrefixCodes(lines) {
20928      var linesLength = lines.length,
20929          prefixLengthMax = 0,
20930          i;
20931
20932      for (i = 0; i < linesLength; i++) {
20933        prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
20934      }
20935
20936      var histogram = new Uint32Array(prefixLengthMax + 1);
20937
20938      for (i = 0; i < linesLength; i++) {
20939        histogram[lines[i].prefixLength]++;
20940      }
20941
20942      var currentLength = 1,
20943          firstCode = 0,
20944          currentCode,
20945          currentTemp,
20946          line;
20947      histogram[0] = 0;
20948
20949      while (currentLength <= prefixLengthMax) {
20950        firstCode = firstCode + histogram[currentLength - 1] << 1;
20951        currentCode = firstCode;
20952        currentTemp = 0;
20953
20954        while (currentTemp < linesLength) {
20955          line = lines[currentTemp];
20956
20957          if (line.prefixLength === currentLength) {
20958            line.prefixCode = currentCode;
20959            currentCode++;
20960          }
20961
20962          currentTemp++;
20963        }
20964
20965        currentLength++;
20966      }
20967    }
20968  };
20969
20970  function decodeTablesSegment(data, start, end) {
20971    var flags = data[start];
20972    var lowestValue = (0, _util.readUint32)(data, start + 1) & 0xFFFFFFFF;
20973    var highestValue = (0, _util.readUint32)(data, start + 5) & 0xFFFFFFFF;
20974    var reader = new Reader(data, start + 9, end);
20975    var prefixSizeBits = (flags >> 1 & 7) + 1;
20976    var rangeSizeBits = (flags >> 4 & 7) + 1;
20977    var lines = [];
20978    var prefixLength,
20979        rangeLength,
20980        currentRangeLow = lowestValue;
20981
20982    do {
20983      prefixLength = reader.readBits(prefixSizeBits);
20984      rangeLength = reader.readBits(rangeSizeBits);
20985      lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0]));
20986      currentRangeLow += 1 << rangeLength;
20987    } while (currentRangeLow < highestValue);
20988
20989    prefixLength = reader.readBits(prefixSizeBits);
20990    lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, 'lower']));
20991    prefixLength = reader.readBits(prefixSizeBits);
20992    lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0]));
20993
20994    if (flags & 1) {
20995      prefixLength = reader.readBits(prefixSizeBits);
20996      lines.push(new HuffmanLine([prefixLength, 0]));
20997    }
20998
20999    return new HuffmanTable(lines, false);
21000  }
21001
21002  var standardTablesCache = {};
21003
21004  function getStandardTable(number) {
21005    var table = standardTablesCache[number];
21006
21007    if (table) {
21008      return table;
21009    }
21010
21011    var lines;
21012
21013    switch (number) {
21014      case 1:
21015        lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]];
21016        break;
21017
21018      case 2:
21019        lines = [[0, 1, 0, 0x0], [1, 2, 0, 0x2], [2, 3, 0, 0x6], [3, 4, 3, 0xE], [11, 5, 6, 0x1E], [75, 6, 32, 0x3E], [6, 0x3F]];
21020        break;
21021
21022      case 3:
21023        lines = [[-256, 8, 8, 0xFE], [0, 1, 0, 0x0], [1, 2, 0, 0x2], [2, 3, 0, 0x6], [3, 4, 3, 0xE], [11, 5, 6, 0x1E], [-257, 8, 32, 0xFF, 'lower'], [75, 7, 32, 0x7E], [6, 0x3E]];
21024        break;
21025
21026      case 4:
21027        lines = [[1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 0, 0x6], [4, 4, 3, 0xE], [12, 5, 6, 0x1E], [76, 5, 32, 0x1F]];
21028        break;
21029
21030      case 5:
21031        lines = [[-255, 7, 8, 0x7E], [1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 0, 0x6], [4, 4, 3, 0xE], [12, 5, 6, 0x1E], [-256, 7, 32, 0x7F, 'lower'], [76, 6, 32, 0x3E]];
21032        break;
21033
21034      case 6:
21035        lines = [[-2048, 5, 10, 0x1C], [-1024, 4, 9, 0x8], [-512, 4, 8, 0x9], [-256, 4, 7, 0xA], [-128, 5, 6, 0x1D], [-64, 5, 5, 0x1E], [-32, 4, 5, 0xB], [0, 2, 7, 0x0], [128, 3, 7, 0x2], [256, 3, 8, 0x3], [512, 4, 9, 0xC], [1024, 4, 10, 0xD], [-2049, 6, 32, 0x3E, 'lower'], [2048, 6, 32, 0x3F]];
21036        break;
21037
21038      case 7:
21039        lines = [[-1024, 4, 9, 0x8], [-512, 3, 8, 0x0], [-256, 4, 7, 0x9], [-128, 5, 6, 0x1A], [-64, 5, 5, 0x1B], [-32, 4, 5, 0xA], [0, 4, 5, 0xB], [32, 5, 5, 0x1C], [64, 5, 6, 0x1D], [128, 4, 7, 0xC], [256, 3, 8, 0x1], [512, 3, 9, 0x2], [1024, 3, 10, 0x3], [-1025, 5, 32, 0x1E, 'lower'], [2048, 5, 32, 0x1F]];
21040        break;
21041
21042      case 8:
21043        lines = [[-15, 8, 3, 0xFC], [-7, 9, 1, 0x1FC], [-5, 8, 1, 0xFD], [-3, 9, 0, 0x1FD], [-2, 7, 0, 0x7C], [-1, 4, 0, 0xA], [0, 2, 1, 0x0], [2, 5, 0, 0x1A], [3, 6, 0, 0x3A], [4, 3, 4, 0x4], [20, 6, 1, 0x3B], [22, 4, 4, 0xB], [38, 4, 5, 0xC], [70, 5, 6, 0x1B], [134, 5, 7, 0x1C], [262, 6, 7, 0x3C], [390, 7, 8, 0x7D], [646, 6, 10, 0x3D], [-16, 9, 32, 0x1FE, 'lower'], [1670, 9, 32, 0x1FF], [2, 0x1]];
21044        break;
21045
21046      case 9:
21047        lines = [[-31, 8, 4, 0xFC], [-15, 9, 2, 0x1FC], [-11, 8, 2, 0xFD], [-7, 9, 1, 0x1FD], [-5, 7, 1, 0x7C], [-3, 4, 1, 0xA], [-1, 3, 1, 0x2], [1, 3, 1, 0x3], [3, 5, 1, 0x1A], [5, 6, 1, 0x3A], [7, 3, 5, 0x4], [39, 6, 2, 0x3B], [43, 4, 5, 0xB], [75, 4, 6, 0xC], [139, 5, 7, 0x1B], [267, 5, 8, 0x1C], [523, 6, 8, 0x3C], [779, 7, 9, 0x7D], [1291, 6, 11, 0x3D], [-32, 9, 32, 0x1FE, 'lower'], [3339, 9, 32, 0x1FF], [2, 0x0]];
21048        break;
21049
21050      case 10:
21051        lines = [[-21, 7, 4, 0x7A], [-5, 8, 0, 0xFC], [-4, 7, 0, 0x7B], [-3, 5, 0, 0x18], [-2, 2, 2, 0x0], [2, 5, 0, 0x19], [3, 6, 0, 0x36], [4, 7, 0, 0x7C], [5, 8, 0, 0xFD], [6, 2, 6, 0x1], [70, 5, 5, 0x1A], [102, 6, 5, 0x37], [134, 6, 6, 0x38], [198, 6, 7, 0x39], [326, 6, 8, 0x3A], [582, 6, 9, 0x3B], [1094, 6, 10, 0x3C], [2118, 7, 11, 0x7D], [-22, 8, 32, 0xFE, 'lower'], [4166, 8, 32, 0xFF], [2, 0x2]];
21052        break;
21053
21054      case 11:
21055        lines = [[1, 1, 0, 0x0], [2, 2, 1, 0x2], [4, 4, 0, 0xC], [5, 4, 1, 0xD], [7, 5, 1, 0x1C], [9, 5, 2, 0x1D], [13, 6, 2, 0x3C], [17, 7, 2, 0x7A], [21, 7, 3, 0x7B], [29, 7, 4, 0x7C], [45, 7, 5, 0x7D], [77, 7, 6, 0x7E], [141, 7, 32, 0x7F]];
21056        break;
21057
21058      case 12:
21059        lines = [[1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 1, 0x6], [5, 5, 0, 0x1C], [6, 5, 1, 0x1D], [8, 6, 1, 0x3C], [10, 7, 0, 0x7A], [11, 7, 1, 0x7B], [13, 7, 2, 0x7C], [17, 7, 3, 0x7D], [25, 7, 4, 0x7E], [41, 8, 5, 0xFE], [73, 8, 32, 0xFF]];
21060        break;
21061
21062      case 13:
21063        lines = [[1, 1, 0, 0x0], [2, 3, 0, 0x4], [3, 4, 0, 0xC], [4, 5, 0, 0x1C], [5, 4, 1, 0xD], [7, 3, 3, 0x5], [15, 6, 1, 0x3A], [17, 6, 2, 0x3B], [21, 6, 3, 0x3C], [29, 6, 4, 0x3D], [45, 6, 5, 0x3E], [77, 7, 6, 0x7E], [141, 7, 32, 0x7F]];
21064        break;
21065
21066      case 14:
21067        lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]];
21068        break;
21069
21070      case 15:
21071        lines = [[-24, 7, 4, 0x7C], [-8, 6, 2, 0x3C], [-4, 5, 1, 0x1C], [-2, 4, 0, 0xC], [-1, 3, 0, 0x4], [0, 1, 0, 0x0], [1, 3, 0, 0x5], [2, 4, 0, 0xD], [3, 5, 1, 0x1D], [5, 6, 2, 0x3D], [9, 7, 4, 0x7D], [-25, 7, 32, 0x7E, 'lower'], [25, 7, 32, 0x7F]];
21072        break;
21073
21074      default:
21075        throw new Jbig2Error("standard table B.".concat(number, " does not exist"));
21076    }
21077
21078    var length = lines.length,
21079        i;
21080
21081    for (i = 0; i < length; i++) {
21082      lines[i] = new HuffmanLine(lines[i]);
21083    }
21084
21085    table = new HuffmanTable(lines, true);
21086    standardTablesCache[number] = table;
21087    return table;
21088  }
21089
21090  function Reader(data, start, end) {
21091    this.data = data;
21092    this.start = start;
21093    this.end = end;
21094    this.position = start;
21095    this.shift = -1;
21096    this.currentByte = 0;
21097  }
21098
21099  Reader.prototype = {
21100    readBit: function readBit() {
21101      if (this.shift < 0) {
21102        if (this.position >= this.end) {
21103          throw new Jbig2Error('end of data while reading bit');
21104        }
21105
21106        this.currentByte = this.data[this.position++];
21107        this.shift = 7;
21108      }
21109
21110      var bit = this.currentByte >> this.shift & 1;
21111      this.shift--;
21112      return bit;
21113    },
21114    readBits: function readBits(numBits) {
21115      var result = 0,
21116          i;
21117
21118      for (i = numBits - 1; i >= 0; i--) {
21119        result |= this.readBit() << i;
21120      }
21121
21122      return result;
21123    },
21124    byteAlign: function byteAlign() {
21125      this.shift = -1;
21126    },
21127    next: function next() {
21128      if (this.position >= this.end) {
21129        return -1;
21130      }
21131
21132      return this.data[this.position++];
21133    }
21134  };
21135
21136  function getCustomHuffmanTable(index, referredTo, customTables) {
21137    var currentIndex = 0,
21138        i,
21139        ii = referredTo.length,
21140        table;
21141
21142    for (i = 0; i < ii; i++) {
21143      table = customTables[referredTo[i]];
21144
21145      if (table) {
21146        if (index === currentIndex) {
21147          return table;
21148        }
21149
21150        currentIndex++;
21151      }
21152    }
21153
21154    throw new Jbig2Error('can\'t find custom Huffman table');
21155  }
21156
21157  function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) {
21158    var codes = [],
21159        i,
21160        codeLength;
21161
21162    for (i = 0; i <= 34; i++) {
21163      codeLength = reader.readBits(4);
21164      codes.push(new HuffmanLine([i, codeLength, 0, 0]));
21165    }
21166
21167    var runCodesTable = new HuffmanTable(codes, false);
21168    codes.length = 0;
21169
21170    for (i = 0; i < numberOfSymbols;) {
21171      codeLength = runCodesTable.decode(reader);
21172
21173      if (codeLength >= 32) {
21174        var repeatedLength = void 0,
21175            numberOfRepeats = void 0,
21176            j = void 0;
21177
21178        switch (codeLength) {
21179          case 32:
21180            if (i === 0) {
21181              throw new Jbig2Error('no previous value in symbol ID table');
21182            }
21183
21184            numberOfRepeats = reader.readBits(2) + 3;
21185            repeatedLength = codes[i - 1].prefixLength;
21186            break;
21187
21188          case 33:
21189            numberOfRepeats = reader.readBits(3) + 3;
21190            repeatedLength = 0;
21191            break;
21192
21193          case 34:
21194            numberOfRepeats = reader.readBits(7) + 11;
21195            repeatedLength = 0;
21196            break;
21197
21198          default:
21199            throw new Jbig2Error('invalid code length in symbol ID table');
21200        }
21201
21202        for (j = 0; j < numberOfRepeats; j++) {
21203          codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));
21204          i++;
21205        }
21206      } else {
21207        codes.push(new HuffmanLine([i, codeLength, 0, 0]));
21208        i++;
21209      }
21210    }
21211
21212    reader.byteAlign();
21213    var symbolIDTable = new HuffmanTable(codes, false);
21214    var customIndex = 0,
21215        tableFirstS,
21216        tableDeltaS,
21217        tableDeltaT;
21218
21219    switch (textRegion.huffmanFS) {
21220      case 0:
21221      case 1:
21222        tableFirstS = getStandardTable(textRegion.huffmanFS + 6);
21223        break;
21224
21225      case 3:
21226        tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables);
21227        customIndex++;
21228        break;
21229
21230      default:
21231        throw new Jbig2Error('invalid Huffman FS selector');
21232    }
21233
21234    switch (textRegion.huffmanDS) {
21235      case 0:
21236      case 1:
21237      case 2:
21238        tableDeltaS = getStandardTable(textRegion.huffmanDS + 8);
21239        break;
21240
21241      case 3:
21242        tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables);
21243        customIndex++;
21244        break;
21245
21246      default:
21247        throw new Jbig2Error('invalid Huffman DS selector');
21248    }
21249
21250    switch (textRegion.huffmanDT) {
21251      case 0:
21252      case 1:
21253      case 2:
21254        tableDeltaT = getStandardTable(textRegion.huffmanDT + 11);
21255        break;
21256
21257      case 3:
21258        tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables);
21259        customIndex++;
21260        break;
21261
21262      default:
21263        throw new Jbig2Error('invalid Huffman DT selector');
21264    }
21265
21266    if (textRegion.refinement) {
21267      throw new Jbig2Error('refinement with Huffman is not supported');
21268    }
21269
21270    return {
21271      symbolIDTable: symbolIDTable,
21272      tableFirstS: tableFirstS,
21273      tableDeltaS: tableDeltaS,
21274      tableDeltaT: tableDeltaT
21275    };
21276  }
21277
21278  function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {
21279    var customIndex = 0,
21280        tableDeltaHeight,
21281        tableDeltaWidth;
21282
21283    switch (dictionary.huffmanDHSelector) {
21284      case 0:
21285      case 1:
21286        tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4);
21287        break;
21288
21289      case 3:
21290        tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables);
21291        customIndex++;
21292        break;
21293
21294      default:
21295        throw new Jbig2Error('invalid Huffman DH selector');
21296    }
21297
21298    switch (dictionary.huffmanDWSelector) {
21299      case 0:
21300      case 1:
21301        tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2);
21302        break;
21303
21304      case 3:
21305        tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables);
21306        customIndex++;
21307        break;
21308
21309      default:
21310        throw new Jbig2Error('invalid Huffman DW selector');
21311    }
21312
21313    var tableBitmapSize, tableAggregateInstances;
21314
21315    if (dictionary.bitmapSizeSelector) {
21316      tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables);
21317      customIndex++;
21318    } else {
21319      tableBitmapSize = getStandardTable(1);
21320    }
21321
21322    if (dictionary.aggregationInstancesSelector) {
21323      tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables);
21324    } else {
21325      tableAggregateInstances = getStandardTable(1);
21326    }
21327
21328    return {
21329      tableDeltaHeight: tableDeltaHeight,
21330      tableDeltaWidth: tableDeltaWidth,
21331      tableBitmapSize: tableBitmapSize,
21332      tableAggregateInstances: tableAggregateInstances
21333    };
21334  }
21335
21336  function readUncompressedBitmap(reader, width, height) {
21337    var bitmap = [],
21338        x,
21339        y,
21340        row;
21341
21342    for (y = 0; y < height; y++) {
21343      row = new Uint8Array(width);
21344      bitmap.push(row);
21345
21346      for (x = 0; x < width; x++) {
21347        row[x] = reader.readBit();
21348      }
21349
21350      reader.byteAlign();
21351    }
21352
21353    return bitmap;
21354  }
21355
21356  function decodeMMRBitmap(input, width, height, endOfBlock) {
21357    var params = {
21358      K: -1,
21359      Columns: width,
21360      Rows: height,
21361      BlackIs1: true,
21362      EndOfBlock: endOfBlock
21363    };
21364    var decoder = new _ccitt.CCITTFaxDecoder(input, params);
21365    var bitmap = [],
21366        x,
21367        y,
21368        row,
21369        currentByte,
21370        shift,
21371        eof = false;
21372
21373    for (y = 0; y < height; y++) {
21374      row = new Uint8Array(width);
21375      bitmap.push(row);
21376      shift = -1;
21377
21378      for (x = 0; x < width; x++) {
21379        if (shift < 0) {
21380          currentByte = decoder.readNextChar();
21381
21382          if (currentByte === -1) {
21383            currentByte = 0;
21384            eof = true;
21385          }
21386
21387          shift = 7;
21388        }
21389
21390        row[x] = currentByte >> shift & 1;
21391        shift--;
21392      }
21393    }
21394
21395    if (endOfBlock && !eof) {
21396      var lookForEOFLimit = 5;
21397
21398      for (var i = 0; i < lookForEOFLimit; i++) {
21399        if (decoder.readNextChar() === -1) {
21400          break;
21401        }
21402      }
21403    }
21404
21405    return bitmap;
21406  }
21407
21408  function Jbig2Image() {}
21409
21410  Jbig2Image.prototype = {
21411    parseChunks: function parseChunks(chunks) {
21412      return parseJbig2Chunks(chunks);
21413    },
21414    parse: function parse(data) {
21415      var _parseJbig = parseJbig2(data),
21416          imgData = _parseJbig.imgData,
21417          width = _parseJbig.width,
21418          height = _parseJbig.height;
21419
21420      this.width = width;
21421      this.height = height;
21422      return imgData;
21423    }
21424  };
21425  return Jbig2Image;
21426}();
21427
21428exports.Jbig2Image = Jbig2Image;
21429
21430/***/ }),
21431/* 163 */
21432/***/ (function(module, exports, __w_pdfjs_require__) {
21433
21434"use strict";
21435
21436
21437Object.defineProperty(exports, "__esModule", {
21438  value: true
21439});
21440exports.ArithmeticDecoder = void 0;
21441
21442function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
21443
21444function _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); } }
21445
21446function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
21447
21448var QeTable = [{
21449  qe: 0x5601,
21450  nmps: 1,
21451  nlps: 1,
21452  switchFlag: 1
21453}, {
21454  qe: 0x3401,
21455  nmps: 2,
21456  nlps: 6,
21457  switchFlag: 0
21458}, {
21459  qe: 0x1801,
21460  nmps: 3,
21461  nlps: 9,
21462  switchFlag: 0
21463}, {
21464  qe: 0x0AC1,
21465  nmps: 4,
21466  nlps: 12,
21467  switchFlag: 0
21468}, {
21469  qe: 0x0521,
21470  nmps: 5,
21471  nlps: 29,
21472  switchFlag: 0
21473}, {
21474  qe: 0x0221,
21475  nmps: 38,
21476  nlps: 33,
21477  switchFlag: 0
21478}, {
21479  qe: 0x5601,
21480  nmps: 7,
21481  nlps: 6,
21482  switchFlag: 1
21483}, {
21484  qe: 0x5401,
21485  nmps: 8,
21486  nlps: 14,
21487  switchFlag: 0
21488}, {
21489  qe: 0x4801,
21490  nmps: 9,
21491  nlps: 14,
21492  switchFlag: 0
21493}, {
21494  qe: 0x3801,
21495  nmps: 10,
21496  nlps: 14,
21497  switchFlag: 0
21498}, {
21499  qe: 0x3001,
21500  nmps: 11,
21501  nlps: 17,
21502  switchFlag: 0
21503}, {
21504  qe: 0x2401,
21505  nmps: 12,
21506  nlps: 18,
21507  switchFlag: 0
21508}, {
21509  qe: 0x1C01,
21510  nmps: 13,
21511  nlps: 20,
21512  switchFlag: 0
21513}, {
21514  qe: 0x1601,
21515  nmps: 29,
21516  nlps: 21,
21517  switchFlag: 0
21518}, {
21519  qe: 0x5601,
21520  nmps: 15,
21521  nlps: 14,
21522  switchFlag: 1
21523}, {
21524  qe: 0x5401,
21525  nmps: 16,
21526  nlps: 14,
21527  switchFlag: 0
21528}, {
21529  qe: 0x5101,
21530  nmps: 17,
21531  nlps: 15,
21532  switchFlag: 0
21533}, {
21534  qe: 0x4801,
21535  nmps: 18,
21536  nlps: 16,
21537  switchFlag: 0
21538}, {
21539  qe: 0x3801,
21540  nmps: 19,
21541  nlps: 17,
21542  switchFlag: 0
21543}, {
21544  qe: 0x3401,
21545  nmps: 20,
21546  nlps: 18,
21547  switchFlag: 0
21548}, {
21549  qe: 0x3001,
21550  nmps: 21,
21551  nlps: 19,
21552  switchFlag: 0
21553}, {
21554  qe: 0x2801,
21555  nmps: 22,
21556  nlps: 19,
21557  switchFlag: 0
21558}, {
21559  qe: 0x2401,
21560  nmps: 23,
21561  nlps: 20,
21562  switchFlag: 0
21563}, {
21564  qe: 0x2201,
21565  nmps: 24,
21566  nlps: 21,
21567  switchFlag: 0
21568}, {
21569  qe: 0x1C01,
21570  nmps: 25,
21571  nlps: 22,
21572  switchFlag: 0
21573}, {
21574  qe: 0x1801,
21575  nmps: 26,
21576  nlps: 23,
21577  switchFlag: 0
21578}, {
21579  qe: 0x1601,
21580  nmps: 27,
21581  nlps: 24,
21582  switchFlag: 0
21583}, {
21584  qe: 0x1401,
21585  nmps: 28,
21586  nlps: 25,
21587  switchFlag: 0
21588}, {
21589  qe: 0x1201,
21590  nmps: 29,
21591  nlps: 26,
21592  switchFlag: 0
21593}, {
21594  qe: 0x1101,
21595  nmps: 30,
21596  nlps: 27,
21597  switchFlag: 0
21598}, {
21599  qe: 0x0AC1,
21600  nmps: 31,
21601  nlps: 28,
21602  switchFlag: 0
21603}, {
21604  qe: 0x09C1,
21605  nmps: 32,
21606  nlps: 29,
21607  switchFlag: 0
21608}, {
21609  qe: 0x08A1,
21610  nmps: 33,
21611  nlps: 30,
21612  switchFlag: 0
21613}, {
21614  qe: 0x0521,
21615  nmps: 34,
21616  nlps: 31,
21617  switchFlag: 0
21618}, {
21619  qe: 0x0441,
21620  nmps: 35,
21621  nlps: 32,
21622  switchFlag: 0
21623}, {
21624  qe: 0x02A1,
21625  nmps: 36,
21626  nlps: 33,
21627  switchFlag: 0
21628}, {
21629  qe: 0x0221,
21630  nmps: 37,
21631  nlps: 34,
21632  switchFlag: 0
21633}, {
21634  qe: 0x0141,
21635  nmps: 38,
21636  nlps: 35,
21637  switchFlag: 0
21638}, {
21639  qe: 0x0111,
21640  nmps: 39,
21641  nlps: 36,
21642  switchFlag: 0
21643}, {
21644  qe: 0x0085,
21645  nmps: 40,
21646  nlps: 37,
21647  switchFlag: 0
21648}, {
21649  qe: 0x0049,
21650  nmps: 41,
21651  nlps: 38,
21652  switchFlag: 0
21653}, {
21654  qe: 0x0025,
21655  nmps: 42,
21656  nlps: 39,
21657  switchFlag: 0
21658}, {
21659  qe: 0x0015,
21660  nmps: 43,
21661  nlps: 40,
21662  switchFlag: 0
21663}, {
21664  qe: 0x0009,
21665  nmps: 44,
21666  nlps: 41,
21667  switchFlag: 0
21668}, {
21669  qe: 0x0005,
21670  nmps: 45,
21671  nlps: 42,
21672  switchFlag: 0
21673}, {
21674  qe: 0x0001,
21675  nmps: 45,
21676  nlps: 43,
21677  switchFlag: 0
21678}, {
21679  qe: 0x5601,
21680  nmps: 46,
21681  nlps: 46,
21682  switchFlag: 0
21683}];
21684
21685var ArithmeticDecoder =
21686/*#__PURE__*/
21687function () {
21688  function ArithmeticDecoder(data, start, end) {
21689    _classCallCheck(this, ArithmeticDecoder);
21690
21691    this.data = data;
21692    this.bp = start;
21693    this.dataEnd = end;
21694    this.chigh = data[start];
21695    this.clow = 0;
21696    this.byteIn();
21697    this.chigh = this.chigh << 7 & 0xFFFF | this.clow >> 9 & 0x7F;
21698    this.clow = this.clow << 7 & 0xFFFF;
21699    this.ct -= 7;
21700    this.a = 0x8000;
21701  }
21702
21703  _createClass(ArithmeticDecoder, [{
21704    key: "byteIn",
21705    value: function byteIn() {
21706      var data = this.data;
21707      var bp = this.bp;
21708
21709      if (data[bp] === 0xFF) {
21710        if (data[bp + 1] > 0x8F) {
21711          this.clow += 0xFF00;
21712          this.ct = 8;
21713        } else {
21714          bp++;
21715          this.clow += data[bp] << 9;
21716          this.ct = 7;
21717          this.bp = bp;
21718        }
21719      } else {
21720        bp++;
21721        this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xFF00;
21722        this.ct = 8;
21723        this.bp = bp;
21724      }
21725
21726      if (this.clow > 0xFFFF) {
21727        this.chigh += this.clow >> 16;
21728        this.clow &= 0xFFFF;
21729      }
21730    }
21731  }, {
21732    key: "readBit",
21733    value: function readBit(contexts, pos) {
21734      var cx_index = contexts[pos] >> 1,
21735          cx_mps = contexts[pos] & 1;
21736      var qeTableIcx = QeTable[cx_index];
21737      var qeIcx = qeTableIcx.qe;
21738      var d;
21739      var a = this.a - qeIcx;
21740
21741      if (this.chigh < qeIcx) {
21742        if (a < qeIcx) {
21743          a = qeIcx;
21744          d = cx_mps;
21745          cx_index = qeTableIcx.nmps;
21746        } else {
21747          a = qeIcx;
21748          d = 1 ^ cx_mps;
21749
21750          if (qeTableIcx.switchFlag === 1) {
21751            cx_mps = d;
21752          }
21753
21754          cx_index = qeTableIcx.nlps;
21755        }
21756      } else {
21757        this.chigh -= qeIcx;
21758
21759        if ((a & 0x8000) !== 0) {
21760          this.a = a;
21761          return cx_mps;
21762        }
21763
21764        if (a < qeIcx) {
21765          d = 1 ^ cx_mps;
21766
21767          if (qeTableIcx.switchFlag === 1) {
21768            cx_mps = d;
21769          }
21770
21771          cx_index = qeTableIcx.nlps;
21772        } else {
21773          d = cx_mps;
21774          cx_index = qeTableIcx.nmps;
21775        }
21776      }
21777
21778      do {
21779        if (this.ct === 0) {
21780          this.byteIn();
21781        }
21782
21783        a <<= 1;
21784        this.chigh = this.chigh << 1 & 0xFFFF | this.clow >> 15 & 1;
21785        this.clow = this.clow << 1 & 0xFFFF;
21786        this.ct--;
21787      } while ((a & 0x8000) === 0);
21788
21789      this.a = a;
21790      contexts[pos] = cx_index << 1 | cx_mps;
21791      return d;
21792    }
21793  }]);
21794
21795  return ArithmeticDecoder;
21796}();
21797
21798exports.ArithmeticDecoder = ArithmeticDecoder;
21799
21800/***/ }),
21801/* 164 */
21802/***/ (function(module, exports, __w_pdfjs_require__) {
21803
21804"use strict";
21805
21806
21807Object.defineProperty(exports, "__esModule", {
21808  value: true
21809});
21810exports.JpegStream = void 0;
21811
21812var _util = __w_pdfjs_require__(5);
21813
21814var _stream = __w_pdfjs_require__(158);
21815
21816var _primitives = __w_pdfjs_require__(151);
21817
21818var _jpg = __w_pdfjs_require__(165);
21819
21820var JpegStream = function JpegStreamClosure() {
21821  function JpegStream(stream, maybeLength, dict, params) {
21822    var ch;
21823
21824    while ((ch = stream.getByte()) !== -1) {
21825      if (ch === 0xFF) {
21826        stream.skip(-1);
21827        break;
21828      }
21829    }
21830
21831    this.stream = stream;
21832    this.maybeLength = maybeLength;
21833    this.dict = dict;
21834    this.params = params;
21835
21836    _stream.DecodeStream.call(this, maybeLength);
21837  }
21838
21839  JpegStream.prototype = Object.create(_stream.DecodeStream.prototype);
21840  Object.defineProperty(JpegStream.prototype, 'bytes', {
21841    get: function JpegStream_bytes() {
21842      return (0, _util.shadow)(this, 'bytes', this.stream.getBytes(this.maybeLength));
21843    },
21844    configurable: true
21845  });
21846
21847  JpegStream.prototype.ensureBuffer = function (requested) {};
21848
21849  JpegStream.prototype.readBlock = function () {
21850    if (this.eof) {
21851      return;
21852    }
21853
21854    var jpegOptions = {
21855      decodeTransform: undefined,
21856      colorTransform: undefined
21857    };
21858    var decodeArr = this.dict.getArray('Decode', 'D');
21859
21860    if (this.forceRGB && Array.isArray(decodeArr)) {
21861      var bitsPerComponent = this.dict.get('BitsPerComponent') || 8;
21862      var decodeArrLength = decodeArr.length;
21863      var transform = new Int32Array(decodeArrLength);
21864      var transformNeeded = false;
21865      var maxValue = (1 << bitsPerComponent) - 1;
21866
21867      for (var i = 0; i < decodeArrLength; i += 2) {
21868        transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
21869        transform[i + 1] = decodeArr[i] * maxValue | 0;
21870
21871        if (transform[i] !== 256 || transform[i + 1] !== 0) {
21872          transformNeeded = true;
21873        }
21874      }
21875
21876      if (transformNeeded) {
21877        jpegOptions.decodeTransform = transform;
21878      }
21879    }
21880
21881    if ((0, _primitives.isDict)(this.params)) {
21882      var colorTransform = this.params.get('ColorTransform');
21883
21884      if (Number.isInteger(colorTransform)) {
21885        jpegOptions.colorTransform = colorTransform;
21886      }
21887    }
21888
21889    var jpegImage = new _jpg.JpegImage(jpegOptions);
21890    jpegImage.parse(this.bytes);
21891    var data = jpegImage.getData({
21892      width: this.drawWidth,
21893      height: this.drawHeight,
21894      forceRGB: this.forceRGB,
21895      isSourcePDF: true
21896    });
21897    this.buffer = data;
21898    this.bufferLength = data.length;
21899    this.eof = true;
21900  };
21901
21902  JpegStream.prototype.getIR = function () {
21903    var forceDataSchema = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
21904    return (0, _util.createObjectURL)(this.bytes, 'image/jpeg', forceDataSchema);
21905  };
21906
21907  return JpegStream;
21908}();
21909
21910exports.JpegStream = JpegStream;
21911
21912/***/ }),
21913/* 165 */
21914/***/ (function(module, exports, __w_pdfjs_require__) {
21915
21916"use strict";
21917
21918
21919Object.defineProperty(exports, "__esModule", {
21920  value: true
21921});
21922exports.JpegImage = void 0;
21923
21924var _util = __w_pdfjs_require__(5);
21925
21926function _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); }
21927
21928var JpegError = function JpegErrorClosure() {
21929  function JpegError(msg) {
21930    this.message = 'JPEG error: ' + msg;
21931  }
21932
21933  JpegError.prototype = new Error();
21934  JpegError.prototype.name = 'JpegError';
21935  JpegError.constructor = JpegError;
21936  return JpegError;
21937}();
21938
21939var DNLMarkerError = function DNLMarkerErrorClosure() {
21940  function DNLMarkerError(message, scanLines) {
21941    this.message = message;
21942    this.scanLines = scanLines;
21943  }
21944
21945  DNLMarkerError.prototype = new Error();
21946  DNLMarkerError.prototype.name = 'DNLMarkerError';
21947  DNLMarkerError.constructor = DNLMarkerError;
21948  return DNLMarkerError;
21949}();
21950
21951var EOIMarkerError = function EOIMarkerErrorClosure() {
21952  function EOIMarkerError(message) {
21953    this.message = message;
21954  }
21955
21956  EOIMarkerError.prototype = new Error();
21957  EOIMarkerError.prototype.name = 'EOIMarkerError';
21958  EOIMarkerError.constructor = EOIMarkerError;
21959  return EOIMarkerError;
21960}();
21961
21962var JpegImage = function JpegImageClosure() {
21963  var dctZigZag = new Uint8Array([0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63]);
21964  var dctCos1 = 4017;
21965  var dctSin1 = 799;
21966  var dctCos3 = 3406;
21967  var dctSin3 = 2276;
21968  var dctCos6 = 1567;
21969  var dctSin6 = 3784;
21970  var dctSqrt2 = 5793;
21971  var dctSqrt1d2 = 2896;
21972
21973  function JpegImage() {
21974    var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
21975        _ref$decodeTransform = _ref.decodeTransform,
21976        decodeTransform = _ref$decodeTransform === void 0 ? null : _ref$decodeTransform,
21977        _ref$colorTransform = _ref.colorTransform,
21978        colorTransform = _ref$colorTransform === void 0 ? -1 : _ref$colorTransform;
21979
21980    this._decodeTransform = decodeTransform;
21981    this._colorTransform = colorTransform;
21982  }
21983
21984  function buildHuffmanTable(codeLengths, values) {
21985    var k = 0,
21986        code = [],
21987        i,
21988        j,
21989        length = 16;
21990
21991    while (length > 0 && !codeLengths[length - 1]) {
21992      length--;
21993    }
21994
21995    code.push({
21996      children: [],
21997      index: 0
21998    });
21999    var p = code[0],
22000        q;
22001
22002    for (i = 0; i < length; i++) {
22003      for (j = 0; j < codeLengths[i]; j++) {
22004        p = code.pop();
22005        p.children[p.index] = values[k];
22006
22007        while (p.index > 0) {
22008          p = code.pop();
22009        }
22010
22011        p.index++;
22012        code.push(p);
22013
22014        while (code.length <= i) {
22015          code.push(q = {
22016            children: [],
22017            index: 0
22018          });
22019          p.children[p.index] = q.children;
22020          p = q;
22021        }
22022
22023        k++;
22024      }
22025
22026      if (i + 1 < length) {
22027        code.push(q = {
22028          children: [],
22029          index: 0
22030        });
22031        p.children[p.index] = q.children;
22032        p = q;
22033      }
22034    }
22035
22036    return code[0].children;
22037  }
22038
22039  function getBlockBufferOffset(component, row, col) {
22040    return 64 * ((component.blocksPerLine + 1) * row + col);
22041  }
22042
22043  function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive) {
22044    var parseDNLMarker = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
22045    var mcusPerLine = frame.mcusPerLine;
22046    var progressive = frame.progressive;
22047    var startOffset = offset,
22048        bitsData = 0,
22049        bitsCount = 0;
22050
22051    function readBit() {
22052      if (bitsCount > 0) {
22053        bitsCount--;
22054        return bitsData >> bitsCount & 1;
22055      }
22056
22057      bitsData = data[offset++];
22058
22059      if (bitsData === 0xFF) {
22060        var nextByte = data[offset++];
22061
22062        if (nextByte) {
22063          if (nextByte === 0xDC && parseDNLMarker) {
22064            offset += 2;
22065            var scanLines = data[offset++] << 8 | data[offset++];
22066
22067            if (scanLines > 0 && scanLines !== frame.scanLines) {
22068              throw new DNLMarkerError('Found DNL marker (0xFFDC) while parsing scan data', scanLines);
22069            }
22070          } else if (nextByte === 0xD9) {
22071            throw new EOIMarkerError('Found EOI marker (0xFFD9) while parsing scan data');
22072          }
22073
22074          throw new JpegError("unexpected marker ".concat((bitsData << 8 | nextByte).toString(16)));
22075        }
22076      }
22077
22078      bitsCount = 7;
22079      return bitsData >>> 7;
22080    }
22081
22082    function decodeHuffman(tree) {
22083      var node = tree;
22084
22085      while (true) {
22086        node = node[readBit()];
22087
22088        if (typeof node === 'number') {
22089          return node;
22090        }
22091
22092        if (_typeof(node) !== 'object') {
22093          throw new JpegError('invalid huffman sequence');
22094        }
22095      }
22096    }
22097
22098    function receive(length) {
22099      var n = 0;
22100
22101      while (length > 0) {
22102        n = n << 1 | readBit();
22103        length--;
22104      }
22105
22106      return n;
22107    }
22108
22109    function receiveAndExtend(length) {
22110      if (length === 1) {
22111        return readBit() === 1 ? 1 : -1;
22112      }
22113
22114      var n = receive(length);
22115
22116      if (n >= 1 << length - 1) {
22117        return n;
22118      }
22119
22120      return n + (-1 << length) + 1;
22121    }
22122
22123    function decodeBaseline(component, offset) {
22124      var t = decodeHuffman(component.huffmanTableDC);
22125      var diff = t === 0 ? 0 : receiveAndExtend(t);
22126      component.blockData[offset] = component.pred += diff;
22127      var k = 1;
22128
22129      while (k < 64) {
22130        var rs = decodeHuffman(component.huffmanTableAC);
22131        var s = rs & 15,
22132            r = rs >> 4;
22133
22134        if (s === 0) {
22135          if (r < 15) {
22136            break;
22137          }
22138
22139          k += 16;
22140          continue;
22141        }
22142
22143        k += r;
22144        var z = dctZigZag[k];
22145        component.blockData[offset + z] = receiveAndExtend(s);
22146        k++;
22147      }
22148    }
22149
22150    function decodeDCFirst(component, offset) {
22151      var t = decodeHuffman(component.huffmanTableDC);
22152      var diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
22153      component.blockData[offset] = component.pred += diff;
22154    }
22155
22156    function decodeDCSuccessive(component, offset) {
22157      component.blockData[offset] |= readBit() << successive;
22158    }
22159
22160    var eobrun = 0;
22161
22162    function decodeACFirst(component, offset) {
22163      if (eobrun > 0) {
22164        eobrun--;
22165        return;
22166      }
22167
22168      var k = spectralStart,
22169          e = spectralEnd;
22170
22171      while (k <= e) {
22172        var rs = decodeHuffman(component.huffmanTableAC);
22173        var s = rs & 15,
22174            r = rs >> 4;
22175
22176        if (s === 0) {
22177          if (r < 15) {
22178            eobrun = receive(r) + (1 << r) - 1;
22179            break;
22180          }
22181
22182          k += 16;
22183          continue;
22184        }
22185
22186        k += r;
22187        var z = dctZigZag[k];
22188        component.blockData[offset + z] = receiveAndExtend(s) * (1 << successive);
22189        k++;
22190      }
22191    }
22192
22193    var successiveACState = 0,
22194        successiveACNextValue;
22195
22196    function decodeACSuccessive(component, offset) {
22197      var k = spectralStart;
22198      var e = spectralEnd;
22199      var r = 0;
22200      var s;
22201      var rs;
22202
22203      while (k <= e) {
22204        var offsetZ = offset + dctZigZag[k];
22205        var sign = component.blockData[offsetZ] < 0 ? -1 : 1;
22206
22207        switch (successiveACState) {
22208          case 0:
22209            rs = decodeHuffman(component.huffmanTableAC);
22210            s = rs & 15;
22211            r = rs >> 4;
22212
22213            if (s === 0) {
22214              if (r < 15) {
22215                eobrun = receive(r) + (1 << r);
22216                successiveACState = 4;
22217              } else {
22218                r = 16;
22219                successiveACState = 1;
22220              }
22221            } else {
22222              if (s !== 1) {
22223                throw new JpegError('invalid ACn encoding');
22224              }
22225
22226              successiveACNextValue = receiveAndExtend(s);
22227              successiveACState = r ? 2 : 3;
22228            }
22229
22230            continue;
22231
22232          case 1:
22233          case 2:
22234            if (component.blockData[offsetZ]) {
22235              component.blockData[offsetZ] += sign * (readBit() << successive);
22236            } else {
22237              r--;
22238
22239              if (r === 0) {
22240                successiveACState = successiveACState === 2 ? 3 : 0;
22241              }
22242            }
22243
22244            break;
22245
22246          case 3:
22247            if (component.blockData[offsetZ]) {
22248              component.blockData[offsetZ] += sign * (readBit() << successive);
22249            } else {
22250              component.blockData[offsetZ] = successiveACNextValue << successive;
22251              successiveACState = 0;
22252            }
22253
22254            break;
22255
22256          case 4:
22257            if (component.blockData[offsetZ]) {
22258              component.blockData[offsetZ] += sign * (readBit() << successive);
22259            }
22260
22261            break;
22262        }
22263
22264        k++;
22265      }
22266
22267      if (successiveACState === 4) {
22268        eobrun--;
22269
22270        if (eobrun === 0) {
22271          successiveACState = 0;
22272        }
22273      }
22274    }
22275
22276    function decodeMcu(component, decode, mcu, row, col) {
22277      var mcuRow = mcu / mcusPerLine | 0;
22278      var mcuCol = mcu % mcusPerLine;
22279      var blockRow = mcuRow * component.v + row;
22280      var blockCol = mcuCol * component.h + col;
22281      var offset = getBlockBufferOffset(component, blockRow, blockCol);
22282      decode(component, offset);
22283    }
22284
22285    function decodeBlock(component, decode, mcu) {
22286      var blockRow = mcu / component.blocksPerLine | 0;
22287      var blockCol = mcu % component.blocksPerLine;
22288      var offset = getBlockBufferOffset(component, blockRow, blockCol);
22289      decode(component, offset);
22290    }
22291
22292    var componentsLength = components.length;
22293    var component, i, j, k, n;
22294    var decodeFn;
22295
22296    if (progressive) {
22297      if (spectralStart === 0) {
22298        decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
22299      } else {
22300        decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
22301      }
22302    } else {
22303      decodeFn = decodeBaseline;
22304    }
22305
22306    var mcu = 0,
22307        fileMarker;
22308    var mcuExpected;
22309
22310    if (componentsLength === 1) {
22311      mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
22312    } else {
22313      mcuExpected = mcusPerLine * frame.mcusPerColumn;
22314    }
22315
22316    var h, v;
22317
22318    while (mcu < mcuExpected) {
22319      var mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
22320
22321      for (i = 0; i < componentsLength; i++) {
22322        components[i].pred = 0;
22323      }
22324
22325      eobrun = 0;
22326
22327      if (componentsLength === 1) {
22328        component = components[0];
22329
22330        for (n = 0; n < mcuToRead; n++) {
22331          decodeBlock(component, decodeFn, mcu);
22332          mcu++;
22333        }
22334      } else {
22335        for (n = 0; n < mcuToRead; n++) {
22336          for (i = 0; i < componentsLength; i++) {
22337            component = components[i];
22338            h = component.h;
22339            v = component.v;
22340
22341            for (j = 0; j < v; j++) {
22342              for (k = 0; k < h; k++) {
22343                decodeMcu(component, decodeFn, mcu, j, k);
22344              }
22345            }
22346          }
22347
22348          mcu++;
22349        }
22350      }
22351
22352      bitsCount = 0;
22353      fileMarker = findNextFileMarker(data, offset);
22354
22355      if (fileMarker && fileMarker.invalid) {
22356        (0, _util.warn)('decodeScan - unexpected MCU data, current marker is: ' + fileMarker.invalid);
22357        offset = fileMarker.offset;
22358      }
22359
22360      var marker = fileMarker && fileMarker.marker;
22361
22362      if (!marker || marker <= 0xFF00) {
22363        throw new JpegError('marker was not found');
22364      }
22365
22366      if (marker >= 0xFFD0 && marker <= 0xFFD7) {
22367        offset += 2;
22368      } else {
22369        break;
22370      }
22371    }
22372
22373    fileMarker = findNextFileMarker(data, offset);
22374
22375    if (fileMarker && fileMarker.invalid) {
22376      (0, _util.warn)('decodeScan - unexpected Scan data, current marker is: ' + fileMarker.invalid);
22377      offset = fileMarker.offset;
22378    }
22379
22380    return offset - startOffset;
22381  }
22382
22383  function quantizeAndInverse(component, blockBufferOffset, p) {
22384    var qt = component.quantizationTable,
22385        blockData = component.blockData;
22386    var v0, v1, v2, v3, v4, v5, v6, v7;
22387    var p0, p1, p2, p3, p4, p5, p6, p7;
22388    var t;
22389
22390    if (!qt) {
22391      throw new JpegError('missing required Quantization Table.');
22392    }
22393
22394    for (var row = 0; row < 64; row += 8) {
22395      p0 = blockData[blockBufferOffset + row];
22396      p1 = blockData[blockBufferOffset + row + 1];
22397      p2 = blockData[blockBufferOffset + row + 2];
22398      p3 = blockData[blockBufferOffset + row + 3];
22399      p4 = blockData[blockBufferOffset + row + 4];
22400      p5 = blockData[blockBufferOffset + row + 5];
22401      p6 = blockData[blockBufferOffset + row + 6];
22402      p7 = blockData[blockBufferOffset + row + 7];
22403      p0 *= qt[row];
22404
22405      if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
22406        t = dctSqrt2 * p0 + 512 >> 10;
22407        p[row] = t;
22408        p[row + 1] = t;
22409        p[row + 2] = t;
22410        p[row + 3] = t;
22411        p[row + 4] = t;
22412        p[row + 5] = t;
22413        p[row + 6] = t;
22414        p[row + 7] = t;
22415        continue;
22416      }
22417
22418      p1 *= qt[row + 1];
22419      p2 *= qt[row + 2];
22420      p3 *= qt[row + 3];
22421      p4 *= qt[row + 4];
22422      p5 *= qt[row + 5];
22423      p6 *= qt[row + 6];
22424      p7 *= qt[row + 7];
22425      v0 = dctSqrt2 * p0 + 128 >> 8;
22426      v1 = dctSqrt2 * p4 + 128 >> 8;
22427      v2 = p2;
22428      v3 = p6;
22429      v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
22430      v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
22431      v5 = p3 << 4;
22432      v6 = p5 << 4;
22433      v0 = v0 + v1 + 1 >> 1;
22434      v1 = v0 - v1;
22435      t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
22436      v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
22437      v3 = t;
22438      v4 = v4 + v6 + 1 >> 1;
22439      v6 = v4 - v6;
22440      v7 = v7 + v5 + 1 >> 1;
22441      v5 = v7 - v5;
22442      v0 = v0 + v3 + 1 >> 1;
22443      v3 = v0 - v3;
22444      v1 = v1 + v2 + 1 >> 1;
22445      v2 = v1 - v2;
22446      t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
22447      v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
22448      v7 = t;
22449      t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
22450      v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
22451      v6 = t;
22452      p[row] = v0 + v7;
22453      p[row + 7] = v0 - v7;
22454      p[row + 1] = v1 + v6;
22455      p[row + 6] = v1 - v6;
22456      p[row + 2] = v2 + v5;
22457      p[row + 5] = v2 - v5;
22458      p[row + 3] = v3 + v4;
22459      p[row + 4] = v3 - v4;
22460    }
22461
22462    for (var col = 0; col < 8; ++col) {
22463      p0 = p[col];
22464      p1 = p[col + 8];
22465      p2 = p[col + 16];
22466      p3 = p[col + 24];
22467      p4 = p[col + 32];
22468      p5 = p[col + 40];
22469      p6 = p[col + 48];
22470      p7 = p[col + 56];
22471
22472      if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
22473        t = dctSqrt2 * p0 + 8192 >> 14;
22474        t = t < -2040 ? 0 : t >= 2024 ? 255 : t + 2056 >> 4;
22475        blockData[blockBufferOffset + col] = t;
22476        blockData[blockBufferOffset + col + 8] = t;
22477        blockData[blockBufferOffset + col + 16] = t;
22478        blockData[blockBufferOffset + col + 24] = t;
22479        blockData[blockBufferOffset + col + 32] = t;
22480        blockData[blockBufferOffset + col + 40] = t;
22481        blockData[blockBufferOffset + col + 48] = t;
22482        blockData[blockBufferOffset + col + 56] = t;
22483        continue;
22484      }
22485
22486      v0 = dctSqrt2 * p0 + 2048 >> 12;
22487      v1 = dctSqrt2 * p4 + 2048 >> 12;
22488      v2 = p2;
22489      v3 = p6;
22490      v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
22491      v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
22492      v5 = p3;
22493      v6 = p5;
22494      v0 = (v0 + v1 + 1 >> 1) + 4112;
22495      v1 = v0 - v1;
22496      t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
22497      v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
22498      v3 = t;
22499      v4 = v4 + v6 + 1 >> 1;
22500      v6 = v4 - v6;
22501      v7 = v7 + v5 + 1 >> 1;
22502      v5 = v7 - v5;
22503      v0 = v0 + v3 + 1 >> 1;
22504      v3 = v0 - v3;
22505      v1 = v1 + v2 + 1 >> 1;
22506      v2 = v1 - v2;
22507      t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
22508      v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
22509      v7 = t;
22510      t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
22511      v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
22512      v6 = t;
22513      p0 = v0 + v7;
22514      p7 = v0 - v7;
22515      p1 = v1 + v6;
22516      p6 = v1 - v6;
22517      p2 = v2 + v5;
22518      p5 = v2 - v5;
22519      p3 = v3 + v4;
22520      p4 = v3 - v4;
22521      p0 = p0 < 16 ? 0 : p0 >= 4080 ? 255 : p0 >> 4;
22522      p1 = p1 < 16 ? 0 : p1 >= 4080 ? 255 : p1 >> 4;
22523      p2 = p2 < 16 ? 0 : p2 >= 4080 ? 255 : p2 >> 4;
22524      p3 = p3 < 16 ? 0 : p3 >= 4080 ? 255 : p3 >> 4;
22525      p4 = p4 < 16 ? 0 : p4 >= 4080 ? 255 : p4 >> 4;
22526      p5 = p5 < 16 ? 0 : p5 >= 4080 ? 255 : p5 >> 4;
22527      p6 = p6 < 16 ? 0 : p6 >= 4080 ? 255 : p6 >> 4;
22528      p7 = p7 < 16 ? 0 : p7 >= 4080 ? 255 : p7 >> 4;
22529      blockData[blockBufferOffset + col] = p0;
22530      blockData[blockBufferOffset + col + 8] = p1;
22531      blockData[blockBufferOffset + col + 16] = p2;
22532      blockData[blockBufferOffset + col + 24] = p3;
22533      blockData[blockBufferOffset + col + 32] = p4;
22534      blockData[blockBufferOffset + col + 40] = p5;
22535      blockData[blockBufferOffset + col + 48] = p6;
22536      blockData[blockBufferOffset + col + 56] = p7;
22537    }
22538  }
22539
22540  function buildComponentData(frame, component) {
22541    var blocksPerLine = component.blocksPerLine;
22542    var blocksPerColumn = component.blocksPerColumn;
22543    var computationBuffer = new Int16Array(64);
22544
22545    for (var blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
22546      for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) {
22547        var offset = getBlockBufferOffset(component, blockRow, blockCol);
22548        quantizeAndInverse(component, offset, computationBuffer);
22549      }
22550    }
22551
22552    return component.blockData;
22553  }
22554
22555  function findNextFileMarker(data, currentPos) {
22556    var startPos = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : currentPos;
22557
22558    function peekUint16(pos) {
22559      return data[pos] << 8 | data[pos + 1];
22560    }
22561
22562    var maxPos = data.length - 1;
22563    var newPos = startPos < currentPos ? startPos : currentPos;
22564
22565    if (currentPos >= maxPos) {
22566      return null;
22567    }
22568
22569    var currentMarker = peekUint16(currentPos);
22570
22571    if (currentMarker >= 0xFFC0 && currentMarker <= 0xFFFE) {
22572      return {
22573        invalid: null,
22574        marker: currentMarker,
22575        offset: currentPos
22576      };
22577    }
22578
22579    var newMarker = peekUint16(newPos);
22580
22581    while (!(newMarker >= 0xFFC0 && newMarker <= 0xFFFE)) {
22582      if (++newPos >= maxPos) {
22583        return null;
22584      }
22585
22586      newMarker = peekUint16(newPos);
22587    }
22588
22589    return {
22590      invalid: currentMarker.toString(16),
22591      marker: newMarker,
22592      offset: newPos
22593    };
22594  }
22595
22596  JpegImage.prototype = {
22597    parse: function parse(data) {
22598      var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
22599          _ref2$dnlScanLines = _ref2.dnlScanLines,
22600          dnlScanLines = _ref2$dnlScanLines === void 0 ? null : _ref2$dnlScanLines;
22601
22602      function readUint16() {
22603        var value = data[offset] << 8 | data[offset + 1];
22604        offset += 2;
22605        return value;
22606      }
22607
22608      function readDataBlock() {
22609        var length = readUint16();
22610        var endOffset = offset + length - 2;
22611        var fileMarker = findNextFileMarker(data, endOffset, offset);
22612
22613        if (fileMarker && fileMarker.invalid) {
22614          (0, _util.warn)('readDataBlock - incorrect length, current marker is: ' + fileMarker.invalid);
22615          endOffset = fileMarker.offset;
22616        }
22617
22618        var array = data.subarray(offset, endOffset);
22619        offset += array.length;
22620        return array;
22621      }
22622
22623      function prepareComponents(frame) {
22624        var mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
22625        var mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
22626
22627        for (var i = 0; i < frame.components.length; i++) {
22628          component = frame.components[i];
22629          var blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
22630          var blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
22631          var blocksPerLineForMcu = mcusPerLine * component.h;
22632          var blocksPerColumnForMcu = mcusPerColumn * component.v;
22633          var blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
22634          component.blockData = new Int16Array(blocksBufferSize);
22635          component.blocksPerLine = blocksPerLine;
22636          component.blocksPerColumn = blocksPerColumn;
22637        }
22638
22639        frame.mcusPerLine = mcusPerLine;
22640        frame.mcusPerColumn = mcusPerColumn;
22641      }
22642
22643      var offset = 0;
22644      var jfif = null;
22645      var adobe = null;
22646      var frame, resetInterval;
22647      var numSOSMarkers = 0;
22648      var quantizationTables = [];
22649      var huffmanTablesAC = [],
22650          huffmanTablesDC = [];
22651      var fileMarker = readUint16();
22652
22653      if (fileMarker !== 0xFFD8) {
22654        throw new JpegError('SOI not found');
22655      }
22656
22657      fileMarker = readUint16();
22658
22659      markerLoop: while (fileMarker !== 0xFFD9) {
22660        var i, j, l;
22661
22662        switch (fileMarker) {
22663          case 0xFFE0:
22664          case 0xFFE1:
22665          case 0xFFE2:
22666          case 0xFFE3:
22667          case 0xFFE4:
22668          case 0xFFE5:
22669          case 0xFFE6:
22670          case 0xFFE7:
22671          case 0xFFE8:
22672          case 0xFFE9:
22673          case 0xFFEA:
22674          case 0xFFEB:
22675          case 0xFFEC:
22676          case 0xFFED:
22677          case 0xFFEE:
22678          case 0xFFEF:
22679          case 0xFFFE:
22680            var appData = readDataBlock();
22681
22682            if (fileMarker === 0xFFE0) {
22683              if (appData[0] === 0x4A && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
22684                jfif = {
22685                  version: {
22686                    major: appData[5],
22687                    minor: appData[6]
22688                  },
22689                  densityUnits: appData[7],
22690                  xDensity: appData[8] << 8 | appData[9],
22691                  yDensity: appData[10] << 8 | appData[11],
22692                  thumbWidth: appData[12],
22693                  thumbHeight: appData[13],
22694                  thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
22695                };
22696              }
22697            }
22698
22699            if (fileMarker === 0xFFEE) {
22700              if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6F && appData[3] === 0x62 && appData[4] === 0x65) {
22701                adobe = {
22702                  version: appData[5] << 8 | appData[6],
22703                  flags0: appData[7] << 8 | appData[8],
22704                  flags1: appData[9] << 8 | appData[10],
22705                  transformCode: appData[11]
22706                };
22707              }
22708            }
22709
22710            break;
22711
22712          case 0xFFDB:
22713            var quantizationTablesLength = readUint16();
22714            var quantizationTablesEnd = quantizationTablesLength + offset - 2;
22715            var z;
22716
22717            while (offset < quantizationTablesEnd) {
22718              var quantizationTableSpec = data[offset++];
22719              var tableData = new Uint16Array(64);
22720
22721              if (quantizationTableSpec >> 4 === 0) {
22722                for (j = 0; j < 64; j++) {
22723                  z = dctZigZag[j];
22724                  tableData[z] = data[offset++];
22725                }
22726              } else if (quantizationTableSpec >> 4 === 1) {
22727                for (j = 0; j < 64; j++) {
22728                  z = dctZigZag[j];
22729                  tableData[z] = readUint16();
22730                }
22731              } else {
22732                throw new JpegError('DQT - invalid table spec');
22733              }
22734
22735              quantizationTables[quantizationTableSpec & 15] = tableData;
22736            }
22737
22738            break;
22739
22740          case 0xFFC0:
22741          case 0xFFC1:
22742          case 0xFFC2:
22743            if (frame) {
22744              throw new JpegError('Only single frame JPEGs supported');
22745            }
22746
22747            readUint16();
22748            frame = {};
22749            frame.extended = fileMarker === 0xFFC1;
22750            frame.progressive = fileMarker === 0xFFC2;
22751            frame.precision = data[offset++];
22752            var sofScanLines = readUint16();
22753            frame.scanLines = dnlScanLines || sofScanLines;
22754            frame.samplesPerLine = readUint16();
22755            frame.components = [];
22756            frame.componentIds = {};
22757            var componentsCount = data[offset++],
22758                componentId;
22759            var maxH = 0,
22760                maxV = 0;
22761
22762            for (i = 0; i < componentsCount; i++) {
22763              componentId = data[offset];
22764              var h = data[offset + 1] >> 4;
22765              var v = data[offset + 1] & 15;
22766
22767              if (maxH < h) {
22768                maxH = h;
22769              }
22770
22771              if (maxV < v) {
22772                maxV = v;
22773              }
22774
22775              var qId = data[offset + 2];
22776              l = frame.components.push({
22777                h: h,
22778                v: v,
22779                quantizationId: qId,
22780                quantizationTable: null
22781              });
22782              frame.componentIds[componentId] = l - 1;
22783              offset += 3;
22784            }
22785
22786            frame.maxH = maxH;
22787            frame.maxV = maxV;
22788            prepareComponents(frame);
22789            break;
22790
22791          case 0xFFC4:
22792            var huffmanLength = readUint16();
22793
22794            for (i = 2; i < huffmanLength;) {
22795              var huffmanTableSpec = data[offset++];
22796              var codeLengths = new Uint8Array(16);
22797              var codeLengthSum = 0;
22798
22799              for (j = 0; j < 16; j++, offset++) {
22800                codeLengthSum += codeLengths[j] = data[offset];
22801              }
22802
22803              var huffmanValues = new Uint8Array(codeLengthSum);
22804
22805              for (j = 0; j < codeLengthSum; j++, offset++) {
22806                huffmanValues[j] = data[offset];
22807              }
22808
22809              i += 17 + codeLengthSum;
22810              (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
22811            }
22812
22813            break;
22814
22815          case 0xFFDD:
22816            readUint16();
22817            resetInterval = readUint16();
22818            break;
22819
22820          case 0xFFDA:
22821            var parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
22822            readUint16();
22823            var selectorsCount = data[offset++];
22824            var components = [],
22825                component;
22826
22827            for (i = 0; i < selectorsCount; i++) {
22828              var componentIndex = frame.componentIds[data[offset++]];
22829              component = frame.components[componentIndex];
22830              var tableSpec = data[offset++];
22831              component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
22832              component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
22833              components.push(component);
22834            }
22835
22836            var spectralStart = data[offset++];
22837            var spectralEnd = data[offset++];
22838            var successiveApproximation = data[offset++];
22839
22840            try {
22841              var processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker);
22842              offset += processed;
22843            } catch (ex) {
22844              if (ex instanceof DNLMarkerError) {
22845                (0, _util.warn)("".concat(ex.message, " -- attempting to re-parse the JPEG image."));
22846                return this.parse(data, {
22847                  dnlScanLines: ex.scanLines
22848                });
22849              } else if (ex instanceof EOIMarkerError) {
22850                (0, _util.warn)("".concat(ex.message, " -- ignoring the rest of the image data."));
22851                break markerLoop;
22852              }
22853
22854              throw ex;
22855            }
22856
22857            break;
22858
22859          case 0xFFDC:
22860            offset += 4;
22861            break;
22862
22863          case 0xFFFF:
22864            if (data[offset] !== 0xFF) {
22865              offset--;
22866            }
22867
22868            break;
22869
22870          default:
22871            if (data[offset - 3] === 0xFF && data[offset - 2] >= 0xC0 && data[offset - 2] <= 0xFE) {
22872              offset -= 3;
22873              break;
22874            }
22875
22876            var nextFileMarker = findNextFileMarker(data, offset - 2);
22877
22878            if (nextFileMarker && nextFileMarker.invalid) {
22879              (0, _util.warn)('JpegImage.parse - unexpected data, current marker is: ' + nextFileMarker.invalid);
22880              offset = nextFileMarker.offset;
22881              break;
22882            }
22883
22884            throw new JpegError('unknown marker ' + fileMarker.toString(16));
22885        }
22886
22887        fileMarker = readUint16();
22888      }
22889
22890      this.width = frame.samplesPerLine;
22891      this.height = frame.scanLines;
22892      this.jfif = jfif;
22893      this.adobe = adobe;
22894      this.components = [];
22895
22896      for (i = 0; i < frame.components.length; i++) {
22897        component = frame.components[i];
22898        var quantizationTable = quantizationTables[component.quantizationId];
22899
22900        if (quantizationTable) {
22901          component.quantizationTable = quantizationTable;
22902        }
22903
22904        this.components.push({
22905          output: buildComponentData(frame, component),
22906          scaleX: component.h / frame.maxH,
22907          scaleY: component.v / frame.maxV,
22908          blocksPerLine: component.blocksPerLine,
22909          blocksPerColumn: component.blocksPerColumn
22910        });
22911      }
22912
22913      this.numComponents = this.components.length;
22914      return undefined;
22915    },
22916    _getLinearizedBlockData: function _getLinearizedBlockData(width, height) {
22917      var isSourcePDF = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
22918      var scaleX = this.width / width,
22919          scaleY = this.height / height;
22920      var component, componentScaleX, componentScaleY, blocksPerScanline;
22921      var x, y, i, j, k;
22922      var index;
22923      var offset = 0;
22924      var output;
22925      var numComponents = this.components.length;
22926      var dataLength = width * height * numComponents;
22927      var data = new Uint8ClampedArray(dataLength);
22928      var xScaleBlockOffset = new Uint32Array(width);
22929      var mask3LSB = 0xfffffff8;
22930
22931      for (i = 0; i < numComponents; i++) {
22932        component = this.components[i];
22933        componentScaleX = component.scaleX * scaleX;
22934        componentScaleY = component.scaleY * scaleY;
22935        offset = i;
22936        output = component.output;
22937        blocksPerScanline = component.blocksPerLine + 1 << 3;
22938
22939        for (x = 0; x < width; x++) {
22940          j = 0 | x * componentScaleX;
22941          xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
22942        }
22943
22944        for (y = 0; y < height; y++) {
22945          j = 0 | y * componentScaleY;
22946          index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
22947
22948          for (x = 0; x < width; x++) {
22949            data[offset] = output[index + xScaleBlockOffset[x]];
22950            offset += numComponents;
22951          }
22952        }
22953      }
22954
22955      var transform = this._decodeTransform;
22956
22957      if (!isSourcePDF && numComponents === 4 && !transform) {
22958        transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
22959      }
22960
22961      if (transform) {
22962        for (i = 0; i < dataLength;) {
22963          for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
22964            data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
22965          }
22966        }
22967      }
22968
22969      return data;
22970    },
22971
22972    get _isColorConversionNeeded() {
22973      if (this.adobe) {
22974        return !!this.adobe.transformCode;
22975      }
22976
22977      if (this.numComponents === 3) {
22978        if (this._colorTransform === 0) {
22979          return false;
22980        }
22981
22982        return true;
22983      }
22984
22985      if (this._colorTransform === 1) {
22986        return true;
22987      }
22988
22989      return false;
22990    },
22991
22992    _convertYccToRgb: function convertYccToRgb(data) {
22993      var Y, Cb, Cr;
22994
22995      for (var i = 0, length = data.length; i < length; i += 3) {
22996        Y = data[i];
22997        Cb = data[i + 1];
22998        Cr = data[i + 2];
22999        data[i] = Y - 179.456 + 1.402 * Cr;
23000        data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
23001        data[i + 2] = Y - 226.816 + 1.772 * Cb;
23002      }
23003
23004      return data;
23005    },
23006    _convertYcckToRgb: function convertYcckToRgb(data) {
23007      var Y, Cb, Cr, k;
23008      var offset = 0;
23009
23010      for (var i = 0, length = data.length; i < length; i += 4) {
23011        Y = data[i];
23012        Cb = data[i + 1];
23013        Cr = data[i + 2];
23014        k = data[i + 3];
23015        data[offset++] = -122.67195406894 + Cb * (-6.60635669420364e-5 * Cb + 0.000437130475926232 * Cr - 5.4080610064599e-5 * Y + 0.00048449797120281 * k - 0.154362151871126) + Cr * (-0.000957964378445773 * Cr + 0.000817076911346625 * Y - 0.00477271405408747 * k + 1.53380253221734) + Y * (0.000961250184130688 * Y - 0.00266257332283933 * k + 0.48357088451265) + k * (-0.000336197177618394 * k + 0.484791561490776);
23016        data[offset++] = 107.268039397724 + Cb * (2.19927104525741e-5 * Cb - 0.000640992018297945 * Cr + 0.000659397001245577 * Y + 0.000426105652938837 * k - 0.176491792462875) + Cr * (-0.000778269941513683 * Cr + 0.00130872261408275 * Y + 0.000770482631801132 * k - 0.151051492775562) + Y * (0.00126935368114843 * Y - 0.00265090189010898 * k + 0.25802910206845) + k * (-0.000318913117588328 * k - 0.213742400323665);
23017        data[offset++] = -20.810012546947 + Cb * (-0.000570115196973677 * Cb - 2.63409051004589e-5 * Cr + 0.0020741088115012 * Y - 0.00288260236853442 * k + 0.814272968359295) + Cr * (-1.53496057440975e-5 * Cr - 0.000132689043961446 * Y + 0.000560833691242812 * k - 0.195152027534049) + Y * (0.00174418132927582 * Y - 0.00255243321439347 * k + 0.116935020465145) + k * (-0.000343531996510555 * k + 0.24165260232407);
23018      }
23019
23020      return data.subarray(0, offset);
23021    },
23022    _convertYcckToCmyk: function convertYcckToCmyk(data) {
23023      var Y, Cb, Cr;
23024
23025      for (var i = 0, length = data.length; i < length; i += 4) {
23026        Y = data[i];
23027        Cb = data[i + 1];
23028        Cr = data[i + 2];
23029        data[i] = 434.456 - Y - 1.402 * Cr;
23030        data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;
23031        data[i + 2] = 481.816 - Y - 1.772 * Cb;
23032      }
23033
23034      return data;
23035    },
23036    _convertCmykToRgb: function convertCmykToRgb(data) {
23037      var c, m, y, k;
23038      var offset = 0;
23039      var scale = 1 / 255;
23040
23041      for (var i = 0, length = data.length; i < length; i += 4) {
23042        c = data[i] * scale;
23043        m = data[i + 1] * scale;
23044        y = data[i + 2] * scale;
23045        k = data[i + 3] * scale;
23046        data[offset++] = 255 + c * (-4.387332384609988 * c + 54.48615194189176 * m + 18.82290502165302 * y + 212.25662451639585 * k - 285.2331026137004) + m * (1.7149763477362134 * m - 5.6096736904047315 * y - 17.873870861415444 * k - 5.497006427196366) + y * (-2.5217340131683033 * y - 21.248923337353073 * k + 17.5119270841813) - k * (21.86122147463605 * k + 189.48180835922747);
23047        data[offset++] = 255 + c * (8.841041422036149 * c + 60.118027045597366 * m + 6.871425592049007 * y + 31.159100130055922 * k - 79.2970844816548) + m * (-15.310361306967817 * m + 17.575251261109482 * y + 131.35250912493976 * k - 190.9453302588951) + y * (4.444339102852739 * y + 9.8632861493405 * k - 24.86741582555878) - k * (20.737325471181034 * k + 187.80453709719578);
23048        data[offset++] = 255 + c * (0.8842522430003296 * c + 8.078677503112928 * m + 30.89978309703729 * y - 0.23883238689178934 * k - 14.183576799673286) + m * (10.49593273432072 * m + 63.02378494754052 * y + 50.606957656360734 * k - 112.23884253719248) + y * (0.03296041114873217 * y + 115.60384449646641 * k - 193.58209356861505) - k * (22.33816807309886 * k + 180.12613974708367);
23049      }
23050
23051      return data.subarray(0, offset);
23052    },
23053    getData: function getData(_ref3) {
23054      var width = _ref3.width,
23055          height = _ref3.height,
23056          _ref3$forceRGB = _ref3.forceRGB,
23057          forceRGB = _ref3$forceRGB === void 0 ? false : _ref3$forceRGB,
23058          _ref3$isSourcePDF = _ref3.isSourcePDF,
23059          isSourcePDF = _ref3$isSourcePDF === void 0 ? false : _ref3$isSourcePDF;
23060
23061      if (this.numComponents > 4) {
23062        throw new JpegError('Unsupported color mode');
23063      }
23064
23065      var data = this._getLinearizedBlockData(width, height, isSourcePDF);
23066
23067      if (this.numComponents === 1 && forceRGB) {
23068        var dataLength = data.length;
23069        var rgbData = new Uint8ClampedArray(dataLength * 3);
23070        var offset = 0;
23071
23072        for (var i = 0; i < dataLength; i++) {
23073          var grayColor = data[i];
23074          rgbData[offset++] = grayColor;
23075          rgbData[offset++] = grayColor;
23076          rgbData[offset++] = grayColor;
23077        }
23078
23079        return rgbData;
23080      } else if (this.numComponents === 3 && this._isColorConversionNeeded) {
23081        return this._convertYccToRgb(data);
23082      } else if (this.numComponents === 4) {
23083        if (this._isColorConversionNeeded) {
23084          if (forceRGB) {
23085            return this._convertYcckToRgb(data);
23086          }
23087
23088          return this._convertYcckToCmyk(data);
23089        } else if (forceRGB) {
23090          return this._convertCmykToRgb(data);
23091        }
23092      }
23093
23094      return data;
23095    }
23096  };
23097  return JpegImage;
23098}();
23099
23100exports.JpegImage = JpegImage;
23101
23102/***/ }),
23103/* 166 */
23104/***/ (function(module, exports, __w_pdfjs_require__) {
23105
23106"use strict";
23107
23108
23109Object.defineProperty(exports, "__esModule", {
23110  value: true
23111});
23112exports.JpxStream = void 0;
23113
23114var _stream = __w_pdfjs_require__(158);
23115
23116var _jpx = __w_pdfjs_require__(167);
23117
23118var _util = __w_pdfjs_require__(5);
23119
23120var JpxStream = function JpxStreamClosure() {
23121  function JpxStream(stream, maybeLength, dict, params) {
23122    this.stream = stream;
23123    this.maybeLength = maybeLength;
23124    this.dict = dict;
23125    this.params = params;
23126
23127    _stream.DecodeStream.call(this, maybeLength);
23128  }
23129
23130  JpxStream.prototype = Object.create(_stream.DecodeStream.prototype);
23131  Object.defineProperty(JpxStream.prototype, 'bytes', {
23132    get: function JpxStream_bytes() {
23133      return (0, _util.shadow)(this, 'bytes', this.stream.getBytes(this.maybeLength));
23134    },
23135    configurable: true
23136  });
23137
23138  JpxStream.prototype.ensureBuffer = function (requested) {};
23139
23140  JpxStream.prototype.readBlock = function () {
23141    if (this.eof) {
23142      return;
23143    }
23144
23145    var jpxImage = new _jpx.JpxImage();
23146    jpxImage.parse(this.bytes);
23147    var width = jpxImage.width;
23148    var height = jpxImage.height;
23149    var componentsCount = jpxImage.componentsCount;
23150    var tileCount = jpxImage.tiles.length;
23151
23152    if (tileCount === 1) {
23153      this.buffer = jpxImage.tiles[0].items;
23154    } else {
23155      var data = new Uint8ClampedArray(width * height * componentsCount);
23156
23157      for (var k = 0; k < tileCount; k++) {
23158        var tileComponents = jpxImage.tiles[k];
23159        var tileWidth = tileComponents.width;
23160        var tileHeight = tileComponents.height;
23161        var tileLeft = tileComponents.left;
23162        var tileTop = tileComponents.top;
23163        var src = tileComponents.items;
23164        var srcPosition = 0;
23165        var dataPosition = (width * tileTop + tileLeft) * componentsCount;
23166        var imgRowSize = width * componentsCount;
23167        var tileRowSize = tileWidth * componentsCount;
23168
23169        for (var j = 0; j < tileHeight; j++) {
23170          var rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
23171          data.set(rowBytes, dataPosition);
23172          srcPosition += tileRowSize;
23173          dataPosition += imgRowSize;
23174        }
23175      }
23176
23177      this.buffer = data;
23178    }
23179
23180    this.bufferLength = this.buffer.length;
23181    this.eof = true;
23182  };
23183
23184  return JpxStream;
23185}();
23186
23187exports.JpxStream = JpxStream;
23188
23189/***/ }),
23190/* 167 */
23191/***/ (function(module, exports, __w_pdfjs_require__) {
23192
23193"use strict";
23194
23195
23196Object.defineProperty(exports, "__esModule", {
23197  value: true
23198});
23199exports.JpxImage = void 0;
23200
23201var _util = __w_pdfjs_require__(5);
23202
23203var _arithmetic_decoder = __w_pdfjs_require__(163);
23204
23205var JpxError = function JpxErrorClosure() {
23206  function JpxError(msg) {
23207    this.message = 'JPX error: ' + msg;
23208  }
23209
23210  JpxError.prototype = new Error();
23211  JpxError.prototype.name = 'JpxError';
23212  JpxError.constructor = JpxError;
23213  return JpxError;
23214}();
23215
23216var JpxImage = function JpxImageClosure() {
23217  var SubbandsGainLog2 = {
23218    'LL': 0,
23219    'LH': 1,
23220    'HL': 1,
23221    'HH': 2
23222  };
23223
23224  function JpxImage() {
23225    this.failOnCorruptedImage = false;
23226  }
23227
23228  JpxImage.prototype = {
23229    parse: function JpxImage_parse(data) {
23230      var head = (0, _util.readUint16)(data, 0);
23231
23232      if (head === 0xFF4F) {
23233        this.parseCodestream(data, 0, data.length);
23234        return;
23235      }
23236
23237      var position = 0,
23238          length = data.length;
23239
23240      while (position < length) {
23241        var headerSize = 8;
23242        var lbox = (0, _util.readUint32)(data, position);
23243        var tbox = (0, _util.readUint32)(data, position + 4);
23244        position += headerSize;
23245
23246        if (lbox === 1) {
23247          lbox = (0, _util.readUint32)(data, position) * 4294967296 + (0, _util.readUint32)(data, position + 4);
23248          position += 8;
23249          headerSize += 8;
23250        }
23251
23252        if (lbox === 0) {
23253          lbox = length - position + headerSize;
23254        }
23255
23256        if (lbox < headerSize) {
23257          throw new JpxError('Invalid box field size');
23258        }
23259
23260        var dataLength = lbox - headerSize;
23261        var jumpDataLength = true;
23262
23263        switch (tbox) {
23264          case 0x6A703268:
23265            jumpDataLength = false;
23266            break;
23267
23268          case 0x636F6C72:
23269            var method = data[position];
23270
23271            if (method === 1) {
23272              var colorspace = (0, _util.readUint32)(data, position + 3);
23273
23274              switch (colorspace) {
23275                case 16:
23276                case 17:
23277                case 18:
23278                  break;
23279
23280                default:
23281                  (0, _util.warn)('Unknown colorspace ' + colorspace);
23282                  break;
23283              }
23284            } else if (method === 2) {
23285              (0, _util.info)('ICC profile not supported');
23286            }
23287
23288            break;
23289
23290          case 0x6A703263:
23291            this.parseCodestream(data, position, position + dataLength);
23292            break;
23293
23294          case 0x6A502020:
23295            if ((0, _util.readUint32)(data, position) !== 0x0d0a870a) {
23296              (0, _util.warn)('Invalid JP2 signature');
23297            }
23298
23299            break;
23300
23301          case 0x6A501A1A:
23302          case 0x66747970:
23303          case 0x72726571:
23304          case 0x72657320:
23305          case 0x69686472:
23306            break;
23307
23308          default:
23309            var headerType = String.fromCharCode(tbox >> 24 & 0xFF, tbox >> 16 & 0xFF, tbox >> 8 & 0xFF, tbox & 0xFF);
23310            (0, _util.warn)('Unsupported header type ' + tbox + ' (' + headerType + ')');
23311            break;
23312        }
23313
23314        if (jumpDataLength) {
23315          position += dataLength;
23316        }
23317      }
23318    },
23319    parseImageProperties: function JpxImage_parseImageProperties(stream) {
23320      var newByte = stream.getByte();
23321
23322      while (newByte >= 0) {
23323        var oldByte = newByte;
23324        newByte = stream.getByte();
23325        var code = oldByte << 8 | newByte;
23326
23327        if (code === 0xFF51) {
23328          stream.skip(4);
23329          var Xsiz = stream.getInt32() >>> 0;
23330          var Ysiz = stream.getInt32() >>> 0;
23331          var XOsiz = stream.getInt32() >>> 0;
23332          var YOsiz = stream.getInt32() >>> 0;
23333          stream.skip(16);
23334          var Csiz = stream.getUint16();
23335          this.width = Xsiz - XOsiz;
23336          this.height = Ysiz - YOsiz;
23337          this.componentsCount = Csiz;
23338          this.bitsPerComponent = 8;
23339          return;
23340        }
23341      }
23342
23343      throw new JpxError('No size marker found in JPX stream');
23344    },
23345    parseCodestream: function JpxImage_parseCodestream(data, start, end) {
23346      var context = {};
23347      var doNotRecover = false;
23348
23349      try {
23350        var position = start;
23351
23352        while (position + 1 < end) {
23353          var code = (0, _util.readUint16)(data, position);
23354          position += 2;
23355          var length = 0,
23356              j,
23357              sqcd,
23358              spqcds,
23359              spqcdSize,
23360              scalarExpounded,
23361              tile;
23362
23363          switch (code) {
23364            case 0xFF4F:
23365              context.mainHeader = true;
23366              break;
23367
23368            case 0xFFD9:
23369              break;
23370
23371            case 0xFF51:
23372              length = (0, _util.readUint16)(data, position);
23373              var siz = {};
23374              siz.Xsiz = (0, _util.readUint32)(data, position + 4);
23375              siz.Ysiz = (0, _util.readUint32)(data, position + 8);
23376              siz.XOsiz = (0, _util.readUint32)(data, position + 12);
23377              siz.YOsiz = (0, _util.readUint32)(data, position + 16);
23378              siz.XTsiz = (0, _util.readUint32)(data, position + 20);
23379              siz.YTsiz = (0, _util.readUint32)(data, position + 24);
23380              siz.XTOsiz = (0, _util.readUint32)(data, position + 28);
23381              siz.YTOsiz = (0, _util.readUint32)(data, position + 32);
23382              var componentsCount = (0, _util.readUint16)(data, position + 36);
23383              siz.Csiz = componentsCount;
23384              var components = [];
23385              j = position + 38;
23386
23387              for (var i = 0; i < componentsCount; i++) {
23388                var component = {
23389                  precision: (data[j] & 0x7F) + 1,
23390                  isSigned: !!(data[j] & 0x80),
23391                  XRsiz: data[j + 1],
23392                  YRsiz: data[j + 2]
23393                };
23394                j += 3;
23395                calculateComponentDimensions(component, siz);
23396                components.push(component);
23397              }
23398
23399              context.SIZ = siz;
23400              context.components = components;
23401              calculateTileGrids(context, components);
23402              context.QCC = [];
23403              context.COC = [];
23404              break;
23405
23406            case 0xFF5C:
23407              length = (0, _util.readUint16)(data, position);
23408              var qcd = {};
23409              j = position + 2;
23410              sqcd = data[j++];
23411
23412              switch (sqcd & 0x1F) {
23413                case 0:
23414                  spqcdSize = 8;
23415                  scalarExpounded = true;
23416                  break;
23417
23418                case 1:
23419                  spqcdSize = 16;
23420                  scalarExpounded = false;
23421                  break;
23422
23423                case 2:
23424                  spqcdSize = 16;
23425                  scalarExpounded = true;
23426                  break;
23427
23428                default:
23429                  throw new Error('Invalid SQcd value ' + sqcd);
23430              }
23431
23432              qcd.noQuantization = spqcdSize === 8;
23433              qcd.scalarExpounded = scalarExpounded;
23434              qcd.guardBits = sqcd >> 5;
23435              spqcds = [];
23436
23437              while (j < length + position) {
23438                var spqcd = {};
23439
23440                if (spqcdSize === 8) {
23441                  spqcd.epsilon = data[j++] >> 3;
23442                  spqcd.mu = 0;
23443                } else {
23444                  spqcd.epsilon = data[j] >> 3;
23445                  spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
23446                  j += 2;
23447                }
23448
23449                spqcds.push(spqcd);
23450              }
23451
23452              qcd.SPqcds = spqcds;
23453
23454              if (context.mainHeader) {
23455                context.QCD = qcd;
23456              } else {
23457                context.currentTile.QCD = qcd;
23458                context.currentTile.QCC = [];
23459              }
23460
23461              break;
23462
23463            case 0xFF5D:
23464              length = (0, _util.readUint16)(data, position);
23465              var qcc = {};
23466              j = position + 2;
23467              var cqcc;
23468
23469              if (context.SIZ.Csiz < 257) {
23470                cqcc = data[j++];
23471              } else {
23472                cqcc = (0, _util.readUint16)(data, j);
23473                j += 2;
23474              }
23475
23476              sqcd = data[j++];
23477
23478              switch (sqcd & 0x1F) {
23479                case 0:
23480                  spqcdSize = 8;
23481                  scalarExpounded = true;
23482                  break;
23483
23484                case 1:
23485                  spqcdSize = 16;
23486                  scalarExpounded = false;
23487                  break;
23488
23489                case 2:
23490                  spqcdSize = 16;
23491                  scalarExpounded = true;
23492                  break;
23493
23494                default:
23495                  throw new Error('Invalid SQcd value ' + sqcd);
23496              }
23497
23498              qcc.noQuantization = spqcdSize === 8;
23499              qcc.scalarExpounded = scalarExpounded;
23500              qcc.guardBits = sqcd >> 5;
23501              spqcds = [];
23502
23503              while (j < length + position) {
23504                spqcd = {};
23505
23506                if (spqcdSize === 8) {
23507                  spqcd.epsilon = data[j++] >> 3;
23508                  spqcd.mu = 0;
23509                } else {
23510                  spqcd.epsilon = data[j] >> 3;
23511                  spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
23512                  j += 2;
23513                }
23514
23515                spqcds.push(spqcd);
23516              }
23517
23518              qcc.SPqcds = spqcds;
23519
23520              if (context.mainHeader) {
23521                context.QCC[cqcc] = qcc;
23522              } else {
23523                context.currentTile.QCC[cqcc] = qcc;
23524              }
23525
23526              break;
23527
23528            case 0xFF52:
23529              length = (0, _util.readUint16)(data, position);
23530              var cod = {};
23531              j = position + 2;
23532              var scod = data[j++];
23533              cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
23534              cod.sopMarkerUsed = !!(scod & 2);
23535              cod.ephMarkerUsed = !!(scod & 4);
23536              cod.progressionOrder = data[j++];
23537              cod.layersCount = (0, _util.readUint16)(data, j);
23538              j += 2;
23539              cod.multipleComponentTransform = data[j++];
23540              cod.decompositionLevelsCount = data[j++];
23541              cod.xcb = (data[j++] & 0xF) + 2;
23542              cod.ycb = (data[j++] & 0xF) + 2;
23543              var blockStyle = data[j++];
23544              cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
23545              cod.resetContextProbabilities = !!(blockStyle & 2);
23546              cod.terminationOnEachCodingPass = !!(blockStyle & 4);
23547              cod.verticallyStripe = !!(blockStyle & 8);
23548              cod.predictableTermination = !!(blockStyle & 16);
23549              cod.segmentationSymbolUsed = !!(blockStyle & 32);
23550              cod.reversibleTransformation = data[j++];
23551
23552              if (cod.entropyCoderWithCustomPrecincts) {
23553                var precinctsSizes = [];
23554
23555                while (j < length + position) {
23556                  var precinctsSize = data[j++];
23557                  precinctsSizes.push({
23558                    PPx: precinctsSize & 0xF,
23559                    PPy: precinctsSize >> 4
23560                  });
23561                }
23562
23563                cod.precinctsSizes = precinctsSizes;
23564              }
23565
23566              var unsupported = [];
23567
23568              if (cod.selectiveArithmeticCodingBypass) {
23569                unsupported.push('selectiveArithmeticCodingBypass');
23570              }
23571
23572              if (cod.resetContextProbabilities) {
23573                unsupported.push('resetContextProbabilities');
23574              }
23575
23576              if (cod.terminationOnEachCodingPass) {
23577                unsupported.push('terminationOnEachCodingPass');
23578              }
23579
23580              if (cod.verticallyStripe) {
23581                unsupported.push('verticallyStripe');
23582              }
23583
23584              if (cod.predictableTermination) {
23585                unsupported.push('predictableTermination');
23586              }
23587
23588              if (unsupported.length > 0) {
23589                doNotRecover = true;
23590                throw new Error('Unsupported COD options (' + unsupported.join(', ') + ')');
23591              }
23592
23593              if (context.mainHeader) {
23594                context.COD = cod;
23595              } else {
23596                context.currentTile.COD = cod;
23597                context.currentTile.COC = [];
23598              }
23599
23600              break;
23601
23602            case 0xFF90:
23603              length = (0, _util.readUint16)(data, position);
23604              tile = {};
23605              tile.index = (0, _util.readUint16)(data, position + 2);
23606              tile.length = (0, _util.readUint32)(data, position + 4);
23607              tile.dataEnd = tile.length + position - 2;
23608              tile.partIndex = data[position + 8];
23609              tile.partsCount = data[position + 9];
23610              context.mainHeader = false;
23611
23612              if (tile.partIndex === 0) {
23613                tile.COD = context.COD;
23614                tile.COC = context.COC.slice(0);
23615                tile.QCD = context.QCD;
23616                tile.QCC = context.QCC.slice(0);
23617              }
23618
23619              context.currentTile = tile;
23620              break;
23621
23622            case 0xFF93:
23623              tile = context.currentTile;
23624
23625              if (tile.partIndex === 0) {
23626                initializeTile(context, tile.index);
23627                buildPackets(context);
23628              }
23629
23630              length = tile.dataEnd - position;
23631              parseTilePackets(context, data, position, length);
23632              break;
23633
23634            case 0xFF55:
23635            case 0xFF57:
23636            case 0xFF58:
23637            case 0xFF64:
23638              length = (0, _util.readUint16)(data, position);
23639              break;
23640
23641            case 0xFF53:
23642              throw new Error('Codestream code 0xFF53 (COC) is ' + 'not implemented');
23643
23644            default:
23645              throw new Error('Unknown codestream code: ' + code.toString(16));
23646          }
23647
23648          position += length;
23649        }
23650      } catch (e) {
23651        if (doNotRecover || this.failOnCorruptedImage) {
23652          throw new JpxError(e.message);
23653        } else {
23654          (0, _util.warn)('JPX: Trying to recover from: ' + e.message);
23655        }
23656      }
23657
23658      this.tiles = transformComponents(context);
23659      this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
23660      this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
23661      this.componentsCount = context.SIZ.Csiz;
23662    }
23663  };
23664
23665  function calculateComponentDimensions(component, siz) {
23666    component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
23667    component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
23668    component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
23669    component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
23670    component.width = component.x1 - component.x0;
23671    component.height = component.y1 - component.y0;
23672  }
23673
23674  function calculateTileGrids(context, components) {
23675    var siz = context.SIZ;
23676    var tile,
23677        tiles = [];
23678    var numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
23679    var numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
23680
23681    for (var q = 0; q < numYtiles; q++) {
23682      for (var p = 0; p < numXtiles; p++) {
23683        tile = {};
23684        tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
23685        tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
23686        tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
23687        tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
23688        tile.width = tile.tx1 - tile.tx0;
23689        tile.height = tile.ty1 - tile.ty0;
23690        tile.components = [];
23691        tiles.push(tile);
23692      }
23693    }
23694
23695    context.tiles = tiles;
23696    var componentsCount = siz.Csiz;
23697
23698    for (var i = 0, ii = componentsCount; i < ii; i++) {
23699      var component = components[i];
23700
23701      for (var j = 0, jj = tiles.length; j < jj; j++) {
23702        var tileComponent = {};
23703        tile = tiles[j];
23704        tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
23705        tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
23706        tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
23707        tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
23708        tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
23709        tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
23710        tile.components[i] = tileComponent;
23711      }
23712    }
23713  }
23714
23715  function getBlocksDimensions(context, component, r) {
23716    var codOrCoc = component.codingStyleParameters;
23717    var result = {};
23718
23719    if (!codOrCoc.entropyCoderWithCustomPrecincts) {
23720      result.PPx = 15;
23721      result.PPy = 15;
23722    } else {
23723      result.PPx = codOrCoc.precinctsSizes[r].PPx;
23724      result.PPy = codOrCoc.precinctsSizes[r].PPy;
23725    }
23726
23727    result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
23728    result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
23729    return result;
23730  }
23731
23732  function buildPrecincts(context, resolution, dimensions) {
23733    var precinctWidth = 1 << dimensions.PPx;
23734    var precinctHeight = 1 << dimensions.PPy;
23735    var isZeroRes = resolution.resLevel === 0;
23736    var precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
23737    var precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
23738    var numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
23739    var numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
23740    var numprecincts = numprecinctswide * numprecinctshigh;
23741    resolution.precinctParameters = {
23742      precinctWidth: precinctWidth,
23743      precinctHeight: precinctHeight,
23744      numprecinctswide: numprecinctswide,
23745      numprecinctshigh: numprecinctshigh,
23746      numprecincts: numprecincts,
23747      precinctWidthInSubband: precinctWidthInSubband,
23748      precinctHeightInSubband: precinctHeightInSubband
23749    };
23750  }
23751
23752  function buildCodeblocks(context, subband, dimensions) {
23753    var xcb_ = dimensions.xcb_;
23754    var ycb_ = dimensions.ycb_;
23755    var codeblockWidth = 1 << xcb_;
23756    var codeblockHeight = 1 << ycb_;
23757    var cbx0 = subband.tbx0 >> xcb_;
23758    var cby0 = subband.tby0 >> ycb_;
23759    var cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
23760    var cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
23761    var precinctParameters = subband.resolution.precinctParameters;
23762    var codeblocks = [];
23763    var precincts = [];
23764    var i, j, codeblock, precinctNumber;
23765
23766    for (j = cby0; j < cby1; j++) {
23767      for (i = cbx0; i < cbx1; i++) {
23768        codeblock = {
23769          cbx: i,
23770          cby: j,
23771          tbx0: codeblockWidth * i,
23772          tby0: codeblockHeight * j,
23773          tbx1: codeblockWidth * (i + 1),
23774          tby1: codeblockHeight * (j + 1)
23775        };
23776        codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
23777        codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
23778        codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
23779        codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
23780        var pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
23781        var pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
23782        precinctNumber = pi + pj * precinctParameters.numprecinctswide;
23783        codeblock.precinctNumber = precinctNumber;
23784        codeblock.subbandType = subband.type;
23785        codeblock.Lblock = 3;
23786
23787        if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
23788          continue;
23789        }
23790
23791        codeblocks.push(codeblock);
23792        var precinct = precincts[precinctNumber];
23793
23794        if (precinct !== undefined) {
23795          if (i < precinct.cbxMin) {
23796            precinct.cbxMin = i;
23797          } else if (i > precinct.cbxMax) {
23798            precinct.cbxMax = i;
23799          }
23800
23801          if (j < precinct.cbyMin) {
23802            precinct.cbxMin = j;
23803          } else if (j > precinct.cbyMax) {
23804            precinct.cbyMax = j;
23805          }
23806        } else {
23807          precincts[precinctNumber] = precinct = {
23808            cbxMin: i,
23809            cbyMin: j,
23810            cbxMax: i,
23811            cbyMax: j
23812          };
23813        }
23814
23815        codeblock.precinct = precinct;
23816      }
23817    }
23818
23819    subband.codeblockParameters = {
23820      codeblockWidth: xcb_,
23821      codeblockHeight: ycb_,
23822      numcodeblockwide: cbx1 - cbx0 + 1,
23823      numcodeblockhigh: cby1 - cby0 + 1
23824    };
23825    subband.codeblocks = codeblocks;
23826    subband.precincts = precincts;
23827  }
23828
23829  function createPacket(resolution, precinctNumber, layerNumber) {
23830    var precinctCodeblocks = [];
23831    var subbands = resolution.subbands;
23832
23833    for (var i = 0, ii = subbands.length; i < ii; i++) {
23834      var subband = subbands[i];
23835      var codeblocks = subband.codeblocks;
23836
23837      for (var j = 0, jj = codeblocks.length; j < jj; j++) {
23838        var codeblock = codeblocks[j];
23839
23840        if (codeblock.precinctNumber !== precinctNumber) {
23841          continue;
23842        }
23843
23844        precinctCodeblocks.push(codeblock);
23845      }
23846    }
23847
23848    return {
23849      layerNumber: layerNumber,
23850      codeblocks: precinctCodeblocks
23851    };
23852  }
23853
23854  function LayerResolutionComponentPositionIterator(context) {
23855    var siz = context.SIZ;
23856    var tileIndex = context.currentTile.index;
23857    var tile = context.tiles[tileIndex];
23858    var layersCount = tile.codingStyleDefaultParameters.layersCount;
23859    var componentsCount = siz.Csiz;
23860    var maxDecompositionLevelsCount = 0;
23861
23862    for (var q = 0; q < componentsCount; q++) {
23863      maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
23864    }
23865
23866    var l = 0,
23867        r = 0,
23868        i = 0,
23869        k = 0;
23870
23871    this.nextPacket = function JpxImage_nextPacket() {
23872      for (; l < layersCount; l++) {
23873        for (; r <= maxDecompositionLevelsCount; r++) {
23874          for (; i < componentsCount; i++) {
23875            var component = tile.components[i];
23876
23877            if (r > component.codingStyleParameters.decompositionLevelsCount) {
23878              continue;
23879            }
23880
23881            var resolution = component.resolutions[r];
23882            var numprecincts = resolution.precinctParameters.numprecincts;
23883
23884            for (; k < numprecincts;) {
23885              var packet = createPacket(resolution, k, l);
23886              k++;
23887              return packet;
23888            }
23889
23890            k = 0;
23891          }
23892
23893          i = 0;
23894        }
23895
23896        r = 0;
23897      }
23898
23899      throw new JpxError('Out of packets');
23900    };
23901  }
23902
23903  function ResolutionLayerComponentPositionIterator(context) {
23904    var siz = context.SIZ;
23905    var tileIndex = context.currentTile.index;
23906    var tile = context.tiles[tileIndex];
23907    var layersCount = tile.codingStyleDefaultParameters.layersCount;
23908    var componentsCount = siz.Csiz;
23909    var maxDecompositionLevelsCount = 0;
23910
23911    for (var q = 0; q < componentsCount; q++) {
23912      maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
23913    }
23914
23915    var r = 0,
23916        l = 0,
23917        i = 0,
23918        k = 0;
23919
23920    this.nextPacket = function JpxImage_nextPacket() {
23921      for (; r <= maxDecompositionLevelsCount; r++) {
23922        for (; l < layersCount; l++) {
23923          for (; i < componentsCount; i++) {
23924            var component = tile.components[i];
23925
23926            if (r > component.codingStyleParameters.decompositionLevelsCount) {
23927              continue;
23928            }
23929
23930            var resolution = component.resolutions[r];
23931            var numprecincts = resolution.precinctParameters.numprecincts;
23932
23933            for (; k < numprecincts;) {
23934              var packet = createPacket(resolution, k, l);
23935              k++;
23936              return packet;
23937            }
23938
23939            k = 0;
23940          }
23941
23942          i = 0;
23943        }
23944
23945        l = 0;
23946      }
23947
23948      throw new JpxError('Out of packets');
23949    };
23950  }
23951
23952  function ResolutionPositionComponentLayerIterator(context) {
23953    var siz = context.SIZ;
23954    var tileIndex = context.currentTile.index;
23955    var tile = context.tiles[tileIndex];
23956    var layersCount = tile.codingStyleDefaultParameters.layersCount;
23957    var componentsCount = siz.Csiz;
23958    var l, r, c, p;
23959    var maxDecompositionLevelsCount = 0;
23960
23961    for (c = 0; c < componentsCount; c++) {
23962      var component = tile.components[c];
23963      maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
23964    }
23965
23966    var maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
23967
23968    for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
23969      var maxNumPrecincts = 0;
23970
23971      for (c = 0; c < componentsCount; ++c) {
23972        var resolutions = tile.components[c].resolutions;
23973
23974        if (r < resolutions.length) {
23975          maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
23976        }
23977      }
23978
23979      maxNumPrecinctsInLevel[r] = maxNumPrecincts;
23980    }
23981
23982    l = 0;
23983    r = 0;
23984    c = 0;
23985    p = 0;
23986
23987    this.nextPacket = function JpxImage_nextPacket() {
23988      for (; r <= maxDecompositionLevelsCount; r++) {
23989        for (; p < maxNumPrecinctsInLevel[r]; p++) {
23990          for (; c < componentsCount; c++) {
23991            var component = tile.components[c];
23992
23993            if (r > component.codingStyleParameters.decompositionLevelsCount) {
23994              continue;
23995            }
23996
23997            var resolution = component.resolutions[r];
23998            var numprecincts = resolution.precinctParameters.numprecincts;
23999
24000            if (p >= numprecincts) {
24001              continue;
24002            }
24003
24004            for (; l < layersCount;) {
24005              var packet = createPacket(resolution, p, l);
24006              l++;
24007              return packet;
24008            }
24009
24010            l = 0;
24011          }
24012
24013          c = 0;
24014        }
24015
24016        p = 0;
24017      }
24018
24019      throw new JpxError('Out of packets');
24020    };
24021  }
24022
24023  function PositionComponentResolutionLayerIterator(context) {
24024    var siz = context.SIZ;
24025    var tileIndex = context.currentTile.index;
24026    var tile = context.tiles[tileIndex];
24027    var layersCount = tile.codingStyleDefaultParameters.layersCount;
24028    var componentsCount = siz.Csiz;
24029    var precinctsSizes = getPrecinctSizesInImageScale(tile);
24030    var precinctsIterationSizes = precinctsSizes;
24031    var l = 0,
24032        r = 0,
24033        c = 0,
24034        px = 0,
24035        py = 0;
24036
24037    this.nextPacket = function JpxImage_nextPacket() {
24038      for (; py < precinctsIterationSizes.maxNumHigh; py++) {
24039        for (; px < precinctsIterationSizes.maxNumWide; px++) {
24040          for (; c < componentsCount; c++) {
24041            var component = tile.components[c];
24042            var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
24043
24044            for (; r <= decompositionLevelsCount; r++) {
24045              var resolution = component.resolutions[r];
24046              var sizeInImageScale = precinctsSizes.components[c].resolutions[r];
24047              var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
24048
24049              if (k === null) {
24050                continue;
24051              }
24052
24053              for (; l < layersCount;) {
24054                var packet = createPacket(resolution, k, l);
24055                l++;
24056                return packet;
24057              }
24058
24059              l = 0;
24060            }
24061
24062            r = 0;
24063          }
24064
24065          c = 0;
24066        }
24067
24068        px = 0;
24069      }
24070
24071      throw new JpxError('Out of packets');
24072    };
24073  }
24074
24075  function ComponentPositionResolutionLayerIterator(context) {
24076    var siz = context.SIZ;
24077    var tileIndex = context.currentTile.index;
24078    var tile = context.tiles[tileIndex];
24079    var layersCount = tile.codingStyleDefaultParameters.layersCount;
24080    var componentsCount = siz.Csiz;
24081    var precinctsSizes = getPrecinctSizesInImageScale(tile);
24082    var l = 0,
24083        r = 0,
24084        c = 0,
24085        px = 0,
24086        py = 0;
24087
24088    this.nextPacket = function JpxImage_nextPacket() {
24089      for (; c < componentsCount; ++c) {
24090        var component = tile.components[c];
24091        var precinctsIterationSizes = precinctsSizes.components[c];
24092        var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
24093
24094        for (; py < precinctsIterationSizes.maxNumHigh; py++) {
24095          for (; px < precinctsIterationSizes.maxNumWide; px++) {
24096            for (; r <= decompositionLevelsCount; r++) {
24097              var resolution = component.resolutions[r];
24098              var sizeInImageScale = precinctsIterationSizes.resolutions[r];
24099              var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
24100
24101              if (k === null) {
24102                continue;
24103              }
24104
24105              for (; l < layersCount;) {
24106                var packet = createPacket(resolution, k, l);
24107                l++;
24108                return packet;
24109              }
24110
24111              l = 0;
24112            }
24113
24114            r = 0;
24115          }
24116
24117          px = 0;
24118        }
24119
24120        py = 0;
24121      }
24122
24123      throw new JpxError('Out of packets');
24124    };
24125  }
24126
24127  function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
24128    var posX = pxIndex * precinctIterationSizes.minWidth;
24129    var posY = pyIndex * precinctIterationSizes.minHeight;
24130
24131    if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
24132      return null;
24133    }
24134
24135    var startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
24136    return posX / sizeInImageScale.height + startPrecinctRowIndex;
24137  }
24138
24139  function getPrecinctSizesInImageScale(tile) {
24140    var componentsCount = tile.components.length;
24141    var minWidth = Number.MAX_VALUE;
24142    var minHeight = Number.MAX_VALUE;
24143    var maxNumWide = 0;
24144    var maxNumHigh = 0;
24145    var sizePerComponent = new Array(componentsCount);
24146
24147    for (var c = 0; c < componentsCount; c++) {
24148      var component = tile.components[c];
24149      var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
24150      var sizePerResolution = new Array(decompositionLevelsCount + 1);
24151      var minWidthCurrentComponent = Number.MAX_VALUE;
24152      var minHeightCurrentComponent = Number.MAX_VALUE;
24153      var maxNumWideCurrentComponent = 0;
24154      var maxNumHighCurrentComponent = 0;
24155      var scale = 1;
24156
24157      for (var r = decompositionLevelsCount; r >= 0; --r) {
24158        var resolution = component.resolutions[r];
24159        var widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
24160        var heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
24161        minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
24162        minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
24163        maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
24164        maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
24165        sizePerResolution[r] = {
24166          width: widthCurrentResolution,
24167          height: heightCurrentResolution
24168        };
24169        scale <<= 1;
24170      }
24171
24172      minWidth = Math.min(minWidth, minWidthCurrentComponent);
24173      minHeight = Math.min(minHeight, minHeightCurrentComponent);
24174      maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
24175      maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
24176      sizePerComponent[c] = {
24177        resolutions: sizePerResolution,
24178        minWidth: minWidthCurrentComponent,
24179        minHeight: minHeightCurrentComponent,
24180        maxNumWide: maxNumWideCurrentComponent,
24181        maxNumHigh: maxNumHighCurrentComponent
24182      };
24183    }
24184
24185    return {
24186      components: sizePerComponent,
24187      minWidth: minWidth,
24188      minHeight: minHeight,
24189      maxNumWide: maxNumWide,
24190      maxNumHigh: maxNumHigh
24191    };
24192  }
24193
24194  function buildPackets(context) {
24195    var siz = context.SIZ;
24196    var tileIndex = context.currentTile.index;
24197    var tile = context.tiles[tileIndex];
24198    var componentsCount = siz.Csiz;
24199
24200    for (var c = 0; c < componentsCount; c++) {
24201      var component = tile.components[c];
24202      var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
24203      var resolutions = [];
24204      var subbands = [];
24205
24206      for (var r = 0; r <= decompositionLevelsCount; r++) {
24207        var blocksDimensions = getBlocksDimensions(context, component, r);
24208        var resolution = {};
24209        var scale = 1 << decompositionLevelsCount - r;
24210        resolution.trx0 = Math.ceil(component.tcx0 / scale);
24211        resolution.try0 = Math.ceil(component.tcy0 / scale);
24212        resolution.trx1 = Math.ceil(component.tcx1 / scale);
24213        resolution.try1 = Math.ceil(component.tcy1 / scale);
24214        resolution.resLevel = r;
24215        buildPrecincts(context, resolution, blocksDimensions);
24216        resolutions.push(resolution);
24217        var subband;
24218
24219        if (r === 0) {
24220          subband = {};
24221          subband.type = 'LL';
24222          subband.tbx0 = Math.ceil(component.tcx0 / scale);
24223          subband.tby0 = Math.ceil(component.tcy0 / scale);
24224          subband.tbx1 = Math.ceil(component.tcx1 / scale);
24225          subband.tby1 = Math.ceil(component.tcy1 / scale);
24226          subband.resolution = resolution;
24227          buildCodeblocks(context, subband, blocksDimensions);
24228          subbands.push(subband);
24229          resolution.subbands = [subband];
24230        } else {
24231          var bscale = 1 << decompositionLevelsCount - r + 1;
24232          var resolutionSubbands = [];
24233          subband = {};
24234          subband.type = 'HL';
24235          subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
24236          subband.tby0 = Math.ceil(component.tcy0 / bscale);
24237          subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
24238          subband.tby1 = Math.ceil(component.tcy1 / bscale);
24239          subband.resolution = resolution;
24240          buildCodeblocks(context, subband, blocksDimensions);
24241          subbands.push(subband);
24242          resolutionSubbands.push(subband);
24243          subband = {};
24244          subband.type = 'LH';
24245          subband.tbx0 = Math.ceil(component.tcx0 / bscale);
24246          subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
24247          subband.tbx1 = Math.ceil(component.tcx1 / bscale);
24248          subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
24249          subband.resolution = resolution;
24250          buildCodeblocks(context, subband, blocksDimensions);
24251          subbands.push(subband);
24252          resolutionSubbands.push(subband);
24253          subband = {};
24254          subband.type = 'HH';
24255          subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
24256          subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
24257          subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
24258          subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
24259          subband.resolution = resolution;
24260          buildCodeblocks(context, subband, blocksDimensions);
24261          subbands.push(subband);
24262          resolutionSubbands.push(subband);
24263          resolution.subbands = resolutionSubbands;
24264        }
24265      }
24266
24267      component.resolutions = resolutions;
24268      component.subbands = subbands;
24269    }
24270
24271    var progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
24272
24273    switch (progressionOrder) {
24274      case 0:
24275        tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
24276        break;
24277
24278      case 1:
24279        tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
24280        break;
24281
24282      case 2:
24283        tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
24284        break;
24285
24286      case 3:
24287        tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
24288        break;
24289
24290      case 4:
24291        tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
24292        break;
24293
24294      default:
24295        throw new JpxError("Unsupported progression order ".concat(progressionOrder));
24296    }
24297  }
24298
24299  function parseTilePackets(context, data, offset, dataLength) {
24300    var position = 0;
24301    var buffer,
24302        bufferSize = 0,
24303        skipNextBit = false;
24304
24305    function readBits(count) {
24306      while (bufferSize < count) {
24307        var b = data[offset + position];
24308        position++;
24309
24310        if (skipNextBit) {
24311          buffer = buffer << 7 | b;
24312          bufferSize += 7;
24313          skipNextBit = false;
24314        } else {
24315          buffer = buffer << 8 | b;
24316          bufferSize += 8;
24317        }
24318
24319        if (b === 0xFF) {
24320          skipNextBit = true;
24321        }
24322      }
24323
24324      bufferSize -= count;
24325      return buffer >>> bufferSize & (1 << count) - 1;
24326    }
24327
24328    function skipMarkerIfEqual(value) {
24329      if (data[offset + position - 1] === 0xFF && data[offset + position] === value) {
24330        skipBytes(1);
24331        return true;
24332      } else if (data[offset + position] === 0xFF && data[offset + position + 1] === value) {
24333        skipBytes(2);
24334        return true;
24335      }
24336
24337      return false;
24338    }
24339
24340    function skipBytes(count) {
24341      position += count;
24342    }
24343
24344    function alignToByte() {
24345      bufferSize = 0;
24346
24347      if (skipNextBit) {
24348        position++;
24349        skipNextBit = false;
24350      }
24351    }
24352
24353    function readCodingpasses() {
24354      if (readBits(1) === 0) {
24355        return 1;
24356      }
24357
24358      if (readBits(1) === 0) {
24359        return 2;
24360      }
24361
24362      var value = readBits(2);
24363
24364      if (value < 3) {
24365        return value + 3;
24366      }
24367
24368      value = readBits(5);
24369
24370      if (value < 31) {
24371        return value + 6;
24372      }
24373
24374      value = readBits(7);
24375      return value + 37;
24376    }
24377
24378    var tileIndex = context.currentTile.index;
24379    var tile = context.tiles[tileIndex];
24380    var sopMarkerUsed = context.COD.sopMarkerUsed;
24381    var ephMarkerUsed = context.COD.ephMarkerUsed;
24382    var packetsIterator = tile.packetsIterator;
24383
24384    while (position < dataLength) {
24385      alignToByte();
24386
24387      if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
24388        skipBytes(4);
24389      }
24390
24391      var packet = packetsIterator.nextPacket();
24392
24393      if (!readBits(1)) {
24394        continue;
24395      }
24396
24397      var layerNumber = packet.layerNumber;
24398      var queue = [],
24399          codeblock;
24400
24401      for (var i = 0, ii = packet.codeblocks.length; i < ii; i++) {
24402        codeblock = packet.codeblocks[i];
24403        var precinct = codeblock.precinct;
24404        var codeblockColumn = codeblock.cbx - precinct.cbxMin;
24405        var codeblockRow = codeblock.cby - precinct.cbyMin;
24406        var codeblockIncluded = false;
24407        var firstTimeInclusion = false;
24408        var valueReady;
24409
24410        if (codeblock['included'] !== undefined) {
24411          codeblockIncluded = !!readBits(1);
24412        } else {
24413          precinct = codeblock.precinct;
24414          var inclusionTree, zeroBitPlanesTree;
24415
24416          if (precinct['inclusionTree'] !== undefined) {
24417            inclusionTree = precinct.inclusionTree;
24418          } else {
24419            var width = precinct.cbxMax - precinct.cbxMin + 1;
24420            var height = precinct.cbyMax - precinct.cbyMin + 1;
24421            inclusionTree = new InclusionTree(width, height, layerNumber);
24422            zeroBitPlanesTree = new TagTree(width, height);
24423            precinct.inclusionTree = inclusionTree;
24424            precinct.zeroBitPlanesTree = zeroBitPlanesTree;
24425          }
24426
24427          if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
24428            while (true) {
24429              if (readBits(1)) {
24430                valueReady = !inclusionTree.nextLevel();
24431
24432                if (valueReady) {
24433                  codeblock.included = true;
24434                  codeblockIncluded = firstTimeInclusion = true;
24435                  break;
24436                }
24437              } else {
24438                inclusionTree.incrementValue(layerNumber);
24439                break;
24440              }
24441            }
24442          }
24443        }
24444
24445        if (!codeblockIncluded) {
24446          continue;
24447        }
24448
24449        if (firstTimeInclusion) {
24450          zeroBitPlanesTree = precinct.zeroBitPlanesTree;
24451          zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
24452
24453          while (true) {
24454            if (readBits(1)) {
24455              valueReady = !zeroBitPlanesTree.nextLevel();
24456
24457              if (valueReady) {
24458                break;
24459              }
24460            } else {
24461              zeroBitPlanesTree.incrementValue();
24462            }
24463          }
24464
24465          codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
24466        }
24467
24468        var codingpasses = readCodingpasses();
24469
24470        while (readBits(1)) {
24471          codeblock.Lblock++;
24472        }
24473
24474        var codingpassesLog2 = (0, _util.log2)(codingpasses);
24475        var bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
24476        var codedDataLength = readBits(bits);
24477        queue.push({
24478          codeblock: codeblock,
24479          codingpasses: codingpasses,
24480          dataLength: codedDataLength
24481        });
24482      }
24483
24484      alignToByte();
24485
24486      if (ephMarkerUsed) {
24487        skipMarkerIfEqual(0x92);
24488      }
24489
24490      while (queue.length > 0) {
24491        var packetItem = queue.shift();
24492        codeblock = packetItem.codeblock;
24493
24494        if (codeblock['data'] === undefined) {
24495          codeblock.data = [];
24496        }
24497
24498        codeblock.data.push({
24499          data: data,
24500          start: offset + position,
24501          end: offset + position + packetItem.dataLength,
24502          codingpasses: packetItem.codingpasses
24503        });
24504        position += packetItem.dataLength;
24505      }
24506    }
24507
24508    return position;
24509  }
24510
24511  function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed) {
24512    var x0 = subband.tbx0;
24513    var y0 = subband.tby0;
24514    var width = subband.tbx1 - subband.tbx0;
24515    var codeblocks = subband.codeblocks;
24516    var right = subband.type.charAt(0) === 'H' ? 1 : 0;
24517    var bottom = subband.type.charAt(1) === 'H' ? levelWidth : 0;
24518
24519    for (var i = 0, ii = codeblocks.length; i < ii; ++i) {
24520      var codeblock = codeblocks[i];
24521      var blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
24522      var blockHeight = codeblock.tby1_ - codeblock.tby0_;
24523
24524      if (blockWidth === 0 || blockHeight === 0) {
24525        continue;
24526      }
24527
24528      if (codeblock['data'] === undefined) {
24529        continue;
24530      }
24531
24532      var bitModel, currentCodingpassType;
24533      bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
24534      currentCodingpassType = 2;
24535      var data = codeblock.data,
24536          totalLength = 0,
24537          codingpasses = 0;
24538      var j, jj, dataItem;
24539
24540      for (j = 0, jj = data.length; j < jj; j++) {
24541        dataItem = data[j];
24542        totalLength += dataItem.end - dataItem.start;
24543        codingpasses += dataItem.codingpasses;
24544      }
24545
24546      var encodedData = new Uint8Array(totalLength);
24547      var position = 0;
24548
24549      for (j = 0, jj = data.length; j < jj; j++) {
24550        dataItem = data[j];
24551        var chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
24552        encodedData.set(chunk, position);
24553        position += chunk.length;
24554      }
24555
24556      var decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength);
24557      bitModel.setDecoder(decoder);
24558
24559      for (j = 0; j < codingpasses; j++) {
24560        switch (currentCodingpassType) {
24561          case 0:
24562            bitModel.runSignificancePropagationPass();
24563            break;
24564
24565          case 1:
24566            bitModel.runMagnitudeRefinementPass();
24567            break;
24568
24569          case 2:
24570            bitModel.runCleanupPass();
24571
24572            if (segmentationSymbolUsed) {
24573              bitModel.checkSegmentationSymbol();
24574            }
24575
24576            break;
24577        }
24578
24579        currentCodingpassType = (currentCodingpassType + 1) % 3;
24580      }
24581
24582      var offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
24583      var sign = bitModel.coefficentsSign;
24584      var magnitude = bitModel.coefficentsMagnitude;
24585      var bitsDecoded = bitModel.bitsDecoded;
24586      var magnitudeCorrection = reversible ? 0 : 0.5;
24587      var k, n, nb;
24588      position = 0;
24589      var interleave = subband.type !== 'LL';
24590
24591      for (j = 0; j < blockHeight; j++) {
24592        var row = offset / width | 0;
24593        var levelOffset = 2 * row * (levelWidth - width) + right + bottom;
24594
24595        for (k = 0; k < blockWidth; k++) {
24596          n = magnitude[position];
24597
24598          if (n !== 0) {
24599            n = (n + magnitudeCorrection) * delta;
24600
24601            if (sign[position] !== 0) {
24602              n = -n;
24603            }
24604
24605            nb = bitsDecoded[position];
24606            var pos = interleave ? levelOffset + (offset << 1) : offset;
24607
24608            if (reversible && nb >= mb) {
24609              coefficients[pos] = n;
24610            } else {
24611              coefficients[pos] = n * (1 << mb - nb);
24612            }
24613          }
24614
24615          offset++;
24616          position++;
24617        }
24618
24619        offset += width - blockWidth;
24620      }
24621    }
24622  }
24623
24624  function transformTile(context, tile, c) {
24625    var component = tile.components[c];
24626    var codingStyleParameters = component.codingStyleParameters;
24627    var quantizationParameters = component.quantizationParameters;
24628    var decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
24629    var spqcds = quantizationParameters.SPqcds;
24630    var scalarExpounded = quantizationParameters.scalarExpounded;
24631    var guardBits = quantizationParameters.guardBits;
24632    var segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
24633    var precision = context.components[c].precision;
24634    var reversible = codingStyleParameters.reversibleTransformation;
24635    var transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
24636    var subbandCoefficients = [];
24637    var b = 0;
24638
24639    for (var i = 0; i <= decompositionLevelsCount; i++) {
24640      var resolution = component.resolutions[i];
24641      var width = resolution.trx1 - resolution.trx0;
24642      var height = resolution.try1 - resolution.try0;
24643      var coefficients = new Float32Array(width * height);
24644
24645      for (var j = 0, jj = resolution.subbands.length; j < jj; j++) {
24646        var mu, epsilon;
24647
24648        if (!scalarExpounded) {
24649          mu = spqcds[0].mu;
24650          epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
24651        } else {
24652          mu = spqcds[b].mu;
24653          epsilon = spqcds[b].epsilon;
24654          b++;
24655        }
24656
24657        var subband = resolution.subbands[j];
24658        var gainLog2 = SubbandsGainLog2[subband.type];
24659        var delta = reversible ? 1 : Math.pow(2, precision + gainLog2 - epsilon) * (1 + mu / 2048);
24660        var mb = guardBits + epsilon - 1;
24661        copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed);
24662      }
24663
24664      subbandCoefficients.push({
24665        width: width,
24666        height: height,
24667        items: coefficients
24668      });
24669    }
24670
24671    var result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
24672    return {
24673      left: component.tcx0,
24674      top: component.tcy0,
24675      width: result.width,
24676      height: result.height,
24677      items: result.items
24678    };
24679  }
24680
24681  function transformComponents(context) {
24682    var siz = context.SIZ;
24683    var components = context.components;
24684    var componentsCount = siz.Csiz;
24685    var resultImages = [];
24686
24687    for (var i = 0, ii = context.tiles.length; i < ii; i++) {
24688      var tile = context.tiles[i];
24689      var transformedTiles = [];
24690      var c;
24691
24692      for (c = 0; c < componentsCount; c++) {
24693        transformedTiles[c] = transformTile(context, tile, c);
24694      }
24695
24696      var tile0 = transformedTiles[0];
24697      var out = new Uint8ClampedArray(tile0.items.length * componentsCount);
24698      var result = {
24699        left: tile0.left,
24700        top: tile0.top,
24701        width: tile0.width,
24702        height: tile0.height,
24703        items: out
24704      };
24705      var shift, offset;
24706      var pos = 0,
24707          j,
24708          jj,
24709          y0,
24710          y1,
24711          y2;
24712
24713      if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
24714        var fourComponents = componentsCount === 4;
24715        var y0items = transformedTiles[0].items;
24716        var y1items = transformedTiles[1].items;
24717        var y2items = transformedTiles[2].items;
24718        var y3items = fourComponents ? transformedTiles[3].items : null;
24719        shift = components[0].precision - 8;
24720        offset = (128 << shift) + 0.5;
24721        var component0 = tile.components[0];
24722        var alpha01 = componentsCount - 3;
24723        jj = y0items.length;
24724
24725        if (!component0.codingStyleParameters.reversibleTransformation) {
24726          for (j = 0; j < jj; j++, pos += alpha01) {
24727            y0 = y0items[j] + offset;
24728            y1 = y1items[j];
24729            y2 = y2items[j];
24730            out[pos++] = y0 + 1.402 * y2 >> shift;
24731            out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift;
24732            out[pos++] = y0 + 1.772 * y1 >> shift;
24733          }
24734        } else {
24735          for (j = 0; j < jj; j++, pos += alpha01) {
24736            y0 = y0items[j] + offset;
24737            y1 = y1items[j];
24738            y2 = y2items[j];
24739            var g = y0 - (y2 + y1 >> 2);
24740            out[pos++] = g + y2 >> shift;
24741            out[pos++] = g >> shift;
24742            out[pos++] = g + y1 >> shift;
24743          }
24744        }
24745
24746        if (fourComponents) {
24747          for (j = 0, pos = 3; j < jj; j++, pos += 4) {
24748            out[pos] = y3items[j] + offset >> shift;
24749          }
24750        }
24751      } else {
24752        for (c = 0; c < componentsCount; c++) {
24753          var items = transformedTiles[c].items;
24754          shift = components[c].precision - 8;
24755          offset = (128 << shift) + 0.5;
24756
24757          for (pos = c, j = 0, jj = items.length; j < jj; j++) {
24758            out[pos] = items[j] + offset >> shift;
24759            pos += componentsCount;
24760          }
24761        }
24762      }
24763
24764      resultImages.push(result);
24765    }
24766
24767    return resultImages;
24768  }
24769
24770  function initializeTile(context, tileIndex) {
24771    var siz = context.SIZ;
24772    var componentsCount = siz.Csiz;
24773    var tile = context.tiles[tileIndex];
24774
24775    for (var c = 0; c < componentsCount; c++) {
24776      var component = tile.components[c];
24777      var qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
24778      component.quantizationParameters = qcdOrQcc;
24779      var codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
24780      component.codingStyleParameters = codOrCoc;
24781    }
24782
24783    tile.codingStyleDefaultParameters = context.currentTile.COD;
24784  }
24785
24786  var TagTree = function TagTreeClosure() {
24787    function TagTree(width, height) {
24788      var levelsLength = (0, _util.log2)(Math.max(width, height)) + 1;
24789      this.levels = [];
24790
24791      for (var i = 0; i < levelsLength; i++) {
24792        var level = {
24793          width: width,
24794          height: height,
24795          items: []
24796        };
24797        this.levels.push(level);
24798        width = Math.ceil(width / 2);
24799        height = Math.ceil(height / 2);
24800      }
24801    }
24802
24803    TagTree.prototype = {
24804      reset: function TagTree_reset(i, j) {
24805        var currentLevel = 0,
24806            value = 0,
24807            level;
24808
24809        while (currentLevel < this.levels.length) {
24810          level = this.levels[currentLevel];
24811          var index = i + j * level.width;
24812
24813          if (level.items[index] !== undefined) {
24814            value = level.items[index];
24815            break;
24816          }
24817
24818          level.index = index;
24819          i >>= 1;
24820          j >>= 1;
24821          currentLevel++;
24822        }
24823
24824        currentLevel--;
24825        level = this.levels[currentLevel];
24826        level.items[level.index] = value;
24827        this.currentLevel = currentLevel;
24828        delete this.value;
24829      },
24830      incrementValue: function TagTree_incrementValue() {
24831        var level = this.levels[this.currentLevel];
24832        level.items[level.index]++;
24833      },
24834      nextLevel: function TagTree_nextLevel() {
24835        var currentLevel = this.currentLevel;
24836        var level = this.levels[currentLevel];
24837        var value = level.items[level.index];
24838        currentLevel--;
24839
24840        if (currentLevel < 0) {
24841          this.value = value;
24842          return false;
24843        }
24844
24845        this.currentLevel = currentLevel;
24846        level = this.levels[currentLevel];
24847        level.items[level.index] = value;
24848        return true;
24849      }
24850    };
24851    return TagTree;
24852  }();
24853
24854  var InclusionTree = function InclusionTreeClosure() {
24855    function InclusionTree(width, height, defaultValue) {
24856      var levelsLength = (0, _util.log2)(Math.max(width, height)) + 1;
24857      this.levels = [];
24858
24859      for (var i = 0; i < levelsLength; i++) {
24860        var items = new Uint8Array(width * height);
24861
24862        for (var j = 0, jj = items.length; j < jj; j++) {
24863          items[j] = defaultValue;
24864        }
24865
24866        var level = {
24867          width: width,
24868          height: height,
24869          items: items
24870        };
24871        this.levels.push(level);
24872        width = Math.ceil(width / 2);
24873        height = Math.ceil(height / 2);
24874      }
24875    }
24876
24877    InclusionTree.prototype = {
24878      reset: function InclusionTree_reset(i, j, stopValue) {
24879        var currentLevel = 0;
24880
24881        while (currentLevel < this.levels.length) {
24882          var level = this.levels[currentLevel];
24883          var index = i + j * level.width;
24884          level.index = index;
24885          var value = level.items[index];
24886
24887          if (value === 0xFF) {
24888            break;
24889          }
24890
24891          if (value > stopValue) {
24892            this.currentLevel = currentLevel;
24893            this.propagateValues();
24894            return false;
24895          }
24896
24897          i >>= 1;
24898          j >>= 1;
24899          currentLevel++;
24900        }
24901
24902        this.currentLevel = currentLevel - 1;
24903        return true;
24904      },
24905      incrementValue: function InclusionTree_incrementValue(stopValue) {
24906        var level = this.levels[this.currentLevel];
24907        level.items[level.index] = stopValue + 1;
24908        this.propagateValues();
24909      },
24910      propagateValues: function InclusionTree_propagateValues() {
24911        var levelIndex = this.currentLevel;
24912        var level = this.levels[levelIndex];
24913        var currentValue = level.items[level.index];
24914
24915        while (--levelIndex >= 0) {
24916          level = this.levels[levelIndex];
24917          level.items[level.index] = currentValue;
24918        }
24919      },
24920      nextLevel: function InclusionTree_nextLevel() {
24921        var currentLevel = this.currentLevel;
24922        var level = this.levels[currentLevel];
24923        var value = level.items[level.index];
24924        level.items[level.index] = 0xFF;
24925        currentLevel--;
24926
24927        if (currentLevel < 0) {
24928          return false;
24929        }
24930
24931        this.currentLevel = currentLevel;
24932        level = this.levels[currentLevel];
24933        level.items[level.index] = value;
24934        return true;
24935      }
24936    };
24937    return InclusionTree;
24938  }();
24939
24940  var BitModel = function BitModelClosure() {
24941    var UNIFORM_CONTEXT = 17;
24942    var RUNLENGTH_CONTEXT = 18;
24943    var LLAndLHContextsLabel = new Uint8Array([0, 5, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 1, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8]);
24944    var HLContextLabel = new Uint8Array([0, 3, 4, 0, 5, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 1, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8]);
24945    var HHContextLabel = new Uint8Array([0, 1, 2, 0, 1, 2, 2, 0, 2, 2, 2, 0, 0, 0, 0, 0, 3, 4, 5, 0, 4, 5, 5, 0, 5, 5, 5, 0, 0, 0, 0, 0, 6, 7, 7, 0, 7, 7, 7, 0, 7, 7, 7, 0, 0, 0, 0, 0, 8, 8, 8, 0, 8, 8, 8, 0, 8, 8, 8, 0, 0, 0, 0, 0, 8, 8, 8, 0, 8, 8, 8, 0, 8, 8, 8]);
24946
24947    function BitModel(width, height, subband, zeroBitPlanes, mb) {
24948      this.width = width;
24949      this.height = height;
24950      this.contextLabelTable = subband === 'HH' ? HHContextLabel : subband === 'HL' ? HLContextLabel : LLAndLHContextsLabel;
24951      var coefficientCount = width * height;
24952      this.neighborsSignificance = new Uint8Array(coefficientCount);
24953      this.coefficentsSign = new Uint8Array(coefficientCount);
24954      this.coefficentsMagnitude = mb > 14 ? new Uint32Array(coefficientCount) : mb > 6 ? new Uint16Array(coefficientCount) : new Uint8Array(coefficientCount);
24955      this.processingFlags = new Uint8Array(coefficientCount);
24956      var bitsDecoded = new Uint8Array(coefficientCount);
24957
24958      if (zeroBitPlanes !== 0) {
24959        for (var i = 0; i < coefficientCount; i++) {
24960          bitsDecoded[i] = zeroBitPlanes;
24961        }
24962      }
24963
24964      this.bitsDecoded = bitsDecoded;
24965      this.reset();
24966    }
24967
24968    BitModel.prototype = {
24969      setDecoder: function BitModel_setDecoder(decoder) {
24970        this.decoder = decoder;
24971      },
24972      reset: function BitModel_reset() {
24973        this.contexts = new Int8Array(19);
24974        this.contexts[0] = 4 << 1 | 0;
24975        this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
24976        this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
24977      },
24978      setNeighborsSignificance: function BitModel_setNeighborsSignificance(row, column, index) {
24979        var neighborsSignificance = this.neighborsSignificance;
24980        var width = this.width,
24981            height = this.height;
24982        var left = column > 0;
24983        var right = column + 1 < width;
24984        var i;
24985
24986        if (row > 0) {
24987          i = index - width;
24988
24989          if (left) {
24990            neighborsSignificance[i - 1] += 0x10;
24991          }
24992
24993          if (right) {
24994            neighborsSignificance[i + 1] += 0x10;
24995          }
24996
24997          neighborsSignificance[i] += 0x04;
24998        }
24999
25000        if (row + 1 < height) {
25001          i = index + width;
25002
25003          if (left) {
25004            neighborsSignificance[i - 1] += 0x10;
25005          }
25006
25007          if (right) {
25008            neighborsSignificance[i + 1] += 0x10;
25009          }
25010
25011          neighborsSignificance[i] += 0x04;
25012        }
25013
25014        if (left) {
25015          neighborsSignificance[index - 1] += 0x01;
25016        }
25017
25018        if (right) {
25019          neighborsSignificance[index + 1] += 0x01;
25020        }
25021
25022        neighborsSignificance[index] |= 0x80;
25023      },
25024      runSignificancePropagationPass: function BitModel_runSignificancePropagationPass() {
25025        var decoder = this.decoder;
25026        var width = this.width,
25027            height = this.height;
25028        var coefficentsMagnitude = this.coefficentsMagnitude;
25029        var coefficentsSign = this.coefficentsSign;
25030        var neighborsSignificance = this.neighborsSignificance;
25031        var processingFlags = this.processingFlags;
25032        var contexts = this.contexts;
25033        var labels = this.contextLabelTable;
25034        var bitsDecoded = this.bitsDecoded;
25035        var processedInverseMask = ~1;
25036        var processedMask = 1;
25037        var firstMagnitudeBitMask = 2;
25038
25039        for (var i0 = 0; i0 < height; i0 += 4) {
25040          for (var j = 0; j < width; j++) {
25041            var index = i0 * width + j;
25042
25043            for (var i1 = 0; i1 < 4; i1++, index += width) {
25044              var i = i0 + i1;
25045
25046              if (i >= height) {
25047                break;
25048              }
25049
25050              processingFlags[index] &= processedInverseMask;
25051
25052              if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
25053                continue;
25054              }
25055
25056              var contextLabel = labels[neighborsSignificance[index]];
25057              var decision = decoder.readBit(contexts, contextLabel);
25058
25059              if (decision) {
25060                var sign = this.decodeSignBit(i, j, index);
25061                coefficentsSign[index] = sign;
25062                coefficentsMagnitude[index] = 1;
25063                this.setNeighborsSignificance(i, j, index);
25064                processingFlags[index] |= firstMagnitudeBitMask;
25065              }
25066
25067              bitsDecoded[index]++;
25068              processingFlags[index] |= processedMask;
25069            }
25070          }
25071        }
25072      },
25073      decodeSignBit: function BitModel_decodeSignBit(row, column, index) {
25074        var width = this.width,
25075            height = this.height;
25076        var coefficentsMagnitude = this.coefficentsMagnitude;
25077        var coefficentsSign = this.coefficentsSign;
25078        var contribution, sign0, sign1, significance1;
25079        var contextLabel, decoded;
25080        significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
25081
25082        if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
25083          sign1 = coefficentsSign[index + 1];
25084
25085          if (significance1) {
25086            sign0 = coefficentsSign[index - 1];
25087            contribution = 1 - sign1 - sign0;
25088          } else {
25089            contribution = 1 - sign1 - sign1;
25090          }
25091        } else if (significance1) {
25092          sign0 = coefficentsSign[index - 1];
25093          contribution = 1 - sign0 - sign0;
25094        } else {
25095          contribution = 0;
25096        }
25097
25098        var horizontalContribution = 3 * contribution;
25099        significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
25100
25101        if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
25102          sign1 = coefficentsSign[index + width];
25103
25104          if (significance1) {
25105            sign0 = coefficentsSign[index - width];
25106            contribution = 1 - sign1 - sign0 + horizontalContribution;
25107          } else {
25108            contribution = 1 - sign1 - sign1 + horizontalContribution;
25109          }
25110        } else if (significance1) {
25111          sign0 = coefficentsSign[index - width];
25112          contribution = 1 - sign0 - sign0 + horizontalContribution;
25113        } else {
25114          contribution = horizontalContribution;
25115        }
25116
25117        if (contribution >= 0) {
25118          contextLabel = 9 + contribution;
25119          decoded = this.decoder.readBit(this.contexts, contextLabel);
25120        } else {
25121          contextLabel = 9 - contribution;
25122          decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
25123        }
25124
25125        return decoded;
25126      },
25127      runMagnitudeRefinementPass: function BitModel_runMagnitudeRefinementPass() {
25128        var decoder = this.decoder;
25129        var width = this.width,
25130            height = this.height;
25131        var coefficentsMagnitude = this.coefficentsMagnitude;
25132        var neighborsSignificance = this.neighborsSignificance;
25133        var contexts = this.contexts;
25134        var bitsDecoded = this.bitsDecoded;
25135        var processingFlags = this.processingFlags;
25136        var processedMask = 1;
25137        var firstMagnitudeBitMask = 2;
25138        var length = width * height;
25139        var width4 = width * 4;
25140
25141        for (var index0 = 0, indexNext; index0 < length; index0 = indexNext) {
25142          indexNext = Math.min(length, index0 + width4);
25143
25144          for (var j = 0; j < width; j++) {
25145            for (var index = index0 + j; index < indexNext; index += width) {
25146              if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
25147                continue;
25148              }
25149
25150              var contextLabel = 16;
25151
25152              if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
25153                processingFlags[index] ^= firstMagnitudeBitMask;
25154                var significance = neighborsSignificance[index] & 127;
25155                contextLabel = significance === 0 ? 15 : 14;
25156              }
25157
25158              var bit = decoder.readBit(contexts, contextLabel);
25159              coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
25160              bitsDecoded[index]++;
25161              processingFlags[index] |= processedMask;
25162            }
25163          }
25164        }
25165      },
25166      runCleanupPass: function BitModel_runCleanupPass() {
25167        var decoder = this.decoder;
25168        var width = this.width,
25169            height = this.height;
25170        var neighborsSignificance = this.neighborsSignificance;
25171        var coefficentsMagnitude = this.coefficentsMagnitude;
25172        var coefficentsSign = this.coefficentsSign;
25173        var contexts = this.contexts;
25174        var labels = this.contextLabelTable;
25175        var bitsDecoded = this.bitsDecoded;
25176        var processingFlags = this.processingFlags;
25177        var processedMask = 1;
25178        var firstMagnitudeBitMask = 2;
25179        var oneRowDown = width;
25180        var twoRowsDown = width * 2;
25181        var threeRowsDown = width * 3;
25182        var iNext;
25183
25184        for (var i0 = 0; i0 < height; i0 = iNext) {
25185          iNext = Math.min(i0 + 4, height);
25186          var indexBase = i0 * width;
25187          var checkAllEmpty = i0 + 3 < height;
25188
25189          for (var j = 0; j < width; j++) {
25190            var index0 = indexBase + j;
25191            var allEmpty = checkAllEmpty && processingFlags[index0] === 0 && processingFlags[index0 + oneRowDown] === 0 && processingFlags[index0 + twoRowsDown] === 0 && processingFlags[index0 + threeRowsDown] === 0 && neighborsSignificance[index0] === 0 && neighborsSignificance[index0 + oneRowDown] === 0 && neighborsSignificance[index0 + twoRowsDown] === 0 && neighborsSignificance[index0 + threeRowsDown] === 0;
25192            var i1 = 0,
25193                index = index0;
25194            var i = i0,
25195                sign;
25196
25197            if (allEmpty) {
25198              var hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
25199
25200              if (!hasSignificantCoefficent) {
25201                bitsDecoded[index0]++;
25202                bitsDecoded[index0 + oneRowDown]++;
25203                bitsDecoded[index0 + twoRowsDown]++;
25204                bitsDecoded[index0 + threeRowsDown]++;
25205                continue;
25206              }
25207
25208              i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
25209
25210              if (i1 !== 0) {
25211                i = i0 + i1;
25212                index += i1 * width;
25213              }
25214
25215              sign = this.decodeSignBit(i, j, index);
25216              coefficentsSign[index] = sign;
25217              coefficentsMagnitude[index] = 1;
25218              this.setNeighborsSignificance(i, j, index);
25219              processingFlags[index] |= firstMagnitudeBitMask;
25220              index = index0;
25221
25222              for (var i2 = i0; i2 <= i; i2++, index += width) {
25223                bitsDecoded[index]++;
25224              }
25225
25226              i1++;
25227            }
25228
25229            for (i = i0 + i1; i < iNext; i++, index += width) {
25230              if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
25231                continue;
25232              }
25233
25234              var contextLabel = labels[neighborsSignificance[index]];
25235              var decision = decoder.readBit(contexts, contextLabel);
25236
25237              if (decision === 1) {
25238                sign = this.decodeSignBit(i, j, index);
25239                coefficentsSign[index] = sign;
25240                coefficentsMagnitude[index] = 1;
25241                this.setNeighborsSignificance(i, j, index);
25242                processingFlags[index] |= firstMagnitudeBitMask;
25243              }
25244
25245              bitsDecoded[index]++;
25246            }
25247          }
25248        }
25249      },
25250      checkSegmentationSymbol: function BitModel_checkSegmentationSymbol() {
25251        var decoder = this.decoder;
25252        var contexts = this.contexts;
25253        var symbol = decoder.readBit(contexts, UNIFORM_CONTEXT) << 3 | decoder.readBit(contexts, UNIFORM_CONTEXT) << 2 | decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
25254
25255        if (symbol !== 0xA) {
25256          throw new JpxError('Invalid segmentation symbol');
25257        }
25258      }
25259    };
25260    return BitModel;
25261  }();
25262
25263  var Transform = function TransformClosure() {
25264    function Transform() {}
25265
25266    Transform.prototype.calculate = function transformCalculate(subbands, u0, v0) {
25267      var ll = subbands[0];
25268
25269      for (var i = 1, ii = subbands.length; i < ii; i++) {
25270        ll = this.iterate(ll, subbands[i], u0, v0);
25271      }
25272
25273      return ll;
25274    };
25275
25276    Transform.prototype.extend = function extend(buffer, offset, size) {
25277      var i1 = offset - 1,
25278          j1 = offset + 1;
25279      var i2 = offset + size - 2,
25280          j2 = offset + size;
25281      buffer[i1--] = buffer[j1++];
25282      buffer[j2++] = buffer[i2--];
25283      buffer[i1--] = buffer[j1++];
25284      buffer[j2++] = buffer[i2--];
25285      buffer[i1--] = buffer[j1++];
25286      buffer[j2++] = buffer[i2--];
25287      buffer[i1] = buffer[j1];
25288      buffer[j2] = buffer[i2];
25289    };
25290
25291    Transform.prototype.iterate = function Transform_iterate(ll, hl_lh_hh, u0, v0) {
25292      var llWidth = ll.width,
25293          llHeight = ll.height,
25294          llItems = ll.items;
25295      var width = hl_lh_hh.width;
25296      var height = hl_lh_hh.height;
25297      var items = hl_lh_hh.items;
25298      var i, j, k, l, u, v;
25299
25300      for (k = 0, i = 0; i < llHeight; i++) {
25301        l = i * 2 * width;
25302
25303        for (j = 0; j < llWidth; j++, k++, l += 2) {
25304          items[l] = llItems[k];
25305        }
25306      }
25307
25308      llItems = ll.items = null;
25309      var bufferPadding = 4;
25310      var rowBuffer = new Float32Array(width + 2 * bufferPadding);
25311
25312      if (width === 1) {
25313        if ((u0 & 1) !== 0) {
25314          for (v = 0, k = 0; v < height; v++, k += width) {
25315            items[k] *= 0.5;
25316          }
25317        }
25318      } else {
25319        for (v = 0, k = 0; v < height; v++, k += width) {
25320          rowBuffer.set(items.subarray(k, k + width), bufferPadding);
25321          this.extend(rowBuffer, bufferPadding, width);
25322          this.filter(rowBuffer, bufferPadding, width);
25323          items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
25324        }
25325      }
25326
25327      var numBuffers = 16;
25328      var colBuffers = [];
25329
25330      for (i = 0; i < numBuffers; i++) {
25331        colBuffers.push(new Float32Array(height + 2 * bufferPadding));
25332      }
25333
25334      var b,
25335          currentBuffer = 0;
25336      ll = bufferPadding + height;
25337
25338      if (height === 1) {
25339        if ((v0 & 1) !== 0) {
25340          for (u = 0; u < width; u++) {
25341            items[u] *= 0.5;
25342          }
25343        }
25344      } else {
25345        for (u = 0; u < width; u++) {
25346          if (currentBuffer === 0) {
25347            numBuffers = Math.min(width - u, numBuffers);
25348
25349            for (k = u, l = bufferPadding; l < ll; k += width, l++) {
25350              for (b = 0; b < numBuffers; b++) {
25351                colBuffers[b][l] = items[k + b];
25352              }
25353            }
25354
25355            currentBuffer = numBuffers;
25356          }
25357
25358          currentBuffer--;
25359          var buffer = colBuffers[currentBuffer];
25360          this.extend(buffer, bufferPadding, height);
25361          this.filter(buffer, bufferPadding, height);
25362
25363          if (currentBuffer === 0) {
25364            k = u - numBuffers + 1;
25365
25366            for (l = bufferPadding; l < ll; k += width, l++) {
25367              for (b = 0; b < numBuffers; b++) {
25368                items[k + b] = colBuffers[b][l];
25369              }
25370            }
25371          }
25372        }
25373      }
25374
25375      return {
25376        width: width,
25377        height: height,
25378        items: items
25379      };
25380    };
25381
25382    return Transform;
25383  }();
25384
25385  var IrreversibleTransform = function IrreversibleTransformClosure() {
25386    function IrreversibleTransform() {
25387      Transform.call(this);
25388    }
25389
25390    IrreversibleTransform.prototype = Object.create(Transform.prototype);
25391
25392    IrreversibleTransform.prototype.filter = function irreversibleTransformFilter(x, offset, length) {
25393      var len = length >> 1;
25394      offset = offset | 0;
25395      var j, n, current, next;
25396      var alpha = -1.586134342059924;
25397      var beta = -0.052980118572961;
25398      var gamma = 0.882911075530934;
25399      var delta = 0.443506852043971;
25400      var K = 1.230174104914001;
25401      var K_ = 1 / K;
25402      j = offset - 3;
25403
25404      for (n = len + 4; n--; j += 2) {
25405        x[j] *= K_;
25406      }
25407
25408      j = offset - 2;
25409      current = delta * x[j - 1];
25410
25411      for (n = len + 3; n--; j += 2) {
25412        next = delta * x[j + 1];
25413        x[j] = K * x[j] - current - next;
25414
25415        if (n--) {
25416          j += 2;
25417          current = delta * x[j + 1];
25418          x[j] = K * x[j] - current - next;
25419        } else {
25420          break;
25421        }
25422      }
25423
25424      j = offset - 1;
25425      current = gamma * x[j - 1];
25426
25427      for (n = len + 2; n--; j += 2) {
25428        next = gamma * x[j + 1];
25429        x[j] -= current + next;
25430
25431        if (n--) {
25432          j += 2;
25433          current = gamma * x[j + 1];
25434          x[j] -= current + next;
25435        } else {
25436          break;
25437        }
25438      }
25439
25440      j = offset;
25441      current = beta * x[j - 1];
25442
25443      for (n = len + 1; n--; j += 2) {
25444        next = beta * x[j + 1];
25445        x[j] -= current + next;
25446
25447        if (n--) {
25448          j += 2;
25449          current = beta * x[j + 1];
25450          x[j] -= current + next;
25451        } else {
25452          break;
25453        }
25454      }
25455
25456      if (len !== 0) {
25457        j = offset + 1;
25458        current = alpha * x[j - 1];
25459
25460        for (n = len; n--; j += 2) {
25461          next = alpha * x[j + 1];
25462          x[j] -= current + next;
25463
25464          if (n--) {
25465            j += 2;
25466            current = alpha * x[j + 1];
25467            x[j] -= current + next;
25468          } else {
25469            break;
25470          }
25471        }
25472      }
25473    };
25474
25475    return IrreversibleTransform;
25476  }();
25477
25478  var ReversibleTransform = function ReversibleTransformClosure() {
25479    function ReversibleTransform() {
25480      Transform.call(this);
25481    }
25482
25483    ReversibleTransform.prototype = Object.create(Transform.prototype);
25484
25485    ReversibleTransform.prototype.filter = function reversibleTransformFilter(x, offset, length) {
25486      var len = length >> 1;
25487      offset = offset | 0;
25488      var j, n;
25489
25490      for (j = offset, n = len + 1; n--; j += 2) {
25491        x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
25492      }
25493
25494      for (j = offset + 1, n = len; n--; j += 2) {
25495        x[j] += x[j - 1] + x[j + 1] >> 1;
25496      }
25497    };
25498
25499    return ReversibleTransform;
25500  }();
25501
25502  return JpxImage;
25503}();
25504
25505exports.JpxImage = JpxImage;
25506
25507/***/ }),
25508/* 168 */
25509/***/ (function(module, exports, __w_pdfjs_require__) {
25510
25511"use strict";
25512
25513
25514Object.defineProperty(exports, "__esModule", {
25515  value: true
25516});
25517exports.calculateSHA512 = exports.calculateSHA384 = exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0;
25518
25519var _util = __w_pdfjs_require__(5);
25520
25521var _primitives = __w_pdfjs_require__(151);
25522
25523var _stream = __w_pdfjs_require__(158);
25524
25525function _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); }
25526
25527function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
25528
25529function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
25530
25531function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
25532
25533function _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); }
25534
25535function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
25536
25537function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
25538
25539function _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); } }
25540
25541function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
25542
25543var ARCFourCipher = function ARCFourCipherClosure() {
25544  function ARCFourCipher(key) {
25545    this.a = 0;
25546    this.b = 0;
25547    var s = new Uint8Array(256);
25548    var i,
25549        j = 0,
25550        tmp,
25551        keyLength = key.length;
25552
25553    for (i = 0; i < 256; ++i) {
25554      s[i] = i;
25555    }
25556
25557    for (i = 0; i < 256; ++i) {
25558      tmp = s[i];
25559      j = j + tmp + key[i % keyLength] & 0xFF;
25560      s[i] = s[j];
25561      s[j] = tmp;
25562    }
25563
25564    this.s = s;
25565  }
25566
25567  ARCFourCipher.prototype = {
25568    encryptBlock: function ARCFourCipher_encryptBlock(data) {
25569      var i,
25570          n = data.length,
25571          tmp,
25572          tmp2;
25573      var a = this.a,
25574          b = this.b,
25575          s = this.s;
25576      var output = new Uint8Array(n);
25577
25578      for (i = 0; i < n; ++i) {
25579        a = a + 1 & 0xFF;
25580        tmp = s[a];
25581        b = b + tmp & 0xFF;
25582        tmp2 = s[b];
25583        s[a] = tmp2;
25584        s[b] = tmp;
25585        output[i] = data[i] ^ s[tmp + tmp2 & 0xFF];
25586      }
25587
25588      this.a = a;
25589      this.b = b;
25590      return output;
25591    }
25592  };
25593  ARCFourCipher.prototype.decryptBlock = ARCFourCipher.prototype.encryptBlock;
25594  return ARCFourCipher;
25595}();
25596
25597exports.ARCFourCipher = ARCFourCipher;
25598
25599var calculateMD5 = function calculateMD5Closure() {
25600  var r = new Uint8Array([7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21]);
25601  var k = new Int32Array([-680876936, -389564586, 606105819, -1044525330, -176418897, 1200080426, -1473231341, -45705983, 1770035416, -1958414417, -42063, -1990404162, 1804603682, -40341101, -1502002290, 1236535329, -165796510, -1069501632, 643717713, -373897302, -701558691, 38016083, -660478335, -405537848, 568446438, -1019803690, -187363961, 1163531501, -1444681467, -51403784, 1735328473, -1926607734, -378558, -2022574463, 1839030562, -35309556, -1530992060, 1272893353, -155497632, -1094730640, 681279174, -358537222, -722521979, 76029189, -640364487, -421815835, 530742520, -995338651, -198630844, 1126891415, -1416354905, -57434055, 1700485571, -1894986606, -1051523, -2054922799, 1873313359, -30611744, -1560198380, 1309151649, -145523070, -1120210379, 718787259, -343485551]);
25602
25603  function hash(data, offset, length) {
25604    var h0 = 1732584193,
25605        h1 = -271733879,
25606        h2 = -1732584194,
25607        h3 = 271733878;
25608    var paddedLength = length + 72 & ~63;
25609    var padded = new Uint8Array(paddedLength);
25610    var i, j, n;
25611
25612    for (i = 0; i < length; ++i) {
25613      padded[i] = data[offset++];
25614    }
25615
25616    padded[i++] = 0x80;
25617    n = paddedLength - 8;
25618
25619    while (i < n) {
25620      padded[i++] = 0;
25621    }
25622
25623    padded[i++] = length << 3 & 0xFF;
25624    padded[i++] = length >> 5 & 0xFF;
25625    padded[i++] = length >> 13 & 0xFF;
25626    padded[i++] = length >> 21 & 0xFF;
25627    padded[i++] = length >>> 29 & 0xFF;
25628    padded[i++] = 0;
25629    padded[i++] = 0;
25630    padded[i++] = 0;
25631    var w = new Int32Array(16);
25632
25633    for (i = 0; i < paddedLength;) {
25634      for (j = 0; j < 16; ++j, i += 4) {
25635        w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
25636      }
25637
25638      var a = h0,
25639          b = h1,
25640          c = h2,
25641          d = h3,
25642          f,
25643          g;
25644
25645      for (j = 0; j < 64; ++j) {
25646        if (j < 16) {
25647          f = b & c | ~b & d;
25648          g = j;
25649        } else if (j < 32) {
25650          f = d & b | ~d & c;
25651          g = 5 * j + 1 & 15;
25652        } else if (j < 48) {
25653          f = b ^ c ^ d;
25654          g = 3 * j + 5 & 15;
25655        } else {
25656          f = c ^ (b | ~d);
25657          g = 7 * j & 15;
25658        }
25659
25660        var tmp = d,
25661            rotateArg = a + f + k[j] + w[g] | 0,
25662            rotate = r[j];
25663        d = c;
25664        c = b;
25665        b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
25666        a = tmp;
25667      }
25668
25669      h0 = h0 + a | 0;
25670      h1 = h1 + b | 0;
25671      h2 = h2 + c | 0;
25672      h3 = h3 + d | 0;
25673    }
25674
25675    return new Uint8Array([h0 & 0xFF, h0 >> 8 & 0xFF, h0 >> 16 & 0xFF, h0 >>> 24 & 0xFF, h1 & 0xFF, h1 >> 8 & 0xFF, h1 >> 16 & 0xFF, h1 >>> 24 & 0xFF, h2 & 0xFF, h2 >> 8 & 0xFF, h2 >> 16 & 0xFF, h2 >>> 24 & 0xFF, h3 & 0xFF, h3 >> 8 & 0xFF, h3 >> 16 & 0xFF, h3 >>> 24 & 0xFF]);
25676  }
25677
25678  return hash;
25679}();
25680
25681exports.calculateMD5 = calculateMD5;
25682
25683var Word64 = function Word64Closure() {
25684  function Word64(highInteger, lowInteger) {
25685    this.high = highInteger | 0;
25686    this.low = lowInteger | 0;
25687  }
25688
25689  Word64.prototype = {
25690    and: function Word64_and(word) {
25691      this.high &= word.high;
25692      this.low &= word.low;
25693    },
25694    xor: function Word64_xor(word) {
25695      this.high ^= word.high;
25696      this.low ^= word.low;
25697    },
25698    or: function Word64_or(word) {
25699      this.high |= word.high;
25700      this.low |= word.low;
25701    },
25702    shiftRight: function Word64_shiftRight(places) {
25703      if (places >= 32) {
25704        this.low = this.high >>> places - 32 | 0;
25705        this.high = 0;
25706      } else {
25707        this.low = this.low >>> places | this.high << 32 - places;
25708        this.high = this.high >>> places | 0;
25709      }
25710    },
25711    shiftLeft: function Word64_shiftLeft(places) {
25712      if (places >= 32) {
25713        this.high = this.low << places - 32;
25714        this.low = 0;
25715      } else {
25716        this.high = this.high << places | this.low >>> 32 - places;
25717        this.low = this.low << places;
25718      }
25719    },
25720    rotateRight: function Word64_rotateRight(places) {
25721      var low, high;
25722
25723      if (places & 32) {
25724        high = this.low;
25725        low = this.high;
25726      } else {
25727        low = this.low;
25728        high = this.high;
25729      }
25730
25731      places &= 31;
25732      this.low = low >>> places | high << 32 - places;
25733      this.high = high >>> places | low << 32 - places;
25734    },
25735    not: function Word64_not() {
25736      this.high = ~this.high;
25737      this.low = ~this.low;
25738    },
25739    add: function Word64_add(word) {
25740      var lowAdd = (this.low >>> 0) + (word.low >>> 0);
25741      var highAdd = (this.high >>> 0) + (word.high >>> 0);
25742
25743      if (lowAdd > 0xFFFFFFFF) {
25744        highAdd += 1;
25745      }
25746
25747      this.low = lowAdd | 0;
25748      this.high = highAdd | 0;
25749    },
25750    copyTo: function Word64_copyTo(bytes, offset) {
25751      bytes[offset] = this.high >>> 24 & 0xFF;
25752      bytes[offset + 1] = this.high >> 16 & 0xFF;
25753      bytes[offset + 2] = this.high >> 8 & 0xFF;
25754      bytes[offset + 3] = this.high & 0xFF;
25755      bytes[offset + 4] = this.low >>> 24 & 0xFF;
25756      bytes[offset + 5] = this.low >> 16 & 0xFF;
25757      bytes[offset + 6] = this.low >> 8 & 0xFF;
25758      bytes[offset + 7] = this.low & 0xFF;
25759    },
25760    assign: function Word64_assign(word) {
25761      this.high = word.high;
25762      this.low = word.low;
25763    }
25764  };
25765  return Word64;
25766}();
25767
25768var calculateSHA256 = function calculateSHA256Closure() {
25769  function rotr(x, n) {
25770    return x >>> n | x << 32 - n;
25771  }
25772
25773  function ch(x, y, z) {
25774    return x & y ^ ~x & z;
25775  }
25776
25777  function maj(x, y, z) {
25778    return x & y ^ x & z ^ y & z;
25779  }
25780
25781  function sigma(x) {
25782    return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
25783  }
25784
25785  function sigmaPrime(x) {
25786    return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
25787  }
25788
25789  function littleSigma(x) {
25790    return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
25791  }
25792
25793  function littleSigmaPrime(x) {
25794    return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
25795  }
25796
25797  var k = [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2];
25798
25799  function hash(data, offset, length) {
25800    var h0 = 0x6a09e667,
25801        h1 = 0xbb67ae85,
25802        h2 = 0x3c6ef372,
25803        h3 = 0xa54ff53a,
25804        h4 = 0x510e527f,
25805        h5 = 0x9b05688c,
25806        h6 = 0x1f83d9ab,
25807        h7 = 0x5be0cd19;
25808    var paddedLength = Math.ceil((length + 9) / 64) * 64;
25809    var padded = new Uint8Array(paddedLength);
25810    var i, j, n;
25811
25812    for (i = 0; i < length; ++i) {
25813      padded[i] = data[offset++];
25814    }
25815
25816    padded[i++] = 0x80;
25817    n = paddedLength - 8;
25818
25819    while (i < n) {
25820      padded[i++] = 0;
25821    }
25822
25823    padded[i++] = 0;
25824    padded[i++] = 0;
25825    padded[i++] = 0;
25826    padded[i++] = length >>> 29 & 0xFF;
25827    padded[i++] = length >> 21 & 0xFF;
25828    padded[i++] = length >> 13 & 0xFF;
25829    padded[i++] = length >> 5 & 0xFF;
25830    padded[i++] = length << 3 & 0xFF;
25831    var w = new Uint32Array(64);
25832
25833    for (i = 0; i < paddedLength;) {
25834      for (j = 0; j < 16; ++j) {
25835        w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
25836        i += 4;
25837      }
25838
25839      for (j = 16; j < 64; ++j) {
25840        w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
25841      }
25842
25843      var a = h0,
25844          b = h1,
25845          c = h2,
25846          d = h3,
25847          e = h4,
25848          f = h5,
25849          g = h6,
25850          h = h7,
25851          t1,
25852          t2;
25853
25854      for (j = 0; j < 64; ++j) {
25855        t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
25856        t2 = sigma(a) + maj(a, b, c);
25857        h = g;
25858        g = f;
25859        f = e;
25860        e = d + t1 | 0;
25861        d = c;
25862        c = b;
25863        b = a;
25864        a = t1 + t2 | 0;
25865      }
25866
25867      h0 = h0 + a | 0;
25868      h1 = h1 + b | 0;
25869      h2 = h2 + c | 0;
25870      h3 = h3 + d | 0;
25871      h4 = h4 + e | 0;
25872      h5 = h5 + f | 0;
25873      h6 = h6 + g | 0;
25874      h7 = h7 + h | 0;
25875    }
25876
25877    return new Uint8Array([h0 >> 24 & 0xFF, h0 >> 16 & 0xFF, h0 >> 8 & 0xFF, h0 & 0xFF, h1 >> 24 & 0xFF, h1 >> 16 & 0xFF, h1 >> 8 & 0xFF, h1 & 0xFF, h2 >> 24 & 0xFF, h2 >> 16 & 0xFF, h2 >> 8 & 0xFF, h2 & 0xFF, h3 >> 24 & 0xFF, h3 >> 16 & 0xFF, h3 >> 8 & 0xFF, h3 & 0xFF, h4 >> 24 & 0xFF, h4 >> 16 & 0xFF, h4 >> 8 & 0xFF, h4 & 0xFF, h5 >> 24 & 0xFF, h5 >> 16 & 0xFF, h5 >> 8 & 0xFF, h5 & 0xFF, h6 >> 24 & 0xFF, h6 >> 16 & 0xFF, h6 >> 8 & 0xFF, h6 & 0xFF, h7 >> 24 & 0xFF, h7 >> 16 & 0xFF, h7 >> 8 & 0xFF, h7 & 0xFF]);
25878  }
25879
25880  return hash;
25881}();
25882
25883exports.calculateSHA256 = calculateSHA256;
25884
25885var calculateSHA512 = function calculateSHA512Closure() {
25886  function ch(result, x, y, z, tmp) {
25887    result.assign(x);
25888    result.and(y);
25889    tmp.assign(x);
25890    tmp.not();
25891    tmp.and(z);
25892    result.xor(tmp);
25893  }
25894
25895  function maj(result, x, y, z, tmp) {
25896    result.assign(x);
25897    result.and(y);
25898    tmp.assign(x);
25899    tmp.and(z);
25900    result.xor(tmp);
25901    tmp.assign(y);
25902    tmp.and(z);
25903    result.xor(tmp);
25904  }
25905
25906  function sigma(result, x, tmp) {
25907    result.assign(x);
25908    result.rotateRight(28);
25909    tmp.assign(x);
25910    tmp.rotateRight(34);
25911    result.xor(tmp);
25912    tmp.assign(x);
25913    tmp.rotateRight(39);
25914    result.xor(tmp);
25915  }
25916
25917  function sigmaPrime(result, x, tmp) {
25918    result.assign(x);
25919    result.rotateRight(14);
25920    tmp.assign(x);
25921    tmp.rotateRight(18);
25922    result.xor(tmp);
25923    tmp.assign(x);
25924    tmp.rotateRight(41);
25925    result.xor(tmp);
25926  }
25927
25928  function littleSigma(result, x, tmp) {
25929    result.assign(x);
25930    result.rotateRight(1);
25931    tmp.assign(x);
25932    tmp.rotateRight(8);
25933    result.xor(tmp);
25934    tmp.assign(x);
25935    tmp.shiftRight(7);
25936    result.xor(tmp);
25937  }
25938
25939  function littleSigmaPrime(result, x, tmp) {
25940    result.assign(x);
25941    result.rotateRight(19);
25942    tmp.assign(x);
25943    tmp.rotateRight(61);
25944    result.xor(tmp);
25945    tmp.assign(x);
25946    tmp.shiftRight(6);
25947    result.xor(tmp);
25948  }
25949
25950  var k = [new Word64(0x428a2f98, 0xd728ae22), new Word64(0x71374491, 0x23ef65cd), new Word64(0xb5c0fbcf, 0xec4d3b2f), new Word64(0xe9b5dba5, 0x8189dbbc), new Word64(0x3956c25b, 0xf348b538), new Word64(0x59f111f1, 0xb605d019), new Word64(0x923f82a4, 0xaf194f9b), new Word64(0xab1c5ed5, 0xda6d8118), new Word64(0xd807aa98, 0xa3030242), new Word64(0x12835b01, 0x45706fbe), new Word64(0x243185be, 0x4ee4b28c), new Word64(0x550c7dc3, 0xd5ffb4e2), new Word64(0x72be5d74, 0xf27b896f), new Word64(0x80deb1fe, 0x3b1696b1), new Word64(0x9bdc06a7, 0x25c71235), new Word64(0xc19bf174, 0xcf692694), new Word64(0xe49b69c1, 0x9ef14ad2), new Word64(0xefbe4786, 0x384f25e3), new Word64(0x0fc19dc6, 0x8b8cd5b5), new Word64(0x240ca1cc, 0x77ac9c65), new Word64(0x2de92c6f, 0x592b0275), new Word64(0x4a7484aa, 0x6ea6e483), new Word64(0x5cb0a9dc, 0xbd41fbd4), new Word64(0x76f988da, 0x831153b5), new Word64(0x983e5152, 0xee66dfab), new Word64(0xa831c66d, 0x2db43210), new Word64(0xb00327c8, 0x98fb213f), new Word64(0xbf597fc7, 0xbeef0ee4), new Word64(0xc6e00bf3, 0x3da88fc2), new Word64(0xd5a79147, 0x930aa725), new Word64(0x06ca6351, 0xe003826f), new Word64(0x14292967, 0x0a0e6e70), new Word64(0x27b70a85, 0x46d22ffc), new Word64(0x2e1b2138, 0x5c26c926), new Word64(0x4d2c6dfc, 0x5ac42aed), new Word64(0x53380d13, 0x9d95b3df), new Word64(0x650a7354, 0x8baf63de), new Word64(0x766a0abb, 0x3c77b2a8), new Word64(0x81c2c92e, 0x47edaee6), new Word64(0x92722c85, 0x1482353b), new Word64(0xa2bfe8a1, 0x4cf10364), new Word64(0xa81a664b, 0xbc423001), new Word64(0xc24b8b70, 0xd0f89791), new Word64(0xc76c51a3, 0x0654be30), new Word64(0xd192e819, 0xd6ef5218), new Word64(0xd6990624, 0x5565a910), new Word64(0xf40e3585, 0x5771202a), new Word64(0x106aa070, 0x32bbd1b8), new Word64(0x19a4c116, 0xb8d2d0c8), new Word64(0x1e376c08, 0x5141ab53), new Word64(0x2748774c, 0xdf8eeb99), new Word64(0x34b0bcb5, 0xe19b48a8), new Word64(0x391c0cb3, 0xc5c95a63), new Word64(0x4ed8aa4a, 0xe3418acb), new Word64(0x5b9cca4f, 0x7763e373), new Word64(0x682e6ff3, 0xd6b2b8a3), new Word64(0x748f82ee, 0x5defb2fc), new Word64(0x78a5636f, 0x43172f60), new Word64(0x84c87814, 0xa1f0ab72), new Word64(0x8cc70208, 0x1a6439ec), new Word64(0x90befffa, 0x23631e28), new Word64(0xa4506ceb, 0xde82bde9), new Word64(0xbef9a3f7, 0xb2c67915), new Word64(0xc67178f2, 0xe372532b), new Word64(0xca273ece, 0xea26619c), new Word64(0xd186b8c7, 0x21c0c207), new Word64(0xeada7dd6, 0xcde0eb1e), new Word64(0xf57d4f7f, 0xee6ed178), new Word64(0x06f067aa, 0x72176fba), new Word64(0x0a637dc5, 0xa2c898a6), new Word64(0x113f9804, 0xbef90dae), new Word64(0x1b710b35, 0x131c471b), new Word64(0x28db77f5, 0x23047d84), new Word64(0x32caab7b, 0x40c72493), new Word64(0x3c9ebe0a, 0x15c9bebc), new Word64(0x431d67c4, 0x9c100d4c), new Word64(0x4cc5d4be, 0xcb3e42b6), new Word64(0x597f299c, 0xfc657e2a), new Word64(0x5fcb6fab, 0x3ad6faec), new Word64(0x6c44198c, 0x4a475817)];
25951
25952  function hash(data, offset, length, mode384) {
25953    mode384 = !!mode384;
25954    var h0, h1, h2, h3, h4, h5, h6, h7;
25955
25956    if (!mode384) {
25957      h0 = new Word64(0x6a09e667, 0xf3bcc908);
25958      h1 = new Word64(0xbb67ae85, 0x84caa73b);
25959      h2 = new Word64(0x3c6ef372, 0xfe94f82b);
25960      h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
25961      h4 = new Word64(0x510e527f, 0xade682d1);
25962      h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
25963      h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
25964      h7 = new Word64(0x5be0cd19, 0x137e2179);
25965    } else {
25966      h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
25967      h1 = new Word64(0x629a292a, 0x367cd507);
25968      h2 = new Word64(0x9159015a, 0x3070dd17);
25969      h3 = new Word64(0x152fecd8, 0xf70e5939);
25970      h4 = new Word64(0x67332667, 0xffc00b31);
25971      h5 = new Word64(0x8eb44a87, 0x68581511);
25972      h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
25973      h7 = new Word64(0x47b5481d, 0xbefa4fa4);
25974    }
25975
25976    var paddedLength = Math.ceil((length + 17) / 128) * 128;
25977    var padded = new Uint8Array(paddedLength);
25978    var i, j, n;
25979
25980    for (i = 0; i < length; ++i) {
25981      padded[i] = data[offset++];
25982    }
25983
25984    padded[i++] = 0x80;
25985    n = paddedLength - 16;
25986
25987    while (i < n) {
25988      padded[i++] = 0;
25989    }
25990
25991    padded[i++] = 0;
25992    padded[i++] = 0;
25993    padded[i++] = 0;
25994    padded[i++] = 0;
25995    padded[i++] = 0;
25996    padded[i++] = 0;
25997    padded[i++] = 0;
25998    padded[i++] = 0;
25999    padded[i++] = 0;
26000    padded[i++] = 0;
26001    padded[i++] = 0;
26002    padded[i++] = length >>> 29 & 0xFF;
26003    padded[i++] = length >> 21 & 0xFF;
26004    padded[i++] = length >> 13 & 0xFF;
26005    padded[i++] = length >> 5 & 0xFF;
26006    padded[i++] = length << 3 & 0xFF;
26007    var w = new Array(80);
26008
26009    for (i = 0; i < 80; i++) {
26010      w[i] = new Word64(0, 0);
26011    }
26012
26013    var a = new Word64(0, 0),
26014        b = new Word64(0, 0),
26015        c = new Word64(0, 0);
26016    var d = new Word64(0, 0),
26017        e = new Word64(0, 0),
26018        f = new Word64(0, 0);
26019    var g = new Word64(0, 0),
26020        h = new Word64(0, 0);
26021    var t1 = new Word64(0, 0),
26022        t2 = new Word64(0, 0);
26023    var tmp1 = new Word64(0, 0),
26024        tmp2 = new Word64(0, 0),
26025        tmp3;
26026
26027    for (i = 0; i < paddedLength;) {
26028      for (j = 0; j < 16; ++j) {
26029        w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
26030        w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
26031        i += 8;
26032      }
26033
26034      for (j = 16; j < 80; ++j) {
26035        tmp3 = w[j];
26036        littleSigmaPrime(tmp3, w[j - 2], tmp2);
26037        tmp3.add(w[j - 7]);
26038        littleSigma(tmp1, w[j - 15], tmp2);
26039        tmp3.add(tmp1);
26040        tmp3.add(w[j - 16]);
26041      }
26042
26043      a.assign(h0);
26044      b.assign(h1);
26045      c.assign(h2);
26046      d.assign(h3);
26047      e.assign(h4);
26048      f.assign(h5);
26049      g.assign(h6);
26050      h.assign(h7);
26051
26052      for (j = 0; j < 80; ++j) {
26053        t1.assign(h);
26054        sigmaPrime(tmp1, e, tmp2);
26055        t1.add(tmp1);
26056        ch(tmp1, e, f, g, tmp2);
26057        t1.add(tmp1);
26058        t1.add(k[j]);
26059        t1.add(w[j]);
26060        sigma(t2, a, tmp2);
26061        maj(tmp1, a, b, c, tmp2);
26062        t2.add(tmp1);
26063        tmp3 = h;
26064        h = g;
26065        g = f;
26066        f = e;
26067        d.add(t1);
26068        e = d;
26069        d = c;
26070        c = b;
26071        b = a;
26072        tmp3.assign(t1);
26073        tmp3.add(t2);
26074        a = tmp3;
26075      }
26076
26077      h0.add(a);
26078      h1.add(b);
26079      h2.add(c);
26080      h3.add(d);
26081      h4.add(e);
26082      h5.add(f);
26083      h6.add(g);
26084      h7.add(h);
26085    }
26086
26087    var result;
26088
26089    if (!mode384) {
26090      result = new Uint8Array(64);
26091      h0.copyTo(result, 0);
26092      h1.copyTo(result, 8);
26093      h2.copyTo(result, 16);
26094      h3.copyTo(result, 24);
26095      h4.copyTo(result, 32);
26096      h5.copyTo(result, 40);
26097      h6.copyTo(result, 48);
26098      h7.copyTo(result, 56);
26099    } else {
26100      result = new Uint8Array(48);
26101      h0.copyTo(result, 0);
26102      h1.copyTo(result, 8);
26103      h2.copyTo(result, 16);
26104      h3.copyTo(result, 24);
26105      h4.copyTo(result, 32);
26106      h5.copyTo(result, 40);
26107    }
26108
26109    return result;
26110  }
26111
26112  return hash;
26113}();
26114
26115exports.calculateSHA512 = calculateSHA512;
26116
26117var calculateSHA384 = function calculateSHA384Closure() {
26118  function hash(data, offset, length) {
26119    return calculateSHA512(data, offset, length, true);
26120  }
26121
26122  return hash;
26123}();
26124
26125exports.calculateSHA384 = calculateSHA384;
26126
26127var NullCipher = function NullCipherClosure() {
26128  function NullCipher() {}
26129
26130  NullCipher.prototype = {
26131    decryptBlock: function NullCipher_decryptBlock(data) {
26132      return data;
26133    }
26134  };
26135  return NullCipher;
26136}();
26137
26138var AESBaseCipher =
26139/*#__PURE__*/
26140function () {
26141  function AESBaseCipher() {
26142    _classCallCheck(this, AESBaseCipher);
26143
26144    if (this.constructor === AESBaseCipher) {
26145      (0, _util.unreachable)('Cannot initialize AESBaseCipher.');
26146    }
26147
26148    this._s = new Uint8Array([0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16]);
26149    this._inv_s = new Uint8Array([0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d]);
26150    this._mix = new Uint32Array([0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3]);
26151    this._mixCol = new Uint8Array(256);
26152
26153    for (var i = 0; i < 256; i++) {
26154      if (i < 128) {
26155        this._mixCol[i] = i << 1;
26156      } else {
26157        this._mixCol[i] = i << 1 ^ 0x1b;
26158      }
26159    }
26160
26161    this.buffer = new Uint8Array(16);
26162    this.bufferPosition = 0;
26163  }
26164
26165  _createClass(AESBaseCipher, [{
26166    key: "_expandKey",
26167    value: function _expandKey(cipherKey) {
26168      (0, _util.unreachable)('Cannot call `_expandKey` on the base class');
26169    }
26170  }, {
26171    key: "_decrypt",
26172    value: function _decrypt(input, key) {
26173      var t, u, v;
26174      var state = new Uint8Array(16);
26175      state.set(input);
26176
26177      for (var j = 0, k = this._keySize; j < 16; ++j, ++k) {
26178        state[j] ^= key[k];
26179      }
26180
26181      for (var i = this._cyclesOfRepetition - 1; i >= 1; --i) {
26182        t = state[13];
26183        state[13] = state[9];
26184        state[9] = state[5];
26185        state[5] = state[1];
26186        state[1] = t;
26187        t = state[14];
26188        u = state[10];
26189        state[14] = state[6];
26190        state[10] = state[2];
26191        state[6] = t;
26192        state[2] = u;
26193        t = state[15];
26194        u = state[11];
26195        v = state[7];
26196        state[15] = state[3];
26197        state[11] = t;
26198        state[7] = u;
26199        state[3] = v;
26200
26201        for (var _j = 0; _j < 16; ++_j) {
26202          state[_j] = this._inv_s[state[_j]];
26203        }
26204
26205        for (var _j2 = 0, _k = i * 16; _j2 < 16; ++_j2, ++_k) {
26206          state[_j2] ^= key[_k];
26207        }
26208
26209        for (var _j3 = 0; _j3 < 16; _j3 += 4) {
26210          var s0 = this._mix[state[_j3]];
26211          var s1 = this._mix[state[_j3 + 1]];
26212          var s2 = this._mix[state[_j3 + 2]];
26213          var s3 = this._mix[state[_j3 + 3]];
26214          t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
26215          state[_j3] = t >>> 24 & 0xFF;
26216          state[_j3 + 1] = t >> 16 & 0xFF;
26217          state[_j3 + 2] = t >> 8 & 0xFF;
26218          state[_j3 + 3] = t & 0xFF;
26219        }
26220      }
26221
26222      t = state[13];
26223      state[13] = state[9];
26224      state[9] = state[5];
26225      state[5] = state[1];
26226      state[1] = t;
26227      t = state[14];
26228      u = state[10];
26229      state[14] = state[6];
26230      state[10] = state[2];
26231      state[6] = t;
26232      state[2] = u;
26233      t = state[15];
26234      u = state[11];
26235      v = state[7];
26236      state[15] = state[3];
26237      state[11] = t;
26238      state[7] = u;
26239      state[3] = v;
26240
26241      for (var _j4 = 0; _j4 < 16; ++_j4) {
26242        state[_j4] = this._inv_s[state[_j4]];
26243        state[_j4] ^= key[_j4];
26244      }
26245
26246      return state;
26247    }
26248  }, {
26249    key: "_encrypt",
26250    value: function _encrypt(input, key) {
26251      var s = this._s;
26252      var t, u, v;
26253      var state = new Uint8Array(16);
26254      state.set(input);
26255
26256      for (var j = 0; j < 16; ++j) {
26257        state[j] ^= key[j];
26258      }
26259
26260      for (var i = 1; i < this._cyclesOfRepetition; i++) {
26261        for (var _j5 = 0; _j5 < 16; ++_j5) {
26262          state[_j5] = s[state[_j5]];
26263        }
26264
26265        v = state[1];
26266        state[1] = state[5];
26267        state[5] = state[9];
26268        state[9] = state[13];
26269        state[13] = v;
26270        v = state[2];
26271        u = state[6];
26272        state[2] = state[10];
26273        state[6] = state[14];
26274        state[10] = v;
26275        state[14] = u;
26276        v = state[3];
26277        u = state[7];
26278        t = state[11];
26279        state[3] = state[15];
26280        state[7] = v;
26281        state[11] = u;
26282        state[15] = t;
26283
26284        for (var _j6 = 0; _j6 < 16; _j6 += 4) {
26285          var s0 = state[_j6 + 0];
26286          var s1 = state[_j6 + 1];
26287          var s2 = state[_j6 + 2];
26288          var s3 = state[_j6 + 3];
26289          t = s0 ^ s1 ^ s2 ^ s3;
26290          state[_j6 + 0] ^= t ^ this._mixCol[s0 ^ s1];
26291          state[_j6 + 1] ^= t ^ this._mixCol[s1 ^ s2];
26292          state[_j6 + 2] ^= t ^ this._mixCol[s2 ^ s3];
26293          state[_j6 + 3] ^= t ^ this._mixCol[s3 ^ s0];
26294        }
26295
26296        for (var _j7 = 0, k = i * 16; _j7 < 16; ++_j7, ++k) {
26297          state[_j7] ^= key[k];
26298        }
26299      }
26300
26301      for (var _j8 = 0; _j8 < 16; ++_j8) {
26302        state[_j8] = s[state[_j8]];
26303      }
26304
26305      v = state[1];
26306      state[1] = state[5];
26307      state[5] = state[9];
26308      state[9] = state[13];
26309      state[13] = v;
26310      v = state[2];
26311      u = state[6];
26312      state[2] = state[10];
26313      state[6] = state[14];
26314      state[10] = v;
26315      state[14] = u;
26316      v = state[3];
26317      u = state[7];
26318      t = state[11];
26319      state[3] = state[15];
26320      state[7] = v;
26321      state[11] = u;
26322      state[15] = t;
26323
26324      for (var _j9 = 0, _k2 = this._keySize; _j9 < 16; ++_j9, ++_k2) {
26325        state[_j9] ^= key[_k2];
26326      }
26327
26328      return state;
26329    }
26330  }, {
26331    key: "_decryptBlock2",
26332    value: function _decryptBlock2(data, finalize) {
26333      var sourceLength = data.length;
26334      var buffer = this.buffer,
26335          bufferLength = this.bufferPosition;
26336      var result = [],
26337          iv = this.iv;
26338
26339      for (var i = 0; i < sourceLength; ++i) {
26340        buffer[bufferLength] = data[i];
26341        ++bufferLength;
26342
26343        if (bufferLength < 16) {
26344          continue;
26345        }
26346
26347        var plain = this._decrypt(buffer, this._key);
26348
26349        for (var j = 0; j < 16; ++j) {
26350          plain[j] ^= iv[j];
26351        }
26352
26353        iv = buffer;
26354        result.push(plain);
26355        buffer = new Uint8Array(16);
26356        bufferLength = 0;
26357      }
26358
26359      this.buffer = buffer;
26360      this.bufferLength = bufferLength;
26361      this.iv = iv;
26362
26363      if (result.length === 0) {
26364        return new Uint8Array(0);
26365      }
26366
26367      var outputLength = 16 * result.length;
26368
26369      if (finalize) {
26370        var lastBlock = result[result.length - 1];
26371        var psLen = lastBlock[15];
26372
26373        if (psLen <= 16) {
26374          for (var _i = 15, ii = 16 - psLen; _i >= ii; --_i) {
26375            if (lastBlock[_i] !== psLen) {
26376              psLen = 0;
26377              break;
26378            }
26379          }
26380
26381          outputLength -= psLen;
26382          result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
26383        }
26384      }
26385
26386      var output = new Uint8Array(outputLength);
26387
26388      for (var _i2 = 0, _j10 = 0, _ii = result.length; _i2 < _ii; ++_i2, _j10 += 16) {
26389        output.set(result[_i2], _j10);
26390      }
26391
26392      return output;
26393    }
26394  }, {
26395    key: "decryptBlock",
26396    value: function decryptBlock(data, finalize) {
26397      var iv = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
26398      var sourceLength = data.length;
26399      var buffer = this.buffer,
26400          bufferLength = this.bufferPosition;
26401
26402      if (iv) {
26403        this.iv = iv;
26404      } else {
26405        for (var i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
26406          buffer[bufferLength] = data[i];
26407        }
26408
26409        if (bufferLength < 16) {
26410          this.bufferLength = bufferLength;
26411          return new Uint8Array(0);
26412        }
26413
26414        this.iv = buffer;
26415        data = data.subarray(16);
26416      }
26417
26418      this.buffer = new Uint8Array(16);
26419      this.bufferLength = 0;
26420      this.decryptBlock = this._decryptBlock2;
26421      return this.decryptBlock(data, finalize);
26422    }
26423  }, {
26424    key: "encrypt",
26425    value: function encrypt(data, iv) {
26426      var sourceLength = data.length;
26427      var buffer = this.buffer,
26428          bufferLength = this.bufferPosition;
26429      var result = [];
26430
26431      if (!iv) {
26432        iv = new Uint8Array(16);
26433      }
26434
26435      for (var i = 0; i < sourceLength; ++i) {
26436        buffer[bufferLength] = data[i];
26437        ++bufferLength;
26438
26439        if (bufferLength < 16) {
26440          continue;
26441        }
26442
26443        for (var j = 0; j < 16; ++j) {
26444          buffer[j] ^= iv[j];
26445        }
26446
26447        var cipher = this._encrypt(buffer, this._key);
26448
26449        iv = cipher;
26450        result.push(cipher);
26451        buffer = new Uint8Array(16);
26452        bufferLength = 0;
26453      }
26454
26455      this.buffer = buffer;
26456      this.bufferLength = bufferLength;
26457      this.iv = iv;
26458
26459      if (result.length === 0) {
26460        return new Uint8Array(0);
26461      }
26462
26463      var outputLength = 16 * result.length;
26464      var output = new Uint8Array(outputLength);
26465
26466      for (var _i3 = 0, _j11 = 0, ii = result.length; _i3 < ii; ++_i3, _j11 += 16) {
26467        output.set(result[_i3], _j11);
26468      }
26469
26470      return output;
26471    }
26472  }]);
26473
26474  return AESBaseCipher;
26475}();
26476
26477var AES128Cipher =
26478/*#__PURE__*/
26479function (_AESBaseCipher) {
26480  _inherits(AES128Cipher, _AESBaseCipher);
26481
26482  function AES128Cipher(key) {
26483    var _this;
26484
26485    _classCallCheck(this, AES128Cipher);
26486
26487    _this = _possibleConstructorReturn(this, _getPrototypeOf(AES128Cipher).call(this));
26488    _this._cyclesOfRepetition = 10;
26489    _this._keySize = 160;
26490    _this._rcon = new Uint8Array([0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d]);
26491    _this._key = _this._expandKey(key);
26492    return _this;
26493  }
26494
26495  _createClass(AES128Cipher, [{
26496    key: "_expandKey",
26497    value: function _expandKey(cipherKey) {
26498      var b = 176;
26499      var s = this._s;
26500      var rcon = this._rcon;
26501      var result = new Uint8Array(b);
26502      result.set(cipherKey);
26503
26504      for (var j = 16, i = 1; j < b; ++i) {
26505        var t1 = result[j - 3];
26506        var t2 = result[j - 2];
26507        var t3 = result[j - 1];
26508        var t4 = result[j - 4];
26509        t1 = s[t1];
26510        t2 = s[t2];
26511        t3 = s[t3];
26512        t4 = s[t4];
26513        t1 = t1 ^ rcon[i];
26514
26515        for (var n = 0; n < 4; ++n) {
26516          result[j] = t1 ^= result[j - 16];
26517          j++;
26518          result[j] = t2 ^= result[j - 16];
26519          j++;
26520          result[j] = t3 ^= result[j - 16];
26521          j++;
26522          result[j] = t4 ^= result[j - 16];
26523          j++;
26524        }
26525      }
26526
26527      return result;
26528    }
26529  }]);
26530
26531  return AES128Cipher;
26532}(AESBaseCipher);
26533
26534exports.AES128Cipher = AES128Cipher;
26535
26536var AES256Cipher =
26537/*#__PURE__*/
26538function (_AESBaseCipher2) {
26539  _inherits(AES256Cipher, _AESBaseCipher2);
26540
26541  function AES256Cipher(key) {
26542    var _this2;
26543
26544    _classCallCheck(this, AES256Cipher);
26545
26546    _this2 = _possibleConstructorReturn(this, _getPrototypeOf(AES256Cipher).call(this));
26547    _this2._cyclesOfRepetition = 14;
26548    _this2._keySize = 224;
26549    _this2._key = _this2._expandKey(key);
26550    return _this2;
26551  }
26552
26553  _createClass(AES256Cipher, [{
26554    key: "_expandKey",
26555    value: function _expandKey(cipherKey) {
26556      var b = 240;
26557      var s = this._s;
26558      var result = new Uint8Array(b);
26559      result.set(cipherKey);
26560      var r = 1;
26561      var t1, t2, t3, t4;
26562
26563      for (var j = 32, i = 1; j < b; ++i) {
26564        if (j % 32 === 16) {
26565          t1 = s[t1];
26566          t2 = s[t2];
26567          t3 = s[t3];
26568          t4 = s[t4];
26569        } else if (j % 32 === 0) {
26570          t1 = result[j - 3];
26571          t2 = result[j - 2];
26572          t3 = result[j - 1];
26573          t4 = result[j - 4];
26574          t1 = s[t1];
26575          t2 = s[t2];
26576          t3 = s[t3];
26577          t4 = s[t4];
26578          t1 = t1 ^ r;
26579
26580          if ((r <<= 1) >= 256) {
26581            r = (r ^ 0x1b) & 0xFF;
26582          }
26583        }
26584
26585        for (var n = 0; n < 4; ++n) {
26586          result[j] = t1 ^= result[j - 32];
26587          j++;
26588          result[j] = t2 ^= result[j - 32];
26589          j++;
26590          result[j] = t3 ^= result[j - 32];
26591          j++;
26592          result[j] = t4 ^= result[j - 32];
26593          j++;
26594        }
26595      }
26596
26597      return result;
26598    }
26599  }]);
26600
26601  return AES256Cipher;
26602}(AESBaseCipher);
26603
26604exports.AES256Cipher = AES256Cipher;
26605
26606var PDF17 = function PDF17Closure() {
26607  function compareByteArrays(array1, array2) {
26608    if (array1.length !== array2.length) {
26609      return false;
26610    }
26611
26612    for (var i = 0; i < array1.length; i++) {
26613      if (array1[i] !== array2[i]) {
26614        return false;
26615      }
26616    }
26617
26618    return true;
26619  }
26620
26621  function PDF17() {}
26622
26623  PDF17.prototype = {
26624    checkOwnerPassword: function PDF17_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
26625      var hashData = new Uint8Array(password.length + 56);
26626      hashData.set(password, 0);
26627      hashData.set(ownerValidationSalt, password.length);
26628      hashData.set(userBytes, password.length + ownerValidationSalt.length);
26629      var result = calculateSHA256(hashData, 0, hashData.length);
26630      return compareByteArrays(result, ownerPassword);
26631    },
26632    checkUserPassword: function PDF17_checkUserPassword(password, userValidationSalt, userPassword) {
26633      var hashData = new Uint8Array(password.length + 8);
26634      hashData.set(password, 0);
26635      hashData.set(userValidationSalt, password.length);
26636      var result = calculateSHA256(hashData, 0, hashData.length);
26637      return compareByteArrays(result, userPassword);
26638    },
26639    getOwnerKey: function PDF17_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
26640      var hashData = new Uint8Array(password.length + 56);
26641      hashData.set(password, 0);
26642      hashData.set(ownerKeySalt, password.length);
26643      hashData.set(userBytes, password.length + ownerKeySalt.length);
26644      var key = calculateSHA256(hashData, 0, hashData.length);
26645      var cipher = new AES256Cipher(key);
26646      return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
26647    },
26648    getUserKey: function PDF17_getUserKey(password, userKeySalt, userEncryption) {
26649      var hashData = new Uint8Array(password.length + 8);
26650      hashData.set(password, 0);
26651      hashData.set(userKeySalt, password.length);
26652      var key = calculateSHA256(hashData, 0, hashData.length);
26653      var cipher = new AES256Cipher(key);
26654      return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
26655    }
26656  };
26657  return PDF17;
26658}();
26659
26660exports.PDF17 = PDF17;
26661
26662var PDF20 = function PDF20Closure() {
26663  function concatArrays(array1, array2) {
26664    var t = new Uint8Array(array1.length + array2.length);
26665    t.set(array1, 0);
26666    t.set(array2, array1.length);
26667    return t;
26668  }
26669
26670  function calculatePDF20Hash(password, input, userBytes) {
26671    var k = calculateSHA256(input, 0, input.length).subarray(0, 32);
26672    var e = [0];
26673    var i = 0;
26674
26675    while (i < 64 || e[e.length - 1] > i - 32) {
26676      var arrayLength = password.length + k.length + userBytes.length;
26677      var k1 = new Uint8Array(arrayLength * 64);
26678      var array = concatArrays(password, k);
26679      array = concatArrays(array, userBytes);
26680
26681      for (var j = 0, pos = 0; j < 64; j++, pos += arrayLength) {
26682        k1.set(array, pos);
26683      }
26684
26685      var cipher = new AES128Cipher(k.subarray(0, 16));
26686      e = cipher.encrypt(k1, k.subarray(16, 32));
26687      var remainder = 0;
26688
26689      for (var z = 0; z < 16; z++) {
26690        remainder *= 256 % 3;
26691        remainder %= 3;
26692        remainder += (e[z] >>> 0) % 3;
26693        remainder %= 3;
26694      }
26695
26696      if (remainder === 0) {
26697        k = calculateSHA256(e, 0, e.length);
26698      } else if (remainder === 1) {
26699        k = calculateSHA384(e, 0, e.length);
26700      } else if (remainder === 2) {
26701        k = calculateSHA512(e, 0, e.length);
26702      }
26703
26704      i++;
26705    }
26706
26707    return k.subarray(0, 32);
26708  }
26709
26710  function PDF20() {}
26711
26712  function compareByteArrays(array1, array2) {
26713    if (array1.length !== array2.length) {
26714      return false;
26715    }
26716
26717    for (var i = 0; i < array1.length; i++) {
26718      if (array1[i] !== array2[i]) {
26719        return false;
26720      }
26721    }
26722
26723    return true;
26724  }
26725
26726  PDF20.prototype = {
26727    hash: function PDF20_hash(password, concatBytes, userBytes) {
26728      return calculatePDF20Hash(password, concatBytes, userBytes);
26729    },
26730    checkOwnerPassword: function PDF20_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
26731      var hashData = new Uint8Array(password.length + 56);
26732      hashData.set(password, 0);
26733      hashData.set(ownerValidationSalt, password.length);
26734      hashData.set(userBytes, password.length + ownerValidationSalt.length);
26735      var result = calculatePDF20Hash(password, hashData, userBytes);
26736      return compareByteArrays(result, ownerPassword);
26737    },
26738    checkUserPassword: function PDF20_checkUserPassword(password, userValidationSalt, userPassword) {
26739      var hashData = new Uint8Array(password.length + 8);
26740      hashData.set(password, 0);
26741      hashData.set(userValidationSalt, password.length);
26742      var result = calculatePDF20Hash(password, hashData, []);
26743      return compareByteArrays(result, userPassword);
26744    },
26745    getOwnerKey: function PDF20_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
26746      var hashData = new Uint8Array(password.length + 56);
26747      hashData.set(password, 0);
26748      hashData.set(ownerKeySalt, password.length);
26749      hashData.set(userBytes, password.length + ownerKeySalt.length);
26750      var key = calculatePDF20Hash(password, hashData, userBytes);
26751      var cipher = new AES256Cipher(key);
26752      return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
26753    },
26754    getUserKey: function PDF20_getUserKey(password, userKeySalt, userEncryption) {
26755      var hashData = new Uint8Array(password.length + 8);
26756      hashData.set(password, 0);
26757      hashData.set(userKeySalt, password.length);
26758      var key = calculatePDF20Hash(password, hashData, []);
26759      var cipher = new AES256Cipher(key);
26760      return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
26761    }
26762  };
26763  return PDF20;
26764}();
26765
26766exports.PDF20 = PDF20;
26767
26768var CipherTransform = function CipherTransformClosure() {
26769  function CipherTransform(stringCipherConstructor, streamCipherConstructor) {
26770    this.StringCipherConstructor = stringCipherConstructor;
26771    this.StreamCipherConstructor = streamCipherConstructor;
26772  }
26773
26774  CipherTransform.prototype = {
26775    createStream: function CipherTransform_createStream(stream, length) {
26776      var cipher = new this.StreamCipherConstructor();
26777      return new _stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
26778        return cipher.decryptBlock(data, finalize);
26779      });
26780    },
26781    decryptString: function CipherTransform_decryptString(s) {
26782      var cipher = new this.StringCipherConstructor();
26783      var data = (0, _util.stringToBytes)(s);
26784      data = cipher.decryptBlock(data, true);
26785      return (0, _util.bytesToString)(data);
26786    }
26787  };
26788  return CipherTransform;
26789}();
26790
26791var CipherTransformFactory = function CipherTransformFactoryClosure() {
26792  var defaultPasswordBytes = new Uint8Array([0x28, 0xBF, 0x4E, 0x5E, 0x4E, 0x75, 0x8A, 0x41, 0x64, 0x00, 0x4E, 0x56, 0xFF, 0xFA, 0x01, 0x08, 0x2E, 0x2E, 0x00, 0xB6, 0xD0, 0x68, 0x3E, 0x80, 0x2F, 0x0C, 0xA9, 0xFE, 0x64, 0x53, 0x69, 0x7A]);
26793
26794  function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
26795    if (password) {
26796      var passwordLength = Math.min(127, password.length);
26797      password = password.subarray(0, passwordLength);
26798    } else {
26799      password = [];
26800    }
26801
26802    var pdfAlgorithm;
26803
26804    if (revision === 6) {
26805      pdfAlgorithm = new PDF20();
26806    } else {
26807      pdfAlgorithm = new PDF17();
26808    }
26809
26810    if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
26811      return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
26812    } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
26813      return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
26814    }
26815
26816    return null;
26817  }
26818
26819  function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
26820    var hashDataSize = 40 + ownerPassword.length + fileId.length;
26821    var hashData = new Uint8Array(hashDataSize),
26822        i = 0,
26823        j,
26824        n;
26825
26826    if (password) {
26827      n = Math.min(32, password.length);
26828
26829      for (; i < n; ++i) {
26830        hashData[i] = password[i];
26831      }
26832    }
26833
26834    j = 0;
26835
26836    while (i < 32) {
26837      hashData[i++] = defaultPasswordBytes[j++];
26838    }
26839
26840    for (j = 0, n = ownerPassword.length; j < n; ++j) {
26841      hashData[i++] = ownerPassword[j];
26842    }
26843
26844    hashData[i++] = flags & 0xFF;
26845    hashData[i++] = flags >> 8 & 0xFF;
26846    hashData[i++] = flags >> 16 & 0xFF;
26847    hashData[i++] = flags >>> 24 & 0xFF;
26848
26849    for (j = 0, n = fileId.length; j < n; ++j) {
26850      hashData[i++] = fileId[j];
26851    }
26852
26853    if (revision >= 4 && !encryptMetadata) {
26854      hashData[i++] = 0xFF;
26855      hashData[i++] = 0xFF;
26856      hashData[i++] = 0xFF;
26857      hashData[i++] = 0xFF;
26858    }
26859
26860    var hash = calculateMD5(hashData, 0, i);
26861    var keyLengthInBytes = keyLength >> 3;
26862
26863    if (revision >= 3) {
26864      for (j = 0; j < 50; ++j) {
26865        hash = calculateMD5(hash, 0, keyLengthInBytes);
26866      }
26867    }
26868
26869    var encryptionKey = hash.subarray(0, keyLengthInBytes);
26870    var cipher, checkData;
26871
26872    if (revision >= 3) {
26873      for (i = 0; i < 32; ++i) {
26874        hashData[i] = defaultPasswordBytes[i];
26875      }
26876
26877      for (j = 0, n = fileId.length; j < n; ++j) {
26878        hashData[i++] = fileId[j];
26879      }
26880
26881      cipher = new ARCFourCipher(encryptionKey);
26882      checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
26883      n = encryptionKey.length;
26884      var derivedKey = new Uint8Array(n),
26885          k;
26886
26887      for (j = 1; j <= 19; ++j) {
26888        for (k = 0; k < n; ++k) {
26889          derivedKey[k] = encryptionKey[k] ^ j;
26890        }
26891
26892        cipher = new ARCFourCipher(derivedKey);
26893        checkData = cipher.encryptBlock(checkData);
26894      }
26895
26896      for (j = 0, n = checkData.length; j < n; ++j) {
26897        if (userPassword[j] !== checkData[j]) {
26898          return null;
26899        }
26900      }
26901    } else {
26902      cipher = new ARCFourCipher(encryptionKey);
26903      checkData = cipher.encryptBlock(defaultPasswordBytes);
26904
26905      for (j = 0, n = checkData.length; j < n; ++j) {
26906        if (userPassword[j] !== checkData[j]) {
26907          return null;
26908        }
26909      }
26910    }
26911
26912    return encryptionKey;
26913  }
26914
26915  function decodeUserPassword(password, ownerPassword, revision, keyLength) {
26916    var hashData = new Uint8Array(32),
26917        i = 0,
26918        j,
26919        n;
26920    n = Math.min(32, password.length);
26921
26922    for (; i < n; ++i) {
26923      hashData[i] = password[i];
26924    }
26925
26926    j = 0;
26927
26928    while (i < 32) {
26929      hashData[i++] = defaultPasswordBytes[j++];
26930    }
26931
26932    var hash = calculateMD5(hashData, 0, i);
26933    var keyLengthInBytes = keyLength >> 3;
26934
26935    if (revision >= 3) {
26936      for (j = 0; j < 50; ++j) {
26937        hash = calculateMD5(hash, 0, hash.length);
26938      }
26939    }
26940
26941    var cipher, userPassword;
26942
26943    if (revision >= 3) {
26944      userPassword = ownerPassword;
26945      var derivedKey = new Uint8Array(keyLengthInBytes),
26946          k;
26947
26948      for (j = 19; j >= 0; j--) {
26949        for (k = 0; k < keyLengthInBytes; ++k) {
26950          derivedKey[k] = hash[k] ^ j;
26951        }
26952
26953        cipher = new ARCFourCipher(derivedKey);
26954        userPassword = cipher.encryptBlock(userPassword);
26955      }
26956    } else {
26957      cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
26958      userPassword = cipher.encryptBlock(ownerPassword);
26959    }
26960
26961    return userPassword;
26962  }
26963
26964  var identityName = _primitives.Name.get('Identity');
26965
26966  function CipherTransformFactory(dict, fileId, password) {
26967    var filter = dict.get('Filter');
26968
26969    if (!(0, _primitives.isName)(filter, 'Standard')) {
26970      throw new _util.FormatError('unknown encryption method');
26971    }
26972
26973    this.dict = dict;
26974    var algorithm = dict.get('V');
26975
26976    if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
26977      throw new _util.FormatError('unsupported encryption algorithm');
26978    }
26979
26980    this.algorithm = algorithm;
26981    var keyLength = dict.get('Length');
26982
26983    if (!keyLength) {
26984      if (algorithm <= 3) {
26985        keyLength = 40;
26986      } else {
26987        var cfDict = dict.get('CF');
26988        var streamCryptoName = dict.get('StmF');
26989
26990        if ((0, _primitives.isDict)(cfDict) && (0, _primitives.isName)(streamCryptoName)) {
26991          cfDict.suppressEncryption = true;
26992          var handlerDict = cfDict.get(streamCryptoName.name);
26993          keyLength = handlerDict && handlerDict.get('Length') || 128;
26994
26995          if (keyLength < 40) {
26996            keyLength <<= 3;
26997          }
26998        }
26999      }
27000    }
27001
27002    if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
27003      throw new _util.FormatError('invalid key length');
27004    }
27005
27006    var ownerPassword = (0, _util.stringToBytes)(dict.get('O')).subarray(0, 32);
27007    var userPassword = (0, _util.stringToBytes)(dict.get('U')).subarray(0, 32);
27008    var flags = dict.get('P');
27009    var revision = dict.get('R');
27010    var encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get('EncryptMetadata') !== false;
27011    this.encryptMetadata = encryptMetadata;
27012    var fileIdBytes = (0, _util.stringToBytes)(fileId);
27013    var passwordBytes;
27014
27015    if (password) {
27016      if (revision === 6) {
27017        try {
27018          password = (0, _util.utf8StringToString)(password);
27019        } catch (ex) {
27020          (0, _util.warn)('CipherTransformFactory: ' + 'Unable to convert UTF8 encoded password.');
27021        }
27022      }
27023
27024      passwordBytes = (0, _util.stringToBytes)(password);
27025    }
27026
27027    var encryptionKey;
27028
27029    if (algorithm !== 5) {
27030      encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
27031    } else {
27032      var ownerValidationSalt = (0, _util.stringToBytes)(dict.get('O')).subarray(32, 40);
27033      var ownerKeySalt = (0, _util.stringToBytes)(dict.get('O')).subarray(40, 48);
27034      var uBytes = (0, _util.stringToBytes)(dict.get('U')).subarray(0, 48);
27035      var userValidationSalt = (0, _util.stringToBytes)(dict.get('U')).subarray(32, 40);
27036      var userKeySalt = (0, _util.stringToBytes)(dict.get('U')).subarray(40, 48);
27037      var ownerEncryption = (0, _util.stringToBytes)(dict.get('OE'));
27038      var userEncryption = (0, _util.stringToBytes)(dict.get('UE'));
27039      var perms = (0, _util.stringToBytes)(dict.get('Perms'));
27040      encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
27041    }
27042
27043    if (!encryptionKey && !password) {
27044      throw new _util.PasswordException('No password given', _util.PasswordResponses.NEED_PASSWORD);
27045    } else if (!encryptionKey && password) {
27046      var decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
27047      encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
27048    }
27049
27050    if (!encryptionKey) {
27051      throw new _util.PasswordException('Incorrect Password', _util.PasswordResponses.INCORRECT_PASSWORD);
27052    }
27053
27054    this.encryptionKey = encryptionKey;
27055
27056    if (algorithm >= 4) {
27057      var cf = dict.get('CF');
27058
27059      if ((0, _primitives.isDict)(cf)) {
27060        cf.suppressEncryption = true;
27061      }
27062
27063      this.cf = cf;
27064      this.stmf = dict.get('StmF') || identityName;
27065      this.strf = dict.get('StrF') || identityName;
27066      this.eff = dict.get('EFF') || this.stmf;
27067    }
27068  }
27069
27070  function buildObjectKey(num, gen, encryptionKey, isAes) {
27071    var key = new Uint8Array(encryptionKey.length + 9),
27072        i,
27073        n;
27074
27075    for (i = 0, n = encryptionKey.length; i < n; ++i) {
27076      key[i] = encryptionKey[i];
27077    }
27078
27079    key[i++] = num & 0xFF;
27080    key[i++] = num >> 8 & 0xFF;
27081    key[i++] = num >> 16 & 0xFF;
27082    key[i++] = gen & 0xFF;
27083    key[i++] = gen >> 8 & 0xFF;
27084
27085    if (isAes) {
27086      key[i++] = 0x73;
27087      key[i++] = 0x41;
27088      key[i++] = 0x6C;
27089      key[i++] = 0x54;
27090    }
27091
27092    var hash = calculateMD5(key, 0, i);
27093    return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
27094  }
27095
27096  function buildCipherConstructor(cf, name, num, gen, key) {
27097    if (!(0, _primitives.isName)(name)) {
27098      throw new _util.FormatError('Invalid crypt filter name.');
27099    }
27100
27101    var cryptFilter = cf.get(name.name);
27102    var cfm;
27103
27104    if (cryptFilter !== null && cryptFilter !== undefined) {
27105      cfm = cryptFilter.get('CFM');
27106    }
27107
27108    if (!cfm || cfm.name === 'None') {
27109      return function cipherTransformFactoryBuildCipherConstructorNone() {
27110        return new NullCipher();
27111      };
27112    }
27113
27114    if (cfm.name === 'V2') {
27115      return function cipherTransformFactoryBuildCipherConstructorV2() {
27116        return new ARCFourCipher(buildObjectKey(num, gen, key, false));
27117      };
27118    }
27119
27120    if (cfm.name === 'AESV2') {
27121      return function cipherTransformFactoryBuildCipherConstructorAESV2() {
27122        return new AES128Cipher(buildObjectKey(num, gen, key, true));
27123      };
27124    }
27125
27126    if (cfm.name === 'AESV3') {
27127      return function cipherTransformFactoryBuildCipherConstructorAESV3() {
27128        return new AES256Cipher(key);
27129      };
27130    }
27131
27132    throw new _util.FormatError('Unknown crypto method');
27133  }
27134
27135  CipherTransformFactory.prototype = {
27136    createCipherTransform: function CipherTransformFactory_createCipherTransform(num, gen) {
27137      if (this.algorithm === 4 || this.algorithm === 5) {
27138        return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey));
27139      }
27140
27141      var key = buildObjectKey(num, gen, this.encryptionKey, false);
27142
27143      var cipherConstructor = function buildCipherCipherConstructor() {
27144        return new ARCFourCipher(key);
27145      };
27146
27147      return new CipherTransform(cipherConstructor, cipherConstructor);
27148    }
27149  };
27150  return CipherTransformFactory;
27151}();
27152
27153exports.CipherTransformFactory = CipherTransformFactory;
27154
27155/***/ }),
27156/* 169 */
27157/***/ (function(module, exports, __w_pdfjs_require__) {
27158
27159"use strict";
27160
27161
27162Object.defineProperty(exports, "__esModule", {
27163  value: true
27164});
27165exports.ColorSpace = void 0;
27166
27167var _util = __w_pdfjs_require__(5);
27168
27169var _primitives = __w_pdfjs_require__(151);
27170
27171function _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); }
27172
27173function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
27174
27175function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
27176
27177function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
27178
27179function _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); }
27180
27181function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
27182
27183function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
27184
27185function _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); } }
27186
27187function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
27188
27189function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
27190  var COMPONENTS = 3;
27191  alpha01 = alpha01 !== 1 ? 0 : alpha01;
27192  var xRatio = w1 / w2;
27193  var yRatio = h1 / h2;
27194  var newIndex = 0,
27195      oldIndex;
27196  var xScaled = new Uint16Array(w2);
27197  var w1Scanline = w1 * COMPONENTS;
27198
27199  for (var i = 0; i < w2; i++) {
27200    xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
27201  }
27202
27203  for (var _i = 0; _i < h2; _i++) {
27204    var py = Math.floor(_i * yRatio) * w1Scanline;
27205
27206    for (var j = 0; j < w2; j++) {
27207      oldIndex = py + xScaled[j];
27208      dest[newIndex++] = src[oldIndex++];
27209      dest[newIndex++] = src[oldIndex++];
27210      dest[newIndex++] = src[oldIndex++];
27211      newIndex += alpha01;
27212    }
27213  }
27214}
27215
27216var ColorSpace =
27217/*#__PURE__*/
27218function () {
27219  function ColorSpace(name, numComps) {
27220    _classCallCheck(this, ColorSpace);
27221
27222    if (this.constructor === ColorSpace) {
27223      (0, _util.unreachable)('Cannot initialize ColorSpace.');
27224    }
27225
27226    this.name = name;
27227    this.numComps = numComps;
27228  }
27229
27230  _createClass(ColorSpace, [{
27231    key: "getRgb",
27232    value: function getRgb(src, srcOffset) {
27233      var rgb = new Uint8ClampedArray(3);
27234      this.getRgbItem(src, srcOffset, rgb, 0);
27235      return rgb;
27236    }
27237  }, {
27238    key: "getRgbItem",
27239    value: function getRgbItem(src, srcOffset, dest, destOffset) {
27240      (0, _util.unreachable)('Should not call ColorSpace.getRgbItem');
27241    }
27242  }, {
27243    key: "getRgbBuffer",
27244    value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
27245      (0, _util.unreachable)('Should not call ColorSpace.getRgbBuffer');
27246    }
27247  }, {
27248    key: "getOutputLength",
27249    value: function getOutputLength(inputLength, alpha01) {
27250      (0, _util.unreachable)('Should not call ColorSpace.getOutputLength');
27251    }
27252  }, {
27253    key: "isPassthrough",
27254    value: function isPassthrough(bits) {
27255      return false;
27256    }
27257  }, {
27258    key: "isDefaultDecode",
27259    value: function isDefaultDecode(decodeMap, bpc) {
27260      return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
27261    }
27262  }, {
27263    key: "fillRgb",
27264    value: function fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
27265      var count = originalWidth * originalHeight;
27266      var rgbBuf = null;
27267      var numComponentColors = 1 << bpc;
27268      var needsResizing = originalHeight !== height || originalWidth !== width;
27269
27270      if (this.isPassthrough(bpc)) {
27271        rgbBuf = comps;
27272      } else if (this.numComps === 1 && count > numComponentColors && this.name !== 'DeviceGray' && this.name !== 'DeviceRGB') {
27273        var allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
27274
27275        for (var i = 0; i < numComponentColors; i++) {
27276          allColors[i] = i;
27277        }
27278
27279        var colorMap = new Uint8ClampedArray(numComponentColors * 3);
27280        this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
27281
27282        if (!needsResizing) {
27283          var destPos = 0;
27284
27285          for (var _i2 = 0; _i2 < count; ++_i2) {
27286            var key = comps[_i2] * 3;
27287            dest[destPos++] = colorMap[key];
27288            dest[destPos++] = colorMap[key + 1];
27289            dest[destPos++] = colorMap[key + 2];
27290            destPos += alpha01;
27291          }
27292        } else {
27293          rgbBuf = new Uint8Array(count * 3);
27294          var rgbPos = 0;
27295
27296          for (var _i3 = 0; _i3 < count; ++_i3) {
27297            var _key = comps[_i3] * 3;
27298
27299            rgbBuf[rgbPos++] = colorMap[_key];
27300            rgbBuf[rgbPos++] = colorMap[_key + 1];
27301            rgbBuf[rgbPos++] = colorMap[_key + 2];
27302          }
27303        }
27304      } else {
27305        if (!needsResizing) {
27306          this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
27307        } else {
27308          rgbBuf = new Uint8ClampedArray(count * 3);
27309          this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
27310        }
27311      }
27312
27313      if (rgbBuf) {
27314        if (needsResizing) {
27315          resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
27316        } else {
27317          var _destPos = 0,
27318              _rgbPos = 0;
27319
27320          for (var _i4 = 0, ii = width * actualHeight; _i4 < ii; _i4++) {
27321            dest[_destPos++] = rgbBuf[_rgbPos++];
27322            dest[_destPos++] = rgbBuf[_rgbPos++];
27323            dest[_destPos++] = rgbBuf[_rgbPos++];
27324            _destPos += alpha01;
27325          }
27326        }
27327      }
27328    }
27329  }, {
27330    key: "usesZeroToOneRange",
27331    get: function get() {
27332      return (0, _util.shadow)(this, 'usesZeroToOneRange', true);
27333    }
27334  }], [{
27335    key: "parse",
27336    value: function parse(cs, xref, res, pdfFunctionFactory) {
27337      var IR = this.parseToIR(cs, xref, res, pdfFunctionFactory);
27338      return this.fromIR(IR);
27339    }
27340  }, {
27341    key: "fromIR",
27342    value: function fromIR(IR) {
27343      var name = Array.isArray(IR) ? IR[0] : IR;
27344      var whitePoint, blackPoint, gamma;
27345
27346      switch (name) {
27347        case 'DeviceGrayCS':
27348          return this.singletons.gray;
27349
27350        case 'DeviceRgbCS':
27351          return this.singletons.rgb;
27352
27353        case 'DeviceCmykCS':
27354          return this.singletons.cmyk;
27355
27356        case 'CalGrayCS':
27357          whitePoint = IR[1];
27358          blackPoint = IR[2];
27359          gamma = IR[3];
27360          return new CalGrayCS(whitePoint, blackPoint, gamma);
27361
27362        case 'CalRGBCS':
27363          whitePoint = IR[1];
27364          blackPoint = IR[2];
27365          gamma = IR[3];
27366          var matrix = IR[4];
27367          return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
27368
27369        case 'PatternCS':
27370          var basePatternCS = IR[1];
27371
27372          if (basePatternCS) {
27373            basePatternCS = this.fromIR(basePatternCS);
27374          }
27375
27376          return new PatternCS(basePatternCS);
27377
27378        case 'IndexedCS':
27379          var baseIndexedCS = IR[1];
27380          var hiVal = IR[2];
27381          var lookup = IR[3];
27382          return new IndexedCS(this.fromIR(baseIndexedCS), hiVal, lookup);
27383
27384        case 'AlternateCS':
27385          var numComps = IR[1];
27386          var alt = IR[2];
27387          var tintFn = IR[3];
27388          return new AlternateCS(numComps, this.fromIR(alt), tintFn);
27389
27390        case 'LabCS':
27391          whitePoint = IR[1];
27392          blackPoint = IR[2];
27393          var range = IR[3];
27394          return new LabCS(whitePoint, blackPoint, range);
27395
27396        default:
27397          throw new _util.FormatError("Unknown colorspace name: ".concat(name));
27398      }
27399    }
27400  }, {
27401    key: "parseToIR",
27402    value: function parseToIR(cs, xref) {
27403      var res = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
27404      var pdfFunctionFactory = arguments.length > 3 ? arguments[3] : undefined;
27405      cs = xref.fetchIfRef(cs);
27406
27407      if ((0, _primitives.isName)(cs)) {
27408        switch (cs.name) {
27409          case 'DeviceGray':
27410          case 'G':
27411            return 'DeviceGrayCS';
27412
27413          case 'DeviceRGB':
27414          case 'RGB':
27415            return 'DeviceRgbCS';
27416
27417          case 'DeviceCMYK':
27418          case 'CMYK':
27419            return 'DeviceCmykCS';
27420
27421          case 'Pattern':
27422            return ['PatternCS', null];
27423
27424          default:
27425            if ((0, _primitives.isDict)(res)) {
27426              var colorSpaces = res.get('ColorSpace');
27427
27428              if ((0, _primitives.isDict)(colorSpaces)) {
27429                var resCS = colorSpaces.get(cs.name);
27430
27431                if (resCS) {
27432                  if ((0, _primitives.isName)(resCS)) {
27433                    return this.parseToIR(resCS, xref, res, pdfFunctionFactory);
27434                  }
27435
27436                  cs = resCS;
27437                  break;
27438                }
27439              }
27440            }
27441
27442            throw new _util.FormatError("unrecognized colorspace ".concat(cs.name));
27443        }
27444      }
27445
27446      if (Array.isArray(cs)) {
27447        var mode = xref.fetchIfRef(cs[0]).name;
27448        var numComps, params, alt, whitePoint, blackPoint, gamma;
27449
27450        switch (mode) {
27451          case 'DeviceGray':
27452          case 'G':
27453            return 'DeviceGrayCS';
27454
27455          case 'DeviceRGB':
27456          case 'RGB':
27457            return 'DeviceRgbCS';
27458
27459          case 'DeviceCMYK':
27460          case 'CMYK':
27461            return 'DeviceCmykCS';
27462
27463          case 'CalGray':
27464            params = xref.fetchIfRef(cs[1]);
27465            whitePoint = params.getArray('WhitePoint');
27466            blackPoint = params.getArray('BlackPoint');
27467            gamma = params.get('Gamma');
27468            return ['CalGrayCS', whitePoint, blackPoint, gamma];
27469
27470          case 'CalRGB':
27471            params = xref.fetchIfRef(cs[1]);
27472            whitePoint = params.getArray('WhitePoint');
27473            blackPoint = params.getArray('BlackPoint');
27474            gamma = params.getArray('Gamma');
27475            var matrix = params.getArray('Matrix');
27476            return ['CalRGBCS', whitePoint, blackPoint, gamma, matrix];
27477
27478          case 'ICCBased':
27479            var stream = xref.fetchIfRef(cs[1]);
27480            var dict = stream.dict;
27481            numComps = dict.get('N');
27482            alt = dict.get('Alternate');
27483
27484            if (alt) {
27485              var altIR = this.parseToIR(alt, xref, res, pdfFunctionFactory);
27486              var altCS = this.fromIR(altIR, pdfFunctionFactory);
27487
27488              if (altCS.numComps === numComps) {
27489                return altIR;
27490              }
27491
27492              (0, _util.warn)('ICCBased color space: Ignoring incorrect /Alternate entry.');
27493            }
27494
27495            if (numComps === 1) {
27496              return 'DeviceGrayCS';
27497            } else if (numComps === 3) {
27498              return 'DeviceRgbCS';
27499            } else if (numComps === 4) {
27500              return 'DeviceCmykCS';
27501            }
27502
27503            break;
27504
27505          case 'Pattern':
27506            var basePatternCS = cs[1] || null;
27507
27508            if (basePatternCS) {
27509              basePatternCS = this.parseToIR(basePatternCS, xref, res, pdfFunctionFactory);
27510            }
27511
27512            return ['PatternCS', basePatternCS];
27513
27514          case 'Indexed':
27515          case 'I':
27516            var baseIndexedCS = this.parseToIR(cs[1], xref, res, pdfFunctionFactory);
27517            var hiVal = xref.fetchIfRef(cs[2]) + 1;
27518            var lookup = xref.fetchIfRef(cs[3]);
27519
27520            if ((0, _primitives.isStream)(lookup)) {
27521              lookup = lookup.getBytes();
27522            }
27523
27524            return ['IndexedCS', baseIndexedCS, hiVal, lookup];
27525
27526          case 'Separation':
27527          case 'DeviceN':
27528            var name = xref.fetchIfRef(cs[1]);
27529            numComps = Array.isArray(name) ? name.length : 1;
27530            alt = this.parseToIR(cs[2], xref, res, pdfFunctionFactory);
27531            var tintFn = pdfFunctionFactory.create(xref.fetchIfRef(cs[3]));
27532            return ['AlternateCS', numComps, alt, tintFn];
27533
27534          case 'Lab':
27535            params = xref.fetchIfRef(cs[1]);
27536            whitePoint = params.getArray('WhitePoint');
27537            blackPoint = params.getArray('BlackPoint');
27538            var range = params.getArray('Range');
27539            return ['LabCS', whitePoint, blackPoint, range];
27540
27541          default:
27542            throw new _util.FormatError("unimplemented color space object \"".concat(mode, "\""));
27543        }
27544      }
27545
27546      throw new _util.FormatError("unrecognized color space object: \"".concat(cs, "\""));
27547    }
27548  }, {
27549    key: "isDefaultDecode",
27550    value: function isDefaultDecode(decode, numComps) {
27551      if (!Array.isArray(decode)) {
27552        return true;
27553      }
27554
27555      if (numComps * 2 !== decode.length) {
27556        (0, _util.warn)('The decode map is not the correct length');
27557        return true;
27558      }
27559
27560      for (var i = 0, ii = decode.length; i < ii; i += 2) {
27561        if (decode[i] !== 0 || decode[i + 1] !== 1) {
27562          return false;
27563        }
27564      }
27565
27566      return true;
27567    }
27568  }, {
27569    key: "singletons",
27570    get: function get() {
27571      return (0, _util.shadow)(this, 'singletons', {
27572        get gray() {
27573          return (0, _util.shadow)(this, 'gray', new DeviceGrayCS());
27574        },
27575
27576        get rgb() {
27577          return (0, _util.shadow)(this, 'rgb', new DeviceRgbCS());
27578        },
27579
27580        get cmyk() {
27581          return (0, _util.shadow)(this, 'cmyk', new DeviceCmykCS());
27582        }
27583
27584      });
27585    }
27586  }]);
27587
27588  return ColorSpace;
27589}();
27590
27591exports.ColorSpace = ColorSpace;
27592
27593var AlternateCS =
27594/*#__PURE__*/
27595function (_ColorSpace) {
27596  _inherits(AlternateCS, _ColorSpace);
27597
27598  function AlternateCS(numComps, base, tintFn) {
27599    var _this;
27600
27601    _classCallCheck(this, AlternateCS);
27602
27603    _this = _possibleConstructorReturn(this, _getPrototypeOf(AlternateCS).call(this, 'Alternate', numComps));
27604    _this.base = base;
27605    _this.tintFn = tintFn;
27606    _this.tmpBuf = new Float32Array(base.numComps);
27607    return _this;
27608  }
27609
27610  _createClass(AlternateCS, [{
27611    key: "getRgbItem",
27612    value: function getRgbItem(src, srcOffset, dest, destOffset) {
27613      var tmpBuf = this.tmpBuf;
27614      this.tintFn(src, srcOffset, tmpBuf, 0);
27615      this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
27616    }
27617  }, {
27618    key: "getRgbBuffer",
27619    value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
27620      var tintFn = this.tintFn;
27621      var base = this.base;
27622      var scale = 1 / ((1 << bits) - 1);
27623      var baseNumComps = base.numComps;
27624      var usesZeroToOneRange = base.usesZeroToOneRange;
27625      var isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
27626      var pos = isPassthrough ? destOffset : 0;
27627      var baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
27628      var numComps = this.numComps;
27629      var scaled = new Float32Array(numComps);
27630      var tinted = new Float32Array(baseNumComps);
27631      var i, j;
27632
27633      for (i = 0; i < count; i++) {
27634        for (j = 0; j < numComps; j++) {
27635          scaled[j] = src[srcOffset++] * scale;
27636        }
27637
27638        tintFn(scaled, 0, tinted, 0);
27639
27640        if (usesZeroToOneRange) {
27641          for (j = 0; j < baseNumComps; j++) {
27642            baseBuf[pos++] = tinted[j] * 255;
27643          }
27644        } else {
27645          base.getRgbItem(tinted, 0, baseBuf, pos);
27646          pos += baseNumComps;
27647        }
27648      }
27649
27650      if (!isPassthrough) {
27651        base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
27652      }
27653    }
27654  }, {
27655    key: "getOutputLength",
27656    value: function getOutputLength(inputLength, alpha01) {
27657      return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
27658    }
27659  }]);
27660
27661  return AlternateCS;
27662}(ColorSpace);
27663
27664var PatternCS =
27665/*#__PURE__*/
27666function (_ColorSpace2) {
27667  _inherits(PatternCS, _ColorSpace2);
27668
27669  function PatternCS(baseCS) {
27670    var _this2;
27671
27672    _classCallCheck(this, PatternCS);
27673
27674    _this2 = _possibleConstructorReturn(this, _getPrototypeOf(PatternCS).call(this, 'Pattern', null));
27675    _this2.base = baseCS;
27676    return _this2;
27677  }
27678
27679  _createClass(PatternCS, [{
27680    key: "isDefaultDecode",
27681    value: function isDefaultDecode(decodeMap, bpc) {
27682      (0, _util.unreachable)('Should not call PatternCS.isDefaultDecode');
27683    }
27684  }]);
27685
27686  return PatternCS;
27687}(ColorSpace);
27688
27689var IndexedCS =
27690/*#__PURE__*/
27691function (_ColorSpace3) {
27692  _inherits(IndexedCS, _ColorSpace3);
27693
27694  function IndexedCS(base, highVal, lookup) {
27695    var _this3;
27696
27697    _classCallCheck(this, IndexedCS);
27698
27699    _this3 = _possibleConstructorReturn(this, _getPrototypeOf(IndexedCS).call(this, 'Indexed', 1));
27700    _this3.base = base;
27701    _this3.highVal = highVal;
27702    var baseNumComps = base.numComps;
27703    var length = baseNumComps * highVal;
27704
27705    if ((0, _primitives.isStream)(lookup)) {
27706      _this3.lookup = new Uint8Array(length);
27707      var bytes = lookup.getBytes(length);
27708
27709      _this3.lookup.set(bytes);
27710    } else if ((0, _util.isString)(lookup)) {
27711      _this3.lookup = new Uint8Array(length);
27712
27713      for (var i = 0; i < length; ++i) {
27714        _this3.lookup[i] = lookup.charCodeAt(i);
27715      }
27716    } else if (lookup instanceof Uint8Array) {
27717      _this3.lookup = lookup;
27718    } else {
27719      throw new _util.FormatError("Unrecognized lookup table: ".concat(lookup));
27720    }
27721
27722    return _this3;
27723  }
27724
27725  _createClass(IndexedCS, [{
27726    key: "getRgbItem",
27727    value: function getRgbItem(src, srcOffset, dest, destOffset) {
27728      var numComps = this.base.numComps;
27729      var start = src[srcOffset] * numComps;
27730      this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
27731    }
27732  }, {
27733    key: "getRgbBuffer",
27734    value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
27735      var base = this.base;
27736      var numComps = base.numComps;
27737      var outputDelta = base.getOutputLength(numComps, alpha01);
27738      var lookup = this.lookup;
27739
27740      for (var i = 0; i < count; ++i) {
27741        var lookupPos = src[srcOffset++] * numComps;
27742        base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
27743        destOffset += outputDelta;
27744      }
27745    }
27746  }, {
27747    key: "getOutputLength",
27748    value: function getOutputLength(inputLength, alpha01) {
27749      return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
27750    }
27751  }, {
27752    key: "isDefaultDecode",
27753    value: function isDefaultDecode(decodeMap, bpc) {
27754      if (!Array.isArray(decodeMap)) {
27755        return true;
27756      }
27757
27758      if (decodeMap.length !== 2) {
27759        (0, _util.warn)('Decode map length is not correct');
27760        return true;
27761      }
27762
27763      if (!Number.isInteger(bpc) || bpc < 1) {
27764        (0, _util.warn)('Bits per component is not correct');
27765        return true;
27766      }
27767
27768      return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
27769    }
27770  }]);
27771
27772  return IndexedCS;
27773}(ColorSpace);
27774
27775var DeviceGrayCS =
27776/*#__PURE__*/
27777function (_ColorSpace4) {
27778  _inherits(DeviceGrayCS, _ColorSpace4);
27779
27780  function DeviceGrayCS() {
27781    _classCallCheck(this, DeviceGrayCS);
27782
27783    return _possibleConstructorReturn(this, _getPrototypeOf(DeviceGrayCS).call(this, 'DeviceGray', 1));
27784  }
27785
27786  _createClass(DeviceGrayCS, [{
27787    key: "getRgbItem",
27788    value: function getRgbItem(src, srcOffset, dest, destOffset) {
27789      var c = src[srcOffset] * 255;
27790      dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
27791    }
27792  }, {
27793    key: "getRgbBuffer",
27794    value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
27795      var scale = 255 / ((1 << bits) - 1);
27796      var j = srcOffset,
27797          q = destOffset;
27798
27799      for (var i = 0; i < count; ++i) {
27800        var c = scale * src[j++];
27801        dest[q++] = c;
27802        dest[q++] = c;
27803        dest[q++] = c;
27804        q += alpha01;
27805      }
27806    }
27807  }, {
27808    key: "getOutputLength",
27809    value: function getOutputLength(inputLength, alpha01) {
27810      return inputLength * (3 + alpha01);
27811    }
27812  }]);
27813
27814  return DeviceGrayCS;
27815}(ColorSpace);
27816
27817var DeviceRgbCS =
27818/*#__PURE__*/
27819function (_ColorSpace5) {
27820  _inherits(DeviceRgbCS, _ColorSpace5);
27821
27822  function DeviceRgbCS() {
27823    _classCallCheck(this, DeviceRgbCS);
27824
27825    return _possibleConstructorReturn(this, _getPrototypeOf(DeviceRgbCS).call(this, 'DeviceRGB', 3));
27826  }
27827
27828  _createClass(DeviceRgbCS, [{
27829    key: "getRgbItem",
27830    value: function getRgbItem(src, srcOffset, dest, destOffset) {
27831      dest[destOffset] = src[srcOffset] * 255;
27832      dest[destOffset + 1] = src[srcOffset + 1] * 255;
27833      dest[destOffset + 2] = src[srcOffset + 2] * 255;
27834    }
27835  }, {
27836    key: "getRgbBuffer",
27837    value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
27838      if (bits === 8 && alpha01 === 0) {
27839        dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
27840        return;
27841      }
27842
27843      var scale = 255 / ((1 << bits) - 1);
27844      var j = srcOffset,
27845          q = destOffset;
27846
27847      for (var i = 0; i < count; ++i) {
27848        dest[q++] = scale * src[j++];
27849        dest[q++] = scale * src[j++];
27850        dest[q++] = scale * src[j++];
27851        q += alpha01;
27852      }
27853    }
27854  }, {
27855    key: "getOutputLength",
27856    value: function getOutputLength(inputLength, alpha01) {
27857      return inputLength * (3 + alpha01) / 3 | 0;
27858    }
27859  }, {
27860    key: "isPassthrough",
27861    value: function isPassthrough(bits) {
27862      return bits === 8;
27863    }
27864  }]);
27865
27866  return DeviceRgbCS;
27867}(ColorSpace);
27868
27869var DeviceCmykCS = function DeviceCmykCSClosure() {
27870  function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
27871    var c = src[srcOffset] * srcScale;
27872    var m = src[srcOffset + 1] * srcScale;
27873    var y = src[srcOffset + 2] * srcScale;
27874    var k = src[srcOffset + 3] * srcScale;
27875    dest[destOffset] = 255 + c * (-4.387332384609988 * c + 54.48615194189176 * m + 18.82290502165302 * y + 212.25662451639585 * k + -285.2331026137004) + m * (1.7149763477362134 * m - 5.6096736904047315 * y + -17.873870861415444 * k - 5.497006427196366) + y * (-2.5217340131683033 * y - 21.248923337353073 * k + 17.5119270841813) + k * (-21.86122147463605 * k - 189.48180835922747);
27876    dest[destOffset + 1] = 255 + c * (8.841041422036149 * c + 60.118027045597366 * m + 6.871425592049007 * y + 31.159100130055922 * k + -79.2970844816548) + m * (-15.310361306967817 * m + 17.575251261109482 * y + 131.35250912493976 * k - 190.9453302588951) + y * (4.444339102852739 * y + 9.8632861493405 * k - 24.86741582555878) + k * (-20.737325471181034 * k - 187.80453709719578);
27877    dest[destOffset + 2] = 255 + c * (0.8842522430003296 * c + 8.078677503112928 * m + 30.89978309703729 * y - 0.23883238689178934 * k + -14.183576799673286) + m * (10.49593273432072 * m + 63.02378494754052 * y + 50.606957656360734 * k - 112.23884253719248) + y * (0.03296041114873217 * y + 115.60384449646641 * k + -193.58209356861505) + k * (-22.33816807309886 * k - 180.12613974708367);
27878  }
27879
27880  var DeviceCmykCS =
27881  /*#__PURE__*/
27882  function (_ColorSpace6) {
27883    _inherits(DeviceCmykCS, _ColorSpace6);
27884
27885    function DeviceCmykCS() {
27886      _classCallCheck(this, DeviceCmykCS);
27887
27888      return _possibleConstructorReturn(this, _getPrototypeOf(DeviceCmykCS).call(this, 'DeviceCMYK', 4));
27889    }
27890
27891    _createClass(DeviceCmykCS, [{
27892      key: "getRgbItem",
27893      value: function getRgbItem(src, srcOffset, dest, destOffset) {
27894        convertToRgb(src, srcOffset, 1, dest, destOffset);
27895      }
27896    }, {
27897      key: "getRgbBuffer",
27898      value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
27899        var scale = 1 / ((1 << bits) - 1);
27900
27901        for (var i = 0; i < count; i++) {
27902          convertToRgb(src, srcOffset, scale, dest, destOffset);
27903          srcOffset += 4;
27904          destOffset += 3 + alpha01;
27905        }
27906      }
27907    }, {
27908      key: "getOutputLength",
27909      value: function getOutputLength(inputLength, alpha01) {
27910        return inputLength / 4 * (3 + alpha01) | 0;
27911      }
27912    }]);
27913
27914    return DeviceCmykCS;
27915  }(ColorSpace);
27916
27917  return DeviceCmykCS;
27918}();
27919
27920var CalGrayCS = function CalGrayCSClosure() {
27921  function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
27922    var A = src[srcOffset] * scale;
27923    var AG = Math.pow(A, cs.G);
27924    var L = cs.YW * AG;
27925    var val = Math.max(295.8 * Math.pow(L, 0.333333333333333333) - 40.8, 0);
27926    dest[destOffset] = val;
27927    dest[destOffset + 1] = val;
27928    dest[destOffset + 2] = val;
27929  }
27930
27931  var CalGrayCS =
27932  /*#__PURE__*/
27933  function (_ColorSpace7) {
27934    _inherits(CalGrayCS, _ColorSpace7);
27935
27936    function CalGrayCS(whitePoint, blackPoint, gamma) {
27937      var _this4;
27938
27939      _classCallCheck(this, CalGrayCS);
27940
27941      _this4 = _possibleConstructorReturn(this, _getPrototypeOf(CalGrayCS).call(this, 'CalGray', 1));
27942
27943      if (!whitePoint) {
27944        throw new _util.FormatError('WhitePoint missing - required for color space CalGray');
27945      }
27946
27947      blackPoint = blackPoint || [0, 0, 0];
27948      gamma = gamma || 1;
27949      _this4.XW = whitePoint[0];
27950      _this4.YW = whitePoint[1];
27951      _this4.ZW = whitePoint[2];
27952      _this4.XB = blackPoint[0];
27953      _this4.YB = blackPoint[1];
27954      _this4.ZB = blackPoint[2];
27955      _this4.G = gamma;
27956
27957      if (_this4.XW < 0 || _this4.ZW < 0 || _this4.YW !== 1) {
27958        throw new _util.FormatError("Invalid WhitePoint components for ".concat(_this4.name) + ', no fallback available');
27959      }
27960
27961      if (_this4.XB < 0 || _this4.YB < 0 || _this4.ZB < 0) {
27962        (0, _util.info)("Invalid BlackPoint for ".concat(_this4.name, ", falling back to default."));
27963        _this4.XB = _this4.YB = _this4.ZB = 0;
27964      }
27965
27966      if (_this4.XB !== 0 || _this4.YB !== 0 || _this4.ZB !== 0) {
27967        (0, _util.warn)("".concat(_this4.name, ", BlackPoint: XB: ").concat(_this4.XB, ", YB: ").concat(_this4.YB, ", ") + "ZB: ".concat(_this4.ZB, ", only default values are supported."));
27968      }
27969
27970      if (_this4.G < 1) {
27971        (0, _util.info)("Invalid Gamma: ".concat(_this4.G, " for ").concat(_this4.name, ", ") + 'falling back to default.');
27972        _this4.G = 1;
27973      }
27974
27975      return _this4;
27976    }
27977
27978    _createClass(CalGrayCS, [{
27979      key: "getRgbItem",
27980      value: function getRgbItem(src, srcOffset, dest, destOffset) {
27981        convertToRgb(this, src, srcOffset, dest, destOffset, 1);
27982      }
27983    }, {
27984      key: "getRgbBuffer",
27985      value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
27986        var scale = 1 / ((1 << bits) - 1);
27987
27988        for (var i = 0; i < count; ++i) {
27989          convertToRgb(this, src, srcOffset, dest, destOffset, scale);
27990          srcOffset += 1;
27991          destOffset += 3 + alpha01;
27992        }
27993      }
27994    }, {
27995      key: "getOutputLength",
27996      value: function getOutputLength(inputLength, alpha01) {
27997        return inputLength * (3 + alpha01);
27998      }
27999    }]);
28000
28001    return CalGrayCS;
28002  }(ColorSpace);
28003
28004  return CalGrayCS;
28005}();
28006
28007var CalRGBCS = function CalRGBCSClosure() {
28008  var BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
28009  var BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([0.9869929, -0.1470543, 0.1599627, 0.4323053, 0.5183603, 0.0492912, -0.0085287, 0.0400428, 0.9684867]);
28010  var SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([3.2404542, -1.5371385, -0.4985314, -0.9692660, 1.8760108, 0.0415560, 0.0556434, -0.2040259, 1.0572252]);
28011  var FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
28012  var tempNormalizeMatrix = new Float32Array(3);
28013  var tempConvertMatrix1 = new Float32Array(3);
28014  var tempConvertMatrix2 = new Float32Array(3);
28015  var DECODE_L_CONSTANT = Math.pow((8 + 16) / 116, 3) / 8.0;
28016
28017  function matrixProduct(a, b, result) {
28018    result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
28019    result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
28020    result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
28021  }
28022
28023  function convertToFlat(sourceWhitePoint, LMS, result) {
28024    result[0] = LMS[0] * 1 / sourceWhitePoint[0];
28025    result[1] = LMS[1] * 1 / sourceWhitePoint[1];
28026    result[2] = LMS[2] * 1 / sourceWhitePoint[2];
28027  }
28028
28029  function convertToD65(sourceWhitePoint, LMS, result) {
28030    var D65X = 0.95047;
28031    var D65Y = 1;
28032    var D65Z = 1.08883;
28033    result[0] = LMS[0] * D65X / sourceWhitePoint[0];
28034    result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
28035    result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
28036  }
28037
28038  function sRGBTransferFunction(color) {
28039    if (color <= 0.0031308) {
28040      return adjustToRange(0, 1, 12.92 * color);
28041    }
28042
28043    return adjustToRange(0, 1, (1 + 0.055) * Math.pow(color, 1 / 2.4) - 0.055);
28044  }
28045
28046  function adjustToRange(min, max, value) {
28047    return Math.max(min, Math.min(max, value));
28048  }
28049
28050  function decodeL(L) {
28051    if (L < 0) {
28052      return -decodeL(-L);
28053    }
28054
28055    if (L > 8.0) {
28056      return Math.pow((L + 16) / 116, 3);
28057    }
28058
28059    return L * DECODE_L_CONSTANT;
28060  }
28061
28062  function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
28063    if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
28064      result[0] = XYZ_Flat[0];
28065      result[1] = XYZ_Flat[1];
28066      result[2] = XYZ_Flat[2];
28067      return;
28068    }
28069
28070    var zeroDecodeL = decodeL(0);
28071    var X_DST = zeroDecodeL;
28072    var X_SRC = decodeL(sourceBlackPoint[0]);
28073    var Y_DST = zeroDecodeL;
28074    var Y_SRC = decodeL(sourceBlackPoint[1]);
28075    var Z_DST = zeroDecodeL;
28076    var Z_SRC = decodeL(sourceBlackPoint[2]);
28077    var X_Scale = (1 - X_DST) / (1 - X_SRC);
28078    var X_Offset = 1 - X_Scale;
28079    var Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
28080    var Y_Offset = 1 - Y_Scale;
28081    var Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
28082    var Z_Offset = 1 - Z_Scale;
28083    result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
28084    result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
28085    result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
28086  }
28087
28088  function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
28089    if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
28090      result[0] = XYZ_In[0];
28091      result[1] = XYZ_In[1];
28092      result[2] = XYZ_In[2];
28093      return;
28094    }
28095
28096    var LMS = result;
28097    matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
28098    var LMS_Flat = tempNormalizeMatrix;
28099    convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
28100    matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
28101  }
28102
28103  function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
28104    var LMS = result;
28105    matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
28106    var LMS_D65 = tempNormalizeMatrix;
28107    convertToD65(sourceWhitePoint, LMS, LMS_D65);
28108    matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
28109  }
28110
28111  function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
28112    var A = adjustToRange(0, 1, src[srcOffset] * scale);
28113    var B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
28114    var C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
28115    var AGR = Math.pow(A, cs.GR);
28116    var BGG = Math.pow(B, cs.GG);
28117    var CGB = Math.pow(C, cs.GB);
28118    var X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
28119    var Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
28120    var Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
28121    var XYZ = tempConvertMatrix1;
28122    XYZ[0] = X;
28123    XYZ[1] = Y;
28124    XYZ[2] = Z;
28125    var XYZ_Flat = tempConvertMatrix2;
28126    normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
28127    var XYZ_Black = tempConvertMatrix1;
28128    compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
28129    var XYZ_D65 = tempConvertMatrix2;
28130    normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
28131    var SRGB = tempConvertMatrix1;
28132    matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
28133    dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255;
28134    dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255;
28135    dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255;
28136  }
28137
28138  var CalRGBCS =
28139  /*#__PURE__*/
28140  function (_ColorSpace8) {
28141    _inherits(CalRGBCS, _ColorSpace8);
28142
28143    function CalRGBCS(whitePoint, blackPoint, gamma, matrix) {
28144      var _this5;
28145
28146      _classCallCheck(this, CalRGBCS);
28147
28148      _this5 = _possibleConstructorReturn(this, _getPrototypeOf(CalRGBCS).call(this, 'CalRGB', 3));
28149
28150      if (!whitePoint) {
28151        throw new _util.FormatError('WhitePoint missing - required for color space CalRGB');
28152      }
28153
28154      blackPoint = blackPoint || new Float32Array(3);
28155      gamma = gamma || new Float32Array([1, 1, 1]);
28156      matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
28157      var XW = whitePoint[0];
28158      var YW = whitePoint[1];
28159      var ZW = whitePoint[2];
28160      _this5.whitePoint = whitePoint;
28161      var XB = blackPoint[0];
28162      var YB = blackPoint[1];
28163      var ZB = blackPoint[2];
28164      _this5.blackPoint = blackPoint;
28165      _this5.GR = gamma[0];
28166      _this5.GG = gamma[1];
28167      _this5.GB = gamma[2];
28168      _this5.MXA = matrix[0];
28169      _this5.MYA = matrix[1];
28170      _this5.MZA = matrix[2];
28171      _this5.MXB = matrix[3];
28172      _this5.MYB = matrix[4];
28173      _this5.MZB = matrix[5];
28174      _this5.MXC = matrix[6];
28175      _this5.MYC = matrix[7];
28176      _this5.MZC = matrix[8];
28177
28178      if (XW < 0 || ZW < 0 || YW !== 1) {
28179        throw new _util.FormatError("Invalid WhitePoint components for ".concat(_this5.name) + ', no fallback available');
28180      }
28181
28182      if (XB < 0 || YB < 0 || ZB < 0) {
28183        (0, _util.info)("Invalid BlackPoint for ".concat(_this5.name, " [").concat(XB, ", ").concat(YB, ", ").concat(ZB, "], ") + 'falling back to default.');
28184        _this5.blackPoint = new Float32Array(3);
28185      }
28186
28187      if (_this5.GR < 0 || _this5.GG < 0 || _this5.GB < 0) {
28188        (0, _util.info)("Invalid Gamma [".concat(_this5.GR, ", ").concat(_this5.GG, ", ").concat(_this5.GB, "] for ") + "".concat(_this5.name, ", falling back to default."));
28189        _this5.GR = _this5.GG = _this5.GB = 1;
28190      }
28191
28192      return _this5;
28193    }
28194
28195    _createClass(CalRGBCS, [{
28196      key: "getRgbItem",
28197      value: function getRgbItem(src, srcOffset, dest, destOffset) {
28198        convertToRgb(this, src, srcOffset, dest, destOffset, 1);
28199      }
28200    }, {
28201      key: "getRgbBuffer",
28202      value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
28203        var scale = 1 / ((1 << bits) - 1);
28204
28205        for (var i = 0; i < count; ++i) {
28206          convertToRgb(this, src, srcOffset, dest, destOffset, scale);
28207          srcOffset += 3;
28208          destOffset += 3 + alpha01;
28209        }
28210      }
28211    }, {
28212      key: "getOutputLength",
28213      value: function getOutputLength(inputLength, alpha01) {
28214        return inputLength * (3 + alpha01) / 3 | 0;
28215      }
28216    }]);
28217
28218    return CalRGBCS;
28219  }(ColorSpace);
28220
28221  return CalRGBCS;
28222}();
28223
28224var LabCS = function LabCSClosure() {
28225  function fn_g(x) {
28226    var result;
28227
28228    if (x >= 6 / 29) {
28229      result = x * x * x;
28230    } else {
28231      result = 108 / 841 * (x - 4 / 29);
28232    }
28233
28234    return result;
28235  }
28236
28237  function decode(value, high1, low2, high2) {
28238    return low2 + value * (high2 - low2) / high1;
28239  }
28240
28241  function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
28242    var Ls = src[srcOffset];
28243    var as = src[srcOffset + 1];
28244    var bs = src[srcOffset + 2];
28245
28246    if (maxVal !== false) {
28247      Ls = decode(Ls, maxVal, 0, 100);
28248      as = decode(as, maxVal, cs.amin, cs.amax);
28249      bs = decode(bs, maxVal, cs.bmin, cs.bmax);
28250    }
28251
28252    as = as > cs.amax ? cs.amax : as < cs.amin ? cs.amin : as;
28253    bs = bs > cs.bmax ? cs.bmax : bs < cs.bmin ? cs.bmin : bs;
28254    var M = (Ls + 16) / 116;
28255    var L = M + as / 500;
28256    var N = M - bs / 200;
28257    var X = cs.XW * fn_g(L);
28258    var Y = cs.YW * fn_g(M);
28259    var Z = cs.ZW * fn_g(N);
28260    var r, g, b;
28261
28262    if (cs.ZW < 1) {
28263      r = X * 3.1339 + Y * -1.6170 + Z * -0.4906;
28264      g = X * -0.9785 + Y * 1.9160 + Z * 0.0333;
28265      b = X * 0.0720 + Y * -0.2290 + Z * 1.4057;
28266    } else {
28267      r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
28268      g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
28269      b = X * 0.0557 + Y * -0.2040 + Z * 1.0570;
28270    }
28271
28272    dest[destOffset] = Math.sqrt(r) * 255;
28273    dest[destOffset + 1] = Math.sqrt(g) * 255;
28274    dest[destOffset + 2] = Math.sqrt(b) * 255;
28275  }
28276
28277  var LabCS =
28278  /*#__PURE__*/
28279  function (_ColorSpace9) {
28280    _inherits(LabCS, _ColorSpace9);
28281
28282    function LabCS(whitePoint, blackPoint, range) {
28283      var _this6;
28284
28285      _classCallCheck(this, LabCS);
28286
28287      _this6 = _possibleConstructorReturn(this, _getPrototypeOf(LabCS).call(this, 'Lab', 3));
28288
28289      if (!whitePoint) {
28290        throw new _util.FormatError('WhitePoint missing - required for color space Lab');
28291      }
28292
28293      blackPoint = blackPoint || [0, 0, 0];
28294      range = range || [-100, 100, -100, 100];
28295      _this6.XW = whitePoint[0];
28296      _this6.YW = whitePoint[1];
28297      _this6.ZW = whitePoint[2];
28298      _this6.amin = range[0];
28299      _this6.amax = range[1];
28300      _this6.bmin = range[2];
28301      _this6.bmax = range[3];
28302      _this6.XB = blackPoint[0];
28303      _this6.YB = blackPoint[1];
28304      _this6.ZB = blackPoint[2];
28305
28306      if (_this6.XW < 0 || _this6.ZW < 0 || _this6.YW !== 1) {
28307        throw new _util.FormatError('Invalid WhitePoint components, no fallback available');
28308      }
28309
28310      if (_this6.XB < 0 || _this6.YB < 0 || _this6.ZB < 0) {
28311        (0, _util.info)('Invalid BlackPoint, falling back to default');
28312        _this6.XB = _this6.YB = _this6.ZB = 0;
28313      }
28314
28315      if (_this6.amin > _this6.amax || _this6.bmin > _this6.bmax) {
28316        (0, _util.info)('Invalid Range, falling back to defaults');
28317        _this6.amin = -100;
28318        _this6.amax = 100;
28319        _this6.bmin = -100;
28320        _this6.bmax = 100;
28321      }
28322
28323      return _this6;
28324    }
28325
28326    _createClass(LabCS, [{
28327      key: "getRgbItem",
28328      value: function getRgbItem(src, srcOffset, dest, destOffset) {
28329        convertToRgb(this, src, srcOffset, false, dest, destOffset);
28330      }
28331    }, {
28332      key: "getRgbBuffer",
28333      value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
28334        var maxVal = (1 << bits) - 1;
28335
28336        for (var i = 0; i < count; i++) {
28337          convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
28338          srcOffset += 3;
28339          destOffset += 3 + alpha01;
28340        }
28341      }
28342    }, {
28343      key: "getOutputLength",
28344      value: function getOutputLength(inputLength, alpha01) {
28345        return inputLength * (3 + alpha01) / 3 | 0;
28346      }
28347    }, {
28348      key: "isDefaultDecode",
28349      value: function isDefaultDecode(decodeMap, bpc) {
28350        return true;
28351      }
28352    }, {
28353      key: "usesZeroToOneRange",
28354      get: function get() {
28355        return (0, _util.shadow)(this, 'usesZeroToOneRange', false);
28356      }
28357    }]);
28358
28359    return LabCS;
28360  }(ColorSpace);
28361
28362  return LabCS;
28363}();
28364
28365/***/ }),
28366/* 170 */
28367/***/ (function(module, exports, __w_pdfjs_require__) {
28368
28369"use strict";
28370
28371
28372Object.defineProperty(exports, "__esModule", {
28373  value: true
28374});
28375exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0;
28376
28377var _util = __w_pdfjs_require__(5);
28378
28379var _obj = __w_pdfjs_require__(156);
28380
28381var _primitives = __w_pdfjs_require__(151);
28382
28383var _colorspace = __w_pdfjs_require__(169);
28384
28385var _core_utils = __w_pdfjs_require__(154);
28386
28387var _operator_list = __w_pdfjs_require__(171);
28388
28389var _stream = __w_pdfjs_require__(158);
28390
28391function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
28392
28393function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
28394
28395function _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); }
28396
28397function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
28398
28399function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
28400
28401function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
28402
28403function _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); }
28404
28405function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
28406
28407function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
28408
28409function _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); } }
28410
28411function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
28412
28413var AnnotationFactory =
28414/*#__PURE__*/
28415function () {
28416  function AnnotationFactory() {
28417    _classCallCheck(this, AnnotationFactory);
28418  }
28419
28420  _createClass(AnnotationFactory, null, [{
28421    key: "create",
28422    value: function create(xref, ref, pdfManager, idFactory) {
28423      return pdfManager.ensure(this, '_create', [xref, ref, pdfManager, idFactory]);
28424    }
28425  }, {
28426    key: "_create",
28427    value: function _create(xref, ref, pdfManager, idFactory) {
28428      var dict = xref.fetchIfRef(ref);
28429
28430      if (!(0, _primitives.isDict)(dict)) {
28431        return undefined;
28432      }
28433
28434      var id = (0, _primitives.isRef)(ref) ? ref.toString() : "annot_".concat(idFactory.createObjId());
28435      var subtype = dict.get('Subtype');
28436      subtype = (0, _primitives.isName)(subtype) ? subtype.name : null;
28437      var parameters = {
28438        xref: xref,
28439        dict: dict,
28440        subtype: subtype,
28441        id: id,
28442        pdfManager: pdfManager
28443      };
28444
28445      switch (subtype) {
28446        case 'Link':
28447          return new LinkAnnotation(parameters);
28448
28449        case 'Text':
28450          return new TextAnnotation(parameters);
28451
28452        case 'Widget':
28453          var fieldType = (0, _core_utils.getInheritableProperty)({
28454            dict: dict,
28455            key: 'FT'
28456          });
28457          fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
28458
28459          switch (fieldType) {
28460            case 'Tx':
28461              return new TextWidgetAnnotation(parameters);
28462
28463            case 'Btn':
28464              return new ButtonWidgetAnnotation(parameters);
28465
28466            case 'Ch':
28467              return new ChoiceWidgetAnnotation(parameters);
28468          }
28469
28470          (0, _util.warn)('Unimplemented widget field type "' + fieldType + '", ' + 'falling back to base field type.');
28471          return new WidgetAnnotation(parameters);
28472
28473        case 'Popup':
28474          return new PopupAnnotation(parameters);
28475
28476        case 'FreeText':
28477          return new FreeTextAnnotation(parameters);
28478
28479        case 'Line':
28480          return new LineAnnotation(parameters);
28481
28482        case 'Square':
28483          return new SquareAnnotation(parameters);
28484
28485        case 'Circle':
28486          return new CircleAnnotation(parameters);
28487
28488        case 'PolyLine':
28489          return new PolylineAnnotation(parameters);
28490
28491        case 'Polygon':
28492          return new PolygonAnnotation(parameters);
28493
28494        case 'Caret':
28495          return new CaretAnnotation(parameters);
28496
28497        case 'Ink':
28498          return new InkAnnotation(parameters);
28499
28500        case 'Highlight':
28501          return new HighlightAnnotation(parameters);
28502
28503        case 'Underline':
28504          return new UnderlineAnnotation(parameters);
28505
28506        case 'Squiggly':
28507          return new SquigglyAnnotation(parameters);
28508
28509        case 'StrikeOut':
28510          return new StrikeOutAnnotation(parameters);
28511
28512        case 'Stamp':
28513          return new StampAnnotation(parameters);
28514
28515        case 'FileAttachment':
28516          return new FileAttachmentAnnotation(parameters);
28517
28518        default:
28519          if (!subtype) {
28520            (0, _util.warn)('Annotation is missing the required /Subtype.');
28521          } else {
28522            (0, _util.warn)('Unimplemented annotation type "' + subtype + '", ' + 'falling back to base annotation.');
28523          }
28524
28525          return new Annotation(parameters);
28526      }
28527    }
28528  }]);
28529
28530  return AnnotationFactory;
28531}();
28532
28533exports.AnnotationFactory = AnnotationFactory;
28534
28535function getTransformMatrix(rect, bbox, matrix) {
28536  var bounds = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
28537
28538  var minX = bounds[0];
28539  var minY = bounds[1];
28540  var maxX = bounds[2];
28541  var maxY = bounds[3];
28542
28543  if (minX === maxX || minY === maxY) {
28544    return [1, 0, 0, 1, rect[0], rect[1]];
28545  }
28546
28547  var xRatio = (rect[2] - rect[0]) / (maxX - minX);
28548  var yRatio = (rect[3] - rect[1]) / (maxY - minY);
28549  return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
28550}
28551
28552var Annotation =
28553/*#__PURE__*/
28554function () {
28555  function Annotation(params) {
28556    _classCallCheck(this, Annotation);
28557
28558    var dict = params.dict;
28559    this.setContents(dict.get('Contents'));
28560    this.setModificationDate(dict.get('M'));
28561    this.setFlags(dict.get('F'));
28562    this.setRectangle(dict.getArray('Rect'));
28563    this.setColor(dict.getArray('C'));
28564    this.setBorderStyle(dict);
28565    this.setAppearance(dict);
28566    this.data = {
28567      annotationFlags: this.flags,
28568      borderStyle: this.borderStyle,
28569      color: this.color,
28570      contents: this.contents,
28571      hasAppearance: !!this.appearance,
28572      id: params.id,
28573      modificationDate: this.modificationDate,
28574      rect: this.rectangle,
28575      subtype: params.subtype
28576    };
28577  }
28578
28579  _createClass(Annotation, [{
28580    key: "_hasFlag",
28581    value: function _hasFlag(flags, flag) {
28582      return !!(flags & flag);
28583    }
28584  }, {
28585    key: "_isViewable",
28586    value: function _isViewable(flags) {
28587      return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.HIDDEN) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);
28588    }
28589  }, {
28590    key: "_isPrintable",
28591    value: function _isPrintable(flags) {
28592      return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.HIDDEN);
28593    }
28594  }, {
28595    key: "setContents",
28596    value: function setContents(contents) {
28597      this.contents = (0, _util.stringToPDFString)(contents || '');
28598    }
28599  }, {
28600    key: "setModificationDate",
28601    value: function setModificationDate(modificationDate) {
28602      this.modificationDate = (0, _util.isString)(modificationDate) ? modificationDate : null;
28603    }
28604  }, {
28605    key: "setFlags",
28606    value: function setFlags(flags) {
28607      this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
28608    }
28609  }, {
28610    key: "hasFlag",
28611    value: function hasFlag(flag) {
28612      return this._hasFlag(this.flags, flag);
28613    }
28614  }, {
28615    key: "setRectangle",
28616    value: function setRectangle(rectangle) {
28617      if (Array.isArray(rectangle) && rectangle.length === 4) {
28618        this.rectangle = _util.Util.normalizeRect(rectangle);
28619      } else {
28620        this.rectangle = [0, 0, 0, 0];
28621      }
28622    }
28623  }, {
28624    key: "setColor",
28625    value: function setColor(color) {
28626      var rgbColor = new Uint8ClampedArray(3);
28627
28628      if (!Array.isArray(color)) {
28629        this.color = rgbColor;
28630        return;
28631      }
28632
28633      switch (color.length) {
28634        case 0:
28635          this.color = null;
28636          break;
28637
28638        case 1:
28639          _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
28640
28641          this.color = rgbColor;
28642          break;
28643
28644        case 3:
28645          _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
28646
28647          this.color = rgbColor;
28648          break;
28649
28650        case 4:
28651          _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
28652
28653          this.color = rgbColor;
28654          break;
28655
28656        default:
28657          this.color = rgbColor;
28658          break;
28659      }
28660    }
28661  }, {
28662    key: "setBorderStyle",
28663    value: function setBorderStyle(borderStyle) {
28664      this.borderStyle = new AnnotationBorderStyle();
28665
28666      if (!(0, _primitives.isDict)(borderStyle)) {
28667        return;
28668      }
28669
28670      if (borderStyle.has('BS')) {
28671        var dict = borderStyle.get('BS');
28672        var dictType = dict.get('Type');
28673
28674        if (!dictType || (0, _primitives.isName)(dictType, 'Border')) {
28675          this.borderStyle.setWidth(dict.get('W'), this.rectangle);
28676          this.borderStyle.setStyle(dict.get('S'));
28677          this.borderStyle.setDashArray(dict.getArray('D'));
28678        }
28679      } else if (borderStyle.has('Border')) {
28680        var array = borderStyle.getArray('Border');
28681
28682        if (Array.isArray(array) && array.length >= 3) {
28683          this.borderStyle.setHorizontalCornerRadius(array[0]);
28684          this.borderStyle.setVerticalCornerRadius(array[1]);
28685          this.borderStyle.setWidth(array[2], this.rectangle);
28686
28687          if (array.length === 4) {
28688            this.borderStyle.setDashArray(array[3]);
28689          }
28690        }
28691      } else {
28692        this.borderStyle.setWidth(0);
28693      }
28694    }
28695  }, {
28696    key: "setAppearance",
28697    value: function setAppearance(dict) {
28698      this.appearance = null;
28699      var appearanceStates = dict.get('AP');
28700
28701      if (!(0, _primitives.isDict)(appearanceStates)) {
28702        return;
28703      }
28704
28705      var normalAppearanceState = appearanceStates.get('N');
28706
28707      if ((0, _primitives.isStream)(normalAppearanceState)) {
28708        this.appearance = normalAppearanceState;
28709        return;
28710      }
28711
28712      if (!(0, _primitives.isDict)(normalAppearanceState)) {
28713        return;
28714      }
28715
28716      var as = dict.get('AS');
28717
28718      if (!(0, _primitives.isName)(as) || !normalAppearanceState.has(as.name)) {
28719        return;
28720      }
28721
28722      this.appearance = normalAppearanceState.get(as.name);
28723    }
28724  }, {
28725    key: "loadResources",
28726    value: function loadResources(keys) {
28727      return this.appearance.dict.getAsync('Resources').then(function (resources) {
28728        if (!resources) {
28729          return undefined;
28730        }
28731
28732        var objectLoader = new _obj.ObjectLoader(resources, keys, resources.xref);
28733        return objectLoader.load().then(function () {
28734          return resources;
28735        });
28736      });
28737    }
28738  }, {
28739    key: "getOperatorList",
28740    value: function getOperatorList(evaluator, task, renderForms) {
28741      var _this = this;
28742
28743      if (!this.appearance) {
28744        return Promise.resolve(new _operator_list.OperatorList());
28745      }
28746
28747      var data = this.data;
28748      var appearanceDict = this.appearance.dict;
28749      var resourcesPromise = this.loadResources(['ExtGState', 'ColorSpace', 'Pattern', 'Shading', 'XObject', 'Font']);
28750      var bbox = appearanceDict.getArray('BBox') || [0, 0, 1, 1];
28751      var matrix = appearanceDict.getArray('Matrix') || [1, 0, 0, 1, 0, 0];
28752      var transform = getTransformMatrix(data.rect, bbox, matrix);
28753      return resourcesPromise.then(function (resources) {
28754        var opList = new _operator_list.OperatorList();
28755        opList.addOp(_util.OPS.beginAnnotation, [data.rect, transform, matrix]);
28756        return evaluator.getOperatorList({
28757          stream: _this.appearance,
28758          task: task,
28759          resources: resources,
28760          operatorList: opList
28761        }).then(function () {
28762          opList.addOp(_util.OPS.endAnnotation, []);
28763
28764          _this.appearance.reset();
28765
28766          return opList;
28767        });
28768      });
28769    }
28770  }, {
28771    key: "viewable",
28772    get: function get() {
28773      if (this.flags === 0) {
28774        return true;
28775      }
28776
28777      return this._isViewable(this.flags);
28778    }
28779  }, {
28780    key: "printable",
28781    get: function get() {
28782      if (this.flags === 0) {
28783        return false;
28784      }
28785
28786      return this._isPrintable(this.flags);
28787    }
28788  }]);
28789
28790  return Annotation;
28791}();
28792
28793exports.Annotation = Annotation;
28794
28795var AnnotationBorderStyle =
28796/*#__PURE__*/
28797function () {
28798  function AnnotationBorderStyle() {
28799    _classCallCheck(this, AnnotationBorderStyle);
28800
28801    this.width = 1;
28802    this.style = _util.AnnotationBorderStyleType.SOLID;
28803    this.dashArray = [3];
28804    this.horizontalCornerRadius = 0;
28805    this.verticalCornerRadius = 0;
28806  }
28807
28808  _createClass(AnnotationBorderStyle, [{
28809    key: "setWidth",
28810    value: function setWidth(width) {
28811      var rect = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0, 0];
28812
28813      if ((0, _primitives.isName)(width)) {
28814        this.width = 0;
28815        return;
28816      }
28817
28818      if (Number.isInteger(width)) {
28819        if (width > 0) {
28820          var maxWidth = (rect[2] - rect[0]) / 2;
28821          var maxHeight = (rect[3] - rect[1]) / 2;
28822
28823          if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {
28824            (0, _util.warn)("AnnotationBorderStyle.setWidth - ignoring width: ".concat(width));
28825            width = 1;
28826          }
28827        }
28828
28829        this.width = width;
28830      }
28831    }
28832  }, {
28833    key: "setStyle",
28834    value: function setStyle(style) {
28835      if (!(0, _primitives.isName)(style)) {
28836        return;
28837      }
28838
28839      switch (style.name) {
28840        case 'S':
28841          this.style = _util.AnnotationBorderStyleType.SOLID;
28842          break;
28843
28844        case 'D':
28845          this.style = _util.AnnotationBorderStyleType.DASHED;
28846          break;
28847
28848        case 'B':
28849          this.style = _util.AnnotationBorderStyleType.BEVELED;
28850          break;
28851
28852        case 'I':
28853          this.style = _util.AnnotationBorderStyleType.INSET;
28854          break;
28855
28856        case 'U':
28857          this.style = _util.AnnotationBorderStyleType.UNDERLINE;
28858          break;
28859
28860        default:
28861          break;
28862      }
28863    }
28864  }, {
28865    key: "setDashArray",
28866    value: function setDashArray(dashArray) {
28867      if (Array.isArray(dashArray) && dashArray.length > 0) {
28868        var isValid = true;
28869        var allZeros = true;
28870
28871        for (var i = 0, len = dashArray.length; i < len; i++) {
28872          var element = dashArray[i];
28873          var validNumber = +element >= 0;
28874
28875          if (!validNumber) {
28876            isValid = false;
28877            break;
28878          } else if (element > 0) {
28879            allZeros = false;
28880          }
28881        }
28882
28883        if (isValid && !allZeros) {
28884          this.dashArray = dashArray;
28885        } else {
28886          this.width = 0;
28887        }
28888      } else if (dashArray) {
28889        this.width = 0;
28890      }
28891    }
28892  }, {
28893    key: "setHorizontalCornerRadius",
28894    value: function setHorizontalCornerRadius(radius) {
28895      if (Number.isInteger(radius)) {
28896        this.horizontalCornerRadius = radius;
28897      }
28898    }
28899  }, {
28900    key: "setVerticalCornerRadius",
28901    value: function setVerticalCornerRadius(radius) {
28902      if (Number.isInteger(radius)) {
28903        this.verticalCornerRadius = radius;
28904      }
28905    }
28906  }]);
28907
28908  return AnnotationBorderStyle;
28909}();
28910
28911exports.AnnotationBorderStyle = AnnotationBorderStyle;
28912
28913var MarkupAnnotation =
28914/*#__PURE__*/
28915function (_Annotation) {
28916  _inherits(MarkupAnnotation, _Annotation);
28917
28918  function MarkupAnnotation(parameters) {
28919    var _this2;
28920
28921    _classCallCheck(this, MarkupAnnotation);
28922
28923    _this2 = _possibleConstructorReturn(this, _getPrototypeOf(MarkupAnnotation).call(this, parameters));
28924    var dict = parameters.dict;
28925
28926    if (!dict.has('C')) {
28927      _this2.data.color = null;
28928    }
28929
28930    _this2.setCreationDate(dict.get('CreationDate'));
28931
28932    _this2.data.creationDate = _this2.creationDate;
28933    _this2.data.hasPopup = dict.has('Popup');
28934    _this2.data.title = (0, _util.stringToPDFString)(dict.get('T') || '');
28935    return _this2;
28936  }
28937
28938  _createClass(MarkupAnnotation, [{
28939    key: "setCreationDate",
28940    value: function setCreationDate(creationDate) {
28941      this.creationDate = (0, _util.isString)(creationDate) ? creationDate : null;
28942    }
28943  }]);
28944
28945  return MarkupAnnotation;
28946}(Annotation);
28947
28948exports.MarkupAnnotation = MarkupAnnotation;
28949
28950var WidgetAnnotation =
28951/*#__PURE__*/
28952function (_Annotation2) {
28953  _inherits(WidgetAnnotation, _Annotation2);
28954
28955  function WidgetAnnotation(params) {
28956    var _this3;
28957
28958    _classCallCheck(this, WidgetAnnotation);
28959
28960    _this3 = _possibleConstructorReturn(this, _getPrototypeOf(WidgetAnnotation).call(this, params));
28961    var dict = params.dict;
28962    var data = _this3.data;
28963    data.annotationType = _util.AnnotationType.WIDGET;
28964    data.fieldName = _this3._constructFieldName(dict);
28965    data.fieldValue = (0, _core_utils.getInheritableProperty)({
28966      dict: dict,
28967      key: 'V',
28968      getArray: true
28969    });
28970    data.alternativeText = (0, _util.stringToPDFString)(dict.get('TU') || '');
28971    data.defaultAppearance = (0, _core_utils.getInheritableProperty)({
28972      dict: dict,
28973      key: 'DA'
28974    }) || '';
28975    var fieldType = (0, _core_utils.getInheritableProperty)({
28976      dict: dict,
28977      key: 'FT'
28978    });
28979    data.fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
28980    _this3.fieldResources = (0, _core_utils.getInheritableProperty)({
28981      dict: dict,
28982      key: 'DR'
28983    }) || _primitives.Dict.empty;
28984    data.fieldFlags = (0, _core_utils.getInheritableProperty)({
28985      dict: dict,
28986      key: 'Ff'
28987    });
28988
28989    if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
28990      data.fieldFlags = 0;
28991    }
28992
28993    data.readOnly = _this3.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
28994
28995    if (data.fieldType === 'Sig') {
28996      data.fieldValue = null;
28997
28998      _this3.setFlags(_util.AnnotationFlag.HIDDEN);
28999    }
29000
29001    return _this3;
29002  }
29003
29004  _createClass(WidgetAnnotation, [{
29005    key: "_constructFieldName",
29006    value: function _constructFieldName(dict) {
29007      if (!dict.has('T') && !dict.has('Parent')) {
29008        (0, _util.warn)('Unknown field name, falling back to empty field name.');
29009        return '';
29010      }
29011
29012      if (!dict.has('Parent')) {
29013        return (0, _util.stringToPDFString)(dict.get('T'));
29014      }
29015
29016      var fieldName = [];
29017
29018      if (dict.has('T')) {
29019        fieldName.unshift((0, _util.stringToPDFString)(dict.get('T')));
29020      }
29021
29022      var loopDict = dict;
29023
29024      while (loopDict.has('Parent')) {
29025        loopDict = loopDict.get('Parent');
29026
29027        if (!(0, _primitives.isDict)(loopDict)) {
29028          break;
29029        }
29030
29031        if (loopDict.has('T')) {
29032          fieldName.unshift((0, _util.stringToPDFString)(loopDict.get('T')));
29033        }
29034      }
29035
29036      return fieldName.join('.');
29037    }
29038  }, {
29039    key: "hasFieldFlag",
29040    value: function hasFieldFlag(flag) {
29041      return !!(this.data.fieldFlags & flag);
29042    }
29043  }, {
29044    key: "getOperatorList",
29045    value: function getOperatorList(evaluator, task, renderForms) {
29046      if (renderForms) {
29047        return Promise.resolve(new _operator_list.OperatorList());
29048      }
29049
29050      return _get(_getPrototypeOf(WidgetAnnotation.prototype), "getOperatorList", this).call(this, evaluator, task, renderForms);
29051    }
29052  }]);
29053
29054  return WidgetAnnotation;
29055}(Annotation);
29056
29057var TextWidgetAnnotation =
29058/*#__PURE__*/
29059function (_WidgetAnnotation) {
29060  _inherits(TextWidgetAnnotation, _WidgetAnnotation);
29061
29062  function TextWidgetAnnotation(params) {
29063    var _this4;
29064
29065    _classCallCheck(this, TextWidgetAnnotation);
29066
29067    _this4 = _possibleConstructorReturn(this, _getPrototypeOf(TextWidgetAnnotation).call(this, params));
29068    var dict = params.dict;
29069    _this4.data.fieldValue = (0, _util.stringToPDFString)(_this4.data.fieldValue || '');
29070    var alignment = (0, _core_utils.getInheritableProperty)({
29071      dict: dict,
29072      key: 'Q'
29073    });
29074
29075    if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {
29076      alignment = null;
29077    }
29078
29079    _this4.data.textAlignment = alignment;
29080    var maximumLength = (0, _core_utils.getInheritableProperty)({
29081      dict: dict,
29082      key: 'MaxLen'
29083    });
29084
29085    if (!Number.isInteger(maximumLength) || maximumLength < 0) {
29086      maximumLength = null;
29087    }
29088
29089    _this4.data.maxLen = maximumLength;
29090    _this4.data.multiLine = _this4.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
29091    _this4.data.comb = _this4.hasFieldFlag(_util.AnnotationFieldFlag.COMB) && !_this4.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE) && !_this4.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD) && !_this4.hasFieldFlag(_util.AnnotationFieldFlag.FILESELECT) && _this4.data.maxLen !== null;
29092    return _this4;
29093  }
29094
29095  _createClass(TextWidgetAnnotation, [{
29096    key: "getOperatorList",
29097    value: function getOperatorList(evaluator, task, renderForms) {
29098      if (renderForms || this.appearance) {
29099        return _get(_getPrototypeOf(TextWidgetAnnotation.prototype), "getOperatorList", this).call(this, evaluator, task, renderForms);
29100      }
29101
29102      var operatorList = new _operator_list.OperatorList();
29103
29104      if (!this.data.defaultAppearance) {
29105        return Promise.resolve(operatorList);
29106      }
29107
29108      var stream = new _stream.Stream((0, _util.stringToBytes)(this.data.defaultAppearance));
29109      return evaluator.getOperatorList({
29110        stream: stream,
29111        task: task,
29112        resources: this.fieldResources,
29113        operatorList: operatorList
29114      }).then(function () {
29115        return operatorList;
29116      });
29117    }
29118  }]);
29119
29120  return TextWidgetAnnotation;
29121}(WidgetAnnotation);
29122
29123var ButtonWidgetAnnotation =
29124/*#__PURE__*/
29125function (_WidgetAnnotation2) {
29126  _inherits(ButtonWidgetAnnotation, _WidgetAnnotation2);
29127
29128  function ButtonWidgetAnnotation(params) {
29129    var _this5;
29130
29131    _classCallCheck(this, ButtonWidgetAnnotation);
29132
29133    _this5 = _possibleConstructorReturn(this, _getPrototypeOf(ButtonWidgetAnnotation).call(this, params));
29134    _this5.data.checkBox = !_this5.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !_this5.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
29135    _this5.data.radioButton = _this5.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !_this5.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
29136    _this5.data.pushButton = _this5.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
29137
29138    if (_this5.data.checkBox) {
29139      _this5._processCheckBox(params);
29140    } else if (_this5.data.radioButton) {
29141      _this5._processRadioButton(params);
29142    } else if (_this5.data.pushButton) {
29143      _this5._processPushButton(params);
29144    } else {
29145      (0, _util.warn)('Invalid field flags for button widget annotation');
29146    }
29147
29148    return _this5;
29149  }
29150
29151  _createClass(ButtonWidgetAnnotation, [{
29152    key: "_processCheckBox",
29153    value: function _processCheckBox(params) {
29154      if ((0, _primitives.isName)(this.data.fieldValue)) {
29155        this.data.fieldValue = this.data.fieldValue.name;
29156      }
29157
29158      var customAppearance = params.dict.get('AP');
29159
29160      if (!(0, _primitives.isDict)(customAppearance)) {
29161        return;
29162      }
29163
29164      var exportValueOptionsDict = customAppearance.get('D');
29165
29166      if (!(0, _primitives.isDict)(exportValueOptionsDict)) {
29167        return;
29168      }
29169
29170      var exportValues = exportValueOptionsDict.getKeys();
29171      var hasCorrectOptionCount = exportValues.length === 2;
29172
29173      if (!hasCorrectOptionCount) {
29174        return;
29175      }
29176
29177      this.data.exportValue = exportValues[0] === 'Off' ? exportValues[1] : exportValues[0];
29178    }
29179  }, {
29180    key: "_processRadioButton",
29181    value: function _processRadioButton(params) {
29182      this.data.fieldValue = this.data.buttonValue = null;
29183      var fieldParent = params.dict.get('Parent');
29184
29185      if ((0, _primitives.isDict)(fieldParent) && fieldParent.has('V')) {
29186        var fieldParentValue = fieldParent.get('V');
29187
29188        if ((0, _primitives.isName)(fieldParentValue)) {
29189          this.data.fieldValue = fieldParentValue.name;
29190        }
29191      }
29192
29193      var appearanceStates = params.dict.get('AP');
29194
29195      if (!(0, _primitives.isDict)(appearanceStates)) {
29196        return;
29197      }
29198
29199      var normalAppearanceState = appearanceStates.get('N');
29200
29201      if (!(0, _primitives.isDict)(normalAppearanceState)) {
29202        return;
29203      }
29204
29205      var keys = normalAppearanceState.getKeys();
29206
29207      for (var i = 0, ii = keys.length; i < ii; i++) {
29208        if (keys[i] !== 'Off') {
29209          this.data.buttonValue = keys[i];
29210          break;
29211        }
29212      }
29213    }
29214  }, {
29215    key: "_processPushButton",
29216    value: function _processPushButton(params) {
29217      if (!params.dict.has('A')) {
29218        (0, _util.warn)('Push buttons without action dictionaries are not supported');
29219        return;
29220      }
29221
29222      _obj.Catalog.parseDestDictionary({
29223        destDict: params.dict,
29224        resultObj: this.data,
29225        docBaseUrl: params.pdfManager.docBaseUrl
29226      });
29227    }
29228  }]);
29229
29230  return ButtonWidgetAnnotation;
29231}(WidgetAnnotation);
29232
29233var ChoiceWidgetAnnotation =
29234/*#__PURE__*/
29235function (_WidgetAnnotation3) {
29236  _inherits(ChoiceWidgetAnnotation, _WidgetAnnotation3);
29237
29238  function ChoiceWidgetAnnotation(params) {
29239    var _this6;
29240
29241    _classCallCheck(this, ChoiceWidgetAnnotation);
29242
29243    _this6 = _possibleConstructorReturn(this, _getPrototypeOf(ChoiceWidgetAnnotation).call(this, params));
29244    _this6.data.options = [];
29245    var options = (0, _core_utils.getInheritableProperty)({
29246      dict: params.dict,
29247      key: 'Opt'
29248    });
29249
29250    if (Array.isArray(options)) {
29251      var xref = params.xref;
29252
29253      for (var i = 0, ii = options.length; i < ii; i++) {
29254        var option = xref.fetchIfRef(options[i]);
29255        var isOptionArray = Array.isArray(option);
29256        _this6.data.options[i] = {
29257          exportValue: isOptionArray ? xref.fetchIfRef(option[0]) : option,
29258          displayValue: (0, _util.stringToPDFString)(isOptionArray ? xref.fetchIfRef(option[1]) : option)
29259        };
29260      }
29261    }
29262
29263    if (!Array.isArray(_this6.data.fieldValue)) {
29264      _this6.data.fieldValue = [_this6.data.fieldValue];
29265    }
29266
29267    _this6.data.combo = _this6.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
29268    _this6.data.multiSelect = _this6.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
29269    return _this6;
29270  }
29271
29272  return ChoiceWidgetAnnotation;
29273}(WidgetAnnotation);
29274
29275var TextAnnotation =
29276/*#__PURE__*/
29277function (_MarkupAnnotation) {
29278  _inherits(TextAnnotation, _MarkupAnnotation);
29279
29280  function TextAnnotation(parameters) {
29281    var _this7;
29282
29283    _classCallCheck(this, TextAnnotation);
29284
29285    var DEFAULT_ICON_SIZE = 22;
29286    _this7 = _possibleConstructorReturn(this, _getPrototypeOf(TextAnnotation).call(this, parameters));
29287    _this7.data.annotationType = _util.AnnotationType.TEXT;
29288
29289    if (_this7.data.hasAppearance) {
29290      _this7.data.name = 'NoIcon';
29291    } else {
29292      _this7.data.rect[1] = _this7.data.rect[3] - DEFAULT_ICON_SIZE;
29293      _this7.data.rect[2] = _this7.data.rect[0] + DEFAULT_ICON_SIZE;
29294      _this7.data.name = parameters.dict.has('Name') ? parameters.dict.get('Name').name : 'Note';
29295    }
29296
29297    return _this7;
29298  }
29299
29300  return TextAnnotation;
29301}(MarkupAnnotation);
29302
29303var LinkAnnotation =
29304/*#__PURE__*/
29305function (_Annotation3) {
29306  _inherits(LinkAnnotation, _Annotation3);
29307
29308  function LinkAnnotation(params) {
29309    var _this8;
29310
29311    _classCallCheck(this, LinkAnnotation);
29312
29313    _this8 = _possibleConstructorReturn(this, _getPrototypeOf(LinkAnnotation).call(this, params));
29314    _this8.data.annotationType = _util.AnnotationType.LINK;
29315
29316    _obj.Catalog.parseDestDictionary({
29317      destDict: params.dict,
29318      resultObj: _this8.data,
29319      docBaseUrl: params.pdfManager.docBaseUrl
29320    });
29321
29322    return _this8;
29323  }
29324
29325  return LinkAnnotation;
29326}(Annotation);
29327
29328var PopupAnnotation =
29329/*#__PURE__*/
29330function (_Annotation4) {
29331  _inherits(PopupAnnotation, _Annotation4);
29332
29333  function PopupAnnotation(parameters) {
29334    var _this9;
29335
29336    _classCallCheck(this, PopupAnnotation);
29337
29338    _this9 = _possibleConstructorReturn(this, _getPrototypeOf(PopupAnnotation).call(this, parameters));
29339    _this9.data.annotationType = _util.AnnotationType.POPUP;
29340    var dict = parameters.dict;
29341    var parentItem = dict.get('Parent');
29342
29343    if (!parentItem) {
29344      (0, _util.warn)('Popup annotation has a missing or invalid parent annotation.');
29345      return _possibleConstructorReturn(_this9);
29346    }
29347
29348    var parentSubtype = parentItem.get('Subtype');
29349    _this9.data.parentType = (0, _primitives.isName)(parentSubtype) ? parentSubtype.name : null;
29350    _this9.data.parentId = dict.getRaw('Parent').toString();
29351    _this9.data.title = (0, _util.stringToPDFString)(parentItem.get('T') || '');
29352    _this9.data.contents = (0, _util.stringToPDFString)(parentItem.get('Contents') || '');
29353
29354    if (!parentItem.has('M')) {
29355      _this9.data.modificationDate = null;
29356    } else {
29357      _this9.setModificationDate(parentItem.get('M'));
29358
29359      _this9.data.modificationDate = _this9.modificationDate;
29360    }
29361
29362    if (!parentItem.has('C')) {
29363      _this9.data.color = null;
29364    } else {
29365      _this9.setColor(parentItem.getArray('C'));
29366
29367      _this9.data.color = _this9.color;
29368    }
29369
29370    if (!_this9.viewable) {
29371      var parentFlags = parentItem.get('F');
29372
29373      if (_this9._isViewable(parentFlags)) {
29374        _this9.setFlags(parentFlags);
29375      }
29376    }
29377
29378    return _this9;
29379  }
29380
29381  return PopupAnnotation;
29382}(Annotation);
29383
29384var FreeTextAnnotation =
29385/*#__PURE__*/
29386function (_MarkupAnnotation2) {
29387  _inherits(FreeTextAnnotation, _MarkupAnnotation2);
29388
29389  function FreeTextAnnotation(parameters) {
29390    var _this10;
29391
29392    _classCallCheck(this, FreeTextAnnotation);
29393
29394    _this10 = _possibleConstructorReturn(this, _getPrototypeOf(FreeTextAnnotation).call(this, parameters));
29395    _this10.data.annotationType = _util.AnnotationType.FREETEXT;
29396    return _this10;
29397  }
29398
29399  return FreeTextAnnotation;
29400}(MarkupAnnotation);
29401
29402var LineAnnotation =
29403/*#__PURE__*/
29404function (_MarkupAnnotation3) {
29405  _inherits(LineAnnotation, _MarkupAnnotation3);
29406
29407  function LineAnnotation(parameters) {
29408    var _this11;
29409
29410    _classCallCheck(this, LineAnnotation);
29411
29412    _this11 = _possibleConstructorReturn(this, _getPrototypeOf(LineAnnotation).call(this, parameters));
29413    _this11.data.annotationType = _util.AnnotationType.LINE;
29414    var dict = parameters.dict;
29415    _this11.data.lineCoordinates = _util.Util.normalizeRect(dict.getArray('L'));
29416    return _this11;
29417  }
29418
29419  return LineAnnotation;
29420}(MarkupAnnotation);
29421
29422var SquareAnnotation =
29423/*#__PURE__*/
29424function (_MarkupAnnotation4) {
29425  _inherits(SquareAnnotation, _MarkupAnnotation4);
29426
29427  function SquareAnnotation(parameters) {
29428    var _this12;
29429
29430    _classCallCheck(this, SquareAnnotation);
29431
29432    _this12 = _possibleConstructorReturn(this, _getPrototypeOf(SquareAnnotation).call(this, parameters));
29433    _this12.data.annotationType = _util.AnnotationType.SQUARE;
29434    return _this12;
29435  }
29436
29437  return SquareAnnotation;
29438}(MarkupAnnotation);
29439
29440var CircleAnnotation =
29441/*#__PURE__*/
29442function (_MarkupAnnotation5) {
29443  _inherits(CircleAnnotation, _MarkupAnnotation5);
29444
29445  function CircleAnnotation(parameters) {
29446    var _this13;
29447
29448    _classCallCheck(this, CircleAnnotation);
29449
29450    _this13 = _possibleConstructorReturn(this, _getPrototypeOf(CircleAnnotation).call(this, parameters));
29451    _this13.data.annotationType = _util.AnnotationType.CIRCLE;
29452    return _this13;
29453  }
29454
29455  return CircleAnnotation;
29456}(MarkupAnnotation);
29457
29458var PolylineAnnotation =
29459/*#__PURE__*/
29460function (_MarkupAnnotation6) {
29461  _inherits(PolylineAnnotation, _MarkupAnnotation6);
29462
29463  function PolylineAnnotation(parameters) {
29464    var _this14;
29465
29466    _classCallCheck(this, PolylineAnnotation);
29467
29468    _this14 = _possibleConstructorReturn(this, _getPrototypeOf(PolylineAnnotation).call(this, parameters));
29469    _this14.data.annotationType = _util.AnnotationType.POLYLINE;
29470    var dict = parameters.dict;
29471    var rawVertices = dict.getArray('Vertices');
29472    _this14.data.vertices = [];
29473
29474    for (var i = 0, ii = rawVertices.length; i < ii; i += 2) {
29475      _this14.data.vertices.push({
29476        x: rawVertices[i],
29477        y: rawVertices[i + 1]
29478      });
29479    }
29480
29481    return _this14;
29482  }
29483
29484  return PolylineAnnotation;
29485}(MarkupAnnotation);
29486
29487var PolygonAnnotation =
29488/*#__PURE__*/
29489function (_PolylineAnnotation) {
29490  _inherits(PolygonAnnotation, _PolylineAnnotation);
29491
29492  function PolygonAnnotation(parameters) {
29493    var _this15;
29494
29495    _classCallCheck(this, PolygonAnnotation);
29496
29497    _this15 = _possibleConstructorReturn(this, _getPrototypeOf(PolygonAnnotation).call(this, parameters));
29498    _this15.data.annotationType = _util.AnnotationType.POLYGON;
29499    return _this15;
29500  }
29501
29502  return PolygonAnnotation;
29503}(PolylineAnnotation);
29504
29505var CaretAnnotation =
29506/*#__PURE__*/
29507function (_MarkupAnnotation7) {
29508  _inherits(CaretAnnotation, _MarkupAnnotation7);
29509
29510  function CaretAnnotation(parameters) {
29511    var _this16;
29512
29513    _classCallCheck(this, CaretAnnotation);
29514
29515    _this16 = _possibleConstructorReturn(this, _getPrototypeOf(CaretAnnotation).call(this, parameters));
29516    _this16.data.annotationType = _util.AnnotationType.CARET;
29517    return _this16;
29518  }
29519
29520  return CaretAnnotation;
29521}(MarkupAnnotation);
29522
29523var InkAnnotation =
29524/*#__PURE__*/
29525function (_MarkupAnnotation8) {
29526  _inherits(InkAnnotation, _MarkupAnnotation8);
29527
29528  function InkAnnotation(parameters) {
29529    var _this17;
29530
29531    _classCallCheck(this, InkAnnotation);
29532
29533    _this17 = _possibleConstructorReturn(this, _getPrototypeOf(InkAnnotation).call(this, parameters));
29534    _this17.data.annotationType = _util.AnnotationType.INK;
29535    var dict = parameters.dict;
29536    var xref = parameters.xref;
29537    var originalInkLists = dict.getArray('InkList');
29538    _this17.data.inkLists = [];
29539
29540    for (var i = 0, ii = originalInkLists.length; i < ii; ++i) {
29541      _this17.data.inkLists.push([]);
29542
29543      for (var j = 0, jj = originalInkLists[i].length; j < jj; j += 2) {
29544        _this17.data.inkLists[i].push({
29545          x: xref.fetchIfRef(originalInkLists[i][j]),
29546          y: xref.fetchIfRef(originalInkLists[i][j + 1])
29547        });
29548      }
29549    }
29550
29551    return _this17;
29552  }
29553
29554  return InkAnnotation;
29555}(MarkupAnnotation);
29556
29557var HighlightAnnotation =
29558/*#__PURE__*/
29559function (_MarkupAnnotation9) {
29560  _inherits(HighlightAnnotation, _MarkupAnnotation9);
29561
29562  function HighlightAnnotation(parameters) {
29563    var _this18;
29564
29565    _classCallCheck(this, HighlightAnnotation);
29566
29567    _this18 = _possibleConstructorReturn(this, _getPrototypeOf(HighlightAnnotation).call(this, parameters));
29568    _this18.data.annotationType = _util.AnnotationType.HIGHLIGHT;
29569    return _this18;
29570  }
29571
29572  return HighlightAnnotation;
29573}(MarkupAnnotation);
29574
29575var UnderlineAnnotation =
29576/*#__PURE__*/
29577function (_MarkupAnnotation10) {
29578  _inherits(UnderlineAnnotation, _MarkupAnnotation10);
29579
29580  function UnderlineAnnotation(parameters) {
29581    var _this19;
29582
29583    _classCallCheck(this, UnderlineAnnotation);
29584
29585    _this19 = _possibleConstructorReturn(this, _getPrototypeOf(UnderlineAnnotation).call(this, parameters));
29586    _this19.data.annotationType = _util.AnnotationType.UNDERLINE;
29587    return _this19;
29588  }
29589
29590  return UnderlineAnnotation;
29591}(MarkupAnnotation);
29592
29593var SquigglyAnnotation =
29594/*#__PURE__*/
29595function (_MarkupAnnotation11) {
29596  _inherits(SquigglyAnnotation, _MarkupAnnotation11);
29597
29598  function SquigglyAnnotation(parameters) {
29599    var _this20;
29600
29601    _classCallCheck(this, SquigglyAnnotation);
29602
29603    _this20 = _possibleConstructorReturn(this, _getPrototypeOf(SquigglyAnnotation).call(this, parameters));
29604    _this20.data.annotationType = _util.AnnotationType.SQUIGGLY;
29605    return _this20;
29606  }
29607
29608  return SquigglyAnnotation;
29609}(MarkupAnnotation);
29610
29611var StrikeOutAnnotation =
29612/*#__PURE__*/
29613function (_MarkupAnnotation12) {
29614  _inherits(StrikeOutAnnotation, _MarkupAnnotation12);
29615
29616  function StrikeOutAnnotation(parameters) {
29617    var _this21;
29618
29619    _classCallCheck(this, StrikeOutAnnotation);
29620
29621    _this21 = _possibleConstructorReturn(this, _getPrototypeOf(StrikeOutAnnotation).call(this, parameters));
29622    _this21.data.annotationType = _util.AnnotationType.STRIKEOUT;
29623    return _this21;
29624  }
29625
29626  return StrikeOutAnnotation;
29627}(MarkupAnnotation);
29628
29629var StampAnnotation =
29630/*#__PURE__*/
29631function (_MarkupAnnotation13) {
29632  _inherits(StampAnnotation, _MarkupAnnotation13);
29633
29634  function StampAnnotation(parameters) {
29635    var _this22;
29636
29637    _classCallCheck(this, StampAnnotation);
29638
29639    _this22 = _possibleConstructorReturn(this, _getPrototypeOf(StampAnnotation).call(this, parameters));
29640    _this22.data.annotationType = _util.AnnotationType.STAMP;
29641    return _this22;
29642  }
29643
29644  return StampAnnotation;
29645}(MarkupAnnotation);
29646
29647var FileAttachmentAnnotation =
29648/*#__PURE__*/
29649function (_MarkupAnnotation14) {
29650  _inherits(FileAttachmentAnnotation, _MarkupAnnotation14);
29651
29652  function FileAttachmentAnnotation(parameters) {
29653    var _this23;
29654
29655    _classCallCheck(this, FileAttachmentAnnotation);
29656
29657    _this23 = _possibleConstructorReturn(this, _getPrototypeOf(FileAttachmentAnnotation).call(this, parameters));
29658    var file = new _obj.FileSpec(parameters.dict.get('FS'), parameters.xref);
29659    _this23.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
29660    _this23.data.file = file.serializable;
29661    return _this23;
29662  }
29663
29664  return FileAttachmentAnnotation;
29665}(MarkupAnnotation);
29666
29667/***/ }),
29668/* 171 */
29669/***/ (function(module, exports, __w_pdfjs_require__) {
29670
29671"use strict";
29672
29673
29674Object.defineProperty(exports, "__esModule", {
29675  value: true
29676});
29677exports.OperatorList = void 0;
29678
29679var _util = __w_pdfjs_require__(5);
29680
29681var QueueOptimizer = function QueueOptimizerClosure() {
29682  function addState(parentState, pattern, checkFn, iterateFn, processFn) {
29683    var state = parentState;
29684
29685    for (var i = 0, ii = pattern.length - 1; i < ii; i++) {
29686      var item = pattern[i];
29687      state = state[item] || (state[item] = []);
29688    }
29689
29690    state[pattern[pattern.length - 1]] = {
29691      checkFn: checkFn,
29692      iterateFn: iterateFn,
29693      processFn: processFn
29694    };
29695  }
29696
29697  function handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray) {
29698    var iFirstPIMXO = iFirstSave + 2;
29699
29700    for (var i = 0; i < count; i++) {
29701      var arg = argsArray[iFirstPIMXO + 4 * i];
29702      var imageMask = arg.length === 1 && arg[0];
29703
29704      if (imageMask && imageMask.width === 1 && imageMask.height === 1 && (!imageMask.data.length || imageMask.data.length === 1 && imageMask.data[0] === 0)) {
29705        fnArray[iFirstPIMXO + 4 * i] = _util.OPS.paintSolidColorImageMask;
29706        continue;
29707      }
29708
29709      break;
29710    }
29711
29712    return count - i;
29713  }
29714
29715  var InitialState = [];
29716  addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) {
29717    var fnArray = context.fnArray;
29718    var iFirstSave = context.iCurr - 3;
29719    var pos = (i - iFirstSave) % 4;
29720
29721    switch (pos) {
29722      case 0:
29723        return fnArray[i] === _util.OPS.save;
29724
29725      case 1:
29726        return fnArray[i] === _util.OPS.transform;
29727
29728      case 2:
29729        return fnArray[i] === _util.OPS.paintInlineImageXObject;
29730
29731      case 3:
29732        return fnArray[i] === _util.OPS.restore;
29733    }
29734
29735    throw new Error("iterateInlineImageGroup - invalid pos: ".concat(pos));
29736  }, function foundInlineImageGroup(context, i) {
29737    var MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
29738    var MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
29739    var MAX_WIDTH = 1000;
29740    var IMAGE_PADDING = 1;
29741    var fnArray = context.fnArray,
29742        argsArray = context.argsArray;
29743    var curr = context.iCurr;
29744    var iFirstSave = curr - 3;
29745    var iFirstTransform = curr - 2;
29746    var iFirstPIIXO = curr - 1;
29747    var count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
29748
29749    if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
29750      return i - (i - iFirstSave) % 4;
29751    }
29752
29753    var maxX = 0;
29754    var map = [],
29755        maxLineHeight = 0;
29756    var currentX = IMAGE_PADDING,
29757        currentY = IMAGE_PADDING;
29758    var q;
29759
29760    for (q = 0; q < count; q++) {
29761      var transform = argsArray[iFirstTransform + (q << 2)];
29762      var img = argsArray[iFirstPIIXO + (q << 2)][0];
29763
29764      if (currentX + img.width > MAX_WIDTH) {
29765        maxX = Math.max(maxX, currentX);
29766        currentY += maxLineHeight + 2 * IMAGE_PADDING;
29767        currentX = 0;
29768        maxLineHeight = 0;
29769      }
29770
29771      map.push({
29772        transform: transform,
29773        x: currentX,
29774        y: currentY,
29775        w: img.width,
29776        h: img.height
29777      });
29778      currentX += img.width + 2 * IMAGE_PADDING;
29779      maxLineHeight = Math.max(maxLineHeight, img.height);
29780    }
29781
29782    var imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
29783    var imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
29784    var imgData = new Uint8ClampedArray(imgWidth * imgHeight * 4);
29785    var imgRowSize = imgWidth << 2;
29786
29787    for (q = 0; q < count; q++) {
29788      var data = argsArray[iFirstPIIXO + (q << 2)][0].data;
29789      var rowSize = map[q].w << 2;
29790      var dataOffset = 0;
29791      var offset = map[q].x + map[q].y * imgWidth << 2;
29792      imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
29793
29794      for (var k = 0, kk = map[q].h; k < kk; k++) {
29795        imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
29796        dataOffset += rowSize;
29797        offset += imgRowSize;
29798      }
29799
29800      imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
29801
29802      while (offset >= 0) {
29803        data[offset - 4] = data[offset];
29804        data[offset - 3] = data[offset + 1];
29805        data[offset - 2] = data[offset + 2];
29806        data[offset - 1] = data[offset + 3];
29807        data[offset + rowSize] = data[offset + rowSize - 4];
29808        data[offset + rowSize + 1] = data[offset + rowSize - 3];
29809        data[offset + rowSize + 2] = data[offset + rowSize - 2];
29810        data[offset + rowSize + 3] = data[offset + rowSize - 1];
29811        offset -= imgRowSize;
29812      }
29813    }
29814
29815    fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup);
29816    argsArray.splice(iFirstSave, count * 4, [{
29817      width: imgWidth,
29818      height: imgHeight,
29819      kind: _util.ImageKind.RGBA_32BPP,
29820      data: imgData
29821    }, map]);
29822    return iFirstSave + 1;
29823  });
29824  addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) {
29825    var fnArray = context.fnArray;
29826    var iFirstSave = context.iCurr - 3;
29827    var pos = (i - iFirstSave) % 4;
29828
29829    switch (pos) {
29830      case 0:
29831        return fnArray[i] === _util.OPS.save;
29832
29833      case 1:
29834        return fnArray[i] === _util.OPS.transform;
29835
29836      case 2:
29837        return fnArray[i] === _util.OPS.paintImageMaskXObject;
29838
29839      case 3:
29840        return fnArray[i] === _util.OPS.restore;
29841    }
29842
29843    throw new Error("iterateImageMaskGroup - invalid pos: ".concat(pos));
29844  }, function foundImageMaskGroup(context, i) {
29845    var MIN_IMAGES_IN_MASKS_BLOCK = 10;
29846    var MAX_IMAGES_IN_MASKS_BLOCK = 100;
29847    var MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
29848    var fnArray = context.fnArray,
29849        argsArray = context.argsArray;
29850    var curr = context.iCurr;
29851    var iFirstSave = curr - 3;
29852    var iFirstTransform = curr - 2;
29853    var iFirstPIMXO = curr - 1;
29854    var count = Math.floor((i - iFirstSave) / 4);
29855    count = handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray);
29856
29857    if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
29858      return i - (i - iFirstSave) % 4;
29859    }
29860
29861    var q;
29862    var isSameImage = false;
29863    var iTransform, transformArgs;
29864    var firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
29865
29866    if (argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0) {
29867      isSameImage = true;
29868      var firstTransformArg0 = argsArray[iFirstTransform][0];
29869      var firstTransformArg3 = argsArray[iFirstTransform][3];
29870      iTransform = iFirstTransform + 4;
29871      var iPIMXO = iFirstPIMXO + 4;
29872
29873      for (q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
29874        transformArgs = argsArray[iTransform];
29875
29876        if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== 0 || transformArgs[2] !== 0 || transformArgs[3] !== firstTransformArg3) {
29877          if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
29878            isSameImage = false;
29879          } else {
29880            count = q;
29881          }
29882
29883          break;
29884        }
29885      }
29886    }
29887
29888    if (isSameImage) {
29889      count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
29890      var positions = new Float32Array(count * 2);
29891      iTransform = iFirstTransform;
29892
29893      for (q = 0; q < count; q++, iTransform += 4) {
29894        transformArgs = argsArray[iTransform];
29895        positions[q << 1] = transformArgs[4];
29896        positions[(q << 1) + 1] = transformArgs[5];
29897      }
29898
29899      fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat);
29900      argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg3, positions]);
29901    } else {
29902      count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
29903      var images = [];
29904
29905      for (q = 0; q < count; q++) {
29906        transformArgs = argsArray[iFirstTransform + (q << 2)];
29907        var maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
29908        images.push({
29909          data: maskParams.data,
29910          width: maskParams.width,
29911          height: maskParams.height,
29912          transform: transformArgs
29913        });
29914      }
29915
29916      fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup);
29917      argsArray.splice(iFirstSave, count * 4, [images]);
29918    }
29919
29920    return iFirstSave + 1;
29921  });
29922  addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) {
29923    var argsArray = context.argsArray;
29924    var iFirstTransform = context.iCurr - 2;
29925    return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0;
29926  }, function iterateImageGroup(context, i) {
29927    var fnArray = context.fnArray,
29928        argsArray = context.argsArray;
29929    var iFirstSave = context.iCurr - 3;
29930    var pos = (i - iFirstSave) % 4;
29931
29932    switch (pos) {
29933      case 0:
29934        return fnArray[i] === _util.OPS.save;
29935
29936      case 1:
29937        if (fnArray[i] !== _util.OPS.transform) {
29938          return false;
29939        }
29940
29941        var iFirstTransform = context.iCurr - 2;
29942        var firstTransformArg0 = argsArray[iFirstTransform][0];
29943        var firstTransformArg3 = argsArray[iFirstTransform][3];
29944
29945        if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) {
29946          return false;
29947        }
29948
29949        return true;
29950
29951      case 2:
29952        if (fnArray[i] !== _util.OPS.paintImageXObject) {
29953          return false;
29954        }
29955
29956        var iFirstPIXO = context.iCurr - 1;
29957        var firstPIXOArg0 = argsArray[iFirstPIXO][0];
29958
29959        if (argsArray[i][0] !== firstPIXOArg0) {
29960          return false;
29961        }
29962
29963        return true;
29964
29965      case 3:
29966        return fnArray[i] === _util.OPS.restore;
29967    }
29968
29969    throw new Error("iterateImageGroup - invalid pos: ".concat(pos));
29970  }, function (context, i) {
29971    var MIN_IMAGES_IN_BLOCK = 3;
29972    var MAX_IMAGES_IN_BLOCK = 1000;
29973    var fnArray = context.fnArray,
29974        argsArray = context.argsArray;
29975    var curr = context.iCurr;
29976    var iFirstSave = curr - 3;
29977    var iFirstTransform = curr - 2;
29978    var iFirstPIXO = curr - 1;
29979    var firstPIXOArg0 = argsArray[iFirstPIXO][0];
29980    var firstTransformArg0 = argsArray[iFirstTransform][0];
29981    var firstTransformArg3 = argsArray[iFirstTransform][3];
29982    var count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK);
29983
29984    if (count < MIN_IMAGES_IN_BLOCK) {
29985      return i - (i - iFirstSave) % 4;
29986    }
29987
29988    var positions = new Float32Array(count * 2);
29989    var iTransform = iFirstTransform;
29990
29991    for (var q = 0; q < count; q++, iTransform += 4) {
29992      var transformArgs = argsArray[iTransform];
29993      positions[q << 1] = transformArgs[4];
29994      positions[(q << 1) + 1] = transformArgs[5];
29995    }
29996
29997    var args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions];
29998    fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat);
29999    argsArray.splice(iFirstSave, count * 4, args);
30000    return iFirstSave + 1;
30001  });
30002  addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) {
30003    var fnArray = context.fnArray,
30004        argsArray = context.argsArray;
30005    var iFirstSave = context.iCurr - 4;
30006    var pos = (i - iFirstSave) % 5;
30007
30008    switch (pos) {
30009      case 0:
30010        return fnArray[i] === _util.OPS.beginText;
30011
30012      case 1:
30013        return fnArray[i] === _util.OPS.setFont;
30014
30015      case 2:
30016        return fnArray[i] === _util.OPS.setTextMatrix;
30017
30018      case 3:
30019        if (fnArray[i] !== _util.OPS.showText) {
30020          return false;
30021        }
30022
30023        var iFirstSetFont = context.iCurr - 3;
30024        var firstSetFontArg0 = argsArray[iFirstSetFont][0];
30025        var firstSetFontArg1 = argsArray[iFirstSetFont][1];
30026
30027        if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) {
30028          return false;
30029        }
30030
30031        return true;
30032
30033      case 4:
30034        return fnArray[i] === _util.OPS.endText;
30035    }
30036
30037    throw new Error("iterateShowTextGroup - invalid pos: ".concat(pos));
30038  }, function (context, i) {
30039    var MIN_CHARS_IN_BLOCK = 3;
30040    var MAX_CHARS_IN_BLOCK = 1000;
30041    var fnArray = context.fnArray,
30042        argsArray = context.argsArray;
30043    var curr = context.iCurr;
30044    var iFirstBeginText = curr - 4;
30045    var iFirstSetFont = curr - 3;
30046    var iFirstSetTextMatrix = curr - 2;
30047    var iFirstShowText = curr - 1;
30048    var iFirstEndText = curr;
30049    var firstSetFontArg0 = argsArray[iFirstSetFont][0];
30050    var firstSetFontArg1 = argsArray[iFirstSetFont][1];
30051    var count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK);
30052
30053    if (count < MIN_CHARS_IN_BLOCK) {
30054      return i - (i - iFirstBeginText) % 5;
30055    }
30056
30057    var iFirst = iFirstBeginText;
30058
30059    if (iFirstBeginText >= 4 && fnArray[iFirstBeginText - 4] === fnArray[iFirstSetFont] && fnArray[iFirstBeginText - 3] === fnArray[iFirstSetTextMatrix] && fnArray[iFirstBeginText - 2] === fnArray[iFirstShowText] && fnArray[iFirstBeginText - 1] === fnArray[iFirstEndText] && argsArray[iFirstBeginText - 4][0] === firstSetFontArg0 && argsArray[iFirstBeginText - 4][1] === firstSetFontArg1) {
30060      count++;
30061      iFirst -= 5;
30062    }
30063
30064    var iEndText = iFirst + 4;
30065
30066    for (var q = 1; q < count; q++) {
30067      fnArray.splice(iEndText, 3);
30068      argsArray.splice(iEndText, 3);
30069      iEndText += 2;
30070    }
30071
30072    return iEndText + 1;
30073  });
30074
30075  function QueueOptimizer(queue) {
30076    this.queue = queue;
30077    this.state = null;
30078    this.context = {
30079      iCurr: 0,
30080      fnArray: queue.fnArray,
30081      argsArray: queue.argsArray
30082    };
30083    this.match = null;
30084    this.lastProcessed = 0;
30085  }
30086
30087  QueueOptimizer.prototype = {
30088    _optimize: function _optimize() {
30089      var fnArray = this.queue.fnArray;
30090      var i = this.lastProcessed,
30091          ii = fnArray.length;
30092      var state = this.state;
30093      var match = this.match;
30094
30095      if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {
30096        this.lastProcessed = ii;
30097        return;
30098      }
30099
30100      var context = this.context;
30101
30102      while (i < ii) {
30103        if (match) {
30104          var iterate = (0, match.iterateFn)(context, i);
30105
30106          if (iterate) {
30107            i++;
30108            continue;
30109          }
30110
30111          i = (0, match.processFn)(context, i + 1);
30112          ii = fnArray.length;
30113          match = null;
30114          state = null;
30115
30116          if (i >= ii) {
30117            break;
30118          }
30119        }
30120
30121        state = (state || InitialState)[fnArray[i]];
30122
30123        if (!state || Array.isArray(state)) {
30124          i++;
30125          continue;
30126        }
30127
30128        context.iCurr = i;
30129        i++;
30130
30131        if (state.checkFn && !(0, state.checkFn)(context)) {
30132          state = null;
30133          continue;
30134        }
30135
30136        match = state;
30137        state = null;
30138      }
30139
30140      this.state = state;
30141      this.match = match;
30142      this.lastProcessed = i;
30143    },
30144    push: function push(fn, args) {
30145      this.queue.fnArray.push(fn);
30146      this.queue.argsArray.push(args);
30147
30148      this._optimize();
30149    },
30150    flush: function flush() {
30151      while (this.match) {
30152        var length = this.queue.fnArray.length;
30153        this.lastProcessed = (0, this.match.processFn)(this.context, length);
30154        this.match = null;
30155        this.state = null;
30156
30157        this._optimize();
30158      }
30159    },
30160    reset: function reset() {
30161      this.state = null;
30162      this.match = null;
30163      this.lastProcessed = 0;
30164    }
30165  };
30166  return QueueOptimizer;
30167}();
30168
30169var NullOptimizer = function NullOptimizerClosure() {
30170  function NullOptimizer(queue) {
30171    this.queue = queue;
30172  }
30173
30174  NullOptimizer.prototype = {
30175    push: function push(fn, args) {
30176      this.queue.fnArray.push(fn);
30177      this.queue.argsArray.push(args);
30178    },
30179    flush: function flush() {},
30180    reset: function reset() {}
30181  };
30182  return NullOptimizer;
30183}();
30184
30185var OperatorList = function OperatorListClosure() {
30186  var CHUNK_SIZE = 1000;
30187  var CHUNK_SIZE_ABOUT = CHUNK_SIZE - 5;
30188
30189  function OperatorList(intent, messageHandler, pageIndex) {
30190    this.messageHandler = messageHandler;
30191    this.fnArray = [];
30192    this.argsArray = [];
30193
30194    if (messageHandler && intent !== 'oplist') {
30195      this.optimizer = new QueueOptimizer(this);
30196    } else {
30197      this.optimizer = new NullOptimizer(this);
30198    }
30199
30200    this.dependencies = Object.create(null);
30201    this._totalLength = 0;
30202    this.pageIndex = pageIndex;
30203    this.intent = intent;
30204    this.weight = 0;
30205  }
30206
30207  OperatorList.prototype = {
30208    get length() {
30209      return this.argsArray.length;
30210    },
30211
30212    get totalLength() {
30213      return this._totalLength + this.length;
30214    },
30215
30216    addOp: function addOp(fn, args) {
30217      this.optimizer.push(fn, args);
30218      this.weight++;
30219
30220      if (this.messageHandler) {
30221        if (this.weight >= CHUNK_SIZE) {
30222          this.flush();
30223        } else if (this.weight >= CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) {
30224          this.flush();
30225        }
30226      }
30227    },
30228    addDependency: function addDependency(dependency) {
30229      if (dependency in this.dependencies) {
30230        return;
30231      }
30232
30233      this.dependencies[dependency] = true;
30234      this.addOp(_util.OPS.dependency, [dependency]);
30235    },
30236    addDependencies: function addDependencies(dependencies) {
30237      for (var key in dependencies) {
30238        this.addDependency(key);
30239      }
30240    },
30241    addOpList: function addOpList(opList) {
30242      Object.assign(this.dependencies, opList.dependencies);
30243
30244      for (var i = 0, ii = opList.length; i < ii; i++) {
30245        this.addOp(opList.fnArray[i], opList.argsArray[i]);
30246      }
30247    },
30248    getIR: function getIR() {
30249      return {
30250        fnArray: this.fnArray,
30251        argsArray: this.argsArray,
30252        length: this.length
30253      };
30254    },
30255
30256    get _transfers() {
30257      var transfers = [];
30258      var fnArray = this.fnArray,
30259          argsArray = this.argsArray,
30260          length = this.length;
30261
30262      for (var i = 0; i < length; i++) {
30263        switch (fnArray[i]) {
30264          case _util.OPS.paintInlineImageXObject:
30265          case _util.OPS.paintInlineImageXObjectGroup:
30266          case _util.OPS.paintImageMaskXObject:
30267            var arg = argsArray[i][0];
30268            ;
30269
30270            if (!arg.cached) {
30271              transfers.push(arg.data.buffer);
30272            }
30273
30274            break;
30275        }
30276      }
30277
30278      return transfers;
30279    },
30280
30281    flush: function flush() {
30282      var lastChunk = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
30283      this.optimizer.flush();
30284      var length = this.length;
30285      this._totalLength += length;
30286      this.messageHandler.send('RenderPageChunk', {
30287        operatorList: {
30288          fnArray: this.fnArray,
30289          argsArray: this.argsArray,
30290          lastChunk: lastChunk,
30291          length: length
30292        },
30293        pageIndex: this.pageIndex,
30294        intent: this.intent
30295      }, this._transfers);
30296      this.dependencies = Object.create(null);
30297      this.fnArray.length = 0;
30298      this.argsArray.length = 0;
30299      this.weight = 0;
30300      this.optimizer.reset();
30301    }
30302  };
30303  return OperatorList;
30304}();
30305
30306exports.OperatorList = OperatorList;
30307
30308/***/ }),
30309/* 172 */
30310/***/ (function(module, exports, __w_pdfjs_require__) {
30311
30312"use strict";
30313
30314
30315Object.defineProperty(exports, "__esModule", {
30316  value: true
30317});
30318exports.PartialEvaluator = void 0;
30319
30320var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2));
30321
30322var _util = __w_pdfjs_require__(5);
30323
30324var _cmap = __w_pdfjs_require__(173);
30325
30326var _primitives = __w_pdfjs_require__(151);
30327
30328var _fonts = __w_pdfjs_require__(174);
30329
30330var _encodings = __w_pdfjs_require__(177);
30331
30332var _unicode = __w_pdfjs_require__(180);
30333
30334var _standard_fonts = __w_pdfjs_require__(179);
30335
30336var _pattern = __w_pdfjs_require__(183);
30337
30338var _parser = __w_pdfjs_require__(157);
30339
30340var _bidi = __w_pdfjs_require__(184);
30341
30342var _colorspace = __w_pdfjs_require__(169);
30343
30344var _stream = __w_pdfjs_require__(158);
30345
30346var _glyphlist = __w_pdfjs_require__(178);
30347
30348var _core_utils = __w_pdfjs_require__(154);
30349
30350var _metrics = __w_pdfjs_require__(185);
30351
30352var _function = __w_pdfjs_require__(186);
30353
30354var _jpeg_stream = __w_pdfjs_require__(164);
30355
30356var _murmurhash = __w_pdfjs_require__(188);
30357
30358var _image_utils = __w_pdfjs_require__(189);
30359
30360var _operator_list = __w_pdfjs_require__(171);
30361
30362var _image = __w_pdfjs_require__(190);
30363
30364function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
30365
30366function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
30367
30368function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
30369
30370var PartialEvaluator = function PartialEvaluatorClosure() {
30371  var DefaultPartialEvaluatorOptions = {
30372    forceDataSchema: false,
30373    maxImageSize: -1,
30374    disableFontFace: false,
30375    nativeImageDecoderSupport: _util.NativeImageDecoding.DECODE,
30376    ignoreErrors: false,
30377    isEvalSupported: true
30378  };
30379
30380  function PartialEvaluator(_ref) {
30381    var _this = this;
30382
30383    var xref = _ref.xref,
30384        handler = _ref.handler,
30385        pageIndex = _ref.pageIndex,
30386        idFactory = _ref.idFactory,
30387        fontCache = _ref.fontCache,
30388        builtInCMapCache = _ref.builtInCMapCache,
30389        _ref$options = _ref.options,
30390        options = _ref$options === void 0 ? null : _ref$options,
30391        pdfFunctionFactory = _ref.pdfFunctionFactory;
30392    this.xref = xref;
30393    this.handler = handler;
30394    this.pageIndex = pageIndex;
30395    this.idFactory = idFactory;
30396    this.fontCache = fontCache;
30397    this.builtInCMapCache = builtInCMapCache;
30398    this.options = options || DefaultPartialEvaluatorOptions;
30399    this.pdfFunctionFactory = pdfFunctionFactory;
30400    this.parsingType3Font = false;
30401
30402    this.fetchBuiltInCMap =
30403    /*#__PURE__*/
30404    function () {
30405      var _ref2 = _asyncToGenerator(
30406      /*#__PURE__*/
30407      _regenerator["default"].mark(function _callee(name) {
30408        var data;
30409        return _regenerator["default"].wrap(function _callee$(_context) {
30410          while (1) {
30411            switch (_context.prev = _context.next) {
30412              case 0:
30413                if (!_this.builtInCMapCache.has(name)) {
30414                  _context.next = 2;
30415                  break;
30416                }
30417
30418                return _context.abrupt("return", _this.builtInCMapCache.get(name));
30419
30420              case 2:
30421                _context.next = 4;
30422                return _this.handler.sendWithPromise('FetchBuiltInCMap', {
30423                  name: name
30424                });
30425
30426              case 4:
30427                data = _context.sent;
30428
30429                if (data.compressionType !== _util.CMapCompressionType.NONE) {
30430                  _this.builtInCMapCache.set(name, data);
30431                }
30432
30433                return _context.abrupt("return", data);
30434
30435              case 7:
30436              case "end":
30437                return _context.stop();
30438            }
30439          }
30440        }, _callee);
30441      }));
30442
30443      return function (_x) {
30444        return _ref2.apply(this, arguments);
30445      };
30446    }();
30447  }
30448
30449  var TIME_SLOT_DURATION_MS = 20;
30450  var CHECK_TIME_EVERY = 100;
30451
30452  function TimeSlotManager() {
30453    this.reset();
30454  }
30455
30456  TimeSlotManager.prototype = {
30457    check: function TimeSlotManager_check() {
30458      if (++this.checked < CHECK_TIME_EVERY) {
30459        return false;
30460      }
30461
30462      this.checked = 0;
30463      return this.endTime <= Date.now();
30464    },
30465    reset: function TimeSlotManager_reset() {
30466      this.endTime = Date.now() + TIME_SLOT_DURATION_MS;
30467      this.checked = 0;
30468    }
30469  };
30470
30471  function normalizeBlendMode(value) {
30472    if (!(0, _primitives.isName)(value)) {
30473      return 'source-over';
30474    }
30475
30476    switch (value.name) {
30477      case 'Normal':
30478      case 'Compatible':
30479        return 'source-over';
30480
30481      case 'Multiply':
30482        return 'multiply';
30483
30484      case 'Screen':
30485        return 'screen';
30486
30487      case 'Overlay':
30488        return 'overlay';
30489
30490      case 'Darken':
30491        return 'darken';
30492
30493      case 'Lighten':
30494        return 'lighten';
30495
30496      case 'ColorDodge':
30497        return 'color-dodge';
30498
30499      case 'ColorBurn':
30500        return 'color-burn';
30501
30502      case 'HardLight':
30503        return 'hard-light';
30504
30505      case 'SoftLight':
30506        return 'soft-light';
30507
30508      case 'Difference':
30509        return 'difference';
30510
30511      case 'Exclusion':
30512        return 'exclusion';
30513
30514      case 'Hue':
30515        return 'hue';
30516
30517      case 'Saturation':
30518        return 'saturation';
30519
30520      case 'Color':
30521        return 'color';
30522
30523      case 'Luminosity':
30524        return 'luminosity';
30525    }
30526
30527    (0, _util.warn)('Unsupported blend mode: ' + value.name);
30528    return 'source-over';
30529  }
30530
30531  var deferred = Promise.resolve();
30532  var TILING_PATTERN = 1,
30533      SHADING_PATTERN = 2;
30534  PartialEvaluator.prototype = {
30535    clone: function clone() {
30536      var newOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DefaultPartialEvaluatorOptions;
30537      var newEvaluator = Object.create(this);
30538      newEvaluator.options = newOptions;
30539      return newEvaluator;
30540    },
30541    hasBlendModes: function PartialEvaluator_hasBlendModes(resources) {
30542      if (!(0, _primitives.isDict)(resources)) {
30543        return false;
30544      }
30545
30546      var processed = Object.create(null);
30547
30548      if (resources.objId) {
30549        processed[resources.objId] = true;
30550      }
30551
30552      var nodes = [resources],
30553          xref = this.xref;
30554
30555      while (nodes.length) {
30556        var key, i, ii;
30557        var node = nodes.shift();
30558        var graphicStates = node.get('ExtGState');
30559
30560        if ((0, _primitives.isDict)(graphicStates)) {
30561          var graphicStatesKeys = graphicStates.getKeys();
30562
30563          for (i = 0, ii = graphicStatesKeys.length; i < ii; i++) {
30564            key = graphicStatesKeys[i];
30565            var graphicState = graphicStates.get(key);
30566            var bm = graphicState.get('BM');
30567
30568            if ((0, _primitives.isName)(bm) && bm.name !== 'Normal') {
30569              return true;
30570            }
30571          }
30572        }
30573
30574        var xObjects = node.get('XObject');
30575
30576        if (!(0, _primitives.isDict)(xObjects)) {
30577          continue;
30578        }
30579
30580        var xObjectsKeys = xObjects.getKeys();
30581
30582        for (i = 0, ii = xObjectsKeys.length; i < ii; i++) {
30583          key = xObjectsKeys[i];
30584          var xObject = xObjects.getRaw(key);
30585
30586          if ((0, _primitives.isRef)(xObject)) {
30587            if (processed[xObject.toString()]) {
30588              continue;
30589            }
30590
30591            xObject = xref.fetch(xObject);
30592          }
30593
30594          if (!(0, _primitives.isStream)(xObject)) {
30595            continue;
30596          }
30597
30598          if (xObject.dict.objId) {
30599            if (processed[xObject.dict.objId]) {
30600              continue;
30601            }
30602
30603            processed[xObject.dict.objId] = true;
30604          }
30605
30606          var xResources = xObject.dict.get('Resources');
30607
30608          if ((0, _primitives.isDict)(xResources) && (!xResources.objId || !processed[xResources.objId])) {
30609            nodes.push(xResources);
30610
30611            if (xResources.objId) {
30612              processed[xResources.objId] = true;
30613            }
30614          }
30615        }
30616      }
30617
30618      return false;
30619    },
30620    buildFormXObject: function PartialEvaluator_buildFormXObject(resources, xobj, smask, operatorList, task, initialState) {
30621      var dict = xobj.dict;
30622      var matrix = dict.getArray('Matrix');
30623      var bbox = dict.getArray('BBox');
30624
30625      if (Array.isArray(bbox) && bbox.length === 4) {
30626        bbox = _util.Util.normalizeRect(bbox);
30627      } else {
30628        bbox = null;
30629      }
30630
30631      var group = dict.get('Group');
30632
30633      if (group) {
30634        var groupOptions = {
30635          matrix: matrix,
30636          bbox: bbox,
30637          smask: smask,
30638          isolated: false,
30639          knockout: false
30640        };
30641        var groupSubtype = group.get('S');
30642        var colorSpace = null;
30643
30644        if ((0, _primitives.isName)(groupSubtype, 'Transparency')) {
30645          groupOptions.isolated = group.get('I') || false;
30646          groupOptions.knockout = group.get('K') || false;
30647
30648          if (group.has('CS')) {
30649            colorSpace = _colorspace.ColorSpace.parse(group.get('CS'), this.xref, resources, this.pdfFunctionFactory);
30650          }
30651        }
30652
30653        if (smask && smask.backdrop) {
30654          colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb;
30655          smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
30656        }
30657
30658        operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);
30659      }
30660
30661      operatorList.addOp(_util.OPS.paintFormXObjectBegin, [matrix, bbox]);
30662      return this.getOperatorList({
30663        stream: xobj,
30664        task: task,
30665        resources: dict.get('Resources') || resources,
30666        operatorList: operatorList,
30667        initialState: initialState
30668      }).then(function () {
30669        operatorList.addOp(_util.OPS.paintFormXObjectEnd, []);
30670
30671        if (group) {
30672          operatorList.addOp(_util.OPS.endGroup, [groupOptions]);
30673        }
30674      });
30675    },
30676    buildPaintImageXObject: function () {
30677      var _buildPaintImageXObject = _asyncToGenerator(
30678      /*#__PURE__*/
30679      _regenerator["default"].mark(function _callee2(_ref3) {
30680        var _this2 = this;
30681
30682        var resources, image, _ref3$isInline, isInline, operatorList, cacheKey, imageCache, _ref3$forceDisableNat, forceDisableNativeImageDecoder, dict, w, h, maxImageSize, imageMask, imgData, args, width, height, bitStrideLength, imgArray, decode, softMask, mask, SMALL_IMAGE_DIMENSIONS, imageObj, nativeImageDecoderSupport, objId, nativeImageDecoder, imgPromise;
30683
30684        return _regenerator["default"].wrap(function _callee2$(_context2) {
30685          while (1) {
30686            switch (_context2.prev = _context2.next) {
30687              case 0:
30688                resources = _ref3.resources, image = _ref3.image, _ref3$isInline = _ref3.isInline, isInline = _ref3$isInline === void 0 ? false : _ref3$isInline, operatorList = _ref3.operatorList, cacheKey = _ref3.cacheKey, imageCache = _ref3.imageCache, _ref3$forceDisableNat = _ref3.forceDisableNativeImageDecoder, forceDisableNativeImageDecoder = _ref3$forceDisableNat === void 0 ? false : _ref3$forceDisableNat;
30689                dict = image.dict;
30690                w = dict.get('Width', 'W');
30691                h = dict.get('Height', 'H');
30692
30693                if (!(!(w && (0, _util.isNum)(w)) || !(h && (0, _util.isNum)(h)))) {
30694                  _context2.next = 7;
30695                  break;
30696                }
30697
30698                (0, _util.warn)('Image dimensions are missing, or not numbers.');
30699                return _context2.abrupt("return", undefined);
30700
30701              case 7:
30702                maxImageSize = this.options.maxImageSize;
30703
30704                if (!(maxImageSize !== -1 && w * h > maxImageSize)) {
30705                  _context2.next = 11;
30706                  break;
30707                }
30708
30709                (0, _util.warn)('Image exceeded maximum allowed size and was removed.');
30710                return _context2.abrupt("return", undefined);
30711
30712              case 11:
30713                imageMask = dict.get('ImageMask', 'IM') || false;
30714
30715                if (!imageMask) {
30716                  _context2.next = 24;
30717                  break;
30718                }
30719
30720                width = dict.get('Width', 'W');
30721                height = dict.get('Height', 'H');
30722                bitStrideLength = width + 7 >> 3;
30723                imgArray = image.getBytes(bitStrideLength * height, true);
30724                decode = dict.getArray('Decode', 'D');
30725                imgData = _image.PDFImage.createMask({
30726                  imgArray: imgArray,
30727                  width: width,
30728                  height: height,
30729                  imageIsFromDecodeStream: image instanceof _stream.DecodeStream,
30730                  inverseDecode: !!decode && decode[0] > 0
30731                });
30732                imgData.cached = !!cacheKey;
30733                args = [imgData];
30734                operatorList.addOp(_util.OPS.paintImageMaskXObject, args);
30735
30736                if (cacheKey) {
30737                  imageCache[cacheKey] = {
30738                    fn: _util.OPS.paintImageMaskXObject,
30739                    args: args
30740                  };
30741                }
30742
30743                return _context2.abrupt("return", undefined);
30744
30745              case 24:
30746                softMask = dict.get('SMask', 'SM') || false;
30747                mask = dict.get('Mask') || false;
30748                SMALL_IMAGE_DIMENSIONS = 200;
30749
30750                if (!(isInline && !softMask && !mask && !(image instanceof _jpeg_stream.JpegStream) && w + h < SMALL_IMAGE_DIMENSIONS)) {
30751                  _context2.next = 32;
30752                  break;
30753                }
30754
30755                imageObj = new _image.PDFImage({
30756                  xref: this.xref,
30757                  res: resources,
30758                  image: image,
30759                  isInline: isInline,
30760                  pdfFunctionFactory: this.pdfFunctionFactory
30761                });
30762                imgData = imageObj.createImageData(true);
30763                operatorList.addOp(_util.OPS.paintInlineImageXObject, [imgData]);
30764                return _context2.abrupt("return", undefined);
30765
30766              case 32:
30767                nativeImageDecoderSupport = forceDisableNativeImageDecoder ? _util.NativeImageDecoding.NONE : this.options.nativeImageDecoderSupport;
30768                objId = "img_".concat(this.idFactory.createObjId());
30769
30770                if (this.parsingType3Font) {
30771                  (0, _util.assert)(nativeImageDecoderSupport === _util.NativeImageDecoding.NONE, 'Type3 image resources should be completely decoded in the worker.');
30772                  objId = "".concat(this.idFactory.getDocId(), "_type3res_").concat(objId);
30773                }
30774
30775                if (!(nativeImageDecoderSupport !== _util.NativeImageDecoding.NONE && !softMask && !mask && image instanceof _jpeg_stream.JpegStream && _image_utils.NativeImageDecoder.isSupported(image, this.xref, resources, this.pdfFunctionFactory))) {
30776                  _context2.next = 37;
30777                  break;
30778                }
30779
30780                return _context2.abrupt("return", this.handler.sendWithPromise('obj', [objId, this.pageIndex, 'JpegStream', image.getIR(this.options.forceDataSchema)]).then(function () {
30781                  operatorList.addDependency(objId);
30782                  args = [objId, w, h];
30783                  operatorList.addOp(_util.OPS.paintJpegXObject, args);
30784
30785                  if (cacheKey) {
30786                    imageCache[cacheKey] = {
30787                      fn: _util.OPS.paintJpegXObject,
30788                      args: args
30789                    };
30790                  }
30791                }, function (reason) {
30792                  (0, _util.warn)('Native JPEG decoding failed -- trying to recover: ' + (reason && reason.message));
30793                  return _this2.buildPaintImageXObject({
30794                    resources: resources,
30795                    image: image,
30796                    isInline: isInline,
30797                    operatorList: operatorList,
30798                    cacheKey: cacheKey,
30799                    imageCache: imageCache,
30800                    forceDisableNativeImageDecoder: true
30801                  });
30802                }));
30803
30804              case 37:
30805                nativeImageDecoder = null;
30806
30807                if (nativeImageDecoderSupport === _util.NativeImageDecoding.DECODE && (image instanceof _jpeg_stream.JpegStream || mask instanceof _jpeg_stream.JpegStream || softMask instanceof _jpeg_stream.JpegStream)) {
30808                  nativeImageDecoder = new _image_utils.NativeImageDecoder({
30809                    xref: this.xref,
30810                    resources: resources,
30811                    handler: this.handler,
30812                    forceDataSchema: this.options.forceDataSchema,
30813                    pdfFunctionFactory: this.pdfFunctionFactory
30814                  });
30815                }
30816
30817                operatorList.addDependency(objId);
30818                args = [objId, w, h];
30819                imgPromise = _image.PDFImage.buildImage({
30820                  handler: this.handler,
30821                  xref: this.xref,
30822                  res: resources,
30823                  image: image,
30824                  isInline: isInline,
30825                  nativeDecoder: nativeImageDecoder,
30826                  pdfFunctionFactory: this.pdfFunctionFactory
30827                }).then(function (imageObj) {
30828                  var imgData = imageObj.createImageData(false);
30829
30830                  if (_this2.parsingType3Font) {
30831                    return _this2.handler.sendWithPromise('commonobj', [objId, 'FontType3Res', imgData], [imgData.data.buffer]);
30832                  }
30833
30834                  _this2.handler.send('obj', [objId, _this2.pageIndex, 'Image', imgData], [imgData.data.buffer]);
30835
30836                  return undefined;
30837                })["catch"](function (reason) {
30838                  (0, _util.warn)('Unable to decode image: ' + reason);
30839
30840                  if (_this2.parsingType3Font) {
30841                    return _this2.handler.sendWithPromise('commonobj', [objId, 'FontType3Res', null]);
30842                  }
30843
30844                  _this2.handler.send('obj', [objId, _this2.pageIndex, 'Image', null]);
30845
30846                  return undefined;
30847                });
30848
30849                if (!this.parsingType3Font) {
30850                  _context2.next = 45;
30851                  break;
30852                }
30853
30854                _context2.next = 45;
30855                return imgPromise;
30856
30857              case 45:
30858                operatorList.addOp(_util.OPS.paintImageXObject, args);
30859
30860                if (cacheKey) {
30861                  imageCache[cacheKey] = {
30862                    fn: _util.OPS.paintImageXObject,
30863                    args: args
30864                  };
30865                }
30866
30867                return _context2.abrupt("return", undefined);
30868
30869              case 48:
30870              case "end":
30871                return _context2.stop();
30872            }
30873          }
30874        }, _callee2, this);
30875      }));
30876
30877      function buildPaintImageXObject(_x2) {
30878        return _buildPaintImageXObject.apply(this, arguments);
30879      }
30880
30881      return buildPaintImageXObject;
30882    }(),
30883    handleSMask: function PartialEvaluator_handleSmask(smask, resources, operatorList, task, stateManager) {
30884      var smaskContent = smask.get('G');
30885      var smaskOptions = {
30886        subtype: smask.get('S').name,
30887        backdrop: smask.get('BC')
30888      };
30889      var transferObj = smask.get('TR');
30890
30891      if ((0, _function.isPDFFunction)(transferObj)) {
30892        var transferFn = this.pdfFunctionFactory.create(transferObj);
30893        var transferMap = new Uint8Array(256);
30894        var tmp = new Float32Array(1);
30895
30896        for (var i = 0; i < 256; i++) {
30897          tmp[0] = i / 255;
30898          transferFn(tmp, 0, tmp, 0);
30899          transferMap[i] = tmp[0] * 255 | 0;
30900        }
30901
30902        smaskOptions.transferMap = transferMap;
30903      }
30904
30905      return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone());
30906    },
30907    handleTilingType: function handleTilingType(fn, args, resources, pattern, patternDict, operatorList, task) {
30908      var _this3 = this;
30909
30910      var tilingOpList = new _operator_list.OperatorList();
30911      var resourcesArray = [patternDict.get('Resources'), resources];
30912
30913      var patternResources = _primitives.Dict.merge(this.xref, resourcesArray);
30914
30915      return this.getOperatorList({
30916        stream: pattern,
30917        task: task,
30918        resources: patternResources,
30919        operatorList: tilingOpList
30920      }).then(function () {
30921        return (0, _pattern.getTilingPatternIR)({
30922          fnArray: tilingOpList.fnArray,
30923          argsArray: tilingOpList.argsArray
30924        }, patternDict, args);
30925      }).then(function (tilingPatternIR) {
30926        operatorList.addDependencies(tilingOpList.dependencies);
30927        operatorList.addOp(fn, tilingPatternIR);
30928      }, function (reason) {
30929        if (_this3.options.ignoreErrors) {
30930          _this3.handler.send('UnsupportedFeature', {
30931            featureId: _util.UNSUPPORTED_FEATURES.unknown
30932          });
30933
30934          (0, _util.warn)("handleTilingType - ignoring pattern: \"".concat(reason, "\"."));
30935          return;
30936        }
30937
30938        throw reason;
30939      });
30940    },
30941    handleSetFont: function PartialEvaluator_handleSetFont(resources, fontArgs, fontRef, operatorList, task, state) {
30942      var _this4 = this;
30943
30944      var fontName;
30945
30946      if (fontArgs) {
30947        fontArgs = fontArgs.slice();
30948        fontName = fontArgs[0].name;
30949      }
30950
30951      return this.loadFont(fontName, fontRef, resources).then(function (translated) {
30952        if (!translated.font.isType3Font) {
30953          return translated;
30954        }
30955
30956        return translated.loadType3Data(_this4, resources, operatorList, task).then(function () {
30957          return translated;
30958        })["catch"](function (reason) {
30959          _this4.handler.send('UnsupportedFeature', {
30960            featureId: _util.UNSUPPORTED_FEATURES.font
30961          });
30962
30963          return new TranslatedFont('g_font_error', new _fonts.ErrorFont('Type3 font load error: ' + reason), translated.font);
30964        });
30965      }).then(function (translated) {
30966        state.font = translated.font;
30967        translated.send(_this4.handler);
30968        return translated.loadedName;
30969      });
30970    },
30971    handleText: function handleText(chars, state) {
30972      var font = state.font;
30973      var glyphs = font.charsToGlyphs(chars);
30974
30975      if (font.data) {
30976        var isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
30977
30978        if (isAddToPathSet || state.fillColorSpace.name === 'Pattern' || font.disableFontFace || this.options.disableFontFace) {
30979          PartialEvaluator.buildFontPaths(font, glyphs, this.handler);
30980        }
30981      }
30982
30983      return glyphs;
30984    },
30985    setGState: function PartialEvaluator_setGState(resources, gState, operatorList, task, stateManager) {
30986      var _this5 = this;
30987
30988      var gStateObj = [];
30989      var gStateKeys = gState.getKeys();
30990      var promise = Promise.resolve();
30991
30992      var _loop = function _loop() {
30993        var key = gStateKeys[i];
30994        var value = gState.get(key);
30995
30996        switch (key) {
30997          case 'Type':
30998            break;
30999
31000          case 'LW':
31001          case 'LC':
31002          case 'LJ':
31003          case 'ML':
31004          case 'D':
31005          case 'RI':
31006          case 'FL':
31007          case 'CA':
31008          case 'ca':
31009            gStateObj.push([key, value]);
31010            break;
31011
31012          case 'Font':
31013            promise = promise.then(function () {
31014              return _this5.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
31015                operatorList.addDependency(loadedName);
31016                gStateObj.push([key, [loadedName, value[1]]]);
31017              });
31018            });
31019            break;
31020
31021          case 'BM':
31022            gStateObj.push([key, normalizeBlendMode(value)]);
31023            break;
31024
31025          case 'SMask':
31026            if ((0, _primitives.isName)(value, 'None')) {
31027              gStateObj.push([key, false]);
31028              break;
31029            }
31030
31031            if ((0, _primitives.isDict)(value)) {
31032              promise = promise.then(function () {
31033                return _this5.handleSMask(value, resources, operatorList, task, stateManager);
31034              });
31035              gStateObj.push([key, true]);
31036            } else {
31037              (0, _util.warn)('Unsupported SMask type');
31038            }
31039
31040            break;
31041
31042          case 'OP':
31043          case 'op':
31044          case 'OPM':
31045          case 'BG':
31046          case 'BG2':
31047          case 'UCR':
31048          case 'UCR2':
31049          case 'TR':
31050          case 'TR2':
31051          case 'HT':
31052          case 'SM':
31053          case 'SA':
31054          case 'AIS':
31055          case 'TK':
31056            (0, _util.info)('graphic state operator ' + key);
31057            break;
31058
31059          default:
31060            (0, _util.info)('Unknown graphic state operator ' + key);
31061            break;
31062        }
31063      };
31064
31065      for (var i = 0, ii = gStateKeys.length; i < ii; i++) {
31066        _loop();
31067      }
31068
31069      return promise.then(function () {
31070        if (gStateObj.length > 0) {
31071          operatorList.addOp(_util.OPS.setGState, [gStateObj]);
31072        }
31073      });
31074    },
31075    loadFont: function PartialEvaluator_loadFont(fontName, font, resources) {
31076      var _this6 = this;
31077
31078      function errorFont() {
31079        return Promise.resolve(new TranslatedFont('g_font_error', new _fonts.ErrorFont('Font ' + fontName + ' is not available'), font));
31080      }
31081
31082      var fontRef,
31083          xref = this.xref;
31084
31085      if (font) {
31086        if (!(0, _primitives.isRef)(font)) {
31087          throw new Error('The "font" object should be a reference.');
31088        }
31089
31090        fontRef = font;
31091      } else {
31092        var fontRes = resources.get('Font');
31093
31094        if (fontRes) {
31095          fontRef = fontRes.getRaw(fontName);
31096        } else {
31097          (0, _util.warn)('fontRes not available');
31098          return errorFont();
31099        }
31100      }
31101
31102      if (!fontRef) {
31103        (0, _util.warn)('fontRef not available');
31104        return errorFont();
31105      }
31106
31107      if (this.fontCache.has(fontRef)) {
31108        return this.fontCache.get(fontRef);
31109      }
31110
31111      font = xref.fetchIfRef(fontRef);
31112
31113      if (!(0, _primitives.isDict)(font)) {
31114        return errorFont();
31115      }
31116
31117      if (font.translated) {
31118        return font.translated;
31119      }
31120
31121      var fontCapability = (0, _util.createPromiseCapability)();
31122      var preEvaluatedFont = this.preEvaluateFont(font);
31123      var descriptor = preEvaluatedFont.descriptor,
31124          hash = preEvaluatedFont.hash;
31125      var fontRefIsRef = (0, _primitives.isRef)(fontRef),
31126          fontID;
31127
31128      if (fontRefIsRef) {
31129        fontID = fontRef.toString();
31130      }
31131
31132      if (hash && (0, _primitives.isDict)(descriptor)) {
31133        if (!descriptor.fontAliases) {
31134          descriptor.fontAliases = Object.create(null);
31135        }
31136
31137        var fontAliases = descriptor.fontAliases;
31138
31139        if (fontAliases[hash]) {
31140          var aliasFontRef = fontAliases[hash].aliasRef;
31141
31142          if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
31143            this.fontCache.putAlias(fontRef, aliasFontRef);
31144            return this.fontCache.get(fontRef);
31145          }
31146        } else {
31147          fontAliases[hash] = {
31148            fontID: _fonts.Font.getFontID()
31149          };
31150        }
31151
31152        if (fontRefIsRef) {
31153          fontAliases[hash].aliasRef = fontRef;
31154        }
31155
31156        fontID = fontAliases[hash].fontID;
31157      }
31158
31159      if (fontRefIsRef) {
31160        this.fontCache.put(fontRef, fontCapability.promise);
31161      } else {
31162        if (!fontID) {
31163          fontID = this.idFactory.createObjId();
31164        }
31165
31166        this.fontCache.put("id_".concat(fontID), fontCapability.promise);
31167      }
31168
31169      (0, _util.assert)(fontID, 'The "fontID" must be defined.');
31170      font.loadedName = "".concat(this.idFactory.getDocId(), "_f").concat(fontID);
31171      font.translated = fontCapability.promise;
31172      var translatedPromise;
31173
31174      try {
31175        translatedPromise = this.translateFont(preEvaluatedFont);
31176      } catch (e) {
31177        translatedPromise = Promise.reject(e);
31178      }
31179
31180      translatedPromise.then(function (translatedFont) {
31181        if (translatedFont.fontType !== undefined) {
31182          var xrefFontStats = xref.stats.fontTypes;
31183          xrefFontStats[translatedFont.fontType] = true;
31184        }
31185
31186        fontCapability.resolve(new TranslatedFont(font.loadedName, translatedFont, font));
31187      })["catch"](function (reason) {
31188        _this6.handler.send('UnsupportedFeature', {
31189          featureId: _util.UNSUPPORTED_FEATURES.font
31190        });
31191
31192        try {
31193          var fontFile3 = descriptor && descriptor.get('FontFile3');
31194          var subtype = fontFile3 && fontFile3.get('Subtype');
31195          var fontType = (0, _fonts.getFontType)(preEvaluatedFont.type, subtype && subtype.name);
31196          var xrefFontStats = xref.stats.fontTypes;
31197          xrefFontStats[fontType] = true;
31198        } catch (ex) {}
31199
31200        fontCapability.resolve(new TranslatedFont(font.loadedName, new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason), font));
31201      });
31202      return fontCapability.promise;
31203    },
31204    buildPath: function buildPath(operatorList, fn, args) {
31205      var parsingText = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
31206      var lastIndex = operatorList.length - 1;
31207
31208      if (!args) {
31209        args = [];
31210      }
31211
31212      if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) {
31213        if (parsingText) {
31214          (0, _util.warn)("Encountered path operator \"".concat(fn, "\" inside of a text object."));
31215          operatorList.addOp(_util.OPS.save, null);
31216        }
31217
31218        operatorList.addOp(_util.OPS.constructPath, [[fn], args]);
31219
31220        if (parsingText) {
31221          operatorList.addOp(_util.OPS.restore, null);
31222        }
31223      } else {
31224        var opArgs = operatorList.argsArray[lastIndex];
31225        opArgs[0].push(fn);
31226        Array.prototype.push.apply(opArgs[1], args);
31227      }
31228    },
31229    handleColorN: function () {
31230      var _handleColorN = _asyncToGenerator(
31231      /*#__PURE__*/
31232      _regenerator["default"].mark(function _callee3(operatorList, fn, args, cs, patterns, resources, task) {
31233        var patternName, pattern, dict, typeNum, color, shading, matrix;
31234        return _regenerator["default"].wrap(function _callee3$(_context3) {
31235          while (1) {
31236            switch (_context3.prev = _context3.next) {
31237              case 0:
31238                patternName = args[args.length - 1];
31239
31240                if (!((0, _primitives.isName)(patternName) && (pattern = patterns.get(patternName.name)))) {
31241                  _context3.next = 16;
31242                  break;
31243                }
31244
31245                dict = (0, _primitives.isStream)(pattern) ? pattern.dict : pattern;
31246                typeNum = dict.get('PatternType');
31247
31248                if (!(typeNum === TILING_PATTERN)) {
31249                  _context3.next = 9;
31250                  break;
31251                }
31252
31253                color = cs.base ? cs.base.getRgb(args, 0) : null;
31254                return _context3.abrupt("return", this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task));
31255
31256              case 9:
31257                if (!(typeNum === SHADING_PATTERN)) {
31258                  _context3.next = 15;
31259                  break;
31260                }
31261
31262                shading = dict.get('Shading');
31263                matrix = dict.getArray('Matrix');
31264                pattern = _pattern.Pattern.parseShading(shading, matrix, this.xref, resources, this.handler, this.pdfFunctionFactory);
31265                operatorList.addOp(fn, pattern.getIR());
31266                return _context3.abrupt("return", undefined);
31267
31268              case 15:
31269                throw new _util.FormatError("Unknown PatternType: ".concat(typeNum));
31270
31271              case 16:
31272                throw new _util.FormatError("Unknown PatternName: ".concat(patternName));
31273
31274              case 17:
31275              case "end":
31276                return _context3.stop();
31277            }
31278          }
31279        }, _callee3, this);
31280      }));
31281
31282      function handleColorN(_x3, _x4, _x5, _x6, _x7, _x8, _x9) {
31283        return _handleColorN.apply(this, arguments);
31284      }
31285
31286      return handleColorN;
31287    }(),
31288    getOperatorList: function getOperatorList(_ref4) {
31289      var _this7 = this;
31290
31291      var stream = _ref4.stream,
31292          task = _ref4.task,
31293          resources = _ref4.resources,
31294          operatorList = _ref4.operatorList,
31295          _ref4$initialState = _ref4.initialState,
31296          initialState = _ref4$initialState === void 0 ? null : _ref4$initialState;
31297      resources = resources || _primitives.Dict.empty;
31298      initialState = initialState || new EvalState();
31299
31300      if (!operatorList) {
31301        throw new Error('getOperatorList: missing "operatorList" parameter');
31302      }
31303
31304      var self = this;
31305      var xref = this.xref;
31306      var parsingText = false;
31307      var imageCache = Object.create(null);
31308
31309      var xobjs = resources.get('XObject') || _primitives.Dict.empty;
31310
31311      var patterns = resources.get('Pattern') || _primitives.Dict.empty;
31312
31313      var stateManager = new StateManager(initialState);
31314      var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
31315      var timeSlotManager = new TimeSlotManager();
31316
31317      function closePendingRestoreOPS(argument) {
31318        for (var i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
31319          operatorList.addOp(_util.OPS.restore, []);
31320        }
31321      }
31322
31323      return new Promise(function promiseBody(resolve, reject) {
31324        var next = function next(promise) {
31325          promise.then(function () {
31326            try {
31327              promiseBody(resolve, reject);
31328            } catch (ex) {
31329              reject(ex);
31330            }
31331          }, reject);
31332        };
31333
31334        task.ensureNotTerminated();
31335        timeSlotManager.reset();
31336        var stop,
31337            operation = {},
31338            i,
31339            ii,
31340            cs;
31341
31342        while (!(stop = timeSlotManager.check())) {
31343          operation.args = null;
31344
31345          if (!preprocessor.read(operation)) {
31346            break;
31347          }
31348
31349          var args = operation.args;
31350          var fn = operation.fn;
31351
31352          switch (fn | 0) {
31353            case _util.OPS.paintXObject:
31354              var name = args[0].name;
31355
31356              if (name && imageCache[name] !== undefined) {
31357                operatorList.addOp(imageCache[name].fn, imageCache[name].args);
31358                args = null;
31359                continue;
31360              }
31361
31362              next(new Promise(function (resolveXObject, rejectXObject) {
31363                if (!name) {
31364                  throw new _util.FormatError('XObject must be referred to by name.');
31365                }
31366
31367                var xobj = xobjs.get(name);
31368
31369                if (!xobj) {
31370                  operatorList.addOp(fn, args);
31371                  resolveXObject();
31372                  return;
31373                }
31374
31375                if (!(0, _primitives.isStream)(xobj)) {
31376                  throw new _util.FormatError('XObject should be a stream');
31377                }
31378
31379                var type = xobj.dict.get('Subtype');
31380
31381                if (!(0, _primitives.isName)(type)) {
31382                  throw new _util.FormatError('XObject should have a Name subtype');
31383                }
31384
31385                if (type.name === 'Form') {
31386                  stateManager.save();
31387                  self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone()).then(function () {
31388                    stateManager.restore();
31389                    resolveXObject();
31390                  }, rejectXObject);
31391                  return;
31392                } else if (type.name === 'Image') {
31393                  self.buildPaintImageXObject({
31394                    resources: resources,
31395                    image: xobj,
31396                    operatorList: operatorList,
31397                    cacheKey: name,
31398                    imageCache: imageCache
31399                  }).then(resolveXObject, rejectXObject);
31400                  return;
31401                } else if (type.name === 'PS') {
31402                  (0, _util.info)('Ignored XObject subtype PS');
31403                } else {
31404                  throw new _util.FormatError("Unhandled XObject subtype ".concat(type.name));
31405                }
31406
31407                resolveXObject();
31408              })["catch"](function (reason) {
31409                if (self.options.ignoreErrors) {
31410                  self.handler.send('UnsupportedFeature', {
31411                    featureId: _util.UNSUPPORTED_FEATURES.unknown
31412                  });
31413                  (0, _util.warn)("getOperatorList - ignoring XObject: \"".concat(reason, "\"."));
31414                  return;
31415                }
31416
31417                throw reason;
31418              }));
31419              return;
31420
31421            case _util.OPS.setFont:
31422              var fontSize = args[1];
31423              next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state).then(function (loadedName) {
31424                operatorList.addDependency(loadedName);
31425                operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]);
31426              }));
31427              return;
31428
31429            case _util.OPS.beginText:
31430              parsingText = true;
31431              break;
31432
31433            case _util.OPS.endText:
31434              parsingText = false;
31435              break;
31436
31437            case _util.OPS.endInlineImage:
31438              var cacheKey = args[0].cacheKey;
31439
31440              if (cacheKey) {
31441                var cacheEntry = imageCache[cacheKey];
31442
31443                if (cacheEntry !== undefined) {
31444                  operatorList.addOp(cacheEntry.fn, cacheEntry.args);
31445                  args = null;
31446                  continue;
31447                }
31448              }
31449
31450              next(self.buildPaintImageXObject({
31451                resources: resources,
31452                image: args[0],
31453                isInline: true,
31454                operatorList: operatorList,
31455                cacheKey: cacheKey,
31456                imageCache: imageCache
31457              }));
31458              return;
31459
31460            case _util.OPS.showText:
31461              args[0] = self.handleText(args[0], stateManager.state);
31462              break;
31463
31464            case _util.OPS.showSpacedText:
31465              var arr = args[0];
31466              var combinedGlyphs = [];
31467              var arrLength = arr.length;
31468              var state = stateManager.state;
31469
31470              for (i = 0; i < arrLength; ++i) {
31471                var arrItem = arr[i];
31472
31473                if ((0, _util.isString)(arrItem)) {
31474                  Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state));
31475                } else if ((0, _util.isNum)(arrItem)) {
31476                  combinedGlyphs.push(arrItem);
31477                }
31478              }
31479
31480              args[0] = combinedGlyphs;
31481              fn = _util.OPS.showText;
31482              break;
31483
31484            case _util.OPS.nextLineShowText:
31485              operatorList.addOp(_util.OPS.nextLine);
31486              args[0] = self.handleText(args[0], stateManager.state);
31487              fn = _util.OPS.showText;
31488              break;
31489
31490            case _util.OPS.nextLineSetSpacingShowText:
31491              operatorList.addOp(_util.OPS.nextLine);
31492              operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]);
31493              operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]);
31494              args[0] = self.handleText(args[0], stateManager.state);
31495              fn = _util.OPS.showText;
31496              break;
31497
31498            case _util.OPS.setTextRenderingMode:
31499              stateManager.state.textRenderingMode = args[0];
31500              break;
31501
31502            case _util.OPS.setFillColorSpace:
31503              stateManager.state.fillColorSpace = _colorspace.ColorSpace.parse(args[0], xref, resources, self.pdfFunctionFactory);
31504              continue;
31505
31506            case _util.OPS.setStrokeColorSpace:
31507              stateManager.state.strokeColorSpace = _colorspace.ColorSpace.parse(args[0], xref, resources, self.pdfFunctionFactory);
31508              continue;
31509
31510            case _util.OPS.setFillColor:
31511              cs = stateManager.state.fillColorSpace;
31512              args = cs.getRgb(args, 0);
31513              fn = _util.OPS.setFillRGBColor;
31514              break;
31515
31516            case _util.OPS.setStrokeColor:
31517              cs = stateManager.state.strokeColorSpace;
31518              args = cs.getRgb(args, 0);
31519              fn = _util.OPS.setStrokeRGBColor;
31520              break;
31521
31522            case _util.OPS.setFillGray:
31523              stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
31524              args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
31525              fn = _util.OPS.setFillRGBColor;
31526              break;
31527
31528            case _util.OPS.setStrokeGray:
31529              stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
31530              args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
31531              fn = _util.OPS.setStrokeRGBColor;
31532              break;
31533
31534            case _util.OPS.setFillCMYKColor:
31535              stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk;
31536              args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
31537              fn = _util.OPS.setFillRGBColor;
31538              break;
31539
31540            case _util.OPS.setStrokeCMYKColor:
31541              stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk;
31542              args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
31543              fn = _util.OPS.setStrokeRGBColor;
31544              break;
31545
31546            case _util.OPS.setFillRGBColor:
31547              stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb;
31548              args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
31549              break;
31550
31551            case _util.OPS.setStrokeRGBColor:
31552              stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb;
31553              args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
31554              break;
31555
31556            case _util.OPS.setFillColorN:
31557              cs = stateManager.state.fillColorSpace;
31558
31559              if (cs.name === 'Pattern') {
31560                next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task));
31561                return;
31562              }
31563
31564              args = cs.getRgb(args, 0);
31565              fn = _util.OPS.setFillRGBColor;
31566              break;
31567
31568            case _util.OPS.setStrokeColorN:
31569              cs = stateManager.state.strokeColorSpace;
31570
31571              if (cs.name === 'Pattern') {
31572                next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task));
31573                return;
31574              }
31575
31576              args = cs.getRgb(args, 0);
31577              fn = _util.OPS.setStrokeRGBColor;
31578              break;
31579
31580            case _util.OPS.shadingFill:
31581              var shadingRes = resources.get('Shading');
31582
31583              if (!shadingRes) {
31584                throw new _util.FormatError('No shading resource found');
31585              }
31586
31587              var shading = shadingRes.get(args[0].name);
31588
31589              if (!shading) {
31590                throw new _util.FormatError('No shading object found');
31591              }
31592
31593              var shadingFill = _pattern.Pattern.parseShading(shading, null, xref, resources, self.handler, self.pdfFunctionFactory);
31594
31595              var patternIR = shadingFill.getIR();
31596              args = [patternIR];
31597              fn = _util.OPS.shadingFill;
31598              break;
31599
31600            case _util.OPS.setGState:
31601              var dictName = args[0];
31602              var extGState = resources.get('ExtGState');
31603
31604              if (!(0, _primitives.isDict)(extGState) || !extGState.has(dictName.name)) {
31605                break;
31606              }
31607
31608              var gState = extGState.get(dictName.name);
31609              next(self.setGState(resources, gState, operatorList, task, stateManager));
31610              return;
31611
31612            case _util.OPS.moveTo:
31613            case _util.OPS.lineTo:
31614            case _util.OPS.curveTo:
31615            case _util.OPS.curveTo2:
31616            case _util.OPS.curveTo3:
31617            case _util.OPS.closePath:
31618            case _util.OPS.rectangle:
31619              self.buildPath(operatorList, fn, args, parsingText);
31620              continue;
31621
31622            case _util.OPS.markPoint:
31623            case _util.OPS.markPointProps:
31624            case _util.OPS.beginMarkedContent:
31625            case _util.OPS.beginMarkedContentProps:
31626            case _util.OPS.endMarkedContent:
31627            case _util.OPS.beginCompat:
31628            case _util.OPS.endCompat:
31629              continue;
31630
31631            default:
31632              if (args !== null) {
31633                for (i = 0, ii = args.length; i < ii; i++) {
31634                  if (args[i] instanceof _primitives.Dict) {
31635                    break;
31636                  }
31637                }
31638
31639                if (i < ii) {
31640                  (0, _util.warn)('getOperatorList - ignoring operator: ' + fn);
31641                  continue;
31642                }
31643              }
31644
31645          }
31646
31647          operatorList.addOp(fn, args);
31648        }
31649
31650        if (stop) {
31651          next(deferred);
31652          return;
31653        }
31654
31655        closePendingRestoreOPS();
31656        resolve();
31657      })["catch"](function (reason) {
31658        if (_this7.options.ignoreErrors) {
31659          _this7.handler.send('UnsupportedFeature', {
31660            featureId: _util.UNSUPPORTED_FEATURES.unknown
31661          });
31662
31663          (0, _util.warn)("getOperatorList - ignoring errors during \"".concat(task.name, "\" ") + "task: \"".concat(reason, "\"."));
31664          closePendingRestoreOPS();
31665          return;
31666        }
31667
31668        throw reason;
31669      });
31670    },
31671    getTextContent: function getTextContent(_ref5) {
31672      var _this8 = this;
31673
31674      var stream = _ref5.stream,
31675          task = _ref5.task,
31676          resources = _ref5.resources,
31677          _ref5$stateManager = _ref5.stateManager,
31678          stateManager = _ref5$stateManager === void 0 ? null : _ref5$stateManager,
31679          _ref5$normalizeWhites = _ref5.normalizeWhitespace,
31680          normalizeWhitespace = _ref5$normalizeWhites === void 0 ? false : _ref5$normalizeWhites,
31681          _ref5$combineTextItem = _ref5.combineTextItems,
31682          combineTextItems = _ref5$combineTextItem === void 0 ? false : _ref5$combineTextItem,
31683          sink = _ref5.sink,
31684          _ref5$seenStyles = _ref5.seenStyles,
31685          seenStyles = _ref5$seenStyles === void 0 ? Object.create(null) : _ref5$seenStyles;
31686      resources = resources || _primitives.Dict.empty;
31687      stateManager = stateManager || new StateManager(new TextState());
31688      var WhitespaceRegexp = /\s/g;
31689      var textContent = {
31690        items: [],
31691        styles: Object.create(null)
31692      };
31693      var textContentItem = {
31694        initialized: false,
31695        str: [],
31696        width: 0,
31697        height: 0,
31698        vertical: false,
31699        lastAdvanceWidth: 0,
31700        lastAdvanceHeight: 0,
31701        textAdvanceScale: 0,
31702        spaceWidth: 0,
31703        fakeSpaceMin: Infinity,
31704        fakeMultiSpaceMin: Infinity,
31705        fakeMultiSpaceMax: -0,
31706        textRunBreakAllowed: false,
31707        transform: null,
31708        fontName: null
31709      };
31710      var SPACE_FACTOR = 0.3;
31711      var MULTI_SPACE_FACTOR = 1.5;
31712      var MULTI_SPACE_FACTOR_MAX = 4;
31713      var self = this;
31714      var xref = this.xref;
31715      var xobjs = null;
31716      var skipEmptyXObjs = Object.create(null);
31717      var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
31718      var textState;
31719
31720      function ensureTextContentItem() {
31721        if (textContentItem.initialized) {
31722          return textContentItem;
31723        }
31724
31725        var font = textState.font;
31726
31727        if (!(font.loadedName in seenStyles)) {
31728          seenStyles[font.loadedName] = true;
31729          textContent.styles[font.loadedName] = {
31730            fontFamily: font.fallbackName,
31731            ascent: font.ascent,
31732            descent: font.descent,
31733            vertical: !!font.vertical
31734          };
31735        }
31736
31737        textContentItem.fontName = font.loadedName;
31738        var tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];
31739
31740        if (font.isType3Font && textState.fontSize <= 1 && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) {
31741          var glyphHeight = font.bbox[3] - font.bbox[1];
31742
31743          if (glyphHeight > 0) {
31744            tsm[3] *= glyphHeight * textState.fontMatrix[3];
31745          }
31746        }
31747
31748        var trm = _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm));
31749
31750        textContentItem.transform = trm;
31751
31752        if (!font.vertical) {
31753          textContentItem.width = 0;
31754          textContentItem.height = Math.sqrt(trm[2] * trm[2] + trm[3] * trm[3]);
31755          textContentItem.vertical = false;
31756        } else {
31757          textContentItem.width = Math.sqrt(trm[0] * trm[0] + trm[1] * trm[1]);
31758          textContentItem.height = 0;
31759          textContentItem.vertical = true;
31760        }
31761
31762        var a = textState.textLineMatrix[0];
31763        var b = textState.textLineMatrix[1];
31764        var scaleLineX = Math.sqrt(a * a + b * b);
31765        a = textState.ctm[0];
31766        b = textState.ctm[1];
31767        var scaleCtmX = Math.sqrt(a * a + b * b);
31768        textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
31769        textContentItem.lastAdvanceWidth = 0;
31770        textContentItem.lastAdvanceHeight = 0;
31771        var spaceWidth = font.spaceWidth / 1000 * textState.fontSize;
31772
31773        if (spaceWidth) {
31774          textContentItem.spaceWidth = spaceWidth;
31775          textContentItem.fakeSpaceMin = spaceWidth * SPACE_FACTOR;
31776          textContentItem.fakeMultiSpaceMin = spaceWidth * MULTI_SPACE_FACTOR;
31777          textContentItem.fakeMultiSpaceMax = spaceWidth * MULTI_SPACE_FACTOR_MAX;
31778          textContentItem.textRunBreakAllowed = !font.isMonospace;
31779        } else {
31780          textContentItem.spaceWidth = 0;
31781          textContentItem.fakeSpaceMin = Infinity;
31782          textContentItem.fakeMultiSpaceMin = Infinity;
31783          textContentItem.fakeMultiSpaceMax = 0;
31784          textContentItem.textRunBreakAllowed = false;
31785        }
31786
31787        textContentItem.initialized = true;
31788        return textContentItem;
31789      }
31790
31791      function replaceWhitespace(str) {
31792        var i = 0,
31793            ii = str.length,
31794            code;
31795
31796        while (i < ii && (code = str.charCodeAt(i)) >= 0x20 && code <= 0x7F) {
31797          i++;
31798        }
31799
31800        return i < ii ? str.replace(WhitespaceRegexp, ' ') : str;
31801      }
31802
31803      function runBidiTransform(textChunk) {
31804        var str = textChunk.str.join('');
31805        var bidiResult = (0, _bidi.bidi)(str, -1, textChunk.vertical);
31806        return {
31807          str: normalizeWhitespace ? replaceWhitespace(bidiResult.str) : bidiResult.str,
31808          dir: bidiResult.dir,
31809          width: textChunk.width,
31810          height: textChunk.height,
31811          transform: textChunk.transform,
31812          fontName: textChunk.fontName
31813        };
31814      }
31815
31816      function handleSetFont(fontName, fontRef) {
31817        return self.loadFont(fontName, fontRef, resources).then(function (translated) {
31818          textState.font = translated.font;
31819          textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX;
31820        });
31821      }
31822
31823      function buildTextContentItem(chars) {
31824        var font = textState.font;
31825        var textChunk = ensureTextContentItem();
31826        var width = 0;
31827        var height = 0;
31828        var glyphs = font.charsToGlyphs(chars);
31829
31830        for (var i = 0; i < glyphs.length; i++) {
31831          var glyph = glyphs[i];
31832          var glyphWidth = null;
31833
31834          if (font.vertical && glyph.vmetric) {
31835            glyphWidth = glyph.vmetric[0];
31836          } else {
31837            glyphWidth = glyph.width;
31838          }
31839
31840          var glyphUnicode = glyph.unicode;
31841          var NormalizedUnicodes = (0, _unicode.getNormalizedUnicodes)();
31842
31843          if (NormalizedUnicodes[glyphUnicode] !== undefined) {
31844            glyphUnicode = NormalizedUnicodes[glyphUnicode];
31845          }
31846
31847          glyphUnicode = (0, _unicode.reverseIfRtl)(glyphUnicode);
31848          var charSpacing = textState.charSpacing;
31849
31850          if (glyph.isSpace) {
31851            var wordSpacing = textState.wordSpacing;
31852            charSpacing += wordSpacing;
31853
31854            if (wordSpacing > 0) {
31855              addFakeSpaces(wordSpacing, textChunk.str);
31856            }
31857          }
31858
31859          var tx = 0;
31860          var ty = 0;
31861
31862          if (!font.vertical) {
31863            var w0 = glyphWidth * textState.fontMatrix[0];
31864            tx = (w0 * textState.fontSize + charSpacing) * textState.textHScale;
31865            width += tx;
31866          } else {
31867            var w1 = glyphWidth * textState.fontMatrix[0];
31868            ty = w1 * textState.fontSize + charSpacing;
31869            height += ty;
31870          }
31871
31872          textState.translateTextMatrix(tx, ty);
31873          textChunk.str.push(glyphUnicode);
31874        }
31875
31876        if (!font.vertical) {
31877          textChunk.lastAdvanceWidth = width;
31878          textChunk.width += width;
31879        } else {
31880          textChunk.lastAdvanceHeight = height;
31881          textChunk.height += Math.abs(height);
31882        }
31883
31884        return textChunk;
31885      }
31886
31887      function addFakeSpaces(width, strBuf) {
31888        if (width < textContentItem.fakeSpaceMin) {
31889          return;
31890        }
31891
31892        if (width < textContentItem.fakeMultiSpaceMin) {
31893          strBuf.push(' ');
31894          return;
31895        }
31896
31897        var fakeSpaces = Math.round(width / textContentItem.spaceWidth);
31898
31899        while (fakeSpaces-- > 0) {
31900          strBuf.push(' ');
31901        }
31902      }
31903
31904      function flushTextContentItem() {
31905        if (!textContentItem.initialized) {
31906          return;
31907        }
31908
31909        if (!textContentItem.vertical) {
31910          textContentItem.width *= textContentItem.textAdvanceScale;
31911        } else {
31912          textContentItem.height *= textContentItem.textAdvanceScale;
31913        }
31914
31915        textContent.items.push(runBidiTransform(textContentItem));
31916        textContentItem.initialized = false;
31917        textContentItem.str.length = 0;
31918      }
31919
31920      function enqueueChunk() {
31921        var length = textContent.items.length;
31922
31923        if (length > 0) {
31924          sink.enqueue(textContent, length);
31925          textContent.items = [];
31926          textContent.styles = Object.create(null);
31927        }
31928      }
31929
31930      var timeSlotManager = new TimeSlotManager();
31931      return new Promise(function promiseBody(resolve, reject) {
31932        var next = function next(promise) {
31933          enqueueChunk();
31934          Promise.all([promise, sink.ready]).then(function () {
31935            try {
31936              promiseBody(resolve, reject);
31937            } catch (ex) {
31938              reject(ex);
31939            }
31940          }, reject);
31941        };
31942
31943        task.ensureNotTerminated();
31944        timeSlotManager.reset();
31945        var stop,
31946            operation = {},
31947            args = [];
31948
31949        while (!(stop = timeSlotManager.check())) {
31950          args.length = 0;
31951          operation.args = args;
31952
31953          if (!preprocessor.read(operation)) {
31954            break;
31955          }
31956
31957          textState = stateManager.state;
31958          var fn = operation.fn;
31959          args = operation.args;
31960          var advance, diff;
31961
31962          switch (fn | 0) {
31963            case _util.OPS.setFont:
31964              var fontNameArg = args[0].name,
31965                  fontSizeArg = args[1];
31966
31967              if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
31968                break;
31969              }
31970
31971              flushTextContentItem();
31972              textState.fontName = fontNameArg;
31973              textState.fontSize = fontSizeArg;
31974              next(handleSetFont(fontNameArg, null));
31975              return;
31976
31977            case _util.OPS.setTextRise:
31978              flushTextContentItem();
31979              textState.textRise = args[0];
31980              break;
31981
31982            case _util.OPS.setHScale:
31983              flushTextContentItem();
31984              textState.textHScale = args[0] / 100;
31985              break;
31986
31987            case _util.OPS.setLeading:
31988              flushTextContentItem();
31989              textState.leading = args[0];
31990              break;
31991
31992            case _util.OPS.moveText:
31993              var isSameTextLine = !textState.font ? false : (textState.font.vertical ? args[0] : args[1]) === 0;
31994              advance = args[0] - args[1];
31995
31996              if (combineTextItems && isSameTextLine && textContentItem.initialized && advance > 0 && advance <= textContentItem.fakeMultiSpaceMax) {
31997                textState.translateTextLineMatrix(args[0], args[1]);
31998                textContentItem.width += args[0] - textContentItem.lastAdvanceWidth;
31999                textContentItem.height += args[1] - textContentItem.lastAdvanceHeight;
32000                diff = args[0] - textContentItem.lastAdvanceWidth - (args[1] - textContentItem.lastAdvanceHeight);
32001                addFakeSpaces(diff, textContentItem.str);
32002                break;
32003              }
32004
32005              flushTextContentItem();
32006              textState.translateTextLineMatrix(args[0], args[1]);
32007              textState.textMatrix = textState.textLineMatrix.slice();
32008              break;
32009
32010            case _util.OPS.setLeadingMoveText:
32011              flushTextContentItem();
32012              textState.leading = -args[1];
32013              textState.translateTextLineMatrix(args[0], args[1]);
32014              textState.textMatrix = textState.textLineMatrix.slice();
32015              break;
32016
32017            case _util.OPS.nextLine:
32018              flushTextContentItem();
32019              textState.carriageReturn();
32020              break;
32021
32022            case _util.OPS.setTextMatrix:
32023              advance = textState.calcTextLineMatrixAdvance(args[0], args[1], args[2], args[3], args[4], args[5]);
32024
32025              if (combineTextItems && advance !== null && textContentItem.initialized && advance.value > 0 && advance.value <= textContentItem.fakeMultiSpaceMax) {
32026                textState.translateTextLineMatrix(advance.width, advance.height);
32027                textContentItem.width += advance.width - textContentItem.lastAdvanceWidth;
32028                textContentItem.height += advance.height - textContentItem.lastAdvanceHeight;
32029                diff = advance.width - textContentItem.lastAdvanceWidth - (advance.height - textContentItem.lastAdvanceHeight);
32030                addFakeSpaces(diff, textContentItem.str);
32031                break;
32032              }
32033
32034              flushTextContentItem();
32035              textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
32036              textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
32037              break;
32038
32039            case _util.OPS.setCharSpacing:
32040              textState.charSpacing = args[0];
32041              break;
32042
32043            case _util.OPS.setWordSpacing:
32044              textState.wordSpacing = args[0];
32045              break;
32046
32047            case _util.OPS.beginText:
32048              flushTextContentItem();
32049              textState.textMatrix = _util.IDENTITY_MATRIX.slice();
32050              textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
32051              break;
32052
32053            case _util.OPS.showSpacedText:
32054              var items = args[0];
32055              var offset;
32056
32057              for (var j = 0, jj = items.length; j < jj; j++) {
32058                if (typeof items[j] === 'string') {
32059                  buildTextContentItem(items[j]);
32060                } else if ((0, _util.isNum)(items[j])) {
32061                  ensureTextContentItem();
32062                  advance = items[j] * textState.fontSize / 1000;
32063                  var breakTextRun = false;
32064
32065                  if (textState.font.vertical) {
32066                    offset = advance;
32067                    textState.translateTextMatrix(0, offset);
32068                    breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
32069
32070                    if (!breakTextRun) {
32071                      textContentItem.height += offset;
32072                    }
32073                  } else {
32074                    advance = -advance;
32075                    offset = advance * textState.textHScale;
32076                    textState.translateTextMatrix(offset, 0);
32077                    breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
32078
32079                    if (!breakTextRun) {
32080                      textContentItem.width += offset;
32081                    }
32082                  }
32083
32084                  if (breakTextRun) {
32085                    flushTextContentItem();
32086                  } else if (advance > 0) {
32087                    addFakeSpaces(advance, textContentItem.str);
32088                  }
32089                }
32090              }
32091
32092              break;
32093
32094            case _util.OPS.showText:
32095              buildTextContentItem(args[0]);
32096              break;
32097
32098            case _util.OPS.nextLineShowText:
32099              flushTextContentItem();
32100              textState.carriageReturn();
32101              buildTextContentItem(args[0]);
32102              break;
32103
32104            case _util.OPS.nextLineSetSpacingShowText:
32105              flushTextContentItem();
32106              textState.wordSpacing = args[0];
32107              textState.charSpacing = args[1];
32108              textState.carriageReturn();
32109              buildTextContentItem(args[2]);
32110              break;
32111
32112            case _util.OPS.paintXObject:
32113              flushTextContentItem();
32114
32115              if (!xobjs) {
32116                xobjs = resources.get('XObject') || _primitives.Dict.empty;
32117              }
32118
32119              var name = args[0].name;
32120
32121              if (name && skipEmptyXObjs[name] !== undefined) {
32122                break;
32123              }
32124
32125              next(new Promise(function (resolveXObject, rejectXObject) {
32126                if (!name) {
32127                  throw new _util.FormatError('XObject must be referred to by name.');
32128                }
32129
32130                var xobj = xobjs.get(name);
32131
32132                if (!xobj) {
32133                  resolveXObject();
32134                  return;
32135                }
32136
32137                if (!(0, _primitives.isStream)(xobj)) {
32138                  throw new _util.FormatError('XObject should be a stream');
32139                }
32140
32141                var type = xobj.dict.get('Subtype');
32142
32143                if (!(0, _primitives.isName)(type)) {
32144                  throw new _util.FormatError('XObject should have a Name subtype');
32145                }
32146
32147                if (type.name !== 'Form') {
32148                  skipEmptyXObjs[name] = true;
32149                  resolveXObject();
32150                  return;
32151                }
32152
32153                var currentState = stateManager.state.clone();
32154                var xObjStateManager = new StateManager(currentState);
32155                var matrix = xobj.dict.getArray('Matrix');
32156
32157                if (Array.isArray(matrix) && matrix.length === 6) {
32158                  xObjStateManager.transform(matrix);
32159                }
32160
32161                enqueueChunk();
32162                var sinkWrapper = {
32163                  enqueueInvoked: false,
32164                  enqueue: function enqueue(chunk, size) {
32165                    this.enqueueInvoked = true;
32166                    sink.enqueue(chunk, size);
32167                  },
32168
32169                  get desiredSize() {
32170                    return sink.desiredSize;
32171                  },
32172
32173                  get ready() {
32174                    return sink.ready;
32175                  }
32176
32177                };
32178                self.getTextContent({
32179                  stream: xobj,
32180                  task: task,
32181                  resources: xobj.dict.get('Resources') || resources,
32182                  stateManager: xObjStateManager,
32183                  normalizeWhitespace: normalizeWhitespace,
32184                  combineTextItems: combineTextItems,
32185                  sink: sinkWrapper,
32186                  seenStyles: seenStyles
32187                }).then(function () {
32188                  if (!sinkWrapper.enqueueInvoked) {
32189                    skipEmptyXObjs[name] = true;
32190                  }
32191
32192                  resolveXObject();
32193                }, rejectXObject);
32194              })["catch"](function (reason) {
32195                if (reason instanceof _util.AbortException) {
32196                  return;
32197                }
32198
32199                if (self.options.ignoreErrors) {
32200                  (0, _util.warn)("getTextContent - ignoring XObject: \"".concat(reason, "\"."));
32201                  return;
32202                }
32203
32204                throw reason;
32205              }));
32206              return;
32207
32208            case _util.OPS.setGState:
32209              flushTextContentItem();
32210              var dictName = args[0];
32211              var extGState = resources.get('ExtGState');
32212
32213              if (!(0, _primitives.isDict)(extGState) || !(0, _primitives.isName)(dictName)) {
32214                break;
32215              }
32216
32217              var gState = extGState.get(dictName.name);
32218
32219              if (!(0, _primitives.isDict)(gState)) {
32220                break;
32221              }
32222
32223              var gStateFont = gState.get('Font');
32224
32225              if (gStateFont) {
32226                textState.fontName = null;
32227                textState.fontSize = gStateFont[1];
32228                next(handleSetFont(null, gStateFont[0]));
32229                return;
32230              }
32231
32232              break;
32233          }
32234
32235          if (textContent.items.length >= sink.desiredSize) {
32236            stop = true;
32237            break;
32238          }
32239        }
32240
32241        if (stop) {
32242          next(deferred);
32243          return;
32244        }
32245
32246        flushTextContentItem();
32247        enqueueChunk();
32248        resolve();
32249      })["catch"](function (reason) {
32250        if (reason instanceof _util.AbortException) {
32251          return;
32252        }
32253
32254        if (_this8.options.ignoreErrors) {
32255          (0, _util.warn)("getTextContent - ignoring errors during \"".concat(task.name, "\" ") + "task: \"".concat(reason, "\"."));
32256          flushTextContentItem();
32257          enqueueChunk();
32258          return;
32259        }
32260
32261        throw reason;
32262      });
32263    },
32264    extractDataStructures: function PartialEvaluator_extractDataStructures(dict, baseDict, properties) {
32265      var _this9 = this;
32266
32267      var xref = this.xref,
32268          cidToGidBytes;
32269      var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode');
32270      var toUnicodePromise = toUnicode ? this.readToUnicode(toUnicode) : Promise.resolve(undefined);
32271
32272      if (properties.composite) {
32273        var cidSystemInfo = dict.get('CIDSystemInfo');
32274
32275        if ((0, _primitives.isDict)(cidSystemInfo)) {
32276          properties.cidSystemInfo = {
32277            registry: (0, _util.stringToPDFString)(cidSystemInfo.get('Registry')),
32278            ordering: (0, _util.stringToPDFString)(cidSystemInfo.get('Ordering')),
32279            supplement: cidSystemInfo.get('Supplement')
32280          };
32281        }
32282
32283        var cidToGidMap = dict.get('CIDToGIDMap');
32284
32285        if ((0, _primitives.isStream)(cidToGidMap)) {
32286          cidToGidBytes = cidToGidMap.getBytes();
32287        }
32288      }
32289
32290      var differences = [];
32291      var baseEncodingName = null;
32292      var encoding;
32293
32294      if (dict.has('Encoding')) {
32295        encoding = dict.get('Encoding');
32296
32297        if ((0, _primitives.isDict)(encoding)) {
32298          baseEncodingName = encoding.get('BaseEncoding');
32299          baseEncodingName = (0, _primitives.isName)(baseEncodingName) ? baseEncodingName.name : null;
32300
32301          if (encoding.has('Differences')) {
32302            var diffEncoding = encoding.get('Differences');
32303            var index = 0;
32304
32305            for (var j = 0, jj = diffEncoding.length; j < jj; j++) {
32306              var data = xref.fetchIfRef(diffEncoding[j]);
32307
32308              if ((0, _util.isNum)(data)) {
32309                index = data;
32310              } else if ((0, _primitives.isName)(data)) {
32311                differences[index++] = data.name;
32312              } else {
32313                throw new _util.FormatError("Invalid entry in 'Differences' array: ".concat(data));
32314              }
32315            }
32316          }
32317        } else if ((0, _primitives.isName)(encoding)) {
32318          baseEncodingName = encoding.name;
32319        } else {
32320          throw new _util.FormatError('Encoding is not a Name nor a Dict');
32321        }
32322
32323        if (baseEncodingName !== 'MacRomanEncoding' && baseEncodingName !== 'MacExpertEncoding' && baseEncodingName !== 'WinAnsiEncoding') {
32324          baseEncodingName = null;
32325        }
32326      }
32327
32328      if (baseEncodingName) {
32329        properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName).slice();
32330      } else {
32331        var isSymbolicFont = !!(properties.flags & _fonts.FontFlags.Symbolic);
32332        var isNonsymbolicFont = !!(properties.flags & _fonts.FontFlags.Nonsymbolic);
32333        encoding = _encodings.StandardEncoding;
32334
32335        if (properties.type === 'TrueType' && !isNonsymbolicFont) {
32336          encoding = _encodings.WinAnsiEncoding;
32337        }
32338
32339        if (isSymbolicFont) {
32340          encoding = _encodings.MacRomanEncoding;
32341
32342          if (!properties.file) {
32343            if (/Symbol/i.test(properties.name)) {
32344              encoding = _encodings.SymbolSetEncoding;
32345            } else if (/Dingbats/i.test(properties.name)) {
32346              encoding = _encodings.ZapfDingbatsEncoding;
32347            }
32348          }
32349        }
32350
32351        properties.defaultEncoding = encoding;
32352      }
32353
32354      properties.differences = differences;
32355      properties.baseEncodingName = baseEncodingName;
32356      properties.hasEncoding = !!baseEncodingName || differences.length > 0;
32357      properties.dict = dict;
32358      return toUnicodePromise.then(function (toUnicode) {
32359        properties.toUnicode = toUnicode;
32360        return _this9.buildToUnicode(properties);
32361      }).then(function (toUnicode) {
32362        properties.toUnicode = toUnicode;
32363
32364        if (cidToGidBytes) {
32365          properties.cidToGidMap = _this9.readCidToGidMap(cidToGidBytes, toUnicode);
32366        }
32367
32368        return properties;
32369      });
32370    },
32371    _buildSimpleFontToUnicode: function _buildSimpleFontToUnicode(properties) {
32372      (0, _util.assert)(!properties.composite, 'Must be a simple font.');
32373      var toUnicode = [],
32374          charcode,
32375          glyphName;
32376      var encoding = properties.defaultEncoding.slice();
32377      var baseEncodingName = properties.baseEncodingName;
32378      var differences = properties.differences;
32379
32380      for (charcode in differences) {
32381        glyphName = differences[charcode];
32382
32383        if (glyphName === '.notdef') {
32384          continue;
32385        }
32386
32387        encoding[charcode] = glyphName;
32388      }
32389
32390      var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
32391
32392      for (charcode in encoding) {
32393        glyphName = encoding[charcode];
32394
32395        if (glyphName === '') {
32396          continue;
32397        } else if (glyphsUnicodeMap[glyphName] === undefined) {
32398          var code = 0;
32399
32400          switch (glyphName[0]) {
32401            case 'G':
32402              if (glyphName.length === 3) {
32403                code = parseInt(glyphName.substring(1), 16);
32404              }
32405
32406              break;
32407
32408            case 'g':
32409              if (glyphName.length === 5) {
32410                code = parseInt(glyphName.substring(1), 16);
32411              }
32412
32413              break;
32414
32415            case 'C':
32416            case 'c':
32417              if (glyphName.length >= 3) {
32418                code = +glyphName.substring(1);
32419              }
32420
32421              break;
32422
32423            default:
32424              var unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
32425
32426              if (unicode !== -1) {
32427                code = unicode;
32428              }
32429
32430          }
32431
32432          if (code) {
32433            if (baseEncodingName && code === +charcode) {
32434              var baseEncoding = (0, _encodings.getEncoding)(baseEncodingName);
32435
32436              if (baseEncoding && (glyphName = baseEncoding[charcode])) {
32437                toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
32438                continue;
32439              }
32440            }
32441
32442            toUnicode[charcode] = String.fromCodePoint(code);
32443          }
32444
32445          continue;
32446        }
32447
32448        toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
32449      }
32450
32451      return new _fonts.ToUnicodeMap(toUnicode);
32452    },
32453    buildToUnicode: function buildToUnicode(properties) {
32454      properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
32455
32456      if (properties.hasIncludedToUnicodeMap) {
32457        if (!properties.composite && properties.hasEncoding) {
32458          properties.fallbackToUnicode = this._buildSimpleFontToUnicode(properties);
32459        }
32460
32461        return Promise.resolve(properties.toUnicode);
32462      }
32463
32464      if (!properties.composite) {
32465        return Promise.resolve(this._buildSimpleFontToUnicode(properties));
32466      }
32467
32468      if (properties.composite && (properties.cMap.builtInCMap && !(properties.cMap instanceof _cmap.IdentityCMap) || properties.cidSystemInfo.registry === 'Adobe' && (properties.cidSystemInfo.ordering === 'GB1' || properties.cidSystemInfo.ordering === 'CNS1' || properties.cidSystemInfo.ordering === 'Japan1' || properties.cidSystemInfo.ordering === 'Korea1'))) {
32469        var registry = properties.cidSystemInfo.registry;
32470        var ordering = properties.cidSystemInfo.ordering;
32471
32472        var ucs2CMapName = _primitives.Name.get(registry + '-' + ordering + '-UCS2');
32473
32474        return _cmap.CMapFactory.create({
32475          encoding: ucs2CMapName,
32476          fetchBuiltInCMap: this.fetchBuiltInCMap,
32477          useCMap: null
32478        }).then(function (ucs2CMap) {
32479          var cMap = properties.cMap;
32480          var toUnicode = [];
32481          cMap.forEach(function (charcode, cid) {
32482            if (cid > 0xffff) {
32483              throw new _util.FormatError('Max size of CID is 65,535');
32484            }
32485
32486            var ucs2 = ucs2CMap.lookup(cid);
32487
32488            if (ucs2) {
32489              toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
32490            }
32491          });
32492          return new _fonts.ToUnicodeMap(toUnicode);
32493        });
32494      }
32495
32496      return Promise.resolve(new _fonts.IdentityToUnicodeMap(properties.firstChar, properties.lastChar));
32497    },
32498    readToUnicode: function PartialEvaluator_readToUnicode(toUnicode) {
32499      var cmapObj = toUnicode;
32500
32501      if ((0, _primitives.isName)(cmapObj)) {
32502        return _cmap.CMapFactory.create({
32503          encoding: cmapObj,
32504          fetchBuiltInCMap: this.fetchBuiltInCMap,
32505          useCMap: null
32506        }).then(function (cmap) {
32507          if (cmap instanceof _cmap.IdentityCMap) {
32508            return new _fonts.IdentityToUnicodeMap(0, 0xFFFF);
32509          }
32510
32511          return new _fonts.ToUnicodeMap(cmap.getMap());
32512        });
32513      } else if ((0, _primitives.isStream)(cmapObj)) {
32514        return _cmap.CMapFactory.create({
32515          encoding: cmapObj,
32516          fetchBuiltInCMap: this.fetchBuiltInCMap,
32517          useCMap: null
32518        }).then(function (cmap) {
32519          if (cmap instanceof _cmap.IdentityCMap) {
32520            return new _fonts.IdentityToUnicodeMap(0, 0xFFFF);
32521          }
32522
32523          var map = new Array(cmap.length);
32524          cmap.forEach(function (charCode, token) {
32525            var str = [];
32526
32527            for (var k = 0; k < token.length; k += 2) {
32528              var w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
32529
32530              if ((w1 & 0xF800) !== 0xD800) {
32531                str.push(w1);
32532                continue;
32533              }
32534
32535              k += 2;
32536              var w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
32537              str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
32538            }
32539
32540            map[charCode] = String.fromCodePoint.apply(String, str);
32541          });
32542          return new _fonts.ToUnicodeMap(map);
32543        });
32544      }
32545
32546      return Promise.resolve(null);
32547    },
32548    readCidToGidMap: function readCidToGidMap(glyphsData, toUnicode) {
32549      var result = [];
32550
32551      for (var j = 0, jj = glyphsData.length; j < jj; j++) {
32552        var glyphID = glyphsData[j++] << 8 | glyphsData[j];
32553        var code = j >> 1;
32554
32555        if (glyphID === 0 && !toUnicode.has(code)) {
32556          continue;
32557        }
32558
32559        result[code] = glyphID;
32560      }
32561
32562      return result;
32563    },
32564    extractWidths: function PartialEvaluator_extractWidths(dict, descriptor, properties) {
32565      var xref = this.xref;
32566      var glyphsWidths = [];
32567      var defaultWidth = 0;
32568      var glyphsVMetrics = [];
32569      var defaultVMetrics;
32570      var i, ii, j, jj, start, code, widths;
32571
32572      if (properties.composite) {
32573        defaultWidth = dict.has('DW') ? dict.get('DW') : 1000;
32574        widths = dict.get('W');
32575
32576        if (widths) {
32577          for (i = 0, ii = widths.length; i < ii; i++) {
32578            start = xref.fetchIfRef(widths[i++]);
32579            code = xref.fetchIfRef(widths[i]);
32580
32581            if (Array.isArray(code)) {
32582              for (j = 0, jj = code.length; j < jj; j++) {
32583                glyphsWidths[start++] = xref.fetchIfRef(code[j]);
32584              }
32585            } else {
32586              var width = xref.fetchIfRef(widths[++i]);
32587
32588              for (j = start; j <= code; j++) {
32589                glyphsWidths[j] = width;
32590              }
32591            }
32592          }
32593        }
32594
32595        if (properties.vertical) {
32596          var vmetrics = dict.getArray('DW2') || [880, -1000];
32597          defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]];
32598          vmetrics = dict.get('W2');
32599
32600          if (vmetrics) {
32601            for (i = 0, ii = vmetrics.length; i < ii; i++) {
32602              start = xref.fetchIfRef(vmetrics[i++]);
32603              code = xref.fetchIfRef(vmetrics[i]);
32604
32605              if (Array.isArray(code)) {
32606                for (j = 0, jj = code.length; j < jj; j++) {
32607                  glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])];
32608                }
32609              } else {
32610                var vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])];
32611
32612                for (j = start; j <= code; j++) {
32613                  glyphsVMetrics[j] = vmetric;
32614                }
32615              }
32616            }
32617          }
32618        }
32619      } else {
32620        var firstChar = properties.firstChar;
32621        widths = dict.get('Widths');
32622
32623        if (widths) {
32624          j = firstChar;
32625
32626          for (i = 0, ii = widths.length; i < ii; i++) {
32627            glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
32628          }
32629
32630          defaultWidth = parseFloat(descriptor.get('MissingWidth')) || 0;
32631        } else {
32632          var baseFontName = dict.get('BaseFont');
32633
32634          if ((0, _primitives.isName)(baseFontName)) {
32635            var metrics = this.getBaseFontMetrics(baseFontName.name);
32636            glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
32637            defaultWidth = metrics.defaultWidth;
32638          }
32639        }
32640      }
32641
32642      var isMonospace = true;
32643      var firstWidth = defaultWidth;
32644
32645      for (var glyph in glyphsWidths) {
32646        var glyphWidth = glyphsWidths[glyph];
32647
32648        if (!glyphWidth) {
32649          continue;
32650        }
32651
32652        if (!firstWidth) {
32653          firstWidth = glyphWidth;
32654          continue;
32655        }
32656
32657        if (firstWidth !== glyphWidth) {
32658          isMonospace = false;
32659          break;
32660        }
32661      }
32662
32663      if (isMonospace) {
32664        properties.flags |= _fonts.FontFlags.FixedPitch;
32665      }
32666
32667      properties.defaultWidth = defaultWidth;
32668      properties.widths = glyphsWidths;
32669      properties.defaultVMetrics = defaultVMetrics;
32670      properties.vmetrics = glyphsVMetrics;
32671    },
32672    isSerifFont: function PartialEvaluator_isSerifFont(baseFontName) {
32673      var fontNameWoStyle = baseFontName.split('-')[0];
32674      return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || fontNameWoStyle.search(/serif/gi) !== -1;
32675    },
32676    getBaseFontMetrics: function PartialEvaluator_getBaseFontMetrics(name) {
32677      var defaultWidth = 0;
32678      var widths = [];
32679      var monospace = false;
32680      var stdFontMap = (0, _standard_fonts.getStdFontMap)();
32681      var lookupName = stdFontMap[name] || name;
32682      var Metrics = (0, _metrics.getMetrics)();
32683
32684      if (!(lookupName in Metrics)) {
32685        if (this.isSerifFont(name)) {
32686          lookupName = 'Times-Roman';
32687        } else {
32688          lookupName = 'Helvetica';
32689        }
32690      }
32691
32692      var glyphWidths = Metrics[lookupName];
32693
32694      if ((0, _util.isNum)(glyphWidths)) {
32695        defaultWidth = glyphWidths;
32696        monospace = true;
32697      } else {
32698        widths = glyphWidths();
32699      }
32700
32701      return {
32702        defaultWidth: defaultWidth,
32703        monospace: monospace,
32704        widths: widths
32705      };
32706    },
32707    buildCharCodeToWidth: function PartialEvaluator_bulildCharCodeToWidth(widthsByGlyphName, properties) {
32708      var widths = Object.create(null);
32709      var differences = properties.differences;
32710      var encoding = properties.defaultEncoding;
32711
32712      for (var charCode = 0; charCode < 256; charCode++) {
32713        if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
32714          widths[charCode] = widthsByGlyphName[differences[charCode]];
32715          continue;
32716        }
32717
32718        if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
32719          widths[charCode] = widthsByGlyphName[encoding[charCode]];
32720          continue;
32721        }
32722      }
32723
32724      return widths;
32725    },
32726    preEvaluateFont: function PartialEvaluator_preEvaluateFont(dict) {
32727      var baseDict = dict;
32728      var type = dict.get('Subtype');
32729
32730      if (!(0, _primitives.isName)(type)) {
32731        throw new _util.FormatError('invalid font Subtype');
32732      }
32733
32734      var composite = false;
32735      var uint8array;
32736
32737      if (type.name === 'Type0') {
32738        var df = dict.get('DescendantFonts');
32739
32740        if (!df) {
32741          throw new _util.FormatError('Descendant fonts are not specified');
32742        }
32743
32744        dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
32745        type = dict.get('Subtype');
32746
32747        if (!(0, _primitives.isName)(type)) {
32748          throw new _util.FormatError('invalid font Subtype');
32749        }
32750
32751        composite = true;
32752      }
32753
32754      var descriptor = dict.get('FontDescriptor');
32755
32756      if (descriptor) {
32757        var hash = new _murmurhash.MurmurHash3_64();
32758        var encoding = baseDict.getRaw('Encoding');
32759
32760        if ((0, _primitives.isName)(encoding)) {
32761          hash.update(encoding.name);
32762        } else if ((0, _primitives.isRef)(encoding)) {
32763          hash.update(encoding.toString());
32764        } else if ((0, _primitives.isDict)(encoding)) {
32765          var keys = encoding.getKeys();
32766
32767          for (var i = 0, ii = keys.length; i < ii; i++) {
32768            var entry = encoding.getRaw(keys[i]);
32769
32770            if ((0, _primitives.isName)(entry)) {
32771              hash.update(entry.name);
32772            } else if ((0, _primitives.isRef)(entry)) {
32773              hash.update(entry.toString());
32774            } else if (Array.isArray(entry)) {
32775              var diffLength = entry.length,
32776                  diffBuf = new Array(diffLength);
32777
32778              for (var j = 0; j < diffLength; j++) {
32779                var diffEntry = entry[j];
32780
32781                if ((0, _primitives.isName)(diffEntry)) {
32782                  diffBuf[j] = diffEntry.name;
32783                } else if ((0, _util.isNum)(diffEntry) || (0, _primitives.isRef)(diffEntry)) {
32784                  diffBuf[j] = diffEntry.toString();
32785                }
32786              }
32787
32788              hash.update(diffBuf.join());
32789            }
32790          }
32791        }
32792
32793        var firstChar = dict.get('FirstChar') || 0;
32794        var lastChar = dict.get('LastChar') || (composite ? 0xFFFF : 0xFF);
32795        hash.update("".concat(firstChar, "-").concat(lastChar));
32796        var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode');
32797
32798        if ((0, _primitives.isStream)(toUnicode)) {
32799          var stream = toUnicode.str || toUnicode;
32800          uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
32801          hash.update(uint8array);
32802        } else if ((0, _primitives.isName)(toUnicode)) {
32803          hash.update(toUnicode.name);
32804        }
32805
32806        var widths = dict.get('Widths') || baseDict.get('Widths');
32807
32808        if (widths) {
32809          uint8array = new Uint8Array(new Uint32Array(widths).buffer);
32810          hash.update(uint8array);
32811        }
32812      }
32813
32814      return {
32815        descriptor: descriptor,
32816        dict: dict,
32817        baseDict: baseDict,
32818        composite: composite,
32819        type: type.name,
32820        hash: hash ? hash.hexdigest() : ''
32821      };
32822    },
32823    translateFont: function PartialEvaluator_translateFont(preEvaluatedFont) {
32824      var _this10 = this;
32825
32826      var baseDict = preEvaluatedFont.baseDict;
32827      var dict = preEvaluatedFont.dict;
32828      var composite = preEvaluatedFont.composite;
32829      var descriptor = preEvaluatedFont.descriptor;
32830      var type = preEvaluatedFont.type;
32831      var maxCharIndex = composite ? 0xFFFF : 0xFF;
32832      var properties;
32833
32834      if (!descriptor) {
32835        if (type === 'Type3') {
32836          descriptor = new _primitives.Dict(null);
32837          descriptor.set('FontName', _primitives.Name.get(type));
32838          descriptor.set('FontBBox', dict.getArray('FontBBox'));
32839        } else {
32840          var baseFontName = dict.get('BaseFont');
32841
32842          if (!(0, _primitives.isName)(baseFontName)) {
32843            throw new _util.FormatError('Base font is not specified');
32844          }
32845
32846          baseFontName = baseFontName.name.replace(/[,_]/g, '-');
32847          var metrics = this.getBaseFontMetrics(baseFontName);
32848          var fontNameWoStyle = baseFontName.split('-')[0];
32849          var flags = (this.isSerifFont(fontNameWoStyle) ? _fonts.FontFlags.Serif : 0) | (metrics.monospace ? _fonts.FontFlags.FixedPitch : 0) | ((0, _standard_fonts.getSymbolsFonts)()[fontNameWoStyle] ? _fonts.FontFlags.Symbolic : _fonts.FontFlags.Nonsymbolic);
32850          properties = {
32851            type: type,
32852            name: baseFontName,
32853            widths: metrics.widths,
32854            defaultWidth: metrics.defaultWidth,
32855            flags: flags,
32856            firstChar: 0,
32857            lastChar: maxCharIndex
32858          };
32859          return this.extractDataStructures(dict, dict, properties).then(function (properties) {
32860            properties.widths = _this10.buildCharCodeToWidth(metrics.widths, properties);
32861            return new _fonts.Font(baseFontName, null, properties);
32862          });
32863        }
32864      }
32865
32866      var firstChar = dict.get('FirstChar') || 0;
32867      var lastChar = dict.get('LastChar') || maxCharIndex;
32868      var fontName = descriptor.get('FontName');
32869      var baseFont = dict.get('BaseFont');
32870
32871      if ((0, _util.isString)(fontName)) {
32872        fontName = _primitives.Name.get(fontName);
32873      }
32874
32875      if ((0, _util.isString)(baseFont)) {
32876        baseFont = _primitives.Name.get(baseFont);
32877      }
32878
32879      if (type !== 'Type3') {
32880        var fontNameStr = fontName && fontName.name;
32881        var baseFontStr = baseFont && baseFont.name;
32882
32883        if (fontNameStr !== baseFontStr) {
32884          (0, _util.info)("The FontDescriptor's FontName is \"".concat(fontNameStr, "\" but ") + "should be the same as the Font's BaseFont \"".concat(baseFontStr, "\"."));
32885
32886          if (fontNameStr && baseFontStr && baseFontStr.startsWith(fontNameStr)) {
32887            fontName = baseFont;
32888          }
32889        }
32890      }
32891
32892      fontName = fontName || baseFont;
32893
32894      if (!(0, _primitives.isName)(fontName)) {
32895        throw new _util.FormatError('invalid font name');
32896      }
32897
32898      var fontFile = descriptor.get('FontFile', 'FontFile2', 'FontFile3');
32899
32900      if (fontFile) {
32901        if (fontFile.dict) {
32902          var subtype = fontFile.dict.get('Subtype');
32903
32904          if (subtype) {
32905            subtype = subtype.name;
32906          }
32907
32908          var length1 = fontFile.dict.get('Length1');
32909          var length2 = fontFile.dict.get('Length2');
32910          var length3 = fontFile.dict.get('Length3');
32911        }
32912      }
32913
32914      properties = {
32915        type: type,
32916        name: fontName.name,
32917        subtype: subtype,
32918        file: fontFile,
32919        length1: length1,
32920        length2: length2,
32921        length3: length3,
32922        loadedName: baseDict.loadedName,
32923        composite: composite,
32924        wideChars: composite,
32925        fixedPitch: false,
32926        fontMatrix: dict.getArray('FontMatrix') || _util.FONT_IDENTITY_MATRIX,
32927        firstChar: firstChar || 0,
32928        lastChar: lastChar || maxCharIndex,
32929        bbox: descriptor.getArray('FontBBox'),
32930        ascent: descriptor.get('Ascent'),
32931        descent: descriptor.get('Descent'),
32932        xHeight: descriptor.get('XHeight'),
32933        capHeight: descriptor.get('CapHeight'),
32934        flags: descriptor.get('Flags'),
32935        italicAngle: descriptor.get('ItalicAngle'),
32936        isType3Font: false
32937      };
32938      var cMapPromise;
32939
32940      if (composite) {
32941        var cidEncoding = baseDict.get('Encoding');
32942
32943        if ((0, _primitives.isName)(cidEncoding)) {
32944          properties.cidEncoding = cidEncoding.name;
32945        }
32946
32947        cMapPromise = _cmap.CMapFactory.create({
32948          encoding: cidEncoding,
32949          fetchBuiltInCMap: this.fetchBuiltInCMap,
32950          useCMap: null
32951        }).then(function (cMap) {
32952          properties.cMap = cMap;
32953          properties.vertical = properties.cMap.vertical;
32954        });
32955      } else {
32956        cMapPromise = Promise.resolve(undefined);
32957      }
32958
32959      return cMapPromise.then(function () {
32960        return _this10.extractDataStructures(dict, baseDict, properties);
32961      }).then(function (properties) {
32962        _this10.extractWidths(dict, descriptor, properties);
32963
32964        if (type === 'Type3') {
32965          properties.isType3Font = true;
32966        }
32967
32968        return new _fonts.Font(fontName.name, fontFile, properties);
32969      });
32970    }
32971  };
32972
32973  PartialEvaluator.buildFontPaths = function (font, glyphs, handler) {
32974    function buildPath(fontChar) {
32975      if (font.renderer.hasBuiltPath(fontChar)) {
32976        return;
32977      }
32978
32979      handler.send('commonobj', ["".concat(font.loadedName, "_path_").concat(fontChar), 'FontPath', font.renderer.getPathJs(fontChar)]);
32980    }
32981
32982    var _iteratorNormalCompletion = true;
32983    var _didIteratorError = false;
32984    var _iteratorError = undefined;
32985
32986    try {
32987      for (var _iterator = glyphs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
32988        var glyph = _step.value;
32989        buildPath(glyph.fontChar);
32990        var accent = glyph.accent;
32991
32992        if (accent && accent.fontChar) {
32993          buildPath(accent.fontChar);
32994        }
32995      }
32996    } catch (err) {
32997      _didIteratorError = true;
32998      _iteratorError = err;
32999    } finally {
33000      try {
33001        if (!_iteratorNormalCompletion && _iterator["return"] != null) {
33002          _iterator["return"]();
33003        }
33004      } finally {
33005        if (_didIteratorError) {
33006          throw _iteratorError;
33007        }
33008      }
33009    }
33010  };
33011
33012  return PartialEvaluator;
33013}();
33014
33015exports.PartialEvaluator = PartialEvaluator;
33016
33017var TranslatedFont = function TranslatedFontClosure() {
33018  function TranslatedFont(loadedName, font, dict) {
33019    this.loadedName = loadedName;
33020    this.font = font;
33021    this.dict = dict;
33022    this.type3Loaded = null;
33023    this.sent = false;
33024  }
33025
33026  TranslatedFont.prototype = {
33027    send: function send(handler) {
33028      if (this.sent) {
33029        return;
33030      }
33031
33032      this.sent = true;
33033      handler.send('commonobj', [this.loadedName, 'Font', this.font.exportData()]);
33034    },
33035    fallback: function fallback(handler) {
33036      if (!this.font.data) {
33037        return;
33038      }
33039
33040      this.font.disableFontFace = true;
33041      var glyphs = this.font.glyphCacheValues;
33042      PartialEvaluator.buildFontPaths(this.font, glyphs, handler);
33043    },
33044    loadType3Data: function loadType3Data(evaluator, resources, parentOperatorList, task) {
33045      if (!this.font.isType3Font) {
33046        throw new Error('Must be a Type3 font.');
33047      }
33048
33049      if (this.type3Loaded) {
33050        return this.type3Loaded;
33051      }
33052
33053      var type3Options = Object.create(evaluator.options);
33054      type3Options.ignoreErrors = false;
33055      type3Options.nativeImageDecoderSupport = _util.NativeImageDecoding.NONE;
33056      var type3Evaluator = evaluator.clone(type3Options);
33057      type3Evaluator.parsingType3Font = true;
33058      var translatedFont = this.font;
33059      var loadCharProcsPromise = Promise.resolve();
33060      var charProcs = this.dict.get('CharProcs');
33061      var fontResources = this.dict.get('Resources') || resources;
33062      var charProcKeys = charProcs.getKeys();
33063      var charProcOperatorList = Object.create(null);
33064
33065      var _loop2 = function _loop2() {
33066        var key = charProcKeys[i];
33067        loadCharProcsPromise = loadCharProcsPromise.then(function () {
33068          var glyphStream = charProcs.get(key);
33069          var operatorList = new _operator_list.OperatorList();
33070          return type3Evaluator.getOperatorList({
33071            stream: glyphStream,
33072            task: task,
33073            resources: fontResources,
33074            operatorList: operatorList
33075          }).then(function () {
33076            charProcOperatorList[key] = operatorList.getIR();
33077            parentOperatorList.addDependencies(operatorList.dependencies);
33078          })["catch"](function (reason) {
33079            (0, _util.warn)("Type3 font resource \"".concat(key, "\" is not available."));
33080            var operatorList = new _operator_list.OperatorList();
33081            charProcOperatorList[key] = operatorList.getIR();
33082          });
33083        });
33084      };
33085
33086      for (var i = 0, n = charProcKeys.length; i < n; ++i) {
33087        _loop2();
33088      }
33089
33090      this.type3Loaded = loadCharProcsPromise.then(function () {
33091        translatedFont.charProcOperatorList = charProcOperatorList;
33092      });
33093      return this.type3Loaded;
33094    }
33095  };
33096  return TranslatedFont;
33097}();
33098
33099var StateManager = function StateManagerClosure() {
33100  function StateManager(initialState) {
33101    this.state = initialState;
33102    this.stateStack = [];
33103  }
33104
33105  StateManager.prototype = {
33106    save: function save() {
33107      var old = this.state;
33108      this.stateStack.push(this.state);
33109      this.state = old.clone();
33110    },
33111    restore: function restore() {
33112      var prev = this.stateStack.pop();
33113
33114      if (prev) {
33115        this.state = prev;
33116      }
33117    },
33118    transform: function transform(args) {
33119      this.state.ctm = _util.Util.transform(this.state.ctm, args);
33120    }
33121  };
33122  return StateManager;
33123}();
33124
33125var TextState = function TextStateClosure() {
33126  function TextState() {
33127    this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
33128    this.fontName = null;
33129    this.fontSize = 0;
33130    this.font = null;
33131    this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
33132    this.textMatrix = _util.IDENTITY_MATRIX.slice();
33133    this.textLineMatrix = _util.IDENTITY_MATRIX.slice();
33134    this.charSpacing = 0;
33135    this.wordSpacing = 0;
33136    this.leading = 0;
33137    this.textHScale = 1;
33138    this.textRise = 0;
33139  }
33140
33141  TextState.prototype = {
33142    setTextMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) {
33143      var m = this.textMatrix;
33144      m[0] = a;
33145      m[1] = b;
33146      m[2] = c;
33147      m[3] = d;
33148      m[4] = e;
33149      m[5] = f;
33150    },
33151    setTextLineMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) {
33152      var m = this.textLineMatrix;
33153      m[0] = a;
33154      m[1] = b;
33155      m[2] = c;
33156      m[3] = d;
33157      m[4] = e;
33158      m[5] = f;
33159    },
33160    translateTextMatrix: function TextState_translateTextMatrix(x, y) {
33161      var m = this.textMatrix;
33162      m[4] = m[0] * x + m[2] * y + m[4];
33163      m[5] = m[1] * x + m[3] * y + m[5];
33164    },
33165    translateTextLineMatrix: function TextState_translateTextMatrix(x, y) {
33166      var m = this.textLineMatrix;
33167      m[4] = m[0] * x + m[2] * y + m[4];
33168      m[5] = m[1] * x + m[3] * y + m[5];
33169    },
33170    calcTextLineMatrixAdvance: function TextState_calcTextLineMatrixAdvance(a, b, c, d, e, f) {
33171      var font = this.font;
33172
33173      if (!font) {
33174        return null;
33175      }
33176
33177      var m = this.textLineMatrix;
33178
33179      if (!(a === m[0] && b === m[1] && c === m[2] && d === m[3])) {
33180        return null;
33181      }
33182
33183      var txDiff = e - m[4],
33184          tyDiff = f - m[5];
33185
33186      if (font.vertical && txDiff !== 0 || !font.vertical && tyDiff !== 0) {
33187        return null;
33188      }
33189
33190      var tx,
33191          ty,
33192          denominator = a * d - b * c;
33193
33194      if (font.vertical) {
33195        tx = -tyDiff * c / denominator;
33196        ty = tyDiff * a / denominator;
33197      } else {
33198        tx = txDiff * d / denominator;
33199        ty = -txDiff * b / denominator;
33200      }
33201
33202      return {
33203        width: tx,
33204        height: ty,
33205        value: font.vertical ? ty : tx
33206      };
33207    },
33208    calcRenderMatrix: function TextState_calcRendeMatrix(ctm) {
33209      var tsm = [this.fontSize * this.textHScale, 0, 0, this.fontSize, 0, this.textRise];
33210      return _util.Util.transform(ctm, _util.Util.transform(this.textMatrix, tsm));
33211    },
33212    carriageReturn: function TextState_carriageReturn() {
33213      this.translateTextLineMatrix(0, -this.leading);
33214      this.textMatrix = this.textLineMatrix.slice();
33215    },
33216    clone: function TextState_clone() {
33217      var clone = Object.create(this);
33218      clone.textMatrix = this.textMatrix.slice();
33219      clone.textLineMatrix = this.textLineMatrix.slice();
33220      clone.fontMatrix = this.fontMatrix.slice();
33221      return clone;
33222    }
33223  };
33224  return TextState;
33225}();
33226
33227var EvalState = function EvalStateClosure() {
33228  function EvalState() {
33229    this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
33230    this.font = null;
33231    this.textRenderingMode = _util.TextRenderingMode.FILL;
33232    this.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
33233    this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
33234  }
33235
33236  EvalState.prototype = {
33237    clone: function CanvasExtraState_clone() {
33238      return Object.create(this);
33239    }
33240  };
33241  return EvalState;
33242}();
33243
33244var EvaluatorPreprocessor = function EvaluatorPreprocessorClosure() {
33245  var getOPMap = (0, _core_utils.getLookupTableFactory)(function (t) {
33246    t['w'] = {
33247      id: _util.OPS.setLineWidth,
33248      numArgs: 1,
33249      variableArgs: false
33250    };
33251    t['J'] = {
33252      id: _util.OPS.setLineCap,
33253      numArgs: 1,
33254      variableArgs: false
33255    };
33256    t['j'] = {
33257      id: _util.OPS.setLineJoin,
33258      numArgs: 1,
33259      variableArgs: false
33260    };
33261    t['M'] = {
33262      id: _util.OPS.setMiterLimit,
33263      numArgs: 1,
33264      variableArgs: false
33265    };
33266    t['d'] = {
33267      id: _util.OPS.setDash,
33268      numArgs: 2,
33269      variableArgs: false
33270    };
33271    t['ri'] = {
33272      id: _util.OPS.setRenderingIntent,
33273      numArgs: 1,
33274      variableArgs: false
33275    };
33276    t['i'] = {
33277      id: _util.OPS.setFlatness,
33278      numArgs: 1,
33279      variableArgs: false
33280    };
33281    t['gs'] = {
33282      id: _util.OPS.setGState,
33283      numArgs: 1,
33284      variableArgs: false
33285    };
33286    t['q'] = {
33287      id: _util.OPS.save,
33288      numArgs: 0,
33289      variableArgs: false
33290    };
33291    t['Q'] = {
33292      id: _util.OPS.restore,
33293      numArgs: 0,
33294      variableArgs: false
33295    };
33296    t['cm'] = {
33297      id: _util.OPS.transform,
33298      numArgs: 6,
33299      variableArgs: false
33300    };
33301    t['m'] = {
33302      id: _util.OPS.moveTo,
33303      numArgs: 2,
33304      variableArgs: false
33305    };
33306    t['l'] = {
33307      id: _util.OPS.lineTo,
33308      numArgs: 2,
33309      variableArgs: false
33310    };
33311    t['c'] = {
33312      id: _util.OPS.curveTo,
33313      numArgs: 6,
33314      variableArgs: false
33315    };
33316    t['v'] = {
33317      id: _util.OPS.curveTo2,
33318      numArgs: 4,
33319      variableArgs: false
33320    };
33321    t['y'] = {
33322      id: _util.OPS.curveTo3,
33323      numArgs: 4,
33324      variableArgs: false
33325    };
33326    t['h'] = {
33327      id: _util.OPS.closePath,
33328      numArgs: 0,
33329      variableArgs: false
33330    };
33331    t['re'] = {
33332      id: _util.OPS.rectangle,
33333      numArgs: 4,
33334      variableArgs: false
33335    };
33336    t['S'] = {
33337      id: _util.OPS.stroke,
33338      numArgs: 0,
33339      variableArgs: false
33340    };
33341    t['s'] = {
33342      id: _util.OPS.closeStroke,
33343      numArgs: 0,
33344      variableArgs: false
33345    };
33346    t['f'] = {
33347      id: _util.OPS.fill,
33348      numArgs: 0,
33349      variableArgs: false
33350    };
33351    t['F'] = {
33352      id: _util.OPS.fill,
33353      numArgs: 0,
33354      variableArgs: false
33355    };
33356    t['f*'] = {
33357      id: _util.OPS.eoFill,
33358      numArgs: 0,
33359      variableArgs: false
33360    };
33361    t['B'] = {
33362      id: _util.OPS.fillStroke,
33363      numArgs: 0,
33364      variableArgs: false
33365    };
33366    t['B*'] = {
33367      id: _util.OPS.eoFillStroke,
33368      numArgs: 0,
33369      variableArgs: false
33370    };
33371    t['b'] = {
33372      id: _util.OPS.closeFillStroke,
33373      numArgs: 0,
33374      variableArgs: false
33375    };
33376    t['b*'] = {
33377      id: _util.OPS.closeEOFillStroke,
33378      numArgs: 0,
33379      variableArgs: false
33380    };
33381    t['n'] = {
33382      id: _util.OPS.endPath,
33383      numArgs: 0,
33384      variableArgs: false
33385    };
33386    t['W'] = {
33387      id: _util.OPS.clip,
33388      numArgs: 0,
33389      variableArgs: false
33390    };
33391    t['W*'] = {
33392      id: _util.OPS.eoClip,
33393      numArgs: 0,
33394      variableArgs: false
33395    };
33396    t['BT'] = {
33397      id: _util.OPS.beginText,
33398      numArgs: 0,
33399      variableArgs: false
33400    };
33401    t['ET'] = {
33402      id: _util.OPS.endText,
33403      numArgs: 0,
33404      variableArgs: false
33405    };
33406    t['Tc'] = {
33407      id: _util.OPS.setCharSpacing,
33408      numArgs: 1,
33409      variableArgs: false
33410    };
33411    t['Tw'] = {
33412      id: _util.OPS.setWordSpacing,
33413      numArgs: 1,
33414      variableArgs: false
33415    };
33416    t['Tz'] = {
33417      id: _util.OPS.setHScale,
33418      numArgs: 1,
33419      variableArgs: false
33420    };
33421    t['TL'] = {
33422      id: _util.OPS.setLeading,
33423      numArgs: 1,
33424      variableArgs: false
33425    };
33426    t['Tf'] = {
33427      id: _util.OPS.setFont,
33428      numArgs: 2,
33429      variableArgs: false
33430    };
33431    t['Tr'] = {
33432      id: _util.OPS.setTextRenderingMode,
33433      numArgs: 1,
33434      variableArgs: false
33435    };
33436    t['Ts'] = {
33437      id: _util.OPS.setTextRise,
33438      numArgs: 1,
33439      variableArgs: false
33440    };
33441    t['Td'] = {
33442      id: _util.OPS.moveText,
33443      numArgs: 2,
33444      variableArgs: false
33445    };
33446    t['TD'] = {
33447      id: _util.OPS.setLeadingMoveText,
33448      numArgs: 2,
33449      variableArgs: false
33450    };
33451    t['Tm'] = {
33452      id: _util.OPS.setTextMatrix,
33453      numArgs: 6,
33454      variableArgs: false
33455    };
33456    t['T*'] = {
33457      id: _util.OPS.nextLine,
33458      numArgs: 0,
33459      variableArgs: false
33460    };
33461    t['Tj'] = {
33462      id: _util.OPS.showText,
33463      numArgs: 1,
33464      variableArgs: false
33465    };
33466    t['TJ'] = {
33467      id: _util.OPS.showSpacedText,
33468      numArgs: 1,
33469      variableArgs: false
33470    };
33471    t['\''] = {
33472      id: _util.OPS.nextLineShowText,
33473      numArgs: 1,
33474      variableArgs: false
33475    };
33476    t['"'] = {
33477      id: _util.OPS.nextLineSetSpacingShowText,
33478      numArgs: 3,
33479      variableArgs: false
33480    };
33481    t['d0'] = {
33482      id: _util.OPS.setCharWidth,
33483      numArgs: 2,
33484      variableArgs: false
33485    };
33486    t['d1'] = {
33487      id: _util.OPS.setCharWidthAndBounds,
33488      numArgs: 6,
33489      variableArgs: false
33490    };
33491    t['CS'] = {
33492      id: _util.OPS.setStrokeColorSpace,
33493      numArgs: 1,
33494      variableArgs: false
33495    };
33496    t['cs'] = {
33497      id: _util.OPS.setFillColorSpace,
33498      numArgs: 1,
33499      variableArgs: false
33500    };
33501    t['SC'] = {
33502      id: _util.OPS.setStrokeColor,
33503      numArgs: 4,
33504      variableArgs: true
33505    };
33506    t['SCN'] = {
33507      id: _util.OPS.setStrokeColorN,
33508      numArgs: 33,
33509      variableArgs: true
33510    };
33511    t['sc'] = {
33512      id: _util.OPS.setFillColor,
33513      numArgs: 4,
33514      variableArgs: true
33515    };
33516    t['scn'] = {
33517      id: _util.OPS.setFillColorN,
33518      numArgs: 33,
33519      variableArgs: true
33520    };
33521    t['G'] = {
33522      id: _util.OPS.setStrokeGray,
33523      numArgs: 1,
33524      variableArgs: false
33525    };
33526    t['g'] = {
33527      id: _util.OPS.setFillGray,
33528      numArgs: 1,
33529      variableArgs: false
33530    };
33531    t['RG'] = {
33532      id: _util.OPS.setStrokeRGBColor,
33533      numArgs: 3,
33534      variableArgs: false
33535    };
33536    t['rg'] = {
33537      id: _util.OPS.setFillRGBColor,
33538      numArgs: 3,
33539      variableArgs: false
33540    };
33541    t['K'] = {
33542      id: _util.OPS.setStrokeCMYKColor,
33543      numArgs: 4,
33544      variableArgs: false
33545    };
33546    t['k'] = {
33547      id: _util.OPS.setFillCMYKColor,
33548      numArgs: 4,
33549      variableArgs: false
33550    };
33551    t['sh'] = {
33552      id: _util.OPS.shadingFill,
33553      numArgs: 1,
33554      variableArgs: false
33555    };
33556    t['BI'] = {
33557      id: _util.OPS.beginInlineImage,
33558      numArgs: 0,
33559      variableArgs: false
33560    };
33561    t['ID'] = {
33562      id: _util.OPS.beginImageData,
33563      numArgs: 0,
33564      variableArgs: false
33565    };
33566    t['EI'] = {
33567      id: _util.OPS.endInlineImage,
33568      numArgs: 1,
33569      variableArgs: false
33570    };
33571    t['Do'] = {
33572      id: _util.OPS.paintXObject,
33573      numArgs: 1,
33574      variableArgs: false
33575    };
33576    t['MP'] = {
33577      id: _util.OPS.markPoint,
33578      numArgs: 1,
33579      variableArgs: false
33580    };
33581    t['DP'] = {
33582      id: _util.OPS.markPointProps,
33583      numArgs: 2,
33584      variableArgs: false
33585    };
33586    t['BMC'] = {
33587      id: _util.OPS.beginMarkedContent,
33588      numArgs: 1,
33589      variableArgs: false
33590    };
33591    t['BDC'] = {
33592      id: _util.OPS.beginMarkedContentProps,
33593      numArgs: 2,
33594      variableArgs: false
33595    };
33596    t['EMC'] = {
33597      id: _util.OPS.endMarkedContent,
33598      numArgs: 0,
33599      variableArgs: false
33600    };
33601    t['BX'] = {
33602      id: _util.OPS.beginCompat,
33603      numArgs: 0,
33604      variableArgs: false
33605    };
33606    t['EX'] = {
33607      id: _util.OPS.endCompat,
33608      numArgs: 0,
33609      variableArgs: false
33610    };
33611    t['BM'] = null;
33612    t['BD'] = null;
33613    t['true'] = null;
33614    t['fa'] = null;
33615    t['fal'] = null;
33616    t['fals'] = null;
33617    t['false'] = null;
33618    t['nu'] = null;
33619    t['nul'] = null;
33620    t['null'] = null;
33621  });
33622  var MAX_INVALID_PATH_OPS = 20;
33623
33624  function EvaluatorPreprocessor(stream, xref, stateManager) {
33625    this.opMap = getOPMap();
33626    this.parser = new _parser.Parser({
33627      lexer: new _parser.Lexer(stream, this.opMap),
33628      xref: xref
33629    });
33630    this.stateManager = stateManager;
33631    this.nonProcessedArgs = [];
33632    this._numInvalidPathOPS = 0;
33633  }
33634
33635  EvaluatorPreprocessor.prototype = {
33636    get savedStatesDepth() {
33637      return this.stateManager.stateStack.length;
33638    },
33639
33640    read: function EvaluatorPreprocessor_read(operation) {
33641      var args = operation.args;
33642
33643      while (true) {
33644        var obj = this.parser.getObj();
33645
33646        if ((0, _primitives.isCmd)(obj)) {
33647          var cmd = obj.cmd;
33648          var opSpec = this.opMap[cmd];
33649
33650          if (!opSpec) {
33651            (0, _util.warn)("Unknown command \"".concat(cmd, "\"."));
33652            continue;
33653          }
33654
33655          var fn = opSpec.id;
33656          var numArgs = opSpec.numArgs;
33657          var argsLength = args !== null ? args.length : 0;
33658
33659          if (!opSpec.variableArgs) {
33660            if (argsLength !== numArgs) {
33661              var nonProcessedArgs = this.nonProcessedArgs;
33662
33663              while (argsLength > numArgs) {
33664                nonProcessedArgs.push(args.shift());
33665                argsLength--;
33666              }
33667
33668              while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
33669                if (args === null) {
33670                  args = [];
33671                }
33672
33673                args.unshift(nonProcessedArgs.pop());
33674                argsLength++;
33675              }
33676            }
33677
33678            if (argsLength < numArgs) {
33679              var partialMsg = "command ".concat(cmd, ": expected ").concat(numArgs, " args, ") + "but received ".concat(argsLength, " args.");
33680
33681              if (fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath && ++this._numInvalidPathOPS > MAX_INVALID_PATH_OPS) {
33682                throw new _util.FormatError("Invalid ".concat(partialMsg));
33683              }
33684
33685              (0, _util.warn)("Skipping ".concat(partialMsg));
33686
33687              if (args !== null) {
33688                args.length = 0;
33689              }
33690
33691              continue;
33692            }
33693          } else if (argsLength > numArgs) {
33694            (0, _util.info)("Command ".concat(cmd, ": expected [0, ").concat(numArgs, "] args, ") + "but received ".concat(argsLength, " args."));
33695          }
33696
33697          this.preprocessCommand(fn, args);
33698          operation.fn = fn;
33699          operation.args = args;
33700          return true;
33701        }
33702
33703        if ((0, _primitives.isEOF)(obj)) {
33704          return false;
33705        }
33706
33707        if (obj !== null) {
33708          if (args === null) {
33709            args = [];
33710          }
33711
33712          args.push(obj);
33713
33714          if (args.length > 33) {
33715            throw new _util.FormatError('Too many arguments');
33716          }
33717        }
33718      }
33719    },
33720    preprocessCommand: function EvaluatorPreprocessor_preprocessCommand(fn, args) {
33721      switch (fn | 0) {
33722        case _util.OPS.save:
33723          this.stateManager.save();
33724          break;
33725
33726        case _util.OPS.restore:
33727          this.stateManager.restore();
33728          break;
33729
33730        case _util.OPS.transform:
33731          this.stateManager.transform(args);
33732          break;
33733      }
33734    }
33735  };
33736  return EvaluatorPreprocessor;
33737}();
33738
33739/***/ }),
33740/* 173 */
33741/***/ (function(module, exports, __w_pdfjs_require__) {
33742
33743"use strict";
33744
33745
33746Object.defineProperty(exports, "__esModule", {
33747  value: true
33748});
33749exports.CMapFactory = exports.IdentityCMap = exports.CMap = void 0;
33750
33751var _util = __w_pdfjs_require__(5);
33752
33753var _primitives = __w_pdfjs_require__(151);
33754
33755var _parser = __w_pdfjs_require__(157);
33756
33757var _core_utils = __w_pdfjs_require__(154);
33758
33759var _stream = __w_pdfjs_require__(158);
33760
33761function _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); }
33762
33763function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
33764
33765function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
33766
33767function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
33768
33769function _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); }
33770
33771function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
33772
33773function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
33774
33775function _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); } }
33776
33777function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
33778
33779var 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'];
33780
33781var CMap =
33782/*#__PURE__*/
33783function () {
33784  function CMap() {
33785    var builtInCMap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
33786
33787    _classCallCheck(this, CMap);
33788
33789    this.codespaceRanges = [[], [], [], []];
33790    this.numCodespaceRanges = 0;
33791    this._map = [];
33792    this.name = '';
33793    this.vertical = false;
33794    this.useCMap = null;
33795    this.builtInCMap = builtInCMap;
33796  }
33797
33798  _createClass(CMap, [{
33799    key: "addCodespaceRange",
33800    value: function addCodespaceRange(n, low, high) {
33801      this.codespaceRanges[n - 1].push(low, high);
33802      this.numCodespaceRanges++;
33803    }
33804  }, {
33805    key: "mapCidRange",
33806    value: function mapCidRange(low, high, dstLow) {
33807      while (low <= high) {
33808        this._map[low++] = dstLow++;
33809      }
33810    }
33811  }, {
33812    key: "mapBfRange",
33813    value: function mapBfRange(low, high, dstLow) {
33814      var lastByte = dstLow.length - 1;
33815
33816      while (low <= high) {
33817        this._map[low++] = dstLow;
33818        dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1);
33819      }
33820    }
33821  }, {
33822    key: "mapBfRangeToArray",
33823    value: function mapBfRangeToArray(low, high, array) {
33824      var i = 0,
33825          ii = array.length;
33826
33827      while (low <= high && i < ii) {
33828        this._map[low] = array[i++];
33829        ++low;
33830      }
33831    }
33832  }, {
33833    key: "mapOne",
33834    value: function mapOne(src, dst) {
33835      this._map[src] = dst;
33836    }
33837  }, {
33838    key: "lookup",
33839    value: function lookup(code) {
33840      return this._map[code];
33841    }
33842  }, {
33843    key: "contains",
33844    value: function contains(code) {
33845      return this._map[code] !== undefined;
33846    }
33847  }, {
33848    key: "forEach",
33849    value: function forEach(callback) {
33850      var map = this._map;
33851      var length = map.length;
33852
33853      if (length <= 0x10000) {
33854        for (var i = 0; i < length; i++) {
33855          if (map[i] !== undefined) {
33856            callback(i, map[i]);
33857          }
33858        }
33859      } else {
33860        for (var _i in map) {
33861          callback(_i, map[_i]);
33862        }
33863      }
33864    }
33865  }, {
33866    key: "charCodeOf",
33867    value: function charCodeOf(value) {
33868      var map = this._map;
33869
33870      if (map.length <= 0x10000) {
33871        return map.indexOf(value);
33872      }
33873
33874      for (var charCode in map) {
33875        if (map[charCode] === value) {
33876          return charCode | 0;
33877        }
33878      }
33879
33880      return -1;
33881    }
33882  }, {
33883    key: "getMap",
33884    value: function getMap() {
33885      return this._map;
33886    }
33887  }, {
33888    key: "readCharCode",
33889    value: function readCharCode(str, offset, out) {
33890      var c = 0;
33891      var codespaceRanges = this.codespaceRanges;
33892
33893      for (var n = 0, nn = codespaceRanges.length; n < nn; n++) {
33894        c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
33895        var codespaceRange = codespaceRanges[n];
33896
33897        for (var k = 0, kk = codespaceRange.length; k < kk;) {
33898          var low = codespaceRange[k++];
33899          var high = codespaceRange[k++];
33900
33901          if (c >= low && c <= high) {
33902            out.charcode = c;
33903            out.length = n + 1;
33904            return;
33905          }
33906        }
33907      }
33908
33909      out.charcode = 0;
33910      out.length = 1;
33911    }
33912  }, {
33913    key: "length",
33914    get: function get() {
33915      return this._map.length;
33916    }
33917  }, {
33918    key: "isIdentityCMap",
33919    get: function get() {
33920      if (!(this.name === 'Identity-H' || this.name === 'Identity-V')) {
33921        return false;
33922      }
33923
33924      if (this._map.length !== 0x10000) {
33925        return false;
33926      }
33927
33928      for (var i = 0; i < 0x10000; i++) {
33929        if (this._map[i] !== i) {
33930          return false;
33931        }
33932      }
33933
33934      return true;
33935    }
33936  }]);
33937
33938  return CMap;
33939}();
33940
33941exports.CMap = CMap;
33942
33943var IdentityCMap =
33944/*#__PURE__*/
33945function (_CMap) {
33946  _inherits(IdentityCMap, _CMap);
33947
33948  function IdentityCMap(vertical, n) {
33949    var _this;
33950
33951    _classCallCheck(this, IdentityCMap);
33952
33953    _this = _possibleConstructorReturn(this, _getPrototypeOf(IdentityCMap).call(this));
33954    _this.vertical = vertical;
33955
33956    _this.addCodespaceRange(n, 0, 0xffff);
33957
33958    return _this;
33959  }
33960
33961  _createClass(IdentityCMap, [{
33962    key: "mapCidRange",
33963    value: function mapCidRange(low, high, dstLow) {
33964      (0, _util.unreachable)('should not call mapCidRange');
33965    }
33966  }, {
33967    key: "mapBfRange",
33968    value: function mapBfRange(low, high, dstLow) {
33969      (0, _util.unreachable)('should not call mapBfRange');
33970    }
33971  }, {
33972    key: "mapBfRangeToArray",
33973    value: function mapBfRangeToArray(low, high, array) {
33974      (0, _util.unreachable)('should not call mapBfRangeToArray');
33975    }
33976  }, {
33977    key: "mapOne",
33978    value: function mapOne(src, dst) {
33979      (0, _util.unreachable)('should not call mapCidOne');
33980    }
33981  }, {
33982    key: "lookup",
33983    value: function lookup(code) {
33984      return Number.isInteger(code) && code <= 0xffff ? code : undefined;
33985    }
33986  }, {
33987    key: "contains",
33988    value: function contains(code) {
33989      return Number.isInteger(code) && code <= 0xffff;
33990    }
33991  }, {
33992    key: "forEach",
33993    value: function forEach(callback) {
33994      for (var i = 0; i <= 0xffff; i++) {
33995        callback(i, i);
33996      }
33997    }
33998  }, {
33999    key: "charCodeOf",
34000    value: function charCodeOf(value) {
34001      return Number.isInteger(value) && value <= 0xffff ? value : -1;
34002    }
34003  }, {
34004    key: "getMap",
34005    value: function getMap() {
34006      var map = new Array(0x10000);
34007
34008      for (var i = 0; i <= 0xffff; i++) {
34009        map[i] = i;
34010      }
34011
34012      return map;
34013    }
34014  }, {
34015    key: "length",
34016    get: function get() {
34017      return 0x10000;
34018    }
34019  }, {
34020    key: "isIdentityCMap",
34021    get: function get() {
34022      (0, _util.unreachable)('should not access .isIdentityCMap');
34023    }
34024  }]);
34025
34026  return IdentityCMap;
34027}(CMap);
34028
34029exports.IdentityCMap = IdentityCMap;
34030
34031var BinaryCMapReader = function BinaryCMapReaderClosure() {
34032  function hexToInt(a, size) {
34033    var n = 0;
34034
34035    for (var i = 0; i <= size; i++) {
34036      n = n << 8 | a[i];
34037    }
34038
34039    return n >>> 0;
34040  }
34041
34042  function hexToStr(a, size) {
34043    if (size === 1) {
34044      return String.fromCharCode(a[0], a[1]);
34045    }
34046
34047    if (size === 3) {
34048      return String.fromCharCode(a[0], a[1], a[2], a[3]);
34049    }
34050
34051    return String.fromCharCode.apply(null, a.subarray(0, size + 1));
34052  }
34053
34054  function addHex(a, b, size) {
34055    var c = 0;
34056
34057    for (var i = size; i >= 0; i--) {
34058      c += a[i] + b[i];
34059      a[i] = c & 255;
34060      c >>= 8;
34061    }
34062  }
34063
34064  function incHex(a, size) {
34065    var c = 1;
34066
34067    for (var i = size; i >= 0 && c > 0; i--) {
34068      c += a[i];
34069      a[i] = c & 255;
34070      c >>= 8;
34071    }
34072  }
34073
34074  var MAX_NUM_SIZE = 16;
34075  var MAX_ENCODED_NUM_SIZE = 19;
34076
34077  function BinaryCMapStream(data) {
34078    this.buffer = data;
34079    this.pos = 0;
34080    this.end = data.length;
34081    this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
34082  }
34083
34084  BinaryCMapStream.prototype = {
34085    readByte: function readByte() {
34086      if (this.pos >= this.end) {
34087        return -1;
34088      }
34089
34090      return this.buffer[this.pos++];
34091    },
34092    readNumber: function readNumber() {
34093      var n = 0;
34094      var last;
34095
34096      do {
34097        var b = this.readByte();
34098
34099        if (b < 0) {
34100          throw new _util.FormatError('unexpected EOF in bcmap');
34101        }
34102
34103        last = !(b & 0x80);
34104        n = n << 7 | b & 0x7F;
34105      } while (!last);
34106
34107      return n;
34108    },
34109    readSigned: function readSigned() {
34110      var n = this.readNumber();
34111      return n & 1 ? ~(n >>> 1) : n >>> 1;
34112    },
34113    readHex: function readHex(num, size) {
34114      num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
34115      this.pos += size + 1;
34116    },
34117    readHexNumber: function readHexNumber(num, size) {
34118      var last;
34119      var stack = this.tmpBuf,
34120          sp = 0;
34121
34122      do {
34123        var b = this.readByte();
34124
34125        if (b < 0) {
34126          throw new _util.FormatError('unexpected EOF in bcmap');
34127        }
34128
34129        last = !(b & 0x80);
34130        stack[sp++] = b & 0x7F;
34131      } while (!last);
34132
34133      var i = size,
34134          buffer = 0,
34135          bufferSize = 0;
34136
34137      while (i >= 0) {
34138        while (bufferSize < 8 && stack.length > 0) {
34139          buffer = stack[--sp] << bufferSize | buffer;
34140          bufferSize += 7;
34141        }
34142
34143        num[i] = buffer & 255;
34144        i--;
34145        buffer >>= 8;
34146        bufferSize -= 8;
34147      }
34148    },
34149    readHexSigned: function readHexSigned(num, size) {
34150      this.readHexNumber(num, size);
34151      var sign = num[size] & 1 ? 255 : 0;
34152      var c = 0;
34153
34154      for (var i = 0; i <= size; i++) {
34155        c = (c & 1) << 8 | num[i];
34156        num[i] = c >> 1 ^ sign;
34157      }
34158    },
34159    readString: function readString() {
34160      var len = this.readNumber();
34161      var s = '';
34162
34163      for (var i = 0; i < len; i++) {
34164        s += String.fromCharCode(this.readNumber());
34165      }
34166
34167      return s;
34168    }
34169  };
34170
34171  function processBinaryCMap(data, cMap, extend) {
34172    return new Promise(function (resolve, reject) {
34173      var stream = new BinaryCMapStream(data);
34174      var header = stream.readByte();
34175      cMap.vertical = !!(header & 1);
34176      var useCMap = null;
34177      var start = new Uint8Array(MAX_NUM_SIZE);
34178      var end = new Uint8Array(MAX_NUM_SIZE);
34179
34180      var _char = new Uint8Array(MAX_NUM_SIZE);
34181
34182      var charCode = new Uint8Array(MAX_NUM_SIZE);
34183      var tmp = new Uint8Array(MAX_NUM_SIZE);
34184      var code;
34185      var b;
34186
34187      while ((b = stream.readByte()) >= 0) {
34188        var type = b >> 5;
34189
34190        if (type === 7) {
34191          switch (b & 0x1F) {
34192            case 0:
34193              stream.readString();
34194              break;
34195
34196            case 1:
34197              useCMap = stream.readString();
34198              break;
34199          }
34200
34201          continue;
34202        }
34203
34204        var sequence = !!(b & 0x10);
34205        var dataSize = b & 15;
34206
34207        if (dataSize + 1 > MAX_NUM_SIZE) {
34208          throw new Error('processBinaryCMap: Invalid dataSize.');
34209        }
34210
34211        var ucs2DataSize = 1;
34212        var subitemsCount = stream.readNumber();
34213        var i;
34214
34215        switch (type) {
34216          case 0:
34217            stream.readHex(start, dataSize);
34218            stream.readHexNumber(end, dataSize);
34219            addHex(end, start, dataSize);
34220            cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
34221
34222            for (i = 1; i < subitemsCount; i++) {
34223              incHex(end, dataSize);
34224              stream.readHexNumber(start, dataSize);
34225              addHex(start, end, dataSize);
34226              stream.readHexNumber(end, dataSize);
34227              addHex(end, start, dataSize);
34228              cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
34229            }
34230
34231            break;
34232
34233          case 1:
34234            stream.readHex(start, dataSize);
34235            stream.readHexNumber(end, dataSize);
34236            addHex(end, start, dataSize);
34237            stream.readNumber();
34238
34239            for (i = 1; i < subitemsCount; i++) {
34240              incHex(end, dataSize);
34241              stream.readHexNumber(start, dataSize);
34242              addHex(start, end, dataSize);
34243              stream.readHexNumber(end, dataSize);
34244              addHex(end, start, dataSize);
34245              stream.readNumber();
34246            }
34247
34248            break;
34249
34250          case 2:
34251            stream.readHex(_char, dataSize);
34252            code = stream.readNumber();
34253            cMap.mapOne(hexToInt(_char, dataSize), code);
34254
34255            for (i = 1; i < subitemsCount; i++) {
34256              incHex(_char, dataSize);
34257
34258              if (!sequence) {
34259                stream.readHexNumber(tmp, dataSize);
34260                addHex(_char, tmp, dataSize);
34261              }
34262
34263              code = stream.readSigned() + (code + 1);
34264              cMap.mapOne(hexToInt(_char, dataSize), code);
34265            }
34266
34267            break;
34268
34269          case 3:
34270            stream.readHex(start, dataSize);
34271            stream.readHexNumber(end, dataSize);
34272            addHex(end, start, dataSize);
34273            code = stream.readNumber();
34274            cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
34275
34276            for (i = 1; i < subitemsCount; i++) {
34277              incHex(end, dataSize);
34278
34279              if (!sequence) {
34280                stream.readHexNumber(start, dataSize);
34281                addHex(start, end, dataSize);
34282              } else {
34283                start.set(end);
34284              }
34285
34286              stream.readHexNumber(end, dataSize);
34287              addHex(end, start, dataSize);
34288              code = stream.readNumber();
34289              cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
34290            }
34291
34292            break;
34293
34294          case 4:
34295            stream.readHex(_char, ucs2DataSize);
34296            stream.readHex(charCode, dataSize);
34297            cMap.mapOne(hexToInt(_char, ucs2DataSize), hexToStr(charCode, dataSize));
34298
34299            for (i = 1; i < subitemsCount; i++) {
34300              incHex(_char, ucs2DataSize);
34301
34302              if (!sequence) {
34303                stream.readHexNumber(tmp, ucs2DataSize);
34304                addHex(_char, tmp, ucs2DataSize);
34305              }
34306
34307              incHex(charCode, dataSize);
34308              stream.readHexSigned(tmp, dataSize);
34309              addHex(charCode, tmp, dataSize);
34310              cMap.mapOne(hexToInt(_char, ucs2DataSize), hexToStr(charCode, dataSize));
34311            }
34312
34313            break;
34314
34315          case 5:
34316            stream.readHex(start, ucs2DataSize);
34317            stream.readHexNumber(end, ucs2DataSize);
34318            addHex(end, start, ucs2DataSize);
34319            stream.readHex(charCode, dataSize);
34320            cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
34321
34322            for (i = 1; i < subitemsCount; i++) {
34323              incHex(end, ucs2DataSize);
34324
34325              if (!sequence) {
34326                stream.readHexNumber(start, ucs2DataSize);
34327                addHex(start, end, ucs2DataSize);
34328              } else {
34329                start.set(end);
34330              }
34331
34332              stream.readHexNumber(end, ucs2DataSize);
34333              addHex(end, start, ucs2DataSize);
34334              stream.readHex(charCode, dataSize);
34335              cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
34336            }
34337
34338            break;
34339
34340          default:
34341            reject(new Error('processBinaryCMap: Unknown type: ' + type));
34342            return;
34343        }
34344      }
34345
34346      if (useCMap) {
34347        resolve(extend(useCMap));
34348        return;
34349      }
34350
34351      resolve(cMap);
34352    });
34353  }
34354
34355  function BinaryCMapReader() {}
34356
34357  BinaryCMapReader.prototype = {
34358    process: processBinaryCMap
34359  };
34360  return BinaryCMapReader;
34361}();
34362
34363var CMapFactory = function CMapFactoryClosure() {
34364  function strToInt(str) {
34365    var a = 0;
34366
34367    for (var i = 0; i < str.length; i++) {
34368      a = a << 8 | str.charCodeAt(i);
34369    }
34370
34371    return a >>> 0;
34372  }
34373
34374  function expectString(obj) {
34375    if (!(0, _util.isString)(obj)) {
34376      throw new _util.FormatError('Malformed CMap: expected string.');
34377    }
34378  }
34379
34380  function expectInt(obj) {
34381    if (!Number.isInteger(obj)) {
34382      throw new _util.FormatError('Malformed CMap: expected int.');
34383    }
34384  }
34385
34386  function parseBfChar(cMap, lexer) {
34387    while (true) {
34388      var obj = lexer.getObj();
34389
34390      if ((0, _primitives.isEOF)(obj)) {
34391        break;
34392      }
34393
34394      if ((0, _primitives.isCmd)(obj, 'endbfchar')) {
34395        return;
34396      }
34397
34398      expectString(obj);
34399      var src = strToInt(obj);
34400      obj = lexer.getObj();
34401      expectString(obj);
34402      var dst = obj;
34403      cMap.mapOne(src, dst);
34404    }
34405  }
34406
34407  function parseBfRange(cMap, lexer) {
34408    while (true) {
34409      var obj = lexer.getObj();
34410
34411      if ((0, _primitives.isEOF)(obj)) {
34412        break;
34413      }
34414
34415      if ((0, _primitives.isCmd)(obj, 'endbfrange')) {
34416        return;
34417      }
34418
34419      expectString(obj);
34420      var low = strToInt(obj);
34421      obj = lexer.getObj();
34422      expectString(obj);
34423      var high = strToInt(obj);
34424      obj = lexer.getObj();
34425
34426      if (Number.isInteger(obj) || (0, _util.isString)(obj)) {
34427        var dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
34428        cMap.mapBfRange(low, high, dstLow);
34429      } else if ((0, _primitives.isCmd)(obj, '[')) {
34430        obj = lexer.getObj();
34431        var array = [];
34432
34433        while (!(0, _primitives.isCmd)(obj, ']') && !(0, _primitives.isEOF)(obj)) {
34434          array.push(obj);
34435          obj = lexer.getObj();
34436        }
34437
34438        cMap.mapBfRangeToArray(low, high, array);
34439      } else {
34440        break;
34441      }
34442    }
34443
34444    throw new _util.FormatError('Invalid bf range.');
34445  }
34446
34447  function parseCidChar(cMap, lexer) {
34448    while (true) {
34449      var obj = lexer.getObj();
34450
34451      if ((0, _primitives.isEOF)(obj)) {
34452        break;
34453      }
34454
34455      if ((0, _primitives.isCmd)(obj, 'endcidchar')) {
34456        return;
34457      }
34458
34459      expectString(obj);
34460      var src = strToInt(obj);
34461      obj = lexer.getObj();
34462      expectInt(obj);
34463      var dst = obj;
34464      cMap.mapOne(src, dst);
34465    }
34466  }
34467
34468  function parseCidRange(cMap, lexer) {
34469    while (true) {
34470      var obj = lexer.getObj();
34471
34472      if ((0, _primitives.isEOF)(obj)) {
34473        break;
34474      }
34475
34476      if ((0, _primitives.isCmd)(obj, 'endcidrange')) {
34477        return;
34478      }
34479
34480      expectString(obj);
34481      var low = strToInt(obj);
34482      obj = lexer.getObj();
34483      expectString(obj);
34484      var high = strToInt(obj);
34485      obj = lexer.getObj();
34486      expectInt(obj);
34487      var dstLow = obj;
34488      cMap.mapCidRange(low, high, dstLow);
34489    }
34490  }
34491
34492  function parseCodespaceRange(cMap, lexer) {
34493    while (true) {
34494      var obj = lexer.getObj();
34495
34496      if ((0, _primitives.isEOF)(obj)) {
34497        break;
34498      }
34499
34500      if ((0, _primitives.isCmd)(obj, 'endcodespacerange')) {
34501        return;
34502      }
34503
34504      if (!(0, _util.isString)(obj)) {
34505        break;
34506      }
34507
34508      var low = strToInt(obj);
34509      obj = lexer.getObj();
34510
34511      if (!(0, _util.isString)(obj)) {
34512        break;
34513      }
34514
34515      var high = strToInt(obj);
34516      cMap.addCodespaceRange(obj.length, low, high);
34517    }
34518
34519    throw new _util.FormatError('Invalid codespace range.');
34520  }
34521
34522  function parseWMode(cMap, lexer) {
34523    var obj = lexer.getObj();
34524
34525    if (Number.isInteger(obj)) {
34526      cMap.vertical = !!obj;
34527    }
34528  }
34529
34530  function parseCMapName(cMap, lexer) {
34531    var obj = lexer.getObj();
34532
34533    if ((0, _primitives.isName)(obj) && (0, _util.isString)(obj.name)) {
34534      cMap.name = obj.name;
34535    }
34536  }
34537
34538  function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
34539    var previous;
34540    var embeddedUseCMap;
34541
34542    objLoop: while (true) {
34543      try {
34544        var obj = lexer.getObj();
34545
34546        if ((0, _primitives.isEOF)(obj)) {
34547          break;
34548        } else if ((0, _primitives.isName)(obj)) {
34549          if (obj.name === 'WMode') {
34550            parseWMode(cMap, lexer);
34551          } else if (obj.name === 'CMapName') {
34552            parseCMapName(cMap, lexer);
34553          }
34554
34555          previous = obj;
34556        } else if ((0, _primitives.isCmd)(obj)) {
34557          switch (obj.cmd) {
34558            case 'endcmap':
34559              break objLoop;
34560
34561            case 'usecmap':
34562              if ((0, _primitives.isName)(previous)) {
34563                embeddedUseCMap = previous.name;
34564              }
34565
34566              break;
34567
34568            case 'begincodespacerange':
34569              parseCodespaceRange(cMap, lexer);
34570              break;
34571
34572            case 'beginbfchar':
34573              parseBfChar(cMap, lexer);
34574              break;
34575
34576            case 'begincidchar':
34577              parseCidChar(cMap, lexer);
34578              break;
34579
34580            case 'beginbfrange':
34581              parseBfRange(cMap, lexer);
34582              break;
34583
34584            case 'begincidrange':
34585              parseCidRange(cMap, lexer);
34586              break;
34587          }
34588        }
34589      } catch (ex) {
34590        if (ex instanceof _core_utils.MissingDataException) {
34591          throw ex;
34592        }
34593
34594        (0, _util.warn)('Invalid cMap data: ' + ex);
34595        continue;
34596      }
34597    }
34598
34599    if (!useCMap && embeddedUseCMap) {
34600      useCMap = embeddedUseCMap;
34601    }
34602
34603    if (useCMap) {
34604      return extendCMap(cMap, fetchBuiltInCMap, useCMap);
34605    }
34606
34607    return Promise.resolve(cMap);
34608  }
34609
34610  function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
34611    return createBuiltInCMap(useCMap, fetchBuiltInCMap).then(function (newCMap) {
34612      cMap.useCMap = newCMap;
34613
34614      if (cMap.numCodespaceRanges === 0) {
34615        var useCodespaceRanges = cMap.useCMap.codespaceRanges;
34616
34617        for (var i = 0; i < useCodespaceRanges.length; i++) {
34618          cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
34619        }
34620
34621        cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
34622      }
34623
34624      cMap.useCMap.forEach(function (key, value) {
34625        if (!cMap.contains(key)) {
34626          cMap.mapOne(key, cMap.useCMap.lookup(key));
34627        }
34628      });
34629      return cMap;
34630    });
34631  }
34632
34633  function createBuiltInCMap(name, fetchBuiltInCMap) {
34634    if (name === 'Identity-H') {
34635      return Promise.resolve(new IdentityCMap(false, 2));
34636    } else if (name === 'Identity-V') {
34637      return Promise.resolve(new IdentityCMap(true, 2));
34638    }
34639
34640    if (!BUILT_IN_CMAPS.includes(name)) {
34641      return Promise.reject(new Error('Unknown CMap name: ' + name));
34642    }
34643
34644    if (!fetchBuiltInCMap) {
34645      return Promise.reject(new Error('Built-in CMap parameters are not provided.'));
34646    }
34647
34648    return fetchBuiltInCMap(name).then(function (data) {
34649      var cMapData = data.cMapData,
34650          compressionType = data.compressionType;
34651      var cMap = new CMap(true);
34652
34653      if (compressionType === _util.CMapCompressionType.BINARY) {
34654        return new BinaryCMapReader().process(cMapData, cMap, function (useCMap) {
34655          return extendCMap(cMap, fetchBuiltInCMap, useCMap);
34656        });
34657      }
34658
34659      if (compressionType === _util.CMapCompressionType.NONE) {
34660        var lexer = new _parser.Lexer(new _stream.Stream(cMapData));
34661        return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
34662      }
34663
34664      return Promise.reject(new Error('TODO: Only BINARY/NONE CMap compression is currently supported.'));
34665    });
34666  }
34667
34668  return {
34669    create: function create(params) {
34670      var encoding = params.encoding;
34671      var fetchBuiltInCMap = params.fetchBuiltInCMap;
34672      var useCMap = params.useCMap;
34673
34674      if ((0, _primitives.isName)(encoding)) {
34675        return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
34676      } else if ((0, _primitives.isStream)(encoding)) {
34677        var cMap = new CMap();
34678        var lexer = new _parser.Lexer(encoding);
34679        return parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap).then(function (parsedCMap) {
34680          if (parsedCMap.isIdentityCMap) {
34681            return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
34682          }
34683
34684          return parsedCMap;
34685        });
34686      }
34687
34688      return Promise.reject(new Error('Encoding required.'));
34689    }
34690  };
34691}();
34692
34693exports.CMapFactory = CMapFactory;
34694
34695/***/ }),
34696/* 174 */
34697/***/ (function(module, exports, __w_pdfjs_require__) {
34698
34699"use strict";
34700
34701
34702Object.defineProperty(exports, "__esModule", {
34703  value: true
34704});
34705exports.getFontType = getFontType;
34706exports.IdentityToUnicodeMap = exports.ToUnicodeMap = exports.FontFlags = exports.Font = exports.ErrorFont = exports.SEAC_ANALYSIS_ENABLED = void 0;
34707
34708var _util = __w_pdfjs_require__(5);
34709
34710var _cff_parser = __w_pdfjs_require__(175);
34711
34712var _glyphlist = __w_pdfjs_require__(178);
34713
34714var _encodings = __w_pdfjs_require__(177);
34715
34716var _standard_fonts = __w_pdfjs_require__(179);
34717
34718var _unicode = __w_pdfjs_require__(180);
34719
34720var _font_renderer = __w_pdfjs_require__(181);
34721
34722var _cmap = __w_pdfjs_require__(173);
34723
34724var _core_utils = __w_pdfjs_require__(154);
34725
34726var _stream = __w_pdfjs_require__(158);
34727
34728var _type1_parser = __w_pdfjs_require__(182);
34729
34730function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
34731
34732function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
34733
34734function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
34735
34736function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
34737
34738var PRIVATE_USE_AREAS = [[0xE000, 0xF8FF], [0x100000, 0x10FFFD]];
34739var PDF_GLYPH_SPACE_UNITS = 1000;
34740var SEAC_ANALYSIS_ENABLED = true;
34741exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
34742var FontFlags = {
34743  FixedPitch: 1,
34744  Serif: 2,
34745  Symbolic: 4,
34746  Script: 8,
34747  Nonsymbolic: 32,
34748  Italic: 64,
34749  AllCap: 65536,
34750  SmallCap: 131072,
34751  ForceBold: 262144
34752};
34753exports.FontFlags = FontFlags;
34754var MacStandardGlyphOrdering = ['.notdef', '.null', 'nonmarkingreturn', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent', 'ampersand', 'quotesingle', 'parenleft', 'parenright', 'asterisk', 'plus', 'comma', 'hyphen', 'period', 'slash', 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', 'less', 'equal', 'greater', 'question', 'at', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'bracketleft', 'backslash', 'bracketright', 'asciicircum', 'underscore', 'grave', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'braceleft', 'bar', 'braceright', 'asciitilde', 'Adieresis', 'Aring', 'Ccedilla', 'Eacute', 'Ntilde', 'Odieresis', 'Udieresis', 'aacute', 'agrave', 'acircumflex', 'adieresis', 'atilde', 'aring', 'ccedilla', 'eacute', 'egrave', 'ecircumflex', 'edieresis', 'iacute', 'igrave', 'icircumflex', 'idieresis', 'ntilde', 'oacute', 'ograve', 'ocircumflex', 'odieresis', 'otilde', 'uacute', 'ugrave', 'ucircumflex', 'udieresis', 'dagger', 'degree', 'cent', 'sterling', 'section', 'bullet', 'paragraph', 'germandbls', 'registered', 'copyright', 'trademark', 'acute', 'dieresis', 'notequal', 'AE', 'Oslash', 'infinity', 'plusminus', 'lessequal', 'greaterequal', 'yen', 'mu', 'partialdiff', 'summation', 'product', 'pi', 'integral', 'ordfeminine', 'ordmasculine', 'Omega', 'ae', 'oslash', 'questiondown', 'exclamdown', 'logicalnot', 'radical', 'florin', 'approxequal', 'Delta', 'guillemotleft', 'guillemotright', 'ellipsis', 'nonbreakingspace', 'Agrave', 'Atilde', 'Otilde', 'OE', 'oe', 'endash', 'emdash', 'quotedblleft', 'quotedblright', 'quoteleft', 'quoteright', 'divide', 'lozenge', 'ydieresis', 'Ydieresis', 'fraction', 'currency', 'guilsinglleft', 'guilsinglright', 'fi', 'fl', 'daggerdbl', 'periodcentered', 'quotesinglbase', 'quotedblbase', 'perthousand', 'Acircumflex', 'Ecircumflex', 'Aacute', 'Edieresis', 'Egrave', 'Iacute', 'Icircumflex', 'Idieresis', 'Igrave', 'Oacute', 'Ocircumflex', 'apple', 'Ograve', 'Uacute', 'Ucircumflex', 'Ugrave', 'dotlessi', 'circumflex', 'tilde', 'macron', 'breve', 'dotaccent', 'ring', 'cedilla', 'hungarumlaut', 'ogonek', 'caron', 'Lslash', 'lslash', 'Scaron', 'scaron', 'Zcaron', 'zcaron', 'brokenbar', 'Eth', 'eth', 'Yacute', 'yacute', 'Thorn', 'thorn', 'minus', 'multiply', 'onesuperior', 'twosuperior', 'threesuperior', 'onehalf', 'onequarter', 'threequarters', 'franc', 'Gbreve', 'gbreve', 'Idotaccent', 'Scedilla', 'scedilla', 'Cacute', 'cacute', 'Ccaron', 'ccaron', 'dcroat'];
34755
34756function adjustWidths(properties) {
34757  if (!properties.fontMatrix) {
34758    return;
34759  }
34760
34761  if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) {
34762    return;
34763  }
34764
34765  var scale = 0.001 / properties.fontMatrix[0];
34766  var glyphsWidths = properties.widths;
34767
34768  for (var glyph in glyphsWidths) {
34769    glyphsWidths[glyph] *= scale;
34770  }
34771
34772  properties.defaultWidth *= scale;
34773}
34774
34775function adjustToUnicode(properties, builtInEncoding) {
34776  if (properties.hasIncludedToUnicodeMap) {
34777    return;
34778  }
34779
34780  if (properties.hasEncoding) {
34781    return;
34782  }
34783
34784  if (builtInEncoding === properties.defaultEncoding) {
34785    return;
34786  }
34787
34788  if (properties.toUnicode instanceof IdentityToUnicodeMap) {
34789    return;
34790  }
34791
34792  var toUnicode = [],
34793      glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
34794
34795  for (var charCode in builtInEncoding) {
34796    var glyphName = builtInEncoding[charCode];
34797    var unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
34798
34799    if (unicode !== -1) {
34800      toUnicode[charCode] = String.fromCharCode(unicode);
34801    }
34802  }
34803
34804  properties.toUnicode.amend(toUnicode);
34805}
34806
34807function getFontType(type, subtype) {
34808  switch (type) {
34809    case 'Type1':
34810      return subtype === 'Type1C' ? _util.FontType.TYPE1C : _util.FontType.TYPE1;
34811
34812    case 'CIDFontType0':
34813      return subtype === 'CIDFontType0C' ? _util.FontType.CIDFONTTYPE0C : _util.FontType.CIDFONTTYPE0;
34814
34815    case 'OpenType':
34816      return _util.FontType.OPENTYPE;
34817
34818    case 'TrueType':
34819      return _util.FontType.TRUETYPE;
34820
34821    case 'CIDFontType2':
34822      return _util.FontType.CIDFONTTYPE2;
34823
34824    case 'MMType1':
34825      return _util.FontType.MMTYPE1;
34826
34827    case 'Type0':
34828      return _util.FontType.TYPE0;
34829
34830    default:
34831      return _util.FontType.UNKNOWN;
34832  }
34833}
34834
34835function recoverGlyphName(name, glyphsUnicodeMap) {
34836  if (glyphsUnicodeMap[name] !== undefined) {
34837    return name;
34838  }
34839
34840  var unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap);
34841
34842  if (unicode !== -1) {
34843    for (var key in glyphsUnicodeMap) {
34844      if (glyphsUnicodeMap[key] === unicode) {
34845        return key;
34846      }
34847    }
34848  }
34849
34850  (0, _util.info)('Unable to recover a standard glyph name for: ' + name);
34851  return name;
34852}
34853
34854var Glyph = function GlyphClosure() {
34855  function Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
34856    this.fontChar = fontChar;
34857    this.unicode = unicode;
34858    this.accent = accent;
34859    this.width = width;
34860    this.vmetric = vmetric;
34861    this.operatorListId = operatorListId;
34862    this.isSpace = isSpace;
34863    this.isInFont = isInFont;
34864  }
34865
34866  Glyph.prototype.matchesForCache = function (fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
34867    return this.fontChar === fontChar && this.unicode === unicode && this.accent === accent && this.width === width && this.vmetric === vmetric && this.operatorListId === operatorListId && this.isSpace === isSpace && this.isInFont === isInFont;
34868  };
34869
34870  return Glyph;
34871}();
34872
34873var ToUnicodeMap = function ToUnicodeMapClosure() {
34874  function ToUnicodeMap() {
34875    var cmap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
34876    this._map = cmap;
34877  }
34878
34879  ToUnicodeMap.prototype = {
34880    get length() {
34881      return this._map.length;
34882    },
34883
34884    forEach: function forEach(callback) {
34885      for (var charCode in this._map) {
34886        callback(charCode, this._map[charCode].charCodeAt(0));
34887      }
34888    },
34889    has: function has(i) {
34890      return this._map[i] !== undefined;
34891    },
34892    get: function get(i) {
34893      return this._map[i];
34894    },
34895    charCodeOf: function charCodeOf(value) {
34896      var map = this._map;
34897
34898      if (map.length <= 0x10000) {
34899        return map.indexOf(value);
34900      }
34901
34902      for (var charCode in map) {
34903        if (map[charCode] === value) {
34904          return charCode | 0;
34905        }
34906      }
34907
34908      return -1;
34909    },
34910    amend: function amend(map) {
34911      for (var charCode in map) {
34912        this._map[charCode] = map[charCode];
34913      }
34914    }
34915  };
34916  return ToUnicodeMap;
34917}();
34918
34919exports.ToUnicodeMap = ToUnicodeMap;
34920
34921var IdentityToUnicodeMap = function IdentityToUnicodeMapClosure() {
34922  function IdentityToUnicodeMap(firstChar, lastChar) {
34923    this.firstChar = firstChar;
34924    this.lastChar = lastChar;
34925  }
34926
34927  IdentityToUnicodeMap.prototype = {
34928    get length() {
34929      return this.lastChar + 1 - this.firstChar;
34930    },
34931
34932    forEach: function forEach(callback) {
34933      for (var i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
34934        callback(i, i);
34935      }
34936    },
34937    has: function has(i) {
34938      return this.firstChar <= i && i <= this.lastChar;
34939    },
34940    get: function get(i) {
34941      if (this.firstChar <= i && i <= this.lastChar) {
34942        return String.fromCharCode(i);
34943      }
34944
34945      return undefined;
34946    },
34947    charCodeOf: function charCodeOf(v) {
34948      return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
34949    },
34950    amend: function amend(map) {
34951      (0, _util.unreachable)('Should not call amend()');
34952    }
34953  };
34954  return IdentityToUnicodeMap;
34955}();
34956
34957exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
34958
34959var OpenTypeFileBuilder = function OpenTypeFileBuilderClosure() {
34960  function writeInt16(dest, offset, num) {
34961    dest[offset] = num >> 8 & 0xFF;
34962    dest[offset + 1] = num & 0xFF;
34963  }
34964
34965  function writeInt32(dest, offset, num) {
34966    dest[offset] = num >> 24 & 0xFF;
34967    dest[offset + 1] = num >> 16 & 0xFF;
34968    dest[offset + 2] = num >> 8 & 0xFF;
34969    dest[offset + 3] = num & 0xFF;
34970  }
34971
34972  function writeData(dest, offset, data) {
34973    var i, ii;
34974
34975    if (data instanceof Uint8Array) {
34976      dest.set(data, offset);
34977    } else if (typeof data === 'string') {
34978      for (i = 0, ii = data.length; i < ii; i++) {
34979        dest[offset++] = data.charCodeAt(i) & 0xFF;
34980      }
34981    } else {
34982      for (i = 0, ii = data.length; i < ii; i++) {
34983        dest[offset++] = data[i] & 0xFF;
34984      }
34985    }
34986  }
34987
34988  function OpenTypeFileBuilder(sfnt) {
34989    this.sfnt = sfnt;
34990    this.tables = Object.create(null);
34991  }
34992
34993  OpenTypeFileBuilder.getSearchParams = function OpenTypeFileBuilder_getSearchParams(entriesCount, entrySize) {
34994    var maxPower2 = 1,
34995        log2 = 0;
34996
34997    while ((maxPower2 ^ entriesCount) > maxPower2) {
34998      maxPower2 <<= 1;
34999      log2++;
35000    }
35001
35002    var searchRange = maxPower2 * entrySize;
35003    return {
35004      range: searchRange,
35005      entry: log2,
35006      rangeShift: entrySize * entriesCount - searchRange
35007    };
35008  };
35009
35010  var OTF_HEADER_SIZE = 12;
35011  var OTF_TABLE_ENTRY_SIZE = 16;
35012  OpenTypeFileBuilder.prototype = {
35013    toArray: function OpenTypeFileBuilder_toArray() {
35014      var sfnt = this.sfnt;
35015      var tables = this.tables;
35016      var tablesNames = Object.keys(tables);
35017      tablesNames.sort();
35018      var numTables = tablesNames.length;
35019      var i, j, jj, table, tableName;
35020      var offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
35021      var tableOffsets = [offset];
35022
35023      for (i = 0; i < numTables; i++) {
35024        table = tables[tablesNames[i]];
35025        var paddedLength = (table.length + 3 & ~3) >>> 0;
35026        offset += paddedLength;
35027        tableOffsets.push(offset);
35028      }
35029
35030      var file = new Uint8Array(offset);
35031
35032      for (i = 0; i < numTables; i++) {
35033        table = tables[tablesNames[i]];
35034        writeData(file, tableOffsets[i], table);
35035      }
35036
35037      if (sfnt === 'true') {
35038        sfnt = (0, _util.string32)(0x00010000);
35039      }
35040
35041      file[0] = sfnt.charCodeAt(0) & 0xFF;
35042      file[1] = sfnt.charCodeAt(1) & 0xFF;
35043      file[2] = sfnt.charCodeAt(2) & 0xFF;
35044      file[3] = sfnt.charCodeAt(3) & 0xFF;
35045      writeInt16(file, 4, numTables);
35046      var searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
35047      writeInt16(file, 6, searchParams.range);
35048      writeInt16(file, 8, searchParams.entry);
35049      writeInt16(file, 10, searchParams.rangeShift);
35050      offset = OTF_HEADER_SIZE;
35051
35052      for (i = 0; i < numTables; i++) {
35053        tableName = tablesNames[i];
35054        file[offset] = tableName.charCodeAt(0) & 0xFF;
35055        file[offset + 1] = tableName.charCodeAt(1) & 0xFF;
35056        file[offset + 2] = tableName.charCodeAt(2) & 0xFF;
35057        file[offset + 3] = tableName.charCodeAt(3) & 0xFF;
35058        var checksum = 0;
35059
35060        for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
35061          var quad = (0, _util.readUint32)(file, j);
35062          checksum = checksum + quad >>> 0;
35063        }
35064
35065        writeInt32(file, offset + 4, checksum);
35066        writeInt32(file, offset + 8, tableOffsets[i]);
35067        writeInt32(file, offset + 12, tables[tableName].length);
35068        offset += OTF_TABLE_ENTRY_SIZE;
35069      }
35070
35071      return file;
35072    },
35073    addTable: function OpenTypeFileBuilder_addTable(tag, data) {
35074      if (tag in this.tables) {
35075        throw new Error('Table ' + tag + ' already exists');
35076      }
35077
35078      this.tables[tag] = data;
35079    }
35080  };
35081  return OpenTypeFileBuilder;
35082}();
35083
35084var Font = function FontClosure() {
35085  function Font(name, file, properties) {
35086    var charCode;
35087    this.name = name;
35088    this.loadedName = properties.loadedName;
35089    this.isType3Font = properties.isType3Font;
35090    this.sizes = [];
35091    this.missingFile = false;
35092    this.glyphCache = Object.create(null);
35093    this.isSerifFont = !!(properties.flags & FontFlags.Serif);
35094    this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
35095    this.isMonospace = !!(properties.flags & FontFlags.FixedPitch);
35096    var type = properties.type;
35097    var subtype = properties.subtype;
35098    this.type = type;
35099    this.subtype = subtype;
35100    this.fallbackName = this.isMonospace ? 'monospace' : this.isSerifFont ? 'serif' : 'sans-serif';
35101    this.differences = properties.differences;
35102    this.widths = properties.widths;
35103    this.defaultWidth = properties.defaultWidth;
35104    this.composite = properties.composite;
35105    this.wideChars = properties.wideChars;
35106    this.cMap = properties.cMap;
35107    this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
35108    this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
35109    this.fontMatrix = properties.fontMatrix;
35110    this.bbox = properties.bbox;
35111    this.defaultEncoding = properties.defaultEncoding;
35112    this.toUnicode = properties.toUnicode;
35113    this.fallbackToUnicode = properties.fallbackToUnicode || new ToUnicodeMap();
35114    this.toFontChar = [];
35115
35116    if (properties.type === 'Type3') {
35117      for (charCode = 0; charCode < 256; charCode++) {
35118        this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
35119      }
35120
35121      this.fontType = _util.FontType.TYPE3;
35122      return;
35123    }
35124
35125    this.cidEncoding = properties.cidEncoding;
35126    this.vertical = properties.vertical;
35127
35128    if (this.vertical) {
35129      this.vmetrics = properties.vmetrics;
35130      this.defaultVMetrics = properties.defaultVMetrics;
35131    }
35132
35133    if (!file || file.isEmpty) {
35134      if (file) {
35135        (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ')');
35136      }
35137
35138      this.fallbackToSystemFont();
35139      return;
35140    }
35141
35142    var _getFontFileType = getFontFileType(file, properties);
35143
35144    var _getFontFileType2 = _slicedToArray(_getFontFileType, 2);
35145
35146    type = _getFontFileType2[0];
35147    subtype = _getFontFileType2[1];
35148
35149    if (type !== this.type || subtype !== this.subtype) {
35150      (0, _util.info)('Inconsistent font file Type/SubType, expected: ' + "".concat(this.type, "/").concat(this.subtype, " but found: ").concat(type, "/").concat(subtype, "."));
35151    }
35152
35153    try {
35154      var data;
35155
35156      switch (type) {
35157        case 'MMType1':
35158          (0, _util.info)('MMType1 font (' + name + '), falling back to Type1.');
35159
35160        case 'Type1':
35161        case 'CIDFontType0':
35162          this.mimetype = 'font/opentype';
35163          var cff = subtype === 'Type1C' || subtype === 'CIDFontType0C' ? new CFFFont(file, properties) : new Type1Font(name, file, properties);
35164          adjustWidths(properties);
35165          data = this.convert(name, cff, properties);
35166          break;
35167
35168        case 'OpenType':
35169        case 'TrueType':
35170        case 'CIDFontType2':
35171          this.mimetype = 'font/opentype';
35172          data = this.checkAndRepair(name, file, properties);
35173
35174          if (this.isOpenType) {
35175            adjustWidths(properties);
35176            type = 'OpenType';
35177          }
35178
35179          break;
35180
35181        default:
35182          throw new _util.FormatError("Font ".concat(type, " is not supported"));
35183      }
35184    } catch (e) {
35185      (0, _util.warn)(e);
35186      this.fallbackToSystemFont();
35187      return;
35188    }
35189
35190    this.data = data;
35191    this.fontType = getFontType(type, subtype);
35192    this.fontMatrix = properties.fontMatrix;
35193    this.widths = properties.widths;
35194    this.defaultWidth = properties.defaultWidth;
35195    this.toUnicode = properties.toUnicode;
35196    this.encoding = properties.baseEncoding;
35197    this.seacMap = properties.seacMap;
35198  }
35199
35200  Font.getFontID = function () {
35201    var ID = 1;
35202    return function Font_getFontID() {
35203      return String(ID++);
35204    };
35205  }();
35206
35207  function int16(b0, b1) {
35208    return (b0 << 8) + b1;
35209  }
35210
35211  function writeSignedInt16(bytes, index, value) {
35212    bytes[index + 1] = value;
35213    bytes[index] = value >>> 8;
35214  }
35215
35216  function signedInt16(b0, b1) {
35217    var value = (b0 << 8) + b1;
35218    return value & 1 << 15 ? value - 0x10000 : value;
35219  }
35220
35221  function int32(b0, b1, b2, b3) {
35222    return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
35223  }
35224
35225  function string16(value) {
35226    return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
35227  }
35228
35229  function safeString16(value) {
35230    value = value > 0x7FFF ? 0x7FFF : value < -0x8000 ? -0x8000 : value;
35231    return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
35232  }
35233
35234  function isTrueTypeFile(file) {
35235    var header = file.peekBytes(4);
35236    return (0, _util.readUint32)(header, 0) === 0x00010000 || (0, _util.bytesToString)(header) === 'true';
35237  }
35238
35239  function isTrueTypeCollectionFile(file) {
35240    var header = file.peekBytes(4);
35241    return (0, _util.bytesToString)(header) === 'ttcf';
35242  }
35243
35244  function isOpenTypeFile(file) {
35245    var header = file.peekBytes(4);
35246    return (0, _util.bytesToString)(header) === 'OTTO';
35247  }
35248
35249  function isType1File(file) {
35250    var header = file.peekBytes(2);
35251
35252    if (header[0] === 0x25 && header[1] === 0x21) {
35253      return true;
35254    }
35255
35256    if (header[0] === 0x80 && header[1] === 0x01) {
35257      return true;
35258    }
35259
35260    return false;
35261  }
35262
35263  function isCFFFile(file) {
35264    var header = file.peekBytes(4);
35265
35266    if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
35267      return true;
35268    }
35269
35270    return false;
35271  }
35272
35273  function getFontFileType(file, _ref) {
35274    var type = _ref.type,
35275        subtype = _ref.subtype,
35276        composite = _ref.composite;
35277    var fileType, fileSubtype;
35278
35279    if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
35280      if (composite) {
35281        fileType = 'CIDFontType2';
35282      } else {
35283        fileType = 'TrueType';
35284      }
35285    } else if (isOpenTypeFile(file)) {
35286      if (composite) {
35287        fileType = 'CIDFontType2';
35288      } else {
35289        fileType = 'OpenType';
35290      }
35291    } else if (isType1File(file)) {
35292      if (composite) {
35293        fileType = 'CIDFontType0';
35294      } else {
35295        fileType = type === 'MMType1' ? 'MMType1' : 'Type1';
35296      }
35297    } else if (isCFFFile(file)) {
35298      if (composite) {
35299        fileType = 'CIDFontType0';
35300        fileSubtype = 'CIDFontType0C';
35301      } else {
35302        fileType = type === 'MMType1' ? 'MMType1' : 'Type1';
35303        fileSubtype = 'Type1C';
35304      }
35305    } else {
35306      (0, _util.warn)('getFontFileType: Unable to detect correct font file Type/Subtype.');
35307      fileType = type;
35308      fileSubtype = subtype;
35309    }
35310
35311    return [fileType, fileSubtype];
35312  }
35313
35314  function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
35315    var toFontChar = [],
35316        unicode;
35317
35318    for (var i = 0, ii = encoding.length; i < ii; i++) {
35319      unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap);
35320
35321      if (unicode !== -1) {
35322        toFontChar[i] = unicode;
35323      }
35324    }
35325
35326    for (var charCode in differences) {
35327      unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap);
35328
35329      if (unicode !== -1) {
35330        toFontChar[+charCode] = unicode;
35331      }
35332    }
35333
35334    return toFontChar;
35335  }
35336
35337  function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId) {
35338    var newMap = Object.create(null);
35339    var toFontChar = [];
35340    var privateUseAreaIndex = 0;
35341    var nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
35342    var privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
35343
35344    for (var originalCharCode in charCodeToGlyphId) {
35345      originalCharCode |= 0;
35346      var glyphId = charCodeToGlyphId[originalCharCode];
35347
35348      if (!hasGlyph(glyphId)) {
35349        continue;
35350      }
35351
35352      if (nextAvailableFontCharCode > privateUseOffetEnd) {
35353        privateUseAreaIndex++;
35354
35355        if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) {
35356          (0, _util.warn)('Ran out of space in font private use area.');
35357          break;
35358        }
35359
35360        nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
35361        privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
35362      }
35363
35364      var fontCharCode = nextAvailableFontCharCode++;
35365
35366      if (glyphId === 0) {
35367        glyphId = newGlyphZeroId;
35368      }
35369
35370      newMap[fontCharCode] = glyphId;
35371      toFontChar[originalCharCode] = fontCharCode;
35372    }
35373
35374    return {
35375      toFontChar: toFontChar,
35376      charCodeToGlyphId: newMap,
35377      nextAvailableFontCharCode: nextAvailableFontCharCode
35378    };
35379  }
35380
35381  function getRanges(glyphs, numGlyphs) {
35382    var codes = [];
35383
35384    for (var charCode in glyphs) {
35385      if (glyphs[charCode] >= numGlyphs) {
35386        continue;
35387      }
35388
35389      codes.push({
35390        fontCharCode: charCode | 0,
35391        glyphId: glyphs[charCode]
35392      });
35393    }
35394
35395    if (codes.length === 0) {
35396      codes.push({
35397        fontCharCode: 0,
35398        glyphId: 0
35399      });
35400    }
35401
35402    codes.sort(function fontGetRangesSort(a, b) {
35403      return a.fontCharCode - b.fontCharCode;
35404    });
35405    var ranges = [];
35406    var length = codes.length;
35407
35408    for (var n = 0; n < length;) {
35409      var start = codes[n].fontCharCode;
35410      var codeIndices = [codes[n].glyphId];
35411      ++n;
35412      var end = start;
35413
35414      while (n < length && end + 1 === codes[n].fontCharCode) {
35415        codeIndices.push(codes[n].glyphId);
35416        ++end;
35417        ++n;
35418
35419        if (end === 0xFFFF) {
35420          break;
35421        }
35422      }
35423
35424      ranges.push([start, end, codeIndices]);
35425    }
35426
35427    return ranges;
35428  }
35429
35430  function createCmapTable(glyphs, numGlyphs) {
35431    var ranges = getRanges(glyphs, numGlyphs);
35432    var numTables = ranges[ranges.length - 1][1] > 0xFFFF ? 2 : 1;
35433    var cmap = '\x00\x00' + string16(numTables) + '\x00\x03' + '\x00\x01' + (0, _util.string32)(4 + numTables * 8);
35434    var i, ii, j, jj;
35435
35436    for (i = ranges.length - 1; i >= 0; --i) {
35437      if (ranges[i][0] <= 0xFFFF) {
35438        break;
35439      }
35440    }
35441
35442    var bmpLength = i + 1;
35443
35444    if (ranges[i][0] < 0xFFFF && ranges[i][1] === 0xFFFF) {
35445      ranges[i][1] = 0xFFFE;
35446    }
35447
35448    var trailingRangesCount = ranges[i][1] < 0xFFFF ? 1 : 0;
35449    var segCount = bmpLength + trailingRangesCount;
35450    var searchParams = OpenTypeFileBuilder.getSearchParams(segCount, 2);
35451    var startCount = '';
35452    var endCount = '';
35453    var idDeltas = '';
35454    var idRangeOffsets = '';
35455    var glyphsIds = '';
35456    var bias = 0;
35457    var range, start, end, codes;
35458
35459    for (i = 0, ii = bmpLength; i < ii; i++) {
35460      range = ranges[i];
35461      start = range[0];
35462      end = range[1];
35463      startCount += string16(start);
35464      endCount += string16(end);
35465      codes = range[2];
35466      var contiguous = true;
35467
35468      for (j = 1, jj = codes.length; j < jj; ++j) {
35469        if (codes[j] !== codes[j - 1] + 1) {
35470          contiguous = false;
35471          break;
35472        }
35473      }
35474
35475      if (!contiguous) {
35476        var offset = (segCount - i) * 2 + bias * 2;
35477        bias += end - start + 1;
35478        idDeltas += string16(0);
35479        idRangeOffsets += string16(offset);
35480
35481        for (j = 0, jj = codes.length; j < jj; ++j) {
35482          glyphsIds += string16(codes[j]);
35483        }
35484      } else {
35485        var startCode = codes[0];
35486        idDeltas += string16(startCode - start & 0xFFFF);
35487        idRangeOffsets += string16(0);
35488      }
35489    }
35490
35491    if (trailingRangesCount > 0) {
35492      endCount += '\xFF\xFF';
35493      startCount += '\xFF\xFF';
35494      idDeltas += '\x00\x01';
35495      idRangeOffsets += '\x00\x00';
35496    }
35497
35498    var format314 = '\x00\x00' + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + '\x00\x00' + startCount + idDeltas + idRangeOffsets + glyphsIds;
35499    var format31012 = '';
35500    var header31012 = '';
35501
35502    if (numTables > 1) {
35503      cmap += '\x00\x03' + '\x00\x0A' + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length);
35504      format31012 = '';
35505
35506      for (i = 0, ii = ranges.length; i < ii; i++) {
35507        range = ranges[i];
35508        start = range[0];
35509        codes = range[2];
35510        var code = codes[0];
35511
35512        for (j = 1, jj = codes.length; j < jj; ++j) {
35513          if (codes[j] !== codes[j - 1] + 1) {
35514            end = range[0] + j - 1;
35515            format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code);
35516            start = end + 1;
35517            code = codes[j];
35518          }
35519        }
35520
35521        format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code);
35522      }
35523
35524      header31012 = '\x00\x0C' + '\x00\x00' + (0, _util.string32)(format31012.length + 16) + '\x00\x00\x00\x00' + (0, _util.string32)(format31012.length / 12);
35525    }
35526
35527    return cmap + '\x00\x04' + string16(format314.length + 4) + format314 + header31012 + format31012;
35528  }
35529
35530  function validateOS2Table(os2) {
35531    var stream = new _stream.Stream(os2.data);
35532    var version = stream.getUint16();
35533    stream.getBytes(60);
35534    var selection = stream.getUint16();
35535
35536    if (version < 4 && selection & 0x0300) {
35537      return false;
35538    }
35539
35540    var firstChar = stream.getUint16();
35541    var lastChar = stream.getUint16();
35542
35543    if (firstChar > lastChar) {
35544      return false;
35545    }
35546
35547    stream.getBytes(6);
35548    var usWinAscent = stream.getUint16();
35549
35550    if (usWinAscent === 0) {
35551      return false;
35552    }
35553
35554    os2.data[8] = os2.data[9] = 0;
35555    return true;
35556  }
35557
35558  function createOS2Table(properties, charstrings, override) {
35559    override = override || {
35560      unitsPerEm: 0,
35561      yMax: 0,
35562      yMin: 0,
35563      ascent: 0,
35564      descent: 0
35565    };
35566    var ulUnicodeRange1 = 0;
35567    var ulUnicodeRange2 = 0;
35568    var ulUnicodeRange3 = 0;
35569    var ulUnicodeRange4 = 0;
35570    var firstCharIndex = null;
35571    var lastCharIndex = 0;
35572
35573    if (charstrings) {
35574      for (var code in charstrings) {
35575        code |= 0;
35576
35577        if (firstCharIndex > code || !firstCharIndex) {
35578          firstCharIndex = code;
35579        }
35580
35581        if (lastCharIndex < code) {
35582          lastCharIndex = code;
35583        }
35584
35585        var position = (0, _unicode.getUnicodeRangeFor)(code);
35586
35587        if (position < 32) {
35588          ulUnicodeRange1 |= 1 << position;
35589        } else if (position < 64) {
35590          ulUnicodeRange2 |= 1 << position - 32;
35591        } else if (position < 96) {
35592          ulUnicodeRange3 |= 1 << position - 64;
35593        } else if (position < 123) {
35594          ulUnicodeRange4 |= 1 << position - 96;
35595        } else {
35596          throw new _util.FormatError('Unicode ranges Bits > 123 are reserved for internal usage');
35597        }
35598      }
35599
35600      if (lastCharIndex > 0xFFFF) {
35601        lastCharIndex = 0xFFFF;
35602      }
35603    } else {
35604      firstCharIndex = 0;
35605      lastCharIndex = 255;
35606    }
35607
35608    var bbox = properties.bbox || [0, 0, 0, 0];
35609    var unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
35610    var scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
35611    var typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
35612    var typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
35613
35614    if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
35615      typoDescent = -typoDescent;
35616    }
35617
35618    var winAscent = override.yMax || typoAscent;
35619    var winDescent = -override.yMin || -typoDescent;
35620    return '\x00\x03' + '\x02\x24' + '\x01\xF4' + '\x00\x05' + '\x00\x00' + '\x02\x8A' + '\x02\xBB' + '\x00\x00' + '\x00\x8C' + '\x02\x8A' + '\x02\xBB' + '\x00\x00' + '\x01\xDF' + '\x00\x31' + '\x01\x02' + '\x00\x00' + '\x00\x00\x06' + String.fromCharCode(properties.fixedPitch ? 0x09 : 0x00) + '\x00\x00\x00\x00\x00\x00' + (0, _util.string32)(ulUnicodeRange1) + (0, _util.string32)(ulUnicodeRange2) + (0, _util.string32)(ulUnicodeRange3) + (0, _util.string32)(ulUnicodeRange4) + '\x2A\x32\x31\x2A' + string16(properties.italicAngle ? 1 : 0) + string16(firstCharIndex || properties.firstChar) + string16(lastCharIndex || properties.lastChar) + string16(typoAscent) + string16(typoDescent) + '\x00\x64' + string16(winAscent) + string16(winDescent) + '\x00\x00\x00\x00' + '\x00\x00\x00\x00' + string16(properties.xHeight) + string16(properties.capHeight) + string16(0) + string16(firstCharIndex || properties.firstChar) + '\x00\x03';
35621  }
35622
35623  function createPostTable(properties) {
35624    var angle = Math.floor(properties.italicAngle * Math.pow(2, 16));
35625    return '\x00\x03\x00\x00' + (0, _util.string32)(angle) + '\x00\x00' + '\x00\x00' + (0, _util.string32)(properties.fixedPitch) + '\x00\x00\x00\x00' + '\x00\x00\x00\x00' + '\x00\x00\x00\x00' + '\x00\x00\x00\x00';
35626  }
35627
35628  function createNameTable(name, proto) {
35629    if (!proto) {
35630      proto = [[], []];
35631    }
35632
35633    var strings = [proto[0][0] || 'Original licence', proto[0][1] || name, proto[0][2] || 'Unknown', proto[0][3] || 'uniqueID', proto[0][4] || name, proto[0][5] || 'Version 0.11', proto[0][6] || '', proto[0][7] || 'Unknown', proto[0][8] || 'Unknown', proto[0][9] || 'Unknown'];
35634    var stringsUnicode = [];
35635    var i, ii, j, jj, str;
35636
35637    for (i = 0, ii = strings.length; i < ii; i++) {
35638      str = proto[1][i] || strings[i];
35639      var strBufUnicode = [];
35640
35641      for (j = 0, jj = str.length; j < jj; j++) {
35642        strBufUnicode.push(string16(str.charCodeAt(j)));
35643      }
35644
35645      stringsUnicode.push(strBufUnicode.join(''));
35646    }
35647
35648    var names = [strings, stringsUnicode];
35649    var platforms = ['\x00\x01', '\x00\x03'];
35650    var encodings = ['\x00\x00', '\x00\x01'];
35651    var languages = ['\x00\x00', '\x04\x09'];
35652    var namesRecordCount = strings.length * platforms.length;
35653    var nameTable = '\x00\x00' + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
35654    var strOffset = 0;
35655
35656    for (i = 0, ii = platforms.length; i < ii; i++) {
35657      var strs = names[i];
35658
35659      for (j = 0, jj = strs.length; j < jj; j++) {
35660        str = strs[j];
35661        var nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
35662        nameTable += nameRecord;
35663        strOffset += str.length;
35664      }
35665    }
35666
35667    nameTable += strings.join('') + stringsUnicode.join('');
35668    return nameTable;
35669  }
35670
35671  Font.prototype = {
35672    name: null,
35673    font: null,
35674    mimetype: null,
35675    encoding: null,
35676    disableFontFace: false,
35677
35678    get renderer() {
35679      var renderer = _font_renderer.FontRendererFactory.create(this, SEAC_ANALYSIS_ENABLED);
35680
35681      return (0, _util.shadow)(this, 'renderer', renderer);
35682    },
35683
35684    exportData: function Font_exportData() {
35685      var data = {};
35686
35687      for (var i in this) {
35688        if (this.hasOwnProperty(i)) {
35689          data[i] = this[i];
35690        }
35691      }
35692
35693      return data;
35694    },
35695    fallbackToSystemFont: function Font_fallbackToSystemFont() {
35696      var _this = this;
35697
35698      this.missingFile = true;
35699      var charCode, unicode;
35700      var name = this.name;
35701      var type = this.type;
35702      var subtype = this.subtype;
35703      var fontName = name.replace(/[,_]/g, '-');
35704      var stdFontMap = (0, _standard_fonts.getStdFontMap)(),
35705          nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
35706      var isStandardFont = !!stdFontMap[fontName] || !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
35707      fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
35708      this.bold = fontName.search(/bold/gi) !== -1;
35709      this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
35710      this.black = name.search(/Black/g) !== -1;
35711      this.remeasure = Object.keys(this.widths).length > 0;
35712
35713      if (isStandardFont && type === 'CIDFontType2' && this.cidEncoding.startsWith('Identity-')) {
35714        var GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)();
35715        var map = [];
35716
35717        for (charCode in GlyphMapForStandardFonts) {
35718          map[+charCode] = GlyphMapForStandardFonts[charCode];
35719        }
35720
35721        if (/Arial-?Black/i.test(name)) {
35722          var SupplementalGlyphMapForArialBlack = (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)();
35723
35724          for (charCode in SupplementalGlyphMapForArialBlack) {
35725            map[+charCode] = SupplementalGlyphMapForArialBlack[charCode];
35726          }
35727        } else if (/Calibri/i.test(name)) {
35728          var SupplementalGlyphMapForCalibri = (0, _standard_fonts.getSupplementalGlyphMapForCalibri)();
35729
35730          for (charCode in SupplementalGlyphMapForCalibri) {
35731            map[+charCode] = SupplementalGlyphMapForCalibri[charCode];
35732          }
35733        }
35734
35735        var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap;
35736
35737        if (!isIdentityUnicode) {
35738          this.toUnicode.forEach(function (charCode, unicodeCharCode) {
35739            map[+charCode] = unicodeCharCode;
35740          });
35741        }
35742
35743        this.toFontChar = map;
35744        this.toUnicode = new ToUnicodeMap(map);
35745      } else if (/Symbol/i.test(fontName)) {
35746        this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
35747      } else if (/Dingbats/i.test(fontName)) {
35748        if (/Wingdings/i.test(name)) {
35749          (0, _util.warn)('Non-embedded Wingdings font, falling back to ZapfDingbats.');
35750        }
35751
35752        this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences);
35753      } else if (isStandardFont) {
35754        this.toFontChar = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
35755      } else {
35756        var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
35757        this.toUnicode.forEach(function (charCode, unicodeCharCode) {
35758          if (!_this.composite) {
35759            var glyphName = _this.differences[charCode] || _this.defaultEncoding[charCode];
35760            unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
35761
35762            if (unicode !== -1) {
35763              unicodeCharCode = unicode;
35764            }
35765          }
35766
35767          _this.toFontChar[charCode] = unicodeCharCode;
35768        });
35769      }
35770
35771      this.loadedName = fontName.split('-')[0];
35772      this.fontType = getFontType(type, subtype);
35773    },
35774    checkAndRepair: function Font_checkAndRepair(name, font, properties) {
35775      var VALID_TABLES = ['OS/2', 'cmap', 'head', 'hhea', 'hmtx', 'maxp', 'name', 'post', 'loca', 'glyf', 'fpgm', 'prep', 'cvt ', 'CFF '];
35776
35777      function readTables(file, numTables) {
35778        var tables = Object.create(null);
35779        tables['OS/2'] = null;
35780        tables['cmap'] = null;
35781        tables['head'] = null;
35782        tables['hhea'] = null;
35783        tables['hmtx'] = null;
35784        tables['maxp'] = null;
35785        tables['name'] = null;
35786        tables['post'] = null;
35787
35788        for (var i = 0; i < numTables; i++) {
35789          var table = readTableEntry(font);
35790
35791          if (!VALID_TABLES.includes(table.tag)) {
35792            continue;
35793          }
35794
35795          if (table.length === 0) {
35796            continue;
35797          }
35798
35799          tables[table.tag] = table;
35800        }
35801
35802        return tables;
35803      }
35804
35805      function readTableEntry(file) {
35806        var tag = (0, _util.bytesToString)(file.getBytes(4));
35807        var checksum = file.getInt32() >>> 0;
35808        var offset = file.getInt32() >>> 0;
35809        var length = file.getInt32() >>> 0;
35810        var previousPosition = file.pos;
35811        file.pos = file.start ? file.start : 0;
35812        file.skip(offset);
35813        var data = file.getBytes(length);
35814        file.pos = previousPosition;
35815
35816        if (tag === 'head') {
35817          data[8] = data[9] = data[10] = data[11] = 0;
35818          data[17] |= 0x20;
35819        }
35820
35821        return {
35822          tag: tag,
35823          checksum: checksum,
35824          length: length,
35825          offset: offset,
35826          data: data
35827        };
35828      }
35829
35830      function readOpenTypeHeader(ttf) {
35831        return {
35832          version: (0, _util.bytesToString)(ttf.getBytes(4)),
35833          numTables: ttf.getUint16(),
35834          searchRange: ttf.getUint16(),
35835          entrySelector: ttf.getUint16(),
35836          rangeShift: ttf.getUint16()
35837        };
35838      }
35839
35840      function readTrueTypeCollectionHeader(ttc) {
35841        var ttcTag = (0, _util.bytesToString)(ttc.getBytes(4));
35842        (0, _util.assert)(ttcTag === 'ttcf', 'Must be a TrueType Collection font.');
35843        var majorVersion = ttc.getUint16();
35844        var minorVersion = ttc.getUint16();
35845        var numFonts = ttc.getInt32() >>> 0;
35846        var offsetTable = [];
35847
35848        for (var i = 0; i < numFonts; i++) {
35849          offsetTable.push(ttc.getInt32() >>> 0);
35850        }
35851
35852        var header = {
35853          ttcTag: ttcTag,
35854          majorVersion: majorVersion,
35855          minorVersion: minorVersion,
35856          numFonts: numFonts,
35857          offsetTable: offsetTable
35858        };
35859
35860        switch (majorVersion) {
35861          case 1:
35862            return header;
35863
35864          case 2:
35865            header.dsigTag = ttc.getInt32() >>> 0;
35866            header.dsigLength = ttc.getInt32() >>> 0;
35867            header.dsigOffset = ttc.getInt32() >>> 0;
35868            return header;
35869        }
35870
35871        throw new _util.FormatError("Invalid TrueType Collection majorVersion: ".concat(majorVersion, "."));
35872      }
35873
35874      function readTrueTypeCollectionData(ttc, fontName) {
35875        var _readTrueTypeCollecti = readTrueTypeCollectionHeader(ttc),
35876            numFonts = _readTrueTypeCollecti.numFonts,
35877            offsetTable = _readTrueTypeCollecti.offsetTable;
35878
35879        for (var i = 0; i < numFonts; i++) {
35880          ttc.pos = (ttc.start || 0) + offsetTable[i];
35881          var potentialHeader = readOpenTypeHeader(ttc);
35882          var potentialTables = readTables(ttc, potentialHeader.numTables);
35883
35884          if (!potentialTables['name']) {
35885            throw new _util.FormatError('TrueType Collection font must contain a "name" table.');
35886          }
35887
35888          var nameTable = readNameTable(potentialTables['name']);
35889
35890          for (var j = 0, jj = nameTable.length; j < jj; j++) {
35891            for (var k = 0, kk = nameTable[j].length; k < kk; k++) {
35892              var nameEntry = nameTable[j][k];
35893
35894              if (nameEntry && nameEntry.replace(/\s/g, '') === fontName) {
35895                return {
35896                  header: potentialHeader,
35897                  tables: potentialTables
35898                };
35899              }
35900            }
35901          }
35902        }
35903
35904        throw new _util.FormatError("TrueType Collection does not contain \"".concat(fontName, "\" font."));
35905      }
35906
35907      function readCmapTable(cmap, font, isSymbolicFont, hasEncoding) {
35908        if (!cmap) {
35909          (0, _util.warn)('No cmap table available.');
35910          return {
35911            platformId: -1,
35912            encodingId: -1,
35913            mappings: [],
35914            hasShortCmap: false
35915          };
35916        }
35917
35918        var segment;
35919        var start = (font.start ? font.start : 0) + cmap.offset;
35920        font.pos = start;
35921        font.getUint16();
35922        var numTables = font.getUint16();
35923        var potentialTable;
35924        var canBreak = false;
35925
35926        for (var i = 0; i < numTables; i++) {
35927          var platformId = font.getUint16();
35928          var encodingId = font.getUint16();
35929          var offset = font.getInt32() >>> 0;
35930          var useTable = false;
35931
35932          if (potentialTable && potentialTable.platformId === platformId && potentialTable.encodingId === encodingId) {
35933            continue;
35934          }
35935
35936          if (platformId === 0 && encodingId === 0) {
35937            useTable = true;
35938          } else if (platformId === 1 && encodingId === 0) {
35939            useTable = true;
35940          } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
35941            useTable = true;
35942
35943            if (!isSymbolicFont) {
35944              canBreak = true;
35945            }
35946          } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
35947            useTable = true;
35948            canBreak = true;
35949          }
35950
35951          if (useTable) {
35952            potentialTable = {
35953              platformId: platformId,
35954              encodingId: encodingId,
35955              offset: offset
35956            };
35957          }
35958
35959          if (canBreak) {
35960            break;
35961          }
35962        }
35963
35964        if (potentialTable) {
35965          font.pos = start + potentialTable.offset;
35966        }
35967
35968        if (!potentialTable || font.peekByte() === -1) {
35969          (0, _util.warn)('Could not find a preferred cmap table.');
35970          return {
35971            platformId: -1,
35972            encodingId: -1,
35973            mappings: [],
35974            hasShortCmap: false
35975          };
35976        }
35977
35978        var format = font.getUint16();
35979        font.getUint16();
35980        font.getUint16();
35981        var hasShortCmap = false;
35982        var mappings = [];
35983        var j, glyphId;
35984
35985        if (format === 0) {
35986          for (j = 0; j < 256; j++) {
35987            var index = font.getByte();
35988
35989            if (!index) {
35990              continue;
35991            }
35992
35993            mappings.push({
35994              charCode: j,
35995              glyphId: index
35996            });
35997          }
35998
35999          hasShortCmap = true;
36000        } else if (format === 4) {
36001          var segCount = font.getUint16() >> 1;
36002          font.getBytes(6);
36003          var segIndex,
36004              segments = [];
36005
36006          for (segIndex = 0; segIndex < segCount; segIndex++) {
36007            segments.push({
36008              end: font.getUint16()
36009            });
36010          }
36011
36012          font.getUint16();
36013
36014          for (segIndex = 0; segIndex < segCount; segIndex++) {
36015            segments[segIndex].start = font.getUint16();
36016          }
36017
36018          for (segIndex = 0; segIndex < segCount; segIndex++) {
36019            segments[segIndex].delta = font.getUint16();
36020          }
36021
36022          var offsetsCount = 0;
36023
36024          for (segIndex = 0; segIndex < segCount; segIndex++) {
36025            segment = segments[segIndex];
36026            var rangeOffset = font.getUint16();
36027
36028            if (!rangeOffset) {
36029              segment.offsetIndex = -1;
36030              continue;
36031            }
36032
36033            var offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
36034            segment.offsetIndex = offsetIndex;
36035            offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
36036          }
36037
36038          var offsets = [];
36039
36040          for (j = 0; j < offsetsCount; j++) {
36041            offsets.push(font.getUint16());
36042          }
36043
36044          for (segIndex = 0; segIndex < segCount; segIndex++) {
36045            segment = segments[segIndex];
36046            start = segment.start;
36047            var end = segment.end;
36048            var delta = segment.delta;
36049            offsetIndex = segment.offsetIndex;
36050
36051            for (j = start; j <= end; j++) {
36052              if (j === 0xFFFF) {
36053                continue;
36054              }
36055
36056              glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
36057              glyphId = glyphId + delta & 0xFFFF;
36058              mappings.push({
36059                charCode: j,
36060                glyphId: glyphId
36061              });
36062            }
36063          }
36064        } else if (format === 6) {
36065          var firstCode = font.getUint16();
36066          var entryCount = font.getUint16();
36067
36068          for (j = 0; j < entryCount; j++) {
36069            glyphId = font.getUint16();
36070            var charCode = firstCode + j;
36071            mappings.push({
36072              charCode: charCode,
36073              glyphId: glyphId
36074            });
36075          }
36076        } else {
36077          (0, _util.warn)('cmap table has unsupported format: ' + format);
36078          return {
36079            platformId: -1,
36080            encodingId: -1,
36081            mappings: [],
36082            hasShortCmap: false
36083          };
36084        }
36085
36086        mappings.sort(function (a, b) {
36087          return a.charCode - b.charCode;
36088        });
36089
36090        for (i = 1; i < mappings.length; i++) {
36091          if (mappings[i - 1].charCode === mappings[i].charCode) {
36092            mappings.splice(i, 1);
36093            i--;
36094          }
36095        }
36096
36097        return {
36098          platformId: potentialTable.platformId,
36099          encodingId: potentialTable.encodingId,
36100          mappings: mappings,
36101          hasShortCmap: hasShortCmap
36102        };
36103      }
36104
36105      function sanitizeMetrics(font, header, metrics, numGlyphs, dupFirstEntry) {
36106        if (!header) {
36107          if (metrics) {
36108            metrics.data = null;
36109          }
36110
36111          return;
36112        }
36113
36114        font.pos = (font.start ? font.start : 0) + header.offset;
36115        font.pos += 4;
36116        font.pos += 2;
36117        font.pos += 2;
36118        font.pos += 2;
36119        font.pos += 2;
36120        font.pos += 2;
36121        font.pos += 2;
36122        font.pos += 2;
36123        font.pos += 2;
36124        font.pos += 2;
36125        font.pos += 2;
36126        font.pos += 8;
36127        font.pos += 2;
36128        var numOfMetrics = font.getUint16();
36129
36130        if (numOfMetrics > numGlyphs) {
36131          (0, _util.info)('The numOfMetrics (' + numOfMetrics + ') should not be ' + 'greater than the numGlyphs (' + numGlyphs + ')');
36132          numOfMetrics = numGlyphs;
36133          header.data[34] = (numOfMetrics & 0xff00) >> 8;
36134          header.data[35] = numOfMetrics & 0x00ff;
36135        }
36136
36137        var numOfSidebearings = numGlyphs - numOfMetrics;
36138        var numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
36139
36140        if (numMissing > 0) {
36141          var entries = new Uint8Array(metrics.length + numMissing * 2);
36142          entries.set(metrics.data);
36143
36144          if (dupFirstEntry) {
36145            entries[metrics.length] = metrics.data[2];
36146            entries[metrics.length + 1] = metrics.data[3];
36147          }
36148
36149          metrics.data = entries;
36150        }
36151      }
36152
36153      function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
36154        var glyphProfile = {
36155          length: 0,
36156          sizeOfInstructions: 0
36157        };
36158
36159        if (sourceEnd - sourceStart <= 12) {
36160          return glyphProfile;
36161        }
36162
36163        var glyf = source.subarray(sourceStart, sourceEnd);
36164        var contoursCount = signedInt16(glyf[0], glyf[1]);
36165
36166        if (contoursCount < 0) {
36167          contoursCount = -1;
36168          writeSignedInt16(glyf, 0, contoursCount);
36169          dest.set(glyf, destStart);
36170          glyphProfile.length = glyf.length;
36171          return glyphProfile;
36172        }
36173
36174        var i,
36175            j = 10,
36176            flagsCount = 0;
36177
36178        for (i = 0; i < contoursCount; i++) {
36179          var endPoint = glyf[j] << 8 | glyf[j + 1];
36180          flagsCount = endPoint + 1;
36181          j += 2;
36182        }
36183
36184        var instructionsStart = j;
36185        var instructionsLength = glyf[j] << 8 | glyf[j + 1];
36186        glyphProfile.sizeOfInstructions = instructionsLength;
36187        j += 2 + instructionsLength;
36188        var instructionsEnd = j;
36189        var coordinatesLength = 0;
36190
36191        for (i = 0; i < flagsCount; i++) {
36192          var flag = glyf[j++];
36193
36194          if (flag & 0xC0) {
36195            glyf[j - 1] = flag & 0x3F;
36196          }
36197
36198          var xyLength = (flag & 2 ? 1 : flag & 16 ? 0 : 2) + (flag & 4 ? 1 : flag & 32 ? 0 : 2);
36199          coordinatesLength += xyLength;
36200
36201          if (flag & 8) {
36202            var repeat = glyf[j++];
36203            i += repeat;
36204            coordinatesLength += repeat * xyLength;
36205          }
36206        }
36207
36208        if (coordinatesLength === 0) {
36209          return glyphProfile;
36210        }
36211
36212        var glyphDataLength = j + coordinatesLength;
36213
36214        if (glyphDataLength > glyf.length) {
36215          return glyphProfile;
36216        }
36217
36218        if (!hintsValid && instructionsLength > 0) {
36219          dest.set(glyf.subarray(0, instructionsStart), destStart);
36220          dest.set([0, 0], destStart + instructionsStart);
36221          dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
36222          glyphDataLength -= instructionsLength;
36223
36224          if (glyf.length - glyphDataLength > 3) {
36225            glyphDataLength = glyphDataLength + 3 & ~3;
36226          }
36227
36228          glyphProfile.length = glyphDataLength;
36229          return glyphProfile;
36230        }
36231
36232        if (glyf.length - glyphDataLength > 3) {
36233          glyphDataLength = glyphDataLength + 3 & ~3;
36234          dest.set(glyf.subarray(0, glyphDataLength), destStart);
36235          glyphProfile.length = glyphDataLength;
36236          return glyphProfile;
36237        }
36238
36239        dest.set(glyf, destStart);
36240        glyphProfile.length = glyf.length;
36241        return glyphProfile;
36242      }
36243
36244      function sanitizeHead(head, numGlyphs, locaLength) {
36245        var data = head.data;
36246        var version = int32(data[0], data[1], data[2], data[3]);
36247
36248        if (version >> 16 !== 1) {
36249          (0, _util.info)('Attempting to fix invalid version in head table: ' + version);
36250          data[0] = 0;
36251          data[1] = 1;
36252          data[2] = 0;
36253          data[3] = 0;
36254        }
36255
36256        var indexToLocFormat = int16(data[50], data[51]);
36257
36258        if (indexToLocFormat < 0 || indexToLocFormat > 1) {
36259          (0, _util.info)('Attempting to fix invalid indexToLocFormat in head table: ' + indexToLocFormat);
36260          var numGlyphsPlusOne = numGlyphs + 1;
36261
36262          if (locaLength === numGlyphsPlusOne << 1) {
36263            data[50] = 0;
36264            data[51] = 0;
36265          } else if (locaLength === numGlyphsPlusOne << 2) {
36266            data[50] = 0;
36267            data[51] = 1;
36268          } else {
36269            throw new _util.FormatError('Could not fix indexToLocFormat: ' + indexToLocFormat);
36270          }
36271        }
36272      }
36273
36274      function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) {
36275        var itemSize, itemDecode, itemEncode;
36276
36277        if (isGlyphLocationsLong) {
36278          itemSize = 4;
36279
36280          itemDecode = function fontItemDecodeLong(data, offset) {
36281            return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
36282          };
36283
36284          itemEncode = function fontItemEncodeLong(data, offset, value) {
36285            data[offset] = value >>> 24 & 0xFF;
36286            data[offset + 1] = value >> 16 & 0xFF;
36287            data[offset + 2] = value >> 8 & 0xFF;
36288            data[offset + 3] = value & 0xFF;
36289          };
36290        } else {
36291          itemSize = 2;
36292
36293          itemDecode = function fontItemDecode(data, offset) {
36294            return data[offset] << 9 | data[offset + 1] << 1;
36295          };
36296
36297          itemEncode = function fontItemEncode(data, offset, value) {
36298            data[offset] = value >> 9 & 0xFF;
36299            data[offset + 1] = value >> 1 & 0xFF;
36300          };
36301        }
36302
36303        var numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
36304        var locaData = loca.data;
36305        var locaDataSize = itemSize * (1 + numGlyphsOut);
36306        locaData = new Uint8Array(locaDataSize);
36307        locaData.set(loca.data.subarray(0, locaDataSize));
36308        loca.data = locaData;
36309        var oldGlyfData = glyf.data;
36310        var oldGlyfDataLength = oldGlyfData.length;
36311        var newGlyfData = new Uint8Array(oldGlyfDataLength);
36312        var startOffset = itemDecode(locaData, 0);
36313        var writeOffset = 0;
36314        var missingGlyphs = Object.create(null);
36315        itemEncode(locaData, 0, writeOffset);
36316        var i, j;
36317
36318        for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
36319          var endOffset = itemDecode(locaData, j);
36320
36321          if (endOffset === 0) {
36322            endOffset = startOffset;
36323          }
36324
36325          if (endOffset > oldGlyfDataLength && (oldGlyfDataLength + 3 & ~3) === endOffset) {
36326            endOffset = oldGlyfDataLength;
36327          }
36328
36329          if (endOffset > oldGlyfDataLength) {
36330            startOffset = endOffset;
36331          }
36332
36333          var glyphProfile = sanitizeGlyph(oldGlyfData, startOffset, endOffset, newGlyfData, writeOffset, hintsValid);
36334          var newLength = glyphProfile.length;
36335
36336          if (newLength === 0) {
36337            missingGlyphs[i] = true;
36338          }
36339
36340          if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) {
36341            maxSizeOfInstructions = glyphProfile.sizeOfInstructions;
36342          }
36343
36344          writeOffset += newLength;
36345          itemEncode(locaData, j, writeOffset);
36346          startOffset = endOffset;
36347        }
36348
36349        if (writeOffset === 0) {
36350          var simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]);
36351
36352          for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
36353            itemEncode(locaData, j, simpleGlyph.length);
36354          }
36355
36356          glyf.data = simpleGlyph;
36357        } else if (dupFirstEntry) {
36358          var firstEntryLength = itemDecode(locaData, itemSize);
36359
36360          if (newGlyfData.length > firstEntryLength + writeOffset) {
36361            glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
36362          } else {
36363            glyf.data = new Uint8Array(firstEntryLength + writeOffset);
36364            glyf.data.set(newGlyfData.subarray(0, writeOffset));
36365          }
36366
36367          glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
36368          itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
36369        } else {
36370          glyf.data = newGlyfData.subarray(0, writeOffset);
36371        }
36372
36373        return {
36374          missingGlyphs: missingGlyphs,
36375          maxSizeOfInstructions: maxSizeOfInstructions
36376        };
36377      }
36378
36379      function readPostScriptTable(post, properties, maxpNumGlyphs) {
36380        var start = (font.start ? font.start : 0) + post.offset;
36381        font.pos = start;
36382        var length = post.length,
36383            end = start + length;
36384        var version = font.getInt32();
36385        font.getBytes(28);
36386        var glyphNames;
36387        var valid = true;
36388        var i;
36389
36390        switch (version) {
36391          case 0x00010000:
36392            glyphNames = MacStandardGlyphOrdering;
36393            break;
36394
36395          case 0x00020000:
36396            var numGlyphs = font.getUint16();
36397
36398            if (numGlyphs !== maxpNumGlyphs) {
36399              valid = false;
36400              break;
36401            }
36402
36403            var glyphNameIndexes = [];
36404
36405            for (i = 0; i < numGlyphs; ++i) {
36406              var index = font.getUint16();
36407
36408              if (index >= 32768) {
36409                valid = false;
36410                break;
36411              }
36412
36413              glyphNameIndexes.push(index);
36414            }
36415
36416            if (!valid) {
36417              break;
36418            }
36419
36420            var customNames = [];
36421            var strBuf = [];
36422
36423            while (font.pos < end) {
36424              var stringLength = font.getByte();
36425              strBuf.length = stringLength;
36426
36427              for (i = 0; i < stringLength; ++i) {
36428                strBuf[i] = String.fromCharCode(font.getByte());
36429              }
36430
36431              customNames.push(strBuf.join(''));
36432            }
36433
36434            glyphNames = [];
36435
36436            for (i = 0; i < numGlyphs; ++i) {
36437              var j = glyphNameIndexes[i];
36438
36439              if (j < 258) {
36440                glyphNames.push(MacStandardGlyphOrdering[j]);
36441                continue;
36442              }
36443
36444              glyphNames.push(customNames[j - 258]);
36445            }
36446
36447            break;
36448
36449          case 0x00030000:
36450            break;
36451
36452          default:
36453            (0, _util.warn)('Unknown/unsupported post table version ' + version);
36454            valid = false;
36455
36456            if (properties.defaultEncoding) {
36457              glyphNames = properties.defaultEncoding;
36458            }
36459
36460            break;
36461        }
36462
36463        properties.glyphNames = glyphNames;
36464        return valid;
36465      }
36466
36467      function readNameTable(nameTable) {
36468        var start = (font.start ? font.start : 0) + nameTable.offset;
36469        font.pos = start;
36470        var names = [[], []];
36471        var length = nameTable.length,
36472            end = start + length;
36473        var format = font.getUint16();
36474        var FORMAT_0_HEADER_LENGTH = 6;
36475
36476        if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
36477          return names;
36478        }
36479
36480        var numRecords = font.getUint16();
36481        var stringsStart = font.getUint16();
36482        var records = [];
36483        var NAME_RECORD_LENGTH = 12;
36484        var i, ii;
36485
36486        for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
36487          var r = {
36488            platform: font.getUint16(),
36489            encoding: font.getUint16(),
36490            language: font.getUint16(),
36491            name: font.getUint16(),
36492            length: font.getUint16(),
36493            offset: font.getUint16()
36494          };
36495
36496          if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
36497            records.push(r);
36498          }
36499        }
36500
36501        for (i = 0, ii = records.length; i < ii; i++) {
36502          var record = records[i];
36503
36504          if (record.length <= 0) {
36505            continue;
36506          }
36507
36508          var pos = start + stringsStart + record.offset;
36509
36510          if (pos + record.length > end) {
36511            continue;
36512          }
36513
36514          font.pos = pos;
36515          var nameIndex = record.name;
36516
36517          if (record.encoding) {
36518            var str = '';
36519
36520            for (var j = 0, jj = record.length; j < jj; j += 2) {
36521              str += String.fromCharCode(font.getUint16());
36522            }
36523
36524            names[1][nameIndex] = str;
36525          } else {
36526            names[0][nameIndex] = (0, _util.bytesToString)(font.getBytes(record.length));
36527          }
36528        }
36529
36530        return names;
36531      }
36532
36533      var TTOpsStackDeltas = [0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, 0, 0, -2, -5, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, -1, -1, 1, -1, -999, 0, 1, 0, -1, -2, 0, -1, -2, -1, -1, 0, -1, -1, 0, 0, -999, -999, -1, -1, -1, -1, -2, -999, -2, -2, -999, 0, -2, -2, 0, 0, -2, 0, -2, 0, 0, 0, -2, -1, -1, 1, 1, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, 0, -999, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -999, -999, -999, -999, -999, -1, -1, -2, -2, 0, 0, 0, 0, -1, -1, -999, -2, -2, 0, 0, -1, -2, -2, 0, 0, 0, -1, -1, -1, -2];
36534
36535      function sanitizeTTProgram(table, ttContext) {
36536        var data = table.data;
36537        var i = 0,
36538            j,
36539            n,
36540            b,
36541            funcId,
36542            pc,
36543            lastEndf = 0,
36544            lastDeff = 0;
36545        var stack = [];
36546        var callstack = [];
36547        var functionsCalled = [];
36548        var tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
36549        var inFDEF = false,
36550            ifLevel = 0,
36551            inELSE = 0;
36552
36553        for (var ii = data.length; i < ii;) {
36554          var op = data[i++];
36555
36556          if (op === 0x40) {
36557            n = data[i++];
36558
36559            if (inFDEF || inELSE) {
36560              i += n;
36561            } else {
36562              for (j = 0; j < n; j++) {
36563                stack.push(data[i++]);
36564              }
36565            }
36566          } else if (op === 0x41) {
36567            n = data[i++];
36568
36569            if (inFDEF || inELSE) {
36570              i += n * 2;
36571            } else {
36572              for (j = 0; j < n; j++) {
36573                b = data[i++];
36574                stack.push(b << 8 | data[i++]);
36575              }
36576            }
36577          } else if ((op & 0xF8) === 0xB0) {
36578            n = op - 0xB0 + 1;
36579
36580            if (inFDEF || inELSE) {
36581              i += n;
36582            } else {
36583              for (j = 0; j < n; j++) {
36584                stack.push(data[i++]);
36585              }
36586            }
36587          } else if ((op & 0xF8) === 0xB8) {
36588            n = op - 0xB8 + 1;
36589
36590            if (inFDEF || inELSE) {
36591              i += n * 2;
36592            } else {
36593              for (j = 0; j < n; j++) {
36594                b = data[i++];
36595                stack.push(b << 8 | data[i++]);
36596              }
36597            }
36598          } else if (op === 0x2B && !tooComplexToFollowFunctions) {
36599            if (!inFDEF && !inELSE) {
36600              funcId = stack[stack.length - 1];
36601
36602              if (isNaN(funcId)) {
36603                (0, _util.info)('TT: CALL empty stack (or invalid entry).');
36604              } else {
36605                ttContext.functionsUsed[funcId] = true;
36606
36607                if (funcId in ttContext.functionsStackDeltas) {
36608                  var newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
36609
36610                  if (newStackLength < 0) {
36611                    (0, _util.warn)('TT: CALL invalid functions stack delta.');
36612                    ttContext.hintsValid = false;
36613                    return;
36614                  }
36615
36616                  stack.length = newStackLength;
36617                } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) {
36618                  callstack.push({
36619                    data: data,
36620                    i: i,
36621                    stackTop: stack.length - 1
36622                  });
36623                  functionsCalled.push(funcId);
36624                  pc = ttContext.functionsDefined[funcId];
36625
36626                  if (!pc) {
36627                    (0, _util.warn)('TT: CALL non-existent function');
36628                    ttContext.hintsValid = false;
36629                    return;
36630                  }
36631
36632                  data = pc.data;
36633                  i = pc.i;
36634                }
36635              }
36636            }
36637          } else if (op === 0x2C && !tooComplexToFollowFunctions) {
36638            if (inFDEF || inELSE) {
36639              (0, _util.warn)('TT: nested FDEFs not allowed');
36640              tooComplexToFollowFunctions = true;
36641            }
36642
36643            inFDEF = true;
36644            lastDeff = i;
36645            funcId = stack.pop();
36646            ttContext.functionsDefined[funcId] = {
36647              data: data,
36648              i: i
36649            };
36650          } else if (op === 0x2D) {
36651            if (inFDEF) {
36652              inFDEF = false;
36653              lastEndf = i;
36654            } else {
36655              pc = callstack.pop();
36656
36657              if (!pc) {
36658                (0, _util.warn)('TT: ENDF bad stack');
36659                ttContext.hintsValid = false;
36660                return;
36661              }
36662
36663              funcId = functionsCalled.pop();
36664              data = pc.data;
36665              i = pc.i;
36666              ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
36667            }
36668          } else if (op === 0x89) {
36669            if (inFDEF || inELSE) {
36670              (0, _util.warn)('TT: nested IDEFs not allowed');
36671              tooComplexToFollowFunctions = true;
36672            }
36673
36674            inFDEF = true;
36675            lastDeff = i;
36676          } else if (op === 0x58) {
36677            ++ifLevel;
36678          } else if (op === 0x1B) {
36679            inELSE = ifLevel;
36680          } else if (op === 0x59) {
36681            if (inELSE === ifLevel) {
36682              inELSE = 0;
36683            }
36684
36685            --ifLevel;
36686          } else if (op === 0x1C) {
36687            if (!inFDEF && !inELSE) {
36688              var offset = stack[stack.length - 1];
36689
36690              if (offset > 0) {
36691                i += offset - 1;
36692              }
36693            }
36694          }
36695
36696          if (!inFDEF && !inELSE) {
36697            var stackDelta = op <= 0x8E ? TTOpsStackDeltas[op] : op >= 0xC0 && op <= 0xDF ? -1 : op >= 0xE0 ? -2 : 0;
36698
36699            if (op >= 0x71 && op <= 0x75) {
36700              n = stack.pop();
36701
36702              if (!isNaN(n)) {
36703                stackDelta = -n * 2;
36704              }
36705            }
36706
36707            while (stackDelta < 0 && stack.length > 0) {
36708              stack.pop();
36709              stackDelta++;
36710            }
36711
36712            while (stackDelta > 0) {
36713              stack.push(NaN);
36714              stackDelta--;
36715            }
36716          }
36717        }
36718
36719        ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
36720        var content = [data];
36721
36722        if (i > data.length) {
36723          content.push(new Uint8Array(i - data.length));
36724        }
36725
36726        if (lastDeff > lastEndf) {
36727          (0, _util.warn)('TT: complementing a missing function tail');
36728          content.push(new Uint8Array([0x22, 0x2D]));
36729        }
36730
36731        foldTTTable(table, content);
36732      }
36733
36734      function checkInvalidFunctions(ttContext, maxFunctionDefs) {
36735        if (ttContext.tooComplexToFollowFunctions) {
36736          return;
36737        }
36738
36739        if (ttContext.functionsDefined.length > maxFunctionDefs) {
36740          (0, _util.warn)('TT: more functions defined than expected');
36741          ttContext.hintsValid = false;
36742          return;
36743        }
36744
36745        for (var j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
36746          if (j > maxFunctionDefs) {
36747            (0, _util.warn)('TT: invalid function id: ' + j);
36748            ttContext.hintsValid = false;
36749            return;
36750          }
36751
36752          if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
36753            (0, _util.warn)('TT: undefined function: ' + j);
36754            ttContext.hintsValid = false;
36755            return;
36756          }
36757        }
36758      }
36759
36760      function foldTTTable(table, content) {
36761        if (content.length > 1) {
36762          var newLength = 0;
36763          var j, jj;
36764
36765          for (j = 0, jj = content.length; j < jj; j++) {
36766            newLength += content[j].length;
36767          }
36768
36769          newLength = newLength + 3 & ~3;
36770          var result = new Uint8Array(newLength);
36771          var pos = 0;
36772
36773          for (j = 0, jj = content.length; j < jj; j++) {
36774            result.set(content[j], pos);
36775            pos += content[j].length;
36776          }
36777
36778          table.data = result;
36779          table.length = newLength;
36780        }
36781      }
36782
36783      function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
36784        var ttContext = {
36785          functionsDefined: [],
36786          functionsUsed: [],
36787          functionsStackDeltas: [],
36788          tooComplexToFollowFunctions: false,
36789          hintsValid: true
36790        };
36791
36792        if (fpgm) {
36793          sanitizeTTProgram(fpgm, ttContext);
36794        }
36795
36796        if (prep) {
36797          sanitizeTTProgram(prep, ttContext);
36798        }
36799
36800        if (fpgm) {
36801          checkInvalidFunctions(ttContext, maxFunctionDefs);
36802        }
36803
36804        if (cvt && cvt.length & 1) {
36805          var cvtData = new Uint8Array(cvt.length + 1);
36806          cvtData.set(cvt.data);
36807          cvt.data = cvtData;
36808        }
36809
36810        return ttContext.hintsValid;
36811      }
36812
36813      font = new _stream.Stream(new Uint8Array(font.getBytes()));
36814      var header, tables;
36815
36816      if (isTrueTypeCollectionFile(font)) {
36817        var ttcData = readTrueTypeCollectionData(font, this.name);
36818        header = ttcData.header;
36819        tables = ttcData.tables;
36820      } else {
36821        header = readOpenTypeHeader(font);
36822        tables = readTables(font, header.numTables);
36823      }
36824
36825      var cff, cffFile;
36826      var isTrueType = !tables['CFF '];
36827
36828      if (!isTrueType) {
36829        var isComposite = properties.composite && ((properties.cidToGidMap || []).length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap));
36830
36831        if (header.version === 'OTTO' && !isComposite || !tables['head'] || !tables['hhea'] || !tables['maxp'] || !tables['post']) {
36832          cffFile = new _stream.Stream(tables['CFF '].data);
36833          cff = new CFFFont(cffFile, properties);
36834          adjustWidths(properties);
36835          return this.convert(name, cff, properties);
36836        }
36837
36838        delete tables['glyf'];
36839        delete tables['loca'];
36840        delete tables['fpgm'];
36841        delete tables['prep'];
36842        delete tables['cvt '];
36843        this.isOpenType = true;
36844      } else {
36845        if (!tables['loca']) {
36846          throw new _util.FormatError('Required "loca" table is not found');
36847        }
36848
36849        if (!tables['glyf']) {
36850          (0, _util.warn)('Required "glyf" table is not found -- trying to recover.');
36851          tables['glyf'] = {
36852            tag: 'glyf',
36853            data: new Uint8Array(0)
36854          };
36855        }
36856
36857        this.isOpenType = false;
36858      }
36859
36860      if (!tables['maxp']) {
36861        throw new _util.FormatError('Required "maxp" table is not found');
36862      }
36863
36864      font.pos = (font.start || 0) + tables['maxp'].offset;
36865      var version = font.getInt32();
36866      var numGlyphs = font.getUint16();
36867      var numGlyphsOut = numGlyphs + 1;
36868      var dupFirstEntry = true;
36869
36870      if (numGlyphsOut > 0xFFFF) {
36871        dupFirstEntry = false;
36872        numGlyphsOut = numGlyphs;
36873        (0, _util.warn)('Not enough space in glyfs to duplicate first glyph.');
36874      }
36875
36876      var maxFunctionDefs = 0;
36877      var maxSizeOfInstructions = 0;
36878
36879      if (version >= 0x00010000 && tables['maxp'].length >= 22) {
36880        font.pos += 8;
36881        var maxZones = font.getUint16();
36882
36883        if (maxZones > 2) {
36884          tables['maxp'].data[14] = 0;
36885          tables['maxp'].data[15] = 2;
36886        }
36887
36888        font.pos += 4;
36889        maxFunctionDefs = font.getUint16();
36890        font.pos += 4;
36891        maxSizeOfInstructions = font.getUint16();
36892      }
36893
36894      tables['maxp'].data[4] = numGlyphsOut >> 8;
36895      tables['maxp'].data[5] = numGlyphsOut & 255;
36896      var hintsValid = sanitizeTTPrograms(tables['fpgm'], tables['prep'], tables['cvt '], maxFunctionDefs);
36897
36898      if (!hintsValid) {
36899        delete tables['fpgm'];
36900        delete tables['prep'];
36901        delete tables['cvt '];
36902      }
36903
36904      sanitizeMetrics(font, tables['hhea'], tables['hmtx'], numGlyphsOut, dupFirstEntry);
36905
36906      if (!tables['head']) {
36907        throw new _util.FormatError('Required "head" table is not found');
36908      }
36909
36910      sanitizeHead(tables['head'], numGlyphs, isTrueType ? tables['loca'].length : 0);
36911      var missingGlyphs = Object.create(null);
36912
36913      if (isTrueType) {
36914        var isGlyphLocationsLong = int16(tables['head'].data[50], tables['head'].data[51]);
36915        var glyphsInfo = sanitizeGlyphLocations(tables['loca'], tables['glyf'], numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions);
36916        missingGlyphs = glyphsInfo.missingGlyphs;
36917
36918        if (version >= 0x00010000 && tables['maxp'].length >= 22) {
36919          tables['maxp'].data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
36920          tables['maxp'].data[27] = glyphsInfo.maxSizeOfInstructions & 255;
36921        }
36922      }
36923
36924      if (!tables['hhea']) {
36925        throw new _util.FormatError('Required "hhea" table is not found');
36926      }
36927
36928      if (tables['hhea'].data[10] === 0 && tables['hhea'].data[11] === 0) {
36929        tables['hhea'].data[10] = 0xFF;
36930        tables['hhea'].data[11] = 0xFF;
36931      }
36932
36933      var metricsOverride = {
36934        unitsPerEm: int16(tables['head'].data[18], tables['head'].data[19]),
36935        yMax: int16(tables['head'].data[42], tables['head'].data[43]),
36936        yMin: signedInt16(tables['head'].data[38], tables['head'].data[39]),
36937        ascent: int16(tables['hhea'].data[4], tables['hhea'].data[5]),
36938        descent: signedInt16(tables['hhea'].data[6], tables['hhea'].data[7])
36939      };
36940      this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
36941      this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
36942
36943      if (tables['post']) {
36944        readPostScriptTable(tables['post'], properties, numGlyphs);
36945      }
36946
36947      tables['post'] = {
36948        tag: 'post',
36949        data: createPostTable(properties)
36950      };
36951      var charCodeToGlyphId = [],
36952          charCode;
36953
36954      function hasGlyph(glyphId) {
36955        return !missingGlyphs[glyphId];
36956      }
36957
36958      if (properties.composite) {
36959        var cidToGidMap = properties.cidToGidMap || [];
36960        var isCidToGidMapEmpty = cidToGidMap.length === 0;
36961        properties.cMap.forEach(function (charCode, cid) {
36962          if (cid > 0xffff) {
36963            throw new _util.FormatError('Max size of CID is 65,535');
36964          }
36965
36966          var glyphId = -1;
36967
36968          if (isCidToGidMapEmpty) {
36969            glyphId = cid;
36970          } else if (cidToGidMap[cid] !== undefined) {
36971            glyphId = cidToGidMap[cid];
36972          }
36973
36974          if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) {
36975            charCodeToGlyphId[charCode] = glyphId;
36976          }
36977        });
36978      } else {
36979        var cmapTable = readCmapTable(tables['cmap'], font, this.isSymbolicFont, properties.hasEncoding);
36980        var cmapPlatformId = cmapTable.platformId;
36981        var cmapEncodingId = cmapTable.encodingId;
36982        var cmapMappings = cmapTable.mappings;
36983        var cmapMappingsLength = cmapMappings.length;
36984
36985        if (properties.hasEncoding && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0) || cmapPlatformId === -1 && cmapEncodingId === -1 && !!(0, _encodings.getEncoding)(properties.baseEncodingName)) {
36986          var baseEncoding = [];
36987
36988          if (properties.baseEncodingName === 'MacRomanEncoding' || properties.baseEncodingName === 'WinAnsiEncoding') {
36989            baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
36990          }
36991
36992          var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
36993
36994          for (charCode = 0; charCode < 256; charCode++) {
36995            var glyphName, standardGlyphName;
36996
36997            if (this.differences && charCode in this.differences) {
36998              glyphName = this.differences[charCode];
36999            } else if (charCode in baseEncoding && baseEncoding[charCode] !== '') {
37000              glyphName = baseEncoding[charCode];
37001            } else {
37002              glyphName = _encodings.StandardEncoding[charCode];
37003            }
37004
37005            if (!glyphName) {
37006              continue;
37007            }
37008
37009            standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
37010            var unicodeOrCharCode;
37011
37012            if (cmapPlatformId === 3 && cmapEncodingId === 1) {
37013              unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
37014            } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
37015              unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName);
37016            }
37017
37018            var found = false;
37019
37020            for (var i = 0; i < cmapMappingsLength; ++i) {
37021              if (cmapMappings[i].charCode !== unicodeOrCharCode) {
37022                continue;
37023              }
37024
37025              charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
37026              found = true;
37027              break;
37028            }
37029
37030            if (!found && properties.glyphNames) {
37031              var glyphId = properties.glyphNames.indexOf(glyphName);
37032
37033              if (glyphId === -1 && standardGlyphName !== glyphName) {
37034                glyphId = properties.glyphNames.indexOf(standardGlyphName);
37035              }
37036
37037              if (glyphId > 0 && hasGlyph(glyphId)) {
37038                charCodeToGlyphId[charCode] = glyphId;
37039              }
37040            }
37041          }
37042        } else if (cmapPlatformId === 0 && cmapEncodingId === 0) {
37043          for (var _i2 = 0; _i2 < cmapMappingsLength; ++_i2) {
37044            charCodeToGlyphId[cmapMappings[_i2].charCode] = cmapMappings[_i2].glyphId;
37045          }
37046        } else {
37047          for (var _i3 = 0; _i3 < cmapMappingsLength; ++_i3) {
37048            charCode = cmapMappings[_i3].charCode;
37049
37050            if (cmapPlatformId === 3 && charCode >= 0xF000 && charCode <= 0xF0FF) {
37051              charCode &= 0xFF;
37052            }
37053
37054            charCodeToGlyphId[charCode] = cmapMappings[_i3].glyphId;
37055          }
37056        }
37057      }
37058
37059      if (charCodeToGlyphId.length === 0) {
37060        charCodeToGlyphId[0] = 0;
37061      }
37062
37063      var glyphZeroId = numGlyphsOut - 1;
37064
37065      if (!dupFirstEntry) {
37066        glyphZeroId = 0;
37067      }
37068
37069      var newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId);
37070      this.toFontChar = newMapping.toFontChar;
37071      tables['cmap'] = {
37072        tag: 'cmap',
37073        data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphsOut)
37074      };
37075
37076      if (!tables['OS/2'] || !validateOS2Table(tables['OS/2'])) {
37077        tables['OS/2'] = {
37078          tag: 'OS/2',
37079          data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
37080        };
37081      }
37082
37083      if (!isTrueType) {
37084        try {
37085          cffFile = new _stream.Stream(tables['CFF '].data);
37086          var parser = new _cff_parser.CFFParser(cffFile, properties, SEAC_ANALYSIS_ENABLED);
37087          cff = parser.parse();
37088          cff.duplicateFirstGlyph();
37089          var compiler = new _cff_parser.CFFCompiler(cff);
37090          tables['CFF '].data = compiler.compile();
37091        } catch (e) {
37092          (0, _util.warn)('Failed to compile font ' + properties.loadedName);
37093        }
37094      }
37095
37096      if (!tables['name']) {
37097        tables['name'] = {
37098          tag: 'name',
37099          data: createNameTable(this.name)
37100        };
37101      } else {
37102        var namePrototype = readNameTable(tables['name']);
37103        tables['name'].data = createNameTable(name, namePrototype);
37104      }
37105
37106      var builder = new OpenTypeFileBuilder(header.version);
37107
37108      for (var tableTag in tables) {
37109        builder.addTable(tableTag, tables[tableTag].data);
37110      }
37111
37112      return builder.toArray();
37113    },
37114    convert: function Font_convert(fontName, font, properties) {
37115      properties.fixedPitch = false;
37116
37117      if (properties.builtInEncoding) {
37118        adjustToUnicode(properties, properties.builtInEncoding);
37119      }
37120
37121      var glyphZeroId = 1;
37122
37123      if (font instanceof CFFFont) {
37124        glyphZeroId = font.numGlyphs - 1;
37125      }
37126
37127      var mapping = font.getGlyphMapping(properties);
37128      var newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId);
37129      this.toFontChar = newMapping.toFontChar;
37130      var numGlyphs = font.numGlyphs;
37131
37132      function getCharCodes(charCodeToGlyphId, glyphId) {
37133        var charCodes = null;
37134
37135        for (var charCode in charCodeToGlyphId) {
37136          if (glyphId === charCodeToGlyphId[charCode]) {
37137            if (!charCodes) {
37138              charCodes = [];
37139            }
37140
37141            charCodes.push(charCode | 0);
37142          }
37143        }
37144
37145        return charCodes;
37146      }
37147
37148      function createCharCode(charCodeToGlyphId, glyphId) {
37149        for (var charCode in charCodeToGlyphId) {
37150          if (glyphId === charCodeToGlyphId[charCode]) {
37151            return charCode | 0;
37152          }
37153        }
37154
37155        newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
37156        return newMapping.nextAvailableFontCharCode++;
37157      }
37158
37159      var seacs = font.seacs;
37160
37161      if (SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
37162        var matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX;
37163        var charset = font.getCharset();
37164        var seacMap = Object.create(null);
37165
37166        for (var glyphId in seacs) {
37167          glyphId |= 0;
37168          var seac = seacs[glyphId];
37169          var baseGlyphName = _encodings.StandardEncoding[seac[2]];
37170          var accentGlyphName = _encodings.StandardEncoding[seac[3]];
37171          var baseGlyphId = charset.indexOf(baseGlyphName);
37172          var accentGlyphId = charset.indexOf(accentGlyphName);
37173
37174          if (baseGlyphId < 0 || accentGlyphId < 0) {
37175            continue;
37176          }
37177
37178          var accentOffset = {
37179            x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
37180            y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
37181          };
37182          var charCodes = getCharCodes(mapping, glyphId);
37183
37184          if (!charCodes) {
37185            continue;
37186          }
37187
37188          for (var i = 0, ii = charCodes.length; i < ii; i++) {
37189            var charCode = charCodes[i];
37190            var charCodeToGlyphId = newMapping.charCodeToGlyphId;
37191            var baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
37192            var accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
37193            seacMap[charCode] = {
37194              baseFontCharCode: baseFontCharCode,
37195              accentFontCharCode: accentFontCharCode,
37196              accentOffset: accentOffset
37197            };
37198          }
37199        }
37200
37201        properties.seacMap = seacMap;
37202      }
37203
37204      var unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
37205      var builder = new OpenTypeFileBuilder('\x4F\x54\x54\x4F');
37206      builder.addTable('CFF ', font.data);
37207      builder.addTable('OS/2', createOS2Table(properties, newMapping.charCodeToGlyphId));
37208      builder.addTable('cmap', createCmapTable(newMapping.charCodeToGlyphId, numGlyphs));
37209      builder.addTable('head', '\x00\x01\x00\x00' + '\x00\x00\x10\x00' + '\x00\x00\x00\x00' + '\x5F\x0F\x3C\xF5' + '\x00\x00' + safeString16(unitsPerEm) + '\x00\x00\x00\x00\x9e\x0b\x7e\x27' + '\x00\x00\x00\x00\x9e\x0b\x7e\x27' + '\x00\x00' + safeString16(properties.descent) + '\x0F\xFF' + safeString16(properties.ascent) + string16(properties.italicAngle ? 2 : 0) + '\x00\x11' + '\x00\x00' + '\x00\x00' + '\x00\x00');
37210      builder.addTable('hhea', '\x00\x01\x00\x00' + safeString16(properties.ascent) + safeString16(properties.descent) + '\x00\x00' + '\xFF\xFF' + '\x00\x00' + '\x00\x00' + '\x00\x00' + safeString16(properties.capHeight) + safeString16(Math.tan(properties.italicAngle) * properties.xHeight) + '\x00\x00' + '\x00\x00' + '\x00\x00' + '\x00\x00' + '\x00\x00' + '\x00\x00' + string16(numGlyphs));
37211      builder.addTable('hmtx', function fontFieldsHmtx() {
37212        var charstrings = font.charstrings;
37213        var cffWidths = font.cff ? font.cff.widths : null;
37214        var hmtx = '\x00\x00\x00\x00';
37215
37216        for (var i = 1, ii = numGlyphs; i < ii; i++) {
37217          var width = 0;
37218
37219          if (charstrings) {
37220            var charstring = charstrings[i - 1];
37221            width = 'width' in charstring ? charstring.width : 0;
37222          } else if (cffWidths) {
37223            width = Math.ceil(cffWidths[i] || 0);
37224          }
37225
37226          hmtx += string16(width) + string16(0);
37227        }
37228
37229        return hmtx;
37230      }());
37231      builder.addTable('maxp', '\x00\x00\x50\x00' + string16(numGlyphs));
37232      builder.addTable('name', createNameTable(fontName));
37233      builder.addTable('post', createPostTable(properties));
37234      return builder.toArray();
37235    },
37236
37237    get spaceWidth() {
37238      if ('_shadowWidth' in this) {
37239        return this._shadowWidth;
37240      }
37241
37242      var possibleSpaceReplacements = ['space', 'minus', 'one', 'i', 'I'];
37243      var width;
37244
37245      for (var i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) {
37246        var glyphName = possibleSpaceReplacements[i];
37247
37248        if (glyphName in this.widths) {
37249          width = this.widths[glyphName];
37250          break;
37251        }
37252
37253        var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
37254        var glyphUnicode = glyphsUnicodeMap[glyphName];
37255        var charcode = 0;
37256
37257        if (this.composite) {
37258          if (this.cMap.contains(glyphUnicode)) {
37259            charcode = this.cMap.lookup(glyphUnicode);
37260          }
37261        }
37262
37263        if (!charcode && this.toUnicode) {
37264          charcode = this.toUnicode.charCodeOf(glyphUnicode);
37265        }
37266
37267        if (charcode <= 0) {
37268          charcode = glyphUnicode;
37269        }
37270
37271        width = this.widths[charcode];
37272
37273        if (width) {
37274          break;
37275        }
37276      }
37277
37278      width = width || this.defaultWidth;
37279      this._shadowWidth = width;
37280      return width;
37281    },
37282
37283    charToGlyph: function Font_charToGlyph(charcode, isSpace) {
37284      var fontCharCode, width, operatorListId;
37285      var widthCode = charcode;
37286
37287      if (this.cMap && this.cMap.contains(charcode)) {
37288        widthCode = this.cMap.lookup(charcode);
37289      }
37290
37291      width = this.widths[widthCode];
37292      width = (0, _util.isNum)(width) ? width : this.defaultWidth;
37293      var vmetric = this.vmetrics && this.vmetrics[widthCode];
37294      var unicode = this.toUnicode.get(charcode) || this.fallbackToUnicode.get(charcode) || charcode;
37295
37296      if (typeof unicode === 'number') {
37297        unicode = String.fromCharCode(unicode);
37298      }
37299
37300      var isInFont = charcode in this.toFontChar;
37301      fontCharCode = this.toFontChar[charcode] || charcode;
37302
37303      if (this.missingFile) {
37304        fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode);
37305      }
37306
37307      if (this.isType3Font) {
37308        operatorListId = fontCharCode;
37309      }
37310
37311      var accent = null;
37312
37313      if (this.seacMap && this.seacMap[charcode]) {
37314        isInFont = true;
37315        var seac = this.seacMap[charcode];
37316        fontCharCode = seac.baseFontCharCode;
37317        accent = {
37318          fontChar: String.fromCodePoint(seac.accentFontCharCode),
37319          offset: seac.accentOffset
37320        };
37321      }
37322
37323      var fontChar = typeof fontCharCode === 'number' ? String.fromCodePoint(fontCharCode) : '';
37324      var glyph = this.glyphCache[charcode];
37325
37326      if (!glyph || !glyph.matchesForCache(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) {
37327        glyph = new Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
37328        this.glyphCache[charcode] = glyph;
37329      }
37330
37331      return glyph;
37332    },
37333    charsToGlyphs: function Font_charsToGlyphs(chars) {
37334      var charsCache = this.charsCache;
37335      var glyphs, glyph, charcode;
37336
37337      if (charsCache) {
37338        glyphs = charsCache[chars];
37339
37340        if (glyphs) {
37341          return glyphs;
37342        }
37343      }
37344
37345      if (!charsCache) {
37346        charsCache = this.charsCache = Object.create(null);
37347      }
37348
37349      glyphs = [];
37350      var charsCacheKey = chars;
37351      var i = 0,
37352          ii;
37353
37354      if (this.cMap) {
37355        var c = Object.create(null);
37356
37357        while (i < chars.length) {
37358          this.cMap.readCharCode(chars, i, c);
37359          charcode = c.charcode;
37360          var length = c.length;
37361          i += length;
37362          var isSpace = length === 1 && chars.charCodeAt(i - 1) === 0x20;
37363          glyph = this.charToGlyph(charcode, isSpace);
37364          glyphs.push(glyph);
37365        }
37366      } else {
37367        for (i = 0, ii = chars.length; i < ii; ++i) {
37368          charcode = chars.charCodeAt(i);
37369          glyph = this.charToGlyph(charcode, charcode === 0x20);
37370          glyphs.push(glyph);
37371        }
37372      }
37373
37374      return charsCache[charsCacheKey] = glyphs;
37375    },
37376
37377    get glyphCacheValues() {
37378      return Object.values(this.glyphCache);
37379    }
37380
37381  };
37382  return Font;
37383}();
37384
37385exports.Font = Font;
37386
37387var ErrorFont = function ErrorFontClosure() {
37388  function ErrorFont(error) {
37389    this.error = error;
37390    this.loadedName = 'g_font_error';
37391    this.missingFile = true;
37392  }
37393
37394  ErrorFont.prototype = {
37395    charsToGlyphs: function ErrorFont_charsToGlyphs() {
37396      return [];
37397    },
37398    exportData: function ErrorFont_exportData() {
37399      return {
37400        error: this.error
37401      };
37402    }
37403  };
37404  return ErrorFont;
37405}();
37406
37407exports.ErrorFont = ErrorFont;
37408
37409function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
37410  var charCodeToGlyphId = Object.create(null);
37411  var glyphId, charCode, baseEncoding;
37412  var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
37413
37414  if (properties.baseEncodingName) {
37415    baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
37416
37417    for (charCode = 0; charCode < baseEncoding.length; charCode++) {
37418      glyphId = glyphNames.indexOf(baseEncoding[charCode]);
37419
37420      if (glyphId >= 0) {
37421        charCodeToGlyphId[charCode] = glyphId;
37422      } else {
37423        charCodeToGlyphId[charCode] = 0;
37424      }
37425    }
37426  } else if (isSymbolicFont) {
37427    for (charCode in builtInEncoding) {
37428      charCodeToGlyphId[charCode] = builtInEncoding[charCode];
37429    }
37430  } else {
37431    baseEncoding = _encodings.StandardEncoding;
37432
37433    for (charCode = 0; charCode < baseEncoding.length; charCode++) {
37434      glyphId = glyphNames.indexOf(baseEncoding[charCode]);
37435
37436      if (glyphId >= 0) {
37437        charCodeToGlyphId[charCode] = glyphId;
37438      } else {
37439        charCodeToGlyphId[charCode] = 0;
37440      }
37441    }
37442  }
37443
37444  var differences = properties.differences,
37445      glyphsUnicodeMap;
37446
37447  if (differences) {
37448    for (charCode in differences) {
37449      var glyphName = differences[charCode];
37450      glyphId = glyphNames.indexOf(glyphName);
37451
37452      if (glyphId === -1) {
37453        if (!glyphsUnicodeMap) {
37454          glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
37455        }
37456
37457        var standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
37458
37459        if (standardGlyphName !== glyphName) {
37460          glyphId = glyphNames.indexOf(standardGlyphName);
37461        }
37462      }
37463
37464      if (glyphId >= 0) {
37465        charCodeToGlyphId[charCode] = glyphId;
37466      } else {
37467        charCodeToGlyphId[charCode] = 0;
37468      }
37469    }
37470  }
37471
37472  return charCodeToGlyphId;
37473}
37474
37475var Type1Font = function Type1FontClosure() {
37476  function findBlock(streamBytes, signature, startIndex) {
37477    var streamBytesLength = streamBytes.length;
37478    var signatureLength = signature.length;
37479    var scanLength = streamBytesLength - signatureLength;
37480    var i = startIndex,
37481        j,
37482        found = false;
37483
37484    while (i < scanLength) {
37485      j = 0;
37486
37487      while (j < signatureLength && streamBytes[i + j] === signature[j]) {
37488        j++;
37489      }
37490
37491      if (j >= signatureLength) {
37492        i += j;
37493
37494        while (i < streamBytesLength && (0, _util.isSpace)(streamBytes[i])) {
37495          i++;
37496        }
37497
37498        found = true;
37499        break;
37500      }
37501
37502      i++;
37503    }
37504
37505    return {
37506      found: found,
37507      length: i
37508    };
37509  }
37510
37511  function getHeaderBlock(stream, suggestedLength) {
37512    var EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
37513    var streamStartPos = stream.pos;
37514    var headerBytes, headerBytesLength, block;
37515
37516    try {
37517      headerBytes = stream.getBytes(suggestedLength);
37518      headerBytesLength = headerBytes.length;
37519    } catch (ex) {
37520      if (ex instanceof _core_utils.MissingDataException) {
37521        throw ex;
37522      }
37523    }
37524
37525    if (headerBytesLength === suggestedLength) {
37526      block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
37527
37528      if (block.found && block.length === suggestedLength) {
37529        return {
37530          stream: new _stream.Stream(headerBytes),
37531          length: suggestedLength
37532        };
37533      }
37534    }
37535
37536    (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.');
37537    stream.pos = streamStartPos;
37538    var SCAN_BLOCK_LENGTH = 2048;
37539    var actualLength;
37540
37541    while (true) {
37542      var scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
37543      block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
37544
37545      if (block.length === 0) {
37546        break;
37547      }
37548
37549      stream.pos += block.length;
37550
37551      if (block.found) {
37552        actualLength = stream.pos - streamStartPos;
37553        break;
37554      }
37555    }
37556
37557    stream.pos = streamStartPos;
37558
37559    if (actualLength) {
37560      return {
37561        stream: new _stream.Stream(stream.getBytes(actualLength)),
37562        length: actualLength
37563      };
37564    }
37565
37566    (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.');
37567    return {
37568      stream: new _stream.Stream(stream.getBytes(suggestedLength)),
37569      length: suggestedLength
37570    };
37571  }
37572
37573  function getEexecBlock(stream, suggestedLength) {
37574    var eexecBytes = stream.getBytes();
37575    return {
37576      stream: new _stream.Stream(eexecBytes),
37577      length: eexecBytes.length
37578    };
37579  }
37580
37581  function Type1Font(name, file, properties) {
37582    var PFB_HEADER_SIZE = 6;
37583    var headerBlockLength = properties.length1;
37584    var eexecBlockLength = properties.length2;
37585    var pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
37586    var pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
37587
37588    if (pfbHeaderPresent) {
37589      file.skip(PFB_HEADER_SIZE);
37590      headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
37591    }
37592
37593    var headerBlock = getHeaderBlock(file, headerBlockLength);
37594    var headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, SEAC_ANALYSIS_ENABLED);
37595    headerBlockParser.extractFontHeader(properties);
37596
37597    if (pfbHeaderPresent) {
37598      pfbHeader = file.getBytes(PFB_HEADER_SIZE);
37599      eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
37600    }
37601
37602    var eexecBlock = getEexecBlock(file, eexecBlockLength);
37603    var eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, SEAC_ANALYSIS_ENABLED);
37604    var data = eexecBlockParser.extractFontProgram();
37605
37606    for (var info in data.properties) {
37607      properties[info] = data.properties[info];
37608    }
37609
37610    var charstrings = data.charstrings;
37611    var type2Charstrings = this.getType2Charstrings(charstrings);
37612    var subrs = this.getType2Subrs(data.subrs);
37613    this.charstrings = charstrings;
37614    this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
37615    this.seacs = this.getSeacs(data.charstrings);
37616  }
37617
37618  Type1Font.prototype = {
37619    get numGlyphs() {
37620      return this.charstrings.length + 1;
37621    },
37622
37623    getCharset: function Type1Font_getCharset() {
37624      var charset = ['.notdef'];
37625      var charstrings = this.charstrings;
37626
37627      for (var glyphId = 0; glyphId < charstrings.length; glyphId++) {
37628        charset.push(charstrings[glyphId].glyphName);
37629      }
37630
37631      return charset;
37632    },
37633    getGlyphMapping: function Type1Font_getGlyphMapping(properties) {
37634      var charstrings = this.charstrings;
37635      var glyphNames = ['.notdef'],
37636          glyphId;
37637
37638      for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
37639        glyphNames.push(charstrings[glyphId].glyphName);
37640      }
37641
37642      var encoding = properties.builtInEncoding;
37643
37644      if (encoding) {
37645        var builtInEncoding = Object.create(null);
37646
37647        for (var charCode in encoding) {
37648          glyphId = glyphNames.indexOf(encoding[charCode]);
37649
37650          if (glyphId >= 0) {
37651            builtInEncoding[charCode] = glyphId;
37652          }
37653        }
37654      }
37655
37656      return type1FontGlyphMapping(properties, builtInEncoding, glyphNames);
37657    },
37658    hasGlyphId: function Type1Font_hasGlyphID(id) {
37659      if (id < 0 || id >= this.numGlyphs) {
37660        return false;
37661      }
37662
37663      if (id === 0) {
37664        return true;
37665      }
37666
37667      var glyph = this.charstrings[id - 1];
37668      return glyph.charstring.length > 0;
37669    },
37670    getSeacs: function Type1Font_getSeacs(charstrings) {
37671      var i, ii;
37672      var seacMap = [];
37673
37674      for (i = 0, ii = charstrings.length; i < ii; i++) {
37675        var charstring = charstrings[i];
37676
37677        if (charstring.seac) {
37678          seacMap[i + 1] = charstring.seac;
37679        }
37680      }
37681
37682      return seacMap;
37683    },
37684    getType2Charstrings: function Type1Font_getType2Charstrings(type1Charstrings) {
37685      var type2Charstrings = [];
37686
37687      for (var i = 0, ii = type1Charstrings.length; i < ii; i++) {
37688        type2Charstrings.push(type1Charstrings[i].charstring);
37689      }
37690
37691      return type2Charstrings;
37692    },
37693    getType2Subrs: function Type1Font_getType2Subrs(type1Subrs) {
37694      var bias = 0;
37695      var count = type1Subrs.length;
37696
37697      if (count < 1133) {
37698        bias = 107;
37699      } else if (count < 33769) {
37700        bias = 1131;
37701      } else {
37702        bias = 32768;
37703      }
37704
37705      var type2Subrs = [];
37706      var i;
37707
37708      for (i = 0; i < bias; i++) {
37709        type2Subrs.push([0x0B]);
37710      }
37711
37712      for (i = 0; i < count; i++) {
37713        type2Subrs.push(type1Subrs[i]);
37714      }
37715
37716      return type2Subrs;
37717    },
37718    wrap: function Type1Font_wrap(name, glyphs, charstrings, subrs, properties) {
37719      var cff = new _cff_parser.CFF();
37720      cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4);
37721      cff.names = [name];
37722      var topDict = new _cff_parser.CFFTopDict();
37723      topDict.setByName('version', 391);
37724      topDict.setByName('Notice', 392);
37725      topDict.setByName('FullName', 393);
37726      topDict.setByName('FamilyName', 394);
37727      topDict.setByName('Weight', 395);
37728      topDict.setByName('Encoding', null);
37729      topDict.setByName('FontMatrix', properties.fontMatrix);
37730      topDict.setByName('FontBBox', properties.bbox);
37731      topDict.setByName('charset', null);
37732      topDict.setByName('CharStrings', null);
37733      topDict.setByName('Private', null);
37734      cff.topDict = topDict;
37735      var strings = new _cff_parser.CFFStrings();
37736      strings.add('Version 0.11');
37737      strings.add('See original notice');
37738      strings.add(name);
37739      strings.add(name);
37740      strings.add('Medium');
37741      cff.strings = strings;
37742      cff.globalSubrIndex = new _cff_parser.CFFIndex();
37743      var count = glyphs.length;
37744      var charsetArray = ['.notdef'];
37745      var i, ii;
37746
37747      for (i = 0; i < count; i++) {
37748        var glyphName = charstrings[i].glyphName;
37749
37750        var index = _cff_parser.CFFStandardStrings.indexOf(glyphName);
37751
37752        if (index === -1) {
37753          strings.add(glyphName);
37754        }
37755
37756        charsetArray.push(glyphName);
37757      }
37758
37759      cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray);
37760      var charStringsIndex = new _cff_parser.CFFIndex();
37761      charStringsIndex.add([0x8B, 0x0E]);
37762
37763      for (i = 0; i < count; i++) {
37764        charStringsIndex.add(glyphs[i]);
37765      }
37766
37767      cff.charStrings = charStringsIndex;
37768      var privateDict = new _cff_parser.CFFPrivateDict();
37769      privateDict.setByName('Subrs', null);
37770      var fields = ['BlueValues', 'OtherBlues', 'FamilyBlues', 'FamilyOtherBlues', 'StemSnapH', 'StemSnapV', 'BlueShift', 'BlueFuzz', 'BlueScale', 'LanguageGroup', 'ExpansionFactor', 'ForceBold', 'StdHW', 'StdVW'];
37771
37772      for (i = 0, ii = fields.length; i < ii; i++) {
37773        var field = fields[i];
37774
37775        if (!(field in properties.privateData)) {
37776          continue;
37777        }
37778
37779        var value = properties.privateData[field];
37780
37781        if (Array.isArray(value)) {
37782          for (var j = value.length - 1; j > 0; j--) {
37783            value[j] -= value[j - 1];
37784          }
37785        }
37786
37787        privateDict.setByName(field, value);
37788      }
37789
37790      cff.topDict.privateDict = privateDict;
37791      var subrIndex = new _cff_parser.CFFIndex();
37792
37793      for (i = 0, ii = subrs.length; i < ii; i++) {
37794        subrIndex.add(subrs[i]);
37795      }
37796
37797      privateDict.subrsIndex = subrIndex;
37798      var compiler = new _cff_parser.CFFCompiler(cff);
37799      return compiler.compile();
37800    }
37801  };
37802  return Type1Font;
37803}();
37804
37805var CFFFont = function CFFFontClosure() {
37806  function CFFFont(file, properties) {
37807    this.properties = properties;
37808    var parser = new _cff_parser.CFFParser(file, properties, SEAC_ANALYSIS_ENABLED);
37809    this.cff = parser.parse();
37810    this.cff.duplicateFirstGlyph();
37811    var compiler = new _cff_parser.CFFCompiler(this.cff);
37812    this.seacs = this.cff.seacs;
37813
37814    try {
37815      this.data = compiler.compile();
37816    } catch (e) {
37817      (0, _util.warn)('Failed to compile font ' + properties.loadedName);
37818      this.data = file;
37819    }
37820  }
37821
37822  CFFFont.prototype = {
37823    get numGlyphs() {
37824      return this.cff.charStrings.count;
37825    },
37826
37827    getCharset: function CFFFont_getCharset() {
37828      return this.cff.charset.charset;
37829    },
37830    getGlyphMapping: function CFFFont_getGlyphMapping() {
37831      var cff = this.cff;
37832      var properties = this.properties;
37833      var charsets = cff.charset.charset;
37834      var charCodeToGlyphId;
37835      var glyphId;
37836
37837      if (properties.composite) {
37838        charCodeToGlyphId = Object.create(null);
37839        var charCode;
37840
37841        if (cff.isCIDFont) {
37842          for (glyphId = 0; glyphId < charsets.length; glyphId++) {
37843            var cid = charsets[glyphId];
37844            charCode = properties.cMap.charCodeOf(cid);
37845            charCodeToGlyphId[charCode] = glyphId;
37846          }
37847        } else {
37848          for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
37849            charCode = properties.cMap.charCodeOf(glyphId);
37850            charCodeToGlyphId[charCode] = glyphId;
37851          }
37852        }
37853
37854        return charCodeToGlyphId;
37855      }
37856
37857      var encoding = cff.encoding ? cff.encoding.encoding : null;
37858      charCodeToGlyphId = type1FontGlyphMapping(properties, encoding, charsets);
37859      return charCodeToGlyphId;
37860    },
37861    hasGlyphId: function CFFFont_hasGlyphID(id) {
37862      return this.cff.hasGlyphId(id);
37863    }
37864  };
37865  return CFFFont;
37866}();
37867
37868/***/ }),
37869/* 175 */
37870/***/ (function(module, exports, __w_pdfjs_require__) {
37871
37872"use strict";
37873
37874
37875Object.defineProperty(exports, "__esModule", {
37876  value: true
37877});
37878exports.CFFFDSelect = exports.CFFCompiler = exports.CFFPrivateDict = exports.CFFTopDict = exports.CFFCharset = exports.CFFIndex = exports.CFFStrings = exports.CFFHeader = exports.CFF = exports.CFFParser = exports.CFFStandardStrings = void 0;
37879
37880var _util = __w_pdfjs_require__(5);
37881
37882var _charsets = __w_pdfjs_require__(176);
37883
37884var _encodings = __w_pdfjs_require__(177);
37885
37886var MAX_SUBR_NESTING = 10;
37887var CFFStandardStrings = ['.notdef', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent', 'ampersand', 'quoteright', 'parenleft', 'parenright', 'asterisk', 'plus', 'comma', 'hyphen', 'period', 'slash', 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', 'less', 'equal', 'greater', 'question', 'at', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'bracketleft', 'backslash', 'bracketright', 'asciicircum', 'underscore', 'quoteleft', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'braceleft', 'bar', 'braceright', 'asciitilde', 'exclamdown', 'cent', 'sterling', 'fraction', 'yen', 'florin', 'section', 'currency', 'quotesingle', 'quotedblleft', 'guillemotleft', 'guilsinglleft', 'guilsinglright', 'fi', 'fl', 'endash', 'dagger', 'daggerdbl', 'periodcentered', 'paragraph', 'bullet', 'quotesinglbase', 'quotedblbase', 'quotedblright', 'guillemotright', 'ellipsis', 'perthousand', 'questiondown', 'grave', 'acute', 'circumflex', 'tilde', 'macron', 'breve', 'dotaccent', 'dieresis', 'ring', 'cedilla', 'hungarumlaut', 'ogonek', 'caron', 'emdash', 'AE', 'ordfeminine', 'Lslash', 'Oslash', 'OE', 'ordmasculine', 'ae', 'dotlessi', 'lslash', 'oslash', 'oe', 'germandbls', 'onesuperior', 'logicalnot', 'mu', 'trademark', 'Eth', 'onehalf', 'plusminus', 'Thorn', 'onequarter', 'divide', 'brokenbar', 'degree', 'thorn', 'threequarters', 'twosuperior', 'registered', 'minus', 'eth', 'multiply', 'threesuperior', 'copyright', 'Aacute', 'Acircumflex', 'Adieresis', 'Agrave', 'Aring', 'Atilde', 'Ccedilla', 'Eacute', 'Ecircumflex', 'Edieresis', 'Egrave', 'Iacute', 'Icircumflex', 'Idieresis', 'Igrave', 'Ntilde', 'Oacute', 'Ocircumflex', 'Odieresis', 'Ograve', 'Otilde', 'Scaron', 'Uacute', 'Ucircumflex', 'Udieresis', 'Ugrave', 'Yacute', 'Ydieresis', 'Zcaron', 'aacute', 'acircumflex', 'adieresis', 'agrave', 'aring', 'atilde', 'ccedilla', 'eacute', 'ecircumflex', 'edieresis', 'egrave', 'iacute', 'icircumflex', 'idieresis', 'igrave', 'ntilde', 'oacute', 'ocircumflex', 'odieresis', 'ograve', 'otilde', 'scaron', 'uacute', 'ucircumflex', 'udieresis', 'ugrave', 'yacute', 'ydieresis', 'zcaron', 'exclamsmall', 'Hungarumlautsmall', 'dollaroldstyle', 'dollarsuperior', 'ampersandsmall', 'Acutesmall', 'parenleftsuperior', 'parenrightsuperior', 'twodotenleader', 'onedotenleader', 'zerooldstyle', 'oneoldstyle', 'twooldstyle', 'threeoldstyle', 'fouroldstyle', 'fiveoldstyle', 'sixoldstyle', 'sevenoldstyle', 'eightoldstyle', 'nineoldstyle', 'commasuperior', 'threequartersemdash', 'periodsuperior', 'questionsmall', 'asuperior', 'bsuperior', 'centsuperior', 'dsuperior', 'esuperior', 'isuperior', 'lsuperior', 'msuperior', 'nsuperior', 'osuperior', 'rsuperior', 'ssuperior', 'tsuperior', 'ff', 'ffi', 'ffl', 'parenleftinferior', 'parenrightinferior', 'Circumflexsmall', 'hyphensuperior', 'Gravesmall', 'Asmall', 'Bsmall', 'Csmall', 'Dsmall', 'Esmall', 'Fsmall', 'Gsmall', 'Hsmall', 'Ismall', 'Jsmall', 'Ksmall', 'Lsmall', 'Msmall', 'Nsmall', 'Osmall', 'Psmall', 'Qsmall', 'Rsmall', 'Ssmall', 'Tsmall', 'Usmall', 'Vsmall', 'Wsmall', 'Xsmall', 'Ysmall', 'Zsmall', 'colonmonetary', 'onefitted', 'rupiah', 'Tildesmall', 'exclamdownsmall', 'centoldstyle', 'Lslashsmall', 'Scaronsmall', 'Zcaronsmall', 'Dieresissmall', 'Brevesmall', 'Caronsmall', 'Dotaccentsmall', 'Macronsmall', 'figuredash', 'hypheninferior', 'Ogoneksmall', 'Ringsmall', 'Cedillasmall', 'questiondownsmall', 'oneeighth', 'threeeighths', 'fiveeighths', 'seveneighths', 'onethird', 'twothirds', 'zerosuperior', 'foursuperior', 'fivesuperior', 'sixsuperior', 'sevensuperior', 'eightsuperior', 'ninesuperior', 'zeroinferior', 'oneinferior', 'twoinferior', 'threeinferior', 'fourinferior', 'fiveinferior', 'sixinferior', 'seveninferior', 'eightinferior', 'nineinferior', 'centinferior', 'dollarinferior', 'periodinferior', 'commainferior', 'Agravesmall', 'Aacutesmall', 'Acircumflexsmall', 'Atildesmall', 'Adieresissmall', 'Aringsmall', 'AEsmall', 'Ccedillasmall', 'Egravesmall', 'Eacutesmall', 'Ecircumflexsmall', 'Edieresissmall', 'Igravesmall', 'Iacutesmall', 'Icircumflexsmall', 'Idieresissmall', 'Ethsmall', 'Ntildesmall', 'Ogravesmall', 'Oacutesmall', 'Ocircumflexsmall', 'Otildesmall', 'Odieresissmall', 'OEsmall', 'Oslashsmall', 'Ugravesmall', 'Uacutesmall', 'Ucircumflexsmall', 'Udieresissmall', 'Yacutesmall', 'Thornsmall', 'Ydieresissmall', '001.000', '001.001', '001.002', '001.003', 'Black', 'Bold', 'Book', 'Light', 'Medium', 'Regular', 'Roman', 'Semibold'];
37888exports.CFFStandardStrings = CFFStandardStrings;
37889var NUM_STANDARD_CFF_STRINGS = 391;
37890
37891var CFFParser = function CFFParserClosure() {
37892  var CharstringValidationData = [null, {
37893    id: 'hstem',
37894    min: 2,
37895    stackClearing: true,
37896    stem: true
37897  }, null, {
37898    id: 'vstem',
37899    min: 2,
37900    stackClearing: true,
37901    stem: true
37902  }, {
37903    id: 'vmoveto',
37904    min: 1,
37905    stackClearing: true
37906  }, {
37907    id: 'rlineto',
37908    min: 2,
37909    resetStack: true
37910  }, {
37911    id: 'hlineto',
37912    min: 1,
37913    resetStack: true
37914  }, {
37915    id: 'vlineto',
37916    min: 1,
37917    resetStack: true
37918  }, {
37919    id: 'rrcurveto',
37920    min: 6,
37921    resetStack: true
37922  }, null, {
37923    id: 'callsubr',
37924    min: 1,
37925    undefStack: true
37926  }, {
37927    id: 'return',
37928    min: 0,
37929    undefStack: true
37930  }, null, null, {
37931    id: 'endchar',
37932    min: 0,
37933    stackClearing: true
37934  }, null, null, null, {
37935    id: 'hstemhm',
37936    min: 2,
37937    stackClearing: true,
37938    stem: true
37939  }, {
37940    id: 'hintmask',
37941    min: 0,
37942    stackClearing: true
37943  }, {
37944    id: 'cntrmask',
37945    min: 0,
37946    stackClearing: true
37947  }, {
37948    id: 'rmoveto',
37949    min: 2,
37950    stackClearing: true
37951  }, {
37952    id: 'hmoveto',
37953    min: 1,
37954    stackClearing: true
37955  }, {
37956    id: 'vstemhm',
37957    min: 2,
37958    stackClearing: true,
37959    stem: true
37960  }, {
37961    id: 'rcurveline',
37962    min: 8,
37963    resetStack: true
37964  }, {
37965    id: 'rlinecurve',
37966    min: 8,
37967    resetStack: true
37968  }, {
37969    id: 'vvcurveto',
37970    min: 4,
37971    resetStack: true
37972  }, {
37973    id: 'hhcurveto',
37974    min: 4,
37975    resetStack: true
37976  }, null, {
37977    id: 'callgsubr',
37978    min: 1,
37979    undefStack: true
37980  }, {
37981    id: 'vhcurveto',
37982    min: 4,
37983    resetStack: true
37984  }, {
37985    id: 'hvcurveto',
37986    min: 4,
37987    resetStack: true
37988  }];
37989  var CharstringValidationData12 = [null, null, null, {
37990    id: 'and',
37991    min: 2,
37992    stackDelta: -1
37993  }, {
37994    id: 'or',
37995    min: 2,
37996    stackDelta: -1
37997  }, {
37998    id: 'not',
37999    min: 1,
38000    stackDelta: 0
38001  }, null, null, null, {
38002    id: 'abs',
38003    min: 1,
38004    stackDelta: 0
38005  }, {
38006    id: 'add',
38007    min: 2,
38008    stackDelta: -1,
38009    stackFn: function stack_div(stack, index) {
38010      stack[index - 2] = stack[index - 2] + stack[index - 1];
38011    }
38012  }, {
38013    id: 'sub',
38014    min: 2,
38015    stackDelta: -1,
38016    stackFn: function stack_div(stack, index) {
38017      stack[index - 2] = stack[index - 2] - stack[index - 1];
38018    }
38019  }, {
38020    id: 'div',
38021    min: 2,
38022    stackDelta: -1,
38023    stackFn: function stack_div(stack, index) {
38024      stack[index - 2] = stack[index - 2] / stack[index - 1];
38025    }
38026  }, null, {
38027    id: 'neg',
38028    min: 1,
38029    stackDelta: 0,
38030    stackFn: function stack_div(stack, index) {
38031      stack[index - 1] = -stack[index - 1];
38032    }
38033  }, {
38034    id: 'eq',
38035    min: 2,
38036    stackDelta: -1
38037  }, null, null, {
38038    id: 'drop',
38039    min: 1,
38040    stackDelta: -1
38041  }, null, {
38042    id: 'put',
38043    min: 2,
38044    stackDelta: -2
38045  }, {
38046    id: 'get',
38047    min: 1,
38048    stackDelta: 0
38049  }, {
38050    id: 'ifelse',
38051    min: 4,
38052    stackDelta: -3
38053  }, {
38054    id: 'random',
38055    min: 0,
38056    stackDelta: 1
38057  }, {
38058    id: 'mul',
38059    min: 2,
38060    stackDelta: -1,
38061    stackFn: function stack_div(stack, index) {
38062      stack[index - 2] = stack[index - 2] * stack[index - 1];
38063    }
38064  }, null, {
38065    id: 'sqrt',
38066    min: 1,
38067    stackDelta: 0
38068  }, {
38069    id: 'dup',
38070    min: 1,
38071    stackDelta: 1
38072  }, {
38073    id: 'exch',
38074    min: 2,
38075    stackDelta: 0
38076  }, {
38077    id: 'index',
38078    min: 2,
38079    stackDelta: 0
38080  }, {
38081    id: 'roll',
38082    min: 3,
38083    stackDelta: -2
38084  }, null, null, null, {
38085    id: 'hflex',
38086    min: 7,
38087    resetStack: true
38088  }, {
38089    id: 'flex',
38090    min: 13,
38091    resetStack: true
38092  }, {
38093    id: 'hflex1',
38094    min: 9,
38095    resetStack: true
38096  }, {
38097    id: 'flex1',
38098    min: 11,
38099    resetStack: true
38100  }];
38101
38102  function CFFParser(file, properties, seacAnalysisEnabled) {
38103    this.bytes = file.getBytes();
38104    this.properties = properties;
38105    this.seacAnalysisEnabled = !!seacAnalysisEnabled;
38106  }
38107
38108  CFFParser.prototype = {
38109    parse: function CFFParser_parse() {
38110      var properties = this.properties;
38111      var cff = new CFF();
38112      this.cff = cff;
38113      var header = this.parseHeader();
38114      var nameIndex = this.parseIndex(header.endPos);
38115      var topDictIndex = this.parseIndex(nameIndex.endPos);
38116      var stringIndex = this.parseIndex(topDictIndex.endPos);
38117      var globalSubrIndex = this.parseIndex(stringIndex.endPos);
38118      var topDictParsed = this.parseDict(topDictIndex.obj.get(0));
38119      var topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
38120      cff.header = header.obj;
38121      cff.names = this.parseNameIndex(nameIndex.obj);
38122      cff.strings = this.parseStringIndex(stringIndex.obj);
38123      cff.topDict = topDict;
38124      cff.globalSubrIndex = globalSubrIndex.obj;
38125      this.parsePrivateDict(cff.topDict);
38126      cff.isCIDFont = topDict.hasName('ROS');
38127      var charStringOffset = topDict.getByName('CharStrings');
38128      var charStringIndex = this.parseIndex(charStringOffset).obj;
38129      var fontMatrix = topDict.getByName('FontMatrix');
38130
38131      if (fontMatrix) {
38132        properties.fontMatrix = fontMatrix;
38133      }
38134
38135      var fontBBox = topDict.getByName('FontBBox');
38136
38137      if (fontBBox) {
38138        properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
38139        properties.descent = Math.min(fontBBox[1], fontBBox[3]);
38140        properties.ascentScaled = true;
38141      }
38142
38143      var charset, encoding;
38144
38145      if (cff.isCIDFont) {
38146        var fdArrayIndex = this.parseIndex(topDict.getByName('FDArray')).obj;
38147
38148        for (var i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
38149          var dictRaw = fdArrayIndex.get(i);
38150          var fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
38151          this.parsePrivateDict(fontDict);
38152          cff.fdArray.push(fontDict);
38153        }
38154
38155        encoding = null;
38156        charset = this.parseCharsets(topDict.getByName('charset'), charStringIndex.count, cff.strings, true);
38157        cff.fdSelect = this.parseFDSelect(topDict.getByName('FDSelect'), charStringIndex.count);
38158      } else {
38159        charset = this.parseCharsets(topDict.getByName('charset'), charStringIndex.count, cff.strings, false);
38160        encoding = this.parseEncoding(topDict.getByName('Encoding'), properties, cff.strings, charset.charset);
38161      }
38162
38163      cff.charset = charset;
38164      cff.encoding = encoding;
38165      var charStringsAndSeacs = this.parseCharStrings({
38166        charStrings: charStringIndex,
38167        localSubrIndex: topDict.privateDict.subrsIndex,
38168        globalSubrIndex: globalSubrIndex.obj,
38169        fdSelect: cff.fdSelect,
38170        fdArray: cff.fdArray,
38171        privateDict: topDict.privateDict
38172      });
38173      cff.charStrings = charStringsAndSeacs.charStrings;
38174      cff.seacs = charStringsAndSeacs.seacs;
38175      cff.widths = charStringsAndSeacs.widths;
38176      return cff;
38177    },
38178    parseHeader: function CFFParser_parseHeader() {
38179      var bytes = this.bytes;
38180      var bytesLength = bytes.length;
38181      var offset = 0;
38182
38183      while (offset < bytesLength && bytes[offset] !== 1) {
38184        ++offset;
38185      }
38186
38187      if (offset >= bytesLength) {
38188        throw new _util.FormatError('Invalid CFF header');
38189      }
38190
38191      if (offset !== 0) {
38192        (0, _util.info)('cff data is shifted');
38193        bytes = bytes.subarray(offset);
38194        this.bytes = bytes;
38195      }
38196
38197      var major = bytes[0];
38198      var minor = bytes[1];
38199      var hdrSize = bytes[2];
38200      var offSize = bytes[3];
38201      var header = new CFFHeader(major, minor, hdrSize, offSize);
38202      return {
38203        obj: header,
38204        endPos: hdrSize
38205      };
38206    },
38207    parseDict: function CFFParser_parseDict(dict) {
38208      var pos = 0;
38209
38210      function parseOperand() {
38211        var value = dict[pos++];
38212
38213        if (value === 30) {
38214          return parseFloatOperand();
38215        } else if (value === 28) {
38216          value = dict[pos++];
38217          value = (value << 24 | dict[pos++] << 16) >> 16;
38218          return value;
38219        } else if (value === 29) {
38220          value = dict[pos++];
38221          value = value << 8 | dict[pos++];
38222          value = value << 8 | dict[pos++];
38223          value = value << 8 | dict[pos++];
38224          return value;
38225        } else if (value >= 32 && value <= 246) {
38226          return value - 139;
38227        } else if (value >= 247 && value <= 250) {
38228          return (value - 247) * 256 + dict[pos++] + 108;
38229        } else if (value >= 251 && value <= 254) {
38230          return -((value - 251) * 256) - dict[pos++] - 108;
38231        }
38232
38233        (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.');
38234        return NaN;
38235      }
38236
38237      function parseFloatOperand() {
38238        var str = '';
38239        var eof = 15;
38240        var lookup = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', 'E', 'E-', null, '-'];
38241        var length = dict.length;
38242
38243        while (pos < length) {
38244          var b = dict[pos++];
38245          var b1 = b >> 4;
38246          var b2 = b & 15;
38247
38248          if (b1 === eof) {
38249            break;
38250          }
38251
38252          str += lookup[b1];
38253
38254          if (b2 === eof) {
38255            break;
38256          }
38257
38258          str += lookup[b2];
38259        }
38260
38261        return parseFloat(str);
38262      }
38263
38264      var operands = [];
38265      var entries = [];
38266      pos = 0;
38267      var end = dict.length;
38268
38269      while (pos < end) {
38270        var b = dict[pos];
38271
38272        if (b <= 21) {
38273          if (b === 12) {
38274            b = b << 8 | dict[++pos];
38275          }
38276
38277          entries.push([b, operands]);
38278          operands = [];
38279          ++pos;
38280        } else {
38281          operands.push(parseOperand());
38282        }
38283      }
38284
38285      return entries;
38286    },
38287    parseIndex: function CFFParser_parseIndex(pos) {
38288      var cffIndex = new CFFIndex();
38289      var bytes = this.bytes;
38290      var count = bytes[pos++] << 8 | bytes[pos++];
38291      var offsets = [];
38292      var end = pos;
38293      var i, ii;
38294
38295      if (count !== 0) {
38296        var offsetSize = bytes[pos++];
38297        var startPos = pos + (count + 1) * offsetSize - 1;
38298
38299        for (i = 0, ii = count + 1; i < ii; ++i) {
38300          var offset = 0;
38301
38302          for (var j = 0; j < offsetSize; ++j) {
38303            offset <<= 8;
38304            offset += bytes[pos++];
38305          }
38306
38307          offsets.push(startPos + offset);
38308        }
38309
38310        end = offsets[count];
38311      }
38312
38313      for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
38314        var offsetStart = offsets[i];
38315        var offsetEnd = offsets[i + 1];
38316        cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
38317      }
38318
38319      return {
38320        obj: cffIndex,
38321        endPos: end
38322      };
38323    },
38324    parseNameIndex: function CFFParser_parseNameIndex(index) {
38325      var names = [];
38326
38327      for (var i = 0, ii = index.count; i < ii; ++i) {
38328        var name = index.get(i);
38329        names.push((0, _util.bytesToString)(name));
38330      }
38331
38332      return names;
38333    },
38334    parseStringIndex: function CFFParser_parseStringIndex(index) {
38335      var strings = new CFFStrings();
38336
38337      for (var i = 0, ii = index.count; i < ii; ++i) {
38338        var data = index.get(i);
38339        strings.add((0, _util.bytesToString)(data));
38340      }
38341
38342      return strings;
38343    },
38344    createDict: function CFFParser_createDict(Type, dict, strings) {
38345      var cffDict = new Type(strings);
38346
38347      for (var i = 0, ii = dict.length; i < ii; ++i) {
38348        var pair = dict[i];
38349        var key = pair[0];
38350        var value = pair[1];
38351        cffDict.setByKey(key, value);
38352      }
38353
38354      return cffDict;
38355    },
38356    parseCharString: function CFFParser_parseCharString(state, data, localSubrIndex, globalSubrIndex) {
38357      if (!data || state.callDepth > MAX_SUBR_NESTING) {
38358        return false;
38359      }
38360
38361      var stackSize = state.stackSize;
38362      var stack = state.stack;
38363      var length = data.length;
38364
38365      for (var j = 0; j < length;) {
38366        var value = data[j++];
38367        var validationCommand = null;
38368
38369        if (value === 12) {
38370          var q = data[j++];
38371
38372          if (q === 0) {
38373            data[j - 2] = 139;
38374            data[j - 1] = 22;
38375            stackSize = 0;
38376          } else {
38377            validationCommand = CharstringValidationData12[q];
38378          }
38379        } else if (value === 28) {
38380          stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
38381          j += 2;
38382          stackSize++;
38383        } else if (value === 14) {
38384          if (stackSize >= 4) {
38385            stackSize -= 4;
38386
38387            if (this.seacAnalysisEnabled) {
38388              state.seac = stack.slice(stackSize, stackSize + 4);
38389              return false;
38390            }
38391          }
38392
38393          validationCommand = CharstringValidationData[value];
38394        } else if (value >= 32 && value <= 246) {
38395          stack[stackSize] = value - 139;
38396          stackSize++;
38397        } else if (value >= 247 && value <= 254) {
38398          stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
38399          j++;
38400          stackSize++;
38401        } else if (value === 255) {
38402          stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
38403          j += 4;
38404          stackSize++;
38405        } else if (value === 19 || value === 20) {
38406          state.hints += stackSize >> 1;
38407          j += state.hints + 7 >> 3;
38408          stackSize %= 2;
38409          validationCommand = CharstringValidationData[value];
38410        } else if (value === 10 || value === 29) {
38411          var subrsIndex;
38412
38413          if (value === 10) {
38414            subrsIndex = localSubrIndex;
38415          } else {
38416            subrsIndex = globalSubrIndex;
38417          }
38418
38419          if (!subrsIndex) {
38420            validationCommand = CharstringValidationData[value];
38421            (0, _util.warn)('Missing subrsIndex for ' + validationCommand.id);
38422            return false;
38423          }
38424
38425          var bias = 32768;
38426
38427          if (subrsIndex.count < 1240) {
38428            bias = 107;
38429          } else if (subrsIndex.count < 33900) {
38430            bias = 1131;
38431          }
38432
38433          var subrNumber = stack[--stackSize] + bias;
38434
38435          if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
38436            validationCommand = CharstringValidationData[value];
38437            (0, _util.warn)('Out of bounds subrIndex for ' + validationCommand.id);
38438            return false;
38439          }
38440
38441          state.stackSize = stackSize;
38442          state.callDepth++;
38443          var valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
38444
38445          if (!valid) {
38446            return false;
38447          }
38448
38449          state.callDepth--;
38450          stackSize = state.stackSize;
38451          continue;
38452        } else if (value === 11) {
38453          state.stackSize = stackSize;
38454          return true;
38455        } else {
38456          validationCommand = CharstringValidationData[value];
38457        }
38458
38459        if (validationCommand) {
38460          if (validationCommand.stem) {
38461            state.hints += stackSize >> 1;
38462
38463            if (value === 3 || value === 23) {
38464              state.hasVStems = true;
38465            } else if (state.hasVStems && (value === 1 || value === 18)) {
38466              (0, _util.warn)('CFF stem hints are in wrong order');
38467              data[j - 1] = value === 1 ? 3 : 23;
38468            }
38469          }
38470
38471          if ('min' in validationCommand) {
38472            if (!state.undefStack && stackSize < validationCommand.min) {
38473              (0, _util.warn)('Not enough parameters for ' + validationCommand.id + '; actual: ' + stackSize + ', expected: ' + validationCommand.min);
38474              return false;
38475            }
38476          }
38477
38478          if (state.firstStackClearing && validationCommand.stackClearing) {
38479            state.firstStackClearing = false;
38480            stackSize -= validationCommand.min;
38481
38482            if (stackSize >= 2 && validationCommand.stem) {
38483              stackSize %= 2;
38484            } else if (stackSize > 1) {
38485              (0, _util.warn)('Found too many parameters for stack-clearing command');
38486            }
38487
38488            if (stackSize > 0 && stack[stackSize - 1] >= 0) {
38489              state.width = stack[stackSize - 1];
38490            }
38491          }
38492
38493          if ('stackDelta' in validationCommand) {
38494            if ('stackFn' in validationCommand) {
38495              validationCommand.stackFn(stack, stackSize);
38496            }
38497
38498            stackSize += validationCommand.stackDelta;
38499          } else if (validationCommand.stackClearing) {
38500            stackSize = 0;
38501          } else if (validationCommand.resetStack) {
38502            stackSize = 0;
38503            state.undefStack = false;
38504          } else if (validationCommand.undefStack) {
38505            stackSize = 0;
38506            state.undefStack = true;
38507            state.firstStackClearing = false;
38508          }
38509        }
38510      }
38511
38512      state.stackSize = stackSize;
38513      return true;
38514    },
38515    parseCharStrings: function parseCharStrings(_ref) {
38516      var charStrings = _ref.charStrings,
38517          localSubrIndex = _ref.localSubrIndex,
38518          globalSubrIndex = _ref.globalSubrIndex,
38519          fdSelect = _ref.fdSelect,
38520          fdArray = _ref.fdArray,
38521          privateDict = _ref.privateDict;
38522      var seacs = [];
38523      var widths = [];
38524      var count = charStrings.count;
38525
38526      for (var i = 0; i < count; i++) {
38527        var charstring = charStrings.get(i);
38528        var state = {
38529          callDepth: 0,
38530          stackSize: 0,
38531          stack: [],
38532          undefStack: true,
38533          hints: 0,
38534          firstStackClearing: true,
38535          seac: null,
38536          width: null,
38537          hasVStems: false
38538        };
38539        var valid = true;
38540        var localSubrToUse = null;
38541        var privateDictToUse = privateDict;
38542
38543        if (fdSelect && fdArray.length) {
38544          var fdIndex = fdSelect.getFDIndex(i);
38545
38546          if (fdIndex === -1) {
38547            (0, _util.warn)('Glyph index is not in fd select.');
38548            valid = false;
38549          }
38550
38551          if (fdIndex >= fdArray.length) {
38552            (0, _util.warn)('Invalid fd index for glyph index.');
38553            valid = false;
38554          }
38555
38556          if (valid) {
38557            privateDictToUse = fdArray[fdIndex].privateDict;
38558            localSubrToUse = privateDictToUse.subrsIndex;
38559          }
38560        } else if (localSubrIndex) {
38561          localSubrToUse = localSubrIndex;
38562        }
38563
38564        if (valid) {
38565          valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
38566        }
38567
38568        if (state.width !== null) {
38569          var nominalWidth = privateDictToUse.getByName('nominalWidthX');
38570          widths[i] = nominalWidth + state.width;
38571        } else {
38572          var defaultWidth = privateDictToUse.getByName('defaultWidthX');
38573          widths[i] = defaultWidth;
38574        }
38575
38576        if (state.seac !== null) {
38577          seacs[i] = state.seac;
38578        }
38579
38580        if (!valid) {
38581          charStrings.set(i, new Uint8Array([14]));
38582        }
38583      }
38584
38585      return {
38586        charStrings: charStrings,
38587        seacs: seacs,
38588        widths: widths
38589      };
38590    },
38591    emptyPrivateDictionary: function CFFParser_emptyPrivateDictionary(parentDict) {
38592      var privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
38593      parentDict.setByKey(18, [0, 0]);
38594      parentDict.privateDict = privateDict;
38595    },
38596    parsePrivateDict: function CFFParser_parsePrivateDict(parentDict) {
38597      if (!parentDict.hasName('Private')) {
38598        this.emptyPrivateDictionary(parentDict);
38599        return;
38600      }
38601
38602      var privateOffset = parentDict.getByName('Private');
38603
38604      if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
38605        parentDict.removeByName('Private');
38606        return;
38607      }
38608
38609      var size = privateOffset[0];
38610      var offset = privateOffset[1];
38611
38612      if (size === 0 || offset >= this.bytes.length) {
38613        this.emptyPrivateDictionary(parentDict);
38614        return;
38615      }
38616
38617      var privateDictEnd = offset + size;
38618      var dictData = this.bytes.subarray(offset, privateDictEnd);
38619      var dict = this.parseDict(dictData);
38620      var privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
38621      parentDict.privateDict = privateDict;
38622
38623      if (!privateDict.getByName('Subrs')) {
38624        return;
38625      }
38626
38627      var subrsOffset = privateDict.getByName('Subrs');
38628      var relativeOffset = offset + subrsOffset;
38629
38630      if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
38631        this.emptyPrivateDictionary(parentDict);
38632        return;
38633      }
38634
38635      var subrsIndex = this.parseIndex(relativeOffset);
38636      privateDict.subrsIndex = subrsIndex.obj;
38637    },
38638    parseCharsets: function CFFParser_parseCharsets(pos, length, strings, cid) {
38639      if (pos === 0) {
38640        return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset);
38641      } else if (pos === 1) {
38642        return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset);
38643      } else if (pos === 2) {
38644        return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset);
38645      }
38646
38647      var bytes = this.bytes;
38648      var start = pos;
38649      var format = bytes[pos++];
38650      var charset = ['.notdef'];
38651      var id, count, i;
38652      length -= 1;
38653
38654      switch (format) {
38655        case 0:
38656          for (i = 0; i < length; i++) {
38657            id = bytes[pos++] << 8 | bytes[pos++];
38658            charset.push(cid ? id : strings.get(id));
38659          }
38660
38661          break;
38662
38663        case 1:
38664          while (charset.length <= length) {
38665            id = bytes[pos++] << 8 | bytes[pos++];
38666            count = bytes[pos++];
38667
38668            for (i = 0; i <= count; i++) {
38669              charset.push(cid ? id++ : strings.get(id++));
38670            }
38671          }
38672
38673          break;
38674
38675        case 2:
38676          while (charset.length <= length) {
38677            id = bytes[pos++] << 8 | bytes[pos++];
38678            count = bytes[pos++] << 8 | bytes[pos++];
38679
38680            for (i = 0; i <= count; i++) {
38681              charset.push(cid ? id++ : strings.get(id++));
38682            }
38683          }
38684
38685          break;
38686
38687        default:
38688          throw new _util.FormatError('Unknown charset format');
38689      }
38690
38691      var end = pos;
38692      var raw = bytes.subarray(start, end);
38693      return new CFFCharset(false, format, charset, raw);
38694    },
38695    parseEncoding: function CFFParser_parseEncoding(pos, properties, strings, charset) {
38696      var encoding = Object.create(null);
38697      var bytes = this.bytes;
38698      var predefined = false;
38699      var format, i, ii;
38700      var raw = null;
38701
38702      function readSupplement() {
38703        var supplementsCount = bytes[pos++];
38704
38705        for (i = 0; i < supplementsCount; i++) {
38706          var code = bytes[pos++];
38707          var sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
38708          encoding[code] = charset.indexOf(strings.get(sid));
38709        }
38710      }
38711
38712      if (pos === 0 || pos === 1) {
38713        predefined = true;
38714        format = pos;
38715        var baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding;
38716
38717        for (i = 0, ii = charset.length; i < ii; i++) {
38718          var index = baseEncoding.indexOf(charset[i]);
38719
38720          if (index !== -1) {
38721            encoding[index] = i;
38722          }
38723        }
38724      } else {
38725        var dataStart = pos;
38726        format = bytes[pos++];
38727
38728        switch (format & 0x7f) {
38729          case 0:
38730            var glyphsCount = bytes[pos++];
38731
38732            for (i = 1; i <= glyphsCount; i++) {
38733              encoding[bytes[pos++]] = i;
38734            }
38735
38736            break;
38737
38738          case 1:
38739            var rangesCount = bytes[pos++];
38740            var gid = 1;
38741
38742            for (i = 0; i < rangesCount; i++) {
38743              var start = bytes[pos++];
38744              var left = bytes[pos++];
38745
38746              for (var j = start; j <= start + left; j++) {
38747                encoding[j] = gid++;
38748              }
38749            }
38750
38751            break;
38752
38753          default:
38754            throw new _util.FormatError("Unknown encoding format: ".concat(format, " in CFF"));
38755        }
38756
38757        var dataEnd = pos;
38758
38759        if (format & 0x80) {
38760          bytes[dataStart] &= 0x7f;
38761          readSupplement();
38762        }
38763
38764        raw = bytes.subarray(dataStart, dataEnd);
38765      }
38766
38767      format = format & 0x7f;
38768      return new CFFEncoding(predefined, format, encoding, raw);
38769    },
38770    parseFDSelect: function CFFParser_parseFDSelect(pos, length) {
38771      var bytes = this.bytes;
38772      var format = bytes[pos++];
38773      var fdSelect = [];
38774      var i;
38775
38776      switch (format) {
38777        case 0:
38778          for (i = 0; i < length; ++i) {
38779            var id = bytes[pos++];
38780            fdSelect.push(id);
38781          }
38782
38783          break;
38784
38785        case 3:
38786          var rangesCount = bytes[pos++] << 8 | bytes[pos++];
38787
38788          for (i = 0; i < rangesCount; ++i) {
38789            var first = bytes[pos++] << 8 | bytes[pos++];
38790
38791            if (i === 0 && first !== 0) {
38792              (0, _util.warn)('parseFDSelect: The first range must have a first GID of 0' + ' -- trying to recover.');
38793              first = 0;
38794            }
38795
38796            var fdIndex = bytes[pos++];
38797            var next = bytes[pos] << 8 | bytes[pos + 1];
38798
38799            for (var j = first; j < next; ++j) {
38800              fdSelect.push(fdIndex);
38801            }
38802          }
38803
38804          pos += 2;
38805          break;
38806
38807        default:
38808          throw new _util.FormatError("parseFDSelect: Unknown format \"".concat(format, "\"."));
38809      }
38810
38811      if (fdSelect.length !== length) {
38812        throw new _util.FormatError('parseFDSelect: Invalid font data.');
38813      }
38814
38815      return new CFFFDSelect(format, fdSelect);
38816    }
38817  };
38818  return CFFParser;
38819}();
38820
38821exports.CFFParser = CFFParser;
38822
38823var CFF = function CFFClosure() {
38824  function CFF() {
38825    this.header = null;
38826    this.names = [];
38827    this.topDict = null;
38828    this.strings = new CFFStrings();
38829    this.globalSubrIndex = null;
38830    this.encoding = null;
38831    this.charset = null;
38832    this.charStrings = null;
38833    this.fdArray = [];
38834    this.fdSelect = null;
38835    this.isCIDFont = false;
38836  }
38837
38838  CFF.prototype = {
38839    duplicateFirstGlyph: function CFF_duplicateFirstGlyph() {
38840      if (this.charStrings.count >= 65535) {
38841        (0, _util.warn)('Not enough space in charstrings to duplicate first glyph.');
38842        return;
38843      }
38844
38845      var glyphZero = this.charStrings.get(0);
38846      this.charStrings.add(glyphZero);
38847
38848      if (this.isCIDFont) {
38849        this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]);
38850      }
38851    },
38852    hasGlyphId: function CFF_hasGlyphID(id) {
38853      if (id < 0 || id >= this.charStrings.count) {
38854        return false;
38855      }
38856
38857      var glyph = this.charStrings.get(id);
38858      return glyph.length > 0;
38859    }
38860  };
38861  return CFF;
38862}();
38863
38864exports.CFF = CFF;
38865
38866var CFFHeader = function CFFHeaderClosure() {
38867  function CFFHeader(major, minor, hdrSize, offSize) {
38868    this.major = major;
38869    this.minor = minor;
38870    this.hdrSize = hdrSize;
38871    this.offSize = offSize;
38872  }
38873
38874  return CFFHeader;
38875}();
38876
38877exports.CFFHeader = CFFHeader;
38878
38879var CFFStrings = function CFFStringsClosure() {
38880  function CFFStrings() {
38881    this.strings = [];
38882  }
38883
38884  CFFStrings.prototype = {
38885    get: function CFFStrings_get(index) {
38886      if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) {
38887        return CFFStandardStrings[index];
38888      }
38889
38890      if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) {
38891        return this.strings[index - NUM_STANDARD_CFF_STRINGS];
38892      }
38893
38894      return CFFStandardStrings[0];
38895    },
38896    getSID: function CFFStrings_getSID(str) {
38897      var index = CFFStandardStrings.indexOf(str);
38898
38899      if (index !== -1) {
38900        return index;
38901      }
38902
38903      index = this.strings.indexOf(str);
38904
38905      if (index !== -1) {
38906        return index + NUM_STANDARD_CFF_STRINGS;
38907      }
38908
38909      return -1;
38910    },
38911    add: function CFFStrings_add(value) {
38912      this.strings.push(value);
38913    },
38914
38915    get count() {
38916      return this.strings.length;
38917    }
38918
38919  };
38920  return CFFStrings;
38921}();
38922
38923exports.CFFStrings = CFFStrings;
38924
38925var CFFIndex = function CFFIndexClosure() {
38926  function CFFIndex() {
38927    this.objects = [];
38928    this.length = 0;
38929  }
38930
38931  CFFIndex.prototype = {
38932    add: function CFFIndex_add(data) {
38933      this.length += data.length;
38934      this.objects.push(data);
38935    },
38936    set: function CFFIndex_set(index, data) {
38937      this.length += data.length - this.objects[index].length;
38938      this.objects[index] = data;
38939    },
38940    get: function CFFIndex_get(index) {
38941      return this.objects[index];
38942    },
38943
38944    get count() {
38945      return this.objects.length;
38946    }
38947
38948  };
38949  return CFFIndex;
38950}();
38951
38952exports.CFFIndex = CFFIndex;
38953
38954var CFFDict = function CFFDictClosure() {
38955  function CFFDict(tables, strings) {
38956    this.keyToNameMap = tables.keyToNameMap;
38957    this.nameToKeyMap = tables.nameToKeyMap;
38958    this.defaults = tables.defaults;
38959    this.types = tables.types;
38960    this.opcodes = tables.opcodes;
38961    this.order = tables.order;
38962    this.strings = strings;
38963    this.values = Object.create(null);
38964  }
38965
38966  CFFDict.prototype = {
38967    setByKey: function CFFDict_setByKey(key, value) {
38968      if (!(key in this.keyToNameMap)) {
38969        return false;
38970      }
38971
38972      var valueLength = value.length;
38973
38974      if (valueLength === 0) {
38975        return true;
38976      }
38977
38978      for (var i = 0; i < valueLength; i++) {
38979        if (isNaN(value[i])) {
38980          (0, _util.warn)('Invalid CFFDict value: "' + value + '" for key "' + key + '".');
38981          return true;
38982        }
38983      }
38984
38985      var type = this.types[key];
38986
38987      if (type === 'num' || type === 'sid' || type === 'offset') {
38988        value = value[0];
38989      }
38990
38991      this.values[key] = value;
38992      return true;
38993    },
38994    setByName: function CFFDict_setByName(name, value) {
38995      if (!(name in this.nameToKeyMap)) {
38996        throw new _util.FormatError("Invalid dictionary name \"".concat(name, "\""));
38997      }
38998
38999      this.values[this.nameToKeyMap[name]] = value;
39000    },
39001    hasName: function CFFDict_hasName(name) {
39002      return this.nameToKeyMap[name] in this.values;
39003    },
39004    getByName: function CFFDict_getByName(name) {
39005      if (!(name in this.nameToKeyMap)) {
39006        throw new _util.FormatError("Invalid dictionary name ".concat(name, "\""));
39007      }
39008
39009      var key = this.nameToKeyMap[name];
39010
39011      if (!(key in this.values)) {
39012        return this.defaults[key];
39013      }
39014
39015      return this.values[key];
39016    },
39017    removeByName: function CFFDict_removeByName(name) {
39018      delete this.values[this.nameToKeyMap[name]];
39019    }
39020  };
39021
39022  CFFDict.createTables = function CFFDict_createTables(layout) {
39023    var tables = {
39024      keyToNameMap: {},
39025      nameToKeyMap: {},
39026      defaults: {},
39027      types: {},
39028      opcodes: {},
39029      order: []
39030    };
39031
39032    for (var i = 0, ii = layout.length; i < ii; ++i) {
39033      var entry = layout[i];
39034      var key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
39035      tables.keyToNameMap[key] = entry[1];
39036      tables.nameToKeyMap[entry[1]] = key;
39037      tables.types[key] = entry[2];
39038      tables.defaults[key] = entry[3];
39039      tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]];
39040      tables.order.push(key);
39041    }
39042
39043    return tables;
39044  };
39045
39046  return CFFDict;
39047}();
39048
39049var CFFTopDict = function CFFTopDictClosure() {
39050  var layout = [[[12, 30], 'ROS', ['sid', 'sid', 'num'], null], [[12, 20], 'SyntheticBase', 'num', null], [0, 'version', 'sid', null], [1, 'Notice', 'sid', null], [[12, 0], 'Copyright', 'sid', null], [2, 'FullName', 'sid', null], [3, 'FamilyName', 'sid', null], [4, 'Weight', 'sid', null], [[12, 1], 'isFixedPitch', 'num', 0], [[12, 2], 'ItalicAngle', 'num', 0], [[12, 3], 'UnderlinePosition', 'num', -100], [[12, 4], 'UnderlineThickness', 'num', 50], [[12, 5], 'PaintType', 'num', 0], [[12, 6], 'CharstringType', 'num', 2], [[12, 7], 'FontMatrix', ['num', 'num', 'num', 'num', 'num', 'num'], [0.001, 0, 0, 0.001, 0, 0]], [13, 'UniqueID', 'num', null], [5, 'FontBBox', ['num', 'num', 'num', 'num'], [0, 0, 0, 0]], [[12, 8], 'StrokeWidth', 'num', 0], [14, 'XUID', 'array', null], [15, 'charset', 'offset', 0], [16, 'Encoding', 'offset', 0], [17, 'CharStrings', 'offset', 0], [18, 'Private', ['offset', 'offset'], null], [[12, 21], 'PostScript', 'sid', null], [[12, 22], 'BaseFontName', 'sid', null], [[12, 23], 'BaseFontBlend', 'delta', null], [[12, 31], 'CIDFontVersion', 'num', 0], [[12, 32], 'CIDFontRevision', 'num', 0], [[12, 33], 'CIDFontType', 'num', 0], [[12, 34], 'CIDCount', 'num', 8720], [[12, 35], 'UIDBase', 'num', null], [[12, 37], 'FDSelect', 'offset', null], [[12, 36], 'FDArray', 'offset', null], [[12, 38], 'FontName', 'sid', null]];
39051  var tables = null;
39052
39053  function CFFTopDict(strings) {
39054    if (tables === null) {
39055      tables = CFFDict.createTables(layout);
39056    }
39057
39058    CFFDict.call(this, tables, strings);
39059    this.privateDict = null;
39060  }
39061
39062  CFFTopDict.prototype = Object.create(CFFDict.prototype);
39063  return CFFTopDict;
39064}();
39065
39066exports.CFFTopDict = CFFTopDict;
39067
39068var CFFPrivateDict = function CFFPrivateDictClosure() {
39069  var layout = [[6, 'BlueValues', 'delta', null], [7, 'OtherBlues', 'delta', null], [8, 'FamilyBlues', 'delta', null], [9, 'FamilyOtherBlues', 'delta', null], [[12, 9], 'BlueScale', 'num', 0.039625], [[12, 10], 'BlueShift', 'num', 7], [[12, 11], 'BlueFuzz', 'num', 1], [10, 'StdHW', 'num', null], [11, 'StdVW', 'num', null], [[12, 12], 'StemSnapH', 'delta', null], [[12, 13], 'StemSnapV', 'delta', null], [[12, 14], 'ForceBold', 'num', 0], [[12, 17], 'LanguageGroup', 'num', 0], [[12, 18], 'ExpansionFactor', 'num', 0.06], [[12, 19], 'initialRandomSeed', 'num', 0], [20, 'defaultWidthX', 'num', 0], [21, 'nominalWidthX', 'num', 0], [19, 'Subrs', 'offset', null]];
39070  var tables = null;
39071
39072  function CFFPrivateDict(strings) {
39073    if (tables === null) {
39074      tables = CFFDict.createTables(layout);
39075    }
39076
39077    CFFDict.call(this, tables, strings);
39078    this.subrsIndex = null;
39079  }
39080
39081  CFFPrivateDict.prototype = Object.create(CFFDict.prototype);
39082  return CFFPrivateDict;
39083}();
39084
39085exports.CFFPrivateDict = CFFPrivateDict;
39086var CFFCharsetPredefinedTypes = {
39087  ISO_ADOBE: 0,
39088  EXPERT: 1,
39089  EXPERT_SUBSET: 2
39090};
39091
39092var CFFCharset = function CFFCharsetClosure() {
39093  function CFFCharset(predefined, format, charset, raw) {
39094    this.predefined = predefined;
39095    this.format = format;
39096    this.charset = charset;
39097    this.raw = raw;
39098  }
39099
39100  return CFFCharset;
39101}();
39102
39103exports.CFFCharset = CFFCharset;
39104
39105var CFFEncoding = function CFFEncodingClosure() {
39106  function CFFEncoding(predefined, format, encoding, raw) {
39107    this.predefined = predefined;
39108    this.format = format;
39109    this.encoding = encoding;
39110    this.raw = raw;
39111  }
39112
39113  return CFFEncoding;
39114}();
39115
39116var CFFFDSelect = function CFFFDSelectClosure() {
39117  function CFFFDSelect(format, fdSelect) {
39118    this.format = format;
39119    this.fdSelect = fdSelect;
39120  }
39121
39122  CFFFDSelect.prototype = {
39123    getFDIndex: function CFFFDSelect_get(glyphIndex) {
39124      if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
39125        return -1;
39126      }
39127
39128      return this.fdSelect[glyphIndex];
39129    }
39130  };
39131  return CFFFDSelect;
39132}();
39133
39134exports.CFFFDSelect = CFFFDSelect;
39135
39136var CFFOffsetTracker = function CFFOffsetTrackerClosure() {
39137  function CFFOffsetTracker() {
39138    this.offsets = Object.create(null);
39139  }
39140
39141  CFFOffsetTracker.prototype = {
39142    isTracking: function CFFOffsetTracker_isTracking(key) {
39143      return key in this.offsets;
39144    },
39145    track: function CFFOffsetTracker_track(key, location) {
39146      if (key in this.offsets) {
39147        throw new _util.FormatError("Already tracking location of ".concat(key));
39148      }
39149
39150      this.offsets[key] = location;
39151    },
39152    offset: function CFFOffsetTracker_offset(value) {
39153      for (var key in this.offsets) {
39154        this.offsets[key] += value;
39155      }
39156    },
39157    setEntryLocation: function CFFOffsetTracker_setEntryLocation(key, values, output) {
39158      if (!(key in this.offsets)) {
39159        throw new _util.FormatError("Not tracking location of ".concat(key));
39160      }
39161
39162      var data = output.data;
39163      var dataOffset = this.offsets[key];
39164      var size = 5;
39165
39166      for (var i = 0, ii = values.length; i < ii; ++i) {
39167        var offset0 = i * size + dataOffset;
39168        var offset1 = offset0 + 1;
39169        var offset2 = offset0 + 2;
39170        var offset3 = offset0 + 3;
39171        var offset4 = offset0 + 4;
39172
39173        if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
39174          throw new _util.FormatError('writing to an offset that is not empty');
39175        }
39176
39177        var value = values[i];
39178        data[offset0] = 0x1d;
39179        data[offset1] = value >> 24 & 0xFF;
39180        data[offset2] = value >> 16 & 0xFF;
39181        data[offset3] = value >> 8 & 0xFF;
39182        data[offset4] = value & 0xFF;
39183      }
39184    }
39185  };
39186  return CFFOffsetTracker;
39187}();
39188
39189var CFFCompiler = function CFFCompilerClosure() {
39190  function CFFCompiler(cff) {
39191    this.cff = cff;
39192  }
39193
39194  CFFCompiler.prototype = {
39195    compile: function CFFCompiler_compile() {
39196      var cff = this.cff;
39197      var output = {
39198        data: [],
39199        length: 0,
39200        add: function CFFCompiler_add(data) {
39201          this.data = this.data.concat(data);
39202          this.length = this.data.length;
39203        }
39204      };
39205      var header = this.compileHeader(cff.header);
39206      output.add(header);
39207      var nameIndex = this.compileNameIndex(cff.names);
39208      output.add(nameIndex);
39209
39210      if (cff.isCIDFont) {
39211        if (cff.topDict.hasName('FontMatrix')) {
39212          var base = cff.topDict.getByName('FontMatrix');
39213          cff.topDict.removeByName('FontMatrix');
39214
39215          for (var i = 0, ii = cff.fdArray.length; i < ii; i++) {
39216            var subDict = cff.fdArray[i];
39217            var matrix = base.slice(0);
39218
39219            if (subDict.hasName('FontMatrix')) {
39220              matrix = _util.Util.transform(matrix, subDict.getByName('FontMatrix'));
39221            }
39222
39223            subDict.setByName('FontMatrix', matrix);
39224          }
39225        }
39226      }
39227
39228      cff.topDict.setByName('charset', 0);
39229      var compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
39230      output.add(compiled.output);
39231      var topDictTracker = compiled.trackers[0];
39232      var stringIndex = this.compileStringIndex(cff.strings.strings);
39233      output.add(stringIndex);
39234      var globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
39235      output.add(globalSubrIndex);
39236
39237      if (cff.encoding && cff.topDict.hasName('Encoding')) {
39238        if (cff.encoding.predefined) {
39239          topDictTracker.setEntryLocation('Encoding', [cff.encoding.format], output);
39240        } else {
39241          var encoding = this.compileEncoding(cff.encoding);
39242          topDictTracker.setEntryLocation('Encoding', [output.length], output);
39243          output.add(encoding);
39244        }
39245      }
39246
39247      var charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont);
39248      topDictTracker.setEntryLocation('charset', [output.length], output);
39249      output.add(charset);
39250      var charStrings = this.compileCharStrings(cff.charStrings);
39251      topDictTracker.setEntryLocation('CharStrings', [output.length], output);
39252      output.add(charStrings);
39253
39254      if (cff.isCIDFont) {
39255        topDictTracker.setEntryLocation('FDSelect', [output.length], output);
39256        var fdSelect = this.compileFDSelect(cff.fdSelect);
39257        output.add(fdSelect);
39258        compiled = this.compileTopDicts(cff.fdArray, output.length, true);
39259        topDictTracker.setEntryLocation('FDArray', [output.length], output);
39260        output.add(compiled.output);
39261        var fontDictTrackers = compiled.trackers;
39262        this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
39263      }
39264
39265      this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
39266      output.add([0]);
39267      return output.data;
39268    },
39269    encodeNumber: function CFFCompiler_encodeNumber(value) {
39270      if (parseFloat(value) === parseInt(value, 10) && !isNaN(value)) {
39271        return this.encodeInteger(value);
39272      }
39273
39274      return this.encodeFloat(value);
39275    },
39276    encodeFloat: function CFFCompiler_encodeFloat(num) {
39277      var value = num.toString();
39278      var m = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(value);
39279
39280      if (m) {
39281        var epsilon = parseFloat('1e' + ((m[2] ? +m[2] : 0) + m[1].length));
39282        value = (Math.round(num * epsilon) / epsilon).toString();
39283      }
39284
39285      var nibbles = '';
39286      var i, ii;
39287
39288      for (i = 0, ii = value.length; i < ii; ++i) {
39289        var a = value[i];
39290
39291        if (a === 'e') {
39292          nibbles += value[++i] === '-' ? 'c' : 'b';
39293        } else if (a === '.') {
39294          nibbles += 'a';
39295        } else if (a === '-') {
39296          nibbles += 'e';
39297        } else {
39298          nibbles += a;
39299        }
39300      }
39301
39302      nibbles += nibbles.length & 1 ? 'f' : 'ff';
39303      var out = [30];
39304
39305      for (i = 0, ii = nibbles.length; i < ii; i += 2) {
39306        out.push(parseInt(nibbles.substring(i, i + 2), 16));
39307      }
39308
39309      return out;
39310    },
39311    encodeInteger: function CFFCompiler_encodeInteger(value) {
39312      var code;
39313
39314      if (value >= -107 && value <= 107) {
39315        code = [value + 139];
39316      } else if (value >= 108 && value <= 1131) {
39317        value = value - 108;
39318        code = [(value >> 8) + 247, value & 0xFF];
39319      } else if (value >= -1131 && value <= -108) {
39320        value = -value - 108;
39321        code = [(value >> 8) + 251, value & 0xFF];
39322      } else if (value >= -32768 && value <= 32767) {
39323        code = [0x1c, value >> 8 & 0xFF, value & 0xFF];
39324      } else {
39325        code = [0x1d, value >> 24 & 0xFF, value >> 16 & 0xFF, value >> 8 & 0xFF, value & 0xFF];
39326      }
39327
39328      return code;
39329    },
39330    compileHeader: function CFFCompiler_compileHeader(header) {
39331      return [header.major, header.minor, header.hdrSize, header.offSize];
39332    },
39333    compileNameIndex: function CFFCompiler_compileNameIndex(names) {
39334      var nameIndex = new CFFIndex();
39335
39336      for (var i = 0, ii = names.length; i < ii; ++i) {
39337        var name = names[i];
39338        var length = Math.min(name.length, 127);
39339        var sanitizedName = new Array(length);
39340
39341        for (var j = 0; j < length; j++) {
39342          var _char = name[j];
39343
39344          if (_char < '!' || _char > '~' || _char === '[' || _char === ']' || _char === '(' || _char === ')' || _char === '{' || _char === '}' || _char === '<' || _char === '>' || _char === '/' || _char === '%') {
39345            _char = '_';
39346          }
39347
39348          sanitizedName[j] = _char;
39349        }
39350
39351        sanitizedName = sanitizedName.join('');
39352
39353        if (sanitizedName === '') {
39354          sanitizedName = 'Bad_Font_Name';
39355        }
39356
39357        nameIndex.add((0, _util.stringToBytes)(sanitizedName));
39358      }
39359
39360      return this.compileIndex(nameIndex);
39361    },
39362    compileTopDicts: function CFFCompiler_compileTopDicts(dicts, length, removeCidKeys) {
39363      var fontDictTrackers = [];
39364      var fdArrayIndex = new CFFIndex();
39365
39366      for (var i = 0, ii = dicts.length; i < ii; ++i) {
39367        var fontDict = dicts[i];
39368
39369        if (removeCidKeys) {
39370          fontDict.removeByName('CIDFontVersion');
39371          fontDict.removeByName('CIDFontRevision');
39372          fontDict.removeByName('CIDFontType');
39373          fontDict.removeByName('CIDCount');
39374          fontDict.removeByName('UIDBase');
39375        }
39376
39377        var fontDictTracker = new CFFOffsetTracker();
39378        var fontDictData = this.compileDict(fontDict, fontDictTracker);
39379        fontDictTrackers.push(fontDictTracker);
39380        fdArrayIndex.add(fontDictData);
39381        fontDictTracker.offset(length);
39382      }
39383
39384      fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
39385      return {
39386        trackers: fontDictTrackers,
39387        output: fdArrayIndex
39388      };
39389    },
39390    compilePrivateDicts: function CFFCompiler_compilePrivateDicts(dicts, trackers, output) {
39391      for (var i = 0, ii = dicts.length; i < ii; ++i) {
39392        var fontDict = dicts[i];
39393        var privateDict = fontDict.privateDict;
39394
39395        if (!privateDict || !fontDict.hasName('Private')) {
39396          throw new _util.FormatError('There must be a private dictionary.');
39397        }
39398
39399        var privateDictTracker = new CFFOffsetTracker();
39400        var privateDictData = this.compileDict(privateDict, privateDictTracker);
39401        var outputLength = output.length;
39402        privateDictTracker.offset(outputLength);
39403
39404        if (!privateDictData.length) {
39405          outputLength = 0;
39406        }
39407
39408        trackers[i].setEntryLocation('Private', [privateDictData.length, outputLength], output);
39409        output.add(privateDictData);
39410
39411        if (privateDict.subrsIndex && privateDict.hasName('Subrs')) {
39412          var subrs = this.compileIndex(privateDict.subrsIndex);
39413          privateDictTracker.setEntryLocation('Subrs', [privateDictData.length], output);
39414          output.add(subrs);
39415        }
39416      }
39417    },
39418    compileDict: function CFFCompiler_compileDict(dict, offsetTracker) {
39419      var out = [];
39420      var order = dict.order;
39421
39422      for (var i = 0; i < order.length; ++i) {
39423        var key = order[i];
39424
39425        if (!(key in dict.values)) {
39426          continue;
39427        }
39428
39429        var values = dict.values[key];
39430        var types = dict.types[key];
39431
39432        if (!Array.isArray(types)) {
39433          types = [types];
39434        }
39435
39436        if (!Array.isArray(values)) {
39437          values = [values];
39438        }
39439
39440        if (values.length === 0) {
39441          continue;
39442        }
39443
39444        for (var j = 0, jj = types.length; j < jj; ++j) {
39445          var type = types[j];
39446          var value = values[j];
39447
39448          switch (type) {
39449            case 'num':
39450            case 'sid':
39451              out = out.concat(this.encodeNumber(value));
39452              break;
39453
39454            case 'offset':
39455              var name = dict.keyToNameMap[key];
39456
39457              if (!offsetTracker.isTracking(name)) {
39458                offsetTracker.track(name, out.length);
39459              }
39460
39461              out = out.concat([0x1d, 0, 0, 0, 0]);
39462              break;
39463
39464            case 'array':
39465            case 'delta':
39466              out = out.concat(this.encodeNumber(value));
39467
39468              for (var k = 1, kk = values.length; k < kk; ++k) {
39469                out = out.concat(this.encodeNumber(values[k]));
39470              }
39471
39472              break;
39473
39474            default:
39475              throw new _util.FormatError("Unknown data type of ".concat(type));
39476          }
39477        }
39478
39479        out = out.concat(dict.opcodes[key]);
39480      }
39481
39482      return out;
39483    },
39484    compileStringIndex: function CFFCompiler_compileStringIndex(strings) {
39485      var stringIndex = new CFFIndex();
39486
39487      for (var i = 0, ii = strings.length; i < ii; ++i) {
39488        stringIndex.add((0, _util.stringToBytes)(strings[i]));
39489      }
39490
39491      return this.compileIndex(stringIndex);
39492    },
39493    compileGlobalSubrIndex: function CFFCompiler_compileGlobalSubrIndex() {
39494      var globalSubrIndex = this.cff.globalSubrIndex;
39495      this.out.writeByteArray(this.compileIndex(globalSubrIndex));
39496    },
39497    compileCharStrings: function CFFCompiler_compileCharStrings(charStrings) {
39498      var charStringsIndex = new CFFIndex();
39499
39500      for (var i = 0; i < charStrings.count; i++) {
39501        var glyph = charStrings.get(i);
39502
39503        if (glyph.length === 0) {
39504          charStringsIndex.add(new Uint8Array([0x8B, 0x0E]));
39505          continue;
39506        }
39507
39508        charStringsIndex.add(glyph);
39509      }
39510
39511      return this.compileIndex(charStringsIndex);
39512    },
39513    compileCharset: function CFFCompiler_compileCharset(charset, numGlyphs, strings, isCIDFont) {
39514      var out;
39515      var numGlyphsLessNotDef = numGlyphs - 1;
39516
39517      if (isCIDFont) {
39518        out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xFF, numGlyphsLessNotDef & 0xFF]);
39519      } else {
39520        var length = 1 + numGlyphsLessNotDef * 2;
39521        out = new Uint8Array(length);
39522        out[0] = 0;
39523        var charsetIndex = 0;
39524        var numCharsets = charset.charset.length;
39525        var warned = false;
39526
39527        for (var i = 1; i < out.length; i += 2) {
39528          var sid = 0;
39529
39530          if (charsetIndex < numCharsets) {
39531            var name = charset.charset[charsetIndex++];
39532            sid = strings.getSID(name);
39533
39534            if (sid === -1) {
39535              sid = 0;
39536
39537              if (!warned) {
39538                warned = true;
39539                (0, _util.warn)("Couldn't find ".concat(name, " in CFF strings"));
39540              }
39541            }
39542          }
39543
39544          out[i] = sid >> 8 & 0xFF;
39545          out[i + 1] = sid & 0xFF;
39546        }
39547      }
39548
39549      return this.compileTypedArray(out);
39550    },
39551    compileEncoding: function CFFCompiler_compileEncoding(encoding) {
39552      return this.compileTypedArray(encoding.raw);
39553    },
39554    compileFDSelect: function CFFCompiler_compileFDSelect(fdSelect) {
39555      var format = fdSelect.format;
39556      var out, i;
39557
39558      switch (format) {
39559        case 0:
39560          out = new Uint8Array(1 + fdSelect.fdSelect.length);
39561          out[0] = format;
39562
39563          for (i = 0; i < fdSelect.fdSelect.length; i++) {
39564            out[i + 1] = fdSelect.fdSelect[i];
39565          }
39566
39567          break;
39568
39569        case 3:
39570          var start = 0;
39571          var lastFD = fdSelect.fdSelect[0];
39572          var ranges = [format, 0, 0, start >> 8 & 0xFF, start & 0xFF, lastFD];
39573
39574          for (i = 1; i < fdSelect.fdSelect.length; i++) {
39575            var currentFD = fdSelect.fdSelect[i];
39576
39577            if (currentFD !== lastFD) {
39578              ranges.push(i >> 8 & 0xFF, i & 0xFF, currentFD);
39579              lastFD = currentFD;
39580            }
39581          }
39582
39583          var numRanges = (ranges.length - 3) / 3;
39584          ranges[1] = numRanges >> 8 & 0xFF;
39585          ranges[2] = numRanges & 0xFF;
39586          ranges.push(i >> 8 & 0xFF, i & 0xFF);
39587          out = new Uint8Array(ranges);
39588          break;
39589      }
39590
39591      return this.compileTypedArray(out);
39592    },
39593    compileTypedArray: function CFFCompiler_compileTypedArray(data) {
39594      var out = [];
39595
39596      for (var i = 0, ii = data.length; i < ii; ++i) {
39597        out[i] = data[i];
39598      }
39599
39600      return out;
39601    },
39602    compileIndex: function CFFCompiler_compileIndex(index, trackers) {
39603      trackers = trackers || [];
39604      var objects = index.objects;
39605      var count = objects.length;
39606
39607      if (count === 0) {
39608        return [0, 0, 0];
39609      }
39610
39611      var data = [count >> 8 & 0xFF, count & 0xff];
39612      var lastOffset = 1,
39613          i;
39614
39615      for (i = 0; i < count; ++i) {
39616        lastOffset += objects[i].length;
39617      }
39618
39619      var offsetSize;
39620
39621      if (lastOffset < 0x100) {
39622        offsetSize = 1;
39623      } else if (lastOffset < 0x10000) {
39624        offsetSize = 2;
39625      } else if (lastOffset < 0x1000000) {
39626        offsetSize = 3;
39627      } else {
39628        offsetSize = 4;
39629      }
39630
39631      data.push(offsetSize);
39632      var relativeOffset = 1;
39633
39634      for (i = 0; i < count + 1; i++) {
39635        if (offsetSize === 1) {
39636          data.push(relativeOffset & 0xFF);
39637        } else if (offsetSize === 2) {
39638          data.push(relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
39639        } else if (offsetSize === 3) {
39640          data.push(relativeOffset >> 16 & 0xFF, relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
39641        } else {
39642          data.push(relativeOffset >>> 24 & 0xFF, relativeOffset >> 16 & 0xFF, relativeOffset >> 8 & 0xFF, relativeOffset & 0xFF);
39643        }
39644
39645        if (objects[i]) {
39646          relativeOffset += objects[i].length;
39647        }
39648      }
39649
39650      for (i = 0; i < count; i++) {
39651        if (trackers[i]) {
39652          trackers[i].offset(data.length);
39653        }
39654
39655        for (var j = 0, jj = objects[i].length; j < jj; j++) {
39656          data.push(objects[i][j]);
39657        }
39658      }
39659
39660      return data;
39661    }
39662  };
39663  return CFFCompiler;
39664}();
39665
39666exports.CFFCompiler = CFFCompiler;
39667
39668/***/ }),
39669/* 176 */
39670/***/ (function(module, exports, __w_pdfjs_require__) {
39671
39672"use strict";
39673
39674
39675Object.defineProperty(exports, "__esModule", {
39676  value: true
39677});
39678exports.ExpertSubsetCharset = exports.ExpertCharset = exports.ISOAdobeCharset = void 0;
39679var ISOAdobeCharset = ['.notdef', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent', 'ampersand', 'quoteright', 'parenleft', 'parenright', 'asterisk', 'plus', 'comma', 'hyphen', 'period', 'slash', 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', 'less', 'equal', 'greater', 'question', 'at', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'bracketleft', 'backslash', 'bracketright', 'asciicircum', 'underscore', 'quoteleft', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'braceleft', 'bar', 'braceright', 'asciitilde', 'exclamdown', 'cent', 'sterling', 'fraction', 'yen', 'florin', 'section', 'currency', 'quotesingle', 'quotedblleft', 'guillemotleft', 'guilsinglleft', 'guilsinglright', 'fi', 'fl', 'endash', 'dagger', 'daggerdbl', 'periodcentered', 'paragraph', 'bullet', 'quotesinglbase', 'quotedblbase', 'quotedblright', 'guillemotright', 'ellipsis', 'perthousand', 'questiondown', 'grave', 'acute', 'circumflex', 'tilde', 'macron', 'breve', 'dotaccent', 'dieresis', 'ring', 'cedilla', 'hungarumlaut', 'ogonek', 'caron', 'emdash', 'AE', 'ordfeminine', 'Lslash', 'Oslash', 'OE', 'ordmasculine', 'ae', 'dotlessi', 'lslash', 'oslash', 'oe', 'germandbls', 'onesuperior', 'logicalnot', 'mu', 'trademark', 'Eth', 'onehalf', 'plusminus', 'Thorn', 'onequarter', 'divide', 'brokenbar', 'degree', 'thorn', 'threequarters', 'twosuperior', 'registered', 'minus', 'eth', 'multiply', 'threesuperior', 'copyright', 'Aacute', 'Acircumflex', 'Adieresis', 'Agrave', 'Aring', 'Atilde', 'Ccedilla', 'Eacute', 'Ecircumflex', 'Edieresis', 'Egrave', 'Iacute', 'Icircumflex', 'Idieresis', 'Igrave', 'Ntilde', 'Oacute', 'Ocircumflex', 'Odieresis', 'Ograve', 'Otilde', 'Scaron', 'Uacute', 'Ucircumflex', 'Udieresis', 'Ugrave', 'Yacute', 'Ydieresis', 'Zcaron', 'aacute', 'acircumflex', 'adieresis', 'agrave', 'aring', 'atilde', 'ccedilla', 'eacute', 'ecircumflex', 'edieresis', 'egrave', 'iacute', 'icircumflex', 'idieresis', 'igrave', 'ntilde', 'oacute', 'ocircumflex', 'odieresis', 'ograve', 'otilde', 'scaron', 'uacute', 'ucircumflex', 'udieresis', 'ugrave', 'yacute', 'ydieresis', 'zcaron'];
39680exports.ISOAdobeCharset = ISOAdobeCharset;
39681var ExpertCharset = ['.notdef', 'space', 'exclamsmall', 'Hungarumlautsmall', 'dollaroldstyle', 'dollarsuperior', 'ampersandsmall', 'Acutesmall', 'parenleftsuperior', 'parenrightsuperior', 'twodotenleader', 'onedotenleader', 'comma', 'hyphen', 'period', 'fraction', 'zerooldstyle', 'oneoldstyle', 'twooldstyle', 'threeoldstyle', 'fouroldstyle', 'fiveoldstyle', 'sixoldstyle', 'sevenoldstyle', 'eightoldstyle', 'nineoldstyle', 'colon', 'semicolon', 'commasuperior', 'threequartersemdash', 'periodsuperior', 'questionsmall', 'asuperior', 'bsuperior', 'centsuperior', 'dsuperior', 'esuperior', 'isuperior', 'lsuperior', 'msuperior', 'nsuperior', 'osuperior', 'rsuperior', 'ssuperior', 'tsuperior', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'parenleftinferior', 'parenrightinferior', 'Circumflexsmall', 'hyphensuperior', 'Gravesmall', 'Asmall', 'Bsmall', 'Csmall', 'Dsmall', 'Esmall', 'Fsmall', 'Gsmall', 'Hsmall', 'Ismall', 'Jsmall', 'Ksmall', 'Lsmall', 'Msmall', 'Nsmall', 'Osmall', 'Psmall', 'Qsmall', 'Rsmall', 'Ssmall', 'Tsmall', 'Usmall', 'Vsmall', 'Wsmall', 'Xsmall', 'Ysmall', 'Zsmall', 'colonmonetary', 'onefitted', 'rupiah', 'Tildesmall', 'exclamdownsmall', 'centoldstyle', 'Lslashsmall', 'Scaronsmall', 'Zcaronsmall', 'Dieresissmall', 'Brevesmall', 'Caronsmall', 'Dotaccentsmall', 'Macronsmall', 'figuredash', 'hypheninferior', 'Ogoneksmall', 'Ringsmall', 'Cedillasmall', 'onequarter', 'onehalf', 'threequarters', 'questiondownsmall', 'oneeighth', 'threeeighths', 'fiveeighths', 'seveneighths', 'onethird', 'twothirds', 'zerosuperior', 'onesuperior', 'twosuperior', 'threesuperior', 'foursuperior', 'fivesuperior', 'sixsuperior', 'sevensuperior', 'eightsuperior', 'ninesuperior', 'zeroinferior', 'oneinferior', 'twoinferior', 'threeinferior', 'fourinferior', 'fiveinferior', 'sixinferior', 'seveninferior', 'eightinferior', 'nineinferior', 'centinferior', 'dollarinferior', 'periodinferior', 'commainferior', 'Agravesmall', 'Aacutesmall', 'Acircumflexsmall', 'Atildesmall', 'Adieresissmall', 'Aringsmall', 'AEsmall', 'Ccedillasmall', 'Egravesmall', 'Eacutesmall', 'Ecircumflexsmall', 'Edieresissmall', 'Igravesmall', 'Iacutesmall', 'Icircumflexsmall', 'Idieresissmall', 'Ethsmall', 'Ntildesmall', 'Ogravesmall', 'Oacutesmall', 'Ocircumflexsmall', 'Otildesmall', 'Odieresissmall', 'OEsmall', 'Oslashsmall', 'Ugravesmall', 'Uacutesmall', 'Ucircumflexsmall', 'Udieresissmall', 'Yacutesmall', 'Thornsmall', 'Ydieresissmall'];
39682exports.ExpertCharset = ExpertCharset;
39683var ExpertSubsetCharset = ['.notdef', 'space', 'dollaroldstyle', 'dollarsuperior', 'parenleftsuperior', 'parenrightsuperior', 'twodotenleader', 'onedotenleader', 'comma', 'hyphen', 'period', 'fraction', 'zerooldstyle', 'oneoldstyle', 'twooldstyle', 'threeoldstyle', 'fouroldstyle', 'fiveoldstyle', 'sixoldstyle', 'sevenoldstyle', 'eightoldstyle', 'nineoldstyle', 'colon', 'semicolon', 'commasuperior', 'threequartersemdash', 'periodsuperior', 'asuperior', 'bsuperior', 'centsuperior', 'dsuperior', 'esuperior', 'isuperior', 'lsuperior', 'msuperior', 'nsuperior', 'osuperior', 'rsuperior', 'ssuperior', 'tsuperior', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'parenleftinferior', 'parenrightinferior', 'hyphensuperior', 'colonmonetary', 'onefitted', 'rupiah', 'centoldstyle', 'figuredash', 'hypheninferior', 'onequarter', 'onehalf', 'threequarters', 'oneeighth', 'threeeighths', 'fiveeighths', 'seveneighths', 'onethird', 'twothirds', 'zerosuperior', 'onesuperior', 'twosuperior', 'threesuperior', 'foursuperior', 'fivesuperior', 'sixsuperior', 'sevensuperior', 'eightsuperior', 'ninesuperior', 'zeroinferior', 'oneinferior', 'twoinferior', 'threeinferior', 'fourinferior', 'fiveinferior', 'sixinferior', 'seveninferior', 'eightinferior', 'nineinferior', 'centinferior', 'dollarinferior', 'periodinferior', 'commainferior'];
39684exports.ExpertSubsetCharset = ExpertSubsetCharset;
39685
39686/***/ }),
39687/* 177 */
39688/***/ (function(module, exports, __w_pdfjs_require__) {
39689
39690"use strict";
39691
39692
39693Object.defineProperty(exports, "__esModule", {
39694  value: true
39695});
39696exports.getEncoding = getEncoding;
39697exports.ExpertEncoding = exports.ZapfDingbatsEncoding = exports.SymbolSetEncoding = exports.MacRomanEncoding = exports.StandardEncoding = exports.WinAnsiEncoding = void 0;
39698var ExpertEncoding = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'space', 'exclamsmall', 'Hungarumlautsmall', '', 'dollaroldstyle', 'dollarsuperior', 'ampersandsmall', 'Acutesmall', 'parenleftsuperior', 'parenrightsuperior', 'twodotenleader', 'onedotenleader', 'comma', 'hyphen', 'period', 'fraction', 'zerooldstyle', 'oneoldstyle', 'twooldstyle', 'threeoldstyle', 'fouroldstyle', 'fiveoldstyle', 'sixoldstyle', 'sevenoldstyle', 'eightoldstyle', 'nineoldstyle', 'colon', 'semicolon', 'commasuperior', 'threequartersemdash', 'periodsuperior', 'questionsmall', '', 'asuperior', 'bsuperior', 'centsuperior', 'dsuperior', 'esuperior', '', '', '', 'isuperior', '', '', 'lsuperior', 'msuperior', 'nsuperior', 'osuperior', '', '', 'rsuperior', 'ssuperior', 'tsuperior', '', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'parenleftinferior', '', 'parenrightinferior', 'Circumflexsmall', 'hyphensuperior', 'Gravesmall', 'Asmall', 'Bsmall', 'Csmall', 'Dsmall', 'Esmall', 'Fsmall', 'Gsmall', 'Hsmall', 'Ismall', 'Jsmall', 'Ksmall', 'Lsmall', 'Msmall', 'Nsmall', 'Osmall', 'Psmall', 'Qsmall', 'Rsmall', 'Ssmall', 'Tsmall', 'Usmall', 'Vsmall', 'Wsmall', 'Xsmall', 'Ysmall', 'Zsmall', 'colonmonetary', 'onefitted', 'rupiah', 'Tildesmall', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'exclamdownsmall', 'centoldstyle', 'Lslashsmall', '', '', 'Scaronsmall', 'Zcaronsmall', 'Dieresissmall', 'Brevesmall', 'Caronsmall', '', 'Dotaccentsmall', '', '', 'Macronsmall', '', '', 'figuredash', 'hypheninferior', '', '', 'Ogoneksmall', 'Ringsmall', 'Cedillasmall', '', '', '', 'onequarter', 'onehalf', 'threequarters', 'questiondownsmall', 'oneeighth', 'threeeighths', 'fiveeighths', 'seveneighths', 'onethird', 'twothirds', '', '', 'zerosuperior', 'onesuperior', 'twosuperior', 'threesuperior', 'foursuperior', 'fivesuperior', 'sixsuperior', 'sevensuperior', 'eightsuperior', 'ninesuperior', 'zeroinferior', 'oneinferior', 'twoinferior', 'threeinferior', 'fourinferior', 'fiveinferior', 'sixinferior', 'seveninferior', 'eightinferior', 'nineinferior', 'centinferior', 'dollarinferior', 'periodinferior', 'commainferior', 'Agravesmall', 'Aacutesmall', 'Acircumflexsmall', 'Atildesmall', 'Adieresissmall', 'Aringsmall', 'AEsmall', 'Ccedillasmall', 'Egravesmall', 'Eacutesmall', 'Ecircumflexsmall', 'Edieresissmall', 'Igravesmall', 'Iacutesmall', 'Icircumflexsmall', 'Idieresissmall', 'Ethsmall', 'Ntildesmall', 'Ogravesmall', 'Oacutesmall', 'Ocircumflexsmall', 'Otildesmall', 'Odieresissmall', 'OEsmall', 'Oslashsmall', 'Ugravesmall', 'Uacutesmall', 'Ucircumflexsmall', 'Udieresissmall', 'Yacutesmall', 'Thornsmall', 'Ydieresissmall'];
39699exports.ExpertEncoding = ExpertEncoding;
39700var MacExpertEncoding = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'space', 'exclamsmall', 'Hungarumlautsmall', 'centoldstyle', 'dollaroldstyle', 'dollarsuperior', 'ampersandsmall', 'Acutesmall', 'parenleftsuperior', 'parenrightsuperior', 'twodotenleader', 'onedotenleader', 'comma', 'hyphen', 'period', 'fraction', 'zerooldstyle', 'oneoldstyle', 'twooldstyle', 'threeoldstyle', 'fouroldstyle', 'fiveoldstyle', 'sixoldstyle', 'sevenoldstyle', 'eightoldstyle', 'nineoldstyle', 'colon', 'semicolon', '', 'threequartersemdash', '', 'questionsmall', '', '', '', '', 'Ethsmall', '', '', 'onequarter', 'onehalf', 'threequarters', 'oneeighth', 'threeeighths', 'fiveeighths', 'seveneighths', 'onethird', 'twothirds', '', '', '', '', '', '', 'ff', 'fi', 'fl', 'ffi', 'ffl', 'parenleftinferior', '', 'parenrightinferior', 'Circumflexsmall', 'hypheninferior', 'Gravesmall', 'Asmall', 'Bsmall', 'Csmall', 'Dsmall', 'Esmall', 'Fsmall', 'Gsmall', 'Hsmall', 'Ismall', 'Jsmall', 'Ksmall', 'Lsmall', 'Msmall', 'Nsmall', 'Osmall', 'Psmall', 'Qsmall', 'Rsmall', 'Ssmall', 'Tsmall', 'Usmall', 'Vsmall', 'Wsmall', 'Xsmall', 'Ysmall', 'Zsmall', 'colonmonetary', 'onefitted', 'rupiah', 'Tildesmall', '', '', 'asuperior', 'centsuperior', '', '', '', '', 'Aacutesmall', 'Agravesmall', 'Acircumflexsmall', 'Adieresissmall', 'Atildesmall', 'Aringsmall', 'Ccedillasmall', 'Eacutesmall', 'Egravesmall', 'Ecircumflexsmall', 'Edieresissmall', 'Iacutesmall', 'Igravesmall', 'Icircumflexsmall', 'Idieresissmall', 'Ntildesmall', 'Oacutesmall', 'Ogravesmall', 'Ocircumflexsmall', 'Odieresissmall', 'Otildesmall', 'Uacutesmall', 'Ugravesmall', 'Ucircumflexsmall', 'Udieresissmall', '', 'eightsuperior', 'fourinferior', 'threeinferior', 'sixinferior', 'eightinferior', 'seveninferior', 'Scaronsmall', '', 'centinferior', 'twoinferior', '', 'Dieresissmall', '', 'Caronsmall', 'osuperior', 'fiveinferior', '', 'commainferior', 'periodinferior', 'Yacutesmall', '', 'dollarinferior', '', '', 'Thornsmall', '', 'nineinferior', 'zeroinferior', 'Zcaronsmall', 'AEsmall', 'Oslashsmall', 'questiondownsmall', 'oneinferior', 'Lslashsmall', '', '', '', '', '', '', 'Cedillasmall', '', '', '', '', '', 'OEsmall', 'figuredash', 'hyphensuperior', '', '', '', '', 'exclamdownsmall', '', 'Ydieresissmall', '', 'onesuperior', 'twosuperior', 'threesuperior', 'foursuperior', 'fivesuperior', 'sixsuperior', 'sevensuperior', 'ninesuperior', 'zerosuperior', '', 'esuperior', 'rsuperior', 'tsuperior', '', '', 'isuperior', 'ssuperior', 'dsuperior', '', '', '', '', '', 'lsuperior', 'Ogoneksmall', 'Brevesmall', 'Macronsmall', 'bsuperior', 'nsuperior', 'msuperior', 'commasuperior', 'periodsuperior', 'Dotaccentsmall', 'Ringsmall', '', '', '', ''];
39701var MacRomanEncoding = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent', 'ampersand', 'quotesingle', 'parenleft', 'parenright', 'asterisk', 'plus', 'comma', 'hyphen', 'period', 'slash', 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', 'less', 'equal', 'greater', 'question', 'at', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'bracketleft', 'backslash', 'bracketright', 'asciicircum', 'underscore', 'grave', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'braceleft', 'bar', 'braceright', 'asciitilde', '', 'Adieresis', 'Aring', 'Ccedilla', 'Eacute', 'Ntilde', 'Odieresis', 'Udieresis', 'aacute', 'agrave', 'acircumflex', 'adieresis', 'atilde', 'aring', 'ccedilla', 'eacute', 'egrave', 'ecircumflex', 'edieresis', 'iacute', 'igrave', 'icircumflex', 'idieresis', 'ntilde', 'oacute', 'ograve', 'ocircumflex', 'odieresis', 'otilde', 'uacute', 'ugrave', 'ucircumflex', 'udieresis', 'dagger', 'degree', 'cent', 'sterling', 'section', 'bullet', 'paragraph', 'germandbls', 'registered', 'copyright', 'trademark', 'acute', 'dieresis', 'notequal', 'AE', 'Oslash', 'infinity', 'plusminus', 'lessequal', 'greaterequal', 'yen', 'mu', 'partialdiff', 'summation', 'product', 'pi', 'integral', 'ordfeminine', 'ordmasculine', 'Omega', 'ae', 'oslash', 'questiondown', 'exclamdown', 'logicalnot', 'radical', 'florin', 'approxequal', 'Delta', 'guillemotleft', 'guillemotright', 'ellipsis', 'space', 'Agrave', 'Atilde', 'Otilde', 'OE', 'oe', 'endash', 'emdash', 'quotedblleft', 'quotedblright', 'quoteleft', 'quoteright', 'divide', 'lozenge', 'ydieresis', 'Ydieresis', 'fraction', 'currency', 'guilsinglleft', 'guilsinglright', 'fi', 'fl', 'daggerdbl', 'periodcentered', 'quotesinglbase', 'quotedblbase', 'perthousand', 'Acircumflex', 'Ecircumflex', 'Aacute', 'Edieresis', 'Egrave', 'Iacute', 'Icircumflex', 'Idieresis', 'Igrave', 'Oacute', 'Ocircumflex', 'apple', 'Ograve', 'Uacute', 'Ucircumflex', 'Ugrave', 'dotlessi', 'circumflex', 'tilde', 'macron', 'breve', 'dotaccent', 'ring', 'cedilla', 'hungarumlaut', 'ogonek', 'caron'];
39702exports.MacRomanEncoding = MacRomanEncoding;
39703var StandardEncoding = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent', 'ampersand', 'quoteright', 'parenleft', 'parenright', 'asterisk', 'plus', 'comma', 'hyphen', 'period', 'slash', 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', 'less', 'equal', 'greater', 'question', 'at', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'bracketleft', 'backslash', 'bracketright', 'asciicircum', 'underscore', 'quoteleft', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'braceleft', 'bar', 'braceright', 'asciitilde', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'exclamdown', 'cent', 'sterling', 'fraction', 'yen', 'florin', 'section', 'currency', 'quotesingle', 'quotedblleft', 'guillemotleft', 'guilsinglleft', 'guilsinglright', 'fi', 'fl', '', 'endash', 'dagger', 'daggerdbl', 'periodcentered', '', 'paragraph', 'bullet', 'quotesinglbase', 'quotedblbase', 'quotedblright', 'guillemotright', 'ellipsis', 'perthousand', '', 'questiondown', '', 'grave', 'acute', 'circumflex', 'tilde', 'macron', 'breve', 'dotaccent', 'dieresis', '', 'ring', 'cedilla', '', 'hungarumlaut', 'ogonek', 'caron', 'emdash', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'AE', '', 'ordfeminine', '', '', '', '', 'Lslash', 'Oslash', 'OE', 'ordmasculine', '', '', '', '', '', 'ae', '', '', '', 'dotlessi', '', '', 'lslash', 'oslash', 'oe', 'germandbls', '', '', '', ''];
39704exports.StandardEncoding = StandardEncoding;
39705var WinAnsiEncoding = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent', 'ampersand', 'quotesingle', 'parenleft', 'parenright', 'asterisk', 'plus', 'comma', 'hyphen', 'period', 'slash', 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', 'less', 'equal', 'greater', 'question', 'at', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'bracketleft', 'backslash', 'bracketright', 'asciicircum', 'underscore', 'grave', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'braceleft', 'bar', 'braceright', 'asciitilde', 'bullet', 'Euro', 'bullet', 'quotesinglbase', 'florin', 'quotedblbase', 'ellipsis', 'dagger', 'daggerdbl', 'circumflex', 'perthousand', 'Scaron', 'guilsinglleft', 'OE', 'bullet', 'Zcaron', 'bullet', 'bullet', 'quoteleft', 'quoteright', 'quotedblleft', 'quotedblright', 'bullet', 'endash', 'emdash', 'tilde', 'trademark', 'scaron', 'guilsinglright', 'oe', 'bullet', 'zcaron', 'Ydieresis', 'space', 'exclamdown', 'cent', 'sterling', 'currency', 'yen', 'brokenbar', 'section', 'dieresis', 'copyright', 'ordfeminine', 'guillemotleft', 'logicalnot', 'hyphen', 'registered', 'macron', 'degree', 'plusminus', 'twosuperior', 'threesuperior', 'acute', 'mu', 'paragraph', 'periodcentered', 'cedilla', 'onesuperior', 'ordmasculine', 'guillemotright', 'onequarter', 'onehalf', 'threequarters', 'questiondown', 'Agrave', 'Aacute', 'Acircumflex', 'Atilde', 'Adieresis', 'Aring', 'AE', 'Ccedilla', 'Egrave', 'Eacute', 'Ecircumflex', 'Edieresis', 'Igrave', 'Iacute', 'Icircumflex', 'Idieresis', 'Eth', 'Ntilde', 'Ograve', 'Oacute', 'Ocircumflex', 'Otilde', 'Odieresis', 'multiply', 'Oslash', 'Ugrave', 'Uacute', 'Ucircumflex', 'Udieresis', 'Yacute', 'Thorn', 'germandbls', 'agrave', 'aacute', 'acircumflex', 'atilde', 'adieresis', 'aring', 'ae', 'ccedilla', 'egrave', 'eacute', 'ecircumflex', 'edieresis', 'igrave', 'iacute', 'icircumflex', 'idieresis', 'eth', 'ntilde', 'ograve', 'oacute', 'ocircumflex', 'otilde', 'odieresis', 'divide', 'oslash', 'ugrave', 'uacute', 'ucircumflex', 'udieresis', 'yacute', 'thorn', 'ydieresis'];
39706exports.WinAnsiEncoding = WinAnsiEncoding;
39707var SymbolSetEncoding = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'space', 'exclam', 'universal', 'numbersign', 'existential', 'percent', 'ampersand', 'suchthat', 'parenleft', 'parenright', 'asteriskmath', 'plus', 'comma', 'minus', 'period', 'slash', 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', 'less', 'equal', 'greater', 'question', 'congruent', 'Alpha', 'Beta', 'Chi', 'Delta', 'Epsilon', 'Phi', 'Gamma', 'Eta', 'Iota', 'theta1', 'Kappa', 'Lambda', 'Mu', 'Nu', 'Omicron', 'Pi', 'Theta', 'Rho', 'Sigma', 'Tau', 'Upsilon', 'sigma1', 'Omega', 'Xi', 'Psi', 'Zeta', 'bracketleft', 'therefore', 'bracketright', 'perpendicular', 'underscore', 'radicalex', 'alpha', 'beta', 'chi', 'delta', 'epsilon', 'phi', 'gamma', 'eta', 'iota', 'phi1', 'kappa', 'lambda', 'mu', 'nu', 'omicron', 'pi', 'theta', 'rho', 'sigma', 'tau', 'upsilon', 'omega1', 'omega', 'xi', 'psi', 'zeta', 'braceleft', 'bar', 'braceright', 'similar', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'Euro', 'Upsilon1', 'minute', 'lessequal', 'fraction', 'infinity', 'florin', 'club', 'diamond', 'heart', 'spade', 'arrowboth', 'arrowleft', 'arrowup', 'arrowright', 'arrowdown', 'degree', 'plusminus', 'second', 'greaterequal', 'multiply', 'proportional', 'partialdiff', 'bullet', 'divide', 'notequal', 'equivalence', 'approxequal', 'ellipsis', 'arrowvertex', 'arrowhorizex', 'carriagereturn', 'aleph', 'Ifraktur', 'Rfraktur', 'weierstrass', 'circlemultiply', 'circleplus', 'emptyset', 'intersection', 'union', 'propersuperset', 'reflexsuperset', 'notsubset', 'propersubset', 'reflexsubset', 'element', 'notelement', 'angle', 'gradient', 'registerserif', 'copyrightserif', 'trademarkserif', 'product', 'radical', 'dotmath', 'logicalnot', 'logicaland', 'logicalor', 'arrowdblboth', 'arrowdblleft', 'arrowdblup', 'arrowdblright', 'arrowdbldown', 'lozenge', 'angleleft', 'registersans', 'copyrightsans', 'trademarksans', 'summation', 'parenlefttp', 'parenleftex', 'parenleftbt', 'bracketlefttp', 'bracketleftex', 'bracketleftbt', 'bracelefttp', 'braceleftmid', 'braceleftbt', 'braceex', '', 'angleright', 'integral', 'integraltp', 'integralex', 'integralbt', 'parenrighttp', 'parenrightex', 'parenrightbt', 'bracketrighttp', 'bracketrightex', 'bracketrightbt', 'bracerighttp', 'bracerightmid', 'bracerightbt', ''];
39708exports.SymbolSetEncoding = SymbolSetEncoding;
39709var ZapfDingbatsEncoding = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'space', 'a1', 'a2', 'a202', 'a3', 'a4', 'a5', 'a119', 'a118', 'a117', 'a11', 'a12', 'a13', 'a14', 'a15', 'a16', 'a105', 'a17', 'a18', 'a19', 'a20', 'a21', 'a22', 'a23', 'a24', 'a25', 'a26', 'a27', 'a28', 'a6', 'a7', 'a8', 'a9', 'a10', 'a29', 'a30', 'a31', 'a32', 'a33', 'a34', 'a35', 'a36', 'a37', 'a38', 'a39', 'a40', 'a41', 'a42', 'a43', 'a44', 'a45', 'a46', 'a47', 'a48', 'a49', 'a50', 'a51', 'a52', 'a53', 'a54', 'a55', 'a56', 'a57', 'a58', 'a59', 'a60', 'a61', 'a62', 'a63', 'a64', 'a65', 'a66', 'a67', 'a68', 'a69', 'a70', 'a71', 'a72', 'a73', 'a74', 'a203', 'a75', 'a204', 'a76', 'a77', 'a78', 'a79', 'a81', 'a82', 'a83', 'a84', 'a97', 'a98', 'a99', 'a100', '', 'a89', 'a90', 'a93', 'a94', 'a91', 'a92', 'a205', 'a85', 'a206', 'a86', 'a87', 'a88', 'a95', 'a96', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'a101', 'a102', 'a103', 'a104', 'a106', 'a107', 'a108', 'a112', 'a111', 'a110', 'a109', 'a120', 'a121', 'a122', 'a123', 'a124', 'a125', 'a126', 'a127', 'a128', 'a129', 'a130', 'a131', 'a132', 'a133', 'a134', 'a135', 'a136', 'a137', 'a138', 'a139', 'a140', 'a141', 'a142', 'a143', 'a144', 'a145', 'a146', 'a147', 'a148', 'a149', 'a150', 'a151', 'a152', 'a153', 'a154', 'a155', 'a156', 'a157', 'a158', 'a159', 'a160', 'a161', 'a163', 'a164', 'a196', 'a165', 'a192', 'a166', 'a167', 'a168', 'a169', 'a170', 'a171', 'a172', 'a173', 'a162', 'a174', 'a175', 'a176', 'a177', 'a178', 'a179', 'a193', 'a180', 'a199', 'a181', 'a200', 'a182', '', 'a201', 'a183', 'a184', 'a197', 'a185', 'a194', 'a198', 'a186', 'a195', 'a187', 'a188', 'a189', 'a190', 'a191', ''];
39710exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
39711
39712function getEncoding(encodingName) {
39713  switch (encodingName) {
39714    case 'WinAnsiEncoding':
39715      return WinAnsiEncoding;
39716
39717    case 'StandardEncoding':
39718      return StandardEncoding;
39719
39720    case 'MacRomanEncoding':
39721      return MacRomanEncoding;
39722
39723    case 'SymbolSetEncoding':
39724      return SymbolSetEncoding;
39725
39726    case 'ZapfDingbatsEncoding':
39727      return ZapfDingbatsEncoding;
39728
39729    case 'ExpertEncoding':
39730      return ExpertEncoding;
39731
39732    case 'MacExpertEncoding':
39733      return MacExpertEncoding;
39734
39735    default:
39736      return null;
39737  }
39738}
39739
39740/***/ }),
39741/* 178 */
39742/***/ (function(module, exports, __w_pdfjs_require__) {
39743
39744var getLookupTableFactory = __w_pdfjs_require__(154).getLookupTableFactory;
39745var getGlyphsUnicode = getLookupTableFactory(function (t) {
39746 t['A'] = 0x0041;
39747 t['AE'] = 0x00C6;
39748 t['AEacute'] = 0x01FC;
39749 t['AEmacron'] = 0x01E2;
39750 t['AEsmall'] = 0xF7E6;
39751 t['Aacute'] = 0x00C1;
39752 t['Aacutesmall'] = 0xF7E1;
39753 t['Abreve'] = 0x0102;
39754 t['Abreveacute'] = 0x1EAE;
39755 t['Abrevecyrillic'] = 0x04D0;
39756 t['Abrevedotbelow'] = 0x1EB6;
39757 t['Abrevegrave'] = 0x1EB0;
39758 t['Abrevehookabove'] = 0x1EB2;
39759 t['Abrevetilde'] = 0x1EB4;
39760 t['Acaron'] = 0x01CD;
39761 t['Acircle'] = 0x24B6;
39762 t['Acircumflex'] = 0x00C2;
39763 t['Acircumflexacute'] = 0x1EA4;
39764 t['Acircumflexdotbelow'] = 0x1EAC;
39765 t['Acircumflexgrave'] = 0x1EA6;
39766 t['Acircumflexhookabove'] = 0x1EA8;
39767 t['Acircumflexsmall'] = 0xF7E2;
39768 t['Acircumflextilde'] = 0x1EAA;
39769 t['Acute'] = 0xF6C9;
39770 t['Acutesmall'] = 0xF7B4;
39771 t['Acyrillic'] = 0x0410;
39772 t['Adblgrave'] = 0x0200;
39773 t['Adieresis'] = 0x00C4;
39774 t['Adieresiscyrillic'] = 0x04D2;
39775 t['Adieresismacron'] = 0x01DE;
39776 t['Adieresissmall'] = 0xF7E4;
39777 t['Adotbelow'] = 0x1EA0;
39778 t['Adotmacron'] = 0x01E0;
39779 t['Agrave'] = 0x00C0;
39780 t['Agravesmall'] = 0xF7E0;
39781 t['Ahookabove'] = 0x1EA2;
39782 t['Aiecyrillic'] = 0x04D4;
39783 t['Ainvertedbreve'] = 0x0202;
39784 t['Alpha'] = 0x0391;
39785 t['Alphatonos'] = 0x0386;
39786 t['Amacron'] = 0x0100;
39787 t['Amonospace'] = 0xFF21;
39788 t['Aogonek'] = 0x0104;
39789 t['Aring'] = 0x00C5;
39790 t['Aringacute'] = 0x01FA;
39791 t['Aringbelow'] = 0x1E00;
39792 t['Aringsmall'] = 0xF7E5;
39793 t['Asmall'] = 0xF761;
39794 t['Atilde'] = 0x00C3;
39795 t['Atildesmall'] = 0xF7E3;
39796 t['Aybarmenian'] = 0x0531;
39797 t['B'] = 0x0042;
39798 t['Bcircle'] = 0x24B7;
39799 t['Bdotaccent'] = 0x1E02;
39800 t['Bdotbelow'] = 0x1E04;
39801 t['Becyrillic'] = 0x0411;
39802 t['Benarmenian'] = 0x0532;
39803 t['Beta'] = 0x0392;
39804 t['Bhook'] = 0x0181;
39805 t['Blinebelow'] = 0x1E06;
39806 t['Bmonospace'] = 0xFF22;
39807 t['Brevesmall'] = 0xF6F4;
39808 t['Bsmall'] = 0xF762;
39809 t['Btopbar'] = 0x0182;
39810 t['C'] = 0x0043;
39811 t['Caarmenian'] = 0x053E;
39812 t['Cacute'] = 0x0106;
39813 t['Caron'] = 0xF6CA;
39814 t['Caronsmall'] = 0xF6F5;
39815 t['Ccaron'] = 0x010C;
39816 t['Ccedilla'] = 0x00C7;
39817 t['Ccedillaacute'] = 0x1E08;
39818 t['Ccedillasmall'] = 0xF7E7;
39819 t['Ccircle'] = 0x24B8;
39820 t['Ccircumflex'] = 0x0108;
39821 t['Cdot'] = 0x010A;
39822 t['Cdotaccent'] = 0x010A;
39823 t['Cedillasmall'] = 0xF7B8;
39824 t['Chaarmenian'] = 0x0549;
39825 t['Cheabkhasiancyrillic'] = 0x04BC;
39826 t['Checyrillic'] = 0x0427;
39827 t['Chedescenderabkhasiancyrillic'] = 0x04BE;
39828 t['Chedescendercyrillic'] = 0x04B6;
39829 t['Chedieresiscyrillic'] = 0x04F4;
39830 t['Cheharmenian'] = 0x0543;
39831 t['Chekhakassiancyrillic'] = 0x04CB;
39832 t['Cheverticalstrokecyrillic'] = 0x04B8;
39833 t['Chi'] = 0x03A7;
39834 t['Chook'] = 0x0187;
39835 t['Circumflexsmall'] = 0xF6F6;
39836 t['Cmonospace'] = 0xFF23;
39837 t['Coarmenian'] = 0x0551;
39838 t['Csmall'] = 0xF763;
39839 t['D'] = 0x0044;
39840 t['DZ'] = 0x01F1;
39841 t['DZcaron'] = 0x01C4;
39842 t['Daarmenian'] = 0x0534;
39843 t['Dafrican'] = 0x0189;
39844 t['Dcaron'] = 0x010E;
39845 t['Dcedilla'] = 0x1E10;
39846 t['Dcircle'] = 0x24B9;
39847 t['Dcircumflexbelow'] = 0x1E12;
39848 t['Dcroat'] = 0x0110;
39849 t['Ddotaccent'] = 0x1E0A;
39850 t['Ddotbelow'] = 0x1E0C;
39851 t['Decyrillic'] = 0x0414;
39852 t['Deicoptic'] = 0x03EE;
39853 t['Delta'] = 0x2206;
39854 t['Deltagreek'] = 0x0394;
39855 t['Dhook'] = 0x018A;
39856 t['Dieresis'] = 0xF6CB;
39857 t['DieresisAcute'] = 0xF6CC;
39858 t['DieresisGrave'] = 0xF6CD;
39859 t['Dieresissmall'] = 0xF7A8;
39860 t['Digammagreek'] = 0x03DC;
39861 t['Djecyrillic'] = 0x0402;
39862 t['Dlinebelow'] = 0x1E0E;
39863 t['Dmonospace'] = 0xFF24;
39864 t['Dotaccentsmall'] = 0xF6F7;
39865 t['Dslash'] = 0x0110;
39866 t['Dsmall'] = 0xF764;
39867 t['Dtopbar'] = 0x018B;
39868 t['Dz'] = 0x01F2;
39869 t['Dzcaron'] = 0x01C5;
39870 t['Dzeabkhasiancyrillic'] = 0x04E0;
39871 t['Dzecyrillic'] = 0x0405;
39872 t['Dzhecyrillic'] = 0x040F;
39873 t['E'] = 0x0045;
39874 t['Eacute'] = 0x00C9;
39875 t['Eacutesmall'] = 0xF7E9;
39876 t['Ebreve'] = 0x0114;
39877 t['Ecaron'] = 0x011A;
39878 t['Ecedillabreve'] = 0x1E1C;
39879 t['Echarmenian'] = 0x0535;
39880 t['Ecircle'] = 0x24BA;
39881 t['Ecircumflex'] = 0x00CA;
39882 t['Ecircumflexacute'] = 0x1EBE;
39883 t['Ecircumflexbelow'] = 0x1E18;
39884 t['Ecircumflexdotbelow'] = 0x1EC6;
39885 t['Ecircumflexgrave'] = 0x1EC0;
39886 t['Ecircumflexhookabove'] = 0x1EC2;
39887 t['Ecircumflexsmall'] = 0xF7EA;
39888 t['Ecircumflextilde'] = 0x1EC4;
39889 t['Ecyrillic'] = 0x0404;
39890 t['Edblgrave'] = 0x0204;
39891 t['Edieresis'] = 0x00CB;
39892 t['Edieresissmall'] = 0xF7EB;
39893 t['Edot'] = 0x0116;
39894 t['Edotaccent'] = 0x0116;
39895 t['Edotbelow'] = 0x1EB8;
39896 t['Efcyrillic'] = 0x0424;
39897 t['Egrave'] = 0x00C8;
39898 t['Egravesmall'] = 0xF7E8;
39899 t['Eharmenian'] = 0x0537;
39900 t['Ehookabove'] = 0x1EBA;
39901 t['Eightroman'] = 0x2167;
39902 t['Einvertedbreve'] = 0x0206;
39903 t['Eiotifiedcyrillic'] = 0x0464;
39904 t['Elcyrillic'] = 0x041B;
39905 t['Elevenroman'] = 0x216A;
39906 t['Emacron'] = 0x0112;
39907 t['Emacronacute'] = 0x1E16;
39908 t['Emacrongrave'] = 0x1E14;
39909 t['Emcyrillic'] = 0x041C;
39910 t['Emonospace'] = 0xFF25;
39911 t['Encyrillic'] = 0x041D;
39912 t['Endescendercyrillic'] = 0x04A2;
39913 t['Eng'] = 0x014A;
39914 t['Enghecyrillic'] = 0x04A4;
39915 t['Enhookcyrillic'] = 0x04C7;
39916 t['Eogonek'] = 0x0118;
39917 t['Eopen'] = 0x0190;
39918 t['Epsilon'] = 0x0395;
39919 t['Epsilontonos'] = 0x0388;
39920 t['Ercyrillic'] = 0x0420;
39921 t['Ereversed'] = 0x018E;
39922 t['Ereversedcyrillic'] = 0x042D;
39923 t['Escyrillic'] = 0x0421;
39924 t['Esdescendercyrillic'] = 0x04AA;
39925 t['Esh'] = 0x01A9;
39926 t['Esmall'] = 0xF765;
39927 t['Eta'] = 0x0397;
39928 t['Etarmenian'] = 0x0538;
39929 t['Etatonos'] = 0x0389;
39930 t['Eth'] = 0x00D0;
39931 t['Ethsmall'] = 0xF7F0;
39932 t['Etilde'] = 0x1EBC;
39933 t['Etildebelow'] = 0x1E1A;
39934 t['Euro'] = 0x20AC;
39935 t['Ezh'] = 0x01B7;
39936 t['Ezhcaron'] = 0x01EE;
39937 t['Ezhreversed'] = 0x01B8;
39938 t['F'] = 0x0046;
39939 t['Fcircle'] = 0x24BB;
39940 t['Fdotaccent'] = 0x1E1E;
39941 t['Feharmenian'] = 0x0556;
39942 t['Feicoptic'] = 0x03E4;
39943 t['Fhook'] = 0x0191;
39944 t['Fitacyrillic'] = 0x0472;
39945 t['Fiveroman'] = 0x2164;
39946 t['Fmonospace'] = 0xFF26;
39947 t['Fourroman'] = 0x2163;
39948 t['Fsmall'] = 0xF766;
39949 t['G'] = 0x0047;
39950 t['GBsquare'] = 0x3387;
39951 t['Gacute'] = 0x01F4;
39952 t['Gamma'] = 0x0393;
39953 t['Gammaafrican'] = 0x0194;
39954 t['Gangiacoptic'] = 0x03EA;
39955 t['Gbreve'] = 0x011E;
39956 t['Gcaron'] = 0x01E6;
39957 t['Gcedilla'] = 0x0122;
39958 t['Gcircle'] = 0x24BC;
39959 t['Gcircumflex'] = 0x011C;
39960 t['Gcommaaccent'] = 0x0122;
39961 t['Gdot'] = 0x0120;
39962 t['Gdotaccent'] = 0x0120;
39963 t['Gecyrillic'] = 0x0413;
39964 t['Ghadarmenian'] = 0x0542;
39965 t['Ghemiddlehookcyrillic'] = 0x0494;
39966 t['Ghestrokecyrillic'] = 0x0492;
39967 t['Gheupturncyrillic'] = 0x0490;
39968 t['Ghook'] = 0x0193;
39969 t['Gimarmenian'] = 0x0533;
39970 t['Gjecyrillic'] = 0x0403;
39971 t['Gmacron'] = 0x1E20;
39972 t['Gmonospace'] = 0xFF27;
39973 t['Grave'] = 0xF6CE;
39974 t['Gravesmall'] = 0xF760;
39975 t['Gsmall'] = 0xF767;
39976 t['Gsmallhook'] = 0x029B;
39977 t['Gstroke'] = 0x01E4;
39978 t['H'] = 0x0048;
39979 t['H18533'] = 0x25CF;
39980 t['H18543'] = 0x25AA;
39981 t['H18551'] = 0x25AB;
39982 t['H22073'] = 0x25A1;
39983 t['HPsquare'] = 0x33CB;
39984 t['Haabkhasiancyrillic'] = 0x04A8;
39985 t['Hadescendercyrillic'] = 0x04B2;
39986 t['Hardsigncyrillic'] = 0x042A;
39987 t['Hbar'] = 0x0126;
39988 t['Hbrevebelow'] = 0x1E2A;
39989 t['Hcedilla'] = 0x1E28;
39990 t['Hcircle'] = 0x24BD;
39991 t['Hcircumflex'] = 0x0124;
39992 t['Hdieresis'] = 0x1E26;
39993 t['Hdotaccent'] = 0x1E22;
39994 t['Hdotbelow'] = 0x1E24;
39995 t['Hmonospace'] = 0xFF28;
39996 t['Hoarmenian'] = 0x0540;
39997 t['Horicoptic'] = 0x03E8;
39998 t['Hsmall'] = 0xF768;
39999 t['Hungarumlaut'] = 0xF6CF;
40000 t['Hungarumlautsmall'] = 0xF6F8;
40001 t['Hzsquare'] = 0x3390;
40002 t['I'] = 0x0049;
40003 t['IAcyrillic'] = 0x042F;
40004 t['IJ'] = 0x0132;
40005 t['IUcyrillic'] = 0x042E;
40006 t['Iacute'] = 0x00CD;
40007 t['Iacutesmall'] = 0xF7ED;
40008 t['Ibreve'] = 0x012C;
40009 t['Icaron'] = 0x01CF;
40010 t['Icircle'] = 0x24BE;
40011 t['Icircumflex'] = 0x00CE;
40012 t['Icircumflexsmall'] = 0xF7EE;
40013 t['Icyrillic'] = 0x0406;
40014 t['Idblgrave'] = 0x0208;
40015 t['Idieresis'] = 0x00CF;
40016 t['Idieresisacute'] = 0x1E2E;
40017 t['Idieresiscyrillic'] = 0x04E4;
40018 t['Idieresissmall'] = 0xF7EF;
40019 t['Idot'] = 0x0130;
40020 t['Idotaccent'] = 0x0130;
40021 t['Idotbelow'] = 0x1ECA;
40022 t['Iebrevecyrillic'] = 0x04D6;
40023 t['Iecyrillic'] = 0x0415;
40024 t['Ifraktur'] = 0x2111;
40025 t['Igrave'] = 0x00CC;
40026 t['Igravesmall'] = 0xF7EC;
40027 t['Ihookabove'] = 0x1EC8;
40028 t['Iicyrillic'] = 0x0418;
40029 t['Iinvertedbreve'] = 0x020A;
40030 t['Iishortcyrillic'] = 0x0419;
40031 t['Imacron'] = 0x012A;
40032 t['Imacroncyrillic'] = 0x04E2;
40033 t['Imonospace'] = 0xFF29;
40034 t['Iniarmenian'] = 0x053B;
40035 t['Iocyrillic'] = 0x0401;
40036 t['Iogonek'] = 0x012E;
40037 t['Iota'] = 0x0399;
40038 t['Iotaafrican'] = 0x0196;
40039 t['Iotadieresis'] = 0x03AA;
40040 t['Iotatonos'] = 0x038A;
40041 t['Ismall'] = 0xF769;
40042 t['Istroke'] = 0x0197;
40043 t['Itilde'] = 0x0128;
40044 t['Itildebelow'] = 0x1E2C;
40045 t['Izhitsacyrillic'] = 0x0474;
40046 t['Izhitsadblgravecyrillic'] = 0x0476;
40047 t['J'] = 0x004A;
40048 t['Jaarmenian'] = 0x0541;
40049 t['Jcircle'] = 0x24BF;
40050 t['Jcircumflex'] = 0x0134;
40051 t['Jecyrillic'] = 0x0408;
40052 t['Jheharmenian'] = 0x054B;
40053 t['Jmonospace'] = 0xFF2A;
40054 t['Jsmall'] = 0xF76A;
40055 t['K'] = 0x004B;
40056 t['KBsquare'] = 0x3385;
40057 t['KKsquare'] = 0x33CD;
40058 t['Kabashkircyrillic'] = 0x04A0;
40059 t['Kacute'] = 0x1E30;
40060 t['Kacyrillic'] = 0x041A;
40061 t['Kadescendercyrillic'] = 0x049A;
40062 t['Kahookcyrillic'] = 0x04C3;
40063 t['Kappa'] = 0x039A;
40064 t['Kastrokecyrillic'] = 0x049E;
40065 t['Kaverticalstrokecyrillic'] = 0x049C;
40066 t['Kcaron'] = 0x01E8;
40067 t['Kcedilla'] = 0x0136;
40068 t['Kcircle'] = 0x24C0;
40069 t['Kcommaaccent'] = 0x0136;
40070 t['Kdotbelow'] = 0x1E32;
40071 t['Keharmenian'] = 0x0554;
40072 t['Kenarmenian'] = 0x053F;
40073 t['Khacyrillic'] = 0x0425;
40074 t['Kheicoptic'] = 0x03E6;
40075 t['Khook'] = 0x0198;
40076 t['Kjecyrillic'] = 0x040C;
40077 t['Klinebelow'] = 0x1E34;
40078 t['Kmonospace'] = 0xFF2B;
40079 t['Koppacyrillic'] = 0x0480;
40080 t['Koppagreek'] = 0x03DE;
40081 t['Ksicyrillic'] = 0x046E;
40082 t['Ksmall'] = 0xF76B;
40083 t['L'] = 0x004C;
40084 t['LJ'] = 0x01C7;
40085 t['LL'] = 0xF6BF;
40086 t['Lacute'] = 0x0139;
40087 t['Lambda'] = 0x039B;
40088 t['Lcaron'] = 0x013D;
40089 t['Lcedilla'] = 0x013B;
40090 t['Lcircle'] = 0x24C1;
40091 t['Lcircumflexbelow'] = 0x1E3C;
40092 t['Lcommaaccent'] = 0x013B;
40093 t['Ldot'] = 0x013F;
40094 t['Ldotaccent'] = 0x013F;
40095 t['Ldotbelow'] = 0x1E36;
40096 t['Ldotbelowmacron'] = 0x1E38;
40097 t['Liwnarmenian'] = 0x053C;
40098 t['Lj'] = 0x01C8;
40099 t['Ljecyrillic'] = 0x0409;
40100 t['Llinebelow'] = 0x1E3A;
40101 t['Lmonospace'] = 0xFF2C;
40102 t['Lslash'] = 0x0141;
40103 t['Lslashsmall'] = 0xF6F9;
40104 t['Lsmall'] = 0xF76C;
40105 t['M'] = 0x004D;
40106 t['MBsquare'] = 0x3386;
40107 t['Macron'] = 0xF6D0;
40108 t['Macronsmall'] = 0xF7AF;
40109 t['Macute'] = 0x1E3E;
40110 t['Mcircle'] = 0x24C2;
40111 t['Mdotaccent'] = 0x1E40;
40112 t['Mdotbelow'] = 0x1E42;
40113 t['Menarmenian'] = 0x0544;
40114 t['Mmonospace'] = 0xFF2D;
40115 t['Msmall'] = 0xF76D;
40116 t['Mturned'] = 0x019C;
40117 t['Mu'] = 0x039C;
40118 t['N'] = 0x004E;
40119 t['NJ'] = 0x01CA;
40120 t['Nacute'] = 0x0143;
40121 t['Ncaron'] = 0x0147;
40122 t['Ncedilla'] = 0x0145;
40123 t['Ncircle'] = 0x24C3;
40124 t['Ncircumflexbelow'] = 0x1E4A;
40125 t['Ncommaaccent'] = 0x0145;
40126 t['Ndotaccent'] = 0x1E44;
40127 t['Ndotbelow'] = 0x1E46;
40128 t['Nhookleft'] = 0x019D;
40129 t['Nineroman'] = 0x2168;
40130 t['Nj'] = 0x01CB;
40131 t['Njecyrillic'] = 0x040A;
40132 t['Nlinebelow'] = 0x1E48;
40133 t['Nmonospace'] = 0xFF2E;
40134 t['Nowarmenian'] = 0x0546;
40135 t['Nsmall'] = 0xF76E;
40136 t['Ntilde'] = 0x00D1;
40137 t['Ntildesmall'] = 0xF7F1;
40138 t['Nu'] = 0x039D;
40139 t['O'] = 0x004F;
40140 t['OE'] = 0x0152;
40141 t['OEsmall'] = 0xF6FA;
40142 t['Oacute'] = 0x00D3;
40143 t['Oacutesmall'] = 0xF7F3;
40144 t['Obarredcyrillic'] = 0x04E8;
40145 t['Obarreddieresiscyrillic'] = 0x04EA;
40146 t['Obreve'] = 0x014E;
40147 t['Ocaron'] = 0x01D1;
40148 t['Ocenteredtilde'] = 0x019F;
40149 t['Ocircle'] = 0x24C4;
40150 t['Ocircumflex'] = 0x00D4;
40151 t['Ocircumflexacute'] = 0x1ED0;
40152 t['Ocircumflexdotbelow'] = 0x1ED8;
40153 t['Ocircumflexgrave'] = 0x1ED2;
40154 t['Ocircumflexhookabove'] = 0x1ED4;
40155 t['Ocircumflexsmall'] = 0xF7F4;
40156 t['Ocircumflextilde'] = 0x1ED6;
40157 t['Ocyrillic'] = 0x041E;
40158 t['Odblacute'] = 0x0150;
40159 t['Odblgrave'] = 0x020C;
40160 t['Odieresis'] = 0x00D6;
40161 t['Odieresiscyrillic'] = 0x04E6;
40162 t['Odieresissmall'] = 0xF7F6;
40163 t['Odotbelow'] = 0x1ECC;
40164 t['Ogoneksmall'] = 0xF6FB;
40165 t['Ograve'] = 0x00D2;
40166 t['Ogravesmall'] = 0xF7F2;
40167 t['Oharmenian'] = 0x0555;
40168 t['Ohm'] = 0x2126;
40169 t['Ohookabove'] = 0x1ECE;
40170 t['Ohorn'] = 0x01A0;
40171 t['Ohornacute'] = 0x1EDA;
40172 t['Ohorndotbelow'] = 0x1EE2;
40173 t['Ohorngrave'] = 0x1EDC;
40174 t['Ohornhookabove'] = 0x1EDE;
40175 t['Ohorntilde'] = 0x1EE0;
40176 t['Ohungarumlaut'] = 0x0150;
40177 t['Oi'] = 0x01A2;
40178 t['Oinvertedbreve'] = 0x020E;
40179 t['Omacron'] = 0x014C;
40180 t['Omacronacute'] = 0x1E52;
40181 t['Omacrongrave'] = 0x1E50;
40182 t['Omega'] = 0x2126;
40183 t['Omegacyrillic'] = 0x0460;
40184 t['Omegagreek'] = 0x03A9;
40185 t['Omegaroundcyrillic'] = 0x047A;
40186 t['Omegatitlocyrillic'] = 0x047C;
40187 t['Omegatonos'] = 0x038F;
40188 t['Omicron'] = 0x039F;
40189 t['Omicrontonos'] = 0x038C;
40190 t['Omonospace'] = 0xFF2F;
40191 t['Oneroman'] = 0x2160;
40192 t['Oogonek'] = 0x01EA;
40193 t['Oogonekmacron'] = 0x01EC;
40194 t['Oopen'] = 0x0186;
40195 t['Oslash'] = 0x00D8;
40196 t['Oslashacute'] = 0x01FE;
40197 t['Oslashsmall'] = 0xF7F8;
40198 t['Osmall'] = 0xF76F;
40199 t['Ostrokeacute'] = 0x01FE;
40200 t['Otcyrillic'] = 0x047E;
40201 t['Otilde'] = 0x00D5;
40202 t['Otildeacute'] = 0x1E4C;
40203 t['Otildedieresis'] = 0x1E4E;
40204 t['Otildesmall'] = 0xF7F5;
40205 t['P'] = 0x0050;
40206 t['Pacute'] = 0x1E54;
40207 t['Pcircle'] = 0x24C5;
40208 t['Pdotaccent'] = 0x1E56;
40209 t['Pecyrillic'] = 0x041F;
40210 t['Peharmenian'] = 0x054A;
40211 t['Pemiddlehookcyrillic'] = 0x04A6;
40212 t['Phi'] = 0x03A6;
40213 t['Phook'] = 0x01A4;
40214 t['Pi'] = 0x03A0;
40215 t['Piwrarmenian'] = 0x0553;
40216 t['Pmonospace'] = 0xFF30;
40217 t['Psi'] = 0x03A8;
40218 t['Psicyrillic'] = 0x0470;
40219 t['Psmall'] = 0xF770;
40220 t['Q'] = 0x0051;
40221 t['Qcircle'] = 0x24C6;
40222 t['Qmonospace'] = 0xFF31;
40223 t['Qsmall'] = 0xF771;
40224 t['R'] = 0x0052;
40225 t['Raarmenian'] = 0x054C;
40226 t['Racute'] = 0x0154;
40227 t['Rcaron'] = 0x0158;
40228 t['Rcedilla'] = 0x0156;
40229 t['Rcircle'] = 0x24C7;
40230 t['Rcommaaccent'] = 0x0156;
40231 t['Rdblgrave'] = 0x0210;
40232 t['Rdotaccent'] = 0x1E58;
40233 t['Rdotbelow'] = 0x1E5A;
40234 t['Rdotbelowmacron'] = 0x1E5C;
40235 t['Reharmenian'] = 0x0550;
40236 t['Rfraktur'] = 0x211C;
40237 t['Rho'] = 0x03A1;
40238 t['Ringsmall'] = 0xF6FC;
40239 t['Rinvertedbreve'] = 0x0212;
40240 t['Rlinebelow'] = 0x1E5E;
40241 t['Rmonospace'] = 0xFF32;
40242 t['Rsmall'] = 0xF772;
40243 t['Rsmallinverted'] = 0x0281;
40244 t['Rsmallinvertedsuperior'] = 0x02B6;
40245 t['S'] = 0x0053;
40246 t['SF010000'] = 0x250C;
40247 t['SF020000'] = 0x2514;
40248 t['SF030000'] = 0x2510;
40249 t['SF040000'] = 0x2518;
40250 t['SF050000'] = 0x253C;
40251 t['SF060000'] = 0x252C;
40252 t['SF070000'] = 0x2534;
40253 t['SF080000'] = 0x251C;
40254 t['SF090000'] = 0x2524;
40255 t['SF100000'] = 0x2500;
40256 t['SF110000'] = 0x2502;
40257 t['SF190000'] = 0x2561;
40258 t['SF200000'] = 0x2562;
40259 t['SF210000'] = 0x2556;
40260 t['SF220000'] = 0x2555;
40261 t['SF230000'] = 0x2563;
40262 t['SF240000'] = 0x2551;
40263 t['SF250000'] = 0x2557;
40264 t['SF260000'] = 0x255D;
40265 t['SF270000'] = 0x255C;
40266 t['SF280000'] = 0x255B;
40267 t['SF360000'] = 0x255E;
40268 t['SF370000'] = 0x255F;
40269 t['SF380000'] = 0x255A;
40270 t['SF390000'] = 0x2554;
40271 t['SF400000'] = 0x2569;
40272 t['SF410000'] = 0x2566;
40273 t['SF420000'] = 0x2560;
40274 t['SF430000'] = 0x2550;
40275 t['SF440000'] = 0x256C;
40276 t['SF450000'] = 0x2567;
40277 t['SF460000'] = 0x2568;
40278 t['SF470000'] = 0x2564;
40279 t['SF480000'] = 0x2565;
40280 t['SF490000'] = 0x2559;
40281 t['SF500000'] = 0x2558;
40282 t['SF510000'] = 0x2552;
40283 t['SF520000'] = 0x2553;
40284 t['SF530000'] = 0x256B;
40285 t['SF540000'] = 0x256A;
40286 t['Sacute'] = 0x015A;
40287 t['Sacutedotaccent'] = 0x1E64;
40288 t['Sampigreek'] = 0x03E0;
40289 t['Scaron'] = 0x0160;
40290 t['Scarondotaccent'] = 0x1E66;
40291 t['Scaronsmall'] = 0xF6FD;
40292 t['Scedilla'] = 0x015E;
40293 t['Schwa'] = 0x018F;
40294 t['Schwacyrillic'] = 0x04D8;
40295 t['Schwadieresiscyrillic'] = 0x04DA;
40296 t['Scircle'] = 0x24C8;
40297 t['Scircumflex'] = 0x015C;
40298 t['Scommaaccent'] = 0x0218;
40299 t['Sdotaccent'] = 0x1E60;
40300 t['Sdotbelow'] = 0x1E62;
40301 t['Sdotbelowdotaccent'] = 0x1E68;
40302 t['Seharmenian'] = 0x054D;
40303 t['Sevenroman'] = 0x2166;
40304 t['Shaarmenian'] = 0x0547;
40305 t['Shacyrillic'] = 0x0428;
40306 t['Shchacyrillic'] = 0x0429;
40307 t['Sheicoptic'] = 0x03E2;
40308 t['Shhacyrillic'] = 0x04BA;
40309 t['Shimacoptic'] = 0x03EC;
40310 t['Sigma'] = 0x03A3;
40311 t['Sixroman'] = 0x2165;
40312 t['Smonospace'] = 0xFF33;
40313 t['Softsigncyrillic'] = 0x042C;
40314 t['Ssmall'] = 0xF773;
40315 t['Stigmagreek'] = 0x03DA;
40316 t['T'] = 0x0054;
40317 t['Tau'] = 0x03A4;
40318 t['Tbar'] = 0x0166;
40319 t['Tcaron'] = 0x0164;
40320 t['Tcedilla'] = 0x0162;
40321 t['Tcircle'] = 0x24C9;
40322 t['Tcircumflexbelow'] = 0x1E70;
40323 t['Tcommaaccent'] = 0x0162;
40324 t['Tdotaccent'] = 0x1E6A;
40325 t['Tdotbelow'] = 0x1E6C;
40326 t['Tecyrillic'] = 0x0422;
40327 t['Tedescendercyrillic'] = 0x04AC;
40328 t['Tenroman'] = 0x2169;
40329 t['Tetsecyrillic'] = 0x04B4;
40330 t['Theta'] = 0x0398;
40331 t['Thook'] = 0x01AC;
40332 t['Thorn'] = 0x00DE;
40333 t['Thornsmall'] = 0xF7FE;
40334 t['Threeroman'] = 0x2162;
40335 t['Tildesmall'] = 0xF6FE;
40336 t['Tiwnarmenian'] = 0x054F;
40337 t['Tlinebelow'] = 0x1E6E;
40338 t['Tmonospace'] = 0xFF34;
40339 t['Toarmenian'] = 0x0539;
40340 t['Tonefive'] = 0x01BC;
40341 t['Tonesix'] = 0x0184;
40342 t['Tonetwo'] = 0x01A7;
40343 t['Tretroflexhook'] = 0x01AE;
40344 t['Tsecyrillic'] = 0x0426;
40345 t['Tshecyrillic'] = 0x040B;
40346 t['Tsmall'] = 0xF774;
40347 t['Twelveroman'] = 0x216B;
40348 t['Tworoman'] = 0x2161;
40349 t['U'] = 0x0055;
40350 t['Uacute'] = 0x00DA;
40351 t['Uacutesmall'] = 0xF7FA;
40352 t['Ubreve'] = 0x016C;
40353 t['Ucaron'] = 0x01D3;
40354 t['Ucircle'] = 0x24CA;
40355 t['Ucircumflex'] = 0x00DB;
40356 t['Ucircumflexbelow'] = 0x1E76;
40357 t['Ucircumflexsmall'] = 0xF7FB;
40358 t['Ucyrillic'] = 0x0423;
40359 t['Udblacute'] = 0x0170;
40360 t['Udblgrave'] = 0x0214;
40361 t['Udieresis'] = 0x00DC;
40362 t['Udieresisacute'] = 0x01D7;
40363 t['Udieresisbelow'] = 0x1E72;
40364 t['Udieresiscaron'] = 0x01D9;
40365 t['Udieresiscyrillic'] = 0x04F0;
40366 t['Udieresisgrave'] = 0x01DB;
40367 t['Udieresismacron'] = 0x01D5;
40368 t['Udieresissmall'] = 0xF7FC;
40369 t['Udotbelow'] = 0x1EE4;
40370 t['Ugrave'] = 0x00D9;
40371 t['Ugravesmall'] = 0xF7F9;
40372 t['Uhookabove'] = 0x1EE6;
40373 t['Uhorn'] = 0x01AF;
40374 t['Uhornacute'] = 0x1EE8;
40375 t['Uhorndotbelow'] = 0x1EF0;
40376 t['Uhorngrave'] = 0x1EEA;
40377 t['Uhornhookabove'] = 0x1EEC;
40378 t['Uhorntilde'] = 0x1EEE;
40379 t['Uhungarumlaut'] = 0x0170;
40380 t['Uhungarumlautcyrillic'] = 0x04F2;
40381 t['Uinvertedbreve'] = 0x0216;
40382 t['Ukcyrillic'] = 0x0478;
40383 t['Umacron'] = 0x016A;
40384 t['Umacroncyrillic'] = 0x04EE;
40385 t['Umacrondieresis'] = 0x1E7A;
40386 t['Umonospace'] = 0xFF35;
40387 t['Uogonek'] = 0x0172;
40388 t['Upsilon'] = 0x03A5;
40389 t['Upsilon1'] = 0x03D2;
40390 t['Upsilonacutehooksymbolgreek'] = 0x03D3;
40391 t['Upsilonafrican'] = 0x01B1;
40392 t['Upsilondieresis'] = 0x03AB;
40393 t['Upsilondieresishooksymbolgreek'] = 0x03D4;
40394 t['Upsilonhooksymbol'] = 0x03D2;
40395 t['Upsilontonos'] = 0x038E;
40396 t['Uring'] = 0x016E;
40397 t['Ushortcyrillic'] = 0x040E;
40398 t['Usmall'] = 0xF775;
40399 t['Ustraightcyrillic'] = 0x04AE;
40400 t['Ustraightstrokecyrillic'] = 0x04B0;
40401 t['Utilde'] = 0x0168;
40402 t['Utildeacute'] = 0x1E78;
40403 t['Utildebelow'] = 0x1E74;
40404 t['V'] = 0x0056;
40405 t['Vcircle'] = 0x24CB;
40406 t['Vdotbelow'] = 0x1E7E;
40407 t['Vecyrillic'] = 0x0412;
40408 t['Vewarmenian'] = 0x054E;
40409 t['Vhook'] = 0x01B2;
40410 t['Vmonospace'] = 0xFF36;
40411 t['Voarmenian'] = 0x0548;
40412 t['Vsmall'] = 0xF776;
40413 t['Vtilde'] = 0x1E7C;
40414 t['W'] = 0x0057;
40415 t['Wacute'] = 0x1E82;
40416 t['Wcircle'] = 0x24CC;
40417 t['Wcircumflex'] = 0x0174;
40418 t['Wdieresis'] = 0x1E84;
40419 t['Wdotaccent'] = 0x1E86;
40420 t['Wdotbelow'] = 0x1E88;
40421 t['Wgrave'] = 0x1E80;
40422 t['Wmonospace'] = 0xFF37;
40423 t['Wsmall'] = 0xF777;
40424 t['X'] = 0x0058;
40425 t['Xcircle'] = 0x24CD;
40426 t['Xdieresis'] = 0x1E8C;
40427 t['Xdotaccent'] = 0x1E8A;
40428 t['Xeharmenian'] = 0x053D;
40429 t['Xi'] = 0x039E;
40430 t['Xmonospace'] = 0xFF38;
40431 t['Xsmall'] = 0xF778;
40432 t['Y'] = 0x0059;
40433 t['Yacute'] = 0x00DD;
40434 t['Yacutesmall'] = 0xF7FD;
40435 t['Yatcyrillic'] = 0x0462;
40436 t['Ycircle'] = 0x24CE;
40437 t['Ycircumflex'] = 0x0176;
40438 t['Ydieresis'] = 0x0178;
40439 t['Ydieresissmall'] = 0xF7FF;
40440 t['Ydotaccent'] = 0x1E8E;
40441 t['Ydotbelow'] = 0x1EF4;
40442 t['Yericyrillic'] = 0x042B;
40443 t['Yerudieresiscyrillic'] = 0x04F8;
40444 t['Ygrave'] = 0x1EF2;
40445 t['Yhook'] = 0x01B3;
40446 t['Yhookabove'] = 0x1EF6;
40447 t['Yiarmenian'] = 0x0545;
40448 t['Yicyrillic'] = 0x0407;
40449 t['Yiwnarmenian'] = 0x0552;
40450 t['Ymonospace'] = 0xFF39;
40451 t['Ysmall'] = 0xF779;
40452 t['Ytilde'] = 0x1EF8;
40453 t['Yusbigcyrillic'] = 0x046A;
40454 t['Yusbigiotifiedcyrillic'] = 0x046C;
40455 t['Yuslittlecyrillic'] = 0x0466;
40456 t['Yuslittleiotifiedcyrillic'] = 0x0468;
40457 t['Z'] = 0x005A;
40458 t['Zaarmenian'] = 0x0536;
40459 t['Zacute'] = 0x0179;
40460 t['Zcaron'] = 0x017D;
40461 t['Zcaronsmall'] = 0xF6FF;
40462 t['Zcircle'] = 0x24CF;
40463 t['Zcircumflex'] = 0x1E90;
40464 t['Zdot'] = 0x017B;
40465 t['Zdotaccent'] = 0x017B;
40466 t['Zdotbelow'] = 0x1E92;
40467 t['Zecyrillic'] = 0x0417;
40468 t['Zedescendercyrillic'] = 0x0498;
40469 t['Zedieresiscyrillic'] = 0x04DE;
40470 t['Zeta'] = 0x0396;
40471 t['Zhearmenian'] = 0x053A;
40472 t['Zhebrevecyrillic'] = 0x04C1;
40473 t['Zhecyrillic'] = 0x0416;
40474 t['Zhedescendercyrillic'] = 0x0496;
40475 t['Zhedieresiscyrillic'] = 0x04DC;
40476 t['Zlinebelow'] = 0x1E94;
40477 t['Zmonospace'] = 0xFF3A;
40478 t['Zsmall'] = 0xF77A;
40479 t['Zstroke'] = 0x01B5;
40480 t['a'] = 0x0061;
40481 t['aabengali'] = 0x0986;
40482 t['aacute'] = 0x00E1;
40483 t['aadeva'] = 0x0906;
40484 t['aagujarati'] = 0x0A86;
40485 t['aagurmukhi'] = 0x0A06;
40486 t['aamatragurmukhi'] = 0x0A3E;
40487 t['aarusquare'] = 0x3303;
40488 t['aavowelsignbengali'] = 0x09BE;
40489 t['aavowelsigndeva'] = 0x093E;
40490 t['aavowelsigngujarati'] = 0x0ABE;
40491 t['abbreviationmarkarmenian'] = 0x055F;
40492 t['abbreviationsigndeva'] = 0x0970;
40493 t['abengali'] = 0x0985;
40494 t['abopomofo'] = 0x311A;
40495 t['abreve'] = 0x0103;
40496 t['abreveacute'] = 0x1EAF;
40497 t['abrevecyrillic'] = 0x04D1;
40498 t['abrevedotbelow'] = 0x1EB7;
40499 t['abrevegrave'] = 0x1EB1;
40500 t['abrevehookabove'] = 0x1EB3;
40501 t['abrevetilde'] = 0x1EB5;
40502 t['acaron'] = 0x01CE;
40503 t['acircle'] = 0x24D0;
40504 t['acircumflex'] = 0x00E2;
40505 t['acircumflexacute'] = 0x1EA5;
40506 t['acircumflexdotbelow'] = 0x1EAD;
40507 t['acircumflexgrave'] = 0x1EA7;
40508 t['acircumflexhookabove'] = 0x1EA9;
40509 t['acircumflextilde'] = 0x1EAB;
40510 t['acute'] = 0x00B4;
40511 t['acutebelowcmb'] = 0x0317;
40512 t['acutecmb'] = 0x0301;
40513 t['acutecomb'] = 0x0301;
40514 t['acutedeva'] = 0x0954;
40515 t['acutelowmod'] = 0x02CF;
40516 t['acutetonecmb'] = 0x0341;
40517 t['acyrillic'] = 0x0430;
40518 t['adblgrave'] = 0x0201;
40519 t['addakgurmukhi'] = 0x0A71;
40520 t['adeva'] = 0x0905;
40521 t['adieresis'] = 0x00E4;
40522 t['adieresiscyrillic'] = 0x04D3;
40523 t['adieresismacron'] = 0x01DF;
40524 t['adotbelow'] = 0x1EA1;
40525 t['adotmacron'] = 0x01E1;
40526 t['ae'] = 0x00E6;
40527 t['aeacute'] = 0x01FD;
40528 t['aekorean'] = 0x3150;
40529 t['aemacron'] = 0x01E3;
40530 t['afii00208'] = 0x2015;
40531 t['afii08941'] = 0x20A4;
40532 t['afii10017'] = 0x0410;
40533 t['afii10018'] = 0x0411;
40534 t['afii10019'] = 0x0412;
40535 t['afii10020'] = 0x0413;
40536 t['afii10021'] = 0x0414;
40537 t['afii10022'] = 0x0415;
40538 t['afii10023'] = 0x0401;
40539 t['afii10024'] = 0x0416;
40540 t['afii10025'] = 0x0417;
40541 t['afii10026'] = 0x0418;
40542 t['afii10027'] = 0x0419;
40543 t['afii10028'] = 0x041A;
40544 t['afii10029'] = 0x041B;
40545 t['afii10030'] = 0x041C;
40546 t['afii10031'] = 0x041D;
40547 t['afii10032'] = 0x041E;
40548 t['afii10033'] = 0x041F;
40549 t['afii10034'] = 0x0420;
40550 t['afii10035'] = 0x0421;
40551 t['afii10036'] = 0x0422;
40552 t['afii10037'] = 0x0423;
40553 t['afii10038'] = 0x0424;
40554 t['afii10039'] = 0x0425;
40555 t['afii10040'] = 0x0426;
40556 t['afii10041'] = 0x0427;
40557 t['afii10042'] = 0x0428;
40558 t['afii10043'] = 0x0429;
40559 t['afii10044'] = 0x042A;
40560 t['afii10045'] = 0x042B;
40561 t['afii10046'] = 0x042C;
40562 t['afii10047'] = 0x042D;
40563 t['afii10048'] = 0x042E;
40564 t['afii10049'] = 0x042F;
40565 t['afii10050'] = 0x0490;
40566 t['afii10051'] = 0x0402;
40567 t['afii10052'] = 0x0403;
40568 t['afii10053'] = 0x0404;
40569 t['afii10054'] = 0x0405;
40570 t['afii10055'] = 0x0406;
40571 t['afii10056'] = 0x0407;
40572 t['afii10057'] = 0x0408;
40573 t['afii10058'] = 0x0409;
40574 t['afii10059'] = 0x040A;
40575 t['afii10060'] = 0x040B;
40576 t['afii10061'] = 0x040C;
40577 t['afii10062'] = 0x040E;
40578 t['afii10063'] = 0xF6C4;
40579 t['afii10064'] = 0xF6C5;
40580 t['afii10065'] = 0x0430;
40581 t['afii10066'] = 0x0431;
40582 t['afii10067'] = 0x0432;
40583 t['afii10068'] = 0x0433;
40584 t['afii10069'] = 0x0434;
40585 t['afii10070'] = 0x0435;
40586 t['afii10071'] = 0x0451;
40587 t['afii10072'] = 0x0436;
40588 t['afii10073'] = 0x0437;
40589 t['afii10074'] = 0x0438;
40590 t['afii10075'] = 0x0439;
40591 t['afii10076'] = 0x043A;
40592 t['afii10077'] = 0x043B;
40593 t['afii10078'] = 0x043C;
40594 t['afii10079'] = 0x043D;
40595 t['afii10080'] = 0x043E;
40596 t['afii10081'] = 0x043F;
40597 t['afii10082'] = 0x0440;
40598 t['afii10083'] = 0x0441;
40599 t['afii10084'] = 0x0442;
40600 t['afii10085'] = 0x0443;
40601 t['afii10086'] = 0x0444;
40602 t['afii10087'] = 0x0445;
40603 t['afii10088'] = 0x0446;
40604 t['afii10089'] = 0x0447;
40605 t['afii10090'] = 0x0448;
40606 t['afii10091'] = 0x0449;
40607 t['afii10092'] = 0x044A;
40608 t['afii10093'] = 0x044B;
40609 t['afii10094'] = 0x044C;
40610 t['afii10095'] = 0x044D;
40611 t['afii10096'] = 0x044E;
40612 t['afii10097'] = 0x044F;
40613 t['afii10098'] = 0x0491;
40614 t['afii10099'] = 0x0452;
40615 t['afii10100'] = 0x0453;
40616 t['afii10101'] = 0x0454;
40617 t['afii10102'] = 0x0455;
40618 t['afii10103'] = 0x0456;
40619 t['afii10104'] = 0x0457;
40620 t['afii10105'] = 0x0458;
40621 t['afii10106'] = 0x0459;
40622 t['afii10107'] = 0x045A;
40623 t['afii10108'] = 0x045B;
40624 t['afii10109'] = 0x045C;
40625 t['afii10110'] = 0x045E;
40626 t['afii10145'] = 0x040F;
40627 t['afii10146'] = 0x0462;
40628 t['afii10147'] = 0x0472;
40629 t['afii10148'] = 0x0474;
40630 t['afii10192'] = 0xF6C6;
40631 t['afii10193'] = 0x045F;
40632 t['afii10194'] = 0x0463;
40633 t['afii10195'] = 0x0473;
40634 t['afii10196'] = 0x0475;
40635 t['afii10831'] = 0xF6C7;
40636 t['afii10832'] = 0xF6C8;
40637 t['afii10846'] = 0x04D9;
40638 t['afii299'] = 0x200E;
40639 t['afii300'] = 0x200F;
40640 t['afii301'] = 0x200D;
40641 t['afii57381'] = 0x066A;
40642 t['afii57388'] = 0x060C;
40643 t['afii57392'] = 0x0660;
40644 t['afii57393'] = 0x0661;
40645 t['afii57394'] = 0x0662;
40646 t['afii57395'] = 0x0663;
40647 t['afii57396'] = 0x0664;
40648 t['afii57397'] = 0x0665;
40649 t['afii57398'] = 0x0666;
40650 t['afii57399'] = 0x0667;
40651 t['afii57400'] = 0x0668;
40652 t['afii57401'] = 0x0669;
40653 t['afii57403'] = 0x061B;
40654 t['afii57407'] = 0x061F;
40655 t['afii57409'] = 0x0621;
40656 t['afii57410'] = 0x0622;
40657 t['afii57411'] = 0x0623;
40658 t['afii57412'] = 0x0624;
40659 t['afii57413'] = 0x0625;
40660 t['afii57414'] = 0x0626;
40661 t['afii57415'] = 0x0627;
40662 t['afii57416'] = 0x0628;
40663 t['afii57417'] = 0x0629;
40664 t['afii57418'] = 0x062A;
40665 t['afii57419'] = 0x062B;
40666 t['afii57420'] = 0x062C;
40667 t['afii57421'] = 0x062D;
40668 t['afii57422'] = 0x062E;
40669 t['afii57423'] = 0x062F;
40670 t['afii57424'] = 0x0630;
40671 t['afii57425'] = 0x0631;
40672 t['afii57426'] = 0x0632;
40673 t['afii57427'] = 0x0633;
40674 t['afii57428'] = 0x0634;
40675 t['afii57429'] = 0x0635;
40676 t['afii57430'] = 0x0636;
40677 t['afii57431'] = 0x0637;
40678 t['afii57432'] = 0x0638;
40679 t['afii57433'] = 0x0639;
40680 t['afii57434'] = 0x063A;
40681 t['afii57440'] = 0x0640;
40682 t['afii57441'] = 0x0641;
40683 t['afii57442'] = 0x0642;
40684 t['afii57443'] = 0x0643;
40685 t['afii57444'] = 0x0644;
40686 t['afii57445'] = 0x0645;
40687 t['afii57446'] = 0x0646;
40688 t['afii57448'] = 0x0648;
40689 t['afii57449'] = 0x0649;
40690 t['afii57450'] = 0x064A;
40691 t['afii57451'] = 0x064B;
40692 t['afii57452'] = 0x064C;
40693 t['afii57453'] = 0x064D;
40694 t['afii57454'] = 0x064E;
40695 t['afii57455'] = 0x064F;
40696 t['afii57456'] = 0x0650;
40697 t['afii57457'] = 0x0651;
40698 t['afii57458'] = 0x0652;
40699 t['afii57470'] = 0x0647;
40700 t['afii57505'] = 0x06A4;
40701 t['afii57506'] = 0x067E;
40702 t['afii57507'] = 0x0686;
40703 t['afii57508'] = 0x0698;
40704 t['afii57509'] = 0x06AF;
40705 t['afii57511'] = 0x0679;
40706 t['afii57512'] = 0x0688;
40707 t['afii57513'] = 0x0691;
40708 t['afii57514'] = 0x06BA;
40709 t['afii57519'] = 0x06D2;
40710 t['afii57534'] = 0x06D5;
40711 t['afii57636'] = 0x20AA;
40712 t['afii57645'] = 0x05BE;
40713 t['afii57658'] = 0x05C3;
40714 t['afii57664'] = 0x05D0;
40715 t['afii57665'] = 0x05D1;
40716 t['afii57666'] = 0x05D2;
40717 t['afii57667'] = 0x05D3;
40718 t['afii57668'] = 0x05D4;
40719 t['afii57669'] = 0x05D5;
40720 t['afii57670'] = 0x05D6;
40721 t['afii57671'] = 0x05D7;
40722 t['afii57672'] = 0x05D8;
40723 t['afii57673'] = 0x05D9;
40724 t['afii57674'] = 0x05DA;
40725 t['afii57675'] = 0x05DB;
40726 t['afii57676'] = 0x05DC;
40727 t['afii57677'] = 0x05DD;
40728 t['afii57678'] = 0x05DE;
40729 t['afii57679'] = 0x05DF;
40730 t['afii57680'] = 0x05E0;
40731 t['afii57681'] = 0x05E1;
40732 t['afii57682'] = 0x05E2;
40733 t['afii57683'] = 0x05E3;
40734 t['afii57684'] = 0x05E4;
40735 t['afii57685'] = 0x05E5;
40736 t['afii57686'] = 0x05E6;
40737 t['afii57687'] = 0x05E7;
40738 t['afii57688'] = 0x05E8;
40739 t['afii57689'] = 0x05E9;
40740 t['afii57690'] = 0x05EA;
40741 t['afii57694'] = 0xFB2A;
40742 t['afii57695'] = 0xFB2B;
40743 t['afii57700'] = 0xFB4B;
40744 t['afii57705'] = 0xFB1F;
40745 t['afii57716'] = 0x05F0;
40746 t['afii57717'] = 0x05F1;
40747 t['afii57718'] = 0x05F2;
40748 t['afii57723'] = 0xFB35;
40749 t['afii57793'] = 0x05B4;
40750 t['afii57794'] = 0x05B5;
40751 t['afii57795'] = 0x05B6;
40752 t['afii57796'] = 0x05BB;
40753 t['afii57797'] = 0x05B8;
40754 t['afii57798'] = 0x05B7;
40755 t['afii57799'] = 0x05B0;
40756 t['afii57800'] = 0x05B2;
40757 t['afii57801'] = 0x05B1;
40758 t['afii57802'] = 0x05B3;
40759 t['afii57803'] = 0x05C2;
40760 t['afii57804'] = 0x05C1;
40761 t['afii57806'] = 0x05B9;
40762 t['afii57807'] = 0x05BC;
40763 t['afii57839'] = 0x05BD;
40764 t['afii57841'] = 0x05BF;
40765 t['afii57842'] = 0x05C0;
40766 t['afii57929'] = 0x02BC;
40767 t['afii61248'] = 0x2105;
40768 t['afii61289'] = 0x2113;
40769 t['afii61352'] = 0x2116;
40770 t['afii61573'] = 0x202C;
40771 t['afii61574'] = 0x202D;
40772 t['afii61575'] = 0x202E;
40773 t['afii61664'] = 0x200C;
40774 t['afii63167'] = 0x066D;
40775 t['afii64937'] = 0x02BD;
40776 t['agrave'] = 0x00E0;
40777 t['agujarati'] = 0x0A85;
40778 t['agurmukhi'] = 0x0A05;
40779 t['ahiragana'] = 0x3042;
40780 t['ahookabove'] = 0x1EA3;
40781 t['aibengali'] = 0x0990;
40782 t['aibopomofo'] = 0x311E;
40783 t['aideva'] = 0x0910;
40784 t['aiecyrillic'] = 0x04D5;
40785 t['aigujarati'] = 0x0A90;
40786 t['aigurmukhi'] = 0x0A10;
40787 t['aimatragurmukhi'] = 0x0A48;
40788 t['ainarabic'] = 0x0639;
40789 t['ainfinalarabic'] = 0xFECA;
40790 t['aininitialarabic'] = 0xFECB;
40791 t['ainmedialarabic'] = 0xFECC;
40792 t['ainvertedbreve'] = 0x0203;
40793 t['aivowelsignbengali'] = 0x09C8;
40794 t['aivowelsigndeva'] = 0x0948;
40795 t['aivowelsigngujarati'] = 0x0AC8;
40796 t['akatakana'] = 0x30A2;
40797 t['akatakanahalfwidth'] = 0xFF71;
40798 t['akorean'] = 0x314F;
40799 t['alef'] = 0x05D0;
40800 t['alefarabic'] = 0x0627;
40801 t['alefdageshhebrew'] = 0xFB30;
40802 t['aleffinalarabic'] = 0xFE8E;
40803 t['alefhamzaabovearabic'] = 0x0623;
40804 t['alefhamzaabovefinalarabic'] = 0xFE84;
40805 t['alefhamzabelowarabic'] = 0x0625;
40806 t['alefhamzabelowfinalarabic'] = 0xFE88;
40807 t['alefhebrew'] = 0x05D0;
40808 t['aleflamedhebrew'] = 0xFB4F;
40809 t['alefmaddaabovearabic'] = 0x0622;
40810 t['alefmaddaabovefinalarabic'] = 0xFE82;
40811 t['alefmaksuraarabic'] = 0x0649;
40812 t['alefmaksurafinalarabic'] = 0xFEF0;
40813 t['alefmaksurainitialarabic'] = 0xFEF3;
40814 t['alefmaksuramedialarabic'] = 0xFEF4;
40815 t['alefpatahhebrew'] = 0xFB2E;
40816 t['alefqamatshebrew'] = 0xFB2F;
40817 t['aleph'] = 0x2135;
40818 t['allequal'] = 0x224C;
40819 t['alpha'] = 0x03B1;
40820 t['alphatonos'] = 0x03AC;
40821 t['amacron'] = 0x0101;
40822 t['amonospace'] = 0xFF41;
40823 t['ampersand'] = 0x0026;
40824 t['ampersandmonospace'] = 0xFF06;
40825 t['ampersandsmall'] = 0xF726;
40826 t['amsquare'] = 0x33C2;
40827 t['anbopomofo'] = 0x3122;
40828 t['angbopomofo'] = 0x3124;
40829 t['angbracketleft'] = 0x3008;
40830 t['angbracketright'] = 0x3009;
40831 t['angkhankhuthai'] = 0x0E5A;
40832 t['angle'] = 0x2220;
40833 t['anglebracketleft'] = 0x3008;
40834 t['anglebracketleftvertical'] = 0xFE3F;
40835 t['anglebracketright'] = 0x3009;
40836 t['anglebracketrightvertical'] = 0xFE40;
40837 t['angleleft'] = 0x2329;
40838 t['angleright'] = 0x232A;
40839 t['angstrom'] = 0x212B;
40840 t['anoteleia'] = 0x0387;
40841 t['anudattadeva'] = 0x0952;
40842 t['anusvarabengali'] = 0x0982;
40843 t['anusvaradeva'] = 0x0902;
40844 t['anusvaragujarati'] = 0x0A82;
40845 t['aogonek'] = 0x0105;
40846 t['apaatosquare'] = 0x3300;
40847 t['aparen'] = 0x249C;
40848 t['apostrophearmenian'] = 0x055A;
40849 t['apostrophemod'] = 0x02BC;
40850 t['apple'] = 0xF8FF;
40851 t['approaches'] = 0x2250;
40852 t['approxequal'] = 0x2248;
40853 t['approxequalorimage'] = 0x2252;
40854 t['approximatelyequal'] = 0x2245;
40855 t['araeaekorean'] = 0x318E;
40856 t['araeakorean'] = 0x318D;
40857 t['arc'] = 0x2312;
40858 t['arighthalfring'] = 0x1E9A;
40859 t['aring'] = 0x00E5;
40860 t['aringacute'] = 0x01FB;
40861 t['aringbelow'] = 0x1E01;
40862 t['arrowboth'] = 0x2194;
40863 t['arrowdashdown'] = 0x21E3;
40864 t['arrowdashleft'] = 0x21E0;
40865 t['arrowdashright'] = 0x21E2;
40866 t['arrowdashup'] = 0x21E1;
40867 t['arrowdblboth'] = 0x21D4;
40868 t['arrowdbldown'] = 0x21D3;
40869 t['arrowdblleft'] = 0x21D0;
40870 t['arrowdblright'] = 0x21D2;
40871 t['arrowdblup'] = 0x21D1;
40872 t['arrowdown'] = 0x2193;
40873 t['arrowdownleft'] = 0x2199;
40874 t['arrowdownright'] = 0x2198;
40875 t['arrowdownwhite'] = 0x21E9;
40876 t['arrowheaddownmod'] = 0x02C5;
40877 t['arrowheadleftmod'] = 0x02C2;
40878 t['arrowheadrightmod'] = 0x02C3;
40879 t['arrowheadupmod'] = 0x02C4;
40880 t['arrowhorizex'] = 0xF8E7;
40881 t['arrowleft'] = 0x2190;
40882 t['arrowleftdbl'] = 0x21D0;
40883 t['arrowleftdblstroke'] = 0x21CD;
40884 t['arrowleftoverright'] = 0x21C6;
40885 t['arrowleftwhite'] = 0x21E6;
40886 t['arrowright'] = 0x2192;
40887 t['arrowrightdblstroke'] = 0x21CF;
40888 t['arrowrightheavy'] = 0x279E;
40889 t['arrowrightoverleft'] = 0x21C4;
40890 t['arrowrightwhite'] = 0x21E8;
40891 t['arrowtableft'] = 0x21E4;
40892 t['arrowtabright'] = 0x21E5;
40893 t['arrowup'] = 0x2191;
40894 t['arrowupdn'] = 0x2195;
40895 t['arrowupdnbse'] = 0x21A8;
40896 t['arrowupdownbase'] = 0x21A8;
40897 t['arrowupleft'] = 0x2196;
40898 t['arrowupleftofdown'] = 0x21C5;
40899 t['arrowupright'] = 0x2197;
40900 t['arrowupwhite'] = 0x21E7;
40901 t['arrowvertex'] = 0xF8E6;
40902 t['asciicircum'] = 0x005E;
40903 t['asciicircummonospace'] = 0xFF3E;
40904 t['asciitilde'] = 0x007E;
40905 t['asciitildemonospace'] = 0xFF5E;
40906 t['ascript'] = 0x0251;
40907 t['ascriptturned'] = 0x0252;
40908 t['asmallhiragana'] = 0x3041;
40909 t['asmallkatakana'] = 0x30A1;
40910 t['asmallkatakanahalfwidth'] = 0xFF67;
40911 t['asterisk'] = 0x002A;
40912 t['asteriskaltonearabic'] = 0x066D;
40913 t['asteriskarabic'] = 0x066D;
40914 t['asteriskmath'] = 0x2217;
40915 t['asteriskmonospace'] = 0xFF0A;
40916 t['asterisksmall'] = 0xFE61;
40917 t['asterism'] = 0x2042;
40918 t['asuperior'] = 0xF6E9;
40919 t['asymptoticallyequal'] = 0x2243;
40920 t['at'] = 0x0040;
40921 t['atilde'] = 0x00E3;
40922 t['atmonospace'] = 0xFF20;
40923 t['atsmall'] = 0xFE6B;
40924 t['aturned'] = 0x0250;
40925 t['aubengali'] = 0x0994;
40926 t['aubopomofo'] = 0x3120;
40927 t['audeva'] = 0x0914;
40928 t['augujarati'] = 0x0A94;
40929 t['augurmukhi'] = 0x0A14;
40930 t['aulengthmarkbengali'] = 0x09D7;
40931 t['aumatragurmukhi'] = 0x0A4C;
40932 t['auvowelsignbengali'] = 0x09CC;
40933 t['auvowelsigndeva'] = 0x094C;
40934 t['auvowelsigngujarati'] = 0x0ACC;
40935 t['avagrahadeva'] = 0x093D;
40936 t['aybarmenian'] = 0x0561;
40937 t['ayin'] = 0x05E2;
40938 t['ayinaltonehebrew'] = 0xFB20;
40939 t['ayinhebrew'] = 0x05E2;
40940 t['b'] = 0x0062;
40941 t['babengali'] = 0x09AC;
40942 t['backslash'] = 0x005C;
40943 t['backslashmonospace'] = 0xFF3C;
40944 t['badeva'] = 0x092C;
40945 t['bagujarati'] = 0x0AAC;
40946 t['bagurmukhi'] = 0x0A2C;
40947 t['bahiragana'] = 0x3070;
40948 t['bahtthai'] = 0x0E3F;
40949 t['bakatakana'] = 0x30D0;
40950 t['bar'] = 0x007C;
40951 t['barmonospace'] = 0xFF5C;
40952 t['bbopomofo'] = 0x3105;
40953 t['bcircle'] = 0x24D1;
40954 t['bdotaccent'] = 0x1E03;
40955 t['bdotbelow'] = 0x1E05;
40956 t['beamedsixteenthnotes'] = 0x266C;
40957 t['because'] = 0x2235;
40958 t['becyrillic'] = 0x0431;
40959 t['beharabic'] = 0x0628;
40960 t['behfinalarabic'] = 0xFE90;
40961 t['behinitialarabic'] = 0xFE91;
40962 t['behiragana'] = 0x3079;
40963 t['behmedialarabic'] = 0xFE92;
40964 t['behmeeminitialarabic'] = 0xFC9F;
40965 t['behmeemisolatedarabic'] = 0xFC08;
40966 t['behnoonfinalarabic'] = 0xFC6D;
40967 t['bekatakana'] = 0x30D9;
40968 t['benarmenian'] = 0x0562;
40969 t['bet'] = 0x05D1;
40970 t['beta'] = 0x03B2;
40971 t['betasymbolgreek'] = 0x03D0;
40972 t['betdagesh'] = 0xFB31;
40973 t['betdageshhebrew'] = 0xFB31;
40974 t['bethebrew'] = 0x05D1;
40975 t['betrafehebrew'] = 0xFB4C;
40976 t['bhabengali'] = 0x09AD;
40977 t['bhadeva'] = 0x092D;
40978 t['bhagujarati'] = 0x0AAD;
40979 t['bhagurmukhi'] = 0x0A2D;
40980 t['bhook'] = 0x0253;
40981 t['bihiragana'] = 0x3073;
40982 t['bikatakana'] = 0x30D3;
40983 t['bilabialclick'] = 0x0298;
40984 t['bindigurmukhi'] = 0x0A02;
40985 t['birusquare'] = 0x3331;
40986 t['blackcircle'] = 0x25CF;
40987 t['blackdiamond'] = 0x25C6;
40988 t['blackdownpointingtriangle'] = 0x25BC;
40989 t['blackleftpointingpointer'] = 0x25C4;
40990 t['blackleftpointingtriangle'] = 0x25C0;
40991 t['blacklenticularbracketleft'] = 0x3010;
40992 t['blacklenticularbracketleftvertical'] = 0xFE3B;
40993 t['blacklenticularbracketright'] = 0x3011;
40994 t['blacklenticularbracketrightvertical'] = 0xFE3C;
40995 t['blacklowerlefttriangle'] = 0x25E3;
40996 t['blacklowerrighttriangle'] = 0x25E2;
40997 t['blackrectangle'] = 0x25AC;
40998 t['blackrightpointingpointer'] = 0x25BA;
40999 t['blackrightpointingtriangle'] = 0x25B6;
41000 t['blacksmallsquare'] = 0x25AA;
41001 t['blacksmilingface'] = 0x263B;
41002 t['blacksquare'] = 0x25A0;
41003 t['blackstar'] = 0x2605;
41004 t['blackupperlefttriangle'] = 0x25E4;
41005 t['blackupperrighttriangle'] = 0x25E5;
41006 t['blackuppointingsmalltriangle'] = 0x25B4;
41007 t['blackuppointingtriangle'] = 0x25B2;
41008 t['blank'] = 0x2423;
41009 t['blinebelow'] = 0x1E07;
41010 t['block'] = 0x2588;
41011 t['bmonospace'] = 0xFF42;
41012 t['bobaimaithai'] = 0x0E1A;
41013 t['bohiragana'] = 0x307C;
41014 t['bokatakana'] = 0x30DC;
41015 t['bparen'] = 0x249D;
41016 t['bqsquare'] = 0x33C3;
41017 t['braceex'] = 0xF8F4;
41018 t['braceleft'] = 0x007B;
41019 t['braceleftbt'] = 0xF8F3;
41020 t['braceleftmid'] = 0xF8F2;
41021 t['braceleftmonospace'] = 0xFF5B;
41022 t['braceleftsmall'] = 0xFE5B;
41023 t['bracelefttp'] = 0xF8F1;
41024 t['braceleftvertical'] = 0xFE37;
41025 t['braceright'] = 0x007D;
41026 t['bracerightbt'] = 0xF8FE;
41027 t['bracerightmid'] = 0xF8FD;
41028 t['bracerightmonospace'] = 0xFF5D;
41029 t['bracerightsmall'] = 0xFE5C;
41030 t['bracerighttp'] = 0xF8FC;
41031 t['bracerightvertical'] = 0xFE38;
41032 t['bracketleft'] = 0x005B;
41033 t['bracketleftbt'] = 0xF8F0;
41034 t['bracketleftex'] = 0xF8EF;
41035 t['bracketleftmonospace'] = 0xFF3B;
41036 t['bracketlefttp'] = 0xF8EE;
41037 t['bracketright'] = 0x005D;
41038 t['bracketrightbt'] = 0xF8FB;
41039 t['bracketrightex'] = 0xF8FA;
41040 t['bracketrightmonospace'] = 0xFF3D;
41041 t['bracketrighttp'] = 0xF8F9;
41042 t['breve'] = 0x02D8;
41043 t['brevebelowcmb'] = 0x032E;
41044 t['brevecmb'] = 0x0306;
41045 t['breveinvertedbelowcmb'] = 0x032F;
41046 t['breveinvertedcmb'] = 0x0311;
41047 t['breveinverteddoublecmb'] = 0x0361;
41048 t['bridgebelowcmb'] = 0x032A;
41049 t['bridgeinvertedbelowcmb'] = 0x033A;
41050 t['brokenbar'] = 0x00A6;
41051 t['bstroke'] = 0x0180;
41052 t['bsuperior'] = 0xF6EA;
41053 t['btopbar'] = 0x0183;
41054 t['buhiragana'] = 0x3076;
41055 t['bukatakana'] = 0x30D6;
41056 t['bullet'] = 0x2022;
41057 t['bulletinverse'] = 0x25D8;
41058 t['bulletoperator'] = 0x2219;
41059 t['bullseye'] = 0x25CE;
41060 t['c'] = 0x0063;
41061 t['caarmenian'] = 0x056E;
41062 t['cabengali'] = 0x099A;
41063 t['cacute'] = 0x0107;
41064 t['cadeva'] = 0x091A;
41065 t['cagujarati'] = 0x0A9A;
41066 t['cagurmukhi'] = 0x0A1A;
41067 t['calsquare'] = 0x3388;
41068 t['candrabindubengali'] = 0x0981;
41069 t['candrabinducmb'] = 0x0310;
41070 t['candrabindudeva'] = 0x0901;
41071 t['candrabindugujarati'] = 0x0A81;
41072 t['capslock'] = 0x21EA;
41073 t['careof'] = 0x2105;
41074 t['caron'] = 0x02C7;
41075 t['caronbelowcmb'] = 0x032C;
41076 t['caroncmb'] = 0x030C;
41077 t['carriagereturn'] = 0x21B5;
41078 t['cbopomofo'] = 0x3118;
41079 t['ccaron'] = 0x010D;
41080 t['ccedilla'] = 0x00E7;
41081 t['ccedillaacute'] = 0x1E09;
41082 t['ccircle'] = 0x24D2;
41083 t['ccircumflex'] = 0x0109;
41084 t['ccurl'] = 0x0255;
41085 t['cdot'] = 0x010B;
41086 t['cdotaccent'] = 0x010B;
41087 t['cdsquare'] = 0x33C5;
41088 t['cedilla'] = 0x00B8;
41089 t['cedillacmb'] = 0x0327;
41090 t['cent'] = 0x00A2;
41091 t['centigrade'] = 0x2103;
41092 t['centinferior'] = 0xF6DF;
41093 t['centmonospace'] = 0xFFE0;
41094 t['centoldstyle'] = 0xF7A2;
41095 t['centsuperior'] = 0xF6E0;
41096 t['chaarmenian'] = 0x0579;
41097 t['chabengali'] = 0x099B;
41098 t['chadeva'] = 0x091B;
41099 t['chagujarati'] = 0x0A9B;
41100 t['chagurmukhi'] = 0x0A1B;
41101 t['chbopomofo'] = 0x3114;
41102 t['cheabkhasiancyrillic'] = 0x04BD;
41103 t['checkmark'] = 0x2713;
41104 t['checyrillic'] = 0x0447;
41105 t['chedescenderabkhasiancyrillic'] = 0x04BF;
41106 t['chedescendercyrillic'] = 0x04B7;
41107 t['chedieresiscyrillic'] = 0x04F5;
41108 t['cheharmenian'] = 0x0573;
41109 t['chekhakassiancyrillic'] = 0x04CC;
41110 t['cheverticalstrokecyrillic'] = 0x04B9;
41111 t['chi'] = 0x03C7;
41112 t['chieuchacirclekorean'] = 0x3277;
41113 t['chieuchaparenkorean'] = 0x3217;
41114 t['chieuchcirclekorean'] = 0x3269;
41115 t['chieuchkorean'] = 0x314A;
41116 t['chieuchparenkorean'] = 0x3209;
41117 t['chochangthai'] = 0x0E0A;
41118 t['chochanthai'] = 0x0E08;
41119 t['chochingthai'] = 0x0E09;
41120 t['chochoethai'] = 0x0E0C;
41121 t['chook'] = 0x0188;
41122 t['cieucacirclekorean'] = 0x3276;
41123 t['cieucaparenkorean'] = 0x3216;
41124 t['cieuccirclekorean'] = 0x3268;
41125 t['cieuckorean'] = 0x3148;
41126 t['cieucparenkorean'] = 0x3208;
41127 t['cieucuparenkorean'] = 0x321C;
41128 t['circle'] = 0x25CB;
41129 t['circlecopyrt'] = 0x00A9;
41130 t['circlemultiply'] = 0x2297;
41131 t['circleot'] = 0x2299;
41132 t['circleplus'] = 0x2295;
41133 t['circlepostalmark'] = 0x3036;
41134 t['circlewithlefthalfblack'] = 0x25D0;
41135 t['circlewithrighthalfblack'] = 0x25D1;
41136 t['circumflex'] = 0x02C6;
41137 t['circumflexbelowcmb'] = 0x032D;
41138 t['circumflexcmb'] = 0x0302;
41139 t['clear'] = 0x2327;
41140 t['clickalveolar'] = 0x01C2;
41141 t['clickdental'] = 0x01C0;
41142 t['clicklateral'] = 0x01C1;
41143 t['clickretroflex'] = 0x01C3;
41144 t['club'] = 0x2663;
41145 t['clubsuitblack'] = 0x2663;
41146 t['clubsuitwhite'] = 0x2667;
41147 t['cmcubedsquare'] = 0x33A4;
41148 t['cmonospace'] = 0xFF43;
41149 t['cmsquaredsquare'] = 0x33A0;
41150 t['coarmenian'] = 0x0581;
41151 t['colon'] = 0x003A;
41152 t['colonmonetary'] = 0x20A1;
41153 t['colonmonospace'] = 0xFF1A;
41154 t['colonsign'] = 0x20A1;
41155 t['colonsmall'] = 0xFE55;
41156 t['colontriangularhalfmod'] = 0x02D1;
41157 t['colontriangularmod'] = 0x02D0;
41158 t['comma'] = 0x002C;
41159 t['commaabovecmb'] = 0x0313;
41160 t['commaaboverightcmb'] = 0x0315;
41161 t['commaaccent'] = 0xF6C3;
41162 t['commaarabic'] = 0x060C;
41163 t['commaarmenian'] = 0x055D;
41164 t['commainferior'] = 0xF6E1;
41165 t['commamonospace'] = 0xFF0C;
41166 t['commareversedabovecmb'] = 0x0314;
41167 t['commareversedmod'] = 0x02BD;
41168 t['commasmall'] = 0xFE50;
41169 t['commasuperior'] = 0xF6E2;
41170 t['commaturnedabovecmb'] = 0x0312;
41171 t['commaturnedmod'] = 0x02BB;
41172 t['compass'] = 0x263C;
41173 t['congruent'] = 0x2245;
41174 t['contourintegral'] = 0x222E;
41175 t['control'] = 0x2303;
41176 t['controlACK'] = 0x0006;
41177 t['controlBEL'] = 0x0007;
41178 t['controlBS'] = 0x0008;
41179 t['controlCAN'] = 0x0018;
41180 t['controlCR'] = 0x000D;
41181 t['controlDC1'] = 0x0011;
41182 t['controlDC2'] = 0x0012;
41183 t['controlDC3'] = 0x0013;
41184 t['controlDC4'] = 0x0014;
41185 t['controlDEL'] = 0x007F;
41186 t['controlDLE'] = 0x0010;
41187 t['controlEM'] = 0x0019;
41188 t['controlENQ'] = 0x0005;
41189 t['controlEOT'] = 0x0004;
41190 t['controlESC'] = 0x001B;
41191 t['controlETB'] = 0x0017;
41192 t['controlETX'] = 0x0003;
41193 t['controlFF'] = 0x000C;
41194 t['controlFS'] = 0x001C;
41195 t['controlGS'] = 0x001D;
41196 t['controlHT'] = 0x0009;
41197 t['controlLF'] = 0x000A;
41198 t['controlNAK'] = 0x0015;
41199 t['controlNULL'] = 0x0000;
41200 t['controlRS'] = 0x001E;
41201 t['controlSI'] = 0x000F;
41202 t['controlSO'] = 0x000E;
41203 t['controlSOT'] = 0x0002;
41204 t['controlSTX'] = 0x0001;
41205 t['controlSUB'] = 0x001A;
41206 t['controlSYN'] = 0x0016;
41207 t['controlUS'] = 0x001F;
41208 t['controlVT'] = 0x000B;
41209 t['copyright'] = 0x00A9;
41210 t['copyrightsans'] = 0xF8E9;
41211 t['copyrightserif'] = 0xF6D9;
41212 t['cornerbracketleft'] = 0x300C;
41213 t['cornerbracketlefthalfwidth'] = 0xFF62;
41214 t['cornerbracketleftvertical'] = 0xFE41;
41215 t['cornerbracketright'] = 0x300D;
41216 t['cornerbracketrighthalfwidth'] = 0xFF63;
41217 t['cornerbracketrightvertical'] = 0xFE42;
41218 t['corporationsquare'] = 0x337F;
41219 t['cosquare'] = 0x33C7;
41220 t['coverkgsquare'] = 0x33C6;
41221 t['cparen'] = 0x249E;
41222 t['cruzeiro'] = 0x20A2;
41223 t['cstretched'] = 0x0297;
41224 t['curlyand'] = 0x22CF;
41225 t['curlyor'] = 0x22CE;
41226 t['currency'] = 0x00A4;
41227 t['cyrBreve'] = 0xF6D1;
41228 t['cyrFlex'] = 0xF6D2;
41229 t['cyrbreve'] = 0xF6D4;
41230 t['cyrflex'] = 0xF6D5;
41231 t['d'] = 0x0064;
41232 t['daarmenian'] = 0x0564;
41233 t['dabengali'] = 0x09A6;
41234 t['dadarabic'] = 0x0636;
41235 t['dadeva'] = 0x0926;
41236 t['dadfinalarabic'] = 0xFEBE;
41237 t['dadinitialarabic'] = 0xFEBF;
41238 t['dadmedialarabic'] = 0xFEC0;
41239 t['dagesh'] = 0x05BC;
41240 t['dageshhebrew'] = 0x05BC;
41241 t['dagger'] = 0x2020;
41242 t['daggerdbl'] = 0x2021;
41243 t['dagujarati'] = 0x0AA6;
41244 t['dagurmukhi'] = 0x0A26;
41245 t['dahiragana'] = 0x3060;
41246 t['dakatakana'] = 0x30C0;
41247 t['dalarabic'] = 0x062F;
41248 t['dalet'] = 0x05D3;
41249 t['daletdagesh'] = 0xFB33;
41250 t['daletdageshhebrew'] = 0xFB33;
41251 t['dalethebrew'] = 0x05D3;
41252 t['dalfinalarabic'] = 0xFEAA;
41253 t['dammaarabic'] = 0x064F;
41254 t['dammalowarabic'] = 0x064F;
41255 t['dammatanaltonearabic'] = 0x064C;
41256 t['dammatanarabic'] = 0x064C;
41257 t['danda'] = 0x0964;
41258 t['dargahebrew'] = 0x05A7;
41259 t['dargalefthebrew'] = 0x05A7;
41260 t['dasiapneumatacyrilliccmb'] = 0x0485;
41261 t['dblGrave'] = 0xF6D3;
41262 t['dblanglebracketleft'] = 0x300A;
41263 t['dblanglebracketleftvertical'] = 0xFE3D;
41264 t['dblanglebracketright'] = 0x300B;
41265 t['dblanglebracketrightvertical'] = 0xFE3E;
41266 t['dblarchinvertedbelowcmb'] = 0x032B;
41267 t['dblarrowleft'] = 0x21D4;
41268 t['dblarrowright'] = 0x21D2;
41269 t['dbldanda'] = 0x0965;
41270 t['dblgrave'] = 0xF6D6;
41271 t['dblgravecmb'] = 0x030F;
41272 t['dblintegral'] = 0x222C;
41273 t['dbllowline'] = 0x2017;
41274 t['dbllowlinecmb'] = 0x0333;
41275 t['dbloverlinecmb'] = 0x033F;
41276 t['dblprimemod'] = 0x02BA;
41277 t['dblverticalbar'] = 0x2016;
41278 t['dblverticallineabovecmb'] = 0x030E;
41279 t['dbopomofo'] = 0x3109;
41280 t['dbsquare'] = 0x33C8;
41281 t['dcaron'] = 0x010F;
41282 t['dcedilla'] = 0x1E11;
41283 t['dcircle'] = 0x24D3;
41284 t['dcircumflexbelow'] = 0x1E13;
41285 t['dcroat'] = 0x0111;
41286 t['ddabengali'] = 0x09A1;
41287 t['ddadeva'] = 0x0921;
41288 t['ddagujarati'] = 0x0AA1;
41289 t['ddagurmukhi'] = 0x0A21;
41290 t['ddalarabic'] = 0x0688;
41291 t['ddalfinalarabic'] = 0xFB89;
41292 t['dddhadeva'] = 0x095C;
41293 t['ddhabengali'] = 0x09A2;
41294 t['ddhadeva'] = 0x0922;
41295 t['ddhagujarati'] = 0x0AA2;
41296 t['ddhagurmukhi'] = 0x0A22;
41297 t['ddotaccent'] = 0x1E0B;
41298 t['ddotbelow'] = 0x1E0D;
41299 t['decimalseparatorarabic'] = 0x066B;
41300 t['decimalseparatorpersian'] = 0x066B;
41301 t['decyrillic'] = 0x0434;
41302 t['degree'] = 0x00B0;
41303 t['dehihebrew'] = 0x05AD;
41304 t['dehiragana'] = 0x3067;
41305 t['deicoptic'] = 0x03EF;
41306 t['dekatakana'] = 0x30C7;
41307 t['deleteleft'] = 0x232B;
41308 t['deleteright'] = 0x2326;
41309 t['delta'] = 0x03B4;
41310 t['deltaturned'] = 0x018D;
41311 t['denominatorminusonenumeratorbengali'] = 0x09F8;
41312 t['dezh'] = 0x02A4;
41313 t['dhabengali'] = 0x09A7;
41314 t['dhadeva'] = 0x0927;
41315 t['dhagujarati'] = 0x0AA7;
41316 t['dhagurmukhi'] = 0x0A27;
41317 t['dhook'] = 0x0257;
41318 t['dialytikatonos'] = 0x0385;
41319 t['dialytikatonoscmb'] = 0x0344;
41320 t['diamond'] = 0x2666;
41321 t['diamondsuitwhite'] = 0x2662;
41322 t['dieresis'] = 0x00A8;
41323 t['dieresisacute'] = 0xF6D7;
41324 t['dieresisbelowcmb'] = 0x0324;
41325 t['dieresiscmb'] = 0x0308;
41326 t['dieresisgrave'] = 0xF6D8;
41327 t['dieresistonos'] = 0x0385;
41328 t['dihiragana'] = 0x3062;
41329 t['dikatakana'] = 0x30C2;
41330 t['dittomark'] = 0x3003;
41331 t['divide'] = 0x00F7;
41332 t['divides'] = 0x2223;
41333 t['divisionslash'] = 0x2215;
41334 t['djecyrillic'] = 0x0452;
41335 t['dkshade'] = 0x2593;
41336 t['dlinebelow'] = 0x1E0F;
41337 t['dlsquare'] = 0x3397;
41338 t['dmacron'] = 0x0111;
41339 t['dmonospace'] = 0xFF44;
41340 t['dnblock'] = 0x2584;
41341 t['dochadathai'] = 0x0E0E;
41342 t['dodekthai'] = 0x0E14;
41343 t['dohiragana'] = 0x3069;
41344 t['dokatakana'] = 0x30C9;
41345 t['dollar'] = 0x0024;
41346 t['dollarinferior'] = 0xF6E3;
41347 t['dollarmonospace'] = 0xFF04;
41348 t['dollaroldstyle'] = 0xF724;
41349 t['dollarsmall'] = 0xFE69;
41350 t['dollarsuperior'] = 0xF6E4;
41351 t['dong'] = 0x20AB;
41352 t['dorusquare'] = 0x3326;
41353 t['dotaccent'] = 0x02D9;
41354 t['dotaccentcmb'] = 0x0307;
41355 t['dotbelowcmb'] = 0x0323;
41356 t['dotbelowcomb'] = 0x0323;
41357 t['dotkatakana'] = 0x30FB;
41358 t['dotlessi'] = 0x0131;
41359 t['dotlessj'] = 0xF6BE;
41360 t['dotlessjstrokehook'] = 0x0284;
41361 t['dotmath'] = 0x22C5;
41362 t['dottedcircle'] = 0x25CC;
41363 t['doubleyodpatah'] = 0xFB1F;
41364 t['doubleyodpatahhebrew'] = 0xFB1F;
41365 t['downtackbelowcmb'] = 0x031E;
41366 t['downtackmod'] = 0x02D5;
41367 t['dparen'] = 0x249F;
41368 t['dsuperior'] = 0xF6EB;
41369 t['dtail'] = 0x0256;
41370 t['dtopbar'] = 0x018C;
41371 t['duhiragana'] = 0x3065;
41372 t['dukatakana'] = 0x30C5;
41373 t['dz'] = 0x01F3;
41374 t['dzaltone'] = 0x02A3;
41375 t['dzcaron'] = 0x01C6;
41376 t['dzcurl'] = 0x02A5;
41377 t['dzeabkhasiancyrillic'] = 0x04E1;
41378 t['dzecyrillic'] = 0x0455;
41379 t['dzhecyrillic'] = 0x045F;
41380 t['e'] = 0x0065;
41381 t['eacute'] = 0x00E9;
41382 t['earth'] = 0x2641;
41383 t['ebengali'] = 0x098F;
41384 t['ebopomofo'] = 0x311C;
41385 t['ebreve'] = 0x0115;
41386 t['ecandradeva'] = 0x090D;
41387 t['ecandragujarati'] = 0x0A8D;
41388 t['ecandravowelsigndeva'] = 0x0945;
41389 t['ecandravowelsigngujarati'] = 0x0AC5;
41390 t['ecaron'] = 0x011B;
41391 t['ecedillabreve'] = 0x1E1D;
41392 t['echarmenian'] = 0x0565;
41393 t['echyiwnarmenian'] = 0x0587;
41394 t['ecircle'] = 0x24D4;
41395 t['ecircumflex'] = 0x00EA;
41396 t['ecircumflexacute'] = 0x1EBF;
41397 t['ecircumflexbelow'] = 0x1E19;
41398 t['ecircumflexdotbelow'] = 0x1EC7;
41399 t['ecircumflexgrave'] = 0x1EC1;
41400 t['ecircumflexhookabove'] = 0x1EC3;
41401 t['ecircumflextilde'] = 0x1EC5;
41402 t['ecyrillic'] = 0x0454;
41403 t['edblgrave'] = 0x0205;
41404 t['edeva'] = 0x090F;
41405 t['edieresis'] = 0x00EB;
41406 t['edot'] = 0x0117;
41407 t['edotaccent'] = 0x0117;
41408 t['edotbelow'] = 0x1EB9;
41409 t['eegurmukhi'] = 0x0A0F;
41410 t['eematragurmukhi'] = 0x0A47;
41411 t['efcyrillic'] = 0x0444;
41412 t['egrave'] = 0x00E8;
41413 t['egujarati'] = 0x0A8F;
41414 t['eharmenian'] = 0x0567;
41415 t['ehbopomofo'] = 0x311D;
41416 t['ehiragana'] = 0x3048;
41417 t['ehookabove'] = 0x1EBB;
41418 t['eibopomofo'] = 0x311F;
41419 t['eight'] = 0x0038;
41420 t['eightarabic'] = 0x0668;
41421 t['eightbengali'] = 0x09EE;
41422 t['eightcircle'] = 0x2467;
41423 t['eightcircleinversesansserif'] = 0x2791;
41424 t['eightdeva'] = 0x096E;
41425 t['eighteencircle'] = 0x2471;
41426 t['eighteenparen'] = 0x2485;
41427 t['eighteenperiod'] = 0x2499;
41428 t['eightgujarati'] = 0x0AEE;
41429 t['eightgurmukhi'] = 0x0A6E;
41430 t['eighthackarabic'] = 0x0668;
41431 t['eighthangzhou'] = 0x3028;
41432 t['eighthnotebeamed'] = 0x266B;
41433 t['eightideographicparen'] = 0x3227;
41434 t['eightinferior'] = 0x2088;
41435 t['eightmonospace'] = 0xFF18;
41436 t['eightoldstyle'] = 0xF738;
41437 t['eightparen'] = 0x247B;
41438 t['eightperiod'] = 0x248F;
41439 t['eightpersian'] = 0x06F8;
41440 t['eightroman'] = 0x2177;
41441 t['eightsuperior'] = 0x2078;
41442 t['eightthai'] = 0x0E58;
41443 t['einvertedbreve'] = 0x0207;
41444 t['eiotifiedcyrillic'] = 0x0465;
41445 t['ekatakana'] = 0x30A8;
41446 t['ekatakanahalfwidth'] = 0xFF74;
41447 t['ekonkargurmukhi'] = 0x0A74;
41448 t['ekorean'] = 0x3154;
41449 t['elcyrillic'] = 0x043B;
41450 t['element'] = 0x2208;
41451 t['elevencircle'] = 0x246A;
41452 t['elevenparen'] = 0x247E;
41453 t['elevenperiod'] = 0x2492;
41454 t['elevenroman'] = 0x217A;
41455 t['ellipsis'] = 0x2026;
41456 t['ellipsisvertical'] = 0x22EE;
41457 t['emacron'] = 0x0113;
41458 t['emacronacute'] = 0x1E17;
41459 t['emacrongrave'] = 0x1E15;
41460 t['emcyrillic'] = 0x043C;
41461 t['emdash'] = 0x2014;
41462 t['emdashvertical'] = 0xFE31;
41463 t['emonospace'] = 0xFF45;
41464 t['emphasismarkarmenian'] = 0x055B;
41465 t['emptyset'] = 0x2205;
41466 t['enbopomofo'] = 0x3123;
41467 t['encyrillic'] = 0x043D;
41468 t['endash'] = 0x2013;
41469 t['endashvertical'] = 0xFE32;
41470 t['endescendercyrillic'] = 0x04A3;
41471 t['eng'] = 0x014B;
41472 t['engbopomofo'] = 0x3125;
41473 t['enghecyrillic'] = 0x04A5;
41474 t['enhookcyrillic'] = 0x04C8;
41475 t['enspace'] = 0x2002;
41476 t['eogonek'] = 0x0119;
41477 t['eokorean'] = 0x3153;
41478 t['eopen'] = 0x025B;
41479 t['eopenclosed'] = 0x029A;
41480 t['eopenreversed'] = 0x025C;
41481 t['eopenreversedclosed'] = 0x025E;
41482 t['eopenreversedhook'] = 0x025D;
41483 t['eparen'] = 0x24A0;
41484 t['epsilon'] = 0x03B5;
41485 t['epsilontonos'] = 0x03AD;
41486 t['equal'] = 0x003D;
41487 t['equalmonospace'] = 0xFF1D;
41488 t['equalsmall'] = 0xFE66;
41489 t['equalsuperior'] = 0x207C;
41490 t['equivalence'] = 0x2261;
41491 t['erbopomofo'] = 0x3126;
41492 t['ercyrillic'] = 0x0440;
41493 t['ereversed'] = 0x0258;
41494 t['ereversedcyrillic'] = 0x044D;
41495 t['escyrillic'] = 0x0441;
41496 t['esdescendercyrillic'] = 0x04AB;
41497 t['esh'] = 0x0283;
41498 t['eshcurl'] = 0x0286;
41499 t['eshortdeva'] = 0x090E;
41500 t['eshortvowelsigndeva'] = 0x0946;
41501 t['eshreversedloop'] = 0x01AA;
41502 t['eshsquatreversed'] = 0x0285;
41503 t['esmallhiragana'] = 0x3047;
41504 t['esmallkatakana'] = 0x30A7;
41505 t['esmallkatakanahalfwidth'] = 0xFF6A;
41506 t['estimated'] = 0x212E;
41507 t['esuperior'] = 0xF6EC;
41508 t['eta'] = 0x03B7;
41509 t['etarmenian'] = 0x0568;
41510 t['etatonos'] = 0x03AE;
41511 t['eth'] = 0x00F0;
41512 t['etilde'] = 0x1EBD;
41513 t['etildebelow'] = 0x1E1B;
41514 t['etnahtafoukhhebrew'] = 0x0591;
41515 t['etnahtafoukhlefthebrew'] = 0x0591;
41516 t['etnahtahebrew'] = 0x0591;
41517 t['etnahtalefthebrew'] = 0x0591;
41518 t['eturned'] = 0x01DD;
41519 t['eukorean'] = 0x3161;
41520 t['euro'] = 0x20AC;
41521 t['evowelsignbengali'] = 0x09C7;
41522 t['evowelsigndeva'] = 0x0947;
41523 t['evowelsigngujarati'] = 0x0AC7;
41524 t['exclam'] = 0x0021;
41525 t['exclamarmenian'] = 0x055C;
41526 t['exclamdbl'] = 0x203C;
41527 t['exclamdown'] = 0x00A1;
41528 t['exclamdownsmall'] = 0xF7A1;
41529 t['exclammonospace'] = 0xFF01;
41530 t['exclamsmall'] = 0xF721;
41531 t['existential'] = 0x2203;
41532 t['ezh'] = 0x0292;
41533 t['ezhcaron'] = 0x01EF;
41534 t['ezhcurl'] = 0x0293;
41535 t['ezhreversed'] = 0x01B9;
41536 t['ezhtail'] = 0x01BA;
41537 t['f'] = 0x0066;
41538 t['fadeva'] = 0x095E;
41539 t['fagurmukhi'] = 0x0A5E;
41540 t['fahrenheit'] = 0x2109;
41541 t['fathaarabic'] = 0x064E;
41542 t['fathalowarabic'] = 0x064E;
41543 t['fathatanarabic'] = 0x064B;
41544 t['fbopomofo'] = 0x3108;
41545 t['fcircle'] = 0x24D5;
41546 t['fdotaccent'] = 0x1E1F;
41547 t['feharabic'] = 0x0641;
41548 t['feharmenian'] = 0x0586;
41549 t['fehfinalarabic'] = 0xFED2;
41550 t['fehinitialarabic'] = 0xFED3;
41551 t['fehmedialarabic'] = 0xFED4;
41552 t['feicoptic'] = 0x03E5;
41553 t['female'] = 0x2640;
41554 t['ff'] = 0xFB00;
41555 t['ffi'] = 0xFB03;
41556 t['ffl'] = 0xFB04;
41557 t['fi'] = 0xFB01;
41558 t['fifteencircle'] = 0x246E;
41559 t['fifteenparen'] = 0x2482;
41560 t['fifteenperiod'] = 0x2496;
41561 t['figuredash'] = 0x2012;
41562 t['filledbox'] = 0x25A0;
41563 t['filledrect'] = 0x25AC;
41564 t['finalkaf'] = 0x05DA;
41565 t['finalkafdagesh'] = 0xFB3A;
41566 t['finalkafdageshhebrew'] = 0xFB3A;
41567 t['finalkafhebrew'] = 0x05DA;
41568 t['finalmem'] = 0x05DD;
41569 t['finalmemhebrew'] = 0x05DD;
41570 t['finalnun'] = 0x05DF;
41571 t['finalnunhebrew'] = 0x05DF;
41572 t['finalpe'] = 0x05E3;
41573 t['finalpehebrew'] = 0x05E3;
41574 t['finaltsadi'] = 0x05E5;
41575 t['finaltsadihebrew'] = 0x05E5;
41576 t['firsttonechinese'] = 0x02C9;
41577 t['fisheye'] = 0x25C9;
41578 t['fitacyrillic'] = 0x0473;
41579 t['five'] = 0x0035;
41580 t['fivearabic'] = 0x0665;
41581 t['fivebengali'] = 0x09EB;
41582 t['fivecircle'] = 0x2464;
41583 t['fivecircleinversesansserif'] = 0x278E;
41584 t['fivedeva'] = 0x096B;
41585 t['fiveeighths'] = 0x215D;
41586 t['fivegujarati'] = 0x0AEB;
41587 t['fivegurmukhi'] = 0x0A6B;
41588 t['fivehackarabic'] = 0x0665;
41589 t['fivehangzhou'] = 0x3025;
41590 t['fiveideographicparen'] = 0x3224;
41591 t['fiveinferior'] = 0x2085;
41592 t['fivemonospace'] = 0xFF15;
41593 t['fiveoldstyle'] = 0xF735;
41594 t['fiveparen'] = 0x2478;
41595 t['fiveperiod'] = 0x248C;
41596 t['fivepersian'] = 0x06F5;
41597 t['fiveroman'] = 0x2174;
41598 t['fivesuperior'] = 0x2075;
41599 t['fivethai'] = 0x0E55;
41600 t['fl'] = 0xFB02;
41601 t['florin'] = 0x0192;
41602 t['fmonospace'] = 0xFF46;
41603 t['fmsquare'] = 0x3399;
41604 t['fofanthai'] = 0x0E1F;
41605 t['fofathai'] = 0x0E1D;
41606 t['fongmanthai'] = 0x0E4F;
41607 t['forall'] = 0x2200;
41608 t['four'] = 0x0034;
41609 t['fourarabic'] = 0x0664;
41610 t['fourbengali'] = 0x09EA;
41611 t['fourcircle'] = 0x2463;
41612 t['fourcircleinversesansserif'] = 0x278D;
41613 t['fourdeva'] = 0x096A;
41614 t['fourgujarati'] = 0x0AEA;
41615 t['fourgurmukhi'] = 0x0A6A;
41616 t['fourhackarabic'] = 0x0664;
41617 t['fourhangzhou'] = 0x3024;
41618 t['fourideographicparen'] = 0x3223;
41619 t['fourinferior'] = 0x2084;
41620 t['fourmonospace'] = 0xFF14;
41621 t['fournumeratorbengali'] = 0x09F7;
41622 t['fouroldstyle'] = 0xF734;
41623 t['fourparen'] = 0x2477;
41624 t['fourperiod'] = 0x248B;
41625 t['fourpersian'] = 0x06F4;
41626 t['fourroman'] = 0x2173;
41627 t['foursuperior'] = 0x2074;
41628 t['fourteencircle'] = 0x246D;
41629 t['fourteenparen'] = 0x2481;
41630 t['fourteenperiod'] = 0x2495;
41631 t['fourthai'] = 0x0E54;
41632 t['fourthtonechinese'] = 0x02CB;
41633 t['fparen'] = 0x24A1;
41634 t['fraction'] = 0x2044;
41635 t['franc'] = 0x20A3;
41636 t['g'] = 0x0067;
41637 t['gabengali'] = 0x0997;
41638 t['gacute'] = 0x01F5;
41639 t['gadeva'] = 0x0917;
41640 t['gafarabic'] = 0x06AF;
41641 t['gaffinalarabic'] = 0xFB93;
41642 t['gafinitialarabic'] = 0xFB94;
41643 t['gafmedialarabic'] = 0xFB95;
41644 t['gagujarati'] = 0x0A97;
41645 t['gagurmukhi'] = 0x0A17;
41646 t['gahiragana'] = 0x304C;
41647 t['gakatakana'] = 0x30AC;
41648 t['gamma'] = 0x03B3;
41649 t['gammalatinsmall'] = 0x0263;
41650 t['gammasuperior'] = 0x02E0;
41651 t['gangiacoptic'] = 0x03EB;
41652 t['gbopomofo'] = 0x310D;
41653 t['gbreve'] = 0x011F;
41654 t['gcaron'] = 0x01E7;
41655 t['gcedilla'] = 0x0123;
41656 t['gcircle'] = 0x24D6;
41657 t['gcircumflex'] = 0x011D;
41658 t['gcommaaccent'] = 0x0123;
41659 t['gdot'] = 0x0121;
41660 t['gdotaccent'] = 0x0121;
41661 t['gecyrillic'] = 0x0433;
41662 t['gehiragana'] = 0x3052;
41663 t['gekatakana'] = 0x30B2;
41664 t['geometricallyequal'] = 0x2251;
41665 t['gereshaccenthebrew'] = 0x059C;
41666 t['gereshhebrew'] = 0x05F3;
41667 t['gereshmuqdamhebrew'] = 0x059D;
41668 t['germandbls'] = 0x00DF;
41669 t['gershayimaccenthebrew'] = 0x059E;
41670 t['gershayimhebrew'] = 0x05F4;
41671 t['getamark'] = 0x3013;
41672 t['ghabengali'] = 0x0998;
41673 t['ghadarmenian'] = 0x0572;
41674 t['ghadeva'] = 0x0918;
41675 t['ghagujarati'] = 0x0A98;
41676 t['ghagurmukhi'] = 0x0A18;
41677 t['ghainarabic'] = 0x063A;
41678 t['ghainfinalarabic'] = 0xFECE;
41679 t['ghaininitialarabic'] = 0xFECF;
41680 t['ghainmedialarabic'] = 0xFED0;
41681 t['ghemiddlehookcyrillic'] = 0x0495;
41682 t['ghestrokecyrillic'] = 0x0493;
41683 t['gheupturncyrillic'] = 0x0491;
41684 t['ghhadeva'] = 0x095A;
41685 t['ghhagurmukhi'] = 0x0A5A;
41686 t['ghook'] = 0x0260;
41687 t['ghzsquare'] = 0x3393;
41688 t['gihiragana'] = 0x304E;
41689 t['gikatakana'] = 0x30AE;
41690 t['gimarmenian'] = 0x0563;
41691 t['gimel'] = 0x05D2;
41692 t['gimeldagesh'] = 0xFB32;
41693 t['gimeldageshhebrew'] = 0xFB32;
41694 t['gimelhebrew'] = 0x05D2;
41695 t['gjecyrillic'] = 0x0453;
41696 t['glottalinvertedstroke'] = 0x01BE;
41697 t['glottalstop'] = 0x0294;
41698 t['glottalstopinverted'] = 0x0296;
41699 t['glottalstopmod'] = 0x02C0;
41700 t['glottalstopreversed'] = 0x0295;
41701 t['glottalstopreversedmod'] = 0x02C1;
41702 t['glottalstopreversedsuperior'] = 0x02E4;
41703 t['glottalstopstroke'] = 0x02A1;
41704 t['glottalstopstrokereversed'] = 0x02A2;
41705 t['gmacron'] = 0x1E21;
41706 t['gmonospace'] = 0xFF47;
41707 t['gohiragana'] = 0x3054;
41708 t['gokatakana'] = 0x30B4;
41709 t['gparen'] = 0x24A2;
41710 t['gpasquare'] = 0x33AC;
41711 t['gradient'] = 0x2207;
41712 t['grave'] = 0x0060;
41713 t['gravebelowcmb'] = 0x0316;
41714 t['gravecmb'] = 0x0300;
41715 t['gravecomb'] = 0x0300;
41716 t['gravedeva'] = 0x0953;
41717 t['gravelowmod'] = 0x02CE;
41718 t['gravemonospace'] = 0xFF40;
41719 t['gravetonecmb'] = 0x0340;
41720 t['greater'] = 0x003E;
41721 t['greaterequal'] = 0x2265;
41722 t['greaterequalorless'] = 0x22DB;
41723 t['greatermonospace'] = 0xFF1E;
41724 t['greaterorequivalent'] = 0x2273;
41725 t['greaterorless'] = 0x2277;
41726 t['greateroverequal'] = 0x2267;
41727 t['greatersmall'] = 0xFE65;
41728 t['gscript'] = 0x0261;
41729 t['gstroke'] = 0x01E5;
41730 t['guhiragana'] = 0x3050;
41731 t['guillemotleft'] = 0x00AB;
41732 t['guillemotright'] = 0x00BB;
41733 t['guilsinglleft'] = 0x2039;
41734 t['guilsinglright'] = 0x203A;
41735 t['gukatakana'] = 0x30B0;
41736 t['guramusquare'] = 0x3318;
41737 t['gysquare'] = 0x33C9;
41738 t['h'] = 0x0068;
41739 t['haabkhasiancyrillic'] = 0x04A9;
41740 t['haaltonearabic'] = 0x06C1;
41741 t['habengali'] = 0x09B9;
41742 t['hadescendercyrillic'] = 0x04B3;
41743 t['hadeva'] = 0x0939;
41744 t['hagujarati'] = 0x0AB9;
41745 t['hagurmukhi'] = 0x0A39;
41746 t['haharabic'] = 0x062D;
41747 t['hahfinalarabic'] = 0xFEA2;
41748 t['hahinitialarabic'] = 0xFEA3;
41749 t['hahiragana'] = 0x306F;
41750 t['hahmedialarabic'] = 0xFEA4;
41751 t['haitusquare'] = 0x332A;
41752 t['hakatakana'] = 0x30CF;
41753 t['hakatakanahalfwidth'] = 0xFF8A;
41754 t['halantgurmukhi'] = 0x0A4D;
41755 t['hamzaarabic'] = 0x0621;
41756 t['hamzalowarabic'] = 0x0621;
41757 t['hangulfiller'] = 0x3164;
41758 t['hardsigncyrillic'] = 0x044A;
41759 t['harpoonleftbarbup'] = 0x21BC;
41760 t['harpoonrightbarbup'] = 0x21C0;
41761 t['hasquare'] = 0x33CA;
41762 t['hatafpatah'] = 0x05B2;
41763 t['hatafpatah16'] = 0x05B2;
41764 t['hatafpatah23'] = 0x05B2;
41765 t['hatafpatah2f'] = 0x05B2;
41766 t['hatafpatahhebrew'] = 0x05B2;
41767 t['hatafpatahnarrowhebrew'] = 0x05B2;
41768 t['hatafpatahquarterhebrew'] = 0x05B2;
41769 t['hatafpatahwidehebrew'] = 0x05B2;
41770 t['hatafqamats'] = 0x05B3;
41771 t['hatafqamats1b'] = 0x05B3;
41772 t['hatafqamats28'] = 0x05B3;
41773 t['hatafqamats34'] = 0x05B3;
41774 t['hatafqamatshebrew'] = 0x05B3;
41775 t['hatafqamatsnarrowhebrew'] = 0x05B3;
41776 t['hatafqamatsquarterhebrew'] = 0x05B3;
41777 t['hatafqamatswidehebrew'] = 0x05B3;
41778 t['hatafsegol'] = 0x05B1;
41779 t['hatafsegol17'] = 0x05B1;
41780 t['hatafsegol24'] = 0x05B1;
41781 t['hatafsegol30'] = 0x05B1;
41782 t['hatafsegolhebrew'] = 0x05B1;
41783 t['hatafsegolnarrowhebrew'] = 0x05B1;
41784 t['hatafsegolquarterhebrew'] = 0x05B1;
41785 t['hatafsegolwidehebrew'] = 0x05B1;
41786 t['hbar'] = 0x0127;
41787 t['hbopomofo'] = 0x310F;
41788 t['hbrevebelow'] = 0x1E2B;
41789 t['hcedilla'] = 0x1E29;
41790 t['hcircle'] = 0x24D7;
41791 t['hcircumflex'] = 0x0125;
41792 t['hdieresis'] = 0x1E27;
41793 t['hdotaccent'] = 0x1E23;
41794 t['hdotbelow'] = 0x1E25;
41795 t['he'] = 0x05D4;
41796 t['heart'] = 0x2665;
41797 t['heartsuitblack'] = 0x2665;
41798 t['heartsuitwhite'] = 0x2661;
41799 t['hedagesh'] = 0xFB34;
41800 t['hedageshhebrew'] = 0xFB34;
41801 t['hehaltonearabic'] = 0x06C1;
41802 t['heharabic'] = 0x0647;
41803 t['hehebrew'] = 0x05D4;
41804 t['hehfinalaltonearabic'] = 0xFBA7;
41805 t['hehfinalalttwoarabic'] = 0xFEEA;
41806 t['hehfinalarabic'] = 0xFEEA;
41807 t['hehhamzaabovefinalarabic'] = 0xFBA5;
41808 t['hehhamzaaboveisolatedarabic'] = 0xFBA4;
41809 t['hehinitialaltonearabic'] = 0xFBA8;
41810 t['hehinitialarabic'] = 0xFEEB;
41811 t['hehiragana'] = 0x3078;
41812 t['hehmedialaltonearabic'] = 0xFBA9;
41813 t['hehmedialarabic'] = 0xFEEC;
41814 t['heiseierasquare'] = 0x337B;
41815 t['hekatakana'] = 0x30D8;
41816 t['hekatakanahalfwidth'] = 0xFF8D;
41817 t['hekutaarusquare'] = 0x3336;
41818 t['henghook'] = 0x0267;
41819 t['herutusquare'] = 0x3339;
41820 t['het'] = 0x05D7;
41821 t['hethebrew'] = 0x05D7;
41822 t['hhook'] = 0x0266;
41823 t['hhooksuperior'] = 0x02B1;
41824 t['hieuhacirclekorean'] = 0x327B;
41825 t['hieuhaparenkorean'] = 0x321B;
41826 t['hieuhcirclekorean'] = 0x326D;
41827 t['hieuhkorean'] = 0x314E;
41828 t['hieuhparenkorean'] = 0x320D;
41829 t['hihiragana'] = 0x3072;
41830 t['hikatakana'] = 0x30D2;
41831 t['hikatakanahalfwidth'] = 0xFF8B;
41832 t['hiriq'] = 0x05B4;
41833 t['hiriq14'] = 0x05B4;
41834 t['hiriq21'] = 0x05B4;
41835 t['hiriq2d'] = 0x05B4;
41836 t['hiriqhebrew'] = 0x05B4;
41837 t['hiriqnarrowhebrew'] = 0x05B4;
41838 t['hiriqquarterhebrew'] = 0x05B4;
41839 t['hiriqwidehebrew'] = 0x05B4;
41840 t['hlinebelow'] = 0x1E96;
41841 t['hmonospace'] = 0xFF48;
41842 t['hoarmenian'] = 0x0570;
41843 t['hohipthai'] = 0x0E2B;
41844 t['hohiragana'] = 0x307B;
41845 t['hokatakana'] = 0x30DB;
41846 t['hokatakanahalfwidth'] = 0xFF8E;
41847 t['holam'] = 0x05B9;
41848 t['holam19'] = 0x05B9;
41849 t['holam26'] = 0x05B9;
41850 t['holam32'] = 0x05B9;
41851 t['holamhebrew'] = 0x05B9;
41852 t['holamnarrowhebrew'] = 0x05B9;
41853 t['holamquarterhebrew'] = 0x05B9;
41854 t['holamwidehebrew'] = 0x05B9;
41855 t['honokhukthai'] = 0x0E2E;
41856 t['hookabovecomb'] = 0x0309;
41857 t['hookcmb'] = 0x0309;
41858 t['hookpalatalizedbelowcmb'] = 0x0321;
41859 t['hookretroflexbelowcmb'] = 0x0322;
41860 t['hoonsquare'] = 0x3342;
41861 t['horicoptic'] = 0x03E9;
41862 t['horizontalbar'] = 0x2015;
41863 t['horncmb'] = 0x031B;
41864 t['hotsprings'] = 0x2668;
41865 t['house'] = 0x2302;
41866 t['hparen'] = 0x24A3;
41867 t['hsuperior'] = 0x02B0;
41868 t['hturned'] = 0x0265;
41869 t['huhiragana'] = 0x3075;
41870 t['huiitosquare'] = 0x3333;
41871 t['hukatakana'] = 0x30D5;
41872 t['hukatakanahalfwidth'] = 0xFF8C;
41873 t['hungarumlaut'] = 0x02DD;
41874 t['hungarumlautcmb'] = 0x030B;
41875 t['hv'] = 0x0195;
41876 t['hyphen'] = 0x002D;
41877 t['hypheninferior'] = 0xF6E5;
41878 t['hyphenmonospace'] = 0xFF0D;
41879 t['hyphensmall'] = 0xFE63;
41880 t['hyphensuperior'] = 0xF6E6;
41881 t['hyphentwo'] = 0x2010;
41882 t['i'] = 0x0069;
41883 t['iacute'] = 0x00ED;
41884 t['iacyrillic'] = 0x044F;
41885 t['ibengali'] = 0x0987;
41886 t['ibopomofo'] = 0x3127;
41887 t['ibreve'] = 0x012D;
41888 t['icaron'] = 0x01D0;
41889 t['icircle'] = 0x24D8;
41890 t['icircumflex'] = 0x00EE;
41891 t['icyrillic'] = 0x0456;
41892 t['idblgrave'] = 0x0209;
41893 t['ideographearthcircle'] = 0x328F;
41894 t['ideographfirecircle'] = 0x328B;
41895 t['ideographicallianceparen'] = 0x323F;
41896 t['ideographiccallparen'] = 0x323A;
41897 t['ideographiccentrecircle'] = 0x32A5;
41898 t['ideographicclose'] = 0x3006;
41899 t['ideographiccomma'] = 0x3001;
41900 t['ideographiccommaleft'] = 0xFF64;
41901 t['ideographiccongratulationparen'] = 0x3237;
41902 t['ideographiccorrectcircle'] = 0x32A3;
41903 t['ideographicearthparen'] = 0x322F;
41904 t['ideographicenterpriseparen'] = 0x323D;
41905 t['ideographicexcellentcircle'] = 0x329D;
41906 t['ideographicfestivalparen'] = 0x3240;
41907 t['ideographicfinancialcircle'] = 0x3296;
41908 t['ideographicfinancialparen'] = 0x3236;
41909 t['ideographicfireparen'] = 0x322B;
41910 t['ideographichaveparen'] = 0x3232;
41911 t['ideographichighcircle'] = 0x32A4;
41912 t['ideographiciterationmark'] = 0x3005;
41913 t['ideographiclaborcircle'] = 0x3298;
41914 t['ideographiclaborparen'] = 0x3238;
41915 t['ideographicleftcircle'] = 0x32A7;
41916 t['ideographiclowcircle'] = 0x32A6;
41917 t['ideographicmedicinecircle'] = 0x32A9;
41918 t['ideographicmetalparen'] = 0x322E;
41919 t['ideographicmoonparen'] = 0x322A;
41920 t['ideographicnameparen'] = 0x3234;
41921 t['ideographicperiod'] = 0x3002;
41922 t['ideographicprintcircle'] = 0x329E;
41923 t['ideographicreachparen'] = 0x3243;
41924 t['ideographicrepresentparen'] = 0x3239;
41925 t['ideographicresourceparen'] = 0x323E;
41926 t['ideographicrightcircle'] = 0x32A8;
41927 t['ideographicsecretcircle'] = 0x3299;
41928 t['ideographicselfparen'] = 0x3242;
41929 t['ideographicsocietyparen'] = 0x3233;
41930 t['ideographicspace'] = 0x3000;
41931 t['ideographicspecialparen'] = 0x3235;
41932 t['ideographicstockparen'] = 0x3231;
41933 t['ideographicstudyparen'] = 0x323B;
41934 t['ideographicsunparen'] = 0x3230;
41935 t['ideographicsuperviseparen'] = 0x323C;
41936 t['ideographicwaterparen'] = 0x322C;
41937 t['ideographicwoodparen'] = 0x322D;
41938 t['ideographiczero'] = 0x3007;
41939 t['ideographmetalcircle'] = 0x328E;
41940 t['ideographmooncircle'] = 0x328A;
41941 t['ideographnamecircle'] = 0x3294;
41942 t['ideographsuncircle'] = 0x3290;
41943 t['ideographwatercircle'] = 0x328C;
41944 t['ideographwoodcircle'] = 0x328D;
41945 t['ideva'] = 0x0907;
41946 t['idieresis'] = 0x00EF;
41947 t['idieresisacute'] = 0x1E2F;
41948 t['idieresiscyrillic'] = 0x04E5;
41949 t['idotbelow'] = 0x1ECB;
41950 t['iebrevecyrillic'] = 0x04D7;
41951 t['iecyrillic'] = 0x0435;
41952 t['ieungacirclekorean'] = 0x3275;
41953 t['ieungaparenkorean'] = 0x3215;
41954 t['ieungcirclekorean'] = 0x3267;
41955 t['ieungkorean'] = 0x3147;
41956 t['ieungparenkorean'] = 0x3207;
41957 t['igrave'] = 0x00EC;
41958 t['igujarati'] = 0x0A87;
41959 t['igurmukhi'] = 0x0A07;
41960 t['ihiragana'] = 0x3044;
41961 t['ihookabove'] = 0x1EC9;
41962 t['iibengali'] = 0x0988;
41963 t['iicyrillic'] = 0x0438;
41964 t['iideva'] = 0x0908;
41965 t['iigujarati'] = 0x0A88;
41966 t['iigurmukhi'] = 0x0A08;
41967 t['iimatragurmukhi'] = 0x0A40;
41968 t['iinvertedbreve'] = 0x020B;
41969 t['iishortcyrillic'] = 0x0439;
41970 t['iivowelsignbengali'] = 0x09C0;
41971 t['iivowelsigndeva'] = 0x0940;
41972 t['iivowelsigngujarati'] = 0x0AC0;
41973 t['ij'] = 0x0133;
41974 t['ikatakana'] = 0x30A4;
41975 t['ikatakanahalfwidth'] = 0xFF72;
41976 t['ikorean'] = 0x3163;
41977 t['ilde'] = 0x02DC;
41978 t['iluyhebrew'] = 0x05AC;
41979 t['imacron'] = 0x012B;
41980 t['imacroncyrillic'] = 0x04E3;
41981 t['imageorapproximatelyequal'] = 0x2253;
41982 t['imatragurmukhi'] = 0x0A3F;
41983 t['imonospace'] = 0xFF49;
41984 t['increment'] = 0x2206;
41985 t['infinity'] = 0x221E;
41986 t['iniarmenian'] = 0x056B;
41987 t['integral'] = 0x222B;
41988 t['integralbottom'] = 0x2321;
41989 t['integralbt'] = 0x2321;
41990 t['integralex'] = 0xF8F5;
41991 t['integraltop'] = 0x2320;
41992 t['integraltp'] = 0x2320;
41993 t['intersection'] = 0x2229;
41994 t['intisquare'] = 0x3305;
41995 t['invbullet'] = 0x25D8;
41996 t['invcircle'] = 0x25D9;
41997 t['invsmileface'] = 0x263B;
41998 t['iocyrillic'] = 0x0451;
41999 t['iogonek'] = 0x012F;
42000 t['iota'] = 0x03B9;
42001 t['iotadieresis'] = 0x03CA;
42002 t['iotadieresistonos'] = 0x0390;
42003 t['iotalatin'] = 0x0269;
42004 t['iotatonos'] = 0x03AF;
42005 t['iparen'] = 0x24A4;
42006 t['irigurmukhi'] = 0x0A72;
42007 t['ismallhiragana'] = 0x3043;
42008 t['ismallkatakana'] = 0x30A3;
42009 t['ismallkatakanahalfwidth'] = 0xFF68;
42010 t['issharbengali'] = 0x09FA;
42011 t['istroke'] = 0x0268;
42012 t['isuperior'] = 0xF6ED;
42013 t['iterationhiragana'] = 0x309D;
42014 t['iterationkatakana'] = 0x30FD;
42015 t['itilde'] = 0x0129;
42016 t['itildebelow'] = 0x1E2D;
42017 t['iubopomofo'] = 0x3129;
42018 t['iucyrillic'] = 0x044E;
42019 t['ivowelsignbengali'] = 0x09BF;
42020 t['ivowelsigndeva'] = 0x093F;
42021 t['ivowelsigngujarati'] = 0x0ABF;
42022 t['izhitsacyrillic'] = 0x0475;
42023 t['izhitsadblgravecyrillic'] = 0x0477;
42024 t['j'] = 0x006A;
42025 t['jaarmenian'] = 0x0571;
42026 t['jabengali'] = 0x099C;
42027 t['jadeva'] = 0x091C;
42028 t['jagujarati'] = 0x0A9C;
42029 t['jagurmukhi'] = 0x0A1C;
42030 t['jbopomofo'] = 0x3110;
42031 t['jcaron'] = 0x01F0;
42032 t['jcircle'] = 0x24D9;
42033 t['jcircumflex'] = 0x0135;
42034 t['jcrossedtail'] = 0x029D;
42035 t['jdotlessstroke'] = 0x025F;
42036 t['jecyrillic'] = 0x0458;
42037 t['jeemarabic'] = 0x062C;
42038 t['jeemfinalarabic'] = 0xFE9E;
42039 t['jeeminitialarabic'] = 0xFE9F;
42040 t['jeemmedialarabic'] = 0xFEA0;
42041 t['jeharabic'] = 0x0698;
42042 t['jehfinalarabic'] = 0xFB8B;
42043 t['jhabengali'] = 0x099D;
42044 t['jhadeva'] = 0x091D;
42045 t['jhagujarati'] = 0x0A9D;
42046 t['jhagurmukhi'] = 0x0A1D;
42047 t['jheharmenian'] = 0x057B;
42048 t['jis'] = 0x3004;
42049 t['jmonospace'] = 0xFF4A;
42050 t['jparen'] = 0x24A5;
42051 t['jsuperior'] = 0x02B2;
42052 t['k'] = 0x006B;
42053 t['kabashkircyrillic'] = 0x04A1;
42054 t['kabengali'] = 0x0995;
42055 t['kacute'] = 0x1E31;
42056 t['kacyrillic'] = 0x043A;
42057 t['kadescendercyrillic'] = 0x049B;
42058 t['kadeva'] = 0x0915;
42059 t['kaf'] = 0x05DB;
42060 t['kafarabic'] = 0x0643;
42061 t['kafdagesh'] = 0xFB3B;
42062 t['kafdageshhebrew'] = 0xFB3B;
42063 t['kaffinalarabic'] = 0xFEDA;
42064 t['kafhebrew'] = 0x05DB;
42065 t['kafinitialarabic'] = 0xFEDB;
42066 t['kafmedialarabic'] = 0xFEDC;
42067 t['kafrafehebrew'] = 0xFB4D;
42068 t['kagujarati'] = 0x0A95;
42069 t['kagurmukhi'] = 0x0A15;
42070 t['kahiragana'] = 0x304B;
42071 t['kahookcyrillic'] = 0x04C4;
42072 t['kakatakana'] = 0x30AB;
42073 t['kakatakanahalfwidth'] = 0xFF76;
42074 t['kappa'] = 0x03BA;
42075 t['kappasymbolgreek'] = 0x03F0;
42076 t['kapyeounmieumkorean'] = 0x3171;
42077 t['kapyeounphieuphkorean'] = 0x3184;
42078 t['kapyeounpieupkorean'] = 0x3178;
42079 t['kapyeounssangpieupkorean'] = 0x3179;
42080 t['karoriisquare'] = 0x330D;
42081 t['kashidaautoarabic'] = 0x0640;
42082 t['kashidaautonosidebearingarabic'] = 0x0640;
42083 t['kasmallkatakana'] = 0x30F5;
42084 t['kasquare'] = 0x3384;
42085 t['kasraarabic'] = 0x0650;
42086 t['kasratanarabic'] = 0x064D;
42087 t['kastrokecyrillic'] = 0x049F;
42088 t['katahiraprolongmarkhalfwidth'] = 0xFF70;
42089 t['kaverticalstrokecyrillic'] = 0x049D;
42090 t['kbopomofo'] = 0x310E;
42091 t['kcalsquare'] = 0x3389;
42092 t['kcaron'] = 0x01E9;
42093 t['kcedilla'] = 0x0137;
42094 t['kcircle'] = 0x24DA;
42095 t['kcommaaccent'] = 0x0137;
42096 t['kdotbelow'] = 0x1E33;
42097 t['keharmenian'] = 0x0584;
42098 t['kehiragana'] = 0x3051;
42099 t['kekatakana'] = 0x30B1;
42100 t['kekatakanahalfwidth'] = 0xFF79;
42101 t['kenarmenian'] = 0x056F;
42102 t['kesmallkatakana'] = 0x30F6;
42103 t['kgreenlandic'] = 0x0138;
42104 t['khabengali'] = 0x0996;
42105 t['khacyrillic'] = 0x0445;
42106 t['khadeva'] = 0x0916;
42107 t['khagujarati'] = 0x0A96;
42108 t['khagurmukhi'] = 0x0A16;
42109 t['khaharabic'] = 0x062E;
42110 t['khahfinalarabic'] = 0xFEA6;
42111 t['khahinitialarabic'] = 0xFEA7;
42112 t['khahmedialarabic'] = 0xFEA8;
42113 t['kheicoptic'] = 0x03E7;
42114 t['khhadeva'] = 0x0959;
42115 t['khhagurmukhi'] = 0x0A59;
42116 t['khieukhacirclekorean'] = 0x3278;
42117 t['khieukhaparenkorean'] = 0x3218;
42118 t['khieukhcirclekorean'] = 0x326A;
42119 t['khieukhkorean'] = 0x314B;
42120 t['khieukhparenkorean'] = 0x320A;
42121 t['khokhaithai'] = 0x0E02;
42122 t['khokhonthai'] = 0x0E05;
42123 t['khokhuatthai'] = 0x0E03;
42124 t['khokhwaithai'] = 0x0E04;
42125 t['khomutthai'] = 0x0E5B;
42126 t['khook'] = 0x0199;
42127 t['khorakhangthai'] = 0x0E06;
42128 t['khzsquare'] = 0x3391;
42129 t['kihiragana'] = 0x304D;
42130 t['kikatakana'] = 0x30AD;
42131 t['kikatakanahalfwidth'] = 0xFF77;
42132 t['kiroguramusquare'] = 0x3315;
42133 t['kiromeetorusquare'] = 0x3316;
42134 t['kirosquare'] = 0x3314;
42135 t['kiyeokacirclekorean'] = 0x326E;
42136 t['kiyeokaparenkorean'] = 0x320E;
42137 t['kiyeokcirclekorean'] = 0x3260;
42138 t['kiyeokkorean'] = 0x3131;
42139 t['kiyeokparenkorean'] = 0x3200;
42140 t['kiyeoksioskorean'] = 0x3133;
42141 t['kjecyrillic'] = 0x045C;
42142 t['klinebelow'] = 0x1E35;
42143 t['klsquare'] = 0x3398;
42144 t['kmcubedsquare'] = 0x33A6;
42145 t['kmonospace'] = 0xFF4B;
42146 t['kmsquaredsquare'] = 0x33A2;
42147 t['kohiragana'] = 0x3053;
42148 t['kohmsquare'] = 0x33C0;
42149 t['kokaithai'] = 0x0E01;
42150 t['kokatakana'] = 0x30B3;
42151 t['kokatakanahalfwidth'] = 0xFF7A;
42152 t['kooposquare'] = 0x331E;
42153 t['koppacyrillic'] = 0x0481;
42154 t['koreanstandardsymbol'] = 0x327F;
42155 t['koroniscmb'] = 0x0343;
42156 t['kparen'] = 0x24A6;
42157 t['kpasquare'] = 0x33AA;
42158 t['ksicyrillic'] = 0x046F;
42159 t['ktsquare'] = 0x33CF;
42160 t['kturned'] = 0x029E;
42161 t['kuhiragana'] = 0x304F;
42162 t['kukatakana'] = 0x30AF;
42163 t['kukatakanahalfwidth'] = 0xFF78;
42164 t['kvsquare'] = 0x33B8;
42165 t['kwsquare'] = 0x33BE;
42166 t['l'] = 0x006C;
42167 t['labengali'] = 0x09B2;
42168 t['lacute'] = 0x013A;
42169 t['ladeva'] = 0x0932;
42170 t['lagujarati'] = 0x0AB2;
42171 t['lagurmukhi'] = 0x0A32;
42172 t['lakkhangyaothai'] = 0x0E45;
42173 t['lamaleffinalarabic'] = 0xFEFC;
42174 t['lamalefhamzaabovefinalarabic'] = 0xFEF8;
42175 t['lamalefhamzaaboveisolatedarabic'] = 0xFEF7;
42176 t['lamalefhamzabelowfinalarabic'] = 0xFEFA;
42177 t['lamalefhamzabelowisolatedarabic'] = 0xFEF9;
42178 t['lamalefisolatedarabic'] = 0xFEFB;
42179 t['lamalefmaddaabovefinalarabic'] = 0xFEF6;
42180 t['lamalefmaddaaboveisolatedarabic'] = 0xFEF5;
42181 t['lamarabic'] = 0x0644;
42182 t['lambda'] = 0x03BB;
42183 t['lambdastroke'] = 0x019B;
42184 t['lamed'] = 0x05DC;
42185 t['lameddagesh'] = 0xFB3C;
42186 t['lameddageshhebrew'] = 0xFB3C;
42187 t['lamedhebrew'] = 0x05DC;
42188 t['lamfinalarabic'] = 0xFEDE;
42189 t['lamhahinitialarabic'] = 0xFCCA;
42190 t['laminitialarabic'] = 0xFEDF;
42191 t['lamjeeminitialarabic'] = 0xFCC9;
42192 t['lamkhahinitialarabic'] = 0xFCCB;
42193 t['lamlamhehisolatedarabic'] = 0xFDF2;
42194 t['lammedialarabic'] = 0xFEE0;
42195 t['lammeemhahinitialarabic'] = 0xFD88;
42196 t['lammeeminitialarabic'] = 0xFCCC;
42197 t['largecircle'] = 0x25EF;
42198 t['lbar'] = 0x019A;
42199 t['lbelt'] = 0x026C;
42200 t['lbopomofo'] = 0x310C;
42201 t['lcaron'] = 0x013E;
42202 t['lcedilla'] = 0x013C;
42203 t['lcircle'] = 0x24DB;
42204 t['lcircumflexbelow'] = 0x1E3D;
42205 t['lcommaaccent'] = 0x013C;
42206 t['ldot'] = 0x0140;
42207 t['ldotaccent'] = 0x0140;
42208 t['ldotbelow'] = 0x1E37;
42209 t['ldotbelowmacron'] = 0x1E39;
42210 t['leftangleabovecmb'] = 0x031A;
42211 t['lefttackbelowcmb'] = 0x0318;
42212 t['less'] = 0x003C;
42213 t['lessequal'] = 0x2264;
42214 t['lessequalorgreater'] = 0x22DA;
42215 t['lessmonospace'] = 0xFF1C;
42216 t['lessorequivalent'] = 0x2272;
42217 t['lessorgreater'] = 0x2276;
42218 t['lessoverequal'] = 0x2266;
42219 t['lesssmall'] = 0xFE64;
42220 t['lezh'] = 0x026E;
42221 t['lfblock'] = 0x258C;
42222 t['lhookretroflex'] = 0x026D;
42223 t['lira'] = 0x20A4;
42224 t['liwnarmenian'] = 0x056C;
42225 t['lj'] = 0x01C9;
42226 t['ljecyrillic'] = 0x0459;
42227 t['ll'] = 0xF6C0;
42228 t['lladeva'] = 0x0933;
42229 t['llagujarati'] = 0x0AB3;
42230 t['llinebelow'] = 0x1E3B;
42231 t['llladeva'] = 0x0934;
42232 t['llvocalicbengali'] = 0x09E1;
42233 t['llvocalicdeva'] = 0x0961;
42234 t['llvocalicvowelsignbengali'] = 0x09E3;
42235 t['llvocalicvowelsigndeva'] = 0x0963;
42236 t['lmiddletilde'] = 0x026B;
42237 t['lmonospace'] = 0xFF4C;
42238 t['lmsquare'] = 0x33D0;
42239 t['lochulathai'] = 0x0E2C;
42240 t['logicaland'] = 0x2227;
42241 t['logicalnot'] = 0x00AC;
42242 t['logicalnotreversed'] = 0x2310;
42243 t['logicalor'] = 0x2228;
42244 t['lolingthai'] = 0x0E25;
42245 t['longs'] = 0x017F;
42246 t['lowlinecenterline'] = 0xFE4E;
42247 t['lowlinecmb'] = 0x0332;
42248 t['lowlinedashed'] = 0xFE4D;
42249 t['lozenge'] = 0x25CA;
42250 t['lparen'] = 0x24A7;
42251 t['lslash'] = 0x0142;
42252 t['lsquare'] = 0x2113;
42253 t['lsuperior'] = 0xF6EE;
42254 t['ltshade'] = 0x2591;
42255 t['luthai'] = 0x0E26;
42256 t['lvocalicbengali'] = 0x098C;
42257 t['lvocalicdeva'] = 0x090C;
42258 t['lvocalicvowelsignbengali'] = 0x09E2;
42259 t['lvocalicvowelsigndeva'] = 0x0962;
42260 t['lxsquare'] = 0x33D3;
42261 t['m'] = 0x006D;
42262 t['mabengali'] = 0x09AE;
42263 t['macron'] = 0x00AF;
42264 t['macronbelowcmb'] = 0x0331;
42265 t['macroncmb'] = 0x0304;
42266 t['macronlowmod'] = 0x02CD;
42267 t['macronmonospace'] = 0xFFE3;
42268 t['macute'] = 0x1E3F;
42269 t['madeva'] = 0x092E;
42270 t['magujarati'] = 0x0AAE;
42271 t['magurmukhi'] = 0x0A2E;
42272 t['mahapakhhebrew'] = 0x05A4;
42273 t['mahapakhlefthebrew'] = 0x05A4;
42274 t['mahiragana'] = 0x307E;
42275 t['maichattawalowleftthai'] = 0xF895;
42276 t['maichattawalowrightthai'] = 0xF894;
42277 t['maichattawathai'] = 0x0E4B;
42278 t['maichattawaupperleftthai'] = 0xF893;
42279 t['maieklowleftthai'] = 0xF88C;
42280 t['maieklowrightthai'] = 0xF88B;
42281 t['maiekthai'] = 0x0E48;
42282 t['maiekupperleftthai'] = 0xF88A;
42283 t['maihanakatleftthai'] = 0xF884;
42284 t['maihanakatthai'] = 0x0E31;
42285 t['maitaikhuleftthai'] = 0xF889;
42286 t['maitaikhuthai'] = 0x0E47;
42287 t['maitholowleftthai'] = 0xF88F;
42288 t['maitholowrightthai'] = 0xF88E;
42289 t['maithothai'] = 0x0E49;
42290 t['maithoupperleftthai'] = 0xF88D;
42291 t['maitrilowleftthai'] = 0xF892;
42292 t['maitrilowrightthai'] = 0xF891;
42293 t['maitrithai'] = 0x0E4A;
42294 t['maitriupperleftthai'] = 0xF890;
42295 t['maiyamokthai'] = 0x0E46;
42296 t['makatakana'] = 0x30DE;
42297 t['makatakanahalfwidth'] = 0xFF8F;
42298 t['male'] = 0x2642;
42299 t['mansyonsquare'] = 0x3347;
42300 t['maqafhebrew'] = 0x05BE;
42301 t['mars'] = 0x2642;
42302 t['masoracirclehebrew'] = 0x05AF;
42303 t['masquare'] = 0x3383;
42304 t['mbopomofo'] = 0x3107;
42305 t['mbsquare'] = 0x33D4;
42306 t['mcircle'] = 0x24DC;
42307 t['mcubedsquare'] = 0x33A5;
42308 t['mdotaccent'] = 0x1E41;
42309 t['mdotbelow'] = 0x1E43;
42310 t['meemarabic'] = 0x0645;
42311 t['meemfinalarabic'] = 0xFEE2;
42312 t['meeminitialarabic'] = 0xFEE3;
42313 t['meemmedialarabic'] = 0xFEE4;
42314 t['meemmeeminitialarabic'] = 0xFCD1;
42315 t['meemmeemisolatedarabic'] = 0xFC48;
42316 t['meetorusquare'] = 0x334D;
42317 t['mehiragana'] = 0x3081;
42318 t['meizierasquare'] = 0x337E;
42319 t['mekatakana'] = 0x30E1;
42320 t['mekatakanahalfwidth'] = 0xFF92;
42321 t['mem'] = 0x05DE;
42322 t['memdagesh'] = 0xFB3E;
42323 t['memdageshhebrew'] = 0xFB3E;
42324 t['memhebrew'] = 0x05DE;
42325 t['menarmenian'] = 0x0574;
42326 t['merkhahebrew'] = 0x05A5;
42327 t['merkhakefulahebrew'] = 0x05A6;
42328 t['merkhakefulalefthebrew'] = 0x05A6;
42329 t['merkhalefthebrew'] = 0x05A5;
42330 t['mhook'] = 0x0271;
42331 t['mhzsquare'] = 0x3392;
42332 t['middledotkatakanahalfwidth'] = 0xFF65;
42333 t['middot'] = 0x00B7;
42334 t['mieumacirclekorean'] = 0x3272;
42335 t['mieumaparenkorean'] = 0x3212;
42336 t['mieumcirclekorean'] = 0x3264;
42337 t['mieumkorean'] = 0x3141;
42338 t['mieumpansioskorean'] = 0x3170;
42339 t['mieumparenkorean'] = 0x3204;
42340 t['mieumpieupkorean'] = 0x316E;
42341 t['mieumsioskorean'] = 0x316F;
42342 t['mihiragana'] = 0x307F;
42343 t['mikatakana'] = 0x30DF;
42344 t['mikatakanahalfwidth'] = 0xFF90;
42345 t['minus'] = 0x2212;
42346 t['minusbelowcmb'] = 0x0320;
42347 t['minuscircle'] = 0x2296;
42348 t['minusmod'] = 0x02D7;
42349 t['minusplus'] = 0x2213;
42350 t['minute'] = 0x2032;
42351 t['miribaarusquare'] = 0x334A;
42352 t['mirisquare'] = 0x3349;
42353 t['mlonglegturned'] = 0x0270;
42354 t['mlsquare'] = 0x3396;
42355 t['mmcubedsquare'] = 0x33A3;
42356 t['mmonospace'] = 0xFF4D;
42357 t['mmsquaredsquare'] = 0x339F;
42358 t['mohiragana'] = 0x3082;
42359 t['mohmsquare'] = 0x33C1;
42360 t['mokatakana'] = 0x30E2;
42361 t['mokatakanahalfwidth'] = 0xFF93;
42362 t['molsquare'] = 0x33D6;
42363 t['momathai'] = 0x0E21;
42364 t['moverssquare'] = 0x33A7;
42365 t['moverssquaredsquare'] = 0x33A8;
42366 t['mparen'] = 0x24A8;
42367 t['mpasquare'] = 0x33AB;
42368 t['mssquare'] = 0x33B3;
42369 t['msuperior'] = 0xF6EF;
42370 t['mturned'] = 0x026F;
42371 t['mu'] = 0x00B5;
42372 t['mu1'] = 0x00B5;
42373 t['muasquare'] = 0x3382;
42374 t['muchgreater'] = 0x226B;
42375 t['muchless'] = 0x226A;
42376 t['mufsquare'] = 0x338C;
42377 t['mugreek'] = 0x03BC;
42378 t['mugsquare'] = 0x338D;
42379 t['muhiragana'] = 0x3080;
42380 t['mukatakana'] = 0x30E0;
42381 t['mukatakanahalfwidth'] = 0xFF91;
42382 t['mulsquare'] = 0x3395;
42383 t['multiply'] = 0x00D7;
42384 t['mumsquare'] = 0x339B;
42385 t['munahhebrew'] = 0x05A3;
42386 t['munahlefthebrew'] = 0x05A3;
42387 t['musicalnote'] = 0x266A;
42388 t['musicalnotedbl'] = 0x266B;
42389 t['musicflatsign'] = 0x266D;
42390 t['musicsharpsign'] = 0x266F;
42391 t['mussquare'] = 0x33B2;
42392 t['muvsquare'] = 0x33B6;
42393 t['muwsquare'] = 0x33BC;
42394 t['mvmegasquare'] = 0x33B9;
42395 t['mvsquare'] = 0x33B7;
42396 t['mwmegasquare'] = 0x33BF;
42397 t['mwsquare'] = 0x33BD;
42398 t['n'] = 0x006E;
42399 t['nabengali'] = 0x09A8;
42400 t['nabla'] = 0x2207;
42401 t['nacute'] = 0x0144;
42402 t['nadeva'] = 0x0928;
42403 t['nagujarati'] = 0x0AA8;
42404 t['nagurmukhi'] = 0x0A28;
42405 t['nahiragana'] = 0x306A;
42406 t['nakatakana'] = 0x30CA;
42407 t['nakatakanahalfwidth'] = 0xFF85;
42408 t['napostrophe'] = 0x0149;
42409 t['nasquare'] = 0x3381;
42410 t['nbopomofo'] = 0x310B;
42411 t['nbspace'] = 0x00A0;
42412 t['ncaron'] = 0x0148;
42413 t['ncedilla'] = 0x0146;
42414 t['ncircle'] = 0x24DD;
42415 t['ncircumflexbelow'] = 0x1E4B;
42416 t['ncommaaccent'] = 0x0146;
42417 t['ndotaccent'] = 0x1E45;
42418 t['ndotbelow'] = 0x1E47;
42419 t['nehiragana'] = 0x306D;
42420 t['nekatakana'] = 0x30CD;
42421 t['nekatakanahalfwidth'] = 0xFF88;
42422 t['newsheqelsign'] = 0x20AA;
42423 t['nfsquare'] = 0x338B;
42424 t['ngabengali'] = 0x0999;
42425 t['ngadeva'] = 0x0919;
42426 t['ngagujarati'] = 0x0A99;
42427 t['ngagurmukhi'] = 0x0A19;
42428 t['ngonguthai'] = 0x0E07;
42429 t['nhiragana'] = 0x3093;
42430 t['nhookleft'] = 0x0272;
42431 t['nhookretroflex'] = 0x0273;
42432 t['nieunacirclekorean'] = 0x326F;
42433 t['nieunaparenkorean'] = 0x320F;
42434 t['nieuncieuckorean'] = 0x3135;
42435 t['nieuncirclekorean'] = 0x3261;
42436 t['nieunhieuhkorean'] = 0x3136;
42437 t['nieunkorean'] = 0x3134;
42438 t['nieunpansioskorean'] = 0x3168;
42439 t['nieunparenkorean'] = 0x3201;
42440 t['nieunsioskorean'] = 0x3167;
42441 t['nieuntikeutkorean'] = 0x3166;
42442 t['nihiragana'] = 0x306B;
42443 t['nikatakana'] = 0x30CB;
42444 t['nikatakanahalfwidth'] = 0xFF86;
42445 t['nikhahitleftthai'] = 0xF899;
42446 t['nikhahitthai'] = 0x0E4D;
42447 t['nine'] = 0x0039;
42448 t['ninearabic'] = 0x0669;
42449 t['ninebengali'] = 0x09EF;
42450 t['ninecircle'] = 0x2468;
42451 t['ninecircleinversesansserif'] = 0x2792;
42452 t['ninedeva'] = 0x096F;
42453 t['ninegujarati'] = 0x0AEF;
42454 t['ninegurmukhi'] = 0x0A6F;
42455 t['ninehackarabic'] = 0x0669;
42456 t['ninehangzhou'] = 0x3029;
42457 t['nineideographicparen'] = 0x3228;
42458 t['nineinferior'] = 0x2089;
42459 t['ninemonospace'] = 0xFF19;
42460 t['nineoldstyle'] = 0xF739;
42461 t['nineparen'] = 0x247C;
42462 t['nineperiod'] = 0x2490;
42463 t['ninepersian'] = 0x06F9;
42464 t['nineroman'] = 0x2178;
42465 t['ninesuperior'] = 0x2079;
42466 t['nineteencircle'] = 0x2472;
42467 t['nineteenparen'] = 0x2486;
42468 t['nineteenperiod'] = 0x249A;
42469 t['ninethai'] = 0x0E59;
42470 t['nj'] = 0x01CC;
42471 t['njecyrillic'] = 0x045A;
42472 t['nkatakana'] = 0x30F3;
42473 t['nkatakanahalfwidth'] = 0xFF9D;
42474 t['nlegrightlong'] = 0x019E;
42475 t['nlinebelow'] = 0x1E49;
42476 t['nmonospace'] = 0xFF4E;
42477 t['nmsquare'] = 0x339A;
42478 t['nnabengali'] = 0x09A3;
42479 t['nnadeva'] = 0x0923;
42480 t['nnagujarati'] = 0x0AA3;
42481 t['nnagurmukhi'] = 0x0A23;
42482 t['nnnadeva'] = 0x0929;
42483 t['nohiragana'] = 0x306E;
42484 t['nokatakana'] = 0x30CE;
42485 t['nokatakanahalfwidth'] = 0xFF89;
42486 t['nonbreakingspace'] = 0x00A0;
42487 t['nonenthai'] = 0x0E13;
42488 t['nonuthai'] = 0x0E19;
42489 t['noonarabic'] = 0x0646;
42490 t['noonfinalarabic'] = 0xFEE6;
42491 t['noonghunnaarabic'] = 0x06BA;
42492 t['noonghunnafinalarabic'] = 0xFB9F;
42493 t['nooninitialarabic'] = 0xFEE7;
42494 t['noonjeeminitialarabic'] = 0xFCD2;
42495 t['noonjeemisolatedarabic'] = 0xFC4B;
42496 t['noonmedialarabic'] = 0xFEE8;
42497 t['noonmeeminitialarabic'] = 0xFCD5;
42498 t['noonmeemisolatedarabic'] = 0xFC4E;
42499 t['noonnoonfinalarabic'] = 0xFC8D;
42500 t['notcontains'] = 0x220C;
42501 t['notelement'] = 0x2209;
42502 t['notelementof'] = 0x2209;
42503 t['notequal'] = 0x2260;
42504 t['notgreater'] = 0x226F;
42505 t['notgreaternorequal'] = 0x2271;
42506 t['notgreaternorless'] = 0x2279;
42507 t['notidentical'] = 0x2262;
42508 t['notless'] = 0x226E;
42509 t['notlessnorequal'] = 0x2270;
42510 t['notparallel'] = 0x2226;
42511 t['notprecedes'] = 0x2280;
42512 t['notsubset'] = 0x2284;
42513 t['notsucceeds'] = 0x2281;
42514 t['notsuperset'] = 0x2285;
42515 t['nowarmenian'] = 0x0576;
42516 t['nparen'] = 0x24A9;
42517 t['nssquare'] = 0x33B1;
42518 t['nsuperior'] = 0x207F;
42519 t['ntilde'] = 0x00F1;
42520 t['nu'] = 0x03BD;
42521 t['nuhiragana'] = 0x306C;
42522 t['nukatakana'] = 0x30CC;
42523 t['nukatakanahalfwidth'] = 0xFF87;
42524 t['nuktabengali'] = 0x09BC;
42525 t['nuktadeva'] = 0x093C;
42526 t['nuktagujarati'] = 0x0ABC;
42527 t['nuktagurmukhi'] = 0x0A3C;
42528 t['numbersign'] = 0x0023;
42529 t['numbersignmonospace'] = 0xFF03;
42530 t['numbersignsmall'] = 0xFE5F;
42531 t['numeralsigngreek'] = 0x0374;
42532 t['numeralsignlowergreek'] = 0x0375;
42533 t['numero'] = 0x2116;
42534 t['nun'] = 0x05E0;
42535 t['nundagesh'] = 0xFB40;
42536 t['nundageshhebrew'] = 0xFB40;
42537 t['nunhebrew'] = 0x05E0;
42538 t['nvsquare'] = 0x33B5;
42539 t['nwsquare'] = 0x33BB;
42540 t['nyabengali'] = 0x099E;
42541 t['nyadeva'] = 0x091E;
42542 t['nyagujarati'] = 0x0A9E;
42543 t['nyagurmukhi'] = 0x0A1E;
42544 t['o'] = 0x006F;
42545 t['oacute'] = 0x00F3;
42546 t['oangthai'] = 0x0E2D;
42547 t['obarred'] = 0x0275;
42548 t['obarredcyrillic'] = 0x04E9;
42549 t['obarreddieresiscyrillic'] = 0x04EB;
42550 t['obengali'] = 0x0993;
42551 t['obopomofo'] = 0x311B;
42552 t['obreve'] = 0x014F;
42553 t['ocandradeva'] = 0x0911;
42554 t['ocandragujarati'] = 0x0A91;
42555 t['ocandravowelsigndeva'] = 0x0949;
42556 t['ocandravowelsigngujarati'] = 0x0AC9;
42557 t['ocaron'] = 0x01D2;
42558 t['ocircle'] = 0x24DE;
42559 t['ocircumflex'] = 0x00F4;
42560 t['ocircumflexacute'] = 0x1ED1;
42561 t['ocircumflexdotbelow'] = 0x1ED9;
42562 t['ocircumflexgrave'] = 0x1ED3;
42563 t['ocircumflexhookabove'] = 0x1ED5;
42564 t['ocircumflextilde'] = 0x1ED7;
42565 t['ocyrillic'] = 0x043E;
42566 t['odblacute'] = 0x0151;
42567 t['odblgrave'] = 0x020D;
42568 t['odeva'] = 0x0913;
42569 t['odieresis'] = 0x00F6;
42570 t['odieresiscyrillic'] = 0x04E7;
42571 t['odotbelow'] = 0x1ECD;
42572 t['oe'] = 0x0153;
42573 t['oekorean'] = 0x315A;
42574 t['ogonek'] = 0x02DB;
42575 t['ogonekcmb'] = 0x0328;
42576 t['ograve'] = 0x00F2;
42577 t['ogujarati'] = 0x0A93;
42578 t['oharmenian'] = 0x0585;
42579 t['ohiragana'] = 0x304A;
42580 t['ohookabove'] = 0x1ECF;
42581 t['ohorn'] = 0x01A1;
42582 t['ohornacute'] = 0x1EDB;
42583 t['ohorndotbelow'] = 0x1EE3;
42584 t['ohorngrave'] = 0x1EDD;
42585 t['ohornhookabove'] = 0x1EDF;
42586 t['ohorntilde'] = 0x1EE1;
42587 t['ohungarumlaut'] = 0x0151;
42588 t['oi'] = 0x01A3;
42589 t['oinvertedbreve'] = 0x020F;
42590 t['okatakana'] = 0x30AA;
42591 t['okatakanahalfwidth'] = 0xFF75;
42592 t['okorean'] = 0x3157;
42593 t['olehebrew'] = 0x05AB;
42594 t['omacron'] = 0x014D;
42595 t['omacronacute'] = 0x1E53;
42596 t['omacrongrave'] = 0x1E51;
42597 t['omdeva'] = 0x0950;
42598 t['omega'] = 0x03C9;
42599 t['omega1'] = 0x03D6;
42600 t['omegacyrillic'] = 0x0461;
42601 t['omegalatinclosed'] = 0x0277;
42602 t['omegaroundcyrillic'] = 0x047B;
42603 t['omegatitlocyrillic'] = 0x047D;
42604 t['omegatonos'] = 0x03CE;
42605 t['omgujarati'] = 0x0AD0;
42606 t['omicron'] = 0x03BF;
42607 t['omicrontonos'] = 0x03CC;
42608 t['omonospace'] = 0xFF4F;
42609 t['one'] = 0x0031;
42610 t['onearabic'] = 0x0661;
42611 t['onebengali'] = 0x09E7;
42612 t['onecircle'] = 0x2460;
42613 t['onecircleinversesansserif'] = 0x278A;
42614 t['onedeva'] = 0x0967;
42615 t['onedotenleader'] = 0x2024;
42616 t['oneeighth'] = 0x215B;
42617 t['onefitted'] = 0xF6DC;
42618 t['onegujarati'] = 0x0AE7;
42619 t['onegurmukhi'] = 0x0A67;
42620 t['onehackarabic'] = 0x0661;
42621 t['onehalf'] = 0x00BD;
42622 t['onehangzhou'] = 0x3021;
42623 t['oneideographicparen'] = 0x3220;
42624 t['oneinferior'] = 0x2081;
42625 t['onemonospace'] = 0xFF11;
42626 t['onenumeratorbengali'] = 0x09F4;
42627 t['oneoldstyle'] = 0xF731;
42628 t['oneparen'] = 0x2474;
42629 t['oneperiod'] = 0x2488;
42630 t['onepersian'] = 0x06F1;
42631 t['onequarter'] = 0x00BC;
42632 t['oneroman'] = 0x2170;
42633 t['onesuperior'] = 0x00B9;
42634 t['onethai'] = 0x0E51;
42635 t['onethird'] = 0x2153;
42636 t['oogonek'] = 0x01EB;
42637 t['oogonekmacron'] = 0x01ED;
42638 t['oogurmukhi'] = 0x0A13;
42639 t['oomatragurmukhi'] = 0x0A4B;
42640 t['oopen'] = 0x0254;
42641 t['oparen'] = 0x24AA;
42642 t['openbullet'] = 0x25E6;
42643 t['option'] = 0x2325;
42644 t['ordfeminine'] = 0x00AA;
42645 t['ordmasculine'] = 0x00BA;
42646 t['orthogonal'] = 0x221F;
42647 t['oshortdeva'] = 0x0912;
42648 t['oshortvowelsigndeva'] = 0x094A;
42649 t['oslash'] = 0x00F8;
42650 t['oslashacute'] = 0x01FF;
42651 t['osmallhiragana'] = 0x3049;
42652 t['osmallkatakana'] = 0x30A9;
42653 t['osmallkatakanahalfwidth'] = 0xFF6B;
42654 t['ostrokeacute'] = 0x01FF;
42655 t['osuperior'] = 0xF6F0;
42656 t['otcyrillic'] = 0x047F;
42657 t['otilde'] = 0x00F5;
42658 t['otildeacute'] = 0x1E4D;
42659 t['otildedieresis'] = 0x1E4F;
42660 t['oubopomofo'] = 0x3121;
42661 t['overline'] = 0x203E;
42662 t['overlinecenterline'] = 0xFE4A;
42663 t['overlinecmb'] = 0x0305;
42664 t['overlinedashed'] = 0xFE49;
42665 t['overlinedblwavy'] = 0xFE4C;
42666 t['overlinewavy'] = 0xFE4B;
42667 t['overscore'] = 0x00AF;
42668 t['ovowelsignbengali'] = 0x09CB;
42669 t['ovowelsigndeva'] = 0x094B;
42670 t['ovowelsigngujarati'] = 0x0ACB;
42671 t['p'] = 0x0070;
42672 t['paampssquare'] = 0x3380;
42673 t['paasentosquare'] = 0x332B;
42674 t['pabengali'] = 0x09AA;
42675 t['pacute'] = 0x1E55;
42676 t['padeva'] = 0x092A;
42677 t['pagedown'] = 0x21DF;
42678 t['pageup'] = 0x21DE;
42679 t['pagujarati'] = 0x0AAA;
42680 t['pagurmukhi'] = 0x0A2A;
42681 t['pahiragana'] = 0x3071;
42682 t['paiyannoithai'] = 0x0E2F;
42683 t['pakatakana'] = 0x30D1;
42684 t['palatalizationcyrilliccmb'] = 0x0484;
42685 t['palochkacyrillic'] = 0x04C0;
42686 t['pansioskorean'] = 0x317F;
42687 t['paragraph'] = 0x00B6;
42688 t['parallel'] = 0x2225;
42689 t['parenleft'] = 0x0028;
42690 t['parenleftaltonearabic'] = 0xFD3E;
42691 t['parenleftbt'] = 0xF8ED;
42692 t['parenleftex'] = 0xF8EC;
42693 t['parenleftinferior'] = 0x208D;
42694 t['parenleftmonospace'] = 0xFF08;
42695 t['parenleftsmall'] = 0xFE59;
42696 t['parenleftsuperior'] = 0x207D;
42697 t['parenlefttp'] = 0xF8EB;
42698 t['parenleftvertical'] = 0xFE35;
42699 t['parenright'] = 0x0029;
42700 t['parenrightaltonearabic'] = 0xFD3F;
42701 t['parenrightbt'] = 0xF8F8;
42702 t['parenrightex'] = 0xF8F7;
42703 t['parenrightinferior'] = 0x208E;
42704 t['parenrightmonospace'] = 0xFF09;
42705 t['parenrightsmall'] = 0xFE5A;
42706 t['parenrightsuperior'] = 0x207E;
42707 t['parenrighttp'] = 0xF8F6;
42708 t['parenrightvertical'] = 0xFE36;
42709 t['partialdiff'] = 0x2202;
42710 t['paseqhebrew'] = 0x05C0;
42711 t['pashtahebrew'] = 0x0599;
42712 t['pasquare'] = 0x33A9;
42713 t['patah'] = 0x05B7;
42714 t['patah11'] = 0x05B7;
42715 t['patah1d'] = 0x05B7;
42716 t['patah2a'] = 0x05B7;
42717 t['patahhebrew'] = 0x05B7;
42718 t['patahnarrowhebrew'] = 0x05B7;
42719 t['patahquarterhebrew'] = 0x05B7;
42720 t['patahwidehebrew'] = 0x05B7;
42721 t['pazerhebrew'] = 0x05A1;
42722 t['pbopomofo'] = 0x3106;
42723 t['pcircle'] = 0x24DF;
42724 t['pdotaccent'] = 0x1E57;
42725 t['pe'] = 0x05E4;
42726 t['pecyrillic'] = 0x043F;
42727 t['pedagesh'] = 0xFB44;
42728 t['pedageshhebrew'] = 0xFB44;
42729 t['peezisquare'] = 0x333B;
42730 t['pefinaldageshhebrew'] = 0xFB43;
42731 t['peharabic'] = 0x067E;
42732 t['peharmenian'] = 0x057A;
42733 t['pehebrew'] = 0x05E4;
42734 t['pehfinalarabic'] = 0xFB57;
42735 t['pehinitialarabic'] = 0xFB58;
42736 t['pehiragana'] = 0x307A;
42737 t['pehmedialarabic'] = 0xFB59;
42738 t['pekatakana'] = 0x30DA;
42739 t['pemiddlehookcyrillic'] = 0x04A7;
42740 t['perafehebrew'] = 0xFB4E;
42741 t['percent'] = 0x0025;
42742 t['percentarabic'] = 0x066A;
42743 t['percentmonospace'] = 0xFF05;
42744 t['percentsmall'] = 0xFE6A;
42745 t['period'] = 0x002E;
42746 t['periodarmenian'] = 0x0589;
42747 t['periodcentered'] = 0x00B7;
42748 t['periodhalfwidth'] = 0xFF61;
42749 t['periodinferior'] = 0xF6E7;
42750 t['periodmonospace'] = 0xFF0E;
42751 t['periodsmall'] = 0xFE52;
42752 t['periodsuperior'] = 0xF6E8;
42753 t['perispomenigreekcmb'] = 0x0342;
42754 t['perpendicular'] = 0x22A5;
42755 t['perthousand'] = 0x2030;
42756 t['peseta'] = 0x20A7;
42757 t['pfsquare'] = 0x338A;
42758 t['phabengali'] = 0x09AB;
42759 t['phadeva'] = 0x092B;
42760 t['phagujarati'] = 0x0AAB;
42761 t['phagurmukhi'] = 0x0A2B;
42762 t['phi'] = 0x03C6;
42763 t['phi1'] = 0x03D5;
42764 t['phieuphacirclekorean'] = 0x327A;
42765 t['phieuphaparenkorean'] = 0x321A;
42766 t['phieuphcirclekorean'] = 0x326C;
42767 t['phieuphkorean'] = 0x314D;
42768 t['phieuphparenkorean'] = 0x320C;
42769 t['philatin'] = 0x0278;
42770 t['phinthuthai'] = 0x0E3A;
42771 t['phisymbolgreek'] = 0x03D5;
42772 t['phook'] = 0x01A5;
42773 t['phophanthai'] = 0x0E1E;
42774 t['phophungthai'] = 0x0E1C;
42775 t['phosamphaothai'] = 0x0E20;
42776 t['pi'] = 0x03C0;
42777 t['pieupacirclekorean'] = 0x3273;
42778 t['pieupaparenkorean'] = 0x3213;
42779 t['pieupcieuckorean'] = 0x3176;
42780 t['pieupcirclekorean'] = 0x3265;
42781 t['pieupkiyeokkorean'] = 0x3172;
42782 t['pieupkorean'] = 0x3142;
42783 t['pieupparenkorean'] = 0x3205;
42784 t['pieupsioskiyeokkorean'] = 0x3174;
42785 t['pieupsioskorean'] = 0x3144;
42786 t['pieupsiostikeutkorean'] = 0x3175;
42787 t['pieupthieuthkorean'] = 0x3177;
42788 t['pieuptikeutkorean'] = 0x3173;
42789 t['pihiragana'] = 0x3074;
42790 t['pikatakana'] = 0x30D4;
42791 t['pisymbolgreek'] = 0x03D6;
42792 t['piwrarmenian'] = 0x0583;
42793 t['plus'] = 0x002B;
42794 t['plusbelowcmb'] = 0x031F;
42795 t['pluscircle'] = 0x2295;
42796 t['plusminus'] = 0x00B1;
42797 t['plusmod'] = 0x02D6;
42798 t['plusmonospace'] = 0xFF0B;
42799 t['plussmall'] = 0xFE62;
42800 t['plussuperior'] = 0x207A;
42801 t['pmonospace'] = 0xFF50;
42802 t['pmsquare'] = 0x33D8;
42803 t['pohiragana'] = 0x307D;
42804 t['pointingindexdownwhite'] = 0x261F;
42805 t['pointingindexleftwhite'] = 0x261C;
42806 t['pointingindexrightwhite'] = 0x261E;
42807 t['pointingindexupwhite'] = 0x261D;
42808 t['pokatakana'] = 0x30DD;
42809 t['poplathai'] = 0x0E1B;
42810 t['postalmark'] = 0x3012;
42811 t['postalmarkface'] = 0x3020;
42812 t['pparen'] = 0x24AB;
42813 t['precedes'] = 0x227A;
42814 t['prescription'] = 0x211E;
42815 t['primemod'] = 0x02B9;
42816 t['primereversed'] = 0x2035;
42817 t['product'] = 0x220F;
42818 t['projective'] = 0x2305;
42819 t['prolongedkana'] = 0x30FC;
42820 t['propellor'] = 0x2318;
42821 t['propersubset'] = 0x2282;
42822 t['propersuperset'] = 0x2283;
42823 t['proportion'] = 0x2237;
42824 t['proportional'] = 0x221D;
42825 t['psi'] = 0x03C8;
42826 t['psicyrillic'] = 0x0471;
42827 t['psilipneumatacyrilliccmb'] = 0x0486;
42828 t['pssquare'] = 0x33B0;
42829 t['puhiragana'] = 0x3077;
42830 t['pukatakana'] = 0x30D7;
42831 t['pvsquare'] = 0x33B4;
42832 t['pwsquare'] = 0x33BA;
42833 t['q'] = 0x0071;
42834 t['qadeva'] = 0x0958;
42835 t['qadmahebrew'] = 0x05A8;
42836 t['qafarabic'] = 0x0642;
42837 t['qaffinalarabic'] = 0xFED6;
42838 t['qafinitialarabic'] = 0xFED7;
42839 t['qafmedialarabic'] = 0xFED8;
42840 t['qamats'] = 0x05B8;
42841 t['qamats10'] = 0x05B8;
42842 t['qamats1a'] = 0x05B8;
42843 t['qamats1c'] = 0x05B8;
42844 t['qamats27'] = 0x05B8;
42845 t['qamats29'] = 0x05B8;
42846 t['qamats33'] = 0x05B8;
42847 t['qamatsde'] = 0x05B8;
42848 t['qamatshebrew'] = 0x05B8;
42849 t['qamatsnarrowhebrew'] = 0x05B8;
42850 t['qamatsqatanhebrew'] = 0x05B8;
42851 t['qamatsqatannarrowhebrew'] = 0x05B8;
42852 t['qamatsqatanquarterhebrew'] = 0x05B8;
42853 t['qamatsqatanwidehebrew'] = 0x05B8;
42854 t['qamatsquarterhebrew'] = 0x05B8;
42855 t['qamatswidehebrew'] = 0x05B8;
42856 t['qarneyparahebrew'] = 0x059F;
42857 t['qbopomofo'] = 0x3111;
42858 t['qcircle'] = 0x24E0;
42859 t['qhook'] = 0x02A0;
42860 t['qmonospace'] = 0xFF51;
42861 t['qof'] = 0x05E7;
42862 t['qofdagesh'] = 0xFB47;
42863 t['qofdageshhebrew'] = 0xFB47;
42864 t['qofhebrew'] = 0x05E7;
42865 t['qparen'] = 0x24AC;
42866 t['quarternote'] = 0x2669;
42867 t['qubuts'] = 0x05BB;
42868 t['qubuts18'] = 0x05BB;
42869 t['qubuts25'] = 0x05BB;
42870 t['qubuts31'] = 0x05BB;
42871 t['qubutshebrew'] = 0x05BB;
42872 t['qubutsnarrowhebrew'] = 0x05BB;
42873 t['qubutsquarterhebrew'] = 0x05BB;
42874 t['qubutswidehebrew'] = 0x05BB;
42875 t['question'] = 0x003F;
42876 t['questionarabic'] = 0x061F;
42877 t['questionarmenian'] = 0x055E;
42878 t['questiondown'] = 0x00BF;
42879 t['questiondownsmall'] = 0xF7BF;
42880 t['questiongreek'] = 0x037E;
42881 t['questionmonospace'] = 0xFF1F;
42882 t['questionsmall'] = 0xF73F;
42883 t['quotedbl'] = 0x0022;
42884 t['quotedblbase'] = 0x201E;
42885 t['quotedblleft'] = 0x201C;
42886 t['quotedblmonospace'] = 0xFF02;
42887 t['quotedblprime'] = 0x301E;
42888 t['quotedblprimereversed'] = 0x301D;
42889 t['quotedblright'] = 0x201D;
42890 t['quoteleft'] = 0x2018;
42891 t['quoteleftreversed'] = 0x201B;
42892 t['quotereversed'] = 0x201B;
42893 t['quoteright'] = 0x2019;
42894 t['quoterightn'] = 0x0149;
42895 t['quotesinglbase'] = 0x201A;
42896 t['quotesingle'] = 0x0027;
42897 t['quotesinglemonospace'] = 0xFF07;
42898 t['r'] = 0x0072;
42899 t['raarmenian'] = 0x057C;
42900 t['rabengali'] = 0x09B0;
42901 t['racute'] = 0x0155;
42902 t['radeva'] = 0x0930;
42903 t['radical'] = 0x221A;
42904 t['radicalex'] = 0xF8E5;
42905 t['radoverssquare'] = 0x33AE;
42906 t['radoverssquaredsquare'] = 0x33AF;
42907 t['radsquare'] = 0x33AD;
42908 t['rafe'] = 0x05BF;
42909 t['rafehebrew'] = 0x05BF;
42910 t['ragujarati'] = 0x0AB0;
42911 t['ragurmukhi'] = 0x0A30;
42912 t['rahiragana'] = 0x3089;
42913 t['rakatakana'] = 0x30E9;
42914 t['rakatakanahalfwidth'] = 0xFF97;
42915 t['ralowerdiagonalbengali'] = 0x09F1;
42916 t['ramiddlediagonalbengali'] = 0x09F0;
42917 t['ramshorn'] = 0x0264;
42918 t['ratio'] = 0x2236;
42919 t['rbopomofo'] = 0x3116;
42920 t['rcaron'] = 0x0159;
42921 t['rcedilla'] = 0x0157;
42922 t['rcircle'] = 0x24E1;
42923 t['rcommaaccent'] = 0x0157;
42924 t['rdblgrave'] = 0x0211;
42925 t['rdotaccent'] = 0x1E59;
42926 t['rdotbelow'] = 0x1E5B;
42927 t['rdotbelowmacron'] = 0x1E5D;
42928 t['referencemark'] = 0x203B;
42929 t['reflexsubset'] = 0x2286;
42930 t['reflexsuperset'] = 0x2287;
42931 t['registered'] = 0x00AE;
42932 t['registersans'] = 0xF8E8;
42933 t['registerserif'] = 0xF6DA;
42934 t['reharabic'] = 0x0631;
42935 t['reharmenian'] = 0x0580;
42936 t['rehfinalarabic'] = 0xFEAE;
42937 t['rehiragana'] = 0x308C;
42938 t['rekatakana'] = 0x30EC;
42939 t['rekatakanahalfwidth'] = 0xFF9A;
42940 t['resh'] = 0x05E8;
42941 t['reshdageshhebrew'] = 0xFB48;
42942 t['reshhebrew'] = 0x05E8;
42943 t['reversedtilde'] = 0x223D;
42944 t['reviahebrew'] = 0x0597;
42945 t['reviamugrashhebrew'] = 0x0597;
42946 t['revlogicalnot'] = 0x2310;
42947 t['rfishhook'] = 0x027E;
42948 t['rfishhookreversed'] = 0x027F;
42949 t['rhabengali'] = 0x09DD;
42950 t['rhadeva'] = 0x095D;
42951 t['rho'] = 0x03C1;
42952 t['rhook'] = 0x027D;
42953 t['rhookturned'] = 0x027B;
42954 t['rhookturnedsuperior'] = 0x02B5;
42955 t['rhosymbolgreek'] = 0x03F1;
42956 t['rhotichookmod'] = 0x02DE;
42957 t['rieulacirclekorean'] = 0x3271;
42958 t['rieulaparenkorean'] = 0x3211;
42959 t['rieulcirclekorean'] = 0x3263;
42960 t['rieulhieuhkorean'] = 0x3140;
42961 t['rieulkiyeokkorean'] = 0x313A;
42962 t['rieulkiyeoksioskorean'] = 0x3169;
42963 t['rieulkorean'] = 0x3139;
42964 t['rieulmieumkorean'] = 0x313B;
42965 t['rieulpansioskorean'] = 0x316C;
42966 t['rieulparenkorean'] = 0x3203;
42967 t['rieulphieuphkorean'] = 0x313F;
42968 t['rieulpieupkorean'] = 0x313C;
42969 t['rieulpieupsioskorean'] = 0x316B;
42970 t['rieulsioskorean'] = 0x313D;
42971 t['rieulthieuthkorean'] = 0x313E;
42972 t['rieultikeutkorean'] = 0x316A;
42973 t['rieulyeorinhieuhkorean'] = 0x316D;
42974 t['rightangle'] = 0x221F;
42975 t['righttackbelowcmb'] = 0x0319;
42976 t['righttriangle'] = 0x22BF;
42977 t['rihiragana'] = 0x308A;
42978 t['rikatakana'] = 0x30EA;
42979 t['rikatakanahalfwidth'] = 0xFF98;
42980 t['ring'] = 0x02DA;
42981 t['ringbelowcmb'] = 0x0325;
42982 t['ringcmb'] = 0x030A;
42983 t['ringhalfleft'] = 0x02BF;
42984 t['ringhalfleftarmenian'] = 0x0559;
42985 t['ringhalfleftbelowcmb'] = 0x031C;
42986 t['ringhalfleftcentered'] = 0x02D3;
42987 t['ringhalfright'] = 0x02BE;
42988 t['ringhalfrightbelowcmb'] = 0x0339;
42989 t['ringhalfrightcentered'] = 0x02D2;
42990 t['rinvertedbreve'] = 0x0213;
42991 t['rittorusquare'] = 0x3351;
42992 t['rlinebelow'] = 0x1E5F;
42993 t['rlongleg'] = 0x027C;
42994 t['rlonglegturned'] = 0x027A;
42995 t['rmonospace'] = 0xFF52;
42996 t['rohiragana'] = 0x308D;
42997 t['rokatakana'] = 0x30ED;
42998 t['rokatakanahalfwidth'] = 0xFF9B;
42999 t['roruathai'] = 0x0E23;
43000 t['rparen'] = 0x24AD;
43001 t['rrabengali'] = 0x09DC;
43002 t['rradeva'] = 0x0931;
43003 t['rragurmukhi'] = 0x0A5C;
43004 t['rreharabic'] = 0x0691;
43005 t['rrehfinalarabic'] = 0xFB8D;
43006 t['rrvocalicbengali'] = 0x09E0;
43007 t['rrvocalicdeva'] = 0x0960;
43008 t['rrvocalicgujarati'] = 0x0AE0;
43009 t['rrvocalicvowelsignbengali'] = 0x09C4;
43010 t['rrvocalicvowelsigndeva'] = 0x0944;
43011 t['rrvocalicvowelsigngujarati'] = 0x0AC4;
43012 t['rsuperior'] = 0xF6F1;
43013 t['rtblock'] = 0x2590;
43014 t['rturned'] = 0x0279;
43015 t['rturnedsuperior'] = 0x02B4;
43016 t['ruhiragana'] = 0x308B;
43017 t['rukatakana'] = 0x30EB;
43018 t['rukatakanahalfwidth'] = 0xFF99;
43019 t['rupeemarkbengali'] = 0x09F2;
43020 t['rupeesignbengali'] = 0x09F3;
43021 t['rupiah'] = 0xF6DD;
43022 t['ruthai'] = 0x0E24;
43023 t['rvocalicbengali'] = 0x098B;
43024 t['rvocalicdeva'] = 0x090B;
43025 t['rvocalicgujarati'] = 0x0A8B;
43026 t['rvocalicvowelsignbengali'] = 0x09C3;
43027 t['rvocalicvowelsigndeva'] = 0x0943;
43028 t['rvocalicvowelsigngujarati'] = 0x0AC3;
43029 t['s'] = 0x0073;
43030 t['sabengali'] = 0x09B8;
43031 t['sacute'] = 0x015B;
43032 t['sacutedotaccent'] = 0x1E65;
43033 t['sadarabic'] = 0x0635;
43034 t['sadeva'] = 0x0938;
43035 t['sadfinalarabic'] = 0xFEBA;
43036 t['sadinitialarabic'] = 0xFEBB;
43037 t['sadmedialarabic'] = 0xFEBC;
43038 t['sagujarati'] = 0x0AB8;
43039 t['sagurmukhi'] = 0x0A38;
43040 t['sahiragana'] = 0x3055;
43041 t['sakatakana'] = 0x30B5;
43042 t['sakatakanahalfwidth'] = 0xFF7B;
43043 t['sallallahoualayhewasallamarabic'] = 0xFDFA;
43044 t['samekh'] = 0x05E1;
43045 t['samekhdagesh'] = 0xFB41;
43046 t['samekhdageshhebrew'] = 0xFB41;
43047 t['samekhhebrew'] = 0x05E1;
43048 t['saraaathai'] = 0x0E32;
43049 t['saraaethai'] = 0x0E41;
43050 t['saraaimaimalaithai'] = 0x0E44;
43051 t['saraaimaimuanthai'] = 0x0E43;
43052 t['saraamthai'] = 0x0E33;
43053 t['saraathai'] = 0x0E30;
43054 t['saraethai'] = 0x0E40;
43055 t['saraiileftthai'] = 0xF886;
43056 t['saraiithai'] = 0x0E35;
43057 t['saraileftthai'] = 0xF885;
43058 t['saraithai'] = 0x0E34;
43059 t['saraothai'] = 0x0E42;
43060 t['saraueeleftthai'] = 0xF888;
43061 t['saraueethai'] = 0x0E37;
43062 t['saraueleftthai'] = 0xF887;
43063 t['sarauethai'] = 0x0E36;
43064 t['sarauthai'] = 0x0E38;
43065 t['sarauuthai'] = 0x0E39;
43066 t['sbopomofo'] = 0x3119;
43067 t['scaron'] = 0x0161;
43068 t['scarondotaccent'] = 0x1E67;
43069 t['scedilla'] = 0x015F;
43070 t['schwa'] = 0x0259;
43071 t['schwacyrillic'] = 0x04D9;
43072 t['schwadieresiscyrillic'] = 0x04DB;
43073 t['schwahook'] = 0x025A;
43074 t['scircle'] = 0x24E2;
43075 t['scircumflex'] = 0x015D;
43076 t['scommaaccent'] = 0x0219;
43077 t['sdotaccent'] = 0x1E61;
43078 t['sdotbelow'] = 0x1E63;
43079 t['sdotbelowdotaccent'] = 0x1E69;
43080 t['seagullbelowcmb'] = 0x033C;
43081 t['second'] = 0x2033;
43082 t['secondtonechinese'] = 0x02CA;
43083 t['section'] = 0x00A7;
43084 t['seenarabic'] = 0x0633;
43085 t['seenfinalarabic'] = 0xFEB2;
43086 t['seeninitialarabic'] = 0xFEB3;
43087 t['seenmedialarabic'] = 0xFEB4;
43088 t['segol'] = 0x05B6;
43089 t['segol13'] = 0x05B6;
43090 t['segol1f'] = 0x05B6;
43091 t['segol2c'] = 0x05B6;
43092 t['segolhebrew'] = 0x05B6;
43093 t['segolnarrowhebrew'] = 0x05B6;
43094 t['segolquarterhebrew'] = 0x05B6;
43095 t['segoltahebrew'] = 0x0592;
43096 t['segolwidehebrew'] = 0x05B6;
43097 t['seharmenian'] = 0x057D;
43098 t['sehiragana'] = 0x305B;
43099 t['sekatakana'] = 0x30BB;
43100 t['sekatakanahalfwidth'] = 0xFF7E;
43101 t['semicolon'] = 0x003B;
43102 t['semicolonarabic'] = 0x061B;
43103 t['semicolonmonospace'] = 0xFF1B;
43104 t['semicolonsmall'] = 0xFE54;
43105 t['semivoicedmarkkana'] = 0x309C;
43106 t['semivoicedmarkkanahalfwidth'] = 0xFF9F;
43107 t['sentisquare'] = 0x3322;
43108 t['sentosquare'] = 0x3323;
43109 t['seven'] = 0x0037;
43110 t['sevenarabic'] = 0x0667;
43111 t['sevenbengali'] = 0x09ED;
43112 t['sevencircle'] = 0x2466;
43113 t['sevencircleinversesansserif'] = 0x2790;
43114 t['sevendeva'] = 0x096D;
43115 t['seveneighths'] = 0x215E;
43116 t['sevengujarati'] = 0x0AED;
43117 t['sevengurmukhi'] = 0x0A6D;
43118 t['sevenhackarabic'] = 0x0667;
43119 t['sevenhangzhou'] = 0x3027;
43120 t['sevenideographicparen'] = 0x3226;
43121 t['seveninferior'] = 0x2087;
43122 t['sevenmonospace'] = 0xFF17;
43123 t['sevenoldstyle'] = 0xF737;
43124 t['sevenparen'] = 0x247A;
43125 t['sevenperiod'] = 0x248E;
43126 t['sevenpersian'] = 0x06F7;
43127 t['sevenroman'] = 0x2176;
43128 t['sevensuperior'] = 0x2077;
43129 t['seventeencircle'] = 0x2470;
43130 t['seventeenparen'] = 0x2484;
43131 t['seventeenperiod'] = 0x2498;
43132 t['seventhai'] = 0x0E57;
43133 t['sfthyphen'] = 0x00AD;
43134 t['shaarmenian'] = 0x0577;
43135 t['shabengali'] = 0x09B6;
43136 t['shacyrillic'] = 0x0448;
43137 t['shaddaarabic'] = 0x0651;
43138 t['shaddadammaarabic'] = 0xFC61;
43139 t['shaddadammatanarabic'] = 0xFC5E;
43140 t['shaddafathaarabic'] = 0xFC60;
43141 t['shaddakasraarabic'] = 0xFC62;
43142 t['shaddakasratanarabic'] = 0xFC5F;
43143 t['shade'] = 0x2592;
43144 t['shadedark'] = 0x2593;
43145 t['shadelight'] = 0x2591;
43146 t['shademedium'] = 0x2592;
43147 t['shadeva'] = 0x0936;
43148 t['shagujarati'] = 0x0AB6;
43149 t['shagurmukhi'] = 0x0A36;
43150 t['shalshelethebrew'] = 0x0593;
43151 t['shbopomofo'] = 0x3115;
43152 t['shchacyrillic'] = 0x0449;
43153 t['sheenarabic'] = 0x0634;
43154 t['sheenfinalarabic'] = 0xFEB6;
43155 t['sheeninitialarabic'] = 0xFEB7;
43156 t['sheenmedialarabic'] = 0xFEB8;
43157 t['sheicoptic'] = 0x03E3;
43158 t['sheqel'] = 0x20AA;
43159 t['sheqelhebrew'] = 0x20AA;
43160 t['sheva'] = 0x05B0;
43161 t['sheva115'] = 0x05B0;
43162 t['sheva15'] = 0x05B0;
43163 t['sheva22'] = 0x05B0;
43164 t['sheva2e'] = 0x05B0;
43165 t['shevahebrew'] = 0x05B0;
43166 t['shevanarrowhebrew'] = 0x05B0;
43167 t['shevaquarterhebrew'] = 0x05B0;
43168 t['shevawidehebrew'] = 0x05B0;
43169 t['shhacyrillic'] = 0x04BB;
43170 t['shimacoptic'] = 0x03ED;
43171 t['shin'] = 0x05E9;
43172 t['shindagesh'] = 0xFB49;
43173 t['shindageshhebrew'] = 0xFB49;
43174 t['shindageshshindot'] = 0xFB2C;
43175 t['shindageshshindothebrew'] = 0xFB2C;
43176 t['shindageshsindot'] = 0xFB2D;
43177 t['shindageshsindothebrew'] = 0xFB2D;
43178 t['shindothebrew'] = 0x05C1;
43179 t['shinhebrew'] = 0x05E9;
43180 t['shinshindot'] = 0xFB2A;
43181 t['shinshindothebrew'] = 0xFB2A;
43182 t['shinsindot'] = 0xFB2B;
43183 t['shinsindothebrew'] = 0xFB2B;
43184 t['shook'] = 0x0282;
43185 t['sigma'] = 0x03C3;
43186 t['sigma1'] = 0x03C2;
43187 t['sigmafinal'] = 0x03C2;
43188 t['sigmalunatesymbolgreek'] = 0x03F2;
43189 t['sihiragana'] = 0x3057;
43190 t['sikatakana'] = 0x30B7;
43191 t['sikatakanahalfwidth'] = 0xFF7C;
43192 t['siluqhebrew'] = 0x05BD;
43193 t['siluqlefthebrew'] = 0x05BD;
43194 t['similar'] = 0x223C;
43195 t['sindothebrew'] = 0x05C2;
43196 t['siosacirclekorean'] = 0x3274;
43197 t['siosaparenkorean'] = 0x3214;
43198 t['sioscieuckorean'] = 0x317E;
43199 t['sioscirclekorean'] = 0x3266;
43200 t['sioskiyeokkorean'] = 0x317A;
43201 t['sioskorean'] = 0x3145;
43202 t['siosnieunkorean'] = 0x317B;
43203 t['siosparenkorean'] = 0x3206;
43204 t['siospieupkorean'] = 0x317D;
43205 t['siostikeutkorean'] = 0x317C;
43206 t['six'] = 0x0036;
43207 t['sixarabic'] = 0x0666;
43208 t['sixbengali'] = 0x09EC;
43209 t['sixcircle'] = 0x2465;
43210 t['sixcircleinversesansserif'] = 0x278F;
43211 t['sixdeva'] = 0x096C;
43212 t['sixgujarati'] = 0x0AEC;
43213 t['sixgurmukhi'] = 0x0A6C;
43214 t['sixhackarabic'] = 0x0666;
43215 t['sixhangzhou'] = 0x3026;
43216 t['sixideographicparen'] = 0x3225;
43217 t['sixinferior'] = 0x2086;
43218 t['sixmonospace'] = 0xFF16;
43219 t['sixoldstyle'] = 0xF736;
43220 t['sixparen'] = 0x2479;
43221 t['sixperiod'] = 0x248D;
43222 t['sixpersian'] = 0x06F6;
43223 t['sixroman'] = 0x2175;
43224 t['sixsuperior'] = 0x2076;
43225 t['sixteencircle'] = 0x246F;
43226 t['sixteencurrencydenominatorbengali'] = 0x09F9;
43227 t['sixteenparen'] = 0x2483;
43228 t['sixteenperiod'] = 0x2497;
43229 t['sixthai'] = 0x0E56;
43230 t['slash'] = 0x002F;
43231 t['slashmonospace'] = 0xFF0F;
43232 t['slong'] = 0x017F;
43233 t['slongdotaccent'] = 0x1E9B;
43234 t['smileface'] = 0x263A;
43235 t['smonospace'] = 0xFF53;
43236 t['sofpasuqhebrew'] = 0x05C3;
43237 t['softhyphen'] = 0x00AD;
43238 t['softsigncyrillic'] = 0x044C;
43239 t['sohiragana'] = 0x305D;
43240 t['sokatakana'] = 0x30BD;
43241 t['sokatakanahalfwidth'] = 0xFF7F;
43242 t['soliduslongoverlaycmb'] = 0x0338;
43243 t['solidusshortoverlaycmb'] = 0x0337;
43244 t['sorusithai'] = 0x0E29;
43245 t['sosalathai'] = 0x0E28;
43246 t['sosothai'] = 0x0E0B;
43247 t['sosuathai'] = 0x0E2A;
43248 t['space'] = 0x0020;
43249 t['spacehackarabic'] = 0x0020;
43250 t['spade'] = 0x2660;
43251 t['spadesuitblack'] = 0x2660;
43252 t['spadesuitwhite'] = 0x2664;
43253 t['sparen'] = 0x24AE;
43254 t['squarebelowcmb'] = 0x033B;
43255 t['squarecc'] = 0x33C4;
43256 t['squarecm'] = 0x339D;
43257 t['squarediagonalcrosshatchfill'] = 0x25A9;
43258 t['squarehorizontalfill'] = 0x25A4;
43259 t['squarekg'] = 0x338F;
43260 t['squarekm'] = 0x339E;
43261 t['squarekmcapital'] = 0x33CE;
43262 t['squareln'] = 0x33D1;
43263 t['squarelog'] = 0x33D2;
43264 t['squaremg'] = 0x338E;
43265 t['squaremil'] = 0x33D5;
43266 t['squaremm'] = 0x339C;
43267 t['squaremsquared'] = 0x33A1;
43268 t['squareorthogonalcrosshatchfill'] = 0x25A6;
43269 t['squareupperlefttolowerrightfill'] = 0x25A7;
43270 t['squareupperrighttolowerleftfill'] = 0x25A8;
43271 t['squareverticalfill'] = 0x25A5;
43272 t['squarewhitewithsmallblack'] = 0x25A3;
43273 t['srsquare'] = 0x33DB;
43274 t['ssabengali'] = 0x09B7;
43275 t['ssadeva'] = 0x0937;
43276 t['ssagujarati'] = 0x0AB7;
43277 t['ssangcieuckorean'] = 0x3149;
43278 t['ssanghieuhkorean'] = 0x3185;
43279 t['ssangieungkorean'] = 0x3180;
43280 t['ssangkiyeokkorean'] = 0x3132;
43281 t['ssangnieunkorean'] = 0x3165;
43282 t['ssangpieupkorean'] = 0x3143;
43283 t['ssangsioskorean'] = 0x3146;
43284 t['ssangtikeutkorean'] = 0x3138;
43285 t['ssuperior'] = 0xF6F2;
43286 t['sterling'] = 0x00A3;
43287 t['sterlingmonospace'] = 0xFFE1;
43288 t['strokelongoverlaycmb'] = 0x0336;
43289 t['strokeshortoverlaycmb'] = 0x0335;
43290 t['subset'] = 0x2282;
43291 t['subsetnotequal'] = 0x228A;
43292 t['subsetorequal'] = 0x2286;
43293 t['succeeds'] = 0x227B;
43294 t['suchthat'] = 0x220B;
43295 t['suhiragana'] = 0x3059;
43296 t['sukatakana'] = 0x30B9;
43297 t['sukatakanahalfwidth'] = 0xFF7D;
43298 t['sukunarabic'] = 0x0652;
43299 t['summation'] = 0x2211;
43300 t['sun'] = 0x263C;
43301 t['superset'] = 0x2283;
43302 t['supersetnotequal'] = 0x228B;
43303 t['supersetorequal'] = 0x2287;
43304 t['svsquare'] = 0x33DC;
43305 t['syouwaerasquare'] = 0x337C;
43306 t['t'] = 0x0074;
43307 t['tabengali'] = 0x09A4;
43308 t['tackdown'] = 0x22A4;
43309 t['tackleft'] = 0x22A3;
43310 t['tadeva'] = 0x0924;
43311 t['tagujarati'] = 0x0AA4;
43312 t['tagurmukhi'] = 0x0A24;
43313 t['taharabic'] = 0x0637;
43314 t['tahfinalarabic'] = 0xFEC2;
43315 t['tahinitialarabic'] = 0xFEC3;
43316 t['tahiragana'] = 0x305F;
43317 t['tahmedialarabic'] = 0xFEC4;
43318 t['taisyouerasquare'] = 0x337D;
43319 t['takatakana'] = 0x30BF;
43320 t['takatakanahalfwidth'] = 0xFF80;
43321 t['tatweelarabic'] = 0x0640;
43322 t['tau'] = 0x03C4;
43323 t['tav'] = 0x05EA;
43324 t['tavdages'] = 0xFB4A;
43325 t['tavdagesh'] = 0xFB4A;
43326 t['tavdageshhebrew'] = 0xFB4A;
43327 t['tavhebrew'] = 0x05EA;
43328 t['tbar'] = 0x0167;
43329 t['tbopomofo'] = 0x310A;
43330 t['tcaron'] = 0x0165;
43331 t['tccurl'] = 0x02A8;
43332 t['tcedilla'] = 0x0163;
43333 t['tcheharabic'] = 0x0686;
43334 t['tchehfinalarabic'] = 0xFB7B;
43335 t['tchehinitialarabic'] = 0xFB7C;
43336 t['tchehmedialarabic'] = 0xFB7D;
43337 t['tcircle'] = 0x24E3;
43338 t['tcircumflexbelow'] = 0x1E71;
43339 t['tcommaaccent'] = 0x0163;
43340 t['tdieresis'] = 0x1E97;
43341 t['tdotaccent'] = 0x1E6B;
43342 t['tdotbelow'] = 0x1E6D;
43343 t['tecyrillic'] = 0x0442;
43344 t['tedescendercyrillic'] = 0x04AD;
43345 t['teharabic'] = 0x062A;
43346 t['tehfinalarabic'] = 0xFE96;
43347 t['tehhahinitialarabic'] = 0xFCA2;
43348 t['tehhahisolatedarabic'] = 0xFC0C;
43349 t['tehinitialarabic'] = 0xFE97;
43350 t['tehiragana'] = 0x3066;
43351 t['tehjeeminitialarabic'] = 0xFCA1;
43352 t['tehjeemisolatedarabic'] = 0xFC0B;
43353 t['tehmarbutaarabic'] = 0x0629;
43354 t['tehmarbutafinalarabic'] = 0xFE94;
43355 t['tehmedialarabic'] = 0xFE98;
43356 t['tehmeeminitialarabic'] = 0xFCA4;
43357 t['tehmeemisolatedarabic'] = 0xFC0E;
43358 t['tehnoonfinalarabic'] = 0xFC73;
43359 t['tekatakana'] = 0x30C6;
43360 t['tekatakanahalfwidth'] = 0xFF83;
43361 t['telephone'] = 0x2121;
43362 t['telephoneblack'] = 0x260E;
43363 t['telishagedolahebrew'] = 0x05A0;
43364 t['telishaqetanahebrew'] = 0x05A9;
43365 t['tencircle'] = 0x2469;
43366 t['tenideographicparen'] = 0x3229;
43367 t['tenparen'] = 0x247D;
43368 t['tenperiod'] = 0x2491;
43369 t['tenroman'] = 0x2179;
43370 t['tesh'] = 0x02A7;
43371 t['tet'] = 0x05D8;
43372 t['tetdagesh'] = 0xFB38;
43373 t['tetdageshhebrew'] = 0xFB38;
43374 t['tethebrew'] = 0x05D8;
43375 t['tetsecyrillic'] = 0x04B5;
43376 t['tevirhebrew'] = 0x059B;
43377 t['tevirlefthebrew'] = 0x059B;
43378 t['thabengali'] = 0x09A5;
43379 t['thadeva'] = 0x0925;
43380 t['thagujarati'] = 0x0AA5;
43381 t['thagurmukhi'] = 0x0A25;
43382 t['thalarabic'] = 0x0630;
43383 t['thalfinalarabic'] = 0xFEAC;
43384 t['thanthakhatlowleftthai'] = 0xF898;
43385 t['thanthakhatlowrightthai'] = 0xF897;
43386 t['thanthakhatthai'] = 0x0E4C;
43387 t['thanthakhatupperleftthai'] = 0xF896;
43388 t['theharabic'] = 0x062B;
43389 t['thehfinalarabic'] = 0xFE9A;
43390 t['thehinitialarabic'] = 0xFE9B;
43391 t['thehmedialarabic'] = 0xFE9C;
43392 t['thereexists'] = 0x2203;
43393 t['therefore'] = 0x2234;
43394 t['theta'] = 0x03B8;
43395 t['theta1'] = 0x03D1;
43396 t['thetasymbolgreek'] = 0x03D1;
43397 t['thieuthacirclekorean'] = 0x3279;
43398 t['thieuthaparenkorean'] = 0x3219;
43399 t['thieuthcirclekorean'] = 0x326B;
43400 t['thieuthkorean'] = 0x314C;
43401 t['thieuthparenkorean'] = 0x320B;
43402 t['thirteencircle'] = 0x246C;
43403 t['thirteenparen'] = 0x2480;
43404 t['thirteenperiod'] = 0x2494;
43405 t['thonangmonthothai'] = 0x0E11;
43406 t['thook'] = 0x01AD;
43407 t['thophuthaothai'] = 0x0E12;
43408 t['thorn'] = 0x00FE;
43409 t['thothahanthai'] = 0x0E17;
43410 t['thothanthai'] = 0x0E10;
43411 t['thothongthai'] = 0x0E18;
43412 t['thothungthai'] = 0x0E16;
43413 t['thousandcyrillic'] = 0x0482;
43414 t['thousandsseparatorarabic'] = 0x066C;
43415 t['thousandsseparatorpersian'] = 0x066C;
43416 t['three'] = 0x0033;
43417 t['threearabic'] = 0x0663;
43418 t['threebengali'] = 0x09E9;
43419 t['threecircle'] = 0x2462;
43420 t['threecircleinversesansserif'] = 0x278C;
43421 t['threedeva'] = 0x0969;
43422 t['threeeighths'] = 0x215C;
43423 t['threegujarati'] = 0x0AE9;
43424 t['threegurmukhi'] = 0x0A69;
43425 t['threehackarabic'] = 0x0663;
43426 t['threehangzhou'] = 0x3023;
43427 t['threeideographicparen'] = 0x3222;
43428 t['threeinferior'] = 0x2083;
43429 t['threemonospace'] = 0xFF13;
43430 t['threenumeratorbengali'] = 0x09F6;
43431 t['threeoldstyle'] = 0xF733;
43432 t['threeparen'] = 0x2476;
43433 t['threeperiod'] = 0x248A;
43434 t['threepersian'] = 0x06F3;
43435 t['threequarters'] = 0x00BE;
43436 t['threequartersemdash'] = 0xF6DE;
43437 t['threeroman'] = 0x2172;
43438 t['threesuperior'] = 0x00B3;
43439 t['threethai'] = 0x0E53;
43440 t['thzsquare'] = 0x3394;
43441 t['tihiragana'] = 0x3061;
43442 t['tikatakana'] = 0x30C1;
43443 t['tikatakanahalfwidth'] = 0xFF81;
43444 t['tikeutacirclekorean'] = 0x3270;
43445 t['tikeutaparenkorean'] = 0x3210;
43446 t['tikeutcirclekorean'] = 0x3262;
43447 t['tikeutkorean'] = 0x3137;
43448 t['tikeutparenkorean'] = 0x3202;
43449 t['tilde'] = 0x02DC;
43450 t['tildebelowcmb'] = 0x0330;
43451 t['tildecmb'] = 0x0303;
43452 t['tildecomb'] = 0x0303;
43453 t['tildedoublecmb'] = 0x0360;
43454 t['tildeoperator'] = 0x223C;
43455 t['tildeoverlaycmb'] = 0x0334;
43456 t['tildeverticalcmb'] = 0x033E;
43457 t['timescircle'] = 0x2297;
43458 t['tipehahebrew'] = 0x0596;
43459 t['tipehalefthebrew'] = 0x0596;
43460 t['tippigurmukhi'] = 0x0A70;
43461 t['titlocyrilliccmb'] = 0x0483;
43462 t['tiwnarmenian'] = 0x057F;
43463 t['tlinebelow'] = 0x1E6F;
43464 t['tmonospace'] = 0xFF54;
43465 t['toarmenian'] = 0x0569;
43466 t['tohiragana'] = 0x3068;
43467 t['tokatakana'] = 0x30C8;
43468 t['tokatakanahalfwidth'] = 0xFF84;
43469 t['tonebarextrahighmod'] = 0x02E5;
43470 t['tonebarextralowmod'] = 0x02E9;
43471 t['tonebarhighmod'] = 0x02E6;
43472 t['tonebarlowmod'] = 0x02E8;
43473 t['tonebarmidmod'] = 0x02E7;
43474 t['tonefive'] = 0x01BD;
43475 t['tonesix'] = 0x0185;
43476 t['tonetwo'] = 0x01A8;
43477 t['tonos'] = 0x0384;
43478 t['tonsquare'] = 0x3327;
43479 t['topatakthai'] = 0x0E0F;
43480 t['tortoiseshellbracketleft'] = 0x3014;
43481 t['tortoiseshellbracketleftsmall'] = 0xFE5D;
43482 t['tortoiseshellbracketleftvertical'] = 0xFE39;
43483 t['tortoiseshellbracketright'] = 0x3015;
43484 t['tortoiseshellbracketrightsmall'] = 0xFE5E;
43485 t['tortoiseshellbracketrightvertical'] = 0xFE3A;
43486 t['totaothai'] = 0x0E15;
43487 t['tpalatalhook'] = 0x01AB;
43488 t['tparen'] = 0x24AF;
43489 t['trademark'] = 0x2122;
43490 t['trademarksans'] = 0xF8EA;
43491 t['trademarkserif'] = 0xF6DB;
43492 t['tretroflexhook'] = 0x0288;
43493 t['triagdn'] = 0x25BC;
43494 t['triaglf'] = 0x25C4;
43495 t['triagrt'] = 0x25BA;
43496 t['triagup'] = 0x25B2;
43497 t['ts'] = 0x02A6;
43498 t['tsadi'] = 0x05E6;
43499 t['tsadidagesh'] = 0xFB46;
43500 t['tsadidageshhebrew'] = 0xFB46;
43501 t['tsadihebrew'] = 0x05E6;
43502 t['tsecyrillic'] = 0x0446;
43503 t['tsere'] = 0x05B5;
43504 t['tsere12'] = 0x05B5;
43505 t['tsere1e'] = 0x05B5;
43506 t['tsere2b'] = 0x05B5;
43507 t['tserehebrew'] = 0x05B5;
43508 t['tserenarrowhebrew'] = 0x05B5;
43509 t['tserequarterhebrew'] = 0x05B5;
43510 t['tserewidehebrew'] = 0x05B5;
43511 t['tshecyrillic'] = 0x045B;
43512 t['tsuperior'] = 0xF6F3;
43513 t['ttabengali'] = 0x099F;
43514 t['ttadeva'] = 0x091F;
43515 t['ttagujarati'] = 0x0A9F;
43516 t['ttagurmukhi'] = 0x0A1F;
43517 t['tteharabic'] = 0x0679;
43518 t['ttehfinalarabic'] = 0xFB67;
43519 t['ttehinitialarabic'] = 0xFB68;
43520 t['ttehmedialarabic'] = 0xFB69;
43521 t['tthabengali'] = 0x09A0;
43522 t['tthadeva'] = 0x0920;
43523 t['tthagujarati'] = 0x0AA0;
43524 t['tthagurmukhi'] = 0x0A20;
43525 t['tturned'] = 0x0287;
43526 t['tuhiragana'] = 0x3064;
43527 t['tukatakana'] = 0x30C4;
43528 t['tukatakanahalfwidth'] = 0xFF82;
43529 t['tusmallhiragana'] = 0x3063;
43530 t['tusmallkatakana'] = 0x30C3;
43531 t['tusmallkatakanahalfwidth'] = 0xFF6F;
43532 t['twelvecircle'] = 0x246B;
43533 t['twelveparen'] = 0x247F;
43534 t['twelveperiod'] = 0x2493;
43535 t['twelveroman'] = 0x217B;
43536 t['twentycircle'] = 0x2473;
43537 t['twentyhangzhou'] = 0x5344;
43538 t['twentyparen'] = 0x2487;
43539 t['twentyperiod'] = 0x249B;
43540 t['two'] = 0x0032;
43541 t['twoarabic'] = 0x0662;
43542 t['twobengali'] = 0x09E8;
43543 t['twocircle'] = 0x2461;
43544 t['twocircleinversesansserif'] = 0x278B;
43545 t['twodeva'] = 0x0968;
43546 t['twodotenleader'] = 0x2025;
43547 t['twodotleader'] = 0x2025;
43548 t['twodotleadervertical'] = 0xFE30;
43549 t['twogujarati'] = 0x0AE8;
43550 t['twogurmukhi'] = 0x0A68;
43551 t['twohackarabic'] = 0x0662;
43552 t['twohangzhou'] = 0x3022;
43553 t['twoideographicparen'] = 0x3221;
43554 t['twoinferior'] = 0x2082;
43555 t['twomonospace'] = 0xFF12;
43556 t['twonumeratorbengali'] = 0x09F5;
43557 t['twooldstyle'] = 0xF732;
43558 t['twoparen'] = 0x2475;
43559 t['twoperiod'] = 0x2489;
43560 t['twopersian'] = 0x06F2;
43561 t['tworoman'] = 0x2171;
43562 t['twostroke'] = 0x01BB;
43563 t['twosuperior'] = 0x00B2;
43564 t['twothai'] = 0x0E52;
43565 t['twothirds'] = 0x2154;
43566 t['u'] = 0x0075;
43567 t['uacute'] = 0x00FA;
43568 t['ubar'] = 0x0289;
43569 t['ubengali'] = 0x0989;
43570 t['ubopomofo'] = 0x3128;
43571 t['ubreve'] = 0x016D;
43572 t['ucaron'] = 0x01D4;
43573 t['ucircle'] = 0x24E4;
43574 t['ucircumflex'] = 0x00FB;
43575 t['ucircumflexbelow'] = 0x1E77;
43576 t['ucyrillic'] = 0x0443;
43577 t['udattadeva'] = 0x0951;
43578 t['udblacute'] = 0x0171;
43579 t['udblgrave'] = 0x0215;
43580 t['udeva'] = 0x0909;
43581 t['udieresis'] = 0x00FC;
43582 t['udieresisacute'] = 0x01D8;
43583 t['udieresisbelow'] = 0x1E73;
43584 t['udieresiscaron'] = 0x01DA;
43585 t['udieresiscyrillic'] = 0x04F1;
43586 t['udieresisgrave'] = 0x01DC;
43587 t['udieresismacron'] = 0x01D6;
43588 t['udotbelow'] = 0x1EE5;
43589 t['ugrave'] = 0x00F9;
43590 t['ugujarati'] = 0x0A89;
43591 t['ugurmukhi'] = 0x0A09;
43592 t['uhiragana'] = 0x3046;
43593 t['uhookabove'] = 0x1EE7;
43594 t['uhorn'] = 0x01B0;
43595 t['uhornacute'] = 0x1EE9;
43596 t['uhorndotbelow'] = 0x1EF1;
43597 t['uhorngrave'] = 0x1EEB;
43598 t['uhornhookabove'] = 0x1EED;
43599 t['uhorntilde'] = 0x1EEF;
43600 t['uhungarumlaut'] = 0x0171;
43601 t['uhungarumlautcyrillic'] = 0x04F3;
43602 t['uinvertedbreve'] = 0x0217;
43603 t['ukatakana'] = 0x30A6;
43604 t['ukatakanahalfwidth'] = 0xFF73;
43605 t['ukcyrillic'] = 0x0479;
43606 t['ukorean'] = 0x315C;
43607 t['umacron'] = 0x016B;
43608 t['umacroncyrillic'] = 0x04EF;
43609 t['umacrondieresis'] = 0x1E7B;
43610 t['umatragurmukhi'] = 0x0A41;
43611 t['umonospace'] = 0xFF55;
43612 t['underscore'] = 0x005F;
43613 t['underscoredbl'] = 0x2017;
43614 t['underscoremonospace'] = 0xFF3F;
43615 t['underscorevertical'] = 0xFE33;
43616 t['underscorewavy'] = 0xFE4F;
43617 t['union'] = 0x222A;
43618 t['universal'] = 0x2200;
43619 t['uogonek'] = 0x0173;
43620 t['uparen'] = 0x24B0;
43621 t['upblock'] = 0x2580;
43622 t['upperdothebrew'] = 0x05C4;
43623 t['upsilon'] = 0x03C5;
43624 t['upsilondieresis'] = 0x03CB;
43625 t['upsilondieresistonos'] = 0x03B0;
43626 t['upsilonlatin'] = 0x028A;
43627 t['upsilontonos'] = 0x03CD;
43628 t['uptackbelowcmb'] = 0x031D;
43629 t['uptackmod'] = 0x02D4;
43630 t['uragurmukhi'] = 0x0A73;
43631 t['uring'] = 0x016F;
43632 t['ushortcyrillic'] = 0x045E;
43633 t['usmallhiragana'] = 0x3045;
43634 t['usmallkatakana'] = 0x30A5;
43635 t['usmallkatakanahalfwidth'] = 0xFF69;
43636 t['ustraightcyrillic'] = 0x04AF;
43637 t['ustraightstrokecyrillic'] = 0x04B1;
43638 t['utilde'] = 0x0169;
43639 t['utildeacute'] = 0x1E79;
43640 t['utildebelow'] = 0x1E75;
43641 t['uubengali'] = 0x098A;
43642 t['uudeva'] = 0x090A;
43643 t['uugujarati'] = 0x0A8A;
43644 t['uugurmukhi'] = 0x0A0A;
43645 t['uumatragurmukhi'] = 0x0A42;
43646 t['uuvowelsignbengali'] = 0x09C2;
43647 t['uuvowelsigndeva'] = 0x0942;
43648 t['uuvowelsigngujarati'] = 0x0AC2;
43649 t['uvowelsignbengali'] = 0x09C1;
43650 t['uvowelsigndeva'] = 0x0941;
43651 t['uvowelsigngujarati'] = 0x0AC1;
43652 t['v'] = 0x0076;
43653 t['vadeva'] = 0x0935;
43654 t['vagujarati'] = 0x0AB5;
43655 t['vagurmukhi'] = 0x0A35;
43656 t['vakatakana'] = 0x30F7;
43657 t['vav'] = 0x05D5;
43658 t['vavdagesh'] = 0xFB35;
43659 t['vavdagesh65'] = 0xFB35;
43660 t['vavdageshhebrew'] = 0xFB35;
43661 t['vavhebrew'] = 0x05D5;
43662 t['vavholam'] = 0xFB4B;
43663 t['vavholamhebrew'] = 0xFB4B;
43664 t['vavvavhebrew'] = 0x05F0;
43665 t['vavyodhebrew'] = 0x05F1;
43666 t['vcircle'] = 0x24E5;
43667 t['vdotbelow'] = 0x1E7F;
43668 t['vecyrillic'] = 0x0432;
43669 t['veharabic'] = 0x06A4;
43670 t['vehfinalarabic'] = 0xFB6B;
43671 t['vehinitialarabic'] = 0xFB6C;
43672 t['vehmedialarabic'] = 0xFB6D;
43673 t['vekatakana'] = 0x30F9;
43674 t['venus'] = 0x2640;
43675 t['verticalbar'] = 0x007C;
43676 t['verticallineabovecmb'] = 0x030D;
43677 t['verticallinebelowcmb'] = 0x0329;
43678 t['verticallinelowmod'] = 0x02CC;
43679 t['verticallinemod'] = 0x02C8;
43680 t['vewarmenian'] = 0x057E;
43681 t['vhook'] = 0x028B;
43682 t['vikatakana'] = 0x30F8;
43683 t['viramabengali'] = 0x09CD;
43684 t['viramadeva'] = 0x094D;
43685 t['viramagujarati'] = 0x0ACD;
43686 t['visargabengali'] = 0x0983;
43687 t['visargadeva'] = 0x0903;
43688 t['visargagujarati'] = 0x0A83;
43689 t['vmonospace'] = 0xFF56;
43690 t['voarmenian'] = 0x0578;
43691 t['voicediterationhiragana'] = 0x309E;
43692 t['voicediterationkatakana'] = 0x30FE;
43693 t['voicedmarkkana'] = 0x309B;
43694 t['voicedmarkkanahalfwidth'] = 0xFF9E;
43695 t['vokatakana'] = 0x30FA;
43696 t['vparen'] = 0x24B1;
43697 t['vtilde'] = 0x1E7D;
43698 t['vturned'] = 0x028C;
43699 t['vuhiragana'] = 0x3094;
43700 t['vukatakana'] = 0x30F4;
43701 t['w'] = 0x0077;
43702 t['wacute'] = 0x1E83;
43703 t['waekorean'] = 0x3159;
43704 t['wahiragana'] = 0x308F;
43705 t['wakatakana'] = 0x30EF;
43706 t['wakatakanahalfwidth'] = 0xFF9C;
43707 t['wakorean'] = 0x3158;
43708 t['wasmallhiragana'] = 0x308E;
43709 t['wasmallkatakana'] = 0x30EE;
43710 t['wattosquare'] = 0x3357;
43711 t['wavedash'] = 0x301C;
43712 t['wavyunderscorevertical'] = 0xFE34;
43713 t['wawarabic'] = 0x0648;
43714 t['wawfinalarabic'] = 0xFEEE;
43715 t['wawhamzaabovearabic'] = 0x0624;
43716 t['wawhamzaabovefinalarabic'] = 0xFE86;
43717 t['wbsquare'] = 0x33DD;
43718 t['wcircle'] = 0x24E6;
43719 t['wcircumflex'] = 0x0175;
43720 t['wdieresis'] = 0x1E85;
43721 t['wdotaccent'] = 0x1E87;
43722 t['wdotbelow'] = 0x1E89;
43723 t['wehiragana'] = 0x3091;
43724 t['weierstrass'] = 0x2118;
43725 t['wekatakana'] = 0x30F1;
43726 t['wekorean'] = 0x315E;
43727 t['weokorean'] = 0x315D;
43728 t['wgrave'] = 0x1E81;
43729 t['whitebullet'] = 0x25E6;
43730 t['whitecircle'] = 0x25CB;
43731 t['whitecircleinverse'] = 0x25D9;
43732 t['whitecornerbracketleft'] = 0x300E;
43733 t['whitecornerbracketleftvertical'] = 0xFE43;
43734 t['whitecornerbracketright'] = 0x300F;
43735 t['whitecornerbracketrightvertical'] = 0xFE44;
43736 t['whitediamond'] = 0x25C7;
43737 t['whitediamondcontainingblacksmalldiamond'] = 0x25C8;
43738 t['whitedownpointingsmalltriangle'] = 0x25BF;
43739 t['whitedownpointingtriangle'] = 0x25BD;
43740 t['whiteleftpointingsmalltriangle'] = 0x25C3;
43741 t['whiteleftpointingtriangle'] = 0x25C1;
43742 t['whitelenticularbracketleft'] = 0x3016;
43743 t['whitelenticularbracketright'] = 0x3017;
43744 t['whiterightpointingsmalltriangle'] = 0x25B9;
43745 t['whiterightpointingtriangle'] = 0x25B7;
43746 t['whitesmallsquare'] = 0x25AB;
43747 t['whitesmilingface'] = 0x263A;
43748 t['whitesquare'] = 0x25A1;
43749 t['whitestar'] = 0x2606;
43750 t['whitetelephone'] = 0x260F;
43751 t['whitetortoiseshellbracketleft'] = 0x3018;
43752 t['whitetortoiseshellbracketright'] = 0x3019;
43753 t['whiteuppointingsmalltriangle'] = 0x25B5;
43754 t['whiteuppointingtriangle'] = 0x25B3;
43755 t['wihiragana'] = 0x3090;
43756 t['wikatakana'] = 0x30F0;
43757 t['wikorean'] = 0x315F;
43758 t['wmonospace'] = 0xFF57;
43759 t['wohiragana'] = 0x3092;
43760 t['wokatakana'] = 0x30F2;
43761 t['wokatakanahalfwidth'] = 0xFF66;
43762 t['won'] = 0x20A9;
43763 t['wonmonospace'] = 0xFFE6;
43764 t['wowaenthai'] = 0x0E27;
43765 t['wparen'] = 0x24B2;
43766 t['wring'] = 0x1E98;
43767 t['wsuperior'] = 0x02B7;
43768 t['wturned'] = 0x028D;
43769 t['wynn'] = 0x01BF;
43770 t['x'] = 0x0078;
43771 t['xabovecmb'] = 0x033D;
43772 t['xbopomofo'] = 0x3112;
43773 t['xcircle'] = 0x24E7;
43774 t['xdieresis'] = 0x1E8D;
43775 t['xdotaccent'] = 0x1E8B;
43776 t['xeharmenian'] = 0x056D;
43777 t['xi'] = 0x03BE;
43778 t['xmonospace'] = 0xFF58;
43779 t['xparen'] = 0x24B3;
43780 t['xsuperior'] = 0x02E3;
43781 t['y'] = 0x0079;
43782 t['yaadosquare'] = 0x334E;
43783 t['yabengali'] = 0x09AF;
43784 t['yacute'] = 0x00FD;
43785 t['yadeva'] = 0x092F;
43786 t['yaekorean'] = 0x3152;
43787 t['yagujarati'] = 0x0AAF;
43788 t['yagurmukhi'] = 0x0A2F;
43789 t['yahiragana'] = 0x3084;
43790 t['yakatakana'] = 0x30E4;
43791 t['yakatakanahalfwidth'] = 0xFF94;
43792 t['yakorean'] = 0x3151;
43793 t['yamakkanthai'] = 0x0E4E;
43794 t['yasmallhiragana'] = 0x3083;
43795 t['yasmallkatakana'] = 0x30E3;
43796 t['yasmallkatakanahalfwidth'] = 0xFF6C;
43797 t['yatcyrillic'] = 0x0463;
43798 t['ycircle'] = 0x24E8;
43799 t['ycircumflex'] = 0x0177;
43800 t['ydieresis'] = 0x00FF;
43801 t['ydotaccent'] = 0x1E8F;
43802 t['ydotbelow'] = 0x1EF5;
43803 t['yeharabic'] = 0x064A;
43804 t['yehbarreearabic'] = 0x06D2;
43805 t['yehbarreefinalarabic'] = 0xFBAF;
43806 t['yehfinalarabic'] = 0xFEF2;
43807 t['yehhamzaabovearabic'] = 0x0626;
43808 t['yehhamzaabovefinalarabic'] = 0xFE8A;
43809 t['yehhamzaaboveinitialarabic'] = 0xFE8B;
43810 t['yehhamzaabovemedialarabic'] = 0xFE8C;
43811 t['yehinitialarabic'] = 0xFEF3;
43812 t['yehmedialarabic'] = 0xFEF4;
43813 t['yehmeeminitialarabic'] = 0xFCDD;
43814 t['yehmeemisolatedarabic'] = 0xFC58;
43815 t['yehnoonfinalarabic'] = 0xFC94;
43816 t['yehthreedotsbelowarabic'] = 0x06D1;
43817 t['yekorean'] = 0x3156;
43818 t['yen'] = 0x00A5;
43819 t['yenmonospace'] = 0xFFE5;
43820 t['yeokorean'] = 0x3155;
43821 t['yeorinhieuhkorean'] = 0x3186;
43822 t['yerahbenyomohebrew'] = 0x05AA;
43823 t['yerahbenyomolefthebrew'] = 0x05AA;
43824 t['yericyrillic'] = 0x044B;
43825 t['yerudieresiscyrillic'] = 0x04F9;
43826 t['yesieungkorean'] = 0x3181;
43827 t['yesieungpansioskorean'] = 0x3183;
43828 t['yesieungsioskorean'] = 0x3182;
43829 t['yetivhebrew'] = 0x059A;
43830 t['ygrave'] = 0x1EF3;
43831 t['yhook'] = 0x01B4;
43832 t['yhookabove'] = 0x1EF7;
43833 t['yiarmenian'] = 0x0575;
43834 t['yicyrillic'] = 0x0457;
43835 t['yikorean'] = 0x3162;
43836 t['yinyang'] = 0x262F;
43837 t['yiwnarmenian'] = 0x0582;
43838 t['ymonospace'] = 0xFF59;
43839 t['yod'] = 0x05D9;
43840 t['yoddagesh'] = 0xFB39;
43841 t['yoddageshhebrew'] = 0xFB39;
43842 t['yodhebrew'] = 0x05D9;
43843 t['yodyodhebrew'] = 0x05F2;
43844 t['yodyodpatahhebrew'] = 0xFB1F;
43845 t['yohiragana'] = 0x3088;
43846 t['yoikorean'] = 0x3189;
43847 t['yokatakana'] = 0x30E8;
43848 t['yokatakanahalfwidth'] = 0xFF96;
43849 t['yokorean'] = 0x315B;
43850 t['yosmallhiragana'] = 0x3087;
43851 t['yosmallkatakana'] = 0x30E7;
43852 t['yosmallkatakanahalfwidth'] = 0xFF6E;
43853 t['yotgreek'] = 0x03F3;
43854 t['yoyaekorean'] = 0x3188;
43855 t['yoyakorean'] = 0x3187;
43856 t['yoyakthai'] = 0x0E22;
43857 t['yoyingthai'] = 0x0E0D;
43858 t['yparen'] = 0x24B4;
43859 t['ypogegrammeni'] = 0x037A;
43860 t['ypogegrammenigreekcmb'] = 0x0345;
43861 t['yr'] = 0x01A6;
43862 t['yring'] = 0x1E99;
43863 t['ysuperior'] = 0x02B8;
43864 t['ytilde'] = 0x1EF9;
43865 t['yturned'] = 0x028E;
43866 t['yuhiragana'] = 0x3086;
43867 t['yuikorean'] = 0x318C;
43868 t['yukatakana'] = 0x30E6;
43869 t['yukatakanahalfwidth'] = 0xFF95;
43870 t['yukorean'] = 0x3160;
43871 t['yusbigcyrillic'] = 0x046B;
43872 t['yusbigiotifiedcyrillic'] = 0x046D;
43873 t['yuslittlecyrillic'] = 0x0467;
43874 t['yuslittleiotifiedcyrillic'] = 0x0469;
43875 t['yusmallhiragana'] = 0x3085;
43876 t['yusmallkatakana'] = 0x30E5;
43877 t['yusmallkatakanahalfwidth'] = 0xFF6D;
43878 t['yuyekorean'] = 0x318B;
43879 t['yuyeokorean'] = 0x318A;
43880 t['yyabengali'] = 0x09DF;
43881 t['yyadeva'] = 0x095F;
43882 t['z'] = 0x007A;
43883 t['zaarmenian'] = 0x0566;
43884 t['zacute'] = 0x017A;
43885 t['zadeva'] = 0x095B;
43886 t['zagurmukhi'] = 0x0A5B;
43887 t['zaharabic'] = 0x0638;
43888 t['zahfinalarabic'] = 0xFEC6;
43889 t['zahinitialarabic'] = 0xFEC7;
43890 t['zahiragana'] = 0x3056;
43891 t['zahmedialarabic'] = 0xFEC8;
43892 t['zainarabic'] = 0x0632;
43893 t['zainfinalarabic'] = 0xFEB0;
43894 t['zakatakana'] = 0x30B6;
43895 t['zaqefgadolhebrew'] = 0x0595;
43896 t['zaqefqatanhebrew'] = 0x0594;
43897 t['zarqahebrew'] = 0x0598;
43898 t['zayin'] = 0x05D6;
43899 t['zayindagesh'] = 0xFB36;
43900 t['zayindageshhebrew'] = 0xFB36;
43901 t['zayinhebrew'] = 0x05D6;
43902 t['zbopomofo'] = 0x3117;
43903 t['zcaron'] = 0x017E;
43904 t['zcircle'] = 0x24E9;
43905 t['zcircumflex'] = 0x1E91;
43906 t['zcurl'] = 0x0291;
43907 t['zdot'] = 0x017C;
43908 t['zdotaccent'] = 0x017C;
43909 t['zdotbelow'] = 0x1E93;
43910 t['zecyrillic'] = 0x0437;
43911 t['zedescendercyrillic'] = 0x0499;
43912 t['zedieresiscyrillic'] = 0x04DF;
43913 t['zehiragana'] = 0x305C;
43914 t['zekatakana'] = 0x30BC;
43915 t['zero'] = 0x0030;
43916 t['zeroarabic'] = 0x0660;
43917 t['zerobengali'] = 0x09E6;
43918 t['zerodeva'] = 0x0966;
43919 t['zerogujarati'] = 0x0AE6;
43920 t['zerogurmukhi'] = 0x0A66;
43921 t['zerohackarabic'] = 0x0660;
43922 t['zeroinferior'] = 0x2080;
43923 t['zeromonospace'] = 0xFF10;
43924 t['zerooldstyle'] = 0xF730;
43925 t['zeropersian'] = 0x06F0;
43926 t['zerosuperior'] = 0x2070;
43927 t['zerothai'] = 0x0E50;
43928 t['zerowidthjoiner'] = 0xFEFF;
43929 t['zerowidthnonjoiner'] = 0x200C;
43930 t['zerowidthspace'] = 0x200B;
43931 t['zeta'] = 0x03B6;
43932 t['zhbopomofo'] = 0x3113;
43933 t['zhearmenian'] = 0x056A;
43934 t['zhebrevecyrillic'] = 0x04C2;
43935 t['zhecyrillic'] = 0x0436;
43936 t['zhedescendercyrillic'] = 0x0497;
43937 t['zhedieresiscyrillic'] = 0x04DD;
43938 t['zihiragana'] = 0x3058;
43939 t['zikatakana'] = 0x30B8;
43940 t['zinorhebrew'] = 0x05AE;
43941 t['zlinebelow'] = 0x1E95;
43942 t['zmonospace'] = 0xFF5A;
43943 t['zohiragana'] = 0x305E;
43944 t['zokatakana'] = 0x30BE;
43945 t['zparen'] = 0x24B5;
43946 t['zretroflexhook'] = 0x0290;
43947 t['zstroke'] = 0x01B6;
43948 t['zuhiragana'] = 0x305A;
43949 t['zukatakana'] = 0x30BA;
43950 t['.notdef'] = 0x0000;
43951 t['angbracketleftbig'] = 0x2329;
43952 t['angbracketleftBig'] = 0x2329;
43953 t['angbracketleftbigg'] = 0x2329;
43954 t['angbracketleftBigg'] = 0x2329;
43955 t['angbracketrightBig'] = 0x232A;
43956 t['angbracketrightbig'] = 0x232A;
43957 t['angbracketrightBigg'] = 0x232A;
43958 t['angbracketrightbigg'] = 0x232A;
43959 t['arrowhookleft'] = 0x21AA;
43960 t['arrowhookright'] = 0x21A9;
43961 t['arrowlefttophalf'] = 0x21BC;
43962 t['arrowleftbothalf'] = 0x21BD;
43963 t['arrownortheast'] = 0x2197;
43964 t['arrownorthwest'] = 0x2196;
43965 t['arrowrighttophalf'] = 0x21C0;
43966 t['arrowrightbothalf'] = 0x21C1;
43967 t['arrowsoutheast'] = 0x2198;
43968 t['arrowsouthwest'] = 0x2199;
43969 t['backslashbig'] = 0x2216;
43970 t['backslashBig'] = 0x2216;
43971 t['backslashBigg'] = 0x2216;
43972 t['backslashbigg'] = 0x2216;
43973 t['bardbl'] = 0x2016;
43974 t['bracehtipdownleft'] = 0xFE37;
43975 t['bracehtipdownright'] = 0xFE37;
43976 t['bracehtipupleft'] = 0xFE38;
43977 t['bracehtipupright'] = 0xFE38;
43978 t['braceleftBig'] = 0x007B;
43979 t['braceleftbig'] = 0x007B;
43980 t['braceleftbigg'] = 0x007B;
43981 t['braceleftBigg'] = 0x007B;
43982 t['bracerightBig'] = 0x007D;
43983 t['bracerightbig'] = 0x007D;
43984 t['bracerightbigg'] = 0x007D;
43985 t['bracerightBigg'] = 0x007D;
43986 t['bracketleftbig'] = 0x005B;
43987 t['bracketleftBig'] = 0x005B;
43988 t['bracketleftbigg'] = 0x005B;
43989 t['bracketleftBigg'] = 0x005B;
43990 t['bracketrightBig'] = 0x005D;
43991 t['bracketrightbig'] = 0x005D;
43992 t['bracketrightbigg'] = 0x005D;
43993 t['bracketrightBigg'] = 0x005D;
43994 t['ceilingleftbig'] = 0x2308;
43995 t['ceilingleftBig'] = 0x2308;
43996 t['ceilingleftBigg'] = 0x2308;
43997 t['ceilingleftbigg'] = 0x2308;
43998 t['ceilingrightbig'] = 0x2309;
43999 t['ceilingrightBig'] = 0x2309;
44000 t['ceilingrightbigg'] = 0x2309;
44001 t['ceilingrightBigg'] = 0x2309;
44002 t['circledotdisplay'] = 0x2299;
44003 t['circledottext'] = 0x2299;
44004 t['circlemultiplydisplay'] = 0x2297;
44005 t['circlemultiplytext'] = 0x2297;
44006 t['circleplusdisplay'] = 0x2295;
44007 t['circleplustext'] = 0x2295;
44008 t['contintegraldisplay'] = 0x222E;
44009 t['contintegraltext'] = 0x222E;
44010 t['coproductdisplay'] = 0x2210;
44011 t['coproducttext'] = 0x2210;
44012 t['floorleftBig'] = 0x230A;
44013 t['floorleftbig'] = 0x230A;
44014 t['floorleftbigg'] = 0x230A;
44015 t['floorleftBigg'] = 0x230A;
44016 t['floorrightbig'] = 0x230B;
44017 t['floorrightBig'] = 0x230B;
44018 t['floorrightBigg'] = 0x230B;
44019 t['floorrightbigg'] = 0x230B;
44020 t['hatwide'] = 0x0302;
44021 t['hatwider'] = 0x0302;
44022 t['hatwidest'] = 0x0302;
44023 t['intercal'] = 0x1D40;
44024 t['integraldisplay'] = 0x222B;
44025 t['integraltext'] = 0x222B;
44026 t['intersectiondisplay'] = 0x22C2;
44027 t['intersectiontext'] = 0x22C2;
44028 t['logicalanddisplay'] = 0x2227;
44029 t['logicalandtext'] = 0x2227;
44030 t['logicalordisplay'] = 0x2228;
44031 t['logicalortext'] = 0x2228;
44032 t['parenleftBig'] = 0x0028;
44033 t['parenleftbig'] = 0x0028;
44034 t['parenleftBigg'] = 0x0028;
44035 t['parenleftbigg'] = 0x0028;
44036 t['parenrightBig'] = 0x0029;
44037 t['parenrightbig'] = 0x0029;
44038 t['parenrightBigg'] = 0x0029;
44039 t['parenrightbigg'] = 0x0029;
44040 t['prime'] = 0x2032;
44041 t['productdisplay'] = 0x220F;
44042 t['producttext'] = 0x220F;
44043 t['radicalbig'] = 0x221A;
44044 t['radicalBig'] = 0x221A;
44045 t['radicalBigg'] = 0x221A;
44046 t['radicalbigg'] = 0x221A;
44047 t['radicalbt'] = 0x221A;
44048 t['radicaltp'] = 0x221A;
44049 t['radicalvertex'] = 0x221A;
44050 t['slashbig'] = 0x002F;
44051 t['slashBig'] = 0x002F;
44052 t['slashBigg'] = 0x002F;
44053 t['slashbigg'] = 0x002F;
44054 t['summationdisplay'] = 0x2211;
44055 t['summationtext'] = 0x2211;
44056 t['tildewide'] = 0x02DC;
44057 t['tildewider'] = 0x02DC;
44058 t['tildewidest'] = 0x02DC;
44059 t['uniondisplay'] = 0x22C3;
44060 t['unionmultidisplay'] = 0x228E;
44061 t['unionmultitext'] = 0x228E;
44062 t['unionsqdisplay'] = 0x2294;
44063 t['unionsqtext'] = 0x2294;
44064 t['uniontext'] = 0x22C3;
44065 t['vextenddouble'] = 0x2225;
44066 t['vextendsingle'] = 0x2223;
44067});
44068var getDingbatsGlyphsUnicode = getLookupTableFactory(function (t) {
44069 t['space'] = 0x0020;
44070 t['a1'] = 0x2701;
44071 t['a2'] = 0x2702;
44072 t['a202'] = 0x2703;
44073 t['a3'] = 0x2704;
44074 t['a4'] = 0x260E;
44075 t['a5'] = 0x2706;
44076 t['a119'] = 0x2707;
44077 t['a118'] = 0x2708;
44078 t['a117'] = 0x2709;
44079 t['a11'] = 0x261B;
44080 t['a12'] = 0x261E;
44081 t['a13'] = 0x270C;
44082 t['a14'] = 0x270D;
44083 t['a15'] = 0x270E;
44084 t['a16'] = 0x270F;
44085 t['a105'] = 0x2710;
44086 t['a17'] = 0x2711;
44087 t['a18'] = 0x2712;
44088 t['a19'] = 0x2713;
44089 t['a20'] = 0x2714;
44090 t['a21'] = 0x2715;
44091 t['a22'] = 0x2716;
44092 t['a23'] = 0x2717;
44093 t['a24'] = 0x2718;
44094 t['a25'] = 0x2719;
44095 t['a26'] = 0x271A;
44096 t['a27'] = 0x271B;
44097 t['a28'] = 0x271C;
44098 t['a6'] = 0x271D;
44099 t['a7'] = 0x271E;
44100 t['a8'] = 0x271F;
44101 t['a9'] = 0x2720;
44102 t['a10'] = 0x2721;
44103 t['a29'] = 0x2722;
44104 t['a30'] = 0x2723;
44105 t['a31'] = 0x2724;
44106 t['a32'] = 0x2725;
44107 t['a33'] = 0x2726;
44108 t['a34'] = 0x2727;
44109 t['a35'] = 0x2605;
44110 t['a36'] = 0x2729;
44111 t['a37'] = 0x272A;
44112 t['a38'] = 0x272B;
44113 t['a39'] = 0x272C;
44114 t['a40'] = 0x272D;
44115 t['a41'] = 0x272E;
44116 t['a42'] = 0x272F;
44117 t['a43'] = 0x2730;
44118 t['a44'] = 0x2731;
44119 t['a45'] = 0x2732;
44120 t['a46'] = 0x2733;
44121 t['a47'] = 0x2734;
44122 t['a48'] = 0x2735;
44123 t['a49'] = 0x2736;
44124 t['a50'] = 0x2737;
44125 t['a51'] = 0x2738;
44126 t['a52'] = 0x2739;
44127 t['a53'] = 0x273A;
44128 t['a54'] = 0x273B;
44129 t['a55'] = 0x273C;
44130 t['a56'] = 0x273D;
44131 t['a57'] = 0x273E;
44132 t['a58'] = 0x273F;
44133 t['a59'] = 0x2740;
44134 t['a60'] = 0x2741;
44135 t['a61'] = 0x2742;
44136 t['a62'] = 0x2743;
44137 t['a63'] = 0x2744;
44138 t['a64'] = 0x2745;
44139 t['a65'] = 0x2746;
44140 t['a66'] = 0x2747;
44141 t['a67'] = 0x2748;
44142 t['a68'] = 0x2749;
44143 t['a69'] = 0x274A;
44144 t['a70'] = 0x274B;
44145 t['a71'] = 0x25CF;
44146 t['a72'] = 0x274D;
44147 t['a73'] = 0x25A0;
44148 t['a74'] = 0x274F;
44149 t['a203'] = 0x2750;
44150 t['a75'] = 0x2751;
44151 t['a204'] = 0x2752;
44152 t['a76'] = 0x25B2;
44153 t['a77'] = 0x25BC;
44154 t['a78'] = 0x25C6;
44155 t['a79'] = 0x2756;
44156 t['a81'] = 0x25D7;
44157 t['a82'] = 0x2758;
44158 t['a83'] = 0x2759;
44159 t['a84'] = 0x275A;
44160 t['a97'] = 0x275B;
44161 t['a98'] = 0x275C;
44162 t['a99'] = 0x275D;
44163 t['a100'] = 0x275E;
44164 t['a101'] = 0x2761;
44165 t['a102'] = 0x2762;
44166 t['a103'] = 0x2763;
44167 t['a104'] = 0x2764;
44168 t['a106'] = 0x2765;
44169 t['a107'] = 0x2766;
44170 t['a108'] = 0x2767;
44171 t['a112'] = 0x2663;
44172 t['a111'] = 0x2666;
44173 t['a110'] = 0x2665;
44174 t['a109'] = 0x2660;
44175 t['a120'] = 0x2460;
44176 t['a121'] = 0x2461;
44177 t['a122'] = 0x2462;
44178 t['a123'] = 0x2463;
44179 t['a124'] = 0x2464;
44180 t['a125'] = 0x2465;
44181 t['a126'] = 0x2466;
44182 t['a127'] = 0x2467;
44183 t['a128'] = 0x2468;
44184 t['a129'] = 0x2469;
44185 t['a130'] = 0x2776;
44186 t['a131'] = 0x2777;
44187 t['a132'] = 0x2778;
44188 t['a133'] = 0x2779;
44189 t['a134'] = 0x277A;
44190 t['a135'] = 0x277B;
44191 t['a136'] = 0x277C;
44192 t['a137'] = 0x277D;
44193 t['a138'] = 0x277E;
44194 t['a139'] = 0x277F;
44195 t['a140'] = 0x2780;
44196 t['a141'] = 0x2781;
44197 t['a142'] = 0x2782;
44198 t['a143'] = 0x2783;
44199 t['a144'] = 0x2784;
44200 t['a145'] = 0x2785;
44201 t['a146'] = 0x2786;
44202 t['a147'] = 0x2787;
44203 t['a148'] = 0x2788;
44204 t['a149'] = 0x2789;
44205 t['a150'] = 0x278A;
44206 t['a151'] = 0x278B;
44207 t['a152'] = 0x278C;
44208 t['a153'] = 0x278D;
44209 t['a154'] = 0x278E;
44210 t['a155'] = 0x278F;
44211 t['a156'] = 0x2790;
44212 t['a157'] = 0x2791;
44213 t['a158'] = 0x2792;
44214 t['a159'] = 0x2793;
44215 t['a160'] = 0x2794;
44216 t['a161'] = 0x2192;
44217 t['a163'] = 0x2194;
44218 t['a164'] = 0x2195;
44219 t['a196'] = 0x2798;
44220 t['a165'] = 0x2799;
44221 t['a192'] = 0x279A;
44222 t['a166'] = 0x279B;
44223 t['a167'] = 0x279C;
44224 t['a168'] = 0x279D;
44225 t['a169'] = 0x279E;
44226 t['a170'] = 0x279F;
44227 t['a171'] = 0x27A0;
44228 t['a172'] = 0x27A1;
44229 t['a173'] = 0x27A2;
44230 t['a162'] = 0x27A3;
44231 t['a174'] = 0x27A4;
44232 t['a175'] = 0x27A5;
44233 t['a176'] = 0x27A6;
44234 t['a177'] = 0x27A7;
44235 t['a178'] = 0x27A8;
44236 t['a179'] = 0x27A9;
44237 t['a193'] = 0x27AA;
44238 t['a180'] = 0x27AB;
44239 t['a199'] = 0x27AC;
44240 t['a181'] = 0x27AD;
44241 t['a200'] = 0x27AE;
44242 t['a182'] = 0x27AF;
44243 t['a201'] = 0x27B1;
44244 t['a183'] = 0x27B2;
44245 t['a184'] = 0x27B3;
44246 t['a197'] = 0x27B4;
44247 t['a185'] = 0x27B5;
44248 t['a194'] = 0x27B6;
44249 t['a198'] = 0x27B7;
44250 t['a186'] = 0x27B8;
44251 t['a195'] = 0x27B9;
44252 t['a187'] = 0x27BA;
44253 t['a188'] = 0x27BB;
44254 t['a189'] = 0x27BC;
44255 t['a190'] = 0x27BD;
44256 t['a191'] = 0x27BE;
44257 t['a89'] = 0x2768;
44258 t['a90'] = 0x2769;
44259 t['a93'] = 0x276A;
44260 t['a94'] = 0x276B;
44261 t['a91'] = 0x276C;
44262 t['a92'] = 0x276D;
44263 t['a205'] = 0x276E;
44264 t['a85'] = 0x276F;
44265 t['a206'] = 0x2770;
44266 t['a86'] = 0x2771;
44267 t['a87'] = 0x2772;
44268 t['a88'] = 0x2773;
44269 t['a95'] = 0x2774;
44270 t['a96'] = 0x2775;
44271 t['.notdef'] = 0x0000;
44272});
44273exports.getGlyphsUnicode = getGlyphsUnicode;
44274exports.getDingbatsGlyphsUnicode = getDingbatsGlyphsUnicode;
44275
44276/***/ }),
44277/* 179 */
44278/***/ (function(module, exports, __w_pdfjs_require__) {
44279
44280"use strict";
44281
44282
44283Object.defineProperty(exports, "__esModule", {
44284  value: true
44285});
44286exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getGlyphMapForStandardFonts = exports.getSymbolsFonts = exports.getSerifFonts = exports.getNonStdFontMap = exports.getStdFontMap = void 0;
44287
44288var _core_utils = __w_pdfjs_require__(154);
44289
44290var getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
44291  t['ArialNarrow'] = 'Helvetica';
44292  t['ArialNarrow-Bold'] = 'Helvetica-Bold';
44293  t['ArialNarrow-BoldItalic'] = 'Helvetica-BoldOblique';
44294  t['ArialNarrow-Italic'] = 'Helvetica-Oblique';
44295  t['ArialBlack'] = 'Helvetica';
44296  t['ArialBlack-Bold'] = 'Helvetica-Bold';
44297  t['ArialBlack-BoldItalic'] = 'Helvetica-BoldOblique';
44298  t['ArialBlack-Italic'] = 'Helvetica-Oblique';
44299  t['Arial-Black'] = 'Helvetica';
44300  t['Arial-Black-Bold'] = 'Helvetica-Bold';
44301  t['Arial-Black-BoldItalic'] = 'Helvetica-BoldOblique';
44302  t['Arial-Black-Italic'] = 'Helvetica-Oblique';
44303  t['Arial'] = 'Helvetica';
44304  t['Arial-Bold'] = 'Helvetica-Bold';
44305  t['Arial-BoldItalic'] = 'Helvetica-BoldOblique';
44306  t['Arial-Italic'] = 'Helvetica-Oblique';
44307  t['Arial-BoldItalicMT'] = 'Helvetica-BoldOblique';
44308  t['Arial-BoldMT'] = 'Helvetica-Bold';
44309  t['Arial-ItalicMT'] = 'Helvetica-Oblique';
44310  t['ArialMT'] = 'Helvetica';
44311  t['Courier-Bold'] = 'Courier-Bold';
44312  t['Courier-BoldItalic'] = 'Courier-BoldOblique';
44313  t['Courier-Italic'] = 'Courier-Oblique';
44314  t['CourierNew'] = 'Courier';
44315  t['CourierNew-Bold'] = 'Courier-Bold';
44316  t['CourierNew-BoldItalic'] = 'Courier-BoldOblique';
44317  t['CourierNew-Italic'] = 'Courier-Oblique';
44318  t['CourierNewPS-BoldItalicMT'] = 'Courier-BoldOblique';
44319  t['CourierNewPS-BoldMT'] = 'Courier-Bold';
44320  t['CourierNewPS-ItalicMT'] = 'Courier-Oblique';
44321  t['CourierNewPSMT'] = 'Courier';
44322  t['Helvetica'] = 'Helvetica';
44323  t['Helvetica-Bold'] = 'Helvetica-Bold';
44324  t['Helvetica-BoldItalic'] = 'Helvetica-BoldOblique';
44325  t['Helvetica-BoldOblique'] = 'Helvetica-BoldOblique';
44326  t['Helvetica-Italic'] = 'Helvetica-Oblique';
44327  t['Helvetica-Oblique'] = 'Helvetica-Oblique';
44328  t['SegoeUISymbol'] = 'Helvetica';
44329  t['Symbol-Bold'] = 'Symbol';
44330  t['Symbol-BoldItalic'] = 'Symbol';
44331  t['Symbol-Italic'] = 'Symbol';
44332  t['TimesNewRoman'] = 'Times-Roman';
44333  t['TimesNewRoman-Bold'] = 'Times-Bold';
44334  t['TimesNewRoman-BoldItalic'] = 'Times-BoldItalic';
44335  t['TimesNewRoman-Italic'] = 'Times-Italic';
44336  t['TimesNewRomanPS'] = 'Times-Roman';
44337  t['TimesNewRomanPS-Bold'] = 'Times-Bold';
44338  t['TimesNewRomanPS-BoldItalic'] = 'Times-BoldItalic';
44339  t['TimesNewRomanPS-BoldItalicMT'] = 'Times-BoldItalic';
44340  t['TimesNewRomanPS-BoldMT'] = 'Times-Bold';
44341  t['TimesNewRomanPS-Italic'] = 'Times-Italic';
44342  t['TimesNewRomanPS-ItalicMT'] = 'Times-Italic';
44343  t['TimesNewRomanPSMT'] = 'Times-Roman';
44344  t['TimesNewRomanPSMT-Bold'] = 'Times-Bold';
44345  t['TimesNewRomanPSMT-BoldItalic'] = 'Times-BoldItalic';
44346  t['TimesNewRomanPSMT-Italic'] = 'Times-Italic';
44347});
44348exports.getStdFontMap = getStdFontMap;
44349var getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
44350  t['Calibri'] = 'Helvetica';
44351  t['Calibri-Bold'] = 'Helvetica-Bold';
44352  t['Calibri-BoldItalic'] = 'Helvetica-BoldOblique';
44353  t['Calibri-Italic'] = 'Helvetica-Oblique';
44354  t['CenturyGothic'] = 'Helvetica';
44355  t['CenturyGothic-Bold'] = 'Helvetica-Bold';
44356  t['CenturyGothic-BoldItalic'] = 'Helvetica-BoldOblique';
44357  t['CenturyGothic-Italic'] = 'Helvetica-Oblique';
44358  t['ComicSansMS'] = 'Comic Sans MS';
44359  t['ComicSansMS-Bold'] = 'Comic Sans MS-Bold';
44360  t['ComicSansMS-BoldItalic'] = 'Comic Sans MS-BoldItalic';
44361  t['ComicSansMS-Italic'] = 'Comic Sans MS-Italic';
44362  t['LucidaConsole'] = 'Courier';
44363  t['LucidaConsole-Bold'] = 'Courier-Bold';
44364  t['LucidaConsole-BoldItalic'] = 'Courier-BoldOblique';
44365  t['LucidaConsole-Italic'] = 'Courier-Oblique';
44366  t['LucidaSans-Demi'] = 'Helvetica-Bold';
44367  t['MS-Gothic'] = 'MS Gothic';
44368  t['MS-Gothic-Bold'] = 'MS Gothic-Bold';
44369  t['MS-Gothic-BoldItalic'] = 'MS Gothic-BoldItalic';
44370  t['MS-Gothic-Italic'] = 'MS Gothic-Italic';
44371  t['MS-Mincho'] = 'MS Mincho';
44372  t['MS-Mincho-Bold'] = 'MS Mincho-Bold';
44373  t['MS-Mincho-BoldItalic'] = 'MS Mincho-BoldItalic';
44374  t['MS-Mincho-Italic'] = 'MS Mincho-Italic';
44375  t['MS-PGothic'] = 'MS PGothic';
44376  t['MS-PGothic-Bold'] = 'MS PGothic-Bold';
44377  t['MS-PGothic-BoldItalic'] = 'MS PGothic-BoldItalic';
44378  t['MS-PGothic-Italic'] = 'MS PGothic-Italic';
44379  t['MS-PMincho'] = 'MS PMincho';
44380  t['MS-PMincho-Bold'] = 'MS PMincho-Bold';
44381  t['MS-PMincho-BoldItalic'] = 'MS PMincho-BoldItalic';
44382  t['MS-PMincho-Italic'] = 'MS PMincho-Italic';
44383  t['NuptialScript'] = 'Times-Italic';
44384  t['Wingdings'] = 'ZapfDingbats';
44385});
44386exports.getNonStdFontMap = getNonStdFontMap;
44387var getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
44388  t['Adobe Jenson'] = true;
44389  t['Adobe Text'] = true;
44390  t['Albertus'] = true;
44391  t['Aldus'] = true;
44392  t['Alexandria'] = true;
44393  t['Algerian'] = true;
44394  t['American Typewriter'] = true;
44395  t['Antiqua'] = true;
44396  t['Apex'] = true;
44397  t['Arno'] = true;
44398  t['Aster'] = true;
44399  t['Aurora'] = true;
44400  t['Baskerville'] = true;
44401  t['Bell'] = true;
44402  t['Bembo'] = true;
44403  t['Bembo Schoolbook'] = true;
44404  t['Benguiat'] = true;
44405  t['Berkeley Old Style'] = true;
44406  t['Bernhard Modern'] = true;
44407  t['Berthold City'] = true;
44408  t['Bodoni'] = true;
44409  t['Bauer Bodoni'] = true;
44410  t['Book Antiqua'] = true;
44411  t['Bookman'] = true;
44412  t['Bordeaux Roman'] = true;
44413  t['Californian FB'] = true;
44414  t['Calisto'] = true;
44415  t['Calvert'] = true;
44416  t['Capitals'] = true;
44417  t['Cambria'] = true;
44418  t['Cartier'] = true;
44419  t['Caslon'] = true;
44420  t['Catull'] = true;
44421  t['Centaur'] = true;
44422  t['Century Old Style'] = true;
44423  t['Century Schoolbook'] = true;
44424  t['Chaparral'] = true;
44425  t['Charis SIL'] = true;
44426  t['Cheltenham'] = true;
44427  t['Cholla Slab'] = true;
44428  t['Clarendon'] = true;
44429  t['Clearface'] = true;
44430  t['Cochin'] = true;
44431  t['Colonna'] = true;
44432  t['Computer Modern'] = true;
44433  t['Concrete Roman'] = true;
44434  t['Constantia'] = true;
44435  t['Cooper Black'] = true;
44436  t['Corona'] = true;
44437  t['Ecotype'] = true;
44438  t['Egyptienne'] = true;
44439  t['Elephant'] = true;
44440  t['Excelsior'] = true;
44441  t['Fairfield'] = true;
44442  t['FF Scala'] = true;
44443  t['Folkard'] = true;
44444  t['Footlight'] = true;
44445  t['FreeSerif'] = true;
44446  t['Friz Quadrata'] = true;
44447  t['Garamond'] = true;
44448  t['Gentium'] = true;
44449  t['Georgia'] = true;
44450  t['Gloucester'] = true;
44451  t['Goudy Old Style'] = true;
44452  t['Goudy Schoolbook'] = true;
44453  t['Goudy Pro Font'] = true;
44454  t['Granjon'] = true;
44455  t['Guardian Egyptian'] = true;
44456  t['Heather'] = true;
44457  t['Hercules'] = true;
44458  t['High Tower Text'] = true;
44459  t['Hiroshige'] = true;
44460  t['Hoefler Text'] = true;
44461  t['Humana Serif'] = true;
44462  t['Imprint'] = true;
44463  t['Ionic No. 5'] = true;
44464  t['Janson'] = true;
44465  t['Joanna'] = true;
44466  t['Korinna'] = true;
44467  t['Lexicon'] = true;
44468  t['Liberation Serif'] = true;
44469  t['Linux Libertine'] = true;
44470  t['Literaturnaya'] = true;
44471  t['Lucida'] = true;
44472  t['Lucida Bright'] = true;
44473  t['Melior'] = true;
44474  t['Memphis'] = true;
44475  t['Miller'] = true;
44476  t['Minion'] = true;
44477  t['Modern'] = true;
44478  t['Mona Lisa'] = true;
44479  t['Mrs Eaves'] = true;
44480  t['MS Serif'] = true;
44481  t['Museo Slab'] = true;
44482  t['New York'] = true;
44483  t['Nimbus Roman'] = true;
44484  t['NPS Rawlinson Roadway'] = true;
44485  t['NuptialScript'] = true;
44486  t['Palatino'] = true;
44487  t['Perpetua'] = true;
44488  t['Plantin'] = true;
44489  t['Plantin Schoolbook'] = true;
44490  t['Playbill'] = true;
44491  t['Poor Richard'] = true;
44492  t['Rawlinson Roadway'] = true;
44493  t['Renault'] = true;
44494  t['Requiem'] = true;
44495  t['Rockwell'] = true;
44496  t['Roman'] = true;
44497  t['Rotis Serif'] = true;
44498  t['Sabon'] = true;
44499  t['Scala'] = true;
44500  t['Seagull'] = true;
44501  t['Sistina'] = true;
44502  t['Souvenir'] = true;
44503  t['STIX'] = true;
44504  t['Stone Informal'] = true;
44505  t['Stone Serif'] = true;
44506  t['Sylfaen'] = true;
44507  t['Times'] = true;
44508  t['Trajan'] = true;
44509  t['Trinité'] = true;
44510  t['Trump Mediaeval'] = true;
44511  t['Utopia'] = true;
44512  t['Vale Type'] = true;
44513  t['Bitstream Vera'] = true;
44514  t['Vera Serif'] = true;
44515  t['Versailles'] = true;
44516  t['Wanted'] = true;
44517  t['Weiss'] = true;
44518  t['Wide Latin'] = true;
44519  t['Windsor'] = true;
44520  t['XITS'] = true;
44521});
44522exports.getSerifFonts = getSerifFonts;
44523var getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
44524  t['Dingbats'] = true;
44525  t['Symbol'] = true;
44526  t['ZapfDingbats'] = true;
44527});
44528exports.getSymbolsFonts = getSymbolsFonts;
44529var getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
44530  t[2] = 10;
44531  t[3] = 32;
44532  t[4] = 33;
44533  t[5] = 34;
44534  t[6] = 35;
44535  t[7] = 36;
44536  t[8] = 37;
44537  t[9] = 38;
44538  t[10] = 39;
44539  t[11] = 40;
44540  t[12] = 41;
44541  t[13] = 42;
44542  t[14] = 43;
44543  t[15] = 44;
44544  t[16] = 45;
44545  t[17] = 46;
44546  t[18] = 47;
44547  t[19] = 48;
44548  t[20] = 49;
44549  t[21] = 50;
44550  t[22] = 51;
44551  t[23] = 52;
44552  t[24] = 53;
44553  t[25] = 54;
44554  t[26] = 55;
44555  t[27] = 56;
44556  t[28] = 57;
44557  t[29] = 58;
44558  t[30] = 894;
44559  t[31] = 60;
44560  t[32] = 61;
44561  t[33] = 62;
44562  t[34] = 63;
44563  t[35] = 64;
44564  t[36] = 65;
44565  t[37] = 66;
44566  t[38] = 67;
44567  t[39] = 68;
44568  t[40] = 69;
44569  t[41] = 70;
44570  t[42] = 71;
44571  t[43] = 72;
44572  t[44] = 73;
44573  t[45] = 74;
44574  t[46] = 75;
44575  t[47] = 76;
44576  t[48] = 77;
44577  t[49] = 78;
44578  t[50] = 79;
44579  t[51] = 80;
44580  t[52] = 81;
44581  t[53] = 82;
44582  t[54] = 83;
44583  t[55] = 84;
44584  t[56] = 85;
44585  t[57] = 86;
44586  t[58] = 87;
44587  t[59] = 88;
44588  t[60] = 89;
44589  t[61] = 90;
44590  t[62] = 91;
44591  t[63] = 92;
44592  t[64] = 93;
44593  t[65] = 94;
44594  t[66] = 95;
44595  t[67] = 96;
44596  t[68] = 97;
44597  t[69] = 98;
44598  t[70] = 99;
44599  t[71] = 100;
44600  t[72] = 101;
44601  t[73] = 102;
44602  t[74] = 103;
44603  t[75] = 104;
44604  t[76] = 105;
44605  t[77] = 106;
44606  t[78] = 107;
44607  t[79] = 108;
44608  t[80] = 109;
44609  t[81] = 110;
44610  t[82] = 111;
44611  t[83] = 112;
44612  t[84] = 113;
44613  t[85] = 114;
44614  t[86] = 115;
44615  t[87] = 116;
44616  t[88] = 117;
44617  t[89] = 118;
44618  t[90] = 119;
44619  t[91] = 120;
44620  t[92] = 121;
44621  t[93] = 122;
44622  t[94] = 123;
44623  t[95] = 124;
44624  t[96] = 125;
44625  t[97] = 126;
44626  t[98] = 196;
44627  t[99] = 197;
44628  t[100] = 199;
44629  t[101] = 201;
44630  t[102] = 209;
44631  t[103] = 214;
44632  t[104] = 220;
44633  t[105] = 225;
44634  t[106] = 224;
44635  t[107] = 226;
44636  t[108] = 228;
44637  t[109] = 227;
44638  t[110] = 229;
44639  t[111] = 231;
44640  t[112] = 233;
44641  t[113] = 232;
44642  t[114] = 234;
44643  t[115] = 235;
44644  t[116] = 237;
44645  t[117] = 236;
44646  t[118] = 238;
44647  t[119] = 239;
44648  t[120] = 241;
44649  t[121] = 243;
44650  t[122] = 242;
44651  t[123] = 244;
44652  t[124] = 246;
44653  t[125] = 245;
44654  t[126] = 250;
44655  t[127] = 249;
44656  t[128] = 251;
44657  t[129] = 252;
44658  t[130] = 8224;
44659  t[131] = 176;
44660  t[132] = 162;
44661  t[133] = 163;
44662  t[134] = 167;
44663  t[135] = 8226;
44664  t[136] = 182;
44665  t[137] = 223;
44666  t[138] = 174;
44667  t[139] = 169;
44668  t[140] = 8482;
44669  t[141] = 180;
44670  t[142] = 168;
44671  t[143] = 8800;
44672  t[144] = 198;
44673  t[145] = 216;
44674  t[146] = 8734;
44675  t[147] = 177;
44676  t[148] = 8804;
44677  t[149] = 8805;
44678  t[150] = 165;
44679  t[151] = 181;
44680  t[152] = 8706;
44681  t[153] = 8721;
44682  t[154] = 8719;
44683  t[156] = 8747;
44684  t[157] = 170;
44685  t[158] = 186;
44686  t[159] = 8486;
44687  t[160] = 230;
44688  t[161] = 248;
44689  t[162] = 191;
44690  t[163] = 161;
44691  t[164] = 172;
44692  t[165] = 8730;
44693  t[166] = 402;
44694  t[167] = 8776;
44695  t[168] = 8710;
44696  t[169] = 171;
44697  t[170] = 187;
44698  t[171] = 8230;
44699  t[210] = 218;
44700  t[223] = 711;
44701  t[224] = 321;
44702  t[225] = 322;
44703  t[227] = 353;
44704  t[229] = 382;
44705  t[234] = 253;
44706  t[252] = 263;
44707  t[253] = 268;
44708  t[254] = 269;
44709  t[258] = 258;
44710  t[260] = 260;
44711  t[261] = 261;
44712  t[265] = 280;
44713  t[266] = 281;
44714  t[268] = 283;
44715  t[269] = 313;
44716  t[275] = 323;
44717  t[276] = 324;
44718  t[278] = 328;
44719  t[284] = 345;
44720  t[285] = 346;
44721  t[286] = 347;
44722  t[292] = 367;
44723  t[295] = 377;
44724  t[296] = 378;
44725  t[298] = 380;
44726  t[305] = 963;
44727  t[306] = 964;
44728  t[307] = 966;
44729  t[308] = 8215;
44730  t[309] = 8252;
44731  t[310] = 8319;
44732  t[311] = 8359;
44733  t[312] = 8592;
44734  t[313] = 8593;
44735  t[337] = 9552;
44736  t[493] = 1039;
44737  t[494] = 1040;
44738  t[705] = 1524;
44739  t[706] = 8362;
44740  t[710] = 64288;
44741  t[711] = 64298;
44742  t[759] = 1617;
44743  t[761] = 1776;
44744  t[763] = 1778;
44745  t[775] = 1652;
44746  t[777] = 1764;
44747  t[778] = 1780;
44748  t[779] = 1781;
44749  t[780] = 1782;
44750  t[782] = 771;
44751  t[783] = 64726;
44752  t[786] = 8363;
44753  t[788] = 8532;
44754  t[790] = 768;
44755  t[791] = 769;
44756  t[792] = 768;
44757  t[795] = 803;
44758  t[797] = 64336;
44759  t[798] = 64337;
44760  t[799] = 64342;
44761  t[800] = 64343;
44762  t[801] = 64344;
44763  t[802] = 64345;
44764  t[803] = 64362;
44765  t[804] = 64363;
44766  t[805] = 64364;
44767  t[2424] = 7821;
44768  t[2425] = 7822;
44769  t[2426] = 7823;
44770  t[2427] = 7824;
44771  t[2428] = 7825;
44772  t[2429] = 7826;
44773  t[2430] = 7827;
44774  t[2433] = 7682;
44775  t[2678] = 8045;
44776  t[2679] = 8046;
44777  t[2830] = 1552;
44778  t[2838] = 686;
44779  t[2840] = 751;
44780  t[2842] = 753;
44781  t[2843] = 754;
44782  t[2844] = 755;
44783  t[2846] = 757;
44784  t[2856] = 767;
44785  t[2857] = 848;
44786  t[2858] = 849;
44787  t[2862] = 853;
44788  t[2863] = 854;
44789  t[2864] = 855;
44790  t[2865] = 861;
44791  t[2866] = 862;
44792  t[2906] = 7460;
44793  t[2908] = 7462;
44794  t[2909] = 7463;
44795  t[2910] = 7464;
44796  t[2912] = 7466;
44797  t[2913] = 7467;
44798  t[2914] = 7468;
44799  t[2916] = 7470;
44800  t[2917] = 7471;
44801  t[2918] = 7472;
44802  t[2920] = 7474;
44803  t[2921] = 7475;
44804  t[2922] = 7476;
44805  t[2924] = 7478;
44806  t[2925] = 7479;
44807  t[2926] = 7480;
44808  t[2928] = 7482;
44809  t[2929] = 7483;
44810  t[2930] = 7484;
44811  t[2932] = 7486;
44812  t[2933] = 7487;
44813  t[2934] = 7488;
44814  t[2936] = 7490;
44815  t[2937] = 7491;
44816  t[2938] = 7492;
44817  t[2940] = 7494;
44818  t[2941] = 7495;
44819  t[2942] = 7496;
44820  t[2944] = 7498;
44821  t[2946] = 7500;
44822  t[2948] = 7502;
44823  t[2950] = 7504;
44824  t[2951] = 7505;
44825  t[2952] = 7506;
44826  t[2954] = 7508;
44827  t[2955] = 7509;
44828  t[2956] = 7510;
44829  t[2958] = 7512;
44830  t[2959] = 7513;
44831  t[2960] = 7514;
44832  t[2962] = 7516;
44833  t[2963] = 7517;
44834  t[2964] = 7518;
44835  t[2966] = 7520;
44836  t[2967] = 7521;
44837  t[2968] = 7522;
44838  t[2970] = 7524;
44839  t[2971] = 7525;
44840  t[2972] = 7526;
44841  t[2974] = 7528;
44842  t[2975] = 7529;
44843  t[2976] = 7530;
44844  t[2978] = 1537;
44845  t[2979] = 1538;
44846  t[2980] = 1539;
44847  t[2982] = 1549;
44848  t[2983] = 1551;
44849  t[2984] = 1552;
44850  t[2986] = 1554;
44851  t[2987] = 1555;
44852  t[2988] = 1556;
44853  t[2990] = 1623;
44854  t[2991] = 1624;
44855  t[2995] = 1775;
44856  t[2999] = 1791;
44857  t[3002] = 64290;
44858  t[3003] = 64291;
44859  t[3004] = 64292;
44860  t[3006] = 64294;
44861  t[3007] = 64295;
44862  t[3008] = 64296;
44863  t[3011] = 1900;
44864  t[3014] = 8223;
44865  t[3015] = 8244;
44866  t[3017] = 7532;
44867  t[3018] = 7533;
44868  t[3019] = 7534;
44869  t[3075] = 7590;
44870  t[3076] = 7591;
44871  t[3079] = 7594;
44872  t[3080] = 7595;
44873  t[3083] = 7598;
44874  t[3084] = 7599;
44875  t[3087] = 7602;
44876  t[3088] = 7603;
44877  t[3091] = 7606;
44878  t[3092] = 7607;
44879  t[3095] = 7610;
44880  t[3096] = 7611;
44881  t[3099] = 7614;
44882  t[3100] = 7615;
44883  t[3103] = 7618;
44884  t[3104] = 7619;
44885  t[3107] = 8337;
44886  t[3108] = 8338;
44887  t[3116] = 1884;
44888  t[3119] = 1885;
44889  t[3120] = 1885;
44890  t[3123] = 1886;
44891  t[3124] = 1886;
44892  t[3127] = 1887;
44893  t[3128] = 1887;
44894  t[3131] = 1888;
44895  t[3132] = 1888;
44896  t[3135] = 1889;
44897  t[3136] = 1889;
44898  t[3139] = 1890;
44899  t[3140] = 1890;
44900  t[3143] = 1891;
44901  t[3144] = 1891;
44902  t[3147] = 1892;
44903  t[3148] = 1892;
44904  t[3153] = 580;
44905  t[3154] = 581;
44906  t[3157] = 584;
44907  t[3158] = 585;
44908  t[3161] = 588;
44909  t[3162] = 589;
44910  t[3165] = 891;
44911  t[3166] = 892;
44912  t[3169] = 1274;
44913  t[3170] = 1275;
44914  t[3173] = 1278;
44915  t[3174] = 1279;
44916  t[3181] = 7622;
44917  t[3182] = 7623;
44918  t[3282] = 11799;
44919  t[3316] = 578;
44920  t[3379] = 42785;
44921  t[3393] = 1159;
44922  t[3416] = 8377;
44923});
44924exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
44925var getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) {
44926  t[227] = 322;
44927  t[264] = 261;
44928  t[291] = 346;
44929});
44930exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
44931var getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) {
44932  t[1] = 32;
44933  t[4] = 65;
44934  t[17] = 66;
44935  t[18] = 67;
44936  t[24] = 68;
44937  t[28] = 69;
44938  t[38] = 70;
44939  t[39] = 71;
44940  t[44] = 72;
44941  t[47] = 73;
44942  t[58] = 74;
44943  t[60] = 75;
44944  t[62] = 76;
44945  t[68] = 77;
44946  t[69] = 78;
44947  t[75] = 79;
44948  t[87] = 80;
44949  t[89] = 81;
44950  t[90] = 82;
44951  t[94] = 83;
44952  t[100] = 84;
44953  t[104] = 85;
44954  t[115] = 86;
44955  t[116] = 87;
44956  t[121] = 88;
44957  t[122] = 89;
44958  t[127] = 90;
44959  t[258] = 97;
44960  t[268] = 261;
44961  t[271] = 98;
44962  t[272] = 99;
44963  t[273] = 263;
44964  t[282] = 100;
44965  t[286] = 101;
44966  t[295] = 281;
44967  t[296] = 102;
44968  t[336] = 103;
44969  t[346] = 104;
44970  t[349] = 105;
44971  t[361] = 106;
44972  t[364] = 107;
44973  t[367] = 108;
44974  t[371] = 322;
44975  t[373] = 109;
44976  t[374] = 110;
44977  t[381] = 111;
44978  t[383] = 243;
44979  t[393] = 112;
44980  t[395] = 113;
44981  t[396] = 114;
44982  t[400] = 115;
44983  t[401] = 347;
44984  t[410] = 116;
44985  t[437] = 117;
44986  t[448] = 118;
44987  t[449] = 119;
44988  t[454] = 120;
44989  t[455] = 121;
44990  t[460] = 122;
44991  t[463] = 380;
44992  t[853] = 44;
44993  t[855] = 58;
44994  t[856] = 46;
44995  t[876] = 47;
44996  t[878] = 45;
44997  t[882] = 45;
44998  t[894] = 40;
44999  t[895] = 41;
45000  t[896] = 91;
45001  t[897] = 93;
45002  t[923] = 64;
45003  t[1004] = 48;
45004  t[1005] = 49;
45005  t[1006] = 50;
45006  t[1007] = 51;
45007  t[1008] = 52;
45008  t[1009] = 53;
45009  t[1010] = 54;
45010  t[1011] = 55;
45011  t[1012] = 56;
45012  t[1013] = 57;
45013  t[1081] = 37;
45014  t[1085] = 43;
45015  t[1086] = 45;
45016});
45017exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri;
45018
45019/***/ }),
45020/* 180 */
45021/***/ (function(module, exports, __w_pdfjs_require__) {
45022
45023var getLookupTableFactory = __w_pdfjs_require__(154).getLookupTableFactory;
45024var getSpecialPUASymbols = getLookupTableFactory(function (t) {
45025 t[63721] = 0x00A9;
45026 t[63193] = 0x00A9;
45027 t[63720] = 0x00AE;
45028 t[63194] = 0x00AE;
45029 t[63722] = 0x2122;
45030 t[63195] = 0x2122;
45031 t[63729] = 0x23A7;
45032 t[63730] = 0x23A8;
45033 t[63731] = 0x23A9;
45034 t[63740] = 0x23AB;
45035 t[63741] = 0x23AC;
45036 t[63742] = 0x23AD;
45037 t[63726] = 0x23A1;
45038 t[63727] = 0x23A2;
45039 t[63728] = 0x23A3;
45040 t[63737] = 0x23A4;
45041 t[63738] = 0x23A5;
45042 t[63739] = 0x23A6;
45043 t[63723] = 0x239B;
45044 t[63724] = 0x239C;
45045 t[63725] = 0x239D;
45046 t[63734] = 0x239E;
45047 t[63735] = 0x239F;
45048 t[63736] = 0x23A0;
45049});
45050function mapSpecialUnicodeValues(code) {
45051 if (code >= 0xFFF0 && code <= 0xFFFF) {
45052  return 0;
45053 } else if (code >= 0xF600 && code <= 0xF8FF) {
45054  return getSpecialPUASymbols()[code] || code;
45055 } else if (code === 0x00AD) {
45056  return 0x002D;
45057 }
45058 return code;
45059}
45060function getUnicodeForGlyph(name, glyphsUnicodeMap) {
45061 var unicode = glyphsUnicodeMap[name];
45062 if (unicode !== undefined) {
45063  return unicode;
45064 }
45065 if (!name) {
45066  return -1;
45067 }
45068 if (name[0] === 'u') {
45069  var nameLen = name.length, hexStr;
45070  if (nameLen === 7 && name[1] === 'n' && name[2] === 'i') {
45071   hexStr = name.substring(3);
45072  } else if (nameLen >= 5 && nameLen <= 7) {
45073   hexStr = name.substring(1);
45074  } else {
45075   return -1;
45076  }
45077  if (hexStr === hexStr.toUpperCase()) {
45078   unicode = parseInt(hexStr, 16);
45079   if (unicode >= 0) {
45080    return unicode;
45081   }
45082  }
45083 }
45084 return -1;
45085}
45086var UnicodeRanges = [
45087 {
45088  'begin': 0x0000,
45089  'end': 0x007F
45090 },
45091 {
45092  'begin': 0x0080,
45093  'end': 0x00FF
45094 },
45095 {
45096  'begin': 0x0100,
45097  'end': 0x017F
45098 },
45099 {
45100  'begin': 0x0180,
45101  'end': 0x024F
45102 },
45103 {
45104  'begin': 0x0250,
45105  'end': 0x02AF
45106 },
45107 {
45108  'begin': 0x02B0,
45109  'end': 0x02FF
45110 },
45111 {
45112  'begin': 0x0300,
45113  'end': 0x036F
45114 },
45115 {
45116  'begin': 0x0370,
45117  'end': 0x03FF
45118 },
45119 {
45120  'begin': 0x2C80,
45121  'end': 0x2CFF
45122 },
45123 {
45124  'begin': 0x0400,
45125  'end': 0x04FF
45126 },
45127 {
45128  'begin': 0x0530,
45129  'end': 0x058F
45130 },
45131 {
45132  'begin': 0x0590,
45133  'end': 0x05FF
45134 },
45135 {
45136  'begin': 0xA500,
45137  'end': 0xA63F
45138 },
45139 {
45140  'begin': 0x0600,
45141  'end': 0x06FF
45142 },
45143 {
45144  'begin': 0x07C0,
45145  'end': 0x07FF
45146 },
45147 {
45148  'begin': 0x0900,
45149  'end': 0x097F
45150 },
45151 {
45152  'begin': 0x0980,
45153  'end': 0x09FF
45154 },
45155 {
45156  'begin': 0x0A00,
45157  'end': 0x0A7F
45158 },
45159 {
45160  'begin': 0x0A80,
45161  'end': 0x0AFF
45162 },
45163 {
45164  'begin': 0x0B00,
45165  'end': 0x0B7F
45166 },
45167 {
45168  'begin': 0x0B80,
45169  'end': 0x0BFF
45170 },
45171 {
45172  'begin': 0x0C00,
45173  'end': 0x0C7F
45174 },
45175 {
45176  'begin': 0x0C80,
45177  'end': 0x0CFF
45178 },
45179 {
45180  'begin': 0x0D00,
45181  'end': 0x0D7F
45182 },
45183 {
45184  'begin': 0x0E00,
45185  'end': 0x0E7F
45186 },
45187 {
45188  'begin': 0x0E80,
45189  'end': 0x0EFF
45190 },
45191 {
45192  'begin': 0x10A0,
45193  'end': 0x10FF
45194 },
45195 {
45196  'begin': 0x1B00,
45197  'end': 0x1B7F
45198 },
45199 {
45200  'begin': 0x1100,
45201  'end': 0x11FF
45202 },
45203 {
45204  'begin': 0x1E00,
45205  'end': 0x1EFF
45206 },
45207 {
45208  'begin': 0x1F00,
45209  'end': 0x1FFF
45210 },
45211 {
45212  'begin': 0x2000,
45213  'end': 0x206F
45214 },
45215 {
45216  'begin': 0x2070,
45217  'end': 0x209F
45218 },
45219 {
45220  'begin': 0x20A0,
45221  'end': 0x20CF
45222 },
45223 {
45224  'begin': 0x20D0,
45225  'end': 0x20FF
45226 },
45227 {
45228  'begin': 0x2100,
45229  'end': 0x214F
45230 },
45231 {
45232  'begin': 0x2150,
45233  'end': 0x218F
45234 },
45235 {
45236  'begin': 0x2190,
45237  'end': 0x21FF
45238 },
45239 {
45240  'begin': 0x2200,
45241  'end': 0x22FF
45242 },
45243 {
45244  'begin': 0x2300,
45245  'end': 0x23FF
45246 },
45247 {
45248  'begin': 0x2400,
45249  'end': 0x243F
45250 },
45251 {
45252  'begin': 0x2440,
45253  'end': 0x245F
45254 },
45255 {
45256  'begin': 0x2460,
45257  'end': 0x24FF
45258 },
45259 {
45260  'begin': 0x2500,
45261  'end': 0x257F
45262 },
45263 {
45264  'begin': 0x2580,
45265  'end': 0x259F
45266 },
45267 {
45268  'begin': 0x25A0,
45269  'end': 0x25FF
45270 },
45271 {
45272  'begin': 0x2600,
45273  'end': 0x26FF
45274 },
45275 {
45276  'begin': 0x2700,
45277  'end': 0x27BF
45278 },
45279 {
45280  'begin': 0x3000,
45281  'end': 0x303F
45282 },
45283 {
45284  'begin': 0x3040,
45285  'end': 0x309F
45286 },
45287 {
45288  'begin': 0x30A0,
45289  'end': 0x30FF
45290 },
45291 {
45292  'begin': 0x3100,
45293  'end': 0x312F
45294 },
45295 {
45296  'begin': 0x3130,
45297  'end': 0x318F
45298 },
45299 {
45300  'begin': 0xA840,
45301  'end': 0xA87F
45302 },
45303 {
45304  'begin': 0x3200,
45305  'end': 0x32FF
45306 },
45307 {
45308  'begin': 0x3300,
45309  'end': 0x33FF
45310 },
45311 {
45312  'begin': 0xAC00,
45313  'end': 0xD7AF
45314 },
45315 {
45316  'begin': 0xD800,
45317  'end': 0xDFFF
45318 },
45319 {
45320  'begin': 0x10900,
45321  'end': 0x1091F
45322 },
45323 {
45324  'begin': 0x4E00,
45325  'end': 0x9FFF
45326 },
45327 {
45328  'begin': 0xE000,
45329  'end': 0xF8FF
45330 },
45331 {
45332  'begin': 0x31C0,
45333  'end': 0x31EF
45334 },
45335 {
45336  'begin': 0xFB00,
45337  'end': 0xFB4F
45338 },
45339 {
45340  'begin': 0xFB50,
45341  'end': 0xFDFF
45342 },
45343 {
45344  'begin': 0xFE20,
45345  'end': 0xFE2F
45346 },
45347 {
45348  'begin': 0xFE10,
45349  'end': 0xFE1F
45350 },
45351 {
45352  'begin': 0xFE50,
45353  'end': 0xFE6F
45354 },
45355 {
45356  'begin': 0xFE70,
45357  'end': 0xFEFF
45358 },
45359 {
45360  'begin': 0xFF00,
45361  'end': 0xFFEF
45362 },
45363 {
45364  'begin': 0xFFF0,
45365  'end': 0xFFFF
45366 },
45367 {
45368  'begin': 0x0F00,
45369  'end': 0x0FFF
45370 },
45371 {
45372  'begin': 0x0700,
45373  'end': 0x074F
45374 },
45375 {
45376  'begin': 0x0780,
45377  'end': 0x07BF
45378 },
45379 {
45380  'begin': 0x0D80,
45381  'end': 0x0DFF
45382 },
45383 {
45384  'begin': 0x1000,
45385  'end': 0x109F
45386 },
45387 {
45388  'begin': 0x1200,
45389  'end': 0x137F
45390 },
45391 {
45392  'begin': 0x13A0,
45393  'end': 0x13FF
45394 },
45395 {
45396  'begin': 0x1400,
45397  'end': 0x167F
45398 },
45399 {
45400  'begin': 0x1680,
45401  'end': 0x169F
45402 },
45403 {
45404  'begin': 0x16A0,
45405  'end': 0x16FF
45406 },
45407 {
45408  'begin': 0x1780,
45409  'end': 0x17FF
45410 },
45411 {
45412  'begin': 0x1800,
45413  'end': 0x18AF
45414 },
45415 {
45416  'begin': 0x2800,
45417  'end': 0x28FF
45418 },
45419 {
45420  'begin': 0xA000,
45421  'end': 0xA48F
45422 },
45423 {
45424  'begin': 0x1700,
45425  'end': 0x171F
45426 },
45427 {
45428  'begin': 0x10300,
45429  'end': 0x1032F
45430 },
45431 {
45432  'begin': 0x10330,
45433  'end': 0x1034F
45434 },
45435 {
45436  'begin': 0x10400,
45437  'end': 0x1044F
45438 },
45439 {
45440  'begin': 0x1D000,
45441  'end': 0x1D0FF
45442 },
45443 {
45444  'begin': 0x1D400,
45445  'end': 0x1D7FF
45446 },
45447 {
45448  'begin': 0xFF000,
45449  'end': 0xFFFFD
45450 },
45451 {
45452  'begin': 0xFE00,
45453  'end': 0xFE0F
45454 },
45455 {
45456  'begin': 0xE0000,
45457  'end': 0xE007F
45458 },
45459 {
45460  'begin': 0x1900,
45461  'end': 0x194F
45462 },
45463 {
45464  'begin': 0x1950,
45465  'end': 0x197F
45466 },
45467 {
45468  'begin': 0x1980,
45469  'end': 0x19DF
45470 },
45471 {
45472  'begin': 0x1A00,
45473  'end': 0x1A1F
45474 },
45475 {
45476  'begin': 0x2C00,
45477  'end': 0x2C5F
45478 },
45479 {
45480  'begin': 0x2D30,
45481  'end': 0x2D7F
45482 },
45483 {
45484  'begin': 0x4DC0,
45485  'end': 0x4DFF
45486 },
45487 {
45488  'begin': 0xA800,
45489  'end': 0xA82F
45490 },
45491 {
45492  'begin': 0x10000,
45493  'end': 0x1007F
45494 },
45495 {
45496  'begin': 0x10140,
45497  'end': 0x1018F
45498 },
45499 {
45500  'begin': 0x10380,
45501  'end': 0x1039F
45502 },
45503 {
45504  'begin': 0x103A0,
45505  'end': 0x103DF
45506 },
45507 {
45508  'begin': 0x10450,
45509  'end': 0x1047F
45510 },
45511 {
45512  'begin': 0x10480,
45513  'end': 0x104AF
45514 },
45515 {
45516  'begin': 0x10800,
45517  'end': 0x1083F
45518 },
45519 {
45520  'begin': 0x10A00,
45521  'end': 0x10A5F
45522 },
45523 {
45524  'begin': 0x1D300,
45525  'end': 0x1D35F
45526 },
45527 {
45528  'begin': 0x12000,
45529  'end': 0x123FF
45530 },
45531 {
45532  'begin': 0x1D360,
45533  'end': 0x1D37F
45534 },
45535 {
45536  'begin': 0x1B80,
45537  'end': 0x1BBF
45538 },
45539 {
45540  'begin': 0x1C00,
45541  'end': 0x1C4F
45542 },
45543 {
45544  'begin': 0x1C50,
45545  'end': 0x1C7F
45546 },
45547 {
45548  'begin': 0xA880,
45549  'end': 0xA8DF
45550 },
45551 {
45552  'begin': 0xA900,
45553  'end': 0xA92F
45554 },
45555 {
45556  'begin': 0xA930,
45557  'end': 0xA95F
45558 },
45559 {
45560  'begin': 0xAA00,
45561  'end': 0xAA5F
45562 },
45563 {
45564  'begin': 0x10190,
45565  'end': 0x101CF
45566 },
45567 {
45568  'begin': 0x101D0,
45569  'end': 0x101FF
45570 },
45571 {
45572  'begin': 0x102A0,
45573  'end': 0x102DF
45574 },
45575 {
45576  'begin': 0x1F030,
45577  'end': 0x1F09F
45578 }
45579];
45580function getUnicodeRangeFor(value) {
45581 for (var i = 0, ii = UnicodeRanges.length; i < ii; i++) {
45582  var range = UnicodeRanges[i];
45583  if (value >= range.begin && value < range.end) {
45584   return i;
45585  }
45586 }
45587 return -1;
45588}
45589function isRTLRangeFor(value) {
45590 var range = UnicodeRanges[13];
45591 if (value >= range.begin && value < range.end) {
45592  return true;
45593 }
45594 range = UnicodeRanges[11];
45595 if (value >= range.begin && value < range.end) {
45596  return true;
45597 }
45598 return false;
45599}
45600var getNormalizedUnicodes = getLookupTableFactory(function (t) {
45601 t['\u00A8'] = '\u0020\u0308';
45602 t['\u00AF'] = '\u0020\u0304';
45603 t['\u00B4'] = '\u0020\u0301';
45604 t['\u00B5'] = '\u03BC';
45605 t['\u00B8'] = '\u0020\u0327';
45606 t['\u0132'] = '\u0049\u004A';
45607 t['\u0133'] = '\u0069\u006A';
45608 t['\u013F'] = '\u004C\u00B7';
45609 t['\u0140'] = '\u006C\u00B7';
45610 t['\u0149'] = '\u02BC\u006E';
45611 t['\u017F'] = '\u0073';
45612 t['\u01C4'] = '\u0044\u017D';
45613 t['\u01C5'] = '\u0044\u017E';
45614 t['\u01C6'] = '\u0064\u017E';
45615 t['\u01C7'] = '\u004C\u004A';
45616 t['\u01C8'] = '\u004C\u006A';
45617 t['\u01C9'] = '\u006C\u006A';
45618 t['\u01CA'] = '\u004E\u004A';
45619 t['\u01CB'] = '\u004E\u006A';
45620 t['\u01CC'] = '\u006E\u006A';
45621 t['\u01F1'] = '\u0044\u005A';
45622 t['\u01F2'] = '\u0044\u007A';
45623 t['\u01F3'] = '\u0064\u007A';
45624 t['\u02D8'] = '\u0020\u0306';
45625 t['\u02D9'] = '\u0020\u0307';
45626 t['\u02DA'] = '\u0020\u030A';
45627 t['\u02DB'] = '\u0020\u0328';
45628 t['\u02DC'] = '\u0020\u0303';
45629 t['\u02DD'] = '\u0020\u030B';
45630 t['\u037A'] = '\u0020\u0345';
45631 t['\u0384'] = '\u0020\u0301';
45632 t['\u03D0'] = '\u03B2';
45633 t['\u03D1'] = '\u03B8';
45634 t['\u03D2'] = '\u03A5';
45635 t['\u03D5'] = '\u03C6';
45636 t['\u03D6'] = '\u03C0';
45637 t['\u03F0'] = '\u03BA';
45638 t['\u03F1'] = '\u03C1';
45639 t['\u03F2'] = '\u03C2';
45640 t['\u03F4'] = '\u0398';
45641 t['\u03F5'] = '\u03B5';
45642 t['\u03F9'] = '\u03A3';
45643 t['\u0587'] = '\u0565\u0582';
45644 t['\u0675'] = '\u0627\u0674';
45645 t['\u0676'] = '\u0648\u0674';
45646 t['\u0677'] = '\u06C7\u0674';
45647 t['\u0678'] = '\u064A\u0674';
45648 t['\u0E33'] = '\u0E4D\u0E32';
45649 t['\u0EB3'] = '\u0ECD\u0EB2';
45650 t['\u0EDC'] = '\u0EAB\u0E99';
45651 t['\u0EDD'] = '\u0EAB\u0EA1';
45652 t['\u0F77'] = '\u0FB2\u0F81';
45653 t['\u0F79'] = '\u0FB3\u0F81';
45654 t['\u1E9A'] = '\u0061\u02BE';
45655 t['\u1FBD'] = '\u0020\u0313';
45656 t['\u1FBF'] = '\u0020\u0313';
45657 t['\u1FC0'] = '\u0020\u0342';
45658 t['\u1FFE'] = '\u0020\u0314';
45659 t['\u2002'] = '\u0020';
45660 t['\u2003'] = '\u0020';
45661 t['\u2004'] = '\u0020';
45662 t['\u2005'] = '\u0020';
45663 t['\u2006'] = '\u0020';
45664 t['\u2008'] = '\u0020';
45665 t['\u2009'] = '\u0020';
45666 t['\u200A'] = '\u0020';
45667 t['\u2017'] = '\u0020\u0333';
45668 t['\u2024'] = '\u002E';
45669 t['\u2025'] = '\u002E\u002E';
45670 t['\u2026'] = '\u002E\u002E\u002E';
45671 t['\u2033'] = '\u2032\u2032';
45672 t['\u2034'] = '\u2032\u2032\u2032';
45673 t['\u2036'] = '\u2035\u2035';
45674 t['\u2037'] = '\u2035\u2035\u2035';
45675 t['\u203C'] = '\u0021\u0021';
45676 t['\u203E'] = '\u0020\u0305';
45677 t['\u2047'] = '\u003F\u003F';
45678 t['\u2048'] = '\u003F\u0021';
45679 t['\u2049'] = '\u0021\u003F';
45680 t['\u2057'] = '\u2032\u2032\u2032\u2032';
45681 t['\u205F'] = '\u0020';
45682 t['\u20A8'] = '\u0052\u0073';
45683 t['\u2100'] = '\u0061\u002F\u0063';
45684 t['\u2101'] = '\u0061\u002F\u0073';
45685 t['\u2103'] = '\u00B0\u0043';
45686 t['\u2105'] = '\u0063\u002F\u006F';
45687 t['\u2106'] = '\u0063\u002F\u0075';
45688 t['\u2107'] = '\u0190';
45689 t['\u2109'] = '\u00B0\u0046';
45690 t['\u2116'] = '\u004E\u006F';
45691 t['\u2121'] = '\u0054\u0045\u004C';
45692 t['\u2135'] = '\u05D0';
45693 t['\u2136'] = '\u05D1';
45694 t['\u2137'] = '\u05D2';
45695 t['\u2138'] = '\u05D3';
45696 t['\u213B'] = '\u0046\u0041\u0058';
45697 t['\u2160'] = '\u0049';
45698 t['\u2161'] = '\u0049\u0049';
45699 t['\u2162'] = '\u0049\u0049\u0049';
45700 t['\u2163'] = '\u0049\u0056';
45701 t['\u2164'] = '\u0056';
45702 t['\u2165'] = '\u0056\u0049';
45703 t['\u2166'] = '\u0056\u0049\u0049';
45704 t['\u2167'] = '\u0056\u0049\u0049\u0049';
45705 t['\u2168'] = '\u0049\u0058';
45706 t['\u2169'] = '\u0058';
45707 t['\u216A'] = '\u0058\u0049';
45708 t['\u216B'] = '\u0058\u0049\u0049';
45709 t['\u216C'] = '\u004C';
45710 t['\u216D'] = '\u0043';
45711 t['\u216E'] = '\u0044';
45712 t['\u216F'] = '\u004D';
45713 t['\u2170'] = '\u0069';
45714 t['\u2171'] = '\u0069\u0069';
45715 t['\u2172'] = '\u0069\u0069\u0069';
45716 t['\u2173'] = '\u0069\u0076';
45717 t['\u2174'] = '\u0076';
45718 t['\u2175'] = '\u0076\u0069';
45719 t['\u2176'] = '\u0076\u0069\u0069';
45720 t['\u2177'] = '\u0076\u0069\u0069\u0069';
45721 t['\u2178'] = '\u0069\u0078';
45722 t['\u2179'] = '\u0078';
45723 t['\u217A'] = '\u0078\u0069';
45724 t['\u217B'] = '\u0078\u0069\u0069';
45725 t['\u217C'] = '\u006C';
45726 t['\u217D'] = '\u0063';
45727 t['\u217E'] = '\u0064';
45728 t['\u217F'] = '\u006D';
45729 t['\u222C'] = '\u222B\u222B';
45730 t['\u222D'] = '\u222B\u222B\u222B';
45731 t['\u222F'] = '\u222E\u222E';
45732 t['\u2230'] = '\u222E\u222E\u222E';
45733 t['\u2474'] = '\u0028\u0031\u0029';
45734 t['\u2475'] = '\u0028\u0032\u0029';
45735 t['\u2476'] = '\u0028\u0033\u0029';
45736 t['\u2477'] = '\u0028\u0034\u0029';
45737 t['\u2478'] = '\u0028\u0035\u0029';
45738 t['\u2479'] = '\u0028\u0036\u0029';
45739 t['\u247A'] = '\u0028\u0037\u0029';
45740 t['\u247B'] = '\u0028\u0038\u0029';
45741 t['\u247C'] = '\u0028\u0039\u0029';
45742 t['\u247D'] = '\u0028\u0031\u0030\u0029';
45743 t['\u247E'] = '\u0028\u0031\u0031\u0029';
45744 t['\u247F'] = '\u0028\u0031\u0032\u0029';
45745 t['\u2480'] = '\u0028\u0031\u0033\u0029';
45746 t['\u2481'] = '\u0028\u0031\u0034\u0029';
45747 t['\u2482'] = '\u0028\u0031\u0035\u0029';
45748 t['\u2483'] = '\u0028\u0031\u0036\u0029';
45749 t['\u2484'] = '\u0028\u0031\u0037\u0029';
45750 t['\u2485'] = '\u0028\u0031\u0038\u0029';
45751 t['\u2486'] = '\u0028\u0031\u0039\u0029';
45752 t['\u2487'] = '\u0028\u0032\u0030\u0029';
45753 t['\u2488'] = '\u0031\u002E';
45754 t['\u2489'] = '\u0032\u002E';
45755 t['\u248A'] = '\u0033\u002E';
45756 t['\u248B'] = '\u0034\u002E';
45757 t['\u248C'] = '\u0035\u002E';
45758 t['\u248D'] = '\u0036\u002E';
45759 t['\u248E'] = '\u0037\u002E';
45760 t['\u248F'] = '\u0038\u002E';
45761 t['\u2490'] = '\u0039\u002E';
45762 t['\u2491'] = '\u0031\u0030\u002E';
45763 t['\u2492'] = '\u0031\u0031\u002E';
45764 t['\u2493'] = '\u0031\u0032\u002E';
45765 t['\u2494'] = '\u0031\u0033\u002E';
45766 t['\u2495'] = '\u0031\u0034\u002E';
45767 t['\u2496'] = '\u0031\u0035\u002E';
45768 t['\u2497'] = '\u0031\u0036\u002E';
45769 t['\u2498'] = '\u0031\u0037\u002E';
45770 t['\u2499'] = '\u0031\u0038\u002E';
45771 t['\u249A'] = '\u0031\u0039\u002E';
45772 t['\u249B'] = '\u0032\u0030\u002E';
45773 t['\u249C'] = '\u0028\u0061\u0029';
45774 t['\u249D'] = '\u0028\u0062\u0029';
45775 t['\u249E'] = '\u0028\u0063\u0029';
45776 t['\u249F'] = '\u0028\u0064\u0029';
45777 t['\u24A0'] = '\u0028\u0065\u0029';
45778 t['\u24A1'] = '\u0028\u0066\u0029';
45779 t['\u24A2'] = '\u0028\u0067\u0029';
45780 t['\u24A3'] = '\u0028\u0068\u0029';
45781 t['\u24A4'] = '\u0028\u0069\u0029';
45782 t['\u24A5'] = '\u0028\u006A\u0029';
45783 t['\u24A6'] = '\u0028\u006B\u0029';
45784 t['\u24A7'] = '\u0028\u006C\u0029';
45785 t['\u24A8'] = '\u0028\u006D\u0029';
45786 t['\u24A9'] = '\u0028\u006E\u0029';
45787 t['\u24AA'] = '\u0028\u006F\u0029';
45788 t['\u24AB'] = '\u0028\u0070\u0029';
45789 t['\u24AC'] = '\u0028\u0071\u0029';
45790 t['\u24AD'] = '\u0028\u0072\u0029';
45791 t['\u24AE'] = '\u0028\u0073\u0029';
45792 t['\u24AF'] = '\u0028\u0074\u0029';
45793 t['\u24B0'] = '\u0028\u0075\u0029';
45794 t['\u24B1'] = '\u0028\u0076\u0029';
45795 t['\u24B2'] = '\u0028\u0077\u0029';
45796 t['\u24B3'] = '\u0028\u0078\u0029';
45797 t['\u24B4'] = '\u0028\u0079\u0029';
45798 t['\u24B5'] = '\u0028\u007A\u0029';
45799 t['\u2A0C'] = '\u222B\u222B\u222B\u222B';
45800 t['\u2A74'] = '\u003A\u003A\u003D';
45801 t['\u2A75'] = '\u003D\u003D';
45802 t['\u2A76'] = '\u003D\u003D\u003D';
45803 t['\u2E9F'] = '\u6BCD';
45804 t['\u2EF3'] = '\u9F9F';
45805 t['\u2F00'] = '\u4E00';
45806 t['\u2F01'] = '\u4E28';
45807 t['\u2F02'] = '\u4E36';
45808 t['\u2F03'] = '\u4E3F';
45809 t['\u2F04'] = '\u4E59';
45810 t['\u2F05'] = '\u4E85';
45811 t['\u2F06'] = '\u4E8C';
45812 t['\u2F07'] = '\u4EA0';
45813 t['\u2F08'] = '\u4EBA';
45814 t['\u2F09'] = '\u513F';
45815 t['\u2F0A'] = '\u5165';
45816 t['\u2F0B'] = '\u516B';
45817 t['\u2F0C'] = '\u5182';
45818 t['\u2F0D'] = '\u5196';
45819 t['\u2F0E'] = '\u51AB';
45820 t['\u2F0F'] = '\u51E0';
45821 t['\u2F10'] = '\u51F5';
45822 t['\u2F11'] = '\u5200';
45823 t['\u2F12'] = '\u529B';
45824 t['\u2F13'] = '\u52F9';
45825 t['\u2F14'] = '\u5315';
45826 t['\u2F15'] = '\u531A';
45827 t['\u2F16'] = '\u5338';
45828 t['\u2F17'] = '\u5341';
45829 t['\u2F18'] = '\u535C';
45830 t['\u2F19'] = '\u5369';
45831 t['\u2F1A'] = '\u5382';
45832 t['\u2F1B'] = '\u53B6';
45833 t['\u2F1C'] = '\u53C8';
45834 t['\u2F1D'] = '\u53E3';
45835 t['\u2F1E'] = '\u56D7';
45836 t['\u2F1F'] = '\u571F';
45837 t['\u2F20'] = '\u58EB';
45838 t['\u2F21'] = '\u5902';
45839 t['\u2F22'] = '\u590A';
45840 t['\u2F23'] = '\u5915';
45841 t['\u2F24'] = '\u5927';
45842 t['\u2F25'] = '\u5973';
45843 t['\u2F26'] = '\u5B50';
45844 t['\u2F27'] = '\u5B80';
45845 t['\u2F28'] = '\u5BF8';
45846 t['\u2F29'] = '\u5C0F';
45847 t['\u2F2A'] = '\u5C22';
45848 t['\u2F2B'] = '\u5C38';
45849 t['\u2F2C'] = '\u5C6E';
45850 t['\u2F2D'] = '\u5C71';
45851 t['\u2F2E'] = '\u5DDB';
45852 t['\u2F2F'] = '\u5DE5';
45853 t['\u2F30'] = '\u5DF1';
45854 t['\u2F31'] = '\u5DFE';
45855 t['\u2F32'] = '\u5E72';
45856 t['\u2F33'] = '\u5E7A';
45857 t['\u2F34'] = '\u5E7F';
45858 t['\u2F35'] = '\u5EF4';
45859 t['\u2F36'] = '\u5EFE';
45860 t['\u2F37'] = '\u5F0B';
45861 t['\u2F38'] = '\u5F13';
45862 t['\u2F39'] = '\u5F50';
45863 t['\u2F3A'] = '\u5F61';
45864 t['\u2F3B'] = '\u5F73';
45865 t['\u2F3C'] = '\u5FC3';
45866 t['\u2F3D'] = '\u6208';
45867 t['\u2F3E'] = '\u6236';
45868 t['\u2F3F'] = '\u624B';
45869 t['\u2F40'] = '\u652F';
45870 t['\u2F41'] = '\u6534';
45871 t['\u2F42'] = '\u6587';
45872 t['\u2F43'] = '\u6597';
45873 t['\u2F44'] = '\u65A4';
45874 t['\u2F45'] = '\u65B9';
45875 t['\u2F46'] = '\u65E0';
45876 t['\u2F47'] = '\u65E5';
45877 t['\u2F48'] = '\u66F0';
45878 t['\u2F49'] = '\u6708';
45879 t['\u2F4A'] = '\u6728';
45880 t['\u2F4B'] = '\u6B20';
45881 t['\u2F4C'] = '\u6B62';
45882 t['\u2F4D'] = '\u6B79';
45883 t['\u2F4E'] = '\u6BB3';
45884 t['\u2F4F'] = '\u6BCB';
45885 t['\u2F50'] = '\u6BD4';
45886 t['\u2F51'] = '\u6BDB';
45887 t['\u2F52'] = '\u6C0F';
45888 t['\u2F53'] = '\u6C14';
45889 t['\u2F54'] = '\u6C34';
45890 t['\u2F55'] = '\u706B';
45891 t['\u2F56'] = '\u722A';
45892 t['\u2F57'] = '\u7236';
45893 t['\u2F58'] = '\u723B';
45894 t['\u2F59'] = '\u723F';
45895 t['\u2F5A'] = '\u7247';
45896 t['\u2F5B'] = '\u7259';
45897 t['\u2F5C'] = '\u725B';
45898 t['\u2F5D'] = '\u72AC';
45899 t['\u2F5E'] = '\u7384';
45900 t['\u2F5F'] = '\u7389';
45901 t['\u2F60'] = '\u74DC';
45902 t['\u2F61'] = '\u74E6';
45903 t['\u2F62'] = '\u7518';
45904 t['\u2F63'] = '\u751F';
45905 t['\u2F64'] = '\u7528';
45906 t['\u2F65'] = '\u7530';
45907 t['\u2F66'] = '\u758B';
45908 t['\u2F67'] = '\u7592';
45909 t['\u2F68'] = '\u7676';
45910 t['\u2F69'] = '\u767D';
45911 t['\u2F6A'] = '\u76AE';
45912 t['\u2F6B'] = '\u76BF';
45913 t['\u2F6C'] = '\u76EE';
45914 t['\u2F6D'] = '\u77DB';
45915 t['\u2F6E'] = '\u77E2';
45916 t['\u2F6F'] = '\u77F3';
45917 t['\u2F70'] = '\u793A';
45918 t['\u2F71'] = '\u79B8';
45919 t['\u2F72'] = '\u79BE';
45920 t['\u2F73'] = '\u7A74';
45921 t['\u2F74'] = '\u7ACB';
45922 t['\u2F75'] = '\u7AF9';
45923 t['\u2F76'] = '\u7C73';
45924 t['\u2F77'] = '\u7CF8';
45925 t['\u2F78'] = '\u7F36';
45926 t['\u2F79'] = '\u7F51';
45927 t['\u2F7A'] = '\u7F8A';
45928 t['\u2F7B'] = '\u7FBD';
45929 t['\u2F7C'] = '\u8001';
45930 t['\u2F7D'] = '\u800C';
45931 t['\u2F7E'] = '\u8012';
45932 t['\u2F7F'] = '\u8033';
45933 t['\u2F80'] = '\u807F';
45934 t['\u2F81'] = '\u8089';
45935 t['\u2F82'] = '\u81E3';
45936 t['\u2F83'] = '\u81EA';
45937 t['\u2F84'] = '\u81F3';
45938 t['\u2F85'] = '\u81FC';
45939 t['\u2F86'] = '\u820C';
45940 t['\u2F87'] = '\u821B';
45941 t['\u2F88'] = '\u821F';
45942 t['\u2F89'] = '\u826E';
45943 t['\u2F8A'] = '\u8272';
45944 t['\u2F8B'] = '\u8278';
45945 t['\u2F8C'] = '\u864D';
45946 t['\u2F8D'] = '\u866B';
45947 t['\u2F8E'] = '\u8840';
45948 t['\u2F8F'] = '\u884C';
45949 t['\u2F90'] = '\u8863';
45950 t['\u2F91'] = '\u897E';
45951 t['\u2F92'] = '\u898B';
45952 t['\u2F93'] = '\u89D2';
45953 t['\u2F94'] = '\u8A00';
45954 t['\u2F95'] = '\u8C37';
45955 t['\u2F96'] = '\u8C46';
45956 t['\u2F97'] = '\u8C55';
45957 t['\u2F98'] = '\u8C78';
45958 t['\u2F99'] = '\u8C9D';
45959 t['\u2F9A'] = '\u8D64';
45960 t['\u2F9B'] = '\u8D70';
45961 t['\u2F9C'] = '\u8DB3';
45962 t['\u2F9D'] = '\u8EAB';
45963 t['\u2F9E'] = '\u8ECA';
45964 t['\u2F9F'] = '\u8F9B';
45965 t['\u2FA0'] = '\u8FB0';
45966 t['\u2FA1'] = '\u8FB5';
45967 t['\u2FA2'] = '\u9091';
45968 t['\u2FA3'] = '\u9149';
45969 t['\u2FA4'] = '\u91C6';
45970 t['\u2FA5'] = '\u91CC';
45971 t['\u2FA6'] = '\u91D1';
45972 t['\u2FA7'] = '\u9577';
45973 t['\u2FA8'] = '\u9580';
45974 t['\u2FA9'] = '\u961C';
45975 t['\u2FAA'] = '\u96B6';
45976 t['\u2FAB'] = '\u96B9';
45977 t['\u2FAC'] = '\u96E8';
45978 t['\u2FAD'] = '\u9751';
45979 t['\u2FAE'] = '\u975E';
45980 t['\u2FAF'] = '\u9762';
45981 t['\u2FB0'] = '\u9769';
45982 t['\u2FB1'] = '\u97CB';
45983 t['\u2FB2'] = '\u97ED';
45984 t['\u2FB3'] = '\u97F3';
45985 t['\u2FB4'] = '\u9801';
45986 t['\u2FB5'] = '\u98A8';
45987 t['\u2FB6'] = '\u98DB';
45988 t['\u2FB7'] = '\u98DF';
45989 t['\u2FB8'] = '\u9996';
45990 t['\u2FB9'] = '\u9999';
45991 t['\u2FBA'] = '\u99AC';
45992 t['\u2FBB'] = '\u9AA8';
45993 t['\u2FBC'] = '\u9AD8';
45994 t['\u2FBD'] = '\u9ADF';
45995 t['\u2FBE'] = '\u9B25';
45996 t['\u2FBF'] = '\u9B2F';
45997 t['\u2FC0'] = '\u9B32';
45998 t['\u2FC1'] = '\u9B3C';
45999 t['\u2FC2'] = '\u9B5A';
46000 t['\u2FC3'] = '\u9CE5';
46001 t['\u2FC4'] = '\u9E75';
46002 t['\u2FC5'] = '\u9E7F';
46003 t['\u2FC6'] = '\u9EA5';
46004 t['\u2FC7'] = '\u9EBB';
46005 t['\u2FC8'] = '\u9EC3';
46006 t['\u2FC9'] = '\u9ECD';
46007 t['\u2FCA'] = '\u9ED1';
46008 t['\u2FCB'] = '\u9EF9';
46009 t['\u2FCC'] = '\u9EFD';
46010 t['\u2FCD'] = '\u9F0E';
46011 t['\u2FCE'] = '\u9F13';
46012 t['\u2FCF'] = '\u9F20';
46013 t['\u2FD0'] = '\u9F3B';
46014 t['\u2FD1'] = '\u9F4A';
46015 t['\u2FD2'] = '\u9F52';
46016 t['\u2FD3'] = '\u9F8D';
46017 t['\u2FD4'] = '\u9F9C';
46018 t['\u2FD5'] = '\u9FA0';
46019 t['\u3036'] = '\u3012';
46020 t['\u3038'] = '\u5341';
46021 t['\u3039'] = '\u5344';
46022 t['\u303A'] = '\u5345';
46023 t['\u309B'] = '\u0020\u3099';
46024 t['\u309C'] = '\u0020\u309A';
46025 t['\u3131'] = '\u1100';
46026 t['\u3132'] = '\u1101';
46027 t['\u3133'] = '\u11AA';
46028 t['\u3134'] = '\u1102';
46029 t['\u3135'] = '\u11AC';
46030 t['\u3136'] = '\u11AD';
46031 t['\u3137'] = '\u1103';
46032 t['\u3138'] = '\u1104';
46033 t['\u3139'] = '\u1105';
46034 t['\u313A'] = '\u11B0';
46035 t['\u313B'] = '\u11B1';
46036 t['\u313C'] = '\u11B2';
46037 t['\u313D'] = '\u11B3';
46038 t['\u313E'] = '\u11B4';
46039 t['\u313F'] = '\u11B5';
46040 t['\u3140'] = '\u111A';
46041 t['\u3141'] = '\u1106';
46042 t['\u3142'] = '\u1107';
46043 t['\u3143'] = '\u1108';
46044 t['\u3144'] = '\u1121';
46045 t['\u3145'] = '\u1109';
46046 t['\u3146'] = '\u110A';
46047 t['\u3147'] = '\u110B';
46048 t['\u3148'] = '\u110C';
46049 t['\u3149'] = '\u110D';
46050 t['\u314A'] = '\u110E';
46051 t['\u314B'] = '\u110F';
46052 t['\u314C'] = '\u1110';
46053 t['\u314D'] = '\u1111';
46054 t['\u314E'] = '\u1112';
46055 t['\u314F'] = '\u1161';
46056 t['\u3150'] = '\u1162';
46057 t['\u3151'] = '\u1163';
46058 t['\u3152'] = '\u1164';
46059 t['\u3153'] = '\u1165';
46060 t['\u3154'] = '\u1166';
46061 t['\u3155'] = '\u1167';
46062 t['\u3156'] = '\u1168';
46063 t['\u3157'] = '\u1169';
46064 t['\u3158'] = '\u116A';
46065 t['\u3159'] = '\u116B';
46066 t['\u315A'] = '\u116C';
46067 t['\u315B'] = '\u116D';
46068 t['\u315C'] = '\u116E';
46069 t['\u315D'] = '\u116F';
46070 t['\u315E'] = '\u1170';
46071 t['\u315F'] = '\u1171';
46072 t['\u3160'] = '\u1172';
46073 t['\u3161'] = '\u1173';
46074 t['\u3162'] = '\u1174';
46075 t['\u3163'] = '\u1175';
46076 t['\u3164'] = '\u1160';
46077 t['\u3165'] = '\u1114';
46078 t['\u3166'] = '\u1115';
46079 t['\u3167'] = '\u11C7';
46080 t['\u3168'] = '\u11C8';
46081 t['\u3169'] = '\u11CC';
46082 t['\u316A'] = '\u11CE';
46083 t['\u316B'] = '\u11D3';
46084 t['\u316C'] = '\u11D7';
46085 t['\u316D'] = '\u11D9';
46086 t['\u316E'] = '\u111C';
46087 t['\u316F'] = '\u11DD';
46088 t['\u3170'] = '\u11DF';
46089 t['\u3171'] = '\u111D';
46090 t['\u3172'] = '\u111E';
46091 t['\u3173'] = '\u1120';
46092 t['\u3174'] = '\u1122';
46093 t['\u3175'] = '\u1123';
46094 t['\u3176'] = '\u1127';
46095 t['\u3177'] = '\u1129';
46096 t['\u3178'] = '\u112B';
46097 t['\u3179'] = '\u112C';
46098 t['\u317A'] = '\u112D';
46099 t['\u317B'] = '\u112E';
46100 t['\u317C'] = '\u112F';
46101 t['\u317D'] = '\u1132';
46102 t['\u317E'] = '\u1136';
46103 t['\u317F'] = '\u1140';
46104 t['\u3180'] = '\u1147';
46105 t['\u3181'] = '\u114C';
46106 t['\u3182'] = '\u11F1';
46107 t['\u3183'] = '\u11F2';
46108 t['\u3184'] = '\u1157';
46109 t['\u3185'] = '\u1158';
46110 t['\u3186'] = '\u1159';
46111 t['\u3187'] = '\u1184';
46112 t['\u3188'] = '\u1185';
46113 t['\u3189'] = '\u1188';
46114 t['\u318A'] = '\u1191';
46115 t['\u318B'] = '\u1192';
46116 t['\u318C'] = '\u1194';
46117 t['\u318D'] = '\u119E';
46118 t['\u318E'] = '\u11A1';
46119 t['\u3200'] = '\u0028\u1100\u0029';
46120 t['\u3201'] = '\u0028\u1102\u0029';
46121 t['\u3202'] = '\u0028\u1103\u0029';
46122 t['\u3203'] = '\u0028\u1105\u0029';
46123 t['\u3204'] = '\u0028\u1106\u0029';
46124 t['\u3205'] = '\u0028\u1107\u0029';
46125 t['\u3206'] = '\u0028\u1109\u0029';
46126 t['\u3207'] = '\u0028\u110B\u0029';
46127 t['\u3208'] = '\u0028\u110C\u0029';
46128 t['\u3209'] = '\u0028\u110E\u0029';
46129 t['\u320A'] = '\u0028\u110F\u0029';
46130 t['\u320B'] = '\u0028\u1110\u0029';
46131 t['\u320C'] = '\u0028\u1111\u0029';
46132 t['\u320D'] = '\u0028\u1112\u0029';
46133 t['\u320E'] = '\u0028\u1100\u1161\u0029';
46134 t['\u320F'] = '\u0028\u1102\u1161\u0029';
46135 t['\u3210'] = '\u0028\u1103\u1161\u0029';
46136 t['\u3211'] = '\u0028\u1105\u1161\u0029';
46137 t['\u3212'] = '\u0028\u1106\u1161\u0029';
46138 t['\u3213'] = '\u0028\u1107\u1161\u0029';
46139 t['\u3214'] = '\u0028\u1109\u1161\u0029';
46140 t['\u3215'] = '\u0028\u110B\u1161\u0029';
46141 t['\u3216'] = '\u0028\u110C\u1161\u0029';
46142 t['\u3217'] = '\u0028\u110E\u1161\u0029';
46143 t['\u3218'] = '\u0028\u110F\u1161\u0029';
46144 t['\u3219'] = '\u0028\u1110\u1161\u0029';
46145 t['\u321A'] = '\u0028\u1111\u1161\u0029';
46146 t['\u321B'] = '\u0028\u1112\u1161\u0029';
46147 t['\u321C'] = '\u0028\u110C\u116E\u0029';
46148 t['\u321D'] = '\u0028\u110B\u1169\u110C\u1165\u11AB\u0029';
46149 t['\u321E'] = '\u0028\u110B\u1169\u1112\u116E\u0029';
46150 t['\u3220'] = '\u0028\u4E00\u0029';
46151 t['\u3221'] = '\u0028\u4E8C\u0029';
46152 t['\u3222'] = '\u0028\u4E09\u0029';
46153 t['\u3223'] = '\u0028\u56DB\u0029';
46154 t['\u3224'] = '\u0028\u4E94\u0029';
46155 t['\u3225'] = '\u0028\u516D\u0029';
46156 t['\u3226'] = '\u0028\u4E03\u0029';
46157 t['\u3227'] = '\u0028\u516B\u0029';
46158 t['\u3228'] = '\u0028\u4E5D\u0029';
46159 t['\u3229'] = '\u0028\u5341\u0029';
46160 t['\u322A'] = '\u0028\u6708\u0029';
46161 t['\u322B'] = '\u0028\u706B\u0029';
46162 t['\u322C'] = '\u0028\u6C34\u0029';
46163 t['\u322D'] = '\u0028\u6728\u0029';
46164 t['\u322E'] = '\u0028\u91D1\u0029';
46165 t['\u322F'] = '\u0028\u571F\u0029';
46166 t['\u3230'] = '\u0028\u65E5\u0029';
46167 t['\u3231'] = '\u0028\u682A\u0029';
46168 t['\u3232'] = '\u0028\u6709\u0029';
46169 t['\u3233'] = '\u0028\u793E\u0029';
46170 t['\u3234'] = '\u0028\u540D\u0029';
46171 t['\u3235'] = '\u0028\u7279\u0029';
46172 t['\u3236'] = '\u0028\u8CA1\u0029';
46173 t['\u3237'] = '\u0028\u795D\u0029';
46174 t['\u3238'] = '\u0028\u52B4\u0029';
46175 t['\u3239'] = '\u0028\u4EE3\u0029';
46176 t['\u323A'] = '\u0028\u547C\u0029';
46177 t['\u323B'] = '\u0028\u5B66\u0029';
46178 t['\u323C'] = '\u0028\u76E3\u0029';
46179 t['\u323D'] = '\u0028\u4F01\u0029';
46180 t['\u323E'] = '\u0028\u8CC7\u0029';
46181 t['\u323F'] = '\u0028\u5354\u0029';
46182 t['\u3240'] = '\u0028\u796D\u0029';
46183 t['\u3241'] = '\u0028\u4F11\u0029';
46184 t['\u3242'] = '\u0028\u81EA\u0029';
46185 t['\u3243'] = '\u0028\u81F3\u0029';
46186 t['\u32C0'] = '\u0031\u6708';
46187 t['\u32C1'] = '\u0032\u6708';
46188 t['\u32C2'] = '\u0033\u6708';
46189 t['\u32C3'] = '\u0034\u6708';
46190 t['\u32C4'] = '\u0035\u6708';
46191 t['\u32C5'] = '\u0036\u6708';
46192 t['\u32C6'] = '\u0037\u6708';
46193 t['\u32C7'] = '\u0038\u6708';
46194 t['\u32C8'] = '\u0039\u6708';
46195 t['\u32C9'] = '\u0031\u0030\u6708';
46196 t['\u32CA'] = '\u0031\u0031\u6708';
46197 t['\u32CB'] = '\u0031\u0032\u6708';
46198 t['\u3358'] = '\u0030\u70B9';
46199 t['\u3359'] = '\u0031\u70B9';
46200 t['\u335A'] = '\u0032\u70B9';
46201 t['\u335B'] = '\u0033\u70B9';
46202 t['\u335C'] = '\u0034\u70B9';
46203 t['\u335D'] = '\u0035\u70B9';
46204 t['\u335E'] = '\u0036\u70B9';
46205 t['\u335F'] = '\u0037\u70B9';
46206 t['\u3360'] = '\u0038\u70B9';
46207 t['\u3361'] = '\u0039\u70B9';
46208 t['\u3362'] = '\u0031\u0030\u70B9';
46209 t['\u3363'] = '\u0031\u0031\u70B9';
46210 t['\u3364'] = '\u0031\u0032\u70B9';
46211 t['\u3365'] = '\u0031\u0033\u70B9';
46212 t['\u3366'] = '\u0031\u0034\u70B9';
46213 t['\u3367'] = '\u0031\u0035\u70B9';
46214 t['\u3368'] = '\u0031\u0036\u70B9';
46215 t['\u3369'] = '\u0031\u0037\u70B9';
46216 t['\u336A'] = '\u0031\u0038\u70B9';
46217 t['\u336B'] = '\u0031\u0039\u70B9';
46218 t['\u336C'] = '\u0032\u0030\u70B9';
46219 t['\u336D'] = '\u0032\u0031\u70B9';
46220 t['\u336E'] = '\u0032\u0032\u70B9';
46221 t['\u336F'] = '\u0032\u0033\u70B9';
46222 t['\u3370'] = '\u0032\u0034\u70B9';
46223 t['\u33E0'] = '\u0031\u65E5';
46224 t['\u33E1'] = '\u0032\u65E5';
46225 t['\u33E2'] = '\u0033\u65E5';
46226 t['\u33E3'] = '\u0034\u65E5';
46227 t['\u33E4'] = '\u0035\u65E5';
46228 t['\u33E5'] = '\u0036\u65E5';
46229 t['\u33E6'] = '\u0037\u65E5';
46230 t['\u33E7'] = '\u0038\u65E5';
46231 t['\u33E8'] = '\u0039\u65E5';
46232 t['\u33E9'] = '\u0031\u0030\u65E5';
46233 t['\u33EA'] = '\u0031\u0031\u65E5';
46234 t['\u33EB'] = '\u0031\u0032\u65E5';
46235 t['\u33EC'] = '\u0031\u0033\u65E5';
46236 t['\u33ED'] = '\u0031\u0034\u65E5';
46237 t['\u33EE'] = '\u0031\u0035\u65E5';
46238 t['\u33EF'] = '\u0031\u0036\u65E5';
46239 t['\u33F0'] = '\u0031\u0037\u65E5';
46240 t['\u33F1'] = '\u0031\u0038\u65E5';
46241 t['\u33F2'] = '\u0031\u0039\u65E5';
46242 t['\u33F3'] = '\u0032\u0030\u65E5';
46243 t['\u33F4'] = '\u0032\u0031\u65E5';
46244 t['\u33F5'] = '\u0032\u0032\u65E5';
46245 t['\u33F6'] = '\u0032\u0033\u65E5';
46246 t['\u33F7'] = '\u0032\u0034\u65E5';
46247 t['\u33F8'] = '\u0032\u0035\u65E5';
46248 t['\u33F9'] = '\u0032\u0036\u65E5';
46249 t['\u33FA'] = '\u0032\u0037\u65E5';
46250 t['\u33FB'] = '\u0032\u0038\u65E5';
46251 t['\u33FC'] = '\u0032\u0039\u65E5';
46252 t['\u33FD'] = '\u0033\u0030\u65E5';
46253 t['\u33FE'] = '\u0033\u0031\u65E5';
46254 t['\uFB00'] = '\u0066\u0066';
46255 t['\uFB01'] = '\u0066\u0069';
46256 t['\uFB02'] = '\u0066\u006C';
46257 t['\uFB03'] = '\u0066\u0066\u0069';
46258 t['\uFB04'] = '\u0066\u0066\u006C';
46259 t['\uFB05'] = '\u017F\u0074';
46260 t['\uFB06'] = '\u0073\u0074';
46261 t['\uFB13'] = '\u0574\u0576';
46262 t['\uFB14'] = '\u0574\u0565';
46263 t['\uFB15'] = '\u0574\u056B';
46264 t['\uFB16'] = '\u057E\u0576';
46265 t['\uFB17'] = '\u0574\u056D';
46266 t['\uFB4F'] = '\u05D0\u05DC';
46267 t['\uFB50'] = '\u0671';
46268 t['\uFB51'] = '\u0671';
46269 t['\uFB52'] = '\u067B';
46270 t['\uFB53'] = '\u067B';
46271 t['\uFB54'] = '\u067B';
46272 t['\uFB55'] = '\u067B';
46273 t['\uFB56'] = '\u067E';
46274 t['\uFB57'] = '\u067E';
46275 t['\uFB58'] = '\u067E';
46276 t['\uFB59'] = '\u067E';
46277 t['\uFB5A'] = '\u0680';
46278 t['\uFB5B'] = '\u0680';
46279 t['\uFB5C'] = '\u0680';
46280 t['\uFB5D'] = '\u0680';
46281 t['\uFB5E'] = '\u067A';
46282 t['\uFB5F'] = '\u067A';
46283 t['\uFB60'] = '\u067A';
46284 t['\uFB61'] = '\u067A';
46285 t['\uFB62'] = '\u067F';
46286 t['\uFB63'] = '\u067F';
46287 t['\uFB64'] = '\u067F';
46288 t['\uFB65'] = '\u067F';
46289 t['\uFB66'] = '\u0679';
46290 t['\uFB67'] = '\u0679';
46291 t['\uFB68'] = '\u0679';
46292 t['\uFB69'] = '\u0679';
46293 t['\uFB6A'] = '\u06A4';
46294 t['\uFB6B'] = '\u06A4';
46295 t['\uFB6C'] = '\u06A4';
46296 t['\uFB6D'] = '\u06A4';
46297 t['\uFB6E'] = '\u06A6';
46298 t['\uFB6F'] = '\u06A6';
46299 t['\uFB70'] = '\u06A6';
46300 t['\uFB71'] = '\u06A6';
46301 t['\uFB72'] = '\u0684';
46302 t['\uFB73'] = '\u0684';
46303 t['\uFB74'] = '\u0684';
46304 t['\uFB75'] = '\u0684';
46305 t['\uFB76'] = '\u0683';
46306 t['\uFB77'] = '\u0683';
46307 t['\uFB78'] = '\u0683';
46308 t['\uFB79'] = '\u0683';
46309 t['\uFB7A'] = '\u0686';
46310 t['\uFB7B'] = '\u0686';
46311 t['\uFB7C'] = '\u0686';
46312 t['\uFB7D'] = '\u0686';
46313 t['\uFB7E'] = '\u0687';
46314 t['\uFB7F'] = '\u0687';
46315 t['\uFB80'] = '\u0687';
46316 t['\uFB81'] = '\u0687';
46317 t['\uFB82'] = '\u068D';
46318 t['\uFB83'] = '\u068D';
46319 t['\uFB84'] = '\u068C';
46320 t['\uFB85'] = '\u068C';
46321 t['\uFB86'] = '\u068E';
46322 t['\uFB87'] = '\u068E';
46323 t['\uFB88'] = '\u0688';
46324 t['\uFB89'] = '\u0688';
46325 t['\uFB8A'] = '\u0698';
46326 t['\uFB8B'] = '\u0698';
46327 t['\uFB8C'] = '\u0691';
46328 t['\uFB8D'] = '\u0691';
46329 t['\uFB8E'] = '\u06A9';
46330 t['\uFB8F'] = '\u06A9';
46331 t['\uFB90'] = '\u06A9';
46332 t['\uFB91'] = '\u06A9';
46333 t['\uFB92'] = '\u06AF';
46334 t['\uFB93'] = '\u06AF';
46335 t['\uFB94'] = '\u06AF';
46336 t['\uFB95'] = '\u06AF';
46337 t['\uFB96'] = '\u06B3';
46338 t['\uFB97'] = '\u06B3';
46339 t['\uFB98'] = '\u06B3';
46340 t['\uFB99'] = '\u06B3';
46341 t['\uFB9A'] = '\u06B1';
46342 t['\uFB9B'] = '\u06B1';
46343 t['\uFB9C'] = '\u06B1';
46344 t['\uFB9D'] = '\u06B1';
46345 t['\uFB9E'] = '\u06BA';
46346 t['\uFB9F'] = '\u06BA';
46347 t['\uFBA0'] = '\u06BB';
46348 t['\uFBA1'] = '\u06BB';
46349 t['\uFBA2'] = '\u06BB';
46350 t['\uFBA3'] = '\u06BB';
46351 t['\uFBA4'] = '\u06C0';
46352 t['\uFBA5'] = '\u06C0';
46353 t['\uFBA6'] = '\u06C1';
46354 t['\uFBA7'] = '\u06C1';
46355 t['\uFBA8'] = '\u06C1';
46356 t['\uFBA9'] = '\u06C1';
46357 t['\uFBAA'] = '\u06BE';
46358 t['\uFBAB'] = '\u06BE';
46359 t['\uFBAC'] = '\u06BE';
46360 t['\uFBAD'] = '\u06BE';
46361 t['\uFBAE'] = '\u06D2';
46362 t['\uFBAF'] = '\u06D2';
46363 t['\uFBB0'] = '\u06D3';
46364 t['\uFBB1'] = '\u06D3';
46365 t['\uFBD3'] = '\u06AD';
46366 t['\uFBD4'] = '\u06AD';
46367 t['\uFBD5'] = '\u06AD';
46368 t['\uFBD6'] = '\u06AD';
46369 t['\uFBD7'] = '\u06C7';
46370 t['\uFBD8'] = '\u06C7';
46371 t['\uFBD9'] = '\u06C6';
46372 t['\uFBDA'] = '\u06C6';
46373 t['\uFBDB'] = '\u06C8';
46374 t['\uFBDC'] = '\u06C8';
46375 t['\uFBDD'] = '\u0677';
46376 t['\uFBDE'] = '\u06CB';
46377 t['\uFBDF'] = '\u06CB';
46378 t['\uFBE0'] = '\u06C5';
46379 t['\uFBE1'] = '\u06C5';
46380 t['\uFBE2'] = '\u06C9';
46381 t['\uFBE3'] = '\u06C9';
46382 t['\uFBE4'] = '\u06D0';
46383 t['\uFBE5'] = '\u06D0';
46384 t['\uFBE6'] = '\u06D0';
46385 t['\uFBE7'] = '\u06D0';
46386 t['\uFBE8'] = '\u0649';
46387 t['\uFBE9'] = '\u0649';
46388 t['\uFBEA'] = '\u0626\u0627';
46389 t['\uFBEB'] = '\u0626\u0627';
46390 t['\uFBEC'] = '\u0626\u06D5';
46391 t['\uFBED'] = '\u0626\u06D5';
46392 t['\uFBEE'] = '\u0626\u0648';
46393 t['\uFBEF'] = '\u0626\u0648';
46394 t['\uFBF0'] = '\u0626\u06C7';
46395 t['\uFBF1'] = '\u0626\u06C7';
46396 t['\uFBF2'] = '\u0626\u06C6';
46397 t['\uFBF3'] = '\u0626\u06C6';
46398 t['\uFBF4'] = '\u0626\u06C8';
46399 t['\uFBF5'] = '\u0626\u06C8';
46400 t['\uFBF6'] = '\u0626\u06D0';
46401 t['\uFBF7'] = '\u0626\u06D0';
46402 t['\uFBF8'] = '\u0626\u06D0';
46403 t['\uFBF9'] = '\u0626\u0649';
46404 t['\uFBFA'] = '\u0626\u0649';
46405 t['\uFBFB'] = '\u0626\u0649';
46406 t['\uFBFC'] = '\u06CC';
46407 t['\uFBFD'] = '\u06CC';
46408 t['\uFBFE'] = '\u06CC';
46409 t['\uFBFF'] = '\u06CC';
46410 t['\uFC00'] = '\u0626\u062C';
46411 t['\uFC01'] = '\u0626\u062D';
46412 t['\uFC02'] = '\u0626\u0645';
46413 t['\uFC03'] = '\u0626\u0649';
46414 t['\uFC04'] = '\u0626\u064A';
46415 t['\uFC05'] = '\u0628\u062C';
46416 t['\uFC06'] = '\u0628\u062D';
46417 t['\uFC07'] = '\u0628\u062E';
46418 t['\uFC08'] = '\u0628\u0645';
46419 t['\uFC09'] = '\u0628\u0649';
46420 t['\uFC0A'] = '\u0628\u064A';
46421 t['\uFC0B'] = '\u062A\u062C';
46422 t['\uFC0C'] = '\u062A\u062D';
46423 t['\uFC0D'] = '\u062A\u062E';
46424 t['\uFC0E'] = '\u062A\u0645';
46425 t['\uFC0F'] = '\u062A\u0649';
46426 t['\uFC10'] = '\u062A\u064A';
46427 t['\uFC11'] = '\u062B\u062C';
46428 t['\uFC12'] = '\u062B\u0645';
46429 t['\uFC13'] = '\u062B\u0649';
46430 t['\uFC14'] = '\u062B\u064A';
46431 t['\uFC15'] = '\u062C\u062D';
46432 t['\uFC16'] = '\u062C\u0645';
46433 t['\uFC17'] = '\u062D\u062C';
46434 t['\uFC18'] = '\u062D\u0645';
46435 t['\uFC19'] = '\u062E\u062C';
46436 t['\uFC1A'] = '\u062E\u062D';
46437 t['\uFC1B'] = '\u062E\u0645';
46438 t['\uFC1C'] = '\u0633\u062C';
46439 t['\uFC1D'] = '\u0633\u062D';
46440 t['\uFC1E'] = '\u0633\u062E';
46441 t['\uFC1F'] = '\u0633\u0645';
46442 t['\uFC20'] = '\u0635\u062D';
46443 t['\uFC21'] = '\u0635\u0645';
46444 t['\uFC22'] = '\u0636\u062C';
46445 t['\uFC23'] = '\u0636\u062D';
46446 t['\uFC24'] = '\u0636\u062E';
46447 t['\uFC25'] = '\u0636\u0645';
46448 t['\uFC26'] = '\u0637\u062D';
46449 t['\uFC27'] = '\u0637\u0645';
46450 t['\uFC28'] = '\u0638\u0645';
46451 t['\uFC29'] = '\u0639\u062C';
46452 t['\uFC2A'] = '\u0639\u0645';
46453 t['\uFC2B'] = '\u063A\u062C';
46454 t['\uFC2C'] = '\u063A\u0645';
46455 t['\uFC2D'] = '\u0641\u062C';
46456 t['\uFC2E'] = '\u0641\u062D';
46457 t['\uFC2F'] = '\u0641\u062E';
46458 t['\uFC30'] = '\u0641\u0645';
46459 t['\uFC31'] = '\u0641\u0649';
46460 t['\uFC32'] = '\u0641\u064A';
46461 t['\uFC33'] = '\u0642\u062D';
46462 t['\uFC34'] = '\u0642\u0645';
46463 t['\uFC35'] = '\u0642\u0649';
46464 t['\uFC36'] = '\u0642\u064A';
46465 t['\uFC37'] = '\u0643\u0627';
46466 t['\uFC38'] = '\u0643\u062C';
46467 t['\uFC39'] = '\u0643\u062D';
46468 t['\uFC3A'] = '\u0643\u062E';
46469 t['\uFC3B'] = '\u0643\u0644';
46470 t['\uFC3C'] = '\u0643\u0645';
46471 t['\uFC3D'] = '\u0643\u0649';
46472 t['\uFC3E'] = '\u0643\u064A';
46473 t['\uFC3F'] = '\u0644\u062C';
46474 t['\uFC40'] = '\u0644\u062D';
46475 t['\uFC41'] = '\u0644\u062E';
46476 t['\uFC42'] = '\u0644\u0645';
46477 t['\uFC43'] = '\u0644\u0649';
46478 t['\uFC44'] = '\u0644\u064A';
46479 t['\uFC45'] = '\u0645\u062C';
46480 t['\uFC46'] = '\u0645\u062D';
46481 t['\uFC47'] = '\u0645\u062E';
46482 t['\uFC48'] = '\u0645\u0645';
46483 t['\uFC49'] = '\u0645\u0649';
46484 t['\uFC4A'] = '\u0645\u064A';
46485 t['\uFC4B'] = '\u0646\u062C';
46486 t['\uFC4C'] = '\u0646\u062D';
46487 t['\uFC4D'] = '\u0646\u062E';
46488 t['\uFC4E'] = '\u0646\u0645';
46489 t['\uFC4F'] = '\u0646\u0649';
46490 t['\uFC50'] = '\u0646\u064A';
46491 t['\uFC51'] = '\u0647\u062C';
46492 t['\uFC52'] = '\u0647\u0645';
46493 t['\uFC53'] = '\u0647\u0649';
46494 t['\uFC54'] = '\u0647\u064A';
46495 t['\uFC55'] = '\u064A\u062C';
46496 t['\uFC56'] = '\u064A\u062D';
46497 t['\uFC57'] = '\u064A\u062E';
46498 t['\uFC58'] = '\u064A\u0645';
46499 t['\uFC59'] = '\u064A\u0649';
46500 t['\uFC5A'] = '\u064A\u064A';
46501 t['\uFC5B'] = '\u0630\u0670';
46502 t['\uFC5C'] = '\u0631\u0670';
46503 t['\uFC5D'] = '\u0649\u0670';
46504 t['\uFC5E'] = '\u0020\u064C\u0651';
46505 t['\uFC5F'] = '\u0020\u064D\u0651';
46506 t['\uFC60'] = '\u0020\u064E\u0651';
46507 t['\uFC61'] = '\u0020\u064F\u0651';
46508 t['\uFC62'] = '\u0020\u0650\u0651';
46509 t['\uFC63'] = '\u0020\u0651\u0670';
46510 t['\uFC64'] = '\u0626\u0631';
46511 t['\uFC65'] = '\u0626\u0632';
46512 t['\uFC66'] = '\u0626\u0645';
46513 t['\uFC67'] = '\u0626\u0646';
46514 t['\uFC68'] = '\u0626\u0649';
46515 t['\uFC69'] = '\u0626\u064A';
46516 t['\uFC6A'] = '\u0628\u0631';
46517 t['\uFC6B'] = '\u0628\u0632';
46518 t['\uFC6C'] = '\u0628\u0645';
46519 t['\uFC6D'] = '\u0628\u0646';
46520 t['\uFC6E'] = '\u0628\u0649';
46521 t['\uFC6F'] = '\u0628\u064A';
46522 t['\uFC70'] = '\u062A\u0631';
46523 t['\uFC71'] = '\u062A\u0632';
46524 t['\uFC72'] = '\u062A\u0645';
46525 t['\uFC73'] = '\u062A\u0646';
46526 t['\uFC74'] = '\u062A\u0649';
46527 t['\uFC75'] = '\u062A\u064A';
46528 t['\uFC76'] = '\u062B\u0631';
46529 t['\uFC77'] = '\u062B\u0632';
46530 t['\uFC78'] = '\u062B\u0645';
46531 t['\uFC79'] = '\u062B\u0646';
46532 t['\uFC7A'] = '\u062B\u0649';
46533 t['\uFC7B'] = '\u062B\u064A';
46534 t['\uFC7C'] = '\u0641\u0649';
46535 t['\uFC7D'] = '\u0641\u064A';
46536 t['\uFC7E'] = '\u0642\u0649';
46537 t['\uFC7F'] = '\u0642\u064A';
46538 t['\uFC80'] = '\u0643\u0627';
46539 t['\uFC81'] = '\u0643\u0644';
46540 t['\uFC82'] = '\u0643\u0645';
46541 t['\uFC83'] = '\u0643\u0649';
46542 t['\uFC84'] = '\u0643\u064A';
46543 t['\uFC85'] = '\u0644\u0645';
46544 t['\uFC86'] = '\u0644\u0649';
46545 t['\uFC87'] = '\u0644\u064A';
46546 t['\uFC88'] = '\u0645\u0627';
46547 t['\uFC89'] = '\u0645\u0645';
46548 t['\uFC8A'] = '\u0646\u0631';
46549 t['\uFC8B'] = '\u0646\u0632';
46550 t['\uFC8C'] = '\u0646\u0645';
46551 t['\uFC8D'] = '\u0646\u0646';
46552 t['\uFC8E'] = '\u0646\u0649';
46553 t['\uFC8F'] = '\u0646\u064A';
46554 t['\uFC90'] = '\u0649\u0670';
46555 t['\uFC91'] = '\u064A\u0631';
46556 t['\uFC92'] = '\u064A\u0632';
46557 t['\uFC93'] = '\u064A\u0645';
46558 t['\uFC94'] = '\u064A\u0646';
46559 t['\uFC95'] = '\u064A\u0649';
46560 t['\uFC96'] = '\u064A\u064A';
46561 t['\uFC97'] = '\u0626\u062C';
46562 t['\uFC98'] = '\u0626\u062D';
46563 t['\uFC99'] = '\u0626\u062E';
46564 t['\uFC9A'] = '\u0626\u0645';
46565 t['\uFC9B'] = '\u0626\u0647';
46566 t['\uFC9C'] = '\u0628\u062C';
46567 t['\uFC9D'] = '\u0628\u062D';
46568 t['\uFC9E'] = '\u0628\u062E';
46569 t['\uFC9F'] = '\u0628\u0645';
46570 t['\uFCA0'] = '\u0628\u0647';
46571 t['\uFCA1'] = '\u062A\u062C';
46572 t['\uFCA2'] = '\u062A\u062D';
46573 t['\uFCA3'] = '\u062A\u062E';
46574 t['\uFCA4'] = '\u062A\u0645';
46575 t['\uFCA5'] = '\u062A\u0647';
46576 t['\uFCA6'] = '\u062B\u0645';
46577 t['\uFCA7'] = '\u062C\u062D';
46578 t['\uFCA8'] = '\u062C\u0645';
46579 t['\uFCA9'] = '\u062D\u062C';
46580 t['\uFCAA'] = '\u062D\u0645';
46581 t['\uFCAB'] = '\u062E\u062C';
46582 t['\uFCAC'] = '\u062E\u0645';
46583 t['\uFCAD'] = '\u0633\u062C';
46584 t['\uFCAE'] = '\u0633\u062D';
46585 t['\uFCAF'] = '\u0633\u062E';
46586 t['\uFCB0'] = '\u0633\u0645';
46587 t['\uFCB1'] = '\u0635\u062D';
46588 t['\uFCB2'] = '\u0635\u062E';
46589 t['\uFCB3'] = '\u0635\u0645';
46590 t['\uFCB4'] = '\u0636\u062C';
46591 t['\uFCB5'] = '\u0636\u062D';
46592 t['\uFCB6'] = '\u0636\u062E';
46593 t['\uFCB7'] = '\u0636\u0645';
46594 t['\uFCB8'] = '\u0637\u062D';
46595 t['\uFCB9'] = '\u0638\u0645';
46596 t['\uFCBA'] = '\u0639\u062C';
46597 t['\uFCBB'] = '\u0639\u0645';
46598 t['\uFCBC'] = '\u063A\u062C';
46599 t['\uFCBD'] = '\u063A\u0645';
46600 t['\uFCBE'] = '\u0641\u062C';
46601 t['\uFCBF'] = '\u0641\u062D';
46602 t['\uFCC0'] = '\u0641\u062E';
46603 t['\uFCC1'] = '\u0641\u0645';
46604 t['\uFCC2'] = '\u0642\u062D';
46605 t['\uFCC3'] = '\u0642\u0645';
46606 t['\uFCC4'] = '\u0643\u062C';
46607 t['\uFCC5'] = '\u0643\u062D';
46608 t['\uFCC6'] = '\u0643\u062E';
46609 t['\uFCC7'] = '\u0643\u0644';
46610 t['\uFCC8'] = '\u0643\u0645';
46611 t['\uFCC9'] = '\u0644\u062C';
46612 t['\uFCCA'] = '\u0644\u062D';
46613 t['\uFCCB'] = '\u0644\u062E';
46614 t['\uFCCC'] = '\u0644\u0645';
46615 t['\uFCCD'] = '\u0644\u0647';
46616 t['\uFCCE'] = '\u0645\u062C';
46617 t['\uFCCF'] = '\u0645\u062D';
46618 t['\uFCD0'] = '\u0645\u062E';
46619 t['\uFCD1'] = '\u0645\u0645';
46620 t['\uFCD2'] = '\u0646\u062C';
46621 t['\uFCD3'] = '\u0646\u062D';
46622 t['\uFCD4'] = '\u0646\u062E';
46623 t['\uFCD5'] = '\u0646\u0645';
46624 t['\uFCD6'] = '\u0646\u0647';
46625 t['\uFCD7'] = '\u0647\u062C';
46626 t['\uFCD8'] = '\u0647\u0645';
46627 t['\uFCD9'] = '\u0647\u0670';
46628 t['\uFCDA'] = '\u064A\u062C';
46629 t['\uFCDB'] = '\u064A\u062D';
46630 t['\uFCDC'] = '\u064A\u062E';
46631 t['\uFCDD'] = '\u064A\u0645';
46632 t['\uFCDE'] = '\u064A\u0647';
46633 t['\uFCDF'] = '\u0626\u0645';
46634 t['\uFCE0'] = '\u0626\u0647';
46635 t['\uFCE1'] = '\u0628\u0645';
46636 t['\uFCE2'] = '\u0628\u0647';
46637 t['\uFCE3'] = '\u062A\u0645';
46638 t['\uFCE4'] = '\u062A\u0647';
46639 t['\uFCE5'] = '\u062B\u0645';
46640 t['\uFCE6'] = '\u062B\u0647';
46641 t['\uFCE7'] = '\u0633\u0645';
46642 t['\uFCE8'] = '\u0633\u0647';
46643 t['\uFCE9'] = '\u0634\u0645';
46644 t['\uFCEA'] = '\u0634\u0647';
46645 t['\uFCEB'] = '\u0643\u0644';
46646 t['\uFCEC'] = '\u0643\u0645';
46647 t['\uFCED'] = '\u0644\u0645';
46648 t['\uFCEE'] = '\u0646\u0645';
46649 t['\uFCEF'] = '\u0646\u0647';
46650 t['\uFCF0'] = '\u064A\u0645';
46651 t['\uFCF1'] = '\u064A\u0647';
46652 t['\uFCF2'] = '\u0640\u064E\u0651';
46653 t['\uFCF3'] = '\u0640\u064F\u0651';
46654 t['\uFCF4'] = '\u0640\u0650\u0651';
46655 t['\uFCF5'] = '\u0637\u0649';
46656 t['\uFCF6'] = '\u0637\u064A';
46657 t['\uFCF7'] = '\u0639\u0649';
46658 t['\uFCF8'] = '\u0639\u064A';
46659 t['\uFCF9'] = '\u063A\u0649';
46660 t['\uFCFA'] = '\u063A\u064A';
46661 t['\uFCFB'] = '\u0633\u0649';
46662 t['\uFCFC'] = '\u0633\u064A';
46663 t['\uFCFD'] = '\u0634\u0649';
46664 t['\uFCFE'] = '\u0634\u064A';
46665 t['\uFCFF'] = '\u062D\u0649';
46666 t['\uFD00'] = '\u062D\u064A';
46667 t['\uFD01'] = '\u062C\u0649';
46668 t['\uFD02'] = '\u062C\u064A';
46669 t['\uFD03'] = '\u062E\u0649';
46670 t['\uFD04'] = '\u062E\u064A';
46671 t['\uFD05'] = '\u0635\u0649';
46672 t['\uFD06'] = '\u0635\u064A';
46673 t['\uFD07'] = '\u0636\u0649';
46674 t['\uFD08'] = '\u0636\u064A';
46675 t['\uFD09'] = '\u0634\u062C';
46676 t['\uFD0A'] = '\u0634\u062D';
46677 t['\uFD0B'] = '\u0634\u062E';
46678 t['\uFD0C'] = '\u0634\u0645';
46679 t['\uFD0D'] = '\u0634\u0631';
46680 t['\uFD0E'] = '\u0633\u0631';
46681 t['\uFD0F'] = '\u0635\u0631';
46682 t['\uFD10'] = '\u0636\u0631';
46683 t['\uFD11'] = '\u0637\u0649';
46684 t['\uFD12'] = '\u0637\u064A';
46685 t['\uFD13'] = '\u0639\u0649';
46686 t['\uFD14'] = '\u0639\u064A';
46687 t['\uFD15'] = '\u063A\u0649';
46688 t['\uFD16'] = '\u063A\u064A';
46689 t['\uFD17'] = '\u0633\u0649';
46690 t['\uFD18'] = '\u0633\u064A';
46691 t['\uFD19'] = '\u0634\u0649';
46692 t['\uFD1A'] = '\u0634\u064A';
46693 t['\uFD1B'] = '\u062D\u0649';
46694 t['\uFD1C'] = '\u062D\u064A';
46695 t['\uFD1D'] = '\u062C\u0649';
46696 t['\uFD1E'] = '\u062C\u064A';
46697 t['\uFD1F'] = '\u062E\u0649';
46698 t['\uFD20'] = '\u062E\u064A';
46699 t['\uFD21'] = '\u0635\u0649';
46700 t['\uFD22'] = '\u0635\u064A';
46701 t['\uFD23'] = '\u0636\u0649';
46702 t['\uFD24'] = '\u0636\u064A';
46703 t['\uFD25'] = '\u0634\u062C';
46704 t['\uFD26'] = '\u0634\u062D';
46705 t['\uFD27'] = '\u0634\u062E';
46706 t['\uFD28'] = '\u0634\u0645';
46707 t['\uFD29'] = '\u0634\u0631';
46708 t['\uFD2A'] = '\u0633\u0631';
46709 t['\uFD2B'] = '\u0635\u0631';
46710 t['\uFD2C'] = '\u0636\u0631';
46711 t['\uFD2D'] = '\u0634\u062C';
46712 t['\uFD2E'] = '\u0634\u062D';
46713 t['\uFD2F'] = '\u0634\u062E';
46714 t['\uFD30'] = '\u0634\u0645';
46715 t['\uFD31'] = '\u0633\u0647';
46716 t['\uFD32'] = '\u0634\u0647';
46717 t['\uFD33'] = '\u0637\u0645';
46718 t['\uFD34'] = '\u0633\u062C';
46719 t['\uFD35'] = '\u0633\u062D';
46720 t['\uFD36'] = '\u0633\u062E';
46721 t['\uFD37'] = '\u0634\u062C';
46722 t['\uFD38'] = '\u0634\u062D';
46723 t['\uFD39'] = '\u0634\u062E';
46724 t['\uFD3A'] = '\u0637\u0645';
46725 t['\uFD3B'] = '\u0638\u0645';
46726 t['\uFD3C'] = '\u0627\u064B';
46727 t['\uFD3D'] = '\u0627\u064B';
46728 t['\uFD50'] = '\u062A\u062C\u0645';
46729 t['\uFD51'] = '\u062A\u062D\u062C';
46730 t['\uFD52'] = '\u062A\u062D\u062C';
46731 t['\uFD53'] = '\u062A\u062D\u0645';
46732 t['\uFD54'] = '\u062A\u062E\u0645';
46733 t['\uFD55'] = '\u062A\u0645\u062C';
46734 t['\uFD56'] = '\u062A\u0645\u062D';
46735 t['\uFD57'] = '\u062A\u0645\u062E';
46736 t['\uFD58'] = '\u062C\u0645\u062D';
46737 t['\uFD59'] = '\u062C\u0645\u062D';
46738 t['\uFD5A'] = '\u062D\u0645\u064A';
46739 t['\uFD5B'] = '\u062D\u0645\u0649';
46740 t['\uFD5C'] = '\u0633\u062D\u062C';
46741 t['\uFD5D'] = '\u0633\u062C\u062D';
46742 t['\uFD5E'] = '\u0633\u062C\u0649';
46743 t['\uFD5F'] = '\u0633\u0645\u062D';
46744 t['\uFD60'] = '\u0633\u0645\u062D';
46745 t['\uFD61'] = '\u0633\u0645\u062C';
46746 t['\uFD62'] = '\u0633\u0645\u0645';
46747 t['\uFD63'] = '\u0633\u0645\u0645';
46748 t['\uFD64'] = '\u0635\u062D\u062D';
46749 t['\uFD65'] = '\u0635\u062D\u062D';
46750 t['\uFD66'] = '\u0635\u0645\u0645';
46751 t['\uFD67'] = '\u0634\u062D\u0645';
46752 t['\uFD68'] = '\u0634\u062D\u0645';
46753 t['\uFD69'] = '\u0634\u062C\u064A';
46754 t['\uFD6A'] = '\u0634\u0645\u062E';
46755 t['\uFD6B'] = '\u0634\u0645\u062E';
46756 t['\uFD6C'] = '\u0634\u0645\u0645';
46757 t['\uFD6D'] = '\u0634\u0645\u0645';
46758 t['\uFD6E'] = '\u0636\u062D\u0649';
46759 t['\uFD6F'] = '\u0636\u062E\u0645';
46760 t['\uFD70'] = '\u0636\u062E\u0645';
46761 t['\uFD71'] = '\u0637\u0645\u062D';
46762 t['\uFD72'] = '\u0637\u0645\u062D';
46763 t['\uFD73'] = '\u0637\u0645\u0645';
46764 t['\uFD74'] = '\u0637\u0645\u064A';
46765 t['\uFD75'] = '\u0639\u062C\u0645';
46766 t['\uFD76'] = '\u0639\u0645\u0645';
46767 t['\uFD77'] = '\u0639\u0645\u0645';
46768 t['\uFD78'] = '\u0639\u0645\u0649';
46769 t['\uFD79'] = '\u063A\u0645\u0645';
46770 t['\uFD7A'] = '\u063A\u0645\u064A';
46771 t['\uFD7B'] = '\u063A\u0645\u0649';
46772 t['\uFD7C'] = '\u0641\u062E\u0645';
46773 t['\uFD7D'] = '\u0641\u062E\u0645';
46774 t['\uFD7E'] = '\u0642\u0645\u062D';
46775 t['\uFD7F'] = '\u0642\u0645\u0645';
46776 t['\uFD80'] = '\u0644\u062D\u0645';
46777 t['\uFD81'] = '\u0644\u062D\u064A';
46778 t['\uFD82'] = '\u0644\u062D\u0649';
46779 t['\uFD83'] = '\u0644\u062C\u062C';
46780 t['\uFD84'] = '\u0644\u062C\u062C';
46781 t['\uFD85'] = '\u0644\u062E\u0645';
46782 t['\uFD86'] = '\u0644\u062E\u0645';
46783 t['\uFD87'] = '\u0644\u0645\u062D';
46784 t['\uFD88'] = '\u0644\u0645\u062D';
46785 t['\uFD89'] = '\u0645\u062D\u062C';
46786 t['\uFD8A'] = '\u0645\u062D\u0645';
46787 t['\uFD8B'] = '\u0645\u062D\u064A';
46788 t['\uFD8C'] = '\u0645\u062C\u062D';
46789 t['\uFD8D'] = '\u0645\u062C\u0645';
46790 t['\uFD8E'] = '\u0645\u062E\u062C';
46791 t['\uFD8F'] = '\u0645\u062E\u0645';
46792 t['\uFD92'] = '\u0645\u062C\u062E';
46793 t['\uFD93'] = '\u0647\u0645\u062C';
46794 t['\uFD94'] = '\u0647\u0645\u0645';
46795 t['\uFD95'] = '\u0646\u062D\u0645';
46796 t['\uFD96'] = '\u0646\u062D\u0649';
46797 t['\uFD97'] = '\u0646\u062C\u0645';
46798 t['\uFD98'] = '\u0646\u062C\u0645';
46799 t['\uFD99'] = '\u0646\u062C\u0649';
46800 t['\uFD9A'] = '\u0646\u0645\u064A';
46801 t['\uFD9B'] = '\u0646\u0645\u0649';
46802 t['\uFD9C'] = '\u064A\u0645\u0645';
46803 t['\uFD9D'] = '\u064A\u0645\u0645';
46804 t['\uFD9E'] = '\u0628\u062E\u064A';
46805 t['\uFD9F'] = '\u062A\u062C\u064A';
46806 t['\uFDA0'] = '\u062A\u062C\u0649';
46807 t['\uFDA1'] = '\u062A\u062E\u064A';
46808 t['\uFDA2'] = '\u062A\u062E\u0649';
46809 t['\uFDA3'] = '\u062A\u0645\u064A';
46810 t['\uFDA4'] = '\u062A\u0645\u0649';
46811 t['\uFDA5'] = '\u062C\u0645\u064A';
46812 t['\uFDA6'] = '\u062C\u062D\u0649';
46813 t['\uFDA7'] = '\u062C\u0645\u0649';
46814 t['\uFDA8'] = '\u0633\u062E\u0649';
46815 t['\uFDA9'] = '\u0635\u062D\u064A';
46816 t['\uFDAA'] = '\u0634\u062D\u064A';
46817 t['\uFDAB'] = '\u0636\u062D\u064A';
46818 t['\uFDAC'] = '\u0644\u062C\u064A';
46819 t['\uFDAD'] = '\u0644\u0645\u064A';
46820 t['\uFDAE'] = '\u064A\u062D\u064A';
46821 t['\uFDAF'] = '\u064A\u062C\u064A';
46822 t['\uFDB0'] = '\u064A\u0645\u064A';
46823 t['\uFDB1'] = '\u0645\u0645\u064A';
46824 t['\uFDB2'] = '\u0642\u0645\u064A';
46825 t['\uFDB3'] = '\u0646\u062D\u064A';
46826 t['\uFDB4'] = '\u0642\u0645\u062D';
46827 t['\uFDB5'] = '\u0644\u062D\u0645';
46828 t['\uFDB6'] = '\u0639\u0645\u064A';
46829 t['\uFDB7'] = '\u0643\u0645\u064A';
46830 t['\uFDB8'] = '\u0646\u062C\u062D';
46831 t['\uFDB9'] = '\u0645\u062E\u064A';
46832 t['\uFDBA'] = '\u0644\u062C\u0645';
46833 t['\uFDBB'] = '\u0643\u0645\u0645';
46834 t['\uFDBC'] = '\u0644\u062C\u0645';
46835 t['\uFDBD'] = '\u0646\u062C\u062D';
46836 t['\uFDBE'] = '\u062C\u062D\u064A';
46837 t['\uFDBF'] = '\u062D\u062C\u064A';
46838 t['\uFDC0'] = '\u0645\u062C\u064A';
46839 t['\uFDC1'] = '\u0641\u0645\u064A';
46840 t['\uFDC2'] = '\u0628\u062D\u064A';
46841 t['\uFDC3'] = '\u0643\u0645\u0645';
46842 t['\uFDC4'] = '\u0639\u062C\u0645';
46843 t['\uFDC5'] = '\u0635\u0645\u0645';
46844 t['\uFDC6'] = '\u0633\u062E\u064A';
46845 t['\uFDC7'] = '\u0646\u062C\u064A';
46846 t['\uFE49'] = '\u203E';
46847 t['\uFE4A'] = '\u203E';
46848 t['\uFE4B'] = '\u203E';
46849 t['\uFE4C'] = '\u203E';
46850 t['\uFE4D'] = '\u005F';
46851 t['\uFE4E'] = '\u005F';
46852 t['\uFE4F'] = '\u005F';
46853 t['\uFE80'] = '\u0621';
46854 t['\uFE81'] = '\u0622';
46855 t['\uFE82'] = '\u0622';
46856 t['\uFE83'] = '\u0623';
46857 t['\uFE84'] = '\u0623';
46858 t['\uFE85'] = '\u0624';
46859 t['\uFE86'] = '\u0624';
46860 t['\uFE87'] = '\u0625';
46861 t['\uFE88'] = '\u0625';
46862 t['\uFE89'] = '\u0626';
46863 t['\uFE8A'] = '\u0626';
46864 t['\uFE8B'] = '\u0626';
46865 t['\uFE8C'] = '\u0626';
46866 t['\uFE8D'] = '\u0627';
46867 t['\uFE8E'] = '\u0627';
46868 t['\uFE8F'] = '\u0628';
46869 t['\uFE90'] = '\u0628';
46870 t['\uFE91'] = '\u0628';
46871 t['\uFE92'] = '\u0628';
46872 t['\uFE93'] = '\u0629';
46873 t['\uFE94'] = '\u0629';
46874 t['\uFE95'] = '\u062A';
46875 t['\uFE96'] = '\u062A';
46876 t['\uFE97'] = '\u062A';
46877 t['\uFE98'] = '\u062A';
46878 t['\uFE99'] = '\u062B';
46879 t['\uFE9A'] = '\u062B';
46880 t['\uFE9B'] = '\u062B';
46881 t['\uFE9C'] = '\u062B';
46882 t['\uFE9D'] = '\u062C';
46883 t['\uFE9E'] = '\u062C';
46884 t['\uFE9F'] = '\u062C';
46885 t['\uFEA0'] = '\u062C';
46886 t['\uFEA1'] = '\u062D';
46887 t['\uFEA2'] = '\u062D';
46888 t['\uFEA3'] = '\u062D';
46889 t['\uFEA4'] = '\u062D';
46890 t['\uFEA5'] = '\u062E';
46891 t['\uFEA6'] = '\u062E';
46892 t['\uFEA7'] = '\u062E';
46893 t['\uFEA8'] = '\u062E';
46894 t['\uFEA9'] = '\u062F';
46895 t['\uFEAA'] = '\u062F';
46896 t['\uFEAB'] = '\u0630';
46897 t['\uFEAC'] = '\u0630';
46898 t['\uFEAD'] = '\u0631';
46899 t['\uFEAE'] = '\u0631';
46900 t['\uFEAF'] = '\u0632';
46901 t['\uFEB0'] = '\u0632';
46902 t['\uFEB1'] = '\u0633';
46903 t['\uFEB2'] = '\u0633';
46904 t['\uFEB3'] = '\u0633';
46905 t['\uFEB4'] = '\u0633';
46906 t['\uFEB5'] = '\u0634';
46907 t['\uFEB6'] = '\u0634';
46908 t['\uFEB7'] = '\u0634';
46909 t['\uFEB8'] = '\u0634';
46910 t['\uFEB9'] = '\u0635';
46911 t['\uFEBA'] = '\u0635';
46912 t['\uFEBB'] = '\u0635';
46913 t['\uFEBC'] = '\u0635';
46914 t['\uFEBD'] = '\u0636';
46915 t['\uFEBE'] = '\u0636';
46916 t['\uFEBF'] = '\u0636';
46917 t['\uFEC0'] = '\u0636';
46918 t['\uFEC1'] = '\u0637';
46919 t['\uFEC2'] = '\u0637';
46920 t['\uFEC3'] = '\u0637';
46921 t['\uFEC4'] = '\u0637';
46922 t['\uFEC5'] = '\u0638';
46923 t['\uFEC6'] = '\u0638';
46924 t['\uFEC7'] = '\u0638';
46925 t['\uFEC8'] = '\u0638';
46926 t['\uFEC9'] = '\u0639';
46927 t['\uFECA'] = '\u0639';
46928 t['\uFECB'] = '\u0639';
46929 t['\uFECC'] = '\u0639';
46930 t['\uFECD'] = '\u063A';
46931 t['\uFECE'] = '\u063A';
46932 t['\uFECF'] = '\u063A';
46933 t['\uFED0'] = '\u063A';
46934 t['\uFED1'] = '\u0641';
46935 t['\uFED2'] = '\u0641';
46936 t['\uFED3'] = '\u0641';
46937 t['\uFED4'] = '\u0641';
46938 t['\uFED5'] = '\u0642';
46939 t['\uFED6'] = '\u0642';
46940 t['\uFED7'] = '\u0642';
46941 t['\uFED8'] = '\u0642';
46942 t['\uFED9'] = '\u0643';
46943 t['\uFEDA'] = '\u0643';
46944 t['\uFEDB'] = '\u0643';
46945 t['\uFEDC'] = '\u0643';
46946 t['\uFEDD'] = '\u0644';
46947 t['\uFEDE'] = '\u0644';
46948 t['\uFEDF'] = '\u0644';
46949 t['\uFEE0'] = '\u0644';
46950 t['\uFEE1'] = '\u0645';
46951 t['\uFEE2'] = '\u0645';
46952 t['\uFEE3'] = '\u0645';
46953 t['\uFEE4'] = '\u0645';
46954 t['\uFEE5'] = '\u0646';
46955 t['\uFEE6'] = '\u0646';
46956 t['\uFEE7'] = '\u0646';
46957 t['\uFEE8'] = '\u0646';
46958 t['\uFEE9'] = '\u0647';
46959 t['\uFEEA'] = '\u0647';
46960 t['\uFEEB'] = '\u0647';
46961 t['\uFEEC'] = '\u0647';
46962 t['\uFEED'] = '\u0648';
46963 t['\uFEEE'] = '\u0648';
46964 t['\uFEEF'] = '\u0649';
46965 t['\uFEF0'] = '\u0649';
46966 t['\uFEF1'] = '\u064A';
46967 t['\uFEF2'] = '\u064A';
46968 t['\uFEF3'] = '\u064A';
46969 t['\uFEF4'] = '\u064A';
46970 t['\uFEF5'] = '\u0644\u0622';
46971 t['\uFEF6'] = '\u0644\u0622';
46972 t['\uFEF7'] = '\u0644\u0623';
46973 t['\uFEF8'] = '\u0644\u0623';
46974 t['\uFEF9'] = '\u0644\u0625';
46975 t['\uFEFA'] = '\u0644\u0625';
46976 t['\uFEFB'] = '\u0644\u0627';
46977 t['\uFEFC'] = '\u0644\u0627';
46978});
46979function reverseIfRtl(chars) {
46980 var charsLength = chars.length;
46981 if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
46982  return chars;
46983 }
46984 var s = '';
46985 for (var ii = charsLength - 1; ii >= 0; ii--) {
46986  s += chars[ii];
46987 }
46988 return s;
46989}
46990exports.mapSpecialUnicodeValues = mapSpecialUnicodeValues;
46991exports.reverseIfRtl = reverseIfRtl;
46992exports.getUnicodeRangeFor = getUnicodeRangeFor;
46993exports.getNormalizedUnicodes = getNormalizedUnicodes;
46994exports.getUnicodeForGlyph = getUnicodeForGlyph;
46995
46996/***/ }),
46997/* 181 */
46998/***/ (function(module, exports, __w_pdfjs_require__) {
46999
47000"use strict";
47001
47002
47003Object.defineProperty(exports, "__esModule", {
47004  value: true
47005});
47006exports.FontRendererFactory = void 0;
47007
47008var _util = __w_pdfjs_require__(5);
47009
47010var _cff_parser = __w_pdfjs_require__(175);
47011
47012var _glyphlist = __w_pdfjs_require__(178);
47013
47014var _encodings = __w_pdfjs_require__(177);
47015
47016var _stream = __w_pdfjs_require__(158);
47017
47018function _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); }
47019
47020function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
47021
47022function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
47023
47024function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
47025
47026function _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); }
47027
47028function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
47029
47030function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
47031
47032function _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); } }
47033
47034function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
47035
47036var FontRendererFactory = function FontRendererFactoryClosure() {
47037  function getLong(data, offset) {
47038    return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
47039  }
47040
47041  function getUshort(data, offset) {
47042    return data[offset] << 8 | data[offset + 1];
47043  }
47044
47045  function parseCmap(data, start, end) {
47046    var offset = getUshort(data, start + 2) === 1 ? getLong(data, start + 8) : getLong(data, start + 16);
47047    var format = getUshort(data, start + offset);
47048    var ranges, p, i;
47049
47050    if (format === 4) {
47051      getUshort(data, start + offset + 2);
47052      var segCount = getUshort(data, start + offset + 6) >> 1;
47053      p = start + offset + 14;
47054      ranges = [];
47055
47056      for (i = 0; i < segCount; i++, p += 2) {
47057        ranges[i] = {
47058          end: getUshort(data, p)
47059        };
47060      }
47061
47062      p += 2;
47063
47064      for (i = 0; i < segCount; i++, p += 2) {
47065        ranges[i].start = getUshort(data, p);
47066      }
47067
47068      for (i = 0; i < segCount; i++, p += 2) {
47069        ranges[i].idDelta = getUshort(data, p);
47070      }
47071
47072      for (i = 0; i < segCount; i++, p += 2) {
47073        var idOffset = getUshort(data, p);
47074
47075        if (idOffset === 0) {
47076          continue;
47077        }
47078
47079        ranges[i].ids = [];
47080
47081        for (var j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
47082          ranges[i].ids[j] = getUshort(data, p + idOffset);
47083          idOffset += 2;
47084        }
47085      }
47086
47087      return ranges;
47088    } else if (format === 12) {
47089      getLong(data, start + offset + 4);
47090      var groups = getLong(data, start + offset + 12);
47091      p = start + offset + 16;
47092      ranges = [];
47093
47094      for (i = 0; i < groups; i++) {
47095        ranges.push({
47096          start: getLong(data, p),
47097          end: getLong(data, p + 4),
47098          idDelta: getLong(data, p + 8) - getLong(data, p)
47099        });
47100        p += 12;
47101      }
47102
47103      return ranges;
47104    }
47105
47106    throw new _util.FormatError("unsupported cmap: ".concat(format));
47107  }
47108
47109  function parseCff(data, start, end, seacAnalysisEnabled) {
47110    var properties = {};
47111    var parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end - start), properties, seacAnalysisEnabled);
47112    var cff = parser.parse();
47113    return {
47114      glyphs: cff.charStrings.objects,
47115      subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
47116      gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects,
47117      isCFFCIDFont: cff.isCIDFont,
47118      fdSelect: cff.fdSelect,
47119      fdArray: cff.fdArray
47120    };
47121  }
47122
47123  function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
47124    var itemSize, itemDecode;
47125
47126    if (isGlyphLocationsLong) {
47127      itemSize = 4;
47128
47129      itemDecode = function fontItemDecodeLong(data, offset) {
47130        return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
47131      };
47132    } else {
47133      itemSize = 2;
47134
47135      itemDecode = function fontItemDecode(data, offset) {
47136        return data[offset] << 9 | data[offset + 1] << 1;
47137      };
47138    }
47139
47140    var glyphs = [];
47141    var startOffset = itemDecode(loca, 0);
47142
47143    for (var j = itemSize; j < loca.length; j += itemSize) {
47144      var endOffset = itemDecode(loca, j);
47145      glyphs.push(glyf.subarray(startOffset, endOffset));
47146      startOffset = endOffset;
47147    }
47148
47149    return glyphs;
47150  }
47151
47152  function lookupCmap(ranges, unicode) {
47153    var code = unicode.codePointAt(0),
47154        gid = 0;
47155    var l = 0,
47156        r = ranges.length - 1;
47157
47158    while (l < r) {
47159      var c = l + r + 1 >> 1;
47160
47161      if (code < ranges[c].start) {
47162        r = c - 1;
47163      } else {
47164        l = c;
47165      }
47166    }
47167
47168    if (ranges[l].start <= code && code <= ranges[l].end) {
47169      gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xFFFF;
47170    }
47171
47172    return {
47173      charCode: code,
47174      glyphId: gid
47175    };
47176  }
47177
47178  function compileGlyf(code, cmds, font) {
47179    function moveTo(x, y) {
47180      cmds.push({
47181        cmd: 'moveTo',
47182        args: [x, y]
47183      });
47184    }
47185
47186    function lineTo(x, y) {
47187      cmds.push({
47188        cmd: 'lineTo',
47189        args: [x, y]
47190      });
47191    }
47192
47193    function quadraticCurveTo(xa, ya, x, y) {
47194      cmds.push({
47195        cmd: 'quadraticCurveTo',
47196        args: [xa, ya, x, y]
47197      });
47198    }
47199
47200    var i = 0;
47201    var numberOfContours = (code[i] << 24 | code[i + 1] << 16) >> 16;
47202    var flags;
47203    var x = 0,
47204        y = 0;
47205    i += 10;
47206
47207    if (numberOfContours < 0) {
47208      do {
47209        flags = code[i] << 8 | code[i + 1];
47210        var glyphIndex = code[i + 2] << 8 | code[i + 3];
47211        i += 4;
47212        var arg1, arg2;
47213
47214        if (flags & 0x01) {
47215          arg1 = (code[i] << 24 | code[i + 1] << 16) >> 16;
47216          arg2 = (code[i + 2] << 24 | code[i + 3] << 16) >> 16;
47217          i += 4;
47218        } else {
47219          arg1 = code[i++];
47220          arg2 = code[i++];
47221        }
47222
47223        if (flags & 0x02) {
47224          x = arg1;
47225          y = arg2;
47226        } else {
47227          x = 0;
47228          y = 0;
47229        }
47230
47231        var scaleX = 1,
47232            scaleY = 1,
47233            scale01 = 0,
47234            scale10 = 0;
47235
47236        if (flags & 0x08) {
47237          scaleX = scaleY = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
47238          i += 2;
47239        } else if (flags & 0x40) {
47240          scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
47241          scaleY = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
47242          i += 4;
47243        } else if (flags & 0x80) {
47244          scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
47245          scale01 = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
47246          scale10 = (code[i + 4] << 24 | code[i + 5] << 16) / 1073741824;
47247          scaleY = (code[i + 6] << 24 | code[i + 7] << 16) / 1073741824;
47248          i += 8;
47249        }
47250
47251        var subglyph = font.glyphs[glyphIndex];
47252
47253        if (subglyph) {
47254          cmds.push({
47255            cmd: 'save'
47256          });
47257          cmds.push({
47258            cmd: 'transform',
47259            args: [scaleX, scale01, scale10, scaleY, x, y]
47260          });
47261          compileGlyf(subglyph, cmds, font);
47262          cmds.push({
47263            cmd: 'restore'
47264          });
47265        }
47266      } while (flags & 0x20);
47267    } else {
47268      var endPtsOfContours = [];
47269      var j, jj;
47270
47271      for (j = 0; j < numberOfContours; j++) {
47272        endPtsOfContours.push(code[i] << 8 | code[i + 1]);
47273        i += 2;
47274      }
47275
47276      var instructionLength = code[i] << 8 | code[i + 1];
47277      i += 2 + instructionLength;
47278      var numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1;
47279      var points = [];
47280
47281      while (points.length < numberOfPoints) {
47282        flags = code[i++];
47283        var repeat = 1;
47284
47285        if (flags & 0x08) {
47286          repeat += code[i++];
47287        }
47288
47289        while (repeat-- > 0) {
47290          points.push({
47291            flags: flags
47292          });
47293        }
47294      }
47295
47296      for (j = 0; j < numberOfPoints; j++) {
47297        switch (points[j].flags & 0x12) {
47298          case 0x00:
47299            x += (code[i] << 24 | code[i + 1] << 16) >> 16;
47300            i += 2;
47301            break;
47302
47303          case 0x02:
47304            x -= code[i++];
47305            break;
47306
47307          case 0x12:
47308            x += code[i++];
47309            break;
47310        }
47311
47312        points[j].x = x;
47313      }
47314
47315      for (j = 0; j < numberOfPoints; j++) {
47316        switch (points[j].flags & 0x24) {
47317          case 0x00:
47318            y += (code[i] << 24 | code[i + 1] << 16) >> 16;
47319            i += 2;
47320            break;
47321
47322          case 0x04:
47323            y -= code[i++];
47324            break;
47325
47326          case 0x24:
47327            y += code[i++];
47328            break;
47329        }
47330
47331        points[j].y = y;
47332      }
47333
47334      var startPoint = 0;
47335
47336      for (i = 0; i < numberOfContours; i++) {
47337        var endPoint = endPtsOfContours[i];
47338        var contour = points.slice(startPoint, endPoint + 1);
47339
47340        if (contour[0].flags & 1) {
47341          contour.push(contour[0]);
47342        } else if (contour[contour.length - 1].flags & 1) {
47343          contour.unshift(contour[contour.length - 1]);
47344        } else {
47345          var p = {
47346            flags: 1,
47347            x: (contour[0].x + contour[contour.length - 1].x) / 2,
47348            y: (contour[0].y + contour[contour.length - 1].y) / 2
47349          };
47350          contour.unshift(p);
47351          contour.push(p);
47352        }
47353
47354        moveTo(contour[0].x, contour[0].y);
47355
47356        for (j = 1, jj = contour.length; j < jj; j++) {
47357          if (contour[j].flags & 1) {
47358            lineTo(contour[j].x, contour[j].y);
47359          } else if (contour[j + 1].flags & 1) {
47360            quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
47361            j++;
47362          } else {
47363            quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
47364          }
47365        }
47366
47367        startPoint = endPoint + 1;
47368      }
47369    }
47370  }
47371
47372  function compileCharString(code, cmds, font, glyphId) {
47373    var stack = [];
47374    var x = 0,
47375        y = 0;
47376    var stems = 0;
47377
47378    function moveTo(x, y) {
47379      cmds.push({
47380        cmd: 'moveTo',
47381        args: [x, y]
47382      });
47383    }
47384
47385    function lineTo(x, y) {
47386      cmds.push({
47387        cmd: 'lineTo',
47388        args: [x, y]
47389      });
47390    }
47391
47392    function bezierCurveTo(x1, y1, x2, y2, x, y) {
47393      cmds.push({
47394        cmd: 'bezierCurveTo',
47395        args: [x1, y1, x2, y2, x, y]
47396      });
47397    }
47398
47399    function parse(code) {
47400      var i = 0;
47401
47402      while (i < code.length) {
47403        var stackClean = false;
47404        var v = code[i++];
47405        var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
47406
47407        switch (v) {
47408          case 1:
47409            stems += stack.length >> 1;
47410            stackClean = true;
47411            break;
47412
47413          case 3:
47414            stems += stack.length >> 1;
47415            stackClean = true;
47416            break;
47417
47418          case 4:
47419            y += stack.pop();
47420            moveTo(x, y);
47421            stackClean = true;
47422            break;
47423
47424          case 5:
47425            while (stack.length > 0) {
47426              x += stack.shift();
47427              y += stack.shift();
47428              lineTo(x, y);
47429            }
47430
47431            break;
47432
47433          case 6:
47434            while (stack.length > 0) {
47435              x += stack.shift();
47436              lineTo(x, y);
47437
47438              if (stack.length === 0) {
47439                break;
47440              }
47441
47442              y += stack.shift();
47443              lineTo(x, y);
47444            }
47445
47446            break;
47447
47448          case 7:
47449            while (stack.length > 0) {
47450              y += stack.shift();
47451              lineTo(x, y);
47452
47453              if (stack.length === 0) {
47454                break;
47455              }
47456
47457              x += stack.shift();
47458              lineTo(x, y);
47459            }
47460
47461            break;
47462
47463          case 8:
47464            while (stack.length > 0) {
47465              xa = x + stack.shift();
47466              ya = y + stack.shift();
47467              xb = xa + stack.shift();
47468              yb = ya + stack.shift();
47469              x = xb + stack.shift();
47470              y = yb + stack.shift();
47471              bezierCurveTo(xa, ya, xb, yb, x, y);
47472            }
47473
47474            break;
47475
47476          case 10:
47477            n = stack.pop();
47478            subrCode = null;
47479
47480            if (font.isCFFCIDFont) {
47481              var fdIndex = font.fdSelect.getFDIndex(glyphId);
47482
47483              if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
47484                var fontDict = font.fdArray[fdIndex],
47485                    subrs = void 0;
47486
47487                if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
47488                  subrs = fontDict.privateDict.subrsIndex.objects;
47489                }
47490
47491                if (subrs) {
47492                  var numSubrs = subrs.length;
47493                  n += numSubrs < 1240 ? 107 : numSubrs < 33900 ? 1131 : 32768;
47494                  subrCode = subrs[n];
47495                }
47496              } else {
47497                (0, _util.warn)('Invalid fd index for glyph index.');
47498              }
47499            } else {
47500              subrCode = font.subrs[n + font.subrsBias];
47501            }
47502
47503            if (subrCode) {
47504              parse(subrCode);
47505            }
47506
47507            break;
47508
47509          case 11:
47510            return;
47511
47512          case 12:
47513            v = code[i++];
47514
47515            switch (v) {
47516              case 34:
47517                xa = x + stack.shift();
47518                xb = xa + stack.shift();
47519                y1 = y + stack.shift();
47520                x = xb + stack.shift();
47521                bezierCurveTo(xa, y, xb, y1, x, y1);
47522                xa = x + stack.shift();
47523                xb = xa + stack.shift();
47524                x = xb + stack.shift();
47525                bezierCurveTo(xa, y1, xb, y, x, y);
47526                break;
47527
47528              case 35:
47529                xa = x + stack.shift();
47530                ya = y + stack.shift();
47531                xb = xa + stack.shift();
47532                yb = ya + stack.shift();
47533                x = xb + stack.shift();
47534                y = yb + stack.shift();
47535                bezierCurveTo(xa, ya, xb, yb, x, y);
47536                xa = x + stack.shift();
47537                ya = y + stack.shift();
47538                xb = xa + stack.shift();
47539                yb = ya + stack.shift();
47540                x = xb + stack.shift();
47541                y = yb + stack.shift();
47542                bezierCurveTo(xa, ya, xb, yb, x, y);
47543                stack.pop();
47544                break;
47545
47546              case 36:
47547                xa = x + stack.shift();
47548                y1 = y + stack.shift();
47549                xb = xa + stack.shift();
47550                y2 = y1 + stack.shift();
47551                x = xb + stack.shift();
47552                bezierCurveTo(xa, y1, xb, y2, x, y2);
47553                xa = x + stack.shift();
47554                xb = xa + stack.shift();
47555                y3 = y2 + stack.shift();
47556                x = xb + stack.shift();
47557                bezierCurveTo(xa, y2, xb, y3, x, y);
47558                break;
47559
47560              case 37:
47561                var x0 = x,
47562                    y0 = y;
47563                xa = x + stack.shift();
47564                ya = y + stack.shift();
47565                xb = xa + stack.shift();
47566                yb = ya + stack.shift();
47567                x = xb + stack.shift();
47568                y = yb + stack.shift();
47569                bezierCurveTo(xa, ya, xb, yb, x, y);
47570                xa = x + stack.shift();
47571                ya = y + stack.shift();
47572                xb = xa + stack.shift();
47573                yb = ya + stack.shift();
47574                x = xb;
47575                y = yb;
47576
47577                if (Math.abs(x - x0) > Math.abs(y - y0)) {
47578                  x += stack.shift();
47579                } else {
47580                  y += stack.shift();
47581                }
47582
47583                bezierCurveTo(xa, ya, xb, yb, x, y);
47584                break;
47585
47586              default:
47587                throw new _util.FormatError("unknown operator: 12 ".concat(v));
47588            }
47589
47590            break;
47591
47592          case 14:
47593            if (stack.length >= 4) {
47594              var achar = stack.pop();
47595              var bchar = stack.pop();
47596              y = stack.pop();
47597              x = stack.pop();
47598              cmds.push({
47599                cmd: 'save'
47600              });
47601              cmds.push({
47602                cmd: 'translate',
47603                args: [x, y]
47604              });
47605              var cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]]));
47606              compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
47607              cmds.push({
47608                cmd: 'restore'
47609              });
47610              cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]]));
47611              compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
47612            }
47613
47614            return;
47615
47616          case 18:
47617            stems += stack.length >> 1;
47618            stackClean = true;
47619            break;
47620
47621          case 19:
47622            stems += stack.length >> 1;
47623            i += stems + 7 >> 3;
47624            stackClean = true;
47625            break;
47626
47627          case 20:
47628            stems += stack.length >> 1;
47629            i += stems + 7 >> 3;
47630            stackClean = true;
47631            break;
47632
47633          case 21:
47634            y += stack.pop();
47635            x += stack.pop();
47636            moveTo(x, y);
47637            stackClean = true;
47638            break;
47639
47640          case 22:
47641            x += stack.pop();
47642            moveTo(x, y);
47643            stackClean = true;
47644            break;
47645
47646          case 23:
47647            stems += stack.length >> 1;
47648            stackClean = true;
47649            break;
47650
47651          case 24:
47652            while (stack.length > 2) {
47653              xa = x + stack.shift();
47654              ya = y + stack.shift();
47655              xb = xa + stack.shift();
47656              yb = ya + stack.shift();
47657              x = xb + stack.shift();
47658              y = yb + stack.shift();
47659              bezierCurveTo(xa, ya, xb, yb, x, y);
47660            }
47661
47662            x += stack.shift();
47663            y += stack.shift();
47664            lineTo(x, y);
47665            break;
47666
47667          case 25:
47668            while (stack.length > 6) {
47669              x += stack.shift();
47670              y += stack.shift();
47671              lineTo(x, y);
47672            }
47673
47674            xa = x + stack.shift();
47675            ya = y + stack.shift();
47676            xb = xa + stack.shift();
47677            yb = ya + stack.shift();
47678            x = xb + stack.shift();
47679            y = yb + stack.shift();
47680            bezierCurveTo(xa, ya, xb, yb, x, y);
47681            break;
47682
47683          case 26:
47684            if (stack.length % 2) {
47685              x += stack.shift();
47686            }
47687
47688            while (stack.length > 0) {
47689              xa = x;
47690              ya = y + stack.shift();
47691              xb = xa + stack.shift();
47692              yb = ya + stack.shift();
47693              x = xb;
47694              y = yb + stack.shift();
47695              bezierCurveTo(xa, ya, xb, yb, x, y);
47696            }
47697
47698            break;
47699
47700          case 27:
47701            if (stack.length % 2) {
47702              y += stack.shift();
47703            }
47704
47705            while (stack.length > 0) {
47706              xa = x + stack.shift();
47707              ya = y;
47708              xb = xa + stack.shift();
47709              yb = ya + stack.shift();
47710              x = xb + stack.shift();
47711              y = yb;
47712              bezierCurveTo(xa, ya, xb, yb, x, y);
47713            }
47714
47715            break;
47716
47717          case 28:
47718            stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
47719            i += 2;
47720            break;
47721
47722          case 29:
47723            n = stack.pop() + font.gsubrsBias;
47724            subrCode = font.gsubrs[n];
47725
47726            if (subrCode) {
47727              parse(subrCode);
47728            }
47729
47730            break;
47731
47732          case 30:
47733            while (stack.length > 0) {
47734              xa = x;
47735              ya = y + stack.shift();
47736              xb = xa + stack.shift();
47737              yb = ya + stack.shift();
47738              x = xb + stack.shift();
47739              y = yb + (stack.length === 1 ? stack.shift() : 0);
47740              bezierCurveTo(xa, ya, xb, yb, x, y);
47741
47742              if (stack.length === 0) {
47743                break;
47744              }
47745
47746              xa = x + stack.shift();
47747              ya = y;
47748              xb = xa + stack.shift();
47749              yb = ya + stack.shift();
47750              y = yb + stack.shift();
47751              x = xb + (stack.length === 1 ? stack.shift() : 0);
47752              bezierCurveTo(xa, ya, xb, yb, x, y);
47753            }
47754
47755            break;
47756
47757          case 31:
47758            while (stack.length > 0) {
47759              xa = x + stack.shift();
47760              ya = y;
47761              xb = xa + stack.shift();
47762              yb = ya + stack.shift();
47763              y = yb + stack.shift();
47764              x = xb + (stack.length === 1 ? stack.shift() : 0);
47765              bezierCurveTo(xa, ya, xb, yb, x, y);
47766
47767              if (stack.length === 0) {
47768                break;
47769              }
47770
47771              xa = x;
47772              ya = y + stack.shift();
47773              xb = xa + stack.shift();
47774              yb = ya + stack.shift();
47775              x = xb + stack.shift();
47776              y = yb + (stack.length === 1 ? stack.shift() : 0);
47777              bezierCurveTo(xa, ya, xb, yb, x, y);
47778            }
47779
47780            break;
47781
47782          default:
47783            if (v < 32) {
47784              throw new _util.FormatError("unknown operator: ".concat(v));
47785            }
47786
47787            if (v < 247) {
47788              stack.push(v - 139);
47789            } else if (v < 251) {
47790              stack.push((v - 247) * 256 + code[i++] + 108);
47791            } else if (v < 255) {
47792              stack.push(-(v - 251) * 256 - code[i++] - 108);
47793            } else {
47794              stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
47795              i += 4;
47796            }
47797
47798            break;
47799        }
47800
47801        if (stackClean) {
47802          stack.length = 0;
47803        }
47804      }
47805    }
47806
47807    parse(code);
47808  }
47809
47810  var NOOP = [];
47811
47812  var CompiledFont =
47813  /*#__PURE__*/
47814  function () {
47815    function CompiledFont(fontMatrix) {
47816      _classCallCheck(this, CompiledFont);
47817
47818      if (this.constructor === CompiledFont) {
47819        (0, _util.unreachable)('Cannot initialize CompiledFont.');
47820      }
47821
47822      this.fontMatrix = fontMatrix;
47823      this.compiledGlyphs = Object.create(null);
47824      this.compiledCharCodeToGlyphId = Object.create(null);
47825    }
47826
47827    _createClass(CompiledFont, [{
47828      key: "getPathJs",
47829      value: function getPathJs(unicode) {
47830        var cmap = lookupCmap(this.cmap, unicode);
47831        var fn = this.compiledGlyphs[cmap.glyphId];
47832
47833        if (!fn) {
47834          fn = this.compileGlyph(this.glyphs[cmap.glyphId], cmap.glyphId);
47835          this.compiledGlyphs[cmap.glyphId] = fn;
47836        }
47837
47838        if (this.compiledCharCodeToGlyphId[cmap.charCode] === undefined) {
47839          this.compiledCharCodeToGlyphId[cmap.charCode] = cmap.glyphId;
47840        }
47841
47842        return fn;
47843      }
47844    }, {
47845      key: "compileGlyph",
47846      value: function compileGlyph(code, glyphId) {
47847        if (!code || code.length === 0 || code[0] === 14) {
47848          return NOOP;
47849        }
47850
47851        var fontMatrix = this.fontMatrix;
47852
47853        if (this.isCFFCIDFont) {
47854          var fdIndex = this.fdSelect.getFDIndex(glyphId);
47855
47856          if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
47857            var fontDict = this.fdArray[fdIndex];
47858            fontMatrix = fontDict.getByName('FontMatrix') || _util.FONT_IDENTITY_MATRIX;
47859          } else {
47860            (0, _util.warn)('Invalid fd index for glyph index.');
47861          }
47862        }
47863
47864        var cmds = [];
47865        cmds.push({
47866          cmd: 'save'
47867        });
47868        cmds.push({
47869          cmd: 'transform',
47870          args: fontMatrix.slice()
47871        });
47872        cmds.push({
47873          cmd: 'scale',
47874          args: ['size', '-size']
47875        });
47876        this.compileGlyphImpl(code, cmds, glyphId);
47877        cmds.push({
47878          cmd: 'restore'
47879        });
47880        return cmds;
47881      }
47882    }, {
47883      key: "compileGlyphImpl",
47884      value: function compileGlyphImpl() {
47885        (0, _util.unreachable)('Children classes should implement this.');
47886      }
47887    }, {
47888      key: "hasBuiltPath",
47889      value: function hasBuiltPath(unicode) {
47890        var cmap = lookupCmap(this.cmap, unicode);
47891        return this.compiledGlyphs[cmap.glyphId] !== undefined && this.compiledCharCodeToGlyphId[cmap.charCode] !== undefined;
47892      }
47893    }]);
47894
47895    return CompiledFont;
47896  }();
47897
47898  var TrueTypeCompiled =
47899  /*#__PURE__*/
47900  function (_CompiledFont) {
47901    _inherits(TrueTypeCompiled, _CompiledFont);
47902
47903    function TrueTypeCompiled(glyphs, cmap, fontMatrix) {
47904      var _this;
47905
47906      _classCallCheck(this, TrueTypeCompiled);
47907
47908      _this = _possibleConstructorReturn(this, _getPrototypeOf(TrueTypeCompiled).call(this, fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]));
47909      _this.glyphs = glyphs;
47910      _this.cmap = cmap;
47911      return _this;
47912    }
47913
47914    _createClass(TrueTypeCompiled, [{
47915      key: "compileGlyphImpl",
47916      value: function compileGlyphImpl(code, cmds) {
47917        compileGlyf(code, cmds, this);
47918      }
47919    }]);
47920
47921    return TrueTypeCompiled;
47922  }(CompiledFont);
47923
47924  var Type2Compiled =
47925  /*#__PURE__*/
47926  function (_CompiledFont2) {
47927    _inherits(Type2Compiled, _CompiledFont2);
47928
47929    function Type2Compiled(cffInfo, cmap, fontMatrix, glyphNameMap) {
47930      var _this2;
47931
47932      _classCallCheck(this, Type2Compiled);
47933
47934      _this2 = _possibleConstructorReturn(this, _getPrototypeOf(Type2Compiled).call(this, fontMatrix || [0.001, 0, 0, 0.001, 0, 0]));
47935      _this2.glyphs = cffInfo.glyphs;
47936      _this2.gsubrs = cffInfo.gsubrs || [];
47937      _this2.subrs = cffInfo.subrs || [];
47938      _this2.cmap = cmap;
47939      _this2.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
47940      _this2.gsubrsBias = _this2.gsubrs.length < 1240 ? 107 : _this2.gsubrs.length < 33900 ? 1131 : 32768;
47941      _this2.subrsBias = _this2.subrs.length < 1240 ? 107 : _this2.subrs.length < 33900 ? 1131 : 32768;
47942      _this2.isCFFCIDFont = cffInfo.isCFFCIDFont;
47943      _this2.fdSelect = cffInfo.fdSelect;
47944      _this2.fdArray = cffInfo.fdArray;
47945      return _this2;
47946    }
47947
47948    _createClass(Type2Compiled, [{
47949      key: "compileGlyphImpl",
47950      value: function compileGlyphImpl(code, cmds, glyphId) {
47951        compileCharString(code, cmds, this, glyphId);
47952      }
47953    }]);
47954
47955    return Type2Compiled;
47956  }(CompiledFont);
47957
47958  return {
47959    create: function FontRendererFactory_create(font, seacAnalysisEnabled) {
47960      var data = new Uint8Array(font.data);
47961      var cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
47962      var numTables = getUshort(data, 4);
47963
47964      for (var i = 0, p = 12; i < numTables; i++, p += 16) {
47965        var tag = (0, _util.bytesToString)(data.subarray(p, p + 4));
47966        var offset = getLong(data, p + 8);
47967        var length = getLong(data, p + 12);
47968
47969        switch (tag) {
47970          case 'cmap':
47971            cmap = parseCmap(data, offset, offset + length);
47972            break;
47973
47974          case 'glyf':
47975            glyf = data.subarray(offset, offset + length);
47976            break;
47977
47978          case 'loca':
47979            loca = data.subarray(offset, offset + length);
47980            break;
47981
47982          case 'head':
47983            unitsPerEm = getUshort(data, offset + 18);
47984            indexToLocFormat = getUshort(data, offset + 50);
47985            break;
47986
47987          case 'CFF ':
47988            cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
47989            break;
47990        }
47991      }
47992
47993      if (glyf) {
47994        var fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
47995        return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
47996      }
47997
47998      return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
47999    }
48000  };
48001}();
48002
48003exports.FontRendererFactory = FontRendererFactory;
48004
48005/***/ }),
48006/* 182 */
48007/***/ (function(module, exports, __w_pdfjs_require__) {
48008
48009"use strict";
48010
48011
48012Object.defineProperty(exports, "__esModule", {
48013  value: true
48014});
48015exports.Type1Parser = void 0;
48016
48017var _util = __w_pdfjs_require__(5);
48018
48019var _encodings = __w_pdfjs_require__(177);
48020
48021var _stream = __w_pdfjs_require__(158);
48022
48023var HINTING_ENABLED = false;
48024
48025var Type1CharString = function Type1CharStringClosure() {
48026  var COMMAND_MAP = {
48027    'hstem': [1],
48028    'vstem': [3],
48029    'vmoveto': [4],
48030    'rlineto': [5],
48031    'hlineto': [6],
48032    'vlineto': [7],
48033    'rrcurveto': [8],
48034    'callsubr': [10],
48035    'flex': [12, 35],
48036    'drop': [12, 18],
48037    'endchar': [14],
48038    'rmoveto': [21],
48039    'hmoveto': [22],
48040    'vhcurveto': [30],
48041    'hvcurveto': [31]
48042  };
48043
48044  function Type1CharString() {
48045    this.width = 0;
48046    this.lsb = 0;
48047    this.flexing = false;
48048    this.output = [];
48049    this.stack = [];
48050  }
48051
48052  Type1CharString.prototype = {
48053    convert: function Type1CharString_convert(encoded, subrs, seacAnalysisEnabled) {
48054      var count = encoded.length;
48055      var error = false;
48056      var wx, sbx, subrNumber;
48057
48058      for (var i = 0; i < count; i++) {
48059        var value = encoded[i];
48060
48061        if (value < 32) {
48062          if (value === 12) {
48063            value = (value << 8) + encoded[++i];
48064          }
48065
48066          switch (value) {
48067            case 1:
48068              if (!HINTING_ENABLED) {
48069                this.stack = [];
48070                break;
48071              }
48072
48073              error = this.executeCommand(2, COMMAND_MAP.hstem);
48074              break;
48075
48076            case 3:
48077              if (!HINTING_ENABLED) {
48078                this.stack = [];
48079                break;
48080              }
48081
48082              error = this.executeCommand(2, COMMAND_MAP.vstem);
48083              break;
48084
48085            case 4:
48086              if (this.flexing) {
48087                if (this.stack.length < 1) {
48088                  error = true;
48089                  break;
48090                }
48091
48092                var dy = this.stack.pop();
48093                this.stack.push(0, dy);
48094                break;
48095              }
48096
48097              error = this.executeCommand(1, COMMAND_MAP.vmoveto);
48098              break;
48099
48100            case 5:
48101              error = this.executeCommand(2, COMMAND_MAP.rlineto);
48102              break;
48103
48104            case 6:
48105              error = this.executeCommand(1, COMMAND_MAP.hlineto);
48106              break;
48107
48108            case 7:
48109              error = this.executeCommand(1, COMMAND_MAP.vlineto);
48110              break;
48111
48112            case 8:
48113              error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
48114              break;
48115
48116            case 9:
48117              this.stack = [];
48118              break;
48119
48120            case 10:
48121              if (this.stack.length < 1) {
48122                error = true;
48123                break;
48124              }
48125
48126              subrNumber = this.stack.pop();
48127
48128              if (!subrs[subrNumber]) {
48129                error = true;
48130                break;
48131              }
48132
48133              error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
48134              break;
48135
48136            case 11:
48137              return error;
48138
48139            case 13:
48140              if (this.stack.length < 2) {
48141                error = true;
48142                break;
48143              }
48144
48145              wx = this.stack.pop();
48146              sbx = this.stack.pop();
48147              this.lsb = sbx;
48148              this.width = wx;
48149              this.stack.push(wx, sbx);
48150              error = this.executeCommand(2, COMMAND_MAP.hmoveto);
48151              break;
48152
48153            case 14:
48154              this.output.push(COMMAND_MAP.endchar[0]);
48155              break;
48156
48157            case 21:
48158              if (this.flexing) {
48159                break;
48160              }
48161
48162              error = this.executeCommand(2, COMMAND_MAP.rmoveto);
48163              break;
48164
48165            case 22:
48166              if (this.flexing) {
48167                this.stack.push(0);
48168                break;
48169              }
48170
48171              error = this.executeCommand(1, COMMAND_MAP.hmoveto);
48172              break;
48173
48174            case 30:
48175              error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
48176              break;
48177
48178            case 31:
48179              error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
48180              break;
48181
48182            case (12 << 8) + 0:
48183              this.stack = [];
48184              break;
48185
48186            case (12 << 8) + 1:
48187              if (!HINTING_ENABLED) {
48188                this.stack = [];
48189                break;
48190              }
48191
48192              error = this.executeCommand(2, COMMAND_MAP.vstem);
48193              break;
48194
48195            case (12 << 8) + 2:
48196              if (!HINTING_ENABLED) {
48197                this.stack = [];
48198                break;
48199              }
48200
48201              error = this.executeCommand(2, COMMAND_MAP.hstem);
48202              break;
48203
48204            case (12 << 8) + 6:
48205              if (seacAnalysisEnabled) {
48206                this.seac = this.stack.splice(-4, 4);
48207                error = this.executeCommand(0, COMMAND_MAP.endchar);
48208              } else {
48209                error = this.executeCommand(4, COMMAND_MAP.endchar);
48210              }
48211
48212              break;
48213
48214            case (12 << 8) + 7:
48215              if (this.stack.length < 4) {
48216                error = true;
48217                break;
48218              }
48219
48220              this.stack.pop();
48221              wx = this.stack.pop();
48222              var sby = this.stack.pop();
48223              sbx = this.stack.pop();
48224              this.lsb = sbx;
48225              this.width = wx;
48226              this.stack.push(wx, sbx, sby);
48227              error = this.executeCommand(3, COMMAND_MAP.rmoveto);
48228              break;
48229
48230            case (12 << 8) + 12:
48231              if (this.stack.length < 2) {
48232                error = true;
48233                break;
48234              }
48235
48236              var num2 = this.stack.pop();
48237              var num1 = this.stack.pop();
48238              this.stack.push(num1 / num2);
48239              break;
48240
48241            case (12 << 8) + 16:
48242              if (this.stack.length < 2) {
48243                error = true;
48244                break;
48245              }
48246
48247              subrNumber = this.stack.pop();
48248              var numArgs = this.stack.pop();
48249
48250              if (subrNumber === 0 && numArgs === 3) {
48251                var flexArgs = this.stack.splice(this.stack.length - 17, 17);
48252                this.stack.push(flexArgs[2] + flexArgs[0], flexArgs[3] + flexArgs[1], flexArgs[4], flexArgs[5], flexArgs[6], flexArgs[7], flexArgs[8], flexArgs[9], flexArgs[10], flexArgs[11], flexArgs[12], flexArgs[13], flexArgs[14]);
48253                error = this.executeCommand(13, COMMAND_MAP.flex, true);
48254                this.flexing = false;
48255                this.stack.push(flexArgs[15], flexArgs[16]);
48256              } else if (subrNumber === 1 && numArgs === 0) {
48257                this.flexing = true;
48258              }
48259
48260              break;
48261
48262            case (12 << 8) + 17:
48263              break;
48264
48265            case (12 << 8) + 33:
48266              this.stack = [];
48267              break;
48268
48269            default:
48270              (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"');
48271              break;
48272          }
48273
48274          if (error) {
48275            break;
48276          }
48277
48278          continue;
48279        } else if (value <= 246) {
48280          value = value - 139;
48281        } else if (value <= 250) {
48282          value = (value - 247) * 256 + encoded[++i] + 108;
48283        } else if (value <= 254) {
48284          value = -((value - 251) * 256) - encoded[++i] - 108;
48285        } else {
48286          value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
48287        }
48288
48289        this.stack.push(value);
48290      }
48291
48292      return error;
48293    },
48294    executeCommand: function executeCommand(howManyArgs, command, keepStack) {
48295      var stackLength = this.stack.length;
48296
48297      if (howManyArgs > stackLength) {
48298        return true;
48299      }
48300
48301      var start = stackLength - howManyArgs;
48302
48303      for (var i = start; i < stackLength; i++) {
48304        var value = this.stack[i];
48305
48306        if (Number.isInteger(value)) {
48307          this.output.push(28, value >> 8 & 0xff, value & 0xff);
48308        } else {
48309          value = 65536 * value | 0;
48310          this.output.push(255, value >> 24 & 0xFF, value >> 16 & 0xFF, value >> 8 & 0xFF, value & 0xFF);
48311        }
48312      }
48313
48314      this.output.push.apply(this.output, command);
48315
48316      if (keepStack) {
48317        this.stack.splice(start, howManyArgs);
48318      } else {
48319        this.stack.length = 0;
48320      }
48321
48322      return false;
48323    }
48324  };
48325  return Type1CharString;
48326}();
48327
48328var Type1Parser = function Type1ParserClosure() {
48329  var EEXEC_ENCRYPT_KEY = 55665;
48330  var CHAR_STRS_ENCRYPT_KEY = 4330;
48331
48332  function isHexDigit(code) {
48333    return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
48334  }
48335
48336  function decrypt(data, key, discardNumber) {
48337    if (discardNumber >= data.length) {
48338      return new Uint8Array(0);
48339    }
48340
48341    var r = key | 0,
48342        c1 = 52845,
48343        c2 = 22719,
48344        i,
48345        j;
48346
48347    for (i = 0; i < discardNumber; i++) {
48348      r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
48349    }
48350
48351    var count = data.length - discardNumber;
48352    var decrypted = new Uint8Array(count);
48353
48354    for (i = discardNumber, j = 0; j < count; i++, j++) {
48355      var value = data[i];
48356      decrypted[j] = value ^ r >> 8;
48357      r = (value + r) * c1 + c2 & (1 << 16) - 1;
48358    }
48359
48360    return decrypted;
48361  }
48362
48363  function decryptAscii(data, key, discardNumber) {
48364    var r = key | 0,
48365        c1 = 52845,
48366        c2 = 22719;
48367    var count = data.length,
48368        maybeLength = count >>> 1;
48369    var decrypted = new Uint8Array(maybeLength);
48370    var i, j;
48371
48372    for (i = 0, j = 0; i < count; i++) {
48373      var digit1 = data[i];
48374
48375      if (!isHexDigit(digit1)) {
48376        continue;
48377      }
48378
48379      i++;
48380      var digit2;
48381
48382      while (i < count && !isHexDigit(digit2 = data[i])) {
48383        i++;
48384      }
48385
48386      if (i < count) {
48387        var value = parseInt(String.fromCharCode(digit1, digit2), 16);
48388        decrypted[j++] = value ^ r >> 8;
48389        r = (value + r) * c1 + c2 & (1 << 16) - 1;
48390      }
48391    }
48392
48393    return Array.prototype.slice.call(decrypted, discardNumber, j);
48394  }
48395
48396  function isSpecial(c) {
48397    return c === 0x2F || c === 0x5B || c === 0x5D || c === 0x7B || c === 0x7D || c === 0x28 || c === 0x29;
48398  }
48399
48400  function Type1Parser(stream, encrypted, seacAnalysisEnabled) {
48401    if (encrypted) {
48402      var data = stream.getBytes();
48403      var isBinary = !(isHexDigit(data[0]) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]));
48404      stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
48405    }
48406
48407    this.seacAnalysisEnabled = !!seacAnalysisEnabled;
48408    this.stream = stream;
48409    this.nextChar();
48410  }
48411
48412  Type1Parser.prototype = {
48413    readNumberArray: function Type1Parser_readNumberArray() {
48414      this.getToken();
48415      var array = [];
48416
48417      while (true) {
48418        var token = this.getToken();
48419
48420        if (token === null || token === ']' || token === '}') {
48421          break;
48422        }
48423
48424        array.push(parseFloat(token || 0));
48425      }
48426
48427      return array;
48428    },
48429    readNumber: function Type1Parser_readNumber() {
48430      var token = this.getToken();
48431      return parseFloat(token || 0);
48432    },
48433    readInt: function Type1Parser_readInt() {
48434      var token = this.getToken();
48435      return parseInt(token || 0, 10) | 0;
48436    },
48437    readBoolean: function Type1Parser_readBoolean() {
48438      var token = this.getToken();
48439      return token === 'true' ? 1 : 0;
48440    },
48441    nextChar: function Type1_nextChar() {
48442      return this.currentChar = this.stream.getByte();
48443    },
48444    getToken: function Type1Parser_getToken() {
48445      var comment = false;
48446      var ch = this.currentChar;
48447
48448      while (true) {
48449        if (ch === -1) {
48450          return null;
48451        }
48452
48453        if (comment) {
48454          if (ch === 0x0A || ch === 0x0D) {
48455            comment = false;
48456          }
48457        } else if (ch === 0x25) {
48458          comment = true;
48459        } else if (!(0, _util.isSpace)(ch)) {
48460          break;
48461        }
48462
48463        ch = this.nextChar();
48464      }
48465
48466      if (isSpecial(ch)) {
48467        this.nextChar();
48468        return String.fromCharCode(ch);
48469      }
48470
48471      var token = '';
48472
48473      do {
48474        token += String.fromCharCode(ch);
48475        ch = this.nextChar();
48476      } while (ch >= 0 && !(0, _util.isSpace)(ch) && !isSpecial(ch));
48477
48478      return token;
48479    },
48480    readCharStrings: function Type1Parser_readCharStrings(bytes, lenIV) {
48481      if (lenIV === -1) {
48482        return bytes;
48483      }
48484
48485      return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
48486    },
48487    extractFontProgram: function Type1Parser_extractFontProgram() {
48488      var stream = this.stream;
48489      var subrs = [],
48490          charstrings = [];
48491      var privateData = Object.create(null);
48492      privateData['lenIV'] = 4;
48493      var program = {
48494        subrs: [],
48495        charstrings: [],
48496        properties: {
48497          'privateData': privateData
48498        }
48499      };
48500      var token, length, data, lenIV, encoded;
48501
48502      while ((token = this.getToken()) !== null) {
48503        if (token !== '/') {
48504          continue;
48505        }
48506
48507        token = this.getToken();
48508
48509        switch (token) {
48510          case 'CharStrings':
48511            this.getToken();
48512            this.getToken();
48513            this.getToken();
48514            this.getToken();
48515
48516            while (true) {
48517              token = this.getToken();
48518
48519              if (token === null || token === 'end') {
48520                break;
48521              }
48522
48523              if (token !== '/') {
48524                continue;
48525              }
48526
48527              var glyph = this.getToken();
48528              length = this.readInt();
48529              this.getToken();
48530              data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
48531              lenIV = program.properties.privateData['lenIV'];
48532              encoded = this.readCharStrings(data, lenIV);
48533              this.nextChar();
48534              token = this.getToken();
48535
48536              if (token === 'noaccess') {
48537                this.getToken();
48538              }
48539
48540              charstrings.push({
48541                glyph: glyph,
48542                encoded: encoded
48543              });
48544            }
48545
48546            break;
48547
48548          case 'Subrs':
48549            this.readInt();
48550            this.getToken();
48551
48552            while (this.getToken() === 'dup') {
48553              var index = this.readInt();
48554              length = this.readInt();
48555              this.getToken();
48556              data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
48557              lenIV = program.properties.privateData['lenIV'];
48558              encoded = this.readCharStrings(data, lenIV);
48559              this.nextChar();
48560              token = this.getToken();
48561
48562              if (token === 'noaccess') {
48563                this.getToken();
48564              }
48565
48566              subrs[index] = encoded;
48567            }
48568
48569            break;
48570
48571          case 'BlueValues':
48572          case 'OtherBlues':
48573          case 'FamilyBlues':
48574          case 'FamilyOtherBlues':
48575            var blueArray = this.readNumberArray();
48576
48577            if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
48578              program.properties.privateData[token] = blueArray;
48579            }
48580
48581            break;
48582
48583          case 'StemSnapH':
48584          case 'StemSnapV':
48585            program.properties.privateData[token] = this.readNumberArray();
48586            break;
48587
48588          case 'StdHW':
48589          case 'StdVW':
48590            program.properties.privateData[token] = this.readNumberArray()[0];
48591            break;
48592
48593          case 'BlueShift':
48594          case 'lenIV':
48595          case 'BlueFuzz':
48596          case 'BlueScale':
48597          case 'LanguageGroup':
48598          case 'ExpansionFactor':
48599            program.properties.privateData[token] = this.readNumber();
48600            break;
48601
48602          case 'ForceBold':
48603            program.properties.privateData[token] = this.readBoolean();
48604            break;
48605        }
48606      }
48607
48608      for (var i = 0; i < charstrings.length; i++) {
48609        glyph = charstrings[i].glyph;
48610        encoded = charstrings[i].encoded;
48611        var charString = new Type1CharString();
48612        var error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
48613        var output = charString.output;
48614
48615        if (error) {
48616          output = [14];
48617        }
48618
48619        program.charstrings.push({
48620          glyphName: glyph,
48621          charstring: output,
48622          width: charString.width,
48623          lsb: charString.lsb,
48624          seac: charString.seac
48625        });
48626      }
48627
48628      return program;
48629    },
48630    extractFontHeader: function Type1Parser_extractFontHeader(properties) {
48631      var token;
48632
48633      while ((token = this.getToken()) !== null) {
48634        if (token !== '/') {
48635          continue;
48636        }
48637
48638        token = this.getToken();
48639
48640        switch (token) {
48641          case 'FontMatrix':
48642            var matrix = this.readNumberArray();
48643            properties.fontMatrix = matrix;
48644            break;
48645
48646          case 'Encoding':
48647            var encodingArg = this.getToken();
48648            var encoding;
48649
48650            if (!/^\d+$/.test(encodingArg)) {
48651              encoding = (0, _encodings.getEncoding)(encodingArg);
48652            } else {
48653              encoding = [];
48654              var size = parseInt(encodingArg, 10) | 0;
48655              this.getToken();
48656
48657              for (var j = 0; j < size; j++) {
48658                token = this.getToken();
48659
48660                while (token !== 'dup' && token !== 'def') {
48661                  token = this.getToken();
48662
48663                  if (token === null) {
48664                    return;
48665                  }
48666                }
48667
48668                if (token === 'def') {
48669                  break;
48670                }
48671
48672                var index = this.readInt();
48673                this.getToken();
48674                var glyph = this.getToken();
48675                encoding[index] = glyph;
48676                this.getToken();
48677              }
48678            }
48679
48680            properties.builtInEncoding = encoding;
48681            break;
48682
48683          case 'FontBBox':
48684            var fontBBox = this.readNumberArray();
48685            properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
48686            properties.descent = Math.min(fontBBox[1], fontBBox[3]);
48687            properties.ascentScaled = true;
48688            break;
48689        }
48690      }
48691    }
48692  };
48693  return Type1Parser;
48694}();
48695
48696exports.Type1Parser = Type1Parser;
48697
48698/***/ }),
48699/* 183 */
48700/***/ (function(module, exports, __w_pdfjs_require__) {
48701
48702"use strict";
48703
48704
48705Object.defineProperty(exports, "__esModule", {
48706  value: true
48707});
48708exports.getTilingPatternIR = getTilingPatternIR;
48709exports.Pattern = void 0;
48710
48711var _util = __w_pdfjs_require__(5);
48712
48713var _colorspace = __w_pdfjs_require__(169);
48714
48715var _primitives = __w_pdfjs_require__(151);
48716
48717var _core_utils = __w_pdfjs_require__(154);
48718
48719var ShadingType = {
48720  FUNCTION_BASED: 1,
48721  AXIAL: 2,
48722  RADIAL: 3,
48723  FREE_FORM_MESH: 4,
48724  LATTICE_FORM_MESH: 5,
48725  COONS_PATCH_MESH: 6,
48726  TENSOR_PATCH_MESH: 7
48727};
48728
48729var Pattern = function PatternClosure() {
48730  function Pattern() {
48731    (0, _util.unreachable)('should not call Pattern constructor');
48732  }
48733
48734  Pattern.prototype = {
48735    getPattern: function Pattern_getPattern(ctx) {
48736      (0, _util.unreachable)("Should not call Pattern.getStyle: ".concat(ctx));
48737    }
48738  };
48739
48740  Pattern.parseShading = function (shading, matrix, xref, res, handler, pdfFunctionFactory) {
48741    var dict = (0, _primitives.isStream)(shading) ? shading.dict : shading;
48742    var type = dict.get('ShadingType');
48743
48744    try {
48745      switch (type) {
48746        case ShadingType.AXIAL:
48747        case ShadingType.RADIAL:
48748          return new Shadings.RadialAxial(dict, matrix, xref, res, pdfFunctionFactory);
48749
48750        case ShadingType.FREE_FORM_MESH:
48751        case ShadingType.LATTICE_FORM_MESH:
48752        case ShadingType.COONS_PATCH_MESH:
48753        case ShadingType.TENSOR_PATCH_MESH:
48754          return new Shadings.Mesh(shading, matrix, xref, res, pdfFunctionFactory);
48755
48756        default:
48757          throw new _util.FormatError('Unsupported ShadingType: ' + type);
48758      }
48759    } catch (ex) {
48760      if (ex instanceof _core_utils.MissingDataException) {
48761        throw ex;
48762      }
48763
48764      handler.send('UnsupportedFeature', {
48765        featureId: _util.UNSUPPORTED_FEATURES.shadingPattern
48766      });
48767      (0, _util.warn)(ex);
48768      return new Shadings.Dummy();
48769    }
48770  };
48771
48772  return Pattern;
48773}();
48774
48775exports.Pattern = Pattern;
48776var Shadings = {};
48777Shadings.SMALL_NUMBER = 1e-6;
48778
48779Shadings.RadialAxial = function RadialAxialClosure() {
48780  function RadialAxial(dict, matrix, xref, res, pdfFunctionFactory) {
48781    this.matrix = matrix;
48782    this.coordsArr = dict.getArray('Coords');
48783    this.shadingType = dict.get('ShadingType');
48784    this.type = 'Pattern';
48785    var cs = dict.get('ColorSpace', 'CS');
48786    cs = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
48787    this.cs = cs;
48788    var t0 = 0.0,
48789        t1 = 1.0;
48790
48791    if (dict.has('Domain')) {
48792      var domainArr = dict.getArray('Domain');
48793      t0 = domainArr[0];
48794      t1 = domainArr[1];
48795    }
48796
48797    var extendStart = false,
48798        extendEnd = false;
48799
48800    if (dict.has('Extend')) {
48801      var extendArr = dict.getArray('Extend');
48802      extendStart = extendArr[0];
48803      extendEnd = extendArr[1];
48804    }
48805
48806    if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
48807      var x1 = this.coordsArr[0];
48808      var y1 = this.coordsArr[1];
48809      var r1 = this.coordsArr[2];
48810      var x2 = this.coordsArr[3];
48811      var y2 = this.coordsArr[4];
48812      var r2 = this.coordsArr[5];
48813      var distance = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
48814
48815      if (r1 <= r2 + distance && r2 <= r1 + distance) {
48816        (0, _util.warn)('Unsupported radial gradient.');
48817      }
48818    }
48819
48820    this.extendStart = extendStart;
48821    this.extendEnd = extendEnd;
48822    var fnObj = dict.get('Function');
48823    var fn = pdfFunctionFactory.createFromArray(fnObj);
48824    var diff = t1 - t0;
48825    var step = diff / 10;
48826    var colorStops = this.colorStops = [];
48827
48828    if (t0 >= t1 || step <= 0) {
48829      (0, _util.info)('Bad shading domain.');
48830      return;
48831    }
48832
48833    var color = new Float32Array(cs.numComps),
48834        ratio = new Float32Array(1);
48835    var rgbColor;
48836
48837    for (var i = t0; i <= t1; i += step) {
48838      ratio[0] = i;
48839      fn(ratio, 0, color, 0);
48840      rgbColor = cs.getRgb(color, 0);
48841
48842      var cssColor = _util.Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
48843
48844      colorStops.push([(i - t0) / diff, cssColor]);
48845    }
48846
48847    var background = 'transparent';
48848
48849    if (dict.has('Background')) {
48850      rgbColor = cs.getRgb(dict.get('Background'), 0);
48851      background = _util.Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]);
48852    }
48853
48854    if (!extendStart) {
48855      colorStops.unshift([0, background]);
48856      colorStops[1][0] += Shadings.SMALL_NUMBER;
48857    }
48858
48859    if (!extendEnd) {
48860      colorStops[colorStops.length - 1][0] -= Shadings.SMALL_NUMBER;
48861      colorStops.push([1, background]);
48862    }
48863
48864    this.colorStops = colorStops;
48865  }
48866
48867  RadialAxial.prototype = {
48868    getIR: function RadialAxial_getIR() {
48869      var coordsArr = this.coordsArr;
48870      var shadingType = this.shadingType;
48871      var type, p0, p1, r0, r1;
48872
48873      if (shadingType === ShadingType.AXIAL) {
48874        p0 = [coordsArr[0], coordsArr[1]];
48875        p1 = [coordsArr[2], coordsArr[3]];
48876        r0 = null;
48877        r1 = null;
48878        type = 'axial';
48879      } else if (shadingType === ShadingType.RADIAL) {
48880        p0 = [coordsArr[0], coordsArr[1]];
48881        p1 = [coordsArr[3], coordsArr[4]];
48882        r0 = coordsArr[2];
48883        r1 = coordsArr[5];
48884        type = 'radial';
48885      } else {
48886        (0, _util.unreachable)("getPattern type unknown: ".concat(shadingType));
48887      }
48888
48889      var matrix = this.matrix;
48890
48891      if (matrix) {
48892        p0 = _util.Util.applyTransform(p0, matrix);
48893        p1 = _util.Util.applyTransform(p1, matrix);
48894
48895        if (shadingType === ShadingType.RADIAL) {
48896          var scale = _util.Util.singularValueDecompose2dScale(matrix);
48897
48898          r0 *= scale[0];
48899          r1 *= scale[1];
48900        }
48901      }
48902
48903      return ['RadialAxial', type, this.colorStops, p0, p1, r0, r1];
48904    }
48905  };
48906  return RadialAxial;
48907}();
48908
48909Shadings.Mesh = function MeshClosure() {
48910  function MeshStreamReader(stream, context) {
48911    this.stream = stream;
48912    this.context = context;
48913    this.buffer = 0;
48914    this.bufferLength = 0;
48915    var numComps = context.numComps;
48916    this.tmpCompsBuf = new Float32Array(numComps);
48917    var csNumComps = context.colorSpace.numComps;
48918    this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
48919  }
48920
48921  MeshStreamReader.prototype = {
48922    get hasData() {
48923      if (this.stream.end) {
48924        return this.stream.pos < this.stream.end;
48925      }
48926
48927      if (this.bufferLength > 0) {
48928        return true;
48929      }
48930
48931      var nextByte = this.stream.getByte();
48932
48933      if (nextByte < 0) {
48934        return false;
48935      }
48936
48937      this.buffer = nextByte;
48938      this.bufferLength = 8;
48939      return true;
48940    },
48941
48942    readBits: function MeshStreamReader_readBits(n) {
48943      var buffer = this.buffer;
48944      var bufferLength = this.bufferLength;
48945
48946      if (n === 32) {
48947        if (bufferLength === 0) {
48948          return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
48949        }
48950
48951        buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
48952        var nextByte = this.stream.getByte();
48953        this.buffer = nextByte & (1 << bufferLength) - 1;
48954        return (buffer << 8 - bufferLength | (nextByte & 0xFF) >> bufferLength) >>> 0;
48955      }
48956
48957      if (n === 8 && bufferLength === 0) {
48958        return this.stream.getByte();
48959      }
48960
48961      while (bufferLength < n) {
48962        buffer = buffer << 8 | this.stream.getByte();
48963        bufferLength += 8;
48964      }
48965
48966      bufferLength -= n;
48967      this.bufferLength = bufferLength;
48968      this.buffer = buffer & (1 << bufferLength) - 1;
48969      return buffer >> bufferLength;
48970    },
48971    align: function MeshStreamReader_align() {
48972      this.buffer = 0;
48973      this.bufferLength = 0;
48974    },
48975    readFlag: function MeshStreamReader_readFlag() {
48976      return this.readBits(this.context.bitsPerFlag);
48977    },
48978    readCoordinate: function MeshStreamReader_readCoordinate() {
48979      var bitsPerCoordinate = this.context.bitsPerCoordinate;
48980      var xi = this.readBits(bitsPerCoordinate);
48981      var yi = this.readBits(bitsPerCoordinate);
48982      var decode = this.context.decode;
48983      var scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
48984      return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]];
48985    },
48986    readComponents: function MeshStreamReader_readComponents() {
48987      var numComps = this.context.numComps;
48988      var bitsPerComponent = this.context.bitsPerComponent;
48989      var scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
48990      var decode = this.context.decode;
48991      var components = this.tmpCompsBuf;
48992
48993      for (var i = 0, j = 4; i < numComps; i++, j += 2) {
48994        var ci = this.readBits(bitsPerComponent);
48995        components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
48996      }
48997
48998      var color = this.tmpCsCompsBuf;
48999
49000      if (this.context.colorFn) {
49001        this.context.colorFn(components, 0, color, 0);
49002      }
49003
49004      return this.context.colorSpace.getRgb(color, 0);
49005    }
49006  };
49007
49008  function decodeType4Shading(mesh, reader) {
49009    var coords = mesh.coords;
49010    var colors = mesh.colors;
49011    var operators = [];
49012    var ps = [];
49013    var verticesLeft = 0;
49014
49015    while (reader.hasData) {
49016      var f = reader.readFlag();
49017      var coord = reader.readCoordinate();
49018      var color = reader.readComponents();
49019
49020      if (verticesLeft === 0) {
49021        if (!(0 <= f && f <= 2)) {
49022          throw new _util.FormatError('Unknown type4 flag');
49023        }
49024
49025        switch (f) {
49026          case 0:
49027            verticesLeft = 3;
49028            break;
49029
49030          case 1:
49031            ps.push(ps[ps.length - 2], ps[ps.length - 1]);
49032            verticesLeft = 1;
49033            break;
49034
49035          case 2:
49036            ps.push(ps[ps.length - 3], ps[ps.length - 1]);
49037            verticesLeft = 1;
49038            break;
49039        }
49040
49041        operators.push(f);
49042      }
49043
49044      ps.push(coords.length);
49045      coords.push(coord);
49046      colors.push(color);
49047      verticesLeft--;
49048      reader.align();
49049    }
49050
49051    mesh.figures.push({
49052      type: 'triangles',
49053      coords: new Int32Array(ps),
49054      colors: new Int32Array(ps)
49055    });
49056  }
49057
49058  function decodeType5Shading(mesh, reader, verticesPerRow) {
49059    var coords = mesh.coords;
49060    var colors = mesh.colors;
49061    var ps = [];
49062
49063    while (reader.hasData) {
49064      var coord = reader.readCoordinate();
49065      var color = reader.readComponents();
49066      ps.push(coords.length);
49067      coords.push(coord);
49068      colors.push(color);
49069    }
49070
49071    mesh.figures.push({
49072      type: 'lattice',
49073      coords: new Int32Array(ps),
49074      colors: new Int32Array(ps),
49075      verticesPerRow: verticesPerRow
49076    });
49077  }
49078
49079  var MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3;
49080  var MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20;
49081  var TRIANGLE_DENSITY = 20;
49082
49083  var getB = function getBClosure() {
49084    function buildB(count) {
49085      var lut = [];
49086
49087      for (var i = 0; i <= count; i++) {
49088        var t = i / count,
49089            t_ = 1 - t;
49090        lut.push(new Float32Array([t_ * t_ * t_, 3 * t * t_ * t_, 3 * t * t * t_, t * t * t]));
49091      }
49092
49093      return lut;
49094    }
49095
49096    var cache = [];
49097    return function getB(count) {
49098      if (!cache[count]) {
49099        cache[count] = buildB(count);
49100      }
49101
49102      return cache[count];
49103    };
49104  }();
49105
49106  function buildFigureFromPatch(mesh, index) {
49107    var figure = mesh.figures[index];
49108    (0, _util.assert)(figure.type === 'patch', 'Unexpected patch mesh figure');
49109    var coords = mesh.coords,
49110        colors = mesh.colors;
49111    var pi = figure.coords;
49112    var ci = figure.colors;
49113    var figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
49114    var figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
49115    var figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
49116    var figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
49117    var splitXBy = Math.ceil((figureMaxX - figureMinX) * TRIANGLE_DENSITY / (mesh.bounds[2] - mesh.bounds[0]));
49118    splitXBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
49119    var splitYBy = Math.ceil((figureMaxY - figureMinY) * TRIANGLE_DENSITY / (mesh.bounds[3] - mesh.bounds[1]));
49120    splitYBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
49121    var verticesPerRow = splitXBy + 1;
49122    var figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
49123    var figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
49124    var k = 0;
49125    var cl = new Uint8Array(3),
49126        cr = new Uint8Array(3);
49127    var c0 = colors[ci[0]],
49128        c1 = colors[ci[1]],
49129        c2 = colors[ci[2]],
49130        c3 = colors[ci[3]];
49131    var bRow = getB(splitYBy),
49132        bCol = getB(splitXBy);
49133
49134    for (var row = 0; row <= splitYBy; row++) {
49135      cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
49136      cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
49137      cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
49138      cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
49139      cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
49140      cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
49141
49142      for (var col = 0; col <= splitXBy; col++, k++) {
49143        if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
49144          continue;
49145        }
49146
49147        var x = 0,
49148            y = 0;
49149        var q = 0;
49150
49151        for (var i = 0; i <= 3; i++) {
49152          for (var j = 0; j <= 3; j++, q++) {
49153            var m = bRow[row][i] * bCol[col][j];
49154            x += coords[pi[q]][0] * m;
49155            y += coords[pi[q]][1] * m;
49156          }
49157        }
49158
49159        figureCoords[k] = coords.length;
49160        coords.push([x, y]);
49161        figureColors[k] = colors.length;
49162        var newColor = new Uint8Array(3);
49163        newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
49164        newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
49165        newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
49166        colors.push(newColor);
49167      }
49168    }
49169
49170    figureCoords[0] = pi[0];
49171    figureColors[0] = ci[0];
49172    figureCoords[splitXBy] = pi[3];
49173    figureColors[splitXBy] = ci[1];
49174    figureCoords[verticesPerRow * splitYBy] = pi[12];
49175    figureColors[verticesPerRow * splitYBy] = ci[2];
49176    figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
49177    figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
49178    mesh.figures[index] = {
49179      type: 'lattice',
49180      coords: figureCoords,
49181      colors: figureColors,
49182      verticesPerRow: verticesPerRow
49183    };
49184  }
49185
49186  function decodeType6Shading(mesh, reader) {
49187    var coords = mesh.coords;
49188    var colors = mesh.colors;
49189    var ps = new Int32Array(16);
49190    var cs = new Int32Array(4);
49191
49192    while (reader.hasData) {
49193      var f = reader.readFlag();
49194
49195      if (!(0 <= f && f <= 3)) {
49196        throw new _util.FormatError('Unknown type6 flag');
49197      }
49198
49199      var i, ii;
49200      var pi = coords.length;
49201
49202      for (i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
49203        coords.push(reader.readCoordinate());
49204      }
49205
49206      var ci = colors.length;
49207
49208      for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
49209        colors.push(reader.readComponents());
49210      }
49211
49212      var tmp1, tmp2, tmp3, tmp4;
49213
49214      switch (f) {
49215        case 0:
49216          ps[12] = pi + 3;
49217          ps[13] = pi + 4;
49218          ps[14] = pi + 5;
49219          ps[15] = pi + 6;
49220          ps[8] = pi + 2;
49221          ps[11] = pi + 7;
49222          ps[4] = pi + 1;
49223          ps[7] = pi + 8;
49224          ps[0] = pi;
49225          ps[1] = pi + 11;
49226          ps[2] = pi + 10;
49227          ps[3] = pi + 9;
49228          cs[2] = ci + 1;
49229          cs[3] = ci + 2;
49230          cs[0] = ci;
49231          cs[1] = ci + 3;
49232          break;
49233
49234        case 1:
49235          tmp1 = ps[12];
49236          tmp2 = ps[13];
49237          tmp3 = ps[14];
49238          tmp4 = ps[15];
49239          ps[12] = tmp4;
49240          ps[13] = pi + 0;
49241          ps[14] = pi + 1;
49242          ps[15] = pi + 2;
49243          ps[8] = tmp3;
49244          ps[11] = pi + 3;
49245          ps[4] = tmp2;
49246          ps[7] = pi + 4;
49247          ps[0] = tmp1;
49248          ps[1] = pi + 7;
49249          ps[2] = pi + 6;
49250          ps[3] = pi + 5;
49251          tmp1 = cs[2];
49252          tmp2 = cs[3];
49253          cs[2] = tmp2;
49254          cs[3] = ci;
49255          cs[0] = tmp1;
49256          cs[1] = ci + 1;
49257          break;
49258
49259        case 2:
49260          tmp1 = ps[15];
49261          tmp2 = ps[11];
49262          ps[12] = ps[3];
49263          ps[13] = pi + 0;
49264          ps[14] = pi + 1;
49265          ps[15] = pi + 2;
49266          ps[8] = ps[7];
49267          ps[11] = pi + 3;
49268          ps[4] = tmp2;
49269          ps[7] = pi + 4;
49270          ps[0] = tmp1;
49271          ps[1] = pi + 7;
49272          ps[2] = pi + 6;
49273          ps[3] = pi + 5;
49274          tmp1 = cs[3];
49275          cs[2] = cs[1];
49276          cs[3] = ci;
49277          cs[0] = tmp1;
49278          cs[1] = ci + 1;
49279          break;
49280
49281        case 3:
49282          ps[12] = ps[0];
49283          ps[13] = pi + 0;
49284          ps[14] = pi + 1;
49285          ps[15] = pi + 2;
49286          ps[8] = ps[1];
49287          ps[11] = pi + 3;
49288          ps[4] = ps[2];
49289          ps[7] = pi + 4;
49290          ps[0] = ps[3];
49291          ps[1] = pi + 7;
49292          ps[2] = pi + 6;
49293          ps[3] = pi + 5;
49294          cs[2] = cs[0];
49295          cs[3] = ci;
49296          cs[0] = cs[1];
49297          cs[1] = ci + 1;
49298          break;
49299      }
49300
49301      ps[5] = coords.length;
49302      coords.push([(-4 * coords[ps[0]][0] - coords[ps[15]][0] + 6 * (coords[ps[4]][0] + coords[ps[1]][0]) - 2 * (coords[ps[12]][0] + coords[ps[3]][0]) + 3 * (coords[ps[13]][0] + coords[ps[7]][0])) / 9, (-4 * coords[ps[0]][1] - coords[ps[15]][1] + 6 * (coords[ps[4]][1] + coords[ps[1]][1]) - 2 * (coords[ps[12]][1] + coords[ps[3]][1]) + 3 * (coords[ps[13]][1] + coords[ps[7]][1])) / 9]);
49303      ps[6] = coords.length;
49304      coords.push([(-4 * coords[ps[3]][0] - coords[ps[12]][0] + 6 * (coords[ps[2]][0] + coords[ps[7]][0]) - 2 * (coords[ps[0]][0] + coords[ps[15]][0]) + 3 * (coords[ps[4]][0] + coords[ps[14]][0])) / 9, (-4 * coords[ps[3]][1] - coords[ps[12]][1] + 6 * (coords[ps[2]][1] + coords[ps[7]][1]) - 2 * (coords[ps[0]][1] + coords[ps[15]][1]) + 3 * (coords[ps[4]][1] + coords[ps[14]][1])) / 9]);
49305      ps[9] = coords.length;
49306      coords.push([(-4 * coords[ps[12]][0] - coords[ps[3]][0] + 6 * (coords[ps[8]][0] + coords[ps[13]][0]) - 2 * (coords[ps[0]][0] + coords[ps[15]][0]) + 3 * (coords[ps[11]][0] + coords[ps[1]][0])) / 9, (-4 * coords[ps[12]][1] - coords[ps[3]][1] + 6 * (coords[ps[8]][1] + coords[ps[13]][1]) - 2 * (coords[ps[0]][1] + coords[ps[15]][1]) + 3 * (coords[ps[11]][1] + coords[ps[1]][1])) / 9]);
49307      ps[10] = coords.length;
49308      coords.push([(-4 * coords[ps[15]][0] - coords[ps[0]][0] + 6 * (coords[ps[11]][0] + coords[ps[14]][0]) - 2 * (coords[ps[12]][0] + coords[ps[3]][0]) + 3 * (coords[ps[2]][0] + coords[ps[8]][0])) / 9, (-4 * coords[ps[15]][1] - coords[ps[0]][1] + 6 * (coords[ps[11]][1] + coords[ps[14]][1]) - 2 * (coords[ps[12]][1] + coords[ps[3]][1]) + 3 * (coords[ps[2]][1] + coords[ps[8]][1])) / 9]);
49309      mesh.figures.push({
49310        type: 'patch',
49311        coords: new Int32Array(ps),
49312        colors: new Int32Array(cs)
49313      });
49314    }
49315  }
49316
49317  function decodeType7Shading(mesh, reader) {
49318    var coords = mesh.coords;
49319    var colors = mesh.colors;
49320    var ps = new Int32Array(16);
49321    var cs = new Int32Array(4);
49322
49323    while (reader.hasData) {
49324      var f = reader.readFlag();
49325
49326      if (!(0 <= f && f <= 3)) {
49327        throw new _util.FormatError('Unknown type7 flag');
49328      }
49329
49330      var i, ii;
49331      var pi = coords.length;
49332
49333      for (i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
49334        coords.push(reader.readCoordinate());
49335      }
49336
49337      var ci = colors.length;
49338
49339      for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
49340        colors.push(reader.readComponents());
49341      }
49342
49343      var tmp1, tmp2, tmp3, tmp4;
49344
49345      switch (f) {
49346        case 0:
49347          ps[12] = pi + 3;
49348          ps[13] = pi + 4;
49349          ps[14] = pi + 5;
49350          ps[15] = pi + 6;
49351          ps[8] = pi + 2;
49352          ps[9] = pi + 13;
49353          ps[10] = pi + 14;
49354          ps[11] = pi + 7;
49355          ps[4] = pi + 1;
49356          ps[5] = pi + 12;
49357          ps[6] = pi + 15;
49358          ps[7] = pi + 8;
49359          ps[0] = pi;
49360          ps[1] = pi + 11;
49361          ps[2] = pi + 10;
49362          ps[3] = pi + 9;
49363          cs[2] = ci + 1;
49364          cs[3] = ci + 2;
49365          cs[0] = ci;
49366          cs[1] = ci + 3;
49367          break;
49368
49369        case 1:
49370          tmp1 = ps[12];
49371          tmp2 = ps[13];
49372          tmp3 = ps[14];
49373          tmp4 = ps[15];
49374          ps[12] = tmp4;
49375          ps[13] = pi + 0;
49376          ps[14] = pi + 1;
49377          ps[15] = pi + 2;
49378          ps[8] = tmp3;
49379          ps[9] = pi + 9;
49380          ps[10] = pi + 10;
49381          ps[11] = pi + 3;
49382          ps[4] = tmp2;
49383          ps[5] = pi + 8;
49384          ps[6] = pi + 11;
49385          ps[7] = pi + 4;
49386          ps[0] = tmp1;
49387          ps[1] = pi + 7;
49388          ps[2] = pi + 6;
49389          ps[3] = pi + 5;
49390          tmp1 = cs[2];
49391          tmp2 = cs[3];
49392          cs[2] = tmp2;
49393          cs[3] = ci;
49394          cs[0] = tmp1;
49395          cs[1] = ci + 1;
49396          break;
49397
49398        case 2:
49399          tmp1 = ps[15];
49400          tmp2 = ps[11];
49401          ps[12] = ps[3];
49402          ps[13] = pi + 0;
49403          ps[14] = pi + 1;
49404          ps[15] = pi + 2;
49405          ps[8] = ps[7];
49406          ps[9] = pi + 9;
49407          ps[10] = pi + 10;
49408          ps[11] = pi + 3;
49409          ps[4] = tmp2;
49410          ps[5] = pi + 8;
49411          ps[6] = pi + 11;
49412          ps[7] = pi + 4;
49413          ps[0] = tmp1;
49414          ps[1] = pi + 7;
49415          ps[2] = pi + 6;
49416          ps[3] = pi + 5;
49417          tmp1 = cs[3];
49418          cs[2] = cs[1];
49419          cs[3] = ci;
49420          cs[0] = tmp1;
49421          cs[1] = ci + 1;
49422          break;
49423
49424        case 3:
49425          ps[12] = ps[0];
49426          ps[13] = pi + 0;
49427          ps[14] = pi + 1;
49428          ps[15] = pi + 2;
49429          ps[8] = ps[1];
49430          ps[9] = pi + 9;
49431          ps[10] = pi + 10;
49432          ps[11] = pi + 3;
49433          ps[4] = ps[2];
49434          ps[5] = pi + 8;
49435          ps[6] = pi + 11;
49436          ps[7] = pi + 4;
49437          ps[0] = ps[3];
49438          ps[1] = pi + 7;
49439          ps[2] = pi + 6;
49440          ps[3] = pi + 5;
49441          cs[2] = cs[0];
49442          cs[3] = ci;
49443          cs[0] = cs[1];
49444          cs[1] = ci + 1;
49445          break;
49446      }
49447
49448      mesh.figures.push({
49449        type: 'patch',
49450        coords: new Int32Array(ps),
49451        colors: new Int32Array(cs)
49452      });
49453    }
49454  }
49455
49456  function updateBounds(mesh) {
49457    var minX = mesh.coords[0][0],
49458        minY = mesh.coords[0][1],
49459        maxX = minX,
49460        maxY = minY;
49461
49462    for (var i = 1, ii = mesh.coords.length; i < ii; i++) {
49463      var x = mesh.coords[i][0],
49464          y = mesh.coords[i][1];
49465      minX = minX > x ? x : minX;
49466      minY = minY > y ? y : minY;
49467      maxX = maxX < x ? x : maxX;
49468      maxY = maxY < y ? y : maxY;
49469    }
49470
49471    mesh.bounds = [minX, minY, maxX, maxY];
49472  }
49473
49474  function packData(mesh) {
49475    var i, ii, j, jj;
49476    var coords = mesh.coords;
49477    var coordsPacked = new Float32Array(coords.length * 2);
49478
49479    for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
49480      var xy = coords[i];
49481      coordsPacked[j++] = xy[0];
49482      coordsPacked[j++] = xy[1];
49483    }
49484
49485    mesh.coords = coordsPacked;
49486    var colors = mesh.colors;
49487    var colorsPacked = new Uint8Array(colors.length * 3);
49488
49489    for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
49490      var c = colors[i];
49491      colorsPacked[j++] = c[0];
49492      colorsPacked[j++] = c[1];
49493      colorsPacked[j++] = c[2];
49494    }
49495
49496    mesh.colors = colorsPacked;
49497    var figures = mesh.figures;
49498
49499    for (i = 0, ii = figures.length; i < ii; i++) {
49500      var figure = figures[i],
49501          ps = figure.coords,
49502          cs = figure.colors;
49503
49504      for (j = 0, jj = ps.length; j < jj; j++) {
49505        ps[j] *= 2;
49506        cs[j] *= 3;
49507      }
49508    }
49509  }
49510
49511  function Mesh(stream, matrix, xref, res, pdfFunctionFactory) {
49512    if (!(0, _primitives.isStream)(stream)) {
49513      throw new _util.FormatError('Mesh data is not a stream');
49514    }
49515
49516    var dict = stream.dict;
49517    this.matrix = matrix;
49518    this.shadingType = dict.get('ShadingType');
49519    this.type = 'Pattern';
49520    this.bbox = dict.getArray('BBox');
49521    var cs = dict.get('ColorSpace', 'CS');
49522    cs = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory);
49523    this.cs = cs;
49524    this.background = dict.has('Background') ? cs.getRgb(dict.get('Background'), 0) : null;
49525    var fnObj = dict.get('Function');
49526    var fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null;
49527    this.coords = [];
49528    this.colors = [];
49529    this.figures = [];
49530    var decodeContext = {
49531      bitsPerCoordinate: dict.get('BitsPerCoordinate'),
49532      bitsPerComponent: dict.get('BitsPerComponent'),
49533      bitsPerFlag: dict.get('BitsPerFlag'),
49534      decode: dict.getArray('Decode'),
49535      colorFn: fn,
49536      colorSpace: cs,
49537      numComps: fn ? 1 : cs.numComps
49538    };
49539    var reader = new MeshStreamReader(stream, decodeContext);
49540    var patchMesh = false;
49541
49542    switch (this.shadingType) {
49543      case ShadingType.FREE_FORM_MESH:
49544        decodeType4Shading(this, reader);
49545        break;
49546
49547      case ShadingType.LATTICE_FORM_MESH:
49548        var verticesPerRow = dict.get('VerticesPerRow') | 0;
49549
49550        if (verticesPerRow < 2) {
49551          throw new _util.FormatError('Invalid VerticesPerRow');
49552        }
49553
49554        decodeType5Shading(this, reader, verticesPerRow);
49555        break;
49556
49557      case ShadingType.COONS_PATCH_MESH:
49558        decodeType6Shading(this, reader);
49559        patchMesh = true;
49560        break;
49561
49562      case ShadingType.TENSOR_PATCH_MESH:
49563        decodeType7Shading(this, reader);
49564        patchMesh = true;
49565        break;
49566
49567      default:
49568        (0, _util.unreachable)('Unsupported mesh type.');
49569        break;
49570    }
49571
49572    if (patchMesh) {
49573      updateBounds(this);
49574
49575      for (var i = 0, ii = this.figures.length; i < ii; i++) {
49576        buildFigureFromPatch(this, i);
49577      }
49578    }
49579
49580    updateBounds(this);
49581    packData(this);
49582  }
49583
49584  Mesh.prototype = {
49585    getIR: function Mesh_getIR() {
49586      return ['Mesh', this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.matrix, this.bbox, this.background];
49587    }
49588  };
49589  return Mesh;
49590}();
49591
49592Shadings.Dummy = function DummyClosure() {
49593  function Dummy() {
49594    this.type = 'Pattern';
49595  }
49596
49597  Dummy.prototype = {
49598    getIR: function Dummy_getIR() {
49599      return ['Dummy'];
49600    }
49601  };
49602  return Dummy;
49603}();
49604
49605function getTilingPatternIR(operatorList, dict, args) {
49606  var matrix = dict.getArray('Matrix');
49607
49608  var bbox = _util.Util.normalizeRect(dict.getArray('BBox'));
49609
49610  var xstep = dict.get('XStep');
49611  var ystep = dict.get('YStep');
49612  var paintType = dict.get('PaintType');
49613  var tilingType = dict.get('TilingType');
49614
49615  if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
49616    throw new _util.FormatError("Invalid getTilingPatternIR /BBox array: [".concat(bbox, "]."));
49617  }
49618
49619  return ['TilingPattern', args, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
49620}
49621
49622/***/ }),
49623/* 184 */
49624/***/ (function(module, exports, __w_pdfjs_require__) {
49625
49626"use strict";
49627
49628
49629Object.defineProperty(exports, "__esModule", {
49630  value: true
49631});
49632exports.bidi = bidi;
49633
49634var _util = __w_pdfjs_require__(5);
49635
49636var baseTypes = ['BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'S', 'B', 'S', 'WS', 'B', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'B', 'B', 'B', 'S', 'WS', 'ON', 'ON', 'ET', 'ET', 'ET', 'ON', 'ON', 'ON', 'ON', 'ON', 'ES', 'CS', 'ES', 'CS', 'CS', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'CS', 'ON', 'ON', 'ON', 'ON', 'ON', 'ON', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'ON', 'ON', 'ON', 'ON', 'ON', 'ON', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'ON', 'ON', 'ON', 'ON', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'B', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'BN', 'CS', 'ON', 'ET', 'ET', 'ET', 'ET', 'ON', 'ON', 'ON', 'ON', 'L', 'ON', 'ON', 'BN', 'ON', 'ON', 'ET', 'ET', 'EN', 'EN', 'ON', 'L', 'ON', 'ON', 'ON', 'EN', 'L', 'ON', 'ON', 'ON', 'ON', 'ON', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'ON', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'ON', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L'];
49637var arabicTypes = ['AN', 'AN', 'AN', 'AN', 'AN', 'AN', 'ON', 'ON', 'AL', 'ET', 'ET', 'AL', 'CS', 'AL', 'ON', 'ON', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'AL', 'AL', '', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'AN', 'AN', 'AN', 'AN', 'AN', 'AN', 'AN', 'AN', 'AN', 'AN', 'ET', 'AN', 'AN', 'AL', 'AL', 'AL', 'NSM', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'AN', 'ON', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'NSM', 'AL', 'AL', 'NSM', 'NSM', 'ON', 'NSM', 'NSM', 'NSM', 'NSM', 'AL', 'AL', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'EN', 'AL', 'AL', 'AL', 'AL', 'AL', 'AL'];
49638
49639function isOdd(i) {
49640  return (i & 1) !== 0;
49641}
49642
49643function isEven(i) {
49644  return (i & 1) === 0;
49645}
49646
49647function findUnequal(arr, start, value) {
49648  for (var j = start, jj = arr.length; j < jj; ++j) {
49649    if (arr[j] !== value) {
49650      return j;
49651    }
49652  }
49653
49654  return j;
49655}
49656
49657function setValues(arr, start, end, value) {
49658  for (var j = start; j < end; ++j) {
49659    arr[j] = value;
49660  }
49661}
49662
49663function reverseValues(arr, start, end) {
49664  for (var i = start, j = end - 1; i < j; ++i, --j) {
49665    var temp = arr[i];
49666    arr[i] = arr[j];
49667    arr[j] = temp;
49668  }
49669}
49670
49671function createBidiText(str, isLTR, vertical) {
49672  return {
49673    str: str,
49674    dir: vertical ? 'ttb' : isLTR ? 'ltr' : 'rtl'
49675  };
49676}
49677
49678var chars = [];
49679var types = [];
49680
49681function bidi(str, startLevel, vertical) {
49682  var isLTR = true;
49683  var strLength = str.length;
49684
49685  if (strLength === 0 || vertical) {
49686    return createBidiText(str, isLTR, vertical);
49687  }
49688
49689  chars.length = strLength;
49690  types.length = strLength;
49691  var numBidi = 0;
49692  var i, ii;
49693
49694  for (i = 0; i < strLength; ++i) {
49695    chars[i] = str.charAt(i);
49696    var charCode = str.charCodeAt(i);
49697    var charType = 'L';
49698
49699    if (charCode <= 0x00ff) {
49700      charType = baseTypes[charCode];
49701    } else if (0x0590 <= charCode && charCode <= 0x05f4) {
49702      charType = 'R';
49703    } else if (0x0600 <= charCode && charCode <= 0x06ff) {
49704      charType = arabicTypes[charCode & 0xff];
49705
49706      if (!charType) {
49707        (0, _util.warn)('Bidi: invalid Unicode character ' + charCode.toString(16));
49708      }
49709    } else if (0x0700 <= charCode && charCode <= 0x08AC) {
49710      charType = 'AL';
49711    }
49712
49713    if (charType === 'R' || charType === 'AL' || charType === 'AN') {
49714      numBidi++;
49715    }
49716
49717    types[i] = charType;
49718  }
49719
49720  if (numBidi === 0) {
49721    isLTR = true;
49722    return createBidiText(str, isLTR);
49723  }
49724
49725  if (startLevel === -1) {
49726    if (numBidi / strLength < 0.3) {
49727      isLTR = true;
49728      startLevel = 0;
49729    } else {
49730      isLTR = false;
49731      startLevel = 1;
49732    }
49733  }
49734
49735  var levels = [];
49736
49737  for (i = 0; i < strLength; ++i) {
49738    levels[i] = startLevel;
49739  }
49740
49741  var e = isOdd(startLevel) ? 'R' : 'L';
49742  var sor = e;
49743  var eor = sor;
49744  var lastType = sor;
49745
49746  for (i = 0; i < strLength; ++i) {
49747    if (types[i] === 'NSM') {
49748      types[i] = lastType;
49749    } else {
49750      lastType = types[i];
49751    }
49752  }
49753
49754  lastType = sor;
49755  var t;
49756
49757  for (i = 0; i < strLength; ++i) {
49758    t = types[i];
49759
49760    if (t === 'EN') {
49761      types[i] = lastType === 'AL' ? 'AN' : 'EN';
49762    } else if (t === 'R' || t === 'L' || t === 'AL') {
49763      lastType = t;
49764    }
49765  }
49766
49767  for (i = 0; i < strLength; ++i) {
49768    t = types[i];
49769
49770    if (t === 'AL') {
49771      types[i] = 'R';
49772    }
49773  }
49774
49775  for (i = 1; i < strLength - 1; ++i) {
49776    if (types[i] === 'ES' && types[i - 1] === 'EN' && types[i + 1] === 'EN') {
49777      types[i] = 'EN';
49778    }
49779
49780    if (types[i] === 'CS' && (types[i - 1] === 'EN' || types[i - 1] === 'AN') && types[i + 1] === types[i - 1]) {
49781      types[i] = types[i - 1];
49782    }
49783  }
49784
49785  for (i = 0; i < strLength; ++i) {
49786    if (types[i] === 'EN') {
49787      var j;
49788
49789      for (j = i - 1; j >= 0; --j) {
49790        if (types[j] !== 'ET') {
49791          break;
49792        }
49793
49794        types[j] = 'EN';
49795      }
49796
49797      for (j = i + 1; j < strLength; ++j) {
49798        if (types[j] !== 'ET') {
49799          break;
49800        }
49801
49802        types[j] = 'EN';
49803      }
49804    }
49805  }
49806
49807  for (i = 0; i < strLength; ++i) {
49808    t = types[i];
49809
49810    if (t === 'WS' || t === 'ES' || t === 'ET' || t === 'CS') {
49811      types[i] = 'ON';
49812    }
49813  }
49814
49815  lastType = sor;
49816
49817  for (i = 0; i < strLength; ++i) {
49818    t = types[i];
49819
49820    if (t === 'EN') {
49821      types[i] = lastType === 'L' ? 'L' : 'EN';
49822    } else if (t === 'R' || t === 'L') {
49823      lastType = t;
49824    }
49825  }
49826
49827  for (i = 0; i < strLength; ++i) {
49828    if (types[i] === 'ON') {
49829      var end = findUnequal(types, i + 1, 'ON');
49830      var before = sor;
49831
49832      if (i > 0) {
49833        before = types[i - 1];
49834      }
49835
49836      var after = eor;
49837
49838      if (end + 1 < strLength) {
49839        after = types[end + 1];
49840      }
49841
49842      if (before !== 'L') {
49843        before = 'R';
49844      }
49845
49846      if (after !== 'L') {
49847        after = 'R';
49848      }
49849
49850      if (before === after) {
49851        setValues(types, i, end, before);
49852      }
49853
49854      i = end - 1;
49855    }
49856  }
49857
49858  for (i = 0; i < strLength; ++i) {
49859    if (types[i] === 'ON') {
49860      types[i] = e;
49861    }
49862  }
49863
49864  for (i = 0; i < strLength; ++i) {
49865    t = types[i];
49866
49867    if (isEven(levels[i])) {
49868      if (t === 'R') {
49869        levels[i] += 1;
49870      } else if (t === 'AN' || t === 'EN') {
49871        levels[i] += 2;
49872      }
49873    } else {
49874      if (t === 'L' || t === 'AN' || t === 'EN') {
49875        levels[i] += 1;
49876      }
49877    }
49878  }
49879
49880  var highestLevel = -1;
49881  var lowestOddLevel = 99;
49882  var level;
49883
49884  for (i = 0, ii = levels.length; i < ii; ++i) {
49885    level = levels[i];
49886
49887    if (highestLevel < level) {
49888      highestLevel = level;
49889    }
49890
49891    if (lowestOddLevel > level && isOdd(level)) {
49892      lowestOddLevel = level;
49893    }
49894  }
49895
49896  for (level = highestLevel; level >= lowestOddLevel; --level) {
49897    var start = -1;
49898
49899    for (i = 0, ii = levels.length; i < ii; ++i) {
49900      if (levels[i] < level) {
49901        if (start >= 0) {
49902          reverseValues(chars, start, i);
49903          start = -1;
49904        }
49905      } else if (start < 0) {
49906        start = i;
49907      }
49908    }
49909
49910    if (start >= 0) {
49911      reverseValues(chars, start, levels.length);
49912    }
49913  }
49914
49915  for (i = 0, ii = chars.length; i < ii; ++i) {
49916    var ch = chars[i];
49917
49918    if (ch === '<' || ch === '>') {
49919      chars[i] = '';
49920    }
49921  }
49922
49923  return createBidiText(chars.join(''), isLTR);
49924}
49925
49926/***/ }),
49927/* 185 */
49928/***/ (function(module, exports, __w_pdfjs_require__) {
49929
49930"use strict";
49931
49932
49933Object.defineProperty(exports, "__esModule", {
49934  value: true
49935});
49936exports.getMetrics = void 0;
49937
49938var _core_utils = __w_pdfjs_require__(154);
49939
49940var getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
49941  t['Courier'] = 600;
49942  t['Courier-Bold'] = 600;
49943  t['Courier-BoldOblique'] = 600;
49944  t['Courier-Oblique'] = 600;
49945  t['Helvetica'] = (0, _core_utils.getLookupTableFactory)(function (t) {
49946    t['space'] = 278;
49947    t['exclam'] = 278;
49948    t['quotedbl'] = 355;
49949    t['numbersign'] = 556;
49950    t['dollar'] = 556;
49951    t['percent'] = 889;
49952    t['ampersand'] = 667;
49953    t['quoteright'] = 222;
49954    t['parenleft'] = 333;
49955    t['parenright'] = 333;
49956    t['asterisk'] = 389;
49957    t['plus'] = 584;
49958    t['comma'] = 278;
49959    t['hyphen'] = 333;
49960    t['period'] = 278;
49961    t['slash'] = 278;
49962    t['zero'] = 556;
49963    t['one'] = 556;
49964    t['two'] = 556;
49965    t['three'] = 556;
49966    t['four'] = 556;
49967    t['five'] = 556;
49968    t['six'] = 556;
49969    t['seven'] = 556;
49970    t['eight'] = 556;
49971    t['nine'] = 556;
49972    t['colon'] = 278;
49973    t['semicolon'] = 278;
49974    t['less'] = 584;
49975    t['equal'] = 584;
49976    t['greater'] = 584;
49977    t['question'] = 556;
49978    t['at'] = 1015;
49979    t['A'] = 667;
49980    t['B'] = 667;
49981    t['C'] = 722;
49982    t['D'] = 722;
49983    t['E'] = 667;
49984    t['F'] = 611;
49985    t['G'] = 778;
49986    t['H'] = 722;
49987    t['I'] = 278;
49988    t['J'] = 500;
49989    t['K'] = 667;
49990    t['L'] = 556;
49991    t['M'] = 833;
49992    t['N'] = 722;
49993    t['O'] = 778;
49994    t['P'] = 667;
49995    t['Q'] = 778;
49996    t['R'] = 722;
49997    t['S'] = 667;
49998    t['T'] = 611;
49999    t['U'] = 722;
50000    t['V'] = 667;
50001    t['W'] = 944;
50002    t['X'] = 667;
50003    t['Y'] = 667;
50004    t['Z'] = 611;
50005    t['bracketleft'] = 278;
50006    t['backslash'] = 278;
50007    t['bracketright'] = 278;
50008    t['asciicircum'] = 469;
50009    t['underscore'] = 556;
50010    t['quoteleft'] = 222;
50011    t['a'] = 556;
50012    t['b'] = 556;
50013    t['c'] = 500;
50014    t['d'] = 556;
50015    t['e'] = 556;
50016    t['f'] = 278;
50017    t['g'] = 556;
50018    t['h'] = 556;
50019    t['i'] = 222;
50020    t['j'] = 222;
50021    t['k'] = 500;
50022    t['l'] = 222;
50023    t['m'] = 833;
50024    t['n'] = 556;
50025    t['o'] = 556;
50026    t['p'] = 556;
50027    t['q'] = 556;
50028    t['r'] = 333;
50029    t['s'] = 500;
50030    t['t'] = 278;
50031    t['u'] = 556;
50032    t['v'] = 500;
50033    t['w'] = 722;
50034    t['x'] = 500;
50035    t['y'] = 500;
50036    t['z'] = 500;
50037    t['braceleft'] = 334;
50038    t['bar'] = 260;
50039    t['braceright'] = 334;
50040    t['asciitilde'] = 584;
50041    t['exclamdown'] = 333;
50042    t['cent'] = 556;
50043    t['sterling'] = 556;
50044    t['fraction'] = 167;
50045    t['yen'] = 556;
50046    t['florin'] = 556;
50047    t['section'] = 556;
50048    t['currency'] = 556;
50049    t['quotesingle'] = 191;
50050    t['quotedblleft'] = 333;
50051    t['guillemotleft'] = 556;
50052    t['guilsinglleft'] = 333;
50053    t['guilsinglright'] = 333;
50054    t['fi'] = 500;
50055    t['fl'] = 500;
50056    t['endash'] = 556;
50057    t['dagger'] = 556;
50058    t['daggerdbl'] = 556;
50059    t['periodcentered'] = 278;
50060    t['paragraph'] = 537;
50061    t['bullet'] = 350;
50062    t['quotesinglbase'] = 222;
50063    t['quotedblbase'] = 333;
50064    t['quotedblright'] = 333;
50065    t['guillemotright'] = 556;
50066    t['ellipsis'] = 1000;
50067    t['perthousand'] = 1000;
50068    t['questiondown'] = 611;
50069    t['grave'] = 333;
50070    t['acute'] = 333;
50071    t['circumflex'] = 333;
50072    t['tilde'] = 333;
50073    t['macron'] = 333;
50074    t['breve'] = 333;
50075    t['dotaccent'] = 333;
50076    t['dieresis'] = 333;
50077    t['ring'] = 333;
50078    t['cedilla'] = 333;
50079    t['hungarumlaut'] = 333;
50080    t['ogonek'] = 333;
50081    t['caron'] = 333;
50082    t['emdash'] = 1000;
50083    t['AE'] = 1000;
50084    t['ordfeminine'] = 370;
50085    t['Lslash'] = 556;
50086    t['Oslash'] = 778;
50087    t['OE'] = 1000;
50088    t['ordmasculine'] = 365;
50089    t['ae'] = 889;
50090    t['dotlessi'] = 278;
50091    t['lslash'] = 222;
50092    t['oslash'] = 611;
50093    t['oe'] = 944;
50094    t['germandbls'] = 611;
50095    t['Idieresis'] = 278;
50096    t['eacute'] = 556;
50097    t['abreve'] = 556;
50098    t['uhungarumlaut'] = 556;
50099    t['ecaron'] = 556;
50100    t['Ydieresis'] = 667;
50101    t['divide'] = 584;
50102    t['Yacute'] = 667;
50103    t['Acircumflex'] = 667;
50104    t['aacute'] = 556;
50105    t['Ucircumflex'] = 722;
50106    t['yacute'] = 500;
50107    t['scommaaccent'] = 500;
50108    t['ecircumflex'] = 556;
50109    t['Uring'] = 722;
50110    t['Udieresis'] = 722;
50111    t['aogonek'] = 556;
50112    t['Uacute'] = 722;
50113    t['uogonek'] = 556;
50114    t['Edieresis'] = 667;
50115    t['Dcroat'] = 722;
50116    t['commaaccent'] = 250;
50117    t['copyright'] = 737;
50118    t['Emacron'] = 667;
50119    t['ccaron'] = 500;
50120    t['aring'] = 556;
50121    t['Ncommaaccent'] = 722;
50122    t['lacute'] = 222;
50123    t['agrave'] = 556;
50124    t['Tcommaaccent'] = 611;
50125    t['Cacute'] = 722;
50126    t['atilde'] = 556;
50127    t['Edotaccent'] = 667;
50128    t['scaron'] = 500;
50129    t['scedilla'] = 500;
50130    t['iacute'] = 278;
50131    t['lozenge'] = 471;
50132    t['Rcaron'] = 722;
50133    t['Gcommaaccent'] = 778;
50134    t['ucircumflex'] = 556;
50135    t['acircumflex'] = 556;
50136    t['Amacron'] = 667;
50137    t['rcaron'] = 333;
50138    t['ccedilla'] = 500;
50139    t['Zdotaccent'] = 611;
50140    t['Thorn'] = 667;
50141    t['Omacron'] = 778;
50142    t['Racute'] = 722;
50143    t['Sacute'] = 667;
50144    t['dcaron'] = 643;
50145    t['Umacron'] = 722;
50146    t['uring'] = 556;
50147    t['threesuperior'] = 333;
50148    t['Ograve'] = 778;
50149    t['Agrave'] = 667;
50150    t['Abreve'] = 667;
50151    t['multiply'] = 584;
50152    t['uacute'] = 556;
50153    t['Tcaron'] = 611;
50154    t['partialdiff'] = 476;
50155    t['ydieresis'] = 500;
50156    t['Nacute'] = 722;
50157    t['icircumflex'] = 278;
50158    t['Ecircumflex'] = 667;
50159    t['adieresis'] = 556;
50160    t['edieresis'] = 556;
50161    t['cacute'] = 500;
50162    t['nacute'] = 556;
50163    t['umacron'] = 556;
50164    t['Ncaron'] = 722;
50165    t['Iacute'] = 278;
50166    t['plusminus'] = 584;
50167    t['brokenbar'] = 260;
50168    t['registered'] = 737;
50169    t['Gbreve'] = 778;
50170    t['Idotaccent'] = 278;
50171    t['summation'] = 600;
50172    t['Egrave'] = 667;
50173    t['racute'] = 333;
50174    t['omacron'] = 556;
50175    t['Zacute'] = 611;
50176    t['Zcaron'] = 611;
50177    t['greaterequal'] = 549;
50178    t['Eth'] = 722;
50179    t['Ccedilla'] = 722;
50180    t['lcommaaccent'] = 222;
50181    t['tcaron'] = 317;
50182    t['eogonek'] = 556;
50183    t['Uogonek'] = 722;
50184    t['Aacute'] = 667;
50185    t['Adieresis'] = 667;
50186    t['egrave'] = 556;
50187    t['zacute'] = 500;
50188    t['iogonek'] = 222;
50189    t['Oacute'] = 778;
50190    t['oacute'] = 556;
50191    t['amacron'] = 556;
50192    t['sacute'] = 500;
50193    t['idieresis'] = 278;
50194    t['Ocircumflex'] = 778;
50195    t['Ugrave'] = 722;
50196    t['Delta'] = 612;
50197    t['thorn'] = 556;
50198    t['twosuperior'] = 333;
50199    t['Odieresis'] = 778;
50200    t['mu'] = 556;
50201    t['igrave'] = 278;
50202    t['ohungarumlaut'] = 556;
50203    t['Eogonek'] = 667;
50204    t['dcroat'] = 556;
50205    t['threequarters'] = 834;
50206    t['Scedilla'] = 667;
50207    t['lcaron'] = 299;
50208    t['Kcommaaccent'] = 667;
50209    t['Lacute'] = 556;
50210    t['trademark'] = 1000;
50211    t['edotaccent'] = 556;
50212    t['Igrave'] = 278;
50213    t['Imacron'] = 278;
50214    t['Lcaron'] = 556;
50215    t['onehalf'] = 834;
50216    t['lessequal'] = 549;
50217    t['ocircumflex'] = 556;
50218    t['ntilde'] = 556;
50219    t['Uhungarumlaut'] = 722;
50220    t['Eacute'] = 667;
50221    t['emacron'] = 556;
50222    t['gbreve'] = 556;
50223    t['onequarter'] = 834;
50224    t['Scaron'] = 667;
50225    t['Scommaaccent'] = 667;
50226    t['Ohungarumlaut'] = 778;
50227    t['degree'] = 400;
50228    t['ograve'] = 556;
50229    t['Ccaron'] = 722;
50230    t['ugrave'] = 556;
50231    t['radical'] = 453;
50232    t['Dcaron'] = 722;
50233    t['rcommaaccent'] = 333;
50234    t['Ntilde'] = 722;
50235    t['otilde'] = 556;
50236    t['Rcommaaccent'] = 722;
50237    t['Lcommaaccent'] = 556;
50238    t['Atilde'] = 667;
50239    t['Aogonek'] = 667;
50240    t['Aring'] = 667;
50241    t['Otilde'] = 778;
50242    t['zdotaccent'] = 500;
50243    t['Ecaron'] = 667;
50244    t['Iogonek'] = 278;
50245    t['kcommaaccent'] = 500;
50246    t['minus'] = 584;
50247    t['Icircumflex'] = 278;
50248    t['ncaron'] = 556;
50249    t['tcommaaccent'] = 278;
50250    t['logicalnot'] = 584;
50251    t['odieresis'] = 556;
50252    t['udieresis'] = 556;
50253    t['notequal'] = 549;
50254    t['gcommaaccent'] = 556;
50255    t['eth'] = 556;
50256    t['zcaron'] = 500;
50257    t['ncommaaccent'] = 556;
50258    t['onesuperior'] = 333;
50259    t['imacron'] = 278;
50260    t['Euro'] = 556;
50261  });
50262  t['Helvetica-Bold'] = (0, _core_utils.getLookupTableFactory)(function (t) {
50263    t['space'] = 278;
50264    t['exclam'] = 333;
50265    t['quotedbl'] = 474;
50266    t['numbersign'] = 556;
50267    t['dollar'] = 556;
50268    t['percent'] = 889;
50269    t['ampersand'] = 722;
50270    t['quoteright'] = 278;
50271    t['parenleft'] = 333;
50272    t['parenright'] = 333;
50273    t['asterisk'] = 389;
50274    t['plus'] = 584;
50275    t['comma'] = 278;
50276    t['hyphen'] = 333;
50277    t['period'] = 278;
50278    t['slash'] = 278;
50279    t['zero'] = 556;
50280    t['one'] = 556;
50281    t['two'] = 556;
50282    t['three'] = 556;
50283    t['four'] = 556;
50284    t['five'] = 556;
50285    t['six'] = 556;
50286    t['seven'] = 556;
50287    t['eight'] = 556;
50288    t['nine'] = 556;
50289    t['colon'] = 333;
50290    t['semicolon'] = 333;
50291    t['less'] = 584;
50292    t['equal'] = 584;
50293    t['greater'] = 584;
50294    t['question'] = 611;
50295    t['at'] = 975;
50296    t['A'] = 722;
50297    t['B'] = 722;
50298    t['C'] = 722;
50299    t['D'] = 722;
50300    t['E'] = 667;
50301    t['F'] = 611;
50302    t['G'] = 778;
50303    t['H'] = 722;
50304    t['I'] = 278;
50305    t['J'] = 556;
50306    t['K'] = 722;
50307    t['L'] = 611;
50308    t['M'] = 833;
50309    t['N'] = 722;
50310    t['O'] = 778;
50311    t['P'] = 667;
50312    t['Q'] = 778;
50313    t['R'] = 722;
50314    t['S'] = 667;
50315    t['T'] = 611;
50316    t['U'] = 722;
50317    t['V'] = 667;
50318    t['W'] = 944;
50319    t['X'] = 667;
50320    t['Y'] = 667;
50321    t['Z'] = 611;
50322    t['bracketleft'] = 333;
50323    t['backslash'] = 278;
50324    t['bracketright'] = 333;
50325    t['asciicircum'] = 584;
50326    t['underscore'] = 556;
50327    t['quoteleft'] = 278;
50328    t['a'] = 556;
50329    t['b'] = 611;
50330    t['c'] = 556;
50331    t['d'] = 611;
50332    t['e'] = 556;
50333    t['f'] = 333;
50334    t['g'] = 611;
50335    t['h'] = 611;
50336    t['i'] = 278;
50337    t['j'] = 278;
50338    t['k'] = 556;
50339    t['l'] = 278;
50340    t['m'] = 889;
50341    t['n'] = 611;
50342    t['o'] = 611;
50343    t['p'] = 611;
50344    t['q'] = 611;
50345    t['r'] = 389;
50346    t['s'] = 556;
50347    t['t'] = 333;
50348    t['u'] = 611;
50349    t['v'] = 556;
50350    t['w'] = 778;
50351    t['x'] = 556;
50352    t['y'] = 556;
50353    t['z'] = 500;
50354    t['braceleft'] = 389;
50355    t['bar'] = 280;
50356    t['braceright'] = 389;
50357    t['asciitilde'] = 584;
50358    t['exclamdown'] = 333;
50359    t['cent'] = 556;
50360    t['sterling'] = 556;
50361    t['fraction'] = 167;
50362    t['yen'] = 556;
50363    t['florin'] = 556;
50364    t['section'] = 556;
50365    t['currency'] = 556;
50366    t['quotesingle'] = 238;
50367    t['quotedblleft'] = 500;
50368    t['guillemotleft'] = 556;
50369    t['guilsinglleft'] = 333;
50370    t['guilsinglright'] = 333;
50371    t['fi'] = 611;
50372    t['fl'] = 611;
50373    t['endash'] = 556;
50374    t['dagger'] = 556;
50375    t['daggerdbl'] = 556;
50376    t['periodcentered'] = 278;
50377    t['paragraph'] = 556;
50378    t['bullet'] = 350;
50379    t['quotesinglbase'] = 278;
50380    t['quotedblbase'] = 500;
50381    t['quotedblright'] = 500;
50382    t['guillemotright'] = 556;
50383    t['ellipsis'] = 1000;
50384    t['perthousand'] = 1000;
50385    t['questiondown'] = 611;
50386    t['grave'] = 333;
50387    t['acute'] = 333;
50388    t['circumflex'] = 333;
50389    t['tilde'] = 333;
50390    t['macron'] = 333;
50391    t['breve'] = 333;
50392    t['dotaccent'] = 333;
50393    t['dieresis'] = 333;
50394    t['ring'] = 333;
50395    t['cedilla'] = 333;
50396    t['hungarumlaut'] = 333;
50397    t['ogonek'] = 333;
50398    t['caron'] = 333;
50399    t['emdash'] = 1000;
50400    t['AE'] = 1000;
50401    t['ordfeminine'] = 370;
50402    t['Lslash'] = 611;
50403    t['Oslash'] = 778;
50404    t['OE'] = 1000;
50405    t['ordmasculine'] = 365;
50406    t['ae'] = 889;
50407    t['dotlessi'] = 278;
50408    t['lslash'] = 278;
50409    t['oslash'] = 611;
50410    t['oe'] = 944;
50411    t['germandbls'] = 611;
50412    t['Idieresis'] = 278;
50413    t['eacute'] = 556;
50414    t['abreve'] = 556;
50415    t['uhungarumlaut'] = 611;
50416    t['ecaron'] = 556;
50417    t['Ydieresis'] = 667;
50418    t['divide'] = 584;
50419    t['Yacute'] = 667;
50420    t['Acircumflex'] = 722;
50421    t['aacute'] = 556;
50422    t['Ucircumflex'] = 722;
50423    t['yacute'] = 556;
50424    t['scommaaccent'] = 556;
50425    t['ecircumflex'] = 556;
50426    t['Uring'] = 722;
50427    t['Udieresis'] = 722;
50428    t['aogonek'] = 556;
50429    t['Uacute'] = 722;
50430    t['uogonek'] = 611;
50431    t['Edieresis'] = 667;
50432    t['Dcroat'] = 722;
50433    t['commaaccent'] = 250;
50434    t['copyright'] = 737;
50435    t['Emacron'] = 667;
50436    t['ccaron'] = 556;
50437    t['aring'] = 556;
50438    t['Ncommaaccent'] = 722;
50439    t['lacute'] = 278;
50440    t['agrave'] = 556;
50441    t['Tcommaaccent'] = 611;
50442    t['Cacute'] = 722;
50443    t['atilde'] = 556;
50444    t['Edotaccent'] = 667;
50445    t['scaron'] = 556;
50446    t['scedilla'] = 556;
50447    t['iacute'] = 278;
50448    t['lozenge'] = 494;
50449    t['Rcaron'] = 722;
50450    t['Gcommaaccent'] = 778;
50451    t['ucircumflex'] = 611;
50452    t['acircumflex'] = 556;
50453    t['Amacron'] = 722;
50454    t['rcaron'] = 389;
50455    t['ccedilla'] = 556;
50456    t['Zdotaccent'] = 611;
50457    t['Thorn'] = 667;
50458    t['Omacron'] = 778;
50459    t['Racute'] = 722;
50460    t['Sacute'] = 667;
50461    t['dcaron'] = 743;
50462    t['Umacron'] = 722;
50463    t['uring'] = 611;
50464    t['threesuperior'] = 333;
50465    t['Ograve'] = 778;
50466    t['Agrave'] = 722;
50467    t['Abreve'] = 722;
50468    t['multiply'] = 584;
50469    t['uacute'] = 611;
50470    t['Tcaron'] = 611;
50471    t['partialdiff'] = 494;
50472    t['ydieresis'] = 556;
50473    t['Nacute'] = 722;
50474    t['icircumflex'] = 278;
50475    t['Ecircumflex'] = 667;
50476    t['adieresis'] = 556;
50477    t['edieresis'] = 556;
50478    t['cacute'] = 556;
50479    t['nacute'] = 611;
50480    t['umacron'] = 611;
50481    t['Ncaron'] = 722;
50482    t['Iacute'] = 278;
50483    t['plusminus'] = 584;
50484    t['brokenbar'] = 280;
50485    t['registered'] = 737;
50486    t['Gbreve'] = 778;
50487    t['Idotaccent'] = 278;
50488    t['summation'] = 600;
50489    t['Egrave'] = 667;
50490    t['racute'] = 389;
50491    t['omacron'] = 611;
50492    t['Zacute'] = 611;
50493    t['Zcaron'] = 611;
50494    t['greaterequal'] = 549;
50495    t['Eth'] = 722;
50496    t['Ccedilla'] = 722;
50497    t['lcommaaccent'] = 278;
50498    t['tcaron'] = 389;
50499    t['eogonek'] = 556;
50500    t['Uogonek'] = 722;
50501    t['Aacute'] = 722;
50502    t['Adieresis'] = 722;
50503    t['egrave'] = 556;
50504    t['zacute'] = 500;
50505    t['iogonek'] = 278;
50506    t['Oacute'] = 778;
50507    t['oacute'] = 611;
50508    t['amacron'] = 556;
50509    t['sacute'] = 556;
50510    t['idieresis'] = 278;
50511    t['Ocircumflex'] = 778;
50512    t['Ugrave'] = 722;
50513    t['Delta'] = 612;
50514    t['thorn'] = 611;
50515    t['twosuperior'] = 333;
50516    t['Odieresis'] = 778;
50517    t['mu'] = 611;
50518    t['igrave'] = 278;
50519    t['ohungarumlaut'] = 611;
50520    t['Eogonek'] = 667;
50521    t['dcroat'] = 611;
50522    t['threequarters'] = 834;
50523    t['Scedilla'] = 667;
50524    t['lcaron'] = 400;
50525    t['Kcommaaccent'] = 722;
50526    t['Lacute'] = 611;
50527    t['trademark'] = 1000;
50528    t['edotaccent'] = 556;
50529    t['Igrave'] = 278;
50530    t['Imacron'] = 278;
50531    t['Lcaron'] = 611;
50532    t['onehalf'] = 834;
50533    t['lessequal'] = 549;
50534    t['ocircumflex'] = 611;
50535    t['ntilde'] = 611;
50536    t['Uhungarumlaut'] = 722;
50537    t['Eacute'] = 667;
50538    t['emacron'] = 556;
50539    t['gbreve'] = 611;
50540    t['onequarter'] = 834;
50541    t['Scaron'] = 667;
50542    t['Scommaaccent'] = 667;
50543    t['Ohungarumlaut'] = 778;
50544    t['degree'] = 400;
50545    t['ograve'] = 611;
50546    t['Ccaron'] = 722;
50547    t['ugrave'] = 611;
50548    t['radical'] = 549;
50549    t['Dcaron'] = 722;
50550    t['rcommaaccent'] = 389;
50551    t['Ntilde'] = 722;
50552    t['otilde'] = 611;
50553    t['Rcommaaccent'] = 722;
50554    t['Lcommaaccent'] = 611;
50555    t['Atilde'] = 722;
50556    t['Aogonek'] = 722;
50557    t['Aring'] = 722;
50558    t['Otilde'] = 778;
50559    t['zdotaccent'] = 500;
50560    t['Ecaron'] = 667;
50561    t['Iogonek'] = 278;
50562    t['kcommaaccent'] = 556;
50563    t['minus'] = 584;
50564    t['Icircumflex'] = 278;
50565    t['ncaron'] = 611;
50566    t['tcommaaccent'] = 333;
50567    t['logicalnot'] = 584;
50568    t['odieresis'] = 611;
50569    t['udieresis'] = 611;
50570    t['notequal'] = 549;
50571    t['gcommaaccent'] = 611;
50572    t['eth'] = 611;
50573    t['zcaron'] = 500;
50574    t['ncommaaccent'] = 611;
50575    t['onesuperior'] = 333;
50576    t['imacron'] = 278;
50577    t['Euro'] = 556;
50578  });
50579  t['Helvetica-BoldOblique'] = (0, _core_utils.getLookupTableFactory)(function (t) {
50580    t['space'] = 278;
50581    t['exclam'] = 333;
50582    t['quotedbl'] = 474;
50583    t['numbersign'] = 556;
50584    t['dollar'] = 556;
50585    t['percent'] = 889;
50586    t['ampersand'] = 722;
50587    t['quoteright'] = 278;
50588    t['parenleft'] = 333;
50589    t['parenright'] = 333;
50590    t['asterisk'] = 389;
50591    t['plus'] = 584;
50592    t['comma'] = 278;
50593    t['hyphen'] = 333;
50594    t['period'] = 278;
50595    t['slash'] = 278;
50596    t['zero'] = 556;
50597    t['one'] = 556;
50598    t['two'] = 556;
50599    t['three'] = 556;
50600    t['four'] = 556;
50601    t['five'] = 556;
50602    t['six'] = 556;
50603    t['seven'] = 556;
50604    t['eight'] = 556;
50605    t['nine'] = 556;
50606    t['colon'] = 333;
50607    t['semicolon'] = 333;
50608    t['less'] = 584;
50609    t['equal'] = 584;
50610    t['greater'] = 584;
50611    t['question'] = 611;
50612    t['at'] = 975;
50613    t['A'] = 722;
50614    t['B'] = 722;
50615    t['C'] = 722;
50616    t['D'] = 722;
50617    t['E'] = 667;
50618    t['F'] = 611;
50619    t['G'] = 778;
50620    t['H'] = 722;
50621    t['I'] = 278;
50622    t['J'] = 556;
50623    t['K'] = 722;
50624    t['L'] = 611;
50625    t['M'] = 833;
50626    t['N'] = 722;
50627    t['O'] = 778;
50628    t['P'] = 667;
50629    t['Q'] = 778;
50630    t['R'] = 722;
50631    t['S'] = 667;
50632    t['T'] = 611;
50633    t['U'] = 722;
50634    t['V'] = 667;
50635    t['W'] = 944;
50636    t['X'] = 667;
50637    t['Y'] = 667;
50638    t['Z'] = 611;
50639    t['bracketleft'] = 333;
50640    t['backslash'] = 278;
50641    t['bracketright'] = 333;
50642    t['asciicircum'] = 584;
50643    t['underscore'] = 556;
50644    t['quoteleft'] = 278;
50645    t['a'] = 556;
50646    t['b'] = 611;
50647    t['c'] = 556;
50648    t['d'] = 611;
50649    t['e'] = 556;
50650    t['f'] = 333;
50651    t['g'] = 611;
50652    t['h'] = 611;
50653    t['i'] = 278;
50654    t['j'] = 278;
50655    t['k'] = 556;
50656    t['l'] = 278;
50657    t['m'] = 889;
50658    t['n'] = 611;
50659    t['o'] = 611;
50660    t['p'] = 611;
50661    t['q'] = 611;
50662    t['r'] = 389;
50663    t['s'] = 556;
50664    t['t'] = 333;
50665    t['u'] = 611;
50666    t['v'] = 556;
50667    t['w'] = 778;
50668    t['x'] = 556;
50669    t['y'] = 556;
50670    t['z'] = 500;
50671    t['braceleft'] = 389;
50672    t['bar'] = 280;
50673    t['braceright'] = 389;
50674    t['asciitilde'] = 584;
50675    t['exclamdown'] = 333;
50676    t['cent'] = 556;
50677    t['sterling'] = 556;
50678    t['fraction'] = 167;
50679    t['yen'] = 556;
50680    t['florin'] = 556;
50681    t['section'] = 556;
50682    t['currency'] = 556;
50683    t['quotesingle'] = 238;
50684    t['quotedblleft'] = 500;
50685    t['guillemotleft'] = 556;
50686    t['guilsinglleft'] = 333;
50687    t['guilsinglright'] = 333;
50688    t['fi'] = 611;
50689    t['fl'] = 611;
50690    t['endash'] = 556;
50691    t['dagger'] = 556;
50692    t['daggerdbl'] = 556;
50693    t['periodcentered'] = 278;
50694    t['paragraph'] = 556;
50695    t['bullet'] = 350;
50696    t['quotesinglbase'] = 278;
50697    t['quotedblbase'] = 500;
50698    t['quotedblright'] = 500;
50699    t['guillemotright'] = 556;
50700    t['ellipsis'] = 1000;
50701    t['perthousand'] = 1000;
50702    t['questiondown'] = 611;
50703    t['grave'] = 333;
50704    t['acute'] = 333;
50705    t['circumflex'] = 333;
50706    t['tilde'] = 333;
50707    t['macron'] = 333;
50708    t['breve'] = 333;
50709    t['dotaccent'] = 333;
50710    t['dieresis'] = 333;
50711    t['ring'] = 333;
50712    t['cedilla'] = 333;
50713    t['hungarumlaut'] = 333;
50714    t['ogonek'] = 333;
50715    t['caron'] = 333;
50716    t['emdash'] = 1000;
50717    t['AE'] = 1000;
50718    t['ordfeminine'] = 370;
50719    t['Lslash'] = 611;
50720    t['Oslash'] = 778;
50721    t['OE'] = 1000;
50722    t['ordmasculine'] = 365;
50723    t['ae'] = 889;
50724    t['dotlessi'] = 278;
50725    t['lslash'] = 278;
50726    t['oslash'] = 611;
50727    t['oe'] = 944;
50728    t['germandbls'] = 611;
50729    t['Idieresis'] = 278;
50730    t['eacute'] = 556;
50731    t['abreve'] = 556;
50732    t['uhungarumlaut'] = 611;
50733    t['ecaron'] = 556;
50734    t['Ydieresis'] = 667;
50735    t['divide'] = 584;
50736    t['Yacute'] = 667;
50737    t['Acircumflex'] = 722;
50738    t['aacute'] = 556;
50739    t['Ucircumflex'] = 722;
50740    t['yacute'] = 556;
50741    t['scommaaccent'] = 556;
50742    t['ecircumflex'] = 556;
50743    t['Uring'] = 722;
50744    t['Udieresis'] = 722;
50745    t['aogonek'] = 556;
50746    t['Uacute'] = 722;
50747    t['uogonek'] = 611;
50748    t['Edieresis'] = 667;
50749    t['Dcroat'] = 722;
50750    t['commaaccent'] = 250;
50751    t['copyright'] = 737;
50752    t['Emacron'] = 667;
50753    t['ccaron'] = 556;
50754    t['aring'] = 556;
50755    t['Ncommaaccent'] = 722;
50756    t['lacute'] = 278;
50757    t['agrave'] = 556;
50758    t['Tcommaaccent'] = 611;
50759    t['Cacute'] = 722;
50760    t['atilde'] = 556;
50761    t['Edotaccent'] = 667;
50762    t['scaron'] = 556;
50763    t['scedilla'] = 556;
50764    t['iacute'] = 278;
50765    t['lozenge'] = 494;
50766    t['Rcaron'] = 722;
50767    t['Gcommaaccent'] = 778;
50768    t['ucircumflex'] = 611;
50769    t['acircumflex'] = 556;
50770    t['Amacron'] = 722;
50771    t['rcaron'] = 389;
50772    t['ccedilla'] = 556;
50773    t['Zdotaccent'] = 611;
50774    t['Thorn'] = 667;
50775    t['Omacron'] = 778;
50776    t['Racute'] = 722;
50777    t['Sacute'] = 667;
50778    t['dcaron'] = 743;
50779    t['Umacron'] = 722;
50780    t['uring'] = 611;
50781    t['threesuperior'] = 333;
50782    t['Ograve'] = 778;
50783    t['Agrave'] = 722;
50784    t['Abreve'] = 722;
50785    t['multiply'] = 584;
50786    t['uacute'] = 611;
50787    t['Tcaron'] = 611;
50788    t['partialdiff'] = 494;
50789    t['ydieresis'] = 556;
50790    t['Nacute'] = 722;
50791    t['icircumflex'] = 278;
50792    t['Ecircumflex'] = 667;
50793    t['adieresis'] = 556;
50794    t['edieresis'] = 556;
50795    t['cacute'] = 556;
50796    t['nacute'] = 611;
50797    t['umacron'] = 611;
50798    t['Ncaron'] = 722;
50799    t['Iacute'] = 278;
50800    t['plusminus'] = 584;
50801    t['brokenbar'] = 280;
50802    t['registered'] = 737;
50803    t['Gbreve'] = 778;
50804    t['Idotaccent'] = 278;
50805    t['summation'] = 600;
50806    t['Egrave'] = 667;
50807    t['racute'] = 389;
50808    t['omacron'] = 611;
50809    t['Zacute'] = 611;
50810    t['Zcaron'] = 611;
50811    t['greaterequal'] = 549;
50812    t['Eth'] = 722;
50813    t['Ccedilla'] = 722;
50814    t['lcommaaccent'] = 278;
50815    t['tcaron'] = 389;
50816    t['eogonek'] = 556;
50817    t['Uogonek'] = 722;
50818    t['Aacute'] = 722;
50819    t['Adieresis'] = 722;
50820    t['egrave'] = 556;
50821    t['zacute'] = 500;
50822    t['iogonek'] = 278;
50823    t['Oacute'] = 778;
50824    t['oacute'] = 611;
50825    t['amacron'] = 556;
50826    t['sacute'] = 556;
50827    t['idieresis'] = 278;
50828    t['Ocircumflex'] = 778;
50829    t['Ugrave'] = 722;
50830    t['Delta'] = 612;
50831    t['thorn'] = 611;
50832    t['twosuperior'] = 333;
50833    t['Odieresis'] = 778;
50834    t['mu'] = 611;
50835    t['igrave'] = 278;
50836    t['ohungarumlaut'] = 611;
50837    t['Eogonek'] = 667;
50838    t['dcroat'] = 611;
50839    t['threequarters'] = 834;
50840    t['Scedilla'] = 667;
50841    t['lcaron'] = 400;
50842    t['Kcommaaccent'] = 722;
50843    t['Lacute'] = 611;
50844    t['trademark'] = 1000;
50845    t['edotaccent'] = 556;
50846    t['Igrave'] = 278;
50847    t['Imacron'] = 278;
50848    t['Lcaron'] = 611;
50849    t['onehalf'] = 834;
50850    t['lessequal'] = 549;
50851    t['ocircumflex'] = 611;
50852    t['ntilde'] = 611;
50853    t['Uhungarumlaut'] = 722;
50854    t['Eacute'] = 667;
50855    t['emacron'] = 556;
50856    t['gbreve'] = 611;
50857    t['onequarter'] = 834;
50858    t['Scaron'] = 667;
50859    t['Scommaaccent'] = 667;
50860    t['Ohungarumlaut'] = 778;
50861    t['degree'] = 400;
50862    t['ograve'] = 611;
50863    t['Ccaron'] = 722;
50864    t['ugrave'] = 611;
50865    t['radical'] = 549;
50866    t['Dcaron'] = 722;
50867    t['rcommaaccent'] = 389;
50868    t['Ntilde'] = 722;
50869    t['otilde'] = 611;
50870    t['Rcommaaccent'] = 722;
50871    t['Lcommaaccent'] = 611;
50872    t['Atilde'] = 722;
50873    t['Aogonek'] = 722;
50874    t['Aring'] = 722;
50875    t['Otilde'] = 778;
50876    t['zdotaccent'] = 500;
50877    t['Ecaron'] = 667;
50878    t['Iogonek'] = 278;
50879    t['kcommaaccent'] = 556;
50880    t['minus'] = 584;
50881    t['Icircumflex'] = 278;
50882    t['ncaron'] = 611;
50883    t['tcommaaccent'] = 333;
50884    t['logicalnot'] = 584;
50885    t['odieresis'] = 611;
50886    t['udieresis'] = 611;
50887    t['notequal'] = 549;
50888    t['gcommaaccent'] = 611;
50889    t['eth'] = 611;
50890    t['zcaron'] = 500;
50891    t['ncommaaccent'] = 611;
50892    t['onesuperior'] = 333;
50893    t['imacron'] = 278;
50894    t['Euro'] = 556;
50895  });
50896  t['Helvetica-Oblique'] = (0, _core_utils.getLookupTableFactory)(function (t) {
50897    t['space'] = 278;
50898    t['exclam'] = 278;
50899    t['quotedbl'] = 355;
50900    t['numbersign'] = 556;
50901    t['dollar'] = 556;
50902    t['percent'] = 889;
50903    t['ampersand'] = 667;
50904    t['quoteright'] = 222;
50905    t['parenleft'] = 333;
50906    t['parenright'] = 333;
50907    t['asterisk'] = 389;
50908    t['plus'] = 584;
50909    t['comma'] = 278;
50910    t['hyphen'] = 333;
50911    t['period'] = 278;
50912    t['slash'] = 278;
50913    t['zero'] = 556;
50914    t['one'] = 556;
50915    t['two'] = 556;
50916    t['three'] = 556;
50917    t['four'] = 556;
50918    t['five'] = 556;
50919    t['six'] = 556;
50920    t['seven'] = 556;
50921    t['eight'] = 556;
50922    t['nine'] = 556;
50923    t['colon'] = 278;
50924    t['semicolon'] = 278;
50925    t['less'] = 584;
50926    t['equal'] = 584;
50927    t['greater'] = 584;
50928    t['question'] = 556;
50929    t['at'] = 1015;
50930    t['A'] = 667;
50931    t['B'] = 667;
50932    t['C'] = 722;
50933    t['D'] = 722;
50934    t['E'] = 667;
50935    t['F'] = 611;
50936    t['G'] = 778;
50937    t['H'] = 722;
50938    t['I'] = 278;
50939    t['J'] = 500;
50940    t['K'] = 667;
50941    t['L'] = 556;
50942    t['M'] = 833;
50943    t['N'] = 722;
50944    t['O'] = 778;
50945    t['P'] = 667;
50946    t['Q'] = 778;
50947    t['R'] = 722;
50948    t['S'] = 667;
50949    t['T'] = 611;
50950    t['U'] = 722;
50951    t['V'] = 667;
50952    t['W'] = 944;
50953    t['X'] = 667;
50954    t['Y'] = 667;
50955    t['Z'] = 611;
50956    t['bracketleft'] = 278;
50957    t['backslash'] = 278;
50958    t['bracketright'] = 278;
50959    t['asciicircum'] = 469;
50960    t['underscore'] = 556;
50961    t['quoteleft'] = 222;
50962    t['a'] = 556;
50963    t['b'] = 556;
50964    t['c'] = 500;
50965    t['d'] = 556;
50966    t['e'] = 556;
50967    t['f'] = 278;
50968    t['g'] = 556;
50969    t['h'] = 556;
50970    t['i'] = 222;
50971    t['j'] = 222;
50972    t['k'] = 500;
50973    t['l'] = 222;
50974    t['m'] = 833;
50975    t['n'] = 556;
50976    t['o'] = 556;
50977    t['p'] = 556;
50978    t['q'] = 556;
50979    t['r'] = 333;
50980    t['s'] = 500;
50981    t['t'] = 278;
50982    t['u'] = 556;
50983    t['v'] = 500;
50984    t['w'] = 722;
50985    t['x'] = 500;
50986    t['y'] = 500;
50987    t['z'] = 500;
50988    t['braceleft'] = 334;
50989    t['bar'] = 260;
50990    t['braceright'] = 334;
50991    t['asciitilde'] = 584;
50992    t['exclamdown'] = 333;
50993    t['cent'] = 556;
50994    t['sterling'] = 556;
50995    t['fraction'] = 167;
50996    t['yen'] = 556;
50997    t['florin'] = 556;
50998    t['section'] = 556;
50999    t['currency'] = 556;
51000    t['quotesingle'] = 191;
51001    t['quotedblleft'] = 333;
51002    t['guillemotleft'] = 556;
51003    t['guilsinglleft'] = 333;
51004    t['guilsinglright'] = 333;
51005    t['fi'] = 500;
51006    t['fl'] = 500;
51007    t['endash'] = 556;
51008    t['dagger'] = 556;
51009    t['daggerdbl'] = 556;
51010    t['periodcentered'] = 278;
51011    t['paragraph'] = 537;
51012    t['bullet'] = 350;
51013    t['quotesinglbase'] = 222;
51014    t['quotedblbase'] = 333;
51015    t['quotedblright'] = 333;
51016    t['guillemotright'] = 556;
51017    t['ellipsis'] = 1000;
51018    t['perthousand'] = 1000;
51019    t['questiondown'] = 611;
51020    t['grave'] = 333;
51021    t['acute'] = 333;
51022    t['circumflex'] = 333;
51023    t['tilde'] = 333;
51024    t['macron'] = 333;
51025    t['breve'] = 333;
51026    t['dotaccent'] = 333;
51027    t['dieresis'] = 333;
51028    t['ring'] = 333;
51029    t['cedilla'] = 333;
51030    t['hungarumlaut'] = 333;
51031    t['ogonek'] = 333;
51032    t['caron'] = 333;
51033    t['emdash'] = 1000;
51034    t['AE'] = 1000;
51035    t['ordfeminine'] = 370;
51036    t['Lslash'] = 556;
51037    t['Oslash'] = 778;
51038    t['OE'] = 1000;
51039    t['ordmasculine'] = 365;
51040    t['ae'] = 889;
51041    t['dotlessi'] = 278;
51042    t['lslash'] = 222;
51043    t['oslash'] = 611;
51044    t['oe'] = 944;
51045    t['germandbls'] = 611;
51046    t['Idieresis'] = 278;
51047    t['eacute'] = 556;
51048    t['abreve'] = 556;
51049    t['uhungarumlaut'] = 556;
51050    t['ecaron'] = 556;
51051    t['Ydieresis'] = 667;
51052    t['divide'] = 584;
51053    t['Yacute'] = 667;
51054    t['Acircumflex'] = 667;
51055    t['aacute'] = 556;
51056    t['Ucircumflex'] = 722;
51057    t['yacute'] = 500;
51058    t['scommaaccent'] = 500;
51059    t['ecircumflex'] = 556;
51060    t['Uring'] = 722;
51061    t['Udieresis'] = 722;
51062    t['aogonek'] = 556;
51063    t['Uacute'] = 722;
51064    t['uogonek'] = 556;
51065    t['Edieresis'] = 667;
51066    t['Dcroat'] = 722;
51067    t['commaaccent'] = 250;
51068    t['copyright'] = 737;
51069    t['Emacron'] = 667;
51070    t['ccaron'] = 500;
51071    t['aring'] = 556;
51072    t['Ncommaaccent'] = 722;
51073    t['lacute'] = 222;
51074    t['agrave'] = 556;
51075    t['Tcommaaccent'] = 611;
51076    t['Cacute'] = 722;
51077    t['atilde'] = 556;
51078    t['Edotaccent'] = 667;
51079    t['scaron'] = 500;
51080    t['scedilla'] = 500;
51081    t['iacute'] = 278;
51082    t['lozenge'] = 471;
51083    t['Rcaron'] = 722;
51084    t['Gcommaaccent'] = 778;
51085    t['ucircumflex'] = 556;
51086    t['acircumflex'] = 556;
51087    t['Amacron'] = 667;
51088    t['rcaron'] = 333;
51089    t['ccedilla'] = 500;
51090    t['Zdotaccent'] = 611;
51091    t['Thorn'] = 667;
51092    t['Omacron'] = 778;
51093    t['Racute'] = 722;
51094    t['Sacute'] = 667;
51095    t['dcaron'] = 643;
51096    t['Umacron'] = 722;
51097    t['uring'] = 556;
51098    t['threesuperior'] = 333;
51099    t['Ograve'] = 778;
51100    t['Agrave'] = 667;
51101    t['Abreve'] = 667;
51102    t['multiply'] = 584;
51103    t['uacute'] = 556;
51104    t['Tcaron'] = 611;
51105    t['partialdiff'] = 476;
51106    t['ydieresis'] = 500;
51107    t['Nacute'] = 722;
51108    t['icircumflex'] = 278;
51109    t['Ecircumflex'] = 667;
51110    t['adieresis'] = 556;
51111    t['edieresis'] = 556;
51112    t['cacute'] = 500;
51113    t['nacute'] = 556;
51114    t['umacron'] = 556;
51115    t['Ncaron'] = 722;
51116    t['Iacute'] = 278;
51117    t['plusminus'] = 584;
51118    t['brokenbar'] = 260;
51119    t['registered'] = 737;
51120    t['Gbreve'] = 778;
51121    t['Idotaccent'] = 278;
51122    t['summation'] = 600;
51123    t['Egrave'] = 667;
51124    t['racute'] = 333;
51125    t['omacron'] = 556;
51126    t['Zacute'] = 611;
51127    t['Zcaron'] = 611;
51128    t['greaterequal'] = 549;
51129    t['Eth'] = 722;
51130    t['Ccedilla'] = 722;
51131    t['lcommaaccent'] = 222;
51132    t['tcaron'] = 317;
51133    t['eogonek'] = 556;
51134    t['Uogonek'] = 722;
51135    t['Aacute'] = 667;
51136    t['Adieresis'] = 667;
51137    t['egrave'] = 556;
51138    t['zacute'] = 500;
51139    t['iogonek'] = 222;
51140    t['Oacute'] = 778;
51141    t['oacute'] = 556;
51142    t['amacron'] = 556;
51143    t['sacute'] = 500;
51144    t['idieresis'] = 278;
51145    t['Ocircumflex'] = 778;
51146    t['Ugrave'] = 722;
51147    t['Delta'] = 612;
51148    t['thorn'] = 556;
51149    t['twosuperior'] = 333;
51150    t['Odieresis'] = 778;
51151    t['mu'] = 556;
51152    t['igrave'] = 278;
51153    t['ohungarumlaut'] = 556;
51154    t['Eogonek'] = 667;
51155    t['dcroat'] = 556;
51156    t['threequarters'] = 834;
51157    t['Scedilla'] = 667;
51158    t['lcaron'] = 299;
51159    t['Kcommaaccent'] = 667;
51160    t['Lacute'] = 556;
51161    t['trademark'] = 1000;
51162    t['edotaccent'] = 556;
51163    t['Igrave'] = 278;
51164    t['Imacron'] = 278;
51165    t['Lcaron'] = 556;
51166    t['onehalf'] = 834;
51167    t['lessequal'] = 549;
51168    t['ocircumflex'] = 556;
51169    t['ntilde'] = 556;
51170    t['Uhungarumlaut'] = 722;
51171    t['Eacute'] = 667;
51172    t['emacron'] = 556;
51173    t['gbreve'] = 556;
51174    t['onequarter'] = 834;
51175    t['Scaron'] = 667;
51176    t['Scommaaccent'] = 667;
51177    t['Ohungarumlaut'] = 778;
51178    t['degree'] = 400;
51179    t['ograve'] = 556;
51180    t['Ccaron'] = 722;
51181    t['ugrave'] = 556;
51182    t['radical'] = 453;
51183    t['Dcaron'] = 722;
51184    t['rcommaaccent'] = 333;
51185    t['Ntilde'] = 722;
51186    t['otilde'] = 556;
51187    t['Rcommaaccent'] = 722;
51188    t['Lcommaaccent'] = 556;
51189    t['Atilde'] = 667;
51190    t['Aogonek'] = 667;
51191    t['Aring'] = 667;
51192    t['Otilde'] = 778;
51193    t['zdotaccent'] = 500;
51194    t['Ecaron'] = 667;
51195    t['Iogonek'] = 278;
51196    t['kcommaaccent'] = 500;
51197    t['minus'] = 584;
51198    t['Icircumflex'] = 278;
51199    t['ncaron'] = 556;
51200    t['tcommaaccent'] = 278;
51201    t['logicalnot'] = 584;
51202    t['odieresis'] = 556;
51203    t['udieresis'] = 556;
51204    t['notequal'] = 549;
51205    t['gcommaaccent'] = 556;
51206    t['eth'] = 556;
51207    t['zcaron'] = 500;
51208    t['ncommaaccent'] = 556;
51209    t['onesuperior'] = 333;
51210    t['imacron'] = 278;
51211    t['Euro'] = 556;
51212  });
51213  t['Symbol'] = (0, _core_utils.getLookupTableFactory)(function (t) {
51214    t['space'] = 250;
51215    t['exclam'] = 333;
51216    t['universal'] = 713;
51217    t['numbersign'] = 500;
51218    t['existential'] = 549;
51219    t['percent'] = 833;
51220    t['ampersand'] = 778;
51221    t['suchthat'] = 439;
51222    t['parenleft'] = 333;
51223    t['parenright'] = 333;
51224    t['asteriskmath'] = 500;
51225    t['plus'] = 549;
51226    t['comma'] = 250;
51227    t['minus'] = 549;
51228    t['period'] = 250;
51229    t['slash'] = 278;
51230    t['zero'] = 500;
51231    t['one'] = 500;
51232    t['two'] = 500;
51233    t['three'] = 500;
51234    t['four'] = 500;
51235    t['five'] = 500;
51236    t['six'] = 500;
51237    t['seven'] = 500;
51238    t['eight'] = 500;
51239    t['nine'] = 500;
51240    t['colon'] = 278;
51241    t['semicolon'] = 278;
51242    t['less'] = 549;
51243    t['equal'] = 549;
51244    t['greater'] = 549;
51245    t['question'] = 444;
51246    t['congruent'] = 549;
51247    t['Alpha'] = 722;
51248    t['Beta'] = 667;
51249    t['Chi'] = 722;
51250    t['Delta'] = 612;
51251    t['Epsilon'] = 611;
51252    t['Phi'] = 763;
51253    t['Gamma'] = 603;
51254    t['Eta'] = 722;
51255    t['Iota'] = 333;
51256    t['theta1'] = 631;
51257    t['Kappa'] = 722;
51258    t['Lambda'] = 686;
51259    t['Mu'] = 889;
51260    t['Nu'] = 722;
51261    t['Omicron'] = 722;
51262    t['Pi'] = 768;
51263    t['Theta'] = 741;
51264    t['Rho'] = 556;
51265    t['Sigma'] = 592;
51266    t['Tau'] = 611;
51267    t['Upsilon'] = 690;
51268    t['sigma1'] = 439;
51269    t['Omega'] = 768;
51270    t['Xi'] = 645;
51271    t['Psi'] = 795;
51272    t['Zeta'] = 611;
51273    t['bracketleft'] = 333;
51274    t['therefore'] = 863;
51275    t['bracketright'] = 333;
51276    t['perpendicular'] = 658;
51277    t['underscore'] = 500;
51278    t['radicalex'] = 500;
51279    t['alpha'] = 631;
51280    t['beta'] = 549;
51281    t['chi'] = 549;
51282    t['delta'] = 494;
51283    t['epsilon'] = 439;
51284    t['phi'] = 521;
51285    t['gamma'] = 411;
51286    t['eta'] = 603;
51287    t['iota'] = 329;
51288    t['phi1'] = 603;
51289    t['kappa'] = 549;
51290    t['lambda'] = 549;
51291    t['mu'] = 576;
51292    t['nu'] = 521;
51293    t['omicron'] = 549;
51294    t['pi'] = 549;
51295    t['theta'] = 521;
51296    t['rho'] = 549;
51297    t['sigma'] = 603;
51298    t['tau'] = 439;
51299    t['upsilon'] = 576;
51300    t['omega1'] = 713;
51301    t['omega'] = 686;
51302    t['xi'] = 493;
51303    t['psi'] = 686;
51304    t['zeta'] = 494;
51305    t['braceleft'] = 480;
51306    t['bar'] = 200;
51307    t['braceright'] = 480;
51308    t['similar'] = 549;
51309    t['Euro'] = 750;
51310    t['Upsilon1'] = 620;
51311    t['minute'] = 247;
51312    t['lessequal'] = 549;
51313    t['fraction'] = 167;
51314    t['infinity'] = 713;
51315    t['florin'] = 500;
51316    t['club'] = 753;
51317    t['diamond'] = 753;
51318    t['heart'] = 753;
51319    t['spade'] = 753;
51320    t['arrowboth'] = 1042;
51321    t['arrowleft'] = 987;
51322    t['arrowup'] = 603;
51323    t['arrowright'] = 987;
51324    t['arrowdown'] = 603;
51325    t['degree'] = 400;
51326    t['plusminus'] = 549;
51327    t['second'] = 411;
51328    t['greaterequal'] = 549;
51329    t['multiply'] = 549;
51330    t['proportional'] = 713;
51331    t['partialdiff'] = 494;
51332    t['bullet'] = 460;
51333    t['divide'] = 549;
51334    t['notequal'] = 549;
51335    t['equivalence'] = 549;
51336    t['approxequal'] = 549;
51337    t['ellipsis'] = 1000;
51338    t['arrowvertex'] = 603;
51339    t['arrowhorizex'] = 1000;
51340    t['carriagereturn'] = 658;
51341    t['aleph'] = 823;
51342    t['Ifraktur'] = 686;
51343    t['Rfraktur'] = 795;
51344    t['weierstrass'] = 987;
51345    t['circlemultiply'] = 768;
51346    t['circleplus'] = 768;
51347    t['emptyset'] = 823;
51348    t['intersection'] = 768;
51349    t['union'] = 768;
51350    t['propersuperset'] = 713;
51351    t['reflexsuperset'] = 713;
51352    t['notsubset'] = 713;
51353    t['propersubset'] = 713;
51354    t['reflexsubset'] = 713;
51355    t['element'] = 713;
51356    t['notelement'] = 713;
51357    t['angle'] = 768;
51358    t['gradient'] = 713;
51359    t['registerserif'] = 790;
51360    t['copyrightserif'] = 790;
51361    t['trademarkserif'] = 890;
51362    t['product'] = 823;
51363    t['radical'] = 549;
51364    t['dotmath'] = 250;
51365    t['logicalnot'] = 713;
51366    t['logicaland'] = 603;
51367    t['logicalor'] = 603;
51368    t['arrowdblboth'] = 1042;
51369    t['arrowdblleft'] = 987;
51370    t['arrowdblup'] = 603;
51371    t['arrowdblright'] = 987;
51372    t['arrowdbldown'] = 603;
51373    t['lozenge'] = 494;
51374    t['angleleft'] = 329;
51375    t['registersans'] = 790;
51376    t['copyrightsans'] = 790;
51377    t['trademarksans'] = 786;
51378    t['summation'] = 713;
51379    t['parenlefttp'] = 384;
51380    t['parenleftex'] = 384;
51381    t['parenleftbt'] = 384;
51382    t['bracketlefttp'] = 384;
51383    t['bracketleftex'] = 384;
51384    t['bracketleftbt'] = 384;
51385    t['bracelefttp'] = 494;
51386    t['braceleftmid'] = 494;
51387    t['braceleftbt'] = 494;
51388    t['braceex'] = 494;
51389    t['angleright'] = 329;
51390    t['integral'] = 274;
51391    t['integraltp'] = 686;
51392    t['integralex'] = 686;
51393    t['integralbt'] = 686;
51394    t['parenrighttp'] = 384;
51395    t['parenrightex'] = 384;
51396    t['parenrightbt'] = 384;
51397    t['bracketrighttp'] = 384;
51398    t['bracketrightex'] = 384;
51399    t['bracketrightbt'] = 384;
51400    t['bracerighttp'] = 494;
51401    t['bracerightmid'] = 494;
51402    t['bracerightbt'] = 494;
51403    t['apple'] = 790;
51404  });
51405  t['Times-Roman'] = (0, _core_utils.getLookupTableFactory)(function (t) {
51406    t['space'] = 250;
51407    t['exclam'] = 333;
51408    t['quotedbl'] = 408;
51409    t['numbersign'] = 500;
51410    t['dollar'] = 500;
51411    t['percent'] = 833;
51412    t['ampersand'] = 778;
51413    t['quoteright'] = 333;
51414    t['parenleft'] = 333;
51415    t['parenright'] = 333;
51416    t['asterisk'] = 500;
51417    t['plus'] = 564;
51418    t['comma'] = 250;
51419    t['hyphen'] = 333;
51420    t['period'] = 250;
51421    t['slash'] = 278;
51422    t['zero'] = 500;
51423    t['one'] = 500;
51424    t['two'] = 500;
51425    t['three'] = 500;
51426    t['four'] = 500;
51427    t['five'] = 500;
51428    t['six'] = 500;
51429    t['seven'] = 500;
51430    t['eight'] = 500;
51431    t['nine'] = 500;
51432    t['colon'] = 278;
51433    t['semicolon'] = 278;
51434    t['less'] = 564;
51435    t['equal'] = 564;
51436    t['greater'] = 564;
51437    t['question'] = 444;
51438    t['at'] = 921;
51439    t['A'] = 722;
51440    t['B'] = 667;
51441    t['C'] = 667;
51442    t['D'] = 722;
51443    t['E'] = 611;
51444    t['F'] = 556;
51445    t['G'] = 722;
51446    t['H'] = 722;
51447    t['I'] = 333;
51448    t['J'] = 389;
51449    t['K'] = 722;
51450    t['L'] = 611;
51451    t['M'] = 889;
51452    t['N'] = 722;
51453    t['O'] = 722;
51454    t['P'] = 556;
51455    t['Q'] = 722;
51456    t['R'] = 667;
51457    t['S'] = 556;
51458    t['T'] = 611;
51459    t['U'] = 722;
51460    t['V'] = 722;
51461    t['W'] = 944;
51462    t['X'] = 722;
51463    t['Y'] = 722;
51464    t['Z'] = 611;
51465    t['bracketleft'] = 333;
51466    t['backslash'] = 278;
51467    t['bracketright'] = 333;
51468    t['asciicircum'] = 469;
51469    t['underscore'] = 500;
51470    t['quoteleft'] = 333;
51471    t['a'] = 444;
51472    t['b'] = 500;
51473    t['c'] = 444;
51474    t['d'] = 500;
51475    t['e'] = 444;
51476    t['f'] = 333;
51477    t['g'] = 500;
51478    t['h'] = 500;
51479    t['i'] = 278;
51480    t['j'] = 278;
51481    t['k'] = 500;
51482    t['l'] = 278;
51483    t['m'] = 778;
51484    t['n'] = 500;
51485    t['o'] = 500;
51486    t['p'] = 500;
51487    t['q'] = 500;
51488    t['r'] = 333;
51489    t['s'] = 389;
51490    t['t'] = 278;
51491    t['u'] = 500;
51492    t['v'] = 500;
51493    t['w'] = 722;
51494    t['x'] = 500;
51495    t['y'] = 500;
51496    t['z'] = 444;
51497    t['braceleft'] = 480;
51498    t['bar'] = 200;
51499    t['braceright'] = 480;
51500    t['asciitilde'] = 541;
51501    t['exclamdown'] = 333;
51502    t['cent'] = 500;
51503    t['sterling'] = 500;
51504    t['fraction'] = 167;
51505    t['yen'] = 500;
51506    t['florin'] = 500;
51507    t['section'] = 500;
51508    t['currency'] = 500;
51509    t['quotesingle'] = 180;
51510    t['quotedblleft'] = 444;
51511    t['guillemotleft'] = 500;
51512    t['guilsinglleft'] = 333;
51513    t['guilsinglright'] = 333;
51514    t['fi'] = 556;
51515    t['fl'] = 556;
51516    t['endash'] = 500;
51517    t['dagger'] = 500;
51518    t['daggerdbl'] = 500;
51519    t['periodcentered'] = 250;
51520    t['paragraph'] = 453;
51521    t['bullet'] = 350;
51522    t['quotesinglbase'] = 333;
51523    t['quotedblbase'] = 444;
51524    t['quotedblright'] = 444;
51525    t['guillemotright'] = 500;
51526    t['ellipsis'] = 1000;
51527    t['perthousand'] = 1000;
51528    t['questiondown'] = 444;
51529    t['grave'] = 333;
51530    t['acute'] = 333;
51531    t['circumflex'] = 333;
51532    t['tilde'] = 333;
51533    t['macron'] = 333;
51534    t['breve'] = 333;
51535    t['dotaccent'] = 333;
51536    t['dieresis'] = 333;
51537    t['ring'] = 333;
51538    t['cedilla'] = 333;
51539    t['hungarumlaut'] = 333;
51540    t['ogonek'] = 333;
51541    t['caron'] = 333;
51542    t['emdash'] = 1000;
51543    t['AE'] = 889;
51544    t['ordfeminine'] = 276;
51545    t['Lslash'] = 611;
51546    t['Oslash'] = 722;
51547    t['OE'] = 889;
51548    t['ordmasculine'] = 310;
51549    t['ae'] = 667;
51550    t['dotlessi'] = 278;
51551    t['lslash'] = 278;
51552    t['oslash'] = 500;
51553    t['oe'] = 722;
51554    t['germandbls'] = 500;
51555    t['Idieresis'] = 333;
51556    t['eacute'] = 444;
51557    t['abreve'] = 444;
51558    t['uhungarumlaut'] = 500;
51559    t['ecaron'] = 444;
51560    t['Ydieresis'] = 722;
51561    t['divide'] = 564;
51562    t['Yacute'] = 722;
51563    t['Acircumflex'] = 722;
51564    t['aacute'] = 444;
51565    t['Ucircumflex'] = 722;
51566    t['yacute'] = 500;
51567    t['scommaaccent'] = 389;
51568    t['ecircumflex'] = 444;
51569    t['Uring'] = 722;
51570    t['Udieresis'] = 722;
51571    t['aogonek'] = 444;
51572    t['Uacute'] = 722;
51573    t['uogonek'] = 500;
51574    t['Edieresis'] = 611;
51575    t['Dcroat'] = 722;
51576    t['commaaccent'] = 250;
51577    t['copyright'] = 760;
51578    t['Emacron'] = 611;
51579    t['ccaron'] = 444;
51580    t['aring'] = 444;
51581    t['Ncommaaccent'] = 722;
51582    t['lacute'] = 278;
51583    t['agrave'] = 444;
51584    t['Tcommaaccent'] = 611;
51585    t['Cacute'] = 667;
51586    t['atilde'] = 444;
51587    t['Edotaccent'] = 611;
51588    t['scaron'] = 389;
51589    t['scedilla'] = 389;
51590    t['iacute'] = 278;
51591    t['lozenge'] = 471;
51592    t['Rcaron'] = 667;
51593    t['Gcommaaccent'] = 722;
51594    t['ucircumflex'] = 500;
51595    t['acircumflex'] = 444;
51596    t['Amacron'] = 722;
51597    t['rcaron'] = 333;
51598    t['ccedilla'] = 444;
51599    t['Zdotaccent'] = 611;
51600    t['Thorn'] = 556;
51601    t['Omacron'] = 722;
51602    t['Racute'] = 667;
51603    t['Sacute'] = 556;
51604    t['dcaron'] = 588;
51605    t['Umacron'] = 722;
51606    t['uring'] = 500;
51607    t['threesuperior'] = 300;
51608    t['Ograve'] = 722;
51609    t['Agrave'] = 722;
51610    t['Abreve'] = 722;
51611    t['multiply'] = 564;
51612    t['uacute'] = 500;
51613    t['Tcaron'] = 611;
51614    t['partialdiff'] = 476;
51615    t['ydieresis'] = 500;
51616    t['Nacute'] = 722;
51617    t['icircumflex'] = 278;
51618    t['Ecircumflex'] = 611;
51619    t['adieresis'] = 444;
51620    t['edieresis'] = 444;
51621    t['cacute'] = 444;
51622    t['nacute'] = 500;
51623    t['umacron'] = 500;
51624    t['Ncaron'] = 722;
51625    t['Iacute'] = 333;
51626    t['plusminus'] = 564;
51627    t['brokenbar'] = 200;
51628    t['registered'] = 760;
51629    t['Gbreve'] = 722;
51630    t['Idotaccent'] = 333;
51631    t['summation'] = 600;
51632    t['Egrave'] = 611;
51633    t['racute'] = 333;
51634    t['omacron'] = 500;
51635    t['Zacute'] = 611;
51636    t['Zcaron'] = 611;
51637    t['greaterequal'] = 549;
51638    t['Eth'] = 722;
51639    t['Ccedilla'] = 667;
51640    t['lcommaaccent'] = 278;
51641    t['tcaron'] = 326;
51642    t['eogonek'] = 444;
51643    t['Uogonek'] = 722;
51644    t['Aacute'] = 722;
51645    t['Adieresis'] = 722;
51646    t['egrave'] = 444;
51647    t['zacute'] = 444;
51648    t['iogonek'] = 278;
51649    t['Oacute'] = 722;
51650    t['oacute'] = 500;
51651    t['amacron'] = 444;
51652    t['sacute'] = 389;
51653    t['idieresis'] = 278;
51654    t['Ocircumflex'] = 722;
51655    t['Ugrave'] = 722;
51656    t['Delta'] = 612;
51657    t['thorn'] = 500;
51658    t['twosuperior'] = 300;
51659    t['Odieresis'] = 722;
51660    t['mu'] = 500;
51661    t['igrave'] = 278;
51662    t['ohungarumlaut'] = 500;
51663    t['Eogonek'] = 611;
51664    t['dcroat'] = 500;
51665    t['threequarters'] = 750;
51666    t['Scedilla'] = 556;
51667    t['lcaron'] = 344;
51668    t['Kcommaaccent'] = 722;
51669    t['Lacute'] = 611;
51670    t['trademark'] = 980;
51671    t['edotaccent'] = 444;
51672    t['Igrave'] = 333;
51673    t['Imacron'] = 333;
51674    t['Lcaron'] = 611;
51675    t['onehalf'] = 750;
51676    t['lessequal'] = 549;
51677    t['ocircumflex'] = 500;
51678    t['ntilde'] = 500;
51679    t['Uhungarumlaut'] = 722;
51680    t['Eacute'] = 611;
51681    t['emacron'] = 444;
51682    t['gbreve'] = 500;
51683    t['onequarter'] = 750;
51684    t['Scaron'] = 556;
51685    t['Scommaaccent'] = 556;
51686    t['Ohungarumlaut'] = 722;
51687    t['degree'] = 400;
51688    t['ograve'] = 500;
51689    t['Ccaron'] = 667;
51690    t['ugrave'] = 500;
51691    t['radical'] = 453;
51692    t['Dcaron'] = 722;
51693    t['rcommaaccent'] = 333;
51694    t['Ntilde'] = 722;
51695    t['otilde'] = 500;
51696    t['Rcommaaccent'] = 667;
51697    t['Lcommaaccent'] = 611;
51698    t['Atilde'] = 722;
51699    t['Aogonek'] = 722;
51700    t['Aring'] = 722;
51701    t['Otilde'] = 722;
51702    t['zdotaccent'] = 444;
51703    t['Ecaron'] = 611;
51704    t['Iogonek'] = 333;
51705    t['kcommaaccent'] = 500;
51706    t['minus'] = 564;
51707    t['Icircumflex'] = 333;
51708    t['ncaron'] = 500;
51709    t['tcommaaccent'] = 278;
51710    t['logicalnot'] = 564;
51711    t['odieresis'] = 500;
51712    t['udieresis'] = 500;
51713    t['notequal'] = 549;
51714    t['gcommaaccent'] = 500;
51715    t['eth'] = 500;
51716    t['zcaron'] = 444;
51717    t['ncommaaccent'] = 500;
51718    t['onesuperior'] = 300;
51719    t['imacron'] = 278;
51720    t['Euro'] = 500;
51721  });
51722  t['Times-Bold'] = (0, _core_utils.getLookupTableFactory)(function (t) {
51723    t['space'] = 250;
51724    t['exclam'] = 333;
51725    t['quotedbl'] = 555;
51726    t['numbersign'] = 500;
51727    t['dollar'] = 500;
51728    t['percent'] = 1000;
51729    t['ampersand'] = 833;
51730    t['quoteright'] = 333;
51731    t['parenleft'] = 333;
51732    t['parenright'] = 333;
51733    t['asterisk'] = 500;
51734    t['plus'] = 570;
51735    t['comma'] = 250;
51736    t['hyphen'] = 333;
51737    t['period'] = 250;
51738    t['slash'] = 278;
51739    t['zero'] = 500;
51740    t['one'] = 500;
51741    t['two'] = 500;
51742    t['three'] = 500;
51743    t['four'] = 500;
51744    t['five'] = 500;
51745    t['six'] = 500;
51746    t['seven'] = 500;
51747    t['eight'] = 500;
51748    t['nine'] = 500;
51749    t['colon'] = 333;
51750    t['semicolon'] = 333;
51751    t['less'] = 570;
51752    t['equal'] = 570;
51753    t['greater'] = 570;
51754    t['question'] = 500;
51755    t['at'] = 930;
51756    t['A'] = 722;
51757    t['B'] = 667;
51758    t['C'] = 722;
51759    t['D'] = 722;
51760    t['E'] = 667;
51761    t['F'] = 611;
51762    t['G'] = 778;
51763    t['H'] = 778;
51764    t['I'] = 389;
51765    t['J'] = 500;
51766    t['K'] = 778;
51767    t['L'] = 667;
51768    t['M'] = 944;
51769    t['N'] = 722;
51770    t['O'] = 778;
51771    t['P'] = 611;
51772    t['Q'] = 778;
51773    t['R'] = 722;
51774    t['S'] = 556;
51775    t['T'] = 667;
51776    t['U'] = 722;
51777    t['V'] = 722;
51778    t['W'] = 1000;
51779    t['X'] = 722;
51780    t['Y'] = 722;
51781    t['Z'] = 667;
51782    t['bracketleft'] = 333;
51783    t['backslash'] = 278;
51784    t['bracketright'] = 333;
51785    t['asciicircum'] = 581;
51786    t['underscore'] = 500;
51787    t['quoteleft'] = 333;
51788    t['a'] = 500;
51789    t['b'] = 556;
51790    t['c'] = 444;
51791    t['d'] = 556;
51792    t['e'] = 444;
51793    t['f'] = 333;
51794    t['g'] = 500;
51795    t['h'] = 556;
51796    t['i'] = 278;
51797    t['j'] = 333;
51798    t['k'] = 556;
51799    t['l'] = 278;
51800    t['m'] = 833;
51801    t['n'] = 556;
51802    t['o'] = 500;
51803    t['p'] = 556;
51804    t['q'] = 556;
51805    t['r'] = 444;
51806    t['s'] = 389;
51807    t['t'] = 333;
51808    t['u'] = 556;
51809    t['v'] = 500;
51810    t['w'] = 722;
51811    t['x'] = 500;
51812    t['y'] = 500;
51813    t['z'] = 444;
51814    t['braceleft'] = 394;
51815    t['bar'] = 220;
51816    t['braceright'] = 394;
51817    t['asciitilde'] = 520;
51818    t['exclamdown'] = 333;
51819    t['cent'] = 500;
51820    t['sterling'] = 500;
51821    t['fraction'] = 167;
51822    t['yen'] = 500;
51823    t['florin'] = 500;
51824    t['section'] = 500;
51825    t['currency'] = 500;
51826    t['quotesingle'] = 278;
51827    t['quotedblleft'] = 500;
51828    t['guillemotleft'] = 500;
51829    t['guilsinglleft'] = 333;
51830    t['guilsinglright'] = 333;
51831    t['fi'] = 556;
51832    t['fl'] = 556;
51833    t['endash'] = 500;
51834    t['dagger'] = 500;
51835    t['daggerdbl'] = 500;
51836    t['periodcentered'] = 250;
51837    t['paragraph'] = 540;
51838    t['bullet'] = 350;
51839    t['quotesinglbase'] = 333;
51840    t['quotedblbase'] = 500;
51841    t['quotedblright'] = 500;
51842    t['guillemotright'] = 500;
51843    t['ellipsis'] = 1000;
51844    t['perthousand'] = 1000;
51845    t['questiondown'] = 500;
51846    t['grave'] = 333;
51847    t['acute'] = 333;
51848    t['circumflex'] = 333;
51849    t['tilde'] = 333;
51850    t['macron'] = 333;
51851    t['breve'] = 333;
51852    t['dotaccent'] = 333;
51853    t['dieresis'] = 333;
51854    t['ring'] = 333;
51855    t['cedilla'] = 333;
51856    t['hungarumlaut'] = 333;
51857    t['ogonek'] = 333;
51858    t['caron'] = 333;
51859    t['emdash'] = 1000;
51860    t['AE'] = 1000;
51861    t['ordfeminine'] = 300;
51862    t['Lslash'] = 667;
51863    t['Oslash'] = 778;
51864    t['OE'] = 1000;
51865    t['ordmasculine'] = 330;
51866    t['ae'] = 722;
51867    t['dotlessi'] = 278;
51868    t['lslash'] = 278;
51869    t['oslash'] = 500;
51870    t['oe'] = 722;
51871    t['germandbls'] = 556;
51872    t['Idieresis'] = 389;
51873    t['eacute'] = 444;
51874    t['abreve'] = 500;
51875    t['uhungarumlaut'] = 556;
51876    t['ecaron'] = 444;
51877    t['Ydieresis'] = 722;
51878    t['divide'] = 570;
51879    t['Yacute'] = 722;
51880    t['Acircumflex'] = 722;
51881    t['aacute'] = 500;
51882    t['Ucircumflex'] = 722;
51883    t['yacute'] = 500;
51884    t['scommaaccent'] = 389;
51885    t['ecircumflex'] = 444;
51886    t['Uring'] = 722;
51887    t['Udieresis'] = 722;
51888    t['aogonek'] = 500;
51889    t['Uacute'] = 722;
51890    t['uogonek'] = 556;
51891    t['Edieresis'] = 667;
51892    t['Dcroat'] = 722;
51893    t['commaaccent'] = 250;
51894    t['copyright'] = 747;
51895    t['Emacron'] = 667;
51896    t['ccaron'] = 444;
51897    t['aring'] = 500;
51898    t['Ncommaaccent'] = 722;
51899    t['lacute'] = 278;
51900    t['agrave'] = 500;
51901    t['Tcommaaccent'] = 667;
51902    t['Cacute'] = 722;
51903    t['atilde'] = 500;
51904    t['Edotaccent'] = 667;
51905    t['scaron'] = 389;
51906    t['scedilla'] = 389;
51907    t['iacute'] = 278;
51908    t['lozenge'] = 494;
51909    t['Rcaron'] = 722;
51910    t['Gcommaaccent'] = 778;
51911    t['ucircumflex'] = 556;
51912    t['acircumflex'] = 500;
51913    t['Amacron'] = 722;
51914    t['rcaron'] = 444;
51915    t['ccedilla'] = 444;
51916    t['Zdotaccent'] = 667;
51917    t['Thorn'] = 611;
51918    t['Omacron'] = 778;
51919    t['Racute'] = 722;
51920    t['Sacute'] = 556;
51921    t['dcaron'] = 672;
51922    t['Umacron'] = 722;
51923    t['uring'] = 556;
51924    t['threesuperior'] = 300;
51925    t['Ograve'] = 778;
51926    t['Agrave'] = 722;
51927    t['Abreve'] = 722;
51928    t['multiply'] = 570;
51929    t['uacute'] = 556;
51930    t['Tcaron'] = 667;
51931    t['partialdiff'] = 494;
51932    t['ydieresis'] = 500;
51933    t['Nacute'] = 722;
51934    t['icircumflex'] = 278;
51935    t['Ecircumflex'] = 667;
51936    t['adieresis'] = 500;
51937    t['edieresis'] = 444;
51938    t['cacute'] = 444;
51939    t['nacute'] = 556;
51940    t['umacron'] = 556;
51941    t['Ncaron'] = 722;
51942    t['Iacute'] = 389;
51943    t['plusminus'] = 570;
51944    t['brokenbar'] = 220;
51945    t['registered'] = 747;
51946    t['Gbreve'] = 778;
51947    t['Idotaccent'] = 389;
51948    t['summation'] = 600;
51949    t['Egrave'] = 667;
51950    t['racute'] = 444;
51951    t['omacron'] = 500;
51952    t['Zacute'] = 667;
51953    t['Zcaron'] = 667;
51954    t['greaterequal'] = 549;
51955    t['Eth'] = 722;
51956    t['Ccedilla'] = 722;
51957    t['lcommaaccent'] = 278;
51958    t['tcaron'] = 416;
51959    t['eogonek'] = 444;
51960    t['Uogonek'] = 722;
51961    t['Aacute'] = 722;
51962    t['Adieresis'] = 722;
51963    t['egrave'] = 444;
51964    t['zacute'] = 444;
51965    t['iogonek'] = 278;
51966    t['Oacute'] = 778;
51967    t['oacute'] = 500;
51968    t['amacron'] = 500;
51969    t['sacute'] = 389;
51970    t['idieresis'] = 278;
51971    t['Ocircumflex'] = 778;
51972    t['Ugrave'] = 722;
51973    t['Delta'] = 612;
51974    t['thorn'] = 556;
51975    t['twosuperior'] = 300;
51976    t['Odieresis'] = 778;
51977    t['mu'] = 556;
51978    t['igrave'] = 278;
51979    t['ohungarumlaut'] = 500;
51980    t['Eogonek'] = 667;
51981    t['dcroat'] = 556;
51982    t['threequarters'] = 750;
51983    t['Scedilla'] = 556;
51984    t['lcaron'] = 394;
51985    t['Kcommaaccent'] = 778;
51986    t['Lacute'] = 667;
51987    t['trademark'] = 1000;
51988    t['edotaccent'] = 444;
51989    t['Igrave'] = 389;
51990    t['Imacron'] = 389;
51991    t['Lcaron'] = 667;
51992    t['onehalf'] = 750;
51993    t['lessequal'] = 549;
51994    t['ocircumflex'] = 500;
51995    t['ntilde'] = 556;
51996    t['Uhungarumlaut'] = 722;
51997    t['Eacute'] = 667;
51998    t['emacron'] = 444;
51999    t['gbreve'] = 500;
52000    t['onequarter'] = 750;
52001    t['Scaron'] = 556;
52002    t['Scommaaccent'] = 556;
52003    t['Ohungarumlaut'] = 778;
52004    t['degree'] = 400;
52005    t['ograve'] = 500;
52006    t['Ccaron'] = 722;
52007    t['ugrave'] = 556;
52008    t['radical'] = 549;
52009    t['Dcaron'] = 722;
52010    t['rcommaaccent'] = 444;
52011    t['Ntilde'] = 722;
52012    t['otilde'] = 500;
52013    t['Rcommaaccent'] = 722;
52014    t['Lcommaaccent'] = 667;
52015    t['Atilde'] = 722;
52016    t['Aogonek'] = 722;
52017    t['Aring'] = 722;
52018    t['Otilde'] = 778;
52019    t['zdotaccent'] = 444;
52020    t['Ecaron'] = 667;
52021    t['Iogonek'] = 389;
52022    t['kcommaaccent'] = 556;
52023    t['minus'] = 570;
52024    t['Icircumflex'] = 389;
52025    t['ncaron'] = 556;
52026    t['tcommaaccent'] = 333;
52027    t['logicalnot'] = 570;
52028    t['odieresis'] = 500;
52029    t['udieresis'] = 556;
52030    t['notequal'] = 549;
52031    t['gcommaaccent'] = 500;
52032    t['eth'] = 500;
52033    t['zcaron'] = 444;
52034    t['ncommaaccent'] = 556;
52035    t['onesuperior'] = 300;
52036    t['imacron'] = 278;
52037    t['Euro'] = 500;
52038  });
52039  t['Times-BoldItalic'] = (0, _core_utils.getLookupTableFactory)(function (t) {
52040    t['space'] = 250;
52041    t['exclam'] = 389;
52042    t['quotedbl'] = 555;
52043    t['numbersign'] = 500;
52044    t['dollar'] = 500;
52045    t['percent'] = 833;
52046    t['ampersand'] = 778;
52047    t['quoteright'] = 333;
52048    t['parenleft'] = 333;
52049    t['parenright'] = 333;
52050    t['asterisk'] = 500;
52051    t['plus'] = 570;
52052    t['comma'] = 250;
52053    t['hyphen'] = 333;
52054    t['period'] = 250;
52055    t['slash'] = 278;
52056    t['zero'] = 500;
52057    t['one'] = 500;
52058    t['two'] = 500;
52059    t['three'] = 500;
52060    t['four'] = 500;
52061    t['five'] = 500;
52062    t['six'] = 500;
52063    t['seven'] = 500;
52064    t['eight'] = 500;
52065    t['nine'] = 500;
52066    t['colon'] = 333;
52067    t['semicolon'] = 333;
52068    t['less'] = 570;
52069    t['equal'] = 570;
52070    t['greater'] = 570;
52071    t['question'] = 500;
52072    t['at'] = 832;
52073    t['A'] = 667;
52074    t['B'] = 667;
52075    t['C'] = 667;
52076    t['D'] = 722;
52077    t['E'] = 667;
52078    t['F'] = 667;
52079    t['G'] = 722;
52080    t['H'] = 778;
52081    t['I'] = 389;
52082    t['J'] = 500;
52083    t['K'] = 667;
52084    t['L'] = 611;
52085    t['M'] = 889;
52086    t['N'] = 722;
52087    t['O'] = 722;
52088    t['P'] = 611;
52089    t['Q'] = 722;
52090    t['R'] = 667;
52091    t['S'] = 556;
52092    t['T'] = 611;
52093    t['U'] = 722;
52094    t['V'] = 667;
52095    t['W'] = 889;
52096    t['X'] = 667;
52097    t['Y'] = 611;
52098    t['Z'] = 611;
52099    t['bracketleft'] = 333;
52100    t['backslash'] = 278;
52101    t['bracketright'] = 333;
52102    t['asciicircum'] = 570;
52103    t['underscore'] = 500;
52104    t['quoteleft'] = 333;
52105    t['a'] = 500;
52106    t['b'] = 500;
52107    t['c'] = 444;
52108    t['d'] = 500;
52109    t['e'] = 444;
52110    t['f'] = 333;
52111    t['g'] = 500;
52112    t['h'] = 556;
52113    t['i'] = 278;
52114    t['j'] = 278;
52115    t['k'] = 500;
52116    t['l'] = 278;
52117    t['m'] = 778;
52118    t['n'] = 556;
52119    t['o'] = 500;
52120    t['p'] = 500;
52121    t['q'] = 500;
52122    t['r'] = 389;
52123    t['s'] = 389;
52124    t['t'] = 278;
52125    t['u'] = 556;
52126    t['v'] = 444;
52127    t['w'] = 667;
52128    t['x'] = 500;
52129    t['y'] = 444;
52130    t['z'] = 389;
52131    t['braceleft'] = 348;
52132    t['bar'] = 220;
52133    t['braceright'] = 348;
52134    t['asciitilde'] = 570;
52135    t['exclamdown'] = 389;
52136    t['cent'] = 500;
52137    t['sterling'] = 500;
52138    t['fraction'] = 167;
52139    t['yen'] = 500;
52140    t['florin'] = 500;
52141    t['section'] = 500;
52142    t['currency'] = 500;
52143    t['quotesingle'] = 278;
52144    t['quotedblleft'] = 500;
52145    t['guillemotleft'] = 500;
52146    t['guilsinglleft'] = 333;
52147    t['guilsinglright'] = 333;
52148    t['fi'] = 556;
52149    t['fl'] = 556;
52150    t['endash'] = 500;
52151    t['dagger'] = 500;
52152    t['daggerdbl'] = 500;
52153    t['periodcentered'] = 250;
52154    t['paragraph'] = 500;
52155    t['bullet'] = 350;
52156    t['quotesinglbase'] = 333;
52157    t['quotedblbase'] = 500;
52158    t['quotedblright'] = 500;
52159    t['guillemotright'] = 500;
52160    t['ellipsis'] = 1000;
52161    t['perthousand'] = 1000;
52162    t['questiondown'] = 500;
52163    t['grave'] = 333;
52164    t['acute'] = 333;
52165    t['circumflex'] = 333;
52166    t['tilde'] = 333;
52167    t['macron'] = 333;
52168    t['breve'] = 333;
52169    t['dotaccent'] = 333;
52170    t['dieresis'] = 333;
52171    t['ring'] = 333;
52172    t['cedilla'] = 333;
52173    t['hungarumlaut'] = 333;
52174    t['ogonek'] = 333;
52175    t['caron'] = 333;
52176    t['emdash'] = 1000;
52177    t['AE'] = 944;
52178    t['ordfeminine'] = 266;
52179    t['Lslash'] = 611;
52180    t['Oslash'] = 722;
52181    t['OE'] = 944;
52182    t['ordmasculine'] = 300;
52183    t['ae'] = 722;
52184    t['dotlessi'] = 278;
52185    t['lslash'] = 278;
52186    t['oslash'] = 500;
52187    t['oe'] = 722;
52188    t['germandbls'] = 500;
52189    t['Idieresis'] = 389;
52190    t['eacute'] = 444;
52191    t['abreve'] = 500;
52192    t['uhungarumlaut'] = 556;
52193    t['ecaron'] = 444;
52194    t['Ydieresis'] = 611;
52195    t['divide'] = 570;
52196    t['Yacute'] = 611;
52197    t['Acircumflex'] = 667;
52198    t['aacute'] = 500;
52199    t['Ucircumflex'] = 722;
52200    t['yacute'] = 444;
52201    t['scommaaccent'] = 389;
52202    t['ecircumflex'] = 444;
52203    t['Uring'] = 722;
52204    t['Udieresis'] = 722;
52205    t['aogonek'] = 500;
52206    t['Uacute'] = 722;
52207    t['uogonek'] = 556;
52208    t['Edieresis'] = 667;
52209    t['Dcroat'] = 722;
52210    t['commaaccent'] = 250;
52211    t['copyright'] = 747;
52212    t['Emacron'] = 667;
52213    t['ccaron'] = 444;
52214    t['aring'] = 500;
52215    t['Ncommaaccent'] = 722;
52216    t['lacute'] = 278;
52217    t['agrave'] = 500;
52218    t['Tcommaaccent'] = 611;
52219    t['Cacute'] = 667;
52220    t['atilde'] = 500;
52221    t['Edotaccent'] = 667;
52222    t['scaron'] = 389;
52223    t['scedilla'] = 389;
52224    t['iacute'] = 278;
52225    t['lozenge'] = 494;
52226    t['Rcaron'] = 667;
52227    t['Gcommaaccent'] = 722;
52228    t['ucircumflex'] = 556;
52229    t['acircumflex'] = 500;
52230    t['Amacron'] = 667;
52231    t['rcaron'] = 389;
52232    t['ccedilla'] = 444;
52233    t['Zdotaccent'] = 611;
52234    t['Thorn'] = 611;
52235    t['Omacron'] = 722;
52236    t['Racute'] = 667;
52237    t['Sacute'] = 556;
52238    t['dcaron'] = 608;
52239    t['Umacron'] = 722;
52240    t['uring'] = 556;
52241    t['threesuperior'] = 300;
52242    t['Ograve'] = 722;
52243    t['Agrave'] = 667;
52244    t['Abreve'] = 667;
52245    t['multiply'] = 570;
52246    t['uacute'] = 556;
52247    t['Tcaron'] = 611;
52248    t['partialdiff'] = 494;
52249    t['ydieresis'] = 444;
52250    t['Nacute'] = 722;
52251    t['icircumflex'] = 278;
52252    t['Ecircumflex'] = 667;
52253    t['adieresis'] = 500;
52254    t['edieresis'] = 444;
52255    t['cacute'] = 444;
52256    t['nacute'] = 556;
52257    t['umacron'] = 556;
52258    t['Ncaron'] = 722;
52259    t['Iacute'] = 389;
52260    t['plusminus'] = 570;
52261    t['brokenbar'] = 220;
52262    t['registered'] = 747;
52263    t['Gbreve'] = 722;
52264    t['Idotaccent'] = 389;
52265    t['summation'] = 600;
52266    t['Egrave'] = 667;
52267    t['racute'] = 389;
52268    t['omacron'] = 500;
52269    t['Zacute'] = 611;
52270    t['Zcaron'] = 611;
52271    t['greaterequal'] = 549;
52272    t['Eth'] = 722;
52273    t['Ccedilla'] = 667;
52274    t['lcommaaccent'] = 278;
52275    t['tcaron'] = 366;
52276    t['eogonek'] = 444;
52277    t['Uogonek'] = 722;
52278    t['Aacute'] = 667;
52279    t['Adieresis'] = 667;
52280    t['egrave'] = 444;
52281    t['zacute'] = 389;
52282    t['iogonek'] = 278;
52283    t['Oacute'] = 722;
52284    t['oacute'] = 500;
52285    t['amacron'] = 500;
52286    t['sacute'] = 389;
52287    t['idieresis'] = 278;
52288    t['Ocircumflex'] = 722;
52289    t['Ugrave'] = 722;
52290    t['Delta'] = 612;
52291    t['thorn'] = 500;
52292    t['twosuperior'] = 300;
52293    t['Odieresis'] = 722;
52294    t['mu'] = 576;
52295    t['igrave'] = 278;
52296    t['ohungarumlaut'] = 500;
52297    t['Eogonek'] = 667;
52298    t['dcroat'] = 500;
52299    t['threequarters'] = 750;
52300    t['Scedilla'] = 556;
52301    t['lcaron'] = 382;
52302    t['Kcommaaccent'] = 667;
52303    t['Lacute'] = 611;
52304    t['trademark'] = 1000;
52305    t['edotaccent'] = 444;
52306    t['Igrave'] = 389;
52307    t['Imacron'] = 389;
52308    t['Lcaron'] = 611;
52309    t['onehalf'] = 750;
52310    t['lessequal'] = 549;
52311    t['ocircumflex'] = 500;
52312    t['ntilde'] = 556;
52313    t['Uhungarumlaut'] = 722;
52314    t['Eacute'] = 667;
52315    t['emacron'] = 444;
52316    t['gbreve'] = 500;
52317    t['onequarter'] = 750;
52318    t['Scaron'] = 556;
52319    t['Scommaaccent'] = 556;
52320    t['Ohungarumlaut'] = 722;
52321    t['degree'] = 400;
52322    t['ograve'] = 500;
52323    t['Ccaron'] = 667;
52324    t['ugrave'] = 556;
52325    t['radical'] = 549;
52326    t['Dcaron'] = 722;
52327    t['rcommaaccent'] = 389;
52328    t['Ntilde'] = 722;
52329    t['otilde'] = 500;
52330    t['Rcommaaccent'] = 667;
52331    t['Lcommaaccent'] = 611;
52332    t['Atilde'] = 667;
52333    t['Aogonek'] = 667;
52334    t['Aring'] = 667;
52335    t['Otilde'] = 722;
52336    t['zdotaccent'] = 389;
52337    t['Ecaron'] = 667;
52338    t['Iogonek'] = 389;
52339    t['kcommaaccent'] = 500;
52340    t['minus'] = 606;
52341    t['Icircumflex'] = 389;
52342    t['ncaron'] = 556;
52343    t['tcommaaccent'] = 278;
52344    t['logicalnot'] = 606;
52345    t['odieresis'] = 500;
52346    t['udieresis'] = 556;
52347    t['notequal'] = 549;
52348    t['gcommaaccent'] = 500;
52349    t['eth'] = 500;
52350    t['zcaron'] = 389;
52351    t['ncommaaccent'] = 556;
52352    t['onesuperior'] = 300;
52353    t['imacron'] = 278;
52354    t['Euro'] = 500;
52355  });
52356  t['Times-Italic'] = (0, _core_utils.getLookupTableFactory)(function (t) {
52357    t['space'] = 250;
52358    t['exclam'] = 333;
52359    t['quotedbl'] = 420;
52360    t['numbersign'] = 500;
52361    t['dollar'] = 500;
52362    t['percent'] = 833;
52363    t['ampersand'] = 778;
52364    t['quoteright'] = 333;
52365    t['parenleft'] = 333;
52366    t['parenright'] = 333;
52367    t['asterisk'] = 500;
52368    t['plus'] = 675;
52369    t['comma'] = 250;
52370    t['hyphen'] = 333;
52371    t['period'] = 250;
52372    t['slash'] = 278;
52373    t['zero'] = 500;
52374    t['one'] = 500;
52375    t['two'] = 500;
52376    t['three'] = 500;
52377    t['four'] = 500;
52378    t['five'] = 500;
52379    t['six'] = 500;
52380    t['seven'] = 500;
52381    t['eight'] = 500;
52382    t['nine'] = 500;
52383    t['colon'] = 333;
52384    t['semicolon'] = 333;
52385    t['less'] = 675;
52386    t['equal'] = 675;
52387    t['greater'] = 675;
52388    t['question'] = 500;
52389    t['at'] = 920;
52390    t['A'] = 611;
52391    t['B'] = 611;
52392    t['C'] = 667;
52393    t['D'] = 722;
52394    t['E'] = 611;
52395    t['F'] = 611;
52396    t['G'] = 722;
52397    t['H'] = 722;
52398    t['I'] = 333;
52399    t['J'] = 444;
52400    t['K'] = 667;
52401    t['L'] = 556;
52402    t['M'] = 833;
52403    t['N'] = 667;
52404    t['O'] = 722;
52405    t['P'] = 611;
52406    t['Q'] = 722;
52407    t['R'] = 611;
52408    t['S'] = 500;
52409    t['T'] = 556;
52410    t['U'] = 722;
52411    t['V'] = 611;
52412    t['W'] = 833;
52413    t['X'] = 611;
52414    t['Y'] = 556;
52415    t['Z'] = 556;
52416    t['bracketleft'] = 389;
52417    t['backslash'] = 278;
52418    t['bracketright'] = 389;
52419    t['asciicircum'] = 422;
52420    t['underscore'] = 500;
52421    t['quoteleft'] = 333;
52422    t['a'] = 500;
52423    t['b'] = 500;
52424    t['c'] = 444;
52425    t['d'] = 500;
52426    t['e'] = 444;
52427    t['f'] = 278;
52428    t['g'] = 500;
52429    t['h'] = 500;
52430    t['i'] = 278;
52431    t['j'] = 278;
52432    t['k'] = 444;
52433    t['l'] = 278;
52434    t['m'] = 722;
52435    t['n'] = 500;
52436    t['o'] = 500;
52437    t['p'] = 500;
52438    t['q'] = 500;
52439    t['r'] = 389;
52440    t['s'] = 389;
52441    t['t'] = 278;
52442    t['u'] = 500;
52443    t['v'] = 444;
52444    t['w'] = 667;
52445    t['x'] = 444;
52446    t['y'] = 444;
52447    t['z'] = 389;
52448    t['braceleft'] = 400;
52449    t['bar'] = 275;
52450    t['braceright'] = 400;
52451    t['asciitilde'] = 541;
52452    t['exclamdown'] = 389;
52453    t['cent'] = 500;
52454    t['sterling'] = 500;
52455    t['fraction'] = 167;
52456    t['yen'] = 500;
52457    t['florin'] = 500;
52458    t['section'] = 500;
52459    t['currency'] = 500;
52460    t['quotesingle'] = 214;
52461    t['quotedblleft'] = 556;
52462    t['guillemotleft'] = 500;
52463    t['guilsinglleft'] = 333;
52464    t['guilsinglright'] = 333;
52465    t['fi'] = 500;
52466    t['fl'] = 500;
52467    t['endash'] = 500;
52468    t['dagger'] = 500;
52469    t['daggerdbl'] = 500;
52470    t['periodcentered'] = 250;
52471    t['paragraph'] = 523;
52472    t['bullet'] = 350;
52473    t['quotesinglbase'] = 333;
52474    t['quotedblbase'] = 556;
52475    t['quotedblright'] = 556;
52476    t['guillemotright'] = 500;
52477    t['ellipsis'] = 889;
52478    t['perthousand'] = 1000;
52479    t['questiondown'] = 500;
52480    t['grave'] = 333;
52481    t['acute'] = 333;
52482    t['circumflex'] = 333;
52483    t['tilde'] = 333;
52484    t['macron'] = 333;
52485    t['breve'] = 333;
52486    t['dotaccent'] = 333;
52487    t['dieresis'] = 333;
52488    t['ring'] = 333;
52489    t['cedilla'] = 333;
52490    t['hungarumlaut'] = 333;
52491    t['ogonek'] = 333;
52492    t['caron'] = 333;
52493    t['emdash'] = 889;
52494    t['AE'] = 889;
52495    t['ordfeminine'] = 276;
52496    t['Lslash'] = 556;
52497    t['Oslash'] = 722;
52498    t['OE'] = 944;
52499    t['ordmasculine'] = 310;
52500    t['ae'] = 667;
52501    t['dotlessi'] = 278;
52502    t['lslash'] = 278;
52503    t['oslash'] = 500;
52504    t['oe'] = 667;
52505    t['germandbls'] = 500;
52506    t['Idieresis'] = 333;
52507    t['eacute'] = 444;
52508    t['abreve'] = 500;
52509    t['uhungarumlaut'] = 500;
52510    t['ecaron'] = 444;
52511    t['Ydieresis'] = 556;
52512    t['divide'] = 675;
52513    t['Yacute'] = 556;
52514    t['Acircumflex'] = 611;
52515    t['aacute'] = 500;
52516    t['Ucircumflex'] = 722;
52517    t['yacute'] = 444;
52518    t['scommaaccent'] = 389;
52519    t['ecircumflex'] = 444;
52520    t['Uring'] = 722;
52521    t['Udieresis'] = 722;
52522    t['aogonek'] = 500;
52523    t['Uacute'] = 722;
52524    t['uogonek'] = 500;
52525    t['Edieresis'] = 611;
52526    t['Dcroat'] = 722;
52527    t['commaaccent'] = 250;
52528    t['copyright'] = 760;
52529    t['Emacron'] = 611;
52530    t['ccaron'] = 444;
52531    t['aring'] = 500;
52532    t['Ncommaaccent'] = 667;
52533    t['lacute'] = 278;
52534    t['agrave'] = 500;
52535    t['Tcommaaccent'] = 556;
52536    t['Cacute'] = 667;
52537    t['atilde'] = 500;
52538    t['Edotaccent'] = 611;
52539    t['scaron'] = 389;
52540    t['scedilla'] = 389;
52541    t['iacute'] = 278;
52542    t['lozenge'] = 471;
52543    t['Rcaron'] = 611;
52544    t['Gcommaaccent'] = 722;
52545    t['ucircumflex'] = 500;
52546    t['acircumflex'] = 500;
52547    t['Amacron'] = 611;
52548    t['rcaron'] = 389;
52549    t['ccedilla'] = 444;
52550    t['Zdotaccent'] = 556;
52551    t['Thorn'] = 611;
52552    t['Omacron'] = 722;
52553    t['Racute'] = 611;
52554    t['Sacute'] = 500;
52555    t['dcaron'] = 544;
52556    t['Umacron'] = 722;
52557    t['uring'] = 500;
52558    t['threesuperior'] = 300;
52559    t['Ograve'] = 722;
52560    t['Agrave'] = 611;
52561    t['Abreve'] = 611;
52562    t['multiply'] = 675;
52563    t['uacute'] = 500;
52564    t['Tcaron'] = 556;
52565    t['partialdiff'] = 476;
52566    t['ydieresis'] = 444;
52567    t['Nacute'] = 667;
52568    t['icircumflex'] = 278;
52569    t['Ecircumflex'] = 611;
52570    t['adieresis'] = 500;
52571    t['edieresis'] = 444;
52572    t['cacute'] = 444;
52573    t['nacute'] = 500;
52574    t['umacron'] = 500;
52575    t['Ncaron'] = 667;
52576    t['Iacute'] = 333;
52577    t['plusminus'] = 675;
52578    t['brokenbar'] = 275;
52579    t['registered'] = 760;
52580    t['Gbreve'] = 722;
52581    t['Idotaccent'] = 333;
52582    t['summation'] = 600;
52583    t['Egrave'] = 611;
52584    t['racute'] = 389;
52585    t['omacron'] = 500;
52586    t['Zacute'] = 556;
52587    t['Zcaron'] = 556;
52588    t['greaterequal'] = 549;
52589    t['Eth'] = 722;
52590    t['Ccedilla'] = 667;
52591    t['lcommaaccent'] = 278;
52592    t['tcaron'] = 300;
52593    t['eogonek'] = 444;
52594    t['Uogonek'] = 722;
52595    t['Aacute'] = 611;
52596    t['Adieresis'] = 611;
52597    t['egrave'] = 444;
52598    t['zacute'] = 389;
52599    t['iogonek'] = 278;
52600    t['Oacute'] = 722;
52601    t['oacute'] = 500;
52602    t['amacron'] = 500;
52603    t['sacute'] = 389;
52604    t['idieresis'] = 278;
52605    t['Ocircumflex'] = 722;
52606    t['Ugrave'] = 722;
52607    t['Delta'] = 612;
52608    t['thorn'] = 500;
52609    t['twosuperior'] = 300;
52610    t['Odieresis'] = 722;
52611    t['mu'] = 500;
52612    t['igrave'] = 278;
52613    t['ohungarumlaut'] = 500;
52614    t['Eogonek'] = 611;
52615    t['dcroat'] = 500;
52616    t['threequarters'] = 750;
52617    t['Scedilla'] = 500;
52618    t['lcaron'] = 300;
52619    t['Kcommaaccent'] = 667;
52620    t['Lacute'] = 556;
52621    t['trademark'] = 980;
52622    t['edotaccent'] = 444;
52623    t['Igrave'] = 333;
52624    t['Imacron'] = 333;
52625    t['Lcaron'] = 611;
52626    t['onehalf'] = 750;
52627    t['lessequal'] = 549;
52628    t['ocircumflex'] = 500;
52629    t['ntilde'] = 500;
52630    t['Uhungarumlaut'] = 722;
52631    t['Eacute'] = 611;
52632    t['emacron'] = 444;
52633    t['gbreve'] = 500;
52634    t['onequarter'] = 750;
52635    t['Scaron'] = 500;
52636    t['Scommaaccent'] = 500;
52637    t['Ohungarumlaut'] = 722;
52638    t['degree'] = 400;
52639    t['ograve'] = 500;
52640    t['Ccaron'] = 667;
52641    t['ugrave'] = 500;
52642    t['radical'] = 453;
52643    t['Dcaron'] = 722;
52644    t['rcommaaccent'] = 389;
52645    t['Ntilde'] = 667;
52646    t['otilde'] = 500;
52647    t['Rcommaaccent'] = 611;
52648    t['Lcommaaccent'] = 556;
52649    t['Atilde'] = 611;
52650    t['Aogonek'] = 611;
52651    t['Aring'] = 611;
52652    t['Otilde'] = 722;
52653    t['zdotaccent'] = 389;
52654    t['Ecaron'] = 611;
52655    t['Iogonek'] = 333;
52656    t['kcommaaccent'] = 444;
52657    t['minus'] = 675;
52658    t['Icircumflex'] = 333;
52659    t['ncaron'] = 500;
52660    t['tcommaaccent'] = 278;
52661    t['logicalnot'] = 675;
52662    t['odieresis'] = 500;
52663    t['udieresis'] = 500;
52664    t['notequal'] = 549;
52665    t['gcommaaccent'] = 500;
52666    t['eth'] = 500;
52667    t['zcaron'] = 389;
52668    t['ncommaaccent'] = 500;
52669    t['onesuperior'] = 300;
52670    t['imacron'] = 278;
52671    t['Euro'] = 500;
52672  });
52673  t['ZapfDingbats'] = (0, _core_utils.getLookupTableFactory)(function (t) {
52674    t['space'] = 278;
52675    t['a1'] = 974;
52676    t['a2'] = 961;
52677    t['a202'] = 974;
52678    t['a3'] = 980;
52679    t['a4'] = 719;
52680    t['a5'] = 789;
52681    t['a119'] = 790;
52682    t['a118'] = 791;
52683    t['a117'] = 690;
52684    t['a11'] = 960;
52685    t['a12'] = 939;
52686    t['a13'] = 549;
52687    t['a14'] = 855;
52688    t['a15'] = 911;
52689    t['a16'] = 933;
52690    t['a105'] = 911;
52691    t['a17'] = 945;
52692    t['a18'] = 974;
52693    t['a19'] = 755;
52694    t['a20'] = 846;
52695    t['a21'] = 762;
52696    t['a22'] = 761;
52697    t['a23'] = 571;
52698    t['a24'] = 677;
52699    t['a25'] = 763;
52700    t['a26'] = 760;
52701    t['a27'] = 759;
52702    t['a28'] = 754;
52703    t['a6'] = 494;
52704    t['a7'] = 552;
52705    t['a8'] = 537;
52706    t['a9'] = 577;
52707    t['a10'] = 692;
52708    t['a29'] = 786;
52709    t['a30'] = 788;
52710    t['a31'] = 788;
52711    t['a32'] = 790;
52712    t['a33'] = 793;
52713    t['a34'] = 794;
52714    t['a35'] = 816;
52715    t['a36'] = 823;
52716    t['a37'] = 789;
52717    t['a38'] = 841;
52718    t['a39'] = 823;
52719    t['a40'] = 833;
52720    t['a41'] = 816;
52721    t['a42'] = 831;
52722    t['a43'] = 923;
52723    t['a44'] = 744;
52724    t['a45'] = 723;
52725    t['a46'] = 749;
52726    t['a47'] = 790;
52727    t['a48'] = 792;
52728    t['a49'] = 695;
52729    t['a50'] = 776;
52730    t['a51'] = 768;
52731    t['a52'] = 792;
52732    t['a53'] = 759;
52733    t['a54'] = 707;
52734    t['a55'] = 708;
52735    t['a56'] = 682;
52736    t['a57'] = 701;
52737    t['a58'] = 826;
52738    t['a59'] = 815;
52739    t['a60'] = 789;
52740    t['a61'] = 789;
52741    t['a62'] = 707;
52742    t['a63'] = 687;
52743    t['a64'] = 696;
52744    t['a65'] = 689;
52745    t['a66'] = 786;
52746    t['a67'] = 787;
52747    t['a68'] = 713;
52748    t['a69'] = 791;
52749    t['a70'] = 785;
52750    t['a71'] = 791;
52751    t['a72'] = 873;
52752    t['a73'] = 761;
52753    t['a74'] = 762;
52754    t['a203'] = 762;
52755    t['a75'] = 759;
52756    t['a204'] = 759;
52757    t['a76'] = 892;
52758    t['a77'] = 892;
52759    t['a78'] = 788;
52760    t['a79'] = 784;
52761    t['a81'] = 438;
52762    t['a82'] = 138;
52763    t['a83'] = 277;
52764    t['a84'] = 415;
52765    t['a97'] = 392;
52766    t['a98'] = 392;
52767    t['a99'] = 668;
52768    t['a100'] = 668;
52769    t['a89'] = 390;
52770    t['a90'] = 390;
52771    t['a93'] = 317;
52772    t['a94'] = 317;
52773    t['a91'] = 276;
52774    t['a92'] = 276;
52775    t['a205'] = 509;
52776    t['a85'] = 509;
52777    t['a206'] = 410;
52778    t['a86'] = 410;
52779    t['a87'] = 234;
52780    t['a88'] = 234;
52781    t['a95'] = 334;
52782    t['a96'] = 334;
52783    t['a101'] = 732;
52784    t['a102'] = 544;
52785    t['a103'] = 544;
52786    t['a104'] = 910;
52787    t['a106'] = 667;
52788    t['a107'] = 760;
52789    t['a108'] = 760;
52790    t['a112'] = 776;
52791    t['a111'] = 595;
52792    t['a110'] = 694;
52793    t['a109'] = 626;
52794    t['a120'] = 788;
52795    t['a121'] = 788;
52796    t['a122'] = 788;
52797    t['a123'] = 788;
52798    t['a124'] = 788;
52799    t['a125'] = 788;
52800    t['a126'] = 788;
52801    t['a127'] = 788;
52802    t['a128'] = 788;
52803    t['a129'] = 788;
52804    t['a130'] = 788;
52805    t['a131'] = 788;
52806    t['a132'] = 788;
52807    t['a133'] = 788;
52808    t['a134'] = 788;
52809    t['a135'] = 788;
52810    t['a136'] = 788;
52811    t['a137'] = 788;
52812    t['a138'] = 788;
52813    t['a139'] = 788;
52814    t['a140'] = 788;
52815    t['a141'] = 788;
52816    t['a142'] = 788;
52817    t['a143'] = 788;
52818    t['a144'] = 788;
52819    t['a145'] = 788;
52820    t['a146'] = 788;
52821    t['a147'] = 788;
52822    t['a148'] = 788;
52823    t['a149'] = 788;
52824    t['a150'] = 788;
52825    t['a151'] = 788;
52826    t['a152'] = 788;
52827    t['a153'] = 788;
52828    t['a154'] = 788;
52829    t['a155'] = 788;
52830    t['a156'] = 788;
52831    t['a157'] = 788;
52832    t['a158'] = 788;
52833    t['a159'] = 788;
52834    t['a160'] = 894;
52835    t['a161'] = 838;
52836    t['a163'] = 1016;
52837    t['a164'] = 458;
52838    t['a196'] = 748;
52839    t['a165'] = 924;
52840    t['a192'] = 748;
52841    t['a166'] = 918;
52842    t['a167'] = 927;
52843    t['a168'] = 928;
52844    t['a169'] = 928;
52845    t['a170'] = 834;
52846    t['a171'] = 873;
52847    t['a172'] = 828;
52848    t['a173'] = 924;
52849    t['a162'] = 924;
52850    t['a174'] = 917;
52851    t['a175'] = 930;
52852    t['a176'] = 931;
52853    t['a177'] = 463;
52854    t['a178'] = 883;
52855    t['a179'] = 836;
52856    t['a193'] = 836;
52857    t['a180'] = 867;
52858    t['a199'] = 867;
52859    t['a181'] = 696;
52860    t['a200'] = 696;
52861    t['a182'] = 874;
52862    t['a201'] = 874;
52863    t['a183'] = 760;
52864    t['a184'] = 946;
52865    t['a197'] = 771;
52866    t['a185'] = 865;
52867    t['a194'] = 771;
52868    t['a198'] = 888;
52869    t['a186'] = 967;
52870    t['a195'] = 888;
52871    t['a187'] = 831;
52872    t['a188'] = 873;
52873    t['a189'] = 927;
52874    t['a190'] = 970;
52875    t['a191'] = 918;
52876  });
52877});
52878exports.getMetrics = getMetrics;
52879
52880/***/ }),
52881/* 186 */
52882/***/ (function(module, exports, __w_pdfjs_require__) {
52883
52884"use strict";
52885
52886
52887Object.defineProperty(exports, "__esModule", {
52888  value: true
52889});
52890exports.isPDFFunction = isPDFFunction;
52891exports.PostScriptCompiler = exports.PostScriptEvaluator = exports.PDFFunctionFactory = void 0;
52892
52893var _util = __w_pdfjs_require__(5);
52894
52895var _primitives = __w_pdfjs_require__(151);
52896
52897var _ps_parser = __w_pdfjs_require__(187);
52898
52899function _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); }
52900
52901function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
52902
52903function _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); } }
52904
52905function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
52906
52907var IsEvalSupportedCached = {
52908  get value() {
52909    return (0, _util.shadow)(this, 'value', (0, _util.isEvalSupported)());
52910  }
52911
52912};
52913
52914var PDFFunctionFactory =
52915/*#__PURE__*/
52916function () {
52917  function PDFFunctionFactory(_ref) {
52918    var xref = _ref.xref,
52919        _ref$isEvalSupported = _ref.isEvalSupported,
52920        isEvalSupported = _ref$isEvalSupported === void 0 ? true : _ref$isEvalSupported;
52921
52922    _classCallCheck(this, PDFFunctionFactory);
52923
52924    this.xref = xref;
52925    this.isEvalSupported = isEvalSupported !== false;
52926  }
52927
52928  _createClass(PDFFunctionFactory, [{
52929    key: "create",
52930    value: function create(fn) {
52931      return PDFFunction.parse({
52932        xref: this.xref,
52933        isEvalSupported: this.isEvalSupported,
52934        fn: fn
52935      });
52936    }
52937  }, {
52938    key: "createFromArray",
52939    value: function createFromArray(fnObj) {
52940      return PDFFunction.parseArray({
52941        xref: this.xref,
52942        isEvalSupported: this.isEvalSupported,
52943        fnObj: fnObj
52944      });
52945    }
52946  }]);
52947
52948  return PDFFunctionFactory;
52949}();
52950
52951exports.PDFFunctionFactory = PDFFunctionFactory;
52952
52953function toNumberArray(arr) {
52954  if (!Array.isArray(arr)) {
52955    return null;
52956  }
52957
52958  var length = arr.length;
52959
52960  for (var i = 0; i < length; i++) {
52961    if (typeof arr[i] !== 'number') {
52962      var result = new Array(length);
52963
52964      for (var _i = 0; _i < length; _i++) {
52965        result[_i] = +arr[_i];
52966      }
52967
52968      return result;
52969    }
52970  }
52971
52972  return arr;
52973}
52974
52975var PDFFunction = function PDFFunctionClosure() {
52976  var CONSTRUCT_SAMPLED = 0;
52977  var CONSTRUCT_INTERPOLATED = 2;
52978  var CONSTRUCT_STICHED = 3;
52979  var CONSTRUCT_POSTSCRIPT = 4;
52980  return {
52981    getSampleArray: function getSampleArray(size, outputSize, bps, stream) {
52982      var i, ii;
52983      var length = 1;
52984
52985      for (i = 0, ii = size.length; i < ii; i++) {
52986        length *= size[i];
52987      }
52988
52989      length *= outputSize;
52990      var array = new Array(length);
52991      var codeSize = 0;
52992      var codeBuf = 0;
52993      var sampleMul = 1.0 / (Math.pow(2.0, bps) - 1);
52994      var strBytes = stream.getBytes((length * bps + 7) / 8);
52995      var strIdx = 0;
52996
52997      for (i = 0; i < length; i++) {
52998        while (codeSize < bps) {
52999          codeBuf <<= 8;
53000          codeBuf |= strBytes[strIdx++];
53001          codeSize += 8;
53002        }
53003
53004        codeSize -= bps;
53005        array[i] = (codeBuf >> codeSize) * sampleMul;
53006        codeBuf &= (1 << codeSize) - 1;
53007      }
53008
53009      return array;
53010    },
53011    getIR: function getIR(_ref2) {
53012      var xref = _ref2.xref,
53013          isEvalSupported = _ref2.isEvalSupported,
53014          fn = _ref2.fn;
53015      var dict = fn.dict;
53016
53017      if (!dict) {
53018        dict = fn;
53019      }
53020
53021      var types = [this.constructSampled, null, this.constructInterpolated, this.constructStiched, this.constructPostScript];
53022      var typeNum = dict.get('FunctionType');
53023      var typeFn = types[typeNum];
53024
53025      if (!typeFn) {
53026        throw new _util.FormatError('Unknown type of function');
53027      }
53028
53029      return typeFn.call(this, {
53030        xref: xref,
53031        isEvalSupported: isEvalSupported,
53032        fn: fn,
53033        dict: dict
53034      });
53035    },
53036    fromIR: function fromIR(_ref3) {
53037      var xref = _ref3.xref,
53038          isEvalSupported = _ref3.isEvalSupported,
53039          IR = _ref3.IR;
53040      var type = IR[0];
53041
53042      switch (type) {
53043        case CONSTRUCT_SAMPLED:
53044          return this.constructSampledFromIR({
53045            xref: xref,
53046            isEvalSupported: isEvalSupported,
53047            IR: IR
53048          });
53049
53050        case CONSTRUCT_INTERPOLATED:
53051          return this.constructInterpolatedFromIR({
53052            xref: xref,
53053            isEvalSupported: isEvalSupported,
53054            IR: IR
53055          });
53056
53057        case CONSTRUCT_STICHED:
53058          return this.constructStichedFromIR({
53059            xref: xref,
53060            isEvalSupported: isEvalSupported,
53061            IR: IR
53062          });
53063
53064        default:
53065          return this.constructPostScriptFromIR({
53066            xref: xref,
53067            isEvalSupported: isEvalSupported,
53068            IR: IR
53069          });
53070      }
53071    },
53072    parse: function parse(_ref4) {
53073      var xref = _ref4.xref,
53074          isEvalSupported = _ref4.isEvalSupported,
53075          fn = _ref4.fn;
53076      var IR = this.getIR({
53077        xref: xref,
53078        isEvalSupported: isEvalSupported,
53079        fn: fn
53080      });
53081      return this.fromIR({
53082        xref: xref,
53083        isEvalSupported: isEvalSupported,
53084        IR: IR
53085      });
53086    },
53087    parseArray: function parseArray(_ref5) {
53088      var xref = _ref5.xref,
53089          isEvalSupported = _ref5.isEvalSupported,
53090          fnObj = _ref5.fnObj;
53091
53092      if (!Array.isArray(fnObj)) {
53093        return this.parse({
53094          xref: xref,
53095          isEvalSupported: isEvalSupported,
53096          fn: fnObj
53097        });
53098      }
53099
53100      var fnArray = [];
53101
53102      for (var j = 0, jj = fnObj.length; j < jj; j++) {
53103        fnArray.push(this.parse({
53104          xref: xref,
53105          isEvalSupported: isEvalSupported,
53106          fn: xref.fetchIfRef(fnObj[j])
53107        }));
53108      }
53109
53110      return function (src, srcOffset, dest, destOffset) {
53111        for (var i = 0, ii = fnArray.length; i < ii; i++) {
53112          fnArray[i](src, srcOffset, dest, destOffset + i);
53113        }
53114      };
53115    },
53116    constructSampled: function constructSampled(_ref6) {
53117      var xref = _ref6.xref,
53118          isEvalSupported = _ref6.isEvalSupported,
53119          fn = _ref6.fn,
53120          dict = _ref6.dict;
53121
53122      function toMultiArray(arr) {
53123        var inputLength = arr.length;
53124        var out = [];
53125        var index = 0;
53126
53127        for (var i = 0; i < inputLength; i += 2) {
53128          out[index] = [arr[i], arr[i + 1]];
53129          ++index;
53130        }
53131
53132        return out;
53133      }
53134
53135      var domain = toNumberArray(dict.getArray('Domain'));
53136      var range = toNumberArray(dict.getArray('Range'));
53137
53138      if (!domain || !range) {
53139        throw new _util.FormatError('No domain or range');
53140      }
53141
53142      var inputSize = domain.length / 2;
53143      var outputSize = range.length / 2;
53144      domain = toMultiArray(domain);
53145      range = toMultiArray(range);
53146      var size = toNumberArray(dict.getArray('Size'));
53147      var bps = dict.get('BitsPerSample');
53148      var order = dict.get('Order') || 1;
53149
53150      if (order !== 1) {
53151        (0, _util.info)('No support for cubic spline interpolation: ' + order);
53152      }
53153
53154      var encode = toNumberArray(dict.getArray('Encode'));
53155
53156      if (!encode) {
53157        encode = [];
53158
53159        for (var i = 0; i < inputSize; ++i) {
53160          encode.push([0, size[i] - 1]);
53161        }
53162      } else {
53163        encode = toMultiArray(encode);
53164      }
53165
53166      var decode = toNumberArray(dict.getArray('Decode'));
53167
53168      if (!decode) {
53169        decode = range;
53170      } else {
53171        decode = toMultiArray(decode);
53172      }
53173
53174      var samples = this.getSampleArray(size, outputSize, bps, fn);
53175      return [CONSTRUCT_SAMPLED, inputSize, domain, encode, decode, samples, size, outputSize, Math.pow(2, bps) - 1, range];
53176    },
53177    constructSampledFromIR: function constructSampledFromIR(_ref7) {
53178      var xref = _ref7.xref,
53179          isEvalSupported = _ref7.isEvalSupported,
53180          IR = _ref7.IR;
53181
53182      function interpolate(x, xmin, xmax, ymin, ymax) {
53183        return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
53184      }
53185
53186      return function constructSampledFromIRResult(src, srcOffset, dest, destOffset) {
53187        var m = IR[1];
53188        var domain = IR[2];
53189        var encode = IR[3];
53190        var decode = IR[4];
53191        var samples = IR[5];
53192        var size = IR[6];
53193        var n = IR[7];
53194        var range = IR[9];
53195        var cubeVertices = 1 << m;
53196        var cubeN = new Float64Array(cubeVertices);
53197        var cubeVertex = new Uint32Array(cubeVertices);
53198        var i, j;
53199
53200        for (j = 0; j < cubeVertices; j++) {
53201          cubeN[j] = 1;
53202        }
53203
53204        var k = n,
53205            pos = 1;
53206
53207        for (i = 0; i < m; ++i) {
53208          var domain_2i = domain[i][0];
53209          var domain_2i_1 = domain[i][1];
53210          var xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
53211          var e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
53212          var size_i = size[i];
53213          e = Math.min(Math.max(e, 0), size_i - 1);
53214          var e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
53215          var n0 = e0 + 1 - e;
53216          var n1 = e - e0;
53217          var offset0 = e0 * k;
53218          var offset1 = offset0 + k;
53219
53220          for (j = 0; j < cubeVertices; j++) {
53221            if (j & pos) {
53222              cubeN[j] *= n1;
53223              cubeVertex[j] += offset1;
53224            } else {
53225              cubeN[j] *= n0;
53226              cubeVertex[j] += offset0;
53227            }
53228          }
53229
53230          k *= size_i;
53231          pos <<= 1;
53232        }
53233
53234        for (j = 0; j < n; ++j) {
53235          var rj = 0;
53236
53237          for (i = 0; i < cubeVertices; i++) {
53238            rj += samples[cubeVertex[i] + j] * cubeN[i];
53239          }
53240
53241          rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
53242          dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
53243        }
53244      };
53245    },
53246    constructInterpolated: function constructInterpolated(_ref8) {
53247      var xref = _ref8.xref,
53248          isEvalSupported = _ref8.isEvalSupported,
53249          fn = _ref8.fn,
53250          dict = _ref8.dict;
53251      var c0 = toNumberArray(dict.getArray('C0')) || [0];
53252      var c1 = toNumberArray(dict.getArray('C1')) || [1];
53253      var n = dict.get('N');
53254      var length = c0.length;
53255      var diff = [];
53256
53257      for (var i = 0; i < length; ++i) {
53258        diff.push(c1[i] - c0[i]);
53259      }
53260
53261      return [CONSTRUCT_INTERPOLATED, c0, diff, n];
53262    },
53263    constructInterpolatedFromIR: function constructInterpolatedFromIR(_ref9) {
53264      var xref = _ref9.xref,
53265          isEvalSupported = _ref9.isEvalSupported,
53266          IR = _ref9.IR;
53267      var c0 = IR[1];
53268      var diff = IR[2];
53269      var n = IR[3];
53270      var length = diff.length;
53271      return function constructInterpolatedFromIRResult(src, srcOffset, dest, destOffset) {
53272        var x = n === 1 ? src[srcOffset] : Math.pow(src[srcOffset], n);
53273
53274        for (var j = 0; j < length; ++j) {
53275          dest[destOffset + j] = c0[j] + x * diff[j];
53276        }
53277      };
53278    },
53279    constructStiched: function constructStiched(_ref10) {
53280      var xref = _ref10.xref,
53281          isEvalSupported = _ref10.isEvalSupported,
53282          fn = _ref10.fn,
53283          dict = _ref10.dict;
53284      var domain = toNumberArray(dict.getArray('Domain'));
53285
53286      if (!domain) {
53287        throw new _util.FormatError('No domain');
53288      }
53289
53290      var inputSize = domain.length / 2;
53291
53292      if (inputSize !== 1) {
53293        throw new _util.FormatError('Bad domain for stiched function');
53294      }
53295
53296      var fnRefs = dict.get('Functions');
53297      var fns = [];
53298
53299      for (var i = 0, ii = fnRefs.length; i < ii; ++i) {
53300        fns.push(this.parse({
53301          xref: xref,
53302          isEvalSupported: isEvalSupported,
53303          fn: xref.fetchIfRef(fnRefs[i])
53304        }));
53305      }
53306
53307      var bounds = toNumberArray(dict.getArray('Bounds'));
53308      var encode = toNumberArray(dict.getArray('Encode'));
53309      return [CONSTRUCT_STICHED, domain, bounds, encode, fns];
53310    },
53311    constructStichedFromIR: function constructStichedFromIR(_ref11) {
53312      var xref = _ref11.xref,
53313          isEvalSupported = _ref11.isEvalSupported,
53314          IR = _ref11.IR;
53315      var domain = IR[1];
53316      var bounds = IR[2];
53317      var encode = IR[3];
53318      var fns = IR[4];
53319      var tmpBuf = new Float32Array(1);
53320      return function constructStichedFromIRResult(src, srcOffset, dest, destOffset) {
53321        var clip = function constructStichedFromIRClip(v, min, max) {
53322          if (v > max) {
53323            v = max;
53324          } else if (v < min) {
53325            v = min;
53326          }
53327
53328          return v;
53329        };
53330
53331        var v = clip(src[srcOffset], domain[0], domain[1]);
53332
53333        for (var i = 0, ii = bounds.length; i < ii; ++i) {
53334          if (v < bounds[i]) {
53335            break;
53336          }
53337        }
53338
53339        var dmin = domain[0];
53340
53341        if (i > 0) {
53342          dmin = bounds[i - 1];
53343        }
53344
53345        var dmax = domain[1];
53346
53347        if (i < bounds.length) {
53348          dmax = bounds[i];
53349        }
53350
53351        var rmin = encode[2 * i];
53352        var rmax = encode[2 * i + 1];
53353        tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
53354        fns[i](tmpBuf, 0, dest, destOffset);
53355      };
53356    },
53357    constructPostScript: function constructPostScript(_ref12) {
53358      var xref = _ref12.xref,
53359          isEvalSupported = _ref12.isEvalSupported,
53360          fn = _ref12.fn,
53361          dict = _ref12.dict;
53362      var domain = toNumberArray(dict.getArray('Domain'));
53363      var range = toNumberArray(dict.getArray('Range'));
53364
53365      if (!domain) {
53366        throw new _util.FormatError('No domain.');
53367      }
53368
53369      if (!range) {
53370        throw new _util.FormatError('No range.');
53371      }
53372
53373      var lexer = new _ps_parser.PostScriptLexer(fn);
53374      var parser = new _ps_parser.PostScriptParser(lexer);
53375      var code = parser.parse();
53376      return [CONSTRUCT_POSTSCRIPT, domain, range, code];
53377    },
53378    constructPostScriptFromIR: function constructPostScriptFromIR(_ref13) {
53379      var xref = _ref13.xref,
53380          isEvalSupported = _ref13.isEvalSupported,
53381          IR = _ref13.IR;
53382      var domain = IR[1];
53383      var range = IR[2];
53384      var code = IR[3];
53385
53386      if (isEvalSupported && IsEvalSupportedCached.value) {
53387        var compiled = new PostScriptCompiler().compile(code, domain, range);
53388
53389        if (compiled) {
53390          return new Function('src', 'srcOffset', 'dest', 'destOffset', compiled);
53391        }
53392      }
53393
53394      (0, _util.info)('Unable to compile PS function');
53395      var numOutputs = range.length >> 1;
53396      var numInputs = domain.length >> 1;
53397      var evaluator = new PostScriptEvaluator(code);
53398      var cache = Object.create(null);
53399      var MAX_CACHE_SIZE = 2048 * 4;
53400      var cache_available = MAX_CACHE_SIZE;
53401      var tmpBuf = new Float32Array(numInputs);
53402      return function constructPostScriptFromIRResult(src, srcOffset, dest, destOffset) {
53403        var i, value;
53404        var key = '';
53405        var input = tmpBuf;
53406
53407        for (i = 0; i < numInputs; i++) {
53408          value = src[srcOffset + i];
53409          input[i] = value;
53410          key += value + '_';
53411        }
53412
53413        var cachedValue = cache[key];
53414
53415        if (cachedValue !== undefined) {
53416          dest.set(cachedValue, destOffset);
53417          return;
53418        }
53419
53420        var output = new Float32Array(numOutputs);
53421        var stack = evaluator.execute(input);
53422        var stackIndex = stack.length - numOutputs;
53423
53424        for (i = 0; i < numOutputs; i++) {
53425          value = stack[stackIndex + i];
53426          var bound = range[i * 2];
53427
53428          if (value < bound) {
53429            value = bound;
53430          } else {
53431            bound = range[i * 2 + 1];
53432
53433            if (value > bound) {
53434              value = bound;
53435            }
53436          }
53437
53438          output[i] = value;
53439        }
53440
53441        if (cache_available > 0) {
53442          cache_available--;
53443          cache[key] = output;
53444        }
53445
53446        dest.set(output, destOffset);
53447      };
53448    }
53449  };
53450}();
53451
53452function isPDFFunction(v) {
53453  var fnDict;
53454
53455  if (_typeof(v) !== 'object') {
53456    return false;
53457  } else if ((0, _primitives.isDict)(v)) {
53458    fnDict = v;
53459  } else if ((0, _primitives.isStream)(v)) {
53460    fnDict = v.dict;
53461  } else {
53462    return false;
53463  }
53464
53465  return fnDict.has('FunctionType');
53466}
53467
53468var PostScriptStack = function PostScriptStackClosure() {
53469  var MAX_STACK_SIZE = 100;
53470
53471  function PostScriptStack(initialStack) {
53472    this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0);
53473  }
53474
53475  PostScriptStack.prototype = {
53476    push: function PostScriptStack_push(value) {
53477      if (this.stack.length >= MAX_STACK_SIZE) {
53478        throw new Error('PostScript function stack overflow.');
53479      }
53480
53481      this.stack.push(value);
53482    },
53483    pop: function PostScriptStack_pop() {
53484      if (this.stack.length <= 0) {
53485        throw new Error('PostScript function stack underflow.');
53486      }
53487
53488      return this.stack.pop();
53489    },
53490    copy: function PostScriptStack_copy(n) {
53491      if (this.stack.length + n >= MAX_STACK_SIZE) {
53492        throw new Error('PostScript function stack overflow.');
53493      }
53494
53495      var stack = this.stack;
53496
53497      for (var i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
53498        stack.push(stack[i]);
53499      }
53500    },
53501    index: function PostScriptStack_index(n) {
53502      this.push(this.stack[this.stack.length - n - 1]);
53503    },
53504    roll: function PostScriptStack_roll(n, p) {
53505      var stack = this.stack;
53506      var l = stack.length - n;
53507      var r = stack.length - 1,
53508          c = l + (p - Math.floor(p / n) * n),
53509          i,
53510          j,
53511          t;
53512
53513      for (i = l, j = r; i < j; i++, j--) {
53514        t = stack[i];
53515        stack[i] = stack[j];
53516        stack[j] = t;
53517      }
53518
53519      for (i = l, j = c - 1; i < j; i++, j--) {
53520        t = stack[i];
53521        stack[i] = stack[j];
53522        stack[j] = t;
53523      }
53524
53525      for (i = c, j = r; i < j; i++, j--) {
53526        t = stack[i];
53527        stack[i] = stack[j];
53528        stack[j] = t;
53529      }
53530    }
53531  };
53532  return PostScriptStack;
53533}();
53534
53535var PostScriptEvaluator = function PostScriptEvaluatorClosure() {
53536  function PostScriptEvaluator(operators) {
53537    this.operators = operators;
53538  }
53539
53540  PostScriptEvaluator.prototype = {
53541    execute: function PostScriptEvaluator_execute(initialStack) {
53542      var stack = new PostScriptStack(initialStack);
53543      var counter = 0;
53544      var operators = this.operators;
53545      var length = operators.length;
53546      var operator, a, b;
53547
53548      while (counter < length) {
53549        operator = operators[counter++];
53550
53551        if (typeof operator === 'number') {
53552          stack.push(operator);
53553          continue;
53554        }
53555
53556        switch (operator) {
53557          case 'jz':
53558            b = stack.pop();
53559            a = stack.pop();
53560
53561            if (!a) {
53562              counter = b;
53563            }
53564
53565            break;
53566
53567          case 'j':
53568            a = stack.pop();
53569            counter = a;
53570            break;
53571
53572          case 'abs':
53573            a = stack.pop();
53574            stack.push(Math.abs(a));
53575            break;
53576
53577          case 'add':
53578            b = stack.pop();
53579            a = stack.pop();
53580            stack.push(a + b);
53581            break;
53582
53583          case 'and':
53584            b = stack.pop();
53585            a = stack.pop();
53586
53587            if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
53588              stack.push(a && b);
53589            } else {
53590              stack.push(a & b);
53591            }
53592
53593            break;
53594
53595          case 'atan':
53596            a = stack.pop();
53597            stack.push(Math.atan(a));
53598            break;
53599
53600          case 'bitshift':
53601            b = stack.pop();
53602            a = stack.pop();
53603
53604            if (a > 0) {
53605              stack.push(a << b);
53606            } else {
53607              stack.push(a >> b);
53608            }
53609
53610            break;
53611
53612          case 'ceiling':
53613            a = stack.pop();
53614            stack.push(Math.ceil(a));
53615            break;
53616
53617          case 'copy':
53618            a = stack.pop();
53619            stack.copy(a);
53620            break;
53621
53622          case 'cos':
53623            a = stack.pop();
53624            stack.push(Math.cos(a));
53625            break;
53626
53627          case 'cvi':
53628            a = stack.pop() | 0;
53629            stack.push(a);
53630            break;
53631
53632          case 'cvr':
53633            break;
53634
53635          case 'div':
53636            b = stack.pop();
53637            a = stack.pop();
53638            stack.push(a / b);
53639            break;
53640
53641          case 'dup':
53642            stack.copy(1);
53643            break;
53644
53645          case 'eq':
53646            b = stack.pop();
53647            a = stack.pop();
53648            stack.push(a === b);
53649            break;
53650
53651          case 'exch':
53652            stack.roll(2, 1);
53653            break;
53654
53655          case 'exp':
53656            b = stack.pop();
53657            a = stack.pop();
53658            stack.push(Math.pow(a, b));
53659            break;
53660
53661          case 'false':
53662            stack.push(false);
53663            break;
53664
53665          case 'floor':
53666            a = stack.pop();
53667            stack.push(Math.floor(a));
53668            break;
53669
53670          case 'ge':
53671            b = stack.pop();
53672            a = stack.pop();
53673            stack.push(a >= b);
53674            break;
53675
53676          case 'gt':
53677            b = stack.pop();
53678            a = stack.pop();
53679            stack.push(a > b);
53680            break;
53681
53682          case 'idiv':
53683            b = stack.pop();
53684            a = stack.pop();
53685            stack.push(a / b | 0);
53686            break;
53687
53688          case 'index':
53689            a = stack.pop();
53690            stack.index(a);
53691            break;
53692
53693          case 'le':
53694            b = stack.pop();
53695            a = stack.pop();
53696            stack.push(a <= b);
53697            break;
53698
53699          case 'ln':
53700            a = stack.pop();
53701            stack.push(Math.log(a));
53702            break;
53703
53704          case 'log':
53705            a = stack.pop();
53706            stack.push(Math.log(a) / Math.LN10);
53707            break;
53708
53709          case 'lt':
53710            b = stack.pop();
53711            a = stack.pop();
53712            stack.push(a < b);
53713            break;
53714
53715          case 'mod':
53716            b = stack.pop();
53717            a = stack.pop();
53718            stack.push(a % b);
53719            break;
53720
53721          case 'mul':
53722            b = stack.pop();
53723            a = stack.pop();
53724            stack.push(a * b);
53725            break;
53726
53727          case 'ne':
53728            b = stack.pop();
53729            a = stack.pop();
53730            stack.push(a !== b);
53731            break;
53732
53733          case 'neg':
53734            a = stack.pop();
53735            stack.push(-a);
53736            break;
53737
53738          case 'not':
53739            a = stack.pop();
53740
53741            if ((0, _util.isBool)(a)) {
53742              stack.push(!a);
53743            } else {
53744              stack.push(~a);
53745            }
53746
53747            break;
53748
53749          case 'or':
53750            b = stack.pop();
53751            a = stack.pop();
53752
53753            if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
53754              stack.push(a || b);
53755            } else {
53756              stack.push(a | b);
53757            }
53758
53759            break;
53760
53761          case 'pop':
53762            stack.pop();
53763            break;
53764
53765          case 'roll':
53766            b = stack.pop();
53767            a = stack.pop();
53768            stack.roll(a, b);
53769            break;
53770
53771          case 'round':
53772            a = stack.pop();
53773            stack.push(Math.round(a));
53774            break;
53775
53776          case 'sin':
53777            a = stack.pop();
53778            stack.push(Math.sin(a));
53779            break;
53780
53781          case 'sqrt':
53782            a = stack.pop();
53783            stack.push(Math.sqrt(a));
53784            break;
53785
53786          case 'sub':
53787            b = stack.pop();
53788            a = stack.pop();
53789            stack.push(a - b);
53790            break;
53791
53792          case 'true':
53793            stack.push(true);
53794            break;
53795
53796          case 'truncate':
53797            a = stack.pop();
53798            a = a < 0 ? Math.ceil(a) : Math.floor(a);
53799            stack.push(a);
53800            break;
53801
53802          case 'xor':
53803            b = stack.pop();
53804            a = stack.pop();
53805
53806            if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
53807              stack.push(a !== b);
53808            } else {
53809              stack.push(a ^ b);
53810            }
53811
53812            break;
53813
53814          default:
53815            throw new _util.FormatError("Unknown operator ".concat(operator));
53816        }
53817      }
53818
53819      return stack.stack;
53820    }
53821  };
53822  return PostScriptEvaluator;
53823}();
53824
53825exports.PostScriptEvaluator = PostScriptEvaluator;
53826
53827var PostScriptCompiler = function PostScriptCompilerClosure() {
53828  function AstNode(type) {
53829    this.type = type;
53830  }
53831
53832  AstNode.prototype.visit = function (visitor) {
53833    (0, _util.unreachable)('abstract method');
53834  };
53835
53836  function AstArgument(index, min, max) {
53837    AstNode.call(this, 'args');
53838    this.index = index;
53839    this.min = min;
53840    this.max = max;
53841  }
53842
53843  AstArgument.prototype = Object.create(AstNode.prototype);
53844
53845  AstArgument.prototype.visit = function (visitor) {
53846    visitor.visitArgument(this);
53847  };
53848
53849  function AstLiteral(number) {
53850    AstNode.call(this, 'literal');
53851    this.number = number;
53852    this.min = number;
53853    this.max = number;
53854  }
53855
53856  AstLiteral.prototype = Object.create(AstNode.prototype);
53857
53858  AstLiteral.prototype.visit = function (visitor) {
53859    visitor.visitLiteral(this);
53860  };
53861
53862  function AstBinaryOperation(op, arg1, arg2, min, max) {
53863    AstNode.call(this, 'binary');
53864    this.op = op;
53865    this.arg1 = arg1;
53866    this.arg2 = arg2;
53867    this.min = min;
53868    this.max = max;
53869  }
53870
53871  AstBinaryOperation.prototype = Object.create(AstNode.prototype);
53872
53873  AstBinaryOperation.prototype.visit = function (visitor) {
53874    visitor.visitBinaryOperation(this);
53875  };
53876
53877  function AstMin(arg, max) {
53878    AstNode.call(this, 'max');
53879    this.arg = arg;
53880    this.min = arg.min;
53881    this.max = max;
53882  }
53883
53884  AstMin.prototype = Object.create(AstNode.prototype);
53885
53886  AstMin.prototype.visit = function (visitor) {
53887    visitor.visitMin(this);
53888  };
53889
53890  function AstVariable(index, min, max) {
53891    AstNode.call(this, 'var');
53892    this.index = index;
53893    this.min = min;
53894    this.max = max;
53895  }
53896
53897  AstVariable.prototype = Object.create(AstNode.prototype);
53898
53899  AstVariable.prototype.visit = function (visitor) {
53900    visitor.visitVariable(this);
53901  };
53902
53903  function AstVariableDefinition(variable, arg) {
53904    AstNode.call(this, 'definition');
53905    this.variable = variable;
53906    this.arg = arg;
53907  }
53908
53909  AstVariableDefinition.prototype = Object.create(AstNode.prototype);
53910
53911  AstVariableDefinition.prototype.visit = function (visitor) {
53912    visitor.visitVariableDefinition(this);
53913  };
53914
53915  function ExpressionBuilderVisitor() {
53916    this.parts = [];
53917  }
53918
53919  ExpressionBuilderVisitor.prototype = {
53920    visitArgument: function visitArgument(arg) {
53921      this.parts.push('Math.max(', arg.min, ', Math.min(', arg.max, ', src[srcOffset + ', arg.index, ']))');
53922    },
53923    visitVariable: function visitVariable(variable) {
53924      this.parts.push('v', variable.index);
53925    },
53926    visitLiteral: function visitLiteral(literal) {
53927      this.parts.push(literal.number);
53928    },
53929    visitBinaryOperation: function visitBinaryOperation(operation) {
53930      this.parts.push('(');
53931      operation.arg1.visit(this);
53932      this.parts.push(' ', operation.op, ' ');
53933      operation.arg2.visit(this);
53934      this.parts.push(')');
53935    },
53936    visitVariableDefinition: function visitVariableDefinition(definition) {
53937      this.parts.push('var ');
53938      definition.variable.visit(this);
53939      this.parts.push(' = ');
53940      definition.arg.visit(this);
53941      this.parts.push(';');
53942    },
53943    visitMin: function visitMin(max) {
53944      this.parts.push('Math.min(');
53945      max.arg.visit(this);
53946      this.parts.push(', ', max.max, ')');
53947    },
53948    toString: function toString() {
53949      return this.parts.join('');
53950    }
53951  };
53952
53953  function buildAddOperation(num1, num2) {
53954    if (num2.type === 'literal' && num2.number === 0) {
53955      return num1;
53956    }
53957
53958    if (num1.type === 'literal' && num1.number === 0) {
53959      return num2;
53960    }
53961
53962    if (num2.type === 'literal' && num1.type === 'literal') {
53963      return new AstLiteral(num1.number + num2.number);
53964    }
53965
53966    return new AstBinaryOperation('+', num1, num2, num1.min + num2.min, num1.max + num2.max);
53967  }
53968
53969  function buildMulOperation(num1, num2) {
53970    if (num2.type === 'literal') {
53971      if (num2.number === 0) {
53972        return new AstLiteral(0);
53973      } else if (num2.number === 1) {
53974        return num1;
53975      } else if (num1.type === 'literal') {
53976        return new AstLiteral(num1.number * num2.number);
53977      }
53978    }
53979
53980    if (num1.type === 'literal') {
53981      if (num1.number === 0) {
53982        return new AstLiteral(0);
53983      } else if (num1.number === 1) {
53984        return num2;
53985      }
53986    }
53987
53988    var min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
53989    var max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
53990    return new AstBinaryOperation('*', num1, num2, min, max);
53991  }
53992
53993  function buildSubOperation(num1, num2) {
53994    if (num2.type === 'literal') {
53995      if (num2.number === 0) {
53996        return num1;
53997      } else if (num1.type === 'literal') {
53998        return new AstLiteral(num1.number - num2.number);
53999      }
54000    }
54001
54002    if (num2.type === 'binary' && num2.op === '-' && num1.type === 'literal' && num1.number === 1 && num2.arg1.type === 'literal' && num2.arg1.number === 1) {
54003      return num2.arg2;
54004    }
54005
54006    return new AstBinaryOperation('-', num1, num2, num1.min - num2.max, num1.max - num2.min);
54007  }
54008
54009  function buildMinOperation(num1, max) {
54010    if (num1.min >= max) {
54011      return new AstLiteral(max);
54012    } else if (num1.max <= max) {
54013      return num1;
54014    }
54015
54016    return new AstMin(num1, max);
54017  }
54018
54019  function PostScriptCompiler() {}
54020
54021  PostScriptCompiler.prototype = {
54022    compile: function PostScriptCompiler_compile(code, domain, range) {
54023      var stack = [];
54024      var i, ii;
54025      var instructions = [];
54026      var inputSize = domain.length >> 1,
54027          outputSize = range.length >> 1;
54028      var lastRegister = 0;
54029      var n, j;
54030      var num1, num2, ast1, ast2, tmpVar, item;
54031
54032      for (i = 0; i < inputSize; i++) {
54033        stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
54034      }
54035
54036      for (i = 0, ii = code.length; i < ii; i++) {
54037        item = code[i];
54038
54039        if (typeof item === 'number') {
54040          stack.push(new AstLiteral(item));
54041          continue;
54042        }
54043
54044        switch (item) {
54045          case 'add':
54046            if (stack.length < 2) {
54047              return null;
54048            }
54049
54050            num2 = stack.pop();
54051            num1 = stack.pop();
54052            stack.push(buildAddOperation(num1, num2));
54053            break;
54054
54055          case 'cvr':
54056            if (stack.length < 1) {
54057              return null;
54058            }
54059
54060            break;
54061
54062          case 'mul':
54063            if (stack.length < 2) {
54064              return null;
54065            }
54066
54067            num2 = stack.pop();
54068            num1 = stack.pop();
54069            stack.push(buildMulOperation(num1, num2));
54070            break;
54071
54072          case 'sub':
54073            if (stack.length < 2) {
54074              return null;
54075            }
54076
54077            num2 = stack.pop();
54078            num1 = stack.pop();
54079            stack.push(buildSubOperation(num1, num2));
54080            break;
54081
54082          case 'exch':
54083            if (stack.length < 2) {
54084              return null;
54085            }
54086
54087            ast1 = stack.pop();
54088            ast2 = stack.pop();
54089            stack.push(ast1, ast2);
54090            break;
54091
54092          case 'pop':
54093            if (stack.length < 1) {
54094              return null;
54095            }
54096
54097            stack.pop();
54098            break;
54099
54100          case 'index':
54101            if (stack.length < 1) {
54102              return null;
54103            }
54104
54105            num1 = stack.pop();
54106
54107            if (num1.type !== 'literal') {
54108              return null;
54109            }
54110
54111            n = num1.number;
54112
54113            if (n < 0 || !Number.isInteger(n) || stack.length < n) {
54114              return null;
54115            }
54116
54117            ast1 = stack[stack.length - n - 1];
54118
54119            if (ast1.type === 'literal' || ast1.type === 'var') {
54120              stack.push(ast1);
54121              break;
54122            }
54123
54124            tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
54125            stack[stack.length - n - 1] = tmpVar;
54126            stack.push(tmpVar);
54127            instructions.push(new AstVariableDefinition(tmpVar, ast1));
54128            break;
54129
54130          case 'dup':
54131            if (stack.length < 1) {
54132              return null;
54133            }
54134
54135            if (typeof code[i + 1] === 'number' && code[i + 2] === 'gt' && code[i + 3] === i + 7 && code[i + 4] === 'jz' && code[i + 5] === 'pop' && code[i + 6] === code[i + 1]) {
54136              num1 = stack.pop();
54137              stack.push(buildMinOperation(num1, code[i + 1]));
54138              i += 6;
54139              break;
54140            }
54141
54142            ast1 = stack[stack.length - 1];
54143
54144            if (ast1.type === 'literal' || ast1.type === 'var') {
54145              stack.push(ast1);
54146              break;
54147            }
54148
54149            tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
54150            stack[stack.length - 1] = tmpVar;
54151            stack.push(tmpVar);
54152            instructions.push(new AstVariableDefinition(tmpVar, ast1));
54153            break;
54154
54155          case 'roll':
54156            if (stack.length < 2) {
54157              return null;
54158            }
54159
54160            num2 = stack.pop();
54161            num1 = stack.pop();
54162
54163            if (num2.type !== 'literal' || num1.type !== 'literal') {
54164              return null;
54165            }
54166
54167            j = num2.number;
54168            n = num1.number;
54169
54170            if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) {
54171              return null;
54172            }
54173
54174            j = (j % n + n) % n;
54175
54176            if (j === 0) {
54177              break;
54178            }
54179
54180            Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j));
54181            break;
54182
54183          default:
54184            return null;
54185        }
54186      }
54187
54188      if (stack.length !== outputSize) {
54189        return null;
54190      }
54191
54192      var result = [];
54193      instructions.forEach(function (instruction) {
54194        var statementBuilder = new ExpressionBuilderVisitor();
54195        instruction.visit(statementBuilder);
54196        result.push(statementBuilder.toString());
54197      });
54198      stack.forEach(function (expr, i) {
54199        var statementBuilder = new ExpressionBuilderVisitor();
54200        expr.visit(statementBuilder);
54201        var min = range[i * 2],
54202            max = range[i * 2 + 1];
54203        var out = [statementBuilder.toString()];
54204
54205        if (min > expr.min) {
54206          out.unshift('Math.max(', min, ', ');
54207          out.push(')');
54208        }
54209
54210        if (max < expr.max) {
54211          out.unshift('Math.min(', max, ', ');
54212          out.push(')');
54213        }
54214
54215        out.unshift('dest[destOffset + ', i, '] = ');
54216        out.push(';');
54217        result.push(out.join(''));
54218      });
54219      return result.join('\n');
54220    }
54221  };
54222  return PostScriptCompiler;
54223}();
54224
54225exports.PostScriptCompiler = PostScriptCompiler;
54226
54227/***/ }),
54228/* 187 */
54229/***/ (function(module, exports, __w_pdfjs_require__) {
54230
54231"use strict";
54232
54233
54234Object.defineProperty(exports, "__esModule", {
54235  value: true
54236});
54237exports.PostScriptParser = exports.PostScriptLexer = void 0;
54238
54239var _util = __w_pdfjs_require__(5);
54240
54241var _primitives = __w_pdfjs_require__(151);
54242
54243function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
54244
54245function _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); } }
54246
54247function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
54248
54249var PostScriptParser =
54250/*#__PURE__*/
54251function () {
54252  function PostScriptParser(lexer) {
54253    _classCallCheck(this, PostScriptParser);
54254
54255    this.lexer = lexer;
54256    this.operators = [];
54257    this.token = null;
54258    this.prev = null;
54259  }
54260
54261  _createClass(PostScriptParser, [{
54262    key: "nextToken",
54263    value: function nextToken() {
54264      this.prev = this.token;
54265      this.token = this.lexer.getToken();
54266    }
54267  }, {
54268    key: "accept",
54269    value: function accept(type) {
54270      if (this.token.type === type) {
54271        this.nextToken();
54272        return true;
54273      }
54274
54275      return false;
54276    }
54277  }, {
54278    key: "expect",
54279    value: function expect(type) {
54280      if (this.accept(type)) {
54281        return true;
54282      }
54283
54284      throw new _util.FormatError("Unexpected symbol: found ".concat(this.token.type, " expected ").concat(type, "."));
54285    }
54286  }, {
54287    key: "parse",
54288    value: function parse() {
54289      this.nextToken();
54290      this.expect(PostScriptTokenTypes.LBRACE);
54291      this.parseBlock();
54292      this.expect(PostScriptTokenTypes.RBRACE);
54293      return this.operators;
54294    }
54295  }, {
54296    key: "parseBlock",
54297    value: function parseBlock() {
54298      while (true) {
54299        if (this.accept(PostScriptTokenTypes.NUMBER)) {
54300          this.operators.push(this.prev.value);
54301        } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
54302          this.operators.push(this.prev.value);
54303        } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
54304          this.parseCondition();
54305        } else {
54306          return;
54307        }
54308      }
54309    }
54310  }, {
54311    key: "parseCondition",
54312    value: function parseCondition() {
54313      var conditionLocation = this.operators.length;
54314      this.operators.push(null, null);
54315      this.parseBlock();
54316      this.expect(PostScriptTokenTypes.RBRACE);
54317
54318      if (this.accept(PostScriptTokenTypes.IF)) {
54319        this.operators[conditionLocation] = this.operators.length;
54320        this.operators[conditionLocation + 1] = 'jz';
54321      } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
54322        var jumpLocation = this.operators.length;
54323        this.operators.push(null, null);
54324        var endOfTrue = this.operators.length;
54325        this.parseBlock();
54326        this.expect(PostScriptTokenTypes.RBRACE);
54327        this.expect(PostScriptTokenTypes.IFELSE);
54328        this.operators[jumpLocation] = this.operators.length;
54329        this.operators[jumpLocation + 1] = 'j';
54330        this.operators[conditionLocation] = endOfTrue;
54331        this.operators[conditionLocation + 1] = 'jz';
54332      } else {
54333        throw new _util.FormatError('PS Function: error parsing conditional.');
54334      }
54335    }
54336  }]);
54337
54338  return PostScriptParser;
54339}();
54340
54341exports.PostScriptParser = PostScriptParser;
54342var PostScriptTokenTypes = {
54343  LBRACE: 0,
54344  RBRACE: 1,
54345  NUMBER: 2,
54346  OPERATOR: 3,
54347  IF: 4,
54348  IFELSE: 5
54349};
54350
54351var PostScriptToken = function PostScriptTokenClosure() {
54352  var opCache = Object.create(null);
54353
54354  var PostScriptToken =
54355  /*#__PURE__*/
54356  function () {
54357    function PostScriptToken(type, value) {
54358      _classCallCheck(this, PostScriptToken);
54359
54360      this.type = type;
54361      this.value = value;
54362    }
54363
54364    _createClass(PostScriptToken, null, [{
54365      key: "getOperator",
54366      value: function getOperator(op) {
54367        var opValue = opCache[op];
54368
54369        if (opValue) {
54370          return opValue;
54371        }
54372
54373        return opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
54374      }
54375    }, {
54376      key: "LBRACE",
54377      get: function get() {
54378        return (0, _util.shadow)(this, 'LBRACE', new PostScriptToken(PostScriptTokenTypes.LBRACE, '{'));
54379      }
54380    }, {
54381      key: "RBRACE",
54382      get: function get() {
54383        return (0, _util.shadow)(this, 'RBRACE', new PostScriptToken(PostScriptTokenTypes.RBRACE, '}'));
54384      }
54385    }, {
54386      key: "IF",
54387      get: function get() {
54388        return (0, _util.shadow)(this, 'IF', new PostScriptToken(PostScriptTokenTypes.IF, 'IF'));
54389      }
54390    }, {
54391      key: "IFELSE",
54392      get: function get() {
54393        return (0, _util.shadow)(this, 'IFELSE', new PostScriptToken(PostScriptTokenTypes.IFELSE, 'IFELSE'));
54394      }
54395    }]);
54396
54397    return PostScriptToken;
54398  }();
54399
54400  return PostScriptToken;
54401}();
54402
54403var PostScriptLexer =
54404/*#__PURE__*/
54405function () {
54406  function PostScriptLexer(stream) {
54407    _classCallCheck(this, PostScriptLexer);
54408
54409    this.stream = stream;
54410    this.nextChar();
54411    this.strBuf = [];
54412  }
54413
54414  _createClass(PostScriptLexer, [{
54415    key: "nextChar",
54416    value: function nextChar() {
54417      return this.currentChar = this.stream.getByte();
54418    }
54419  }, {
54420    key: "getToken",
54421    value: function getToken() {
54422      var comment = false;
54423      var ch = this.currentChar;
54424
54425      while (true) {
54426        if (ch < 0) {
54427          return _primitives.EOF;
54428        }
54429
54430        if (comment) {
54431          if (ch === 0x0A || ch === 0x0D) {
54432            comment = false;
54433          }
54434        } else if (ch === 0x25) {
54435          comment = true;
54436        } else if (!(0, _util.isSpace)(ch)) {
54437          break;
54438        }
54439
54440        ch = this.nextChar();
54441      }
54442
54443      switch (ch | 0) {
54444        case 0x30:
54445        case 0x31:
54446        case 0x32:
54447        case 0x33:
54448        case 0x34:
54449        case 0x35:
54450        case 0x36:
54451        case 0x37:
54452        case 0x38:
54453        case 0x39:
54454        case 0x2B:
54455        case 0x2D:
54456        case 0x2E:
54457          return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
54458
54459        case 0x7B:
54460          this.nextChar();
54461          return PostScriptToken.LBRACE;
54462
54463        case 0x7D:
54464          this.nextChar();
54465          return PostScriptToken.RBRACE;
54466      }
54467
54468      var strBuf = this.strBuf;
54469      strBuf.length = 0;
54470      strBuf[0] = String.fromCharCode(ch);
54471
54472      while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5A || ch >= 0x61 && ch <= 0x7A)) {
54473        strBuf.push(String.fromCharCode(ch));
54474      }
54475
54476      var str = strBuf.join('');
54477
54478      switch (str.toLowerCase()) {
54479        case 'if':
54480          return PostScriptToken.IF;
54481
54482        case 'ifelse':
54483          return PostScriptToken.IFELSE;
54484
54485        default:
54486          return PostScriptToken.getOperator(str);
54487      }
54488    }
54489  }, {
54490    key: "getNumber",
54491    value: function getNumber() {
54492      var ch = this.currentChar;
54493      var strBuf = this.strBuf;
54494      strBuf.length = 0;
54495      strBuf[0] = String.fromCharCode(ch);
54496
54497      while ((ch = this.nextChar()) >= 0) {
54498        if (ch >= 0x30 && ch <= 0x39 || ch === 0x2D || ch === 0x2E) {
54499          strBuf.push(String.fromCharCode(ch));
54500        } else {
54501          break;
54502        }
54503      }
54504
54505      var value = parseFloat(strBuf.join(''));
54506
54507      if (isNaN(value)) {
54508        throw new _util.FormatError("Invalid floating point number: ".concat(value));
54509      }
54510
54511      return value;
54512    }
54513  }]);
54514
54515  return PostScriptLexer;
54516}();
54517
54518exports.PostScriptLexer = PostScriptLexer;
54519
54520/***/ }),
54521/* 188 */
54522/***/ (function(module, exports, __w_pdfjs_require__) {
54523
54524"use strict";
54525
54526
54527Object.defineProperty(exports, "__esModule", {
54528  value: true
54529});
54530exports.MurmurHash3_64 = void 0;
54531
54532var _util = __w_pdfjs_require__(5);
54533
54534function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
54535
54536function _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); } }
54537
54538function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
54539
54540var SEED = 0xc3d2e1f0;
54541var MASK_HIGH = 0xffff0000;
54542var MASK_LOW = 0xffff;
54543
54544var MurmurHash3_64 =
54545/*#__PURE__*/
54546function () {
54547  function MurmurHash3_64(seed) {
54548    _classCallCheck(this, MurmurHash3_64);
54549
54550    this.h1 = seed ? seed & 0xffffffff : SEED;
54551    this.h2 = seed ? seed & 0xffffffff : SEED;
54552  }
54553
54554  _createClass(MurmurHash3_64, [{
54555    key: "update",
54556    value: function update(input) {
54557      var data, length;
54558
54559      if ((0, _util.isString)(input)) {
54560        data = new Uint8Array(input.length * 2);
54561        length = 0;
54562
54563        for (var i = 0, ii = input.length; i < ii; i++) {
54564          var code = input.charCodeAt(i);
54565
54566          if (code <= 0xff) {
54567            data[length++] = code;
54568          } else {
54569            data[length++] = code >>> 8;
54570            data[length++] = code & 0xff;
54571          }
54572        }
54573      } else if ((0, _util.isArrayBuffer)(input)) {
54574        data = input;
54575        length = data.byteLength;
54576      } else {
54577        throw new Error('Wrong data format in MurmurHash3_64_update. ' + 'Input must be a string or array.');
54578      }
54579
54580      var blockCounts = length >> 2;
54581      var tailLength = length - blockCounts * 4;
54582      var dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
54583      var k1 = 0,
54584          k2 = 0;
54585      var h1 = this.h1,
54586          h2 = this.h2;
54587      var C1 = 0xcc9e2d51,
54588          C2 = 0x1b873593;
54589      var C1_LOW = C1 & MASK_LOW,
54590          C2_LOW = C2 & MASK_LOW;
54591
54592      for (var _i = 0; _i < blockCounts; _i++) {
54593        if (_i & 1) {
54594          k1 = dataUint32[_i];
54595          k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
54596          k1 = k1 << 15 | k1 >>> 17;
54597          k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
54598          h1 ^= k1;
54599          h1 = h1 << 13 | h1 >>> 19;
54600          h1 = h1 * 5 + 0xe6546b64;
54601        } else {
54602          k2 = dataUint32[_i];
54603          k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
54604          k2 = k2 << 15 | k2 >>> 17;
54605          k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
54606          h2 ^= k2;
54607          h2 = h2 << 13 | h2 >>> 19;
54608          h2 = h2 * 5 + 0xe6546b64;
54609        }
54610      }
54611
54612      k1 = 0;
54613
54614      switch (tailLength) {
54615        case 3:
54616          k1 ^= data[blockCounts * 4 + 2] << 16;
54617
54618        case 2:
54619          k1 ^= data[blockCounts * 4 + 1] << 8;
54620
54621        case 1:
54622          k1 ^= data[blockCounts * 4];
54623          k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
54624          k1 = k1 << 15 | k1 >>> 17;
54625          k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
54626
54627          if (blockCounts & 1) {
54628            h1 ^= k1;
54629          } else {
54630            h2 ^= k1;
54631          }
54632
54633      }
54634
54635      this.h1 = h1;
54636      this.h2 = h2;
54637    }
54638  }, {
54639    key: "hexdigest",
54640    value: function hexdigest() {
54641      var h1 = this.h1,
54642          h2 = this.h2;
54643      h1 ^= h2 >>> 1;
54644      h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
54645      h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
54646      h1 ^= h2 >>> 1;
54647      h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
54648      h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
54649      h1 ^= h2 >>> 1;
54650      var hex1 = (h1 >>> 0).toString(16),
54651          hex2 = (h2 >>> 0).toString(16);
54652      return hex1.padStart(8, '0') + hex2.padStart(8, '0');
54653    }
54654  }]);
54655
54656  return MurmurHash3_64;
54657}();
54658
54659exports.MurmurHash3_64 = MurmurHash3_64;
54660
54661/***/ }),
54662/* 189 */
54663/***/ (function(module, exports, __w_pdfjs_require__) {
54664
54665"use strict";
54666
54667
54668Object.defineProperty(exports, "__esModule", {
54669  value: true
54670});
54671exports.NativeImageDecoder = void 0;
54672
54673var _colorspace = __w_pdfjs_require__(169);
54674
54675var _jpeg_stream = __w_pdfjs_require__(164);
54676
54677var _stream = __w_pdfjs_require__(158);
54678
54679function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
54680
54681function _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); } }
54682
54683function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
54684
54685var NativeImageDecoder =
54686/*#__PURE__*/
54687function () {
54688  function NativeImageDecoder(_ref) {
54689    var xref = _ref.xref,
54690        resources = _ref.resources,
54691        handler = _ref.handler,
54692        _ref$forceDataSchema = _ref.forceDataSchema,
54693        forceDataSchema = _ref$forceDataSchema === void 0 ? false : _ref$forceDataSchema,
54694        pdfFunctionFactory = _ref.pdfFunctionFactory;
54695
54696    _classCallCheck(this, NativeImageDecoder);
54697
54698    this.xref = xref;
54699    this.resources = resources;
54700    this.handler = handler;
54701    this.forceDataSchema = forceDataSchema;
54702    this.pdfFunctionFactory = pdfFunctionFactory;
54703  }
54704
54705  _createClass(NativeImageDecoder, [{
54706    key: "canDecode",
54707    value: function canDecode(image) {
54708      return image instanceof _jpeg_stream.JpegStream && NativeImageDecoder.isDecodable(image, this.xref, this.resources, this.pdfFunctionFactory);
54709    }
54710  }, {
54711    key: "decode",
54712    value: function decode(image) {
54713      var dict = image.dict;
54714      var colorSpace = dict.get('ColorSpace', 'CS');
54715      colorSpace = _colorspace.ColorSpace.parse(colorSpace, this.xref, this.resources, this.pdfFunctionFactory);
54716      return this.handler.sendWithPromise('JpegDecode', [image.getIR(this.forceDataSchema), colorSpace.numComps]).then(function (_ref2) {
54717        var data = _ref2.data,
54718            width = _ref2.width,
54719            height = _ref2.height;
54720        return new _stream.Stream(data, 0, data.length, dict);
54721      });
54722    }
54723  }], [{
54724    key: "isSupported",
54725    value: function isSupported(image, xref, res, pdfFunctionFactory) {
54726      var dict = image.dict;
54727
54728      if (dict.has('DecodeParms') || dict.has('DP')) {
54729        return false;
54730      }
54731
54732      var cs = _colorspace.ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res, pdfFunctionFactory);
54733
54734      return (cs.name === 'DeviceGray' || cs.name === 'DeviceRGB') && cs.isDefaultDecode(dict.getArray('Decode', 'D'));
54735    }
54736  }, {
54737    key: "isDecodable",
54738    value: function isDecodable(image, xref, res, pdfFunctionFactory) {
54739      var dict = image.dict;
54740
54741      if (dict.has('DecodeParms') || dict.has('DP')) {
54742        return false;
54743      }
54744
54745      var cs = _colorspace.ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res, pdfFunctionFactory);
54746
54747      var bpc = dict.get('BitsPerComponent', 'BPC') || 1;
54748      return (cs.numComps === 1 || cs.numComps === 3) && cs.isDefaultDecode(dict.getArray('Decode', 'D'), bpc);
54749    }
54750  }]);
54751
54752  return NativeImageDecoder;
54753}();
54754
54755exports.NativeImageDecoder = NativeImageDecoder;
54756
54757/***/ }),
54758/* 190 */
54759/***/ (function(module, exports, __w_pdfjs_require__) {
54760
54761"use strict";
54762
54763
54764Object.defineProperty(exports, "__esModule", {
54765  value: true
54766});
54767exports.PDFImage = void 0;
54768
54769var _util = __w_pdfjs_require__(5);
54770
54771var _primitives = __w_pdfjs_require__(151);
54772
54773var _colorspace = __w_pdfjs_require__(169);
54774
54775var _stream = __w_pdfjs_require__(158);
54776
54777var _jpeg_stream = __w_pdfjs_require__(164);
54778
54779var _jpx = __w_pdfjs_require__(167);
54780
54781function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
54782
54783function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
54784
54785function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
54786
54787function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
54788
54789var PDFImage = function PDFImageClosure() {
54790  function handleImageData(image, nativeDecoder) {
54791    if (nativeDecoder && nativeDecoder.canDecode(image)) {
54792      return nativeDecoder.decode(image)["catch"](function (reason) {
54793        (0, _util.warn)('Native image decoding failed -- trying to recover: ' + (reason && reason.message));
54794        return image;
54795      });
54796    }
54797
54798    return Promise.resolve(image);
54799  }
54800
54801  function decodeAndClamp(value, addend, coefficient, max) {
54802    value = addend + value * coefficient;
54803    return value < 0 ? 0 : value > max ? max : value;
54804  }
54805
54806  function resizeImageMask(src, bpc, w1, h1, w2, h2) {
54807    var length = w2 * h2;
54808    var dest = bpc <= 8 ? new Uint8Array(length) : bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length);
54809    var xRatio = w1 / w2;
54810    var yRatio = h1 / h2;
54811    var i,
54812        j,
54813        py,
54814        newIndex = 0,
54815        oldIndex;
54816    var xScaled = new Uint16Array(w2);
54817    var w1Scanline = w1;
54818
54819    for (i = 0; i < w2; i++) {
54820      xScaled[i] = Math.floor(i * xRatio);
54821    }
54822
54823    for (i = 0; i < h2; i++) {
54824      py = Math.floor(i * yRatio) * w1Scanline;
54825
54826      for (j = 0; j < w2; j++) {
54827        oldIndex = py + xScaled[j];
54828        dest[newIndex++] = src[oldIndex];
54829      }
54830    }
54831
54832    return dest;
54833  }
54834
54835  function PDFImage(_ref) {
54836    var xref = _ref.xref,
54837        res = _ref.res,
54838        image = _ref.image,
54839        _ref$isInline = _ref.isInline,
54840        isInline = _ref$isInline === void 0 ? false : _ref$isInline,
54841        _ref$smask = _ref.smask,
54842        smask = _ref$smask === void 0 ? null : _ref$smask,
54843        _ref$mask = _ref.mask,
54844        mask = _ref$mask === void 0 ? null : _ref$mask,
54845        _ref$isMask = _ref.isMask,
54846        isMask = _ref$isMask === void 0 ? false : _ref$isMask,
54847        pdfFunctionFactory = _ref.pdfFunctionFactory;
54848    this.image = image;
54849    var dict = image.dict;
54850    var filter = dict.get('Filter');
54851
54852    if ((0, _primitives.isName)(filter)) {
54853      switch (filter.name) {
54854        case 'JPXDecode':
54855          var jpxImage = new _jpx.JpxImage();
54856          jpxImage.parseImageProperties(image.stream);
54857          image.stream.reset();
54858          image.width = jpxImage.width;
54859          image.height = jpxImage.height;
54860          image.bitsPerComponent = jpxImage.bitsPerComponent;
54861          image.numComps = jpxImage.componentsCount;
54862          break;
54863
54864        case 'JBIG2Decode':
54865          image.bitsPerComponent = 1;
54866          image.numComps = 1;
54867          break;
54868      }
54869    }
54870
54871    var width = dict.get('Width', 'W');
54872    var height = dict.get('Height', 'H');
54873
54874    if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) {
54875      (0, _util.warn)('PDFImage - using the Width/Height of the image data, ' + 'rather than the image dictionary.');
54876      width = image.width;
54877      height = image.height;
54878    }
54879
54880    if (width < 1 || height < 1) {
54881      throw new _util.FormatError("Invalid image width: ".concat(width, " or ") + "height: ".concat(height));
54882    }
54883
54884    this.width = width;
54885    this.height = height;
54886    this.interpolate = dict.get('Interpolate', 'I') || false;
54887    this.imageMask = dict.get('ImageMask', 'IM') || false;
54888    this.matte = dict.get('Matte') || false;
54889    var bitsPerComponent = image.bitsPerComponent;
54890
54891    if (!bitsPerComponent) {
54892      bitsPerComponent = dict.get('BitsPerComponent', 'BPC');
54893
54894      if (!bitsPerComponent) {
54895        if (this.imageMask) {
54896          bitsPerComponent = 1;
54897        } else {
54898          throw new _util.FormatError("Bits per component missing in image: ".concat(this.imageMask));
54899        }
54900      }
54901    }
54902
54903    this.bpc = bitsPerComponent;
54904
54905    if (!this.imageMask) {
54906      var colorSpace = dict.get('ColorSpace', 'CS');
54907
54908      if (!colorSpace) {
54909        (0, _util.info)('JPX images (which do not require color spaces)');
54910
54911        switch (image.numComps) {
54912          case 1:
54913            colorSpace = _primitives.Name.get('DeviceGray');
54914            break;
54915
54916          case 3:
54917            colorSpace = _primitives.Name.get('DeviceRGB');
54918            break;
54919
54920          case 4:
54921            colorSpace = _primitives.Name.get('DeviceCMYK');
54922            break;
54923
54924          default:
54925            throw new Error("JPX images with ".concat(image.numComps, " ") + 'color components not supported.');
54926        }
54927      }
54928
54929      var resources = isInline ? res : null;
54930      this.colorSpace = _colorspace.ColorSpace.parse(colorSpace, xref, resources, pdfFunctionFactory);
54931      this.numComps = this.colorSpace.numComps;
54932    }
54933
54934    this.decode = dict.getArray('Decode', 'D');
54935    this.needsDecode = false;
54936
54937    if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) {
54938      this.needsDecode = true;
54939      var max = (1 << bitsPerComponent) - 1;
54940      this.decodeCoefficients = [];
54941      this.decodeAddends = [];
54942      var isIndexed = this.colorSpace && this.colorSpace.name === 'Indexed';
54943
54944      for (var i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
54945        var dmin = this.decode[i];
54946        var dmax = this.decode[i + 1];
54947        this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin;
54948        this.decodeAddends[j] = isIndexed ? dmin : max * dmin;
54949      }
54950    }
54951
54952    if (smask) {
54953      this.smask = new PDFImage({
54954        xref: xref,
54955        res: res,
54956        image: smask,
54957        isInline: isInline,
54958        pdfFunctionFactory: pdfFunctionFactory
54959      });
54960    } else if (mask) {
54961      if ((0, _primitives.isStream)(mask)) {
54962        var maskDict = mask.dict,
54963            imageMask = maskDict.get('ImageMask', 'IM');
54964
54965        if (!imageMask) {
54966          (0, _util.warn)('Ignoring /Mask in image without /ImageMask.');
54967        } else {
54968          this.mask = new PDFImage({
54969            xref: xref,
54970            res: res,
54971            image: mask,
54972            isInline: isInline,
54973            isMask: true,
54974            pdfFunctionFactory: pdfFunctionFactory
54975          });
54976        }
54977      } else {
54978        this.mask = mask;
54979      }
54980    }
54981  }
54982
54983  PDFImage.buildImage = function (_ref2) {
54984    var handler = _ref2.handler,
54985        xref = _ref2.xref,
54986        res = _ref2.res,
54987        image = _ref2.image,
54988        _ref2$isInline = _ref2.isInline,
54989        isInline = _ref2$isInline === void 0 ? false : _ref2$isInline,
54990        _ref2$nativeDecoder = _ref2.nativeDecoder,
54991        nativeDecoder = _ref2$nativeDecoder === void 0 ? null : _ref2$nativeDecoder,
54992        pdfFunctionFactory = _ref2.pdfFunctionFactory;
54993    var imagePromise = handleImageData(image, nativeDecoder);
54994    var smaskPromise;
54995    var maskPromise;
54996    var smask = image.dict.get('SMask');
54997    var mask = image.dict.get('Mask');
54998
54999    if (smask) {
55000      smaskPromise = handleImageData(smask, nativeDecoder);
55001      maskPromise = Promise.resolve(null);
55002    } else {
55003      smaskPromise = Promise.resolve(null);
55004
55005      if (mask) {
55006        if ((0, _primitives.isStream)(mask)) {
55007          maskPromise = handleImageData(mask, nativeDecoder);
55008        } else if (Array.isArray(mask)) {
55009          maskPromise = Promise.resolve(mask);
55010        } else {
55011          (0, _util.warn)('Unsupported mask format.');
55012          maskPromise = Promise.resolve(null);
55013        }
55014      } else {
55015        maskPromise = Promise.resolve(null);
55016      }
55017    }
55018
55019    return Promise.all([imagePromise, smaskPromise, maskPromise]).then(function (_ref3) {
55020      var _ref4 = _slicedToArray(_ref3, 3),
55021          imageData = _ref4[0],
55022          smaskData = _ref4[1],
55023          maskData = _ref4[2];
55024
55025      return new PDFImage({
55026        xref: xref,
55027        res: res,
55028        image: imageData,
55029        isInline: isInline,
55030        smask: smaskData,
55031        mask: maskData,
55032        pdfFunctionFactory: pdfFunctionFactory
55033      });
55034    });
55035  };
55036
55037  PDFImage.createMask = function (_ref5) {
55038    var imgArray = _ref5.imgArray,
55039        width = _ref5.width,
55040        height = _ref5.height,
55041        imageIsFromDecodeStream = _ref5.imageIsFromDecodeStream,
55042        inverseDecode = _ref5.inverseDecode;
55043    var computedLength = (width + 7 >> 3) * height;
55044    var actualLength = imgArray.byteLength;
55045    var haveFullData = computedLength === actualLength;
55046    var data, i;
55047
55048    if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
55049      data = imgArray;
55050    } else if (!inverseDecode) {
55051      data = new Uint8ClampedArray(actualLength);
55052      data.set(imgArray);
55053    } else {
55054      data = new Uint8ClampedArray(computedLength);
55055      data.set(imgArray);
55056
55057      for (i = actualLength; i < computedLength; i++) {
55058        data[i] = 0xff;
55059      }
55060    }
55061
55062    if (inverseDecode) {
55063      for (i = 0; i < actualLength; i++) {
55064        data[i] ^= 0xFF;
55065      }
55066    }
55067
55068    return {
55069      data: data,
55070      width: width,
55071      height: height
55072    };
55073  };
55074
55075  PDFImage.prototype = {
55076    get drawWidth() {
55077      return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
55078    },
55079
55080    get drawHeight() {
55081      return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
55082    },
55083
55084    decodeBuffer: function decodeBuffer(buffer) {
55085      var bpc = this.bpc;
55086      var numComps = this.numComps;
55087      var decodeAddends = this.decodeAddends;
55088      var decodeCoefficients = this.decodeCoefficients;
55089      var max = (1 << bpc) - 1;
55090      var i, ii;
55091
55092      if (bpc === 1) {
55093        for (i = 0, ii = buffer.length; i < ii; i++) {
55094          buffer[i] = +!buffer[i];
55095        }
55096
55097        return;
55098      }
55099
55100      var index = 0;
55101
55102      for (i = 0, ii = this.width * this.height; i < ii; i++) {
55103        for (var j = 0; j < numComps; j++) {
55104          buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
55105          index++;
55106        }
55107      }
55108    },
55109    getComponents: function getComponents(buffer) {
55110      var bpc = this.bpc;
55111
55112      if (bpc === 8) {
55113        return buffer;
55114      }
55115
55116      var width = this.width;
55117      var height = this.height;
55118      var numComps = this.numComps;
55119      var length = width * height * numComps;
55120      var bufferPos = 0;
55121      var output = bpc <= 8 ? new Uint8Array(length) : bpc <= 16 ? new Uint16Array(length) : new Uint32Array(length);
55122      var rowComps = width * numComps;
55123      var max = (1 << bpc) - 1;
55124      var i = 0,
55125          ii,
55126          buf;
55127
55128      if (bpc === 1) {
55129        var mask, loop1End, loop2End;
55130
55131        for (var j = 0; j < height; j++) {
55132          loop1End = i + (rowComps & ~7);
55133          loop2End = i + rowComps;
55134
55135          while (i < loop1End) {
55136            buf = buffer[bufferPos++];
55137            output[i] = buf >> 7 & 1;
55138            output[i + 1] = buf >> 6 & 1;
55139            output[i + 2] = buf >> 5 & 1;
55140            output[i + 3] = buf >> 4 & 1;
55141            output[i + 4] = buf >> 3 & 1;
55142            output[i + 5] = buf >> 2 & 1;
55143            output[i + 6] = buf >> 1 & 1;
55144            output[i + 7] = buf & 1;
55145            i += 8;
55146          }
55147
55148          if (i < loop2End) {
55149            buf = buffer[bufferPos++];
55150            mask = 128;
55151
55152            while (i < loop2End) {
55153              output[i++] = +!!(buf & mask);
55154              mask >>= 1;
55155            }
55156          }
55157        }
55158      } else {
55159        var bits = 0;
55160        buf = 0;
55161
55162        for (i = 0, ii = length; i < ii; ++i) {
55163          if (i % rowComps === 0) {
55164            buf = 0;
55165            bits = 0;
55166          }
55167
55168          while (bits < bpc) {
55169            buf = buf << 8 | buffer[bufferPos++];
55170            bits += 8;
55171          }
55172
55173          var remainingBits = bits - bpc;
55174          var value = buf >> remainingBits;
55175          output[i] = value < 0 ? 0 : value > max ? max : value;
55176          buf = buf & (1 << remainingBits) - 1;
55177          bits = remainingBits;
55178        }
55179      }
55180
55181      return output;
55182    },
55183    fillOpacity: function fillOpacity(rgbaBuf, width, height, actualHeight, image) {
55184      var smask = this.smask;
55185      var mask = this.mask;
55186      var alphaBuf, sw, sh, i, ii, j;
55187
55188      if (smask) {
55189        sw = smask.width;
55190        sh = smask.height;
55191        alphaBuf = new Uint8ClampedArray(sw * sh);
55192        smask.fillGrayBuffer(alphaBuf);
55193
55194        if (sw !== width || sh !== height) {
55195          alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
55196        }
55197      } else if (mask) {
55198        if (mask instanceof PDFImage) {
55199          sw = mask.width;
55200          sh = mask.height;
55201          alphaBuf = new Uint8ClampedArray(sw * sh);
55202          mask.numComps = 1;
55203          mask.fillGrayBuffer(alphaBuf);
55204
55205          for (i = 0, ii = sw * sh; i < ii; ++i) {
55206            alphaBuf[i] = 255 - alphaBuf[i];
55207          }
55208
55209          if (sw !== width || sh !== height) {
55210            alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
55211          }
55212        } else if (Array.isArray(mask)) {
55213          alphaBuf = new Uint8ClampedArray(width * height);
55214          var numComps = this.numComps;
55215
55216          for (i = 0, ii = width * height; i < ii; ++i) {
55217            var opacity = 0;
55218            var imageOffset = i * numComps;
55219
55220            for (j = 0; j < numComps; ++j) {
55221              var color = image[imageOffset + j];
55222              var maskOffset = j * 2;
55223
55224              if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
55225                opacity = 255;
55226                break;
55227              }
55228            }
55229
55230            alphaBuf[i] = opacity;
55231          }
55232        } else {
55233          throw new _util.FormatError('Unknown mask format.');
55234        }
55235      }
55236
55237      if (alphaBuf) {
55238        for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
55239          rgbaBuf[j] = alphaBuf[i];
55240        }
55241      } else {
55242        for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
55243          rgbaBuf[j] = 255;
55244        }
55245      }
55246    },
55247    undoPreblend: function undoPreblend(buffer, width, height) {
55248      var matte = this.smask && this.smask.matte;
55249
55250      if (!matte) {
55251        return;
55252      }
55253
55254      var matteRgb = this.colorSpace.getRgb(matte, 0);
55255      var matteR = matteRgb[0];
55256      var matteG = matteRgb[1];
55257      var matteB = matteRgb[2];
55258      var length = width * height * 4;
55259
55260      for (var i = 0; i < length; i += 4) {
55261        var alpha = buffer[i + 3];
55262
55263        if (alpha === 0) {
55264          buffer[i] = 255;
55265          buffer[i + 1] = 255;
55266          buffer[i + 2] = 255;
55267          continue;
55268        }
55269
55270        var k = 255 / alpha;
55271        buffer[i] = (buffer[i] - matteR) * k + matteR;
55272        buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG;
55273        buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB;
55274      }
55275    },
55276    createImageData: function createImageData() {
55277      var forceRGBA = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
55278      var drawWidth = this.drawWidth;
55279      var drawHeight = this.drawHeight;
55280      var imgData = {
55281        width: drawWidth,
55282        height: drawHeight,
55283        kind: 0,
55284        data: null
55285      };
55286      var numComps = this.numComps;
55287      var originalWidth = this.width;
55288      var originalHeight = this.height;
55289      var bpc = this.bpc;
55290      var rowBytes = originalWidth * numComps * bpc + 7 >> 3;
55291      var imgArray;
55292
55293      if (!forceRGBA) {
55294        var kind;
55295
55296        if (this.colorSpace.name === 'DeviceGray' && bpc === 1) {
55297          kind = _util.ImageKind.GRAYSCALE_1BPP;
55298        } else if (this.colorSpace.name === 'DeviceRGB' && bpc === 8 && !this.needsDecode) {
55299          kind = _util.ImageKind.RGB_24BPP;
55300        }
55301
55302        if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
55303          imgData.kind = kind;
55304          imgArray = this.getImageBytes(originalHeight * rowBytes);
55305
55306          if (this.image instanceof _stream.DecodeStream) {
55307            imgData.data = imgArray;
55308          } else {
55309            var newArray = new Uint8ClampedArray(imgArray.length);
55310            newArray.set(imgArray);
55311            imgData.data = newArray;
55312          }
55313
55314          if (this.needsDecode) {
55315            (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP, 'PDFImage.createImageData: The image must be grayscale.');
55316            var buffer = imgData.data;
55317
55318            for (var i = 0, ii = buffer.length; i < ii; i++) {
55319              buffer[i] ^= 0xff;
55320            }
55321          }
55322
55323          return imgData;
55324        }
55325
55326        if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask) {
55327          var imageLength = originalHeight * rowBytes;
55328
55329          switch (this.colorSpace.name) {
55330            case 'DeviceGray':
55331              imageLength *= 3;
55332
55333            case 'DeviceRGB':
55334            case 'DeviceCMYK':
55335              imgData.kind = _util.ImageKind.RGB_24BPP;
55336              imgData.data = this.getImageBytes(imageLength, drawWidth, drawHeight, true);
55337              return imgData;
55338          }
55339        }
55340      }
55341
55342      imgArray = this.getImageBytes(originalHeight * rowBytes);
55343      var actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
55344      var comps = this.getComponents(imgArray);
55345      var alpha01, maybeUndoPreblend;
55346
55347      if (!forceRGBA && !this.smask && !this.mask) {
55348        imgData.kind = _util.ImageKind.RGB_24BPP;
55349        imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 3);
55350        alpha01 = 0;
55351        maybeUndoPreblend = false;
55352      } else {
55353        imgData.kind = _util.ImageKind.RGBA_32BPP;
55354        imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 4);
55355        alpha01 = 1;
55356        maybeUndoPreblend = true;
55357        this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
55358      }
55359
55360      if (this.needsDecode) {
55361        this.decodeBuffer(comps);
55362      }
55363
55364      this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
55365
55366      if (maybeUndoPreblend) {
55367        this.undoPreblend(imgData.data, drawWidth, actualHeight);
55368      }
55369
55370      return imgData;
55371    },
55372    fillGrayBuffer: function fillGrayBuffer(buffer) {
55373      var numComps = this.numComps;
55374
55375      if (numComps !== 1) {
55376        throw new _util.FormatError("Reading gray scale from a color image: ".concat(numComps));
55377      }
55378
55379      var width = this.width;
55380      var height = this.height;
55381      var bpc = this.bpc;
55382      var rowBytes = width * numComps * bpc + 7 >> 3;
55383      var imgArray = this.getImageBytes(height * rowBytes);
55384      var comps = this.getComponents(imgArray);
55385      var i, length;
55386
55387      if (bpc === 1) {
55388        length = width * height;
55389
55390        if (this.needsDecode) {
55391          for (i = 0; i < length; ++i) {
55392            buffer[i] = comps[i] - 1 & 255;
55393          }
55394        } else {
55395          for (i = 0; i < length; ++i) {
55396            buffer[i] = -comps[i] & 255;
55397          }
55398        }
55399
55400        return;
55401      }
55402
55403      if (this.needsDecode) {
55404        this.decodeBuffer(comps);
55405      }
55406
55407      length = width * height;
55408      var scale = 255 / ((1 << bpc) - 1);
55409
55410      for (i = 0; i < length; ++i) {
55411        buffer[i] = scale * comps[i];
55412      }
55413    },
55414    getImageBytes: function getImageBytes(length, drawWidth, drawHeight) {
55415      var forceRGB = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
55416      this.image.reset();
55417      this.image.drawWidth = drawWidth || this.width;
55418      this.image.drawHeight = drawHeight || this.height;
55419      this.image.forceRGB = !!forceRGB;
55420      return this.image.getBytes(length, true);
55421    }
55422  };
55423  return PDFImage;
55424}();
55425
55426exports.PDFImage = PDFImage;
55427
55428/***/ }),
55429/* 191 */
55430/***/ (function(module, exports, __w_pdfjs_require__) {
55431
55432"use strict";
55433
55434
55435Object.defineProperty(exports, "__esModule", {
55436  value: true
55437});
55438exports.MessageHandler = MessageHandler;
55439
55440var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2));
55441
55442var _util = __w_pdfjs_require__(5);
55443
55444function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
55445
55446function _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); }
55447
55448function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
55449
55450function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
55451
55452function resolveCall(_x, _x2) {
55453  return _resolveCall.apply(this, arguments);
55454}
55455
55456function _resolveCall() {
55457  _resolveCall = _asyncToGenerator(
55458  /*#__PURE__*/
55459  _regenerator["default"].mark(function _callee(fn, args) {
55460    var thisArg,
55461        _args = arguments;
55462    return _regenerator["default"].wrap(function _callee$(_context) {
55463      while (1) {
55464        switch (_context.prev = _context.next) {
55465          case 0:
55466            thisArg = _args.length > 2 && _args[2] !== undefined ? _args[2] : null;
55467
55468            if (fn) {
55469              _context.next = 3;
55470              break;
55471            }
55472
55473            return _context.abrupt("return", undefined);
55474
55475          case 3:
55476            return _context.abrupt("return", fn.apply(thisArg, args));
55477
55478          case 4:
55479          case "end":
55480            return _context.stop();
55481        }
55482      }
55483    }, _callee);
55484  }));
55485  return _resolveCall.apply(this, arguments);
55486}
55487
55488function wrapReason(reason) {
55489  if (_typeof(reason) !== 'object') {
55490    return reason;
55491  }
55492
55493  switch (reason.name) {
55494    case 'AbortException':
55495      return new _util.AbortException(reason.message);
55496
55497    case 'MissingPDFException':
55498      return new _util.MissingPDFException(reason.message);
55499
55500    case 'UnexpectedResponseException':
55501      return new _util.UnexpectedResponseException(reason.message, reason.status);
55502
55503    default:
55504      return new _util.UnknownErrorException(reason.message, reason.details);
55505  }
55506}
55507
55508function makeReasonSerializable(reason) {
55509  if (!(reason instanceof Error) || reason instanceof _util.AbortException || reason instanceof _util.MissingPDFException || reason instanceof _util.UnexpectedResponseException || reason instanceof _util.UnknownErrorException) {
55510    return reason;
55511  }
55512
55513  return new _util.UnknownErrorException(reason.message, reason.toString());
55514}
55515
55516function resolveOrReject(capability, success, reason) {
55517  if (success) {
55518    capability.resolve();
55519  } else {
55520    capability.reject(reason);
55521  }
55522}
55523
55524function finalize(promise) {
55525  return Promise.resolve(promise)["catch"](function () {});
55526}
55527
55528function MessageHandler(sourceName, targetName, comObj) {
55529  var _this = this;
55530
55531  this.sourceName = sourceName;
55532  this.targetName = targetName;
55533  this.comObj = comObj;
55534  this.callbackId = 1;
55535  this.streamId = 1;
55536  this.postMessageTransfers = true;
55537  this.streamSinks = Object.create(null);
55538  this.streamControllers = Object.create(null);
55539  var callbacksCapabilities = this.callbacksCapabilities = Object.create(null);
55540  var ah = this.actionHandler = Object.create(null);
55541
55542  this._onComObjOnMessage = function (event) {
55543    var data = event.data;
55544
55545    if (data.targetName !== _this.sourceName) {
55546      return;
55547    }
55548
55549    if (data.stream) {
55550      _this._processStreamMessage(data);
55551    } else if (data.isReply) {
55552      var callbackId = data.callbackId;
55553
55554      if (data.callbackId in callbacksCapabilities) {
55555        var callback = callbacksCapabilities[callbackId];
55556        delete callbacksCapabilities[callbackId];
55557
55558        if ('error' in data) {
55559          callback.reject(wrapReason(data.error));
55560        } else {
55561          callback.resolve(data.data);
55562        }
55563      } else {
55564        throw new Error("Cannot resolve callback ".concat(callbackId));
55565      }
55566    } else if (data.action in ah) {
55567      var action = ah[data.action];
55568
55569      if (data.callbackId) {
55570        var _sourceName = _this.sourceName;
55571        var _targetName = data.sourceName;
55572        Promise.resolve().then(function () {
55573          return action[0].call(action[1], data.data);
55574        }).then(function (result) {
55575          comObj.postMessage({
55576            sourceName: _sourceName,
55577            targetName: _targetName,
55578            isReply: true,
55579            callbackId: data.callbackId,
55580            data: result
55581          });
55582        }, function (reason) {
55583          comObj.postMessage({
55584            sourceName: _sourceName,
55585            targetName: _targetName,
55586            isReply: true,
55587            callbackId: data.callbackId,
55588            error: makeReasonSerializable(reason)
55589          });
55590        });
55591      } else if (data.streamId) {
55592        _this._createStreamSink(data);
55593      } else {
55594        action[0].call(action[1], data.data);
55595      }
55596    } else {
55597      throw new Error("Unknown action from worker: ".concat(data.action));
55598    }
55599  };
55600
55601  comObj.addEventListener('message', this._onComObjOnMessage);
55602}
55603
55604MessageHandler.prototype = {
55605  on: function on(actionName, handler, scope) {
55606    var ah = this.actionHandler;
55607
55608    if (ah[actionName]) {
55609      throw new Error("There is already an actionName called \"".concat(actionName, "\""));
55610    }
55611
55612    ah[actionName] = [handler, scope];
55613  },
55614  send: function send(actionName, data, transfers) {
55615    var message = {
55616      sourceName: this.sourceName,
55617      targetName: this.targetName,
55618      action: actionName,
55619      data: data
55620    };
55621    this.postMessage(message, transfers);
55622  },
55623  sendWithPromise: function sendWithPromise(actionName, data, transfers) {
55624    var callbackId = this.callbackId++;
55625    var message = {
55626      sourceName: this.sourceName,
55627      targetName: this.targetName,
55628      action: actionName,
55629      data: data,
55630      callbackId: callbackId
55631    };
55632    var capability = (0, _util.createPromiseCapability)();
55633    this.callbacksCapabilities[callbackId] = capability;
55634
55635    try {
55636      this.postMessage(message, transfers);
55637    } catch (e) {
55638      capability.reject(e);
55639    }
55640
55641    return capability.promise;
55642  },
55643  sendWithStream: function sendWithStream(actionName, data, queueingStrategy, transfers) {
55644    var _this2 = this;
55645
55646    var streamId = this.streamId++;
55647    var sourceName = this.sourceName;
55648    var targetName = this.targetName;
55649    return new _util.ReadableStream({
55650      start: function start(controller) {
55651        var startCapability = (0, _util.createPromiseCapability)();
55652        _this2.streamControllers[streamId] = {
55653          controller: controller,
55654          startCall: startCapability,
55655          isClosed: false
55656        };
55657
55658        _this2.postMessage({
55659          sourceName: sourceName,
55660          targetName: targetName,
55661          action: actionName,
55662          streamId: streamId,
55663          data: data,
55664          desiredSize: controller.desiredSize
55665        });
55666
55667        return startCapability.promise;
55668      },
55669      pull: function pull(controller) {
55670        var pullCapability = (0, _util.createPromiseCapability)();
55671        _this2.streamControllers[streamId].pullCall = pullCapability;
55672
55673        _this2.postMessage({
55674          sourceName: sourceName,
55675          targetName: targetName,
55676          stream: 'pull',
55677          streamId: streamId,
55678          desiredSize: controller.desiredSize
55679        });
55680
55681        return pullCapability.promise;
55682      },
55683      cancel: function cancel(reason) {
55684        var cancelCapability = (0, _util.createPromiseCapability)();
55685        _this2.streamControllers[streamId].cancelCall = cancelCapability;
55686        _this2.streamControllers[streamId].isClosed = true;
55687
55688        _this2.postMessage({
55689          sourceName: sourceName,
55690          targetName: targetName,
55691          stream: 'cancel',
55692          reason: reason,
55693          streamId: streamId
55694        });
55695
55696        return cancelCapability.promise;
55697      }
55698    }, queueingStrategy);
55699  },
55700  _createStreamSink: function _createStreamSink(data) {
55701    var _this3 = this;
55702
55703    var self = this;
55704    var action = this.actionHandler[data.action];
55705    var streamId = data.streamId;
55706    var desiredSize = data.desiredSize;
55707    var sourceName = this.sourceName;
55708    var targetName = data.sourceName;
55709    var capability = (0, _util.createPromiseCapability)();
55710
55711    var sendStreamRequest = function sendStreamRequest(_ref) {
55712      var stream = _ref.stream,
55713          chunk = _ref.chunk,
55714          transfers = _ref.transfers,
55715          success = _ref.success,
55716          reason = _ref.reason;
55717
55718      _this3.postMessage({
55719        sourceName: sourceName,
55720        targetName: targetName,
55721        stream: stream,
55722        streamId: streamId,
55723        chunk: chunk,
55724        success: success,
55725        reason: reason
55726      }, transfers);
55727    };
55728
55729    var streamSink = {
55730      enqueue: function enqueue(chunk) {
55731        var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
55732        var transfers = arguments.length > 2 ? arguments[2] : undefined;
55733
55734        if (this.isCancelled) {
55735          return;
55736        }
55737
55738        var lastDesiredSize = this.desiredSize;
55739        this.desiredSize -= size;
55740
55741        if (lastDesiredSize > 0 && this.desiredSize <= 0) {
55742          this.sinkCapability = (0, _util.createPromiseCapability)();
55743          this.ready = this.sinkCapability.promise;
55744        }
55745
55746        sendStreamRequest({
55747          stream: 'enqueue',
55748          chunk: chunk,
55749          transfers: transfers
55750        });
55751      },
55752      close: function close() {
55753        if (this.isCancelled) {
55754          return;
55755        }
55756
55757        this.isCancelled = true;
55758        sendStreamRequest({
55759          stream: 'close'
55760        });
55761        delete self.streamSinks[streamId];
55762      },
55763      error: function error(reason) {
55764        if (this.isCancelled) {
55765          return;
55766        }
55767
55768        this.isCancelled = true;
55769        sendStreamRequest({
55770          stream: 'error',
55771          reason: reason
55772        });
55773      },
55774      sinkCapability: capability,
55775      onPull: null,
55776      onCancel: null,
55777      isCancelled: false,
55778      desiredSize: desiredSize,
55779      ready: null
55780    };
55781    streamSink.sinkCapability.resolve();
55782    streamSink.ready = streamSink.sinkCapability.promise;
55783    this.streamSinks[streamId] = streamSink;
55784    resolveCall(action[0], [data.data, streamSink], action[1]).then(function () {
55785      sendStreamRequest({
55786        stream: 'start_complete',
55787        success: true
55788      });
55789    }, function (reason) {
55790      sendStreamRequest({
55791        stream: 'start_complete',
55792        success: false,
55793        reason: reason
55794      });
55795    });
55796  },
55797  _processStreamMessage: function _processStreamMessage(data) {
55798    var _this4 = this;
55799
55800    var sourceName = this.sourceName;
55801    var targetName = data.sourceName;
55802    var streamId = data.streamId;
55803
55804    var sendStreamResponse = function sendStreamResponse(_ref2) {
55805      var stream = _ref2.stream,
55806          success = _ref2.success,
55807          reason = _ref2.reason;
55808
55809      _this4.comObj.postMessage({
55810        sourceName: sourceName,
55811        targetName: targetName,
55812        stream: stream,
55813        success: success,
55814        streamId: streamId,
55815        reason: reason
55816      });
55817    };
55818
55819    var deleteStreamController = function deleteStreamController() {
55820      Promise.all([_this4.streamControllers[data.streamId].startCall, _this4.streamControllers[data.streamId].pullCall, _this4.streamControllers[data.streamId].cancelCall].map(function (capability) {
55821        return capability && finalize(capability.promise);
55822      })).then(function () {
55823        delete _this4.streamControllers[data.streamId];
55824      });
55825    };
55826
55827    switch (data.stream) {
55828      case 'start_complete':
55829        resolveOrReject(this.streamControllers[data.streamId].startCall, data.success, wrapReason(data.reason));
55830        break;
55831
55832      case 'pull_complete':
55833        resolveOrReject(this.streamControllers[data.streamId].pullCall, data.success, wrapReason(data.reason));
55834        break;
55835
55836      case 'pull':
55837        if (!this.streamSinks[data.streamId]) {
55838          sendStreamResponse({
55839            stream: 'pull_complete',
55840            success: true
55841          });
55842          break;
55843        }
55844
55845        if (this.streamSinks[data.streamId].desiredSize <= 0 && data.desiredSize > 0) {
55846          this.streamSinks[data.streamId].sinkCapability.resolve();
55847        }
55848
55849        this.streamSinks[data.streamId].desiredSize = data.desiredSize;
55850        resolveCall(this.streamSinks[data.streamId].onPull).then(function () {
55851          sendStreamResponse({
55852            stream: 'pull_complete',
55853            success: true
55854          });
55855        }, function (reason) {
55856          sendStreamResponse({
55857            stream: 'pull_complete',
55858            success: false,
55859            reason: reason
55860          });
55861        });
55862        break;
55863
55864      case 'enqueue':
55865        (0, _util.assert)(this.streamControllers[data.streamId], 'enqueue should have stream controller');
55866
55867        if (!this.streamControllers[data.streamId].isClosed) {
55868          this.streamControllers[data.streamId].controller.enqueue(data.chunk);
55869        }
55870
55871        break;
55872
55873      case 'close':
55874        (0, _util.assert)(this.streamControllers[data.streamId], 'close should have stream controller');
55875
55876        if (this.streamControllers[data.streamId].isClosed) {
55877          break;
55878        }
55879
55880        this.streamControllers[data.streamId].isClosed = true;
55881        this.streamControllers[data.streamId].controller.close();
55882        deleteStreamController();
55883        break;
55884
55885      case 'error':
55886        (0, _util.assert)(this.streamControllers[data.streamId], 'error should have stream controller');
55887        this.streamControllers[data.streamId].controller.error(wrapReason(data.reason));
55888        deleteStreamController();
55889        break;
55890
55891      case 'cancel_complete':
55892        resolveOrReject(this.streamControllers[data.streamId].cancelCall, data.success, wrapReason(data.reason));
55893        deleteStreamController();
55894        break;
55895
55896      case 'cancel':
55897        if (!this.streamSinks[data.streamId]) {
55898          break;
55899        }
55900
55901        resolveCall(this.streamSinks[data.streamId].onCancel, [wrapReason(data.reason)]).then(function () {
55902          sendStreamResponse({
55903            stream: 'cancel_complete',
55904            success: true
55905          });
55906        }, function (reason) {
55907          sendStreamResponse({
55908            stream: 'cancel_complete',
55909            success: false,
55910            reason: reason
55911          });
55912        });
55913        this.streamSinks[data.streamId].sinkCapability.reject(wrapReason(data.reason));
55914        this.streamSinks[data.streamId].isCancelled = true;
55915        delete this.streamSinks[data.streamId];
55916        break;
55917
55918      default:
55919        throw new Error('Unexpected stream case');
55920    }
55921  },
55922  postMessage: function postMessage(message, transfers) {
55923    if (transfers && this.postMessageTransfers) {
55924      this.comObj.postMessage(message, transfers);
55925    } else {
55926      this.comObj.postMessage(message);
55927    }
55928  },
55929  destroy: function destroy() {
55930    this.comObj.removeEventListener('message', this._onComObjOnMessage);
55931  }
55932};
55933
55934/***/ }),
55935/* 192 */
55936/***/ (function(module, exports, __w_pdfjs_require__) {
55937
55938"use strict";
55939
55940
55941Object.defineProperty(exports, "__esModule", {
55942  value: true
55943});
55944exports.PDFWorkerStream = void 0;
55945
55946var _regenerator = _interopRequireDefault(__w_pdfjs_require__(2));
55947
55948var _util = __w_pdfjs_require__(5);
55949
55950function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
55951
55952function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
55953
55954function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
55955
55956function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
55957
55958function _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); } }
55959
55960function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
55961
55962var PDFWorkerStream =
55963/*#__PURE__*/
55964function () {
55965  function PDFWorkerStream(msgHandler) {
55966    _classCallCheck(this, PDFWorkerStream);
55967
55968    this._msgHandler = msgHandler;
55969    this._contentLength = null;
55970    this._fullRequestReader = null;
55971    this._rangeRequestReaders = [];
55972  }
55973
55974  _createClass(PDFWorkerStream, [{
55975    key: "getFullReader",
55976    value: function getFullReader() {
55977      (0, _util.assert)(!this._fullRequestReader);
55978      this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler);
55979      return this._fullRequestReader;
55980    }
55981  }, {
55982    key: "getRangeReader",
55983    value: function getRangeReader(begin, end) {
55984      var reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler);
55985
55986      this._rangeRequestReaders.push(reader);
55987
55988      return reader;
55989    }
55990  }, {
55991    key: "cancelAllRequests",
55992    value: function cancelAllRequests(reason) {
55993      if (this._fullRequestReader) {
55994        this._fullRequestReader.cancel(reason);
55995      }
55996
55997      var readers = this._rangeRequestReaders.slice(0);
55998
55999      readers.forEach(function (reader) {
56000        reader.cancel(reason);
56001      });
56002    }
56003  }]);
56004
56005  return PDFWorkerStream;
56006}();
56007
56008exports.PDFWorkerStream = PDFWorkerStream;
56009
56010var PDFWorkerStreamReader =
56011/*#__PURE__*/
56012function () {
56013  function PDFWorkerStreamReader(msgHandler) {
56014    var _this = this;
56015
56016    _classCallCheck(this, PDFWorkerStreamReader);
56017
56018    this._msgHandler = msgHandler;
56019    this.onProgress = null;
56020    this._contentLength = null;
56021    this._isRangeSupported = false;
56022    this._isStreamingSupported = false;
56023
56024    var readableStream = this._msgHandler.sendWithStream('GetReader');
56025
56026    this._reader = readableStream.getReader();
56027    this._headersReady = this._msgHandler.sendWithPromise('ReaderHeadersReady').then(function (data) {
56028      _this._isStreamingSupported = data.isStreamingSupported;
56029      _this._isRangeSupported = data.isRangeSupported;
56030      _this._contentLength = data.contentLength;
56031    });
56032  }
56033
56034  _createClass(PDFWorkerStreamReader, [{
56035    key: "read",
56036    value: function () {
56037      var _read = _asyncToGenerator(
56038      /*#__PURE__*/
56039      _regenerator["default"].mark(function _callee() {
56040        var _ref, value, done;
56041
56042        return _regenerator["default"].wrap(function _callee$(_context) {
56043          while (1) {
56044            switch (_context.prev = _context.next) {
56045              case 0:
56046                _context.next = 2;
56047                return this._reader.read();
56048
56049              case 2:
56050                _ref = _context.sent;
56051                value = _ref.value;
56052                done = _ref.done;
56053
56054                if (!done) {
56055                  _context.next = 7;
56056                  break;
56057                }
56058
56059                return _context.abrupt("return", {
56060                  value: undefined,
56061                  done: true
56062                });
56063
56064              case 7:
56065                return _context.abrupt("return", {
56066                  value: value.buffer,
56067                  done: false
56068                });
56069
56070              case 8:
56071              case "end":
56072                return _context.stop();
56073            }
56074          }
56075        }, _callee, this);
56076      }));
56077
56078      function read() {
56079        return _read.apply(this, arguments);
56080      }
56081
56082      return read;
56083    }()
56084  }, {
56085    key: "cancel",
56086    value: function cancel(reason) {
56087      this._reader.cancel(reason);
56088    }
56089  }, {
56090    key: "headersReady",
56091    get: function get() {
56092      return this._headersReady;
56093    }
56094  }, {
56095    key: "contentLength",
56096    get: function get() {
56097      return this._contentLength;
56098    }
56099  }, {
56100    key: "isStreamingSupported",
56101    get: function get() {
56102      return this._isStreamingSupported;
56103    }
56104  }, {
56105    key: "isRangeSupported",
56106    get: function get() {
56107      return this._isRangeSupported;
56108    }
56109  }]);
56110
56111  return PDFWorkerStreamReader;
56112}();
56113
56114var PDFWorkerStreamRangeReader =
56115/*#__PURE__*/
56116function () {
56117  function PDFWorkerStreamRangeReader(begin, end, msgHandler) {
56118    _classCallCheck(this, PDFWorkerStreamRangeReader);
56119
56120    this._msgHandler = msgHandler;
56121    this.onProgress = null;
56122
56123    var readableStream = this._msgHandler.sendWithStream('GetRangeReader', {
56124      begin: begin,
56125      end: end
56126    });
56127
56128    this._reader = readableStream.getReader();
56129  }
56130
56131  _createClass(PDFWorkerStreamRangeReader, [{
56132    key: "read",
56133    value: function () {
56134      var _read2 = _asyncToGenerator(
56135      /*#__PURE__*/
56136      _regenerator["default"].mark(function _callee2() {
56137        var _ref2, value, done;
56138
56139        return _regenerator["default"].wrap(function _callee2$(_context2) {
56140          while (1) {
56141            switch (_context2.prev = _context2.next) {
56142              case 0:
56143                _context2.next = 2;
56144                return this._reader.read();
56145
56146              case 2:
56147                _ref2 = _context2.sent;
56148                value = _ref2.value;
56149                done = _ref2.done;
56150
56151                if (!done) {
56152                  _context2.next = 7;
56153                  break;
56154                }
56155
56156                return _context2.abrupt("return", {
56157                  value: undefined,
56158                  done: true
56159                });
56160
56161              case 7:
56162                return _context2.abrupt("return", {
56163                  value: value.buffer,
56164                  done: false
56165                });
56166
56167              case 8:
56168              case "end":
56169                return _context2.stop();
56170            }
56171          }
56172        }, _callee2, this);
56173      }));
56174
56175      function read() {
56176        return _read2.apply(this, arguments);
56177      }
56178
56179      return read;
56180    }()
56181  }, {
56182    key: "cancel",
56183    value: function cancel(reason) {
56184      this._reader.cancel(reason);
56185    }
56186  }, {
56187    key: "isStreamingSupported",
56188    get: function get() {
56189      return false;
56190    }
56191  }]);
56192
56193  return PDFWorkerStreamRangeReader;
56194}();
56195
56196/***/ })
56197/******/ ]);
56198});
56199//# sourceMappingURL=pdf.worker.js.map