|
@@ -34,131 +34,6 @@ if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) {
|
|
|
globalScope.PDFJS = {};
|
|
|
}
|
|
|
PDFJS.compatibilityChecked = true;
|
|
|
- (function checkTypedArrayCompatibility() {
|
|
|
- if (typeof Uint8ClampedArray === 'undefined') {
|
|
|
- globalScope.Uint8ClampedArray = require('core-js/fn/typed/uint8-clamped-array');
|
|
|
- }
|
|
|
- if (typeof Uint8Array !== 'undefined') {
|
|
|
- if (typeof Uint8Array.prototype.subarray === 'undefined') {
|
|
|
- Uint8Array.prototype.subarray = function subarray(start, end) {
|
|
|
- return new Uint8Array(this.slice(start, end));
|
|
|
- };
|
|
|
- Float32Array.prototype.subarray = function subarray(start, end) {
|
|
|
- return new Float32Array(this.slice(start, end));
|
|
|
- };
|
|
|
- }
|
|
|
- if (typeof Float64Array === 'undefined') {
|
|
|
- globalScope.Float64Array = Float32Array;
|
|
|
- }
|
|
|
- return;
|
|
|
- }
|
|
|
- function subarray(start, end) {
|
|
|
- return new TypedArray(this.slice(start, end));
|
|
|
- }
|
|
|
- function setArrayOffset(array, offset) {
|
|
|
- if (arguments.length < 2) {
|
|
|
- offset = 0;
|
|
|
- }
|
|
|
- for (var i = 0, n = array.length; i < n; ++i, ++offset) {
|
|
|
- this[offset] = array[i] & 0xFF;
|
|
|
- }
|
|
|
- }
|
|
|
- function Uint32ArrayView(buffer, length) {
|
|
|
- this.buffer = buffer;
|
|
|
- this.byteLength = buffer.length;
|
|
|
- this.length = length;
|
|
|
- ensureUint32ArrayViewProps(this.length);
|
|
|
- }
|
|
|
- Uint32ArrayView.prototype = Object.create(null);
|
|
|
- var uint32ArrayViewSetters = 0;
|
|
|
- function createUint32ArrayProp(index) {
|
|
|
- return {
|
|
|
- get: function get() {
|
|
|
- var buffer = this.buffer,
|
|
|
- offset = index << 2;
|
|
|
- return (buffer[offset] | buffer[offset + 1] << 8 | buffer[offset + 2] << 16 | buffer[offset + 3] << 24) >>> 0;
|
|
|
- },
|
|
|
- set: function set(value) {
|
|
|
- var buffer = this.buffer,
|
|
|
- offset = index << 2;
|
|
|
- buffer[offset] = value & 255;
|
|
|
- buffer[offset + 1] = value >> 8 & 255;
|
|
|
- buffer[offset + 2] = value >> 16 & 255;
|
|
|
- buffer[offset + 3] = value >>> 24 & 255;
|
|
|
- }
|
|
|
- };
|
|
|
- }
|
|
|
- function ensureUint32ArrayViewProps(length) {
|
|
|
- while (uint32ArrayViewSetters < length) {
|
|
|
- Object.defineProperty(Uint32ArrayView.prototype, uint32ArrayViewSetters, createUint32ArrayProp(uint32ArrayViewSetters));
|
|
|
- uint32ArrayViewSetters++;
|
|
|
- }
|
|
|
- }
|
|
|
- function TypedArray(arg1) {
|
|
|
- var result, i, n;
|
|
|
- if (typeof arg1 === 'number') {
|
|
|
- result = [];
|
|
|
- for (i = 0; i < arg1; ++i) {
|
|
|
- result[i] = 0;
|
|
|
- }
|
|
|
- } else if ('slice' in arg1) {
|
|
|
- result = arg1.slice(0);
|
|
|
- } else {
|
|
|
- result = [];
|
|
|
- for (i = 0, n = arg1.length; i < n; ++i) {
|
|
|
- result[i] = arg1[i];
|
|
|
- }
|
|
|
- }
|
|
|
- result.subarray = subarray;
|
|
|
- result.buffer = result;
|
|
|
- result.byteLength = result.length;
|
|
|
- result.set = setArrayOffset;
|
|
|
- if ((typeof arg1 === 'undefined' ? 'undefined' : _typeof(arg1)) === 'object' && arg1.buffer) {
|
|
|
- result.buffer = arg1.buffer;
|
|
|
- }
|
|
|
- return result;
|
|
|
- }
|
|
|
- globalScope.Uint8Array = TypedArray;
|
|
|
- globalScope.Int8Array = TypedArray;
|
|
|
- globalScope.Int32Array = TypedArray;
|
|
|
- globalScope.Uint16Array = TypedArray;
|
|
|
- globalScope.Float32Array = TypedArray;
|
|
|
- globalScope.Float64Array = TypedArray;
|
|
|
- globalScope.Uint32Array = function () {
|
|
|
- if (arguments.length === 3) {
|
|
|
- if (arguments[1] !== 0) {
|
|
|
- throw new Error('offset !== 0 is not supported');
|
|
|
- }
|
|
|
- return new Uint32ArrayView(arguments[0], arguments[2]);
|
|
|
- }
|
|
|
- return TypedArray.apply(this, arguments);
|
|
|
- };
|
|
|
- })();
|
|
|
- (function canvasPixelArrayBuffer() {
|
|
|
- if (!hasDOM || !window.CanvasPixelArray) {
|
|
|
- return;
|
|
|
- }
|
|
|
- var cpaProto = window.CanvasPixelArray.prototype;
|
|
|
- if ('buffer' in cpaProto) {
|
|
|
- return;
|
|
|
- }
|
|
|
- Object.defineProperty(cpaProto, 'buffer', {
|
|
|
- get: function get() {
|
|
|
- return this;
|
|
|
- },
|
|
|
-
|
|
|
- enumerable: false,
|
|
|
- configurable: true
|
|
|
- });
|
|
|
- Object.defineProperty(cpaProto, 'byteLength', {
|
|
|
- get: function get() {
|
|
|
- return this.length;
|
|
|
- },
|
|
|
-
|
|
|
- enumerable: false,
|
|
|
- configurable: true
|
|
|
- });
|
|
|
- })();
|
|
|
(function normalizeURLObject() {
|
|
|
if (!globalScope.URL) {
|
|
|
globalScope.URL = globalScope.webkitURL;
|