Source code
Revision control
Copy as Markdown
Other Tools
/**
* @licstart The following is the entire license notice for the
* JavaScript code in this page
*
* Copyright 2024 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* @licend The above is the entire license notice for the
* JavaScript code in this page
*/
/**
* pdfjsVersion = 7.0.306
* pdfjsBuild = 99b87c5d5
*/
export const __webpack_esm_ids__ = ["jbig2"];
export const __webpack_esm_modules__ = {
/***/ 2708
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
__webpack_require__.r(__webpack_exports__);
async function JBig2(moduleArg = {}) {
var Module = moduleArg;
var quit_ = (status, toThrow) => {
throw toThrow;
};
var _scriptName = import.meta.url;
var scriptDirectory = "";
var readAsync;
try {
scriptDirectory = new URL(".", _scriptName).href;
} catch {}
readAsync = async url => {
var response = await fetch(url, {
credentials: "same-origin"
});
if (response.ok) return response.arrayBuffer();
throw new Error(response.status + " : " + response.url);
};
console.log.bind(console);
var err = console.error.bind(console);
var ABORT = false;
var EXITSTATUS;
function getMemoryBuffer() {
return wasmMemory.buffer;
}
function updateMemoryViews() {
if (HEAP8?.buffer?.resizable) return;
var b = getMemoryBuffer();
HEAP8 = new Int8Array(b);
HEAPU8 = new Uint8Array(b);
}
function preRun() {
var preRun = Module["preRun"];
if (preRun) {
if (typeof preRun === "function") preRun = [preRun];
onPreRuns.push(...preRun);
}
callRuntimeCallbacks(onPreRuns);
}
function initRuntime() {
0;
wasmExports["j"]();
}
function postRun() {
var postRun = Module["postRun"];
if (postRun) {
if (typeof postRun === "function") postRun = [postRun];
onPostRuns.push(...postRun);
}
callRuntimeCallbacks(onPostRuns);
}
function abort(what) {
Module["onAbort"]?.(what);
what = `Aborted(${what})`;
err(what);
ABORT = true;
what += ". Build with -sASSERTIONS for more info.";
throw new WebAssembly.RuntimeError(what);
}
var wasmBinaryFile;
function getWasmImports() {
var imports = {
a: wasmImports
};
return imports;
}
class ExitStatus {
name = "ExitStatus";
constructor(status) {
this.message = `Program terminated with exit(${status})`;
this.status = status;
}
}
var HEAP8;
var callRuntimeCallbacks = callbacks => {
while (callbacks.length > 0) callbacks.shift()(Module);
};
var onPostRuns = [];
var onPreRuns = [];
var noExitRuntime = true;
var runtimeKeepaliveCounter = 0;
var handleException = e => {
if (e instanceof ExitStatus || e == "unwind") return EXITSTATUS;
quit_(0, e);
};
var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0;
var _proc_exit = code => {
EXITSTATUS = code;
if (!keepRuntimeAlive()) {
Module["onExit"]?.(code);
ABORT = true;
}
quit_(0, new ExitStatus(code));
};
var maybeExit = () => {
if (!keepRuntimeAlive()) try {
_exit(EXITSTATUS);
} catch (e) {
handleException(e);
}
};
var callUserCallback = (func, ...args) => {
if (ABORT) return;
try {
return func(...args);
} catch (e) {
handleException(e);
} finally {
maybeExit();
}
};
var timers = {};
var _emscripten_get_now = () => performance.now();
var HEAPU8;
var alignMemory = (size, alignment) => Math.ceil(size / alignment) * alignment;
var getHeapMax = () => 2147483648;
var growMemory = size => {
var oldHeapSize = wasmMemory.buffer.byteLength;
var pages = (size - oldHeapSize + 65535) / 65536 | 0;
try {
wasmMemory.grow(pages);
updateMemoryViews();
return 1;
} catch (e) {}
};
var _exit = status => {
EXITSTATUS = status;
_proc_exit(status);
};
if (Module["noExitRuntime"]) noExitRuntime = Module["noExitRuntime"];
if (Module["print"]) Module["print"];
if (Module["printErr"]) err = Module["printErr"];
if (Module["arguments"]) Module["arguments"];
if (Module["thisProgram"]) Module["thisProgram"];
var preInit = Module["preInit"];
if (preInit) {
if (typeof preInit === "function") Module["preInit"] = preInit = [preInit];
while (preInit.length > 0) preInit.shift()();
}
Module["writeArrayToMemory"] = (array, buffer) => {
HEAP8.set(array, buffer);
};
var __emscripten_timeout, wasmMemory;
function assignWasmExports(wasmExports) {
Module["_malloc"] = wasmExports["k"];
Module["_free"] = wasmExports["l"];
Module["_jbig2_decode"] = wasmExports["m"];
Module["_ccitt_decode"] = wasmExports["n"];
__emscripten_timeout = wasmExports["o"];
wasmMemory = wasmExports["i"];
wasmExports["__indirect_function_table"];
}
var wasmImports = {
e: () => abort(""),
d: () => {
noExitRuntime = false;
runtimeKeepaliveCounter = 0;
},
a: (which, timeout_ms) => {
if (timers[which]) {
clearTimeout(timers[which].id);
delete timers[which];
}
if (!timeout_ms) return 0;
var id = setTimeout(() => {
delete timers[which];
callUserCallback(__emscripten_timeout, which, _emscripten_get_now());
}, timeout_ms);
timers[which] = {
id,
timeout_ms
};
return 0;
},
g: function (size) {
Module.imageData = new Uint8Array(size);
},
b: requestedSize => {
var oldSize = HEAPU8.length;
requestedSize >>>= 0;
var maxHeapSize = getHeapMax();
if (requestedSize > maxHeapSize) return false;
for (var cutDown = 1; cutDown <= 4; cutDown *= 2) {
var overGrownHeapSize = oldSize * (1 + .2 / cutDown);
overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296);
var newSize = Math.min(maxHeapSize, alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536));
var replacement = growMemory(newSize);
if (replacement) return true;
}
return false;
},
c: _proc_exit,
h: function (array_ptr, pitch8, pitch32, height) {
if (pitch32 === pitch8) {
Module.imageData = new Uint8ClampedArray(HEAPU8.subarray(array_ptr, array_ptr + pitch32 * height));
return;
}
const destSize = pitch8 * height;
const imageData = Module.imageData = new Uint8ClampedArray(destSize);
for (let srcStart = array_ptr, destStart = 0; destStart < destSize; srcStart += pitch32, destStart += pitch8) imageData.set(HEAPU8.subarray(srcStart, srcStart + pitch8), destStart);
},
f: function (line_ptr, pitch8, offset) {
Module.imageData.set(HEAPU8.subarray(line_ptr, line_ptr + pitch8), offset);
}
};
var wasmExports;
wasmExports = await async function () {
function receiveInstance(instance) {
wasmExports = instance.exports;
assignWasmExports(wasmExports);
updateMemoryViews();
return wasmExports;
}
var info = getWasmImports();
var instantiateWasm = Module["instantiateWasm"];
return new Promise(resolve => {
instantiateWasm(info, inst => resolve(receiveInstance(inst)));
});
}();
await async function () {
preRun();
var setStatus = Module["setStatus"];
if (setStatus) {
setStatus("Running...");
await new Promise(resolve => setTimeout(resolve, 1));
setTimeout(setStatus, 1, "");
}
if (ABORT) return;
initRuntime();
Module["onRuntimeInitialized"]?.();
postRun();
}();
return Module;
}
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (JBig2);
/* harmony export */ __webpack_require__.d(__webpack_exports__, [
/* harmony export */ "default", 0, __WEBPACK_DEFAULT_EXPORT__
/* harmony export */ ]);
/***/ }
};