13016 lines
414 KiB
JavaScript
13016 lines
414 KiB
JavaScript
/**
|
||
* @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
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* 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 = 6.5.438
|
||
* pdfjsBuild = 0a4153349
|
||
*/
|
||
/******/ var __webpack_modules__ = ({
|
||
|
||
/***/ 463
|
||
(module) {
|
||
|
||
|
||
var $TypeError = TypeError;
|
||
|
||
module.exports = function (argument) {
|
||
if (typeof argument == 'string') return argument;
|
||
throw new $TypeError('Argument is not a string');
|
||
};
|
||
|
||
|
||
/***/ },
|
||
|
||
/***/ 804
|
||
(module) {
|
||
|
||
|
||
var commonAlphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||
var base64Alphabet = commonAlphabet + '+/';
|
||
var base64UrlAlphabet = commonAlphabet + '-_';
|
||
|
||
var inverse = function (characters) {
|
||
// TODO: use `Object.create(null)` in `core-js@4`
|
||
var result = {};
|
||
var index = 0;
|
||
for (; index < 64; index++) result[characters.charAt(index)] = index;
|
||
return result;
|
||
};
|
||
|
||
module.exports = {
|
||
i2c: base64Alphabet,
|
||
c2i: inverse(base64Alphabet),
|
||
i2cUrl: base64UrlAlphabet,
|
||
c2iUrl: inverse(base64UrlAlphabet)
|
||
};
|
||
|
||
|
||
/***/ },
|
||
|
||
/***/ 529
|
||
(module) {
|
||
|
||
|
||
// `CreateIterResultObject` abstract operation
|
||
// https://tc39.es/ecma262/#sec-createiterresultobject
|
||
module.exports = function (value, done) {
|
||
return { value: value, done: done };
|
||
};
|
||
|
||
|
||
/***/ },
|
||
|
||
/***/ 837
|
||
(module) {
|
||
|
||
|
||
var $TypeError = TypeError;
|
||
var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991
|
||
|
||
module.exports = function (it) {
|
||
if (it > MAX_SAFE_INTEGER) throw new $TypeError('Maximum allowed index exceeded');
|
||
return it;
|
||
};
|
||
|
||
|
||
/***/ },
|
||
|
||
/***/ 2
|
||
(module) {
|
||
|
||
|
||
module.exports = {
|
||
IndexSizeError: { s: 'INDEX_SIZE_ERR', c: 1, m: 1 },
|
||
DOMStringSizeError: { s: 'DOMSTRING_SIZE_ERR', c: 2, m: 0 },
|
||
HierarchyRequestError: { s: 'HIERARCHY_REQUEST_ERR', c: 3, m: 1 },
|
||
WrongDocumentError: { s: 'WRONG_DOCUMENT_ERR', c: 4, m: 1 },
|
||
InvalidCharacterError: { s: 'INVALID_CHARACTER_ERR', c: 5, m: 1 },
|
||
NoDataAllowedError: { s: 'NO_DATA_ALLOWED_ERR', c: 6, m: 0 },
|
||
NoModificationAllowedError: { s: 'NO_MODIFICATION_ALLOWED_ERR', c: 7, m: 1 },
|
||
NotFoundError: { s: 'NOT_FOUND_ERR', c: 8, m: 1 },
|
||
NotSupportedError: { s: 'NOT_SUPPORTED_ERR', c: 9, m: 1 },
|
||
InUseAttributeError: { s: 'INUSE_ATTRIBUTE_ERR', c: 10, m: 1 },
|
||
InvalidStateError: { s: 'INVALID_STATE_ERR', c: 11, m: 1 },
|
||
SyntaxError: { s: 'SYNTAX_ERR', c: 12, m: 1 },
|
||
InvalidModificationError: { s: 'INVALID_MODIFICATION_ERR', c: 13, m: 1 },
|
||
NamespaceError: { s: 'NAMESPACE_ERR', c: 14, m: 1 },
|
||
InvalidAccessError: { s: 'INVALID_ACCESS_ERR', c: 15, m: 1 },
|
||
ValidationError: { s: 'VALIDATION_ERR', c: 16, m: 0 },
|
||
TypeMismatchError: { s: 'TYPE_MISMATCH_ERR', c: 17, m: 1 },
|
||
SecurityError: { s: 'SECURITY_ERR', c: 18, m: 1 },
|
||
NetworkError: { s: 'NETWORK_ERR', c: 19, m: 1 },
|
||
AbortError: { s: 'ABORT_ERR', c: 20, m: 1 },
|
||
URLMismatchError: { s: 'URL_MISMATCH_ERR', c: 21, m: 1 },
|
||
QuotaExceededError: { s: 'QUOTA_EXCEEDED_ERR', c: 22, m: 1 },
|
||
TimeoutError: { s: 'TIMEOUT_ERR', c: 23, m: 1 },
|
||
InvalidNodeTypeError: { s: 'INVALID_NODE_TYPE_ERR', c: 24, m: 1 },
|
||
DataCloneError: { s: 'DATA_CLONE_ERR', c: 25, m: 1 }
|
||
};
|
||
|
||
|
||
/***/ },
|
||
|
||
/***/ 944
|
||
(module) {
|
||
|
||
|
||
var $TypeError = TypeError;
|
||
|
||
module.exports = function (options) {
|
||
var alphabet = options && options.alphabet;
|
||
if (alphabet === undefined || alphabet === 'base64' || alphabet === 'base64url') return alphabet || 'base64';
|
||
throw new $TypeError('Incorrect `alphabet` option');
|
||
};
|
||
|
||
|
||
/***/ },
|
||
|
||
/***/ 767
|
||
(module) {
|
||
|
||
|
||
// `GetIteratorDirect(obj)` abstract operation
|
||
// https://tc39.es/ecma262/#sec-getiteratordirect
|
||
module.exports = function (obj) {
|
||
return {
|
||
iterator: obj,
|
||
next: obj.next,
|
||
done: false
|
||
};
|
||
};
|
||
|
||
|
||
/***/ },
|
||
|
||
/***/ 117
|
||
(module) {
|
||
|
||
|
||
// we can't use just `it == null` since of `document.all` special case
|
||
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
|
||
module.exports = function (it) {
|
||
return it === null || it === undefined;
|
||
};
|
||
|
||
|
||
/***/ },
|
||
|
||
/***/ 859
|
||
(module) {
|
||
|
||
|
||
// release references held by exhausted / closed iterator helpers to allow GC of the source chain
|
||
module.exports = function (state) {
|
||
state.iterator = state.next = state.nextHandler = state.mapper = state.predicate = state.inner =
|
||
state.iterables = state.iters = state.openIters = state.padding = state.finishResults = state.buffer = null;
|
||
};
|
||
|
||
|
||
/***/ },
|
||
|
||
/***/ 684
|
||
(module) {
|
||
|
||
|
||
// Should throw an error on invalid iterator
|
||
// https://issues.chromium.org/issues/336839115
|
||
module.exports = function (methodName, argument) {
|
||
// eslint-disable-next-line es/no-iterator -- required for testing
|
||
var method = typeof Iterator == 'function' && Iterator.prototype[methodName];
|
||
if (method) try {
|
||
method.call({ next: null }, argument).next();
|
||
} catch (error) {
|
||
return true;
|
||
}
|
||
};
|
||
|
||
|
||
/***/ },
|
||
|
||
/***/ 269
|
||
(module) {
|
||
|
||
|
||
module.exports = Object.create ? Object.create(null) : {};
|
||
|
||
|
||
/***/ },
|
||
|
||
/***/ 741
|
||
(module) {
|
||
|
||
|
||
var ceil = Math.ceil;
|
||
var floor = Math.floor;
|
||
|
||
// `Math.trunc` method
|
||
// https://tc39.es/ecma262/#sec-math.trunc
|
||
// eslint-disable-next-line es/no-math-trunc -- safe
|
||
module.exports = Math.trunc || function trunc(x) {
|
||
var n = +x;
|
||
return (n > 0 ? floor : ceil)(n);
|
||
};
|
||
|
||
|
||
/***/ },
|
||
|
||
/***/ 149
|
||
(module) {
|
||
|
||
|
||
var $RangeError = RangeError;
|
||
|
||
module.exports = function (it) {
|
||
// eslint-disable-next-line no-self-compare -- NaN check
|
||
if (it === it) return it;
|
||
throw new $RangeError('NaN is not allowed');
|
||
};
|
||
|
||
|
||
/***/ },
|
||
|
||
/***/ 717
|
||
(__unused_webpack_module, exports) {
|
||
|
||
|
||
// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
|
||
exports.f = Object.getOwnPropertySymbols;
|
||
|
||
|
||
/***/ },
|
||
|
||
/***/ 103
|
||
(module) {
|
||
|
||
|
||
module.exports = function (exec) {
|
||
try {
|
||
return { error: false, value: exec() };
|
||
} catch (error) {
|
||
return { error: true, value: error };
|
||
}
|
||
};
|
||
|
||
|
||
/***/ },
|
||
|
||
/***/ 750
|
||
(module, __unused_webpack_exports, __webpack_require__) {
|
||
|
||
|
||
var isNullOrUndefined = __webpack_require__(117);
|
||
|
||
var $TypeError = TypeError;
|
||
|
||
// `RequireObjectCoercible` abstract operation
|
||
// https://tc39.es/ecma262/#sec-requireobjectcoercible
|
||
module.exports = function (it) {
|
||
if (isNullOrUndefined(it)) throw new $TypeError("Can't call method on " + it);
|
||
return it;
|
||
};
|
||
|
||
|
||
/***/ },
|
||
|
||
/***/ 835
|
||
(module) {
|
||
|
||
|
||
// Should get iterator record of a set-like object before cloning this
|
||
// https://bugs.webkit.org/show_bug.cgi?id=289430
|
||
module.exports = function (METHOD_NAME) {
|
||
try {
|
||
// eslint-disable-next-line es/no-set -- needed for test
|
||
var baseSet = new Set();
|
||
var setLike = {
|
||
size: 0,
|
||
has: function () { return true; },
|
||
keys: function () {
|
||
// eslint-disable-next-line es/no-object-defineproperty -- needed for test
|
||
return Object.defineProperty({}, 'next', {
|
||
get: function () {
|
||
baseSet.clear();
|
||
baseSet.add(4);
|
||
return function () {
|
||
return { done: true };
|
||
};
|
||
}
|
||
});
|
||
}
|
||
};
|
||
var result = baseSet[METHOD_NAME](setLike);
|
||
|
||
return result.size === 1 && result.values().next().value === 4;
|
||
} catch (error) {
|
||
return false;
|
||
}
|
||
};
|
||
|
||
|
||
/***/ },
|
||
|
||
/***/ 291
|
||
(module, __unused_webpack_exports, __webpack_require__) {
|
||
|
||
|
||
var trunc = __webpack_require__(741);
|
||
|
||
// `ToIntegerOrInfinity` abstract operation
|
||
// https://tc39.es/ecma262/#sec-tointegerorinfinity
|
||
module.exports = function (argument) {
|
||
var number = +argument;
|
||
// eslint-disable-next-line no-self-compare -- NaN check
|
||
return number !== number || number === 0 ? 0 : trunc(number);
|
||
};
|
||
|
||
|
||
/***/ },
|
||
|
||
/***/ 14
|
||
(module, __unused_webpack_exports, __webpack_require__) {
|
||
|
||
|
||
var toIntegerOrInfinity = __webpack_require__(291);
|
||
|
||
var min = Math.min;
|
||
|
||
// `ToLength` abstract operation
|
||
// https://tc39.es/ecma262/#sec-tolength
|
||
module.exports = function (argument) {
|
||
var len = toIntegerOrInfinity(argument);
|
||
return len > 0 ? min(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
|
||
};
|
||
|
||
|
||
/***/ },
|
||
|
||
/***/ 981
|
||
(module, __unused_webpack_exports, __webpack_require__) {
|
||
|
||
|
||
var requireObjectCoercible = __webpack_require__(750);
|
||
|
||
var $Object = Object;
|
||
|
||
// `ToObject` abstract operation
|
||
// https://tc39.es/ecma262/#sec-toobject
|
||
module.exports = function (argument) {
|
||
return $Object(requireObjectCoercible(argument));
|
||
};
|
||
|
||
|
||
/***/ },
|
||
|
||
/***/ 590
|
||
(module, __unused_webpack_exports, __webpack_require__) {
|
||
|
||
|
||
var toIntegerOrInfinity = __webpack_require__(291);
|
||
|
||
var $RangeError = RangeError;
|
||
|
||
module.exports = function (it) {
|
||
var result = toIntegerOrInfinity(it);
|
||
if (result < 0) throw new $RangeError("The argument can't be less than 0");
|
||
return result;
|
||
};
|
||
|
||
|
||
/***/ },
|
||
|
||
/***/ 812
|
||
(module) {
|
||
|
||
|
||
var $TypeError = TypeError;
|
||
|
||
module.exports = function (passed, required) {
|
||
if (passed < required) throw new $TypeError('Not enough arguments');
|
||
return passed;
|
||
};
|
||
|
||
|
||
/***/ }
|
||
|
||
/******/ });
|
||
/************************************************************************/
|
||
/******/ // The module cache
|
||
/******/ const __webpack_module_cache__ = {};
|
||
/******/
|
||
/******/ // The require function
|
||
/******/ function __webpack_require__(moduleId) {
|
||
/******/ // Check if module is in cache
|
||
/******/ const cachedModule = __webpack_module_cache__[moduleId];
|
||
/******/ if (cachedModule !== undefined) {
|
||
/******/ return cachedModule.exports;
|
||
/******/ }
|
||
/******/ // Create a new module (and put it into the cache)
|
||
/******/ const module = __webpack_module_cache__[moduleId] = {
|
||
/******/ // no module.id needed
|
||
/******/ // no module.loaded needed
|
||
/******/ exports: {}
|
||
/******/ };
|
||
/******/
|
||
/******/ // Execute the module function
|
||
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
||
/******/
|
||
/******/ // Return the exports of the module
|
||
/******/ return module.exports;
|
||
/******/ }
|
||
/******/
|
||
/************************************************************************/
|
||
/******/ /* webpack/runtime/concatenation wrap */
|
||
/******/ // wrap a concatenated module body as a lazy, memoized accessor; mod is
|
||
/******/ // set before the body runs so re-entrant calls (require cycles) observe
|
||
/******/ // the partial exports like Node.js
|
||
/******/ __webpack_require__.cw = (body) => {
|
||
/******/ var mod;
|
||
/******/ return () => {
|
||
/******/ if (body) {
|
||
/******/ var fn = body;
|
||
/******/ body = 0;
|
||
/******/ mod = { exports: {} };
|
||
/******/ fn.call(mod.exports, mod, mod.exports);
|
||
/******/ }
|
||
/******/ return mod.exports;
|
||
/******/ };
|
||
/******/ };
|
||
/******/
|
||
/************************************************************************/
|
||
|
||
// MODULE: ./node_modules/core-js/internals/a-callable.js
|
||
var a_callable_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var isCallable = (is_callable_namespaceFn());
|
||
var tryToString = (try_to_string_namespaceFn());
|
||
|
||
var $TypeError = TypeError;
|
||
|
||
// `Assert: IsCallable(argument) is true`
|
||
module.exports = function (argument) {
|
||
if (isCallable(argument)) return argument;
|
||
throw new $TypeError(tryToString(argument) + ' is not a function');
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/a-possible-prototype.js
|
||
var a_possible_prototype_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var isPossiblePrototype = (is_possible_prototype_namespaceFn());
|
||
|
||
var $String = String;
|
||
var $TypeError = TypeError;
|
||
|
||
module.exports = function (argument) {
|
||
if (isPossiblePrototype(argument)) return argument;
|
||
throw new $TypeError("Can't set " + $String(argument) + ' as a prototype');
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/a-set.js
|
||
var a_set_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var has = (set_helpers_namespaceFn().has);
|
||
|
||
// Perform ? RequireInternalSlot(M, [[SetData]])
|
||
module.exports = function (it) {
|
||
has(it);
|
||
return it;
|
||
};
|
||
|
||
});
|
||
|
||
// EXTERNAL MODULE: ./node_modules/core-js/internals/a-string.js
|
||
var a_string_namespaceFn = () => {
|
||
return __webpack_require__(463);
|
||
};
|
||
|
||
// MODULE: ./node_modules/core-js/internals/a-weak-key.js
|
||
var a_weak_key_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var WeakMapHelpers = (weak_map_helpers_namespaceFn());
|
||
|
||
var weakmap = new WeakMapHelpers.WeakMap();
|
||
var set = WeakMapHelpers.set;
|
||
var remove = WeakMapHelpers.remove;
|
||
|
||
module.exports = function (key) {
|
||
set(weakmap, key, 1);
|
||
remove(weakmap, key);
|
||
return key;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/a-weak-map.js
|
||
var a_weak_map_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var has = (weak_map_helpers_namespaceFn().has);
|
||
|
||
// Perform ? RequireInternalSlot(M, [[WeakMapData]])
|
||
module.exports = function (it) {
|
||
has(it);
|
||
return it;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/add-to-unscopables.js
|
||
var add_to_unscopables_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var wellKnownSymbol = (well_known_symbol_namespaceFn());
|
||
var create = (object_create_namespaceFn());
|
||
var defineProperty = (object_define_property_namespaceFn().f);
|
||
|
||
var UNSCOPABLES = wellKnownSymbol('unscopables');
|
||
var ArrayPrototype = Array.prototype;
|
||
|
||
// Array.prototype[@@unscopables]
|
||
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
||
if (ArrayPrototype[UNSCOPABLES] === undefined) {
|
||
defineProperty(ArrayPrototype, UNSCOPABLES, {
|
||
configurable: true,
|
||
value: create(null)
|
||
});
|
||
}
|
||
|
||
// add a key to Array.prototype[@@unscopables]
|
||
module.exports = function (key) {
|
||
ArrayPrototype[UNSCOPABLES][key] = true;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/an-instance.js
|
||
var an_instance_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var isPrototypeOf = (object_is_prototype_of_namespaceFn());
|
||
|
||
var $TypeError = TypeError;
|
||
|
||
module.exports = function (it, Prototype) {
|
||
if (isPrototypeOf(Prototype, it)) return it;
|
||
throw new $TypeError('Incorrect invocation');
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/an-object-or-undefined.js
|
||
var an_object_or_undefined_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var isObject = (is_object_namespaceFn());
|
||
|
||
var $String = String;
|
||
var $TypeError = TypeError;
|
||
|
||
module.exports = function (argument) {
|
||
if (argument === undefined || isObject(argument)) return argument;
|
||
throw new $TypeError($String(argument) + ' is not an object or undefined');
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/an-object.js
|
||
var an_object_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var isObject = (is_object_namespaceFn());
|
||
|
||
var $String = String;
|
||
var $TypeError = TypeError;
|
||
|
||
// `Assert: Type(argument) is Object`
|
||
module.exports = function (argument) {
|
||
if (isObject(argument)) return argument;
|
||
throw new $TypeError($String(argument) + ' is not an object');
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/an-uint8-array.js
|
||
var an_uint8_array_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var classof = (classof_namespaceFn());
|
||
|
||
var $TypeError = TypeError;
|
||
|
||
// Perform ? RequireInternalSlot(argument, [[TypedArrayName]])
|
||
// If argument.[[TypedArrayName]] is not "Uint8Array", throw a TypeError exception
|
||
module.exports = function (argument) {
|
||
if (classof(argument) === 'Uint8Array') return argument;
|
||
throw new $TypeError('Argument is not an Uint8Array');
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/array-buffer-basic-detection.js
|
||
var array_buffer_basic_detection_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
// eslint-disable-next-line es/no-typed-arrays -- safe
|
||
module.exports = typeof ArrayBuffer != 'undefined' && typeof DataView != 'undefined';
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/array-buffer-byte-length.js
|
||
var array_buffer_byte_length_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var globalThis = (global_this_namespaceFn());
|
||
var uncurryThisAccessor = (function_uncurry_this_accessor_namespaceFn());
|
||
var classof = (classof_raw_namespaceFn());
|
||
|
||
var ArrayBuffer = globalThis.ArrayBuffer;
|
||
var TypeError = globalThis.TypeError;
|
||
|
||
// Includes
|
||
// - Perform ? RequireInternalSlot(O, [[ArrayBufferData]]).
|
||
// - If IsSharedArrayBuffer(O) is true, throw a TypeError exception.
|
||
module.exports = ArrayBuffer && uncurryThisAccessor(ArrayBuffer.prototype, 'byteLength', 'get') || function (O) {
|
||
if (classof(O) !== 'ArrayBuffer') throw new TypeError('ArrayBuffer expected');
|
||
return O.byteLength;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/array-buffer-is-detached.js
|
||
var array_buffer_is_detached_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var globalThis = (global_this_namespaceFn());
|
||
var NATIVE_ARRAY_BUFFER = (array_buffer_basic_detection_namespaceFn());
|
||
var arrayBufferByteLength = (array_buffer_byte_length_namespaceFn());
|
||
|
||
var DataView = globalThis.DataView;
|
||
|
||
module.exports = function (O) {
|
||
if (!NATIVE_ARRAY_BUFFER || arrayBufferByteLength(O) !== 0) return false;
|
||
try {
|
||
// eslint-disable-next-line no-new -- thrower
|
||
new DataView(O);
|
||
return false;
|
||
} catch (error) {
|
||
return true;
|
||
}
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/array-buffer-not-detached.js
|
||
var array_buffer_not_detached_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var isDetached = (array_buffer_is_detached_namespaceFn());
|
||
|
||
var $TypeError = TypeError;
|
||
|
||
module.exports = function (it) {
|
||
if (isDetached(it)) throw new $TypeError('ArrayBuffer is detached');
|
||
return it;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/array-buffer-view-core.js
|
||
var array_buffer_view_core_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var NATIVE_ARRAY_BUFFER = (array_buffer_basic_detection_namespaceFn());
|
||
var DESCRIPTORS = (descriptors_namespaceFn());
|
||
var globalThis = (global_this_namespaceFn());
|
||
var isCallable = (is_callable_namespaceFn());
|
||
var isObject = (is_object_namespaceFn());
|
||
var hasOwn = (has_own_property_namespaceFn());
|
||
var classof = (classof_namespaceFn());
|
||
var tryToString = (try_to_string_namespaceFn());
|
||
var createNonEnumerableProperty = (create_non_enumerable_property_namespaceFn());
|
||
var defineBuiltIn = (define_built_in_namespaceFn());
|
||
var defineBuiltInAccessor = (define_built_in_accessor_namespaceFn());
|
||
var isPrototypeOf = (object_is_prototype_of_namespaceFn());
|
||
var getPrototypeOf = (object_get_prototype_of_namespaceFn());
|
||
var setPrototypeOf = (object_set_prototype_of_namespaceFn());
|
||
var wellKnownSymbol = (well_known_symbol_namespaceFn());
|
||
var uid = (uid_namespaceFn());
|
||
var InternalStateModule = (internal_state_namespaceFn());
|
||
|
||
var enforceInternalState = InternalStateModule.enforce;
|
||
var getInternalState = InternalStateModule.get;
|
||
var Int8Array = globalThis.Int8Array;
|
||
var Int8ArrayPrototype = Int8Array && Int8Array.prototype;
|
||
var Uint8ClampedArray = globalThis.Uint8ClampedArray;
|
||
var Uint8ClampedArrayPrototype = Uint8ClampedArray && Uint8ClampedArray.prototype;
|
||
var TypedArray = Int8Array && getPrototypeOf(Int8Array);
|
||
var TypedArrayPrototype = Int8ArrayPrototype && getPrototypeOf(Int8ArrayPrototype);
|
||
var ObjectPrototype = Object.prototype;
|
||
var TypeError = globalThis.TypeError;
|
||
|
||
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
||
var TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG');
|
||
var TYPED_ARRAY_CONSTRUCTOR = 'TypedArrayConstructor';
|
||
// Fixing native typed arrays in Opera Presto crashes the browser, see #595
|
||
var NATIVE_ARRAY_BUFFER_VIEWS = NATIVE_ARRAY_BUFFER && !!setPrototypeOf && classof(globalThis.opera) !== 'Opera';
|
||
var TYPED_ARRAY_TAG_REQUIRED = false;
|
||
var NAME, Constructor, Prototype;
|
||
|
||
var TypedArrayConstructorsList = {
|
||
Int8Array: 1,
|
||
Uint8Array: 1,
|
||
Uint8ClampedArray: 1,
|
||
Int16Array: 2,
|
||
Uint16Array: 2,
|
||
Int32Array: 4,
|
||
Uint32Array: 4,
|
||
Float32Array: 4,
|
||
Float64Array: 8
|
||
};
|
||
|
||
var BigIntArrayConstructorsList = {
|
||
BigInt64Array: 8,
|
||
BigUint64Array: 8
|
||
};
|
||
|
||
var isView = function isView(it) {
|
||
if (!isObject(it)) return false;
|
||
var klass = classof(it);
|
||
return klass === 'DataView'
|
||
|| hasOwn(TypedArrayConstructorsList, klass)
|
||
|| hasOwn(BigIntArrayConstructorsList, klass);
|
||
};
|
||
|
||
var getTypedArrayConstructor = function (it) {
|
||
var proto = getPrototypeOf(it);
|
||
if (!isObject(proto)) return;
|
||
var state = getInternalState(proto);
|
||
return (state && hasOwn(state, TYPED_ARRAY_CONSTRUCTOR)) ? state[TYPED_ARRAY_CONSTRUCTOR] : getTypedArrayConstructor(proto);
|
||
};
|
||
|
||
var isTypedArray = function (it) {
|
||
if (!isObject(it)) return false;
|
||
var klass = classof(it);
|
||
return hasOwn(TypedArrayConstructorsList, klass)
|
||
|| hasOwn(BigIntArrayConstructorsList, klass);
|
||
};
|
||
|
||
var aTypedArray = function (it) {
|
||
if (isTypedArray(it)) return it;
|
||
throw new TypeError('Target is not a typed array');
|
||
};
|
||
|
||
var aTypedArrayConstructor = function (C) {
|
||
if (isCallable(C) && (!setPrototypeOf || isPrototypeOf(TypedArray, C))) return C;
|
||
throw new TypeError(tryToString(C) + ' is not a typed array constructor');
|
||
};
|
||
|
||
var exportTypedArrayMethod = function (KEY, property, forced, options) {
|
||
if (!DESCRIPTORS) return;
|
||
if (forced) for (var ARRAY in TypedArrayConstructorsList) {
|
||
var TypedArrayConstructor = globalThis[ARRAY];
|
||
if (TypedArrayConstructor && hasOwn(TypedArrayConstructor.prototype, KEY)) try {
|
||
delete TypedArrayConstructor.prototype[KEY];
|
||
} catch (error) {
|
||
// old WebKit bug - some methods are non-configurable
|
||
try {
|
||
TypedArrayConstructor.prototype[KEY] = property;
|
||
} catch (error2) { /* empty */ }
|
||
}
|
||
}
|
||
if (!TypedArrayPrototype[KEY] || forced) {
|
||
defineBuiltIn(TypedArrayPrototype, KEY, forced ? property
|
||
: NATIVE_ARRAY_BUFFER_VIEWS && Int8ArrayPrototype[KEY] || property, options);
|
||
}
|
||
};
|
||
|
||
var exportTypedArrayStaticMethod = function (KEY, property, forced) {
|
||
var ARRAY, TypedArrayConstructor;
|
||
if (!DESCRIPTORS) return;
|
||
if (setPrototypeOf) {
|
||
if (forced) for (ARRAY in TypedArrayConstructorsList) {
|
||
TypedArrayConstructor = globalThis[ARRAY];
|
||
if (TypedArrayConstructor && hasOwn(TypedArrayConstructor, KEY)) try {
|
||
delete TypedArrayConstructor[KEY];
|
||
} catch (error) { /* empty */ }
|
||
}
|
||
if (!TypedArray[KEY] || forced) {
|
||
// V8 ~ Chrome 49-50 `%TypedArray%` methods are non-writable non-configurable
|
||
try {
|
||
return defineBuiltIn(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && TypedArray[KEY] || property);
|
||
} catch (error) { /* empty */ }
|
||
} else return;
|
||
}
|
||
for (ARRAY in TypedArrayConstructorsList) {
|
||
TypedArrayConstructor = globalThis[ARRAY];
|
||
if (TypedArrayConstructor && (!TypedArrayConstructor[KEY] || forced)) {
|
||
defineBuiltIn(TypedArrayConstructor, KEY, property);
|
||
}
|
||
}
|
||
};
|
||
|
||
for (NAME in TypedArrayConstructorsList) {
|
||
Constructor = globalThis[NAME];
|
||
Prototype = Constructor && Constructor.prototype;
|
||
if (Prototype) enforceInternalState(Prototype)[TYPED_ARRAY_CONSTRUCTOR] = Constructor;
|
||
else NATIVE_ARRAY_BUFFER_VIEWS = false;
|
||
}
|
||
|
||
for (NAME in BigIntArrayConstructorsList) {
|
||
Constructor = globalThis[NAME];
|
||
Prototype = Constructor && Constructor.prototype;
|
||
if (Prototype) enforceInternalState(Prototype)[TYPED_ARRAY_CONSTRUCTOR] = Constructor;
|
||
}
|
||
|
||
// WebKit bug - typed arrays constructors prototype is Object.prototype
|
||
if (!NATIVE_ARRAY_BUFFER_VIEWS || !isCallable(TypedArray) || TypedArray === Function.prototype) {
|
||
// eslint-disable-next-line no-shadow -- safe
|
||
TypedArray = function TypedArray() {
|
||
throw new TypeError('Incorrect invocation');
|
||
};
|
||
if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) {
|
||
if (globalThis[NAME]) setPrototypeOf(globalThis[NAME], TypedArray);
|
||
}
|
||
}
|
||
|
||
if (!NATIVE_ARRAY_BUFFER_VIEWS || !TypedArrayPrototype || TypedArrayPrototype === ObjectPrototype) {
|
||
TypedArrayPrototype = TypedArray.prototype;
|
||
if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) {
|
||
if (globalThis[NAME]) setPrototypeOf(globalThis[NAME].prototype, TypedArrayPrototype);
|
||
}
|
||
}
|
||
|
||
// WebKit bug - one more object in Uint8ClampedArray prototype chain
|
||
if (NATIVE_ARRAY_BUFFER_VIEWS && getPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype) {
|
||
setPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype);
|
||
}
|
||
|
||
if (DESCRIPTORS && !hasOwn(TypedArrayPrototype, TO_STRING_TAG)) {
|
||
TYPED_ARRAY_TAG_REQUIRED = true;
|
||
defineBuiltInAccessor(TypedArrayPrototype, TO_STRING_TAG, {
|
||
configurable: true,
|
||
get: function () {
|
||
return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined;
|
||
}
|
||
});
|
||
for (NAME in TypedArrayConstructorsList) if (globalThis[NAME]) {
|
||
createNonEnumerableProperty(globalThis[NAME].prototype, TYPED_ARRAY_TAG, NAME);
|
||
}
|
||
}
|
||
|
||
module.exports = {
|
||
NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS,
|
||
TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQUIRED && TYPED_ARRAY_TAG,
|
||
aTypedArray: aTypedArray,
|
||
aTypedArrayConstructor: aTypedArrayConstructor,
|
||
exportTypedArrayMethod: exportTypedArrayMethod,
|
||
exportTypedArrayStaticMethod: exportTypedArrayStaticMethod,
|
||
getTypedArrayConstructor: getTypedArrayConstructor,
|
||
isView: isView,
|
||
isTypedArray: isTypedArray,
|
||
TypedArray: TypedArray,
|
||
TypedArrayPrototype: TypedArrayPrototype
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/array-includes.js
|
||
var array_includes_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var toIndexedObject = (to_indexed_object_namespaceFn());
|
||
var toAbsoluteIndex = (to_absolute_index_namespaceFn());
|
||
var lengthOfArrayLike = (length_of_array_like_namespaceFn());
|
||
|
||
// `Array.prototype.{ indexOf, includes }` methods implementation
|
||
var createMethod = function (IS_INCLUDES) {
|
||
return function ($this, el, fromIndex) {
|
||
var O = toIndexedObject($this);
|
||
var length = lengthOfArrayLike(O);
|
||
if (length === 0) return !IS_INCLUDES && -1;
|
||
var index = toAbsoluteIndex(fromIndex, length);
|
||
var value;
|
||
// Array#includes uses SameValueZero equality algorithm
|
||
// eslint-disable-next-line no-self-compare -- NaN check
|
||
if (IS_INCLUDES && el !== el) while (length > index) {
|
||
value = O[index++];
|
||
// eslint-disable-next-line no-self-compare -- NaN check
|
||
if (value !== value) return true;
|
||
// Array#indexOf ignores holes, Array#includes - not
|
||
} else for (;length > index; index++) {
|
||
if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
|
||
} return !IS_INCLUDES && -1;
|
||
};
|
||
};
|
||
|
||
module.exports = {
|
||
// `Array.prototype.includes` method
|
||
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
||
includes: createMethod(true),
|
||
// `Array.prototype.indexOf` method
|
||
// https://tc39.es/ecma262/#sec-array.prototype.indexof
|
||
indexOf: createMethod(false)
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/array-set-length.js
|
||
var array_set_length_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var DESCRIPTORS = (descriptors_namespaceFn());
|
||
var isArray = (is_array_namespaceFn());
|
||
|
||
var $TypeError = TypeError;
|
||
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
||
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
||
|
||
// Safari < 13 does not throw an error in this case
|
||
var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS && !function () {
|
||
// makes no sense without proper strict mode support
|
||
if (this !== undefined) return true;
|
||
try {
|
||
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
||
Object.defineProperty([], 'length', { writable: false }).length = 1;
|
||
} catch (error) {
|
||
return error instanceof TypeError;
|
||
}
|
||
}();
|
||
|
||
module.exports = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function (O, length) {
|
||
if (isArray(O) && !getOwnPropertyDescriptor(O, 'length').writable) {
|
||
throw new $TypeError('Cannot set read only .length');
|
||
} return O.length = length;
|
||
} : function (O, length) {
|
||
return O.length = length;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/array-slice.js
|
||
var array_slice_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var uncurryThis = (function_uncurry_this_namespaceFn());
|
||
|
||
module.exports = uncurryThis([].slice);
|
||
|
||
});
|
||
|
||
// EXTERNAL MODULE: ./node_modules/core-js/internals/base64-map.js
|
||
var base64_map_namespaceFn = () => {
|
||
return __webpack_require__(804);
|
||
};
|
||
|
||
// MODULE: ./node_modules/core-js/internals/call-with-safe-iteration-closing.js
|
||
var call_with_safe_iteration_closing_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var anObject = (an_object_namespaceFn());
|
||
var iteratorClose = (iterator_close_namespaceFn());
|
||
|
||
// call something on iterator step with safe closing on error
|
||
module.exports = function (iterator, fn, value, ENTRIES) {
|
||
try {
|
||
return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
|
||
} catch (error) {
|
||
iteratorClose(iterator, 'throw', error);
|
||
}
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/classof-raw.js
|
||
var classof_raw_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var uncurryThis = (function_uncurry_this_namespaceFn());
|
||
|
||
var toString = uncurryThis({}.toString);
|
||
var stringSlice = uncurryThis(''.slice);
|
||
|
||
module.exports = function (it) {
|
||
return stringSlice(toString(it), 8, -1);
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/classof.js
|
||
var classof_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var TO_STRING_TAG_SUPPORT = (to_string_tag_support_namespaceFn());
|
||
var isCallable = (is_callable_namespaceFn());
|
||
var classofRaw = (classof_raw_namespaceFn());
|
||
var wellKnownSymbol = (well_known_symbol_namespaceFn());
|
||
|
||
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
||
var $Object = Object;
|
||
|
||
// ES3 wrong here
|
||
var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) === 'Arguments';
|
||
|
||
// fallback for IE11 Script Access Denied error
|
||
var tryGet = function (it, key) {
|
||
try {
|
||
return it[key];
|
||
} catch (error) { /* empty */ }
|
||
};
|
||
|
||
// getting tag from ES6+ `Object.prototype.toString`
|
||
module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
|
||
var O, tag, result;
|
||
return it === undefined ? 'Undefined' : it === null ? 'Null'
|
||
// @@toStringTag case
|
||
: typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
|
||
// builtinTag case
|
||
: CORRECT_ARGUMENTS ? classofRaw(O)
|
||
// ES3 arguments fallback
|
||
: (result = classofRaw(O)) === 'Object' && isCallable(O.callee) ? 'Arguments' : result;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/copy-constructor-properties.js
|
||
var copy_constructor_properties_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var hasOwn = (has_own_property_namespaceFn());
|
||
var ownKeys = (own_keys_namespaceFn());
|
||
var getOwnPropertyDescriptorModule = (object_get_own_property_descriptor_namespaceFn());
|
||
var definePropertyModule = (object_define_property_namespaceFn());
|
||
|
||
module.exports = function (target, source, exceptions) {
|
||
var keys = ownKeys(source);
|
||
var defineProperty = definePropertyModule.f;
|
||
var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
|
||
for (var i = 0; i < keys.length; i++) {
|
||
var key = keys[i];
|
||
if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
|
||
defineProperty(target, key, getOwnPropertyDescriptor(source, key));
|
||
}
|
||
}
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/correct-prototype-getter.js
|
||
var correct_prototype_getter_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var fails = (fails_namespaceFn());
|
||
|
||
module.exports = !fails(function () {
|
||
function F() { /* empty */ }
|
||
F.prototype.constructor = null;
|
||
// eslint-disable-next-line es/no-object-getprototypeof -- required for testing
|
||
return Object.getPrototypeOf(new F()) !== F.prototype;
|
||
});
|
||
|
||
});
|
||
|
||
// EXTERNAL MODULE: ./node_modules/core-js/internals/create-iter-result-object.js
|
||
var create_iter_result_object_namespaceFn = () => {
|
||
return __webpack_require__(529);
|
||
};
|
||
|
||
// MODULE: ./node_modules/core-js/internals/create-non-enumerable-property.js
|
||
var create_non_enumerable_property_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var DESCRIPTORS = (descriptors_namespaceFn());
|
||
var definePropertyModule = (object_define_property_namespaceFn());
|
||
var createPropertyDescriptor = (create_property_descriptor_namespaceFn());
|
||
|
||
module.exports = DESCRIPTORS ? function (object, key, value) {
|
||
return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
|
||
} : function (object, key, value) {
|
||
object[key] = value;
|
||
return object;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/create-property-descriptor.js
|
||
var create_property_descriptor_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
module.exports = function (bitmap, value) {
|
||
return {
|
||
enumerable: !(bitmap & 1),
|
||
configurable: !(bitmap & 2),
|
||
writable: !(bitmap & 4),
|
||
value: value
|
||
};
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/create-property.js
|
||
var create_property_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var DESCRIPTORS = (descriptors_namespaceFn());
|
||
var definePropertyModule = (object_define_property_namespaceFn());
|
||
var createPropertyDescriptor = (create_property_descriptor_namespaceFn());
|
||
|
||
module.exports = function (object, key, value) {
|
||
if (DESCRIPTORS) definePropertyModule.f(object, key, createPropertyDescriptor(0, value));
|
||
else object[key] = value;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/define-built-in-accessor.js
|
||
var define_built_in_accessor_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var makeBuiltIn = (make_built_in_namespaceFn());
|
||
var defineProperty = (object_define_property_namespaceFn());
|
||
|
||
module.exports = function (target, name, descriptor) {
|
||
if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true });
|
||
if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true });
|
||
return defineProperty.f(target, name, descriptor);
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/define-built-in.js
|
||
var define_built_in_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var isCallable = (is_callable_namespaceFn());
|
||
var definePropertyModule = (object_define_property_namespaceFn());
|
||
var makeBuiltIn = (make_built_in_namespaceFn());
|
||
var defineGlobalProperty = (define_global_property_namespaceFn());
|
||
|
||
module.exports = function (O, key, value, options) {
|
||
if (!options) options = {};
|
||
var simple = options.enumerable;
|
||
var name = options.name !== undefined ? options.name : key;
|
||
if (isCallable(value)) makeBuiltIn(value, name, options);
|
||
if (options.global) {
|
||
if (simple) O[key] = value;
|
||
else defineGlobalProperty(key, value);
|
||
} else {
|
||
try {
|
||
if (!options.unsafe) delete O[key];
|
||
else if (O[key]) simple = true;
|
||
} catch (error) { /* empty */ }
|
||
if (simple) O[key] = value;
|
||
else definePropertyModule.f(O, key, {
|
||
value: value,
|
||
enumerable: false,
|
||
configurable: !options.nonConfigurable,
|
||
writable: !options.nonWritable
|
||
});
|
||
} return O;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/define-built-ins.js
|
||
var define_built_ins_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var defineBuiltIn = (define_built_in_namespaceFn());
|
||
|
||
module.exports = function (target, src, options) {
|
||
for (var key in src) defineBuiltIn(target, key, src[key], options);
|
||
return target;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/define-global-property.js
|
||
var define_global_property_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var globalThis = (global_this_namespaceFn());
|
||
|
||
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
||
var defineProperty = Object.defineProperty;
|
||
|
||
module.exports = function (key, value) {
|
||
try {
|
||
defineProperty(globalThis, key, { value: value, configurable: true, writable: true });
|
||
} catch (error) {
|
||
globalThis[key] = value;
|
||
} return value;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/descriptors.js
|
||
var descriptors_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var fails = (fails_namespaceFn());
|
||
|
||
// Detect IE8's incomplete defineProperty implementation
|
||
module.exports = !fails(function () {
|
||
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
||
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7;
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/document-create-element.js
|
||
var document_create_element_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var globalThis = (global_this_namespaceFn());
|
||
var isObject = (is_object_namespaceFn());
|
||
|
||
var document = globalThis.document;
|
||
// typeof document.createElement is 'object' in old IE
|
||
var EXISTS = isObject(document) && isObject(document.createElement);
|
||
|
||
module.exports = function (it) {
|
||
return EXISTS ? document.createElement(it) : {};
|
||
};
|
||
|
||
});
|
||
|
||
// EXTERNAL MODULE: ./node_modules/core-js/internals/does-not-exceed-safe-integer.js
|
||
var does_not_exceed_safe_integer_namespaceFn = () => {
|
||
return __webpack_require__(837);
|
||
};
|
||
|
||
// EXTERNAL MODULE: ./node_modules/core-js/internals/dom-exception-constants.js
|
||
var dom_exception_constants_namespaceFn = () => {
|
||
return __webpack_require__(2);
|
||
};
|
||
|
||
// MODULE: ./node_modules/core-js/internals/enum-bug-keys.js
|
||
var enum_bug_keys_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
// IE8- don't enum bug keys
|
||
module.exports = [
|
||
'constructor',
|
||
'hasOwnProperty',
|
||
'isPrototypeOf',
|
||
'propertyIsEnumerable',
|
||
'toLocaleString',
|
||
'toString',
|
||
'valueOf'
|
||
];
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/environment-user-agent.js
|
||
var environment_user_agent_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var globalThis = (global_this_namespaceFn());
|
||
|
||
var navigator = globalThis.navigator;
|
||
var userAgent = navigator && navigator.userAgent;
|
||
|
||
module.exports = userAgent ? String(userAgent) : '';
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/environment-v8-version.js
|
||
var environment_v8_version_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var globalThis = (global_this_namespaceFn());
|
||
var userAgent = (environment_user_agent_namespaceFn());
|
||
|
||
var process = globalThis.process;
|
||
var Deno = globalThis.Deno;
|
||
var versions = process && process.versions || Deno && Deno.version;
|
||
var v8 = versions && versions.v8;
|
||
var match, version;
|
||
|
||
if (v8) {
|
||
match = v8.split('.');
|
||
// in old Chrome, versions of V8 isn't V8 = Chrome / 10
|
||
// but their correct versions are not interesting for us
|
||
version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
|
||
}
|
||
|
||
// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
|
||
// so check `userAgent` even if `.v8` exists, but 0
|
||
if (!version && userAgent) {
|
||
match = userAgent.match(/Edge\/(\d+)/);
|
||
if (!match || match[1] >= 74) {
|
||
match = userAgent.match(/Chrome\/(\d+)/);
|
||
if (match) version = +match[1];
|
||
}
|
||
}
|
||
|
||
module.exports = version;
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/error-stack-clear.js
|
||
var error_stack_clear_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var uncurryThis = (function_uncurry_this_namespaceFn());
|
||
|
||
var $Error = Error;
|
||
var replace = uncurryThis(''.replace);
|
||
|
||
var TEST = (function (arg) { return String(new $Error(arg).stack); })('zxcasd');
|
||
// eslint-disable-next-line redos/no-vulnerable -- safe
|
||
var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/;
|
||
var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST);
|
||
|
||
module.exports = function (stack, dropEntries) {
|
||
if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error.prepareStackTrace) {
|
||
while (dropEntries--) stack = replace(stack, V8_OR_CHAKRA_STACK_ENTRY, '');
|
||
} return stack;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/export.js
|
||
var export_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var globalThis = (global_this_namespaceFn());
|
||
var getOwnPropertyDescriptor = (object_get_own_property_descriptor_namespaceFn().f);
|
||
var createNonEnumerableProperty = (create_non_enumerable_property_namespaceFn());
|
||
var defineBuiltIn = (define_built_in_namespaceFn());
|
||
var defineGlobalProperty = (define_global_property_namespaceFn());
|
||
var copyConstructorProperties = (copy_constructor_properties_namespaceFn());
|
||
var isForced = (is_forced_namespaceFn());
|
||
|
||
/*
|
||
options.target - name of the target object
|
||
options.global - target is the global object
|
||
options.stat - export as static methods of target
|
||
options.proto - export as prototype methods of target
|
||
options.real - real prototype method for the `pure` version
|
||
options.forced - export even if the native feature is available
|
||
options.bind - bind methods to the target, required for the `pure` version
|
||
options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
|
||
options.unsafe - use the simple assignment of property instead of delete + defineProperty
|
||
options.sham - add a flag to not completely full polyfills
|
||
options.enumerable - export as enumerable property
|
||
options.dontCallGetSet - prevent calling a getter on target
|
||
options.name - the .name of the function if it does not match the key
|
||
*/
|
||
module.exports = function (options, source) {
|
||
var TARGET = options.target;
|
||
var GLOBAL = options.global;
|
||
var STATIC = options.stat;
|
||
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
|
||
if (GLOBAL) {
|
||
target = globalThis;
|
||
} else if (STATIC) {
|
||
target = globalThis[TARGET] || defineGlobalProperty(TARGET, {});
|
||
} else {
|
||
target = globalThis[TARGET] && globalThis[TARGET].prototype;
|
||
}
|
||
if (target) for (key in source) {
|
||
sourceProperty = source[key];
|
||
if (options.dontCallGetSet) {
|
||
descriptor = getOwnPropertyDescriptor(target, key);
|
||
targetProperty = descriptor && descriptor.value;
|
||
} else targetProperty = target[key];
|
||
FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
|
||
// contained in target
|
||
if (!FORCED && targetProperty !== undefined) {
|
||
if (typeof sourceProperty == typeof targetProperty) continue;
|
||
copyConstructorProperties(sourceProperty, targetProperty);
|
||
}
|
||
// add a flag to not completely full polyfills
|
||
if (options.sham || (targetProperty && targetProperty.sham)) {
|
||
createNonEnumerableProperty(sourceProperty, 'sham', true);
|
||
}
|
||
defineBuiltIn(target, key, sourceProperty, options);
|
||
}
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/fails.js
|
||
var fails_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
module.exports = function (exec) {
|
||
try {
|
||
return !!exec();
|
||
} catch (error) {
|
||
return true;
|
||
}
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/function-apply.js
|
||
var function_apply_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var NATIVE_BIND = (function_bind_native_namespaceFn());
|
||
|
||
var FunctionPrototype = Function.prototype;
|
||
var apply = FunctionPrototype.apply;
|
||
var call = FunctionPrototype.call;
|
||
|
||
// eslint-disable-next-line es/no-function-prototype-bind, es/no-reflect -- safe
|
||
module.exports = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function () {
|
||
return call.apply(apply, arguments);
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/function-bind-context.js
|
||
var function_bind_context_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var uncurryThis = (function_uncurry_this_clause_namespaceFn());
|
||
var aCallable = (a_callable_namespaceFn());
|
||
var NATIVE_BIND = (function_bind_native_namespaceFn());
|
||
|
||
var bind = uncurryThis(uncurryThis.bind);
|
||
|
||
// optional / simple context binding
|
||
module.exports = function (fn, that) {
|
||
aCallable(fn);
|
||
return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function (/* ...args */) {
|
||
return fn.apply(that, arguments);
|
||
};
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/function-bind-native.js
|
||
var function_bind_native_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var fails = (fails_namespaceFn());
|
||
|
||
module.exports = !fails(function () {
|
||
// eslint-disable-next-line es/no-function-prototype-bind -- safe
|
||
var test = function () { /* empty */ }.bind();
|
||
// eslint-disable-next-line no-prototype-builtins -- safe
|
||
return typeof test != 'function' || test.hasOwnProperty('prototype');
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/function-call.js
|
||
var function_call_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var NATIVE_BIND = (function_bind_native_namespaceFn());
|
||
|
||
var call = Function.prototype.call;
|
||
// eslint-disable-next-line es/no-function-prototype-bind -- safe
|
||
module.exports = NATIVE_BIND ? call.bind(call) : function () {
|
||
return call.apply(call, arguments);
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/function-name.js
|
||
var function_name_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var DESCRIPTORS = (descriptors_namespaceFn());
|
||
var hasOwn = (has_own_property_namespaceFn());
|
||
|
||
var FunctionPrototype = Function.prototype;
|
||
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
||
var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
|
||
|
||
var EXISTS = hasOwn(FunctionPrototype, 'name');
|
||
// additional protection from minified / mangled / dropped function names
|
||
var PROPER = EXISTS && function something() { /* empty */ }.name === 'something';
|
||
var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));
|
||
|
||
module.exports = {
|
||
...(/* unused pure expression */ null && (EXISTS)),
|
||
...(/* unused pure expression */ null && (PROPER)),
|
||
CONFIGURABLE: CONFIGURABLE
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/function-uncurry-this-accessor.js
|
||
var function_uncurry_this_accessor_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var uncurryThis = (function_uncurry_this_namespaceFn());
|
||
var aCallable = (a_callable_namespaceFn());
|
||
|
||
module.exports = function (object, key, method) {
|
||
try {
|
||
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
||
return uncurryThis(aCallable(Object.getOwnPropertyDescriptor(object, key)[method]));
|
||
} catch (error) { /* empty */ }
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/function-uncurry-this-clause.js
|
||
var function_uncurry_this_clause_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var classofRaw = (classof_raw_namespaceFn());
|
||
var uncurryThis = (function_uncurry_this_namespaceFn());
|
||
|
||
module.exports = function (fn) {
|
||
// Nashorn bug:
|
||
// https://github.com/zloirock/core-js/issues/1128
|
||
// https://github.com/zloirock/core-js/issues/1130
|
||
if (classofRaw(fn) === 'Function') return uncurryThis(fn);
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/function-uncurry-this.js
|
||
var function_uncurry_this_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var NATIVE_BIND = (function_bind_native_namespaceFn());
|
||
|
||
var FunctionPrototype = Function.prototype;
|
||
var call = FunctionPrototype.call;
|
||
// eslint-disable-next-line es/no-function-prototype-bind -- safe
|
||
var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call);
|
||
|
||
module.exports = NATIVE_BIND ? uncurryThisWithBind : function (fn) {
|
||
return function () {
|
||
return call.apply(fn, arguments);
|
||
};
|
||
};
|
||
|
||
});
|
||
|
||
// EXTERNAL MODULE: ./node_modules/core-js/internals/get-alphabet-option.js
|
||
var get_alphabet_option_namespaceFn = () => {
|
||
return __webpack_require__(944);
|
||
};
|
||
|
||
// MODULE: ./node_modules/core-js/internals/get-built-in.js
|
||
var get_built_in_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var globalThis = (global_this_namespaceFn());
|
||
var isCallable = (is_callable_namespaceFn());
|
||
|
||
var aFunction = function (argument) {
|
||
return isCallable(argument) ? argument : undefined;
|
||
};
|
||
|
||
module.exports = function (namespace, method) {
|
||
return arguments.length < 2 ? aFunction(globalThis[namespace]) : globalThis[namespace] && globalThis[namespace][method];
|
||
};
|
||
|
||
});
|
||
|
||
// EXTERNAL MODULE: ./node_modules/core-js/internals/get-iterator-direct.js
|
||
var get_iterator_direct_namespaceFn = () => {
|
||
return __webpack_require__(767);
|
||
};
|
||
|
||
// MODULE: ./node_modules/core-js/internals/get-iterator-internal.js
|
||
var get_iterator_internal_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var call = (function_call_namespaceFn());
|
||
var isCallable = (is_callable_namespaceFn());
|
||
var anObject = (an_object_namespaceFn());
|
||
var tryToString = (try_to_string_namespaceFn());
|
||
var getIteratorMethod = (get_iterator_method_internal_namespaceFn());
|
||
|
||
var $TypeError = TypeError;
|
||
|
||
module.exports = function (argument, usingIterator) {
|
||
var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
|
||
if (isCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument));
|
||
throw new $TypeError(tryToString(argument) + ' is not iterable');
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/get-iterator-method-internal.js
|
||
var get_iterator_method_internal_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var classof = (classof_raw_namespaceFn());
|
||
var isNullOrUndefined = (is_null_or_undefined_namespaceFn());
|
||
var getMethod = (get_method_namespaceFn());
|
||
var wellKnownSymbol = (well_known_symbol_namespaceFn());
|
||
|
||
var ITERATOR = wellKnownSymbol('iterator');
|
||
var ArrayPrototype = Array.prototype;
|
||
|
||
module.exports = function (it) {
|
||
if (!isNullOrUndefined(it)) return getMethod(it, ITERATOR)
|
||
|| getMethod(it, '@@iterator')
|
||
|| (classof(it) === 'Arguments' ? ArrayPrototype[ITERATOR] : undefined);
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/get-method.js
|
||
var get_method_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var aCallable = (a_callable_namespaceFn());
|
||
var isNullOrUndefined = (is_null_or_undefined_namespaceFn());
|
||
|
||
// `GetMethod` abstract operation
|
||
// https://tc39.es/ecma262/#sec-getmethod
|
||
module.exports = function (V, P) {
|
||
var func = V[P];
|
||
return isNullOrUndefined(func) ? undefined : aCallable(func);
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/get-set-record.js
|
||
var get_set_record_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var aCallable = (a_callable_namespaceFn());
|
||
var anObject = (an_object_namespaceFn());
|
||
var call = (function_call_namespaceFn());
|
||
var toIntegerOrInfinity = (to_integer_or_infinity_namespaceFn());
|
||
var getIteratorDirect = (get_iterator_direct_namespaceFn());
|
||
|
||
var INVALID_SIZE = 'Invalid size';
|
||
var $RangeError = RangeError;
|
||
var $TypeError = TypeError;
|
||
var max = Math.max;
|
||
|
||
var SetRecord = function (set, intSize) {
|
||
this.set = set;
|
||
this.size = max(intSize, 0);
|
||
this.has = aCallable(set.has);
|
||
this.keys = aCallable(set.keys);
|
||
};
|
||
|
||
SetRecord.prototype = {
|
||
getIterator: function () {
|
||
return getIteratorDirect(anObject(call(this.keys, this.set)));
|
||
},
|
||
includes: function (it) {
|
||
return call(this.has, this.set, it);
|
||
}
|
||
};
|
||
|
||
// `GetSetRecord` abstract operation
|
||
// https://tc39.es/proposal-set-methods/#sec-getsetrecord
|
||
module.exports = function (obj) {
|
||
anObject(obj);
|
||
var numSize = +obj.size;
|
||
// NOTE: If size is undefined, then numSize will be NaN
|
||
// eslint-disable-next-line no-self-compare -- NaN check
|
||
if (numSize !== numSize) throw new $TypeError(INVALID_SIZE);
|
||
var intSize = toIntegerOrInfinity(numSize);
|
||
if (intSize < 0) throw new $RangeError(INVALID_SIZE);
|
||
return new SetRecord(obj, intSize);
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/global-this.js
|
||
var global_this_namespaceFn = /*#__PURE__*/__webpack_require__.cw(function(module) {
|
||
|
||
var check = function (it) {
|
||
return it && it.Math === Math && it;
|
||
};
|
||
|
||
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
||
module.exports =
|
||
// eslint-disable-next-line es/no-global-this -- safe
|
||
check(typeof globalThis == 'object' && globalThis) ||
|
||
check(typeof window == 'object' && window) ||
|
||
// eslint-disable-next-line no-restricted-globals -- safe
|
||
check(typeof self == 'object' && self) ||
|
||
check(typeof global == 'object' && global) ||
|
||
check(typeof this == 'object' && this) ||
|
||
// eslint-disable-next-line no-new-func -- fallback
|
||
(function () { return this; })() || Function('return this')();
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/has-own-property.js
|
||
var has_own_property_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var uncurryThis = (function_uncurry_this_namespaceFn());
|
||
var toObject = (to_object_namespaceFn());
|
||
|
||
var hasOwnProperty = uncurryThis({}.hasOwnProperty);
|
||
|
||
// `HasOwnProperty` abstract operation
|
||
// https://tc39.es/ecma262/#sec-hasownproperty
|
||
// eslint-disable-next-line es/no-object-hasown -- safe
|
||
module.exports = Object.hasOwn || function hasOwn(it, key) {
|
||
return hasOwnProperty(toObject(it), key);
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/hidden-keys.js
|
||
var hidden_keys_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
module.exports = {};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/html.js
|
||
var html_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var getBuiltIn = (get_built_in_namespaceFn());
|
||
|
||
module.exports = getBuiltIn('document', 'documentElement');
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/ie8-dom-define.js
|
||
var ie8_dom_define_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var DESCRIPTORS = (descriptors_namespaceFn());
|
||
var fails = (fails_namespaceFn());
|
||
var createElement = (document_create_element_namespaceFn());
|
||
|
||
// Thanks to IE8 for its funny defineProperty
|
||
module.exports = !DESCRIPTORS && !fails(function () {
|
||
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
||
return Object.defineProperty(createElement('div'), 'a', {
|
||
get: function () { return 7; }
|
||
}).a !== 7;
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/indexed-object.js
|
||
var indexed_object_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var uncurryThis = (function_uncurry_this_namespaceFn());
|
||
var fails = (fails_namespaceFn());
|
||
var classof = (classof_raw_namespaceFn());
|
||
|
||
var $Object = Object;
|
||
var split = uncurryThis(''.split);
|
||
|
||
// fallback for non-array-like ES3 and non-enumerable old V8 strings
|
||
module.exports = fails(function () {
|
||
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
|
||
// eslint-disable-next-line no-prototype-builtins -- safe
|
||
return !$Object('z').propertyIsEnumerable(0);
|
||
}) ? function (it) {
|
||
return classof(it) === 'String' ? split(it, '') : $Object(it);
|
||
} : $Object;
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/inherit-if-required.js
|
||
var inherit_if_required_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var isCallable = (is_callable_namespaceFn());
|
||
var isObject = (is_object_namespaceFn());
|
||
var setPrototypeOf = (object_set_prototype_of_namespaceFn());
|
||
|
||
// makes subclassing work correct for wrapped built-ins
|
||
module.exports = function ($this, dummy, Wrapper) {
|
||
var NewTarget, NewTargetPrototype;
|
||
if (
|
||
// it can work only with native `setPrototypeOf`
|
||
setPrototypeOf &&
|
||
// we haven't completely correct pre-ES6 way for getting `new.target`, so use this
|
||
isCallable(NewTarget = dummy.constructor) &&
|
||
NewTarget !== Wrapper &&
|
||
isObject(NewTargetPrototype = NewTarget.prototype) &&
|
||
NewTargetPrototype !== Wrapper.prototype
|
||
) setPrototypeOf($this, NewTargetPrototype);
|
||
return $this;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/inspect-source.js
|
||
var inspect_source_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var uncurryThis = (function_uncurry_this_namespaceFn());
|
||
var isCallable = (is_callable_namespaceFn());
|
||
var store = (shared_store_namespaceFn());
|
||
|
||
var functionToString = uncurryThis(Function.toString);
|
||
|
||
// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
|
||
if (!isCallable(store.inspectSource)) {
|
||
store.inspectSource = function (it) {
|
||
return functionToString(it);
|
||
};
|
||
}
|
||
|
||
module.exports = store.inspectSource;
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/internal-state.js
|
||
var internal_state_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var NATIVE_WEAK_MAP = (weak_map_basic_detection_namespaceFn());
|
||
var globalThis = (global_this_namespaceFn());
|
||
var isObject = (is_object_namespaceFn());
|
||
var createNonEnumerableProperty = (create_non_enumerable_property_namespaceFn());
|
||
var hasOwn = (has_own_property_namespaceFn());
|
||
var shared = (shared_store_namespaceFn());
|
||
var sharedKey = (shared_key_namespaceFn());
|
||
var hiddenKeys = (hidden_keys_namespaceFn());
|
||
|
||
var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
|
||
var TypeError = globalThis.TypeError;
|
||
var WeakMap = globalThis.WeakMap;
|
||
var set, get, has;
|
||
|
||
var enforce = function (it) {
|
||
return has(it) ? get(it) : set(it, {});
|
||
};
|
||
|
||
var getterFor = function (TYPE) {
|
||
return function (it) {
|
||
var state;
|
||
if (!isObject(it) || (state = get(it)).type !== TYPE) {
|
||
throw new TypeError('Incompatible receiver, ' + TYPE + ' required');
|
||
} return state;
|
||
};
|
||
};
|
||
|
||
if (NATIVE_WEAK_MAP || shared.state) {
|
||
var store = shared.state || (shared.state = new WeakMap());
|
||
/* eslint-disable no-self-assign -- prototype methods protection */
|
||
store.get = store.get;
|
||
store.has = store.has;
|
||
store.set = store.set;
|
||
/* eslint-enable no-self-assign -- prototype methods protection */
|
||
set = function (it, metadata) {
|
||
if (store.has(it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
|
||
metadata.facade = it;
|
||
store.set(it, metadata);
|
||
return metadata;
|
||
};
|
||
get = function (it) {
|
||
return store.get(it) || {};
|
||
};
|
||
has = function (it) {
|
||
return store.has(it);
|
||
};
|
||
} else {
|
||
var STATE = sharedKey('state');
|
||
hiddenKeys[STATE] = true;
|
||
set = function (it, metadata) {
|
||
if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
|
||
metadata.facade = it;
|
||
createNonEnumerableProperty(it, STATE, metadata);
|
||
return metadata;
|
||
};
|
||
get = function (it) {
|
||
return hasOwn(it, STATE) ? it[STATE] : {};
|
||
};
|
||
has = function (it) {
|
||
return hasOwn(it, STATE);
|
||
};
|
||
}
|
||
|
||
module.exports = {
|
||
set: set,
|
||
get: get,
|
||
has: has,
|
||
enforce: enforce,
|
||
getterFor: getterFor
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/is-array-iterator-method.js
|
||
var is_array_iterator_method_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var wellKnownSymbol = (well_known_symbol_namespaceFn());
|
||
var Iterators = (iterators_namespaceFn());
|
||
|
||
var ITERATOR = wellKnownSymbol('iterator');
|
||
var ArrayPrototype = Array.prototype;
|
||
|
||
// check on default Array iterator
|
||
module.exports = function (it) {
|
||
return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/is-array.js
|
||
var is_array_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var classof = (classof_raw_namespaceFn());
|
||
|
||
// `IsArray` abstract operation
|
||
// https://tc39.es/ecma262/#sec-isarray
|
||
// eslint-disable-next-line es/no-array-isarray -- safe
|
||
module.exports = Array.isArray || function isArray(argument) {
|
||
return classof(argument) === 'Array';
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/is-big-int-array.js
|
||
var is_big_int_array_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var classof = (classof_namespaceFn());
|
||
|
||
module.exports = function (it) {
|
||
var klass = classof(it);
|
||
return klass === 'BigInt64Array' || klass === 'BigUint64Array';
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/is-callable.js
|
||
var is_callable_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
|
||
var documentAll = typeof document == 'object' && document.all;
|
||
|
||
// `IsCallable` abstract operation
|
||
// https://tc39.es/ecma262/#sec-iscallable
|
||
// eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing
|
||
module.exports = typeof documentAll == 'undefined' && documentAll !== undefined ? function (argument) {
|
||
return typeof argument == 'function' || argument === documentAll;
|
||
} : function (argument) {
|
||
return typeof argument == 'function';
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/is-forced.js
|
||
var is_forced_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var fails = (fails_namespaceFn());
|
||
var isCallable = (is_callable_namespaceFn());
|
||
|
||
var replacement = /#|\.prototype\./;
|
||
|
||
var isForced = function (feature, detection) {
|
||
var value = data[normalize(feature)];
|
||
return value === POLYFILL ? true
|
||
: value === NATIVE ? false
|
||
: isCallable(detection) ? fails(detection)
|
||
: !!detection;
|
||
};
|
||
|
||
var normalize = isForced.normalize = function (string) {
|
||
return String(string).replace(replacement, '.').toLowerCase();
|
||
};
|
||
|
||
var data = isForced.data = {};
|
||
var NATIVE = isForced.NATIVE = 'N';
|
||
var POLYFILL = isForced.POLYFILL = 'P';
|
||
|
||
module.exports = isForced;
|
||
|
||
});
|
||
|
||
// EXTERNAL MODULE: ./node_modules/core-js/internals/is-null-or-undefined.js
|
||
var is_null_or_undefined_namespaceFn = () => {
|
||
return __webpack_require__(117);
|
||
};
|
||
|
||
// MODULE: ./node_modules/core-js/internals/is-object.js
|
||
var is_object_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var isCallable = (is_callable_namespaceFn());
|
||
|
||
module.exports = function (it) {
|
||
return typeof it == 'object' ? it !== null : isCallable(it);
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/is-possible-prototype.js
|
||
var is_possible_prototype_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var isObject = (is_object_namespaceFn());
|
||
|
||
module.exports = function (argument) {
|
||
return isObject(argument) || argument === null;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/is-pure.js
|
||
var is_pure_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
module.exports = false;
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/is-raw-json.js
|
||
var is_raw_json_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var isObject = (is_object_namespaceFn());
|
||
var getInternalState = (internal_state_namespaceFn().get);
|
||
|
||
module.exports = function isRawJSON(O) {
|
||
if (!isObject(O)) return false;
|
||
var state = getInternalState(O);
|
||
return !!state && state.type === 'RawJSON';
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/is-symbol.js
|
||
var is_symbol_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var getBuiltIn = (get_built_in_namespaceFn());
|
||
var isCallable = (is_callable_namespaceFn());
|
||
var isPrototypeOf = (object_is_prototype_of_namespaceFn());
|
||
var USE_SYMBOL_AS_UID = (use_symbol_as_uid_namespaceFn());
|
||
|
||
var $Object = Object;
|
||
|
||
module.exports = USE_SYMBOL_AS_UID ? function (it) {
|
||
return typeof it == 'symbol';
|
||
} : function (it) {
|
||
var $Symbol = getBuiltIn('Symbol');
|
||
return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/iterate-simple.js
|
||
var iterate_simple_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var call = (function_call_namespaceFn());
|
||
|
||
module.exports = function (record, fn, ITERATOR_INSTEAD_OF_RECORD) {
|
||
var iterator = ITERATOR_INSTEAD_OF_RECORD ? record : record.iterator;
|
||
var next = record.next;
|
||
var step, result;
|
||
while (!(step = call(next, iterator)).done) {
|
||
result = fn(step.value);
|
||
if (result !== undefined) return result;
|
||
}
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/iterate.js
|
||
var iterate_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var bind = (function_bind_context_namespaceFn());
|
||
var call = (function_call_namespaceFn());
|
||
var anObject = (an_object_namespaceFn());
|
||
var tryToString = (try_to_string_namespaceFn());
|
||
var isArrayIteratorMethod = (is_array_iterator_method_namespaceFn());
|
||
var lengthOfArrayLike = (length_of_array_like_namespaceFn());
|
||
var isPrototypeOf = (object_is_prototype_of_namespaceFn());
|
||
var getIterator = (get_iterator_internal_namespaceFn());
|
||
var getIteratorMethod = (get_iterator_method_internal_namespaceFn());
|
||
var iteratorClose = (iterator_close_namespaceFn());
|
||
|
||
var $TypeError = TypeError;
|
||
|
||
var Result = function (stopped, result) {
|
||
this.stopped = stopped;
|
||
this.result = result;
|
||
};
|
||
|
||
var ResultPrototype = Result.prototype;
|
||
|
||
module.exports = function (iterable, unboundFunction, options) {
|
||
var that = options && options.that;
|
||
var AS_ENTRIES = !!(options && options.AS_ENTRIES);
|
||
var IS_RECORD = !!(options && options.IS_RECORD);
|
||
var IS_ITERATOR = !!(options && options.IS_ITERATOR);
|
||
var INTERRUPTED = !!(options && options.INTERRUPTED);
|
||
var fn = bind(unboundFunction, that);
|
||
var iterator, iterFn, index, length, result, next, step;
|
||
|
||
var stop = function (condition) {
|
||
var $iterator = iterator;
|
||
iterator = undefined;
|
||
if ($iterator) iteratorClose($iterator, 'normal');
|
||
return new Result(true, condition);
|
||
};
|
||
|
||
var callFn = function (value) {
|
||
if (AS_ENTRIES) {
|
||
anObject(value);
|
||
return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
|
||
} return INTERRUPTED ? fn(value, stop) : fn(value);
|
||
};
|
||
|
||
if (IS_RECORD) {
|
||
iterator = iterable.iterator;
|
||
} else if (IS_ITERATOR) {
|
||
iterator = iterable;
|
||
} else {
|
||
iterFn = getIteratorMethod(iterable);
|
||
if (!iterFn) throw new $TypeError(tryToString(iterable) + ' is not iterable');
|
||
// optimisation for array iterators
|
||
if (isArrayIteratorMethod(iterFn)) {
|
||
for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
|
||
result = callFn(iterable[index]);
|
||
if (result && isPrototypeOf(ResultPrototype, result)) return result;
|
||
} return new Result(false);
|
||
}
|
||
iterator = getIterator(iterable, iterFn);
|
||
}
|
||
|
||
next = IS_RECORD ? iterable.next : iterator.next;
|
||
while (!(step = call(next, iterator)).done) {
|
||
// `IteratorValue` errors should propagate without closing the iterator
|
||
var value = step.value;
|
||
try {
|
||
result = callFn(value);
|
||
} catch (error) {
|
||
if (iterator) iteratorClose(iterator, 'throw', error);
|
||
else throw error;
|
||
}
|
||
if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;
|
||
} return new Result(false);
|
||
};
|
||
|
||
});
|
||
|
||
// EXTERNAL MODULE: ./node_modules/core-js/internals/iterator-cleanup-state.js
|
||
var iterator_cleanup_state_namespaceFn = () => {
|
||
return __webpack_require__(859);
|
||
};
|
||
|
||
// MODULE: ./node_modules/core-js/internals/iterator-close-all.js
|
||
var iterator_close_all_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var iteratorClose = (iterator_close_namespaceFn());
|
||
|
||
module.exports = function (iters, kind, value) {
|
||
for (var i = iters.length - 1; i >= 0; i--) {
|
||
if (iters[i] === undefined) continue;
|
||
try {
|
||
value = iteratorClose(iters[i].iterator, kind, value);
|
||
} catch (error) {
|
||
kind = 'throw';
|
||
value = error;
|
||
}
|
||
}
|
||
if (kind === 'throw') throw value;
|
||
return value;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/iterator-close.js
|
||
var iterator_close_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var call = (function_call_namespaceFn());
|
||
var anObject = (an_object_namespaceFn());
|
||
var getMethod = (get_method_namespaceFn());
|
||
|
||
module.exports = function (iterator, kind, value) {
|
||
var innerResult, innerError;
|
||
anObject(iterator);
|
||
try {
|
||
innerResult = getMethod(iterator, 'return');
|
||
if (!innerResult) {
|
||
if (kind === 'throw') throw value;
|
||
return value;
|
||
}
|
||
innerResult = call(innerResult, iterator);
|
||
} catch (error) {
|
||
innerError = true;
|
||
innerResult = error;
|
||
}
|
||
if (kind === 'throw') throw value;
|
||
if (innerError) throw innerResult;
|
||
anObject(innerResult);
|
||
return value;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/iterator-create-proxy.js
|
||
var iterator_create_proxy_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var call = (function_call_namespaceFn());
|
||
var create = (object_create_namespaceFn());
|
||
var createNonEnumerableProperty = (create_non_enumerable_property_namespaceFn());
|
||
var defineBuiltIns = (define_built_ins_namespaceFn());
|
||
var wellKnownSymbol = (well_known_symbol_namespaceFn());
|
||
var InternalStateModule = (internal_state_namespaceFn());
|
||
var getMethod = (get_method_namespaceFn());
|
||
var IteratorPrototype = (iterators_core_namespaceFn().IteratorPrototype);
|
||
var createIterResultObject = (create_iter_result_object_namespaceFn());
|
||
var iteratorClose = (iterator_close_namespaceFn());
|
||
var iteratorCloseAll = (iterator_close_all_namespaceFn());
|
||
var cleanupState = (iterator_cleanup_state_namespaceFn());
|
||
|
||
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
||
var ITERATOR_HELPER = 'IteratorHelper';
|
||
var WRAP_FOR_VALID_ITERATOR = 'WrapForValidIterator';
|
||
var NORMAL = 'normal';
|
||
var THROW = 'throw';
|
||
var setInternalState = InternalStateModule.set;
|
||
|
||
var createIteratorProxyPrototype = function (IS_ITERATOR) {
|
||
var getInternalState = InternalStateModule.getterFor(IS_ITERATOR ? WRAP_FOR_VALID_ITERATOR : ITERATOR_HELPER);
|
||
|
||
return defineBuiltIns(create(IteratorPrototype), {
|
||
next: function next() {
|
||
var state = getInternalState(this);
|
||
// for simplification:
|
||
// for `%WrapForValidIteratorPrototype%.next` or with `state.returnHandlerResult` our `nextHandler` returns `IterResultObject`
|
||
// for `%IteratorHelperPrototype%.next` - just a value
|
||
if (IS_ITERATOR) return state.nextHandler();
|
||
if (state.done) return createIterResultObject(undefined, true);
|
||
try {
|
||
var result = state.nextHandler();
|
||
if (state.done) cleanupState(state);
|
||
return state.returnHandlerResult ? result : createIterResultObject(result, state.done);
|
||
} catch (error) {
|
||
state.done = true;
|
||
cleanupState(state);
|
||
throw error;
|
||
}
|
||
},
|
||
'return': function () {
|
||
var state = getInternalState(this);
|
||
var iterator = state.iterator;
|
||
var inner = state.inner;
|
||
var openIters = state.openIters;
|
||
var done = state.done;
|
||
state.done = true;
|
||
if (IS_ITERATOR) {
|
||
var returnMethod = getMethod(iterator, 'return');
|
||
return returnMethod ? call(returnMethod, iterator) : createIterResultObject(undefined, true);
|
||
}
|
||
cleanupState(state);
|
||
if (done) return createIterResultObject(undefined, true);
|
||
if (inner) try {
|
||
iteratorClose(inner.iterator, NORMAL);
|
||
} catch (error) {
|
||
return iteratorClose(iterator, THROW, error);
|
||
}
|
||
if (openIters) try {
|
||
iteratorCloseAll(openIters, NORMAL);
|
||
} catch (error) {
|
||
if (iterator) return iteratorClose(iterator, THROW, error);
|
||
throw error;
|
||
}
|
||
if (iterator) iteratorClose(iterator, NORMAL);
|
||
return createIterResultObject(undefined, true);
|
||
}
|
||
});
|
||
};
|
||
|
||
var WrapForValidIteratorPrototype = createIteratorProxyPrototype(true);
|
||
var IteratorHelperPrototype = createIteratorProxyPrototype(false);
|
||
|
||
createNonEnumerableProperty(IteratorHelperPrototype, TO_STRING_TAG, 'Iterator Helper');
|
||
|
||
module.exports = function (nextHandler, IS_ITERATOR, RETURN_HANDLER_RESULT) {
|
||
var IteratorProxy = function Iterator(record, state) {
|
||
if (state) {
|
||
state.iterator = record.iterator;
|
||
state.next = record.next;
|
||
} else state = record;
|
||
state.type = IS_ITERATOR ? WRAP_FOR_VALID_ITERATOR : ITERATOR_HELPER;
|
||
state.returnHandlerResult = !!RETURN_HANDLER_RESULT;
|
||
state.nextHandler = nextHandler;
|
||
state.counter = 0;
|
||
state.done = false;
|
||
setInternalState(this, state);
|
||
};
|
||
|
||
IteratorProxy.prototype = IS_ITERATOR ? WrapForValidIteratorPrototype : IteratorHelperPrototype;
|
||
|
||
return IteratorProxy;
|
||
};
|
||
|
||
});
|
||
|
||
// EXTERNAL MODULE: ./node_modules/core-js/internals/iterator-helper-throws-on-invalid-iterator.js
|
||
var iterator_helper_throws_on_invalid_iterator_namespaceFn = () => {
|
||
return __webpack_require__(684);
|
||
};
|
||
|
||
// MODULE: ./node_modules/core-js/internals/iterator-helper-without-closing-on-early-error.js
|
||
var iterator_helper_without_closing_on_early_error_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var globalThis = (global_this_namespaceFn());
|
||
|
||
// https://github.com/tc39/ecma262/pull/3467
|
||
module.exports = function (METHOD_NAME, ExpectedError) {
|
||
var Iterator = globalThis.Iterator;
|
||
var IteratorPrototype = Iterator && Iterator.prototype;
|
||
var method = IteratorPrototype && IteratorPrototype[METHOD_NAME];
|
||
|
||
var CLOSED = false;
|
||
|
||
if (method) try {
|
||
method.call({
|
||
next: function () { return { done: true }; },
|
||
'return': function () { CLOSED = true; }
|
||
}, -1);
|
||
} catch (error) {
|
||
// https://bugs.webkit.org/show_bug.cgi?id=291195
|
||
if (!(error instanceof ExpectedError)) CLOSED = false;
|
||
}
|
||
|
||
if (!CLOSED) return method;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/iterators-core.js
|
||
var iterators_core_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var fails = (fails_namespaceFn());
|
||
var isCallable = (is_callable_namespaceFn());
|
||
var isObject = (is_object_namespaceFn());
|
||
var create = (object_create_namespaceFn());
|
||
var getPrototypeOf = (object_get_prototype_of_namespaceFn());
|
||
var defineBuiltIn = (define_built_in_namespaceFn());
|
||
var wellKnownSymbol = (well_known_symbol_namespaceFn());
|
||
var IS_PURE = (is_pure_namespaceFn());
|
||
|
||
var ITERATOR = wellKnownSymbol('iterator');
|
||
var BUGGY_SAFARI_ITERATORS = false;
|
||
|
||
// `%IteratorPrototype%` object
|
||
// https://tc39.es/ecma262/#sec-%iteratorprototype%-object
|
||
var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
|
||
|
||
/* eslint-disable es/no-array-prototype-keys -- safe */
|
||
if ([].keys) {
|
||
arrayIterator = [].keys();
|
||
// Safari 8 has buggy iterators w/o `next`
|
||
if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
|
||
else {
|
||
PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
|
||
if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
|
||
}
|
||
}
|
||
|
||
var NEW_ITERATOR_PROTOTYPE = !isObject(IteratorPrototype) || fails(function () {
|
||
var test = {};
|
||
// FF44- legacy iterators case
|
||
return IteratorPrototype[ITERATOR].call(test) !== test;
|
||
});
|
||
|
||
if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {};
|
||
else if (IS_PURE) IteratorPrototype = create(IteratorPrototype);
|
||
|
||
// `%IteratorPrototype%[@@iterator]()` method
|
||
// https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
|
||
if (!isCallable(IteratorPrototype[ITERATOR])) {
|
||
defineBuiltIn(IteratorPrototype, ITERATOR, function () {
|
||
return this;
|
||
});
|
||
}
|
||
|
||
module.exports = {
|
||
IteratorPrototype: IteratorPrototype,
|
||
...(/* unused pure expression */ null && (BUGGY_SAFARI_ITERATORS))
|
||
};
|
||
|
||
});
|
||
|
||
// EXTERNAL MODULE: ./node_modules/core-js/internals/iterators.js
|
||
var iterators_namespaceFn = () => {
|
||
return __webpack_require__(269);
|
||
};
|
||
|
||
// MODULE: ./node_modules/core-js/internals/length-of-array-like.js
|
||
var length_of_array_like_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var toLength = (to_length_namespaceFn());
|
||
|
||
// `LengthOfArrayLike` abstract operation
|
||
// https://tc39.es/ecma262/#sec-lengthofarraylike
|
||
module.exports = function (obj) {
|
||
return toLength(obj.length);
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/make-built-in.js
|
||
var make_built_in_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var uncurryThis = (function_uncurry_this_namespaceFn());
|
||
var fails = (fails_namespaceFn());
|
||
var isCallable = (is_callable_namespaceFn());
|
||
var hasOwn = (has_own_property_namespaceFn());
|
||
var DESCRIPTORS = (descriptors_namespaceFn());
|
||
var CONFIGURABLE_FUNCTION_NAME = (function_name_namespaceFn().CONFIGURABLE);
|
||
var inspectSource = (inspect_source_namespaceFn());
|
||
var InternalStateModule = (internal_state_namespaceFn());
|
||
|
||
var enforceInternalState = InternalStateModule.enforce;
|
||
var getInternalState = InternalStateModule.get;
|
||
var $String = String;
|
||
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
||
var defineProperty = Object.defineProperty;
|
||
var stringSlice = uncurryThis(''.slice);
|
||
var replace = uncurryThis(''.replace);
|
||
var join = uncurryThis([].join);
|
||
|
||
var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function () {
|
||
return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
|
||
});
|
||
|
||
var TEMPLATE = String(String).split('String');
|
||
|
||
var makeBuiltIn = module.exports = function (value, name, options) {
|
||
if (stringSlice($String(name), 0, 7) === 'Symbol(') {
|
||
name = '[' + replace($String(name), /^Symbol\(([^)]*)\).*$/, '$1') + ']';
|
||
}
|
||
if (options && options.getter) name = 'get ' + name;
|
||
if (options && options.setter) name = 'set ' + name;
|
||
if (!hasOwn(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
|
||
if (DESCRIPTORS) defineProperty(value, 'name', { value: name, configurable: true });
|
||
else value.name = name;
|
||
}
|
||
if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) {
|
||
defineProperty(value, 'length', { value: options.arity });
|
||
}
|
||
try {
|
||
if (options && hasOwn(options, 'constructor') && options.constructor) {
|
||
if (DESCRIPTORS) defineProperty(value, 'prototype', { writable: false });
|
||
// in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
|
||
} else if (value.prototype) value.prototype = undefined;
|
||
} catch (error) { /* empty */ }
|
||
var state = enforceInternalState(value);
|
||
if (!hasOwn(state, 'source')) {
|
||
state.source = join(TEMPLATE, typeof name == 'string' ? name : '');
|
||
} return value;
|
||
};
|
||
|
||
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
|
||
// eslint-disable-next-line no-extend-native -- required
|
||
Function.prototype.toString = makeBuiltIn(function toString() {
|
||
return isCallable(this) && getInternalState(this).source || inspectSource(this);
|
||
}, 'toString');
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/map-helpers.js
|
||
var map_helpers_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var uncurryThis = (function_uncurry_this_namespaceFn());
|
||
|
||
// eslint-disable-next-line es/no-map -- safe
|
||
var MapPrototype = Map.prototype;
|
||
|
||
module.exports = {
|
||
// eslint-disable-next-line es/no-map -- safe
|
||
Map: Map,
|
||
set: uncurryThis(MapPrototype.set),
|
||
get: uncurryThis(MapPrototype.get),
|
||
has: uncurryThis(MapPrototype.has),
|
||
remove: uncurryThis(MapPrototype['delete']),
|
||
proto: MapPrototype
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/native-raw-json.js
|
||
var native_raw_json_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
/* eslint-disable es/no-json -- safe */
|
||
var fails = (fails_namespaceFn());
|
||
|
||
module.exports = !fails(function () {
|
||
var unsafeInt = '9007199254740993';
|
||
// eslint-disable-next-line es/no-json-rawjson -- feature detection
|
||
var raw = JSON.rawJSON(unsafeInt);
|
||
// eslint-disable-next-line es/no-json-israwjson -- feature detection
|
||
return !JSON.isRawJSON(raw) || JSON.stringify(raw) !== unsafeInt;
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/new-promise-capability.js
|
||
var new_promise_capability_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var aCallable = (a_callable_namespaceFn());
|
||
|
||
var $TypeError = TypeError;
|
||
|
||
var PromiseCapability = function (C) {
|
||
var resolve, reject;
|
||
this.promise = new C(function ($$resolve, $$reject) {
|
||
if (resolve !== undefined || reject !== undefined) throw new $TypeError('Bad Promise constructor');
|
||
resolve = $$resolve;
|
||
reject = $$reject;
|
||
});
|
||
this.resolve = aCallable(resolve);
|
||
this.reject = aCallable(reject);
|
||
};
|
||
|
||
// `NewPromiseCapability` abstract operation
|
||
// https://tc39.es/ecma262/#sec-newpromisecapability
|
||
module.exports.f = function (C) {
|
||
return new PromiseCapability(C);
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/normalize-string-argument.js
|
||
var normalize_string_argument_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var toString = (to_string_namespaceFn());
|
||
|
||
module.exports = function (argument, $default) {
|
||
return argument === undefined ? arguments.length < 2 ? '' : $default : toString(argument);
|
||
};
|
||
|
||
});
|
||
|
||
// EXTERNAL MODULE: ./node_modules/core-js/internals/not-a-nan.js
|
||
var not_a_nan_namespaceFn = () => {
|
||
return __webpack_require__(149);
|
||
};
|
||
|
||
// MODULE: ./node_modules/core-js/internals/object-create.js
|
||
var object_create_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
/* global ActiveXObject -- old IE, WSH */
|
||
var anObject = (an_object_namespaceFn());
|
||
var definePropertiesModule = (object_define_properties_namespaceFn());
|
||
var enumBugKeys = (enum_bug_keys_namespaceFn());
|
||
var hiddenKeys = (hidden_keys_namespaceFn());
|
||
var html = (html_namespaceFn());
|
||
var documentCreateElement = (document_create_element_namespaceFn());
|
||
var sharedKey = (shared_key_namespaceFn());
|
||
|
||
var GT = '>';
|
||
var LT = '<';
|
||
var PROTOTYPE = 'prototype';
|
||
var SCRIPT = 'script';
|
||
var IE_PROTO = sharedKey('IE_PROTO');
|
||
|
||
var EmptyConstructor = function () { /* empty */ };
|
||
|
||
var scriptTag = function (content) {
|
||
return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
|
||
};
|
||
|
||
// Create object with fake `null` prototype: use ActiveX Object with cleared prototype
|
||
var NullProtoObjectViaActiveX = function (activeXDocument) {
|
||
activeXDocument.write(scriptTag(''));
|
||
activeXDocument.close();
|
||
var temp = activeXDocument.parentWindow.Object;
|
||
// eslint-disable-next-line no-useless-assignment -- avoid memory leak
|
||
activeXDocument = null;
|
||
return temp;
|
||
};
|
||
|
||
// Create object with fake `null` prototype: use iframe Object with cleared prototype
|
||
var NullProtoObjectViaIFrame = function () {
|
||
// Thrash, waste and sodomy: IE GC bug
|
||
var iframe = documentCreateElement('iframe');
|
||
var JS = 'java' + SCRIPT + ':';
|
||
var iframeDocument;
|
||
iframe.style.display = 'none';
|
||
html.appendChild(iframe);
|
||
// https://github.com/zloirock/core-js/issues/475
|
||
iframe.src = String(JS);
|
||
iframeDocument = iframe.contentWindow.document;
|
||
iframeDocument.open();
|
||
iframeDocument.write(scriptTag('document.F=Object'));
|
||
iframeDocument.close();
|
||
return iframeDocument.F;
|
||
};
|
||
|
||
// Check for document.domain and active x support
|
||
// No need to use active x approach when document.domain is not set
|
||
// see https://github.com/es-shims/es5-shim/issues/150
|
||
// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
|
||
// avoid IE GC bug
|
||
var activeXDocument;
|
||
var NullProtoObject = function () {
|
||
try {
|
||
activeXDocument = new ActiveXObject('htmlfile');
|
||
} catch (error) { /* ignore */ }
|
||
NullProtoObject = typeof document != 'undefined'
|
||
? document.domain && activeXDocument
|
||
? NullProtoObjectViaActiveX(activeXDocument) // old IE
|
||
: NullProtoObjectViaIFrame()
|
||
: NullProtoObjectViaActiveX(activeXDocument); // WSH
|
||
var length = enumBugKeys.length;
|
||
while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
|
||
return NullProtoObject();
|
||
};
|
||
|
||
hiddenKeys[IE_PROTO] = true;
|
||
|
||
// `Object.create` method
|
||
// https://tc39.es/ecma262/#sec-object.create
|
||
// eslint-disable-next-line es/no-object-create -- safe
|
||
module.exports = Object.create || function create(O, Properties) {
|
||
var result;
|
||
if (O !== null) {
|
||
EmptyConstructor[PROTOTYPE] = anObject(O);
|
||
result = new EmptyConstructor();
|
||
EmptyConstructor[PROTOTYPE] = null;
|
||
// add "__proto__" for Object.getPrototypeOf polyfill
|
||
result[IE_PROTO] = O;
|
||
} else result = NullProtoObject();
|
||
return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/object-define-properties.js
|
||
var object_define_properties_namespaceFn = /*#__PURE__*/__webpack_require__.cw((__unused_webpack_module, exports) => {
|
||
|
||
var DESCRIPTORS = (descriptors_namespaceFn());
|
||
var V8_PROTOTYPE_DEFINE_BUG = (v8_prototype_define_bug_namespaceFn());
|
||
var definePropertyModule = (object_define_property_namespaceFn());
|
||
var anObject = (an_object_namespaceFn());
|
||
var toIndexedObject = (to_indexed_object_namespaceFn());
|
||
var objectKeys = (object_keys_namespaceFn());
|
||
|
||
// `Object.defineProperties` method
|
||
// https://tc39.es/ecma262/#sec-object.defineproperties
|
||
// eslint-disable-next-line es/no-object-defineproperties -- safe
|
||
exports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
|
||
anObject(O);
|
||
var props = toIndexedObject(Properties);
|
||
var keys = objectKeys(Properties);
|
||
var length = keys.length;
|
||
var index = 0;
|
||
var key;
|
||
while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);
|
||
return O;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/object-define-property.js
|
||
var object_define_property_namespaceFn = /*#__PURE__*/__webpack_require__.cw((__unused_webpack_module, exports) => {
|
||
|
||
var DESCRIPTORS = (descriptors_namespaceFn());
|
||
var IE8_DOM_DEFINE = (ie8_dom_define_namespaceFn());
|
||
var V8_PROTOTYPE_DEFINE_BUG = (v8_prototype_define_bug_namespaceFn());
|
||
var anObject = (an_object_namespaceFn());
|
||
var toPropertyKey = (to_property_key_namespaceFn());
|
||
|
||
var $TypeError = TypeError;
|
||
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
||
var $defineProperty = Object.defineProperty;
|
||
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
||
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
||
var ENUMERABLE = 'enumerable';
|
||
var CONFIGURABLE = 'configurable';
|
||
var WRITABLE = 'writable';
|
||
|
||
// `Object.defineProperty` method
|
||
// https://tc39.es/ecma262/#sec-object.defineproperty
|
||
exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
|
||
anObject(O);
|
||
P = toPropertyKey(P);
|
||
anObject(Attributes);
|
||
if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
|
||
var current = $getOwnPropertyDescriptor(O, P);
|
||
if (current && current[WRITABLE]) {
|
||
O[P] = Attributes.value;
|
||
Attributes = {
|
||
configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
|
||
enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
|
||
writable: false
|
||
};
|
||
}
|
||
} return $defineProperty(O, P, Attributes);
|
||
} : $defineProperty : function defineProperty(O, P, Attributes) {
|
||
anObject(O);
|
||
P = toPropertyKey(P);
|
||
anObject(Attributes);
|
||
if (IE8_DOM_DEFINE) try {
|
||
return $defineProperty(O, P, Attributes);
|
||
} catch (error) { /* empty */ }
|
||
if ('get' in Attributes || 'set' in Attributes) throw new $TypeError('Accessors not supported');
|
||
if ('value' in Attributes) O[P] = Attributes.value;
|
||
return O;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/object-get-own-property-descriptor.js
|
||
var object_get_own_property_descriptor_namespaceFn = /*#__PURE__*/__webpack_require__.cw((__unused_webpack_module, exports) => {
|
||
|
||
var DESCRIPTORS = (descriptors_namespaceFn());
|
||
var call = (function_call_namespaceFn());
|
||
var propertyIsEnumerableModule = (object_property_is_enumerable_namespaceFn());
|
||
var createPropertyDescriptor = (create_property_descriptor_namespaceFn());
|
||
var toIndexedObject = (to_indexed_object_namespaceFn());
|
||
var toPropertyKey = (to_property_key_namespaceFn());
|
||
var hasOwn = (has_own_property_namespaceFn());
|
||
var IE8_DOM_DEFINE = (ie8_dom_define_namespaceFn());
|
||
|
||
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
||
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
||
|
||
// `Object.getOwnPropertyDescriptor` method
|
||
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
|
||
exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
|
||
O = toIndexedObject(O);
|
||
P = toPropertyKey(P);
|
||
if (IE8_DOM_DEFINE) try {
|
||
return $getOwnPropertyDescriptor(O, P);
|
||
} catch (error) { /* empty */ }
|
||
if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/object-get-own-property-names.js
|
||
var object_get_own_property_names_namespaceFn = /*#__PURE__*/__webpack_require__.cw((__unused_webpack_module, exports) => {
|
||
|
||
var internalObjectKeys = (object_keys_internal_namespaceFn());
|
||
var enumBugKeys = (enum_bug_keys_namespaceFn());
|
||
|
||
var hiddenKeys = enumBugKeys.concat('length', 'prototype');
|
||
|
||
// `Object.getOwnPropertyNames` method
|
||
// https://tc39.es/ecma262/#sec-object.getownpropertynames
|
||
// eslint-disable-next-line es/no-object-getownpropertynames -- safe
|
||
exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
||
return internalObjectKeys(O, hiddenKeys);
|
||
};
|
||
|
||
});
|
||
|
||
// EXTERNAL MODULE: ./node_modules/core-js/internals/object-get-own-property-symbols.js
|
||
var object_get_own_property_symbols_namespaceFn = () => {
|
||
return __webpack_require__(717);
|
||
};
|
||
|
||
// MODULE: ./node_modules/core-js/internals/object-get-prototype-of.js
|
||
var object_get_prototype_of_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var hasOwn = (has_own_property_namespaceFn());
|
||
var isCallable = (is_callable_namespaceFn());
|
||
var toObject = (to_object_namespaceFn());
|
||
var sharedKey = (shared_key_namespaceFn());
|
||
var CORRECT_PROTOTYPE_GETTER = (correct_prototype_getter_namespaceFn());
|
||
|
||
var IE_PROTO = sharedKey('IE_PROTO');
|
||
var $Object = Object;
|
||
var ObjectPrototype = $Object.prototype;
|
||
|
||
// `Object.getPrototypeOf` method
|
||
// https://tc39.es/ecma262/#sec-object.getprototypeof
|
||
// eslint-disable-next-line es/no-object-getprototypeof -- safe
|
||
module.exports = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) {
|
||
var object = toObject(O);
|
||
if (hasOwn(object, IE_PROTO)) return object[IE_PROTO];
|
||
var constructor = object.constructor;
|
||
if (isCallable(constructor) && object instanceof constructor) {
|
||
return constructor.prototype;
|
||
} return object instanceof $Object ? ObjectPrototype : null;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/object-is-prototype-of.js
|
||
var object_is_prototype_of_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var uncurryThis = (function_uncurry_this_namespaceFn());
|
||
|
||
module.exports = uncurryThis({}.isPrototypeOf);
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/object-keys-internal.js
|
||
var object_keys_internal_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var uncurryThis = (function_uncurry_this_namespaceFn());
|
||
var hasOwn = (has_own_property_namespaceFn());
|
||
var toIndexedObject = (to_indexed_object_namespaceFn());
|
||
var indexOf = (array_includes_namespaceFn().indexOf);
|
||
var hiddenKeys = (hidden_keys_namespaceFn());
|
||
|
||
var push = uncurryThis([].push);
|
||
|
||
module.exports = function (object, names) {
|
||
var O = toIndexedObject(object);
|
||
var i = 0;
|
||
var result = [];
|
||
var key;
|
||
for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
|
||
// Don't enum bug & hidden keys
|
||
while (names.length > i) if (hasOwn(O, key = names[i++])) {
|
||
~indexOf(result, key) || push(result, key);
|
||
}
|
||
return result;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/object-keys.js
|
||
var object_keys_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var internalObjectKeys = (object_keys_internal_namespaceFn());
|
||
var enumBugKeys = (enum_bug_keys_namespaceFn());
|
||
|
||
// `Object.keys` method
|
||
// https://tc39.es/ecma262/#sec-object.keys
|
||
// eslint-disable-next-line es/no-object-keys -- safe
|
||
module.exports = Object.keys || function keys(O) {
|
||
return internalObjectKeys(O, enumBugKeys);
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/object-property-is-enumerable.js
|
||
var object_property_is_enumerable_namespaceFn = /*#__PURE__*/__webpack_require__.cw((__unused_webpack_module, exports) => {
|
||
|
||
var $propertyIsEnumerable = {}.propertyIsEnumerable;
|
||
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
||
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
||
|
||
// Nashorn ~ JDK8 bug
|
||
var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
|
||
|
||
// `Object.prototype.propertyIsEnumerable` method implementation
|
||
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
|
||
exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
|
||
var descriptor = getOwnPropertyDescriptor(this, V);
|
||
return !!descriptor && descriptor.enumerable;
|
||
} : $propertyIsEnumerable;
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/object-set-prototype-of.js
|
||
var object_set_prototype_of_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
/* eslint-disable no-proto -- safe */
|
||
var uncurryThisAccessor = (function_uncurry_this_accessor_namespaceFn());
|
||
var isObject = (is_object_namespaceFn());
|
||
var requireObjectCoercible = (require_object_coercible_namespaceFn());
|
||
var aPossiblePrototype = (a_possible_prototype_namespaceFn());
|
||
|
||
// `Object.setPrototypeOf` method
|
||
// https://tc39.es/ecma262/#sec-object.setprototypeof
|
||
// Works with __proto__ only. Old v8 can't work with null proto objects.
|
||
// eslint-disable-next-line es/no-object-setprototypeof -- safe
|
||
module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
|
||
var CORRECT_SETTER = false;
|
||
var test = {};
|
||
var setter;
|
||
try {
|
||
setter = uncurryThisAccessor(Object.prototype, '__proto__', 'set');
|
||
setter(test, []);
|
||
CORRECT_SETTER = test instanceof Array;
|
||
} catch (error) { /* empty */ }
|
||
return function setPrototypeOf(O, proto) {
|
||
requireObjectCoercible(O);
|
||
aPossiblePrototype(proto);
|
||
if (!isObject(O)) return O;
|
||
if (CORRECT_SETTER) setter(O, proto);
|
||
else O.__proto__ = proto;
|
||
return O;
|
||
};
|
||
}() : undefined);
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/ordinary-to-primitive.js
|
||
var ordinary_to_primitive_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var call = (function_call_namespaceFn());
|
||
var isCallable = (is_callable_namespaceFn());
|
||
var isObject = (is_object_namespaceFn());
|
||
|
||
var $TypeError = TypeError;
|
||
|
||
// `OrdinaryToPrimitive` abstract operation
|
||
// https://tc39.es/ecma262/#sec-ordinarytoprimitive
|
||
module.exports = function (input, pref) {
|
||
var fn, val;
|
||
if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
|
||
if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val;
|
||
if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;
|
||
throw new $TypeError("Can't convert object to primitive value");
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/own-keys.js
|
||
var own_keys_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var getBuiltIn = (get_built_in_namespaceFn());
|
||
var uncurryThis = (function_uncurry_this_namespaceFn());
|
||
var getOwnPropertyNamesModule = (object_get_own_property_names_namespaceFn());
|
||
var getOwnPropertySymbolsModule = (object_get_own_property_symbols_namespaceFn());
|
||
var anObject = (an_object_namespaceFn());
|
||
|
||
var concat = uncurryThis([].concat);
|
||
|
||
// all object keys, includes non-enumerable and symbols
|
||
module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
|
||
var keys = getOwnPropertyNamesModule.f(anObject(it));
|
||
var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
|
||
return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/parse-json-string.js
|
||
var parse_json_string_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var uncurryThis = (function_uncurry_this_namespaceFn());
|
||
var hasOwn = (has_own_property_namespaceFn());
|
||
|
||
var $SyntaxError = SyntaxError;
|
||
var $parseInt = parseInt;
|
||
var fromCharCode = String.fromCharCode;
|
||
var at = uncurryThis(''.charAt);
|
||
var slice = uncurryThis(''.slice);
|
||
var exec = uncurryThis(/./.exec);
|
||
|
||
var codePoints = {
|
||
'\\"': '"',
|
||
'\\\\': '\\',
|
||
'\\/': '/',
|
||
'\\b': '\b',
|
||
'\\f': '\f',
|
||
'\\n': '\n',
|
||
'\\r': '\r',
|
||
'\\t': '\t'
|
||
};
|
||
|
||
var IS_4_HEX_DIGITS = /^[\da-f]{4}$/i;
|
||
// eslint-disable-next-line regexp/no-control-character -- safe
|
||
var IS_C0_CONTROL_CODE = /^[\u0000-\u001F]$/;
|
||
|
||
module.exports = function (source, i) {
|
||
var unterminated = true;
|
||
var value = '';
|
||
while (i < source.length) {
|
||
var chr = at(source, i);
|
||
if (chr === '\\') {
|
||
var twoChars = slice(source, i, i + 2);
|
||
if (hasOwn(codePoints, twoChars)) {
|
||
value += codePoints[twoChars];
|
||
i += 2;
|
||
} else if (twoChars === '\\u') {
|
||
i += 2;
|
||
var fourHexDigits = slice(source, i, i + 4);
|
||
if (!exec(IS_4_HEX_DIGITS, fourHexDigits)) throw new $SyntaxError('Bad Unicode escape at: ' + i);
|
||
value += fromCharCode($parseInt(fourHexDigits, 16));
|
||
i += 4;
|
||
} else throw new $SyntaxError('Unknown escape sequence: "' + twoChars + '"');
|
||
} else if (chr === '"') {
|
||
unterminated = false;
|
||
i++;
|
||
break;
|
||
} else {
|
||
if (exec(IS_C0_CONTROL_CODE, chr)) throw new $SyntaxError('Bad control character in string literal at: ' + i);
|
||
value += chr;
|
||
i++;
|
||
}
|
||
}
|
||
if (unterminated) throw new $SyntaxError('Unterminated string at: ' + i);
|
||
return { value: value, end: i };
|
||
};
|
||
|
||
});
|
||
|
||
// EXTERNAL MODULE: ./node_modules/core-js/internals/perform.js
|
||
var perform_namespaceFn = () => {
|
||
return __webpack_require__(103);
|
||
};
|
||
|
||
// MODULE: ./node_modules/core-js/internals/promise-resolve.js
|
||
var promise_resolve_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var anObject = (an_object_namespaceFn());
|
||
var isObject = (is_object_namespaceFn());
|
||
var newPromiseCapability = (new_promise_capability_namespaceFn());
|
||
|
||
module.exports = function (C, x) {
|
||
anObject(C);
|
||
if (isObject(x) && x.constructor === C) return x;
|
||
var promiseCapability = newPromiseCapability.f(C);
|
||
var resolve = promiseCapability.resolve;
|
||
resolve(x);
|
||
return promiseCapability.promise;
|
||
};
|
||
|
||
});
|
||
|
||
// EXTERNAL MODULE: ./node_modules/core-js/internals/require-object-coercible.js
|
||
var require_object_coercible_namespaceFn = () => {
|
||
return __webpack_require__(750);
|
||
};
|
||
|
||
// MODULE: ./node_modules/core-js/internals/set-clone.js
|
||
var set_clone_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var SetHelpers = (set_helpers_namespaceFn());
|
||
var iterate = (set_iterate_namespaceFn());
|
||
|
||
var Set = SetHelpers.Set;
|
||
var add = SetHelpers.add;
|
||
|
||
module.exports = function (set) {
|
||
var result = new Set();
|
||
iterate(set, function (it) {
|
||
add(result, it);
|
||
});
|
||
return result;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/set-difference.js
|
||
var set_difference_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var aSet = (a_set_namespaceFn());
|
||
var SetHelpers = (set_helpers_namespaceFn());
|
||
var clone = (set_clone_namespaceFn());
|
||
var size = (set_size_namespaceFn());
|
||
var getSetRecord = (get_set_record_namespaceFn());
|
||
var iterateSet = (set_iterate_namespaceFn());
|
||
var iterateSimple = (iterate_simple_namespaceFn());
|
||
|
||
var has = SetHelpers.has;
|
||
var remove = SetHelpers.remove;
|
||
|
||
// `Set.prototype.difference` method
|
||
// https://tc39.es/ecma262/#sec-set.prototype.difference
|
||
module.exports = function difference(other) {
|
||
var O = aSet(this);
|
||
var otherRec = getSetRecord(other);
|
||
var result = clone(O);
|
||
if (size(result) <= otherRec.size) iterateSet(result, function (e) {
|
||
if (otherRec.includes(e)) remove(result, e);
|
||
});
|
||
else iterateSimple(otherRec.getIterator(), function (e) {
|
||
if (has(result, e)) remove(result, e);
|
||
});
|
||
return result;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/set-helpers.js
|
||
var set_helpers_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var uncurryThis = (function_uncurry_this_namespaceFn());
|
||
|
||
// eslint-disable-next-line es/no-set -- safe
|
||
var SetPrototype = Set.prototype;
|
||
|
||
module.exports = {
|
||
// eslint-disable-next-line es/no-set -- safe
|
||
Set: Set,
|
||
add: uncurryThis(SetPrototype.add),
|
||
has: uncurryThis(SetPrototype.has),
|
||
remove: uncurryThis(SetPrototype['delete']),
|
||
proto: SetPrototype
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/set-intersection.js
|
||
var set_intersection_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var aSet = (a_set_namespaceFn());
|
||
var SetHelpers = (set_helpers_namespaceFn());
|
||
var size = (set_size_namespaceFn());
|
||
var getSetRecord = (get_set_record_namespaceFn());
|
||
var iterateSet = (set_iterate_namespaceFn());
|
||
var iterateSimple = (iterate_simple_namespaceFn());
|
||
|
||
var Set = SetHelpers.Set;
|
||
var add = SetHelpers.add;
|
||
var has = SetHelpers.has;
|
||
|
||
// `Set.prototype.intersection` method
|
||
// https://tc39.es/ecma262/#sec-set.prototype.intersection
|
||
module.exports = function intersection(other) {
|
||
var O = aSet(this);
|
||
var otherRec = getSetRecord(other);
|
||
var result = new Set();
|
||
|
||
if (size(O) > otherRec.size) {
|
||
iterateSimple(otherRec.getIterator(), function (e) {
|
||
if (has(O, e)) add(result, e);
|
||
});
|
||
} else {
|
||
iterateSet(O, function (e) {
|
||
if (otherRec.includes(e)) add(result, e);
|
||
});
|
||
}
|
||
|
||
return result;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/set-is-disjoint-from.js
|
||
var set_is_disjoint_from_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var aSet = (a_set_namespaceFn());
|
||
var has = (set_helpers_namespaceFn().has);
|
||
var size = (set_size_namespaceFn());
|
||
var getSetRecord = (get_set_record_namespaceFn());
|
||
var iterateSet = (set_iterate_namespaceFn());
|
||
var iterateSimple = (iterate_simple_namespaceFn());
|
||
var iteratorClose = (iterator_close_namespaceFn());
|
||
|
||
// `Set.prototype.isDisjointFrom` method
|
||
// https://tc39.es/ecma262/#sec-set.prototype.isdisjointfrom
|
||
module.exports = function isDisjointFrom(other) {
|
||
var O = aSet(this);
|
||
var otherRec = getSetRecord(other);
|
||
if (size(O) <= otherRec.size) return iterateSet(O, function (e) {
|
||
if (otherRec.includes(e)) return false;
|
||
}, true) !== false;
|
||
var iterator = otherRec.getIterator();
|
||
return iterateSimple(iterator, function (e) {
|
||
if (has(O, e)) return iteratorClose(iterator.iterator, 'normal', false);
|
||
}) !== false;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/set-is-subset-of.js
|
||
var set_is_subset_of_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var aSet = (a_set_namespaceFn());
|
||
var size = (set_size_namespaceFn());
|
||
var iterate = (set_iterate_namespaceFn());
|
||
var getSetRecord = (get_set_record_namespaceFn());
|
||
|
||
// `Set.prototype.isSubsetOf` method
|
||
// https://tc39.es/ecma262/#sec-set.prototype.issubsetof
|
||
module.exports = function isSubsetOf(other) {
|
||
var O = aSet(this);
|
||
var otherRec = getSetRecord(other);
|
||
if (size(O) > otherRec.size) return false;
|
||
return iterate(O, function (e) {
|
||
if (!otherRec.includes(e)) return false;
|
||
}, true) !== false;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/set-is-superset-of.js
|
||
var set_is_superset_of_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var aSet = (a_set_namespaceFn());
|
||
var has = (set_helpers_namespaceFn().has);
|
||
var size = (set_size_namespaceFn());
|
||
var getSetRecord = (get_set_record_namespaceFn());
|
||
var iterateSimple = (iterate_simple_namespaceFn());
|
||
var iteratorClose = (iterator_close_namespaceFn());
|
||
|
||
// `Set.prototype.isSupersetOf` method
|
||
// https://tc39.es/ecma262/#sec-set.prototype.issupersetof
|
||
module.exports = function isSupersetOf(other) {
|
||
var O = aSet(this);
|
||
var otherRec = getSetRecord(other);
|
||
if (size(O) < otherRec.size) return false;
|
||
var iterator = otherRec.getIterator();
|
||
return iterateSimple(iterator, function (e) {
|
||
if (!has(O, e)) return iteratorClose(iterator.iterator, 'normal', false);
|
||
}) !== false;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/set-iterate.js
|
||
var set_iterate_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var uncurryThis = (function_uncurry_this_namespaceFn());
|
||
var iterateSimple = (iterate_simple_namespaceFn());
|
||
var SetHelpers = (set_helpers_namespaceFn());
|
||
|
||
var Set = SetHelpers.Set;
|
||
var SetPrototype = SetHelpers.proto;
|
||
var forEach = uncurryThis(SetPrototype.forEach);
|
||
var keys = uncurryThis(SetPrototype.keys);
|
||
var next = keys(new Set()).next;
|
||
|
||
module.exports = function (set, fn, interruptible) {
|
||
return interruptible ? iterateSimple({ iterator: keys(set), next: next }, fn) : forEach(set, fn);
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/set-method-accept-set-like.js
|
||
var set_method_accept_set_like_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var getBuiltIn = (get_built_in_namespaceFn());
|
||
|
||
var createSetLike = function (size) {
|
||
return {
|
||
size: size,
|
||
has: function () {
|
||
return false;
|
||
},
|
||
keys: function () {
|
||
return {
|
||
next: function () {
|
||
return { done: true };
|
||
}
|
||
};
|
||
}
|
||
};
|
||
};
|
||
|
||
var createSetLikeWithInfinitySize = function (size) {
|
||
return {
|
||
size: size,
|
||
has: function () {
|
||
return true;
|
||
},
|
||
keys: function () {
|
||
throw new Error('e');
|
||
}
|
||
};
|
||
};
|
||
|
||
module.exports = function (name, callback) {
|
||
var Set = getBuiltIn('Set');
|
||
try {
|
||
new Set()[name](createSetLike(0));
|
||
try {
|
||
// late spec change, early WebKit ~ Safari 17 implementation does not pass it
|
||
// https://github.com/tc39/proposal-set-methods/pull/88
|
||
// also covered engines with
|
||
// https://bugs.webkit.org/show_bug.cgi?id=272679
|
||
new Set()[name](createSetLike(-1));
|
||
return false;
|
||
} catch (error2) {
|
||
if (!callback) return true;
|
||
// early V8 implementation bug
|
||
// https://issues.chromium.org/issues/351332634
|
||
try {
|
||
new Set()[name](createSetLikeWithInfinitySize(-Infinity));
|
||
return false;
|
||
} catch (error) {
|
||
var set = new Set([1, 2]);
|
||
return callback(set[name](createSetLikeWithInfinitySize(Infinity)));
|
||
}
|
||
}
|
||
} catch (error) {
|
||
return false;
|
||
}
|
||
};
|
||
|
||
});
|
||
|
||
// EXTERNAL MODULE: ./node_modules/core-js/internals/set-method-get-keys-before-cloning-detection.js
|
||
var set_method_get_keys_before_cloning_detection_namespaceFn = () => {
|
||
return __webpack_require__(835);
|
||
};
|
||
|
||
// MODULE: ./node_modules/core-js/internals/set-size.js
|
||
var set_size_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var uncurryThisAccessor = (function_uncurry_this_accessor_namespaceFn());
|
||
var SetHelpers = (set_helpers_namespaceFn());
|
||
|
||
module.exports = uncurryThisAccessor(SetHelpers.proto, 'size', 'get') || function (set) {
|
||
return set.size;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/set-symmetric-difference.js
|
||
var set_symmetric_difference_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var aSet = (a_set_namespaceFn());
|
||
var SetHelpers = (set_helpers_namespaceFn());
|
||
var clone = (set_clone_namespaceFn());
|
||
var getSetRecord = (get_set_record_namespaceFn());
|
||
var iterateSimple = (iterate_simple_namespaceFn());
|
||
|
||
var add = SetHelpers.add;
|
||
var has = SetHelpers.has;
|
||
var remove = SetHelpers.remove;
|
||
|
||
// `Set.prototype.symmetricDifference` method
|
||
// https://tc39.es/ecma262/#sec-set.prototype.symmetricdifference
|
||
module.exports = function symmetricDifference(other) {
|
||
var O = aSet(this);
|
||
var keysIter = getSetRecord(other).getIterator();
|
||
var result = clone(O);
|
||
iterateSimple(keysIter, function (e) {
|
||
if (has(O, e)) remove(result, e);
|
||
else add(result, e);
|
||
});
|
||
return result;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/set-union.js
|
||
var set_union_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var aSet = (a_set_namespaceFn());
|
||
var add = (set_helpers_namespaceFn().add);
|
||
var clone = (set_clone_namespaceFn());
|
||
var getSetRecord = (get_set_record_namespaceFn());
|
||
var iterateSimple = (iterate_simple_namespaceFn());
|
||
|
||
// `Set.prototype.union` method
|
||
// https://tc39.es/ecma262/#sec-set.prototype.union
|
||
module.exports = function union(other) {
|
||
var O = aSet(this);
|
||
var keysIter = getSetRecord(other).getIterator();
|
||
var result = clone(O);
|
||
iterateSimple(keysIter, function (it) {
|
||
add(result, it);
|
||
});
|
||
return result;
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/shared-key.js
|
||
var shared_key_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var shared = (shared_namespaceFn());
|
||
var uid = (uid_namespaceFn());
|
||
|
||
var keys = shared('keys');
|
||
|
||
module.exports = function (key) {
|
||
return keys[key] || (keys[key] = uid(key));
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/shared-store.js
|
||
var shared_store_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var IS_PURE = (is_pure_namespaceFn());
|
||
var globalThis = (global_this_namespaceFn());
|
||
var defineGlobalProperty = (define_global_property_namespaceFn());
|
||
|
||
var SHARED = '__core-js_shared__';
|
||
var store = module.exports = globalThis[SHARED] || defineGlobalProperty(SHARED, {});
|
||
|
||
(store.versions || (store.versions = [])).push({
|
||
version: '3.51.0',
|
||
mode: IS_PURE ? 'pure' : 'global',
|
||
copyright: '© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.',
|
||
license: 'https://github.com/zloirock/core-js/blob/v3.51.0/LICENSE',
|
||
source: 'https://github.com/zloirock/core-js'
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/shared.js
|
||
var shared_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var store = (shared_store_namespaceFn());
|
||
// eslint-disable-next-line es/no-object-create -- safe
|
||
var create = Object.create || Object;
|
||
|
||
module.exports = function (key, value) {
|
||
return store[key] || (store[key] = value || create(null));
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/symbol-constructor-detection.js
|
||
var symbol_constructor_detection_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
/* eslint-disable es/no-symbol -- required for testing */
|
||
var V8_VERSION = (environment_v8_version_namespaceFn());
|
||
var fails = (fails_namespaceFn());
|
||
var globalThis = (global_this_namespaceFn());
|
||
|
||
var $String = globalThis.String;
|
||
|
||
// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
|
||
module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
|
||
var symbol = Symbol('symbol detection');
|
||
// Chrome 38 Symbol has incorrect toString conversion
|
||
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
|
||
// nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
|
||
// of course, fail.
|
||
return !$String(symbol) || !(Object(symbol) instanceof Symbol) ||
|
||
// Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
|
||
!Symbol.sham && V8_VERSION && V8_VERSION < 41;
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/this-number-value.js
|
||
var this_number_value_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var uncurryThis = (function_uncurry_this_namespaceFn());
|
||
|
||
// `thisNumberValue` abstract operation
|
||
// https://tc39.es/ecma262/#sec-thisnumbervalue
|
||
module.exports = uncurryThis(1.1.valueOf);
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/to-absolute-index.js
|
||
var to_absolute_index_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var toIntegerOrInfinity = (to_integer_or_infinity_namespaceFn());
|
||
|
||
var max = Math.max;
|
||
var min = Math.min;
|
||
|
||
// Helper for a popular repeating case of the spec:
|
||
// Let integer be ? ToInteger(index).
|
||
// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
|
||
module.exports = function (index, length) {
|
||
var integer = toIntegerOrInfinity(index);
|
||
return integer < 0 ? max(integer + length, 0) : min(integer, length);
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/to-big-int.js
|
||
var to_big_int_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var toPrimitive = (to_primitive_namespaceFn());
|
||
|
||
var $TypeError = TypeError;
|
||
|
||
// `ToBigInt` abstract operation
|
||
// https://tc39.es/ecma262/#sec-tobigint
|
||
module.exports = function (argument) {
|
||
var prim = toPrimitive(argument, 'number');
|
||
if (typeof prim == 'number') throw new $TypeError("Can't convert number to bigint");
|
||
// eslint-disable-next-line es/no-bigint -- safe
|
||
return BigInt(prim);
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/to-indexed-object.js
|
||
var to_indexed_object_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
// toObject with fallback for non-array-like ES3 strings
|
||
var IndexedObject = (indexed_object_namespaceFn());
|
||
var requireObjectCoercible = (require_object_coercible_namespaceFn());
|
||
|
||
module.exports = function (it) {
|
||
return IndexedObject(requireObjectCoercible(it));
|
||
};
|
||
|
||
});
|
||
|
||
// EXTERNAL MODULE: ./node_modules/core-js/internals/to-integer-or-infinity.js
|
||
var to_integer_or_infinity_namespaceFn = () => {
|
||
return __webpack_require__(291);
|
||
};
|
||
|
||
// EXTERNAL MODULE: ./node_modules/core-js/internals/to-length.js
|
||
var to_length_namespaceFn = () => {
|
||
return __webpack_require__(14);
|
||
};
|
||
|
||
// EXTERNAL MODULE: ./node_modules/core-js/internals/to-object.js
|
||
var to_object_namespaceFn = () => {
|
||
return __webpack_require__(981);
|
||
};
|
||
|
||
// EXTERNAL MODULE: ./node_modules/core-js/internals/to-positive-integer.js
|
||
var to_positive_integer_namespaceFn = () => {
|
||
return __webpack_require__(590);
|
||
};
|
||
|
||
// MODULE: ./node_modules/core-js/internals/to-primitive.js
|
||
var to_primitive_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var call = (function_call_namespaceFn());
|
||
var isObject = (is_object_namespaceFn());
|
||
var isSymbol = (is_symbol_namespaceFn());
|
||
var getMethod = (get_method_namespaceFn());
|
||
var ordinaryToPrimitive = (ordinary_to_primitive_namespaceFn());
|
||
var wellKnownSymbol = (well_known_symbol_namespaceFn());
|
||
|
||
var $TypeError = TypeError;
|
||
var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
|
||
|
||
// `ToPrimitive` abstract operation
|
||
// https://tc39.es/ecma262/#sec-toprimitive
|
||
module.exports = function (input, pref) {
|
||
if (!isObject(input) || isSymbol(input)) return input;
|
||
var exoticToPrim = getMethod(input, TO_PRIMITIVE);
|
||
var result;
|
||
if (exoticToPrim) {
|
||
if (pref === undefined) pref = 'default';
|
||
result = call(exoticToPrim, input, pref);
|
||
if (!isObject(result) || isSymbol(result)) return result;
|
||
throw new $TypeError("Can't convert object to primitive value");
|
||
}
|
||
if (pref === undefined) pref = 'number';
|
||
return ordinaryToPrimitive(input, pref);
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/to-property-key.js
|
||
var to_property_key_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var toPrimitive = (to_primitive_namespaceFn());
|
||
var isSymbol = (is_symbol_namespaceFn());
|
||
|
||
// `ToPropertyKey` abstract operation
|
||
// https://tc39.es/ecma262/#sec-topropertykey
|
||
module.exports = function (argument) {
|
||
var key = toPrimitive(argument, 'string');
|
||
return isSymbol(key) ? key : key + '';
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/to-string-tag-support.js
|
||
var to_string_tag_support_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var wellKnownSymbol = (well_known_symbol_namespaceFn());
|
||
|
||
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
||
var test = {};
|
||
// eslint-disable-next-line unicorn/no-immediate-mutation -- ES3 syntax limitation
|
||
test[TO_STRING_TAG] = 'z';
|
||
|
||
module.exports = String(test) === '[object z]';
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/to-string.js
|
||
var to_string_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var classof = (classof_namespaceFn());
|
||
|
||
var $String = String;
|
||
|
||
module.exports = function (argument) {
|
||
if (classof(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string');
|
||
return $String(argument);
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/try-to-string.js
|
||
var try_to_string_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var $String = String;
|
||
|
||
module.exports = function (argument) {
|
||
try {
|
||
return $String(argument);
|
||
} catch (error) {
|
||
return 'Object';
|
||
}
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/uid.js
|
||
var uid_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var uncurryThis = (function_uncurry_this_namespaceFn());
|
||
|
||
var id = 0;
|
||
var postfix = Math.random();
|
||
var toString = uncurryThis(1.1.toString);
|
||
|
||
module.exports = function (key) {
|
||
return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/uint8-from-base64.js
|
||
var uint8_from_base64_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var globalThis = (global_this_namespaceFn());
|
||
var uncurryThis = (function_uncurry_this_namespaceFn());
|
||
var anObjectOrUndefined = (an_object_or_undefined_namespaceFn());
|
||
var aString = (a_string_namespaceFn());
|
||
var hasOwn = (has_own_property_namespaceFn());
|
||
var base64Map = (base64_map_namespaceFn());
|
||
var getAlphabetOption = (get_alphabet_option_namespaceFn());
|
||
var notDetached = (array_buffer_not_detached_namespaceFn());
|
||
|
||
var base64Alphabet = base64Map.c2i;
|
||
var base64UrlAlphabet = base64Map.c2iUrl;
|
||
|
||
var SyntaxError = globalThis.SyntaxError;
|
||
var TypeError = globalThis.TypeError;
|
||
var $Array = globalThis.Array;
|
||
var at = uncurryThis(''.charAt);
|
||
var floor = Math.floor;
|
||
|
||
var skipAsciiWhitespace = function (string, index) {
|
||
var length = string.length;
|
||
for (;index < length; index++) {
|
||
var chr = at(string, index);
|
||
if (chr !== ' ' && chr !== '\t' && chr !== '\n' && chr !== '\f' && chr !== '\r') break;
|
||
} return index;
|
||
};
|
||
|
||
var decodeBase64Chunk = function (chunk, alphabet, throwOnExtraBits) {
|
||
var chunkLength = chunk.length;
|
||
|
||
if (chunkLength < 4) {
|
||
chunk += chunkLength === 2 ? 'AA' : 'A';
|
||
}
|
||
|
||
var triplet = (alphabet[at(chunk, 0)] << 18)
|
||
+ (alphabet[at(chunk, 1)] << 12)
|
||
+ (alphabet[at(chunk, 2)] << 6)
|
||
+ alphabet[at(chunk, 3)];
|
||
|
||
var chunkBytes = [
|
||
(triplet >> 16) & 255,
|
||
(triplet >> 8) & 255,
|
||
triplet & 255
|
||
];
|
||
|
||
if (chunkLength === 2) {
|
||
if (throwOnExtraBits && chunkBytes[1] !== 0) {
|
||
throw new SyntaxError('Extra bits');
|
||
}
|
||
return [chunkBytes[0]];
|
||
}
|
||
|
||
if (chunkLength === 3) {
|
||
if (throwOnExtraBits && chunkBytes[2] !== 0) {
|
||
throw new SyntaxError('Extra bits');
|
||
}
|
||
return [chunkBytes[0], chunkBytes[1]];
|
||
}
|
||
|
||
return chunkBytes;
|
||
};
|
||
|
||
var writeBytes = function (bytes, elements, written) {
|
||
var elementsLength = elements.length;
|
||
for (var index = 0; index < elementsLength; index++) {
|
||
bytes[written + index] = elements[index];
|
||
}
|
||
return written + elementsLength;
|
||
};
|
||
|
||
/* eslint-disable max-statements, max-depth -- TODO */
|
||
module.exports = function (string, options, into, maxLength) {
|
||
aString(string);
|
||
anObjectOrUndefined(options);
|
||
var alphabet = getAlphabetOption(options) === 'base64' ? base64Alphabet : base64UrlAlphabet;
|
||
var lastChunkHandling = options ? options.lastChunkHandling : undefined;
|
||
|
||
if (lastChunkHandling === undefined) lastChunkHandling = 'loose';
|
||
|
||
if (lastChunkHandling !== 'loose' && lastChunkHandling !== 'strict' && lastChunkHandling !== 'stop-before-partial') {
|
||
throw new TypeError('Incorrect `lastChunkHandling` option');
|
||
}
|
||
|
||
if (into) notDetached(into.buffer);
|
||
|
||
var stringLength = string.length;
|
||
var bytes = into || $Array(floor(stringLength * 3 / 4));
|
||
var written = 0;
|
||
var read = 0;
|
||
var chunk = '';
|
||
var index = 0;
|
||
|
||
if (maxLength) while (true) {
|
||
index = skipAsciiWhitespace(string, index);
|
||
if (index === stringLength) {
|
||
if (chunk.length > 0) {
|
||
if (lastChunkHandling === 'stop-before-partial') {
|
||
break;
|
||
}
|
||
if (lastChunkHandling === 'loose') {
|
||
if (chunk.length === 1) {
|
||
throw new SyntaxError('Malformed padding: exactly one additional character');
|
||
}
|
||
written = writeBytes(bytes, decodeBase64Chunk(chunk, alphabet, false), written);
|
||
} else {
|
||
throw new SyntaxError('Missing padding');
|
||
}
|
||
}
|
||
read = stringLength;
|
||
break;
|
||
}
|
||
var chr = at(string, index);
|
||
++index;
|
||
if (chr === '=') {
|
||
if (chunk.length < 2) {
|
||
throw new SyntaxError('Padding is too early');
|
||
}
|
||
index = skipAsciiWhitespace(string, index);
|
||
if (chunk.length === 2) {
|
||
if (index === stringLength) {
|
||
if (lastChunkHandling === 'stop-before-partial') {
|
||
break;
|
||
}
|
||
throw new SyntaxError('Malformed padding: only one =');
|
||
}
|
||
if (at(string, index) === '=') {
|
||
++index;
|
||
index = skipAsciiWhitespace(string, index);
|
||
}
|
||
}
|
||
if (index < stringLength) {
|
||
throw new SyntaxError('Unexpected character after padding');
|
||
}
|
||
written = writeBytes(bytes, decodeBase64Chunk(chunk, alphabet, lastChunkHandling === 'strict'), written);
|
||
read = stringLength;
|
||
break;
|
||
}
|
||
if (!hasOwn(alphabet, chr)) {
|
||
throw new SyntaxError('Unexpected character');
|
||
}
|
||
var remainingBytes = maxLength - written;
|
||
if (remainingBytes === 1 && chunk.length === 2 || remainingBytes === 2 && chunk.length === 3) {
|
||
// special case: we can fit exactly the number of bytes currently represented by chunk, so we were just checking for `=`
|
||
break;
|
||
}
|
||
|
||
chunk += chr;
|
||
if (chunk.length === 4) {
|
||
written = writeBytes(bytes, decodeBase64Chunk(chunk, alphabet, false), written);
|
||
chunk = '';
|
||
read = index;
|
||
if (written === maxLength) {
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
if (!into) bytes.length = written;
|
||
return { bytes: bytes, read: read, written: written };
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/uint8-from-hex.js
|
||
var uint8_from_hex_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var globalThis = (global_this_namespaceFn());
|
||
var uncurryThis = (function_uncurry_this_namespaceFn());
|
||
|
||
var Uint8Array = globalThis.Uint8Array;
|
||
var SyntaxError = globalThis.SyntaxError;
|
||
var min = Math.min;
|
||
var stringMatch = uncurryThis(''.match);
|
||
|
||
module.exports = function (string, into) {
|
||
var stringLength = string.length;
|
||
if (stringLength % 2 !== 0) throw new SyntaxError('String should be an even number of characters');
|
||
var maxLength = into ? min(into.length, stringLength / 2) : stringLength / 2;
|
||
var bytes = into || new Uint8Array(maxLength);
|
||
var segments = stringMatch(string, /[\S\s]{2}/g);
|
||
var written = 0;
|
||
for (; written < maxLength; written++) {
|
||
var result = +('0x' + segments[written] + '0');
|
||
// eslint-disable-next-line no-self-compare -- NaN check
|
||
if (result !== result) {
|
||
throw new SyntaxError('String should only contain hex characters');
|
||
}
|
||
bytes[written] = result >> 4;
|
||
}
|
||
return { bytes: bytes, read: written << 1 };
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/url-constructor-detection.js
|
||
var url_constructor_detection_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var fails = (fails_namespaceFn());
|
||
var wellKnownSymbol = (well_known_symbol_namespaceFn());
|
||
var DESCRIPTORS = (descriptors_namespaceFn());
|
||
var IS_PURE = (is_pure_namespaceFn());
|
||
|
||
var ITERATOR = wellKnownSymbol('iterator');
|
||
|
||
module.exports = !fails(function () {
|
||
// eslint-disable-next-line unicorn/relative-url-style -- required for testing
|
||
var url = new URL('b?a=1&b=2&c=3', 'https://a');
|
||
var params = url.searchParams;
|
||
var params2 = new URLSearchParams('a=1&a=2&b=3');
|
||
var result = '';
|
||
url.pathname = 'c%20d';
|
||
params.forEach(function (value, key) {
|
||
params['delete']('b');
|
||
result += key + value;
|
||
});
|
||
params2['delete']('a', 2);
|
||
// `undefined` case is a Chromium 117 bug
|
||
// https://bugs.chromium.org/p/v8/issues/detail?id=14222
|
||
params2['delete']('b', undefined);
|
||
return (IS_PURE && (!url.toJSON || !params2.has('a', 1) || params2.has('a', 2) || !params2.has('a', undefined) || params2.has('b')))
|
||
|| (!params.size && (IS_PURE || !DESCRIPTORS))
|
||
|| !params.sort
|
||
|| url.href !== 'https://a/c%20d?a=1&c=3'
|
||
|| params.get('c') !== '3'
|
||
|| String(new URLSearchParams('?a=1')) !== 'a=1'
|
||
|| !params[ITERATOR]
|
||
// throws in Edge
|
||
|| new URL('https://a@b').username !== 'a'
|
||
|| new URLSearchParams(new URLSearchParams('a=b')).get('a') !== 'b'
|
||
// not punycoded in Edge
|
||
|| new URL('https://тест').host !== 'xn--e1aybc'
|
||
// not escaped in Chrome 62-
|
||
|| new URL('https://a#б').hash !== '#%D0%B1'
|
||
// fails in Chrome 66-
|
||
|| result !== 'a1c3'
|
||
// throws in Safari
|
||
|| new URL('https://x', undefined).host !== 'x';
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/use-symbol-as-uid.js
|
||
var use_symbol_as_uid_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
/* eslint-disable es/no-symbol -- required for testing */
|
||
var NATIVE_SYMBOL = (symbol_constructor_detection_namespaceFn());
|
||
|
||
module.exports = NATIVE_SYMBOL &&
|
||
!Symbol.sham &&
|
||
typeof Symbol.iterator == 'symbol';
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/v8-prototype-define-bug.js
|
||
var v8_prototype_define_bug_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var DESCRIPTORS = (descriptors_namespaceFn());
|
||
var fails = (fails_namespaceFn());
|
||
|
||
// V8 ~ Chrome 36-
|
||
// https://bugs.chromium.org/p/v8/issues/detail?id=3334
|
||
module.exports = DESCRIPTORS && fails(function () {
|
||
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
||
return Object.defineProperty(function () { /* empty */ }, 'prototype', {
|
||
value: 42,
|
||
writable: false
|
||
}).prototype !== 42;
|
||
});
|
||
|
||
});
|
||
|
||
// EXTERNAL MODULE: ./node_modules/core-js/internals/validate-arguments-length.js
|
||
var validate_arguments_length_namespaceFn = () => {
|
||
return __webpack_require__(812);
|
||
};
|
||
|
||
// MODULE: ./node_modules/core-js/internals/weak-map-basic-detection.js
|
||
var weak_map_basic_detection_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var globalThis = (global_this_namespaceFn());
|
||
var isCallable = (is_callable_namespaceFn());
|
||
|
||
var WeakMap = globalThis.WeakMap;
|
||
|
||
module.exports = isCallable(WeakMap) && /native code/.test(String(WeakMap));
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/weak-map-helpers.js
|
||
var weak_map_helpers_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var uncurryThis = (function_uncurry_this_namespaceFn());
|
||
|
||
// eslint-disable-next-line es/no-weak-map -- safe
|
||
var WeakMapPrototype = WeakMap.prototype;
|
||
|
||
module.exports = {
|
||
// eslint-disable-next-line es/no-weak-map -- safe
|
||
WeakMap: WeakMap,
|
||
set: uncurryThis(WeakMapPrototype.set),
|
||
get: uncurryThis(WeakMapPrototype.get),
|
||
has: uncurryThis(WeakMapPrototype.has),
|
||
remove: uncurryThis(WeakMapPrototype['delete'])
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/internals/well-known-symbol.js
|
||
var well_known_symbol_namespaceFn = /*#__PURE__*/__webpack_require__.cw((module) => {
|
||
|
||
var globalThis = (global_this_namespaceFn());
|
||
var shared = (shared_namespaceFn());
|
||
var hasOwn = (has_own_property_namespaceFn());
|
||
var uid = (uid_namespaceFn());
|
||
var NATIVE_SYMBOL = (symbol_constructor_detection_namespaceFn());
|
||
var USE_SYMBOL_AS_UID = (use_symbol_as_uid_namespaceFn());
|
||
|
||
var Symbol = globalThis.Symbol;
|
||
var WellKnownSymbolsStore = shared('wks');
|
||
var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol['for'] || Symbol : Symbol && Symbol.withoutSetter || uid;
|
||
|
||
module.exports = function (name) {
|
||
if (!hasOwn(WellKnownSymbolsStore, name)) {
|
||
WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn(Symbol, name)
|
||
? Symbol[name]
|
||
: createWellKnownSymbol('Symbol.' + name);
|
||
} return WellKnownSymbolsStore[name];
|
||
};
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/modules/es.array.includes.js
|
||
var es_array_includes_namespaceFn = /*#__PURE__*/__webpack_require__.cw(() => {
|
||
|
||
var $ = (export_namespaceFn());
|
||
var $includes = (array_includes_namespaceFn().includes);
|
||
var fails = (fails_namespaceFn());
|
||
var addToUnscopables = (add_to_unscopables_namespaceFn());
|
||
|
||
// FF99+ bug
|
||
var BROKEN_ON_SPARSE = fails(function () {
|
||
// eslint-disable-next-line es/no-array-prototype-includes -- detection
|
||
return !Array(1).includes();
|
||
});
|
||
|
||
// Safari 26.4- bug
|
||
var BROKEN_ON_SPARSE_WITH_FROM_INDEX = fails(function () {
|
||
// eslint-disable-next-line no-sparse-arrays, es/no-array-prototype-includes -- detection
|
||
return [, 1].includes(undefined, 1);
|
||
});
|
||
|
||
// `Array.prototype.includes` method
|
||
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
||
$({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE || BROKEN_ON_SPARSE_WITH_FROM_INDEX }, {
|
||
includes: function includes(el /* , fromIndex = 0 */) {
|
||
return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
|
||
}
|
||
});
|
||
|
||
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
||
addToUnscopables('includes');
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/modules/es.array.push.js
|
||
var es_array_push_namespaceFn = /*#__PURE__*/__webpack_require__.cw(() => {
|
||
|
||
var $ = (export_namespaceFn());
|
||
var toObject = (to_object_namespaceFn());
|
||
var lengthOfArrayLike = (length_of_array_like_namespaceFn());
|
||
var setArrayLength = (array_set_length_namespaceFn());
|
||
var doesNotExceedSafeInteger = (does_not_exceed_safe_integer_namespaceFn());
|
||
var fails = (fails_namespaceFn());
|
||
|
||
var INCORRECT_TO_LENGTH = fails(function () {
|
||
return [].push.call({ length: 0x100000000 }, 1) !== 4294967297;
|
||
});
|
||
|
||
// V8 <= 121 and Safari <= 15.4; FF < 23 throws InternalError
|
||
// https://bugs.chromium.org/p/v8/issues/detail?id=12681
|
||
var properErrorOnNonWritableLength = function () {
|
||
try {
|
||
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
||
Object.defineProperty([], 'length', { writable: false }).push();
|
||
} catch (error) {
|
||
return error instanceof TypeError;
|
||
}
|
||
};
|
||
|
||
var FORCED = INCORRECT_TO_LENGTH || !properErrorOnNonWritableLength();
|
||
|
||
// `Array.prototype.push` method
|
||
// https://tc39.es/ecma262/#sec-array.prototype.push
|
||
$({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
|
||
// eslint-disable-next-line no-unused-vars -- required for `.length`
|
||
push: function push(item) {
|
||
var O = toObject(this);
|
||
var len = lengthOfArrayLike(O);
|
||
var argCount = arguments.length;
|
||
doesNotExceedSafeInteger(len + argCount);
|
||
for (var i = 0; i < argCount; i++) {
|
||
O[len] = arguments[i];
|
||
len++;
|
||
}
|
||
setArrayLength(O, len);
|
||
return len;
|
||
}
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/modules/es.iterator.constructor.js
|
||
var es_iterator_constructor_namespaceFn = /*#__PURE__*/__webpack_require__.cw(() => {
|
||
|
||
var $ = (export_namespaceFn());
|
||
var globalThis = (global_this_namespaceFn());
|
||
var anInstance = (an_instance_namespaceFn());
|
||
var anObject = (an_object_namespaceFn());
|
||
var isCallable = (is_callable_namespaceFn());
|
||
var getPrototypeOf = (object_get_prototype_of_namespaceFn());
|
||
var defineBuiltInAccessor = (define_built_in_accessor_namespaceFn());
|
||
var createProperty = (create_property_namespaceFn());
|
||
var fails = (fails_namespaceFn());
|
||
var hasOwn = (has_own_property_namespaceFn());
|
||
var wellKnownSymbol = (well_known_symbol_namespaceFn());
|
||
var IteratorPrototype = (iterators_core_namespaceFn().IteratorPrototype);
|
||
var DESCRIPTORS = (descriptors_namespaceFn());
|
||
var IS_PURE = (is_pure_namespaceFn());
|
||
|
||
var CONSTRUCTOR = 'constructor';
|
||
var ITERATOR = 'Iterator';
|
||
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
||
|
||
var $TypeError = TypeError;
|
||
var NativeIterator = globalThis[ITERATOR];
|
||
|
||
// FF56- have non-standard global helper `Iterator`
|
||
var FORCED = IS_PURE
|
||
|| !isCallable(NativeIterator)
|
||
|| NativeIterator.prototype !== IteratorPrototype
|
||
// FF44- non-standard `Iterator` passes previous tests
|
||
|| !fails(function () { NativeIterator({}); });
|
||
|
||
var IteratorConstructor = function Iterator() {
|
||
anInstance(this, IteratorPrototype);
|
||
if (getPrototypeOf(this) === IteratorPrototype) throw new $TypeError('Abstract class Iterator not directly constructable');
|
||
};
|
||
|
||
var defineIteratorPrototypeAccessor = function (key, value) {
|
||
if (DESCRIPTORS) {
|
||
defineBuiltInAccessor(IteratorPrototype, key, {
|
||
configurable: true,
|
||
get: function () {
|
||
return value;
|
||
},
|
||
set: function (replacement) {
|
||
anObject(this);
|
||
if (this === IteratorPrototype) throw new $TypeError("You can't redefine this property");
|
||
if (hasOwn(this, key)) this[key] = replacement;
|
||
else createProperty(this, key, replacement);
|
||
}
|
||
});
|
||
} else IteratorPrototype[key] = value;
|
||
};
|
||
|
||
if (!hasOwn(IteratorPrototype, TO_STRING_TAG)) defineIteratorPrototypeAccessor(TO_STRING_TAG, ITERATOR);
|
||
|
||
if (FORCED || !hasOwn(IteratorPrototype, CONSTRUCTOR) || IteratorPrototype[CONSTRUCTOR] === Object) {
|
||
defineIteratorPrototypeAccessor(CONSTRUCTOR, IteratorConstructor);
|
||
}
|
||
|
||
IteratorConstructor.prototype = IteratorPrototype;
|
||
|
||
// `Iterator` constructor
|
||
// https://tc39.es/ecma262/#sec-iterator
|
||
$({ global: true, constructor: true, forced: FORCED }, {
|
||
Iterator: IteratorConstructor
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/modules/es.iterator.filter.js
|
||
var es_iterator_filter_namespaceFn = /*#__PURE__*/__webpack_require__.cw(() => {
|
||
|
||
var $ = (export_namespaceFn());
|
||
var call = (function_call_namespaceFn());
|
||
var aCallable = (a_callable_namespaceFn());
|
||
var anObject = (an_object_namespaceFn());
|
||
var getIteratorDirect = (get_iterator_direct_namespaceFn());
|
||
var createIteratorProxy = (iterator_create_proxy_namespaceFn());
|
||
var callWithSafeIterationClosing = (call_with_safe_iteration_closing_namespaceFn());
|
||
var IS_PURE = (is_pure_namespaceFn());
|
||
var iteratorClose = (iterator_close_namespaceFn());
|
||
var iteratorHelperThrowsOnInvalidIterator = (iterator_helper_throws_on_invalid_iterator_namespaceFn());
|
||
var iteratorHelperWithoutClosingOnEarlyError = (iterator_helper_without_closing_on_early_error_namespaceFn());
|
||
|
||
var FILTER_WITHOUT_THROWING_ON_INVALID_ITERATOR = !IS_PURE && !iteratorHelperThrowsOnInvalidIterator('filter', function () { /* empty */ });
|
||
var filterWithoutClosingOnEarlyError = !IS_PURE && !FILTER_WITHOUT_THROWING_ON_INVALID_ITERATOR
|
||
&& iteratorHelperWithoutClosingOnEarlyError('filter', TypeError);
|
||
|
||
var FORCED = IS_PURE || FILTER_WITHOUT_THROWING_ON_INVALID_ITERATOR || filterWithoutClosingOnEarlyError;
|
||
|
||
var IteratorProxy = createIteratorProxy(function () {
|
||
var iterator = this.iterator;
|
||
var predicate = this.predicate;
|
||
var next = this.next;
|
||
var result, done, value;
|
||
while (true) {
|
||
result = anObject(call(next, iterator));
|
||
done = this.done = !!result.done;
|
||
if (done) return;
|
||
value = result.value;
|
||
if (callWithSafeIterationClosing(iterator, predicate, [value, this.counter++], true)) return value;
|
||
}
|
||
});
|
||
|
||
// `Iterator.prototype.filter` method
|
||
// https://tc39.es/ecma262/#sec-iterator.prototype.filter
|
||
$({ target: 'Iterator', proto: true, real: true, forced: FORCED }, {
|
||
filter: function filter(predicate) {
|
||
anObject(this);
|
||
try {
|
||
aCallable(predicate);
|
||
} catch (error) {
|
||
iteratorClose(this, 'throw', error);
|
||
}
|
||
|
||
if (filterWithoutClosingOnEarlyError) return call(filterWithoutClosingOnEarlyError, this, predicate);
|
||
|
||
return new IteratorProxy(getIteratorDirect(this), {
|
||
predicate: predicate
|
||
});
|
||
}
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/modules/es.iterator.for-each.js
|
||
var es_iterator_for_each_namespaceFn = /*#__PURE__*/__webpack_require__.cw(() => {
|
||
|
||
var $ = (export_namespaceFn());
|
||
var call = (function_call_namespaceFn());
|
||
var iterate = (iterate_namespaceFn());
|
||
var aCallable = (a_callable_namespaceFn());
|
||
var anObject = (an_object_namespaceFn());
|
||
var getIteratorDirect = (get_iterator_direct_namespaceFn());
|
||
var iteratorClose = (iterator_close_namespaceFn());
|
||
var iteratorHelperWithoutClosingOnEarlyError = (iterator_helper_without_closing_on_early_error_namespaceFn());
|
||
|
||
var forEachWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError('forEach', TypeError);
|
||
|
||
// `Iterator.prototype.forEach` method
|
||
// https://tc39.es/ecma262/#sec-iterator.prototype.foreach
|
||
$({ target: 'Iterator', proto: true, real: true, forced: forEachWithoutClosingOnEarlyError }, {
|
||
forEach: function forEach(fn) {
|
||
anObject(this);
|
||
try {
|
||
aCallable(fn);
|
||
} catch (error) {
|
||
iteratorClose(this, 'throw', error);
|
||
}
|
||
|
||
if (forEachWithoutClosingOnEarlyError) return call(forEachWithoutClosingOnEarlyError, this, fn);
|
||
|
||
var record = getIteratorDirect(this);
|
||
var counter = 0;
|
||
iterate(record, function (value) {
|
||
fn(value, counter++);
|
||
}, { IS_RECORD: true });
|
||
}
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/modules/es.iterator.map.js
|
||
var es_iterator_map_namespaceFn = /*#__PURE__*/__webpack_require__.cw(() => {
|
||
|
||
var $ = (export_namespaceFn());
|
||
var call = (function_call_namespaceFn());
|
||
var aCallable = (a_callable_namespaceFn());
|
||
var anObject = (an_object_namespaceFn());
|
||
var getIteratorDirect = (get_iterator_direct_namespaceFn());
|
||
var createIteratorProxy = (iterator_create_proxy_namespaceFn());
|
||
var callWithSafeIterationClosing = (call_with_safe_iteration_closing_namespaceFn());
|
||
var iteratorClose = (iterator_close_namespaceFn());
|
||
var iteratorHelperThrowsOnInvalidIterator = (iterator_helper_throws_on_invalid_iterator_namespaceFn());
|
||
var iteratorHelperWithoutClosingOnEarlyError = (iterator_helper_without_closing_on_early_error_namespaceFn());
|
||
var IS_PURE = (is_pure_namespaceFn());
|
||
|
||
var MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR = !IS_PURE && !iteratorHelperThrowsOnInvalidIterator('map', function () { /* empty */ });
|
||
var mapWithoutClosingOnEarlyError = !IS_PURE && !MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR
|
||
&& iteratorHelperWithoutClosingOnEarlyError('map', TypeError);
|
||
|
||
var FORCED = IS_PURE || MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR || mapWithoutClosingOnEarlyError;
|
||
|
||
var IteratorProxy = createIteratorProxy(function () {
|
||
var iterator = this.iterator;
|
||
var result = anObject(call(this.next, iterator));
|
||
var done = this.done = !!result.done;
|
||
if (!done) return callWithSafeIterationClosing(iterator, this.mapper, [result.value, this.counter++], true);
|
||
});
|
||
|
||
// `Iterator.prototype.map` method
|
||
// https://tc39.es/ecma262/#sec-iterator.prototype.map
|
||
$({ target: 'Iterator', proto: true, real: true, forced: FORCED }, {
|
||
map: function map(mapper) {
|
||
anObject(this);
|
||
try {
|
||
aCallable(mapper);
|
||
} catch (error) {
|
||
iteratorClose(this, 'throw', error);
|
||
}
|
||
|
||
if (mapWithoutClosingOnEarlyError) return call(mapWithoutClosingOnEarlyError, this, mapper);
|
||
|
||
return new IteratorProxy(getIteratorDirect(this), {
|
||
mapper: mapper
|
||
});
|
||
}
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/modules/es.iterator.take.js
|
||
var es_iterator_take_namespaceFn = /*#__PURE__*/__webpack_require__.cw(() => {
|
||
|
||
var $ = (export_namespaceFn());
|
||
var call = (function_call_namespaceFn());
|
||
var anObject = (an_object_namespaceFn());
|
||
var getIteratorDirect = (get_iterator_direct_namespaceFn());
|
||
var notANaN = (not_a_nan_namespaceFn());
|
||
var toPositiveInteger = (to_positive_integer_namespaceFn());
|
||
var createIteratorProxy = (iterator_create_proxy_namespaceFn());
|
||
var iteratorClose = (iterator_close_namespaceFn());
|
||
var iteratorHelperThrowsOnInvalidIterator = (iterator_helper_throws_on_invalid_iterator_namespaceFn());
|
||
var iteratorHelperWithoutClosingOnEarlyError = (iterator_helper_without_closing_on_early_error_namespaceFn());
|
||
var IS_PURE = (is_pure_namespaceFn());
|
||
|
||
var $RangeError = RangeError;
|
||
var $Infinity = Infinity;
|
||
|
||
var TAKE_WITHOUT_THROWING_ON_INVALID_ITERATOR = !IS_PURE && !iteratorHelperThrowsOnInvalidIterator('take', 1);
|
||
var takeWithoutClosingOnEarlyError = !IS_PURE && !TAKE_WITHOUT_THROWING_ON_INVALID_ITERATOR
|
||
&& iteratorHelperWithoutClosingOnEarlyError('take', RangeError);
|
||
|
||
var FORCED = IS_PURE || TAKE_WITHOUT_THROWING_ON_INVALID_ITERATOR || takeWithoutClosingOnEarlyError || !function () {
|
||
try {
|
||
// eslint-disable-next-line es/no-iterator, es/no-iterator-prototype-take -- detection
|
||
Iterator.prototype.take.call({
|
||
next: function () { return { done: true }; }
|
||
}, 0x20000000000000);
|
||
} catch (error) {
|
||
return error instanceof $RangeError;
|
||
}
|
||
}();
|
||
|
||
var IteratorProxy = createIteratorProxy(function () {
|
||
var iterator = this.iterator;
|
||
if (!this.remaining--) {
|
||
this.done = true;
|
||
return iteratorClose(iterator, 'normal', undefined);
|
||
}
|
||
var result = anObject(call(this.next, iterator));
|
||
var done = this.done = !!result.done;
|
||
if (!done) return result.value;
|
||
});
|
||
|
||
// `Iterator.prototype.take` method
|
||
// https://tc39.es/ecma262/#sec-iterator.prototype.take
|
||
$({ target: 'Iterator', proto: true, real: true, forced: FORCED }, {
|
||
take: function take(limit) {
|
||
anObject(this);
|
||
var remaining;
|
||
try {
|
||
remaining = toPositiveInteger(notANaN(+limit));
|
||
if (remaining > 0x1FFFFFFFFFFFFF && remaining !== $Infinity) {
|
||
throw new $RangeError('The argument should be a safe integer');
|
||
}
|
||
} catch (error) {
|
||
iteratorClose(this, 'throw', error);
|
||
}
|
||
|
||
if (takeWithoutClosingOnEarlyError) return call(takeWithoutClosingOnEarlyError, this, remaining);
|
||
|
||
return new IteratorProxy(getIteratorDirect(this), {
|
||
remaining: remaining
|
||
});
|
||
}
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/modules/es.json.stringify.js
|
||
var es_json_stringify_namespaceFn = /*#__PURE__*/__webpack_require__.cw(() => {
|
||
|
||
var $ = (export_namespaceFn());
|
||
var getBuiltIn = (get_built_in_namespaceFn());
|
||
var call = (function_call_namespaceFn());
|
||
var uncurryThis = (function_uncurry_this_namespaceFn());
|
||
var fails = (fails_namespaceFn());
|
||
var isArray = (is_array_namespaceFn());
|
||
var isCallable = (is_callable_namespaceFn());
|
||
var isObject = (is_object_namespaceFn());
|
||
var create = (object_create_namespaceFn());
|
||
var isRawJSON = (is_raw_json_namespaceFn());
|
||
var isSymbol = (is_symbol_namespaceFn());
|
||
var classof = (classof_raw_namespaceFn());
|
||
var thisNumberValue = (this_number_value_namespaceFn());
|
||
var includes = (array_includes_namespaceFn().includes);
|
||
var hasOwn = (has_own_property_namespaceFn());
|
||
var toString = (to_string_namespaceFn());
|
||
var parseJSONString = (parse_json_string_namespaceFn());
|
||
var uid = (uid_namespaceFn());
|
||
var NATIVE_SYMBOL = (symbol_constructor_detection_namespaceFn());
|
||
var NATIVE_RAW_JSON = (native_raw_json_namespaceFn());
|
||
|
||
var $String = String;
|
||
var $TypeError = TypeError;
|
||
var $stringify = getBuiltIn('JSON', 'stringify');
|
||
var $BigInt = getBuiltIn('BigInt');
|
||
var stringValueOf = uncurryThis(''.valueOf);
|
||
var booleanValueOf = uncurryThis(true.valueOf);
|
||
var bigIntValueOf = $BigInt && uncurryThis($BigInt.prototype.valueOf);
|
||
var exec = uncurryThis(/./.exec);
|
||
var charAt = uncurryThis(''.charAt);
|
||
var charCodeAt = uncurryThis(''.charCodeAt);
|
||
var replace = uncurryThis(''.replace);
|
||
var slice = uncurryThis(''.slice);
|
||
var push = uncurryThis([].push);
|
||
var pop = uncurryThis([].pop);
|
||
var numberToString = uncurryThis(1.1.toString);
|
||
|
||
var surrogates = /[\uD800-\uDFFF]/g;
|
||
var leadingSurrogates = /^[\uD800-\uDBFF]$/;
|
||
var trailingSurrogates = /^[\uDC00-\uDFFF]$/;
|
||
var digits = /^\d+$/;
|
||
|
||
// a placeholder of a raw JSON value
|
||
var RAW_MARK = uid();
|
||
// a prefix of keys of a reordered object, see `createOrderedObject`
|
||
var KEY_MARK = uid();
|
||
// the last key of a reordered object, marks the end of its serialization
|
||
var END_MARK = uid();
|
||
var RAW_MARK_LENGTH = RAW_MARK.length;
|
||
var KEY_MARK_LENGTH = KEY_MARK.length;
|
||
|
||
var WRONG_SYMBOLS_CONVERSION = !NATIVE_SYMBOL || fails(function () {
|
||
var symbol = getBuiltIn('Symbol')('stringify detection');
|
||
// MS Edge converts symbol values to JSON as {}
|
||
return $stringify([symbol]) !== '[null]'
|
||
// WebKit converts symbol values to JSON as null
|
||
|| $stringify({ a: symbol }) !== '{}'
|
||
// V8 throws on boxed symbols
|
||
|| $stringify(Object(symbol)) !== '{}';
|
||
});
|
||
|
||
// https://github.com/tc39/proposal-well-formed-stringify
|
||
var ILL_FORMED_UNICODE = fails(function () {
|
||
return $stringify('\uDF06\uD834') !== '"\\udf06\\ud834"'
|
||
|| $stringify('\uDEAD') !== '"\\udead"';
|
||
});
|
||
|
||
var isRawJSONValue = NATIVE_RAW_JSON ? getBuiltIn('JSON', 'isRawJSON') : isRawJSON;
|
||
|
||
var stringifyWithProperSymbolsConversion = WRONG_SYMBOLS_CONVERSION ? function (it, replacer, space) {
|
||
return $stringify(it, function (key, value) {
|
||
var replaced = call(replacer, this, key, value);
|
||
if (!isSymbol(replaced)) return replaced;
|
||
}, space);
|
||
} : $stringify;
|
||
|
||
var fixIllFormedJSON = function (match, offset, string) {
|
||
var prev = charAt(string, offset - 1);
|
||
var next = charAt(string, offset + 1);
|
||
if (
|
||
(exec(leadingSurrogates, match) && !exec(trailingSurrogates, next)) ||
|
||
(exec(trailingSurrogates, match) && !exec(leadingSurrogates, prev))
|
||
) {
|
||
return '\\u' + numberToString(charCodeAt(match, 0), 16);
|
||
} return match;
|
||
};
|
||
|
||
// `PropertyList` of `JSON.stringify`
|
||
// https://tc39.es/ecma262/#sec-json.stringify
|
||
var getPropertyList = function (replacer) {
|
||
if (!isArray(replacer)) return;
|
||
var rawLength = replacer.length;
|
||
var propertyList = [];
|
||
// a null prototype object is used as a set of already added keys to keep the deduplication linear
|
||
var addedKeys = create(null);
|
||
for (var i = 0; i < rawLength; i++) {
|
||
var element = replacer[i];
|
||
var key;
|
||
if (typeof element == 'string') key = element;
|
||
else if (typeof element == 'number' || classof(element) === 'Number' || classof(element) === 'String') key = toString(element);
|
||
else continue;
|
||
if (!hasOwn(addedKeys, key)) {
|
||
addedKeys[key] = true;
|
||
push(propertyList, key);
|
||
}
|
||
}
|
||
return propertyList;
|
||
};
|
||
|
||
// values with such an internal slot are unwrapped by `SerializeJSONProperty` instead of being serialized as objects
|
||
var hasInternalSlot = function (valueOf, it) {
|
||
try {
|
||
valueOf(it);
|
||
return true;
|
||
} catch (error) {
|
||
return false;
|
||
}
|
||
};
|
||
|
||
// the slot check is expensive, so it's performed only for the kind reported by the value itself -
|
||
// a value lying about its kind via `Symbol.toStringTag` is serialized as an ordinary object
|
||
var isBoxedPrimitive = function (it) {
|
||
var kind = classof(it);
|
||
return (kind === 'Number' && hasInternalSlot(thisNumberValue, it))
|
||
|| (kind === 'String' && hasInternalSlot(stringValueOf, it))
|
||
|| (kind === 'Boolean' && hasInternalSlot(booleanValueOf, it))
|
||
|| (!!bigIntValueOf && kind === 'BigInt' && hasInternalSlot(bigIntValueOf, it));
|
||
};
|
||
|
||
// only objects serialized by `SerializeJSONObject` are affected by the property list
|
||
var isSerializedAsObject = function (it) {
|
||
if (!isObject(it) || isCallable(it) || isArray(it)) return false;
|
||
try {
|
||
return !isBoxedPrimitive(it);
|
||
// `classof` reads `Symbol.toStringTag`, so a proxy could throw - it has no internal slots anyway
|
||
} catch (error) {
|
||
return true;
|
||
}
|
||
};
|
||
|
||
// the engine unwraps it in the same order as it would read the original property,
|
||
// so the property is read lazily and `toJSON` is called once and with the original key
|
||
var createElementHolder = function (holder, key) {
|
||
return {
|
||
toJSON: function () {
|
||
var element = holder[key];
|
||
if (isObject(element) || typeof element == 'bigint') {
|
||
var elementToJSON = element.toJSON;
|
||
if (isCallable(elementToJSON)) element = call(elementToJSON, element, key);
|
||
} return element;
|
||
}
|
||
};
|
||
};
|
||
|
||
// own keys of objects are sorted - integer-like keys are moved to the beginning,
|
||
// so such keys should be marked and restored in the serialized string
|
||
var getKeyPrefix = function (propertyList) {
|
||
for (var i = 0, length = propertyList.length; i < length; i++) {
|
||
if (exec(digits, propertyList[i])) return KEY_MARK;
|
||
} return '';
|
||
};
|
||
|
||
// `SerializeJSONObject` iterates the property list, so the value is replaced with an object with keys in this order
|
||
var createOrderedObject = function (value, propertyList, keyPrefix) {
|
||
// keys are not marked if the property list has no integer-like keys, so `Object.prototype`
|
||
// with a setter, a non-writable property or `__proto__` should not intercept the assignment
|
||
var ordered = create(null);
|
||
for (var i = 0, length = propertyList.length; i < length; i++) {
|
||
var key = propertyList[i];
|
||
ordered[keyPrefix + key] = createElementHolder(value, key);
|
||
}
|
||
ordered[END_MARK] = null;
|
||
return ordered;
|
||
};
|
||
|
||
// `JSON.stringify` method
|
||
// https://tc39.es/ecma262/#sec-json.stringify
|
||
// https://github.com/tc39/proposal-json-parse-with-source
|
||
if ($stringify) $({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE || !NATIVE_RAW_JSON }, {
|
||
stringify: function stringify(text, replacer, space) {
|
||
var replacerFunction = isCallable(replacer) ? replacer : undefined;
|
||
var propertyList = replacerFunction ? undefined : getPropertyList(replacer);
|
||
var keyPrefix = propertyList && getKeyPrefix(propertyList);
|
||
var rawStrings = [];
|
||
var openObjects = [];
|
||
var parentOrdered = [];
|
||
var currentOrdered;
|
||
var marked = false;
|
||
var root = true;
|
||
|
||
var json = stringifyWithProperSymbolsConversion(text, function (key, value) {
|
||
// some old implementations (like WebKit) could pass numbers as keys
|
||
key = $String(key);
|
||
|
||
if (propertyList) {
|
||
if (key === END_MARK) {
|
||
pop(openObjects);
|
||
currentOrdered = pop(parentOrdered);
|
||
return;
|
||
}
|
||
if (root) root = false;
|
||
// the innermost reordered object already contains only keys of the property list and arrays are not
|
||
// affected by it, the rest of objects (like objects with a fake `Symbol.toStringTag`) are filtered here
|
||
else if (this !== currentOrdered && !isArray(this) && !includes(propertyList, key)) return;
|
||
} else if (replacerFunction) value = call(replacerFunction, this, key, value);
|
||
|
||
if (isRawJSONValue(value)) {
|
||
if (NATIVE_RAW_JSON) return value;
|
||
marked = true;
|
||
return RAW_MARK + (push(rawStrings, value.rawJSON) - 1);
|
||
}
|
||
|
||
if (propertyList && isSerializedAsObject(value)) {
|
||
// reordered objects are new each time, so cycles should be detected before the engine does it
|
||
if (includes(openObjects, value)) throw new $TypeError('Converting circular structure to JSON');
|
||
var ordered = createOrderedObject(value, propertyList, keyPrefix);
|
||
push(openObjects, value);
|
||
push(parentOrdered, currentOrdered);
|
||
currentOrdered = ordered;
|
||
if (keyPrefix) marked = true;
|
||
return ordered;
|
||
}
|
||
|
||
return value;
|
||
}, space);
|
||
|
||
if (typeof json != 'string') return json;
|
||
|
||
if (ILL_FORMED_UNICODE) json = replace(json, surrogates, fixIllFormedJSON);
|
||
|
||
if (!marked) return json;
|
||
|
||
var result = '';
|
||
var length = json.length;
|
||
|
||
for (var i = 0; i < length; i++) {
|
||
var chr = charAt(json, i);
|
||
if (chr === '"') {
|
||
var end = parseJSONString(json, ++i).end - 1;
|
||
var string = slice(json, i, end);
|
||
if (slice(string, 0, RAW_MARK_LENGTH) === RAW_MARK) result += rawStrings[slice(string, RAW_MARK_LENGTH)];
|
||
else if (slice(string, 0, KEY_MARK_LENGTH) === KEY_MARK) result += '"' + slice(string, KEY_MARK_LENGTH) + '"';
|
||
else result += '"' + string + '"';
|
||
i = end;
|
||
} else result += chr;
|
||
}
|
||
|
||
return result;
|
||
}
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/modules/es.map.get-or-insert-computed.js
|
||
var es_map_get_or_insert_computed_namespaceFn = /*#__PURE__*/__webpack_require__.cw(() => {
|
||
|
||
var $ = (export_namespaceFn());
|
||
var aCallable = (a_callable_namespaceFn());
|
||
var MapHelpers = (map_helpers_namespaceFn());
|
||
var IS_PURE = (is_pure_namespaceFn());
|
||
|
||
var get = MapHelpers.get;
|
||
var has = MapHelpers.has;
|
||
var set = MapHelpers.set;
|
||
|
||
// `Map.prototype.getOrInsertComputed` method
|
||
// https://tc39.es/ecma262/#sec-map.prototype.getorinsertcomputed
|
||
$({ target: 'Map', proto: true, real: true, forced: IS_PURE }, {
|
||
getOrInsertComputed: function getOrInsertComputed(key, callbackfn) {
|
||
var hasKey = has(this, key);
|
||
aCallable(callbackfn);
|
||
if (hasKey) return get(this, key);
|
||
// CanonicalizeKeyedCollectionKey
|
||
if (key === 0 && 1 / key === -Infinity) key = 0;
|
||
var value = callbackfn(key);
|
||
set(this, key, value);
|
||
return value;
|
||
}
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/modules/es.map.get-or-insert.js
|
||
var es_map_get_or_insert_namespaceFn = /*#__PURE__*/__webpack_require__.cw(() => {
|
||
|
||
var $ = (export_namespaceFn());
|
||
var MapHelpers = (map_helpers_namespaceFn());
|
||
var IS_PURE = (is_pure_namespaceFn());
|
||
|
||
var get = MapHelpers.get;
|
||
var has = MapHelpers.has;
|
||
var set = MapHelpers.set;
|
||
|
||
// `Map.prototype.getOrInsert` method
|
||
// https://tc39.es/ecma262/#sec-map.prototype.getorinsert
|
||
$({ target: 'Map', proto: true, real: true, forced: IS_PURE }, {
|
||
getOrInsert: function getOrInsert(key, value) {
|
||
if (has(this, key)) return get(this, key);
|
||
set(this, key, value);
|
||
return value;
|
||
}
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/modules/es.promise.try.js
|
||
var es_promise_try_namespaceFn = /*#__PURE__*/__webpack_require__.cw(() => {
|
||
|
||
var $ = (export_namespaceFn());
|
||
var globalThis = (global_this_namespaceFn());
|
||
var apply = (function_apply_namespaceFn());
|
||
var slice = (array_slice_namespaceFn());
|
||
var promiseResolve = (promise_resolve_namespaceFn());
|
||
var newPromiseCapabilityModule = (new_promise_capability_namespaceFn());
|
||
var aCallable = (a_callable_namespaceFn());
|
||
var perform = (perform_namespaceFn());
|
||
var fails = (fails_namespaceFn());
|
||
|
||
var Promise = globalThis.Promise;
|
||
|
||
var ACCEPT_ARGUMENTS = false;
|
||
var FORCED = !Promise || !Promise['try'] || fails(function () {
|
||
var p = Promise.resolve();
|
||
return Promise['try'](function (argument) {
|
||
// avoiding the use of polyfills of the previous iteration of this proposal
|
||
// that does not accept arguments of the callback
|
||
ACCEPT_ARGUMENTS = argument === 8;
|
||
return p;
|
||
// it should use `PromiseResolve`
|
||
// https://github.com/tc39/ecma262/pull/3883
|
||
}, 8) !== p;
|
||
}) || !ACCEPT_ARGUMENTS;
|
||
|
||
// `Promise.try` method
|
||
// https://tc39.es/ecma262/#sec-promise.try
|
||
$({ target: 'Promise', stat: true, forced: FORCED }, {
|
||
'try': function (callbackfn /* , ...args */) {
|
||
var args = arguments.length > 1 ? slice(arguments, 1) : [];
|
||
var result = perform(function () {
|
||
return apply(aCallable(callbackfn), undefined, args);
|
||
});
|
||
if (!result.error) return promiseResolve(this, result.value);
|
||
var promiseCapability = newPromiseCapabilityModule.f(this);
|
||
var reject = promiseCapability.reject;
|
||
reject(result.value);
|
||
return promiseCapability.promise;
|
||
}
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/modules/es.set.difference.v2.js
|
||
var es_set_difference_v2_namespaceFn = /*#__PURE__*/__webpack_require__.cw(() => {
|
||
|
||
var $ = (export_namespaceFn());
|
||
var difference = (set_difference_namespaceFn());
|
||
var fails = (fails_namespaceFn());
|
||
var setMethodAcceptSetLike = (set_method_accept_set_like_namespaceFn());
|
||
|
||
var SET_LIKE_INCORRECT_BEHAVIOR = !setMethodAcceptSetLike('difference', function (result) {
|
||
return result.size === 0;
|
||
});
|
||
|
||
var FORCED = SET_LIKE_INCORRECT_BEHAVIOR || fails(function () {
|
||
// https://bugs.webkit.org/show_bug.cgi?id=288595
|
||
var setLike = {
|
||
size: 1,
|
||
has: function () { return true; },
|
||
keys: function () {
|
||
var index = 0;
|
||
return {
|
||
next: function () {
|
||
var done = index++ > 1;
|
||
if (baseSet.has(1)) baseSet.clear();
|
||
return { done: done, value: 2 };
|
||
}
|
||
};
|
||
}
|
||
};
|
||
// eslint-disable-next-line es/no-set -- testing
|
||
var baseSet = new Set([1, 2, 3, 4]);
|
||
// eslint-disable-next-line es/no-set-prototype-difference -- testing
|
||
return baseSet.difference(setLike).size !== 3;
|
||
});
|
||
|
||
// `Set.prototype.difference` method
|
||
// https://tc39.es/ecma262/#sec-set.prototype.difference
|
||
$({ target: 'Set', proto: true, real: true, forced: FORCED }, {
|
||
difference: difference
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/modules/es.set.intersection.v2.js
|
||
var es_set_intersection_v2_namespaceFn = /*#__PURE__*/__webpack_require__.cw(() => {
|
||
|
||
var $ = (export_namespaceFn());
|
||
var fails = (fails_namespaceFn());
|
||
var intersection = (set_intersection_namespaceFn());
|
||
var setMethodAcceptSetLike = (set_method_accept_set_like_namespaceFn());
|
||
|
||
var INCORRECT = !setMethodAcceptSetLike('intersection', function (result) {
|
||
return result.size === 2 && result.has(1) && result.has(2);
|
||
}) || fails(function () {
|
||
// eslint-disable-next-line es/no-array-from, es/no-set, es/no-set-prototype-intersection -- testing
|
||
return String(Array.from(new Set([1, 2, 3]).intersection(new Set([3, 2])))) !== '3,2';
|
||
});
|
||
|
||
// `Set.prototype.intersection` method
|
||
// https://tc39.es/ecma262/#sec-set.prototype.intersection
|
||
$({ target: 'Set', proto: true, real: true, forced: INCORRECT }, {
|
||
intersection: intersection
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/modules/es.set.is-disjoint-from.v2.js
|
||
var es_set_is_disjoint_from_v2_namespaceFn = /*#__PURE__*/__webpack_require__.cw(() => {
|
||
|
||
var $ = (export_namespaceFn());
|
||
var isDisjointFrom = (set_is_disjoint_from_namespaceFn());
|
||
var setMethodAcceptSetLike = (set_method_accept_set_like_namespaceFn());
|
||
|
||
var INCORRECT = !setMethodAcceptSetLike('isDisjointFrom', function (result) {
|
||
return !result;
|
||
});
|
||
|
||
// `Set.prototype.isDisjointFrom` method
|
||
// https://tc39.es/ecma262/#sec-set.prototype.isdisjointfrom
|
||
$({ target: 'Set', proto: true, real: true, forced: INCORRECT }, {
|
||
isDisjointFrom: isDisjointFrom
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/modules/es.set.is-subset-of.v2.js
|
||
var es_set_is_subset_of_v2_namespaceFn = /*#__PURE__*/__webpack_require__.cw(() => {
|
||
|
||
var $ = (export_namespaceFn());
|
||
var isSubsetOf = (set_is_subset_of_namespaceFn());
|
||
var setMethodAcceptSetLike = (set_method_accept_set_like_namespaceFn());
|
||
|
||
var INCORRECT = !setMethodAcceptSetLike('isSubsetOf', function (result) {
|
||
return result;
|
||
});
|
||
|
||
// `Set.prototype.isSubsetOf` method
|
||
// https://tc39.es/ecma262/#sec-set.prototype.issubsetof
|
||
$({ target: 'Set', proto: true, real: true, forced: INCORRECT }, {
|
||
isSubsetOf: isSubsetOf
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/modules/es.set.is-superset-of.v2.js
|
||
var es_set_is_superset_of_v2_namespaceFn = /*#__PURE__*/__webpack_require__.cw(() => {
|
||
|
||
var $ = (export_namespaceFn());
|
||
var isSupersetOf = (set_is_superset_of_namespaceFn());
|
||
var setMethodAcceptSetLike = (set_method_accept_set_like_namespaceFn());
|
||
|
||
var INCORRECT = !setMethodAcceptSetLike('isSupersetOf', function (result) {
|
||
return !result;
|
||
});
|
||
|
||
// `Set.prototype.isSupersetOf` method
|
||
// https://tc39.es/ecma262/#sec-set.prototype.issupersetof
|
||
$({ target: 'Set', proto: true, real: true, forced: INCORRECT }, {
|
||
isSupersetOf: isSupersetOf
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/modules/es.set.symmetric-difference.v2.js
|
||
var es_set_symmetric_difference_v2_namespaceFn = /*#__PURE__*/__webpack_require__.cw(() => {
|
||
|
||
var $ = (export_namespaceFn());
|
||
var symmetricDifference = (set_symmetric_difference_namespaceFn());
|
||
var setMethodGetKeysBeforeCloning = (set_method_get_keys_before_cloning_detection_namespaceFn());
|
||
var setMethodAcceptSetLike = (set_method_accept_set_like_namespaceFn());
|
||
|
||
var FORCED = !setMethodAcceptSetLike('symmetricDifference') || !setMethodGetKeysBeforeCloning('symmetricDifference');
|
||
|
||
// `Set.prototype.symmetricDifference` method
|
||
// https://tc39.es/ecma262/#sec-set.prototype.symmetricdifference
|
||
$({ target: 'Set', proto: true, real: true, forced: FORCED }, {
|
||
symmetricDifference: symmetricDifference
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/modules/es.set.union.v2.js
|
||
var es_set_union_v2_namespaceFn = /*#__PURE__*/__webpack_require__.cw(() => {
|
||
|
||
var $ = (export_namespaceFn());
|
||
var union = (set_union_namespaceFn());
|
||
var setMethodGetKeysBeforeCloning = (set_method_get_keys_before_cloning_detection_namespaceFn());
|
||
var setMethodAcceptSetLike = (set_method_accept_set_like_namespaceFn());
|
||
|
||
var FORCED = !setMethodAcceptSetLike('union') || !setMethodGetKeysBeforeCloning('union');
|
||
|
||
// `Set.prototype.union` method
|
||
// https://tc39.es/ecma262/#sec-set.prototype.union
|
||
$({ target: 'Set', proto: true, real: true, forced: FORCED }, {
|
||
union: union
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/modules/es.typed-array.with.js
|
||
var es_typed_array_with_namespaceFn = /*#__PURE__*/__webpack_require__.cw(() => {
|
||
|
||
var ArrayBufferViewCore = (array_buffer_view_core_namespaceFn());
|
||
var isBigIntArray = (is_big_int_array_namespaceFn());
|
||
var lengthOfArrayLike = (length_of_array_like_namespaceFn());
|
||
var toIntegerOrInfinity = (to_integer_or_infinity_namespaceFn());
|
||
var toBigInt = (to_big_int_namespaceFn());
|
||
|
||
var aTypedArray = ArrayBufferViewCore.aTypedArray;
|
||
var getTypedArrayConstructor = ArrayBufferViewCore.getTypedArrayConstructor;
|
||
var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
|
||
|
||
var $RangeError = RangeError;
|
||
|
||
var PROPER_ORDER = function () {
|
||
try {
|
||
// eslint-disable-next-line no-throw-literal, es/no-typed-arrays, es/no-array-prototype-with -- required for testing
|
||
new Int8Array(1)['with'](2, { valueOf: function () { throw 8; } });
|
||
} catch (error) {
|
||
// some early implementations, like WebKit, does not follow the final semantic
|
||
// https://github.com/tc39/proposal-change-array-by-copy/pull/86
|
||
return error === 8;
|
||
}
|
||
}();
|
||
|
||
// Bug in WebKit. It should truncate a negative fractional index to zero, but instead throws an error
|
||
var THROW_ON_NEGATIVE_FRACTIONAL_INDEX = PROPER_ORDER && function () {
|
||
try {
|
||
// eslint-disable-next-line es/no-typed-arrays, es/no-array-prototype-with -- required for testing
|
||
new Int8Array(1)['with'](-0.5, 1);
|
||
} catch (error) {
|
||
return true;
|
||
}
|
||
}();
|
||
|
||
// `%TypedArray%.prototype.with` method
|
||
// https://tc39.es/ecma262/#sec-%typedarray%.prototype.with
|
||
exportTypedArrayMethod('with', { 'with': function (index, value) {
|
||
var O = aTypedArray(this);
|
||
var len = lengthOfArrayLike(O);
|
||
var relativeIndex = toIntegerOrInfinity(index);
|
||
var actualIndex = relativeIndex < 0 ? len + relativeIndex : relativeIndex;
|
||
var numericValue = isBigIntArray(O) ? toBigInt(value) : +value;
|
||
if (actualIndex >= len || actualIndex < 0) throw new $RangeError('Incorrect index');
|
||
var A = new (getTypedArrayConstructor(O))(len);
|
||
var k = 0;
|
||
for (; k < len; k++) A[k] = k === actualIndex ? numericValue : O[k];
|
||
return A;
|
||
} }['with'], !PROPER_ORDER || THROW_ON_NEGATIVE_FRACTIONAL_INDEX);
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/modules/es.uint8-array.set-from-base64.js
|
||
var es_uint8_array_set_from_base64_namespaceFn = /*#__PURE__*/__webpack_require__.cw(() => {
|
||
|
||
var $ = (export_namespaceFn());
|
||
var globalThis = (global_this_namespaceFn());
|
||
var $fromBase64 = (uint8_from_base64_namespaceFn());
|
||
var anUint8Array = (an_uint8_array_namespaceFn());
|
||
|
||
var Uint8Array = globalThis.Uint8Array;
|
||
|
||
var INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS = !Uint8Array || !Uint8Array.prototype.setFromBase64 || !function () {
|
||
var target = new Uint8Array([255, 255, 255, 255, 255]);
|
||
try {
|
||
target.setFromBase64('', null);
|
||
return;
|
||
} catch (error) { /* empty */ }
|
||
// Webkit not throw an error on odd length string
|
||
try {
|
||
target.setFromBase64('a');
|
||
return;
|
||
} catch (error) { /* empty */ }
|
||
try {
|
||
target.setFromBase64('MjYyZg===');
|
||
} catch (error) {
|
||
return target[0] === 50 && target[1] === 54 && target[2] === 50 && target[3] === 255 && target[4] === 255;
|
||
}
|
||
}();
|
||
|
||
// `Uint8Array.prototype.setFromBase64` method
|
||
// https://tc39.es/ecma262/#sec-uint8array.prototype.setfrombase64
|
||
if (Uint8Array) $({ target: 'Uint8Array', proto: true, forced: INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS }, {
|
||
setFromBase64: function setFromBase64(string /* , options */) {
|
||
anUint8Array(this);
|
||
|
||
var result = $fromBase64(string, arguments.length > 1 ? arguments[1] : undefined, this, this.length);
|
||
|
||
return { read: result.read, written: result.written };
|
||
}
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/modules/es.uint8-array.set-from-hex.js
|
||
var es_uint8_array_set_from_hex_namespaceFn = /*#__PURE__*/__webpack_require__.cw(() => {
|
||
|
||
var $ = (export_namespaceFn());
|
||
var globalThis = (global_this_namespaceFn());
|
||
var aString = (a_string_namespaceFn());
|
||
var anUint8Array = (an_uint8_array_namespaceFn());
|
||
var notDetached = (array_buffer_not_detached_namespaceFn());
|
||
var $fromHex = (uint8_from_hex_namespaceFn());
|
||
|
||
// Should not throw an error on length-tracking views over ResizableArrayBuffer
|
||
// https://issues.chromium.org/issues/454630441
|
||
function throwsOnLengthTrackingView() {
|
||
try {
|
||
// eslint-disable-next-line es/no-resizable-and-growable-arraybuffers -- required for testing
|
||
var rab = new ArrayBuffer(16, { maxByteLength: 1024 });
|
||
// eslint-disable-next-line es/no-uint8array-prototype-setfromhex, es/no-typed-arrays -- required for testing
|
||
new Uint8Array(rab).setFromHex('cafed00d');
|
||
} catch (error) {
|
||
return true;
|
||
}
|
||
}
|
||
|
||
// `Uint8Array.prototype.setFromHex` method
|
||
// https://tc39.es/ecma262/#sec-uint8array.prototype.setfromhex
|
||
if (globalThis.Uint8Array) $({ target: 'Uint8Array', proto: true, forced: throwsOnLengthTrackingView() }, {
|
||
setFromHex: function setFromHex(string) {
|
||
anUint8Array(this);
|
||
aString(string);
|
||
notDetached(this.buffer);
|
||
var read = $fromHex(string, this).read;
|
||
return { read: read, written: read / 2 };
|
||
}
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/modules/es.uint8-array.to-base64.js
|
||
var es_uint8_array_to_base64_namespaceFn = /*#__PURE__*/__webpack_require__.cw(() => {
|
||
|
||
/* eslint-disable no-useless-assignment -- false positive for [index++] syntax */
|
||
var $ = (export_namespaceFn());
|
||
var globalThis = (global_this_namespaceFn());
|
||
var uncurryThis = (function_uncurry_this_namespaceFn());
|
||
var anObjectOrUndefined = (an_object_or_undefined_namespaceFn());
|
||
var anUint8Array = (an_uint8_array_namespaceFn());
|
||
var notDetached = (array_buffer_not_detached_namespaceFn());
|
||
var base64Map = (base64_map_namespaceFn());
|
||
var getAlphabetOption = (get_alphabet_option_namespaceFn());
|
||
|
||
var base64Alphabet = base64Map.i2c;
|
||
var base64UrlAlphabet = base64Map.i2cUrl;
|
||
var $floor = Math.floor;
|
||
var $ceil = Math.ceil;
|
||
|
||
var charAt = uncurryThis(''.charAt);
|
||
|
||
var Uint8Array = globalThis.Uint8Array;
|
||
var $Array = globalThis.Array;
|
||
var join = uncurryThis([].join);
|
||
|
||
var INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS = !Uint8Array || !Uint8Array.prototype.toBase64 || !function () {
|
||
try {
|
||
var target = new Uint8Array();
|
||
target.toBase64(null);
|
||
} catch (error) {
|
||
return true;
|
||
}
|
||
}();
|
||
|
||
// `Uint8Array.prototype.toBase64` method
|
||
// https://tc39.es/ecma262/#sec-uint8array.prototype.tobase64
|
||
if (Uint8Array) $({ target: 'Uint8Array', proto: true, forced: INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS }, {
|
||
toBase64: function toBase64(/* options */) {
|
||
var array = anUint8Array(this);
|
||
var options = arguments.length ? anObjectOrUndefined(arguments[0]) : undefined;
|
||
var alphabet = getAlphabetOption(options) === 'base64' ? base64Alphabet : base64UrlAlphabet;
|
||
var omitPadding = !!options && !!options.omitPadding;
|
||
notDetached(this.buffer);
|
||
|
||
var i = 0;
|
||
var length = array.length;
|
||
var result = $Array(omitPadding ? $floor(length / 3) * 4 + (length % 3 ? length % 3 + 1 : 0) : $ceil(length / 3) * 4);
|
||
var written = 0;
|
||
var triplet;
|
||
|
||
var at = function (shift) {
|
||
return charAt(alphabet, (triplet >> (6 * shift)) & 63);
|
||
};
|
||
|
||
for (; i + 2 < length; i += 3) {
|
||
triplet = (array[i] << 16) + (array[i + 1] << 8) + array[i + 2];
|
||
result[written++] = at(3);
|
||
result[written++] = at(2);
|
||
result[written++] = at(1);
|
||
result[written++] = at(0);
|
||
}
|
||
if (i + 2 === length) {
|
||
triplet = (array[i] << 16) + (array[i + 1] << 8);
|
||
result[written++] = at(3);
|
||
result[written++] = at(2);
|
||
result[written++] = at(1);
|
||
if (!omitPadding) result[written++] = '=';
|
||
} else if (i + 1 === length) {
|
||
triplet = array[i] << 16;
|
||
result[written++] = at(3);
|
||
result[written++] = at(2);
|
||
if (!omitPadding) {
|
||
result[written++] = '=';
|
||
result[written++] = '=';
|
||
}
|
||
}
|
||
|
||
return join(result, '');
|
||
}
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/modules/es.uint8-array.to-hex.js
|
||
var es_uint8_array_to_hex_namespaceFn = /*#__PURE__*/__webpack_require__.cw(() => {
|
||
|
||
var $ = (export_namespaceFn());
|
||
var globalThis = (global_this_namespaceFn());
|
||
var uncurryThis = (function_uncurry_this_namespaceFn());
|
||
var anUint8Array = (an_uint8_array_namespaceFn());
|
||
var notDetached = (array_buffer_not_detached_namespaceFn());
|
||
|
||
var numberToString = uncurryThis(1.1.toString);
|
||
var join = uncurryThis([].join);
|
||
var $Array = Array;
|
||
|
||
var Uint8Array = globalThis.Uint8Array;
|
||
|
||
var INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS = !Uint8Array || !Uint8Array.prototype.toHex || !(function () {
|
||
try {
|
||
var target = new Uint8Array([255, 255, 255, 255, 255, 255, 255, 255]);
|
||
return target.toHex() === 'ffffffffffffffff';
|
||
} catch (error) {
|
||
return false;
|
||
}
|
||
})();
|
||
|
||
// `Uint8Array.prototype.toHex` method
|
||
// https://tc39.es/ecma262/#sec-uint8array.prototype.tohex
|
||
if (Uint8Array) $({ target: 'Uint8Array', proto: true, forced: INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS }, {
|
||
toHex: function toHex() {
|
||
anUint8Array(this);
|
||
notDetached(this.buffer);
|
||
var result = $Array(this.length);
|
||
for (var i = 0, length = this.length; i < length; i++) {
|
||
var hex = numberToString(this[i], 16);
|
||
result[i] = hex.length === 1 ? '0' + hex : hex;
|
||
}
|
||
return join(result, '');
|
||
}
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/modules/es.weak-map.get-or-insert-computed.js
|
||
var es_weak_map_get_or_insert_computed_namespaceFn = /*#__PURE__*/__webpack_require__.cw(() => {
|
||
|
||
var $ = (export_namespaceFn());
|
||
var aCallable = (a_callable_namespaceFn());
|
||
var aWeakMap = (a_weak_map_namespaceFn());
|
||
var aWeakKey = (a_weak_key_namespaceFn());
|
||
var WeakMapHelpers = (weak_map_helpers_namespaceFn());
|
||
var IS_PURE = (is_pure_namespaceFn());
|
||
|
||
var get = WeakMapHelpers.get;
|
||
var has = WeakMapHelpers.has;
|
||
var set = WeakMapHelpers.set;
|
||
|
||
var FORCED = IS_PURE || !function () {
|
||
try {
|
||
// eslint-disable-next-line es/no-weak-map, no-throw-literal -- testing
|
||
if (WeakMap.prototype.getOrInsertComputed) new WeakMap().getOrInsertComputed(1, function () { throw 1; });
|
||
} catch (error) {
|
||
// FF144 Nightly - Beta 3 bug
|
||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1988369
|
||
return error instanceof TypeError;
|
||
}
|
||
}();
|
||
|
||
// `WeakMap.prototype.getOrInsertComputed` method
|
||
// https://tc39.es/ecma262/#sec-weakmap.prototype.getorinsertcomputed
|
||
$({ target: 'WeakMap', proto: true, real: true, forced: FORCED }, {
|
||
getOrInsertComputed: function getOrInsertComputed(key, callbackfn) {
|
||
if (!IS_PURE) aWeakMap(this);
|
||
aWeakKey(key);
|
||
aCallable(callbackfn);
|
||
if (has(this, key)) return get(this, key);
|
||
var value = callbackfn(key);
|
||
set(this, key, value);
|
||
return value;
|
||
}
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/modules/es.weak-map.get-or-insert.js
|
||
var es_weak_map_get_or_insert_namespaceFn = /*#__PURE__*/__webpack_require__.cw(() => {
|
||
|
||
var $ = (export_namespaceFn());
|
||
var WeakMapHelpers = (weak_map_helpers_namespaceFn());
|
||
var IS_PURE = (is_pure_namespaceFn());
|
||
|
||
var get = WeakMapHelpers.get;
|
||
var has = WeakMapHelpers.has;
|
||
var set = WeakMapHelpers.set;
|
||
|
||
// `WeakMap.prototype.getOrInsert` method
|
||
// https://tc39.es/ecma262/#sec-weakmap.prototype.getorinsert
|
||
$({ target: 'WeakMap', proto: true, real: true, forced: IS_PURE }, {
|
||
getOrInsert: function getOrInsert(key, value) {
|
||
if (has(this, key)) return get(this, key);
|
||
set(this, key, value);
|
||
return value;
|
||
}
|
||
});
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/modules/web.dom-exception.stack.js
|
||
var web_dom_exception_stack_namespaceFn = /*#__PURE__*/__webpack_require__.cw(() => {
|
||
|
||
var $ = (export_namespaceFn());
|
||
var globalThis = (global_this_namespaceFn());
|
||
var getBuiltIn = (get_built_in_namespaceFn());
|
||
var createPropertyDescriptor = (create_property_descriptor_namespaceFn());
|
||
var defineProperty = (object_define_property_namespaceFn().f);
|
||
var hasOwn = (has_own_property_namespaceFn());
|
||
var anInstance = (an_instance_namespaceFn());
|
||
var inheritIfRequired = (inherit_if_required_namespaceFn());
|
||
var normalizeStringArgument = (normalize_string_argument_namespaceFn());
|
||
var DOMExceptionConstants = (dom_exception_constants_namespaceFn());
|
||
var clearErrorStack = (error_stack_clear_namespaceFn());
|
||
var DESCRIPTORS = (descriptors_namespaceFn());
|
||
var IS_PURE = (is_pure_namespaceFn());
|
||
|
||
var DOM_EXCEPTION = 'DOMException';
|
||
var Error = getBuiltIn('Error');
|
||
var NativeDOMException = getBuiltIn(DOM_EXCEPTION);
|
||
|
||
var $DOMException = function DOMException() {
|
||
anInstance(this, DOMExceptionPrototype);
|
||
var argumentsLength = arguments.length;
|
||
var message = normalizeStringArgument(argumentsLength < 1 ? undefined : arguments[0]);
|
||
var name = normalizeStringArgument(argumentsLength < 2 ? undefined : arguments[1], 'Error');
|
||
var that = new NativeDOMException(message, name);
|
||
var error = new Error(message);
|
||
error.name = DOM_EXCEPTION;
|
||
defineProperty(that, 'stack', createPropertyDescriptor(1, clearErrorStack(error.stack, 1)));
|
||
inheritIfRequired(that, this, $DOMException);
|
||
return that;
|
||
};
|
||
|
||
var DOMExceptionPrototype = $DOMException.prototype = NativeDOMException.prototype;
|
||
|
||
var ERROR_HAS_STACK = 'stack' in new Error(DOM_EXCEPTION);
|
||
var DOM_EXCEPTION_HAS_STACK = 'stack' in new NativeDOMException(1, 2);
|
||
|
||
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
||
var descriptor = NativeDOMException && DESCRIPTORS && Object.getOwnPropertyDescriptor(globalThis, DOM_EXCEPTION);
|
||
|
||
// Bun ~ 0.1.1 DOMException have incorrect descriptor and we can't redefine it
|
||
// https://github.com/Jarred-Sumner/bun/issues/399
|
||
var BUGGY_DESCRIPTOR = !!descriptor && !(descriptor.writable && descriptor.configurable);
|
||
|
||
var FORCED_CONSTRUCTOR = ERROR_HAS_STACK && !BUGGY_DESCRIPTOR && !DOM_EXCEPTION_HAS_STACK;
|
||
|
||
// `DOMException` constructor patch for `.stack` where it's required
|
||
// https://webidl.spec.whatwg.org/#es-DOMException-specialness
|
||
$({ global: true, constructor: true, forced: IS_PURE || FORCED_CONSTRUCTOR }, { // TODO: fix export logic
|
||
DOMException: FORCED_CONSTRUCTOR ? $DOMException : NativeDOMException
|
||
});
|
||
|
||
var PolyfilledDOMException = getBuiltIn(DOM_EXCEPTION);
|
||
var PolyfilledDOMExceptionPrototype = PolyfilledDOMException.prototype;
|
||
|
||
if (PolyfilledDOMExceptionPrototype.constructor !== PolyfilledDOMException) {
|
||
if (!IS_PURE) {
|
||
defineProperty(PolyfilledDOMExceptionPrototype, 'constructor', createPropertyDescriptor(1, PolyfilledDOMException));
|
||
}
|
||
|
||
for (var key in DOMExceptionConstants) if (hasOwn(DOMExceptionConstants, key)) {
|
||
var constant = DOMExceptionConstants[key];
|
||
var constantName = constant.s;
|
||
if (!hasOwn(PolyfilledDOMException, constantName)) {
|
||
defineProperty(PolyfilledDOMException, constantName, createPropertyDescriptor(6, constant.c));
|
||
}
|
||
}
|
||
}
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/modules/web.self.js
|
||
var web_self_namespaceFn = /*#__PURE__*/__webpack_require__.cw(() => {
|
||
|
||
var $ = (export_namespaceFn());
|
||
var globalThis = (global_this_namespaceFn());
|
||
var defineBuiltInAccessor = (define_built_in_accessor_namespaceFn());
|
||
var DESCRIPTORS = (descriptors_namespaceFn());
|
||
|
||
var $TypeError = TypeError;
|
||
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
||
var defineProperty = Object.defineProperty;
|
||
var INCORRECT_VALUE = globalThis.self !== globalThis;
|
||
|
||
// `self` getter
|
||
// https://html.spec.whatwg.org/multipage/window-object.html#dom-self
|
||
try {
|
||
if (DESCRIPTORS) {
|
||
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
||
var descriptor = Object.getOwnPropertyDescriptor(globalThis, 'self');
|
||
// some engines have `self`, but with incorrect descriptor
|
||
// https://github.com/denoland/deno/issues/15765
|
||
if (INCORRECT_VALUE || !descriptor || !descriptor.get || !descriptor.enumerable) {
|
||
defineBuiltInAccessor(globalThis, 'self', {
|
||
get: function self() {
|
||
return globalThis;
|
||
},
|
||
set: function self(value) {
|
||
if (this !== globalThis) throw new $TypeError('Illegal invocation');
|
||
defineProperty(globalThis, 'self', {
|
||
value: value,
|
||
writable: true,
|
||
configurable: true,
|
||
enumerable: true
|
||
});
|
||
},
|
||
configurable: true,
|
||
enumerable: true
|
||
});
|
||
}
|
||
} else $({ global: true, simple: true, forced: INCORRECT_VALUE }, {
|
||
self: globalThis
|
||
});
|
||
} catch (error) { /* empty */ }
|
||
|
||
});
|
||
|
||
// MODULE: ./node_modules/core-js/modules/web.url.parse.js
|
||
var web_url_parse_namespaceFn = /*#__PURE__*/__webpack_require__.cw(() => {
|
||
|
||
var $ = (export_namespaceFn());
|
||
var getBuiltIn = (get_built_in_namespaceFn());
|
||
var validateArgumentsLength = (validate_arguments_length_namespaceFn());
|
||
var toString = (to_string_namespaceFn());
|
||
var USE_NATIVE_URL = (url_constructor_detection_namespaceFn());
|
||
|
||
var URL = getBuiltIn('URL');
|
||
|
||
// `URL.parse` method
|
||
// https://url.spec.whatwg.org/#dom-url-parse
|
||
$({ target: 'URL', stat: true, forced: !USE_NATIVE_URL }, {
|
||
parse: function parse(url) {
|
||
var length = validateArgumentsLength(arguments.length, 1);
|
||
var urlString = toString(url);
|
||
var base = length < 2 || arguments[1] === undefined ? undefined : toString(arguments[1]);
|
||
try {
|
||
return new URL(urlString, base);
|
||
} catch (error) {
|
||
return null;
|
||
}
|
||
}
|
||
});
|
||
|
||
});
|
||
|
||
;// ./node_modules/core-js/modules/es.array.push.js
|
||
es_array_push_namespaceFn();
|
||
|
||
;// ./node_modules/core-js/modules/es.iterator.constructor.js
|
||
es_iterator_constructor_namespaceFn();
|
||
|
||
;// ./node_modules/core-js/modules/es.iterator.take.js
|
||
es_iterator_take_namespaceFn();
|
||
|
||
;// ./node_modules/core-js/modules/es.map.get-or-insert.js
|
||
es_map_get_or_insert_namespaceFn();
|
||
|
||
;// ./node_modules/core-js/modules/es.map.get-or-insert-computed.js
|
||
es_map_get_or_insert_computed_namespaceFn();
|
||
|
||
;// ./node_modules/core-js/modules/es.typed-array.with.js
|
||
es_typed_array_with_namespaceFn();
|
||
|
||
;// ./node_modules/core-js/modules/es.uint8-array.set-from-base64.js
|
||
es_uint8_array_set_from_base64_namespaceFn();
|
||
|
||
;// ./node_modules/core-js/modules/es.uint8-array.set-from-hex.js
|
||
es_uint8_array_set_from_hex_namespaceFn();
|
||
|
||
;// ./node_modules/core-js/modules/es.uint8-array.to-base64.js
|
||
es_uint8_array_to_base64_namespaceFn();
|
||
|
||
;// ./node_modules/core-js/modules/es.uint8-array.to-hex.js
|
||
es_uint8_array_to_hex_namespaceFn();
|
||
|
||
;// ./node_modules/core-js/modules/web.self.js
|
||
web_self_namespaceFn();
|
||
|
||
;// ./node_modules/core-js/modules/es.iterator.filter.js
|
||
es_iterator_filter_namespaceFn();
|
||
|
||
;// ./node_modules/core-js/modules/es.iterator.map.js
|
||
es_iterator_map_namespaceFn();
|
||
|
||
;// ./node_modules/core-js/modules/es.json.stringify.js
|
||
es_json_stringify_namespaceFn();
|
||
|
||
;// ./node_modules/core-js/modules/es.weak-map.get-or-insert.js
|
||
es_weak_map_get_or_insert_namespaceFn();
|
||
|
||
;// ./node_modules/core-js/modules/es.weak-map.get-or-insert-computed.js
|
||
es_weak_map_get_or_insert_computed_namespaceFn();
|
||
|
||
;// ./node_modules/core-js/modules/es.iterator.for-each.js
|
||
es_iterator_for_each_namespaceFn();
|
||
|
||
;// ./node_modules/core-js/modules/es.set.difference.v2.js
|
||
es_set_difference_v2_namespaceFn();
|
||
|
||
;// ./node_modules/core-js/modules/es.set.intersection.v2.js
|
||
es_set_intersection_v2_namespaceFn();
|
||
|
||
;// ./node_modules/core-js/modules/es.set.is-disjoint-from.v2.js
|
||
es_set_is_disjoint_from_v2_namespaceFn();
|
||
|
||
;// ./node_modules/core-js/modules/es.set.is-subset-of.v2.js
|
||
es_set_is_subset_of_v2_namespaceFn();
|
||
|
||
;// ./node_modules/core-js/modules/es.set.is-superset-of.v2.js
|
||
es_set_is_superset_of_v2_namespaceFn();
|
||
|
||
;// ./node_modules/core-js/modules/es.set.symmetric-difference.v2.js
|
||
es_set_symmetric_difference_v2_namespaceFn();
|
||
|
||
;// ./node_modules/core-js/modules/es.set.union.v2.js
|
||
es_set_union_v2_namespaceFn();
|
||
|
||
;// ./node_modules/core-js/modules/es.array.includes.js
|
||
es_array_includes_namespaceFn();
|
||
|
||
;// ./node_modules/core-js/modules/web.url.parse.js
|
||
web_url_parse_namespaceFn();
|
||
|
||
;// ./src/shared/util.js
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
|
||
const BBOX_INIT = [Infinity, Infinity, -Infinity, -Infinity];
|
||
const F32_BBOX_INIT = new Float32Array(BBOX_INIT);
|
||
const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
|
||
const DEFAULT_VERTICAL_ORIGIN_Y = 880;
|
||
const DEFAULT_VERTICAL_ADVANCE = 1000;
|
||
const LINE_FACTOR = 1.35;
|
||
const LINE_DESCENT_FACTOR = 0.35;
|
||
const BASELINE_FACTOR = (/* unused pure expression or super */ null && (LINE_DESCENT_FACTOR / LINE_FACTOR));
|
||
const SVG_NS = "http://www.w3.org/2000/svg";
|
||
const RenderingIntentFlag = {
|
||
ANY: 0x01,
|
||
DISPLAY: 0x02,
|
||
PRINT: 0x04,
|
||
SAVE: 0x08,
|
||
ANNOTATIONS_FORMS: 0x10,
|
||
ANNOTATIONS_STORAGE: 0x20,
|
||
ANNOTATIONS_DISABLE: 0x40,
|
||
IS_EDITING: 0x80,
|
||
OPLIST: 0x100
|
||
};
|
||
const AnnotationMode = (/* unused pure expression or super */ null && ({
|
||
DISABLE: 0,
|
||
ENABLE: 1,
|
||
ENABLE_FORMS: 2,
|
||
ENABLE_STORAGE: 3
|
||
}));
|
||
const AnnotationPrefix = "pdfjs_internal_id_";
|
||
const AnnotationEditorPrefix = "pdfjs_internal_editor_";
|
||
const AnnotationEditorType = (/* unused pure expression or super */ null && ({
|
||
DISABLE: -1,
|
||
NONE: 0,
|
||
FREETEXT: 3,
|
||
HIGHLIGHT: 9,
|
||
STAMP: 13,
|
||
INK: 15,
|
||
POPUP: 16,
|
||
SIGNATURE: 101,
|
||
COMMENT: 102
|
||
}));
|
||
const AnnotationEditorParamsType = (/* unused pure expression or super */ null && ({
|
||
RESIZE: 1,
|
||
CREATE: 2,
|
||
FREETEXT_SIZE: 11,
|
||
FREETEXT_COLOR: 12,
|
||
FREETEXT_OPACITY: 13,
|
||
INK_COLOR: 21,
|
||
INK_THICKNESS: 22,
|
||
INK_OPACITY: 23,
|
||
INK_COLOR_AND_OPACITY: 24,
|
||
HIGHLIGHT_COLOR: 31,
|
||
HIGHLIGHT_THICKNESS: 32,
|
||
HIGHLIGHT_FREE: 33,
|
||
HIGHLIGHT_SHOW_ALL: 34,
|
||
DRAW_STEP: 41
|
||
}));
|
||
const PermissionFlag = (/* unused pure expression or super */ null && ({
|
||
PRINT: 0x04,
|
||
MODIFY_CONTENTS: 0x08,
|
||
COPY: 0x10,
|
||
MODIFY_ANNOTATIONS: 0x20,
|
||
FILL_INTERACTIVE_FORMS: 0x100,
|
||
COPY_FOR_ACCESSIBILITY: 0x200,
|
||
ASSEMBLE: 0x400,
|
||
PRINT_HIGH_QUALITY: 0x800
|
||
}));
|
||
const MeshFigureType = (/* unused pure expression or super */ null && ({
|
||
TRIANGLES: 1,
|
||
LATTICE: 2,
|
||
PATCH: 3
|
||
}));
|
||
const TextRenderingMode = {
|
||
FILL: 0,
|
||
STROKE: 1,
|
||
FILL_STROKE: 2,
|
||
INVISIBLE: 3,
|
||
FILL_ADD_TO_PATH: 4,
|
||
STROKE_ADD_TO_PATH: 5,
|
||
FILL_STROKE_ADD_TO_PATH: 6,
|
||
ADD_TO_PATH: 7,
|
||
FILL_STROKE_MASK: 3,
|
||
ADD_TO_PATH_FLAG: 4
|
||
};
|
||
const ImageKind = {
|
||
GRAYSCALE_1BPP: 1,
|
||
RGB_24BPP: 2,
|
||
RGBA_32BPP: 3
|
||
};
|
||
const AnnotationType = (/* unused pure expression or super */ null && ({
|
||
TEXT: 1,
|
||
LINK: 2,
|
||
FREETEXT: 3,
|
||
LINE: 4,
|
||
SQUARE: 5,
|
||
CIRCLE: 6,
|
||
POLYGON: 7,
|
||
POLYLINE: 8,
|
||
HIGHLIGHT: 9,
|
||
UNDERLINE: 10,
|
||
SQUIGGLY: 11,
|
||
STRIKEOUT: 12,
|
||
STAMP: 13,
|
||
CARET: 14,
|
||
INK: 15,
|
||
POPUP: 16,
|
||
FILEATTACHMENT: 17,
|
||
SOUND: 18,
|
||
MOVIE: 19,
|
||
WIDGET: 20,
|
||
SCREEN: 21,
|
||
PRINTERMARK: 22,
|
||
TRAPNET: 23,
|
||
WATERMARK: 24,
|
||
THREED: 25,
|
||
REDACT: 26,
|
||
RICHMEDIA: 27
|
||
}));
|
||
const AnnotationReplyType = (/* unused pure expression or super */ null && ({
|
||
GROUP: "Group",
|
||
REPLY: "R"
|
||
}));
|
||
const AnnotationRenditionOperation = (/* unused pure expression or super */ null && ({
|
||
PLAY_OR_RESUME: 0,
|
||
STOP: 1,
|
||
PAUSE: 2,
|
||
RESUME: 3,
|
||
PLAY: 4
|
||
}));
|
||
const AnnotationFlag = (/* unused pure expression or super */ null && ({
|
||
INVISIBLE: 0x01,
|
||
HIDDEN: 0x02,
|
||
PRINT: 0x04,
|
||
NOZOOM: 0x08,
|
||
NOROTATE: 0x10,
|
||
NOVIEW: 0x20,
|
||
READONLY: 0x40,
|
||
LOCKED: 0x80,
|
||
TOGGLENOVIEW: 0x100,
|
||
LOCKEDCONTENTS: 0x200
|
||
}));
|
||
const AnnotationFieldFlag = (/* unused pure expression or super */ null && ({
|
||
READONLY: 0x0000001,
|
||
REQUIRED: 0x0000002,
|
||
NOEXPORT: 0x0000004,
|
||
MULTILINE: 0x0001000,
|
||
PASSWORD: 0x0002000,
|
||
NOTOGGLETOOFF: 0x0004000,
|
||
RADIO: 0x0008000,
|
||
PUSHBUTTON: 0x0010000,
|
||
COMBO: 0x0020000,
|
||
EDIT: 0x0040000,
|
||
SORT: 0x0080000,
|
||
FILESELECT: 0x0100000,
|
||
MULTISELECT: 0x0200000,
|
||
DONOTSPELLCHECK: 0x0400000,
|
||
DONOTSCROLL: 0x0800000,
|
||
COMB: 0x1000000,
|
||
RICHTEXT: 0x2000000,
|
||
RADIOSINUNISON: 0x2000000,
|
||
COMMITONSELCHANGE: 0x4000000
|
||
}));
|
||
const AnnotationBorderStyleType = (/* unused pure expression or super */ null && ({
|
||
SOLID: 1,
|
||
DASHED: 2,
|
||
BEVELED: 3,
|
||
INSET: 4,
|
||
UNDERLINE: 5
|
||
}));
|
||
const AnnotationActionEventType = (/* unused pure expression or super */ null && ({
|
||
E: "Mouse Enter",
|
||
X: "Mouse Exit",
|
||
D: "Mouse Down",
|
||
U: "Mouse Up",
|
||
Fo: "Focus",
|
||
Bl: "Blur",
|
||
PO: "PageOpen",
|
||
PC: "PageClose",
|
||
PV: "PageVisible",
|
||
PI: "PageInvisible",
|
||
K: "Keystroke",
|
||
F: "Format",
|
||
V: "Validate",
|
||
C: "Calculate"
|
||
}));
|
||
const DocumentActionEventType = (/* unused pure expression or super */ null && ({
|
||
WC: "WillClose",
|
||
WS: "WillSave",
|
||
DS: "DidSave",
|
||
WP: "WillPrint",
|
||
DP: "DidPrint"
|
||
}));
|
||
const PageActionEventType = (/* unused pure expression or super */ null && ({
|
||
O: "PageOpen",
|
||
C: "PageClose"
|
||
}));
|
||
const VerbosityLevel = {
|
||
ERRORS: 0,
|
||
WARNINGS: 1,
|
||
INFOS: 5
|
||
};
|
||
const OPS = {
|
||
dependency: 1,
|
||
setLineWidth: 2,
|
||
setLineCap: 3,
|
||
setLineJoin: 4,
|
||
setMiterLimit: 5,
|
||
setDash: 6,
|
||
setRenderingIntent: 7,
|
||
setFlatness: 8,
|
||
setGState: 9,
|
||
save: 10,
|
||
restore: 11,
|
||
transform: 12,
|
||
moveTo: 13,
|
||
lineTo: 14,
|
||
curveTo: 15,
|
||
curveTo2: 16,
|
||
curveTo3: 17,
|
||
closePath: 18,
|
||
rectangle: 19,
|
||
stroke: 20,
|
||
closeStroke: 21,
|
||
fill: 22,
|
||
eoFill: 23,
|
||
fillStroke: 24,
|
||
eoFillStroke: 25,
|
||
closeFillStroke: 26,
|
||
closeEOFillStroke: 27,
|
||
endPath: 28,
|
||
clip: 29,
|
||
eoClip: 30,
|
||
beginText: 31,
|
||
endText: 32,
|
||
setCharSpacing: 33,
|
||
setWordSpacing: 34,
|
||
setHScale: 35,
|
||
setLeading: 36,
|
||
setFont: 37,
|
||
setTextRenderingMode: 38,
|
||
setTextRise: 39,
|
||
moveText: 40,
|
||
setLeadingMoveText: 41,
|
||
setTextMatrix: 42,
|
||
nextLine: 43,
|
||
showText: 44,
|
||
showSpacedText: 45,
|
||
nextLineShowText: 46,
|
||
nextLineSetSpacingShowText: 47,
|
||
setCharWidth: 48,
|
||
setCharWidthAndBounds: 49,
|
||
setStrokeColorSpace: 50,
|
||
setFillColorSpace: 51,
|
||
setStrokeColor: 52,
|
||
setStrokeColorN: 53,
|
||
setFillColor: 54,
|
||
setFillColorN: 55,
|
||
setStrokeGray: 56,
|
||
setFillGray: 57,
|
||
setStrokeRGBColor: 58,
|
||
setFillRGBColor: 59,
|
||
setStrokeCMYKColor: 60,
|
||
setFillCMYKColor: 61,
|
||
shadingFill: 62,
|
||
beginInlineImage: 63,
|
||
beginImageData: 64,
|
||
endInlineImage: 65,
|
||
paintXObject: 66,
|
||
markPoint: 67,
|
||
markPointProps: 68,
|
||
beginMarkedContent: 69,
|
||
beginMarkedContentProps: 70,
|
||
endMarkedContent: 71,
|
||
beginCompat: 72,
|
||
endCompat: 73,
|
||
paintFormXObjectBegin: 74,
|
||
paintFormXObjectEnd: 75,
|
||
beginGroup: 76,
|
||
endGroup: 77,
|
||
beginAnnotation: 80,
|
||
endAnnotation: 81,
|
||
paintImageMaskXObject: 83,
|
||
paintImageMaskXObjectGroup: 84,
|
||
paintImageXObject: 85,
|
||
paintInlineImageXObject: 86,
|
||
paintInlineImageXObjectGroup: 87,
|
||
paintImageXObjectRepeat: 88,
|
||
paintImageMaskXObjectRepeat: 89,
|
||
paintSolidColorImageMask: 90,
|
||
constructPath: 91,
|
||
setStrokeTransparent: 92,
|
||
setFillTransparent: 93,
|
||
rawFillPath: 94
|
||
};
|
||
const DrawOPS = {
|
||
moveTo: 0,
|
||
lineTo: 1,
|
||
curveTo: 2,
|
||
quadraticCurveTo: 3,
|
||
closePath: 4
|
||
};
|
||
const PasswordResponses = (/* unused pure expression or super */ null && ({
|
||
NEED_PASSWORD: 1,
|
||
INCORRECT_PASSWORD: 2
|
||
}));
|
||
let verbosity = VerbosityLevel.WARNINGS;
|
||
function setVerbosityLevel(level) {
|
||
if (Number.isInteger(level)) {
|
||
verbosity = level;
|
||
}
|
||
}
|
||
function getVerbosityLevel() {
|
||
return verbosity;
|
||
}
|
||
function info(msg) {
|
||
if (verbosity >= VerbosityLevel.INFOS) {
|
||
console.info(`Info: ${msg}`);
|
||
}
|
||
}
|
||
function warn(msg) {
|
||
if (verbosity >= VerbosityLevel.WARNINGS) {
|
||
console.warn(`Warning: ${msg}`);
|
||
}
|
||
}
|
||
function unreachable(msg) {
|
||
throw new Error(msg);
|
||
}
|
||
function assert(cond, msg) {
|
||
if (!cond) {
|
||
unreachable(msg);
|
||
}
|
||
}
|
||
function _isValidProtocol(url) {
|
||
switch (url?.protocol) {
|
||
case "http:":
|
||
case "https:":
|
||
case "ftp:":
|
||
case "mailto:":
|
||
case "tel:":
|
||
return true;
|
||
default:
|
||
return false;
|
||
}
|
||
}
|
||
function createValidAbsoluteUrl(url, baseUrl = null, options = null) {
|
||
if (!url) {
|
||
return null;
|
||
}
|
||
if (options && typeof url === "string") {
|
||
if (options.addDefaultProtocol && url.startsWith("www.")) {
|
||
const dots = url.match(/\./g);
|
||
if (dots?.length >= 2) {
|
||
url = `http://${url}`;
|
||
}
|
||
}
|
||
if (options.tryConvertEncoding) {
|
||
try {
|
||
url = stringToUTF8String(url);
|
||
} catch {}
|
||
}
|
||
}
|
||
const absoluteUrl = baseUrl ? URL.parse(url, baseUrl) : URL.parse(url);
|
||
return _isValidProtocol(absoluteUrl) ? absoluteUrl : null;
|
||
}
|
||
function updateUrlHash(url, hash, allowRel = false) {
|
||
const res = URL.parse(url);
|
||
if (res) {
|
||
res.hash = hash;
|
||
return res.href;
|
||
}
|
||
if (allowRel && createValidAbsoluteUrl(url, "http://example.com")) {
|
||
return url.split("#", 1)[0] + `${hash ? `#${hash}` : ""}`;
|
||
}
|
||
return "";
|
||
}
|
||
function stripPath(str) {
|
||
return str.substring(str.lastIndexOf("/") + 1);
|
||
}
|
||
function util_shadow(obj, prop, value, nonSerializable = false) {
|
||
Object.defineProperty(obj, prop, {
|
||
value,
|
||
enumerable: !nonSerializable,
|
||
configurable: true,
|
||
writable: false
|
||
});
|
||
return value;
|
||
}
|
||
const BaseException = function BaseExceptionClosure() {
|
||
function BaseException(message, name) {
|
||
this.message = message;
|
||
this.name = name;
|
||
}
|
||
BaseException.prototype = new Error();
|
||
BaseException.constructor = BaseException;
|
||
return BaseException;
|
||
}();
|
||
class PasswordException extends BaseException {
|
||
constructor(msg, code) {
|
||
super(msg, "PasswordException");
|
||
this.code = code;
|
||
}
|
||
}
|
||
class UnknownErrorException extends BaseException {
|
||
constructor(msg, details) {
|
||
super(msg, "UnknownErrorException");
|
||
this.details = details;
|
||
}
|
||
}
|
||
class InvalidPDFException extends BaseException {
|
||
constructor(msg) {
|
||
super(msg, "InvalidPDFException");
|
||
}
|
||
}
|
||
class ResponseException extends BaseException {
|
||
constructor(msg, status, missing) {
|
||
super(msg, "ResponseException");
|
||
this.status = status;
|
||
this.missing = missing;
|
||
}
|
||
}
|
||
class FormatError extends BaseException {
|
||
constructor(msg) {
|
||
super(msg, "FormatError");
|
||
}
|
||
}
|
||
class AbortException extends BaseException {
|
||
constructor(msg) {
|
||
super(msg, "AbortException");
|
||
}
|
||
}
|
||
function bytesToString(bytes) {
|
||
if (typeof bytes !== "object" || bytes?.length === undefined) {
|
||
unreachable("Invalid argument for bytesToString");
|
||
}
|
||
const length = bytes.length;
|
||
const MAX_ARGUMENT_COUNT = 8192;
|
||
if (length < MAX_ARGUMENT_COUNT) {
|
||
return String.fromCharCode.apply(null, bytes);
|
||
}
|
||
const strBuf = [];
|
||
for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
|
||
const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
|
||
const chunk = bytes.subarray(i, chunkEnd);
|
||
strBuf.push(String.fromCharCode.apply(null, chunk));
|
||
}
|
||
return strBuf.join("");
|
||
}
|
||
function stringToBytes(str) {
|
||
if (typeof str !== "string") {
|
||
unreachable("Invalid argument for stringToBytes");
|
||
}
|
||
const length = str.length;
|
||
const bytes = new Uint8Array(length);
|
||
for (let i = 0; i < length; ++i) {
|
||
bytes[i] = str.charCodeAt(i) & 0xff;
|
||
}
|
||
return bytes;
|
||
}
|
||
class FeatureTest {
|
||
static get isLittleEndian() {
|
||
const buffer8 = new Uint8Array(4);
|
||
buffer8[0] = 1;
|
||
const view32 = new Uint32Array(buffer8.buffer, 0, 1);
|
||
return util_shadow(this, "isLittleEndian", view32[0] === 1);
|
||
}
|
||
static get isOffscreenCanvasSupported() {
|
||
return util_shadow(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas !== "undefined");
|
||
}
|
||
static get isImageDecoderSupported() {
|
||
return util_shadow(this, "isImageDecoderSupported", typeof ImageDecoder !== "undefined");
|
||
}
|
||
static get isVideoFrameSupported() {
|
||
return util_shadow(this, "isVideoFrameSupported", typeof VideoFrame !== "undefined");
|
||
}
|
||
static get isFloat16ArraySupported() {
|
||
return util_shadow(this, "isFloat16ArraySupported", typeof Float16Array !== "undefined");
|
||
}
|
||
static get isSanitizerSupported() {
|
||
return util_shadow(this, "isSanitizerSupported", typeof Sanitizer !== "undefined");
|
||
}
|
||
static get platform() {
|
||
const {
|
||
platform,
|
||
userAgent
|
||
} = navigator;
|
||
return util_shadow(this, "platform", {
|
||
isAndroid: userAgent.includes("Android"),
|
||
isLinux: platform.includes("Linux"),
|
||
isMac: platform.includes("Mac"),
|
||
isWindows: platform.includes("Win"),
|
||
isFirefox: userAgent.includes("Firefox")
|
||
});
|
||
}
|
||
static get isCanvasFilterSupported() {
|
||
let ctx;
|
||
if (this.isOffscreenCanvasSupported) {
|
||
ctx = new OffscreenCanvas(1, 1).getContext("2d");
|
||
}
|
||
return util_shadow(this, "isCanvasFilterSupported", ctx?.filter !== undefined);
|
||
}
|
||
static get isAlphaColorInputSupported() {
|
||
return util_shadow(this, "isAlphaColorInputSupported", false);
|
||
}
|
||
static get isBackdropFilterSupported() {
|
||
return util_shadow(this, "isBackdropFilterSupported", typeof CSS !== "undefined" && CSS.supports("backdrop-filter", "blur(1px)"));
|
||
}
|
||
}
|
||
class Util {
|
||
static get hexNums() {
|
||
return util_shadow(this, "hexNums", Array.from({
|
||
length: 256
|
||
}, (_, n) => n.toString(16).padStart(2, "0")));
|
||
}
|
||
static makeHexColor(r, g, b) {
|
||
return `#${this.hexNums[r]}${this.hexNums[g]}${this.hexNums[b]}`;
|
||
}
|
||
static get identity0to256Map() {
|
||
return util_shadow(this, "identity0to256Map", Uint8Array.from({
|
||
length: 256
|
||
}, (_, i) => i));
|
||
}
|
||
static transform(m1, m2) {
|
||
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]];
|
||
}
|
||
static multiplyByDOMMatrix(m, md) {
|
||
return [m[0] * md.a + m[2] * md.b, m[1] * md.a + m[3] * md.b, m[0] * md.c + m[2] * md.d, m[1] * md.c + m[3] * md.d, m[0] * md.e + m[2] * md.f + m[4], m[1] * md.e + m[3] * md.f + m[5]];
|
||
}
|
||
static applyTransform(p, m, pos = 0) {
|
||
const p0 = p[pos];
|
||
const p1 = p[pos + 1];
|
||
p[pos] = p0 * m[0] + p1 * m[2] + m[4];
|
||
p[pos + 1] = p0 * m[1] + p1 * m[3] + m[5];
|
||
}
|
||
static applyTransformToBezier(p, transform, pos = 0) {
|
||
const m0 = transform[0];
|
||
const m1 = transform[1];
|
||
const m2 = transform[2];
|
||
const m3 = transform[3];
|
||
const m4 = transform[4];
|
||
const m5 = transform[5];
|
||
for (let i = 0; i < 6; i += 2) {
|
||
const pI = p[pos + i];
|
||
const pI1 = p[pos + i + 1];
|
||
p[pos + i] = pI * m0 + pI1 * m2 + m4;
|
||
p[pos + i + 1] = pI * m1 + pI1 * m3 + m5;
|
||
}
|
||
}
|
||
static applyInverseTransform(p, m) {
|
||
const p0 = p[0];
|
||
const p1 = p[1];
|
||
const d = m[0] * m[3] - m[1] * m[2];
|
||
p[0] = (p0 * m[3] - p1 * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
|
||
p[1] = (-p0 * m[1] + p1 * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
|
||
}
|
||
static axialAlignedBoundingBox(rect, transform, output) {
|
||
const m0 = transform[0];
|
||
const m1 = transform[1];
|
||
const m2 = transform[2];
|
||
const m3 = transform[3];
|
||
const m4 = transform[4];
|
||
const m5 = transform[5];
|
||
const r0 = rect[0];
|
||
const r1 = rect[1];
|
||
const r2 = rect[2];
|
||
const r3 = rect[3];
|
||
let a0 = m0 * r0 + m4;
|
||
let a2 = a0;
|
||
let a1 = m0 * r2 + m4;
|
||
let a3 = a1;
|
||
let b0 = m3 * r1 + m5;
|
||
let b2 = b0;
|
||
let b1 = m3 * r3 + m5;
|
||
let b3 = b1;
|
||
if (m1 !== 0 || m2 !== 0) {
|
||
const m1r0 = m1 * r0;
|
||
const m1r2 = m1 * r2;
|
||
const m2r1 = m2 * r1;
|
||
const m2r3 = m2 * r3;
|
||
a0 += m2r1;
|
||
a3 += m2r1;
|
||
a1 += m2r3;
|
||
a2 += m2r3;
|
||
b0 += m1r0;
|
||
b3 += m1r0;
|
||
b1 += m1r2;
|
||
b2 += m1r2;
|
||
}
|
||
output[0] = Math.min(output[0], a0, a1, Math.min(a2, a3));
|
||
output[1] = Math.min(output[1], b0, b1, Math.min(b2, b3));
|
||
output[2] = Math.max(output[2], a0, a1, Math.max(a2, a3));
|
||
output[3] = Math.max(output[3], b0, b1, Math.max(b2, b3));
|
||
}
|
||
static inverseTransform(m) {
|
||
const d = m[0] * m[3] - m[1] * m[2];
|
||
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];
|
||
}
|
||
static singularValueDecompose2dScale(matrix, output) {
|
||
const m0 = matrix[0];
|
||
const m1 = matrix[1];
|
||
const m2 = matrix[2];
|
||
const m3 = matrix[3];
|
||
const a = m0 ** 2 + m1 ** 2;
|
||
const b = m0 * m2 + m1 * m3;
|
||
const c = m2 ** 2 + m3 ** 2;
|
||
const first = (a + c) / 2;
|
||
const second = Math.sqrt(first ** 2 - (a * c - b ** 2));
|
||
output[0] = Math.sqrt(first + second || 1);
|
||
output[1] = Math.sqrt(first - second || 1);
|
||
}
|
||
static normalizeRect(rect) {
|
||
const r = rect.slice(0);
|
||
if (rect[0] > rect[2]) {
|
||
r[0] = rect[2];
|
||
r[2] = rect[0];
|
||
}
|
||
if (rect[1] > rect[3]) {
|
||
r[1] = rect[3];
|
||
r[3] = rect[1];
|
||
}
|
||
return r;
|
||
}
|
||
static intersect(rect1, rect2) {
|
||
const xLow = Math.max(Math.min(rect1[0], rect1[2]), Math.min(rect2[0], rect2[2]));
|
||
const xHigh = Math.min(Math.max(rect1[0], rect1[2]), Math.max(rect2[0], rect2[2]));
|
||
if (xLow > xHigh) {
|
||
return null;
|
||
}
|
||
const yLow = Math.max(Math.min(rect1[1], rect1[3]), Math.min(rect2[1], rect2[3]));
|
||
const yHigh = Math.min(Math.max(rect1[1], rect1[3]), Math.max(rect2[1], rect2[3]));
|
||
return yLow > yHigh ? null : [xLow, yLow, xHigh, yHigh];
|
||
}
|
||
static pointBoundingBox(x, y, minMax) {
|
||
minMax[0] = Math.min(minMax[0], x);
|
||
minMax[1] = Math.min(minMax[1], y);
|
||
minMax[2] = Math.max(minMax[2], x);
|
||
minMax[3] = Math.max(minMax[3], y);
|
||
}
|
||
static rectBoundingBox(x0, y0, x1, y1, minMax) {
|
||
minMax[0] = Math.min(minMax[0], x0, x1);
|
||
minMax[1] = Math.min(minMax[1], y0, y1);
|
||
minMax[2] = Math.max(minMax[2], x0, x1);
|
||
minMax[3] = Math.max(minMax[3], y0, y1);
|
||
}
|
||
static #getExtremumOnCurve(x0, x1, x2, x3, y0, y1, y2, y3, t, minMax) {
|
||
if (t <= 0 || t >= 1) {
|
||
return;
|
||
}
|
||
const mt = 1 - t;
|
||
const tt = t * t;
|
||
const ttt = tt * t;
|
||
const x = mt * (mt * (mt * x0 + 3 * t * x1) + 3 * tt * x2) + ttt * x3;
|
||
const y = mt * (mt * (mt * y0 + 3 * t * y1) + 3 * tt * y2) + ttt * y3;
|
||
minMax[0] = Math.min(minMax[0], x);
|
||
minMax[1] = Math.min(minMax[1], y);
|
||
minMax[2] = Math.max(minMax[2], x);
|
||
minMax[3] = Math.max(minMax[3], y);
|
||
}
|
||
static #getExtremum(x0, x1, x2, x3, y0, y1, y2, y3, a, b, c, minMax) {
|
||
if (Math.abs(a) < 1e-12) {
|
||
if (Math.abs(b) >= 1e-12) {
|
||
this.#getExtremumOnCurve(x0, x1, x2, x3, y0, y1, y2, y3, -c / b, minMax);
|
||
}
|
||
return;
|
||
}
|
||
const delta = b ** 2 - 4 * c * a;
|
||
if (delta < 0) {
|
||
return;
|
||
}
|
||
const sqrtDelta = Math.sqrt(delta);
|
||
const a2 = 2 * a;
|
||
this.#getExtremumOnCurve(x0, x1, x2, x3, y0, y1, y2, y3, (-b + sqrtDelta) / a2, minMax);
|
||
this.#getExtremumOnCurve(x0, x1, x2, x3, y0, y1, y2, y3, (-b - sqrtDelta) / a2, minMax);
|
||
}
|
||
static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3, minMax) {
|
||
minMax[0] = Math.min(minMax[0], x0, x3);
|
||
minMax[1] = Math.min(minMax[1], y0, y3);
|
||
minMax[2] = Math.max(minMax[2], x0, x3);
|
||
minMax[3] = Math.max(minMax[3], y0, y3);
|
||
this.#getExtremum(x0, x1, x2, x3, y0, y1, y2, y3, 3 * (-x0 + 3 * (x1 - x2) + x3), 6 * (x0 - 2 * x1 + x2), 3 * (x1 - x0), minMax);
|
||
this.#getExtremum(x0, x1, x2, x3, y0, y1, y2, y3, 3 * (-y0 + 3 * (y1 - y2) + y3), 6 * (y0 - 2 * y1 + y2), 3 * (y1 - y0), minMax);
|
||
}
|
||
}
|
||
function stringToUTF8String(str) {
|
||
return decodeURIComponent(escape(str));
|
||
}
|
||
function utf8StringToString(str) {
|
||
return unescape(encodeURIComponent(str));
|
||
}
|
||
function isArrayEqual(arr1, arr2) {
|
||
if (arr1.length !== arr2.length) {
|
||
return false;
|
||
}
|
||
for (let i = 0, ii = arr1.length; i < ii; i++) {
|
||
if (arr1[i] !== arr2[i]) {
|
||
return false;
|
||
}
|
||
}
|
||
return true;
|
||
}
|
||
let NormalizeRegex = null;
|
||
let NormalizationMap = null;
|
||
function normalizeUnicode(str) {
|
||
if (!NormalizeRegex) {
|
||
NormalizeRegex = /([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu;
|
||
NormalizationMap = new Map([["ſt", "ſt"]]);
|
||
}
|
||
return str.replaceAll(NormalizeRegex, (_, p1, p2) => p1 ? p1.normalize("NFKC") : NormalizationMap.get(p2));
|
||
}
|
||
function getUuid() {
|
||
if (typeof crypto.randomUUID === "function") {
|
||
return crypto.randomUUID();
|
||
}
|
||
const buf = new Uint8Array(32);
|
||
crypto.getRandomValues(buf);
|
||
return bytesToString(buf);
|
||
}
|
||
function _isValidExplicitDest(validRef, validName, dest) {
|
||
if (!Array.isArray(dest) || dest.length < 2) {
|
||
return false;
|
||
}
|
||
const [page, zoom, ...args] = dest;
|
||
if (!validRef(page) && !Number.isInteger(page)) {
|
||
return false;
|
||
}
|
||
if (!validName(zoom)) {
|
||
return false;
|
||
}
|
||
const argsLen = args.length;
|
||
let allowNull = true;
|
||
switch (zoom.name) {
|
||
case "XYZ":
|
||
if (argsLen < 2 || argsLen > 3) {
|
||
return false;
|
||
}
|
||
break;
|
||
case "Fit":
|
||
case "FitB":
|
||
return argsLen === 0;
|
||
case "FitH":
|
||
case "FitBH":
|
||
case "FitV":
|
||
case "FitBV":
|
||
if (argsLen > 1) {
|
||
return false;
|
||
}
|
||
break;
|
||
case "FitR":
|
||
if (argsLen !== 4) {
|
||
return false;
|
||
}
|
||
allowNull = false;
|
||
break;
|
||
default:
|
||
return false;
|
||
}
|
||
for (const arg of args) {
|
||
if (typeof arg === "number" || allowNull && arg === null) {
|
||
continue;
|
||
}
|
||
return false;
|
||
}
|
||
return true;
|
||
}
|
||
const makeArr = () => [];
|
||
const makeMap = () => new Map();
|
||
const makeObj = () => Object.create(null);
|
||
const makeSet = () => new Set();
|
||
if (typeof Blob.prototype.bytes !== "function") {
|
||
Blob.prototype.bytes = async function () {
|
||
return new Uint8Array(await this.arrayBuffer());
|
||
};
|
||
}
|
||
if (typeof Response.prototype.bytes !== "function") {
|
||
Response.prototype.bytes = async function () {
|
||
return new Uint8Array(await this.arrayBuffer());
|
||
};
|
||
}
|
||
if (typeof Iterator.prototype.join !== "function") {
|
||
Iterator.prototype.join = function (separator) {
|
||
return [...this].join(separator);
|
||
};
|
||
}
|
||
|
||
;// ./src/display/display_utils.js
|
||
/* unused harmony import specifier */ var display_utils_warn;
|
||
/* unused harmony import specifier */ var display_utils_Util;
|
||
/* unused harmony import specifier */ var MathClamp;
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
class PixelsPerInch {
|
||
static CSS = 96.0;
|
||
static PDF = 72.0;
|
||
static PDF_TO_CSS_UNITS = this.CSS / this.PDF;
|
||
}
|
||
class RenderingCancelledException extends BaseException {
|
||
constructor(msg, extraDelay = 0) {
|
||
super(msg, "RenderingCancelledException");
|
||
this.extraDelay = extraDelay;
|
||
}
|
||
}
|
||
function getRGBA(color) {
|
||
if (color.startsWith("#")) {
|
||
const hex = color.slice(1);
|
||
return [parseInt(hex.slice(0, 2), 16), parseInt(hex.slice(2, 4), 16), parseInt(hex.slice(4, 6), 16), hex.length >= 8 ? parseInt(hex.slice(6, 8), 16) / 255 : 1];
|
||
}
|
||
if (color.startsWith("rgb(")) {
|
||
const [r, g, b] = color.slice(4, -1).split(",").map(x => parseInt(x, 10));
|
||
return [r, g, b, 1];
|
||
}
|
||
if (color.startsWith("rgba(")) {
|
||
const parts = color.slice(5, -1).split(",");
|
||
return [parseInt(parts[0], 10), parseInt(parts[1], 10), parseInt(parts[2], 10), parseFloat(parts[3])];
|
||
}
|
||
const m = color.match(/^color\(srgb\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)(?:\s*\/\s*([\d.]+|none))?\)$/);
|
||
if (m) {
|
||
return [Math.round(parseFloat(m[1]) * 255), Math.round(parseFloat(m[2]) * 255), Math.round(parseFloat(m[3]) * 255), m[4] !== undefined && m[4] !== "none" ? parseFloat(m[4]) : 1];
|
||
}
|
||
return null;
|
||
}
|
||
function getRGB(color) {
|
||
const rgba = getRGBA(color);
|
||
if (!rgba) {
|
||
display_utils_warn(`Not a valid color format: "${color}"`);
|
||
return [0, 0, 0];
|
||
}
|
||
return rgba.slice(0, 3);
|
||
}
|
||
function getCurrentTransform(ctx) {
|
||
const {
|
||
a,
|
||
b,
|
||
c,
|
||
d,
|
||
e,
|
||
f
|
||
} = ctx.getTransform();
|
||
return [a, b, c, d, e, f];
|
||
}
|
||
function getCurrentTransformInverse(ctx) {
|
||
const {
|
||
a,
|
||
b,
|
||
c,
|
||
d,
|
||
e,
|
||
f
|
||
} = ctx.getTransform().invertSelf();
|
||
return [a, b, c, d, e, f];
|
||
}
|
||
class OutputScale {
|
||
constructor() {
|
||
const {
|
||
pixelRatio
|
||
} = OutputScale;
|
||
this.sx = pixelRatio;
|
||
this.sy = pixelRatio;
|
||
}
|
||
get scaled() {
|
||
return this.sx !== 1 || this.sy !== 1;
|
||
}
|
||
get symmetric() {
|
||
return this.sx === this.sy;
|
||
}
|
||
limitCanvas(width, height, maxPixels, maxDim, capAreaFactor = -1) {
|
||
return false;
|
||
}
|
||
static get pixelRatio() {
|
||
return globalThis.devicePixelRatio || 1;
|
||
}
|
||
static capPixels(maxPixels, capAreaFactor) {
|
||
return maxPixels;
|
||
}
|
||
}
|
||
function applyOpacity(color, opacity) {
|
||
opacity = MathClamp(opacity ?? 1, 0, 1);
|
||
const white = 255 * (1 - opacity);
|
||
return color.map(c => Math.round(c * opacity + white));
|
||
}
|
||
function RGBToHSL(rgb, output) {
|
||
const r = rgb[0] / 255;
|
||
const g = rgb[1] / 255;
|
||
const b = rgb[2] / 255;
|
||
const max = Math.max(r, g, b);
|
||
const min = Math.min(r, g, b);
|
||
const l = (max + min) / 2;
|
||
if (max === min) {
|
||
output[0] = output[1] = 0;
|
||
} else {
|
||
const d = max - min;
|
||
output[1] = l < 0.5 ? d / (max + min) : d / (2 - max - min);
|
||
switch (max) {
|
||
case r:
|
||
output[0] = ((g - b) / d + (g < b ? 6 : 0)) * 60;
|
||
break;
|
||
case g:
|
||
output[0] = ((b - r) / d + 2) * 60;
|
||
break;
|
||
case b:
|
||
output[0] = ((r - g) / d + 4) * 60;
|
||
break;
|
||
}
|
||
}
|
||
output[2] = l;
|
||
}
|
||
function HSLToRGB(hsl, output) {
|
||
const h = hsl[0];
|
||
const s = hsl[1];
|
||
const l = hsl[2];
|
||
const c = (1 - Math.abs(2 * l - 1)) * s;
|
||
const x = c * (1 - Math.abs(h / 60 % 2 - 1));
|
||
const m = l - c / 2;
|
||
switch (Math.floor(h / 60)) {
|
||
case 0:
|
||
output[0] = c + m;
|
||
output[1] = x + m;
|
||
output[2] = m;
|
||
break;
|
||
case 1:
|
||
output[0] = x + m;
|
||
output[1] = c + m;
|
||
output[2] = m;
|
||
break;
|
||
case 2:
|
||
output[0] = m;
|
||
output[1] = c + m;
|
||
output[2] = x + m;
|
||
break;
|
||
case 3:
|
||
output[0] = m;
|
||
output[1] = x + m;
|
||
output[2] = c + m;
|
||
break;
|
||
case 4:
|
||
output[0] = x + m;
|
||
output[1] = m;
|
||
output[2] = c + m;
|
||
break;
|
||
case 5:
|
||
case 6:
|
||
output[0] = c + m;
|
||
output[1] = m;
|
||
output[2] = x + m;
|
||
break;
|
||
}
|
||
}
|
||
function computeLuminance(x) {
|
||
return x <= 0.03928 ? x / 12.92 : ((x + 0.055) / 1.055) ** 2.4;
|
||
}
|
||
function contrastRatio(hsl1, hsl2, output) {
|
||
HSLToRGB(hsl1, output);
|
||
output.map(computeLuminance);
|
||
const lum1 = 0.2126 * output[0] + 0.7152 * output[1] + 0.0722 * output[2];
|
||
HSLToRGB(hsl2, output);
|
||
output.map(computeLuminance);
|
||
const lum2 = 0.2126 * output[0] + 0.7152 * output[1] + 0.0722 * output[2];
|
||
return lum1 > lum2 ? (lum1 + 0.05) / (lum2 + 0.05) : (lum2 + 0.05) / (lum1 + 0.05);
|
||
}
|
||
const contrastCache = new Map();
|
||
function findContrastColor(baseColor, fixedColor) {
|
||
const key = baseColor[0] + baseColor[1] * 0x100 + baseColor[2] * 0x10000 + fixedColor[0] * 0x1000000 + fixedColor[1] * 0x100000000 + fixedColor[2] * 0x10000000000;
|
||
let cachedValue = contrastCache.get(key);
|
||
if (cachedValue) {
|
||
return cachedValue;
|
||
}
|
||
const array = new Float32Array(9);
|
||
const output = array.subarray(0, 3);
|
||
const baseHSL = array.subarray(3, 6);
|
||
RGBToHSL(baseColor, baseHSL);
|
||
const fixedHSL = array.subarray(6, 9);
|
||
RGBToHSL(fixedColor, fixedHSL);
|
||
const isFixedColorDark = fixedHSL[2] < 0.5;
|
||
const minContrast = isFixedColorDark ? 12 : 4.5;
|
||
baseHSL[2] = isFixedColorDark ? Math.sqrt(baseHSL[2]) : 1 - Math.sqrt(1 - baseHSL[2]);
|
||
if (contrastRatio(baseHSL, fixedHSL, output) < minContrast) {
|
||
let start, end;
|
||
if (isFixedColorDark) {
|
||
start = baseHSL[2];
|
||
end = 1;
|
||
} else {
|
||
start = 0;
|
||
end = baseHSL[2];
|
||
}
|
||
const PRECISION = 0.005;
|
||
while (end - start > PRECISION) {
|
||
const mid = baseHSL[2] = (start + end) / 2;
|
||
if (isFixedColorDark === contrastRatio(baseHSL, fixedHSL, output) < minContrast) {
|
||
start = mid;
|
||
} else {
|
||
end = mid;
|
||
}
|
||
}
|
||
baseHSL[2] = isFixedColorDark ? end : start;
|
||
}
|
||
HSLToRGB(baseHSL, output);
|
||
cachedValue = display_utils_Util.makeHexColor(Math.round(output[0] * 255), Math.round(output[1] * 255), Math.round(output[2] * 255));
|
||
contrastCache.set(key, cachedValue);
|
||
return cachedValue;
|
||
}
|
||
function makePathFromDrawOPS(data) {
|
||
const path = new Path2D();
|
||
if (!data) {
|
||
return path;
|
||
}
|
||
for (let i = 0, ii = data.length; i < ii;) {
|
||
switch (data[i++]) {
|
||
case DrawOPS.moveTo:
|
||
path.moveTo(data[i++], data[i++]);
|
||
break;
|
||
case DrawOPS.lineTo:
|
||
path.lineTo(data[i++], data[i++]);
|
||
break;
|
||
case DrawOPS.curveTo:
|
||
path.bezierCurveTo(data[i++], data[i++], data[i++], data[i++], data[i++], data[i++]);
|
||
break;
|
||
case DrawOPS.quadraticCurveTo:
|
||
path.quadraticCurveTo(data[i++], data[i++], data[i++], data[i++]);
|
||
break;
|
||
case DrawOPS.closePath:
|
||
path.closePath();
|
||
break;
|
||
default:
|
||
warn(`Unrecognized drawing path operator: ${data[i - 1]}`);
|
||
break;
|
||
}
|
||
}
|
||
return path;
|
||
}
|
||
|
||
;// ./src/shared/math_clamp.js
|
||
function math_clamp_MathClamp(v, min, max) {
|
||
return Math.min(Math.max(v, min), max);
|
||
}
|
||
|
||
;// ./src/display/canvas_dependency_tracker.js
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
const FORCED_DEPENDENCY_LABEL = "__forcedDependency";
|
||
const {
|
||
floor: canvas_dependency_tracker_floor,
|
||
ceil
|
||
} = Math;
|
||
function expandBBox(array, index, minX, minY, maxX, maxY) {
|
||
array[index * 4 + 0] = Math.min(array[index * 4 + 0], minX);
|
||
array[index * 4 + 1] = Math.min(array[index * 4 + 1], minY);
|
||
array[index * 4 + 2] = Math.max(array[index * 4 + 2], maxX);
|
||
array[index * 4 + 3] = Math.max(array[index * 4 + 3], maxY);
|
||
}
|
||
function scaleCharBBox(scaleX, scaleY, x, y, bbox) {
|
||
let temp;
|
||
if (scaleX) {
|
||
if (scaleX < 0) {
|
||
temp = bbox[0];
|
||
bbox[0] = bbox[2];
|
||
bbox[2] = temp;
|
||
}
|
||
bbox[0] *= scaleX;
|
||
bbox[2] *= scaleX;
|
||
if (scaleY < 0) {
|
||
temp = bbox[1];
|
||
bbox[1] = bbox[3];
|
||
bbox[3] = temp;
|
||
}
|
||
bbox[1] *= scaleY;
|
||
bbox[3] *= scaleY;
|
||
} else {
|
||
bbox.fill(0);
|
||
}
|
||
bbox[0] += x;
|
||
bbox[1] += y;
|
||
bbox[2] += x;
|
||
bbox[3] += y;
|
||
}
|
||
const EMPTY_BBOX = new Uint32Array(new Uint8Array([255, 255, 0, 0]).buffer)[0];
|
||
class BBoxReader {
|
||
#bboxes;
|
||
#coords;
|
||
constructor(bboxes, coords) {
|
||
this.#bboxes = bboxes;
|
||
this.#coords = coords;
|
||
}
|
||
static fromBuffer(buffer) {
|
||
return new BBoxReader(new Uint32Array(buffer), new Uint8ClampedArray(buffer));
|
||
}
|
||
get buffer() {
|
||
return this.#bboxes.buffer;
|
||
}
|
||
get length() {
|
||
return this.#bboxes.length;
|
||
}
|
||
isEmpty(i) {
|
||
return this.#bboxes[i] === EMPTY_BBOX;
|
||
}
|
||
minX(i) {
|
||
return this.#coords[i * 4 + 0] / 256;
|
||
}
|
||
minY(i) {
|
||
return this.#coords[i * 4 + 1] / 256;
|
||
}
|
||
maxX(i) {
|
||
return (this.#coords[i * 4 + 2] + 1) / 256;
|
||
}
|
||
maxY(i) {
|
||
return (this.#coords[i * 4 + 3] + 1) / 256;
|
||
}
|
||
}
|
||
const ensureDebugMetadata = (map, key) => map?.getOrInsertComputed(key, () => ({
|
||
dependencies: new Set(),
|
||
isRenderingOperation: false
|
||
}));
|
||
class CanvasBBoxTracker {
|
||
#baseTransformStack = [[1, 0, 0, 1, 0, 0]];
|
||
#clipBox = [-Infinity, -Infinity, Infinity, Infinity];
|
||
#pendingBBox = new Float64Array(BBOX_INIT);
|
||
_pendingBBoxIdx = -1;
|
||
#canvasWidth;
|
||
#canvasHeight;
|
||
#bboxesCoords;
|
||
#bboxes;
|
||
_savesStack = [];
|
||
_markedContentStack = [];
|
||
constructor(canvas, operationsCount) {
|
||
this.#canvasWidth = canvas.width;
|
||
this.#canvasHeight = canvas.height;
|
||
this.#initializeBBoxes(operationsCount);
|
||
}
|
||
growOperationsCount(operationsCount) {
|
||
if (operationsCount >= this.#bboxes.length) {
|
||
this.#initializeBBoxes(operationsCount, this.#bboxes);
|
||
}
|
||
}
|
||
#initializeBBoxes(operationsCount, oldBBoxes) {
|
||
const buffer = new ArrayBuffer(operationsCount * 4);
|
||
this.#bboxesCoords = new Uint8ClampedArray(buffer);
|
||
this.#bboxes = new Uint32Array(buffer);
|
||
if (oldBBoxes && oldBBoxes.length > 0) {
|
||
this.#bboxes.set(oldBBoxes);
|
||
this.#bboxes.fill(EMPTY_BBOX, oldBBoxes.length);
|
||
} else {
|
||
this.#bboxes.fill(EMPTY_BBOX);
|
||
}
|
||
}
|
||
get clipBox() {
|
||
return this.#clipBox;
|
||
}
|
||
save(opIdx) {
|
||
this.#clipBox = {
|
||
__proto__: this.#clipBox
|
||
};
|
||
this._savesStack.push(opIdx);
|
||
return this;
|
||
}
|
||
restore(opIdx, onSavePopped) {
|
||
const previous = Object.getPrototypeOf(this.#clipBox);
|
||
if (previous === null) {
|
||
return this;
|
||
}
|
||
this.#clipBox = previous;
|
||
const lastSave = this._savesStack.pop();
|
||
if (lastSave !== undefined) {
|
||
onSavePopped?.(lastSave, opIdx);
|
||
this.#bboxes[opIdx] = this.#bboxes[lastSave];
|
||
}
|
||
return this;
|
||
}
|
||
recordOpenMarker(idx) {
|
||
this._savesStack.push(idx);
|
||
return this;
|
||
}
|
||
getOpenMarker() {
|
||
return this._savesStack.length === 0 ? null : this._savesStack.at(-1);
|
||
}
|
||
recordCloseMarker(opIdx, onSavePopped) {
|
||
const lastSave = this._savesStack.pop();
|
||
if (lastSave !== undefined) {
|
||
onSavePopped?.(lastSave, opIdx);
|
||
this.#bboxes[opIdx] = this.#bboxes[lastSave];
|
||
}
|
||
return this;
|
||
}
|
||
beginMarkedContent(opIdx) {
|
||
this._markedContentStack.push(opIdx);
|
||
return this;
|
||
}
|
||
endMarkedContent(opIdx, onSavePopped) {
|
||
const lastSave = this._markedContentStack.pop();
|
||
if (lastSave !== undefined) {
|
||
onSavePopped?.(lastSave, opIdx);
|
||
this.#bboxes[opIdx] = this.#bboxes[lastSave];
|
||
}
|
||
return this;
|
||
}
|
||
pushBaseTransform(ctx) {
|
||
this.#baseTransformStack.push(Util.multiplyByDOMMatrix(this.#baseTransformStack.at(-1), ctx.getTransform()));
|
||
return this;
|
||
}
|
||
popBaseTransform() {
|
||
if (this.#baseTransformStack.length > 1) {
|
||
this.#baseTransformStack.pop();
|
||
}
|
||
return this;
|
||
}
|
||
resetBBox(idx) {
|
||
if (this._pendingBBoxIdx !== idx) {
|
||
this._pendingBBoxIdx = idx;
|
||
this.#pendingBBox.set(BBOX_INIT, 0);
|
||
}
|
||
return this;
|
||
}
|
||
recordClipBox(idx, ctx, minX, maxX, minY, maxY) {
|
||
const transform = Util.multiplyByDOMMatrix(this.#baseTransformStack.at(-1), ctx.getTransform());
|
||
const clipBox = BBOX_INIT.slice();
|
||
Util.axialAlignedBoundingBox([minX, minY, maxX, maxY], transform, clipBox);
|
||
const intersection = Util.intersect(this.#clipBox, clipBox);
|
||
if (intersection) {
|
||
this.#clipBox[0] = intersection[0];
|
||
this.#clipBox[1] = intersection[1];
|
||
this.#clipBox[2] = intersection[2];
|
||
this.#clipBox[3] = intersection[3];
|
||
} else {
|
||
this.#clipBox[0] = this.#clipBox[1] = Infinity;
|
||
this.#clipBox[2] = this.#clipBox[3] = -Infinity;
|
||
}
|
||
return this;
|
||
}
|
||
recordBBox(idx, ctx, minX, maxX, minY, maxY) {
|
||
const clipBox = this.#clipBox;
|
||
if (clipBox[0] === Infinity) {
|
||
return this;
|
||
}
|
||
const transform = Util.multiplyByDOMMatrix(this.#baseTransformStack.at(-1), ctx.getTransform());
|
||
if (clipBox[0] === -Infinity) {
|
||
Util.axialAlignedBoundingBox([minX, minY, maxX, maxY], transform, this.#pendingBBox);
|
||
return this;
|
||
}
|
||
const bbox = BBOX_INIT.slice();
|
||
Util.axialAlignedBoundingBox([minX, minY, maxX, maxY], transform, bbox);
|
||
this.#pendingBBox[0] = math_clamp_MathClamp(bbox[0], clipBox[0], this.#pendingBBox[0]);
|
||
this.#pendingBBox[1] = math_clamp_MathClamp(bbox[1], clipBox[1], this.#pendingBBox[1]);
|
||
this.#pendingBBox[2] = math_clamp_MathClamp(bbox[2], this.#pendingBBox[2], clipBox[2]);
|
||
this.#pendingBBox[3] = math_clamp_MathClamp(bbox[3], this.#pendingBBox[3], clipBox[3]);
|
||
return this;
|
||
}
|
||
recordFullPageBBox(idx) {
|
||
this.#pendingBBox[0] = Math.max(0, this.#clipBox[0]);
|
||
this.#pendingBBox[1] = Math.max(0, this.#clipBox[1]);
|
||
this.#pendingBBox[2] = Math.min(this.#canvasWidth, this.#clipBox[2]);
|
||
this.#pendingBBox[3] = Math.min(this.#canvasHeight, this.#clipBox[3]);
|
||
return this;
|
||
}
|
||
recordOperation(idx, preserve = false, dependencyLists) {
|
||
if (this._pendingBBoxIdx !== idx) {
|
||
return this;
|
||
}
|
||
const minX = canvas_dependency_tracker_floor(this.#pendingBBox[0] * 256 / this.#canvasWidth);
|
||
const minY = canvas_dependency_tracker_floor(this.#pendingBBox[1] * 256 / this.#canvasHeight);
|
||
const maxX = ceil(this.#pendingBBox[2] * 256 / this.#canvasWidth);
|
||
const maxY = ceil(this.#pendingBBox[3] * 256 / this.#canvasHeight);
|
||
expandBBox(this.#bboxesCoords, idx, minX, minY, maxX, maxY);
|
||
if (dependencyLists) {
|
||
for (const dependencies of dependencyLists) {
|
||
for (const depIdx of dependencies) {
|
||
if (depIdx !== idx) {
|
||
expandBBox(this.#bboxesCoords, depIdx, minX, minY, maxX, maxY);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (!preserve) {
|
||
this._pendingBBoxIdx = -1;
|
||
}
|
||
return this;
|
||
}
|
||
bboxToClipBoxDropOperation(idx) {
|
||
if (this._pendingBBoxIdx === idx) {
|
||
this._pendingBBoxIdx = -1;
|
||
this.#clipBox[0] = Math.max(this.#clipBox[0], this.#pendingBBox[0]);
|
||
this.#clipBox[1] = Math.max(this.#clipBox[1], this.#pendingBBox[1]);
|
||
this.#clipBox[2] = Math.min(this.#clipBox[2], this.#pendingBBox[2]);
|
||
this.#clipBox[3] = Math.min(this.#clipBox[3], this.#pendingBBox[3]);
|
||
}
|
||
return this;
|
||
}
|
||
take() {
|
||
return new BBoxReader(this.#bboxes, this.#bboxesCoords);
|
||
}
|
||
takeDebugMetadata() {
|
||
throw new Error("Unreachable");
|
||
}
|
||
recordSimpleData(name, idx) {
|
||
return this;
|
||
}
|
||
recordIncrementalData(name, idx) {
|
||
return this;
|
||
}
|
||
resetIncrementalData(name, idx) {
|
||
return this;
|
||
}
|
||
recordNamedData(name, idx) {
|
||
return this;
|
||
}
|
||
recordSimpleDataFromNamed(name, depName, fallbackIdx) {
|
||
return this;
|
||
}
|
||
recordFutureForcedDependency(name, idx) {
|
||
return this;
|
||
}
|
||
inheritSimpleDataAsFutureForcedDependencies(names) {
|
||
return this;
|
||
}
|
||
inheritPendingDependenciesAsFutureForcedDependencies() {
|
||
return this;
|
||
}
|
||
recordCharacterBBox(idx, ctx, font, scale = 1, x = 0, y = 0, getMeasure) {
|
||
return this;
|
||
}
|
||
getSimpleIndex(dependencyName) {
|
||
return undefined;
|
||
}
|
||
recordDependencies(idx, dependencyNames) {
|
||
return this;
|
||
}
|
||
recordNamedDependency(idx, name) {
|
||
return this;
|
||
}
|
||
recordShowTextOperation(idx, preserve = false) {
|
||
return this;
|
||
}
|
||
}
|
||
class CanvasDependencyTracker {
|
||
#simple = {
|
||
__proto__: null
|
||
};
|
||
#incremental = {
|
||
__proto__: null,
|
||
transform: [],
|
||
moveText: [],
|
||
sameLineText: [],
|
||
[FORCED_DEPENDENCY_LABEL]: []
|
||
};
|
||
#namedDependencies = new Map();
|
||
#pendingDependencies = new Set();
|
||
#fontBBoxTrustworthy = new Map();
|
||
#debugMetadata;
|
||
#recordDebugMetadataDepenencyAfterRestore;
|
||
#bboxTracker;
|
||
constructor(bboxTracker, recordDebugMetadata = false) {
|
||
this.#bboxTracker = bboxTracker;
|
||
if (recordDebugMetadata) {
|
||
this.#debugMetadata = new Map();
|
||
this.#recordDebugMetadataDepenencyAfterRestore = (lastSave, opIdx) => {
|
||
ensureDebugMetadata(this.#debugMetadata, opIdx).dependencies.add(lastSave);
|
||
};
|
||
}
|
||
}
|
||
get clipBox() {
|
||
return this.#bboxTracker.clipBox;
|
||
}
|
||
growOperationsCount(operationsCount) {
|
||
this.#bboxTracker.growOperationsCount(operationsCount);
|
||
}
|
||
save(opIdx) {
|
||
this.#simple = {
|
||
__proto__: this.#simple
|
||
};
|
||
this.#incremental = {
|
||
__proto__: this.#incremental,
|
||
transform: {
|
||
__proto__: this.#incremental.transform
|
||
},
|
||
moveText: {
|
||
__proto__: this.#incremental.moveText
|
||
},
|
||
sameLineText: {
|
||
__proto__: this.#incremental.sameLineText
|
||
},
|
||
[FORCED_DEPENDENCY_LABEL]: {
|
||
__proto__: this.#incremental[FORCED_DEPENDENCY_LABEL]
|
||
}
|
||
};
|
||
this.#bboxTracker.save(opIdx);
|
||
return this;
|
||
}
|
||
restore(opIdx) {
|
||
this.#bboxTracker.restore(opIdx, this.#recordDebugMetadataDepenencyAfterRestore);
|
||
const previous = Object.getPrototypeOf(this.#simple);
|
||
if (previous === null) {
|
||
return this;
|
||
}
|
||
this.#simple = previous;
|
||
this.#incremental = Object.getPrototypeOf(this.#incremental);
|
||
return this;
|
||
}
|
||
recordOpenMarker(opIdx) {
|
||
this.#bboxTracker.recordOpenMarker(opIdx, this.#recordDebugMetadataDepenencyAfterRestore);
|
||
return this;
|
||
}
|
||
getOpenMarker() {
|
||
return this.#bboxTracker.getOpenMarker();
|
||
}
|
||
recordCloseMarker(opIdx) {
|
||
this.#bboxTracker.recordCloseMarker(opIdx, this.#recordDebugMetadataDepenencyAfterRestore);
|
||
return this;
|
||
}
|
||
beginMarkedContent(opIdx) {
|
||
this.#bboxTracker.beginMarkedContent(opIdx);
|
||
return this;
|
||
}
|
||
endMarkedContent(opIdx) {
|
||
this.#bboxTracker.endMarkedContent(opIdx, this.#recordDebugMetadataDepenencyAfterRestore);
|
||
return this;
|
||
}
|
||
pushBaseTransform(ctx) {
|
||
this.#bboxTracker.pushBaseTransform(ctx);
|
||
return this;
|
||
}
|
||
popBaseTransform() {
|
||
this.#bboxTracker.popBaseTransform();
|
||
return this;
|
||
}
|
||
recordSimpleData(name, idx) {
|
||
this.#simple[name] = idx;
|
||
return this;
|
||
}
|
||
recordIncrementalData(name, idx) {
|
||
this.#incremental[name].push(idx);
|
||
return this;
|
||
}
|
||
resetIncrementalData(name, idx) {
|
||
this.#incremental[name].length = 0;
|
||
return this;
|
||
}
|
||
recordNamedData(name, idx) {
|
||
this.#namedDependencies.set(name, idx);
|
||
return this;
|
||
}
|
||
recordSimpleDataFromNamed(name, depName, fallbackIdx) {
|
||
this.#simple[name] = this.#namedDependencies.get(depName) ?? fallbackIdx;
|
||
}
|
||
recordFutureForcedDependency(name, idx) {
|
||
this.recordIncrementalData(FORCED_DEPENDENCY_LABEL, idx);
|
||
return this;
|
||
}
|
||
inheritSimpleDataAsFutureForcedDependencies(names) {
|
||
for (const name of names) {
|
||
if (name in this.#simple) {
|
||
this.recordFutureForcedDependency(name, this.#simple[name]);
|
||
}
|
||
}
|
||
return this;
|
||
}
|
||
inheritPendingDependenciesAsFutureForcedDependencies() {
|
||
for (const dep of this.#pendingDependencies) {
|
||
this.recordFutureForcedDependency(FORCED_DEPENDENCY_LABEL, dep);
|
||
}
|
||
return this;
|
||
}
|
||
resetBBox(idx) {
|
||
this.#bboxTracker.resetBBox(idx);
|
||
return this;
|
||
}
|
||
recordClipBox(idx, ctx, minX, maxX, minY, maxY) {
|
||
this.#bboxTracker.recordClipBox(idx, ctx, minX, maxX, minY, maxY);
|
||
return this;
|
||
}
|
||
recordBBox(idx, ctx, minX, maxX, minY, maxY) {
|
||
this.#bboxTracker.recordBBox(idx, ctx, minX, maxX, minY, maxY);
|
||
return this;
|
||
}
|
||
recordCharacterBBox(idx, ctx, font, scale = 1, x = 0, y = 0, getMeasure) {
|
||
const fontBBox = font.bbox;
|
||
let isBBoxTrustworthy;
|
||
let computedBBox;
|
||
if (fontBBox) {
|
||
isBBoxTrustworthy = fontBBox[2] !== fontBBox[0] && fontBBox[3] !== fontBBox[1] && this.#fontBBoxTrustworthy.get(font);
|
||
if (isBBoxTrustworthy !== false) {
|
||
computedBBox = [0, 0, 0, 0];
|
||
Util.axialAlignedBoundingBox(fontBBox, font.fontMatrix, computedBBox);
|
||
if (scale !== 1 || x !== 0 || y !== 0) {
|
||
scaleCharBBox(scale, -scale, x, y, computedBBox);
|
||
}
|
||
if (isBBoxTrustworthy) {
|
||
return this.recordBBox(idx, ctx, computedBBox[0], computedBBox[2], computedBBox[1], computedBBox[3]);
|
||
}
|
||
}
|
||
}
|
||
if (!getMeasure) {
|
||
return this.recordFullPageBBox(idx);
|
||
}
|
||
const measure = getMeasure();
|
||
if (fontBBox && computedBBox && isBBoxTrustworthy === undefined) {
|
||
isBBoxTrustworthy = computedBBox[0] <= x - measure.actualBoundingBoxLeft && computedBBox[2] >= x + measure.actualBoundingBoxRight && computedBBox[1] <= y - measure.actualBoundingBoxAscent && computedBBox[3] >= y + measure.actualBoundingBoxDescent;
|
||
this.#fontBBoxTrustworthy.set(font, isBBoxTrustworthy);
|
||
if (isBBoxTrustworthy) {
|
||
return this.recordBBox(idx, ctx, computedBBox[0], computedBBox[2], computedBBox[1], computedBBox[3]);
|
||
}
|
||
}
|
||
return this.recordBBox(idx, ctx, x - measure.actualBoundingBoxLeft, x + measure.actualBoundingBoxRight, y - measure.actualBoundingBoxAscent, y + measure.actualBoundingBoxDescent);
|
||
}
|
||
recordFullPageBBox(idx) {
|
||
this.#bboxTracker.recordFullPageBBox(idx);
|
||
return this;
|
||
}
|
||
getSimpleIndex(dependencyName) {
|
||
return this.#simple[dependencyName];
|
||
}
|
||
recordDependencies(idx, dependencyNames) {
|
||
const pendingDependencies = this.#pendingDependencies;
|
||
const simple = this.#simple;
|
||
const incremental = this.#incremental;
|
||
for (const name of dependencyNames) {
|
||
if (name in this.#simple) {
|
||
pendingDependencies.add(simple[name]);
|
||
} else if (name in incremental) {
|
||
incremental[name].forEach(pendingDependencies.add, pendingDependencies);
|
||
}
|
||
}
|
||
return this;
|
||
}
|
||
recordNamedDependency(idx, name) {
|
||
if (this.#namedDependencies.has(name)) {
|
||
this.#pendingDependencies.add(this.#namedDependencies.get(name));
|
||
}
|
||
return this;
|
||
}
|
||
recordOperation(idx, preserve = false) {
|
||
this.recordDependencies(idx, [FORCED_DEPENDENCY_LABEL]);
|
||
if (this.#debugMetadata) {
|
||
const metadata = ensureDebugMetadata(this.#debugMetadata, idx);
|
||
const {
|
||
dependencies
|
||
} = metadata;
|
||
this.#pendingDependencies.forEach(dependencies.add, dependencies);
|
||
this.#bboxTracker._savesStack.forEach(dependencies.add, dependencies);
|
||
this.#bboxTracker._markedContentStack.forEach(dependencies.add, dependencies);
|
||
dependencies.delete(idx);
|
||
metadata.isRenderingOperation = true;
|
||
}
|
||
const needsCleanup = !preserve && idx === this.#bboxTracker._pendingBBoxIdx;
|
||
this.#bboxTracker.recordOperation(idx, preserve, [this.#pendingDependencies, this.#bboxTracker._savesStack, this.#bboxTracker._markedContentStack]);
|
||
if (needsCleanup) {
|
||
this.#pendingDependencies.clear();
|
||
}
|
||
return this;
|
||
}
|
||
recordShowTextOperation(idx, preserve = false) {
|
||
const deps = Array.from(this.#pendingDependencies);
|
||
this.recordOperation(idx, preserve);
|
||
this.recordIncrementalData("sameLineText", idx);
|
||
for (const dep of deps) {
|
||
this.recordIncrementalData("sameLineText", dep);
|
||
}
|
||
return this;
|
||
}
|
||
bboxToClipBoxDropOperation(idx, preserve = false) {
|
||
const needsCleanup = !preserve && idx === this.#bboxTracker._pendingBBoxIdx;
|
||
this.#bboxTracker.bboxToClipBoxDropOperation(idx);
|
||
if (needsCleanup) {
|
||
this.#pendingDependencies.clear();
|
||
}
|
||
return this;
|
||
}
|
||
take() {
|
||
this.#fontBBoxTrustworthy.clear();
|
||
return this.#bboxTracker.take();
|
||
}
|
||
takeDebugMetadata() {
|
||
return this.#debugMetadata;
|
||
}
|
||
}
|
||
class CanvasNestedDependencyTracker {
|
||
#dependencyTracker;
|
||
#opIdx;
|
||
#ignoreBBoxes;
|
||
#nestingLevel = 0;
|
||
#savesLevel = 0;
|
||
constructor(dependencyTracker, opIdx, ignoreBBoxes) {
|
||
if (dependencyTracker instanceof CanvasNestedDependencyTracker && dependencyTracker.#ignoreBBoxes === !!ignoreBBoxes) {
|
||
return dependencyTracker;
|
||
}
|
||
this.#dependencyTracker = dependencyTracker;
|
||
this.#opIdx = opIdx;
|
||
this.#ignoreBBoxes = !!ignoreBBoxes;
|
||
}
|
||
get clipBox() {
|
||
return this.#dependencyTracker.clipBox;
|
||
}
|
||
growOperationsCount() {
|
||
throw new Error("Unreachable");
|
||
}
|
||
save(opIdx) {
|
||
this.#savesLevel++;
|
||
this.#dependencyTracker.save(this.#opIdx);
|
||
return this;
|
||
}
|
||
restore(opIdx) {
|
||
if (this.#savesLevel > 0) {
|
||
this.#dependencyTracker.restore(this.#opIdx);
|
||
this.#savesLevel--;
|
||
}
|
||
return this;
|
||
}
|
||
recordOpenMarker(idx) {
|
||
this.#nestingLevel++;
|
||
return this;
|
||
}
|
||
getOpenMarker() {
|
||
return this.#nestingLevel > 0 ? this.#opIdx : this.#dependencyTracker.getOpenMarker();
|
||
}
|
||
recordCloseMarker(idx) {
|
||
this.#nestingLevel--;
|
||
return this;
|
||
}
|
||
beginMarkedContent(opIdx) {
|
||
return this;
|
||
}
|
||
endMarkedContent(opIdx) {
|
||
return this;
|
||
}
|
||
pushBaseTransform(ctx) {
|
||
this.#dependencyTracker.pushBaseTransform(ctx);
|
||
return this;
|
||
}
|
||
popBaseTransform() {
|
||
this.#dependencyTracker.popBaseTransform();
|
||
return this;
|
||
}
|
||
recordSimpleData(name, idx) {
|
||
this.#dependencyTracker.recordSimpleData(name, this.#opIdx);
|
||
return this;
|
||
}
|
||
recordIncrementalData(name, idx) {
|
||
this.#dependencyTracker.recordIncrementalData(name, this.#opIdx);
|
||
return this;
|
||
}
|
||
resetIncrementalData(name, idx) {
|
||
this.#dependencyTracker.resetIncrementalData(name, this.#opIdx);
|
||
return this;
|
||
}
|
||
recordNamedData(name, idx) {
|
||
return this;
|
||
}
|
||
recordSimpleDataFromNamed(name, depName, fallbackIdx) {
|
||
this.#dependencyTracker.recordSimpleDataFromNamed(name, depName, this.#opIdx);
|
||
return this;
|
||
}
|
||
recordFutureForcedDependency(name, idx) {
|
||
this.#dependencyTracker.recordFutureForcedDependency(name, this.#opIdx);
|
||
return this;
|
||
}
|
||
inheritSimpleDataAsFutureForcedDependencies(names) {
|
||
this.#dependencyTracker.inheritSimpleDataAsFutureForcedDependencies(names);
|
||
return this;
|
||
}
|
||
inheritPendingDependenciesAsFutureForcedDependencies() {
|
||
this.#dependencyTracker.inheritPendingDependenciesAsFutureForcedDependencies();
|
||
return this;
|
||
}
|
||
resetBBox(idx) {
|
||
if (!this.#ignoreBBoxes) {
|
||
this.#dependencyTracker.resetBBox(this.#opIdx);
|
||
}
|
||
return this;
|
||
}
|
||
recordClipBox(idx, ctx, minX, maxX, minY, maxY) {
|
||
if (!this.#ignoreBBoxes) {
|
||
this.#dependencyTracker.recordClipBox(this.#opIdx, ctx, minX, maxX, minY, maxY);
|
||
}
|
||
return this;
|
||
}
|
||
recordBBox(idx, ctx, minX, maxX, minY, maxY) {
|
||
if (!this.#ignoreBBoxes) {
|
||
this.#dependencyTracker.recordBBox(this.#opIdx, ctx, minX, maxX, minY, maxY);
|
||
}
|
||
return this;
|
||
}
|
||
recordCharacterBBox(idx, ctx, font, scale, x, y, getMeasure) {
|
||
if (!this.#ignoreBBoxes) {
|
||
this.#dependencyTracker.recordCharacterBBox(this.#opIdx, ctx, font, scale, x, y, getMeasure);
|
||
}
|
||
return this;
|
||
}
|
||
recordFullPageBBox(idx) {
|
||
if (!this.#ignoreBBoxes) {
|
||
this.#dependencyTracker.recordFullPageBBox(this.#opIdx);
|
||
}
|
||
return this;
|
||
}
|
||
getSimpleIndex(dependencyName) {
|
||
return this.#dependencyTracker.getSimpleIndex(dependencyName);
|
||
}
|
||
recordDependencies(idx, dependencyNames) {
|
||
this.#dependencyTracker.recordDependencies(this.#opIdx, dependencyNames);
|
||
return this;
|
||
}
|
||
recordNamedDependency(idx, name) {
|
||
this.#dependencyTracker.recordNamedDependency(this.#opIdx, name);
|
||
return this;
|
||
}
|
||
recordOperation(idx) {
|
||
this.#dependencyTracker.recordOperation(this.#opIdx, true);
|
||
return this;
|
||
}
|
||
recordShowTextOperation(idx) {
|
||
this.#dependencyTracker.recordShowTextOperation(this.#opIdx, true);
|
||
return this;
|
||
}
|
||
bboxToClipBoxDropOperation(idx) {
|
||
if (!this.#ignoreBBoxes) {
|
||
this.#dependencyTracker.bboxToClipBoxDropOperation(this.#opIdx, true);
|
||
}
|
||
return this;
|
||
}
|
||
take() {
|
||
throw new Error("Unreachable");
|
||
}
|
||
takeDebugMetadata() {
|
||
throw new Error("Unreachable");
|
||
}
|
||
}
|
||
const Dependencies = {
|
||
stroke: ["path", "transform", "filter", "strokeColor", "strokeAlpha", "lineWidth", "lineCap", "lineJoin", "miterLimit", "dash"],
|
||
fill: ["path", "transform", "filter", "fillColor", "fillAlpha", "globalCompositeOperation", "SMask"],
|
||
imageXObject: ["transform", "SMask", "filter", "fillAlpha", "strokeAlpha", "globalCompositeOperation"],
|
||
rawFillPath: ["filter", "fillColor", "fillAlpha"],
|
||
showText: ["transform", "leading", "charSpacing", "wordSpacing", "hScale", "textRise", "moveText", "textMatrix", "font", "fontObj", "filter", "fillColor", "textRenderingMode", "SMask", "fillAlpha", "strokeAlpha", "globalCompositeOperation", "sameLineText"],
|
||
transform: ["transform"],
|
||
transformAndFill: ["transform", "filter", "fillColor"]
|
||
};
|
||
class CanvasImagesTracker {
|
||
#canvasWidth;
|
||
#canvasHeight;
|
||
#capacity = 4;
|
||
#count = 0;
|
||
#coords = new CanvasImagesTracker.#CoordsArray(this.#capacity * 6);
|
||
static #CoordsArray = FeatureTest.isFloat16ArraySupported ? Float16Array : Float32Array;
|
||
constructor(canvas) {
|
||
this.#canvasWidth = canvas.width;
|
||
this.#canvasHeight = canvas.height;
|
||
}
|
||
record(ctx, width, height, clipBox) {
|
||
if (this.#count === this.#capacity) {
|
||
this.#capacity *= 2;
|
||
const newCoords = new CanvasImagesTracker.#CoordsArray(this.#capacity * 6);
|
||
newCoords.set(this.#coords);
|
||
this.#coords = newCoords;
|
||
}
|
||
const transform = getCurrentTransform(ctx);
|
||
let coords;
|
||
if (clipBox[0] !== Infinity) {
|
||
const bbox = BBOX_INIT.slice();
|
||
Util.axialAlignedBoundingBox([0, -height, width, 0], transform, bbox);
|
||
const finalBBox = Util.intersect(clipBox, bbox);
|
||
if (!finalBBox) {
|
||
return;
|
||
}
|
||
const [minX, minY, maxX, maxY] = finalBBox;
|
||
if (minX !== bbox[0] || minY !== bbox[1] || maxX !== bbox[2] || maxY !== bbox[3]) {
|
||
const rotationAngle = Math.atan2(transform[1], transform[0]);
|
||
const sin = Math.abs(Math.sin(rotationAngle));
|
||
const cos = Math.abs(Math.cos(rotationAngle));
|
||
if (sin < 1e-6 || cos < 1e-6 || Math.abs(sin - cos) < 1e-6) {
|
||
coords = [minX, minY, minX, maxY, maxX, minY];
|
||
} else {
|
||
const finalBBoxWidth = maxX - minX;
|
||
const finalBBoxHeight = maxY - minY;
|
||
const sin2 = sin * sin;
|
||
const cos2 = cos * cos;
|
||
const cosSin = cos * sin;
|
||
const denom = cos2 - sin2;
|
||
const a = (finalBBoxHeight * cos2 - finalBBoxWidth * cosSin) / denom;
|
||
const b = (finalBBoxHeight * cosSin - finalBBoxWidth * sin2) / denom;
|
||
coords = [minX + b, minY, minX, minY + a, maxX, maxY - a];
|
||
}
|
||
}
|
||
}
|
||
if (!coords) {
|
||
coords = [0, -height, 0, 0, width, -height];
|
||
Util.applyTransform(coords, transform, 0);
|
||
Util.applyTransform(coords, transform, 2);
|
||
Util.applyTransform(coords, transform, 4);
|
||
}
|
||
coords[0] /= this.#canvasWidth;
|
||
coords[1] /= this.#canvasHeight;
|
||
coords[2] /= this.#canvasWidth;
|
||
coords[3] /= this.#canvasHeight;
|
||
coords[4] /= this.#canvasWidth;
|
||
coords[5] /= this.#canvasHeight;
|
||
this.#coords.set(coords, this.#count * 6);
|
||
this.#count++;
|
||
}
|
||
take() {
|
||
return this.#coords.subarray(0, this.#count * 6);
|
||
}
|
||
}
|
||
function createCanvasTrackers(canvas, operationsCount, {
|
||
recordOperations = false,
|
||
recordImages = false,
|
||
recordDebugMetadata = false
|
||
}) {
|
||
const bboxTracker = recordOperations || recordImages ? new CanvasBBoxTracker(canvas, operationsCount) : null;
|
||
return {
|
||
dependencyTracker: recordOperations ? new CanvasDependencyTracker(bboxTracker, recordDebugMetadata) : bboxTracker,
|
||
imagesTracker: recordImages ? new CanvasImagesTracker(canvas) : null
|
||
};
|
||
}
|
||
|
||
;// ./src/shared/image_utils.js
|
||
/* unused harmony import specifier */ var image_utils_ImageKind;
|
||
/* unused harmony import specifier */ var image_utils_FeatureTest;
|
||
|
||
|
||
|
||
function convertToRGBA(params) {
|
||
switch (params.kind) {
|
||
case image_utils_ImageKind.GRAYSCALE_1BPP:
|
||
return convertBlackAndWhiteToRGBA(params);
|
||
case image_utils_ImageKind.RGB_24BPP:
|
||
return convertRGBToRGBA(params);
|
||
}
|
||
return null;
|
||
}
|
||
function convertBlackAndWhiteToRGBA({
|
||
src,
|
||
srcPos = 0,
|
||
dest,
|
||
width,
|
||
height,
|
||
nonBlackColor = 0xffffffff,
|
||
inverseDecode = false
|
||
}) {
|
||
const black = FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;
|
||
const [zeroMapping, oneMapping] = inverseDecode ? [nonBlackColor, black] : [black, nonBlackColor];
|
||
const widthInSource = width >> 3;
|
||
const widthRemainder = width & 7;
|
||
const xorMask = zeroMapping ^ oneMapping;
|
||
const srcLength = src.length;
|
||
dest = new Uint32Array(dest.buffer);
|
||
let destPos = 0;
|
||
for (let i = 0; i < height; ++i) {
|
||
for (const max = srcPos + widthInSource; srcPos < max; ++srcPos, destPos += 8) {
|
||
const elem = src[srcPos];
|
||
dest[destPos] = zeroMapping ^ -(elem >> 7 & 1) & xorMask;
|
||
dest[destPos + 1] = zeroMapping ^ -(elem >> 6 & 1) & xorMask;
|
||
dest[destPos + 2] = zeroMapping ^ -(elem >> 5 & 1) & xorMask;
|
||
dest[destPos + 3] = zeroMapping ^ -(elem >> 4 & 1) & xorMask;
|
||
dest[destPos + 4] = zeroMapping ^ -(elem >> 3 & 1) & xorMask;
|
||
dest[destPos + 5] = zeroMapping ^ -(elem >> 2 & 1) & xorMask;
|
||
dest[destPos + 6] = zeroMapping ^ -(elem >> 1 & 1) & xorMask;
|
||
dest[destPos + 7] = zeroMapping ^ -(elem & 1) & xorMask;
|
||
}
|
||
if (widthRemainder === 0) {
|
||
continue;
|
||
}
|
||
const elem = srcPos < srcLength ? src[srcPos++] : 255;
|
||
for (let j = 0; j < widthRemainder; ++j, ++destPos) {
|
||
dest[destPos] = zeroMapping ^ -(elem >> 7 - j & 1) & xorMask;
|
||
}
|
||
}
|
||
return {
|
||
srcPos,
|
||
destPos
|
||
};
|
||
}
|
||
function convertRGBToRGBA({
|
||
src,
|
||
srcPos = 0,
|
||
dest,
|
||
destPos = 0,
|
||
width,
|
||
height
|
||
}) {
|
||
let i = 0;
|
||
const len = width * height * 3;
|
||
const byteOffset = src.byteOffset + srcPos;
|
||
const len32 = byteOffset % 4 === 0 ? Math.floor(math_clamp_MathClamp(src.length - srcPos, 0, len) / 4) : 0;
|
||
const src32 = len32 > 0 ? new Uint32Array(src.buffer, byteOffset, len32) : null;
|
||
const alphaMask = FeatureTest.isLittleEndian ? 0xff000000 : 0xff;
|
||
if (FeatureTest.isLittleEndian) {
|
||
for (; i < len32 - 2; i += 3, destPos += 4) {
|
||
const s1 = src32[i],
|
||
s2 = src32[i + 1],
|
||
s3 = src32[i + 2];
|
||
dest[destPos] = s1 | alphaMask;
|
||
dest[destPos + 1] = s1 >>> 24 | s2 << 8 | alphaMask;
|
||
dest[destPos + 2] = s2 >>> 16 | s3 << 16 | alphaMask;
|
||
dest[destPos + 3] = s3 >>> 8 | alphaMask;
|
||
}
|
||
for (let j = srcPos + i * 4, jj = srcPos + len; j < jj; j += 3) {
|
||
dest[destPos++] = src[j] | src[j + 1] << 8 | src[j + 2] << 16 | alphaMask;
|
||
}
|
||
} else {
|
||
for (; i < len32 - 2; i += 3, destPos += 4) {
|
||
const s1 = src32[i],
|
||
s2 = src32[i + 1],
|
||
s3 = src32[i + 2];
|
||
dest[destPos] = s1 | alphaMask;
|
||
dest[destPos + 1] = s1 << 24 | s2 >>> 8 | alphaMask;
|
||
dest[destPos + 2] = s2 << 16 | s3 >>> 16 | alphaMask;
|
||
dest[destPos + 3] = s3 << 8 | alphaMask;
|
||
}
|
||
for (let j = srcPos + i * 4, jj = srcPos + len; j < jj; j += 3) {
|
||
dest[destPos++] = src[j] << 24 | src[j + 1] << 16 | src[j + 2] << 8 | alphaMask;
|
||
}
|
||
}
|
||
return {
|
||
srcPos: srcPos + len,
|
||
destPos
|
||
};
|
||
}
|
||
function grayToRGBA(src, dest) {
|
||
if (image_utils_FeatureTest.isLittleEndian) {
|
||
for (let i = 0, ii = src.length; i < ii; i++) {
|
||
dest[i] = src[i] * 0x10101 | 0xff000000;
|
||
}
|
||
} else {
|
||
for (let i = 0, ii = src.length; i < ii; i++) {
|
||
dest[i] = src[i] * 0x1010100 | 0x000000ff;
|
||
}
|
||
}
|
||
}
|
||
|
||
;// ./src/display/webgpu.js
|
||
|
||
const MESH_WGSL = `
|
||
struct Uniforms {
|
||
offsetX : f32,
|
||
offsetY : f32,
|
||
scaleX : f32,
|
||
scaleY : f32,
|
||
paddedWidth : f32,
|
||
paddedHeight : f32,
|
||
borderSize : f32,
|
||
_pad : f32,
|
||
};
|
||
|
||
@group(0) @binding(0) var<uniform> u : Uniforms;
|
||
|
||
struct VertexInput {
|
||
@location(0) position : vec2<f32>,
|
||
@location(1) color : vec4<f32>,
|
||
};
|
||
|
||
struct VertexOutput {
|
||
@builtin(position) position : vec4<f32>,
|
||
@location(0) color : vec3<f32>,
|
||
};
|
||
|
||
@vertex
|
||
fn vs_main(in : VertexInput) -> VertexOutput {
|
||
var out : VertexOutput;
|
||
let cx = (in.position.x + u.offsetX) * u.scaleX;
|
||
let cy = (in.position.y + u.offsetY) * u.scaleY;
|
||
out.position = vec4<f32>(
|
||
((cx + u.borderSize) / u.paddedWidth) * 2.0 - 1.0,
|
||
1.0 - ((cy + u.borderSize) / u.paddedHeight) * 2.0,
|
||
0.0,
|
||
1.0
|
||
);
|
||
out.color = in.color.rgb;
|
||
return out;
|
||
}
|
||
|
||
@fragment
|
||
fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
||
return vec4<f32>(in.color, 1.0);
|
||
}
|
||
`;
|
||
class WebGPU {
|
||
#initPromise = null;
|
||
#device = null;
|
||
#meshPipeline = null;
|
||
#preferredFormat = null;
|
||
async #initGPU() {
|
||
if (!globalThis.navigator?.gpu) {
|
||
return false;
|
||
}
|
||
try {
|
||
const adapter = await navigator.gpu.requestAdapter();
|
||
if (!adapter) {
|
||
return false;
|
||
}
|
||
this.#preferredFormat = navigator.gpu.getPreferredCanvasFormat();
|
||
this.#device = await adapter.requestDevice();
|
||
return true;
|
||
} catch {
|
||
return false;
|
||
}
|
||
}
|
||
init() {
|
||
return this.#initPromise ||= this.#initGPU();
|
||
}
|
||
get isReady() {
|
||
return this.#device !== null;
|
||
}
|
||
loadMeshShader() {
|
||
if (!this.#device || this.#meshPipeline) {
|
||
return;
|
||
}
|
||
const shaderModule = this.#device.createShaderModule({
|
||
code: MESH_WGSL
|
||
});
|
||
this.#meshPipeline = this.#device.createRenderPipeline({
|
||
layout: "auto",
|
||
vertex: {
|
||
module: shaderModule,
|
||
entryPoint: "vs_main",
|
||
buffers: [{
|
||
arrayStride: 2 * 4,
|
||
attributes: [{
|
||
shaderLocation: 0,
|
||
offset: 0,
|
||
format: "float32x2"
|
||
}]
|
||
}, {
|
||
arrayStride: 4,
|
||
attributes: [{
|
||
shaderLocation: 1,
|
||
offset: 0,
|
||
format: "unorm8x4"
|
||
}]
|
||
}]
|
||
},
|
||
fragment: {
|
||
module: shaderModule,
|
||
entryPoint: "fs_main",
|
||
targets: [{
|
||
format: this.#preferredFormat
|
||
}]
|
||
},
|
||
primitive: {
|
||
topology: "triangle-list"
|
||
}
|
||
});
|
||
}
|
||
draw(posData, colData, vertexCount, context, backgroundColor, paddedWidth, paddedHeight, borderSize) {
|
||
this.loadMeshShader();
|
||
const device = this.#device;
|
||
const {
|
||
offsetX,
|
||
offsetY,
|
||
scaleX,
|
||
scaleY
|
||
} = context;
|
||
const posBuffer = device.createBuffer({
|
||
size: Math.max(posData.byteLength, 4),
|
||
usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST
|
||
});
|
||
if (posData.byteLength > 0) {
|
||
device.queue.writeBuffer(posBuffer, 0, posData);
|
||
}
|
||
const colBuffer = device.createBuffer({
|
||
size: Math.max(colData.byteLength, 4),
|
||
usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST
|
||
});
|
||
if (colData.byteLength > 0) {
|
||
device.queue.writeBuffer(colBuffer, 0, colData);
|
||
}
|
||
const uniformBuffer = device.createBuffer({
|
||
size: 8 * 4,
|
||
usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST
|
||
});
|
||
device.queue.writeBuffer(uniformBuffer, 0, new Float32Array([offsetX, offsetY, scaleX, scaleY, paddedWidth, paddedHeight, borderSize, 0]));
|
||
const bindGroup = device.createBindGroup({
|
||
layout: this.#meshPipeline.getBindGroupLayout(0),
|
||
entries: [{
|
||
binding: 0,
|
||
resource: {
|
||
buffer: uniformBuffer
|
||
}
|
||
}]
|
||
});
|
||
const offscreen = new OffscreenCanvas(paddedWidth, paddedHeight);
|
||
const gpuCtx = offscreen.getContext("webgpu");
|
||
gpuCtx.configure({
|
||
device,
|
||
format: this.#preferredFormat,
|
||
alphaMode: backgroundColor ? "opaque" : "premultiplied"
|
||
});
|
||
const clearValue = backgroundColor ? {
|
||
r: backgroundColor[0] / 255,
|
||
g: backgroundColor[1] / 255,
|
||
b: backgroundColor[2] / 255,
|
||
a: 1
|
||
} : {
|
||
r: 0,
|
||
g: 0,
|
||
b: 0,
|
||
a: 0
|
||
};
|
||
const commandEncoder = device.createCommandEncoder();
|
||
const renderPass = commandEncoder.beginRenderPass({
|
||
colorAttachments: [{
|
||
view: gpuCtx.getCurrentTexture().createView(),
|
||
clearValue,
|
||
loadOp: "clear",
|
||
storeOp: "store"
|
||
}]
|
||
});
|
||
if (vertexCount > 0) {
|
||
renderPass.setPipeline(this.#meshPipeline);
|
||
renderPass.setBindGroup(0, bindGroup);
|
||
renderPass.setVertexBuffer(0, posBuffer);
|
||
renderPass.setVertexBuffer(1, colBuffer);
|
||
renderPass.draw(vertexCount);
|
||
}
|
||
renderPass.end();
|
||
device.queue.submit([commandEncoder.finish()]);
|
||
posBuffer.destroy();
|
||
colBuffer.destroy();
|
||
uniformBuffer.destroy();
|
||
return offscreen.transferToImageBitmap();
|
||
}
|
||
}
|
||
const _webGPU = new WebGPU();
|
||
function initGPU() {
|
||
return _webGPU.init();
|
||
}
|
||
function isGPUReady() {
|
||
return _webGPU.isReady;
|
||
}
|
||
function loadMeshShader() {
|
||
_webGPU.loadMeshShader();
|
||
}
|
||
function drawMeshWithGPU(posData, colData, vertexCount, context, backgroundColor, paddedWidth, paddedHeight, borderSize) {
|
||
return _webGPU.draw(posData, colData, vertexCount, context, backgroundColor, paddedWidth, paddedHeight, borderSize);
|
||
}
|
||
|
||
;// ./src/display/pattern_helper.js
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
const PathType = {
|
||
FILL: "Fill",
|
||
STROKE: "Stroke",
|
||
SHADING: "Shading"
|
||
};
|
||
function applyBoundingBox(ctx, bbox) {
|
||
if (!bbox) {
|
||
return;
|
||
}
|
||
const width = bbox[2] - bbox[0];
|
||
const height = bbox[3] - bbox[1];
|
||
const region = new Path2D();
|
||
region.rect(bbox[0], bbox[1], width, height);
|
||
ctx.clip(region);
|
||
}
|
||
class BaseShadingPattern {
|
||
matrix = null;
|
||
isModifyingCurrentTransform() {
|
||
return false;
|
||
}
|
||
getPattern() {
|
||
unreachable("Abstract method `getPattern` called.");
|
||
}
|
||
}
|
||
class RadialAxialShadingPattern extends BaseShadingPattern {
|
||
constructor(IR) {
|
||
super();
|
||
this._type = IR[1];
|
||
this._bbox = IR[2];
|
||
this._colorStops = IR[3];
|
||
this._p0 = IR[4];
|
||
this._p1 = IR[5];
|
||
this._r0 = IR[6];
|
||
this._r1 = IR[7];
|
||
}
|
||
isOriginBased() {
|
||
return this._p0[0] === 0 && this._p0[1] === 0 && (!this.isRadial() || this._p1[0] === 0 && this._p1[1] === 0);
|
||
}
|
||
isRadial() {
|
||
return this._type === "radial";
|
||
}
|
||
areConic() {
|
||
if (!this.isRadial()) {
|
||
return false;
|
||
}
|
||
const dist = Math.hypot(this._p0[0] - this._p1[0], this._p0[1] - this._p1[1]);
|
||
return dist + this._r1 > this._r0 && dist + this._r0 > this._r1;
|
||
}
|
||
_createGradient(ctx, transform = null) {
|
||
let grad;
|
||
let firstPoint = this._p0;
|
||
let secondPoint = this._p1;
|
||
if (transform) {
|
||
firstPoint = firstPoint.slice();
|
||
secondPoint = secondPoint.slice();
|
||
Util.applyTransform(firstPoint, transform);
|
||
Util.applyTransform(secondPoint, transform);
|
||
}
|
||
if (this._type === "axial") {
|
||
grad = ctx.createLinearGradient(firstPoint[0], firstPoint[1], secondPoint[0], secondPoint[1]);
|
||
} else if (this._type === "radial") {
|
||
let r0 = this._r0;
|
||
let r1 = this._r1;
|
||
if (transform) {
|
||
const scale = new Float32Array(2);
|
||
Util.singularValueDecompose2dScale(transform, scale);
|
||
r0 *= scale[0];
|
||
r1 *= scale[0];
|
||
}
|
||
grad = ctx.createRadialGradient(firstPoint[0], firstPoint[1], r0, secondPoint[0], secondPoint[1], r1);
|
||
}
|
||
for (const colorStop of this._colorStops) {
|
||
grad.addColorStop(colorStop[0], colorStop[1]);
|
||
}
|
||
return grad;
|
||
}
|
||
_createReversedGradient(ctx, transform = null) {
|
||
let firstPoint = this._p1;
|
||
let secondPoint = this._p0;
|
||
if (transform) {
|
||
firstPoint = firstPoint.slice();
|
||
secondPoint = secondPoint.slice();
|
||
Util.applyTransform(firstPoint, transform);
|
||
Util.applyTransform(secondPoint, transform);
|
||
}
|
||
let r0 = this._r1;
|
||
let r1 = this._r0;
|
||
if (transform) {
|
||
const scale = new Float32Array(2);
|
||
Util.singularValueDecompose2dScale(transform, scale);
|
||
r0 *= scale[0];
|
||
r1 *= scale[0];
|
||
}
|
||
const grad = ctx.createRadialGradient(firstPoint[0], firstPoint[1], r0, secondPoint[0], secondPoint[1], r1);
|
||
const reversedStops = this._colorStops.map(([t, c]) => [1 - t, c]).reverse();
|
||
for (const [t, c] of reversedStops) {
|
||
grad.addColorStop(t, c);
|
||
}
|
||
return grad;
|
||
}
|
||
_createRasterPattern(ctx, owner, inverse, bbox, transform, transferMaps) {
|
||
const width = Math.ceil(bbox[2] - bbox[0]) || 1;
|
||
const height = Math.ceil(bbox[3] - bbox[1]) || 1;
|
||
const tmpCanvas = owner.canvasFactory.create(width, height);
|
||
const tmpCtx = tmpCanvas.context;
|
||
tmpCtx.clearRect(0, 0, width, height);
|
||
tmpCtx.beginPath();
|
||
tmpCtx.rect(0, 0, width, height);
|
||
tmpCtx.translate(-bbox[0], -bbox[1]);
|
||
inverse = Util.transform(inverse, [1, 0, 0, 1, bbox[0], bbox[1]]);
|
||
tmpCtx.transform(...transform);
|
||
applyBoundingBox(tmpCtx, this._bbox);
|
||
if (this.areConic()) {
|
||
tmpCtx.fillStyle = this._createReversedGradient(tmpCtx);
|
||
tmpCtx.fill();
|
||
}
|
||
tmpCtx.fillStyle = this._createGradient(tmpCtx);
|
||
tmpCtx.fill();
|
||
transferMaps?.applyToCanvas(tmpCtx);
|
||
const pattern = ctx.createPattern(tmpCanvas.canvas, "no-repeat");
|
||
owner.canvasFactory.destroy(tmpCanvas);
|
||
pattern.setTransform(new DOMMatrix(inverse));
|
||
return pattern;
|
||
}
|
||
getPattern(ctx, owner, inverse, pathType) {
|
||
const transferMaps = owner.current.transferMapsFallback;
|
||
if (pathType === PathType.STROKE || pathType === PathType.FILL) {
|
||
if (this.isOriginBased() && !transferMaps) {
|
||
let transf = Util.transform(inverse, owner.baseTransform);
|
||
if (this.matrix) {
|
||
transf = Util.transform(transf, this.matrix);
|
||
}
|
||
const precision = 1e-3;
|
||
const n1 = Math.hypot(transf[0], transf[1]);
|
||
const n2 = Math.hypot(transf[2], transf[3]);
|
||
const ps = (transf[0] * transf[2] + transf[1] * transf[3]) / (n1 * n2);
|
||
if (Math.abs(ps) < precision) {
|
||
if (this.isRadial()) {
|
||
if (Math.abs(n1 - n2) < precision) {
|
||
return this._createGradient(ctx, transf);
|
||
}
|
||
} else {
|
||
return this._createGradient(ctx, transf);
|
||
}
|
||
}
|
||
}
|
||
const ownerBBox = owner.current.getClippedPathBoundingBox(pathType, getCurrentTransform(ctx)) || [0, 0, 0, 0];
|
||
const transform = this.matrix ? Util.transform(owner.baseTransform, this.matrix) : owner.baseTransform;
|
||
return this._createRasterPattern(ctx, owner, inverse, ownerBBox, transform, transferMaps);
|
||
}
|
||
if (transferMaps && inverse) {
|
||
return this._createRasterPattern(ctx, owner, inverse, owner.current.clipBox, getCurrentTransform(ctx), transferMaps);
|
||
}
|
||
if (this.areConic()) {
|
||
ctx.save();
|
||
applyBoundingBox(ctx, this._bbox);
|
||
ctx.fillStyle = this._createReversedGradient(ctx);
|
||
ctx.fillRect(-1e10, -1e10, 2e10, 2e10);
|
||
ctx.restore();
|
||
}
|
||
applyBoundingBox(ctx, this._bbox);
|
||
return this._createGradient(ctx);
|
||
}
|
||
}
|
||
function drawTriangle(data, context, p1, p2, p3, c1, c2, c3) {
|
||
const coords = context.coords,
|
||
colors = context.colors;
|
||
const bytes = data.data,
|
||
rowSize = data.width * 4;
|
||
let tmp;
|
||
if (coords[p1 * 2 + 1] > coords[p2 * 2 + 1]) {
|
||
tmp = p1;
|
||
p1 = p2;
|
||
p2 = tmp;
|
||
tmp = c1;
|
||
c1 = c2;
|
||
c2 = tmp;
|
||
}
|
||
if (coords[p2 * 2 + 1] > coords[p3 * 2 + 1]) {
|
||
tmp = p2;
|
||
p2 = p3;
|
||
p3 = tmp;
|
||
tmp = c2;
|
||
c2 = c3;
|
||
c3 = tmp;
|
||
}
|
||
if (coords[p1 * 2 + 1] > coords[p2 * 2 + 1]) {
|
||
tmp = p1;
|
||
p1 = p2;
|
||
p2 = tmp;
|
||
tmp = c1;
|
||
c1 = c2;
|
||
c2 = tmp;
|
||
}
|
||
const x1 = (coords[p1 * 2] + context.offsetX) * context.scaleX;
|
||
const y1 = (coords[p1 * 2 + 1] + context.offsetY) * context.scaleY;
|
||
const x2 = (coords[p2 * 2] + context.offsetX) * context.scaleX;
|
||
const y2 = (coords[p2 * 2 + 1] + context.offsetY) * context.scaleY;
|
||
const x3 = (coords[p3 * 2] + context.offsetX) * context.scaleX;
|
||
const y3 = (coords[p3 * 2 + 1] + context.offsetY) * context.scaleY;
|
||
if (y1 >= y3) {
|
||
return;
|
||
}
|
||
const c1r = colors[c1 * 4],
|
||
c1g = colors[c1 * 4 + 1],
|
||
c1b = colors[c1 * 4 + 2];
|
||
const c2r = colors[c2 * 4],
|
||
c2g = colors[c2 * 4 + 1],
|
||
c2b = colors[c2 * 4 + 2];
|
||
const c3r = colors[c3 * 4],
|
||
c3g = colors[c3 * 4 + 1],
|
||
c3b = colors[c3 * 4 + 2];
|
||
const minY = Math.round(y1),
|
||
maxY = Math.round(y3);
|
||
let xa, car, cag, cab;
|
||
let xb, cbr, cbg, cbb;
|
||
for (let y = minY; y <= maxY; y++) {
|
||
if (y < y2) {
|
||
const k = y < y1 ? 0 : (y1 - y) / (y1 - y2);
|
||
xa = x1 - (x1 - x2) * k;
|
||
car = c1r - (c1r - c2r) * k;
|
||
cag = c1g - (c1g - c2g) * k;
|
||
cab = c1b - (c1b - c2b) * k;
|
||
} else {
|
||
let k;
|
||
if (y > y3) {
|
||
k = 1;
|
||
} else if (y2 === y3) {
|
||
k = 0;
|
||
} else {
|
||
k = (y2 - y) / (y2 - y3);
|
||
}
|
||
xa = x2 - (x2 - x3) * k;
|
||
car = c2r - (c2r - c3r) * k;
|
||
cag = c2g - (c2g - c3g) * k;
|
||
cab = c2b - (c2b - c3b) * k;
|
||
}
|
||
let k;
|
||
if (y < y1) {
|
||
k = 0;
|
||
} else if (y > y3) {
|
||
k = 1;
|
||
} else {
|
||
k = (y1 - y) / (y1 - y3);
|
||
}
|
||
xb = x1 - (x1 - x3) * k;
|
||
cbr = c1r - (c1r - c3r) * k;
|
||
cbg = c1g - (c1g - c3g) * k;
|
||
cbb = c1b - (c1b - c3b) * k;
|
||
const x1_ = Math.round(Math.min(xa, xb));
|
||
const x2_ = Math.round(Math.max(xa, xb));
|
||
let j = rowSize * y + x1_ * 4;
|
||
for (let x = x1_; x <= x2_; x++) {
|
||
k = (xa - x) / (xa - xb);
|
||
if (k < 0) {
|
||
k = 0;
|
||
} else if (k > 1) {
|
||
k = 1;
|
||
}
|
||
bytes[j++] = car - (car - cbr) * k | 0;
|
||
bytes[j++] = cag - (cag - cbg) * k | 0;
|
||
bytes[j++] = cab - (cab - cbb) * k | 0;
|
||
bytes[j++] = 255;
|
||
}
|
||
}
|
||
}
|
||
class MeshShadingPattern extends BaseShadingPattern {
|
||
constructor(IR) {
|
||
super();
|
||
this._posData = IR[2];
|
||
this._colData = IR[3];
|
||
this._vertexCount = IR[4];
|
||
this._bounds = IR[5];
|
||
this._bbox = IR[6];
|
||
this._background = IR[7];
|
||
loadMeshShader();
|
||
}
|
||
_createMeshCanvas(combinedScale, backgroundColor, canvasFactory, transferMaps = null) {
|
||
const EXPECTED_SCALE = 1.1;
|
||
const MAX_PATTERN_SIZE = 3000;
|
||
const BORDER_SIZE = 2;
|
||
const offsetX = Math.floor(this._bounds[0]);
|
||
const offsetY = Math.floor(this._bounds[1]);
|
||
const boundsWidth = Math.ceil(this._bounds[2]) - offsetX;
|
||
const boundsHeight = Math.ceil(this._bounds[3]) - offsetY;
|
||
const width = Math.min(Math.ceil(Math.abs(boundsWidth * combinedScale[0] * EXPECTED_SCALE)), MAX_PATTERN_SIZE) || 1;
|
||
const height = Math.min(Math.ceil(Math.abs(boundsHeight * combinedScale[1] * EXPECTED_SCALE)), MAX_PATTERN_SIZE) || 1;
|
||
const scaleX = boundsWidth ? boundsWidth / width : 1;
|
||
const scaleY = boundsHeight ? boundsHeight / height : 1;
|
||
const context = {
|
||
coords: this._posData,
|
||
colors: this._colData,
|
||
offsetX: -offsetX,
|
||
offsetY: -offsetY,
|
||
scaleX: 1 / scaleX,
|
||
scaleY: 1 / scaleY
|
||
};
|
||
const paddedWidth = width + BORDER_SIZE * 2;
|
||
const paddedHeight = height + BORDER_SIZE * 2;
|
||
const tmpCanvas = canvasFactory.create(paddedWidth, paddedHeight);
|
||
if (isGPUReady() && this._vertexCount > 48) {
|
||
tmpCanvas.context.drawImage(drawMeshWithGPU(this._posData, this._colData, this._vertexCount, context, backgroundColor, paddedWidth, paddedHeight, BORDER_SIZE), 0, 0);
|
||
} else {
|
||
const data = tmpCanvas.context.createImageData(width, height);
|
||
if (backgroundColor) {
|
||
const bytes = data.data;
|
||
for (let i = 0, ii = bytes.length; i < ii; i += 4) {
|
||
bytes[i] = backgroundColor[0];
|
||
bytes[i + 1] = backgroundColor[1];
|
||
bytes[i + 2] = backgroundColor[2];
|
||
bytes[i + 3] = 255;
|
||
}
|
||
}
|
||
for (let i = 0, ii = this._vertexCount; i < ii; i += 3) {
|
||
drawTriangle(data, context, i, i + 1, i + 2, i, i + 1, i + 2);
|
||
}
|
||
tmpCanvas.context.putImageData(data, BORDER_SIZE, BORDER_SIZE);
|
||
}
|
||
transferMaps?.applyToCanvas(tmpCanvas.context);
|
||
return {
|
||
canvas: tmpCanvas.canvas,
|
||
offsetX: offsetX - BORDER_SIZE * scaleX,
|
||
offsetY: offsetY - BORDER_SIZE * scaleY,
|
||
scaleX,
|
||
scaleY
|
||
};
|
||
}
|
||
isModifyingCurrentTransform() {
|
||
return true;
|
||
}
|
||
getPattern(ctx, owner, inverse, pathType) {
|
||
applyBoundingBox(ctx, this._bbox);
|
||
const scale = new Float32Array(2);
|
||
if (pathType === PathType.SHADING) {
|
||
Util.singularValueDecompose2dScale(getCurrentTransform(ctx), scale);
|
||
} else if (this.matrix) {
|
||
Util.singularValueDecompose2dScale(this.matrix, scale);
|
||
const [matrixScaleX, matrixScaleY] = scale;
|
||
Util.singularValueDecompose2dScale(owner.baseTransform, scale);
|
||
scale[0] *= matrixScaleX;
|
||
scale[1] *= matrixScaleY;
|
||
} else {
|
||
Util.singularValueDecompose2dScale(owner.baseTransform, scale);
|
||
}
|
||
const temporaryPatternCanvas = this._createMeshCanvas(scale, pathType === PathType.SHADING ? null : this._background, owner.canvasFactory, owner.current.transferMapsFallback);
|
||
if (pathType !== PathType.SHADING) {
|
||
ctx.setTransform(...owner.baseTransform);
|
||
if (this.matrix) {
|
||
ctx.transform(...this.matrix);
|
||
}
|
||
}
|
||
ctx.translate(temporaryPatternCanvas.offsetX, temporaryPatternCanvas.offsetY);
|
||
ctx.scale(temporaryPatternCanvas.scaleX, temporaryPatternCanvas.scaleY);
|
||
const pattern = ctx.createPattern(temporaryPatternCanvas.canvas, "no-repeat");
|
||
owner.canvasFactory.destroy(temporaryPatternCanvas);
|
||
return pattern;
|
||
}
|
||
}
|
||
class DummyShadingPattern extends BaseShadingPattern {
|
||
getPattern() {
|
||
return "hotpink";
|
||
}
|
||
}
|
||
function getShadingPattern(IR) {
|
||
switch (IR[0]) {
|
||
case "RadialAxial":
|
||
return new RadialAxialShadingPattern(IR);
|
||
case "Mesh":
|
||
return new MeshShadingPattern(IR);
|
||
case "Dummy":
|
||
return new DummyShadingPattern();
|
||
}
|
||
throw new Error(`Unknown IR type: ${IR[0]}`);
|
||
}
|
||
const PaintType = {
|
||
COLORED: 1,
|
||
UNCOLORED: 2
|
||
};
|
||
class TilingPattern {
|
||
static MAX_PATTERN_SIZE = 3000;
|
||
constructor(IR, ctx, canvasGraphicsFactory, baseTransform) {
|
||
this.color = IR[1];
|
||
this.operatorList = IR[2];
|
||
this.matrix = IR[3];
|
||
this.bbox = IR[4];
|
||
this.xstep = IR[5];
|
||
this.ystep = IR[6];
|
||
this.paintType = IR[7];
|
||
this.tilingType = IR[8];
|
||
this.needsIsolation = IR[9] ?? true;
|
||
this.ctx = ctx;
|
||
this.canvasGraphicsFactory = canvasGraphicsFactory;
|
||
this.baseTransform = baseTransform;
|
||
this.patternBaseMatrix = this.matrix ? Util.transform(baseTransform, this.matrix) : baseTransform;
|
||
}
|
||
canSkipPatternCanvas([width, height, offsetX, offsetY]) {
|
||
const [x0, y0, x1, y1] = this.bbox;
|
||
const absXStep = Math.abs(this.xstep);
|
||
const absYStep = Math.abs(this.ystep);
|
||
if (width > absXStep + 1e-6 || height > absYStep + 1e-6) {
|
||
return null;
|
||
}
|
||
const nXFirst = Math.floor((offsetX - x1) / absXStep) + 1;
|
||
const nXLast = Math.ceil((offsetX + width - x0) / absXStep) - 1;
|
||
const nYFirst = Math.floor((offsetY - y1) / absYStep) + 1;
|
||
const nYLast = Math.ceil((offsetY + height - y0) / absYStep) - 1;
|
||
return nXLast <= nXFirst && nYLast <= nYFirst ? [nXFirst, nYFirst] : null;
|
||
}
|
||
updatePatternDims(clippedBBox, dims) {
|
||
const bbox = BBOX_INIT.slice();
|
||
Util.axialAlignedBoundingBox(clippedBBox, Util.inverseTransform(this.patternBaseMatrix), bbox);
|
||
dims[0] = bbox[2] - bbox[0];
|
||
dims[1] = bbox[3] - bbox[1];
|
||
dims[2] = bbox[0];
|
||
dims[3] = bbox[1];
|
||
}
|
||
_renderTileCanvas(owner, opIdx, dimx, dimy) {
|
||
const [x0, y0, x1, y1] = this.bbox;
|
||
const tmpCanvas = owner.canvasFactory.create(dimx.size, dimy.size);
|
||
const tmpCtx = tmpCanvas.context;
|
||
const graphics = this.canvasGraphicsFactory.createCanvasGraphics(tmpCtx, opIdx);
|
||
graphics.groupLevel = owner.groupLevel;
|
||
graphics.current.transferMapsFallback = owner.current.transferMapsFallback;
|
||
this.setFillAndStrokeStyleToContext(graphics, this.paintType, this.color);
|
||
tmpCtx.translate(-dimx.scale * x0, -dimy.scale * y0);
|
||
graphics.transform(0, dimx.scale, 0, 0, dimy.scale, 0, 0);
|
||
tmpCtx.save();
|
||
graphics.dependencyTracker?.save();
|
||
this.clipBbox(graphics, x0, y0, x1, y1);
|
||
graphics.baseTransform = getCurrentTransform(graphics.ctx);
|
||
graphics.executeOperatorList(this.operatorList);
|
||
graphics.endDrawing();
|
||
graphics.dependencyTracker?.restore();
|
||
tmpCtx.restore();
|
||
return tmpCanvas;
|
||
}
|
||
_getCombinedScales() {
|
||
const scale = new Float32Array(2);
|
||
Util.singularValueDecompose2dScale(this.matrix, scale);
|
||
const [matrixScaleX, matrixScaleY] = scale;
|
||
Util.singularValueDecompose2dScale(this.baseTransform, scale);
|
||
return [matrixScaleX * scale[0], matrixScaleY * scale[1]];
|
||
}
|
||
drawPattern(owner, path, useEOFill = false, [n, m], opIdx) {
|
||
const [x0, y0, x1, y1] = this.bbox;
|
||
const dependencyTracker = owner.dependencyTracker;
|
||
if (dependencyTracker) {
|
||
owner.dependencyTracker = new CanvasNestedDependencyTracker(dependencyTracker, opIdx);
|
||
}
|
||
try {
|
||
owner.save();
|
||
if (useEOFill) {
|
||
owner.ctx.clip(path, "evenodd");
|
||
} else {
|
||
owner.ctx.clip(path);
|
||
}
|
||
owner.ctx.setTransform(...this.patternBaseMatrix);
|
||
owner.ctx.translate(n * this.xstep, m * this.ystep);
|
||
if (this.needsIsolation || owner.ctx.globalAlpha !== 1 || owner.ctx.globalCompositeOperation !== "source-over" || owner.inSMaskMode) {
|
||
const bboxWidth = x1 - x0;
|
||
const bboxHeight = y1 - y0;
|
||
const [combinedScaleX, combinedScaleY] = this._getCombinedScales();
|
||
const dimx = this.getSizeAndScale(bboxWidth, this.ctx.canvas.width, combinedScaleX);
|
||
const dimy = this.getSizeAndScale(bboxHeight, this.ctx.canvas.height, combinedScaleY);
|
||
const tmpCanvas = this._renderTileCanvas(owner, opIdx, dimx, dimy);
|
||
owner.ctx.drawImage(tmpCanvas.canvas, x0, y0, bboxWidth, bboxHeight);
|
||
owner.canvasFactory.destroy(tmpCanvas);
|
||
} else {
|
||
owner.resetGraphicsState();
|
||
this.setFillAndStrokeStyleToContext(owner, this.paintType, this.color);
|
||
this.clipBbox(owner, x0, y0, x1, y1);
|
||
owner.baseTransformStack.push(owner.baseTransform);
|
||
owner.baseTransform = getCurrentTransform(owner.ctx);
|
||
owner.executeOperatorList(this.operatorList);
|
||
owner.baseTransform = owner.baseTransformStack.pop();
|
||
}
|
||
owner.restore();
|
||
} finally {
|
||
if (dependencyTracker) {
|
||
owner.dependencyTracker = dependencyTracker;
|
||
}
|
||
}
|
||
}
|
||
createPatternCanvas(owner, opIdx) {
|
||
const [x0, y0, x1, y1] = this.bbox;
|
||
const width = x1 - x0;
|
||
const height = y1 - y0;
|
||
let {
|
||
xstep,
|
||
ystep
|
||
} = this;
|
||
xstep = Math.abs(xstep);
|
||
ystep = Math.abs(ystep);
|
||
info("TilingType: " + this.tilingType);
|
||
const [combinedScaleX, combinedScaleY] = this._getCombinedScales();
|
||
let canvasWidth = width,
|
||
canvasHeight = height,
|
||
redrawHorizontally = false,
|
||
redrawVertically = false;
|
||
if (Math.ceil(xstep * combinedScaleX) >= Math.ceil(width * combinedScaleX)) {
|
||
canvasWidth = xstep;
|
||
} else {
|
||
redrawHorizontally = true;
|
||
}
|
||
if (Math.ceil(ystep * combinedScaleY) >= Math.ceil(height * combinedScaleY)) {
|
||
canvasHeight = ystep;
|
||
} else {
|
||
redrawVertically = true;
|
||
}
|
||
const dimx = this.getSizeAndScale(canvasWidth, this.ctx.canvas.width, combinedScaleX);
|
||
const dimy = this.getSizeAndScale(canvasHeight, this.ctx.canvas.height, combinedScaleY);
|
||
const tmpCanvas = this._renderTileCanvas(owner, opIdx, dimx, dimy);
|
||
if (redrawHorizontally || redrawVertically) {
|
||
const image = tmpCanvas.canvas;
|
||
if (redrawHorizontally) {
|
||
canvasWidth = xstep;
|
||
}
|
||
if (redrawVertically) {
|
||
canvasHeight = ystep;
|
||
}
|
||
const dimx2 = this.getSizeAndScale(canvasWidth, this.ctx.canvas.width, combinedScaleX);
|
||
const dimy2 = this.getSizeAndScale(canvasHeight, this.ctx.canvas.height, combinedScaleY);
|
||
const xSize = dimx2.size;
|
||
const ySize = dimy2.size;
|
||
const tmpCanvas2 = owner.canvasFactory.create(xSize, ySize);
|
||
const tmpCtx2 = tmpCanvas2.context;
|
||
const ii = redrawHorizontally ? Math.min(Math.floor(width / xstep), Math.ceil(image.width / xSize)) : 0;
|
||
const jj = redrawVertically ? Math.min(Math.floor(height / ystep), Math.ceil(image.height / ySize)) : 0;
|
||
let rowSource = image;
|
||
let bandCanvas = null;
|
||
if (redrawVertically) {
|
||
bandCanvas = owner.canvasFactory.create(image.width, ySize);
|
||
const bandCtx = bandCanvas.context;
|
||
for (let j = jj; j >= 0; j--) {
|
||
bandCtx.drawImage(image, 0, ySize * j, image.width, ySize, 0, 0, image.width, ySize);
|
||
}
|
||
rowSource = bandCanvas.canvas;
|
||
}
|
||
for (let i = ii; i >= 0; i--) {
|
||
tmpCtx2.drawImage(rowSource, xSize * i, 0, xSize, ySize, 0, 0, xSize, ySize);
|
||
}
|
||
if (bandCanvas) {
|
||
owner.canvasFactory.destroy(bandCanvas);
|
||
}
|
||
owner.canvasFactory.destroy(tmpCanvas);
|
||
return {
|
||
canvas: tmpCanvas2.canvas,
|
||
canvasEntry: tmpCanvas2,
|
||
scaleX: dimx2.scale,
|
||
scaleY: dimy2.scale,
|
||
offsetX: x0,
|
||
offsetY: y0
|
||
};
|
||
}
|
||
return {
|
||
canvas: tmpCanvas.canvas,
|
||
canvasEntry: tmpCanvas,
|
||
scaleX: dimx.scale,
|
||
scaleY: dimy.scale,
|
||
offsetX: x0,
|
||
offsetY: y0
|
||
};
|
||
}
|
||
getSizeAndScale(step, realOutputSize, scale) {
|
||
const maxSize = Math.max(TilingPattern.MAX_PATTERN_SIZE, realOutputSize);
|
||
let size = Math.ceil(step * scale);
|
||
if (size >= maxSize) {
|
||
size = maxSize;
|
||
} else {
|
||
scale = size / step;
|
||
}
|
||
return {
|
||
scale,
|
||
size
|
||
};
|
||
}
|
||
clipBbox(graphics, x0, y0, x1, y1) {
|
||
const bboxWidth = x1 - x0;
|
||
const bboxHeight = y1 - y0;
|
||
const clip = new Path2D();
|
||
clip.rect(x0, y0, bboxWidth, bboxHeight);
|
||
Util.axialAlignedBoundingBox([x0, y0, x1, y1], getCurrentTransform(graphics.ctx), graphics.current.minMax);
|
||
graphics.ctx.clip(clip);
|
||
graphics.current.updateClipFromPath();
|
||
}
|
||
setFillAndStrokeStyleToContext(graphics, paintType, color) {
|
||
switch (paintType) {
|
||
case PaintType.COLORED:
|
||
color = "#000000";
|
||
break;
|
||
case PaintType.UNCOLORED:
|
||
break;
|
||
default:
|
||
throw new FormatError(`Unsupported paint type: ${paintType}`);
|
||
}
|
||
const {
|
||
ctx,
|
||
current
|
||
} = graphics;
|
||
current.patternFill = current.patternStroke = false;
|
||
ctx.fillStyle = ctx.strokeStyle = current.transferMapsFallback?.applyToColor(color) ?? color;
|
||
current.fillColor = current.strokeColor = color;
|
||
}
|
||
isModifyingCurrentTransform() {
|
||
return false;
|
||
}
|
||
getPattern(ctx, owner, inverse, pathType, opIdx) {
|
||
const matrix = pathType !== PathType.SHADING ? Util.transform(inverse, this.patternBaseMatrix) : inverse;
|
||
const temporaryPatternCanvas = this.createPatternCanvas(owner, opIdx);
|
||
let domMatrix = new DOMMatrix(matrix);
|
||
domMatrix = domMatrix.translate(temporaryPatternCanvas.offsetX, temporaryPatternCanvas.offsetY);
|
||
domMatrix = domMatrix.scale(1 / temporaryPatternCanvas.scaleX, 1 / temporaryPatternCanvas.scaleY);
|
||
const pattern = ctx.createPattern(temporaryPatternCanvas.canvas, "repeat");
|
||
owner.canvasFactory.destroy(temporaryPatternCanvas.canvasEntry);
|
||
pattern.setTransform(domMatrix);
|
||
return pattern;
|
||
}
|
||
}
|
||
|
||
;// ./src/display/canvas.js
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
const MIN_FONT_SIZE = 16;
|
||
const MAX_FONT_SIZE = 100;
|
||
const EXECUTION_TIME = 15;
|
||
const EXECUTION_STEPS = 10;
|
||
const FULL_CHUNK_HEIGHT = 16;
|
||
const XY = new Float32Array(2);
|
||
function mirrorContextOperations(ctx, destCtx) {
|
||
if (ctx._removeMirroring) {
|
||
throw new Error("Context is already forwarding operations.");
|
||
}
|
||
const originalMethods = new Map();
|
||
for (const name of ["save", "restore", "rotate", "scale", "translate", "transform", "setTransform", "resetTransform", "clip", "moveTo", "lineTo", "bezierCurveTo", "quadraticCurveTo", "arc", "arcTo", "ellipse", "rect", "roundRect", "closePath", "beginPath"]) {
|
||
const original = ctx[name];
|
||
if (typeof original !== "function" || typeof destCtx[name] !== "function") {
|
||
continue;
|
||
}
|
||
originalMethods.set(name, original);
|
||
ctx[name] = function (...args) {
|
||
destCtx[name](...args);
|
||
return original.apply(this, args);
|
||
};
|
||
}
|
||
ctx._removeMirroring = () => {
|
||
for (const [name, original] of originalMethods) {
|
||
ctx[name] = original;
|
||
}
|
||
delete ctx._removeMirroring;
|
||
};
|
||
}
|
||
function drawImageAtIntegerCoords(ctx, srcImg, srcX, srcY, srcW, srcH, destX, destY, destW, destH) {
|
||
const [a, b, c, d, tx, ty] = getCurrentTransform(ctx);
|
||
if (b === 0 && c === 0) {
|
||
const tlX = destX * a + tx;
|
||
const rTlX = Math.round(tlX);
|
||
const tlY = destY * d + ty;
|
||
const rTlY = Math.round(tlY);
|
||
const brX = (destX + destW) * a + tx;
|
||
const rWidth = Math.abs(Math.round(brX) - rTlX) || 1;
|
||
const brY = (destY + destH) * d + ty;
|
||
const rHeight = Math.abs(Math.round(brY) - rTlY) || 1;
|
||
ctx.setTransform(Math.sign(a), 0, 0, Math.sign(d), rTlX, rTlY);
|
||
ctx.drawImage(srcImg, srcX, srcY, srcW, srcH, 0, 0, rWidth, rHeight);
|
||
ctx.setTransform(a, b, c, d, tx, ty);
|
||
return [rWidth, rHeight];
|
||
}
|
||
if (a === 0 && d === 0) {
|
||
const tlX = destY * c + tx;
|
||
const rTlX = Math.round(tlX);
|
||
const tlY = destX * b + ty;
|
||
const rTlY = Math.round(tlY);
|
||
const brX = (destY + destH) * c + tx;
|
||
const rWidth = Math.abs(Math.round(brX) - rTlX) || 1;
|
||
const brY = (destX + destW) * b + ty;
|
||
const rHeight = Math.abs(Math.round(brY) - rTlY) || 1;
|
||
ctx.setTransform(0, Math.sign(b), Math.sign(c), 0, rTlX, rTlY);
|
||
ctx.drawImage(srcImg, srcX, srcY, srcW, srcH, 0, 0, rHeight, rWidth);
|
||
ctx.setTransform(a, b, c, d, tx, ty);
|
||
return [rHeight, rWidth];
|
||
}
|
||
ctx.drawImage(srcImg, srcX, srcY, srcW, srcH, destX, destY, destW, destH);
|
||
const scaleX = Math.hypot(a, b);
|
||
const scaleY = Math.hypot(c, d);
|
||
return [scaleX * destW, scaleY * destH];
|
||
}
|
||
class CanvasExtraState {
|
||
alphaIsShape = false;
|
||
fontSize = 0;
|
||
fontSizeScale = 1;
|
||
textMatrix = null;
|
||
textMatrixScale = 1;
|
||
fontMatrix = FONT_IDENTITY_MATRIX;
|
||
leading = 0;
|
||
x = 0;
|
||
y = 0;
|
||
lineX = 0;
|
||
lineY = 0;
|
||
charSpacing = 0;
|
||
wordSpacing = 0;
|
||
textHScale = 1;
|
||
textRenderingMode = TextRenderingMode.FILL;
|
||
textRise = 0;
|
||
fillColor = "#000000";
|
||
strokeColor = "#000000";
|
||
tilingPatternDims = null;
|
||
patternFill = false;
|
||
patternStroke = false;
|
||
fillAlpha = 1;
|
||
strokeAlpha = 1;
|
||
lineWidth = 1;
|
||
activeSMask = null;
|
||
transferMaps = "none";
|
||
transferMapsFallback = null;
|
||
minMax = F32_BBOX_INIT.slice();
|
||
constructor(width, height) {
|
||
this.clipBox = new Float32Array([0, 0, width, height]);
|
||
}
|
||
clone() {
|
||
const clone = Object.create(this);
|
||
clone.clipBox = this.clipBox.slice();
|
||
clone.minMax = this.minMax.slice();
|
||
clone.tilingPatternDims = this.tilingPatternDims?.slice();
|
||
return clone;
|
||
}
|
||
getPathBoundingBox(pathType = PathType.FILL, transform = null) {
|
||
const box = this.minMax.slice();
|
||
if (pathType === PathType.STROKE) {
|
||
if (!transform) {
|
||
unreachable("Stroke bounding box must include transform.");
|
||
}
|
||
Util.singularValueDecompose2dScale(transform, XY);
|
||
const xStrokePad = XY[0] * this.lineWidth / 2;
|
||
const yStrokePad = XY[1] * this.lineWidth / 2;
|
||
box[0] -= xStrokePad;
|
||
box[1] -= yStrokePad;
|
||
box[2] += xStrokePad;
|
||
box[3] += yStrokePad;
|
||
}
|
||
return box;
|
||
}
|
||
updateClipFromPath() {
|
||
const intersect = Util.intersect(this.clipBox, this.getPathBoundingBox());
|
||
this.startNewPathAndClipBox(intersect || [0, 0, 0, 0]);
|
||
}
|
||
isEmptyClip() {
|
||
return this.minMax[0] === Infinity;
|
||
}
|
||
startNewPathAndClipBox(box) {
|
||
this.clipBox.set(box, 0);
|
||
this.minMax.set(F32_BBOX_INIT, 0);
|
||
}
|
||
getClippedPathBoundingBox(pathType = PathType.FILL, transform = null) {
|
||
return Util.intersect(this.clipBox, this.getPathBoundingBox(pathType, transform));
|
||
}
|
||
}
|
||
function putBinaryImageData(ctx, imgData) {
|
||
const {
|
||
width,
|
||
height,
|
||
kind
|
||
} = imgData;
|
||
const partialChunkHeight = height % FULL_CHUNK_HEIGHT;
|
||
const fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT;
|
||
const totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1;
|
||
const chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT);
|
||
let srcPos = 0;
|
||
const src = imgData.data;
|
||
const dest = chunkImgData.data;
|
||
let i;
|
||
if (kind === ImageKind.GRAYSCALE_1BPP) {
|
||
for (i = 0; i < totalChunks; i++) {
|
||
({
|
||
srcPos
|
||
} = convertBlackAndWhiteToRGBA({
|
||
src,
|
||
srcPos,
|
||
dest,
|
||
width,
|
||
height: i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight
|
||
}));
|
||
ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);
|
||
}
|
||
} else if (kind === ImageKind.RGBA_32BPP) {
|
||
let j = 0;
|
||
let elemsInThisChunk = width * FULL_CHUNK_HEIGHT * 4;
|
||
for (i = 0; i < fullChunks; i++) {
|
||
dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk));
|
||
srcPos += elemsInThisChunk;
|
||
ctx.putImageData(chunkImgData, 0, j);
|
||
j += FULL_CHUNK_HEIGHT;
|
||
}
|
||
if (i < totalChunks) {
|
||
elemsInThisChunk = width * partialChunkHeight * 4;
|
||
dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk));
|
||
ctx.putImageData(chunkImgData, 0, j);
|
||
}
|
||
} else if (kind === ImageKind.RGB_24BPP) {
|
||
for (i = 0; i < totalChunks; i++) {
|
||
({
|
||
srcPos
|
||
} = convertRGBToRGBA({
|
||
src,
|
||
srcPos,
|
||
dest: new Uint32Array(dest.buffer),
|
||
width,
|
||
height: i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight
|
||
}));
|
||
ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);
|
||
}
|
||
} else {
|
||
throw new Error(`bad image kind: ${kind}`);
|
||
}
|
||
}
|
||
function putBinaryImageMask(ctx, imgData) {
|
||
if (imgData.bitmap) {
|
||
ctx.drawImage(imgData.bitmap, 0, 0);
|
||
return;
|
||
}
|
||
const {
|
||
width,
|
||
height
|
||
} = imgData;
|
||
const partialChunkHeight = height % FULL_CHUNK_HEIGHT;
|
||
const fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT;
|
||
const totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1;
|
||
const chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT);
|
||
let srcPos = 0;
|
||
const src = imgData.data;
|
||
const dest = chunkImgData.data;
|
||
for (let i = 0; i < totalChunks; i++) {
|
||
({
|
||
srcPos
|
||
} = convertBlackAndWhiteToRGBA({
|
||
src,
|
||
srcPos,
|
||
dest,
|
||
width,
|
||
height: i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight,
|
||
nonBlackColor: 0
|
||
}));
|
||
ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT);
|
||
}
|
||
}
|
||
function copyCtxState(sourceCtx, destCtx) {
|
||
const properties = ["strokeStyle", "fillStyle", "fillRule", "globalAlpha", "lineWidth", "lineCap", "lineJoin", "miterLimit", "globalCompositeOperation", "font", "filter"];
|
||
for (const property of properties) {
|
||
if (sourceCtx[property] !== undefined) {
|
||
destCtx[property] = sourceCtx[property];
|
||
}
|
||
}
|
||
if (sourceCtx.setLineDash !== undefined) {
|
||
destCtx.setLineDash(sourceCtx.getLineDash());
|
||
destCtx.lineDashOffset = sourceCtx.lineDashOffset;
|
||
}
|
||
}
|
||
function setAnnotationCanvasName(canvas, canvasName) {
|
||
canvas.setAttribute?.("data-canvas-name", canvasName);
|
||
canvas._pdfjsCanvasName = canvasName;
|
||
}
|
||
function getAnnotationCanvasName(canvas) {
|
||
return canvas._pdfjsCanvasName ?? null;
|
||
}
|
||
function resetCtxToDefault(ctx) {
|
||
ctx.strokeStyle = ctx.fillStyle = "#000000";
|
||
ctx.fillRule = "nonzero";
|
||
ctx.globalAlpha = 1;
|
||
ctx.lineWidth = 1;
|
||
ctx.lineCap = "butt";
|
||
ctx.lineJoin = "miter";
|
||
ctx.miterLimit = 10;
|
||
ctx.globalCompositeOperation = "source-over";
|
||
ctx.font = "10px sans-serif";
|
||
if (ctx.setLineDash !== undefined) {
|
||
ctx.setLineDash([]);
|
||
ctx.lineDashOffset = 0;
|
||
}
|
||
const {
|
||
filter
|
||
} = ctx;
|
||
if (filter !== "none" && filter !== "") {
|
||
ctx.filter = "none";
|
||
}
|
||
}
|
||
class TransferMapsFallback {
|
||
#maps;
|
||
constructor(maps) {
|
||
const [mapR, mapG = mapR, mapB = mapR] = maps;
|
||
const identityMap = Util.identity0to256Map.slice();
|
||
this.#maps = [mapR || identityMap, mapG || identityMap, mapB || identityMap];
|
||
}
|
||
applyToColor(color) {
|
||
if (typeof color !== "string" || !color.startsWith("#")) {
|
||
return color;
|
||
}
|
||
const [r, g, b] = getRGBA(color);
|
||
const [mapR, mapG, mapB] = this.#maps;
|
||
return Util.makeHexColor(mapR[r], mapG[g], mapB[b]);
|
||
}
|
||
applyToImageData({
|
||
data
|
||
}) {
|
||
const [mapR, mapG, mapB] = this.#maps;
|
||
for (let i = 0, ii = data.length; i < ii; i += 4) {
|
||
data[i] = mapR[data[i]];
|
||
data[i + 1] = mapG[data[i + 1]];
|
||
data[i + 2] = mapB[data[i + 2]];
|
||
}
|
||
}
|
||
applyToCanvas(ctx) {
|
||
const {
|
||
width,
|
||
height
|
||
} = ctx.canvas;
|
||
const imgData = ctx.getImageData(0, 0, width, height);
|
||
this.applyToImageData(imgData);
|
||
ctx.putImageData(imgData, 0, 0);
|
||
}
|
||
}
|
||
function getImageSmoothingEnabled(transform, interpolate, pixelRatio) {
|
||
if (interpolate) {
|
||
return true;
|
||
}
|
||
Util.singularValueDecompose2dScale(transform, XY);
|
||
const actualScale = Math.fround(pixelRatio * PixelsPerInch.PDF_TO_CSS_UNITS);
|
||
return XY[0] <= actualScale && XY[1] <= actualScale;
|
||
}
|
||
const LINE_CAP_STYLES = ["butt", "round", "square"];
|
||
const LINE_JOIN_STYLES = ["miter", "round", "bevel"];
|
||
const NORMAL_CLIP = {};
|
||
const EO_CLIP = {};
|
||
class CanvasGraphics {
|
||
static #SCALE_MATRIX = null;
|
||
static #pathCaches = new WeakMap();
|
||
#knockoutGroupLevel = 0;
|
||
#knockoutElementDepth = 0;
|
||
#knockoutTempCanvasEntry = null;
|
||
#knockoutSavedCtx = null;
|
||
#knockoutSavedSMaskCtx = null;
|
||
#knockoutSavedGCO = null;
|
||
#knockoutElementAlpha = 1;
|
||
#knockoutFilterCache;
|
||
#knockoutElementGroupMeta = null;
|
||
#groupStackMeta = [];
|
||
constructor(canvasCtx, commonObjs, objs, canvasFactory, filterFactory, {
|
||
optionalContentConfig,
|
||
markedContentStack = null,
|
||
pixelRatio = OutputScale.pixelRatio
|
||
}, annotationCanvasMap, pageColors, dependencyTracker, imagesTracker) {
|
||
this.ctx = canvasCtx;
|
||
this.current = new CanvasExtraState(this.ctx.canvas.width, this.ctx.canvas.height);
|
||
this.stateStack = [];
|
||
this.pendingClip = null;
|
||
this.pendingEOFill = false;
|
||
this.commonObjs = commonObjs;
|
||
this.objs = objs;
|
||
this.canvasFactory = canvasFactory;
|
||
this.filterFactory = filterFactory;
|
||
this.groupStack = [];
|
||
this.baseTransform = null;
|
||
this.baseTransformStack = [];
|
||
this.groupLevel = 0;
|
||
this.smaskStack = [];
|
||
this.tempSMask = null;
|
||
this.smaskGroupCanvases = [];
|
||
this.smaskPreparedEntry = null;
|
||
this.smaskPreparedFor = null;
|
||
this.smaskPreparedOffsetX = 0;
|
||
this.smaskPreparedOffsetY = 0;
|
||
this.smaskPreparedOOBAlpha = null;
|
||
this.suspendedCtx = null;
|
||
this.contentVisible = true;
|
||
this.markedContentStack = markedContentStack || [];
|
||
this.optionalContentConfig = optionalContentConfig;
|
||
this.pixelRatio = pixelRatio;
|
||
this.cachedPatterns = new Map();
|
||
this.annotationCanvasMap = annotationCanvasMap;
|
||
this.viewportScale = 1;
|
||
this.outputScaleX = 1;
|
||
this.outputScaleY = 1;
|
||
this.pageColors = pageColors;
|
||
this._cachedScaleForStroking = [-1, 0];
|
||
this._cachedBitmapsMap = new Map();
|
||
this.dependencyTracker = dependencyTracker ?? null;
|
||
this.imagesTracker = imagesTracker ?? null;
|
||
}
|
||
getObject(opIdx, data, fallback = null) {
|
||
if (typeof data === "string") {
|
||
this.dependencyTracker?.recordNamedDependency(opIdx, data);
|
||
return data.startsWith("g_") ? this.commonObjs.get(data) : this.objs.get(data);
|
||
}
|
||
return fallback;
|
||
}
|
||
beginDrawing({
|
||
transform,
|
||
viewport,
|
||
transparency = false,
|
||
background = null
|
||
}) {
|
||
const width = this.ctx.canvas.width;
|
||
const height = this.ctx.canvas.height;
|
||
const savedFillStyle = this.ctx.fillStyle;
|
||
this.ctx.fillStyle = background || "#ffffff";
|
||
this.ctx.fillRect(0, 0, width, height);
|
||
this.ctx.fillStyle = savedFillStyle;
|
||
if (transparency) {
|
||
const transparentCanvas = this.transparentCanvasEntry = this.canvasFactory.create(width, height);
|
||
this.compositeCtx = this.ctx;
|
||
({
|
||
canvas: this.transparentCanvas,
|
||
context: this.ctx
|
||
} = transparentCanvas);
|
||
this.ctx.save();
|
||
this.ctx.transform(...getCurrentTransform(this.compositeCtx));
|
||
}
|
||
this.ctx.save();
|
||
resetCtxToDefault(this.ctx);
|
||
if (transform) {
|
||
this.ctx.transform(...transform);
|
||
this.outputScaleX = transform[0];
|
||
this.outputScaleY = transform[3];
|
||
}
|
||
this.ctx.transform(...viewport.transform);
|
||
this.viewportScale = viewport.scale;
|
||
this.baseTransform = getCurrentTransform(this.ctx);
|
||
}
|
||
executeOperatorList(operatorList, executionStartIdx, continueCallback, errorCallback, stepper, operationsFilter) {
|
||
const argsArray = operatorList.argsArray;
|
||
const fnArray = operatorList.fnArray;
|
||
const prevPathCache = this._pathCache;
|
||
this._pathCache = operatorList.pathCache ?? CanvasGraphics.#pathCaches.getOrInsertComputed(operatorList, makeMap);
|
||
try {
|
||
let i = executionStartIdx || 0;
|
||
const argsArrayLen = argsArray.length;
|
||
if (argsArrayLen === i) {
|
||
return i;
|
||
}
|
||
const chunkOperations = argsArrayLen - i > EXECUTION_STEPS && typeof continueCallback === "function";
|
||
const endTime = chunkOperations ? Date.now() + EXECUTION_TIME : 0;
|
||
let steps = 0;
|
||
const commonObjs = this.commonObjs;
|
||
const objs = this.objs;
|
||
let fnId, fnArgs;
|
||
while (true) {
|
||
if (stepper !== undefined) {
|
||
if (i === stepper.nextBreakPoint) {
|
||
stepper.breakIt(i, continueCallback);
|
||
return i;
|
||
}
|
||
if (stepper.shouldSkip(i)) {
|
||
if (++i === argsArrayLen) {
|
||
return i;
|
||
}
|
||
continue;
|
||
}
|
||
}
|
||
if (!operationsFilter || operationsFilter(i, operatorList)) {
|
||
fnId = fnArray[i];
|
||
fnArgs = argsArray[i] ?? null;
|
||
if (fnId !== OPS.dependency) {
|
||
if (fnArgs === null) {
|
||
this[fnId](i);
|
||
} else {
|
||
this[fnId](i, ...fnArgs);
|
||
}
|
||
} else {
|
||
for (const depObjId of fnArgs) {
|
||
this.dependencyTracker?.recordNamedData(depObjId, i);
|
||
const objsPool = depObjId.startsWith("g_") ? commonObjs : objs;
|
||
if (!objsPool.has(depObjId)) {
|
||
objsPool.get(depObjId, continueCallback, errorCallback);
|
||
return i;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
i++;
|
||
if (i === argsArrayLen) {
|
||
return i;
|
||
}
|
||
if (chunkOperations && ++steps > EXECUTION_STEPS) {
|
||
if (Date.now() > endTime) {
|
||
continueCallback();
|
||
return i;
|
||
}
|
||
steps = 0;
|
||
}
|
||
}
|
||
} finally {
|
||
this._pathCache = prevPathCache;
|
||
}
|
||
}
|
||
#restoreInitialState() {
|
||
while (this.stateStack.length || this.inSMaskMode) {
|
||
this.restore();
|
||
}
|
||
this.current.activeSMask = null;
|
||
this.ctx.restore();
|
||
if (this.transparentCanvas) {
|
||
this.ctx = this.compositeCtx;
|
||
this.ctx.save();
|
||
this.ctx.setTransform(1, 0, 0, 1, 0, 0);
|
||
this.ctx.drawImage(this.transparentCanvas, 0, 0);
|
||
this.ctx.restore();
|
||
this.canvasFactory.destroy(this.transparentCanvasEntry);
|
||
this.transparentCanvas = null;
|
||
this.transparentCanvasEntry = null;
|
||
}
|
||
}
|
||
endDrawing() {
|
||
this.#restoreInitialState();
|
||
for (const canvas of this.smaskGroupCanvases) {
|
||
this.canvasFactory.destroy(canvas);
|
||
}
|
||
this.smaskGroupCanvases.length = 0;
|
||
this._clearPreparedSMask();
|
||
this.tempSMask = null;
|
||
this.smaskStack.length = 0;
|
||
for (const meta of this.#groupStackMeta) {
|
||
this.#destroyKnockoutPools(meta);
|
||
}
|
||
this.#groupStackMeta.length = 0;
|
||
this.#knockoutTempCanvasEntry = null;
|
||
this.#knockoutSavedCtx = null;
|
||
this.#knockoutSavedSMaskCtx = null;
|
||
this.#knockoutSavedGCO = null;
|
||
this.#knockoutElementAlpha = 1;
|
||
this.#knockoutElementGroupMeta = null;
|
||
this.#knockoutElementDepth = 0;
|
||
this.#knockoutGroupLevel = 0;
|
||
this.cachedPatterns.clear();
|
||
for (const cache of this._cachedBitmapsMap.values()) {
|
||
for (const canvas of cache.values()) {
|
||
if (typeof HTMLCanvasElement !== "undefined" && canvas instanceof HTMLCanvasElement) {
|
||
canvas.width = canvas.height = 0;
|
||
}
|
||
}
|
||
cache.clear();
|
||
}
|
||
this._cachedBitmapsMap.clear();
|
||
this.#drawFilter();
|
||
}
|
||
#drawFilter() {
|
||
if (this.pageColors) {
|
||
const hcmFilterId = this.filterFactory.addHCMFilter(this.pageColors.foreground, this.pageColors.background);
|
||
if (hcmFilterId !== "none") {
|
||
const savedFilter = this.ctx.filter;
|
||
this.ctx.filter = hcmFilterId;
|
||
this.ctx.drawImage(this.ctx.canvas, 0, 0);
|
||
this.ctx.filter = savedFilter;
|
||
}
|
||
}
|
||
}
|
||
_scaleImage(img, inverseTransform) {
|
||
const width = img.width ?? img.displayWidth;
|
||
const height = img.height ?? img.displayHeight;
|
||
const widthScale = Math.max(Math.hypot(inverseTransform[0], inverseTransform[1]), 1);
|
||
const heightScale = Math.max(Math.hypot(inverseTransform[2], inverseTransform[3]), 1);
|
||
const scaleSteps = [];
|
||
let ws = widthScale,
|
||
hs = heightScale,
|
||
pw = width,
|
||
ph = height;
|
||
while (ws > 2 && pw > 1 || hs > 2 && ph > 1) {
|
||
let nw = pw,
|
||
nh = ph;
|
||
if (ws > 2 && pw > 1) {
|
||
nw = Math.ceil(pw / 2);
|
||
ws /= pw / nw;
|
||
}
|
||
if (hs > 2 && ph > 1) {
|
||
nh = Math.ceil(ph / 2);
|
||
hs /= ph / nh;
|
||
}
|
||
scaleSteps.push({
|
||
newWidth: nw,
|
||
newHeight: nh
|
||
});
|
||
pw = nw;
|
||
ph = nh;
|
||
}
|
||
if (scaleSteps.length === 0) {
|
||
return {
|
||
img,
|
||
paintWidth: width,
|
||
paintHeight: height,
|
||
tmpCanvas: null
|
||
};
|
||
}
|
||
if (scaleSteps.length === 1) {
|
||
const {
|
||
newWidth,
|
||
newHeight
|
||
} = scaleSteps[0];
|
||
const tmpCanvas = this.canvasFactory.create(newWidth, newHeight);
|
||
tmpCanvas.context.drawImage(img, 0, 0, width, height, 0, 0, newWidth, newHeight);
|
||
return {
|
||
img: tmpCanvas.canvas,
|
||
paintWidth: newWidth,
|
||
paintHeight: newHeight,
|
||
tmpCanvas
|
||
};
|
||
}
|
||
let readEntry = this.canvasFactory.create(1, 1);
|
||
let writeEntry = this.canvasFactory.create(1, 1);
|
||
let paintWidth = width,
|
||
paintHeight = height;
|
||
let source = img;
|
||
for (const {
|
||
newWidth,
|
||
newHeight
|
||
} of scaleSteps) {
|
||
this.canvasFactory.reset(writeEntry, newWidth, newHeight);
|
||
writeEntry.context.drawImage(source, 0, 0, paintWidth, paintHeight, 0, 0, newWidth, newHeight);
|
||
[readEntry, writeEntry] = [writeEntry, readEntry];
|
||
source = readEntry.canvas;
|
||
paintWidth = newWidth;
|
||
paintHeight = newHeight;
|
||
}
|
||
this.canvasFactory.destroy(writeEntry);
|
||
return {
|
||
img: readEntry.canvas,
|
||
paintWidth,
|
||
paintHeight,
|
||
tmpCanvas: readEntry
|
||
};
|
||
}
|
||
_createMaskCanvas(opIdx, img) {
|
||
const ctx = this.ctx;
|
||
const {
|
||
width,
|
||
height
|
||
} = img;
|
||
const isPatternFill = this.current.patternFill;
|
||
const fillColor = isPatternFill ? this.current.fillColor : ctx.fillStyle;
|
||
const currentTransform = getCurrentTransform(ctx);
|
||
let cache, cacheKey, scaled, maskCanvas;
|
||
if ((img.bitmap || img.data) && img.count > 1) {
|
||
const mainKey = img.bitmap || img.data.buffer;
|
||
cacheKey = JSON.stringify(isPatternFill ? currentTransform : [currentTransform.slice(0, 4), fillColor]);
|
||
cache = this._cachedBitmapsMap.getOrInsertComputed(mainKey, makeMap);
|
||
const cachedImage = cache.get(cacheKey);
|
||
if (cachedImage && !isPatternFill) {
|
||
const offsetX = Math.round(Math.min(currentTransform[0], currentTransform[2]) + currentTransform[4]);
|
||
const offsetY = Math.round(Math.min(currentTransform[1], currentTransform[3]) + currentTransform[5]);
|
||
this.dependencyTracker?.recordDependencies(opIdx, Dependencies.transformAndFill);
|
||
return {
|
||
canvas: cachedImage,
|
||
offsetX,
|
||
offsetY
|
||
};
|
||
}
|
||
scaled = cachedImage;
|
||
}
|
||
if (!scaled) {
|
||
maskCanvas = this.canvasFactory.create(width, height);
|
||
putBinaryImageMask(maskCanvas.context, img);
|
||
}
|
||
let maskToCanvas = Util.transform(currentTransform, [1 / width, 0, 0, -1 / height, 0, 0]);
|
||
maskToCanvas = Util.transform(maskToCanvas, [1, 0, 0, 1, 0, -height]);
|
||
const minMax = F32_BBOX_INIT.slice();
|
||
Util.axialAlignedBoundingBox([0, 0, width, height], maskToCanvas, minMax);
|
||
const [minX, minY, maxX, maxY] = minMax;
|
||
const drawnWidth = Math.round(maxX - minX) || 1;
|
||
const drawnHeight = Math.round(maxY - minY) || 1;
|
||
const fillCanvas = this.canvasFactory.create(drawnWidth, drawnHeight);
|
||
const fillCtx = fillCanvas.context;
|
||
const offsetX = minX;
|
||
const offsetY = minY;
|
||
fillCtx.translate(-offsetX, -offsetY);
|
||
fillCtx.transform(...maskToCanvas);
|
||
let scaledEntry = null;
|
||
if (!scaled) {
|
||
const scaleResult = this._scaleImage(maskCanvas.canvas, getCurrentTransformInverse(fillCtx));
|
||
scaled = scaleResult.img;
|
||
scaledEntry = scaleResult.tmpCanvas;
|
||
if (scaled !== maskCanvas.canvas) {
|
||
this.canvasFactory.destroy(maskCanvas);
|
||
maskCanvas = null;
|
||
}
|
||
if (cache && isPatternFill) {
|
||
cache.set(cacheKey, scaled);
|
||
scaledEntry = null;
|
||
maskCanvas = null;
|
||
}
|
||
}
|
||
fillCtx.imageSmoothingEnabled = getImageSmoothingEnabled(getCurrentTransform(fillCtx), img.interpolate, this.pixelRatio);
|
||
drawImageAtIntegerCoords(fillCtx, scaled, 0, 0, scaled.width, scaled.height, 0, 0, width, height);
|
||
if (scaledEntry) {
|
||
this.canvasFactory.destroy(scaledEntry);
|
||
}
|
||
if (maskCanvas) {
|
||
this.canvasFactory.destroy(maskCanvas);
|
||
}
|
||
fillCtx.globalCompositeOperation = "source-in";
|
||
const inverse = Util.transform(getCurrentTransformInverse(fillCtx), [1, 0, 0, 1, -offsetX, -offsetY]);
|
||
fillCtx.fillStyle = isPatternFill ? fillColor.getPattern(ctx, this, inverse, PathType.FILL, opIdx) : fillColor;
|
||
fillCtx.fillRect(0, 0, width, height);
|
||
if (cache && !isPatternFill) {
|
||
cache.set(cacheKey, fillCanvas.canvas);
|
||
}
|
||
this.dependencyTracker?.recordDependencies(opIdx, Dependencies.transformAndFill);
|
||
return {
|
||
canvas: fillCanvas.canvas,
|
||
canvasEntry: cache && !isPatternFill ? null : fillCanvas,
|
||
offsetX: Math.round(offsetX),
|
||
offsetY: Math.round(offsetY)
|
||
};
|
||
}
|
||
setLineWidth(opIdx, width) {
|
||
this.dependencyTracker?.recordSimpleData("lineWidth", opIdx);
|
||
if (width !== this.current.lineWidth) {
|
||
this._cachedScaleForStroking[0] = -1;
|
||
}
|
||
this.current.lineWidth = width;
|
||
this.ctx.lineWidth = width;
|
||
}
|
||
setLineCap(opIdx, style) {
|
||
this.dependencyTracker?.recordSimpleData("lineCap", opIdx);
|
||
this.ctx.lineCap = LINE_CAP_STYLES[style];
|
||
}
|
||
setLineJoin(opIdx, style) {
|
||
this.dependencyTracker?.recordSimpleData("lineJoin", opIdx);
|
||
this.ctx.lineJoin = LINE_JOIN_STYLES[style];
|
||
}
|
||
setMiterLimit(opIdx, limit) {
|
||
this.dependencyTracker?.recordSimpleData("miterLimit", opIdx);
|
||
this.ctx.miterLimit = limit;
|
||
}
|
||
setDash(opIdx, dashArray, dashPhase) {
|
||
this.dependencyTracker?.recordSimpleData("dash", opIdx);
|
||
const ctx = this.ctx;
|
||
if (ctx.setLineDash !== undefined) {
|
||
ctx.setLineDash(dashArray);
|
||
ctx.lineDashOffset = dashPhase;
|
||
}
|
||
}
|
||
setRenderingIntent(opIdx, intent) {}
|
||
setFlatness(opIdx, flatness) {}
|
||
setGState(opIdx, states) {
|
||
for (const [key, value] of states) {
|
||
switch (key) {
|
||
case "LW":
|
||
this.setLineWidth(opIdx, value);
|
||
break;
|
||
case "LC":
|
||
this.setLineCap(opIdx, value);
|
||
break;
|
||
case "LJ":
|
||
this.setLineJoin(opIdx, value);
|
||
break;
|
||
case "ML":
|
||
this.setMiterLimit(opIdx, value);
|
||
break;
|
||
case "D":
|
||
this.setDash(opIdx, value[0], value[1]);
|
||
break;
|
||
case "RI":
|
||
this.setRenderingIntent(opIdx, value);
|
||
break;
|
||
case "FL":
|
||
this.setFlatness(opIdx, value);
|
||
break;
|
||
case "Font":
|
||
this.setFont(opIdx, value[0], value[1]);
|
||
break;
|
||
case "CA":
|
||
this.dependencyTracker?.recordSimpleData("strokeAlpha", opIdx);
|
||
this.current.strokeAlpha = value;
|
||
break;
|
||
case "ca":
|
||
this.dependencyTracker?.recordSimpleData("fillAlpha", opIdx);
|
||
this.ctx.globalAlpha = this.current.fillAlpha = value;
|
||
break;
|
||
case "BM":
|
||
this.dependencyTracker?.recordSimpleData("globalCompositeOperation", opIdx);
|
||
this.ctx.globalCompositeOperation = value;
|
||
break;
|
||
case "SMask":
|
||
this.dependencyTracker?.recordSimpleData("SMask", opIdx);
|
||
this.current.activeSMask = value ? this.tempSMask : null;
|
||
if (this.current.activeSMask) {
|
||
this.current.activeSMask.blendMode = this.ctx.globalCompositeOperation;
|
||
}
|
||
this.tempSMask = null;
|
||
this.checkSMaskState(opIdx);
|
||
break;
|
||
case "TR":
|
||
{
|
||
this.dependencyTracker?.recordSimpleData("filter", opIdx);
|
||
let filter = this.filterFactory.addFilter(value);
|
||
this.ctx.filter = filter;
|
||
let fallback = null;
|
||
if (value && (filter === "none" || !FeatureTest.isCanvasFilterSupported || this.ctx.filter === "none" || this.ctx.filter === "")) {
|
||
this.ctx.filter = filter = "none";
|
||
fallback = new TransferMapsFallback(value);
|
||
}
|
||
this.current.transferMaps = filter;
|
||
if (fallback || this.current.transferMapsFallback) {
|
||
this.current.transferMapsFallback = fallback;
|
||
if (!this.current.patternFill) {
|
||
this.ctx.fillStyle = this.#transferColor(this.current.fillColor);
|
||
}
|
||
if (!this.current.patternStroke) {
|
||
this.ctx.strokeStyle = this.#transferColor(this.current.strokeColor);
|
||
}
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
get inSMaskMode() {
|
||
return !!this.suspendedCtx;
|
||
}
|
||
_clearPreparedSMask() {
|
||
if (this.smaskPreparedEntry) {
|
||
this.canvasFactory.destroy(this.smaskPreparedEntry);
|
||
this.smaskPreparedEntry = null;
|
||
}
|
||
this.smaskPreparedFor = null;
|
||
this.smaskPreparedOffsetX = 0;
|
||
this.smaskPreparedOffsetY = 0;
|
||
this.smaskPreparedOOBAlpha = null;
|
||
}
|
||
_ensurePreparedSMask(smask) {
|
||
if (smask === this.smaskPreparedFor) {
|
||
return;
|
||
}
|
||
this._clearPreparedSMask();
|
||
this._prepareSMaskCanvas(smask);
|
||
}
|
||
checkSMaskState(opIdx) {
|
||
const inSMaskMode = this.inSMaskMode;
|
||
if (this.current.activeSMask && !inSMaskMode) {
|
||
this.beginSMaskMode(opIdx);
|
||
} else if (!this.current.activeSMask && inSMaskMode) {
|
||
this.endSMaskMode();
|
||
} else if (this.current.activeSMask && inSMaskMode) {
|
||
this._ensurePreparedSMask(this.current.activeSMask);
|
||
}
|
||
}
|
||
_prepareSMaskCanvas(smask) {
|
||
const {
|
||
canvas: maskCanvas,
|
||
subtype,
|
||
backdrop,
|
||
transferMap
|
||
} = smask;
|
||
const hasFilter = subtype === "Luminosity" || subtype === "Alpha" && transferMap;
|
||
if (!hasFilter && !(subtype === "Luminosity" && backdrop)) {
|
||
this.smaskPreparedFor = smask;
|
||
return;
|
||
}
|
||
let filteredOOBAlpha;
|
||
if (subtype === "Luminosity" && backdrop) {
|
||
const [r, g, b] = getRGBA(backdrop);
|
||
const inputAlpha = Math.round(0.3 * r + 0.59 * g + 0.11 * b);
|
||
filteredOOBAlpha = transferMap?.[inputAlpha] ?? inputAlpha;
|
||
} else {
|
||
filteredOOBAlpha = transferMap?.[0] ?? 0;
|
||
}
|
||
const SMASK_LAYER_TO_MASK_AREA_RATIO = 4;
|
||
const {
|
||
width: layerW,
|
||
height: layerH
|
||
} = this.ctx.canvas;
|
||
const maskArea = maskCanvas.width * maskCanvas.height;
|
||
const useLayerSize = layerW * layerH < SMASK_LAYER_TO_MASK_AREA_RATIO * maskArea;
|
||
const filterSpec = hasFilter ? {
|
||
url: subtype === "Alpha" ? this.filterFactory.addAlphaFilter(transferMap) : this.filterFactory.addLuminosityFilter(transferMap),
|
||
subtype,
|
||
transferMap
|
||
} : null;
|
||
const bakedBackdrop = subtype === "Luminosity" ? backdrop : null;
|
||
let preparedEntry, offsetX, offsetY;
|
||
if (useLayerSize) {
|
||
preparedEntry = this._bakeSMaskCanvas(maskCanvas, smask.offsetX, smask.offsetY, layerW, layerH, bakedBackdrop, filterSpec);
|
||
offsetX = 0;
|
||
offsetY = 0;
|
||
} else {
|
||
preparedEntry = this._bakeSMaskCanvas(maskCanvas, 0, 0, maskCanvas.width, maskCanvas.height, bakedBackdrop, filterSpec);
|
||
offsetX = smask.offsetX;
|
||
offsetY = smask.offsetY;
|
||
}
|
||
this.smaskPreparedEntry = preparedEntry;
|
||
this.smaskPreparedFor = smask;
|
||
this.smaskPreparedOffsetX = offsetX;
|
||
this.smaskPreparedOffsetY = offsetY;
|
||
this.smaskPreparedOOBAlpha = !useLayerSize && filteredOOBAlpha !== 0 ? filteredOOBAlpha : null;
|
||
}
|
||
_bakeSMaskCanvas(maskCanvas, drawX, drawY, w, h, backdrop, filterSpec) {
|
||
if (!backdrop && !filterSpec) {
|
||
unreachable("_bakeSMaskCanvas with neither backdrop nor filter");
|
||
}
|
||
const srcEntry = this.canvasFactory.create(w, h);
|
||
const sCtx = srcEntry.context;
|
||
sCtx.drawImage(maskCanvas, drawX, drawY);
|
||
if (backdrop) {
|
||
sCtx.globalCompositeOperation = "destination-atop";
|
||
sCtx.fillStyle = backdrop;
|
||
sCtx.fillRect(0, 0, w, h);
|
||
}
|
||
if (!filterSpec) {
|
||
return srcEntry;
|
||
}
|
||
const preparedEntry = this.canvasFactory.create(w, h);
|
||
const pCtx = preparedEntry.context;
|
||
pCtx.filter = filterSpec.url;
|
||
const filterApplied = FeatureTest.isCanvasFilterSupported && pCtx.filter !== "none" && pCtx.filter !== "";
|
||
pCtx.drawImage(srcEntry.canvas, 0, 0);
|
||
if (FeatureTest.isCanvasFilterSupported) {
|
||
pCtx.filter = "none";
|
||
}
|
||
if (!filterApplied) {
|
||
const img = pCtx.getImageData(0, 0, w, h);
|
||
const {
|
||
data
|
||
} = img;
|
||
const {
|
||
transferMap
|
||
} = filterSpec;
|
||
if (filterSpec.subtype === "Luminosity") {
|
||
for (let i = 0, ii = data.length; i < ii; i += 4) {
|
||
const a = 0.3 * data[i] + 0.59 * data[i + 1] + 0.11 * data[i + 2] + 0.5 | 0;
|
||
data[i] = data[i + 1] = data[i + 2] = 0;
|
||
data[i + 3] = transferMap?.[a] ?? a;
|
||
}
|
||
} else {
|
||
for (let i = 3, ii = data.length; i < ii; i += 4) {
|
||
data[i] = transferMap[data[i]];
|
||
}
|
||
}
|
||
pCtx.putImageData(img, 0, 0);
|
||
}
|
||
this.canvasFactory.destroy(srcEntry);
|
||
return preparedEntry;
|
||
}
|
||
beginSMaskMode(opIdx) {
|
||
if (this.inSMaskMode) {
|
||
throw new Error("beginSMaskMode called while already in smask mode");
|
||
}
|
||
const {
|
||
width: drawnWidth,
|
||
height: drawnHeight
|
||
} = this.ctx.canvas;
|
||
const scratchCanvas = this.canvasFactory.create(drawnWidth, drawnHeight);
|
||
this.smaskScratchCanvas = scratchCanvas;
|
||
this.suspendedCtx = this.ctx;
|
||
const ctx = this.ctx = scratchCanvas.context;
|
||
ctx.setTransform(this.suspendedCtx.getTransform());
|
||
copyCtxState(this.suspendedCtx, ctx);
|
||
mirrorContextOperations(ctx, this.suspendedCtx);
|
||
this._ensurePreparedSMask(this.current.activeSMask);
|
||
this.setGState(opIdx, [["BM", "source-over"]]);
|
||
}
|
||
endSMaskMode() {
|
||
if (!this.inSMaskMode) {
|
||
throw new Error("endSMaskMode called while not in smask mode");
|
||
}
|
||
this.ctx._removeMirroring();
|
||
copyCtxState(this.ctx, this.suspendedCtx);
|
||
this.ctx = this.suspendedCtx;
|
||
this.suspendedCtx = null;
|
||
this.canvasFactory.destroy(this.smaskScratchCanvas);
|
||
this.smaskScratchCanvas = null;
|
||
this._clearPreparedSMask();
|
||
}
|
||
#createKnockoutMaskCanvas(sourceCanvas, reuseEntry = null, alpha = 1) {
|
||
const {
|
||
width,
|
||
height
|
||
} = sourceCanvas;
|
||
const maskEntry = reuseEntry ?? this.canvasFactory.create(width, height);
|
||
const maskCtx = maskEntry.context;
|
||
alpha = Math.round(alpha * 255) / 255;
|
||
const needsAlphaScaling = alpha < 1;
|
||
if (needsAlphaScaling && this.#knockoutFilterCache === undefined) {
|
||
this.#knockoutFilterCache = FeatureTest.isCanvasFilterSupported ? new Map() : "none";
|
||
}
|
||
let knockoutFilter = "none";
|
||
if (needsAlphaScaling && this.#knockoutFilterCache instanceof Map) {
|
||
knockoutFilter = this.#knockoutFilterCache.getOrInsertComputed(alpha, () => this.filterFactory.addKnockoutFilter(alpha));
|
||
}
|
||
if (!needsAlphaScaling || knockoutFilter !== "none") {
|
||
if (reuseEntry) {
|
||
maskCtx.save();
|
||
maskCtx.setTransform(1, 0, 0, 1, 0, 0);
|
||
maskCtx.clearRect(0, 0, width, height);
|
||
maskCtx.restore();
|
||
}
|
||
maskCtx.filter = knockoutFilter;
|
||
maskCtx.drawImage(sourceCanvas, 0, 0);
|
||
maskCtx.filter = "none";
|
||
return maskEntry;
|
||
}
|
||
const sourceData = sourceCanvas.getContext("2d", {
|
||
willReadFrequently: true
|
||
}).getImageData(0, 0, width, height);
|
||
const maskData = maskCtx.createImageData(width, height);
|
||
const sourcePixels = sourceData.data,
|
||
maskPixels = maskData.data;
|
||
const alphaScale = alpha > 0 ? 1 / alpha : 1e6;
|
||
for (let i = 3, ii = sourcePixels.length; i < ii; i += 4) {
|
||
maskPixels[i] = Math.min(Math.round(sourcePixels[i] * alphaScale), 255);
|
||
}
|
||
maskCtx.putImageData(maskData, 0, 0);
|
||
return maskEntry;
|
||
}
|
||
#getOrCreatePooledEntry(meta, key, width, height) {
|
||
let entry = meta?.[key] ?? null;
|
||
if (entry && (entry.canvas.width !== width || entry.canvas.height !== height)) {
|
||
this.canvasFactory.destroy(entry);
|
||
entry = null;
|
||
}
|
||
if (!entry) {
|
||
entry = this.canvasFactory.create(width, height);
|
||
if (meta) {
|
||
meta[key] = entry;
|
||
}
|
||
return entry;
|
||
}
|
||
const ctx = entry.context;
|
||
ctx.save();
|
||
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
||
ctx.clearRect(0, 0, width, height);
|
||
ctx.restore();
|
||
return entry;
|
||
}
|
||
#compositeKnockoutSurface(destCtx, surfaceCanvas, options = {}) {
|
||
const {
|
||
backdropCanvas = null,
|
||
destTransform = [1, 0, 0, 1, 0, 0],
|
||
backdropOffset = [0, 0],
|
||
reuseMaskEntry = null,
|
||
poolMeta = null,
|
||
sourceAlpha = 1,
|
||
sourceFilter = "none",
|
||
knockoutAlpha = 1
|
||
} = options;
|
||
const {
|
||
width,
|
||
height
|
||
} = surfaceCanvas;
|
||
const knockoutMaskEntry = this.#createKnockoutMaskCanvas(surfaceCanvas, reuseMaskEntry, knockoutAlpha);
|
||
const sourceCompositeOperation = destCtx.globalCompositeOperation;
|
||
destCtx.save();
|
||
destCtx.setTransform(...destTransform);
|
||
destCtx.globalAlpha = 1;
|
||
if (FeatureTest.isCanvasFilterSupported) {
|
||
destCtx.filter = "none";
|
||
}
|
||
destCtx.globalCompositeOperation = "destination-out";
|
||
destCtx.drawImage(knockoutMaskEntry.canvas, 0, 0);
|
||
if (backdropCanvas) {
|
||
const [bx, by] = backdropOffset;
|
||
const backdropEntry = this.#getOrCreatePooledEntry(poolMeta, "knockoutBackdropEntry", width, height);
|
||
const backdropCtx = backdropEntry.context;
|
||
backdropCtx.drawImage(backdropCanvas, bx, by, width, height, 0, 0, width, height);
|
||
backdropCtx.globalCompositeOperation = "destination-in";
|
||
backdropCtx.drawImage(knockoutMaskEntry.canvas, 0, 0);
|
||
backdropCtx.globalCompositeOperation = "source-over";
|
||
destCtx.globalCompositeOperation = "destination-over";
|
||
destCtx.drawImage(backdropEntry.canvas, 0, 0);
|
||
if (!poolMeta) {
|
||
this.canvasFactory.destroy(backdropEntry);
|
||
}
|
||
}
|
||
destCtx.globalCompositeOperation = sourceCompositeOperation;
|
||
destCtx.globalAlpha = sourceAlpha;
|
||
if (FeatureTest.isCanvasFilterSupported) {
|
||
destCtx.filter = sourceFilter ?? "none";
|
||
}
|
||
destCtx.drawImage(surfaceCanvas, 0, 0);
|
||
destCtx.restore();
|
||
if (!reuseMaskEntry) {
|
||
this.canvasFactory.destroy(knockoutMaskEntry);
|
||
}
|
||
}
|
||
#beginKnockoutElement(alpha = 1) {
|
||
if (this.#knockoutGroupLevel === 0 || this.#knockoutElementDepth > 0 || !this.contentVisible) {
|
||
return false;
|
||
}
|
||
this.#knockoutElementDepth++;
|
||
this.#knockoutElementAlpha = alpha;
|
||
const groupMeta = this.#groupStackMeta.at(-1);
|
||
const {
|
||
canvas
|
||
} = this.ctx;
|
||
const tempEntry = this.#getOrCreatePooledEntry(groupMeta, "knockoutTempEntry", canvas.width, canvas.height);
|
||
this.#knockoutTempCanvasEntry = tempEntry;
|
||
const tempCtx = tempEntry.context;
|
||
tempCtx.save();
|
||
tempCtx.setTransform(this.ctx.getTransform());
|
||
copyCtxState(this.ctx, tempCtx);
|
||
this.#knockoutSavedGCO = tempCtx.globalCompositeOperation;
|
||
tempCtx.globalCompositeOperation = "source-over";
|
||
mirrorContextOperations(tempCtx, this.ctx);
|
||
this.#knockoutElementGroupMeta = groupMeta;
|
||
this.#knockoutSavedCtx = this.ctx;
|
||
this.#knockoutSavedSMaskCtx = this.suspendedCtx;
|
||
this.ctx = tempCtx;
|
||
if (this.inSMaskMode) {
|
||
this.suspendedCtx = tempCtx;
|
||
}
|
||
return true;
|
||
}
|
||
#endKnockoutElement(started) {
|
||
if (!started) {
|
||
return;
|
||
}
|
||
const tempEntry = this.#knockoutTempCanvasEntry;
|
||
const savedCtx = this.#knockoutSavedCtx;
|
||
const savedSMaskCtx = this.#knockoutSavedSMaskCtx;
|
||
const tempCtx = tempEntry.context;
|
||
this.#knockoutTempCanvasEntry = null;
|
||
this.#knockoutSavedCtx = null;
|
||
this.#knockoutSavedSMaskCtx = null;
|
||
if (this.inSMaskMode && this.suspendedCtx === tempCtx && this.ctx !== tempCtx) {
|
||
this.endSMaskMode();
|
||
}
|
||
if (this.inSMaskMode) {
|
||
this.suspendedCtx = savedSMaskCtx;
|
||
}
|
||
this.ctx._removeMirroring();
|
||
this.ctx.globalCompositeOperation = this.#knockoutSavedGCO;
|
||
this.#knockoutSavedGCO = null;
|
||
copyCtxState(this.ctx, savedCtx);
|
||
this.ctx = savedCtx;
|
||
const groupMeta = this.#knockoutElementGroupMeta;
|
||
this.#knockoutElementGroupMeta = null;
|
||
const knockoutAlpha = this.#knockoutElementAlpha;
|
||
this.#knockoutElementAlpha = 1;
|
||
try {
|
||
this.#compositeKnockoutSurface(savedSMaskCtx ?? savedCtx, tempEntry.canvas, {
|
||
backdropCanvas: groupMeta?.backdropCtx?.canvas ?? null,
|
||
backdropOffset: groupMeta?.backdropCtx ? [groupMeta.offsetX, groupMeta.offsetY] : [0, 0],
|
||
reuseMaskEntry: groupMeta?.knockoutMaskEntry ?? null,
|
||
poolMeta: groupMeta,
|
||
knockoutAlpha
|
||
});
|
||
} finally {
|
||
tempCtx.restore();
|
||
this.#knockoutElementDepth--;
|
||
if (!groupMeta) {
|
||
this.canvasFactory.destroy(tempEntry);
|
||
}
|
||
}
|
||
}
|
||
compose(dirtyBox) {
|
||
if (!this.current.activeSMask) {
|
||
return;
|
||
}
|
||
dirtyBox = dirtyBox ? [Math.floor(dirtyBox[0]), Math.floor(dirtyBox[1]), Math.ceil(dirtyBox[2]), Math.ceil(dirtyBox[3])] : [0, 0, this.ctx.canvas.width, this.ctx.canvas.height];
|
||
const smask = this.current.activeSMask;
|
||
const suspendedCtx = this.suspendedCtx;
|
||
const applySMaskInPlace = this.#knockoutElementDepth > 0 && suspendedCtx === this.ctx;
|
||
this.composeSMask(applySMaskInPlace ? null : suspendedCtx, smask, this.ctx, dirtyBox);
|
||
if (applySMaskInPlace) {
|
||
return;
|
||
}
|
||
this.ctx.save();
|
||
this.ctx.setTransform(1, 0, 0, 1, 0, 0);
|
||
this.ctx.clearRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height);
|
||
this.ctx.restore();
|
||
}
|
||
composeSMask(ctx, smask, layerCtx, layerBox) {
|
||
const layerOffsetX = layerBox[0];
|
||
const layerOffsetY = layerBox[1];
|
||
const layerWidth = layerBox[2] - layerOffsetX;
|
||
const layerHeight = layerBox[3] - layerOffsetY;
|
||
if (layerWidth === 0 || layerHeight === 0) {
|
||
return;
|
||
}
|
||
const preparedEntry = this.smaskPreparedEntry;
|
||
if (preparedEntry) {
|
||
let clipX = layerOffsetX;
|
||
let clipY = layerOffsetY;
|
||
let clipW = layerWidth;
|
||
let clipH = layerHeight;
|
||
const oobAlpha = this.smaskPreparedOOBAlpha;
|
||
const hasOOBAlpha = oobAlpha !== null;
|
||
if (hasOOBAlpha) {
|
||
clipX = Math.max(layerOffsetX, smask.offsetX);
|
||
clipY = Math.max(layerOffsetY, smask.offsetY);
|
||
const x1 = Math.min(layerOffsetX + layerWidth, smask.offsetX + smask.canvas.width);
|
||
const y1 = Math.min(layerOffsetY + layerHeight, smask.offsetY + smask.canvas.height);
|
||
clipW = x1 - clipX;
|
||
clipH = y1 - clipY;
|
||
}
|
||
if (clipW > 0 && clipH > 0) {
|
||
const srcX = clipX - this.smaskPreparedOffsetX;
|
||
const srcY = clipY - this.smaskPreparedOffsetY;
|
||
layerCtx.save();
|
||
layerCtx.globalAlpha = 1;
|
||
layerCtx.setTransform(1, 0, 0, 1, 0, 0);
|
||
const clip = new Path2D();
|
||
clip.rect(clipX, clipY, clipW, clipH);
|
||
layerCtx.clip(clip);
|
||
layerCtx.globalCompositeOperation = "destination-in";
|
||
layerCtx.drawImage(preparedEntry.canvas, srcX, srcY, clipW, clipH, clipX, clipY, clipW, clipH);
|
||
layerCtx.restore();
|
||
}
|
||
if (hasOOBAlpha && oobAlpha < 255) {
|
||
this._applySMaskOOBAlpha(layerCtx, layerOffsetX, layerOffsetY, layerWidth, layerHeight, clipX, clipY, clipX + clipW, clipY + clipH, oobAlpha);
|
||
}
|
||
} else {
|
||
this.genericComposeSMask(smask, layerCtx, layerWidth, layerHeight, layerOffsetX, layerOffsetY);
|
||
}
|
||
if (!ctx) {
|
||
return;
|
||
}
|
||
ctx.save();
|
||
ctx.globalAlpha = 1;
|
||
ctx.globalCompositeOperation = smask.blendMode || "source-over";
|
||
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
||
ctx.drawImage(layerCtx.canvas, layerOffsetX, layerOffsetY, layerWidth, layerHeight, layerOffsetX, layerOffsetY, layerWidth, layerHeight);
|
||
ctx.restore();
|
||
}
|
||
_applySMaskOOBAlpha(layerCtx, layerOffsetX, layerOffsetY, layerWidth, layerHeight, maskX0, maskY0, maskX1, maskY1, alpha) {
|
||
const hasInnerCutout = maskX0 < maskX1 && maskY0 < maskY1;
|
||
if (hasInnerCutout && maskX0 === layerOffsetX && maskY0 === layerOffsetY && maskX1 === layerOffsetX + layerWidth && maskY1 === layerOffsetY + layerHeight) {
|
||
return;
|
||
}
|
||
const path = new Path2D();
|
||
path.rect(layerOffsetX, layerOffsetY, layerWidth, layerHeight);
|
||
if (hasInnerCutout) {
|
||
path.rect(maskX0, maskY0, maskX1 - maskX0, maskY1 - maskY0);
|
||
}
|
||
layerCtx.save();
|
||
layerCtx.globalAlpha = alpha / 255;
|
||
layerCtx.setTransform(1, 0, 0, 1, 0, 0);
|
||
layerCtx.clip(path, "evenodd");
|
||
layerCtx.globalCompositeOperation = "destination-in";
|
||
layerCtx.fillStyle = "#000000";
|
||
layerCtx.fillRect(layerOffsetX, layerOffsetY, layerWidth, layerHeight);
|
||
layerCtx.restore();
|
||
}
|
||
genericComposeSMask(smask, layerCtx, width, height, layerOffsetX, layerOffsetY) {
|
||
const {
|
||
context: maskCtx,
|
||
offsetX: maskOffsetX,
|
||
offsetY: maskOffsetY
|
||
} = smask;
|
||
layerCtx.save();
|
||
layerCtx.globalAlpha = 1;
|
||
layerCtx.setTransform(1, 0, 0, 1, 0, 0);
|
||
const clip = new Path2D();
|
||
clip.rect(layerOffsetX, layerOffsetY, width, height);
|
||
layerCtx.clip(clip);
|
||
layerCtx.globalCompositeOperation = "destination-in";
|
||
layerCtx.drawImage(maskCtx.canvas, layerOffsetX - maskOffsetX, layerOffsetY - maskOffsetY, width, height, layerOffsetX, layerOffsetY, width, height);
|
||
layerCtx.restore();
|
||
}
|
||
save(opIdx) {
|
||
if (this.inSMaskMode) {
|
||
copyCtxState(this.ctx, this.suspendedCtx);
|
||
}
|
||
this.ctx.save();
|
||
const old = this.current;
|
||
this.stateStack.push(old);
|
||
this.current = old.clone();
|
||
this.dependencyTracker?.save(opIdx);
|
||
}
|
||
restore(opIdx) {
|
||
this.dependencyTracker?.restore(opIdx);
|
||
if (this.stateStack.length === 0) {
|
||
if (this.inSMaskMode) {
|
||
this.endSMaskMode();
|
||
}
|
||
return;
|
||
}
|
||
this.current = this.stateStack.pop();
|
||
this.ctx.restore();
|
||
if (this.inSMaskMode) {
|
||
copyCtxState(this.suspendedCtx, this.ctx);
|
||
this.ctx.setTransform(this.suspendedCtx.getTransform());
|
||
}
|
||
this.checkSMaskState(opIdx);
|
||
this.pendingClip = null;
|
||
this._cachedScaleForStroking[0] = -1;
|
||
}
|
||
resetGraphicsState() {
|
||
const {
|
||
clipBox,
|
||
transferMaps,
|
||
transferMapsFallback
|
||
} = this.current;
|
||
const current = this.current = new CanvasExtraState(0, 0);
|
||
current.clipBox = clipBox;
|
||
current.transferMaps = transferMaps;
|
||
current.transferMapsFallback = transferMapsFallback;
|
||
const ctx = this.ctx;
|
||
ctx.lineWidth = 1;
|
||
ctx.lineCap = "butt";
|
||
ctx.lineJoin = "miter";
|
||
ctx.miterLimit = 10;
|
||
if (ctx.setLineDash !== undefined) {
|
||
ctx.setLineDash([]);
|
||
ctx.lineDashOffset = 0;
|
||
}
|
||
this._cachedScaleForStroking[0] = -1;
|
||
}
|
||
transform(opIdx, a, b, c, d, e, f) {
|
||
this.dependencyTracker?.recordIncrementalData("transform", opIdx);
|
||
this.ctx.transform(a, b, c, d, e, f);
|
||
this._cachedScaleForStroking[0] = -1;
|
||
}
|
||
constructPath(opIdx, op, data, minMax) {
|
||
let path = this._pathCache.get(opIdx);
|
||
if (!minMax) {
|
||
if (!path) {
|
||
path = new Path2D();
|
||
this._pathCache.set(opIdx, path);
|
||
}
|
||
if (op !== OPS.stroke && op !== OPS.closeStroke) {
|
||
this.current.tilingPatternDims = null;
|
||
}
|
||
this[op](opIdx, path);
|
||
return;
|
||
}
|
||
if (this.dependencyTracker !== null) {
|
||
const outerExtraSize = op === OPS.stroke ? this.current.lineWidth / 2 : 0;
|
||
this.dependencyTracker.resetBBox(opIdx).recordBBox(opIdx, this.ctx, minMax[0] - outerExtraSize, minMax[2] + outerExtraSize, minMax[1] - outerExtraSize, minMax[3] + outerExtraSize).recordDependencies(opIdx, ["transform"]);
|
||
}
|
||
if (!path) {
|
||
path = makePathFromDrawOPS(data[0]);
|
||
this._pathCache.set(opIdx, path);
|
||
}
|
||
Util.axialAlignedBoundingBox(minMax, getCurrentTransform(this.ctx), this.current.minMax);
|
||
const tilingDims = this.current.tilingPatternDims;
|
||
if (tilingDims && op !== OPS.stroke && op !== OPS.closeStroke && this.current.fillColor instanceof TilingPattern) {
|
||
const clippedBBox = Util.intersect(this.current.clipBox, this.current.minMax);
|
||
if (!clippedBBox) {
|
||
this.current.tilingPatternDims = null;
|
||
} else {
|
||
this.current.fillColor.updatePatternDims(clippedBBox, tilingDims);
|
||
}
|
||
}
|
||
this[op](opIdx, path);
|
||
this._pathStartIdx = opIdx;
|
||
}
|
||
closePath(opIdx) {
|
||
this.ctx.closePath();
|
||
}
|
||
stroke(opIdx, path, consumePath = true) {
|
||
const started = consumePath && this.#beginKnockoutElement(this.current.strokeAlpha);
|
||
const ctx = this.ctx;
|
||
const strokeColor = this.current.strokeColor;
|
||
ctx.globalAlpha = this.current.strokeAlpha;
|
||
if (this.contentVisible) {
|
||
if (typeof strokeColor === "object" && strokeColor?.getPattern) {
|
||
const baseTransform = strokeColor.isModifyingCurrentTransform() ? ctx.getTransform() : null;
|
||
ctx.save();
|
||
ctx.strokeStyle = strokeColor.getPattern(ctx, this, getCurrentTransformInverse(ctx), PathType.STROKE, opIdx);
|
||
if (baseTransform) {
|
||
const newPath = new Path2D();
|
||
newPath.addPath(path, ctx.getTransform().invertSelf().multiplySelf(baseTransform));
|
||
path = newPath;
|
||
}
|
||
this.rescaleAndStroke(path, false);
|
||
ctx.restore();
|
||
} else {
|
||
this.rescaleAndStroke(path, true);
|
||
}
|
||
}
|
||
this.dependencyTracker?.recordDependencies(opIdx, Dependencies.stroke);
|
||
if (consumePath) {
|
||
this.consumePath(opIdx, path, this.current.getClippedPathBoundingBox(PathType.STROKE, getCurrentTransform(this.ctx)));
|
||
}
|
||
ctx.globalAlpha = this.current.fillAlpha;
|
||
this.#endKnockoutElement(started);
|
||
}
|
||
closeStroke(opIdx, path) {
|
||
this.stroke(opIdx, path);
|
||
}
|
||
fill(opIdx, path, consumePath = true) {
|
||
const started = consumePath && this.#beginKnockoutElement(this.current.fillAlpha);
|
||
const ctx = this.ctx;
|
||
const fillColor = this.current.fillColor;
|
||
const isPatternFill = this.current.patternFill;
|
||
let needRestore = false;
|
||
const intersect = this.current.getClippedPathBoundingBox();
|
||
this.dependencyTracker?.recordDependencies(opIdx, Dependencies.fill);
|
||
if (isPatternFill) {
|
||
const dims = this.current.tilingPatternDims;
|
||
const tileIdx = dims && fillColor.canSkipPatternCanvas(dims);
|
||
if (tileIdx) {
|
||
const {
|
||
pendingClip,
|
||
pendingEOFill
|
||
} = this;
|
||
this.pendingClip = null;
|
||
this.pendingEOFill = false;
|
||
fillColor.drawPattern(this, path, pendingEOFill, tileIdx, opIdx);
|
||
this.pendingClip = pendingClip;
|
||
if (consumePath) {
|
||
this.consumePath(opIdx, path, intersect);
|
||
}
|
||
this.current.tilingPatternDims = null;
|
||
this.#endKnockoutElement(started);
|
||
return;
|
||
}
|
||
const baseTransform = fillColor.isModifyingCurrentTransform() ? ctx.getTransform() : null;
|
||
this.dependencyTracker?.save(opIdx);
|
||
ctx.save();
|
||
ctx.fillStyle = fillColor.getPattern(ctx, this, getCurrentTransformInverse(ctx), PathType.FILL, opIdx);
|
||
if (baseTransform) {
|
||
const newPath = new Path2D();
|
||
newPath.addPath(path, ctx.getTransform().invertSelf().multiplySelf(baseTransform));
|
||
path = newPath;
|
||
}
|
||
needRestore = true;
|
||
}
|
||
if (this.contentVisible && intersect !== null) {
|
||
if (this.pendingEOFill) {
|
||
ctx.fill(path, "evenodd");
|
||
this.pendingEOFill = false;
|
||
} else {
|
||
ctx.fill(path);
|
||
}
|
||
}
|
||
if (needRestore) {
|
||
ctx.restore();
|
||
this.dependencyTracker?.restore(opIdx);
|
||
}
|
||
if (consumePath) {
|
||
this.consumePath(opIdx, path, intersect);
|
||
}
|
||
this.#endKnockoutElement(started);
|
||
}
|
||
eoFill(opIdx, path) {
|
||
this.pendingEOFill = true;
|
||
this.fill(opIdx, path);
|
||
}
|
||
fillStroke(opIdx, path) {
|
||
const started = this.#beginKnockoutElement(Math.min(this.current.fillAlpha, this.current.strokeAlpha));
|
||
this.fill(opIdx, path, false);
|
||
this.stroke(opIdx, path, false);
|
||
this.consumePath(opIdx, path);
|
||
this.#endKnockoutElement(started);
|
||
}
|
||
eoFillStroke(opIdx, path) {
|
||
this.pendingEOFill = true;
|
||
this.fillStroke(opIdx, path);
|
||
}
|
||
closeFillStroke(opIdx, path) {
|
||
this.fillStroke(opIdx, path);
|
||
}
|
||
closeEOFillStroke(opIdx, path) {
|
||
this.pendingEOFill = true;
|
||
this.fillStroke(opIdx, path);
|
||
}
|
||
endPath(opIdx, path) {
|
||
this.consumePath(opIdx, path);
|
||
}
|
||
rawFillPath(opIdx, path) {
|
||
const started = this.#beginKnockoutElement(this.current.fillAlpha);
|
||
this.ctx.fill(path);
|
||
this.dependencyTracker?.recordDependencies(opIdx, Dependencies.rawFillPath).recordOperation(opIdx);
|
||
this.#endKnockoutElement(started);
|
||
}
|
||
clip(opIdx) {
|
||
this.dependencyTracker?.recordFutureForcedDependency("clipMode", opIdx);
|
||
this.pendingClip = NORMAL_CLIP;
|
||
}
|
||
eoClip(opIdx) {
|
||
this.dependencyTracker?.recordFutureForcedDependency("clipMode", opIdx);
|
||
this.pendingClip = EO_CLIP;
|
||
}
|
||
beginText(opIdx) {
|
||
this.current.textMatrix = null;
|
||
this.current.textMatrixScale = 1;
|
||
this.current.x = this.current.lineX = 0;
|
||
this.current.y = this.current.lineY = 0;
|
||
this.dependencyTracker?.recordOpenMarker(opIdx).resetIncrementalData("sameLineText").resetIncrementalData("moveText", opIdx);
|
||
}
|
||
endText(opIdx) {
|
||
const paths = this.pendingTextPaths;
|
||
const ctx = this.ctx;
|
||
if (this.dependencyTracker) {
|
||
const {
|
||
dependencyTracker
|
||
} = this;
|
||
if (paths !== undefined) {
|
||
dependencyTracker.recordFutureForcedDependency("textClip", dependencyTracker.getOpenMarker()).recordFutureForcedDependency("textClip", opIdx);
|
||
}
|
||
dependencyTracker.recordCloseMarker(opIdx);
|
||
}
|
||
if (paths !== undefined) {
|
||
const newPath = new Path2D();
|
||
const invTransf = ctx.getTransform().invertSelf();
|
||
for (const {
|
||
transform,
|
||
x,
|
||
y,
|
||
fontSize,
|
||
path
|
||
} of paths) {
|
||
if (!path) {
|
||
continue;
|
||
}
|
||
newPath.addPath(path, new DOMMatrix(transform).preMultiplySelf(invTransf).translate(x, y).scale(fontSize, -fontSize));
|
||
}
|
||
ctx.clip(newPath);
|
||
}
|
||
delete this.pendingTextPaths;
|
||
}
|
||
setCharSpacing(opIdx, spacing) {
|
||
this.dependencyTracker?.recordSimpleData("charSpacing", opIdx);
|
||
this.current.charSpacing = spacing;
|
||
}
|
||
setWordSpacing(opIdx, spacing) {
|
||
this.dependencyTracker?.recordSimpleData("wordSpacing", opIdx);
|
||
this.current.wordSpacing = spacing;
|
||
}
|
||
setHScale(opIdx, scale) {
|
||
this.dependencyTracker?.recordSimpleData("hScale", opIdx);
|
||
this.current.textHScale = scale / 100;
|
||
}
|
||
setLeading(opIdx, leading) {
|
||
this.dependencyTracker?.recordSimpleData("leading", opIdx);
|
||
this.current.leading = -leading;
|
||
}
|
||
setFont(opIdx, fontRefName, size) {
|
||
this.dependencyTracker?.recordSimpleData("font", opIdx).recordSimpleDataFromNamed("fontObj", fontRefName, opIdx);
|
||
const fontObj = this.commonObjs.get(fontRefName);
|
||
const current = this.current;
|
||
if (!fontObj) {
|
||
throw new Error(`Can't find font for ${fontRefName}`);
|
||
}
|
||
current.fontMatrix = fontObj.fontMatrix || FONT_IDENTITY_MATRIX;
|
||
if (current.fontMatrix[0] === 0 || current.fontMatrix[3] === 0) {
|
||
warn("Invalid font matrix for font " + fontRefName);
|
||
}
|
||
if (size < 0) {
|
||
size = -size;
|
||
current.fontDirection = -1;
|
||
} else {
|
||
current.fontDirection = 1;
|
||
}
|
||
this.current.font = fontObj;
|
||
this.current.fontSize = size;
|
||
if (fontObj.isType3Font) {
|
||
return;
|
||
}
|
||
const name = fontObj.loadedName || "sans-serif";
|
||
const typeface = fontObj.systemFontInfo?.css || `"${name}", ${fontObj.fallbackName}`;
|
||
let bold = "normal";
|
||
if (fontObj.black) {
|
||
bold = "900";
|
||
} else if (fontObj.bold) {
|
||
bold = "bold";
|
||
}
|
||
const italic = fontObj.italic ? "italic" : "normal";
|
||
const browserFontSize = math_clamp_MathClamp(size, MIN_FONT_SIZE, MAX_FONT_SIZE);
|
||
this.current.fontSizeScale = size / browserFontSize;
|
||
this.ctx.font = `${italic} ${bold} ${browserFontSize}px ${typeface}`;
|
||
}
|
||
setTextRenderingMode(opIdx, mode) {
|
||
this.dependencyTracker?.recordSimpleData("textRenderingMode", opIdx);
|
||
this.current.textRenderingMode = mode;
|
||
}
|
||
setTextRise(opIdx, rise) {
|
||
this.dependencyTracker?.recordSimpleData("textRise", opIdx);
|
||
this.current.textRise = rise;
|
||
}
|
||
moveText(opIdx, x, y) {
|
||
this.dependencyTracker?.resetIncrementalData("sameLineText").recordIncrementalData("moveText", opIdx);
|
||
this.current.x = this.current.lineX += x;
|
||
this.current.y = this.current.lineY += y;
|
||
}
|
||
setLeadingMoveText(opIdx, x, y) {
|
||
this.setLeading(opIdx, -y);
|
||
this.moveText(opIdx, x, y);
|
||
}
|
||
setTextMatrix(opIdx, matrix) {
|
||
this.dependencyTracker?.resetIncrementalData("sameLineText").recordSimpleData("textMatrix", opIdx);
|
||
const {
|
||
current
|
||
} = this;
|
||
current.textMatrix = matrix;
|
||
current.textMatrixScale = Math.hypot(matrix[0], matrix[1]);
|
||
current.x = current.lineX = 0;
|
||
current.y = current.lineY = 0;
|
||
}
|
||
nextLine(opIdx) {
|
||
this.moveText(opIdx, 0, this.current.leading);
|
||
this.dependencyTracker?.recordIncrementalData("moveText", this.dependencyTracker.getSimpleIndex("leading") ?? opIdx);
|
||
}
|
||
#getScaledPath(path, currentTransform, transform) {
|
||
const newPath = new Path2D();
|
||
newPath.addPath(path, new DOMMatrix(transform).invertSelf().multiplySelf(currentTransform));
|
||
return newPath;
|
||
}
|
||
paintChar(opIdx, character, x, y, patternFillTransform, patternStrokeTransform) {
|
||
const ctx = this.ctx;
|
||
const current = this.current;
|
||
const font = current.font;
|
||
const textRenderingMode = current.textRenderingMode;
|
||
const fontSize = current.fontSize / current.fontSizeScale;
|
||
const fillStrokeMode = textRenderingMode & TextRenderingMode.FILL_STROKE_MASK;
|
||
const isAddToPathSet = !!(textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG);
|
||
const patternFill = current.patternFill && !font.missingFile;
|
||
const patternStroke = current.patternStroke && !font.missingFile;
|
||
let path;
|
||
if ((font.disableFontFace || isAddToPathSet || patternFill || patternStroke) && !font.missingFile) {
|
||
path = font.getPathGenerator(this.commonObjs, character);
|
||
}
|
||
if (path && (font.disableFontFace || patternFill || patternStroke)) {
|
||
ctx.save();
|
||
ctx.translate(x, y);
|
||
ctx.scale(fontSize, -fontSize);
|
||
this.dependencyTracker?.recordCharacterBBox(opIdx, ctx, font);
|
||
let currentTransform;
|
||
if (fillStrokeMode === TextRenderingMode.FILL || fillStrokeMode === TextRenderingMode.FILL_STROKE) {
|
||
if (patternFillTransform) {
|
||
currentTransform = ctx.getTransform();
|
||
ctx.setTransform(...patternFillTransform);
|
||
const scaledPath = this.#getScaledPath(path, currentTransform, patternFillTransform);
|
||
ctx.fill(scaledPath);
|
||
} else {
|
||
ctx.fill(path);
|
||
}
|
||
}
|
||
if (fillStrokeMode === TextRenderingMode.STROKE || fillStrokeMode === TextRenderingMode.FILL_STROKE) {
|
||
if (patternStrokeTransform) {
|
||
currentTransform ||= ctx.getTransform();
|
||
ctx.setTransform(...patternStrokeTransform);
|
||
const {
|
||
a,
|
||
b,
|
||
c,
|
||
d
|
||
} = currentTransform;
|
||
const invPatternTransform = Util.inverseTransform(patternStrokeTransform);
|
||
const transf = Util.transform([a, b, c, d, 0, 0], invPatternTransform);
|
||
Util.singularValueDecompose2dScale(transf, XY);
|
||
ctx.lineWidth *= Math.max(XY[0], XY[1]) / fontSize;
|
||
ctx.stroke(this.#getScaledPath(path, currentTransform, patternStrokeTransform));
|
||
} else {
|
||
ctx.lineWidth /= fontSize;
|
||
ctx.stroke(path);
|
||
}
|
||
}
|
||
ctx.restore();
|
||
} else {
|
||
if (fillStrokeMode === TextRenderingMode.FILL || fillStrokeMode === TextRenderingMode.FILL_STROKE) {
|
||
ctx.fillText(character, x, y);
|
||
this.dependencyTracker?.recordCharacterBBox(opIdx, ctx, font, fontSize, x, y, () => ctx.measureText(character));
|
||
}
|
||
if (fillStrokeMode === TextRenderingMode.STROKE || fillStrokeMode === TextRenderingMode.FILL_STROKE) {
|
||
if (this.dependencyTracker) {
|
||
this.dependencyTracker?.recordCharacterBBox(opIdx, ctx, font, fontSize, x, y, () => ctx.measureText(character)).recordDependencies(opIdx, Dependencies.stroke);
|
||
}
|
||
ctx.strokeText(character, x, y);
|
||
}
|
||
}
|
||
if (isAddToPathSet) {
|
||
const paths = this.pendingTextPaths ||= [];
|
||
paths.push({
|
||
transform: getCurrentTransform(ctx),
|
||
x,
|
||
y,
|
||
fontSize,
|
||
path
|
||
});
|
||
this.dependencyTracker?.recordCharacterBBox(opIdx, ctx, font, fontSize, x, y);
|
||
}
|
||
}
|
||
get isFontSubpixelAAEnabled() {
|
||
const tmpCanvas = this.canvasFactory.create(10, 10);
|
||
const ctx = tmpCanvas.context;
|
||
ctx.scale(1.5, 1);
|
||
ctx.fillText("I", 0, 10);
|
||
const data = ctx.getImageData(0, 0, 10, 10).data;
|
||
this.canvasFactory.destroy(tmpCanvas);
|
||
let enabled = false;
|
||
for (let i = 3; i < data.length; i += 4) {
|
||
if (data[i] > 0 && data[i] < 255) {
|
||
enabled = true;
|
||
break;
|
||
}
|
||
}
|
||
return util_shadow(this, "isFontSubpixelAAEnabled", enabled);
|
||
}
|
||
#getTextPattern(color, pathType, opIdx) {
|
||
const ctx = this.ctx;
|
||
ctx.save();
|
||
const pattern = color.getPattern(ctx, this, getCurrentTransformInverse(ctx), pathType, opIdx);
|
||
const transform = getCurrentTransform(ctx);
|
||
ctx.restore();
|
||
return [pattern, transform];
|
||
}
|
||
showText(opIdx, glyphs) {
|
||
if (this.dependencyTracker) {
|
||
this.dependencyTracker.recordDependencies(opIdx, Dependencies.showText).resetBBox(opIdx);
|
||
if (this.current.textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG) {
|
||
this.dependencyTracker.recordFutureForcedDependency("textClip", opIdx).inheritPendingDependenciesAsFutureForcedDependencies();
|
||
}
|
||
}
|
||
const current = this.current;
|
||
const font = current.font;
|
||
if (font.isType3Font) {
|
||
const started = this.#beginKnockoutElement(current.fillAlpha);
|
||
this.showType3Text(opIdx, glyphs);
|
||
this.dependencyTracker?.recordShowTextOperation(opIdx);
|
||
this.#endKnockoutElement(started);
|
||
return;
|
||
}
|
||
const fontSize = current.fontSize;
|
||
if (fontSize === 0) {
|
||
this.dependencyTracker?.recordOperation(opIdx);
|
||
return;
|
||
}
|
||
const started = this.#beginKnockoutElement(current.fillAlpha);
|
||
const ctx = this.ctx;
|
||
const fontSizeScale = current.fontSizeScale;
|
||
const charSpacing = current.charSpacing;
|
||
const wordSpacing = current.wordSpacing;
|
||
const fontDirection = current.fontDirection;
|
||
const textHScale = current.textHScale * fontDirection;
|
||
const glyphsLength = glyphs.length;
|
||
const vertical = font.vertical;
|
||
const spacingDir = vertical ? 1 : -1;
|
||
const widthAdvanceScale = fontSize * current.fontMatrix[0];
|
||
const simpleFillText = current.textRenderingMode === TextRenderingMode.FILL && !font.disableFontFace && !current.patternFill;
|
||
ctx.save();
|
||
if (current.textMatrix) {
|
||
ctx.transform(...current.textMatrix);
|
||
}
|
||
ctx.translate(current.x, current.y + current.textRise);
|
||
if (fontDirection > 0) {
|
||
ctx.scale(textHScale, -1);
|
||
} else {
|
||
ctx.scale(textHScale, 1);
|
||
}
|
||
let patternFillTransform, patternStrokeTransform;
|
||
const fillStrokeMode = current.textRenderingMode & TextRenderingMode.FILL_STROKE_MASK;
|
||
const needsFill = fillStrokeMode === TextRenderingMode.FILL || fillStrokeMode === TextRenderingMode.FILL_STROKE;
|
||
const needsStroke = fillStrokeMode === TextRenderingMode.STROKE || fillStrokeMode === TextRenderingMode.FILL_STROKE;
|
||
let lineWidth = current.lineWidth;
|
||
const scale = current.textMatrixScale;
|
||
if (scale === 0 || lineWidth === 0) {
|
||
if (needsStroke) {
|
||
lineWidth = this.getSinglePixelWidth();
|
||
}
|
||
} else {
|
||
lineWidth /= scale;
|
||
}
|
||
if (fontSizeScale !== 1.0) {
|
||
ctx.scale(fontSizeScale, fontSizeScale);
|
||
lineWidth /= fontSizeScale;
|
||
}
|
||
ctx.lineWidth = lineWidth;
|
||
if (needsFill && current.patternFill) {
|
||
[ctx.fillStyle, patternFillTransform] = this.#getTextPattern(current.fillColor, PathType.FILL, opIdx);
|
||
}
|
||
if (needsStroke && current.patternStroke) {
|
||
[ctx.strokeStyle, patternStrokeTransform] = this.#getTextPattern(current.strokeColor, PathType.STROKE, opIdx);
|
||
}
|
||
if (font.isInvalidPDFjsFont) {
|
||
const chars = [];
|
||
let width = 0;
|
||
for (const glyph of glyphs) {
|
||
chars.push(glyph.unicode);
|
||
width += glyph.width;
|
||
}
|
||
const joinedChars = chars.join("");
|
||
ctx.fillText(joinedChars, 0, 0);
|
||
if (this.dependencyTracker !== null) {
|
||
const measure = ctx.measureText(joinedChars);
|
||
this.dependencyTracker.recordBBox(opIdx, this.ctx, -measure.actualBoundingBoxLeft, measure.actualBoundingBoxRight, -measure.actualBoundingBoxAscent, measure.actualBoundingBoxDescent).recordShowTextOperation(opIdx);
|
||
}
|
||
current.x += width * widthAdvanceScale * textHScale;
|
||
ctx.restore();
|
||
this.compose();
|
||
this.#endKnockoutElement(started);
|
||
return;
|
||
}
|
||
let x = 0,
|
||
i,
|
||
glyphPatterns = null;
|
||
for (i = 0; i < glyphsLength; ++i) {
|
||
const glyph = glyphs[i];
|
||
if (typeof glyph === "number") {
|
||
x += spacingDir * glyph * fontSize / 1000;
|
||
continue;
|
||
}
|
||
let restoreNeeded = false;
|
||
const spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;
|
||
const character = glyph.fontChar;
|
||
const accent = glyph.accent;
|
||
let scaledX, scaledY, measure;
|
||
let width = glyph.width;
|
||
if (vertical) {
|
||
const vmetric = glyph.vmetric;
|
||
const vx = -vmetric[1] * widthAdvanceScale;
|
||
const vy = vmetric[2] * widthAdvanceScale;
|
||
width = -vmetric[0];
|
||
scaledX = vx / fontSizeScale;
|
||
scaledY = (x + vy) / fontSizeScale;
|
||
if (glyph.isRotated) {
|
||
measure = ctx.measureText(character);
|
||
const glyphScale = widthAdvanceScale / fontSizeScale;
|
||
const halfWidth = glyph.width / 2 * glyphScale;
|
||
const centerX = scaledX + halfWidth;
|
||
scaledX = scaledY - ((/* inlined export .DEFAULT_VERTICAL_ORIGIN_Y */880) - (/* inlined export .DEFAULT_VERTICAL_ADVANCE */1000) / 2) * glyphScale - halfWidth;
|
||
scaledY = (measure.actualBoundingBoxAscent - measure.actualBoundingBoxDescent) / 2 - centerX;
|
||
restoreNeeded = true;
|
||
ctx.save();
|
||
ctx.rotate(Math.PI / 2);
|
||
}
|
||
} else {
|
||
scaledX = x / fontSizeScale;
|
||
scaledY = 0;
|
||
}
|
||
const glyphWidth = glyph.isRotated ? glyph.width : width;
|
||
let characterScaleX = 1;
|
||
if ((font.remeasure || glyph.isRotated) && glyphWidth > 0) {
|
||
measure ??= ctx.measureText(character);
|
||
const measuredWidth = measure.width * 1000 / fontSize * fontSizeScale;
|
||
if (glyphWidth < measuredWidth && this.isFontSubpixelAAEnabled) {
|
||
characterScaleX = glyphWidth / measuredWidth;
|
||
if (!restoreNeeded) {
|
||
restoreNeeded = true;
|
||
ctx.save();
|
||
}
|
||
ctx.scale(characterScaleX, 1);
|
||
scaledX /= characterScaleX;
|
||
} else if (glyphWidth !== measuredWidth) {
|
||
scaledX += (glyphWidth - measuredWidth) / 2000 * fontSize / fontSizeScale;
|
||
}
|
||
}
|
||
if (restoreNeeded && font.missingFile && (patternFillTransform || patternStrokeTransform)) {
|
||
glyphPatterns ||= new Map();
|
||
[ctx.fillStyle, ctx.strokeStyle] = glyphPatterns.getOrInsertComputed(glyph.isRotated ? -characterScaleX : characterScaleX, () => [patternFillTransform ? this.#getTextPattern(current.fillColor, PathType.FILL, opIdx)[0] : ctx.fillStyle, patternStrokeTransform ? this.#getTextPattern(current.strokeColor, PathType.STROKE, opIdx)[0] : ctx.strokeStyle]);
|
||
}
|
||
if (this.contentVisible && (glyph.isInFont || font.missingFile)) {
|
||
if (simpleFillText && !accent) {
|
||
ctx.fillText(character, scaledX, scaledY);
|
||
this.dependencyTracker?.recordCharacterBBox(opIdx, ctx, measure ? {
|
||
bbox: null
|
||
} : font, fontSize / fontSizeScale, scaledX, scaledY, () => measure ?? ctx.measureText(character));
|
||
} else {
|
||
this.paintChar(opIdx, character, scaledX, scaledY, patternFillTransform, patternStrokeTransform);
|
||
if (accent) {
|
||
const scaledAccentX = scaledX + fontSize * accent.offset.x / fontSizeScale;
|
||
const scaledAccentY = scaledY - fontSize * accent.offset.y / fontSizeScale;
|
||
this.paintChar(opIdx, accent.fontChar, scaledAccentX, scaledAccentY, patternFillTransform, patternStrokeTransform);
|
||
}
|
||
}
|
||
}
|
||
const charWidth = vertical ? width * widthAdvanceScale - spacing * fontDirection : width * widthAdvanceScale + spacing * fontDirection;
|
||
x += charWidth;
|
||
if (restoreNeeded) {
|
||
ctx.restore();
|
||
}
|
||
}
|
||
if (vertical) {
|
||
current.y -= x;
|
||
} else {
|
||
current.x += x * textHScale;
|
||
}
|
||
ctx.restore();
|
||
this.compose();
|
||
this.dependencyTracker?.recordShowTextOperation(opIdx);
|
||
this.#endKnockoutElement(started);
|
||
}
|
||
showType3Text(opIdx, glyphs) {
|
||
const ctx = this.ctx;
|
||
const current = this.current;
|
||
const font = current.font;
|
||
const fontSize = current.fontSize;
|
||
const fontDirection = current.fontDirection;
|
||
const spacingDir = font.vertical ? 1 : -1;
|
||
const charSpacing = current.charSpacing;
|
||
const wordSpacing = current.wordSpacing;
|
||
const textHScale = current.textHScale * fontDirection;
|
||
const fontMatrix = current.fontMatrix || FONT_IDENTITY_MATRIX;
|
||
const glyphsLength = glyphs.length;
|
||
const isTextVisible = current.textRenderingMode !== TextRenderingMode.INVISIBLE;
|
||
let i, glyph, width, spacingLength;
|
||
if (fontSize === 0) {
|
||
return;
|
||
}
|
||
this._cachedScaleForStroking[0] = -1;
|
||
ctx.save();
|
||
if (current.textMatrix) {
|
||
ctx.transform(...current.textMatrix);
|
||
}
|
||
ctx.translate(current.x, current.y + current.textRise);
|
||
ctx.scale(textHScale, fontDirection);
|
||
const dependencyTracker = this.dependencyTracker;
|
||
this.dependencyTracker = dependencyTracker ? new CanvasNestedDependencyTracker(dependencyTracker, opIdx) : null;
|
||
try {
|
||
for (i = 0; i < glyphsLength; ++i) {
|
||
glyph = glyphs[i];
|
||
if (typeof glyph === "number") {
|
||
spacingLength = spacingDir * glyph * fontSize / 1000;
|
||
this.ctx.translate(spacingLength, 0);
|
||
current.x += spacingLength * textHScale;
|
||
continue;
|
||
}
|
||
const spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;
|
||
const operatorList = font.charProcOperatorList.get(glyph.operatorListId);
|
||
if (!operatorList) {
|
||
warn(`Type3 character "${glyph.operatorListId}" is not available.`);
|
||
} else if (this.contentVisible && isTextVisible) {
|
||
this.save();
|
||
ctx.scale(fontSize, fontSize);
|
||
ctx.transform(...fontMatrix);
|
||
this.executeOperatorList(operatorList);
|
||
this.restore();
|
||
}
|
||
width = glyph.width * fontMatrix[0] * fontSize + spacing * fontDirection;
|
||
ctx.translate(width, 0);
|
||
current.x += width * textHScale;
|
||
}
|
||
} finally {
|
||
if (dependencyTracker) {
|
||
this.dependencyTracker = dependencyTracker;
|
||
}
|
||
}
|
||
ctx.restore();
|
||
}
|
||
setCharWidth(opIdx, xWidth, yWidth) {}
|
||
setCharWidthAndBounds(opIdx, xWidth, yWidth, llx, lly, urx, ury) {
|
||
const clip = new Path2D();
|
||
clip.rect(llx, lly, urx - llx, ury - lly);
|
||
this.ctx.clip(clip);
|
||
this.dependencyTracker?.recordBBox(opIdx, this.ctx, llx, urx, lly, ury).recordClipBox(opIdx, this.ctx, llx, urx, lly, ury);
|
||
this.endPath(opIdx);
|
||
}
|
||
getColorN_Pattern(opIdx, IR) {
|
||
let pattern;
|
||
if (IR[0] === "TilingPattern") {
|
||
const baseTransform = this.baseTransform || getCurrentTransform(this.ctx);
|
||
const canvasGraphicsFactory = {
|
||
createCanvasGraphics: (ctx, renderingOpIdx) => new CanvasGraphics(ctx, this.commonObjs, this.objs, this.canvasFactory, this.filterFactory, {
|
||
optionalContentConfig: this.optionalContentConfig,
|
||
markedContentStack: this.markedContentStack,
|
||
pixelRatio: this.pixelRatio
|
||
}, undefined, undefined, this.dependencyTracker ? new CanvasNestedDependencyTracker(this.dependencyTracker, renderingOpIdx, true) : null)
|
||
};
|
||
pattern = new TilingPattern(IR, this.ctx, canvasGraphicsFactory, baseTransform);
|
||
} else {
|
||
pattern = this._getPattern(opIdx, IR[1], IR[2]);
|
||
}
|
||
return pattern;
|
||
}
|
||
setStrokeColorN(opIdx, ...args) {
|
||
this.dependencyTracker?.recordSimpleData("strokeColor", opIdx);
|
||
this.current.strokeColor = this.getColorN_Pattern(opIdx, args);
|
||
this.current.patternStroke = true;
|
||
}
|
||
setFillColorN(opIdx, ...args) {
|
||
this.dependencyTracker?.recordSimpleData("fillColor", opIdx);
|
||
const pattern = this.current.fillColor = this.getColorN_Pattern(opIdx, args);
|
||
this.current.patternFill = true;
|
||
this.current.tilingPatternDims = pattern instanceof TilingPattern ? [0, 0, 0, 0] : null;
|
||
}
|
||
#transferColor(color) {
|
||
return this.current.transferMapsFallback?.applyToColor(color) ?? color;
|
||
}
|
||
setStrokeRGBColor(opIdx, color) {
|
||
this.dependencyTracker?.recordSimpleData("strokeColor", opIdx);
|
||
this.current.strokeColor = color;
|
||
this.ctx.strokeStyle = this.#transferColor(color);
|
||
this.current.patternStroke = false;
|
||
}
|
||
setStrokeTransparent(opIdx) {
|
||
this.dependencyTracker?.recordSimpleData("strokeColor", opIdx);
|
||
this.ctx.strokeStyle = this.current.strokeColor = "transparent";
|
||
this.current.patternStroke = false;
|
||
}
|
||
setFillRGBColor(opIdx, color) {
|
||
this.dependencyTracker?.recordSimpleData("fillColor", opIdx);
|
||
this.current.fillColor = color;
|
||
this.ctx.fillStyle = this.#transferColor(color);
|
||
this.current.patternFill = false;
|
||
this.current.tilingPatternDims = null;
|
||
}
|
||
setFillTransparent(opIdx) {
|
||
this.dependencyTracker?.recordSimpleData("fillColor", opIdx);
|
||
this.ctx.fillStyle = this.current.fillColor = "transparent";
|
||
this.current.patternFill = false;
|
||
this.current.tilingPatternDims = null;
|
||
}
|
||
_getPattern(opIdx, objId, matrix = null) {
|
||
const pattern = this.cachedPatterns.getOrInsertComputed(objId, () => getShadingPattern(this.getObject(opIdx, objId)));
|
||
if (matrix) {
|
||
pattern.matrix = matrix;
|
||
}
|
||
return pattern;
|
||
}
|
||
shadingFill(opIdx, objId) {
|
||
if (!this.contentVisible) {
|
||
return;
|
||
}
|
||
const started = this.#beginKnockoutElement(this.current.fillAlpha);
|
||
const ctx = this.ctx;
|
||
this.save(opIdx);
|
||
const pattern = this._getPattern(opIdx, objId);
|
||
ctx.fillStyle = pattern.getPattern(ctx, this, getCurrentTransformInverse(ctx), PathType.SHADING, opIdx);
|
||
const inv = getCurrentTransformInverse(ctx);
|
||
if (inv) {
|
||
const {
|
||
width,
|
||
height
|
||
} = ctx.canvas;
|
||
const minMax = F32_BBOX_INIT.slice();
|
||
Util.axialAlignedBoundingBox([0, 0, width, height], inv, minMax);
|
||
const [x0, y0, x1, y1] = minMax;
|
||
this.ctx.fillRect(x0, y0, x1 - x0, y1 - y0);
|
||
} else {
|
||
this.ctx.fillRect(-1e10, -1e10, 2e10, 2e10);
|
||
}
|
||
this.dependencyTracker?.resetBBox(opIdx).recordFullPageBBox(opIdx).recordDependencies(opIdx, Dependencies.transform).recordDependencies(opIdx, Dependencies.fill).recordOperation(opIdx);
|
||
this.compose(this.current.getClippedPathBoundingBox());
|
||
this.restore(opIdx);
|
||
this.#endKnockoutElement(started);
|
||
}
|
||
beginInlineImage() {
|
||
unreachable("Should not call beginInlineImage");
|
||
}
|
||
beginImageData() {
|
||
unreachable("Should not call beginImageData");
|
||
}
|
||
paintFormXObjectBegin(opIdx, matrix, bbox) {
|
||
if (!this.contentVisible) {
|
||
return;
|
||
}
|
||
this.save(opIdx);
|
||
this.baseTransformStack.push(this.baseTransform);
|
||
if (matrix) {
|
||
this.transform(opIdx, ...matrix);
|
||
}
|
||
this.baseTransform = getCurrentTransform(this.ctx);
|
||
if (bbox) {
|
||
Util.axialAlignedBoundingBox(bbox, this.baseTransform, this.current.minMax);
|
||
const [x0, y0, x1, y1] = bbox;
|
||
const clip = new Path2D();
|
||
clip.rect(x0, y0, x1 - x0, y1 - y0);
|
||
this.ctx.clip(clip);
|
||
this.dependencyTracker?.recordClipBox(opIdx, this.ctx, x0, x1, y0, y1);
|
||
this.endPath(opIdx);
|
||
}
|
||
}
|
||
paintFormXObjectEnd(opIdx) {
|
||
if (!this.contentVisible) {
|
||
return;
|
||
}
|
||
this.restore(opIdx);
|
||
this.baseTransform = this.baseTransformStack.pop();
|
||
}
|
||
beginGroup(opIdx, group) {
|
||
if (!this.contentVisible) {
|
||
return;
|
||
}
|
||
this.save(opIdx);
|
||
const {
|
||
inSMaskMode
|
||
} = this;
|
||
if (inSMaskMode) {
|
||
this.endSMaskMode();
|
||
this.current.activeSMask = null;
|
||
}
|
||
const currentCtx = this.ctx;
|
||
if ((!group.needsIsolation || !group.isolated && !group.hasSoftMask) && !group.knockout && !group.isGray && this.#knockoutGroupLevel === 0 && currentCtx.globalAlpha === 1 && currentCtx.globalCompositeOperation === "source-over" && !inSMaskMode) {
|
||
if (group.bbox) {
|
||
let clip = new Path2D();
|
||
const [x0, y0, x1, y1] = group.bbox;
|
||
clip.rect(x0, y0, x1 - x0, y1 - y0);
|
||
if (group.matrix) {
|
||
const path = new Path2D();
|
||
path.addPath(clip, new DOMMatrix(group.matrix));
|
||
clip = path;
|
||
}
|
||
currentCtx.clip(clip);
|
||
}
|
||
this.groupStack.push(null);
|
||
this.#groupStackMeta.push(null);
|
||
this.groupLevel++;
|
||
return;
|
||
}
|
||
if (!group.isolated && !group.knockout && this.#knockoutGroupLevel === 0) {
|
||
info("TODO: Fully support non-isolated non-knockout groups.");
|
||
}
|
||
const currentTransform = getCurrentTransform(currentCtx);
|
||
if (group.matrix) {
|
||
currentCtx.transform(...group.matrix);
|
||
}
|
||
const canvasBounds = [0, 0, currentCtx.canvas.width, currentCtx.canvas.height];
|
||
let bounds;
|
||
if (group.bbox) {
|
||
bounds = F32_BBOX_INIT.slice();
|
||
Util.axialAlignedBoundingBox(group.bbox, getCurrentTransform(currentCtx), bounds);
|
||
bounds = Util.intersect(bounds, canvasBounds) || [0, 0, 0, 0];
|
||
} else {
|
||
bounds = canvasBounds;
|
||
}
|
||
const offsetX = Math.floor(bounds[0]);
|
||
const offsetY = Math.floor(bounds[1]);
|
||
const drawnWidth = Math.max(Math.ceil(bounds[2]) - offsetX, 1);
|
||
const drawnHeight = Math.max(Math.ceil(bounds[3]) - offsetY, 1);
|
||
this.current.startNewPathAndClipBox([0, 0, drawnWidth, drawnHeight]);
|
||
const scratchCanvas = this.canvasFactory.create(drawnWidth, drawnHeight);
|
||
if (group.smask) {
|
||
this.smaskGroupCanvases.push(scratchCanvas);
|
||
}
|
||
const groupCtx = scratchCanvas.context;
|
||
const backdropCtx = group.knockout && !group.isolated ? currentCtx : null;
|
||
const hasInnerBackdrop = !group.isolated && !group.knockout && !group.smask && group.needsIsolation && this.#knockoutGroupLevel > 0;
|
||
const knockoutMaskEntry = group.knockout ? this.canvasFactory.create(drawnWidth, drawnHeight) : null;
|
||
const savedKnockoutLevel = this.#knockoutGroupLevel;
|
||
if (group.knockout) {
|
||
this.#knockoutGroupLevel++;
|
||
} else {
|
||
this.#knockoutGroupLevel = 0;
|
||
}
|
||
groupCtx.translate(-offsetX, -offsetY);
|
||
groupCtx.transform(...currentTransform);
|
||
const needsBackdropCopy = !group.isolated && !group.smask && group.needsIsolation;
|
||
const replaceBackdrop = needsBackdropCopy && !inSMaskMode && savedKnockoutLevel === 0 && !group.knockout && !group.isGray && group.hasSoftMask && currentCtx.globalAlpha === 1 && currentCtx.globalCompositeOperation === "source-over" && this.current.transferMaps === "none" && !this.current.transferMapsFallback;
|
||
if (needsBackdropCopy && (inSMaskMode || replaceBackdrop)) {
|
||
groupCtx.save();
|
||
groupCtx.setTransform(1, 0, 0, 1, 0, 0);
|
||
groupCtx.drawImage(currentCtx.canvas, -offsetX, -offsetY);
|
||
groupCtx.restore();
|
||
}
|
||
if (group.bbox) {
|
||
let clip = new Path2D();
|
||
const [x0, y0, x1, y1] = group.bbox;
|
||
clip.rect(x0, y0, x1 - x0, y1 - y0);
|
||
if (group.matrix) {
|
||
const path = new Path2D();
|
||
path.addPath(clip, new DOMMatrix(group.matrix));
|
||
clip = path;
|
||
}
|
||
groupCtx.clip(clip);
|
||
}
|
||
if (group.smask) {
|
||
this.smaskStack.push({
|
||
canvas: scratchCanvas.canvas,
|
||
context: groupCtx,
|
||
offsetX,
|
||
offsetY,
|
||
subtype: group.smask.subtype,
|
||
backdrop: group.smask.backdrop,
|
||
transferMap: group.smask.transferMap || null
|
||
});
|
||
}
|
||
if (!group.smask || this.dependencyTracker) {
|
||
currentCtx.setTransform(1, 0, 0, 1, 0, 0);
|
||
currentCtx.translate(offsetX, offsetY);
|
||
currentCtx.save();
|
||
}
|
||
copyCtxState(currentCtx, groupCtx);
|
||
this.ctx = groupCtx;
|
||
this.dependencyTracker?.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha", "strokeAlpha", "globalCompositeOperation"]).pushBaseTransform(currentCtx);
|
||
this.setGState(opIdx, [["BM", "source-over"], ["ca", 1], ["CA", 1], ["TR", null]]);
|
||
this.groupStack.push(currentCtx);
|
||
this.#groupStackMeta.push({
|
||
backdropCtx,
|
||
savedKnockoutLevel,
|
||
offsetX,
|
||
offsetY,
|
||
hasInnerBackdrop,
|
||
replaceBackdrop,
|
||
knockoutMaskEntry,
|
||
knockoutTempEntry: null,
|
||
knockoutBackdropEntry: null
|
||
});
|
||
this.groupLevel++;
|
||
}
|
||
endGroup(opIdx, group) {
|
||
if (!this.contentVisible) {
|
||
return;
|
||
}
|
||
this.groupLevel--;
|
||
const groupCtx = this.ctx;
|
||
const ctx = this.groupStack.pop();
|
||
const groupMeta = this.#groupStackMeta.pop();
|
||
if (groupMeta) {
|
||
this.#knockoutGroupLevel = groupMeta.savedKnockoutLevel;
|
||
}
|
||
if (ctx === null) {
|
||
this.restore(opIdx);
|
||
return;
|
||
}
|
||
if (group.isGray) {
|
||
this.#convertGroupToGray(groupCtx);
|
||
}
|
||
this.ctx = ctx;
|
||
this.ctx.imageSmoothingEnabled = false;
|
||
this.dependencyTracker?.popBaseTransform();
|
||
if (group.smask) {
|
||
this.tempSMask = this.smaskStack.pop();
|
||
this.restore(opIdx);
|
||
if (this.dependencyTracker) {
|
||
this.ctx.restore();
|
||
if (this.inSMaskMode) {
|
||
this.ctx.setTransform(this.suspendedCtx.getTransform());
|
||
}
|
||
}
|
||
this.#destroyKnockoutPools(groupMeta);
|
||
} else {
|
||
this.ctx.restore();
|
||
const currentMtx = getCurrentTransform(this.ctx);
|
||
this.restore(opIdx);
|
||
this.current.transferMapsFallback?.applyToCanvas(groupCtx);
|
||
this.ctx.save();
|
||
this.ctx.setTransform(...currentMtx);
|
||
const dirtyBox = F32_BBOX_INIT.slice();
|
||
Util.axialAlignedBoundingBox([0, 0, groupCtx.canvas.width, groupCtx.canvas.height], currentMtx, dirtyBox);
|
||
const parentGroupMeta = this.#groupStackMeta.at(-1);
|
||
if (this.#knockoutGroupLevel > 0) {
|
||
if (groupMeta.hasInnerBackdrop) {
|
||
const {
|
||
width,
|
||
height
|
||
} = groupCtx.canvas;
|
||
const colorEntry = this.canvasFactory.create(width, height);
|
||
const colorCtx = colorEntry.context;
|
||
colorCtx.drawImage(ctx.canvas, groupMeta.offsetX, groupMeta.offsetY, width, height, 0, 0, width, height);
|
||
colorCtx.globalCompositeOperation = "source-over";
|
||
colorCtx.drawImage(groupCtx.canvas, 0, 0);
|
||
const shapeMaskEntry = this.#createKnockoutMaskCanvas(groupCtx.canvas);
|
||
colorCtx.globalCompositeOperation = "destination-in";
|
||
colorCtx.drawImage(shapeMaskEntry.canvas, 0, 0);
|
||
const sourceCompositeOperation = this.ctx.globalCompositeOperation;
|
||
const sourceAlpha = this.ctx.globalAlpha;
|
||
const sourceFilter = this.ctx.filter;
|
||
this.ctx.save();
|
||
this.ctx.setTransform(...currentMtx);
|
||
this.ctx.globalAlpha = 1;
|
||
if (FeatureTest.isCanvasFilterSupported) {
|
||
this.ctx.filter = "none";
|
||
}
|
||
this.ctx.globalCompositeOperation = "destination-out";
|
||
this.ctx.drawImage(shapeMaskEntry.canvas, 0, 0);
|
||
this.ctx.globalCompositeOperation = sourceCompositeOperation;
|
||
this.ctx.globalAlpha = sourceAlpha;
|
||
if (FeatureTest.isCanvasFilterSupported) {
|
||
this.ctx.filter = sourceFilter ?? "none";
|
||
}
|
||
this.ctx.drawImage(colorEntry.canvas, 0, 0);
|
||
this.ctx.restore();
|
||
this.canvasFactory.destroy(shapeMaskEntry);
|
||
this.canvasFactory.destroy(colorEntry);
|
||
} else {
|
||
const backdropCtx = parentGroupMeta?.backdropCtx ?? null;
|
||
this.#compositeKnockoutSurface(this.ctx, groupCtx.canvas, {
|
||
backdropCanvas: backdropCtx?.canvas ?? null,
|
||
destTransform: currentMtx,
|
||
backdropOffset: backdropCtx ? [parentGroupMeta.offsetX + groupMeta.offsetX, parentGroupMeta.offsetY + groupMeta.offsetY] : [0, 0],
|
||
sourceAlpha: this.ctx.globalAlpha,
|
||
sourceFilter: this.ctx.filter
|
||
});
|
||
}
|
||
} else {
|
||
if (groupMeta.replaceBackdrop) {
|
||
const clip = new Path2D();
|
||
clip.rect(0, 0, groupCtx.canvas.width, groupCtx.canvas.height);
|
||
this.ctx.clip(clip);
|
||
this.ctx.globalCompositeOperation = "copy";
|
||
}
|
||
this.ctx.drawImage(groupCtx.canvas, 0, 0);
|
||
}
|
||
this.ctx.restore();
|
||
this.canvasFactory.destroy({
|
||
canvas: groupCtx.canvas,
|
||
context: groupCtx
|
||
});
|
||
this.#destroyKnockoutPools(groupMeta);
|
||
this.compose(dirtyBox);
|
||
}
|
||
}
|
||
#convertGroupToGray(groupCtx) {
|
||
const {
|
||
canvas
|
||
} = groupCtx;
|
||
const {
|
||
width,
|
||
height
|
||
} = canvas;
|
||
if (FeatureTest.isCanvasFilterSupported) {
|
||
groupCtx.save();
|
||
groupCtx.setTransform(1, 0, 0, 1, 0, 0);
|
||
groupCtx.filter = "grayscale(1)";
|
||
groupCtx.globalAlpha = 1;
|
||
groupCtx.globalCompositeOperation = "copy";
|
||
groupCtx.drawImage(canvas, 0, 0);
|
||
groupCtx.restore();
|
||
return;
|
||
}
|
||
const imageData = groupCtx.getImageData(0, 0, width, height);
|
||
const {
|
||
data
|
||
} = imageData;
|
||
for (let i = 0, ii = data.length; i < ii; i += 4) {
|
||
const gray = data[i] * 0.2126 + data[i + 1] * 0.7152 + data[i + 2] * 0.0722 + 0.5 | 0;
|
||
data[i] = data[i + 1] = data[i + 2] = gray;
|
||
}
|
||
groupCtx.putImageData(imageData, 0, 0);
|
||
}
|
||
#destroyKnockoutPools(groupMeta) {
|
||
if (!groupMeta) {
|
||
return;
|
||
}
|
||
if (groupMeta.knockoutMaskEntry) {
|
||
this.canvasFactory.destroy(groupMeta.knockoutMaskEntry);
|
||
groupMeta.knockoutMaskEntry = null;
|
||
}
|
||
if (groupMeta.knockoutTempEntry) {
|
||
this.canvasFactory.destroy(groupMeta.knockoutTempEntry);
|
||
groupMeta.knockoutTempEntry = null;
|
||
}
|
||
if (groupMeta.knockoutBackdropEntry) {
|
||
this.canvasFactory.destroy(groupMeta.knockoutBackdropEntry);
|
||
groupMeta.knockoutBackdropEntry = null;
|
||
}
|
||
}
|
||
beginAnnotation(opIdx, id, rect, transform, matrix, hasOwnCanvas, canvasName) {
|
||
this.#restoreInitialState();
|
||
resetCtxToDefault(this.ctx);
|
||
this.ctx.save();
|
||
this.save(opIdx);
|
||
if (this.baseTransform) {
|
||
this.ctx.setTransform(...this.baseTransform);
|
||
}
|
||
if (rect) {
|
||
const width = rect[2] - rect[0];
|
||
const height = rect[3] - rect[1];
|
||
if (hasOwnCanvas && this.annotationCanvasMap) {
|
||
transform = transform.slice();
|
||
transform[4] -= rect[0];
|
||
transform[5] -= rect[1];
|
||
Util.singularValueDecompose2dScale(getCurrentTransform(this.ctx), XY);
|
||
const {
|
||
viewportScale
|
||
} = this;
|
||
const canvasWidth = Math.ceil(width * this.outputScaleX * viewportScale);
|
||
const canvasHeight = Math.ceil(height * this.outputScaleY * viewportScale);
|
||
this.annotationCanvas = this.canvasFactory.create(canvasWidth, canvasHeight);
|
||
const {
|
||
canvas,
|
||
context
|
||
} = this.annotationCanvas;
|
||
if (canvasName) {
|
||
const canvases = this.annotationCanvasMap.getOrInsertComputed(id, makeArr);
|
||
setAnnotationCanvasName(canvas, canvasName);
|
||
const index = canvases.findIndex(c => getAnnotationCanvasName(c) === canvasName);
|
||
if (index === -1) {
|
||
canvases.push(canvas);
|
||
} else {
|
||
canvases[index] = canvas;
|
||
}
|
||
} else {
|
||
this.annotationCanvasMap.set(id, canvas);
|
||
}
|
||
this.annotationCanvas.savedCtx = this.ctx;
|
||
this.ctx = context;
|
||
this.ctx.save();
|
||
this.ctx.setTransform(XY[0], 0, 0, -XY[1], 0, height * XY[1]);
|
||
resetCtxToDefault(this.ctx);
|
||
} else {
|
||
resetCtxToDefault(this.ctx);
|
||
this.endPath(opIdx);
|
||
const clip = new Path2D();
|
||
clip.rect(rect[0], rect[1], width, height);
|
||
this.ctx.clip(clip);
|
||
}
|
||
}
|
||
this.current = new CanvasExtraState(this.ctx.canvas.width, this.ctx.canvas.height);
|
||
this.baseTransformStack.push(this.baseTransform);
|
||
this.transform(opIdx, ...transform);
|
||
this.transform(opIdx, ...matrix);
|
||
this.baseTransform = getCurrentTransform(this.ctx);
|
||
}
|
||
endAnnotation(opIdx) {
|
||
if (this.annotationCanvas) {
|
||
this.ctx.restore();
|
||
this.#drawFilter();
|
||
this.ctx = this.annotationCanvas.savedCtx;
|
||
delete this.annotationCanvas.savedCtx;
|
||
delete this.annotationCanvas;
|
||
}
|
||
this.baseTransform = this.baseTransformStack.pop();
|
||
}
|
||
paintImageMaskXObject(opIdx, img) {
|
||
if (!this.contentVisible) {
|
||
return;
|
||
}
|
||
const count = img.count;
|
||
img = this.getObject(opIdx, img.data, img);
|
||
img.count = count;
|
||
const started = this.#beginKnockoutElement(this.current.fillAlpha);
|
||
const ctx = this.ctx;
|
||
const mask = this._createMaskCanvas(opIdx, img);
|
||
const maskCanvas = mask.canvas;
|
||
ctx.save();
|
||
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
||
ctx.drawImage(maskCanvas, mask.offsetX, mask.offsetY);
|
||
this.dependencyTracker?.resetBBox(opIdx).recordBBox(opIdx, this.ctx, mask.offsetX, mask.offsetX + maskCanvas.width, mask.offsetY, mask.offsetY + maskCanvas.height).recordOperation(opIdx);
|
||
ctx.restore();
|
||
if (mask.canvasEntry) {
|
||
this.canvasFactory.destroy(mask.canvasEntry);
|
||
}
|
||
this.compose();
|
||
this.#endKnockoutElement(started);
|
||
}
|
||
paintImageMaskXObjectRepeat(opIdx, img, scaleX, skewX = 0, skewY = 0, scaleY, positions) {
|
||
if (!this.contentVisible) {
|
||
return;
|
||
}
|
||
img = this.getObject(opIdx, img.data, img);
|
||
const started = this.#beginKnockoutElement(this.current.fillAlpha);
|
||
const ctx = this.ctx;
|
||
ctx.save();
|
||
const currentTransform = getCurrentTransform(ctx);
|
||
ctx.transform(scaleX, skewX, skewY, scaleY, 0, 0);
|
||
const mask = this._createMaskCanvas(opIdx, img);
|
||
ctx.setTransform(1, 0, 0, 1, mask.offsetX - currentTransform[4], mask.offsetY - currentTransform[5]);
|
||
this.dependencyTracker?.resetBBox(opIdx);
|
||
for (let i = 0, ii = positions.length; i < ii; i += 2) {
|
||
const trans = Util.transform(currentTransform, [scaleX, skewX, skewY, scaleY, positions[i], positions[i + 1]]);
|
||
ctx.drawImage(mask.canvas, trans[4], trans[5]);
|
||
this.dependencyTracker?.recordBBox(opIdx, this.ctx, trans[4], trans[4] + mask.canvas.width, trans[5], trans[5] + mask.canvas.height);
|
||
}
|
||
ctx.restore();
|
||
if (mask.canvasEntry) {
|
||
this.canvasFactory.destroy(mask.canvasEntry);
|
||
}
|
||
this.compose();
|
||
this.dependencyTracker?.recordOperation(opIdx);
|
||
this.#endKnockoutElement(started);
|
||
}
|
||
paintImageMaskXObjectGroup(opIdx, images) {
|
||
if (!this.contentVisible) {
|
||
return;
|
||
}
|
||
const started = this.#beginKnockoutElement(this.current.fillAlpha);
|
||
const ctx = this.ctx;
|
||
const isPatternFill = this.current.patternFill;
|
||
const fillColor = isPatternFill ? this.current.fillColor : ctx.fillStyle;
|
||
this.dependencyTracker?.resetBBox(opIdx).recordDependencies(opIdx, Dependencies.transformAndFill);
|
||
for (const image of images) {
|
||
const {
|
||
data,
|
||
width,
|
||
height,
|
||
transform
|
||
} = image;
|
||
const maskCanvas = this.canvasFactory.create(width, height);
|
||
const maskCtx = maskCanvas.context;
|
||
maskCtx.save();
|
||
const img = this.getObject(opIdx, data, image);
|
||
putBinaryImageMask(maskCtx, img);
|
||
maskCtx.globalCompositeOperation = "source-in";
|
||
maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this, getCurrentTransformInverse(ctx), PathType.FILL, opIdx) : fillColor;
|
||
maskCtx.fillRect(0, 0, width, height);
|
||
maskCtx.restore();
|
||
ctx.save();
|
||
ctx.transform(...transform);
|
||
ctx.scale(1, -1);
|
||
drawImageAtIntegerCoords(ctx, maskCanvas.canvas, 0, 0, width, height, 0, -1, 1, 1);
|
||
this.canvasFactory.destroy(maskCanvas);
|
||
this.dependencyTracker?.recordBBox(opIdx, ctx, 0, width, 0, height);
|
||
ctx.restore();
|
||
}
|
||
this.compose();
|
||
this.dependencyTracker?.recordOperation(opIdx);
|
||
this.#endKnockoutElement(started);
|
||
}
|
||
paintImageXObject(opIdx, objId) {
|
||
if (!this.contentVisible) {
|
||
return;
|
||
}
|
||
const imgData = this.getObject(opIdx, objId);
|
||
if (!imgData) {
|
||
warn("Dependent image isn't ready yet");
|
||
return;
|
||
}
|
||
this.paintInlineImageXObject(opIdx, imgData);
|
||
}
|
||
paintImageXObjectRepeat(opIdx, objId, scaleX, scaleY, positions) {
|
||
if (!this.contentVisible) {
|
||
return;
|
||
}
|
||
const imgData = this.getObject(opIdx, objId);
|
||
if (!imgData) {
|
||
warn("Dependent image isn't ready yet");
|
||
return;
|
||
}
|
||
const width = imgData.width;
|
||
const height = imgData.height;
|
||
const map = [];
|
||
for (let i = 0, ii = positions.length; i < ii; i += 2) {
|
||
map.push({
|
||
transform: [scaleX, 0, 0, scaleY, positions[i], positions[i + 1]],
|
||
x: 0,
|
||
y: 0,
|
||
w: width,
|
||
h: height
|
||
});
|
||
}
|
||
this.paintInlineImageXObjectGroup(opIdx, imgData, map);
|
||
}
|
||
applyTransferMapsToCanvas(ctx) {
|
||
if (this.current.transferMaps !== "none") {
|
||
ctx.filter = this.current.transferMaps;
|
||
ctx.drawImage(ctx.canvas, 0, 0);
|
||
ctx.filter = "none";
|
||
} else {
|
||
this.current.transferMapsFallback?.applyToCanvas(ctx);
|
||
}
|
||
return ctx.canvas;
|
||
}
|
||
applyTransferMapsToBitmap(imgData) {
|
||
const {
|
||
transferMaps,
|
||
transferMapsFallback
|
||
} = this.current;
|
||
if (transferMaps === "none" && !transferMapsFallback) {
|
||
return {
|
||
img: imgData.bitmap,
|
||
canvasEntry: null
|
||
};
|
||
}
|
||
const {
|
||
bitmap,
|
||
width,
|
||
height
|
||
} = imgData;
|
||
const tmpCanvas = this.canvasFactory.create(width, height);
|
||
const tmpCtx = tmpCanvas.context;
|
||
tmpCtx.filter = transferMaps;
|
||
tmpCtx.drawImage(bitmap, 0, 0);
|
||
tmpCtx.filter = "none";
|
||
transferMapsFallback?.applyToCanvas(tmpCtx);
|
||
return {
|
||
img: tmpCanvas.canvas,
|
||
canvasEntry: tmpCanvas
|
||
};
|
||
}
|
||
paintInlineImageXObject(opIdx, imgData) {
|
||
if (!this.contentVisible) {
|
||
return;
|
||
}
|
||
const width = imgData.width;
|
||
const height = imgData.height;
|
||
const started = this.#beginKnockoutElement(this.current.fillAlpha);
|
||
const ctx = this.ctx;
|
||
this.save(opIdx);
|
||
const {
|
||
filter
|
||
} = ctx;
|
||
if (filter !== "none" && filter !== "") {
|
||
ctx.filter = "none";
|
||
}
|
||
ctx.scale(1 / width, -1 / height);
|
||
let imgToPaint;
|
||
let inlineImgCanvas = null;
|
||
if (imgData.bitmap) {
|
||
const result = this.applyTransferMapsToBitmap(imgData);
|
||
imgToPaint = result.img;
|
||
inlineImgCanvas = result.canvasEntry;
|
||
} else {
|
||
const tmpCanvas = this.canvasFactory.create(width, height);
|
||
putBinaryImageData(tmpCanvas.context, imgData);
|
||
imgToPaint = this.applyTransferMapsToCanvas(tmpCanvas.context);
|
||
inlineImgCanvas = tmpCanvas;
|
||
}
|
||
const scaled = this._scaleImage(imgToPaint, getCurrentTransformInverse(ctx));
|
||
ctx.imageSmoothingEnabled = getImageSmoothingEnabled(getCurrentTransform(ctx), imgData.interpolate, this.pixelRatio);
|
||
if (this.dependencyTracker) {
|
||
this.dependencyTracker.resetBBox(opIdx).recordBBox(opIdx, ctx, 0, width, -height, 0).recordDependencies(opIdx, Dependencies.imageXObject).recordOperation(opIdx);
|
||
this.imagesTracker?.record(ctx, width, height, this.dependencyTracker.clipBox);
|
||
}
|
||
drawImageAtIntegerCoords(ctx, scaled.img, 0, 0, scaled.paintWidth, scaled.paintHeight, 0, -height, width, height);
|
||
if (scaled.tmpCanvas) {
|
||
this.canvasFactory.destroy(scaled.tmpCanvas);
|
||
}
|
||
if (inlineImgCanvas) {
|
||
this.canvasFactory.destroy(inlineImgCanvas);
|
||
}
|
||
this.compose();
|
||
this.restore(opIdx);
|
||
this.#endKnockoutElement(started);
|
||
}
|
||
paintInlineImageXObjectGroup(opIdx, imgData, map) {
|
||
if (!this.contentVisible) {
|
||
return;
|
||
}
|
||
const started = this.#beginKnockoutElement(this.current.fillAlpha);
|
||
const ctx = this.ctx;
|
||
let imgToPaint;
|
||
let inlineImgCanvas = null;
|
||
if (imgData.bitmap && !this.current.transferMapsFallback) {
|
||
imgToPaint = imgData.bitmap;
|
||
} else if (imgData.bitmap) {
|
||
({
|
||
img: imgToPaint,
|
||
canvasEntry: inlineImgCanvas
|
||
} = this.applyTransferMapsToBitmap(imgData));
|
||
} else {
|
||
const w = imgData.width;
|
||
const h = imgData.height;
|
||
const tmpCanvas = this.canvasFactory.create(w, h);
|
||
putBinaryImageData(tmpCanvas.context, imgData);
|
||
imgToPaint = this.applyTransferMapsToCanvas(tmpCanvas.context);
|
||
inlineImgCanvas = tmpCanvas;
|
||
}
|
||
this.dependencyTracker?.resetBBox(opIdx);
|
||
for (const entry of map) {
|
||
ctx.save();
|
||
ctx.transform(...entry.transform);
|
||
ctx.scale(1, -1);
|
||
drawImageAtIntegerCoords(ctx, imgToPaint, entry.x, entry.y, entry.w, entry.h, 0, -1, 1, 1);
|
||
this.dependencyTracker?.recordBBox(opIdx, ctx, 0, 1, -1, 0);
|
||
ctx.restore();
|
||
}
|
||
if (inlineImgCanvas) {
|
||
this.canvasFactory.destroy(inlineImgCanvas);
|
||
}
|
||
this.dependencyTracker?.recordOperation(opIdx);
|
||
this.compose();
|
||
this.#endKnockoutElement(started);
|
||
}
|
||
paintSolidColorImageMask(opIdx) {
|
||
if (!this.contentVisible) {
|
||
return;
|
||
}
|
||
const started = this.#beginKnockoutElement(this.current.fillAlpha);
|
||
this.dependencyTracker?.resetBBox(opIdx).recordBBox(opIdx, this.ctx, 0, 1, 0, 1).recordDependencies(opIdx, Dependencies.fill).recordOperation(opIdx);
|
||
this.ctx.fillRect(0, 0, 1, 1);
|
||
this.compose();
|
||
this.#endKnockoutElement(started);
|
||
}
|
||
markPoint(opIdx, tag) {}
|
||
markPointProps(opIdx, tag, properties) {}
|
||
beginMarkedContent(opIdx, tag) {
|
||
this.dependencyTracker?.beginMarkedContent(opIdx);
|
||
this.markedContentStack.push({
|
||
visible: true
|
||
});
|
||
}
|
||
beginMarkedContentProps(opIdx, tag, properties) {
|
||
this.dependencyTracker?.beginMarkedContent(opIdx);
|
||
if (tag === "OC") {
|
||
this.markedContentStack.push({
|
||
visible: this.optionalContentConfig.isVisible(properties)
|
||
});
|
||
} else {
|
||
this.markedContentStack.push({
|
||
visible: true
|
||
});
|
||
}
|
||
this.contentVisible = this.isContentVisible();
|
||
}
|
||
endMarkedContent(opIdx) {
|
||
this.dependencyTracker?.endMarkedContent(opIdx);
|
||
this.markedContentStack.pop();
|
||
this.contentVisible = this.isContentVisible();
|
||
}
|
||
beginCompat(opIdx) {}
|
||
endCompat(opIdx) {}
|
||
consumePath(opIdx, path, clipBox) {
|
||
const isEmpty = this.current.isEmptyClip();
|
||
if (this.pendingClip) {
|
||
this.current.updateClipFromPath();
|
||
}
|
||
if (!this.pendingClip) {
|
||
this.compose(clipBox);
|
||
}
|
||
const ctx = this.ctx;
|
||
if (this.pendingClip) {
|
||
if (!isEmpty) {
|
||
if (this.pendingClip === EO_CLIP) {
|
||
ctx.clip(path, "evenodd");
|
||
} else {
|
||
ctx.clip(path);
|
||
}
|
||
}
|
||
this.pendingClip = null;
|
||
this.dependencyTracker?.bboxToClipBoxDropOperation(opIdx).recordFutureForcedDependency("clipPath", opIdx);
|
||
} else {
|
||
this.dependencyTracker?.recordOperation(opIdx);
|
||
}
|
||
this.current.startNewPathAndClipBox(this.current.clipBox);
|
||
}
|
||
getSinglePixelWidth() {
|
||
const m = getCurrentTransform(this.ctx);
|
||
if (m[1] === 0 && m[2] === 0) {
|
||
return 1 / Math.min(Math.abs(m[0]), Math.abs(m[3]));
|
||
}
|
||
const absDet = Math.abs(m[0] * m[3] - m[2] * m[1]);
|
||
const normX = Math.hypot(m[0], m[2]);
|
||
const normY = Math.hypot(m[1], m[3]);
|
||
return Math.max(normX, normY) / absDet;
|
||
}
|
||
getScaleForStroking() {
|
||
if (this._cachedScaleForStroking[0] === -1) {
|
||
const {
|
||
lineWidth
|
||
} = this.current;
|
||
const {
|
||
a,
|
||
b,
|
||
c,
|
||
d
|
||
} = this.ctx.getTransform();
|
||
let scaleX, scaleY;
|
||
if (b === 0 && c === 0) {
|
||
const normX = Math.abs(a);
|
||
const normY = Math.abs(d);
|
||
if (normX === normY) {
|
||
if (lineWidth === 0) {
|
||
scaleX = scaleY = 1 / normX;
|
||
} else {
|
||
const scaledLineWidth = normX * lineWidth;
|
||
scaleX = scaleY = scaledLineWidth < 1 ? 1 / scaledLineWidth : 1;
|
||
}
|
||
} else if (lineWidth === 0) {
|
||
scaleX = 1 / normX;
|
||
scaleY = 1 / normY;
|
||
} else {
|
||
const scaledXLineWidth = normX * lineWidth;
|
||
const scaledYLineWidth = normY * lineWidth;
|
||
scaleX = scaledXLineWidth < 1 ? 1 / scaledXLineWidth : 1;
|
||
scaleY = scaledYLineWidth < 1 ? 1 / scaledYLineWidth : 1;
|
||
}
|
||
} else {
|
||
const absDet = Math.abs(a * d - b * c);
|
||
const normX = Math.hypot(a, b);
|
||
const normY = Math.hypot(c, d);
|
||
if (lineWidth === 0) {
|
||
scaleX = normY / absDet;
|
||
scaleY = normX / absDet;
|
||
} else {
|
||
const baseArea = lineWidth * absDet;
|
||
scaleX = normY > baseArea ? normY / baseArea : 1;
|
||
scaleY = normX > baseArea ? normX / baseArea : 1;
|
||
}
|
||
}
|
||
this._cachedScaleForStroking[0] = scaleX;
|
||
this._cachedScaleForStroking[1] = scaleY;
|
||
}
|
||
return this._cachedScaleForStroking;
|
||
}
|
||
rescaleAndStroke(path, saveRestore) {
|
||
const {
|
||
ctx,
|
||
current: {
|
||
lineWidth
|
||
}
|
||
} = this;
|
||
const [scaleX, scaleY] = this.getScaleForStroking();
|
||
if (scaleX === scaleY) {
|
||
ctx.lineWidth = (lineWidth || 1) * scaleX;
|
||
ctx.stroke(path);
|
||
return;
|
||
}
|
||
const SCALE_MATRIX = CanvasGraphics.#SCALE_MATRIX ??= new DOMMatrix();
|
||
const dashes = ctx.getLineDash();
|
||
if (saveRestore) {
|
||
ctx.save();
|
||
}
|
||
ctx.scale(scaleX, scaleY);
|
||
SCALE_MATRIX.a = 1 / scaleX;
|
||
SCALE_MATRIX.d = 1 / scaleY;
|
||
const newPath = new Path2D();
|
||
newPath.addPath(path, SCALE_MATRIX);
|
||
if (dashes.length > 0) {
|
||
const scale = Math.max(scaleX, scaleY);
|
||
ctx.setLineDash(dashes.map(x => x / scale));
|
||
ctx.lineDashOffset /= scale;
|
||
}
|
||
ctx.lineWidth = lineWidth || 1;
|
||
ctx.stroke(newPath);
|
||
if (saveRestore) {
|
||
ctx.restore();
|
||
}
|
||
}
|
||
isContentVisible() {
|
||
for (let i = this.markedContentStack.length - 1; i >= 0; i--) {
|
||
if (!this.markedContentStack[i].visible) {
|
||
return false;
|
||
}
|
||
}
|
||
return true;
|
||
}
|
||
}
|
||
for (const op in OPS) {
|
||
if (CanvasGraphics.prototype[op] !== undefined) {
|
||
CanvasGraphics.prototype[OPS[op]] = CanvasGraphics.prototype[op];
|
||
}
|
||
}
|
||
|
||
;// ./node_modules/core-js/modules/web.dom-exception.stack.js
|
||
web_dom_exception_stack_namespaceFn();
|
||
|
||
;// ./src/shared/css_utils.js
|
||
const CONTROL_CHAR_REGEXP = /\p{Cc}/u;
|
||
function isCSSString(str) {
|
||
const quote = str[0];
|
||
if (str.length < 2 || quote !== `"` && quote !== `'` || str.at(-1) !== quote) {
|
||
return false;
|
||
}
|
||
const end = str.length - 1;
|
||
for (let i = 1; i < end; i++) {
|
||
const char = str[i];
|
||
if (char === quote || CONTROL_CHAR_REGEXP.test(char)) {
|
||
return false;
|
||
}
|
||
if (char === "\\") {
|
||
if (++i >= end || CONTROL_CHAR_REGEXP.test(str[i])) {
|
||
return false;
|
||
}
|
||
}
|
||
}
|
||
return true;
|
||
}
|
||
function serializeFontFamily(fontFamily) {
|
||
if (isCSSString(fontFamily)) {
|
||
return fontFamily;
|
||
}
|
||
const escaped = fontFamily.replaceAll(/["\\\p{Cc}]/gu, char => char === `"` || char === "\\" ? `\\${char}` : `\\${char.codePointAt(0).toString(16)} `);
|
||
return `"${escaped}"`;
|
||
}
|
||
|
||
;// ./src/display/font_loader.js
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
class FontLoader {
|
||
#nativeFontFaces = new Set();
|
||
#systemFonts = new Set();
|
||
#styleSheet = null;
|
||
constructor({
|
||
ownerDocument = globalThis.document,
|
||
styleElement = null
|
||
}) {
|
||
this._document = ownerDocument;
|
||
this.styleElement = null;
|
||
}
|
||
addNativeFontFace(nativeFontFace) {
|
||
this.#nativeFontFaces.add(nativeFontFace);
|
||
this._document.fonts.add(nativeFontFace);
|
||
}
|
||
removeNativeFontFace(nativeFontFace) {
|
||
this.#nativeFontFaces.delete(nativeFontFace);
|
||
this._document.fonts.delete(nativeFontFace);
|
||
}
|
||
insertRule(rule) {
|
||
throw new Error("Not implemented: insertRule");
|
||
}
|
||
#getStyleSheet() {
|
||
throw new Error("Not implemented: #getStyleSheet");
|
||
}
|
||
clear() {
|
||
for (const nativeFontFace of this.#nativeFontFaces) {
|
||
this._document.fonts.delete(nativeFontFace);
|
||
}
|
||
this.#nativeFontFaces.clear();
|
||
this.#systemFonts.clear();
|
||
}
|
||
async loadSystemFont({
|
||
systemFontInfo: info,
|
||
disableFontFace,
|
||
_inspectFont
|
||
}) {
|
||
if (!info || this.#systemFonts.has(info.loadedName)) {
|
||
return;
|
||
}
|
||
assert(!disableFontFace, "loadSystemFont shouldn't be called when `disableFontFace` is set.");
|
||
if (this.isFontLoadingAPISupported) {
|
||
const {
|
||
loadedName,
|
||
src,
|
||
style
|
||
} = info;
|
||
const fontFace = new FontFace(loadedName, src, style);
|
||
this.addNativeFontFace(fontFace);
|
||
try {
|
||
await fontFace.load();
|
||
this.#systemFonts.add(loadedName);
|
||
_inspectFont?.(info);
|
||
} catch {
|
||
warn(`Cannot load system font: ${info.baseFontName}, installing it could help to improve PDF rendering.`);
|
||
this.removeNativeFontFace(fontFace);
|
||
}
|
||
return;
|
||
}
|
||
unreachable("Not implemented: loadSystemFont without the Font Loading API.");
|
||
}
|
||
async bind(font) {
|
||
if (font.attached || font.missingFile && !font.systemFontInfo) {
|
||
return;
|
||
}
|
||
font.attached = true;
|
||
if (font.systemFontInfo) {
|
||
await this.loadSystemFont(font);
|
||
return;
|
||
}
|
||
if (this.isFontLoadingAPISupported) {
|
||
const nativeFontFace = font.createNativeFontFace();
|
||
if (nativeFontFace) {
|
||
this.addNativeFontFace(nativeFontFace);
|
||
try {
|
||
await nativeFontFace.loaded;
|
||
} catch (ex) {
|
||
warn(`Failed to load font '${nativeFontFace.family}': '${ex}'.`);
|
||
font.disableFontFace = true;
|
||
throw ex;
|
||
}
|
||
}
|
||
return;
|
||
}
|
||
throw new Error("Not implemented: DOM font loading");
|
||
}
|
||
get isFontLoadingAPISupported() {
|
||
return util_shadow(this, "isFontLoadingAPISupported", !!this._document?.fonts);
|
||
}
|
||
get isSyncFontLoadingSupported() {
|
||
return util_shadow(this, "isSyncFontLoadingSupported", isNodeJS || FeatureTest.platform.isFirefox);
|
||
}
|
||
#testFontLoaded(font) {
|
||
throw new Error("Not implemented: #testFontLoaded");
|
||
}
|
||
}
|
||
class FontFaceObject {
|
||
#compiledPaths = new Map();
|
||
#fontData;
|
||
constructor(translatedData, inspectFont = null, charProcOperatorList, extra) {
|
||
this.#fontData = translatedData;
|
||
this._inspectFont = inspectFont;
|
||
if (charProcOperatorList) {
|
||
this.charProcOperatorList = charProcOperatorList;
|
||
}
|
||
if (extra) {
|
||
Object.assign(this, extra);
|
||
}
|
||
}
|
||
createNativeFontFace() {
|
||
const {
|
||
data
|
||
} = this;
|
||
if (!data || this.disableFontFace) {
|
||
return null;
|
||
}
|
||
let nativeFontFace;
|
||
if (!this.cssFontInfo) {
|
||
nativeFontFace = new FontFace(this.loadedName, data, {});
|
||
} else {
|
||
const css = {
|
||
weight: this.cssFontInfo.fontWeight
|
||
};
|
||
if (this.cssFontInfo.italicAngle) {
|
||
css.style = `oblique ${this.cssFontInfo.italicAngle}deg`;
|
||
}
|
||
nativeFontFace = new FontFace(serializeFontFamily(this.cssFontInfo.fontFamily), data, css);
|
||
}
|
||
this._inspectFont?.(this);
|
||
return nativeFontFace;
|
||
}
|
||
createFontFaceRule() {
|
||
throw new Error("Not implemented: createFontFaceRule");
|
||
}
|
||
getPathGenerator(objs, character) {
|
||
let path = this.#compiledPaths.get(character);
|
||
if (path) {
|
||
return path;
|
||
}
|
||
const objId = `${this.loadedName}_path_${character}`;
|
||
let cmds;
|
||
try {
|
||
cmds = objs.get(objId);
|
||
} catch (ex) {
|
||
warn(`getPathGenerator - ignoring character: "${ex}".`);
|
||
}
|
||
path = makePathFromDrawOPS(cmds?.path);
|
||
if (!this.fontExtraProperties) {
|
||
objs.delete(objId);
|
||
}
|
||
this.#compiledPaths.set(character, path);
|
||
return path;
|
||
}
|
||
get black() {
|
||
return this.#fontData.black;
|
||
}
|
||
get bold() {
|
||
return this.#fontData.bold;
|
||
}
|
||
get disableFontFace() {
|
||
return this.#fontData.disableFontFace;
|
||
}
|
||
set disableFontFace(value) {
|
||
util_shadow(this, "disableFontFace", !!value);
|
||
}
|
||
get fontExtraProperties() {
|
||
return this.#fontData.fontExtraProperties;
|
||
}
|
||
get isInvalidPDFjsFont() {
|
||
return this.#fontData.isInvalidPDFjsFont;
|
||
}
|
||
get isType3Font() {
|
||
return this.#fontData.isType3Font;
|
||
}
|
||
get italic() {
|
||
return this.#fontData.italic;
|
||
}
|
||
get missingFile() {
|
||
return this.#fontData.missingFile;
|
||
}
|
||
get remeasure() {
|
||
return this.#fontData.remeasure;
|
||
}
|
||
get vertical() {
|
||
return this.#fontData.vertical;
|
||
}
|
||
get bbox() {
|
||
return this.#fontData.bbox;
|
||
}
|
||
get fontMatrix() {
|
||
return this.#fontData.fontMatrix;
|
||
}
|
||
get fallbackName() {
|
||
return this.#fontData.fallbackName;
|
||
}
|
||
get loadedName() {
|
||
return this.#fontData.loadedName;
|
||
}
|
||
get mimetype() {
|
||
return this.missingFile ? null : "font/opentype";
|
||
}
|
||
get data() {
|
||
return this.#fontData.data;
|
||
}
|
||
clearData() {
|
||
this.#fontData.clearData();
|
||
}
|
||
get cssFontInfo() {
|
||
return this.#fontData.cssFontInfo;
|
||
}
|
||
get systemFontInfo() {
|
||
return this.#fontData.systemFontInfo;
|
||
}
|
||
}
|
||
|
||
;// ./node_modules/core-js/modules/es.promise.try.js
|
||
es_promise_try_namespaceFn();
|
||
|
||
;// ./src/shared/message_handler.js
|
||
|
||
|
||
|
||
|
||
const CallbackKind = {
|
||
DATA: 1,
|
||
ERROR: 2
|
||
};
|
||
const StreamKind = {
|
||
CANCEL: 1,
|
||
CANCEL_COMPLETE: 2,
|
||
CLOSE: 3,
|
||
ENQUEUE: 4,
|
||
ERROR: 5,
|
||
PULL: 6,
|
||
PULL_COMPLETE: 7,
|
||
START_COMPLETE: 8
|
||
};
|
||
function onFn() {}
|
||
function wrapReason(ex) {
|
||
if (ex instanceof AbortException || ex instanceof InvalidPDFException || ex instanceof PasswordException || ex instanceof ResponseException || ex instanceof UnknownErrorException) {
|
||
return ex;
|
||
}
|
||
if (typeof ex !== "object" || ex === null) {
|
||
return new UnknownErrorException(String(ex), String(ex));
|
||
}
|
||
switch (ex.name) {
|
||
case "AbortException":
|
||
return new AbortException(ex.message);
|
||
case "InvalidPDFException":
|
||
return new InvalidPDFException(ex.message);
|
||
case "PasswordException":
|
||
return new PasswordException(ex.message, ex.code);
|
||
case "ResponseException":
|
||
return new ResponseException(ex.message, ex.status, ex.missing);
|
||
case "UnknownErrorException":
|
||
return new UnknownErrorException(ex.message, ex.details);
|
||
}
|
||
return new UnknownErrorException(ex.message, ex.toString());
|
||
}
|
||
class MessageHandler {
|
||
#actions = new Map();
|
||
#callbackCapabilities = new Map();
|
||
#callbackId = 1;
|
||
#comObj;
|
||
#messageAC = new AbortController();
|
||
#sourceName;
|
||
#streamControllers = new Map();
|
||
#streamId = 1;
|
||
#streamSinks = new Map();
|
||
#targetName;
|
||
constructor(sourceName, targetName, comObj) {
|
||
this.#sourceName = sourceName;
|
||
this.#targetName = targetName;
|
||
this.#comObj = comObj;
|
||
comObj.addEventListener("message", this.#onMessage.bind(this), {
|
||
signal: this.#messageAC.signal
|
||
});
|
||
}
|
||
#onMessage({
|
||
data
|
||
}) {
|
||
if (data.targetName !== this.#sourceName) {
|
||
return;
|
||
}
|
||
if (data.stream) {
|
||
this.#processStreamMessage(data);
|
||
return;
|
||
}
|
||
if (data.callback) {
|
||
const {
|
||
callbackId,
|
||
callback
|
||
} = data;
|
||
const capability = this.#callbackCapabilities.get(callbackId);
|
||
if (!capability) {
|
||
throw new Error(`Cannot resolve callback ${callbackId}`);
|
||
}
|
||
this.#callbackCapabilities.delete(callbackId);
|
||
if (callback === CallbackKind.DATA) {
|
||
capability.resolve(data.data);
|
||
} else if (callback === CallbackKind.ERROR) {
|
||
capability.reject(wrapReason(data.reason));
|
||
} else {
|
||
throw new Error("Unexpected callback case");
|
||
}
|
||
return;
|
||
}
|
||
const action = this.#actions.get(data.action);
|
||
if (!action) {
|
||
throw new Error(`Unknown action from worker: ${data.action}`);
|
||
}
|
||
if (data.callbackId) {
|
||
const sourceName = this.#sourceName,
|
||
targetName = data.sourceName,
|
||
comObj = this.#comObj;
|
||
Promise.try(action, data.data).then(result => {
|
||
comObj.postMessage({
|
||
sourceName,
|
||
targetName,
|
||
callback: CallbackKind.DATA,
|
||
callbackId: data.callbackId,
|
||
data: result
|
||
});
|
||
}).catch(reason => {
|
||
comObj.postMessage({
|
||
sourceName,
|
||
targetName,
|
||
callback: CallbackKind.ERROR,
|
||
callbackId: data.callbackId,
|
||
reason: wrapReason(reason)
|
||
});
|
||
});
|
||
return;
|
||
}
|
||
if (data.streamId) {
|
||
this.#createStreamSink(data);
|
||
return;
|
||
}
|
||
action(data.data);
|
||
}
|
||
on(actionName, handler) {
|
||
const ah = this.#actions;
|
||
if (ah.has(actionName)) {
|
||
throw new Error(`There is already a "${actionName}" handler.`);
|
||
}
|
||
ah.set(actionName, handler);
|
||
}
|
||
send(actionName, data, transfers) {
|
||
this.#comObj.postMessage({
|
||
sourceName: this.#sourceName,
|
||
targetName: this.#targetName,
|
||
action: actionName,
|
||
data
|
||
}, transfers);
|
||
}
|
||
sendWithPromise(actionName, data, transfers) {
|
||
const callbackId = this.#callbackId++,
|
||
capability = Promise.withResolvers();
|
||
this.#callbackCapabilities.set(callbackId, capability);
|
||
try {
|
||
this.#comObj.postMessage({
|
||
sourceName: this.#sourceName,
|
||
targetName: this.#targetName,
|
||
action: actionName,
|
||
callbackId,
|
||
data
|
||
}, transfers);
|
||
} catch (ex) {
|
||
capability.reject(ex);
|
||
}
|
||
return capability.promise;
|
||
}
|
||
sendWithStream(actionName, data, queueingStrategy, transfers) {
|
||
const streamId = this.#streamId++,
|
||
sourceName = this.#sourceName,
|
||
targetName = this.#targetName,
|
||
comObj = this.#comObj;
|
||
return new ReadableStream({
|
||
start: controller => {
|
||
const startCapability = Promise.withResolvers();
|
||
this.#streamControllers.set(streamId, {
|
||
controller,
|
||
startCall: startCapability,
|
||
pullCall: null,
|
||
cancelCall: null,
|
||
isClosed: false
|
||
});
|
||
comObj.postMessage({
|
||
sourceName,
|
||
targetName,
|
||
action: actionName,
|
||
streamId,
|
||
data,
|
||
desiredSize: controller.desiredSize
|
||
}, transfers);
|
||
return startCapability.promise;
|
||
},
|
||
pull: controller => {
|
||
const pullCapability = Promise.withResolvers();
|
||
this.#streamControllers.get(streamId).pullCall = pullCapability;
|
||
comObj.postMessage({
|
||
sourceName,
|
||
targetName,
|
||
stream: StreamKind.PULL,
|
||
streamId,
|
||
desiredSize: controller.desiredSize
|
||
});
|
||
return pullCapability.promise;
|
||
},
|
||
cancel: reason => {
|
||
assert(reason instanceof Error, "cancel must have a valid reason");
|
||
const cancelCapability = Promise.withResolvers();
|
||
this.#streamControllers.get(streamId).cancelCall = cancelCapability;
|
||
this.#streamControllers.get(streamId).isClosed = true;
|
||
comObj.postMessage({
|
||
sourceName,
|
||
targetName,
|
||
stream: StreamKind.CANCEL,
|
||
streamId,
|
||
reason: wrapReason(reason)
|
||
});
|
||
return cancelCapability.promise;
|
||
}
|
||
}, queueingStrategy);
|
||
}
|
||
#createStreamSink(data) {
|
||
const streamId = data.streamId,
|
||
sourceName = this.#sourceName,
|
||
targetName = data.sourceName,
|
||
comObj = this.#comObj;
|
||
const streamSinks = this.#streamSinks,
|
||
action = this.#actions.get(data.action);
|
||
const streamSink = {
|
||
enqueue(chunk, size = 1, transfers) {
|
||
if (this.isCancelled) {
|
||
return;
|
||
}
|
||
const lastDesiredSize = this.desiredSize;
|
||
this.desiredSize -= size;
|
||
if (lastDesiredSize > 0 && this.desiredSize <= 0) {
|
||
this.sinkCapability = Promise.withResolvers();
|
||
this.ready = this.sinkCapability.promise;
|
||
}
|
||
comObj.postMessage({
|
||
sourceName,
|
||
targetName,
|
||
stream: StreamKind.ENQUEUE,
|
||
streamId,
|
||
chunk
|
||
}, transfers);
|
||
},
|
||
close() {
|
||
if (this.isCancelled) {
|
||
return;
|
||
}
|
||
this.isCancelled = true;
|
||
comObj.postMessage({
|
||
sourceName,
|
||
targetName,
|
||
stream: StreamKind.CLOSE,
|
||
streamId
|
||
});
|
||
streamSinks.delete(streamId);
|
||
},
|
||
error(reason) {
|
||
if (this.isCancelled) {
|
||
return;
|
||
}
|
||
this.isCancelled = true;
|
||
comObj.postMessage({
|
||
sourceName,
|
||
targetName,
|
||
stream: StreamKind.ERROR,
|
||
streamId,
|
||
reason: wrapReason(reason)
|
||
});
|
||
},
|
||
sinkCapability: Promise.withResolvers(),
|
||
onPull: null,
|
||
onCancel: null,
|
||
isCancelled: false,
|
||
desiredSize: data.desiredSize,
|
||
ready: null
|
||
};
|
||
streamSink.sinkCapability.resolve();
|
||
streamSink.ready = streamSink.sinkCapability.promise;
|
||
streamSinks.set(streamId, streamSink);
|
||
Promise.try(action, data.data, streamSink).then(() => {
|
||
comObj.postMessage({
|
||
sourceName,
|
||
targetName,
|
||
stream: StreamKind.START_COMPLETE,
|
||
streamId,
|
||
success: true
|
||
});
|
||
}, reason => {
|
||
comObj.postMessage({
|
||
sourceName,
|
||
targetName,
|
||
stream: StreamKind.START_COMPLETE,
|
||
streamId,
|
||
reason: wrapReason(reason)
|
||
});
|
||
});
|
||
}
|
||
#processStreamMessage(data) {
|
||
const streamId = data.streamId,
|
||
sourceName = this.#sourceName,
|
||
targetName = data.sourceName,
|
||
comObj = this.#comObj;
|
||
const streamController = this.#streamControllers.get(streamId),
|
||
streamSink = this.#streamSinks.get(streamId);
|
||
switch (data.stream) {
|
||
case StreamKind.START_COMPLETE:
|
||
if (data.success) {
|
||
streamController.startCall.resolve();
|
||
} else {
|
||
streamController.startCall.reject(wrapReason(data.reason));
|
||
}
|
||
break;
|
||
case StreamKind.PULL_COMPLETE:
|
||
if (data.success) {
|
||
streamController.pullCall.resolve();
|
||
} else {
|
||
streamController.pullCall.reject(wrapReason(data.reason));
|
||
}
|
||
break;
|
||
case StreamKind.PULL:
|
||
if (!streamSink) {
|
||
comObj.postMessage({
|
||
sourceName,
|
||
targetName,
|
||
stream: StreamKind.PULL_COMPLETE,
|
||
streamId,
|
||
success: true
|
||
});
|
||
break;
|
||
}
|
||
if (streamSink.desiredSize <= 0 && data.desiredSize > 0) {
|
||
streamSink.sinkCapability.resolve();
|
||
}
|
||
streamSink.desiredSize = data.desiredSize;
|
||
Promise.try(streamSink.onPull || onFn).then(() => {
|
||
comObj.postMessage({
|
||
sourceName,
|
||
targetName,
|
||
stream: StreamKind.PULL_COMPLETE,
|
||
streamId,
|
||
success: true
|
||
});
|
||
}, reason => {
|
||
comObj.postMessage({
|
||
sourceName,
|
||
targetName,
|
||
stream: StreamKind.PULL_COMPLETE,
|
||
streamId,
|
||
reason: wrapReason(reason)
|
||
});
|
||
});
|
||
break;
|
||
case StreamKind.ENQUEUE:
|
||
assert(streamController, "enqueue should have stream controller");
|
||
if (streamController.isClosed) {
|
||
break;
|
||
}
|
||
streamController.controller.enqueue(data.chunk);
|
||
break;
|
||
case StreamKind.CLOSE:
|
||
assert(streamController, "close should have stream controller");
|
||
if (streamController.isClosed) {
|
||
break;
|
||
}
|
||
streamController.isClosed = true;
|
||
streamController.controller.close();
|
||
this.#deleteStreamController(streamController, streamId);
|
||
break;
|
||
case StreamKind.ERROR:
|
||
assert(streamController, "error should have stream controller");
|
||
streamController.controller.error(wrapReason(data.reason));
|
||
this.#deleteStreamController(streamController, streamId);
|
||
break;
|
||
case StreamKind.CANCEL_COMPLETE:
|
||
if (data.success) {
|
||
streamController.cancelCall.resolve();
|
||
} else {
|
||
streamController.cancelCall.reject(wrapReason(data.reason));
|
||
}
|
||
this.#deleteStreamController(streamController, streamId);
|
||
break;
|
||
case StreamKind.CANCEL:
|
||
if (!streamSink) {
|
||
break;
|
||
}
|
||
const dataReason = wrapReason(data.reason);
|
||
Promise.try(streamSink.onCancel || onFn, dataReason).then(() => {
|
||
comObj.postMessage({
|
||
sourceName,
|
||
targetName,
|
||
stream: StreamKind.CANCEL_COMPLETE,
|
||
streamId,
|
||
success: true
|
||
});
|
||
}, reason => {
|
||
comObj.postMessage({
|
||
sourceName,
|
||
targetName,
|
||
stream: StreamKind.CANCEL_COMPLETE,
|
||
streamId,
|
||
reason: wrapReason(reason)
|
||
});
|
||
});
|
||
streamSink.sinkCapability.reject(dataReason);
|
||
streamSink.isCancelled = true;
|
||
this.#streamSinks.delete(streamId);
|
||
break;
|
||
default:
|
||
throw new Error("Unexpected stream case");
|
||
}
|
||
}
|
||
async #deleteStreamController(streamController, streamId) {
|
||
await Promise.allSettled([streamController.startCall?.promise, streamController.pullCall?.promise, streamController.cancelCall?.promise]);
|
||
this.#streamControllers.delete(streamId);
|
||
}
|
||
destroy() {
|
||
this.#messageAC?.abort();
|
||
this.#messageAC = null;
|
||
}
|
||
get destroyed() {
|
||
return !this.#messageAC;
|
||
}
|
||
}
|
||
|
||
;// ./src/shared/obj_bin_transform_utils.js
|
||
|
||
class CSS_FONT_INFO {
|
||
static strings = ["fontFamily", "fontWeight", "italicAngle"];
|
||
}
|
||
class SYSTEM_FONT_INFO {
|
||
static strings = ["css", "loadedName", "baseFontName", "src"];
|
||
}
|
||
class FONT_INFO {
|
||
static bools = ["black", "bold", "disableFontFace", "fontExtraProperties", "isInvalidPDFjsFont", "isType3Font", "italic", "missingFile", "remeasure", "vertical"];
|
||
static strings = ["fallbackName", "loadedName"];
|
||
static OFFSET_BBOX = Math.ceil(this.bools.length * 2 / 8);
|
||
static OFFSET_FONT_MATRIX = this.OFFSET_BBOX + 1 + 2 * 4;
|
||
static OFFSET_STRINGS = this.OFFSET_FONT_MATRIX + 1 + 8 * 6;
|
||
}
|
||
class PATTERN_INFO {
|
||
static KIND = 0;
|
||
static HAS_BBOX = 1;
|
||
static HAS_BACKGROUND = 2;
|
||
static SHADING_TYPE = 3;
|
||
static N_COORD = 4;
|
||
static N_COLOR = 8;
|
||
static N_STOP = 12;
|
||
static N_FIGURES = 16;
|
||
}
|
||
class InfoUtils {
|
||
static get decoder() {
|
||
return util_shadow(this, "decoder", new TextDecoder());
|
||
}
|
||
static get encoder() {
|
||
return util_shadow(this, "encoder", new TextEncoder());
|
||
}
|
||
}
|
||
|
||
;// ./src/display/obj_bin_transform_display.js
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
function readString(buffer, view, index, offset = 0) {
|
||
const {
|
||
decoder
|
||
} = InfoUtils;
|
||
for (let i = 0; i < index; i++) {
|
||
offset += view.getUint32(offset) + 4;
|
||
}
|
||
const length = view.getUint32(offset);
|
||
return decoder.decode(new Uint8Array(buffer, offset + 4, length));
|
||
}
|
||
class CssFontInfo {
|
||
#buffer;
|
||
#view;
|
||
constructor(buffer) {
|
||
this.#buffer = buffer;
|
||
this.#view = new DataView(buffer);
|
||
}
|
||
#readString(index) {
|
||
assert(index < CSS_FONT_INFO.strings.length, "Invalid string index");
|
||
return readString(this.#buffer, this.#view, index);
|
||
}
|
||
get fontFamily() {
|
||
return util_shadow(this, "fontFamily", this.#readString(0));
|
||
}
|
||
get fontWeight() {
|
||
return util_shadow(this, "fontWeight", this.#readString(1));
|
||
}
|
||
get italicAngle() {
|
||
return util_shadow(this, "italicAngle", this.#readString(2));
|
||
}
|
||
}
|
||
class SystemFontInfo {
|
||
#buffer;
|
||
#view;
|
||
constructor(buffer) {
|
||
this.#buffer = buffer;
|
||
this.#view = new DataView(buffer);
|
||
}
|
||
#readString(index) {
|
||
assert(index < SYSTEM_FONT_INFO.strings.length, "Invalid string index");
|
||
return readString(this.#buffer, this.#view, index, 4);
|
||
}
|
||
get css() {
|
||
return util_shadow(this, "css", this.#readString(0));
|
||
}
|
||
get loadedName() {
|
||
return util_shadow(this, "loadedName", this.#readString(1));
|
||
}
|
||
get baseFontName() {
|
||
return util_shadow(this, "baseFontName", this.#readString(2));
|
||
}
|
||
get src() {
|
||
return util_shadow(this, "src", this.#readString(3));
|
||
}
|
||
get style() {
|
||
let offset = 0;
|
||
offset += 4 + this.#view.getUint32(offset);
|
||
const style = readString(this.#buffer, this.#view, 0, offset),
|
||
weight = readString(this.#buffer, this.#view, 1, offset);
|
||
return util_shadow(this, "style", {
|
||
style,
|
||
weight
|
||
});
|
||
}
|
||
}
|
||
class FontInfo {
|
||
#buffer;
|
||
#view;
|
||
constructor(buffer) {
|
||
this.#buffer = buffer;
|
||
this.#view = new DataView(buffer);
|
||
}
|
||
#readBoolean(index) {
|
||
assert(index < FONT_INFO.bools.length, "Invalid boolean index");
|
||
const byteOffset = Math.floor(index / 4);
|
||
const bitOffset = index * 2 % 8;
|
||
const value = this.#view.getUint8(byteOffset) >> bitOffset & 0x03;
|
||
return value === 0x00 ? undefined : value === 0x02;
|
||
}
|
||
get black() {
|
||
return util_shadow(this, "black", this.#readBoolean(0));
|
||
}
|
||
get bold() {
|
||
return util_shadow(this, "bold", this.#readBoolean(1));
|
||
}
|
||
get disableFontFace() {
|
||
return util_shadow(this, "disableFontFace", this.#readBoolean(2));
|
||
}
|
||
get fontExtraProperties() {
|
||
return util_shadow(this, "fontExtraProperties", this.#readBoolean(3));
|
||
}
|
||
get isInvalidPDFjsFont() {
|
||
return util_shadow(this, "isInvalidPDFjsFont", this.#readBoolean(4));
|
||
}
|
||
get isType3Font() {
|
||
return util_shadow(this, "isType3Font", this.#readBoolean(5));
|
||
}
|
||
get italic() {
|
||
return util_shadow(this, "italic", this.#readBoolean(6));
|
||
}
|
||
get missingFile() {
|
||
return util_shadow(this, "missingFile", this.#readBoolean(7));
|
||
}
|
||
get remeasure() {
|
||
return util_shadow(this, "remeasure", this.#readBoolean(8));
|
||
}
|
||
get vertical() {
|
||
return util_shadow(this, "vertical", this.#readBoolean(9));
|
||
}
|
||
#readArray(offset, arrLen, lookupName, increment) {
|
||
const len = this.#view.getUint8(offset++);
|
||
if (len === 0) {
|
||
return undefined;
|
||
}
|
||
assert(len === arrLen, "Invalid array length.");
|
||
const arr = new Array(len);
|
||
for (let i = 0; i < len; i++) {
|
||
arr[i] = this.#view[lookupName](offset, true);
|
||
offset += increment;
|
||
}
|
||
return arr;
|
||
}
|
||
get bbox() {
|
||
return util_shadow(this, "bbox", this.#readArray(FONT_INFO.OFFSET_BBOX, 4, "getInt16", 2));
|
||
}
|
||
get fontMatrix() {
|
||
return util_shadow(this, "fontMatrix", this.#readArray(FONT_INFO.OFFSET_FONT_MATRIX, 6, "getFloat64", 8));
|
||
}
|
||
#readString(index) {
|
||
assert(index < FONT_INFO.strings.length, "Invalid string index");
|
||
return readString(this.#buffer, this.#view, index, FONT_INFO.OFFSET_STRINGS + 4);
|
||
}
|
||
get fallbackName() {
|
||
return util_shadow(this, "fallbackName", this.#readString(0));
|
||
}
|
||
get loadedName() {
|
||
return util_shadow(this, "loadedName", this.#readString(1));
|
||
}
|
||
#getBufferOffset(index) {
|
||
let offset = FONT_INFO.OFFSET_STRINGS;
|
||
for (let i = 0; i <= index; i++) {
|
||
offset += 4 + this.#view.getUint32(offset);
|
||
}
|
||
const length = this.#view.getUint32(offset);
|
||
return {
|
||
offset,
|
||
length
|
||
};
|
||
}
|
||
get data() {
|
||
const {
|
||
offset,
|
||
length
|
||
} = this.#getBufferOffset(2);
|
||
return !length ? undefined : new Uint8Array(this.#buffer, offset + 4, length);
|
||
}
|
||
clearData() {
|
||
const {
|
||
offset,
|
||
length
|
||
} = this.#getBufferOffset(2);
|
||
if (!length) {
|
||
return;
|
||
}
|
||
this.#view.setUint32(offset, 0);
|
||
this.#buffer = new Uint8Array(this.#buffer, 0, offset + 4).slice().buffer;
|
||
this.#view = new DataView(this.#buffer);
|
||
}
|
||
get cssFontInfo() {
|
||
const {
|
||
offset,
|
||
length
|
||
} = this.#getBufferOffset(1);
|
||
let info = null;
|
||
if (length) {
|
||
const data = new Uint8Array(this.#buffer, offset + 4, length).slice();
|
||
info = new CssFontInfo(data.buffer);
|
||
}
|
||
return util_shadow(this, "cssFontInfo", info);
|
||
}
|
||
get systemFontInfo() {
|
||
const {
|
||
offset,
|
||
length
|
||
} = this.#getBufferOffset(0);
|
||
let info = null;
|
||
if (length) {
|
||
const data = new Uint8Array(this.#buffer, offset + 4, length).slice();
|
||
info = new SystemFontInfo(data.buffer);
|
||
}
|
||
return util_shadow(this, "systemFontInfo", info);
|
||
}
|
||
}
|
||
class PatternInfo {
|
||
constructor(buffer) {
|
||
this.buffer = buffer;
|
||
this.view = new DataView(buffer);
|
||
this.data = new Uint8Array(buffer);
|
||
}
|
||
getIR() {
|
||
const dataView = this.view;
|
||
const kind = this.data[PATTERN_INFO.KIND];
|
||
const hasBBox = !!this.data[PATTERN_INFO.HAS_BBOX];
|
||
const hasBackground = !!this.data[PATTERN_INFO.HAS_BACKGROUND];
|
||
const nCoord = dataView.getUint32(PATTERN_INFO.N_COORD, true);
|
||
const nColor = dataView.getUint32(PATTERN_INFO.N_COLOR, true);
|
||
const nStop = dataView.getUint32(PATTERN_INFO.N_STOP, true);
|
||
let offset = 20;
|
||
const coords = new Float32Array(this.buffer, offset, nCoord * 2);
|
||
offset += nCoord * 8;
|
||
const colors = new Uint8Array(this.buffer, offset, nColor * 4);
|
||
offset += nColor * 4;
|
||
const stops = [];
|
||
for (let i = 0; i < nStop; ++i) {
|
||
const p = dataView.getFloat32(offset, true);
|
||
offset += 4;
|
||
const rgb = dataView.getUint32(offset, true);
|
||
offset += 4;
|
||
stops.push([p, `#${rgb.toString(16).padStart(6, "0")}`]);
|
||
}
|
||
let bbox = null;
|
||
if (hasBBox) {
|
||
bbox = [];
|
||
for (let i = 0; i < 4; ++i) {
|
||
bbox.push(dataView.getFloat32(offset, true));
|
||
offset += 4;
|
||
}
|
||
}
|
||
let background = null;
|
||
if (hasBackground) {
|
||
background = new Uint8Array(this.buffer, offset, 3);
|
||
offset += 3;
|
||
}
|
||
if (kind === 1) {
|
||
return ["RadialAxial", "axial", bbox, stops, [coords[0], coords[1]], [coords[2], coords[3]], null, null];
|
||
}
|
||
if (kind === 2) {
|
||
return ["RadialAxial", "radial", bbox, stops, [coords[0], coords[1]], [coords[3], coords[4]], coords[2], coords[5]];
|
||
}
|
||
if (kind === 3) {
|
||
const shadingType = this.data[PATTERN_INFO.SHADING_TYPE];
|
||
let bounds = null;
|
||
if (coords.length > 0) {
|
||
bounds = BBOX_INIT.slice();
|
||
for (let i = 0, ii = coords.length; i < ii; i += 2) {
|
||
Util.pointBoundingBox(coords[i], coords[i + 1], bounds);
|
||
}
|
||
}
|
||
return ["Mesh", shadingType, coords, colors, nCoord, bounds, bbox, background];
|
||
}
|
||
throw new Error(`Unsupported pattern kind: ${kind}`);
|
||
}
|
||
}
|
||
class FontPathInfo {
|
||
#buffer;
|
||
constructor(buffer) {
|
||
this.#buffer = buffer;
|
||
}
|
||
get path() {
|
||
if (FeatureTest.isFloat16ArraySupported) {
|
||
return new Float16Array(this.#buffer);
|
||
}
|
||
return new Float32Array(this.#buffer);
|
||
}
|
||
}
|
||
|
||
;// ./src/display/pdf_objects.js
|
||
|
||
|
||
const INITIAL_DATA = Symbol("INITIAL_DATA");
|
||
const dataObj = () => ({
|
||
...Promise.withResolvers(),
|
||
data: INITIAL_DATA
|
||
});
|
||
class PDFObjects {
|
||
#objs = new Map();
|
||
get(objId, callback = null, errorCallback = null) {
|
||
if (callback) {
|
||
const obj = this.#objs.getOrInsertComputed(objId, dataObj);
|
||
obj.promise.then(() => callback(obj.data), errorCallback);
|
||
return null;
|
||
}
|
||
const obj = this.#objs.get(objId);
|
||
if (!obj || obj.data === INITIAL_DATA) {
|
||
throw new Error(`Requesting object that isn't resolved yet ${objId}.`);
|
||
}
|
||
return obj.data;
|
||
}
|
||
has(objId) {
|
||
const obj = this.#objs.get(objId);
|
||
return !!obj && obj.data !== INITIAL_DATA;
|
||
}
|
||
delete(objId) {
|
||
const obj = this.#objs.get(objId);
|
||
if (!obj || obj.data === INITIAL_DATA) {
|
||
return false;
|
||
}
|
||
this.#objs.delete(objId);
|
||
return true;
|
||
}
|
||
resolve(objId, data = null) {
|
||
const obj = this.#objs.getOrInsertComputed(objId, dataObj);
|
||
if (obj.data !== INITIAL_DATA) {
|
||
throw new Error(`Object already resolved ${objId}.`);
|
||
}
|
||
obj.data = data;
|
||
obj.resolve();
|
||
}
|
||
reject(objId, reason) {
|
||
const obj = this.#objs.getOrInsertComputed(objId, dataObj);
|
||
if (obj.data !== INITIAL_DATA) {
|
||
return;
|
||
}
|
||
obj.promise.catch(() => {});
|
||
obj.reject(reason);
|
||
}
|
||
clear() {
|
||
for (const {
|
||
data
|
||
} of this.#objs.values()) {
|
||
data?.bitmap?.close();
|
||
}
|
||
this.#objs.clear();
|
||
}
|
||
*[Symbol.iterator]() {
|
||
for (const [objId, {
|
||
data
|
||
}] of this.#objs) {
|
||
if (data !== INITIAL_DATA) {
|
||
yield [objId, data];
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
;// ./src/display/object_handler.js
|
||
|
||
|
||
|
||
|
||
|
||
class ObjectHandler {
|
||
constructor({
|
||
messageHandler,
|
||
commonObjs,
|
||
fontLoader,
|
||
pageCache,
|
||
pdfBug = false,
|
||
shouldCreatePageObjs = false
|
||
}) {
|
||
this.messageHandler = messageHandler;
|
||
this.commonObjs = commonObjs;
|
||
this.fontLoader = fontLoader;
|
||
this.pageCache = pageCache;
|
||
this.pdfBug = pdfBug;
|
||
this.shouldCreatePageObjs = shouldCreatePageObjs;
|
||
}
|
||
resolveCommonObject(id, type, exportedData) {
|
||
if (type === "CopyLocalImage") {
|
||
const {
|
||
imageRef
|
||
} = exportedData;
|
||
assert(imageRef, "The imageRef must be defined.");
|
||
for (const pageOrObjs of this.pageCache.values()) {
|
||
const objs = pageOrObjs.objs || pageOrObjs;
|
||
for (const [, data] of objs) {
|
||
if (data?.ref !== imageRef) {
|
||
continue;
|
||
}
|
||
if (!data.dataLen) {
|
||
return null;
|
||
}
|
||
const copy = structuredClone(data);
|
||
this.commonObjs.resolve(id, copy);
|
||
return data.dataLen;
|
||
}
|
||
}
|
||
return null;
|
||
}
|
||
switch (type) {
|
||
case "Font":
|
||
if ("error" in exportedData) {
|
||
const exportedError = exportedData.error;
|
||
warn(`Error during font loading: ${exportedError}`);
|
||
this.commonObjs.resolve(id, exportedError);
|
||
break;
|
||
}
|
||
const fontData = new FontInfo(exportedData.buffer);
|
||
const inspectFont = null;
|
||
const font = new FontFaceObject(fontData, inspectFont, exportedData.charProcOperatorList, exportedData.extra);
|
||
this.fontLoader.bind(font).catch(() => this.messageHandler.sendWithPromise("FontFallback", {
|
||
id
|
||
}).catch(reason => {
|
||
warn(`FontFallback failed for "${id}": ${reason}`);
|
||
})).finally(() => {
|
||
if (!font.fontExtraProperties) {
|
||
font.clearData();
|
||
}
|
||
this.commonObjs.resolve(id, font);
|
||
});
|
||
break;
|
||
case "FontPath":
|
||
this.commonObjs.resolve(id, new FontPathInfo(exportedData));
|
||
break;
|
||
case "Image":
|
||
this.commonObjs.resolve(id, exportedData);
|
||
break;
|
||
case "Pattern":
|
||
const pattern = new PatternInfo(exportedData);
|
||
this.commonObjs.resolve(id, pattern.getIR());
|
||
break;
|
||
default:
|
||
throw new Error(`Got unknown common object type ${type}`);
|
||
}
|
||
return null;
|
||
}
|
||
resolveObject(id, pageProxyId, type, exportedData) {
|
||
let pageOrObjs = this.pageCache.get(pageProxyId);
|
||
if (!pageOrObjs) {
|
||
if (!this.shouldCreatePageObjs) {
|
||
return false;
|
||
}
|
||
pageOrObjs = new PDFObjects();
|
||
this.pageCache.set(pageProxyId, pageOrObjs);
|
||
}
|
||
const objs = pageOrObjs.objs || pageOrObjs;
|
||
if (objs.has(id)) {
|
||
return false;
|
||
}
|
||
if (pageOrObjs._intentStates?.size === 0) {
|
||
exportedData?.bitmap?.close();
|
||
return false;
|
||
}
|
||
switch (type) {
|
||
case "Image":
|
||
case "Pattern":
|
||
objs.resolve(id, exportedData);
|
||
return true;
|
||
default:
|
||
throw new Error(`Got unknown object type ${type}`);
|
||
}
|
||
}
|
||
}
|
||
|
||
;// ./src/display/canvas_factory.js
|
||
|
||
class BaseCanvasFactory {
|
||
#enableHWA = false;
|
||
constructor({
|
||
enableHWA = false
|
||
}) {
|
||
this.#enableHWA = enableHWA;
|
||
}
|
||
create(width, height) {
|
||
if (width <= 0 || height <= 0) {
|
||
throw new Error("Invalid canvas size");
|
||
}
|
||
const canvas = this._createCanvas(width, height);
|
||
return {
|
||
canvas,
|
||
context: canvas.getContext("2d", {
|
||
willReadFrequently: !this.#enableHWA
|
||
})
|
||
};
|
||
}
|
||
reset({
|
||
canvas
|
||
}, width, height) {
|
||
if (!canvas) {
|
||
throw new Error("Canvas is not specified");
|
||
}
|
||
if (width <= 0 || height <= 0) {
|
||
throw new Error("Invalid canvas size");
|
||
}
|
||
canvas.width = width;
|
||
canvas.height = height;
|
||
}
|
||
destroy(canvasAndContext) {
|
||
const {
|
||
canvas
|
||
} = canvasAndContext;
|
||
if (!canvas) {
|
||
throw new Error("Canvas is not specified");
|
||
}
|
||
canvas.width = canvas.height = 0;
|
||
canvasAndContext.canvas = null;
|
||
canvasAndContext.context = null;
|
||
}
|
||
getNoAlphaContext(canvas) {
|
||
return canvas.getContext("2d", {
|
||
alpha: false,
|
||
willReadFrequently: !this.#enableHWA
|
||
});
|
||
}
|
||
_createCanvas(width, height) {
|
||
unreachable("Abstract method `_createCanvas` called.");
|
||
}
|
||
}
|
||
|
||
;// ./src/display/offscreen_canvas_factory.js
|
||
|
||
class OffscreenCanvasFactory extends BaseCanvasFactory {
|
||
_createCanvas(width, height) {
|
||
return new OffscreenCanvas(width, height);
|
||
}
|
||
}
|
||
|
||
;// ./src/shared/murmurhash3.js
|
||
|
||
|
||
|
||
|
||
|
||
const SEED = 0xc3d2e1f0;
|
||
const MASK_HIGH = 0xffff0000;
|
||
const MASK_LOW = 0xffff;
|
||
class MurmurHash3_64 {
|
||
constructor(seed) {
|
||
this.h1 = seed ? seed & 0xffffffff : SEED;
|
||
this.h2 = seed ? seed & 0xffffffff : SEED;
|
||
}
|
||
update(input) {
|
||
let data, length;
|
||
if (typeof input === "string") {
|
||
data = new Uint8Array(input.length * 2);
|
||
length = 0;
|
||
for (let i = 0, ii = input.length; i < ii; i++) {
|
||
const code = input.charCodeAt(i);
|
||
if (code <= 0xff) {
|
||
data[length++] = code;
|
||
} else {
|
||
data[length++] = code >>> 8;
|
||
data[length++] = code & 0xff;
|
||
}
|
||
}
|
||
} else if (ArrayBuffer.isView(input)) {
|
||
data = input.slice();
|
||
length = data.byteLength;
|
||
} else {
|
||
throw new Error("Invalid data format, must be a string or TypedArray.");
|
||
}
|
||
const blockCounts = length >> 2;
|
||
const tailLength = length - blockCounts * 4;
|
||
const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
|
||
let k1 = 0,
|
||
k2 = 0;
|
||
let h1 = this.h1,
|
||
h2 = this.h2;
|
||
const C1 = 0xcc9e2d51,
|
||
C2 = 0x1b873593;
|
||
const C1_LOW = C1 & MASK_LOW,
|
||
C2_LOW = C2 & MASK_LOW;
|
||
for (let i = 0; i < blockCounts; i++) {
|
||
if (i & 1) {
|
||
k1 = dataUint32[i];
|
||
k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
|
||
k1 = k1 << 15 | k1 >>> 17;
|
||
k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
|
||
h1 ^= k1;
|
||
h1 = h1 << 13 | h1 >>> 19;
|
||
h1 = h1 * 5 + 0xe6546b64;
|
||
} else {
|
||
k2 = dataUint32[i];
|
||
k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
|
||
k2 = k2 << 15 | k2 >>> 17;
|
||
k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
|
||
h2 ^= k2;
|
||
h2 = h2 << 13 | h2 >>> 19;
|
||
h2 = h2 * 5 + 0xe6546b64;
|
||
}
|
||
}
|
||
k1 = 0;
|
||
switch (tailLength) {
|
||
case 3:
|
||
k1 ^= data[blockCounts * 4 + 2] << 16;
|
||
case 2:
|
||
k1 ^= data[blockCounts * 4 + 1] << 8;
|
||
case 1:
|
||
k1 ^= data[blockCounts * 4];
|
||
k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
|
||
k1 = k1 << 15 | k1 >>> 17;
|
||
k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
|
||
if (blockCounts & 1) {
|
||
h1 ^= k1;
|
||
} else {
|
||
h2 ^= k1;
|
||
}
|
||
}
|
||
this.h1 = h1;
|
||
this.h2 = h2;
|
||
}
|
||
hexdigest() {
|
||
let h1 = this.h1,
|
||
h2 = this.h2;
|
||
h1 ^= h2 >>> 1;
|
||
h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
|
||
h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
|
||
h1 ^= h2 >>> 1;
|
||
h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
|
||
h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
|
||
h1 ^= h2 >>> 1;
|
||
return (h1 >>> 0).toString(16).padStart(8, "0") + (h2 >>> 0).toString(16).padStart(8, "0");
|
||
}
|
||
}
|
||
|
||
;// ./src/display/optional_content_config.js
|
||
|
||
|
||
|
||
|
||
const INTERNAL = Symbol("INTERNAL");
|
||
class OptionalContentGroup {
|
||
#isDisplay = false;
|
||
#isPrint = false;
|
||
#userSet = false;
|
||
#visible = true;
|
||
constructor(renderingIntent, {
|
||
name,
|
||
intent,
|
||
usage,
|
||
rbGroups
|
||
}) {
|
||
this.#isDisplay = !!(renderingIntent & RenderingIntentFlag.DISPLAY);
|
||
this.#isPrint = !!(renderingIntent & RenderingIntentFlag.PRINT);
|
||
this.name = name;
|
||
this.intent = intent;
|
||
this.usage = usage;
|
||
this.rbGroups = rbGroups;
|
||
}
|
||
get visible() {
|
||
if (this.#userSet) {
|
||
return this.#visible;
|
||
}
|
||
if (!this.#visible) {
|
||
return false;
|
||
}
|
||
const {
|
||
print,
|
||
view
|
||
} = this.usage;
|
||
if (this.#isDisplay) {
|
||
return view?.viewState !== "OFF";
|
||
} else if (this.#isPrint) {
|
||
return print?.printState !== "OFF";
|
||
}
|
||
return true;
|
||
}
|
||
_setVisible(internal, visible, userSet = false) {
|
||
if (internal !== INTERNAL) {
|
||
unreachable("Internal method `_setVisible` called.");
|
||
}
|
||
this.#userSet = userSet;
|
||
this.#visible = visible;
|
||
}
|
||
get serializable() {
|
||
return {
|
||
userSet: this.#userSet,
|
||
visible: this.#visible
|
||
};
|
||
}
|
||
}
|
||
class OptionalContentConfig {
|
||
#cachedGetHash = null;
|
||
#groups = new Map();
|
||
#initialHash = null;
|
||
#order = null;
|
||
#rawData;
|
||
creator = null;
|
||
name = null;
|
||
constructor(data, renderingIntent = RenderingIntentFlag.DISPLAY, groupState = null) {
|
||
this.#rawData = data;
|
||
this.renderingIntent = renderingIntent;
|
||
if (data === null) {
|
||
return;
|
||
}
|
||
this.name = data.name;
|
||
this.creator = data.creator;
|
||
this.#order = data.order;
|
||
for (const group of data.groups) {
|
||
this.#groups.set(group.id, new OptionalContentGroup(renderingIntent, group));
|
||
}
|
||
if (groupState) {
|
||
if (groupState.size !== this.#groups.size) {
|
||
unreachable("Incorrect serialized groupState.");
|
||
}
|
||
for (const [id, group] of groupState) {
|
||
this.#groups.get(id)._setVisible(INTERNAL, group.visible, group.userSet);
|
||
}
|
||
} else {
|
||
if (data.baseState === "OFF") {
|
||
for (const group of this.#groups.values()) {
|
||
group._setVisible(INTERNAL, false);
|
||
}
|
||
}
|
||
for (const on of data.on) {
|
||
this.#groups.get(on)._setVisible(INTERNAL, true);
|
||
}
|
||
for (const off of data.off) {
|
||
this.#groups.get(off)._setVisible(INTERNAL, false);
|
||
}
|
||
}
|
||
this.#initialHash = this.getHash();
|
||
}
|
||
#evaluateVisibilityExpression(array) {
|
||
const length = array.length;
|
||
if (length < 2) {
|
||
return true;
|
||
}
|
||
const operator = array[0];
|
||
for (let i = 1; i < length; i++) {
|
||
const element = array[i];
|
||
let state;
|
||
if (Array.isArray(element)) {
|
||
state = this.#evaluateVisibilityExpression(element);
|
||
} else if (this.#groups.has(element)) {
|
||
state = this.#groups.get(element).visible;
|
||
} else {
|
||
warn(`Optional content group not found: ${element}`);
|
||
return true;
|
||
}
|
||
switch (operator) {
|
||
case "And":
|
||
if (!state) {
|
||
return false;
|
||
}
|
||
break;
|
||
case "Or":
|
||
if (state) {
|
||
return true;
|
||
}
|
||
break;
|
||
case "Not":
|
||
return !state;
|
||
default:
|
||
return true;
|
||
}
|
||
}
|
||
return operator === "And";
|
||
}
|
||
isVisible(group) {
|
||
if (this.#groups.size === 0) {
|
||
return true;
|
||
}
|
||
if (!group) {
|
||
info("Optional content group not defined.");
|
||
return true;
|
||
}
|
||
if (group.type === "OCG") {
|
||
if (!this.#groups.has(group.id)) {
|
||
warn(`Optional content group not found: ${group.id}`);
|
||
return true;
|
||
}
|
||
return this.#groups.get(group.id).visible;
|
||
} else if (group.type === "OCMD") {
|
||
if (group.expression) {
|
||
return this.#evaluateVisibilityExpression(group.expression);
|
||
}
|
||
if (!group.policy || group.policy === "AnyOn") {
|
||
for (const id of group.ids) {
|
||
if (!this.#groups.has(id)) {
|
||
warn(`Optional content group not found: ${id}`);
|
||
return true;
|
||
}
|
||
if (this.#groups.get(id).visible) {
|
||
return true;
|
||
}
|
||
}
|
||
return false;
|
||
} else if (group.policy === "AllOn") {
|
||
for (const id of group.ids) {
|
||
if (!this.#groups.has(id)) {
|
||
warn(`Optional content group not found: ${id}`);
|
||
return true;
|
||
}
|
||
if (!this.#groups.get(id).visible) {
|
||
return false;
|
||
}
|
||
}
|
||
return true;
|
||
} else if (group.policy === "AnyOff") {
|
||
for (const id of group.ids) {
|
||
if (!this.#groups.has(id)) {
|
||
warn(`Optional content group not found: ${id}`);
|
||
return true;
|
||
}
|
||
if (!this.#groups.get(id).visible) {
|
||
return true;
|
||
}
|
||
}
|
||
return false;
|
||
} else if (group.policy === "AllOff") {
|
||
for (const id of group.ids) {
|
||
if (!this.#groups.has(id)) {
|
||
warn(`Optional content group not found: ${id}`);
|
||
return true;
|
||
}
|
||
if (this.#groups.get(id).visible) {
|
||
return false;
|
||
}
|
||
}
|
||
return true;
|
||
}
|
||
warn(`Unknown optional content policy ${group.policy}.`);
|
||
return true;
|
||
}
|
||
warn(`Unknown group type ${group.type}.`);
|
||
return true;
|
||
}
|
||
setVisibility(id, visible = true, preserveRB = true) {
|
||
throw new Error("Not implemented: setVisibility");
|
||
}
|
||
setOCGState({
|
||
state,
|
||
preserveRB
|
||
}) {
|
||
throw new Error("Not implemented: setOCGState");
|
||
}
|
||
get hasInitialVisibility() {
|
||
return this.#initialHash === null || this.getHash() === this.#initialHash;
|
||
}
|
||
getOrder() {
|
||
throw new Error("Not implemented: getOrder");
|
||
}
|
||
getGroup(id) {
|
||
return this.#groups.get(id) || null;
|
||
}
|
||
getHash() {
|
||
if (this.#cachedGetHash !== null) {
|
||
return this.#cachedGetHash;
|
||
}
|
||
const hash = new MurmurHash3_64();
|
||
for (const [id, group] of this.#groups) {
|
||
hash.update(`${id}:${group.visible}`);
|
||
}
|
||
return this.#cachedGetHash = hash.hexdigest();
|
||
}
|
||
[Symbol.iterator]() {
|
||
return this.#groups.entries();
|
||
}
|
||
get serializable() {
|
||
const groupState = new Map();
|
||
for (const [id, group] of this.#groups) {
|
||
groupState.set(id, group.serializable);
|
||
}
|
||
return {
|
||
data: this.#rawData,
|
||
renderingIntent: this.renderingIntent,
|
||
groupState
|
||
};
|
||
}
|
||
static fromSerializable({
|
||
data,
|
||
renderingIntent,
|
||
groupState
|
||
}) {
|
||
return new OptionalContentConfig(data, renderingIntent, groupState);
|
||
}
|
||
}
|
||
|
||
;// ./src/display/filter_factory.js
|
||
|
||
class BaseFilterFactory {
|
||
addFilter(maps) {
|
||
return "none";
|
||
}
|
||
addHCMFilter(fgColor, bgColor) {
|
||
return "none";
|
||
}
|
||
addAlphaFilter(map) {
|
||
return "none";
|
||
}
|
||
addLuminosityFilter(map) {
|
||
return "none";
|
||
}
|
||
addKnockoutFilter(alpha = 0) {
|
||
return "none";
|
||
}
|
||
addHighlightHCMFilter(filterName, fgColor, bgColor, newFgColor, newBgColor) {
|
||
return "none";
|
||
}
|
||
addSelectionHCMFilter(fgColor, bgColor) {
|
||
return "none";
|
||
}
|
||
addSelectionFilter() {
|
||
return "none";
|
||
}
|
||
createSelectionStyle(pageColors = null) {
|
||
return null;
|
||
}
|
||
destroy(keepHCM = false) {}
|
||
}
|
||
|
||
;// ./src/display/worker_filter_factory.js
|
||
|
||
class WorkerFilterFactory extends BaseFilterFactory {}
|
||
|
||
;// ./src/display/renderer_worker.js
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
const PARTIAL_FRAME_TIME = 500;
|
||
class RendererMessageHandler {
|
||
static #canvasFactory;
|
||
static #commonObjs = new PDFObjects();
|
||
static #connection = null;
|
||
static #enableHWA = false;
|
||
static #enableWebGPU = false;
|
||
static #filterFactory;
|
||
static #fontLoader = new FontLoader({
|
||
ownerDocument: globalThis
|
||
});
|
||
static #hasMeshPattern = false;
|
||
static #objsMap = new Map();
|
||
static #operatorLists = new Map();
|
||
static #renderTaskStates = new Map();
|
||
static #yieldChannel = null;
|
||
static #yieldResolvers = [];
|
||
static {
|
||
if (typeof window === "undefined" && !isNodeJS && typeof self !== "undefined" && typeof self.postMessage === "function" && "onmessage" in self) {
|
||
this.#initializeFromPort(self);
|
||
}
|
||
}
|
||
static #getPageObjs(pageProxyId) {
|
||
return this.#objsMap.getOrInsertComputed(pageProxyId, () => new PDFObjects());
|
||
}
|
||
static #getOperatorList(pageProxyId, operatorListId) {
|
||
return this.#operatorLists.getOrInsertComputed(pageProxyId, makeMap).getOrInsertComputed(operatorListId, () => ({
|
||
fnArray: [],
|
||
argsArray: [],
|
||
pathCache: new Map()
|
||
}));
|
||
}
|
||
static #collectAnnotationBitmaps(renderTaskState, transfers) {
|
||
const map = renderTaskState.gfx?.annotationCanvasMap;
|
||
if (!map?.size) {
|
||
return null;
|
||
}
|
||
const tuples = [];
|
||
for (const [id, value] of map) {
|
||
for (const canvas of Array.isArray(value) ? value : [value]) {
|
||
const bitmap = canvas.transferToImageBitmap();
|
||
tuples.push([id, getAnnotationCanvasName(canvas), bitmap]);
|
||
transfers.push(bitmap);
|
||
}
|
||
}
|
||
return tuples;
|
||
}
|
||
static async #sendFrame(handler, renderTaskState, isFinal) {
|
||
const {
|
||
canvas,
|
||
renderTaskId
|
||
} = renderTaskState;
|
||
let bitmap = null;
|
||
if (canvas.width === 0 || canvas.height === 0) {
|
||
if (!isFinal) {
|
||
return;
|
||
}
|
||
} else if (isFinal) {
|
||
bitmap = canvas.transferToImageBitmap();
|
||
} else {
|
||
const {
|
||
transparentCanvas
|
||
} = renderTaskState.gfx;
|
||
if (transparentCanvas) {
|
||
const composite = new OffscreenCanvas(canvas.width, canvas.height);
|
||
const ctx = composite.getContext("2d");
|
||
ctx.drawImage(canvas, 0, 0);
|
||
ctx.drawImage(transparentCanvas, 0, 0);
|
||
bitmap = composite.transferToImageBitmap();
|
||
composite.width = composite.height = 0;
|
||
} else {
|
||
bitmap = await createImageBitmap(canvas);
|
||
if (renderTaskState.aborted) {
|
||
bitmap.close();
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
const transfers = bitmap ? [bitmap] : [];
|
||
const annotationBitmaps = isFinal ? this.#collectAnnotationBitmaps(renderTaskState, transfers) : null;
|
||
handler.send("RenderFrame", {
|
||
renderTaskId,
|
||
bitmap,
|
||
annotationBitmaps
|
||
}, transfers);
|
||
}
|
||
static async #maybeSendInterimFrame(handler, renderTaskState) {
|
||
if (!renderTaskState.partialFrames || renderTaskState.aborted || Date.now() - renderTaskState.lastFrameTime < PARTIAL_FRAME_TIME || renderTaskState.operatorListIdx === renderTaskState.lastFrameIdx) {
|
||
return;
|
||
}
|
||
try {
|
||
await this.#sendFrame(handler, renderTaskState, false);
|
||
} catch (ex) {
|
||
warn(`Failed to send an interim frame: ${ex.message}`);
|
||
}
|
||
renderTaskState.lastFrameTime = Date.now();
|
||
renderTaskState.lastFrameIdx = renderTaskState.operatorListIdx;
|
||
}
|
||
static #cleanupPage(pageProxyId) {
|
||
this.#objsMap.get(pageProxyId)?.clear();
|
||
this.#objsMap.delete(pageProxyId);
|
||
this.#operatorLists.delete(pageProxyId);
|
||
for (const [renderTaskId, renderTaskState] of this.#renderTaskStates) {
|
||
if (renderTaskState.pageProxyId === pageProxyId) {
|
||
this.#cleanupRenderTask(renderTaskId);
|
||
}
|
||
}
|
||
}
|
||
static #cleanupRenderTask(renderTaskId, keepCanvas = false) {
|
||
const renderTaskState = this.#renderTaskStates.get(renderTaskId);
|
||
if (!renderTaskState) {
|
||
return;
|
||
}
|
||
renderTaskState.aborted = true;
|
||
renderTaskState.continueResolve?.();
|
||
renderTaskState.gfx?.endDrawing();
|
||
if (!keepCanvas) {
|
||
this.#releaseCanvases(renderTaskState);
|
||
}
|
||
this.#renderTaskStates.delete(renderTaskId);
|
||
}
|
||
static #releaseCanvases({
|
||
canvas,
|
||
gfx
|
||
}) {
|
||
canvas.width = canvas.height = 0;
|
||
const map = gfx?.annotationCanvasMap;
|
||
if (!map) {
|
||
return;
|
||
}
|
||
for (const value of map.values()) {
|
||
for (const annotationCanvas of Array.isArray(value) ? value : [value]) {
|
||
annotationCanvas.width = annotationCanvas.height = 0;
|
||
}
|
||
}
|
||
map.clear();
|
||
}
|
||
static #appendFromSharedOperatorList(renderTaskState, length, operationsFilterMask, lastChunk) {
|
||
const {
|
||
operatorList,
|
||
sharedOperatorList
|
||
} = renderTaskState;
|
||
const {
|
||
fnArray,
|
||
argsArray
|
||
} = sharedOperatorList;
|
||
for (let i = operatorList.fnArray.length; i < length; i++) {
|
||
operatorList.fnArray.push(fnArray[i]);
|
||
operatorList.argsArray.push(argsArray[i]);
|
||
}
|
||
if (operationsFilterMask) {
|
||
const mask = renderTaskState.operationsFilterMask ||= [];
|
||
for (let i = 0, ii = operationsFilterMask.length; i < ii; i++) {
|
||
mask.push(operationsFilterMask[i]);
|
||
}
|
||
}
|
||
operatorList.lastChunk = lastChunk;
|
||
renderTaskState.dependencyTracker?.growOperationsCount(operatorList.fnArray.length);
|
||
}
|
||
static async #executeOperatorList(handler, renderTaskState) {
|
||
const {
|
||
operatorList,
|
||
gfx,
|
||
operationsFilterMask
|
||
} = renderTaskState;
|
||
const operationsFilter = operationsFilterMask ? i => operationsFilterMask[i] : null;
|
||
while (!renderTaskState.aborted) {
|
||
const {
|
||
promise,
|
||
resolve,
|
||
reject
|
||
} = Promise.withResolvers();
|
||
renderTaskState.continueResolve = resolve;
|
||
renderTaskState.operatorListIdx = gfx.executeOperatorList(operatorList, renderTaskState.operatorListIdx, resolve, reject, undefined, operationsFilter);
|
||
if (renderTaskState.operatorListIdx === operatorList.argsArray.length) {
|
||
return renderTaskState.operatorListIdx;
|
||
}
|
||
await this.#maybeSendInterimFrame(handler, renderTaskState);
|
||
await promise;
|
||
if (renderTaskState.aborted) {
|
||
break;
|
||
}
|
||
await this.#yield();
|
||
}
|
||
return renderTaskState.operatorListIdx;
|
||
}
|
||
static #yield() {
|
||
if (!this.#yieldChannel) {
|
||
this.#yieldChannel = new MessageChannel();
|
||
this.#yieldChannel.port1.onmessage = () => {
|
||
this.#yieldResolvers.shift()();
|
||
};
|
||
}
|
||
const {
|
||
promise,
|
||
resolve
|
||
} = Promise.withResolvers();
|
||
this.#yieldResolvers.push(resolve);
|
||
this.#yieldChannel.port2.postMessage(null);
|
||
return promise;
|
||
}
|
||
static #setupObjectHandler(handler) {
|
||
const objectHandler = new ObjectHandler({
|
||
messageHandler: handler,
|
||
commonObjs: this.#commonObjs,
|
||
fontLoader: this.#fontLoader,
|
||
pageCache: this.#objsMap,
|
||
shouldCreatePageObjs: true
|
||
});
|
||
handler.on("commonobj", ([id, type, exportedData]) => {
|
||
if (this.#commonObjs.has(id)) {
|
||
return;
|
||
}
|
||
objectHandler.resolveCommonObject(id, type, exportedData);
|
||
if (type === "Pattern" && this.#commonObjs.get(id)[0] === "Mesh") {
|
||
this.#hasMeshPattern = true;
|
||
}
|
||
});
|
||
handler.on("obj", ([id, pageProxyId, type, imageData]) => {
|
||
if (type === "Pattern" && imageData[0] === "Mesh") {
|
||
this.#hasMeshPattern = true;
|
||
}
|
||
objectHandler.resolveObject(id, pageProxyId, type, imageData);
|
||
});
|
||
handler.on("objFailed", ({
|
||
id,
|
||
pageProxyId,
|
||
reason
|
||
}) => {
|
||
const error = new Error(reason);
|
||
if (pageProxyId === null) {
|
||
this.#commonObjs.reject(id, error);
|
||
return;
|
||
}
|
||
this.#getPageObjs(pageProxyId).reject(id, error);
|
||
});
|
||
}
|
||
static #setup(handler) {
|
||
handler.on("configure", data => {
|
||
setVerbosityLevel(data.verbosity);
|
||
this.#enableHWA = data.enableHWA;
|
||
this.#enableWebGPU = data.enableWebGPU;
|
||
if (this.#enableWebGPU) {
|
||
initGPU();
|
||
}
|
||
});
|
||
this.#setupObjectHandler(handler);
|
||
handler.on("cleanupPage", ({
|
||
pageProxyId
|
||
}) => {
|
||
this.#cleanupPage(pageProxyId);
|
||
});
|
||
handler.on("Cleanup", ({
|
||
keepLoadedFonts
|
||
}) => {
|
||
this.#commonObjs.clear();
|
||
if (!keepLoadedFonts) {
|
||
this.#fontLoader.clear();
|
||
}
|
||
this.#filterFactory?.destroy(true);
|
||
});
|
||
handler.on("CleanupRenderTask", ({
|
||
renderTaskId
|
||
}) => {
|
||
this.#cleanupRenderTask(renderTaskId);
|
||
});
|
||
handler.on("AppendOperatorList", ({
|
||
pageProxyId,
|
||
operatorListId,
|
||
fnArray,
|
||
argsArray
|
||
}) => {
|
||
const operatorList = this.#getOperatorList(pageProxyId, operatorListId);
|
||
for (let i = 0, ii = fnArray.length; i < ii; i++) {
|
||
operatorList.fnArray.push(fnArray[i]);
|
||
operatorList.argsArray.push(argsArray[i]);
|
||
}
|
||
});
|
||
handler.on("InitializeGraphics", async data => {
|
||
const {
|
||
width,
|
||
height,
|
||
pageProxyId,
|
||
operatorListId,
|
||
renderTaskId,
|
||
hasAnnotationCanvasMap = false,
|
||
transform,
|
||
viewport,
|
||
transparency,
|
||
background,
|
||
pixelRatio,
|
||
recordOperations = false,
|
||
recordImages = false,
|
||
partialFrames = false
|
||
} = data;
|
||
const canvas = new OffscreenCanvas(width, height);
|
||
const sharedOperatorList = this.#getOperatorList(pageProxyId, operatorListId);
|
||
const renderTaskState = {
|
||
pageProxyId,
|
||
renderTaskId,
|
||
canvas,
|
||
partialFrames,
|
||
lastFrameTime: Date.now(),
|
||
gfx: null,
|
||
sharedOperatorList,
|
||
dependencyTracker: null,
|
||
imagesTracker: null,
|
||
operatorList: {
|
||
fnArray: [],
|
||
argsArray: [],
|
||
lastChunk: false,
|
||
pathCache: sharedOperatorList.pathCache
|
||
},
|
||
operatorListIdx: 0,
|
||
lastFrameIdx: 0,
|
||
operationsFilterMask: null,
|
||
continueResolve: null,
|
||
aborted: false
|
||
};
|
||
this.#renderTaskStates.set(renderTaskId, renderTaskState);
|
||
try {
|
||
const objs = this.#getPageObjs(pageProxyId);
|
||
const optionalContentConfig = OptionalContentConfig.fromSerializable(data.optionalContentConfig);
|
||
const canvasFactory = this.#canvasFactory ??= new OffscreenCanvasFactory({
|
||
enableHWA: this.#enableHWA
|
||
});
|
||
const filterFactory = this.#filterFactory ??= new WorkerFilterFactory();
|
||
const annotationCanvases = hasAnnotationCanvasMap ? new Map() : null;
|
||
const {
|
||
dependencyTracker,
|
||
imagesTracker
|
||
} = createCanvasTrackers(canvas, 0, {
|
||
recordOperations,
|
||
recordImages
|
||
});
|
||
const gfx = new CanvasGraphics(canvasFactory.getNoAlphaContext(canvas), this.#commonObjs, objs, canvasFactory, filterFactory, {
|
||
optionalContentConfig,
|
||
pixelRatio
|
||
}, annotationCanvases, null, dependencyTracker, imagesTracker);
|
||
gfx.beginDrawing({
|
||
transform,
|
||
viewport,
|
||
transparency,
|
||
background
|
||
});
|
||
renderTaskState.gfx = gfx;
|
||
renderTaskState.dependencyTracker = dependencyTracker;
|
||
renderTaskState.imagesTracker = imagesTracker;
|
||
} catch (ex) {
|
||
this.#cleanupRenderTask(renderTaskId);
|
||
throw ex;
|
||
}
|
||
});
|
||
handler.on("ExecuteOperatorList", async data => {
|
||
const {
|
||
renderTaskId,
|
||
operatorListIdx,
|
||
operatorListLength,
|
||
operationsFilterMask,
|
||
lastChunk
|
||
} = data;
|
||
const renderTaskState = this.#renderTaskStates.get(renderTaskId);
|
||
if (!renderTaskState) {
|
||
return {
|
||
operatorListIdx,
|
||
aborted: true
|
||
};
|
||
}
|
||
if (this.#hasMeshPattern && this.#enableWebGPU && !isGPUReady()) {
|
||
await initGPU();
|
||
if (renderTaskState.aborted) {
|
||
return {
|
||
operatorListIdx,
|
||
aborted: true
|
||
};
|
||
}
|
||
}
|
||
renderTaskState.operatorListIdx = operatorListIdx;
|
||
this.#appendFromSharedOperatorList(renderTaskState, operatorListLength, operationsFilterMask, lastChunk);
|
||
const currentOperatorListIdx = await this.#executeOperatorList(handler, renderTaskState);
|
||
let recordedBBoxesBuffer = null;
|
||
let imageCoordinates = null;
|
||
if (renderTaskState.operatorList.lastChunk && currentOperatorListIdx === renderTaskState.operatorList.argsArray.length) {
|
||
recordedBBoxesBuffer = renderTaskState.dependencyTracker?.take().buffer ?? null;
|
||
imageCoordinates = renderTaskState.imagesTracker?.take() ?? null;
|
||
const aborted = renderTaskState.aborted;
|
||
this.#cleanupRenderTask(renderTaskId, !aborted);
|
||
if (!aborted) {
|
||
try {
|
||
await this.#sendFrame(handler, renderTaskState, true);
|
||
} finally {
|
||
this.#releaseCanvases(renderTaskState);
|
||
}
|
||
}
|
||
} else {
|
||
await this.#maybeSendInterimFrame(handler, renderTaskState);
|
||
}
|
||
return {
|
||
operatorListIdx: currentOperatorListIdx,
|
||
recordedBBoxesBuffer,
|
||
imageCoordinates
|
||
};
|
||
});
|
||
}
|
||
static #initializeFromPort(port) {
|
||
const handler = new MessageHandler("renderer", "main", port);
|
||
this.#setup(handler);
|
||
handler.on("Connect", ({
|
||
sourceName,
|
||
targetName
|
||
}) => {
|
||
this.#disconnect();
|
||
const connection = new MessageHandler(sourceName, targetName, port);
|
||
this.#connection = connection;
|
||
this.#setup(connection);
|
||
connection.on("Disconnect", () => {
|
||
this.#disconnect();
|
||
});
|
||
this.#sendReady(connection);
|
||
});
|
||
this.#sendReady(handler);
|
||
}
|
||
static #disconnect() {
|
||
if (!this.#connection) {
|
||
return;
|
||
}
|
||
for (const renderTaskId of this.#renderTaskStates.keys()) {
|
||
this.#cleanupRenderTask(renderTaskId);
|
||
}
|
||
for (const objs of this.#objsMap.values()) {
|
||
objs.clear();
|
||
}
|
||
this.#objsMap.clear();
|
||
this.#operatorLists.clear();
|
||
this.#hasMeshPattern = false;
|
||
this.#commonObjs.clear();
|
||
this.#fontLoader.clear();
|
||
this.#commonObjs = new PDFObjects();
|
||
this.#fontLoader = new FontLoader({
|
||
ownerDocument: globalThis
|
||
});
|
||
this.#canvasFactory = null;
|
||
this.#filterFactory?.destroy();
|
||
this.#filterFactory = null;
|
||
this.#connection.send("Disconnected", null);
|
||
this.#connection.destroy();
|
||
this.#connection = null;
|
||
}
|
||
static #sendReady(handler) {
|
||
const workerVersion = "6.5.438";
|
||
const testObj = new Uint8Array();
|
||
handler.send("ready", {
|
||
testObj,
|
||
workerVersion
|
||
}, [testObj.buffer]);
|
||
}
|
||
}
|
||
|
||
;// ./src/pdf.renderer.js
|
||
|
||
|
||
//# sourceMappingURL=pdf.renderer.mjs.map
|