1/** 2 * @licstart The following is the entire license notice for the 3 * JavaScript code in this page 4 * 5 * Copyright 2024 Mozilla Foundation 6 * 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 * 19 * @licend The above is the entire license notice for the 20 * JavaScript code in this page 21 */ 22 23/** 24 * pdfjsVersion = 5.7.284 25 * pdfjsBuild = 7e5b36c2d 26 */ 27/******/ var __webpack_modules__ = ({ 28 29/***/ 9306 30(module, __unused_webpack_exports, __webpack_require__) { 31 32 33var isCallable = __webpack_require__(4901); 34var tryToString = __webpack_require__(6823); 35 36var $TypeError = TypeError; 37 38// `Assert: IsCallable(argument) is true` 39module.exports = function (argument) { 40 if (isCallable(argument)) return argument; 41 throw new $TypeError(tryToString(argument) + ' is not a function'); 42}; 43 44 45/***/ }, 46 47/***/ 3506 48(module, __unused_webpack_exports, __webpack_require__) { 49 50 51var isPossiblePrototype = __webpack_require__(3925); 52 53var $String = String; 54var $TypeError = TypeError; 55 56module.exports = function (argument) { 57 if (isPossiblePrototype(argument)) return argument; 58 throw new $TypeError("Can't set " + $String(argument) + ' as a prototype'); 59}; 60 61 62/***/ }, 63 64/***/ 7080 65(module, __unused_webpack_exports, __webpack_require__) { 66 67 68var has = (__webpack_require__(4402).has); 69 70// Perform ? RequireInternalSlot(M, [[SetData]]) 71module.exports = function (it) { 72 has(it); 73 return it; 74}; 75 76 77/***/ }, 78 79/***/ 3463 80(module) { 81 82 83var $TypeError = TypeError; 84 85module.exports = function (argument) { 86 if (typeof argument == 'string') return argument; 87 throw new $TypeError('Argument is not a string'); 88}; 89 90 91/***/ }, 92 93/***/ 4328 94(module, __unused_webpack_exports, __webpack_require__) { 95 96 97var WeakMapHelpers = __webpack_require__(4995); 98 99var weakmap = new WeakMapHelpers.WeakMap(); 100var set = WeakMapHelpers.set; 101var remove = WeakMapHelpers.remove; 102 103module.exports = function (key) { 104 set(weakmap, key, 1); 105 remove(weakmap, key); 106 return key; 107}; 108 109 110/***/ }, 111 112/***/ 6557 113(module, __unused_webpack_exports, __webpack_require__) { 114 115 116var has = (__webpack_require__(4995).has); 117 118// Perform ? RequireInternalSlot(M, [[WeakMapData]]) 119module.exports = function (it) { 120 has(it); 121 return it; 122}; 123 124 125/***/ }, 126 127/***/ 6469 128(module, __unused_webpack_exports, __webpack_require__) { 129 130 131var wellKnownSymbol = __webpack_require__(8227); 132var create = __webpack_require__(2360); 133var defineProperty = (__webpack_require__(4913).f); 134 135var UNSCOPABLES = wellKnownSymbol('unscopables'); 136var ArrayPrototype = Array.prototype; 137 138// Array.prototype[@@unscopables] 139// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables 140if (ArrayPrototype[UNSCOPABLES] === undefined) { 141 defineProperty(ArrayPrototype, UNSCOPABLES, { 142 configurable: true, 143 value: create(null) 144 }); 145} 146 147// add a key to Array.prototype[@@unscopables] 148module.exports = function (key) { 149 ArrayPrototype[UNSCOPABLES][key] = true; 150}; 151 152 153/***/ }, 154 155/***/ 679 156(module, __unused_webpack_exports, __webpack_require__) { 157 158 159var isPrototypeOf = __webpack_require__(1625); 160 161var $TypeError = TypeError; 162 163module.exports = function (it, Prototype) { 164 if (isPrototypeOf(Prototype, it)) return it; 165 throw new $TypeError('Incorrect invocation'); 166}; 167 168 169/***/ }, 170 171/***/ 3972 172(module, __unused_webpack_exports, __webpack_require__) { 173 174 175var isObject = __webpack_require__(34); 176 177var $String = String; 178var $TypeError = TypeError; 179 180module.exports = function (argument) { 181 if (argument === undefined || isObject(argument)) return argument; 182 throw new $TypeError($String(argument) + ' is not an object or undefined'); 183}; 184 185 186/***/ }, 187 188/***/ 8551 189(module, __unused_webpack_exports, __webpack_require__) { 190 191 192var isObject = __webpack_require__(34); 193 194var $String = String; 195var $TypeError = TypeError; 196 197// `Assert: Type(argument) is Object` 198module.exports = function (argument) { 199 if (isObject(argument)) return argument; 200 throw new $TypeError($String(argument) + ' is not an object'); 201}; 202 203 204/***/ }, 205 206/***/ 4154 207(module, __unused_webpack_exports, __webpack_require__) { 208 209 210var classof = __webpack_require__(6955); 211 212var $TypeError = TypeError; 213 214// Perform ? RequireInternalSlot(argument, [[TypedArrayName]]) 215// If argument.[[TypedArrayName]] is not "Uint8Array", throw a TypeError exception 216module.exports = function (argument) { 217 if (classof(argument) === 'Uint8Array') return argument; 218 throw new $TypeError('Argument is not an Uint8Array'); 219}; 220 221 222/***/ }, 223 224/***/ 7811 225(module) { 226 227 228// eslint-disable-next-line es/no-typed-arrays -- safe 229module.exports = typeof ArrayBuffer != 'undefined' && typeof DataView != 'undefined'; 230 231 232/***/ }, 233 234/***/ 7394 235(module, __unused_webpack_exports, __webpack_require__) { 236 237 238var globalThis = __webpack_require__(4576); 239var uncurryThisAccessor = __webpack_require__(6706); 240var classof = __webpack_require__(2195); 241 242var ArrayBuffer = globalThis.ArrayBuffer; 243var TypeError = globalThis.TypeError; 244 245// Includes
vendor: 12,274 bytes, lines 246-591
246// - Perform ? RequireInternalSlot(O, [[ArrayBufferData]]). 247// - If IsSharedArrayBuffer(O) is true, throw a TypeError exception. 248module.exports = ArrayBuffer && uncurryThisAccessor(ArrayBuffer.prototype, 'byteLength', 'get') || function (O) { 249 if (classof(O) !== 'ArrayBuffer') throw new TypeError('ArrayBuffer expected'); 250 return O.byteLength; 251}; 252 253 254/***/ }, 255 256/***/ 3238 257(module, __unused_webpack_exports, __webpack_require__) { 258 259 260var globalThis = __webpack_require__(4576); 261var NATIVE_ARRAY_BUFFER = __webpack_require__(7811); 262var arrayBufferByteLength = __webpack_require__(7394); 263 264var DataView = globalThis.DataView; 265 266module.exports = function (O) { 267 if (!NATIVE_ARRAY_BUFFER || arrayBufferByteLength(O) !== 0) return false; 268 try { 269 // eslint-disable-next-line no-new -- thrower 270 new DataView(O); 271 return false; 272 } catch (error) { 273 return true; 274 } 275}; 276 277 278/***/ }, 279 280/***/ 5169 281(module, __unused_webpack_exports, __webpack_require__) { 282 283 284var isDetached = __webpack_require__(3238); 285 286var $TypeError = TypeError; 287 288module.exports = function (it) { 289 if (isDetached(it)) throw new $TypeError('ArrayBuffer is detached'); 290 return it; 291}; 292 293 294/***/ }, 295 296/***/ 5636 297(module, __unused_webpack_exports, __webpack_require__) { 298 299 300var globalThis = __webpack_require__(4576); 301var uncurryThis = __webpack_require__(9504); 302var uncurryThisAccessor = __webpack_require__(6706); 303var toIndex = __webpack_require__(7696); 304var notDetached = __webpack_require__(5169); 305var arrayBufferByteLength = __webpack_require__(7394); 306var detachTransferable = __webpack_require__(4483); 307var PROPER_STRUCTURED_CLONE_TRANSFER = __webpack_require__(1548); 308 309var structuredClone = globalThis.structuredClone; 310var ArrayBuffer = globalThis.ArrayBuffer; 311var DataView = globalThis.DataView; 312var max = Math.max; 313var min = Math.min; 314var ArrayBufferPrototype = ArrayBuffer.prototype; 315var DataViewPrototype = DataView.prototype; 316var slice = uncurryThis(ArrayBufferPrototype.slice); 317var isResizable = uncurryThisAccessor(ArrayBufferPrototype, 'resizable', 'get'); 318var maxByteLength = uncurryThisAccessor(ArrayBufferPrototype, 'maxByteLength', 'get'); 319var getInt8 = uncurryThis(DataViewPrototype.getInt8); 320var setInt8 = uncurryThis(DataViewPrototype.setInt8); 321 322module.exports = (PROPER_STRUCTURED_CLONE_TRANSFER || detachTransferable) && function (arrayBuffer, newLength, preserveResizability) { 323 var byteLength = arrayBufferByteLength(arrayBuffer); 324 var newByteLength = newLength === undefined ? byteLength : toIndex(newLength); 325 var fixedLength = !isResizable || !isResizable(arrayBuffer); 326 var newBuffer; 327 notDetached(arrayBuffer); 328 if (PROPER_STRUCTURED_CLONE_TRANSFER) { 329 arrayBuffer = structuredClone(arrayBuffer, { transfer: [arrayBuffer] }); 330 if (byteLength === newByteLength && (preserveResizability || fixedLength)) return arrayBuffer; 331 } 332 if (byteLength >= newByteLength && (!preserveResizability || fixedLength)) { 333 newBuffer = slice(arrayBuffer, 0, newByteLength); 334 } else { 335 var options = preserveResizability && !fixedLength && maxByteLength 336 ? { maxByteLength: max(newByteLength, maxByteLength(arrayBuffer)) } 337 : undefined; 338 newBuffer = new ArrayBuffer(newByteLength, options); 339 var a = new DataView(arrayBuffer); 340 var b = new DataView(newBuffer); 341 var copyLength = min(newByteLength, byteLength); 342 for (var i = 0; i < copyLength; i++) setInt8(b, i, getInt8(a, i)); 343 } 344 if (!PROPER_STRUCTURED_CLONE_TRANSFER) detachTransferable(arrayBuffer); 345 return newBuffer; 346}; 347 348 349/***/ }, 350 351/***/ 4644 352(module, __unused_webpack_exports, __webpack_require__) { 353 354 355var NATIVE_ARRAY_BUFFER = __webpack_require__(7811); 356var DESCRIPTORS = __webpack_require__(3724); 357var globalThis = __webpack_require__(4576); 358var isCallable = __webpack_require__(4901); 359var isObject = __webpack_require__(34); 360var hasOwn = __webpack_require__(9297); 361var classof = __webpack_require__(6955); 362var tryToString = __webpack_require__(6823); 363var createNonEnumerableProperty = __webpack_require__(6699); 364var defineBuiltIn = __webpack_require__(6840); 365var defineBuiltInAccessor = __webpack_require__(2106); 366var isPrototypeOf = __webpack_require__(1625); 367var getPrototypeOf = __webpack_require__(2787); 368var setPrototypeOf = __webpack_require__(2967); 369var wellKnownSymbol = __webpack_require__(8227); 370var uid = __webpack_require__(3392); 371var InternalStateModule = __webpack_require__(1181); 372 373var enforceInternalState = InternalStateModule.enforce; 374var getInternalState = InternalStateModule.get; 375var Int8Array = globalThis.Int8Array; 376var Int8ArrayPrototype = Int8Array && Int8Array.prototype; 377var Uint8ClampedArray = globalThis.Uint8ClampedArray; 378var Uint8ClampedArrayPrototype = Uint8ClampedArray && Uint8ClampedArray.prototype; 379var TypedArray = Int8Array && getPrototypeOf(Int8Array); 380var TypedArrayPrototype = Int8ArrayPrototype && getPrototypeOf(Int8ArrayPrototype); 381var ObjectPrototype = Object.prototype; 382var TypeError = globalThis.TypeError; 383 384var TO_STRING_TAG = wellKnownSymbol('toStringTag'); 385var TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG'); 386var TYPED_ARRAY_CONSTRUCTOR = 'TypedArrayConstructor'; 387// Fixing native typed arrays in Opera Presto crashes the browser, see #595 388var NATIVE_ARRAY_BUFFER_VIEWS = NATIVE_ARRAY_BUFFER && !!setPrototypeOf && classof(globalThis.opera) !== 'Opera'; 389var TYPED_ARRAY_TAG_REQUIRED = false; 390var NAME, Constructor, Prototype; 391 392var TypedArrayConstructorsList = { 393 Int8Array: 1, 394 Uint8Array: 1, 395 Uint8ClampedArray: 1, 396 Int16Array: 2, 397 Uint16Array: 2, 398 Int32Array: 4, 399 Uint32Array: 4, 400 Float32Array: 4, 401 Float64Array: 8 402}; 403 404var BigIntArrayConstructorsList = { 405 BigInt64Array: 8, 406 BigUint64Array: 8 407}; 408 409var isView = function isView(it) { 410 if (!isObject(it)) return false; 411 var klass = classof(it); 412 return klass === 'DataView' 413 || hasOwn(TypedArrayConstructorsList, klass) 414 || hasOwn(BigIntArrayConstructorsList, klass); 415}; 416 417var getTypedArrayConstructor = function (it) { 418 var proto = getPrototypeOf(it); 419 if (!isObject(proto)) return; 420 var state = getInternalState(proto); 421 return (state && hasOwn(state, TYPED_ARRAY_CONSTRUCTOR)) ? state[TYPED_ARRAY_CONSTRUCTOR] : getTypedArrayConstructor(proto); 422}; 423 424var isTypedArray = function (it) { 425 if (!isObject(it)) return false; 426 var klass = classof(it); 427 return hasOwn(TypedArrayConstructorsList, klass) 428 || hasOwn(BigIntArrayConstructorsList, klass); 429}; 430 431var aTypedArray = function (it) { 432 if (isTypedArray(it)) return it; 433 throw new TypeError('Target is not a typed array'); 434}; 435 436var aTypedArrayConstructor = function (C) { 437 if (isCallable(C) && (!setPrototypeOf || isPrototypeOf(TypedArray, C))) return C; 438 throw new TypeError(tryToString(C) + ' is not a typed array constructor'); 439}; 440 441var exportTypedArrayMethod = function (KEY, property, forced, options) { 442 if (!DESCRIPTORS) return; 443 if (forced) for (var ARRAY in TypedArrayConstructorsList) { 444 var TypedArrayConstructor = globalThis[ARRAY]; 445 if (TypedArrayConstructor && hasOwn(TypedArrayConstructor.prototype, KEY)) try { 446 delete TypedArrayConstructor.prototype[KEY]; 447 } catch (error) { 448 // old WebKit bug - some methods are non-configurable 449 try { 450 TypedArrayConstructor.prototype[KEY] = property; 451 } catch (error2) { /* empty */ } 452 } 453 } 454 if (!TypedArrayPrototype[KEY] || forced) { 455 defineBuiltIn(TypedArrayPrototype, KEY, forced ? property 456 : NATIVE_ARRAY_BUFFER_VIEWS && Int8ArrayPrototype[KEY] || property, options); 457 } 458}; 459 460var exportTypedArrayStaticMethod = function (KEY, property, forced) { 461 var ARRAY, TypedArrayConstructor; 462 if (!DESCRIPTORS) return; 463 if (setPrototypeOf) { 464 if (forced) for (ARRAY in TypedArrayConstructorsList) { 465 TypedArrayConstructor = globalThis[ARRAY]; 466 if (TypedArrayConstructor && hasOwn(TypedArrayConstructor, KEY)) try { 467 delete TypedArrayConstructor[KEY]; 468 } catch (error) { /* empty */ } 469 } 470 if (!TypedArray[KEY] || forced) { 471 // V8 ~ Chrome 49-50 `%TypedArray%` methods are non-writable non-configurable 472 try { 473 return defineBuiltIn(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && TypedArray[KEY] || property); 474 } catch (error) { /* empty */ } 475 } else return; 476 } 477 for (ARRAY in TypedArrayConstructorsList) { 478 TypedArrayConstructor = globalThis[ARRAY]; 479 if (TypedArrayConstructor && (!TypedArrayConstructor[KEY] || forced)) { 480 defineBuiltIn(TypedArrayConstructor, KEY, property); 481 } 482 } 483}; 484 485for (NAME in TypedArrayConstructorsList) { 486 Constructor = globalThis[NAME]; 487 Prototype = Constructor && Constructor.prototype; 488 if (Prototype) enforceInternalState(Prototype)[TYPED_ARRAY_CONSTRUCTOR] = Constructor; 489 else NATIVE_ARRAY_BUFFER_VIEWS = false; 490} 491 492for (NAME in BigIntArrayConstructorsList) { 493 Constructor = globalThis[NAME]; 494 Prototype = Constructor && Constructor.prototype; 495 if (Prototype) enforceInternalState(Prototype)[TYPED_ARRAY_CONSTRUCTOR] = Constructor; 496} 497 498// WebKit bug - typed arrays constructors prototype is Object.prototype 499if (!NATIVE_ARRAY_BUFFER_VIEWS || !isCallable(TypedArray) || TypedArray === Function.prototype) { 500 // eslint-disable-next-line no-shadow -- safe 501 TypedArray = function TypedArray() { 502 throw new TypeError('Incorrect invocation'); 503 }; 504 if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) { 505 if (globalThis[NAME]) setPrototypeOf(globalThis[NAME], TypedArray); 506 } 507} 508 509if (!NATIVE_ARRAY_BUFFER_VIEWS || !TypedArrayPrototype || TypedArrayPrototype === ObjectPrototype) { 510 TypedArrayPrototype = TypedArray.prototype; 511 if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) { 512 if (globalThis[NAME]) setPrototypeOf(globalThis[NAME].prototype, TypedArrayPrototype); 513 } 514} 515 516// WebKit bug - one more object in Uint8ClampedArray prototype chain 517if (NATIVE_ARRAY_BUFFER_VIEWS && getPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype) { 518 setPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype); 519} 520 521if (DESCRIPTORS && !hasOwn(TypedArrayPrototype, TO_STRING_TAG)) { 522 TYPED_ARRAY_TAG_REQUIRED = true; 523 defineBuiltInAccessor(TypedArrayPrototype, TO_STRING_TAG, { 524 configurable: true, 525 get: function () { 526 return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined; 527 } 528 }); 529 for (NAME in TypedArrayConstructorsList) if (globalThis[NAME]) { 530 createNonEnumerableProperty(globalThis[NAME].prototype, TYPED_ARRAY_TAG, NAME); 531 } 532} 533 534module.exports = { 535 NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS, 536 TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQUIRED && TYPED_ARRAY_TAG, 537 aTypedArray: aTypedArray, 538 aTypedArrayConstructor: aTypedArrayConstructor, 539 exportTypedArrayMethod: exportTypedArrayMethod, 540 exportTypedArrayStaticMethod: exportTypedArrayStaticMethod, 541 getTypedArrayConstructor: getTypedArrayConstructor, 542 isView: isView, 543 isTypedArray: isTypedArray, 544 TypedArray: TypedArray, 545 TypedArrayPrototype: TypedArrayPrototype 546}; 547 548 549/***/ }, 550 551/***/ 5370 552(module, __unused_webpack_exports, __webpack_require__) { 553 554 555var lengthOfArrayLike = __webpack_require__(6198); 556 557module.exports = function (Constructor, list, $length) { 558 var index = 0; 559 var length = arguments.length > 2 ? $length : lengthOfArrayLike(list); 560 var result = new Constructor(length); 561 while (length > index) result[index] = list[index++]; 562 return result; 563}; 564 565 566/***/ }, 567 568/***/ 9617 569(module, __unused_webpack_exports, __webpack_require__) { 570 571 572var toIndexedObject = __webpack_require__(5397); 573var toAbsoluteIndex = __webpack_require__(5610); 574var lengthOfArrayLike = __webpack_require__(6198); 575 576// `Array.prototype.{ indexOf, includes }` methods implementation 577var createMethod = function (IS_INCLUDES) { 578 return function ($this, el, fromIndex) { 579 var O = toIndexedObject($this); 580 var length = lengthOfArrayLike(O); 581 if (length === 0) return !IS_INCLUDES && -1; 582 var index = toAbsoluteIndex(fromIndex, length); 583 var value; 584 // Array#includes uses SameValueZero equality algorithm 585 // eslint-disable-next-line no-self-compare -- NaN check 586 if (IS_INCLUDES && el !== el) while (length > index) { 587 value = O[index++]; 588 // eslint-disable-next-line no-self-compare -- NaN check 589 if (value !== value) return true; 590 // Array#indexOf ignores holes, Array#includes - not 591 } else for (;length > index; index++) {
vendor: 9,389 bytes, lines 592-966
592 if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0; 593 } return !IS_INCLUDES && -1; 594 }; 595}; 596 597module.exports = { 598 // `Array.prototype.includes` method 599 // https://tc39.es/ecma262/#sec-array.prototype.includes 600 includes: createMethod(true), 601 // `Array.prototype.indexOf` method 602 // https://tc39.es/ecma262/#sec-array.prototype.indexof 603 indexOf: createMethod(false) 604}; 605 606 607/***/ }, 608 609/***/ 4527 610(module, __unused_webpack_exports, __webpack_require__) { 611 612 613var DESCRIPTORS = __webpack_require__(3724); 614var isArray = __webpack_require__(4376); 615 616var $TypeError = TypeError; 617// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe 618var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; 619 620// Safari < 13 does not throw an error in this case 621var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS && !function () { 622 // makes no sense without proper strict mode support 623 if (this !== undefined) return true; 624 try { 625 // eslint-disable-next-line es/no-object-defineproperty -- safe 626 Object.defineProperty([], 'length', { writable: false }).length = 1; 627 } catch (error) { 628 return error instanceof TypeError; 629 } 630}(); 631 632module.exports = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function (O, length) { 633 if (isArray(O) && !getOwnPropertyDescriptor(O, 'length').writable) { 634 throw new $TypeError('Cannot set read only .length'); 635 } return O.length = length; 636} : function (O, length) { 637 return O.length = length; 638}; 639 640 641/***/ }, 642 643/***/ 7680 644(module, __unused_webpack_exports, __webpack_require__) { 645 646 647var uncurryThis = __webpack_require__(9504); 648 649module.exports = uncurryThis([].slice); 650 651 652/***/ }, 653 654/***/ 2804 655(module) { 656 657 658var commonAlphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; 659var base64Alphabet = commonAlphabet + '+/'; 660var base64UrlAlphabet = commonAlphabet + '-_'; 661 662var inverse = function (characters) { 663 // TODO: use `Object.create(null)` in `core-js@4` 664 var result = {}; 665 var index = 0; 666 for (; index < 64; index++) result[characters.charAt(index)] = index; 667 return result; 668}; 669 670module.exports = { 671 i2c: base64Alphabet, 672 c2i: inverse(base64Alphabet), 673 i2cUrl: base64UrlAlphabet, 674 c2iUrl: inverse(base64UrlAlphabet) 675}; 676 677 678/***/ }, 679 680/***/ 6319 681(module, __unused_webpack_exports, __webpack_require__) { 682 683 684var anObject = __webpack_require__(8551); 685var iteratorClose = __webpack_require__(9539); 686 687// call something on iterator step with safe closing on error 688module.exports = function (iterator, fn, value, ENTRIES) { 689 try { 690 return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value); 691 } catch (error) { 692 iteratorClose(iterator, 'throw', error); 693 } 694}; 695 696 697/***/ }, 698 699/***/ 2195 700(module, __unused_webpack_exports, __webpack_require__) { 701 702 703var uncurryThis = __webpack_require__(9504); 704 705var toString = uncurryThis({}.toString); 706var stringSlice = uncurryThis(''.slice); 707 708module.exports = function (it) { 709 return stringSlice(toString(it), 8, -1); 710}; 711 712 713/***/ }, 714 715/***/ 6955 716(module, __unused_webpack_exports, __webpack_require__) { 717 718 719var TO_STRING_TAG_SUPPORT = __webpack_require__(2140); 720var isCallable = __webpack_require__(4901); 721var classofRaw = __webpack_require__(2195); 722var wellKnownSymbol = __webpack_require__(8227); 723 724var TO_STRING_TAG = wellKnownSymbol('toStringTag'); 725var $Object = Object; 726 727// ES3 wrong here 728var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) === 'Arguments'; 729 730// fallback for IE11 Script Access Denied error 731var tryGet = function (it, key) { 732 try { 733 return it[key]; 734 } catch (error) { /* empty */ } 735}; 736 737// getting tag from ES6+ `Object.prototype.toString` 738module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) { 739 var O, tag, result; 740 return it === undefined ? 'Undefined' : it === null ? 'Null' 741 // @@toStringTag case 742 : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag 743 // builtinTag case 744 : CORRECT_ARGUMENTS ? classofRaw(O) 745 // ES3 arguments fallback 746 : (result = classofRaw(O)) === 'Object' && isCallable(O.callee) ? 'Arguments' : result; 747}; 748 749 750/***/ }, 751 752/***/ 7740 753(module, __unused_webpack_exports, __webpack_require__) { 754 755 756var hasOwn = __webpack_require__(9297); 757var ownKeys = __webpack_require__(5031); 758var getOwnPropertyDescriptorModule = __webpack_require__(7347); 759var definePropertyModule = __webpack_require__(4913); 760 761module.exports = function (target, source, exceptions) { 762 var keys = ownKeys(source); 763 var defineProperty = definePropertyModule.f; 764 var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; 765 for (var i = 0; i < keys.length; i++) { 766 var key = keys[i]; 767 if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) { 768 defineProperty(target, key, getOwnPropertyDescriptor(source, key)); 769 } 770 } 771}; 772 773 774/***/ }, 775 776/***/ 2211 777(module, __unused_webpack_exports, __webpack_require__) { 778 779 780var fails = __webpack_require__(9039); 781 782module.exports = !fails(function () { 783 function F() { /* empty */ } 784 F.prototype.constructor = null; 785 // eslint-disable-next-line es/no-object-getprototypeof -- required for testing 786 return Object.getPrototypeOf(new F()) !== F.prototype; 787}); 788 789 790/***/ }, 791 792/***/ 2529 793(module) { 794 795 796// `CreateIterResultObject` abstract operation 797// https://tc39.es/ecma262/#sec-createiterresultobject 798module.exports = function (value, done) { 799 return { value: value, done: done }; 800}; 801 802 803/***/ }, 804 805/***/ 6699 806(module, __unused_webpack_exports, __webpack_require__) { 807 808 809var DESCRIPTORS = __webpack_require__(3724); 810var definePropertyModule = __webpack_require__(4913); 811var createPropertyDescriptor = __webpack_require__(6980); 812 813module.exports = DESCRIPTORS ? function (object, key, value) { 814 return definePropertyModule.f(object, key, createPropertyDescriptor(1, value)); 815} : function (object, key, value) { 816 object[key] = value; 817 return object; 818}; 819 820 821/***/ }, 822 823/***/ 6980 824(module) { 825 826 827module.exports = function (bitmap, value) { 828 return { 829 enumerable: !(bitmap & 1), 830 configurable: !(bitmap & 2), 831 writable: !(bitmap & 4), 832 value: value 833 }; 834}; 835 836 837/***/ }, 838 839/***/ 4659 840(module, __unused_webpack_exports, __webpack_require__) { 841 842 843var DESCRIPTORS = __webpack_require__(3724); 844var definePropertyModule = __webpack_require__(4913); 845var createPropertyDescriptor = __webpack_require__(6980); 846 847module.exports = function (object, key, value) { 848 if (DESCRIPTORS) definePropertyModule.f(object, key, createPropertyDescriptor(0, value)); 849 else object[key] = value; 850}; 851 852 853/***/ }, 854 855/***/ 2106 856(module, __unused_webpack_exports, __webpack_require__) { 857 858 859var makeBuiltIn = __webpack_require__(283); 860var defineProperty = __webpack_require__(4913); 861 862module.exports = function (target, name, descriptor) { 863 if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true }); 864 if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true }); 865 return defineProperty.f(target, name, descriptor); 866}; 867 868 869/***/ }, 870 871/***/ 6840 872(module, __unused_webpack_exports, __webpack_require__) { 873 874 875var isCallable = __webpack_require__(4901); 876var definePropertyModule = __webpack_require__(4913); 877var makeBuiltIn = __webpack_require__(283); 878var defineGlobalProperty = __webpack_require__(9433); 879 880module.exports = function (O, key, value, options) { 881 if (!options) options = {}; 882 var simple = options.enumerable; 883 var name = options.name !== undefined ? options.name : key; 884 if (isCallable(value)) makeBuiltIn(value, name, options); 885 if (options.global) { 886 if (simple) O[key] = value; 887 else defineGlobalProperty(key, value); 888 } else { 889 try { 890 if (!options.unsafe) delete O[key]; 891 else if (O[key]) simple = true; 892 } catch (error) { /* empty */ } 893 if (simple) O[key] = value; 894 else definePropertyModule.f(O, key, { 895 value: value, 896 enumerable: false, 897 configurable: !options.nonConfigurable, 898 writable: !options.nonWritable 899 }); 900 } return O; 901}; 902 903 904/***/ }, 905 906/***/ 6279 907(module, __unused_webpack_exports, __webpack_require__) { 908 909 910var defineBuiltIn = __webpack_require__(6840); 911 912module.exports = function (target, src, options) { 913 for (var key in src) defineBuiltIn(target, key, src[key], options); 914 return target; 915}; 916 917 918/***/ }, 919 920/***/ 9433 921(module, __unused_webpack_exports, __webpack_require__) { 922 923 924var globalThis = __webpack_require__(4576); 925 926// eslint-disable-next-line es/no-object-defineproperty -- safe 927var defineProperty = Object.defineProperty; 928 929module.exports = function (key, value) { 930 try { 931 defineProperty(globalThis, key, { value: value, configurable: true, writable: true }); 932 } catch (error) { 933 globalThis[key] = value; 934 } return value; 935}; 936 937 938/***/ }, 939 940/***/ 3724 941(module, __unused_webpack_exports, __webpack_require__) { 942 943 944var fails = __webpack_require__(9039); 945 946// Detect IE8's incomplete defineProperty implementation 947module.exports = !fails(function () { 948 // eslint-disable-next-line es/no-object-defineproperty -- required for testing 949 return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7; 950}); 951 952 953/***/ }, 954 955/***/ 4483 956(module, __unused_webpack_exports, __webpack_require__) { 957 958 959var globalThis = __webpack_require__(4576); 960var getBuiltInNodeModule = __webpack_require__(9429); 961var PROPER_STRUCTURED_CLONE_TRANSFER = __webpack_require__(1548); 962 963var structuredClone = globalThis.structuredClone; 964var $ArrayBuffer = globalThis.ArrayBuffer; 965var $MessageChannel = globalThis.MessageChannel; 966var detach = false;
vendor: 4,776 bytes, lines 967-1156
967var WorkerThreads, channel, buffer, $detach; 968 969if (PROPER_STRUCTURED_CLONE_TRANSFER) { 970 detach = function (transferable) { 971 structuredClone(transferable, { transfer: [transferable] }); 972 }; 973} else if ($ArrayBuffer) try { 974 if (!$MessageChannel) { 975 WorkerThreads = getBuiltInNodeModule('worker_threads'); 976 if (WorkerThreads) $MessageChannel = WorkerThreads.MessageChannel; 977 } 978 979 if ($MessageChannel) { 980 channel = new $MessageChannel(); 981 buffer = new $ArrayBuffer(2); 982 983 $detach = function (transferable) { 984 channel.port1.postMessage(null, [transferable]); 985 }; 986 987 if (buffer.byteLength === 2) { 988 $detach(buffer); 989 if (buffer.byteLength === 0) detach = $detach; 990 } 991 } 992} catch (error) { /* empty */ } 993 994module.exports = detach; 995 996 997/***/ }, 998 999/***/ 4055 1000(module, __unused_webpack_exports, __webpack_require__) { 1001 1002 1003var globalThis = __webpack_require__(4576); 1004var isObject = __webpack_require__(34); 1005 1006var document = globalThis.document; 1007// typeof document.createElement is 'object' in old IE 1008var EXISTS = isObject(document) && isObject(document.createElement); 1009 1010module.exports = function (it) { 1011 return EXISTS ? document.createElement(it) : {}; 1012}; 1013 1014 1015/***/ }, 1016 1017/***/ 6837 1018(module) { 1019 1020 1021var $TypeError = TypeError; 1022var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991 1023 1024module.exports = function (it) { 1025 if (it > MAX_SAFE_INTEGER) throw new $TypeError('Maximum allowed index exceeded'); 1026 return it; 1027}; 1028 1029 1030/***/ }, 1031 1032/***/ 8727 1033(module) { 1034 1035 1036// IE8- don't enum bug keys 1037module.exports = [ 1038 'constructor', 1039 'hasOwnProperty', 1040 'isPrototypeOf', 1041 'propertyIsEnumerable', 1042 'toLocaleString', 1043 'toString', 1044 'valueOf' 1045]; 1046 1047 1048/***/ }, 1049 1050/***/ 6193 1051(module, __unused_webpack_exports, __webpack_require__) { 1052 1053 1054var ENVIRONMENT = __webpack_require__(4215); 1055 1056module.exports = ENVIRONMENT === 'NODE'; 1057 1058 1059/***/ }, 1060 1061/***/ 2839 1062(module, __unused_webpack_exports, __webpack_require__) { 1063 1064 1065var globalThis = __webpack_require__(4576); 1066 1067var navigator = globalThis.navigator; 1068var userAgent = navigator && navigator.userAgent; 1069 1070module.exports = userAgent ? String(userAgent) : ''; 1071 1072 1073/***/ }, 1074 1075/***/ 9519 1076(module, __unused_webpack_exports, __webpack_require__) { 1077 1078 1079var globalThis = __webpack_require__(4576); 1080var userAgent = __webpack_require__(2839); 1081 1082var process = globalThis.process; 1083var Deno = globalThis.Deno; 1084var versions = process && process.versions || Deno && Deno.version; 1085var v8 = versions && versions.v8; 1086var match, version; 1087 1088if (v8) { 1089 match = v8.split('.'); 1090 // in old Chrome, versions of V8 isn't V8 = Chrome / 10 1091 // but their correct versions are not interesting for us 1092 version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]); 1093} 1094 1095// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0` 1096// so check `userAgent` even if `.v8` exists, but 0 1097if (!version && userAgent) { 1098 match = userAgent.match(/Edge\/(\d+)/); 1099 if (!match || match[1] >= 74) { 1100 match = userAgent.match(/Chrome\/(\d+)/); 1101 if (match) version = +match[1]; 1102 } 1103} 1104 1105module.exports = version; 1106 1107 1108/***/ }, 1109 1110/***/ 4215 1111(module, __unused_webpack_exports, __webpack_require__) { 1112 1113 1114/* global Bun, Deno -- detection */ 1115var globalThis = __webpack_require__(4576); 1116var userAgent = __webpack_require__(2839); 1117var classof = __webpack_require__(2195); 1118 1119var userAgentStartsWith = function (string) { 1120 return userAgent.slice(0, string.length) === string; 1121}; 1122 1123module.exports = (function () { 1124 if (userAgentStartsWith('Bun/')) return 'BUN'; 1125 if (userAgentStartsWith('Cloudflare-Workers')) return 'CLOUDFLARE'; 1126 if (userAgentStartsWith('Deno/')) return 'DENO'; 1127 if (userAgentStartsWith('Node.js/')) return 'NODE'; 1128 if (globalThis.Bun && typeof Bun.version == 'string') return 'BUN'; 1129 if (globalThis.Deno && typeof Deno.version == 'object') return 'DENO'; 1130 if (classof(globalThis.process) === 'process') return 'NODE'; 1131 if (globalThis.window && globalThis.document) return 'BROWSER'; 1132 return 'REST'; 1133})(); 1134 1135 1136/***/ }, 1137 1138/***/ 6518 1139(module, __unused_webpack_exports, __webpack_require__) { 1140 1141 1142var globalThis = __webpack_require__(4576); 1143var getOwnPropertyDescriptor = (__webpack_require__(7347).f); 1144var createNonEnumerableProperty = __webpack_require__(6699); 1145var defineBuiltIn = __webpack_require__(6840); 1146var defineGlobalProperty = __webpack_require__(9433); 1147var copyConstructorProperties = __webpack_require__(7740); 1148var isForced = __webpack_require__(2796); 1149 1150/* 1151 options.target - name of the target object 1152 options.global - target is the global object 1153 options.stat - export as static methods of target 1154 options.proto - export as prototype methods of target 1155 options.real - real prototype method for the `pure` version 1156 options.forced - export even if the native feature is available
vendor: 5,914 bytes, lines 1157-1371
1157 options.bind - bind methods to the target, required for the `pure` version 1158 options.wrap - wrap constructors to preventing global pollution, required for the `pure` version 1159 options.unsafe - use the simple assignment of property instead of delete + defineProperty 1160 options.sham - add a flag to not completely full polyfills 1161 options.enumerable - export as enumerable property 1162 options.dontCallGetSet - prevent calling a getter on target 1163 options.name - the .name of the function if it does not match the key 1164*/ 1165module.exports = function (options, source) { 1166 var TARGET = options.target; 1167 var GLOBAL = options.global; 1168 var STATIC = options.stat; 1169 var FORCED, target, key, targetProperty, sourceProperty, descriptor; 1170 if (GLOBAL) { 1171 target = globalThis; 1172 } else if (STATIC) { 1173 target = globalThis[TARGET] || defineGlobalProperty(TARGET, {}); 1174 } else { 1175 target = globalThis[TARGET] && globalThis[TARGET].prototype; 1176 } 1177 if (target) for (key in source) { 1178 sourceProperty = source[key]; 1179 if (options.dontCallGetSet) { 1180 descriptor = getOwnPropertyDescriptor(target, key); 1181 targetProperty = descriptor && descriptor.value; 1182 } else targetProperty = target[key]; 1183 FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); 1184 // contained in target 1185 if (!FORCED && targetProperty !== undefined) { 1186 if (typeof sourceProperty == typeof targetProperty) continue; 1187 copyConstructorProperties(sourceProperty, targetProperty); 1188 } 1189 // add a flag to not completely full polyfills 1190 if (options.sham || (targetProperty && targetProperty.sham)) { 1191 createNonEnumerableProperty(sourceProperty, 'sham', true); 1192 } 1193 defineBuiltIn(target, key, sourceProperty, options); 1194 } 1195}; 1196 1197 1198/***/ }, 1199 1200/***/ 9039 1201(module) { 1202 1203 1204module.exports = function (exec) { 1205 try { 1206 return !!exec(); 1207 } catch (error) { 1208 return true; 1209 } 1210}; 1211 1212 1213/***/ }, 1214 1215/***/ 8745 1216(module, __unused_webpack_exports, __webpack_require__) { 1217 1218 1219var NATIVE_BIND = __webpack_require__(616); 1220 1221var FunctionPrototype = Function.prototype; 1222var apply = FunctionPrototype.apply; 1223var call = FunctionPrototype.call; 1224 1225// eslint-disable-next-line es/no-function-prototype-bind, es/no-reflect -- safe 1226module.exports = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function () { 1227 return call.apply(apply, arguments); 1228}); 1229 1230 1231/***/ }, 1232 1233/***/ 6080 1234(module, __unused_webpack_exports, __webpack_require__) { 1235 1236 1237var uncurryThis = __webpack_require__(7476); 1238var aCallable = __webpack_require__(9306); 1239var NATIVE_BIND = __webpack_require__(616); 1240 1241var bind = uncurryThis(uncurryThis.bind); 1242 1243// optional / simple context binding 1244module.exports = function (fn, that) { 1245 aCallable(fn); 1246 return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function (/* ...args */) { 1247 return fn.apply(that, arguments); 1248 }; 1249}; 1250 1251 1252/***/ }, 1253 1254/***/ 616 1255(module, __unused_webpack_exports, __webpack_require__) { 1256 1257 1258var fails = __webpack_require__(9039); 1259 1260module.exports = !fails(function () { 1261 // eslint-disable-next-line es/no-function-prototype-bind -- safe 1262 var test = function () { /* empty */ }.bind(); 1263 // eslint-disable-next-line no-prototype-builtins -- safe 1264 return typeof test != 'function' || test.hasOwnProperty('prototype'); 1265}); 1266 1267 1268/***/ }, 1269 1270/***/ 9565 1271(module, __unused_webpack_exports, __webpack_require__) { 1272 1273 1274var NATIVE_BIND = __webpack_require__(616); 1275 1276var call = Function.prototype.call; 1277// eslint-disable-next-line es/no-function-prototype-bind -- safe 1278module.exports = NATIVE_BIND ? call.bind(call) : function () { 1279 return call.apply(call, arguments); 1280}; 1281 1282 1283/***/ }, 1284 1285/***/ 350 1286(module, __unused_webpack_exports, __webpack_require__) { 1287 1288 1289var DESCRIPTORS = __webpack_require__(3724); 1290var hasOwn = __webpack_require__(9297); 1291 1292var FunctionPrototype = Function.prototype; 1293// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe 1294var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor; 1295 1296var EXISTS = hasOwn(FunctionPrototype, 'name'); 1297// additional protection from minified / mangled / dropped function names 1298var PROPER = EXISTS && function something() { /* empty */ }.name === 'something'; 1299var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable)); 1300 1301module.exports = { 1302 EXISTS: EXISTS, 1303 PROPER: PROPER, 1304 CONFIGURABLE: CONFIGURABLE 1305}; 1306 1307 1308/***/ }, 1309 1310/***/ 6706 1311(module, __unused_webpack_exports, __webpack_require__) { 1312 1313 1314var uncurryThis = __webpack_require__(9504); 1315var aCallable = __webpack_require__(9306); 1316 1317module.exports = function (object, key, method) { 1318 try { 1319 // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe 1320 return uncurryThis(aCallable(Object.getOwnPropertyDescriptor(object, key)[method])); 1321 } catch (error) { /* empty */ } 1322}; 1323 1324 1325/***/ }, 1326 1327/***/ 7476 1328(module, __unused_webpack_exports, __webpack_require__) { 1329 1330 1331var classofRaw = __webpack_require__(2195); 1332var uncurryThis = __webpack_require__(9504); 1333 1334module.exports = function (fn) { 1335 // Nashorn bug: 1336 // https://github.com/zloirock/core-js/issues/1128 1337 // https://github.com/zloirock/core-js/issues/1130 1338 if (classofRaw(fn) === 'Function') return uncurryThis(fn); 1339}; 1340 1341 1342/***/ }, 1343 1344/***/ 9504 1345(module, __unused_webpack_exports, __webpack_require__) { 1346 1347 1348var NATIVE_BIND = __webpack_require__(616); 1349 1350var FunctionPrototype = Function.prototype; 1351var call = FunctionPrototype.call; 1352// eslint-disable-next-line es/no-function-prototype-bind -- safe 1353var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call); 1354 1355module.exports = NATIVE_BIND ? uncurryThisWithBind : function (fn) { 1356 return function () { 1357 return call.apply(fn, arguments); 1358 }; 1359}; 1360 1361 1362/***/ }, 1363 1364/***/ 944 1365(module) { 1366 1367 1368var $TypeError = TypeError; 1369 1370module.exports = function (options) { 1371 var alphabet = options && options.alphabet;
vendor: 10,847 bytes, lines 1372-1815
1372 if (alphabet === undefined || alphabet === 'base64' || alphabet === 'base64url') return alphabet || 'base64'; 1373 throw new $TypeError('Incorrect `alphabet` option'); 1374}; 1375 1376 1377/***/ }, 1378 1379/***/ 9429 1380(module, __unused_webpack_exports, __webpack_require__) { 1381 1382 1383var globalThis = __webpack_require__(4576); 1384var IS_NODE = __webpack_require__(6193); 1385 1386module.exports = function (name) { 1387 if (IS_NODE) { 1388 try { 1389 return globalThis.process.getBuiltinModule(name); 1390 } catch (error) { /* empty */ } 1391 try { 1392 // eslint-disable-next-line no-new-func -- safe 1393 return Function('return require("' + name + '")')(); 1394 } catch (error) { /* empty */ } 1395 } 1396}; 1397 1398 1399/***/ }, 1400 1401/***/ 7751 1402(module, __unused_webpack_exports, __webpack_require__) { 1403 1404 1405var globalThis = __webpack_require__(4576); 1406var isCallable = __webpack_require__(4901); 1407 1408var aFunction = function (argument) { 1409 return isCallable(argument) ? argument : undefined; 1410}; 1411 1412module.exports = function (namespace, method) { 1413 return arguments.length < 2 ? aFunction(globalThis[namespace]) : globalThis[namespace] && globalThis[namespace][method]; 1414}; 1415 1416 1417/***/ }, 1418 1419/***/ 1767 1420(module) { 1421 1422 1423// `GetIteratorDirect(obj)` abstract operation 1424// https://tc39.es/ecma262/#sec-getiteratordirect 1425module.exports = function (obj) { 1426 return { 1427 iterator: obj, 1428 next: obj.next, 1429 done: false 1430 }; 1431}; 1432 1433 1434/***/ }, 1435 1436/***/ 8646 1437(module, __unused_webpack_exports, __webpack_require__) { 1438 1439 1440var call = __webpack_require__(9565); 1441var anObject = __webpack_require__(8551); 1442var getIteratorDirect = __webpack_require__(1767); 1443var getIteratorMethod = __webpack_require__(851); 1444 1445module.exports = function (obj, stringHandling) { 1446 if (!stringHandling || typeof obj !== 'string') anObject(obj); 1447 var method = getIteratorMethod(obj); 1448 return getIteratorDirect(anObject(method !== undefined ? call(method, obj) : obj)); 1449}; 1450 1451 1452/***/ }, 1453 1454/***/ 851 1455(module, __unused_webpack_exports, __webpack_require__) { 1456 1457 1458var classof = __webpack_require__(6955); 1459var getMethod = __webpack_require__(5966); 1460var isNullOrUndefined = __webpack_require__(4117); 1461var Iterators = __webpack_require__(6269); 1462var wellKnownSymbol = __webpack_require__(8227); 1463 1464var ITERATOR = wellKnownSymbol('iterator'); 1465 1466module.exports = function (it) { 1467 if (!isNullOrUndefined(it)) return getMethod(it, ITERATOR) 1468 || getMethod(it, '@@iterator') 1469 || Iterators[classof(it)]; 1470}; 1471 1472 1473/***/ }, 1474 1475/***/ 81 1476(module, __unused_webpack_exports, __webpack_require__) { 1477 1478 1479var call = __webpack_require__(9565); 1480var aCallable = __webpack_require__(9306); 1481var anObject = __webpack_require__(8551); 1482var tryToString = __webpack_require__(6823); 1483var getIteratorMethod = __webpack_require__(851); 1484 1485var $TypeError = TypeError; 1486 1487module.exports = function (argument, usingIterator) { 1488 var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator; 1489 if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument)); 1490 throw new $TypeError(tryToString(argument) + ' is not iterable'); 1491}; 1492 1493 1494/***/ }, 1495 1496/***/ 5966 1497(module, __unused_webpack_exports, __webpack_require__) { 1498 1499 1500var aCallable = __webpack_require__(9306); 1501var isNullOrUndefined = __webpack_require__(4117); 1502 1503// `GetMethod` abstract operation 1504// https://tc39.es/ecma262/#sec-getmethod 1505module.exports = function (V, P) { 1506 var func = V[P]; 1507 return isNullOrUndefined(func) ? undefined : aCallable(func); 1508}; 1509 1510 1511/***/ }, 1512 1513/***/ 3789 1514(module, __unused_webpack_exports, __webpack_require__) { 1515 1516 1517var aCallable = __webpack_require__(9306); 1518var anObject = __webpack_require__(8551); 1519var call = __webpack_require__(9565); 1520var toIntegerOrInfinity = __webpack_require__(1291); 1521var getIteratorDirect = __webpack_require__(1767); 1522 1523var INVALID_SIZE = 'Invalid size'; 1524var $RangeError = RangeError; 1525var $TypeError = TypeError; 1526var max = Math.max; 1527 1528var SetRecord = function (set, intSize) { 1529 this.set = set; 1530 this.size = max(intSize, 0); 1531 this.has = aCallable(set.has); 1532 this.keys = aCallable(set.keys); 1533}; 1534 1535SetRecord.prototype = { 1536 getIterator: function () { 1537 return getIteratorDirect(anObject(call(this.keys, this.set))); 1538 }, 1539 includes: function (it) { 1540 return call(this.has, this.set, it); 1541 } 1542}; 1543 1544// `GetSetRecord` abstract operation 1545// https://tc39.es/proposal-set-methods/#sec-getsetrecord 1546module.exports = function (obj) { 1547 anObject(obj); 1548 var numSize = +obj.size; 1549 // NOTE: If size is undefined, then numSize will be NaN 1550 // eslint-disable-next-line no-self-compare -- NaN check 1551 if (numSize !== numSize) throw new $TypeError(INVALID_SIZE); 1552 var intSize = toIntegerOrInfinity(numSize); 1553 if (intSize < 0) throw new $RangeError(INVALID_SIZE); 1554 return new SetRecord(obj, intSize); 1555}; 1556 1557 1558/***/ }, 1559 1560/***/ 4576 1561(module) { 1562 1563 1564var check = function (it) { 1565 return it && it.Math === Math && it; 1566}; 1567 1568// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 1569module.exports = 1570 // eslint-disable-next-line es/no-global-this -- safe 1571 check(typeof globalThis == 'object' && globalThis) || 1572 check(typeof window == 'object' && window) || 1573 // eslint-disable-next-line no-restricted-globals -- safe 1574 check(typeof self == 'object' && self) || 1575 check(typeof global == 'object' && global) || 1576 check(typeof this == 'object' && this) || 1577 // eslint-disable-next-line no-new-func -- fallback 1578 (function () { return this; })() || Function('return this')(); 1579 1580 1581/***/ }, 1582 1583/***/ 9297 1584(module, __unused_webpack_exports, __webpack_require__) { 1585 1586 1587var uncurryThis = __webpack_require__(9504); 1588var toObject = __webpack_require__(8981); 1589 1590var hasOwnProperty = uncurryThis({}.hasOwnProperty); 1591 1592// `HasOwnProperty` abstract operation 1593// https://tc39.es/ecma262/#sec-hasownproperty 1594// eslint-disable-next-line es/no-object-hasown -- safe 1595module.exports = Object.hasOwn || function hasOwn(it, key) { 1596 return hasOwnProperty(toObject(it), key); 1597}; 1598 1599 1600/***/ }, 1601 1602/***/ 421 1603(module) { 1604 1605 1606module.exports = {}; 1607 1608 1609/***/ }, 1610 1611/***/ 397 1612(module, __unused_webpack_exports, __webpack_require__) { 1613 1614 1615var getBuiltIn = __webpack_require__(7751); 1616 1617module.exports = getBuiltIn('document', 'documentElement'); 1618 1619 1620/***/ }, 1621 1622/***/ 5917 1623(module, __unused_webpack_exports, __webpack_require__) { 1624 1625 1626var DESCRIPTORS = __webpack_require__(3724); 1627var fails = __webpack_require__(9039); 1628var createElement = __webpack_require__(4055); 1629 1630// Thanks to IE8 for its funny defineProperty 1631module.exports = !DESCRIPTORS && !fails(function () { 1632 // eslint-disable-next-line es/no-object-defineproperty -- required for testing 1633 return Object.defineProperty(createElement('div'), 'a', { 1634 get: function () { return 7; } 1635 }).a !== 7; 1636}); 1637 1638 1639/***/ }, 1640 1641/***/ 7055 1642(module, __unused_webpack_exports, __webpack_require__) { 1643 1644 1645var uncurryThis = __webpack_require__(9504); 1646var fails = __webpack_require__(9039); 1647var classof = __webpack_require__(2195); 1648 1649var $Object = Object; 1650var split = uncurryThis(''.split); 1651 1652// fallback for non-array-like ES3 and non-enumerable old V8 strings 1653module.exports = fails(function () { 1654 // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 1655 // eslint-disable-next-line no-prototype-builtins -- safe 1656 return !$Object('z').propertyIsEnumerable(0); 1657}) ? function (it) { 1658 return classof(it) === 'String' ? split(it, '') : $Object(it); 1659} : $Object; 1660 1661 1662/***/ }, 1663 1664/***/ 3706 1665(module, __unused_webpack_exports, __webpack_require__) { 1666 1667 1668var uncurryThis = __webpack_require__(9504); 1669var isCallable = __webpack_require__(4901); 1670var store = __webpack_require__(7629); 1671 1672var functionToString = uncurryThis(Function.toString); 1673 1674// this helper broken in `[email protected]`, so we can't use `shared` helper 1675if (!isCallable(store.inspectSource)) { 1676 store.inspectSource = function (it) { 1677 return functionToString(it); 1678 }; 1679} 1680 1681module.exports = store.inspectSource; 1682 1683 1684/***/ }, 1685 1686/***/ 1181 1687(module, __unused_webpack_exports, __webpack_require__) { 1688 1689 1690var NATIVE_WEAK_MAP = __webpack_require__(8622); 1691var globalThis = __webpack_require__(4576); 1692var isObject = __webpack_require__(34); 1693var createNonEnumerableProperty = __webpack_require__(6699); 1694var hasOwn = __webpack_require__(9297); 1695var shared = __webpack_require__(7629); 1696var sharedKey = __webpack_require__(6119); 1697var hiddenKeys = __webpack_require__(421); 1698 1699var OBJECT_ALREADY_INITIALIZED = 'Object already initialized'; 1700var TypeError = globalThis.TypeError; 1701var WeakMap = globalThis.WeakMap; 1702var set, get, has; 1703 1704var enforce = function (it) { 1705 return has(it) ? get(it) : set(it, {}); 1706}; 1707 1708var getterFor = function (TYPE) { 1709 return function (it) { 1710 var state; 1711 if (!isObject(it) || (state = get(it)).type !== TYPE) { 1712 throw new TypeError('Incompatible receiver, ' + TYPE + ' required'); 1713 } return state; 1714 }; 1715}; 1716 1717if (NATIVE_WEAK_MAP || shared.state) { 1718 var store = shared.state || (shared.state = new WeakMap()); 1719 /* eslint-disable no-self-assign -- prototype methods protection */ 1720 store.get = store.get; 1721 store.has = store.has; 1722 store.set = store.set; 1723 /* eslint-enable no-self-assign -- prototype methods protection */ 1724 set = function (it, metadata) { 1725 if (store.has(it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED); 1726 metadata.facade = it; 1727 store.set(it, metadata); 1728 return metadata; 1729 }; 1730 get = function (it) { 1731 return store.get(it) || {}; 1732 }; 1733 has = function (it) { 1734 return store.has(it); 1735 }; 1736} else { 1737 var STATE = sharedKey('state'); 1738 hiddenKeys[STATE] = true; 1739 set = function (it, metadata) { 1740 if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED); 1741 metadata.facade = it; 1742 createNonEnumerableProperty(it, STATE, metadata); 1743 return metadata; 1744 }; 1745 get = function (it) { 1746 return hasOwn(it, STATE) ? it[STATE] : {}; 1747 }; 1748 has = function (it) { 1749 return hasOwn(it, STATE); 1750 }; 1751} 1752 1753module.exports = { 1754 set: set, 1755 get: get, 1756 has: has, 1757 enforce: enforce, 1758 getterFor: getterFor 1759}; 1760 1761 1762/***/ }, 1763 1764/***/ 4209 1765(module, __unused_webpack_exports, __webpack_require__) { 1766 1767 1768var wellKnownSymbol = __webpack_require__(8227); 1769var Iterators = __webpack_require__(6269); 1770 1771var ITERATOR = wellKnownSymbol('iterator'); 1772var ArrayPrototype = Array.prototype; 1773 1774// check on default Array iterator 1775module.exports = function (it) { 1776 return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it); 1777}; 1778 1779 1780/***/ }, 1781 1782/***/ 4376 1783(module, __unused_webpack_exports, __webpack_require__) { 1784 1785 1786var classof = __webpack_require__(2195); 1787 1788// `IsArray` abstract operation 1789// https://tc39.es/ecma262/#sec-isarray 1790// eslint-disable-next-line es/no-array-isarray -- safe 1791module.exports = Array.isArray || function isArray(argument) { 1792 return classof(argument) === 'Array'; 1793}; 1794 1795 1796/***/ }, 1797 1798/***/ 1108 1799(module, __unused_webpack_exports, __webpack_require__) { 1800 1801 1802var classof = __webpack_require__(6955); 1803 1804module.exports = function (it) { 1805 var klass = classof(it); 1806 return klass === 'BigInt64Array' || klass === 'BigUint64Array'; 1807}; 1808 1809 1810/***/ }, 1811 1812/***/ 4901 1813(module) { 1814 1815
vendor: 8,595 bytes, lines 1816-2133
1816// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot 1817var documentAll = typeof document == 'object' && document.all; 1818 1819// `IsCallable` abstract operation 1820// https://tc39.es/ecma262/#sec-iscallable 1821// eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing 1822module.exports = typeof documentAll == 'undefined' && documentAll !== undefined ? function (argument) { 1823 return typeof argument == 'function' || argument === documentAll; 1824} : function (argument) { 1825 return typeof argument == 'function'; 1826}; 1827 1828 1829/***/ }, 1830 1831/***/ 2796 1832(module, __unused_webpack_exports, __webpack_require__) { 1833 1834 1835var fails = __webpack_require__(9039); 1836var isCallable = __webpack_require__(4901); 1837 1838var replacement = /#|\.prototype\./; 1839 1840var isForced = function (feature, detection) { 1841 var value = data[normalize(feature)]; 1842 return value === POLYFILL ? true 1843 : value === NATIVE ? false 1844 : isCallable(detection) ? fails(detection) 1845 : !!detection; 1846}; 1847 1848var normalize = isForced.normalize = function (string) { 1849 return String(string).replace(replacement, '.').toLowerCase(); 1850}; 1851 1852var data = isForced.data = {}; 1853var NATIVE = isForced.NATIVE = 'N'; 1854var POLYFILL = isForced.POLYFILL = 'P'; 1855 1856module.exports = isForced; 1857 1858 1859/***/ }, 1860 1861/***/ 4117 1862(module) { 1863 1864 1865// we can't use just `it == null` since of `document.all` special case 1866// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec 1867module.exports = function (it) { 1868 return it === null || it === undefined; 1869}; 1870 1871 1872/***/ }, 1873 1874/***/ 34 1875(module, __unused_webpack_exports, __webpack_require__) { 1876 1877 1878var isCallable = __webpack_require__(4901); 1879 1880module.exports = function (it) { 1881 return typeof it == 'object' ? it !== null : isCallable(it); 1882}; 1883 1884 1885/***/ }, 1886 1887/***/ 3925 1888(module, __unused_webpack_exports, __webpack_require__) { 1889 1890 1891var isObject = __webpack_require__(34); 1892 1893module.exports = function (argument) { 1894 return isObject(argument) || argument === null; 1895}; 1896 1897 1898/***/ }, 1899 1900/***/ 6395 1901(module) { 1902 1903 1904module.exports = false; 1905 1906 1907/***/ }, 1908 1909/***/ 5810 1910(module, __unused_webpack_exports, __webpack_require__) { 1911 1912 1913var isObject = __webpack_require__(34); 1914var getInternalState = (__webpack_require__(1181).get); 1915 1916module.exports = function isRawJSON(O) { 1917 if (!isObject(O)) return false; 1918 var state = getInternalState(O); 1919 return !!state && state.type === 'RawJSON'; 1920}; 1921 1922 1923/***/ }, 1924 1925/***/ 757 1926(module, __unused_webpack_exports, __webpack_require__) { 1927 1928 1929var getBuiltIn = __webpack_require__(7751); 1930var isCallable = __webpack_require__(4901); 1931var isPrototypeOf = __webpack_require__(1625); 1932var USE_SYMBOL_AS_UID = __webpack_require__(7040); 1933 1934var $Object = Object; 1935 1936module.exports = USE_SYMBOL_AS_UID ? function (it) { 1937 return typeof it == 'symbol'; 1938} : function (it) { 1939 var $Symbol = getBuiltIn('Symbol'); 1940 return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it)); 1941}; 1942 1943 1944/***/ }, 1945 1946/***/ 507 1947(module, __unused_webpack_exports, __webpack_require__) { 1948 1949 1950var call = __webpack_require__(9565); 1951 1952module.exports = function (record, fn, ITERATOR_INSTEAD_OF_RECORD) { 1953 var iterator = ITERATOR_INSTEAD_OF_RECORD ? record : record.iterator; 1954 var next = record.next; 1955 var step, result; 1956 while (!(step = call(next, iterator)).done) { 1957 result = fn(step.value); 1958 if (result !== undefined) return result; 1959 } 1960}; 1961 1962 1963/***/ }, 1964 1965/***/ 2652 1966(module, __unused_webpack_exports, __webpack_require__) { 1967 1968 1969var bind = __webpack_require__(6080); 1970var call = __webpack_require__(9565); 1971var anObject = __webpack_require__(8551); 1972var tryToString = __webpack_require__(6823); 1973var isArrayIteratorMethod = __webpack_require__(4209); 1974var lengthOfArrayLike = __webpack_require__(6198); 1975var isPrototypeOf = __webpack_require__(1625); 1976var getIterator = __webpack_require__(81); 1977var getIteratorMethod = __webpack_require__(851); 1978var iteratorClose = __webpack_require__(9539); 1979 1980var $TypeError = TypeError; 1981 1982var Result = function (stopped, result) { 1983 this.stopped = stopped; 1984 this.result = result; 1985}; 1986 1987var ResultPrototype = Result.prototype; 1988 1989module.exports = function (iterable, unboundFunction, options) { 1990 var that = options && options.that; 1991 var AS_ENTRIES = !!(options && options.AS_ENTRIES); 1992 var IS_RECORD = !!(options && options.IS_RECORD); 1993 var IS_ITERATOR = !!(options && options.IS_ITERATOR); 1994 var INTERRUPTED = !!(options && options.INTERRUPTED); 1995 var fn = bind(unboundFunction, that); 1996 var iterator, iterFn, index, length, result, next, step; 1997 1998 var stop = function (condition) { 1999 var $iterator = iterator; 2000 iterator = undefined; 2001 if ($iterator) iteratorClose($iterator, 'normal'); 2002 return new Result(true, condition); 2003 }; 2004 2005 var callFn = function (value) { 2006 if (AS_ENTRIES) { 2007 anObject(value); 2008 return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]); 2009 } return INTERRUPTED ? fn(value, stop) : fn(value); 2010 }; 2011 2012 if (IS_RECORD) { 2013 iterator = iterable.iterator; 2014 } else if (IS_ITERATOR) { 2015 iterator = iterable; 2016 } else { 2017 iterFn = getIteratorMethod(iterable); 2018 if (!iterFn) throw new $TypeError(tryToString(iterable) + ' is not iterable'); 2019 // optimisation for array iterators 2020 if (isArrayIteratorMethod(iterFn)) { 2021 for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) { 2022 result = callFn(iterable[index]); 2023 if (result && isPrototypeOf(ResultPrototype, result)) return result; 2024 } return new Result(false); 2025 } 2026 iterator = getIterator(iterable, iterFn); 2027 } 2028 2029 next = IS_RECORD ? iterable.next : iterator.next; 2030 while (!(step = call(next, iterator)).done) { 2031 // `IteratorValue` errors should propagate without closing the iterator 2032 var value = step.value; 2033 try { 2034 result = callFn(value); 2035 } catch (error) { 2036 if (iterator) iteratorClose(iterator, 'throw', error); 2037 else throw error; 2038 } 2039 if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result; 2040 } return new Result(false); 2041}; 2042 2043 2044/***/ }, 2045 2046/***/ 1385 2047(module, __unused_webpack_exports, __webpack_require__) { 2048 2049 2050var iteratorClose = __webpack_require__(9539); 2051 2052module.exports = function (iters, kind, value) { 2053 for (var i = iters.length - 1; i >= 0; i--) { 2054 if (iters[i] === undefined) continue; 2055 try { 2056 value = iteratorClose(iters[i].iterator, kind, value); 2057 } catch (error) { 2058 kind = 'throw'; 2059 value = error; 2060 } 2061 } 2062 if (kind === 'throw') throw value; 2063 return value; 2064}; 2065 2066 2067/***/ }, 2068 2069/***/ 9539 2070(module, __unused_webpack_exports, __webpack_require__) { 2071 2072 2073var call = __webpack_require__(9565); 2074var anObject = __webpack_require__(8551); 2075var getMethod = __webpack_require__(5966); 2076 2077module.exports = function (iterator, kind, value) { 2078 var innerResult, innerError; 2079 anObject(iterator); 2080 try { 2081 innerResult = getMethod(iterator, 'return'); 2082 if (!innerResult) { 2083 if (kind === 'throw') throw value; 2084 return value; 2085 } 2086 innerResult = call(innerResult, iterator); 2087 } catch (error) { 2088 innerError = true; 2089 innerResult = error; 2090 } 2091 if (kind === 'throw') throw value; 2092 if (innerError) throw innerResult; 2093 anObject(innerResult); 2094 return value; 2095}; 2096 2097 2098/***/ }, 2099 2100/***/ 9462 2101(module, __unused_webpack_exports, __webpack_require__) { 2102 2103 2104var call = __webpack_require__(9565); 2105var create = __webpack_require__(2360); 2106var createNonEnumerableProperty = __webpack_require__(6699); 2107var defineBuiltIns = __webpack_require__(6279); 2108var wellKnownSymbol = __webpack_require__(8227); 2109var InternalStateModule = __webpack_require__(1181); 2110var getMethod = __webpack_require__(5966); 2111var IteratorPrototype = (__webpack_require__(7657).IteratorPrototype); 2112var createIterResultObject = __webpack_require__(2529); 2113var iteratorClose = __webpack_require__(9539); 2114var iteratorCloseAll = __webpack_require__(1385); 2115 2116var TO_STRING_TAG = wellKnownSymbol('toStringTag'); 2117var ITERATOR_HELPER = 'IteratorHelper'; 2118var WRAP_FOR_VALID_ITERATOR = 'WrapForValidIterator'; 2119var NORMAL = 'normal'; 2120var THROW = 'throw'; 2121var setInternalState = InternalStateModule.set; 2122 2123var createIteratorProxyPrototype = function (IS_ITERATOR) { 2124 var getInternalState = InternalStateModule.getterFor(IS_ITERATOR ? WRAP_FOR_VALID_ITERATOR : ITERATOR_HELPER); 2125 2126 return defineBuiltIns(create(IteratorPrototype), { 2127 next: function next() { 2128 var state = getInternalState(this); 2129 // for simplification: 2130 // for `%WrapForValidIteratorPrototype%.next` or with `state.returnHandlerResult` our `nextHandler` returns `IterResultObject` 2131 // for `%IteratorHelperPrototype%.next` - just a value 2132 if (IS_ITERATOR) return state.nextHandler(); 2133 if (state.done) return createIterResultObject(undefined, true);
vendor: 5,109 bytes, lines 2134-2313
2134 try { 2135 var result = state.nextHandler(); 2136 return state.returnHandlerResult ? result : createIterResultObject(result, state.done); 2137 } catch (error) { 2138 state.done = true; 2139 throw error; 2140 } 2141 }, 2142 'return': function () { 2143 var state = getInternalState(this); 2144 var iterator = state.iterator; 2145 var done = state.done; 2146 state.done = true; 2147 if (IS_ITERATOR) { 2148 var returnMethod = getMethod(iterator, 'return'); 2149 return returnMethod ? call(returnMethod, iterator) : createIterResultObject(undefined, true); 2150 } 2151 if (done) return createIterResultObject(undefined, true); 2152 if (state.inner) try { 2153 iteratorClose(state.inner.iterator, NORMAL); 2154 } catch (error) { 2155 return iteratorClose(iterator, THROW, error); 2156 } 2157 if (state.openIters) try { 2158 iteratorCloseAll(state.openIters, NORMAL); 2159 } catch (error) { 2160 if (iterator) return iteratorClose(iterator, THROW, error); 2161 throw error; 2162 } 2163 if (iterator) iteratorClose(iterator, NORMAL); 2164 return createIterResultObject(undefined, true); 2165 } 2166 }); 2167}; 2168 2169var WrapForValidIteratorPrototype = createIteratorProxyPrototype(true); 2170var IteratorHelperPrototype = createIteratorProxyPrototype(false); 2171 2172createNonEnumerableProperty(IteratorHelperPrototype, TO_STRING_TAG, 'Iterator Helper'); 2173 2174module.exports = function (nextHandler, IS_ITERATOR, RETURN_HANDLER_RESULT) { 2175 var IteratorProxy = function Iterator(record, state) { 2176 if (state) { 2177 state.iterator = record.iterator; 2178 state.next = record.next; 2179 } else state = record; 2180 state.type = IS_ITERATOR ? WRAP_FOR_VALID_ITERATOR : ITERATOR_HELPER; 2181 state.returnHandlerResult = !!RETURN_HANDLER_RESULT; 2182 state.nextHandler = nextHandler; 2183 state.counter = 0; 2184 state.done = false; 2185 setInternalState(this, state); 2186 }; 2187 2188 IteratorProxy.prototype = IS_ITERATOR ? WrapForValidIteratorPrototype : IteratorHelperPrototype; 2189 2190 return IteratorProxy; 2191}; 2192 2193 2194/***/ }, 2195 2196/***/ 684 2197(module) { 2198 2199 2200// Should throw an error on invalid iterator 2201// https://issues.chromium.org/issues/336839115 2202module.exports = function (methodName, argument) { 2203 // eslint-disable-next-line es/no-iterator -- required for testing 2204 var method = typeof Iterator == 'function' && Iterator.prototype[methodName]; 2205 if (method) try { 2206 method.call({ next: null }, argument).next(); 2207 } catch (error) { 2208 return true; 2209 } 2210}; 2211 2212 2213/***/ }, 2214 2215/***/ 4549 2216(module, __unused_webpack_exports, __webpack_require__) { 2217 2218 2219var globalThis = __webpack_require__(4576); 2220 2221// https://github.com/tc39/ecma262/pull/3467 2222module.exports = function (METHOD_NAME, ExpectedError) { 2223 var Iterator = globalThis.Iterator; 2224 var IteratorPrototype = Iterator && Iterator.prototype; 2225 var method = IteratorPrototype && IteratorPrototype[METHOD_NAME]; 2226 2227 var CLOSED = false; 2228 2229 if (method) try { 2230 method.call({ 2231 next: function () { return { done: true }; }, 2232 'return': function () { CLOSED = true; } 2233 }, -1); 2234 } catch (error) { 2235 // https://bugs.webkit.org/show_bug.cgi?id=291195 2236 if (!(error instanceof ExpectedError)) CLOSED = false; 2237 } 2238 2239 if (!CLOSED) return method; 2240}; 2241 2242 2243/***/ }, 2244 2245/***/ 7657 2246(module, __unused_webpack_exports, __webpack_require__) { 2247 2248 2249var fails = __webpack_require__(9039); 2250var isCallable = __webpack_require__(4901); 2251var isObject = __webpack_require__(34); 2252var create = __webpack_require__(2360); 2253var getPrototypeOf = __webpack_require__(2787); 2254var defineBuiltIn = __webpack_require__(6840); 2255var wellKnownSymbol = __webpack_require__(8227); 2256var IS_PURE = __webpack_require__(6395); 2257 2258var ITERATOR = wellKnownSymbol('iterator'); 2259var BUGGY_SAFARI_ITERATORS = false; 2260 2261// `%IteratorPrototype%` object 2262// https://tc39.es/ecma262/#sec-%iteratorprototype%-object 2263var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator; 2264 2265/* eslint-disable es/no-array-prototype-keys -- safe */ 2266if ([].keys) { 2267 arrayIterator = [].keys(); 2268 // Safari 8 has buggy iterators w/o `next` 2269 if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true; 2270 else { 2271 PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator)); 2272 if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype; 2273 } 2274} 2275 2276var NEW_ITERATOR_PROTOTYPE = !isObject(IteratorPrototype) || fails(function () { 2277 var test = {}; 2278 // FF44- legacy iterators case 2279 return IteratorPrototype[ITERATOR].call(test) !== test; 2280}); 2281 2282if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {}; 2283else if (IS_PURE) IteratorPrototype = create(IteratorPrototype); 2284 2285// `%IteratorPrototype%[@@iterator]()` method 2286// https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator 2287if (!isCallable(IteratorPrototype[ITERATOR])) { 2288 defineBuiltIn(IteratorPrototype, ITERATOR, function () { 2289 return this; 2290 }); 2291} 2292 2293module.exports = { 2294 IteratorPrototype: IteratorPrototype, 2295 BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS 2296}; 2297 2298 2299/***/ }, 2300 2301/***/ 6269 2302(module) { 2303 2304 2305module.exports = {}; 2306 2307 2308/***/ }, 2309 2310/***/ 6198 2311(module, __unused_webpack_exports, __webpack_require__) { 2312 2313
vendor: 4,727 bytes, lines 2314-2467
2314var toLength = __webpack_require__(8014); 2315 2316// `LengthOfArrayLike` abstract operation 2317// https://tc39.es/ecma262/#sec-lengthofarraylike 2318module.exports = function (obj) { 2319 return toLength(obj.length); 2320}; 2321 2322 2323/***/ }, 2324 2325/***/ 283 2326(module, __unused_webpack_exports, __webpack_require__) { 2327 2328 2329var uncurryThis = __webpack_require__(9504); 2330var fails = __webpack_require__(9039); 2331var isCallable = __webpack_require__(4901); 2332var hasOwn = __webpack_require__(9297); 2333var DESCRIPTORS = __webpack_require__(3724); 2334var CONFIGURABLE_FUNCTION_NAME = (__webpack_require__(350).CONFIGURABLE); 2335var inspectSource = __webpack_require__(3706); 2336var InternalStateModule = __webpack_require__(1181); 2337 2338var enforceInternalState = InternalStateModule.enforce; 2339var getInternalState = InternalStateModule.get; 2340var $String = String; 2341// eslint-disable-next-line es/no-object-defineproperty -- safe 2342var defineProperty = Object.defineProperty; 2343var stringSlice = uncurryThis(''.slice); 2344var replace = uncurryThis(''.replace); 2345var join = uncurryThis([].join); 2346 2347var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function () { 2348 return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8; 2349}); 2350 2351var TEMPLATE = String(String).split('String'); 2352 2353var makeBuiltIn = module.exports = function (value, name, options) { 2354 if (stringSlice($String(name), 0, 7) === 'Symbol(') { 2355 name = '[' + replace($String(name), /^Symbol\(([^)]*)\).*$/, '$1') + ']'; 2356 } 2357 if (options && options.getter) name = 'get ' + name; 2358 if (options && options.setter) name = 'set ' + name; 2359 if (!hasOwn(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) { 2360 if (DESCRIPTORS) defineProperty(value, 'name', { value: name, configurable: true }); 2361 else value.name = name; 2362 } 2363 if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) { 2364 defineProperty(value, 'length', { value: options.arity }); 2365 } 2366 try { 2367 if (options && hasOwn(options, 'constructor') && options.constructor) { 2368 if (DESCRIPTORS) defineProperty(value, 'prototype', { writable: false }); 2369 // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable 2370 } else if (value.prototype) value.prototype = undefined; 2371 } catch (error) { /* empty */ } 2372 var state = enforceInternalState(value); 2373 if (!hasOwn(state, 'source')) { 2374 state.source = join(TEMPLATE, typeof name == 'string' ? name : ''); 2375 } return value; 2376}; 2377 2378// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative 2379// eslint-disable-next-line no-extend-native -- required 2380Function.prototype.toString = makeBuiltIn(function toString() { 2381 return isCallable(this) && getInternalState(this).source || inspectSource(this); 2382}, 'toString'); 2383 2384 2385/***/ }, 2386 2387/***/ 2248 2388(module, __unused_webpack_exports, __webpack_require__) { 2389 2390 2391var uncurryThis = __webpack_require__(9504); 2392 2393// eslint-disable-next-line es/no-map -- safe 2394var MapPrototype = Map.prototype; 2395 2396module.exports = { 2397 // eslint-disable-next-line es/no-map -- safe 2398 Map: Map, 2399 set: uncurryThis(MapPrototype.set), 2400 get: uncurryThis(MapPrototype.get), 2401 has: uncurryThis(MapPrototype.has), 2402 remove: uncurryThis(MapPrototype['delete']), 2403 proto: MapPrototype 2404}; 2405 2406 2407/***/ }, 2408 2409/***/ 741 2410(module) { 2411 2412 2413var ceil = Math.ceil; 2414var floor = Math.floor; 2415 2416// `Math.trunc` method 2417// https://tc39.es/ecma262/#sec-math.trunc 2418// eslint-disable-next-line es/no-math-trunc -- safe 2419module.exports = Math.trunc || function trunc(x) { 2420 var n = +x; 2421 return (n > 0 ? floor : ceil)(n); 2422}; 2423 2424 2425/***/ }, 2426 2427/***/ 7819 2428(module, __unused_webpack_exports, __webpack_require__) { 2429 2430 2431/* eslint-disable es/no-json -- safe */ 2432var fails = __webpack_require__(9039); 2433 2434module.exports = !fails(function () { 2435 var unsafeInt = '9007199254740993'; 2436 // eslint-disable-next-line es/no-json-rawjson -- feature detection 2437 var raw = JSON.rawJSON(unsafeInt); 2438 // eslint-disable-next-line es/no-json-israwjson -- feature detection 2439 return !JSON.isRawJSON(raw) || JSON.stringify(raw) !== unsafeInt; 2440}); 2441 2442 2443/***/ }, 2444 2445/***/ 6043 2446(module, __unused_webpack_exports, __webpack_require__) { 2447 2448 2449var aCallable = __webpack_require__(9306); 2450 2451var $TypeError = TypeError; 2452 2453var PromiseCapability = function (C) { 2454 var resolve, reject; 2455 this.promise = new C(function ($$resolve, $$reject) { 2456 if (resolve !== undefined || reject !== undefined) throw new $TypeError('Bad Promise constructor'); 2457 resolve = $$resolve; 2458 reject = $$reject; 2459 }); 2460 this.resolve = aCallable(resolve); 2461 this.reject = aCallable(reject); 2462}; 2463 2464// `NewPromiseCapability` abstract operation 2465// https://tc39.es/ecma262/#sec-newpromisecapability 2466module.exports.f = function (C) { 2467 return new PromiseCapability(C
vendor: 11,767 bytes, lines 2467-2845
2467); 2468}; 2469 2470 2471/***/ }, 2472 2473/***/ 2360 2474(module, __unused_webpack_exports, __webpack_require__) { 2475 2476 2477/* global ActiveXObject -- old IE, WSH */ 2478var anObject = __webpack_require__(8551); 2479var definePropertiesModule = __webpack_require__(6801); 2480var enumBugKeys = __webpack_require__(8727); 2481var hiddenKeys = __webpack_require__(421); 2482var html = __webpack_require__(397); 2483var documentCreateElement = __webpack_require__(4055); 2484var sharedKey = __webpack_require__(6119); 2485 2486var GT = '>'; 2487var LT = '<'; 2488var PROTOTYPE = 'prototype'; 2489var SCRIPT = 'script'; 2490var IE_PROTO = sharedKey('IE_PROTO'); 2491 2492var EmptyConstructor = function () { /* empty */ }; 2493 2494var scriptTag = function (content) { 2495 return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT; 2496}; 2497 2498// Create object with fake `null` prototype: use ActiveX Object with cleared prototype 2499var NullProtoObjectViaActiveX = function (activeXDocument) { 2500 activeXDocument.write(scriptTag('')); 2501 activeXDocument.close(); 2502 var temp = activeXDocument.parentWindow.Object; 2503 // eslint-disable-next-line no-useless-assignment -- avoid memory leak 2504 activeXDocument = null; 2505 return temp; 2506}; 2507 2508// Create object with fake `null` prototype: use iframe Object with cleared prototype 2509var NullProtoObjectViaIFrame = function () { 2510 // Thrash, waste and sodomy: IE GC bug 2511 var iframe = documentCreateElement('iframe'); 2512 var JS = 'java' + SCRIPT + ':'; 2513 var iframeDocument; 2514 iframe.style.display = 'none'; 2515 html.appendChild(iframe); 2516 // https://github.com/zloirock/core-js/issues/475 2517 iframe.src = String(JS); 2518 iframeDocument = iframe.contentWindow.document; 2519 iframeDocument.open(); 2520 iframeDocument.write(scriptTag('document.F=Object')); 2521 iframeDocument.close(); 2522 return iframeDocument.F; 2523}; 2524 2525// Check for document.domain and active x support 2526// No need to use active x approach when document.domain is not set 2527// see https://github.com/es-shims/es5-shim/issues/150 2528// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346 2529// avoid IE GC bug 2530var activeXDocument; 2531var NullProtoObject = function () { 2532 try { 2533 activeXDocument = new ActiveXObject('htmlfile'); 2534 } catch (error) { /* ignore */ } 2535 NullProtoObject = typeof document != 'undefined' 2536 ? document.domain && activeXDocument 2537 ? NullProtoObjectViaActiveX(activeXDocument) // old IE 2538 : NullProtoObjectViaIFrame() 2539 : NullProtoObjectViaActiveX(activeXDocument); // WSH 2540 var length = enumBugKeys.length; 2541 while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]]; 2542 return NullProtoObject(); 2543}; 2544 2545hiddenKeys[IE_PROTO] = true; 2546 2547// `Object.create` method 2548// https://tc39.es/ecma262/#sec-object.create 2549// eslint-disable-next-line es/no-object-create -- safe 2550module.exports = Object.create || function create(O, Properties) { 2551 var result; 2552 if (O !== null) { 2553 EmptyConstructor[PROTOTYPE] = anObject(O); 2554 result = new EmptyConstructor(); 2555 EmptyConstructor[PROTOTYPE] = null; 2556 // add "__proto__" for Object.getPrototypeOf polyfill 2557 result[IE_PROTO] = O; 2558 } else result = NullProtoObject(); 2559 return Properties === undefined ? result : definePropertiesModule.f(result, Properties); 2560}; 2561 2562 2563/***/ }, 2564 2565/***/ 6801 2566(__unused_webpack_module, exports, __webpack_require__) { 2567 2568 2569var DESCRIPTORS = __webpack_require__(3724); 2570var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(8686); 2571var definePropertyModule = __webpack_require__(4913); 2572var anObject = __webpack_require__(8551); 2573var toIndexedObject = __webpack_require__(5397); 2574var objectKeys = __webpack_require__(1072); 2575 2576// `Object.defineProperties` method 2577// https://tc39.es/ecma262/#sec-object.defineproperties 2578// eslint-disable-next-line es/no-object-defineproperties -- safe 2579exports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) { 2580 anObject(O); 2581 var props = toIndexedObject(Properties); 2582 var keys = objectKeys(Properties); 2583 var length = keys.length; 2584 var index = 0; 2585 var key; 2586 while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]); 2587 return O; 2588}; 2589 2590 2591/***/ }, 2592 2593/***/ 4913 2594(__unused_webpack_module, exports, __webpack_require__) { 2595 2596 2597var DESCRIPTORS = __webpack_require__(3724); 2598var IE8_DOM_DEFINE = __webpack_require__(5917); 2599var V8_PROTOTYPE_DEFINE_BUG = __webpack_require__(8686); 2600var anObject = __webpack_require__(8551); 2601var toPropertyKey = __webpack_require__(6969); 2602 2603var $TypeError = TypeError; 2604// eslint-disable-next-line es/no-object-defineproperty -- safe 2605var $defineProperty = Object.defineProperty; 2606// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe 2607var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; 2608var ENUMERABLE = 'enumerable'; 2609var CONFIGURABLE = 'configurable'; 2610var WRITABLE = 'writable'; 2611 2612// `Object.defineProperty` method 2613// https://tc39.es/ecma262/#sec-object.defineproperty 2614exports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) { 2615 anObject(O); 2616 P = toPropertyKey(P); 2617 anObject(Attributes); 2618 if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) { 2619 var current = $getOwnPropertyDescriptor(O, P); 2620 if (current && current[WRITABLE]) { 2621 O[P] = Attributes.value; 2622 Attributes = { 2623 configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE], 2624 enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE], 2625 writable: false 2626 }; 2627 } 2628 } return $defineProperty(O, P, Attributes); 2629} : $defineProperty : function defineProperty(O, P, Attributes) { 2630 anObject(O); 2631 P = toPropertyKey(P); 2632 anObject(Attributes); 2633 if (IE8_DOM_DEFINE) try { 2634 return $defineProperty(O, P, Attributes); 2635 } catch (error) { /* empty */ } 2636 if ('get' in Attributes || 'set' in Attributes) throw new $TypeError('Accessors not supported'); 2637 if ('value' in Attributes) O[P] = Attributes.value; 2638 return O; 2639}; 2640 2641 2642/***/ }, 2643 2644/***/ 7347 2645(__unused_webpack_module, exports, __webpack_require__) { 2646 2647 2648var DESCRIPTORS = __webpack_require__(3724); 2649var call = __webpack_require__(9565); 2650var propertyIsEnumerableModule = __webpack_require__(8773); 2651var createPropertyDescriptor = __webpack_require__(6980); 2652var toIndexedObject = __webpack_require__(5397); 2653var toPropertyKey = __webpack_require__(6969); 2654var hasOwn = __webpack_require__(9297); 2655var IE8_DOM_DEFINE = __webpack_require__(5917); 2656 2657// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe 2658var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; 2659 2660// `Object.getOwnPropertyDescriptor` method 2661// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor 2662exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { 2663 O = toIndexedObject(O); 2664 P = toPropertyKey(P); 2665 if (IE8_DOM_DEFINE) try { 2666 return $getOwnPropertyDescriptor(O, P); 2667 } catch (error) { /* empty */ } 2668 if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]); 2669}; 2670 2671 2672/***/ }, 2673 2674/***/ 8480 2675(__unused_webpack_module, exports, __webpack_require__) { 2676 2677 2678var internalObjectKeys = __webpack_require__(1828); 2679var enumBugKeys = __webpack_require__(8727); 2680 2681var hiddenKeys = enumBugKeys.concat('length', 'prototype'); 2682 2683// `Object.getOwnPropertyNames` method 2684// https://tc39.es/ecma262/#sec-object.getownpropertynames 2685// eslint-disable-next-line es/no-object-getownpropertynames -- safe 2686exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { 2687 return internalObjectKeys(O, hiddenKeys); 2688}; 2689 2690 2691/***/ }, 2692 2693/***/ 3717 2694(__unused_webpack_module, exports) { 2695 2696 2697// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe 2698exports.f = Object.getOwnPropertySymbols; 2699 2700 2701/***/ }, 2702 2703/***/ 2787 2704(module, __unused_webpack_exports, __webpack_require__) { 2705 2706 2707var hasOwn = __webpack_require__(9297); 2708var isCallable = __webpack_require__(4901); 2709var toObject = __webpack_require__(8981); 2710var sharedKey = __webpack_require__(6119); 2711var CORRECT_PROTOTYPE_GETTER = __webpack_require__(2211); 2712 2713var IE_PROTO = sharedKey('IE_PROTO'); 2714var $Object = Object; 2715var ObjectPrototype = $Object.prototype; 2716 2717// `Object.getPrototypeOf` method 2718// https://tc39.es/ecma262/#sec-object.getprototypeof 2719// eslint-disable-next-line es/no-object-getprototypeof -- safe 2720module.exports = CORRECT_PROTOTYPE_GETTER ? $Object.getPrototypeOf : function (O) { 2721 var object = toObject(O); 2722 if (hasOwn(object, IE_PROTO)) return object[IE_PROTO]; 2723 var constructor = object.constructor; 2724 if (isCallable(constructor) && object instanceof constructor) { 2725 return constructor.prototype; 2726 } return object instanceof $Object ? ObjectPrototype : null; 2727}; 2728 2729 2730/***/ }, 2731 2732/***/ 1625 2733(module, __unused_webpack_exports, __webpack_require__) { 2734 2735 2736var uncurryThis = __webpack_require__(9504); 2737 2738module.exports = uncurryThis({}.isPrototypeOf); 2739 2740 2741/***/ }, 2742 2743/***/ 1828 2744(module, __unused_webpack_exports, __webpack_require__) { 2745 2746 2747var uncurryThis = __webpack_require__(9504); 2748var hasOwn = __webpack_require__(9297); 2749var toIndexedObject = __webpack_require__(5397); 2750var indexOf = (__webpack_require__(9617).indexOf); 2751var hiddenKeys = __webpack_require__(421); 2752 2753var push = uncurryThis([].push); 2754 2755module.exports = function (object, names) { 2756 var O = toIndexedObject(object); 2757 var i = 0; 2758 var result = []; 2759 var key; 2760 for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key); 2761 // Don't enum bug & hidden keys 2762 while (names.length > i) if (hasOwn(O, key = names[i++])) { 2763 ~indexOf(result, key) || push(result, key); 2764 } 2765 return result; 2766}; 2767 2768 2769/***/ }, 2770 2771/***/ 1072 2772(module, __unused_webpack_exports, __webpack_require__) { 2773 2774 2775var internalObjectKeys = __webpack_require__(1828); 2776var enumBugKeys = __webpack_require__(8727); 2777 2778// `Object.keys` method 2779// https://tc39.es/ecma262/#sec-object.keys 2780// eslint-disable-next-line es/no-object-keys -- safe 2781module.exports = Object.keys || function keys(O) { 2782 return internalObjectKeys(O, enumBugKeys); 2783}; 2784 2785 2786/***/ }, 2787 2788/***/ 8773 2789(__unused_webpack_module, exports) { 2790 2791 2792var $propertyIsEnumerable = {}.propertyIsEnumerable; 2793// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe 2794var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; 2795 2796// Nashorn ~ JDK8 bug 2797var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1); 2798 2799// `Object.prototype.propertyIsEnumerable` method implementation 2800// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable 2801exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) { 2802 var descriptor = getOwnPropertyDescriptor(this, V); 2803 return !!descriptor && descriptor.enumerable; 2804} : $propertyIsEnumerable; 2805 2806 2807/***/ }, 2808 2809/***/ 2967 2810(module, __unused_webpack_exports, __webpack_require__) { 2811 2812 2813/* eslint-disable no-proto -- safe */ 2814var uncurryThisAccessor = __webpack_require__(6706); 2815var isObject = __webpack_require__(34); 2816var requireObjectCoercible = __webpack_require__(7750); 2817var aPossiblePrototype = __webpack_require__(3506); 2818 2819// `Object.setPrototypeOf` method 2820// https://tc39.es/ecma262/#sec-object.setprototypeof 2821// Works with __proto__ only. Old v8 can't work with null proto objects. 2822// eslint-disable-next-line es/no-object-setprototypeof -- safe 2823module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () { 2824 var CORRECT_SETTER = false; 2825 var test = {}; 2826 var setter; 2827 try { 2828 setter = uncurryThisAccessor(Object.prototype, '__proto__', 'set'); 2829 setter(test, []); 2830 CORRECT_SETTER = test instanceof Array; 2831 } catch (error) { /* empty */ } 2832 return function setPrototypeOf(O, proto) { 2833 requireObjectCoercible(O); 2834 aPossiblePrototype(proto); 2835 if (!isObject(O)) return O; 2836 if (CORRECT_SETTER) setter(O, proto); 2837 else O.__proto__ = proto; 2838 return O; 2839 }; 2840}() : undefined); 2841 2842 2843/***/ }, 2844 2845/***/
28454270 2846(module, __unused_webpack_exports, __webpack_require__) { 2847 2848 2849var call = __webpack_require__(9565); 2850var isCallable = __webpack_require__(4901); 2851var isObject = __webpack_require__(34); 2852 2853var $TypeError = TypeError; 2854 2855// `OrdinaryToPrimitive` abstract operation 2856// https://tc39.es/ecma262/#sec-ordinarytoprimitive 2857module.exports = function (input, pref) { 2858 var fn, val; 2859 if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val; 2860 if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val; 2861 if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val; 2862 throw new $TypeError("Can't convert object to primitive value"); 2863}; 2864 2865 2866/***/ }, 2867 2868/***/ 5031 2869(module, __unused_webpack_exports, __webpack_require__) { 2870 2871 2872var getBuiltIn = __webpack_require__(7751); 2873var uncurryThis = __webpack_require__(9504); 2874var getOwnPropertyNamesModule = __webpack_require__(8480); 2875var getOwnPropertySymbolsModule = __webpack_require__(3717); 2876var anObject = __webpack_require__(8551); 2877
vendor: 6,010 bytes, lines 2878-3117
2878var concat = uncurryThis([].concat); 2879 2880// all object keys, includes non-enumerable and symbols 2881module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) { 2882 var keys = getOwnPropertyNamesModule.f(anObject(it)); 2883 var getOwnPropertySymbols = getOwnPropertySymbolsModule.f; 2884 return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys; 2885}; 2886 2887 2888/***/ }, 2889 2890/***/ 8235 2891(module, __unused_webpack_exports, __webpack_require__) { 2892 2893 2894var uncurryThis = __webpack_require__(9504); 2895var hasOwn = __webpack_require__(9297); 2896 2897var $SyntaxError = SyntaxError; 2898var $parseInt = parseInt; 2899var fromCharCode = String.fromCharCode; 2900var at = uncurryThis(''.charAt); 2901var slice = uncurryThis(''.slice); 2902var exec = uncurryThis(/./.exec); 2903 2904var codePoints = { 2905 '\\"': '"', 2906 '\\\\': '\\', 2907 '\\/': '/', 2908 '\\b': '\b', 2909 '\\f': '\f', 2910 '\\n': '\n', 2911 '\\r': '\r', 2912 '\\t': '\t' 2913}; 2914 2915var IS_4_HEX_DIGITS = /^[\da-f]{4}$/i; 2916// eslint-disable-next-line regexp/no-control-character -- safe 2917var IS_C0_CONTROL_CODE = /^[\u0000-\u001F]$/; 2918 2919module.exports = function (source, i) { 2920 var unterminated = true; 2921 var value = ''; 2922 while (i < source.length) { 2923 var chr = at(source, i); 2924 if (chr === '\\') { 2925 var twoChars = slice(source, i, i + 2); 2926 if (hasOwn(codePoints, twoChars)) { 2927 value += codePoints[twoChars]; 2928 i += 2; 2929 } else if (twoChars === '\\u') { 2930 i += 2; 2931 var fourHexDigits = slice(source, i, i + 4); 2932 if (!exec(IS_4_HEX_DIGITS, fourHexDigits)) throw new $SyntaxError('Bad Unicode escape at: ' + i); 2933 value += fromCharCode($parseInt(fourHexDigits, 16)); 2934 i += 4; 2935 } else throw new $SyntaxError('Unknown escape sequence: "' + twoChars + '"'); 2936 } else if (chr === '"') { 2937 unterminated = false; 2938 i++; 2939 break; 2940 } else { 2941 if (exec(IS_C0_CONTROL_CODE, chr)) throw new $SyntaxError('Bad control character in string literal at: ' + i); 2942 value += chr; 2943 i++; 2944 } 2945 } 2946 if (unterminated) throw new $SyntaxError('Unterminated string at: ' + i); 2947 return { value: value, end: i }; 2948}; 2949 2950 2951/***/ }, 2952 2953/***/ 1103 2954(module) { 2955 2956 2957module.exports = function (exec) { 2958 try { 2959 return { error: false, value: exec() }; 2960 } catch (error) { 2961 return { error: true, value: error }; 2962 } 2963}; 2964 2965 2966/***/ }, 2967 2968/***/ 7750 2969(module, __unused_webpack_exports, __webpack_require__) { 2970 2971 2972var isNullOrUndefined = __webpack_require__(4117); 2973 2974var $TypeError = TypeError; 2975 2976// `RequireObjectCoercible` abstract operation 2977// https://tc39.es/ecma262/#sec-requireobjectcoercible 2978module.exports = function (it) { 2979 if (isNullOrUndefined(it)) throw new $TypeError("Can't call method on " + it); 2980 return it; 2981}; 2982 2983 2984/***/ }, 2985 2986/***/ 9286 2987(module, __unused_webpack_exports, __webpack_require__) { 2988 2989 2990var SetHelpers = __webpack_require__(4402); 2991var iterate = __webpack_require__(8469); 2992 2993var Set = SetHelpers.Set; 2994var add = SetHelpers.add; 2995 2996module.exports = function (set) { 2997 var result = new Set(); 2998 iterate(set, function (it) { 2999 add(result, it); 3000 }); 3001 return result; 3002}; 3003 3004 3005/***/ }, 3006 3007/***/ 3440 3008(module, __unused_webpack_exports, __webpack_require__) { 3009 3010 3011var aSet = __webpack_require__(7080); 3012var SetHelpers = __webpack_require__(4402); 3013var clone = __webpack_require__(9286); 3014var size = __webpack_require__(5170); 3015var getSetRecord = __webpack_require__(3789); 3016var iterateSet = __webpack_require__(8469); 3017var iterateSimple = __webpack_require__(507); 3018 3019var has = SetHelpers.has; 3020var remove = SetHelpers.remove; 3021 3022// `Set.prototype.difference` method 3023// https://tc39.es/ecma262/#sec-set.prototype.difference 3024module.exports = function difference(other) { 3025 var O = aSet(this); 3026 var otherRec = getSetRecord(other); 3027 var result = clone(O); 3028 if (size(result) <= otherRec.size) iterateSet(result, function (e) { 3029 if (otherRec.includes(e)) remove(result, e); 3030 }); 3031 else iterateSimple(otherRec.getIterator(), function (e) { 3032 if (has(result, e)) remove(result, e); 3033 }); 3034 return result; 3035}; 3036 3037 3038/***/ }, 3039 3040/***/ 4402 3041(module, __unused_webpack_exports, __webpack_require__) { 3042 3043 3044var uncurryThis = __webpack_require__(9504); 3045 3046// eslint-disable-next-line es/no-set -- safe 3047var SetPrototype = Set.prototype; 3048 3049module.exports = { 3050 // eslint-disable-next-line es/no-set -- safe 3051 Set: Set, 3052 add: uncurryThis(SetPrototype.add), 3053 has: uncurryThis(SetPrototype.has), 3054 remove: uncurryThis(SetPrototype['delete']), 3055 proto: SetPrototype 3056}; 3057 3058 3059/***/ }, 3060 3061/***/ 8750 3062(module, __unused_webpack_exports, __webpack_require__) { 3063 3064 3065var aSet = __webpack_require__(7080); 3066var SetHelpers = __webpack_require__(4402); 3067var size = __webpack_require__(5170); 3068var getSetRecord = __webpack_require__(3789); 3069var iterateSet = __webpack_require__(8469); 3070var iterateSimple = __webpack_require__(507); 3071 3072var Set = SetHelpers.Set; 3073var add = SetHelpers.add; 3074var has = SetHelpers.has; 3075 3076// `Set.prototype.intersection` method 3077// https://tc39.es/ecma262/#sec-set.prototype.intersection 3078module.exports = function intersection(other) { 3079 var O = aSet(this); 3080 var otherRec = getSetRecord(other); 3081 var result = new Set(); 3082 3083 if (size(O) > otherRec.size) { 3084 iterateSimple(otherRec.getIterator(), function (e) { 3085 if (has(O, e)) add(result, e); 3086 }); 3087 } else { 3088 iterateSet(O, function (e) { 3089 if (otherRec.includes(e)) add(result, e); 3090 }); 3091 } 3092 3093 return result; 3094}; 3095 3096 3097/***/ }, 3098 3099/***/ 4449 3100(module, __unused_webpack_exports, __webpack_require__) { 3101 3102 3103var aSet = __webpack_require__(7080); 3104var has = (__webpack_require__(4402).has); 3105var size = __webpack_require__(5170); 3106var getSetRecord = __webpack_require__(3789); 3107var iterateSet = __webpack_require__(8469); 3108var iterateSimple = __webpack_require__(507); 3109var iteratorClose = __webpack_require__(9539); 3110 3111// `Set.prototype.isDisjointFrom` method 3112// https://tc39.es/ecma262/#sec-set.prototype.isdisjointfrom 3113module.exports = function isDisjointFrom(other) { 3114 var O = aSet(this); 3115 var otherRec = getSetRecord(other); 3116 if (size(O) <= otherRec.size) return iterateSet(O, function (e) { 3117 if (otherRec.includes(e)) return false;
vendor: 4,495 bytes, lines 3118-3293
3118 }, true) !== false; 3119 var iterator = otherRec.getIterator(); 3120 return iterateSimple(iterator, function (e) { 3121 if (has(O, e)) return iteratorClose(iterator.iterator, 'normal', false); 3122 }) !== false; 3123}; 3124 3125 3126/***/ }, 3127 3128/***/ 3838 3129(module, __unused_webpack_exports, __webpack_require__) { 3130 3131 3132var aSet = __webpack_require__(7080); 3133var size = __webpack_require__(5170); 3134var iterate = __webpack_require__(8469); 3135var getSetRecord = __webpack_require__(3789); 3136 3137// `Set.prototype.isSubsetOf` method 3138// https://tc39.es/ecma262/#sec-set.prototype.issubsetof 3139module.exports = function isSubsetOf(other) { 3140 var O = aSet(this); 3141 var otherRec = getSetRecord(other); 3142 if (size(O) > otherRec.size) return false; 3143 return iterate(O, function (e) { 3144 if (!otherRec.includes(e)) return false; 3145 }, true) !== false; 3146}; 3147 3148 3149/***/ }, 3150 3151/***/ 8527 3152(module, __unused_webpack_exports, __webpack_require__) { 3153 3154 3155var aSet = __webpack_require__(7080); 3156var has = (__webpack_require__(4402).has); 3157var size = __webpack_require__(5170); 3158var getSetRecord = __webpack_require__(3789); 3159var iterateSimple = __webpack_require__(507); 3160var iteratorClose = __webpack_require__(9539); 3161 3162// `Set.prototype.isSupersetOf` method 3163// https://tc39.es/ecma262/#sec-set.prototype.issupersetof 3164module.exports = function isSupersetOf(other) { 3165 var O = aSet(this); 3166 var otherRec = getSetRecord(other); 3167 if (size(O) < otherRec.size) return false; 3168 var iterator = otherRec.getIterator(); 3169 return iterateSimple(iterator, function (e) { 3170 if (!has(O, e)) return iteratorClose(iterator.iterator, 'normal', false); 3171 }) !== false; 3172}; 3173 3174 3175/***/ }, 3176 3177/***/ 8469 3178(module, __unused_webpack_exports, __webpack_require__) { 3179 3180 3181var uncurryThis = __webpack_require__(9504); 3182var iterateSimple = __webpack_require__(507); 3183var SetHelpers = __webpack_require__(4402); 3184 3185var Set = SetHelpers.Set; 3186var SetPrototype = SetHelpers.proto; 3187var forEach = uncurryThis(SetPrototype.forEach); 3188var keys = uncurryThis(SetPrototype.keys); 3189var next = keys(new Set()).next; 3190 3191module.exports = function (set, fn, interruptible) { 3192 return interruptible ? iterateSimple({ iterator: keys(set), next: next }, fn) : forEach(set, fn); 3193}; 3194 3195 3196/***/ }, 3197 3198/***/ 4916 3199(module, __unused_webpack_exports, __webpack_require__) { 3200 3201 3202var getBuiltIn = __webpack_require__(7751); 3203 3204var createSetLike = function (size) { 3205 return { 3206 size: size, 3207 has: function () { 3208 return false; 3209 }, 3210 keys: function () { 3211 return { 3212 next: function () { 3213 return { done: true }; 3214 } 3215 }; 3216 } 3217 }; 3218}; 3219 3220var createSetLikeWithInfinitySize = function (size) { 3221 return { 3222 size: size, 3223 has: function () { 3224 return true; 3225 }, 3226 keys: function () { 3227 throw new Error('e'); 3228 } 3229 }; 3230}; 3231 3232module.exports = function (name, callback) { 3233 var Set = getBuiltIn('Set'); 3234 try { 3235 new Set()[name](createSetLike(0)); 3236 try { 3237 // late spec change, early WebKit ~ Safari 17 implementation does not pass it 3238 // https://github.com/tc39/proposal-set-methods/pull/88 3239 // also covered engines with 3240 // https://bugs.webkit.org/show_bug.cgi?id=272679 3241 new Set()[name](createSetLike(-1)); 3242 return false; 3243 } catch (error2) { 3244 if (!callback) return true; 3245 // early V8 implementation bug 3246 // https://issues.chromium.org/issues/351332634 3247 try { 3248 new Set()[name](createSetLikeWithInfinitySize(-Infinity)); 3249 return false; 3250 } catch (error) { 3251 var set = new Set([1, 2]); 3252 return callback(set[name](createSetLikeWithInfinitySize(Infinity))); 3253 } 3254 } 3255 } catch (error) { 3256 return false; 3257 } 3258}; 3259 3260 3261/***/ }, 3262 3263/***/ 9835 3264(module) { 3265 3266 3267// Should get iterator record of a set-like object before cloning this 3268// https://bugs.webkit.org/show_bug.cgi?id=289430 3269module.exports = function (METHOD_NAME) { 3270 try { 3271 // eslint-disable-next-line es/no-set -- needed for test 3272 var baseSet = new Set(); 3273 var setLike = { 3274 size: 0, 3275 has: function () { return true; }, 3276 keys: function () { 3277 // eslint-disable-next-line es/no-object-defineproperty -- needed for test 3278 return Object.defineProperty({}, 'next', { 3279 get: function () { 3280 baseSet.clear(); 3281 baseSet.add(4); 3282 return function () { 3283 return { done: true }; 3284 }; 3285 } 3286 }); 3287 } 3288 }; 3289 var result = baseSet[METHOD_NAME](setLike); 3290 3291 return result.size === 1 && result.values().next().value === 4; 3292 } catch (error) { 3293 return false;
vendor: 4,239 bytes, lines 3294-3457
3294 } 3295}; 3296 3297 3298/***/ }, 3299 3300/***/ 5170 3301(module, __unused_webpack_exports, __webpack_require__) { 3302 3303 3304var uncurryThisAccessor = __webpack_require__(6706); 3305var SetHelpers = __webpack_require__(4402); 3306 3307module.exports = uncurryThisAccessor(SetHelpers.proto, 'size', 'get') || function (set) { 3308 return set.size; 3309}; 3310 3311 3312/***/ }, 3313 3314/***/ 3650 3315(module, __unused_webpack_exports, __webpack_require__) { 3316 3317 3318var aSet = __webpack_require__(7080); 3319var SetHelpers = __webpack_require__(4402); 3320var clone = __webpack_require__(9286); 3321var getSetRecord = __webpack_require__(3789); 3322var iterateSimple = __webpack_require__(507); 3323 3324var add = SetHelpers.add; 3325var has = SetHelpers.has; 3326var remove = SetHelpers.remove; 3327 3328// `Set.prototype.symmetricDifference` method 3329// https://tc39.es/ecma262/#sec-set.prototype.symmetricdifference 3330module.exports = function symmetricDifference(other) { 3331 var O = aSet(this); 3332 var keysIter = getSetRecord(other).getIterator(); 3333 var result = clone(O); 3334 iterateSimple(keysIter, function (e) { 3335 if (has(O, e)) remove(result, e); 3336 else add(result, e); 3337 }); 3338 return result; 3339}; 3340 3341 3342/***/ }, 3343 3344/***/ 4204 3345(module, __unused_webpack_exports, __webpack_require__) { 3346 3347 3348var aSet = __webpack_require__(7080); 3349var add = (__webpack_require__(4402).add); 3350var clone = __webpack_require__(9286); 3351var getSetRecord = __webpack_require__(3789); 3352var iterateSimple = __webpack_require__(507); 3353 3354// `Set.prototype.union` method 3355// https://tc39.es/ecma262/#sec-set.prototype.union 3356module.exports = function union(other) { 3357 var O = aSet(this); 3358 var keysIter = getSetRecord(other).getIterator(); 3359 var result = clone(O); 3360 iterateSimple(keysIter, function (it) { 3361 add(result, it); 3362 }); 3363 return result; 3364}; 3365 3366 3367/***/ }, 3368 3369/***/ 6119 3370(module, __unused_webpack_exports, __webpack_require__) { 3371 3372 3373var shared = __webpack_require__(5745); 3374var uid = __webpack_require__(3392); 3375 3376var keys = shared('keys'); 3377 3378module.exports = function (key) { 3379 return keys[key] || (keys[key] = uid(key)); 3380}; 3381 3382 3383/***/ }, 3384 3385/***/ 7629 3386(module, __unused_webpack_exports, __webpack_require__) { 3387 3388 3389var IS_PURE = __webpack_require__(6395); 3390var globalThis = __webpack_require__(4576); 3391var defineGlobalProperty = __webpack_require__(9433); 3392 3393var SHARED = '__core-js_shared__'; 3394var store = module.exports = globalThis[SHARED] || defineGlobalProperty(SHARED, {}); 3395 3396(store.versions || (store.versions = [])).push({ 3397 version: '3.49.0', 3398 mode: IS_PURE ? 'pure' : 'global', 3399 copyright: '© 2013â2025 Denis Pushkarev (zloirock.ru), 2025â2026 CoreJS Company (core-js.io). All rights reserved.', 3400 license: 'https://github.com/zloirock/core-js/blob/v3.49.0/LICENSE', 3401 source: 'https://github.com/zloirock/core-js' 3402}); 3403 3404 3405/***/ }, 3406 3407/***/ 5745 3408(module, __unused_webpack_exports, __webpack_require__) { 3409 3410 3411var store = __webpack_require__(7629); 3412 3413module.exports = function (key, value) { 3414 return store[key] || (store[key] = value || {}); 3415}; 3416 3417 3418/***/ }, 3419 3420/***/ 1548 3421(module, __unused_webpack_exports, __webpack_require__) { 3422 3423 3424var globalThis = __webpack_require__(4576); 3425var fails = __webpack_require__(9039); 3426var V8 = __webpack_require__(9519); 3427var ENVIRONMENT = __webpack_require__(4215); 3428 3429var structuredClone = globalThis.structuredClone; 3430 3431module.exports = !!structuredClone && !fails(function () { 3432 // prevent V8 ArrayBufferDetaching protector cell invalidation and performance degradation 3433 // https://github.com/zloirock/core-js/issues/679 3434 if ((ENVIRONMENT === 'DENO' && V8 > 92) || (ENVIRONMENT === 'NODE' && V8 > 94) || (ENVIRONMENT === 'BROWSER' && V8 > 97)) return false; 3435 var buffer = new ArrayBuffer(8); 3436 var clone = structuredClone(buffer, { transfer: [buffer] }); 3437 return buffer.byteLength !== 0 || clone.byteLength !== 8; 3438}); 3439 3440 3441/***/ }, 3442 3443/***/ 4495 3444(module, __unused_webpack_exports, __webpack_require__) { 3445 3446 3447/* eslint-disable es/no-symbol -- required for testing */ 3448var V8_VERSION = __webpack_require__(9519); 3449var fails = __webpack_require__(9039); 3450var globalThis = __webpack_require__(4576); 3451 3452var $String = globalThis.String; 3453 3454// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing 3455module.exports = !!Object.getOwnPropertySymbols && !fails(function () { 3456 var symbol = Symbol('symbol detection'); 3457 // Chrome 38 Symbol has incorrect toString conversion
vendor: 7,007 bytes, lines 3458-3742
3458 // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances 3459 // nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will, 3460 // of course, fail. 3461 return !$String(symbol) || !(Object(symbol) instanceof Symbol) || 3462 // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances 3463 !Symbol.sham && V8_VERSION && V8_VERSION < 41; 3464}); 3465 3466 3467/***/ }, 3468 3469/***/ 5610 3470(module, __unused_webpack_exports, __webpack_require__) { 3471 3472 3473var toIntegerOrInfinity = __webpack_require__(1291); 3474 3475var max = Math.max; 3476var min = Math.min; 3477 3478// Helper for a popular repeating case of the spec: 3479// Let integer be ? ToInteger(index). 3480// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length). 3481module.exports = function (index, length) { 3482 var integer = toIntegerOrInfinity(index); 3483 return integer < 0 ? max(integer + length, 0) : min(integer, length); 3484}; 3485 3486 3487/***/ }, 3488 3489/***/ 5854 3490(module, __unused_webpack_exports, __webpack_require__) { 3491 3492 3493var toPrimitive = __webpack_require__(2777); 3494 3495var $TypeError = TypeError; 3496 3497// `ToBigInt` abstract operation 3498// https://tc39.es/ecma262/#sec-tobigint 3499module.exports = function (argument) { 3500 var prim = toPrimitive(argument, 'number'); 3501 if (typeof prim == 'number') throw new $TypeError("Can't convert number to bigint"); 3502 // eslint-disable-next-line es/no-bigint -- safe 3503 return BigInt(prim); 3504}; 3505 3506 3507/***/ }, 3508 3509/***/ 7696 3510(module, __unused_webpack_exports, __webpack_require__) { 3511 3512 3513var toIntegerOrInfinity = __webpack_require__(1291); 3514var toLength = __webpack_require__(8014); 3515 3516var $RangeError = RangeError; 3517 3518// `ToIndex` abstract operation 3519// https://tc39.es/ecma262/#sec-toindex 3520module.exports = function (it) { 3521 if (it === undefined) return 0; 3522 var number = toIntegerOrInfinity(it); 3523 var length = toLength(number); 3524 if (number !== length) throw new $RangeError('Wrong length or index'); 3525 return length; 3526}; 3527 3528 3529/***/ }, 3530 3531/***/ 5397 3532(module, __unused_webpack_exports, __webpack_require__) { 3533 3534 3535// toObject with fallback for non-array-like ES3 strings 3536var IndexedObject = __webpack_require__(7055); 3537var requireObjectCoercible = __webpack_require__(7750); 3538 3539module.exports = function (it) { 3540 return IndexedObject(requireObjectCoercible(it)); 3541}; 3542 3543 3544/***/ }, 3545 3546/***/ 1291 3547(module, __unused_webpack_exports, __webpack_require__) { 3548 3549 3550var trunc = __webpack_require__(741); 3551 3552// `ToIntegerOrInfinity` abstract operation 3553// https://tc39.es/ecma262/#sec-tointegerorinfinity 3554module.exports = function (argument) { 3555 var number = +argument; 3556 // eslint-disable-next-line no-self-compare -- NaN check 3557 return number !== number || number === 0 ? 0 : trunc(number); 3558}; 3559 3560 3561/***/ }, 3562 3563/***/ 8014 3564(module, __unused_webpack_exports, __webpack_require__) { 3565 3566 3567var toIntegerOrInfinity = __webpack_require__(1291); 3568 3569var min = Math.min; 3570 3571// `ToLength` abstract operation 3572// https://tc39.es/ecma262/#sec-tolength 3573module.exports = function (argument) { 3574 var len = toIntegerOrInfinity(argument); 3575 return len > 0 ? min(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 3576}; 3577 3578 3579/***/ }, 3580 3581/***/ 8981 3582(module, __unused_webpack_exports, __webpack_require__) { 3583 3584 3585var requireObjectCoercible = __webpack_require__(7750); 3586 3587var $Object = Object; 3588 3589// `ToObject` abstract operation 3590// https://tc39.es/ecma262/#sec-toobject 3591module.exports = function (argument) { 3592 return $Object(requireObjectCoercible(argument)); 3593}; 3594 3595 3596/***/ }, 3597 3598/***/ 2777 3599(module, __unused_webpack_exports, __webpack_require__) { 3600 3601 3602var call = __webpack_require__(9565); 3603var isObject = __webpack_require__(34); 3604var isSymbol = __webpack_require__(757); 3605var getMethod = __webpack_require__(5966); 3606var ordinaryToPrimitive = __webpack_require__(4270); 3607var wellKnownSymbol = __webpack_require__(8227); 3608 3609var $TypeError = TypeError; 3610var TO_PRIMITIVE = wellKnownSymbol('toPrimitive'); 3611 3612// `ToPrimitive` abstract operation 3613// https://tc39.es/ecma262/#sec-toprimitive 3614module.exports = function (input, pref) { 3615 if (!isObject(input) || isSymbol(input)) return input; 3616 var exoticToPrim = getMethod(input, TO_PRIMITIVE); 3617 var result; 3618 if (exoticToPrim) { 3619 if (pref === undefined) pref = 'default'; 3620 result = call(exoticToPrim, input, pref); 3621 if (!isObject(result) || isSymbol(result)) return result; 3622 throw new $TypeError("Can't convert object to primitive value"); 3623 } 3624 if (pref === undefined) pref = 'number'; 3625 return ordinaryToPrimitive(input, pref); 3626}; 3627 3628 3629/***/ }, 3630 3631/***/ 6969 3632(module, __unused_webpack_exports, __webpack_require__) { 3633 3634 3635var toPrimitive = __webpack_require__(2777); 3636var isSymbol = __webpack_require__(757); 3637 3638// `ToPropertyKey` abstract operation 3639// https://tc39.es/ecma262/#sec-topropertykey 3640module.exports = function (argument) { 3641 var key = toPrimitive(argument, 'string'); 3642 return isSymbol(key) ? key : key + ''; 3643}; 3644 3645 3646/***/ }, 3647 3648/***/ 2140 3649(module, __unused_webpack_exports, __webpack_require__) { 3650 3651 3652var wellKnownSymbol = __webpack_require__(8227); 3653 3654var TO_STRING_TAG = wellKnownSymbol('toStringTag'); 3655var test = {}; 3656// eslint-disable-next-line unicorn/no-immediate-mutation -- ES3 syntax limitation 3657test[TO_STRING_TAG] = 'z'; 3658 3659module.exports = String(test) === '[object z]'; 3660 3661 3662/***/ }, 3663 3664/***/ 655 3665(module, __unused_webpack_exports, __webpack_require__) { 3666 3667 3668var classof = __webpack_require__(6955); 3669 3670var $String = String; 3671 3672module.exports = function (argument) { 3673 if (classof(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string'); 3674 return $String(argument); 3675}; 3676 3677 3678/***/ }, 3679 3680/***/ 6823 3681(module) { 3682 3683 3684var $String = String; 3685 3686module.exports = function (argument) { 3687 try { 3688 return $String(argument); 3689 } catch (error) { 3690 return 'Object'; 3691 } 3692}; 3693 3694 3695/***/ }, 3696 3697/***/ 3392 3698(module, __unused_webpack_exports, __webpack_require__) { 3699 3700 3701var uncurryThis = __webpack_require__(9504); 3702 3703var id = 0; 3704var postfix = Math.random(); 3705var toString = uncurryThis(1.1.toString); 3706 3707module.exports = function (key) { 3708 return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36); 3709}; 3710 3711 3712/***/ }, 3713 3714/***/ 9143 3715(module, __unused_webpack_exports, __webpack_require__) { 3716 3717 3718var globalThis = __webpack_require__(4576); 3719var uncurryThis = __webpack_require__(9504); 3720var anObjectOrUndefined = __webpack_require__(3972); 3721var aString = __webpack_require__(3463); 3722var hasOwn = __webpack_require__(9297); 3723var base64Map = __webpack_require__(2804); 3724var getAlphabetOption = __webpack_require__(944); 3725var notDetached = __webpack_require__(5169); 3726 3727var base64Alphabet = base64Map.c2i; 3728var base64UrlAlphabet = base64Map.c2iUrl; 3729 3730var SyntaxError = globalThis.SyntaxError; 3731var TypeError = globalThis.TypeError; 3732var at = uncurryThis(''.charAt); 3733 3734var skipAsciiWhitespace = function (string, index) { 3735 var length = string.length; 3736 for (;index < length; index++) { 3737 var chr = at(string, index); 3738 if (chr !== ' ' && chr !== '\t' && chr !== '\n' && chr !== '\f' && chr !== '\r') break; 3739 } return index; 3740}; 3741 3742var decodeBase64Chunk = function (chunk, alphabet, throwOnExtraBits) {
vendor: 10,007 bytes, lines 3743-4099
3743 var chunkLength = chunk.length; 3744 3745 if (chunkLength < 4) { 3746 chunk += chunkLength === 2 ? 'AA' : 'A'; 3747 } 3748 3749 var triplet = (alphabet[at(chunk, 0)] << 18) 3750 + (alphabet[at(chunk, 1)] << 12) 3751 + (alphabet[at(chunk, 2)] << 6) 3752 + alphabet[at(chunk, 3)]; 3753 3754 var chunkBytes = [ 3755 (triplet >> 16) & 255, 3756 (triplet >> 8) & 255, 3757 triplet & 255 3758 ]; 3759 3760 if (chunkLength === 2) { 3761 if (throwOnExtraBits && chunkBytes[1] !== 0) { 3762 throw new SyntaxError('Extra bits'); 3763 } 3764 return [chunkBytes[0]]; 3765 } 3766 3767 if (chunkLength === 3) { 3768 if (throwOnExtraBits && chunkBytes[2] !== 0) { 3769 throw new SyntaxError('Extra bits'); 3770 } 3771 return [chunkBytes[0], chunkBytes[1]]; 3772 } 3773 3774 return chunkBytes; 3775}; 3776 3777var writeBytes = function (bytes, elements, written) { 3778 var elementsLength = elements.length; 3779 for (var index = 0; index < elementsLength; index++) { 3780 bytes[written + index] = elements[index]; 3781 } 3782 return written + elementsLength; 3783}; 3784 3785/* eslint-disable max-statements, max-depth -- TODO */ 3786module.exports = function (string, options, into, maxLength) { 3787 aString(string); 3788 anObjectOrUndefined(options); 3789 var alphabet = getAlphabetOption(options) === 'base64' ? base64Alphabet : base64UrlAlphabet; 3790 var lastChunkHandling = options ? options.lastChunkHandling : undefined; 3791 3792 if (lastChunkHandling === undefined) lastChunkHandling = 'loose'; 3793 3794 if (lastChunkHandling !== 'loose' && lastChunkHandling !== 'strict' && lastChunkHandling !== 'stop-before-partial') { 3795 throw new TypeError('Incorrect `lastChunkHandling` option'); 3796 } 3797 3798 if (into) notDetached(into.buffer); 3799 3800 var stringLength = string.length; 3801 var bytes = into || []; 3802 var written = 0; 3803 var read = 0; 3804 var chunk = ''; 3805 var index = 0; 3806 3807 if (maxLength) while (true) { 3808 index = skipAsciiWhitespace(string, index); 3809 if (index === stringLength) { 3810 if (chunk.length > 0) { 3811 if (lastChunkHandling === 'stop-before-partial') { 3812 break; 3813 } 3814 if (lastChunkHandling === 'loose') { 3815 if (chunk.length === 1) { 3816 throw new SyntaxError('Malformed padding: exactly one additional character'); 3817 } 3818 written = writeBytes(bytes, decodeBase64Chunk(chunk, alphabet, false), written); 3819 } else { 3820 throw new SyntaxError('Missing padding'); 3821 } 3822 } 3823 read = stringLength; 3824 break; 3825 } 3826 var chr = at(string, index); 3827 ++index; 3828 if (chr === '=') { 3829 if (chunk.length < 2) { 3830 throw new SyntaxError('Padding is too early'); 3831 } 3832 index = skipAsciiWhitespace(string, index); 3833 if (chunk.length === 2) { 3834 if (index === stringLength) { 3835 if (lastChunkHandling === 'stop-before-partial') { 3836 break; 3837 } 3838 throw new SyntaxError('Malformed padding: only one ='); 3839 } 3840 if (at(string, index) === '=') { 3841 ++index; 3842 index = skipAsciiWhitespace(string, index); 3843 } 3844 } 3845 if (index < stringLength) { 3846 throw new SyntaxError('Unexpected character after padding'); 3847 } 3848 written = writeBytes(bytes, decodeBase64Chunk(chunk, alphabet, lastChunkHandling === 'strict'), written); 3849 read = stringLength; 3850 break; 3851 } 3852 if (!hasOwn(alphabet, chr)) { 3853 throw new SyntaxError('Unexpected character'); 3854 } 3855 var remainingBytes = maxLength - written; 3856 if (remainingBytes === 1 && chunk.length === 2 || remainingBytes === 2 && chunk.length === 3) { 3857 // special case: we can fit exactly the number of bytes currently represented by chunk, so we were just checking for `=` 3858 break; 3859 } 3860 3861 chunk += chr; 3862 if (chunk.length === 4) { 3863 written = writeBytes(bytes, decodeBase64Chunk(chunk, alphabet, false), written); 3864 chunk = ''; 3865 read = index; 3866 if (written === maxLength) { 3867 break; 3868 } 3869 } 3870 } 3871 3872 return { bytes: bytes, read: read, written: written }; 3873}; 3874 3875 3876/***/ }, 3877 3878/***/ 2303 3879(module, __unused_webpack_exports, __webpack_require__) { 3880 3881 3882var globalThis = __webpack_require__(4576); 3883var uncurryThis = __webpack_require__(9504); 3884 3885var Uint8Array = globalThis.Uint8Array; 3886var SyntaxError = globalThis.SyntaxError; 3887var min = Math.min; 3888var stringMatch = uncurryThis(''.match); 3889 3890module.exports = function (string, into) { 3891 var stringLength = string.length; 3892 if (stringLength % 2 !== 0) throw new SyntaxError('String should be an even number of characters'); 3893 var maxLength = into ? min(into.length, stringLength / 2) : stringLength / 2; 3894 var bytes = into || new Uint8Array(maxLength); 3895 var segments = stringMatch(string, /.{2}/g); 3896 var written = 0; 3897 for (; written < maxLength; written++) { 3898 var result = +('0x' + segments[written] + '0'); 3899 // eslint-disable-next-line no-self-compare -- NaN check 3900 if (result !== result) { 3901 throw new SyntaxError('String should only contain hex characters'); 3902 } 3903 bytes[written] = result >> 4; 3904 } 3905 return { bytes: bytes, read: written << 1 }; 3906}; 3907 3908 3909/***/ }, 3910 3911/***/ 7416 3912(module, __unused_webpack_exports, __webpack_require__) { 3913 3914 3915var fails = __webpack_require__(9039); 3916var wellKnownSymbol = __webpack_require__(8227); 3917var DESCRIPTORS = __webpack_require__(3724); 3918var IS_PURE = __webpack_require__(6395); 3919 3920var ITERATOR = wellKnownSymbol('iterator'); 3921 3922module.exports = !fails(function () { 3923 // eslint-disable-next-line unicorn/relative-url-style -- required for testing 3924 var url = new URL('b?a=1&b=2&c=3', 'https://a'); 3925 var params = url.searchParams; 3926 var params2 = new URLSearchParams('a=1&a=2&b=3'); 3927 var result = ''; 3928 url.pathname = 'c%20d'; 3929 params.forEach(function (value, key) { 3930 params['delete']('b'); 3931 result += key + value; 3932 }); 3933 params2['delete']('a', 2); 3934 // `undefined` case is a Chromium 117 bug 3935 // https://bugs.chromium.org/p/v8/issues/detail?id=14222 3936 params2['delete']('b', undefined); 3937 return (IS_PURE && (!url.toJSON || !params2.has('a', 1) || params2.has('a', 2) || !params2.has('a', undefined) || params2.has('b'))) 3938 || (!params.size && (IS_PURE || !DESCRIPTORS)) 3939 || !params.sort 3940 || url.href !== 'https://a/c%20d?a=1&c=3' 3941 || params.get('c') !== '3' 3942 || String(new URLSearchParams('?a=1')) !== 'a=1' 3943 || !params[ITERATOR] 3944 // throws in Edge 3945 || new URL('https://a@b').username !== 'a' 3946 || new URLSearchParams(new URLSearchParams('a=b')).get('a') !== 'b' 3947 // not punycoded in Edge 3948 || new URL('https://ÑеÑÑ').host !== 'xn--e1aybc' 3949 // not escaped in Chrome 62- 3950 || new URL('https://a#б').hash !== '#%D0%B1' 3951 // fails in Chrome 66- 3952 || result !== 'a1c3' 3953 // throws in Safari 3954 || new URL('https://x', undefined).host !== 'x'; 3955}); 3956 3957 3958/***/ }, 3959 3960/***/ 7040 3961(module, __unused_webpack_exports, __webpack_require__) { 3962 3963 3964/* eslint-disable es/no-symbol -- required for testing */ 3965var NATIVE_SYMBOL = __webpack_require__(4495); 3966 3967module.exports = NATIVE_SYMBOL && 3968 !Symbol.sham && 3969 typeof Symbol.iterator == 'symbol'; 3970 3971 3972/***/ }, 3973 3974/***/ 8686 3975(module, __unused_webpack_exports, __webpack_require__) { 3976 3977 3978var DESCRIPTORS = __webpack_require__(3724); 3979var fails = __webpack_require__(9039); 3980 3981// V8 ~ Chrome 36- 3982// https://bugs.chromium.org/p/v8/issues/detail?id=3334 3983module.exports = DESCRIPTORS && fails(function () { 3984 // eslint-disable-next-line es/no-object-defineproperty -- required for testing 3985 return Object.defineProperty(function () { /* empty */ }, 'prototype', { 3986 value: 42, 3987 writable: false 3988 }).prototype !== 42; 3989}); 3990 3991 3992/***/ }, 3993 3994/***/ 2812 3995(module) { 3996 3997 3998var $TypeError = TypeError; 3999 4000module.exports = function (passed, required) { 4001 if (passed < required) throw new $TypeError('Not enough arguments'); 4002 return passed; 4003}; 4004 4005 4006/***/ }, 4007 4008/***/ 8622 4009(module, __unused_webpack_exports, __webpack_require__) { 4010 4011 4012var globalThis = __webpack_require__(4576); 4013var isCallable = __webpack_require__(4901); 4014 4015var WeakMap = globalThis.WeakMap; 4016 4017module.exports = isCallable(WeakMap) && /native code/.test(String(WeakMap)); 4018 4019 4020/***/ }, 4021 4022/***/ 4995 4023(module, __unused_webpack_exports, __webpack_require__) { 4024 4025 4026var uncurryThis = __webpack_require__(9504); 4027 4028// eslint-disable-next-line es/no-weak-map -- safe 4029var WeakMapPrototype = WeakMap.prototype; 4030 4031module.exports = { 4032 // eslint-disable-next-line es/no-weak-map -- safe 4033 WeakMap: WeakMap, 4034 set: uncurryThis(WeakMapPrototype.set), 4035 get: uncurryThis(WeakMapPrototype.get), 4036 has: uncurryThis(WeakMapPrototype.has), 4037 remove: uncurryThis(WeakMapPrototype['delete']) 4038}; 4039 4040 4041/***/ }, 4042 4043/***/ 8227 4044(module, __unused_webpack_exports, __webpack_require__) { 4045 4046 4047var globalThis = __webpack_require__(4576); 4048var shared = __webpack_require__(5745); 4049var hasOwn = __webpack_require__(9297); 4050var uid = __webpack_require__(3392); 4051var NATIVE_SYMBOL = __webpack_require__(4495); 4052var USE_SYMBOL_AS_UID = __webpack_require__(7040); 4053 4054var Symbol = globalThis.Symbol; 4055var WellKnownSymbolsStore = shared('wks'); 4056var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol['for'] || Symbol : Symbol && Symbol.withoutSetter || uid; 4057 4058module.exports = function (name) { 4059 if (!hasOwn(WellKnownSymbolsStore, name)) { 4060 WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn(Symbol, name) 4061 ? Symbol[name] 4062 : createWellKnownSymbol('Symbol.' + name); 4063 } return WellKnownSymbolsStore[name]; 4064}; 4065 4066 4067/***/ }, 4068 4069/***/ 6573 4070(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 4071 4072 4073var DESCRIPTORS = __webpack_require__(3724); 4074var defineBuiltInAccessor = __webpack_require__(2106); 4075var isDetached = __webpack_require__(3238); 4076 4077var ArrayBufferPrototype = ArrayBuffer.prototype; 4078 4079// `ArrayBuffer.prototype.detached` getter 4080// https://tc39.es/ecma262/#sec-get-arraybuffer.prototype.detached 4081if (DESCRIPTORS && !('detached' in ArrayBufferPrototype)) { 4082 defineBuiltInAccessor(ArrayBufferPrototype, 'detached', { 4083 configurable: true, 4084 get: function detached() { 4085 return isDetached(this); 4086 } 4087 }); 4088} 4089 4090 4091/***/ }, 4092 4093/***/ 7936 4094(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 4095 4096 4097var $ = __webpack_require__(6518); 4098var $transfer = __webpack_require__(5636); 4099
vendor: 4,160 bytes, lines 4100-4232
4100// `ArrayBuffer.prototype.transferToFixedLength` method 4101// https://tc39.es/ecma262/#sec-arraybuffer.prototype.transfertofixedlength 4102if ($transfer) $({ target: 'ArrayBuffer', proto: true }, { 4103 transferToFixedLength: function transferToFixedLength() { 4104 return $transfer(this, arguments.length ? arguments[0] : undefined, false); 4105 } 4106}); 4107 4108 4109/***/ }, 4110 4111/***/ 8100 4112(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 4113 4114 4115var $ = __webpack_require__(6518); 4116var $transfer = __webpack_require__(5636); 4117 4118// `ArrayBuffer.prototype.transfer` method 4119// https://tc39.es/ecma262/#sec-arraybuffer.prototype.transfer 4120if ($transfer) $({ target: 'ArrayBuffer', proto: true }, { 4121 transfer: function transfer() { 4122 return $transfer(this, arguments.length ? arguments[0] : undefined, true); 4123 } 4124}); 4125 4126 4127/***/ }, 4128 4129/***/ 4423 4130(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 4131 4132 4133var $ = __webpack_require__(6518); 4134var $includes = (__webpack_require__(9617).includes); 4135var fails = __webpack_require__(9039); 4136var addToUnscopables = __webpack_require__(6469); 4137 4138// FF99+ bug 4139var BROKEN_ON_SPARSE = fails(function () { 4140 // eslint-disable-next-line es/no-array-prototype-includes -- detection 4141 return !Array(1).includes(); 4142}); 4143 4144// Safari 26.4- bug 4145var BROKEN_ON_SPARSE_WITH_FROM_INDEX = fails(function () { 4146 // eslint-disable-next-line no-sparse-arrays, es/no-array-prototype-includes -- detection 4147 return [, 1].includes(undefined, 1); 4148}); 4149 4150// `Array.prototype.includes` method 4151// https://tc39.es/ecma262/#sec-array.prototype.includes 4152$({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE || BROKEN_ON_SPARSE_WITH_FROM_INDEX }, { 4153 includes: function includes(el /* , fromIndex = 0 */) { 4154 return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); 4155 } 4156}); 4157 4158// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables 4159addToUnscopables('includes'); 4160 4161 4162/***/ }, 4163 4164/***/ 4114 4165(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 4166 4167 4168var $ = __webpack_require__(6518); 4169var toObject = __webpack_require__(8981); 4170var lengthOfArrayLike = __webpack_require__(6198); 4171var setArrayLength = __webpack_require__(4527); 4172var doesNotExceedSafeInteger = __webpack_require__(6837); 4173var fails = __webpack_require__(9039); 4174 4175var INCORRECT_TO_LENGTH = fails(function () { 4176 return [].push.call({ length: 0x100000000 }, 1) !== 4294967297; 4177}); 4178 4179// V8 <= 121 and Safari <= 15.4; FF < 23 throws InternalError 4180// https://bugs.chromium.org/p/v8/issues/detail?id=12681 4181var properErrorOnNonWritableLength = function () { 4182 try { 4183 // eslint-disable-next-line es/no-object-defineproperty -- safe 4184 Object.defineProperty([], 'length', { writable: false }).push(); 4185 } catch (error) { 4186 return error instanceof TypeError; 4187 } 4188}; 4189 4190var FORCED = INCORRECT_TO_LENGTH || !properErrorOnNonWritableLength(); 4191 4192// `Array.prototype.push` method 4193// https://tc39.es/ecma262/#sec-array.prototype.push 4194$({ target: 'Array', proto: true, arity: 1, forced: FORCED }, { 4195 // eslint-disable-next-line no-unused-vars -- required for `.length` 4196 push: function push(item) { 4197 var O = toObject(this); 4198 var len = lengthOfArrayLike(O); 4199 var argCount = arguments.length; 4200 doesNotExceedSafeInteger(len + argCount); 4201 for (var i = 0; i < argCount; i++) { 4202 O[len] = arguments[i]; 4203 len++; 4204 } 4205 setArrayLength(O, len); 4206 return len; 4207 } 4208}); 4209 4210 4211/***/ }, 4212 4213/***/ 8111 4214(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 4215 4216 4217var $ = __webpack_require__(6518); 4218var globalThis = __webpack_require__(4576); 4219var anInstance = __webpack_require__(679); 4220var anObject = __webpack_require__(8551); 4221var isCallable = __webpack_require__(4901); 4222var getPrototypeOf = __webpack_require__(2787); 4223var defineBuiltInAccessor = __webpack_require__(2106); 4224var createProperty = __webpack_require__(4659); 4225var fails = __webpack_require__(9039); 4226var hasOwn = __webpack_require__(9297); 4227var wellKnownSymbol = __webpack_require__(8227); 4228var IteratorPrototype = (__webpack_require__(7657).IteratorPrototype); 4229var DESCRIPTORS = __webpack_require__(3724); 4230var IS_PURE = __webpack_require__(6395); 4231 4232var CONSTRUCTOR = 'constructor';
vendor: 6,067 bytes, lines 4233-4411
4233var ITERATOR = 'Iterator'; 4234var TO_STRING_TAG = wellKnownSymbol('toStringTag'); 4235 4236var $TypeError = TypeError; 4237var NativeIterator = globalThis[ITERATOR]; 4238 4239// FF56- have non-standard global helper `Iterator` 4240var FORCED = IS_PURE 4241 || !isCallable(NativeIterator) 4242 || NativeIterator.prototype !== IteratorPrototype 4243 // FF44- non-standard `Iterator` passes previous tests 4244 || !fails(function () { NativeIterator({}); }); 4245 4246var IteratorConstructor = function Iterator() { 4247 anInstance(this, IteratorPrototype); 4248 if (getPrototypeOf(this) === IteratorPrototype) throw new $TypeError('Abstract class Iterator not directly constructable'); 4249}; 4250 4251var defineIteratorPrototypeAccessor = function (key, value) { 4252 if (DESCRIPTORS) { 4253 defineBuiltInAccessor(IteratorPrototype, key, { 4254 configurable: true, 4255 get: function () { 4256 return value; 4257 }, 4258 set: function (replacement) { 4259 anObject(this); 4260 if (this === IteratorPrototype) throw new $TypeError("You can't redefine this property"); 4261 if (hasOwn(this, key)) this[key] = replacement; 4262 else createProperty(this, key, replacement); 4263 } 4264 }); 4265 } else IteratorPrototype[key] = value; 4266}; 4267 4268if (!hasOwn(IteratorPrototype, TO_STRING_TAG)) defineIteratorPrototypeAccessor(TO_STRING_TAG, ITERATOR); 4269 4270if (FORCED || !hasOwn(IteratorPrototype, CONSTRUCTOR) || IteratorPrototype[CONSTRUCTOR] === Object) { 4271 defineIteratorPrototypeAccessor(CONSTRUCTOR, IteratorConstructor); 4272} 4273 4274IteratorConstructor.prototype = IteratorPrototype; 4275 4276// `Iterator` constructor 4277// https://tc39.es/ecma262/#sec-iterator 4278$({ global: true, constructor: true, forced: FORCED }, { 4279 Iterator: IteratorConstructor 4280}); 4281 4282 4283/***/ }, 4284 4285/***/ 1148 4286(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 4287 4288 4289var $ = __webpack_require__(6518); 4290var call = __webpack_require__(9565); 4291var iterate = __webpack_require__(2652); 4292var aCallable = __webpack_require__(9306); 4293var anObject = __webpack_require__(8551); 4294var getIteratorDirect = __webpack_require__(1767); 4295var iteratorClose = __webpack_require__(9539); 4296var iteratorHelperWithoutClosingOnEarlyError = __webpack_require__(4549); 4297 4298var everyWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError('every', TypeError); 4299 4300// `Iterator.prototype.every` method 4301// https://tc39.es/ecma262/#sec-iterator.prototype.every 4302$({ target: 'Iterator', proto: true, real: true, forced: everyWithoutClosingOnEarlyError }, { 4303 every: function every(predicate) { 4304 anObject(this); 4305 try { 4306 aCallable(predicate); 4307 } catch (error) { 4308 iteratorClose(this, 'throw', error); 4309 } 4310 4311 if (everyWithoutClosingOnEarlyError) return call(everyWithoutClosingOnEarlyError, this, predicate); 4312 4313 var record = getIteratorDirect(this); 4314 var counter = 0; 4315 return !iterate(record, function (value, stop) { 4316 if (!predicate(value, counter++)) return stop(); 4317 }, { IS_RECORD: true, INTERRUPTED: true }).stopped; 4318 } 4319}); 4320 4321 4322/***/ }, 4323 4324/***/ 2489 4325(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 4326 4327 4328var $ = __webpack_require__(6518); 4329var call = __webpack_require__(9565); 4330var aCallable = __webpack_require__(9306); 4331var anObject = __webpack_require__(8551); 4332var getIteratorDirect = __webpack_require__(1767); 4333var createIteratorProxy = __webpack_require__(9462); 4334var callWithSafeIterationClosing = __webpack_require__(6319); 4335var IS_PURE = __webpack_require__(6395); 4336var iteratorClose = __webpack_require__(9539); 4337var iteratorHelperThrowsOnInvalidIterator = __webpack_require__(684); 4338var iteratorHelperWithoutClosingOnEarlyError = __webpack_require__(4549); 4339 4340var FILTER_WITHOUT_THROWING_ON_INVALID_ITERATOR = !IS_PURE && !iteratorHelperThrowsOnInvalidIterator('filter', function () { /* empty */ }); 4341var filterWithoutClosingOnEarlyError = !IS_PURE && !FILTER_WITHOUT_THROWING_ON_INVALID_ITERATOR 4342 && iteratorHelperWithoutClosingOnEarlyError('filter', TypeError); 4343 4344var FORCED = IS_PURE || FILTER_WITHOUT_THROWING_ON_INVALID_ITERATOR || filterWithoutClosingOnEarlyError; 4345 4346var IteratorProxy = createIteratorProxy(function () { 4347 var iterator = this.iterator; 4348 var predicate = this.predicate; 4349 var next = this.next; 4350 var result, done, value; 4351 while (true) { 4352 result = anObject(call(next, iterator)); 4353 done = this.done = !!result.done; 4354 if (done) return; 4355 value = result.value; 4356 if (callWithSafeIterationClosing(iterator, predicate, [value, this.counter++], true)) return value; 4357 } 4358}); 4359 4360// `Iterator.prototype.filter` method 4361// https://tc39.es/ecma262/#sec-iterator.prototype.filter 4362$({ target: 'Iterator', proto: true, real: true, forced: FORCED }, { 4363 filter: function filter(predicate) { 4364 anObject(this); 4365 try { 4366 aCallable(predicate); 4367 } catch (error) { 4368 iteratorClose(this, 'throw', error); 4369 } 4370 4371 if (filterWithoutClosingOnEarlyError) return call(filterWithoutClosingOnEarlyError, this, predicate); 4372 4373 return new IteratorProxy(getIteratorDirect(this), { 4374 predicate: predicate 4375 }); 4376 } 4377}); 4378 4379 4380/***/ }, 4381 4382/***/ 116 4383(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 4384 4385 4386var $ = __webpack_require__(6518); 4387var call = __webpack_require__(9565); 4388var iterate = __webpack_require__(2652); 4389var aCallable = __webpack_require__(9306); 4390var anObject = __webpack_require__(8551); 4391var getIteratorDirect = __webpack_require__(1767); 4392var iteratorClose = __webpack_require__(9539); 4393var iteratorHelperWithoutClosingOnEarlyError = __webpack_require__(4549); 4394 4395var findWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError('find', TypeError); 4396 4397// `Iterator.prototype.find` method 4398// https://tc39.es/ecma262/#sec-iterator.prototype.find 4399$({ target: 'Iterator', proto: true, real: true, forced: findWithoutClosingOnEarlyError }, { 4400 find: function find(predicate) { 4401 anObject(this); 4402 try { 4403 aCallable(predicate); 4404 } catch (error) { 4405 iteratorClose(this, 'throw', error); 4406 } 4407 4408 if (findWithoutClosingOnEarlyError) return call(findWithoutClosingOnEarlyError, this, predicate); 4409 4410 var record = getIteratorDirect(this); 4411 var counter = 0;
vendor: 4,642 bytes, lines 4412-4553
4412 return iterate(record, function (value, stop) { 4413 if (predicate(value, counter++)) return stop(value); 4414 }, { IS_RECORD: true, INTERRUPTED: true }).result; 4415 } 4416}); 4417 4418 4419/***/ }, 4420 4421/***/ 531 4422(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 4423 4424 4425var $ = __webpack_require__(6518); 4426var call = __webpack_require__(9565); 4427var aCallable = __webpack_require__(9306); 4428var anObject = __webpack_require__(8551); 4429var getIteratorDirect = __webpack_require__(1767); 4430var getIteratorFlattenable = __webpack_require__(8646); 4431var createIteratorProxy = __webpack_require__(9462); 4432var iteratorClose = __webpack_require__(9539); 4433var IS_PURE = __webpack_require__(6395); 4434var iteratorHelperThrowsOnInvalidIterator = __webpack_require__(684); 4435var iteratorHelperWithoutClosingOnEarlyError = __webpack_require__(4549); 4436 4437// Should not throw an error for an iterator without `return` method. Fixed in Safari 26.2 4438// https://bugs.webkit.org/show_bug.cgi?id=297532 4439function throwsOnIteratorWithoutReturn() { 4440 try { 4441 // eslint-disable-next-line es/no-map, es/no-iterator, es/no-iterator-prototype-flatmap -- required for testing 4442 var it = Iterator.prototype.flatMap.call(new Map([[4, 5]]).entries(), function (v) { return v; }); 4443 it.next(); 4444 it['return'](); 4445 } catch (error) { 4446 return true; 4447 } 4448} 4449 4450var FLAT_MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR = !IS_PURE 4451 && !iteratorHelperThrowsOnInvalidIterator('flatMap', function () { /* empty */ }); 4452var flatMapWithoutClosingOnEarlyError = !IS_PURE && !FLAT_MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR 4453 && iteratorHelperWithoutClosingOnEarlyError('flatMap', TypeError); 4454 4455var FORCED = IS_PURE || FLAT_MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR || flatMapWithoutClosingOnEarlyError 4456 || throwsOnIteratorWithoutReturn(); 4457 4458var IteratorProxy = createIteratorProxy(function () { 4459 var iterator = this.iterator; 4460 var mapper = this.mapper; 4461 var result, inner; 4462 4463 while (true) { 4464 if (inner = this.inner) try { 4465 result = anObject(call(inner.next, inner.iterator)); 4466 if (!result.done) return result.value; 4467 this.inner = null; 4468 } catch (error) { iteratorClose(iterator, 'throw', error); } 4469 4470 result = anObject(call(this.next, iterator)); 4471 4472 if (this.done = !!result.done) return; 4473 4474 try { 4475 this.inner = getIteratorFlattenable(mapper(result.value, this.counter++), false); 4476 } catch (error) { iteratorClose(iterator, 'throw', error); } 4477 } 4478}); 4479 4480// `Iterator.prototype.flatMap` method 4481// https://tc39.es/ecma262/#sec-iterator.prototype.flatmap 4482$({ target: 'Iterator', proto: true, real: true, forced: FORCED }, { 4483 flatMap: function flatMap(mapper) { 4484 anObject(this); 4485 try { 4486 aCallable(mapper); 4487 } catch (error) { 4488 iteratorClose(this, 'throw', error); 4489 } 4490 4491 if (flatMapWithoutClosingOnEarlyError) return call(flatMapWithoutClosingOnEarlyError, this, mapper); 4492 4493 return new IteratorProxy(getIteratorDirect(this), { 4494 mapper: mapper, 4495 inner: null 4496 }); 4497 } 4498}); 4499 4500 4501/***/ }, 4502 4503/***/ 7588 4504(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 4505 4506 4507var $ = __webpack_require__(6518); 4508var call = __webpack_require__(9565); 4509var iterate = __webpack_require__(2652); 4510var aCallable = __webpack_require__(9306); 4511var anObject = __webpack_require__(8551); 4512var getIteratorDirect = __webpack_require__(1767); 4513var iteratorClose = __webpack_require__(9539); 4514var iteratorHelperWithoutClosingOnEarlyError = __webpack_require__(4549); 4515 4516var forEachWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError('forEach', TypeError); 4517 4518// `Iterator.prototype.forEach` method 4519// https://tc39.es/ecma262/#sec-iterator.prototype.foreach 4520$({ target: 'Iterator', proto: true, real: true, forced: forEachWithoutClosingOnEarlyError }, { 4521 forEach: function forEach(fn) { 4522 anObject(this); 4523 try { 4524 aCallable(fn); 4525 } catch (error) { 4526 iteratorClose(this, 'throw', error); 4527 } 4528 4529 if (forEachWithoutClosingOnEarlyError) return call(forEachWithoutClosingOnEarlyError, this, fn); 4530 4531 var record = getIteratorDirect(this); 4532 var counter = 0; 4533 iterate(record, function (value) { 4534 fn(value, counter++); 4535 }, { IS_RECORD: true }); 4536 } 4537}); 4538 4539 4540/***/ }, 4541 4542/***/ 1701 4543(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 4544 4545 4546var $ = __webpack_require__(6518); 4547var call = __webpack_require__(9565); 4548var aCallable = __webpack_require__(9306); 4549var anObject = __webpack_require__(8551); 4550var getIteratorDirect = __webpack_require__(1767); 4551var createIteratorProxy = __webpack_require__(9462); 4552var callWithSafeIterationClosing = __webpack_require__(6319); 4553var iteratorClose = __webpack_require__(9539);
vendor: 4,309 bytes, lines 4554-4683
4554var iteratorHelperThrowsOnInvalidIterator = __webpack_require__(684); 4555var iteratorHelperWithoutClosingOnEarlyError = __webpack_require__(4549); 4556var IS_PURE = __webpack_require__(6395); 4557 4558var MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR = !IS_PURE && !iteratorHelperThrowsOnInvalidIterator('map', function () { /* empty */ }); 4559var mapWithoutClosingOnEarlyError = !IS_PURE && !MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR 4560 && iteratorHelperWithoutClosingOnEarlyError('map', TypeError); 4561 4562var FORCED = IS_PURE || MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR || mapWithoutClosingOnEarlyError; 4563 4564var IteratorProxy = createIteratorProxy(function () { 4565 var iterator = this.iterator; 4566 var result = anObject(call(this.next, iterator)); 4567 var done = this.done = !!result.done; 4568 if (!done) return callWithSafeIterationClosing(iterator, this.mapper, [result.value, this.counter++], true); 4569}); 4570 4571// `Iterator.prototype.map` method 4572// https://tc39.es/ecma262/#sec-iterator.prototype.map 4573$({ target: 'Iterator', proto: true, real: true, forced: FORCED }, { 4574 map: function map(mapper) { 4575 anObject(this); 4576 try { 4577 aCallable(mapper); 4578 } catch (error) { 4579 iteratorClose(this, 'throw', error); 4580 } 4581 4582 if (mapWithoutClosingOnEarlyError) return call(mapWithoutClosingOnEarlyError, this, mapper); 4583 4584 return new IteratorProxy(getIteratorDirect(this), { 4585 mapper: mapper 4586 }); 4587 } 4588}); 4589 4590 4591/***/ }, 4592 4593/***/ 3579 4594(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 4595 4596 4597var $ = __webpack_require__(6518); 4598var call = __webpack_require__(9565); 4599var iterate = __webpack_require__(2652); 4600var aCallable = __webpack_require__(9306); 4601var anObject = __webpack_require__(8551); 4602var getIteratorDirect = __webpack_require__(1767); 4603var iteratorClose = __webpack_require__(9539); 4604var iteratorHelperWithoutClosingOnEarlyError = __webpack_require__(4549); 4605 4606var someWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError('some', TypeError); 4607 4608// `Iterator.prototype.some` method 4609// https://tc39.es/ecma262/#sec-iterator.prototype.some 4610$({ target: 'Iterator', proto: true, real: true, forced: someWithoutClosingOnEarlyError }, { 4611 some: function some(predicate) { 4612 anObject(this); 4613 try { 4614 aCallable(predicate); 4615 } catch (error) { 4616 iteratorClose(this, 'throw', error); 4617 } 4618 4619 if (someWithoutClosingOnEarlyError) return call(someWithoutClosingOnEarlyError, this, predicate); 4620 4621 var record = getIteratorDirect(this); 4622 var counter = 0; 4623 return iterate(record, function (value, stop) { 4624 if (predicate(value, counter++)) return stop(); 4625 }, { IS_RECORD: true, INTERRUPTED: true }).stopped; 4626 } 4627}); 4628 4629 4630/***/ }, 4631 4632/***/ 1806 4633(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 4634 4635 4636var $ = __webpack_require__(6518); 4637var anObject = __webpack_require__(8551); 4638var createProperty = __webpack_require__(4659); 4639var iterate = __webpack_require__(2652); 4640var getIteratorDirect = __webpack_require__(1767); 4641 4642// `Iterator.prototype.toArray` method 4643// https://tc39.es/ecma262/#sec-iterator.prototype.toarray 4644$({ target: 'Iterator', proto: true, real: true }, { 4645 toArray: function toArray() { 4646 var result = []; 4647 var index = 0; 4648 iterate(getIteratorDirect(anObject(this)), function (element) { 4649 createProperty(result, index++, element); 4650 }, { IS_RECORD: true }); 4651 return result; 4652 } 4653}); 4654 4655 4656/***/ }, 4657 4658/***/ 3110 4659(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 4660 4661 4662var $ = __webpack_require__(6518); 4663var getBuiltIn = __webpack_require__(7751); 4664var apply = __webpack_require__(8745); 4665var call = __webpack_require__(9565); 4666var uncurryThis = __webpack_require__(9504); 4667var fails = __webpack_require__(9039); 4668var isArray = __webpack_require__(4376); 4669var isCallable = __webpack_require__(4901); 4670var isRawJSON = __webpack_require__(5810); 4671var isSymbol = __webpack_require__(757); 4672var classof = __webpack_require__(2195); 4673var toString = __webpack_require__(655); 4674var arraySlice = __webpack_require__(7680); 4675var parseJSONString = __webpack_require__(8235); 4676var uid = __webpack_require__(3392); 4677var NATIVE_SYMBOL = __webpack_require__(4495); 4678var NATIVE_RAW_JSON = __webpack_require__(7819); 4679 4680var $String = String; 4681var $stringify = getBuiltIn('JSON', 'stringify'); 4682var exec = uncurryThis(/./.exec); 4683var charAt = uncurryThis(''.charAt);
vendor: 6,810 bytes, lines 4684-4894
4684var charCodeAt = uncurryThis(''.charCodeAt); 4685var replace = uncurryThis(''.replace); 4686var slice = uncurryThis(''.slice); 4687var push = uncurryThis([].push); 4688var numberToString = uncurryThis(1.1.toString); 4689 4690var surrogates = /[\uD800-\uDFFF]/g; 4691var leadingSurrogates = /^[\uD800-\uDBFF]$/; 4692var trailingSurrogates = /^[\uDC00-\uDFFF]$/; 4693 4694var MARK = uid(); 4695var MARK_LENGTH = MARK.length; 4696 4697var WRONG_SYMBOLS_CONVERSION = !NATIVE_SYMBOL || fails(function () { 4698 var symbol = getBuiltIn('Symbol')('stringify detection'); 4699 // MS Edge converts symbol values to JSON as {} 4700 return $stringify([symbol]) !== '[null]' 4701 // WebKit converts symbol values to JSON as null 4702 || $stringify({ a: symbol }) !== '{}' 4703 // V8 throws on boxed symbols 4704 || $stringify(Object(symbol)) !== '{}'; 4705}); 4706 4707// https://github.com/tc39/proposal-well-formed-stringify 4708var ILL_FORMED_UNICODE = fails(function () { 4709 return $stringify('\uDF06\uD834') !== '"\\udf06\\ud834"' 4710 || $stringify('\uDEAD') !== '"\\udead"'; 4711}); 4712 4713var stringifyWithProperSymbolsConversion = WRONG_SYMBOLS_CONVERSION ? function (it, replacer) { 4714 var args = arraySlice(arguments); 4715 var $replacer = getReplacerFunction(replacer); 4716 if (!isCallable($replacer) && (it === undefined || isSymbol(it))) return; // IE8 returns string on undefined 4717 args[1] = function (key, value) { 4718 // some old implementations (like WebKit) could pass numbers as keys 4719 if (isCallable($replacer)) value = call($replacer, this, $String(key), value); 4720 if (!isSymbol(value)) return value; 4721 }; 4722 return apply($stringify, null, args); 4723} : $stringify; 4724 4725var fixIllFormedJSON = function (match, offset, string) { 4726 var prev = charAt(string, offset - 1); 4727 var next = charAt(string, offset + 1); 4728 if ( 4729 (exec(leadingSurrogates, match) && !exec(trailingSurrogates, next)) || 4730 (exec(trailingSurrogates, match) && !exec(leadingSurrogates, prev)) 4731 ) { 4732 return '\\u' + numberToString(charCodeAt(match, 0), 16); 4733 } return match; 4734}; 4735 4736var getReplacerFunction = function (replacer) { 4737 if (isCallable(replacer)) return replacer; 4738 if (!isArray(replacer)) return; 4739 var rawLength = replacer.length; 4740 var keys = []; 4741 for (var i = 0; i < rawLength; i++) { 4742 var element = replacer[i]; 4743 if (typeof element == 'string') push(keys, element); 4744 else if (typeof element == 'number' || classof(element) === 'Number' || classof(element) === 'String') push(keys, toString(element)); 4745 } 4746 var keysLength = keys.length; 4747 var root = true; 4748 return function (key, value) { 4749 if (root) { 4750 root = false; 4751 return value; 4752 } 4753 if (isArray(this)) return value; 4754 for (var j = 0; j < keysLength; j++) if (keys[j] === key) return value; 4755 }; 4756}; 4757 4758// `JSON.stringify` method 4759// https://tc39.es/ecma262/#sec-json.stringify 4760// https://github.com/tc39/proposal-json-parse-with-source 4761if ($stringify) $({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE || !NATIVE_RAW_JSON }, { 4762 stringify: function stringify(text, replacer, space) { 4763 var replacerFunction = getReplacerFunction(replacer); 4764 var rawStrings = []; 4765 4766 var json = stringifyWithProperSymbolsConversion(text, function (key, value) { 4767 // some old implementations (like WebKit) could pass numbers as keys 4768 var v = isCallable(replacerFunction) ? call(replacerFunction, this, $String(key), value) : value; 4769 return !NATIVE_RAW_JSON && isRawJSON(v) ? MARK + (push(rawStrings, v.rawJSON) - 1) : v; 4770 }, space); 4771 4772 if (typeof json != 'string') return json; 4773 4774 if (ILL_FORMED_UNICODE) json = replace(json, surrogates, fixIllFormedJSON); 4775 4776 if (NATIVE_RAW_JSON) return json; 4777 4778 var result = ''; 4779 var length = json.length; 4780 4781 for (var i = 0; i < length; i++) { 4782 var chr = charAt(json, i); 4783 if (chr === '"') { 4784 var end = parseJSONString(json, ++i).end - 1; 4785 var string = slice(json, i, end); 4786 result += slice(string, 0, MARK_LENGTH) === MARK 4787 ? rawStrings[slice(string, MARK_LENGTH)] 4788 : '"' + string + '"'; 4789 i = end; 4790 } else result += chr; 4791 } 4792 4793 return result; 4794 } 4795}); 4796 4797 4798/***/ }, 4799 4800/***/ 2731 4801(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 4802 4803 4804var $ = __webpack_require__(6518); 4805var aCallable = __webpack_require__(9306); 4806var MapHelpers = __webpack_require__(2248); 4807var IS_PURE = __webpack_require__(6395); 4808 4809var get = MapHelpers.get; 4810var has = MapHelpers.has; 4811var set = MapHelpers.set; 4812 4813// `Map.prototype.getOrInsertComputed` method 4814// https://tc39.es/ecma262/#sec-map.prototype.getorinsertcomputed 4815$({ target: 'Map', proto: true, real: true, forced: IS_PURE }, { 4816 getOrInsertComputed: function getOrInsertComputed(key, callbackfn) { 4817 var hasKey = has(this, key); 4818 aCallable(callbackfn); 4819 if (hasKey) return get(this, key); 4820 // CanonicalizeKeyedCollectionKey 4821 if (key === 0 && 1 / key === -Infinity) key = 0; 4822 var value = callbackfn(key); 4823 set(this, key, value); 4824 return value; 4825 } 4826}); 4827 4828 4829/***/ }, 4830 4831/***/ 5367 4832(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 4833 4834 4835var $ = __webpack_require__(6518); 4836var MapHelpers = __webpack_require__(2248); 4837var IS_PURE = __webpack_require__(6395); 4838 4839var get = MapHelpers.get; 4840var has = MapHelpers.has; 4841var set = MapHelpers.set; 4842 4843// `Map.prototype.getOrInsert` method 4844// https://tc39.es/ecma262/#sec-map.prototype.getorinsert 4845$({ target: 'Map', proto: true, real: true, forced: IS_PURE }, { 4846 getOrInsert: function getOrInsert(key, value) { 4847 if (has(this, key)) return get(this, key); 4848 set(this, key, value); 4849 return value; 4850 } 4851}); 4852 4853 4854/***/ }, 4855 4856/***/ 3068 4857(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 4858 4859 4860// based on Shewchuk's algorithm for exactly floating point addition 4861// adapted from https://github.com/tc39/proposal-math-sum/blob/3513d58323a1ae25560e8700aa5294500c6c9287/polyfill/polyfill.mjs 4862var $ = __webpack_require__(6518); 4863var uncurryThis = __webpack_require__(9504); 4864var iterate = __webpack_require__(2652); 4865 4866var $RangeError = RangeError; 4867var $TypeError = TypeError; 4868var $Infinity = Infinity; 4869var $NaN = NaN; 4870var abs = Math.abs; 4871var pow = Math.pow; 4872var push = uncurryThis([].push); 4873 4874var POW_2_1023 = pow(2, 1023); 4875var MAX_SAFE_INTEGER = pow(2, 53) - 1; // 2 ** 53 - 1 === 9007199254740991 4876var MAX_DOUBLE = Number.MAX_VALUE; // 2 ** 1024 - 2 ** (1023 - 52) === 1.79769313486231570815e+308 4877var MAX_ULP = pow(2, 971); // 2 ** (1023 - 52) === 1.99584030953471981166e+292 4878 4879var NOT_A_NUMBER = {}; 4880var MINUS_INFINITY = {}; 4881var PLUS_INFINITY = {}; 4882var MINUS_ZERO = {}; 4883var FINITE = {}; 4884 4885// prerequisite: abs(x) >= abs(y) 4886var twosum = function (x, y) { 4887 var hi = x + y; 4888 var lo = y - (hi - x); 4889 return { hi: hi, lo: lo }; 4890}; 4891 4892// `Math.sumPrecise` method 4893// https://tc39.es/ecma262/#sec-math.sumprecise 4894$({ target: 'Math', stat: true }, {
vendor: 5,163 bytes, lines 4895-5063
4895 // eslint-disable-next-line max-statements -- ok 4896 sumPrecise: function sumPrecise(items) { 4897 var numbers = []; 4898 var count = 0; 4899 var state = MINUS_ZERO; 4900 4901 iterate(items, function (n) { 4902 if (++count > MAX_SAFE_INTEGER) throw new $RangeError('Maximum allowed index exceeded'); 4903 if (typeof n != 'number') throw new $TypeError('Value is not a number'); 4904 if (state !== NOT_A_NUMBER) { 4905 // eslint-disable-next-line no-self-compare -- NaN check 4906 if (n !== n) state = NOT_A_NUMBER; 4907 else if (n === $Infinity) state = state === MINUS_INFINITY ? NOT_A_NUMBER : PLUS_INFINITY; 4908 else if (n === -$Infinity) state = state === PLUS_INFINITY ? NOT_A_NUMBER : MINUS_INFINITY; 4909 else if ((n !== 0 || (1 / n) === $Infinity) && (state === MINUS_ZERO || state === FINITE)) { 4910 state = FINITE; 4911 push(numbers, n); 4912 } 4913 } 4914 }); 4915 4916 switch (state) { 4917 case NOT_A_NUMBER: return $NaN; 4918 case MINUS_INFINITY: return -$Infinity; 4919 case PLUS_INFINITY: return $Infinity; 4920 case MINUS_ZERO: return -0; 4921 } 4922 4923 var partials = []; 4924 var overflow = 0; // conceptually 2 ** 1024 times this value; the final partial is biased by this amount 4925 var x, y, sum, hi, lo, tmp; 4926 4927 for (var i = 0; i < numbers.length; i++) { 4928 x = numbers[i]; 4929 var actuallyUsedPartials = 0; 4930 for (var j = 0; j < partials.length; j++) { 4931 y = partials[j]; 4932 if (abs(x) < abs(y)) { 4933 tmp = x; 4934 x = y; 4935 y = tmp; 4936 } 4937 sum = twosum(x, y); 4938 hi = sum.hi; 4939 lo = sum.lo; 4940 if (abs(hi) === $Infinity) { 4941 var sign = hi === $Infinity ? 1 : -1; 4942 overflow += sign; 4943 4944 x = (x - (sign * POW_2_1023)) - (sign * POW_2_1023); 4945 if (abs(x) < abs(y)) { 4946 tmp = x; 4947 x = y; 4948 y = tmp; 4949 } 4950 sum = twosum(x, y); 4951 hi = sum.hi; 4952 lo = sum.lo; 4953 } 4954 if (lo !== 0) partials[actuallyUsedPartials++] = lo; 4955 x = hi; 4956 } 4957 partials.length = actuallyUsedPartials; 4958 if (x !== 0) push(partials, x); 4959 } 4960 4961 // compute the exact sum of partials, stopping once we lose precision 4962 var n = partials.length - 1; 4963 hi = 0; 4964 lo = 0; 4965 4966 if (overflow !== 0) { 4967 var next = n >= 0 ? partials[n] : 0; 4968 n--; 4969 if (abs(overflow) > 1 || (overflow > 0 && next > 0) || (overflow < 0 && next < 0)) { 4970 return overflow > 0 ? $Infinity : -$Infinity; 4971 } 4972 // here we actually have to do the arithmetic 4973 // drop a factor of 2 so we can do it without overflow 4974 // assert(abs(overflow) === 1) 4975 sum = twosum(overflow * POW_2_1023, next / 2); 4976 hi = sum.hi; 4977 lo = sum.lo; 4978 lo *= 2; 4979 if (abs(2 * hi) === $Infinity) { 4980 // rounding to the maximum value 4981 if (hi > 0) { 4982 return (hi === POW_2_1023 && lo === -(MAX_ULP / 2) && n >= 0 && partials[n] < 0) ? MAX_DOUBLE : $Infinity; 4983 } return (hi === -POW_2_1023 && lo === (MAX_ULP / 2) && n >= 0 && partials[n] > 0) ? -MAX_DOUBLE : -$Infinity; 4984 } 4985 4986 if (lo !== 0) { 4987 partials[++n] = lo; 4988 lo = 0; 4989 } 4990 4991 hi *= 2; 4992 } 4993 4994 while (n >= 0) { 4995 sum = twosum(hi, partials[n--]); 4996 hi = sum.hi; 4997 lo = sum.lo; 4998 if (lo !== 0) break; 4999 } 5000 5001 if (n >= 0 && ((lo < 0 && partials[n] < 0) || (lo > 0 && partials[n] > 0))) { 5002 y = lo * 2; 5003 x = hi + y; 5004 if (y === x - hi) hi = x; 5005 } 5006 5007 return hi; 5008 } 5009}); 5010 5011 5012/***/ }, 5013 5014/***/ 1689 5015(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 5016 5017 5018var $ = __webpack_require__(6518); 5019var globalThis = __webpack_require__(4576); 5020var apply = __webpack_require__(8745); 5021var slice = __webpack_require__(7680); 5022var newPromiseCapabilityModule = __webpack_require__(6043); 5023var aCallable = __webpack_require__(9306); 5024var perform = __webpack_require__(1103); 5025 5026var Promise = globalThis.Promise; 5027 5028var ACCEPT_ARGUMENTS = false; 5029// Avoiding the use of polyfills of the previous iteration of this proposal 5030// that does not accept arguments of the callback 5031var FORCED = !Promise || !Promise['try'] || perform(function () { 5032 Promise['try'](function (argument) { 5033 ACCEPT_ARGUMENTS = argument === 8; 5034 }, 8); 5035}).error || !ACCEPT_ARGUMENTS; 5036 5037// `Promise.try` method 5038// https://tc39.es/ecma262/#sec-promise.try 5039$({ target: 'Promise', stat: true, forced: FORCED }, { 5040 'try': function (callbackfn /* , ...args */) { 5041 var args = arguments.length > 1 ? slice(arguments, 1) : []; 5042 var promiseCapability = newPromiseCapabilityModule.f(this); 5043 var result = perform(function () { 5044 return apply(aCallable(callbackfn), undefined, args); 5045 }); 5046 (result.error ? promiseCapability.reject : promiseCapability.resolve)(result.value); 5047 return promiseCapability.promise; 5048 } 5049}); 5050 5051 5052/***/ }, 5053 5054/***/ 4628 5055(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 5056 5057 5058var $ = __webpack_require__(6518); 5059var newPromiseCapabilityModule = __webpack_require__(6043); 5060 5061// `Promise.withResolvers` method 5062// https://tc39.es/ecma262/#sec-promise.withResolvers 5063$({ target: 'Promise', stat: true }, {
vendor: 5,874 bytes, lines 5064-5267
5064 withResolvers: function withResolvers() { 5065 var promiseCapability = newPromiseCapabilityModule.f(this); 5066 return { 5067 promise: promiseCapability.promise, 5068 resolve: promiseCapability.resolve, 5069 reject: promiseCapability.reject 5070 }; 5071 } 5072}); 5073 5074 5075/***/ }, 5076 5077/***/ 7642 5078(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 5079 5080 5081var $ = __webpack_require__(6518); 5082var difference = __webpack_require__(3440); 5083var fails = __webpack_require__(9039); 5084var setMethodAcceptSetLike = __webpack_require__(4916); 5085 5086var SET_LIKE_INCORRECT_BEHAVIOR = !setMethodAcceptSetLike('difference', function (result) { 5087 return result.size === 0; 5088}); 5089 5090var FORCED = SET_LIKE_INCORRECT_BEHAVIOR || fails(function () { 5091 // https://bugs.webkit.org/show_bug.cgi?id=288595 5092 var setLike = { 5093 size: 1, 5094 has: function () { return true; }, 5095 keys: function () { 5096 var index = 0; 5097 return { 5098 next: function () { 5099 var done = index++ > 1; 5100 if (baseSet.has(1)) baseSet.clear(); 5101 return { done: done, value: 2 }; 5102 } 5103 }; 5104 } 5105 }; 5106 // eslint-disable-next-line es/no-set -- testing 5107 var baseSet = new Set([1, 2, 3, 4]); 5108 // eslint-disable-next-line es/no-set-prototype-difference -- testing 5109 return baseSet.difference(setLike).size !== 3; 5110}); 5111 5112// `Set.prototype.difference` method 5113// https://tc39.es/ecma262/#sec-set.prototype.difference 5114$({ target: 'Set', proto: true, real: true, forced: FORCED }, { 5115 difference: difference 5116}); 5117 5118 5119/***/ }, 5120 5121/***/ 8004 5122(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 5123 5124 5125var $ = __webpack_require__(6518); 5126var fails = __webpack_require__(9039); 5127var intersection = __webpack_require__(8750); 5128var setMethodAcceptSetLike = __webpack_require__(4916); 5129 5130var INCORRECT = !setMethodAcceptSetLike('intersection', function (result) { 5131 return result.size === 2 && result.has(1) && result.has(2); 5132}) || fails(function () { 5133 // eslint-disable-next-line es/no-array-from, es/no-set, es/no-set-prototype-intersection -- testing 5134 return String(Array.from(new Set([1, 2, 3]).intersection(new Set([3, 2])))) !== '3,2'; 5135}); 5136 5137// `Set.prototype.intersection` method 5138// https://tc39.es/ecma262/#sec-set.prototype.intersection 5139$({ target: 'Set', proto: true, real: true, forced: INCORRECT }, { 5140 intersection: intersection 5141}); 5142 5143 5144/***/ }, 5145 5146/***/ 3853 5147(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 5148 5149 5150var $ = __webpack_require__(6518); 5151var isDisjointFrom = __webpack_require__(4449); 5152var setMethodAcceptSetLike = __webpack_require__(4916); 5153 5154var INCORRECT = !setMethodAcceptSetLike('isDisjointFrom', function (result) { 5155 return !result; 5156}); 5157 5158// `Set.prototype.isDisjointFrom` method 5159// https://tc39.es/ecma262/#sec-set.prototype.isdisjointfrom 5160$({ target: 'Set', proto: true, real: true, forced: INCORRECT }, { 5161 isDisjointFrom: isDisjointFrom 5162}); 5163 5164 5165/***/ }, 5166 5167/***/ 5876 5168(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 5169 5170 5171var $ = __webpack_require__(6518); 5172var isSubsetOf = __webpack_require__(3838); 5173var setMethodAcceptSetLike = __webpack_require__(4916); 5174 5175var INCORRECT = !setMethodAcceptSetLike('isSubsetOf', function (result) { 5176 return result; 5177}); 5178 5179// `Set.prototype.isSubsetOf` method 5180// https://tc39.es/ecma262/#sec-set.prototype.issubsetof 5181$({ target: 'Set', proto: true, real: true, forced: INCORRECT }, { 5182 isSubsetOf: isSubsetOf 5183}); 5184 5185 5186/***/ }, 5187 5188/***/ 2475 5189(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 5190 5191 5192var $ = __webpack_require__(6518); 5193var isSupersetOf = __webpack_require__(8527); 5194var setMethodAcceptSetLike = __webpack_require__(4916); 5195 5196var INCORRECT = !setMethodAcceptSetLike('isSupersetOf', function (result) { 5197 return !result; 5198}); 5199 5200// `Set.prototype.isSupersetOf` method 5201// https://tc39.es/ecma262/#sec-set.prototype.issupersetof 5202$({ target: 'Set', proto: true, real: true, forced: INCORRECT }, { 5203 isSupersetOf: isSupersetOf 5204}); 5205 5206 5207/***/ }, 5208 5209/***/ 5024 5210(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 5211 5212 5213var $ = __webpack_require__(6518); 5214var symmetricDifference = __webpack_require__(3650); 5215var setMethodGetKeysBeforeCloning = __webpack_require__(9835); 5216var setMethodAcceptSetLike = __webpack_require__(4916); 5217 5218var FORCED = !setMethodAcceptSetLike('symmetricDifference') || !setMethodGetKeysBeforeCloning('symmetricDifference'); 5219 5220// `Set.prototype.symmetricDifference` method 5221// https://tc39.es/ecma262/#sec-set.prototype.symmetricdifference 5222$({ target: 'Set', proto: true, real: true, forced: FORCED }, { 5223 symmetricDifference: symmetricDifference 5224}); 5225 5226 5227/***/ }, 5228 5229/***/ 1698 5230(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 5231 5232 5233var $ = __webpack_require__(6518); 5234var union = __webpack_require__(4204); 5235var setMethodGetKeysBeforeCloning = __webpack_require__(9835); 5236var setMethodAcceptSetLike = __webpack_require__(4916); 5237 5238var FORCED = !setMethodAcceptSetLike('union') || !setMethodGetKeysBeforeCloning('union'); 5239 5240// `Set.prototype.union` method 5241// https://tc39.es/ecma262/#sec-set.prototype.union 5242$({ target: 'Set', proto: true, real: true, forced: FORCED }, { 5243 union: union 5244}); 5245 5246 5247/***/ }, 5248 5249/***/ 9577 5250(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 5251 5252 5253var ArrayBufferViewCore = __webpack_require__(4644); 5254var isBigIntArray = __webpack_require__(1108); 5255var lengthOfArrayLike = __webpack_require__(6198); 5256var toIntegerOrInfinity = __webpack_require__(1291); 5257var toBigInt = __webpack_require__(5854); 5258 5259var aTypedArray = ArrayBufferViewCore.aTypedArray; 5260var getTypedArrayConstructor = ArrayBufferViewCore.getTypedArrayConstructor; 5261var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; 5262 5263var $RangeError = RangeError; 5264 5265var PROPER_ORDER = function () { 5266 try { 5267 // eslint-disable-next-line no-throw-literal, es/no-typed-arrays, es/no-array-prototype-with -- required for testing
vendor: 7,963 bytes, lines 5268-5511
5268 new Int8Array(1)['with'](2, { valueOf: function () { throw 8; } }); 5269 } catch (error) { 5270 // some early implementations, like WebKit, does not follow the final semantic 5271 // https://github.com/tc39/proposal-change-array-by-copy/pull/86 5272 return error === 8; 5273 } 5274}(); 5275 5276// Bug in WebKit. It should truncate a negative fractional index to zero, but instead throws an error 5277var THROW_ON_NEGATIVE_FRACTIONAL_INDEX = PROPER_ORDER && function () { 5278 try { 5279 // eslint-disable-next-line es/no-typed-arrays, es/no-array-prototype-with -- required for testing 5280 new Int8Array(1)['with'](-0.5, 1); 5281 } catch (error) { 5282 return true; 5283 } 5284}(); 5285 5286// `%TypedArray%.prototype.with` method 5287// https://tc39.es/ecma262/#sec-%typedarray%.prototype.with 5288exportTypedArrayMethod('with', { 'with': function (index, value) { 5289 var O = aTypedArray(this); 5290 var len = lengthOfArrayLike(O); 5291 var relativeIndex = toIntegerOrInfinity(index); 5292 var actualIndex = relativeIndex < 0 ? len + relativeIndex : relativeIndex; 5293 var numericValue = isBigIntArray(O) ? toBigInt(value) : +value; 5294 if (actualIndex >= len || actualIndex < 0) throw new $RangeError('Incorrect index'); 5295 var A = new (getTypedArrayConstructor(O))(len); 5296 var k = 0; 5297 for (; k < len; k++) A[k] = k === actualIndex ? numericValue : O[k]; 5298 return A; 5299} }['with'], !PROPER_ORDER || THROW_ON_NEGATIVE_FRACTIONAL_INDEX); 5300 5301 5302/***/ }, 5303 5304/***/ 5213 5305(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 5306 5307 5308var $ = __webpack_require__(6518); 5309var globalThis = __webpack_require__(4576); 5310var arrayFromConstructorAndList = __webpack_require__(5370); 5311var $fromBase64 = __webpack_require__(9143); 5312 5313var Uint8Array = globalThis.Uint8Array; 5314 5315var INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS = !Uint8Array || !Uint8Array.fromBase64 || !function () { 5316 // Webkit not throw an error on odd length string 5317 try { 5318 Uint8Array.fromBase64('a'); 5319 return; 5320 } catch (error) { /* empty */ } 5321 try { 5322 Uint8Array.fromBase64('', null); 5323 } catch (error) { 5324 return true; 5325 } 5326}(); 5327 5328// `Uint8Array.fromBase64` method 5329// https://tc39.es/ecma262/#sec-uint8array.frombase64 5330if (Uint8Array) $({ target: 'Uint8Array', stat: true, forced: INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS }, { 5331 fromBase64: function fromBase64(string /* , options */) { 5332 var result = $fromBase64(string, arguments.length > 1 ? arguments[1] : undefined, null, 0x1FFFFFFFFFFFFF); 5333 return arrayFromConstructorAndList(Uint8Array, result.bytes); 5334 } 5335}); 5336 5337 5338/***/ }, 5339 5340/***/ 6632 5341(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 5342 5343 5344var $ = __webpack_require__(6518); 5345var globalThis = __webpack_require__(4576); 5346var $fromBase64 = __webpack_require__(9143); 5347var anUint8Array = __webpack_require__(4154); 5348 5349var Uint8Array = globalThis.Uint8Array; 5350 5351var INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS = !Uint8Array || !Uint8Array.prototype.setFromBase64 || !function () { 5352 var target = new Uint8Array([255, 255, 255, 255, 255]); 5353 try { 5354 target.setFromBase64('', null); 5355 return; 5356 } catch (error) { /* empty */ } 5357 // Webkit not throw an error on odd length string 5358 try { 5359 target.setFromBase64('a'); 5360 return; 5361 } catch (error) { /* empty */ } 5362 try { 5363 target.setFromBase64('MjYyZg==='); 5364 } catch (error) { 5365 return target[0] === 50 && target[1] === 54 && target[2] === 50 && target[3] === 255 && target[4] === 255; 5366 } 5367}(); 5368 5369// `Uint8Array.prototype.setFromBase64` method 5370// https://tc39.es/ecma262/#sec-uint8array.prototype.setfrombase64 5371if (Uint8Array) $({ target: 'Uint8Array', proto: true, forced: INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS }, { 5372 setFromBase64: function setFromBase64(string /* , options */) { 5373 anUint8Array(this); 5374 5375 var result = $fromBase64(string, arguments.length > 1 ? arguments[1] : undefined, this, this.length); 5376 5377 return { read: result.read, written: result.written }; 5378 } 5379}); 5380 5381 5382/***/ }, 5383 5384/***/ 4226 5385(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 5386 5387 5388var $ = __webpack_require__(6518); 5389var globalThis = __webpack_require__(4576); 5390var aString = __webpack_require__(3463); 5391var anUint8Array = __webpack_require__(4154); 5392var notDetached = __webpack_require__(5169); 5393var $fromHex = __webpack_require__(2303); 5394 5395// Should not throw an error on length-tracking views over ResizableArrayBuffer 5396// https://issues.chromium.org/issues/454630441 5397function throwsOnLengthTrackingView() { 5398 try { 5399 // eslint-disable-next-line es/no-resizable-and-growable-arraybuffers -- required for testing 5400 var rab = new ArrayBuffer(16, { maxByteLength: 1024 }); 5401 // eslint-disable-next-line es/no-uint8array-prototype-setfromhex, es/no-typed-arrays -- required for testing 5402 new Uint8Array(rab).setFromHex('cafed00d'); 5403 } catch (error) { 5404 return true; 5405 } 5406} 5407 5408// `Uint8Array.prototype.setFromHex` method 5409// https://tc39.es/ecma262/#sec-uint8array.prototype.setfromhex 5410if (globalThis.Uint8Array) $({ target: 'Uint8Array', proto: true, forced: throwsOnLengthTrackingView() }, { 5411 setFromHex: function setFromHex(string) { 5412 anUint8Array(this); 5413 aString(string); 5414 notDetached(this.buffer); 5415 var read = $fromHex(string, this).read; 5416 return { read: read, written: read / 2 }; 5417 } 5418}); 5419 5420 5421/***/ }, 5422 5423/***/ 9486 5424(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 5425 5426 5427var $ = __webpack_require__(6518); 5428var globalThis = __webpack_require__(4576); 5429var uncurryThis = __webpack_require__(9504); 5430var anObjectOrUndefined = __webpack_require__(3972); 5431var anUint8Array = __webpack_require__(4154); 5432var notDetached = __webpack_require__(5169); 5433var base64Map = __webpack_require__(2804); 5434var getAlphabetOption = __webpack_require__(944); 5435 5436var base64Alphabet = base64Map.i2c; 5437var base64UrlAlphabet = base64Map.i2cUrl; 5438 5439var charAt = uncurryThis(''.charAt); 5440 5441var Uint8Array = globalThis.Uint8Array; 5442 5443var INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS = !Uint8Array || !Uint8Array.prototype.toBase64 || !function () { 5444 try { 5445 var target = new Uint8Array(); 5446 target.toBase64(null); 5447 } catch (error) { 5448 return true; 5449 } 5450}(); 5451 5452// `Uint8Array.prototype.toBase64` method 5453// https://tc39.es/ecma262/#sec-uint8array.prototype.tobase64 5454if (Uint8Array) $({ target: 'Uint8Array', proto: true, forced: INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS }, { 5455 toBase64: function toBase64(/* options */) { 5456 var array = anUint8Array(this); 5457 var options = arguments.length ? anObjectOrUndefined(arguments[0]) : undefined; 5458 var alphabet = getAlphabetOption(options) === 'base64' ? base64Alphabet : base64UrlAlphabet; 5459 var omitPadding = !!options && !!options.omitPadding; 5460 notDetached(this.buffer); 5461 5462 var result = ''; 5463 var i = 0; 5464 var length = array.length; 5465 var triplet; 5466 5467 var at = function (shift) { 5468 return charAt(alphabet, (triplet >> (6 * shift)) & 63); 5469 }; 5470 5471 for (; i + 2 < length; i += 3) { 5472 triplet = (array[i] << 16) + (array[i + 1] << 8) + array[i + 2]; 5473 result += at(3) + at(2) + at(1) + at(0); 5474 } 5475 if (i + 2 === length) { 5476 triplet = (array[i] << 16) + (array[i + 1] << 8); 5477 result += at(3) + at(2) + at(1) + (omitPadding ? '' : '='); 5478 } else if (i + 1 === length) { 5479 triplet = array[i] << 16; 5480 result += at(3) + at(2) + (omitPadding ? '' : '=='); 5481 } 5482 5483 return result; 5484 } 5485}); 5486 5487 5488/***/ }, 5489 5490/***/ 456 5491(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 5492 5493 5494var $ = __webpack_require__(6518); 5495var globalThis = __webpack_require__(4576); 5496var uncurryThis = __webpack_require__(9504); 5497var anUint8Array = __webpack_require__(4154); 5498var notDetached = __webpack_require__(5169); 5499 5500var numberToString = uncurryThis(1.1.toString); 5501var join = uncurryThis([].join); 5502var $Array = Array; 5503 5504var Uint8Array = globalThis.Uint8Array; 5505 5506var INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS = !Uint8Array || !Uint8Array.prototype.toHex || !(function () { 5507 try { 5508 var target = new Uint8Array([255, 255, 255, 255, 255, 255, 255, 255]); 5509 return target.toHex() === 'ffffffffffffffff'; 5510 } catch (error) { 5511 return false;
vendor: 4,560 bytes, lines 5512-5661
5512 } 5513})(); 5514 5515// `Uint8Array.prototype.toHex` method 5516// https://tc39.es/ecma262/#sec-uint8array.prototype.tohex 5517if (Uint8Array) $({ target: 'Uint8Array', proto: true, forced: INCORRECT_BEHAVIOR_OR_DOESNT_EXISTS }, { 5518 toHex: function toHex() { 5519 anUint8Array(this); 5520 notDetached(this.buffer); 5521 var result = $Array(this.length); 5522 for (var i = 0, length = this.length; i < length; i++) { 5523 var hex = numberToString(this[i], 16); 5524 result[i] = hex.length === 1 ? '0' + hex : hex; 5525 } 5526 return join(result, ''); 5527 } 5528}); 5529 5530 5531/***/ }, 5532 5533/***/ 9452 5534(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 5535 5536 5537var $ = __webpack_require__(6518); 5538var aCallable = __webpack_require__(9306); 5539var aWeakMap = __webpack_require__(6557); 5540var aWeakKey = __webpack_require__(4328); 5541var WeakMapHelpers = __webpack_require__(4995); 5542var IS_PURE = __webpack_require__(6395); 5543 5544var get = WeakMapHelpers.get; 5545var has = WeakMapHelpers.has; 5546var set = WeakMapHelpers.set; 5547 5548var FORCED = IS_PURE || !function () { 5549 try { 5550 // eslint-disable-next-line es/no-weak-map, no-throw-literal -- testing 5551 if (WeakMap.prototype.getOrInsertComputed) new WeakMap().getOrInsertComputed(1, function () { throw 1; }); 5552 } catch (error) { 5553 // FF144 Nightly - Beta 3 bug 5554 // https://bugzilla.mozilla.org/show_bug.cgi?id=1988369 5555 return error instanceof TypeError; 5556 } 5557}(); 5558 5559// `WeakMap.prototype.getOrInsertComputed` method 5560// https://tc39.es/ecma262/#sec-weakmap.prototype.getorinsertcomputed 5561$({ target: 'WeakMap', proto: true, real: true, forced: FORCED }, { 5562 getOrInsertComputed: function getOrInsertComputed(key, callbackfn) { 5563 if (!IS_PURE) aWeakMap(this); 5564 aWeakKey(key); 5565 aCallable(callbackfn); 5566 if (has(this, key)) return get(this, key); 5567 var value = callbackfn(key); 5568 set(this, key, value); 5569 return value; 5570 } 5571}); 5572 5573 5574/***/ }, 5575 5576/***/ 8454 5577(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 5578 5579 5580var $ = __webpack_require__(6518); 5581var WeakMapHelpers = __webpack_require__(4995); 5582var IS_PURE = __webpack_require__(6395); 5583 5584var get = WeakMapHelpers.get; 5585var has = WeakMapHelpers.has; 5586var set = WeakMapHelpers.set; 5587 5588// `WeakMap.prototype.getOrInsert` method 5589// https://tc39.es/ecma262/#sec-weakmap.prototype.getorinsert 5590$({ target: 'WeakMap', proto: true, real: true, forced: IS_PURE }, { 5591 getOrInsert: function getOrInsert(key, value) { 5592 if (has(this, key)) return get(this, key); 5593 set(this, key, value); 5594 return value; 5595 } 5596}); 5597 5598 5599/***/ }, 5600 5601/***/ 3611 5602(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 5603 5604 5605var $ = __webpack_require__(6518); 5606var globalThis = __webpack_require__(4576); 5607var defineBuiltInAccessor = __webpack_require__(2106); 5608var DESCRIPTORS = __webpack_require__(3724); 5609 5610var $TypeError = TypeError; 5611// eslint-disable-next-line es/no-object-defineproperty -- safe 5612var defineProperty = Object.defineProperty; 5613var INCORRECT_VALUE = globalThis.self !== globalThis; 5614 5615// `self` getter 5616// https://html.spec.whatwg.org/multipage/window-object.html#dom-self 5617try { 5618 if (DESCRIPTORS) { 5619 // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe 5620 var descriptor = Object.getOwnPropertyDescriptor(globalThis, 'self'); 5621 // some engines have `self`, but with incorrect descriptor 5622 // https://github.com/denoland/deno/issues/15765 5623 if (INCORRECT_VALUE || !descriptor || !descriptor.get || !descriptor.enumerable) { 5624 defineBuiltInAccessor(globalThis, 'self', { 5625 get: function self() { 5626 return globalThis; 5627 }, 5628 set: function self(value) { 5629 if (this !== globalThis) throw new $TypeError('Illegal invocation'); 5630 defineProperty(globalThis, 'self', { 5631 value: value, 5632 writable: true, 5633 configurable: true, 5634 enumerable: true 5635 }); 5636 }, 5637 configurable: true, 5638 enumerable: true 5639 }); 5640 } 5641 } else $({ global: true, simple: true, forced: INCORRECT_VALUE }, { 5642 self: globalThis 5643 }); 5644} catch (error) { /* empty */ } 5645 5646 5647/***/ }, 5648 5649/***/ 4603 5650(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 5651 5652 5653var defineBuiltIn = __webpack_require__(6840); 5654var uncurryThis = __webpack_require__(9504); 5655var toString = __webpack_require__(655); 5656var validateArgumentsLength = __webpack_require__(2812); 5657 5658var $URLSearchParams = URLSearchParams; 5659var URLSearchParamsPrototype = $URLSearchParams.prototype; 5660var append = uncurryThis(URLSearchParamsPrototype.append); 5661var $delete = uncurryThis(URLSearchParamsPrototype['delete']);
vendor: 10,387 bytes, lines 5662-5945
5662var forEach = uncurryThis(URLSearchParamsPrototype.forEach); 5663var push = uncurryThis([].push); 5664var params = new $URLSearchParams('a=1&a=2&b=3'); 5665 5666params['delete']('a', 1); 5667// `undefined` case is a Chromium 117 bug 5668// https://bugs.chromium.org/p/v8/issues/detail?id=14222 5669params['delete']('b', undefined); 5670 5671if (params + '' !== 'a=2') { 5672 defineBuiltIn(URLSearchParamsPrototype, 'delete', function (name /* , value */) { 5673 var length = arguments.length; 5674 var $value = length < 2 ? undefined : arguments[1]; 5675 if (length && $value === undefined) return $delete(this, name); 5676 var entries = []; 5677 forEach(this, function (v, k) { // also validates `this` 5678 push(entries, { key: k, value: v }); 5679 }); 5680 validateArgumentsLength(length, 1); 5681 var key = toString(name); 5682 var value = toString($value); 5683 var index = 0; 5684 var entriesLength = entries.length; 5685 var entry; 5686 while (index < entriesLength) { 5687 entry = entries[index]; 5688 $delete(this, entry.key); 5689 index++; 5690 } 5691 index = 0; 5692 while (index < entriesLength) { 5693 entry = entries[index++]; 5694 if (!(entry.key === key && entry.value === value)) append(this, entry.key, entry.value); 5695 } 5696 }, { enumerable: true, unsafe: true }); 5697} 5698 5699 5700/***/ }, 5701 5702/***/ 7566 5703(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 5704 5705 5706var defineBuiltIn = __webpack_require__(6840); 5707var uncurryThis = __webpack_require__(9504); 5708var toString = __webpack_require__(655); 5709var validateArgumentsLength = __webpack_require__(2812); 5710 5711var $URLSearchParams = URLSearchParams; 5712var URLSearchParamsPrototype = $URLSearchParams.prototype; 5713var getAll = uncurryThis(URLSearchParamsPrototype.getAll); 5714var $has = uncurryThis(URLSearchParamsPrototype.has); 5715var params = new $URLSearchParams('a=1'); 5716 5717// `undefined` case is a Chromium 117 bug 5718// https://bugs.chromium.org/p/v8/issues/detail?id=14222 5719if (params.has('a', 2) || !params.has('a', undefined)) { 5720 defineBuiltIn(URLSearchParamsPrototype, 'has', function has(name /* , value */) { 5721 var length = arguments.length; 5722 var $value = length < 2 ? undefined : arguments[1]; 5723 if (length && $value === undefined) return $has(this, name); 5724 var values = getAll(this, name); // also validates `this` 5725 validateArgumentsLength(length, 1); 5726 var value = toString($value); 5727 var index = 0; 5728 while (index < values.length) { 5729 if (values[index++] === value) return true; 5730 } return false; 5731 }, { enumerable: true, unsafe: true }); 5732} 5733 5734 5735/***/ }, 5736 5737/***/ 8721 5738(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 5739 5740 5741var DESCRIPTORS = __webpack_require__(3724); 5742var uncurryThis = __webpack_require__(9504); 5743var defineBuiltInAccessor = __webpack_require__(2106); 5744 5745var URLSearchParamsPrototype = URLSearchParams.prototype; 5746var forEach = uncurryThis(URLSearchParamsPrototype.forEach); 5747 5748// `URLSearchParams.prototype.size` getter 5749// https://github.com/whatwg/url/pull/734 5750if (DESCRIPTORS && !('size' in URLSearchParamsPrototype)) { 5751 defineBuiltInAccessor(URLSearchParamsPrototype, 'size', { 5752 get: function size() { 5753 var count = 0; 5754 forEach(this, function () { count++; }); 5755 return count; 5756 }, 5757 configurable: true, 5758 enumerable: true 5759 }); 5760} 5761 5762 5763/***/ }, 5764 5765/***/ 5781 5766(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { 5767 5768 5769var $ = __webpack_require__(6518); 5770var getBuiltIn = __webpack_require__(7751); 5771var validateArgumentsLength = __webpack_require__(2812); 5772var toString = __webpack_require__(655); 5773var USE_NATIVE_URL = __webpack_require__(7416); 5774 5775var URL = getBuiltIn('URL'); 5776 5777// `URL.parse` method 5778// https://url.spec.whatwg.org/#dom-url-parse 5779$({ target: 'URL', stat: true, forced: !USE_NATIVE_URL }, { 5780 parse: function parse(url) { 5781 var length = validateArgumentsLength(arguments.length, 1); 5782 var urlString = toString(url); 5783 var base = length < 2 || arguments[1] === undefined ? undefined : toString(arguments[1]); 5784 try { 5785 return new URL(urlString, base); 5786 } catch (error) { 5787 return null; 5788 } 5789 } 5790}); 5791 5792 5793/***/ } 5794 5795/******/ }); 5796/************************************************************************/ 5797/******/ // The module cache 5798/******/ var __webpack_module_cache__ = {}; 5799/******/ 5800/******/ // The require function 5801/******/ function __webpack_require__(moduleId) { 5802/******/ // Check if module is in cache 5803/******/ var cachedModule = __webpack_module_cache__[moduleId]; 5804/******/ if (cachedModule !== undefined) { 5805/******/ return cachedModule.exports; 5806/******/ } 5807/******/ // Create a new module (and put it into the cache) 5808/******/ var module = __webpack_module_cache__[moduleId] = { 5809/******/ // no module.id needed 5810/******/ // no module.loaded needed 5811/******/ exports: {} 5812/******/ }; 5813/******/ 5814/******/ // Execute the module function 5815/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); 5816/******/ 5817/******/ // Return the exports of the module 5818/******/ return module.exports; 5819/******/ } 5820/******/ 5821/************************************************************************/ 5822/******/ /* webpack/runtime/define property getters */ 5823/******/ (() => { 5824/******/ // define getter functions for harmony exports 5825/******/ __webpack_require__.d = (exports, definition) => { 5826/******/ for(var key in definition) { 5827/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 5828/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 5829/******/ } 5830/******/ } 5831/******/ }; 5832/******/ })(); 5833/******/ 5834/******/ /* webpack/runtime/hasOwnProperty shorthand */ 5835/******/ (() => { 5836/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 5837/******/ })(); 5838/******/ 5839/************************************************************************/ 5840 5841// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.push.js 5842var es_array_push = __webpack_require__(4114); 5843// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array-buffer.detached.js 5844var es_array_buffer_detached = __webpack_require__(6573); 5845// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array-buffer.transfer.js 5846var es_array_buffer_transfer = __webpack_require__(8100); 5847// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array-buffer.transfer-to-fixed-length.js 5848var es_array_buffer_transfer_to_fixed_length = __webpack_require__(7936); 5849// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.constructor.js 5850var es_iterator_constructor = __webpack_require__(8111); 5851// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.filter.js 5852var es_iterator_filter = __webpack_require__(2489); 5853// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.map.js 5854var es_iterator_map = __webpack_require__(1701); 5855// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.some.js 5856var es_iterator_some = __webpack_require__(3579); 5857// EXTERNAL MODULE: ./node_modules/core-js/modules/es.map.get-or-insert.js 5858var es_map_get_or_insert = __webpack_require__(5367); 5859// EXTERNAL MODULE: ./node_modules/core-js/modules/es.map.get-or-insert-computed.js 5860var es_map_get_or_insert_computed = __webpack_require__(2731); 5861// EXTERNAL MODULE: ./node_modules/core-js/modules/es.promise.with-resolvers.js 5862var es_promise_with_resolvers = __webpack_require__(4628); 5863// EXTERNAL MODULE: ./node_modules/core-js/modules/es.set.difference.v2.js 5864var es_set_difference_v2 = __webpack_require__(7642); 5865// EXTERNAL MODULE: ./node_modules/core-js/modules/es.set.intersection.v2.js 5866var es_set_intersection_v2 = __webpack_require__(8004); 5867// EXTERNAL MODULE: ./node_modules/core-js/modules/es.set.is-disjoint-from.v2.js 5868var es_set_is_disjoint_from_v2 = __webpack_require__(3853); 5869// EXTERNAL MODULE: ./node_modules/core-js/modules/es.set.is-subset-of.v2.js 5870var es_set_is_subset_of_v2 = __webpack_require__(5876); 5871// EXTERNAL MODULE: ./node_modules/core-js/modules/es.set.is-superset-of.v2.js 5872var es_set_is_superset_of_v2 = __webpack_require__(2475); 5873// EXTERNAL MODULE: ./node_modules/core-js/modules/es.set.symmetric-difference.v2.js 5874var es_set_symmetric_difference_v2 = __webpack_require__(5024); 5875// EXTERNAL MODULE: ./node_modules/core-js/modules/es.set.union.v2.js 5876var es_set_union_v2 = __webpack_require__(1698); 5877// EXTERNAL MODULE: ./node_modules/core-js/modules/es.typed-array.with.js 5878var es_typed_array_with = __webpack_require__(9577); 5879// EXTERNAL MODULE: ./node_modules/core-js/modules/es.uint8-array.set-from-base64.js 5880var es_uint8_array_set_from_base64 = __webpack_require__(6632); 5881// EXTERNAL MODULE: ./node_modules/core-js/modules/es.uint8-array.set-from-hex.js 5882var es_uint8_array_set_from_hex = __webpack_require__(4226); 5883// EXTERNAL MODULE: ./node_modules/core-js/modules/es.uint8-array.to-base64.js 5884var es_uint8_array_to_base64 = __webpack_require__(9486); 5885// EXTERNAL MODULE: ./node_modules/core-js/modules/es.uint8-array.to-hex.js 5886var es_uint8_array_to_hex = __webpack_require__(456); 5887// EXTERNAL MODULE: ./node_modules/core-js/modules/web.self.js 5888var web_self = __webpack_require__(3611); 5889// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.includes.js 5890var es_array_includes = __webpack_require__(4423); 5891// EXTERNAL MODULE: ./node_modules/core-js/modules/web.url.parse.js 5892var web_url_parse = __webpack_require__(5781); 5893;// ./src/shared/util.js 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser"); 5908const BBOX_INIT = [Infinity, Infinity, -Infinity, -Infinity]; 5909const F32_BBOX_INIT = new Float32Array(BBOX_INIT); 5910const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0]; 5911const LINE_FACTOR = 1.35; 5912const LINE_DESCENT_FACTOR = 0.35; 5913const BASELINE_FACTOR = LINE_DESCENT_FACTOR / LINE_FACTOR; 5914const RenderingIntentFlag = { 5915 ANY: 0x01, 5916 DISPLAY: 0x02, 5917 PRINT: 0x04, 5918 SAVE: 0x08, 5919 ANNOTATIONS_FORMS: 0x10, 5920 ANNOTATIONS_STORAGE: 0x20, 5921 ANNOTATIONS_DISABLE: 0x40, 5922 IS_EDITING: 0x80, 5923 OPLIST: 0x100 5924}; 5925const AnnotationMode = { 5926 DISABLE: 0, 5927 ENABLE: 1, 5928 ENABLE_FORMS: 2, 5929 ENABLE_STORAGE: 3 5930}; 5931const AnnotationEditorPrefix = "pdfjs_internal_editor_"; 5932const AnnotationEditorType = { 5933 DISABLE: -1, 5934 NONE: 0, 5935 FREETEXT: 3, 5936 HIGHLIGHT: 9, 5937 STAMP: 13, 5938 INK: 15, 5939 POPUP: 16, 5940 SIGNATURE: 101, 5941 COMMENT: 102 5942}; 5943const AnnotationEditorParamsType = { 5944 RESIZE: 1, 5945 CREATE: 2,
5946 FREETEXT_SIZE: 11, 5947 FREETEXT_COLOR: 12, 5948 FREETEXT_OPACITY: 13, 5949 INK_COLOR: 21, 5950 INK_THICKNESS: 22, 5951 INK_OPACITY: 23, 5952 INK_COLOR_AND_OPACITY: 24, 5953 HIGHLIGHT_COLOR: 31, 5954 HIGHLIGHT_THICKNESS: 32, 5955 HIGHLIGHT_FREE: 33, 5956 HIGHLIGHT_SHOW_ALL: 34, 5957 DRAW_STEP: 41 5958}; 5959const PermissionFlag = { 5960 PRINT: 0x04, 5961 MODIFY_CONTENTS: 0x08, 5962 COPY: 0x10, 5963 MODIFY_ANNOTATIONS: 0x20, 5964 FILL_INTERACTIVE_FORMS: 0x100, 5965 COPY_FOR_ACCESSIBILITY: 0x200, 5966 ASSEMBLE: 0x400, 5967 PRINT_HIGH_QUALITY: 0x800 5968}; 5969const MeshFigureType = { 5970 TRIANGLES: 1, 5971 LATTICE: 2, 5972 PATCH: 3 5973}; 5974const TextRenderingMode = { 5975 FILL: 0, 5976 STROKE: 1, 5977 FILL_STROKE: 2, 5978 INVISIBLE: 3, 5979 FILL_ADD_TO_PATH: 4, 5980 STROKE_ADD_TO_PATH: 5, 5981 FILL_STROKE_ADD_TO_PATH: 6, 5982 ADD_TO_PATH: 7, 5983 FILL_STROKE_MASK: 3, 5984 ADD_TO_PATH_FLAG: 4 5985}; 5986const ImageKind = { 5987 GRAYSCALE_1BPP: 1, 5988 RGB_24BPP: 2, 5989 RGBA_32BPP: 3 5990}; 5991const AnnotationType = { 5992 TEXT: 1, 5993 LINK: 2, 5994 FREETEXT: 3, 5995 LINE: 4, 5996 SQUARE: 5, 5997 CIRCLE: 6, 5998 POLYGON: 7, 5999 POLYLINE: 8, 6000 HIGHLIGHT: 9, 6001 UNDERLINE: 10, 6002 SQUIGGLY: 11, 6003 STRIKEOUT: 12, 6004 STAMP: 13, 6005 CARET: 14, 6006 INK: 15, 6007 POPUP: 16, 6008 FILEATTACHMENT: 17, 6009 SOUND: 18, 6010 MOVIE: 19, 6011 WIDGET: 20, 6012 SCREEN: 21, 6013 PRINTERMARK: 22, 6014 TRAPNET: 23, 6015 WATERMARK: 24, 6016 THREED: 25, 6017 REDACT: 26 6018}; 6019const AnnotationReplyType = { 6020 GROUP: "Group", 6021 REPLY: "R" 6022}; 6023const AnnotationFlag = { 6024 INVISIBLE: 0x01, 6025 HIDDEN: 0x02, 6026 PRINT: 0x04, 6027 NOZOOM: 0x08, 6028 NOROTATE: 0x10, 6029 NOVIEW: 0x20, 6030 READONLY: 0x40, 6031 LOCKED: 0x80, 6032 TOGGLENOVIEW: 0x100, 6033 LOCKEDCONTENTS: 0x200 6034}; 6035const AnnotationFieldFlag = { 6036 READONLY: 0x0000001, 6037 REQUIRED: 0x0000002, 6038 NOEXPORT: 0x0000004, 6039 MULTILINE: 0x0001000, 6040 PASSWORD: 0x0002000, 6041 NOTOGGLETOOFF: 0x0004000, 6042 RADIO: 0x0008000, 6043 PUSHBUTTON: 0x0010000, 6044 COMBO: 0x0020000, 6045 EDIT: 0x0040000, 6046 SORT: 0x0080000, 6047 FILESELECT: 0x0100000, 6048 MULTISELECT: 0x0200000, 6049 DONOTSPELLCHECK: 0x0400000, 6050 DONOTSCROLL: 0x0800000, 6051 COMB: 0x1000000, 6052 RICHTEXT: 0x2000000, 6053 RADIOSINUNISON: 0x2000000, 6054 COMMITONSELCHANGE: 0x4000000 6055}; 6056const AnnotationBorderStyleType = { 6057 SOLID: 1, 6058 DASHED: 2, 6059 BEVELED: 3, 6060 INSET: 4, 6061 UNDERLINE: 5 6062}; 6063const AnnotationActionEventType = { 6064 E: "Mouse Enter", 6065 X: "Mouse Exit", 6066 D: "Mouse Down", 6067 U: "Mouse Up", 6068 Fo: "Focus", 6069 Bl: "Blur", 6070 PO: "PageOpen", 6071 PC: "PageClose", 6072 PV: "PageVisible", 6073 PI: "PageInvisible", 6074 K: "Keystroke", 6075 F: "Format", 6076 V: "Validate", 6077 C: "Calculate" 6078}; 6079const DocumentActionEventType = { 6080 WC: "WillClose", 6081 WS: "WillSave", 6082 DS: "DidSave", 6083 WP: "WillPrint", 6084 DP: "DidPrint" 6085}; 6086const PageActionEventType = { 6087 O: "PageOpen", 6088 C: "PageClose" 6089}
vendor: 6,037 bytes, lines 6089-6351
6089; 6090const VerbosityLevel = { 6091 ERRORS: 0, 6092 WARNINGS: 1, 6093 INFOS: 5 6094}; 6095const OPS = { 6096 dependency: 1, 6097 setLineWidth: 2, 6098 setLineCap: 3, 6099 setLineJoin: 4, 6100 setMiterLimit: 5, 6101 setDash: 6, 6102 setRenderingIntent: 7, 6103 setFlatness: 8, 6104 setGState: 9, 6105 save: 10, 6106 restore: 11, 6107 transform: 12, 6108 moveTo: 13, 6109 lineTo: 14, 6110 curveTo: 15, 6111 curveTo2: 16, 6112 curveTo3: 17, 6113 closePath: 18, 6114 rectangle: 19, 6115 stroke: 20, 6116 closeStroke: 21, 6117 fill: 22, 6118 eoFill: 23, 6119 fillStroke: 24, 6120 eoFillStroke: 25, 6121 closeFillStroke: 26, 6122 closeEOFillStroke: 27, 6123 endPath: 28, 6124 clip: 29, 6125 eoClip: 30, 6126 beginText: 31, 6127 endText: 32, 6128 setCharSpacing: 33, 6129 setWordSpacing: 34, 6130 setHScale: 35, 6131 setLeading: 36, 6132 setFont: 37, 6133 setTextRenderingMode: 38, 6134 setTextRise: 39, 6135 moveText: 40, 6136 setLeadingMoveText: 41, 6137 setTextMatrix: 42, 6138 nextLine: 43, 6139 showText: 44, 6140 showSpacedText: 45, 6141 nextLineShowText: 46, 6142 nextLineSetSpacingShowText: 47, 6143 setCharWidth: 48, 6144 setCharWidthAndBounds: 49, 6145 setStrokeColorSpace: 50, 6146 setFillColorSpace: 51, 6147 setStrokeColor: 52, 6148 setStrokeColorN: 53, 6149 setFillColor: 54, 6150 setFillColorN: 55, 6151 setStrokeGray: 56, 6152 setFillGray: 57, 6153 setStrokeRGBColor: 58, 6154 setFillRGBColor: 59, 6155 setStrokeCMYKColor: 60, 6156 setFillCMYKColor: 61, 6157 shadingFill: 62, 6158 beginInlineImage: 63, 6159 beginImageData: 64, 6160 endInlineImage: 65, 6161 paintXObject: 66, 6162 markPoint: 67, 6163 markPointProps: 68, 6164 beginMarkedContent: 69, 6165 beginMarkedContentProps: 70, 6166 endMarkedContent: 71, 6167 beginCompat: 72, 6168 endCompat: 73, 6169 paintFormXObjectBegin: 74, 6170 paintFormXObjectEnd: 75, 6171 beginGroup: 76, 6172 endGroup: 77, 6173 beginAnnotation: 80, 6174 endAnnotation: 81, 6175 paintImageMaskXObject: 83, 6176 paintImageMaskXObjectGroup: 84, 6177 paintImageXObject: 85, 6178 paintInlineImageXObject: 86, 6179 paintInlineImageXObjectGroup: 87, 6180 paintImageXObjectRepeat: 88, 6181 paintImageMaskXObjectRepeat: 89, 6182 paintSolidColorImageMask: 90, 6183 constructPath: 91, 6184 setStrokeTransparent: 92, 6185 setFillTransparent: 93, 6186 rawFillPath: 94 6187}; 6188const DrawOPS = { 6189 moveTo: 0, 6190 lineTo: 1, 6191 curveTo: 2, 6192 quadraticCurveTo: 3, 6193 closePath: 4 6194}; 6195const PasswordResponses = { 6196 NEED_PASSWORD: 1, 6197 INCORRECT_PASSWORD: 2 6198}; 6199let verbosity = VerbosityLevel.WARNINGS; 6200function setVerbosityLevel(level) { 6201 if (Number.isInteger(level)) { 6202 verbosity = level; 6203 } 6204} 6205function getVerbosityLevel() { 6206 return verbosity; 6207} 6208function info(msg) { 6209 if (verbosity >= VerbosityLevel.INFOS) { 6210 console.info(`Info: ${msg}`); 6211 } 6212} 6213function warn(msg) { 6214 if (verbosity >= VerbosityLevel.WARNINGS) { 6215 console.warn(`Warning: ${msg}`); 6216 } 6217} 6218function unreachable(msg) { 6219 throw new Error(msg); 6220} 6221function assert(cond, msg) { 6222 if (!cond) { 6223 unreachable(msg); 6224 } 6225} 6226function _isValidProtocol(url) { 6227 switch (url?.protocol) { 6228 case "http:": 6229 case "https:": 6230 case "ftp:": 6231 case "mailto:": 6232 case "tel:": 6233 return true; 6234 default: 6235 return false; 6236 } 6237} 6238function createValidAbsoluteUrl(url, baseUrl = null, options = null) { 6239 if (!url) { 6240 return null; 6241 } 6242 if (options && typeof url === "string") { 6243 if (options.addDefaultProtocol && url.startsWith("www.")) { 6244 const dots = url.match(/\./g); 6245 if (dots?.length >= 2) { 6246 url = `http://${url}`; 6247 } 6248 } 6249 if (options.tryConvertEncoding) { 6250 try { 6251 url = stringToUTF8String(url); 6252 } catch {} 6253 } 6254 } 6255 const absoluteUrl = baseUrl ? URL.parse(url, baseUrl) : URL.parse(url); 6256 return _isValidProtocol(absoluteUrl) ? absoluteUrl : null; 6257} 6258function updateUrlHash(url, hash, allowRel = false) { 6259 const res = URL.parse(url); 6260 if (res) { 6261 res.hash = hash; 6262 return res.href; 6263 } 6264 if (allowRel && createValidAbsoluteUrl(url, "http://example.com")) { 6265 return url.split("#", 1)[0] + `${hash ? `#${hash}` : ""}`; 6266 } 6267 return ""; 6268} 6269function stripPath(str) { 6270 return str.substring(str.lastIndexOf("/") + 1); 6271} 6272function shadow(obj, prop, value, nonSerializable = false) { 6273 Object.defineProperty(obj, prop, { 6274 value, 6275 enumerable: !nonSerializable, 6276 configurable: true, 6277 writable: false 6278 }); 6279 return value; 6280} 6281const BaseException = function BaseExceptionClosure() { 6282 function BaseException(message, name) { 6283 this.message = message; 6284 this.name = name; 6285 } 6286 BaseException.prototype = new Error(); 6287 BaseException.constructor = BaseException; 6288 return BaseException; 6289}(); 6290class PasswordException extends BaseException { 6291 constructor(msg, code) { 6292 super(msg, "PasswordException"); 6293 this.code = code; 6294 } 6295} 6296class UnknownErrorException extends BaseException { 6297 constructor(msg, details) { 6298 super(msg, "UnknownErrorException"); 6299 this.details = details; 6300 } 6301} 6302class InvalidPDFException extends BaseException { 6303 constructor(msg) { 6304 super(msg, "InvalidPDFException"); 6305 } 6306} 6307class ResponseException extends BaseException { 6308 constructor(msg, status, missing) { 6309 super(msg, "ResponseException"); 6310 this.status = status; 6311 this.missing = missing; 6312 } 6313} 6314class FormatError extends BaseException { 6315 constructor(msg) { 6316 super(msg, "FormatError"); 6317 } 6318} 6319class AbortException extends BaseException { 6320 constructor(msg) { 6321 super(msg, "AbortException"); 6322 } 6323} 6324function bytesToString(bytes) { 6325 if (typeof bytes !== "object" || bytes?.length === undefined) { 6326 unreachable("Invalid argument for bytesToString"); 6327 } 6328 const length = bytes.length; 6329 const MAX_ARGUMENT_COUNT = 8192; 6330 if (length < MAX_ARGUMENT_COUNT) { 6331 return String.fromCharCode.apply(null, bytes); 6332 } 6333 const strBuf = []; 6334 for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) { 6335 const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length); 6336 const chunk = bytes.subarray(i, chunkEnd); 6337 strBuf.push(String.fromCharCode.apply(null, chunk)); 6338 } 6339 return strBuf.join(""); 6340} 6341function stringToBytes(str) { 6342 if (typeof str !== "string") { 6343 unreachable("Invalid argument for stringToBytes"); 6344 } 6345 const length = str.length; 6346 const bytes = new Uint8Array(length); 6347 for (let i = 0; i < length; ++i) { 6348 bytes[i] = str.charCodeAt(i) & 0xff; 6349 } 6350 return bytes; 6351}
vendor: 15,278 bytes, lines 6352-6822
6352function objectSize(obj) { 6353 return Object.keys(obj).length; 6354} 6355function isLittleEndian() { 6356 const buffer8 = new Uint8Array(4); 6357 buffer8[0] = 1; 6358 const view32 = new Uint32Array(buffer8.buffer, 0, 1); 6359 return view32[0] === 1; 6360} 6361class FeatureTest { 6362 static get isLittleEndian() { 6363 return shadow(this, "isLittleEndian", isLittleEndian()); 6364 } 6365 static get isOffscreenCanvasSupported() { 6366 return shadow(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas !== "undefined"); 6367 } 6368 static get isImageDecoderSupported() { 6369 return shadow(this, "isImageDecoderSupported", typeof ImageDecoder !== "undefined"); 6370 } 6371 static get isFloat16ArraySupported() { 6372 return shadow(this, "isFloat16ArraySupported", typeof Float16Array !== "undefined"); 6373 } 6374 static get isSanitizerSupported() { 6375 return shadow(this, "isSanitizerSupported", typeof Sanitizer !== "undefined"); 6376 } 6377 static get platform() { 6378 const { 6379 platform, 6380 userAgent 6381 } = navigator; 6382 return shadow(this, "platform", { 6383 isAndroid: userAgent.includes("Android"), 6384 isLinux: platform.includes("Linux"), 6385 isMac: platform.includes("Mac"), 6386 isWindows: platform.includes("Win"), 6387 isFirefox: userAgent.includes("Firefox") 6388 }); 6389 } 6390 static get isCSSRoundSupported() { 6391 return shadow(this, "isCSSRoundSupported", globalThis.CSS?.supports?.("width: round(1.5px, 1px)")); 6392 } 6393 static get isAlphaColorInputSupported() { 6394 return shadow(this, "isAlphaColorInputSupported", (() => { 6395 if (typeof document === "undefined") { 6396 return false; 6397 } 6398 const input = document.createElement("input"); 6399 input.type = "color"; 6400 input.setAttribute("alpha", ""); 6401 input.value = "#ff000080"; 6402 return input.value !== "#ff0000"; 6403 })()); 6404 } 6405} 6406class Util { 6407 static get hexNums() { 6408 return shadow(this, "hexNums", Array.from(Array(256).keys(), n => n.toString(16).padStart(2, "0"))); 6409 } 6410 static makeHexColor(r, g, b) { 6411 return `#${this.hexNums[r]}${this.hexNums[g]}${this.hexNums[b]}`; 6412 } 6413 static domMatrixToTransform(dm) { 6414 return [dm.a, dm.b, dm.c, dm.d, dm.e, dm.f]; 6415 } 6416 static scaleMinMax(transform, minMax) { 6417 let temp; 6418 if (transform[0]) { 6419 if (transform[0] < 0) { 6420 temp = minMax[0]; 6421 minMax[0] = minMax[2]; 6422 minMax[2] = temp; 6423 } 6424 minMax[0] *= transform[0]; 6425 minMax[2] *= transform[0]; 6426 if (transform[3] < 0) { 6427 temp = minMax[1]; 6428 minMax[1] = minMax[3]; 6429 minMax[3] = temp; 6430 } 6431 minMax[1] *= transform[3]; 6432 minMax[3] *= transform[3]; 6433 } else { 6434 temp = minMax[0]; 6435 minMax[0] = minMax[1]; 6436 minMax[1] = temp; 6437 temp = minMax[2]; 6438 minMax[2] = minMax[3]; 6439 minMax[3] = temp; 6440 if (transform[1] < 0) { 6441 temp = minMax[1]; 6442 minMax[1] = minMax[3]; 6443 minMax[3] = temp; 6444 } 6445 minMax[1] *= transform[1]; 6446 minMax[3] *= transform[1]; 6447 if (transform[2] < 0) { 6448 temp = minMax[0]; 6449 minMax[0] = minMax[2]; 6450 minMax[2] = temp; 6451 } 6452 minMax[0] *= transform[2]; 6453 minMax[2] *= transform[2]; 6454 } 6455 minMax[0] += transform[4]; 6456 minMax[1] += transform[5]; 6457 minMax[2] += transform[4]; 6458 minMax[3] += transform[5]; 6459 } 6460 static transform(m1, m2) { 6461 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]]; 6462 } 6463 static multiplyByDOMMatrix(m, md) { 6464 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]]; 6465 } 6466 static applyTransform(p, m, pos = 0) { 6467 const p0 = p[pos]; 6468 const p1 = p[pos + 1]; 6469 p[pos] = p0 * m[0] + p1 * m[2] + m[4]; 6470 p[pos + 1] = p0 * m[1] + p1 * m[3] + m[5]; 6471 } 6472 static applyTransformToBezier(p, transform, pos = 0) { 6473 const m0 = transform[0]; 6474 const m1 = transform[1]; 6475 const m2 = transform[2]; 6476 const m3 = transform[3]; 6477 const m4 = transform[4]; 6478 const m5 = transform[5]; 6479 for (let i = 0; i < 6; i += 2) { 6480 const pI = p[pos + i]; 6481 const pI1 = p[pos + i + 1]; 6482 p[pos + i] = pI * m0 + pI1 * m2 + m4; 6483 p[pos + i + 1] = pI * m1 + pI1 * m3 + m5; 6484 } 6485 } 6486 static applyInverseTransform(p, m) { 6487 const p0 = p[0]; 6488 const p1 = p[1]; 6489 const d = m[0] * m[3] - m[1] * m[2]; 6490 p[0] = (p0 * m[3] - p1 * m[2] + m[2] * m[5] - m[4] * m[3]) / d; 6491 p[1] = (-p0 * m[1] + p1 * m[0] + m[4] * m[1] - m[5] * m[0]) / d; 6492 } 6493 static axialAlignedBoundingBox(rect, transform, output) { 6494 const m0 = transform[0]; 6495 const m1 = transform[1]; 6496 const m2 = transform[2]; 6497 const m3 = transform[3]; 6498 const m4 = transform[4]; 6499 const m5 = transform[5]; 6500 const r0 = rect[0]; 6501 const r1 = rect[1]; 6502 const r2 = rect[2]; 6503 const r3 = rect[3]; 6504 let a0 = m0 * r0 + m4; 6505 let a2 = a0; 6506 let a1 = m0 * r2 + m4; 6507 let a3 = a1; 6508 let b0 = m3 * r1 + m5; 6509 let b2 = b0; 6510 let b1 = m3 * r3 + m5; 6511 let b3 = b1; 6512 if (m1 !== 0 || m2 !== 0) { 6513 const m1r0 = m1 * r0; 6514 const m1r2 = m1 * r2; 6515 const m2r1 = m2 * r1; 6516 const m2r3 = m2 * r3; 6517 a0 += m2r1; 6518 a3 += m2r1; 6519 a1 += m2r3; 6520 a2 += m2r3; 6521 b0 += m1r0; 6522 b3 += m1r0; 6523 b1 += m1r2; 6524 b2 += m1r2; 6525 } 6526 output[0] = Math.min(output[0], a0, a1, a2, a3); 6527 output[1] = Math.min(output[1], b0, b1, b2, b3); 6528 output[2] = Math.max(output[2], a0, a1, a2, a3); 6529 output[3] = Math.max(output[3], b0, b1, b2, b3); 6530 } 6531 static inverseTransform(m) { 6532 const d = m[0] * m[3] - m[1] * m[2]; 6533 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]; 6534 } 6535 static singularValueDecompose2dScale(matrix, output) { 6536 const m0 = matrix[0]; 6537 const m1 = matrix[1]; 6538 const m2 = matrix[2]; 6539 const m3 = matrix[3]; 6540 const a = m0 ** 2 + m1 ** 2; 6541 const b = m0 * m2 + m1 * m3; 6542 const c = m2 ** 2 + m3 ** 2; 6543 const first = (a + c) / 2; 6544 const second = Math.sqrt(first ** 2 - (a * c - b ** 2)); 6545 output[0] = Math.sqrt(first + second || 1); 6546 output[1] = Math.sqrt(first - second || 1); 6547 } 6548 static normalizeRect(rect) { 6549 const r = rect.slice(0); 6550 if (rect[0] > rect[2]) { 6551 r[0] = rect[2]; 6552 r[2] = rect[0]; 6553 } 6554 if (rect[1] > rect[3]) { 6555 r[1] = rect[3]; 6556 r[3] = rect[1]; 6557 } 6558 return r; 6559 } 6560 static intersect(rect1, rect2) { 6561 const xLow = Math.max(Math.min(rect1[0], rect1[2]), Math.min(rect2[0], rect2[2])); 6562 const xHigh = Math.min(Math.max(rect1[0], rect1[2]), Math.max(rect2[0], rect2[2])); 6563 if (xLow > xHigh) { 6564 return null; 6565 } 6566 const yLow = Math.max(Math.min(rect1[1], rect1[3]), Math.min(rect2[1], rect2[3])); 6567 const yHigh = Math.min(Math.max(rect1[1], rect1[3]), Math.max(rect2[1], rect2[3])); 6568 if (yLow > yHigh) { 6569 return null; 6570 } 6571 return [xLow, yLow, xHigh, yHigh]; 6572 } 6573 static pointBoundingBox(x, y, minMax) { 6574 minMax[0] = Math.min(minMax[0], x); 6575 minMax[1] = Math.min(minMax[1], y); 6576 minMax[2] = Math.max(minMax[2], x); 6577 minMax[3] = Math.max(minMax[3], y); 6578 } 6579 static rectBoundingBox(x0, y0, x1, y1, minMax) { 6580 minMax[0] = Math.min(minMax[0], x0, x1); 6581 minMax[1] = Math.min(minMax[1], y0, y1); 6582 minMax[2] = Math.max(minMax[2], x0, x1); 6583 minMax[3] = Math.max(minMax[3], y0, y1); 6584 } 6585 static #getExtremumOnCurve(x0, x1, x2, x3, y0, y1, y2, y3, t, minMax) { 6586 if (t <= 0 || t >= 1) { 6587 return; 6588 } 6589 const mt = 1 - t; 6590 const tt = t * t; 6591 const ttt = tt * t; 6592 const x = mt * (mt * (mt * x0 + 3 * t * x1) + 3 * tt * x2) + ttt * x3; 6593 const y = mt * (mt * (mt * y0 + 3 * t * y1) + 3 * tt * y2) + ttt * y3; 6594 minMax[0] = Math.min(minMax[0], x); 6595 minMax[1] = Math.min(minMax[1], y); 6596 minMax[2] = Math.max(minMax[2], x); 6597 minMax[3] = Math.max(minMax[3], y); 6598 } 6599 static #getExtremum(x0, x1, x2, x3, y0, y1, y2, y3, a, b, c, minMax) { 6600 if (Math.abs(a) < 1e-12) { 6601 if (Math.abs(b) >= 1e-12) { 6602 this.#getExtremumOnCurve(x0, x1, x2, x3, y0, y1, y2, y3, -c / b, minMax); 6603 } 6604 return; 6605 } 6606 const delta = b ** 2 - 4 * c * a; 6607 if (delta < 0) { 6608 return; 6609 } 6610 const sqrtDelta = Math.sqrt(delta); 6611 const a2 = 2 * a; 6612 this.#getExtremumOnCurve(x0, x1, x2, x3, y0, y1, y2, y3, (-b + sqrtDelta) / a2, minMax); 6613 this.#getExtremumOnCurve(x0, x1, x2, x3, y0, y1, y2, y3, (-b - sqrtDelta) / a2, minMax); 6614 } 6615 static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3, minMax) { 6616 minMax[0] = Math.min(minMax[0], x0, x3); 6617 minMax[1] = Math.min(minMax[1], y0, y3); 6618 minMax[2] = Math.max(minMax[2], x0, x3); 6619 minMax[3] = Math.max(minMax[3], y0, y3); 6620 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); 6621 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); 6622 } 6623} 6624const PDFStringTranslateTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2d8, 0x2c7, 0x2c6, 0x2d9, 0x2dd, 0x2db, 0x2da, 0x2dc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192, 0x2044, 0x2039, 0x203a, 0x2212, 0x2030, 0x201e, 0x201c, 0x201d, 0x2018, 0x2019, 0x201a, 0x2122, 0xfb01, 0xfb02, 0x141, 0x152, 0x160, 0x178, 0x17d, 0x131, 0x142, 0x153, 0x161, 0x17e, 0, 0x20ac]; 6625function stringToPDFString(str, keepEscapeSequence = false) { 6626 if (str[0] >= "\xEF") { 6627 let encoding; 6628 if (str[0] === "\xFE" && str[1] === "\xFF") { 6629 encoding = "utf-16be"; 6630 if (str.length % 2 === 1) { 6631 str = str.slice(0, -1); 6632 } 6633 } else if (str[0] === "\xFF" && str[1] === "\xFE") { 6634 encoding = "utf-16le"; 6635 if (str.length % 2 === 1) { 6636 str = str.slice(0, -1); 6637 } 6638 } else if (str[0] === "\xEF" && str[1] === "\xBB" && str[2] === "\xBF") { 6639 encoding = "utf-8"; 6640 } 6641 if (encoding) { 6642 try { 6643 const decoder = new TextDecoder(encoding, { 6644 fatal: true 6645 }); 6646 const buffer = stringToBytes(str); 6647 const decoded = decoder.decode(buffer); 6648 if (keepEscapeSequence || !decoded.includes("\x1b")) { 6649 return decoded; 6650 } 6651 return decoded.replaceAll(/\x1b[^\x1b]*(?:\x1b|$)/g, ""); 6652 } catch (ex) { 6653 warn(`stringToPDFString: "${ex}".`); 6654 } 6655 } 6656 } 6657 const strBuf = []; 6658 for (let i = 0, ii = str.length; i < ii; i++) { 6659 const charCode = str.charCodeAt(i); 6660 if (!keepEscapeSequence && charCode === 0x1b) { 6661 while (++i < ii && str.charCodeAt(i) !== 0x1b) {} 6662 continue; 6663 } 6664 const code = PDFStringTranslateTable[charCode]; 6665 strBuf.push(code ? String.fromCharCode(code) : str.charAt(i)); 6666 } 6667 return strBuf.join(""); 6668} 6669function stringToUTF8String(str) { 6670 return decodeURIComponent(escape(str)); 6671} 6672function utf8StringToString(str) { 6673 return unescape(encodeURIComponent(str)); 6674} 6675function isArrayEqual(arr1, arr2) { 6676 if (arr1.length !== arr2.length) { 6677 return false; 6678 } 6679 for (let i = 0, ii = arr1.length; i < ii; i++) { 6680 if (arr1[i] !== arr2[i]) { 6681 return false; 6682 } 6683 } 6684 return true; 6685} 6686function getModificationDate(date = new Date()) { 6687 if (!(date instanceof Date)) { 6688 date = new Date(date); 6689 } 6690 const buffer = [date.getUTCFullYear().toString(), (date.getUTCMonth() + 1).toString().padStart(2, "0"), date.getUTCDate().toString().padStart(2, "0"), date.getUTCHours().toString().padStart(2, "0"), date.getUTCMinutes().toString().padStart(2, "0"), date.getUTCSeconds().toString().padStart(2, "0")]; 6691 return buffer.join(""); 6692} 6693let NormalizeRegex = null; 6694let NormalizationMap = null; 6695function normalizeUnicode(str) { 6696 if (!NormalizeRegex) { 6697 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; 6698 NormalizationMap = new Map([["ï¬ ", "Å¿t"]]); 6699 } 6700 return str.replaceAll(NormalizeRegex, (_, p1, p2) => p1 ? p1.normalize("NFKC") : NormalizationMap.get(p2)); 6701} 6702function getUuid() { 6703 if (typeof crypto.randomUUID === "function") { 6704 return crypto.randomUUID(); 6705 } 6706 const buf = new Uint8Array(32); 6707 crypto.getRandomValues(buf); 6708 return bytesToString(buf); 6709} 6710const AnnotationPrefix = "pdfjs_internal_id_"; 6711function _isValidExplicitDest(validRef, validName, dest) { 6712 if (!Array.isArray(dest) || dest.length < 2) { 6713 return false; 6714 } 6715 const [page, zoom, ...args] = dest; 6716 if (!validRef(page) && !Number.isInteger(page)) { 6717 return false; 6718 } 6719 if (!validName(zoom)) { 6720 return false; 6721 } 6722 const argsLen = args.length; 6723 let allowNull = true; 6724 switch (zoom.name) { 6725 case "XYZ": 6726 if (argsLen < 2 || argsLen > 3) { 6727 return false; 6728 } 6729 break; 6730 case "Fit": 6731 case "FitB": 6732 return argsLen === 0; 6733 case "FitH": 6734 case "FitBH": 6735 case "FitV": 6736 case "FitBV": 6737 if (argsLen > 1) { 6738 return false; 6739 } 6740 break; 6741 case "FitR": 6742 if (argsLen !== 4) { 6743 return false; 6744 } 6745 allowNull = false; 6746 break; 6747 default: 6748 return false; 6749 } 6750 for (const arg of args) { 6751 if (typeof arg === "number" || allowNull && arg === null) { 6752 continue; 6753 } 6754 return false; 6755 } 6756 return true; 6757} 6758const makeArr = () => []; 6759const makeMap = () => new Map(); 6760const makeObj = () => Object.create(null); 6761if (typeof Blob.prototype.bytes !== "function") { 6762 Blob.prototype.bytes = async function () { 6763 return new Uint8Array(await this.arrayBuffer()); 6764 }; 6765} 6766if (typeof Response.prototype.bytes !== "function") { 6767 Response.prototype.bytes = async function () { 6768 return new Uint8Array(await this.arrayBuffer()); 6769 }; 6770} 6771if (typeof AbortSignal.any !== "function") { 6772 AbortSignal.any = function (iterable) { 6773 const ac = new AbortController(); 6774 const { 6775 signal 6776 } = ac; 6777 for (const s of iterable) { 6778 if (s.aborted) { 6779 ac.abort(s.reason); 6780 return signal; 6781 } 6782 } 6783 for (const s of iterable) { 6784 s.addEventListener("abort", () => { 6785 ac.abort(s.reason); 6786 }, { 6787 signal 6788 }); 6789 } 6790 return signal; 6791 }; 6792} 6793 6794// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.every.js 6795var es_iterator_every = __webpack_require__(1148); 6796;// ./src/core/primitives.js 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808const CIRCULAR_REF = Symbol("CIRCULAR_REF"); 6809const EOF = Symbol("EOF"); 6810let CmdCache = Object.create(null); 6811let NameCache = Object.create(null); 6812let RefCache = Object.create(null); 6813function clearPrimitiveCaches() { 6814 CmdCache = Object.create(null); 6815 NameCache = Object.create(null); 6816 RefCache = Object.create(null); 6817} 6818class Name { 6819 constructor(name) { 6820 this.name = name; 6821 } 6822 static get(name) {
6823 return NameCache[name] ||= new Name(name); 6824 } 6825} 6826class Cmd { 6827 constructor(cmd) { 6828 this.cmd = cmd; 6829 } 6830 static get(cmd) { 6831 return CmdCache[cmd] ||= new Cmd(cmd); 6832 } 6833} 6834const nonSerializable = function nonSerializableClosure() { 6835 return nonSerializable; 6836}; 6837class Dict { 6838 __nonSerializable__ = nonSerializable; 6839 #map = new Map(); 6840 objId = null; 6841 suppressEncryption = false; 6842 xref; 6843 constructor(xref = null) { 6844 this.xref = xref; 6845 } 6846 assignXref(newXref) { 6847 this.xref = newXref; 6848 } 6849 get size() { 6850 return this.#map.size; 6851 } 6852 #getValue(isAsync, key1, key2, key3) { 6853 let value = this.#map.get(key1); 6854 if (value === undefined && key2 !== undefined) { 6855 value = this.#map.get(key2); 6856 if (value === undefined && key3 !== undefined) { 6857 value = this.#map.get(key3); 6858 } 6859 } 6860 if (value instanceof Ref && this.xref) { 6861 return isAsync ? this.xref.fetchAsync(value, this.suppressEncryption) : this.xref.fetch(value, this.suppressEncryption); 6862 } 6863 return value; 6864 } 6865 get(key1, key2, key3) { 6866 return this.#getValue(false, key1, key2, key3); 6867 } 6868 async getAsync(key1, key2, key3) { 6869 return this.#getValue(true, key1, key2, key3); 6870 } 6871 getArray(key1, key2, key3) { 6872 let value = this.#getValue(false, key1, key2, key3); 6873 if (Array.isArray(value)) { 6874 value = value.slice(); 6875 for (let i = 0, ii = value.length; i < ii; i++) { 6876 if (value[i] instanceof Ref && this.xref) { 6877 value[i] = this.xref.fetch(value[i], this.suppressEncryption); 6878 } 6879 } 6880 } 6881 return value; 6882 } 6883 getRaw(key) { 6884 return this.#map.get(key); 6885 } 6886 getKeys() { 6887 return this.#map.keys(); 6888 } 6889 getRawValues() { 6890 return this.#map.values(); 6891 } 6892 getRawEntries() { 6893 return this.#map.entries(); 6894 } 6895 set(key, value) { 6896 this.#map.set(key, value); 6897 } 6898 setIfNotExists(key, value) { 6899 if (!this.has(key)) { 6900 this.set(key, value); 6901 } 6902 } 6903 setIfNumber(key, value) { 6904 if (typeof value === "number") { 6905 this.set(key, value); 6906 } 6907 } 6908 setIfArray(key, value) { 6909 if (Array.isArray(value) || ArrayBuffer.isView(value)) { 6910 this.set(key, value); 6911 } 6912 } 6913 setIfDefined(key, value) { 6914 if (value !== undefined && value !== null) { 6915 this.set(key, value); 6916 } 6917 } 6918 setIfName(key, value) { 6919 if (typeof value === "string") { 6920 this.set(key, Name.get(value)); 6921 } else if (value instanceof Name) { 6922 this.set(key, value); 6923 } 6924 } 6925 setIfDict(key, value) { 6926 if (value instanceof Dict) { 6927 this.set(key, value); 6928 } 6929 } 6930 has(key) { 6931 return this.#map.has(key); 6932 } 6933 *[Symbol.iterator]() { 6934 for (const [key, value] of this.#map) { 6935 yield [key, value instanceof Ref && this.xref ? this.xref.fetch(value, this.suppressEncryption) : value]; 6936 } 6937 } 6938 static get empty() { 6939 const emptyDict = new Dict(null); 6940 emptyDict.set = (key, value) => { 6941 unreachable("Should not call `set` on the empty dictionary."); 6942 }; 6943 return shadow(this, "empty", emptyDict); 6944 } 6945 static merge({ 6946 xref, 6947 dictArray, 6948 mergeSubDicts = false 6949 }) { 6950 const mergedDict = new Dict(xref), 6951 properties = new Map(); 6952 for (const dict of dictArray) { 6953 if (!(dict instanceof Dict)) { 6954 continue; 6955 } 6956 for (const [key, value] of dict.getRawEntries()) { 6957 let property = properties.get(key); 6958 if (property === undefined) { 6959 property = []; 6960 properties.set(key, property); 6961 } else if (!mergeSubDicts || !(value instanceof Dict)) { 6962 continue; 6963 } 6964 property.push(value); 6965 } 6966 } 6967 for (const [name, values] of properties) { 6968 if (values.length === 1 || !(values[0] instanceof Dict)) { 6969 mergedDict.set(name, values[0]); 6970 continue; 6971 } 6972 const subDict = new Dict(xref); 6973 for (const dict of values) { 6974 for (const [key, value] of dict.getRawEntries()) { 6975 subDict.setIfNotExists(key, value); 6976 } 6977 } 6978 if (subDict.size > 0) { 6979 mergedDict.set(name, subDict); 6980 } 6981 } 6982 properties.clear(); 6983 return mergedDict.size > 0 ? mergedDict : Dict.empty; 6984 } 6985 clone() { 6986 const dict = new Dict(this.xref); 6987 for (const [key, value] of this.#map) { 6988 dict.set(key, value); 6989 } 6990 return dict; 6991 } 6992 delete(key) { 6993 this.#map.delete(key); 6994 } 6995} 6996class Ref { 6997 constructor(num, gen) { 6998 this.num = num; 6999 this.gen = gen; 7000 } 7001 toString() { 7002 if (this.gen === 0) { 7003 return `${this.num}R`; 7004 } 7005 return `${this.num}R${this.gen}`; 7006 } 7007 static fromString(str) { 7008 const ref = RefCache[str]; 7009 if (ref) { 7010 return ref; 7011 } 7012 const m = /^(\d+)R(\d*)$/.exec(str); 7013 if (!m || m[1] === "0") { 7014 return null; 7015 } 7016 return RefCache[str] = new Ref(parseInt(m[1], 10), !m[2] ? 0 : parseInt(m[2], 10)); 7017 } 7018 static get(num, gen) {
vendor: 4,611 bytes, lines 7019-7239
7019 const key = gen === 0 ? `${num}R` : `${num}R${gen}`; 7020 return RefCache[key] ||= new Ref(num, gen); 7021 } 7022} 7023class RefSet { 7024 constructor(parent = null) { 7025 this._set = new Set(parent?._set); 7026 } 7027 has(ref) { 7028 return this._set.has(ref.toString()); 7029 } 7030 put(ref) { 7031 this._set.add(ref.toString()); 7032 } 7033 remove(ref) { 7034 this._set.delete(ref.toString()); 7035 } 7036 [Symbol.iterator]() { 7037 return this._set.values(); 7038 } 7039 clear() { 7040 this._set.clear(); 7041 } 7042} 7043class RefSetCache { 7044 _map = new Map(); 7045 get size() { 7046 return this._map.size; 7047 } 7048 get(ref) { 7049 return this._map.get(ref.toString()); 7050 } 7051 has(ref) { 7052 return this._map.has(ref.toString()); 7053 } 7054 put(ref, obj) { 7055 this._map.set(ref.toString(), obj); 7056 } 7057 putAlias(ref, aliasRef) { 7058 this._map.set(ref.toString(), this.get(aliasRef)); 7059 } 7060 [Symbol.iterator]() { 7061 return this._map.values(); 7062 } 7063 clear() { 7064 this._map.clear(); 7065 } 7066 *values() { 7067 yield* this._map.values(); 7068 } 7069 *items() { 7070 for (const [ref, value] of this._map) { 7071 yield [Ref.fromString(ref), value]; 7072 } 7073 } 7074 *keys() { 7075 for (const ref of this._map.keys()) { 7076 yield Ref.fromString(ref); 7077 } 7078 } 7079} 7080function isName(v, name) { 7081 return v instanceof Name && (name === undefined || v.name === name); 7082} 7083function isCmd(v, cmd) { 7084 return v instanceof Cmd && (cmd === undefined || v.cmd === cmd); 7085} 7086function isDict(v, type) { 7087 return v instanceof Dict && (type === undefined || isName(v.get("Type"), type)); 7088} 7089function isRefsEqual(v1, v2) { 7090 return v1.num === v2.num && v1.gen === v2.gen; 7091} 7092 7093;// ./src/core/base_stream.js 7094 7095class BaseStream { 7096 get length() { 7097 unreachable("Abstract getter `length` accessed"); 7098 } 7099 get isEmpty() { 7100 unreachable("Abstract getter `isEmpty` accessed"); 7101 } 7102 get isDataLoaded() { 7103 return shadow(this, "isDataLoaded", true); 7104 } 7105 getByte() { 7106 unreachable("Abstract method `getByte` called"); 7107 } 7108 getBytes(length) { 7109 unreachable("Abstract method `getBytes` called"); 7110 } 7111 async getImageData(length, decoderOptions) { 7112 return this.getBytes(length, decoderOptions); 7113 } 7114 async asyncGetBytes() { 7115 unreachable("Abstract method `asyncGetBytes` called"); 7116 } 7117 get isAsync() { 7118 return false; 7119 } 7120 get isAsyncDecoder() { 7121 return false; 7122 } 7123 get isImageStream() { 7124 return false; 7125 } 7126 get canAsyncDecodeImageFromBuffer() { 7127 return false; 7128 } 7129 async getTransferableImage() { 7130 return null; 7131 } 7132 peekByte() { 7133 const peekedByte = this.getByte(); 7134 if (peekedByte !== -1) { 7135 this.pos--; 7136 } 7137 return peekedByte; 7138 } 7139 peekBytes(length) { 7140 const bytes = this.getBytes(length); 7141 this.pos -= bytes.length; 7142 return bytes; 7143 } 7144 getUint16() { 7145 const b0 = this.getByte(); 7146 const b1 = this.getByte(); 7147 if (b0 === -1 || b1 === -1) { 7148 return -1; 7149 } 7150 return (b0 << 8) + b1; 7151 } 7152 getInt32() { 7153 const b0 = this.getByte(); 7154 const b1 = this.getByte(); 7155 const b2 = this.getByte(); 7156 const b3 = this.getByte(); 7157 return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3; 7158 } 7159 getByteRange(begin, end) { 7160 unreachable("Abstract method `getByteRange` called"); 7161 } 7162 getString(length) { 7163 return bytesToString(this.getBytes(length)); 7164 } 7165 skip(n) { 7166 this.pos += n || 1; 7167 } 7168 reset() { 7169 unreachable("Abstract method `reset` called"); 7170 } 7171 moveStart() { 7172 unreachable("Abstract method `moveStart` called"); 7173 } 7174 makeSubStream(start, length, dict = null) { 7175 unreachable("Abstract method `makeSubStream` called"); 7176 } 7177 getBaseStreams() { 7178 return null; 7179 } 7180 getOriginalStream() { 7181 return this.stream?.getOriginalStream() || this; 7182 } 7183} 7184 7185;// ./src/core/core_utils.js 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210const PDF_VERSION_REGEXP = /^[1-9]\.\d$/; 7211const MAX_INT_32 = 2 ** 31 - 1; 7212const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0]; 7213const RESOURCES_KEYS_OPERATOR_LIST = ["ColorSpace", "ExtGState", "Font", "Pattern", "Properties", "Shading", "XObject"]; 7214const RESOURCES_KEYS_TEXT_CONTENT = ["ExtGState", "Font", "Properties", "XObject"]; 7215function getLookupTableFactory(initializer) { 7216 let lookup; 7217 return function () { 7218 if (initializer) { 7219 lookup = Object.create(null); 7220 initializer(lookup); 7221 initializer = null; 7222 } 7223 return lookup; 7224 }; 7225} 7226class MissingDataException extends BaseException { 7227 constructor(begin, end) { 7228 super(`Missing data [${begin}, ${end})`, "MissingDataException"); 7229 this.begin = begin; 7230 this.end = end; 7231 } 7232} 7233class ParserEOFException extends BaseException { 7234 constructor(msg) { 7235 super(msg, "ParserEOFException"); 7236 } 7237} 7238class XRefEntryException extends BaseException { 7239 constructor(msg) {
vendor: 8,727 bytes, lines 7240-7558
7240 super(msg, "XRefEntryException"); 7241 } 7242} 7243class XRefParseException extends BaseException { 7244 constructor(msg) { 7245 super(msg, "XRefParseException"); 7246 } 7247} 7248function arrayBuffersToBytes(arr) { 7249 const length = arr.length; 7250 if (length === 0) { 7251 return new Uint8Array(0); 7252 } 7253 if (length === 1) { 7254 return new Uint8Array(arr[0]); 7255 } 7256 let dataLength = 0; 7257 for (let i = 0; i < length; i++) { 7258 dataLength += arr[i].byteLength; 7259 } 7260 const data = new Uint8Array(dataLength); 7261 let pos = 0; 7262 for (let i = 0; i < length; i++) { 7263 const item = new Uint8Array(arr[i]); 7264 data.set(item, pos); 7265 pos += item.byteLength; 7266 } 7267 return data; 7268} 7269async function fetchBinaryData(url) { 7270 const response = await fetch(url); 7271 if (!response.ok) { 7272 throw new Error(`Failed to fetch file "${url}" with "${response.statusText}".`); 7273 } 7274 return response.bytes(); 7275} 7276function getInheritableProperty({ 7277 dict, 7278 key, 7279 getArray = false, 7280 stopWhenFound = true 7281}) { 7282 let values; 7283 const visited = new RefSet(); 7284 while (dict instanceof Dict && !(dict.objId && visited.has(dict.objId))) { 7285 if (dict.objId) { 7286 visited.put(dict.objId); 7287 } 7288 const value = getArray ? dict.getArray(key) : dict.get(key); 7289 if (value !== undefined) { 7290 if (stopWhenFound) { 7291 return value; 7292 } 7293 (values ||= []).push(value); 7294 } 7295 dict = dict.get("Parent"); 7296 } 7297 return values; 7298} 7299function getParentToUpdate(dict, ref, xref) { 7300 const visited = new RefSet(); 7301 const firstDict = dict; 7302 const result = { 7303 dict: null, 7304 ref: null 7305 }; 7306 while (dict instanceof Dict && !visited.has(ref)) { 7307 visited.put(ref); 7308 if (dict.has("T")) { 7309 break; 7310 } 7311 ref = dict.getRaw("Parent"); 7312 if (!(ref instanceof Ref)) { 7313 return result; 7314 } 7315 dict = xref.fetch(ref); 7316 } 7317 if (dict instanceof Dict && dict !== firstDict) { 7318 result.dict = dict; 7319 result.ref = ref; 7320 } 7321 return result; 7322} 7323function deepCompare(a, b) { 7324 if (a === b) { 7325 return true; 7326 } 7327 if (a instanceof Dict && b instanceof Dict) { 7328 if (a.size !== b.size) { 7329 return false; 7330 } 7331 for (const [key, value1] of a.getRawEntries()) { 7332 const value2 = b.getRaw(key); 7333 if (value2 === undefined || !deepCompare(value1, value2)) { 7334 return false; 7335 } 7336 } 7337 return true; 7338 } 7339 if (Array.isArray(a) && Array.isArray(b)) { 7340 if (a.length !== b.length) { 7341 return false; 7342 } 7343 for (let i = 0, ii = a.length; i < ii; i++) { 7344 if (!deepCompare(a[i], b[i])) { 7345 return false; 7346 } 7347 } 7348 return true; 7349 } 7350 return false; 7351} 7352const ROMAN_NUMBER_MAP = ["", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM", "", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC", "", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"]; 7353function toRomanNumerals(number, lowerCase = false) { 7354 assert(Number.isInteger(number) && number > 0, "The number should be a positive integer."); 7355 const roman = "M".repeat(number / 1000 | 0) + ROMAN_NUMBER_MAP[number % 1000 / 100 | 0] + ROMAN_NUMBER_MAP[10 + (number % 100 / 10 | 0)] + ROMAN_NUMBER_MAP[20 + number % 10]; 7356 return lowerCase ? roman.toLowerCase() : roman; 7357} 7358function isWhiteSpace(ch) { 7359 return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a; 7360} 7361function isBooleanArray(arr, len) { 7362 return Array.isArray(arr) && (len === null || arr.length === len) && arr.every(x => typeof x === "boolean"); 7363} 7364function isNumberArray(arr, len) { 7365 if (Array.isArray(arr)) { 7366 return (len === null || arr.length === len) && arr.every(x => typeof x === "number"); 7367 } 7368 return ArrayBuffer.isView(arr) && !(arr instanceof BigInt64Array || arr instanceof BigUint64Array) && (len === null || arr.length === len); 7369} 7370function lookupMatrix(arr, fallback) { 7371 return isNumberArray(arr, 6) ? arr : fallback; 7372} 7373function lookupRect(arr, fallback) { 7374 return isNumberArray(arr, 4) ? arr : fallback; 7375} 7376function lookupNormalRect(arr, fallback) { 7377 return isNumberArray(arr, 4) ? Util.normalizeRect(arr) : fallback; 7378} 7379function parseXFAPath(path) { 7380 const positionPattern = /(.+)\[(\d+)\]$/; 7381 return path.split(".").map(component => { 7382 const m = component.match(positionPattern); 7383 if (m) { 7384 return { 7385 name: m[1], 7386 pos: parseInt(m[2], 10) 7387 }; 7388 } 7389 return { 7390 name: component, 7391 pos: 0 7392 }; 7393 }); 7394} 7395function escapePDFName(str) { 7396 const buffer = []; 7397 let start = 0; 7398 for (let i = 0, ii = str.length; i < ii; i++) { 7399 const char = str.charCodeAt(i); 7400 if (char < 0x21 || char > 0x7e || char === 0x23 || char === 0x28 || char === 0x29 || char === 0x3c || char === 0x3e || char === 0x5b || char === 0x5d || char === 0x7b || char === 0x7d || char === 0x2f || char === 0x25) { 7401 if (start < i) { 7402 buffer.push(str.substring(start, i)); 7403 } 7404 buffer.push(`#${char.toString(16)}`); 7405 start = i + 1; 7406 } 7407 } 7408 if (buffer.length === 0) { 7409 return str; 7410 } 7411 if (start < str.length) { 7412 buffer.push(str.substring(start, str.length)); 7413 } 7414 return buffer.join(""); 7415} 7416function escapeString(str) { 7417 return str.replaceAll(/([()\\\n\r])/g, match => { 7418 if (match === "\n") { 7419 return "\\n"; 7420 } else if (match === "\r") { 7421 return "\\r"; 7422 } 7423 return `\\${match}`; 7424 }); 7425} 7426function _collectJS(entry, xref, list, parents) { 7427 if (!entry) { 7428 return; 7429 } 7430 let parent = null; 7431 if (entry instanceof Ref) { 7432 if (parents.has(entry)) { 7433 return; 7434 } 7435 parent = entry; 7436 parents.put(parent); 7437 entry = xref.fetch(entry); 7438 } 7439 if (Array.isArray(entry)) { 7440 for (const element of entry) { 7441 _collectJS(element, xref, list, parents); 7442 } 7443 } else if (entry instanceof Dict) { 7444 if (isName(entry.get("S"), "JavaScript")) { 7445 const js = entry.get("JS"); 7446 let code; 7447 if (js instanceof BaseStream) { 7448 code = js.getString(); 7449 } else if (typeof js === "string") { 7450 code = js; 7451 } 7452 code &&= stringToPDFString(code, true).replaceAll("\x00", ""); 7453 if (code) { 7454 list.push(code.trim()); 7455 } 7456 } 7457 _collectJS(entry.getRaw("Next"), xref, list, parents); 7458 } 7459 if (parent) { 7460 parents.remove(parent); 7461 } 7462} 7463function collectActions(xref, dict, eventType) { 7464 const actions = Object.create(null); 7465 const additionalActionsDicts = getInheritableProperty({ 7466 dict, 7467 key: "AA", 7468 stopWhenFound: false 7469 }); 7470 if (additionalActionsDicts) { 7471 for (let i = additionalActionsDicts.length - 1; i >= 0; i--) { 7472 const additionalActions = additionalActionsDicts[i]; 7473 if (!(additionalActions instanceof Dict)) { 7474 continue; 7475 } 7476 for (const [key, rawActionDict] of additionalActions.getRawEntries()) { 7477 const action = eventType[key]; 7478 if (!action) { 7479 continue; 7480 } 7481 const parents = new RefSet(); 7482 const list = []; 7483 _collectJS(rawActionDict, xref, list, parents); 7484 if (list.length > 0) { 7485 actions[action] = list; 7486 } 7487 } 7488 } 7489 } 7490 if (dict.has("A")) { 7491 const actionDict = dict.get("A"); 7492 const parents = new RefSet(); 7493 const list = []; 7494 _collectJS(actionDict, xref, list, parents); 7495 if (list.length > 0) { 7496 actions.Action = list; 7497 } 7498 } 7499 return objectSize(actions) > 0 ? actions : null; 7500} 7501const XMLEntities = { 7502 0x3c: "<", 7503 0x3e: ">", 7504 0x26: "&", 7505 0x22: """, 7506 0x27: "'" 7507}; 7508function* codePointIter(str) { 7509 for (let i = 0, ii = str.length; i < ii; i++) { 7510 const char = str.codePointAt(i); 7511 if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) { 7512 i++; 7513 } 7514 yield char; 7515 } 7516} 7517function encodeToXmlString(str) { 7518 const buffer = []; 7519 let start = 0; 7520 for (let i = 0, ii = str.length; i < ii; i++) { 7521 const char = str.codePointAt(i); 7522 if (0x20 <= char && char <= 0x7e) { 7523 const entity = XMLEntities[char]; 7524 if (entity) { 7525 if (start < i) { 7526 buffer.push(str.substring(start, i)); 7527 } 7528 buffer.push(entity); 7529 start = i + 1; 7530 } 7531 } else { 7532 if (start < i) { 7533 buffer.push(str.substring(start, i)); 7534 } 7535 buffer.push(`&#x${char.toString(16).toUpperCase()};`); 7536 if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) { 7537 i++; 7538 } 7539 start = i + 1; 7540 } 7541 } 7542 if (buffer.length === 0) { 7543 return str; 7544 } 7545 if (start < str.length) { 7546 buffer.push(str.substring(start, str.length)); 7547 } 7548 return buffer.join(""); 7549} 7550function validateFontName(fontFamily, mustWarn = false) { 7551 const m = /^("|').*("|')$/.exec(fontFamily); 7552 if (m && m[1] === m[2]) { 7553 const re = new RegExp(`[^\\\\]${m[1]}`); 7554 if (re.test(fontFamily.slice(1, -1))) { 7555 if (mustWarn) { 7556 warn(`FontFamily contains unescaped ${m[1]}: ${fontFamily}.`); 7557 } 7558 return false;
vendor: 4,105 bytes, lines 7559-7694
7559 } 7560 } else { 7561 for (const ident of fontFamily.split(/[ \t]+/)) { 7562 if (/^(\d|(-(\d|-)))/.test(ident) || !/^[\w-\\]+$/.test(ident)) { 7563 if (mustWarn) { 7564 warn(`FontFamily contains invalid <custom-ident>: ${fontFamily}.`); 7565 } 7566 return false; 7567 } 7568 } 7569 } 7570 return true; 7571} 7572function validateCSSFont(cssFontInfo) { 7573 const DEFAULT_CSS_FONT_OBLIQUE = "14"; 7574 const DEFAULT_CSS_FONT_WEIGHT = "400"; 7575 const CSS_FONT_WEIGHT_VALUES = new Set(["100", "200", "300", "400", "500", "600", "700", "800", "900", "1000", "normal", "bold", "bolder", "lighter"]); 7576 const { 7577 fontFamily, 7578 fontWeight, 7579 italicAngle 7580 } = cssFontInfo; 7581 if (!validateFontName(fontFamily, true)) { 7582 return false; 7583 } 7584 const weight = fontWeight ? fontWeight.toString() : ""; 7585 cssFontInfo.fontWeight = CSS_FONT_WEIGHT_VALUES.has(weight) ? weight : DEFAULT_CSS_FONT_WEIGHT; 7586 const angle = parseFloat(italicAngle); 7587 cssFontInfo.italicAngle = isNaN(angle) || angle < -90 || angle > 90 ? DEFAULT_CSS_FONT_OBLIQUE : italicAngle.toString(); 7588 return true; 7589} 7590function recoverJsURL(str) { 7591 const URL_OPEN_METHODS = ["app.launchURL", "window.open", "xfa.host.gotoURL"]; 7592 const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").replaceAll(".", "\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i"); 7593 const jsUrl = regex.exec(str); 7594 if (jsUrl?.[2]) { 7595 return { 7596 url: jsUrl[2], 7597 newWindow: jsUrl[1] === "app.launchURL" && jsUrl[3] === "true" 7598 }; 7599 } 7600 return null; 7601} 7602function numberToString(value) { 7603 if (Number.isInteger(value)) { 7604 return value.toString(); 7605 } 7606 const roundedValue = Math.round(value * 100); 7607 if (roundedValue % 100 === 0) { 7608 return (roundedValue / 100).toString(); 7609 } 7610 if (roundedValue % 10 === 0) { 7611 return value.toFixed(1); 7612 } 7613 return value.toFixed(2); 7614} 7615function getNewAnnotationsMap(annotationStorage) { 7616 if (!annotationStorage) { 7617 return null; 7618 } 7619 const newAnnotationsByPage = new Map(); 7620 for (const [key, value] of annotationStorage) { 7621 if (!key.startsWith(AnnotationEditorPrefix)) { 7622 continue; 7623 } 7624 newAnnotationsByPage.getOrInsertComputed(value.pageIndex, makeArr).push(value); 7625 } 7626 return newAnnotationsByPage.size > 0 ? newAnnotationsByPage : null; 7627} 7628function stringToAsciiOrUTF16BE(str) { 7629 if (str === null || str === undefined) { 7630 return str; 7631 } 7632 return isAscii(str) ? str : stringToUTF16String(str, true); 7633} 7634function isAscii(str) { 7635 if (typeof str !== "string") { 7636 return false; 7637 } 7638 return !str || /^[\x00-\x7F]*$/.test(str); 7639} 7640function stringToUTF16HexString(str) { 7641 const buf = []; 7642 for (let i = 0, ii = str.length; i < ii; i++) { 7643 const char = str.charCodeAt(i); 7644 buf.push(Util.hexNums[char >> 8 & 0xff], Util.hexNums[char & 0xff]); 7645 } 7646 return buf.join(""); 7647} 7648function stringToUTF16String(str, bigEndian = false) { 7649 const buf = []; 7650 if (bigEndian) { 7651 buf.push("\xFE\xFF"); 7652 } 7653 for (let i = 0, ii = str.length; i < ii; i++) { 7654 const char = str.charCodeAt(i); 7655 buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff)); 7656 } 7657 return buf.join(""); 7658} 7659function getRotationMatrix(rotation, width, height) { 7660 switch (rotation) { 7661 case 90: 7662 return [0, 1, -1, 0, width, 0]; 7663 case 180: 7664 return [-1, 0, 0, -1, width, height]; 7665 case 270: 7666 return [0, -1, 1, 0, 0, height]; 7667 default: 7668 throw new Error("Invalid rotation"); 7669 } 7670} 7671function getSizeInBytes(x) { 7672 return Math.ceil(Math.ceil(Math.log2(1 + x)) / 8); 7673} 7674 7675// EXTERNAL MODULE: ./node_modules/core-js/modules/web.url-search-params.delete.js 7676var web_url_search_params_delete = __webpack_require__(4603); 7677// EXTERNAL MODULE: ./node_modules/core-js/modules/web.url-search-params.has.js 7678var web_url_search_params_has = __webpack_require__(7566); 7679// EXTERNAL MODULE: ./node_modules/core-js/modules/web.url-search-params.size.js 7680var web_url_search_params_size = __webpack_require__(8721); 7681;// ./external/qcms/qcms_utils.js 7682 7683 7684 7685 7686 7687 7688 7689 7690class QCMS { 7691 static #memoryArray = null; 7692 static _memory = null; 7693 static _mustAddAlpha = false; 7694 static _destBuffer = null;
7695 static _destOffset = 0; 7696 static _destLength = 0; 7697 static _cssColor = ""; 7698 static _makeHexColor = null; 7699 static get _memoryArray() { 7700 const array = this.#memoryArray; 7701 if (array?.byteLength) { 7702 return array; 7703 } 7704 return this.#memoryArray = new Uint8Array(this._memory.buffer); 7705 } 7706} 7707function copy_result(ptr, len) { 7708 const { 7709 _mustAddAlpha, 7710 _destBuffer, 7711 _destOffset, 7712 _destLength, 7713 _memoryArray 7714 } = QCMS; 7715 if (len === _destLength) { 7716 _destBuffer.set(_memoryArray.subarray(ptr, ptr + len), _destOffset); 7717 return; 7718 } 7719 if (_mustAddAlpha) { 7720 for (let i = ptr, ii = ptr + len, j = _destOffset; i < ii; i += 3, j += 4) { 7721 _destBuffer[j] = _memoryArray[i]; 7722 _destBuffer[j + 1] = _memoryArray[i + 1]; 7723 _destBuffer[j + 2] = _memoryArray[i + 2]; 7724 _destBuffer[j + 3] = 255; 7725 } 7726 } else { 7727 for (let i = ptr, ii = ptr + len, j = _destOffset; i < ii; i += 3, j += 4) { 7728 _destBuffer[j] = _memoryArray[i]; 7729 _destBuffer[j + 1] = _memoryArray[i + 1]; 7730 _destBuffer[j + 2] = _memoryArray[i + 2]; 7731 } 7732 } 7733} 7734function copy_rgb(ptr) { 7735 const { 7736 _destBuffer, 7737 _destOffset, 7738 _memoryArray 7739 } = QCMS; 7740 _destBuffer[_destOffset] = _memoryArray[ptr]; 7741 _destBuffer[_destOffset + 1] = _memoryArray[ptr + 1]; 7742 _destBuffer[_destOffset + 2] = _memoryArray[ptr + 2]; 7743} 7744function make_cssRGB(ptr) { 7745 const { 7746 _memoryArray 7747 } = QCMS; 7748 QCMS._cssColor = QCMS._makeHexColor(_memoryArray[ptr], _memoryArray[ptr + 1], _memoryArray[ptr + 2]); 7749} 7750 7751;// ./external/qcms/qcms.js 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764const DataType = Object.freeze({ 7765 RGB8: 0, 7766 "0": "RGB8", 7767 RGBA8: 1, 7768 "1": "RGBA8", 7769 BGRA8: 2, 7770 "2": "BGRA8", 7771 Gray8: 3, 7772 "3": "Gray8", 7773 GrayA8: 4, 7774 "4": "GrayA8", 7775 CMYK: 5, 7776 "5": "CMYK" 7777}); 7778const Intent = Object.freeze({ 7779 Perceptual: 0, 7780 "0": "Perceptual", 7781 RelativeColorimetric: 1, 7782 "1": "RelativeColorimetric", 7783 Saturation: 2, 7784 "2": "Saturation", 7785 AbsoluteColorimetric: 3, 7786 "3": "AbsoluteColorimetric" 7787}); 7788function qcms_convert_array(transformer, src) { 7789 const ptr0 = passArray8ToWasm0(src, wasm.__wbindgen_malloc); 7790 const len0 = WASM_VECTOR_LEN; 7791 wasm.qcms_convert_array(transformer, ptr0, len0); 7792} 7793function qcms_convert_four(transformer, src1, src2, src3, src4, css) { 7794 wasm.qcms_convert_four(transformer, src1, src2, src3, src4, css); 7795} 7796function qcms_convert_one(transformer, src, css) { 7797 wasm.qcms_convert_one(transformer, src, css); 7798} 7799function qcms_convert_three(transformer, src1, src2, src3, css) { 7800 wasm.qcms_convert_three(transformer, src1, src2, src3, css); 7801} 7802function qcms_drop_transformer(transformer) { 7803 wasm.qcms_drop_transformer(transformer); 7804} 7805function qcms_transformer_from_memory(mem, in_type, intent) { 7806 const ptr0 = passArray8ToWasm0(mem, wasm.__wbindgen_malloc); 7807 const len0 = WASM_VECTOR_LEN; 7808 const ret = wasm.qcms_transformer_from_memory(ptr0, len0, in_type, intent); 7809 return ret >>> 0; 7810} 7811function __wbg_get_imports() { 7812 const import0 = { 7813 __proto__: null, 7814 __wbg___wbindgen_throw_6b64449b9b9ed33c: function (arg0, arg1) { 7815 throw new Error(getStringFromWasm0(arg0, arg1)); 7816 }, 7817 __wbg_copy_result_0d15f3bf9d9012ae: function (arg0, arg1) { 7818 copy_result(arg0 >>> 0, arg1 >>> 0); 7819 }, 7820 __wbg_copy_rgb_0106d9d9464fce43: function (arg0) { 7821 copy_rgb(arg0 >>> 0); 7822 }, 7823 __wbg_make_cssRGB_8e24b34f71f5363e: function (arg0) { 7824 make_cssRGB(arg0 >>> 0); 7825 }, 7826 __wbindgen_init_externref_table: function () { 7827 const table = wasm.__wbindgen_externrefs; 7828 const offset = table.grow(4); 7829 table.set(0, undefined); 7830 table.set(offset + 0, undefined); 7831 table.set(offset + 1, null); 7832 table.set(offset + 2, true); 7833 table.set(offset + 3, false); 7834 } 7835 }; 7836 return { 7837 __proto__: null, 7838 "./qcms_bg.js": import0 7839 }; 7840} 7841function getStringFromWasm0(ptr, len) { 7842 ptr = ptr >>> 0; 7843 return decodeText(ptr, len); 7844} 7845let cachedUint8ArrayMemory0 = null; 7846function getUint8ArrayMemory0() { 7847 if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { 7848 cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); 7849 } 7850 return cachedUint8ArrayMemory0; 7851} 7852function passArray8ToWasm0(arg, malloc) { 7853 const ptr = malloc(arg.length * 1, 1) >>> 0; 7854 getUint8ArrayMemory0().set(arg, ptr / 1); 7855 WASM_VECTOR_LEN = arg.length; 7856 return ptr; 7857} 7858let cachedTextDecoder = new TextDecoder('utf-8', { 7859 ignoreBOM: true, 7860 fatal: true 7861}); 7862cachedTextDecoder.decode(); 7863const MAX_SAFARI_DECODE_BYTES = 2146435072; 7864let numBytesDecoded = 0; 7865function decodeText(ptr, len) { 7866 numBytesDecoded += len; 7867 if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) { 7868 cachedTextDecoder = new TextDecoder('utf-8', { 7869 ignoreBOM: true, 7870 fatal: true 7871 }); 7872 cachedTextDecoder.decode(); 7873 numBytesDecoded = len; 7874 } 7875 return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); 7876} 7877let WASM_VECTOR_LEN = 0; 7878let wasmModule, wasm; 7879function __wbg_finalize_init(instance, module) { 7880 wasm = instance.exports; 7881 wasmModule = module; 7882 cachedUint8ArrayMemory0 = null; 7883 wasm.__wbindgen_start(); 7884 return wasm; 7885} 7886async function __wbg_load(module, imports) { 7887 if (typeof Response === 'function' && module instanceof Response) { 7888 if (typeof WebAssembly.instantiateStreaming === 'function') {
vendor: 9,579 bytes, lines 7889-8186
7889 try { 7890 return await WebAssembly.instantiateStreaming(module, imports); 7891 } catch (e) { 7892 const validResponse = module.ok && expectedResponseType(module.type); 7893 if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') { 7894 console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); 7895 } else { 7896 throw e; 7897 } 7898 } 7899 } 7900 const bytes = await module.arrayBuffer(); 7901 return await WebAssembly.instantiate(bytes, imports); 7902 } else { 7903 const instance = await WebAssembly.instantiate(module, imports); 7904 if (instance instanceof WebAssembly.Instance) { 7905 return { 7906 instance, 7907 module 7908 }; 7909 } else { 7910 return instance; 7911 } 7912 } 7913 function expectedResponseType(type) { 7914 switch (type) { 7915 case 'basic': 7916 case 'cors': 7917 case 'default': 7918 return true; 7919 } 7920 return false; 7921 } 7922} 7923function initSync(module) { 7924 if (wasm !== undefined) return wasm; 7925 if (module !== undefined) { 7926 if (Object.getPrototypeOf(module) === Object.prototype) { 7927 ({ 7928 module 7929 } = module); 7930 } else { 7931 console.warn('using deprecated parameters for `initSync()`; pass a single object instead'); 7932 } 7933 } 7934 const imports = __wbg_get_imports(); 7935 if (!(module instanceof WebAssembly.Module)) { 7936 module = new WebAssembly.Module(module); 7937 } 7938 const instance = new WebAssembly.Instance(module, imports); 7939 return __wbg_finalize_init(instance, module); 7940} 7941async function __wbg_init(module_or_path) { 7942 if (wasm !== undefined) return wasm; 7943 if (module_or_path !== undefined) { 7944 if (Object.getPrototypeOf(module_or_path) === Object.prototype) { 7945 ({ 7946 module_or_path 7947 } = module_or_path); 7948 } else { 7949 console.warn('using deprecated parameters for the initialization function; pass a single object instead'); 7950 } 7951 } 7952 const imports = __wbg_get_imports(); 7953 if (typeof module_or_path === 'string' || typeof Request === 'function' && module_or_path instanceof Request || typeof URL === 'function' && module_or_path instanceof URL) { 7954 module_or_path = fetch(module_or_path); 7955 } 7956 const { 7957 instance, 7958 module 7959 } = await __wbg_load(await module_or_path, imports); 7960 return __wbg_finalize_init(instance, module); 7961} 7962 7963;// ./src/shared/math_clamp.js 7964function MathClamp(v, min, max) { 7965 return Math.min(Math.max(v, min), max); 7966} 7967 7968;// ./src/core/colorspace.js 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) { 7981 const COMPONENTS = 3; 7982 alpha01 = alpha01 !== 1 ? 0 : alpha01; 7983 const xRatio = w1 / w2; 7984 const yRatio = h1 / h2; 7985 let newIndex = 0, 7986 oldIndex; 7987 const xScaled = new Uint16Array(w2); 7988 const w1Scanline = w1 * COMPONENTS; 7989 for (let i = 0; i < w2; i++) { 7990 xScaled[i] = Math.floor(i * xRatio) * COMPONENTS; 7991 } 7992 for (let i = 0; i < h2; i++) { 7993 const py = Math.floor(i * yRatio) * w1Scanline; 7994 for (let j = 0; j < w2; j++) { 7995 oldIndex = py + xScaled[j]; 7996 dest[newIndex++] = src[oldIndex++]; 7997 dest[newIndex++] = src[oldIndex++]; 7998 dest[newIndex++] = src[oldIndex++]; 7999 newIndex += alpha01; 8000 } 8001 } 8002} 8003function resizeRgbaImage(src, dest, w1, h1, w2, h2, alpha01) { 8004 const xRatio = w1 / w2; 8005 const yRatio = h1 / h2; 8006 let newIndex = 0; 8007 const xScaled = new Uint16Array(w2); 8008 if (alpha01 === 1) { 8009 for (let i = 0; i < w2; i++) { 8010 xScaled[i] = Math.floor(i * xRatio); 8011 } 8012 const src32 = new Uint32Array(src.buffer); 8013 const dest32 = new Uint32Array(dest.buffer); 8014 const rgbMask = FeatureTest.isLittleEndian ? 0x00ffffff : 0xffffff00; 8015 for (let i = 0; i < h2; i++) { 8016 const buf = src32.subarray(Math.floor(i * yRatio) * w1); 8017 for (let j = 0; j < w2; j++) { 8018 dest32[newIndex++] |= buf[xScaled[j]] & rgbMask; 8019 } 8020 } 8021 } else { 8022 const COMPONENTS = 4; 8023 const w1Scanline = w1 * COMPONENTS; 8024 for (let i = 0; i < w2; i++) { 8025 xScaled[i] = Math.floor(i * xRatio) * COMPONENTS; 8026 } 8027 for (let i = 0; i < h2; i++) { 8028 const buf = src.subarray(Math.floor(i * yRatio) * w1Scanline); 8029 for (let j = 0; j < w2; j++) { 8030 const oldIndex = xScaled[j]; 8031 dest[newIndex++] = buf[oldIndex]; 8032 dest[newIndex++] = buf[oldIndex + 1]; 8033 dest[newIndex++] = buf[oldIndex + 2]; 8034 } 8035 } 8036 } 8037} 8038function copyRgbaImage(src, dest, alpha01) { 8039 if (alpha01 === 1) { 8040 const src32 = new Uint32Array(src.buffer); 8041 const dest32 = new Uint32Array(dest.buffer); 8042 const rgbMask = FeatureTest.isLittleEndian ? 0x00ffffff : 0xffffff00; 8043 for (let i = 0, ii = src32.length; i < ii; i++) { 8044 dest32[i] |= src32[i] & rgbMask; 8045 } 8046 } else { 8047 let j = 0; 8048 for (let i = 0, ii = src.length; i < ii; i += 4) { 8049 dest[j++] = src[i]; 8050 dest[j++] = src[i + 1]; 8051 dest[j++] = src[i + 2]; 8052 } 8053 } 8054} 8055function isDefaultDecodeHelper(decode, expectedLen) { 8056 if (!Array.isArray(decode)) { 8057 return true; 8058 } 8059 const decodeLen = decode.length; 8060 if (decodeLen < expectedLen) { 8061 warn("Decode map length is too short."); 8062 return true; 8063 } 8064 if (decodeLen > expectedLen) { 8065 info("Truncating too long decode map."); 8066 decode.length = expectedLen; 8067 } 8068 return false; 8069} 8070class ColorSpace { 8071 static #rgbBuf = new Uint8ClampedArray(3); 8072 constructor(name, numComps) { 8073 this.name = name; 8074 this.numComps = numComps; 8075 } 8076 getRgb(src, srcOffset, output = new Uint8ClampedArray(3)) { 8077 this.getRgbItem(src, srcOffset, output, 0); 8078 return output; 8079 } 8080 getRgbHex(src, srcOffset) { 8081 const buffer = this.getRgb(src, srcOffset, ColorSpace.#rgbBuf); 8082 return Util.makeHexColor(buffer[0], buffer[1], buffer[2]); 8083 } 8084 getRgbItem(src, srcOffset, dest, destOffset) { 8085 unreachable("Should not call ColorSpace.getRgbItem"); 8086 } 8087 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 8088 unreachable("Should not call ColorSpace.getRgbBuffer"); 8089 } 8090 getOutputLength(inputLength, alpha01) { 8091 unreachable("Should not call ColorSpace.getOutputLength"); 8092 } 8093 isPassthrough(bits) { 8094 return false; 8095 } 8096 isDefaultDecode(decode, bpc) { 8097 return ColorSpace.isDefaultDecode(decode, this.numComps); 8098 } 8099 fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) { 8100 const count = originalWidth * originalHeight; 8101 let rgbBuf = null; 8102 const numComponentColors = 1 << bpc; 8103 const needsResizing = originalHeight !== height || originalWidth !== width; 8104 if (this.isPassthrough(bpc)) { 8105 rgbBuf = comps; 8106 } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") { 8107 const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors); 8108 for (let i = 0; i < numComponentColors; i++) { 8109 allColors[i] = i; 8110 } 8111 const colorMap = new Uint8ClampedArray(numComponentColors * 3); 8112 this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0); 8113 if (!needsResizing) { 8114 let destPos = 0; 8115 for (let i = 0; i < count; ++i) { 8116 const key = comps[i] * 3; 8117 dest[destPos++] = colorMap[key]; 8118 dest[destPos++] = colorMap[key + 1]; 8119 dest[destPos++] = colorMap[key + 2]; 8120 destPos += alpha01; 8121 } 8122 } else { 8123 rgbBuf = new Uint8Array(count * 3); 8124 let rgbPos = 0; 8125 for (let i = 0; i < count; ++i) { 8126 const key = comps[i] * 3; 8127 rgbBuf[rgbPos++] = colorMap[key]; 8128 rgbBuf[rgbPos++] = colorMap[key + 1]; 8129 rgbBuf[rgbPos++] = colorMap[key + 2]; 8130 } 8131 } 8132 } else if (!needsResizing) { 8133 this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01); 8134 } else { 8135 rgbBuf = new Uint8ClampedArray(count * 3); 8136 this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0); 8137 } 8138 if (rgbBuf) { 8139 if (needsResizing) { 8140 resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01); 8141 } else { 8142 let destPos = 0, 8143 rgbPos = 0; 8144 for (let i = 0, ii = width * actualHeight; i < ii; i++) { 8145 dest[destPos++] = rgbBuf[rgbPos++]; 8146 dest[destPos++] = rgbBuf[rgbPos++]; 8147 dest[destPos++] = rgbBuf[rgbPos++]; 8148 destPos += alpha01; 8149 } 8150 } 8151 } 8152 } 8153 get usesZeroToOneRange() { 8154 return shadow(this, "usesZeroToOneRange", true); 8155 } 8156 static isDefaultDecode(decode, numComps) { 8157 if (isDefaultDecodeHelper(decode, numComps * 2)) { 8158 return true; 8159 } 8160 for (let i = 0, ii = decode.length; i < ii; i += 2) { 8161 if (decode[i] !== 0 || decode[i + 1] !== 1) { 8162 return false; 8163 } 8164 } 8165 return true; 8166 } 8167} 8168class AlternateCS extends ColorSpace { 8169 constructor(numComps, base, tintFn) { 8170 super("Alternate", numComps); 8171 this.base = base; 8172 this.tintFn = tintFn; 8173 this.tmpBuf = new Float32Array(base.numComps); 8174 } 8175 getRgbItem(src, srcOffset, dest, destOffset) { 8176 const tmpBuf = this.tmpBuf; 8177 this.tintFn(src, srcOffset, tmpBuf, 0); 8178 this.base.getRgbItem(tmpBuf, 0, dest, destOffset); 8179 } 8180 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 8181 const tintFn = this.tintFn; 8182 const base = this.base; 8183 const scale = 1 / ((1 << bits) - 1); 8184 const baseNumComps = base.numComps; 8185 const usesZeroToOneRange = base.usesZeroToOneRange; 8186 const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
vendor: 28,876 bytes, lines 8187-9075
8187 let pos = isPassthrough ? destOffset : 0; 8188 const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count); 8189 const numComps = this.numComps; 8190 const scaled = new Float32Array(numComps); 8191 const tinted = new Float32Array(baseNumComps); 8192 let i, j; 8193 for (i = 0; i < count; i++) { 8194 for (j = 0; j < numComps; j++) { 8195 scaled[j] = src[srcOffset++] * scale; 8196 } 8197 tintFn(scaled, 0, tinted, 0); 8198 if (usesZeroToOneRange) { 8199 for (j = 0; j < baseNumComps; j++) { 8200 baseBuf[pos++] = tinted[j] * 255; 8201 } 8202 } else { 8203 base.getRgbItem(tinted, 0, baseBuf, pos); 8204 pos += baseNumComps; 8205 } 8206 } 8207 if (!isPassthrough) { 8208 base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01); 8209 } 8210 } 8211 getOutputLength(inputLength, alpha01) { 8212 return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01); 8213 } 8214} 8215class PatternCS extends ColorSpace { 8216 constructor(baseCS) { 8217 super("Pattern", null); 8218 this.base = baseCS; 8219 } 8220 isDefaultDecode(decode, bpc) { 8221 unreachable("Should not call PatternCS.isDefaultDecode"); 8222 } 8223} 8224class IndexedCS extends ColorSpace { 8225 constructor(base, highVal, lookup) { 8226 super("Indexed", 1); 8227 this.base = base; 8228 this.highVal = highVal; 8229 const length = base.numComps * (highVal + 1); 8230 this.lookup = new Uint8Array(length); 8231 if (lookup instanceof BaseStream) { 8232 const bytes = lookup.getBytes(length); 8233 this.lookup.set(bytes); 8234 } else if (typeof lookup === "string") { 8235 for (let i = 0; i < length; ++i) { 8236 this.lookup[i] = lookup.charCodeAt(i) & 0xff; 8237 } 8238 } else { 8239 throw new FormatError(`IndexedCS - unrecognized lookup table: ${lookup}`); 8240 } 8241 } 8242 getRgbItem(src, srcOffset, dest, destOffset) { 8243 const { 8244 base, 8245 highVal, 8246 lookup 8247 } = this; 8248 const start = MathClamp(Math.round(src[srcOffset]), 0, highVal) * base.numComps; 8249 base.getRgbBuffer(lookup, start, 1, dest, destOffset, 8, 0); 8250 } 8251 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 8252 const { 8253 base, 8254 highVal, 8255 lookup 8256 } = this; 8257 const { 8258 numComps 8259 } = base; 8260 const outputDelta = base.getOutputLength(numComps, alpha01); 8261 for (let i = 0; i < count; ++i) { 8262 const lookupPos = MathClamp(Math.round(src[srcOffset++]), 0, highVal) * numComps; 8263 base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01); 8264 destOffset += outputDelta; 8265 } 8266 } 8267 getOutputLength(inputLength, alpha01) { 8268 return this.base.getOutputLength(inputLength * this.base.numComps, alpha01); 8269 } 8270 isDefaultDecode(decode, bpc) { 8271 if (isDefaultDecodeHelper(decode, 2)) { 8272 return true; 8273 } 8274 if (!Number.isInteger(bpc) || bpc < 1) { 8275 warn("Bits per component is not correct"); 8276 return true; 8277 } 8278 return decode[0] === 0 && decode[1] === (1 << bpc) - 1; 8279 } 8280} 8281class DeviceGrayCS extends ColorSpace { 8282 constructor() { 8283 super("DeviceGray", 1); 8284 } 8285 getRgbItem(src, srcOffset, dest, destOffset) { 8286 const c = src[srcOffset] * 255; 8287 dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c; 8288 } 8289 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 8290 const scale = 255 / ((1 << bits) - 1); 8291 let j = srcOffset, 8292 q = destOffset; 8293 for (let i = 0; i < count; ++i) { 8294 const c = scale * src[j++]; 8295 dest[q++] = c; 8296 dest[q++] = c; 8297 dest[q++] = c; 8298 q += alpha01; 8299 } 8300 } 8301 getOutputLength(inputLength, alpha01) { 8302 return inputLength * (3 + alpha01); 8303 } 8304} 8305class DeviceRgbCS extends ColorSpace { 8306 constructor() { 8307 super("DeviceRGB", 3); 8308 } 8309 getRgbItem(src, srcOffset, dest, destOffset) { 8310 dest[destOffset] = src[srcOffset] * 255; 8311 dest[destOffset + 1] = src[srcOffset + 1] * 255; 8312 dest[destOffset + 2] = src[srcOffset + 2] * 255; 8313 } 8314 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 8315 if (bits === 8 && alpha01 === 0) { 8316 dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset); 8317 return; 8318 } 8319 const scale = 255 / ((1 << bits) - 1); 8320 let j = srcOffset, 8321 q = destOffset; 8322 for (let i = 0; i < count; ++i) { 8323 dest[q++] = scale * src[j++]; 8324 dest[q++] = scale * src[j++]; 8325 dest[q++] = scale * src[j++]; 8326 q += alpha01; 8327 } 8328 } 8329 getOutputLength(inputLength, alpha01) { 8330 return inputLength * (3 + alpha01) / 3 | 0; 8331 } 8332 isPassthrough(bits) { 8333 return bits === 8; 8334 } 8335} 8336class DeviceRgbaCS extends ColorSpace { 8337 constructor() { 8338 super("DeviceRGBA", 4); 8339 } 8340 getOutputLength(inputLength, _alpha01) { 8341 return inputLength * 4; 8342 } 8343 isPassthrough(bits) { 8344 return bits === 8; 8345 } 8346 fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) { 8347 if (originalHeight !== height || originalWidth !== width) { 8348 resizeRgbaImage(comps, dest, originalWidth, originalHeight, width, height, alpha01); 8349 } else { 8350 copyRgbaImage(comps, dest, alpha01); 8351 } 8352 } 8353} 8354class DeviceCmykCS extends ColorSpace { 8355 constructor() { 8356 super("DeviceCMYK", 4); 8357 } 8358 #toRgb(src, srcOffset, srcScale, dest, destOffset) { 8359 const c = src[srcOffset] * srcScale; 8360 const m = src[srcOffset + 1] * srcScale; 8361 const y = src[srcOffset + 2] * srcScale; 8362 const k = src[srcOffset + 3] * srcScale; 8363 dest[destOffset] = 255 + c * (-4.387332384609988 * c + 54.48615194189176 * m + 18.82290502165302 * y + 212.25662451639585 * k + -285.2331026137004) + m * (1.7149763477362134 * m - 5.6096736904047315 * y + -17.873870861415444 * k - 5.497006427196366) + y * (-2.5217340131683033 * y - 21.248923337353073 * k + 17.5119270841813) + k * (-21.86122147463605 * k - 189.48180835922747); 8364 dest[destOffset + 1] = 255 + c * (8.841041422036149 * c + 60.118027045597366 * m + 6.871425592049007 * y + 31.159100130055922 * k + -79.2970844816548) + m * (-15.310361306967817 * m + 17.575251261109482 * y + 131.35250912493976 * k - 190.9453302588951) + y * (4.444339102852739 * y + 9.8632861493405 * k - 24.86741582555878) + k * (-20.737325471181034 * k - 187.80453709719578); 8365 dest[destOffset + 2] = 255 + c * (0.8842522430003296 * c + 8.078677503112928 * m + 30.89978309703729 * y - 0.23883238689178934 * k + -14.183576799673286) + m * (10.49593273432072 * m + 63.02378494754052 * y + 50.606957656360734 * k - 112.23884253719248) + y * (0.03296041114873217 * y + 115.60384449646641 * k + -193.58209356861505) + k * (-22.33816807309886 * k - 180.12613974708367); 8366 } 8367 getRgbItem(src, srcOffset, dest, destOffset) { 8368 this.#toRgb(src, srcOffset, 1, dest, destOffset); 8369 } 8370 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 8371 const scale = 1 / ((1 << bits) - 1); 8372 for (let i = 0; i < count; i++) { 8373 this.#toRgb(src, srcOffset, scale, dest, destOffset); 8374 srcOffset += 4; 8375 destOffset += 3 + alpha01; 8376 } 8377 } 8378 getOutputLength(inputLength, alpha01) { 8379 return inputLength / 4 * (3 + alpha01) | 0; 8380 } 8381} 8382class CalGrayCS extends ColorSpace { 8383 constructor(whitePoint, blackPoint, gamma) { 8384 super("CalGray", 1); 8385 if (!whitePoint) { 8386 throw new FormatError("WhitePoint missing - required for color space CalGray"); 8387 } 8388 [this.XW, this.YW, this.ZW] = whitePoint; 8389 [this.XB, this.YB, this.ZB] = blackPoint || [0, 0, 0]; 8390 this.G = gamma || 1; 8391 if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) { 8392 throw new FormatError(`Invalid WhitePoint components for ${this.name}, no fallback available`); 8393 } 8394 if (this.XB < 0 || this.YB < 0 || this.ZB < 0) { 8395 info(`Invalid BlackPoint for ${this.name}, falling back to default.`); 8396 this.XB = this.YB = this.ZB = 0; 8397 } 8398 if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) { 8399 warn(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`); 8400 } 8401 if (this.G < 1) { 8402 info(`Invalid Gamma: ${this.G} for ${this.name}, falling back to default.`); 8403 this.G = 1; 8404 } 8405 } 8406 #toRgb(src, srcOffset, dest, destOffset, scale) { 8407 const A = src[srcOffset] * scale; 8408 const AG = A ** this.G; 8409 const L = this.YW * AG; 8410 const val = Math.max(295.8 * L ** 0.3333333333333333 - 40.8, 0); 8411 dest[destOffset] = val; 8412 dest[destOffset + 1] = val; 8413 dest[destOffset + 2] = val; 8414 } 8415 getRgbItem(src, srcOffset, dest, destOffset) { 8416 this.#toRgb(src, srcOffset, dest, destOffset, 1); 8417 } 8418 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 8419 const scale = 1 / ((1 << bits) - 1); 8420 for (let i = 0; i < count; ++i) { 8421 this.#toRgb(src, srcOffset, dest, destOffset, scale); 8422 srcOffset += 1; 8423 destOffset += 3 + alpha01; 8424 } 8425 } 8426 getOutputLength(inputLength, alpha01) { 8427 return inputLength * (3 + alpha01); 8428 } 8429} 8430class CalRGBCS extends ColorSpace { 8431 static #BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]); 8432 static #BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([0.9869929, -0.1470543, 0.1599627, 0.4323053, 0.5183603, 0.0492912, -0.0085287, 0.0400428, 0.9684867]); 8433 static #SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([3.2404542, -1.5371385, -0.4985314, -0.9692660, 1.8760108, 0.0415560, 0.0556434, -0.2040259, 1.0572252]); 8434 static #FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]); 8435 static #tempNormalizeMatrix = new Float32Array(3); 8436 static #tempConvertMatrix1 = new Float32Array(3); 8437 static #tempConvertMatrix2 = new Float32Array(3); 8438 static #DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0; 8439 constructor(whitePoint, blackPoint, gamma, matrix) { 8440 super("CalRGB", 3); 8441 if (!whitePoint) { 8442 throw new FormatError("WhitePoint missing - required for color space CalRGB"); 8443 } 8444 const [XW, YW, ZW] = this.whitePoint = whitePoint; 8445 const [XB, YB, ZB] = this.blackPoint = blackPoint || new Float32Array(3); 8446 [this.GR, this.GG, this.GB] = gamma || new Float32Array([1, 1, 1]); 8447 [this.MXA, this.MYA, this.MZA, this.MXB, this.MYB, this.MZB, this.MXC, this.MYC, this.MZC] = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]); 8448 if (XW < 0 || ZW < 0 || YW !== 1) { 8449 throw new FormatError(`Invalid WhitePoint components for ${this.name}, no fallback available`); 8450 } 8451 if (XB < 0 || YB < 0 || ZB < 0) { 8452 info(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default."); 8453 this.blackPoint = new Float32Array(3); 8454 } 8455 if (this.GR < 0 || this.GG < 0 || this.GB < 0) { 8456 info(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`); 8457 this.GR = this.GG = this.GB = 1; 8458 } 8459 } 8460 #matrixProduct(a, b, result) { 8461 result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; 8462 result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2]; 8463 result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2]; 8464 } 8465 #toFlat(sourceWhitePoint, LMS, result) { 8466 result[0] = LMS[0] * 1 / sourceWhitePoint[0]; 8467 result[1] = LMS[1] * 1 / sourceWhitePoint[1]; 8468 result[2] = LMS[2] * 1 / sourceWhitePoint[2]; 8469 } 8470 #toD65(sourceWhitePoint, LMS, result) { 8471 const D65X = 0.95047; 8472 const D65Y = 1; 8473 const D65Z = 1.08883; 8474 result[0] = LMS[0] * D65X / sourceWhitePoint[0]; 8475 result[1] = LMS[1] * D65Y / sourceWhitePoint[1]; 8476 result[2] = LMS[2] * D65Z / sourceWhitePoint[2]; 8477 } 8478 #sRGBTransferFunction(color) { 8479 if (color <= 0.0031308) { 8480 return MathClamp(12.92 * color, 0, 1); 8481 } 8482 if (color >= 0.99554525) { 8483 return 1; 8484 } 8485 return MathClamp((1 + 0.055) * color ** (1 / 2.4) - 0.055, 0, 1); 8486 } 8487 #decodeL(L) { 8488 if (L < 0) { 8489 return -this.#decodeL(-L); 8490 } 8491 if (L > 8.0) { 8492 return ((L + 16) / 116) ** 3; 8493 } 8494 return L * CalRGBCS.#DECODE_L_CONSTANT; 8495 } 8496 #compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) { 8497 if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) { 8498 result[0] = XYZ_Flat[0]; 8499 result[1] = XYZ_Flat[1]; 8500 result[2] = XYZ_Flat[2]; 8501 return; 8502 } 8503 const zeroDecodeL = this.#decodeL(0); 8504 const X_DST = zeroDecodeL; 8505 const X_SRC = this.#decodeL(sourceBlackPoint[0]); 8506 const Y_DST = zeroDecodeL; 8507 const Y_SRC = this.#decodeL(sourceBlackPoint[1]); 8508 const Z_DST = zeroDecodeL; 8509 const Z_SRC = this.#decodeL(sourceBlackPoint[2]); 8510 const X_Scale = (1 - X_DST) / (1 - X_SRC); 8511 const X_Offset = 1 - X_Scale; 8512 const Y_Scale = (1 - Y_DST) / (1 - Y_SRC); 8513 const Y_Offset = 1 - Y_Scale; 8514 const Z_Scale = (1 - Z_DST) / (1 - Z_SRC); 8515 const Z_Offset = 1 - Z_Scale; 8516 result[0] = XYZ_Flat[0] * X_Scale + X_Offset; 8517 result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset; 8518 result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset; 8519 } 8520 #normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) { 8521 if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) { 8522 result[0] = XYZ_In[0]; 8523 result[1] = XYZ_In[1]; 8524 result[2] = XYZ_In[2]; 8525 return; 8526 } 8527 const LMS = result; 8528 this.#matrixProduct(CalRGBCS.#BRADFORD_SCALE_MATRIX, XYZ_In, LMS); 8529 const LMS_Flat = CalRGBCS.#tempNormalizeMatrix; 8530 this.#toFlat(sourceWhitePoint, LMS, LMS_Flat); 8531 this.#matrixProduct(CalRGBCS.#BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result); 8532 } 8533 #normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) { 8534 const LMS = result; 8535 this.#matrixProduct(CalRGBCS.#BRADFORD_SCALE_MATRIX, XYZ_In, LMS); 8536 const LMS_D65 = CalRGBCS.#tempNormalizeMatrix; 8537 this.#toD65(sourceWhitePoint, LMS, LMS_D65); 8538 this.#matrixProduct(CalRGBCS.#BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result); 8539 } 8540 #toRgb(src, srcOffset, dest, destOffset, scale) { 8541 const A = MathClamp(src[srcOffset] * scale, 0, 1); 8542 const B = MathClamp(src[srcOffset + 1] * scale, 0, 1); 8543 const C = MathClamp(src[srcOffset + 2] * scale, 0, 1); 8544 const AGR = A === 1 ? 1 : A ** this.GR; 8545 const BGG = B === 1 ? 1 : B ** this.GG; 8546 const CGB = C === 1 ? 1 : C ** this.GB; 8547 const X = this.MXA * AGR + this.MXB * BGG + this.MXC * CGB; 8548 const Y = this.MYA * AGR + this.MYB * BGG + this.MYC * CGB; 8549 const Z = this.MZA * AGR + this.MZB * BGG + this.MZC * CGB; 8550 const XYZ = CalRGBCS.#tempConvertMatrix1; 8551 XYZ[0] = X; 8552 XYZ[1] = Y; 8553 XYZ[2] = Z; 8554 const XYZ_Flat = CalRGBCS.#tempConvertMatrix2; 8555 this.#normalizeWhitePointToFlat(this.whitePoint, XYZ, XYZ_Flat); 8556 const XYZ_Black = CalRGBCS.#tempConvertMatrix1; 8557 this.#compensateBlackPoint(this.blackPoint, XYZ_Flat, XYZ_Black); 8558 const XYZ_D65 = CalRGBCS.#tempConvertMatrix2; 8559 this.#normalizeWhitePointToD65(CalRGBCS.#FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65); 8560 const SRGB = CalRGBCS.#tempConvertMatrix1; 8561 this.#matrixProduct(CalRGBCS.#SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB); 8562 dest[destOffset] = this.#sRGBTransferFunction(SRGB[0]) * 255; 8563 dest[destOffset + 1] = this.#sRGBTransferFunction(SRGB[1]) * 255; 8564 dest[destOffset + 2] = this.#sRGBTransferFunction(SRGB[2]) * 255; 8565 } 8566 getRgbItem(src, srcOffset, dest, destOffset) { 8567 this.#toRgb(src, srcOffset, dest, destOffset, 1); 8568 } 8569 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 8570 const scale = 1 / ((1 << bits) - 1); 8571 for (let i = 0; i < count; ++i) { 8572 this.#toRgb(src, srcOffset, dest, destOffset, scale); 8573 srcOffset += 3; 8574 destOffset += 3 + alpha01; 8575 } 8576 } 8577 getOutputLength(inputLength, alpha01) { 8578 return inputLength * (3 + alpha01) / 3 | 0; 8579 } 8580} 8581class LabCS extends ColorSpace { 8582 constructor(whitePoint, blackPoint, range) { 8583 super("Lab", 3); 8584 if (!whitePoint) { 8585 throw new FormatError("WhitePoint missing - required for color space Lab"); 8586 } 8587 [this.XW, this.YW, this.ZW] = whitePoint; 8588 [this.amin, this.amax, this.bmin, this.bmax] = range || [-100, 100, -100, 100]; 8589 [this.XB, this.YB, this.ZB] = blackPoint || [0, 0, 0]; 8590 if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) { 8591 throw new FormatError("Invalid WhitePoint components, no fallback available"); 8592 } 8593 if (this.XB < 0 || this.YB < 0 || this.ZB < 0) { 8594 info("Invalid BlackPoint, falling back to default"); 8595 this.XB = this.YB = this.ZB = 0; 8596 } 8597 if (this.amin > this.amax || this.bmin > this.bmax) { 8598 info("Invalid Range, falling back to defaults"); 8599 this.amin = -100; 8600 this.amax = 100; 8601 this.bmin = -100; 8602 this.bmax = 100; 8603 } 8604 } 8605 #fn_g(x) { 8606 return x >= 6 / 29 ? x ** 3 : 108 / 841 * (x - 4 / 29); 8607 } 8608 #decode(value, high1, low2, high2) { 8609 return low2 + value * (high2 - low2) / high1; 8610 } 8611 #toRgb(src, srcOffset, maxVal, dest, destOffset) { 8612 let Ls = src[srcOffset]; 8613 let as = src[srcOffset + 1]; 8614 let bs = src[srcOffset + 2]; 8615 if (maxVal !== false) { 8616 Ls = this.#decode(Ls, maxVal, 0, 100); 8617 as = this.#decode(as, maxVal, this.amin, this.amax); 8618 bs = this.#decode(bs, maxVal, this.bmin, this.bmax); 8619 } 8620 if (as > this.amax) { 8621 as = this.amax; 8622 } else if (as < this.amin) { 8623 as = this.amin; 8624 } 8625 if (bs > this.bmax) { 8626 bs = this.bmax; 8627 } else if (bs < this.bmin) { 8628 bs = this.bmin; 8629 } 8630 const M = (Ls + 16) / 116; 8631 const L = M + as / 500; 8632 const N = M - bs / 200; 8633 const X = this.XW * this.#fn_g(L); 8634 const Y = this.YW * this.#fn_g(M); 8635 const Z = this.ZW * this.#fn_g(N); 8636 let r, g, b; 8637 if (this.ZW < 1) { 8638 r = X * 3.1339 + Y * -1.617 + Z * -0.4906; 8639 g = X * -0.9785 + Y * 1.916 + Z * 0.0333; 8640 b = X * 0.072 + Y * -0.229 + Z * 1.4057; 8641 } else { 8642 r = X * 3.2406 + Y * -1.5372 + Z * -0.4986; 8643 g = X * -0.9689 + Y * 1.8758 + Z * 0.0415; 8644 b = X * 0.0557 + Y * -0.204 + Z * 1.057; 8645 } 8646 dest[destOffset] = Math.sqrt(r) * 255; 8647 dest[destOffset + 1] = Math.sqrt(g) * 255; 8648 dest[destOffset + 2] = Math.sqrt(b) * 255; 8649 } 8650 getRgbItem(src, srcOffset, dest, destOffset) { 8651 this.#toRgb(src, srcOffset, false, dest, destOffset); 8652 } 8653 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 8654 const maxVal = (1 << bits) - 1; 8655 for (let i = 0; i < count; i++) { 8656 this.#toRgb(src, srcOffset, maxVal, dest, destOffset); 8657 srcOffset += 3; 8658 destOffset += 3 + alpha01; 8659 } 8660 } 8661 getOutputLength(inputLength, alpha01) { 8662 return inputLength * (3 + alpha01) / 3 | 0; 8663 } 8664 isDefaultDecode(decode, bpc) { 8665 return true; 8666 } 8667 get usesZeroToOneRange() { 8668 return shadow(this, "usesZeroToOneRange", false); 8669 } 8670} 8671 8672;// ./src/core/icc_colorspace.js 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685function fetchSync(url) { 8686 const xhr = new XMLHttpRequest(); 8687 xhr.open("GET", url, false); 8688 xhr.responseType = "arraybuffer"; 8689 xhr.send(null); 8690 return xhr.response; 8691} 8692class IccColorSpace extends ColorSpace { 8693 #transformer; 8694 #convertPixel; 8695 static #useWasm = true; 8696 static #wasmUrl = null; 8697 static #finalizer = null; 8698 constructor(iccProfile, name, numComps) { 8699 if (!IccColorSpace.isUsable) { 8700 throw new Error("No ICC color space support"); 8701 } 8702 super(name, numComps); 8703 let inType; 8704 switch (numComps) { 8705 case 1: 8706 inType = DataType.Gray8; 8707 this.#convertPixel = (src, srcOffset, css) => qcms_convert_one(this.#transformer, src[srcOffset] * 255, css); 8708 break; 8709 case 3: 8710 inType = DataType.RGB8; 8711 this.#convertPixel = (src, srcOffset, css) => qcms_convert_three(this.#transformer, src[srcOffset] * 255, src[srcOffset + 1] * 255, src[srcOffset + 2] * 255, css); 8712 break; 8713 case 4: 8714 inType = DataType.CMYK; 8715 this.#convertPixel = (src, srcOffset, css) => qcms_convert_four(this.#transformer, src[srcOffset] * 255, src[srcOffset + 1] * 255, src[srcOffset + 2] * 255, src[srcOffset + 3] * 255, css); 8716 break; 8717 default: 8718 throw new Error(`Unsupported number of components: ${numComps}`); 8719 } 8720 this.#transformer = qcms_transformer_from_memory(iccProfile, inType, Intent.Perceptual); 8721 if (!this.#transformer) { 8722 throw new Error("Failed to create ICC color space"); 8723 } 8724 IccColorSpace.#finalizer ||= new FinalizationRegistry(transformer => { 8725 qcms_drop_transformer(transformer); 8726 }); 8727 IccColorSpace.#finalizer.register(this, this.#transformer); 8728 } 8729 getRgbHex(src, srcOffset) { 8730 this.#convertPixel(src, srcOffset, true); 8731 return QCMS._cssColor; 8732 } 8733 getRgbItem(src, srcOffset, dest, destOffset) { 8734 QCMS._destBuffer = dest; 8735 QCMS._destOffset = destOffset; 8736 QCMS._destLength = 3; 8737 this.#convertPixel(src, srcOffset, false); 8738 QCMS._destBuffer = null; 8739 } 8740 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 8741 src = src.subarray(srcOffset, srcOffset + count * this.numComps); 8742 if (bits !== 8) { 8743 const scale = 255 / ((1 << bits) - 1); 8744 for (let i = 0, ii = src.length; i < ii; i++) { 8745 src[i] *= scale; 8746 } 8747 } 8748 QCMS._mustAddAlpha = alpha01 && dest.buffer === src.buffer; 8749 QCMS._destBuffer = dest; 8750 QCMS._destOffset = destOffset; 8751 QCMS._destLength = count * (3 + alpha01); 8752 qcms_convert_array(this.#transformer, src); 8753 QCMS._mustAddAlpha = false; 8754 QCMS._destBuffer = null; 8755 } 8756 getOutputLength(inputLength, alpha01) { 8757 return inputLength / this.numComps * (3 + alpha01) | 0; 8758 } 8759 static setOptions({ 8760 useWasm, 8761 useWorkerFetch, 8762 wasmUrl 8763 }) { 8764 if (!useWorkerFetch) { 8765 this.#useWasm = false; 8766 return; 8767 } 8768 this.#useWasm = useWasm; 8769 this.#wasmUrl = wasmUrl; 8770 } 8771 static get isUsable() { 8772 let isUsable = false; 8773 if (this.#useWasm) { 8774 if (this.#wasmUrl) { 8775 try { 8776 this._module = initSync({ 8777 module: fetchSync(`${this.#wasmUrl}qcms_bg.wasm`) 8778 }); 8779 isUsable = !!this._module; 8780 QCMS._memory = this._module.memory; 8781 QCMS._makeHexColor = Util.makeHexColor.bind(Util); 8782 } catch (e) { 8783 warn(`ICCBased color space: "${e}".`); 8784 } 8785 } else { 8786 warn("No ICC color space support due to missing `wasmUrl` API option"); 8787 } 8788 } 8789 return shadow(this, "isUsable", isUsable); 8790 } 8791} 8792class CmykICCBasedCS extends IccColorSpace { 8793 static #iccUrl; 8794 constructor() { 8795 const iccProfile = new Uint8Array(fetchSync(`${CmykICCBasedCS.#iccUrl}CGATS001Compat-v2-micro.icc`)); 8796 super(iccProfile, "DeviceCMYK", 4); 8797 } 8798 static setOptions({ 8799 iccUrl 8800 }) { 8801 this.#iccUrl = iccUrl; 8802 } 8803 static get isUsable() { 8804 let isUsable = false; 8805 if (IccColorSpace.isUsable) { 8806 if (this.#iccUrl) { 8807 isUsable = true; 8808 } else { 8809 warn("No CMYK ICC profile support due to missing `iccUrl` API option"); 8810 } 8811 } 8812 return shadow(this, "isUsable", isUsable); 8813 } 8814} 8815 8816;// ./src/core/stream.js 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827class Stream extends BaseStream { 8828 constructor(arrayBuffer, start, length, dict) { 8829 super(); 8830 this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer); 8831 this.start = start || 0; 8832 this.pos = this.start; 8833 this.end = start + length || this.bytes.length; 8834 this.dict = dict; 8835 } 8836 get length() { 8837 return this.end - this.start; 8838 } 8839 get isEmpty() { 8840 return this.length === 0; 8841 } 8842 getByte() { 8843 if (this.pos >= this.end) { 8844 return -1; 8845 } 8846 return this.bytes[this.pos++]; 8847 } 8848 getBytes(length) { 8849 const bytes = this.bytes; 8850 const pos = this.pos; 8851 const strEnd = this.end; 8852 if (!length) { 8853 this.pos = strEnd; 8854 return bytes.subarray(pos, strEnd); 8855 } 8856 let end = pos + length; 8857 if (end > strEnd) { 8858 end = strEnd; 8859 } 8860 this.pos = end; 8861 return bytes.subarray(pos, end); 8862 } 8863 getByteRange(begin, end) { 8864 if (begin < 0) { 8865 begin = 0; 8866 } 8867 if (end > this.end) { 8868 end = this.end; 8869 } 8870 return this.bytes.subarray(begin, end); 8871 } 8872 reset() { 8873 this.pos = this.start; 8874 } 8875 moveStart() { 8876 this.start = this.pos; 8877 } 8878 makeSubStream(start, length, dict = null) { 8879 return new Stream(this.bytes.buffer, start, length, dict); 8880 } 8881 clone() { 8882 return new Stream(this.bytes.buffer, this.start, this.end - this.start, this.dict.clone()); 8883 } 8884} 8885class StringStream extends Stream { 8886 constructor(str) { 8887 super(stringToBytes(str)); 8888 } 8889} 8890class NullStream extends Stream { 8891 constructor() { 8892 super(new Uint8Array(0)); 8893 } 8894} 8895 8896;// ./src/core/chunked_stream.js 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921class ChunkedStream extends Stream { 8922 progressiveDataLength = 0; 8923 _lastSuccessfulEnsureByteChunk = -1; 8924 _loadedChunks = new Set(); 8925 constructor(length, chunkSize, manager) { 8926 super(new Uint8Array(length), 0, length, null); 8927 this.chunkSize = chunkSize; 8928 this.numChunks = Math.ceil(length / chunkSize); 8929 this.manager = manager; 8930 } 8931 getMissingChunks() { 8932 const chunks = []; 8933 for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) { 8934 if (!this._loadedChunks.has(chunk)) { 8935 chunks.push(chunk); 8936 } 8937 } 8938 return chunks; 8939 } 8940 get numChunksLoaded() { 8941 return this._loadedChunks.size; 8942 } 8943 get isDataLoaded() { 8944 return this.numChunksLoaded === this.numChunks; 8945 } 8946 onReceiveData(begin, chunk) { 8947 const chunkSize = this.chunkSize; 8948 if (begin % chunkSize !== 0) { 8949 throw new Error(`Bad begin offset: ${begin}`); 8950 } 8951 const end = begin + chunk.byteLength; 8952 if (end % chunkSize !== 0 && end !== this.bytes.length) { 8953 throw new Error(`Bad end offset: ${end}`); 8954 } 8955 this.bytes.set(new Uint8Array(chunk), begin); 8956 const beginChunk = Math.floor(begin / chunkSize); 8957 const endChunk = Math.floor((end - 1) / chunkSize) + 1; 8958 for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) { 8959 this._loadedChunks.add(curChunk); 8960 } 8961 } 8962 onReceiveProgressiveData(data) { 8963 let position = this.progressiveDataLength; 8964 const beginChunk = Math.floor(position / this.chunkSize); 8965 this.bytes.set(new Uint8Array(data), position); 8966 position += data.byteLength; 8967 this.progressiveDataLength = position; 8968 const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize); 8969 for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) { 8970 this._loadedChunks.add(curChunk); 8971 } 8972 } 8973 ensureByte(pos) { 8974 if (pos < this.progressiveDataLength) { 8975 return; 8976 } 8977 const chunk = Math.floor(pos / this.chunkSize); 8978 if (chunk > this.numChunks) { 8979 return; 8980 } 8981 if (chunk === this._lastSuccessfulEnsureByteChunk) { 8982 return; 8983 } 8984 if (!this._loadedChunks.has(chunk)) { 8985 throw new MissingDataException(pos, pos + 1); 8986 } 8987 this._lastSuccessfulEnsureByteChunk = chunk; 8988 } 8989 ensureRange(begin, end) { 8990 if (begin >= end) { 8991 return; 8992 } 8993 if (end <= this.progressiveDataLength) { 8994 return; 8995 } 8996 const beginChunk = Math.floor(begin / this.chunkSize); 8997 if (beginChunk > this.numChunks) { 8998 return; 8999 } 9000 const endChunk = Math.min(Math.floor((end - 1) / this.chunkSize) + 1, this.numChunks); 9001 for (let chunk = beginChunk; chunk < endChunk; ++chunk) { 9002 if (!this._loadedChunks.has(chunk)) { 9003 throw new MissingDataException(begin, end); 9004 } 9005 } 9006 } 9007 nextEmptyChunk(beginChunk) { 9008 const numChunks = this.numChunks; 9009 for (let i = 0; i < numChunks; ++i) { 9010 const chunk = (beginChunk + i) % numChunks; 9011 if (!this._loadedChunks.has(chunk)) { 9012 return chunk; 9013 } 9014 } 9015 return null; 9016 } 9017 hasChunk(chunk) { 9018 return this._loadedChunks.has(chunk); 9019 } 9020 getByte() { 9021 const pos = this.pos; 9022 if (pos >= this.end) { 9023 return -1; 9024 } 9025 if (pos >= this.progressiveDataLength) { 9026 this.ensureByte(pos); 9027 } 9028 return this.bytes[this.pos++]; 9029 } 9030 getBytes(length) { 9031 const bytes = this.bytes; 9032 const pos = this.pos; 9033 const strEnd = this.end; 9034 if (!length) { 9035 if (strEnd > this.progressiveDataLength) { 9036 this.ensureRange(pos, strEnd); 9037 } 9038 this.pos = strEnd; 9039 return bytes.subarray(pos, strEnd); 9040 } 9041 let end = pos + length; 9042 if (end > strEnd) { 9043 end = strEnd; 9044 } 9045 if (end > this.progressiveDataLength) { 9046 this.ensureRange(pos, end); 9047 } 9048 this.pos = end; 9049 return bytes.subarray(pos, end); 9050 } 9051 getByteRange(begin, end) { 9052 if (begin < 0) { 9053 begin = 0; 9054 } 9055 if (end > this.end) { 9056 end = this.end; 9057 } 9058 if (end > this.progressiveDataLength) { 9059 this.ensureRange(begin, end); 9060 } 9061 return this.bytes.subarray(begin, end); 9062 } 9063 makeSubStream(start, length, dict = null) { 9064 if (length) { 9065 if (start + length > this.progressiveDataLength) { 9066 this.ensureRange(start, start + length); 9067 } 9068 } else if (start >= this.progressiveDataLength) { 9069 this.ensureByte(start); 9070 } 9071 function ChunkedStreamSubstream() {} 9072 ChunkedStreamSubstream.prototype = Object.create(this); 9073 ChunkedStreamSubstream.prototype.getMissingChunks = function () { 9074 const chunkSize = this.chunkSize; 9075 const beginChunk = Math.floor(this.start / chunkSize);
vendor: 22,438 bytes, lines 9076-9831
9076 const endChunk = Math.floor((this.end - 1) / chunkSize) + 1; 9077 const missingChunks = []; 9078 for (let chunk = beginChunk; chunk < endChunk; ++chunk) { 9079 if (!this._loadedChunks.has(chunk)) { 9080 missingChunks.push(chunk); 9081 } 9082 } 9083 return missingChunks; 9084 }; 9085 Object.defineProperty(ChunkedStreamSubstream.prototype, "isDataLoaded", { 9086 get() { 9087 if (this.numChunksLoaded === this.numChunks) { 9088 return true; 9089 } 9090 return this.getMissingChunks().length === 0; 9091 }, 9092 configurable: true 9093 }); 9094 const subStream = new ChunkedStreamSubstream(); 9095 subStream.pos = subStream.start = start; 9096 subStream.end = start + length || this.end; 9097 subStream.dict = dict; 9098 return subStream; 9099 } 9100 getBaseStreams() { 9101 return [this]; 9102 } 9103} 9104class ChunkedStreamManager { 9105 aborted = false; 9106 currRequestId = 0; 9107 _chunksNeededByRequest = new Map(); 9108 _loadedStreamCapability = Promise.withResolvers(); 9109 _promisesByRequest = new Map(); 9110 _requestsByChunk = new Map(); 9111 constructor(pdfStream, args) { 9112 this.length = args.length; 9113 this.chunkSize = args.rangeChunkSize; 9114 this.stream = new ChunkedStream(this.length, this.chunkSize, this); 9115 this.pdfStream = pdfStream; 9116 this.disableAutoFetch = args.disableAutoFetch; 9117 this.msgHandler = args.msgHandler; 9118 } 9119 async sendRequest(begin, end) { 9120 const rangeReader = this.pdfStream.getRangeReader(begin, end); 9121 let chunks = []; 9122 while (true) { 9123 const { 9124 value, 9125 done 9126 } = await rangeReader.read(); 9127 if (this.aborted) { 9128 chunks = null; 9129 return; 9130 } 9131 if (done) { 9132 break; 9133 } 9134 chunks.push(value); 9135 } 9136 if (chunks.length === 0 && this.disableAutoFetch) { 9137 return; 9138 } 9139 const data = arrayBuffersToBytes(chunks); 9140 chunks = null; 9141 this.onReceiveData({ 9142 chunk: data.buffer, 9143 begin 9144 }); 9145 } 9146 requestAllChunks(noFetch = false) { 9147 if (!noFetch) { 9148 const missingChunks = this.stream.getMissingChunks(); 9149 this._requestChunks(missingChunks); 9150 } 9151 return this._loadedStreamCapability.promise; 9152 } 9153 _requestChunks(chunks) { 9154 const requestId = this.currRequestId++; 9155 const chunksNeeded = new Set(); 9156 this._chunksNeededByRequest.set(requestId, chunksNeeded); 9157 for (const chunk of chunks) { 9158 if (!this.stream.hasChunk(chunk)) { 9159 chunksNeeded.add(chunk); 9160 } 9161 } 9162 if (chunksNeeded.size === 0) { 9163 return Promise.resolve(); 9164 } 9165 const capability = Promise.withResolvers(); 9166 this._promisesByRequest.set(requestId, capability); 9167 const chunksToRequest = []; 9168 for (const chunk of chunksNeeded) { 9169 let requestIds = this._requestsByChunk.get(chunk); 9170 if (!requestIds) { 9171 requestIds = []; 9172 this._requestsByChunk.set(chunk, requestIds); 9173 chunksToRequest.push(chunk); 9174 } 9175 requestIds.push(requestId); 9176 } 9177 if (chunksToRequest.length > 0) { 9178 const groupedChunksToRequest = this.groupChunks(chunksToRequest); 9179 for (const groupedChunk of groupedChunksToRequest) { 9180 const begin = groupedChunk.beginChunk * this.chunkSize; 9181 const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length); 9182 this.sendRequest(begin, end).catch(capability.reject); 9183 } 9184 } 9185 return capability.promise.catch(reason => { 9186 if (this.aborted) { 9187 return; 9188 } 9189 throw reason; 9190 }); 9191 } 9192 getStream() { 9193 return this.stream; 9194 } 9195 requestRange(begin, end) { 9196 end = Math.min(end, this.length); 9197 const beginChunk = this.getBeginChunk(begin); 9198 const endChunk = this.getEndChunk(end); 9199 const chunks = []; 9200 for (let chunk = beginChunk; chunk < endChunk; ++chunk) { 9201 chunks.push(chunk); 9202 } 9203 return this._requestChunks(chunks); 9204 } 9205 requestRanges(ranges = []) { 9206 const chunksToRequest = []; 9207 for (const range of ranges) { 9208 const beginChunk = this.getBeginChunk(range.begin); 9209 const endChunk = this.getEndChunk(range.end); 9210 for (let chunk = beginChunk; chunk < endChunk; ++chunk) { 9211 if (!chunksToRequest.includes(chunk)) { 9212 chunksToRequest.push(chunk); 9213 } 9214 } 9215 } 9216 chunksToRequest.sort((a, b) => a - b); 9217 return this._requestChunks(chunksToRequest); 9218 } 9219 groupChunks(chunks) { 9220 const groupedChunks = []; 9221 let beginChunk = -1; 9222 let prevChunk = -1; 9223 for (let i = 0, ii = chunks.length; i < ii; ++i) { 9224 const chunk = chunks[i]; 9225 if (beginChunk < 0) { 9226 beginChunk = chunk; 9227 } 9228 if (prevChunk >= 0 && prevChunk + 1 !== chunk) { 9229 groupedChunks.push({ 9230 beginChunk, 9231 endChunk: prevChunk + 1 9232 }); 9233 beginChunk = chunk; 9234 } 9235 if (i + 1 === chunks.length) { 9236 groupedChunks.push({ 9237 beginChunk, 9238 endChunk: chunk + 1 9239 }); 9240 } 9241 prevChunk = chunk; 9242 } 9243 return groupedChunks; 9244 } 9245 onReceiveData(args) { 9246 const { 9247 chunkSize, 9248 length, 9249 stream 9250 } = this; 9251 const chunk = args.chunk; 9252 const isProgressive = args.begin === undefined; 9253 const begin = isProgressive ? stream.progressiveDataLength : args.begin; 9254 const end = begin + chunk.byteLength; 9255 const beginChunk = Math.floor(begin / chunkSize); 9256 const endChunk = end < length ? Math.floor(end / chunkSize) : Math.ceil(end / chunkSize); 9257 if (isProgressive) { 9258 stream.onReceiveProgressiveData(chunk); 9259 } else { 9260 stream.onReceiveData(begin, chunk); 9261 } 9262 if (stream.isDataLoaded) { 9263 this._loadedStreamCapability.resolve(stream); 9264 } 9265 const loadedRequests = []; 9266 for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) { 9267 const requestIds = this._requestsByChunk.get(curChunk); 9268 if (!requestIds) { 9269 continue; 9270 } 9271 this._requestsByChunk.delete(curChunk); 9272 for (const requestId of requestIds) { 9273 const chunksNeeded = this._chunksNeededByRequest.get(requestId); 9274 if (chunksNeeded.has(curChunk)) { 9275 chunksNeeded.delete(curChunk); 9276 } 9277 if (chunksNeeded.size > 0) { 9278 continue; 9279 } 9280 loadedRequests.push(requestId); 9281 } 9282 } 9283 if (!this.disableAutoFetch && this._requestsByChunk.size === 0) { 9284 let nextEmptyChunk; 9285 if (stream.numChunksLoaded === 1) { 9286 const lastChunk = stream.numChunks - 1; 9287 if (!stream.hasChunk(lastChunk)) { 9288 nextEmptyChunk = lastChunk; 9289 } 9290 } else { 9291 nextEmptyChunk = stream.nextEmptyChunk(endChunk); 9292 } 9293 if (Number.isInteger(nextEmptyChunk)) { 9294 this._requestChunks([nextEmptyChunk]); 9295 } 9296 } 9297 for (const requestId of loadedRequests) { 9298 const capability = this._promisesByRequest.get(requestId); 9299 this._promisesByRequest.delete(requestId); 9300 capability.resolve(); 9301 } 9302 this.msgHandler.send("DocProgress", { 9303 loaded: MathClamp(stream.numChunksLoaded * chunkSize, stream.progressiveDataLength, length), 9304 total: length 9305 }); 9306 } 9307 onError(err) { 9308 this._loadedStreamCapability.reject(err); 9309 } 9310 getBeginChunk(begin) { 9311 return Math.floor(begin / this.chunkSize); 9312 } 9313 getEndChunk(end) { 9314 return Math.floor((end - 1) / this.chunkSize) + 1; 9315 } 9316 abort(reason) { 9317 this.aborted = true; 9318 this.pdfStream?.cancelAllRequests(reason); 9319 for (const capability of this._promisesByRequest.values()) { 9320 capability.reject(reason); 9321 } 9322 } 9323} 9324 9325;// ./src/shared/image_utils.js 9326 9327 9328 9329 9330 9331function convertToRGBA(params) { 9332 switch (params.kind) { 9333 case ImageKind.GRAYSCALE_1BPP: 9334 return convertBlackAndWhiteToRGBA(params); 9335 case ImageKind.RGB_24BPP: 9336 return convertRGBToRGBA(params); 9337 } 9338 return null; 9339} 9340function convertBlackAndWhiteToRGBA({ 9341 src, 9342 srcPos = 0, 9343 dest, 9344 width, 9345 height, 9346 nonBlackColor = 0xffffffff, 9347 inverseDecode = false 9348}) { 9349 const black = FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff; 9350 const [zeroMapping, oneMapping] = inverseDecode ? [nonBlackColor, black] : [black, nonBlackColor]; 9351 const widthInSource = width >> 3; 9352 const widthRemainder = width & 7; 9353 const xorMask = zeroMapping ^ oneMapping; 9354 const srcLength = src.length; 9355 dest = new Uint32Array(dest.buffer); 9356 let destPos = 0; 9357 for (let i = 0; i < height; ++i) { 9358 for (const max = srcPos + widthInSource; srcPos < max; ++srcPos, destPos += 8) { 9359 const elem = src[srcPos]; 9360 dest[destPos] = zeroMapping ^ -(elem >> 7 & 1) & xorMask; 9361 dest[destPos + 1] = zeroMapping ^ -(elem >> 6 & 1) & xorMask; 9362 dest[destPos + 2] = zeroMapping ^ -(elem >> 5 & 1) & xorMask; 9363 dest[destPos + 3] = zeroMapping ^ -(elem >> 4 & 1) & xorMask; 9364 dest[destPos + 4] = zeroMapping ^ -(elem >> 3 & 1) & xorMask; 9365 dest[destPos + 5] = zeroMapping ^ -(elem >> 2 & 1) & xorMask; 9366 dest[destPos + 6] = zeroMapping ^ -(elem >> 1 & 1) & xorMask; 9367 dest[destPos + 7] = zeroMapping ^ -(elem & 1) & xorMask; 9368 } 9369 if (widthRemainder === 0) { 9370 continue; 9371 } 9372 const elem = srcPos < srcLength ? src[srcPos++] : 255; 9373 for (let j = 0; j < widthRemainder; ++j, ++destPos) { 9374 dest[destPos] = zeroMapping ^ -(elem >> 7 - j & 1) & xorMask; 9375 } 9376 } 9377 return { 9378 srcPos, 9379 destPos 9380 }; 9381} 9382function convertRGBToRGBA({ 9383 src, 9384 srcPos = 0, 9385 dest, 9386 destPos = 0, 9387 width, 9388 height 9389}) { 9390 let i = 0; 9391 const len = width * height * 3; 9392 const len32 = len >> 2; 9393 const src32 = new Uint32Array(src.buffer, srcPos, len32); 9394 const alphaMask = FeatureTest.isLittleEndian ? 0xff000000 : 0xff; 9395 if (FeatureTest.isLittleEndian) { 9396 for (; i < len32 - 2; i += 3, destPos += 4) { 9397 const s1 = src32[i], 9398 s2 = src32[i + 1], 9399 s3 = src32[i + 2]; 9400 dest[destPos] = s1 | alphaMask; 9401 dest[destPos + 1] = s1 >>> 24 | s2 << 8 | alphaMask; 9402 dest[destPos + 2] = s2 >>> 16 | s3 << 16 | alphaMask; 9403 dest[destPos + 3] = s3 >>> 8 | alphaMask; 9404 } 9405 for (let j = i * 4, jj = srcPos + len; j < jj; j += 3) { 9406 dest[destPos++] = src[j] | src[j + 1] << 8 | src[j + 2] << 16 | alphaMask; 9407 } 9408 } else { 9409 for (; i < len32 - 2; i += 3, destPos += 4) { 9410 const s1 = src32[i], 9411 s2 = src32[i + 1], 9412 s3 = src32[i + 2]; 9413 dest[destPos] = s1 | alphaMask; 9414 dest[destPos + 1] = s1 << 24 | s2 >>> 8 | alphaMask; 9415 dest[destPos + 2] = s2 << 16 | s3 >>> 16 | alphaMask; 9416 dest[destPos + 3] = s3 << 8 | alphaMask; 9417 } 9418 for (let j = i * 4, jj = srcPos + len; j < jj; j += 3) { 9419 dest[destPos++] = src[j] << 24 | src[j + 1] << 16 | src[j + 2] << 8 | alphaMask; 9420 } 9421 } 9422 return { 9423 srcPos: srcPos + len, 9424 destPos 9425 }; 9426} 9427function grayToRGBA(src, dest) { 9428 if (FeatureTest.isLittleEndian) { 9429 for (let i = 0, ii = src.length; i < ii; i++) { 9430 dest[i] = src[i] * 0x10101 | 0xff000000; 9431 } 9432 } else { 9433 for (let i = 0, ii = src.length; i < ii; i++) { 9434 dest[i] = src[i] * 0x1010100 | 0x000000ff; 9435 } 9436 } 9437} 9438 9439;// ./src/core/image_resizer.js 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9450 9451const MIN_IMAGE_DIM = 2048; 9452const MAX_IMAGE_DIM = 32768; 9453const MAX_ERROR = 128; 9454class ImageResizer { 9455 static #goodSquareLength = MIN_IMAGE_DIM; 9456 static #isImageDecoderSupported = FeatureTest.isImageDecoderSupported; 9457 constructor(imgData, isMask) { 9458 this._imgData = imgData; 9459 this._isMask = isMask; 9460 } 9461 static get canUseImageDecoder() { 9462 return shadow(this, "canUseImageDecoder", this.#isImageDecoderSupported ? ImageDecoder.isTypeSupported("image/bmp") : Promise.resolve(false)); 9463 } 9464 static needsToBeResized(width, height) { 9465 if (width <= this.#goodSquareLength && height <= this.#goodSquareLength) { 9466 return false; 9467 } 9468 const { 9469 MAX_DIM 9470 } = this; 9471 if (width > MAX_DIM || height > MAX_DIM) { 9472 return true; 9473 } 9474 const area = width * height; 9475 if (this._hasMaxArea) { 9476 return area > this.MAX_AREA; 9477 } 9478 if (area < this.#goodSquareLength ** 2) { 9479 return false; 9480 } 9481 if (this._areGoodDims(width, height)) { 9482 this.#goodSquareLength = Math.max(this.#goodSquareLength, Math.floor(Math.sqrt(width * height))); 9483 return false; 9484 } 9485 this.#goodSquareLength = this._guessMax(this.#goodSquareLength, MAX_DIM, MAX_ERROR, 0); 9486 const maxArea = this.MAX_AREA = this.#goodSquareLength ** 2; 9487 return area > maxArea; 9488 } 9489 static getReducePowerForJPX(width, height, componentsCount) { 9490 const area = width * height; 9491 const maxJPXArea = 2 ** 30 / (componentsCount * 4); 9492 if (!this.needsToBeResized(width, height)) { 9493 if (area > maxJPXArea) { 9494 return Math.ceil(Math.log2(area / maxJPXArea)); 9495 } 9496 return 0; 9497 } 9498 const { 9499 MAX_DIM, 9500 MAX_AREA 9501 } = this; 9502 const minFactor = Math.max(width / MAX_DIM, height / MAX_DIM, Math.sqrt(area / Math.min(maxJPXArea, MAX_AREA))); 9503 return Math.ceil(Math.log2(minFactor)); 9504 } 9505 static get MAX_DIM() { 9506 return shadow(this, "MAX_DIM", this._guessMax(MIN_IMAGE_DIM, MAX_IMAGE_DIM, 0, 1)); 9507 } 9508 static get MAX_AREA() { 9509 this._hasMaxArea = true; 9510 return shadow(this, "MAX_AREA", this._guessMax(this.#goodSquareLength, this.MAX_DIM, MAX_ERROR, 0) ** 2); 9511 } 9512 static set MAX_AREA(area) { 9513 if (area >= 0) { 9514 this._hasMaxArea = true; 9515 shadow(this, "MAX_AREA", area); 9516 } 9517 } 9518 static setOptions({ 9519 canvasMaxAreaInBytes = -1, 9520 isImageDecoderSupported = false 9521 }) { 9522 if (!this._hasMaxArea) { 9523 this.MAX_AREA = canvasMaxAreaInBytes >> 2; 9524 } 9525 this.#isImageDecoderSupported = isImageDecoderSupported; 9526 } 9527 static _areGoodDims(width, height) { 9528 try { 9529 const canvas = new OffscreenCanvas(width, height); 9530 const ctx = canvas.getContext("2d"); 9531 ctx.fillRect(0, 0, 1, 1); 9532 const opacity = ctx.getImageData(0, 0, 1, 1).data[3]; 9533 canvas.width = canvas.height = 1; 9534 return opacity !== 0; 9535 } catch { 9536 return false; 9537 } 9538 } 9539 static _guessMax(start, end, tolerance, defaultHeight) { 9540 while (start + tolerance + 1 < end) { 9541 const middle = Math.floor((start + end) / 2); 9542 const height = defaultHeight || middle; 9543 if (this._areGoodDims(middle, height)) { 9544 start = middle; 9545 } else { 9546 end = middle; 9547 } 9548 } 9549 return start; 9550 } 9551 static async createImage(imgData, isMask = false) { 9552 return new ImageResizer(imgData, isMask)._createImage(); 9553 } 9554 async _createImage() { 9555 const { 9556 _imgData: imgData 9557 } = this; 9558 const { 9559 width, 9560 height 9561 } = imgData; 9562 if (width * height * 4 > MAX_INT_32) { 9563 const result = this.#rescaleImageData(); 9564 if (result) { 9565 return result; 9566 } 9567 } 9568 const data = this._encodeBMP(); 9569 let decoder, imagePromise; 9570 if (await ImageResizer.canUseImageDecoder) { 9571 decoder = new ImageDecoder({ 9572 data, 9573 type: "image/bmp", 9574 preferAnimation: false, 9575 transfer: [data.buffer] 9576 }); 9577 imagePromise = decoder.decode().catch(reason => { 9578 warn(`BMP image decoding failed: ${reason}`); 9579 return createImageBitmap(new Blob([this._encodeBMP().buffer], { 9580 type: "image/bmp" 9581 })); 9582 }).finally(() => { 9583 decoder.close(); 9584 }); 9585 } else { 9586 imagePromise = createImageBitmap(new Blob([data.buffer], { 9587 type: "image/bmp" 9588 })); 9589 } 9590 const { 9591 MAX_AREA, 9592 MAX_DIM 9593 } = ImageResizer; 9594 const minFactor = Math.max(width / MAX_DIM, height / MAX_DIM, Math.sqrt(width * height / MAX_AREA)); 9595 const firstFactor = Math.max(minFactor, 2); 9596 const factor = Math.round(10 * (minFactor + 1.25)) / 10 / firstFactor; 9597 const N = Math.floor(Math.log2(factor)); 9598 const steps = new Array(N + 2).fill(2); 9599 steps[0] = firstFactor; 9600 steps.splice(-1, 1, factor / (1 << N)); 9601 let newWidth = width; 9602 let newHeight = height; 9603 const result = await imagePromise; 9604 let bitmap = result.image || result; 9605 for (const step of steps) { 9606 const prevWidth = newWidth; 9607 const prevHeight = newHeight; 9608 newWidth = Math.floor(newWidth / step); 9609 newHeight = Math.floor(newHeight / step); 9610 const canvas = new OffscreenCanvas(newWidth, newHeight); 9611 const ctx = canvas.getContext("2d"); 9612 ctx.drawImage(bitmap, 0, 0, prevWidth, prevHeight, 0, 0, newWidth, newHeight); 9613 bitmap.close(); 9614 bitmap = canvas.transferToImageBitmap(); 9615 } 9616 imgData.data = null; 9617 imgData.bitmap = bitmap; 9618 imgData.width = newWidth; 9619 imgData.height = newHeight; 9620 return imgData; 9621 } 9622 #rescaleImageData() { 9623 const { 9624 _imgData: imgData 9625 } = this; 9626 const { 9627 data, 9628 width, 9629 height, 9630 kind 9631 } = imgData; 9632 const rgbaSize = width * height * 4; 9633 const K = Math.ceil(Math.log2(rgbaSize / MAX_INT_32)); 9634 const newWidth = width >> K; 9635 const newHeight = height >> K; 9636 let rgbaData; 9637 let maxHeight = height; 9638 try { 9639 rgbaData = new Uint8Array(rgbaSize); 9640 } catch { 9641 let n = Math.floor(Math.log2(rgbaSize + 1)); 9642 while (true) { 9643 try { 9644 rgbaData = new Uint8Array(2 ** n - 1); 9645 break; 9646 } catch { 9647 n -= 1; 9648 } 9649 } 9650 maxHeight = Math.floor((2 ** n - 1) / (width * 4)); 9651 const newSize = width * maxHeight * 4; 9652 if (newSize < rgbaData.length) { 9653 rgbaData = new Uint8Array(newSize); 9654 } 9655 } 9656 const src32 = new Uint32Array(rgbaData.buffer); 9657 const dest32 = new Uint32Array(newWidth * newHeight); 9658 let srcPos = 0; 9659 let newIndex = 0; 9660 const step = Math.ceil(height / maxHeight); 9661 const remainder = height % maxHeight === 0 ? height : height % maxHeight; 9662 for (let k = 0; k < step; k++) { 9663 const h = k < step - 1 ? maxHeight : remainder; 9664 ({ 9665 srcPos 9666 } = convertToRGBA({ 9667 kind, 9668 src: data, 9669 dest: src32, 9670 width, 9671 height: h, 9672 inverseDecode: this._isMask, 9673 srcPos 9674 })); 9675 for (let i = 0, ii = h >> K; i < ii; i++) { 9676 const buf = src32.subarray((i << K) * width); 9677 for (let j = 0; j < newWidth; j++) { 9678 dest32[newIndex++] = buf[j << K]; 9679 } 9680 } 9681 } 9682 if (ImageResizer.needsToBeResized(newWidth, newHeight)) { 9683 imgData.data = dest32; 9684 imgData.width = newWidth; 9685 imgData.height = newHeight; 9686 imgData.kind = ImageKind.RGBA_32BPP; 9687 return null; 9688 } 9689 const canvas = new OffscreenCanvas(newWidth, newHeight); 9690 const ctx = canvas.getContext("2d", { 9691 willReadFrequently: true 9692 }); 9693 ctx.putImageData(new ImageData(new Uint8ClampedArray(dest32.buffer), newWidth, newHeight), 0, 0); 9694 imgData.data = null; 9695 imgData.bitmap = canvas.transferToImageBitmap(); 9696 imgData.width = newWidth; 9697 imgData.height = newHeight; 9698 return imgData; 9699 } 9700 _encodeBMP() { 9701 const { 9702 width, 9703 height, 9704 kind 9705 } = this._imgData; 9706 let data = this._imgData.data; 9707 let bitPerPixel; 9708 let colorTable = new Uint8Array(0); 9709 let maskTable = colorTable; 9710 let compression = 0; 9711 switch (kind) { 9712 case ImageKind.GRAYSCALE_1BPP: 9713 { 9714 bitPerPixel = 1; 9715 colorTable = new Uint8Array(this._isMask ? [255, 255, 255, 255, 0, 0, 0, 0] : [0, 0, 0, 0, 255, 255, 255, 255]); 9716 const rowLen = width + 7 >> 3; 9717 const rowSize = rowLen + 3 & -4; 9718 if (rowLen !== rowSize) { 9719 const newData = new Uint8Array(rowSize * height); 9720 let k = 0; 9721 for (let i = 0, ii = height * rowLen; i < ii; i += rowLen, k += rowSize) { 9722 newData.set(data.subarray(i, i + rowLen), k); 9723 } 9724 data = newData; 9725 } 9726 break; 9727 } 9728 case ImageKind.RGB_24BPP: 9729 { 9730 bitPerPixel = 24; 9731 if (width & 3) { 9732 const rowLen = 3 * width; 9733 const rowSize = rowLen + 3 & -4; 9734 const extraLen = rowSize - rowLen; 9735 const newData = new Uint8Array(rowSize * height); 9736 let k = 0; 9737 for (let i = 0, ii = height * rowLen; i < ii; i += rowLen) { 9738 const row = data.subarray(i, i + rowLen); 9739 for (let j = 0; j < rowLen; j += 3) { 9740 newData[k++] = row[j + 2]; 9741 newData[k++] = row[j + 1]; 9742 newData[k++] = row[j]; 9743 } 9744 k += extraLen; 9745 } 9746 data = newData; 9747 } else { 9748 for (let i = 0, ii = data.length; i < ii; i += 3) { 9749 const tmp = data[i]; 9750 data[i] = data[i + 2]; 9751 data[i + 2] = tmp; 9752 } 9753 } 9754 break; 9755 } 9756 case ImageKind.RGBA_32BPP: 9757 bitPerPixel = 32; 9758 compression = 3; 9759 maskTable = new Uint8Array(4 + 4 + 4 + 4 + 52); 9760 const view = new DataView(maskTable.buffer); 9761 if (FeatureTest.isLittleEndian) { 9762 view.setUint32(0, 0x000000ff, true); 9763 view.setUint32(4, 0x0000ff00, true); 9764 view.setUint32(8, 0x00ff0000, true); 9765 view.setUint32(12, 0xff000000, true); 9766 } else { 9767 view.setUint32(0, 0xff000000, true); 9768 view.setUint32(4, 0x00ff0000, true); 9769 view.setUint32(8, 0x0000ff00, true); 9770 view.setUint32(12, 0x000000ff, true); 9771 } 9772 break; 9773 default: 9774 throw new Error("invalid format"); 9775 } 9776 let i = 0; 9777 const headerLength = 40 + maskTable.length; 9778 const fileLength = 14 + headerLength + colorTable.length + data.length; 9779 const bmpData = new Uint8Array(fileLength); 9780 const view = new DataView(bmpData.buffer); 9781 view.setUint16(i, 0x4d42, true); 9782 i += 2; 9783 view.setUint32(i, fileLength, true); 9784 i += 4; 9785 view.setUint32(i, 0, true); 9786 i += 4; 9787 view.setUint32(i, 14 + headerLength + colorTable.length, true); 9788 i += 4; 9789 view.setUint32(i, headerLength, true); 9790 i += 4; 9791 view.setInt32(i, width, true); 9792 i += 4; 9793 view.setInt32(i, -height, true); 9794 i += 4; 9795 view.setUint16(i, 1, true); 9796 i += 2; 9797 view.setUint16(i, bitPerPixel, true); 9798 i += 2; 9799 view.setUint32(i, compression, true); 9800 i += 4; 9801 view.setUint32(i, 0, true); 9802 i += 4; 9803 view.setInt32(i, 0, true); 9804 i += 4; 9805 view.setInt32(i, 0, true); 9806 i += 4; 9807 view.setUint32(i, colorTable.length / 4, true); 9808 i += 4; 9809 view.setUint32(i, 0, true); 9810 i += 4; 9811 bmpData.set(maskTable, i); 9812 i += maskTable.length; 9813 bmpData.set(colorTable, i); 9814 i += colorTable.length; 9815 bmpData.set(data, i); 9816 return bmpData; 9817 } 9818} 9819 9820;// ./external/jbig2/jbig2.js 9821 9822 9823 9824 9825 9826 9827 9828 9829 9830 9831
vendor: 9,034 bytes, lines 9832-10133
9832 9833async function JBig2(moduleArg = {}) { 9834 var moduleRtn; 9835 var Module = moduleArg; 9836 var ENVIRONMENT_IS_WEB = true; 9837 var ENVIRONMENT_IS_WORKER = false; 9838 var arguments_ = []; 9839 var thisProgram = "./this.program"; 9840 var quit_ = (status, toThrow) => { 9841 throw toThrow; 9842 }; 9843 var _scriptName = import.meta.url; 9844 var scriptDirectory = ""; 9845 var readAsync, readBinary; 9846 if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { 9847 try { 9848 scriptDirectory = new URL(".", _scriptName).href; 9849 } catch {} 9850 readAsync = async url => { 9851 var response = await fetch(url, { 9852 credentials: "same-origin" 9853 }); 9854 if (response.ok) { 9855 return response.arrayBuffer(); 9856 } 9857 throw new Error(response.status + " : " + response.url); 9858 }; 9859 } else {} 9860 var out = console.log.bind(console); 9861 var err = console.error.bind(console); 9862 var wasmBinary; 9863 var ABORT = false; 9864 var EXITSTATUS; 9865 var readyPromiseResolve, readyPromiseReject; 9866 var HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64; 9867 var HEAP64, HEAPU64; 9868 var runtimeInitialized = false; 9869 function updateMemoryViews() { 9870 var b = wasmMemory.buffer; 9871 HEAP8 = new Int8Array(b); 9872 HEAP16 = new Int16Array(b); 9873 HEAPU8 = new Uint8Array(b); 9874 HEAPU16 = new Uint16Array(b); 9875 HEAP32 = new Int32Array(b); 9876 HEAPU32 = new Uint32Array(b); 9877 HEAPF32 = new Float32Array(b); 9878 HEAPF64 = new Float64Array(b); 9879 HEAP64 = new BigInt64Array(b); 9880 HEAPU64 = new BigUint64Array(b); 9881 } 9882 function preRun() { 9883 if (Module["preRun"]) { 9884 if (typeof Module["preRun"] == "function") Module["preRun"] = [Module["preRun"]]; 9885 while (Module["preRun"].length) { 9886 addOnPreRun(Module["preRun"].shift()); 9887 } 9888 } 9889 callRuntimeCallbacks(onPreRuns); 9890 } 9891 function initRuntime() { 9892 runtimeInitialized = true; 9893 wasmExports["j"](); 9894 } 9895 function postRun() { 9896 if (Module["postRun"]) { 9897 if (typeof Module["postRun"] == "function") Module["postRun"] = [Module["postRun"]]; 9898 while (Module["postRun"].length) { 9899 addOnPostRun(Module["postRun"].shift()); 9900 } 9901 } 9902 callRuntimeCallbacks(onPostRuns); 9903 } 9904 function abort(what) { 9905 Module["onAbort"]?.(what); 9906 what = "Aborted(" + what + ")"; 9907 err(what); 9908 ABORT = true; 9909 what += ". Build with -sASSERTIONS for more info."; 9910 var e = new WebAssembly.RuntimeError(what); 9911 readyPromiseReject?.(e); 9912 throw e; 9913 } 9914 var wasmBinaryFile; 9915 function getWasmImports() { 9916 var imports = { 9917 a: wasmImports 9918 }; 9919 return imports; 9920 } 9921 async function createWasm() { 9922 function receiveInstance(instance, module) { 9923 wasmExports = instance.exports; 9924 assignWasmExports(wasmExports); 9925 updateMemoryViews(); 9926 return wasmExports; 9927 } 9928 var info = getWasmImports(); 9929 return new Promise((resolve, reject) => { 9930 Module["instantiateWasm"](info, (inst, mod) => { 9931 resolve(receiveInstance(inst, mod)); 9932 }); 9933 }); 9934 } 9935 class ExitStatus { 9936 name = "ExitStatus"; 9937 constructor(status) { 9938 this.message = `Program terminated with exit(${status})`; 9939 this.status = status; 9940 } 9941 } 9942 var callRuntimeCallbacks = callbacks => { 9943 while (callbacks.length > 0) { 9944 callbacks.shift()(Module); 9945 } 9946 }; 9947 var onPostRuns = []; 9948 var addOnPostRun = cb => onPostRuns.push(cb); 9949 var onPreRuns = []; 9950 var addOnPreRun = cb => onPreRuns.push(cb); 9951 var noExitRuntime = true; 9952 var __abort_js = () => abort(""); 9953 var runtimeKeepaliveCounter = 0; 9954 var __emscripten_runtime_keepalive_clear = () => { 9955 noExitRuntime = false; 9956 runtimeKeepaliveCounter = 0; 9957 }; 9958 var timers = {}; 9959 var handleException = e => { 9960 if (e instanceof ExitStatus || e == "unwind") { 9961 return EXITSTATUS; 9962 } 9963 quit_(1, e); 9964 }; 9965 var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0; 9966 var _proc_exit = code => { 9967 EXITSTATUS = code; 9968 if (!keepRuntimeAlive()) { 9969 Module["onExit"]?.(code); 9970 ABORT = true; 9971 } 9972 quit_(code, new ExitStatus(code)); 9973 }; 9974 var exitJS = (status, implicit) => { 9975 EXITSTATUS = status; 9976 _proc_exit(status); 9977 }; 9978 var _exit = exitJS; 9979 var maybeExit = () => { 9980 if (!keepRuntimeAlive()) { 9981 try { 9982 _exit(EXITSTATUS); 9983 } catch (e) { 9984 handleException(e); 9985 } 9986 } 9987 }; 9988 var callUserCallback = func => { 9989 if (ABORT) { 9990 return; 9991 } 9992 try { 9993 return func(); 9994 } catch (e) { 9995 handleException(e); 9996 } finally { 9997 maybeExit(); 9998 } 9999 }; 10000 var _emscripten_get_now = () => performance.now(); 10001 var __setitimer_js = (which, timeout_ms) => { 10002 if (timers[which]) { 10003 clearTimeout(timers[which].id); 10004 delete timers[which]; 10005 } 10006 if (!timeout_ms) return 0; 10007 var id = setTimeout(() => { 10008 delete timers[which]; 10009 callUserCallback(() => __emscripten_timeout(which, _emscripten_get_now())); 10010 }, timeout_ms); 10011 timers[which] = { 10012 id, 10013 timeout_ms 10014 }; 10015 return 0; 10016 }; 10017 function _createImageData(size) { 10018 Module.imageData = new Uint8Array(size); 10019 } 10020 var getHeapMax = () => 2147483648; 10021 var alignMemory = (size, alignment) => Math.ceil(size / alignment) * alignment; 10022 var growMemory = size => { 10023 var oldHeapSize = wasmMemory.buffer.byteLength; 10024 var pages = (size - oldHeapSize + 65535) / 65536 | 0; 10025 try { 10026 wasmMemory.grow(pages); 10027 updateMemoryViews(); 10028 return 1; 10029 } catch (e) {} 10030 }; 10031 var _emscripten_resize_heap = requestedSize => { 10032 var oldSize = HEAPU8.length; 10033 requestedSize >>>= 0; 10034 var maxHeapSize = getHeapMax(); 10035 if (requestedSize > maxHeapSize) { 10036 return false; 10037 } 10038 for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { 10039 var overGrownHeapSize = oldSize * (1 + .2 / cutDown); 10040 overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296); 10041 var newSize = Math.min(maxHeapSize, alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536)); 10042 var replacement = growMemory(newSize); 10043 if (replacement) { 10044 return true; 10045 } 10046 } 10047 return false; 10048 }; 10049 function _setImageData(array_ptr, pitch8, pitch32, height) { 10050 if (pitch32 === pitch8) { 10051 Module.imageData = new Uint8ClampedArray(HEAPU8.subarray(array_ptr, array_ptr + pitch32 * height)); 10052 return; 10053 } 10054 const destSize = pitch8 * height; 10055 const imageData = Module.imageData = new Uint8ClampedArray(destSize); 10056 for (let srcStart = array_ptr, destStart = 0; destStart < destSize; srcStart += pitch32, destStart += pitch8) { 10057 imageData.set(HEAPU8.subarray(srcStart, srcStart + pitch8), destStart); 10058 } 10059 } 10060 function _setLineData(line_ptr, pitch8, offset) { 10061 Module.imageData.set(HEAPU8.subarray(line_ptr, line_ptr + pitch8), offset); 10062 } 10063 var writeArrayToMemory = (array, buffer) => { 10064 HEAP8.set(array, buffer); 10065 }; 10066 if (Module["noExitRuntime"]) noExitRuntime = Module["noExitRuntime"]; 10067 if (Module["print"]) out = Module["print"]; 10068 if (Module["printErr"]) err = Module["printErr"]; 10069 if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"]; 10070 if (Module["arguments"]) arguments_ = Module["arguments"]; 10071 if (Module["thisProgram"]) thisProgram = Module["thisProgram"]; 10072 if (Module["preInit"]) { 10073 if (typeof Module["preInit"] == "function") Module["preInit"] = [Module["preInit"]]; 10074 while (Module["preInit"].length > 0) { 10075 Module["preInit"].shift()(); 10076 } 10077 } 10078 Module["writeArrayToMemory"] = writeArrayToMemory; 10079 var _malloc, _free, _jbig2_decode, _ccitt_decode, __emscripten_timeout, memory, __indirect_function_table, wasmMemory; 10080 function assignWasmExports(wasmExports) { 10081 _malloc = Module["_malloc"] = wasmExports["k"]; 10082 _free = Module["_free"] = wasmExports["l"]; 10083 _jbig2_decode = Module["_jbig2_decode"] = wasmExports["m"]; 10084 _ccitt_decode = Module["_ccitt_decode"] = wasmExports["n"]; 10085 __emscripten_timeout = wasmExports["o"]; 10086 memory = wasmMemory = wasmExports["i"]; 10087 __indirect_function_table = wasmExports["__indirect_function_table"]; 10088 } 10089 var wasmImports = { 10090 e: __abort_js, 10091 b: __emscripten_runtime_keepalive_clear, 10092 c: __setitimer_js, 10093 g: _createImageData, 10094 d: _emscripten_resize_heap, 10095 a: _proc_exit, 10096 h: _setImageData, 10097 f: _setLineData 10098 }; 10099 function run() { 10100 preRun(); 10101 function doRun() { 10102 Module["calledRun"] = true; 10103 if (ABORT) return; 10104 initRuntime(); 10105 readyPromiseResolve?.(Module); 10106 Module["onRuntimeInitialized"]?.(); 10107 postRun(); 10108 } 10109 if (Module["setStatus"]) { 10110 Module["setStatus"]("Running..."); 10111 setTimeout(() => { 10112 setTimeout(() => Module["setStatus"](""), 1); 10113 doRun(); 10114 }, 1); 10115 } else { 10116 doRun(); 10117 } 10118 } 10119 var wasmExports; 10120 wasmExports = await createWasm(); 10121 run(); 10122 if (runtimeInitialized) { 10123 moduleRtn = Module; 10124 } else { 10125 moduleRtn = new Promise((resolve, reject) => { 10126 readyPromiseResolve = resolve; 10127 readyPromiseReject = reject; 10128 }); 10129 } 10130 return moduleRtn; 10131} 10132/* harmony default export */ const jbig2 = (JBig2); 10133;// ./src/core/
vendor: 6,483 bytes, lines 10133-10381
10133jbig2_ccittFax.js 10134 10135 10136 10137 10138 10139class Jbig2Error extends BaseException { 10140 constructor(msg) { 10141 super(msg, "Jbig2Error"); 10142 } 10143} 10144class JBig2CCITTFaxImage { 10145 static #buffer = null; 10146 static #handler = null; 10147 static #modulePromise = null; 10148 static #useWasm = true; 10149 static #useWorkerFetch = true; 10150 static #wasmUrl = null; 10151 static setOptions({ 10152 handler, 10153 useWasm, 10154 useWorkerFetch, 10155 wasmUrl 10156 }) { 10157 this.#useWasm = useWasm; 10158 this.#useWorkerFetch = useWorkerFetch; 10159 this.#wasmUrl = wasmUrl; 10160 if (!useWorkerFetch) { 10161 this.#handler = handler; 10162 } 10163 } 10164 static async #getJsModule(fallbackCallback) { 10165 const path = `${this.#wasmUrl}jbig2_nowasm_fallback.js`; 10166 let instance = null; 10167 try { 10168 const mod = await import( 10169 /*webpackIgnore: true*/ 10170 /*@vite-ignore*/ 10171 path); 10172 instance = mod.default(); 10173 } catch (e) { 10174 warn(`JBig2CCITTFaxImage#getJsModule: ${e}`); 10175 } 10176 fallbackCallback(instance); 10177 } 10178 static async #instantiateWasm(fallbackCallback, imports, successCallback) { 10179 const filename = "jbig2.wasm"; 10180 try { 10181 if (!this.#buffer) { 10182 if (this.#useWorkerFetch) { 10183 this.#buffer = await fetchBinaryData(`${this.#wasmUrl}${filename}`); 10184 } else { 10185 this.#buffer = await this.#handler.sendWithPromise("FetchBinaryData", { 10186 kind: "wasmUrl", 10187 filename 10188 }); 10189 } 10190 } 10191 const results = await WebAssembly.instantiate(this.#buffer, imports); 10192 return successCallback(results.instance); 10193 } catch (reason) { 10194 warn(`JBig2CCITTFaxImage#instantiateWasm: ${reason}`); 10195 this.#getJsModule(fallbackCallback); 10196 return null; 10197 } finally { 10198 this.#handler = null; 10199 } 10200 } 10201 static async decode(bytes, width, height, globals, CCITTOptions) { 10202 if (!this.#modulePromise) { 10203 const { 10204 promise, 10205 resolve 10206 } = Promise.withResolvers(); 10207 const promises = [promise]; 10208 if (!this.#useWasm) { 10209 this.#getJsModule(resolve); 10210 } else { 10211 promises.push(jbig2({ 10212 warn: warn, 10213 instantiateWasm: this.#instantiateWasm.bind(this, resolve) 10214 })); 10215 } 10216 this.#modulePromise = Promise.race(promises); 10217 } 10218 const module = await this.#modulePromise; 10219 if (!module) { 10220 throw new Jbig2Error("JBig2 failed to initialize"); 10221 } 10222 let ptr, globalsPtr; 10223 try { 10224 const size = bytes.length; 10225 ptr = module._malloc(size); 10226 module.writeArrayToMemory(bytes, ptr); 10227 if (CCITTOptions) { 10228 module._ccitt_decode(ptr, size, width, height, CCITTOptions.K, CCITTOptions.EndOfLine ? 1 : 0, CCITTOptions.EncodedByteAlign ? 1 : 0, CCITTOptions.BlackIs1 ? 1 : 0, CCITTOptions.Columns, CCITTOptions.Rows); 10229 } else { 10230 const globalsSize = globals ? globals.length : 0; 10231 if (globalsSize > 0) { 10232 globalsPtr = module._malloc(globalsSize); 10233 module.writeArrayToMemory(globals, globalsPtr); 10234 } 10235 module._jbig2_decode(ptr, size, width, height, globalsPtr, globalsSize); 10236 } 10237 if (!module.imageData) { 10238 throw new Jbig2Error("Unknown error"); 10239 } 10240 const { 10241 imageData 10242 } = module; 10243 module.imageData = null; 10244 return imageData; 10245 } finally { 10246 if (ptr) { 10247 module._free(ptr); 10248 } 10249 if (globalsPtr) { 10250 module._free(globalsPtr); 10251 } 10252 } 10253 } 10254 static cleanup() { 10255 this.#modulePromise = null; 10256 } 10257} 10258 10259;// ./src/core/decode_stream.js 10260 10261 10262 10263 10264 10265 10266 10267 10268 10269 10270 10271 10272 10273const emptyBuffer = new Uint8Array(0); 10274class DecodeStream extends BaseStream { 10275 constructor(maybeMinBufferLength) { 10276 super(); 10277 this._rawMinBufferLength = maybeMinBufferLength || 0; 10278 this.pos = 0; 10279 this.bufferLength = 0; 10280 this.eof = false; 10281 this.buffer = emptyBuffer; 10282 this.minBufferLength = 512; 10283 if (maybeMinBufferLength) { 10284 while (this.minBufferLength < maybeMinBufferLength) { 10285 this.minBufferLength *= 2; 10286 } 10287 } 10288 } 10289 get isEmpty() { 10290 while (!this.eof && this.bufferLength === 0) { 10291 this.readBlock(); 10292 } 10293 return this.bufferLength === 0; 10294 } 10295 ensureBuffer(requested) { 10296 const buffer = this.buffer; 10297 if (requested <= buffer.byteLength) { 10298 return buffer; 10299 } 10300 let size = this.minBufferLength; 10301 while (size < requested) { 10302 size *= 2; 10303 } 10304 const buffer2 = new Uint8Array(size); 10305 buffer2.set(buffer); 10306 return this.buffer = buffer2; 10307 } 10308 getByte() { 10309 const pos = this.pos; 10310 while (this.bufferLength <= pos) { 10311 if (this.eof) { 10312 return -1; 10313 } 10314 this.readBlock(); 10315 } 10316 return this.buffer[this.pos++]; 10317 } 10318 getBytes(length, decoderOptions = null) { 10319 const pos = this.pos; 10320 let end; 10321 if (length) { 10322 this.ensureBuffer(pos + length); 10323 end = pos + length; 10324 while (!this.eof && this.bufferLength < end) { 10325 this.readBlock(decoderOptions); 10326 } 10327 const bufEnd = this.bufferLength; 10328 if (end > bufEnd) { 10329 end = bufEnd; 10330 } 10331 } else { 10332 while (!this.eof) { 10333 this.readBlock(decoderOptions); 10334 } 10335 end = this.bufferLength; 10336 } 10337 this.pos = end; 10338 return this.buffer.subarray(pos, end); 10339 } 10340 async getImageData(length, decoderOptions) { 10341 if (!this.canAsyncDecodeImageFromBuffer) { 10342 if (this.isAsyncDecoder) { 10343 return this.decodeImage(null, length, decoderOptions); 10344 } 10345 return this.getBytes(length, decoderOptions); 10346 } 10347 const data = await this.stream.asyncGetBytes(); 10348 return this.decodeImage(data, length, decoderOptions); 10349 } 10350 async asyncGetBytesFromDecompressionStream(name) { 10351 this.stream.reset(); 10352 const bytes = this.stream.isAsync ? await this.stream.asyncGetBytes() : this.stream.getBytes(); 10353 try { 10354 const { 10355 readable, 10356 writable 10357 } = new DecompressionStream(name); 10358 const writer = writable.getWriter(); 10359 await writer.ready; 10360 writer.write(bytes).then(async () => { 10361 await writer.ready; 10362 await writer.close(); 10363 }).catch(() => {}); 10364 const chunks = []; 10365 let totalLength = 0; 10366 for await (const chunk of readable) { 10367 chunks.push(chunk); 10368 totalLength += chunk.byteLength; 10369 } 10370 const data = new Uint8Array(totalLength); 10371 let offset = 0; 10372 for (const chunk of chunks) { 10373 data.set(chunk, offset); 10374 offset += chunk.byteLength; 10375 } 10376 return { 10377 decompressed: data, 10378 compressed: bytes 10379 }; 10380 } catch { 10381 return {
vendor: 18,702 bytes, lines 10382-11032
10382 decompressed: null, 10383 compressed: bytes 10384 }; 10385 } 10386 } 10387 reset() { 10388 this.pos = 0; 10389 } 10390 makeSubStream(start, length, dict = null) { 10391 if (length === undefined) { 10392 while (!this.eof) { 10393 this.readBlock(); 10394 } 10395 } else { 10396 const end = start + length; 10397 while (this.bufferLength <= end && !this.eof) { 10398 this.readBlock(); 10399 } 10400 } 10401 return new Stream(this.buffer, start, length, dict); 10402 } 10403 getBaseStreams() { 10404 return this.stream ? this.stream.getBaseStreams() : null; 10405 } 10406 clone() { 10407 while (!this.eof) { 10408 this.readBlock(); 10409 } 10410 return new Stream(this.buffer, this.start, this.end - this.start, this.dict.clone()); 10411 } 10412} 10413class StreamsSequenceStream extends DecodeStream { 10414 constructor(streams, onError = null) { 10415 streams = streams.filter(s => s instanceof BaseStream && !s.isImageStream); 10416 let maybeLength = 0; 10417 for (const stream of streams) { 10418 maybeLength += stream instanceof DecodeStream ? stream._rawMinBufferLength : stream.length; 10419 } 10420 super(maybeLength); 10421 this.streams = streams; 10422 this._onError = onError; 10423 } 10424 readBlock() { 10425 const streams = this.streams; 10426 if (streams.length === 0) { 10427 this.eof = true; 10428 return; 10429 } 10430 const stream = streams.shift(); 10431 let chunk; 10432 try { 10433 chunk = stream.getBytes(); 10434 } catch (reason) { 10435 if (this._onError) { 10436 this._onError(reason, stream.dict?.objId); 10437 return; 10438 } 10439 throw reason; 10440 } 10441 const bufferLength = this.bufferLength; 10442 const newLength = bufferLength + chunk.length; 10443 const buffer = this.ensureBuffer(newLength); 10444 buffer.set(chunk, bufferLength); 10445 this.bufferLength = newLength; 10446 } 10447 getBaseStreams() { 10448 const baseStreamsBuf = []; 10449 for (const stream of this.streams) { 10450 const baseStreams = stream.getBaseStreams(); 10451 if (baseStreams) { 10452 baseStreamsBuf.push(...baseStreams); 10453 } 10454 } 10455 return baseStreamsBuf.length > 0 ? baseStreamsBuf : null; 10456 } 10457} 10458 10459;// ./src/core/colorspace_utils.js 10460 10461 10462 10463 10464 10465 10466class ColorSpaceUtils { 10467 static parse({ 10468 cs, 10469 xref, 10470 resources = null, 10471 pdfFunctionFactory, 10472 globalColorSpaceCache, 10473 localColorSpaceCache, 10474 asyncIfNotCached = false 10475 }) { 10476 const options = { 10477 xref, 10478 resources, 10479 pdfFunctionFactory, 10480 globalColorSpaceCache, 10481 localColorSpaceCache 10482 }; 10483 let csName, csRef, parsedCS; 10484 if (cs instanceof Ref) { 10485 csRef = cs; 10486 const cachedCS = globalColorSpaceCache.getByRef(csRef) || localColorSpaceCache.getByRef(csRef); 10487 if (cachedCS) { 10488 return cachedCS; 10489 } 10490 cs = xref.fetch(cs); 10491 } 10492 if (cs instanceof Name) { 10493 csName = cs.name; 10494 const cachedCS = localColorSpaceCache.getByName(csName); 10495 if (cachedCS) { 10496 return cachedCS; 10497 } 10498 } 10499 try { 10500 parsedCS = this.#parse(cs, options); 10501 } catch (ex) { 10502 if (asyncIfNotCached && !(ex instanceof MissingDataException)) { 10503 return Promise.reject(ex); 10504 } 10505 throw ex; 10506 } 10507 if (csName || csRef) { 10508 localColorSpaceCache.set(csName, csRef, parsedCS); 10509 if (csRef) { 10510 globalColorSpaceCache.set(null, csRef, parsedCS); 10511 } 10512 } 10513 return asyncIfNotCached ? Promise.resolve(parsedCS) : parsedCS; 10514 } 10515 static #subParse(cs, options) { 10516 const { 10517 globalColorSpaceCache 10518 } = options; 10519 let csRef; 10520 if (cs instanceof Ref) { 10521 csRef = cs; 10522 const cachedCS = globalColorSpaceCache.getByRef(csRef); 10523 if (cachedCS) { 10524 return cachedCS; 10525 } 10526 } 10527 const parsedCS = this.#parse(cs, options); 10528 if (csRef) { 10529 globalColorSpaceCache.set(null, csRef, parsedCS); 10530 } 10531 return parsedCS; 10532 } 10533 static #parse(cs, options) { 10534 const { 10535 xref, 10536 resources, 10537 pdfFunctionFactory, 10538 globalColorSpaceCache 10539 } = options; 10540 cs = xref.fetchIfRef(cs); 10541 if (cs instanceof Name) { 10542 switch (cs.name) { 10543 case "G": 10544 case "DeviceGray": 10545 return this.gray; 10546 case "RGB": 10547 case "DeviceRGB": 10548 return this.rgb; 10549 case "DeviceRGBA": 10550 return this.rgba; 10551 case "CMYK": 10552 case "DeviceCMYK": 10553 return this.cmyk; 10554 case "Pattern": 10555 return new PatternCS(null); 10556 default: 10557 if (resources instanceof Dict) { 10558 const colorSpaces = resources.get("ColorSpace"); 10559 if (colorSpaces instanceof Dict) { 10560 const resourcesCS = colorSpaces.get(cs.name); 10561 if (resourcesCS) { 10562 if (resourcesCS instanceof Name) { 10563 return this.#parse(resourcesCS, options); 10564 } 10565 cs = resourcesCS; 10566 break; 10567 } 10568 } 10569 } 10570 warn(`Unrecognized ColorSpace: ${cs.name}`); 10571 return this.gray; 10572 } 10573 } 10574 if (Array.isArray(cs)) { 10575 const mode = xref.fetchIfRef(cs[0]).name; 10576 let params, numComps, baseCS, whitePoint, blackPoint, gamma; 10577 switch (mode) { 10578 case "G": 10579 case "DeviceGray": 10580 return this.gray; 10581 case "RGB": 10582 case "DeviceRGB": 10583 return this.rgb; 10584 case "CMYK": 10585 case "DeviceCMYK": 10586 return this.cmyk; 10587 case "CalGray": 10588 params = xref.fetchIfRef(cs[1]); 10589 whitePoint = params.getArray("WhitePoint"); 10590 blackPoint = params.getArray("BlackPoint"); 10591 gamma = params.get("Gamma"); 10592 return new CalGrayCS(whitePoint, blackPoint, gamma); 10593 case "CalRGB": 10594 params = xref.fetchIfRef(cs[1]); 10595 whitePoint = params.getArray("WhitePoint"); 10596 blackPoint = params.getArray("BlackPoint"); 10597 gamma = params.getArray("Gamma"); 10598 const matrix = params.getArray("Matrix"); 10599 return new CalRGBCS(whitePoint, blackPoint, gamma, matrix); 10600 case "ICCBased": 10601 const isRef = cs[1] instanceof Ref; 10602 if (isRef) { 10603 const cachedCS = globalColorSpaceCache.getByRef(cs[1]); 10604 if (cachedCS) { 10605 return cachedCS; 10606 } 10607 } 10608 const stream = xref.fetchIfRef(cs[1]); 10609 const dict = stream.dict; 10610 numComps = dict.get("N"); 10611 if (IccColorSpace.isUsable) { 10612 try { 10613 const iccCS = new IccColorSpace(stream.getBytes(), "ICCBased", numComps); 10614 if (isRef) { 10615 globalColorSpaceCache.set(null, cs[1], iccCS); 10616 } 10617 return iccCS; 10618 } catch (ex) { 10619 if (ex instanceof MissingDataException) { 10620 throw ex; 10621 } 10622 warn(`ICCBased color space (${cs[1]}): "${ex}".`); 10623 } 10624 } 10625 const altRaw = dict.getRaw("Alternate"); 10626 if (altRaw) { 10627 const altCS = this.#subParse(altRaw, options); 10628 if (altCS.numComps === numComps) { 10629 return altCS; 10630 } 10631 warn("ICCBased color space: Ignoring incorrect /Alternate entry."); 10632 } 10633 if (numComps === 1) { 10634 return this.gray; 10635 } else if (numComps === 3) { 10636 return this.rgb; 10637 } else if (numComps === 4) { 10638 return this.cmyk; 10639 } 10640 break; 10641 case "Pattern": 10642 baseCS = cs[1] || null; 10643 if (baseCS) { 10644 baseCS = this.#subParse(baseCS, options); 10645 } 10646 return new PatternCS(baseCS); 10647 case "I": 10648 case "Indexed": 10649 baseCS = this.#subParse(cs[1], options); 10650 const hiVal = MathClamp(xref.fetchIfRef(cs[2]), 0, 255); 10651 const lookup = xref.fetchIfRef(cs[3]); 10652 return new IndexedCS(baseCS, hiVal, lookup); 10653 case "Separation": 10654 case "DeviceN": 10655 const name = xref.fetchIfRef(cs[1]); 10656 numComps = Array.isArray(name) ? name.length : 1; 10657 baseCS = this.#subParse(cs[2], options); 10658 const tintFn = pdfFunctionFactory.create(cs[3]); 10659 return new AlternateCS(numComps, baseCS, tintFn); 10660 case "Lab": 10661 params = xref.fetchIfRef(cs[1]); 10662 whitePoint = params.getArray("WhitePoint"); 10663 blackPoint = params.getArray("BlackPoint"); 10664 const range = params.getArray("Range"); 10665 return new LabCS(whitePoint, blackPoint, range); 10666 default: 10667 warn(`Unimplemented ColorSpace object: ${mode}`); 10668 return this.gray; 10669 } 10670 } 10671 warn(`Unrecognized ColorSpace object: ${cs}`); 10672 return this.gray; 10673 } 10674 static get gray() { 10675 return shadow(this, "gray", new DeviceGrayCS()); 10676 } 10677 static get rgb() { 10678 return shadow(this, "rgb", new DeviceRgbCS()); 10679 } 10680 static get rgba() { 10681 return shadow(this, "rgba", new DeviceRgbaCS()); 10682 } 10683 static get cmyk() { 10684 if (CmykICCBasedCS.isUsable) { 10685 try { 10686 return shadow(this, "cmyk", new CmykICCBasedCS()); 10687 } catch { 10688 warn("CMYK fallback: DeviceCMYK"); 10689 } 10690 } 10691 return shadow(this, "cmyk", new DeviceCmykCS()); 10692 } 10693} 10694 10695;// ./src/core/jpg.js 10696 10697 10698 10699 10700 10701 10702 10703 10704 10705 10706 10707 10708 10709class JpegError extends BaseException { 10710 constructor(msg) { 10711 super(msg, "JpegError"); 10712 } 10713} 10714class DNLMarkerError extends BaseException { 10715 constructor(message, scanLines) { 10716 super(message, "DNLMarkerError"); 10717 this.scanLines = scanLines; 10718 } 10719} 10720class EOIMarkerError extends BaseException { 10721 constructor(msg) { 10722 super(msg, "EOIMarkerError"); 10723 } 10724} 10725const dctZigZag = new Uint8Array([0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63]); 10726const dctCos1 = 4017; 10727const dctSin1 = 799; 10728const dctCos3 = 3406; 10729const dctSin3 = 2276; 10730const dctCos6 = 1567; 10731const dctSin6 = 3784; 10732const dctSqrt2 = 5793; 10733const dctSqrt1d2 = 2896; 10734function buildHuffmanTable(codeLengths, values) { 10735 let k = 0, 10736 i, 10737 j, 10738 length = 16; 10739 while (length > 0 && !codeLengths[length - 1]) { 10740 length--; 10741 } 10742 const code = [{ 10743 children: [], 10744 index: 0 10745 }]; 10746 let p = code[0], 10747 q; 10748 for (i = 0; i < length; i++) { 10749 for (j = 0; j < codeLengths[i]; j++) { 10750 p = code.pop(); 10751 p.children[p.index] = values[k]; 10752 while (p.index > 0) { 10753 p = code.pop(); 10754 } 10755 p.index++; 10756 code.push(p); 10757 while (code.length <= i) { 10758 code.push(q = { 10759 children: [], 10760 index: 0 10761 }); 10762 p.children[p.index] = q.children; 10763 p = q; 10764 } 10765 k++; 10766 } 10767 if (i + 1 < length) { 10768 code.push(q = { 10769 children: [], 10770 index: 0 10771 }); 10772 p.children[p.index] = q.children; 10773 p = q; 10774 } 10775 } 10776 return code[0].children; 10777} 10778function getBlockBufferOffset(component, row, col) { 10779 return 64 * ((component.blocksPerLine + 1) * row + col); 10780} 10781function decodeScan(data, view, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, parseDNLMarker = false) { 10782 const mcusPerLine = frame.mcusPerLine; 10783 const progressive = frame.progressive; 10784 const startOffset = offset; 10785 let bitsData = 0, 10786 bitsCount = 0; 10787 function readBit() { 10788 if (bitsCount > 0) { 10789 bitsCount--; 10790 return bitsData >> bitsCount & 1; 10791 } 10792 bitsData = data[offset++]; 10793 if (bitsData === 0xff) { 10794 const nextByte = data[offset++]; 10795 if (nextByte) { 10796 if (nextByte === 0xdc && parseDNLMarker) { 10797 offset += 2; 10798 const scanLines = view.getUint16(offset); 10799 offset += 2; 10800 if (scanLines > 0 && scanLines !== frame.scanLines) { 10801 throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines); 10802 } 10803 } else if (nextByte === 0xd9) { 10804 if (parseDNLMarker) { 10805 const maybeScanLines = blockRow * (frame.precision === 8 ? 8 : 0); 10806 if (maybeScanLines > 0 && Math.round(frame.scanLines / maybeScanLines) >= 5) { 10807 throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines); 10808 } 10809 } 10810 throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data"); 10811 } 10812 throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`); 10813 } 10814 } 10815 bitsCount = 7; 10816 return bitsData >>> 7; 10817 } 10818 function decodeHuffman(tree) { 10819 let node = tree; 10820 while (true) { 10821 node = node[readBit()]; 10822 switch (typeof node) { 10823 case "number": 10824 return node; 10825 case "object": 10826 continue; 10827 } 10828 throw new JpegError("invalid huffman sequence"); 10829 } 10830 } 10831 function receive(length) { 10832 let n = 0; 10833 while (length > 0) { 10834 n = n << 1 | readBit(); 10835 length--; 10836 } 10837 return n; 10838 } 10839 function receiveAndExtend(length) { 10840 if (length === 1) { 10841 return readBit() === 1 ? 1 : -1; 10842 } 10843 const n = receive(length); 10844 if (n >= 1 << length - 1) { 10845 return n; 10846 } 10847 return n + (-1 << length) + 1; 10848 } 10849 function decodeBaseline(component, blockOffset) { 10850 const t = decodeHuffman(component.huffmanTableDC); 10851 const diff = t === 0 ? 0 : receiveAndExtend(t); 10852 component.blockData[blockOffset] = component.pred += diff; 10853 let k = 1; 10854 while (k < 64) { 10855 const rs = decodeHuffman(component.huffmanTableAC); 10856 const s = rs & 15, 10857 r = rs >> 4; 10858 if (s === 0) { 10859 if (r < 15) { 10860 break; 10861 } 10862 k += 16; 10863 continue; 10864 } 10865 k += r; 10866 const z = dctZigZag[k]; 10867 component.blockData[blockOffset + z] = receiveAndExtend(s); 10868 k++; 10869 } 10870 } 10871 function decodeDCFirst(component, blockOffset) { 10872 const t = decodeHuffman(component.huffmanTableDC); 10873 const diff = t === 0 ? 0 : receiveAndExtend(t) << successive; 10874 component.blockData[blockOffset] = component.pred += diff; 10875 } 10876 function decodeDCSuccessive(component, blockOffset) { 10877 component.blockData[blockOffset] |= readBit() << successive; 10878 } 10879 let eobrun = 0; 10880 function decodeACFirst(component, blockOffset) { 10881 if (eobrun > 0) { 10882 eobrun--; 10883 return; 10884 } 10885 let k = spectralStart; 10886 const e = spectralEnd; 10887 while (k <= e) { 10888 const rs = decodeHuffman(component.huffmanTableAC); 10889 const s = rs & 15, 10890 r = rs >> 4; 10891 if (s === 0) { 10892 if (r < 15) { 10893 eobrun = receive(r) + (1 << r) - 1; 10894 break; 10895 } 10896 k += 16; 10897 continue; 10898 } 10899 k += r; 10900 const z = dctZigZag[k]; 10901 component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive); 10902 k++; 10903 } 10904 } 10905 let successiveACState = 0, 10906 successiveACNextValue; 10907 function decodeACSuccessive(component, blockOffset) { 10908 let k = spectralStart; 10909 const e = spectralEnd; 10910 let r = 0; 10911 let s; 10912 let rs; 10913 while (k <= e) { 10914 const offsetZ = blockOffset + dctZigZag[k]; 10915 const sign = component.blockData[offsetZ] < 0 ? -1 : 1; 10916 switch (successiveACState) { 10917 case 0: 10918 rs = decodeHuffman(component.huffmanTableAC); 10919 s = rs & 15; 10920 r = rs >> 4; 10921 if (s === 0) { 10922 if (r < 15) { 10923 eobrun = receive(r) + (1 << r); 10924 successiveACState = 4; 10925 } else { 10926 r = 16; 10927 successiveACState = 1; 10928 } 10929 } else { 10930 if (s !== 1) { 10931 throw new JpegError("invalid ACn encoding"); 10932 } 10933 successiveACNextValue = receiveAndExtend(s); 10934 successiveACState = r ? 2 : 3; 10935 } 10936 continue; 10937 case 1: 10938 case 2: 10939 if (component.blockData[offsetZ]) { 10940 component.blockData[offsetZ] += sign * (readBit() << successive); 10941 } else { 10942 r--; 10943 if (r === 0) { 10944 successiveACState = successiveACState === 2 ? 3 : 0; 10945 } 10946 } 10947 break; 10948 case 3: 10949 if (component.blockData[offsetZ]) { 10950 component.blockData[offsetZ] += sign * (readBit() << successive); 10951 } else { 10952 component.blockData[offsetZ] = successiveACNextValue << successive; 10953 successiveACState = 0; 10954 } 10955 break; 10956 case 4: 10957 if (component.blockData[offsetZ]) { 10958 component.blockData[offsetZ] += sign * (readBit() << successive); 10959 } 10960 break; 10961 } 10962 k++; 10963 } 10964 if (successiveACState === 4) { 10965 eobrun--; 10966 if (eobrun === 0) { 10967 successiveACState = 0; 10968 } 10969 } 10970 } 10971 let blockRow = 0; 10972 function decodeMcu(component, decode, mcu, row, col) { 10973 const mcuRow = mcu / mcusPerLine | 0; 10974 const mcuCol = mcu % mcusPerLine; 10975 blockRow = mcuRow * component.v + row; 10976 const blockCol = mcuCol * component.h + col; 10977 const blockOffset = getBlockBufferOffset(component, blockRow, blockCol); 10978 decode(component, blockOffset); 10979 } 10980 function decodeBlock(component, decode, mcu) { 10981 blockRow = mcu / component.blocksPerLine | 0; 10982 const blockCol = mcu % component.blocksPerLine; 10983 const blockOffset = getBlockBufferOffset(component, blockRow, blockCol); 10984 decode(component, blockOffset); 10985 } 10986 const componentsLength = components.length; 10987 let component, i, j, k, n; 10988 let decodeFn; 10989 if (progressive) { 10990 if (spectralStart === 0) { 10991 decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive; 10992 } else { 10993 decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive; 10994 } 10995 } else { 10996 decodeFn = decodeBaseline; 10997 } 10998 let mcu = 0, 10999 fileMarker; 11000 const mcuExpected = componentsLength === 1 ? components[0].blocksPerLine * components[0].blocksPerColumn : mcusPerLine * frame.mcusPerColumn; 11001 let h, v; 11002 while (mcu <= mcuExpected) { 11003 const mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected; 11004 if (mcuToRead > 0) { 11005 for (i = 0; i < componentsLength; i++) { 11006 components[i].pred = 0; 11007 } 11008 eobrun = 0; 11009 if (componentsLength === 1) { 11010 component = components[0]; 11011 for (n = 0; n < mcuToRead; n++) { 11012 decodeBlock(component, decodeFn, mcu); 11013 mcu++; 11014 } 11015 } else { 11016 for (n = 0; n < mcuToRead; n++) { 11017 for (i = 0; i < componentsLength; i++) { 11018 component = components[i]; 11019 h = component.h; 11020 v = component.v; 11021 for (j = 0; j < v; j++) { 11022 for (k = 0; k < h; k++) { 11023 decodeMcu(component, decodeFn, mcu, j, k); 11024 } 11025 } 11026 } 11027 mcu++; 11028 } 11029 } 11030 } 11031 bitsCount = 0; 11032 fileMarker = findNextFileMarker(data, view
vendor: 4,100 bytes, lines 11032-11172
11032, offset); 11033 if (!fileMarker) { 11034 break; 11035 } 11036 if (fileMarker.invalid) { 11037 const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive"; 11038 warn(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`); 11039 offset = fileMarker.offset; 11040 } 11041 if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) { 11042 offset += 2; 11043 } else { 11044 break; 11045 } 11046 } 11047 return offset - startOffset; 11048} 11049function quantizeAndInverse(component, blockBufferOffset, p) { 11050 const qt = component.quantizationTable, 11051 blockData = component.blockData; 11052 let v0, v1, v2, v3, v4, v5, v6, v7; 11053 let p0, p1, p2, p3, p4, p5, p6, p7; 11054 let t; 11055 if (!qt) { 11056 throw new JpegError("missing required Quantization Table."); 11057 } 11058 for (let row = 0; row < 64; row += 8) { 11059 p0 = blockData[blockBufferOffset + row]; 11060 p1 = blockData[blockBufferOffset + row + 1]; 11061 p2 = blockData[blockBufferOffset + row + 2]; 11062 p3 = blockData[blockBufferOffset + row + 3]; 11063 p4 = blockData[blockBufferOffset + row + 4]; 11064 p5 = blockData[blockBufferOffset + row + 5]; 11065 p6 = blockData[blockBufferOffset + row + 6]; 11066 p7 = blockData[blockBufferOffset + row + 7]; 11067 p0 *= qt[row]; 11068 if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) { 11069 t = dctSqrt2 * p0 + 512 >> 10; 11070 p[row] = t; 11071 p[row + 1] = t; 11072 p[row + 2] = t; 11073 p[row + 3] = t; 11074 p[row + 4] = t; 11075 p[row + 5] = t; 11076 p[row + 6] = t; 11077 p[row + 7] = t; 11078 continue; 11079 } 11080 p1 *= qt[row + 1]; 11081 p2 *= qt[row + 2]; 11082 p3 *= qt[row + 3]; 11083 p4 *= qt[row + 4]; 11084 p5 *= qt[row + 5]; 11085 p6 *= qt[row + 6]; 11086 p7 *= qt[row + 7]; 11087 v0 = dctSqrt2 * p0 + 128 >> 8; 11088 v1 = dctSqrt2 * p4 + 128 >> 8; 11089 v2 = p2; 11090 v3 = p6; 11091 v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8; 11092 v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8; 11093 v5 = p3 << 4; 11094 v6 = p5 << 4; 11095 v0 = v0 + v1 + 1 >> 1; 11096 v1 = v0 - v1; 11097 t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8; 11098 v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8; 11099 v3 = t; 11100 v4 = v4 + v6 + 1 >> 1; 11101 v6 = v4 - v6; 11102 v7 = v7 + v5 + 1 >> 1; 11103 v5 = v7 - v5; 11104 v0 = v0 + v3 + 1 >> 1; 11105 v3 = v0 - v3; 11106 v1 = v1 + v2 + 1 >> 1; 11107 v2 = v1 - v2; 11108 t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12; 11109 v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12; 11110 v7 = t; 11111 t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12; 11112 v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12; 11113 v6 = t; 11114 p[row] = v0 + v7; 11115 p[row + 7] = v0 - v7; 11116 p[row + 1] = v1 + v6; 11117 p[row + 6] = v1 - v6; 11118 p[row + 2] = v2 + v5; 11119 p[row + 5] = v2 - v5; 11120 p[row + 3] = v3 + v4; 11121 p[row + 4] = v3 - v4; 11122 } 11123 for (let col = 0; col < 8; ++col) { 11124 p0 = p[col]; 11125 p1 = p[col + 8]; 11126 p2 = p[col + 16]; 11127 p3 = p[col + 24]; 11128 p4 = p[col + 32]; 11129 p5 = p[col + 40]; 11130 p6 = p[col + 48]; 11131 p7 = p[col + 56]; 11132 if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) { 11133 t = dctSqrt2 * p0 + 8192 >> 14; 11134 if (t < -2040) { 11135 t = 0; 11136 } else if (t >= 2024) { 11137 t = 255; 11138 } else { 11139 t = t + 2056 >> 4; 11140 } 11141 blockData[blockBufferOffset + col] = t; 11142 blockData[blockBufferOffset + col + 8] = t; 11143 blockData[blockBufferOffset + col + 16] = t; 11144 blockData[blockBufferOffset + col + 24] = t; 11145 blockData[blockBufferOffset + col + 32] = t; 11146 blockData[blockBufferOffset + col + 40] = t; 11147 blockData[blockBufferOffset + col + 48] = t; 11148 blockData[blockBufferOffset + col + 56] = t; 11149 continue; 11150 } 11151 v0 = dctSqrt2 * p0 + 2048 >> 12; 11152 v1 = dctSqrt2 * p4 + 2048 >> 12; 11153 v2 = p2; 11154 v3 = p6; 11155 v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12; 11156 v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12; 11157 v5 = p3; 11158 v6 = p5; 11159 v0 = (v0 + v1 + 1 >> 1) + 4112; 11160 v1 = v0 - v1; 11161 t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12; 11162 v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12; 11163 v3 = t; 11164 v4 = v4 + v6 + 1 >> 1; 11165 v6 = v4 - v6; 11166 v7 = v7 + v5 + 1 >> 1; 11167 v5 = v7 - v5; 11168 v0 = v0 + v3 + 1 >> 1; 11169 v3 = v0 - v3; 11170 v1 = v1 + v2 + 1 >> 1; 11171 v2 = v1 - v2; 11172 t = v4 * dctSin3 + v7 * dctCos3 + 2048 >>
vendor: 4,581 bytes, lines 11172-11334
11172 12; 11173 v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12; 11174 v7 = t; 11175 t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12; 11176 v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12; 11177 v6 = t; 11178 p0 = v0 + v7; 11179 p7 = v0 - v7; 11180 p1 = v1 + v6; 11181 p6 = v1 - v6; 11182 p2 = v2 + v5; 11183 p5 = v2 - v5; 11184 p3 = v3 + v4; 11185 p4 = v3 - v4; 11186 if (p0 < 16) { 11187 p0 = 0; 11188 } else if (p0 >= 4080) { 11189 p0 = 255; 11190 } else { 11191 p0 >>= 4; 11192 } 11193 if (p1 < 16) { 11194 p1 = 0; 11195 } else if (p1 >= 4080) { 11196 p1 = 255; 11197 } else { 11198 p1 >>= 4; 11199 } 11200 if (p2 < 16) { 11201 p2 = 0; 11202 } else if (p2 >= 4080) { 11203 p2 = 255; 11204 } else { 11205 p2 >>= 4; 11206 } 11207 if (p3 < 16) { 11208 p3 = 0; 11209 } else if (p3 >= 4080) { 11210 p3 = 255; 11211 } else { 11212 p3 >>= 4; 11213 } 11214 if (p4 < 16) { 11215 p4 = 0; 11216 } else if (p4 >= 4080) { 11217 p4 = 255; 11218 } else { 11219 p4 >>= 4; 11220 } 11221 if (p5 < 16) { 11222 p5 = 0; 11223 } else if (p5 >= 4080) { 11224 p5 = 255; 11225 } else { 11226 p5 >>= 4; 11227 } 11228 if (p6 < 16) { 11229 p6 = 0; 11230 } else if (p6 >= 4080) { 11231 p6 = 255; 11232 } else { 11233 p6 >>= 4; 11234 } 11235 if (p7 < 16) { 11236 p7 = 0; 11237 } else if (p7 >= 4080) { 11238 p7 = 255; 11239 } else { 11240 p7 >>= 4; 11241 } 11242 blockData[blockBufferOffset + col] = p0; 11243 blockData[blockBufferOffset + col + 8] = p1; 11244 blockData[blockBufferOffset + col + 16] = p2; 11245 blockData[blockBufferOffset + col + 24] = p3; 11246 blockData[blockBufferOffset + col + 32] = p4; 11247 blockData[blockBufferOffset + col + 40] = p5; 11248 blockData[blockBufferOffset + col + 48] = p6; 11249 blockData[blockBufferOffset + col + 56] = p7; 11250 } 11251} 11252function buildComponentData(frame, component) { 11253 const blocksPerLine = component.blocksPerLine; 11254 const blocksPerColumn = component.blocksPerColumn; 11255 const computationBuffer = new Int16Array(64); 11256 for (let blockRow = 0; blockRow < blocksPerColumn; blockRow++) { 11257 for (let blockCol = 0; blockCol < blocksPerLine; blockCol++) { 11258 const offset = getBlockBufferOffset(component, blockRow, blockCol); 11259 quantizeAndInverse(component, offset, computationBuffer); 11260 } 11261 } 11262 return component.blockData; 11263} 11264function findNextFileMarker(data, view, currentPos, startPos = currentPos) { 11265 const maxPos = data.length - 1; 11266 let newPos = startPos < currentPos ? startPos : currentPos; 11267 if (currentPos >= maxPos) { 11268 return null; 11269 } 11270 const currentMarker = view.getUint16(currentPos); 11271 if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) { 11272 return { 11273 invalid: null, 11274 marker: currentMarker, 11275 offset: currentPos 11276 }; 11277 } 11278 let newMarker = view.getUint16(newPos); 11279 while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) { 11280 if (++newPos >= maxPos) { 11281 return null; 11282 } 11283 newMarker = view.getUint16(newPos); 11284 } 11285 return { 11286 invalid: currentMarker.toString(16), 11287 marker: newMarker, 11288 offset: newPos 11289 }; 11290} 11291function prepareComponents(frame) { 11292 const mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH); 11293 const mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV); 11294 for (const component of frame.components) { 11295 const blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH); 11296 const blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV); 11297 const blocksPerLineForMcu = mcusPerLine * component.h; 11298 const blocksPerColumnForMcu = mcusPerColumn * component.v; 11299 const blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1); 11300 component.blockData = new Int16Array(blocksBufferSize); 11301 component.blocksPerLine = blocksPerLine; 11302 component.blocksPerColumn = blocksPerColumn; 11303 } 11304 frame.mcusPerLine = mcusPerLine; 11305 frame.mcusPerColumn = mcusPerColumn; 11306} 11307function readDataBlock(data, view, offset) { 11308 const length = view.getUint16(offset); 11309 offset += 2; 11310 let endOffset = offset + length - 2; 11311 const fileMarker = findNextFileMarker(data, view, endOffset, offset); 11312 if (fileMarker?.invalid) { 11313 warn("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid); 11314 endOffset = fileMarker.offset; 11315 } 11316 const array = data.subarray(offset, endOffset); 11317 return { 11318 appData: array, 11319 oldOffset: offset, 11320 newOffset: offset + array.length 11321 }; 11322} 11323function skipData(data, view, offset) { 11324 const length = view.getUint16(offset); 11325 offset += 2; 11326 const endOffset = offset + length - 2; 11327 const fileMarker = findNextFileMarker(data, view, endOffset, offset); 11328 if (fileMarker?.invalid) { 11329 return fileMarker.offset; 11330 } 11331 return endOffset; 11332} 11333class JpegImage { 11334 constructor(
11334{ 11335 decodeTransform = null, 11336 colorTransform = -1 11337 } = {}) { 11338 this._decodeTransform = decodeTransform; 11339 this._colorTransform = colorTransform; 11340 } 11341 static canUseImageDecoder(data, colorTransform = -1) { 11342 const view = new DataView(data.buffer, data.byteOffset, data.byteLength); 11343 let exifOffsets = null; 11344 let offset = 0; 11345 let numComponents = null; 11346 let fileMarker = view.getUint16(offset); 11347 offset += 2; 11348 if (fileMarker !== 0xffd8) { 11349 throw new JpegError("SOI not found"); 11350 } 11351 fileMarker = view.getUint16(offset); 11352 offset += 2; 11353 markerLoop: while (fileMarker !== 0xffd9) { 11354 switch (fileMarker) { 11355 case 0xffe1: 11356 const { 11357 appData, 11358 oldOffset, 11359 newOffset 11360 } = readDataBlock(data, view, offset); 11361 offset = newOffset; 11362 if (appData[0] === 0x45 && appData[1] === 0x78 && appData[2] === 0x69 && appData[3] === 0x66 && appData[4] === 0 && appData[5] === 0) { 11363 if (exifOffsets) {
vendor: 8,033 bytes, lines 11364-11590
11364 throw new JpegError("Duplicate EXIF-blocks found."); 11365 } 11366 exifOffsets = { 11367 exifStart: oldOffset + 6, 11368 exifEnd: newOffset 11369 }; 11370 } 11371 fileMarker = view.getUint16(offset); 11372 offset += 2; 11373 continue; 11374 case 0xffc0: 11375 case 0xffc1: 11376 case 0xffc2: 11377 numComponents = data[offset + (2 + 1 + 2 + 2)]; 11378 break markerLoop; 11379 case 0xffff: 11380 if (data[offset] !== 0xff) { 11381 offset--; 11382 } 11383 break; 11384 } 11385 offset = skipData(data, view, offset); 11386 fileMarker = view.getUint16(offset); 11387 offset += 2; 11388 } 11389 if (numComponents === 4) { 11390 return null; 11391 } 11392 if (numComponents === 3 && colorTransform === 0) { 11393 return null; 11394 } 11395 return exifOffsets || {}; 11396 } 11397 parse(data, { 11398 dnlScanLines = null 11399 } = {}) { 11400 const view = new DataView(data.buffer, data.byteOffset, data.byteLength); 11401 const maxOffset = data.length - 1; 11402 let offset = 0; 11403 let jfif = null; 11404 let adobe = null; 11405 let frame, resetInterval; 11406 let numSOSMarkers = 0; 11407 const quantizationTables = []; 11408 const huffmanTablesAC = [], 11409 huffmanTablesDC = []; 11410 let fileMarker = view.getUint16(offset); 11411 offset += 2; 11412 if (fileMarker !== 0xffd8) { 11413 throw new JpegError("SOI not found"); 11414 } 11415 fileMarker = view.getUint16(offset); 11416 offset += 2; 11417 markerLoop: while (fileMarker !== 0xffd9) { 11418 let i, j, l; 11419 switch (fileMarker) { 11420 case 0xffe0: 11421 case 0xffe1: 11422 case 0xffe2: 11423 case 0xffe3: 11424 case 0xffe4: 11425 case 0xffe5: 11426 case 0xffe6: 11427 case 0xffe7: 11428 case 0xffe8: 11429 case 0xffe9: 11430 case 0xffea: 11431 case 0xffeb: 11432 case 0xffec: 11433 case 0xffed: 11434 case 0xffee: 11435 case 0xffef: 11436 case 0xfffe: 11437 const { 11438 appData, 11439 newOffset 11440 } = readDataBlock(data, view, offset); 11441 offset = newOffset; 11442 if (fileMarker === 0xffe0) { 11443 if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) { 11444 jfif = { 11445 version: { 11446 major: appData[5], 11447 minor: appData[6] 11448 }, 11449 densityUnits: appData[7], 11450 xDensity: appData[8] << 8 | appData[9], 11451 yDensity: appData[10] << 8 | appData[11], 11452 thumbWidth: appData[12], 11453 thumbHeight: appData[13], 11454 thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13]) 11455 }; 11456 } 11457 } 11458 if (fileMarker === 0xffee) { 11459 if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) { 11460 adobe = { 11461 version: appData[5] << 8 | appData[6], 11462 flags0: appData[7] << 8 | appData[8], 11463 flags1: appData[9] << 8 | appData[10], 11464 transformCode: appData[11] 11465 }; 11466 } 11467 } 11468 break; 11469 case 0xffdb: 11470 const quantizationTablesLength = view.getUint16(offset); 11471 offset += 2; 11472 const quantizationTablesEnd = quantizationTablesLength + offset - 2; 11473 let z; 11474 while (offset < quantizationTablesEnd) { 11475 const quantizationTableSpec = data[offset++]; 11476 const tableData = new Uint16Array(64); 11477 if (quantizationTableSpec >> 4 === 0) { 11478 for (j = 0; j < 64; j++) { 11479 z = dctZigZag[j]; 11480 tableData[z] = data[offset++]; 11481 } 11482 } else if (quantizationTableSpec >> 4 === 1) { 11483 for (j = 0; j < 64; j++) { 11484 z = dctZigZag[j]; 11485 tableData[z] = view.getUint16(offset); 11486 offset += 2; 11487 } 11488 } else { 11489 throw new JpegError("DQT - invalid table spec"); 11490 } 11491 quantizationTables[quantizationTableSpec & 15] = tableData; 11492 } 11493 break; 11494 case 0xffc0: 11495 case 0xffc1: 11496 case 0xffc2: 11497 if (frame) { 11498 throw new JpegError("Only single frame JPEGs supported"); 11499 } 11500 offset += 2; 11501 frame = {}; 11502 frame.extended = fileMarker === 0xffc1; 11503 frame.progressive = fileMarker === 0xffc2; 11504 frame.precision = data[offset++]; 11505 const sofScanLines = view.getUint16(offset); 11506 offset += 2; 11507 frame.scanLines = dnlScanLines || sofScanLines; 11508 frame.samplesPerLine = view.getUint16(offset); 11509 offset += 2; 11510 frame.components = []; 11511 frame.componentIds = {}; 11512 const componentsCount = data[offset++]; 11513 let maxH = 0, 11514 maxV = 0; 11515 for (i = 0; i < componentsCount; i++) { 11516 const componentId = data[offset]; 11517 const h = data[offset + 1] >> 4; 11518 const v = data[offset + 1] & 15; 11519 if (maxH < h) { 11520 maxH = h; 11521 } 11522 if (maxV < v) { 11523 maxV = v; 11524 } 11525 const qId = data[offset + 2]; 11526 l = frame.components.push({ 11527 h, 11528 v, 11529 quantizationId: qId, 11530 quantizationTable: null 11531 }); 11532 frame.componentIds[componentId] = l - 1; 11533 offset += 3; 11534 } 11535 frame.maxH = maxH; 11536 frame.maxV = maxV; 11537 prepareComponents(frame); 11538 break; 11539 case 0xffc4: 11540 const huffmanLength = view.getUint16(offset); 11541 offset += 2; 11542 for (i = 2; i < huffmanLength;) { 11543 const huffmanTableSpec = data[offset++]; 11544 const codeLengths = new Uint8Array(16); 11545 let codeLengthSum = 0; 11546 for (j = 0; j < 16; j++, offset++) { 11547 codeLengthSum += codeLengths[j] = data[offset]; 11548 } 11549 const huffmanValues = new Uint8Array(codeLengthSum); 11550 for (j = 0; j < codeLengthSum; j++, offset++) { 11551 huffmanValues[j] = data[offset]; 11552 } 11553 i += 17 + codeLengthSum; 11554 (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues); 11555 } 11556 break; 11557 case 0xffdd: 11558 offset += 2; 11559 resetInterval = view.getUint16(offset); 11560 offset += 2; 11561 break; 11562 case 0xffda: 11563 const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines; 11564 offset += 2; 11565 const selectorsCount = data[offset++], 11566 components = []; 11567 for (i = 0; i < selectorsCount; i++) { 11568 const index = data[offset++]; 11569 const componentIndex = frame.componentIds[index]; 11570 const component = frame.components[componentIndex]; 11571 component.index = index; 11572 const tableSpec = data[offset++]; 11573 component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4]; 11574 component.huffmanTableAC = huffmanTablesAC[tableSpec & 15]; 11575 components.push(component); 11576 } 11577 const spectralStart = data[offset++], 11578 spectralEnd = data[offset++], 11579 successiveApproximation = data[offset++]; 11580 try { 11581 const processed = decodeScan(data, view, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker); 11582 offset += processed; 11583 } catch (ex) { 11584 if (ex instanceof DNLMarkerError) { 11585 warn(`${ex.message} -- attempting to re-parse the JPEG image.`); 11586 return this.parse(data, { 11587 dnlScanLines: ex.scanLines 11588 }); 11589 } else if (ex instanceof EOIMarkerError) { 11590 warn(`${ex.message} -- ignoring the rest of the image data.`);
vendor: 15,230 bytes, lines 11591-12107
11591 break markerLoop; 11592 } 11593 throw ex; 11594 } 11595 break; 11596 case 0xffdc: 11597 offset += 4; 11598 break; 11599 case 0xffff: 11600 if (data[offset] !== 0xff) { 11601 offset--; 11602 } 11603 break; 11604 default: 11605 const nextFileMarker = findNextFileMarker(data, view, offset - 2, offset - 3); 11606 if (nextFileMarker?.invalid) { 11607 warn("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid); 11608 offset = nextFileMarker.offset; 11609 break; 11610 } 11611 if (!nextFileMarker || offset >= maxOffset) { 11612 warn("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9)."); 11613 break markerLoop; 11614 } 11615 throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16)); 11616 } 11617 if (offset < maxOffset) { 11618 fileMarker = view.getUint16(offset); 11619 offset += 2; 11620 } else { 11621 fileMarker = 0; 11622 } 11623 } 11624 if (!frame) { 11625 throw new JpegError("JpegImage.parse - no frame data found."); 11626 } 11627 this.width = frame.samplesPerLine; 11628 this.height = frame.scanLines; 11629 this.jfif = jfif; 11630 this.adobe = adobe; 11631 this.components = []; 11632 for (const component of frame.components) { 11633 const quantizationTable = quantizationTables[component.quantizationId]; 11634 if (quantizationTable) { 11635 component.quantizationTable = quantizationTable; 11636 } 11637 this.components.push({ 11638 index: component.index, 11639 output: buildComponentData(frame, component), 11640 scaleX: component.h / frame.maxH, 11641 scaleY: component.v / frame.maxV, 11642 blocksPerLine: component.blocksPerLine, 11643 blocksPerColumn: component.blocksPerColumn 11644 }); 11645 } 11646 this.numComponents = this.components.length; 11647 return undefined; 11648 } 11649 _getLinearizedBlockData(width, height, isSourcePDF = false) { 11650 const scaleX = this.width / width, 11651 scaleY = this.height / height; 11652 let component, componentScaleX, componentScaleY, blocksPerScanline; 11653 let x, y, i, j, k; 11654 let index; 11655 let offset = 0; 11656 let output; 11657 const numComponents = this.components.length; 11658 const dataLength = width * height * numComponents; 11659 const data = new Uint8ClampedArray(dataLength); 11660 const xScaleBlockOffset = new Uint32Array(width); 11661 const mask3LSB = 0xfffffff8; 11662 let lastComponentScaleX; 11663 for (i = 0; i < numComponents; i++) { 11664 component = this.components[i]; 11665 componentScaleX = component.scaleX * scaleX; 11666 componentScaleY = component.scaleY * scaleY; 11667 offset = i; 11668 output = component.output; 11669 blocksPerScanline = component.blocksPerLine + 1 << 3; 11670 if (componentScaleX !== lastComponentScaleX) { 11671 for (x = 0; x < width; x++) { 11672 j = 0 | x * componentScaleX; 11673 xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7; 11674 } 11675 lastComponentScaleX = componentScaleX; 11676 } 11677 for (y = 0; y < height; y++) { 11678 j = 0 | y * componentScaleY; 11679 index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3; 11680 for (x = 0; x < width; x++) { 11681 data[offset] = output[index + xScaleBlockOffset[x]]; 11682 offset += numComponents; 11683 } 11684 } 11685 } 11686 let transform = this._decodeTransform; 11687 if (!isSourcePDF && numComponents === 4 && !transform) { 11688 transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]); 11689 } 11690 if (transform) { 11691 for (i = 0; i < dataLength;) { 11692 for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) { 11693 data[i] = (data[i] * transform[k] >> 8) + transform[k + 1]; 11694 } 11695 } 11696 } 11697 return data; 11698 } 11699 get _isColorConversionNeeded() { 11700 if (this.adobe) { 11701 return !!this.adobe.transformCode; 11702 } 11703 if (this.numComponents === 3) { 11704 if (this._colorTransform === 0) { 11705 return false; 11706 } else if (this.components[0].index === 0x52 && this.components[1].index === 0x47 && this.components[2].index === 0x42) { 11707 return false; 11708 } 11709 return true; 11710 } 11711 if (this._colorTransform === 1) { 11712 return true; 11713 } 11714 return false; 11715 } 11716 _convertYccToRgb(data) { 11717 let Y, Cb, Cr; 11718 for (let i = 0, length = data.length; i < length; i += 3) { 11719 Y = data[i]; 11720 Cb = data[i + 1]; 11721 Cr = data[i + 2]; 11722 data[i] = Y - 179.456 + 1.402 * Cr; 11723 data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr; 11724 data[i + 2] = Y - 226.816 + 1.772 * Cb; 11725 } 11726 return data; 11727 } 11728 _convertYccToRgba(data, out) { 11729 for (let i = 0, j = 0, length = data.length; i < length; i += 3, j += 4) { 11730 const Y = data[i]; 11731 const Cb = data[i + 1]; 11732 const Cr = data[i + 2]; 11733 out[j] = Y - 179.456 + 1.402 * Cr; 11734 out[j + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr; 11735 out[j + 2] = Y - 226.816 + 1.772 * Cb; 11736 out[j + 3] = 255; 11737 } 11738 return out; 11739 } 11740 _convertYcckToRgb(data) { 11741 this._convertYcckToCmyk(data); 11742 return this._convertCmykToRgb(data); 11743 } 11744 _convertYcckToRgba(data) { 11745 this._convertYcckToCmyk(data); 11746 return this._convertCmykToRgba(data); 11747 } 11748 _convertYcckToCmyk(data) { 11749 let Y, Cb, Cr; 11750 for (let i = 0, length = data.length; i < length; i += 4) { 11751 Y = data[i]; 11752 Cb = data[i + 1]; 11753 Cr = data[i + 2]; 11754 data[i] = 434.456 - Y - 1.402 * Cr; 11755 data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr; 11756 data[i + 2] = 481.816 - Y - 1.772 * Cb; 11757 } 11758 return data; 11759 } 11760 _convertCmykToRgb(data) { 11761 const count = data.length / 4; 11762 ColorSpaceUtils.cmyk.getRgbBuffer(data, 0, count, data, 0, 8, 0); 11763 return data.subarray(0, count * 3); 11764 } 11765 _convertCmykToRgba(data) { 11766 ColorSpaceUtils.cmyk.getRgbBuffer(data, 0, data.length / 4, data, 0, 8, 1); 11767 if (ColorSpaceUtils.cmyk instanceof DeviceCmykCS) { 11768 for (let i = 3, ii = data.length; i < ii; i += 4) { 11769 data[i] = 255; 11770 } 11771 } 11772 return data; 11773 } 11774 getData({ 11775 width, 11776 height, 11777 forceRGBA = false, 11778 forceRGB = false, 11779 isSourcePDF = false 11780 }) { 11781 if (this.numComponents > 4) { 11782 throw new JpegError("Unsupported color mode"); 11783 } 11784 const data = this._getLinearizedBlockData(width, height, isSourcePDF); 11785 if (this.numComponents === 1 && (forceRGBA || forceRGB)) { 11786 const len = data.length * (forceRGBA ? 4 : 3); 11787 const rgbaData = new Uint8ClampedArray(len); 11788 let offset = 0; 11789 if (forceRGBA) { 11790 grayToRGBA(data, new Uint32Array(rgbaData.buffer)); 11791 } else { 11792 for (const grayColor of data) { 11793 rgbaData[offset++] = grayColor; 11794 rgbaData[offset++] = grayColor; 11795 rgbaData[offset++] = grayColor; 11796 } 11797 } 11798 return rgbaData; 11799 } else if (this.numComponents === 3 && this._isColorConversionNeeded) { 11800 if (forceRGBA) { 11801 const rgbaData = new Uint8ClampedArray(data.length / 3 * 4); 11802 return this._convertYccToRgba(data, rgbaData); 11803 } 11804 return this._convertYccToRgb(data); 11805 } else if (this.numComponents === 4) { 11806 if (this._isColorConversionNeeded) { 11807 if (forceRGBA) { 11808 return this._convertYcckToRgba(data); 11809 } 11810 if (forceRGB) { 11811 return this._convertYcckToRgb(data); 11812 } 11813 return this._convertYcckToCmyk(data); 11814 } else if (forceRGBA) { 11815 return this._convertCmykToRgba(data); 11816 } else if (forceRGB) { 11817 return this._convertCmykToRgb(data); 11818 } 11819 } 11820 return data; 11821 } 11822} 11823 11824;// ./src/core/jpeg_stream.js 11825 11826 11827 11828 11829 11830 11831 11832 11833class JpegStream extends DecodeStream { 11834 static #isImageDecoderSupported = FeatureTest.isImageDecoderSupported; 11835 constructor(stream, maybeLength, params) { 11836 super(maybeLength); 11837 this.stream = stream; 11838 this.dict = stream.dict; 11839 this.maybeLength = maybeLength; 11840 this.params = params; 11841 } 11842 static get canUseImageDecoder() { 11843 return shadow(this, "canUseImageDecoder", this.#isImageDecoderSupported ? ImageDecoder.isTypeSupported("image/jpeg") : Promise.resolve(false)); 11844 } 11845 static setOptions({ 11846 isImageDecoderSupported = false 11847 }) { 11848 this.#isImageDecoderSupported = isImageDecoderSupported; 11849 } 11850 get bytes() { 11851 return shadow(this, "bytes", this.stream.getBytes(this.maybeLength)); 11852 } 11853 ensureBuffer(requested) {} 11854 readBlock() { 11855 this.decodeImage(); 11856 } 11857 get jpegOptions() { 11858 const jpegOptions = { 11859 decodeTransform: undefined, 11860 colorTransform: undefined 11861 }; 11862 const decodeArr = this.dict.getArray("D", "Decode"); 11863 if ((this.forceRGBA || this.forceRGB) && Array.isArray(decodeArr)) { 11864 const bitsPerComponent = this.dict.get("BPC", "BitsPerComponent") || 8; 11865 const decodeArrLength = decodeArr.length; 11866 const transform = new Int32Array(decodeArrLength); 11867 let transformNeeded = false; 11868 const maxValue = (1 << bitsPerComponent) - 1; 11869 for (let i = 0; i < decodeArrLength; i += 2) { 11870 transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0; 11871 transform[i + 1] = decodeArr[i] * maxValue | 0; 11872 if (transform[i] !== 256 || transform[i + 1] !== 0) { 11873 transformNeeded = true; 11874 } 11875 } 11876 if (transformNeeded) { 11877 jpegOptions.decodeTransform = transform; 11878 } 11879 } 11880 if (this.params instanceof Dict) { 11881 const colorTransform = this.params.get("ColorTransform"); 11882 if (Number.isInteger(colorTransform)) { 11883 jpegOptions.colorTransform = colorTransform; 11884 } 11885 } 11886 return shadow(this, "jpegOptions", jpegOptions); 11887 } 11888 #skipUselessBytes(data) { 11889 for (let i = 0, ii = data.length - 1; i < ii; i++) { 11890 if (data[i] === 0xff && data[i + 1] === 0xd8) { 11891 if (i > 0) { 11892 data = data.subarray(i); 11893 } 11894 break; 11895 } 11896 } 11897 return data; 11898 } 11899 decodeImage(bytes) { 11900 if (this.eof) { 11901 return this.buffer; 11902 } 11903 bytes = this.#skipUselessBytes(bytes || this.bytes); 11904 const jpegImage = new JpegImage(this.jpegOptions); 11905 jpegImage.parse(bytes); 11906 const data = jpegImage.getData({ 11907 width: this.drawWidth, 11908 height: this.drawHeight, 11909 forceRGBA: this.forceRGBA, 11910 forceRGB: this.forceRGB, 11911 isSourcePDF: true 11912 }); 11913 this.buffer = data; 11914 this.bufferLength = data.length; 11915 this.eof = true; 11916 return this.buffer; 11917 } 11918 get canAsyncDecodeImageFromBuffer() { 11919 return this.stream.isAsync; 11920 } 11921 async getTransferableImage() { 11922 if (!(await JpegStream.canUseImageDecoder)) { 11923 return null; 11924 } 11925 const jpegOptions = this.jpegOptions; 11926 if (jpegOptions.decodeTransform) { 11927 return null; 11928 } 11929 let decoder; 11930 try { 11931 const bytes = this.canAsyncDecodeImageFromBuffer && (await this.stream.asyncGetBytes()) || this.bytes; 11932 if (!bytes) { 11933 return null; 11934 } 11935 let data = this.#skipUselessBytes(bytes); 11936 const useImageDecoder = JpegImage.canUseImageDecoder(data, jpegOptions.colorTransform); 11937 if (!useImageDecoder) { 11938 return null; 11939 } 11940 if (useImageDecoder.exifStart) { 11941 data = data.slice(); 11942 data.fill(0x00, useImageDecoder.exifStart, useImageDecoder.exifEnd); 11943 } 11944 decoder = new ImageDecoder({ 11945 data, 11946 type: "image/jpeg", 11947 preferAnimation: false 11948 }); 11949 return (await decoder.decode()).image; 11950 } catch (reason) { 11951 warn(`getTransferableImage - failed: "${reason}".`); 11952 return null; 11953 } finally { 11954 decoder?.close(); 11955 } 11956 } 11957 get isImageStream() { 11958 return true; 11959 } 11960} 11961 11962;// ./external/openjpeg/openjpeg.js 11963 11964 11965 11966 11967 11968 11969 11970 11971 11972 11973 11974 11975async function OpenJPEG(moduleArg = {}) { 11976 var moduleRtn; 11977 var Module = moduleArg; 11978 var ENVIRONMENT_IS_WEB = true; 11979 var ENVIRONMENT_IS_WORKER = false; 11980 var arguments_ = []; 11981 var thisProgram = "./this.program"; 11982 var quit_ = (status, toThrow) => { 11983 throw toThrow; 11984 }; 11985 var _scriptName = import.meta.url; 11986 var scriptDirectory = ""; 11987 var readAsync, readBinary; 11988 if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { 11989 try { 11990 scriptDirectory = new URL(".", _scriptName).href; 11991 } catch {} 11992 readAsync = async url => { 11993 var response = await fetch(url, { 11994 credentials: "same-origin" 11995 }); 11996 if (response.ok) { 11997 return response.arrayBuffer(); 11998 } 11999 throw new Error(response.status + " : " + response.url); 12000 }; 12001 } else {} 12002 var out = console.log.bind(console); 12003 var err = console.error.bind(console); 12004 var wasmBinary; 12005 var ABORT = false; 12006 var EXITSTATUS; 12007 class EmscriptenEH {} 12008 class EmscriptenSjLj extends EmscriptenEH {} 12009 var readyPromiseResolve, readyPromiseReject; 12010 var runtimeInitialized = false; 12011 function updateMemoryViews() { 12012 var b = wasmMemory.buffer; 12013 HEAP8 = new Int8Array(b); 12014 HEAP16 = new Int16Array(b); 12015 HEAPU8 = new Uint8Array(b); 12016 HEAPU16 = new Uint16Array(b); 12017 HEAP32 = new Int32Array(b); 12018 HEAPU32 = new Uint32Array(b); 12019 HEAPF32 = new Float32Array(b); 12020 HEAPF64 = new Float64Array(b); 12021 HEAP64 = new BigInt64Array(b); 12022 HEAPU64 = new BigUint64Array(b); 12023 } 12024 function preRun() { 12025 if (Module["preRun"]) { 12026 if (typeof Module["preRun"] == "function") Module["preRun"] = [Module["preRun"]]; 12027 while (Module["preRun"].length) { 12028 addOnPreRun(Module["preRun"].shift()); 12029 } 12030 } 12031 callRuntimeCallbacks(onPreRuns); 12032 } 12033 function initRuntime() { 12034 runtimeInitialized = true; 12035 wasmExports["s"](); 12036 } 12037 function postRun() { 12038 if (Module["postRun"]) { 12039 if (typeof Module["postRun"] == "function") Module["postRun"] = [Module["postRun"]]; 12040 while (Module["postRun"].length) { 12041 addOnPostRun(Module["postRun"].shift()); 12042 } 12043 } 12044 callRuntimeCallbacks(onPostRuns); 12045 } 12046 function abort(what) { 12047 Module["onAbort"]?.(what); 12048 what = `Aborted(${what})`; 12049 err(what); 12050 ABORT = true; 12051 what += ". Build with -sASSERTIONS for more info."; 12052 var e = new WebAssembly.RuntimeError(what); 12053 readyPromiseReject?.(e); 12054 throw e; 12055 } 12056 var wasmBinaryFile; 12057 function getWasmImports() { 12058 var imports = { 12059 a: wasmImports 12060 }; 12061 return imports; 12062 } 12063 async function createWasm() { 12064 function receiveInstance(instance, module) { 12065 wasmExports = instance.exports; 12066 assignWasmExports(wasmExports); 12067 updateMemoryViews(); 12068 return wasmExports; 12069 } 12070 var info = getWasmImports(); 12071 return new Promise((resolve, reject) => { 12072 Module["instantiateWasm"](info, (inst, mod) => { 12073 resolve(receiveInstance(inst, mod)); 12074 }); 12075 }); 12076 } 12077 class ExitStatus { 12078 name = "ExitStatus"; 12079 constructor(status) { 12080 this.message = `Program terminated with exit(${status})`; 12081 this.status = status; 12082 } 12083 } 12084 var HEAP16; 12085 var HEAP32; 12086 var HEAP64; 12087 var HEAP8; 12088 var HEAPF32; 12089 var HEAPF64; 12090 var HEAPU16; 12091 var HEAPU32; 12092 var HEAPU64; 12093 var HEAPU8; 12094 var callRuntimeCallbacks = callbacks => { 12095 while (callbacks.length > 0) { 12096 callbacks.shift()(Module); 12097 } 12098 }; 12099 var onPostRuns = []; 12100 var addOnPostRun = cb => onPostRuns.push(cb); 12101 var onPreRuns = []; 12102 var addOnPreRun = cb => onPreRuns.push(cb); 12103 var noExitRuntime = true; 12104 var __abort_js = () => abort(""); 12105 var runtimeKeepaliveCounter = 0; 12106 var __emscripten_runtime_keepalive_clear = () => { 12107 noExitRuntime = false;
vendor: 8,931 bytes, lines 12108-12388
12108 runtimeKeepaliveCounter = 0; 12109 }; 12110 var timers = {}; 12111 var handleException = e => { 12112 if (e instanceof ExitStatus || e == "unwind") { 12113 return EXITSTATUS; 12114 } 12115 quit_(1, e); 12116 }; 12117 var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0; 12118 var _proc_exit = code => { 12119 EXITSTATUS = code; 12120 if (!keepRuntimeAlive()) { 12121 Module["onExit"]?.(code); 12122 ABORT = true; 12123 } 12124 quit_(code, new ExitStatus(code)); 12125 }; 12126 var exitJS = (status, implicit) => { 12127 EXITSTATUS = status; 12128 _proc_exit(status); 12129 }; 12130 var _exit = exitJS; 12131 var maybeExit = () => { 12132 if (!keepRuntimeAlive()) { 12133 try { 12134 _exit(EXITSTATUS); 12135 } catch (e) { 12136 handleException(e); 12137 } 12138 } 12139 }; 12140 var callUserCallback = func => { 12141 if (ABORT) { 12142 return; 12143 } 12144 try { 12145 return func(); 12146 } catch (e) { 12147 handleException(e); 12148 } finally { 12149 maybeExit(); 12150 } 12151 }; 12152 var _emscripten_get_now = () => performance.now(); 12153 var __setitimer_js = (which, timeout_ms) => { 12154 if (timers[which]) { 12155 clearTimeout(timers[which].id); 12156 delete timers[which]; 12157 } 12158 if (!timeout_ms) return 0; 12159 var id = setTimeout(() => { 12160 delete timers[which]; 12161 callUserCallback(() => __emscripten_timeout(which, _emscripten_get_now())); 12162 }, timeout_ms); 12163 timers[which] = { 12164 id, 12165 timeout_ms 12166 }; 12167 return 0; 12168 }; 12169 function _copy_pixels_1(compG_ptr, nb_pixels) { 12170 compG_ptr >>= 2; 12171 const imageData = Module.imageData = new Uint8ClampedArray(nb_pixels); 12172 const compG = HEAP32.subarray(compG_ptr, compG_ptr + nb_pixels); 12173 imageData.set(compG); 12174 } 12175 function _copy_pixels_3(compR_ptr, compG_ptr, compB_ptr, nb_pixels) { 12176 compR_ptr >>= 2; 12177 compG_ptr >>= 2; 12178 compB_ptr >>= 2; 12179 const imageData = Module.imageData = new Uint8ClampedArray(nb_pixels * 3); 12180 const compR = HEAP32.subarray(compR_ptr, compR_ptr + nb_pixels); 12181 const compG = HEAP32.subarray(compG_ptr, compG_ptr + nb_pixels); 12182 const compB = HEAP32.subarray(compB_ptr, compB_ptr + nb_pixels); 12183 for (let i = 0; i < nb_pixels; i++) { 12184 imageData[3 * i] = compR[i]; 12185 imageData[3 * i + 1] = compG[i]; 12186 imageData[3 * i + 2] = compB[i]; 12187 } 12188 } 12189 function _copy_pixels_4(compR_ptr, compG_ptr, compB_ptr, compA_ptr, nb_pixels) { 12190 compR_ptr >>= 2; 12191 compG_ptr >>= 2; 12192 compB_ptr >>= 2; 12193 compA_ptr >>= 2; 12194 const imageData = Module.imageData = new Uint8ClampedArray(nb_pixels * 4); 12195 const compR = HEAP32.subarray(compR_ptr, compR_ptr + nb_pixels); 12196 const compG = HEAP32.subarray(compG_ptr, compG_ptr + nb_pixels); 12197 const compB = HEAP32.subarray(compB_ptr, compB_ptr + nb_pixels); 12198 const compA = HEAP32.subarray(compA_ptr, compA_ptr + nb_pixels); 12199 for (let i = 0; i < nb_pixels; i++) { 12200 imageData[4 * i] = compR[i]; 12201 imageData[4 * i + 1] = compG[i]; 12202 imageData[4 * i + 2] = compB[i]; 12203 imageData[4 * i + 3] = compA[i]; 12204 } 12205 } 12206 var getHeapMax = () => 2147483648; 12207 var alignMemory = (size, alignment) => Math.ceil(size / alignment) * alignment; 12208 var growMemory = size => { 12209 var oldHeapSize = wasmMemory.buffer.byteLength; 12210 var pages = (size - oldHeapSize + 65535) / 65536 | 0; 12211 try { 12212 wasmMemory.grow(pages); 12213 updateMemoryViews(); 12214 return 1; 12215 } catch (e) {} 12216 }; 12217 var _emscripten_resize_heap = requestedSize => { 12218 var oldSize = HEAPU8.length; 12219 requestedSize >>>= 0; 12220 var maxHeapSize = getHeapMax(); 12221 if (requestedSize > maxHeapSize) { 12222 return false; 12223 } 12224 for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { 12225 var overGrownHeapSize = oldSize * (1 + .2 / cutDown); 12226 overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296); 12227 var newSize = Math.min(maxHeapSize, alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536)); 12228 var replacement = growMemory(newSize); 12229 if (replacement) { 12230 return true; 12231 } 12232 } 12233 return false; 12234 }; 12235 var ENV = {}; 12236 var getExecutableName = () => thisProgram || "./this.program"; 12237 var getEnvStrings = () => { 12238 if (!getEnvStrings.strings) { 12239 var lang = (globalThis.navigator?.language ?? "C").replace("-", "_") + ".UTF-8"; 12240 var env = { 12241 USER: "web_user", 12242 LOGNAME: "web_user", 12243 PATH: "/", 12244 PWD: "/", 12245 HOME: "/home/web_user", 12246 LANG: lang, 12247 _: getExecutableName() 12248 }; 12249 for (var x in ENV) { 12250 if (ENV[x] === undefined) delete env[x];else env[x] = ENV[x]; 12251 } 12252 var strings = []; 12253 for (var x in env) { 12254 strings.push(`${x}=${env[x]}`); 12255 } 12256 getEnvStrings.strings = strings; 12257 } 12258 return getEnvStrings.strings; 12259 }; 12260 var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => { 12261 if (!(maxBytesToWrite > 0)) return 0; 12262 var startIdx = outIdx; 12263 var endIdx = outIdx + maxBytesToWrite - 1; 12264 for (var i = 0; i < str.length; ++i) { 12265 var u = str.codePointAt(i); 12266 if (u <= 127) { 12267 if (outIdx >= endIdx) break; 12268 heap[outIdx++] = u; 12269 } else if (u <= 2047) { 12270 if (outIdx + 1 >= endIdx) break; 12271 heap[outIdx++] = 192 | u >> 6; 12272 heap[outIdx++] = 128 | u & 63; 12273 } else if (u <= 65535) { 12274 if (outIdx + 2 >= endIdx) break; 12275 heap[outIdx++] = 224 | u >> 12; 12276 heap[outIdx++] = 128 | u >> 6 & 63; 12277 heap[outIdx++] = 128 | u & 63; 12278 } else { 12279 if (outIdx + 3 >= endIdx) break; 12280 heap[outIdx++] = 240 | u >> 18; 12281 heap[outIdx++] = 128 | u >> 12 & 63; 12282 heap[outIdx++] = 128 | u >> 6 & 63; 12283 heap[outIdx++] = 128 | u & 63; 12284 i++; 12285 } 12286 } 12287 heap[outIdx] = 0; 12288 return outIdx - startIdx; 12289 }; 12290 var stringToUTF8 = (str, outPtr, maxBytesToWrite) => stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); 12291 var _environ_get = (__environ, environ_buf) => { 12292 var bufSize = 0; 12293 var envp = 0; 12294 for (var string of getEnvStrings()) { 12295 var ptr = environ_buf + bufSize; 12296 HEAPU32[__environ + envp >> 2] = ptr; 12297 bufSize += stringToUTF8(string, ptr, Infinity) + 1; 12298 envp += 4; 12299 } 12300 return 0; 12301 }; 12302 var lengthBytesUTF8 = str => { 12303 var len = 0; 12304 for (var i = 0; i < str.length; ++i) { 12305 var c = str.charCodeAt(i); 12306 if (c <= 127) { 12307 len++; 12308 } else if (c <= 2047) { 12309 len += 2; 12310 } else if (c >= 55296 && c <= 57343) { 12311 len += 4; 12312 ++i; 12313 } else { 12314 len += 3; 12315 } 12316 } 12317 return len; 12318 }; 12319 var _environ_sizes_get = (penviron_count, penviron_buf_size) => { 12320 var strings = getEnvStrings(); 12321 HEAPU32[penviron_count >> 2] = strings.length; 12322 var bufSize = 0; 12323 for (var string of strings) { 12324 bufSize += lengthBytesUTF8(string) + 1; 12325 } 12326 HEAPU32[penviron_buf_size >> 2] = bufSize; 12327 return 0; 12328 }; 12329 var INT53_MAX = 9007199254740992; 12330 var INT53_MIN = -9007199254740992; 12331 var bigintToI53Checked = num => num < INT53_MIN || num > INT53_MAX ? NaN : Number(num); 12332 function _fd_seek(fd, offset, whence, newOffset) { 12333 offset = bigintToI53Checked(offset); 12334 return 70; 12335 } 12336 var printCharBuffers = [null, [], []]; 12337 var UTF8Decoder = globalThis.TextDecoder && new TextDecoder(); 12338 var findStringEnd = (heapOrArray, idx, maxBytesToRead, ignoreNul) => { 12339 var maxIdx = idx + maxBytesToRead; 12340 if (ignoreNul) return maxIdx; 12341 while (heapOrArray[idx] && !(idx >= maxIdx)) ++idx; 12342 return idx; 12343 }; 12344 var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead, ignoreNul) => { 12345 var endPtr = findStringEnd(heapOrArray, idx, maxBytesToRead, ignoreNul); 12346 if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) { 12347 return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr)); 12348 } 12349 var str = ""; 12350 while (idx < endPtr) { 12351 var u0 = heapOrArray[idx++]; 12352 if (!(u0 & 128)) { 12353 str += String.fromCharCode(u0); 12354 continue; 12355 } 12356 var u1 = heapOrArray[idx++] & 63; 12357 if ((u0 & 224) == 192) { 12358 str += String.fromCharCode((u0 & 31) << 6 | u1); 12359 continue; 12360 } 12361 var u2 = heapOrArray[idx++] & 63; 12362 if ((u0 & 240) == 224) { 12363 u0 = (u0 & 15) << 12 | u1 << 6 | u2; 12364 } else { 12365 u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heapOrArray[idx++] & 63; 12366 } 12367 if (u0 < 65536) { 12368 str += String.fromCharCode(u0); 12369 } else { 12370 var ch = u0 - 65536; 12371 str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023); 12372 } 12373 } 12374 return str; 12375 }; 12376 var printChar = (stream, curr) => { 12377 var buffer = printCharBuffers[stream]; 12378 if (curr === 0 || curr === 10) { 12379 (stream === 1 ? out : err)(UTF8ArrayToString(buffer)); 12380 buffer.length = 0; 12381 } else { 12382 buffer.push(curr); 12383 } 12384 }; 12385 var UTF8ToString = (ptr, maxBytesToRead, ignoreNul) => ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead, ignoreNul) : ""; 12386 var _fd_write = (fd, iov, iovcnt, pnum) => { 12387 var num = 0; 12388 for (var i = 0; i < iovcnt; i++) {
vendor: 8,510 bytes, lines 12389-12694
12389 var ptr = HEAPU32[iov >> 2]; 12390 var len = HEAPU32[iov + 4 >> 2]; 12391 iov += 8; 12392 for (var j = 0; j < len; j++) { 12393 printChar(fd, HEAPU8[ptr + j]); 12394 } 12395 num += len; 12396 } 12397 HEAPU32[pnum >> 2] = num; 12398 return 0; 12399 }; 12400 function _gray_to_rgba(compG_ptr, nb_pixels) { 12401 compG_ptr >>= 2; 12402 const imageData = Module.imageData = new Uint8ClampedArray(nb_pixels * 4); 12403 const compG = HEAP32.subarray(compG_ptr, compG_ptr + nb_pixels); 12404 for (let i = 0; i < nb_pixels; i++) { 12405 imageData[4 * i] = imageData[4 * i + 1] = imageData[4 * i + 2] = compG[i]; 12406 imageData[4 * i + 3] = 255; 12407 } 12408 } 12409 function _graya_to_rgba(compG_ptr, compA_ptr, nb_pixels) { 12410 compG_ptr >>= 2; 12411 compA_ptr >>= 2; 12412 const imageData = Module.imageData = new Uint8ClampedArray(nb_pixels * 4); 12413 const compG = HEAP32.subarray(compG_ptr, compG_ptr + nb_pixels); 12414 const compA = HEAP32.subarray(compA_ptr, compA_ptr + nb_pixels); 12415 for (let i = 0; i < nb_pixels; i++) { 12416 imageData[4 * i] = imageData[4 * i + 1] = imageData[4 * i + 2] = compG[i]; 12417 imageData[4 * i + 3] = compA[i]; 12418 } 12419 } 12420 function _jsPrintWarning(message_ptr) { 12421 const message = UTF8ToString(message_ptr); 12422 (Module.warn || console.warn)(`OpenJPEG: ${message}`); 12423 } 12424 function _rgb_to_rgba(compR_ptr, compG_ptr, compB_ptr, nb_pixels) { 12425 compR_ptr >>= 2; 12426 compG_ptr >>= 2; 12427 compB_ptr >>= 2; 12428 const imageData = Module.imageData = new Uint8ClampedArray(nb_pixels * 4); 12429 const compR = HEAP32.subarray(compR_ptr, compR_ptr + nb_pixels); 12430 const compG = HEAP32.subarray(compG_ptr, compG_ptr + nb_pixels); 12431 const compB = HEAP32.subarray(compB_ptr, compB_ptr + nb_pixels); 12432 for (let i = 0; i < nb_pixels; i++) { 12433 imageData[4 * i] = compR[i]; 12434 imageData[4 * i + 1] = compG[i]; 12435 imageData[4 * i + 2] = compB[i]; 12436 imageData[4 * i + 3] = 255; 12437 } 12438 } 12439 function _storeErrorMessage(message_ptr) { 12440 const message = UTF8ToString(message_ptr); 12441 if (!Module.errorMessages) { 12442 Module.errorMessages = message; 12443 } else { 12444 Module.errorMessages += "\n" + message; 12445 } 12446 } 12447 var writeArrayToMemory = (array, buffer) => { 12448 HEAP8.set(array, buffer); 12449 }; 12450 if (Module["noExitRuntime"]) noExitRuntime = Module["noExitRuntime"]; 12451 if (Module["print"]) out = Module["print"]; 12452 if (Module["printErr"]) err = Module["printErr"]; 12453 if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"]; 12454 if (Module["arguments"]) arguments_ = Module["arguments"]; 12455 if (Module["thisProgram"]) thisProgram = Module["thisProgram"]; 12456 if (Module["preInit"]) { 12457 if (typeof Module["preInit"] == "function") Module["preInit"] = [Module["preInit"]]; 12458 while (Module["preInit"].length > 0) { 12459 Module["preInit"].shift()(); 12460 } 12461 } 12462 Module["writeArrayToMemory"] = writeArrayToMemory; 12463 var _malloc, _free, _jp2_decode, __emscripten_timeout, memory, __indirect_function_table, wasmMemory; 12464 function assignWasmExports(wasmExports) { 12465 _malloc = Module["_malloc"] = wasmExports["t"]; 12466 _free = Module["_free"] = wasmExports["u"]; 12467 _jp2_decode = Module["_jp2_decode"] = wasmExports["v"]; 12468 __emscripten_timeout = wasmExports["w"]; 12469 memory = wasmMemory = wasmExports["r"]; 12470 __indirect_function_table = wasmExports["__indirect_function_table"]; 12471 } 12472 var wasmImports = { 12473 m: __abort_js, 12474 l: __emscripten_runtime_keepalive_clear, 12475 i: __setitimer_js, 12476 f: _copy_pixels_1, 12477 e: _copy_pixels_3, 12478 d: _copy_pixels_4, 12479 j: _emscripten_resize_heap, 12480 o: _environ_get, 12481 p: _environ_sizes_get, 12482 n: _fd_seek, 12483 b: _fd_write, 12484 q: _gray_to_rgba, 12485 h: _graya_to_rgba, 12486 c: _jsPrintWarning, 12487 k: _proc_exit, 12488 g: _rgb_to_rgba, 12489 a: _storeErrorMessage 12490 }; 12491 function run() { 12492 preRun(); 12493 function doRun() { 12494 Module["calledRun"] = true; 12495 if (ABORT) return; 12496 initRuntime(); 12497 readyPromiseResolve?.(Module); 12498 Module["onRuntimeInitialized"]?.(); 12499 postRun(); 12500 } 12501 if (Module["setStatus"]) { 12502 Module["setStatus"]("Running..."); 12503 setTimeout(() => { 12504 setTimeout(() => Module["setStatus"](""), 1); 12505 doRun(); 12506 }, 1); 12507 } else { 12508 doRun(); 12509 } 12510 } 12511 var wasmExports; 12512 wasmExports = await createWasm(); 12513 run(); 12514 if (runtimeInitialized) { 12515 moduleRtn = Module; 12516 } else { 12517 moduleRtn = new Promise((resolve, reject) => { 12518 readyPromiseResolve = resolve; 12519 readyPromiseReject = reject; 12520 }); 12521 } 12522 return moduleRtn; 12523} 12524/* harmony default export */ const openjpeg = (OpenJPEG); 12525;// ./src/core/jpx.js 12526 12527 12528 12529 12530 12531 12532 12533 12534 12535class JpxError extends BaseException { 12536 constructor(msg) { 12537 super(msg, "JpxError"); 12538 } 12539} 12540class JpxImage { 12541 static #buffer = null; 12542 static #handler = null; 12543 static #modulePromise = null; 12544 static #useWasm = true; 12545 static #useWorkerFetch = true; 12546 static #wasmUrl = null; 12547 static setOptions({ 12548 handler, 12549 useWasm, 12550 useWorkerFetch, 12551 wasmUrl 12552 }) { 12553 this.#useWasm = useWasm; 12554 this.#useWorkerFetch = useWorkerFetch; 12555 this.#wasmUrl = wasmUrl; 12556 if (!useWorkerFetch) { 12557 this.#handler = handler; 12558 } 12559 } 12560 static async #getJsModule(fallbackCallback) { 12561 const path = `${this.#wasmUrl}openjpeg_nowasm_fallback.js`; 12562 let instance = null; 12563 try { 12564 const mod = await import( 12565 /*webpackIgnore: true*/ 12566 /*@vite-ignore*/ 12567 path); 12568 instance = mod.default(); 12569 } catch (e) { 12570 warn(`JpxImage#getJsModule: ${e}`); 12571 } 12572 fallbackCallback(instance); 12573 } 12574 static async #instantiateWasm(fallbackCallback, imports, successCallback) { 12575 const filename = "openjpeg.wasm"; 12576 try { 12577 if (!this.#buffer) { 12578 if (this.#useWorkerFetch) { 12579 this.#buffer = await fetchBinaryData(`${this.#wasmUrl}${filename}`); 12580 } else { 12581 this.#buffer = await this.#handler.sendWithPromise("FetchBinaryData", { 12582 kind: "wasmUrl", 12583 filename 12584 }); 12585 } 12586 } 12587 const results = await WebAssembly.instantiate(this.#buffer, imports); 12588 return successCallback(results.instance); 12589 } catch (reason) { 12590 warn(`JpxImage#instantiateWasm: ${reason}`); 12591 this.#getJsModule(fallbackCallback); 12592 return null; 12593 } finally { 12594 this.#handler = null; 12595 } 12596 } 12597 static async decode(bytes, { 12598 numComponents = 4, 12599 isIndexedColormap = false, 12600 smaskInData = false, 12601 reducePower = 0 12602 } = {}) { 12603 if (!this.#modulePromise) { 12604 const { 12605 promise, 12606 resolve 12607 } = Promise.withResolvers(); 12608 const promises = [promise]; 12609 if (!this.#useWasm) { 12610 this.#getJsModule(resolve); 12611 } else { 12612 promises.push(openjpeg({ 12613 warn: warn, 12614 instantiateWasm: this.#instantiateWasm.bind(this, resolve) 12615 })); 12616 } 12617 this.#modulePromise = Promise.race(promises); 12618 } 12619 const module = await this.#modulePromise; 12620 if (!module) { 12621 throw new JpxError("OpenJPEG failed to initialize"); 12622 } 12623 let ptr; 12624 try { 12625 const size = bytes.length; 12626 ptr = module._malloc(size); 12627 module.writeArrayToMemory(bytes, ptr); 12628 const ret = module._jp2_decode(ptr, size, numComponents > 0 ? numComponents : 0, !!isIndexedColormap, !!smaskInData, reducePower); 12629 if (ret) { 12630 const { 12631 errorMessages 12632 } = module; 12633 if (errorMessages) { 12634 delete module.errorMessages; 12635 throw new JpxError(errorMessages); 12636 } 12637 throw new JpxError("Unknown error"); 12638 } 12639 const { 12640 imageData 12641 } = module; 12642 module.imageData = null; 12643 return imageData; 12644 } finally { 12645 if (ptr) { 12646 module._free(ptr); 12647 } 12648 } 12649 } 12650 static cleanup() { 12651 this.#modulePromise = null; 12652 } 12653 static parseImageProperties(stream) { 12654 let newByte = stream.getByte(); 12655 while (newByte >= 0) { 12656 const oldByte = newByte; 12657 newByte = stream.getByte(); 12658 const code = oldByte << 8 | newByte; 12659 if (code === 0xff51) { 12660 stream.skip(4); 12661 const Xsiz = stream.getInt32() >>> 0; 12662 const Ysiz = stream.getInt32() >>> 0; 12663 const XOsiz = stream.getInt32() >>> 0; 12664 const YOsiz = stream.getInt32() >>> 0; 12665 stream.skip(16); 12666 const Csiz = stream.getUint16(); 12667 return { 12668 width: Xsiz - XOsiz, 12669 height: Ysiz - YOsiz, 12670 bitsPerComponent: 8, 12671 componentsCount: Csiz 12672 }; 12673 } 12674 } 12675 throw new JpxError("No size marker found in JPX stream"); 12676 } 12677} 12678 12679;// ./src/core/operator_list.js 12680 12681 12682 12683 12684 12685 12686 12687 12688 12689 12690 12691 12692 12693 12694
vendor: 19,918 bytes, lines 12695-13296
12695 12696 12697function addState(parentState, pattern, checkFn, iterateFn, processFn) { 12698 let state = parentState; 12699 for (let i = 0, ii = pattern.length - 1; i < ii; i++) { 12700 const item = pattern[i]; 12701 state = state[item] ||= []; 12702 } 12703 state[pattern.at(-1)] = { 12704 checkFn, 12705 iterateFn, 12706 processFn 12707 }; 12708} 12709const InitialState = []; 12710addState(InitialState, [OPS.save, OPS.transform, OPS.paintInlineImageXObject, OPS.restore], null, function iterateInlineImageGroup(context, i) { 12711 const fnArray = context.fnArray; 12712 const iFirstSave = context.iCurr - 3; 12713 const pos = (i - iFirstSave) % 4; 12714 switch (pos) { 12715 case 0: 12716 return fnArray[i] === OPS.save; 12717 case 1: 12718 return fnArray[i] === OPS.transform; 12719 case 2: 12720 return fnArray[i] === OPS.paintInlineImageXObject; 12721 case 3: 12722 return fnArray[i] === OPS.restore; 12723 } 12724 throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`); 12725}, function foundInlineImageGroup(context, i) { 12726 const MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10; 12727 const MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200; 12728 const MAX_WIDTH = 1000; 12729 const IMAGE_PADDING = 1; 12730 const fnArray = context.fnArray, 12731 argsArray = context.argsArray; 12732 const curr = context.iCurr; 12733 const iFirstSave = curr - 3; 12734 const iFirstTransform = curr - 2; 12735 const iFirstPIIXO = curr - 1; 12736 const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK); 12737 if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) { 12738 return i - (i - iFirstSave) % 4; 12739 } 12740 let maxX = 0; 12741 const map = []; 12742 let maxLineHeight = 0; 12743 let currentX = IMAGE_PADDING, 12744 currentY = IMAGE_PADDING; 12745 for (let q = 0; q < count; q++) { 12746 const transform = argsArray[iFirstTransform + (q << 2)]; 12747 const img = argsArray[iFirstPIIXO + (q << 2)][0]; 12748 if (currentX + img.width > MAX_WIDTH) { 12749 maxX = Math.max(maxX, currentX); 12750 currentY += maxLineHeight + 2 * IMAGE_PADDING; 12751 currentX = 0; 12752 maxLineHeight = 0; 12753 } 12754 map.push({ 12755 transform, 12756 x: currentX, 12757 y: currentY, 12758 w: img.width, 12759 h: img.height 12760 }); 12761 currentX += img.width + 2 * IMAGE_PADDING; 12762 maxLineHeight = Math.max(maxLineHeight, img.height); 12763 } 12764 const imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING; 12765 const imgHeight = currentY + maxLineHeight + IMAGE_PADDING; 12766 const imgData = new Uint8Array(imgWidth * imgHeight * 4); 12767 const imgRowSize = imgWidth << 2; 12768 for (let q = 0; q < count; q++) { 12769 const data = argsArray[iFirstPIIXO + (q << 2)][0].data; 12770 const rowSize = map[q].w << 2; 12771 let dataOffset = 0; 12772 let offset = map[q].x + map[q].y * imgWidth << 2; 12773 imgData.set(data.subarray(0, rowSize), offset - imgRowSize); 12774 for (let k = 0, kk = map[q].h; k < kk; k++) { 12775 imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset); 12776 dataOffset += rowSize; 12777 offset += imgRowSize; 12778 } 12779 imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset); 12780 while (offset >= 0) { 12781 data[offset - 4] = data[offset]; 12782 data[offset - 3] = data[offset + 1]; 12783 data[offset - 2] = data[offset + 2]; 12784 data[offset - 1] = data[offset + 3]; 12785 data[offset + rowSize] = data[offset + rowSize - 4]; 12786 data[offset + rowSize + 1] = data[offset + rowSize - 3]; 12787 data[offset + rowSize + 2] = data[offset + rowSize - 2]; 12788 data[offset + rowSize + 3] = data[offset + rowSize - 1]; 12789 offset -= imgRowSize; 12790 } 12791 } 12792 const img = { 12793 width: imgWidth, 12794 height: imgHeight 12795 }; 12796 if (context.isOffscreenCanvasSupported) { 12797 const canvas = new OffscreenCanvas(imgWidth, imgHeight); 12798 const ctx = canvas.getContext("2d"); 12799 ctx.putImageData(new ImageData(new Uint8ClampedArray(imgData.buffer), imgWidth, imgHeight), 0, 0); 12800 img.bitmap = canvas.transferToImageBitmap(); 12801 img.data = null; 12802 } else { 12803 img.kind = ImageKind.RGBA_32BPP; 12804 img.data = imgData; 12805 } 12806 fnArray.splice(iFirstSave, count * 4, OPS.paintInlineImageXObjectGroup); 12807 argsArray.splice(iFirstSave, count * 4, [img, map]); 12808 return iFirstSave + 1; 12809}); 12810addState(InitialState, [OPS.save, OPS.transform, OPS.paintImageMaskXObject, OPS.restore], null, function iterateImageMaskGroup(context, i) { 12811 const fnArray = context.fnArray; 12812 const iFirstSave = context.iCurr - 3; 12813 const pos = (i - iFirstSave) % 4; 12814 switch (pos) { 12815 case 0: 12816 return fnArray[i] === OPS.save; 12817 case 1: 12818 return fnArray[i] === OPS.transform; 12819 case 2: 12820 return fnArray[i] === OPS.paintImageMaskXObject; 12821 case 3: 12822 return fnArray[i] === OPS.restore; 12823 } 12824 throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`); 12825}, function foundImageMaskGroup(context, i) { 12826 const MIN_IMAGES_IN_MASKS_BLOCK = 10; 12827 const MAX_IMAGES_IN_MASKS_BLOCK = 100; 12828 const MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000; 12829 const fnArray = context.fnArray, 12830 argsArray = context.argsArray; 12831 const curr = context.iCurr; 12832 const iFirstSave = curr - 3; 12833 const iFirstTransform = curr - 2; 12834 const iFirstPIMXO = curr - 1; 12835 let count = Math.floor((i - iFirstSave) / 4); 12836 if (count < MIN_IMAGES_IN_MASKS_BLOCK) { 12837 return i - (i - iFirstSave) % 4; 12838 } 12839 let isSameImage = false; 12840 let iTransform, transformArgs; 12841 const firstPIMXOArg0 = argsArray[iFirstPIMXO][0]; 12842 const firstTransformArg0 = argsArray[iFirstTransform][0], 12843 firstTransformArg1 = argsArray[iFirstTransform][1], 12844 firstTransformArg2 = argsArray[iFirstTransform][2], 12845 firstTransformArg3 = argsArray[iFirstTransform][3]; 12846 if (firstTransformArg1 === firstTransformArg2) { 12847 isSameImage = true; 12848 iTransform = iFirstTransform + 4; 12849 let iPIMXO = iFirstPIMXO + 4; 12850 for (let q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) { 12851 transformArgs = argsArray[iTransform]; 12852 if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== firstTransformArg1 || transformArgs[2] !== firstTransformArg2 || transformArgs[3] !== firstTransformArg3) { 12853 if (q < MIN_IMAGES_IN_MASKS_BLOCK) { 12854 isSameImage = false; 12855 } else { 12856 count = q; 12857 } 12858 break; 12859 } 12860 } 12861 } 12862 if (isSameImage) { 12863 count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK); 12864 const positions = new Float32Array(count * 2); 12865 iTransform = iFirstTransform; 12866 for (let q = 0; q < count; q++, iTransform += 4) { 12867 transformArgs = argsArray[iTransform]; 12868 positions[q << 1] = transformArgs[4]; 12869 positions[(q << 1) + 1] = transformArgs[5]; 12870 } 12871 fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectRepeat); 12872 argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg1, firstTransformArg2, firstTransformArg3, positions]); 12873 } else { 12874 count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK); 12875 const images = []; 12876 for (let q = 0; q < count; q++) { 12877 transformArgs = argsArray[iFirstTransform + (q << 2)]; 12878 const maskParams = argsArray[iFirstPIMXO + (q << 2)][0]; 12879 images.push({ 12880 data: maskParams.data, 12881 width: maskParams.width, 12882 height: maskParams.height, 12883 interpolate: maskParams.interpolate, 12884 count: maskParams.count, 12885 transform: transformArgs 12886 }); 12887 } 12888 fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectGroup); 12889 argsArray.splice(iFirstSave, count * 4, [images]); 12890 } 12891 return iFirstSave + 1; 12892}); 12893addState(InitialState, [OPS.save, OPS.transform, OPS.paintImageXObject, OPS.restore], function (context) { 12894 const argsArray = context.argsArray; 12895 const iFirstTransform = context.iCurr - 2; 12896 return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0; 12897}, function iterateImageGroup(context, i) { 12898 const fnArray = context.fnArray, 12899 argsArray = context.argsArray; 12900 const iFirstSave = context.iCurr - 3; 12901 const pos = (i - iFirstSave) % 4; 12902 switch (pos) { 12903 case 0: 12904 return fnArray[i] === OPS.save; 12905 case 1: 12906 if (fnArray[i] !== OPS.transform) { 12907 return false; 12908 } 12909 const iFirstTransform = context.iCurr - 2; 12910 const firstTransformArg0 = argsArray[iFirstTransform][0]; 12911 const firstTransformArg3 = argsArray[iFirstTransform][3]; 12912 if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) { 12913 return false; 12914 } 12915 return true; 12916 case 2: 12917 if (fnArray[i] !== OPS.paintImageXObject) { 12918 return false; 12919 } 12920 const iFirstPIXO = context.iCurr - 1; 12921 const firstPIXOArg0 = argsArray[iFirstPIXO][0]; 12922 if (argsArray[i][0] !== firstPIXOArg0) { 12923 return false; 12924 } 12925 return true; 12926 case 3: 12927 return fnArray[i] === OPS.restore; 12928 } 12929 throw new Error(`iterateImageGroup - invalid pos: ${pos}`); 12930}, function (context, i) { 12931 const MIN_IMAGES_IN_BLOCK = 3; 12932 const MAX_IMAGES_IN_BLOCK = 1000; 12933 const fnArray = context.fnArray, 12934 argsArray = context.argsArray; 12935 const curr = context.iCurr; 12936 const iFirstSave = curr - 3; 12937 const iFirstTransform = curr - 2; 12938 const iFirstPIXO = curr - 1; 12939 const firstPIXOArg0 = argsArray[iFirstPIXO][0]; 12940 const firstTransformArg0 = argsArray[iFirstTransform][0]; 12941 const firstTransformArg3 = argsArray[iFirstTransform][3]; 12942 const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK); 12943 if (count < MIN_IMAGES_IN_BLOCK) { 12944 return i - (i - iFirstSave) % 4; 12945 } 12946 const positions = new Float32Array(count * 2); 12947 let iTransform = iFirstTransform; 12948 for (let q = 0; q < count; q++, iTransform += 4) { 12949 const transformArgs = argsArray[iTransform]; 12950 positions[q << 1] = transformArgs[4]; 12951 positions[(q << 1) + 1] = transformArgs[5]; 12952 } 12953 const args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions]; 12954 fnArray.splice(iFirstSave, count * 4, OPS.paintImageXObjectRepeat); 12955 argsArray.splice(iFirstSave, count * 4, args); 12956 return iFirstSave + 1; 12957}); 12958addState(InitialState, [OPS.beginText, OPS.setFont, OPS.setTextMatrix, OPS.showText, OPS.endText], null, function iterateShowTextGroup(context, i) { 12959 const fnArray = context.fnArray, 12960 argsArray = context.argsArray; 12961 const iFirstSave = context.iCurr - 4; 12962 const pos = (i - iFirstSave) % 5; 12963 switch (pos) { 12964 case 0: 12965 return fnArray[i] === OPS.beginText; 12966 case 1: 12967 return fnArray[i] === OPS.setFont; 12968 case 2: 12969 return fnArray[i] === OPS.setTextMatrix; 12970 case 3: 12971 if (fnArray[i] !== OPS.showText) { 12972 return false; 12973 } 12974 const iFirstSetFont = context.iCurr - 3; 12975 const firstSetFontArg0 = argsArray[iFirstSetFont][0]; 12976 const firstSetFontArg1 = argsArray[iFirstSetFont][1]; 12977 if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) { 12978 return false; 12979 } 12980 return true; 12981 case 4: 12982 return fnArray[i] === OPS.endText; 12983 } 12984 throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`); 12985}, function (context, i) { 12986 const MIN_CHARS_IN_BLOCK = 3; 12987 const MAX_CHARS_IN_BLOCK = 1000; 12988 const fnArray = context.fnArray, 12989 argsArray = context.argsArray; 12990 const curr = context.iCurr; 12991 const iFirstBeginText = curr - 4; 12992 const iFirstSetFont = curr - 3; 12993 const iFirstSetTextMatrix = curr - 2; 12994 const iFirstShowText = curr - 1; 12995 const iFirstEndText = curr; 12996 const firstSetFontArg0 = argsArray[iFirstSetFont][0]; 12997 const firstSetFontArg1 = argsArray[iFirstSetFont][1]; 12998 let count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK); 12999 if (count < MIN_CHARS_IN_BLOCK) { 13000 return i - (i - iFirstBeginText) % 5; 13001 } 13002 let iFirst = iFirstBeginText; 13003 if (iFirstBeginText >= 4 && fnArray[iFirstBeginText - 4] === fnArray[iFirstSetFont] && fnArray[iFirstBeginText - 3] === fnArray[iFirstSetTextMatrix] && fnArray[iFirstBeginText - 2] === fnArray[iFirstShowText] && fnArray[iFirstBeginText - 1] === fnArray[iFirstEndText] && argsArray[iFirstBeginText - 4][0] === firstSetFontArg0 && argsArray[iFirstBeginText - 4][1] === firstSetFontArg1) { 13004 count++; 13005 iFirst -= 5; 13006 } 13007 let iEndText = iFirst + 4; 13008 for (let q = 1; q < count; q++) { 13009 fnArray.splice(iEndText, 3); 13010 argsArray.splice(iEndText, 3); 13011 iEndText += 2; 13012 } 13013 return iEndText + 1; 13014}); 13015addState(InitialState, [OPS.save, OPS.transform, OPS.constructPath, OPS.restore], context => { 13016 const argsArray = context.argsArray; 13017 const iFirstConstructPath = context.iCurr - 1; 13018 const op = argsArray[iFirstConstructPath][0]; 13019 if (op !== OPS.stroke && op !== OPS.closeStroke && op !== OPS.fillStroke && op !== OPS.eoFillStroke && op !== OPS.closeFillStroke && op !== OPS.closeEOFillStroke) { 13020 return true; 13021 } 13022 const iFirstTransform = context.iCurr - 2; 13023 const transform = argsArray[iFirstTransform]; 13024 return transform[0] === 1 && transform[1] === 0 && transform[2] === 0 && transform[3] === 1; 13025}, () => false, (context, i) => { 13026 const { 13027 fnArray, 13028 argsArray 13029 } = context; 13030 const curr = context.iCurr; 13031 const iFirstSave = curr - 3; 13032 const iFirstTransform = curr - 2; 13033 const iFirstConstructPath = curr - 1; 13034 const args = argsArray[iFirstConstructPath]; 13035 const transform = argsArray[iFirstTransform]; 13036 const [, [buffer], minMax] = args; 13037 if (minMax) { 13038 const newBBox = F32_BBOX_INIT.slice(); 13039 Util.axialAlignedBoundingBox(minMax, transform, newBBox); 13040 minMax.set(newBBox); 13041 for (let k = 0, kk = buffer.length; k < kk;) { 13042 switch (buffer[k++]) { 13043 case DrawOPS.moveTo: 13044 case DrawOPS.lineTo: 13045 Util.applyTransform(buffer, transform, k); 13046 k += 2; 13047 break; 13048 case DrawOPS.curveTo: 13049 Util.applyTransformToBezier(buffer, transform, k); 13050 k += 6; 13051 break; 13052 } 13053 } 13054 } 13055 fnArray.splice(iFirstSave, 4, OPS.constructPath); 13056 argsArray.splice(iFirstSave, 4, args); 13057 return iFirstSave + 1; 13058}); 13059class NullOptimizer { 13060 constructor(queue) { 13061 this.queue = queue; 13062 } 13063 _optimize() {} 13064 push(fn, args) { 13065 this.queue.fnArray.push(fn); 13066 this.queue.argsArray.push(args); 13067 this._optimize(); 13068 } 13069 flush() {} 13070 reset() {} 13071} 13072class QueueOptimizer extends NullOptimizer { 13073 constructor(queue) { 13074 super(queue); 13075 this.state = null; 13076 this.context = { 13077 iCurr: 0, 13078 fnArray: queue.fnArray, 13079 argsArray: queue.argsArray, 13080 isOffscreenCanvasSupported: OperatorList.isOffscreenCanvasSupported 13081 }; 13082 this.match = null; 13083 this.lastProcessed = 0; 13084 } 13085 _optimize() { 13086 const fnArray = this.queue.fnArray; 13087 let i = this.lastProcessed, 13088 ii = fnArray.length; 13089 let state = this.state; 13090 let match = this.match; 13091 if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) { 13092 this.lastProcessed = ii; 13093 return; 13094 } 13095 const context = this.context; 13096 while (i < ii) { 13097 if (match) { 13098 const iterate = (0, match.iterateFn)(context, i); 13099 if (iterate) { 13100 i++; 13101 continue; 13102 } 13103 i = (0, match.processFn)(context, i + 1); 13104 ii = fnArray.length; 13105 match = null; 13106 state = null; 13107 if (i >= ii) { 13108 break; 13109 } 13110 } 13111 state = (state || InitialState)[fnArray[i]]; 13112 if (!state || Array.isArray(state)) { 13113 i++; 13114 continue; 13115 } 13116 context.iCurr = i; 13117 i++; 13118 if (state.checkFn && !(0, state.checkFn)(context)) { 13119 state = null; 13120 continue; 13121 } 13122 match = state; 13123 state = null; 13124 } 13125 this.state = state; 13126 this.match = match; 13127 this.lastProcessed = i; 13128 } 13129 flush() { 13130 while (this.match) { 13131 const length = this.queue.fnArray.length; 13132 this.lastProcessed = (0, this.match.processFn)(this.context, length); 13133 this.match = null; 13134 this.state = null; 13135 this._optimize(); 13136 } 13137 } 13138 reset() { 13139 this.state = null; 13140 this.match = null; 13141 this.lastProcessed = 0; 13142 } 13143} 13144class OperatorList { 13145 static CHUNK_SIZE = 1000; 13146 static CHUNK_SIZE_ABOUT = this.CHUNK_SIZE - 5; 13147 static isOffscreenCanvasSupported = false; 13148 constructor(intent = 0, streamSink) { 13149 this._streamSink = streamSink; 13150 this.fnArray = []; 13151 this.argsArray = []; 13152 this.optimizer = streamSink && !(intent & RenderingIntentFlag.OPLIST) ? new QueueOptimizer(this) : new NullOptimizer(this); 13153 this.dependencies = new Set(); 13154 this._totalLength = 0; 13155 this.weight = 0; 13156 this._resolved = streamSink ? null : Promise.resolve(); 13157 } 13158 static setOptions({ 13159 isOffscreenCanvasSupported 13160 }) { 13161 this.isOffscreenCanvasSupported = isOffscreenCanvasSupported; 13162 } 13163 get length() { 13164 return this.argsArray.length; 13165 } 13166 get ready() { 13167 return this._resolved || this._streamSink.ready; 13168 } 13169 get totalLength() { 13170 return this._totalLength + this.length; 13171 } 13172 addOp(fn, args) { 13173 this.optimizer.push(fn, args); 13174 this.weight++; 13175 if (this._streamSink) { 13176 if (this.weight >= OperatorList.CHUNK_SIZE) { 13177 this.flush(); 13178 } else if (this.weight >= OperatorList.CHUNK_SIZE_ABOUT && (fn === OPS.restore || fn === OPS.endText)) { 13179 this.flush(); 13180 } 13181 } 13182 } 13183 addImageOps(fn, args, optionalContent, hasMask = false) { 13184 if (hasMask) { 13185 this.addOp(OPS.save); 13186 this.addOp(OPS.setGState, [[["SMask", false]]]); 13187 } 13188 if (optionalContent !== undefined) { 13189 this.addOp(OPS.beginMarkedContentProps, ["OC", optionalContent]); 13190 } 13191 this.addOp(fn, args); 13192 if (optionalContent !== undefined) { 13193 this.addOp(OPS.endMarkedContent, []); 13194 } 13195 if (hasMask) { 13196 this.addOp(OPS.restore); 13197 } 13198 } 13199 addDependency(dependency) { 13200 if (this.dependencies.has(dependency)) { 13201 return; 13202 } 13203 this.dependencies.add(dependency); 13204 this.addOp(OPS.dependency, [dependency]); 13205 } 13206 addDependencies(dependencies) { 13207 for (const dependency of dependencies) { 13208 this.addDependency(dependency); 13209 } 13210 } 13211 addOpList(opList) { 13212 if (!(opList instanceof OperatorList)) { 13213 warn('addOpList - ignoring invalid "opList" parameter.'); 13214 return; 13215 } 13216 for (const dependency of opList.dependencies) { 13217 this.dependencies.add(dependency); 13218 } 13219 for (let i = 0, ii = opList.length; i < ii; i++) { 13220 this.addOp(opList.fnArray[i], opList.argsArray[i]); 13221 } 13222 } 13223 getIR() { 13224 return { 13225 fnArray: this.fnArray, 13226 argsArray: this.argsArray, 13227 length: this.length 13228 }; 13229 } 13230 get _transfers() { 13231 const transfers = []; 13232 const { 13233 fnArray, 13234 argsArray, 13235 length 13236 } = this; 13237 for (let i = 0; i < length; i++) { 13238 switch (fnArray[i]) { 13239 case OPS.paintInlineImageXObject: 13240 case OPS.paintInlineImageXObjectGroup: 13241 case OPS.paintImageMaskXObject: 13242 { 13243 const { 13244 bitmap, 13245 data 13246 } = argsArray[i][0]; 13247 if (bitmap || data?.buffer) { 13248 transfers.push(bitmap || data.buffer); 13249 } 13250 break; 13251 } 13252 case OPS.constructPath: 13253 { 13254 const [, [data], minMax] = argsArray[i]; 13255 if (data) { 13256 transfers.push(data.buffer, minMax.buffer); 13257 } 13258 break; 13259 } 13260 case OPS.paintFormXObjectBegin: 13261 const [matrix, bbox] = argsArray[i]; 13262 if (matrix) { 13263 transfers.push(matrix.buffer); 13264 } 13265 if (bbox) { 13266 transfers.push(bbox.buffer); 13267 } 13268 break; 13269 case OPS.setTextMatrix: 13270 transfers.push(argsArray[i][0].buffer); 13271 break; 13272 } 13273 } 13274 return transfers; 13275 } 13276 flush(lastChunk = false, separateAnnots = null) { 13277 this.optimizer.flush(); 13278 const length = this.length; 13279 this._totalLength += length; 13280 this._streamSink.enqueue({ 13281 fnArray: this.fnArray, 13282 argsArray: this.argsArray, 13283 lastChunk, 13284 separateAnnots, 13285 length 13286 }, 1, this._transfers); 13287 this.dependencies.clear(); 13288 this.fnArray.length = 0; 13289 this.argsArray.length = 0; 13290 this.weight = 0; 13291 this.optimizer.reset(); 13292 } 13293} 13294class CheckedOperatorList extends OperatorList { 13295 needsIsolation = false; 13296
vendor: 2,394 bytes, lines 13296-13387
13296addOp(fn, args) { 13297 if (!this.needsIsolation) { 13298 if (fn === OPS.beginGroup) { 13299 this.needsIsolation = args[0].needsIsolation; 13300 } else if (fn === OPS.setGState) { 13301 for (const [key, val] of args[0]) { 13302 if (key === "BM" && val !== "source-over") { 13303 this.needsIsolation = true; 13304 break; 13305 } 13306 if (key === "SMask" && val !== false) { 13307 this.needsIsolation = true; 13308 break; 13309 } 13310 } 13311 } 13312 } 13313 super.addOp(fn, args); 13314 } 13315} 13316 13317;// ./src/core/pattern.js 13318 13319 13320 13321 13322 13323 13324 13325 13326 13327 13328 13329 13330 13331 13332const ShadingType = { 13333 FUNCTION_BASED: 1, 13334 AXIAL: 2, 13335 RADIAL: 3, 13336 FREE_FORM_MESH: 4, 13337 LATTICE_FORM_MESH: 5, 13338 COONS_PATCH_MESH: 6, 13339 TENSOR_PATCH_MESH: 7 13340}; 13341class Pattern { 13342 static #hasGPU = false; 13343 constructor() { 13344 unreachable("Cannot initialize Pattern."); 13345 } 13346 static setOptions({ 13347 hasGPU 13348 }) { 13349 this.#hasGPU = hasGPU; 13350 } 13351 static parseShading(shading, xref, res, pdfFunctionFactory, globalColorSpaceCache, localColorSpaceCache) { 13352 const dict = shading instanceof BaseStream ? shading.dict : shading; 13353 const type = dict.get("ShadingType"); 13354 try { 13355 switch (type) { 13356 case ShadingType.FUNCTION_BASED: 13357 return new FunctionBasedShading(dict, xref, res, pdfFunctionFactory, globalColorSpaceCache, localColorSpaceCache); 13358 case ShadingType.AXIAL: 13359 case ShadingType.RADIAL: 13360 return new RadialAxialShading(dict, xref, res, pdfFunctionFactory, globalColorSpaceCache, localColorSpaceCache); 13361 case ShadingType.FREE_FORM_MESH: 13362 case ShadingType.LATTICE_FORM_MESH: 13363 case ShadingType.COONS_PATCH_MESH: 13364 case ShadingType.TENSOR_PATCH_MESH: 13365 return new MeshShading(shading, xref, res, pdfFunctionFactory, globalColorSpaceCache, localColorSpaceCache); 13366 default: 13367 throw new FormatError("Unsupported ShadingType: " + type); 13368 } 13369 } catch (ex) { 13370 if (ex instanceof MissingDataException) { 13371 throw ex; 13372 } 13373 warn(ex); 13374 return new DummyShading(); 13375 } 13376 } 13377} 13378class BaseShading { 13379 static SMALL_NUMBER = 1e-6; 13380 getIR() { 13381 unreachable("Abstract method `getIR` called."); 13382 } 13383} 13384class RadialAxialShading extends BaseShading { 13385 constructor(dict, xref, resources, pdfFunctionFactory, globalColorSpaceCache, localColorSpaceCache) { 13386 super(); 13387 this.shadingType = dict.get("ShadingType");
vendor: 3,423 bytes, lines 13388-13483
13388 let coordsLen = 0; 13389 if (this.shadingType === ShadingType.AXIAL) { 13390 coordsLen = 4; 13391 } else if (this.shadingType === ShadingType.RADIAL) { 13392 coordsLen = 6; 13393 } 13394 this.coordsArr = dict.getArray("Coords"); 13395 if (!isNumberArray(this.coordsArr, coordsLen)) { 13396 throw new FormatError("RadialAxialShading: Invalid /Coords array."); 13397 } 13398 const cs = ColorSpaceUtils.parse({ 13399 cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"), 13400 xref, 13401 resources, 13402 pdfFunctionFactory, 13403 globalColorSpaceCache, 13404 localColorSpaceCache 13405 }); 13406 this.bbox = lookupNormalRect(dict.getArray("BBox"), null); 13407 let t0 = 0.0, 13408 t1 = 1.0; 13409 const domainArr = dict.getArray("Domain"); 13410 if (isNumberArray(domainArr, 2)) { 13411 [t0, t1] = domainArr; 13412 } 13413 let extendStart = false, 13414 extendEnd = false; 13415 const extendArr = dict.getArray("Extend"); 13416 if (isBooleanArray(extendArr, 2)) { 13417 [extendStart, extendEnd] = extendArr; 13418 } 13419 this.extendStart = extendStart; 13420 this.extendEnd = extendEnd; 13421 const fnObj = dict.getRaw("Function"); 13422 const fn = pdfFunctionFactory.create(fnObj, true); 13423 const NUMBER_OF_SAMPLES = 840; 13424 const step = (t1 - t0) / NUMBER_OF_SAMPLES; 13425 const colorStops = this.colorStops = []; 13426 if (t0 >= t1 || step <= 0) { 13427 info("Bad shading domain."); 13428 return; 13429 } 13430 const color = new Float32Array(cs.numComps), 13431 ratio = new Float32Array(1); 13432 let iBase = 0; 13433 ratio[0] = t0; 13434 fn(ratio, 0, color, 0); 13435 const rgbBuffer = new Uint8ClampedArray(3); 13436 cs.getRgb(color, 0, rgbBuffer); 13437 let [rBase, gBase, bBase] = rgbBuffer; 13438 colorStops.push([0, Util.makeHexColor(rBase, gBase, bBase)]); 13439 let iPrev = 1; 13440 ratio[0] = t0 + step; 13441 fn(ratio, 0, color, 0); 13442 cs.getRgb(color, 0, rgbBuffer); 13443 let [rPrev, gPrev, bPrev] = rgbBuffer; 13444 let maxSlopeR = rPrev - rBase + 1; 13445 let maxSlopeG = gPrev - gBase + 1; 13446 let maxSlopeB = bPrev - bBase + 1; 13447 let minSlopeR = rPrev - rBase - 1; 13448 let minSlopeG = gPrev - gBase - 1; 13449 let minSlopeB = bPrev - bBase - 1; 13450 for (let i = 2; i < NUMBER_OF_SAMPLES; i++) { 13451 ratio[0] = t0 + i * step; 13452 fn(ratio, 0, color, 0); 13453 cs.getRgb(color, 0, rgbBuffer); 13454 const [r, g, b] = rgbBuffer; 13455 const run = i - iBase; 13456 maxSlopeR = Math.min(maxSlopeR, (r - rBase + 1) / run); 13457 maxSlopeG = Math.min(maxSlopeG, (g - gBase + 1) / run); 13458 maxSlopeB = Math.min(maxSlopeB, (b - bBase + 1) / run); 13459 minSlopeR = Math.max(minSlopeR, (r - rBase - 1) / run); 13460 minSlopeG = Math.max(minSlopeG, (g - gBase - 1) / run); 13461 minSlopeB = Math.max(minSlopeB, (b - bBase - 1) / run); 13462 const slopesExist = minSlopeR <= maxSlopeR && minSlopeG <= maxSlopeG && minSlopeB <= maxSlopeB; 13463 if (!slopesExist) { 13464 const cssColor = Util.makeHexColor(rPrev, gPrev, bPrev); 13465 colorStops.push([iPrev / NUMBER_OF_SAMPLES, cssColor]); 13466 maxSlopeR = r - rPrev + 1; 13467 maxSlopeG = g - gPrev + 1; 13468 maxSlopeB = b - bPrev + 1; 13469 minSlopeR = r - rPrev - 1; 13470 minSlopeG = g - gPrev - 1; 13471 minSlopeB = b - bPrev - 1; 13472 iBase = iPrev; 13473 rBase = rPrev; 13474 gBase = gPrev; 13475 bBase = bPrev; 13476 } 13477 iPrev = i; 13478 rPrev = r; 13479 gPrev = g; 13480 bPrev = b; 13481 } 13482 colorStops.push([1, Util.makeHexColor(rPrev, gPrev, bPrev)]); 13483 let background = "transparent";
vendor: 9,972 bytes, lines 13484-13792
13484 if (dict.has("Background")) { 13485 background = cs.getRgbHex(dict.get("Background"), 0); 13486 } 13487 if (!extendStart) { 13488 colorStops.unshift([0, background]); 13489 colorStops[1][0] += BaseShading.SMALL_NUMBER; 13490 } 13491 if (!extendEnd) { 13492 colorStops.at(-1)[0] -= BaseShading.SMALL_NUMBER; 13493 colorStops.push([1, background]); 13494 } 13495 this.colorStops = colorStops; 13496 } 13497 getIR() { 13498 const { 13499 coordsArr, 13500 shadingType 13501 } = this; 13502 let type, p0, p1, r0, r1; 13503 if (shadingType === ShadingType.AXIAL) { 13504 p0 = [coordsArr[0], coordsArr[1]]; 13505 p1 = [coordsArr[2], coordsArr[3]]; 13506 r0 = null; 13507 r1 = null; 13508 type = "axial"; 13509 } else if (shadingType === ShadingType.RADIAL) { 13510 p0 = [coordsArr[0], coordsArr[1]]; 13511 p1 = [coordsArr[3], coordsArr[4]]; 13512 r0 = coordsArr[2]; 13513 r1 = coordsArr[5]; 13514 type = "radial"; 13515 } else { 13516 unreachable(`getPattern type unknown: ${shadingType}`); 13517 } 13518 return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1]; 13519 } 13520} 13521function meshUpdateBounds(self) { 13522 let minX = self.coords[0][0], 13523 minY = self.coords[0][1], 13524 maxX = minX, 13525 maxY = minY; 13526 for (let i = 1, ii = self.coords.length; i < ii; i++) { 13527 const x = self.coords[i][0], 13528 y = self.coords[i][1]; 13529 minX = minX > x ? x : minX; 13530 minY = minY > y ? y : minY; 13531 maxX = maxX < x ? x : maxX; 13532 maxY = maxY < y ? y : maxY; 13533 } 13534 self.bounds = [minX, minY, maxX, maxY]; 13535} 13536function meshPackData(self) { 13537 let i, j, ii; 13538 const coords = self.coords; 13539 const coordsPacked = new Float32Array(coords.length * 2); 13540 for (i = 0, j = 0, ii = coords.length; i < ii; i++) { 13541 const xy = coords[i]; 13542 coordsPacked[j++] = xy[0]; 13543 coordsPacked[j++] = xy[1]; 13544 } 13545 self.coords = coordsPacked; 13546 const colors = self.colors; 13547 const colorsPacked = new Uint8Array(colors.length * 4); 13548 for (i = 0, j = 0, ii = colors.length; i < ii; i++) { 13549 const c = colors[i]; 13550 colorsPacked[j++] = c[0]; 13551 colorsPacked[j++] = c[1]; 13552 colorsPacked[j++] = c[2]; 13553 j++; 13554 } 13555 self.colors = colorsPacked; 13556 for (const figure of self.figures) { 13557 figure.coords = new Uint32Array(figure.coords); 13558 figure.colors = new Uint32Array(figure.colors); 13559 } 13560} 13561function buildMeshVertexData(coords, colors, figures) { 13562 let vertexCount = 0; 13563 for (const figure of figures) { 13564 if (figure.type === MeshFigureType.TRIANGLES) { 13565 vertexCount += figure.coords.length; 13566 } else if (figure.type === MeshFigureType.LATTICE) { 13567 const vpr = figure.verticesPerRow; 13568 vertexCount += (Math.floor(figure.coords.length / vpr) - 1) * (vpr - 1) * 6; 13569 } 13570 } 13571 const posData = new Float32Array(vertexCount * 2); 13572 const colData = new Uint8Array(vertexCount * 4); 13573 let pOff = 0, 13574 cOff = 0; 13575 const addVertex = (pi, ci) => { 13576 posData[pOff++] = coords[pi * 2]; 13577 posData[pOff++] = coords[pi * 2 + 1]; 13578 colData[cOff++] = colors[ci * 4]; 13579 colData[cOff++] = colors[ci * 4 + 1]; 13580 colData[cOff++] = colors[ci * 4 + 2]; 13581 cOff++; 13582 }; 13583 for (const figure of figures) { 13584 const ps = figure.coords; 13585 const cs = figure.colors; 13586 if (figure.type === MeshFigureType.TRIANGLES) { 13587 for (let i = 0, ii = ps.length; i < ii; i++) { 13588 addVertex(ps[i], cs[i]); 13589 } 13590 } else if (figure.type === MeshFigureType.LATTICE) { 13591 const vpr = figure.verticesPerRow; 13592 const rows = Math.floor(ps.length / vpr) - 1; 13593 const cols = vpr - 1; 13594 for (let i = 0; i < rows; i++) { 13595 let q = i * vpr; 13596 for (let j = 0; j < cols; j++, q++) { 13597 addVertex(ps[q], cs[q]); 13598 addVertex(ps[q + 1], cs[q + 1]); 13599 addVertex(ps[q + vpr], cs[q + vpr]); 13600 addVertex(ps[q + vpr + 1], cs[q + vpr + 1]); 13601 addVertex(ps[q + 1], cs[q + 1]); 13602 addVertex(ps[q + vpr], cs[q + vpr]); 13603 } 13604 } 13605 } 13606 } 13607 return { 13608 posData, 13609 colData, 13610 vertexCount 13611 }; 13612} 13613class FunctionBasedShading extends BaseShading { 13614 static MAX_STEP_COUNT = 512; 13615 constructor(dict, xref, resources, pdfFunctionFactory, globalColorSpaceCache, localColorSpaceCache) { 13616 super(); 13617 this.bbox = lookupNormalRect(dict.getArray("BBox"), null); 13618 const cs = ColorSpaceUtils.parse({ 13619 cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"), 13620 xref, 13621 resources, 13622 pdfFunctionFactory, 13623 globalColorSpaceCache, 13624 localColorSpaceCache 13625 }); 13626 this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null; 13627 const fnObj = dict.getRaw("Function"); 13628 if (!fnObj) { 13629 throw new FormatError("FunctionBasedShading: missing /Function"); 13630 } 13631 const fn = pdfFunctionFactory.create(fnObj, true); 13632 const [x0, x1, y0, y1] = lookupRect(dict.getArray("Domain"), [0, 1, 0, 1]); 13633 const matrix = lookupMatrix(dict.getArray("Matrix"), IDENTITY_MATRIX); 13634 this.bounds = BBOX_INIT.slice(); 13635 Util.axialAlignedBoundingBox([x0, y0, x1, y1], matrix, this.bounds); 13636 const bboxW = this.bounds[2] - this.bounds[0]; 13637 const bboxH = this.bounds[3] - this.bounds[1]; 13638 const stepsX = MathClamp(Math.ceil(bboxW), 1, FunctionBasedShading.MAX_STEP_COUNT); 13639 const stepsY = MathClamp(Math.ceil(bboxH), 1, FunctionBasedShading.MAX_STEP_COUNT); 13640 const verticesPerRow = stepsX + 1; 13641 const totalVertices = (stepsY + 1) * verticesPerRow; 13642 const coords = this.coords = new Float32Array(totalVertices * 2); 13643 const colors = this.colors = new Uint8ClampedArray(totalVertices * 4); 13644 const xyBuf = new Float32Array(2); 13645 const colorBuf = new Float32Array(cs.numComps); 13646 const rangeX = (x1 - x0) / stepsX; 13647 const rangeY = (y1 - y0) / stepsY; 13648 const halfStepX = rangeX / 2; 13649 const halfStepY = rangeY / 2; 13650 let coordOffset = 0; 13651 let colorOffset = 0; 13652 for (let row = 0; row <= stepsY; row++) { 13653 const yDomain = y0 + rangeY * row; 13654 xyBuf[1] = row === stepsY ? yDomain - halfStepY : yDomain; 13655 for (let col = 0; col <= stepsX; col++) { 13656 const xDomain = x0 + rangeX * col; 13657 xyBuf[0] = col === stepsX ? xDomain - halfStepX : xDomain; 13658 fn(xyBuf, 0, colorBuf, 0); 13659 coords[coordOffset] = xDomain; 13660 coords[coordOffset + 1] = yDomain; 13661 Util.applyTransform(coords, matrix, coordOffset); 13662 coordOffset += 2; 13663 cs.getRgbItem(colorBuf, 0, colors, colorOffset); 13664 colorOffset += 4; 13665 } 13666 } 13667 const ps = new Uint32Array(totalVertices); 13668 for (let i = 0; i < totalVertices; i++) { 13669 ps[i] = i; 13670 } 13671 this.figures = [{ 13672 type: MeshFigureType.LATTICE, 13673 coords: ps, 13674 colors: new Uint32Array(ps), 13675 verticesPerRow 13676 }]; 13677 } 13678 getIR() { 13679 const { 13680 posData, 13681 colData, 13682 vertexCount 13683 } = buildMeshVertexData(this.coords, this.colors, this.figures); 13684 return ["Mesh", ShadingType.FUNCTION_BASED, posData, colData, vertexCount, this.bounds, this.bbox, this.background]; 13685 } 13686} 13687class MeshStreamReader { 13688 constructor(stream, context) { 13689 this.stream = stream; 13690 this.context = context; 13691 this.buffer = 0; 13692 this.bufferLength = 0; 13693 const numComps = context.numComps; 13694 this.tmpCompsBuf = new Float32Array(numComps); 13695 const csNumComps = context.colorSpace.numComps; 13696 this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf; 13697 } 13698 get hasData() { 13699 if (this.stream.end) { 13700 return this.stream.pos < this.stream.end; 13701 } 13702 if (this.bufferLength > 0) { 13703 return true; 13704 } 13705 const nextByte = this.stream.getByte(); 13706 if (nextByte < 0) { 13707 return false; 13708 } 13709 this.buffer = nextByte; 13710 this.bufferLength = 8; 13711 return true; 13712 } 13713 readBits(n) { 13714 const { 13715 stream 13716 } = this; 13717 let { 13718 buffer, 13719 bufferLength 13720 } = this; 13721 if (n === 32) { 13722 if (bufferLength === 0) { 13723 return stream.getInt32() >>> 0; 13724 } 13725 buffer = buffer << 24 | stream.getByte() << 16 | stream.getByte() << 8 | stream.getByte(); 13726 const nextByte = stream.getByte(); 13727 this.buffer = nextByte & (1 << bufferLength) - 1; 13728 return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0; 13729 } 13730 if (n === 8 && bufferLength === 0) { 13731 return stream.getByte(); 13732 } 13733 while (bufferLength < n) { 13734 buffer = buffer << 8 | stream.getByte(); 13735 bufferLength += 8; 13736 } 13737 bufferLength -= n; 13738 this.bufferLength = bufferLength; 13739 this.buffer = buffer & (1 << bufferLength) - 1; 13740 return buffer >> bufferLength; 13741 } 13742 align() { 13743 this.buffer = 0; 13744 this.bufferLength = 0; 13745 } 13746 readFlag() { 13747 return this.readBits(this.context.bitsPerFlag); 13748 } 13749 readCoordinate() { 13750 const { 13751 bitsPerCoordinate, 13752 decode 13753 } = this.context; 13754 const xi = this.readBits(bitsPerCoordinate); 13755 const yi = this.readBits(bitsPerCoordinate); 13756 const scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10; 13757 return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]]; 13758 } 13759 readComponents() { 13760 const { 13761 bitsPerComponent, 13762 colorFn, 13763 colorSpace, 13764 decode, 13765 numComps 13766 } = this.context; 13767 const scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10; 13768 const components = this.tmpCompsBuf; 13769 for (let i = 0, j = 4; i < numComps; i++, j += 2) { 13770 const ci = this.readBits(bitsPerComponent); 13771 components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j]; 13772 } 13773 const color = this.tmpCsCompsBuf; 13774 colorFn?.(components, 0, color, 0); 13775 return colorSpace.getRgb(color, 0); 13776 } 13777} 13778let bCache = Object.create(null); 13779function buildB(count) { 13780 const lut = []; 13781 for (let i = 0; i <= count; i++) { 13782 const t = i / count, 13783 t_ = 1 - t; 13784 lut.push(new Float32Array([t_ ** 3, 3 * t * t_ ** 2, 3 * t ** 2 * t_, t ** 3])); 13785 } 13786 return lut; 13787} 13788function getB(count) { 13789 return bCache[count] ||= buildB(count); 13790} 13791function clearPatternCaches() { 13792 bCache = Object.create(null
vendor: 16,742 bytes, lines 13792-14281
13792); 13793} 13794class MeshShading extends BaseShading { 13795 static MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3; 13796 static MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20; 13797 static TRIANGLE_DENSITY = 20; 13798 constructor(stream, xref, resources, pdfFunctionFactory, globalColorSpaceCache, localColorSpaceCache) { 13799 super(); 13800 if (!(stream instanceof BaseStream)) { 13801 throw new FormatError("Mesh data is not a stream"); 13802 } 13803 const dict = stream.dict; 13804 this.shadingType = dict.get("ShadingType"); 13805 this.bbox = lookupNormalRect(dict.getArray("BBox"), null); 13806 const cs = ColorSpaceUtils.parse({ 13807 cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"), 13808 xref, 13809 resources, 13810 pdfFunctionFactory, 13811 globalColorSpaceCache, 13812 localColorSpaceCache 13813 }); 13814 this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null; 13815 const fnObj = dict.getRaw("Function"); 13816 const fn = fnObj ? pdfFunctionFactory.create(fnObj, true) : null; 13817 this.coords = []; 13818 this.colors = []; 13819 this.figures = []; 13820 const decodeContext = { 13821 bitsPerCoordinate: dict.get("BitsPerCoordinate"), 13822 bitsPerComponent: dict.get("BitsPerComponent"), 13823 bitsPerFlag: dict.get("BitsPerFlag"), 13824 decode: dict.getArray("Decode"), 13825 colorFn: fn, 13826 colorSpace: cs, 13827 numComps: fn ? 1 : cs.numComps 13828 }; 13829 const reader = new MeshStreamReader(stream, decodeContext); 13830 let patchMesh = false; 13831 switch (this.shadingType) { 13832 case ShadingType.FREE_FORM_MESH: 13833 this._decodeType4Shading(reader); 13834 break; 13835 case ShadingType.LATTICE_FORM_MESH: 13836 const verticesPerRow = dict.get("VerticesPerRow") | 0; 13837 if (verticesPerRow < 2) { 13838 throw new FormatError("Invalid VerticesPerRow"); 13839 } 13840 this._decodeType5Shading(reader, verticesPerRow); 13841 break; 13842 case ShadingType.COONS_PATCH_MESH: 13843 this._decodeType6Shading(reader); 13844 patchMesh = true; 13845 break; 13846 case ShadingType.TENSOR_PATCH_MESH: 13847 this._decodeType7Shading(reader); 13848 patchMesh = true; 13849 break; 13850 default: 13851 unreachable("Unsupported mesh type."); 13852 break; 13853 } 13854 if (patchMesh) { 13855 this._updateBounds(); 13856 for (let i = 0, ii = this.figures.length; i < ii; i++) { 13857 this._buildFigureFromPatch(i); 13858 } 13859 } 13860 this._updateBounds(); 13861 this._packData(); 13862 } 13863 _decodeType4Shading(reader) { 13864 const coords = this.coords; 13865 const colors = this.colors; 13866 const operators = []; 13867 const ps = []; 13868 let verticesLeft = 0; 13869 while (reader.hasData) { 13870 const f = reader.readFlag(); 13871 const coord = reader.readCoordinate(); 13872 const color = reader.readComponents(); 13873 if (verticesLeft === 0) { 13874 if (!(0 <= f && f <= 2)) { 13875 throw new FormatError("Unknown type4 flag"); 13876 } 13877 switch (f) { 13878 case 0: 13879 verticesLeft = 3; 13880 break; 13881 case 1: 13882 ps.push(ps.at(-2), ps.at(-1)); 13883 verticesLeft = 1; 13884 break; 13885 case 2: 13886 ps.push(ps.at(-3), ps.at(-1)); 13887 verticesLeft = 1; 13888 break; 13889 } 13890 operators.push(f); 13891 } 13892 ps.push(coords.length); 13893 coords.push(coord); 13894 colors.push(color); 13895 verticesLeft--; 13896 reader.align(); 13897 } 13898 this.figures.push({ 13899 type: MeshFigureType.TRIANGLES, 13900 coords: new Int32Array(ps), 13901 colors: new Int32Array(ps) 13902 }); 13903 } 13904 _decodeType5Shading(reader, verticesPerRow) { 13905 const coords = this.coords; 13906 const colors = this.colors; 13907 const ps = []; 13908 while (reader.hasData) { 13909 const coord = reader.readCoordinate(); 13910 const color = reader.readComponents(); 13911 ps.push(coords.length); 13912 coords.push(coord); 13913 colors.push(color); 13914 } 13915 this.figures.push({ 13916 type: MeshFigureType.LATTICE, 13917 coords: new Int32Array(ps), 13918 colors: new Int32Array(ps), 13919 verticesPerRow 13920 }); 13921 } 13922 _decodeType6Shading(reader) { 13923 const coords = this.coords; 13924 const colors = this.colors; 13925 const ps = new Int32Array(16); 13926 const cs = new Int32Array(4); 13927 while (reader.hasData) { 13928 const f = reader.readFlag(); 13929 if (!(0 <= f && f <= 3)) { 13930 throw new FormatError("Unknown type6 flag"); 13931 } 13932 const pi = coords.length; 13933 for (let i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) { 13934 coords.push(reader.readCoordinate()); 13935 } 13936 const ci = colors.length; 13937 for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) { 13938 colors.push(reader.readComponents()); 13939 } 13940 let tmp1, tmp2, tmp3, tmp4; 13941 switch (f) { 13942 case 0: 13943 ps[12] = pi + 3; 13944 ps[13] = pi + 4; 13945 ps[14] = pi + 5; 13946 ps[15] = pi + 6; 13947 ps[8] = pi + 2; 13948 ps[11] = pi + 7; 13949 ps[4] = pi + 1; 13950 ps[7] = pi + 8; 13951 ps[0] = pi; 13952 ps[1] = pi + 11; 13953 ps[2] = pi + 10; 13954 ps[3] = pi + 9; 13955 cs[2] = ci + 1; 13956 cs[3] = ci + 2; 13957 cs[0] = ci; 13958 cs[1] = ci + 3; 13959 break; 13960 case 1: 13961 tmp1 = ps[12]; 13962 tmp2 = ps[13]; 13963 tmp3 = ps[14]; 13964 tmp4 = ps[15]; 13965 ps[12] = tmp4; 13966 ps[13] = pi + 0; 13967 ps[14] = pi + 1; 13968 ps[15] = pi + 2; 13969 ps[8] = tmp3; 13970 ps[11] = pi + 3; 13971 ps[4] = tmp2; 13972 ps[7] = pi + 4; 13973 ps[0] = tmp1; 13974 ps[1] = pi + 7; 13975 ps[2] = pi + 6; 13976 ps[3] = pi + 5; 13977 tmp1 = cs[2]; 13978 tmp2 = cs[3]; 13979 cs[2] = tmp2; 13980 cs[3] = ci; 13981 cs[0] = tmp1; 13982 cs[1] = ci + 1; 13983 break; 13984 case 2: 13985 tmp1 = ps[15]; 13986 tmp2 = ps[11]; 13987 ps[12] = ps[3]; 13988 ps[13] = pi + 0; 13989 ps[14] = pi + 1; 13990 ps[15] = pi + 2; 13991 ps[8] = ps[7]; 13992 ps[11] = pi + 3; 13993 ps[4] = tmp2; 13994 ps[7] = pi + 4; 13995 ps[0] = tmp1; 13996 ps[1] = pi + 7; 13997 ps[2] = pi + 6; 13998 ps[3] = pi + 5; 13999 tmp1 = cs[3]; 14000 cs[2] = cs[1]; 14001 cs[3] = ci; 14002 cs[0] = tmp1; 14003 cs[1] = ci + 1; 14004 break; 14005 case 3: 14006 ps[12] = ps[0]; 14007 ps[13] = pi + 0; 14008 ps[14] = pi + 1; 14009 ps[15] = pi + 2; 14010 ps[8] = ps[1]; 14011 ps[11] = pi + 3; 14012 ps[4] = ps[2]; 14013 ps[7] = pi + 4; 14014 ps[0] = ps[3]; 14015 ps[1] = pi + 7; 14016 ps[2] = pi + 6; 14017 ps[3] = pi + 5; 14018 cs[2] = cs[0]; 14019 cs[3] = ci; 14020 cs[0] = cs[1]; 14021 cs[1] = ci + 1; 14022 break; 14023 } 14024 ps[5] = coords.length; 14025 coords.push([(-4 * coords[ps[0]][0] - coords[ps[15]][0] + 6 * (coords[ps[4]][0] + coords[ps[1]][0]) - 2 * (coords[ps[12]][0] + coords[ps[3]][0]) + 3 * (coords[ps[13]][0] + coords[ps[7]][0])) / 9, (-4 * coords[ps[0]][1] - coords[ps[15]][1] + 6 * (coords[ps[4]][1] + coords[ps[1]][1]) - 2 * (coords[ps[12]][1] + coords[ps[3]][1]) + 3 * (coords[ps[13]][1] + coords[ps[7]][1])) / 9]); 14026 ps[6] = coords.length; 14027 coords.push([(-4 * coords[ps[3]][0] - coords[ps[12]][0] + 6 * (coords[ps[2]][0] + coords[ps[7]][0]) - 2 * (coords[ps[0]][0] + coords[ps[15]][0]) + 3 * (coords[ps[4]][0] + coords[ps[14]][0])) / 9, (-4 * coords[ps[3]][1] - coords[ps[12]][1] + 6 * (coords[ps[2]][1] + coords[ps[7]][1]) - 2 * (coords[ps[0]][1] + coords[ps[15]][1]) + 3 * (coords[ps[4]][1] + coords[ps[14]][1])) / 9]); 14028 ps[9] = coords.length; 14029 coords.push([(-4 * coords[ps[12]][0] - coords[ps[3]][0] + 6 * (coords[ps[8]][0] + coords[ps[13]][0]) - 2 * (coords[ps[0]][0] + coords[ps[15]][0]) + 3 * (coords[ps[11]][0] + coords[ps[1]][0])) / 9, (-4 * coords[ps[12]][1] - coords[ps[3]][1] + 6 * (coords[ps[8]][1] + coords[ps[13]][1]) - 2 * (coords[ps[0]][1] + coords[ps[15]][1]) + 3 * (coords[ps[11]][1] + coords[ps[1]][1])) / 9]); 14030 ps[10] = coords.length; 14031 coords.push([(-4 * coords[ps[15]][0] - coords[ps[0]][0] + 6 * (coords[ps[11]][0] + coords[ps[14]][0]) - 2 * (coords[ps[12]][0] + coords[ps[3]][0]) + 3 * (coords[ps[2]][0] + coords[ps[8]][0])) / 9, (-4 * coords[ps[15]][1] - coords[ps[0]][1] + 6 * (coords[ps[11]][1] + coords[ps[14]][1]) - 2 * (coords[ps[12]][1] + coords[ps[3]][1]) + 3 * (coords[ps[2]][1] + coords[ps[8]][1])) / 9]); 14032 this.figures.push({ 14033 type: MeshFigureType.PATCH, 14034 coords: new Int32Array(ps), 14035 colors: new Int32Array(cs) 14036 }); 14037 } 14038 } 14039 _decodeType7Shading(reader) { 14040 const coords = this.coords; 14041 const colors = this.colors; 14042 const ps = new Int32Array(16); 14043 const cs = new Int32Array(4); 14044 while (reader.hasData) { 14045 const f = reader.readFlag(); 14046 if (!(0 <= f && f <= 3)) { 14047 throw new FormatError("Unknown type7 flag"); 14048 } 14049 const pi = coords.length; 14050 for (let i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) { 14051 coords.push(reader.readCoordinate()); 14052 } 14053 const ci = colors.length; 14054 for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) { 14055 colors.push(reader.readComponents()); 14056 } 14057 let tmp1, tmp2, tmp3, tmp4; 14058 switch (f) { 14059 case 0: 14060 ps[12] = pi + 3; 14061 ps[13] = pi + 4; 14062 ps[14] = pi + 5; 14063 ps[15] = pi + 6; 14064 ps[8] = pi + 2; 14065 ps[9] = pi + 13; 14066 ps[10] = pi + 14; 14067 ps[11] = pi + 7; 14068 ps[4] = pi + 1; 14069 ps[5] = pi + 12; 14070 ps[6] = pi + 15; 14071 ps[7] = pi + 8; 14072 ps[0] = pi; 14073 ps[1] = pi + 11; 14074 ps[2] = pi + 10; 14075 ps[3] = pi + 9; 14076 cs[2] = ci + 1; 14077 cs[3] = ci + 2; 14078 cs[0] = ci; 14079 cs[1] = ci + 3; 14080 break; 14081 case 1: 14082 tmp1 = ps[12]; 14083 tmp2 = ps[13]; 14084 tmp3 = ps[14]; 14085 tmp4 = ps[15]; 14086 ps[12] = tmp4; 14087 ps[13] = pi + 0; 14088 ps[14] = pi + 1; 14089 ps[15] = pi + 2; 14090 ps[8] = tmp3; 14091 ps[9] = pi + 9; 14092 ps[10] = pi + 10; 14093 ps[11] = pi + 3; 14094 ps[4] = tmp2; 14095 ps[5] = pi + 8; 14096 ps[6] = pi + 11; 14097 ps[7] = pi + 4; 14098 ps[0] = tmp1; 14099 ps[1] = pi + 7; 14100 ps[2] = pi + 6; 14101 ps[3] = pi + 5; 14102 tmp1 = cs[2]; 14103 tmp2 = cs[3]; 14104 cs[2] = tmp2; 14105 cs[3] = ci; 14106 cs[0] = tmp1; 14107 cs[1] = ci + 1; 14108 break; 14109 case 2: 14110 tmp1 = ps[15]; 14111 tmp2 = ps[11]; 14112 ps[12] = ps[3]; 14113 ps[13] = pi + 0; 14114 ps[14] = pi + 1; 14115 ps[15] = pi + 2; 14116 ps[8] = ps[7]; 14117 ps[9] = pi + 9; 14118 ps[10] = pi + 10; 14119 ps[11] = pi + 3; 14120 ps[4] = tmp2; 14121 ps[5] = pi + 8; 14122 ps[6] = pi + 11; 14123 ps[7] = pi + 4; 14124 ps[0] = tmp1; 14125 ps[1] = pi + 7; 14126 ps[2] = pi + 6; 14127 ps[3] = pi + 5; 14128 tmp1 = cs[3]; 14129 cs[2] = cs[1]; 14130 cs[3] = ci; 14131 cs[0] = tmp1; 14132 cs[1] = ci + 1; 14133 break; 14134 case 3: 14135 ps[12] = ps[0]; 14136 ps[13] = pi + 0; 14137 ps[14] = pi + 1; 14138 ps[15] = pi + 2; 14139 ps[8] = ps[1]; 14140 ps[9] = pi + 9; 14141 ps[10] = pi + 10; 14142 ps[11] = pi + 3; 14143 ps[4] = ps[2]; 14144 ps[5] = pi + 8; 14145 ps[6] = pi + 11; 14146 ps[7] = pi + 4; 14147 ps[0] = ps[3]; 14148 ps[1] = pi + 7; 14149 ps[2] = pi + 6; 14150 ps[3] = pi + 5; 14151 cs[2] = cs[0]; 14152 cs[3] = ci; 14153 cs[0] = cs[1]; 14154 cs[1] = ci + 1; 14155 break; 14156 } 14157 this.figures.push({ 14158 type: MeshFigureType.PATCH, 14159 coords: new Int32Array(ps), 14160 colors: new Int32Array(cs) 14161 }); 14162 } 14163 } 14164 _buildFigureFromPatch(index) { 14165 const figure = this.figures[index]; 14166 assert(figure.type === MeshFigureType.PATCH, "Unexpected patch mesh figure"); 14167 const coords = this.coords, 14168 colors = this.colors; 14169 const pi = figure.coords; 14170 const ci = figure.colors; 14171 const figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]); 14172 const figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]); 14173 const figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]); 14174 const figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]); 14175 let splitXBy = Math.ceil((figureMaxX - figureMinX) * MeshShading.TRIANGLE_DENSITY / (this.bounds[2] - this.bounds[0])); 14176 splitXBy = MathClamp(splitXBy, MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT); 14177 let splitYBy = Math.ceil((figureMaxY - figureMinY) * MeshShading.TRIANGLE_DENSITY / (this.bounds[3] - this.bounds[1])); 14178 splitYBy = MathClamp(splitYBy, MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT); 14179 const verticesPerRow = splitXBy + 1; 14180 const figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow); 14181 const figureColors = new Int32Array((splitYBy + 1) * verticesPerRow); 14182 let k = 0; 14183 const cl = new Uint8Array(3), 14184 cr = new Uint8Array(3); 14185 const c0 = colors[ci[0]], 14186 c1 = colors[ci[1]], 14187 c2 = colors[ci[2]], 14188 c3 = colors[ci[3]]; 14189 const bRow = getB(splitYBy), 14190 bCol = getB(splitXBy); 14191 for (let row = 0; row <= splitYBy; row++) { 14192 cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0; 14193 cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0; 14194 cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0; 14195 cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0; 14196 cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0; 14197 cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0; 14198 for (let col = 0; col <= splitXBy; col++, k++) { 14199 if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) { 14200 continue; 14201 } 14202 let x = 0, 14203 y = 0; 14204 let q = 0; 14205 for (let i = 0; i <= 3; i++) { 14206 for (let j = 0; j <= 3; j++, q++) { 14207 const m = bRow[row][i] * bCol[col][j]; 14208 x += coords[pi[q]][0] * m; 14209 y += coords[pi[q]][1] * m; 14210 } 14211 } 14212 figureCoords[k] = coords.length; 14213 coords.push([x, y]); 14214 figureColors[k] = colors.length; 14215 const newColor = new Uint8Array(3); 14216 newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0; 14217 newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0; 14218 newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0; 14219 colors.push(newColor); 14220 } 14221 } 14222 figureCoords[0] = pi[0]; 14223 figureColors[0] = ci[0]; 14224 figureCoords[splitXBy] = pi[3]; 14225 figureColors[splitXBy] = ci[1]; 14226 figureCoords[verticesPerRow * splitYBy] = pi[12]; 14227 figureColors[verticesPerRow * splitYBy] = ci[2]; 14228 figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15]; 14229 figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3]; 14230 this.figures[index] = { 14231 type: MeshFigureType.LATTICE, 14232 coords: figureCoords, 14233 colors: figureColors, 14234 verticesPerRow 14235 }; 14236 } 14237 _updateBounds() { 14238 meshUpdateBounds(this); 14239 } 14240 _packData() { 14241 meshPackData(this); 14242 } 14243 getIR() { 14244 const { 14245 posData, 14246 colData, 14247 vertexCount 14248 } = buildMeshVertexData(this.coords, this.colors, this.figures); 14249 return ["Mesh", this.shadingType, posData, colData, vertexCount, this.bounds, this.bbox, this.background]; 14250 } 14251} 14252class DummyShading extends BaseShading { 14253 getIR() { 14254 return ["Dummy"]; 14255 } 14256} 14257function getTilingPatternIR(operatorList, dict, color, needsIsolation = true) { 14258 const matrix = lookupMatrix(dict.getArray("Matrix"), IDENTITY_MATRIX); 14259 const bbox = lookupNormalRect(dict.getArray("BBox"), null); 14260 if (!bbox || bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) { 14261 throw new FormatError(`Invalid getTilingPatternIR /BBox array.`); 14262 } 14263 const xstep = dict.get("XStep"); 14264 if (typeof xstep !== "number") { 14265 throw new FormatError(`Invalid getTilingPatternIR /XStep value.`); 14266 } 14267 const ystep = dict.get("YStep"); 14268 if (typeof ystep !== "number") { 14269 throw new FormatError(`Invalid getTilingPatternIR /YStep value.`); 14270 } 14271 const paintType = dict.get("PaintType"); 14272 if (!Number.isInteger(paintType)) { 14273 throw new FormatError(`Invalid getTilingPatternIR /PaintType value.`); 14274 } 14275 const tilingType = dict.get("TilingType"); 14276 if (!Number.isInteger(tilingType)) { 14277 throw new FormatError(`Invalid getTilingPatternIR /TilingType value.`); 14278 } 14279 return ["TilingPattern", color, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType, needsIsolation]; 14280} 14281
vendor: 10,922 bytes, lines 14282-14671
14282// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.find.js 14283var es_iterator_find = __webpack_require__(116); 14284// EXTERNAL MODULE: ./node_modules/core-js/modules/es.math.sum-precise.js 14285var es_math_sum_precise = __webpack_require__(3068); 14286// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.for-each.js 14287var es_iterator_for_each = __webpack_require__(7588); 14288;// ./src/core/binary_cmap.js 14289 14290 14291 14292 14293 14294 14295 14296 14297 14298 14299function hexToInt(a, size) { 14300 let n = 0; 14301 for (let i = 0; i <= size; i++) { 14302 n = n << 8 | a[i]; 14303 } 14304 return n >>> 0; 14305} 14306function hexToStr(a, size) { 14307 if (size === 1) { 14308 return String.fromCharCode(a[0], a[1]); 14309 } 14310 if (size === 3) { 14311 return String.fromCharCode(a[0], a[1], a[2], a[3]); 14312 } 14313 return String.fromCharCode(...a.subarray(0, size + 1)); 14314} 14315function addHex(a, b, size) { 14316 let c = 0; 14317 for (let i = size; i >= 0; i--) { 14318 c += a[i] + b[i]; 14319 a[i] = c & 255; 14320 c >>= 8; 14321 } 14322} 14323function incHex(a, size) { 14324 let c = 1; 14325 for (let i = size; i >= 0 && c > 0; i--) { 14326 c += a[i]; 14327 a[i] = c & 255; 14328 c >>= 8; 14329 } 14330} 14331const MAX_NUM_SIZE = 16; 14332const MAX_ENCODED_NUM_SIZE = 19; 14333class BinaryCMapStream extends Stream { 14334 tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE); 14335 constructor(data) { 14336 super(data, 0, data.length, null); 14337 } 14338 readNumber() { 14339 let n = 0; 14340 let last; 14341 do { 14342 const b = this.getByte(); 14343 if (b < 0) { 14344 throw new FormatError("unexpected EOF in bcmap"); 14345 } 14346 last = !(b & 0x80); 14347 n = n << 7 | b & 0x7f; 14348 } while (!last); 14349 return n; 14350 } 14351 readSigned() { 14352 const n = this.readNumber(); 14353 return n & 1 ? ~(n >>> 1) : n >>> 1; 14354 } 14355 readHex(num, size) { 14356 num.set(this.getBytes(size + 1)); 14357 } 14358 readHexNumber(num, size) { 14359 let last; 14360 const stack = this.tmpBuf; 14361 let sp = 0; 14362 do { 14363 const b = this.getByte(); 14364 if (b < 0) { 14365 throw new FormatError("unexpected EOF in bcmap"); 14366 } 14367 last = !(b & 0x80); 14368 stack[sp++] = b & 0x7f; 14369 } while (!last); 14370 let i = size, 14371 buffer = 0, 14372 bufferSize = 0; 14373 while (i >= 0) { 14374 while (bufferSize < 8 && stack.length > 0) { 14375 buffer |= stack[--sp] << bufferSize; 14376 bufferSize += 7; 14377 } 14378 num[i] = buffer & 255; 14379 i--; 14380 buffer >>= 8; 14381 bufferSize -= 8; 14382 } 14383 } 14384 readHexSigned(num, size) { 14385 this.readHexNumber(num, size); 14386 const sign = num[size] & 1 ? 255 : 0; 14387 let c = 0; 14388 for (let i = 0; i <= size; i++) { 14389 c = (c & 1) << 8 | num[i]; 14390 num[i] = c >> 1 ^ sign; 14391 } 14392 } 14393 readString() { 14394 const len = this.readNumber(), 14395 buf = new Array(len); 14396 for (let i = 0; i < len; i++) { 14397 buf[i] = this.readNumber(); 14398 } 14399 return String.fromCharCode(...buf); 14400 } 14401} 14402class BinaryCMapReader { 14403 async process(data, cMap, extend) { 14404 const stream = new BinaryCMapStream(data); 14405 const header = stream.getByte(); 14406 cMap.vertical = !!(header & 1); 14407 let useCMap = null; 14408 const start = new Uint8Array(MAX_NUM_SIZE); 14409 const end = new Uint8Array(MAX_NUM_SIZE); 14410 const char = new Uint8Array(MAX_NUM_SIZE); 14411 const charCode = new Uint8Array(MAX_NUM_SIZE); 14412 const tmp = new Uint8Array(MAX_NUM_SIZE); 14413 let code; 14414 let b; 14415 while ((b = stream.getByte()) >= 0) { 14416 const type = b >> 5; 14417 if (type === 7) { 14418 switch (b & 0x1f) { 14419 case 0: 14420 stream.readString(); 14421 break; 14422 case 1: 14423 useCMap = stream.readString(); 14424 break; 14425 } 14426 continue; 14427 } 14428 const sequence = !!(b & 0x10); 14429 const dataSize = b & 15; 14430 if (dataSize + 1 > MAX_NUM_SIZE) { 14431 throw new Error("BinaryCMapReader.process: Invalid dataSize."); 14432 } 14433 const ucs2DataSize = 1; 14434 const subitemsCount = stream.readNumber(); 14435 switch (type) { 14436 case 0: 14437 stream.readHex(start, dataSize); 14438 stream.readHexNumber(end, dataSize); 14439 addHex(end, start, dataSize); 14440 cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize)); 14441 for (let i = 1; i < subitemsCount; i++) { 14442 incHex(end, dataSize); 14443 stream.readHexNumber(start, dataSize); 14444 addHex(start, end, dataSize); 14445 stream.readHexNumber(end, dataSize); 14446 addHex(end, start, dataSize); 14447 cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize)); 14448 } 14449 break; 14450 case 1: 14451 stream.readHex(start, dataSize); 14452 stream.readHexNumber(end, dataSize); 14453 addHex(end, start, dataSize); 14454 stream.readNumber(); 14455 for (let i = 1; i < subitemsCount; i++) { 14456 incHex(end, dataSize); 14457 stream.readHexNumber(start, dataSize); 14458 addHex(start, end, dataSize); 14459 stream.readHexNumber(end, dataSize); 14460 addHex(end, start, dataSize); 14461 stream.readNumber(); 14462 } 14463 break; 14464 case 2: 14465 stream.readHex(char, dataSize); 14466 code = stream.readNumber(); 14467 cMap.mapOne(hexToInt(char, dataSize), code); 14468 for (let i = 1; i < subitemsCount; i++) { 14469 incHex(char, dataSize); 14470 if (!sequence) { 14471 stream.readHexNumber(tmp, dataSize); 14472 addHex(char, tmp, dataSize); 14473 } 14474 code = stream.readSigned() + (code + 1); 14475 cMap.mapOne(hexToInt(char, dataSize), code); 14476 } 14477 break; 14478 case 3: 14479 stream.readHex(start, dataSize); 14480 stream.readHexNumber(end, dataSize); 14481 addHex(end, start, dataSize); 14482 code = stream.readNumber(); 14483 cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code); 14484 for (let i = 1; i < subitemsCount; i++) { 14485 incHex(end, dataSize); 14486 if (!sequence) { 14487 stream.readHexNumber(start, dataSize); 14488 addHex(start, end, dataSize); 14489 } else { 14490 start.set(end); 14491 } 14492 stream.readHexNumber(end, dataSize); 14493 addHex(end, start, dataSize); 14494 code = stream.readNumber(); 14495 cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code); 14496 } 14497 break; 14498 case 4: 14499 stream.readHex(char, ucs2DataSize); 14500 stream.readHex(charCode, dataSize); 14501 cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize)); 14502 for (let i = 1; i < subitemsCount; i++) { 14503 incHex(char, ucs2DataSize); 14504 if (!sequence) { 14505 stream.readHexNumber(tmp, ucs2DataSize); 14506 addHex(char, tmp, ucs2DataSize); 14507 } 14508 incHex(charCode, dataSize); 14509 stream.readHexSigned(tmp, dataSize); 14510 addHex(charCode, tmp, dataSize); 14511 cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize)); 14512 } 14513 break; 14514 case 5: 14515 stream.readHex(start, ucs2DataSize); 14516 stream.readHexNumber(end, ucs2DataSize); 14517 addHex(end, start, ucs2DataSize); 14518 stream.readHex(charCode, dataSize); 14519 cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize)); 14520 for (let i = 1; i < subitemsCount; i++) { 14521 incHex(end, ucs2DataSize); 14522 if (!sequence) { 14523 stream.readHexNumber(start, ucs2DataSize); 14524 addHex(start, end, ucs2DataSize); 14525 } else { 14526 start.set(end); 14527 } 14528 stream.readHexNumber(end, ucs2DataSize); 14529 addHex(end, start, ucs2DataSize); 14530 stream.readHex(charCode, dataSize); 14531 cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize)); 14532 } 14533 break; 14534 default: 14535 throw new Error(`BinaryCMapReader.process - unknown type: ${type}`); 14536 } 14537 } 14538 if (useCMap) { 14539 return extend(useCMap); 14540 } 14541 return cMap; 14542 } 14543} 14544 14545;// ./src/core/ascii_85_stream.js 14546 14547 14548 14549 14550 14551 14552 14553 14554 14555 14556class Ascii85Stream extends DecodeStream { 14557 #input = new Uint8Array(5); 14558 constructor(str, maybeLength) { 14559 if (maybeLength) { 14560 maybeLength *= 0.8; 14561 } 14562 super(maybeLength); 14563 this.stream = str; 14564 this.dict = str.dict; 14565 } 14566 readBlock() { 14567 const TILDA_CHAR = 0x7e; 14568 const Z_LOWER_CHAR = 0x7a; 14569 const EOF = -1; 14570 const str = this.stream; 14571 let c = str.getByte(); 14572 while (isWhiteSpace(c)) { 14573 c = str.getByte(); 14574 } 14575 if (c === EOF || c === TILDA_CHAR) { 14576 this.eof = true; 14577 return; 14578 } 14579 const bufferLength = this.bufferLength; 14580 let buffer, i; 14581 if (c === Z_LOWER_CHAR) { 14582 buffer = this.ensureBuffer(bufferLength + 4); 14583 buffer.fill(0, bufferLength, bufferLength + 4); 14584 this.bufferLength += 4; 14585 } else { 14586 const input = this.#input; 14587 input[0] = c; 14588 for (i = 1; i < 5; ++i) { 14589 c = str.getByte(); 14590 while (isWhiteSpace(c)) { 14591 c = str.getByte(); 14592 } 14593 input[i] = c; 14594 if (c === EOF || c === TILDA_CHAR) { 14595 break; 14596 } 14597 } 14598 buffer = this.ensureBuffer(bufferLength + i - 1); 14599 this.bufferLength += i - 1; 14600 if (i < 5) { 14601 input.fill(0x21 + 84, i, 5); 14602 this.eof = true; 14603 } 14604 let t = 0; 14605 for (i = 0; i < 5; ++i) { 14606 t = t * 85 + (input[i] - 0x21); 14607 } 14608 for (i = 3; i >= 0; --i) { 14609 buffer[bufferLength + i] = t & 0xff; 14610 t >>= 8; 14611 } 14612 } 14613 } 14614} 14615 14616;// ./src/core/ascii_hex_stream.js 14617 14618class AsciiHexStream extends DecodeStream { 14619 constructor(str, maybeLength) { 14620 if (maybeLength) { 14621 maybeLength *= 0.5; 14622 } 14623 super(maybeLength); 14624 this.stream = str; 14625 this.dict = str.dict; 14626 this.firstDigit = -1; 14627 } 14628 readBlock() { 14629 const UPSTREAM_BLOCK_SIZE = 8000; 14630 const bytes = this.stream.getBytes(UPSTREAM_BLOCK_SIZE); 14631 if (!bytes.length) { 14632 this.eof = true; 14633 return; 14634 } 14635 const maxDecodeLength = bytes.length + 1 >> 1; 14636 const buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength); 14637 let bufferLength = this.bufferLength; 14638 let firstDigit = this.firstDigit; 14639 for (const ch of bytes) { 14640 let digit; 14641 if (ch >= 0x30 && ch <= 0x39) { 14642 digit = ch & 0x0f; 14643 } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) { 14644 digit = (ch & 0x0f) + 9; 14645 } else if (ch === 0x3e) { 14646 this.eof = true; 14647 break; 14648 } else { 14649 continue; 14650 } 14651 if (firstDigit < 0) { 14652 firstDigit = digit; 14653 } else { 14654 buffer[bufferLength++] = firstDigit << 4 | digit; 14655 firstDigit = -1; 14656 } 14657 } 14658 if (firstDigit >= 0 && this.eof) { 14659 buffer[bufferLength++] = firstDigit << 4; 14660 firstDigit = -1; 14661 } 14662 this.firstDigit = firstDigit; 14663 this.bufferLength = bufferLength; 14664 } 14665} 14666 14667;// ./external/brotli/decode.js 14668 14669 14670 14671
vendor: 150,744 bytes, lines 14672-16514
14672 14673let Options; 14674let makeBrotliDecode = () => { 14675 const MAX_HUFFMAN_TABLE_SIZE = Int32Array.from([256, 402, 436, 468, 500, 534, 566, 598, 630, 662, 694, 726, 758, 790, 822, 854, 886, 920, 952, 984, 1016, 1048, 1080]); 14676 const CODE_LENGTH_CODE_ORDER = Int32Array.from([1, 2, 3, 4, 0, 5, 17, 6, 16, 7, 8, 9, 10, 11, 12, 13, 14, 15]); 14677 const DISTANCE_SHORT_CODE_INDEX_OFFSET = Int32Array.from([0, 3, 2, 1, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3]); 14678 const DISTANCE_SHORT_CODE_VALUE_OFFSET = Int32Array.from([0, 0, 0, 0, -1, 1, -2, 2, -3, 3, -1, 1, -2, 2, -3, 3]); 14679 const FIXED_TABLE = Int32Array.from([0x020000, 0x020004, 0x020003, 0x030002, 0x020000, 0x020004, 0x020003, 0x040001, 0x020000, 0x020004, 0x020003, 0x030002, 0x020000, 0x020004, 0x020003, 0x040005]); 14680 const BLOCK_LENGTH_OFFSET = Int32Array.from([1, 5, 9, 13, 17, 25, 33, 41, 49, 65, 81, 97, 113, 145, 177, 209, 241, 305, 369, 497, 753, 1265, 2289, 4337, 8433, 16625]); 14681 const BLOCK_LENGTH_N_BITS = Int32Array.from([2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 8, 9, 10, 11, 12, 13, 24]); 14682 const INSERT_LENGTH_N_BITS = Int16Array.from([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x03, 0x03, 0x04, 0x04, 0x05, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0C, 0x0E, 0x18]); 14683 const COPY_LENGTH_N_BITS = Int16Array.from([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x03, 0x03, 0x04, 0x04, 0x05, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x18]); 14684 const CMD_LOOKUP = new Int16Array(2816); 14685 unpackCommandLookupTable(CMD_LOOKUP); 14686 function log2floor(i) { 14687 let result = -1; 14688 let step = 16; 14689 let v = i; 14690 while (step > 0) { 14691 let next = v >> step; 14692 if (next !== 0) { 14693 result += step; 14694 v = next; 14695 } 14696 step = step >> 1; 14697 } 14698 return result + v; 14699 } 14700 function calculateDistanceAlphabetSize(npostfix, ndirect, maxndistbits) { 14701 return 16 + ndirect + 2 * (maxndistbits << npostfix); 14702 } 14703 function calculateDistanceAlphabetLimit(s, maxDistance, npostfix, ndirect) { 14704 if (maxDistance < ndirect + (2 << npostfix)) { 14705 return makeError(s, -23); 14706 } 14707 const offset = (maxDistance - ndirect >> npostfix) + 4; 14708 const ndistbits = log2floor(offset) - 1; 14709 const group = ndistbits - 1 << 1 | offset >> ndistbits & 1; 14710 return (group - 1 << npostfix) + (1 << npostfix) + ndirect + 16; 14711 } 14712 function unpackCommandLookupTable(cmdLookup) { 14713 const insertLengthOffsets = new Int32Array(24); 14714 const copyLengthOffsets = new Int32Array(24); 14715 copyLengthOffsets[0] = 2; 14716 for (let i = 0; i < 23; ++i) { 14717 insertLengthOffsets[i + 1] = insertLengthOffsets[i] + (1 << INSERT_LENGTH_N_BITS[i]); 14718 copyLengthOffsets[i + 1] = copyLengthOffsets[i] + (1 << COPY_LENGTH_N_BITS[i]); 14719 } 14720 for (let cmdCode = 0; cmdCode < 704; ++cmdCode) { 14721 let rangeIdx = cmdCode >> 6; 14722 let distanceContextOffset = -4; 14723 if (rangeIdx >= 2) { 14724 rangeIdx -= 2; 14725 distanceContextOffset = 0; 14726 } 14727 const insertCode = (0x29850 >> rangeIdx * 2 & 0x3) << 3 | cmdCode >> 3 & 7; 14728 const copyCode = (0x26244 >> rangeIdx * 2 & 0x3) << 3 | cmdCode & 7; 14729 const copyLengthOffset = copyLengthOffsets[copyCode]; 14730 const distanceContext = distanceContextOffset + Math.min(copyLengthOffset, 5) - 2; 14731 const index = cmdCode * 4; 14732 cmdLookup[index] = INSERT_LENGTH_N_BITS[insertCode] | COPY_LENGTH_N_BITS[copyCode] << 8; 14733 cmdLookup[index + 1] = insertLengthOffsets[insertCode]; 14734 cmdLookup[index + 2] = copyLengthOffsets[copyCode]; 14735 cmdLookup[index + 3] = distanceContext; 14736 } 14737 } 14738 function decodeWindowBits(s) { 14739 const largeWindowEnabled = s.isLargeWindow; 14740 s.isLargeWindow = 0; 14741 if (s.bitOffset >= 16) { 14742 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 14743 s.bitOffset -= 16; 14744 } 14745 if (readFewBits(s, 1) === 0) { 14746 return 16; 14747 } 14748 let n = readFewBits(s, 3); 14749 if (n !== 0) { 14750 return 17 + n; 14751 } 14752 n = readFewBits(s, 3); 14753 if (n !== 0) { 14754 if (n === 1) { 14755 if (largeWindowEnabled === 0) { 14756 return -1; 14757 } 14758 s.isLargeWindow = 1; 14759 if (readFewBits(s, 1) === 1) { 14760 return -1; 14761 } 14762 n = readFewBits(s, 6); 14763 if (n < 10 || n > 30) { 14764 return -1; 14765 } 14766 return n; 14767 } 14768 return 8 + n; 14769 } 14770 return 17; 14771 } 14772 function attachDictionaryChunk(s, data) { 14773 if (s.runningState !== 1) { 14774 return makeError(s, -24); 14775 } 14776 if (s.cdNumChunks === 0) { 14777 s.cdChunks = new Array(16); 14778 s.cdChunkOffsets = new Int32Array(16); 14779 s.cdBlockBits = -1; 14780 } 14781 if (s.cdNumChunks === 15) { 14782 return makeError(s, -27); 14783 } 14784 s.cdChunks[s.cdNumChunks] = data; 14785 s.cdNumChunks++; 14786 s.cdTotalSize += data.length; 14787 s.cdChunkOffsets[s.cdNumChunks] = s.cdTotalSize; 14788 return 0; 14789 } 14790 function initState(s) { 14791 if (s.runningState !== 0) { 14792 return makeError(s, -26); 14793 } 14794 s.blockTrees = new Int32Array(3091); 14795 s.blockTrees[0] = 7; 14796 s.distRbIdx = 3; 14797 let result = calculateDistanceAlphabetLimit(s, 0x7FFFFFFC, 3, 120); 14798 if (result < 0) { 14799 return result; 14800 } 14801 const maxDistanceAlphabetLimit = result; 14802 s.distExtraBits = new Int8Array(maxDistanceAlphabetLimit); 14803 s.distOffset = new Int32Array(maxDistanceAlphabetLimit); 14804 result = initBitReader(s); 14805 if (result < 0) { 14806 return result; 14807 } 14808 s.runningState = 1; 14809 return 0; 14810 } 14811 function close(s) { 14812 if (s.runningState === 0) { 14813 return makeError(s, -25); 14814 } 14815 if (s.runningState > 0) { 14816 s.runningState = 11; 14817 } 14818 return 0; 14819 } 14820 function decodeVarLenUnsignedByte(s) { 14821 if (s.bitOffset >= 16) { 14822 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 14823 s.bitOffset -= 16; 14824 } 14825 if (readFewBits(s, 1) !== 0) { 14826 const n = readFewBits(s, 3); 14827 if (n === 0) { 14828 return 1; 14829 } 14830 return readFewBits(s, n) + (1 << n); 14831 } 14832 return 0; 14833 } 14834 function decodeMetaBlockLength(s) { 14835 if (s.bitOffset >= 16) { 14836 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 14837 s.bitOffset -= 16; 14838 } 14839 s.inputEnd = readFewBits(s, 1); 14840 s.metaBlockLength = 0; 14841 s.isUncompressed = 0; 14842 s.isMetadata = 0; 14843 if (s.inputEnd !== 0 && readFewBits(s, 1) !== 0) { 14844 return 0; 14845 } 14846 const sizeNibbles = readFewBits(s, 2) + 4; 14847 if (sizeNibbles === 7) { 14848 s.isMetadata = 1; 14849 if (readFewBits(s, 1) !== 0) { 14850 return makeError(s, -6); 14851 } 14852 const sizeBytes = readFewBits(s, 2); 14853 if (sizeBytes === 0) { 14854 return 0; 14855 } 14856 for (let i = 0; i < sizeBytes; ++i) { 14857 if (s.bitOffset >= 16) { 14858 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 14859 s.bitOffset -= 16; 14860 } 14861 const bits = readFewBits(s, 8); 14862 if (bits === 0 && i + 1 === sizeBytes && sizeBytes > 1) { 14863 return makeError(s, -8); 14864 } 14865 s.metaBlockLength += bits << i * 8; 14866 } 14867 } else { 14868 for (let i = 0; i < sizeNibbles; ++i) { 14869 if (s.bitOffset >= 16) { 14870 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 14871 s.bitOffset -= 16; 14872 } 14873 const bits = readFewBits(s, 4); 14874 if (bits === 0 && i + 1 === sizeNibbles && sizeNibbles > 4) { 14875 return makeError(s, -8); 14876 } 14877 s.metaBlockLength += bits << i * 4; 14878 } 14879 } 14880 s.metaBlockLength++; 14881 if (s.inputEnd === 0) { 14882 s.isUncompressed = readFewBits(s, 1); 14883 } 14884 return 0; 14885 } 14886 function readSymbol(tableGroup, tableIdx, s) { 14887 let offset = tableGroup[tableIdx]; 14888 const v = s.accumulator32 >>> s.bitOffset; 14889 offset += v & 0xFF; 14890 const bits = tableGroup[offset] >> 16; 14891 const sym = tableGroup[offset] & 0xFFFF; 14892 if (bits <= 8) { 14893 s.bitOffset += bits; 14894 return sym; 14895 } 14896 offset += sym; 14897 const mask = (1 << bits) - 1; 14898 offset += (v & mask) >>> 8; 14899 s.bitOffset += (tableGroup[offset] >> 16) + 8; 14900 return tableGroup[offset] & 0xFFFF; 14901 } 14902 function readBlockLength(tableGroup, tableIdx, s) { 14903 if (s.bitOffset >= 16) { 14904 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 14905 s.bitOffset -= 16; 14906 } 14907 const code = readSymbol(tableGroup, tableIdx, s); 14908 const n = BLOCK_LENGTH_N_BITS[code]; 14909 if (s.bitOffset >= 16) { 14910 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 14911 s.bitOffset -= 16; 14912 } 14913 return BLOCK_LENGTH_OFFSET[code] + (n <= 16 ? readFewBits(s, n) : readManyBits(s, n)); 14914 } 14915 function moveToFront(v, index) { 14916 let i = index; 14917 const value = v[i]; 14918 while (i > 0) { 14919 v[i] = v[i - 1]; 14920 i--; 14921 } 14922 v[0] = value; 14923 } 14924 function inverseMoveToFrontTransform(v, vLen) { 14925 const mtf = new Int32Array(256); 14926 for (let i = 0; i < 256; ++i) { 14927 mtf[i] = i; 14928 } 14929 for (let i = 0; i < vLen; ++i) { 14930 const index = v[i] & 0xFF; 14931 v[i] = mtf[index]; 14932 if (index !== 0) { 14933 moveToFront(mtf, index); 14934 } 14935 } 14936 } 14937 function readHuffmanCodeLengths(codeLengthCodeLengths, numSymbols, codeLengths, s) { 14938 let symbol = 0; 14939 let prevCodeLen = 8; 14940 let repeat = 0; 14941 let repeatCodeLen = 0; 14942 let space = 32768; 14943 const table = new Int32Array(33); 14944 const tableIdx = table.length - 1; 14945 buildHuffmanTable(table, tableIdx, 5, codeLengthCodeLengths, 18); 14946 while (symbol < numSymbols && space > 0) { 14947 if (s.halfOffset > 2030) { 14948 const result = readMoreInput(s); 14949 if (result < 0) { 14950 return result; 14951 } 14952 } 14953 if (s.bitOffset >= 16) { 14954 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 14955 s.bitOffset -= 16; 14956 } 14957 const p = s.accumulator32 >>> s.bitOffset & 31; 14958 s.bitOffset += table[p] >> 16; 14959 const codeLen = table[p] & 0xFFFF; 14960 if (codeLen < 16) { 14961 repeat = 0; 14962 codeLengths[symbol++] = codeLen; 14963 if (codeLen !== 0) { 14964 prevCodeLen = codeLen; 14965 space -= 32768 >> codeLen; 14966 } 14967 } else { 14968 const extraBits = codeLen - 14; 14969 let newLen = 0; 14970 if (codeLen === 16) { 14971 newLen = prevCodeLen; 14972 } 14973 if (repeatCodeLen !== newLen) { 14974 repeat = 0; 14975 repeatCodeLen = newLen; 14976 } 14977 const oldRepeat = repeat; 14978 if (repeat > 0) { 14979 repeat -= 2; 14980 repeat = repeat << extraBits; 14981 } 14982 if (s.bitOffset >= 16) { 14983 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 14984 s.bitOffset -= 16; 14985 } 14986 repeat += readFewBits(s, extraBits) + 3; 14987 const repeatDelta = repeat - oldRepeat; 14988 if (symbol + repeatDelta > numSymbols) { 14989 return makeError(s, -2); 14990 } 14991 for (let i = 0; i < repeatDelta; ++i) { 14992 codeLengths[symbol++] = repeatCodeLen; 14993 } 14994 if (repeatCodeLen !== 0) { 14995 space -= repeatDelta << 15 - repeatCodeLen; 14996 } 14997 } 14998 } 14999 if (space !== 0) { 15000 return makeError(s, -18); 15001 } 15002 codeLengths.fill(0, symbol, numSymbols); 15003 return 0; 15004 } 15005 function checkDupes(s, symbols, length) { 15006 for (let i = 0; i < length - 1; ++i) { 15007 for (let j = i + 1; j < length; ++j) { 15008 if (symbols[i] === symbols[j]) { 15009 return makeError(s, -7); 15010 } 15011 } 15012 } 15013 return 0; 15014 } 15015 function readSimpleHuffmanCode(alphabetSizeMax, alphabetSizeLimit, tableGroup, tableIdx, s) { 15016 const codeLengths = new Int32Array(alphabetSizeLimit); 15017 const symbols = new Int32Array(4); 15018 const maxBits = 1 + log2floor(alphabetSizeMax - 1); 15019 const numSymbols = readFewBits(s, 2) + 1; 15020 for (let i = 0; i < numSymbols; ++i) { 15021 if (s.bitOffset >= 16) { 15022 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 15023 s.bitOffset -= 16; 15024 } 15025 const symbol = readFewBits(s, maxBits); 15026 if (symbol >= alphabetSizeLimit) { 15027 return makeError(s, -15); 15028 } 15029 symbols[i] = symbol; 15030 } 15031 const result = checkDupes(s, symbols, numSymbols); 15032 if (result < 0) { 15033 return result; 15034 } 15035 let histogramId = numSymbols; 15036 if (numSymbols === 4) { 15037 histogramId += readFewBits(s, 1); 15038 } 15039 switch (histogramId) { 15040 case 1: 15041 codeLengths[symbols[0]] = 1; 15042 break; 15043 case 2: 15044 codeLengths[symbols[0]] = 1; 15045 codeLengths[symbols[1]] = 1; 15046 break; 15047 case 3: 15048 codeLengths[symbols[0]] = 1; 15049 codeLengths[symbols[1]] = 2; 15050 codeLengths[symbols[2]] = 2; 15051 break; 15052 case 4: 15053 codeLengths[symbols[0]] = 2; 15054 codeLengths[symbols[1]] = 2; 15055 codeLengths[symbols[2]] = 2; 15056 codeLengths[symbols[3]] = 2; 15057 break; 15058 case 5: 15059 codeLengths[symbols[0]] = 1; 15060 codeLengths[symbols[1]] = 2; 15061 codeLengths[symbols[2]] = 3; 15062 codeLengths[symbols[3]] = 3; 15063 break; 15064 default: 15065 break; 15066 } 15067 return buildHuffmanTable(tableGroup, tableIdx, 8, codeLengths, alphabetSizeLimit); 15068 } 15069 function readComplexHuffmanCode(alphabetSizeLimit, skip, tableGroup, tableIdx, s) { 15070 const codeLengths = new Int32Array(alphabetSizeLimit); 15071 const codeLengthCodeLengths = new Int32Array(18); 15072 let space = 32; 15073 let numCodes = 0; 15074 for (let i = skip; i < 18; ++i) { 15075 const codeLenIdx = CODE_LENGTH_CODE_ORDER[i]; 15076 if (s.bitOffset >= 16) { 15077 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 15078 s.bitOffset -= 16; 15079 } 15080 const p = s.accumulator32 >>> s.bitOffset & 15; 15081 s.bitOffset += FIXED_TABLE[p] >> 16; 15082 const v = FIXED_TABLE[p] & 0xFFFF; 15083 codeLengthCodeLengths[codeLenIdx] = v; 15084 if (v !== 0) { 15085 space -= 32 >> v; 15086 numCodes++; 15087 if (space <= 0) { 15088 break; 15089 } 15090 } 15091 } 15092 if (space !== 0 && numCodes !== 1) { 15093 return makeError(s, -4); 15094 } 15095 const result = readHuffmanCodeLengths(codeLengthCodeLengths, alphabetSizeLimit, codeLengths, s); 15096 if (result < 0) { 15097 return result; 15098 } 15099 return buildHuffmanTable(tableGroup, tableIdx, 8, codeLengths, alphabetSizeLimit); 15100 } 15101 function readHuffmanCode(alphabetSizeMax, alphabetSizeLimit, tableGroup, tableIdx, s) { 15102 if (s.halfOffset > 2030) { 15103 const result = readMoreInput(s); 15104 if (result < 0) { 15105 return result; 15106 } 15107 } 15108 if (s.bitOffset >= 16) { 15109 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 15110 s.bitOffset -= 16; 15111 } 15112 const simpleCodeOrSkip = readFewBits(s, 2); 15113 if (simpleCodeOrSkip === 1) { 15114 return readSimpleHuffmanCode(alphabetSizeMax, alphabetSizeLimit, tableGroup, tableIdx, s); 15115 } 15116 return readComplexHuffmanCode(alphabetSizeLimit, simpleCodeOrSkip, tableGroup, tableIdx, s); 15117 } 15118 function decodeContextMap(contextMapSize, contextMap, s) { 15119 let result; 15120 if (s.halfOffset > 2030) { 15121 result = readMoreInput(s); 15122 if (result < 0) { 15123 return result; 15124 } 15125 } 15126 const numTrees = decodeVarLenUnsignedByte(s) + 1; 15127 if (numTrees === 1) { 15128 contextMap.fill(0, 0, contextMapSize); 15129 return numTrees; 15130 } 15131 if (s.bitOffset >= 16) { 15132 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 15133 s.bitOffset -= 16; 15134 } 15135 const useRleForZeros = readFewBits(s, 1); 15136 let maxRunLengthPrefix = 0; 15137 if (useRleForZeros !== 0) { 15138 maxRunLengthPrefix = readFewBits(s, 4) + 1; 15139 } 15140 const alphabetSize = numTrees + maxRunLengthPrefix; 15141 const tableSize = MAX_HUFFMAN_TABLE_SIZE[alphabetSize + 31 >> 5]; 15142 const table = new Int32Array(tableSize + 1); 15143 const tableIdx = table.length - 1; 15144 result = readHuffmanCode(alphabetSize, alphabetSize, table, tableIdx, s); 15145 if (result < 0) { 15146 return result; 15147 } 15148 let i = 0; 15149 while (i < contextMapSize) { 15150 if (s.halfOffset > 2030) { 15151 result = readMoreInput(s); 15152 if (result < 0) { 15153 return result; 15154 } 15155 } 15156 if (s.bitOffset >= 16) { 15157 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 15158 s.bitOffset -= 16; 15159 } 15160 const code = readSymbol(table, tableIdx, s); 15161 if (code === 0) { 15162 contextMap[i] = 0; 15163 i++; 15164 } else if (code <= maxRunLengthPrefix) { 15165 if (s.bitOffset >= 16) { 15166 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 15167 s.bitOffset -= 16; 15168 } 15169 let reps = (1 << code) + readFewBits(s, code); 15170 while (reps !== 0) { 15171 if (i >= contextMapSize) { 15172 return makeError(s, -3); 15173 } 15174 contextMap[i] = 0; 15175 i++; 15176 reps--; 15177 } 15178 } else { 15179 contextMap[i] = code - maxRunLengthPrefix; 15180 i++; 15181 } 15182 } 15183 if (s.bitOffset >= 16) { 15184 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 15185 s.bitOffset -= 16; 15186 } 15187 if (readFewBits(s, 1) === 1) { 15188 inverseMoveToFrontTransform(contextMap, contextMapSize); 15189 } 15190 return numTrees; 15191 } 15192 function decodeBlockTypeAndLength(s, treeType, numBlockTypes) { 15193 const ringBuffers = s.rings; 15194 const offset = 4 + treeType * 2; 15195 if (s.bitOffset >= 16) { 15196 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 15197 s.bitOffset -= 16; 15198 } 15199 let blockType = readSymbol(s.blockTrees, 2 * treeType, s); 15200 const result = readBlockLength(s.blockTrees, 2 * treeType + 1, s); 15201 if (blockType === 1) { 15202 blockType = ringBuffers[offset + 1] + 1; 15203 } else if (blockType === 0) { 15204 blockType = ringBuffers[offset]; 15205 } else { 15206 blockType -= 2; 15207 } 15208 if (blockType >= numBlockTypes) { 15209 blockType -= numBlockTypes; 15210 } 15211 ringBuffers[offset] = ringBuffers[offset + 1]; 15212 ringBuffers[offset + 1] = blockType; 15213 return result; 15214 } 15215 function decodeLiteralBlockSwitch(s) { 15216 s.literalBlockLength = decodeBlockTypeAndLength(s, 0, s.numLiteralBlockTypes); 15217 const literalBlockType = s.rings[5]; 15218 s.contextMapSlice = literalBlockType << 6; 15219 s.literalTreeIdx = s.contextMap[s.contextMapSlice] & 0xFF; 15220 const contextMode = s.contextModes[literalBlockType]; 15221 s.contextLookupOffset1 = contextMode << 9; 15222 s.contextLookupOffset2 = s.contextLookupOffset1 + 256; 15223 } 15224 function decodeCommandBlockSwitch(s) { 15225 s.commandBlockLength = decodeBlockTypeAndLength(s, 1, s.numCommandBlockTypes); 15226 s.commandTreeIdx = s.rings[7]; 15227 } 15228 function decodeDistanceBlockSwitch(s) { 15229 s.distanceBlockLength = decodeBlockTypeAndLength(s, 2, s.numDistanceBlockTypes); 15230 s.distContextMapSlice = s.rings[9] << 2; 15231 } 15232 function maybeReallocateRingBuffer(s) { 15233 let newSize = s.maxRingBufferSize; 15234 if (newSize > s.expectedTotalSize) { 15235 const minimalNewSize = s.expectedTotalSize; 15236 while (newSize >> 1 > minimalNewSize) { 15237 newSize = newSize >> 1; 15238 } 15239 if (s.inputEnd === 0 && newSize < 16384 && s.maxRingBufferSize >= 16384) { 15240 newSize = 16384; 15241 } 15242 } 15243 if (newSize <= s.ringBufferSize) { 15244 return; 15245 } 15246 const ringBufferSizeWithSlack = newSize + 37; 15247 const newBuffer = new Int8Array(ringBufferSizeWithSlack); 15248 const oldBuffer = s.ringBuffer; 15249 if (oldBuffer.length !== 0) { 15250 newBuffer.set(oldBuffer.subarray(0, s.ringBufferSize), 0); 15251 } 15252 s.ringBuffer = newBuffer; 15253 s.ringBufferSize = newSize; 15254 } 15255 function readNextMetablockHeader(s) { 15256 if (s.inputEnd !== 0) { 15257 s.nextRunningState = 10; 15258 s.runningState = 12; 15259 return 0; 15260 } 15261 s.literalTreeGroup = new Int32Array(0); 15262 s.commandTreeGroup = new Int32Array(0); 15263 s.distanceTreeGroup = new Int32Array(0); 15264 let result; 15265 if (s.halfOffset > 2030) { 15266 result = readMoreInput(s); 15267 if (result < 0) { 15268 return result; 15269 } 15270 } 15271 result = decodeMetaBlockLength(s); 15272 if (result < 0) { 15273 return result; 15274 } 15275 if (s.metaBlockLength === 0 && s.isMetadata === 0) { 15276 return 0; 15277 } 15278 if (s.isUncompressed !== 0 || s.isMetadata !== 0) { 15279 result = jumpToByteBoundary(s); 15280 if (result < 0) { 15281 return result; 15282 } 15283 if (s.isMetadata === 0) { 15284 s.runningState = 6; 15285 } else { 15286 s.runningState = 5; 15287 } 15288 } else { 15289 s.runningState = 3; 15290 } 15291 if (s.isMetadata !== 0) { 15292 return 0; 15293 } 15294 s.expectedTotalSize += s.metaBlockLength; 15295 if (s.expectedTotalSize > 1 << 30) { 15296 s.expectedTotalSize = 1 << 30; 15297 } 15298 if (s.ringBufferSize < s.maxRingBufferSize) { 15299 maybeReallocateRingBuffer(s); 15300 } 15301 return 0; 15302 } 15303 function readMetablockPartition(s, treeType, numBlockTypes) { 15304 let offset = s.blockTrees[2 * treeType]; 15305 if (numBlockTypes <= 1) { 15306 s.blockTrees[2 * treeType + 1] = offset; 15307 s.blockTrees[2 * treeType + 2] = offset; 15308 return 1 << 28; 15309 } 15310 const blockTypeAlphabetSize = numBlockTypes + 2; 15311 let result = readHuffmanCode(blockTypeAlphabetSize, blockTypeAlphabetSize, s.blockTrees, 2 * treeType, s); 15312 if (result < 0) { 15313 return result; 15314 } 15315 offset += result; 15316 s.blockTrees[2 * treeType + 1] = offset; 15317 const blockLengthAlphabetSize = 26; 15318 result = readHuffmanCode(blockLengthAlphabetSize, blockLengthAlphabetSize, s.blockTrees, 2 * treeType + 1, s); 15319 if (result < 0) { 15320 return result; 15321 } 15322 offset += result; 15323 s.blockTrees[2 * treeType + 2] = offset; 15324 return readBlockLength(s.blockTrees, 2 * treeType + 1, s); 15325 } 15326 function calculateDistanceLut(s, alphabetSizeLimit) { 15327 const distExtraBits = s.distExtraBits; 15328 const distOffset = s.distOffset; 15329 const npostfix = s.distancePostfixBits; 15330 const ndirect = s.numDirectDistanceCodes; 15331 const postfix = 1 << npostfix; 15332 let bits = 1; 15333 let half = 0; 15334 let i = 16; 15335 for (let j = 0; j < ndirect; ++j) { 15336 distExtraBits[i] = 0; 15337 distOffset[i] = j + 1; 15338 ++i; 15339 } 15340 while (i < alphabetSizeLimit) { 15341 const base = ndirect + ((2 + half << bits) - 4 << npostfix) + 1; 15342 for (let j = 0; j < postfix; ++j) { 15343 distExtraBits[i] = bits; 15344 distOffset[i] = base + j; 15345 ++i; 15346 } 15347 bits = bits + half; 15348 half = half ^ 1; 15349 } 15350 } 15351 function readMetablockHuffmanCodesAndContextMaps(s) { 15352 s.numLiteralBlockTypes = decodeVarLenUnsignedByte(s) + 1; 15353 let result = readMetablockPartition(s, 0, s.numLiteralBlockTypes); 15354 if (result < 0) { 15355 return result; 15356 } 15357 s.literalBlockLength = result; 15358 s.numCommandBlockTypes = decodeVarLenUnsignedByte(s) + 1; 15359 result = readMetablockPartition(s, 1, s.numCommandBlockTypes); 15360 if (result < 0) { 15361 return result; 15362 } 15363 s.commandBlockLength = result; 15364 s.numDistanceBlockTypes = decodeVarLenUnsignedByte(s) + 1; 15365 result = readMetablockPartition(s, 2, s.numDistanceBlockTypes); 15366 if (result < 0) { 15367 return result; 15368 } 15369 s.distanceBlockLength = result; 15370 if (s.halfOffset > 2030) { 15371 result = readMoreInput(s); 15372 if (result < 0) { 15373 return result; 15374 } 15375 } 15376 if (s.bitOffset >= 16) { 15377 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 15378 s.bitOffset -= 16; 15379 } 15380 s.distancePostfixBits = readFewBits(s, 2); 15381 s.numDirectDistanceCodes = readFewBits(s, 4) << s.distancePostfixBits; 15382 s.contextModes = new Int8Array(s.numLiteralBlockTypes); 15383 let i = 0; 15384 while (i < s.numLiteralBlockTypes) { 15385 const limit = Math.min(i + 96, s.numLiteralBlockTypes); 15386 while (i < limit) { 15387 if (s.bitOffset >= 16) { 15388 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 15389 s.bitOffset -= 16; 15390 } 15391 s.contextModes[i] = readFewBits(s, 2); 15392 i++; 15393 } 15394 if (s.halfOffset > 2030) { 15395 result = readMoreInput(s); 15396 if (result < 0) { 15397 return result; 15398 } 15399 } 15400 } 15401 const contextMapLength = s.numLiteralBlockTypes << 6; 15402 s.contextMap = new Int8Array(contextMapLength); 15403 result = decodeContextMap(contextMapLength, s.contextMap, s); 15404 if (result < 0) { 15405 return result; 15406 } 15407 const numLiteralTrees = result; 15408 s.trivialLiteralContext = 1; 15409 for (let j = 0; j < contextMapLength; ++j) { 15410 if (s.contextMap[j] !== j >> 6) { 15411 s.trivialLiteralContext = 0; 15412 break; 15413 } 15414 } 15415 s.distContextMap = new Int8Array(s.numDistanceBlockTypes << 2); 15416 result = decodeContextMap(s.numDistanceBlockTypes << 2, s.distContextMap, s); 15417 if (result < 0) { 15418 return result; 15419 } 15420 const numDistTrees = result; 15421 s.literalTreeGroup = new Int32Array(huffmanTreeGroupAllocSize(256, numLiteralTrees)); 15422 result = decodeHuffmanTreeGroup(256, 256, numLiteralTrees, s, s.literalTreeGroup); 15423 if (result < 0) { 15424 return result; 15425 } 15426 s.commandTreeGroup = new Int32Array(huffmanTreeGroupAllocSize(704, s.numCommandBlockTypes)); 15427 result = decodeHuffmanTreeGroup(704, 704, s.numCommandBlockTypes, s, s.commandTreeGroup); 15428 if (result < 0) { 15429 return result; 15430 } 15431 let distanceAlphabetSizeMax = calculateDistanceAlphabetSize(s.distancePostfixBits, s.numDirectDistanceCodes, 24); 15432 let distanceAlphabetSizeLimit = distanceAlphabetSizeMax; 15433 if (s.isLargeWindow === 1) { 15434 distanceAlphabetSizeMax = calculateDistanceAlphabetSize(s.distancePostfixBits, s.numDirectDistanceCodes, 62); 15435 result = calculateDistanceAlphabetLimit(s, 0x7FFFFFFC, s.distancePostfixBits, s.numDirectDistanceCodes); 15436 if (result < 0) { 15437 return result; 15438 } 15439 distanceAlphabetSizeLimit = result; 15440 } 15441 s.distanceTreeGroup = new Int32Array(huffmanTreeGroupAllocSize(distanceAlphabetSizeLimit, numDistTrees)); 15442 result = decodeHuffmanTreeGroup(distanceAlphabetSizeMax, distanceAlphabetSizeLimit, numDistTrees, s, s.distanceTreeGroup); 15443 if (result < 0) { 15444 return result; 15445 } 15446 calculateDistanceLut(s, distanceAlphabetSizeLimit); 15447 s.contextMapSlice = 0; 15448 s.distContextMapSlice = 0; 15449 s.contextLookupOffset1 = s.contextModes[0] * 512; 15450 s.contextLookupOffset2 = s.contextLookupOffset1 + 256; 15451 s.literalTreeIdx = 0; 15452 s.commandTreeIdx = 0; 15453 s.rings[4] = 1; 15454 s.rings[5] = 0; 15455 s.rings[6] = 1; 15456 s.rings[7] = 0; 15457 s.rings[8] = 1; 15458 s.rings[9] = 0; 15459 return 0; 15460 } 15461 function copyUncompressedData(s) { 15462 const ringBuffer = s.ringBuffer; 15463 let result; 15464 if (s.metaBlockLength <= 0) { 15465 result = reload(s); 15466 if (result < 0) { 15467 return result; 15468 } 15469 s.runningState = 2; 15470 return 0; 15471 } 15472 const chunkLength = Math.min(s.ringBufferSize - s.pos, s.metaBlockLength); 15473 result = copyRawBytes(s, ringBuffer, s.pos, chunkLength); 15474 if (result < 0) { 15475 return result; 15476 } 15477 s.metaBlockLength -= chunkLength; 15478 s.pos += chunkLength; 15479 if (s.pos === s.ringBufferSize) { 15480 s.nextRunningState = 6; 15481 s.runningState = 12; 15482 return 0; 15483 } 15484 result = reload(s); 15485 if (result < 0) { 15486 return result; 15487 } 15488 s.runningState = 2; 15489 return 0; 15490 } 15491 function writeRingBuffer(s) { 15492 const toWrite = Math.min(s.outputLength - s.outputUsed, s.ringBufferBytesReady - s.ringBufferBytesWritten); 15493 if (toWrite !== 0) { 15494 s.output.set(s.ringBuffer.subarray(s.ringBufferBytesWritten, s.ringBufferBytesWritten + toWrite), s.outputOffset + s.outputUsed); 15495 s.outputUsed += toWrite; 15496 s.ringBufferBytesWritten += toWrite; 15497 } 15498 if (s.outputUsed < s.outputLength) { 15499 return 0; 15500 } 15501 return 2; 15502 } 15503 function huffmanTreeGroupAllocSize(alphabetSizeLimit, n) { 15504 const maxTableSize = MAX_HUFFMAN_TABLE_SIZE[alphabetSizeLimit + 31 >> 5]; 15505 return n + n * maxTableSize; 15506 } 15507 function decodeHuffmanTreeGroup(alphabetSizeMax, alphabetSizeLimit, n, s, group) { 15508 let next = n; 15509 for (let i = 0; i < n; ++i) { 15510 group[i] = next; 15511 const result = readHuffmanCode(alphabetSizeMax, alphabetSizeLimit, group, i, s); 15512 if (result < 0) { 15513 return result; 15514 } 15515 next += result; 15516 } 15517 return 0; 15518 } 15519 function calculateFence(s) { 15520 let result = s.ringBufferSize; 15521 if (s.isEager !== 0) { 15522 result = Math.min(result, s.ringBufferBytesWritten + s.outputLength - s.outputUsed); 15523 } 15524 return result; 15525 } 15526 function doUseDictionary(s, fence) { 15527 if (s.distance > 0x7FFFFFFC) { 15528 return makeError(s, -9); 15529 } 15530 const address = s.distance - s.maxDistance - 1 - s.cdTotalSize; 15531 if (address < 0) { 15532 const result = initializeCompoundDictionaryCopy(s, -address - 1, s.copyLength); 15533 if (result < 0) { 15534 return result; 15535 } 15536 s.runningState = 14; 15537 } else { 15538 const dictionaryData = data; 15539 const wordLength = s.copyLength; 15540 if (wordLength > 31) { 15541 return makeError(s, -9); 15542 } 15543 const shift = sizeBits[wordLength]; 15544 if (shift === 0) { 15545 return makeError(s, -9); 15546 } 15547 let offset = offsets[wordLength]; 15548 const mask = (1 << shift) - 1; 15549 const wordIdx = address & mask; 15550 const transformIdx = address >> shift; 15551 offset += wordIdx * wordLength; 15552 const transforms = RFC_TRANSFORMS; 15553 if (transformIdx >= transforms.numTransforms) { 15554 return makeError(s, -9); 15555 } 15556 const len = transformDictionaryWord(s.ringBuffer, s.pos, dictionaryData, offset, wordLength, transforms, transformIdx); 15557 s.pos += len; 15558 s.metaBlockLength -= len; 15559 if (s.pos >= fence) { 15560 s.nextRunningState = 4; 15561 s.runningState = 12; 15562 return 0; 15563 } 15564 s.runningState = 4; 15565 } 15566 return 0; 15567 } 15568 function initializeCompoundDictionary(s) { 15569 s.cdBlockMap = new Int8Array(256); 15570 let blockBits = 8; 15571 while (s.cdTotalSize - 1 >> blockBits !== 0) { 15572 blockBits++; 15573 } 15574 blockBits -= 8; 15575 s.cdBlockBits = blockBits; 15576 let cursor = 0; 15577 let index = 0; 15578 while (cursor < s.cdTotalSize) { 15579 while (s.cdChunkOffsets[index + 1] < cursor) { 15580 index++; 15581 } 15582 s.cdBlockMap[cursor >> blockBits] = index; 15583 cursor += 1 << blockBits; 15584 } 15585 } 15586 function initializeCompoundDictionaryCopy(s, address, length) { 15587 if (s.cdBlockBits === -1) { 15588 initializeCompoundDictionary(s); 15589 } 15590 let index = s.cdBlockMap[address >> s.cdBlockBits]; 15591 while (address >= s.cdChunkOffsets[index + 1]) { 15592 index++; 15593 } 15594 if (s.cdTotalSize > address + length) { 15595 return makeError(s, -9); 15596 } 15597 s.distRbIdx = s.distRbIdx + 1 & 0x3; 15598 s.rings[s.distRbIdx] = s.distance; 15599 s.metaBlockLength -= length; 15600 s.cdBrIndex = index; 15601 s.cdBrOffset = address - s.cdChunkOffsets[index]; 15602 s.cdBrLength = length; 15603 s.cdBrCopied = 0; 15604 return 0; 15605 } 15606 function copyFromCompoundDictionary(s, fence) { 15607 let pos = s.pos; 15608 const origPos = pos; 15609 while (s.cdBrLength !== s.cdBrCopied) { 15610 const space = fence - pos; 15611 const chunkLength = s.cdChunkOffsets[s.cdBrIndex + 1] - s.cdChunkOffsets[s.cdBrIndex]; 15612 const remChunkLength = chunkLength - s.cdBrOffset; 15613 let length = s.cdBrLength - s.cdBrCopied; 15614 if (length > remChunkLength) { 15615 length = remChunkLength; 15616 } 15617 if (length > space) { 15618 length = space; 15619 } 15620 s.ringBuffer.set(s.cdChunks[s.cdBrIndex].subarray(s.cdBrOffset, s.cdBrOffset + length), pos); 15621 pos += length; 15622 s.cdBrOffset += length; 15623 s.cdBrCopied += length; 15624 if (length === remChunkLength) { 15625 s.cdBrIndex++; 15626 s.cdBrOffset = 0; 15627 } 15628 if (pos >= fence) { 15629 break; 15630 } 15631 } 15632 return pos - origPos; 15633 } 15634 function decompress(s) { 15635 let result; 15636 if (s.runningState === 0) { 15637 return makeError(s, -25); 15638 } 15639 if (s.runningState < 0) { 15640 return makeError(s, -28); 15641 } 15642 if (s.runningState === 11) { 15643 return makeError(s, -22); 15644 } 15645 if (s.runningState === 1) { 15646 const windowBits = decodeWindowBits(s); 15647 if (windowBits === -1) { 15648 return makeError(s, -11); 15649 } 15650 s.maxRingBufferSize = 1 << windowBits; 15651 s.maxBackwardDistance = s.maxRingBufferSize - 16; 15652 s.runningState = 2; 15653 } 15654 let fence = calculateFence(s); 15655 let ringBufferMask = s.ringBufferSize - 1; 15656 let ringBuffer = s.ringBuffer; 15657 while (s.runningState !== 10) { 15658 switch (s.runningState) { 15659 case 2: 15660 if (s.metaBlockLength < 0) { 15661 return makeError(s, -10); 15662 } 15663 result = readNextMetablockHeader(s); 15664 if (result < 0) { 15665 return result; 15666 } 15667 fence = calculateFence(s); 15668 ringBufferMask = s.ringBufferSize - 1; 15669 ringBuffer = s.ringBuffer; 15670 continue; 15671 case 3: 15672 result = readMetablockHuffmanCodesAndContextMaps(s); 15673 if (result < 0) { 15674 return result; 15675 } 15676 s.runningState = 4; 15677 continue; 15678 case 4: 15679 if (s.metaBlockLength <= 0) { 15680 s.runningState = 2; 15681 continue; 15682 } 15683 if (s.halfOffset > 2030) { 15684 result = readMoreInput(s); 15685 if (result < 0) { 15686 return result; 15687 } 15688 } 15689 if (s.commandBlockLength === 0) { 15690 decodeCommandBlockSwitch(s); 15691 } 15692 s.commandBlockLength--; 15693 if (s.bitOffset >= 16) { 15694 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 15695 s.bitOffset -= 16; 15696 } 15697 const cmdCode = readSymbol(s.commandTreeGroup, s.commandTreeIdx, s) << 2; 15698 const insertAndCopyExtraBits = CMD_LOOKUP[cmdCode]; 15699 const insertLengthOffset = CMD_LOOKUP[cmdCode + 1]; 15700 const copyLengthOffset = CMD_LOOKUP[cmdCode + 2]; 15701 s.distanceCode = CMD_LOOKUP[cmdCode + 3]; 15702 if (s.bitOffset >= 16) { 15703 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 15704 s.bitOffset -= 16; 15705 } 15706 const insertLengthExtraBits = insertAndCopyExtraBits & 0xFF; 15707 s.insertLength = insertLengthOffset + (insertLengthExtraBits <= 16 ? readFewBits(s, insertLengthExtraBits) : readManyBits(s, insertLengthExtraBits)); 15708 if (s.bitOffset >= 16) { 15709 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 15710 s.bitOffset -= 16; 15711 } 15712 const copyLengthExtraBits = insertAndCopyExtraBits >> 8; 15713 s.copyLength = copyLengthOffset + (copyLengthExtraBits <= 16 ? readFewBits(s, copyLengthExtraBits) : readManyBits(s, copyLengthExtraBits)); 15714 s.j = 0; 15715 s.runningState = 7; 15716 continue; 15717 case 7: 15718 if (s.trivialLiteralContext !== 0) { 15719 while (s.j < s.insertLength) { 15720 if (s.halfOffset > 2030) { 15721 result = readMoreInput(s); 15722 if (result < 0) { 15723 return result; 15724 } 15725 } 15726 if (s.literalBlockLength === 0) { 15727 decodeLiteralBlockSwitch(s); 15728 } 15729 s.literalBlockLength--; 15730 if (s.bitOffset >= 16) { 15731 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 15732 s.bitOffset -= 16; 15733 } 15734 ringBuffer[s.pos] = readSymbol(s.literalTreeGroup, s.literalTreeIdx, s); 15735 s.pos++; 15736 s.j++; 15737 if (s.pos >= fence) { 15738 s.nextRunningState = 7; 15739 s.runningState = 12; 15740 break; 15741 } 15742 } 15743 } else { 15744 let prevByte1 = ringBuffer[s.pos - 1 & ringBufferMask] & 0xFF; 15745 let prevByte2 = ringBuffer[s.pos - 2 & ringBufferMask] & 0xFF; 15746 while (s.j < s.insertLength) { 15747 if (s.halfOffset > 2030) { 15748 result = readMoreInput(s); 15749 if (result < 0) { 15750 return result; 15751 } 15752 } 15753 if (s.literalBlockLength === 0) { 15754 decodeLiteralBlockSwitch(s); 15755 } 15756 const literalContext = LOOKUP[s.contextLookupOffset1 + prevByte1] | LOOKUP[s.contextLookupOffset2 + prevByte2]; 15757 const literalTreeIdx = s.contextMap[s.contextMapSlice + literalContext] & 0xFF; 15758 s.literalBlockLength--; 15759 prevByte2 = prevByte1; 15760 if (s.bitOffset >= 16) { 15761 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 15762 s.bitOffset -= 16; 15763 } 15764 prevByte1 = readSymbol(s.literalTreeGroup, literalTreeIdx, s); 15765 ringBuffer[s.pos] = prevByte1; 15766 s.pos++; 15767 s.j++; 15768 if (s.pos >= fence) { 15769 s.nextRunningState = 7; 15770 s.runningState = 12; 15771 break; 15772 } 15773 } 15774 } 15775 if (s.runningState !== 7) { 15776 continue; 15777 } 15778 s.metaBlockLength -= s.insertLength; 15779 if (s.metaBlockLength <= 0) { 15780 s.runningState = 4; 15781 continue; 15782 } 15783 let distanceCode = s.distanceCode; 15784 if (distanceCode < 0) { 15785 s.distance = s.rings[s.distRbIdx]; 15786 } else { 15787 if (s.halfOffset > 2030) { 15788 result = readMoreInput(s); 15789 if (result < 0) { 15790 return result; 15791 } 15792 } 15793 if (s.distanceBlockLength === 0) { 15794 decodeDistanceBlockSwitch(s); 15795 } 15796 s.distanceBlockLength--; 15797 if (s.bitOffset >= 16) { 15798 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 15799 s.bitOffset -= 16; 15800 } 15801 const distTreeIdx = s.distContextMap[s.distContextMapSlice + distanceCode] & 0xFF; 15802 distanceCode = readSymbol(s.distanceTreeGroup, distTreeIdx, s); 15803 if (distanceCode < 16) { 15804 const index = s.distRbIdx + DISTANCE_SHORT_CODE_INDEX_OFFSET[distanceCode] & 0x3; 15805 s.distance = s.rings[index] + DISTANCE_SHORT_CODE_VALUE_OFFSET[distanceCode]; 15806 if (s.distance < 0) { 15807 return makeError(s, -12); 15808 } 15809 } else { 15810 const extraBits = s.distExtraBits[distanceCode]; 15811 let bits; 15812 if (s.bitOffset + extraBits <= 32) { 15813 bits = readFewBits(s, extraBits); 15814 } else { 15815 if (s.bitOffset >= 16) { 15816 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 15817 s.bitOffset -= 16; 15818 } 15819 bits = extraBits <= 16 ? readFewBits(s, extraBits) : readManyBits(s, extraBits); 15820 } 15821 s.distance = s.distOffset[distanceCode] + (bits << s.distancePostfixBits); 15822 } 15823 } 15824 if (s.maxDistance !== s.maxBackwardDistance && s.pos < s.maxBackwardDistance) { 15825 s.maxDistance = s.pos; 15826 } else { 15827 s.maxDistance = s.maxBackwardDistance; 15828 } 15829 if (s.distance > s.maxDistance) { 15830 s.runningState = 9; 15831 continue; 15832 } 15833 if (distanceCode > 0) { 15834 s.distRbIdx = s.distRbIdx + 1 & 0x3; 15835 s.rings[s.distRbIdx] = s.distance; 15836 } 15837 if (s.copyLength > s.metaBlockLength) { 15838 return makeError(s, -9); 15839 } 15840 s.j = 0; 15841 s.runningState = 8; 15842 continue; 15843 case 8: 15844 let src = s.pos - s.distance & ringBufferMask; 15845 let dst = s.pos; 15846 const copyLength = s.copyLength - s.j; 15847 const srcEnd = src + copyLength; 15848 const dstEnd = dst + copyLength; 15849 if (srcEnd < ringBufferMask && dstEnd < ringBufferMask) { 15850 if (copyLength < 12 || srcEnd > dst && dstEnd > src) { 15851 const numQuads = copyLength + 3 >> 2; 15852 for (let k = 0; k < numQuads; ++k) { 15853 ringBuffer[dst++] = ringBuffer[src++]; 15854 ringBuffer[dst++] = ringBuffer[src++]; 15855 ringBuffer[dst++] = ringBuffer[src++]; 15856 ringBuffer[dst++] = ringBuffer[src++]; 15857 } 15858 } else { 15859 ringBuffer.copyWithin(dst, src, srcEnd); 15860 } 15861 s.j += copyLength; 15862 s.metaBlockLength -= copyLength; 15863 s.pos += copyLength; 15864 } else { 15865 while (s.j < s.copyLength) { 15866 ringBuffer[s.pos] = ringBuffer[s.pos - s.distance & ringBufferMask]; 15867 s.metaBlockLength--; 15868 s.pos++; 15869 s.j++; 15870 if (s.pos >= fence) { 15871 s.nextRunningState = 8; 15872 s.runningState = 12; 15873 break; 15874 } 15875 } 15876 } 15877 if (s.runningState === 8) { 15878 s.runningState = 4; 15879 } 15880 continue; 15881 case 9: 15882 result = doUseDictionary(s, fence); 15883 if (result < 0) { 15884 return result; 15885 } 15886 continue; 15887 case 14: 15888 s.pos += copyFromCompoundDictionary(s, fence); 15889 if (s.pos >= fence) { 15890 s.nextRunningState = 14; 15891 s.runningState = 12; 15892 return 2; 15893 } 15894 s.runningState = 4; 15895 continue; 15896 case 5: 15897 while (s.metaBlockLength > 0) { 15898 if (s.halfOffset > 2030) { 15899 result = readMoreInput(s); 15900 if (result < 0) { 15901 return result; 15902 } 15903 } 15904 if (s.bitOffset >= 16) { 15905 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 15906 s.bitOffset -= 16; 15907 } 15908 readFewBits(s, 8); 15909 s.metaBlockLength--; 15910 } 15911 s.runningState = 2; 15912 continue; 15913 case 6: 15914 result = copyUncompressedData(s); 15915 if (result < 0) { 15916 return result; 15917 } 15918 continue; 15919 case 12: 15920 s.ringBufferBytesReady = Math.min(s.pos, s.ringBufferSize); 15921 s.runningState = 13; 15922 continue; 15923 case 13: 15924 result = writeRingBuffer(s); 15925 if (result !== 0) { 15926 return result; 15927 } 15928 if (s.pos >= s.maxBackwardDistance) { 15929 s.maxDistance = s.maxBackwardDistance; 15930 } 15931 if (s.pos >= s.ringBufferSize) { 15932 if (s.pos > s.ringBufferSize) { 15933 ringBuffer.copyWithin(0, s.ringBufferSize, s.pos); 15934 } 15935 s.pos = s.pos & ringBufferMask; 15936 s.ringBufferBytesWritten = 0; 15937 } 15938 s.runningState = s.nextRunningState; 15939 continue; 15940 default: 15941 return makeError(s, -28); 15942 } 15943 } 15944 if (s.runningState !== 10) { 15945 return makeError(s, -29); 15946 } 15947 if (s.metaBlockLength < 0) { 15948 return makeError(s, -10); 15949 } 15950 result = jumpToByteBoundary(s); 15951 if (result !== 0) { 15952 return result; 15953 } 15954 result = checkHealth(s, 1); 15955 if (result !== 0) { 15956 return result; 15957 } 15958 return 1; 15959 } 15960 function Transforms(numTransforms, prefixSuffixLen, prefixSuffixCount) { 15961 this.numTransforms = 0; 15962 this.triplets = new Int32Array(0); 15963 this.prefixSuffixStorage = new Int8Array(0); 15964 this.prefixSuffixHeads = new Int32Array(0); 15965 this.params = new Int16Array(0); 15966 this.numTransforms = numTransforms; 15967 this.triplets = new Int32Array(numTransforms * 3); 15968 this.params = new Int16Array(numTransforms); 15969 this.prefixSuffixStorage = new Int8Array(prefixSuffixLen); 15970 this.prefixSuffixHeads = new Int32Array(prefixSuffixCount + 1); 15971 } 15972 const RFC_TRANSFORMS = new Transforms(121, 167, 50); 15973 function unpackTransforms(prefixSuffix, prefixSuffixHeads, transforms, prefixSuffixSrc, transformsSrc) { 15974 const prefixSuffixBytes = toUtf8Runes(prefixSuffixSrc); 15975 const n = prefixSuffixBytes.length; 15976 let index = 1; 15977 let j = 0; 15978 for (let i = 0; i < n; ++i) { 15979 const c = prefixSuffixBytes[i]; 15980 if (c === 35) { 15981 prefixSuffixHeads[index++] = j; 15982 } else { 15983 prefixSuffix[j++] = c; 15984 } 15985 } 15986 for (let i = 0; i < 363; ++i) { 15987 transforms[i] = transformsSrc.charCodeAt(i) - 32; 15988 } 15989 } 15990 unpackTransforms(RFC_TRANSFORMS.prefixSuffixStorage, RFC_TRANSFORMS.prefixSuffixHeads, RFC_TRANSFORMS.triplets, "# #s #, #e #.# the #.com/#\xC2\xA0# of # and # in # to #\"#\">#\n#]# for # a # that #. # with #'# from # by #. The # on # as # is #ing #\n\t#:#ed #(# at #ly #=\"# of the #. This #,# not #er #al #='#ful #ive #less #est #ize #ous #", " !! ! , *! &! \" ! ) * * - ! # ! #!*! + ,$ ! - % . / # 0 1 . \" 2 3!* 4% ! # / 5 6 7 8 0 1 & $ 9 + : ; < ' != > ?! 4 @ 4 2 & A *# ( B C& ) % ) !*# *-% A +! *. D! %' & E *6 F G% ! *A *% H! D I!+! J!+ K +- *4! A L!*4 M N +6 O!*% +.! K *G P +%( ! G *D +D Q +# *K!*G!+D!+# +G +A +4!+% +K!+4!*D!+K!*K"); 15991 function transformDictionaryWord(dst, dstOffset, src, srcOffset, wordLen, transforms, transformIndex) { 15992 let offset = dstOffset; 15993 const triplets = transforms.triplets; 15994 const prefixSuffixStorage = transforms.prefixSuffixStorage; 15995 const prefixSuffixHeads = transforms.prefixSuffixHeads; 15996 const transformOffset = 3 * transformIndex; 15997 const prefixIdx = triplets[transformOffset]; 15998 const transformType = triplets[transformOffset + 1]; 15999 const suffixIdx = triplets[transformOffset + 2]; 16000 let prefix = prefixSuffixHeads[prefixIdx]; 16001 const prefixEnd = prefixSuffixHeads[prefixIdx + 1]; 16002 let suffix = prefixSuffixHeads[suffixIdx]; 16003 const suffixEnd = prefixSuffixHeads[suffixIdx + 1]; 16004 let omitFirst = transformType - 11; 16005 let omitLast = transformType; 16006 if (omitFirst < 1 || omitFirst > 9) { 16007 omitFirst = 0; 16008 } 16009 if (omitLast < 1 || omitLast > 9) { 16010 omitLast = 0; 16011 } 16012 while (prefix !== prefixEnd) { 16013 dst[offset++] = prefixSuffixStorage[prefix++]; 16014 } 16015 let len = wordLen; 16016 if (omitFirst > len) { 16017 omitFirst = len; 16018 } 16019 let dictOffset = srcOffset + omitFirst; 16020 len -= omitFirst; 16021 len -= omitLast; 16022 let i = len; 16023 while (i > 0) { 16024 dst[offset++] = src[dictOffset++]; 16025 i--; 16026 } 16027 if (transformType === 10 || transformType === 11) { 16028 let uppercaseOffset = offset - len; 16029 if (transformType === 10) { 16030 len = 1; 16031 } 16032 while (len > 0) { 16033 const c0 = dst[uppercaseOffset] & 0xFF; 16034 if (c0 < 0xC0) { 16035 if (c0 >= 97 && c0 <= 122) { 16036 dst[uppercaseOffset] = dst[uppercaseOffset] ^ 32; 16037 } 16038 uppercaseOffset += 1; 16039 len -= 1; 16040 } else if (c0 < 0xE0) { 16041 dst[uppercaseOffset + 1] = dst[uppercaseOffset + 1] ^ 32; 16042 uppercaseOffset += 2; 16043 len -= 2; 16044 } else { 16045 dst[uppercaseOffset + 2] = dst[uppercaseOffset + 2] ^ 5; 16046 uppercaseOffset += 3; 16047 len -= 3; 16048 } 16049 } 16050 } else if (transformType === 21 || transformType === 22) { 16051 let shiftOffset = offset - len; 16052 const param = transforms.params[transformIndex]; 16053 let scalar = (param & 0x7FFF) + (0x1000000 - (param & 0x8000)); 16054 while (len > 0) { 16055 let step = 1; 16056 const c0 = dst[shiftOffset] & 0xFF; 16057 if (c0 < 0x80) { 16058 scalar += c0; 16059 dst[shiftOffset] = scalar & 0x7F; 16060 } else if (c0 < 0xC0) {} else if (c0 < 0xE0) { 16061 if (len >= 2) { 16062 const c1 = dst[shiftOffset + 1]; 16063 scalar += c1 & 0x3F | (c0 & 0x1F) << 6; 16064 dst[shiftOffset] = 0xC0 | scalar >> 6 & 0x1F; 16065 dst[shiftOffset + 1] = c1 & 0xC0 | scalar & 0x3F; 16066 step = 2; 16067 } else { 16068 step = len; 16069 } 16070 } else if (c0 < 0xF0) { 16071 if (len >= 3) { 16072 const c1 = dst[shiftOffset + 1]; 16073 const c2 = dst[shiftOffset + 2]; 16074 scalar += c2 & 0x3F | (c1 & 0x3F) << 6 | (c0 & 0x0F) << 12; 16075 dst[shiftOffset] = 0xE0 | scalar >> 12 & 0x0F; 16076 dst[shiftOffset + 1] = c1 & 0xC0 | scalar >> 6 & 0x3F; 16077 dst[shiftOffset + 2] = c2 & 0xC0 | scalar & 0x3F; 16078 step = 3; 16079 } else { 16080 step = len; 16081 } 16082 } else if (c0 < 0xF8) { 16083 if (len >= 4) { 16084 const c1 = dst[shiftOffset + 1]; 16085 const c2 = dst[shiftOffset + 2]; 16086 const c3 = dst[shiftOffset + 3]; 16087 scalar += c3 & 0x3F | (c2 & 0x3F) << 6 | (c1 & 0x3F) << 12 | (c0 & 0x07) << 18; 16088 dst[shiftOffset] = 0xF0 | scalar >> 18 & 0x07; 16089 dst[shiftOffset + 1] = c1 & 0xC0 | scalar >> 12 & 0x3F; 16090 dst[shiftOffset + 2] = c2 & 0xC0 | scalar >> 6 & 0x3F; 16091 dst[shiftOffset + 3] = c3 & 0xC0 | scalar & 0x3F; 16092 step = 4; 16093 } else { 16094 step = len; 16095 } 16096 } 16097 shiftOffset += step; 16098 len -= step; 16099 if (transformType === 21) { 16100 len = 0; 16101 } 16102 } 16103 } 16104 while (suffix !== suffixEnd) { 16105 dst[offset++] = prefixSuffixStorage[suffix++]; 16106 } 16107 return offset - dstOffset; 16108 } 16109 function getNextKey(key, len) { 16110 let step = 1 << len - 1; 16111 while ((key & step) !== 0) { 16112 step = step >> 1; 16113 } 16114 return (key & step - 1) + step; 16115 } 16116 function replicateValue(table, offset, step, end, item) { 16117 let pos = end; 16118 while (pos > 0) { 16119 pos -= step; 16120 table[offset + pos] = item; 16121 } 16122 } 16123 function nextTableBitSize(count, len, rootBits) { 16124 let bits = len; 16125 let left = 1 << bits - rootBits; 16126 while (bits < 15) { 16127 left -= count[bits]; 16128 if (left <= 0) { 16129 break; 16130 } 16131 bits++; 16132 left = left << 1; 16133 } 16134 return bits - rootBits; 16135 } 16136 function buildHuffmanTable(tableGroup, tableIdx, rootBits, codeLengths, codeLengthsSize) { 16137 const tableOffset = tableGroup[tableIdx]; 16138 const sorted = new Int32Array(codeLengthsSize); 16139 const count = new Int32Array(16); 16140 const offset = new Int32Array(16); 16141 for (let sym = 0; sym < codeLengthsSize; ++sym) { 16142 count[codeLengths[sym]]++; 16143 } 16144 offset[1] = 0; 16145 for (let len = 1; len < 15; ++len) { 16146 offset[len + 1] = offset[len] + count[len]; 16147 } 16148 for (let sym = 0; sym < codeLengthsSize; ++sym) { 16149 if (codeLengths[sym] !== 0) { 16150 sorted[offset[codeLengths[sym]]++] = sym; 16151 } 16152 } 16153 let tableBits = rootBits; 16154 let tableSize = 1 << tableBits; 16155 let totalSize = tableSize; 16156 if (offset[15] === 1) { 16157 for (let k = 0; k < totalSize; ++k) { 16158 tableGroup[tableOffset + k] = sorted[0]; 16159 } 16160 return totalSize; 16161 } 16162 let key = 0; 16163 let symbol = 0; 16164 let step = 1; 16165 for (let len = 1; len <= rootBits; ++len) { 16166 step = step << 1; 16167 while (count[len] > 0) { 16168 replicateValue(tableGroup, tableOffset + key, step, tableSize, len << 16 | sorted[symbol++]); 16169 key = getNextKey(key, len); 16170 count[len]--; 16171 } 16172 } 16173 const mask = totalSize - 1; 16174 let low = -1; 16175 let currentOffset = tableOffset; 16176 step = 1; 16177 for (let len = rootBits + 1; len <= 15; ++len) { 16178 step = step << 1; 16179 while (count[len] > 0) { 16180 if ((key & mask) !== low) { 16181 currentOffset += tableSize; 16182 tableBits = nextTableBitSize(count, len, rootBits); 16183 tableSize = 1 << tableBits; 16184 totalSize += tableSize; 16185 low = key & mask; 16186 tableGroup[tableOffset + low] = tableBits + rootBits << 16 | currentOffset - tableOffset - low; 16187 } 16188 replicateValue(tableGroup, currentOffset + (key >> rootBits), step, tableSize, len - rootBits << 16 | sorted[symbol++]); 16189 key = getNextKey(key, len); 16190 count[len]--; 16191 } 16192 } 16193 return totalSize; 16194 } 16195 function readMoreInput(s) { 16196 if (s.endOfStreamReached !== 0) { 16197 if (halfAvailable(s) >= -2) { 16198 return 0; 16199 } 16200 return makeError(s, -16); 16201 } 16202 const readOffset = s.halfOffset << 1; 16203 let bytesInBuffer = 4096 - readOffset; 16204 s.byteBuffer.copyWithin(0, readOffset, 4096); 16205 s.halfOffset = 0; 16206 while (bytesInBuffer < 4096) { 16207 const spaceLeft = 4096 - bytesInBuffer; 16208 const len = readInput(s, s.byteBuffer, bytesInBuffer, spaceLeft); 16209 if (len < -1) { 16210 return len; 16211 } 16212 if (len <= 0) { 16213 s.endOfStreamReached = 1; 16214 s.tailBytes = bytesInBuffer; 16215 bytesInBuffer += 1; 16216 break; 16217 } 16218 bytesInBuffer += len; 16219 } 16220 bytesToNibbles(s, bytesInBuffer); 16221 return 0; 16222 } 16223 function checkHealth(s, endOfStream) { 16224 if (s.endOfStreamReached === 0) { 16225 return 0; 16226 } 16227 const byteOffset = (s.halfOffset << 1) + (s.bitOffset + 7 >> 3) - 4; 16228 if (byteOffset > s.tailBytes) { 16229 return makeError(s, -13); 16230 } 16231 if (endOfStream !== 0 && byteOffset !== s.tailBytes) { 16232 return makeError(s, -17); 16233 } 16234 return 0; 16235 } 16236 function readFewBits(s, n) { 16237 const v = s.accumulator32 >>> s.bitOffset & (1 << n) - 1; 16238 s.bitOffset += n; 16239 return v; 16240 } 16241 function readManyBits(s, n) { 16242 const low = readFewBits(s, 16); 16243 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 16244 s.bitOffset -= 16; 16245 return low | readFewBits(s, n - 16) << 16; 16246 } 16247 function initBitReader(s) { 16248 s.byteBuffer = new Int8Array(4160); 16249 s.accumulator32 = 0; 16250 s.shortBuffer = new Int16Array(2080); 16251 s.bitOffset = 32; 16252 s.halfOffset = 2048; 16253 s.endOfStreamReached = 0; 16254 return prepare(s); 16255 } 16256 function prepare(s) { 16257 if (s.halfOffset > 2030) { 16258 const result = readMoreInput(s); 16259 if (result !== 0) { 16260 return result; 16261 } 16262 } 16263 let health = checkHealth(s, 0); 16264 if (health !== 0) { 16265 return health; 16266 } 16267 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 16268 s.bitOffset -= 16; 16269 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 16270 s.bitOffset -= 16; 16271 return 0; 16272 } 16273 function reload(s) { 16274 if (s.bitOffset === 32) { 16275 return prepare(s); 16276 } 16277 return 0; 16278 } 16279 function jumpToByteBoundary(s) { 16280 const padding = 32 - s.bitOffset & 7; 16281 if (padding !== 0) { 16282 const paddingBits = readFewBits(s, padding); 16283 if (paddingBits !== 0) { 16284 return makeError(s, -5); 16285 } 16286 } 16287 return 0; 16288 } 16289 function halfAvailable(s) { 16290 let limit = 2048; 16291 if (s.endOfStreamReached !== 0) { 16292 limit = s.tailBytes + 1 >> 1; 16293 } 16294 return limit - s.halfOffset; 16295 } 16296 function copyRawBytes(s, data, offset, length) { 16297 let pos = offset; 16298 let len = length; 16299 if ((s.bitOffset & 7) !== 0) { 16300 return makeError(s, -30); 16301 } 16302 while (s.bitOffset !== 32 && len !== 0) { 16303 data[pos++] = s.accumulator32 >>> s.bitOffset; 16304 s.bitOffset += 8; 16305 len--; 16306 } 16307 if (len === 0) { 16308 return 0; 16309 } 16310 const copyNibbles = Math.min(halfAvailable(s), len >> 1); 16311 if (copyNibbles > 0) { 16312 const readOffset = s.halfOffset << 1; 16313 const delta = copyNibbles << 1; 16314 data.set(s.byteBuffer.subarray(readOffset, readOffset + delta), pos); 16315 pos += delta; 16316 len -= delta; 16317 s.halfOffset += copyNibbles; 16318 } 16319 if (len === 0) { 16320 return 0; 16321 } 16322 if (halfAvailable(s) > 0) { 16323 if (s.bitOffset >= 16) { 16324 s.accumulator32 = s.shortBuffer[s.halfOffset++] << 16 | s.accumulator32 >>> 16; 16325 s.bitOffset -= 16; 16326 } 16327 while (len !== 0) { 16328 data[pos++] = s.accumulator32 >>> s.bitOffset; 16329 s.bitOffset += 8; 16330 len--; 16331 } 16332 return checkHealth(s, 0); 16333 } 16334 while (len > 0) { 16335 const chunkLen = readInput(s, data, pos, len); 16336 if (chunkLen < -1) { 16337 return chunkLen; 16338 } 16339 if (chunkLen <= 0) { 16340 return makeError(s, -16); 16341 } 16342 pos += chunkLen; 16343 len -= chunkLen; 16344 } 16345 return 0; 16346 } 16347 function bytesToNibbles(s, byteLen) { 16348 const byteBuffer = s.byteBuffer; 16349 const halfLen = byteLen >> 1; 16350 const shortBuffer = s.shortBuffer; 16351 for (let i = 0; i < halfLen; ++i) { 16352 shortBuffer[i] = byteBuffer[i * 2] & 0xFF | (byteBuffer[i * 2 + 1] & 0xFF) << 8; 16353 } 16354 } 16355 const LOOKUP = new Int32Array(2048); 16356 function unpackLookupTable(lookup, utfMap, utfRle) { 16357 for (let i = 0; i < 256; ++i) { 16358 lookup[i] = i & 0x3F; 16359 lookup[512 + i] = i >> 2; 16360 lookup[1792 + i] = 2 + (i >> 6); 16361 } 16362 for (let i = 0; i < 128; ++i) { 16363 lookup[1024 + i] = 4 * (utfMap.charCodeAt(i) - 32); 16364 } 16365 for (let i = 0; i < 64; ++i) { 16366 lookup[1152 + i] = i & 1; 16367 lookup[1216 + i] = 2 + (i & 1); 16368 } 16369 let offset = 1280; 16370 for (let k = 0; k < 19; ++k) { 16371 const value = k & 3; 16372 const rep = utfRle.charCodeAt(k) - 32; 16373 for (let i = 0; i < rep; ++i) { 16374 lookup[offset++] = value; 16375 } 16376 } 16377 for (let i = 0; i < 16; ++i) { 16378 lookup[1792 + i] = 1; 16379 lookup[2032 + i] = 6; 16380 } 16381 lookup[1792] = 0; 16382 lookup[2047] = 7; 16383 for (let i = 0; i < 256; ++i) { 16384 lookup[1536 + i] = lookup[1792 + i] << 3; 16385 } 16386 } 16387 unpackLookupTable(LOOKUP, " !! ! \"#$##%#$&'##(#)#++++++++++((&*'##,---,---,-----,-----,-----&#'###.///.///./////./////./////&#'# ", "A/* ': & : $ \x81 @"); 16388 function State() { 16389 this.ringBuffer = new Int8Array(0); 16390 this.contextModes = new Int8Array(0); 16391 this.contextMap = new Int8Array(0); 16392 this.distContextMap = new Int8Array(0); 16393 this.distExtraBits = new Int8Array(0); 16394 this.output = new Int8Array(0); 16395 this.byteBuffer = new Int8Array(0); 16396 this.shortBuffer = new Int16Array(0); 16397 this.intBuffer = new Int32Array(0); 16398 this.rings = new Int32Array(0); 16399 this.blockTrees = new Int32Array(0); 16400 this.literalTreeGroup = new Int32Array(0); 16401 this.commandTreeGroup = new Int32Array(0); 16402 this.distanceTreeGroup = new Int32Array(0); 16403 this.distOffset = new Int32Array(0); 16404 this.accumulator64 = 0; 16405 this.runningState = 0; 16406 this.nextRunningState = 0; 16407 this.accumulator32 = 0; 16408 this.bitOffset = 0; 16409 this.halfOffset = 0; 16410 this.tailBytes = 0; 16411 this.endOfStreamReached = 0; 16412 this.metaBlockLength = 0; 16413 this.inputEnd = 0; 16414 this.isUncompressed = 0; 16415 this.isMetadata = 0; 16416 this.literalBlockLength = 0; 16417 this.numLiteralBlockTypes = 0; 16418 this.commandBlockLength = 0; 16419 this.numCommandBlockTypes = 0; 16420 this.distanceBlockLength = 0; 16421 this.numDistanceBlockTypes = 0; 16422 this.pos = 0; 16423 this.maxDistance = 0; 16424 this.distRbIdx = 0; 16425 this.trivialLiteralContext = 0; 16426 this.literalTreeIdx = 0; 16427 this.commandTreeIdx = 0; 16428 this.j = 0; 16429 this.insertLength = 0; 16430 this.contextMapSlice = 0; 16431 this.distContextMapSlice = 0; 16432 this.contextLookupOffset1 = 0; 16433 this.contextLookupOffset2 = 0; 16434 this.distanceCode = 0; 16435 this.numDirectDistanceCodes = 0; 16436 this.distancePostfixBits = 0; 16437 this.distance = 0; 16438 this.copyLength = 0; 16439 this.maxBackwardDistance = 0; 16440 this.maxRingBufferSize = 0; 16441 this.ringBufferSize = 0; 16442 this.expectedTotalSize = 0; 16443 this.outputOffset = 0; 16444 this.outputLength = 0; 16445 this.outputUsed = 0; 16446 this.ringBufferBytesWritten = 0; 16447 this.ringBufferBytesReady = 0; 16448 this.isEager = 0; 16449 this.isLargeWindow = 0; 16450 this.cdNumChunks = 0; 16451 this.cdTotalSize = 0; 16452 this.cdBrIndex = 0; 16453 this.cdBrOffset = 0; 16454 this.cdBrLength = 0; 16455 this.cdBrCopied = 0; 16456 this.cdChunks = new Array(0); 16457 this.cdChunkOffsets = new Int32Array(0); 16458 this.cdBlockBits = 0; 16459 this.cdBlockMap = new Int8Array(0); 16460 this.input = new InputStream(new Int8Array(0)); 16461 this.ringBuffer = new Int8Array(0); 16462 this.rings = new Int32Array(10); 16463 this.rings[0] = 16; 16464 this.rings[1] = 15; 16465 this.rings[2] = 11; 16466 this.rings[3] = 4; 16467 } 16468 let data = new Int8Array(0); 16469 const offsets = new Int32Array(32); 16470 const sizeBits = new Int32Array(32); 16471 function setData(newData, newSizeBits) { 16472 const dictionaryOffsets = offsets; 16473 const dictionarySizeBits = sizeBits; 16474 for (let i = 0; i < newSizeBits.length; ++i) { 16475 dictionarySizeBits[i] = newSizeBits[i]; 16476 } 16477 let pos = 0; 16478 for (let i = 0; i < newSizeBits.length; ++i) { 16479 dictionaryOffsets[i] = pos; 16480 const bits = dictionarySizeBits[i]; 16481 if (bits !== 0) { 16482 pos += i << (bits & 31); 16483 } 16484 } 16485 for (let i = newSizeBits.length; i < 32; ++i) { 16486 dictionaryOffsets[i] = pos; 16487 } 16488 data = newData; 16489 } 16490 function unpackDictionaryData(dictionary, data0, data1, skipFlip, sizeBits, sizeBitsData) { 16491 const dict = toUsAsciiBytes(data0 + data1); 16492 const skipFlipRunes = toUtf8Runes(skipFlip); 16493 let offset = 0; 16494 const n = skipFlipRunes.length >> 1; 16495 for (let i = 0; i < n; ++i) { 16496 const skip = skipFlipRunes[2 * i] - 36; 16497 const flip = skipFlipRunes[2 * i + 1] - 36; 16498 for (let j = 0; j < skip; ++j) { 16499 dict[offset] = dict[offset] ^ 3; 16500 offset++; 16501 } 16502 for (let j = 0; j < flip; ++j) { 16503 dict[offset] = dict[offset] ^ 236; 16504 offset++; 16505 } 16506 } 16507 for (let i = 0; i < sizeBitsData.length; ++i) { 16508 sizeBits[i] = sizeBitsData.charCodeAt(i) - 65; 16509 } 16510 dictionary.set(dict); 16511 } 16512 const dictionaryData = new Int8Array(122784); 16513 const dictionarySizeBits = new Int32Array(25); 16514 unpackDictionaryData(dictionaryData, "wjnfgltmojefofewab`h`lgfgbwbpkltlmozpjwf`jwzlsfmivpwojhfeqfftlqhwf{wzfbqlufqalgzolufelqnallhsobzojufojmfkfosklnfpjgfnlqftlqgolmdwkfnujftejmgsbdfgbzpevookfbgwfqnfb`kbqfbeqlnwqvfnbqhbaofvslmkjdkgbwfobmgmftpfufmmf{w`bpfalwkslpwvpfgnbgfkbmgkfqftkbwmbnfOjmhaoldpjyfabpfkfognbhfnbjmvpfq$*#(klogfmgptjwkMftpqfbgtfqfpjdmwbhfkbufdbnfpffm`boosbwktfoosovpnfmvejonsbqwiljmwkjpojpwdllgmffgtbzptfpwilapnjmgboploldlqj`kvpfpobpwwfbnbqnzellghjmdtjoofbpwtbqgafpwejqfSbdfhmltbtbz-smdnlufwkbmolbgdjufpfoemlwfnv`keffgnbmzql`hj`lmlm`follhkjgfgjfgKlnfqvofklpwbib{jmel`ovaobtpofppkboeplnfpv`kylmf233&lmfp`bqfWjnfqb`faovfelvqtffheb`fklsfdbufkbqgolpwtkfmsbqhhfswsbpppkjsqllnKWNOsobmWzsfglmfpbufhffseobdojmhplogejufwllhqbwfwltmivnswkvpgbqh`bqgejofefbqpwbzhjoowkbweboobvwlfufq-`lnwbohpklsulwfgffsnlgfqfpwwvqmalqmabmgefooqlpfvqo+phjmqlof`lnfb`wpbdfpnffwdlog-isdjwfnubqzefowwkfmpfmggqlsUjft`lsz2-3!?,b=pwlsfopfojfpwlvqsb`h-djesbpw`pp<dqbznfbm%dw8qjgfpklwobwfpbjgqlbgubq#effoilkmqj`hslqwebpw$VB.gfbg?,a=sllqajoowzsfV-P-tllgnvpw1s{8JmelqbmhtjgftbmwtbooofbgX3^8sbvotbufpvqf'+$ tbjwnbppbqnpdlfpdbjmobmdsbjg\"..#ol`hvmjwqllwtbohejqntjef{no!plmdwfpw13s{hjmgqltpwlloelmwnbjopbefpwbqnbsp`lqfqbjmeoltabazpsbmpbzp7s{85s{8bqwpellwqfbotjhjkfbwpwfswqjslqd,obhftfbhwlogElqn`bpwebmpabmhufqzqvmpivozwbph2s{8dlbodqftpoltfgdfjg>!pfwp6s{8-ip<73s{je#+pllmpfbwmlmfwvafyfqlpfmwqffgeb`wjmwldjewkbqn2;s{`bnfkjooalogyllnuljgfbpzqjmdejoosfbhjmjw`lpw0s{8ib`hwbdpajwpqloofgjwhmftmfbq?\"..dqltIPLMgvwzMbnfpbofzlv#olwpsbjmibyy`logfzfpejpkttt-qjphwbapsqfu23s{qjpf16s{Aovfgjmd033/abooelqgfbqmtjogal{-ebjqob`hufqpsbjqivmfwf`kje+\"sj`hfujo'+! tbqnolqgglfpsvoo/333jgfbgqbtkvdfpslwevmgavqmkqfe`foohfzpwj`hklvqolppevfo21s{pvjwgfboQPP!bdfgdqfzDFW!fbpfbjnpdjqobjgp;s{8mbuzdqjgwjsp :::tbqpobgz`bqp*8#~sks<kfoowbootklnyk9\t),\x0E\t#233kboo-\t\tB4s{8svpk`kbw3s{8`qft),?,kbpk46s{eobwqbqf#%%#wfoo`bnslmwlobjgnjppphjswfmwejmfnbofdfwpsolw733/\x0E\t\x0E\t`lloeffw-sks?aq=fqj`nlpwdvjgafoogfp`kbjqnbwkbwln,jnd% ;1ov`h`fmw3338wjmzdlmfkwnopfoogqvdEQFFmlgfmj`h<jg>olpfmvooubpwtjmgQPP#tfbqqfozaffmpbnfgvhfmbpb`bsftjpkdvoeW109kjwppolwdbwfhj`haovqwkfz26s{$$*8*8!=npjftjmpajqgplqwafwbpffhW2;9lqgpwqffnboo53s{ebqn\x0ElupalzpX3^-$*8!SLPWafbqhjgp*8~~nbqzwfmg+VH*rvbgyk9\n.pjy....sqls$*8\x0EojewW2:9uj`fbmgzgfaw=QPPsllomf`haoltW259gllqfuboW249ofwpebjolqbosloomlub`lopdfmf#\x0Elxplewqlnfwjooqlpp?k0=slvqebgfsjmh?wq=njmj*\x7F\"+njmfyk9\x04abqpkfbq33*8njoh#..=jqlmeqfggjphtfmwpljosvwp,ip,klozW119JPAMW139bgbnpffp?k1=iplm$/#$`lmwW129#QPPollsbpjbnllm?,s=plvoOJMFelqw`bqwW279?k2=;3s{\"..?:s{8W379njhf975Ymj`fjm`kZlqhqj`fyk9\b$**8svqfnbdfsbqbwlmfalmg904Y\\le\\$^*8333/yk9\x0Bwbmhzbqgaltoavpk965YIbub03s{\t\x7F~\t&@0&907YifeeF[SJ`bpkujpbdloepmltyk9\x05rvfq-`pppj`hnfbwnjm-ajmggfookjqfsj`pqfmw905YKWWS.132elwltloeFMG#{al{967YALGZgj`h8\t~\tf{jw906Yubqpafbw$~*8gjfw:::8bmmf~~?,Xj^-Obmdhn.^tjqfwlzpbggppfbobof{8\t\n~f`klmjmf-lqd336*wlmziftppbmgofdpqlle333*#133tjmfdfbqgldpallwdbqz`vwpwzofwfnswjlm-{no`l`hdbmd'+$-63s{Sk-Gnjp`bobmolbmgfphnjofqzbmvmj{gjp`*8~\tgvpw`ojs*-\t\t43s{.133GUGp4^=?wbsfgfnlj((*tbdffvqlskjolswpklofEBRpbpjm.15WobapsfwpVQO#avoh`llh8~\x0E\tKFBGX3^*baaqivbm+2:;ofpkwtjm?,j=plmzdvzpev`hsjsf\x7F.\t\"331*mgltX2^8X^8\tOld#pbow\x0E\t\n\nabmdwqjnabwk*x\x0E\t33s{\t~*8hl9\0effpbg=\x0Ep9,,#X^8wloosovd+*x\tx\x0E\t#-ip$133sgvboalbw-ISD*8\t~rvlw*8\t\t$*8\t\x0E\t~\x0E1327132613251324132;132:13131312131113101317131613151314131;131:130313021301130013071306130513041320132113221323133:133;133413351336133713301331133213332:::2::;2::42::52::62::72::02::12::22::32:;:2:;;2:;42:;52:;62:;72:;02:;12:;22:;32:4:2:4;2:442:452:462:472:402:412:422:432:5:2:5;2:542:552:562:572:502:512:522:532:6:2:6;2:642:652:662:672:602:612:622:632333231720:73333::::`lnln/Mpfpwffpwbsfqlwlglkb`f`bgbb/]lajfmg/Abbp/Aujgb`bpllwqlelqlplollwqb`vbogjilpjgldqbmwjslwfnbgfafbodlrv/Efpwlmbgbwqfpsl`l`bpbabilwlgbpjmlbdvbsvfpvmlpbmwfgj`fovjpfoobnbzlylmbbnlqsjpllaqb`oj`foolgjlpklqb`bpj<[<\\<Q<\\<R<P=l<\\=l=o=n<\\<Q<Y<S<R<R=n<T<[<Q<R<X<R=n<R<Z<Y<R<Q<T=i<q<\\<Y<Y<]=g<P=g<~=g=m<R<^=g<^<R<q<R<R<]<s<R<W<T<Q<T<L<H<q<Y<p=g=n=g<r<Q<T<P<X<\\<{<\\<x<\\<q=o<r<]=n<Y<t<[<Y<U<Q=o<P<P<N=g=o<Z5m5f4O5j5i4K5i4U5o5h4O5d4]4C5f4K5m5e5k5d5h5i5h5o4K5d5h5k4D4_4K5h4I5j5k5f4O5f5n4C5k5h4G5i4D5k5h5d5h5f4D5h4K5f4D5o4X5f4K5i4O5i5j4F4D5f5h5j4A4D5k5i5i4X5d4Xejqpwujgflojdkwtlqognfgjbtkjwf`olpfaob`hqjdkwpnbooallhpsob`fnvpj`ejfoglqgfqsljmwubovfofufowbaofalbqgklvpfdqlvstlqhpzfbqppwbwfwlgbztbwfqpwbqwpwzofgfbwksltfqsklmfmjdkwfqqlqjmsvwbalvwwfqnpwjwofwllopfufmwol`bowjnfpobqdftlqgpdbnfppklqwpsb`fel`vp`ofbqnlgfoaol`hdvjgfqbgjlpkbqftlnfmbdbjmnlmfzjnbdfmbnfpzlvmdojmfpobwfq`lolqdqffmeqlmw%bns8tbw`kelq`fsqj`fqvofpafdjmbewfqujpjwjppvfbqfbpafoltjmgf{wlwboklvqpobafosqjmwsqfppavjowojmhppsffgpwvgzwqbgfelvmgpfmpfvmgfqpkltmelqnpqbmdfbggfgpwjoonlufgwbhfmbalufeobpkej{fglewfmlwkfqujftp`kf`hofdboqjufqjwfnprvj`hpkbsfkvnbmf{jpwdljmdnlujfwkjqgabpj`sfb`fpwbdftjgwkoldjmjgfbptqlwfsbdfpvpfqpgqjufpwlqfaqfbhplvwkulj`fpjwfpnlmwktkfqfavjogtkj`kfbqwkelqvnwkqffpslqwsbqwz@oj`holtfqojufp`obppobzfqfmwqzpwlqzvpbdfplvmg`lvqwzlvq#ajqwkslsvswzsfpbssozJnbdfafjmdvssfqmlwfpfufqzpkltpnfbmpf{wqbnbw`kwqb`hhmltmfbqozafdbmpvsfqsbsfqmlqwkofbqmdjufmmbnfgfmgfgWfqnpsbqwpDqlvsaqbmgvpjmdtlnbmebopfqfbgzbvgjlwbhfptkjof-`ln,ojufg`bpfpgbjoz`kjogdqfbwivgdfwklpfvmjwpmfufqaqlbg`lbpw`lufqbssofejofp`z`ofp`fmfsobmp`oj`htqjwfrvffmsjf`ffnbjoeqbnflogfqsklwlojnjw`b`kf`jujop`boffmwfqwkfnfwkfqfwlv`kalvmgqlzbobphfgtklofpjm`fpwl`h#mbnfebjwkkfbqwfnswzleefqp`lsfltmfgnjdkwboavnwkjmhaollgbqqbznbilqwqvpw`bmlmvmjlm`lvmwubojgpwlmfPwzofOldjmkbsszl``vqofew9eqfpkrvjwfejonpdqbgfmffgpvqabmejdkwabpjpklufqbvwl8qlvwf-kwnonj{fgejmboZlvq#pojgfwlsj`aqltmbolmfgqbtmpsojwqfb`kQjdkwgbwfpnbq`krvlwfdllgpOjmhpglvawbpzm`wkvnaboolt`kjfezlvwkmlufo23s{8pfqufvmwjokbmgp@kf`hPsb`frvfqzibnfpfrvbowtj`f3/333Pwbqwsbmfoplmdpqlvmgfjdkwpkjewtlqwkslpwpofbgptffhpbuljgwkfpfnjofpsobmfpnbqwboskbsobmwnbqhpqbwfpsobzp`objnpbofpwf{wppwbqptqlmd?,k0=wkjmd-lqd,nvowjkfbqgSltfqpwbmgwlhfmplojg+wkjpaqjmdpkjsppwbeewqjfg`boopevoozeb`wpbdfmwWkjp#,,..=bgnjmfdzswFufmw26s{8Fnbjowqvf!`qlpppsfmwaoldpal{!=mlwfgofbuf`kjmbpjyfpdvfpw?,k7=qlalwkfbuzwqvf/pfufmdqbmg`qjnfpjdmpbtbqfgbm`fskbpf=?\"..fm\\VP% 0:8133s{\\mbnfobwjmfmilzbib{-bwjlmpnjwkV-P-#klogpsfwfqjmgjbmbu!=`kbjmp`lqf`lnfpgljmdsqjlqPkbqf2::3pqlnbmojpwpibsbmeboopwqjboltmfqbdqff?,k1=bavpfbofqwlsfqb!.,,T`bqgpkjoopwfbnpSklwlwqvwk`ofbm-sks<pbjmwnfwboolvjpnfbmwsqlleaqjfeqlt!=dfmqfwqv`hollhpUbovfEqbnf-mfw,..=\t?wqz#x\tubq#nbhfp`lpwpsobjmbgvowrvfpwwqbjmobalqkfosp`bvpfnbdj`nlwlqwkfjq163s{ofbpwpwfsp@lvmw`lvogdobpppjgfpevmgpklwfobtbqgnlvwknlufpsbqjpdjufpgvw`kwf{bpeqvjwmvoo/\x7F\x7FX^8wls!=\t?\"..SLPW!l`fbm?aq,=eollqpsfbhgfswk#pjyfabmhp`bw`k`kbqw13s{8bojdmgfboptlvog63s{8vqo>!sbqhpnlvpfNlpw#---?,bnlmdaqbjmalgz#mlmf8abpfg`bqqzgqbewqfefqsbdf\\klnf-nfwfqgfobzgqfbnsqlufiljmw?,wq=gqvdp?\"..#bsqjojgfboboofmf{b`welqwk`lgfpoldj`Ujft#pffnpaobmhslqwp#+133pbufg\\ojmhdlbopdqbmwdqffhklnfpqjmdpqbwfg03s{8tklpfsbqpf+*8!#Aol`hojmv{ilmfpsj{fo$*8!=*8je+.ofewgbujgklqpfEl`vpqbjpfal{fpWqb`hfnfmw?,fn=abq!=-pq`>wltfqbow>!`baofkfmqz17s{8pfwvsjwbozpkbqsnjmlqwbpwftbmwpwkjp-qfpfwtkffodjqop,`pp,233&8`ovappwveeajaofulwfp#2333hlqfb~*8\x0E\tabmgprvfvf>#x~8;3s{8`hjmdx\x0E\t\n\nbkfbg`ol`hjqjpkojhf#qbwjlpwbwpElqn!zbkll*X3^8Balvwejmgp?,k2=gfavdwbphpVQO#>`foop~*+*821s{8sqjnfwfoopwvqmp3{533-isd!psbjmafb`kwb{fpnj`qlbmdfo..=?,djewppwfuf.ojmhalgz-~*8\t\nnlvmw#+2::EBR?,qldfqeqbmh@obpp1;s{8effgp?k2=?p`lwwwfpwp11s{8gqjmh*#\x7F\x7F#oftjppkboo 30:8#elq#olufgtbpwf33s{8ib9\x0Fnpjnlm?elmwqfsoznffwpvmwfq`kfbswjdkwAqbmg*#\">#gqfpp`ojspqllnplmhfznlajonbjm-Mbnf#sobwfevmmzwqffp`ln,!2-isdtnlgfsbqbnPWBQWofew#jggfm/#132*8\t~\telqn-ujqvp`kbjqwqbmptlqpwSbdfpjwjlmsbw`k?\"..\tl.`b`ejqnpwlvqp/333#bpjbmj((*xbglaf$*X3^jg>23alwk8nfmv#-1-nj-smd!hfujm`lb`k@kjogaqv`f1-isdVQO*(-isd\x7Fpvjwfpoj`fkbqqz213!#ptffwwq=\x0E\tmbnf>gjfdlsbdf#ptjpp..=\t\t eee8!=Old-`ln!wqfbwpkffw*#%%#27s{8poffsmwfmwejofgib9\x0Fojg>!`Mbnf!tlqpfpklwp.al{.gfowb\t%ow8afbqp97;Y?gbwb.qvqbo?,b=#psfmgabhfqpklsp>#!!8sks!=`wjlm20s{8aqjbmkfoolpjyf>l>&1E#iljmnbzaf?jnd#jnd!=/#eipjnd!#!*X3^NWlsAWzsf!mftozGbmph`yf`kwqbjohmltp?,k6=ebr!=yk.`m23*8\t.2!*8wzsf>aovfpwqvozgbujp-ip$8=\x0E\t?\"pwffo#zlv#k1=\x0E\telqn#ifpvp233&#nfmv-\x0E\t\n\x0E\ttbofpqjphpvnfmwggjmda.ojhwfb`kdje!#ufdbpgbmphffpwjpkrjspvlnjplaqfgfpgffmwqfwlglpsvfgfb/]lpfpw/Mwjfmfkbpwblwqlpsbqwfglmgfmvfulkb`fqelqnbnjpnlnfilqnvmglbrv/Ag/Abpp/_olbzvgbef`kbwlgbpwbmwlnfmlpgbwlplwqbppjwjlnv`klbklqbovdbqnbzlqfpwlpklqbpwfmfqbmwfpelwlpfpwbpsb/Apmvfubpbovgelqlpnfgjlrvjfmnfpfpslgfq`kjofpfq/Muf`fpgf`jqilp/Efpwbqufmwbdqvslkf`klfoolpwfmdlbnjdl`lpbpmjufodfmwfnjpnbbjqfpivojlwfnbpkb`jbebulqivmjlojaqfsvmwlavfmlbvwlqbaqjoavfmbwf{wlnbqylpbafqojpwbovfdl`/_nlfmfqlivfdlsfq/Vkbafqfpwlzmvm`bnvifqubolqevfqbojaqldvpwbjdvboulwlp`bplpdv/Absvfglplnlpbujplvpwfggfafmml`kfavp`bebowbfvqlppfqjfgj`kl`vqpl`obuf`bpbpof/_msobylobqdllaqbpujpwbbslzlivmwlwqbwbujpwl`qfbq`bnslkfnlp`jm`l`bqdlsjplplqgfmkb`fm/Mqfbgjp`lsfgql`fq`bsvfgbsbsfonfmlq/Vwjo`obqlilqdf`boofslmfqwbqgfmbgjfnbq`bpjdvffoobppjdol`l`kfnlwlpnbgqf`obpfqfpwlmj/]lrvfgbsbpbqabm`lkjilpujbifsbaol/Epwfujfmfqfjmlgfibqelmgl`bmbomlqwfofwqb`bvpbwlnbqnbmlpovmfpbvwlpujoobufmglsfpbqwjslpwfmdbnbq`loofubsbgqfvmjglubnlpylmbpbnalpabmgbnbqjbbavplnv`kbpvajqqjlibujujqdqbgl`kj`bboo/Ailufmgj`kbfpwbmwbofppbojqpvfolsfplpejmfpoobnbavp`l/Epwboofdbmfdqlsobybkvnlqsbdbqivmwbglaofjpobpalopbab/]lkbaobov`kb/mqfbgj`fmivdbqmlwbpuboofboo/M`bqdbglolqbabilfpw/Edvpwlnfmwfnbqjlejqnb`lpwlej`kbsobwbkldbqbqwfpofzfpbrvfonvpflabpfpsl`lpnjwbg`jfol`kj`lnjfgldbmbqpbmwlfwbsbgfafpsobzbqfgfppjfwf`lqwf`lqfbgvgbpgfpflujfilgfpfbbdvbp%rvlw8glnbjm`lnnlmpwbwvpfufmwpnbpwfqpzpwfnb`wjlmabmmfqqfnlufp`qloovsgbwfdolabonfgjvnejowfqmvnafq`kbmdfqfpvowsvaoj`p`qffm`kllpfmlqnbowqbufojppvfpplvq`fwbqdfwpsqjmdnlgvofnlajofptjw`ksklwlpalqgfqqfdjlmjwpfoepl`jbob`wjuf`lovnmqf`lqgelooltwjwof=fjwkfqofmdwkebnjozeqjfmgobzlvwbvwklq`qfbwfqfujftpvnnfqpfqufqsobzfgsobzfqf{sbmgsloj`zelqnbwglvaofsljmwppfqjfpsfqplmojujmdgfpjdmnlmwkpelq`fpvmjrvftfjdkwsflsoffmfqdzmbwvqfpfbq`kejdvqfkbujmd`vpwlnleepfwofwwfqtjmgltpvanjwqfmgfqdqlvspvsolbgkfbowknfwklgujgflpp`klloevwvqfpkbgltgfabwfubovfpLaif`wlwkfqpqjdkwpofbdvf`kqlnfpjnsofmlwj`fpkbqfgfmgjmdpfbplmqfslqwlmojmfprvbqfavwwlmjnbdfpfmbaofnlujmdobwfpwtjmwfqEqbm`fsfqjlgpwqlmdqfsfbwOlmglmgfwbjoelqnfggfnbmgpf`vqfsbppfgwlddofsob`fpgfuj`fpwbwj``jwjfppwqfbnzfooltbwwb`hpwqffweojdkwkjggfmjmel!=lsfmfgvpfevouboofz`bvpfpofbgfqpf`qfwpf`lmggbnbdfpslqwpf{`fswqbwjmdpjdmfgwkjmdpfeef`wejfogppwbwfpleej`fujpvbofgjwlqulovnfQfslqwnvpfvnnlujfpsbqfmwb``fppnlpwoznlwkfq!#jg>!nbqhfwdqlvmg`kbm`fpvqufzafelqfpznalonlnfmwpsff`knlwjlmjmpjgfnbwwfq@fmwfqlaif`wf{jpwpnjggofFvqlsfdqltwkofdb`znbmmfqfmlvdk`bqffqbmptfqlqjdjmslqwbo`ojfmwpfof`wqbmgln`olpfgwlsj`p`lnjmdebwkfqlswjlmpjnsozqbjpfgfp`bsf`klpfm`kvq`kgfejmfqfbplm`lqmfqlvwsvwnfnlqzjeqbnfsloj`fnlgfopMvnafqgvqjmdleefqppwzofphjoofgojpwfg`boofgpjoufqnbqdjmgfofwfafwwfqaqltpfojnjwpDolabopjmdoftjgdfw`fmwfqavgdfwmltqbs`qfgjw`objnpfmdjmfpbefwz`klj`fpsjqjw.pwzofpsqfbgnbhjmdmffgfgqvppjbsofbpff{wfmwP`qjswaqlhfmbooltp`kbqdfgjujgfeb`wlqnfnafq.abpfgwkflqz`lmejdbqlvmgtlqhfgkfosfg@kvq`kjnsb`wpklvogbotbzpoldl!#alwwlnojpw!=*xubq#sqfej{lqbmdfKfbgfq-svpk+`lvsofdbqgfmaqjgdfobvm`kQfujftwbhjmdujpjlmojwwofgbwjmdAvwwlmafbvwzwkfnfpelqdlwPfbq`kbm`klqbonlpwolbgfg@kbmdfqfwvqmpwqjmdqfolbgNlajofjm`lnfpvssozPlvq`flqgfqpujftfg%maps8`lvqpfBalvw#jpobmg?kwno#`llhjfmbnf>!bnbylmnlgfqmbguj`fjm?,b=9#Wkf#gjboldklvpfpAFDJM#Nf{j`lpwbqwp`fmwqfkfjdkwbggjmdJpobmgbppfwpFnsjqfP`kllofeelqwgjqf`wmfbqoznbmvboPfof`w-\t\tLmfiljmfgnfmv!=SkjojsbtbqgpkbmgofjnslqwLeej`fqfdbqgphjoopmbwjlmPslqwpgfdqfftffhoz#+f-d-afkjmggl`wlqolddfgvmjwfg?,a=?,afdjmpsobmwpbppjpwbqwjpwjppvfg033s{\x7F`bmbgbbdfm`zp`kfnfqfnbjmAqbyjopbnsofoldl!=afzlmg.p`bofb``fswpfqufgnbqjmfEllwfq`bnfqb?,k2=\t\\elqn!ofbufppwqfpp!#,=\x0E\t-dje!#lmolbgolbgfqL{elqgpjpwfqpvqujuojpwfmefnbofGfpjdmpjyf>!bssfbowf{w!=ofufopwkbmhpkjdkfqelq`fgbmjnbobmzlmfBeqj`bbdqffgqf`fmwSflsof?aq#,=tlmgfqsqj`fpwvqmfg\x7F\x7F#x~8nbjm!=jmojmfpvmgbztqbs!=ebjofg`fmpvpnjmvwfafb`lmrvlwfp263s{\x7Ffpwbwfqfnlwffnbjo!ojmhfgqjdkw8pjdmboelqnbo2-kwnopjdmvssqjm`feolbw9-smd!#elqvn-B``fppsbsfqpplvmgpf{wfmgKfjdkwpojgfqVWE.;!%bns8#Afelqf-#TjwkpwvgjlltmfqpnbmbdfsqlejwiRvfqzbmmvbosbqbnpalvdkwebnlvpdlldofolmdfqj((*#xjpqbfopbzjmdgf`jgfklnf!=kfbgfqfmpvqfaqbm`ksjf`fpaol`h8pwbwfgwls!=?qb`jmdqfpjyf..%dw8sb`jwzpf{vboavqfbv-isd!#23/333lawbjmwjwofpbnlvmw/#Jm`-`lnfgznfmv!#ozqj`pwlgbz-jmgffg`lvmwz\\oldl-EbnjozollhfgNbqhfwopf#jeSobzfqwvqhfz*8ubq#elqfpwdjujmdfqqlqpGlnbjm~fopfxjmpfqwAold?,ellwfqoldjm-ebpwfqbdfmwp?algz#23s{#3sqbdnbeqjgbzivmjlqgloobqsob`fg`lufqpsovdjm6/333#sbdf!=alpwlm-wfpw+bubwbqwfpwfg\\`lvmwelqvnpp`kfnbjmgf{/ejoofgpkbqfpqfbgfqbofqw+bssfbqPvanjwojmf!=algz!=\t)#WkfWklvdkpffjmdifqpfzMftp?,ufqjezf{sfqwjmivqztjgwk>@llhjfPWBQW#b`qlpp\\jnbdfwkqfbgmbwjufsl`hfwal{!=\tPzpwfn#Gbujg`bm`fqwbaofpsqlufgBsqjo#qfboozgqjufqjwfn!=nlqf!=albqgp`lolqp`bnsvpejqpw#\x7F\x7F#X^8nfgjb-dvjwbqejmjpktjgwk9pkltfgLwkfq#-sks!#bppvnfobzfqptjoplmpwlqfpqfojfeptfgfm@vpwlnfbpjoz#zlvq#Pwqjmd\t\tTkjowbzolq`ofbq9qfplqweqfm`kwklvdk!*#(#!?algz=avzjmdaqbmgpNfnafqmbnf!=lssjmdpf`wlq6s{8!=upsb`fslpwfqnbilq#`leeffnbqwjmnbwvqfkbssfm?,mbu=hbmpbpojmh!=Jnbdfp>ebopftkjof#kpsb`f3%bns8#\t\tJm##sltfqSlophj.`lolqilqgbmAlwwlnPwbqw#.`lvmw1-kwnomftp!=32-isdLmojmf.qjdkwnjoofqpfmjlqJPAM#33/333#dvjgfpubovf*f`wjlmqfsbjq-{no!##qjdkwp-kwno.aol`hqfdF{s9klufqtjwkjmujqdjmsklmfp?,wq=\x0Evpjmd#\t\nubq#=$*8\t\n?,wg=\t?,wq=\tabkbpbaqbpjodbofdlnbdzbqslophjpqsphj4]4C5d\bTA\nzk\x0BBl\bQ\x7F\x0BUm\x05Gx\bSM\nmC\bTA\twQ\nd}\bW@\bTl\bTF\ti@\tcT\x0BBM\x0B|j\x04BV\tqw\tcC\bWI\npa\tfM\n{Z\x05{X\bTF\bVV\bVK\t\x7Fm\x04kF\t[]\bPm\bTv\nsI\x0Bpg\t[I\bQp\x04mx\x0B_W\n^M\npe\x0BQ}\x0BGu\nel\npe\x04Ch\x04BV\bTA\tSo\nzk\x0BGL\x0BxD\nd[\x05Jz\x05MY\bQp\x04li\nfl\npC\x05{B\x05Nt\x0BwT\ti_\bTg\x04QQ\n|p\x0BXN\bQS\x0BxD\x04QC\bWZ\tpD\x0BVS\bTW\x05Nt\x04Yh\nzu\x04Kj\x05N}\twr\tHa\n_D\tj`\x0BQ}\x0BWp\nxZ\x04{c\tji\tBU\nbD\x04a|\tTn\tpV\nZd\nmC\x0BEV\x05{X\tc}\tTo\bWl\bUd\tIQ\tcg\x0Bxs\nXW\twR\x0Bek\tc}\t]y\tJn\nrp\neg\npV\nz\\\x05{W\npl\nz\\\nzU\tPc\t`{\bV@\nc|\bRw\ti_\bVb\nwX\tHv\x04Su\bTF\x0B_W\x0BWs\x0BsI\x05m\x7F\nTT\ndc\tUS\t}f\tiZ\bWz\tc}\x04MD\tBe\tiD\x0B@@\bTl\bPv\t}t\x04Sw\x04M`\x0BnU\tkW\x0Bed\nqo\x0BxY\tA|\bTz\x0By`\x04BR\x04BM\tia\x04XU\nyu\x04n^\tfL\tiI\nXW\tfD\bWz\bW@\tyj\t\x7Fm\tav\tBN\x0Bb\\\tpD\bTf\nY[\tJn\bQy\t[^\x0BWc\x0Byu\x04Dl\x04CJ\x0BWj\x0BHR\t`V\x0BuW\tQy\np@\x0BGu\x05pl\x04Jm\bW[\nLP\nxC\n`m\twQ\x05ui\x05\x7FR\nbI\twQ\tBZ\tWV\x04BR\npg\tcg\x05ti\x04CW\n_y\tRg\bQa\x0BQB\x0BWc\nYb\x05le\ngE\x04Su\nL[\tQ\x7F\tea\tdj\x0B]W\nb~\x04M`\twL\bTV\bVH\nt\x7F\npl\t|b\x05s_\bU|\bTa\x04oQ\x05lv\x04Sk\x04M`\bTv\x0BK}\nfl\tcC\x04oQ\x04BR\tHk\t|d\bQp\tHK\tBZ\x0BHR\bPv\x0BLx\x0BEZ\bT\x7F\bTv\tiD\x05oD\x05MU\x0BwB\x04Su\x05k`\x04St\ntC\tPl\tKg\noi\tjY\x0BxY\x04h}\nzk\bWZ\t\x7Fm\x0Be`\tTB\tfE\nzk\t`z\x04Yh\nV|\tHK\tAJ\tAJ\bUL\tp\\\tql\nYc\x04Kd\nfy\x04Yh\t[I\x0BDg\x04Jm\n]n\nlb\bUd\n{Z\tlu\tfs\x04oQ\bTW\x04Jm\x0BwB\tea\x04Yh\x04BC\tsb\tTn\nzU\n_y\x0BxY\tQ]\ngw\x04mt\tO\\\ntb\bWW\bQy\tmI\tV[\ny\\\naB\x0BRb\twQ\n]Q\x04QJ\bWg\x0BWa\bQj\ntC\bVH\nYm\x0Bxs\bVK\nel\bWI\x0BxY\x04Cq\ntR\x0BHV\bTl\bVw\tay\bQa\bVV\t}t\tdj\nr|\tp\\\twR\n{i\nTT\t[I\ti[\tAJ\x0Bxs\x0B_W\td{\x0BQ}\tcg\tTz\tA|\tCj\x0BLm\x05N}\x05m\x7F\nbK\tdZ\tp\\\t`V\tsV\np@\tiD\twQ\x0BQ}\bTf\x05ka\x04Jm\x0B@@\bV`\tzp\n@N\x04Sw\tiI\tcg\noi\x04Su\bVw\x04lo\x04Cy\tc}\x0Bb\\\tsU\x04BA\bWI\bTf\nxS\tVp\nd|\bTV\x0BbC\tNo\x05Ju\nTC\t|`\n{Z\tD]\bU|\tc}\x05lm\bTl\tBv\tPl\tc}\bQp\t\x7Fm\nLk\tkj\n@N\x04Sb\x04KO\tj_\tp\\\nzU\bTl\bTg\bWI\tcf\x04XO\bWW\ndz\x04li\tBN\nd[\bWO\x04MD\x0BKC\tdj\tI_\bVV\ny\\\x0BLm\x05xl\txB\tkV\x0Bb\\\x0BJW\x0BVS\tVx\x0BxD\td{\x04MD\bTa\t|`\x0BPz\x04R}\x0BWs\x04BM\nsI\x04CN\bTa\x04Jm\npe\ti_\npV\nrh\tRd\tHv\n~A\nxR\x0BWh\x0BWk\nxS\x0BAz\x0BwX\nbI\x04oQ\tfw\nqI\nV|\nun\x05z\x7F\x0Bpg\td\\\x0BoA\x05{D\ti_\x05xB\bT\x7F\t`V\x05qr\tTT\x04g]\x04CA\x0BuR\tVJ\tT`\npw\x0BRb\tI_\nCx\x04Ro\x0BsI\x04Cj\x04Kh\tBv\tWV\x04BB\x05oD\x05{D\nhc\x04Km\x0B^R\tQE\n{I\np@\nc|\x05Gt\tc}\x04Dl\nzU\x05qN\tsV\x05k}\tHh\x0B|j\nqo\x05u|\tQ]\x0Bek\x05\x7FZ\x04M`\x04St\npe\tdj\bVG\x0BeE\t\x7Fm\x0BWc\x04|I\n[W\tfL\bT\x7F\tBZ\x04Su\x0BKa\x04Cq\x05Nt\x04Y[\nqI\bTv\tfM\ti@\t}f\x04B\\\tQy\x0BBl\bWg\x04XD\x05kc\x0Bx[\bVV\tQ]\t\x7Fa\tPy\x0BxD\nfI\t}f\x05oD\tdj\tSG\x05ls\t~D\x04CN\n{Z\t\\v\n_D\nhc\x0Bx_\x04C[\tAJ\nLM\tVx\x04CI\tbj\tc^\tcF\ntC\x04Sx\twr\x04XA\bU\\\t|a\x0BK\\\bTV\bVj\nd|\tfs\x04CX\ntb\bRw\tVx\tAE\tA|\bT\x7F\x05Nt\x0BDg\tVc\bTl\x04d@\npo\t\x7FM\tcF\npe\tiZ\tBo\bSq\nfH\x04l`\bTx\bWf\tHE\x0BF{\tcO\tfD\nlm\x0BfZ\nlm\x0BeU\tdG\x04BH\bTV\tSi\x05MW\nwX\nz\\\t\\c\x04CX\nd}\tl}\bQp\bTV\tF~\bQ\x7F\t`i\ng@\x05nO\bUd\bTl\nL[\twQ\tji\ntC\t|J\nLU\naB\x0BxY\x04Kj\tAJ\x05uN\ti[\npe\x04Sk\x0BDg\x0Bx]\bVb\bVV\nea\tkV\nqI\bTa\x04Sk\nAO\tpD\ntb\nts\nyi\bVg\ti_\x0B_W\nLk\x05Nt\tyj\tfM\x04R\x7F\tiI\bTl\x0BwX\tsV\x0BMl\nyu\tAJ\bVj\x04KO\tWV\x0BA}\x0BW\x7F\nrp\tiD\x0B|o\x05lv\x0BsI\x04BM\td~\tCU\bVb\x04eV\npC\x0BwT\tj`\tc}\x0Bxs\x0Bps\x0Bvh\tWV\x0BGg\x0BAe\x0BVK\x0B]W\trg\x0BWc\x05F`\tBr\x0Bb\\\tdZ\bQp\nqI\x04kF\nLk\x0BAR\bWI\bTg\tbs\tdw\n{L\n_y\tiZ\bTA\tlg\bVV\bTl\tdk\n`k\ta{\ti_\x05{A\x05wj\twN\x0B@@\bTe\ti_\n_D\twL\nAH\x0BiK\x0Bek\n[]\tp_\tyj\bTv\tUS\t[r\n{I\nps\x05Gt\x0BVK\npl\x04S}\x0BWP\t|d\x04MD\x0BHV\bT\x7F\x04R}\x04M`\bTV\bVH\x05lv\x04Ch\bW[\x04Ke\tR{\x0B^R\tab\tBZ\tVA\tB`\nd|\nhs\x04Ke\tBe\x04Oi\tR{\td\\\x05nB\bWZ\tdZ\tVJ\x05Os\t\x7Fm\x04uQ\x0BhZ\x04Q@\x04QQ\nfI\bW[\x04B\\\x04li\nzU\nMd\x04M`\nxS\bVV\n\\}\x0BxD\t\x7Fm\bTp\x04IS\nc|\tkV\x05i~\tV{\x0BhZ\t|b\bWt\n@R\x0BoA\x0BnU\bWI\tea\tB`\tiD\tc}\tTz\x04BR\x0BQB\x05Nj\tCP\t[I\bTv\t`W\x05uN\x0Bpg\x0Bpg\x0BWc\tiT\tbs\twL\tU_\tc\\\t|h\x0BKa\tNr\tfL\nq|\nzu\nz\\\tNr\bUg\t|b\x04m`\bTv\nyd\nrp\bWf\tUX\x04BV\nzk\nd}\twQ\t}f\x04Ce\x0Bed\bTW\bSB\nxU\tcn\bTb\ne\x7F\ta\\\tSG\bU|\npV\nN\\\x04Kn\x0BnU\tAt\tpD\x0B^R\x0BIr\x04b[\tR{\tdE\x0BxD\x0BWK\x0BWA\bQL\bW@\x04Su\bUd\nDM\tPc\x04CA\x04Dl\x04oQ\tHs\x05wi\x04ub\n\x7Fa\bQp\x05Ob\nLP\bTl\x04Y[\x0BK}\tAJ\bQ\x7F\x04n^\x0BsA\bSM\nqM\bWZ\n^W\x0Bz{\x04S|\tfD\bVK\bTv\bPv\x04BB\tCP\x04dF\tid\x0Bxs\x04mx\x0Bws\tcC\ntC\tyc\x05M`\x0BW\x7F\nrh\bQp\x0BxD\x04\\o\nsI\x04_k\nzu\x04kF\tfD\x04Xs\x04XO\tjp\bTv\x04BS\x05{B\tBr\nzQ\nbI\tc{\x04BD\x04BV\x05nO\bTF\tca\x05Jd\tfL\tPV\tI_\nlK\x04`o\twX\npa\tgu\bP}\x05{^\bWf\n{I\tBN\npa\x04Kl\x0Bpg\tcn\tfL\x0Bvh\x04Cq\bTl\x0BnU\bSq\x04Cm\twR\bUJ\npe\nyd\nYg\x04Cy\x0BKW\tfD\nea\x04oQ\tj_\tBv\x04nM\x0BID\bTa\nzA\x05pl\n]n\bTa\tR{\tfr\n_y\bUg\x05{X\x05kk\x0BxD\x04|I\x05xl\nfy\x04Ce\x0BwB\nLk\x0Bd]\noi\n}h\tQ]\npe\bVw\x04Hk\x04OQ\nzk\tAJ\npV\bPv\ny\\\tA{\x04Oi\bSB\x04XA\x0BeE\tjp\nq}\tiD\x05qN\x0B^R\t\x7Fm\tiZ\tBr\bVg\noi\n\\X\tU_\nc|\x0BHV\bTf\tTn\x04\\N\x04\\N\nuB\x05lv\nyu\tTd\bTf\bPL\x0B]W\tdG\nA`\nw^\ngI\npe\tdw\nz\\\x05ia\bWZ\tcF\x04Jm\n{Z\bWO\x04_k\x04Df\x04RR\td\\\bVV\x0Bxs\x04BN\x05ti\x04lm\tTd\t]y\x0BHV\tSo\x0B|j\x04XX\tA|\x0BZ^\x0BGu\bTW\x05M`\x04kF\x0BhZ\x0BVK\tdG\x0BBl\tay\nxU\x05qE\x05nO\bVw\nqI\x04CX\ne\x7F\tPl\bWO\x0BLm\tdL\x05uH\x04Cm\tdT\x04fn\x0BwB\x05ka\x0BnU\n@M\nyT\tHv\t\\}\x04Kh\td~\x04Yh\x05k}\neR\td\\\bWI\t|b\tHK\tiD\bTW\x05MY\npl\bQ_\twr\x0BAx\tHE\bTg\bSq\x05vp\x0Bb\\\bWO\nOl\nsI\nfy\x0BID\t\\c\n{Z\n^~\npe\nAO\tTT\x0Bxv\x04k_\bWO\x0B|j\x0BwB\tQy\ti@\tPl\tHa\tdZ\x05k}\x04ra\tUT\x0BJc\x0Bed\np@\tQN\nd|\tkj\tHk\x04M`\noi\twr\td\\\nlq\no_\nlb\nL[\tac\x04BB\x04BH\x04Cm\npl\tIQ\bVK\x0Bxs\n`e\x0BiK\npa\x04Oi\tUS\bTp\tfD\nPG\x05kk\x04XA\nz\\\neg\x0BWh\twR\x05qN\nqS\tcn\x04lo\nxS\n^W\tBU\nt\x7F\tHE\tp\\\tfF\tfw\bVV\bW@\tak\x0BVK\x05ls\tVJ\bVV\x0BeE\x04\\o\nyX\nYm\x04M`\x05lL\nd|\nzk\tA{\x05sE\twQ\x04XT\nt\x7F\tPl\t]y\x0BwT\x05{p\x04MD\x0Bb\\\tQ]\x04Kj\tJn\nAH\x0BRb\tBU\tHK\t\\c\nfI\x05m\x7F\nqM\n@R\tSo\noi\x04BT\tHv\n_y\x04Kh\tBZ\t]i\bUJ\tV{\x04Sr\nbI\x0BGg\ta_\bTR\nfI\nfl\t[K\tII\x04S|\x0BuW\tiI\bWI\nqI\x0B|j\x04BV\bVg\bWZ\x04kF\x0Bx]\bTA\tab\tfr\ti@\tJd\tJd\x0Bps\nAO\bTa\x05xu\tiD\nzk\t|d\t|`\bW[\tlP\tdG\bVV\x0Bw}\x0BqO\ti[\bQ\x7F\bTz\x0BVF\twN\x05ts\tdw\bTv\neS\ngi\tNr\x05yS\npe\bVV\bSq\n`m\tyj\tBZ\x0BWX\bSB\tc\\\nUR\t[J\tc_\x04nM\bWQ\x0BAx\nMd\tBr\x05ui\x0BxY\bSM\x0BWc\x0B|j\x0Bxs\t}Q\tBO\bPL\bWW\tfM\nAO\tPc\x0BeU\x04e^\bTg\nqI\tac\bPv\tcF\x04oQ\tQ\x7F\x0BhZ\x05ka\nz\\\tiK\tBU\n`k\tCP\x04S|\x04M`\n{I\tS{\x04_O\tBZ\x04Zi\x04Sk\tps\tp\\\nYu\n]s\nxC\bWt\nbD\tkV\x0BGu\x05yS\nqA\t[r\neK\x04M`\tdZ\x05lL\bUg\bTl\nbD\tUS\x0Bb\\\tpV\ncc\x04S\\\tct\t`z\bPL\x0BWs\nA`\neg\bSq\x05uE\x04CR\x0BDg\t`W\x0Bz{\x0BWc\x04Sk\x04Sk\tbW\bUg\tea\nxZ\tiI\tUX\tVJ\nqn\tS{\x0BRb\bTQ\npl\x05Gt\x0BuW\x05uj\npF\nqI\tfL\t[I\tia\x04XO\nyu\x0BDg\x0Bed\tq{\x04VG\bQ\x7F\x05ka\tVj\tkV\txB\nd|\np@\tQN\tPc\tps\x04]j\tkV\toU\bTp\nzU\x05nB\x0BB]\ta{\bV@\n]n\x04m`\tcz\tR{\x04m`\bQa\x0BwT\bSM\x05MY\x05qN\tdj\x05~s\x0BQ}\x05MY\x0BMB\tBv\twR\bRg\x0BQ}\tql\x0BKC\nrm\x05xu\x04CC\x0BwB\x0Bvh\tBq\x04Xq\npV\ti_\x05Ob\x05uE\nbd\nqo\x0B{i\nC~\tBL\x0BeE\x05uH\bVj\x04Ey\x04Gz\x0BzR\x0B{i\tcf\n{Z\n]n\x04XA\x0BGu\x0BnU\thS\x0BGI\nCc\tHE\bTA\tHB\x04BH\x04Cj\nCc\bTF\tHE\nXI\tA{\bQ\x7F\tc\\\x0BmO\x0BWX\nfH\np@\x05MY\bTF\nlK\tBt\nzU\tTT\x04Km\x0BwT\npV\ndt\x0ByI\tVx\tQ\x7F\tRg\tTd\nzU\bRS\nLM\twA\x04nM\tTn\ndS\t]g\nLc\x0BwB\t}t\t[I\tCP\x04kX\x0BFm\x0BhZ\x05m\x7F\ti[\np@\x0BQ}\x0BW\x7F\t|d\nMO\nMd\tf_\tfD\tcJ\tHz\x0BRb\tio\tPy\x04Y[\nxU\tct\x0B@@\tww\bPv\x04BM\x04FF\ntb\x05v|\x0BKm\tBq\tBq\x04Kh\x04`o\nZd\x04XU\ti]\t|`\tSt\x04B\\\bQ\x7F\x0B_W\tTJ\nqI\t|a\tA{\x0BuP\x04MD\tPl\nxR\tfL\x0Bws\tc{\td\\\bV`\neg\tHK\x05kc\nd|\bVV\ny\\\x05kc\ti]\bVG\t`V\tss\tI_\tAE\tbs\tdu\nel\tpD\x0BW\x7F\nqs\x05lv\bSM\x04Zi\x0BVK\x05ia\x0BQB\tQ\x7F\n{Z\bPt\x0BKl\nlK\nhs\ndS\bVK\x05mf\nd^\tkV\tcO\nc|\bVH\t\\]\bTv\bSq\tmI\x0BDg\tVJ\tcn\ny\\\bVg\bTv\nyX\bTF\t]]\bTp\noi\nhs\x0BeU\nBf\tdj\x05Mr\n|p\t\\g\t]r\bVb\x05{D\nd[\x04XN\tfM\tO\\\x05s_\tcf\tiZ\x04XN\x0BWc\tqv\n`m\tU^\x05oD\nd|\x0BGg\tdE\x0Bwf\x04lo\x04u}\nd|\x05oQ\t`i\x04Oi\x0BxD\ndZ\nCx\x04Yw\nzk\ntb\ngw\tyj\tB`\nyX\x0Bps\ntC\x0BpP\x0Bqw\bPu\bPX\tDm\npw\x05Nj\tss\taG\x0Bxs\bPt\noL\x04Gz\tOk\ti@\ti]\x04eC\tIQ\tii\tdj\x0B@J\t|d\x05uh\bWZ\x0BeU\x0BnU\bTa\tcC\x04g]\nzk\x04Yh\bVK\nLU\np@\ntb\ntR\tCj\x0BNP\ti@\bP{\n\\}\n{c\nwX\tfL\bVG\tc{\t|`\tAJ\t|C\tfD\x05ln\t|d\tbs\nqI\x05{B\x0BAx\np@\nzk\x0BRb\x05Os\x0BWS\x04e^\x0BD_\tBv\x0BWd\bVb\x0Bxs\x0BeE\bRw\n]n\n|p\x0Bg|\tfw\x05kc\bTI\x05ka\n\\T\x04Sp\tju\x0Bps\npe\x05u|\x0BGr\bVe\tCU\x04]M\x04XU\x0BxD\bTa\tIQ\x0BWq\tCU\tam\tdj\bSo\x04Sw\x0BnU\x04Ch\tQ]\x05s_\bPt\tfS\bTa\t\\}\n@O\x04Yc\tUZ\bTx\npe\x0BnU\nzU\t|}\tiD\nz\\\bSM\x0BxD\x04BR\nzQ\tQN\x04]M\x04Yh\nLP\x0BFm\x0BLX\x05vc\x0Bql\x05ka\tHK\bVb\ntC\nCy\bTv\nuV\x04oQ\t`z\t[I\tB`\x0BRb\tyj\tsb\x0BWs\bTl\tkV\x0Bed\ne\x7F\x05lL\x0BxN\t\x7Fm\nJn\tjY\x0BxD\bVb\bSq\x0Byu\twL\x0BXL\bTA\tpg\tAt\tnD\x04XX\twR\npl\nhw\x05yS\nps\tcO\bW[\x0B|j\x04XN\tsV\tp\\\tBe\nb~\nAJ\n]e\x05k`\x05qN\tdw\tWV\tHE\x0BEV\x05Jz\tid\tB`\tzh\x05E]\tfD\bTg\x05qN\bTa\tja\x04Cv\bSM\nhc\bUe\x05t_\tie\x04g]\twQ\nPn\bVB\tjw\bVg\x0BbE\tBZ\x0BRH\bP{\tjp\n\\}\ta_\tcC\t|a\x0BD]\tBZ\ti[\tfD\x0BxW\no_\td\\\n_D\ntb\t\\c\tAJ\nlK\x04oQ\x04lo\x0BLx\x0BM@\bWZ\x04Kn\x0Bpg\nTi\nIv\n|r\x0B@}\x05Jz\x05Lm\x05Wh\x05k}\x05ln\x0BxD\n]s\x04gc\x0Bps\tBr\bTW\x0BBM\x05tZ\nBY\x04DW\tjf\x0BSW\x04C}\nqo\tdE\tmv\tIQ\bPP\bUb\x05lv\x04BC\nzQ\t[I\x0Bgl\nig\bUs\x04BT\x0BbC\bSq\tsU\tiW\nJn\tSY\tHK\trg\npV\x0BID\x0B|j\x04KO\t`S\t|a`vbmglfmujbqnbgqjgavp`bqjmj`jlwjfnslslqrvf`vfmwbfpwbglsvfgfmivfdlp`lmwqbfpw/Mmmlnaqfwjfmfmsfqejonbmfqbbnjdlp`jvgbg`fmwqlbvmrvfsvfgfpgfmwqlsqjnfqsqf`jlpfd/Vmavfmlpuloufqsvmwlppfnbmbkba/Abbdlpwlmvfulpvmjglp`bqolpfrvjslmj/]lpnv`klpbodvmb`lqqfljnbdfmsbqwjqbqqjabnbq/Abklnaqffnsoflufqgbg`bnajlnv`kbpevfqlmsbpbglo/Amfbsbqf`fmvfubp`vqplpfpwbabrvjfqlojaqlp`vbmwlb``fplnjdvfoubqjlp`vbwqlwjfmfpdqvslppfq/Mmfvqlsbnfgjlpeqfmwfb`fq`bgfn/Mplefqwb`l`kfpnlgfoljwbojbofwqbpbod/Vm`lnsqb`vbofpf{jpwf`vfqslpjfmglsqfmpboofdbqujbifpgjmfqlnvq`jbslgq/Msvfpwlgjbqjlsvfaolrvjfqfnbmvfosqlsjl`qjpjp`jfqwlpfdvqlnvfqwfevfmwf`fqqbqdqbmgffef`wlsbqwfpnfgjgbsqlsjbleqf`fwjfqqbf.nbjoubqjbpelqnbpevwvqllaifwlpfdvjqqjfpdlmlqnbpnjpnlp/Vmj`l`bnjmlpjwjlpqby/_mgfajglsqvfabwlofglwfm/Abifp/Vpfpsfql`l`jmblqjdfmwjfmgb`jfmwl`/Mgjykbaobqpfq/Abobwjmbevfqybfpwjoldvfqqbfmwqbq/E{jwlo/_sfybdfmgbu/Agflfujwbqsbdjmbnfwqlpibujfqsbgqfpe/M`jo`bafyb/Mqfbppbojgbfmu/Alibs/_mbavplpajfmfpwf{wlpoofubqsvfgbmevfqwf`ln/Vm`obpfpkvnbmlwfmjglajoablvmjgbgfpw/Mpfgjwbq`qfbgl<X<W=c=k=n<R<V<\\<V<T<W<T=a=n<R<^=m<Y<Y<_<R<S=l<T=n<\\<V<Y=e<Y=o<Z<Y<v<\\<V<]<Y<[<]=g<W<R<Q<T<~=m<Y<S<R<X<A=n<R=n<R<P=k<Y<P<Q<Y=n<W<Y=n=l<\\<[<R<Q<\\<_<X<Y<P<Q<Y<x<W=c<s=l<T<Q<\\=m<Q<T=i=n<Y<P<V=n<R<_<R<X<^<R=n=n<\\<P<M<D<|<P<\\=c<K=n<R<^<\\=m<^<\\<P<Y<P=o<N<\\<V<X<^<\\<Q<\\<P=a=n<T=a=n=o<~<\\<P=n<Y=i<S=l<R=n=o=n<Q<\\<X<X<Q=c<~<R=n=n=l<T<Q<Y<U<~<\\=m<Q<T<P=m<\\<P=n<R=n=l=o<]<r<Q<T<P<T=l<Q<Y<Y<r<r<r<W<T=j=a=n<\\<r<Q<\\<Q<Y<P<X<R<P<P<R<U<X<^<Y<R<Q<R=m=o<X\fHy\fIk\fHU\fId\fHy\fIl\fHT\fIk\fHy\fHR\fHy\fIg\fHx\fH\\\fHF\fH\\\fHD\fIk\fHc\fHy\fHy\fHS\fHA\fIl\fHk\fHT\fHy\fH\\\fHH\fIg\fHU\fIg\fHj\fHF\fHU\fIl\fHC\fHU\fHC\fHR\fHH\fHy\fHI\fHRibdqbm\fHj\fHp\fHp\fIg\fHi\fH@\fHJ\fIg\fH{\fHd\fHp\fHR\fH{\fHc\fHU\fHB\fHk\fHD\fHY\fHU\fHC\fIk\fHI\fIk\fHI\fIl\fHt\fH\\\fHp\fH@\fHJ\fIl\fHy\fHd\fHp\fIl\fHY\fIk\fHD\fHd\fHD\fHc\fHU\fH\\\fHe\fHT\fHB\fIk\fHy\fHB\fHY\fIg\fH^\fIk\fHT\fH@\fHB\fHd\fHJ\fIk\fH\x7F\fH\\\fHj\fHB\fH@\fHT\fHA\fH\\\fH@\fHD\fHv\fH^\fHB\fHD\fHj\fH{\fHT\fIl\fH^\fIl4U5h5e4I5h5e5k4\\4K4N4B4]4U4C4C4K5h5e5k4\\5k4Y5d4]4V5f4]5o4K5j5d5h4K4D5f5j4U4]4Z4\\5h5o5k5j4K5f5d5i5n4K5h4U5h5f4K5j4K5h5o5j4A4F5e5n4D5h5d4A4E4K4B4]5m5n4[4U4D4C4]5o5j4I4\\4K5o5i4K4K4A4C4I5h4K5m5f5k4D4U4Z5o5f5m4D4A4G5d5i5j5d5k5d4O5j4K4@4C4K5h5k4K4_5h5i4U5j4C5h5f4_4U4D4]4Y5h5e5i5j4\\4D5k4K4O5j5k5i4G5h5o5j4F4K5h4K4A5f4G5i4Y4]4X4]4A4A5d5h5d5m5f4K4\\4K5h5o5h5i4]4E4K5j4F4K5h5m4O4D5d4B4K4Y4O5j4F4K5j5k4K5h5f4U4Z5d5d5n4C4K4D5j4B5f4]4D5j4F5h5o5i4X4K4M5d5k5f4K4D5d5n4Y4Y5d5i4K4]5n5i4O4A4C5j4A5j4U4C5i4]4O5f4K4A4E5o4F4D4C5d5j5f4@4D5i5j5k4F4A4F4@5k4E4_5j4E5f4F5i5o4]4E4V4^4E5j5m4_4D5f4F5h5h5k5h5j4K4F5h5o5n5h4D5h5i4K4U5j5k4O5d5h4X5f4M5j5d4]4O5i4K5m5f5o4D5o5h4\\4K4F4]4F4D4D4O5j5k5i4_4K5j5o4D5f4U5m5n4C4A4_5j5h5k5i4X4U4]4O5k5h4X5k4]5n4[4]4[5h4Dsqlejofpfquj`fgfebvowkjnpfoegfwbjop`lmwfmwpvsslqwpwbqwfgnfppbdfpv``fppebpkjlm?wjwof=`lvmwqzb``lvmw`qfbwfgpwlqjfpqfpvowpqvmmjmdsql`fpptqjwjmdlaif`wpujpjaoftfo`lnfbqwj`ofvmhmltmmfwtlqh`lnsbmzgzmbnj`aqltpfqsqjub`zsqlaofnPfquj`fqfpsf`wgjpsobzqfrvfpwqfpfquftfapjwfkjpwlqzeqjfmgplswjlmptlqhjmdufqpjlmnjoojlm`kbmmfotjmglt-bggqfppujpjwfgtfbwkfq`lqqf`wsqlgv`wfgjqf`welqtbqgzlv#`bmqfnlufgpvaif`w`lmwqlobq`kjuf`vqqfmwqfbgjmdojaqbqzojnjwfgnbmbdfqevqwkfqpvnnbqznb`kjmfnjmvwfpsqjubwf`lmwf{wsqldqbnpl`jfwzmvnafqptqjwwfmfmbaofgwqjddfqplvq`fpolbgjmdfofnfmwsbqwmfqejmboozsfqef`wnfbmjmdpzpwfnphffsjmd`vowvqf%rvlw8/ilvqmbosqlif`wpvqeb`fp%rvlw8f{sjqfpqfujftpabobm`fFmdojpk@lmwfmwwkqlvdkSofbpf#lsjmjlm`lmwb`wbufqbdfsqjnbqzujoobdfPsbmjpkdboofqzgf`ojmfnffwjmdnjppjlmslsvobqrvbojwznfbpvqfdfmfqbopsf`jfppfppjlmpf`wjlmtqjwfqp`lvmwfqjmjwjboqfslqwpejdvqfpnfnafqpklogjmdgjpsvwffbqojfqf{sqfppgjdjwbosj`wvqfBmlwkfqnbqqjfgwqbeej`ofbgjmd`kbmdfg`fmwqbouj`wlqzjnbdfp,qfbplmppwvgjfpefbwvqfojpwjmdnvpw#afp`kllopUfqpjlmvpvboozfsjplgfsobzjmddqltjmdlaujlvplufqobzsqfpfmwb`wjlmp?,vo=\x0E\ttqbssfqboqfbgz`fqwbjmqfbojwzpwlqbdfbmlwkfqgfphwlsleefqfgsbwwfqmvmvpvboGjdjwbo`bsjwboTfapjwfebjovqf`lmmf`wqfgv`fgBmgqljggf`bgfpqfdvobq#%bns8#bmjnbopqfofbpfBvwlnbwdfwwjmdnfwklgpmlwkjmdSlsvobq`bswjlmofwwfqp`bswvqfp`jfm`foj`fmpf`kbmdfpFmdobmg>2%bns8Kjpwlqz#>#mft#@fmwqbovsgbwfgPsf`jboMfwtlqhqfrvjqf`lnnfmwtbqmjmd@loofdfwlloabqqfnbjmpaf`bvpffof`wfgGfvwp`kejmbm`ftlqhfqprvj`hozafwtffmf{b`wozpfwwjmdgjpfbpfPl`jfwztfbslmpf{kjajw%ow8\"..@lmwqlo`obppfp`lufqfglvwojmfbwwb`hpgfuj`fp+tjmgltsvqslpfwjwof>!Nlajof#hjoojmdpkltjmdJwbojbmgqlssfgkfbujozfeef`wp.2$^*8\t`lmejqn@vqqfmwbgubm`fpkbqjmdlsfmjmdgqbtjmdajoojlmlqgfqfgDfqnbmzqfobwfg?,elqn=jm`ovgftkfwkfqgfejmfgP`jfm`f`bwboldBqwj`ofavwwlmpobqdfpwvmjelqnilvqmfzpjgfabq@kj`bdlklojgbzDfmfqbosbppbdf/%rvlw8bmjnbwfeffojmdbqqjufgsbppjmdmbwvqboqlvdkoz-\t\tWkf#avw#mlwgfmpjwzAqjwbjm@kjmfpfob`h#lewqjavwfJqfobmg!#gbwb.eb`wlqpqf`fjufwkbw#jpOjaqbqzkvpabmgjm#eb`wbeebjqp@kbqofpqbgj`boaqlvdkwejmgjmdobmgjmd9obmd>!qfwvqm#ofbgfqpsobmmfgsqfnjvnsb`hbdfBnfqj`bFgjwjlm^%rvlw8Nfppbdfmffg#wlubovf>!`lnsof{ollhjmdpwbwjlmafojfufpnboofq.nlajofqf`lqgptbmw#wlhjmg#leEjqfel{zlv#bqfpjnjobqpwvgjfgnb{jnvnkfbgjmdqbsjgoz`ojnbwfhjmdglnfnfqdfgbnlvmwpelvmgfgsjlmffqelqnvobgzmbpwzklt#wl#Pvsslqwqfufmvff`lmlnzQfpvowpaqlwkfqplogjfqobqdfoz`boojmd-%rvlw8B``lvmwFgtbqg#pfdnfmwQlafqw#feelqwpSb`jej`ofbqmfgvs#tjwkkfjdkw9tf#kbufBmdfofpmbwjlmp\\pfbq`kbssojfgb`rvjqfnbppjufdqbmwfg9#ebopfwqfbwfgajddfpwafmfejwgqjujmdPwvgjfpnjmjnvnsfqkbspnlqmjmdpfoojmdjp#vpfgqfufqpfubqjbmw#qlof>!njppjmdb`kjfufsqlnlwfpwvgfmwplnflmff{wqfnfqfpwlqfalwwln9fuloufgboo#wkfpjwfnbsfmdojpktbz#wl##Bvdvpwpznalop@lnsbmznbwwfqpnvpj`bobdbjmpwpfqujmd~*+*8\x0E\tsbznfmwwqlvaof`lm`fsw`lnsbqfsbqfmwpsobzfqpqfdjlmpnlmjwlq#$$Wkf#tjmmjmdf{solqfbgbswfgDboofqzsqlgv`fbajojwzfmkbm`f`bqffqp*-#Wkf#`loof`wPfbq`k#bm`jfmwf{jpwfgellwfq#kbmgofqsqjmwfg`lmplofFbpwfqmf{slqwptjmgltp@kbmmfojoofdbomfvwqbopvddfpw\\kfbgfqpjdmjmd-kwno!=pfwwofgtfpwfqm`bvpjmd.tfahjw`objnfgIvpwj`f`kbswfquj`wjnpWklnbp#nlyjoobsqlnjpfsbqwjfpfgjwjlmlvwpjgf9ebopf/kvmgqfgLoznsj`\\avwwlmbvwklqpqfb`kfg`kqlmj`gfnbmgppf`lmgpsqlwf`wbglswfgsqfsbqfmfjwkfqdqfbwozdqfbwfqlufqboojnsqluf`lnnbmgpsf`jbopfbq`k-tlqpkjsevmgjmdwklvdkwkjdkfpwjmpwfbgvwjojwzrvbqwfq@vowvqfwfpwjmd`ofbqozf{slpfgAqltpfqojafqbo~#`bw`kSqlif`wf{bnsofkjgf+*8EolqjgbbmptfqpbooltfgFnsfqlqgfefmpfpfqjlvpeqffglnPfufqbo.avwwlmEvqwkfqlvw#le#\">#mvoowqbjmfgGfmnbqhuljg+3*,boo-ipsqfufmwQfrvfpwPwfskfm\t\tTkfm#lapfquf?,k1=\x0E\tNlgfqm#sqlujgf!#bow>!alqgfqp-\t\tElq#\t\tNbmz#bqwjpwpsltfqfgsfqelqnej`wjlmwzsf#lenfgj`bowj`hfwplsslpfg@lvm`jotjwmfppivpwj`fDflqdf#Afodjvn---?,b=wtjwwfqmlwbaoztbjwjmdtbqebqf#Lwkfq#qbmhjmdskqbpfpnfmwjlmpvqujufp`klobq?,s=\x0E\t#@lvmwqzjdmlqfgolpp#leivpw#bpDflqdjbpwqbmdf?kfbg=?pwlssfg2$^*8\x0E\tjpobmgpmlwbaofalqgfq9ojpw#le`bqqjfg233/333?,k0=\t#pfufqboaf`lnfppfof`w#tfggjmd33-kwnonlmbq`klee#wkfwfb`kfqkjdkoz#ajloldzojef#lelq#fufmqjpf#le%qbrvl8sovplmfkvmwjmd+wklvdkGlvdobpiljmjmd`jq`ofpElq#wkfBm`jfmwUjfwmbnufkj`ofpv`k#bp`qzpwboubovf#>Tjmgltpfmilzfgb#pnboobppvnfg?b#jg>!elqfjdm#Boo#qjklt#wkfGjpsobzqfwjqfgkltfufqkjggfm8abwwofppffhjmd`bajmfwtbp#mlwollh#bw`lmgv`wdfw#wkfIbmvbqzkbssfmpwvqmjmdb9klufqLmojmf#Eqfm`k#ob`hjmdwzsj`bof{wqb`wfmfnjfpfufm#jedfmfqbwgf`jgfgbqf#mlw,pfbq`kafojfep.jnbdf9ol`bwfgpwbwj`-oldjm!=`lmufqwujlofmwfmwfqfgejqpw!=`jq`vjwEjmobmg`kfnjpwpkf#tbp23s{8!=bp#pv`kgjujgfg?,psbm=tjoo#afojmf#leb#dqfbwnzpwfqz,jmgf{-eboojmdgvf#wl#qbjotbz`loofdfnlmpwfqgfp`fmwjw#tjwkmv`ofbqIftjpk#sqlwfpwAqjwjpkeoltfqpsqfgj`wqfelqnpavwwlm#tkl#tbpof`wvqfjmpwbmwpvj`jgfdfmfqj`sfqjlgpnbqhfwpPl`jbo#ejpkjmd`lnajmfdqbskj`tjmmfqp?aq#,=?az#wkf#MbwvqboSqjub`z`llhjfplvw`lnfqfploufPtfgjpkaqjfeozSfqpjbmpl#nv`k@fmwvqzgfsj`wp`lovnmpklvpjmdp`qjswpmf{w#wlafbqjmdnbssjmdqfujpfgiRvfqz+.tjgwk9wjwof!=wllowjsPf`wjlmgfpjdmpWvqhjpkzlvmdfq-nbw`k+~*+*8\t\tavqmjmdlsfqbwfgfdqffpplvq`f>Qj`kbqg`olpfozsobpwj`fmwqjfp?,wq=\x0E\t`lolq9 vo#jg>!slppfppqloojmdskzpj`pebjojmdf{f`vwf`lmwfpwojmh#wlGfebvow?aq#,=\t9#wqvf/`kbqwfqwlvqjpn`obppj`sql`ffgf{sobjm?,k2=\x0E\tlmojmf-<{no#ufkfosjmdgjbnlmgvpf#wkfbjqojmffmg#..=*-bwwq+qfbgfqpklpwjmd eeeeeeqfbojyfUjm`fmwpjdmbop#pq`>!,Sqlgv`wgfpsjwfgjufqpfwfoojmdSvaoj`#kfog#jmIlpfsk#wkfbwqfbeef`wp?pwzof=b#obqdfglfpm$wobwfq/#Fofnfmwebuj`lm`qfbwlqKvmdbqzBjqslqwpff#wkfpl#wkbwNj`kbfoPzpwfnpSqldqbnp/#bmg##tjgwk>f%rvlw8wqbgjmdofew!=\tsfqplmpDlogfm#Beebjqpdqbnnbqelqnjmdgfpwqlzjgfb#le`bpf#lelogfpw#wkjp#jp-pq`#>#`bqwllmqfdjpwq@lnnlmpNvpojnpTkbw#jpjm#nbmznbqhjmdqfufbopJmgffg/frvbooz,pklt\\blvwgllqfp`bsf+Bvpwqjbdfmfwj`pzpwfn/Jm#wkf#pjwwjmdKf#boplJpobmgpB`bgfnz\t\n\n?\"..Gbmjfo#ajmgjmdaol`h!=jnslpfgvwjojyfBaqbkbn+f{`fswxtjgwk9svwwjmd*-kwno+\x7F\x7F#X^8\tGBWBX#)hjw`kfmnlvmwfgb`wvbo#gjbof`wnbjmoz#\\aobmh$jmpwboof{sfqwpje+wzsfJw#bopl%`lsz8#!=Wfqnpalqm#jmLswjlmpfbpwfqmwbohjmd`lm`fqmdbjmfg#lmdljmdivpwjez`qjwj`peb`wlqzjwp#ltmbppbvowjmujwfgobpwjmdkjp#ltmkqfe>!,!#qfo>!gfufols`lm`fqwgjbdqbngloobqp`ovpwfqsks<jg>bo`lklo*8~*+*8vpjmd#b=?psbm=ufppfopqfujuboBggqfppbnbwfvqbmgqljgboofdfgjoomfpptbohjmd`fmwfqprvbojeznbw`kfpvmjejfgf{wjm`wGfefmpfgjfg#jm\t\n?\"..#`vpwlnpojmhjmdOjwwof#Allh#lefufmjmdnjm-ip<bqf#wkfhlmwbhwwlgbz$p-kwno!#wbqdfw>tfbqjmdBoo#Qjd8\t~*+*8qbjpjmd#Bopl/#`qv`jbobalvw!=gf`obqf..=\t?p`ejqfel{bp#nv`kbssojfpjmgf{/#p/#avw#wzsf#>#\t\x0E\t?\"..wltbqgpQf`lqgpSqjubwfElqfjdmSqfnjfq`klj`fpUjqwvboqfwvqmp@lnnfmwSltfqfgjmojmf8slufqwz`kbnafqOjujmd#ulovnfpBmwklmzoldjm!#QfobwfgF`lmlnzqfb`kfp`vwwjmddqbujwzojef#[email protected]?,wg=\x0E\t#qfwvqmpwbgjvntjgdfwpubqzjmdwqbufopkfog#aztkl#bqftlqh#jmeb`vowzbmdvobqtkl#kbgbjqslqwwltm#le\t\tPlnf#$`oj`h$`kbqdfphfztlqgjw#tjoo`jwz#le+wkjp*8Bmgqft#vmjrvf#`kf`hfglq#nlqf033s{8#qfwvqm8qpjlm>!sovdjmptjwkjm#kfqpfoePwbwjlmEfgfqboufmwvqfsvaojpkpfmw#wlwfmpjlmb`wqfpp`lnf#wlejmdfqpGvhf#lesflsof/f{soljwtkbw#jpkbqnlmzb#nbilq!9!kwwsjm#kjp#nfmv!=\tnlmwkozleej`fq`lvm`jodbjmjmdfufm#jmPvnnbqzgbwf#leolzbowzejwmfppbmg#tbpfnsfqlqpvsqfnfPf`lmg#kfbqjmdQvppjbmolmdfpwBoafqwbobwfqbopfw#le#pnboo!=-bssfmggl#tjwkefgfqboabmh#leafmfbwkGfpsjwf@bsjwbodqlvmgp*/#bmg#sfq`fmwjw#eqln`olpjmd`lmwbjmJmpwfbgejewffmbp#tfoo-zbkll-qfpslmgejdkwfqlap`vqfqfeof`wlqdbmj`>#Nbwk-fgjwjmdlmojmf#sbggjmdb#tkloflmfqqlqzfbq#lefmg#le#abqqjfqtkfm#jwkfbgfq#klnf#leqfpvnfgqfmbnfgpwqlmd=kfbwjmdqfwbjmp`olvgeqtbz#le#Nbq`k#2hmltjmdjm#sbqwAfwtffmofpplmp`olpfpwujqwvboojmhp!=`qlppfgFMG#..=ebnlvp#btbqgfgOj`fmpfKfbowk#ebjqoz#tfbowkznjmjnboBeqj`bm`lnsfwfobafo!=pjmdjmdebqnfqpAqbpjo*gjp`vppqfsob`fDqfdlqzelmw#`lsvqpvfgbssfbqpnbhf#vsqlvmgfgalwk#leaol`hfgpbt#wkfleej`fp`lolvqpje+gl`vtkfm#kffmelq`fsvpk+evBvdvpw#VWE.;!=Ebmwbpzjm#nlpwjmivqfgVpvboozebqnjmd`olpvqflaif`w#gfefm`fvpf#le#Nfgj`bo?algz=\tfujgfmwaf#vpfghfz@lgfpj{wffmJpobnj` 333333fmwjqf#tjgfoz#b`wjuf#+wzsflelmf#`bm`lolq#>psfbhfqf{wfmgpSkzpj`pwfqqbjm?walgz=evmfqboujftjmdnjggof#`qj`hfwsqlskfwpkjewfggl`wlqpQvppfoo#wbqdfw`lnsb`wbodfaqbpl`jbo.avoh#lenbm#bmg?,wg=\t#kf#ofew*-ubo+*ebopf*8oldj`boabmhjmdklnf#wlmbnjmd#Bqjylmb`qfgjwp*8\t~*8\telvmgfqjm#wvqm@loojmpafelqf#Avw#wkf`kbqdfgWjwof!=@bswbjmpsfoofgdlggfppWbd#..=Bggjmd9avw#tbpQf`fmw#sbwjfmwab`h#jm>ebopf%Ojm`lomtf#hmlt@lvmwfqIvgbjpnp`qjsw#bowfqfg$^*8\t##kbp#wkfvm`ofbqFufmw$/alwk#jmmlw#boo\t\t?\"..#sob`jmdkbqg#wl#`fmwfqplqw#le`ojfmwppwqffwpAfqmbqgbppfqwpwfmg#wlebmwbpzgltm#jmkbqalvqEqffglniftfoqz,balvw--pfbq`kofdfmgpjp#nbgfnlgfqm#lmoz#lmlmoz#wljnbdf!#ojmfbq#sbjmwfqbmg#mlwqbqfoz#b`qlmzngfojufqpklqwfq33%bns8bp#nbmztjgwk>!,)#?\"X@wjwof#>le#wkf#oltfpw#sj`hfg#fp`bsfgvpfp#lesflsofp#Svaoj`Nbwwkftwb`wj`pgbnbdfgtbz#elqobtp#lefbpz#wl#tjmgltpwqlmd##pjnsof~`bw`k+pfufmwkjmelal{tfmw#wlsbjmwfg`jwjyfmJ#glm$wqfwqfbw-#Plnf#tt-!*8\talnajmdnbjowl9nbgf#jm-#Nbmz#`bqqjfp\x7F\x7Fx~8tjtlqh#lepzmlmzngfefbwpebulqfglswj`bosbdfWqbvmofpp#pfmgjmdofew!=?`lnP`lqBoo#wkfiRvfqz-wlvqjpw@obppj`ebopf!#Tjokfonpvavqapdfmvjmfajpklsp-psojw+dolabo#elooltpalgz#lemlnjmbo@lmwb`wpf`vobqofew#wl`kjfeoz.kjggfm.abmmfq?,oj=\t\t-#Tkfm#jm#alwkgjpnjppF{solqfbotbzp#ujb#wkfpsb/]lotfoebqfqvojmd#bqqbmdf`bswbjmkjp#plmqvof#lekf#wllhjwpfoe/>3%bns8+`boofgpbnsofpwl#nbhf`ln,sbdNbqwjm#Hfmmfgzb``fswpevoo#lekbmgofgAfpjgfp,,..=?,baof#wlwbqdfwpfppfm`fkjn#wl#jwp#az#`lnnlm-njmfqbowl#wbhftbzp#wlp-lqd,obgujpfgsfmbowzpjnsof9je#wkfzOfwwfqpb#pklqwKfqafqwpwqjhfp#dqlvsp-ofmdwkeojdkwplufqobspoltoz#ofppfq#pl`jbo#?,s=\t\n\njw#jmwlqbmhfg#qbwf#levo=\x0E\t##bwwfnswsbjq#lenbhf#jwHlmwbhwBmwlmjlkbujmd#qbwjmdp#b`wjufpwqfbnpwqbssfg!*-`pp+klpwjofofbg#wlojwwof#dqlvsp/Sj`wvqf..=\x0E\t\x0E\t#qltp>!#laif`wjmufqpf?ellwfq@vpwlnU=?_,p`qploujmd@kbnafqpobufqztlvmgfgtkfqfbp\">#$vmgelq#boosbqwoz#.qjdkw9Bqbajbmab`hfg#`fmwvqzvmjw#lenlajof.Fvqlsf/jp#klnfqjph#legfpjqfg@ojmwlm`lpw#lebdf#le#af`lnf#mlmf#les%rvlw8Njggof#fbg$*X3@qjwj`ppwvgjlp=%`lsz8dqlvs!=bppfnaonbhjmd#sqfppfgtjgdfw-sp9!#<#qfavjowaz#plnfElqnfq#fgjwlqpgfobzfg@bmlmj`kbg#wkfsvpkjmd`obpp>!avw#bqfsbqwjboAbazolmalwwln#`bqqjfq@lnnbmgjwp#vpfBp#tjwk`lvqpfpb#wkjqggfmlwfpbopl#jmKlvpwlm13s{8!=b``vpfgglvaof#dlbo#leEbnlvp#*-ajmg+sqjfpwp#Lmojmfjm#Ivozpw#(#!d`lmpvowgf`jnbokfosevoqfujufgjp#ufqzq$($jswolpjmd#efnbofpjp#boplpwqjmdpgbzp#lebqqjuboevwvqf#?laif`welq`jmdPwqjmd+!#,=\t\n\nkfqf#jpfm`lgfg-##Wkf#aboollmglmf#az,`lnnlmad`lolqobt#le#Jmgjbmbbuljgfgavw#wkf1s{#0s{irvfqz-bewfq#bsloj`z-nfm#bmgellwfq.>#wqvf8elq#vpfp`qffm-Jmgjbm#jnbdf#>ebnjoz/kwws9,,#%maps8gqjufqpfwfqmbopbnf#bpmlwj`fgujftfqp~*+*8\t#jp#nlqfpfbplmpelqnfq#wkf#mftjp#ivpw`lmpfmw#Pfbq`ktbp#wkftkz#wkfpkjssfgaq=?aq=tjgwk9#kfjdkw>nbgf#le`vjpjmfjp#wkbwb#ufqz#Bgnjqbo#ej{fg8mlqnbo#NjppjlmSqfpp/#lmwbqjl`kbqpfwwqz#wl#jmubgfg>!wqvf!psb`jmdjp#nlpwb#nlqf#wlwboozeboo#le~*8\x0E\t##jnnfmpfwjnf#jmpfw#lvwpbwjpezwl#ejmggltm#wlolw#le#Sobzfqpjm#Ivmfrvbmwvnmlw#wkfwjnf#wlgjpwbmwEjmmjpkpq`#>#+pjmdof#kfos#leDfqnbm#obt#bmgobafofgelqfpwp`llhjmdpsb`f!=kfbgfq.tfoo#bpPwbmofzaqjgdfp,dolabo@qlbwjb#Balvw#X3^8\t##jw/#bmgdqlvsfgafjmd#b*xwkqltkf#nbgfojdkwfqfwkj`boEEEEEE!alwwln!ojhf#b#fnsolzpojuf#jmbp#pffmsqjmwfqnlpw#leva.ojmhqfif`wpbmg#vpfjnbdf!=pv``ffgeffgjmdMv`ofbqjmelqnbwl#kfosTlnfm$pMfjwkfqNf{j`bmsqlwfjm?wbaof#az#nbmzkfbowkzobtpvjwgfujpfg-svpk+xpfoofqppjnsoz#Wkqlvdk-`llhjf#Jnbdf+logfq!=vp-ip!=#Pjm`f#vmjufqpobqdfq#lsfm#wl\"..#fmgojfp#jm$^*8\x0E\t##nbqhfwtkl#jp#+!GLN@lnbmbdfglmf#elqwzsfle#Hjmdglnsqlejwpsqlslpfwl#pklt`fmwfq8nbgf#jwgqfppfgtfqf#jmnj{wvqfsqf`jpfbqjpjmdpq`#>#$nbhf#b#pf`vqfgAbswjpwulwjmd#\t\n\nubq#Nbq`k#1dqft#vs@ojnbwf-qfnlufphjoofgtbz#wkf?,kfbg=eb`f#leb`wjmd#qjdkw!=wl#tlqhqfgv`fpkbp#kbgfqf`wfgpklt+*8b`wjlm>allh#lebm#bqfb>>#!kww?kfbgfq\t?kwno=`lmelqneb`jmd#`llhjf-qfoz#lmklpwfg#-`vpwlnkf#tfmwavw#elqpsqfbg#Ebnjoz#b#nfbmplvw#wkfelqvnp-ellwbdf!=Nlajo@ofnfmwp!#jg>!bp#kjdkjmwfmpf..=?\"..efnbof#jp#pffmjnsojfgpfw#wkfb#pwbwfbmg#kjpebpwfpwafpjgfpavwwlm\\alvmgfg!=?jnd#Jmelal{fufmwp/b#zlvmdbmg#bqfMbwjuf#`kfbsfqWjnflvwbmg#kbpfmdjmfptlm#wkf+nlpwozqjdkw9#ejmg#b#.alwwlnSqjm`f#bqfb#lenlqf#lepfbq`k\\mbwvqf/ofdboozsfqjlg/obmg#lelq#tjwkjmgv`fgsqlujmdnjppjofol`boozBdbjmpwwkf#tbzh%rvlw8s{8!=\x0E\tsvpkfg#babmglmmvnfqbo@fqwbjmJm#wkjpnlqf#jmlq#plnfmbnf#jpbmg/#jm`qltmfgJPAM#3.`qfbwfpL`wlafqnbz#mlw`fmwfq#obwf#jmGfefm`ffmb`wfgtjpk#wlaqlbgoz`llojmdlmolbg>jw-#Wkfqf`lufqNfnafqpkfjdkw#bppvnfp?kwno=\tsflsof-jm#lmf#>tjmgltellwfq\\b#dllg#qfhobnblwkfqp/wl#wkjp\\`llhjfsbmfo!=Olmglm/gfejmfp`qvpkfgabswjpn`lbpwbopwbwvp#wjwof!#nluf#wlolpw#jmafwwfq#jnsojfpqjuboqzpfqufqp#PzpwfnSfqkbspfp#bmg#`lmwfmgeoltjmdobpwfg#qjpf#jmDfmfpjpujft#leqjpjmd#pffn#wlavw#jm#ab`hjmdkf#tjoodjufm#bdjujmd#`jwjfp-eolt#le#Obwfq#boo#avwKjdktbzlmoz#azpjdm#lekf#glfpgjeefqpabwwfqz%bns8obpjmdofpwkqfbwpjmwfdfqwbhf#lmqfevpfg`boofg#>VP%bnsPff#wkfmbwjufpaz#wkjppzpwfn-kfbg#le9klufq/ofpajbmpvqmbnfbmg#boo`lnnlm,kfbgfq\\\\sbqbnpKbqubqg,sj{fo-qfnlubopl#olmdqlof#leiljmwozphzp`qbVmj`lgfaq#,=\x0E\tBwobmwbmv`ofvp@lvmwz/svqfoz#`lvmw!=fbpjoz#avjog#blm`oj`hb#djufmsljmwfqk%rvlw8fufmwp#fopf#x\tgjwjlmpmlt#wkf/#tjwk#nbm#tkllqd,Tfalmf#bmg`buboqzKf#gjfgpfbwwof33/333#xtjmgltkbuf#wlje+tjmgbmg#jwpplofoz#n%rvlw8qfmftfgGfwqljwbnlmdpwfjwkfq#wkfn#jmPfmbwlqVp?,b=?Hjmd#leEqbm`jp.sqlgv`kf#vpfgbqw#bmgkjn#bmgvpfg#azp`lqjmdbw#klnfwl#kbufqfobwfpjajojwzeb`wjlmAveebolojmh!=?tkbw#kfeqff#wl@jwz#le`lnf#jmpf`wlqp`lvmwfglmf#gbzmfqulvpprvbqf#~8je+dljm#tkbwjnd!#bojp#lmozpfbq`k,wvfpgbzollpfozPlolnlmpf{vbo#.#?b#kqnfgjvn!GL#MLW#Eqbm`f/tjwk#b#tbq#bmgpf`lmg#wbhf#b#=\x0E\t\x0E\t\x0E\tnbqhfw-kjdktbzglmf#jm`wjujwz!obpw!=laojdfgqjpf#wl!vmgfejnbgf#wl#Fbqoz#sqbjpfgjm#jwp#elq#kjpbwkofwfIvsjwfqZbkll\"#wfqnfg#pl#nbmzqfbooz#p-#Wkf#b#tlnbm<ubovf>gjqf`w#qjdkw!#aj`z`ofb`jmd>!gbz#bmgpwbwjmdQbwkfq/kjdkfq#Leej`f#bqf#mltwjnfp/#tkfm#b#sbz#elqlm#wkjp.ojmh!=8alqgfqbqlvmg#bmmvbo#wkf#Mftsvw#wkf-`ln!#wbhjm#wlb#aqjfe+jm#wkfdqlvsp-8#tjgwkfmyznfppjnsof#jm#obwfxqfwvqmwkfqbszb#sljmwabmmjmdjmhp!=\t+*8!#qfb#sob`f_v330@bbalvw#bwq=\x0E\t\n\n``lvmw#djufp#b?P@QJSWQbjotbzwkfnfp,wlloal{AzJg+!{kvnbmp/tbw`kfpjm#plnf#je#+tj`lnjmd#elqnbwp#Vmgfq#avw#kbpkbmgfg#nbgf#azwkbm#jmefbq#legfmlwfg,jeqbnfofew#jmulowbdfjm#fb`kb%rvlw8abpf#leJm#nbmzvmgfqdlqfdjnfpb`wjlm#?,s=\x0E\t?vpwlnUb8%dw8?,jnslqwplq#wkbwnlpwoz#%bns8qf#pjyf>!?,b=?,kb#`obppsbppjufKlpw#>#TkfwkfqefqwjofUbqjlvp>X^8+ev`bnfqbp,=?,wg=b`wp#bpJm#plnf=\x0E\t\x0E\t?\"lqdbmjp#?aq#,=Afjijmd`bwbo/Lgfvwp`kfvqlsfvfvphbqbdbfjodfpufmphbfpsb/]bnfmpbifvpvbqjlwqbabiln/E{j`ls/Mdjmbpjfnsqfpjpwfnbl`wvaqfgvqbmwfb/]bgjqfnsqfpbnlnfmwlmvfpwqlsqjnfqbwqbu/Epdqb`jbpmvfpwqbsql`fplfpwbglp`bojgbgsfqplmbm/Vnfqlb`vfqgln/Vpj`bnjfnaqllefqwbpbodvmlpsb/Apfpfifnsolgfqf`klbgfn/Mpsqjubglbdqfdbqfmob`fpslpjaofklwfofppfujoobsqjnfql/Vowjnlfufmwlpbq`kjul`vowvqbnvifqfpfmwqbgbbmvm`jlfnabqdlnfq`bgldqbmgfpfpwvgjlnfilqfpefaqfqlgjpf/]lwvqjpnl`/_gjdlslqwbgbfpsb`jlebnjojbbmwlmjlsfqnjwfdvbqgbqbodvmbpsqf`jlpbodvjfmpfmwjglujpjwbpw/Awvol`lml`fqpfdvmgl`lmpfileqbm`jbnjmvwlppfdvmgbwfmfnlpfef`wlpn/Mobdbpfpj/_mqfujpwbdqbmbgb`lnsqbqjmdqfpldbq`/Abb``j/_mf`vbglqrvjfmfpjm`ovplgfafq/Mnbwfqjbklnaqfpnvfpwqbslgq/Abnb/]bmb/Vowjnbfpwbnlplej`jbowbnajfmmjmd/Vmpbovglpslgfnlpnfilqbqslpjwjlmavpjmfppklnfsbdfpf`vqjwzobmdvbdfpwbmgbqg`bnsbjdmefbwvqfp`bwfdlqzf{wfqmbo`kjogqfmqfpfqufgqfpfbq`kf{`kbmdfebulqjwfwfnsobwfnjojwbqzjmgvpwqzpfquj`fpnbwfqjbosqlgv`wpy.jmgf{9`lnnfmwpplewtbqf`lnsofwf`bofmgbqsobwelqnbqwj`ofpqfrvjqfgnlufnfmwrvfpwjlmavjogjmdslojwj`pslppjaofqfojdjlmskzpj`boeffgab`hqfdjpwfqsj`wvqfpgjpbaofgsqlwl`lobvgjfm`fpfwwjmdpb`wjujwzfofnfmwpofbqmjmdbmzwkjmdbapwqb`wsqldqfpplufqujftnbdbyjmff`lmlnj`wqbjmjmdsqfppvqfubqjlvp#?pwqlmd=sqlsfqwzpklssjmdwldfwkfqbgubm`fgafkbujlqgltmolbgefbwvqfgellwaboopfof`wfgObmdvbdfgjpwbm`fqfnfnafqwqb`hjmdsbpptlqgnlgjejfgpwvgfmwpgjqf`wozejdkwjmdmlqwkfqmgbwbabpfefpwjuboaqfbhjmdol`bwjlmjmwfqmfwgqlsgltmsqb`wj`ffujgfm`fevm`wjlmnbqqjbdfqfpslmpfsqlaofnpmfdbwjufsqldqbnpbmbozpjpqfofbpfgabmmfq!=svq`kbpfsloj`jfpqfdjlmbo`qfbwjufbqdvnfmwallhnbqhqfefqqfq`kfnj`bogjujpjlm`booab`hpfsbqbwfsqlif`wp`lmeoj`wkbqgtbqfjmwfqfpwgfojufqznlvmwbjmlawbjmfg>#ebopf8elq+ubq#b``fswfg`bsb`jwz`lnsvwfqjgfmwjwzbjq`qbewfnsolzfgsqlslpfgglnfpwj`jm`ovgfpsqlujgfgklpsjwboufqwj`bo`loobspfbssqlb`ksbqwmfqpoldl!=?bgbvdkwfqbvwklq!#`vowvqboebnjojfp,jnbdfp,bppfnaozsltfqevowfb`kjmdejmjpkfggjpwqj`w`qjwj`bo`dj.ajm,svqslpfpqfrvjqfpfof`wjlmaf`lnjmdsqlujgfpb`bgfnj`f{fq`jpfb`wvbooznfgj`jmf`lmpwbmwb``jgfmwNbdbyjmfgl`vnfmwpwbqwjmdalwwln!=lapfqufg9#%rvlw8f{wfmgfgsqfujlvpPlewtbqf`vpwlnfqgf`jpjlmpwqfmdwkgfwbjofgpojdkwozsobmmjmdwf{wbqfb`vqqfm`zfufqzlmfpwqbjdkwwqbmpefqslpjwjufsqlgv`fgkfqjwbdfpkjssjmdbaplovwfqf`fjufgqfofubmwavwwlm!#ujlofm`fbmztkfqfafmfejwpobvm`kfgqf`fmwozboojbm`felooltfgnvowjsofavoofwjmjm`ovgfgl``vqqfgjmwfqmbo'+wkjp*-qfsvaoj`=?wq=?wg`lmdqfppqf`lqgfgvowjnbwfplovwjlm?vo#jg>!gjp`lufqKlnf?,b=tfapjwfpmfwtlqhpbowklvdkfmwjqfoznfnlqjbonfppbdfp`lmwjmvfb`wjuf!=plnftkbwuj`wlqjbTfpwfqm##wjwof>!Ol`bwjlm`lmwqb`wujpjwlqpGltmolbgtjwklvw#qjdkw!=\tnfbpvqfptjgwk#>#ubqjbaofjmuloufgujqdjmjbmlqnboozkbssfmfgb``lvmwppwbmgjmdmbwjlmboQfdjpwfqsqfsbqfg`lmwqlopb``vqbwfajqwkgbzpwqbwfdzleej`jbodqbskj`p`qjnjmboslppjaoz`lmpvnfqSfqplmbopsfbhjmdubojgbwfb`kjfufg-isd!#,=nb`kjmfp?,k1=\t##hfztlqgpeqjfmgozaqlwkfqp`lnajmfglqjdjmbo`lnslpfgf{sf`wfgbgfrvbwfsbhjpwbmeloolt!#ubovbaof?,obafo=qfobwjufaqjmdjmdjm`qfbpfdlufqmlqsovdjmp,Ojpw#le#Kfbgfq!=!#mbnf>!#+%rvlw8dqbgvbwf?,kfbg=\t`lnnfq`fnbobzpjbgjqf`wlqnbjmwbjm8kfjdkw9p`kfgvof`kbmdjmdab`h#wl#`bwkloj`sbwwfqmp`lolq9# dqfbwfpwpvssojfpqfojbaof?,vo=\t\n\n?pfof`w#`jwjyfmp`olwkjmdtbw`kjmd?oj#jg>!psf`jej``bqqzjmdpfmwfm`f?`fmwfq=`lmwqbpwwkjmhjmd`bw`k+f*plvwkfqmNj`kbfo#nfq`kbmw`bqlvpfosbggjmd9jmwfqjlq-psojw+!ojybwjlmL`wlafq#*xqfwvqmjnsqlufg..%dw8\t\t`lufqbdf`kbjqnbm-smd!#,=pvaif`wpQj`kbqg#tkbwfufqsqlabaozqf`lufqzabpfabooivgdnfmw`lmmf`w--`pp!#,=#tfapjwfqfslqwfggfebvow!,=?,b=\x0E\tfof`wqj`p`lwobmg`qfbwjlmrvbmwjwz-#JPAM#3gjg#mlw#jmpwbm`f.pfbq`k.!#obmd>!psfbhfqp@lnsvwfq`lmwbjmpbq`kjufpnjmjpwfqqfb`wjlmgjp`lvmwJwbojbml`qjwfqjbpwqlmdoz9#$kwws9$p`qjsw$`lufqjmdleefqjmdbssfbqfgAqjwjpk#jgfmwjezEb`fallhmvnfqlvpufkj`ofp`lm`fqmpBnfqj`bmkbmgojmdgju#jg>!Tjoojbn#sqlujgfq\\`lmwfmwb``vqb`zpf`wjlm#bmgfqplmeof{jaof@bwfdlqzobtqfm`f?p`qjsw=obzlvw>!bssqlufg#nb{jnvnkfbgfq!=?,wbaof=Pfquj`fpkbnjowlm`vqqfmw#`bmbgjbm`kbmmfop,wkfnfp,,bqwj`oflswjlmboslqwvdboubovf>!!jmwfqubotjqfofppfmwjwofgbdfm`jfpPfbq`k!#nfbpvqfgwklvpbmgpsfmgjmd%kfoojs8mft#Gbwf!#pjyf>!sbdfMbnfnjggof!#!#,=?,b=kjggfm!=pfrvfm`fsfqplmbolufqeoltlsjmjlmpjoojmljpojmhp!=\t\n?wjwof=ufqpjlmppbwvqgbzwfqnjmbojwfnsqlsfmdjmffqpf`wjlmpgfpjdmfqsqlslpbo>!ebopf!Fpsb/]loqfofbpfppvanjw!#fq%rvlw8bggjwjlmpznswlnplqjfmwfgqfplvq`fqjdkw!=?sofbpvqfpwbwjlmpkjpwlqz-ofbujmd##alqgfq>`lmwfmwp`fmwfq!=-\t\tPlnf#gjqf`wfgpvjwbaofavodbqjb-pklt+*8gfpjdmfgDfmfqbo#`lm`fswpF{bnsofptjoojbnpLqjdjmbo!=?psbm=pfbq`k!=lsfqbwlqqfrvfpwpb#%rvlw8booltjmdGl`vnfmwqfujpjlm-#\t\tWkf#zlvqpfoe@lmwb`w#nj`kjdbmFmdojpk#`lovnajbsqjlqjwzsqjmwjmdgqjmhjmdeb`jojwzqfwvqmfg@lmwfmw#leej`fqpQvppjbm#dfmfqbwf.;;6:.2!jmgj`bwfebnjojbq#rvbojwznbqdjm93#`lmwfmwujftslqw`lmwb`wp.wjwof!=slqwbaof-ofmdwk#fojdjaofjmuloufpbwobmwj`lmolbg>!gfebvow-pvssojfgsbznfmwpdolppbqz\t\tBewfq#dvjgbm`f?,wg=?wgfm`lgjmdnjggof!=`bnf#wl#gjpsobzpp`lwwjpkilmbwkbmnbilqjwztjgdfwp-`ojmj`bowkbjobmgwfb`kfqp?kfbg=\t\nbeef`wfgpvsslqwpsljmwfq8wlPwqjmd?,pnboo=lhobklnbtjoo#af#jmufpwlq3!#bow>!klojgbzpQfplvq`foj`fmpfg#+tkj`k#-#Bewfq#`lmpjgfqujpjwjmdf{solqfqsqjnbqz#pfbq`k!#bmgqljg!rvj`hoz#nffwjmdpfpwjnbwf8qfwvqm#8`lolq9 #kfjdkw>bssqlubo/#%rvlw8#`kf`hfg-njm-ip!nbdmfwj`=?,b=?,kelqf`bpw-#Tkjof#wkvqpgbzgufqwjpf%fb`vwf8kbp@obppfubovbwflqgfqjmdf{jpwjmdsbwjfmwp#Lmojmf#`lolqbglLswjlmp!`bnsafoo?\"..#fmg?,psbm=??aq#,=\x0E\t\\slsvsp\x7Fp`jfm`fp/%rvlw8#rvbojwz#Tjmgltp#bppjdmfgkfjdkw9#?a#`obppof%rvlw8#ubovf>!#@lnsbmzf{bnsofp?jeqbnf#afojfufpsqfpfmwpnbqpkboosbqw#le#sqlsfqoz*-\t\tWkf#wb{lmlnznv`k#le#?,psbm=\t!#gbwb.pqwvdv/Fpp`qlooWl#sqlif`w?kfbg=\x0E\tbwwlqmfzfnskbpjppslmplqpebm`zal{tlqog$p#tjogojef`kf`hfg>pfppjlmpsqldqbnns{8elmw.#Sqlif`wilvqmbopafojfufgub`bwjlmwklnsplmojdkwjmdbmg#wkf#psf`jbo#alqgfq>3`kf`hjmd?,walgz=?avwwlm#@lnsofwf`ofbqej{\t?kfbg=\tbqwj`of#?pf`wjlmejmgjmdpqlof#jm#slsvobq##L`wlafqtfapjwf#f{slpvqfvpfg#wl##`kbmdfplsfqbwfg`oj`hjmdfmwfqjmd`lnnbmgpjmelqnfg#mvnafqp##?,gju=`qfbwjmdlmPvanjwnbqzobmg`loofdfpbmbozwj`ojpwjmdp`lmwb`w-olddfgJmbgujplqzpjaojmdp`lmwfmw!p%rvlw8*p-#Wkjp#sb`hbdfp`kf`hal{pvddfpwpsqfdmbmwwlnlqqltpsb`jmd>j`lm-smdibsbmfpf`lgfabpfavwwlm!=dbnaojmdpv`k#bp#/#tkjof#?,psbm=#njpplvqjpslqwjmdwls92s{#-?,psbm=wfmpjlmptjgwk>!1obyzolbgmlufnafqvpfg#jm#kfjdkw>!`qjsw!=\t%maps8?,?wq=?wg#kfjdkw91,sqlgv`w`lvmwqz#jm`ovgf#ellwfq!#%ow8\"..#wjwof!=?,irvfqz-?,elqn=\t+\x0BBl\bQ\x7F*+\x0BUm\x05Gx*kqubwphjjwbojbmlqln/Nm(ow/Pqh/Kf4K4]4C5dwbnaj/Emmlwj`jbpnfmpbifpsfqplmbpgfqf`klpmb`jlmbopfquj`jl`lmwb`wlvpvbqjlpsqldqbnbdlajfqmlfnsqfpbpbmvm`jlpubofm`jb`lolnajbgfpsv/Epgfslqwfpsqlzf`wlsqlgv`wls/Vaoj`lmlplwqlpkjpwlqjbsqfpfmwfnjoolmfpnfgjbmwfsqfdvmwbbmwfqjlqqf`vqplpsqlaofnbpbmwjbdlmvfpwqlplsjmj/_mjnsqjnjqnjfmwqbpbn/Eqj`bufmgfglqpl`jfgbgqfpsf`wlqfbojybqqfdjpwqlsbobaqbpjmwfq/Epfmwlm`fpfpsf`jbonjfnaqlpqfbojgbg`/_qglabybqbdlybs/Mdjmbppl`jbofpaolrvfbqdfpwj/_mborvjofqpjpwfnbp`jfm`jbp`lnsofwlufqpj/_m`lnsofwbfpwvgjlps/Vaoj`blaifwjulboj`bmwfavp`bglq`bmwjgbgfmwqbgbpb``jlmfpbq`kjulppvsfqjlqnbzlq/Abbofnbmjbevm`j/_m/Vowjnlpkb`jfmglbrvfoolpfgj`j/_mefqmbmglbnajfmwfeb`fallhmvfpwqbp`ojfmwfpsql`fplpabpwbmwfsqfpfmwbqfslqwbq`lmdqfplsvaoj`bq`lnfq`jl`lmwqbwli/_ufmfpgjpwqjwlw/E`mj`b`lmivmwlfmfqd/Abwqbabibqbpwvqjbpqf`jfmwfvwjojybqalofw/Ampboubglq`lqqf`wbwqbabilpsqjnfqlpmfdl`jlpojafqwbggfwboofpsbmwboobsq/_{jnlbonfq/Abbmjnbofprvj/Emfp`lqby/_mpf``j/_mavp`bmglls`jlmfpf{wfqjlq`lm`fswlwlgbu/Abdbofq/Abfp`qjajqnfgj`jmboj`fm`jb`lmpvowbbpsf`wlp`q/Awj`bg/_obqfpivpwj`jbgfafq/Mmsfq/Alglmf`fpjwbnbmwfmfqsfrvf/]lqf`jajgbwqjavmbowfmfqjef`bm`j/_m`bmbqjbpgfp`bqdbgjufqplpnboolq`bqfrvjfqfw/E`mj`lgfafq/Abujujfmgbejmbmybpbgfobmwfevm`jlmb`lmpfilpgje/A`jo`jvgbgfpbmwjdvbpbubmybgbw/Eqnjmlvmjgbgfpp/Mm`kfy`bnsb/]bplewlmj`qfujpwbp`lmwjfmfpf`wlqfpnlnfmwlpeb`vowbg`q/Egjwlgjufqpbppvsvfpwleb`wlqfppfdvmglpsfrvf/]b<_<R<X<\\<Y=m<W<T<Y=m=n=`<]=g<W<R<]=g=n=`=a=n<R<P<y=m<W<T=n<R<_<R<P<Y<Q=c<^=m<Y=i=a=n<R<U<X<\\<Z<Y<]=g<W<T<_<R<X=o<X<Y<Q=`=a=n<R=n<]=g<W<\\=m<Y<]=c<R<X<T<Q=m<Y<]<Y<Q<\\<X<R=m<\\<U=n=h<R=n<R<Q<Y<_<R=m<^<R<T=m<^<R<U<T<_=l=g=n<R<Z<Y<^=m<Y<P=m<^<R=b<W<T=d=`=a=n<T=i<S<R<V<\\<X<Q<Y<U<X<R<P<\\<P<T=l<\\<W<T<]<R=n<Y<P=o=i<R=n=c<X<^=o=i=m<Y=n<T<W=b<X<T<X<Y<W<R<P<T=l<Y=n<Y<]=c=m<^<R<Y<^<T<X<Y=k<Y<_<R=a=n<T<P=m=k<Y=n=n<Y<P=g=j<Y<Q=g=m=n<\\<W<^<Y<X=`=n<Y<P<Y<^<R<X=g=n<Y<]<Y<^=g=d<Y<Q<\\<P<T=n<T<S<\\=n<R<P=o<S=l<\\<^<W<T=j<\\<R<X<Q<\\<_<R<X=g<[<Q<\\=b<P<R<_=o<X=l=o<_<^=m<Y<U<T<X<Y=n<V<T<Q<R<R<X<Q<R<X<Y<W<\\<X<Y<W<Y=m=l<R<V<T=b<Q=c<^<Y=m=`<y=m=n=`=l<\\<[<\\<Q<\\=d<T4K5h5h5k4K5h4F5f4@5i5f4U4B4K4Y4E4K5h4\\5f4U5h5f5k4@4C5f4C4K5h4N5j4K5h4]4C4F4A5o5i4Y5m4A4E5o4K5j4F4K5h5h5f5f5o5d5j4X4D5o4E5m5f5k4K4D5j4K4F4A5d4K4M4O5o4G4]4B5h4K5h4K5h4A4D4C5h5f5h4C4]5d4_4K4Z4V4[4F5o5d5j5k5j4K5o4_4K4A4E5j4K4C5f4K5h4[4D4U5h5f5o4X5o4]4K5f5i5o5j5i5j5k4K4X4]5o4E4]4J5f4_5j4X5f4[5i4K4\\4K4K5h5m5j4X4D4K4D4F4U4D4]4]4A5i4E5o4K5m4E5f5n5d5h5i4]5o4^5o5h5i4E4O4A5i4C5n5h4D5f5f4U5j5f4Y5d4]4E4[4]5f5n4X4K4]5o4@5d4K5h4O4B4]5e5i4U5j4K4K4D4A4G4U4]5d4Z4D4X5o5h5i4_4@5h4D5j4K5j4B4K5h4C5o4F4K4D5o5h5f4E4D4C5d5j4O5f4Z4K5f5d4@4C5m4]5f5n5o4F4D4F4O5m4Z5h5i4[4D4B4K5o4G4]4D4K4]5o4K5m4Z5h4K4A5h5e5j5m4_5k4O5f4K5i4]4C5d4C4O5j5k4K4C5f5j4K4K5h4K5j5i4U4]4Z4F4U5h5i4C4K4B5h5i5i5o5j\x03\x03\x03\x03\x03\x03\x03\x03\x02\x03\x02\x03\x02\x03\x02\x03\x01\x03\x01\x03\x01\x03\x01\x03\x07\x03\x07\x03\x07\x03\x07\x03\x03\x02\x01\0\x07\x06\x05\x04\x04\x05\x06\x07\0\x01\x02\x03\x0B\n\t\b\x0F\x0E\r\f\f\r\x0E\x0F\b\t\n\x0B\x13\x12\x11\x10\x17\x16\x15\x14\x14\x15\x16\x17\x10\x11\x12\x13\x1B\x1A\x19\x18\x1F\x1E\x1D\x1C\x1C\x1D\x1E\x1F\x18\x19\x1A\x1B\x13\x13\x13\x13\x03\x03\x03\x03\x03\x03\x03\x03\x13\x13\x13\x13\x02\x03\x03\x03\x01\x03\x03\x03\x01\x03\x03\x03\x02\x03\x03\x03\x02\x03\x03\x03\0\x03\x03\x03\x13\x13\x03\x02\x03\x03\x03\x02\x03\x03\x13\x13\x03\x02\x03\x03\x03\x0B\x03\x0B\x03\x0B\x03\x0B\x03\x03\x03\x02\x03\x01\x03\0\x03\x07\x03\x06\x03\x05\x03\x04qfplvq`fp`lvmwqjfprvfpwjlmpfrvjsnfmw`lnnvmjwzbubjobaofkjdkojdkwGWG,{kwnonbqhfwjmdhmltofgdfplnfwkjmd`lmwbjmfqgjqf`wjlmpvap`qjafbgufqwjpf`kbqb`wfq!#ubovf>!?,pfof`w=Bvpwqbojb!#`obpp>!pjwvbwjlmbvwklqjwzelooltjmdsqjnbqjozlsfqbwjlm`kboofmdfgfufolsfgbmlmznlvpevm`wjlm#evm`wjlmp`lnsbmjfppwqv`wvqfbdqffnfmw!#wjwof>!slwfmwjbofgv`bwjlmbqdvnfmwppf`lmgbqz`lszqjdkwobmdvbdfpf{`ovpjuf`lmgjwjlm?,elqn=\x0E\tpwbwfnfmwbwwfmwjlmAjldqbskz~#fopf#x\tplovwjlmptkfm#wkf#Bmbozwj`pwfnsobwfpgbmdfqlvppbwfoojwfgl`vnfmwpsvaojpkfqjnslqwbmwsqlwlwzsfjmeovfm`f%qbrvl8?,feef`wjufdfmfqboozwqbmpelqnafbvwjevowqbmpslqwlqdbmjyfgsvaojpkfgsqlnjmfmwvmwjo#wkfwkvnambjoMbwjlmbo#-el`vp+*8lufq#wkf#njdqbwjlmbmmlvm`fgellwfq!=\tf{`fswjlmofpp#wkbmf{sfmpjufelqnbwjlmeqbnftlqhwfqqjwlqzmgj`bwjlm`vqqfmwoz`obppMbnf`qjwj`jpnwqbgjwjlmfopftkfqfBof{bmgfqbssljmwfgnbwfqjbopaqlbg`bpwnfmwjlmfgbeejojbwf?,lswjlm=wqfbwnfmwgjeefqfmw,gfebvow-Sqfpjgfmwlm`oj`h>!ajldqbskzlwkfqtjpfsfqnbmfmwEqbm/KbjpKlooztllgf{sbmpjlmpwbmgbqgp?,pwzof=\tqfgv`wjlmGf`fnafq#sqfefqqfg@bnaqjgdflsslmfmwpAvpjmfpp#`lmevpjlm=\t?wjwof=sqfpfmwfgf{sobjmfgglfp#mlw#tlqogtjgfjmwfqeb`fslpjwjlmpmftpsbsfq?,wbaof=\tnlvmwbjmpojhf#wkf#fppfmwjboejmbm`jbopfof`wjlmb`wjlm>!,babmglmfgFgv`bwjlmsbqpfJmw+pwbajojwzvmbaof#wl?,wjwof=\tqfobwjlmpMlwf#wkbwfeej`jfmwsfqelqnfgwtl#zfbqpPjm`f#wkfwkfqfelqftqbssfq!=bowfqmbwfjm`qfbpfgAbwwof#lesfq`fjufgwqzjmd#wlmf`fppbqzslqwqbzfgfof`wjlmpFojybafwk?,jeqbnf=gjp`lufqzjmpvqbm`fp-ofmdwk8ofdfmgbqzDfldqbskz`bmgjgbwf`lqslqbwfplnfwjnfppfquj`fp-jmkfqjwfg?,pwqlmd=@lnnvmjwzqfojdjlvpol`bwjlmp@lnnjwwffavjogjmdpwkf#tlqogml#olmdfqafdjmmjmdqfefqfm`f`bmmlw#afeqfrvfm`zwzsj`boozjmwl#wkf#qfobwjuf8qf`lqgjmdsqfpjgfmwjmjwjboozwf`kmjrvfwkf#lwkfqjw#`bm#aff{jpwfm`fvmgfqojmfwkjp#wjnfwfofsklmfjwfnp`lsfsqb`wj`fpbgubmwbdf*8qfwvqm#Elq#lwkfqsqlujgjmdgfnl`qb`zalwk#wkf#f{wfmpjufpveefqjmdpvsslqwfg`lnsvwfqp#evm`wjlmsqb`wj`bopbjg#wkbwjw#nbz#afFmdojpk?,eqln#wkf#p`kfgvofggltmolbgp?,obafo=\tpvpsf`wfgnbqdjm9#3psjqjwvbo?,kfbg=\t\tnj`qlplewdqbgvboozgjp`vppfgkf#af`bnff{f`vwjufirvfqz-ipklvpfklog`lmejqnfgsvq`kbpfgojwfqboozgfpwqlzfgvs#wl#wkfubqjbwjlmqfnbjmjmdjw#jp#mlw`fmwvqjfpIbsbmfpf#bnlmd#wkf`lnsofwfgbodlqjwknjmwfqfpwpqfafoojlmvmgfejmfgfm`lvqbdfqfpjybaofjmuloujmdpfmpjwjufvmjufqpbosqlujpjlm+bowklvdkefbwvqjmd`lmgv`wfg*/#tkj`k#`lmwjmvfg.kfbgfq!=Efaqvbqz#mvnfqlvp#lufqeolt9`lnslmfmweqbdnfmwpf{`foofmw`lopsbm>!wf`kmj`bomfbq#wkf#Bgubm`fg#plvq`f#lef{sqfppfgKlmd#Hlmd#Eb`fallhnvowjsof#nf`kbmjpnfofubwjlmleefmpjuf?,elqn=\t\npslmplqfggl`vnfmw-lq#%rvlw8wkfqf#bqfwklpf#tklnlufnfmwpsql`fppfpgjeej`vowpvanjwwfgqf`lnnfmg`lmujm`fgsqlnlwjmd!#tjgwk>!-qfsob`f+`obppj`bo`lbojwjlmkjp#ejqpwgf`jpjlmpbppjpwbmwjmgj`bwfgfulovwjlm.tqbssfq!fmlvdk#wlbolmd#wkfgfojufqfg..=\x0E\t?\"..Bnfqj`bm#sqlwf`wfgMlufnafq#?,pwzof=?evqmjwvqfJmwfqmfw##lmaovq>!pvpsfmgfgqf`jsjfmwabpfg#lm#Nlqflufq/balojpkfg`loof`wfgtfqf#nbgffnlwjlmbofnfqdfm`zmbqqbwjufbgul`bwfps{8alqgfq`lnnjwwfggjq>!owq!fnsolzffpqfpfbq`k-#pfof`wfgpv``fpplq`vpwlnfqpgjpsobzfgPfswfnafqbgg@obpp+Eb`fallh#pvddfpwfgbmg#obwfqlsfqbwjmdfobalqbwfPlnfwjnfpJmpwjwvwf`fqwbjmozjmpwboofgelooltfqpIfqvpbofnwkfz#kbuf`lnsvwjmddfmfqbwfgsqlujm`fpdvbqbmwffbqajwqbqzqf`ldmjyftbmwfg#wls{8tjgwk9wkflqz#leafkbujlvqTkjof#wkffpwjnbwfgafdbm#wl#jw#af`bnfnbdmjwvgfnvpw#kbufnlqf#wkbmGjqf`wlqzf{wfmpjlmpf`qfwbqzmbwvqboozl``vqqjmdubqjbaofpdjufm#wkfsobwelqn-?,obafo=?ebjofg#wl`lnslvmgphjmgp#le#pl`jfwjfpbolmdpjgf#..%dw8\t\tplvwktfpwwkf#qjdkwqbgjbwjlmnbz#kbuf#vmfp`bsf+pslhfm#jm!#kqfe>!,sqldqbnnflmoz#wkf#`lnf#eqlngjqf`wlqzavqjfg#jmb#pjnjobqwkfz#tfqf?,elmw=?,Mlqtfdjbmpsf`jejfgsqlgv`jmdsbppfmdfq+mft#Gbwfwfnslqbqzej`wjlmboBewfq#wkffrvbwjlmpgltmolbg-qfdvobqozgfufolsfqbaluf#wkfojmhfg#wlskfmlnfmbsfqjlg#lewllowjs!=pvapwbm`fbvwlnbwj`bpsf`w#leBnlmd#wkf`lmmf`wfgfpwjnbwfpBjq#Elq`fpzpwfn#lelaif`wjufjnnfgjbwfnbhjmd#jwsbjmwjmdp`lmrvfqfgbqf#pwjoosql`fgvqfdqltwk#lekfbgfg#azFvqlsfbm#gjujpjlmpnlof`vofpeqbm`kjpfjmwfmwjlmbwwqb`wfg`kjogkllgbopl#vpfggfgj`bwfgpjmdbslqfgfdqff#leebwkfq#le`lmeoj`wp?,b=?,s=\t`bnf#eqlntfqf#vpfgmlwf#wkbwqf`fjujmdF{f`vwjuffufm#nlqfb``fpp#wl`lnnbmgfqSlojwj`bonvpj`jbmpgfoj`jlvpsqjplmfqpbgufmw#leVWE.;!#,=?\"X@GBWBX!=@lmwb`wPlvwkfqm#ad`lolq>!pfqjfp#le-#Jw#tbp#jm#Fvqlsfsfqnjwwfgubojgbwf-bssfbqjmdleej`jboppfqjlvpoz.obmdvbdfjmjwjbwfgf{wfmgjmdolmd.wfqnjmeobwjlmpv`k#wkbwdfw@llhjfnbqhfg#az?,avwwlm=jnsofnfmwavw#jw#jpjm`qfbpfpgltm#wkf#qfrvjqjmdgfsfmgfmw..=\t?\"..#jmwfqujftTjwk#wkf#`lsjfp#le`lmpfmpvptbp#avjowUfmfyvfob+elqnfqozwkf#pwbwfsfqplmmfopwqbwfdj`ebulvq#lejmufmwjlmTjhjsfgjb`lmwjmfmwujqwvbooztkj`k#tbpsqjm`jsof@lnsofwf#jgfmwj`bopklt#wkbwsqjnjwjufbtbz#eqlnnlof`vobqsqf`jpfozgjpploufgVmgfq#wkfufqpjlm>!=%maps8?,Jw#jp#wkf#Wkjp#jp#tjoo#kbuflqdbmjpnpplnf#wjnfEqjfgqj`ktbp#ejqpwwkf#lmoz#eb`w#wkbwelqn#jg>!sqf`fgjmdWf`kmj`boskzpj`jpwl``vqp#jmmbujdbwlqpf`wjlm!=psbm#jg>!plvdkw#wlafolt#wkfpvqujujmd~?,pwzof=kjp#gfbwkbp#jm#wkf`bvpfg#azsbqwjboozf{jpwjmd#vpjmd#wkftbp#djufmb#ojpw#leofufop#lemlwjlm#leLeej`jbo#gjpnjppfgp`jfmwjpwqfpfnaofpgvsoj`bwff{solpjufqf`lufqfgboo#lwkfqdboofqjfpxsbggjmd9sflsof#leqfdjlm#lebggqfppfpbppl`jbwfjnd#bow>!jm#nlgfqmpklvog#afnfwklg#leqfslqwjmdwjnfpwbnsmffgfg#wlwkf#Dqfbwqfdbqgjmdpffnfg#wlujftfg#bpjnsb`w#lmjgfb#wkbwwkf#Tlqogkfjdkw#lef{sbmgjmdWkfpf#bqf`vqqfmw!=`bqfevooznbjmwbjmp`kbqdf#le@obppj`bobggqfppfgsqfgj`wfgltmfqpkjs?gju#jg>!qjdkw!=\x0E\tqfpjgfm`fofbuf#wkf`lmwfmw!=bqf#lewfm##~*+*8\x0E\tsqlabaoz#Sqlefpplq.avwwlm!#qfpslmgfgpbzp#wkbwkbg#wl#afsob`fg#jmKvmdbqjbmpwbwvp#lepfqufp#bpVmjufqpbof{f`vwjlmbddqfdbwfelq#tkj`kjmef`wjlmbdqffg#wlkltfufq/#slsvobq!=sob`fg#lm`lmpwqv`wfof`wlqbopznalo#lejm`ovgjmdqfwvqm#wlbq`kjwf`w@kqjpwjbmsqfujlvp#ojujmd#jmfbpjfq#wlsqlefpplq\t%ow8\"..#feef`w#lebmbozwj`ptbp#wbhfmtkfqf#wkfwllh#lufqafojfe#jmBeqjhbbmpbp#ebq#bpsqfufmwfgtlqh#tjwkb#psf`jbo?ejfogpfw@kqjpwnbpQfwqjfufg\t\tJm#wkf#ab`h#jmwlmlqwkfbpwnbdbyjmfp=?pwqlmd=`lnnjwwffdlufqmjmddqlvsp#lepwlqfg#jmfpwbaojpkb#dfmfqbojwp#ejqpwwkfjq#ltmslsvobwfgbm#laif`w@bqjaafbmboolt#wkfgjpwqj`wptjp`lmpjmol`bwjlm-8#tjgwk9#jmkbajwfgPl`jbojpwIbmvbqz#2?,ellwfq=pjnjobqoz`klj`f#lewkf#pbnf#psf`jej`#avpjmfpp#Wkf#ejqpw-ofmdwk8#gfpjqf#wlgfbo#tjwkpjm`f#wkfvpfqBdfmw`lm`fjufgjmgf{-sksbp#%rvlw8fmdbdf#jmqf`fmwoz/eft#zfbqptfqf#bopl\t?kfbg=\t?fgjwfg#azbqf#hmltm`jwjfp#jmb``fpphfz`lmgfnmfgbopl#kbufpfquj`fp/ebnjoz#leP`kllo#le`lmufqwfgmbwvqf#le#obmdvbdfnjmjpwfqp?,laif`w=wkfqf#jp#b#slsvobqpfrvfm`fpbgul`bwfgWkfz#tfqfbmz#lwkfqol`bwjlm>fmwfq#wkfnv`k#nlqfqfeof`wfgtbp#mbnfglqjdjmbo#b#wzsj`botkfm#wkfzfmdjmffqp`lvog#mlwqfpjgfmwptfgmfpgbzwkf#wkjqg#sqlgv`wpIbmvbqz#1tkbw#wkfzb#`fqwbjmqfb`wjlmpsql`fpplqbewfq#kjpwkf#obpw#`lmwbjmfg!=?,gju=\t?,b=?,wg=gfsfmg#lmpfbq`k!=\tsjf`fp#le`lnsfwjmdQfefqfm`fwfmmfppfftkj`k#kbp#ufqpjlm>?,psbm=#??,kfbgfq=djufp#wkfkjpwlqjbmubovf>!!=sbggjmd93ujft#wkbwwldfwkfq/wkf#nlpw#tbp#elvmgpvapfw#lebwwb`h#lm`kjogqfm/sljmwp#lesfqplmbo#slpjwjlm9boofdfgoz@ofufobmgtbp#obwfqbmg#bewfqbqf#djufmtbp#pwjoop`qloojmdgfpjdm#lenbhfp#wkfnv`k#ofppBnfqj`bmp-\t\tBewfq#/#avw#wkfNvpfvn#leolvjpjbmb+eqln#wkfnjmmfplwbsbqwj`ofpb#sql`fppGlnjmj`bmulovnf#leqfwvqmjmdgfefmpjuf33s{\x7Fqjdknbgf#eqlnnlvpflufq!#pwzof>!pwbwfp#le+tkj`k#jp`lmwjmvfpEqbm`jp`lavjogjmd#tjwklvw#btjwk#plnftkl#tlvogb#elqn#leb#sbqw#leafelqf#jwhmltm#bp##Pfquj`fpol`bwjlm#bmg#lewfmnfbpvqjmdbmg#jw#jpsbsfqab`hubovfp#le\x0E\t?wjwof=>#tjmglt-gfwfqnjmffq%rvlw8#sobzfg#azbmg#fbqoz?,`fmwfq=eqln#wkjpwkf#wkqffsltfq#bmgle#%rvlw8jmmfqKWNO?b#kqfe>!z9jmojmf8@kvq`k#lewkf#fufmwufqz#kjdkleej`jbo#.kfjdkw9#`lmwfmw>!,`dj.ajm,wl#`qfbwfbeqjhbbmpfpsfqbmwleqbm/Kbjpobwujf)Mvojfwvuj)_(`f)Mwjmb(af)Mwjmb\fUh\fT{\fTN\n{I\np@\x04Fr\x0BBl\bQ\x7F\tA{\x0BUm\x05Gx\tA{\x01yp\x06YA\0zX\bTV\bWl\bUd\x04BM\x0BB{\npV\x0B@x\x04B\\\np@\x04Db\x04Gz\tal\npa\tfM\tuD\bV~\x04mx\x0BQ}\ndS\tp\\\bVK\bS]\bU|\x05oD\tkV\x0Bed\x0BHR\nb~\x04M`\nJp\x05oD\x04|Q\nLP\x04Sw\bTl\nAI\nxC\bWt\tBq\x05F`\x04Cm\x0BLm\tKx\t}t\bPv\ny\\\naB\tV\x7F\nZd\x04XU\x04li\tfr\ti@\tBH\x04BD\x04BV\t`V\n[]\tp_\tTn\n~A\nxR\tuD\t`{\bV@\tTn\tHK\tAJ\x0Bxs\x04Zf\nqI\x04Zf\x0BBM\x0B|j\t}t\bSM\nmC\x0BQ}pfquj`jlpbqw/A`volbqdfmwjmbabq`folmb`vborvjfqsvaoj`bglsqlgv`wlpslo/Awj`bqfpsvfpwbtjhjsfgjbpjdvjfmwfa/Vprvfgb`lnvmjgbgpfdvqjgbgsqjm`jsbosqfdvmwbp`lmwfmjglqfpslmgfqufmfyvfobsqlaofnbpgj`jfnaqfqfob`j/_mmlujfnaqfpjnjobqfpsqlzf`wlpsqldqbnbpjmpwjwvwlb`wjujgbgfm`vfmwqbf`lmln/Abjn/Mdfmfp`lmwb`wbqgfp`bqdbqmf`fpbqjlbwfm`j/_mwfo/Eelml`lnjpj/_m`bm`jlmfp`bsb`jgbgfm`lmwqbqbm/Mojpjpebulqjwlpw/Eqnjmlpsqlujm`jbfwjrvfwbpfofnfmwlpevm`jlmfpqfpvowbgl`bq/M`wfqsqlsjfgbgsqjm`jsjlmf`fpjgbgnvmj`jsbo`qfb`j/_mgfp`bqdbpsqfpfm`jb`lnfq`jbolsjmjlmfpfifq`j`jlfgjwlqjbopbobnbm`bdlmy/Mofygl`vnfmwlsfo/A`vobqf`jfmwfpdfmfqbofpwbqqbdlmbsq/M`wj`bmlufgbgfpsqlsvfpwbsb`jfmwfpw/E`mj`bplaifwjulp`lmwb`wlp\fHB\fIk\fHn\fH^\fHS\fHc\fHU\fId\fHn\fH{\fHC\fHR\fHT\fHR\fHI\fHc\fHY\fHn\fH\\\fHU\fIk\fHy\fIg\fHd\fHy\fIm\fHw\fH\\\fHU\fHR\fH@\fHR\fHJ\fHy\fHU\fHR\fHT\fHA\fIl\fHU\fIm\fHc\fH\\\fHU\fIl\fHB\fId\fHn\fHJ\fHS\fHD\fH@\fHR\fHHgjsolgl`p\fHT\fHB\fHC\fH\\\fIn\fHF\fHD\fHR\fHB\fHF\fHH\fHR\fHG\fHS\fH\\\fHx\fHT\fHH\fHH\fH\\\fHU\fH^\fIg\fH{\fHU\fIm\fHj\fH@\fHR\fH\\\fHJ\fIk\fHZ\fHU\fIm\fHd\fHz\fIk\fH^\fHC\fHJ\fHS\fHy\fHR\fHB\fHY\fIk\fH@\fHH\fIl\fHD\fH@\fIl\fHv\fHB\fI`\fHH\fHT\fHR\fH^\fH^\fIk\fHz\fHp\fIe\fH@\fHB\fHJ\fHJ\fHH\fHI\fHR\fHD\fHU\fIl\fHZ\fHU\fH\\\fHi\fH^\fH{\fHy\fHA\fIl\fHD\fH{\fH\\\fHF\fHR\fHT\fH\\\fHR\fHH\fHy\fHS\fHc\fHe\fHT\fIk\fH{\fHC\fIl\fHU\fIn\fHm\fHj\fH{\fIk\fHs\fIl\fHB\fHz\fIg\fHp\fHy\fHR\fH\\\fHi\fHA\fIl\fH{\fHC\fIk\fHH\fIm\fHB\fHY\fIg\fHs\fHJ\fIk\fHn\fHi\fH{\fH\\\fH|\fHT\fIk\fHB\fIk\fH^\fH^\fH{\fHR\fHU\fHR\fH^\fHf\fHF\fH\\\fHv\fHR\fH\\\fH|\fHT\fHR\fHJ\fIk\fH\\\fHp\fHS\fHT\fHJ\fHS\fH^\fH@\fHn\fHJ\fH@\fHD\fHR\fHU\fIn\fHn\fH^\fHR\fHz\fHp\fIl\fHH\fH@\fHs\fHD\fHB\fHS\fH^\fHk\fHT\fIk\fHj\fHD\fIk\fHD\fHC\fHR\fHy\fIm\fH^\fH^\fIe\fH{\fHA\fHR\fH{\fH\\\fIk\fH^\fHp\fH{\fHU\fH\\\fHR\fHB\fH^\fH{\fIk\fHF\fIk\fHp\fHU\fHR\fHI\fHk\fHT\fIl\fHT\fHU\fIl\fHy\fH^\fHR\fHL\fIl\fHy\fHU\fHR\fHm\fHJ\fIn\fH\\\fHH\fHU\fHH\fHT\fHR\fHH\fHC\fHR\fHJ\fHj\fHC\fHR\fHF\fHR\fHy\fHy\fI`\fHD\fHZ\fHR\fHB\fHJ\fIk\fHz\fHC\fHU\fIl\fH\\\fHR\fHC\fHz\fIm\fHJ\fH^\fH{\fIl`bwfdlqjfpf{sfqjfm`f?,wjwof=\x0E\t@lszqjdkw#ibubp`qjsw`lmgjwjlmpfufqzwkjmd?s#`obpp>!wf`kmloldzab`hdqlvmg?b#`obpp>!nbmbdfnfmw%`lsz8#132ibubP`qjsw`kbqb`wfqpaqfbg`qvnawkfnpfoufpklqjylmwbodlufqmnfmw@bojelqmjbb`wjujwjfpgjp`lufqfgMbujdbwjlmwqbmpjwjlm`lmmf`wjlmmbujdbwjlmbssfbqbm`f?,wjwof=?n`kf`hal{!#wf`kmjrvfpsqlwf`wjlmbssbqfmwozbp#tfoo#bpvmw$/#$VB.qfplovwjlmlsfqbwjlmpwfofujpjlmwqbmpobwfgTbpkjmdwlmmbujdbwlq-#>#tjmglt-jnsqfppjlm%ow8aq%dw8ojwfqbwvqfslsvobwjlmad`lolq>! fpsf`jbooz#`lmwfmw>!sqlgv`wjlmmftpofwwfqsqlsfqwjfpgfejmjwjlmofbgfqpkjsWf`kmloldzSbqojbnfmw`lnsbqjplmvo#`obpp>!-jmgf{Le+!`lm`ovpjlmgjp`vppjlm`lnslmfmwpajloldj`boQfulovwjlm\\`lmwbjmfqvmgfqpwllgmlp`qjsw=?sfqnjppjlmfb`k#lwkfqbwnlpskfqf#lmel`vp>!?elqn#jg>!sql`fppjmdwkjp-ubovfdfmfqbwjlm@lmefqfm`fpvapfrvfmwtfoo.hmltmubqjbwjlmpqfsvwbwjlmskfmlnfmlmgjp`jsojmfoldl-smd!#+gl`vnfmw/alvmgbqjfpf{sqfppjlmpfwwofnfmwAb`hdqlvmglvw#le#wkffmwfqsqjpf+!kwwsp9!#vmfp`bsf+!sbpptlqg!#gfnl`qbwj`?b#kqfe>!,tqbssfq!=\tnfnafqpkjsojmdvjpwj`s{8sbggjmdskjolplskzbppjpwbm`fvmjufqpjwzeb`jojwjfpqf`ldmjyfgsqfefqfm`fje#+wzsflenbjmwbjmfgul`bavobqzkzslwkfpjp-pvanjw+*8%bns8maps8bmmlwbwjlmafkjmg#wkfElvmgbwjlmsvaojpkfq!bppvnswjlmjmwqlgv`fg`lqqvswjlmp`jfmwjpwpf{soj`jwozjmpwfbg#legjnfmpjlmp#lm@oj`h>!`lmpjgfqfggfsbqwnfmwl``vsbwjlmpllm#bewfqjmufpwnfmwsqlmlvm`fgjgfmwjejfgf{sfqjnfmwNbmbdfnfmwdfldqbskj`!#kfjdkw>!ojmh#qfo>!-qfsob`f+,gfsqfppjlm`lmefqfm`fsvmjpknfmwfojnjmbwfgqfpjpwbm`fbgbswbwjlmlsslpjwjlmtfoo#hmltmpvssofnfmwgfwfqnjmfgk2#`obpp>!3s{8nbqdjmnf`kbmj`bopwbwjpwj`p`fofaqbwfgDlufqmnfmw\t\tGvqjmd#wgfufolsfqpbqwjej`jbofrvjubofmwlqjdjmbwfg@lnnjppjlmbwwb`knfmw?psbm#jg>!wkfqf#tfqfMfgfqobmgpafzlmg#wkfqfdjpwfqfgilvqmbojpweqfrvfmwozboo#le#wkfobmd>!fm!#?,pwzof=\x0E\tbaplovwf8#pvsslqwjmdf{wqfnfoz#nbjmpwqfbn?,pwqlmd=#slsvobqjwzfnsolznfmw?,wbaof=\x0E\t#`lopsbm>!?,elqn=\t##`lmufqpjlmbalvw#wkf#?,s=?,gju=jmwfdqbwfg!#obmd>!fmSlqwvdvfpfpvapwjwvwfjmgjujgvbojnslppjaofnvowjnfgjbbonlpw#boos{#plojg# bsbqw#eqlnpvaif`w#wljm#Fmdojpk`qjwj`jyfgf{`fsw#elqdvjgfojmfplqjdjmboozqfnbqhbaofwkf#pf`lmgk1#`obpp>!?b#wjwof>!+jm`ovgjmdsbqbnfwfqpsqlkjajwfg>#!kwws9,,gj`wjlmbqzsfq`fswjlmqfulovwjlmelvmgbwjlms{8kfjdkw9pv``fppevopvsslqwfqpnjoofmmjvnkjp#ebwkfqwkf#%rvlw8ml.qfsfbw8`lnnfq`jbojmgvpwqjbofm`lvqbdfgbnlvmw#le#vmleej`jbofeej`jfm`zQfefqfm`fp`llqgjmbwfgjp`objnfqf{sfgjwjlmgfufolsjmd`bo`vobwfgpjnsojejfgofdjwjnbwfpvapwqjmd+3!#`obpp>!`lnsofwfozjoovpwqbwfejuf#zfbqpjmpwqvnfmwSvaojpkjmd2!#`obpp>!spz`kloldz`lmejgfm`fmvnafq#le#bapfm`f#leel`vpfg#lmiljmfg#wkfpwqv`wvqfpsqfujlvpoz=?,jeqbnf=lm`f#bdbjmavw#qbwkfqjnnjdqbmwple#`lvqpf/b#dqlvs#leOjwfqbwvqfVmojhf#wkf?,b=%maps8\tevm`wjlm#jw#tbp#wkf@lmufmwjlmbvwlnlajofSqlwfpwbmwbddqfppjufbewfq#wkf#Pjnjobqoz/!#,=?,gju=`loof`wjlm\x0E\tevm`wjlmujpjajojwzwkf#vpf#leulovmwffqpbwwqb`wjlmvmgfq#wkf#wkqfbwfmfg)?\"X@GBWBXjnslqwbm`fjm#dfmfqbowkf#obwwfq?,elqn=\t?,-jmgf{Le+$j#>#38#j#?gjeefqfm`fgfulwfg#wlwqbgjwjlmppfbq`k#elqvowjnbwfozwlvqmbnfmwbwwqjavwfppl.`boofg#~\t?,pwzof=fubovbwjlmfnskbpjyfgb``fppjaof?,pf`wjlm=pv``fppjlmbolmd#tjwkNfbmtkjof/jmgvpwqjfp?,b=?aq#,=kbp#af`lnfbpsf`wp#leWfofujpjlmpveej`jfmwabphfwabooalwk#pjgfp`lmwjmvjmdbm#bqwj`of?jnd#bow>!bgufmwvqfpkjp#nlwkfqnbm`kfpwfqsqjm`jsofpsbqwj`vobq`lnnfmwbqzfeef`wp#legf`jgfg#wl!=?pwqlmd=svaojpkfqpIlvqmbo#legjeej`vowzeb`jojwbwfb``fswbaofpwzof-`pp!\nevm`wjlm#jmmlubwjlm=@lszqjdkwpjwvbwjlmptlvog#kbufavpjmfppfpGj`wjlmbqzpwbwfnfmwplewfm#vpfgsfqpjpwfmwjm#Ibmvbqz`lnsqjpjmd?,wjwof=\t\ngjsolnbwj``lmwbjmjmdsfqelqnjmdf{wfmpjlmpnbz#mlw#af`lm`fsw#le#lm`oj`h>!Jw#jp#boplejmbm`jbo#nbhjmd#wkfOv{fnalvqdbggjwjlmbobqf#`boofgfmdbdfg#jm!p`qjsw!*8avw#jw#tbpfof`wqlmj`lmpvanjw>!\t?\"..#Fmg#fof`wqj`boleej`jboozpvddfpwjlmwls#le#wkfvmojhf#wkfBvpwqbojbmLqjdjmboozqfefqfm`fp\t?,kfbg=\x0E\tqf`ldmjpfgjmjwjbojyfojnjwfg#wlBof{bmgqjbqfwjqfnfmwBgufmwvqfpelvq#zfbqp\t\t%ow8\"..#jm`qfbpjmdgf`lqbwjlmk0#`obpp>!lqjdjmp#lelaojdbwjlmqfdvobwjlm`obppjejfg+evm`wjlm+bgubmwbdfpafjmd#wkf#kjpwlqjbmp?abpf#kqfeqfsfbwfgoztjoojmd#wl`lnsbqbaofgfpjdmbwfgmlnjmbwjlmevm`wjlmbojmpjgf#wkfqfufobwjlmfmg#le#wkfp#elq#wkf#bvwklqjyfgqfevpfg#wlwbhf#sob`fbvwlmlnlvp`lnsqlnjpfslojwj`bo#qfpwbvqbmwwtl#le#wkfEfaqvbqz#1rvbojwz#leptelaif`w-vmgfqpwbmgmfbqoz#bootqjwwfm#azjmwfqujftp!#tjgwk>!2tjwkgqbtboeolbw9ofewjp#vpvbooz`bmgjgbwfpmftpsbsfqpnzpwfqjlvpGfsbqwnfmwafpw#hmltmsbqojbnfmwpvssqfppfg`lmufmjfmwqfnfnafqfggjeefqfmw#pzpwfnbwj`kbp#ofg#wlsqlsbdbmgb`lmwqloofgjmeovfm`fp`fqfnlmjbosql`objnfgSqlwf`wjlmoj#`obpp>!P`jfmwjej``obpp>!ml.wqbgfnbqhpnlqf#wkbm#tjgfpsqfbgOjafqbwjlmwllh#sob`fgbz#le#wkfbp#olmd#bpjnsqjplmfgBggjwjlmbo\t?kfbg=\t?nObalqbwlqzMlufnafq#1f{`fswjlmpJmgvpwqjboubqjfwz#leeolbw9#ofeGvqjmd#wkfbppfppnfmwkbuf#affm#gfbop#tjwkPwbwjpwj`pl``vqqfm`f,vo=?,gju=`ofbqej{!=wkf#svaoj`nbmz#zfbqptkj`k#tfqflufq#wjnf/pzmlmznlvp`lmwfmw!=\tsqfpvnbaozkjp#ebnjozvpfqBdfmw-vmf{sf`wfgjm`ovgjmd#`kboofmdfgb#njmlqjwzvmgfejmfg!afolmdp#wlwbhfm#eqlnjm#L`wlafqslpjwjlm9#pbjg#wl#afqfojdjlvp#Efgfqbwjlm#qltpsbm>!lmoz#b#eftnfbmw#wkbwofg#wl#wkf..=\x0E\t?gju#?ejfogpfw=Bq`kajpkls#`obpp>!mlafjmd#vpfgbssqlb`kfpsqjujofdfpmlp`qjsw=\tqfpvowp#jmnbz#af#wkfFbpwfq#fddnf`kbmjpnpqfbplmbaofSlsvobwjlm@loof`wjlmpfof`wfg!=mlp`qjsw=\x0E,jmgf{-sksbqqjubo#le.ippgh$**8nbmbdfg#wljm`lnsofwf`bpvbowjfp`lnsofwjlm@kqjpwjbmpPfswfnafq#bqjwknfwj`sql`fgvqfpnjdkw#kbufSqlgv`wjlmjw#bssfbqpSkjolplskzeqjfmgpkjsofbgjmd#wldjujmd#wkfwltbqg#wkfdvbqbmwffggl`vnfmwfg`lolq9 333ujgfl#dbnf`lnnjppjlmqfeof`wjmd`kbmdf#wkfbppl`jbwfgpbmp.pfqjelmhfzsqfpp8#sbggjmd9Kf#tbp#wkfvmgfqozjmdwzsj`booz#/#bmg#wkf#pq`Fofnfmwpv``fppjufpjm`f#wkf#pklvog#af#mfwtlqhjmdb``lvmwjmdvpf#le#wkfoltfq#wkbmpkltp#wkbw?,psbm=\t\n\n`lnsobjmwp`lmwjmvlvprvbmwjwjfpbpwqlmlnfqkf#gjg#mlwgvf#wl#jwpbssojfg#wlbm#bufqbdffeelqwp#wlwkf#evwvqfbwwfnsw#wlWkfqfelqf/`bsbajojwzQfsvaoj`bmtbp#elqnfgFof`wqlmj`hjolnfwfqp`kboofmdfpsvaojpkjmdwkf#elqnfqjmgjdfmlvpgjqf`wjlmppvapjgjbqz`lmpsjqb`zgfwbjop#lebmg#jm#wkfbeelqgbaofpvapwbm`fpqfbplm#elq`lmufmwjlmjwfnwzsf>!baplovwfozpvsslpfgozqfnbjmfg#bbwwqb`wjufwqbufoojmdpfsbqbwfozel`vpfp#lmfofnfmwbqzbssoj`baofelvmg#wkbwpwzofpkffwnbmvp`qjswpwbmgp#elq#ml.qfsfbw+plnfwjnfp@lnnfq`jbojm#Bnfqj`bvmgfqwbhfmrvbqwfq#lebm#f{bnsofsfqplmboozjmgf{-sks<?,avwwlm=\tsfq`fmwbdfafpw.hmltm`qfbwjmd#b!#gjq>!owqOjfvwfmbmw\t?gju#jg>!wkfz#tlvogbajojwz#lenbgf#vs#lemlwfg#wkbw`ofbq#wkbwbqdvf#wkbwwl#bmlwkfq`kjogqfm$psvqslpf#leelqnvobwfgabpfg#vslmwkf#qfdjlmpvaif`w#lesbppfmdfqpslppfppjlm-\t\tJm#wkf#Afelqf#wkfbewfqtbqgp`vqqfmwoz#b`qlpp#wkfp`jfmwjej``lnnvmjwz-`bsjwbojpnjm#Dfqnbmzqjdkw.tjmdwkf#pzpwfnPl`jfwz#leslojwj`jbmgjqf`wjlm9tfmw#lm#wlqfnlubo#le#Mft#Zlqh#bsbqwnfmwpjmgj`bwjlmgvqjmd#wkfvmofpp#wkfkjpwlqj`bokbg#affm#bgfejmjwjufjmdqfgjfmwbwwfmgbm`f@fmwfq#elqsqlnjmfm`fqfbgzPwbwfpwqbwfdjfpavw#jm#wkfbp#sbqw#le`lmpwjwvwf`objn#wkbwobalqbwlqz`lnsbwjaofebjovqf#le/#pv`k#bp#afdbm#tjwkvpjmd#wkf#wl#sqlujgfefbwvqf#leeqln#tkj`k,!#`obpp>!dfloldj`bopfufqbo#legfojafqbwfjnslqwbmw#klogp#wkbwjmd%rvlw8#ubojdm>wlswkf#Dfqnbmlvwpjgf#lemfdlwjbwfgkjp#`bqffqpfsbqbwjlmjg>!pfbq`ktbp#`boofgwkf#elvqwkqf`qfbwjlmlwkfq#wkbmsqfufmwjlmtkjof#wkf#fgv`bwjlm/`lmmf`wjmdb``vqbwfoztfqf#avjowtbp#hjoofgbdqffnfmwpnv`k#nlqf#Gvf#wl#wkftjgwk9#233plnf#lwkfqHjmdgln#lewkf#fmwjqfebnlvp#elqwl#`lmmf`wlaif`wjufpwkf#Eqfm`ksflsof#bmgefbwvqfg!=jp#pbjg#wlpwqv`wvqboqfefqfmgvnnlpw#lewfmb#pfsbqbwf.=\t?gju#jg#Leej`jbo#tlqogtjgf-bqjb.obafowkf#sobmfwbmg#jw#tbpg!#ubovf>!ollhjmd#bwafmfej`jbobqf#jm#wkfnlmjwlqjmdqfslqwfgozwkf#nlgfqmtlqhjmd#lmbooltfg#wltkfqf#wkf#jmmlubwjuf?,b=?,gju=plvmgwqb`hpfbq`kElqnwfmg#wl#afjmsvw#jg>!lsfmjmd#leqfpwqj`wfgbglswfg#azbggqfppjmdwkfloldjbmnfwklgp#leubqjbmw#le@kqjpwjbm#ufqz#obqdfbvwlnlwjufaz#ebq#wkfqbmdf#eqlnsvqpvjw#leeloolt#wkfaqlvdkw#wljm#Fmdobmgbdqff#wkbwb``vpfg#le`lnfp#eqlnsqfufmwjmdgju#pwzof>kjp#lq#kfqwqfnfmglvpeqffgln#le`lm`fqmjmd3#2fn#2fn8Abphfwaboo,pwzof-`ppbm#fbqojfqfufm#bewfq,!#wjwof>!-`ln,jmgf{wbhjmd#wkfsjwwpavqdk`lmwfmw!=\x0E?p`qjsw=+ewvqmfg#lvwkbujmd#wkf?,psbm=\x0E\t#l``bpjlmboaf`bvpf#jwpwbqwfg#wlskzpj`booz=?,gju=\t##`qfbwfg#az@vqqfmwoz/#ad`lolq>!wbajmgf{>!gjpbpwqlvpBmbozwj`p#bopl#kbp#b=?gju#jg>!?,pwzof=\t?`boofg#elqpjmdfq#bmg-pq`#>#!,,ujlobwjlmpwkjp#sljmw`lmpwbmwozjp#ol`bwfgqf`lqgjmdpg#eqln#wkfmfgfqobmgpslqwvdv/Fp;N;};D;u;F5m4K4]4_7`gfpbqqlool`lnfmwbqjlfgv`b`j/_mpfswjfnaqfqfdjpwqbglgjqf``j/_mvaj`b`j/_msvaoj`jgbgqfpsvfpwbpqfpvowbglpjnslqwbmwfqfpfqubglpbqw/A`volpgjefqfmwfppjdvjfmwfpqfs/Vaoj`bpjwvb`j/_mnjmjpwfqjlsqjub`jgbggjqf`wlqjlelqnb`j/_mslaob`j/_msqfpjgfmwf`lmw", "fmjglpb``fplqjlpwf`kmlqbwjsfqplmbofp`bwfdlq/Abfpsf`jbofpgjpslmjaofb`wvbojgbgqfefqfm`jbuboobglojgajaojlwf`bqfob`jlmfp`bofmgbqjlslo/Awj`bpbmwfqjlqfpgl`vnfmwlpmbwvqbofybnbwfqjbofpgjefqfm`jbf`lm/_nj`bwqbmpslqwfqlgq/Advfysbqwj`jsbqfm`vfmwqbmgjp`vpj/_mfpwqv`wvqbevmgb`j/_meqf`vfmwfpsfqnbmfmwfwlwbonfmwf<P<R<Z<Q<R<]=o<X<Y=n<P<R<Z<Y=n<^=l<Y<P=c=n<\\<V<Z<Y=k=n<R<]=g<]<R<W<Y<Y<R=k<Y<Q=`=a=n<R<_<R<V<R<_<X<\\<S<R=m<W<Y<^=m<Y<_<R=m<\\<U=n<Y=k<Y=l<Y<[<P<R<_=o=n=m<\\<U=n<\\<Z<T<[<Q<T<P<Y<Z<X=o<]=o<X=o=n<s<R<T=m<V<[<X<Y=m=`<^<T<X<Y<R=m<^=c<[<T<Q=o<Z<Q<R=m<^<R<Y<U<W=b<X<Y<U<S<R=l<Q<R<P<Q<R<_<R<X<Y=n<Y<U=m<^<R<T=i<S=l<\\<^<\\=n<\\<V<R<U<P<Y=m=n<R<T<P<Y<Y=n<Z<T<[<Q=`<R<X<Q<R<U<W=o=k=d<Y<S<Y=l<Y<X=k<\\=m=n<T=k<\\=m=n=`=l<\\<]<R=n<Q<R<^=g=i<S=l<\\<^<R=m<R<]<R<U<S<R=n<R<P<P<Y<Q<Y<Y=k<T=m<W<Y<Q<R<^=g<Y=o=m<W=o<_<R<V<R<W<R<Q<\\<[<\\<X=n<\\<V<R<Y=n<R<_<X<\\<S<R=k=n<T<s<R=m<W<Y=n<\\<V<T<Y<Q<R<^=g<U=m=n<R<T=n=n<\\<V<T=i=m=l<\\<[=o<M<\\<Q<V=n=h<R=l=o<P<v<R<_<X<\\<V<Q<T<_<T=m<W<R<^<\\<Q<\\=d<Y<U<Q<\\<U=n<T=m<^<R<T<P=m<^=c<[=`<W=b<]<R<U=k<\\=m=n<R=m=l<Y<X<T<v=l<R<P<Y<H<R=l=o<P=l=g<Q<V<Y=m=n<\\<W<T<S<R<T=m<V=n=g=m=c=k<P<Y=m=c=j=j<Y<Q=n=l=n=l=o<X<\\=m<\\<P=g=i=l=g<Q<V<\\<q<R<^=g<U=k<\\=m<R<^<P<Y=m=n<\\=h<T<W=`<P<P<\\=l=n<\\=m=n=l<\\<Q<P<Y=m=n<Y=n<Y<V=m=n<Q<\\=d<T=i<P<T<Q=o=n<T<P<Y<Q<T<T<P<Y=b=n<Q<R<P<Y=l<_<R=l<R<X=m<\\<P<R<P=a=n<R<P=o<V<R<Q=j<Y=m<^<R<Y<P<V<\\<V<R<U<|=l=i<T<^5i5j4F4C5e4I4]4_4K5h4]4_4K5h4E4K5h4U4K5i5o4F4D5k4K4D4]4K5i4@4K5h5f5d5i4K5h4Y5d4]4@4C5f4C4E4K5h4U4Z5d4I4Z4K5m4E4K5h5n4_5i4K5h4U4K4D4F4A5i5f5h5i5h5m4K4F5i5h4F5n5e4F4U4C5f5h4K5h4X4U4]4O4B4D4K4]4F4[5d5f4]4U5h5f5o5i4I4]5m4K5n4[5h4D4K4F4K5h5h4V4E4F4]4F5f4D4K5h5j4K4_4K5h4X5f4B5i5j4F4C5f4K5h4U4]4D4K5h5n4Y4Y4K5m5h4K5i4U5h5f5k4K4F4A4C5f4G4K5h5h5k5i4K5h4U5i5h5i5o4F4D4E5f5i5o5j5o4K5h4[5m5h5m5f4C5f5d4I4C4K4]4E4F4K4]5f4B4K5h4Y4A4E4F4_4@5f5h4K5h5d5n4F4U5j4C5i4K5i4C5f5j4E4F4Y5i5f5i4O4]4X5f5m4K5h4\\5f5j4U4]4D5f4E4D5d4K4D4E4O5h4U4K4D4K5h4_5m4]5i4X4K5o5h4F4U4K5h5e4K5h4O5d5h4K5h4_5j4E4@4K5i4U4E4K5h4Y4A5m4K5h4C5f5j5o5h5i4K4F4K5h4B4K4Y4K5h5i5h5m4O4U4Z4K4M5o4F4K4D4E4K5h4B5f4]4]4_4K4J5h4K5h5n5h4D4K5h4O4C4D5i5n4K4[4U5i4]4K4_5h5i5j4[5n4E4K5h5o4F4D4K5h4]4@5h4K4X4F4]5o4K5h5n4C5i5f4U4[5f5opAzWbdMbnf+-isd!#bow>!2s{#plojg# -dje!#bow>!wqbmpsbqfmwjmelqnbwjlmbssoj`bwjlm!#lm`oj`h>!fpwbaojpkfgbgufqwjpjmd-smd!#bow>!fmujqlmnfmwsfqelqnbm`fbssqlsqjbwf%bns8ngbpk8jnnfgjbwfoz?,pwqlmd=?,qbwkfq#wkbmwfnsfqbwvqfgfufolsnfmw`lnsfwjwjlmsob`fklogfqujpjajojwz9`lszqjdkw!=3!#kfjdkw>!fufm#wklvdkqfsob`fnfmwgfpwjmbwjlm@lqslqbwjlm?vo#`obpp>!Bppl`jbwjlmjmgjujgvbopsfqpsf`wjufpfwWjnflvw+vqo+kwws9,,nbwkfnbwj`pnbqdjm.wls9fufmwvbooz#gfp`qjswjlm*#ml.qfsfbw`loof`wjlmp-ISD\x7Fwkvna\x7Fsbqwj`jsbwf,kfbg=?algzeolbw9ofew8?oj#`obpp>!kvmgqfgp#le\t\tKltfufq/#`lnslpjwjlm`ofbq9alwk8`llsfqbwjlmtjwkjm#wkf#obafo#elq>!alqgfq.wls9Mft#Yfbobmgqf`lnnfmgfgsklwldqbskzjmwfqfpwjmd%ow8pvs%dw8`lmwqlufqpzMfwkfqobmgpbowfqmbwjufnb{ofmdwk>!ptjwyfqobmgGfufolsnfmwfppfmwjbooz\t\tBowklvdk#?,wf{wbqfb=wkvmgfqajqgqfsqfpfmwfg%bns8mgbpk8psf`vobwjlm`lnnvmjwjfpofdjpobwjlmfof`wqlmj`p\t\n?gju#jg>!joovpwqbwfgfmdjmffqjmdwfqqjwlqjfpbvwklqjwjfpgjpwqjavwfg5!#kfjdkw>!pbmp.pfqje8`bsbaof#le#gjpbssfbqfgjmwfqb`wjufollhjmd#elqjw#tlvog#afBedkbmjpwbmtbp#`qfbwfgNbwk-eollq+pvqqlvmgjmd`bm#bopl#aflapfqubwjlmnbjmwfmbm`ffm`lvmwfqfg?k1#`obpp>!nlqf#qf`fmwjw#kbp#affmjmubpjlm#le*-dfwWjnf+*evmgbnfmwboGfpsjwf#wkf!=?gju#jg>!jmpsjqbwjlmf{bnjmbwjlmsqfsbqbwjlmf{sobmbwjlm?jmsvw#jg>!?,b=?,psbm=ufqpjlmp#lejmpwqvnfmwpafelqf#wkf##>#$kwws9,,Gfp`qjswjlmqfobwjufoz#-pvapwqjmd+fb`k#le#wkff{sfqjnfmwpjmeovfmwjbojmwfdqbwjlmnbmz#sflsofgvf#wl#wkf#`lnajmbwjlmgl#mlw#kbufNjggof#Fbpw?mlp`qjsw=?`lszqjdkw!#sfqkbsp#wkfjmpwjwvwjlmjm#Gf`fnafqbqqbmdfnfmwnlpw#ebnlvpsfqplmbojwz`qfbwjlm#leojnjwbwjlmpf{`ovpjufozplufqfjdmwz.`lmwfmw!=\t?wg#`obpp>!vmgfqdqlvmgsbqboofo#wlgl`wqjmf#lel``vsjfg#azwfqnjmloldzQfmbjppbm`fb#mvnafq#lepvsslqw#elqf{solqbwjlmqf`ldmjwjlmsqfgf`fpplq?jnd#pq`>!,?k2#`obpp>!svaoj`bwjlmnbz#bopl#afpsf`jbojyfg?,ejfogpfw=sqldqfppjufnjoojlmp#lepwbwfp#wkbwfmelq`fnfmwbqlvmg#wkf#lmf#bmlwkfq-sbqfmwMlgfbdqj`vowvqfBowfqmbwjufqfpfbq`kfqpwltbqgp#wkfNlpw#le#wkfnbmz#lwkfq#+fpsf`jbooz?wg#tjgwk>!8tjgwk9233&jmgfsfmgfmw?k0#`obpp>!#lm`kbmdf>!*-bgg@obpp+jmwfqb`wjlmLmf#le#wkf#gbvdkwfq#leb``fpplqjfpaqbm`kfp#le\x0E\t?gju#jg>!wkf#obqdfpwgf`obqbwjlmqfdvobwjlmpJmelqnbwjlmwqbmpobwjlmgl`vnfmwbqzjm#lqgfq#wl!=\t?kfbg=\t?!#kfjdkw>!2b`qlpp#wkf#lqjfmwbwjlm*8?,p`qjsw=jnsofnfmwfg`bm#af#pffmwkfqf#tbp#bgfnlmpwqbwf`lmwbjmfq!=`lmmf`wjlmpwkf#Aqjwjpktbp#tqjwwfm\"jnslqwbmw8s{8#nbqdjm.elooltfg#azbajojwz#wl#`lnsoj`bwfggvqjmd#wkf#jnnjdqbwjlmbopl#`boofg?k7#`obpp>!gjpwjm`wjlmqfsob`fg#azdlufqmnfmwpol`bwjlm#lejm#Mlufnafqtkfwkfq#wkf?,s=\t?,gju=b`rvjpjwjlm`boofg#wkf#sfqpf`vwjlmgfpjdmbwjlmxelmw.pjyf9bssfbqfg#jmjmufpwjdbwff{sfqjfm`fgnlpw#ojhfoztjgfoz#vpfggjp`vppjlmpsqfpfm`f#le#+gl`vnfmw-f{wfmpjufozJw#kbp#affmjw#glfp#mlw`lmwqbqz#wljmkbajwbmwpjnsqlufnfmwp`klobqpkjs`lmpvnswjlmjmpwqv`wjlmelq#f{bnsoflmf#lq#nlqfs{8#sbggjmdwkf#`vqqfmwb#pfqjfp#lebqf#vpvboozqlof#jm#wkfsqfujlvpoz#gfqjubwjufpfujgfm`f#lef{sfqjfm`fp`lolqp`kfnfpwbwfg#wkbw`fqwjej`bwf?,b=?,gju=\t#pfof`wfg>!kjdk#p`klloqfpslmpf#wl`lnelqwbaofbglswjlm#lewkqff#zfbqpwkf#`lvmwqzjm#Efaqvbqzpl#wkbw#wkfsflsof#tkl#sqlujgfg#az?sbqbn#mbnfbeef`wfg#azjm#wfqnp#lebssljmwnfmwJPL.;;6:.2!tbp#alqm#jmkjpwlqj`bo#qfdbqgfg#bpnfbpvqfnfmwjp#abpfg#lm#bmg#lwkfq#9#evm`wjlm+pjdmjej`bmw`fofaqbwjlmwqbmpnjwwfg,ip,irvfqz-jp#hmltm#bpwkflqfwj`bo#wbajmgf{>!jw#`lvog#af?mlp`qjsw=\tkbujmd#affm\x0E\t?kfbg=\x0E\t?#%rvlw8Wkf#`lnsjobwjlmkf#kbg#affmsqlgv`fg#azskjolplskfq`lmpwqv`wfgjmwfmgfg#wlbnlmd#lwkfq`lnsbqfg#wlwl#pbz#wkbwFmdjmffqjmdb#gjeefqfmwqfefqqfg#wlgjeefqfm`fpafojfe#wkbwsklwldqbskpjgfmwjezjmdKjpwlqz#le#Qfsvaoj`#lemf`fppbqjozsqlabajojwzwf`kmj`boozofbujmd#wkfpsf`wb`vobqeqb`wjlm#lefof`wqj`jwzkfbg#le#wkfqfpwbvqbmwpsbqwmfqpkjsfnskbpjp#lmnlpw#qf`fmwpkbqf#tjwk#pbzjmd#wkbwejoofg#tjwkgfpjdmfg#wljw#jp#lewfm!=?,jeqbnf=bp#elooltp9nfqdfg#tjwkwkqlvdk#wkf`lnnfq`jbo#sljmwfg#lvwlsslqwvmjwzujft#le#wkfqfrvjqfnfmwgjujpjlm#lesqldqbnnjmdkf#qf`fjufgpfwJmwfqubo!=?,psbm=?,jm#Mft#Zlqhbggjwjlmbo#`lnsqfppjlm\t\t?gju#jg>!jm`lqslqbwf8?,p`qjsw=?bwwb`kFufmwaf`bnf#wkf#!#wbqdfw>!\\`bqqjfg#lvwPlnf#le#wkfp`jfm`f#bmgwkf#wjnf#le@lmwbjmfq!=nbjmwbjmjmd@kqjpwlskfqNv`k#le#wkftqjwjmdp#le!#kfjdkw>!1pjyf#le#wkfufqpjlm#le#nj{wvqf#le#afwtffm#wkfF{bnsofp#lefgv`bwjlmbo`lnsfwjwjuf#lmpvanjw>!gjqf`wlq#legjpwjm`wjuf,GWG#[KWNO#qfobwjmd#wlwfmgfm`z#wlsqlujm`f#letkj`k#tlvoggfpsjwf#wkfp`jfmwjej`#ofdjpobwvqf-jmmfqKWNO#boofdbwjlmpBdqj`vowvqftbp#vpfg#jmbssqlb`k#wljmwfoojdfmwzfbqp#obwfq/pbmp.pfqjegfwfqnjmjmdSfqelqnbm`fbssfbqbm`fp/#tkj`k#jp#elvmgbwjlmpbaaqfujbwfgkjdkfq#wkbmp#eqln#wkf#jmgjujgvbo#`lnslpfg#lepvsslpfg#wl`objnp#wkbwbwwqjavwjlmelmw.pjyf92fofnfmwp#leKjpwlqj`bo#kjp#aqlwkfqbw#wkf#wjnfbmmjufqpbqzdlufqmfg#azqfobwfg#wl#vowjnbwfoz#jmmlubwjlmpjw#jp#pwjoo`bm#lmoz#afgfejmjwjlmpwlDNWPwqjmdB#mvnafq#lejnd#`obpp>!Fufmwvbooz/tbp#`kbmdfgl``vqqfg#jmmfjdkalqjmdgjpwjmdvjpktkfm#kf#tbpjmwqlgv`jmdwfqqfpwqjboNbmz#le#wkfbqdvfp#wkbwbm#Bnfqj`bm`lmrvfpw#letjgfpsqfbg#tfqf#hjoofgp`qffm#bmg#Jm#lqgfq#wlf{sf`wfg#wlgfp`fmgbmwpbqf#ol`bwfgofdjpobwjufdfmfqbwjlmp#ab`hdqlvmgnlpw#sflsofzfbqp#bewfqwkfqf#jp#mlwkf#kjdkfpweqfrvfmwoz#wkfz#gl#mlwbqdvfg#wkbwpkltfg#wkbwsqfglnjmbmwwkfloldj`boaz#wkf#wjnf`lmpjgfqjmdpklqw.ojufg?,psbm=?,b=`bm#af#vpfgufqz#ojwwoflmf#le#wkf#kbg#boqfbgzjmwfqsqfwfg`lnnvmj`bwfefbwvqfp#ledlufqmnfmw/?,mlp`qjsw=fmwfqfg#wkf!#kfjdkw>!0Jmgfsfmgfmwslsvobwjlmpobqdf.p`bof-#Bowklvdk#vpfg#jm#wkfgfpwqv`wjlmslppjajojwzpwbqwjmd#jmwtl#lq#nlqff{sqfppjlmppvalqgjmbwfobqdfq#wkbmkjpwlqz#bmg?,lswjlm=\x0E\t@lmwjmfmwbofojnjmbwjmdtjoo#mlw#afsqb`wj`f#lejm#eqlmw#lepjwf#le#wkffmpvqf#wkbwwl#`qfbwf#bnjppjppjssjslwfmwjboozlvwpwbmgjmdafwwfq#wkbmtkbw#jp#mltpjwvbwfg#jmnfwb#mbnf>!WqbgjwjlmbopvddfpwjlmpWqbmpobwjlmwkf#elqn#lebwnlpskfqj`jgfloldj`bofmwfqsqjpfp`bo`vobwjmdfbpw#le#wkfqfnmbmwp#lesovdjmpsbdf,jmgf{-sks<qfnbjmfg#jmwqbmpelqnfgKf#tbp#bopltbp#boqfbgzpwbwjpwj`bojm#ebulq#leNjmjpwqz#lenlufnfmw#leelqnvobwjlmjp#qfrvjqfg?ojmh#qfo>!Wkjp#jp#wkf#?b#kqfe>!,slsvobqjyfgjmuloufg#jmbqf#vpfg#wlbmg#pfufqbonbgf#az#wkfpffnp#wl#afojhfoz#wkbwSbofpwjmjbmmbnfg#bewfqjw#kbg#affmnlpw#`lnnlmwl#qfefq#wlavw#wkjp#jp`lmpf`vwjufwfnslqbqjozJm#dfmfqbo/`lmufmwjlmpwbhfp#sob`fpvagjujpjlmwfqqjwlqjbolsfqbwjlmbosfqnbmfmwoztbp#obqdfozlvwaqfbh#lejm#wkf#sbpwelooltjmd#b#{nomp9ld>!=?b#`obpp>!`obpp>!wf{w@lmufqpjlm#nbz#af#vpfgnbmveb`wvqfbewfq#afjmd`ofbqej{!=\trvfpwjlm#letbp#fof`wfgwl#af`lnf#baf`bvpf#le#plnf#sflsofjmpsjqfg#azpv``fppevo#b#wjnf#tkfmnlqf#`lnnlmbnlmdpw#wkfbm#leej`jbotjgwk9233&8wf`kmloldz/tbp#bglswfgwl#hffs#wkfpfwwofnfmwpojuf#ajqwkpjmgf{-kwno!@lmmf`wj`vwbppjdmfg#wl%bns8wjnfp8b``lvmw#elqbojdm>qjdkwwkf#`lnsbmzbotbzp#affmqfwvqmfg#wljmuloufnfmwAf`bvpf#wkfwkjp#sfqjlg!#mbnf>!r!#`lmejmfg#wlb#qfpvow#leubovf>!!#,=jp#b`wvboozFmujqlmnfmw\x0E\t?,kfbg=\x0E\t@lmufqpfoz/=\t?gju#jg>!3!#tjgwk>!2jp#sqlabaozkbuf#af`lnf`lmwqloojmdwkf#sqlaofn`jwjyfmp#leslojwj`jbmpqfb`kfg#wkfbp#fbqoz#bp9mlmf8#lufq?wbaof#`fooubojgjwz#legjqf`woz#wllmnlvpfgltmtkfqf#jw#jptkfm#jw#tbpnfnafqp#le#qfobwjlm#wlb``lnnlgbwfbolmd#tjwk#Jm#wkf#obwfwkf#Fmdojpkgfoj`jlvp!=wkjp#jp#mlwwkf#sqfpfmwje#wkfz#bqfbmg#ejmboozb#nbwwfq#le\x0E\t\n?,gju=\x0E\t\x0E\t?,p`qjsw=ebpwfq#wkbmnbilqjwz#lebewfq#tkj`k`lnsbqbwjufwl#nbjmwbjmjnsqluf#wkfbtbqgfg#wkffq!#`obpp>!eqbnfalqgfqqfpwlqbwjlmjm#wkf#pbnfbmbozpjp#lewkfjq#ejqpwGvqjmd#wkf#`lmwjmfmwbopfrvfm`f#leevm`wjlm+*xelmw.pjyf9#tlqh#lm#wkf?,p`qjsw=\t?afdjmp#tjwkibubp`qjsw9`lmpwjwvfmwtbp#elvmgfgfrvjojaqjvnbppvnf#wkbwjp#djufm#azmffgp#wl#af`llqgjmbwfpwkf#ubqjlvpbqf#sbqw#lelmoz#jm#wkfpf`wjlmp#lejp#b#`lnnlmwkflqjfp#legjp`lufqjfpbppl`jbwjlmfgdf#le#wkfpwqfmdwk#leslpjwjlm#jmsqfpfmw.gbzvmjufqpboozwl#elqn#wkfavw#jmpwfbg`lqslqbwjlmbwwb`kfg#wljp#`lnnlmozqfbplmp#elq#%rvlw8wkf#`bm#af#nbgftbp#baof#wltkj`k#nfbmpavw#gjg#mlwlmNlvpfLufqbp#slppjaoflsfqbwfg#az`lnjmd#eqlnwkf#sqjnbqzbggjwjlm#leelq#pfufqbowqbmpefqqfgb#sfqjlg#lebqf#baof#wlkltfufq/#jwpklvog#kbufnv`k#obqdfq\t\n?,p`qjsw=bglswfg#wkfsqlsfqwz#legjqf`wfg#azfeef`wjufoztbp#aqlvdkw`kjogqfm#leSqldqbnnjmdolmdfq#wkbmnbmvp`qjswptbq#bdbjmpwaz#nfbmp#lebmg#nlpw#lepjnjobq#wl#sqlsqjfwbqzlqjdjmbwjmdsqfpwjdjlvpdqbnnbwj`bof{sfqjfm`f-wl#nbhf#wkfJw#tbp#bopljp#elvmg#jm`lnsfwjwlqpjm#wkf#V-P-qfsob`f#wkfaqlvdkw#wkf`bo`vobwjlmeboo#le#wkfwkf#dfmfqbosqb`wj`boozjm#klmlq#leqfofbpfg#jmqfpjgfmwjbobmg#plnf#lehjmd#le#wkfqfb`wjlm#wl2pw#Fbqo#le`vowvqf#bmgsqjm`jsbooz?,wjwof=\t##wkfz#`bm#afab`h#wl#wkfplnf#le#kjpf{slpvqf#wlbqf#pjnjobqelqn#le#wkfbggEbulqjwf`jwjyfmpkjssbqw#jm#wkfsflsof#tjwkjm#sqb`wj`fwl#`lmwjmvf%bns8njmvp8bssqlufg#az#wkf#ejqpw#booltfg#wkfbmg#elq#wkfevm`wjlmjmdsobzjmd#wkfplovwjlm#wlkfjdkw>!3!#jm#kjp#allhnlqf#wkbm#belooltp#wkf`qfbwfg#wkfsqfpfm`f#jm%maps8?,wg=mbwjlmbojpwwkf#jgfb#leb#`kbqb`wfqtfqf#elq`fg#`obpp>!awmgbzp#le#wkfefbwvqfg#jmpkltjmd#wkfjmwfqfpw#jmjm#sob`f#lewvqm#le#wkfwkf#kfbg#leOlqg#le#wkfslojwj`boozkbp#jwp#ltmFgv`bwjlmbobssqlubo#leplnf#le#wkffb`k#lwkfq/afkbujlq#lebmg#af`bvpfbmg#bmlwkfqbssfbqfg#lmqf`lqgfg#jmaob`h%rvlw8nbz#jm`ovgfwkf#tlqog$p`bm#ofbg#wlqfefqp#wl#balqgfq>!3!#dlufqmnfmw#tjmmjmd#wkfqfpvowfg#jm#tkjof#wkf#Tbpkjmdwlm/wkf#pvaif`w`jwz#jm#wkf=?,gju=\x0E\t\n\nqfeof`w#wkfwl#`lnsofwfaf`bnf#nlqfqbgjlb`wjufqfif`wfg#aztjwklvw#bmzkjp#ebwkfq/tkj`k#`lvog`lsz#le#wkfwl#jmgj`bwfb#slojwj`bob``lvmwp#le`lmpwjwvwfptlqhfg#tjwkfq?,b=?,oj=le#kjp#ojefb``lnsbmjfg`ojfmwTjgwksqfufmw#wkfOfdjpobwjufgjeefqfmwozwldfwkfq#jmkbp#pfufqboelq#bmlwkfqwf{w#le#wkfelvmgfg#wkff#tjwk#wkf#jp#vpfg#elq`kbmdfg#wkfvpvbooz#wkfsob`f#tkfqftkfqfbp#wkf=#?b#kqfe>!!=?b#kqfe>!wkfnpfoufp/bowklvdk#kfwkbw#`bm#afwqbgjwjlmboqlof#le#wkfbp#b#qfpvowqfnluf@kjoggfpjdmfg#aztfpw#le#wkfPlnf#sflsofsqlgv`wjlm/pjgf#le#wkfmftpofwwfqpvpfg#az#wkfgltm#wl#wkfb``fswfg#azojuf#jm#wkfbwwfnswp#wllvwpjgf#wkfeqfrvfm`jfpKltfufq/#jmsqldqbnnfqpbw#ofbpw#jmbssql{jnbwfbowklvdk#jwtbp#sbqw#lebmg#ubqjlvpDlufqmlq#lewkf#bqwj`ofwvqmfg#jmwl=?b#kqfe>!,wkf#f`lmlnzjp#wkf#nlpwnlpw#tjgfoztlvog#obwfqbmg#sfqkbspqjpf#wl#wkfl``vqp#tkfmvmgfq#tkj`k`lmgjwjlmp-wkf#tfpwfqmwkflqz#wkbwjp#sqlgv`fgwkf#`jwz#lejm#tkj`k#kfpffm#jm#wkfwkf#`fmwqboavjogjmd#lenbmz#le#kjpbqfb#le#wkfjp#wkf#lmoznlpw#le#wkfnbmz#le#wkfwkf#TfpwfqmWkfqf#jp#mlf{wfmgfg#wlPwbwjpwj`bo`lopsbm>1#\x7Fpklqw#pwlqzslppjaof#wlwlsloldj`bo`qjwj`bo#leqfslqwfg#wlb#@kqjpwjbmgf`jpjlm#wljp#frvbo#wlsqlaofnp#leWkjp#`bm#afnfq`kbmgjpfelq#nlpw#leml#fujgfm`ffgjwjlmp#lefofnfmwp#jm%rvlw8-#Wkf`ln,jnbdfp,tkj`k#nbhfpwkf#sql`fppqfnbjmp#wkfojwfqbwvqf/jp#b#nfnafqwkf#slsvobqwkf#bm`jfmwsqlaofnp#jmwjnf#le#wkfgfefbwfg#azalgz#le#wkfb#eft#zfbqpnv`k#le#wkfwkf#tlqh#le@bojelqmjb/pfqufg#bp#bdlufqmnfmw-`lm`fswp#lenlufnfmw#jm\n\n?gju#jg>!jw!#ubovf>!obmdvbdf#lebp#wkfz#bqfsqlgv`fg#jmjp#wkbw#wkff{sobjm#wkfgju=?,gju=\tKltfufq#wkfofbg#wl#wkf\n?b#kqfe>!,tbp#dqbmwfgsflsof#kbuf`lmwjmvbooztbp#pffm#bpbmg#qfobwfgwkf#qlof#lesqlslpfg#azle#wkf#afpwfb`k#lwkfq-@lmpwbmwjmfsflsof#eqlngjbof`wp#lewl#qfujpjlmtbp#qfmbnfgb#plvq`f#lewkf#jmjwjboobvm`kfg#jmsqlujgf#wkfwl#wkf#tfpwtkfqf#wkfqfbmg#pjnjobqafwtffm#wtljp#bopl#wkfFmdojpk#bmg`lmgjwjlmp/wkbw#jw#tbpfmwjwofg#wlwkfnpfoufp-rvbmwjwz#leqbmpsbqfm`zwkf#pbnf#bpwl#iljm#wkf`lvmwqz#bmgwkjp#jp#wkfWkjp#ofg#wlb#pwbwfnfmw`lmwqbpw#wlobpwJmgf{Lewkqlvdk#kjpjp#gfpjdmfgwkf#wfqn#jpjp#sqlujgfgsqlwf`w#wkfmd?,b=?,oj=Wkf#`vqqfmwwkf#pjwf#lepvapwbmwjbof{sfqjfm`f/jm#wkf#Tfpwwkfz#pklvogpolufm(ajmb`lnfmwbqjlpvmjufqpjgbg`lmgj`jlmfpb`wjujgbgfpf{sfqjfm`jbwf`mlold/Absqlgv``j/_msvmwvb`j/_mbsoj`b`j/_m`lmwqbpf/]b`bwfdlq/Abpqfdjpwqbqpfsqlefpjlmbowqbwbnjfmwlqfd/Apwqbwfpf`qfwbq/Absqjm`jsbofpsqlwf``j/_mjnslqwbmwfpjnslqwbm`jbslpjajojgbgjmwfqfpbmwf`qf`jnjfmwlmf`fpjgbgfppvp`qjajqpfbpl`jb`j/_mgjpslmjaofpfubovb`j/_mfpwvgjbmwfpqfpslmpbaofqfplov`j/_mdvbgbobibqbqfdjpwqbglplslqwvmjgbg`lnfq`jbofpelwldqbe/Abbvwlqjgbgfpjmdfmjfq/Abwfofujpj/_m`lnsfwfm`jblsfqb`jlmfpfpwbaof`jglpjnsofnfmwfb`wvbonfmwfmbufdb`j/_m`lmelqnjgbgojmf.kfjdkw9elmw.ebnjoz9!#9#!kwws9,,bssoj`bwjlmpojmh!#kqfe>!psf`jej`booz,,?\"X@GBWBX\tLqdbmjybwjlmgjpwqjavwjlm3s{8#kfjdkw9qfobwjlmpkjsgfuj`f.tjgwk?gju#`obpp>!?obafo#elq>!qfdjpwqbwjlm?,mlp`qjsw=\t,jmgf{-kwno!tjmglt-lsfm+#\"jnslqwbmw8bssoj`bwjlm,jmgfsfmgfm`f,,ttt-dlldoflqdbmjybwjlmbvwl`lnsofwfqfrvjqfnfmwp`lmpfqubwjuf?elqn#mbnf>!jmwfoof`wvbonbqdjm.ofew92;wk#`fmwvqzbm#jnslqwbmwjmpwjwvwjlmpbaaqfujbwjlm?jnd#`obpp>!lqdbmjpbwjlm`jujojybwjlm2:wk#`fmwvqzbq`kjwf`wvqfjm`lqslqbwfg13wk#`fmwvqz.`lmwbjmfq!=nlpw#mlwbaoz,=?,b=?,gju=mlwjej`bwjlm$vmgfejmfg$*Evqwkfqnlqf/afojfuf#wkbwjmmfqKWNO#>#sqjlq#wl#wkfgqbnbwj`boozqfefqqjmd#wlmfdlwjbwjlmpkfbgrvbqwfqpPlvwk#Beqj`bvmpv``fppevoSfmmpzoubmjbBp#b#qfpvow/?kwno#obmd>!%ow8,pvs%dw8gfbojmd#tjwkskjobgfoskjbkjpwlqj`booz*8?,p`qjsw=\tsbggjmd.wls9f{sfqjnfmwbodfwBwwqjavwfjmpwqv`wjlmpwf`kmloldjfpsbqw#le#wkf#>evm`wjlm+*xpvap`qjswjlmo-gwg!=\x0E\t?kwdfldqbskj`bo@lmpwjwvwjlm$/#evm`wjlm+pvsslqwfg#azbdqj`vowvqbo`lmpwqv`wjlmsvaoj`bwjlmpelmw.pjyf9#2b#ubqjfwz#le?gju#pwzof>!Fm`z`olsfgjbjeqbnf#pq`>!gfnlmpwqbwfgb``lnsojpkfgvmjufqpjwjfpGfnldqbskj`p*8?,p`qjsw=?gfgj`bwfg#wlhmltofgdf#lepbwjpeb`wjlmsbqwj`vobqoz?,gju=?,gju=Fmdojpk#+VP*bssfmg@kjog+wqbmpnjppjlmp-#Kltfufq/#jmwfoojdfm`f!#wbajmgf{>!eolbw9qjdkw8@lnnlmtfbowkqbmdjmd#eqlnjm#tkj`k#wkfbw#ofbpw#lmfqfsqlgv`wjlmfm`z`olsfgjb8elmw.pjyf92ivqjpgj`wjlmbw#wkbw#wjnf!=?b#`obpp>!Jm#bggjwjlm/gfp`qjswjlm(`lmufqpbwjlm`lmwb`w#tjwkjp#dfmfqboozq!#`lmwfmw>!qfsqfpfmwjmd%ow8nbwk%dw8sqfpfmwbwjlml``bpjlmbooz?jnd#tjgwk>!mbujdbwjlm!=`lnsfmpbwjlm`kbnsjlmpkjsnfgjb>!boo!#ujlobwjlm#leqfefqfm`f#wlqfwvqm#wqvf8Pwqj`w,,FM!#wqbmpb`wjlmpjmwfqufmwjlmufqjej`bwjlmJmelqnbwjlm#gjeej`vowjfp@kbnsjlmpkjs`bsbajojwjfp?\"Xfmgje^..=~\t?,p`qjsw=\t@kqjpwjbmjwzelq#f{bnsof/Sqlefppjlmboqfpwqj`wjlmppvddfpw#wkbwtbp#qfofbpfg+pv`k#bp#wkfqfnluf@obpp+vmfnsolznfmwwkf#Bnfqj`bmpwqv`wvqf#le,jmgf{-kwno#svaojpkfg#jmpsbm#`obpp>!!=?b#kqfe>!,jmwqlgv`wjlmafolmdjmd#wl`objnfg#wkbw`lmpfrvfm`fp?nfwb#mbnf>!Dvjgf#wl#wkflufqtkfonjmdbdbjmpw#wkf#`lm`fmwqbwfg/\t-mlmwlv`k#lapfqubwjlmp?,b=\t?,gju=\te#+gl`vnfmw-alqgfq9#2s{#xelmw.pjyf92wqfbwnfmw#le3!#kfjdkw>!2nlgjej`bwjlmJmgfsfmgfm`fgjujgfg#jmwldqfbwfq#wkbmb`kjfufnfmwpfpwbaojpkjmdIbubP`qjsw!#mfufqwkfofpppjdmjej`bm`fAqlbg`bpwjmd=%maps8?,wg=`lmwbjmfq!=\tpv`k#bp#wkf#jmeovfm`f#leb#sbqwj`vobqpq`>$kwws9,,mbujdbwjlm!#kboe#le#wkf#pvapwbmwjbo#%maps8?,gju=bgubmwbdf#legjp`lufqz#leevmgbnfmwbo#nfwqlslojwbmwkf#lsslpjwf!#{no9obmd>!gfojafqbwfozbojdm>`fmwfqfulovwjlm#lesqfpfqubwjlmjnsqlufnfmwpafdjmmjmd#jmIfpvp#@kqjpwSvaoj`bwjlmpgjpbdqffnfmwwf{w.bojdm9q/#evm`wjlm+*pjnjobqjwjfpalgz=?,kwno=jp#`vqqfmwozboskbafwj`bojp#plnfwjnfpwzsf>!jnbdf,nbmz#le#wkf#eolt9kjggfm8bubjobaof#jmgfp`qjaf#wkff{jpwfm`f#leboo#lufq#wkfwkf#Jmwfqmfw\n?vo#`obpp>!jmpwboobwjlmmfjdkalqkllgbqnfg#elq`fpqfgv`jmd#wkf`lmwjmvfp#wlMlmfwkfofpp/wfnsfqbwvqfp\t\n\n?b#kqfe>!`olpf#wl#wkff{bnsofp#le#jp#balvw#wkf+pff#afolt*-!#jg>!pfbq`ksqlefppjlmbojp#bubjobaofwkf#leej`jbo\n\n?,p`qjsw=\t\t\n\n?gju#jg>!b``fofqbwjlmwkqlvdk#wkf#Kboo#le#Ebnfgfp`qjswjlmpwqbmpobwjlmpjmwfqefqfm`f#wzsf>$wf{w,qf`fmw#zfbqpjm#wkf#tlqogufqz#slsvobqxab`hdqlvmg9wqbgjwjlmbo#plnf#le#wkf#`lmmf`wfg#wlf{soljwbwjlmfnfqdfm`f#le`lmpwjwvwjlmB#Kjpwlqz#lepjdmjej`bmw#nbmveb`wvqfgf{sf`wbwjlmp=?mlp`qjsw=?`bm#af#elvmgaf`bvpf#wkf#kbp#mlw#affmmfjdkalvqjmdtjwklvw#wkf#bggfg#wl#wkf\n?oj#`obpp>!jmpwqvnfmwboPlujfw#Vmjlmb`hmltofgdfgtkj`k#`bm#afmbnf#elq#wkfbwwfmwjlm#wlbwwfnswp#wl#gfufolsnfmwpJm#eb`w/#wkf?oj#`obpp>!bjnsoj`bwjlmppvjwbaof#elqnv`k#le#wkf#`lolmjybwjlmsqfpjgfmwjbo`bm`foAvaaof#Jmelqnbwjlmnlpw#le#wkf#jp#gfp`qjafgqfpw#le#wkf#nlqf#lq#ofppjm#PfswfnafqJmwfoojdfm`fpq`>!kwws9,,s{8#kfjdkw9#bubjobaof#wlnbmveb`wvqfqkvnbm#qjdkwpojmh#kqfe>!,bubjobajojwzsqlslqwjlmbolvwpjgf#wkf#bpwqlmlnj`bokvnbm#afjmdpmbnf#le#wkf#bqf#elvmg#jmbqf#abpfg#lmpnboofq#wkbmb#sfqplm#tklf{sbmpjlm#lebqdvjmd#wkbwmlt#hmltm#bpJm#wkf#fbqozjmwfqnfgjbwfgfqjufg#eqlnP`bmgjmbujbm?,b=?,gju=\x0E\t`lmpjgfq#wkfbm#fpwjnbwfgwkf#Mbwjlmbo?gju#jg>!sbdqfpvowjmd#jm`lnnjppjlmfgbmboldlvp#wlbqf#qfrvjqfg,vo=\t?,gju=\ttbp#abpfg#lmbmg#af`bnf#b%maps8%maps8w!#ubovf>!!#tbp#`bswvqfgml#nlqf#wkbmqfpsf`wjufoz`lmwjmvf#wl#=\x0E\t?kfbg=\x0E\t?tfqf#`qfbwfgnlqf#dfmfqbojmelqnbwjlm#vpfg#elq#wkfjmgfsfmgfmw#wkf#Jnsfqjbo`lnslmfmw#lewl#wkf#mlqwkjm`ovgf#wkf#@lmpwqv`wjlmpjgf#le#wkf#tlvog#mlw#afelq#jmpwbm`fjmufmwjlm#lenlqf#`lnsof{`loof`wjufozab`hdqlvmg9#wf{w.bojdm9#jwp#lqjdjmbojmwl#b``lvmwwkjp#sql`fppbm#f{wfmpjufkltfufq/#wkfwkfz#bqf#mlwqfif`wfg#wkf`qjwj`jpn#legvqjmd#tkj`ksqlabaoz#wkfwkjp#bqwj`of+evm`wjlm+*xJw#pklvog#afbm#bdqffnfmwb``jgfmwboozgjeefqp#eqlnBq`kjwf`wvqfafwwfq#hmltmbqqbmdfnfmwpjmeovfm`f#lmbwwfmgfg#wkfjgfmwj`bo#wlplvwk#le#wkfsbpp#wkqlvdk{no!#wjwof>!tfjdkw9alog8`qfbwjmd#wkfgjpsobz9mlmfqfsob`fg#wkf?jnd#pq`>!,jkwwsp9,,ttt-Tlqog#Tbq#JJwfpwjnlmjbopelvmg#jm#wkfqfrvjqfg#wl#bmg#wkbw#wkfafwtffm#wkf#tbp#gfpjdmfg`lmpjpwp#le#`lmpjgfqbaozsvaojpkfg#azwkf#obmdvbdf@lmpfqubwjlm`lmpjpwfg#leqfefq#wl#wkfab`h#wl#wkf#`pp!#nfgjb>!Sflsof#eqln#bubjobaof#lmsqlufg#wl#afpvddfpwjlmp!tbp#hmltm#bpubqjfwjfp#leojhfoz#wl#af`lnsqjpfg#lepvsslqw#wkf#kbmgp#le#wkf`lvsofg#tjwk`lmmf`w#bmg#alqgfq9mlmf8sfqelqnbm`fpafelqf#afjmdobwfq#af`bnf`bo`vobwjlmplewfm#`boofgqfpjgfmwp#lenfbmjmd#wkbw=?oj#`obpp>!fujgfm`f#elqf{sobmbwjlmpfmujqlmnfmwp!=?,b=?,gju=tkj`k#booltpJmwqlgv`wjlmgfufolsfg#azb#tjgf#qbmdflm#afkboe#leubojdm>!wls!sqjm`jsof#lebw#wkf#wjnf/?,mlp`qjsw=\x0Epbjg#wl#kbufjm#wkf#ejqpwtkjof#lwkfqpkzslwkfwj`boskjolplskfqpsltfq#le#wkf`lmwbjmfg#jmsfqelqnfg#azjmbajojwz#wltfqf#tqjwwfmpsbm#pwzof>!jmsvw#mbnf>!wkf#rvfpwjlmjmwfmgfg#elqqfif`wjlm#lejnsojfp#wkbwjmufmwfg#wkfwkf#pwbmgbqgtbp#sqlabaozojmh#afwtffmsqlefpplq#lejmwfqb`wjlmp`kbmdjmd#wkfJmgjbm#L`fbm#`obpp>!obpwtlqhjmd#tjwk$kwws9,,ttt-zfbqp#afelqfWkjp#tbp#wkfqf`qfbwjlmbofmwfqjmd#wkfnfbpvqfnfmwpbm#f{wqfnfozubovf#le#wkfpwbqw#le#wkf\t?,p`qjsw=\t\tbm#feelqw#wljm`qfbpf#wkfwl#wkf#plvwkpsb`jmd>!3!=pveej`jfmwozwkf#Fvqlsfbm`lmufqwfg#wl`ofbqWjnflvwgjg#mlw#kbuf`lmpfrvfmwozelq#wkf#mf{wf{wfmpjlm#lef`lmlnj`#bmgbowklvdk#wkfbqf#sqlgv`fgbmg#tjwk#wkfjmpveej`jfmwdjufm#az#wkfpwbwjmd#wkbwf{sfmgjwvqfp?,psbm=?,b=\twklvdkw#wkbwlm#wkf#abpjp`foosbggjmd>jnbdf#le#wkfqfwvqmjmd#wljmelqnbwjlm/pfsbqbwfg#azbppbppjmbwfgp!#`lmwfmw>!bvwklqjwz#lemlqwktfpwfqm?,gju=\t?gju#!=?,gju=\x0E\t##`lmpvowbwjlm`lnnvmjwz#lewkf#mbwjlmbojw#pklvog#afsbqwj`jsbmwp#bojdm>!ofewwkf#dqfbwfpwpfof`wjlm#lepvsfqmbwvqbogfsfmgfmw#lmjp#nfmwjlmfgbooltjmd#wkftbp#jmufmwfgb``lnsbmzjmdkjp#sfqplmbobubjobaof#bwpwvgz#le#wkflm#wkf#lwkfqf{f`vwjlm#leKvnbm#Qjdkwpwfqnp#le#wkfbppl`jbwjlmpqfpfbq`k#bmgpv``ffgfg#azgfefbwfg#wkfbmg#eqln#wkfavw#wkfz#bqf`lnnbmgfq#lepwbwf#le#wkfzfbqp#le#bdfwkf#pwvgz#le?vo#`obpp>!psob`f#jm#wkftkfqf#kf#tbp?oj#`obpp>!ewkfqf#bqf#mltkj`k#af`bnfkf#svaojpkfgf{sqfppfg#jmwl#tkj`k#wkf`lnnjppjlmfqelmw.tfjdkw9wfqqjwlqz#lef{wfmpjlmp!=Qlnbm#Fnsjqffrvbo#wl#wkfJm#`lmwqbpw/kltfufq/#bmgjp#wzsj`boozbmg#kjp#tjef+bopl#`boofg=?vo#`obpp>!feef`wjufoz#fuloufg#jmwlpffn#wl#kbuftkj`k#jp#wkfwkfqf#tbp#mlbm#f{`foofmwboo#le#wkfpfgfp`qjafg#azJm#sqb`wj`f/aqlbg`bpwjmd`kbqdfg#tjwkqfeof`wfg#jmpvaif`wfg#wlnjojwbqz#bmgwl#wkf#sljmwf`lmlnj`boozpfwWbqdfwjmdbqf#b`wvboozuj`wlqz#lufq+*8?,p`qjsw=`lmwjmvlvpozqfrvjqfg#elqfulovwjlmbqzbm#feef`wjufmlqwk#le#wkf/#tkj`k#tbp#eqlmw#le#wkflq#lwkfqtjpfplnf#elqn#lekbg#mlw#affmdfmfqbwfg#azjmelqnbwjlm-sfqnjwwfg#wljm`ovgfp#wkfgfufolsnfmw/fmwfqfg#jmwlwkf#sqfujlvp`lmpjpwfmwozbqf#hmltm#bpwkf#ejfog#lewkjp#wzsf#ledjufm#wl#wkfwkf#wjwof#le`lmwbjmp#wkfjmpwbm`fp#lejm#wkf#mlqwkgvf#wl#wkfjqbqf#gfpjdmfg`lqslqbwjlmptbp#wkbw#wkflmf#le#wkfpfnlqf#slsvobqpv``ffgfg#jmpvsslqw#eqlnjm#gjeefqfmwglnjmbwfg#azgfpjdmfg#elqltmfqpkjs#lebmg#slppjaozpwbmgbqgjyfgqfpslmpfWf{wtbp#jmwfmgfgqf`fjufg#wkfbppvnfg#wkbwbqfbp#le#wkfsqjnbqjoz#jmwkf#abpjp#lejm#wkf#pfmpfb``lvmwp#elqgfpwqlzfg#azbw#ofbpw#wtltbp#gf`obqfg`lvog#mlw#afPf`qfwbqz#lebssfbq#wl#afnbqdjm.wls92,]_p(\x7F_p(',df*xwkqlt#f~8wkf#pwbqw#lewtl#pfsbqbwfobmdvbdf#bmgtkl#kbg#affmlsfqbwjlm#legfbwk#le#wkfqfbo#mvnafqp\n?ojmh#qfo>!sqlujgfg#wkfwkf#pwlqz#le`lnsfwjwjlmpfmdojpk#+VH*fmdojpk#+VP*<p<R<Q<_<R<W<M=l<S=m<V<T=m=l<S=m<V<T=m=l<S=m<V<R5h4U4]4D5f4E\nAO\x05Gx\bTA\nzk\x0BBl\bQ\x7F\bTA\nzk\x0BUm\bQ\x7F\bTA\nzk\npe\x05u|\ti@\tcT\bVV\n\\}\nxS\tVp\x05tS\x05k`\t[X\t[X\x0BHR\bPv\bTW\bUe\n\x7Fa\bQp\x0B_W\x0BWs\nxS\x0BAz\n_y\x04Khjmelqnb`j/_mkfqqbnjfmwbpfof`wq/_mj`lgfp`qjs`j/_m`obpjej`bglp`lml`jnjfmwlsvaoj`b`j/_mqfob`jlmbgbpjmelqn/Mwj`bqfob`jlmbglpgfsbqwbnfmwlwqbabibglqfpgjqf`wbnfmwfbzvmwbnjfmwlnfq`bglOjaqf`lmw/M`wfmlpkbajwb`jlmfp`vnsojnjfmwlqfpwbvqbmwfpgjpslpj`j/_m`lmpf`vfm`jbfof`wq/_mj`bbsoj`b`jlmfpgfp`lmf`wbgljmpwbob`j/_mqfbojyb`j/_mvwjojyb`j/_mfm`j`olsfgjbfmefqnfgbgfpjmpwqvnfmwlpf{sfqjfm`jbpjmpwjwv`j/_msbqwj`vobqfppva`bwfdlqjb=n<R<W=`<V<R<L<R=m=m<T<T=l<\\<]<R=n=g<]<R<W=`=d<Y<S=l<R=m=n<R<P<R<Z<Y=n<Y<X=l=o<_<T=i=m<W=o=k<\\<Y=m<Y<U=k<\\=m<^=m<Y<_<X<\\<L<R=m=m<T=c<p<R=m<V<^<Y<X=l=o<_<T<Y<_<R=l<R<X<\\<^<R<S=l<R=m<X<\\<Q<Q=g=i<X<R<W<Z<Q=g<T<P<Y<Q<Q<R<p<R=m<V<^=g=l=o<]<W<Y<U<p<R=m<V<^<\\=m=n=l<\\<Q=g<Q<T=k<Y<_<R=l<\\<]<R=n<Y<X<R<W<Z<Y<Q=o=m<W=o<_<T=n<Y<S<Y=l=`<r<X<Q<\\<V<R<S<R=n<R<P=o=l<\\<]<R=n=o<\\<S=l<Y<W=c<^<R<R<]=e<Y<R<X<Q<R<_<R=m<^<R<Y<_<R=m=n<\\=n=`<T<X=l=o<_<R<U=h<R=l=o<P<Y=i<R=l<R=d<R<S=l<R=n<T<^=m=m=g<W<V<\\<V<\\<Z<X=g<U<^<W<\\=m=n<T<_=l=o<S<S=g<^<P<Y=m=n<Y=l<\\<]<R=n<\\=m<V<\\<[<\\<W<S<Y=l<^=g<U<X<Y<W<\\=n=`<X<Y<Q=`<_<T<S<Y=l<T<R<X<]<T<[<Q<Y=m<R=m<Q<R<^<Y<P<R<P<Y<Q=n<V=o<S<T=n=`<X<R<W<Z<Q<\\=l<\\<P<V<\\=i<Q<\\=k<\\<W<R<L<\\<]<R=n<\\<N<R<W=`<V<R=m<R<^=m<Y<P<^
vendor: 4,592 bytes, line 16514
16514=n<R=l<R<U<Q<\\=k<\\<W<\\=m<S<T=m<R<V=m<W=o<Z<]=g=m<T=m=n<Y<P<S<Y=k<\\=n<T<Q<R<^<R<_<R<S<R<P<R=e<T=m<\\<U=n<R<^<S<R=k<Y<P=o<S<R<P<R=e=`<X<R<W<Z<Q<R=m=m=g<W<V<T<]=g=m=n=l<R<X<\\<Q<Q=g<Y<P<Q<R<_<T<Y<S=l<R<Y<V=n<M<Y<U=k<\\=m<P<R<X<Y<W<T=n<\\<V<R<_<R<R<Q<W<\\<U<Q<_<R=l<R<X<Y<^<Y=l=m<T=c=m=n=l<\\<Q<Y=h<T<W=`<P=g=o=l<R<^<Q=c=l<\\<[<Q=g=i<T=m<V<\\=n=`<Q<Y<X<Y<W=b=c<Q<^<\\=l=c<P<Y<Q=`=d<Y<P<Q<R<_<T=i<X<\\<Q<Q<R<U<[<Q<\\=k<T=n<Q<Y<W=`<[=c=h<R=l=o<P<\\<N<Y<S<Y=l=`<P<Y=m=c=j<\\<[<\\=e<T=n=g<w=o=k=d<T<Y\fHD\fHU\fIl\fHn\fHy\fH\\\fHD\fIk\fHi\fHF\fHD\fIk\fHy\fHS\fHC\fHR\fHy\fH\\\fIk\fHn\fHi\fHD\fIa\fHC\fHy\fIa\fHC\fHR\fH{\fHR\fHk\fHM\fH@\fHR\fH\\\fIk\fHy\fHS\fHT\fIl\fHJ\fHS\fHC\fHR\fHF\fHU\fH^\fIk\fHT\fHS\fHn\fHU\fHA\fHR\fH\\\fHH\fHi\fHF\fHD\fIl\fHY\fHR\fH^\fIk\fHT\fIk\fHY\fHR\fHy\fH\\\fHH\fIk\fHB\fIk\fH\\\fIk\fHU\fIg\fHD\fIk\fHT\fHy\fHH\fIk\fH@\fHU\fIm\fHH\fHT\fHR\fHk\fHs\fHU\fIg\fH{\fHR\fHp\fHR\fHD\fIk\fHB\fHS\fHD\fHs\fHy\fH\\\fHH\fHR\fHy\fH\\\fHD\fHR\fHe\fHD\fHy\fIk\fHC\fHU\fHR\fHm\fHT\fH@\fHT\fIk\fHA\fHR\fH[\fHR\fHj\fHF\fHy\fIk\fH^\fHS\fHC\fIk\fHZ\fIm\fH\\\fIn\fHk\fHT\fHy\fIk\fHt\fHn\fHs\fIk\fHB\fIk\fH\\\fIl\fHT\fHy\fHH\fHR\fHB\fIk\fH\\\fHR\fH^\fIk\fHy\fH\\\fHi\fHK\fHS\fHy\fHi\fHF\fHD\fHR\fHT\fHB\fHR\fHp\fHB\fIm\fHq\fIk\fHy\fHR\fH\\\fHO\fHU\fIg\fHH\fHR\fHy\fHM\fHP\fIl\fHC\fHU\fHR\fHn\fHU\fIg\fHs\fH^\fHZ\fH@\fIa\fHJ\fH^\fHS\fHC\fHR\fHp\fIl\fHY\fHD\fHp\fHR\fHH\fHR\fHy\fId\fHT\fIk\fHj\fHF\fHy\fHR\fHY\fHR\fH^\fIl\fHJ\fIk\fHD\fIk\fHF\fIn\fH\\\fIl\fHF\fHR\fHD\fIl\fHe\fHT\fHy\fIk\fHU\fIg\fH{\fIl\fH@\fId\fHL\fHy\fHj\fHF\fHy\fIl\fHY\fH\\\fIa\fH[\fH{\fHR\fHn\fHY\fHj\fHF\fHy\fIg\fHp\fHS\fH^\fHR\fHp\fHR\fHD\fHR\fHT\fHU\fHB\fHH\fHU\fHB\fIk\fHn\fHe\fHD\fHy\fIl\fHC\fHR\fHU\fIn\fHJ\fH\\\fIa\fHp\fHT\fIn\fHv\fIl\fHF\fHT\fHn\fHJ\fHT\fHY\fHR\fH^\fHU\fIg\fHD\fHR\fHU\fIg\fHH\fIl\fHp\fId\fHT\fIk\fHY\fHR\fHF\fHT\fHp\fHD\fHH\fHR\fHD\fIk\fHH\fHR\fHp\fHR\fH\\\fIl\fHt\fHR\fHC\fH^\fHp\fHS\fH^\fIk\fHD\fIl\fHv\fIk\fHp\fHR\fHn\fHv\fHF\fHH\fIa\fH\\\fH{\fIn\fH{\fH^\fHp\fHR\fHH\fIk\fH@\fHR\fHU\fH\\\fHj\fHF\fHD\fIk\fHY\fHR\fHU\fHD\fHk\fHT\fHy\fHR\fHT\fIm\fH@\fHU\fH\\\fHU\fHD\fIk\fHk\fHT\fHT\fIk\fHT\fHU\fHS\fHH\fH@\fHM\fHP\fIk\fHt\fHs\fHD\fHR\fHH\fH^\fHR\fHZ\fHF\fHR\fHn\fHv\fHZ\fIa\fH\\\fIl\fH@\fHM\fHP\fIl\fHU\fIg\fHH\fIk\fHT\fHR\fHd\fHs\fHZ\fHR\fHC\fHJ\fHT\fHy\fHH\fIl\fHp\fHR\fHH\fIl\fHY\fHR\fH^\fHR\fHU\fHp\fHR\fH\\\fHF\fHs\fHD\fHR\fH\\\fHz\fHD\fIk\fHT\fHM\fHP\fHy\fHB\fHS\fH^\fHR\fHe\fHT\fHy\fIl\fHy\fIk\fHY\fH^\fH^\fH{\fHH\fHR\fHz\fHR\fHD\fHR\fHi\fH\\\fIa\fHI\fHp\fHU\fHR\fHn\fHJ\fIk\fHz\fHR\fHF\fHU\fH^\fIl\fHD\fHS\fHC\fHB\fH@\fHS\fHD\fHR\fH@\fId\fHn\fHy\fHy\fHU\fIl\fHn\fHy\fHU\fHD\fHR\fHJ\fIk\fHH\fHR\fHU\fHB\fH^\fIk\fHy\fHR\fHG\fIl\fHp\fH@\fHy\fHS\fHH\fIm\fH\\\fHH\fHB\fHR\fHn\fH{\fHY\fHU\fIl\fHn\fH\\\fIg\fHp\fHP\fHB\fHS\fH^\fIl\fHj\fH\\\fIg\fHF\fHT\fIk\fHD\fHR\fHC\fHR\fHJ\fHY\fH^\fIk\fHD\fIk\fHz\fHR\fHH\fHR\fHy\fH\\\fIl\fH@\fHe\fHD\fHy\fHR\fHp\fHY\fHR\fH@\fHF\fIn\fH\\\fHR\fH@\fHM\fHP\fHR\fHT\fI`\fHJ\fHR\fHZ\fIk\fHC\fH\\\fHy\fHS\fHC\fIk\fHy\fHU\fHR\fHn\fHi\fHy\fHT\fH\\\fH@\fHD\fHR\fHc\fHY\fHU\fHR\fHn\fHT\fIa\fHI\fH^\fHB\fHS\fH^\fIk\fH^\fIk\fHz\fHy\fHY\fHS\fH[\fHC\fHy\fIa\fH\\\fHn\fHT\fHB\fIn\fHU\fHI\fHR\fHD\fHR4F4_4F4[5f4U5i4X4K4]5o4E4D5d4K4_4[4E4K5h4Y5m4A4E5i5d4K4Z5f4U4K5h4B4K4Y4E4K5h5i4^5f4C4K5h4U4K5i4E4K5h5o4K4F4D4K5h4]4C5d4C4D4]5j4K5i4@4K5h4C5d5h4E4K5h4U4K5h5i4K5h5i5d5n4U4K5h4U4]4D5f4K5h4_4]5f4U4K5h4@5d4K5h4K5h4\\5k4K4D4K5h4A5f4K4E4K5h4A5n5d5n4K5h5o4]5f5i4K5h4U4]4K5n5i4A5m5d4T4E4K5h4G4K5j5f5i4X4K5k4C4E4K5h5i4]4O4E4K5h5n4]4N5j4K5h4X4D4K4D4K5h4A5d4K4]4K5h4@4C5f4C4K5h4O4_4]4E4K5h4U5h5d5i5i4@5i5d4U4E4K5h4]4A5i5j4K5h5j5n4K4[5m5h4_4[5f5j4K5h5o5d5f4F4K5h4C5j5f4K4D4]5o4K4F5k4K5h4]5f4K4Z4F4A5f4K4F5f4D4F5d5n5f4F4K5h4O5d5h5e4K5h4D4]5f4C4K5h5o5h4K5i4K5h4]4K4D4[4K5h4X4B4Y5f4_5f4K4]4K4F4K5h4G4K5h4G4K5h4Y5h4K4E4K5h4A4C5f4G4K5h4^5d4K4]4K5h4B5h5f4@4K5h4@5i5f4U4K5h4U4K5i5k4K5h4@5i4K5h4K5h4_4K4U4E5i4X4K5k4C5k4K5h4]4J5f4_4K5h4C4B5d5h4K5h5m5j5f4E4K5h5o4F4K4D4K5h4C5d4]5f4K5h4C4]5d4_4K4_4F4V4]5n4F4Y4K5i5f5i4K5h4D5j4K4F4K5h4U4T5f5ifmwfqwbjmnfmwvmgfqpwbmgjmd#>#evm`wjlm+*-isd!#tjgwk>!`lmejdvqbwjlm-smd!#tjgwk>!?algz#`obpp>!Nbwk-qbmgln+*`lmwfnslqbqz#Vmjwfg#Pwbwfp`jq`vnpwbm`fp-bssfmg@kjog+lqdbmjybwjlmp?psbm#`obpp>!!=?jnd#pq`>!,gjpwjmdvjpkfgwklvpbmgp#le#`lnnvmj`bwjlm`ofbq!=?,gju=jmufpwjdbwjlmebuj`lm-j`l!#nbqdjm.qjdkw9abpfg#lm#wkf#Nbppb`kvpfwwpwbaof#alqgfq>jmwfqmbwjlmbobopl#hmltm#bpsqlmvm`jbwjlmab`hdqlvmg9 esbggjmd.ofew9Elq#f{bnsof/#njp`foobmflvp%ow8,nbwk%dw8spz`kloldj`bojm#sbqwj`vobqfbq`k!#wzsf>!elqn#nfwklg>!bp#lsslpfg#wlPvsqfnf#@lvqwl``bpjlmbooz#Bggjwjlmbooz/Mlqwk#Bnfqj`bs{8ab`hdqlvmglsslqwvmjwjfpFmwfqwbjmnfmw-wlOltfq@bpf+nbmveb`wvqjmdsqlefppjlmbo#`lnajmfg#tjwkElq#jmpwbm`f/`lmpj
vendor: 39,931 bytes, lines 16514-16605
16514pwjmd#le!#nb{ofmdwk>!qfwvqm#ebopf8`lmp`jlvpmfppNfgjwfqqbmfbmf{wqblqgjmbqzbppbppjmbwjlmpvapfrvfmwoz#avwwlm#wzsf>!wkf#mvnafq#lewkf#lqjdjmbo#`lnsqfkfmpjufqfefqp#wl#wkf?,vo=\t?,gju=\tskjolplskj`bool`bwjlm-kqfetbp#svaojpkfgPbm#Eqbm`jp`l+evm`wjlm+*x\t?gju#jg>!nbjmplskjpwj`bwfgnbwkfnbwj`bo#,kfbg=\x0E\t?algzpvddfpwp#wkbwgl`vnfmwbwjlm`lm`fmwqbwjlmqfobwjlmpkjspnbz#kbuf#affm+elq#f{bnsof/Wkjp#bqwj`of#jm#plnf#`bpfpsbqwp#le#wkf#gfejmjwjlm#leDqfbw#Aqjwbjm#`foosbggjmd>frvjubofmw#wlsob`fklogfq>!8#elmw.pjyf9#ivpwjej`bwjlmafojfufg#wkbwpveefqfg#eqlnbwwfnswfg#wl#ofbgfq#le#wkf`qjsw!#pq`>!,+evm`wjlm+*#xbqf#bubjobaof\t\n?ojmh#qfo>!#pq`>$kwws9,,jmwfqfpwfg#jm`lmufmwjlmbo#!#bow>!!#,=?,bqf#dfmfqboozkbp#bopl#affmnlpw#slsvobq#`lqqfpslmgjmd`qfgjwfg#tjwkwzof>!alqgfq9?,b=?,psbm=?,-dje!#tjgwk>!?jeqbnf#pq`>!wbaof#`obpp>!jmojmf.aol`h8b``lqgjmd#wl#wldfwkfq#tjwkbssql{jnbwfozsbqojbnfmwbqznlqf#bmg#nlqfgjpsobz9mlmf8wqbgjwjlmboozsqfglnjmbmwoz%maps8\x7F%maps8%maps8?,psbm=#`foopsb`jmd>?jmsvw#mbnf>!lq!#`lmwfmw>!`lmwqlufqpjbosqlsfqwz>!ld9,{.pkl`htbuf.gfnlmpwqbwjlmpvqqlvmgfg#azMfufqwkfofpp/tbp#wkf#ejqpw`lmpjgfqbaof#Bowklvdk#wkf#`loobalqbwjlmpklvog#mlw#afsqlslqwjlm#le?psbm#pwzof>!hmltm#bp#wkf#pklqwoz#bewfqelq#jmpwbm`f/gfp`qjafg#bp#,kfbg=\t?algz#pwbqwjmd#tjwkjm`qfbpjmdoz#wkf#eb`w#wkbwgjp`vppjlm#lenjggof#le#wkfbm#jmgjujgvbogjeej`vow#wl#sljmw#le#ujftklnlpf{vbojwzb``fswbm`f#le?,psbm=?,gju=nbmveb`wvqfqplqjdjm#le#wkf`lnnlmoz#vpfgjnslqwbm`f#legfmlnjmbwjlmpab`hdqlvmg9# ofmdwk#le#wkfgfwfqnjmbwjlmb#pjdmjej`bmw!#alqgfq>!3!=qfulovwjlmbqzsqjm`jsofp#lejp#`lmpjgfqfgtbp#gfufolsfgJmgl.Fvqlsfbmuvomfqbaof#wlsqlslmfmwp#lebqf#plnfwjnfp`olpfq#wl#wkfMft#Zlqh#@jwz#mbnf>!pfbq`kbwwqjavwfg#wl`lvqpf#le#wkfnbwkfnbwj`jbmaz#wkf#fmg#lebw#wkf#fmg#le!#alqgfq>!3!#wf`kmloldj`bo-qfnluf@obpp+aqbm`k#le#wkffujgfm`f#wkbw\"Xfmgje^..=\x0E\tJmpwjwvwf#le#jmwl#b#pjmdofqfpsf`wjufoz-bmg#wkfqfelqfsqlsfqwjfp#lejp#ol`bwfg#jmplnf#le#tkj`kWkfqf#jp#bopl`lmwjmvfg#wl#bssfbqbm`f#le#%bns8mgbpk8#gfp`qjafp#wkf`lmpjgfqbwjlmbvwklq#le#wkfjmgfsfmgfmwozfrvjssfg#tjwkglfp#mlw#kbuf?,b=?b#kqfe>!`lmevpfg#tjwk?ojmh#kqfe>!,bw#wkf#bdf#lebssfbq#jm#wkfWkfpf#jm`ovgfqfdbqgofpp#le`lvog#af#vpfg#pwzof>%rvlw8pfufqbo#wjnfpqfsqfpfmw#wkfalgz=\t?,kwno=wklvdkw#wl#afslsvobwjlm#leslppjajojwjfpsfq`fmwbdf#leb``fpp#wl#wkfbm#bwwfnsw#wlsqlgv`wjlm#leirvfqz,irvfqzwtl#gjeefqfmwafolmd#wl#wkffpwbaojpknfmwqfsob`jmd#wkfgfp`qjswjlm!#gfwfqnjmf#wkfbubjobaof#elqB``lqgjmd#wl#tjgf#qbmdf#le\n?gju#`obpp>!nlqf#`lnnlmozlqdbmjpbwjlmpevm`wjlmbojwztbp#`lnsofwfg#%bns8ngbpk8#sbqwj`jsbwjlmwkf#`kbqb`wfqbm#bggjwjlmbobssfbqp#wl#afeb`w#wkbw#wkfbm#f{bnsof#lepjdmjej`bmwozlmnlvpflufq>!af`bvpf#wkfz#bpzm`#>#wqvf8sqlaofnp#tjwkpffnp#wl#kbufwkf#qfpvow#le#pq`>!kwws9,,ebnjojbq#tjwkslppfppjlm#leevm`wjlm#+*#xwllh#sob`f#jmbmg#plnfwjnfppvapwbmwjbooz?psbm=?,psbm=jp#lewfm#vpfgjm#bm#bwwfnswdqfbw#gfbo#leFmujqlmnfmwbopv``fppevooz#ujqwvbooz#boo13wk#`fmwvqz/sqlefppjlmbopmf`fppbqz#wl#gfwfqnjmfg#az`lnsbwjajojwzaf`bvpf#jw#jpGj`wjlmbqz#lenlgjej`bwjlmpWkf#elooltjmdnbz#qfefq#wl9@lmpfrvfmwoz/Jmwfqmbwjlmbobowklvdk#plnfwkbw#tlvog#aftlqog$p#ejqpw`obppjejfg#bpalwwln#le#wkf+sbqwj`vobqozbojdm>!ofew!#nlpw#`lnnlmozabpjp#elq#wkfelvmgbwjlm#le`lmwqjavwjlmpslsvobqjwz#le`fmwfq#le#wkfwl#qfgv`f#wkfivqjpgj`wjlmpbssql{jnbwjlm#lmnlvpflvw>!Mft#Wfpwbnfmw`loof`wjlm#le?,psbm=?,b=?,jm#wkf#Vmjwfgejon#gjqf`wlq.pwqj`w-gwg!=kbp#affm#vpfgqfwvqm#wl#wkfbowklvdk#wkjp`kbmdf#jm#wkfpfufqbo#lwkfqavw#wkfqf#bqfvmsqf`fgfmwfgjp#pjnjobq#wlfpsf`jbooz#jmtfjdkw9#alog8jp#`boofg#wkf`lnsvwbwjlmbojmgj`bwf#wkbwqfpwqj`wfg#wl\n?nfwb#mbnf>!bqf#wzsj`booz`lmeoj`w#tjwkKltfufq/#wkf#Bm#f{bnsof#le`lnsbqfg#tjwkrvbmwjwjfp#leqbwkfq#wkbm#b`lmpwfoobwjlmmf`fppbqz#elqqfslqwfg#wkbwpsf`jej`bwjlmslojwj`bo#bmg%maps8%maps8?qfefqfm`fp#wlwkf#pbnf#zfbqDlufqmnfmw#ledfmfqbwjlm#lekbuf#mlw#affmpfufqbo#zfbqp`lnnjwnfmw#wl\n\n?vo#`obpp>!ujpvbojybwjlm2:wk#`fmwvqz/sqb`wjwjlmfqpwkbw#kf#tlvogbmg#`lmwjmvfgl``vsbwjlm#lejp#gfejmfg#bp`fmwqf#le#wkfwkf#bnlvmw#le=?gju#pwzof>!frvjubofmw#legjeefqfmwjbwfaqlvdkw#balvwnbqdjm.ofew9#bvwlnbwj`boozwklvdkw#le#bpPlnf#le#wkfpf\t?gju#`obpp>!jmsvw#`obpp>!qfsob`fg#tjwkjp#lmf#le#wkffgv`bwjlm#bmgjmeovfm`fg#azqfsvwbwjlm#bp\t?nfwb#mbnf>!b``lnnlgbwjlm?,gju=\t?,gju=obqdf#sbqw#leJmpwjwvwf#elqwkf#pl.`boofg#bdbjmpw#wkf#Jm#wkjp#`bpf/tbp#bssljmwfg`objnfg#wl#afKltfufq/#wkjpGfsbqwnfmw#lewkf#qfnbjmjmdfeef`w#lm#wkfsbqwj`vobqoz#gfbo#tjwk#wkf\t?gju#pwzof>!bonlpw#botbzpbqf#`vqqfmwozf{sqfppjlm#leskjolplskz#leelq#nlqf#wkbm`jujojybwjlmplm#wkf#jpobmgpfof`wfgJmgf{`bm#qfpvow#jm!#ubovf>!!#,=wkf#pwqv`wvqf#,=?,b=?,gju=Nbmz#le#wkfpf`bvpfg#az#wkfle#wkf#Vmjwfgpsbm#`obpp>!n`bm#af#wqb`fgjp#qfobwfg#wlaf`bnf#lmf#lejp#eqfrvfmwozojujmd#jm#wkfwkflqfwj`boozElooltjmd#wkfQfulovwjlmbqzdlufqmnfmw#jmjp#gfwfqnjmfgwkf#slojwj`bojmwqlgv`fg#jmpveej`jfmw#wlgfp`qjswjlm!=pklqw#pwlqjfppfsbqbwjlm#lebp#wl#tkfwkfqhmltm#elq#jwptbp#jmjwjboozgjpsobz9aol`hjp#bm#f{bnsofwkf#sqjm`jsbo`lmpjpwp#le#bqf`ldmjyfg#bp,algz=?,kwno=b#pvapwbmwjboqf`lmpwqv`wfgkfbg#le#pwbwfqfpjpwbm`f#wlvmgfqdqbgvbwfWkfqf#bqf#wtldqbujwbwjlmbobqf#gfp`qjafgjmwfmwjlmboozpfqufg#bp#wkf`obpp>!kfbgfqlsslpjwjlm#wlevmgbnfmwboozglnjmbwfg#wkfbmg#wkf#lwkfqboojbm`f#tjwktbp#elq`fg#wlqfpsf`wjufoz/bmg#slojwj`bojm#pvsslqw#lesflsof#jm#wkf13wk#`fmwvqz-bmg#svaojpkfgolbg@kbqwafbwwl#vmgfqpwbmgnfnafq#pwbwfpfmujqlmnfmwboejqpw#kboe#le`lvmwqjfp#bmgbq`kjwf`wvqboaf#`lmpjgfqfg`kbqb`wfqjyfg`ofbqJmwfqubobvwklqjwbwjufEfgfqbwjlm#letbp#pv``ffgfgbmg#wkfqf#bqfb#`lmpfrvfm`fwkf#Sqfpjgfmwbopl#jm`ovgfgeqff#plewtbqfpv``fppjlm#legfufolsfg#wkftbp#gfpwqlzfgbtbz#eqln#wkf8\t?,p`qjsw=\t?bowklvdk#wkfzelooltfg#az#bnlqf#sltfqevoqfpvowfg#jm#bVmjufqpjwz#leKltfufq/#nbmzwkf#sqfpjgfmwKltfufq/#plnfjp#wklvdkw#wlvmwjo#wkf#fmgtbp#bmmlvm`fgbqf#jnslqwbmwbopl#jm`ovgfp=?jmsvw#wzsf>wkf#`fmwfq#le#GL#MLW#BOWFQvpfg#wl#qfefqwkfnfp,<plqw>wkbw#kbg#affmwkf#abpjp#elqkbp#gfufolsfgjm#wkf#pvnnfq`lnsbqbwjufozgfp`qjafg#wkfpv`k#bp#wklpfwkf#qfpvowjmdjp#jnslppjaofubqjlvp#lwkfqPlvwk#Beqj`bmkbuf#wkf#pbnffeef`wjufmfppjm#tkj`k#`bpf8#wf{w.bojdm9pwqv`wvqf#bmg8#ab`hdqlvmg9qfdbqgjmd#wkfpvsslqwfg#wkfjp#bopl#hmltmpwzof>!nbqdjmjm`ovgjmd#wkfabkbpb#Nfobzvmlqph#alhn/Iomlqph#mzmlqphpolufm)M(ajmbjmwfqmb`jlmbo`bojej`b`j/_m`lnvmj`b`j/_m`lmpwqv``j/_m!=?gju#`obpp>!gjpbnajdvbwjlmGlnbjmMbnf$/#$bgnjmjpwqbwjlmpjnvowbmflvpozwqbmpslqwbwjlmJmwfqmbwjlmbo#nbqdjm.alwwln9qfpslmpjajojwz?\"Xfmgje^..=\t?,=?nfwb#mbnf>!jnsofnfmwbwjlmjmeqbpwqv`wvqfqfsqfpfmwbwjlmalqgfq.alwwln9?,kfbg=\t?algz=>kwws&0B&1E&1E?elqn#nfwklg>!nfwklg>!slpw!#,ebuj`lm-j`l!#~*8\t?,p`qjsw=\t-pfwBwwqjavwf+Bgnjmjpwqbwjlm>#mft#Bqqbz+*8?\"Xfmgje^..=\x0E\tgjpsobz9aol`h8Vmelqwvmbwfoz/!=%maps8?,gju=,ebuj`lm-j`l!=>$pwzofpkffw$#jgfmwjej`bwjlm/#elq#f{bnsof/?oj=?b#kqfe>!,bm#bowfqmbwjufbp#b#qfpvow#lesw!=?,p`qjsw=\twzsf>!pvanjw!#\t+evm`wjlm+*#xqf`lnnfmgbwjlmelqn#b`wjlm>!,wqbmpelqnbwjlmqf`lmpwqv`wjlm-pwzof-gjpsobz#B``lqgjmd#wl#kjggfm!#mbnf>!bolmd#tjwk#wkfgl`vnfmw-algz-bssql{jnbwfoz#@lnnvmj`bwjlmpslpw!#b`wjlm>!nfbmjmd#%rvlw8..?\"Xfmgje^..=Sqjnf#Njmjpwfq`kbqb`wfqjpwj`?,b=#?b#`obpp>wkf#kjpwlqz#le#lmnlvpflufq>!wkf#dlufqmnfmwkqfe>!kwwsp9,,tbp#lqjdjmbooztbp#jmwqlgv`fg`obppjej`bwjlmqfsqfpfmwbwjufbqf#`lmpjgfqfg?\"Xfmgje^..=\t\tgfsfmgp#lm#wkfVmjufqpjwz#le#jm#`lmwqbpw#wl#sob`fklogfq>!jm#wkf#`bpf#lejmwfqmbwjlmbo#`lmpwjwvwjlmbopwzof>!alqgfq.9#evm`wjlm+*#xAf`bvpf#le#wkf.pwqj`w-gwg!=\t?wbaof#`obpp>!b``lnsbmjfg#azb``lvmw#le#wkf?p`qjsw#pq`>!,mbwvqf#le#wkf#wkf#sflsof#jm#jm#bggjwjlm#wlp*8#ip-jg#>#jg!#tjgwk>!233&!qfdbqgjmd#wkf#Qlnbm#@bwkloj`bm#jmgfsfmgfmwelooltjmd#wkf#-dje!#tjgwk>!2wkf#elooltjmd#gjp`qjnjmbwjlmbq`kbfloldj`bosqjnf#njmjpwfq-ip!=?,p`qjsw=`lnajmbwjlm#le#nbqdjmtjgwk>!`qfbwfFofnfmw+t-bwwb`kFufmw+?,b=?,wg=?,wq=pq`>!kwwsp9,,bJm#sbqwj`vobq/#bojdm>!ofew!#@yf`k#Qfsvaoj`Vmjwfg#Hjmdgln`lqqfpslmgfm`f`lm`ovgfg#wkbw-kwno!#wjwof>!+evm`wjlm#+*#x`lnfp#eqln#wkfbssoj`bwjlm#le?psbm#`obpp>!pafojfufg#wl#affnfmw+$p`qjsw$?,b=\t?,oj=\t?ojufqz#gjeefqfmw=?psbm#`obpp>!lswjlm#ubovf>!+bopl#hmltm#bp\n?oj=?b#kqfe>!=?jmsvw#mbnf>!pfsbqbwfg#eqlnqfefqqfg#wl#bp#ubojdm>!wls!=elvmgfq#le#wkfbwwfnswjmd#wl#`bqalm#gjl{jgf\t\t?gju#`obpp>!`obpp>!pfbq`k.,algz=\t?,kwno=lsslqwvmjwz#wl`lnnvmj`bwjlmp?,kfbg=\x0E\t?algz#pwzof>!tjgwk9Wj\rVSmd#Uj\rWkw`kbmdfp#jm#wkfalqgfq.`lolq9 3!#alqgfq>!3!#?,psbm=?,gju=?tbp#gjp`lufqfg!#wzsf>!wf{w!#*8\t?,p`qjsw=\t\tGfsbqwnfmw#le#f``ofpjbpwj`bowkfqf#kbp#affmqfpvowjmd#eqln?,algz=?,kwno=kbp#mfufq#affmwkf#ejqpw#wjnfjm#qfpslmpf#wlbvwlnbwj`booz#?,gju=\t\t?gju#jtbp#`lmpjgfqfgsfq`fmw#le#wkf!#,=?,b=?,gju=`loof`wjlm#le#gfp`fmgfg#eqlnpf`wjlm#le#wkfb``fsw.`kbqpfwwl#af#`lmevpfgnfnafq#le#wkf#sbggjmd.qjdkw9wqbmpobwjlm#lejmwfqsqfwbwjlm#kqfe>$kwws9,,tkfwkfq#lq#mlwWkfqf#bqf#boplwkfqf#bqf#nbmzb#pnboo#mvnafqlwkfq#sbqwp#lejnslppjaof#wl##`obpp>!avwwlmol`bwfg#jm#wkf-#Kltfufq/#wkfbmg#fufmwvboozBw#wkf#fmg#le#af`bvpf#le#jwpqfsqfpfmwp#wkf?elqn#b`wjlm>!#nfwklg>!slpw!jw#jp#slppjaofnlqf#ojhfoz#wlbm#jm`qfbpf#jmkbuf#bopl#affm`lqqfpslmgp#wlbmmlvm`fg#wkbwbojdm>!qjdkw!=nbmz#`lvmwqjfpelq#nbmz#zfbqpfbqojfpw#hmltmaf`bvpf#jw#tbpsw!=?,p`qjsw=\x0E#ubojdm>!wls!#jmkbajwbmwp#leelooltjmd#zfbq\x0E\t?gju#`obpp>!njoojlm#sflsof`lmwqlufqpjbo#`lm`fqmjmd#wkfbqdvf#wkbw#wkfdlufqmnfmw#bmgb#qfefqfm`f#wlwqbmpefqqfg#wlgfp`qjajmd#wkf#pwzof>!`lolq9bowklvdk#wkfqfafpw#hmltm#elqpvanjw!#mbnf>!nvowjsoj`bwjlmnlqf#wkbm#lmf#qf`ldmjwjlm#le@lvm`jo#le#wkffgjwjlm#le#wkf##?nfwb#mbnf>!Fmwfqwbjmnfmw#btbz#eqln#wkf#8nbqdjm.qjdkw9bw#wkf#wjnf#lejmufpwjdbwjlmp`lmmf`wfg#tjwkbmg#nbmz#lwkfqbowklvdk#jw#jpafdjmmjmd#tjwk#?psbm#`obpp>!gfp`fmgbmwp#le?psbm#`obpp>!j#bojdm>!qjdkw!?,kfbg=\t?algz#bpsf`wp#le#wkfkbp#pjm`f#affmFvqlsfbm#Vmjlmqfnjmjp`fmw#lenlqf#gjeej`vowUj`f#Sqfpjgfmw`lnslpjwjlm#lesbppfg#wkqlvdknlqf#jnslqwbmwelmw.pjyf922s{f{sobmbwjlm#lewkf#`lm`fsw#letqjwwfm#jm#wkf\n?psbm#`obpp>!jp#lmf#le#wkf#qfpfnaobm`f#wllm#wkf#dqlvmgptkj`k#`lmwbjmpjm`ovgjmd#wkf#gfejmfg#az#wkfsvaoj`bwjlm#lenfbmp#wkbw#wkflvwpjgf#le#wkfpvsslqw#le#wkf?jmsvw#`obpp>!?psbm#`obpp>!w+Nbwk-qbmgln+*nlpw#sqlnjmfmwgfp`qjswjlm#le@lmpwbmwjmlsoftfqf#svaojpkfg?gju#`obpp>!pfbssfbqp#jm#wkf2!#kfjdkw>!2!#nlpw#jnslqwbmwtkj`k#jm`ovgfptkj`k#kbg#affmgfpwqv`wjlm#lewkf#slsvobwjlm\t\n?gju#`obpp>!slppjajojwz#leplnfwjnfp#vpfgbssfbq#wl#kbufpv``fpp#le#wkfjmwfmgfg#wl#afsqfpfmw#jm#wkfpwzof>!`ofbq9a\x0E\t?,p`qjsw=\x0E\t?tbp#elvmgfg#jmjmwfqujft#tjwk\\jg!#`lmwfmw>!`bsjwbo#le#wkf\x0E\t?ojmh#qfo>!pqfofbpf#le#wkfsljmw#lvw#wkbw{NOKwwsQfrvfpwbmg#pvapfrvfmwpf`lmg#obqdfpwufqz#jnslqwbmwpsf`jej`bwjlmppvqeb`f#le#wkfbssojfg#wl#wkfelqfjdm#sloj`z\\pfwGlnbjmMbnffpwbaojpkfg#jmjp#afojfufg#wlJm#bggjwjlm#wlnfbmjmd#le#wkfjp#mbnfg#bewfqwl#sqlwf`w#wkfjp#qfsqfpfmwfgGf`obqbwjlm#lenlqf#feej`jfmw@obppjej`bwjlmlwkfq#elqnp#lekf#qfwvqmfg#wl?psbm#`obpp>!`sfqelqnbm`f#le+evm`wjlm+*#x\x0Eje#bmg#lmoz#jeqfdjlmp#le#wkfofbgjmd#wl#wkfqfobwjlmp#tjwkVmjwfg#Mbwjlmppwzof>!kfjdkw9lwkfq#wkbm#wkfzsf!#`lmwfmw>!Bppl`jbwjlm#le\t?,kfbg=\t?algzol`bwfg#lm#wkfjp#qfefqqfg#wl+jm`ovgjmd#wkf`lm`fmwqbwjlmpwkf#jmgjujgvbobnlmd#wkf#nlpwwkbm#bmz#lwkfq,=\t?ojmh#qfo>!#qfwvqm#ebopf8wkf#svqslpf#lewkf#bajojwz#wl8`lolq9 eee~\t-\t?psbm#`obpp>!wkf#pvaif`w#legfejmjwjlmp#le=\x0E\t?ojmh#qfo>!`objn#wkbw#wkfkbuf#gfufolsfg?wbaof#tjgwk>!`fofaqbwjlm#leElooltjmd#wkf#wl#gjpwjmdvjpk?psbm#`obpp>!awbhfp#sob`f#jmvmgfq#wkf#mbnfmlwfg#wkbw#wkf=?\"Xfmgje^..=\tpwzof>!nbqdjm.jmpwfbg#le#wkfjmwqlgv`fg#wkfwkf#sql`fpp#lejm`qfbpjmd#wkfgjeefqfm`fp#jmfpwjnbwfg#wkbwfpsf`jbooz#wkf,gju=?gju#jg>!tbp#fufmwvboozwkqlvdklvw#kjpwkf#gjeefqfm`fplnfwkjmd#wkbwpsbm=?,psbm=?,pjdmjej`bmwoz#=?,p`qjsw=\x0E\t\x0E\tfmujqlmnfmwbo#wl#sqfufmw#wkfkbuf#affm#vpfgfpsf`jbooz#elqvmgfqpwbmg#wkfjp#fppfmwjbooztfqf#wkf#ejqpwjp#wkf#obqdfpwkbuf#affm#nbgf!#pq`>!kwws9,,jmwfqsqfwfg#bppf`lmg#kboe#le`qloojmd>!ml!#jp#`lnslpfg#leJJ/#Kloz#Qlnbmjp#f{sf`wfg#wlkbuf#wkfjq#ltmgfejmfg#bp#wkfwqbgjwjlmbooz#kbuf#gjeefqfmwbqf#lewfm#vpfgwl#fmpvqf#wkbwbdqffnfmw#tjwk`lmwbjmjmd#wkfbqf#eqfrvfmwozjmelqnbwjlm#lmf{bnsof#jp#wkfqfpvowjmd#jm#b?,b=?,oj=?,vo=#`obpp>!ellwfqbmg#fpsf`jboozwzsf>!avwwlm!#?,psbm=?,psbm=tkj`k#jm`ovgfg=\t?nfwb#mbnf>!`lmpjgfqfg#wkf`bqqjfg#lvw#azKltfufq/#jw#jpaf`bnf#sbqw#lejm#qfobwjlm#wlslsvobq#jm#wkfwkf#`bsjwbo#letbp#leej`jbooztkj`k#kbp#affmwkf#Kjpwlqz#lebowfqmbwjuf#wlgjeefqfmw#eqlnwl#pvsslqw#wkfpvddfpwfg#wkbwjm#wkf#sql`fpp##?gju#`obpp>!wkf#elvmgbwjlmaf`bvpf#le#kjp`lm`fqmfg#tjwkwkf#vmjufqpjwzlsslpfg#wl#wkfwkf#`lmwf{w#le?psbm#`obpp>!swf{w!#mbnf>!r!\n\n?gju#`obpp>!wkf#p`jfmwjej`qfsqfpfmwfg#aznbwkfnbwj`jbmpfof`wfg#az#wkfwkbw#kbuf#affm=?gju#`obpp>!`gju#jg>!kfbgfqjm#sbqwj`vobq/`lmufqwfg#jmwl*8\t?,p`qjsw=\t?skjolplskj`bo#pqsphlkqubwphjwj\rVSmd#Uj\rWkw<L=o=m=m<V<T<U=l=o=m=m<V<T<Ujmufpwjdb`j/_msbqwj`jsb`j/_m<V<R=n<R=l=g<Y<R<]<W<\\=m=n<T<V<R=n<R=l=g<U=k<Y<W<R<^<Y<V=m<T=m=n<Y<P=g<q<R<^<R=m=n<T<V<R=n<R=l=g=i<R<]<W<\\=m=n=`<^=l<Y<P<Y<Q<T<V<R=n<R=l<\\=c=m<Y<_<R<X<Q=c=m<V<\\=k<\\=n=`<Q<R<^<R=m=n<T<O<V=l<\\<T<Q=g<^<R<S=l<R=m=g<V<R=n<R=l<R<U=m<X<Y<W<\\=n=`<S<R<P<R=e=`=b=m=l<Y<X=m=n<^<R<]=l<\\<[<R<P=m=n<R=l<R<Q=g=o=k<\\=m=n<T<Y=n<Y=k<Y<Q<T<Y<\x7F<W<\\<^<Q<\\=c<T=m=n<R=l<T<T=m<T=m=n<Y<P<\\=l<Y=d<Y<Q<T=c<M<V<\\=k<\\=n=`<S<R=a=n<R<P=o=m<W<Y<X=o<Y=n=m<V<\\<[<\\=n=`=n<R<^<\\=l<R<^<V<R<Q<Y=k<Q<R=l<Y=d<Y<Q<T<Y<V<R=n<R=l<R<Y<R=l<_<\\<Q<R<^<V<R=n<R=l<R<P<L<Y<V<W<\\<P<\\4K5h5i5j4F4C5e5i5j4F4C5f4K4F4K5h5i5d4Z5d4U4K5h4D4]4K5i4@4K5h5i5d4K5n4U4K5h4]4_4K4J5h5i4X4K4]5o4K4F4K5h4O4U4Z4K4M4K5h4]5f4K4Z4E4K5h4F4Y5i5f5i4K5h4K4U4Z4K4M4K5h5j4F4K4J4@4K5h4O5h4U4K4D4K5h4F4_4@5f5h4K5h4O5n4_4K5i4K5h4Z4V4[4K4F4K5h5m5f4C5f5d4K5h4F4]4A5f4D4K5h4@4C5f4C4E4K5h4F4U5h5f5i4K5h4O4B4D4K4]4K5h4K5m5h4K5i4K5h4O5m5h4K5i4K5h4F4K4]5f4B4K5h4F5n5j5f4E4K5h4K5h4U4K4D4K5h4B5d4K4[4]4K5h5i4@4F5i4U4K5h4C5f5o5d4]4K5h4_5f4K4A4E4U4D4C4K5h5h5k4K5h4F4]4D5f4E4K5h4]5d4K4D4[4K5h4O4C4D5f4E4K5h4K4B4D4K4]4K5h5i4F4A4C4E4K5h4K4V4K5j5f`vqplq9sljmwfq8?,wjwof=\t?nfwb#!#kqfe>!kwws9,,!=?psbm#`obpp>!nfnafqp#le#wkf#tjmglt-ol`bwjlmufqwj`bo.bojdm9,b=#\x7F#?b#kqfe>!?\"gl`wzsf#kwno=nfgjb>!p`qffm!#?lswjlm#ubovf>!ebuj`lm-j`l!#,=\t\n\n?gju#`obpp>!`kbqb`wfqjpwj`p!#nfwklg>!dfw!#,algz=\t?,kwno=\tpklqw`vw#j`lm!#gl`vnfmw-tqjwf+sbggjmd.alwwln9qfsqfpfmwbwjufppvanjw!#ubovf>!bojdm>!`fmwfq!#wkqlvdklvw#wkf#p`jfm`f#ej`wjlm\t##?gju#`obpp>!pvanjw!#`obpp>!lmf#le#wkf#nlpw#ubojdm>!wls!=?tbp#fpwbaojpkfg*8\x0E\t?,p`qjsw=\x0E\tqfwvqm#ebopf8!=*-pwzof-gjpsobzaf`bvpf#le#wkf#gl`vnfmw-`llhjf?elqn#b`wjlm>!,~algzxnbqdjm938Fm`z`olsfgjb#leufqpjlm#le#wkf#-`qfbwfFofnfmw+mbnf!#`lmwfmw>!?,gju=\t?,gju=\t\tbgnjmjpwqbwjuf#?,algz=\t?,kwno=kjpwlqz#le#wkf#!=?jmsvw#wzsf>!slqwjlm#le#wkf#bp#sbqw#le#wkf#%maps8?b#kqfe>!lwkfq#`lvmwqjfp!=\t?gju#`obpp>!?,psbm=?,psbm=?Jm#lwkfq#tlqgp/gjpsobz9#aol`h8`lmwqlo#le#wkf#jmwqlgv`wjlm#le,=\t?nfwb#mbnf>!bp#tfoo#bp#wkf#jm#qf`fmw#zfbqp\x0E\t\n?gju#`obpp>!?,gju=\t\n?,gju=\tjmpsjqfg#az#wkfwkf#fmg#le#wkf#`lnsbwjaof#tjwkaf`bnf#hmltm#bp#pwzof>!nbqdjm9-ip!=?,p`qjsw=?#Jmwfqmbwjlmbo#wkfqf#kbuf#affmDfqnbm#obmdvbdf#pwzof>!`lolq9 @lnnvmjpw#Sbqwz`lmpjpwfmw#tjwkalqgfq>!3!#`foo#nbqdjmkfjdkw>!wkf#nbilqjwz#le!#bojdm>!`fmwfqqfobwfg#wl#wkf#nbmz#gjeefqfmw#Lqwklgl{#@kvq`kpjnjobq#wl#wkf#,=\t?ojmh#qfo>!ptbp#lmf#le#wkf#vmwjo#kjp#gfbwk~*+*8\t?,p`qjsw=lwkfq#obmdvbdfp`lnsbqfg#wl#wkfslqwjlmp#le#wkfwkf#Mfwkfqobmgpwkf#nlpw#`lnnlmab`hdqlvmg9vqo+bqdvfg#wkbw#wkfp`qloojmd>!ml!#jm`ovgfg#jm#wkfMlqwk#Bnfqj`bm#wkf#mbnf#le#wkfjmwfqsqfwbwjlmpwkf#wqbgjwjlmbogfufolsnfmw#le#eqfrvfmwoz#vpfgb#`loof`wjlm#leufqz#pjnjobq#wlpvqqlvmgjmd#wkff{bnsof#le#wkjpbojdm>!`fmwfq!=tlvog#kbuf#affmjnbdf\\`bswjlm#>bwwb`kfg#wl#wkfpvddfpwjmd#wkbwjm#wkf#elqn#le#jmuloufg#jm#wkfjp#gfqjufg#eqlnmbnfg#bewfq#wkfJmwqlgv`wjlm#wlqfpwqj`wjlmp#lm#pwzof>!tjgwk9#`bm#af#vpfg#wl#wkf#`qfbwjlm#lenlpw#jnslqwbmw#jmelqnbwjlm#bmgqfpvowfg#jm#wkf`loobspf#le#wkfWkjp#nfbmp#wkbwfofnfmwp#le#wkftbp#qfsob`fg#azbmbozpjp#le#wkfjmpsjqbwjlm#elqqfdbqgfg#bp#wkfnlpw#pv``fppevohmltm#bp#%rvlw8b#`lnsqfkfmpjufKjpwlqz#le#wkf#tfqf#`lmpjgfqfgqfwvqmfg#wl#wkfbqf#qfefqqfg#wlVmplvq`fg#jnbdf=\t\n?gju#`obpp>!`lmpjpwp#le#wkfpwlsSqlsbdbwjlmjmwfqfpw#jm#wkfbubjobajojwz#lebssfbqp#wl#kbuffof`wqlnbdmfwj`fmbaofPfquj`fp+evm`wjlm#le#wkfJw#jp#jnslqwbmw?,p`qjsw=?,gju=evm`wjlm+*xubq#qfobwjuf#wl#wkfbp#b#qfpvow#le#wkf#slpjwjlm#leElq#f{bnsof/#jm#nfwklg>!slpw!#tbp#elooltfg#az%bns8ngbpk8#wkfwkf#bssoj`bwjlmip!=?,p`qjsw=\x0E\tvo=?,gju=?,gju=bewfq#wkf#gfbwktjwk#qfpsf`w#wlpwzof>!sbggjmd9jp#sbqwj`vobqozgjpsobz9jmojmf8#wzsf>!pvanjw!#jp#gjujgfg#jmwl\bTA\nzk#+\x0BBl\bQ\x7F*qfpslmpbajojgbgbgnjmjpwqb`j/_mjmwfqmb`jlmbofp`lqqfpslmgjfmwf\fHe\fHF\fHC\fIg\fH{\fHF\fIn\fH\\\fIa\fHY\fHU\fHB\fHR\fH\\\fIk\fH^\fIg\fH{\fIg\fHn\fHv\fIm\fHD\fHR\fHY\fH^\fIk\fHy\fHS\fHD\fHT\fH\\\fHy\fHR\fH\\\fHF\fIm\fH^\fHS\fHT\fHz\fIg\fHp\fIk\fHn\fHv\fHR\fHU\fHS\fHc\fHA\fIk\fHp\fIk\fHn\fHZ\fHR\fHB\fHS\fH^\fHU\fHB\fHR\fH\\\fIl\fHp\fHR\fH{\fH\\\fHO\fH@\fHD\fHR\fHD\fIk\fHy\fIm\fHB\fHR\fH\\\fH@\fIa\fH^\fIe\fH{\fHB\fHR\fH^\fHS\fHy\fHB\fHU\fHS\fH^\fHR\fHF\fIo\fH[\fIa\fHL\fH@\fHN\fHP\fHH\fIk\fHA\fHR\fHp\fHF\fHR\fHy\fIa\fH^\fHS\fHy\fHs\fIa\fH\\\fIk\fHD\fHz\fHS\fH^\fHR\fHG\fHJ\fI`\fH\\\fHR\fHD\fHB\fHR\fHB\fH^\fIk\fHB\fHH\fHJ\fHR\fHD\fH@\fHR\fHp\fHR\fH\\\fHY\fHS\fHy\fHR\fHT\fHy\fIa\fHC\fIg\fHn\fHv\fHR\fHU\fHH\fIk\fHF\fHU\fIm\fHm\fHv\fH@\fHH\fHR\fHC\fHR\fHT\fHn\fHY\fHR\fHJ\fHJ\fIk\fHz\fHD\fIk\fHF\fHS\fHw\fH^\fIk\fHY\fHS\fHZ\fIk\fH[\fH\\\fHR\fHp\fIa\fHC\fHe\fHH\fIa\fHH\fH\\\fHB\fIm\fHn\fH@\fHd\fHJ\fIg\fHD\fIg\fHn\fHe\fHF\fHy\fH\\\fHO\fHF\fHN\fHP\fIk\fHn\fHT\fIa\fHI\fHS\fHH\fHG\fHS\fH^\fIa\fHB\fHB\fIm\fHz\fIa\fHC\fHi\fHv\fIa\fHw\fHR\fHw\fIn\fHs\fHH\fIl\fHT\fHn\fH{\fIl\fHH\fHp\fHR\fHc\fH{\fHR\fHY\fHS\fHA\fHR\fH{\fHt\fHO\fIa\fHs\fIk\fHJ\fIn\fHT\fH\\\fIk\fHJ\fHS\fHD\fIg\fHn\fHU\fHH\fIa\fHC\fHR\fHT\fIk\fHy\fIa\fHT\fH{\fHR\fHn\fHK\fIl\fHY\fHS\fHZ\fIa\fHY\fH\\\fHR\fHH\fIk\fHn\fHJ\fId\fHs\fIa\fHT\fHD\fHy\fIa\fHZ\fHR\fHT\fHR\fHB\fHD\fIk\fHi\fHJ\fHR\fH^\fHH\fH@\fHS\fHp\fH^\fIl\fHF\fIm\fH\\\fIn\fH[\fHU\fHS\fHn\fHJ\fIl\fHB\fHS\fHH\fIa\fH\\\fHy\fHY\fHS\fHH\fHR\fH\\\fIm\fHF\fHC\fIk\fHT\fIa\fHI\fHR\fHD\fHy\fH\\\fIg\fHM\fHP\fHB\fIm\fHy\fIa\fHH\fHC\fIg\fHp\fHD\fHR\fHy\fIo\fHF\fHC\fHR\fHF\fIg\fHT\fIa\fHs\fHt\fH\\\fIk\fH^\fIn\fHy\fHR\fH\\\fIa\fHC\fHY\fHS\fHv\fHR\fH\\\fHT\fIn\fHv\fHD\fHR\fHB\fIn\fH^\fIa\fHC\fHJ\fIk\fHz\fIk\fHn\fHU\fHB\fIk\fHZ\fHR\fHT\fIa\fHy\fIn\fH^\fHB\fId\fHn\fHD\fIk\fHH\fId\fHC\fHR\fH\\\fHp\fHS\fHT\fHy\fIkqpp({no!#wjwof>!.wzsf!#`lmwfmw>!wjwof!#`lmwfmw>!bw#wkf#pbnf#wjnf-ip!=?,p`qjsw=\t?!#nfwklg>!slpw!#?,psbm=?,b=?,oj=ufqwj`bo.bojdm9w,irvfqz-njm-ip!=-`oj`h+evm`wjlm+#pwzof>!sbggjmd.~*+*8\t?,p`qjsw=\t?,psbm=?b#kqfe>!?b#kqfe>!kwws9,,*8#qfwvqm#ebopf8wf{w.gf`lqbwjlm9#p`qloojmd>!ml!#alqgfq.`loobspf9bppl`jbwfg#tjwk#Abkbpb#JmglmfpjbFmdojpk#obmdvbdf?wf{w#{no9psb`f>-dje!#alqgfq>!3!?,algz=\t?,kwno=\tlufqeolt9kjggfm8jnd#pq`>!kwws9,,bggFufmwOjpwfmfqqfpslmpjaof#elq#p-ip!=?,p`qjsw=\t,ebuj`lm-j`l!#,=lsfqbwjmd#pzpwfn!#pwzof>!tjgwk92wbqdfw>!\\aobmh!=Pwbwf#Vmjufqpjwzwf{w.bojdm9ofew8\tgl`vnfmw-tqjwf+/#jm`ovgjmd#wkf#bqlvmg#wkf#tlqog*8\x0E\t?,p`qjsw=\x0E\t?!#pwzof>!kfjdkw98lufqeolt9kjggfmnlqf#jmelqnbwjlmbm#jmwfqmbwjlmbob#nfnafq#le#wkf#lmf#le#wkf#ejqpw`bm#af#elvmg#jm#?,gju=\t\n\n?,gju=\tgjpsobz9#mlmf8!=!#,=\t?ojmh#qfo>!\t##+evm`wjlm+*#xwkf#26wk#`fmwvqz-sqfufmwGfebvow+obqdf#mvnafq#le#Azybmwjmf#Fnsjqf-isd\x7Fwkvna\x7Fofew\x7Fubpw#nbilqjwz#lenbilqjwz#le#wkf##bojdm>!`fmwfq!=Vmjufqpjwz#Sqfppglnjmbwfg#az#wkfPf`lmg#Tlqog#Tbqgjpwqjavwjlm#le#pwzof>!slpjwjlm9wkf#qfpw#le#wkf#`kbqb`wfqjyfg#az#qfo>!mleloolt!=gfqjufp#eqln#wkfqbwkfq#wkbm#wkf#b#`lnajmbwjlm#lepwzof>!tjgwk9233Fmdojpk.psfbhjmd`lnsvwfq#p`jfm`falqgfq>!3!#bow>!wkf#f{jpwfm`f#leGfnl`qbwj`#Sbqwz!#pwzof>!nbqdjm.Elq#wkjp#qfbplm/-ip!=?,p`qjsw=\t\npAzWbdMbnf+p*X3^ip!=?,p`qjsw=\x0E\t?-ip!=?,p`qjsw=\x0E\tojmh#qfo>!j`lm!#$#bow>$$#`obpp>$elqnbwjlm#le#wkfufqpjlmp#le#wkf#?,b=?,gju=?,gju=,sbdf=\t##?sbdf=\t?gju#`obpp>!`lmwaf`bnf#wkf#ejqpwabkbpb#Jmglmfpjbfmdojpk#+pjnsof*\"y\"W\"W\"[\"Q\"U\"V\"@=i=l<^<\\=n=m<V<T<V<R<P<S<\\<Q<T<T=c<^<W=c<Y=n=m=c<x<R<]<\\<^<T=n=`=k<Y<W<R<^<Y<V<\\=l<\\<[<^<T=n<T=c<t<Q=n<Y=l<Q<Y=n<r=n<^<Y=n<T=n=`<Q<\\<S=l<T<P<Y=l<T<Q=n<Y=l<Q<Y=n<V<R=n<R=l<R<_<R=m=n=l<\\<Q<T=j=g<V<\\=k<Y=m=n<^<Y=o=m<W<R<^<T=c=i<S=l<R<]<W<Y<P=g<S<R<W=o=k<T=n=`=c<^<W=c=b=n=m=c<Q<\\<T<]<R<W<Y<Y<V<R<P<S<\\<Q<T=c<^<Q<T<P<\\<Q<T<Y=m=l<Y<X=m=n<^<\\4K5h5i5d4K4Z5f4U4K5h4]4J5f4_5f4E4K5h4K5j4F5n4K5h5i4X4K4]5o4K4F5o4K5h4_5f4K4]4K4F4K5h5i5o4F5d4D4E4K5h4_4U5d4C5f4E4K4A4Y4K4J5f4K4F4K5h4U4K5h5i5f4E4K5h4Y5d4F5f4K4F4K5h4K5j4F4]5j4F4K5h4F4Y4K5i5f5i4K5h4I4_5h4K5i5f4K5h5i4X4K4]5o4E4K5h5i4]4J5f4K4Fqlalwp!#`lmwfmw>!?gju#jg>!ellwfq!=wkf#Vmjwfg#Pwbwfp?jnd#pq`>!kwws9,,-isd\x7Fqjdkw\x7Fwkvna\x7F-ip!=?,p`qjsw=\x0E\t?ol`bwjlm-sqlwl`loeqbnfalqgfq>!3!#p!#,=\t?nfwb#mbnf>!?,b=?,gju=?,gju=?elmw.tfjdkw9alog8%rvlw8#bmg#%rvlw8gfsfmgjmd#lm#wkf#nbqdjm938sbggjmd9!#qfo>!mleloolt!#Sqfpjgfmw#le#wkf#wtfmwjfwk#`fmwvqzfujpjlm=\t##?,sbdfJmwfqmfw#F{solqfqb-bpzm`#>#wqvf8\x0E\tjmelqnbwjlm#balvw?gju#jg>!kfbgfq!=!#b`wjlm>!kwws9,,?b#kqfe>!kwwsp9,,?gju#jg>!`lmwfmw!?,gju=\x0E\t?,gju=\x0E\t?gfqjufg#eqln#wkf#?jnd#pq`>$kwws9,,b``lqgjmd#wl#wkf#\t?,algz=\t?,kwno=\tpwzof>!elmw.pjyf9p`qjsw#obmdvbdf>!Bqjbo/#Kfoufwj`b/?,b=?psbm#`obpp>!?,p`qjsw=?p`qjsw#slojwj`bo#sbqwjfpwg=?,wq=?,wbaof=?kqfe>!kwws9,,ttt-jmwfqsqfwbwjlm#leqfo>!pwzofpkffw!#gl`vnfmw-tqjwf+$?`kbqpfw>!vwe.;!=\tafdjmmjmd#le#wkf#qfufbofg#wkbw#wkfwfofujpjlm#pfqjfp!#qfo>!mleloolt!=#wbqdfw>!\\aobmh!=`objnjmd#wkbw#wkfkwws&0B&1E&1Ettt-nbmjefpwbwjlmp#leSqjnf#Njmjpwfq#lejmeovfm`fg#az#wkf`obpp>!`ofbqej{!=,gju=\x0E\t?,gju=\x0E\t\x0E\twkqff.gjnfmpjlmbo@kvq`k#le#Fmdobmgle#Mlqwk#@bqlojmbprvbqf#hjolnfwqfp-bggFufmwOjpwfmfqgjpwjm`w#eqln#wkf`lnnlmoz#hmltm#bpSklmfwj`#Boskbafwgf`obqfg#wkbw#wkf`lmwqloofg#az#wkfAfmibnjm#Eqbmhojmqlof.sobzjmd#dbnfwkf#Vmjufqpjwz#lejm#Tfpwfqm#Fvqlsfsfqplmbo#`lnsvwfqSqlif`w#Dvwfmafqdqfdbqgofpp#le#wkfkbp#affm#sqlslpfgwldfwkfq#tjwk#wkf=?,oj=?oj#`obpp>!jm#plnf#`lvmwqjfpnjm-ip!=?,p`qjsw=le#wkf#slsvobwjlmleej`jbo#obmdvbdf?jnd#pq`>!jnbdfp,jgfmwjejfg#az#wkfmbwvqbo#qfplvq`fp`obppjej`bwjlm#le`bm#af#`lmpjgfqfgrvbmwvn#nf`kbmj`pMfufqwkfofpp/#wkfnjoojlm#zfbqp#bdl?,algz=\x0E\t?,kwno=\x0E\"y\"W\"W\"[\"Q\"U\"V\"@\twbhf#bgubmwbdf#lebmg/#b``lqgjmd#wlbwwqjavwfg#wl#wkfNj`qlplew#Tjmgltpwkf#ejqpw#`fmwvqzvmgfq#wkf#`lmwqlogju#`obpp>!kfbgfqpklqwoz#bewfq#wkfmlwbaof#f{`fswjlmwfmp#le#wklvpbmgppfufqbo#gjeefqfmwbqlvmg#wkf#tlqog-qfb`kjmd#njojwbqzjplobwfg#eqln#wkflsslpjwjlm#wl#wkfwkf#Log#WfpwbnfmwBeqj`bm#Bnfqj`bmpjmpfqwfg#jmwl#wkfpfsbqbwf#eqln#wkfnfwqlslojwbm#bqfbnbhfp#jw#slppjaofb`hmltofgdfg#wkbwbqdvbaoz#wkf#nlpwwzsf>!wf{w,`pp!=\twkf#JmwfqmbwjlmboB``lqgjmd#wl#wkf#sf>!wf{w,`pp!#,=\t`ljm`jgf#tjwk#wkfwtl.wkjqgp#le#wkfGvqjmd#wkjp#wjnf/gvqjmd#wkf#sfqjlgbmmlvm`fg#wkbw#kfwkf#jmwfqmbwjlmbobmg#nlqf#qf`fmwozafojfufg#wkbw#wkf`lmp`jlvpmfpp#bmgelqnfqoz#hmltm#bppvqqlvmgfg#az#wkfejqpw#bssfbqfg#jml``bpjlmbooz#vpfgslpjwjlm9baplovwf8!#wbqdfw>!\\aobmh!#slpjwjlm9qfobwjuf8wf{w.bojdm9`fmwfq8ib{,ojap,irvfqz,2-ab`hdqlvmg.`lolq9 wzsf>!bssoj`bwjlm,bmdvbdf!#`lmwfmw>!?nfwb#kwws.frvju>!Sqjub`z#Sloj`z?,b=f+!&0@p`qjsw#pq`>$!#wbqdfw>!\\aobmh!=Lm#wkf#lwkfq#kbmg/-isd\x7Fwkvna\x7Fqjdkw\x7F1?,gju=?gju#`obpp>!?gju#pwzof>!eolbw9mjmfwffmwk#`fmwvqz?,algz=\x0E\t?,kwno=\x0E\t?jnd#pq`>!kwws9,,p8wf{w.bojdm9`fmwfqelmw.tfjdkw9#alog8#B``lqgjmd#wl#wkf#gjeefqfm`f#afwtffm!#eqbnfalqgfq>!3!#!#pwzof>!slpjwjlm9ojmh#kqfe>!kwws9,,kwno7,ollpf-gwg!=\tgvqjmd#wkjp#sfqjlg?,wg=?,wq=?,wbaof=`olpfoz#qfobwfg#wlelq#wkf#ejqpw#wjnf8elmw.tfjdkw9alog8jmsvw#wzsf>!wf{w!#?psbm#pwzof>!elmw.lmqfbgzpwbwf`kbmdf\n?gju#`obpp>!`ofbqgl`vnfmw-ol`bwjlm-#Elq#f{bnsof/#wkf#b#tjgf#ubqjfwz#le#?\"GL@WZSF#kwno=\x0E\t?%maps8%maps8%maps8!=?b#kqfe>!kwws9,,pwzof>!eolbw9ofew8`lm`fqmfg#tjwk#wkf>kwws&0B&1E&1Ettt-jm#slsvobq#`vowvqfwzsf>!wf{w,`pp!#,=jw#jp#slppjaof#wl#Kbqubqg#Vmjufqpjwzwzofpkffw!#kqfe>!,wkf#nbjm#`kbqb`wfqL{elqg#Vmjufqpjwz##mbnf>!hfztlqgp!#`pwzof>!wf{w.bojdm9wkf#Vmjwfg#Hjmdglnefgfqbo#dlufqmnfmw?gju#pwzof>!nbqdjm#gfsfmgjmd#lm#wkf#gfp`qjswjlm#le#wkf?gju#`obpp>!kfbgfq-njm-ip!=?,p`qjsw=gfpwqv`wjlm#le#wkfpojdkwoz#gjeefqfmwjm#b``lqgbm`f#tjwkwfof`lnnvmj`bwjlmpjmgj`bwfp#wkbw#wkfpklqwoz#wkfqfbewfqfpsf`jbooz#jm#wkf#Fvqlsfbm#`lvmwqjfpKltfufq/#wkfqf#bqfpq`>!kwws9,,pwbwj`pvddfpwfg#wkbw#wkf!#pq`>!kwws9,,ttt-b#obqdf#mvnafq#le#Wfof`lnnvmj`bwjlmp!#qfo>!mleloolt!#wKloz#Qlnbm#Fnsfqlqbonlpw#f{`ovpjufoz!#alqgfq>!3!#bow>!Pf`qfwbqz#le#Pwbwf`vonjmbwjmd#jm#wkf@JB#Tlqog#Eb`wallhwkf#nlpw#jnslqwbmwbmmjufqpbqz#le#wkfpwzof>!ab`hdqlvmg.?oj=?fn=?b#kqfe>!,wkf#Bwobmwj`#L`fbmpwqj`woz#psfbhjmd/pklqwoz#afelqf#wkfgjeefqfmw#wzsfp#lewkf#Lwwlnbm#Fnsjqf=?jnd#pq`>!kwws9,,Bm#Jmwqlgv`wjlm#wl`lmpfrvfm`f#le#wkfgfsbqwvqf#eqln#wkf@lmefgfqbwf#Pwbwfpjmgjdfmlvp#sflsofpSql`ffgjmdp#le#wkfjmelqnbwjlm#lm#wkfwkflqjfp#kbuf#affmjmuloufnfmw#jm#wkfgjujgfg#jmwl#wkqffbgib`fmw#`lvmwqjfpjp#qfpslmpjaof#elqgjpplovwjlm#le#wkf`loobalqbwjlm#tjwktjgfoz#qfdbqgfg#bpkjp#`lmwfnslqbqjfpelvmgjmd#nfnafq#leGlnjmj`bm#Qfsvaoj`dfmfqbooz#b``fswfgwkf#slppjajojwz#lebqf#bopl#bubjobaofvmgfq#`lmpwqv`wjlmqfpwlqbwjlm#le#wkfwkf#dfmfqbo#svaoj`jp#bonlpw#fmwjqfozsbppfp#wkqlvdk#wkfkbp#affm#pvddfpwfg`lnsvwfq#bmg#ujgflDfqnbmj`#obmdvbdfp#b``lqgjmd#wl#wkf#gjeefqfmw#eqln#wkfpklqwoz#bewfqtbqgpkqfe>!kwwsp9,,ttt-qf`fmw#gfufolsnfmwAlbqg#le#Gjqf`wlqp?gju#`obpp>!pfbq`k\x7F#?b#kqfe>!kwws9,,Jm#sbqwj`vobq/#wkfNvowjsof#ellwmlwfplq#lwkfq#pvapwbm`fwklvpbmgp#le#zfbqpwqbmpobwjlm#le#wkf?,gju=\x0E\t?,gju=\x0E\t\x0E\t?b#kqfe>!jmgf{-skstbp#fpwbaojpkfg#jmnjm-ip!=?,p`qjsw=\tsbqwj`jsbwf#jm#wkfb#pwqlmd#jmeovfm`fpwzof>!nbqdjm.wls9qfsqfpfmwfg#az#wkfdqbgvbwfg#eqln#wkfWqbgjwjlmbooz/#wkfFofnfmw+!p`qjsw!*8Kltfufq/#pjm`f#wkf,gju=\t?,gju=\t?gju#ofew8#nbqdjm.ofew9sqlwf`wjlm#bdbjmpw38#ufqwj`bo.bojdm9Vmelqwvmbwfoz/#wkfwzsf>!jnbdf,{.j`lm,gju=\t?gju#`obpp>!#`obpp>!`ofbqej{!=?gju#`obpp>!ellwfq\n\n?,gju=\t\n\n?,gju=\twkf#nlwjlm#sj`wvqf<}=f<W<_<\\=l=m<V<T<]=f<W<_<\\=l=m<V<T<H<Y<X<Y=l<\\=j<T<T<Q<Y=m<V<R<W=`<V<R=m<R<R<]=e<Y<Q<T<Y=m<R<R<]=e<Y<Q<T=c<S=l<R<_=l<\\<P<P=g<r=n<S=l<\\<^<T=n=`<]<Y=m<S<W<\\=n<Q<R<P<\\=n<Y=l<T<\\<W=g<S<R<[<^<R<W=c<Y=n<S<R=m<W<Y<X<Q<T<Y=l<\\<[<W<T=k<Q=g=i<S=l<R<X=o<V=j<T<T<S=l<R<_=l<\\<P<P<\\<S<R<W<Q<R=m=n=`=b<Q<\\=i<R<X<T=n=m=c<T<[<]=l<\\<Q<Q<R<Y<Q<\\=m<Y<W<Y<Q<T=c<T<[<P<Y<Q<Y<Q<T=c<V<\\=n<Y<_<R=l<T<T<|<W<Y<V=m<\\<Q<X=l\fHJ\fIa\fHY\fHR\fH\\\fHR\fHB\fId\fHD\fIm\fHi\fH^\fHF\fIa\fH\\\fHJ\fHR\fHD\fHA\fHR\fH\\\fHH\fIl\fHC\fHi\fHD\fIm\fHJ\fIk\fHZ\fHU\fHS\fHD\fIa\fHJ\fIl\fHk\fHn\fHM\fHS\fHC\fHR\fHJ\fHS\fH^\fIa\fH^\fIl\fHi\fHK\fHS\fHy\fHR\fH\\\fHY\fIl\fHM\fHS\fHC\fIg\fHv\fHS\fHs\fIa\fHL\fIk\fHT\fHB\fHR\fHv\fHR\fH\\\fHp\fHn\fHy\fIa\fHZ\fHD\fHJ\fIm\fHD\fHS\fHC\fHR\fHF\fIa\fH\\\fHC\fIg\fH{\fHi\fHD\fIm\fHT\fHR\fH\\\fH}\fHD\fH^\fHR\fHk\fHD\fHF\fHR\fH\\\fIa\fHs\fIl\fHZ\fH\\\fIa\fHH\fIg\fHn\fH^\fIg\fHy\fHT\fHA\fHR\fHG\fHP\fIa\fH^\fId\fHZ\fHZ\fH\\\fIa\fHH\fIk\fHn\fHF\fIa\fH\\\fHJ\fIk\fHZ\fHF\fIa\fH^\fIk\fHC\fH\\\fHy\fIk\fHn\fHJ\fIa\fH\\\fHT\fIa\fHI\fHS\fHH\fHS\fHe\fHH\fIa\fHF\fHR\fHJ\fHe\fHD\fIa\fHU\fIk\fHn\fHv\fHS\fHs\fIa\fHL\fHR\fHC\fHR\fHH\fIa\fH\\\fHR\fHp\fIa\fHC\fHR\fHJ\fHR\fHF\fIm\fH\\\fHR\fHD\fIk\fHp\fIg\fHM\fHP\fIk\fHn\fHi\fHD\fIm\fHY\fHR\fHJ\fHZ\fIa\fH\\\fIk\fHO\fIl\fHZ\fHS\fHy\fIa\fH[\fHR\fHT\fH\\\fHy\fHR\fH\\\fIl\fHT\fHn\fH{\fIa\fH\\\fHU\fHF\fH\\\fHS\fHO\fHR\fHB\fH@\fIa\fH\\\fHR\fHn\fHM\fH@\fHv\fIa\fHv\fIg\fHn\fHe\fHF\fH^\fH@\fIa\fHK\fHB\fHn\fHH\fIa\fH\\\fIl\fHT\fHn\fHF\fH\\\fIa\fHy\fHe\fHB\fIa\fHB\fIl\fHJ\fHB\fHR\fHK\fIa\fHC\fHB\fHT\fHU\fHR\fHC\fHH\fHR\fHZ\fH@\fIa\fHJ\fIg\fHn\fHB\fIl\fHM\fHS\fHC\fHR\fHj\fHd\fHF\fIl\fHc\fH^\fHB\fIg\fH@\fHR\fHk\fH^\fHT\fHn\fHz\fIa\fHC\fHR\fHj\fHF\fH\\\fIk\fHZ\fHD\fHi\fHD\fIm\fH@\fHn\fHK\fH@\fHR\fHp\fHP\fHR\fH\\\fHD\fHY\fIl\fHD\fHH\fHB\fHF\fIa\fH\\\fHB\fIm\fHz\fHF\fIa\fH\\\fHZ\fIa\fHD\fHF\fH\\\fHS\fHY\fHR\fH\\\fHD\fIm\fHy\fHT\fHR\fHD\fHT\fHB\fH\\\fIa\fHI\fHD\fHj\fHC\fIg\fHp\fHS\fHH\fHT\fIg\fHB\fHY\fHR\fH\\4K5h5i4X4K4]5o4K4F4K5h5i5j4F4C5f4K4F4K5h5o5i4D5f5d4F4]4K5h5i4X4K5k4C4K4F4U4C4C4K5h4^5d4K4]4U4C4C4K5h4]4C5d4C4K5h4I4_5h4K5i5f4E4K5h5m5d4F5d4X5d4D4K5h5i4_4K4D5n4K4F4K5h5i4U5h5d5i4K4F4K5h5i4_5h4_5h4K4F4K5h4@4]4K5m5f5o4_4K5h4K4_5h4K5i5f4E4K5h4K4F4Y4K5h4K4Fhfztlqgp!#`lmwfmw>!t0-lqd,2:::,{kwno!=?b#wbqdfw>!\\aobmh!#wf{w,kwno8#`kbqpfw>!#wbqdfw>!\\aobmh!=?wbaof#`foosbggjmd>!bvwl`lnsofwf>!lee!#wf{w.bojdm9#`fmwfq8wl#obpw#ufqpjlm#az#ab`hdqlvmg.`lolq9# !#kqfe>!kwws9,,ttt-,gju=?,gju=?gju#jg>?b#kqfe>! !#`obpp>!!=?jnd#pq`>!kwws9,,`qjsw!#pq`>!kwws9,,\t?p`qjsw#obmdvbdf>!,,FM!#!kwws9,,ttt-tfm`lgfVQJ@lnslmfmw+!#kqfe>!ibubp`qjsw9?gju#`obpp>!`lmwfmwgl`vnfmw-tqjwf+$?p`slpjwjlm9#baplovwf8p`qjsw#pq`>!kwws9,,#pwzof>!nbqdjm.wls9-njm-ip!=?,p`qjsw=\t?,gju=\t?gju#`obpp>!t0-lqd,2:::,{kwno!#\t\x0E\t?,algz=\x0E\t?,kwno=gjpwjm`wjlm#afwtffm,!#wbqdfw>!\\aobmh!=?ojmh#kqfe>!kwws9,,fm`lgjmd>!vwe.;!<=\tt-bggFufmwOjpwfmfq<b`wjlm>!kwws9,,ttt-j`lm!#kqfe>!kwws9,,#pwzof>!ab`hdqlvmg9wzsf>!wf{w,`pp!#,=\tnfwb#sqlsfqwz>!ld9w?jmsvw#wzsf>!wf{w!##pwzof>!wf{w.bojdm9wkf#gfufolsnfmw#le#wzofpkffw!#wzsf>!wfkwno8#`kbqpfw>vwe.;jp#`lmpjgfqfg#wl#afwbaof#tjgwk>!233&!#Jm#bggjwjlm#wl#wkf#`lmwqjavwfg#wl#wkf#gjeefqfm`fp#afwtffmgfufolsnfmw#le#wkf#Jw#jp#jnslqwbmw#wl#?,p`qjsw=\t\t?p`qjsw##pwzof>!elmw.pjyf92=?,psbm=?psbm#jg>daOjaqbqz#le#@lmdqfpp?jnd#pq`>!kwws9,,jnFmdojpk#wqbmpobwjlmB`bgfnz#le#P`jfm`fpgju#pwzof>!gjpsobz9`lmpwqv`wjlm#le#wkf-dfwFofnfmwAzJg+jg*jm#`lmivm`wjlm#tjwkFofnfmw+$p`qjsw$*8#?nfwb#sqlsfqwz>!ld9<}=f<W<_<\\=l=m<V<T\t#wzsf>!wf{w!#mbnf>!=Sqjub`z#Sloj`z?,b=bgnjmjpwfqfg#az#wkffmbaofPjmdofQfrvfpwpwzof>%rvlw8nbqdjm9?,gju=?,gju=?,gju=?=?jnd#pq`>!kwws9,,j#pwzof>%rvlw8eolbw9qfefqqfg#wl#bp#wkf#wlwbo#slsvobwjlm#lejm#Tbpkjmdwlm/#G-@-#pwzof>!ab`hdqlvmg.bnlmd#lwkfq#wkjmdp/lqdbmjybwjlm#le#wkfsbqwj`jsbwfg#jm#wkfwkf#jmwqlgv`wjlm#lejgfmwjejfg#tjwk#wkfej`wjlmbo#`kbqb`wfq#L{elqg#Vmjufqpjwz#njpvmgfqpwbmgjmd#leWkfqf#bqf/#kltfufq/pwzofpkffw!#kqfe>!,@lovnajb#Vmjufqpjwzf{sbmgfg#wl#jm`ovgfvpvbooz#qfefqqfg#wljmgj`bwjmd#wkbw#wkfkbuf#pvddfpwfg#wkbwbeejojbwfg#tjwk#wkf`lqqfobwjlm#afwtffmmvnafq#le#gjeefqfmw=?,wg=?,wq=?,wbaof=Qfsvaoj`#le#Jqfobmg\t?,p`qjsw=\t?p`qjsw#vmgfq#wkf#jmeovfm`f`lmwqjavwjlm#wl#wkfLeej`jbo#tfapjwf#lekfbgrvbqwfqp#le#wkf`fmwfqfg#bqlvmg#wkfjnsoj`bwjlmp#le#wkfkbuf#affm#gfufolsfgEfgfqbo#Qfsvaoj`#leaf`bnf#jm`qfbpjmdoz`lmwjmvbwjlm#le#wkfMlwf/#kltfufq/#wkbwpjnjobq#wl#wkbw#le#`bsbajojwjfp#le#wkfb``lqgbm`f#tjwk#wkfsbqwj`jsbmwp#jm#wkfevqwkfq#gfufolsnfmwvmgfq#wkf#gjqf`wjlmjp#lewfm#`lmpjgfqfgkjp#zlvmdfq#aqlwkfq?,wg=?,wq=?,wbaof=?b#kwws.frvju>![.VB.skzpj`bo#sqlsfqwjfple#Aqjwjpk#@lovnajbkbp#affm#`qjwj`jyfg+tjwk#wkf#f{`fswjlmrvfpwjlmp#balvw#wkfsbppjmd#wkqlvdk#wkf3!#`foosbggjmd>!3!#wklvpbmgp#le#sflsofqfgjqf`wp#kfqf-#Elqkbuf#`kjogqfm#vmgfq&0F&0@,p`qjsw&0F!**8?b#kqfe>!kwws9,,ttt-?oj=?b#kqfe>!kwws9,,pjwf\\mbnf!#`lmwfmw>!wf{w.gf`lqbwjlm9mlmfpwzof>!gjpsobz9#mlmf?nfwb#kwws.frvju>![.mft#Gbwf+*-dfwWjnf+*#wzsf>!jnbdf,{.j`lm!?,psbm=?psbm#`obpp>!obmdvbdf>!ibubp`qjswtjmglt-ol`bwjlm-kqfe?b#kqfe>!ibubp`qjsw9..=\x0E\t?p`qjsw#wzsf>!w?b#kqfe>$kwws9,,ttt-klqw`vw#j`lm!#kqfe>!?,gju=\x0E\t?gju#`obpp>!?p`qjsw#pq`>!kwws9,,!#qfo>!pwzofpkffw!#w?,gju=\t?p`qjsw#wzsf>,b=#?b#kqfe>!kwws9,,#booltWqbmpsbqfm`z>![.VB.@lnsbwjaof!#`lmqfobwjlmpkjs#afwtffm\t?,p`qjsw=\x0E\t?p`qjsw#?,b=?,oj=?,vo=?,gju=bppl`jbwfg#tjwk#wkf#sqldqbnnjmd#obmdvbdf?,b=?b#kqfe>!kwws9,,?,b=?,oj=?oj#`obpp>!elqn#b`wjlm>!kwws9,,?gju#pwzof>!gjpsobz9wzsf>!wf{w!#mbnf>!r!?wbaof#tjgwk>!233&!#ab`hdqlvmg.slpjwjlm9!#alqgfq>!3!#tjgwk>!qfo>!pklqw`vw#j`lm!#k5=?vo=?oj=?b#kqfe>!##?nfwb#kwws.frvju>!`pp!#nfgjb>!p`qffm!#qfpslmpjaof#elq#wkf#!#wzsf>!bssoj`bwjlm,!#pwzof>!ab`hdqlvmg.kwno8#`kbqpfw>vwe.;!#booltwqbmpsbqfm`z>!pwzofpkffw!#wzsf>!wf\x0E\t?nfwb#kwws.frvju>!=?,psbm=?psbm#`obpp>!3!#`foopsb`jmd>!3!=8\t?,p`qjsw=\t?p`qjsw#plnfwjnfp#`boofg#wkfglfp#mlw#mf`fppbqjozElq#nlqf#jmelqnbwjlmbw#wkf#afdjmmjmd#le#?\"GL@WZSF#kwno=?kwnosbqwj`vobqoz#jm#wkf#wzsf>!kjggfm!#mbnf>!ibubp`qjsw9uljg+3*8!feef`wjufmfpp#le#wkf#bvwl`lnsofwf>!lee!#dfmfqbooz#`lmpjgfqfg=?jmsvw#wzsf>!wf{w!#!=?,p`qjsw=\x0E\t?p`qjswwkqlvdklvw#wkf#tlqog`lnnlm#njp`lm`fswjlmbppl`jbwjlm#tjwk#wkf?,gju=\t?,gju=\t?gju#`gvqjmd#kjp#ojefwjnf/`lqqfpslmgjmd#wl#wkfwzsf>!jnbdf,{.j`lm!#bm#jm`qfbpjmd#mvnafqgjsolnbwj`#qfobwjlmpbqf#lewfm#`lmpjgfqfgnfwb#`kbqpfw>!vwe.;!#?jmsvw#wzsf>!wf{w!#f{bnsofp#jm`ovgf#wkf!=?jnd#pq`>!kwws9,,jsbqwj`jsbwjlm#jm#wkfwkf#fpwbaojpknfmw#le\t?,gju=\t?gju#`obpp>!%bns8maps8%bns8maps8wl#gfwfqnjmf#tkfwkfqrvjwf#gjeefqfmw#eqlnnbqhfg#wkf#afdjmmjmdgjpwbm`f#afwtffm#wkf`lmwqjavwjlmp#wl#wkf`lmeoj`w#afwtffm#wkftjgfoz#`lmpjgfqfg#wltbp#lmf#le#wkf#ejqpwtjwk#ubqzjmd#gfdqffpkbuf#psf`vobwfg#wkbw+gl`vnfmw-dfwFofnfmwsbqwj`jsbwjmd#jm#wkflqjdjmbooz#gfufolsfgfwb#`kbqpfw>!vwe.;!=#wzsf>!wf{w,`pp!#,=\tjmwfq`kbmdfbaoz#tjwknlqf#`olpfoz#qfobwfgpl`jbo#bmg#slojwj`bowkbw#tlvog#lwkfqtjpfsfqsfmgj`vobq#wl#wkfpwzof#wzsf>!wf{w,`ppwzsf>!pvanjw!#mbnf>!ebnjojfp#qfpjgjmd#jmgfufolsjmd#`lvmwqjfp`lnsvwfq#sqldqbnnjmdf`lmlnj`#gfufolsnfmwgfwfqnjmbwjlm#le#wkfelq#nlqf#jmelqnbwjlmlm#pfufqbo#l``bpjlmpslqwvdv/Fp#+Fvqlsfv*<O<V=l<\\={<Q=m=`<V<\\=o<V=l<\\={<Q=m=`<V<\\<L<R=m=m<T<U=m<V<R<U<P<\\=n<Y=l<T<\\<W<R<^<T<Q=h<R=l<P<\\=j<T<T=o<S=l<\\<^<W<Y<Q<T=c<Q<Y<R<]=i<R<X<T<P<R<T<Q=h<R=l<P<\\=j<T=c<t<Q=h<R=l<P<\\=j<T=c<L<Y=m<S=o<]<W<T<V<T<V<R<W<T=k<Y=m=n<^<R<T<Q=h<R=l<P<\\=j<T=b=n<Y=l=l<T=n<R=l<T<T<X<R=m=n<\\=n<R=k<Q<R4K5h5i4F5d4K4@4C5d5j4K5h4K4X4F4]4K5o4K4F4K5h4K5n4F4]4K4A4K4Fkwno8#`kbqpfw>VWE.;!#pfwWjnflvw+evm`wjlm+*gjpsobz9jmojmf.aol`h8?jmsvw#wzsf>!pvanjw!#wzsf#>#$wf{w,ibubp`qj?jnd#pq`>!kwws9,,ttt-!#!kwws9,,ttt-t0-lqd,pklqw`vw#j`lm!#kqfe>!!#bvwl`lnsofwf>!lee!#?,b=?,gju=?gju#`obpp>?,b=?,oj=\t?oj#`obpp>!`pp!#wzsf>!wf{w,`pp!#?elqn#b`wjlm>!kwws9,,{w,`pp!#kqfe>!kwws9,,ojmh#qfo>!bowfqmbwf!#\x0E\t?p`qjsw#wzsf>!wf{w,#lm`oj`h>!ibubp`qjsw9+mft#Gbwf*-dfwWjnf+*~kfjdkw>!2!#tjgwk>!2!#Sflsof$p#Qfsvaoj`#le##?b#kqfe>!kwws9,,ttt-wf{w.gf`lqbwjlm9vmgfqwkf#afdjmmjmd#le#wkf#?,gju=\t?,gju=\t?,gju=\tfpwbaojpknfmw#le#wkf#?,gju=?,gju=?,gju=?,g ujftslqwxnjm.kfjdkw9\t?p`qjsw#pq`>!kwws9,,lswjlm=?lswjlm#ubovf>lewfm#qfefqqfg#wl#bp#,lswjlm=\t?lswjlm#ubov?\"GL@WZSF#kwno=\t?\"..XJmwfqmbwjlmbo#Bjqslqw=\t?b#kqfe>!kwws9,,ttt?,b=?b#kqfe>!kwws9,,t\fTL\fT^\fTE\fT^\fUh\fT{\fTN\roI\ro|\roL\ro{\roO\rov\rot\nAO\x05Gx\bTA\nzk#+\x0BUm\x05Gx*\fHD\fHS\fH\\\fIa\fHJ\fIk\fHZ\fHM\fHR\fHe\fHD\fH^\fIg\fHM\fHy\fIa\fH[\fIk\fHH\fIa\fH\\\fHp\fHR\fHD\fHy\fHR\fH\\\fIl\fHT\fHn\fH@\fHn\fHK\fHS\fHH\fHT\fIa\fHI\fHR\fHF\fHD\fHR\fHT\fIa\fHY\fIl\fHy\fHR\fH\\\fHT\fHn\fHT\fIa\fHy\fH\\\fHO\fHT\fHR\fHB\fH{\fIa\fH\\\fIl\fHv\fHS\fHs\fIa\fHL\fIg\fHn\fHY\fHS\fHp\fIa\fHr\fHR\fHD\fHi\fHB\fIk\fH\\\fHS\fHy\fHR\fHY\fHS\fHA\fHS\fHD\fIa\fHD\fH{\fHR\fHM\fHS\fHC\fHR\fHm\fHy\fIa\fHC\fIg\fHn\fHy\fHS\fHT\fIm\fH\\\fHy\fIa\fH[\fHR\fHF\fHU\fIm\fHm\fHv\fHH\fIl\fHF\fIa\fH\\\fH@\fHn\fHK\fHD\fHs\fHS\fHF\fIa\fHF\fHO\fIl\fHy\fIa\fH\\\fHS\fHy\fIk\fHs\fHF\fIa\fH\\\fHR\fH\\\fHn\fHA\fHF\fIa\fH\\\fHR\fHF\fIa\fHH\fHB\fHR\fH^\fHS\fHy\fIg\fHn\fH\\\fHG\fHP\fIa\fHH\fHR\fH\\\fHD\fHS\fH\\\fIa\fHB\fHR\fHO\fH^\fHS\fHB\fHS\fHs\fIk\fHMgfp`qjswjlm!#`lmwfmw>!gl`vnfmw-ol`bwjlm-sqlw-dfwFofnfmwpAzWbdMbnf+?\"GL@WZSF#kwno=\t?kwno#?nfwb#`kbqpfw>!vwe.;!=9vqo!#`lmwfmw>!kwws9,,-`pp!#qfo>!pwzofpkffw!pwzof#wzsf>!wf{w,`pp!=wzsf>!wf{w,`pp!#kqfe>!t0-lqd,2:::,{kwno!#{nowzsf>!wf{w,ibubp`qjsw!#nfwklg>!dfw!#b`wjlm>!ojmh#qfo>!pwzofpkffw!##>#gl`vnfmw-dfwFofnfmwwzsf>!jnbdf,{.j`lm!#,=`foosbggjmd>!3!#`foops-`pp!#wzsf>!wf{w,`pp!#?,b=?,oj=?oj=?b#kqfe>!!#tjgwk>!2!#kfjdkw>!2!!=?b#kqfe>!kwws9,,ttt-pwzof>!gjpsobz9mlmf8!=bowfqmbwf!#wzsf>!bssoj.,,T0@,,GWG#[KWNO#2-3#foopsb`jmd>!3!#`foosbg#wzsf>!kjggfm!#ubovf>!,b=%maps8?psbm#qlof>!p\t?jmsvw#wzsf>!kjggfm!#obmdvbdf>!IbubP`qjsw!##gl`vnfmw-dfwFofnfmwpAd>!3!#`foopsb`jmd>!3!#zsf>!wf{w,`pp!#nfgjb>!wzsf>$wf{w,ibubp`qjsw$tjwk#wkf#f{`fswjlm#le#zsf>!wf{w,`pp!#qfo>!pw#kfjdkw>!2!#tjgwk>!2!#>$(fm`lgfVQJ@lnslmfmw+?ojmh#qfo>!bowfqmbwf!#\talgz/#wq/#jmsvw/#wf{wnfwb#mbnf>!qlalwp!#`lmnfwklg>!slpw!#b`wjlm>!=\t?b#kqfe>!kwws9,,ttt-`pp!#qfo>!pwzofpkffw!#?,gju=?,gju=?gju#`obppobmdvbdf>!ibubp`qjsw!=bqjb.kjggfm>!wqvf!=.[?qjsw!#wzsf>!wf{w,ibubpo>38~*+*8\t+evm`wjlm+*xab`hdqlvmg.jnbdf9#vqo+,b=?,oj=?oj=?b#kqfe>!k\n\n?oj=?b#kqfe>!kwws9,,bwlq!#bqjb.kjggfm>!wqv=#?b#kqfe>!kwws9,,ttt-obmdvbdf>!ibubp`qjsw!#,lswjlm=\t?lswjlm#ubovf,gju=?,gju=?gju#`obpp>qbwlq!#bqjb.kjggfm>!wqf>+mft#Gbwf*-dfwWjnf+*slqwvdv/Fp#+gl#Aqbpjo*<R=l<_<\\<Q<T<[<\\=j<T<T<^<R<[<P<R<Z<Q<R=m=n=`<R<]=l<\\<[<R<^<\\<Q<T=c=l<Y<_<T=m=n=l<\\=j<T<T<^<R<[<P<R<Z<Q<R=m=n<T<R<]=c<[<\\=n<Y<W=`<Q<\\?\"GL@WZSF#kwno#SVAOJ@#!mw.Wzsf!#`lmwfmw>!wf{w,?nfwb#kwws.frvju>!@lmwfqbmpjwjlmbo,,FM!#!kwws9?kwno#{nomp>!kwws9,,ttt.,,T0@,,GWG#[KWNO#2-3#WGWG,{kwno2.wqbmpjwjlmbo,,ttt-t0-lqd,WQ,{kwno2,sf#>#$wf{w,ibubp`qjsw$8?nfwb#mbnf>!gfp`qjswjlmsbqfmwMlgf-jmpfqwAfelqf?jmsvw#wzsf>!kjggfm!#mbip!#wzsf>!wf{w,ibubp`qj+gl`vnfmw*-qfbgz+evm`wjp`qjsw#wzsf>!wf{w,ibubpjnbdf!#`lmwfmw>!kwws9,,VB.@lnsbwjaof!#`lmwfmw>wno8#`kbqpfw>vwe.;!#,=\tojmh#qfo>!pklqw`vw#j`lm?ojmh#qfo>!pwzofpkffw!#?,p`qjsw=\t?p`qjsw#wzsf>>#gl`vnfmw-`qfbwfFofnfm?b#wbqdfw>!\\aobmh!#kqfe>#gl`vnfmw-dfwFofnfmwpAjmsvw#wzsf>!wf{w!#mbnf>b-wzsf#>#$wf{w,ibubp`qjmsvw#wzsf>!kjggfm!#mbnfkwno8#`kbqpfw>vwe.;!#,=gwg!=\t?kwno#{nomp>!kwws.,,T0@,,GWG#KWNO#7-32#WfmwpAzWbdMbnf+$p`qjsw$*jmsvw#wzsf>!kjggfm!#mbn?p`qjsw#wzsf>!wf{w,ibubp!#pwzof>!gjpsobz9mlmf8!=gl`vnfmw-dfwFofnfmwAzJg+>gl`vnfmw-`qfbwfFofnfmw+$#wzsf>$wf{w,ibubp`qjsw$jmsvw#wzsf>!wf{w!#mbnf>!g-dfwFofnfmwpAzWbdMbnf+pmj`bo!#kqfe>!kwws9,,ttt-@,,GWG#KWNO#7-32#Wqbmpjw?pwzof#wzsf>!wf{w,`pp!=\t\t?pwzof#wzsf>!wf{w,`pp!=jlmbo-gwg!=\t?kwno#{nomp>kwws.frvju>[email protected]>!3!#`foopsb`jmd>!3!kwno8#`kbqpfw>vwe.;!#,=\t#pwzof>!gjpsobz9mlmf8!=??oj=?b#kqfe>!kwws9,,ttt-#wzsf>$wf{w,ibubp`qjsw$=<X<Y=c=n<Y<W=`<Q<R=m=n<T=m<R<R=n<^<Y=n=m=n<^<T<T<S=l<R<T<[<^<R<X=m=n<^<\\<]<Y<[<R<S<\\=m<Q<R=m=n<T\fHF\fIm\fHT\fIa\fHH\fHS\fHy\fHR\fHy\fHR\fHn\fH{\fIa\fH\\\fIk\fHT\fHe\fHD\fIa\fHU\fIg\fHn\fHD\fIk\fHY\fHS\fHK\fHR\fHD\fHT\fHA\fHR\fHG\fHS\fHy\fIa\fHT\fHS\fHn\fH{\fHT\fIm\fH\\\fHy\fIa\fH[\fHS\fHH\fHy\fIe\fHF\fIl\fH\\\fHR\fHk\fHs\fHY\fHS\fHp\fIa\fHr\fHR\fHF\fHD\fHy\fHR\fH\\\fIa\fH\\\fHY\fHR\fHd\fHT\fHy\fIa\fH\\\fHS\fHC\fHH\fHR", "\u06F7%\u018C'T%\x85'W%\xD7%O%g%\xA6&\u0193%\u01E5&>&*&'&^&\x88\u0178\u0C3E&\u01AD&\u0192&)&^&%&'&\x82&P&1&\xB1&3&]&m&u&E&t&C&\xCF&V&V&/&>&6&\u0F76\u177Co&p&@&E&M&P&x&@&F&e&\xCC&7&:&(&D&0&C&)&.&F&-&1&(&L&F&1\u025E*\u03EA\u21F3&\u1372&K&;&)&E&H&P&0&?&9&V&\x81&-&v&a&,&E&)&?&=&'&'&B&\u0D2E&\u0503&\u0316*&*8&%&%&&&%,)&\x9A&>&\x86&7&]&F&2&>&J&6&n&2&%&?&\x8E&2&6&J&g&-&0&,&*&J&*&O&)&6&(&<&B&N&.&P&@&2&.&W&M&%\u053C\x84(,(<&,&\u03DA&\u18C7&-&,(%&(&%&(\u013B0&X&D&\x81&j&'&J&(&.&B&3&Z&R&h&3&E&E&<\xC6-\u0360\u1EF3&%8?&@&,&Z&@&0&J&,&^&x&_&6&C&6&C\u072C\u2A25&f&-&-&-&-&,&J&2&8&z&8&C&Y&8&-&d&\u1E78\xCC-&7&1&F&7&t&W&7&I&.&.&^&=\u0F9C\u19D3&8(>&/&/&\u077B')'\u1065')'%@/&0&%\u043E\u09C0*&*@&C\u053D\u05D4\u0274\u05EB4\u0DD7\u071A\u04D16\u0D84&/\u0178\u0303Z&*%\u0246\u03FF&\u0134&1\xA8\u04B4\u0174", dictionarySizeBits, "AAAAKKLLKKKKKJJIHHIHHGGFF"); 16515 setData(dictionaryData, dictionarySizeBits); 16516 function InputStream(data) { 16517 this.data = new Int8Array(0); 16518 this.offset = 0; 16519 this.data = data; 16520 } 16521 function readInput(s, dst, offset, length) { 16522 if (s.input === null) { 16523 return -1; 16524 } 16525 const src = s.input; 16526 const end = Math.min(src.offset + length, src.data.length); 16527 const bytesRead = end - src.offset; 16528 dst.set(src.data.subarray(src.offset, end), offset); 16529 src.offset += bytesRead; 16530 return bytesRead; 16531 } 16532 function closeInput(s) { 16533 s.input = new InputStream(new Int8Array(0)); 16534 } 16535 function toUsAsciiBytes(src) { 16536 const n = src.length; 16537 const result = new Int8Array(n); 16538 for (let i = 0; i < n; ++i) { 16539 result[i] = src.charCodeAt(i); 16540 } 16541 return result; 16542 } 16543 function toUtf8Runes(src) { 16544 const n = src.length; 16545 const result = new Int32Array(n); 16546 for (let i = 0; i < n; ++i) { 16547 result[i] = src.charCodeAt(i); 16548 } 16549 return result; 16550 } 16551 function makeError(s, code) { 16552 if (code >= 0) { 16553 return code; 16554 } 16555 if (s.runningState >= 0) { 16556 s.runningState = code; 16557 } 16558 throw new Error("Brotli error code: " + code); 16559 } 16560 let ByteBuffer; 16561 function decode(bytes, options) { 16562 let s = new State(); 16563 s.input = new InputStream(bytes); 16564 initState(s); 16565 if (options) { 16566 let customDictionary = options["customDictionary"]; 16567 if (customDictionary) attachDictionaryChunk(s, customDictionary); 16568 } 16569 let totalOutput = 0; 16570 let chunks = []; 16571 while (true) { 16572 let chunk = new Int8Array(16384); 16573 chunks.push(chunk); 16574 s.output = chunk; 16575 s.outputOffset = 0; 16576 s.outputLength = 16384; 16577 s.outputUsed = 0; 16578 decompress(s); 16579 totalOutput += s.outputUsed; 16580 if (s.outputUsed < 16384) break; 16581 } 16582 close(s); 16583 closeInput(s); 16584 let result = new Int8Array(totalOutput); 16585 let offset = 0; 16586 for (let i = 0; i < chunks.length; ++i) { 16587 let chunk = chunks[i]; 16588 let end = Math.min(totalOutput, offset + 16384); 16589 let len = end - offset; 16590 if (len < 16384) { 16591 result.set(chunk.subarray(0, len), offset); 16592 } else { 16593 result.set(chunk, offset); 16594 } 16595 offset += len; 16596 } 16597 return result; 16598 } 16599 return decode; 16600}; 16601let BrotliDecode = makeBrotliDecode(); 16602;// ./src/core/brotli_stream.js 16603 16604 16605
vendor: 2,556 bytes, lines 16606-16713
16606 16607 16608 16609 16610 16611 16612 16613 16614class BrotliStream extends DecodeStream { 16615 #isAsync = true; 16616 constructor(stream, maybeLength) { 16617 super(maybeLength); 16618 this.stream = stream; 16619 this.dict = stream.dict; 16620 } 16621 readBlock() { 16622 const bytes = this.stream.getBytes(); 16623 const decodedData = BrotliDecode(new Int8Array(bytes.buffer, bytes.byteOffset, bytes.length)); 16624 this.buffer = new Uint8Array(decodedData.buffer, decodedData.byteOffset, decodedData.length); 16625 this.bufferLength = this.buffer.length; 16626 this.eof = true; 16627 } 16628 async getImageData(length, _decoderOptions) { 16629 const data = await this.asyncGetBytes(); 16630 if (!data) { 16631 return this.getBytes(length); 16632 } 16633 if (data.length <= length) { 16634 return data; 16635 } 16636 return data.subarray(0, length); 16637 } 16638 async asyncGetBytes() { 16639 const { 16640 decompressed, 16641 compressed 16642 } = await this.asyncGetBytesFromDecompressionStream("brotli"); 16643 if (decompressed) { 16644 return decompressed; 16645 } 16646 this.#isAsync = false; 16647 this.stream = new Stream(compressed, 0, compressed.length, this.stream.dict); 16648 this.reset(); 16649 return null; 16650 } 16651 get isAsync() { 16652 return this.#isAsync; 16653 } 16654} 16655 16656;// ./src/core/ccitt_stream.js 16657 16658 16659 16660 16661class CCITTFaxStream extends DecodeStream { 16662 constructor(str, maybeLength, params) { 16663 super(maybeLength); 16664 this.stream = str; 16665 this.maybeLength = maybeLength; 16666 this.dict = str.dict; 16667 if (!(params instanceof Dict)) { 16668 params = Dict.empty; 16669 } 16670 this.params = { 16671 K: params.get("K") || 0, 16672 EndOfLine: !!params.get("EndOfLine"), 16673 EncodedByteAlign: !!params.get("EncodedByteAlign"), 16674 Columns: params.get("Columns") || 1728, 16675 Rows: params.get("Rows") || 0, 16676 EndOfBlock: !!(params.get("EndOfBlock") ?? true), 16677 BlackIs1: !!params.get("BlackIs1") 16678 }; 16679 } 16680 get bytes() { 16681 return shadow(this, "bytes", this.stream.getBytes(this.maybeLength)); 16682 } 16683 readBlock() { 16684 unreachable("CCITTFaxStream.readBlock"); 16685 } 16686 get isImageStream() { 16687 return true; 16688 } 16689 get isAsyncDecoder() { 16690 return true; 16691 } 16692 async decodeImage(bytes, length, _decoderOptions) { 16693 if (this.eof) { 16694 return this.buffer; 16695 } 16696 if (!bytes) { 16697 bytes = this.stream.isAsync ? (await this.stream.asyncGetBytes()) || this.bytes : this.bytes; 16698 } 16699 this.buffer = await JBig2CCITTFaxImage.decode(bytes, this.dict.get("W", "Width"), this.dict.get("H", "Height"), null, this.params); 16700 this.bufferLength = this.buffer.length; 16701 this.eof = true; 16702 return this.buffer; 16703 } 16704} 16705 16706;// ./src/core/flate_stream.js 16707 16708 16709 16710 16711 16712 16713
vendor: 13,846 bytes, lines 16714-17011
16714 16715 16716 16717 16718const codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]); 16719const lengthDecode = new Int32Array([0x00003, 0x00004, 0x00005, 0x00006, 0x00007, 0x00008, 0x00009, 0x0000a, 0x1000b, 0x1000d, 0x1000f, 0x10011, 0x20013, 0x20017, 0x2001b, 0x2001f, 0x30023, 0x3002b, 0x30033, 0x3003b, 0x40043, 0x40053, 0x40063, 0x40073, 0x50083, 0x500a3, 0x500c3, 0x500e3, 0x00102, 0x00102, 0x00102]); 16720const distDecode = new Int32Array([0x00001, 0x00002, 0x00003, 0x00004, 0x10005, 0x10007, 0x20009, 0x2000d, 0x30011, 0x30019, 0x40021, 0x40031, 0x50041, 0x50061, 0x60081, 0x600c1, 0x70101, 0x70181, 0x80201, 0x80301, 0x90401, 0x90601, 0xa0801, 0xa0c01, 0xb1001, 0xb1801, 0xc2001, 0xc3001, 0xd4001, 0xd6001]); 16721const fixedLitCodeTab = [new Int32Array([0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c0, 0x70108, 0x80060, 0x80020, 0x900a0, 0x80000, 0x80080, 0x80040, 0x900e0, 0x70104, 0x80058, 0x80018, 0x90090, 0x70114, 0x80078, 0x80038, 0x900d0, 0x7010c, 0x80068, 0x80028, 0x900b0, 0x80008, 0x80088, 0x80048, 0x900f0, 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c8, 0x7010a, 0x80064, 0x80024, 0x900a8, 0x80004, 0x80084, 0x80044, 0x900e8, 0x70106, 0x8005c, 0x8001c, 0x90098, 0x70116, 0x8007c, 0x8003c, 0x900d8, 0x7010e, 0x8006c, 0x8002c, 0x900b8, 0x8000c, 0x8008c, 0x8004c, 0x900f8, 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c4, 0x70109, 0x80062, 0x80022, 0x900a4, 0x80002, 0x80082, 0x80042, 0x900e4, 0x70105, 0x8005a, 0x8001a, 0x90094, 0x70115, 0x8007a, 0x8003a, 0x900d4, 0x7010d, 0x8006a, 0x8002a, 0x900b4, 0x8000a, 0x8008a, 0x8004a, 0x900f4, 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cc, 0x7010b, 0x80066, 0x80026, 0x900ac, 0x80006, 0x80086, 0x80046, 0x900ec, 0x70107, 0x8005e, 0x8001e, 0x9009c, 0x70117, 0x8007e, 0x8003e, 0x900dc, 0x7010f, 0x8006e, 0x8002e, 0x900bc, 0x8000e, 0x8008e, 0x8004e, 0x900fc, 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c2, 0x70108, 0x80061, 0x80021, 0x900a2, 0x80001, 0x80081, 0x80041, 0x900e2, 0x70104, 0x80059, 0x80019, 0x90092, 0x70114, 0x80079, 0x80039, 0x900d2, 0x7010c, 0x80069, 0x80029, 0x900b2, 0x80009, 0x80089, 0x80049, 0x900f2, 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900ca, 0x7010a, 0x80065, 0x80025, 0x900aa, 0x80005, 0x80085, 0x80045, 0x900ea, 0x70106, 0x8005d, 0x8001d, 0x9009a, 0x70116, 0x8007d, 0x8003d, 0x900da, 0x7010e, 0x8006d, 0x8002d, 0x900ba, 0x8000d, 0x8008d, 0x8004d, 0x900fa, 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c6, 0x70109, 0x80063, 0x80023, 0x900a6, 0x80003, 0x80083, 0x80043, 0x900e6, 0x70105, 0x8005b, 0x8001b, 0x90096, 0x70115, 0x8007b, 0x8003b, 0x900d6, 0x7010d, 0x8006b, 0x8002b, 0x900b6, 0x8000b, 0x8008b, 0x8004b, 0x900f6, 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900ce, 0x7010b, 0x80067, 0x80027, 0x900ae, 0x80007, 0x80087, 0x80047, 0x900ee, 0x70107, 0x8005f, 0x8001f, 0x9009e, 0x70117, 0x8007f, 0x8003f, 0x900de, 0x7010f, 0x8006f, 0x8002f, 0x900be, 0x8000f, 0x8008f, 0x8004f, 0x900fe, 0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c1, 0x70108, 0x80060, 0x80020, 0x900a1, 0x80000, 0x80080, 0x80040, 0x900e1, 0x70104, 0x80058, 0x80018, 0x90091, 0x70114, 0x80078, 0x80038, 0x900d1, 0x7010c, 0x80068, 0x80028, 0x900b1, 0x80008, 0x80088, 0x80048, 0x900f1, 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c9, 0x7010a, 0x80064, 0x80024, 0x900a9, 0x80004, 0x80084, 0x80044, 0x900e9, 0x70106, 0x8005c, 0x8001c, 0x90099, 0x70116, 0x8007c, 0x8003c, 0x900d9, 0x7010e, 0x8006c, 0x8002c, 0x900b9, 0x8000c, 0x8008c, 0x8004c, 0x900f9, 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c5, 0x70109, 0x80062, 0x80022, 0x900a5, 0x80002, 0x80082, 0x80042, 0x900e5, 0x70105, 0x8005a, 0x8001a, 0x90095, 0x70115, 0x8007a, 0x8003a, 0x900d5, 0x7010d, 0x8006a, 0x8002a, 0x900b5, 0x8000a, 0x8008a, 0x8004a, 0x900f5, 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cd, 0x7010b, 0x80066, 0x80026, 0x900ad, 0x80006, 0x80086, 0x80046, 0x900ed, 0x70107, 0x8005e, 0x8001e, 0x9009d, 0x70117, 0x8007e, 0x8003e, 0x900dd, 0x7010f, 0x8006e, 0x8002e, 0x900bd, 0x8000e, 0x8008e, 0x8004e, 0x900fd, 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c3, 0x70108, 0x80061, 0x80021, 0x900a3, 0x80001, 0x80081, 0x80041, 0x900e3, 0x70104, 0x80059, 0x80019, 0x90093, 0x70114, 0x80079, 0x80039, 0x900d3, 0x7010c, 0x80069, 0x80029, 0x900b3, 0x80009, 0x80089, 0x80049, 0x900f3, 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900cb, 0x7010a, 0x80065, 0x80025, 0x900ab, 0x80005, 0x80085, 0x80045, 0x900eb, 0x70106, 0x8005d, 0x8001d, 0x9009b, 0x70116, 0x8007d, 0x8003d, 0x900db, 0x7010e, 0x8006d, 0x8002d, 0x900bb, 0x8000d, 0x8008d, 0x8004d, 0x900fb, 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c7, 0x70109, 0x80063, 0x80023, 0x900a7, 0x80003, 0x80083, 0x80043, 0x900e7, 0x70105, 0x8005b, 0x8001b, 0x90097, 0x70115, 0x8007b, 0x8003b, 0x900d7, 0x7010d, 0x8006b, 0x8002b, 0x900b7, 0x8000b, 0x8008b, 0x8004b, 0x900f7, 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900cf, 0x7010b, 0x80067, 0x80027, 0x900af, 0x80007, 0x80087, 0x80047, 0x900ef, 0x70107, 0x8005f, 0x8001f, 0x9009f, 0x70117, 0x8007f, 0x8003f, 0x900df, 0x7010f, 0x8006f, 0x8002f, 0x900bf, 0x8000f, 0x8008f, 0x8004f, 0x900ff]), 9]; 16722const fixedDistCodeTab = [new Int32Array([0x50000, 0x50010, 0x50008, 0x50018, 0x50004, 0x50014, 0x5000c, 0x5001c, 0x50002, 0x50012, 0x5000a, 0x5001a, 0x50006, 0x50016, 0x5000e, 0x00000, 0x50001, 0x50011, 0x50009, 0x50019, 0x50005, 0x50015, 0x5000d, 0x5001d, 0x50003, 0x50013, 0x5000b, 0x5001b, 0x50007, 0x50017, 0x5000f, 0x00000]), 5]; 16723class FlateStream extends DecodeStream { 16724 #isAsync = true; 16725 constructor(str, maybeLength) { 16726 super(maybeLength); 16727 this.stream = str; 16728 this.dict = str.dict; 16729 const cmf = str.getByte(); 16730 const flg = str.getByte(); 16731 if (cmf === -1 || flg === -1) { 16732 throw new FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`); 16733 } 16734 if ((cmf & 0x0f) !== 0x08) { 16735 throw new FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`); 16736 } 16737 if (((cmf << 8) + flg) % 31 !== 0) { 16738 throw new FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`); 16739 } 16740 if (flg & 0x20) { 16741 throw new FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`); 16742 } 16743 this.codeSize = 0; 16744 this.codeBuf = 0; 16745 } 16746 async getImageData(length, _decoderOptions) { 16747 const data = await this.asyncGetBytes(); 16748 if (!data) { 16749 return this.getBytes(length); 16750 } 16751 if (data.length <= length) { 16752 return data; 16753 } 16754 return data.subarray(0, length); 16755 } 16756 async asyncGetBytes() { 16757 const { 16758 decompressed, 16759 compressed 16760 } = await this.asyncGetBytesFromDecompressionStream("deflate"); 16761 if (decompressed) { 16762 return decompressed; 16763 } 16764 this.#isAsync = false; 16765 this.stream = new Stream(compressed, 2, compressed.length, this.stream.dict); 16766 this.reset(); 16767 return null; 16768 } 16769 get isAsync() { 16770 return this.#isAsync; 16771 } 16772 getBits(bits) { 16773 const str = this.stream; 16774 let codeSize = this.codeSize; 16775 let codeBuf = this.codeBuf; 16776 let b; 16777 while (codeSize < bits) { 16778 if ((b = str.getByte()) === -1) { 16779 throw new FormatError("Bad encoding in flate stream"); 16780 } 16781 codeBuf |= b << codeSize; 16782 codeSize += 8; 16783 } 16784 b = codeBuf & (1 << bits) - 1; 16785 this.codeBuf = codeBuf >> bits; 16786 this.codeSize = codeSize -= bits; 16787 return b; 16788 } 16789 getCode(table) { 16790 const str = this.stream; 16791 const codes = table[0]; 16792 const maxLen = table[1]; 16793 let codeSize = this.codeSize; 16794 let codeBuf = this.codeBuf; 16795 let b; 16796 while (codeSize < maxLen) { 16797 if ((b = str.getByte()) === -1) { 16798 break; 16799 } 16800 codeBuf |= b << codeSize; 16801 codeSize += 8; 16802 } 16803 const code = codes[codeBuf & (1 << maxLen) - 1]; 16804 const codeLen = code >> 16; 16805 const codeVal = code & 0xffff; 16806 if (codeLen < 1 || codeSize < codeLen) { 16807 throw new FormatError("Bad encoding in flate stream"); 16808 } 16809 this.codeBuf = codeBuf >> codeLen; 16810 this.codeSize = codeSize - codeLen; 16811 return codeVal; 16812 } 16813 generateHuffmanTable(lengths) { 16814 const n = lengths.length; 16815 let maxLen = 0; 16816 let i; 16817 for (i = 0; i < n; ++i) { 16818 if (lengths[i] > maxLen) { 16819 maxLen = lengths[i]; 16820 } 16821 } 16822 const size = 1 << maxLen; 16823 const codes = new Int32Array(size); 16824 for (let len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) { 16825 for (let val = 0; val < n; ++val) { 16826 if (lengths[val] === len) { 16827 let code2 = 0; 16828 let t = code; 16829 for (i = 0; i < len; ++i) { 16830 code2 = code2 << 1 | t & 1; 16831 t >>= 1; 16832 } 16833 for (i = code2; i < size; i += skip) { 16834 codes[i] = len << 16 | val; 16835 } 16836 ++code; 16837 } 16838 } 16839 } 16840 return [codes, maxLen]; 16841 } 16842 #endsStreamOnError(err) { 16843 info(err); 16844 this.eof = true; 16845 } 16846 readBlock() { 16847 let buffer, hdr, len; 16848 const str = this.stream; 16849 try { 16850 hdr = this.getBits(3); 16851 } catch (ex) { 16852 this.#endsStreamOnError(ex.message); 16853 return; 16854 } 16855 if (hdr & 1) { 16856 this.eof = true; 16857 } 16858 hdr >>= 1; 16859 if (hdr === 0) { 16860 let b; 16861 if ((b = str.getByte()) === -1) { 16862 this.#endsStreamOnError("Bad block header in flate stream"); 16863 return; 16864 } 16865 let blockLen = b; 16866 if ((b = str.getByte()) === -1) { 16867 this.#endsStreamOnError("Bad block header in flate stream"); 16868 return; 16869 } 16870 blockLen |= b << 8; 16871 if ((b = str.getByte()) === -1) { 16872 this.#endsStreamOnError("Bad block header in flate stream"); 16873 return; 16874 } 16875 let check = b; 16876 if ((b = str.getByte()) === -1) { 16877 this.#endsStreamOnError("Bad block header in flate stream"); 16878 return; 16879 } 16880 check |= b << 8; 16881 if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) { 16882 throw new FormatError("Bad uncompressed block length in flate stream"); 16883 } 16884 this.codeBuf = 0; 16885 this.codeSize = 0; 16886 const bufferLength = this.bufferLength, 16887 end = bufferLength + blockLen; 16888 buffer = this.ensureBuffer(end); 16889 this.bufferLength = end; 16890 if (blockLen === 0) { 16891 if (str.peekByte() === -1) { 16892 this.eof = true; 16893 } 16894 } else { 16895 const block = str.getBytes(blockLen); 16896 buffer.set(block, bufferLength); 16897 if (block.length < blockLen) { 16898 this.eof = true; 16899 } 16900 } 16901 return; 16902 } 16903 let litCodeTable; 16904 let distCodeTable; 16905 if (hdr === 1) { 16906 litCodeTable = fixedLitCodeTab; 16907 distCodeTable = fixedDistCodeTab; 16908 } else if (hdr === 2) { 16909 const numLitCodes = this.getBits(5) + 257; 16910 const numDistCodes = this.getBits(5) + 1; 16911 const numCodeLenCodes = this.getBits(4) + 4; 16912 const codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length); 16913 let i; 16914 for (i = 0; i < numCodeLenCodes; ++i) { 16915 codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3); 16916 } 16917 const codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths); 16918 len = 0; 16919 i = 0; 16920 const codes = numLitCodes + numDistCodes; 16921 const codeLengths = new Uint8Array(codes); 16922 let bitsLength, bitsOffset, what; 16923 while (i < codes) { 16924 const code = this.getCode(codeLenCodeTab); 16925 if (code === 16) { 16926 bitsLength = 2; 16927 bitsOffset = 3; 16928 what = len; 16929 } else if (code === 17) { 16930 bitsLength = 3; 16931 bitsOffset = 3; 16932 what = len = 0; 16933 } else if (code === 18) { 16934 bitsLength = 7; 16935 bitsOffset = 11; 16936 what = len = 0; 16937 } else { 16938 codeLengths[i++] = len = code; 16939 continue; 16940 } 16941 let repeatLength = this.getBits(bitsLength) + bitsOffset; 16942 while (repeatLength-- > 0) { 16943 codeLengths[i++] = what; 16944 } 16945 } 16946 litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes)); 16947 distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes)); 16948 } else { 16949 throw new FormatError("Unknown block type in flate stream"); 16950 } 16951 buffer = this.buffer; 16952 let limit = buffer ? buffer.length : 0; 16953 let pos = this.bufferLength; 16954 while (true) { 16955 let code1 = this.getCode(litCodeTable); 16956 if (code1 < 256) { 16957 if (pos + 1 >= limit) { 16958 buffer = this.ensureBuffer(pos + 1); 16959 limit = buffer.length; 16960 } 16961 buffer[pos++] = code1; 16962 continue; 16963 } 16964 if (code1 === 256) { 16965 this.bufferLength = pos; 16966 return; 16967 } 16968 code1 -= 257; 16969 code1 = lengthDecode[code1]; 16970 let code2 = code1 >> 16; 16971 if (code2 > 0) { 16972 code2 = this.getBits(code2); 16973 } 16974 len = (code1 & 0xffff) + code2; 16975 code1 = this.getCode(distCodeTable); 16976 code1 = distDecode[code1]; 16977 code2 = code1 >> 16; 16978 if (code2 > 0) { 16979 code2 = this.getBits(code2); 16980 } 16981 const dist = (code1 & 0xffff) + code2; 16982 if (pos + len >= limit) { 16983 buffer = this.ensureBuffer(pos + len); 16984 limit = buffer.length; 16985 } 16986 for (let k = 0; k < len; ++k, ++pos) { 16987 buffer[pos] = buffer[pos - dist]; 16988 } 16989 } 16990 } 16991} 16992 16993;// ./src/core/jbig2_stream.js 16994 16995 16996 16997 16998 16999class Jbig2Stream extends DecodeStream { 17000 constructor(stream, maybeLength, params) { 17001 super(maybeLength); 17002 this.stream = stream; 17003 this.dict = stream.dict; 17004 this.maybeLength = maybeLength; 17005 this.params = params; 17006 } 17007 get bytes() { 17008 return shadow(this, "bytes", this.stream.getBytes(this.maybeLength)); 17009 } 17010 ensureBuffer(requested) {} 17011
vendor: 8,368 bytes, lines 17011-17294
17011readBlock() { 17012 unreachable("Jbig2Stream.readBlock"); 17013 } 17014 get isAsyncDecoder() { 17015 return true; 17016 } 17017 get isImageStream() { 17018 return true; 17019 } 17020 async decodeImage(bytes, length, _decoderOptions) { 17021 if (this.eof) { 17022 return this.buffer; 17023 } 17024 bytes ||= this.bytes; 17025 let globals = null; 17026 if (this.params instanceof Dict) { 17027 const globalsStream = this.params.get("JBIG2Globals"); 17028 if (globalsStream instanceof BaseStream) { 17029 globals = globalsStream.getBytes(); 17030 } 17031 } 17032 this.buffer = await JBig2CCITTFaxImage.decode(bytes, this.dict.get("Width"), this.dict.get("Height"), globals); 17033 this.bufferLength = this.buffer.length; 17034 this.eof = true; 17035 return this.buffer; 17036 } 17037 get canAsyncDecodeImageFromBuffer() { 17038 return this.stream.isAsync; 17039 } 17040} 17041 17042;// ./src/core/jpx_stream.js 17043 17044 17045 17046class JpxStream extends DecodeStream { 17047 constructor(stream, maybeLength, params) { 17048 super(maybeLength); 17049 this.stream = stream; 17050 this.dict = stream.dict; 17051 this.maybeLength = maybeLength; 17052 this.params = params; 17053 } 17054 get bytes() { 17055 return shadow(this, "bytes", this.stream.getBytes(this.maybeLength)); 17056 } 17057 ensureBuffer(requested) {} 17058 readBlock(decoderOptions) { 17059 unreachable("JpxStream.readBlock"); 17060 } 17061 get isAsyncDecoder() { 17062 return true; 17063 } 17064 async decodeImage(bytes, _length, decoderOptions) { 17065 if (this.eof) { 17066 return this.buffer; 17067 } 17068 bytes ||= this.bytes; 17069 this.buffer = await JpxImage.decode(bytes, decoderOptions); 17070 this.bufferLength = this.buffer.length; 17071 this.eof = true; 17072 return this.buffer; 17073 } 17074 get canAsyncDecodeImageFromBuffer() { 17075 return this.stream.isAsync; 17076 } 17077 get isImageStream() { 17078 return true; 17079 } 17080} 17081 17082;// ./src/core/lzw_stream.js 17083 17084 17085 17086 17087 17088 17089 17090 17091 17092class LZWStream extends DecodeStream { 17093 constructor(str, maybeLength, earlyChange) { 17094 super(maybeLength); 17095 this.stream = str; 17096 this.dict = str.dict; 17097 this.cachedData = 0; 17098 this.bitsCached = 0; 17099 const maxLzwDictionarySize = 4096; 17100 const lzwState = { 17101 earlyChange, 17102 codeLength: 9, 17103 nextCode: 258, 17104 dictionaryValues: new Uint8Array(maxLzwDictionarySize), 17105 dictionaryLengths: new Uint16Array(maxLzwDictionarySize), 17106 dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize), 17107 currentSequence: new Uint8Array(maxLzwDictionarySize), 17108 currentSequenceLength: 0 17109 }; 17110 for (let i = 0; i < 256; ++i) { 17111 lzwState.dictionaryValues[i] = i; 17112 lzwState.dictionaryLengths[i] = 1; 17113 } 17114 this.lzwState = lzwState; 17115 } 17116 readBits(n) { 17117 let bitsCached = this.bitsCached; 17118 let cachedData = this.cachedData; 17119 while (bitsCached < n) { 17120 const c = this.stream.getByte(); 17121 if (c === -1) { 17122 this.eof = true; 17123 return null; 17124 } 17125 cachedData = cachedData << 8 | c; 17126 bitsCached += 8; 17127 } 17128 this.bitsCached = bitsCached -= n; 17129 this.cachedData = cachedData; 17130 return cachedData >>> bitsCached & (1 << n) - 1; 17131 } 17132 readBlock() { 17133 const blockSize = 512, 17134 decodedSizeDelta = blockSize; 17135 let estimatedDecodedSize = blockSize * 2; 17136 let i, j, q; 17137 const lzwState = this.lzwState; 17138 if (!lzwState) { 17139 return; 17140 } 17141 const earlyChange = lzwState.earlyChange; 17142 let nextCode = lzwState.nextCode; 17143 const dictionaryValues = lzwState.dictionaryValues; 17144 const dictionaryLengths = lzwState.dictionaryLengths; 17145 const dictionaryPrevCodes = lzwState.dictionaryPrevCodes; 17146 let codeLength = lzwState.codeLength; 17147 let prevCode = lzwState.prevCode; 17148 const currentSequence = lzwState.currentSequence; 17149 let currentSequenceLength = lzwState.currentSequenceLength; 17150 let decodedLength = 0; 17151 let currentBufferLength = this.bufferLength; 17152 let buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize); 17153 for (i = 0; i < blockSize; i++) { 17154 const code = this.readBits(codeLength); 17155 const hasPrev = currentSequenceLength > 0; 17156 if (code < 256) { 17157 currentSequence[0] = code; 17158 currentSequenceLength = 1; 17159 } else if (code >= 258) { 17160 if (code < nextCode) { 17161 currentSequenceLength = dictionaryLengths[code]; 17162 for (j = currentSequenceLength - 1, q = code; j >= 0; j--) { 17163 currentSequence[j] = dictionaryValues[q]; 17164 q = dictionaryPrevCodes[q]; 17165 } 17166 } else { 17167 currentSequence[currentSequenceLength++] = currentSequence[0]; 17168 } 17169 } else if (code === 256) { 17170 codeLength = 9; 17171 nextCode = 258; 17172 currentSequenceLength = 0; 17173 continue; 17174 } else { 17175 this.eof = true; 17176 delete this.lzwState; 17177 break; 17178 } 17179 if (hasPrev) { 17180 dictionaryPrevCodes[nextCode] = prevCode; 17181 dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1; 17182 dictionaryValues[nextCode] = currentSequence[0]; 17183 nextCode++; 17184 codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0; 17185 } 17186 prevCode = code; 17187 decodedLength += currentSequenceLength; 17188 if (estimatedDecodedSize < decodedLength) { 17189 do { 17190 estimatedDecodedSize += decodedSizeDelta; 17191 } while (estimatedDecodedSize < decodedLength); 17192 buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize); 17193 } 17194 for (j = 0; j < currentSequenceLength; j++) { 17195 buffer[currentBufferLength++] = currentSequence[j]; 17196 } 17197 } 17198 lzwState.nextCode = nextCode; 17199 lzwState.codeLength = codeLength; 17200 lzwState.prevCode = prevCode; 17201 lzwState.currentSequenceLength = currentSequenceLength; 17202 this.bufferLength = currentBufferLength; 17203 } 17204} 17205 17206;// ./src/core/predictor_stream.js 17207 17208 17209 17210 17211 17212 17213 17214 17215 17216 17217 17218class PredictorStream extends DecodeStream { 17219 constructor(str, maybeLength, params) { 17220 super(maybeLength); 17221 if (!(params instanceof Dict)) { 17222 return str; 17223 } 17224 const predictor = this.predictor = params.get("Predictor") || 1; 17225 if (predictor <= 1) { 17226 return str; 17227 } 17228 if (predictor !== 2 && (predictor < 10 || predictor > 15)) { 17229 throw new FormatError(`Unsupported predictor: ${predictor}`); 17230 } 17231 this.readBlock = predictor === 2 ? this.readBlockTiff : this.readBlockPng; 17232 this.stream = str; 17233 this.dict = str.dict; 17234 const colors = this.colors = params.get("Colors") || 1; 17235 const bits = this.bits = params.get("BPC", "BitsPerComponent") || 8; 17236 const columns = this.columns = params.get("Columns") || 1; 17237 this.pixBytes = colors * bits + 7 >> 3; 17238 this.rowBytes = columns * colors * bits + 7 >> 3; 17239 return this; 17240 } 17241 readBlockTiff() { 17242 const rowBytes = this.rowBytes; 17243 const bufferLength = this.bufferLength; 17244 const buffer = this.ensureBuffer(bufferLength + rowBytes); 17245 const bits = this.bits; 17246 const colors = this.colors; 17247 const rawBytes = this.stream.getBytes(rowBytes); 17248 this.eof = !rawBytes.length; 17249 if (this.eof) { 17250 return; 17251 } 17252 let inbuf = 0, 17253 outbuf = 0; 17254 let inbits = 0, 17255 outbits = 0; 17256 let pos = bufferLength; 17257 let i; 17258 if (bits === 1 && colors === 1) { 17259 for (i = 0; i < rowBytes; ++i) { 17260 let c = rawBytes[i] ^ inbuf; 17261 c ^= c >> 1; 17262 c ^= c >> 2; 17263 c ^= c >> 4; 17264 inbuf = (c & 1) << 7; 17265 buffer[pos++] = c; 17266 } 17267 } else if (bits === 8) { 17268 for (i = 0; i < colors; ++i) { 17269 buffer[pos++] = rawBytes[i]; 17270 } 17271 for (; i < rowBytes; ++i) { 17272 buffer[pos] = buffer[pos - colors] + rawBytes[i]; 17273 pos++; 17274 } 17275 } else if (bits === 16) { 17276 const bytesPerPixel = colors * 2; 17277 for (i = 0; i < bytesPerPixel; ++i) { 17278 buffer[pos++] = rawBytes[i]; 17279 } 17280 for (; i < rowBytes; i += 2) { 17281 const sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff); 17282 buffer[pos++] = sum >> 8 & 0xff; 17283 buffer[pos++] = sum & 0xff; 17284 } 17285 } else { 17286 const compArray = new Uint8Array(colors + 1); 17287 const bitMask = (1 << bits) - 1; 17288 let j = 0, 17289 k = bufferLength; 17290 const columns = this.columns; 17291 for (i = 0; i < columns; ++i) { 17292 for (let kk = 0; kk < colors; ++kk) { 17293 if (inbits < bits) { 17294 inbuf = inbuf << 8 | rawBytes[j++] & 0xff;
vendor: 3,898 bytes, lines 17295-17436
17295 inbits += 8; 17296 } 17297 compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask; 17298 inbits -= bits; 17299 outbuf = outbuf << bits | compArray[kk]; 17300 outbits += bits; 17301 if (outbits >= 8) { 17302 buffer[k++] = outbuf >> outbits - 8 & 0xff; 17303 outbits -= 8; 17304 } 17305 } 17306 } 17307 if (outbits > 0) { 17308 buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1); 17309 } 17310 } 17311 this.bufferLength += rowBytes; 17312 } 17313 readBlockPng() { 17314 const rowBytes = this.rowBytes; 17315 const pixBytes = this.pixBytes; 17316 const predictor = this.stream.getByte(); 17317 const rawBytes = this.stream.getBytes(rowBytes); 17318 this.eof = !rawBytes.length; 17319 if (this.eof) { 17320 return; 17321 } 17322 const bufferLength = this.bufferLength; 17323 const buffer = this.ensureBuffer(bufferLength + rowBytes); 17324 let prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength); 17325 if (prevRow.length === 0) { 17326 prevRow = new Uint8Array(rowBytes); 17327 } 17328 let i, 17329 j = bufferLength, 17330 up, 17331 c; 17332 switch (predictor) { 17333 case 0: 17334 for (i = 0; i < rowBytes; ++i) { 17335 buffer[j++] = rawBytes[i]; 17336 } 17337 break; 17338 case 1: 17339 for (i = 0; i < pixBytes; ++i) { 17340 buffer[j++] = rawBytes[i]; 17341 } 17342 for (; i < rowBytes; ++i) { 17343 buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff; 17344 j++; 17345 } 17346 break; 17347 case 2: 17348 for (i = 0; i < rowBytes; ++i) { 17349 buffer[j++] = prevRow[i] + rawBytes[i] & 0xff; 17350 } 17351 break; 17352 case 3: 17353 for (i = 0; i < pixBytes; ++i) { 17354 buffer[j++] = (prevRow[i] >> 1) + rawBytes[i]; 17355 } 17356 for (; i < rowBytes; ++i) { 17357 buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff; 17358 j++; 17359 } 17360 break; 17361 case 4: 17362 for (i = 0; i < pixBytes; ++i) { 17363 up = prevRow[i]; 17364 c = rawBytes[i]; 17365 buffer[j++] = up + c; 17366 } 17367 for (; i < rowBytes; ++i) { 17368 up = prevRow[i]; 17369 const upLeft = prevRow[i - pixBytes]; 17370 const left = buffer[j - pixBytes]; 17371 const p = left + up - upLeft; 17372 let pa = p - left; 17373 if (pa < 0) { 17374 pa = -pa; 17375 } 17376 let pb = p - up; 17377 if (pb < 0) { 17378 pb = -pb; 17379 } 17380 let pc = p - upLeft; 17381 if (pc < 0) { 17382 pc = -pc; 17383 } 17384 c = rawBytes[i]; 17385 if (pa <= pb && pa <= pc) { 17386 buffer[j++] = left + c; 17387 } else if (pb <= pc) { 17388 buffer[j++] = up + c; 17389 } else { 17390 buffer[j++] = upLeft + c; 17391 } 17392 } 17393 break; 17394 default: 17395 throw new FormatError(`Unsupported predictor: ${predictor}`); 17396 } 17397 this.bufferLength += rowBytes; 17398 } 17399} 17400 17401;// ./src/core/run_length_stream.js 17402 17403class RunLengthStream extends DecodeStream { 17404 constructor(str, maybeLength) { 17405 super(maybeLength); 17406 this.stream = str; 17407 this.dict = str.dict; 17408 } 17409 readBlock() { 17410 const repeatHeader = this.stream.getBytes(2); 17411 if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) { 17412 this.eof = true; 17413 return; 17414 } 17415 let buffer; 17416 let bufferLength = this.bufferLength; 17417 let n = repeatHeader[0]; 17418 if (n < 128) { 17419 buffer = this.ensureBuffer(bufferLength + n + 1); 17420 buffer[bufferLength++] = repeatHeader[1]; 17421 if (n > 0) { 17422 const source = this.stream.getBytes(n); 17423 buffer.set(source, bufferLength); 17424 bufferLength += n; 17425 } 17426 } else { 17427 n = 257 - n; 17428 buffer = this.ensureBuffer(bufferLength + n + 1); 17429 buffer.fill(repeatHeader[1], bufferLength, bufferLength + n); 17430 bufferLength += n; 17431 } 17432 this.bufferLength = bufferLength; 17433 } 17434} 17435 17436;// ./src/core/parser.js
vendor: 17,330 bytes, lines 17437-18054
17437 17438 17439 17440 17441 17442 17443 17444 17445 17446 17447 17448 17449 17450 17451 17452 17453 17454 17455 17456 17457 17458 17459 17460 17461 17462 17463const MAX_LENGTH_TO_CACHE = 1000; 17464function getInlineImageCacheKey(bytes) { 17465 const strBuf = [], 17466 ii = bytes.length; 17467 let i = 0; 17468 while (i < ii - 1) { 17469 strBuf.push(bytes[i++] << 8 | bytes[i++]); 17470 } 17471 if (i < ii) { 17472 strBuf.push(bytes[i]); 17473 } 17474 return ii + "_" + String.fromCharCode.apply(null, strBuf); 17475} 17476class Parser { 17477 constructor({ 17478 lexer, 17479 xref, 17480 allowStreams = false, 17481 recoveryMode = false 17482 }) { 17483 this.lexer = lexer; 17484 this.xref = xref; 17485 this.allowStreams = allowStreams; 17486 this.recoveryMode = recoveryMode; 17487 this.imageCache = Object.create(null); 17488 this._imageId = 0; 17489 this.refill(); 17490 } 17491 refill() { 17492 this.buf1 = this.lexer.getObj(); 17493 this.buf2 = this.lexer.getObj(); 17494 } 17495 shift() { 17496 if (this.buf2 instanceof Cmd && this.buf2.cmd === "ID") { 17497 this.buf1 = this.buf2; 17498 this.buf2 = null; 17499 } else { 17500 this.buf1 = this.buf2; 17501 this.buf2 = this.lexer.getObj(); 17502 } 17503 } 17504 tryShift() { 17505 try { 17506 this.shift(); 17507 return true; 17508 } catch (e) { 17509 if (e instanceof MissingDataException) { 17510 throw e; 17511 } 17512 return false; 17513 } 17514 } 17515 getObj(cipherTransform = null) { 17516 const buf1 = this.buf1; 17517 this.shift(); 17518 if (buf1 instanceof Cmd) { 17519 switch (buf1.cmd) { 17520 case "BI": 17521 return this.makeInlineImage(cipherTransform); 17522 case "[": 17523 const array = []; 17524 while (!isCmd(this.buf1, "]") && this.buf1 !== EOF) { 17525 array.push(this.getObj(cipherTransform)); 17526 } 17527 if (this.buf1 === EOF) { 17528 if (this.recoveryMode) { 17529 return array; 17530 } 17531 throw new ParserEOFException("End of file inside array."); 17532 } 17533 this.shift(); 17534 return array; 17535 case "<<": 17536 const dict = new Dict(this.xref); 17537 while (!isCmd(this.buf1, ">>") && this.buf1 !== EOF) { 17538 if (!(this.buf1 instanceof Name)) { 17539 info("Malformed dictionary: key must be a name object"); 17540 this.shift(); 17541 continue; 17542 } 17543 const key = this.buf1.name; 17544 this.shift(); 17545 if (this.buf1 === EOF) { 17546 break; 17547 } 17548 dict.set(key, this.getObj(cipherTransform)); 17549 } 17550 if (this.buf1 === EOF) { 17551 if (this.recoveryMode) { 17552 return dict; 17553 } 17554 throw new ParserEOFException("End of file inside dictionary."); 17555 } 17556 if (isCmd(this.buf2, "stream")) { 17557 return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict; 17558 } 17559 this.shift(); 17560 return dict; 17561 default: 17562 return buf1; 17563 } 17564 } 17565 if (Number.isInteger(buf1)) { 17566 if (Number.isInteger(this.buf1) && isCmd(this.buf2, "R")) { 17567 const ref = Ref.get(buf1, this.buf1); 17568 this.shift(); 17569 this.shift(); 17570 return ref; 17571 } 17572 return buf1; 17573 } 17574 if (typeof buf1 === "string") { 17575 if (cipherTransform) { 17576 return cipherTransform.decryptString(buf1); 17577 } 17578 return buf1; 17579 } 17580 return buf1; 17581 } 17582 findDefaultInlineStreamEnd(stream) { 17583 const E = 0x45, 17584 I = 0x49, 17585 SPACE = 0x20, 17586 LF = 0xa, 17587 CR = 0xd, 17588 NUL = 0x0; 17589 const { 17590 knownCommands 17591 } = this.lexer, 17592 startPos = stream.pos, 17593 n = 15; 17594 let state = 0, 17595 ch, 17596 maybeEIPos; 17597 while ((ch = stream.getByte()) !== -1) { 17598 if (state === 0) { 17599 state = ch === E ? 1 : 0; 17600 } else if (state === 1) { 17601 state = ch === I ? 2 : 0; 17602 } else { 17603 if (ch === SPACE || ch === LF || ch === CR) { 17604 maybeEIPos = stream.pos; 17605 const followingBytes = stream.peekBytes(n); 17606 const ii = followingBytes.length; 17607 if (ii === 0) { 17608 break; 17609 } 17610 for (let i = 0; i < ii; i++) { 17611 ch = followingBytes[i]; 17612 if (ch === NUL && followingBytes[i + 1] !== NUL) { 17613 continue; 17614 } 17615 if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) { 17616 state = 0; 17617 break; 17618 } 17619 } 17620 if (state !== 2) { 17621 continue; 17622 } 17623 if (!knownCommands) { 17624 warn("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined."); 17625 continue; 17626 } 17627 const tmpLexer = new Lexer(new Stream(stream.peekBytes(5 * n)), knownCommands); 17628 tmpLexer._hexStringWarn = () => {}; 17629 let numArgs = 0; 17630 while (true) { 17631 const nextObj = tmpLexer.getObj(); 17632 if (nextObj === EOF) { 17633 state = 0; 17634 break; 17635 } 17636 if (nextObj instanceof Cmd) { 17637 const knownCommand = knownCommands[nextObj.cmd]; 17638 if (!knownCommand) { 17639 state = 0; 17640 break; 17641 } else if (knownCommand.variableArgs ? numArgs <= knownCommand.numArgs : numArgs === knownCommand.numArgs) { 17642 break; 17643 } 17644 numArgs = 0; 17645 continue; 17646 } 17647 numArgs++; 17648 } 17649 if (state === 2) { 17650 break; 17651 } 17652 } else { 17653 state = 0; 17654 } 17655 } 17656 } 17657 if (ch === -1) { 17658 warn("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker"); 17659 if (maybeEIPos) { 17660 warn('... trying to recover by using the last "EI" occurrence.'); 17661 stream.skip(-(stream.pos - maybeEIPos)); 17662 } 17663 } 17664 let endOffset = 4; 17665 stream.skip(-endOffset); 17666 ch = stream.peekByte(); 17667 stream.skip(endOffset); 17668 if (!isWhiteSpace(ch)) { 17669 endOffset--; 17670 } 17671 return stream.pos - endOffset - startPos; 17672 } 17673 findDCTDecodeInlineStreamEnd(stream) { 17674 const startPos = stream.pos; 17675 let foundEOI = false, 17676 b, 17677 markerLength; 17678 while ((b = stream.getByte()) !== -1) { 17679 if (b !== 0xff) { 17680 continue; 17681 } 17682 switch (stream.getByte()) { 17683 case 0x00: 17684 break; 17685 case 0xff: 17686 stream.skip(-1); 17687 break; 17688 case 0xd9: 17689 foundEOI = true; 17690 break; 17691 case 0xc0: 17692 case 0xc1: 17693 case 0xc2: 17694 case 0xc3: 17695 case 0xc5: 17696 case 0xc6: 17697 case 0xc7: 17698 case 0xc9: 17699 case 0xca: 17700 case 0xcb: 17701 case 0xcd: 17702 case 0xce: 17703 case 0xcf: 17704 case 0xc4: 17705 case 0xcc: 17706 case 0xda: 17707 case 0xdb: 17708 case 0xdc: 17709 case 0xdd: 17710 case 0xde: 17711 case 0xdf: 17712 case 0xe0: 17713 case 0xe1: 17714 case 0xe2: 17715 case 0xe3: 17716 case 0xe4: 17717 case 0xe5: 17718 case 0xe6: 17719 case 0xe7: 17720 case 0xe8: 17721 case 0xe9: 17722 case 0xea: 17723 case 0xeb: 17724 case 0xec: 17725 case 0xed: 17726 case 0xee: 17727 case 0xef: 17728 case 0xfe: 17729 markerLength = stream.getUint16(); 17730 if (markerLength > 2) { 17731 stream.skip(markerLength - 2); 17732 } else { 17733 stream.skip(-2); 17734 } 17735 break; 17736 } 17737 if (foundEOI) { 17738 break; 17739 } 17740 } 17741 const length = stream.pos - startPos; 17742 if (b === -1) { 17743 warn("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead."); 17744 stream.skip(-length); 17745 return this.findDefaultInlineStreamEnd(stream); 17746 } 17747 this.inlineStreamSkipEI(stream); 17748 return length; 17749 } 17750 findASCII85DecodeInlineStreamEnd(stream) { 17751 const TILDE = 0x7e, 17752 GT = 0x3e; 17753 const startPos = stream.pos; 17754 let ch; 17755 while ((ch = stream.getByte()) !== -1) { 17756 if (ch === TILDE) { 17757 const tildePos = stream.pos; 17758 ch = stream.peekByte(); 17759 while (isWhiteSpace(ch)) { 17760 stream.skip(); 17761 ch = stream.peekByte(); 17762 } 17763 if (ch === GT) { 17764 stream.skip(); 17765 break; 17766 } 17767 if (stream.pos > tildePos) { 17768 const maybeEI = stream.peekBytes(2); 17769 if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) { 17770 break; 17771 } 17772 } 17773 } 17774 } 17775 const length = stream.pos - startPos; 17776 if (ch === -1) { 17777 warn("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead."); 17778 stream.skip(-length); 17779 return this.findDefaultInlineStreamEnd(stream); 17780 } 17781 this.inlineStreamSkipEI(stream); 17782 return length; 17783 } 17784 findASCIIHexDecodeInlineStreamEnd(stream) { 17785 const GT = 0x3e; 17786 const startPos = stream.pos; 17787 let ch; 17788 while ((ch = stream.getByte()) !== -1) { 17789 if (ch === GT) { 17790 break; 17791 } 17792 } 17793 const length = stream.pos - startPos; 17794 if (ch === -1) { 17795 warn("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead."); 17796 stream.skip(-length); 17797 return this.findDefaultInlineStreamEnd(stream); 17798 } 17799 this.inlineStreamSkipEI(stream); 17800 return length; 17801 } 17802 inlineStreamSkipEI(stream) { 17803 const E = 0x45, 17804 I = 0x49; 17805 let state = 0, 17806 ch; 17807 while ((ch = stream.getByte()) !== -1) { 17808 if (state === 0) { 17809 state = ch === E ? 1 : 0; 17810 } else if (state === 1) { 17811 state = ch === I ? 2 : 0; 17812 } else if (state === 2) { 17813 break; 17814 } 17815 } 17816 } 17817 makeInlineImage(cipherTransform) { 17818 const lexer = this.lexer; 17819 const stream = lexer.stream; 17820 const dictMap = Object.create(null); 17821 let dictLength; 17822 while (!isCmd(this.buf1, "ID") && this.buf1 !== EOF) { 17823 if (!(this.buf1 instanceof Name)) { 17824 throw new FormatError("Dictionary key must be a name object"); 17825 } 17826 const key = this.buf1.name; 17827 this.shift(); 17828 if (this.buf1 === EOF) { 17829 break; 17830 } 17831 dictMap[key] = this.getObj(cipherTransform); 17832 } 17833 if (lexer.beginInlineImagePos !== -1) { 17834 dictLength = stream.pos - lexer.beginInlineImagePos; 17835 } 17836 const filter = this.xref.fetchIfRef(dictMap.F || dictMap.Filter); 17837 let filterName; 17838 if (filter instanceof Name) { 17839 filterName = filter.name; 17840 } else if (Array.isArray(filter)) { 17841 const filterZero = this.xref.fetchIfRef(filter[0]); 17842 if (filterZero instanceof Name) { 17843 filterName = filterZero.name; 17844 } 17845 } 17846 const startPos = stream.pos; 17847 let length; 17848 switch (filterName) { 17849 case "DCT": 17850 case "DCTDecode": 17851 length = this.findDCTDecodeInlineStreamEnd(stream); 17852 break; 17853 case "A85": 17854 case "ASCII85Decode": 17855 length = this.findASCII85DecodeInlineStreamEnd(stream); 17856 break; 17857 case "AHx": 17858 case "ASCIIHexDecode": 17859 length = this.findASCIIHexDecodeInlineStreamEnd(stream); 17860 break; 17861 default: 17862 length = this.findDefaultInlineStreamEnd(stream); 17863 } 17864 let cacheKey; 17865 if (length < MAX_LENGTH_TO_CACHE && dictLength > 0) { 17866 const initialStreamPos = stream.pos; 17867 stream.pos = lexer.beginInlineImagePos; 17868 cacheKey = getInlineImageCacheKey(stream.getBytes(dictLength + length)); 17869 stream.pos = initialStreamPos; 17870 const cacheEntry = this.imageCache[cacheKey]; 17871 if (cacheEntry !== undefined) { 17872 this.buf2 = Cmd.get("EI"); 17873 this.shift(); 17874 cacheEntry.reset(); 17875 return cacheEntry; 17876 } 17877 } 17878 const dict = new Dict(this.xref); 17879 for (const key in dictMap) { 17880 dict.set(key, dictMap[key]); 17881 } 17882 let imageStream = stream.makeSubStream(startPos, length, dict); 17883 if (cipherTransform) { 17884 imageStream = cipherTransform.createStream(imageStream, length); 17885 } 17886 imageStream = this.filter(imageStream, dict, length); 17887 imageStream.dict = dict; 17888 if (cacheKey !== undefined) { 17889 imageStream.cacheKey = `inline_img_${++this._imageId}`; 17890 this.imageCache[cacheKey] = imageStream; 17891 } 17892 this.buf2 = Cmd.get("EI"); 17893 this.shift(); 17894 return imageStream; 17895 } 17896 #findStreamLength(startPos) { 17897 const { 17898 stream 17899 } = this.lexer; 17900 stream.pos = startPos; 17901 const SCAN_BLOCK_LENGTH = 2048; 17902 const signatureLength = "endstream".length; 17903 const END_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64]); 17904 const endLength = END_SIGNATURE.length; 17905 const PARTIAL_SIGNATURE = [new Uint8Array([0x73, 0x74, 0x72, 0x65, 0x61, 0x6d]), new Uint8Array([0x73, 0x74, 0x65, 0x61, 0x6d]), new Uint8Array([0x73, 0x74, 0x72, 0x65, 0x61])]; 17906 const normalLength = signatureLength - endLength; 17907 while (stream.pos < stream.end) { 17908 const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH); 17909 const scanLength = scanBytes.length - signatureLength; 17910 if (scanLength <= 0) { 17911 break; 17912 } 17913 let pos = 0; 17914 while (pos < scanLength) { 17915 let j = 0; 17916 while (j < endLength && scanBytes[pos + j] === END_SIGNATURE[j]) { 17917 j++; 17918 } 17919 if (j >= endLength) { 17920 let found = false; 17921 for (const part of PARTIAL_SIGNATURE) { 17922 const partLen = part.length; 17923 let k = 0; 17924 while (k < partLen && scanBytes[pos + j + k] === part[k]) { 17925 k++; 17926 } 17927 if (k >= normalLength) { 17928 found = true; 17929 break; 17930 } 17931 if (k >= partLen) { 17932 const lastByte = scanBytes[pos + j + k]; 17933 if (isWhiteSpace(lastByte)) { 17934 info(`Found "${bytesToString([...END_SIGNATURE, ...part])}" when ` + "searching for endstream command."); 17935 found = true; 17936 } 17937 break; 17938 } 17939 } 17940 if (found) { 17941 stream.pos += pos; 17942 return stream.pos - startPos; 17943 } 17944 } 17945 pos++; 17946 } 17947 stream.pos += scanLength; 17948 } 17949 return -1; 17950 } 17951 makeStream(dict, cipherTransform) { 17952 const lexer = this.lexer; 17953 let stream = lexer.stream; 17954 lexer.skipToNextLine(); 17955 const startPos = stream.pos - 1; 17956 let length = dict.get("Length"); 17957 if (!Number.isInteger(length)) { 17958 info(`Bad length "${length && length.toString()}" in stream.`); 17959 length = 0; 17960 } 17961 stream.pos = startPos + length; 17962 lexer.nextChar(); 17963 if (this.tryShift() && isCmd(this.buf2, "endstream")) { 17964 this.shift(); 17965 } else { 17966 length = this.#findStreamLength(startPos); 17967 if (length < 0) { 17968 throw new FormatError("Missing endstream command."); 17969 } 17970 lexer.nextChar(); 17971 this.shift(); 17972 this.shift(); 17973 } 17974 this.shift(); 17975 stream = stream.makeSubStream(startPos, length, dict); 17976 if (cipherTransform) { 17977 stream = cipherTransform.createStream(stream, length); 17978 } 17979 stream = this.filter(stream, dict, length); 17980 stream.dict = dict; 17981 return stream; 17982 } 17983 filter(stream, dict, length) { 17984 let filter = dict.get("F", "Filter"); 17985 let params = dict.get("DP", "DecodeParms"); 17986 if (filter instanceof Name) { 17987 if (Array.isArray(params)) { 17988 warn("/DecodeParms should not be an Array, when /Filter is a Name."); 17989 } 17990 return this.makeFilter(stream, filter.name, length, params); 17991 } 17992 let maybeLength = length; 17993 if (Array.isArray(filter)) { 17994 const filterArray = filter; 17995 const paramsArray = params; 17996 for (let i = 0, ii = filterArray.length; i < ii; ++i) { 17997 filter = this.xref.fetchIfRef(filterArray[i]); 17998 if (!(filter instanceof Name)) { 17999 throw new FormatError(`Bad filter name "${filter}"`); 18000 } 18001 params = null; 18002 if (Array.isArray(paramsArray) && i in paramsArray) { 18003 params = this.xref.fetchIfRef(paramsArray[i]); 18004 } 18005 stream = this.makeFilter(stream, filter.name, maybeLength, params); 18006 maybeLength = null; 18007 } 18008 } 18009 return stream; 18010 } 18011 makeFilter(stream, name, maybeLength, params) { 18012 if (maybeLength === 0) { 18013 warn(`Empty "${name}" stream.`); 18014 return new NullStream(); 18015 } 18016 try { 18017 switch (name) { 18018 case "Fl": 18019 case "FlateDecode": 18020 if (params) { 18021 return new PredictorStream(new FlateStream(stream, maybeLength), maybeLength, params); 18022 } 18023 return new FlateStream(stream, maybeLength); 18024 case "LZW": 18025 case "LZWDecode": 18026 let earlyChange = 1; 18027 if (params) { 18028 if (params.has("EarlyChange")) { 18029 earlyChange = params.get("EarlyChange"); 18030 } 18031 return new PredictorStream(new LZWStream(stream, maybeLength, earlyChange), maybeLength, params); 18032 } 18033 return new LZWStream(stream, maybeLength, earlyChange); 18034 case "DCT": 18035 case "DCTDecode": 18036 return new JpegStream(stream, maybeLength, params); 18037 case "JPX": 18038 case "JPXDecode": 18039 return new JpxStream(stream, maybeLength, params); 18040 case "A85": 18041 case "ASCII85Decode": 18042 return new Ascii85Stream(stream, maybeLength); 18043 case "AHx": 18044 case "ASCIIHexDecode": 18045 return new AsciiHexStream(stream, maybeLength); 18046 case "CCF": 18047 case "CCITTFaxDecode": 18048 return new CCITTFaxStream(stream, maybeLength, params); 18049 case "RL": 18050 case "RunLengthDecode": 18051 return new RunLengthStream(stream, maybeLength); 18052 case "JBIG2Decode": 18053 return new Jbig2Stream(stream, maybeLength, params); 18054
18054 case "BrotliDecode": 18055 return new BrotliStream(stream, maybeLength);
vendor: 12,848 bytes, lines 18055-18506
18055 18056 } 18057 warn(`Filter "${name}" is not supported.`); 18058 return stream; 18059 } catch (ex) { 18060 if (ex instanceof MissingDataException) { 18061 throw ex; 18062 } 18063 warn(`Invalid stream: "${ex}"`); 18064 return new NullStream(); 18065 } 18066 } 18067} 18068const specialChars = [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; 18069function toHexDigit(ch) { 18070 if (ch >= 0x30 && ch <= 0x39) { 18071 return ch & 0x0f; 18072 } 18073 if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) { 18074 return (ch & 0x0f) + 9; 18075 } 18076 return -1; 18077} 18078class Lexer { 18079 constructor(stream, knownCommands = null) { 18080 this.stream = stream; 18081 this.nextChar(); 18082 this.strBuf = []; 18083 this.knownCommands = knownCommands; 18084 this._hexStringNumWarn = 0; 18085 this.beginInlineImagePos = -1; 18086 } 18087 nextChar() { 18088 return this.currentChar = this.stream.getByte(); 18089 } 18090 peekChar() { 18091 return this.stream.peekByte(); 18092 } 18093 getNumber() { 18094 let ch = this.currentChar; 18095 let divideBy = 0; 18096 let sign = 1; 18097 if (ch === 0x2d) { 18098 sign = -1; 18099 ch = this.nextChar(); 18100 if (ch === 0x2d) { 18101 ch = this.nextChar(); 18102 } 18103 } else if (ch === 0x2b) { 18104 ch = this.nextChar(); 18105 } 18106 if (ch === 0x0a || ch === 0x0d) { 18107 do { 18108 ch = this.nextChar(); 18109 } while (ch === 0x0a || ch === 0x0d); 18110 } 18111 if (ch === 0x2e) { 18112 divideBy = 10; 18113 ch = this.nextChar(); 18114 } 18115 if (ch < 0x30 || ch > 0x39) { 18116 const msg = `Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`; 18117 if (isWhiteSpace(ch) || ch === 0x28 || ch === 0x3c || ch === -1) { 18118 info(`Lexer.getNumber - "${msg}".`); 18119 return 0; 18120 } 18121 throw new FormatError(msg); 18122 } 18123 let baseValue = ch - 0x30; 18124 while ((ch = this.nextChar()) >= 0) { 18125 if (ch >= 0x30 && ch <= 0x39) { 18126 const currentDigit = ch - 0x30; 18127 if (divideBy !== 0) { 18128 divideBy *= 10; 18129 } 18130 baseValue = baseValue * 10 + currentDigit; 18131 } else if (ch === 0x2e) { 18132 if (divideBy === 0) { 18133 divideBy = 1; 18134 } else { 18135 break; 18136 } 18137 } else if (ch === 0x2d) { 18138 warn("Badly formatted number: minus sign in the middle"); 18139 } else { 18140 break; 18141 } 18142 } 18143 if (divideBy !== 0) { 18144 baseValue /= divideBy; 18145 } 18146 return sign * baseValue; 18147 } 18148 getString() { 18149 let numParen = 1; 18150 let done = false; 18151 const strBuf = this.strBuf; 18152 strBuf.length = 0; 18153 let ch = this.nextChar(); 18154 while (true) { 18155 let charBuffered = false; 18156 switch (ch | 0) { 18157 case -1: 18158 warn("Unterminated string"); 18159 done = true; 18160 break; 18161 case 0x28: 18162 ++numParen; 18163 strBuf.push("("); 18164 break; 18165 case 0x29: 18166 if (--numParen === 0) { 18167 this.nextChar(); 18168 done = true; 18169 } else { 18170 strBuf.push(")"); 18171 } 18172 break; 18173 case 0x5c: 18174 ch = this.nextChar(); 18175 switch (ch) { 18176 case -1: 18177 warn("Unterminated string"); 18178 done = true; 18179 break; 18180 case 0x6e: 18181 strBuf.push("\n"); 18182 break; 18183 case 0x72: 18184 strBuf.push("\r"); 18185 break; 18186 case 0x74: 18187 strBuf.push("\t"); 18188 break; 18189 case 0x62: 18190 strBuf.push("\b"); 18191 break; 18192 case 0x66: 18193 strBuf.push("\f"); 18194 break; 18195 case 0x5c: 18196 case 0x28: 18197 case 0x29: 18198 strBuf.push(String.fromCharCode(ch)); 18199 break; 18200 case 0x30: 18201 case 0x31: 18202 case 0x32: 18203 case 0x33: 18204 case 0x34: 18205 case 0x35: 18206 case 0x36: 18207 case 0x37: 18208 let x = ch & 0x0f; 18209 ch = this.nextChar(); 18210 charBuffered = true; 18211 if (ch >= 0x30 && ch <= 0x37) { 18212 x = (x << 3) + (ch & 0x0f); 18213 ch = this.nextChar(); 18214 if (ch >= 0x30 && ch <= 0x37) { 18215 charBuffered = false; 18216 x = (x << 3) + (ch & 0x0f); 18217 } 18218 } 18219 strBuf.push(String.fromCharCode(x)); 18220 break; 18221 case 0x0d: 18222 if (this.peekChar() === 0x0a) { 18223 this.nextChar(); 18224 } 18225 break; 18226 case 0x0a: 18227 break; 18228 default: 18229 strBuf.push(String.fromCharCode(ch)); 18230 break; 18231 } 18232 break; 18233 default: 18234 strBuf.push(String.fromCharCode(ch)); 18235 break; 18236 } 18237 if (done) { 18238 break; 18239 } 18240 if (!charBuffered) { 18241 ch = this.nextChar(); 18242 } 18243 } 18244 return strBuf.join(""); 18245 } 18246 getName() { 18247 let ch, previousCh; 18248 const strBuf = this.strBuf; 18249 strBuf.length = 0; 18250 while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) { 18251 if (ch === 0x23) { 18252 ch = this.nextChar(); 18253 if (specialChars[ch]) { 18254 warn("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number."); 18255 strBuf.push("#"); 18256 break; 18257 } 18258 const x = toHexDigit(ch); 18259 if (x !== -1) { 18260 previousCh = ch; 18261 ch = this.nextChar(); 18262 const x2 = toHexDigit(ch); 18263 if (x2 === -1) { 18264 warn(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number."); 18265 strBuf.push("#", String.fromCharCode(previousCh)); 18266 if (specialChars[ch]) { 18267 break; 18268 } 18269 strBuf.push(String.fromCharCode(ch)); 18270 continue; 18271 } 18272 strBuf.push(String.fromCharCode(x << 4 | x2)); 18273 } else { 18274 strBuf.push("#", String.fromCharCode(ch)); 18275 } 18276 } else { 18277 strBuf.push(String.fromCharCode(ch)); 18278 } 18279 } 18280 if (strBuf.length > 127) { 18281 warn(`Name token is longer than allowed by the spec: ${strBuf.length}`); 18282 } 18283 return Name.get(strBuf.join("")); 18284 } 18285 _hexStringWarn(ch) { 18286 const MAX_HEX_STRING_NUM_WARN = 5; 18287 if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) { 18288 warn("getHexString - ignoring additional invalid characters."); 18289 return; 18290 } 18291 if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) { 18292 return; 18293 } 18294 warn(`getHexString - ignoring invalid character: ${ch}`); 18295 } 18296 getHexString() { 18297 const strBuf = this.strBuf; 18298 strBuf.length = 0; 18299 let ch = this.currentChar; 18300 let firstDigit = -1, 18301 digit = -1; 18302 this._hexStringNumWarn = 0; 18303 while (true) { 18304 if (ch < 0) { 18305 warn("Unterminated hex string"); 18306 break; 18307 } else if (ch === 0x3e) { 18308 this.nextChar(); 18309 break; 18310 } else if (specialChars[ch] === 1) { 18311 ch = this.nextChar(); 18312 continue; 18313 } else { 18314 digit = toHexDigit(ch); 18315 if (digit === -1) { 18316 this._hexStringWarn(ch); 18317 } else if (firstDigit === -1) { 18318 firstDigit = digit; 18319 } else { 18320 strBuf.push(String.fromCharCode(firstDigit << 4 | digit)); 18321 firstDigit = -1; 18322 } 18323 ch = this.nextChar(); 18324 } 18325 } 18326 if (firstDigit !== -1) { 18327 strBuf.push(String.fromCharCode(firstDigit << 4)); 18328 } 18329 return strBuf.join(""); 18330 } 18331 getObj() { 18332 let comment = false; 18333 let ch = this.currentChar; 18334 while (true) { 18335 if (ch < 0) { 18336 return EOF; 18337 } 18338 if (comment) { 18339 if (ch === 0x0a || ch === 0x0d) { 18340 comment = false; 18341 } 18342 } else if (ch === 0x25) { 18343 comment = true; 18344 } else if (specialChars[ch] !== 1) { 18345 break; 18346 } 18347 ch = this.nextChar(); 18348 } 18349 switch (ch | 0) { 18350 case 0x30: 18351 case 0x31: 18352 case 0x32: 18353 case 0x33: 18354 case 0x34: 18355 case 0x35: 18356 case 0x36: 18357 case 0x37: 18358 case 0x38: 18359 case 0x39: 18360 case 0x2b: 18361 case 0x2d: 18362 case 0x2e: 18363 return this.getNumber(); 18364 case 0x28: 18365 return this.getString(); 18366 case 0x2f: 18367 return this.getName(); 18368 case 0x5b: 18369 this.nextChar(); 18370 return Cmd.get("["); 18371 case 0x5d: 18372 this.nextChar(); 18373 return Cmd.get("]"); 18374 case 0x3c: 18375 ch = this.nextChar(); 18376 if (ch === 0x3c) { 18377 this.nextChar(); 18378 return Cmd.get("<<"); 18379 } 18380 return this.getHexString(); 18381 case 0x3e: 18382 ch = this.nextChar(); 18383 if (ch === 0x3e) { 18384 this.nextChar(); 18385 return Cmd.get(">>"); 18386 } 18387 return Cmd.get(">"); 18388 case 0x7b: 18389 this.nextChar(); 18390 return Cmd.get("{"); 18391 case 0x7d: 18392 this.nextChar(); 18393 return Cmd.get("}"); 18394 case 0x29: 18395 this.nextChar(); 18396 throw new FormatError(`Illegal character: ${ch}`); 18397 } 18398 let str = String.fromCharCode(ch); 18399 if (ch < 0x20 || ch > 0x7f) { 18400 const nextCh = this.peekChar(); 18401 if (nextCh >= 0x20 && nextCh <= 0x7f) { 18402 this.nextChar(); 18403 return Cmd.get(str); 18404 } 18405 } 18406 const knownCommands = this.knownCommands; 18407 let knownCommandFound = knownCommands?.[str] !== undefined; 18408 while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) { 18409 const possibleCommand = str + String.fromCharCode(ch); 18410 if (knownCommandFound && knownCommands[possibleCommand] === undefined) { 18411 break; 18412 } 18413 if (str.length === 128) { 18414 throw new FormatError(`Command token too long: ${str.length}`); 18415 } 18416 str = possibleCommand; 18417 knownCommandFound = knownCommands?.[str] !== undefined; 18418 } 18419 if (str === "true") { 18420 return true; 18421 } 18422 if (str === "false") { 18423 return false; 18424 } 18425 if (str === "null") { 18426 return null; 18427 } 18428 if (str === "BI") { 18429 this.beginInlineImagePos = this.stream.pos; 18430 } 18431 return Cmd.get(str); 18432 } 18433 skipToNextLine() { 18434 let ch = this.currentChar; 18435 while (ch >= 0) { 18436 if (ch === 0x0d) { 18437 ch = this.nextChar(); 18438 if (ch === 0x0a) { 18439 this.nextChar(); 18440 } 18441 break; 18442 } else if (ch === 0x0a) { 18443 this.nextChar(); 18444 break; 18445 } 18446 ch = this.nextChar(); 18447 } 18448 } 18449} 18450class Linearization { 18451 static create(stream) { 18452 function getInt(linDict, name, allowZeroValue = false) { 18453 const obj = linDict.get(name); 18454 if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) { 18455 return obj; 18456 } 18457 throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid."); 18458 } 18459 function getHints(linDict) { 18460 const hints = linDict.get("H"); 18461 let hintsLength; 18462 if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) { 18463 for (let index = 0; index < hintsLength; index++) { 18464 const hint = hints[index]; 18465 if (!(Number.isInteger(hint) && hint > 0)) { 18466 throw new Error(`Hint (${index}) in the linearization dictionary is invalid.`); 18467 } 18468 } 18469 return hints; 18470 } 18471 throw new Error("Hint array in the linearization dictionary is invalid."); 18472 } 18473 const parser = new Parser({ 18474 lexer: new Lexer(stream), 18475 xref: null 18476 }); 18477 const obj1 = parser.getObj(); 18478 const obj2 = parser.getObj(); 18479 const obj3 = parser.getObj(); 18480 const linDict = parser.getObj(); 18481 let obj, length; 18482 if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && isCmd(obj3, "obj") && linDict instanceof Dict && typeof (obj = linDict.get("Linearized")) === "number" && obj > 0)) { 18483 return null; 18484 } else if ((length = getInt(linDict, "L")) !== stream.length) { 18485 throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length."); 18486 } 18487 return { 18488 length, 18489 hints: getHints(linDict), 18490 objectNumberFirst: getInt(linDict, "O"), 18491 endFirst: getInt(linDict, "E"), 18492 numPages: getInt(linDict, "N"), 18493 mainXRefEntriesOffset: getInt(linDict, "T"), 18494 pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0 18495 }; 18496 } 18497} 18498 18499;// ./src/core/cmap.js 18500 18501 18502 18503 18504 18505 18506
vendor: 5,287 bytes, lines 18507-18609
18507 18508 18509 18510 18511const BUILT_IN_CMAPS = ["Adobe-GB1-UCS2", "Adobe-CNS1-UCS2", "Adobe-Japan1-UCS2", "Adobe-Korea1-UCS2", "78-EUC-H", "78-EUC-V", "78-H", "78-RKSJ-H", "78-RKSJ-V", "78-V", "78ms-RKSJ-H", "78ms-RKSJ-V", "83pv-RKSJ-H", "90ms-RKSJ-H", "90ms-RKSJ-V", "90msp-RKSJ-H", "90msp-RKSJ-V", "90pv-RKSJ-H", "90pv-RKSJ-V", "Add-H", "Add-RKSJ-H", "Add-RKSJ-V", "Add-V", "Adobe-CNS1-0", "Adobe-CNS1-1", "Adobe-CNS1-2", "Adobe-CNS1-3", "Adobe-CNS1-4", "Adobe-CNS1-5", "Adobe-CNS1-6", "Adobe-GB1-0", "Adobe-GB1-1", "Adobe-GB1-2", "Adobe-GB1-3", "Adobe-GB1-4", "Adobe-GB1-5", "Adobe-Japan1-0", "Adobe-Japan1-1", "Adobe-Japan1-2", "Adobe-Japan1-3", "Adobe-Japan1-4", "Adobe-Japan1-5", "Adobe-Japan1-6", "Adobe-Korea1-0", "Adobe-Korea1-1", "Adobe-Korea1-2", "B5-H", "B5-V", "B5pc-H", "B5pc-V", "CNS-EUC-H", "CNS-EUC-V", "CNS1-H", "CNS1-V", "CNS2-H", "CNS2-V", "ETHK-B5-H", "ETHK-B5-V", "ETen-B5-H", "ETen-B5-V", "ETenms-B5-H", "ETenms-B5-V", "EUC-H", "EUC-V", "Ext-H", "Ext-RKSJ-H", "Ext-RKSJ-V", "Ext-V", "GB-EUC-H", "GB-EUC-V", "GB-H", "GB-V", "GBK-EUC-H", "GBK-EUC-V", "GBK2K-H", "GBK2K-V", "GBKp-EUC-H", "GBKp-EUC-V", "GBT-EUC-H", "GBT-EUC-V", "GBT-H", "GBT-V", "GBTpc-EUC-H", "GBTpc-EUC-V", "GBpc-EUC-H", "GBpc-EUC-V", "H", "HKdla-B5-H", "HKdla-B5-V", "HKdlb-B5-H", "HKdlb-B5-V", "HKgccs-B5-H", "HKgccs-B5-V", "HKm314-B5-H", "HKm314-B5-V", "HKm471-B5-H", "HKm471-B5-V", "HKscs-B5-H", "HKscs-B5-V", "Hankaku", "Hiragana", "KSC-EUC-H", "KSC-EUC-V", "KSC-H", "KSC-Johab-H", "KSC-Johab-V", "KSC-V", "KSCms-UHC-H", "KSCms-UHC-HW-H", "KSCms-UHC-HW-V", "KSCms-UHC-V", "KSCpc-EUC-H", "KSCpc-EUC-V", "Katakana", "NWP-H", "NWP-V", "RKSJ-H", "RKSJ-V", "Roman", "UniCNS-UCS2-H", "UniCNS-UCS2-V", "UniCNS-UTF16-H", "UniCNS-UTF16-V", "UniCNS-UTF32-H", "UniCNS-UTF32-V", "UniCNS-UTF8-H", "UniCNS-UTF8-V", "UniGB-UCS2-H", "UniGB-UCS2-V", "UniGB-UTF16-H", "UniGB-UTF16-V", "UniGB-UTF32-H", "UniGB-UTF32-V", "UniGB-UTF8-H", "UniGB-UTF8-V", "UniJIS-UCS2-H", "UniJIS-UCS2-HW-H", "UniJIS-UCS2-HW-V", "UniJIS-UCS2-V", "UniJIS-UTF16-H", "UniJIS-UTF16-V", "UniJIS-UTF32-H", "UniJIS-UTF32-V", "UniJIS-UTF8-H", "UniJIS-UTF8-V", "UniJIS2004-UTF16-H", "UniJIS2004-UTF16-V", "UniJIS2004-UTF32-H", "UniJIS2004-UTF32-V", "UniJIS2004-UTF8-H", "UniJIS2004-UTF8-V", "UniJISPro-UCS2-HW-V", "UniJISPro-UCS2-V", "UniJISPro-UTF8-V", "UniJISX0213-UTF32-H", "UniJISX0213-UTF32-V", "UniJISX02132004-UTF32-H", "UniJISX02132004-UTF32-V", "UniKS-UCS2-H", "UniKS-UCS2-V", "UniKS-UTF16-H", "UniKS-UTF16-V", "UniKS-UTF32-H", "UniKS-UTF32-V", "UniKS-UTF8-H", "UniKS-UTF8-V", "V", "WP-Symbol"]; 18512const MAX_MAP_RANGE = 2 ** 24 - 1; 18513class CMap { 18514 constructor(builtInCMap = false) { 18515 this.codespaceRanges = [[], [], [], []]; 18516 this.numCodespaceRanges = 0; 18517 this._map = []; 18518 this.name = ""; 18519 this.vertical = false; 18520 this.useCMap = null; 18521 this.builtInCMap = builtInCMap; 18522 } 18523 addCodespaceRange(n, low, high) { 18524 this.codespaceRanges[n - 1].push(low, high); 18525 this.numCodespaceRanges++; 18526 } 18527 mapCidRange(low, high, dstLow) { 18528 if (high - low > MAX_MAP_RANGE) { 18529 throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE."); 18530 } 18531 while (low <= high) { 18532 this._map[low++] = dstLow++; 18533 } 18534 } 18535 mapBfRange(low, high, dstLow) { 18536 if (high - low > MAX_MAP_RANGE) { 18537 throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE."); 18538 } 18539 const lastByte = dstLow.length - 1; 18540 while (low <= high) { 18541 this._map[low++] = dstLow; 18542 const nextCharCode = dstLow.charCodeAt(lastByte) + 1; 18543 if (nextCharCode > 0xff) { 18544 dstLow = dstLow.substring(0, lastByte - 1) + String.fromCharCode(dstLow.charCodeAt(lastByte - 1) + 1) + "\x00"; 18545 continue; 18546 } 18547 dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(nextCharCode); 18548 } 18549 } 18550 mapBfRangeToArray(low, high, array) { 18551 if (high - low > MAX_MAP_RANGE) { 18552 throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE."); 18553 } 18554 const ii = array.length; 18555 let i = 0; 18556 while (low <= high && i < ii) { 18557 this._map[low] = array[i++]; 18558 ++low; 18559 } 18560 } 18561 mapOne(src, dst) { 18562 this._map[src] = dst; 18563 } 18564 lookup(code) { 18565 return this._map[code]; 18566 } 18567 contains(code) { 18568 return this._map[code] !== undefined; 18569 } 18570 forEach(callback) { 18571 const map = this._map; 18572 const length = map.length; 18573 if (length <= 0x10000) { 18574 for (let i = 0; i < length; i++) { 18575 if (map[i] !== undefined) { 18576 callback(i, map[i]); 18577 } 18578 } 18579 } else { 18580 for (const i in map) { 18581 callback(i, map[i]); 18582 } 18583 } 18584 } 18585 charCodeOf(value) { 18586 const map = this._map; 18587 if (map.length <= 0x10000) { 18588 return map.indexOf(value); 18589 } 18590 for (const charCode in map) { 18591 if (map[charCode] === value) { 18592 return charCode | 0; 18593 } 18594 } 18595 return -1; 18596 } 18597 getMap() { 18598 return this._map; 18599 } 18600 readCharCode(str, offset, out) { 18601 let c = 0; 18602 const codespaceRanges = this.codespaceRanges; 18603 for (let n = 0, nn = codespaceRanges.length; n < nn; n++) { 18604 c = (c << 8 | str.charCodeAt(offset + n)) >>> 0; 18605 const codespaceRange = codespaceRanges[n]; 18606 for (let k = 0, kk = codespaceRange.length; k < kk;) { 18607 const low = codespaceRange[k++]; 18608 const high = codespaceRange[k++]; 18609 if (c >= low && c <= high) {
vendor: 8,779 bytes, lines 18610-18954
18610 out.charcode = c; 18611 out.length = n + 1; 18612 return; 18613 } 18614 } 18615 } 18616 out.charcode = 0; 18617 out.length = 1; 18618 } 18619 getCharCodeLength(charCode) { 18620 const codespaceRanges = this.codespaceRanges; 18621 for (let n = 0, nn = codespaceRanges.length; n < nn; n++) { 18622 const codespaceRange = codespaceRanges[n]; 18623 for (let k = 0, kk = codespaceRange.length; k < kk;) { 18624 const low = codespaceRange[k++]; 18625 const high = codespaceRange[k++]; 18626 if (charCode >= low && charCode <= high) { 18627 return n + 1; 18628 } 18629 } 18630 } 18631 return 1; 18632 } 18633 get length() { 18634 return this._map.length; 18635 } 18636 get isIdentityCMap() { 18637 if (!(this.name === "Identity-H" || this.name === "Identity-V")) { 18638 return false; 18639 } 18640 if (this._map.length !== 0x10000) { 18641 return false; 18642 } 18643 for (let i = 0; i < 0x10000; i++) { 18644 if (this._map[i] !== i) { 18645 return false; 18646 } 18647 } 18648 return true; 18649 } 18650} 18651class IdentityCMap extends CMap { 18652 constructor(vertical, n) { 18653 super(); 18654 this.vertical = vertical; 18655 this.addCodespaceRange(n, 0, 0xffff); 18656 } 18657 mapCidRange(low, high, dstLow) { 18658 unreachable("should not call mapCidRange"); 18659 } 18660 mapBfRange(low, high, dstLow) { 18661 unreachable("should not call mapBfRange"); 18662 } 18663 mapBfRangeToArray(low, high, array) { 18664 unreachable("should not call mapBfRangeToArray"); 18665 } 18666 mapOne(src, dst) { 18667 unreachable("should not call mapCidOne"); 18668 } 18669 lookup(code) { 18670 return Number.isInteger(code) && code <= 0xffff ? code : undefined; 18671 } 18672 contains(code) { 18673 return Number.isInteger(code) && code <= 0xffff; 18674 } 18675 forEach(callback) { 18676 for (let i = 0; i <= 0xffff; i++) { 18677 callback(i, i); 18678 } 18679 } 18680 charCodeOf(value) { 18681 return Number.isInteger(value) && value <= 0xffff ? value : -1; 18682 } 18683 getMap() { 18684 const map = new Array(0x10000); 18685 for (let i = 0; i <= 0xffff; i++) { 18686 map[i] = i; 18687 } 18688 return map; 18689 } 18690 get length() { 18691 return 0x10000; 18692 } 18693 get isIdentityCMap() { 18694 unreachable("should not access .isIdentityCMap"); 18695 } 18696} 18697function strToInt(str) { 18698 let a = 0; 18699 for (let i = 0; i < str.length; i++) { 18700 a = a << 8 | str.charCodeAt(i); 18701 } 18702 return a >>> 0; 18703} 18704function expectString(obj) { 18705 if (typeof obj !== "string") { 18706 throw new FormatError("Malformed CMap: expected string."); 18707 } 18708} 18709function expectInt(obj) { 18710 if (!Number.isInteger(obj)) { 18711 throw new FormatError("Malformed CMap: expected int."); 18712 } 18713} 18714function parseBfChar(cMap, lexer) { 18715 while (true) { 18716 let obj = lexer.getObj(); 18717 if (obj === EOF) { 18718 break; 18719 } 18720 if (isCmd(obj, "endbfchar")) { 18721 return; 18722 } 18723 expectString(obj); 18724 const src = strToInt(obj); 18725 obj = lexer.getObj(); 18726 expectString(obj); 18727 const dst = obj; 18728 cMap.mapOne(src, dst); 18729 } 18730} 18731function parseBfRange(cMap, lexer) { 18732 while (true) { 18733 let obj = lexer.getObj(); 18734 if (obj === EOF) { 18735 break; 18736 } 18737 if (isCmd(obj, "endbfrange")) { 18738 return; 18739 } 18740 expectString(obj); 18741 const low = strToInt(obj); 18742 obj = lexer.getObj(); 18743 expectString(obj); 18744 const high = strToInt(obj); 18745 obj = lexer.getObj(); 18746 if (Number.isInteger(obj) || typeof obj === "string") { 18747 const dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj; 18748 cMap.mapBfRange(low, high, dstLow); 18749 } else if (isCmd(obj, "[")) { 18750 obj = lexer.getObj(); 18751 const array = []; 18752 while (!isCmd(obj, "]") && obj !== EOF) { 18753 array.push(obj); 18754 obj = lexer.getObj(); 18755 } 18756 cMap.mapBfRangeToArray(low, high, array); 18757 } else { 18758 break; 18759 } 18760 } 18761 throw new FormatError("Invalid bf range."); 18762} 18763function parseCidChar(cMap, lexer) { 18764 while (true) { 18765 let obj = lexer.getObj(); 18766 if (obj === EOF) { 18767 break; 18768 } 18769 if (isCmd(obj, "endcidchar")) { 18770 return; 18771 } 18772 expectString(obj); 18773 const src = strToInt(obj); 18774 obj = lexer.getObj(); 18775 expectInt(obj); 18776 const dst = obj; 18777 cMap.mapOne(src, dst); 18778 } 18779} 18780function parseCidRange(cMap, lexer) { 18781 while (true) { 18782 let obj = lexer.getObj(); 18783 if (obj === EOF) { 18784 break; 18785 } 18786 if (isCmd(obj, "endcidrange")) { 18787 return; 18788 } 18789 expectString(obj); 18790 const low = strToInt(obj); 18791 obj = lexer.getObj(); 18792 expectString(obj); 18793 const high = strToInt(obj); 18794 obj = lexer.getObj(); 18795 expectInt(obj); 18796 const dstLow = obj; 18797 cMap.mapCidRange(low, high, dstLow); 18798 } 18799} 18800function parseCodespaceRange(cMap, lexer) { 18801 while (true) { 18802 let obj = lexer.getObj(); 18803 if (obj === EOF) { 18804 break; 18805 } 18806 if (isCmd(obj, "endcodespacerange")) { 18807 return; 18808 } 18809 if (typeof obj !== "string") { 18810 break; 18811 } 18812 const low = strToInt(obj); 18813 obj = lexer.getObj(); 18814 if (typeof obj !== "string") { 18815 break; 18816 } 18817 const high = strToInt(obj); 18818 cMap.addCodespaceRange(obj.length, low, high); 18819 } 18820 throw new FormatError("Invalid codespace range."); 18821} 18822function parseWMode(cMap, lexer) { 18823 const obj = lexer.getObj(); 18824 if (Number.isInteger(obj)) { 18825 cMap.vertical = !!obj; 18826 } 18827} 18828function parseCMapName(cMap, lexer) { 18829 const obj = lexer.getObj(); 18830 if (obj instanceof Name) { 18831 cMap.name = obj.name; 18832 } 18833} 18834async function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) { 18835 let previous, embeddedUseCMap; 18836 objLoop: while (true) { 18837 try { 18838 const obj = lexer.getObj(); 18839 if (obj === EOF) { 18840 break; 18841 } else if (obj instanceof Name) { 18842 if (obj.name === "WMode") { 18843 parseWMode(cMap, lexer); 18844 } else if (obj.name === "CMapName") { 18845 parseCMapName(cMap, lexer); 18846 } 18847 previous = obj; 18848 } else if (obj instanceof Cmd) { 18849 switch (obj.cmd) { 18850 case "endcmap": 18851 break objLoop; 18852 case "usecmap": 18853 if (previous instanceof Name) { 18854 embeddedUseCMap = previous.name; 18855 } 18856 break; 18857 case "begincodespacerange": 18858 parseCodespaceRange(cMap, lexer); 18859 break; 18860 case "beginbfchar": 18861 parseBfChar(cMap, lexer); 18862 break; 18863 case "begincidchar": 18864 parseCidChar(cMap, lexer); 18865 break; 18866 case "beginbfrange": 18867 parseBfRange(cMap, lexer); 18868 break; 18869 case "begincidrange": 18870 parseCidRange(cMap, lexer); 18871 break; 18872 } 18873 } 18874 } catch (ex) { 18875 if (ex instanceof MissingDataException) { 18876 throw ex; 18877 } 18878 warn("Invalid cMap data: " + ex); 18879 continue; 18880 } 18881 } 18882 if (!useCMap && embeddedUseCMap) { 18883 useCMap = embeddedUseCMap; 18884 } 18885 if (useCMap) { 18886 return extendCMap(cMap, fetchBuiltInCMap, useCMap); 18887 } 18888 return cMap; 18889} 18890async function extendCMap(cMap, fetchBuiltInCMap, useCMap) { 18891 cMap.useCMap = await createBuiltInCMap(useCMap, fetchBuiltInCMap); 18892 if (cMap.numCodespaceRanges === 0) { 18893 const useCodespaceRanges = cMap.useCMap.codespaceRanges; 18894 for (let i = 0; i < useCodespaceRanges.length; i++) { 18895 cMap.codespaceRanges[i] = useCodespaceRanges[i].slice(); 18896 } 18897 cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges; 18898 } 18899 cMap.useCMap.forEach(function (key, value) { 18900 if (!cMap.contains(key)) { 18901 cMap.mapOne(key, value); 18902 } 18903 }); 18904 return cMap; 18905} 18906async function createBuiltInCMap(name, fetchBuiltInCMap) { 18907 if (name === "Identity-H") { 18908 return new IdentityCMap(false, 2); 18909 } else if (name === "Identity-V") { 18910 return new IdentityCMap(true, 2); 18911 } 18912 if (!BUILT_IN_CMAPS.includes(name)) { 18913 throw new Error("Unknown CMap name: " + name); 18914 } 18915 if (!fetchBuiltInCMap) { 18916 throw new Error("Built-in CMap parameters are not provided."); 18917 } 18918 const { 18919 cMapData, 18920 isCompressed 18921 } = await fetchBuiltInCMap(name); 18922 const cMap = new CMap(true); 18923 if (isCompressed) { 18924 return new BinaryCMapReader().process(cMapData, cMap, useCMap => extendCMap(cMap, fetchBuiltInCMap, useCMap)); 18925 } 18926 const lexer = new Lexer(new Stream(cMapData)); 18927 return parseCMap(cMap, lexer, fetchBuiltInCMap, null); 18928} 18929class CMapFactory { 18930 static async create({ 18931 encoding, 18932 fetchBuiltInCMap, 18933 useCMap 18934 }) { 18935 if (encoding instanceof Name) { 18936 return createBuiltInCMap(encoding.name, fetchBuiltInCMap); 18937 } else if (encoding instanceof BaseStream) { 18938 if (encoding.isAsync) { 18939 const bytes = await encoding.asyncGetBytes(); 18940 if (bytes) { 18941 encoding = new Stream(bytes, 0, bytes.length, encoding.dict); 18942 } 18943 } 18944 const parsedCMap = await parseCMap(new CMap(), new Lexer(encoding), fetchBuiltInCMap, useCMap); 18945 if (parsedCMap.isIdentityCMap) { 18946 return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap); 18947 } 18948 return parsedCMap; 18949 } 18950 throw new Error("Encoding required."); 18951 } 18952} 18953 18954;// ./src/
vendor: 9,754 bytes, lines 18954-19241
18954shared/obj_bin_transform_utils.js 18955class CSS_FONT_INFO { 18956 static strings = ["fontFamily", "fontWeight", "italicAngle"]; 18957} 18958class SYSTEM_FONT_INFO { 18959 static strings = ["css", "loadedName", "baseFontName", "src"]; 18960} 18961class FONT_INFO { 18962 static bools = ["black", "bold", "disableFontFace", "fontExtraProperties", "isInvalidPDFjsFont", "isType3Font", "italic", "missingFile", "remeasure", "vertical"]; 18963 static numbers = ["ascent", "defaultWidth", "descent"]; 18964 static strings = ["fallbackName", "loadedName", "mimetype", "name"]; 18965 static OFFSET_NUMBERS = Math.ceil(this.bools.length * 2 / 8); 18966 static OFFSET_BBOX = this.OFFSET_NUMBERS + this.numbers.length * 8; 18967 static OFFSET_FONT_MATRIX = this.OFFSET_BBOX + 1 + 2 * 4; 18968 static OFFSET_DEFAULT_VMETRICS = this.OFFSET_FONT_MATRIX + 1 + 8 * 6; 18969 static OFFSET_STRINGS = this.OFFSET_DEFAULT_VMETRICS + 1 + 2 * 3; 18970} 18971class PATTERN_INFO { 18972 static KIND = 0; 18973 static HAS_BBOX = 1; 18974 static HAS_BACKGROUND = 2; 18975 static SHADING_TYPE = 3; 18976 static N_COORD = 4; 18977 static N_COLOR = 8; 18978 static N_STOP = 12; 18979 static N_FIGURES = 16; 18980} 18981 18982;// ./src/core/obj_bin_transform_core.js 18983 18984 18985 18986 18987 18988 18989 18990 18991 18992 18993 18994function compileCssFontInfo(info) { 18995 const encoder = new TextEncoder(); 18996 const encodedStrings = {}; 18997 let stringsLength = 0; 18998 for (const prop of CSS_FONT_INFO.strings) { 18999 const encoded = encoder.encode(info[prop]); 19000 encodedStrings[prop] = encoded; 19001 stringsLength += 4 + encoded.length; 19002 } 19003 const buffer = new ArrayBuffer(stringsLength); 19004 const data = new Uint8Array(buffer); 19005 const view = new DataView(buffer); 19006 let offset = 0; 19007 for (const prop of CSS_FONT_INFO.strings) { 19008 const encoded = encodedStrings[prop]; 19009 const length = encoded.length; 19010 view.setUint32(offset, length); 19011 data.set(encoded, offset + 4); 19012 offset += 4 + length; 19013 } 19014 assert(offset === buffer.byteLength, "compileCssFontInfo: Buffer overflow"); 19015 return buffer; 19016} 19017function compileSystemFontInfo(info) { 19018 const encoder = new TextEncoder(); 19019 const encodedStrings = {}; 19020 let stringsLength = 0; 19021 for (const prop of SYSTEM_FONT_INFO.strings) { 19022 const encoded = encoder.encode(info[prop]); 19023 encodedStrings[prop] = encoded; 19024 stringsLength += 4 + encoded.length; 19025 } 19026 stringsLength += 4; 19027 let encodedStyleStyle, 19028 encodedStyleWeight, 19029 lengthEstimate = 1 + stringsLength; 19030 if (info.style) { 19031 encodedStyleStyle = encoder.encode(info.style.style); 19032 encodedStyleWeight = encoder.encode(info.style.weight); 19033 lengthEstimate += 4 + encodedStyleStyle.length + 4 + encodedStyleWeight.length; 19034 } 19035 const buffer = new ArrayBuffer(lengthEstimate); 19036 const data = new Uint8Array(buffer); 19037 const view = new DataView(buffer); 19038 let offset = 0; 19039 view.setUint8(offset++, info.guessFallback ? 1 : 0); 19040 view.setUint32(offset, 0); 19041 offset += 4; 19042 stringsLength = 0; 19043 for (const prop of SYSTEM_FONT_INFO.strings) { 19044 const encoded = encodedStrings[prop]; 19045 const length = encoded.length; 19046 stringsLength += 4 + length; 19047 view.setUint32(offset, length); 19048 data.set(encoded, offset + 4); 19049 offset += 4 + length; 19050 } 19051 view.setUint32(offset - stringsLength - 4, stringsLength); 19052 if (info.style) { 19053 view.setUint32(offset, encodedStyleStyle.length); 19054 data.set(encodedStyleStyle, offset + 4); 19055 offset += 4 + encodedStyleStyle.length; 19056 view.setUint32(offset, encodedStyleWeight.length); 19057 data.set(encodedStyleWeight, offset + 4); 19058 offset += 4 + encodedStyleWeight.length; 19059 } 19060 assert(offset <= buffer.byteLength, "compileSystemFontInfo: Buffer overflow"); 19061 return buffer.transferToFixedLength(offset); 19062} 19063function compileFontInfo(font) { 19064 const systemFontInfoBuffer = font.systemFontInfo ? compileSystemFontInfo(font.systemFontInfo) : null; 19065 const cssFontInfoBuffer = font.cssFontInfo ? compileCssFontInfo(font.cssFontInfo) : null; 19066 const encoder = new TextEncoder(); 19067 const encodedStrings = {}; 19068 let stringsLength = 0; 19069 for (const prop of FONT_INFO.strings) { 19070 encodedStrings[prop] = encoder.encode(font[prop]); 19071 stringsLength += 4 + encodedStrings[prop].length; 19072 } 19073 const lengthEstimate = FONT_INFO.OFFSET_STRINGS + 4 + stringsLength + 4 + (systemFontInfoBuffer?.byteLength ?? 0) + 4 + (cssFontInfoBuffer?.byteLength ?? 0) + 4 + (font.data?.length ?? 0); 19074 const buffer = new ArrayBuffer(lengthEstimate); 19075 const data = new Uint8Array(buffer); 19076 const view = new DataView(buffer); 19077 let offset = 0; 19078 const numBools = FONT_INFO.bools.length; 19079 let boolByte = 0, 19080 boolBit = 0; 19081 for (let i = 0; i < numBools; i++) { 19082 const value = font[FONT_INFO.bools[i]]; 19083 const bits = value === undefined ? 0x00 : value ? 0x02 : 0x01; 19084 boolByte |= bits << boolBit; 19085 boolBit += 2; 19086 if (boolBit === 8 || i === numBools - 1) { 19087 view.setUint8(offset++, boolByte); 19088 boolByte = 0; 19089 boolBit = 0; 19090 } 19091 } 19092 assert(offset === FONT_INFO.OFFSET_NUMBERS, "compileFontInfo: Boolean properties offset mismatch"); 19093 for (const prop of FONT_INFO.numbers) { 19094 view.setFloat64(offset, font[prop]); 19095 offset += 8; 19096 } 19097 assert(offset === FONT_INFO.OFFSET_BBOX, "compileFontInfo: Number properties offset mismatch"); 19098 if (font.bbox) { 19099 view.setUint8(offset++, 4); 19100 for (const coord of font.bbox) { 19101 view.setInt16(offset, coord, true); 19102 offset += 2; 19103 } 19104 } else { 19105 view.setUint8(offset++, 0); 19106 offset += 2 * 4; 19107 } 19108 assert(offset === FONT_INFO.OFFSET_FONT_MATRIX, "compileFontInfo: BBox properties offset mismatch"); 19109 if (font.fontMatrix) { 19110 view.setUint8(offset++, 6); 19111 for (const point of font.fontMatrix) { 19112 view.setFloat64(offset, point, true); 19113 offset += 8; 19114 } 19115 } else { 19116 view.setUint8(offset++, 0); 19117 offset += 8 * 6; 19118 } 19119 assert(offset === FONT_INFO.OFFSET_DEFAULT_VMETRICS, "compileFontInfo: FontMatrix properties offset mismatch"); 19120 if (font.defaultVMetrics) { 19121 view.setUint8(offset++, 3); 19122 for (const metric of font.defaultVMetrics) { 19123 view.setInt16(offset, metric, true); 19124 offset += 2; 19125 } 19126 } else { 19127 view.setUint8(offset++, 0); 19128 offset += 3 * 2; 19129 } 19130 assert(offset === FONT_INFO.OFFSET_STRINGS, "compileFontInfo: DefaultVMetrics properties offset mismatch"); 19131 view.setUint32(FONT_INFO.OFFSET_STRINGS, 0); 19132 offset += 4; 19133 for (const prop of FONT_INFO.strings) { 19134 const encoded = encodedStrings[prop]; 19135 const length = encoded.length; 19136 view.setUint32(offset, length); 19137 data.set(encoded, offset + 4); 19138 offset += 4 + length; 19139 } 19140 view.setUint32(FONT_INFO.OFFSET_STRINGS, offset - FONT_INFO.OFFSET_STRINGS - 4); 19141 if (!systemFontInfoBuffer) { 19142 view.setUint32(offset, 0); 19143 offset += 4; 19144 } else { 19145 const length = systemFontInfoBuffer.byteLength; 19146 view.setUint32(offset, length); 19147 assert(offset + 4 + length <= buffer.byteLength, "compileFontInfo: Buffer overflow at systemFontInfo"); 19148 data.set(new Uint8Array(systemFontInfoBuffer), offset + 4); 19149 offset += 4 + length; 19150 } 19151 if (!cssFontInfoBuffer) { 19152 view.setUint32(offset, 0); 19153 offset += 4; 19154 } else { 19155 const length = cssFontInfoBuffer.byteLength; 19156 view.setUint32(offset, length); 19157 assert(offset + 4 + length <= buffer.byteLength, "compileFontInfo: Buffer overflow at cssFontInfo"); 19158 data.set(new Uint8Array(cssFontInfoBuffer), offset + 4); 19159 offset += 4 + length; 19160 } 19161 if (font.data === undefined) { 19162 view.setUint32(offset, 0); 19163 offset += 4; 19164 } else { 19165 view.setUint32(offset, font.data.length); 19166 data.set(font.data, offset + 4); 19167 offset += 4 + font.data.length; 19168 } 19169 assert(offset <= buffer.byteLength, "compileFontInfo: Buffer overflow"); 19170 return buffer.transferToFixedLength(offset); 19171} 19172function compilePatternInfo(ir) { 19173 let kind, 19174 bbox = null, 19175 coords = [], 19176 colors = [], 19177 colorStops = [], 19178 shadingType = null, 19179 background = null; 19180 switch (ir[0]) { 19181 case "RadialAxial": 19182 kind = ir[1] === "axial" ? 1 : 2; 19183 bbox = ir[2]; 19184 colorStops = ir[3]; 19185 if (kind === 1) { 19186 coords.push(...ir[4], ...ir[5]); 19187 } else { 19188 coords.push(ir[4][0], ir[4][1], ir[6], ir[5][0], ir[5][1], ir[7]); 19189 } 19190 break; 19191 case "Mesh": 19192 kind = 3; 19193 shadingType = ir[1]; 19194 coords = ir[2]; 19195 colors = ir[3]; 19196 bbox = ir[6]; 19197 background = ir[7]; 19198 break; 19199 default: 19200 throw new Error(`Unsupported pattern type: ${ir[0]}`); 19201 } 19202 const nCoord = Math.floor(coords.length / 2); 19203 const nColor = Math.floor(colors.length / 4); 19204 const nStop = colorStops.length; 19205 const byteLen = 20 + nCoord * 8 + nColor * 4 + nStop * 8 + (bbox ? 16 : 0) + (background ? 3 : 0); 19206 const buffer = new ArrayBuffer(byteLen); 19207 const dataView = new DataView(buffer); 19208 const u8data = new Uint8Array(buffer); 19209 dataView.setUint8(PATTERN_INFO.KIND, kind); 19210 dataView.setUint8(PATTERN_INFO.HAS_BBOX, bbox ? 1 : 0); 19211 dataView.setUint8(PATTERN_INFO.HAS_BACKGROUND, background ? 1 : 0); 19212 dataView.setUint8(PATTERN_INFO.SHADING_TYPE, shadingType); 19213 dataView.setUint32(PATTERN_INFO.N_COORD, nCoord, true); 19214 dataView.setUint32(PATTERN_INFO.N_COLOR, nColor, true); 19215 dataView.setUint32(PATTERN_INFO.N_STOP, nStop, true); 19216 dataView.setUint32(PATTERN_INFO.N_FIGURES, 0, true); 19217 let offset = 20; 19218 const coordsView = new Float32Array(buffer, offset, nCoord * 2); 19219 coordsView.set(coords); 19220 offset += nCoord * 8; 19221 u8data.set(colors, offset); 19222 offset += nColor * 4; 19223 for (const [pos, hex] of colorStops) { 19224 dataView.setFloat32(offset, pos, true); 19225 offset += 4; 19226 dataView.setUint32(offset, parseInt(hex.slice(1), 16), true); 19227 offset += 4; 19228 } 19229 if (bbox) { 19230 for (const v of bbox) { 19231 dataView.setFloat32(offset, v, true); 19232 offset += 4; 19233 } 19234 } 19235 if (background) { 19236 u8data.set(background, offset); 19237 } 19238 return buffer; 19239} 19240function compileFontPathInfo(path) { 19241 return path.slice().buffer;
vendor: 136,307 bytes, lines 19241-23812
19241 19242} 19243 19244;// ./src/core/encodings.js 19245const ExpertEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclamsmall", "Hungarumlautsmall", "", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "", "", "", "isuperior", "", "", "lsuperior", "msuperior", "nsuperior", "osuperior", "", "", "rsuperior", "ssuperior", "tsuperior", "", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "exclamdownsmall", "centoldstyle", "Lslashsmall", "", "", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "", "Dotaccentsmall", "", "", "Macronsmall", "", "", "figuredash", "hypheninferior", "", "", "Ogoneksmall", "Ringsmall", "Cedillasmall", "", "", "", "onequarter", "onehalf", "threequarters", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "", "", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall"]; 19246const MacExpertEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclamsmall", "Hungarumlautsmall", "centoldstyle", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "", "threequartersemdash", "", "questionsmall", "", "", "", "", "Ethsmall", "", "", "onequarter", "onehalf", "threequarters", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "", "", "", "", "", "", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "", "parenrightinferior", "Circumflexsmall", "hypheninferior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "", "", "asuperior", "centsuperior", "", "", "", "", "Aacutesmall", "Agravesmall", "Acircumflexsmall", "Adieresissmall", "Atildesmall", "Aringsmall", "Ccedillasmall", "Eacutesmall", "Egravesmall", "Ecircumflexsmall", "Edieresissmall", "Iacutesmall", "Igravesmall", "Icircumflexsmall", "Idieresissmall", "Ntildesmall", "Oacutesmall", "Ogravesmall", "Ocircumflexsmall", "Odieresissmall", "Otildesmall", "Uacutesmall", "Ugravesmall", "Ucircumflexsmall", "Udieresissmall", "", "eightsuperior", "fourinferior", "threeinferior", "sixinferior", "eightinferior", "seveninferior", "Scaronsmall", "", "centinferior", "twoinferior", "", "Dieresissmall", "", "Caronsmall", "osuperior", "fiveinferior", "", "commainferior", "periodinferior", "Yacutesmall", "", "dollarinferior", "", "", "Thornsmall", "", "nineinferior", "zeroinferior", "Zcaronsmall", "AEsmall", "Oslashsmall", "questiondownsmall", "oneinferior", "Lslashsmall", "", "", "", "", "", "", "Cedillasmall", "", "", "", "", "", "OEsmall", "figuredash", "hyphensuperior", "", "", "", "", "exclamdownsmall", "", "Ydieresissmall", "", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "ninesuperior", "zerosuperior", "", "esuperior", "rsuperior", "tsuperior", "", "", "isuperior", "ssuperior", "dsuperior", "", "", "", "", "", "lsuperior", "Ogoneksmall", "Brevesmall", "Macronsmall", "bsuperior", "nsuperior", "msuperior", "commasuperior", "periodsuperior", "Dotaccentsmall", "Ringsmall", "", "", "", ""]; 19247const MacRomanEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "", "Adieresis", "Aring", "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis", "aacute", "agrave", "acircumflex", "adieresis", "atilde", "aring", "ccedilla", "eacute", "egrave", "ecircumflex", "edieresis", "iacute", "igrave", "icircumflex", "idieresis", "ntilde", "oacute", "ograve", "ocircumflex", "odieresis", "otilde", "uacute", "ugrave", "ucircumflex", "udieresis", "dagger", "degree", "cent", "sterling", "section", "bullet", "paragraph", "germandbls", "registered", "copyright", "trademark", "acute", "dieresis", "notequal", "AE", "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", "yen", "mu", "partialdiff", "summation", "product", "pi", "integral", "ordfeminine", "ordmasculine", "Omega", "ae", "oslash", "questiondown", "exclamdown", "logicalnot", "radical", "florin", "approxequal", "Delta", "guillemotleft", "guillemotright", "ellipsis", "space", "Agrave", "Atilde", "Otilde", "OE", "oe", "endash", "emdash", "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide", "lozenge", "ydieresis", "Ydieresis", "fraction", "currency", "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", "periodcentered", "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex", "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex", "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi", "circumflex", "tilde", "macron", "breve", "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek", "caron"]; 19248const StandardEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "", "endash", "dagger", "daggerdbl", "periodcentered", "", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "", "questiondown", "", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "", "ring", "cedilla", "", "hungarumlaut", "ogonek", "caron", "emdash", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "AE", "", "ordfeminine", "", "", "", "", "Lslash", "Oslash", "OE", "ordmasculine", "", "", "", "", "", "ae", "", "", "", "dotlessi", "", "", "lslash", "oslash", "oe", "germandbls", "", "", "", ""]; 19249const WinAnsiEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "bullet", "Euro", "bullet", "quotesinglbase", "florin", "quotedblbase", "ellipsis", "dagger", "daggerdbl", "circumflex", "perthousand", "Scaron", "guilsinglleft", "OE", "bullet", "Zcaron", "bullet", "bullet", "quoteleft", "quoteright", "quotedblleft", "quotedblright", "bullet", "endash", "emdash", "tilde", "trademark", "scaron", "guilsinglright", "oe", "bullet", "zcaron", "Ydieresis", "space", "exclamdown", "cent", "sterling", "currency", "yen", "brokenbar", "section", "dieresis", "copyright", "ordfeminine", "guillemotleft", "logicalnot", "hyphen", "registered", "macron", "degree", "plusminus", "twosuperior", "threesuperior", "acute", "mu", "paragraph", "periodcentered", "cedilla", "onesuperior", "ordmasculine", "guillemotright", "onequarter", "onehalf", "threequarters", "questiondown", "Agrave", "Aacute", "Acircumflex", "Atilde", "Adieresis", "Aring", "AE", "Ccedilla", "Egrave", "Eacute", "Ecircumflex", "Edieresis", "Igrave", "Iacute", "Icircumflex", "Idieresis", "Eth", "Ntilde", "Ograve", "Oacute", "Ocircumflex", "Otilde", "Odieresis", "multiply", "Oslash", "Ugrave", "Uacute", "Ucircumflex", "Udieresis", "Yacute", "Thorn", "germandbls", "agrave", "aacute", "acircumflex", "atilde", "adieresis", "aring", "ae", "ccedilla", "egrave", "eacute", "ecircumflex", "edieresis", "igrave", "iacute", "icircumflex", "idieresis", "eth", "ntilde", "ograve", "oacute", "ocircumflex", "otilde", "odieresis", "divide", "oslash", "ugrave", "uacute", "ucircumflex", "udieresis", "yacute", "thorn", "ydieresis"]; 19250const SymbolSetEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "universal", "numbersign", "existential", "percent", "ampersand", "suchthat", "parenleft", "parenright", "asteriskmath", "plus", "comma", "minus", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "congruent", "Alpha", "Beta", "Chi", "Delta", "Epsilon", "Phi", "Gamma", "Eta", "Iota", "theta1", "Kappa", "Lambda", "Mu", "Nu", "Omicron", "Pi", "Theta", "Rho", "Sigma", "Tau", "Upsilon", "sigma1", "Omega", "Xi", "Psi", "Zeta", "bracketleft", "therefore", "bracketright", "perpendicular", "underscore", "radicalex", "alpha", "beta", "chi", "delta", "epsilon", "phi", "gamma", "eta", "iota", "phi1", "kappa", "lambda", "mu", "nu", "omicron", "pi", "theta", "rho", "sigma", "tau", "upsilon", "omega1", "omega", "xi", "psi", "zeta", "braceleft", "bar", "braceright", "similar", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "Euro", "Upsilon1", "minute", "lessequal", "fraction", "infinity", "florin", "club", "diamond", "heart", "spade", "arrowboth", "arrowleft", "arrowup", "arrowright", "arrowdown", "degree", "plusminus", "second", "greaterequal", "multiply", "proportional", "partialdiff", "bullet", "divide", "notequal", "equivalence", "approxequal", "ellipsis", "arrowvertex", "arrowhorizex", "carriagereturn", "aleph", "Ifraktur", "Rfraktur", "weierstrass", "circlemultiply", "circleplus", "emptyset", "intersection", "union", "propersuperset", "reflexsuperset", "notsubset", "propersubset", "reflexsubset", "element", "notelement", "angle", "gradient", "registerserif", "copyrightserif", "trademarkserif", "product", "radical", "dotmath", "logicalnot", "logicaland", "logicalor", "arrowdblboth", "arrowdblleft", "arrowdblup", "arrowdblright", "arrowdbldown", "lozenge", "angleleft", "registersans", "copyrightsans", "trademarksans", "summation", "parenlefttp", "parenleftex", "parenleftbt", "bracketlefttp", "bracketleftex", "bracketleftbt", "bracelefttp", "braceleftmid", "braceleftbt", "braceex", "", "angleright", "integral", "integraltp", "integralex", "integralbt", "parenrighttp", "parenrightex", "parenrightbt", "bracketrighttp", "bracketrightex", "bracketrightbt", "bracerighttp", "bracerightmid", "bracerightbt", ""]; 19251const ZapfDingbatsEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "a1", "a2", "a202", "a3", "a4", "a5", "a119", "a118", "a117", "a11", "a12", "a13", "a14", "a15", "a16", "a105", "a17", "a18", "a19", "a20", "a21", "a22", "a23", "a24", "a25", "a26", "a27", "a28", "a6", "a7", "a8", "a9", "a10", "a29", "a30", "a31", "a32", "a33", "a34", "a35", "a36", "a37", "a38", "a39", "a40", "a41", "a42", "a43", "a44", "a45", "a46", "a47", "a48", "a49", "a50", "a51", "a52", "a53", "a54", "a55", "a56", "a57", "a58", "a59", "a60", "a61", "a62", "a63", "a64", "a65", "a66", "a67", "a68", "a69", "a70", "a71", "a72", "a73", "a74", "a203", "a75", "a204", "a76", "a77", "a78", "a79", "a81", "a82", "a83", "a84", "a97", "a98", "a99", "a100", "", "a89", "a90", "a93", "a94", "a91", "a92", "a205", "a85", "a206", "a86", "a87", "a88", "a95", "a96", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "a101", "a102", "a103", "a104", "a106", "a107", "a108", "a112", "a111", "a110", "a109", "a120", "a121", "a122", "a123", "a124", "a125", "a126", "a127", "a128", "a129", "a130", "a131", "a132", "a133", "a134", "a135", "a136", "a137", "a138", "a139", "a140", "a141", "a142", "a143", "a144", "a145", "a146", "a147", "a148", "a149", "a150", "a151", "a152", "a153", "a154", "a155", "a156", "a157", "a158", "a159", "a160", "a161", "a163", "a164", "a196", "a165", "a192", "a166", "a167", "a168", "a169", "a170", "a171", "a172", "a173", "a162", "a174", "a175", "a176", "a177", "a178", "a179", "a193", "a180", "a199", "a181", "a200", "a182", "", "a201", "a183", "a184", "a197", "a185", "a194", "a198", "a186", "a195", "a187", "a188", "a189", "a190", "a191", ""]; 19252function getEncoding(encodingName) { 19253 switch (encodingName) { 19254 case "WinAnsiEncoding": 19255 return WinAnsiEncoding; 19256 case "StandardEncoding": 19257 return StandardEncoding; 19258 case "MacRomanEncoding": 19259 return MacRomanEncoding; 19260 case "SymbolSetEncoding": 19261 return SymbolSetEncoding; 19262 case "ZapfDingbatsEncoding": 19263 return ZapfDingbatsEncoding; 19264 case "ExpertEncoding": 19265 return ExpertEncoding; 19266 case "MacExpertEncoding": 19267 return MacExpertEncoding; 19268 default: 19269 return null; 19270 } 19271} 19272 19273;// ./src/core/glyphlist.js 19274 19275const getGlyphsUnicode = getLookupTableFactory(function (t) { 19276 t.A = 0x0041; 19277 t.AE = 0x00c6; 19278 t.AEacute = 0x01fc; 19279 t.AEmacron = 0x01e2; 19280 t.AEsmall = 0xf7e6; 19281 t.Aacute = 0x00c1; 19282 t.Aacutesmall = 0xf7e1; 19283 t.Abreve = 0x0102; 19284 t.Abreveacute = 0x1eae; 19285 t.Abrevecyrillic = 0x04d0; 19286 t.Abrevedotbelow = 0x1eb6; 19287 t.Abrevegrave = 0x1eb0; 19288 t.Abrevehookabove = 0x1eb2; 19289 t.Abrevetilde = 0x1eb4; 19290 t.Acaron = 0x01cd; 19291 t.Acircle = 0x24b6; 19292 t.Acircumflex = 0x00c2; 19293 t.Acircumflexacute = 0x1ea4; 19294 t.Acircumflexdotbelow = 0x1eac; 19295 t.Acircumflexgrave = 0x1ea6; 19296 t.Acircumflexhookabove = 0x1ea8; 19297 t.Acircumflexsmall = 0xf7e2; 19298 t.Acircumflextilde = 0x1eaa; 19299 t.Acute = 0xf6c9; 19300 t.Acutesmall = 0xf7b4; 19301 t.Acyrillic = 0x0410; 19302 t.Adblgrave = 0x0200; 19303 t.Adieresis = 0x00c4; 19304 t.Adieresiscyrillic = 0x04d2; 19305 t.Adieresismacron = 0x01de; 19306 t.Adieresissmall = 0xf7e4; 19307 t.Adotbelow = 0x1ea0; 19308 t.Adotmacron = 0x01e0; 19309 t.Agrave = 0x00c0; 19310 t.Agravesmall = 0xf7e0; 19311 t.Ahookabove = 0x1ea2; 19312 t.Aiecyrillic = 0x04d4; 19313 t.Ainvertedbreve = 0x0202; 19314 t.Alpha = 0x0391; 19315 t.Alphatonos = 0x0386; 19316 t.Amacron = 0x0100; 19317 t.Amonospace = 0xff21; 19318 t.Aogonek = 0x0104; 19319 t.Aring = 0x00c5; 19320 t.Aringacute = 0x01fa; 19321 t.Aringbelow = 0x1e00; 19322 t.Aringsmall = 0xf7e5; 19323 t.Asmall = 0xf761; 19324 t.Atilde = 0x00c3; 19325 t.Atildesmall = 0xf7e3; 19326 t.Aybarmenian = 0x0531; 19327 t.B = 0x0042; 19328 t.Bcircle = 0x24b7; 19329 t.Bdotaccent = 0x1e02; 19330 t.Bdotbelow = 0x1e04; 19331 t.Becyrillic = 0x0411; 19332 t.Benarmenian = 0x0532; 19333 t.Beta = 0x0392; 19334 t.Bhook = 0x0181; 19335 t.Blinebelow = 0x1e06; 19336 t.Bmonospace = 0xff22; 19337 t.Brevesmall = 0xf6f4; 19338 t.Bsmall = 0xf762; 19339 t.Btopbar = 0x0182; 19340 t.C = 0x0043; 19341 t.Caarmenian = 0x053e; 19342 t.Cacute = 0x0106; 19343 t.Caron = 0xf6ca; 19344 t.Caronsmall = 0xf6f5; 19345 t.Ccaron = 0x010c; 19346 t.Ccedilla = 0x00c7; 19347 t.Ccedillaacute = 0x1e08; 19348 t.Ccedillasmall = 0xf7e7; 19349 t.Ccircle = 0x24b8; 19350 t.Ccircumflex = 0x0108; 19351 t.Cdot = 0x010a; 19352 t.Cdotaccent = 0x010a; 19353 t.Cedillasmall = 0xf7b8; 19354 t.Chaarmenian = 0x0549; 19355 t.Cheabkhasiancyrillic = 0x04bc; 19356 t.Checyrillic = 0x0427; 19357 t.Chedescenderabkhasiancyrillic = 0x04be; 19358 t.Chedescendercyrillic = 0x04b6; 19359 t.Chedieresiscyrillic = 0x04f4; 19360 t.Cheharmenian = 0x0543; 19361 t.Chekhakassiancyrillic = 0x04cb; 19362 t.Cheverticalstrokecyrillic = 0x04b8; 19363 t.Chi = 0x03a7; 19364 t.Chook = 0x0187; 19365 t.Circumflexsmall = 0xf6f6; 19366 t.Cmonospace = 0xff23; 19367 t.Coarmenian = 0x0551; 19368 t.Csmall = 0xf763; 19369 t.D = 0x0044; 19370 t.DZ = 0x01f1; 19371 t.DZcaron = 0x01c4; 19372 t.Daarmenian = 0x0534; 19373 t.Dafrican = 0x0189; 19374 t.Dcaron = 0x010e; 19375 t.Dcedilla = 0x1e10; 19376 t.Dcircle = 0x24b9; 19377 t.Dcircumflexbelow = 0x1e12; 19378 t.Dcroat = 0x0110; 19379 t.Ddotaccent = 0x1e0a; 19380 t.Ddotbelow = 0x1e0c; 19381 t.Decyrillic = 0x0414; 19382 t.Deicoptic = 0x03ee; 19383 t.Delta = 0x2206; 19384 t.Deltagreek = 0x0394; 19385 t.Dhook = 0x018a; 19386 t.Dieresis = 0xf6cb; 19387 t.DieresisAcute = 0xf6cc; 19388 t.DieresisGrave = 0xf6cd; 19389 t.Dieresissmall = 0xf7a8; 19390 t.Digammagreek = 0x03dc; 19391 t.Djecyrillic = 0x0402; 19392 t.Dlinebelow = 0x1e0e; 19393 t.Dmonospace = 0xff24; 19394 t.Dotaccentsmall = 0xf6f7; 19395 t.Dslash = 0x0110; 19396 t.Dsmall = 0xf764; 19397 t.Dtopbar = 0x018b; 19398 t.Dz = 0x01f2; 19399 t.Dzcaron = 0x01c5; 19400 t.Dzeabkhasiancyrillic = 0x04e0; 19401 t.Dzecyrillic = 0x0405; 19402 t.Dzhecyrillic = 0x040f; 19403 t.E = 0x0045; 19404 t.Eacute = 0x00c9; 19405 t.Eacutesmall = 0xf7e9; 19406 t.Ebreve = 0x0114; 19407 t.Ecaron = 0x011a; 19408 t.Ecedillabreve = 0x1e1c; 19409 t.Echarmenian = 0x0535; 19410 t.Ecircle = 0x24ba; 19411 t.Ecircumflex = 0x00ca; 19412 t.Ecircumflexacute = 0x1ebe; 19413 t.Ecircumflexbelow = 0x1e18; 19414 t.Ecircumflexdotbelow = 0x1ec6; 19415 t.Ecircumflexgrave = 0x1ec0; 19416 t.Ecircumflexhookabove = 0x1ec2; 19417 t.Ecircumflexsmall = 0xf7ea; 19418 t.Ecircumflextilde = 0x1ec4; 19419 t.Ecyrillic = 0x0404; 19420 t.Edblgrave = 0x0204; 19421 t.Edieresis = 0x00cb; 19422 t.Edieresissmall = 0xf7eb; 19423 t.Edot = 0x0116; 19424 t.Edotaccent = 0x0116; 19425 t.Edotbelow = 0x1eb8; 19426 t.Efcyrillic = 0x0424; 19427 t.Egrave = 0x00c8; 19428 t.Egravesmall = 0xf7e8; 19429 t.Eharmenian = 0x0537; 19430 t.Ehookabove = 0x1eba; 19431 t.Eightroman = 0x2167; 19432 t.Einvertedbreve = 0x0206; 19433 t.Eiotifiedcyrillic = 0x0464; 19434 t.Elcyrillic = 0x041b; 19435 t.Elevenroman = 0x216a; 19436 t.Emacron = 0x0112; 19437 t.Emacronacute = 0x1e16; 19438 t.Emacrongrave = 0x1e14; 19439 t.Emcyrillic = 0x041c; 19440 t.Emonospace = 0xff25; 19441 t.Encyrillic = 0x041d; 19442 t.Endescendercyrillic = 0x04a2; 19443 t.Eng = 0x014a; 19444 t.Enghecyrillic = 0x04a4; 19445 t.Enhookcyrillic = 0x04c7; 19446 t.Eogonek = 0x0118; 19447 t.Eopen = 0x0190; 19448 t.Epsilon = 0x0395; 19449 t.Epsilontonos = 0x0388; 19450 t.Ercyrillic = 0x0420; 19451 t.Ereversed = 0x018e; 19452 t.Ereversedcyrillic = 0x042d; 19453 t.Escyrillic = 0x0421; 19454 t.Esdescendercyrillic = 0x04aa; 19455 t.Esh = 0x01a9; 19456 t.Esmall = 0xf765; 19457 t.Eta = 0x0397; 19458 t.Etarmenian = 0x0538; 19459 t.Etatonos = 0x0389; 19460 t.Eth = 0x00d0; 19461 t.Ethsmall = 0xf7f0; 19462 t.Etilde = 0x1ebc; 19463 t.Etildebelow = 0x1e1a; 19464 t.Euro = 0x20ac; 19465 t.Ezh = 0x01b7; 19466 t.Ezhcaron = 0x01ee; 19467 t.Ezhreversed = 0x01b8; 19468 t.F = 0x0046; 19469 t.Fcircle = 0x24bb; 19470 t.Fdotaccent = 0x1e1e; 19471 t.Feharmenian = 0x0556; 19472 t.Feicoptic = 0x03e4; 19473 t.Fhook = 0x0191; 19474 t.Fitacyrillic = 0x0472; 19475 t.Fiveroman = 0x2164; 19476 t.Fmonospace = 0xff26; 19477 t.Fourroman = 0x2163; 19478 t.Fsmall = 0xf766; 19479 t.G = 0x0047; 19480 t.GBsquare = 0x3387; 19481 t.Gacute = 0x01f4; 19482 t.Gamma = 0x0393; 19483 t.Gammaafrican = 0x0194; 19484 t.Gangiacoptic = 0x03ea; 19485 t.Gbreve = 0x011e; 19486 t.Gcaron = 0x01e6; 19487 t.Gcedilla = 0x0122; 19488 t.Gcircle = 0x24bc; 19489 t.Gcircumflex = 0x011c; 19490 t.Gcommaaccent = 0x0122; 19491 t.Gdot = 0x0120; 19492 t.Gdotaccent = 0x0120; 19493 t.Gecyrillic = 0x0413; 19494 t.Ghadarmenian = 0x0542; 19495 t.Ghemiddlehookcyrillic = 0x0494; 19496 t.Ghestrokecyrillic = 0x0492; 19497 t.Gheupturncyrillic = 0x0490; 19498 t.Ghook = 0x0193; 19499 t.Gimarmenian = 0x0533; 19500 t.Gjecyrillic = 0x0403; 19501 t.Gmacron = 0x1e20; 19502 t.Gmonospace = 0xff27; 19503 t.Grave = 0xf6ce; 19504 t.Gravesmall = 0xf760; 19505 t.Gsmall = 0xf767; 19506 t.Gsmallhook = 0x029b; 19507 t.Gstroke = 0x01e4; 19508 t.H = 0x0048; 19509 t.H18533 = 0x25cf; 19510 t.H18543 = 0x25aa; 19511 t.H18551 = 0x25ab; 19512 t.H22073 = 0x25a1; 19513 t.HPsquare = 0x33cb; 19514 t.Haabkhasiancyrillic = 0x04a8; 19515 t.Hadescendercyrillic = 0x04b2; 19516 t.Hardsigncyrillic = 0x042a; 19517 t.Hbar = 0x0126; 19518 t.Hbrevebelow = 0x1e2a; 19519 t.Hcedilla = 0x1e28; 19520 t.Hcircle = 0x24bd; 19521 t.Hcircumflex = 0x0124; 19522 t.Hdieresis = 0x1e26; 19523 t.Hdotaccent = 0x1e22; 19524 t.Hdotbelow = 0x1e24; 19525 t.Hmonospace = 0xff28; 19526 t.Hoarmenian = 0x0540; 19527 t.Horicoptic = 0x03e8; 19528 t.Hsmall = 0xf768; 19529 t.Hungarumlaut = 0xf6cf; 19530 t.Hungarumlautsmall = 0xf6f8; 19531 t.Hzsquare = 0x3390; 19532 t.I = 0x0049; 19533 t.IAcyrillic = 0x042f; 19534 t.IJ = 0x0132; 19535 t.IUcyrillic = 0x042e; 19536 t.Iacute = 0x00cd; 19537 t.Iacutesmall = 0xf7ed; 19538 t.Ibreve = 0x012c; 19539 t.Icaron = 0x01cf; 19540 t.Icircle = 0x24be; 19541 t.Icircumflex = 0x00ce; 19542 t.Icircumflexsmall = 0xf7ee; 19543 t.Icyrillic = 0x0406; 19544 t.Idblgrave = 0x0208; 19545 t.Idieresis = 0x00cf; 19546 t.Idieresisacute = 0x1e2e; 19547 t.Idieresiscyrillic = 0x04e4; 19548 t.Idieresissmall = 0xf7ef; 19549 t.Idot = 0x0130; 19550 t.Idotaccent = 0x0130; 19551 t.Idotbelow = 0x1eca; 19552 t.Iebrevecyrillic = 0x04d6; 19553 t.Iecyrillic = 0x0415; 19554 t.Ifraktur = 0x2111; 19555 t.Igrave = 0x00cc; 19556 t.Igravesmall = 0xf7ec; 19557 t.Ihookabove = 0x1ec8; 19558 t.Iicyrillic = 0x0418; 19559 t.Iinvertedbreve = 0x020a; 19560 t.Iishortcyrillic = 0x0419; 19561 t.Imacron = 0x012a; 19562 t.Imacroncyrillic = 0x04e2; 19563 t.Imonospace = 0xff29; 19564 t.Iniarmenian = 0x053b; 19565 t.Iocyrillic = 0x0401; 19566 t.Iogonek = 0x012e; 19567 t.Iota = 0x0399; 19568 t.Iotaafrican = 0x0196; 19569 t.Iotadieresis = 0x03aa; 19570 t.Iotatonos = 0x038a; 19571 t.Ismall = 0xf769; 19572 t.Istroke = 0x0197; 19573 t.Itilde = 0x0128; 19574 t.Itildebelow = 0x1e2c; 19575 t.Izhitsacyrillic = 0x0474; 19576 t.Izhitsadblgravecyrillic = 0x0476; 19577 t.J = 0x004a; 19578 t.Jaarmenian = 0x0541; 19579 t.Jcircle = 0x24bf; 19580 t.Jcircumflex = 0x0134; 19581 t.Jecyrillic = 0x0408; 19582 t.Jheharmenian = 0x054b; 19583 t.Jmonospace = 0xff2a; 19584 t.Jsmall = 0xf76a; 19585 t.K = 0x004b; 19586 t.KBsquare = 0x3385; 19587 t.KKsquare = 0x33cd; 19588 t.Kabashkircyrillic = 0x04a0; 19589 t.Kacute = 0x1e30; 19590 t.Kacyrillic = 0x041a; 19591 t.Kadescendercyrillic = 0x049a; 19592 t.Kahookcyrillic = 0x04c3; 19593 t.Kappa = 0x039a; 19594 t.Kastrokecyrillic = 0x049e; 19595 t.Kaverticalstrokecyrillic = 0x049c; 19596 t.Kcaron = 0x01e8; 19597 t.Kcedilla = 0x0136; 19598 t.Kcircle = 0x24c0; 19599 t.Kcommaaccent = 0x0136; 19600 t.Kdotbelow = 0x1e32; 19601 t.Keharmenian = 0x0554; 19602 t.Kenarmenian = 0x053f; 19603 t.Khacyrillic = 0x0425; 19604 t.Kheicoptic = 0x03e6; 19605 t.Khook = 0x0198; 19606 t.Kjecyrillic = 0x040c; 19607 t.Klinebelow = 0x1e34; 19608 t.Kmonospace = 0xff2b; 19609 t.Koppacyrillic = 0x0480; 19610 t.Koppagreek = 0x03de; 19611 t.Ksicyrillic = 0x046e; 19612 t.Ksmall = 0xf76b; 19613 t.L = 0x004c; 19614 t.LJ = 0x01c7; 19615 t.LL = 0xf6bf; 19616 t.Lacute = 0x0139; 19617 t.Lambda = 0x039b; 19618 t.Lcaron = 0x013d; 19619 t.Lcedilla = 0x013b; 19620 t.Lcircle = 0x24c1; 19621 t.Lcircumflexbelow = 0x1e3c; 19622 t.Lcommaaccent = 0x013b; 19623 t.Ldot = 0x013f; 19624 t.Ldotaccent = 0x013f; 19625 t.Ldotbelow = 0x1e36; 19626 t.Ldotbelowmacron = 0x1e38; 19627 t.Liwnarmenian = 0x053c; 19628 t.Lj = 0x01c8; 19629 t.Ljecyrillic = 0x0409; 19630 t.Llinebelow = 0x1e3a; 19631 t.Lmonospace = 0xff2c; 19632 t.Lslash = 0x0141; 19633 t.Lslashsmall = 0xf6f9; 19634 t.Lsmall = 0xf76c; 19635 t.M = 0x004d; 19636 t.MBsquare = 0x3386; 19637 t.Macron = 0xf6d0; 19638 t.Macronsmall = 0xf7af; 19639 t.Macute = 0x1e3e; 19640 t.Mcircle = 0x24c2; 19641 t.Mdotaccent = 0x1e40; 19642 t.Mdotbelow = 0x1e42; 19643 t.Menarmenian = 0x0544; 19644 t.Mmonospace = 0xff2d; 19645 t.Msmall = 0xf76d; 19646 t.Mturned = 0x019c; 19647 t.Mu = 0x039c; 19648 t.N = 0x004e; 19649 t.NJ = 0x01ca; 19650 t.Nacute = 0x0143; 19651 t.Ncaron = 0x0147; 19652 t.Ncedilla = 0x0145; 19653 t.Ncircle = 0x24c3; 19654 t.Ncircumflexbelow = 0x1e4a; 19655 t.Ncommaaccent = 0x0145; 19656 t.Ndotaccent = 0x1e44; 19657 t.Ndotbelow = 0x1e46; 19658 t.Nhookleft = 0x019d; 19659 t.Nineroman = 0x2168; 19660 t.Nj = 0x01cb; 19661 t.Njecyrillic = 0x040a; 19662 t.Nlinebelow = 0x1e48; 19663 t.Nmonospace = 0xff2e; 19664 t.Nowarmenian = 0x0546; 19665 t.Nsmall = 0xf76e; 19666 t.Ntilde = 0x00d1; 19667 t.Ntildesmall = 0xf7f1; 19668 t.Nu = 0x039d; 19669 t.O = 0x004f; 19670 t.OE = 0x0152; 19671 t.OEsmall = 0xf6fa; 19672 t.Oacute = 0x00d3; 19673 t.Oacutesmall = 0xf7f3; 19674 t.Obarredcyrillic = 0x04e8; 19675 t.Obarreddieresiscyrillic = 0x04ea; 19676 t.Obreve = 0x014e; 19677 t.Ocaron = 0x01d1; 19678 t.Ocenteredtilde = 0x019f; 19679 t.Ocircle = 0x24c4; 19680 t.Ocircumflex = 0x00d4; 19681 t.Ocircumflexacute = 0x1ed0; 19682 t.Ocircumflexdotbelow = 0x1ed8; 19683 t.Ocircumflexgrave = 0x1ed2; 19684 t.Ocircumflexhookabove = 0x1ed4; 19685 t.Ocircumflexsmall = 0xf7f4; 19686 t.Ocircumflextilde = 0x1ed6; 19687 t.Ocyrillic = 0x041e; 19688 t.Odblacute = 0x0150; 19689 t.Odblgrave = 0x020c; 19690 t.Odieresis = 0x00d6; 19691 t.Odieresiscyrillic = 0x04e6; 19692 t.Odieresissmall = 0xf7f6; 19693 t.Odotbelow = 0x1ecc; 19694 t.Ogoneksmall = 0xf6fb; 19695 t.Ograve = 0x00d2; 19696 t.Ogravesmall = 0xf7f2; 19697 t.Oharmenian = 0x0555; 19698 t.Ohm = 0x2126; 19699 t.Ohookabove = 0x1ece; 19700 t.Ohorn = 0x01a0; 19701 t.Ohornacute = 0x1eda; 19702 t.Ohorndotbelow = 0x1ee2; 19703 t.Ohorngrave = 0x1edc; 19704 t.Ohornhookabove = 0x1ede; 19705 t.Ohorntilde = 0x1ee0; 19706 t.Ohungarumlaut = 0x0150; 19707 t.Oi = 0x01a2; 19708 t.Oinvertedbreve = 0x020e; 19709 t.Omacron = 0x014c; 19710 t.Omacronacute = 0x1e52; 19711 t.Omacrongrave = 0x1e50; 19712 t.Omega = 0x2126; 19713 t.Omegacyrillic = 0x0460; 19714 t.Omegagreek = 0x03a9; 19715 t.Omegaroundcyrillic = 0x047a; 19716 t.Omegatitlocyrillic = 0x047c; 19717 t.Omegatonos = 0x038f; 19718 t.Omicron = 0x039f; 19719 t.Omicrontonos = 0x038c; 19720 t.Omonospace = 0xff2f; 19721 t.Oneroman = 0x2160; 19722 t.Oogonek = 0x01ea; 19723 t.Oogonekmacron = 0x01ec; 19724 t.Oopen = 0x0186; 19725 t.Oslash = 0x00d8; 19726 t.Oslashacute = 0x01fe; 19727 t.Oslashsmall = 0xf7f8; 19728 t.Osmall = 0xf76f; 19729 t.Ostrokeacute = 0x01fe; 19730 t.Otcyrillic = 0x047e; 19731 t.Otilde = 0x00d5; 19732 t.Otildeacute = 0x1e4c; 19733 t.Otildedieresis = 0x1e4e; 19734 t.Otildesmall = 0xf7f5; 19735 t.P = 0x0050; 19736 t.Pacute = 0x1e54; 19737 t.Pcircle = 0x24c5; 19738 t.Pdotaccent = 0x1e56; 19739 t.Pecyrillic = 0x041f; 19740 t.Peharmenian = 0x054a; 19741 t.Pemiddlehookcyrillic = 0x04a6; 19742 t.Phi = 0x03a6; 19743 t.Phook = 0x01a4; 19744 t.Pi = 0x03a0; 19745 t.Piwrarmenian = 0x0553; 19746 t.Pmonospace = 0xff30; 19747 t.Psi = 0x03a8; 19748 t.Psicyrillic = 0x0470; 19749 t.Psmall = 0xf770; 19750 t.Q = 0x0051; 19751 t.Qcircle = 0x24c6; 19752 t.Qmonospace = 0xff31; 19753 t.Qsmall = 0xf771; 19754 t.R = 0x0052; 19755 t.Raarmenian = 0x054c; 19756 t.Racute = 0x0154; 19757 t.Rcaron = 0x0158; 19758 t.Rcedilla = 0x0156; 19759 t.Rcircle = 0x24c7; 19760 t.Rcommaaccent = 0x0156; 19761 t.Rdblgrave = 0x0210; 19762 t.Rdotaccent = 0x1e58; 19763 t.Rdotbelow = 0x1e5a; 19764 t.Rdotbelowmacron = 0x1e5c; 19765 t.Reharmenian = 0x0550; 19766 t.Rfraktur = 0x211c; 19767 t.Rho = 0x03a1; 19768 t.Ringsmall = 0xf6fc; 19769 t.Rinvertedbreve = 0x0212; 19770 t.Rlinebelow = 0x1e5e; 19771 t.Rmonospace = 0xff32; 19772 t.Rsmall = 0xf772; 19773 t.Rsmallinverted = 0x0281; 19774 t.Rsmallinvertedsuperior = 0x02b6; 19775 t.S = 0x0053; 19776 t.SF010000 = 0x250c; 19777 t.SF020000 = 0x2514; 19778 t.SF030000 = 0x2510; 19779 t.SF040000 = 0x2518; 19780 t.SF050000 = 0x253c; 19781 t.SF060000 = 0x252c; 19782 t.SF070000 = 0x2534; 19783 t.SF080000 = 0x251c; 19784 t.SF090000 = 0x2524; 19785 t.SF100000 = 0x2500; 19786 t.SF110000 = 0x2502; 19787 t.SF190000 = 0x2561; 19788 t.SF200000 = 0x2562; 19789 t.SF210000 = 0x2556; 19790 t.SF220000 = 0x2555; 19791 t.SF230000 = 0x2563; 19792 t.SF240000 = 0x2551; 19793 t.SF250000 = 0x2557; 19794 t.SF260000 = 0x255d; 19795 t.SF270000 = 0x255c; 19796 t.SF280000 = 0x255b; 19797 t.SF360000 = 0x255e; 19798 t.SF370000 = 0x255f; 19799 t.SF380000 = 0x255a; 19800 t.SF390000 = 0x2554; 19801 t.SF400000 = 0x2569; 19802 t.SF410000 = 0x2566; 19803 t.SF420000 = 0x2560; 19804 t.SF430000 = 0x2550; 19805 t.SF440000 = 0x256c; 19806 t.SF450000 = 0x2567; 19807 t.SF460000 = 0x2568; 19808 t.SF470000 = 0x2564; 19809 t.SF480000 = 0x2565; 19810 t.SF490000 = 0x2559; 19811 t.SF500000 = 0x2558; 19812 t.SF510000 = 0x2552; 19813 t.SF520000 = 0x2553; 19814 t.SF530000 = 0x256b; 19815 t.SF540000 = 0x256a; 19816 t.Sacute = 0x015a; 19817 t.Sacutedotaccent = 0x1e64; 19818 t.Sampigreek = 0x03e0; 19819 t.Scaron = 0x0160; 19820 t.Scarondotaccent = 0x1e66; 19821 t.Scaronsmall = 0xf6fd; 19822 t.Scedilla = 0x015e; 19823 t.Schwa = 0x018f; 19824 t.Schwacyrillic = 0x04d8; 19825 t.Schwadieresiscyrillic = 0x04da; 19826 t.Scircle = 0x24c8; 19827 t.Scircumflex = 0x015c; 19828 t.Scommaaccent = 0x0218; 19829 t.Sdotaccent = 0x1e60; 19830 t.Sdotbelow = 0x1e62; 19831 t.Sdotbelowdotaccent = 0x1e68; 19832 t.Seharmenian = 0x054d; 19833 t.Sevenroman = 0x2166; 19834 t.Shaarmenian = 0x0547; 19835 t.Shacyrillic = 0x0428; 19836 t.Shchacyrillic = 0x0429; 19837 t.Sheicoptic = 0x03e2; 19838 t.Shhacyrillic = 0x04ba; 19839 t.Shimacoptic = 0x03ec; 19840 t.Sigma = 0x03a3; 19841 t.Sixroman = 0x2165; 19842 t.Smonospace = 0xff33; 19843 t.Softsigncyrillic = 0x042c; 19844 t.Ssmall = 0xf773; 19845 t.Stigmagreek = 0x03da; 19846 t.T = 0x0054; 19847 t.Tau = 0x03a4; 19848 t.Tbar = 0x0166; 19849 t.Tcaron = 0x0164; 19850 t.Tcedilla = 0x0162; 19851 t.Tcircle = 0x24c9; 19852 t.Tcircumflexbelow = 0x1e70; 19853 t.Tcommaaccent = 0x0162; 19854 t.Tdotaccent = 0x1e6a; 19855 t.Tdotbelow = 0x1e6c; 19856 t.Tecyrillic = 0x0422; 19857 t.Tedescendercyrillic = 0x04ac; 19858 t.Tenroman = 0x2169; 19859 t.Tetsecyrillic = 0x04b4; 19860 t.Theta = 0x0398; 19861 t.Thook = 0x01ac; 19862 t.Thorn = 0x00de; 19863 t.Thornsmall = 0xf7fe; 19864 t.Threeroman = 0x2162; 19865 t.Tildesmall = 0xf6fe; 19866 t.Tiwnarmenian = 0x054f; 19867 t.Tlinebelow = 0x1e6e; 19868 t.Tmonospace = 0xff34; 19869 t.Toarmenian = 0x0539; 19870 t.Tonefive = 0x01bc; 19871 t.Tonesix = 0x0184; 19872 t.Tonetwo = 0x01a7; 19873 t.Tretroflexhook = 0x01ae; 19874 t.Tsecyrillic = 0x0426; 19875 t.Tshecyrillic = 0x040b; 19876 t.Tsmall = 0xf774; 19877 t.Twelveroman = 0x216b; 19878 t.Tworoman = 0x2161; 19879 t.U = 0x0055; 19880 t.Uacute = 0x00da; 19881 t.Uacutesmall = 0xf7fa; 19882 t.Ubreve = 0x016c; 19883 t.Ucaron = 0x01d3; 19884 t.Ucircle = 0x24ca; 19885 t.Ucircumflex = 0x00db; 19886 t.Ucircumflexbelow = 0x1e76; 19887 t.Ucircumflexsmall = 0xf7fb; 19888 t.Ucyrillic = 0x0423; 19889 t.Udblacute = 0x0170; 19890 t.Udblgrave = 0x0214; 19891 t.Udieresis = 0x00dc; 19892 t.Udieresisacute = 0x01d7; 19893 t.Udieresisbelow = 0x1e72; 19894 t.Udieresiscaron = 0x01d9; 19895 t.Udieresiscyrillic = 0x04f0; 19896 t.Udieresisgrave = 0x01db; 19897 t.Udieresismacron = 0x01d5; 19898 t.Udieresissmall = 0xf7fc; 19899 t.Udotbelow = 0x1ee4; 19900 t.Ugrave = 0x00d9; 19901 t.Ugravesmall = 0xf7f9; 19902 t.Uhookabove = 0x1ee6; 19903 t.Uhorn = 0x01af; 19904 t.Uhornacute = 0x1ee8; 19905 t.Uhorndotbelow = 0x1ef0; 19906 t.Uhorngrave = 0x1eea; 19907 t.Uhornhookabove = 0x1eec; 19908 t.Uhorntilde = 0x1eee; 19909 t.Uhungarumlaut = 0x0170; 19910 t.Uhungarumlautcyrillic = 0x04f2; 19911 t.Uinvertedbreve = 0x0216; 19912 t.Ukcyrillic = 0x0478; 19913 t.Umacron = 0x016a; 19914 t.Umacroncyrillic = 0x04ee; 19915 t.Umacrondieresis = 0x1e7a; 19916 t.Umonospace = 0xff35; 19917 t.Uogonek = 0x0172; 19918 t.Upsilon = 0x03a5; 19919 t.Upsilon1 = 0x03d2; 19920 t.Upsilonacutehooksymbolgreek = 0x03d3; 19921 t.Upsilonafrican = 0x01b1; 19922 t.Upsilondieresis = 0x03ab; 19923 t.Upsilondieresishooksymbolgreek = 0x03d4; 19924 t.Upsilonhooksymbol = 0x03d2; 19925 t.Upsilontonos = 0x038e; 19926 t.Uring = 0x016e; 19927 t.Ushortcyrillic = 0x040e; 19928 t.Usmall = 0xf775; 19929 t.Ustraightcyrillic = 0x04ae; 19930 t.Ustraightstrokecyrillic = 0x04b0; 19931 t.Utilde = 0x0168; 19932 t.Utildeacute = 0x1e78; 19933 t.Utildebelow = 0x1e74; 19934 t.V = 0x0056; 19935 t.Vcircle = 0x24cb; 19936 t.Vdotbelow = 0x1e7e; 19937 t.Vecyrillic = 0x0412; 19938 t.Vewarmenian = 0x054e; 19939 t.Vhook = 0x01b2; 19940 t.Vmonospace = 0xff36; 19941 t.Voarmenian = 0x0548; 19942 t.Vsmall = 0xf776; 19943 t.Vtilde = 0x1e7c; 19944 t.W = 0x0057; 19945 t.Wacute = 0x1e82; 19946 t.Wcircle = 0x24cc; 19947 t.Wcircumflex = 0x0174; 19948 t.Wdieresis = 0x1e84; 19949 t.Wdotaccent = 0x1e86; 19950 t.Wdotbelow = 0x1e88; 19951 t.Wgrave = 0x1e80; 19952 t.Wmonospace = 0xff37; 19953 t.Wsmall = 0xf777; 19954 t.X = 0x0058; 19955 t.Xcircle = 0x24cd; 19956 t.Xdieresis = 0x1e8c; 19957 t.Xdotaccent = 0x1e8a; 19958 t.Xeharmenian = 0x053d; 19959 t.Xi = 0x039e; 19960 t.Xmonospace = 0xff38; 19961 t.Xsmall = 0xf778; 19962 t.Y = 0x0059; 19963 t.Yacute = 0x00dd; 19964 t.Yacutesmall = 0xf7fd; 19965 t.Yatcyrillic = 0x0462; 19966 t.Ycircle = 0x24ce; 19967 t.Ycircumflex = 0x0176; 19968 t.Ydieresis = 0x0178; 19969 t.Ydieresissmall = 0xf7ff; 19970 t.Ydotaccent = 0x1e8e; 19971 t.Ydotbelow = 0x1ef4; 19972 t.Yericyrillic = 0x042b; 19973 t.Yerudieresiscyrillic = 0x04f8; 19974 t.Ygrave = 0x1ef2; 19975 t.Yhook = 0x01b3; 19976 t.Yhookabove = 0x1ef6; 19977 t.Yiarmenian = 0x0545; 19978 t.Yicyrillic = 0x0407; 19979 t.Yiwnarmenian = 0x0552; 19980 t.Ymonospace = 0xff39; 19981 t.Ysmall = 0xf779; 19982 t.Ytilde = 0x1ef8; 19983 t.Yusbigcyrillic = 0x046a; 19984 t.Yusbigiotifiedcyrillic = 0x046c; 19985 t.Yuslittlecyrillic = 0x0466; 19986 t.Yuslittleiotifiedcyrillic = 0x0468; 19987 t.Z = 0x005a; 19988 t.Zaarmenian = 0x0536; 19989 t.Zacute = 0x0179; 19990 t.Zcaron = 0x017d; 19991 t.Zcaronsmall = 0xf6ff; 19992 t.Zcircle = 0x24cf; 19993 t.Zcircumflex = 0x1e90; 19994 t.Zdot = 0x017b; 19995 t.Zdotaccent = 0x017b; 19996 t.Zdotbelow = 0x1e92; 19997 t.Zecyrillic = 0x0417; 19998 t.Zedescendercyrillic = 0x0498; 19999 t.Zedieresiscyrillic = 0x04de; 20000 t.Zeta = 0x0396; 20001 t.Zhearmenian = 0x053a; 20002 t.Zhebrevecyrillic = 0x04c1; 20003 t.Zhecyrillic = 0x0416; 20004 t.Zhedescendercyrillic = 0x0496; 20005 t.Zhedieresiscyrillic = 0x04dc; 20006 t.Zlinebelow = 0x1e94; 20007 t.Zmonospace = 0xff3a; 20008 t.Zsmall = 0xf77a; 20009 t.Zstroke = 0x01b5; 20010 t.a = 0x0061; 20011 t.aabengali = 0x0986; 20012 t.aacute = 0x00e1; 20013 t.aadeva = 0x0906; 20014 t.aagujarati = 0x0a86; 20015 t.aagurmukhi = 0x0a06; 20016 t.aamatragurmukhi = 0x0a3e; 20017 t.aarusquare = 0x3303; 20018 t.aavowelsignbengali = 0x09be; 20019 t.aavowelsigndeva = 0x093e; 20020 t.aavowelsigngujarati = 0x0abe; 20021 t.abbreviationmarkarmenian = 0x055f; 20022 t.abbreviationsigndeva = 0x0970; 20023 t.abengali = 0x0985; 20024 t.abopomofo = 0x311a; 20025 t.abreve = 0x0103; 20026 t.abreveacute = 0x1eaf; 20027 t.abrevecyrillic = 0x04d1; 20028 t.abrevedotbelow = 0x1eb7; 20029 t.abrevegrave = 0x1eb1; 20030 t.abrevehookabove = 0x1eb3; 20031 t.abrevetilde = 0x1eb5; 20032 t.acaron = 0x01ce; 20033 t.acircle = 0x24d0; 20034 t.acircumflex = 0x00e2; 20035 t.acircumflexacute = 0x1ea5; 20036 t.acircumflexdotbelow = 0x1ead; 20037 t.acircumflexgrave = 0x1ea7; 20038 t.acircumflexhookabove = 0x1ea9; 20039 t.acircumflextilde = 0x1eab; 20040 t.acute = 0x00b4; 20041 t.acutebelowcmb = 0x0317; 20042 t.acutecmb = 0x0301; 20043 t.acutecomb = 0x0301; 20044 t.acutedeva = 0x0954; 20045 t.acutelowmod = 0x02cf; 20046 t.acutetonecmb = 0x0341; 20047 t.acyrillic = 0x0430; 20048 t.adblgrave = 0x0201; 20049 t.addakgurmukhi = 0x0a71; 20050 t.adeva = 0x0905; 20051 t.adieresis = 0x00e4; 20052 t.adieresiscyrillic = 0x04d3; 20053 t.adieresismacron = 0x01df; 20054 t.adotbelow = 0x1ea1; 20055 t.adotmacron = 0x01e1; 20056 t.ae = 0x00e6; 20057 t.aeacute = 0x01fd; 20058 t.aekorean = 0x3150; 20059 t.aemacron = 0x01e3; 20060 t.afii00208 = 0x2015; 20061 t.afii08941 = 0x20a4; 20062 t.afii10017 = 0x0410; 20063 t.afii10018 = 0x0411; 20064 t.afii10019 = 0x0412; 20065 t.afii10020 = 0x0413; 20066 t.afii10021 = 0x0414; 20067 t.afii10022 = 0x0415; 20068 t.afii10023 = 0x0401; 20069 t.afii10024 = 0x0416; 20070 t.afii10025 = 0x0417; 20071 t.afii10026 = 0x0418; 20072 t.afii10027 = 0x0419; 20073 t.afii10028 = 0x041a; 20074 t.afii10029 = 0x041b; 20075 t.afii10030 = 0x041c; 20076 t.afii10031 = 0x041d; 20077 t.afii10032 = 0x041e; 20078 t.afii10033 = 0x041f; 20079 t.afii10034 = 0x0420; 20080 t.afii10035 = 0x0421; 20081 t.afii10036 = 0x0422; 20082 t.afii10037 = 0x0423; 20083 t.afii10038 = 0x0424; 20084 t.afii10039 = 0x0425; 20085 t.afii10040 = 0x0426; 20086 t.afii10041 = 0x0427; 20087 t.afii10042 = 0x0428; 20088 t.afii10043 = 0x0429; 20089 t.afii10044 = 0x042a; 20090 t.afii10045 = 0x042b; 20091 t.afii10046 = 0x042c; 20092 t.afii10047 = 0x042d; 20093 t.afii10048 = 0x042e; 20094 t.afii10049 = 0x042f; 20095 t.afii10050 = 0x0490; 20096 t.afii10051 = 0x0402; 20097 t.afii10052 = 0x0403; 20098 t.afii10053 = 0x0404; 20099 t.afii10054 = 0x0405; 20100 t.afii10055 = 0x0406; 20101 t.afii10056 = 0x0407; 20102 t.afii10057 = 0x0408; 20103 t.afii10058 = 0x0409; 20104 t.afii10059 = 0x040a; 20105 t.afii10060 = 0x040b; 20106 t.afii10061 = 0x040c; 20107 t.afii10062 = 0x040e; 20108 t.afii10063 = 0xf6c4; 20109 t.afii10064 = 0xf6c5; 20110 t.afii10065 = 0x0430; 20111 t.afii10066 = 0x0431; 20112 t.afii10067 = 0x0432; 20113 t.afii10068 = 0x0433; 20114 t.afii10069 = 0x0434; 20115 t.afii10070 = 0x0435; 20116 t.afii10071 = 0x0451; 20117 t.afii10072 = 0x0436; 20118 t.afii10073 = 0x0437; 20119 t.afii10074 = 0x0438; 20120 t.afii10075 = 0x0439; 20121 t.afii10076 = 0x043a; 20122 t.afii10077 = 0x043b; 20123 t.afii10078 = 0x043c; 20124 t.afii10079 = 0x043d; 20125 t.afii10080 = 0x043e; 20126 t.afii10081 = 0x043f; 20127 t.afii10082 = 0x0440; 20128 t.afii10083 = 0x0441; 20129 t.afii10084 = 0x0442; 20130 t.afii10085 = 0x0443; 20131 t.afii10086 = 0x0444; 20132 t.afii10087 = 0x0445; 20133 t.afii10088 = 0x0446; 20134 t.afii10089 = 0x0447; 20135 t.afii10090 = 0x0448; 20136 t.afii10091 = 0x0449; 20137 t.afii10092 = 0x044a; 20138 t.afii10093 = 0x044b; 20139 t.afii10094 = 0x044c; 20140 t.afii10095 = 0x044d; 20141 t.afii10096 = 0x044e; 20142 t.afii10097 = 0x044f; 20143 t.afii10098 = 0x0491; 20144 t.afii10099 = 0x0452; 20145 t.afii10100 = 0x0453; 20146 t.afii10101 = 0x0454; 20147 t.afii10102 = 0x0455; 20148 t.afii10103 = 0x0456; 20149 t.afii10104 = 0x0457; 20150 t.afii10105 = 0x0458; 20151 t.afii10106 = 0x0459; 20152 t.afii10107 = 0x045a; 20153 t.afii10108 = 0x045b; 20154 t.afii10109 = 0x045c; 20155 t.afii10110 = 0x045e; 20156 t.afii10145 = 0x040f; 20157 t.afii10146 = 0x0462; 20158 t.afii10147 = 0x0472; 20159 t.afii10148 = 0x0474; 20160 t.afii10192 = 0xf6c6; 20161 t.afii10193 = 0x045f; 20162 t.afii10194 = 0x0463; 20163 t.afii10195 = 0x0473; 20164 t.afii10196 = 0x0475; 20165 t.afii10831 = 0xf6c7; 20166 t.afii10832 = 0xf6c8; 20167 t.afii10846 = 0x04d9; 20168 t.afii299 = 0x200e; 20169 t.afii300 = 0x200f; 20170 t.afii301 = 0x200d; 20171 t.afii57381 = 0x066a; 20172 t.afii57388 = 0x060c; 20173 t.afii57392 = 0x0660; 20174 t.afii57393 = 0x0661; 20175 t.afii57394 = 0x0662; 20176 t.afii57395 = 0x0663; 20177 t.afii57396 = 0x0664; 20178 t.afii57397 = 0x0665; 20179 t.afii57398 = 0x0666; 20180 t.afii57399 = 0x0667; 20181 t.afii57400 = 0x0668; 20182 t.afii57401 = 0x0669; 20183 t.afii57403 = 0x061b; 20184 t.afii57407 = 0x061f; 20185 t.afii57409 = 0x0621; 20186 t.afii57410 = 0x0622; 20187 t.afii57411 = 0x0623; 20188 t.afii57412 = 0x0624; 20189 t.afii57413 = 0x0625; 20190 t.afii57414 = 0x0626; 20191 t.afii57415 = 0x0627; 20192 t.afii57416 = 0x0628; 20193 t.afii57417 = 0x0629; 20194 t.afii57418 = 0x062a; 20195 t.afii57419 = 0x062b; 20196 t.afii57420 = 0x062c; 20197 t.afii57421 = 0x062d; 20198 t.afii57422 = 0x062e; 20199 t.afii57423 = 0x062f; 20200 t.afii57424 = 0x0630; 20201 t.afii57425 = 0x0631; 20202 t.afii57426 = 0x0632; 20203 t.afii57427 = 0x0633; 20204 t.afii57428 = 0x0634; 20205 t.afii57429 = 0x0635; 20206 t.afii57430 = 0x0636; 20207 t.afii57431 = 0x0637; 20208 t.afii57432 = 0x0638; 20209 t.afii57433 = 0x0639; 20210 t.afii57434 = 0x063a; 20211 t.afii57440 = 0x0640; 20212 t.afii57441 = 0x0641; 20213 t.afii57442 = 0x0642; 20214 t.afii57443 = 0x0643; 20215 t.afii57444 = 0x0644; 20216 t.afii57445 = 0x0645; 20217 t.afii57446 = 0x0646; 20218 t.afii57448 = 0x0648; 20219 t.afii57449 = 0x0649; 20220 t.afii57450 = 0x064a; 20221 t.afii57451 = 0x064b; 20222 t.afii57452 = 0x064c; 20223 t.afii57453 = 0x064d; 20224 t.afii57454 = 0x064e; 20225 t.afii57455 = 0x064f; 20226 t.afii57456 = 0x0650; 20227 t.afii57457 = 0x0651; 20228 t.afii57458 = 0x0652; 20229 t.afii57470 = 0x0647; 20230 t.afii57505 = 0x06a4; 20231 t.afii57506 = 0x067e; 20232 t.afii57507 = 0x0686; 20233 t.afii57508 = 0x0698; 20234 t.afii57509 = 0x06af; 20235 t.afii57511 = 0x0679; 20236 t.afii57512 = 0x0688; 20237 t.afii57513 = 0x0691; 20238 t.afii57514 = 0x06ba; 20239 t.afii57519 = 0x06d2; 20240 t.afii57534 = 0x06d5; 20241 t.afii57636 = 0x20aa; 20242 t.afii57645 = 0x05be; 20243 t.afii57658 = 0x05c3; 20244 t.afii57664 = 0x05d0; 20245 t.afii57665 = 0x05d1; 20246 t.afii57666 = 0x05d2; 20247 t.afii57667 = 0x05d3; 20248 t.afii57668 = 0x05d4; 20249 t.afii57669 = 0x05d5; 20250 t.afii57670 = 0x05d6; 20251 t.afii57671 = 0x05d7; 20252 t.afii57672 = 0x05d8; 20253 t.afii57673 = 0x05d9; 20254 t.afii57674 = 0x05da; 20255 t.afii57675 = 0x05db; 20256 t.afii57676 = 0x05dc; 20257 t.afii57677 = 0x05dd; 20258 t.afii57678 = 0x05de; 20259 t.afii57679 = 0x05df; 20260 t.afii57680 = 0x05e0; 20261 t.afii57681 = 0x05e1; 20262 t.afii57682 = 0x05e2; 20263 t.afii57683 = 0x05e3; 20264 t.afii57684 = 0x05e4; 20265 t.afii57685 = 0x05e5; 20266 t.afii57686 = 0x05e6; 20267 t.afii57687 = 0x05e7; 20268 t.afii57688 = 0x05e8; 20269 t.afii57689 = 0x05e9; 20270 t.afii57690 = 0x05ea; 20271 t.afii57694 = 0xfb2a; 20272 t.afii57695 = 0xfb2b; 20273 t.afii57700 = 0xfb4b; 20274 t.afii57705 = 0xfb1f; 20275 t.afii57716 = 0x05f0; 20276 t.afii57717 = 0x05f1; 20277 t.afii57718 = 0x05f2; 20278 t.afii57723 = 0xfb35; 20279 t.afii57793 = 0x05b4; 20280 t.afii57794 = 0x05b5; 20281 t.afii57795 = 0x05b6; 20282 t.afii57796 = 0x05bb; 20283 t.afii57797 = 0x05b8; 20284 t.afii57798 = 0x05b7; 20285 t.afii57799 = 0x05b0; 20286 t.afii57800 = 0x05b2; 20287 t.afii57801 = 0x05b1; 20288 t.afii57802 = 0x05b3; 20289 t.afii57803 = 0x05c2; 20290 t.afii57804 = 0x05c1; 20291 t.afii57806 = 0x05b9; 20292 t.afii57807 = 0x05bc; 20293 t.afii57839 = 0x05bd; 20294 t.afii57841 = 0x05bf; 20295 t.afii57842 = 0x05c0; 20296 t.afii57929 = 0x02bc; 20297 t.afii61248 = 0x2105; 20298 t.afii61289 = 0x2113; 20299 t.afii61352 = 0x2116; 20300 t.afii61573 = 0x202c; 20301 t.afii61574 = 0x202d; 20302 t.afii61575 = 0x202e; 20303 t.afii61664 = 0x200c; 20304 t.afii63167 = 0x066d; 20305 t.afii64937 = 0x02bd; 20306 t.agrave = 0x00e0; 20307 t.agujarati = 0x0a85; 20308 t.agurmukhi = 0x0a05; 20309 t.ahiragana = 0x3042; 20310 t.ahookabove = 0x1ea3; 20311 t.aibengali = 0x0990; 20312 t.aibopomofo = 0x311e; 20313 t.aideva = 0x0910; 20314 t.aiecyrillic = 0x04d5; 20315 t.aigujarati = 0x0a90; 20316 t.aigurmukhi = 0x0a10; 20317 t.aimatragurmukhi = 0x0a48; 20318 t.ainarabic = 0x0639; 20319 t.ainfinalarabic = 0xfeca; 20320 t.aininitialarabic = 0xfecb; 20321 t.ainmedialarabic = 0xfecc; 20322 t.ainvertedbreve = 0x0203; 20323 t.aivowelsignbengali = 0x09c8; 20324 t.aivowelsigndeva = 0x0948; 20325 t.aivowelsigngujarati = 0x0ac8; 20326 t.akatakana = 0x30a2; 20327 t.akatakanahalfwidth = 0xff71; 20328 t.akorean = 0x314f; 20329 t.alef = 0x05d0; 20330 t.alefarabic = 0x0627; 20331 t.alefdageshhebrew = 0xfb30; 20332 t.aleffinalarabic = 0xfe8e; 20333 t.alefhamzaabovearabic = 0x0623; 20334 t.alefhamzaabovefinalarabic = 0xfe84; 20335 t.alefhamzabelowarabic = 0x0625; 20336 t.alefhamzabelowfinalarabic = 0xfe88; 20337 t.alefhebrew = 0x05d0; 20338 t.aleflamedhebrew = 0xfb4f; 20339 t.alefmaddaabovearabic = 0x0622; 20340 t.alefmaddaabovefinalarabic = 0xfe82; 20341 t.alefmaksuraarabic = 0x0649; 20342 t.alefmaksurafinalarabic = 0xfef0; 20343 t.alefmaksurainitialarabic = 0xfef3; 20344 t.alefmaksuramedialarabic = 0xfef4; 20345 t.alefpatahhebrew = 0xfb2e; 20346 t.alefqamatshebrew = 0xfb2f; 20347 t.aleph = 0x2135; 20348 t.allequal = 0x224c; 20349 t.alpha = 0x03b1; 20350 t.alphatonos = 0x03ac; 20351 t.amacron = 0x0101; 20352 t.amonospace = 0xff41; 20353 t.ampersand = 0x0026; 20354 t.ampersandmonospace = 0xff06; 20355 t.ampersandsmall = 0xf726; 20356 t.amsquare = 0x33c2; 20357 t.anbopomofo = 0x3122; 20358 t.angbopomofo = 0x3124; 20359 t.angbracketleft = 0x3008; 20360 t.angbracketright = 0x3009; 20361 t.angkhankhuthai = 0x0e5a; 20362 t.angle = 0x2220; 20363 t.anglebracketleft = 0x3008; 20364 t.anglebracketleftvertical = 0xfe3f; 20365 t.anglebracketright = 0x3009; 20366 t.anglebracketrightvertical = 0xfe40; 20367 t.angleleft = 0x2329; 20368 t.angleright = 0x232a; 20369 t.angstrom = 0x212b; 20370 t.anoteleia = 0x0387; 20371 t.anudattadeva = 0x0952; 20372 t.anusvarabengali = 0x0982; 20373 t.anusvaradeva = 0x0902; 20374 t.anusvaragujarati = 0x0a82; 20375 t.aogonek = 0x0105; 20376 t.apaatosquare = 0x3300; 20377 t.aparen = 0x249c; 20378 t.apostrophearmenian = 0x055a; 20379 t.apostrophemod = 0x02bc; 20380 t.apple = 0xf8ff; 20381 t.approaches = 0x2250; 20382 t.approxequal = 0x2248; 20383 t.approxequalorimage = 0x2252; 20384 t.approximatelyequal = 0x2245; 20385 t.araeaekorean = 0x318e; 20386 t.araeakorean = 0x318d; 20387 t.arc = 0x2312; 20388 t.arighthalfring = 0x1e9a; 20389 t.aring = 0x00e5; 20390 t.aringacute = 0x01fb; 20391 t.aringbelow = 0x1e01; 20392 t.arrowboth = 0x2194; 20393 t.arrowdashdown = 0x21e3; 20394 t.arrowdashleft = 0x21e0; 20395 t.arrowdashright = 0x21e2; 20396 t.arrowdashup = 0x21e1; 20397 t.arrowdblboth = 0x21d4; 20398 t.arrowdbldown = 0x21d3; 20399 t.arrowdblleft = 0x21d0; 20400 t.arrowdblright = 0x21d2; 20401 t.arrowdblup = 0x21d1; 20402 t.arrowdown = 0x2193; 20403 t.arrowdownleft = 0x2199; 20404 t.arrowdownright = 0x2198; 20405 t.arrowdownwhite = 0x21e9; 20406 t.arrowheaddownmod = 0x02c5; 20407 t.arrowheadleftmod = 0x02c2; 20408 t.arrowheadrightmod = 0x02c3; 20409 t.arrowheadupmod = 0x02c4; 20410 t.arrowhorizex = 0xf8e7; 20411 t.arrowleft = 0x2190; 20412 t.arrowleftdbl = 0x21d0; 20413 t.arrowleftdblstroke = 0x21cd; 20414 t.arrowleftoverright = 0x21c6; 20415 t.arrowleftwhite = 0x21e6; 20416 t.arrowright = 0x2192; 20417 t.arrowrightdblstroke = 0x21cf; 20418 t.arrowrightheavy = 0x279e; 20419 t.arrowrightoverleft = 0x21c4; 20420 t.arrowrightwhite = 0x21e8; 20421 t.arrowtableft = 0x21e4; 20422 t.arrowtabright = 0x21e5; 20423 t.arrowup = 0x2191; 20424 t.arrowupdn = 0x2195; 20425 t.arrowupdnbse = 0x21a8; 20426 t.arrowupdownbase = 0x21a8; 20427 t.arrowupleft = 0x2196; 20428 t.arrowupleftofdown = 0x21c5; 20429 t.arrowupright = 0x2197; 20430 t.arrowupwhite = 0x21e7; 20431 t.arrowvertex = 0xf8e6; 20432 t.asciicircum = 0x005e; 20433 t.asciicircummonospace = 0xff3e; 20434 t.asciitilde = 0x007e; 20435 t.asciitildemonospace = 0xff5e; 20436 t.ascript = 0x0251; 20437 t.ascriptturned = 0x0252; 20438 t.asmallhiragana = 0x3041; 20439 t.asmallkatakana = 0x30a1; 20440 t.asmallkatakanahalfwidth = 0xff67; 20441 t.asterisk = 0x002a; 20442 t.asteriskaltonearabic = 0x066d; 20443 t.asteriskarabic = 0x066d; 20444 t.asteriskmath = 0x2217; 20445 t.asteriskmonospace = 0xff0a; 20446 t.asterisksmall = 0xfe61; 20447 t.asterism = 0x2042; 20448 t.asuperior = 0xf6e9; 20449 t.asymptoticallyequal = 0x2243; 20450 t.at = 0x0040; 20451 t.atilde = 0x00e3; 20452 t.atmonospace = 0xff20; 20453 t.atsmall = 0xfe6b; 20454 t.aturned = 0x0250; 20455 t.aubengali = 0x0994; 20456 t.aubopomofo = 0x3120; 20457 t.audeva = 0x0914; 20458 t.augujarati = 0x0a94; 20459 t.augurmukhi = 0x0a14; 20460 t.aulengthmarkbengali = 0x09d7; 20461 t.aumatragurmukhi = 0x0a4c; 20462 t.auvowelsignbengali = 0x09cc; 20463 t.auvowelsigndeva = 0x094c; 20464 t.auvowelsigngujarati = 0x0acc; 20465 t.avagrahadeva = 0x093d; 20466 t.aybarmenian = 0x0561; 20467 t.ayin = 0x05e2; 20468 t.ayinaltonehebrew = 0xfb20; 20469 t.ayinhebrew = 0x05e2; 20470 t.b = 0x0062; 20471 t.babengali = 0x09ac; 20472 t.backslash = 0x005c; 20473 t.backslashmonospace = 0xff3c; 20474 t.badeva = 0x092c; 20475 t.bagujarati = 0x0aac; 20476 t.bagurmukhi = 0x0a2c; 20477 t.bahiragana = 0x3070; 20478 t.bahtthai = 0x0e3f; 20479 t.bakatakana = 0x30d0; 20480 t.bar = 0x007c; 20481 t.barmonospace = 0xff5c; 20482 t.bbopomofo = 0x3105; 20483 t.bcircle = 0x24d1; 20484 t.bdotaccent = 0x1e03; 20485 t.bdotbelow = 0x1e05; 20486 t.beamedsixteenthnotes = 0x266c; 20487 t.because = 0x2235; 20488 t.becyrillic = 0x0431; 20489 t.beharabic = 0x0628; 20490 t.behfinalarabic = 0xfe90; 20491 t.behinitialarabic = 0xfe91; 20492 t.behiragana = 0x3079; 20493 t.behmedialarabic = 0xfe92; 20494 t.behmeeminitialarabic = 0xfc9f; 20495 t.behmeemisolatedarabic = 0xfc08; 20496 t.behnoonfinalarabic = 0xfc6d; 20497 t.bekatakana = 0x30d9; 20498 t.benarmenian = 0x0562; 20499 t.bet = 0x05d1; 20500 t.beta = 0x03b2; 20501 t.betasymbolgreek = 0x03d0; 20502 t.betdagesh = 0xfb31; 20503 t.betdageshhebrew = 0xfb31; 20504 t.bethebrew = 0x05d1; 20505 t.betrafehebrew = 0xfb4c; 20506 t.bhabengali = 0x09ad; 20507 t.bhadeva = 0x092d; 20508 t.bhagujarati = 0x0aad; 20509 t.bhagurmukhi = 0x0a2d; 20510 t.bhook = 0x0253; 20511 t.bihiragana = 0x3073; 20512 t.bikatakana = 0x30d3; 20513 t.bilabialclick = 0x0298; 20514 t.bindigurmukhi = 0x0a02; 20515 t.birusquare = 0x3331; 20516 t.blackcircle = 0x25cf; 20517 t.blackdiamond = 0x25c6; 20518 t.blackdownpointingtriangle = 0x25bc; 20519 t.blackleftpointingpointer = 0x25c4; 20520 t.blackleftpointingtriangle = 0x25c0; 20521 t.blacklenticularbracketleft = 0x3010; 20522 t.blacklenticularbracketleftvertical = 0xfe3b; 20523 t.blacklenticularbracketright = 0x3011; 20524 t.blacklenticularbracketrightvertical = 0xfe3c; 20525 t.blacklowerlefttriangle = 0x25e3; 20526 t.blacklowerrighttriangle = 0x25e2; 20527 t.blackrectangle = 0x25ac; 20528 t.blackrightpointingpointer = 0x25ba; 20529 t.blackrightpointingtriangle = 0x25b6; 20530 t.blacksmallsquare = 0x25aa; 20531 t.blacksmilingface = 0x263b; 20532 t.blacksquare = 0x25a0; 20533 t.blackstar = 0x2605; 20534 t.blackupperlefttriangle = 0x25e4; 20535 t.blackupperrighttriangle = 0x25e5; 20536 t.blackuppointingsmalltriangle = 0x25b4; 20537 t.blackuppointingtriangle = 0x25b2; 20538 t.blank = 0x2423; 20539 t.blinebelow = 0x1e07; 20540 t.block = 0x2588; 20541 t.bmonospace = 0xff42; 20542 t.bobaimaithai = 0x0e1a; 20543 t.bohiragana = 0x307c; 20544 t.bokatakana = 0x30dc; 20545 t.bparen = 0x249d; 20546 t.bqsquare = 0x33c3; 20547 t.braceex = 0xf8f4; 20548 t.braceleft = 0x007b; 20549 t.braceleftbt = 0xf8f3; 20550 t.braceleftmid = 0xf8f2; 20551 t.braceleftmonospace = 0xff5b; 20552 t.braceleftsmall = 0xfe5b; 20553 t.bracelefttp = 0xf8f1; 20554 t.braceleftvertical = 0xfe37; 20555 t.braceright = 0x007d; 20556 t.bracerightbt = 0xf8fe; 20557 t.bracerightmid = 0xf8fd; 20558 t.bracerightmonospace = 0xff5d; 20559 t.bracerightsmall = 0xfe5c; 20560 t.bracerighttp = 0xf8fc; 20561 t.bracerightvertical = 0xfe38; 20562 t.bracketleft = 0x005b; 20563 t.bracketleftbt = 0xf8f0; 20564 t.bracketleftex = 0xf8ef; 20565 t.bracketleftmonospace = 0xff3b; 20566 t.bracketlefttp = 0xf8ee; 20567 t.bracketright = 0x005d; 20568 t.bracketrightbt = 0xf8fb; 20569 t.bracketrightex = 0xf8fa; 20570 t.bracketrightmonospace = 0xff3d; 20571 t.bracketrighttp = 0xf8f9; 20572 t.breve = 0x02d8; 20573 t.brevebelowcmb = 0x032e; 20574 t.brevecmb = 0x0306; 20575 t.breveinvertedbelowcmb = 0x032f; 20576 t.breveinvertedcmb = 0x0311; 20577 t.breveinverteddoublecmb = 0x0361; 20578 t.bridgebelowcmb = 0x032a; 20579 t.bridgeinvertedbelowcmb = 0x033a; 20580 t.brokenbar = 0x00a6; 20581 t.bstroke = 0x0180; 20582 t.bsuperior = 0xf6ea; 20583 t.btopbar = 0x0183; 20584 t.buhiragana = 0x3076; 20585 t.bukatakana = 0x30d6; 20586 t.bullet = 0x2022; 20587 t.bulletinverse = 0x25d8; 20588 t.bulletoperator = 0x2219; 20589 t.bullseye = 0x25ce; 20590 t.c = 0x0063; 20591 t.caarmenian = 0x056e; 20592 t.cabengali = 0x099a; 20593 t.cacute = 0x0107; 20594 t.cadeva = 0x091a; 20595 t.cagujarati = 0x0a9a; 20596 t.cagurmukhi = 0x0a1a; 20597 t.calsquare = 0x3388; 20598 t.candrabindubengali = 0x0981; 20599 t.candrabinducmb = 0x0310; 20600 t.candrabindudeva = 0x0901; 20601 t.candrabindugujarati = 0x0a81; 20602 t.capslock = 0x21ea; 20603 t.careof = 0x2105; 20604 t.caron = 0x02c7; 20605 t.caronbelowcmb = 0x032c; 20606 t.caroncmb = 0x030c; 20607 t.carriagereturn = 0x21b5; 20608 t.cbopomofo = 0x3118; 20609 t.ccaron = 0x010d; 20610 t.ccedilla = 0x00e7; 20611 t.ccedillaacute = 0x1e09; 20612 t.ccircle = 0x24d2; 20613 t.ccircumflex = 0x0109; 20614 t.ccurl = 0x0255; 20615 t.cdot = 0x010b; 20616 t.cdotaccent = 0x010b; 20617 t.cdsquare = 0x33c5; 20618 t.cedilla = 0x00b8; 20619 t.cedillacmb = 0x0327; 20620 t.cent = 0x00a2; 20621 t.centigrade = 0x2103; 20622 t.centinferior = 0xf6df; 20623 t.centmonospace = 0xffe0; 20624 t.centoldstyle = 0xf7a2; 20625 t.centsuperior = 0xf6e0; 20626 t.chaarmenian = 0x0579; 20627 t.chabengali = 0x099b; 20628 t.chadeva = 0x091b; 20629 t.chagujarati = 0x0a9b; 20630 t.chagurmukhi = 0x0a1b; 20631 t.chbopomofo = 0x3114; 20632 t.cheabkhasiancyrillic = 0x04bd; 20633 t.checkmark = 0x2713; 20634 t.checyrillic = 0x0447; 20635 t.chedescenderabkhasiancyrillic = 0x04bf; 20636 t.chedescendercyrillic = 0x04b7; 20637 t.chedieresiscyrillic = 0x04f5; 20638 t.cheharmenian = 0x0573; 20639 t.chekhakassiancyrillic = 0x04cc; 20640 t.cheverticalstrokecyrillic = 0x04b9; 20641 t.chi = 0x03c7; 20642 t.chieuchacirclekorean = 0x3277; 20643 t.chieuchaparenkorean = 0x3217; 20644 t.chieuchcirclekorean = 0x3269; 20645 t.chieuchkorean = 0x314a; 20646 t.chieuchparenkorean = 0x3209; 20647 t.chochangthai = 0x0e0a; 20648 t.chochanthai = 0x0e08; 20649 t.chochingthai = 0x0e09; 20650 t.chochoethai = 0x0e0c; 20651 t.chook = 0x0188; 20652 t.cieucacirclekorean = 0x3276; 20653 t.cieucaparenkorean = 0x3216; 20654 t.cieuccirclekorean = 0x3268; 20655 t.cieuckorean = 0x3148; 20656 t.cieucparenkorean = 0x3208; 20657 t.cieucuparenkorean = 0x321c; 20658 t.circle = 0x25cb; 20659 t.circlecopyrt = 0x00a9; 20660 t.circlemultiply = 0x2297; 20661 t.circleot = 0x2299; 20662 t.circleplus = 0x2295; 20663 t.circlepostalmark = 0x3036; 20664 t.circlewithlefthalfblack = 0x25d0; 20665 t.circlewithrighthalfblack = 0x25d1; 20666 t.circumflex = 0x02c6; 20667 t.circumflexbelowcmb = 0x032d; 20668 t.circumflexcmb = 0x0302; 20669 t.clear = 0x2327; 20670 t.clickalveolar = 0x01c2; 20671 t.clickdental = 0x01c0; 20672 t.clicklateral = 0x01c1; 20673 t.clickretroflex = 0x01c3; 20674 t.club = 0x2663; 20675 t.clubsuitblack = 0x2663; 20676 t.clubsuitwhite = 0x2667; 20677 t.cmcubedsquare = 0x33a4; 20678 t.cmonospace = 0xff43; 20679 t.cmsquaredsquare = 0x33a0; 20680 t.coarmenian = 0x0581; 20681 t.colon = 0x003a; 20682 t.colonmonetary = 0x20a1; 20683 t.colonmonospace = 0xff1a; 20684 t.colonsign = 0x20a1; 20685 t.colonsmall = 0xfe55; 20686 t.colontriangularhalfmod = 0x02d1; 20687 t.colontriangularmod = 0x02d0; 20688 t.comma = 0x002c; 20689 t.commaabovecmb = 0x0313; 20690 t.commaaboverightcmb = 0x0315; 20691 t.commaaccent = 0xf6c3; 20692 t.commaarabic = 0x060c; 20693 t.commaarmenian = 0x055d; 20694 t.commainferior = 0xf6e1; 20695 t.commamonospace = 0xff0c; 20696 t.commareversedabovecmb = 0x0314; 20697 t.commareversedmod = 0x02bd; 20698 t.commasmall = 0xfe50; 20699 t.commasuperior = 0xf6e2; 20700 t.commaturnedabovecmb = 0x0312; 20701 t.commaturnedmod = 0x02bb; 20702 t.compass = 0x263c; 20703 t.congruent = 0x2245; 20704 t.contourintegral = 0x222e; 20705 t.control = 0x2303; 20706 t.controlACK = 0x0006; 20707 t.controlBEL = 0x0007; 20708 t.controlBS = 0x0008; 20709 t.controlCAN = 0x0018; 20710 t.controlCR = 0x000d; 20711 t.controlDC1 = 0x0011; 20712 t.controlDC2 = 0x0012; 20713 t.controlDC3 = 0x0013; 20714 t.controlDC4 = 0x0014; 20715 t.controlDEL = 0x007f; 20716 t.controlDLE = 0x0010; 20717 t.controlEM = 0x0019; 20718 t.controlENQ = 0x0005; 20719 t.controlEOT = 0x0004; 20720 t.controlESC = 0x001b; 20721 t.controlETB = 0x0017; 20722 t.controlETX = 0x0003; 20723 t.controlFF = 0x000c; 20724 t.controlFS = 0x001c; 20725 t.controlGS = 0x001d; 20726 t.controlHT = 0x0009; 20727 t.controlLF = 0x000a; 20728 t.controlNAK = 0x0015; 20729 t.controlNULL = 0x0000; 20730 t.controlRS = 0x001e; 20731 t.controlSI = 0x000f; 20732 t.controlSO = 0x000e; 20733 t.controlSOT = 0x0002; 20734 t.controlSTX = 0x0001; 20735 t.controlSUB = 0x001a; 20736 t.controlSYN = 0x0016; 20737 t.controlUS = 0x001f; 20738 t.controlVT = 0x000b; 20739 t.copyright = 0x00a9; 20740 t.copyrightsans = 0xf8e9; 20741 t.copyrightserif = 0xf6d9; 20742 t.cornerbracketleft = 0x300c; 20743 t.cornerbracketlefthalfwidth = 0xff62; 20744 t.cornerbracketleftvertical = 0xfe41; 20745 t.cornerbracketright = 0x300d; 20746 t.cornerbracketrighthalfwidth = 0xff63; 20747 t.cornerbracketrightvertical = 0xfe42; 20748 t.corporationsquare = 0x337f; 20749 t.cosquare = 0x33c7; 20750 t.coverkgsquare = 0x33c6; 20751 t.cparen = 0x249e; 20752 t.cruzeiro = 0x20a2; 20753 t.cstretched = 0x0297; 20754 t.curlyand = 0x22cf; 20755 t.curlyor = 0x22ce; 20756 t.currency = 0x00a4; 20757 t.cyrBreve = 0xf6d1; 20758 t.cyrFlex = 0xf6d2; 20759 t.cyrbreve = 0xf6d4; 20760 t.cyrflex = 0xf6d5; 20761 t.d = 0x0064; 20762 t.daarmenian = 0x0564; 20763 t.dabengali = 0x09a6; 20764 t.dadarabic = 0x0636; 20765 t.dadeva = 0x0926; 20766 t.dadfinalarabic = 0xfebe; 20767 t.dadinitialarabic = 0xfebf; 20768 t.dadmedialarabic = 0xfec0; 20769 t.dagesh = 0x05bc; 20770 t.dageshhebrew = 0x05bc; 20771 t.dagger = 0x2020; 20772 t.daggerdbl = 0x2021; 20773 t.dagujarati = 0x0aa6; 20774 t.dagurmukhi = 0x0a26; 20775 t.dahiragana = 0x3060; 20776 t.dakatakana = 0x30c0; 20777 t.dalarabic = 0x062f; 20778 t.dalet = 0x05d3; 20779 t.daletdagesh = 0xfb33; 20780 t.daletdageshhebrew = 0xfb33; 20781 t.dalethebrew = 0x05d3; 20782 t.dalfinalarabic = 0xfeaa; 20783 t.dammaarabic = 0x064f; 20784 t.dammalowarabic = 0x064f; 20785 t.dammatanaltonearabic = 0x064c; 20786 t.dammatanarabic = 0x064c; 20787 t.danda = 0x0964; 20788 t.dargahebrew = 0x05a7; 20789 t.dargalefthebrew = 0x05a7; 20790 t.dasiapneumatacyrilliccmb = 0x0485; 20791 t.dblGrave = 0xf6d3; 20792 t.dblanglebracketleft = 0x300a; 20793 t.dblanglebracketleftvertical = 0xfe3d; 20794 t.dblanglebracketright = 0x300b; 20795 t.dblanglebracketrightvertical = 0xfe3e; 20796 t.dblarchinvertedbelowcmb = 0x032b; 20797 t.dblarrowleft = 0x21d4; 20798 t.dblarrowright = 0x21d2; 20799 t.dbldanda = 0x0965; 20800 t.dblgrave = 0xf6d6; 20801 t.dblgravecmb = 0x030f; 20802 t.dblintegral = 0x222c; 20803 t.dbllowline = 0x2017; 20804 t.dbllowlinecmb = 0x0333; 20805 t.dbloverlinecmb = 0x033f; 20806 t.dblprimemod = 0x02ba; 20807 t.dblverticalbar = 0x2016; 20808 t.dblverticallineabovecmb = 0x030e; 20809 t.dbopomofo = 0x3109; 20810 t.dbsquare = 0x33c8; 20811 t.dcaron = 0x010f; 20812 t.dcedilla = 0x1e11; 20813 t.dcircle = 0x24d3; 20814 t.dcircumflexbelow = 0x1e13; 20815 t.dcroat = 0x0111; 20816 t.ddabengali = 0x09a1; 20817 t.ddadeva = 0x0921; 20818 t.ddagujarati = 0x0aa1; 20819 t.ddagurmukhi = 0x0a21; 20820 t.ddalarabic = 0x0688; 20821 t.ddalfinalarabic = 0xfb89; 20822 t.dddhadeva = 0x095c; 20823 t.ddhabengali = 0x09a2; 20824 t.ddhadeva = 0x0922; 20825 t.ddhagujarati = 0x0aa2; 20826 t.ddhagurmukhi = 0x0a22; 20827 t.ddotaccent = 0x1e0b; 20828 t.ddotbelow = 0x1e0d; 20829 t.decimalseparatorarabic = 0x066b; 20830 t.decimalseparatorpersian = 0x066b; 20831 t.decyrillic = 0x0434; 20832 t.degree = 0x00b0; 20833 t.dehihebrew = 0x05ad; 20834 t.dehiragana = 0x3067; 20835 t.deicoptic = 0x03ef; 20836 t.dekatakana = 0x30c7; 20837 t.deleteleft = 0x232b; 20838 t.deleteright = 0x2326; 20839 t.delta = 0x03b4; 20840 t.deltaturned = 0x018d; 20841 t.denominatorminusonenumeratorbengali = 0x09f8; 20842 t.dezh = 0x02a4; 20843 t.dhabengali = 0x09a7; 20844 t.dhadeva = 0x0927; 20845 t.dhagujarati = 0x0aa7; 20846 t.dhagurmukhi = 0x0a27; 20847 t.dhook = 0x0257; 20848 t.dialytikatonos = 0x0385; 20849 t.dialytikatonoscmb = 0x0344; 20850 t.diamond = 0x2666; 20851 t.diamondsuitwhite = 0x2662; 20852 t.dieresis = 0x00a8; 20853 t.dieresisacute = 0xf6d7; 20854 t.dieresisbelowcmb = 0x0324; 20855 t.dieresiscmb = 0x0308; 20856 t.dieresisgrave = 0xf6d8; 20857 t.dieresistonos = 0x0385; 20858 t.dihiragana = 0x3062; 20859 t.dikatakana = 0x30c2; 20860 t.dittomark = 0x3003; 20861 t.divide = 0x00f7; 20862 t.divides = 0x2223; 20863 t.divisionslash = 0x2215; 20864 t.djecyrillic = 0x0452; 20865 t.dkshade = 0x2593; 20866 t.dlinebelow = 0x1e0f; 20867 t.dlsquare = 0x3397; 20868 t.dmacron = 0x0111; 20869 t.dmonospace = 0xff44; 20870 t.dnblock = 0x2584; 20871 t.dochadathai = 0x0e0e; 20872 t.dodekthai = 0x0e14; 20873 t.dohiragana = 0x3069; 20874 t.dokatakana = 0x30c9; 20875 t.dollar = 0x0024; 20876 t.dollarinferior = 0xf6e3; 20877 t.dollarmonospace = 0xff04; 20878 t.dollaroldstyle = 0xf724; 20879 t.dollarsmall = 0xfe69; 20880 t.dollarsuperior = 0xf6e4; 20881 t.dong = 0x20ab; 20882 t.dorusquare = 0x3326; 20883 t.dotaccent = 0x02d9; 20884 t.dotaccentcmb = 0x0307; 20885 t.dotbelowcmb = 0x0323; 20886 t.dotbelowcomb = 0x0323; 20887 t.dotkatakana = 0x30fb; 20888 t.dotlessi = 0x0131; 20889 t.dotlessj = 0xf6be; 20890 t.dotlessjstrokehook = 0x0284; 20891 t.dotmath = 0x22c5; 20892 t.dottedcircle = 0x25cc; 20893 t.doubleyodpatah = 0xfb1f; 20894 t.doubleyodpatahhebrew = 0xfb1f; 20895 t.downtackbelowcmb = 0x031e; 20896 t.downtackmod = 0x02d5; 20897 t.dparen = 0x249f; 20898 t.dsuperior = 0xf6eb; 20899 t.dtail = 0x0256; 20900 t.dtopbar = 0x018c; 20901 t.duhiragana = 0x3065; 20902 t.dukatakana = 0x30c5; 20903 t.dz = 0x01f3; 20904 t.dzaltone = 0x02a3; 20905 t.dzcaron = 0x01c6; 20906 t.dzcurl = 0x02a5; 20907 t.dzeabkhasiancyrillic = 0x04e1; 20908 t.dzecyrillic = 0x0455; 20909 t.dzhecyrillic = 0x045f; 20910 t.e = 0x0065; 20911 t.eacute = 0x00e9; 20912 t.earth = 0x2641; 20913 t.ebengali = 0x098f; 20914 t.ebopomofo = 0x311c; 20915 t.ebreve = 0x0115; 20916 t.ecandradeva = 0x090d; 20917 t.ecandragujarati = 0x0a8d; 20918 t.ecandravowelsigndeva = 0x0945; 20919 t.ecandravowelsigngujarati = 0x0ac5; 20920 t.ecaron = 0x011b; 20921 t.ecedillabreve = 0x1e1d; 20922 t.echarmenian = 0x0565; 20923 t.echyiwnarmenian = 0x0587; 20924 t.ecircle = 0x24d4; 20925 t.ecircumflex = 0x00ea; 20926 t.ecircumflexacute = 0x1ebf; 20927 t.ecircumflexbelow = 0x1e19; 20928 t.ecircumflexdotbelow = 0x1ec7; 20929 t.ecircumflexgrave = 0x1ec1; 20930 t.ecircumflexhookabove = 0x1ec3; 20931 t.ecircumflextilde = 0x1ec5; 20932 t.ecyrillic = 0x0454; 20933 t.edblgrave = 0x0205; 20934 t.edeva = 0x090f; 20935 t.edieresis = 0x00eb; 20936 t.edot = 0x0117; 20937 t.edotaccent = 0x0117; 20938 t.edotbelow = 0x1eb9; 20939 t.eegurmukhi = 0x0a0f; 20940 t.eematragurmukhi = 0x0a47; 20941 t.efcyrillic = 0x0444; 20942 t.egrave = 0x00e8; 20943 t.egujarati = 0x0a8f; 20944 t.eharmenian = 0x0567; 20945 t.ehbopomofo = 0x311d; 20946 t.ehiragana = 0x3048; 20947 t.ehookabove = 0x1ebb; 20948 t.eibopomofo = 0x311f; 20949 t.eight = 0x0038; 20950 t.eightarabic = 0x0668; 20951 t.eightbengali = 0x09ee; 20952 t.eightcircle = 0x2467; 20953 t.eightcircleinversesansserif = 0x2791; 20954 t.eightdeva = 0x096e; 20955 t.eighteencircle = 0x2471; 20956 t.eighteenparen = 0x2485; 20957 t.eighteenperiod = 0x2499; 20958 t.eightgujarati = 0x0aee; 20959 t.eightgurmukhi = 0x0a6e; 20960 t.eighthackarabic = 0x0668; 20961 t.eighthangzhou = 0x3028; 20962 t.eighthnotebeamed = 0x266b; 20963 t.eightideographicparen = 0x3227; 20964 t.eightinferior = 0x2088; 20965 t.eightmonospace = 0xff18; 20966 t.eightoldstyle = 0xf738; 20967 t.eightparen = 0x247b; 20968 t.eightperiod = 0x248f; 20969 t.eightpersian = 0x06f8; 20970 t.eightroman = 0x2177; 20971 t.eightsuperior = 0x2078; 20972 t.eightthai = 0x0e58; 20973 t.einvertedbreve = 0x0207; 20974 t.eiotifiedcyrillic = 0x0465; 20975 t.ekatakana = 0x30a8; 20976 t.ekatakanahalfwidth = 0xff74; 20977 t.ekonkargurmukhi = 0x0a74; 20978 t.ekorean = 0x3154; 20979 t.elcyrillic = 0x043b; 20980 t.element = 0x2208; 20981 t.elevencircle = 0x246a; 20982 t.elevenparen = 0x247e; 20983 t.elevenperiod = 0x2492; 20984 t.elevenroman = 0x217a; 20985 t.ellipsis = 0x2026; 20986 t.ellipsisvertical = 0x22ee; 20987 t.emacron = 0x0113; 20988 t.emacronacute = 0x1e17; 20989 t.emacrongrave = 0x1e15; 20990 t.emcyrillic = 0x043c; 20991 t.emdash = 0x2014; 20992 t.emdashvertical = 0xfe31; 20993 t.emonospace = 0xff45; 20994 t.emphasismarkarmenian = 0x055b; 20995 t.emptyset = 0x2205; 20996 t.enbopomofo = 0x3123; 20997 t.encyrillic = 0x043d; 20998 t.endash = 0x2013; 20999 t.endashvertical = 0xfe32; 21000 t.endescendercyrillic = 0x04a3; 21001 t.eng = 0x014b; 21002 t.engbopomofo = 0x3125; 21003 t.enghecyrillic = 0x04a5; 21004 t.enhookcyrillic = 0x04c8; 21005 t.enspace = 0x2002; 21006 t.eogonek = 0x0119; 21007 t.eokorean = 0x3153; 21008 t.eopen = 0x025b; 21009 t.eopenclosed = 0x029a; 21010 t.eopenreversed = 0x025c; 21011 t.eopenreversedclosed = 0x025e; 21012 t.eopenreversedhook = 0x025d; 21013 t.eparen = 0x24a0; 21014 t.epsilon = 0x03b5; 21015 t.epsilontonos = 0x03ad; 21016 t.equal = 0x003d; 21017 t.equalmonospace = 0xff1d; 21018 t.equalsmall = 0xfe66; 21019 t.equalsuperior = 0x207c; 21020 t.equivalence = 0x2261; 21021 t.erbopomofo = 0x3126; 21022 t.ercyrillic = 0x0440; 21023 t.ereversed = 0x0258; 21024 t.ereversedcyrillic = 0x044d; 21025 t.escyrillic = 0x0441; 21026 t.esdescendercyrillic = 0x04ab; 21027 t.esh = 0x0283; 21028 t.eshcurl = 0x0286; 21029 t.eshortdeva = 0x090e; 21030 t.eshortvowelsigndeva = 0x0946; 21031 t.eshreversedloop = 0x01aa; 21032 t.eshsquatreversed = 0x0285; 21033 t.esmallhiragana = 0x3047; 21034 t.esmallkatakana = 0x30a7; 21035 t.esmallkatakanahalfwidth = 0xff6a; 21036 t.estimated = 0x212e; 21037 t.esuperior = 0xf6ec; 21038 t.eta = 0x03b7; 21039 t.etarmenian = 0x0568; 21040 t.etatonos = 0x03ae; 21041 t.eth = 0x00f0; 21042 t.etilde = 0x1ebd; 21043 t.etildebelow = 0x1e1b; 21044 t.etnahtafoukhhebrew = 0x0591; 21045 t.etnahtafoukhlefthebrew = 0x0591; 21046 t.etnahtahebrew = 0x0591; 21047 t.etnahtalefthebrew = 0x0591; 21048 t.eturned = 0x01dd; 21049 t.eukorean = 0x3161; 21050 t.euro = 0x20ac; 21051 t.evowelsignbengali = 0x09c7; 21052 t.evowelsigndeva = 0x0947; 21053 t.evowelsigngujarati = 0x0ac7; 21054 t.exclam = 0x0021; 21055 t.exclamarmenian = 0x055c; 21056 t.exclamdbl = 0x203c; 21057 t.exclamdown = 0x00a1; 21058 t.exclamdownsmall = 0xf7a1; 21059 t.exclammonospace = 0xff01; 21060 t.exclamsmall = 0xf721; 21061 t.existential = 0x2203; 21062 t.ezh = 0x0292; 21063 t.ezhcaron = 0x01ef; 21064 t.ezhcurl = 0x0293; 21065 t.ezhreversed = 0x01b9; 21066 t.ezhtail = 0x01ba; 21067 t.f = 0x0066; 21068 t.fadeva = 0x095e; 21069 t.fagurmukhi = 0x0a5e; 21070 t.fahrenheit = 0x2109; 21071 t.fathaarabic = 0x064e; 21072 t.fathalowarabic = 0x064e; 21073 t.fathatanarabic = 0x064b; 21074 t.fbopomofo = 0x3108; 21075 t.fcircle = 0x24d5; 21076 t.fdotaccent = 0x1e1f; 21077 t.feharabic = 0x0641; 21078 t.feharmenian = 0x0586; 21079 t.fehfinalarabic = 0xfed2; 21080 t.fehinitialarabic = 0xfed3; 21081 t.fehmedialarabic = 0xfed4; 21082 t.feicoptic = 0x03e5; 21083 t.female = 0x2640; 21084 t.ff = 0xfb00; 21085 t.f_f = 0xfb00; 21086 t.ffi = 0xfb03; 21087 t.f_f_i = 0xfb03; 21088 t.ffl = 0xfb04; 21089 t.f_f_l = 0xfb04; 21090 t.fi = 0xfb01; 21091 t.f_i = 0xfb01; 21092 t.fifteencircle = 0x246e; 21093 t.fifteenparen = 0x2482; 21094 t.fifteenperiod = 0x2496; 21095 t.figuredash = 0x2012; 21096 t.filledbox = 0x25a0; 21097 t.filledrect = 0x25ac; 21098 t.finalkaf = 0x05da; 21099 t.finalkafdagesh = 0xfb3a; 21100 t.finalkafdageshhebrew = 0xfb3a; 21101 t.finalkafhebrew = 0x05da; 21102 t.finalmem = 0x05dd; 21103 t.finalmemhebrew = 0x05dd; 21104 t.finalnun = 0x05df; 21105 t.finalnunhebrew = 0x05df; 21106 t.finalpe = 0x05e3; 21107 t.finalpehebrew = 0x05e3; 21108 t.finaltsadi = 0x05e5; 21109 t.finaltsadihebrew = 0x05e5; 21110 t.firsttonechinese = 0x02c9; 21111 t.fisheye = 0x25c9; 21112 t.fitacyrillic = 0x0473; 21113 t.five = 0x0035; 21114 t.fivearabic = 0x0665; 21115 t.fivebengali = 0x09eb; 21116 t.fivecircle = 0x2464; 21117 t.fivecircleinversesansserif = 0x278e; 21118 t.fivedeva = 0x096b; 21119 t.fiveeighths = 0x215d; 21120 t.fivegujarati = 0x0aeb; 21121 t.fivegurmukhi = 0x0a6b; 21122 t.fivehackarabic = 0x0665; 21123 t.fivehangzhou = 0x3025; 21124 t.fiveideographicparen = 0x3224; 21125 t.fiveinferior = 0x2085; 21126 t.fivemonospace = 0xff15; 21127 t.fiveoldstyle = 0xf735; 21128 t.fiveparen = 0x2478; 21129 t.fiveperiod = 0x248c; 21130 t.fivepersian = 0x06f5; 21131 t.fiveroman = 0x2174; 21132 t.fivesuperior = 0x2075; 21133 t.fivethai = 0x0e55; 21134 t.fl = 0xfb02; 21135 t.f_l = 0xfb02; 21136 t.florin = 0x0192; 21137 t.fmonospace = 0xff46; 21138 t.fmsquare = 0x3399; 21139 t.fofanthai = 0x0e1f; 21140 t.fofathai = 0x0e1d; 21141 t.fongmanthai = 0x0e4f; 21142 t.forall = 0x2200; 21143 t.four = 0x0034; 21144 t.fourarabic = 0x0664; 21145 t.fourbengali = 0x09ea; 21146 t.fourcircle = 0x2463; 21147 t.fourcircleinversesansserif = 0x278d; 21148 t.fourdeva = 0x096a; 21149 t.fourgujarati = 0x0aea; 21150 t.fourgurmukhi = 0x0a6a; 21151 t.fourhackarabic = 0x0664; 21152 t.fourhangzhou = 0x3024; 21153 t.fourideographicparen = 0x3223; 21154 t.fourinferior = 0x2084; 21155 t.fourmonospace = 0xff14; 21156 t.fournumeratorbengali = 0x09f7; 21157 t.fouroldstyle = 0xf734; 21158 t.fourparen = 0x2477; 21159 t.fourperiod = 0x248b; 21160 t.fourpersian = 0x06f4; 21161 t.fourroman = 0x2173; 21162 t.foursuperior = 0x2074; 21163 t.fourteencircle = 0x246d; 21164 t.fourteenparen = 0x2481; 21165 t.fourteenperiod = 0x2495; 21166 t.fourthai = 0x0e54; 21167 t.fourthtonechinese = 0x02cb; 21168 t.fparen = 0x24a1; 21169 t.fraction = 0x2044; 21170 t.franc = 0x20a3; 21171 t.g = 0x0067; 21172 t.gabengali = 0x0997; 21173 t.gacute = 0x01f5; 21174 t.gadeva = 0x0917; 21175 t.gafarabic = 0x06af; 21176 t.gaffinalarabic = 0xfb93; 21177 t.gafinitialarabic = 0xfb94; 21178 t.gafmedialarabic = 0xfb95; 21179 t.gagujarati = 0x0a97; 21180 t.gagurmukhi = 0x0a17; 21181 t.gahiragana = 0x304c; 21182 t.gakatakana = 0x30ac; 21183 t.gamma = 0x03b3; 21184 t.gammalatinsmall = 0x0263; 21185 t.gammasuperior = 0x02e0; 21186 t.gangiacoptic = 0x03eb; 21187 t.gbopomofo = 0x310d; 21188 t.gbreve = 0x011f; 21189 t.gcaron = 0x01e7; 21190 t.gcedilla = 0x0123; 21191 t.gcircle = 0x24d6; 21192 t.gcircumflex = 0x011d; 21193 t.gcommaaccent = 0x0123; 21194 t.gdot = 0x0121; 21195 t.gdotaccent = 0x0121; 21196 t.gecyrillic = 0x0433; 21197 t.gehiragana = 0x3052; 21198 t.gekatakana = 0x30b2; 21199 t.geometricallyequal = 0x2251; 21200 t.gereshaccenthebrew = 0x059c; 21201 t.gereshhebrew = 0x05f3; 21202 t.gereshmuqdamhebrew = 0x059d; 21203 t.germandbls = 0x00df; 21204 t.gershayimaccenthebrew = 0x059e; 21205 t.gershayimhebrew = 0x05f4; 21206 t.getamark = 0x3013; 21207 t.ghabengali = 0x0998; 21208 t.ghadarmenian = 0x0572; 21209 t.ghadeva = 0x0918; 21210 t.ghagujarati = 0x0a98; 21211 t.ghagurmukhi = 0x0a18; 21212 t.ghainarabic = 0x063a; 21213 t.ghainfinalarabic = 0xfece; 21214 t.ghaininitialarabic = 0xfecf; 21215 t.ghainmedialarabic = 0xfed0; 21216 t.ghemiddlehookcyrillic = 0x0495; 21217 t.ghestrokecyrillic = 0x0493; 21218 t.gheupturncyrillic = 0x0491; 21219 t.ghhadeva = 0x095a; 21220 t.ghhagurmukhi = 0x0a5a; 21221 t.ghook = 0x0260; 21222 t.ghzsquare = 0x3393; 21223 t.gihiragana = 0x304e; 21224 t.gikatakana = 0x30ae; 21225 t.gimarmenian = 0x0563; 21226 t.gimel = 0x05d2; 21227 t.gimeldagesh = 0xfb32; 21228 t.gimeldageshhebrew = 0xfb32; 21229 t.gimelhebrew = 0x05d2; 21230 t.gjecyrillic = 0x0453; 21231 t.glottalinvertedstroke = 0x01be; 21232 t.glottalstop = 0x0294; 21233 t.glottalstopinverted = 0x0296; 21234 t.glottalstopmod = 0x02c0; 21235 t.glottalstopreversed = 0x0295; 21236 t.glottalstopreversedmod = 0x02c1; 21237 t.glottalstopreversedsuperior = 0x02e4; 21238 t.glottalstopstroke = 0x02a1; 21239 t.glottalstopstrokereversed = 0x02a2; 21240 t.gmacron = 0x1e21; 21241 t.gmonospace = 0xff47; 21242 t.gohiragana = 0x3054; 21243 t.gokatakana = 0x30b4; 21244 t.gparen = 0x24a2; 21245 t.gpasquare = 0x33ac; 21246 t.gradient = 0x2207; 21247 t.grave = 0x0060; 21248 t.gravebelowcmb = 0x0316; 21249 t.gravecmb = 0x0300; 21250 t.gravecomb = 0x0300; 21251 t.gravedeva = 0x0953; 21252 t.gravelowmod = 0x02ce; 21253 t.gravemonospace = 0xff40; 21254 t.gravetonecmb = 0x0340; 21255 t.greater = 0x003e; 21256 t.greaterequal = 0x2265; 21257 t.greaterequalorless = 0x22db; 21258 t.greatermonospace = 0xff1e; 21259 t.greaterorequivalent = 0x2273; 21260 t.greaterorless = 0x2277; 21261 t.greateroverequal = 0x2267; 21262 t.greatersmall = 0xfe65; 21263 t.gscript = 0x0261; 21264 t.gstroke = 0x01e5; 21265 t.guhiragana = 0x3050; 21266 t.guillemotleft = 0x00ab; 21267 t.guillemotright = 0x00bb; 21268 t.guilsinglleft = 0x2039; 21269 t.guilsinglright = 0x203a; 21270 t.gukatakana = 0x30b0; 21271 t.guramusquare = 0x3318; 21272 t.gysquare = 0x33c9; 21273 t.h = 0x0068; 21274 t.haabkhasiancyrillic = 0x04a9; 21275 t.haaltonearabic = 0x06c1; 21276 t.habengali = 0x09b9; 21277 t.hadescendercyrillic = 0x04b3; 21278 t.hadeva = 0x0939; 21279 t.hagujarati = 0x0ab9; 21280 t.hagurmukhi = 0x0a39; 21281 t.haharabic = 0x062d; 21282 t.hahfinalarabic = 0xfea2; 21283 t.hahinitialarabic = 0xfea3; 21284 t.hahiragana = 0x306f; 21285 t.hahmedialarabic = 0xfea4; 21286 t.haitusquare = 0x332a; 21287 t.hakatakana = 0x30cf; 21288 t.hakatakanahalfwidth = 0xff8a; 21289 t.halantgurmukhi = 0x0a4d; 21290 t.hamzaarabic = 0x0621; 21291 t.hamzalowarabic = 0x0621; 21292 t.hangulfiller = 0x3164; 21293 t.hardsigncyrillic = 0x044a; 21294 t.harpoonleftbarbup = 0x21bc; 21295 t.harpoonrightbarbup = 0x21c0; 21296 t.hasquare = 0x33ca; 21297 t.hatafpatah = 0x05b2; 21298 t.hatafpatah16 = 0x05b2; 21299 t.hatafpatah23 = 0x05b2; 21300 t.hatafpatah2f = 0x05b2; 21301 t.hatafpatahhebrew = 0x05b2; 21302 t.hatafpatahnarrowhebrew = 0x05b2; 21303 t.hatafpatahquarterhebrew = 0x05b2; 21304 t.hatafpatahwidehebrew = 0x05b2; 21305 t.hatafqamats = 0x05b3; 21306 t.hatafqamats1b = 0x05b3; 21307 t.hatafqamats28 = 0x05b3; 21308 t.hatafqamats34 = 0x05b3; 21309 t.hatafqamatshebrew = 0x05b3; 21310 t.hatafqamatsnarrowhebrew = 0x05b3; 21311 t.hatafqamatsquarterhebrew = 0x05b3; 21312 t.hatafqamatswidehebrew = 0x05b3; 21313 t.hatafsegol = 0x05b1; 21314 t.hatafsegol17 = 0x05b1; 21315 t.hatafsegol24 = 0x05b1; 21316 t.hatafsegol30 = 0x05b1; 21317 t.hatafsegolhebrew = 0x05b1; 21318 t.hatafsegolnarrowhebrew = 0x05b1; 21319 t.hatafsegolquarterhebrew = 0x05b1; 21320 t.hatafsegolwidehebrew = 0x05b1; 21321 t.hbar = 0x0127; 21322 t.hbopomofo = 0x310f; 21323 t.hbrevebelow = 0x1e2b; 21324 t.hcedilla = 0x1e29; 21325 t.hcircle = 0x24d7; 21326 t.hcircumflex = 0x0125; 21327 t.hdieresis = 0x1e27; 21328 t.hdotaccent = 0x1e23; 21329 t.hdotbelow = 0x1e25; 21330 t.he = 0x05d4; 21331 t.heart = 0x2665; 21332 t.heartsuitblack = 0x2665; 21333 t.heartsuitwhite = 0x2661; 21334 t.hedagesh = 0xfb34; 21335 t.hedageshhebrew = 0xfb34; 21336 t.hehaltonearabic = 0x06c1; 21337 t.heharabic = 0x0647; 21338 t.hehebrew = 0x05d4; 21339 t.hehfinalaltonearabic = 0xfba7; 21340 t.hehfinalalttwoarabic = 0xfeea; 21341 t.hehfinalarabic = 0xfeea; 21342 t.hehhamzaabovefinalarabic = 0xfba5; 21343 t.hehhamzaaboveisolatedarabic = 0xfba4; 21344 t.hehinitialaltonearabic = 0xfba8; 21345 t.hehinitialarabic = 0xfeeb; 21346 t.hehiragana = 0x3078; 21347 t.hehmedialaltonearabic = 0xfba9; 21348 t.hehmedialarabic = 0xfeec; 21349 t.heiseierasquare = 0x337b; 21350 t.hekatakana = 0x30d8; 21351 t.hekatakanahalfwidth = 0xff8d; 21352 t.hekutaarusquare = 0x3336; 21353 t.henghook = 0x0267; 21354 t.herutusquare = 0x3339; 21355 t.het = 0x05d7; 21356 t.hethebrew = 0x05d7; 21357 t.hhook = 0x0266; 21358 t.hhooksuperior = 0x02b1; 21359 t.hieuhacirclekorean = 0x327b; 21360 t.hieuhaparenkorean = 0x321b; 21361 t.hieuhcirclekorean = 0x326d; 21362 t.hieuhkorean = 0x314e; 21363 t.hieuhparenkorean = 0x320d; 21364 t.hihiragana = 0x3072; 21365 t.hikatakana = 0x30d2; 21366 t.hikatakanahalfwidth = 0xff8b; 21367 t.hiriq = 0x05b4; 21368 t.hiriq14 = 0x05b4; 21369 t.hiriq21 = 0x05b4; 21370 t.hiriq2d = 0x05b4; 21371 t.hiriqhebrew = 0x05b4; 21372 t.hiriqnarrowhebrew = 0x05b4; 21373 t.hiriqquarterhebrew = 0x05b4; 21374 t.hiriqwidehebrew = 0x05b4; 21375 t.hlinebelow = 0x1e96; 21376 t.hmonospace = 0xff48; 21377 t.hoarmenian = 0x0570; 21378 t.hohipthai = 0x0e2b; 21379 t.hohiragana = 0x307b; 21380 t.hokatakana = 0x30db; 21381 t.hokatakanahalfwidth = 0xff8e; 21382 t.holam = 0x05b9; 21383 t.holam19 = 0x05b9; 21384 t.holam26 = 0x05b9; 21385 t.holam32 = 0x05b9; 21386 t.holamhebrew = 0x05b9; 21387 t.holamnarrowhebrew = 0x05b9; 21388 t.holamquarterhebrew = 0x05b9; 21389 t.holamwidehebrew = 0x05b9; 21390 t.honokhukthai = 0x0e2e; 21391 t.hookabovecomb = 0x0309; 21392 t.hookcmb = 0x0309; 21393 t.hookpalatalizedbelowcmb = 0x0321; 21394 t.hookretroflexbelowcmb = 0x0322; 21395 t.hoonsquare = 0x3342; 21396 t.horicoptic = 0x03e9; 21397 t.horizontalbar = 0x2015; 21398 t.horncmb = 0x031b; 21399 t.hotsprings = 0x2668; 21400 t.house = 0x2302; 21401 t.hparen = 0x24a3; 21402 t.hsuperior = 0x02b0; 21403 t.hturned = 0x0265; 21404 t.huhiragana = 0x3075; 21405 t.huiitosquare = 0x3333; 21406 t.hukatakana = 0x30d5; 21407 t.hukatakanahalfwidth = 0xff8c; 21408 t.hungarumlaut = 0x02dd; 21409 t.hungarumlautcmb = 0x030b; 21410 t.hv = 0x0195; 21411 t.hyphen = 0x002d; 21412 t.hypheninferior = 0xf6e5; 21413 t.hyphenmonospace = 0xff0d; 21414 t.hyphensmall = 0xfe63; 21415 t.hyphensuperior = 0xf6e6; 21416 t.hyphentwo = 0x2010; 21417 t.i = 0x0069; 21418 t.iacute = 0x00ed; 21419 t.iacyrillic = 0x044f; 21420 t.ibengali = 0x0987; 21421 t.ibopomofo = 0x3127; 21422 t.ibreve = 0x012d; 21423 t.icaron = 0x01d0; 21424 t.icircle = 0x24d8; 21425 t.icircumflex = 0x00ee; 21426 t.icyrillic = 0x0456; 21427 t.idblgrave = 0x0209; 21428 t.ideographearthcircle = 0x328f; 21429 t.ideographfirecircle = 0x328b; 21430 t.ideographicallianceparen = 0x323f; 21431 t.ideographiccallparen = 0x323a; 21432 t.ideographiccentrecircle = 0x32a5; 21433 t.ideographicclose = 0x3006; 21434 t.ideographiccomma = 0x3001; 21435 t.ideographiccommaleft = 0xff64; 21436 t.ideographiccongratulationparen = 0x3237; 21437 t.ideographiccorrectcircle = 0x32a3; 21438 t.ideographicearthparen = 0x322f; 21439 t.ideographicenterpriseparen = 0x323d; 21440 t.ideographicexcellentcircle = 0x329d; 21441 t.ideographicfestivalparen = 0x3240; 21442 t.ideographicfinancialcircle = 0x3296; 21443 t.ideographicfinancialparen = 0x3236; 21444 t.ideographicfireparen = 0x322b; 21445 t.ideographichaveparen = 0x3232; 21446 t.ideographichighcircle = 0x32a4; 21447 t.ideographiciterationmark = 0x3005; 21448 t.ideographiclaborcircle = 0x3298; 21449 t.ideographiclaborparen = 0x3238; 21450 t.ideographicleftcircle = 0x32a7; 21451 t.ideographiclowcircle = 0x32a6; 21452 t.ideographicmedicinecircle = 0x32a9; 21453 t.ideographicmetalparen = 0x322e; 21454 t.ideographicmoonparen = 0x322a; 21455 t.ideographicnameparen = 0x3234; 21456 t.ideographicperiod = 0x3002; 21457 t.ideographicprintcircle = 0x329e; 21458 t.ideographicreachparen = 0x3243; 21459 t.ideographicrepresentparen = 0x3239; 21460 t.ideographicresourceparen = 0x323e; 21461 t.ideographicrightcircle = 0x32a8; 21462 t.ideographicsecretcircle = 0x3299; 21463 t.ideographicselfparen = 0x3242; 21464 t.ideographicsocietyparen = 0x3233; 21465 t.ideographicspace = 0x3000; 21466 t.ideographicspecialparen = 0x3235; 21467 t.ideographicstockparen = 0x3231; 21468 t.ideographicstudyparen = 0x323b; 21469 t.ideographicsunparen = 0x3230; 21470 t.ideographicsuperviseparen = 0x323c; 21471 t.ideographicwaterparen = 0x322c; 21472 t.ideographicwoodparen = 0x322d; 21473 t.ideographiczero = 0x3007; 21474 t.ideographmetalcircle = 0x328e; 21475 t.ideographmooncircle = 0x328a; 21476 t.ideographnamecircle = 0x3294; 21477 t.ideographsuncircle = 0x3290; 21478 t.ideographwatercircle = 0x328c; 21479 t.ideographwoodcircle = 0x328d; 21480 t.ideva = 0x0907; 21481 t.idieresis = 0x00ef; 21482 t.idieresisacute = 0x1e2f; 21483 t.idieresiscyrillic = 0x04e5; 21484 t.idotbelow = 0x1ecb; 21485 t.iebrevecyrillic = 0x04d7; 21486 t.iecyrillic = 0x0435; 21487 t.ieungacirclekorean = 0x3275; 21488 t.ieungaparenkorean = 0x3215; 21489 t.ieungcirclekorean = 0x3267; 21490 t.ieungkorean = 0x3147; 21491 t.ieungparenkorean = 0x3207; 21492 t.igrave = 0x00ec; 21493 t.igujarati = 0x0a87; 21494 t.igurmukhi = 0x0a07; 21495 t.ihiragana = 0x3044; 21496 t.ihookabove = 0x1ec9; 21497 t.iibengali = 0x0988; 21498 t.iicyrillic = 0x0438; 21499 t.iideva = 0x0908; 21500 t.iigujarati = 0x0a88; 21501 t.iigurmukhi = 0x0a08; 21502 t.iimatragurmukhi = 0x0a40; 21503 t.iinvertedbreve = 0x020b; 21504 t.iishortcyrillic = 0x0439; 21505 t.iivowelsignbengali = 0x09c0; 21506 t.iivowelsigndeva = 0x0940; 21507 t.iivowelsigngujarati = 0x0ac0; 21508 t.ij = 0x0133; 21509 t.ikatakana = 0x30a4; 21510 t.ikatakanahalfwidth = 0xff72; 21511 t.ikorean = 0x3163; 21512 t.ilde = 0x02dc; 21513 t.iluyhebrew = 0x05ac; 21514 t.imacron = 0x012b; 21515 t.imacroncyrillic = 0x04e3; 21516 t.imageorapproximatelyequal = 0x2253; 21517 t.imatragurmukhi = 0x0a3f; 21518 t.imonospace = 0xff49; 21519 t.increment = 0x2206; 21520 t.infinity = 0x221e; 21521 t.iniarmenian = 0x056b; 21522 t.integral = 0x222b; 21523 t.integralbottom = 0x2321; 21524 t.integralbt = 0x2321; 21525 t.integralex = 0xf8f5; 21526 t.integraltop = 0x2320; 21527 t.integraltp = 0x2320; 21528 t.intersection = 0x2229; 21529 t.intisquare = 0x3305; 21530 t.invbullet = 0x25d8; 21531 t.invcircle = 0x25d9; 21532 t.invsmileface = 0x263b; 21533 t.iocyrillic = 0x0451; 21534 t.iogonek = 0x012f; 21535 t.iota = 0x03b9; 21536 t.iotadieresis = 0x03ca; 21537 t.iotadieresistonos = 0x0390; 21538 t.iotalatin = 0x0269; 21539 t.iotatonos = 0x03af; 21540 t.iparen = 0x24a4; 21541 t.irigurmukhi = 0x0a72; 21542 t.ismallhiragana = 0x3043; 21543 t.ismallkatakana = 0x30a3; 21544 t.ismallkatakanahalfwidth = 0xff68; 21545 t.issharbengali = 0x09fa; 21546 t.istroke = 0x0268; 21547 t.isuperior = 0xf6ed; 21548 t.iterationhiragana = 0x309d; 21549 t.iterationkatakana = 0x30fd; 21550 t.itilde = 0x0129; 21551 t.itildebelow = 0x1e2d; 21552 t.iubopomofo = 0x3129; 21553 t.iucyrillic = 0x044e; 21554 t.ivowelsignbengali = 0x09bf; 21555 t.ivowelsigndeva = 0x093f; 21556 t.ivowelsigngujarati = 0x0abf; 21557 t.izhitsacyrillic = 0x0475; 21558 t.izhitsadblgravecyrillic = 0x0477; 21559 t.j = 0x006a; 21560 t.jaarmenian = 0x0571; 21561 t.jabengali = 0x099c; 21562 t.jadeva = 0x091c; 21563 t.jagujarati = 0x0a9c; 21564 t.jagurmukhi = 0x0a1c; 21565 t.jbopomofo = 0x3110; 21566 t.jcaron = 0x01f0; 21567 t.jcircle = 0x24d9; 21568 t.jcircumflex = 0x0135; 21569 t.jcrossedtail = 0x029d; 21570 t.jdotlessstroke = 0x025f; 21571 t.jecyrillic = 0x0458; 21572 t.jeemarabic = 0x062c; 21573 t.jeemfinalarabic = 0xfe9e; 21574 t.jeeminitialarabic = 0xfe9f; 21575 t.jeemmedialarabic = 0xfea0; 21576 t.jeharabic = 0x0698; 21577 t.jehfinalarabic = 0xfb8b; 21578 t.jhabengali = 0x099d; 21579 t.jhadeva = 0x091d; 21580 t.jhagujarati = 0x0a9d; 21581 t.jhagurmukhi = 0x0a1d; 21582 t.jheharmenian = 0x057b; 21583 t.jis = 0x3004; 21584 t.jmonospace = 0xff4a; 21585 t.jparen = 0x24a5; 21586 t.jsuperior = 0x02b2; 21587 t.k = 0x006b; 21588 t.kabashkircyrillic = 0x04a1; 21589 t.kabengali = 0x0995; 21590 t.kacute = 0x1e31; 21591 t.kacyrillic = 0x043a; 21592 t.kadescendercyrillic = 0x049b; 21593 t.kadeva = 0x0915; 21594 t.kaf = 0x05db; 21595 t.kafarabic = 0x0643; 21596 t.kafdagesh = 0xfb3b; 21597 t.kafdageshhebrew = 0xfb3b; 21598 t.kaffinalarabic = 0xfeda; 21599 t.kafhebrew = 0x05db; 21600 t.kafinitialarabic = 0xfedb; 21601 t.kafmedialarabic = 0xfedc; 21602 t.kafrafehebrew = 0xfb4d; 21603 t.kagujarati = 0x0a95; 21604 t.kagurmukhi = 0x0a15; 21605 t.kahiragana = 0x304b; 21606 t.kahookcyrillic = 0x04c4; 21607 t.kakatakana = 0x30ab; 21608 t.kakatakanahalfwidth = 0xff76; 21609 t.kappa = 0x03ba; 21610 t.kappasymbolgreek = 0x03f0; 21611 t.kapyeounmieumkorean = 0x3171; 21612 t.kapyeounphieuphkorean = 0x3184; 21613 t.kapyeounpieupkorean = 0x3178; 21614 t.kapyeounssangpieupkorean = 0x3179; 21615 t.karoriisquare = 0x330d; 21616 t.kashidaautoarabic = 0x0640; 21617 t.kashidaautonosidebearingarabic = 0x0640; 21618 t.kasmallkatakana = 0x30f5; 21619 t.kasquare = 0x3384; 21620 t.kasraarabic = 0x0650; 21621 t.kasratanarabic = 0x064d; 21622 t.kastrokecyrillic = 0x049f; 21623 t.katahiraprolongmarkhalfwidth = 0xff70; 21624 t.kaverticalstrokecyrillic = 0x049d; 21625 t.kbopomofo = 0x310e; 21626 t.kcalsquare = 0x3389; 21627 t.kcaron = 0x01e9; 21628 t.kcedilla = 0x0137; 21629 t.kcircle = 0x24da; 21630 t.kcommaaccent = 0x0137; 21631 t.kdotbelow = 0x1e33; 21632 t.keharmenian = 0x0584; 21633 t.kehiragana = 0x3051; 21634 t.kekatakana = 0x30b1; 21635 t.kekatakanahalfwidth = 0xff79; 21636 t.kenarmenian = 0x056f; 21637 t.kesmallkatakana = 0x30f6; 21638 t.kgreenlandic = 0x0138; 21639 t.khabengali = 0x0996; 21640 t.khacyrillic = 0x0445; 21641 t.khadeva = 0x0916; 21642 t.khagujarati = 0x0a96; 21643 t.khagurmukhi = 0x0a16; 21644 t.khaharabic = 0x062e; 21645 t.khahfinalarabic = 0xfea6; 21646 t.khahinitialarabic = 0xfea7; 21647 t.khahmedialarabic = 0xfea8; 21648 t.kheicoptic = 0x03e7; 21649 t.khhadeva = 0x0959; 21650 t.khhagurmukhi = 0x0a59; 21651 t.khieukhacirclekorean = 0x3278; 21652 t.khieukhaparenkorean = 0x3218; 21653 t.khieukhcirclekorean = 0x326a; 21654 t.khieukhkorean = 0x314b; 21655 t.khieukhparenkorean = 0x320a; 21656 t.khokhaithai = 0x0e02; 21657 t.khokhonthai = 0x0e05; 21658 t.khokhuatthai = 0x0e03; 21659 t.khokhwaithai = 0x0e04; 21660 t.khomutthai = 0x0e5b; 21661 t.khook = 0x0199; 21662 t.khorakhangthai = 0x0e06; 21663 t.khzsquare = 0x3391; 21664 t.kihiragana = 0x304d; 21665 t.kikatakana = 0x30ad; 21666 t.kikatakanahalfwidth = 0xff77; 21667 t.kiroguramusquare = 0x3315; 21668 t.kiromeetorusquare = 0x3316; 21669 t.kirosquare = 0x3314; 21670 t.kiyeokacirclekorean = 0x326e; 21671 t.kiyeokaparenkorean = 0x320e; 21672 t.kiyeokcirclekorean = 0x3260; 21673 t.kiyeokkorean = 0x3131; 21674 t.kiyeokparenkorean = 0x3200; 21675 t.kiyeoksioskorean = 0x3133; 21676 t.kjecyrillic = 0x045c; 21677 t.klinebelow = 0x1e35; 21678 t.klsquare = 0x3398; 21679 t.kmcubedsquare = 0x33a6; 21680 t.kmonospace = 0xff4b; 21681 t.kmsquaredsquare = 0x33a2; 21682 t.kohiragana = 0x3053; 21683 t.kohmsquare = 0x33c0; 21684 t.kokaithai = 0x0e01; 21685 t.kokatakana = 0x30b3; 21686 t.kokatakanahalfwidth = 0xff7a; 21687 t.kooposquare = 0x331e; 21688 t.koppacyrillic = 0x0481; 21689 t.koreanstandardsymbol = 0x327f; 21690 t.koroniscmb = 0x0343; 21691 t.kparen = 0x24a6; 21692 t.kpasquare = 0x33aa; 21693 t.ksicyrillic = 0x046f; 21694 t.ktsquare = 0x33cf; 21695 t.kturned = 0x029e; 21696 t.kuhiragana = 0x304f; 21697 t.kukatakana = 0x30af; 21698 t.kukatakanahalfwidth = 0xff78; 21699 t.kvsquare = 0x33b8; 21700 t.kwsquare = 0x33be; 21701 t.l = 0x006c; 21702 t.labengali = 0x09b2; 21703 t.lacute = 0x013a; 21704 t.ladeva = 0x0932; 21705 t.lagujarati = 0x0ab2; 21706 t.lagurmukhi = 0x0a32; 21707 t.lakkhangyaothai = 0x0e45; 21708 t.lamaleffinalarabic = 0xfefc; 21709 t.lamalefhamzaabovefinalarabic = 0xfef8; 21710 t.lamalefhamzaaboveisolatedarabic = 0xfef7; 21711 t.lamalefhamzabelowfinalarabic = 0xfefa; 21712 t.lamalefhamzabelowisolatedarabic = 0xfef9; 21713 t.lamalefisolatedarabic = 0xfefb; 21714 t.lamalefmaddaabovefinalarabic = 0xfef6; 21715 t.lamalefmaddaaboveisolatedarabic = 0xfef5; 21716 t.lamarabic = 0x0644; 21717 t.lambda = 0x03bb; 21718 t.lambdastroke = 0x019b; 21719 t.lamed = 0x05dc; 21720 t.lameddagesh = 0xfb3c; 21721 t.lameddageshhebrew = 0xfb3c; 21722 t.lamedhebrew = 0x05dc; 21723 t.lamfinalarabic = 0xfede; 21724 t.lamhahinitialarabic = 0xfcca; 21725 t.laminitialarabic = 0xfedf; 21726 t.lamjeeminitialarabic = 0xfcc9; 21727 t.lamkhahinitialarabic = 0xfccb; 21728 t.lamlamhehisolatedarabic = 0xfdf2; 21729 t.lammedialarabic = 0xfee0; 21730 t.lammeemhahinitialarabic = 0xfd88; 21731 t.lammeeminitialarabic = 0xfccc; 21732 t.largecircle = 0x25ef; 21733 t.lbar = 0x019a; 21734 t.lbelt = 0x026c; 21735 t.lbopomofo = 0x310c; 21736 t.lcaron = 0x013e; 21737 t.lcedilla = 0x013c; 21738 t.lcircle = 0x24db; 21739 t.lcircumflexbelow = 0x1e3d; 21740 t.lcommaaccent = 0x013c; 21741 t.ldot = 0x0140; 21742 t.ldotaccent = 0x0140; 21743 t.ldotbelow = 0x1e37; 21744 t.ldotbelowmacron = 0x1e39; 21745 t.leftangleabovecmb = 0x031a; 21746 t.lefttackbelowcmb = 0x0318; 21747 t.less = 0x003c; 21748 t.lessequal = 0x2264; 21749 t.lessequalorgreater = 0x22da; 21750 t.lessmonospace = 0xff1c; 21751 t.lessorequivalent = 0x2272; 21752 t.lessorgreater = 0x2276; 21753 t.lessoverequal = 0x2266; 21754 t.lesssmall = 0xfe64; 21755 t.lezh = 0x026e; 21756 t.lfblock = 0x258c; 21757 t.lhookretroflex = 0x026d; 21758 t.lira = 0x20a4; 21759 t.liwnarmenian = 0x056c; 21760 t.lj = 0x01c9; 21761 t.ljecyrillic = 0x0459; 21762 t.ll = 0xf6c0; 21763 t.lladeva = 0x0933; 21764 t.llagujarati = 0x0ab3; 21765 t.llinebelow = 0x1e3b; 21766 t.llladeva = 0x0934; 21767 t.llvocalicbengali = 0x09e1; 21768 t.llvocalicdeva = 0x0961; 21769 t.llvocalicvowelsignbengali = 0x09e3; 21770 t.llvocalicvowelsigndeva = 0x0963; 21771 t.lmiddletilde = 0x026b; 21772 t.lmonospace = 0xff4c; 21773 t.lmsquare = 0x33d0; 21774 t.lochulathai = 0x0e2c; 21775 t.logicaland = 0x2227; 21776 t.logicalnot = 0x00ac; 21777 t.logicalnotreversed = 0x2310; 21778 t.logicalor = 0x2228; 21779 t.lolingthai = 0x0e25; 21780 t.longs = 0x017f; 21781 t.lowlinecenterline = 0xfe4e; 21782 t.lowlinecmb = 0x0332; 21783 t.lowlinedashed = 0xfe4d; 21784 t.lozenge = 0x25ca; 21785 t.lparen = 0x24a7; 21786 t.lslash = 0x0142; 21787 t.lsquare = 0x2113; 21788 t.lsuperior = 0xf6ee; 21789 t.ltshade = 0x2591; 21790 t.luthai = 0x0e26; 21791 t.lvocalicbengali = 0x098c; 21792 t.lvocalicdeva = 0x090c; 21793 t.lvocalicvowelsignbengali = 0x09e2; 21794 t.lvocalicvowelsigndeva = 0x0962; 21795 t.lxsquare = 0x33d3; 21796 t.m = 0x006d; 21797 t.mabengali = 0x09ae; 21798 t.macron = 0x00af; 21799 t.macronbelowcmb = 0x0331; 21800 t.macroncmb = 0x0304; 21801 t.macronlowmod = 0x02cd; 21802 t.macronmonospace = 0xffe3; 21803 t.macute = 0x1e3f; 21804 t.madeva = 0x092e; 21805 t.magujarati = 0x0aae; 21806 t.magurmukhi = 0x0a2e; 21807 t.mahapakhhebrew = 0x05a4; 21808 t.mahapakhlefthebrew = 0x05a4; 21809 t.mahiragana = 0x307e; 21810 t.maichattawalowleftthai = 0xf895; 21811 t.maichattawalowrightthai = 0xf894; 21812 t.maichattawathai = 0x0e4b; 21813 t.maichattawaupperleftthai = 0xf893; 21814 t.maieklowleftthai = 0xf88c; 21815 t.maieklowrightthai = 0xf88b; 21816 t.maiekthai = 0x0e48; 21817 t.maiekupperleftthai = 0xf88a; 21818 t.maihanakatleftthai = 0xf884; 21819 t.maihanakatthai = 0x0e31; 21820 t.maitaikhuleftthai = 0xf889; 21821 t.maitaikhuthai = 0x0e47; 21822 t.maitholowleftthai = 0xf88f; 21823 t.maitholowrightthai = 0xf88e; 21824 t.maithothai = 0x0e49; 21825 t.maithoupperleftthai = 0xf88d; 21826 t.maitrilowleftthai = 0xf892; 21827 t.maitrilowrightthai = 0xf891; 21828 t.maitrithai = 0x0e4a; 21829 t.maitriupperleftthai = 0xf890; 21830 t.maiyamokthai = 0x0e46; 21831 t.makatakana = 0x30de; 21832 t.makatakanahalfwidth = 0xff8f; 21833 t.male = 0x2642; 21834 t.mansyonsquare = 0x3347; 21835 t.maqafhebrew = 0x05be; 21836 t.mars = 0x2642; 21837 t.masoracirclehebrew = 0x05af; 21838 t.masquare = 0x3383; 21839 t.mbopomofo = 0x3107; 21840 t.mbsquare = 0x33d4; 21841 t.mcircle = 0x24dc; 21842 t.mcubedsquare = 0x33a5; 21843 t.mdotaccent = 0x1e41; 21844 t.mdotbelow = 0x1e43; 21845 t.meemarabic = 0x0645; 21846 t.meemfinalarabic = 0xfee2; 21847 t.meeminitialarabic = 0xfee3; 21848 t.meemmedialarabic = 0xfee4; 21849 t.meemmeeminitialarabic = 0xfcd1; 21850 t.meemmeemisolatedarabic = 0xfc48; 21851 t.meetorusquare = 0x334d; 21852 t.mehiragana = 0x3081; 21853 t.meizierasquare = 0x337e; 21854 t.mekatakana = 0x30e1; 21855 t.mekatakanahalfwidth = 0xff92; 21856 t.mem = 0x05de; 21857 t.memdagesh = 0xfb3e; 21858 t.memdageshhebrew = 0xfb3e; 21859 t.memhebrew = 0x05de; 21860 t.menarmenian = 0x0574; 21861 t.merkhahebrew = 0x05a5; 21862 t.merkhakefulahebrew = 0x05a6; 21863 t.merkhakefulalefthebrew = 0x05a6; 21864 t.merkhalefthebrew = 0x05a5; 21865 t.mhook = 0x0271; 21866 t.mhzsquare = 0x3392; 21867 t.middledotkatakanahalfwidth = 0xff65; 21868 t.middot = 0x00b7; 21869 t.mieumacirclekorean = 0x3272; 21870 t.mieumaparenkorean = 0x3212; 21871 t.mieumcirclekorean = 0x3264; 21872 t.mieumkorean = 0x3141; 21873 t.mieumpansioskorean = 0x3170; 21874 t.mieumparenkorean = 0x3204; 21875 t.mieumpieupkorean = 0x316e; 21876 t.mieumsioskorean = 0x316f; 21877 t.mihiragana = 0x307f; 21878 t.mikatakana = 0x30df; 21879 t.mikatakanahalfwidth = 0xff90; 21880 t.minus = 0x2212; 21881 t.minusbelowcmb = 0x0320; 21882 t.minuscircle = 0x2296; 21883 t.minusmod = 0x02d7; 21884 t.minusplus = 0x2213; 21885 t.minute = 0x2032; 21886 t.miribaarusquare = 0x334a; 21887 t.mirisquare = 0x3349; 21888 t.mlonglegturned = 0x0270; 21889 t.mlsquare = 0x3396; 21890 t.mmcubedsquare = 0x33a3; 21891 t.mmonospace = 0xff4d; 21892 t.mmsquaredsquare = 0x339f; 21893 t.mohiragana = 0x3082; 21894 t.mohmsquare = 0x33c1; 21895 t.mokatakana = 0x30e2; 21896 t.mokatakanahalfwidth = 0xff93; 21897 t.molsquare = 0x33d6; 21898 t.momathai = 0x0e21; 21899 t.moverssquare = 0x33a7; 21900 t.moverssquaredsquare = 0x33a8; 21901 t.mparen = 0x24a8; 21902 t.mpasquare = 0x33ab; 21903 t.mssquare = 0x33b3; 21904 t.msuperior = 0xf6ef; 21905 t.mturned = 0x026f; 21906 t.mu = 0x00b5; 21907 t.mu1 = 0x00b5; 21908 t.muasquare = 0x3382; 21909 t.muchgreater = 0x226b; 21910 t.muchless = 0x226a; 21911 t.mufsquare = 0x338c; 21912 t.mugreek = 0x03bc; 21913 t.mugsquare = 0x338d; 21914 t.muhiragana = 0x3080; 21915 t.mukatakana = 0x30e0; 21916 t.mukatakanahalfwidth = 0xff91; 21917 t.mulsquare = 0x3395; 21918 t.multiply = 0x00d7; 21919 t.mumsquare = 0x339b; 21920 t.munahhebrew = 0x05a3; 21921 t.munahlefthebrew = 0x05a3; 21922 t.musicalnote = 0x266a; 21923 t.musicalnotedbl = 0x266b; 21924 t.musicflatsign = 0x266d; 21925 t.musicsharpsign = 0x266f; 21926 t.mussquare = 0x33b2; 21927 t.muvsquare = 0x33b6; 21928 t.muwsquare = 0x33bc; 21929 t.mvmegasquare = 0x33b9; 21930 t.mvsquare = 0x33b7; 21931 t.mwmegasquare = 0x33bf; 21932 t.mwsquare = 0x33bd; 21933 t.n = 0x006e; 21934 t.nabengali = 0x09a8; 21935 t.nabla = 0x2207; 21936 t.nacute = 0x0144; 21937 t.nadeva = 0x0928; 21938 t.nagujarati = 0x0aa8; 21939 t.nagurmukhi = 0x0a28; 21940 t.nahiragana = 0x306a; 21941 t.nakatakana = 0x30ca; 21942 t.nakatakanahalfwidth = 0xff85; 21943 t.napostrophe = 0x0149; 21944 t.nasquare = 0x3381; 21945 t.nbopomofo = 0x310b; 21946 t.nbspace = 0x00a0; 21947 t.ncaron = 0x0148; 21948 t.ncedilla = 0x0146; 21949 t.ncircle = 0x24dd; 21950 t.ncircumflexbelow = 0x1e4b; 21951 t.ncommaaccent = 0x0146; 21952 t.ndotaccent = 0x1e45; 21953 t.ndotbelow = 0x1e47; 21954 t.nehiragana = 0x306d; 21955 t.nekatakana = 0x30cd; 21956 t.nekatakanahalfwidth = 0xff88; 21957 t.newsheqelsign = 0x20aa; 21958 t.nfsquare = 0x338b; 21959 t.ngabengali = 0x0999; 21960 t.ngadeva = 0x0919; 21961 t.ngagujarati = 0x0a99; 21962 t.ngagurmukhi = 0x0a19; 21963 t.ngonguthai = 0x0e07; 21964 t.nhiragana = 0x3093; 21965 t.nhookleft = 0x0272; 21966 t.nhookretroflex = 0x0273; 21967 t.nieunacirclekorean = 0x326f; 21968 t.nieunaparenkorean = 0x320f; 21969 t.nieuncieuckorean = 0x3135; 21970 t.nieuncirclekorean = 0x3261; 21971 t.nieunhieuhkorean = 0x3136; 21972 t.nieunkorean = 0x3134; 21973 t.nieunpansioskorean = 0x3168; 21974 t.nieunparenkorean = 0x3201; 21975 t.nieunsioskorean = 0x3167; 21976 t.nieuntikeutkorean = 0x3166; 21977 t.nihiragana = 0x306b; 21978 t.nikatakana = 0x30cb; 21979 t.nikatakanahalfwidth = 0xff86; 21980 t.nikhahitleftthai = 0xf899; 21981 t.nikhahitthai = 0x0e4d; 21982 t.nine = 0x0039; 21983 t.ninearabic = 0x0669; 21984 t.ninebengali = 0x09ef; 21985 t.ninecircle = 0x2468; 21986 t.ninecircleinversesansserif = 0x2792; 21987 t.ninedeva = 0x096f; 21988 t.ninegujarati = 0x0aef; 21989 t.ninegurmukhi = 0x0a6f; 21990 t.ninehackarabic = 0x0669; 21991 t.ninehangzhou = 0x3029; 21992 t.nineideographicparen = 0x3228; 21993 t.nineinferior = 0x2089; 21994 t.ninemonospace = 0xff19; 21995 t.nineoldstyle = 0xf739; 21996 t.nineparen = 0x247c; 21997 t.nineperiod = 0x2490; 21998 t.ninepersian = 0x06f9; 21999 t.nineroman = 0x2178; 22000 t.ninesuperior = 0x2079; 22001 t.nineteencircle = 0x2472; 22002 t.nineteenparen = 0x2486; 22003 t.nineteenperiod = 0x249a; 22004 t.ninethai = 0x0e59; 22005 t.nj = 0x01cc; 22006 t.njecyrillic = 0x045a; 22007 t.nkatakana = 0x30f3; 22008 t.nkatakanahalfwidth = 0xff9d; 22009 t.nlegrightlong = 0x019e; 22010 t.nlinebelow = 0x1e49; 22011 t.nmonospace = 0xff4e; 22012 t.nmsquare = 0x339a; 22013 t.nnabengali = 0x09a3; 22014 t.nnadeva = 0x0923; 22015 t.nnagujarati = 0x0aa3; 22016 t.nnagurmukhi = 0x0a23; 22017 t.nnnadeva = 0x0929; 22018 t.nohiragana = 0x306e; 22019 t.nokatakana = 0x30ce; 22020 t.nokatakanahalfwidth = 0xff89; 22021 t.nonbreakingspace = 0x00a0; 22022 t.nonenthai = 0x0e13; 22023 t.nonuthai = 0x0e19; 22024 t.noonarabic = 0x0646; 22025 t.noonfinalarabic = 0xfee6; 22026 t.noonghunnaarabic = 0x06ba; 22027 t.noonghunnafinalarabic = 0xfb9f; 22028 t.nooninitialarabic = 0xfee7; 22029 t.noonjeeminitialarabic = 0xfcd2; 22030 t.noonjeemisolatedarabic = 0xfc4b; 22031 t.noonmedialarabic = 0xfee8; 22032 t.noonmeeminitialarabic = 0xfcd5; 22033 t.noonmeemisolatedarabic = 0xfc4e; 22034 t.noonnoonfinalarabic = 0xfc8d; 22035 t.notcontains = 0x220c; 22036 t.notelement = 0x2209; 22037 t.notelementof = 0x2209; 22038 t.notequal = 0x2260; 22039 t.notgreater = 0x226f; 22040 t.notgreaternorequal = 0x2271; 22041 t.notgreaternorless = 0x2279; 22042 t.notidentical = 0x2262; 22043 t.notless = 0x226e; 22044 t.notlessnorequal = 0x2270; 22045 t.notparallel = 0x2226; 22046 t.notprecedes = 0x2280; 22047 t.notsubset = 0x2284; 22048 t.notsucceeds = 0x2281; 22049 t.notsuperset = 0x2285; 22050 t.nowarmenian = 0x0576; 22051 t.nparen = 0x24a9; 22052 t.nssquare = 0x33b1; 22053 t.nsuperior = 0x207f; 22054 t.ntilde = 0x00f1; 22055 t.nu = 0x03bd; 22056 t.nuhiragana = 0x306c; 22057 t.nukatakana = 0x30cc; 22058 t.nukatakanahalfwidth = 0xff87; 22059 t.nuktabengali = 0x09bc; 22060 t.nuktadeva = 0x093c; 22061 t.nuktagujarati = 0x0abc; 22062 t.nuktagurmukhi = 0x0a3c; 22063 t.numbersign = 0x0023; 22064 t.numbersignmonospace = 0xff03; 22065 t.numbersignsmall = 0xfe5f; 22066 t.numeralsigngreek = 0x0374; 22067 t.numeralsignlowergreek = 0x0375; 22068 t.numero = 0x2116; 22069 t.nun = 0x05e0; 22070 t.nundagesh = 0xfb40; 22071 t.nundageshhebrew = 0xfb40; 22072 t.nunhebrew = 0x05e0; 22073 t.nvsquare = 0x33b5; 22074 t.nwsquare = 0x33bb; 22075 t.nyabengali = 0x099e; 22076 t.nyadeva = 0x091e; 22077 t.nyagujarati = 0x0a9e; 22078 t.nyagurmukhi = 0x0a1e; 22079 t.o = 0x006f; 22080 t.oacute = 0x00f3; 22081 t.oangthai = 0x0e2d; 22082 t.obarred = 0x0275; 22083 t.obarredcyrillic = 0x04e9; 22084 t.obarreddieresiscyrillic = 0x04eb; 22085 t.obengali = 0x0993; 22086 t.obopomofo = 0x311b; 22087 t.obreve = 0x014f; 22088 t.ocandradeva = 0x0911; 22089 t.ocandragujarati = 0x0a91; 22090 t.ocandravowelsigndeva = 0x0949; 22091 t.ocandravowelsigngujarati = 0x0ac9; 22092 t.ocaron = 0x01d2; 22093 t.ocircle = 0x24de; 22094 t.ocircumflex = 0x00f4; 22095 t.ocircumflexacute = 0x1ed1; 22096 t.ocircumflexdotbelow = 0x1ed9; 22097 t.ocircumflexgrave = 0x1ed3; 22098 t.ocircumflexhookabove = 0x1ed5; 22099 t.ocircumflextilde = 0x1ed7; 22100 t.ocyrillic = 0x043e; 22101 t.odblacute = 0x0151; 22102 t.odblgrave = 0x020d; 22103 t.odeva = 0x0913; 22104 t.odieresis = 0x00f6; 22105 t.odieresiscyrillic = 0x04e7; 22106 t.odotbelow = 0x1ecd; 22107 t.oe = 0x0153; 22108 t.oekorean = 0x315a; 22109 t.ogonek = 0x02db; 22110 t.ogonekcmb = 0x0328; 22111 t.ograve = 0x00f2; 22112 t.ogujarati = 0x0a93; 22113 t.oharmenian = 0x0585; 22114 t.ohiragana = 0x304a; 22115 t.ohookabove = 0x1ecf; 22116 t.ohorn = 0x01a1; 22117 t.ohornacute = 0x1edb; 22118 t.ohorndotbelow = 0x1ee3; 22119 t.ohorngrave = 0x1edd; 22120 t.ohornhookabove = 0x1edf; 22121 t.ohorntilde = 0x1ee1; 22122 t.ohungarumlaut = 0x0151; 22123 t.oi = 0x01a3; 22124 t.oinvertedbreve = 0x020f; 22125 t.okatakana = 0x30aa; 22126 t.okatakanahalfwidth = 0xff75; 22127 t.okorean = 0x3157; 22128 t.olehebrew = 0x05ab; 22129 t.omacron = 0x014d; 22130 t.omacronacute = 0x1e53; 22131 t.omacrongrave = 0x1e51; 22132 t.omdeva = 0x0950; 22133 t.omega = 0x03c9; 22134 t.omega1 = 0x03d6; 22135 t.omegacyrillic = 0x0461; 22136 t.omegalatinclosed = 0x0277; 22137 t.omegaroundcyrillic = 0x047b; 22138 t.omegatitlocyrillic = 0x047d; 22139 t.omegatonos = 0x03ce; 22140 t.omgujarati = 0x0ad0; 22141 t.omicron = 0x03bf; 22142 t.omicrontonos = 0x03cc; 22143 t.omonospace = 0xff4f; 22144 t.one = 0x0031; 22145 t.onearabic = 0x0661; 22146 t.onebengali = 0x09e7; 22147 t.onecircle = 0x2460; 22148 t.onecircleinversesansserif = 0x278a; 22149 t.onedeva = 0x0967; 22150 t.onedotenleader = 0x2024; 22151 t.oneeighth = 0x215b; 22152 t.onefitted = 0xf6dc; 22153 t.onegujarati = 0x0ae7; 22154 t.onegurmukhi = 0x0a67; 22155 t.onehackarabic = 0x0661; 22156 t.onehalf = 0x00bd; 22157 t.onehangzhou = 0x3021; 22158 t.oneideographicparen = 0x3220; 22159 t.oneinferior = 0x2081; 22160 t.onemonospace = 0xff11; 22161 t.onenumeratorbengali = 0x09f4; 22162 t.oneoldstyle = 0xf731; 22163 t.oneparen = 0x2474; 22164 t.oneperiod = 0x2488; 22165 t.onepersian = 0x06f1; 22166 t.onequarter = 0x00bc; 22167 t.oneroman = 0x2170; 22168 t.onesuperior = 0x00b9; 22169 t.onethai = 0x0e51; 22170 t.onethird = 0x2153; 22171 t.oogonek = 0x01eb; 22172 t.oogonekmacron = 0x01ed; 22173 t.oogurmukhi = 0x0a13; 22174 t.oomatragurmukhi = 0x0a4b; 22175 t.oopen = 0x0254; 22176 t.oparen = 0x24aa; 22177 t.openbullet = 0x25e6; 22178 t.option = 0x2325; 22179 t.ordfeminine = 0x00aa; 22180 t.ordmasculine = 0x00ba; 22181 t.orthogonal = 0x221f; 22182 t.oshortdeva = 0x0912; 22183 t.oshortvowelsigndeva = 0x094a; 22184 t.oslash = 0x00f8; 22185 t.oslashacute = 0x01ff; 22186 t.osmallhiragana = 0x3049; 22187 t.osmallkatakana = 0x30a9; 22188 t.osmallkatakanahalfwidth = 0xff6b; 22189 t.ostrokeacute = 0x01ff; 22190 t.osuperior = 0xf6f0; 22191 t.otcyrillic = 0x047f; 22192 t.otilde = 0x00f5; 22193 t.otildeacute = 0x1e4d; 22194 t.otildedieresis = 0x1e4f; 22195 t.oubopomofo = 0x3121; 22196 t.overline = 0x203e; 22197 t.overlinecenterline = 0xfe4a; 22198 t.overlinecmb = 0x0305; 22199 t.overlinedashed = 0xfe49; 22200 t.overlinedblwavy = 0xfe4c; 22201 t.overlinewavy = 0xfe4b; 22202 t.overscore = 0x00af; 22203 t.ovowelsignbengali = 0x09cb; 22204 t.ovowelsigndeva = 0x094b; 22205 t.ovowelsigngujarati = 0x0acb; 22206 t.p = 0x0070; 22207 t.paampssquare = 0x3380; 22208 t.paasentosquare = 0x332b; 22209 t.pabengali = 0x09aa; 22210 t.pacute = 0x1e55; 22211 t.padeva = 0x092a; 22212 t.pagedown = 0x21df; 22213 t.pageup = 0x21de; 22214 t.pagujarati = 0x0aaa; 22215 t.pagurmukhi = 0x0a2a; 22216 t.pahiragana = 0x3071; 22217 t.paiyannoithai = 0x0e2f; 22218 t.pakatakana = 0x30d1; 22219 t.palatalizationcyrilliccmb = 0x0484; 22220 t.palochkacyrillic = 0x04c0; 22221 t.pansioskorean = 0x317f; 22222 t.paragraph = 0x00b6; 22223 t.parallel = 0x2225; 22224 t.parenleft = 0x0028; 22225 t.parenleftaltonearabic = 0xfd3e; 22226 t.parenleftbt = 0xf8ed; 22227 t.parenleftex = 0xf8ec; 22228 t.parenleftinferior = 0x208d; 22229 t.parenleftmonospace = 0xff08; 22230 t.parenleftsmall = 0xfe59; 22231 t.parenleftsuperior = 0x207d; 22232 t.parenlefttp = 0xf8eb; 22233 t.parenleftvertical = 0xfe35; 22234 t.parenright = 0x0029; 22235 t.parenrightaltonearabic = 0xfd3f; 22236 t.parenrightbt = 0xf8f8; 22237 t.parenrightex = 0xf8f7; 22238 t.parenrightinferior = 0x208e; 22239 t.parenrightmonospace = 0xff09; 22240 t.parenrightsmall = 0xfe5a; 22241 t.parenrightsuperior = 0x207e; 22242 t.parenrighttp = 0xf8f6; 22243 t.parenrightvertical = 0xfe36; 22244 t.partialdiff = 0x2202; 22245 t.paseqhebrew = 0x05c0; 22246 t.pashtahebrew = 0x0599; 22247 t.pasquare = 0x33a9; 22248 t.patah = 0x05b7; 22249 t.patah11 = 0x05b7; 22250 t.patah1d = 0x05b7; 22251 t.patah2a = 0x05b7; 22252 t.patahhebrew = 0x05b7; 22253 t.patahnarrowhebrew = 0x05b7; 22254 t.patahquarterhebrew = 0x05b7; 22255 t.patahwidehebrew = 0x05b7; 22256 t.pazerhebrew = 0x05a1; 22257 t.pbopomofo = 0x3106; 22258 t.pcircle = 0x24df; 22259 t.pdotaccent = 0x1e57; 22260 t.pe = 0x05e4; 22261 t.pecyrillic = 0x043f; 22262 t.pedagesh = 0xfb44; 22263 t.pedageshhebrew = 0xfb44; 22264 t.peezisquare = 0x333b; 22265 t.pefinaldageshhebrew = 0xfb43; 22266 t.peharabic = 0x067e; 22267 t.peharmenian = 0x057a; 22268 t.pehebrew = 0x05e4; 22269 t.pehfinalarabic = 0xfb57; 22270 t.pehinitialarabic = 0xfb58; 22271 t.pehiragana = 0x307a; 22272 t.pehmedialarabic = 0xfb59; 22273 t.pekatakana = 0x30da; 22274 t.pemiddlehookcyrillic = 0x04a7; 22275 t.perafehebrew = 0xfb4e; 22276 t.percent = 0x0025; 22277 t.percentarabic = 0x066a; 22278 t.percentmonospace = 0xff05; 22279 t.percentsmall = 0xfe6a; 22280 t.period = 0x002e; 22281 t.periodarmenian = 0x0589; 22282 t.periodcentered = 0x00b7; 22283 t.periodhalfwidth = 0xff61; 22284 t.periodinferior = 0xf6e7; 22285 t.periodmonospace = 0xff0e; 22286 t.periodsmall = 0xfe52; 22287 t.periodsuperior = 0xf6e8; 22288 t.perispomenigreekcmb = 0x0342; 22289 t.perpendicular = 0x22a5; 22290 t.perthousand = 0x2030; 22291 t.peseta = 0x20a7; 22292 t.pfsquare = 0x338a; 22293 t.phabengali = 0x09ab; 22294 t.phadeva = 0x092b; 22295 t.phagujarati = 0x0aab; 22296 t.phagurmukhi = 0x0a2b; 22297 t.phi = 0x03c6; 22298 t.phi1 = 0x03d5; 22299 t.phieuphacirclekorean = 0x327a; 22300 t.phieuphaparenkorean = 0x321a; 22301 t.phieuphcirclekorean = 0x326c; 22302 t.phieuphkorean = 0x314d; 22303 t.phieuphparenkorean = 0x320c; 22304 t.philatin = 0x0278; 22305 t.phinthuthai = 0x0e3a; 22306 t.phisymbolgreek = 0x03d5; 22307 t.phook = 0x01a5; 22308 t.phophanthai = 0x0e1e; 22309 t.phophungthai = 0x0e1c; 22310 t.phosamphaothai = 0x0e20; 22311 t.pi = 0x03c0; 22312 t.pieupacirclekorean = 0x3273; 22313 t.pieupaparenkorean = 0x3213; 22314 t.pieupcieuckorean = 0x3176; 22315 t.pieupcirclekorean = 0x3265; 22316 t.pieupkiyeokkorean = 0x3172; 22317 t.pieupkorean = 0x3142; 22318 t.pieupparenkorean = 0x3205; 22319 t.pieupsioskiyeokkorean = 0x3174; 22320 t.pieupsioskorean = 0x3144; 22321 t.pieupsiostikeutkorean = 0x3175; 22322 t.pieupthieuthkorean = 0x3177; 22323 t.pieuptikeutkorean = 0x3173; 22324 t.pihiragana = 0x3074; 22325 t.pikatakana = 0x30d4; 22326 t.pisymbolgreek = 0x03d6; 22327 t.piwrarmenian = 0x0583; 22328 t.planckover2pi = 0x210f; 22329 t.planckover2pi1 = 0x210f; 22330 t.plus = 0x002b; 22331 t.plusbelowcmb = 0x031f; 22332 t.pluscircle = 0x2295; 22333 t.plusminus = 0x00b1; 22334 t.plusmod = 0x02d6; 22335 t.plusmonospace = 0xff0b; 22336 t.plussmall = 0xfe62; 22337 t.plussuperior = 0x207a; 22338 t.pmonospace = 0xff50; 22339 t.pmsquare = 0x33d8; 22340 t.pohiragana = 0x307d; 22341 t.pointingindexdownwhite = 0x261f; 22342 t.pointingindexleftwhite = 0x261c; 22343 t.pointingindexrightwhite = 0x261e; 22344 t.pointingindexupwhite = 0x261d; 22345 t.pokatakana = 0x30dd; 22346 t.poplathai = 0x0e1b; 22347 t.postalmark = 0x3012; 22348 t.postalmarkface = 0x3020; 22349 t.pparen = 0x24ab; 22350 t.precedes = 0x227a; 22351 t.prescription = 0x211e; 22352 t.primemod = 0x02b9; 22353 t.primereversed = 0x2035; 22354 t.product = 0x220f; 22355 t.projective = 0x2305; 22356 t.prolongedkana = 0x30fc; 22357 t.propellor = 0x2318; 22358 t.propersubset = 0x2282; 22359 t.propersuperset = 0x2283; 22360 t.proportion = 0x2237; 22361 t.proportional = 0x221d; 22362 t.psi = 0x03c8; 22363 t.psicyrillic = 0x0471; 22364 t.psilipneumatacyrilliccmb = 0x0486; 22365 t.pssquare = 0x33b0; 22366 t.puhiragana = 0x3077; 22367 t.pukatakana = 0x30d7; 22368 t.pvsquare = 0x33b4; 22369 t.pwsquare = 0x33ba; 22370 t.q = 0x0071; 22371 t.qadeva = 0x0958; 22372 t.qadmahebrew = 0x05a8; 22373 t.qafarabic = 0x0642; 22374 t.qaffinalarabic = 0xfed6; 22375 t.qafinitialarabic = 0xfed7; 22376 t.qafmedialarabic = 0xfed8; 22377 t.qamats = 0x05b8; 22378 t.qamats10 = 0x05b8; 22379 t.qamats1a = 0x05b8; 22380 t.qamats1c = 0x05b8; 22381 t.qamats27 = 0x05b8; 22382 t.qamats29 = 0x05b8; 22383 t.qamats33 = 0x05b8; 22384 t.qamatsde = 0x05b8; 22385 t.qamatshebrew = 0x05b8; 22386 t.qamatsnarrowhebrew = 0x05b8; 22387 t.qamatsqatanhebrew = 0x05b8; 22388 t.qamatsqatannarrowhebrew = 0x05b8; 22389 t.qamatsqatanquarterhebrew = 0x05b8; 22390 t.qamatsqatanwidehebrew = 0x05b8; 22391 t.qamatsquarterhebrew = 0x05b8; 22392 t.qamatswidehebrew = 0x05b8; 22393 t.qarneyparahebrew = 0x059f; 22394 t.qbopomofo = 0x3111; 22395 t.qcircle = 0x24e0; 22396 t.qhook = 0x02a0; 22397 t.qmonospace = 0xff51; 22398 t.qof = 0x05e7; 22399 t.qofdagesh = 0xfb47; 22400 t.qofdageshhebrew = 0xfb47; 22401 t.qofhebrew = 0x05e7; 22402 t.qparen = 0x24ac; 22403 t.quarternote = 0x2669; 22404 t.qubuts = 0x05bb; 22405 t.qubuts18 = 0x05bb; 22406 t.qubuts25 = 0x05bb; 22407 t.qubuts31 = 0x05bb; 22408 t.qubutshebrew = 0x05bb; 22409 t.qubutsnarrowhebrew = 0x05bb; 22410 t.qubutsquarterhebrew = 0x05bb; 22411 t.qubutswidehebrew = 0x05bb; 22412 t.question = 0x003f; 22413 t.questionarabic = 0x061f; 22414 t.questionarmenian = 0x055e; 22415 t.questiondown = 0x00bf; 22416 t.questiondownsmall = 0xf7bf; 22417 t.questiongreek = 0x037e; 22418 t.questionmonospace = 0xff1f; 22419 t.questionsmall = 0xf73f; 22420 t.quotedbl = 0x0022; 22421 t.quotedblbase = 0x201e; 22422 t.quotedblleft = 0x201c; 22423 t.quotedblmonospace = 0xff02; 22424 t.quotedblprime = 0x301e; 22425 t.quotedblprimereversed = 0x301d; 22426 t.quotedblright = 0x201d; 22427 t.quoteleft = 0x2018; 22428 t.quoteleftreversed = 0x201b; 22429 t.quotereversed = 0x201b; 22430 t.quoteright = 0x2019; 22431 t.quoterightn = 0x0149; 22432 t.quotesinglbase = 0x201a; 22433 t.quotesingle = 0x0027; 22434 t.quotesinglemonospace = 0xff07; 22435 t.r = 0x0072; 22436 t.raarmenian = 0x057c; 22437 t.rabengali = 0x09b0; 22438 t.racute = 0x0155; 22439 t.radeva = 0x0930; 22440 t.radical = 0x221a; 22441 t.radicalex = 0xf8e5; 22442 t.radoverssquare = 0x33ae; 22443 t.radoverssquaredsquare = 0x33af; 22444 t.radsquare = 0x33ad; 22445 t.rafe = 0x05bf; 22446 t.rafehebrew = 0x05bf; 22447 t.ragujarati = 0x0ab0; 22448 t.ragurmukhi = 0x0a30; 22449 t.rahiragana = 0x3089; 22450 t.rakatakana = 0x30e9; 22451 t.rakatakanahalfwidth = 0xff97; 22452 t.ralowerdiagonalbengali = 0x09f1; 22453 t.ramiddlediagonalbengali = 0x09f0; 22454 t.ramshorn = 0x0264; 22455 t.ratio = 0x2236; 22456 t.rbopomofo = 0x3116; 22457 t.rcaron = 0x0159; 22458 t.rcedilla = 0x0157; 22459 t.rcircle = 0x24e1; 22460 t.rcommaaccent = 0x0157; 22461 t.rdblgrave = 0x0211; 22462 t.rdotaccent = 0x1e59; 22463 t.rdotbelow = 0x1e5b; 22464 t.rdotbelowmacron = 0x1e5d; 22465 t.referencemark = 0x203b; 22466 t.reflexsubset = 0x2286; 22467 t.reflexsuperset = 0x2287; 22468 t.registered = 0x00ae; 22469 t.registersans = 0xf8e8; 22470 t.registerserif = 0xf6da; 22471 t.reharabic = 0x0631; 22472 t.reharmenian = 0x0580; 22473 t.rehfinalarabic = 0xfeae; 22474 t.rehiragana = 0x308c; 22475 t.rekatakana = 0x30ec; 22476 t.rekatakanahalfwidth = 0xff9a; 22477 t.resh = 0x05e8; 22478 t.reshdageshhebrew = 0xfb48; 22479 t.reshhebrew = 0x05e8; 22480 t.reversedtilde = 0x223d; 22481 t.reviahebrew = 0x0597; 22482 t.reviamugrashhebrew = 0x0597; 22483 t.revlogicalnot = 0x2310; 22484 t.rfishhook = 0x027e; 22485 t.rfishhookreversed = 0x027f; 22486 t.rhabengali = 0x09dd; 22487 t.rhadeva = 0x095d; 22488 t.rho = 0x03c1; 22489 t.rhook = 0x027d; 22490 t.rhookturned = 0x027b; 22491 t.rhookturnedsuperior = 0x02b5; 22492 t.rhosymbolgreek = 0x03f1; 22493 t.rhotichookmod = 0x02de; 22494 t.rieulacirclekorean = 0x3271; 22495 t.rieulaparenkorean = 0x3211; 22496 t.rieulcirclekorean = 0x3263; 22497 t.rieulhieuhkorean = 0x3140; 22498 t.rieulkiyeokkorean = 0x313a; 22499 t.rieulkiyeoksioskorean = 0x3169; 22500 t.rieulkorean = 0x3139; 22501 t.rieulmieumkorean = 0x313b; 22502 t.rieulpansioskorean = 0x316c; 22503 t.rieulparenkorean = 0x3203; 22504 t.rieulphieuphkorean = 0x313f; 22505 t.rieulpieupkorean = 0x313c; 22506 t.rieulpieupsioskorean = 0x316b; 22507 t.rieulsioskorean = 0x313d; 22508 t.rieulthieuthkorean = 0x313e; 22509 t.rieultikeutkorean = 0x316a; 22510 t.rieulyeorinhieuhkorean = 0x316d; 22511 t.rightangle = 0x221f; 22512 t.righttackbelowcmb = 0x0319; 22513 t.righttriangle = 0x22bf; 22514 t.rihiragana = 0x308a; 22515 t.rikatakana = 0x30ea; 22516 t.rikatakanahalfwidth = 0xff98; 22517 t.ring = 0x02da; 22518 t.ringbelowcmb = 0x0325; 22519 t.ringcmb = 0x030a; 22520 t.ringhalfleft = 0x02bf; 22521 t.ringhalfleftarmenian = 0x0559; 22522 t.ringhalfleftbelowcmb = 0x031c; 22523 t.ringhalfleftcentered = 0x02d3; 22524 t.ringhalfright = 0x02be; 22525 t.ringhalfrightbelowcmb = 0x0339; 22526 t.ringhalfrightcentered = 0x02d2; 22527 t.rinvertedbreve = 0x0213; 22528 t.rittorusquare = 0x3351; 22529 t.rlinebelow = 0x1e5f; 22530 t.rlongleg = 0x027c; 22531 t.rlonglegturned = 0x027a; 22532 t.rmonospace = 0xff52; 22533 t.rohiragana = 0x308d; 22534 t.rokatakana = 0x30ed; 22535 t.rokatakanahalfwidth = 0xff9b; 22536 t.roruathai = 0x0e23; 22537 t.rparen = 0x24ad; 22538 t.rrabengali = 0x09dc; 22539 t.rradeva = 0x0931; 22540 t.rragurmukhi = 0x0a5c; 22541 t.rreharabic = 0x0691; 22542 t.rrehfinalarabic = 0xfb8d; 22543 t.rrvocalicbengali = 0x09e0; 22544 t.rrvocalicdeva = 0x0960; 22545 t.rrvocalicgujarati = 0x0ae0; 22546 t.rrvocalicvowelsignbengali = 0x09c4; 22547 t.rrvocalicvowelsigndeva = 0x0944; 22548 t.rrvocalicvowelsigngujarati = 0x0ac4; 22549 t.rsuperior = 0xf6f1; 22550 t.rtblock = 0x2590; 22551 t.rturned = 0x0279; 22552 t.rturnedsuperior = 0x02b4; 22553 t.ruhiragana = 0x308b; 22554 t.rukatakana = 0x30eb; 22555 t.rukatakanahalfwidth = 0xff99; 22556 t.rupeemarkbengali = 0x09f2; 22557 t.rupeesignbengali = 0x09f3; 22558 t.rupiah = 0xf6dd; 22559 t.ruthai = 0x0e24; 22560 t.rvocalicbengali = 0x098b; 22561 t.rvocalicdeva = 0x090b; 22562 t.rvocalicgujarati = 0x0a8b; 22563 t.rvocalicvowelsignbengali = 0x09c3; 22564 t.rvocalicvowelsigndeva = 0x0943; 22565 t.rvocalicvowelsigngujarati = 0x0ac3; 22566 t.s = 0x0073; 22567 t.sabengali = 0x09b8; 22568 t.sacute = 0x015b; 22569 t.sacutedotaccent = 0x1e65; 22570 t.sadarabic = 0x0635; 22571 t.sadeva = 0x0938; 22572 t.sadfinalarabic = 0xfeba; 22573 t.sadinitialarabic = 0xfebb; 22574 t.sadmedialarabic = 0xfebc; 22575 t.sagujarati = 0x0ab8; 22576 t.sagurmukhi = 0x0a38; 22577 t.sahiragana = 0x3055; 22578 t.sakatakana = 0x30b5; 22579 t.sakatakanahalfwidth = 0xff7b; 22580 t.sallallahoualayhewasallamarabic = 0xfdfa; 22581 t.samekh = 0x05e1; 22582 t.samekhdagesh = 0xfb41; 22583 t.samekhdageshhebrew = 0xfb41; 22584 t.samekhhebrew = 0x05e1; 22585 t.saraaathai = 0x0e32; 22586 t.saraaethai = 0x0e41; 22587 t.saraaimaimalaithai = 0x0e44; 22588 t.saraaimaimuanthai = 0x0e43; 22589 t.saraamthai = 0x0e33; 22590 t.saraathai = 0x0e30; 22591 t.saraethai = 0x0e40; 22592 t.saraiileftthai = 0xf886; 22593 t.saraiithai = 0x0e35; 22594 t.saraileftthai = 0xf885; 22595 t.saraithai = 0x0e34; 22596 t.saraothai = 0x0e42; 22597 t.saraueeleftthai = 0xf888; 22598 t.saraueethai = 0x0e37; 22599 t.saraueleftthai = 0xf887; 22600 t.sarauethai = 0x0e36; 22601 t.sarauthai = 0x0e38; 22602 t.sarauuthai = 0x0e39; 22603 t.sbopomofo = 0x3119; 22604 t.scaron = 0x0161; 22605 t.scarondotaccent = 0x1e67; 22606 t.scedilla = 0x015f; 22607 t.schwa = 0x0259; 22608 t.schwacyrillic = 0x04d9; 22609 t.schwadieresiscyrillic = 0x04db; 22610 t.schwahook = 0x025a; 22611 t.scircle = 0x24e2; 22612 t.scircumflex = 0x015d; 22613 t.scommaaccent = 0x0219; 22614 t.sdotaccent = 0x1e61; 22615 t.sdotbelow = 0x1e63; 22616 t.sdotbelowdotaccent = 0x1e69; 22617 t.seagullbelowcmb = 0x033c; 22618 t.second = 0x2033; 22619 t.secondtonechinese = 0x02ca; 22620 t.section = 0x00a7; 22621 t.seenarabic = 0x0633; 22622 t.seenfinalarabic = 0xfeb2; 22623 t.seeninitialarabic = 0xfeb3; 22624 t.seenmedialarabic = 0xfeb4; 22625 t.segol = 0x05b6; 22626 t.segol13 = 0x05b6; 22627 t.segol1f = 0x05b6; 22628 t.segol2c = 0x05b6; 22629 t.segolhebrew = 0x05b6; 22630 t.segolnarrowhebrew = 0x05b6; 22631 t.segolquarterhebrew = 0x05b6; 22632 t.segoltahebrew = 0x0592; 22633 t.segolwidehebrew = 0x05b6; 22634 t.seharmenian = 0x057d; 22635 t.sehiragana = 0x305b; 22636 t.sekatakana = 0x30bb; 22637 t.sekatakanahalfwidth = 0xff7e; 22638 t.semicolon = 0x003b; 22639 t.semicolonarabic = 0x061b; 22640 t.semicolonmonospace = 0xff1b; 22641 t.semicolonsmall = 0xfe54; 22642 t.semivoicedmarkkana = 0x309c; 22643 t.semivoicedmarkkanahalfwidth = 0xff9f; 22644 t.sentisquare = 0x3322; 22645 t.sentosquare = 0x3323; 22646 t.seven = 0x0037; 22647 t.sevenarabic = 0x0667; 22648 t.sevenbengali = 0x09ed; 22649 t.sevencircle = 0x2466; 22650 t.sevencircleinversesansserif = 0x2790; 22651 t.sevendeva = 0x096d; 22652 t.seveneighths = 0x215e; 22653 t.sevengujarati = 0x0aed; 22654 t.sevengurmukhi = 0x0a6d; 22655 t.sevenhackarabic = 0x0667; 22656 t.sevenhangzhou = 0x3027; 22657 t.sevenideographicparen = 0x3226; 22658 t.seveninferior = 0x2087; 22659 t.sevenmonospace = 0xff17; 22660 t.sevenoldstyle = 0xf737; 22661 t.sevenparen = 0x247a; 22662 t.sevenperiod = 0x248e; 22663 t.sevenpersian = 0x06f7; 22664 t.sevenroman = 0x2176; 22665 t.sevensuperior = 0x2077; 22666 t.seventeencircle = 0x2470; 22667 t.seventeenparen = 0x2484; 22668 t.seventeenperiod = 0x2498; 22669 t.seventhai = 0x0e57; 22670 t.sfthyphen = 0x00ad; 22671 t.shaarmenian = 0x0577; 22672 t.shabengali = 0x09b6; 22673 t.shacyrillic = 0x0448; 22674 t.shaddaarabic = 0x0651; 22675 t.shaddadammaarabic = 0xfc61; 22676 t.shaddadammatanarabic = 0xfc5e; 22677 t.shaddafathaarabic = 0xfc60; 22678 t.shaddakasraarabic = 0xfc62; 22679 t.shaddakasratanarabic = 0xfc5f; 22680 t.shade = 0x2592; 22681 t.shadedark = 0x2593; 22682 t.shadelight = 0x2591; 22683 t.shademedium = 0x2592; 22684 t.shadeva = 0x0936; 22685 t.shagujarati = 0x0ab6; 22686 t.shagurmukhi = 0x0a36; 22687 t.shalshelethebrew = 0x0593; 22688 t.shbopomofo = 0x3115; 22689 t.shchacyrillic = 0x0449; 22690 t.sheenarabic = 0x0634; 22691 t.sheenfinalarabic = 0xfeb6; 22692 t.sheeninitialarabic = 0xfeb7; 22693 t.sheenmedialarabic = 0xfeb8; 22694 t.sheicoptic = 0x03e3; 22695 t.sheqel = 0x20aa; 22696 t.sheqelhebrew = 0x20aa; 22697 t.sheva = 0x05b0; 22698 t.sheva115 = 0x05b0; 22699 t.sheva15 = 0x05b0; 22700 t.sheva22 = 0x05b0; 22701 t.sheva2e = 0x05b0; 22702 t.shevahebrew = 0x05b0; 22703 t.shevanarrowhebrew = 0x05b0; 22704 t.shevaquarterhebrew = 0x05b0; 22705 t.shevawidehebrew = 0x05b0; 22706 t.shhacyrillic = 0x04bb; 22707 t.shimacoptic = 0x03ed; 22708 t.shin = 0x05e9; 22709 t.shindagesh = 0xfb49; 22710 t.shindageshhebrew = 0xfb49; 22711 t.shindageshshindot = 0xfb2c; 22712 t.shindageshshindothebrew = 0xfb2c; 22713 t.shindageshsindot = 0xfb2d; 22714 t.shindageshsindothebrew = 0xfb2d; 22715 t.shindothebrew = 0x05c1; 22716 t.shinhebrew = 0x05e9; 22717 t.shinshindot = 0xfb2a; 22718 t.shinshindothebrew = 0xfb2a; 22719 t.shinsindot = 0xfb2b; 22720 t.shinsindothebrew = 0xfb2b; 22721 t.shook = 0x0282; 22722 t.sigma = 0x03c3; 22723 t.sigma1 = 0x03c2; 22724 t.sigmafinal = 0x03c2; 22725 t.sigmalunatesymbolgreek = 0x03f2; 22726 t.sihiragana = 0x3057; 22727 t.sikatakana = 0x30b7; 22728 t.sikatakanahalfwidth = 0xff7c; 22729 t.siluqhebrew = 0x05bd; 22730 t.siluqlefthebrew = 0x05bd; 22731 t.similar = 0x223c; 22732 t.sindothebrew = 0x05c2; 22733 t.siosacirclekorean = 0x3274; 22734 t.siosaparenkorean = 0x3214; 22735 t.sioscieuckorean = 0x317e; 22736 t.sioscirclekorean = 0x3266; 22737 t.sioskiyeokkorean = 0x317a; 22738 t.sioskorean = 0x3145; 22739 t.siosnieunkorean = 0x317b; 22740 t.siosparenkorean = 0x3206; 22741 t.siospieupkorean = 0x317d; 22742 t.siostikeutkorean = 0x317c; 22743 t.six = 0x0036; 22744 t.sixarabic = 0x0666; 22745 t.sixbengali = 0x09ec; 22746 t.sixcircle = 0x2465; 22747 t.sixcircleinversesansserif = 0x278f; 22748 t.sixdeva = 0x096c; 22749 t.sixgujarati = 0x0aec; 22750 t.sixgurmukhi = 0x0a6c; 22751 t.sixhackarabic = 0x0666; 22752 t.sixhangzhou = 0x3026; 22753 t.sixideographicparen = 0x3225; 22754 t.sixinferior = 0x2086; 22755 t.sixmonospace = 0xff16; 22756 t.sixoldstyle = 0xf736; 22757 t.sixparen = 0x2479; 22758 t.sixperiod = 0x248d; 22759 t.sixpersian = 0x06f6; 22760 t.sixroman = 0x2175; 22761 t.sixsuperior = 0x2076; 22762 t.sixteencircle = 0x246f; 22763 t.sixteencurrencydenominatorbengali = 0x09f9; 22764 t.sixteenparen = 0x2483; 22765 t.sixteenperiod = 0x2497; 22766 t.sixthai = 0x0e56; 22767 t.slash = 0x002f; 22768 t.slashmonospace = 0xff0f; 22769 t.slong = 0x017f; 22770 t.slongdotaccent = 0x1e9b; 22771 t.smileface = 0x263a; 22772 t.smonospace = 0xff53; 22773 t.sofpasuqhebrew = 0x05c3; 22774 t.softhyphen = 0x00ad; 22775 t.softsigncyrillic = 0x044c; 22776 t.sohiragana = 0x305d; 22777 t.sokatakana = 0x30bd; 22778 t.sokatakanahalfwidth = 0xff7f; 22779 t.soliduslongoverlaycmb = 0x0338; 22780 t.solidusshortoverlaycmb = 0x0337; 22781 t.sorusithai = 0x0e29; 22782 t.sosalathai = 0x0e28; 22783 t.sosothai = 0x0e0b; 22784 t.sosuathai = 0x0e2a; 22785 t.space = 0x0020; 22786 t.spacehackarabic = 0x0020; 22787 t.spade = 0x2660; 22788 t.spadesuitblack = 0x2660; 22789 t.spadesuitwhite = 0x2664; 22790 t.sparen = 0x24ae; 22791 t.squarebelowcmb = 0x033b; 22792 t.squarecc = 0x33c4; 22793 t.squarecm = 0x339d; 22794 t.squarediagonalcrosshatchfill = 0x25a9; 22795 t.squarehorizontalfill = 0x25a4; 22796 t.squarekg = 0x338f; 22797 t.squarekm = 0x339e; 22798 t.squarekmcapital = 0x33ce; 22799 t.squareln = 0x33d1; 22800 t.squarelog = 0x33d2; 22801 t.squaremg = 0x338e; 22802 t.squaremil = 0x33d5; 22803 t.squaremm = 0x339c; 22804 t.squaremsquared = 0x33a1; 22805 t.squareorthogonalcrosshatchfill = 0x25a6; 22806 t.squareupperlefttolowerrightfill = 0x25a7; 22807 t.squareupperrighttolowerleftfill = 0x25a8; 22808 t.squareverticalfill = 0x25a5; 22809 t.squarewhitewithsmallblack = 0x25a3; 22810 t.srsquare = 0x33db; 22811 t.ssabengali = 0x09b7; 22812 t.ssadeva = 0x0937; 22813 t.ssagujarati = 0x0ab7; 22814 t.ssangcieuckorean = 0x3149; 22815 t.ssanghieuhkorean = 0x3185; 22816 t.ssangieungkorean = 0x3180; 22817 t.ssangkiyeokkorean = 0x3132; 22818 t.ssangnieunkorean = 0x3165; 22819 t.ssangpieupkorean = 0x3143; 22820 t.ssangsioskorean = 0x3146; 22821 t.ssangtikeutkorean = 0x3138; 22822 t.ssuperior = 0xf6f2; 22823 t.sterling = 0x00a3; 22824 t.sterlingmonospace = 0xffe1; 22825 t.strokelongoverlaycmb = 0x0336; 22826 t.strokeshortoverlaycmb = 0x0335; 22827 t.subset = 0x2282; 22828 t.subsetnotequal = 0x228a; 22829 t.subsetorequal = 0x2286; 22830 t.succeeds = 0x227b; 22831 t.suchthat = 0x220b; 22832 t.suhiragana = 0x3059; 22833 t.sukatakana = 0x30b9; 22834 t.sukatakanahalfwidth = 0xff7d; 22835 t.sukunarabic = 0x0652; 22836 t.summation = 0x2211; 22837 t.sun = 0x263c; 22838 t.superset = 0x2283; 22839 t.supersetnotequal = 0x228b; 22840 t.supersetorequal = 0x2287; 22841 t.svsquare = 0x33dc; 22842 t.syouwaerasquare = 0x337c; 22843 t.t = 0x0074; 22844 t.tabengali = 0x09a4; 22845 t.tackdown = 0x22a4; 22846 t.tackleft = 0x22a3; 22847 t.tadeva = 0x0924; 22848 t.tagujarati = 0x0aa4; 22849 t.tagurmukhi = 0x0a24; 22850 t.taharabic = 0x0637; 22851 t.tahfinalarabic = 0xfec2; 22852 t.tahinitialarabic = 0xfec3; 22853 t.tahiragana = 0x305f; 22854 t.tahmedialarabic = 0xfec4; 22855 t.taisyouerasquare = 0x337d; 22856 t.takatakana = 0x30bf; 22857 t.takatakanahalfwidth = 0xff80; 22858 t.tatweelarabic = 0x0640; 22859 t.tau = 0x03c4; 22860 t.tav = 0x05ea; 22861 t.tavdages = 0xfb4a; 22862 t.tavdagesh = 0xfb4a; 22863 t.tavdageshhebrew = 0xfb4a; 22864 t.tavhebrew = 0x05ea; 22865 t.tbar = 0x0167; 22866 t.tbopomofo = 0x310a; 22867 t.tcaron = 0x0165; 22868 t.tccurl = 0x02a8; 22869 t.tcedilla = 0x0163; 22870 t.tcheharabic = 0x0686; 22871 t.tchehfinalarabic = 0xfb7b; 22872 t.tchehinitialarabic = 0xfb7c; 22873 t.tchehmedialarabic = 0xfb7d; 22874 t.tcircle = 0x24e3; 22875 t.tcircumflexbelow = 0x1e71; 22876 t.tcommaaccent = 0x0163; 22877 t.tdieresis = 0x1e97; 22878 t.tdotaccent = 0x1e6b; 22879 t.tdotbelow = 0x1e6d; 22880 t.tecyrillic = 0x0442; 22881 t.tedescendercyrillic = 0x04ad; 22882 t.teharabic = 0x062a; 22883 t.tehfinalarabic = 0xfe96; 22884 t.tehhahinitialarabic = 0xfca2; 22885 t.tehhahisolatedarabic = 0xfc0c; 22886 t.tehinitialarabic = 0xfe97; 22887 t.tehiragana = 0x3066; 22888 t.tehjeeminitialarabic = 0xfca1; 22889 t.tehjeemisolatedarabic = 0xfc0b; 22890 t.tehmarbutaarabic = 0x0629; 22891 t.tehmarbutafinalarabic = 0xfe94; 22892 t.tehmedialarabic = 0xfe98; 22893 t.tehmeeminitialarabic = 0xfca4; 22894 t.tehmeemisolatedarabic = 0xfc0e; 22895 t.tehnoonfinalarabic = 0xfc73; 22896 t.tekatakana = 0x30c6; 22897 t.tekatakanahalfwidth = 0xff83; 22898 t.telephone = 0x2121; 22899 t.telephoneblack = 0x260e; 22900 t.telishagedolahebrew = 0x05a0; 22901 t.telishaqetanahebrew = 0x05a9; 22902 t.tencircle = 0x2469; 22903 t.tenideographicparen = 0x3229; 22904 t.tenparen = 0x247d; 22905 t.tenperiod = 0x2491; 22906 t.tenroman = 0x2179; 22907 t.tesh = 0x02a7; 22908 t.tet = 0x05d8; 22909 t.tetdagesh = 0xfb38; 22910 t.tetdageshhebrew = 0xfb38; 22911 t.tethebrew = 0x05d8; 22912 t.tetsecyrillic = 0x04b5; 22913 t.tevirhebrew = 0x059b; 22914 t.tevirlefthebrew = 0x059b; 22915 t.thabengali = 0x09a5; 22916 t.thadeva = 0x0925; 22917 t.thagujarati = 0x0aa5; 22918 t.thagurmukhi = 0x0a25; 22919 t.thalarabic = 0x0630; 22920 t.thalfinalarabic = 0xfeac; 22921 t.thanthakhatlowleftthai = 0xf898; 22922 t.thanthakhatlowrightthai = 0xf897; 22923 t.thanthakhatthai = 0x0e4c; 22924 t.thanthakhatupperleftthai = 0xf896; 22925 t.theharabic = 0x062b; 22926 t.thehfinalarabic = 0xfe9a; 22927 t.thehinitialarabic = 0xfe9b; 22928 t.thehmedialarabic = 0xfe9c; 22929 t.thereexists = 0x2203; 22930 t.therefore = 0x2234; 22931 t.theta = 0x03b8; 22932 t.theta1 = 0x03d1; 22933 t.thetasymbolgreek = 0x03d1; 22934 t.thieuthacirclekorean = 0x3279; 22935 t.thieuthaparenkorean = 0x3219; 22936 t.thieuthcirclekorean = 0x326b; 22937 t.thieuthkorean = 0x314c; 22938 t.thieuthparenkorean = 0x320b; 22939 t.thirteencircle = 0x246c; 22940 t.thirteenparen = 0x2480; 22941 t.thirteenperiod = 0x2494; 22942 t.thonangmonthothai = 0x0e11; 22943 t.thook = 0x01ad; 22944 t.thophuthaothai = 0x0e12; 22945 t.thorn = 0x00fe; 22946 t.thothahanthai = 0x0e17; 22947 t.thothanthai = 0x0e10; 22948 t.thothongthai = 0x0e18; 22949 t.thothungthai = 0x0e16; 22950 t.thousandcyrillic = 0x0482; 22951 t.thousandsseparatorarabic = 0x066c; 22952 t.thousandsseparatorpersian = 0x066c; 22953 t.three = 0x0033; 22954 t.threearabic = 0x0663; 22955 t.threebengali = 0x09e9; 22956 t.threecircle = 0x2462; 22957 t.threecircleinversesansserif = 0x278c; 22958 t.threedeva = 0x0969; 22959 t.threeeighths = 0x215c; 22960 t.threegujarati = 0x0ae9; 22961 t.threegurmukhi = 0x0a69; 22962 t.threehackarabic = 0x0663; 22963 t.threehangzhou = 0x3023; 22964 t.threeideographicparen = 0x3222; 22965 t.threeinferior = 0x2083; 22966 t.threemonospace = 0xff13; 22967 t.threenumeratorbengali = 0x09f6; 22968 t.threeoldstyle = 0xf733; 22969 t.threeparen = 0x2476; 22970 t.threeperiod = 0x248a; 22971 t.threepersian = 0x06f3; 22972 t.threequarters = 0x00be; 22973 t.threequartersemdash = 0xf6de; 22974 t.threeroman = 0x2172; 22975 t.threesuperior = 0x00b3; 22976 t.threethai = 0x0e53; 22977 t.thzsquare = 0x3394; 22978 t.tihiragana = 0x3061; 22979 t.tikatakana = 0x30c1; 22980 t.tikatakanahalfwidth = 0xff81; 22981 t.tikeutacirclekorean = 0x3270; 22982 t.tikeutaparenkorean = 0x3210; 22983 t.tikeutcirclekorean = 0x3262; 22984 t.tikeutkorean = 0x3137; 22985 t.tikeutparenkorean = 0x3202; 22986 t.tilde = 0x02dc; 22987 t.tildebelowcmb = 0x0330; 22988 t.tildecmb = 0x0303; 22989 t.tildecomb = 0x0303; 22990 t.tildedoublecmb = 0x0360; 22991 t.tildeoperator = 0x223c; 22992 t.tildeoverlaycmb = 0x0334; 22993 t.tildeverticalcmb = 0x033e; 22994 t.timescircle = 0x2297; 22995 t.tipehahebrew = 0x0596; 22996 t.tipehalefthebrew = 0x0596; 22997 t.tippigurmukhi = 0x0a70; 22998 t.titlocyrilliccmb = 0x0483; 22999 t.tiwnarmenian = 0x057f; 23000 t.tlinebelow = 0x1e6f; 23001 t.tmonospace = 0xff54; 23002 t.toarmenian = 0x0569; 23003 t.tohiragana = 0x3068; 23004 t.tokatakana = 0x30c8; 23005 t.tokatakanahalfwidth = 0xff84; 23006 t.tonebarextrahighmod = 0x02e5; 23007 t.tonebarextralowmod = 0x02e9; 23008 t.tonebarhighmod = 0x02e6; 23009 t.tonebarlowmod = 0x02e8; 23010 t.tonebarmidmod = 0x02e7; 23011 t.tonefive = 0x01bd; 23012 t.tonesix = 0x0185; 23013 t.tonetwo = 0x01a8; 23014 t.tonos = 0x0384; 23015 t.tonsquare = 0x3327; 23016 t.topatakthai = 0x0e0f; 23017 t.tortoiseshellbracketleft = 0x3014; 23018 t.tortoiseshellbracketleftsmall = 0xfe5d; 23019 t.tortoiseshellbracketleftvertical = 0xfe39; 23020 t.tortoiseshellbracketright = 0x3015; 23021 t.tortoiseshellbracketrightsmall = 0xfe5e; 23022 t.tortoiseshellbracketrightvertical = 0xfe3a; 23023 t.totaothai = 0x0e15; 23024 t.tpalatalhook = 0x01ab; 23025 t.tparen = 0x24af; 23026 t.trademark = 0x2122; 23027 t.trademarksans = 0xf8ea; 23028 t.trademarkserif = 0xf6db; 23029 t.tretroflexhook = 0x0288; 23030 t.triagdn = 0x25bc; 23031 t.triaglf = 0x25c4; 23032 t.triagrt = 0x25ba; 23033 t.triagup = 0x25b2; 23034 t.ts = 0x02a6; 23035 t.tsadi = 0x05e6; 23036 t.tsadidagesh = 0xfb46; 23037 t.tsadidageshhebrew = 0xfb46; 23038 t.tsadihebrew = 0x05e6; 23039 t.tsecyrillic = 0x0446; 23040 t.tsere = 0x05b5; 23041 t.tsere12 = 0x05b5; 23042 t.tsere1e = 0x05b5; 23043 t.tsere2b = 0x05b5; 23044 t.tserehebrew = 0x05b5; 23045 t.tserenarrowhebrew = 0x05b5; 23046 t.tserequarterhebrew = 0x05b5; 23047 t.tserewidehebrew = 0x05b5; 23048 t.tshecyrillic = 0x045b; 23049 t.tsuperior = 0xf6f3; 23050 t.ttabengali = 0x099f; 23051 t.ttadeva = 0x091f; 23052 t.ttagujarati = 0x0a9f; 23053 t.ttagurmukhi = 0x0a1f; 23054 t.tteharabic = 0x0679; 23055 t.ttehfinalarabic = 0xfb67; 23056 t.ttehinitialarabic = 0xfb68; 23057 t.ttehmedialarabic = 0xfb69; 23058 t.tthabengali = 0x09a0; 23059 t.tthadeva = 0x0920; 23060 t.tthagujarati = 0x0aa0; 23061 t.tthagurmukhi = 0x0a20; 23062 t.tturned = 0x0287; 23063 t.tuhiragana = 0x3064; 23064 t.tukatakana = 0x30c4; 23065 t.tukatakanahalfwidth = 0xff82; 23066 t.tusmallhiragana = 0x3063; 23067 t.tusmallkatakana = 0x30c3; 23068 t.tusmallkatakanahalfwidth = 0xff6f; 23069 t.twelvecircle = 0x246b; 23070 t.twelveparen = 0x247f; 23071 t.twelveperiod = 0x2493; 23072 t.twelveroman = 0x217b; 23073 t.twentycircle = 0x2473; 23074 t.twentyhangzhou = 0x5344; 23075 t.twentyparen = 0x2487; 23076 t.twentyperiod = 0x249b; 23077 t.two = 0x0032; 23078 t.twoarabic = 0x0662; 23079 t.twobengali = 0x09e8; 23080 t.twocircle = 0x2461; 23081 t.twocircleinversesansserif = 0x278b; 23082 t.twodeva = 0x0968; 23083 t.twodotenleader = 0x2025; 23084 t.twodotleader = 0x2025; 23085 t.twodotleadervertical = 0xfe30; 23086 t.twogujarati = 0x0ae8; 23087 t.twogurmukhi = 0x0a68; 23088 t.twohackarabic = 0x0662; 23089 t.twohangzhou = 0x3022; 23090 t.twoideographicparen = 0x3221; 23091 t.twoinferior = 0x2082; 23092 t.twomonospace = 0xff12; 23093 t.twonumeratorbengali = 0x09f5; 23094 t.twooldstyle = 0xf732; 23095 t.twoparen = 0x2475; 23096 t.twoperiod = 0x2489; 23097 t.twopersian = 0x06f2; 23098 t.tworoman = 0x2171; 23099 t.twostroke = 0x01bb; 23100 t.twosuperior = 0x00b2; 23101 t.twothai = 0x0e52; 23102 t.twothirds = 0x2154; 23103 t.u = 0x0075; 23104 t.uacute = 0x00fa; 23105 t.ubar = 0x0289; 23106 t.ubengali = 0x0989; 23107 t.ubopomofo = 0x3128; 23108 t.ubreve = 0x016d; 23109 t.ucaron = 0x01d4; 23110 t.ucircle = 0x24e4; 23111 t.ucircumflex = 0x00fb; 23112 t.ucircumflexbelow = 0x1e77; 23113 t.ucyrillic = 0x0443; 23114 t.udattadeva = 0x0951; 23115 t.udblacute = 0x0171; 23116 t.udblgrave = 0x0215; 23117 t.udeva = 0x0909; 23118 t.udieresis = 0x00fc; 23119 t.udieresisacute = 0x01d8; 23120 t.udieresisbelow = 0x1e73; 23121 t.udieresiscaron = 0x01da; 23122 t.udieresiscyrillic = 0x04f1; 23123 t.udieresisgrave = 0x01dc; 23124 t.udieresismacron = 0x01d6; 23125 t.udotbelow = 0x1ee5; 23126 t.ugrave = 0x00f9; 23127 t.ugujarati = 0x0a89; 23128 t.ugurmukhi = 0x0a09; 23129 t.uhiragana = 0x3046; 23130 t.uhookabove = 0x1ee7; 23131 t.uhorn = 0x01b0; 23132 t.uhornacute = 0x1ee9; 23133 t.uhorndotbelow = 0x1ef1; 23134 t.uhorngrave = 0x1eeb; 23135 t.uhornhookabove = 0x1eed; 23136 t.uhorntilde = 0x1eef; 23137 t.uhungarumlaut = 0x0171; 23138 t.uhungarumlautcyrillic = 0x04f3; 23139 t.uinvertedbreve = 0x0217; 23140 t.ukatakana = 0x30a6; 23141 t.ukatakanahalfwidth = 0xff73; 23142 t.ukcyrillic = 0x0479; 23143 t.ukorean = 0x315c; 23144 t.umacron = 0x016b; 23145 t.umacroncyrillic = 0x04ef; 23146 t.umacrondieresis = 0x1e7b; 23147 t.umatragurmukhi = 0x0a41; 23148 t.umonospace = 0xff55; 23149 t.underscore = 0x005f; 23150 t.underscoredbl = 0x2017; 23151 t.underscoremonospace = 0xff3f; 23152 t.underscorevertical = 0xfe33; 23153 t.underscorewavy = 0xfe4f; 23154 t.union = 0x222a; 23155 t.universal = 0x2200; 23156 t.uogonek = 0x0173; 23157 t.uparen = 0x24b0; 23158 t.upblock = 0x2580; 23159 t.upperdothebrew = 0x05c4; 23160 t.upsilon = 0x03c5; 23161 t.upsilondieresis = 0x03cb; 23162 t.upsilondieresistonos = 0x03b0; 23163 t.upsilonlatin = 0x028a; 23164 t.upsilontonos = 0x03cd; 23165 t.uptackbelowcmb = 0x031d; 23166 t.uptackmod = 0x02d4; 23167 t.uragurmukhi = 0x0a73; 23168 t.uring = 0x016f; 23169 t.ushortcyrillic = 0x045e; 23170 t.usmallhiragana = 0x3045; 23171 t.usmallkatakana = 0x30a5; 23172 t.usmallkatakanahalfwidth = 0xff69; 23173 t.ustraightcyrillic = 0x04af; 23174 t.ustraightstrokecyrillic = 0x04b1; 23175 t.utilde = 0x0169; 23176 t.utildeacute = 0x1e79; 23177 t.utildebelow = 0x1e75; 23178 t.uubengali = 0x098a; 23179 t.uudeva = 0x090a; 23180 t.uugujarati = 0x0a8a; 23181 t.uugurmukhi = 0x0a0a; 23182 t.uumatragurmukhi = 0x0a42; 23183 t.uuvowelsignbengali = 0x09c2; 23184 t.uuvowelsigndeva = 0x0942; 23185 t.uuvowelsigngujarati = 0x0ac2; 23186 t.uvowelsignbengali = 0x09c1; 23187 t.uvowelsigndeva = 0x0941; 23188 t.uvowelsigngujarati = 0x0ac1; 23189 t.v = 0x0076; 23190 t.vadeva = 0x0935; 23191 t.vagujarati = 0x0ab5; 23192 t.vagurmukhi = 0x0a35; 23193 t.vakatakana = 0x30f7; 23194 t.vav = 0x05d5; 23195 t.vavdagesh = 0xfb35; 23196 t.vavdagesh65 = 0xfb35; 23197 t.vavdageshhebrew = 0xfb35; 23198 t.vavhebrew = 0x05d5; 23199 t.vavholam = 0xfb4b; 23200 t.vavholamhebrew = 0xfb4b; 23201 t.vavvavhebrew = 0x05f0; 23202 t.vavyodhebrew = 0x05f1; 23203 t.vcircle = 0x24e5; 23204 t.vdotbelow = 0x1e7f; 23205 t.vecyrillic = 0x0432; 23206 t.veharabic = 0x06a4; 23207 t.vehfinalarabic = 0xfb6b; 23208 t.vehinitialarabic = 0xfb6c; 23209 t.vehmedialarabic = 0xfb6d; 23210 t.vekatakana = 0x30f9; 23211 t.venus = 0x2640; 23212 t.verticalbar = 0x007c; 23213 t.verticallineabovecmb = 0x030d; 23214 t.verticallinebelowcmb = 0x0329; 23215 t.verticallinelowmod = 0x02cc; 23216 t.verticallinemod = 0x02c8; 23217 t.vewarmenian = 0x057e; 23218 t.vhook = 0x028b; 23219 t.vikatakana = 0x30f8; 23220 t.viramabengali = 0x09cd; 23221 t.viramadeva = 0x094d; 23222 t.viramagujarati = 0x0acd; 23223 t.visargabengali = 0x0983; 23224 t.visargadeva = 0x0903; 23225 t.visargagujarati = 0x0a83; 23226 t.vmonospace = 0xff56; 23227 t.voarmenian = 0x0578; 23228 t.voicediterationhiragana = 0x309e; 23229 t.voicediterationkatakana = 0x30fe; 23230 t.voicedmarkkana = 0x309b; 23231 t.voicedmarkkanahalfwidth = 0xff9e; 23232 t.vokatakana = 0x30fa; 23233 t.vparen = 0x24b1; 23234 t.vtilde = 0x1e7d; 23235 t.vturned = 0x028c; 23236 t.vuhiragana = 0x3094; 23237 t.vukatakana = 0x30f4; 23238 t.w = 0x0077; 23239 t.wacute = 0x1e83; 23240 t.waekorean = 0x3159; 23241 t.wahiragana = 0x308f; 23242 t.wakatakana = 0x30ef; 23243 t.wakatakanahalfwidth = 0xff9c; 23244 t.wakorean = 0x3158; 23245 t.wasmallhiragana = 0x308e; 23246 t.wasmallkatakana = 0x30ee; 23247 t.wattosquare = 0x3357; 23248 t.wavedash = 0x301c; 23249 t.wavyunderscorevertical = 0xfe34; 23250 t.wawarabic = 0x0648; 23251 t.wawfinalarabic = 0xfeee; 23252 t.wawhamzaabovearabic = 0x0624; 23253 t.wawhamzaabovefinalarabic = 0xfe86; 23254 t.wbsquare = 0x33dd; 23255 t.wcircle = 0x24e6; 23256 t.wcircumflex = 0x0175; 23257 t.wdieresis = 0x1e85; 23258 t.wdotaccent = 0x1e87; 23259 t.wdotbelow = 0x1e89; 23260 t.wehiragana = 0x3091; 23261 t.weierstrass = 0x2118; 23262 t.wekatakana = 0x30f1; 23263 t.wekorean = 0x315e; 23264 t.weokorean = 0x315d; 23265 t.wgrave = 0x1e81; 23266 t.whitebullet = 0x25e6; 23267 t.whitecircle = 0x25cb; 23268 t.whitecircleinverse = 0x25d9; 23269 t.whitecornerbracketleft = 0x300e; 23270 t.whitecornerbracketleftvertical = 0xfe43; 23271 t.whitecornerbracketright = 0x300f; 23272 t.whitecornerbracketrightvertical = 0xfe44; 23273 t.whitediamond = 0x25c7; 23274 t.whitediamondcontainingblacksmalldiamond = 0x25c8; 23275 t.whitedownpointingsmalltriangle = 0x25bf; 23276 t.whitedownpointingtriangle = 0x25bd; 23277 t.whiteleftpointingsmalltriangle = 0x25c3; 23278 t.whiteleftpointingtriangle = 0x25c1; 23279 t.whitelenticularbracketleft = 0x3016; 23280 t.whitelenticularbracketright = 0x3017; 23281 t.whiterightpointingsmalltriangle = 0x25b9; 23282 t.whiterightpointingtriangle = 0x25b7; 23283 t.whitesmallsquare = 0x25ab; 23284 t.whitesmilingface = 0x263a; 23285 t.whitesquare = 0x25a1; 23286 t.whitestar = 0x2606; 23287 t.whitetelephone = 0x260f; 23288 t.whitetortoiseshellbracketleft = 0x3018; 23289 t.whitetortoiseshellbracketright = 0x3019; 23290 t.whiteuppointingsmalltriangle = 0x25b5; 23291 t.whiteuppointingtriangle = 0x25b3; 23292 t.wihiragana = 0x3090; 23293 t.wikatakana = 0x30f0; 23294 t.wikorean = 0x315f; 23295 t.wmonospace = 0xff57; 23296 t.wohiragana = 0x3092; 23297 t.wokatakana = 0x30f2; 23298 t.wokatakanahalfwidth = 0xff66; 23299 t.won = 0x20a9; 23300 t.wonmonospace = 0xffe6; 23301 t.wowaenthai = 0x0e27; 23302 t.wparen = 0x24b2; 23303 t.wring = 0x1e98; 23304 t.wsuperior = 0x02b7; 23305 t.wturned = 0x028d; 23306 t.wynn = 0x01bf; 23307 t.x = 0x0078; 23308 t.xabovecmb = 0x033d; 23309 t.xbopomofo = 0x3112; 23310 t.xcircle = 0x24e7; 23311 t.xdieresis = 0x1e8d; 23312 t.xdotaccent = 0x1e8b; 23313 t.xeharmenian = 0x056d; 23314 t.xi = 0x03be; 23315 t.xmonospace = 0xff58; 23316 t.xparen = 0x24b3; 23317 t.xsuperior = 0x02e3; 23318 t.y = 0x0079; 23319 t.yaadosquare = 0x334e; 23320 t.yabengali = 0x09af; 23321 t.yacute = 0x00fd; 23322 t.yadeva = 0x092f; 23323 t.yaekorean = 0x3152; 23324 t.yagujarati = 0x0aaf; 23325 t.yagurmukhi = 0x0a2f; 23326 t.yahiragana = 0x3084; 23327 t.yakatakana = 0x30e4; 23328 t.yakatakanahalfwidth = 0xff94; 23329 t.yakorean = 0x3151; 23330 t.yamakkanthai = 0x0e4e; 23331 t.yasmallhiragana = 0x3083; 23332 t.yasmallkatakana = 0x30e3; 23333 t.yasmallkatakanahalfwidth = 0xff6c; 23334 t.yatcyrillic = 0x0463; 23335 t.ycircle = 0x24e8; 23336 t.ycircumflex = 0x0177; 23337 t.ydieresis = 0x00ff; 23338 t.ydotaccent = 0x1e8f; 23339 t.ydotbelow = 0x1ef5; 23340 t.yeharabic = 0x064a; 23341 t.yehbarreearabic = 0x06d2; 23342 t.yehbarreefinalarabic = 0xfbaf; 23343 t.yehfinalarabic = 0xfef2; 23344 t.yehhamzaabovearabic = 0x0626; 23345 t.yehhamzaabovefinalarabic = 0xfe8a; 23346 t.yehhamzaaboveinitialarabic = 0xfe8b; 23347 t.yehhamzaabovemedialarabic = 0xfe8c; 23348 t.yehinitialarabic = 0xfef3; 23349 t.yehmedialarabic = 0xfef4; 23350 t.yehmeeminitialarabic = 0xfcdd; 23351 t.yehmeemisolatedarabic = 0xfc58; 23352 t.yehnoonfinalarabic = 0xfc94; 23353 t.yehthreedotsbelowarabic = 0x06d1; 23354 t.yekorean = 0x3156; 23355 t.yen = 0x00a5; 23356 t.yenmonospace = 0xffe5; 23357 t.yeokorean = 0x3155; 23358 t.yeorinhieuhkorean = 0x3186; 23359 t.yerahbenyomohebrew = 0x05aa; 23360 t.yerahbenyomolefthebrew = 0x05aa; 23361 t.yericyrillic = 0x044b; 23362 t.yerudieresiscyrillic = 0x04f9; 23363 t.yesieungkorean = 0x3181; 23364 t.yesieungpansioskorean = 0x3183; 23365 t.yesieungsioskorean = 0x3182; 23366 t.yetivhebrew = 0x059a; 23367 t.ygrave = 0x1ef3; 23368 t.yhook = 0x01b4; 23369 t.yhookabove = 0x1ef7; 23370 t.yiarmenian = 0x0575; 23371 t.yicyrillic = 0x0457; 23372 t.yikorean = 0x3162; 23373 t.yinyang = 0x262f; 23374 t.yiwnarmenian = 0x0582; 23375 t.ymonospace = 0xff59; 23376 t.yod = 0x05d9; 23377 t.yoddagesh = 0xfb39; 23378 t.yoddageshhebrew = 0xfb39; 23379 t.yodhebrew = 0x05d9; 23380 t.yodyodhebrew = 0x05f2; 23381 t.yodyodpatahhebrew = 0xfb1f; 23382 t.yohiragana = 0x3088; 23383 t.yoikorean = 0x3189; 23384 t.yokatakana = 0x30e8; 23385 t.yokatakanahalfwidth = 0xff96; 23386 t.yokorean = 0x315b; 23387 t.yosmallhiragana = 0x3087; 23388 t.yosmallkatakana = 0x30e7; 23389 t.yosmallkatakanahalfwidth = 0xff6e; 23390 t.yotgreek = 0x03f3; 23391 t.yoyaekorean = 0x3188; 23392 t.yoyakorean = 0x3187; 23393 t.yoyakthai = 0x0e22; 23394 t.yoyingthai = 0x0e0d; 23395 t.yparen = 0x24b4; 23396 t.ypogegrammeni = 0x037a; 23397 t.ypogegrammenigreekcmb = 0x0345; 23398 t.yr = 0x01a6; 23399 t.yring = 0x1e99; 23400 t.ysuperior = 0x02b8; 23401 t.ytilde = 0x1ef9; 23402 t.yturned = 0x028e; 23403 t.yuhiragana = 0x3086; 23404 t.yuikorean = 0x318c; 23405 t.yukatakana = 0x30e6; 23406 t.yukatakanahalfwidth = 0xff95; 23407 t.yukorean = 0x3160; 23408 t.yusbigcyrillic = 0x046b; 23409 t.yusbigiotifiedcyrillic = 0x046d; 23410 t.yuslittlecyrillic = 0x0467; 23411 t.yuslittleiotifiedcyrillic = 0x0469; 23412 t.yusmallhiragana = 0x3085; 23413 t.yusmallkatakana = 0x30e5; 23414 t.yusmallkatakanahalfwidth = 0xff6d; 23415 t.yuyekorean = 0x318b; 23416 t.yuyeokorean = 0x318a; 23417 t.yyabengali = 0x09df; 23418 t.yyadeva = 0x095f; 23419 t.z = 0x007a; 23420 t.zaarmenian = 0x0566; 23421 t.zacute = 0x017a; 23422 t.zadeva = 0x095b; 23423 t.zagurmukhi = 0x0a5b; 23424 t.zaharabic = 0x0638; 23425 t.zahfinalarabic = 0xfec6; 23426 t.zahinitialarabic = 0xfec7; 23427 t.zahiragana = 0x3056; 23428 t.zahmedialarabic = 0xfec8; 23429 t.zainarabic = 0x0632; 23430 t.zainfinalarabic = 0xfeb0; 23431 t.zakatakana = 0x30b6; 23432 t.zaqefgadolhebrew = 0x0595; 23433 t.zaqefqatanhebrew = 0x0594; 23434 t.zarqahebrew = 0x0598; 23435 t.zayin = 0x05d6; 23436 t.zayindagesh = 0xfb36; 23437 t.zayindageshhebrew = 0xfb36; 23438 t.zayinhebrew = 0x05d6; 23439 t.zbopomofo = 0x3117; 23440 t.zcaron = 0x017e; 23441 t.zcircle = 0x24e9; 23442 t.zcircumflex = 0x1e91; 23443 t.zcurl = 0x0291; 23444 t.zdot = 0x017c; 23445 t.zdotaccent = 0x017c; 23446 t.zdotbelow = 0x1e93; 23447 t.zecyrillic = 0x0437; 23448 t.zedescendercyrillic = 0x0499; 23449 t.zedieresiscyrillic = 0x04df; 23450 t.zehiragana = 0x305c; 23451 t.zekatakana = 0x30bc; 23452 t.zero = 0x0030; 23453 t.zeroarabic = 0x0660; 23454 t.zerobengali = 0x09e6; 23455 t.zerodeva = 0x0966; 23456 t.zerogujarati = 0x0ae6; 23457 t.zerogurmukhi = 0x0a66; 23458 t.zerohackarabic = 0x0660; 23459 t.zeroinferior = 0x2080; 23460 t.zeromonospace = 0xff10; 23461 t.zerooldstyle = 0xf730; 23462 t.zeropersian = 0x06f0; 23463 t.zerosuperior = 0x2070; 23464 t.zerothai = 0x0e50; 23465 t.zerowidthjoiner = 0xfeff; 23466 t.zerowidthnonjoiner = 0x200c; 23467 t.zerowidthspace = 0x200b; 23468 t.zeta = 0x03b6; 23469 t.zhbopomofo = 0x3113; 23470 t.zhearmenian = 0x056a; 23471 t.zhebrevecyrillic = 0x04c2; 23472 t.zhecyrillic = 0x0436; 23473 t.zhedescendercyrillic = 0x0497; 23474 t.zhedieresiscyrillic = 0x04dd; 23475 t.zihiragana = 0x3058; 23476 t.zikatakana = 0x30b8; 23477 t.zinorhebrew = 0x05ae; 23478 t.zlinebelow = 0x1e95; 23479 t.zmonospace = 0xff5a; 23480 t.zohiragana = 0x305e; 23481 t.zokatakana = 0x30be; 23482 t.zparen = 0x24b5; 23483 t.zretroflexhook = 0x0290; 23484 t.zstroke = 0x01b6; 23485 t.zuhiragana = 0x305a; 23486 t.zukatakana = 0x30ba; 23487 t[".notdef"] = 0x0000; 23488 t.angbracketleftbig = 0x2329; 23489 t.angbracketleftBig = 0x2329; 23490 t.angbracketleftbigg = 0x2329; 23491 t.angbracketleftBigg = 0x2329; 23492 t.angbracketrightBig = 0x232a; 23493 t.angbracketrightbig = 0x232a; 23494 t.angbracketrightBigg = 0x232a; 23495 t.angbracketrightbigg = 0x232a; 23496 t.arrowhookleft = 0x21aa; 23497 t.arrowhookright = 0x21a9; 23498 t.arrowlefttophalf = 0x21bc; 23499 t.arrowleftbothalf = 0x21bd; 23500 t.arrownortheast = 0x2197; 23501 t.arrownorthwest = 0x2196; 23502 t.arrowrighttophalf = 0x21c0; 23503 t.arrowrightbothalf = 0x21c1; 23504 t.arrowsoutheast = 0x2198; 23505 t.arrowsouthwest = 0x2199; 23506 t.backslashbig = 0x2216; 23507 t.backslashBig = 0x2216; 23508 t.backslashBigg = 0x2216; 23509 t.backslashbigg = 0x2216; 23510 t.bardbl = 0x2016; 23511 t.bracehtipdownleft = 0xfe37; 23512 t.bracehtipdownright = 0xfe37; 23513 t.bracehtipupleft = 0xfe38; 23514 t.bracehtipupright = 0xfe38; 23515 t.braceleftBig = 0x007b; 23516 t.braceleftbig = 0x007b; 23517 t.braceleftbigg = 0x007b; 23518 t.braceleftBigg = 0x007b; 23519 t.bracerightBig = 0x007d; 23520 t.bracerightbig = 0x007d; 23521 t.bracerightbigg = 0x007d; 23522 t.bracerightBigg = 0x007d; 23523 t.bracketleftbig = 0x005b; 23524 t.bracketleftBig = 0x005b; 23525 t.bracketleftbigg = 0x005b; 23526 t.bracketleftBigg = 0x005b; 23527 t.bracketrightBig = 0x005d; 23528 t.bracketrightbig = 0x005d; 23529 t.bracketrightbigg = 0x005d; 23530 t.bracketrightBigg = 0x005d; 23531 t.ceilingleftbig = 0x2308; 23532 t.ceilingleftBig = 0x2308; 23533 t.ceilingleftBigg = 0x2308; 23534 t.ceilingleftbigg = 0x2308; 23535 t.ceilingrightbig = 0x2309; 23536 t.ceilingrightBig = 0x2309; 23537 t.ceilingrightbigg = 0x2309; 23538 t.ceilingrightBigg = 0x2309; 23539 t.circledotdisplay = 0x2299; 23540 t.circledottext = 0x2299; 23541 t.circlemultiplydisplay = 0x2297; 23542 t.circlemultiplytext = 0x2297; 23543 t.circleplusdisplay = 0x2295; 23544 t.circleplustext = 0x2295; 23545 t.contintegraldisplay = 0x222e; 23546 t.contintegraltext = 0x222e; 23547 t.coproductdisplay = 0x2210; 23548 t.coproducttext = 0x2210; 23549 t.floorleftBig = 0x230a; 23550 t.floorleftbig = 0x230a; 23551 t.floorleftbigg = 0x230a; 23552 t.floorleftBigg = 0x230a; 23553 t.floorrightbig = 0x230b; 23554 t.floorrightBig = 0x230b; 23555 t.floorrightBigg = 0x230b; 23556 t.floorrightbigg = 0x230b; 23557 t.hatwide = 0x0302; 23558 t.hatwider = 0x0302; 23559 t.hatwidest = 0x0302; 23560 t.intercal = 0x1d40; 23561 t.integraldisplay = 0x222b; 23562 t.integraltext = 0x222b; 23563 t.intersectiondisplay = 0x22c2; 23564 t.intersectiontext = 0x22c2; 23565 t.logicalanddisplay = 0x2227; 23566 t.logicalandtext = 0x2227; 23567 t.logicalordisplay = 0x2228; 23568 t.logicalortext = 0x2228; 23569 t.parenleftBig = 0x0028; 23570 t.parenleftbig = 0x0028; 23571 t.parenleftBigg = 0x0028; 23572 t.parenleftbigg = 0x0028; 23573 t.parenrightBig = 0x0029; 23574 t.parenrightbig = 0x0029; 23575 t.parenrightBigg = 0x0029; 23576 t.parenrightbigg = 0x0029; 23577 t.prime = 0x2032; 23578 t.productdisplay = 0x220f; 23579 t.producttext = 0x220f; 23580 t.radicalbig = 0x221a; 23581 t.radicalBig = 0x221a; 23582 t.radicalBigg = 0x221a; 23583 t.radicalbigg = 0x221a; 23584 t.radicalbt = 0x221a; 23585 t.radicaltp = 0x221a; 23586 t.radicalvertex = 0x221a; 23587 t.slashbig = 0x002f; 23588 t.slashBig = 0x002f; 23589 t.slashBigg = 0x002f; 23590 t.slashbigg = 0x002f; 23591 t.summationdisplay = 0x2211; 23592 t.summationtext = 0x2211; 23593 t.tildewide = 0x02dc; 23594 t.tildewider = 0x02dc; 23595 t.tildewidest = 0x02dc; 23596 t.uniondisplay = 0x22c3; 23597 t.unionmultidisplay = 0x228e; 23598 t.unionmultitext = 0x228e; 23599 t.unionsqdisplay = 0x2294; 23600 t.unionsqtext = 0x2294; 23601 t.uniontext = 0x22c3; 23602 t.vextenddouble = 0x2225; 23603 t.vextendsingle = 0x2223; 23604}); 23605const getDingbatsGlyphsUnicode = getLookupTableFactory(function (t) { 23606 t.space = 0x0020; 23607 t.a1 = 0x2701; 23608 t.a2 = 0x2702; 23609 t.a202 = 0x2703; 23610 t.a3 = 0x2704; 23611 t.a4 = 0x260e; 23612 t.a5 = 0x2706; 23613 t.a119 = 0x2707; 23614 t.a118 = 0x2708; 23615 t.a117 = 0x2709; 23616 t.a11 = 0x261b; 23617 t.a12 = 0x261e; 23618 t.a13 = 0x270c; 23619 t.a14 = 0x270d; 23620 t.a15 = 0x270e; 23621 t.a16 = 0x270f; 23622 t.a105 = 0x2710; 23623 t.a17 = 0x2711; 23624 t.a18 = 0x2712; 23625 t.a19 = 0x2713; 23626 t.a20 = 0x2714; 23627 t.a21 = 0x2715; 23628 t.a22 = 0x2716; 23629 t.a23 = 0x2717; 23630 t.a24 = 0x2718; 23631 t.a25 = 0x2719; 23632 t.a26 = 0x271a; 23633 t.a27 = 0x271b; 23634 t.a28 = 0x271c; 23635 t.a6 = 0x271d; 23636 t.a7 = 0x271e; 23637 t.a8 = 0x271f; 23638 t.a9 = 0x2720; 23639 t.a10 = 0x2721; 23640 t.a29 = 0x2722; 23641 t.a30 = 0x2723; 23642 t.a31 = 0x2724; 23643 t.a32 = 0x2725; 23644 t.a33 = 0x2726; 23645 t.a34 = 0x2727; 23646 t.a35 = 0x2605; 23647 t.a36 = 0x2729; 23648 t.a37 = 0x272a; 23649 t.a38 = 0x272b; 23650 t.a39 = 0x272c; 23651 t.a40 = 0x272d; 23652 t.a41 = 0x272e; 23653 t.a42 = 0x272f; 23654 t.a43 = 0x2730; 23655 t.a44 = 0x2731; 23656 t.a45 = 0x2732; 23657 t.a46 = 0x2733; 23658 t.a47 = 0x2734; 23659 t.a48 = 0x2735; 23660 t.a49 = 0x2736; 23661 t.a50 = 0x2737; 23662 t.a51 = 0x2738; 23663 t.a52 = 0x2739; 23664 t.a53 = 0x273a; 23665 t.a54 = 0x273b; 23666 t.a55 = 0x273c; 23667 t.a56 = 0x273d; 23668 t.a57 = 0x273e; 23669 t.a58 = 0x273f; 23670 t.a59 = 0x2740; 23671 t.a60 = 0x2741; 23672 t.a61 = 0x2742; 23673 t.a62 = 0x2743; 23674 t.a63 = 0x2744; 23675 t.a64 = 0x2745; 23676 t.a65 = 0x2746; 23677 t.a66 = 0x2747; 23678 t.a67 = 0x2748; 23679 t.a68 = 0x2749; 23680 t.a69 = 0x274a; 23681 t.a70 = 0x274b; 23682 t.a71 = 0x25cf; 23683 t.a72 = 0x274d; 23684 t.a73 = 0x25a0; 23685 t.a74 = 0x274f; 23686 t.a203 = 0x2750; 23687 t.a75 = 0x2751; 23688 t.a204 = 0x2752; 23689 t.a76 = 0x25b2; 23690 t.a77 = 0x25bc; 23691 t.a78 = 0x25c6; 23692 t.a79 = 0x2756; 23693 t.a81 = 0x25d7; 23694 t.a82 = 0x2758; 23695 t.a83 = 0x2759; 23696 t.a84 = 0x275a; 23697 t.a97 = 0x275b; 23698 t.a98 = 0x275c; 23699 t.a99 = 0x275d; 23700 t.a100 = 0x275e; 23701 t.a101 = 0x2761; 23702 t.a102 = 0x2762; 23703 t.a103 = 0x2763; 23704 t.a104 = 0x2764; 23705 t.a106 = 0x2765; 23706 t.a107 = 0x2766; 23707 t.a108 = 0x2767; 23708 t.a112 = 0x2663; 23709 t.a111 = 0x2666; 23710 t.a110 = 0x2665; 23711 t.a109 = 0x2660; 23712 t.a120 = 0x2460; 23713 t.a121 = 0x2461; 23714 t.a122 = 0x2462; 23715 t.a123 = 0x2463; 23716 t.a124 = 0x2464; 23717 t.a125 = 0x2465; 23718 t.a126 = 0x2466; 23719 t.a127 = 0x2467; 23720 t.a128 = 0x2468; 23721 t.a129 = 0x2469; 23722 t.a130 = 0x2776; 23723 t.a131 = 0x2777; 23724 t.a132 = 0x2778; 23725 t.a133 = 0x2779; 23726 t.a134 = 0x277a; 23727 t.a135 = 0x277b; 23728 t.a136 = 0x277c; 23729 t.a137 = 0x277d; 23730 t.a138 = 0x277e; 23731 t.a139 = 0x277f; 23732 t.a140 = 0x2780; 23733 t.a141 = 0x2781; 23734 t.a142 = 0x2782; 23735 t.a143 = 0x2783; 23736 t.a144 = 0x2784; 23737 t.a145 = 0x2785; 23738 t.a146 = 0x2786; 23739 t.a147 = 0x2787; 23740 t.a148 = 0x2788; 23741 t.a149 = 0x2789; 23742 t.a150 = 0x278a; 23743 t.a151 = 0x278b; 23744 t.a152 = 0x278c; 23745 t.a153 = 0x278d; 23746 t.a154 = 0x278e; 23747 t.a155 = 0x278f; 23748 t.a156 = 0x2790; 23749 t.a157 = 0x2791; 23750 t.a158 = 0x2792; 23751 t.a159 = 0x2793; 23752 t.a160 = 0x2794; 23753 t.a161 = 0x2192; 23754 t.a163 = 0x2194; 23755 t.a164 = 0x2195; 23756 t.a196 = 0x2798; 23757 t.a165 = 0x2799; 23758 t.a192 = 0x279a; 23759 t.a166 = 0x279b; 23760 t.a167 = 0x279c; 23761 t.a168 = 0x279d; 23762 t.a169 = 0x279e; 23763 t.a170 = 0x279f; 23764 t.a171 = 0x27a0; 23765 t.a172 = 0x27a1; 23766 t.a173 = 0x27a2; 23767 t.a162 = 0x27a3; 23768 t.a174 = 0x27a4; 23769 t.a175 = 0x27a5; 23770 t.a176 = 0x27a6; 23771 t.a177 = 0x27a7; 23772 t.a178 = 0x27a8; 23773 t.a179 = 0x27a9; 23774 t.a193 = 0x27aa; 23775 t.a180 = 0x27ab; 23776 t.a199 = 0x27ac; 23777 t.a181 = 0x27ad; 23778 t.a200 = 0x27ae; 23779 t.a182 = 0x27af; 23780 t.a201 = 0x27b1; 23781 t.a183 = 0x27b2; 23782 t.a184 = 0x27b3; 23783 t.a197 = 0x27b4; 23784 t.a185 = 0x27b5; 23785 t.a194 = 0x27b6; 23786 t.a198 = 0x27b7; 23787 t.a186 = 0x27b8; 23788 t.a195 = 0x27b9; 23789 t.a187 = 0x27ba; 23790 t.a188 = 0x27bb; 23791 t.a189 = 0x27bc; 23792 t.a190 = 0x27bd; 23793 t.a191 = 0x27be; 23794 t.a89 = 0x2768; 23795 t.a90 = 0x2769; 23796 t.a93 = 0x276a; 23797 t.a94 = 0x276b; 23798 t.a91 = 0x276c; 23799 t.a92 = 0x276d; 23800 t.a205 = 0x276e; 23801 t.a85 = 0x276f; 23802 t.a206 = 0x2770; 23803 t.a86 = 0x2771; 23804 t.a87 = 0x2772; 23805 t.a88 = 0x2773; 23806 t.a95 = 0x2774; 23807 t.a96 = 0x2775; 23808 t[".notdef"] = 0x0000; 23809}); 23810 23811;// ./src/core/unicode.js 23812
23813 23814
vendor: 5,594 bytes, lines 23815-23918
23815const getSpecialPUASymbols = getLookupTableFactory(function (t) { 23816 t[63721] = 0x00a9; 23817 t[63193] = 0x00a9; 23818 t[63720] = 0x00ae; 23819 t[63194] = 0x00ae; 23820 t[63722] = 0x2122; 23821 t[63195] = 0x2122; 23822 t[63729] = 0x23a7; 23823 t[63730] = 0x23a8; 23824 t[63731] = 0x23a9; 23825 t[63740] = 0x23ab; 23826 t[63741] = 0x23ac; 23827 t[63742] = 0x23ad; 23828 t[63726] = 0x23a1; 23829 t[63727] = 0x23a2; 23830 t[63728] = 0x23a3; 23831 t[63737] = 0x23a4; 23832 t[63738] = 0x23a5; 23833 t[63739] = 0x23a6; 23834 t[63723] = 0x239b; 23835 t[63724] = 0x239c; 23836 t[63725] = 0x239d; 23837 t[63734] = 0x239e; 23838 t[63735] = 0x239f; 23839 t[63736] = 0x23a0; 23840}); 23841function mapSpecialUnicodeValues(code) { 23842 if (code >= 0xfff0 && code <= 0xffff) { 23843 return 0; 23844 } else if (code >= 0xf600 && code <= 0xf8ff) { 23845 return getSpecialPUASymbols()[code] || code; 23846 } else if (code === 0x00ad) { 23847 return 0x002d; 23848 } 23849 return code; 23850} 23851function getUnicodeForGlyph(name, glyphsUnicodeMap) { 23852 let unicode = glyphsUnicodeMap[name]; 23853 if (unicode !== undefined) { 23854 return unicode; 23855 } 23856 if (!name) { 23857 return -1; 23858 } 23859 if (name[0] === "u") { 23860 const nameLen = name.length; 23861 let hexStr; 23862 if (nameLen === 7 && name[1] === "n" && name[2] === "i") { 23863 hexStr = name.substring(3); 23864 } else if (nameLen >= 5 && nameLen <= 7) { 23865 hexStr = name.substring(1); 23866 } else { 23867 return -1; 23868 } 23869 if (hexStr === hexStr.toUpperCase()) { 23870 unicode = parseInt(hexStr, 16); 23871 if (unicode >= 0) { 23872 return unicode; 23873 } 23874 } 23875 } 23876 return -1; 23877} 23878const UnicodeRanges = [[0x0000, 0x007f], [0x0080, 0x00ff], [0x0100, 0x017f], [0x0180, 0x024f], [0x0250, 0x02af, 0x1d00, 0x1d7f, 0x1d80, 0x1dbf], [0x02b0, 0x02ff, 0xa700, 0xa71f], [0x0300, 0x036f, 0x1dc0, 0x1dff], [0x0370, 0x03ff], [0x2c80, 0x2cff], [0x0400, 0x04ff, 0x0500, 0x052f, 0x2de0, 0x2dff, 0xa640, 0xa69f], [0x0530, 0x058f], [0x0590, 0x05ff], [0xa500, 0xa63f], [0x0600, 0x06ff, 0x0750, 0x077f], [0x07c0, 0x07ff], [0x0900, 0x097f], [0x0980, 0x09ff], [0x0a00, 0x0a7f], [0x0a80, 0x0aff], [0x0b00, 0x0b7f], [0x0b80, 0x0bff], [0x0c00, 0x0c7f], [0x0c80, 0x0cff], [0x0d00, 0x0d7f], [0x0e00, 0x0e7f], [0x0e80, 0x0eff], [0x10a0, 0x10ff, 0x2d00, 0x2d2f], [0x1b00, 0x1b7f], [0x1100, 0x11ff], [0x1e00, 0x1eff, 0x2c60, 0x2c7f, 0xa720, 0xa7ff], [0x1f00, 0x1fff], [0x2000, 0x206f, 0x2e00, 0x2e7f], [0x2070, 0x209f], [0x20a0, 0x20cf], [0x20d0, 0x20ff], [0x2100, 0x214f], [0x2150, 0x218f], [0x2190, 0x21ff, 0x27f0, 0x27ff, 0x2900, 0x297f, 0x2b00, 0x2bff], [0x2200, 0x22ff, 0x2a00, 0x2aff, 0x27c0, 0x27ef, 0x2980, 0x29ff], [0x2300, 0x23ff], [0x2400, 0x243f], [0x2440, 0x245f], [0x2460, 0x24ff], [0x2500, 0x257f], [0x2580, 0x259f], [0x25a0, 0x25ff], [0x2600, 0x26ff], [0x2700, 0x27bf], [0x3000, 0x303f], [0x3040, 0x309f], [0x30a0, 0x30ff, 0x31f0, 0x31ff], [0x3100, 0x312f, 0x31a0, 0x31bf], [0x3130, 0x318f], [0xa840, 0xa87f], [0x3200, 0x32ff], [0x3300, 0x33ff], [0xac00, 0xd7af], [0xd800, 0xdfff], [0x10900, 0x1091f], [0x4e00, 0x9fff, 0x2e80, 0x2eff, 0x2f00, 0x2fdf, 0x2ff0, 0x2fff, 0x3400, 0x4dbf, 0x20000, 0x2a6df, 0x3190, 0x319f], [0xe000, 0xf8ff], [0x31c0, 0x31ef, 0xf900, 0xfaff, 0x2f800, 0x2fa1f], [0xfb00, 0xfb4f], [0xfb50, 0xfdff], [0xfe20, 0xfe2f], [0xfe10, 0xfe1f], [0xfe50, 0xfe6f], [0xfe70, 0xfeff], [0xff00, 0xffef], [0xfff0, 0xffff], [0x0f00, 0x0fff], [0x0700, 0x074f], [0x0780, 0x07bf], [0x0d80, 0x0dff], [0x1000, 0x109f], [0x1200, 0x137f, 0x1380, 0x139f, 0x2d80, 0x2ddf], [0x13a0, 0x13ff], [0x1400, 0x167f], [0x1680, 0x169f], [0x16a0, 0x16ff], [0x1780, 0x17ff], [0x1800, 0x18af], [0x2800, 0x28ff], [0xa000, 0xa48f], [0x1700, 0x171f, 0x1720, 0x173f, 0x1740, 0x175f, 0x1760, 0x177f], [0x10300, 0x1032f], [0x10330, 0x1034f], [0x10400, 0x1044f], [0x1d000, 0x1d0ff, 0x1d100, 0x1d1ff, 0x1d200, 0x1d24f], [0x1d400, 0x1d7ff], [0xff000, 0xffffd], [0xfe00, 0xfe0f, 0xe0100, 0xe01ef], [0xe0000, 0xe007f], [0x1900, 0x194f], [0x1950, 0x197f], [0x1980, 0x19df], [0x1a00, 0x1a1f], [0x2c00, 0x2c5f], [0x2d30, 0x2d7f], [0x4dc0, 0x4dff], [0xa800, 0xa82f], [0x10000, 0x1007f, 0x10080, 0x100ff, 0x10100, 0x1013f], [0x10140, 0x1018f], [0x10380, 0x1039f], [0x103a0, 0x103df], [0x10450, 0x1047f], [0x10480, 0x104af], [0x10800, 0x1083f], [0x10a00, 0x10a5f], [0x1d300, 0x1d35f], [0x12000, 0x123ff, 0x12400, 0x1247f], [0x1d360, 0x1d37f], [0x1b80, 0x1bbf], [0x1c00, 0x1c4f], [0x1c50, 0x1c7f], [0xa880, 0xa8df], [0xa900, 0xa92f], [0xa930, 0xa95f], [0xaa00, 0xaa5f], [0x10190, 0x101cf], [0x101d0, 0x101ff], [0x102a0, 0x102df, 0x10280, 0x1029f, 0x10920, 0x1093f], [0x1f030, 0x1f09f, 0x1f000, 0x1f02f]]; 23879function getUnicodeRangeFor(value, lastPosition = -1) { 23880 if (lastPosition !== -1) { 23881 const range = UnicodeRanges[lastPosition]; 23882 for (let i = 0, ii = range.length; i < ii; i += 2) { 23883 if (value >= range[i] && value <= range[i + 1]) { 23884 return lastPosition; 23885 } 23886 } 23887 } 23888 for (let i = 0, ii = UnicodeRanges.length; i < ii; i++) { 23889 const range = UnicodeRanges[i]; 23890 for (let j = 0, jj = range.length; j < jj; j += 2) { 23891 if (value >= range[j] && value <= range[j + 1]) { 23892 return i; 23893 } 23894 } 23895 } 23896 return -1; 23897} 23898const SpecialCharRegExp = new RegExp("^(\\s)|(\\p{Mn})|(\\p{Cf})$", "u"); 23899const CategoryCache = new Map(); 23900function getCharUnicodeCategory(char) { 23901 const cachedCategory = CategoryCache.get(char); 23902 if (cachedCategory) { 23903 return cachedCategory; 23904 } 23905 const groups = char.match(SpecialCharRegExp); 23906 const category = { 23907 isWhitespace: !!groups?.[1], 23908 isZeroWidthDiacritic: !!groups?.[2], 23909 isInvisibleFormatMark: !!groups?.[3] 23910 }; 23911 CategoryCache.set(char, category); 23912 return category; 23913} 23914function clearUnicodeCaches() { 23915 CategoryCache.clear(); 23916} 23917 23918;// ./src/core/fonts_utils.js
vendor: 15,479 bytes, lines 23918-24199
23918 23919 23920 23921 23922 23923 23924 23925 23926 23927 23928 23929 23930 23931 23932 23933const SEAC_ANALYSIS_ENABLED = true; 23934const FontFlags = { 23935 FixedPitch: 1, 23936 Serif: 2, 23937 Symbolic: 4, 23938 Script: 8, 23939 Nonsymbolic: 32, 23940 Italic: 64, 23941 AllCap: 65536, 23942 SmallCap: 131072, 23943 ForceBold: 262144 23944}; 23945const MacStandardGlyphOrdering = [".notdef", ".null", "nonmarkingreturn", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "Adieresis", "Aring", "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis", "aacute", "agrave", "acircumflex", "adieresis", "atilde", "aring", "ccedilla", "eacute", "egrave", "ecircumflex", "edieresis", "iacute", "igrave", "icircumflex", "idieresis", "ntilde", "oacute", "ograve", "ocircumflex", "odieresis", "otilde", "uacute", "ugrave", "ucircumflex", "udieresis", "dagger", "degree", "cent", "sterling", "section", "bullet", "paragraph", "germandbls", "registered", "copyright", "trademark", "acute", "dieresis", "notequal", "AE", "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", "yen", "mu", "partialdiff", "summation", "product", "pi", "integral", "ordfeminine", "ordmasculine", "Omega", "ae", "oslash", "questiondown", "exclamdown", "logicalnot", "radical", "florin", "approxequal", "Delta", "guillemotleft", "guillemotright", "ellipsis", "nonbreakingspace", "Agrave", "Atilde", "Otilde", "OE", "oe", "endash", "emdash", "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide", "lozenge", "ydieresis", "Ydieresis", "fraction", "currency", "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", "periodcentered", "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex", "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex", "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi", "circumflex", "tilde", "macron", "breve", "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "Lslash", "lslash", "Scaron", "scaron", "Zcaron", "zcaron", "brokenbar", "Eth", "eth", "Yacute", "yacute", "Thorn", "thorn", "minus", "multiply", "onesuperior", "twosuperior", "threesuperior", "onehalf", "onequarter", "threequarters", "franc", "Gbreve", "gbreve", "Idotaccent", "Scedilla", "scedilla", "Cacute", "cacute", "Ccaron", "ccaron", "dcroat"]; 23946function recoverGlyphName(name, glyphsUnicodeMap) { 23947 if (glyphsUnicodeMap[name] !== undefined) { 23948 return name; 23949 } 23950 const unicode = getUnicodeForGlyph(name, glyphsUnicodeMap); 23951 if (unicode !== -1) { 23952 for (const key in glyphsUnicodeMap) { 23953 if (glyphsUnicodeMap[key] === unicode) { 23954 return key; 23955 } 23956 } 23957 } 23958 info("Unable to recover a standard glyph name for: " + name); 23959 return name; 23960} 23961function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) { 23962 const charCodeToGlyphId = Object.create(null); 23963 let glyphId, charCode, baseEncoding; 23964 const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic); 23965 if (properties.isInternalFont) { 23966 baseEncoding = builtInEncoding; 23967 for (charCode = 0; charCode < baseEncoding.length; charCode++) { 23968 glyphId = glyphNames.indexOf(baseEncoding[charCode]); 23969 charCodeToGlyphId[charCode] = glyphId >= 0 ? glyphId : 0; 23970 } 23971 } else if (properties.baseEncodingName) { 23972 baseEncoding = getEncoding(properties.baseEncodingName); 23973 for (charCode = 0; charCode < baseEncoding.length; charCode++) { 23974 glyphId = glyphNames.indexOf(baseEncoding[charCode]); 23975 charCodeToGlyphId[charCode] = glyphId >= 0 ? glyphId : 0; 23976 } 23977 } else if (isSymbolicFont) { 23978 for (charCode in builtInEncoding) { 23979 charCodeToGlyphId[charCode] = builtInEncoding[charCode]; 23980 } 23981 } else { 23982 baseEncoding = StandardEncoding; 23983 for (charCode = 0; charCode < baseEncoding.length; charCode++) { 23984 glyphId = glyphNames.indexOf(baseEncoding[charCode]); 23985 charCodeToGlyphId[charCode] = glyphId >= 0 ? glyphId : 0; 23986 } 23987 } 23988 const differences = properties.differences; 23989 let glyphsUnicodeMap; 23990 if (differences) { 23991 for (charCode in differences) { 23992 const glyphName = differences[charCode]; 23993 glyphId = glyphNames.indexOf(glyphName); 23994 if (glyphId === -1) { 23995 if (!glyphsUnicodeMap) { 23996 glyphsUnicodeMap = getGlyphsUnicode(); 23997 } 23998 const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap); 23999 if (standardGlyphName !== glyphName) { 24000 glyphId = glyphNames.indexOf(standardGlyphName); 24001 } 24002 } 24003 charCodeToGlyphId[charCode] = glyphId >= 0 ? glyphId : 0; 24004 } 24005 } 24006 return charCodeToGlyphId; 24007} 24008function normalizeFontName(name) { 24009 return name.replaceAll(/[,_]/g, "-").replaceAll(/\s/g, ""); 24010} 24011const getVerticalPresentationForm = getLookupTableFactory(t => { 24012 t[0x2013] = 0xfe32; 24013 t[0x2014] = 0xfe31; 24014 t[0x2025] = 0xfe30; 24015 t[0x2026] = 0xfe19; 24016 t[0x3001] = 0xfe11; 24017 t[0x3002] = 0xfe12; 24018 t[0x3008] = 0xfe3f; 24019 t[0x3009] = 0xfe40; 24020 t[0x300a] = 0xfe3d; 24021 t[0x300b] = 0xfe3e; 24022 t[0x300c] = 0xfe41; 24023 t[0x300d] = 0xfe42; 24024 t[0x300e] = 0xfe43; 24025 t[0x300f] = 0xfe44; 24026 t[0x3010] = 0xfe3b; 24027 t[0x3011] = 0xfe3c; 24028 t[0x3014] = 0xfe39; 24029 t[0x3015] = 0xfe3a; 24030 t[0x3016] = 0xfe17; 24031 t[0x3017] = 0xfe18; 24032 t[0xfe4f] = 0xfe34; 24033 t[0xff01] = 0xfe15; 24034 t[0xff08] = 0xfe35; 24035 t[0xff09] = 0xfe36; 24036 t[0xff0c] = 0xfe10; 24037 t[0xff1a] = 0xfe13; 24038 t[0xff1b] = 0xfe14; 24039 t[0xff1f] = 0xfe16; 24040 t[0xff3b] = 0xfe47; 24041 t[0xff3d] = 0xfe48; 24042 t[0xff3f] = 0xfe33; 24043 t[0xff5b] = 0xfe37; 24044 t[0xff5d] = 0xfe38; 24045}); 24046const MAX_SIZE_TO_COMPILE = 1000; 24047function compileType3Glyph({ 24048 data: img, 24049 width, 24050 height 24051}) { 24052 if (width > MAX_SIZE_TO_COMPILE || height > MAX_SIZE_TO_COMPILE) { 24053 return null; 24054 } 24055 const POINT_TO_PROCESS_LIMIT = 1000; 24056 const POINT_TYPES = new Uint8Array([0, 2, 4, 0, 1, 0, 5, 4, 8, 10, 0, 8, 0, 2, 1, 0]); 24057 const width1 = width + 1; 24058 const points = new Uint8Array(width1 * (height + 1)); 24059 let i, j, j0; 24060 const lineSize = width + 7 & ~7; 24061 const data = new Uint8Array(lineSize * height); 24062 let pos = 0; 24063 for (const elem of img) { 24064 let mask = 128; 24065 while (mask > 0) { 24066 data[pos++] = elem & mask ? 0 : 255; 24067 mask >>= 1; 24068 } 24069 } 24070 let count = 0; 24071 pos = 0; 24072 if (data[pos] !== 0) { 24073 points[0] = 1; 24074 ++count; 24075 } 24076 for (j = 1; j < width; j++) { 24077 if (data[pos] !== data[pos + 1]) { 24078 points[j] = data[pos] ? 2 : 1; 24079 ++count; 24080 } 24081 pos++; 24082 } 24083 if (data[pos] !== 0) { 24084 points[j] = 2; 24085 ++count; 24086 } 24087 for (i = 1; i < height; i++) { 24088 pos = i * lineSize; 24089 j0 = i * width1; 24090 if (data[pos - lineSize] !== data[pos]) { 24091 points[j0] = data[pos] ? 1 : 8; 24092 ++count; 24093 } 24094 let sum = (data[pos] ? 4 : 0) + (data[pos - lineSize] ? 8 : 0); 24095 for (j = 1; j < width; j++) { 24096 sum = (sum >> 2) + (data[pos + 1] ? 4 : 0) + (data[pos - lineSize + 1] ? 8 : 0); 24097 if (POINT_TYPES[sum]) { 24098 points[j0 + j] = POINT_TYPES[sum]; 24099 ++count; 24100 } 24101 pos++; 24102 } 24103 if (data[pos - lineSize] !== data[pos]) { 24104 points[j0 + j] = data[pos] ? 2 : 4; 24105 ++count; 24106 } 24107 if (count > POINT_TO_PROCESS_LIMIT) { 24108 return null; 24109 } 24110 } 24111 pos = lineSize * (height - 1); 24112 j0 = i * width1; 24113 if (data[pos] !== 0) { 24114 points[j0] = 8; 24115 ++count; 24116 } 24117 for (j = 1; j < width; j++) { 24118 if (data[pos] !== data[pos + 1]) { 24119 points[j0 + j] = data[pos] ? 4 : 8; 24120 ++count; 24121 } 24122 pos++; 24123 } 24124 if (data[pos] !== 0) { 24125 points[j0 + j] = 4; 24126 ++count; 24127 } 24128 if (count > POINT_TO_PROCESS_LIMIT) { 24129 return null; 24130 } 24131 const steps = new Int32Array([0, width1, -1, 0, -width1, 0, 0, 0, 1]); 24132 const pathBuf = []; 24133 const { 24134 a, 24135 b, 24136 c, 24137 d, 24138 e, 24139 f 24140 } = new DOMMatrix().scaleSelf(1 / width, -1 / height).translateSelf(0, -height); 24141 for (i = 0; count && i <= height; i++) { 24142 let p = i * width1; 24143 const end = p + width; 24144 while (p < end && !points[p]) { 24145 p++; 24146 } 24147 if (p === end) { 24148 continue; 24149 } 24150 let x = p % width1; 24151 let y = i; 24152 pathBuf.push(DrawOPS.moveTo, a * x + c * y + e, b * x + d * y + f); 24153 const p0 = p; 24154 let type = points[p]; 24155 do { 24156 const step = steps[type]; 24157 do { 24158 p += step; 24159 } while (!points[p]); 24160 const pp = points[p]; 24161 if (pp !== 5 && pp !== 10) { 24162 type = pp; 24163 points[p] = 0; 24164 } else { 24165 type = pp & 0x33 * type >> 4; 24166 points[p] &= type >> 2 | type << 2; 24167 } 24168 x = p % width1; 24169 y = p / width1 | 0; 24170 pathBuf.push(DrawOPS.lineTo, a * x + c * y + e, b * x + d * y + f); 24171 if (!points[p]) { 24172 --count; 24173 } 24174 } while (p0 !== p); 24175 --i; 24176 } 24177 return [OPS.rawFillPath, [new Float32Array(pathBuf)], new Float32Array([0, 0, width, height])]; 24178} 24179 24180// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.to-array.js 24181var es_iterator_to_array = __webpack_require__(1806); 24182;// ./src/core/charsets.js 24183const ISOAdobeCharset = [".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "endash", "dagger", "daggerdbl", "periodcentered", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "questiondown", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "emdash", "AE", "ordfeminine", "Lslash", "Oslash", "OE", "ordmasculine", "ae", "dotlessi", "lslash", "oslash", "oe", "germandbls", "onesuperior", "logicalnot", "mu", "trademark", "Eth", "onehalf", "plusminus", "Thorn", "onequarter", "divide", "brokenbar", "degree", "thorn", "threequarters", "twosuperior", "registered", "minus", "eth", "multiply", "threesuperior", "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave", "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex", "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron", "aacute", "acircumflex", "adieresis", "agrave", "aring", "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis", "egrave", "iacute", "icircumflex", "idieresis", "igrave", "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", "otilde", "scaron", "uacute", "ucircumflex", "udieresis", "ugrave", "yacute", "ydieresis", "zcaron"]; 24184const ExpertCharset = [".notdef", "space", "exclamsmall", "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall", "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash", "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall", "onequarter", "onehalf", "threequarters", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall"]; 24185const ExpertSubsetCharset = [".notdef", "space", "dollaroldstyle", "dollarsuperior", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "hyphensuperior", "colonmonetary", "onefitted", "rupiah", "centoldstyle", "figuredash", "hypheninferior", "onequarter", "onehalf", "threequarters", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior"]; 24186 24187;// ./src/core/cff_parser.js 24188 24189 24190 24191 24192 24193 24194 24195 24196 24197 24198 24199
24200const MAX_SUBR_NESTING = 10; 24201const CFFStandardStrings = [".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "endash", "dagger", "daggerdbl", "periodce
vendor: 8,071 bytes, lines 24201-24441
24201ntered", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "questiondown", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "emdash", "AE", "ordfeminine", "Lslash", "Oslash", "OE", "ordmasculine", "ae", "dotlessi", "lslash", "oslash", "oe", "germandbls", "onesuperior", "logicalnot", "mu", "trademark", "Eth", "onehalf", "plusminus", "Thorn", "onequarter", "divide", "brokenbar", "degree", "thorn", "threequarters", "twosuperior", "registered", "minus", "eth", "multiply", "threesuperior", "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave", "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex", "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron", "aacute", "acircumflex", "adieresis", "agrave", "aring", "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis", "egrave", "iacute", "icircumflex", "idieresis", "igrave", "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", "otilde", "scaron", "uacute", "ucircumflex", "udieresis", "ugrave", "yacute", "ydieresis", "zcaron", "exclamsmall", "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall", "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash", "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall", "001.000", "001.001", "001.002", "001.003", "Black", "Bold", "Book", "Light", "Medium", "Regular", "Roman", "Semibold"]; 24202const NUM_STANDARD_CFF_STRINGS = 391; 24203const CharstringValidationData = [null, { 24204 id: "hstem", 24205 min: 2, 24206 stackClearing: true, 24207 stem: true 24208}, null, { 24209 id: "vstem", 24210 min: 2, 24211 stackClearing: true, 24212 stem: true 24213}, { 24214 id: "vmoveto", 24215 min: 1, 24216 stackClearing: true 24217}, { 24218 id: "rlineto", 24219 min: 2, 24220 resetStack: true 24221}, { 24222 id: "hlineto", 24223 min: 1, 24224 resetStack: true 24225}, { 24226 id: "vlineto", 24227 min: 1, 24228 resetStack: true 24229}, { 24230 id: "rrcurveto", 24231 min: 6, 24232 resetStack: true 24233}, null, { 24234 id: "callsubr", 24235 min: 1 24236}, { 24237 id: "return", 24238 min: 0 24239}, null, null, { 24240 id: "endchar", 24241 min: 0, 24242 stackClearing: true 24243}, null, null, null, { 24244 id: "hstemhm", 24245 min: 2, 24246 stackClearing: true, 24247 stem: true 24248}, { 24249 id: "hintmask", 24250 min: 0, 24251 stackClearing: true 24252}, { 24253 id: "cntrmask", 24254 min: 0, 24255 stackClearing: true 24256}, { 24257 id: "rmoveto", 24258 min: 2, 24259 stackClearing: true 24260}, { 24261 id: "hmoveto", 24262 min: 1, 24263 stackClearing: true 24264}, { 24265 id: "vstemhm", 24266 min: 2, 24267 stackClearing: true, 24268 stem: true 24269}, { 24270 id: "rcurveline", 24271 min: 8, 24272 resetStack: true 24273}, { 24274 id: "rlinecurve", 24275 min: 8, 24276 resetStack: true 24277}, { 24278 id: "vvcurveto", 24279 min: 4, 24280 resetStack: true 24281}, { 24282 id: "hhcurveto", 24283 min: 4, 24284 resetStack: true 24285}, null, { 24286 id: "callgsubr", 24287 min: 1 24288}, { 24289 id: "vhcurveto", 24290 min: 4, 24291 resetStack: true 24292}, { 24293 id: "hvcurveto", 24294 min: 4, 24295 resetStack: true 24296}]; 24297const CharstringValidationData12 = [null, null, null, { 24298 id: "and", 24299 min: 2, 24300 stackDelta: -1 24301}, { 24302 id: "or", 24303 min: 2, 24304 stackDelta: -1 24305}, { 24306 id: "not", 24307 min: 1, 24308 stackDelta: 0 24309}, null, null, null, { 24310 id: "abs", 24311 min: 1, 24312 stackDelta: 0 24313}, { 24314 id: "add", 24315 min: 2, 24316 stackDelta: -1, 24317 stackFn(stack, index) { 24318 stack[index - 2] = stack[index - 2] + stack[index - 1]; 24319 } 24320}, { 24321 id: "sub", 24322 min: 2, 24323 stackDelta: -1, 24324 stackFn(stack, index) { 24325 stack[index - 2] = stack[index - 2] - stack[index - 1]; 24326 } 24327}, { 24328 id: "div", 24329 min: 2, 24330 stackDelta: -1, 24331 stackFn(stack, index) { 24332 stack[index - 2] = stack[index - 2] / stack[index - 1]; 24333 } 24334}, null, { 24335 id: "neg", 24336 min: 1, 24337 stackDelta: 0, 24338 stackFn(stack, index) { 24339 stack[index - 1] = -stack[index - 1]; 24340 } 24341}, { 24342 id: "eq", 24343 min: 2, 24344 stackDelta: -1 24345}, null, null, { 24346 id: "drop", 24347 min: 1, 24348 stackDelta: -1 24349}, null, { 24350 id: "put", 24351 min: 2, 24352 stackDelta: -2 24353}, { 24354 id: "get", 24355 min: 1, 24356 stackDelta: 0 24357}, { 24358 id: "ifelse", 24359 min: 4, 24360 stackDelta: -3 24361}, { 24362 id: "random", 24363 min: 0, 24364 stackDelta: 1 24365}, { 24366 id: "mul", 24367 min: 2, 24368 stackDelta: -1, 24369 stackFn(stack, index) { 24370 stack[index - 2] = stack[index - 2] * stack[index - 1]; 24371 } 24372}, null, { 24373 id: "sqrt", 24374 min: 1, 24375 stackDelta: 0 24376}, { 24377 id: "dup", 24378 min: 1, 24379 stackDelta: 1 24380}, { 24381 id: "exch", 24382 min: 2, 24383 stackDelta: 0 24384}, { 24385 id: "index", 24386 min: 2, 24387 stackDelta: 0 24388}, { 24389 id: "roll", 24390 min: 3, 24391 stackDelta: -2 24392}, null, null, null, { 24393 id: "hflex", 24394 min: 7, 24395 resetStack: true 24396}, { 24397 id: "flex", 24398 min: 13, 24399 resetStack: true 24400}, { 24401 id: "hflex1", 24402 min: 9, 24403 resetStack: true 24404}, { 24405 id: "flex1", 24406 min: 11, 24407 resetStack: true 24408}]; 24409class CFFParser { 24410 constructor(file, properties, seacAnalysisEnabled) { 24411 this.bytes = file.getBytes(); 24412 this.properties = properties; 24413 this.seacAnalysisEnabled = !!seacAnalysisEnabled; 24414 } 24415 parse() { 24416 const properties = this.properties; 24417 const cff = new CFF(this.bytes.length); 24418 this.cff = cff; 24419 const header = this.parseHeader(); 24420 const nameIndex = this.parseIndex(header.endPos); 24421 const topDictIndex = this.parseIndex(nameIndex.endPos); 24422 const stringIndex = this.parseIndex(topDictIndex.endPos); 24423 const globalSubrIndex = this.parseIndex(stringIndex.endPos); 24424 const topDictParsed = this.parseDict(topDictIndex.obj.get(0)); 24425 const topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings); 24426 cff.header = header.obj; 24427 cff.names = this.parseNameIndex(nameIndex.obj); 24428 cff.strings = this.parseStringIndex(stringIndex.obj); 24429 cff.topDict = topDict; 24430 cff.globalSubrIndex = globalSubrIndex.obj; 24431 this.parsePrivateDict(cff.topDict); 24432 cff.isCIDFont = topDict.hasName("ROS"); 24433 const charStringOffset = topDict.getByName("CharStrings"); 24434 const charStringIndex = this.parseIndex(charStringOffset).obj; 24435 cff.charStringCount = charStringIndex.count; 24436 const fontMatrix = topDict.getByName("FontMatrix"); 24437 if (fontMatrix) { 24438 properties.fontMatrix = fontMatrix; 24439 } 24440 const fontBBox = topDict.getByName("FontBBox"); 24441 if (fontBBox
vendor: 11,696 bytes, lines 24441-24805
24441) { 24442 properties.ascent = Math.max(fontBBox[3], fontBBox[1]); 24443 properties.descent = Math.min(fontBBox[1], fontBBox[3]); 24444 properties.ascentScaled = true; 24445 } 24446 let charset, encoding; 24447 if (cff.isCIDFont) { 24448 const fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj; 24449 for (let i = 0, ii = fdArrayIndex.count; i < ii; ++i) { 24450 const dictRaw = fdArrayIndex.get(i); 24451 const fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings); 24452 this.parsePrivateDict(fontDict); 24453 cff.fdArray.push(fontDict); 24454 } 24455 encoding = null; 24456 charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true); 24457 cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count); 24458 } else { 24459 charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false); 24460 encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset); 24461 } 24462 cff.charset = charset; 24463 cff.encoding = encoding; 24464 const charStringsAndSeacs = this.parseCharStrings({ 24465 charStrings: charStringIndex, 24466 localSubrIndex: topDict.privateDict.subrsIndex, 24467 globalSubrIndex: globalSubrIndex.obj, 24468 fdSelect: cff.fdSelect, 24469 fdArray: cff.fdArray, 24470 privateDict: topDict.privateDict 24471 }); 24472 cff.charStrings = charStringsAndSeacs.charStrings; 24473 cff.seacs = charStringsAndSeacs.seacs; 24474 cff.widths = charStringsAndSeacs.widths; 24475 return cff; 24476 } 24477 parseHeader() { 24478 let bytes = this.bytes; 24479 const bytesLength = bytes.length; 24480 let offset = 0; 24481 while (offset < bytesLength && bytes[offset] !== 1) { 24482 ++offset; 24483 } 24484 if (offset >= bytesLength) { 24485 throw new FormatError("Invalid CFF header"); 24486 } 24487 if (offset !== 0) { 24488 info("cff data is shifted"); 24489 bytes = bytes.subarray(offset); 24490 this.bytes = bytes; 24491 } 24492 const major = bytes[0]; 24493 const minor = bytes[1]; 24494 const hdrSize = bytes[2]; 24495 const offSize = bytes[3]; 24496 const header = new CFFHeader(major, minor, hdrSize, offSize); 24497 return { 24498 obj: header, 24499 endPos: hdrSize 24500 }; 24501 } 24502 parseDict(dict) { 24503 const view = new DataView(dict.buffer, dict.byteOffset, dict.bytesLength); 24504 let pos = 0; 24505 function parseOperand() { 24506 let value = dict[pos++]; 24507 if (value === 30) { 24508 return parseFloatOperand(); 24509 } else if (value === 28) { 24510 value = view.getInt16(pos); 24511 pos += 2; 24512 return value; 24513 } else if (value === 29) { 24514 value = view.getInt32(pos); 24515 pos += 4; 24516 return value; 24517 } else if (value >= 32 && value <= 246) { 24518 return value - 139; 24519 } else if (value >= 247 && value <= 250) { 24520 return (value - 247) * 256 + dict[pos++] + 108; 24521 } else if (value >= 251 && value <= 254) { 24522 return -((value - 251) * 256) - dict[pos++] - 108; 24523 } 24524 warn(`CFFParser.parseDict: "${value}" is a reserved command.`); 24525 return NaN; 24526 } 24527 function parseFloatOperand() { 24528 let str = ""; 24529 const eof = 15; 24530 const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"]; 24531 const length = dict.length; 24532 while (pos < length) { 24533 const b = dict[pos++]; 24534 const b1 = b >> 4; 24535 const b2 = b & 15; 24536 if (b1 === eof) { 24537 break; 24538 } 24539 str += lookup[b1]; 24540 if (b2 === eof) { 24541 break; 24542 } 24543 str += lookup[b2]; 24544 } 24545 return parseFloat(str); 24546 } 24547 let operands = []; 24548 const entries = []; 24549 pos = 0; 24550 const end = dict.length; 24551 while (pos < end) { 24552 let b = dict[pos]; 24553 if (b <= 21) { 24554 if (b === 12) { 24555 b = b << 8 | dict[++pos]; 24556 } 24557 entries.push([b, operands]); 24558 operands = []; 24559 ++pos; 24560 } else { 24561 operands.push(parseOperand()); 24562 } 24563 } 24564 return entries; 24565 } 24566 parseIndex(pos) { 24567 const cffIndex = new CFFIndex(); 24568 const bytes = this.bytes; 24569 const count = bytes[pos++] << 8 | bytes[pos++]; 24570 const offsets = []; 24571 let end = pos; 24572 let i, ii; 24573 if (count !== 0) { 24574 const offsetSize = bytes[pos++]; 24575 const startPos = pos + (count + 1) * offsetSize - 1; 24576 for (i = 0, ii = count + 1; i < ii; ++i) { 24577 let offset = 0; 24578 for (let j = 0; j < offsetSize; ++j) { 24579 offset <<= 8; 24580 offset += bytes[pos++]; 24581 } 24582 offsets.push(startPos + offset); 24583 } 24584 end = offsets[count]; 24585 } 24586 for (i = 0, ii = offsets.length - 1; i < ii; ++i) { 24587 const offsetStart = offsets[i]; 24588 const offsetEnd = offsets[i + 1]; 24589 cffIndex.add(bytes.subarray(offsetStart, offsetEnd)); 24590 } 24591 return { 24592 obj: cffIndex, 24593 endPos: end 24594 }; 24595 } 24596 parseNameIndex(index) { 24597 const names = []; 24598 for (let i = 0, ii = index.count; i < ii; ++i) { 24599 const name = index.get(i); 24600 names.push(bytesToString(name)); 24601 } 24602 return names; 24603 } 24604 parseStringIndex(index) { 24605 const strings = new CFFStrings(); 24606 for (let i = 0, ii = index.count; i < ii; ++i) { 24607 const data = index.get(i); 24608 strings.add(bytesToString(data)); 24609 } 24610 return strings; 24611 } 24612 createDict(Type, dict, strings) { 24613 const cffDict = new Type(strings); 24614 for (const [key, value] of dict) { 24615 cffDict.setByKey(key, value); 24616 } 24617 return cffDict; 24618 } 24619 parseCharString(state, data, localSubrIndex, globalSubrIndex) { 24620 if (!data || state.callDepth > MAX_SUBR_NESTING) { 24621 return false; 24622 } 24623 const view = new DataView(data.buffer, data.byteOffset, data.bytesLength); 24624 let stackSize = state.stackSize; 24625 const stack = state.stack; 24626 let length = data.length; 24627 for (let j = 0; j < length;) { 24628 const value = data[j++]; 24629 let validationCommand = null; 24630 if (value === 12) { 24631 const q = data[j++]; 24632 if (q === 0) { 24633 data[j - 2] = 139; 24634 data[j - 1] = 22; 24635 stackSize = 0; 24636 } else { 24637 validationCommand = CharstringValidationData12[q]; 24638 } 24639 } else if (value === 28) { 24640 stack[stackSize] = view.getInt16(j); 24641 j += 2; 24642 stackSize++; 24643 } else if (value === 14) { 24644 if (stackSize >= 4) { 24645 stackSize -= 4; 24646 if (this.seacAnalysisEnabled) { 24647 state.seac = stack.slice(stackSize, stackSize + 4); 24648 return false; 24649 } 24650 } 24651 validationCommand = CharstringValidationData[value]; 24652 } else if (value >= 32 && value <= 246) { 24653 stack[stackSize] = value - 139; 24654 stackSize++; 24655 } else if (value >= 247 && value <= 254) { 24656 stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108; 24657 j++; 24658 stackSize++; 24659 } else if (value === 255) { 24660 stack[stackSize] = view.getInt32(j) / 65536; 24661 j += 4; 24662 stackSize++; 24663 } else if (value === 19 || value === 20) { 24664 state.hints += stackSize >> 1; 24665 if (state.hints === 0) { 24666 data.copyWithin(j - 1, j, -1); 24667 j -= 1; 24668 length -= 1; 24669 continue; 24670 } 24671 j += state.hints + 7 >> 3; 24672 stackSize %= 2; 24673 validationCommand = CharstringValidationData[value]; 24674 } else if (value === 10 || value === 29) { 24675 const subrsIndex = value === 10 ? localSubrIndex : globalSubrIndex; 24676 if (!subrsIndex) { 24677 validationCommand = CharstringValidationData[value]; 24678 warn("Missing subrsIndex for " + validationCommand.id); 24679 return false; 24680 } 24681 let bias = 32768; 24682 if (subrsIndex.count < 1240) { 24683 bias = 107; 24684 } else if (subrsIndex.count < 33900) { 24685 bias = 1131; 24686 } 24687 const subrNumber = stack[--stackSize] + bias; 24688 if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) { 24689 validationCommand = CharstringValidationData[value]; 24690 warn("Out of bounds subrIndex for " + validationCommand.id); 24691 return false; 24692 } 24693 state.stackSize = stackSize; 24694 state.callDepth++; 24695 const valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex); 24696 if (!valid) { 24697 return false; 24698 } 24699 state.callDepth--; 24700 stackSize = state.stackSize; 24701 continue; 24702 } else if (value === 11) { 24703 state.stackSize = stackSize; 24704 return true; 24705 } else if (value === 0 && j === data.length) { 24706 data[j - 1] = 14; 24707 validationCommand = CharstringValidationData[14]; 24708 } else if (value === 9) { 24709 data.copyWithin(j - 1, j, -1); 24710 j -= 1; 24711 length -= 1; 24712 continue; 24713 } else { 24714 validationCommand = CharstringValidationData[value]; 24715 } 24716 if (validationCommand) { 24717 if (validationCommand.stem) { 24718 state.hints += stackSize >> 1; 24719 if (value === 3 || value === 23) { 24720 state.hasVStems = true; 24721 } else if (state.hasVStems && (value === 1 || value === 18)) { 24722 warn("CFF stem hints are in wrong order"); 24723 data[j - 1] = value === 1 ? 3 : 23; 24724 } 24725 } 24726 if (stackSize < validationCommand.min) { 24727 warn("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min); 24728 if (stackSize === 0) { 24729 data[j - 1] = 14; 24730 return true; 24731 } 24732 return false; 24733 } 24734 if (state.firstStackClearing && validationCommand.stackClearing) { 24735 state.firstStackClearing = false; 24736 stackSize -= validationCommand.min; 24737 if (stackSize >= 2 && validationCommand.stem) { 24738 stackSize %= 2; 24739 } else if (stackSize > 1) { 24740 warn("Found too many parameters for stack-clearing command"); 24741 } 24742 if (stackSize > 0) { 24743 state.width = stack[stackSize - 1]; 24744 } 24745 } 24746 if ("stackDelta" in validationCommand) { 24747 if ("stackFn" in validationCommand) { 24748 validationCommand.stackFn(stack, stackSize); 24749 } 24750 stackSize += validationCommand.stackDelta; 24751 } else if (validationCommand.stackClearing || validationCommand.resetStack) { 24752 stackSize = 0; 24753 } 24754 } 24755 } 24756 if (length < data.length) { 24757 data.fill(14, length); 24758 } 24759 state.stackSize = stackSize; 24760 return true; 24761 } 24762 parseCharStrings({ 24763 charStrings, 24764 localSubrIndex, 24765 globalSubrIndex, 24766 fdSelect, 24767 fdArray, 24768 privateDict 24769 }) { 24770 const seacs = []; 24771 const widths = []; 24772 const count = charStrings.count; 24773 for (let i = 0; i < count; i++) { 24774 const charstring = charStrings.get(i); 24775 const state = { 24776 callDepth: 0, 24777 stackSize: 0, 24778 stack: [], 24779 hints: 0, 24780 firstStackClearing: true, 24781 seac: null, 24782 width: null, 24783 hasVStems: false 24784 }; 24785 let valid = true; 24786 let localSubrToUse = null; 24787 let privateDictToUse = privateDict; 24788 if (fdSelect && fdArray.length) { 24789 const fdIndex = fdSelect.getFDIndex(i); 24790 if (fdIndex === -1) { 24791 warn("Glyph index is not in fd select."); 24792 valid = false; 24793 } 24794 if (fdIndex >= fdArray.length) { 24795 warn("Invalid fd index for glyph index."); 24796 valid = false; 24797 } 24798 if (valid) { 24799 privateDictToUse = fdArray[fdIndex].privateDict; 24800 localSubrToUse = privateDictToUse.subrsIndex; 24801 } 24802 } else if (localSubrIndex) { 24803 localSubrToUse = localSubrIndex; 24804 } 24805
vendor: 2,795 bytes, lines 24805-24885
24805if (valid) { 24806 valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex); 24807 } 24808 if (state.width !== null) { 24809 const nominalWidth = privateDictToUse.getByName("nominalWidthX"); 24810 widths[i] = nominalWidth + state.width; 24811 } else { 24812 const defaultWidth = privateDictToUse.getByName("defaultWidthX"); 24813 widths[i] = defaultWidth; 24814 } 24815 if (state.seac !== null) { 24816 seacs[i] = state.seac; 24817 } 24818 if (!valid) { 24819 charStrings.set(i, new Uint8Array([14])); 24820 } 24821 } 24822 return { 24823 charStrings, 24824 seacs, 24825 widths 24826 }; 24827 } 24828 emptyPrivateDictionary(parentDict) { 24829 const privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings); 24830 parentDict.setByKey(18, [0, 0]); 24831 parentDict.privateDict = privateDict; 24832 } 24833 parsePrivateDict(parentDict) { 24834 if (!parentDict.hasName("Private")) { 24835 this.emptyPrivateDictionary(parentDict); 24836 return; 24837 } 24838 const privateOffset = parentDict.getByName("Private"); 24839 if (!Array.isArray(privateOffset) || privateOffset.length !== 2) { 24840 parentDict.removeByName("Private"); 24841 return; 24842 } 24843 const size = privateOffset[0]; 24844 const offset = privateOffset[1]; 24845 if (size === 0 || offset >= this.bytes.length) { 24846 this.emptyPrivateDictionary(parentDict); 24847 return; 24848 } 24849 const privateDictEnd = offset + size; 24850 const dictData = this.bytes.subarray(offset, privateDictEnd); 24851 const dict = this.parseDict(dictData); 24852 const privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings); 24853 parentDict.privateDict = privateDict; 24854 if (privateDict.getByName("ExpansionFactor") === 0) { 24855 privateDict.setByName("ExpansionFactor", 0.06); 24856 } 24857 if (!privateDict.getByName("Subrs")) { 24858 return; 24859 } 24860 const subrsOffset = privateDict.getByName("Subrs"); 24861 const relativeOffset = offset + subrsOffset; 24862 if (subrsOffset === 0 || relativeOffset >= this.bytes.length) { 24863 this.emptyPrivateDictionary(parentDict); 24864 return; 24865 } 24866 const subrsIndex = this.parseIndex(relativeOffset); 24867 privateDict.subrsIndex = subrsIndex.obj; 24868 } 24869 parseCharsets(pos, length, strings, cid) { 24870 if (pos === 0) { 24871 return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, ISOAdobeCharset); 24872 } else if (pos === 1) { 24873 return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, ExpertCharset); 24874 } else if (pos === 2) { 24875 return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, ExpertSubsetCharset); 24876 } 24877 const bytes = this.bytes; 24878 const start = pos; 24879 const format = bytes[pos++]; 24880 const charset = [cid ? 0 : ".notdef"]; 24881 let id, count, i; 24882 length -= 1; 24883 switch (format) { 24884 case 0: 24885 for (i = 0; i < length; i++) {
vendor: 26,032 bytes, lines 24886-25680
24886 id = bytes[pos++] << 8 | bytes[pos++]; 24887 charset.push(cid ? id : strings.get(id)); 24888 } 24889 break; 24890 case 1: 24891 while (charset.length <= length) { 24892 id = bytes[pos++] << 8 | bytes[pos++]; 24893 count = bytes[pos++]; 24894 for (i = 0; i <= count; i++) { 24895 charset.push(cid ? id++ : strings.get(id++)); 24896 } 24897 } 24898 break; 24899 case 2: 24900 while (charset.length <= length) { 24901 id = bytes[pos++] << 8 | bytes[pos++]; 24902 count = bytes[pos++] << 8 | bytes[pos++]; 24903 for (i = 0; i <= count; i++) { 24904 charset.push(cid ? id++ : strings.get(id++)); 24905 } 24906 } 24907 break; 24908 default: 24909 throw new FormatError("Unknown charset format"); 24910 } 24911 const end = pos; 24912 const raw = bytes.subarray(start, end); 24913 return new CFFCharset(false, format, charset, raw); 24914 } 24915 parseEncoding(pos, properties, strings, charset) { 24916 const encoding = Object.create(null); 24917 const bytes = this.bytes; 24918 let predefined = false; 24919 let format, i, ii; 24920 let raw = null; 24921 function readSupplement() { 24922 const supplementsCount = bytes[pos++]; 24923 for (i = 0; i < supplementsCount; i++) { 24924 const code = bytes[pos++]; 24925 const sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff); 24926 encoding[code] = charset.indexOf(strings.get(sid)); 24927 } 24928 } 24929 if (pos === 0 || pos === 1) { 24930 predefined = true; 24931 format = pos; 24932 const baseEncoding = pos ? ExpertEncoding : StandardEncoding; 24933 for (i = 0, ii = charset.length; i < ii; i++) { 24934 const index = baseEncoding.indexOf(charset[i]); 24935 if (index !== -1) { 24936 encoding[index] = i; 24937 } 24938 } 24939 } else { 24940 const dataStart = pos; 24941 format = bytes[pos++]; 24942 switch (format & 0x7f) { 24943 case 0: 24944 const glyphsCount = bytes[pos++]; 24945 for (i = 1; i <= glyphsCount; i++) { 24946 encoding[bytes[pos++]] = i; 24947 } 24948 break; 24949 case 1: 24950 const rangesCount = bytes[pos++]; 24951 let gid = 1; 24952 for (i = 0; i < rangesCount; i++) { 24953 const start = bytes[pos++]; 24954 const left = bytes[pos++]; 24955 for (let j = start; j <= start + left; j++) { 24956 encoding[j] = gid++; 24957 } 24958 } 24959 break; 24960 default: 24961 throw new FormatError(`Unknown encoding format: ${format} in CFF`); 24962 } 24963 const dataEnd = pos; 24964 if (format & 0x80) { 24965 bytes[dataStart] &= 0x7f; 24966 readSupplement(); 24967 } 24968 raw = bytes.subarray(dataStart, dataEnd); 24969 } 24970 format &= 0x7f; 24971 return new CFFEncoding(predefined, format, encoding, raw); 24972 } 24973 parseFDSelect(pos, length) { 24974 const bytes = this.bytes; 24975 const format = bytes[pos++]; 24976 const fdSelect = []; 24977 let i; 24978 switch (format) { 24979 case 0: 24980 for (i = 0; i < length; ++i) { 24981 const id = bytes[pos++]; 24982 fdSelect.push(id); 24983 } 24984 break; 24985 case 3: 24986 const rangesCount = bytes[pos++] << 8 | bytes[pos++]; 24987 for (i = 0; i < rangesCount; ++i) { 24988 let first = bytes[pos++] << 8 | bytes[pos++]; 24989 if (i === 0 && first !== 0) { 24990 warn("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover."); 24991 first = 0; 24992 } 24993 const fdIndex = bytes[pos++]; 24994 const next = bytes[pos] << 8 | bytes[pos + 1]; 24995 for (let j = first; j < next; ++j) { 24996 fdSelect.push(fdIndex); 24997 } 24998 } 24999 pos += 2; 25000 break; 25001 default: 25002 throw new FormatError(`parseFDSelect: Unknown format "${format}".`); 25003 } 25004 if (fdSelect.length !== length) { 25005 throw new FormatError("parseFDSelect: Invalid font data."); 25006 } 25007 return new CFFFDSelect(format, fdSelect); 25008 } 25009} 25010class CFF { 25011 header = null; 25012 names = []; 25013 topDict = null; 25014 strings = new CFFStrings(); 25015 globalSubrIndex = null; 25016 encoding = null; 25017 charset = null; 25018 charStrings = null; 25019 fdArray = []; 25020 fdSelect = null; 25021 isCIDFont = false; 25022 charStringCount = 0; 25023 constructor(rawFileLength = 0) { 25024 this.rawFileLength = rawFileLength; 25025 } 25026 duplicateFirstGlyph() { 25027 if (this.charStrings.count >= 65535) { 25028 warn("Not enough space in charstrings to duplicate first glyph."); 25029 return; 25030 } 25031 const glyphZero = this.charStrings.get(0); 25032 this.charStrings.add(glyphZero); 25033 if (this.isCIDFont) { 25034 this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]); 25035 } 25036 } 25037 hasGlyphId(id) { 25038 if (id < 0 || id >= this.charStrings.count) { 25039 return false; 25040 } 25041 const glyph = this.charStrings.get(id); 25042 return glyph.length > 0; 25043 } 25044} 25045class CFFHeader { 25046 constructor(major, minor, hdrSize, offSize) { 25047 this.major = major; 25048 this.minor = minor; 25049 this.hdrSize = hdrSize; 25050 this.offSize = offSize; 25051 } 25052} 25053class CFFStrings { 25054 strings = []; 25055 get(index) { 25056 if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) { 25057 return CFFStandardStrings[index]; 25058 } 25059 if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) { 25060 return this.strings[index - NUM_STANDARD_CFF_STRINGS]; 25061 } 25062 return CFFStandardStrings[0]; 25063 } 25064 getSID(str) { 25065 let index = CFFStandardStrings.indexOf(str); 25066 if (index !== -1) { 25067 return index; 25068 } 25069 index = this.strings.indexOf(str); 25070 if (index !== -1) { 25071 return index + NUM_STANDARD_CFF_STRINGS; 25072 } 25073 return -1; 25074 } 25075 add(value) { 25076 this.strings.push(value); 25077 } 25078 get count() { 25079 return this.strings.length; 25080 } 25081} 25082class CFFIndex { 25083 objects = []; 25084 length = 0; 25085 add(data) { 25086 this.length += data.length; 25087 this.objects.push(data); 25088 } 25089 set(index, data) { 25090 this.length += data.length - this.objects[index].length; 25091 this.objects[index] = data; 25092 } 25093 get(index) { 25094 return this.objects[index]; 25095 } 25096 get count() { 25097 return this.objects.length; 25098 } 25099} 25100class CFFDict { 25101 constructor(tables, strings) { 25102 this.keyToNameMap = tables.keyToNameMap; 25103 this.nameToKeyMap = tables.nameToKeyMap; 25104 this.defaults = tables.defaults; 25105 this.types = tables.types; 25106 this.opcodes = tables.opcodes; 25107 this.order = tables.order; 25108 this.strings = strings; 25109 this.values = Object.create(null); 25110 } 25111 setByKey(key, value) { 25112 if (!(key in this.keyToNameMap)) { 25113 return false; 25114 } 25115 if (value.length === 0) { 25116 return true; 25117 } 25118 for (const val of value) { 25119 if (isNaN(val)) { 25120 warn(`Invalid CFFDict value: "${value}" for key "${key}".`); 25121 return true; 25122 } 25123 } 25124 const type = this.types[key]; 25125 if (type === "num" || type === "sid" || type === "offset") { 25126 value = value[0]; 25127 } 25128 this.values[key] = value; 25129 return true; 25130 } 25131 setByName(name, value) { 25132 if (!(name in this.nameToKeyMap)) { 25133 throw new FormatError(`Invalid dictionary name "${name}"`); 25134 } 25135 this.values[this.nameToKeyMap[name]] = value; 25136 } 25137 hasName(name) { 25138 return this.nameToKeyMap[name] in this.values; 25139 } 25140 getByName(name) { 25141 if (!(name in this.nameToKeyMap)) { 25142 throw new FormatError(`Invalid dictionary name ${name}"`); 25143 } 25144 const key = this.nameToKeyMap[name]; 25145 if (!(key in this.values)) { 25146 return this.defaults[key]; 25147 } 25148 return this.values[key]; 25149 } 25150 removeByName(name) { 25151 delete this.values[this.nameToKeyMap[name]]; 25152 } 25153 static createTables(layout) { 25154 const tables = { 25155 keyToNameMap: {}, 25156 nameToKeyMap: {}, 25157 defaults: {}, 25158 types: {}, 25159 opcodes: {}, 25160 order: [] 25161 }; 25162 for (const entry of layout) { 25163 const key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0]; 25164 tables.keyToNameMap[key] = entry[1]; 25165 tables.nameToKeyMap[entry[1]] = key; 25166 tables.types[key] = entry[2]; 25167 tables.defaults[key] = entry[3]; 25168 tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]]; 25169 tables.order.push(key); 25170 } 25171 return tables; 25172 } 25173} 25174const CFFTopDictLayout = [[[12, 30], "ROS", ["sid", "sid", "num"], null], [[12, 20], "SyntheticBase", "num", null], [0, "version", "sid", null], [1, "Notice", "sid", null], [[12, 0], "Copyright", "sid", null], [2, "FullName", "sid", null], [3, "FamilyName", "sid", null], [4, "Weight", "sid", null], [[12, 1], "isFixedPitch", "num", 0], [[12, 2], "ItalicAngle", "num", 0], [[12, 3], "UnderlinePosition", "num", -100], [[12, 4], "UnderlineThickness", "num", 50], [[12, 5], "PaintType", "num", 0], [[12, 6], "CharstringType", "num", 2], [[12, 7], "FontMatrix", ["num", "num", "num", "num", "num", "num"], [0.001, 0, 0, 0.001, 0, 0]], [13, "UniqueID", "num", null], [5, "FontBBox", ["num", "num", "num", "num"], [0, 0, 0, 0]], [[12, 8], "StrokeWidth", "num", 0], [14, "XUID", "array", null], [15, "charset", "offset", 0], [16, "Encoding", "offset", 0], [17, "CharStrings", "offset", 0], [18, "Private", ["offset", "offset"], null], [[12, 21], "PostScript", "sid", null], [[12, 22], "BaseFontName", "sid", null], [[12, 23], "BaseFontBlend", "delta", null], [[12, 31], "CIDFontVersion", "num", 0], [[12, 32], "CIDFontRevision", "num", 0], [[12, 33], "CIDFontType", "num", 0], [[12, 34], "CIDCount", "num", 8720], [[12, 35], "UIDBase", "num", null], [[12, 37], "FDSelect", "offset", null], [[12, 36], "FDArray", "offset", null], [[12, 38], "FontName", "sid", null]]; 25175class CFFTopDict extends CFFDict { 25176 static get tables() { 25177 return shadow(this, "tables", this.createTables(CFFTopDictLayout)); 25178 } 25179 constructor(strings) { 25180 super(CFFTopDict.tables, strings); 25181 this.privateDict = null; 25182 } 25183} 25184const CFFPrivateDictLayout = [[6, "BlueValues", "delta", null], [7, "OtherBlues", "delta", null], [8, "FamilyBlues", "delta", null], [9, "FamilyOtherBlues", "delta", null], [[12, 9], "BlueScale", "num", 0.039625], [[12, 10], "BlueShift", "num", 7], [[12, 11], "BlueFuzz", "num", 1], [10, "StdHW", "num", null], [11, "StdVW", "num", null], [[12, 12], "StemSnapH", "delta", null], [[12, 13], "StemSnapV", "delta", null], [[12, 14], "ForceBold", "num", 0], [[12, 17], "LanguageGroup", "num", 0], [[12, 18], "ExpansionFactor", "num", 0.06], [[12, 19], "initialRandomSeed", "num", 0], [20, "defaultWidthX", "num", 0], [21, "nominalWidthX", "num", 0], [19, "Subrs", "offset", null]]; 25185class CFFPrivateDict extends CFFDict { 25186 static get tables() { 25187 return shadow(this, "tables", this.createTables(CFFPrivateDictLayout)); 25188 } 25189 constructor(strings) { 25190 super(CFFPrivateDict.tables, strings); 25191 this.subrsIndex = null; 25192 } 25193} 25194const CFFCharsetPredefinedTypes = { 25195 ISO_ADOBE: 0, 25196 EXPERT: 1, 25197 EXPERT_SUBSET: 2 25198}; 25199class CFFCharset { 25200 constructor(predefined, format, charset, raw) { 25201 this.predefined = predefined; 25202 this.format = format; 25203 this.charset = charset; 25204 this.raw = raw; 25205 } 25206} 25207class CFFEncoding { 25208 constructor(predefined, format, encoding, raw) { 25209 this.predefined = predefined; 25210 this.format = format; 25211 this.encoding = encoding; 25212 this.raw = raw; 25213 } 25214} 25215class CFFFDSelect { 25216 constructor(format, fdSelect) { 25217 this.format = format; 25218 this.fdSelect = fdSelect; 25219 } 25220 getFDIndex(glyphIndex) { 25221 if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) { 25222 return -1; 25223 } 25224 return this.fdSelect[glyphIndex]; 25225 } 25226} 25227class CFFOffsetTracker { 25228 offsets = Object.create(null); 25229 isTracking(key) { 25230 return key in this.offsets; 25231 } 25232 track(key, location) { 25233 if (key in this.offsets) { 25234 throw new FormatError(`Already tracking location of ${key}`); 25235 } 25236 this.offsets[key] = location; 25237 } 25238 offset(value) { 25239 for (const key in this.offsets) { 25240 this.offsets[key] += value; 25241 } 25242 } 25243 setEntryLocation(key, values, output) { 25244 if (!(key in this.offsets)) { 25245 throw new FormatError(`Not tracking location of ${key}`); 25246 } 25247 const data = output.data; 25248 const dataOffset = this.offsets[key]; 25249 const size = 5; 25250 for (let i = 0, ii = values.length; i < ii; ++i) { 25251 const offset0 = i * size + dataOffset; 25252 const offset1 = offset0 + 1; 25253 const offset2 = offset0 + 2; 25254 const offset3 = offset0 + 3; 25255 const offset4 = offset0 + 4; 25256 if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) { 25257 throw new FormatError("writing to an offset that is not empty"); 25258 } 25259 const value = values[i]; 25260 data[offset0] = 0x1d; 25261 data[offset1] = value >> 24 & 0xff; 25262 data[offset2] = value >> 16 & 0xff; 25263 data[offset3] = value >> 8 & 0xff; 25264 data[offset4] = value & 0xff; 25265 } 25266 } 25267} 25268class CompilerOutput { 25269 #buf; 25270 #bufLength = 1024; 25271 #pos = 0; 25272 constructor(minLength) { 25273 this.#initBuf(minLength); 25274 } 25275 #initBuf(minLength) { 25276 while (this.#bufLength < minLength) { 25277 this.#bufLength *= 2; 25278 } 25279 const newBuf = new Uint8Array(this.#bufLength); 25280 if (this.#buf) { 25281 newBuf.set(this.#buf, 0); 25282 } 25283 this.#buf = newBuf; 25284 } 25285 get data() { 25286 return this.#buf.subarray(0, this.#pos); 25287 } 25288 get finalData() { 25289 const data = this.#buf.slice(0, this.#pos); 25290 this.#buf = null; 25291 return data; 25292 } 25293 get length() { 25294 return this.#pos; 25295 } 25296 add(data) { 25297 const newPos = this.#pos + data.length; 25298 if (newPos > this.#bufLength) { 25299 this.#initBuf(newPos); 25300 } 25301 this.#buf.set(data, this.#pos); 25302 this.#pos = newPos; 25303 } 25304} 25305class CFFCompiler { 25306 constructor(cff) { 25307 this.cff = cff; 25308 } 25309 compile() { 25310 const cff = this.cff; 25311 const output = new CompilerOutput(cff.rawFileLength); 25312 const header = this.compileHeader(cff.header); 25313 output.add(header); 25314 const nameIndex = this.compileNameIndex(cff.names); 25315 output.add(nameIndex); 25316 if (cff.isCIDFont) { 25317 if (cff.topDict.hasName("FontMatrix")) { 25318 const base = cff.topDict.getByName("FontMatrix"); 25319 cff.topDict.removeByName("FontMatrix"); 25320 for (const subDict of cff.fdArray) { 25321 let matrix = base.slice(0); 25322 if (subDict.hasName("FontMatrix")) { 25323 matrix = Util.transform(matrix, subDict.getByName("FontMatrix")); 25324 } 25325 subDict.setByName("FontMatrix", matrix); 25326 } 25327 } 25328 } 25329 const xuid = cff.topDict.getByName("XUID"); 25330 if (xuid?.length > 16) { 25331 cff.topDict.removeByName("XUID"); 25332 } 25333 cff.topDict.setByName("charset", 0); 25334 let compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont); 25335 output.add(compiled.output); 25336 const topDictTracker = compiled.trackers[0]; 25337 const stringIndex = this.compileStringIndex(cff.strings.strings); 25338 output.add(stringIndex); 25339 const globalSubrIndex = this.compileIndex(cff.globalSubrIndex); 25340 output.add(globalSubrIndex); 25341 if (cff.encoding && cff.topDict.hasName("Encoding")) { 25342 if (cff.encoding.predefined) { 25343 topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output); 25344 } else { 25345 const encoding = this.compileEncoding(cff.encoding); 25346 topDictTracker.setEntryLocation("Encoding", [output.length], output); 25347 output.add(encoding); 25348 } 25349 } 25350 const charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont); 25351 topDictTracker.setEntryLocation("charset", [output.length], output); 25352 output.add(charset); 25353 const charStrings = this.compileCharStrings(cff.charStrings); 25354 topDictTracker.setEntryLocation("CharStrings", [output.length], output); 25355 output.add(charStrings); 25356 if (cff.isCIDFont) { 25357 topDictTracker.setEntryLocation("FDSelect", [output.length], output); 25358 const fdSelect = this.compileFDSelect(cff.fdSelect); 25359 output.add(fdSelect); 25360 compiled = this.compileTopDicts(cff.fdArray, output.length, true); 25361 topDictTracker.setEntryLocation("FDArray", [output.length], output); 25362 output.add(compiled.output); 25363 const fontDictTrackers = compiled.trackers; 25364 this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output); 25365 } 25366 this.compilePrivateDicts([cff.topDict], [topDictTracker], output); 25367 output.add([0]); 25368 return output.finalData; 25369 } 25370 encodeNumber(value) { 25371 if (Number.isInteger(value)) { 25372 return this.encodeInteger(value); 25373 } 25374 return this.encodeFloat(value); 25375 } 25376 static get EncodeFloatRegExp() { 25377 return shadow(this, "EncodeFloatRegExp", /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/); 25378 } 25379 encodeFloat(num) { 25380 let value = num.toString(); 25381 const m = CFFCompiler.EncodeFloatRegExp.exec(value); 25382 if (m) { 25383 const epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length)); 25384 value = (Math.round(num * epsilon) / epsilon).toString(); 25385 } 25386 let nibbles = ""; 25387 let i, ii; 25388 for (i = 0, ii = value.length; i < ii; ++i) { 25389 const a = value[i]; 25390 if (a === "e") { 25391 nibbles += value[++i] === "-" ? "c" : "b"; 25392 } else if (a === ".") { 25393 nibbles += "a"; 25394 } else if (a === "-") { 25395 nibbles += "e"; 25396 } else { 25397 nibbles += a; 25398 } 25399 } 25400 nibbles += nibbles.length & 1 ? "f" : "ff"; 25401 const out = [30]; 25402 for (i = 0, ii = nibbles.length; i < ii; i += 2) { 25403 out.push(parseInt(nibbles.substring(i, i + 2), 16)); 25404 } 25405 return out; 25406 } 25407 encodeInteger(value) { 25408 let code; 25409 if (value >= -107 && value <= 107) { 25410 code = [value + 139]; 25411 } else if (value >= 108 && value <= 1131) { 25412 value -= 108; 25413 code = [(value >> 8) + 247, value & 0xff]; 25414 } else if (value >= -1131 && value <= -108) { 25415 value = -value - 108; 25416 code = [(value >> 8) + 251, value & 0xff]; 25417 } else if (value >= -32768 && value <= 32767) { 25418 code = [0x1c, value >> 8 & 0xff, value & 0xff]; 25419 } else { 25420 code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff]; 25421 } 25422 return code; 25423 } 25424 compileHeader(header) { 25425 return [header.major, header.minor, 4, header.offSize]; 25426 } 25427 compileNameIndex(names) { 25428 const nameIndex = new CFFIndex(); 25429 for (const name of names) { 25430 const length = Math.min(name.length, 127); 25431 let sanitizedName = new Array(length); 25432 for (let j = 0; j < length; j++) { 25433 let char = name[j]; 25434 if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") { 25435 char = "_"; 25436 } 25437 sanitizedName[j] = char; 25438 } 25439 sanitizedName = sanitizedName.join(""); 25440 if (sanitizedName === "") { 25441 sanitizedName = "Bad_Font_Name"; 25442 } 25443 nameIndex.add(stringToBytes(sanitizedName)); 25444 } 25445 return this.compileIndex(nameIndex); 25446 } 25447 compileTopDicts(dicts, length, removeCidKeys) { 25448 const fontDictTrackers = []; 25449 let fdArrayIndex = new CFFIndex(); 25450 for (const fontDict of dicts) { 25451 if (removeCidKeys) { 25452 fontDict.removeByName("CIDFontVersion"); 25453 fontDict.removeByName("CIDFontRevision"); 25454 fontDict.removeByName("CIDFontType"); 25455 fontDict.removeByName("CIDCount"); 25456 fontDict.removeByName("UIDBase"); 25457 } 25458 const fontDictTracker = new CFFOffsetTracker(); 25459 const fontDictData = this.compileDict(fontDict, fontDictTracker); 25460 fontDictTrackers.push(fontDictTracker); 25461 fdArrayIndex.add(fontDictData); 25462 fontDictTracker.offset(length); 25463 } 25464 fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers); 25465 return { 25466 trackers: fontDictTrackers, 25467 output: fdArrayIndex 25468 }; 25469 } 25470 compilePrivateDicts(dicts, trackers, output) { 25471 for (let i = 0, ii = dicts.length; i < ii; ++i) { 25472 const fontDict = dicts[i]; 25473 const privateDict = fontDict.privateDict; 25474 if (!privateDict || !fontDict.hasName("Private")) { 25475 throw new FormatError("There must be a private dictionary."); 25476 } 25477 const privateDictTracker = new CFFOffsetTracker(); 25478 const privateDictData = this.compileDict(privateDict, privateDictTracker); 25479 let outputLength = output.length; 25480 privateDictTracker.offset(outputLength); 25481 if (!privateDictData.length) { 25482 outputLength = 0; 25483 } 25484 trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output); 25485 output.add(privateDictData); 25486 if (privateDict.subrsIndex && privateDict.hasName("Subrs")) { 25487 const subrs = this.compileIndex(privateDict.subrsIndex); 25488 privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output); 25489 output.add(subrs); 25490 } 25491 } 25492 } 25493 compileDict(dict, offsetTracker) { 25494 const out = []; 25495 for (const key of dict.order) { 25496 if (!(key in dict.values)) { 25497 continue; 25498 } 25499 let values = dict.values[key]; 25500 let types = dict.types[key]; 25501 if (!Array.isArray(types)) { 25502 types = [types]; 25503 } 25504 if (!Array.isArray(values)) { 25505 values = [values]; 25506 } 25507 if (values.length === 0) { 25508 continue; 25509 } 25510 for (let j = 0, jj = types.length; j < jj; ++j) { 25511 const type = types[j]; 25512 const value = values[j]; 25513 switch (type) { 25514 case "num": 25515 case "sid": 25516 out.push(...this.encodeNumber(value)); 25517 break; 25518 case "offset": 25519 const name = dict.keyToNameMap[key]; 25520 if (!offsetTracker.isTracking(name)) { 25521 offsetTracker.track(name, out.length); 25522 } 25523 out.push(0x1d, 0, 0, 0, 0); 25524 break; 25525 case "array": 25526 case "delta": 25527 out.push(...this.encodeNumber(value)); 25528 for (let k = 1, kk = values.length; k < kk; ++k) { 25529 out.push(...this.encodeNumber(values[k])); 25530 } 25531 break; 25532 default: 25533 throw new FormatError(`Unknown data type of ${type}`); 25534 } 25535 } 25536 out.push(...dict.opcodes[key]); 25537 } 25538 return out; 25539 } 25540 compileStringIndex(strings) { 25541 const stringIndex = new CFFIndex(); 25542 for (const string of strings) { 25543 stringIndex.add(stringToBytes(string)); 25544 } 25545 return this.compileIndex(stringIndex); 25546 } 25547 compileCharStrings(charStrings) { 25548 const charStringsIndex = new CFFIndex(); 25549 for (let i = 0; i < charStrings.count; i++) { 25550 const glyph = charStrings.get(i); 25551 if (glyph.length === 0) { 25552 charStringsIndex.add(new Uint8Array([0x8b, 0x0e])); 25553 continue; 25554 } 25555 charStringsIndex.add(glyph); 25556 } 25557 return this.compileIndex(charStringsIndex); 25558 } 25559 compileCharset(charset, numGlyphs, strings, isCIDFont) { 25560 let out; 25561 const numGlyphsLessNotDef = numGlyphs - 1; 25562 if (isCIDFont) { 25563 const nLeft = numGlyphsLessNotDef - 1; 25564 out = new Uint8Array([2, 0, 1, nLeft >> 8 & 0xff, nLeft & 0xff]); 25565 } else { 25566 const length = 1 + numGlyphsLessNotDef * 2; 25567 out = new Uint8Array(length); 25568 let charsetIndex = 0; 25569 const numCharsets = charset.charset.length; 25570 let warned = false; 25571 for (let i = 1; i < out.length; i += 2) { 25572 let sid = 0; 25573 if (charsetIndex < numCharsets) { 25574 const name = charset.charset[charsetIndex++]; 25575 sid = strings.getSID(name); 25576 if (sid === -1) { 25577 sid = 0; 25578 if (!warned) { 25579 warned = true; 25580 warn(`Couldn't find ${name} in CFF strings`); 25581 } 25582 } 25583 } 25584 out[i] = sid >> 8 & 0xff; 25585 out[i + 1] = sid & 0xff; 25586 } 25587 } 25588 return out; 25589 } 25590 compileEncoding(encoding) { 25591 return encoding.raw; 25592 } 25593 compileFDSelect(fdSelect) { 25594 const format = fdSelect.format; 25595 let out, i; 25596 switch (format) { 25597 case 0: 25598 out = new Uint8Array(1 + fdSelect.fdSelect.length); 25599 out[0] = format; 25600 for (i = 0; i < fdSelect.fdSelect.length; i++) { 25601 out[i + 1] = fdSelect.fdSelect[i]; 25602 } 25603 break; 25604 case 3: 25605 const start = 0; 25606 let lastFD = fdSelect.fdSelect[0]; 25607 const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD]; 25608 for (i = 1; i < fdSelect.fdSelect.length; i++) { 25609 const currentFD = fdSelect.fdSelect[i]; 25610 if (currentFD !== lastFD) { 25611 ranges.push(i >> 8 & 0xff, i & 0xff, currentFD); 25612 lastFD = currentFD; 25613 } 25614 } 25615 const numRanges = (ranges.length - 3) / 3; 25616 ranges[1] = numRanges >> 8 & 0xff; 25617 ranges[2] = numRanges & 0xff; 25618 ranges.push(i >> 8 & 0xff, i & 0xff); 25619 out = new Uint8Array(ranges); 25620 break; 25621 } 25622 return out; 25623 } 25624 compileIndex(index, trackers = []) { 25625 const objects = index.objects; 25626 const count = objects.length; 25627 if (count === 0) { 25628 return new Uint8Array(2); 25629 } 25630 let lastOffset = 1, 25631 i; 25632 for (i = 0; i < count; ++i) { 25633 lastOffset += objects[i].length; 25634 } 25635 let offsetSize; 25636 if (lastOffset < 0x100) { 25637 offsetSize = 1; 25638 } else if (lastOffset < 0x10000) { 25639 offsetSize = 2; 25640 } else if (lastOffset < 0x1000000) { 25641 offsetSize = 3; 25642 } else { 25643 offsetSize = 4; 25644 } 25645 const data = new Uint8Array(2 + offsetSize * (count + 1) + lastOffset); 25646 let pos = 0; 25647 data[pos++] = count >> 8 & 0xff; 25648 data[pos++] = count & 0xff; 25649 data[pos++] = offsetSize; 25650 let relativeOffset = 1; 25651 for (i = 0; i < count + 1; i++) { 25652 if (offsetSize === 1) { 25653 data[pos++] = relativeOffset & 0xff; 25654 } else if (offsetSize === 2) { 25655 data[pos++] = relativeOffset >> 8 & 0xff; 25656 data[pos++] = relativeOffset & 0xff; 25657 } else if (offsetSize === 3) { 25658 data[pos++] = relativeOffset >> 16 & 0xff; 25659 data[pos++] = relativeOffset >> 8 & 0xff; 25660 data[pos++] = relativeOffset & 0xff; 25661 } else { 25662 data[pos++] = relativeOffset >>> 24 & 0xff; 25663 data[pos++] = relativeOffset >> 16 & 0xff; 25664 data[pos++] = relativeOffset >> 8 & 0xff; 25665 data[pos++] = relativeOffset & 0xff; 25666 } 25667 if (objects[i]) { 25668 relativeOffset += objects[i].length; 25669 } 25670 } 25671 for (i = 0; i < count; i++) { 25672 trackers[i]?.offset(pos); 25673 data.set(objects[i], pos); 25674 pos += objects[i].length; 25675 } 25676 return data; 25677 } 25678} 25679 25680;// ./src/core/standard_fonts.js
vendor: 4,846 bytes, lines 25680-25790
25680 25681 25682 25683const getStdFontMap = getLookupTableFactory(function (t) { 25684 t["Times-Roman"] = "Times-Roman"; 25685 t.Helvetica = "Helvetica"; 25686 t.Courier = "Courier"; 25687 t.Symbol = "Symbol"; 25688 t["Times-Bold"] = "Times-Bold"; 25689 t["Helvetica-Bold"] = "Helvetica-Bold"; 25690 t["Courier-Bold"] = "Courier-Bold"; 25691 t.ZapfDingbats = "ZapfDingbats"; 25692 t["Times-Italic"] = "Times-Italic"; 25693 t["Helvetica-Oblique"] = "Helvetica-Oblique"; 25694 t["Courier-Oblique"] = "Courier-Oblique"; 25695 t["Times-BoldItalic"] = "Times-BoldItalic"; 25696 t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique"; 25697 t["Courier-BoldOblique"] = "Courier-BoldOblique"; 25698 t.ArialNarrow = "Helvetica"; 25699 t["ArialNarrow-Bold"] = "Helvetica-Bold"; 25700 t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique"; 25701 t["ArialNarrow-Italic"] = "Helvetica-Oblique"; 25702 t.ArialBlack = "Helvetica"; 25703 t["ArialBlack-Bold"] = "Helvetica-Bold"; 25704 t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique"; 25705 t["ArialBlack-Italic"] = "Helvetica-Oblique"; 25706 t["Arial-Black"] = "Helvetica"; 25707 t["Arial-Black-Bold"] = "Helvetica-Bold"; 25708 t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique"; 25709 t["Arial-Black-Italic"] = "Helvetica-Oblique"; 25710 t.Arial = "Helvetica"; 25711 t["Arial-Bold"] = "Helvetica-Bold"; 25712 t["Arial-BoldItalic"] = "Helvetica-BoldOblique"; 25713 t["Arial-Italic"] = "Helvetica-Oblique"; 25714 t.ArialMT = "Helvetica"; 25715 t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique"; 25716 t["Arial-BoldMT"] = "Helvetica-Bold"; 25717 t["Arial-ItalicMT"] = "Helvetica-Oblique"; 25718 t["Arial-BoldItalicMT-BoldItalic"] = "Helvetica-BoldOblique"; 25719 t["Arial-BoldMT-Bold"] = "Helvetica-Bold"; 25720 t["Arial-ItalicMT-Italic"] = "Helvetica-Oblique"; 25721 t.ArialUnicodeMS = "Helvetica"; 25722 t["ArialUnicodeMS-Bold"] = "Helvetica-Bold"; 25723 t["ArialUnicodeMS-BoldItalic"] = "Helvetica-BoldOblique"; 25724 t["ArialUnicodeMS-Italic"] = "Helvetica-Oblique"; 25725 t["Courier-BoldItalic"] = "Courier-BoldOblique"; 25726 t["Courier-Italic"] = "Courier-Oblique"; 25727 t.CourierNew = "Courier"; 25728 t["CourierNew-Bold"] = "Courier-Bold"; 25729 t["CourierNew-BoldItalic"] = "Courier-BoldOblique"; 25730 t["CourierNew-Italic"] = "Courier-Oblique"; 25731 t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique"; 25732 t["CourierNewPS-BoldMT"] = "Courier-Bold"; 25733 t["CourierNewPS-ItalicMT"] = "Courier-Oblique"; 25734 t.CourierNewPSMT = "Courier"; 25735 t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique"; 25736 t["Helvetica-Italic"] = "Helvetica-Oblique"; 25737 t["HelveticaLTStd-Bold"] = "Helvetica-Bold"; 25738 t["Symbol-Bold"] = "Symbol"; 25739 t["Symbol-BoldItalic"] = "Symbol"; 25740 t["Symbol-Italic"] = "Symbol"; 25741 t.TimesNewRoman = "Times-Roman"; 25742 t["TimesNewRoman-Bold"] = "Times-Bold"; 25743 t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic"; 25744 t["TimesNewRoman-Italic"] = "Times-Italic"; 25745 t.TimesNewRomanPS = "Times-Roman"; 25746 t["TimesNewRomanPS-Bold"] = "Times-Bold"; 25747 t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic"; 25748 t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic"; 25749 t["TimesNewRomanPS-BoldMT"] = "Times-Bold"; 25750 t["TimesNewRomanPS-Italic"] = "Times-Italic"; 25751 t["TimesNewRomanPS-ItalicMT"] = "Times-Italic"; 25752 t.TimesNewRomanPSMT = "Times-Roman"; 25753 t["TimesNewRomanPSMT-Bold"] = "Times-Bold"; 25754 t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic"; 25755 t["TimesNewRomanPSMT-Italic"] = "Times-Italic"; 25756}); 25757const getFontNameToFileMap = getLookupTableFactory(function (t) { 25758 t.Courier = "FoxitFixed.pfb"; 25759 t["Courier-Bold"] = "FoxitFixedBold.pfb"; 25760 t["Courier-BoldOblique"] = "FoxitFixedBoldItalic.pfb"; 25761 t["Courier-Oblique"] = "FoxitFixedItalic.pfb"; 25762 t.Helvetica = "LiberationSans-Regular.ttf"; 25763 t["Helvetica-Bold"] = "LiberationSans-Bold.ttf"; 25764 t["Helvetica-BoldOblique"] = "LiberationSans-BoldItalic.ttf"; 25765 t["Helvetica-Oblique"] = "LiberationSans-Italic.ttf"; 25766 t["Times-Roman"] = "FoxitSerif.pfb"; 25767 t["Times-Bold"] = "FoxitSerifBold.pfb"; 25768 t["Times-BoldItalic"] = "FoxitSerifBoldItalic.pfb"; 25769 t["Times-Italic"] = "FoxitSerifItalic.pfb"; 25770 t.Symbol = "FoxitSymbol.pfb"; 25771 t.ZapfDingbats = "FoxitDingbats.pfb"; 25772 t["LiberationSans-Regular"] = "LiberationSans-Regular.ttf"; 25773 t["LiberationSans-Bold"] = "LiberationSans-Bold.ttf"; 25774 t["LiberationSans-Italic"] = "LiberationSans-Italic.ttf"; 25775 t["LiberationSans-BoldItalic"] = "LiberationSans-BoldItalic.ttf"; 25776}); 25777const getNonStdFontMap = getLookupTableFactory(function (t) { 25778 t.Calibri = "Helvetica"; 25779 t["Calibri-Bold"] = "Helvetica-Bold"; 25780 t["Calibri-BoldItalic"] = "Helvetica-BoldOblique"; 25781 t["Calibri-Italic"] = "Helvetica-Oblique"; 25782 t.CenturyGothic = "Helvetica"; 25783 t["CenturyGothic-Bold"] = "Helvetica-Bold"; 25784 t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique"; 25785 t["CenturyGothic-Italic"] = "Helvetica-Oblique"; 25786 t.ComicSansMS = "Comic Sans MS"; 25787 t["ComicSansMS-Bold"] = "Comic Sans MS-Bold"; 25788 t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic"; 25789 t["ComicSansMS-Italic"] = "Comic Sans MS-Italic"; 25790 t.GillSansMT = "Helvetica";
vendor: 8,875 bytes, lines 25791-26221
25791 t["GillSansMT-Bold"] = "Helvetica-Bold"; 25792 t["GillSansMT-BoldItalic"] = "Helvetica-BoldOblique"; 25793 t["GillSansMT-Italic"] = "Helvetica-Oblique"; 25794 t.Impact = "Helvetica"; 25795 t["ItcSymbol-Bold"] = "Helvetica-Bold"; 25796 t["ItcSymbol-BoldItalic"] = "Helvetica-BoldOblique"; 25797 t["ItcSymbol-Book"] = "Helvetica"; 25798 t["ItcSymbol-BookItalic"] = "Helvetica-Oblique"; 25799 t["ItcSymbol-Medium"] = "Helvetica"; 25800 t["ItcSymbol-MediumItalic"] = "Helvetica-Oblique"; 25801 t.LucidaConsole = "Courier"; 25802 t["LucidaConsole-Bold"] = "Courier-Bold"; 25803 t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique"; 25804 t["LucidaConsole-Italic"] = "Courier-Oblique"; 25805 t["LucidaSans-Demi"] = "Helvetica-Bold"; 25806 t["MS-Gothic"] = "MS Gothic"; 25807 t["MS-Gothic-Bold"] = "MS Gothic-Bold"; 25808 t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic"; 25809 t["MS-Gothic-Italic"] = "MS Gothic-Italic"; 25810 t["MS-Mincho"] = "MS Mincho"; 25811 t["MS-Mincho-Bold"] = "MS Mincho-Bold"; 25812 t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic"; 25813 t["MS-Mincho-Italic"] = "MS Mincho-Italic"; 25814 t["MS-PGothic"] = "MS PGothic"; 25815 t["MS-PGothic-Bold"] = "MS PGothic-Bold"; 25816 t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic"; 25817 t["MS-PGothic-Italic"] = "MS PGothic-Italic"; 25818 t["MS-PMincho"] = "MS PMincho"; 25819 t["MS-PMincho-Bold"] = "MS PMincho-Bold"; 25820 t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic"; 25821 t["MS-PMincho-Italic"] = "MS PMincho-Italic"; 25822 t.NuptialScript = "Times-Italic"; 25823 t.SegoeUISymbol = "Helvetica"; 25824}); 25825const getSerifFonts = getLookupTableFactory(function (t) { 25826 t["Adobe Jenson"] = true; 25827 t["Adobe Text"] = true; 25828 t.Albertus = true; 25829 t.Aldus = true; 25830 t.Alexandria = true; 25831 t.Algerian = true; 25832 t["American Typewriter"] = true; 25833 t.Antiqua = true; 25834 t.Apex = true; 25835 t.Arno = true; 25836 t.Aster = true; 25837 t.Aurora = true; 25838 t.Baskerville = true; 25839 t.Bell = true; 25840 t.Bembo = true; 25841 t["Bembo Schoolbook"] = true; 25842 t.Benguiat = true; 25843 t["Berkeley Old Style"] = true; 25844 t["Bernhard Modern"] = true; 25845 t["Berthold City"] = true; 25846 t.Bodoni = true; 25847 t["Bauer Bodoni"] = true; 25848 t["Book Antiqua"] = true; 25849 t.Bookman = true; 25850 t["Bordeaux Roman"] = true; 25851 t["Californian FB"] = true; 25852 t.Calisto = true; 25853 t.Calvert = true; 25854 t.Capitals = true; 25855 t.Cambria = true; 25856 t.Cartier = true; 25857 t.Caslon = true; 25858 t.Catull = true; 25859 t.Centaur = true; 25860 t["Century Old Style"] = true; 25861 t["Century Schoolbook"] = true; 25862 t.Chaparral = true; 25863 t["Charis SIL"] = true; 25864 t.Cheltenham = true; 25865 t["Cholla Slab"] = true; 25866 t.Clarendon = true; 25867 t.Clearface = true; 25868 t.Cochin = true; 25869 t.Colonna = true; 25870 t["Computer Modern"] = true; 25871 t["Concrete Roman"] = true; 25872 t.Constantia = true; 25873 t["Cooper Black"] = true; 25874 t.Corona = true; 25875 t.Ecotype = true; 25876 t.Egyptienne = true; 25877 t.Elephant = true; 25878 t.Excelsior = true; 25879 t.Fairfield = true; 25880 t["FF Scala"] = true; 25881 t.Folkard = true; 25882 t.Footlight = true; 25883 t.FreeSerif = true; 25884 t["Friz Quadrata"] = true; 25885 t.Garamond = true; 25886 t.Gentium = true; 25887 t.Georgia = true; 25888 t.Gloucester = true; 25889 t["Goudy Old Style"] = true; 25890 t["Goudy Schoolbook"] = true; 25891 t["Goudy Pro Font"] = true; 25892 t.Granjon = true; 25893 t["Guardian Egyptian"] = true; 25894 t.Heather = true; 25895 t.Hercules = true; 25896 t["High Tower Text"] = true; 25897 t.Hiroshige = true; 25898 t["Hoefler Text"] = true; 25899 t["Humana Serif"] = true; 25900 t.Imprint = true; 25901 t["Ionic No. 5"] = true; 25902 t.Janson = true; 25903 t.Joanna = true; 25904 t.Korinna = true; 25905 t.Lexicon = true; 25906 t.LiberationSerif = true; 25907 t["Liberation Serif"] = true; 25908 t["Linux Libertine"] = true; 25909 t.Literaturnaya = true; 25910 t.Lucida = true; 25911 t["Lucida Bright"] = true; 25912 t.Melior = true; 25913 t.Memphis = true; 25914 t.Miller = true; 25915 t.Minion = true; 25916 t.Modern = true; 25917 t["Mona Lisa"] = true; 25918 t["Mrs Eaves"] = true; 25919 t["MS Serif"] = true; 25920 t["Museo Slab"] = true; 25921 t["New York"] = true; 25922 t["Nimbus Roman"] = true; 25923 t["NPS Rawlinson Roadway"] = true; 25924 t.NuptialScript = true; 25925 t.Palatino = true; 25926 t.Perpetua = true; 25927 t.Plantin = true; 25928 t["Plantin Schoolbook"] = true; 25929 t.Playbill = true; 25930 t["Poor Richard"] = true; 25931 t["Rawlinson Roadway"] = true; 25932 t.Renault = true; 25933 t.Requiem = true; 25934 t.Rockwell = true; 25935 t.Roman = true; 25936 t["Rotis Serif"] = true; 25937 t.Sabon = true; 25938 t.Scala = true; 25939 t.Seagull = true; 25940 t.Sistina = true; 25941 t.Souvenir = true; 25942 t.STIX = true; 25943 t["Stone Informal"] = true; 25944 t["Stone Serif"] = true; 25945 t.Sylfaen = true; 25946 t.Times = true; 25947 t.Trajan = true; 25948 t["Trinité"] = true; 25949 t["Trump Mediaeval"] = true; 25950 t.Utopia = true; 25951 t["Vale Type"] = true; 25952 t["Bitstream Vera"] = true; 25953 t["Vera Serif"] = true; 25954 t.Versailles = true; 25955 t.Wanted = true; 25956 t.Weiss = true; 25957 t["Wide Latin"] = true; 25958 t.Windsor = true; 25959 t.XITS = true; 25960}); 25961const getSymbolsFonts = getLookupTableFactory(function (t) { 25962 t.Dingbats = true; 25963 t.Symbol = true; 25964 t.ZapfDingbats = true; 25965 t.Wingdings = true; 25966 t["Wingdings-Bold"] = true; 25967 t["Wingdings-Regular"] = true; 25968}); 25969const getGlyphMapForStandardFonts = getLookupTableFactory(function (t) { 25970 t[2] = 10; 25971 t[3] = 32; 25972 t[4] = 33; 25973 t[5] = 34; 25974 t[6] = 35; 25975 t[7] = 36; 25976 t[8] = 37; 25977 t[9] = 38; 25978 t[10] = 39; 25979 t[11] = 40; 25980 t[12] = 41; 25981 t[13] = 42; 25982 t[14] = 43; 25983 t[15] = 44; 25984 t[16] = 45; 25985 t[17] = 46; 25986 t[18] = 47; 25987 t[19] = 48; 25988 t[20] = 49; 25989 t[21] = 50; 25990 t[22] = 51; 25991 t[23] = 52; 25992 t[24] = 53; 25993 t[25] = 54; 25994 t[26] = 55; 25995 t[27] = 56; 25996 t[28] = 57; 25997 t[29] = 58; 25998 t[30] = 894; 25999 t[31] = 60; 26000 t[32] = 61; 26001 t[33] = 62; 26002 t[34] = 63; 26003 t[35] = 64; 26004 t[36] = 65; 26005 t[37] = 66; 26006 t[38] = 67; 26007 t[39] = 68; 26008 t[40] = 69; 26009 t[41] = 70; 26010 t[42] = 71; 26011 t[43] = 72; 26012 t[44] = 73; 26013 t[45] = 74; 26014 t[46] = 75; 26015 t[47] = 76; 26016 t[48] = 77; 26017 t[49] = 78; 26018 t[50] = 79; 26019 t[51] = 80; 26020 t[52] = 81; 26021 t[53] = 82; 26022 t[54] = 83; 26023 t[55] = 84; 26024 t[56] = 85; 26025 t[57] = 86; 26026 t[58] = 87; 26027 t[59] = 88; 26028 t[60] = 89; 26029 t[61] = 90; 26030 t[62] = 91; 26031 t[63] = 92; 26032 t[64] = 93; 26033 t[65] = 94; 26034 t[66] = 95; 26035 t[67] = 96; 26036 t[68] = 97; 26037 t[69] = 98; 26038 t[70] = 99; 26039 t[71] = 100; 26040 t[72] = 101; 26041 t[73] = 102; 26042 t[74] = 103; 26043 t[75] = 104; 26044 t[76] = 105; 26045 t[77] = 106; 26046 t[78] = 107; 26047 t[79] = 108; 26048 t[80] = 109; 26049 t[81] = 110; 26050 t[82] = 111; 26051 t[83] = 112; 26052 t[84] = 113; 26053 t[85] = 114; 26054 t[86] = 115; 26055 t[87] = 116; 26056 t[88] = 117; 26057 t[89] = 118; 26058 t[90] = 119; 26059 t[91] = 120; 26060 t[92] = 121; 26061 t[93] = 122; 26062 t[94] = 123; 26063 t[95] = 124; 26064 t[96] = 125; 26065 t[97] = 126; 26066 t[98] = 196; 26067 t[99] = 197; 26068 t[100] = 199; 26069 t[101] = 201; 26070 t[102] = 209; 26071 t[103] = 214; 26072 t[104] = 220; 26073 t[105] = 225; 26074 t[106] = 224; 26075 t[107] = 226; 26076 t[108] = 228; 26077 t[109] = 227; 26078 t[110] = 229; 26079 t[111] = 231; 26080 t[112] = 233; 26081 t[113] = 232; 26082 t[114] = 234; 26083 t[115] = 235; 26084 t[116] = 237; 26085 t[117] = 236; 26086 t[118] = 238; 26087 t[119] = 239; 26088 t[120] = 241; 26089 t[121] = 243; 26090 t[122] = 242; 26091 t[123] = 244; 26092 t[124] = 246; 26093 t[125] = 245; 26094 t[126] = 250; 26095 t[127] = 249; 26096 t[128] = 251; 26097 t[129] = 252; 26098 t[130] = 8224; 26099 t[131] = 176; 26100 t[132] = 162; 26101 t[133] = 163; 26102 t[134] = 167; 26103 t[135] = 8226; 26104 t[136] = 182; 26105 t[137] = 223; 26106 t[138] = 174; 26107 t[139] = 169; 26108 t[140] = 8482; 26109 t[141] = 180; 26110 t[142] = 168; 26111 t[143] = 8800; 26112 t[144] = 198; 26113 t[145] = 216; 26114 t[146] = 8734; 26115 t[147] = 177; 26116 t[148] = 8804; 26117 t[149] = 8805; 26118 t[150] = 165; 26119 t[151] = 181; 26120 t[152] = 8706; 26121 t[153] = 8721; 26122 t[154] = 8719; 26123 t[156] = 8747; 26124 t[157] = 170; 26125 t[158] = 186; 26126 t[159] = 8486; 26127 t[160] = 230; 26128 t[161] = 248; 26129 t[162] = 191; 26130 t[163] = 161; 26131 t[164] = 172; 26132 t[165] = 8730; 26133 t[166] = 402; 26134 t[167] = 8776; 26135 t[168] = 8710; 26136 t[169] = 171; 26137 t[170] = 187; 26138 t[171] = 8230; 26139 t[179] = 8220; 26140 t[180] = 8221; 26141 t[181] = 8216; 26142 t[182] = 8217; 26143 t[200] = 193; 26144 t[203] = 205; 26145 t[207] = 211; 26146 t[210] = 218; 26147 t[223] = 711; 26148 t[224] = 321; 26149 t[225] = 322; 26150 t[226] = 352; 26151 t[227] = 353; 26152 t[228] = 381; 26153 t[229] = 382; 26154 t[233] = 221; 26155 t[234] = 253; 26156 t[252] = 263; 26157 t[253] = 268; 26158 t[254] = 269; 26159 t[258] = 258; 26160 t[260] = 260; 26161 t[261] = 261; 26162 t[265] = 280; 26163 t[266] = 281; 26164 t[267] = 282; 26165 t[268] = 283; 26166 t[269] = 313; 26167 t[275] = 323; 26168 t[276] = 324; 26169 t[278] = 328; 26170 t[283] = 344; 26171 t[284] = 345; 26172 t[285] = 346; 26173 t[286] = 347; 26174 t[292] = 367; 26175 t[295] = 377; 26176 t[296] = 378; 26177 t[298] = 380; 26178 t[305] = 963; 26179 t[306] = 964; 26180 t[307] = 966; 26181 t[308] = 8215; 26182 t[309] = 8252; 26183 t[310] = 8319; 26184 t[311] = 8359; 26185 t[312] = 8592; 26186 t[313] = 8593; 26187 t[337] = 9552; 26188 t[493] = 1039; 26189 t[494] = 1040; 26190 t[570] = 1040; 26191 t[571] = 1041; 26192 t[572] = 1042; 26193 t[573] = 1043; 26194 t[574] = 1044; 26195 t[575] = 1045; 26196 t[576] = 1046; 26197 t[577] = 1047; 26198 t[578] = 1048; 26199 t[579] = 1049; 26200 t[580] = 1050; 26201 t[581] = 1051; 26202 t[582] = 1052; 26203 t[583] = 1053; 26204 t[584] = 1054; 26205 t[585] = 1055; 26206 t[586] = 1056; 26207 t[587] = 1057; 26208 t[588] = 1058; 26209 t[589] = 1059; 26210 t[590] = 1060; 26211 t[591] = 1061; 26212 t[592] = 1062; 26213 t[593] = 1063; 26214 t[594] = 1064; 26215 t[595] = 1065; 26216 t[596] = 1066; 26217 t[597] = 1067; 26218 t[598] = 1068; 26219 t[599] = 1069; 26220 t[600] = 1070; 26221 t[6
2622101] = 1071; 26222 t[602] = 1072; 26223 t[603] = 1073; 26224 t[604] = 1074; 26225 t[605] = 1075; 26226 t[606] = 1076; 26227 t[607] = 1077; 26228 t[608] = 1078; 26229 t[609] = 1079; 26230 t[610] = 1080; 26231 t[611] = 1081; 26232 t[612] = 1082; 26233 t[613] = 1083; 26234 t[614] = 1084; 26235 t[615] = 1085; 26236 t[616] = 1086; 26237 t[617] = 1087; 26238 t[618] = 1088; 26239 t[619] = 1089; 26240 t[620] = 1090; 26241 t[621] = 1091; 26242 t[622] = 1092; 26243 t[623] = 1093; 26244 t[624] = 1094; 26245 t[625] = 1095; 26246 t[626] = 1096; 26247 t[627] = 1097; 26248 t[628] = 1098; 26249 t[629] = 1099; 26250 t[630] = 1100; 26251 t[631] = 1101; 26252 t[632] = 1102; 26253 t[633] = 1103
vendor: 10,402 bytes, lines 26253-26787
26253; 26254 t[672] = 1488; 26255 t[673] = 1489; 26256 t[674] = 1490; 26257 t[675] = 1491; 26258 t[676] = 1492; 26259 t[677] = 1493; 26260 t[678] = 1494; 26261 t[679] = 1495; 26262 t[680] = 1496; 26263 t[681] = 1497; 26264 t[682] = 1498; 26265 t[683] = 1499; 26266 t[684] = 1500; 26267 t[685] = 1501; 26268 t[686] = 1502; 26269 t[687] = 1503; 26270 t[688] = 1504; 26271 t[689] = 1505; 26272 t[690] = 1506; 26273 t[691] = 1507; 26274 t[692] = 1508; 26275 t[693] = 1509; 26276 t[694] = 1510; 26277 t[695] = 1511; 26278 t[696] = 1512; 26279 t[697] = 1513; 26280 t[698] = 1514; 26281 t[705] = 1524; 26282 t[706] = 8362; 26283 t[710] = 64288; 26284 t[711] = 64298; 26285 t[759] = 1617; 26286 t[761] = 1776; 26287 t[763] = 1778; 26288 t[775] = 1652; 26289 t[777] = 1764; 26290 t[778] = 1780; 26291 t[779] = 1781; 26292 t[780] = 1782; 26293 t[782] = 771; 26294 t[783] = 64726; 26295 t[786] = 8363; 26296 t[788] = 8532; 26297 t[790] = 768; 26298 t[791] = 769; 26299 t[792] = 768; 26300 t[795] = 803; 26301 t[797] = 64336; 26302 t[798] = 64337; 26303 t[799] = 64342; 26304 t[800] = 64343; 26305 t[801] = 64344; 26306 t[802] = 64345; 26307 t[803] = 64362; 26308 t[804] = 64363; 26309 t[805] = 64364; 26310 t[2424] = 7821; 26311 t[2425] = 7822; 26312 t[2426] = 7823; 26313 t[2427] = 7824; 26314 t[2428] = 7825; 26315 t[2429] = 7826; 26316 t[2430] = 7827; 26317 t[2433] = 7682; 26318 t[2678] = 8045; 26319 t[2679] = 8046; 26320 t[2830] = 1552; 26321 t[2838] = 686; 26322 t[2840] = 751; 26323 t[2842] = 753; 26324 t[2843] = 754; 26325 t[2844] = 755; 26326 t[2846] = 757; 26327 t[2856] = 767; 26328 t[2857] = 848; 26329 t[2858] = 849; 26330 t[2862] = 853; 26331 t[2863] = 854; 26332 t[2864] = 855; 26333 t[2865] = 861; 26334 t[2866] = 862; 26335 t[2906] = 7460; 26336 t[2908] = 7462; 26337 t[2909] = 7463; 26338 t[2910] = 7464; 26339 t[2912] = 7466; 26340 t[2913] = 7467; 26341 t[2914] = 7468; 26342 t[2916] = 7470; 26343 t[2917] = 7471; 26344 t[2918] = 7472; 26345 t[2920] = 7474; 26346 t[2921] = 7475; 26347 t[2922] = 7476; 26348 t[2924] = 7478; 26349 t[2925] = 7479; 26350 t[2926] = 7480; 26351 t[2928] = 7482; 26352 t[2929] = 7483; 26353 t[2930] = 7484; 26354 t[2932] = 7486; 26355 t[2933] = 7487; 26356 t[2934] = 7488; 26357 t[2936] = 7490; 26358 t[2937] = 7491; 26359 t[2938] = 7492; 26360 t[2940] = 7494; 26361 t[2941] = 7495; 26362 t[2942] = 7496; 26363 t[2944] = 7498; 26364 t[2946] = 7500; 26365 t[2948] = 7502; 26366 t[2950] = 7504; 26367 t[2951] = 7505; 26368 t[2952] = 7506; 26369 t[2954] = 7508; 26370 t[2955] = 7509; 26371 t[2956] = 7510; 26372 t[2958] = 7512; 26373 t[2959] = 7513; 26374 t[2960] = 7514; 26375 t[2962] = 7516; 26376 t[2963] = 7517; 26377 t[2964] = 7518; 26378 t[2966] = 7520; 26379 t[2967] = 7521; 26380 t[2968] = 7522; 26381 t[2970] = 7524; 26382 t[2971] = 7525; 26383 t[2972] = 7526; 26384 t[2974] = 7528; 26385 t[2975] = 7529; 26386 t[2976] = 7530; 26387 t[2978] = 1537; 26388 t[2979] = 1538; 26389 t[2980] = 1539; 26390 t[2982] = 1549; 26391 t[2983] = 1551; 26392 t[2984] = 1552; 26393 t[2986] = 1554; 26394 t[2987] = 1555; 26395 t[2988] = 1556; 26396 t[2990] = 1623; 26397 t[2991] = 1624; 26398 t[2995] = 1775; 26399 t[2999] = 1791; 26400 t[3002] = 64290; 26401 t[3003] = 64291; 26402 t[3004] = 64292; 26403 t[3006] = 64294; 26404 t[3007] = 64295; 26405 t[3008] = 64296; 26406 t[3011] = 1900; 26407 t[3014] = 8223; 26408 t[3015] = 8244; 26409 t[3017] = 7532; 26410 t[3018] = 7533; 26411 t[3019] = 7534; 26412 t[3075] = 7590; 26413 t[3076] = 7591; 26414 t[3079] = 7594; 26415 t[3080] = 7595; 26416 t[3083] = 7598; 26417 t[3084] = 7599; 26418 t[3087] = 7602; 26419 t[3088] = 7603; 26420 t[3091] = 7606; 26421 t[3092] = 7607; 26422 t[3095] = 7610; 26423 t[3096] = 7611; 26424 t[3099] = 7614; 26425 t[3100] = 7615; 26426 t[3103] = 7618; 26427 t[3104] = 7619; 26428 t[3107] = 8337; 26429 t[3108] = 8338; 26430 t[3116] = 1884; 26431 t[3119] = 1885; 26432 t[3120] = 1885; 26433 t[3123] = 1886; 26434 t[3124] = 1886; 26435 t[3127] = 1887; 26436 t[3128] = 1887; 26437 t[3131] = 1888; 26438 t[3132] = 1888; 26439 t[3135] = 1889; 26440 t[3136] = 1889; 26441 t[3139] = 1890; 26442 t[3140] = 1890; 26443 t[3143] = 1891; 26444 t[3144] = 1891; 26445 t[3147] = 1892; 26446 t[3148] = 1892; 26447 t[3153] = 580; 26448 t[3154] = 581; 26449 t[3157] = 584; 26450 t[3158] = 585; 26451 t[3161] = 588; 26452 t[3162] = 589; 26453 t[3165] = 891; 26454 t[3166] = 892; 26455 t[3169] = 1274; 26456 t[3170] = 1275; 26457 t[3173] = 1278; 26458 t[3174] = 1279; 26459 t[3181] = 7622; 26460 t[3182] = 7623; 26461 t[3282] = 11799; 26462 t[3316] = 578; 26463 t[3379] = 42785; 26464 t[3393] = 1159; 26465 t[3416] = 8377; 26466}); 26467const getSupplementalGlyphMapForArialBlack = getLookupTableFactory(function (t) { 26468 t[227] = 322; 26469 t[264] = 261; 26470 t[291] = 346; 26471}); 26472const getSupplementalGlyphMapForCalibri = getLookupTableFactory(function (t) { 26473 t[1] = 32; 26474 t[4] = 65; 26475 t[5] = 192; 26476 t[6] = 193; 26477 t[9] = 196; 26478 t[17] = 66; 26479 t[18] = 67; 26480 t[21] = 268; 26481 t[24] = 68; 26482 t[28] = 69; 26483 t[29] = 200; 26484 t[30] = 201; 26485 t[32] = 282; 26486 t[38] = 70; 26487 t[39] = 71; 26488 t[44] = 72; 26489 t[47] = 73; 26490 t[48] = 204; 26491 t[49] = 205; 26492 t[58] = 74; 26493 t[60] = 75; 26494 t[62] = 76; 26495 t[68] = 77; 26496 t[69] = 78; 26497 t[75] = 79; 26498 t[76] = 210; 26499 t[80] = 214; 26500 t[87] = 80; 26501 t[89] = 81; 26502 t[90] = 82; 26503 t[92] = 344; 26504 t[94] = 83; 26505 t[97] = 352; 26506 t[100] = 84; 26507 t[104] = 85; 26508 t[109] = 220; 26509 t[115] = 86; 26510 t[116] = 87; 26511 t[121] = 88; 26512 t[122] = 89; 26513 t[124] = 221; 26514 t[127] = 90; 26515 t[129] = 381; 26516 t[258] = 97; 26517 t[259] = 224; 26518 t[260] = 225; 26519 t[263] = 228; 26520 t[268] = 261; 26521 t[271] = 98; 26522 t[272] = 99; 26523 t[273] = 263; 26524 t[275] = 269; 26525 t[282] = 100; 26526 t[286] = 101; 26527 t[287] = 232; 26528 t[288] = 233; 26529 t[290] = 283; 26530 t[295] = 281; 26531 t[296] = 102; 26532 t[336] = 103; 26533 t[346] = 104; 26534 t[349] = 105; 26535 t[350] = 236; 26536 t[351] = 237; 26537 t[361] = 106; 26538 t[364] = 107; 26539 t[367] = 108; 26540 t[371] = 322; 26541 t[373] = 109; 26542 t[374] = 110; 26543 t[381] = 111; 26544 t[382] = 242; 26545 t[383] = 243; 26546 t[386] = 246; 26547 t[393] = 112; 26548 t[395] = 113; 26549 t[396] = 114; 26550 t[398] = 345; 26551 t[400] = 115; 26552 t[401] = 347; 26553 t[403] = 353; 26554 t[410] = 116; 26555 t[437] = 117; 26556 t[442] = 252; 26557 t[448] = 118; 26558 t[449] = 119; 26559 t[454] = 120; 26560 t[455] = 121; 26561 t[457] = 253; 26562 t[460] = 122; 26563 t[462] = 382; 26564 t[463] = 380; 26565 t[853] = 44; 26566 t[855] = 58; 26567 t[856] = 46; 26568 t[876] = 47; 26569 t[878] = 45; 26570 t[882] = 45; 26571 t[894] = 40; 26572 t[895] = 41; 26573 t[896] = 91; 26574 t[897] = 93; 26575 t[923] = 64; 26576 t[940] = 163; 26577 t[1004] = 48; 26578 t[1005] = 49; 26579 t[1006] = 50; 26580 t[1007] = 51; 26581 t[1008] = 52; 26582 t[1009] = 53; 26583 t[1010] = 54; 26584 t[1011] = 55; 26585 t[1012] = 56; 26586 t[1013] = 57; 26587 t[1081] = 37; 26588 t[1085] = 43; 26589 t[1086] = 45; 26590}); 26591function getStandardFontName(name) { 26592 const fontName = normalizeFontName(name); 26593 const stdFontMap = getStdFontMap(); 26594 return stdFontMap[fontName]; 26595} 26596function isKnownFontName(name) { 26597 const fontName = normalizeFontName(name); 26598 return !!(getStdFontMap()[fontName] || getNonStdFontMap()[fontName] || getSerifFonts()[fontName] || getSymbolsFonts()[fontName]); 26599} 26600 26601;// ./src/core/to_unicode_map.js 26602 26603class ToUnicodeMap { 26604 constructor(cmap = []) { 26605 this._map = cmap; 26606 } 26607 get length() { 26608 return this._map.length; 26609 } 26610 forEach(callback) { 26611 for (const charCode in this._map) { 26612 callback(charCode, this._map[charCode].codePointAt(0)); 26613 } 26614 } 26615 has(i) { 26616 return this._map[i] !== undefined; 26617 } 26618 get(i) { 26619 return this._map[i]; 26620 } 26621 charCodeOf(value) { 26622 const map = this._map; 26623 if (map.length <= 0x10000) { 26624 return map.indexOf(value); 26625 } 26626 for (const charCode in map) { 26627 if (map[charCode] === value) { 26628 return charCode | 0; 26629 } 26630 } 26631 return -1; 26632 } 26633 amend(map) { 26634 for (const charCode in map) { 26635 this._map[charCode] = map[charCode]; 26636 } 26637 } 26638} 26639class IdentityToUnicodeMap { 26640 constructor(firstChar, lastChar) { 26641 this.firstChar = firstChar; 26642 this.lastChar = lastChar; 26643 } 26644 get length() { 26645 return this.lastChar + 1 - this.firstChar; 26646 } 26647 forEach(callback) { 26648 for (let i = this.firstChar, ii = this.lastChar; i <= ii; i++) { 26649 callback(i, i); 26650 } 26651 } 26652 has(i) { 26653 return this.firstChar <= i && i <= this.lastChar; 26654 } 26655 get(i) { 26656 if (this.firstChar <= i && i <= this.lastChar) { 26657 return String.fromCharCode(i); 26658 } 26659 return undefined; 26660 } 26661 charCodeOf(v) { 26662 return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1; 26663 } 26664 amend(map) { 26665 unreachable("Should not call amend()"); 26666 } 26667} 26668 26669;// ./src/core/cff_font.js 26670 26671 26672 26673class CFFFont { 26674 constructor(file, properties) { 26675 this.properties = properties; 26676 const parser = new CFFParser(file, properties, SEAC_ANALYSIS_ENABLED); 26677 this.cff = parser.parse(); 26678 this.cff.duplicateFirstGlyph(); 26679 const compiler = new CFFCompiler(this.cff); 26680 this.seacs = this.cff.seacs; 26681 try { 26682 this.data = compiler.compile(); 26683 } catch { 26684 warn("Failed to compile font " + properties.loadedName); 26685 this.data = file; 26686 } 26687 this._createBuiltInEncoding(); 26688 } 26689 get numGlyphs() { 26690 return this.cff.charStrings.count; 26691 } 26692 getCharset() { 26693 return this.cff.charset.charset; 26694 } 26695 getGlyphMapping() { 26696 const cff = this.cff; 26697 const properties = this.properties; 26698 const { 26699 cidToGidMap, 26700 cMap 26701 } = properties; 26702 const charsets = cff.charset.charset; 26703 let charCodeToGlyphId; 26704 let glyphId; 26705 if (properties.composite) { 26706 let invCidToGidMap; 26707 if (cidToGidMap?.length > 0) { 26708 invCidToGidMap = Object.create(null); 26709 for (let i = 0, ii = cidToGidMap.length; i < ii; i++) { 26710 const gid = cidToGidMap[i]; 26711 if (gid !== undefined) { 26712 invCidToGidMap[gid] = i; 26713 } 26714 } 26715 } 26716 charCodeToGlyphId = Object.create(null); 26717 let charCode; 26718 if (cff.isCIDFont) { 26719 for (glyphId = 0; glyphId < charsets.length; glyphId++) { 26720 const cid = charsets[glyphId]; 26721 charCode = cMap.charCodeOf(cid); 26722 if (invCidToGidMap?.[charCode] !== undefined) { 26723 charCode = invCidToGidMap[charCode]; 26724 } 26725 charCodeToGlyphId[charCode] = glyphId; 26726 } 26727 } else { 26728 for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) { 26729 charCode = cMap.charCodeOf(glyphId); 26730 charCodeToGlyphId[charCode] = glyphId; 26731 } 26732 } 26733 return charCodeToGlyphId; 26734 } 26735 let encoding = cff.encoding ? cff.encoding.encoding : null; 26736 if (properties.isInternalFont) { 26737 encoding = properties.defaultEncoding; 26738 } 26739 charCodeToGlyphId = type1FontGlyphMapping(properties, encoding, charsets); 26740 return charCodeToGlyphId; 26741 } 26742 hasGlyphId(id) { 26743 return this.cff.hasGlyphId(id); 26744 } 26745 _createBuiltInEncoding() { 26746 const { 26747 charset, 26748 encoding 26749 } = this.cff; 26750 if (!charset || !encoding) { 26751 return; 26752 } 26753 const charsets = charset.charset, 26754 encodings = encoding.encoding; 26755 const map = []; 26756 for (const charCode in encodings) { 26757 const glyphId = encodings[charCode]; 26758 if (glyphId >= 0) { 26759 const glyphName = charsets[glyphId]; 26760 if (glyphName) { 26761 map[charCode] = glyphName; 26762 } 26763 } 26764 } 26765 if (map.length > 0) { 26766 this.properties.builtInEncoding = map; 26767 } 26768 } 26769} 26770 26771;// ./src/core/font_renderer.js 26772 26773 26774 26775 26776 26777 26778 26779 26780 26781 26782 26783 26784 26785 26786 26787
vendor: 8,646 bytes, lines 26788-27099
26788 26789 26790 26791 26792 26793 26794function getFloat214(view, offset) { 26795 return view.getInt16(offset) / 16384; 26796} 26797function getSubroutineBias(subrs) { 26798 const numSubrs = subrs.length; 26799 let bias = 32768; 26800 if (numSubrs < 1240) { 26801 bias = 107; 26802 } else if (numSubrs < 33900) { 26803 bias = 1131; 26804 } 26805 return bias; 26806} 26807function parseCmap(data, start, end) { 26808 const view = new DataView(data.buffer, data.byteOffset, data.byteLength); 26809 const offset = view.getUint16(start + 2) === 1 ? view.getUint32(start + 8) : view.getUint32(start + 16); 26810 const format = view.getUint16(start + offset); 26811 let ranges, p, i; 26812 if (format === 4) { 26813 const segCount = view.getUint16(start + offset + 6) >> 1; 26814 p = start + offset + 14; 26815 ranges = []; 26816 for (i = 0; i < segCount; i++, p += 2) { 26817 ranges[i] = { 26818 end: view.getUint16(p) 26819 }; 26820 } 26821 p += 2; 26822 for (i = 0; i < segCount; i++, p += 2) { 26823 ranges[i].start = view.getUint16(p); 26824 } 26825 for (i = 0; i < segCount; i++, p += 2) { 26826 ranges[i].idDelta = view.getUint16(p); 26827 } 26828 for (i = 0; i < segCount; i++, p += 2) { 26829 let idOffset = view.getUint16(p); 26830 if (idOffset === 0) { 26831 continue; 26832 } 26833 ranges[i].ids = []; 26834 for (let j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) { 26835 ranges[i].ids[j] = view.getUint16(p + idOffset); 26836 idOffset += 2; 26837 } 26838 } 26839 return ranges; 26840 } else if (format === 12) { 26841 const groups = view.getUint32(start + offset + 12); 26842 p = start + offset + 16; 26843 ranges = []; 26844 for (i = 0; i < groups; i++) { 26845 start = view.getUint32(p); 26846 ranges.push({ 26847 start, 26848 end: view.getUint32(p + 4), 26849 idDelta: view.getUint32(p + 8) - start 26850 }); 26851 p += 12; 26852 } 26853 return ranges; 26854 } 26855 throw new FormatError(`unsupported cmap: ${format}`); 26856} 26857function parseCff(data, start, end, seacAnalysisEnabled) { 26858 const properties = {}; 26859 const parser = new CFFParser(new Stream(data, start, end - start), properties, seacAnalysisEnabled); 26860 const cff = parser.parse(); 26861 return { 26862 glyphs: cff.charStrings.objects, 26863 subrs: cff.topDict.privateDict?.subrsIndex?.objects, 26864 gsubrs: cff.globalSubrIndex?.objects, 26865 isCFFCIDFont: cff.isCIDFont, 26866 fdSelect: cff.fdSelect, 26867 fdArray: cff.fdArray 26868 }; 26869} 26870function parseGlyfTable(glyf, loca, isGlyphLocationsLong) { 26871 const view = new DataView(loca.buffer, loca.byteOffset, loca.byteLength); 26872 let itemSize, itemDecode; 26873 if (isGlyphLocationsLong) { 26874 itemSize = 4; 26875 itemDecode = (dv, offset) => dv.getUint32(offset); 26876 } else { 26877 itemSize = 2; 26878 itemDecode = (dv, offset) => 2 * dv.getUint16(offset); 26879 } 26880 const glyphs = []; 26881 let startOffset = itemDecode(view, 0); 26882 for (let j = itemSize; j < loca.length; j += itemSize) { 26883 const endOffset = itemDecode(view, j); 26884 glyphs.push(glyf.subarray(startOffset, endOffset)); 26885 startOffset = endOffset; 26886 } 26887 return glyphs; 26888} 26889function lookupCmap(ranges, unicode) { 26890 const code = unicode.codePointAt(0); 26891 let gid = 0, 26892 l = 0, 26893 r = ranges.length - 1; 26894 while (l < r) { 26895 const c = l + r + 1 >> 1; 26896 if (code < ranges[c].start) { 26897 r = c - 1; 26898 } else { 26899 l = c; 26900 } 26901 } 26902 if (ranges[l].start <= code && code <= ranges[l].end) { 26903 gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff; 26904 } 26905 return { 26906 charCode: code, 26907 glyphId: gid 26908 }; 26909} 26910function compileGlyf(code, cmds, font, visitedGlyphs = new Set()) { 26911 if (visitedGlyphs.has(code)) { 26912 warn("compileGlyf: skipping recursive composite glyph reference."); 26913 return; 26914 } 26915 visitedGlyphs.add(code); 26916 function moveTo(x, y) { 26917 if (firstPoint) { 26918 cmds.add(DrawOPS.lineTo, firstPoint); 26919 } 26920 firstPoint = [x, y]; 26921 cmds.add(DrawOPS.moveTo, [x, y]); 26922 } 26923 function lineTo(x, y) { 26924 cmds.add(DrawOPS.lineTo, [x, y]); 26925 } 26926 function quadraticCurveTo(xa, ya, x, y) { 26927 cmds.add(DrawOPS.quadraticCurveTo, [xa, ya, x, y]); 26928 } 26929 const view = new DataView(code.buffer, code.byteOffset, code.byteLength); 26930 let i = 0; 26931 const numberOfContours = view.getInt16(i); 26932 let flags; 26933 let firstPoint = null; 26934 let x = 0, 26935 y = 0; 26936 i += 10; 26937 if (numberOfContours < 0) { 26938 do { 26939 flags = view.getUint16(i); 26940 const glyphIndex = view.getUint16(i + 2); 26941 i += 4; 26942 let arg1, arg2; 26943 if (flags & 0x01) { 26944 if (flags & 0x02) { 26945 arg1 = view.getInt16(i); 26946 arg2 = view.getInt16(i + 2); 26947 } else { 26948 arg1 = view.getUint16(i); 26949 arg2 = view.getUint16(i + 2); 26950 } 26951 i += 4; 26952 } else if (flags & 0x02) { 26953 arg1 = view.getInt8(i++); 26954 arg2 = view.getInt8(i++); 26955 } else { 26956 arg1 = code[i++]; 26957 arg2 = code[i++]; 26958 } 26959 if (flags & 0x02) { 26960 x = arg1; 26961 y = arg2; 26962 } else { 26963 x = 0; 26964 y = 0; 26965 } 26966 let scaleX = 1, 26967 scaleY = 1, 26968 scale01 = 0, 26969 scale10 = 0; 26970 if (flags & 0x08) { 26971 scaleX = scaleY = getFloat214(view, i); 26972 i += 2; 26973 } else if (flags & 0x40) { 26974 scaleX = getFloat214(view, i); 26975 scaleY = getFloat214(view, i + 2); 26976 i += 4; 26977 } else if (flags & 0x80) { 26978 scaleX = getFloat214(view, i); 26979 scale01 = getFloat214(view, i + 2); 26980 scale10 = getFloat214(view, i + 4); 26981 scaleY = getFloat214(view, i + 6); 26982 i += 8; 26983 } 26984 const subglyph = font.glyphs[glyphIndex]; 26985 if (subglyph) { 26986 cmds.save(); 26987 cmds.transform([scaleX, scale01, scale10, scaleY, x, y]); 26988 if (!(flags & 0x02)) {} 26989 compileGlyf(subglyph, cmds, font, visitedGlyphs); 26990 cmds.restore(); 26991 } 26992 } while (flags & 0x20); 26993 } else { 26994 const endPtsOfContours = []; 26995 let j, jj; 26996 for (j = 0; j < numberOfContours; j++) { 26997 endPtsOfContours.push(view.getUint16(i)); 26998 i += 2; 26999 } 27000 const instructionLength = view.getUint16(i); 27001 i += 2 + instructionLength; 27002 const numberOfPoints = endPtsOfContours.at(-1) + 1; 27003 const points = []; 27004 while (points.length < numberOfPoints) { 27005 flags = code[i++]; 27006 let repeat = 1; 27007 if (flags & 0x08) { 27008 repeat += code[i++]; 27009 } 27010 while (repeat-- > 0) { 27011 points.push({ 27012 flags 27013 }); 27014 } 27015 } 27016 for (j = 0; j < numberOfPoints; j++) { 27017 switch (points[j].flags & 0x12) { 27018 case 0x00: 27019 x += view.getInt16(i); 27020 i += 2; 27021 break; 27022 case 0x02: 27023 x -= code[i++]; 27024 break; 27025 case 0x12: 27026 x += code[i++]; 27027 break; 27028 } 27029 points[j].x = x; 27030 } 27031 for (j = 0; j < numberOfPoints; j++) { 27032 switch (points[j].flags & 0x24) { 27033 case 0x00: 27034 y += view.getInt16(i); 27035 i += 2; 27036 break; 27037 case 0x04: 27038 y -= code[i++]; 27039 break; 27040 case 0x24: 27041 y += code[i++]; 27042 break; 27043 } 27044 points[j].y = y; 27045 } 27046 let startPoint = 0; 27047 for (i = 0; i < numberOfContours; i++) { 27048 const endPoint = endPtsOfContours[i]; 27049 const contour = points.slice(startPoint, endPoint + 1); 27050 if (contour[0].flags & 1) { 27051 contour.push(contour[0]); 27052 } else if (contour.at(-1).flags & 1) { 27053 contour.unshift(contour.at(-1)); 27054 } else { 27055 const p = { 27056 flags: 1, 27057 x: (contour[0].x + contour.at(-1).x) / 2, 27058 y: (contour[0].y + contour.at(-1).y) / 2 27059 }; 27060 contour.unshift(p); 27061 contour.push(p); 27062 } 27063 moveTo(contour[0].x, contour[0].y); 27064 for (j = 1, jj = contour.length; j < jj; j++) { 27065 if (contour[j].flags & 1) { 27066 lineTo(contour[j].x, contour[j].y); 27067 } else if (contour[j + 1].flags & 1) { 27068 quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y); 27069 j++; 27070 } else { 27071 quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2); 27072 } 27073 } 27074 startPoint = endPoint + 1; 27075 } 27076 } 27077 visitedGlyphs.delete(code); 27078} 27079function compileCharString(charStringCode, cmds, font, glyphId) { 27080 function moveTo(x, y) { 27081 if (firstPoint) { 27082 cmds.add(DrawOPS.lineTo, firstPoint); 27083 } 27084 firstPoint = [x, y]; 27085 cmds.add(DrawOPS.moveTo, [x, y]); 27086 } 27087 function lineTo(x, y) { 27088 cmds.add(DrawOPS.lineTo, [x, y]); 27089 } 27090 function bezierCurveTo(x1, y1, x2, y2, x, y) { 27091 cmds.add(DrawOPS.curveTo, [x1, y1, x2, y2, x, y]); 27092 } 27093 const stack = []; 27094 let x = 0, 27095 y = 0; 27096 let stems = 0; 27097 let firstPoint = null; 27098 function parse(code) { 27099 const view = new DataView(code.buffer, code.byteOffset, code.byteLength);
vendor: 8,031 bytes, lines 27099-27358
27099 27100 let i = 0; 27101 while (i < code.length) { 27102 let stackClean = false; 27103 let v = code[i++]; 27104 let xa, xb, ya, yb, y1, y2, y3, n, subrCode; 27105 switch (v) { 27106 case 1: 27107 stems += stack.length >> 1; 27108 stackClean = true; 27109 break; 27110 case 3: 27111 stems += stack.length >> 1; 27112 stackClean = true; 27113 break; 27114 case 4: 27115 y += stack.pop(); 27116 moveTo(x, y); 27117 stackClean = true; 27118 break; 27119 case 5: 27120 while (stack.length > 0) { 27121 x += stack.shift(); 27122 y += stack.shift(); 27123 lineTo(x, y); 27124 } 27125 break; 27126 case 6: 27127 while (stack.length > 0) { 27128 x += stack.shift(); 27129 lineTo(x, y); 27130 if (stack.length === 0) { 27131 break; 27132 } 27133 y += stack.shift(); 27134 lineTo(x, y); 27135 } 27136 break; 27137 case 7: 27138 while (stack.length > 0) { 27139 y += stack.shift(); 27140 lineTo(x, y); 27141 if (stack.length === 0) { 27142 break; 27143 } 27144 x += stack.shift(); 27145 lineTo(x, y); 27146 } 27147 break; 27148 case 8: 27149 while (stack.length > 0) { 27150 xa = x + stack.shift(); 27151 ya = y + stack.shift(); 27152 xb = xa + stack.shift(); 27153 yb = ya + stack.shift(); 27154 x = xb + stack.shift(); 27155 y = yb + stack.shift(); 27156 bezierCurveTo(xa, ya, xb, yb, x, y); 27157 } 27158 break; 27159 case 10: 27160 n = stack.pop(); 27161 subrCode = null; 27162 if (font.isCFFCIDFont) { 27163 const fdIndex = font.fdSelect.getFDIndex(glyphId); 27164 if (fdIndex >= 0 && fdIndex < font.fdArray.length) { 27165 const fontDict = font.fdArray[fdIndex]; 27166 let subrs; 27167 if (fontDict.privateDict?.subrsIndex) { 27168 subrs = fontDict.privateDict.subrsIndex.objects; 27169 } 27170 if (subrs) { 27171 n += getSubroutineBias(subrs); 27172 subrCode = subrs[n]; 27173 } 27174 } else { 27175 warn("Invalid fd index for glyph index."); 27176 } 27177 } else { 27178 subrCode = font.subrs[n + font.subrsBias]; 27179 } 27180 if (subrCode) { 27181 parse(subrCode); 27182 } 27183 break; 27184 case 11: 27185 return; 27186 case 12: 27187 v = code[i++]; 27188 switch (v) { 27189 case 34: 27190 xa = x + stack.shift(); 27191 xb = xa + stack.shift(); 27192 y1 = y + stack.shift(); 27193 x = xb + stack.shift(); 27194 bezierCurveTo(xa, y, xb, y1, x, y1); 27195 xa = x + stack.shift(); 27196 xb = xa + stack.shift(); 27197 x = xb + stack.shift(); 27198 bezierCurveTo(xa, y1, xb, y, x, y); 27199 break; 27200 case 35: 27201 xa = x + stack.shift(); 27202 ya = y + stack.shift(); 27203 xb = xa + stack.shift(); 27204 yb = ya + stack.shift(); 27205 x = xb + stack.shift(); 27206 y = yb + stack.shift(); 27207 bezierCurveTo(xa, ya, xb, yb, x, y); 27208 xa = x + stack.shift(); 27209 ya = y + stack.shift(); 27210 xb = xa + stack.shift(); 27211 yb = ya + stack.shift(); 27212 x = xb + stack.shift(); 27213 y = yb + stack.shift(); 27214 bezierCurveTo(xa, ya, xb, yb, x, y); 27215 stack.pop(); 27216 break; 27217 case 36: 27218 xa = x + stack.shift(); 27219 y1 = y + stack.shift(); 27220 xb = xa + stack.shift(); 27221 y2 = y1 + stack.shift(); 27222 x = xb + stack.shift(); 27223 bezierCurveTo(xa, y1, xb, y2, x, y2); 27224 xa = x + stack.shift(); 27225 xb = xa + stack.shift(); 27226 y3 = y2 + stack.shift(); 27227 x = xb + stack.shift(); 27228 bezierCurveTo(xa, y2, xb, y3, x, y); 27229 break; 27230 case 37: 27231 const x0 = x, 27232 y0 = y; 27233 xa = x + stack.shift(); 27234 ya = y + stack.shift(); 27235 xb = xa + stack.shift(); 27236 yb = ya + stack.shift(); 27237 x = xb + stack.shift(); 27238 y = yb + stack.shift(); 27239 bezierCurveTo(xa, ya, xb, yb, x, y); 27240 xa = x + stack.shift(); 27241 ya = y + stack.shift(); 27242 xb = xa + stack.shift(); 27243 yb = ya + stack.shift(); 27244 x = xb; 27245 y = yb; 27246 if (Math.abs(x - x0) > Math.abs(y - y0)) { 27247 x += stack.shift(); 27248 } else { 27249 y += stack.shift(); 27250 } 27251 bezierCurveTo(xa, ya, xb, yb, x, y); 27252 break; 27253 default: 27254 throw new FormatError(`unknown operator: 12 ${v}`); 27255 } 27256 break; 27257 case 14: 27258 if (stack.length >= 4) { 27259 const achar = stack.pop(); 27260 const bchar = stack.pop(); 27261 y = stack.pop(); 27262 x = stack.pop(); 27263 cmds.save(); 27264 cmds.translate(x, y); 27265 let cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[achar]])); 27266 compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId); 27267 cmds.restore(); 27268 cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[bchar]])); 27269 compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId); 27270 } 27271 return; 27272 case 18: 27273 stems += stack.length >> 1; 27274 stackClean = true; 27275 break; 27276 case 19: 27277 stems += stack.length >> 1; 27278 i += stems + 7 >> 3; 27279 stackClean = true; 27280 break; 27281 case 20: 27282 stems += stack.length >> 1; 27283 i += stems + 7 >> 3; 27284 stackClean = true; 27285 break; 27286 case 21: 27287 y += stack.pop(); 27288 x += stack.pop(); 27289 moveTo(x, y); 27290 stackClean = true; 27291 break; 27292 case 22: 27293 x += stack.pop(); 27294 moveTo(x, y); 27295 stackClean = true; 27296 break; 27297 case 23: 27298 stems += stack.length >> 1; 27299 stackClean = true; 27300 break; 27301 case 24: 27302 while (stack.length > 2) { 27303 xa = x + stack.shift(); 27304 ya = y + stack.shift(); 27305 xb = xa + stack.shift(); 27306 yb = ya + stack.shift(); 27307 x = xb + stack.shift(); 27308 y = yb + stack.shift(); 27309 bezierCurveTo(xa, ya, xb, yb, x, y); 27310 } 27311 x += stack.shift(); 27312 y += stack.shift(); 27313 lineTo(x, y); 27314 break; 27315 case 25: 27316 while (stack.length > 6) { 27317 x += stack.shift(); 27318 y += stack.shift(); 27319 lineTo(x, y); 27320 } 27321 xa = x + stack.shift(); 27322 ya = y + stack.shift(); 27323 xb = xa + stack.shift(); 27324 yb = ya + stack.shift(); 27325 x = xb + stack.shift(); 27326 y = yb + stack.shift(); 27327 bezierCurveTo(xa, ya, xb, yb, x, y); 27328 break; 27329 case 26: 27330 if (stack.length % 2) { 27331 x += stack.shift(); 27332 } 27333 while (stack.length > 0) { 27334 xa = x; 27335 ya = y + stack.shift(); 27336 xb = xa + stack.shift(); 27337 yb = ya + stack.shift(); 27338 x = xb; 27339 y = yb + stack.shift(); 27340 bezierCurveTo(xa, ya, xb, yb, x, y); 27341 } 27342 break; 27343 case 27: 27344 if (stack.length % 2) { 27345 y += stack.shift(); 27346 } 27347 while (stack.length > 0) { 27348 xa = x + stack.shift(); 27349 ya = y; 27350 xb = xa + stack.shift(); 27351 yb = ya + stack.shift(); 27352 x = xb + stack.shift(); 27353 y = yb; 27354 bezierCurveTo(xa, ya, xb, yb, x, y); 27355 } 27356 break; 27357 case 28: 27358 stack.push(
vendor: 1,956 bytes, lines 27358-27418
27358view.getInt16(i)); 27359 i += 2; 27360 break; 27361 case 29: 27362 n = stack.pop() + font.gsubrsBias; 27363 subrCode = font.gsubrs[n]; 27364 if (subrCode) { 27365 parse(subrCode); 27366 } 27367 break; 27368 case 30: 27369 while (stack.length > 0) { 27370 xa = x; 27371 ya = y + stack.shift(); 27372 xb = xa + stack.shift(); 27373 yb = ya + stack.shift(); 27374 x = xb + stack.shift(); 27375 y = yb + (stack.length === 1 ? stack.shift() : 0); 27376 bezierCurveTo(xa, ya, xb, yb, x, y); 27377 if (stack.length === 0) { 27378 break; 27379 } 27380 xa = x + stack.shift(); 27381 ya = y; 27382 xb = xa + stack.shift(); 27383 yb = ya + stack.shift(); 27384 y = yb + stack.shift(); 27385 x = xb + (stack.length === 1 ? stack.shift() : 0); 27386 bezierCurveTo(xa, ya, xb, yb, x, y); 27387 } 27388 break; 27389 case 31: 27390 while (stack.length > 0) { 27391 xa = x + stack.shift(); 27392 ya = y; 27393 xb = xa + stack.shift(); 27394 yb = ya + stack.shift(); 27395 y = yb + stack.shift(); 27396 x = xb + (stack.length === 1 ? stack.shift() : 0); 27397 bezierCurveTo(xa, ya, xb, yb, x, y); 27398 if (stack.length === 0) { 27399 break; 27400 } 27401 xa = x; 27402 ya = y + stack.shift(); 27403 xb = xa + stack.shift(); 27404 yb = ya + stack.shift(); 27405 x = xb + stack.shift(); 27406 y = yb + (stack.length === 1 ? stack.shift() : 0); 27407 bezierCurveTo(xa, ya, xb, yb, x, y); 27408 } 27409 break; 27410 default: 27411 if (v < 32) { 27412 throw new FormatError(`unknown operator: ${v}`); 27413 } 27414 if (v < 247) { 27415 stack.push(v - 139); 27416 } else if (v < 251) { 27417 stack.push((v - 247) * 256 + code[i++] + 108); 27418 } else if (v < 255) {
27419 stack.push(-(v - 251) * 256 - code[i++] - 108); 27420 } else { 27421 stack.push(view.getInt32(i) / 65536); 27422 i += 4; 27423 } 27424 break; 27425 } 27426 if (stackClean) { 27427 stack.length = 0; 27428 } 27429 } 27430 } 27431 parse(charStringCode); 27432} 27433class Commands { 27434 cmds = []; 27435 transformStack = []; 27436 currentTransform = [1, 0, 0, 1, 0, 0]; 27437 add(cmd, args) { 27438 if (args) { 27439 const { 27440 currentTransform 27441 } = this; 27442 for (let i = 0, ii = args.length; i < ii; i += 2) { 27443 Util.applyTransform(args, currentTransform, i); 27444 } 27445 this.cmds.push(cmd, ...args); 27446 } else { 27447 this.cmds.push(cmd); 27448 } 27449 } 27450 transform(transf) { 27451 this.currentTransform = Util.transform(this.currentTransform, transf); 27452 } 27453 translate(x, y) { 27454 this.transform([1, 0, 0, 1, x, y]); 27455 } 27456 save() { 27457 this.transformStack.push(this.currentTransform.slice()); 27458 } 27459 restore() { 27460 this.currentTransform = this.transformStack.pop() || [1, 0, 0, 1, 0, 0]; 27461 } 27462 getPath() { 27463 if (FeatureTest.isFloat16ArraySupported) { 27464 return new Float16Array(this.cmds); 27465 } 27466 return new Float32Array(this.cmds); 27467 } 27468} 27469class CompiledFont { 27470 constructor(fontMatrix) { 27471 this.fontMatrix = fontMatrix; 27472 this.compiledGlyphs = Object.create(null); 27473 this.compiledCharCodeToGlyphId = Object.create(null); 27474 } 27475 static get NOOP() { 27476 return shadow(this, "NOOP", FeatureTest.isFloat16ArraySupported ? new Float16Array(0) : new Float32Array(0)); 27477 } 27478 getPathJs(unicode) { 27479 const { 27480 charCode, 27481 glyphId 27482 } = lookupCmap(this.cmap, unicode); 27483 let fn = this.compiledGlyphs[glyphId], 27484 compileEx; 27485 if (fn === undefined) { 27486 try { 27487 fn = this.compileGlyph(this.glyphs[glyphId], glyphId); 27488 } catch (ex) { 27489 fn = CompiledFont.NOOP; 27490 compileEx = ex; 27491 } 27492 this.compiledGlyphs[glyphId] = fn; 27493 } 27494 this.compiledCharCodeToGlyphId[charCode] ??= glyphId; 27495 if (compileEx) { 27496 throw compileEx; 27497 } 27498 return fn; 27499 } 27500 compileGlyph(code, glyphId) { 27501 if (!code?.length || code[0] === 14) { 27502 return CompiledFont.NOOP; 27503 } 27504 let fontMatrix = this.fontMatrix; 27505 if (this.isCFFCIDFont) { 27506 const fdIndex = this.fdSelect.getFDIndex(glyphId); 27507 if (fdIndex >= 0 && fdIndex < this.fdArray.length) { 27508 const fontDict = this.fdArray[fdIndex]; 27509 fontMatrix = fontDict.getByName("FontMatrix") || FONT_IDENTITY_MATRIX; 27510 } else { 27511 warn("Invalid fd index for glyph index."); 27512 } 27513 } 27514 assert(isNumberArray(fontMatrix, 6), "Expected a valid fontMatrix."); 27515 const cmds = new Commands(); 27516 cmds.transform(fontMatrix.slice()); 27517 this.compileGlyphImpl(code, cmds, glyphId); 27518 cmds.add(DrawOPS.closePath); 27519 return cmds.getPath(); 27520 } 27521 compileGlyphImpl() { 27522 unreachable("Children classes should implement this."); 27523 } 27524 hasBuiltPath(unicode) { 27525 const { 27526 charCode, 27527 glyphId 27528 } = lookupCmap(this.cmap, unicode); 27529 return this.compiledGlyphs[glyphId] !== undefined && this.compiledCharCodeToGlyphId[charCode] !== undefined; 27530 } 27531} 27532class TrueTypeCompiled extends CompiledFont { 27533 constructor(glyphs, cmap, fontMatrix) { 27534 super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]); 27535 this.glyphs = glyphs; 27536 this.cmap = cmap; 27537 } 27538 compileGlyphImpl(code, cmds) { 27539 compileGlyf(code, cmds, this); 27540 } 27541} 27542class Type2Compiled extends CompiledFont { 27543 constructor(cffInfo, cmap, fontMatrix) { 27544 super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]); 27545 this.glyphs = cffInfo.glyphs; 27546 this.gsubrs = cffInfo.gsubrs || []; 27547 this.subrs = cffInfo.subrs || []; 27548 this.cmap = cmap; 27549 this.glyphNameMap = getGlyphsUnicode(); 27550 this.gsubrsBias = getSubroutineBias(this.gsubrs); 27551 this.subrsBias = getSubroutineBias(this.subrs); 27552 this.isCFFCIDFont = cffInfo.isCFFCIDFont; 27553 this.fdSelect = cffInfo.fdSelect; 27554 this.fdArray = cffInfo.fdArray; 27555 } 27556 compileGlyphImpl(code, cmds, glyphId) { 27557 compileCharString(code, cmds, this, glyphId); 27558 } 27559} 27560class FontRendererFactory { 27561 static create(font, seacAnalysisEnabled) { 27562 const data = new Uint8Array(font.data), 27563 view = new DataView(data.buffer);
vendor: 1,413 bytes, lines 27564-27604
27564 let cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm; 27565 const numTables = view.getUint16(4); 27566 for (let i = 0, p = 12; i < numTables; i++, p += 16) { 27567 const tag = bytesToString(data.subarray(p, p + 4)); 27568 const offset = view.getUint32(p + 8); 27569 const length = view.getUint32(p + 12); 27570 switch (tag) { 27571 case "cmap": 27572 cmap = parseCmap(data, offset, offset + length); 27573 break; 27574 case "glyf": 27575 glyf = data.subarray(offset, offset + length); 27576 break; 27577 case "loca": 27578 loca = data.subarray(offset, offset + length); 27579 break; 27580 case "head": 27581 unitsPerEm = view.getUint16(offset + 18); 27582 indexToLocFormat = view.getUint16(offset + 50); 27583 break; 27584 case "CFF ": 27585 cff = parseCff(data, offset, offset + length, seacAnalysisEnabled); 27586 break; 27587 } 27588 } 27589 if (glyf) { 27590 const fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0]; 27591 return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix); 27592 } 27593 return new Type2Compiled(cff, cmap, font.fontMatrix); 27594 } 27595} 27596 27597;// ./src/core/metrics.js 27598 27599const getMetrics = getLookupTableFactory(function (t) { 27600 t.Courier = 600; 27601 t["Courier-Bold"] = 600; 27602 t["Courier-BoldOblique"] = 600; 27603 t["Courier-Oblique"] = 600; 27604 t.Helvetica = getLookupTableFactory
vendor: 5,719 bytes, lines 27604-27884
27604(function (t) { 27605 t.space = 278; 27606 t.exclam = 278; 27607 t.quotedbl = 355; 27608 t.numbersign = 556; 27609 t.dollar = 556; 27610 t.percent = 889; 27611 t.ampersand = 667; 27612 t.quoteright = 222; 27613 t.parenleft = 333; 27614 t.parenright = 333; 27615 t.asterisk = 389; 27616 t.plus = 584; 27617 t.comma = 278; 27618 t.hyphen = 333; 27619 t.period = 278; 27620 t.slash = 278; 27621 t.zero = 556; 27622 t.one = 556; 27623 t.two = 556; 27624 t.three = 556; 27625 t.four = 556; 27626 t.five = 556; 27627 t.six = 556; 27628 t.seven = 556; 27629 t.eight = 556; 27630 t.nine = 556; 27631 t.colon = 278; 27632 t.semicolon = 278; 27633 t.less = 584; 27634 t.equal = 584; 27635 t.greater = 584; 27636 t.question = 556; 27637 t.at = 1015; 27638 t.A = 667; 27639 t.B = 667; 27640 t.C = 722; 27641 t.D = 722; 27642 t.E = 667; 27643 t.F = 611; 27644 t.G = 778; 27645 t.H = 722; 27646 t.I = 278; 27647 t.J = 500; 27648 t.K = 667; 27649 t.L = 556; 27650 t.M = 833; 27651 t.N = 722; 27652 t.O = 778; 27653 t.P = 667; 27654 t.Q = 778; 27655 t.R = 722; 27656 t.S = 667; 27657 t.T = 611; 27658 t.U = 722; 27659 t.V = 667; 27660 t.W = 944; 27661 t.X = 667; 27662 t.Y = 667; 27663 t.Z = 611; 27664 t.bracketleft = 278; 27665 t.backslash = 278; 27666 t.bracketright = 278; 27667 t.asciicircum = 469; 27668 t.underscore = 556; 27669 t.quoteleft = 222; 27670 t.a = 556; 27671 t.b = 556; 27672 t.c = 500; 27673 t.d = 556; 27674 t.e = 556; 27675 t.f = 278; 27676 t.g = 556; 27677 t.h = 556; 27678 t.i = 222; 27679 t.j = 222; 27680 t.k = 500; 27681 t.l = 222; 27682 t.m = 833; 27683 t.n = 556; 27684 t.o = 556; 27685 t.p = 556; 27686 t.q = 556; 27687 t.r = 333; 27688 t.s = 500; 27689 t.t = 278; 27690 t.u = 556; 27691 t.v = 500; 27692 t.w = 722; 27693 t.x = 500; 27694 t.y = 500; 27695 t.z = 500; 27696 t.braceleft = 334; 27697 t.bar = 260; 27698 t.braceright = 334; 27699 t.asciitilde = 584; 27700 t.exclamdown = 333; 27701 t.cent = 556; 27702 t.sterling = 556; 27703 t.fraction = 167; 27704 t.yen = 556; 27705 t.florin = 556; 27706 t.section = 556; 27707 t.currency = 556; 27708 t.quotesingle = 191; 27709 t.quotedblleft = 333; 27710 t.guillemotleft = 556; 27711 t.guilsinglleft = 333; 27712 t.guilsinglright = 333; 27713 t.fi = 500; 27714 t.fl = 500; 27715 t.endash = 556; 27716 t.dagger = 556; 27717 t.daggerdbl = 556; 27718 t.periodcentered = 278; 27719 t.paragraph = 537; 27720 t.bullet = 350; 27721 t.quotesinglbase = 222; 27722 t.quotedblbase = 333; 27723 t.quotedblright = 333; 27724 t.guillemotright = 556; 27725 t.ellipsis = 1000; 27726 t.perthousand = 1000; 27727 t.questiondown = 611; 27728 t.grave = 333; 27729 t.acute = 333; 27730 t.circumflex = 333; 27731 t.tilde = 333; 27732 t.macron = 333; 27733 t.breve = 333; 27734 t.dotaccent = 333; 27735 t.dieresis = 333; 27736 t.ring = 333; 27737 t.cedilla = 333; 27738 t.hungarumlaut = 333; 27739 t.ogonek = 333; 27740 t.caron = 333; 27741 t.emdash = 1000; 27742 t.AE = 1000; 27743 t.ordfeminine = 370; 27744 t.Lslash = 556; 27745 t.Oslash = 778; 27746 t.OE = 1000; 27747 t.ordmasculine = 365; 27748 t.ae = 889; 27749 t.dotlessi = 278; 27750 t.lslash = 222; 27751 t.oslash = 611; 27752 t.oe = 944; 27753 t.germandbls = 611; 27754 t.Idieresis = 278; 27755 t.eacute = 556; 27756 t.abreve = 556; 27757 t.uhungarumlaut = 556; 27758 t.ecaron = 556; 27759 t.Ydieresis = 667; 27760 t.divide = 584; 27761 t.Yacute = 667; 27762 t.Acircumflex = 667; 27763 t.aacute = 556; 27764 t.Ucircumflex = 722; 27765 t.yacute = 500; 27766 t.scommaaccent = 500; 27767 t.ecircumflex = 556; 27768 t.Uring = 722; 27769 t.Udieresis = 722; 27770 t.aogonek = 556; 27771 t.Uacute = 722; 27772 t.uogonek = 556; 27773 t.Edieresis = 667; 27774 t.Dcroat = 722; 27775 t.commaaccent = 250; 27776 t.copyright = 737; 27777 t.Emacron = 667; 27778 t.ccaron = 500; 27779 t.aring = 556; 27780 t.Ncommaaccent = 722; 27781 t.lacute = 222; 27782 t.agrave = 556; 27783 t.Tcommaaccent = 611; 27784 t.Cacute = 722; 27785 t.atilde = 556; 27786 t.Edotaccent = 667; 27787 t.scaron = 500; 27788 t.scedilla = 500; 27789 t.iacute = 278; 27790 t.lozenge = 471; 27791 t.Rcaron = 722; 27792 t.Gcommaaccent = 778; 27793 t.ucircumflex = 556; 27794 t.acircumflex = 556; 27795 t.Amacron = 667; 27796 t.rcaron = 333; 27797 t.ccedilla = 500; 27798 t.Zdotaccent = 611; 27799 t.Thorn = 667; 27800 t.Omacron = 778; 27801 t.Racute = 722; 27802 t.Sacute = 667; 27803 t.dcaron = 643; 27804 t.Umacron = 722; 27805 t.uring = 556; 27806 t.threesuperior = 333; 27807 t.Ograve = 778; 27808 t.Agrave = 667; 27809 t.Abreve = 667; 27810 t.multiply = 584; 27811 t.uacute = 556; 27812 t.Tcaron = 611; 27813 t.partialdiff = 476; 27814 t.ydieresis = 500; 27815 t.Nacute = 722; 27816 t.icircumflex = 278; 27817 t.Ecircumflex = 667; 27818 t.adieresis = 556; 27819 t.edieresis = 556; 27820 t.cacute = 500; 27821 t.nacute = 556; 27822 t.umacron = 556; 27823 t.Ncaron = 722; 27824 t.Iacute = 278; 27825 t.plusminus = 584; 27826 t.brokenbar = 260; 27827 t.registered = 737; 27828 t.Gbreve = 778; 27829 t.Idotaccent = 278; 27830 t.summation = 600; 27831 t.Egrave = 667; 27832 t.racute = 333; 27833 t.omacron = 556; 27834 t.Zacute = 611; 27835 t.Zcaron = 611; 27836 t.greaterequal = 549; 27837 t.Eth = 722; 27838 t.Ccedilla = 722; 27839 t.lcommaaccent = 222; 27840 t.tcaron = 317; 27841 t.eogonek = 556; 27842 t.Uogonek = 722; 27843 t.Aacute = 667; 27844 t.Adieresis = 667; 27845 t.egrave = 556; 27846 t.zacute = 500; 27847 t.iogonek = 222; 27848 t.Oacute = 778; 27849 t.oacute = 556; 27850 t.amacron = 556; 27851 t.sacute = 500; 27852 t.idieresis = 278; 27853 t.Ocircumflex = 778; 27854 t.Ugrave = 722; 27855 t.Delta = 612; 27856 t.thorn = 556; 27857 t.twosuperior = 333; 27858 t.Odieresis = 778; 27859 t.mu = 556; 27860 t.igrave = 278; 27861 t.ohungarumlaut = 556; 27862 t.Eogonek = 667; 27863 t.dcroat = 556; 27864 t.threequarters = 834; 27865 t.Scedilla = 667; 27866 t.lcaron = 299; 27867 t.Kcommaaccent = 667; 27868 t.Lacute = 556; 27869 t.trademark = 1000; 27870 t.edotaccent = 556; 27871 t.Igrave = 278; 27872 t.Imacron = 278; 27873 t.Lcaron = 556; 27874 t.onehalf = 834; 27875 t.lessequal = 549; 27876 t.ocircumflex = 556; 27877 t.ntilde = 556; 27878 t.Uhungarumlaut = 722; 27879 t.Eacute = 667; 27880 t.emacron = 556; 27881 t.gbreve = 556; 27882 t.onequarter = 834; 27883 t.Scaron = 667; 27884 t.Scommaaccent = 667;
vendor: 14,768 bytes, lines 27885-28600
27885 t.Ohungarumlaut = 778; 27886 t.degree = 400; 27887 t.ograve = 556; 27888 t.Ccaron = 722; 27889 t.ugrave = 556; 27890 t.radical = 453; 27891 t.Dcaron = 722; 27892 t.rcommaaccent = 333; 27893 t.Ntilde = 722; 27894 t.otilde = 556; 27895 t.Rcommaaccent = 722; 27896 t.Lcommaaccent = 556; 27897 t.Atilde = 667; 27898 t.Aogonek = 667; 27899 t.Aring = 667; 27900 t.Otilde = 778; 27901 t.zdotaccent = 500; 27902 t.Ecaron = 667; 27903 t.Iogonek = 278; 27904 t.kcommaaccent = 500; 27905 t.minus = 584; 27906 t.Icircumflex = 278; 27907 t.ncaron = 556; 27908 t.tcommaaccent = 278; 27909 t.logicalnot = 584; 27910 t.odieresis = 556; 27911 t.udieresis = 556; 27912 t.notequal = 549; 27913 t.gcommaaccent = 556; 27914 t.eth = 556; 27915 t.zcaron = 500; 27916 t.ncommaaccent = 556; 27917 t.onesuperior = 333; 27918 t.imacron = 278; 27919 t.Euro = 556; 27920 }); 27921 t["Helvetica-Bold"] = getLookupTableFactory(function (t) { 27922 t.space = 278; 27923 t.exclam = 333; 27924 t.quotedbl = 474; 27925 t.numbersign = 556; 27926 t.dollar = 556; 27927 t.percent = 889; 27928 t.ampersand = 722; 27929 t.quoteright = 278; 27930 t.parenleft = 333; 27931 t.parenright = 333; 27932 t.asterisk = 389; 27933 t.plus = 584; 27934 t.comma = 278; 27935 t.hyphen = 333; 27936 t.period = 278; 27937 t.slash = 278; 27938 t.zero = 556; 27939 t.one = 556; 27940 t.two = 556; 27941 t.three = 556; 27942 t.four = 556; 27943 t.five = 556; 27944 t.six = 556; 27945 t.seven = 556; 27946 t.eight = 556; 27947 t.nine = 556; 27948 t.colon = 333; 27949 t.semicolon = 333; 27950 t.less = 584; 27951 t.equal = 584; 27952 t.greater = 584; 27953 t.question = 611; 27954 t.at = 975; 27955 t.A = 722; 27956 t.B = 722; 27957 t.C = 722; 27958 t.D = 722; 27959 t.E = 667; 27960 t.F = 611; 27961 t.G = 778; 27962 t.H = 722; 27963 t.I = 278; 27964 t.J = 556; 27965 t.K = 722; 27966 t.L = 611; 27967 t.M = 833; 27968 t.N = 722; 27969 t.O = 778; 27970 t.P = 667; 27971 t.Q = 778; 27972 t.R = 722; 27973 t.S = 667; 27974 t.T = 611; 27975 t.U = 722; 27976 t.V = 667; 27977 t.W = 944; 27978 t.X = 667; 27979 t.Y = 667; 27980 t.Z = 611; 27981 t.bracketleft = 333; 27982 t.backslash = 278; 27983 t.bracketright = 333; 27984 t.asciicircum = 584; 27985 t.underscore = 556; 27986 t.quoteleft = 278; 27987 t.a = 556; 27988 t.b = 611; 27989 t.c = 556; 27990 t.d = 611; 27991 t.e = 556; 27992 t.f = 333; 27993 t.g = 611; 27994 t.h = 611; 27995 t.i = 278; 27996 t.j = 278; 27997 t.k = 556; 27998 t.l = 278; 27999 t.m = 889; 28000 t.n = 611; 28001 t.o = 611; 28002 t.p = 611; 28003 t.q = 611; 28004 t.r = 389; 28005 t.s = 556; 28006 t.t = 333; 28007 t.u = 611; 28008 t.v = 556; 28009 t.w = 778; 28010 t.x = 556; 28011 t.y = 556; 28012 t.z = 500; 28013 t.braceleft = 389; 28014 t.bar = 280; 28015 t.braceright = 389; 28016 t.asciitilde = 584; 28017 t.exclamdown = 333; 28018 t.cent = 556; 28019 t.sterling = 556; 28020 t.fraction = 167; 28021 t.yen = 556; 28022 t.florin = 556; 28023 t.section = 556; 28024 t.currency = 556; 28025 t.quotesingle = 238; 28026 t.quotedblleft = 500; 28027 t.guillemotleft = 556; 28028 t.guilsinglleft = 333; 28029 t.guilsinglright = 333; 28030 t.fi = 611; 28031 t.fl = 611; 28032 t.endash = 556; 28033 t.dagger = 556; 28034 t.daggerdbl = 556; 28035 t.periodcentered = 278; 28036 t.paragraph = 556; 28037 t.bullet = 350; 28038 t.quotesinglbase = 278; 28039 t.quotedblbase = 500; 28040 t.quotedblright = 500; 28041 t.guillemotright = 556; 28042 t.ellipsis = 1000; 28043 t.perthousand = 1000; 28044 t.questiondown = 611; 28045 t.grave = 333; 28046 t.acute = 333; 28047 t.circumflex = 333; 28048 t.tilde = 333; 28049 t.macron = 333; 28050 t.breve = 333; 28051 t.dotaccent = 333; 28052 t.dieresis = 333; 28053 t.ring = 333; 28054 t.cedilla = 333; 28055 t.hungarumlaut = 333; 28056 t.ogonek = 333; 28057 t.caron = 333; 28058 t.emdash = 1000; 28059 t.AE = 1000; 28060 t.ordfeminine = 370; 28061 t.Lslash = 611; 28062 t.Oslash = 778; 28063 t.OE = 1000; 28064 t.ordmasculine = 365; 28065 t.ae = 889; 28066 t.dotlessi = 278; 28067 t.lslash = 278; 28068 t.oslash = 611; 28069 t.oe = 944; 28070 t.germandbls = 611; 28071 t.Idieresis = 278; 28072 t.eacute = 556; 28073 t.abreve = 556; 28074 t.uhungarumlaut = 611; 28075 t.ecaron = 556; 28076 t.Ydieresis = 667; 28077 t.divide = 584; 28078 t.Yacute = 667; 28079 t.Acircumflex = 722; 28080 t.aacute = 556; 28081 t.Ucircumflex = 722; 28082 t.yacute = 556; 28083 t.scommaaccent = 556; 28084 t.ecircumflex = 556; 28085 t.Uring = 722; 28086 t.Udieresis = 722; 28087 t.aogonek = 556; 28088 t.Uacute = 722; 28089 t.uogonek = 611; 28090 t.Edieresis = 667; 28091 t.Dcroat = 722; 28092 t.commaaccent = 250; 28093 t.copyright = 737; 28094 t.Emacron = 667; 28095 t.ccaron = 556; 28096 t.aring = 556; 28097 t.Ncommaaccent = 722; 28098 t.lacute = 278; 28099 t.agrave = 556; 28100 t.Tcommaaccent = 611; 28101 t.Cacute = 722; 28102 t.atilde = 556; 28103 t.Edotaccent = 667; 28104 t.scaron = 556; 28105 t.scedilla = 556; 28106 t.iacute = 278; 28107 t.lozenge = 494; 28108 t.Rcaron = 722; 28109 t.Gcommaaccent = 778; 28110 t.ucircumflex = 611; 28111 t.acircumflex = 556; 28112 t.Amacron = 722; 28113 t.rcaron = 389; 28114 t.ccedilla = 556; 28115 t.Zdotaccent = 611; 28116 t.Thorn = 667; 28117 t.Omacron = 778; 28118 t.Racute = 722; 28119 t.Sacute = 667; 28120 t.dcaron = 743; 28121 t.Umacron = 722; 28122 t.uring = 611; 28123 t.threesuperior = 333; 28124 t.Ograve = 778; 28125 t.Agrave = 722; 28126 t.Abreve = 722; 28127 t.multiply = 584; 28128 t.uacute = 611; 28129 t.Tcaron = 611; 28130 t.partialdiff = 494; 28131 t.ydieresis = 556; 28132 t.Nacute = 722; 28133 t.icircumflex = 278; 28134 t.Ecircumflex = 667; 28135 t.adieresis = 556; 28136 t.edieresis = 556; 28137 t.cacute = 556; 28138 t.nacute = 611; 28139 t.umacron = 611; 28140 t.Ncaron = 722; 28141 t.Iacute = 278; 28142 t.plusminus = 584; 28143 t.brokenbar = 280; 28144 t.registered = 737; 28145 t.Gbreve = 778; 28146 t.Idotaccent = 278; 28147 t.summation = 600; 28148 t.Egrave = 667; 28149 t.racute = 389; 28150 t.omacron = 611; 28151 t.Zacute = 611; 28152 t.Zcaron = 611; 28153 t.greaterequal = 549; 28154 t.Eth = 722; 28155 t.Ccedilla = 722; 28156 t.lcommaaccent = 278; 28157 t.tcaron = 389; 28158 t.eogonek = 556; 28159 t.Uogonek = 722; 28160 t.Aacute = 722; 28161 t.Adieresis = 722; 28162 t.egrave = 556; 28163 t.zacute = 500; 28164 t.iogonek = 278; 28165 t.Oacute = 778; 28166 t.oacute = 611; 28167 t.amacron = 556; 28168 t.sacute = 556; 28169 t.idieresis = 278; 28170 t.Ocircumflex = 778; 28171 t.Ugrave = 722; 28172 t.Delta = 612; 28173 t.thorn = 611; 28174 t.twosuperior = 333; 28175 t.Odieresis = 778; 28176 t.mu = 611; 28177 t.igrave = 278; 28178 t.ohungarumlaut = 611; 28179 t.Eogonek = 667; 28180 t.dcroat = 611; 28181 t.threequarters = 834; 28182 t.Scedilla = 667; 28183 t.lcaron = 400; 28184 t.Kcommaaccent = 722; 28185 t.Lacute = 611; 28186 t.trademark = 1000; 28187 t.edotaccent = 556; 28188 t.Igrave = 278; 28189 t.Imacron = 278; 28190 t.Lcaron = 611; 28191 t.onehalf = 834; 28192 t.lessequal = 549; 28193 t.ocircumflex = 611; 28194 t.ntilde = 611; 28195 t.Uhungarumlaut = 722; 28196 t.Eacute = 667; 28197 t.emacron = 556; 28198 t.gbreve = 611; 28199 t.onequarter = 834; 28200 t.Scaron = 667; 28201 t.Scommaaccent = 667; 28202 t.Ohungarumlaut = 778; 28203 t.degree = 400; 28204 t.ograve = 611; 28205 t.Ccaron = 722; 28206 t.ugrave = 611; 28207 t.radical = 549; 28208 t.Dcaron = 722; 28209 t.rcommaaccent = 389; 28210 t.Ntilde = 722; 28211 t.otilde = 611; 28212 t.Rcommaaccent = 722; 28213 t.Lcommaaccent = 611; 28214 t.Atilde = 722; 28215 t.Aogonek = 722; 28216 t.Aring = 722; 28217 t.Otilde = 778; 28218 t.zdotaccent = 500; 28219 t.Ecaron = 667; 28220 t.Iogonek = 278; 28221 t.kcommaaccent = 556; 28222 t.minus = 584; 28223 t.Icircumflex = 278; 28224 t.ncaron = 611; 28225 t.tcommaaccent = 333; 28226 t.logicalnot = 584; 28227 t.odieresis = 611; 28228 t.udieresis = 611; 28229 t.notequal = 549; 28230 t.gcommaaccent = 611; 28231 t.eth = 611; 28232 t.zcaron = 500; 28233 t.ncommaaccent = 611; 28234 t.onesuperior = 333; 28235 t.imacron = 278; 28236 t.Euro = 556; 28237 }); 28238 t["Helvetica-BoldOblique"] = getLookupTableFactory(function (t) { 28239 t.space = 278; 28240 t.exclam = 333; 28241 t.quotedbl = 474; 28242 t.numbersign = 556; 28243 t.dollar = 556; 28244 t.percent = 889; 28245 t.ampersand = 722; 28246 t.quoteright = 278; 28247 t.parenleft = 333; 28248 t.parenright = 333; 28249 t.asterisk = 389; 28250 t.plus = 584; 28251 t.comma = 278; 28252 t.hyphen = 333; 28253 t.period = 278; 28254 t.slash = 278; 28255 t.zero = 556; 28256 t.one = 556; 28257 t.two = 556; 28258 t.three = 556; 28259 t.four = 556; 28260 t.five = 556; 28261 t.six = 556; 28262 t.seven = 556; 28263 t.eight = 556; 28264 t.nine = 556; 28265 t.colon = 333; 28266 t.semicolon = 333; 28267 t.less = 584; 28268 t.equal = 584; 28269 t.greater = 584; 28270 t.question = 611; 28271 t.at = 975; 28272 t.A = 722; 28273 t.B = 722; 28274 t.C = 722; 28275 t.D = 722; 28276 t.E = 667; 28277 t.F = 611; 28278 t.G = 778; 28279 t.H = 722; 28280 t.I = 278; 28281 t.J = 556; 28282 t.K = 722; 28283 t.L = 611; 28284 t.M = 833; 28285 t.N = 722; 28286 t.O = 778; 28287 t.P = 667; 28288 t.Q = 778; 28289 t.R = 722; 28290 t.S = 667; 28291 t.T = 611; 28292 t.U = 722; 28293 t.V = 667; 28294 t.W = 944; 28295 t.X = 667; 28296 t.Y = 667; 28297 t.Z = 611; 28298 t.bracketleft = 333; 28299 t.backslash = 278; 28300 t.bracketright = 333; 28301 t.asciicircum = 584; 28302 t.underscore = 556; 28303 t.quoteleft = 278; 28304 t.a = 556; 28305 t.b = 611; 28306 t.c = 556; 28307 t.d = 611; 28308 t.e = 556; 28309 t.f = 333; 28310 t.g = 611; 28311 t.h = 611; 28312 t.i = 278; 28313 t.j = 278; 28314 t.k = 556; 28315 t.l = 278; 28316 t.m = 889; 28317 t.n = 611; 28318 t.o = 611; 28319 t.p = 611; 28320 t.q = 611; 28321 t.r = 389; 28322 t.s = 556; 28323 t.t = 333; 28324 t.u = 611; 28325 t.v = 556; 28326 t.w = 778; 28327 t.x = 556; 28328 t.y = 556; 28329 t.z = 500; 28330 t.braceleft = 389; 28331 t.bar = 280; 28332 t.braceright = 389; 28333 t.asciitilde = 584; 28334 t.exclamdown = 333; 28335 t.cent = 556; 28336 t.sterling = 556; 28337 t.fraction = 167; 28338 t.yen = 556; 28339 t.florin = 556; 28340 t.section = 556; 28341 t.currency = 556; 28342 t.quotesingle = 238; 28343 t.quotedblleft = 500; 28344 t.guillemotleft = 556; 28345 t.guilsinglleft = 333; 28346 t.guilsinglright = 333; 28347 t.fi = 611; 28348 t.fl = 611; 28349 t.endash = 556; 28350 t.dagger = 556; 28351 t.daggerdbl = 556; 28352 t.periodcentered = 278; 28353 t.paragraph = 556; 28354 t.bullet = 350; 28355 t.quotesinglbase = 278; 28356 t.quotedblbase = 500; 28357 t.quotedblright = 500; 28358 t.guillemotright = 556; 28359 t.ellipsis = 1000; 28360 t.perthousand = 1000; 28361 t.questiondown = 611; 28362 t.grave = 333; 28363 t.acute = 333; 28364 t.circumflex = 333; 28365 t.tilde = 333; 28366 t.macron = 333; 28367 t.breve = 333; 28368 t.dotaccent = 333; 28369 t.dieresis = 333; 28370 t.ring = 333; 28371 t.cedilla = 333; 28372 t.hungarumlaut = 333; 28373 t.ogonek = 333; 28374 t.caron = 333; 28375 t.emdash = 1000; 28376 t.AE = 1000; 28377 t.ordfeminine = 370; 28378 t.Lslash = 611; 28379 t.Oslash = 778; 28380 t.OE = 1000; 28381 t.ordmasculine = 365; 28382 t.ae = 889; 28383 t.dotlessi = 278; 28384 t.lslash = 278; 28385 t.oslash = 611; 28386 t.oe = 944; 28387 t.germandbls = 611; 28388 t.Idieresis = 278; 28389 t.eacute = 556; 28390 t.abreve = 556; 28391 t.uhungarumlaut = 611; 28392 t.ecaron = 556; 28393 t.Ydieresis = 667; 28394 t.divide = 584; 28395 t.Yacute = 667; 28396 t.Acircumflex = 722; 28397 t.aacute = 556; 28398 t.Ucircumflex = 722; 28399 t.yacute = 556; 28400 t.scommaaccent = 556; 28401 t.ecircumflex = 556; 28402 t.Uring = 722; 28403 t.Udieresis = 722; 28404 t.aogonek = 556; 28405 t.Uacute = 722; 28406 t.uogonek = 611; 28407 t.Edieresis = 667; 28408 t.Dcroat = 722; 28409 t.commaaccent = 250; 28410 t.copyright = 737; 28411 t.Emacron = 667; 28412 t.ccaron = 556; 28413 t.aring = 556; 28414 t.Ncommaaccent = 722; 28415 t.lacute = 278; 28416 t.agrave = 556; 28417 t.Tcommaaccent = 611; 28418 t.Cacute = 722; 28419 t.atilde = 556; 28420 t.Edotaccent = 667; 28421 t.scaron = 556; 28422 t.scedilla = 556; 28423 t.iacute = 278; 28424 t.lozenge = 494; 28425 t.Rcaron = 722; 28426 t.Gcommaaccent = 778; 28427 t.ucircumflex = 611; 28428 t.acircumflex = 556; 28429 t.Amacron = 722; 28430 t.rcaron = 389; 28431 t.ccedilla = 556; 28432 t.Zdotaccent = 611; 28433 t.Thorn = 667; 28434 t.Omacron = 778; 28435 t.Racute = 722; 28436 t.Sacute = 667; 28437 t.dcaron = 743; 28438 t.Umacron = 722; 28439 t.uring = 611; 28440 t.threesuperior = 333; 28441 t.Ograve = 778; 28442 t.Agrave = 722; 28443 t.Abreve = 722; 28444 t.multiply = 584; 28445 t.uacute = 611; 28446 t.Tcaron = 611; 28447 t.partialdiff = 494; 28448 t.ydieresis = 556; 28449 t.Nacute = 722; 28450 t.icircumflex = 278; 28451 t.Ecircumflex = 667; 28452 t.adieresis = 556; 28453 t.edieresis = 556; 28454 t.cacute = 556; 28455 t.nacute = 611; 28456 t.umacron = 611; 28457 t.Ncaron = 722; 28458 t.Iacute = 278; 28459 t.plusminus = 584; 28460 t.brokenbar = 280; 28461 t.registered = 737; 28462 t.Gbreve = 778; 28463 t.Idotaccent = 278; 28464 t.summation = 600; 28465 t.Egrave = 667; 28466 t.racute = 389; 28467 t.omacron = 611; 28468 t.Zacute = 611; 28469 t.Zcaron = 611; 28470 t.greaterequal = 549; 28471 t.Eth = 722; 28472 t.Ccedilla = 722; 28473 t.lcommaaccent = 278; 28474 t.tcaron = 389; 28475 t.eogonek = 556; 28476 t.Uogonek = 722; 28477 t.Aacute = 722; 28478 t.Adieresis = 722; 28479 t.egrave = 556; 28480 t.zacute = 500; 28481 t.iogonek = 278; 28482 t.Oacute = 778; 28483 t.oacute = 611; 28484 t.amacron = 556; 28485 t.sacute = 556; 28486 t.idieresis = 278; 28487 t.Ocircumflex = 778; 28488 t.Ugrave = 722; 28489 t.Delta = 612; 28490 t.thorn = 611; 28491 t.twosuperior = 333; 28492 t.Odieresis = 778; 28493 t.mu = 611; 28494 t.igrave = 278; 28495 t.ohungarumlaut = 611; 28496 t.Eogonek = 667; 28497 t.dcroat = 611; 28498 t.threequarters = 834; 28499 t.Scedilla = 667; 28500 t.lcaron = 400; 28501 t.Kcommaaccent = 722; 28502 t.Lacute = 611; 28503 t.trademark = 1000; 28504 t.edotaccent = 556; 28505 t.Igrave = 278; 28506 t.Imacron = 278; 28507 t.Lcaron = 611; 28508 t.onehalf = 834; 28509 t.lessequal = 549; 28510 t.ocircumflex = 611; 28511 t.ntilde = 611; 28512 t.Uhungarumlaut = 722; 28513 t.Eacute = 667; 28514 t.emacron = 556; 28515 t.gbreve = 611; 28516 t.onequarter = 834; 28517 t.Scaron = 667; 28518 t.Scommaaccent = 667; 28519 t.Ohungarumlaut = 778; 28520 t.degree = 400; 28521 t.ograve = 611; 28522 t.Ccaron = 722; 28523 t.ugrave = 611; 28524 t.radical = 549; 28525 t.Dcaron = 722; 28526 t.rcommaaccent = 389; 28527 t.Ntilde = 722; 28528 t.otilde = 611; 28529 t.Rcommaaccent = 722; 28530 t.Lcommaaccent = 611; 28531 t.Atilde = 722; 28532 t.Aogonek = 722; 28533 t.Aring = 722; 28534 t.Otilde = 778; 28535 t.zdotaccent = 500; 28536 t.Ecaron = 667; 28537 t.Iogonek = 278; 28538 t.kcommaaccent = 556; 28539 t.minus = 584; 28540 t.Icircumflex = 278; 28541 t.ncaron = 611; 28542 t.tcommaaccent = 333; 28543 t.logicalnot = 584; 28544 t.odieresis = 611; 28545 t.udieresis = 611; 28546 t.notequal = 549; 28547 t.gcommaaccent = 611; 28548 t.eth = 611; 28549 t.zcaron = 500; 28550 t.ncommaaccent = 611; 28551 t.onesuperior = 333; 28552 t.imacron = 278; 28553 t.Euro = 556; 28554 }); 28555 t["Helvetica-Oblique"] = getLookupTableFactory(function (t) { 28556 t.space = 278; 28557 t.exclam = 278; 28558 t.quotedbl = 355; 28559 t.numbersign = 556; 28560 t.dollar = 556; 28561 t.percent = 889; 28562 t.ampersand = 667; 28563 t.quoteright = 222; 28564 t.parenleft = 333; 28565 t.parenright = 333; 28566 t.asterisk = 389; 28567 t.plus = 584; 28568 t.comma = 278; 28569 t.hyphen = 333; 28570 t.period = 278; 28571 t.slash = 278; 28572 t.zero = 556; 28573 t.one = 556; 28574 t.two = 556; 28575 t.three = 556; 28576 t.four = 556; 28577 t.five = 556; 28578 t.six = 556; 28579 t.seven = 556; 28580 t.eight = 556; 28581 t.nine = 556; 28582 t.colon = 278; 28583 t.semicolon = 278; 28584 t.less = 584; 28585 t.equal = 584; 28586 t.greater = 584; 28587 t.question = 556; 28588 t.at = 1015; 28589 t.A = 667; 28590 t.B = 667; 28591 t.C = 722; 28592 t.D = 722; 28593 t.E = 667; 28594 t.F = 611; 28595 t.G = 778; 28596 t.H = 722; 28597 t.I = 278; 28598 t.J = 500; 28599 t.K = 667; 28600 t.L = 556;
vendor: 4,866 bytes, lines 28601-28835
28601 t.M = 833; 28602 t.N = 722; 28603 t.O = 778; 28604 t.P = 667; 28605 t.Q = 778; 28606 t.R = 722; 28607 t.S = 667; 28608 t.T = 611; 28609 t.U = 722; 28610 t.V = 667; 28611 t.W = 944; 28612 t.X = 667; 28613 t.Y = 667; 28614 t.Z = 611; 28615 t.bracketleft = 278; 28616 t.backslash = 278; 28617 t.bracketright = 278; 28618 t.asciicircum = 469; 28619 t.underscore = 556; 28620 t.quoteleft = 222; 28621 t.a = 556; 28622 t.b = 556; 28623 t.c = 500; 28624 t.d = 556; 28625 t.e = 556; 28626 t.f = 278; 28627 t.g = 556; 28628 t.h = 556; 28629 t.i = 222; 28630 t.j = 222; 28631 t.k = 500; 28632 t.l = 222; 28633 t.m = 833; 28634 t.n = 556; 28635 t.o = 556; 28636 t.p = 556; 28637 t.q = 556; 28638 t.r = 333; 28639 t.s = 500; 28640 t.t = 278; 28641 t.u = 556; 28642 t.v = 500; 28643 t.w = 722; 28644 t.x = 500; 28645 t.y = 500; 28646 t.z = 500; 28647 t.braceleft = 334; 28648 t.bar = 260; 28649 t.braceright = 334; 28650 t.asciitilde = 584; 28651 t.exclamdown = 333; 28652 t.cent = 556; 28653 t.sterling = 556; 28654 t.fraction = 167; 28655 t.yen = 556; 28656 t.florin = 556; 28657 t.section = 556; 28658 t.currency = 556; 28659 t.quotesingle = 191; 28660 t.quotedblleft = 333; 28661 t.guillemotleft = 556; 28662 t.guilsinglleft = 333; 28663 t.guilsinglright = 333; 28664 t.fi = 500; 28665 t.fl = 500; 28666 t.endash = 556; 28667 t.dagger = 556; 28668 t.daggerdbl = 556; 28669 t.periodcentered = 278; 28670 t.paragraph = 537; 28671 t.bullet = 350; 28672 t.quotesinglbase = 222; 28673 t.quotedblbase = 333; 28674 t.quotedblright = 333; 28675 t.guillemotright = 556; 28676 t.ellipsis = 1000; 28677 t.perthousand = 1000; 28678 t.questiondown = 611; 28679 t.grave = 333; 28680 t.acute = 333; 28681 t.circumflex = 333; 28682 t.tilde = 333; 28683 t.macron = 333; 28684 t.breve = 333; 28685 t.dotaccent = 333; 28686 t.dieresis = 333; 28687 t.ring = 333; 28688 t.cedilla = 333; 28689 t.hungarumlaut = 333; 28690 t.ogonek = 333; 28691 t.caron = 333; 28692 t.emdash = 1000; 28693 t.AE = 1000; 28694 t.ordfeminine = 370; 28695 t.Lslash = 556; 28696 t.Oslash = 778; 28697 t.OE = 1000; 28698 t.ordmasculine = 365; 28699 t.ae = 889; 28700 t.dotlessi = 278; 28701 t.lslash = 222; 28702 t.oslash = 611; 28703 t.oe = 944; 28704 t.germandbls = 611; 28705 t.Idieresis = 278; 28706 t.eacute = 556; 28707 t.abreve = 556; 28708 t.uhungarumlaut = 556; 28709 t.ecaron = 556; 28710 t.Ydieresis = 667; 28711 t.divide = 584; 28712 t.Yacute = 667; 28713 t.Acircumflex = 667; 28714 t.aacute = 556; 28715 t.Ucircumflex = 722; 28716 t.yacute = 500; 28717 t.scommaaccent = 500; 28718 t.ecircumflex = 556; 28719 t.Uring = 722; 28720 t.Udieresis = 722; 28721 t.aogonek = 556; 28722 t.Uacute = 722; 28723 t.uogonek = 556; 28724 t.Edieresis = 667; 28725 t.Dcroat = 722; 28726 t.commaaccent = 250; 28727 t.copyright = 737; 28728 t.Emacron = 667; 28729 t.ccaron = 500; 28730 t.aring = 556; 28731 t.Ncommaaccent = 722; 28732 t.lacute = 222; 28733 t.agrave = 556; 28734 t.Tcommaaccent = 611; 28735 t.Cacute = 722; 28736 t.atilde = 556; 28737 t.Edotaccent = 667; 28738 t.scaron = 500; 28739 t.scedilla = 500; 28740 t.iacute = 278; 28741 t.lozenge = 471; 28742 t.Rcaron = 722; 28743 t.Gcommaaccent = 778; 28744 t.ucircumflex = 556; 28745 t.acircumflex = 556; 28746 t.Amacron = 667; 28747 t.rcaron = 333; 28748 t.ccedilla = 500; 28749 t.Zdotaccent = 611; 28750 t.Thorn = 667; 28751 t.Omacron = 778; 28752 t.Racute = 722; 28753 t.Sacute = 667; 28754 t.dcaron = 643; 28755 t.Umacron = 722; 28756 t.uring = 556; 28757 t.threesuperior = 333; 28758 t.Ograve = 778; 28759 t.Agrave = 667; 28760 t.Abreve = 667; 28761 t.multiply = 584; 28762 t.uacute = 556; 28763 t.Tcaron = 611; 28764 t.partialdiff = 476; 28765 t.ydieresis = 500; 28766 t.Nacute = 722; 28767 t.icircumflex = 278; 28768 t.Ecircumflex = 667; 28769 t.adieresis = 556; 28770 t.edieresis = 556; 28771 t.cacute = 500; 28772 t.nacute = 556; 28773 t.umacron = 556; 28774 t.Ncaron = 722; 28775 t.Iacute = 278; 28776 t.plusminus = 584; 28777 t.brokenbar = 260; 28778 t.registered = 737; 28779 t.Gbreve = 778; 28780 t.Idotaccent = 278; 28781 t.summation = 600; 28782 t.Egrave = 667; 28783 t.racute = 333; 28784 t.omacron = 556; 28785 t.Zacute = 611; 28786 t.Zcaron = 611; 28787 t.greaterequal = 549; 28788 t.Eth = 722; 28789 t.Ccedilla = 722; 28790 t.lcommaaccent = 222; 28791 t.tcaron = 317; 28792 t.eogonek = 556; 28793 t.Uogonek = 722; 28794 t.Aacute = 667; 28795 t.Adieresis = 667; 28796 t.egrave = 556; 28797 t.zacute = 500; 28798 t.iogonek = 222; 28799 t.Oacute = 778; 28800 t.oacute = 556; 28801 t.amacron = 556; 28802 t.sacute = 500; 28803 t.idieresis = 278; 28804 t.Ocircumflex = 778; 28805 t.Ugrave = 722; 28806 t.Delta = 612; 28807 t.thorn = 556; 28808 t.twosuperior = 333; 28809 t.Odieresis = 778; 28810 t.mu = 556; 28811 t.igrave = 278; 28812 t.ohungarumlaut = 556; 28813 t.Eogonek = 667; 28814 t.dcroat = 556; 28815 t.threequarters = 834; 28816 t.Scedilla = 667; 28817 t.lcaron = 299; 28818 t.Kcommaaccent = 667; 28819 t.Lacute = 556; 28820 t.trademark = 1000; 28821 t.edotaccent = 556; 28822 t.Igrave = 278; 28823 t.Imacron = 278; 28824 t.Lcaron = 556; 28825 t.onehalf = 834; 28826 t.lessequal = 549; 28827 t.ocircumflex = 556; 28828 t.ntilde = 556; 28829 t.Uhungarumlaut = 722; 28830 t.Eacute = 667; 28831 t.emacron = 556; 28832 t.gbreve = 556; 28833 t.onequarter = 834; 28834 t.Scaron = 667; 28835 t.Scommaaccent = 667;
vendor: 25,462 bytes, lines 28836-30060
28836 t.Ohungarumlaut = 778; 28837 t.degree = 400; 28838 t.ograve = 556; 28839 t.Ccaron = 722; 28840 t.ugrave = 556; 28841 t.radical = 453; 28842 t.Dcaron = 722; 28843 t.rcommaaccent = 333; 28844 t.Ntilde = 722; 28845 t.otilde = 556; 28846 t.Rcommaaccent = 722; 28847 t.Lcommaaccent = 556; 28848 t.Atilde = 667; 28849 t.Aogonek = 667; 28850 t.Aring = 667; 28851 t.Otilde = 778; 28852 t.zdotaccent = 500; 28853 t.Ecaron = 667; 28854 t.Iogonek = 278; 28855 t.kcommaaccent = 500; 28856 t.minus = 584; 28857 t.Icircumflex = 278; 28858 t.ncaron = 556; 28859 t.tcommaaccent = 278; 28860 t.logicalnot = 584; 28861 t.odieresis = 556; 28862 t.udieresis = 556; 28863 t.notequal = 549; 28864 t.gcommaaccent = 556; 28865 t.eth = 556; 28866 t.zcaron = 500; 28867 t.ncommaaccent = 556; 28868 t.onesuperior = 333; 28869 t.imacron = 278; 28870 t.Euro = 556; 28871 }); 28872 t.Symbol = getLookupTableFactory(function (t) { 28873 t.space = 250; 28874 t.exclam = 333; 28875 t.universal = 713; 28876 t.numbersign = 500; 28877 t.existential = 549; 28878 t.percent = 833; 28879 t.ampersand = 778; 28880 t.suchthat = 439; 28881 t.parenleft = 333; 28882 t.parenright = 333; 28883 t.asteriskmath = 500; 28884 t.plus = 549; 28885 t.comma = 250; 28886 t.minus = 549; 28887 t.period = 250; 28888 t.slash = 278; 28889 t.zero = 500; 28890 t.one = 500; 28891 t.two = 500; 28892 t.three = 500; 28893 t.four = 500; 28894 t.five = 500; 28895 t.six = 500; 28896 t.seven = 500; 28897 t.eight = 500; 28898 t.nine = 500; 28899 t.colon = 278; 28900 t.semicolon = 278; 28901 t.less = 549; 28902 t.equal = 549; 28903 t.greater = 549; 28904 t.question = 444; 28905 t.congruent = 549; 28906 t.Alpha = 722; 28907 t.Beta = 667; 28908 t.Chi = 722; 28909 t.Delta = 612; 28910 t.Epsilon = 611; 28911 t.Phi = 763; 28912 t.Gamma = 603; 28913 t.Eta = 722; 28914 t.Iota = 333; 28915 t.theta1 = 631; 28916 t.Kappa = 722; 28917 t.Lambda = 686; 28918 t.Mu = 889; 28919 t.Nu = 722; 28920 t.Omicron = 722; 28921 t.Pi = 768; 28922 t.Theta = 741; 28923 t.Rho = 556; 28924 t.Sigma = 592; 28925 t.Tau = 611; 28926 t.Upsilon = 690; 28927 t.sigma1 = 439; 28928 t.Omega = 768; 28929 t.Xi = 645; 28930 t.Psi = 795; 28931 t.Zeta = 611; 28932 t.bracketleft = 333; 28933 t.therefore = 863; 28934 t.bracketright = 333; 28935 t.perpendicular = 658; 28936 t.underscore = 500; 28937 t.radicalex = 500; 28938 t.alpha = 631; 28939 t.beta = 549; 28940 t.chi = 549; 28941 t.delta = 494; 28942 t.epsilon = 439; 28943 t.phi = 521; 28944 t.gamma = 411; 28945 t.eta = 603; 28946 t.iota = 329; 28947 t.phi1 = 603; 28948 t.kappa = 549; 28949 t.lambda = 549; 28950 t.mu = 576; 28951 t.nu = 521; 28952 t.omicron = 549; 28953 t.pi = 549; 28954 t.theta = 521; 28955 t.rho = 549; 28956 t.sigma = 603; 28957 t.tau = 439; 28958 t.upsilon = 576; 28959 t.omega1 = 713; 28960 t.omega = 686; 28961 t.xi = 493; 28962 t.psi = 686; 28963 t.zeta = 494; 28964 t.braceleft = 480; 28965 t.bar = 200; 28966 t.braceright = 480; 28967 t.similar = 549; 28968 t.Euro = 750; 28969 t.Upsilon1 = 620; 28970 t.minute = 247; 28971 t.lessequal = 549; 28972 t.fraction = 167; 28973 t.infinity = 713; 28974 t.florin = 500; 28975 t.club = 753; 28976 t.diamond = 753; 28977 t.heart = 753; 28978 t.spade = 753; 28979 t.arrowboth = 1042; 28980 t.arrowleft = 987; 28981 t.arrowup = 603; 28982 t.arrowright = 987; 28983 t.arrowdown = 603; 28984 t.degree = 400; 28985 t.plusminus = 549; 28986 t.second = 411; 28987 t.greaterequal = 549; 28988 t.multiply = 549; 28989 t.proportional = 713; 28990 t.partialdiff = 494; 28991 t.bullet = 460; 28992 t.divide = 549; 28993 t.notequal = 549; 28994 t.equivalence = 549; 28995 t.approxequal = 549; 28996 t.ellipsis = 1000; 28997 t.arrowvertex = 603; 28998 t.arrowhorizex = 1000; 28999 t.carriagereturn = 658; 29000 t.aleph = 823; 29001 t.Ifraktur = 686; 29002 t.Rfraktur = 795; 29003 t.weierstrass = 987; 29004 t.circlemultiply = 768; 29005 t.circleplus = 768; 29006 t.emptyset = 823; 29007 t.intersection = 768; 29008 t.union = 768; 29009 t.propersuperset = 713; 29010 t.reflexsuperset = 713; 29011 t.notsubset = 713; 29012 t.propersubset = 713; 29013 t.reflexsubset = 713; 29014 t.element = 713; 29015 t.notelement = 713; 29016 t.angle = 768; 29017 t.gradient = 713; 29018 t.registerserif = 790; 29019 t.copyrightserif = 790; 29020 t.trademarkserif = 890; 29021 t.product = 823; 29022 t.radical = 549; 29023 t.dotmath = 250; 29024 t.logicalnot = 713; 29025 t.logicaland = 603; 29026 t.logicalor = 603; 29027 t.arrowdblboth = 1042; 29028 t.arrowdblleft = 987; 29029 t.arrowdblup = 603; 29030 t.arrowdblright = 987; 29031 t.arrowdbldown = 603; 29032 t.lozenge = 494; 29033 t.angleleft = 329; 29034 t.registersans = 790; 29035 t.copyrightsans = 790; 29036 t.trademarksans = 786; 29037 t.summation = 713; 29038 t.parenlefttp = 384; 29039 t.parenleftex = 384; 29040 t.parenleftbt = 384; 29041 t.bracketlefttp = 384; 29042 t.bracketleftex = 384; 29043 t.bracketleftbt = 384; 29044 t.bracelefttp = 494; 29045 t.braceleftmid = 494; 29046 t.braceleftbt = 494; 29047 t.braceex = 494; 29048 t.angleright = 329; 29049 t.integral = 274; 29050 t.integraltp = 686; 29051 t.integralex = 686; 29052 t.integralbt = 686; 29053 t.parenrighttp = 384; 29054 t.parenrightex = 384; 29055 t.parenrightbt = 384; 29056 t.bracketrighttp = 384; 29057 t.bracketrightex = 384; 29058 t.bracketrightbt = 384; 29059 t.bracerighttp = 494; 29060 t.bracerightmid = 494; 29061 t.bracerightbt = 494; 29062 t.apple = 790; 29063 }); 29064 t["Times-Roman"] = getLookupTableFactory(function (t) { 29065 t.space = 250; 29066 t.exclam = 333; 29067 t.quotedbl = 408; 29068 t.numbersign = 500; 29069 t.dollar = 500; 29070 t.percent = 833; 29071 t.ampersand = 778; 29072 t.quoteright = 333; 29073 t.parenleft = 333; 29074 t.parenright = 333; 29075 t.asterisk = 500; 29076 t.plus = 564; 29077 t.comma = 250; 29078 t.hyphen = 333; 29079 t.period = 250; 29080 t.slash = 278; 29081 t.zero = 500; 29082 t.one = 500; 29083 t.two = 500; 29084 t.three = 500; 29085 t.four = 500; 29086 t.five = 500; 29087 t.six = 500; 29088 t.seven = 500; 29089 t.eight = 500; 29090 t.nine = 500; 29091 t.colon = 278; 29092 t.semicolon = 278; 29093 t.less = 564; 29094 t.equal = 564; 29095 t.greater = 564; 29096 t.question = 444; 29097 t.at = 921; 29098 t.A = 722; 29099 t.B = 667; 29100 t.C = 667; 29101 t.D = 722; 29102 t.E = 611; 29103 t.F = 556; 29104 t.G = 722; 29105 t.H = 722; 29106 t.I = 333; 29107 t.J = 389; 29108 t.K = 722; 29109 t.L = 611; 29110 t.M = 889; 29111 t.N = 722; 29112 t.O = 722; 29113 t.P = 556; 29114 t.Q = 722; 29115 t.R = 667; 29116 t.S = 556; 29117 t.T = 611; 29118 t.U = 722; 29119 t.V = 722; 29120 t.W = 944; 29121 t.X = 722; 29122 t.Y = 722; 29123 t.Z = 611; 29124 t.bracketleft = 333; 29125 t.backslash = 278; 29126 t.bracketright = 333; 29127 t.asciicircum = 469; 29128 t.underscore = 500; 29129 t.quoteleft = 333; 29130 t.a = 444; 29131 t.b = 500; 29132 t.c = 444; 29133 t.d = 500; 29134 t.e = 444; 29135 t.f = 333; 29136 t.g = 500; 29137 t.h = 500; 29138 t.i = 278; 29139 t.j = 278; 29140 t.k = 500; 29141 t.l = 278; 29142 t.m = 778; 29143 t.n = 500; 29144 t.o = 500; 29145 t.p = 500; 29146 t.q = 500; 29147 t.r = 333; 29148 t.s = 389; 29149 t.t = 278; 29150 t.u = 500; 29151 t.v = 500; 29152 t.w = 722; 29153 t.x = 500; 29154 t.y = 500; 29155 t.z = 444; 29156 t.braceleft = 480; 29157 t.bar = 200; 29158 t.braceright = 480; 29159 t.asciitilde = 541; 29160 t.exclamdown = 333; 29161 t.cent = 500; 29162 t.sterling = 500; 29163 t.fraction = 167; 29164 t.yen = 500; 29165 t.florin = 500; 29166 t.section = 500; 29167 t.currency = 500; 29168 t.quotesingle = 180; 29169 t.quotedblleft = 444; 29170 t.guillemotleft = 500; 29171 t.guilsinglleft = 333; 29172 t.guilsinglright = 333; 29173 t.fi = 556; 29174 t.fl = 556; 29175 t.endash = 500; 29176 t.dagger = 500; 29177 t.daggerdbl = 500; 29178 t.periodcentered = 250; 29179 t.paragraph = 453; 29180 t.bullet = 350; 29181 t.quotesinglbase = 333; 29182 t.quotedblbase = 444; 29183 t.quotedblright = 444; 29184 t.guillemotright = 500; 29185 t.ellipsis = 1000; 29186 t.perthousand = 1000; 29187 t.questiondown = 444; 29188 t.grave = 333; 29189 t.acute = 333; 29190 t.circumflex = 333; 29191 t.tilde = 333; 29192 t.macron = 333; 29193 t.breve = 333; 29194 t.dotaccent = 333; 29195 t.dieresis = 333; 29196 t.ring = 333; 29197 t.cedilla = 333; 29198 t.hungarumlaut = 333; 29199 t.ogonek = 333; 29200 t.caron = 333; 29201 t.emdash = 1000; 29202 t.AE = 889; 29203 t.ordfeminine = 276; 29204 t.Lslash = 611; 29205 t.Oslash = 722; 29206 t.OE = 889; 29207 t.ordmasculine = 310; 29208 t.ae = 667; 29209 t.dotlessi = 278; 29210 t.lslash = 278; 29211 t.oslash = 500; 29212 t.oe = 722; 29213 t.germandbls = 500; 29214 t.Idieresis = 333; 29215 t.eacute = 444; 29216 t.abreve = 444; 29217 t.uhungarumlaut = 500; 29218 t.ecaron = 444; 29219 t.Ydieresis = 722; 29220 t.divide = 564; 29221 t.Yacute = 722; 29222 t.Acircumflex = 722; 29223 t.aacute = 444; 29224 t.Ucircumflex = 722; 29225 t.yacute = 500; 29226 t.scommaaccent = 389; 29227 t.ecircumflex = 444; 29228 t.Uring = 722; 29229 t.Udieresis = 722; 29230 t.aogonek = 444; 29231 t.Uacute = 722; 29232 t.uogonek = 500; 29233 t.Edieresis = 611; 29234 t.Dcroat = 722; 29235 t.commaaccent = 250; 29236 t.copyright = 760; 29237 t.Emacron = 611; 29238 t.ccaron = 444; 29239 t.aring = 444; 29240 t.Ncommaaccent = 722; 29241 t.lacute = 278; 29242 t.agrave = 444; 29243 t.Tcommaaccent = 611; 29244 t.Cacute = 667; 29245 t.atilde = 444; 29246 t.Edotaccent = 611; 29247 t.scaron = 389; 29248 t.scedilla = 389; 29249 t.iacute = 278; 29250 t.lozenge = 471; 29251 t.Rcaron = 667; 29252 t.Gcommaaccent = 722; 29253 t.ucircumflex = 500; 29254 t.acircumflex = 444; 29255 t.Amacron = 722; 29256 t.rcaron = 333; 29257 t.ccedilla = 444; 29258 t.Zdotaccent = 611; 29259 t.Thorn = 556; 29260 t.Omacron = 722; 29261 t.Racute = 667; 29262 t.Sacute = 556; 29263 t.dcaron = 588; 29264 t.Umacron = 722; 29265 t.uring = 500; 29266 t.threesuperior = 300; 29267 t.Ograve = 722; 29268 t.Agrave = 722; 29269 t.Abreve = 722; 29270 t.multiply = 564; 29271 t.uacute = 500; 29272 t.Tcaron = 611; 29273 t.partialdiff = 476; 29274 t.ydieresis = 500; 29275 t.Nacute = 722; 29276 t.icircumflex = 278; 29277 t.Ecircumflex = 611; 29278 t.adieresis = 444; 29279 t.edieresis = 444; 29280 t.cacute = 444; 29281 t.nacute = 500; 29282 t.umacron = 500; 29283 t.Ncaron = 722; 29284 t.Iacute = 333; 29285 t.plusminus = 564; 29286 t.brokenbar = 200; 29287 t.registered = 760; 29288 t.Gbreve = 722; 29289 t.Idotaccent = 333; 29290 t.summation = 600; 29291 t.Egrave = 611; 29292 t.racute = 333; 29293 t.omacron = 500; 29294 t.Zacute = 611; 29295 t.Zcaron = 611; 29296 t.greaterequal = 549; 29297 t.Eth = 722; 29298 t.Ccedilla = 667; 29299 t.lcommaaccent = 278; 29300 t.tcaron = 326; 29301 t.eogonek = 444; 29302 t.Uogonek = 722; 29303 t.Aacute = 722; 29304 t.Adieresis = 722; 29305 t.egrave = 444; 29306 t.zacute = 444; 29307 t.iogonek = 278; 29308 t.Oacute = 722; 29309 t.oacute = 500; 29310 t.amacron = 444; 29311 t.sacute = 389; 29312 t.idieresis = 278; 29313 t.Ocircumflex = 722; 29314 t.Ugrave = 722; 29315 t.Delta = 612; 29316 t.thorn = 500; 29317 t.twosuperior = 300; 29318 t.Odieresis = 722; 29319 t.mu = 500; 29320 t.igrave = 278; 29321 t.ohungarumlaut = 500; 29322 t.Eogonek = 611; 29323 t.dcroat = 500; 29324 t.threequarters = 750; 29325 t.Scedilla = 556; 29326 t.lcaron = 344; 29327 t.Kcommaaccent = 722; 29328 t.Lacute = 611; 29329 t.trademark = 980; 29330 t.edotaccent = 444; 29331 t.Igrave = 333; 29332 t.Imacron = 333; 29333 t.Lcaron = 611; 29334 t.onehalf = 750; 29335 t.lessequal = 549; 29336 t.ocircumflex = 500; 29337 t.ntilde = 500; 29338 t.Uhungarumlaut = 722; 29339 t.Eacute = 611; 29340 t.emacron = 444; 29341 t.gbreve = 500; 29342 t.onequarter = 750; 29343 t.Scaron = 556; 29344 t.Scommaaccent = 556; 29345 t.Ohungarumlaut = 722; 29346 t.degree = 400; 29347 t.ograve = 500; 29348 t.Ccaron = 667; 29349 t.ugrave = 500; 29350 t.radical = 453; 29351 t.Dcaron = 722; 29352 t.rcommaaccent = 333; 29353 t.Ntilde = 722; 29354 t.otilde = 500; 29355 t.Rcommaaccent = 667; 29356 t.Lcommaaccent = 611; 29357 t.Atilde = 722; 29358 t.Aogonek = 722; 29359 t.Aring = 722; 29360 t.Otilde = 722; 29361 t.zdotaccent = 444; 29362 t.Ecaron = 611; 29363 t.Iogonek = 333; 29364 t.kcommaaccent = 500; 29365 t.minus = 564; 29366 t.Icircumflex = 333; 29367 t.ncaron = 500; 29368 t.tcommaaccent = 278; 29369 t.logicalnot = 564; 29370 t.odieresis = 500; 29371 t.udieresis = 500; 29372 t.notequal = 549; 29373 t.gcommaaccent = 500; 29374 t.eth = 500; 29375 t.zcaron = 444; 29376 t.ncommaaccent = 500; 29377 t.onesuperior = 300; 29378 t.imacron = 278; 29379 t.Euro = 500; 29380 }); 29381 t["Times-Bold"] = getLookupTableFactory(function (t) { 29382 t.space = 250; 29383 t.exclam = 333; 29384 t.quotedbl = 555; 29385 t.numbersign = 500; 29386 t.dollar = 500; 29387 t.percent = 1000; 29388 t.ampersand = 833; 29389 t.quoteright = 333; 29390 t.parenleft = 333; 29391 t.parenright = 333; 29392 t.asterisk = 500; 29393 t.plus = 570; 29394 t.comma = 250; 29395 t.hyphen = 333; 29396 t.period = 250; 29397 t.slash = 278; 29398 t.zero = 500; 29399 t.one = 500; 29400 t.two = 500; 29401 t.three = 500; 29402 t.four = 500; 29403 t.five = 500; 29404 t.six = 500; 29405 t.seven = 500; 29406 t.eight = 500; 29407 t.nine = 500; 29408 t.colon = 333; 29409 t.semicolon = 333; 29410 t.less = 570; 29411 t.equal = 570; 29412 t.greater = 570; 29413 t.question = 500; 29414 t.at = 930; 29415 t.A = 722; 29416 t.B = 667; 29417 t.C = 722; 29418 t.D = 722; 29419 t.E = 667; 29420 t.F = 611; 29421 t.G = 778; 29422 t.H = 778; 29423 t.I = 389; 29424 t.J = 500; 29425 t.K = 778; 29426 t.L = 667; 29427 t.M = 944; 29428 t.N = 722; 29429 t.O = 778; 29430 t.P = 611; 29431 t.Q = 778; 29432 t.R = 722; 29433 t.S = 556; 29434 t.T = 667; 29435 t.U = 722; 29436 t.V = 722; 29437 t.W = 1000; 29438 t.X = 722; 29439 t.Y = 722; 29440 t.Z = 667; 29441 t.bracketleft = 333; 29442 t.backslash = 278; 29443 t.bracketright = 333; 29444 t.asciicircum = 581; 29445 t.underscore = 500; 29446 t.quoteleft = 333; 29447 t.a = 500; 29448 t.b = 556; 29449 t.c = 444; 29450 t.d = 556; 29451 t.e = 444; 29452 t.f = 333; 29453 t.g = 500; 29454 t.h = 556; 29455 t.i = 278; 29456 t.j = 333; 29457 t.k = 556; 29458 t.l = 278; 29459 t.m = 833; 29460 t.n = 556; 29461 t.o = 500; 29462 t.p = 556; 29463 t.q = 556; 29464 t.r = 444; 29465 t.s = 389; 29466 t.t = 333; 29467 t.u = 556; 29468 t.v = 500; 29469 t.w = 722; 29470 t.x = 500; 29471 t.y = 500; 29472 t.z = 444; 29473 t.braceleft = 394; 29474 t.bar = 220; 29475 t.braceright = 394; 29476 t.asciitilde = 520; 29477 t.exclamdown = 333; 29478 t.cent = 500; 29479 t.sterling = 500; 29480 t.fraction = 167; 29481 t.yen = 500; 29482 t.florin = 500; 29483 t.section = 500; 29484 t.currency = 500; 29485 t.quotesingle = 278; 29486 t.quotedblleft = 500; 29487 t.guillemotleft = 500; 29488 t.guilsinglleft = 333; 29489 t.guilsinglright = 333; 29490 t.fi = 556; 29491 t.fl = 556; 29492 t.endash = 500; 29493 t.dagger = 500; 29494 t.daggerdbl = 500; 29495 t.periodcentered = 250; 29496 t.paragraph = 540; 29497 t.bullet = 350; 29498 t.quotesinglbase = 333; 29499 t.quotedblbase = 500; 29500 t.quotedblright = 500; 29501 t.guillemotright = 500; 29502 t.ellipsis = 1000; 29503 t.perthousand = 1000; 29504 t.questiondown = 500; 29505 t.grave = 333; 29506 t.acute = 333; 29507 t.circumflex = 333; 29508 t.tilde = 333; 29509 t.macron = 333; 29510 t.breve = 333; 29511 t.dotaccent = 333; 29512 t.dieresis = 333; 29513 t.ring = 333; 29514 t.cedilla = 333; 29515 t.hungarumlaut = 333; 29516 t.ogonek = 333; 29517 t.caron = 333; 29518 t.emdash = 1000; 29519 t.AE = 1000; 29520 t.ordfeminine = 300; 29521 t.Lslash = 667; 29522 t.Oslash = 778; 29523 t.OE = 1000; 29524 t.ordmasculine = 330; 29525 t.ae = 722; 29526 t.dotlessi = 278; 29527 t.lslash = 278; 29528 t.oslash = 500; 29529 t.oe = 722; 29530 t.germandbls = 556; 29531 t.Idieresis = 389; 29532 t.eacute = 444; 29533 t.abreve = 500; 29534 t.uhungarumlaut = 556; 29535 t.ecaron = 444; 29536 t.Ydieresis = 722; 29537 t.divide = 570; 29538 t.Yacute = 722; 29539 t.Acircumflex = 722; 29540 t.aacute = 500; 29541 t.Ucircumflex = 722; 29542 t.yacute = 500; 29543 t.scommaaccent = 389; 29544 t.ecircumflex = 444; 29545 t.Uring = 722; 29546 t.Udieresis = 722; 29547 t.aogonek = 500; 29548 t.Uacute = 722; 29549 t.uogonek = 556; 29550 t.Edieresis = 667; 29551 t.Dcroat = 722; 29552 t.commaaccent = 250; 29553 t.copyright = 747; 29554 t.Emacron = 667; 29555 t.ccaron = 444; 29556 t.aring = 500; 29557 t.Ncommaaccent = 722; 29558 t.lacute = 278; 29559 t.agrave = 500; 29560 t.Tcommaaccent = 667; 29561 t.Cacute = 722; 29562 t.atilde = 500; 29563 t.Edotaccent = 667; 29564 t.scaron = 389; 29565 t.scedilla = 389; 29566 t.iacute = 278; 29567 t.lozenge = 494; 29568 t.Rcaron = 722; 29569 t.Gcommaaccent = 778; 29570 t.ucircumflex = 556; 29571 t.acircumflex = 500; 29572 t.Amacron = 722; 29573 t.rcaron = 444; 29574 t.ccedilla = 444; 29575 t.Zdotaccent = 667; 29576 t.Thorn = 611; 29577 t.Omacron = 778; 29578 t.Racute = 722; 29579 t.Sacute = 556; 29580 t.dcaron = 672; 29581 t.Umacron = 722; 29582 t.uring = 556; 29583 t.threesuperior = 300; 29584 t.Ograve = 778; 29585 t.Agrave = 722; 29586 t.Abreve = 722; 29587 t.multiply = 570; 29588 t.uacute = 556; 29589 t.Tcaron = 667; 29590 t.partialdiff = 494; 29591 t.ydieresis = 500; 29592 t.Nacute = 722; 29593 t.icircumflex = 278; 29594 t.Ecircumflex = 667; 29595 t.adieresis = 500; 29596 t.edieresis = 444; 29597 t.cacute = 444; 29598 t.nacute = 556; 29599 t.umacron = 556; 29600 t.Ncaron = 722; 29601 t.Iacute = 389; 29602 t.plusminus = 570; 29603 t.brokenbar = 220; 29604 t.registered = 747; 29605 t.Gbreve = 778; 29606 t.Idotaccent = 389; 29607 t.summation = 600; 29608 t.Egrave = 667; 29609 t.racute = 444; 29610 t.omacron = 500; 29611 t.Zacute = 667; 29612 t.Zcaron = 667; 29613 t.greaterequal = 549; 29614 t.Eth = 722; 29615 t.Ccedilla = 722; 29616 t.lcommaaccent = 278; 29617 t.tcaron = 416; 29618 t.eogonek = 444; 29619 t.Uogonek = 722; 29620 t.Aacute = 722; 29621 t.Adieresis = 722; 29622 t.egrave = 444; 29623 t.zacute = 444; 29624 t.iogonek = 278; 29625 t.Oacute = 778; 29626 t.oacute = 500; 29627 t.amacron = 500; 29628 t.sacute = 389; 29629 t.idieresis = 278; 29630 t.Ocircumflex = 778; 29631 t.Ugrave = 722; 29632 t.Delta = 612; 29633 t.thorn = 556; 29634 t.twosuperior = 300; 29635 t.Odieresis = 778; 29636 t.mu = 556; 29637 t.igrave = 278; 29638 t.ohungarumlaut = 500; 29639 t.Eogonek = 667; 29640 t.dcroat = 556; 29641 t.threequarters = 750; 29642 t.Scedilla = 556; 29643 t.lcaron = 394; 29644 t.Kcommaaccent = 778; 29645 t.Lacute = 667; 29646 t.trademark = 1000; 29647 t.edotaccent = 444; 29648 t.Igrave = 389; 29649 t.Imacron = 389; 29650 t.Lcaron = 667; 29651 t.onehalf = 750; 29652 t.lessequal = 549; 29653 t.ocircumflex = 500; 29654 t.ntilde = 556; 29655 t.Uhungarumlaut = 722; 29656 t.Eacute = 667; 29657 t.emacron = 444; 29658 t.gbreve = 500; 29659 t.onequarter = 750; 29660 t.Scaron = 556; 29661 t.Scommaaccent = 556; 29662 t.Ohungarumlaut = 778; 29663 t.degree = 400; 29664 t.ograve = 500; 29665 t.Ccaron = 722; 29666 t.ugrave = 556; 29667 t.radical = 549; 29668 t.Dcaron = 722; 29669 t.rcommaaccent = 444; 29670 t.Ntilde = 722; 29671 t.otilde = 500; 29672 t.Rcommaaccent = 722; 29673 t.Lcommaaccent = 667; 29674 t.Atilde = 722; 29675 t.Aogonek = 722; 29676 t.Aring = 722; 29677 t.Otilde = 778; 29678 t.zdotaccent = 444; 29679 t.Ecaron = 667; 29680 t.Iogonek = 389; 29681 t.kcommaaccent = 556; 29682 t.minus = 570; 29683 t.Icircumflex = 389; 29684 t.ncaron = 556; 29685 t.tcommaaccent = 333; 29686 t.logicalnot = 570; 29687 t.odieresis = 500; 29688 t.udieresis = 556; 29689 t.notequal = 549; 29690 t.gcommaaccent = 500; 29691 t.eth = 500; 29692 t.zcaron = 444; 29693 t.ncommaaccent = 556; 29694 t.onesuperior = 300; 29695 t.imacron = 278; 29696 t.Euro = 500; 29697 }); 29698 t["Times-BoldItalic"] = getLookupTableFactory(function (t) { 29699 t.space = 250; 29700 t.exclam = 389; 29701 t.quotedbl = 555; 29702 t.numbersign = 500; 29703 t.dollar = 500; 29704 t.percent = 833; 29705 t.ampersand = 778; 29706 t.quoteright = 333; 29707 t.parenleft = 333; 29708 t.parenright = 333; 29709 t.asterisk = 500; 29710 t.plus = 570; 29711 t.comma = 250; 29712 t.hyphen = 333; 29713 t.period = 250; 29714 t.slash = 278; 29715 t.zero = 500; 29716 t.one = 500; 29717 t.two = 500; 29718 t.three = 500; 29719 t.four = 500; 29720 t.five = 500; 29721 t.six = 500; 29722 t.seven = 500; 29723 t.eight = 500; 29724 t.nine = 500; 29725 t.colon = 333; 29726 t.semicolon = 333; 29727 t.less = 570; 29728 t.equal = 570; 29729 t.greater = 570; 29730 t.question = 500; 29731 t.at = 832; 29732 t.A = 667; 29733 t.B = 667; 29734 t.C = 667; 29735 t.D = 722; 29736 t.E = 667; 29737 t.F = 667; 29738 t.G = 722; 29739 t.H = 778; 29740 t.I = 389; 29741 t.J = 500; 29742 t.K = 667; 29743 t.L = 611; 29744 t.M = 889; 29745 t.N = 722; 29746 t.O = 722; 29747 t.P = 611; 29748 t.Q = 722; 29749 t.R = 667; 29750 t.S = 556; 29751 t.T = 611; 29752 t.U = 722; 29753 t.V = 667; 29754 t.W = 889; 29755 t.X = 667; 29756 t.Y = 611; 29757 t.Z = 611; 29758 t.bracketleft = 333; 29759 t.backslash = 278; 29760 t.bracketright = 333; 29761 t.asciicircum = 570; 29762 t.underscore = 500; 29763 t.quoteleft = 333; 29764 t.a = 500; 29765 t.b = 500; 29766 t.c = 444; 29767 t.d = 500; 29768 t.e = 444; 29769 t.f = 333; 29770 t.g = 500; 29771 t.h = 556; 29772 t.i = 278; 29773 t.j = 278; 29774 t.k = 500; 29775 t.l = 278; 29776 t.m = 778; 29777 t.n = 556; 29778 t.o = 500; 29779 t.p = 500; 29780 t.q = 500; 29781 t.r = 389; 29782 t.s = 389; 29783 t.t = 278; 29784 t.u = 556; 29785 t.v = 444; 29786 t.w = 667; 29787 t.x = 500; 29788 t.y = 444; 29789 t.z = 389; 29790 t.braceleft = 348; 29791 t.bar = 220; 29792 t.braceright = 348; 29793 t.asciitilde = 570; 29794 t.exclamdown = 389; 29795 t.cent = 500; 29796 t.sterling = 500; 29797 t.fraction = 167; 29798 t.yen = 500; 29799 t.florin = 500; 29800 t.section = 500; 29801 t.currency = 500; 29802 t.quotesingle = 278; 29803 t.quotedblleft = 500; 29804 t.guillemotleft = 500; 29805 t.guilsinglleft = 333; 29806 t.guilsinglright = 333; 29807 t.fi = 556; 29808 t.fl = 556; 29809 t.endash = 500; 29810 t.dagger = 500; 29811 t.daggerdbl = 500; 29812 t.periodcentered = 250; 29813 t.paragraph = 500; 29814 t.bullet = 350; 29815 t.quotesinglbase = 333; 29816 t.quotedblbase = 500; 29817 t.quotedblright = 500; 29818 t.guillemotright = 500; 29819 t.ellipsis = 1000; 29820 t.perthousand = 1000; 29821 t.questiondown = 500; 29822 t.grave = 333; 29823 t.acute = 333; 29824 t.circumflex = 333; 29825 t.tilde = 333; 29826 t.macron = 333; 29827 t.breve = 333; 29828 t.dotaccent = 333; 29829 t.dieresis = 333; 29830 t.ring = 333; 29831 t.cedilla = 333; 29832 t.hungarumlaut = 333; 29833 t.ogonek = 333; 29834 t.caron = 333; 29835 t.emdash = 1000; 29836 t.AE = 944; 29837 t.ordfeminine = 266; 29838 t.Lslash = 611; 29839 t.Oslash = 722; 29840 t.OE = 944; 29841 t.ordmasculine = 300; 29842 t.ae = 722; 29843 t.dotlessi = 278; 29844 t.lslash = 278; 29845 t.oslash = 500; 29846 t.oe = 722; 29847 t.germandbls = 500; 29848 t.Idieresis = 389; 29849 t.eacute = 444; 29850 t.abreve = 500; 29851 t.uhungarumlaut = 556; 29852 t.ecaron = 444; 29853 t.Ydieresis = 611; 29854 t.divide = 570; 29855 t.Yacute = 611; 29856 t.Acircumflex = 667; 29857 t.aacute = 500; 29858 t.Ucircumflex = 722; 29859 t.yacute = 444; 29860 t.scommaaccent = 389; 29861 t.ecircumflex = 444; 29862 t.Uring = 722; 29863 t.Udieresis = 722; 29864 t.aogonek = 500; 29865 t.Uacute = 722; 29866 t.uogonek = 556; 29867 t.Edieresis = 667; 29868 t.Dcroat = 722; 29869 t.commaaccent = 250; 29870 t.copyright = 747; 29871 t.Emacron = 667; 29872 t.ccaron = 444; 29873 t.aring = 500; 29874 t.Ncommaaccent = 722; 29875 t.lacute = 278; 29876 t.agrave = 500; 29877 t.Tcommaaccent = 611; 29878 t.Cacute = 667; 29879 t.atilde = 500; 29880 t.Edotaccent = 667; 29881 t.scaron = 389; 29882 t.scedilla = 389; 29883 t.iacute = 278; 29884 t.lozenge = 494; 29885 t.Rcaron = 667; 29886 t.Gcommaaccent = 722; 29887 t.ucircumflex = 556; 29888 t.acircumflex = 500; 29889 t.Amacron = 667; 29890 t.rcaron = 389; 29891 t.ccedilla = 444; 29892 t.Zdotaccent = 611; 29893 t.Thorn = 611; 29894 t.Omacron = 722; 29895 t.Racute = 667; 29896 t.Sacute = 556; 29897 t.dcaron = 608; 29898 t.Umacron = 722; 29899 t.uring = 556; 29900 t.threesuperior = 300; 29901 t.Ograve = 722; 29902 t.Agrave = 667; 29903 t.Abreve = 667; 29904 t.multiply = 570; 29905 t.uacute = 556; 29906 t.Tcaron = 611; 29907 t.partialdiff = 494; 29908 t.ydieresis = 444; 29909 t.Nacute = 722; 29910 t.icircumflex = 278; 29911 t.Ecircumflex = 667; 29912 t.adieresis = 500; 29913 t.edieresis = 444; 29914 t.cacute = 444; 29915 t.nacute = 556; 29916 t.umacron = 556; 29917 t.Ncaron = 722; 29918 t.Iacute = 389; 29919 t.plusminus = 570; 29920 t.brokenbar = 220; 29921 t.registered = 747; 29922 t.Gbreve = 722; 29923 t.Idotaccent = 389; 29924 t.summation = 600; 29925 t.Egrave = 667; 29926 t.racute = 389; 29927 t.omacron = 500; 29928 t.Zacute = 611; 29929 t.Zcaron = 611; 29930 t.greaterequal = 549; 29931 t.Eth = 722; 29932 t.Ccedilla = 667; 29933 t.lcommaaccent = 278; 29934 t.tcaron = 366; 29935 t.eogonek = 444; 29936 t.Uogonek = 722; 29937 t.Aacute = 667; 29938 t.Adieresis = 667; 29939 t.egrave = 444; 29940 t.zacute = 389; 29941 t.iogonek = 278; 29942 t.Oacute = 722; 29943 t.oacute = 500; 29944 t.amacron = 500; 29945 t.sacute = 389; 29946 t.idieresis = 278; 29947 t.Ocircumflex = 722; 29948 t.Ugrave = 722; 29949 t.Delta = 612; 29950 t.thorn = 500; 29951 t.twosuperior = 300; 29952 t.Odieresis = 722; 29953 t.mu = 576; 29954 t.igrave = 278; 29955 t.ohungarumlaut = 500; 29956 t.Eogonek = 667; 29957 t.dcroat = 500; 29958 t.threequarters = 750; 29959 t.Scedilla = 556; 29960 t.lcaron = 382; 29961 t.Kcommaaccent = 667; 29962 t.Lacute = 611; 29963 t.trademark = 1000; 29964 t.edotaccent = 444; 29965 t.Igrave = 389; 29966 t.Imacron = 389; 29967 t.Lcaron = 611; 29968 t.onehalf = 750; 29969 t.lessequal = 549; 29970 t.ocircumflex = 500; 29971 t.ntilde = 556; 29972 t.Uhungarumlaut = 722; 29973 t.Eacute = 667; 29974 t.emacron = 444; 29975 t.gbreve = 500; 29976 t.onequarter = 750; 29977 t.Scaron = 556; 29978 t.Scommaaccent = 556; 29979 t.Ohungarumlaut = 722; 29980 t.degree = 400; 29981 t.ograve = 500; 29982 t.Ccaron = 667; 29983 t.ugrave = 556; 29984 t.radical = 549; 29985 t.Dcaron = 722; 29986 t.rcommaaccent = 389; 29987 t.Ntilde = 722; 29988 t.otilde = 500; 29989 t.Rcommaaccent = 667; 29990 t.Lcommaaccent = 611; 29991 t.Atilde = 667; 29992 t.Aogonek = 667; 29993 t.Aring = 667; 29994 t.Otilde = 722; 29995 t.zdotaccent = 389; 29996 t.Ecaron = 667; 29997 t.Iogonek = 389; 29998 t.kcommaaccent = 500; 29999 t.minus = 606; 30000 t.Icircumflex = 389; 30001 t.ncaron = 556; 30002 t.tcommaaccent = 278; 30003 t.logicalnot = 606; 30004 t.odieresis = 500; 30005 t.udieresis = 556; 30006 t.notequal = 549; 30007 t.gcommaaccent = 500; 30008 t.eth = 500; 30009 t.zcaron = 389; 30010 t.ncommaaccent = 556; 30011 t.onesuperior = 300; 30012 t.imacron = 278; 30013 t.Euro = 500; 30014 }); 30015 t["Times-Italic"] = getLookupTableFactory(function (t) { 30016 t.space = 250; 30017 t.exclam = 333; 30018 t.quotedbl = 420; 30019 t.numbersign = 500; 30020 t.dollar = 500; 30021 t.percent = 833; 30022 t.ampersand = 778; 30023 t.quoteright = 333; 30024 t.parenleft = 333; 30025 t.parenright = 333; 30026 t.asterisk = 500; 30027 t.plus = 675; 30028 t.comma = 250; 30029 t.hyphen = 333; 30030 t.period = 250; 30031 t.slash = 278; 30032 t.zero = 500; 30033 t.one = 500; 30034 t.two = 500; 30035 t.three = 500; 30036 t.four = 500; 30037 t.five = 500; 30038 t.six = 500; 30039 t.seven = 500; 30040 t.eight = 500; 30041 t.nine = 500; 30042 t.colon = 333; 30043 t.semicolon = 333; 30044 t.less = 675; 30045 t.equal = 675; 30046 t.greater = 675; 30047 t.question = 500; 30048 t.at = 920; 30049 t.A = 611; 30050 t.B = 611; 30051 t.C = 667; 30052 t.D = 722; 30053 t.E = 611; 30054 t.F = 611; 30055 t.G = 722; 30056 t.H = 722; 30057 t.I = 333; 30058 t.J = 444; 30059 t.K = 667; 30060 t.L = 556;
vendor: 4,861 bytes, lines 30061-30295
30061 t.M = 833; 30062 t.N = 667; 30063 t.O = 722; 30064 t.P = 611; 30065 t.Q = 722; 30066 t.R = 611; 30067 t.S = 500; 30068 t.T = 556; 30069 t.U = 722; 30070 t.V = 611; 30071 t.W = 833; 30072 t.X = 611; 30073 t.Y = 556; 30074 t.Z = 556; 30075 t.bracketleft = 389; 30076 t.backslash = 278; 30077 t.bracketright = 389; 30078 t.asciicircum = 422; 30079 t.underscore = 500; 30080 t.quoteleft = 333; 30081 t.a = 500; 30082 t.b = 500; 30083 t.c = 444; 30084 t.d = 500; 30085 t.e = 444; 30086 t.f = 278; 30087 t.g = 500; 30088 t.h = 500; 30089 t.i = 278; 30090 t.j = 278; 30091 t.k = 444; 30092 t.l = 278; 30093 t.m = 722; 30094 t.n = 500; 30095 t.o = 500; 30096 t.p = 500; 30097 t.q = 500; 30098 t.r = 389; 30099 t.s = 389; 30100 t.t = 278; 30101 t.u = 500; 30102 t.v = 444; 30103 t.w = 667; 30104 t.x = 444; 30105 t.y = 444; 30106 t.z = 389; 30107 t.braceleft = 400; 30108 t.bar = 275; 30109 t.braceright = 400; 30110 t.asciitilde = 541; 30111 t.exclamdown = 389; 30112 t.cent = 500; 30113 t.sterling = 500; 30114 t.fraction = 167; 30115 t.yen = 500; 30116 t.florin = 500; 30117 t.section = 500; 30118 t.currency = 500; 30119 t.quotesingle = 214; 30120 t.quotedblleft = 556; 30121 t.guillemotleft = 500; 30122 t.guilsinglleft = 333; 30123 t.guilsinglright = 333; 30124 t.fi = 500; 30125 t.fl = 500; 30126 t.endash = 500; 30127 t.dagger = 500; 30128 t.daggerdbl = 500; 30129 t.periodcentered = 250; 30130 t.paragraph = 523; 30131 t.bullet = 350; 30132 t.quotesinglbase = 333; 30133 t.quotedblbase = 556; 30134 t.quotedblright = 556; 30135 t.guillemotright = 500; 30136 t.ellipsis = 889; 30137 t.perthousand = 1000; 30138 t.questiondown = 500; 30139 t.grave = 333; 30140 t.acute = 333; 30141 t.circumflex = 333; 30142 t.tilde = 333; 30143 t.macron = 333; 30144 t.breve = 333; 30145 t.dotaccent = 333; 30146 t.dieresis = 333; 30147 t.ring = 333; 30148 t.cedilla = 333; 30149 t.hungarumlaut = 333; 30150 t.ogonek = 333; 30151 t.caron = 333; 30152 t.emdash = 889; 30153 t.AE = 889; 30154 t.ordfeminine = 276; 30155 t.Lslash = 556; 30156 t.Oslash = 722; 30157 t.OE = 944; 30158 t.ordmasculine = 310; 30159 t.ae = 667; 30160 t.dotlessi = 278; 30161 t.lslash = 278; 30162 t.oslash = 500; 30163 t.oe = 667; 30164 t.germandbls = 500; 30165 t.Idieresis = 333; 30166 t.eacute = 444; 30167 t.abreve = 500; 30168 t.uhungarumlaut = 500; 30169 t.ecaron = 444; 30170 t.Ydieresis = 556; 30171 t.divide = 675; 30172 t.Yacute = 556; 30173 t.Acircumflex = 611; 30174 t.aacute = 500; 30175 t.Ucircumflex = 722; 30176 t.yacute = 444; 30177 t.scommaaccent = 389; 30178 t.ecircumflex = 444; 30179 t.Uring = 722; 30180 t.Udieresis = 722; 30181 t.aogonek = 500; 30182 t.Uacute = 722; 30183 t.uogonek = 500; 30184 t.Edieresis = 611; 30185 t.Dcroat = 722; 30186 t.commaaccent = 250; 30187 t.copyright = 760; 30188 t.Emacron = 611; 30189 t.ccaron = 444; 30190 t.aring = 500; 30191 t.Ncommaaccent = 667; 30192 t.lacute = 278; 30193 t.agrave = 500; 30194 t.Tcommaaccent = 556; 30195 t.Cacute = 667; 30196 t.atilde = 500; 30197 t.Edotaccent = 611; 30198 t.scaron = 389; 30199 t.scedilla = 389; 30200 t.iacute = 278; 30201 t.lozenge = 471; 30202 t.Rcaron = 611; 30203 t.Gcommaaccent = 722; 30204 t.ucircumflex = 500; 30205 t.acircumflex = 500; 30206 t.Amacron = 611; 30207 t.rcaron = 389; 30208 t.ccedilla = 444; 30209 t.Zdotaccent = 556; 30210 t.Thorn = 611; 30211 t.Omacron = 722; 30212 t.Racute = 611; 30213 t.Sacute = 500; 30214 t.dcaron = 544; 30215 t.Umacron = 722; 30216 t.uring = 500; 30217 t.threesuperior = 300; 30218 t.Ograve = 722; 30219 t.Agrave = 611; 30220 t.Abreve = 611; 30221 t.multiply = 675; 30222 t.uacute = 500; 30223 t.Tcaron = 556; 30224 t.partialdiff = 476; 30225 t.ydieresis = 444; 30226 t.Nacute = 667; 30227 t.icircumflex = 278; 30228 t.Ecircumflex = 611; 30229 t.adieresis = 500; 30230 t.edieresis = 444; 30231 t.cacute = 444; 30232 t.nacute = 500; 30233 t.umacron = 500; 30234 t.Ncaron = 667; 30235 t.Iacute = 333; 30236 t.plusminus = 675; 30237 t.brokenbar = 275; 30238 t.registered = 760; 30239 t.Gbreve = 722; 30240 t.Idotaccent = 333; 30241 t.summation = 600; 30242 t.Egrave = 611; 30243 t.racute = 389; 30244 t.omacron = 500; 30245 t.Zacute = 556; 30246 t.Zcaron = 556; 30247 t.greaterequal = 549; 30248 t.Eth = 722; 30249 t.Ccedilla = 667; 30250 t.lcommaaccent = 278; 30251 t.tcaron = 300; 30252 t.eogonek = 444; 30253 t.Uogonek = 722; 30254 t.Aacute = 611; 30255 t.Adieresis = 611; 30256 t.egrave = 444; 30257 t.zacute = 389; 30258 t.iogonek = 278; 30259 t.Oacute = 722; 30260 t.oacute = 500; 30261 t.amacron = 500; 30262 t.sacute = 389; 30263 t.idieresis = 278; 30264 t.Ocircumflex = 722; 30265 t.Ugrave = 722; 30266 t.Delta = 612; 30267 t.thorn = 500; 30268 t.twosuperior = 300; 30269 t.Odieresis = 722; 30270 t.mu = 500; 30271 t.igrave = 278; 30272 t.ohungarumlaut = 500; 30273 t.Eogonek = 611; 30274 t.dcroat = 500; 30275 t.threequarters = 750; 30276 t.Scedilla = 500; 30277 t.lcaron = 300; 30278 t.Kcommaaccent = 667; 30279 t.Lacute = 556; 30280 t.trademark = 980; 30281 t.edotaccent = 444; 30282 t.Igrave = 333; 30283 t.Imacron = 333; 30284 t.Lcaron = 611; 30285 t.onehalf = 750; 30286 t.lessequal = 549; 30287 t.ocircumflex = 500; 30288 t.ntilde = 500; 30289 t.Uhungarumlaut = 722; 30290 t.Eacute = 611; 30291 t.emacron = 444; 30292 t.gbreve = 500; 30293 t.onequarter = 750; 30294 t.Scaron = 500; 30295 t.Scommaaccent = 500;
vendor: 5,928 bytes, lines 30296-30624
30296 t.Ohungarumlaut = 722; 30297 t.degree = 400; 30298 t.ograve = 500; 30299 t.Ccaron = 667; 30300 t.ugrave = 500; 30301 t.radical = 453; 30302 t.Dcaron = 722; 30303 t.rcommaaccent = 389; 30304 t.Ntilde = 667; 30305 t.otilde = 500; 30306 t.Rcommaaccent = 611; 30307 t.Lcommaaccent = 556; 30308 t.Atilde = 611; 30309 t.Aogonek = 611; 30310 t.Aring = 611; 30311 t.Otilde = 722; 30312 t.zdotaccent = 389; 30313 t.Ecaron = 611; 30314 t.Iogonek = 333; 30315 t.kcommaaccent = 444; 30316 t.minus = 675; 30317 t.Icircumflex = 333; 30318 t.ncaron = 500; 30319 t.tcommaaccent = 278; 30320 t.logicalnot = 675; 30321 t.odieresis = 500; 30322 t.udieresis = 500; 30323 t.notequal = 549; 30324 t.gcommaaccent = 500; 30325 t.eth = 500; 30326 t.zcaron = 389; 30327 t.ncommaaccent = 500; 30328 t.onesuperior = 300; 30329 t.imacron = 278; 30330 t.Euro = 500; 30331 }); 30332 t.ZapfDingbats = getLookupTableFactory(function (t) { 30333 t.space = 278; 30334 t.a1 = 974; 30335 t.a2 = 961; 30336 t.a202 = 974; 30337 t.a3 = 980; 30338 t.a4 = 719; 30339 t.a5 = 789; 30340 t.a119 = 790; 30341 t.a118 = 791; 30342 t.a117 = 690; 30343 t.a11 = 960; 30344 t.a12 = 939; 30345 t.a13 = 549; 30346 t.a14 = 855; 30347 t.a15 = 911; 30348 t.a16 = 933; 30349 t.a105 = 911; 30350 t.a17 = 945; 30351 t.a18 = 974; 30352 t.a19 = 755; 30353 t.a20 = 846; 30354 t.a21 = 762; 30355 t.a22 = 761; 30356 t.a23 = 571; 30357 t.a24 = 677; 30358 t.a25 = 763; 30359 t.a26 = 760; 30360 t.a27 = 759; 30361 t.a28 = 754; 30362 t.a6 = 494; 30363 t.a7 = 552; 30364 t.a8 = 537; 30365 t.a9 = 577; 30366 t.a10 = 692; 30367 t.a29 = 786; 30368 t.a30 = 788; 30369 t.a31 = 788; 30370 t.a32 = 790; 30371 t.a33 = 793; 30372 t.a34 = 794; 30373 t.a35 = 816; 30374 t.a36 = 823; 30375 t.a37 = 789; 30376 t.a38 = 841; 30377 t.a39 = 823; 30378 t.a40 = 833; 30379 t.a41 = 816; 30380 t.a42 = 831; 30381 t.a43 = 923; 30382 t.a44 = 744; 30383 t.a45 = 723; 30384 t.a46 = 749; 30385 t.a47 = 790; 30386 t.a48 = 792; 30387 t.a49 = 695; 30388 t.a50 = 776; 30389 t.a51 = 768; 30390 t.a52 = 792; 30391 t.a53 = 759; 30392 t.a54 = 707; 30393 t.a55 = 708; 30394 t.a56 = 682; 30395 t.a57 = 701; 30396 t.a58 = 826; 30397 t.a59 = 815; 30398 t.a60 = 789; 30399 t.a61 = 789; 30400 t.a62 = 707; 30401 t.a63 = 687; 30402 t.a64 = 696; 30403 t.a65 = 689; 30404 t.a66 = 786; 30405 t.a67 = 787; 30406 t.a68 = 713; 30407 t.a69 = 791; 30408 t.a70 = 785; 30409 t.a71 = 791; 30410 t.a72 = 873; 30411 t.a73 = 761; 30412 t.a74 = 762; 30413 t.a203 = 762; 30414 t.a75 = 759; 30415 t.a204 = 759; 30416 t.a76 = 892; 30417 t.a77 = 892; 30418 t.a78 = 788; 30419 t.a79 = 784; 30420 t.a81 = 438; 30421 t.a82 = 138; 30422 t.a83 = 277; 30423 t.a84 = 415; 30424 t.a97 = 392; 30425 t.a98 = 392; 30426 t.a99 = 668; 30427 t.a100 = 668; 30428 t.a89 = 390; 30429 t.a90 = 390; 30430 t.a93 = 317; 30431 t.a94 = 317; 30432 t.a91 = 276; 30433 t.a92 = 276; 30434 t.a205 = 509; 30435 t.a85 = 509; 30436 t.a206 = 410; 30437 t.a86 = 410; 30438 t.a87 = 234; 30439 t.a88 = 234; 30440 t.a95 = 334; 30441 t.a96 = 334; 30442 t.a101 = 732; 30443 t.a102 = 544; 30444 t.a103 = 544; 30445 t.a104 = 910; 30446 t.a106 = 667; 30447 t.a107 = 760; 30448 t.a108 = 760; 30449 t.a112 = 776; 30450 t.a111 = 595; 30451 t.a110 = 694; 30452 t.a109 = 626; 30453 t.a120 = 788; 30454 t.a121 = 788; 30455 t.a122 = 788; 30456 t.a123 = 788; 30457 t.a124 = 788; 30458 t.a125 = 788; 30459 t.a126 = 788; 30460 t.a127 = 788; 30461 t.a128 = 788; 30462 t.a129 = 788; 30463 t.a130 = 788; 30464 t.a131 = 788; 30465 t.a132 = 788; 30466 t.a133 = 788; 30467 t.a134 = 788; 30468 t.a135 = 788; 30469 t.a136 = 788; 30470 t.a137 = 788; 30471 t.a138 = 788; 30472 t.a139 = 788; 30473 t.a140 = 788; 30474 t.a141 = 788; 30475 t.a142 = 788; 30476 t.a143 = 788; 30477 t.a144 = 788; 30478 t.a145 = 788; 30479 t.a146 = 788; 30480 t.a147 = 788; 30481 t.a148 = 788; 30482 t.a149 = 788; 30483 t.a150 = 788; 30484 t.a151 = 788; 30485 t.a152 = 788; 30486 t.a153 = 788; 30487 t.a154 = 788; 30488 t.a155 = 788; 30489 t.a156 = 788; 30490 t.a157 = 788; 30491 t.a158 = 788; 30492 t.a159 = 788; 30493 t.a160 = 894; 30494 t.a161 = 838; 30495 t.a163 = 1016; 30496 t.a164 = 458; 30497 t.a196 = 748; 30498 t.a165 = 924; 30499 t.a192 = 748; 30500 t.a166 = 918; 30501 t.a167 = 927; 30502 t.a168 = 928; 30503 t.a169 = 928; 30504 t.a170 = 834; 30505 t.a171 = 873; 30506 t.a172 = 828; 30507 t.a173 = 924; 30508 t.a162 = 924; 30509 t.a174 = 917; 30510 t.a175 = 930; 30511 t.a176 = 931; 30512 t.a177 = 463; 30513 t.a178 = 883; 30514 t.a179 = 836; 30515 t.a193 = 836; 30516 t.a180 = 867; 30517 t.a199 = 867; 30518 t.a181 = 696; 30519 t.a200 = 696; 30520 t.a182 = 874; 30521 t.a201 = 874; 30522 t.a183 = 760; 30523 t.a184 = 946; 30524 t.a197 = 771; 30525 t.a185 = 865; 30526 t.a194 = 771; 30527 t.a198 = 888; 30528 t.a186 = 967; 30529 t.a195 = 888; 30530 t.a187 = 831; 30531 t.a188 = 873; 30532 t.a189 = 927; 30533 t.a190 = 970; 30534 t.a191 = 918; 30535 }); 30536}); 30537const getFontBasicMetrics = getLookupTableFactory(function (t) { 30538 t.Courier = { 30539 ascent: 629, 30540 descent: -157, 30541 capHeight: 562, 30542 xHeight: -426 30543 }; 30544 t["Courier-Bold"] = { 30545 ascent: 629, 30546 descent: -157, 30547 capHeight: 562, 30548 xHeight: 439 30549 }; 30550 t["Courier-Oblique"] = { 30551 ascent: 629, 30552 descent: -157, 30553 capHeight: 562, 30554 xHeight: 426 30555 }; 30556 t["Courier-BoldOblique"] = { 30557 ascent: 629, 30558 descent: -157, 30559 capHeight: 562, 30560 xHeight: 426 30561 }; 30562 t.Helvetica = { 30563 ascent: 718, 30564 descent: -207, 30565 capHeight: 718, 30566 xHeight: 523 30567 }; 30568 t["Helvetica-Bold"] = { 30569 ascent: 718, 30570 descent: -207, 30571 capHeight: 718, 30572 xHeight: 532 30573 }; 30574 t["Helvetica-Oblique"] = { 30575 ascent: 718, 30576 descent: -207, 30577 capHeight: 718, 30578 xHeight: 523 30579 }; 30580 t["Helvetica-BoldOblique"] = { 30581 ascent: 718, 30582 descent: -207, 30583 capHeight: 718, 30584 xHeight: 532 30585 }; 30586 t["Times-Roman"] = { 30587 ascent: 683, 30588 descent: -217, 30589 capHeight: 662, 30590 xHeight: 450 30591 }; 30592 t["Times-Bold"] = { 30593 ascent: 683, 30594 descent: -217, 30595 capHeight: 676, 30596 xHeight: 461 30597 }; 30598 t["Times-Italic"] = { 30599 ascent: 683, 30600 descent: -217, 30601 capHeight: 653, 30602 xHeight: 441 30603 }; 30604 t["Times-BoldItalic"] = { 30605 ascent: 683, 30606 descent: -217, 30607 capHeight: 669, 30608 xHeight: 462 30609 }; 30610 t.Symbol = { 30611 ascent: Math.NaN, 30612 descent: Math.NaN, 30613 capHeight: Math.NaN, 30614 xHeight: Math.NaN 30615 }; 30616 t.ZapfDingbats = { 30617 ascent: Math.NaN, 30618 descent: Math.NaN, 30619 capHeight: Math.NaN, 30620 xHeight: Math.NaN 30621 }; 30622}); 30623 30624;// ./src/core/
vendor: 4,875 bytes, lines 30624-30815
30624glyf.js 30625 30626 30627 30628 30629 30630 30631 30632 30633 30634 30635 30636 30637const ON_CURVE_POINT = 1 << 0; 30638const X_SHORT_VECTOR = 1 << 1; 30639const Y_SHORT_VECTOR = 1 << 2; 30640const REPEAT_FLAG = 1 << 3; 30641const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 1 << 4; 30642const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 1 << 5; 30643const OVERLAP_SIMPLE = 1 << 6; 30644const ARG_1_AND_2_ARE_WORDS = 1 << 0; 30645const ARGS_ARE_XY_VALUES = 1 << 1; 30646const WE_HAVE_A_SCALE = 1 << 3; 30647const MORE_COMPONENTS = 1 << 5; 30648const WE_HAVE_AN_X_AND_Y_SCALE = 1 << 6; 30649const WE_HAVE_A_TWO_BY_TWO = 1 << 7; 30650const WE_HAVE_INSTRUCTIONS = 1 << 8; 30651class GlyfTable { 30652 constructor({ 30653 glyfTable, 30654 isGlyphLocationsLong, 30655 locaTable, 30656 numGlyphs 30657 }) { 30658 this.glyphs = []; 30659 const loca = new DataView(locaTable.buffer, locaTable.byteOffset, locaTable.byteLength); 30660 const glyf = new DataView(glyfTable.buffer, glyfTable.byteOffset, glyfTable.byteLength); 30661 const offsetSize = isGlyphLocationsLong ? 4 : 2; 30662 let prev = isGlyphLocationsLong ? loca.getUint32(0) : 2 * loca.getUint16(0); 30663 let pos = 0; 30664 for (let i = 0; i < numGlyphs; i++) { 30665 pos += offsetSize; 30666 const next = isGlyphLocationsLong ? loca.getUint32(pos) : 2 * loca.getUint16(pos); 30667 if (next === prev) { 30668 this.glyphs.push(new Glyph({})); 30669 continue; 30670 } 30671 const glyph = Glyph.parse(prev, glyf); 30672 this.glyphs.push(glyph); 30673 prev = next; 30674 } 30675 } 30676 getSize() { 30677 return Math.sumPrecise(this.glyphs.map(g => g.getSize() + 3 & ~3)); 30678 } 30679 write() { 30680 const totalSize = this.getSize(); 30681 const glyfTable = new DataView(new ArrayBuffer(totalSize)); 30682 const isLocationLong = totalSize > 0x1fffe; 30683 const offsetSize = isLocationLong ? 4 : 2; 30684 const locaTable = new DataView(new ArrayBuffer((this.glyphs.length + 1) * offsetSize)); 30685 if (isLocationLong) { 30686 locaTable.setUint32(0, 0); 30687 } else { 30688 locaTable.setUint16(0, 0); 30689 } 30690 let pos = 0; 30691 let locaIndex = 0; 30692 for (const glyph of this.glyphs) { 30693 pos += glyph.write(pos, glyfTable); 30694 pos = pos + 3 & ~3; 30695 locaIndex += offsetSize; 30696 if (isLocationLong) { 30697 locaTable.setUint32(locaIndex, pos); 30698 } else { 30699 locaTable.setUint16(locaIndex, pos >> 1); 30700 } 30701 } 30702 return { 30703 isLocationLong, 30704 loca: new Uint8Array(locaTable.buffer), 30705 glyf: new Uint8Array(glyfTable.buffer) 30706 }; 30707 } 30708 scale(factors) { 30709 for (let i = 0, ii = this.glyphs.length; i < ii; i++) { 30710 this.glyphs[i].scale(factors[i]); 30711 } 30712 } 30713} 30714class Glyph { 30715 constructor({ 30716 header = null, 30717 simple = null, 30718 composites = null 30719 }) { 30720 this.header = header; 30721 this.simple = simple; 30722 this.composites = composites; 30723 } 30724 static parse(pos, glyf) { 30725 const [read, header] = GlyphHeader.parse(pos, glyf); 30726 pos += read; 30727 if (header.numberOfContours < 0) { 30728 const composites = []; 30729 while (true) { 30730 const [n, composite] = CompositeGlyph.parse(pos, glyf); 30731 pos += n; 30732 composites.push(composite); 30733 if (!(composite.flags & MORE_COMPONENTS)) { 30734 break; 30735 } 30736 } 30737 return new Glyph({ 30738 header, 30739 composites 30740 }); 30741 } 30742 const simple = SimpleGlyph.parse(pos, glyf, header.numberOfContours); 30743 return new Glyph({ 30744 header, 30745 simple 30746 }); 30747 } 30748 getSize() { 30749 if (!this.header) { 30750 return 0; 30751 } 30752 const size = this.simple ? this.simple.getSize() : Math.sumPrecise(this.composites.map(c => c.getSize())); 30753 return this.header.getSize() + size; 30754 } 30755 write(pos, buf) { 30756 if (!this.header) { 30757 return 0; 30758 } 30759 const spos = pos; 30760 pos += this.header.write(pos, buf); 30761 if (this.simple) { 30762 pos += this.simple.write(pos, buf); 30763 } else { 30764 for (const composite of this.composites) { 30765 pos += composite.write(pos, buf); 30766 } 30767 } 30768 return pos - spos; 30769 } 30770 scale(factor) { 30771 if (!this.header) { 30772 return; 30773 } 30774 const xMiddle = (this.header.xMin + this.header.xMax) / 2; 30775 this.header.scale(xMiddle, factor); 30776 if (this.simple) { 30777 this.simple.scale(xMiddle, factor); 30778 } else { 30779 for (const composite of this.composites) { 30780 composite.scale(xMiddle, factor); 30781 } 30782 } 30783 } 30784} 30785class GlyphHeader { 30786 constructor({ 30787 numberOfContours, 30788 xMin, 30789 yMin, 30790 xMax, 30791 yMax 30792 }) { 30793 this.numberOfContours = numberOfContours; 30794 this.xMin = xMin; 30795 this.yMin = yMin; 30796 this.xMax = xMax; 30797 this.yMax = yMax; 30798 } 30799 static parse(pos, glyf) { 30800 return [10, new GlyphHeader({ 30801 numberOfContours: glyf.getInt16(pos), 30802 xMin: glyf.getInt16(pos + 2), 30803 yMin: glyf.getInt16(pos + 4), 30804 xMax: glyf.getInt16(pos + 6), 30805 yMax: glyf.getInt16(pos + 8) 30806 })]; 30807 } 30808 getSize() { 30809 return 10; 30810 } 30811 write(pos, buf) { 30812 buf.setInt16(pos, this.numberOfContours); 30813 buf.setInt16(pos + 2, this.xMin); 30814 buf.setInt16(pos + 4, this.yMin); 30815 buf.setInt16(pos + 6, this.xMax);
vendor: 16,694 bytes, lines 30816-31402
30816 buf.setInt16(pos + 8, this.yMax); 30817 return 10; 30818 } 30819 scale(x, factor) { 30820 this.xMin = Math.round(x + (this.xMin - x) * factor); 30821 this.xMax = Math.round(x + (this.xMax - x) * factor); 30822 } 30823} 30824class Contour { 30825 constructor({ 30826 flags, 30827 xCoordinates, 30828 yCoordinates 30829 }) { 30830 this.xCoordinates = xCoordinates; 30831 this.yCoordinates = yCoordinates; 30832 this.flags = flags; 30833 } 30834} 30835class SimpleGlyph { 30836 constructor({ 30837 contours, 30838 instructions 30839 }) { 30840 this.contours = contours; 30841 this.instructions = instructions; 30842 } 30843 static parse(pos, glyf, numberOfContours) { 30844 const endPtsOfContours = []; 30845 for (let i = 0; i < numberOfContours; i++) { 30846 const endPt = glyf.getUint16(pos); 30847 pos += 2; 30848 endPtsOfContours.push(endPt); 30849 } 30850 const numberOfPt = endPtsOfContours[numberOfContours - 1] + 1; 30851 const instructionLength = glyf.getUint16(pos); 30852 pos += 2; 30853 const instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength); 30854 pos += instructionLength; 30855 const flags = []; 30856 for (let i = 0; i < numberOfPt; pos++, i++) { 30857 let flag = glyf.getUint8(pos); 30858 flags.push(flag); 30859 if (flag & REPEAT_FLAG) { 30860 const count = glyf.getUint8(++pos); 30861 flag ^= REPEAT_FLAG; 30862 for (let m = 0; m < count; m++) { 30863 flags.push(flag); 30864 } 30865 i += count; 30866 } 30867 } 30868 const allXCoordinates = []; 30869 let xCoordinates = []; 30870 let yCoordinates = []; 30871 let pointFlags = []; 30872 const contours = []; 30873 let endPtsOfContoursIndex = 0; 30874 let lastCoordinate = 0; 30875 for (let i = 0; i < numberOfPt; i++) { 30876 const flag = flags[i]; 30877 if (flag & X_SHORT_VECTOR) { 30878 const x = glyf.getUint8(pos++); 30879 lastCoordinate += flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR ? x : -x; 30880 xCoordinates.push(lastCoordinate); 30881 } else if (flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) { 30882 xCoordinates.push(lastCoordinate); 30883 } else { 30884 lastCoordinate += glyf.getInt16(pos); 30885 pos += 2; 30886 xCoordinates.push(lastCoordinate); 30887 } 30888 if (endPtsOfContours[endPtsOfContoursIndex] === i) { 30889 endPtsOfContoursIndex++; 30890 allXCoordinates.push(xCoordinates); 30891 xCoordinates = []; 30892 } 30893 } 30894 lastCoordinate = 0; 30895 endPtsOfContoursIndex = 0; 30896 for (let i = 0; i < numberOfPt; i++) { 30897 const flag = flags[i]; 30898 if (flag & Y_SHORT_VECTOR) { 30899 const y = glyf.getUint8(pos++); 30900 lastCoordinate += flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR ? y : -y; 30901 yCoordinates.push(lastCoordinate); 30902 } else if (flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) { 30903 yCoordinates.push(lastCoordinate); 30904 } else { 30905 lastCoordinate += glyf.getInt16(pos); 30906 pos += 2; 30907 yCoordinates.push(lastCoordinate); 30908 } 30909 pointFlags.push(flag & ON_CURVE_POINT | flag & OVERLAP_SIMPLE); 30910 if (endPtsOfContours[endPtsOfContoursIndex] === i) { 30911 xCoordinates = allXCoordinates[endPtsOfContoursIndex]; 30912 endPtsOfContoursIndex++; 30913 contours.push(new Contour({ 30914 flags: pointFlags, 30915 xCoordinates, 30916 yCoordinates 30917 })); 30918 yCoordinates = []; 30919 pointFlags = []; 30920 } 30921 } 30922 return new SimpleGlyph({ 30923 contours, 30924 instructions 30925 }); 30926 } 30927 getSize() { 30928 let size = this.contours.length * 2 + 2 + this.instructions.length; 30929 let lastX = 0; 30930 let lastY = 0; 30931 for (const contour of this.contours) { 30932 size += contour.flags.length; 30933 for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) { 30934 const x = contour.xCoordinates[i]; 30935 const y = contour.yCoordinates[i]; 30936 let abs = Math.abs(x - lastX); 30937 if (abs > 255) { 30938 size += 2; 30939 } else if (abs > 0) { 30940 size += 1; 30941 } 30942 lastX = x; 30943 abs = Math.abs(y - lastY); 30944 if (abs > 255) { 30945 size += 2; 30946 } else if (abs > 0) { 30947 size += 1; 30948 } 30949 lastY = y; 30950 } 30951 } 30952 return size; 30953 } 30954 write(pos, buf) { 30955 const spos = pos; 30956 const xCoordinates = []; 30957 const yCoordinates = []; 30958 const flags = []; 30959 let lastX = 0; 30960 let lastY = 0; 30961 for (const contour of this.contours) { 30962 for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) { 30963 let flag = contour.flags[i]; 30964 const x = contour.xCoordinates[i]; 30965 let delta = x - lastX; 30966 if (delta === 0) { 30967 flag |= X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR; 30968 xCoordinates.push(0); 30969 } else { 30970 const abs = Math.abs(delta); 30971 if (abs <= 255) { 30972 flag |= delta >= 0 ? X_SHORT_VECTOR | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR : X_SHORT_VECTOR; 30973 xCoordinates.push(abs); 30974 } else { 30975 xCoordinates.push(delta); 30976 } 30977 } 30978 lastX = x; 30979 const y = contour.yCoordinates[i]; 30980 delta = y - lastY; 30981 if (delta === 0) { 30982 flag |= Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR; 30983 yCoordinates.push(0); 30984 } else { 30985 const abs = Math.abs(delta); 30986 if (abs <= 255) { 30987 flag |= delta >= 0 ? Y_SHORT_VECTOR | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR : Y_SHORT_VECTOR; 30988 yCoordinates.push(abs); 30989 } else { 30990 yCoordinates.push(delta); 30991 } 30992 } 30993 lastY = y; 30994 flags.push(flag); 30995 } 30996 buf.setUint16(pos, xCoordinates.length - 1); 30997 pos += 2; 30998 } 30999 buf.setUint16(pos, this.instructions.length); 31000 pos += 2; 31001 if (this.instructions.length) { 31002 new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos); 31003 pos += this.instructions.length; 31004 } 31005 for (const flag of flags) { 31006 buf.setUint8(pos++, flag); 31007 } 31008 for (let i = 0, ii = xCoordinates.length; i < ii; i++) { 31009 const x = xCoordinates[i]; 31010 const flag = flags[i]; 31011 if (flag & X_SHORT_VECTOR) { 31012 buf.setUint8(pos++, x); 31013 } else if (!(flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR)) { 31014 buf.setInt16(pos, x); 31015 pos += 2; 31016 } 31017 } 31018 for (let i = 0, ii = yCoordinates.length; i < ii; i++) { 31019 const y = yCoordinates[i]; 31020 const flag = flags[i]; 31021 if (flag & Y_SHORT_VECTOR) { 31022 buf.setUint8(pos++, y); 31023 } else if (!(flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR)) { 31024 buf.setInt16(pos, y); 31025 pos += 2; 31026 } 31027 } 31028 return pos - spos; 31029 } 31030 scale(x, factor) { 31031 for (const contour of this.contours) { 31032 if (contour.xCoordinates.length === 0) { 31033 continue; 31034 } 31035 for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) { 31036 contour.xCoordinates[i] = Math.round(x + (contour.xCoordinates[i] - x) * factor); 31037 } 31038 } 31039 } 31040} 31041class CompositeGlyph { 31042 constructor({ 31043 flags, 31044 glyphIndex, 31045 argument1, 31046 argument2, 31047 transf, 31048 instructions 31049 }) { 31050 this.flags = flags; 31051 this.glyphIndex = glyphIndex; 31052 this.argument1 = argument1; 31053 this.argument2 = argument2; 31054 this.transf = transf; 31055 this.instructions = instructions; 31056 } 31057 static parse(pos, glyf) { 31058 const spos = pos; 31059 const transf = []; 31060 let flags = glyf.getUint16(pos); 31061 const glyphIndex = glyf.getUint16(pos + 2); 31062 pos += 4; 31063 let argument1, argument2; 31064 if (flags & ARG_1_AND_2_ARE_WORDS) { 31065 if (flags & ARGS_ARE_XY_VALUES) { 31066 argument1 = glyf.getInt16(pos); 31067 argument2 = glyf.getInt16(pos + 2); 31068 } else { 31069 argument1 = glyf.getUint16(pos); 31070 argument2 = glyf.getUint16(pos + 2); 31071 } 31072 pos += 4; 31073 flags ^= ARG_1_AND_2_ARE_WORDS; 31074 } else { 31075 if (flags & ARGS_ARE_XY_VALUES) { 31076 argument1 = glyf.getInt8(pos); 31077 argument2 = glyf.getInt8(pos + 1); 31078 } else { 31079 argument1 = glyf.getUint8(pos); 31080 argument2 = glyf.getUint8(pos + 1); 31081 } 31082 pos += 2; 31083 } 31084 if (flags & WE_HAVE_A_SCALE) { 31085 transf.push(glyf.getUint16(pos)); 31086 pos += 2; 31087 } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) { 31088 transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2)); 31089 pos += 4; 31090 } else if (flags & WE_HAVE_A_TWO_BY_TWO) { 31091 transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2), glyf.getUint16(pos + 4), glyf.getUint16(pos + 6)); 31092 pos += 8; 31093 } 31094 let instructions = null; 31095 if (flags & WE_HAVE_INSTRUCTIONS) { 31096 const instructionLength = glyf.getUint16(pos); 31097 pos += 2; 31098 instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength); 31099 pos += instructionLength; 31100 } 31101 return [pos - spos, new CompositeGlyph({ 31102 flags, 31103 glyphIndex, 31104 argument1, 31105 argument2, 31106 transf, 31107 instructions 31108 })]; 31109 } 31110 getSize() { 31111 let size = 2 + 2 + this.transf.length * 2; 31112 if (this.flags & WE_HAVE_INSTRUCTIONS) { 31113 size += 2 + this.instructions.length; 31114 } 31115 size += 2; 31116 if (this.flags & 2) { 31117 if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) { 31118 size += 2; 31119 } 31120 } else if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) { 31121 size += 2; 31122 } 31123 return size; 31124 } 31125 write(pos, buf) { 31126 const spos = pos; 31127 if (this.flags & ARGS_ARE_XY_VALUES) { 31128 if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) { 31129 this.flags |= ARG_1_AND_2_ARE_WORDS; 31130 } 31131 } else if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) { 31132 this.flags |= ARG_1_AND_2_ARE_WORDS; 31133 } 31134 buf.setUint16(pos, this.flags); 31135 buf.setUint16(pos + 2, this.glyphIndex); 31136 pos += 4; 31137 if (this.flags & ARG_1_AND_2_ARE_WORDS) { 31138 if (this.flags & ARGS_ARE_XY_VALUES) { 31139 buf.setInt16(pos, this.argument1); 31140 buf.setInt16(pos + 2, this.argument2); 31141 } else { 31142 buf.setUint16(pos, this.argument1); 31143 buf.setUint16(pos + 2, this.argument2); 31144 } 31145 pos += 4; 31146 } else { 31147 buf.setUint8(pos, this.argument1); 31148 buf.setUint8(pos + 1, this.argument2); 31149 pos += 2; 31150 } 31151 if (this.flags & WE_HAVE_INSTRUCTIONS) { 31152 buf.setUint16(pos, this.instructions.length); 31153 pos += 2; 31154 if (this.instructions.length) { 31155 new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos); 31156 pos += this.instructions.length; 31157 } 31158 } 31159 return pos - spos; 31160 } 31161 scale(x, factor) {} 31162} 31163 31164;// ./src/core/opentype_file_builder.js 31165 31166 31167 31168 31169 31170 31171 31172 31173 31174 31175 31176 31177const OTF_HEADER_SIZE = 12; 31178const OTF_TABLE_ENTRY_SIZE = 16; 31179class OpenTypeFileBuilder { 31180 #tables = new Map(); 31181 constructor(sfnt) { 31182 this.sfnt = sfnt; 31183 } 31184 static getSearchParams(entriesCount, entrySize) { 31185 let maxPower2 = 1, 31186 log2 = 0; 31187 while ((maxPower2 ^ entriesCount) > maxPower2) { 31188 maxPower2 <<= 1; 31189 log2++; 31190 } 31191 const searchRange = maxPower2 * entrySize; 31192 return { 31193 range: searchRange, 31194 entry: log2, 31195 rangeShift: entrySize * entriesCount - searchRange 31196 }; 31197 } 31198 toArray() { 31199 let sfnt = this.sfnt; 31200 const tables = this.#tables; 31201 const tablesNames = [...tables.keys()].sort(); 31202 const numTables = tablesNames.length; 31203 let offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE; 31204 const tableOffsets = [offset]; 31205 for (let i = 0; i < numTables; i++) { 31206 const table = tables.get(tablesNames[i]); 31207 const paddedLength = (table.length + 3 & ~3) >>> 0; 31208 offset += paddedLength; 31209 tableOffsets.push(offset); 31210 } 31211 const file = new Uint8Array(offset), 31212 view = new DataView(file.buffer); 31213 for (let i = 0; i < numTables; i++) { 31214 const table = tables.get(tablesNames[i]); 31215 file.set(table, tableOffsets[i]); 31216 } 31217 if (sfnt === "true") { 31218 sfnt = "\x00\x01\x00\x00"; 31219 } 31220 file.set(stringToBytes(sfnt), 0); 31221 view.setInt16(4, numTables); 31222 const searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16); 31223 view.setInt16(6, searchParams.range); 31224 view.setInt16(8, searchParams.entry); 31225 view.setInt16(10, searchParams.rangeShift); 31226 offset = OTF_HEADER_SIZE; 31227 for (let i = 0; i < numTables; i++) { 31228 const tableName = tablesNames[i]; 31229 file.set(stringToBytes(tableName), offset); 31230 let checksum = 0; 31231 for (let j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) { 31232 const quad = view.getUint32(j); 31233 checksum = checksum + quad >>> 0; 31234 } 31235 view.setInt32(offset + 4, checksum); 31236 view.setInt32(offset + 8, tableOffsets[i]); 31237 view.setInt32(offset + 12, tables.get(tableName).length); 31238 offset += OTF_TABLE_ENTRY_SIZE; 31239 } 31240 this.#tables.clear(); 31241 return file; 31242 } 31243 addTable(tag, data) { 31244 if (this.#tables.has(tag)) { 31245 throw new Error(`Table ${tag} already exists`); 31246 } 31247 this.#tables.set(tag, data); 31248 } 31249} 31250 31251;// ./src/core/type1_parser.js 31252 31253 31254 31255 31256 31257 31258 31259 31260 31261 31262 31263 31264 31265 31266 31267const HINTING_ENABLED = false; 31268const COMMAND_MAP = { 31269 hstem: [1], 31270 vstem: [3], 31271 vmoveto: [4], 31272 rlineto: [5], 31273 hlineto: [6], 31274 vlineto: [7], 31275 rrcurveto: [8], 31276 callsubr: [10], 31277 flex: [12, 35], 31278 drop: [12, 18], 31279 endchar: [14], 31280 rmoveto: [21], 31281 hmoveto: [22], 31282 vhcurveto: [30], 31283 hvcurveto: [31] 31284}; 31285class Type1CharString { 31286 width = 0; 31287 lsb = 0; 31288 flexing = false; 31289 output = []; 31290 stack = []; 31291 convert(encoded, subrs, seacAnalysisEnabled) { 31292 const count = encoded.length; 31293 let error = false; 31294 let wx, sbx, subrNumber; 31295 for (let i = 0; i < count; i++) { 31296 let value = encoded[i]; 31297 if (value < 32) { 31298 if (value === 12) { 31299 value = (value << 8) + encoded[++i]; 31300 } 31301 switch (value) { 31302 case 1: 31303 if (!HINTING_ENABLED) { 31304 this.stack = []; 31305 break; 31306 } 31307 error = this.executeCommand(2, COMMAND_MAP.hstem); 31308 break; 31309 case 3: 31310 if (!HINTING_ENABLED) { 31311 this.stack = []; 31312 break; 31313 } 31314 error = this.executeCommand(2, COMMAND_MAP.vstem); 31315 break; 31316 case 4: 31317 if (this.flexing) { 31318 if (this.stack.length < 1) { 31319 error = true; 31320 break; 31321 } 31322 const dy = this.stack.pop(); 31323 this.stack.push(0, dy); 31324 break; 31325 } 31326 error = this.executeCommand(1, COMMAND_MAP.vmoveto); 31327 break; 31328 case 5: 31329 error = this.executeCommand(2, COMMAND_MAP.rlineto); 31330 break; 31331 case 6: 31332 error = this.executeCommand(1, COMMAND_MAP.hlineto); 31333 break; 31334 case 7: 31335 error = this.executeCommand(1, COMMAND_MAP.vlineto); 31336 break; 31337 case 8: 31338 error = this.executeCommand(6, COMMAND_MAP.rrcurveto); 31339 break; 31340 case 9: 31341 this.stack = []; 31342 break; 31343 case 10: 31344 if (this.stack.length < 1) { 31345 error = true; 31346 break; 31347 } 31348 subrNumber = this.stack.pop(); 31349 if (!subrs[subrNumber]) { 31350 error = true; 31351 break; 31352 } 31353 error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled); 31354 break; 31355 case 11: 31356 return error; 31357 case 13: 31358 if (this.stack.length < 2) { 31359 error = true; 31360 break; 31361 } 31362 wx = this.stack.pop(); 31363 sbx = this.stack.pop(); 31364 this.lsb = sbx; 31365 this.width = wx; 31366 this.stack.push(wx, sbx); 31367 error = this.executeCommand(2, COMMAND_MAP.hmoveto); 31368 break; 31369 case 14: 31370 this.output.push(COMMAND_MAP.endchar[0]); 31371 break; 31372 case 21: 31373 if (this.flexing) { 31374 break; 31375 } 31376 error = this.executeCommand(2, COMMAND_MAP.rmoveto); 31377 break; 31378 case 22: 31379 if (this.flexing) { 31380 this.stack.push(0); 31381 break; 31382 } 31383 error = this.executeCommand(1, COMMAND_MAP.hmoveto); 31384 break; 31385 case 30: 31386 error = this.executeCommand(4, COMMAND_MAP.vhcurveto); 31387 break; 31388 case 31: 31389 error = this.executeCommand(4, COMMAND_MAP.hvcurveto); 31390 break; 31391 case (12 << 8) + 0: 31392 this.stack = []; 31393 break; 31394 case (12 << 8) + 1: 31395 if (!HINTING_ENABLED) { 31396 this.stack = []; 31397 break; 31398 } 31399 error = this.executeCommand(2, COMMAND_MAP.vstem); 31400 break; 31401 case (12 << 8) + 2: 31402 if (!HINTING_ENABLED
vendor: 7,654 bytes, lines 31402-31652
31402) { 31403 this.stack = []; 31404 break; 31405 } 31406 error = this.executeCommand(2, COMMAND_MAP.hstem); 31407 break; 31408 case (12 << 8) + 6: 31409 if (seacAnalysisEnabled) { 31410 const asb = this.stack.at(-5); 31411 this.seac = this.stack.splice(-4, 4); 31412 this.seac[0] += this.lsb - asb; 31413 error = this.executeCommand(0, COMMAND_MAP.endchar); 31414 } else { 31415 error = this.executeCommand(4, COMMAND_MAP.endchar); 31416 } 31417 break; 31418 case (12 << 8) + 7: 31419 if (this.stack.length < 4) { 31420 error = true; 31421 break; 31422 } 31423 this.stack.pop(); 31424 wx = this.stack.pop(); 31425 const sby = this.stack.pop(); 31426 sbx = this.stack.pop(); 31427 this.lsb = sbx; 31428 this.width = wx; 31429 this.stack.push(wx, sbx, sby); 31430 error = this.executeCommand(3, COMMAND_MAP.rmoveto); 31431 break; 31432 case (12 << 8) + 12: 31433 if (this.stack.length < 2) { 31434 error = true; 31435 break; 31436 } 31437 const num2 = this.stack.pop(); 31438 const num1 = this.stack.pop(); 31439 this.stack.push(num1 / num2); 31440 break; 31441 case (12 << 8) + 16: 31442 if (this.stack.length < 2) { 31443 error = true; 31444 break; 31445 } 31446 subrNumber = this.stack.pop(); 31447 const numArgs = this.stack.pop(); 31448 if (subrNumber === 0 && numArgs === 3) { 31449 const flexArgs = this.stack.splice(-17, 17); 31450 this.stack.push(flexArgs[2] + flexArgs[0], flexArgs[3] + flexArgs[1], flexArgs[4], flexArgs[5], flexArgs[6], flexArgs[7], flexArgs[8], flexArgs[9], flexArgs[10], flexArgs[11], flexArgs[12], flexArgs[13], flexArgs[14]); 31451 error = this.executeCommand(13, COMMAND_MAP.flex, true); 31452 this.flexing = false; 31453 this.stack.push(flexArgs[15], flexArgs[16]); 31454 } else if (subrNumber === 1 && numArgs === 0) { 31455 this.flexing = true; 31456 } 31457 break; 31458 case (12 << 8) + 17: 31459 break; 31460 case (12 << 8) + 33: 31461 this.stack = []; 31462 break; 31463 default: 31464 warn('Unknown type 1 charstring command of "' + value + '"'); 31465 break; 31466 } 31467 if (error) { 31468 break; 31469 } 31470 continue; 31471 } else if (value <= 246) { 31472 value -= 139; 31473 } else if (value <= 250) { 31474 value = (value - 247) * 256 + encoded[++i] + 108; 31475 } else if (value <= 254) { 31476 value = -((value - 251) * 256) - encoded[++i] - 108; 31477 } else { 31478 value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0; 31479 } 31480 this.stack.push(value); 31481 } 31482 return error; 31483 } 31484 executeCommand(howManyArgs, command, keepStack) { 31485 const stackLength = this.stack.length; 31486 if (howManyArgs > stackLength) { 31487 return true; 31488 } 31489 const start = stackLength - howManyArgs; 31490 for (let i = start; i < stackLength; i++) { 31491 let value = this.stack[i]; 31492 if (Number.isInteger(value)) { 31493 this.output.push(28, value >> 8 & 0xff, value & 0xff); 31494 } else { 31495 value = 65536 * value | 0; 31496 this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff); 31497 } 31498 } 31499 this.output.push(...command); 31500 if (keepStack) { 31501 this.stack.splice(start, howManyArgs); 31502 } else { 31503 this.stack.length = 0; 31504 } 31505 return false; 31506 } 31507} 31508const EEXEC_ENCRYPT_KEY = 55665; 31509const CHAR_STRS_ENCRYPT_KEY = 4330; 31510function isHexDigit(code) { 31511 return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102; 31512} 31513function decrypt(data, key, discardNumber) { 31514 if (discardNumber >= data.length) { 31515 return new Uint8Array(0); 31516 } 31517 const c1 = 52845, 31518 c2 = 22719; 31519 let r = key | 0, 31520 i, 31521 j; 31522 for (i = 0; i < discardNumber; i++) { 31523 r = (data[i] + r) * c1 + c2 & (1 << 16) - 1; 31524 } 31525 const count = data.length - discardNumber; 31526 const decrypted = new Uint8Array(count); 31527 for (i = discardNumber, j = 0; j < count; i++, j++) { 31528 const value = data[i]; 31529 decrypted[j] = value ^ r >> 8; 31530 r = (value + r) * c1 + c2 & (1 << 16) - 1; 31531 } 31532 return decrypted; 31533} 31534function decryptAscii(data, key, discardNumber) { 31535 const c1 = 52845, 31536 c2 = 22719; 31537 let r = key | 0; 31538 const count = data.length, 31539 maybeLength = count >>> 1; 31540 const decrypted = new Uint8Array(maybeLength); 31541 let i, j; 31542 for (i = 0, j = 0; i < count; i++) { 31543 const digit1 = data[i]; 31544 if (!isHexDigit(digit1)) { 31545 continue; 31546 } 31547 i++; 31548 let digit2; 31549 while (i < count && !isHexDigit(digit2 = data[i])) { 31550 i++; 31551 } 31552 if (i < count) { 31553 const value = parseInt(String.fromCharCode(digit1, digit2), 16); 31554 decrypted[j++] = value ^ r >> 8; 31555 r = (value + r) * c1 + c2 & (1 << 16) - 1; 31556 } 31557 } 31558 return decrypted.slice(discardNumber, j); 31559} 31560function isSpecial(c) { 31561 return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29; 31562} 31563class Type1Parser { 31564 constructor(stream, encrypted, seacAnalysisEnabled) { 31565 if (encrypted) { 31566 const data = stream.getBytes(); 31567 const isBinary = !((isHexDigit(data[0]) || isWhiteSpace(data[0])) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]) && isHexDigit(data[4]) && isHexDigit(data[5]) && isHexDigit(data[6]) && isHexDigit(data[7])); 31568 stream = new Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4)); 31569 } 31570 this.seacAnalysisEnabled = !!seacAnalysisEnabled; 31571 this.stream = stream; 31572 this.nextChar(); 31573 } 31574 readNumberArray() { 31575 this.getToken(); 31576 const array = []; 31577 while (true) { 31578 const token = this.getToken(); 31579 if (token === null || token === "]" || token === "}") { 31580 break; 31581 } 31582 array.push(parseFloat(token || 0)); 31583 } 31584 return array; 31585 } 31586 readNumber() { 31587 const token = this.getToken(); 31588 return parseFloat(token || 0); 31589 } 31590 readInt() { 31591 const token = this.getToken(); 31592 return parseInt(token || 0, 10) | 0; 31593 } 31594 readBoolean() { 31595 const token = this.getToken(); 31596 return token === "true" ? 1 : 0; 31597 } 31598 nextChar() { 31599 return this.currentChar = this.stream.getByte(); 31600 } 31601 prevChar() { 31602 this.stream.skip(-2); 31603 return this.currentChar = this.stream.getByte(); 31604 } 31605 getToken() { 31606 let comment = false; 31607 let ch = this.currentChar; 31608 while (true) { 31609 if (ch === -1) { 31610 return null; 31611 } 31612 if (comment) { 31613 if (ch === 0x0a || ch === 0x0d) { 31614 comment = false; 31615 } 31616 } else if (ch === 0x25) { 31617 comment = true; 31618 } else if (!isWhiteSpace(ch)) { 31619 break; 31620 } 31621 ch = this.nextChar(); 31622 } 31623 if (isSpecial(ch)) { 31624 this.nextChar(); 31625 return String.fromCharCode(ch); 31626 } 31627 let token = ""; 31628 do { 31629 token += String.fromCharCode(ch); 31630 ch = this.nextChar(); 31631 } while (ch >= 0 && !isWhiteSpace(ch) && !isSpecial(ch)); 31632 return token; 31633 } 31634 readCharStrings(bytes, lenIV) { 31635 if (lenIV === -1) { 31636 return bytes; 31637 } 31638 return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV); 31639 } 31640 extractFontProgram(properties) { 31641 const stream = this.stream; 31642 const subrs = [], 31643 charstrings = []; 31644 const privateData = new Map([["lenIV", 4]]); 31645 const program = { 31646 subrs: [], 31647 charstrings: [], 31648 properties: { 31649 privateData 31650 } 31651 }; 31652 let token, length, data
vendor: 9,833 bytes, lines 31652-31963
31652, lenIV; 31653 while ((token = this.getToken()) !== null) { 31654 if (token !== "/") { 31655 continue; 31656 } 31657 token = this.getToken(); 31658 switch (token) { 31659 case "CharStrings": 31660 this.getToken(); 31661 this.getToken(); 31662 this.getToken(); 31663 this.getToken(); 31664 while (true) { 31665 token = this.getToken(); 31666 if (token === null || token === "end") { 31667 break; 31668 } 31669 if (token !== "/") { 31670 continue; 31671 } 31672 const glyph = this.getToken(); 31673 length = this.readInt(); 31674 this.getToken(); 31675 data = length > 0 ? stream.getBytes(length) : new Uint8Array(0); 31676 lenIV = privateData.get("lenIV"); 31677 const encoded = this.readCharStrings(data, lenIV); 31678 this.nextChar(); 31679 token = this.getToken(); 31680 if (token === "noaccess") { 31681 this.getToken(); 31682 } else if (token === "/") { 31683 this.prevChar(); 31684 } 31685 charstrings.push({ 31686 glyph, 31687 encoded 31688 }); 31689 } 31690 break; 31691 case "Subrs": 31692 this.readInt(); 31693 this.getToken(); 31694 while (this.getToken() === "dup") { 31695 const index = this.readInt(); 31696 length = this.readInt(); 31697 this.getToken(); 31698 data = length > 0 ? stream.getBytes(length) : new Uint8Array(0); 31699 lenIV = privateData.get("lenIV"); 31700 const encoded = this.readCharStrings(data, lenIV); 31701 this.nextChar(); 31702 token = this.getToken(); 31703 if (token === "noaccess") { 31704 this.getToken(); 31705 } 31706 subrs[index] = encoded; 31707 } 31708 break; 31709 case "BlueValues": 31710 case "OtherBlues": 31711 case "FamilyBlues": 31712 case "FamilyOtherBlues": 31713 const blueArray = this.readNumberArray(); 31714 if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) { 31715 privateData.set(token, blueArray); 31716 } 31717 break; 31718 case "StemSnapH": 31719 case "StemSnapV": 31720 privateData.set(token, this.readNumberArray()); 31721 break; 31722 case "StdHW": 31723 case "StdVW": 31724 privateData.set(token, this.readNumberArray()[0]); 31725 break; 31726 case "BlueShift": 31727 case "lenIV": 31728 case "BlueFuzz": 31729 case "BlueScale": 31730 case "LanguageGroup": 31731 privateData.set(token, this.readNumber()); 31732 break; 31733 case "ExpansionFactor": 31734 privateData.set(token, this.readNumber() || 0.06); 31735 break; 31736 case "ForceBold": 31737 privateData.set(token, this.readBoolean()); 31738 break; 31739 } 31740 } 31741 for (const { 31742 encoded, 31743 glyph 31744 } of charstrings) { 31745 const charString = new Type1CharString(); 31746 const error = charString.convert(encoded, subrs, this.seacAnalysisEnabled); 31747 let output = charString.output; 31748 if (error) { 31749 output = [14]; 31750 } 31751 const charStringObject = { 31752 glyphName: glyph, 31753 charstring: output, 31754 width: charString.width, 31755 lsb: charString.lsb, 31756 seac: charString.seac 31757 }; 31758 if (glyph === ".notdef") { 31759 program.charstrings.unshift(charStringObject); 31760 } else { 31761 program.charstrings.push(charStringObject); 31762 } 31763 if (properties.builtInEncoding) { 31764 const index = properties.builtInEncoding.indexOf(glyph); 31765 if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) { 31766 properties.widths[index] = charString.width; 31767 } 31768 } 31769 } 31770 return program; 31771 } 31772 extractFontHeader(properties) { 31773 let token; 31774 while ((token = this.getToken()) !== null) { 31775 if (token !== "/") { 31776 continue; 31777 } 31778 token = this.getToken(); 31779 switch (token) { 31780 case "FontMatrix": 31781 const matrix = this.readNumberArray(); 31782 properties.fontMatrix = matrix; 31783 break; 31784 case "Encoding": 31785 const encodingArg = this.getToken(); 31786 let encoding; 31787 if (!/^\d+$/.test(encodingArg)) { 31788 encoding = getEncoding(encodingArg); 31789 } else { 31790 encoding = []; 31791 const size = parseInt(encodingArg, 10) | 0; 31792 this.getToken(); 31793 for (let j = 0; j < size; j++) { 31794 token = this.getToken(); 31795 while (token !== "dup" && token !== "def") { 31796 token = this.getToken(); 31797 if (token === null) { 31798 return; 31799 } 31800 } 31801 if (token === "def") { 31802 break; 31803 } 31804 const index = this.readInt(); 31805 this.getToken(); 31806 const glyph = this.getToken(); 31807 encoding[index] = glyph; 31808 this.getToken(); 31809 } 31810 } 31811 properties.builtInEncoding = encoding; 31812 break; 31813 case "FontBBox": 31814 const fontBBox = this.readNumberArray(); 31815 properties.ascent = Math.max(fontBBox[3], fontBBox[1]); 31816 properties.descent = Math.min(fontBBox[1], fontBBox[3]); 31817 properties.ascentScaled = true; 31818 break; 31819 } 31820 } 31821 } 31822} 31823 31824;// ./src/core/type1_font.js 31825 31826 31827 31828 31829 31830 31831 31832function findBlock(streamBytes, signature, startIndex) { 31833 const streamBytesLength = streamBytes.length; 31834 const signatureLength = signature.length; 31835 const scanLength = streamBytesLength - signatureLength; 31836 let i = startIndex, 31837 found = false; 31838 while (i < scanLength) { 31839 let j = 0; 31840 while (j < signatureLength && streamBytes[i + j] === signature[j]) { 31841 j++; 31842 } 31843 if (j >= signatureLength) { 31844 i += j; 31845 while (i < streamBytesLength && isWhiteSpace(streamBytes[i])) { 31846 i++; 31847 } 31848 found = true; 31849 break; 31850 } 31851 i++; 31852 } 31853 return { 31854 found, 31855 length: i 31856 }; 31857} 31858function getHeaderBlock(stream, suggestedLength) { 31859 const EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63]; 31860 const streamStartPos = stream.pos; 31861 let headerBytes, headerBytesLength, block; 31862 try { 31863 headerBytes = stream.getBytes(suggestedLength); 31864 headerBytesLength = headerBytes.length; 31865 } catch {} 31866 if (headerBytesLength === suggestedLength) { 31867 block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length); 31868 if (block.found && block.length === suggestedLength) { 31869 return { 31870 stream: new Stream(headerBytes), 31871 length: suggestedLength 31872 }; 31873 } 31874 } 31875 warn('Invalid "Length1" property in Type1 font -- trying to recover.'); 31876 stream.pos = streamStartPos; 31877 const SCAN_BLOCK_LENGTH = 2048; 31878 let actualLength; 31879 while (true) { 31880 const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH); 31881 block = findBlock(scanBytes, EEXEC_SIGNATURE, 0); 31882 if (block.length === 0) { 31883 break; 31884 } 31885 stream.pos += block.length; 31886 if (block.found) { 31887 actualLength = stream.pos - streamStartPos; 31888 break; 31889 } 31890 } 31891 stream.pos = streamStartPos; 31892 if (actualLength) { 31893 return { 31894 stream: new Stream(stream.getBytes(actualLength)), 31895 length: actualLength 31896 }; 31897 } 31898 warn('Unable to recover "Length1" property in Type1 font -- using as is.'); 31899 return { 31900 stream: new Stream(stream.getBytes(suggestedLength)), 31901 length: suggestedLength 31902 }; 31903} 31904function getEexecBlock(stream, suggestedLength) { 31905 const eexecBytes = stream.getBytes(); 31906 if (eexecBytes.length === 0) { 31907 throw new FormatError("getEexecBlock - no font program found."); 31908 } 31909 return { 31910 stream: new Stream(eexecBytes), 31911 length: eexecBytes.length 31912 }; 31913} 31914class Type1Font { 31915 #rawFileLength; 31916 constructor(name, file, properties) { 31917 const PFB_HEADER_SIZE = 6; 31918 let headerBlockLength = properties.length1; 31919 let eexecBlockLength = properties.length2; 31920 let pfbHeader = file.peekBytes(PFB_HEADER_SIZE); 31921 const pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01; 31922 if (pfbHeaderPresent) { 31923 file.skip(PFB_HEADER_SIZE); 31924 headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2]; 31925 } 31926 const headerBlock = getHeaderBlock(file, headerBlockLength); 31927 const headerBlockParser = new Type1Parser(headerBlock.stream, false, SEAC_ANALYSIS_ENABLED); 31928 headerBlockParser.extractFontHeader(properties); 31929 if (pfbHeaderPresent) { 31930 pfbHeader = file.getBytes(PFB_HEADER_SIZE); 31931 eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2]; 31932 } 31933 const eexecBlock = getEexecBlock(file, eexecBlockLength); 31934 const eexecBlockParser = new Type1Parser(eexecBlock.stream, true, SEAC_ANALYSIS_ENABLED); 31935 const data = eexecBlockParser.extractFontProgram(properties); 31936 for (const key in data.properties) { 31937 properties[key] = data.properties[key]; 31938 } 31939 this.#rawFileLength = headerBlock.length + eexecBlock.length; 31940 const charstrings = data.charstrings; 31941 const type2Charstrings = this.getType2Charstrings(charstrings); 31942 const subrs = this.getType2Subrs(data.subrs); 31943 this.charstrings = charstrings; 31944 this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties); 31945 this.seacs = this.getSeacs(data.charstrings); 31946 } 31947 get numGlyphs() { 31948 return this.charstrings.length + 1; 31949 } 31950 getCharset() { 31951 const charset = [".notdef"]; 31952 for (const { 31953 glyphName 31954 } of this.charstrings) { 31955 charset.push(glyphName); 31956 } 31957 return charset; 31958 } 31959 getGlyphMapping(properties) { 31960 const charstrings = this.charstrings; 31961 if (properties.composite) { 31962 const charCodeToGlyphId = Object.create(null); 31963 for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) {
vendor: 34,327 bytes, lines 31964-33072
31964 const charCode = properties.cMap.charCodeOf(glyphId); 31965 charCodeToGlyphId[charCode] = glyphId + 1; 31966 } 31967 return charCodeToGlyphId; 31968 } 31969 const glyphNames = [".notdef"]; 31970 let builtInEncoding, glyphId; 31971 for (glyphId = 0; glyphId < charstrings.length; glyphId++) { 31972 glyphNames.push(charstrings[glyphId].glyphName); 31973 } 31974 const encoding = properties.builtInEncoding; 31975 if (encoding) { 31976 builtInEncoding = Object.create(null); 31977 for (const charCode in encoding) { 31978 glyphId = glyphNames.indexOf(encoding[charCode]); 31979 if (glyphId >= 0) { 31980 builtInEncoding[charCode] = glyphId; 31981 } 31982 } 31983 } 31984 return type1FontGlyphMapping(properties, builtInEncoding, glyphNames); 31985 } 31986 hasGlyphId(id) { 31987 if (id < 0 || id >= this.numGlyphs) { 31988 return false; 31989 } 31990 if (id === 0) { 31991 return true; 31992 } 31993 const glyph = this.charstrings[id - 1]; 31994 return glyph.charstring.length > 0; 31995 } 31996 getSeacs(charstrings) { 31997 const seacMap = []; 31998 for (let i = 0, ii = charstrings.length; i < ii; i++) { 31999 const charstring = charstrings[i]; 32000 if (charstring.seac) { 32001 seacMap[i + 1] = charstring.seac; 32002 } 32003 } 32004 return seacMap; 32005 } 32006 getType2Charstrings(type1Charstrings) { 32007 const type2Charstrings = []; 32008 for (const type1Charstring of type1Charstrings) { 32009 type2Charstrings.push(type1Charstring.charstring); 32010 } 32011 return type2Charstrings; 32012 } 32013 getType2Subrs(type1Subrs) { 32014 let bias = 0; 32015 const count = type1Subrs.length; 32016 if (count < 1133) { 32017 bias = 107; 32018 } else if (count < 33769) { 32019 bias = 1131; 32020 } else { 32021 bias = 32768; 32022 } 32023 const type2Subrs = []; 32024 let i; 32025 for (i = 0; i < bias; i++) { 32026 type2Subrs.push([0x0b]); 32027 } 32028 for (i = 0; i < count; i++) { 32029 type2Subrs.push(type1Subrs[i]); 32030 } 32031 return type2Subrs; 32032 } 32033 wrap(name, glyphs, charstrings, subrs, properties) { 32034 const cff = new CFF(this.#rawFileLength); 32035 cff.header = new CFFHeader(1, 0, 4, 4); 32036 cff.names = [name]; 32037 const topDict = new CFFTopDict(); 32038 topDict.setByName("version", 391); 32039 topDict.setByName("Notice", 392); 32040 topDict.setByName("FullName", 393); 32041 topDict.setByName("FamilyName", 394); 32042 topDict.setByName("Weight", 395); 32043 topDict.setByName("Encoding", null); 32044 topDict.setByName("FontMatrix", properties.fontMatrix); 32045 topDict.setByName("FontBBox", properties.bbox); 32046 topDict.setByName("charset", null); 32047 topDict.setByName("CharStrings", null); 32048 topDict.setByName("Private", null); 32049 cff.topDict = topDict; 32050 const strings = new CFFStrings(); 32051 strings.add("Version 0.11"); 32052 strings.add("See original notice"); 32053 strings.add(name); 32054 strings.add(name); 32055 strings.add("Medium"); 32056 cff.strings = strings; 32057 cff.globalSubrIndex = new CFFIndex(); 32058 const count = glyphs.length; 32059 const charsetArray = [".notdef"]; 32060 for (let i = 0; i < count; i++) { 32061 const { 32062 glyphName 32063 } = charstrings[i]; 32064 const index = CFFStandardStrings.indexOf(glyphName); 32065 if (index === -1) { 32066 strings.add(glyphName); 32067 } 32068 charsetArray.push(glyphName); 32069 } 32070 cff.charset = new CFFCharset(false, 0, charsetArray); 32071 const charStringsIndex = new CFFIndex(); 32072 charStringsIndex.add([0x8b, 0x0e]); 32073 for (let i = 0; i < count; i++) { 32074 charStringsIndex.add(glyphs[i]); 32075 } 32076 cff.charStrings = charStringsIndex; 32077 const privateDict = new CFFPrivateDict(); 32078 privateDict.setByName("Subrs", null); 32079 const fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"]; 32080 for (const field of fields) { 32081 if (!properties.privateData.has(field)) { 32082 continue; 32083 } 32084 const value = properties.privateData.get(field); 32085 if (Array.isArray(value)) { 32086 for (let j = value.length - 1; j > 0; j--) { 32087 value[j] -= value[j - 1]; 32088 } 32089 } 32090 privateDict.setByName(field, value); 32091 } 32092 cff.topDict.privateDict = privateDict; 32093 const subrIndex = new CFFIndex(); 32094 for (const subr of subrs) { 32095 subrIndex.add(subr); 32096 } 32097 privateDict.subrsIndex = subrIndex; 32098 const compiler = new CFFCompiler(cff); 32099 return compiler.compile(); 32100 } 32101} 32102 32103;// ./src/core/fonts.js 32104 32105 32106 32107 32108 32109 32110 32111 32112 32113 32114 32115 32116 32117 32118 32119 32120 32121 32122 32123 32124 32125 32126 32127 32128 32129 32130 32131 32132 32133 32134 32135 32136 32137 32138 32139 32140 32141 32142 32143 32144 32145 32146const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]]; 32147const PDF_GLYPH_SPACE_UNITS = 1000; 32148const EXPORT_DATA_PROPERTIES = ["ascent", "bbox", "black", "bold", "cssFontInfo", "data", "defaultVMetrics", "defaultWidth", "descent", "disableFontFace", "fallbackName", "fontExtraProperties", "fontMatrix", "isInvalidPDFjsFont", "isType3Font", "italic", "loadedName", "mimetype", "missingFile", "name", "remeasure", "systemFontInfo", "vertical"]; 32149const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "composite", "defaultEncoding", "differences", "isMonospace", "isSerifFont", "isSymbolicFont", "seacMap", "subtype", "toFontChar", "toUnicode", "type", "vmetrics", "widths"]; 32150function adjustWidths(properties) { 32151 if (!properties.fontMatrix) { 32152 return; 32153 } 32154 if (properties.fontMatrix[0] === FONT_IDENTITY_MATRIX[0]) { 32155 return; 32156 } 32157 const scale = 0.001 / properties.fontMatrix[0]; 32158 const glyphsWidths = properties.widths; 32159 for (const glyph in glyphsWidths) { 32160 glyphsWidths[glyph] *= scale; 32161 } 32162 properties.defaultWidth *= scale; 32163} 32164function adjustTrueTypeToUnicode(properties, isSymbolicFont, nameRecords) { 32165 if (properties.isInternalFont) { 32166 return; 32167 } 32168 if (properties.hasIncludedToUnicodeMap) { 32169 return; 32170 } 32171 if (properties.hasEncoding) { 32172 return; 32173 } 32174 if (properties.toUnicode instanceof IdentityToUnicodeMap) { 32175 return; 32176 } 32177 if (!isSymbolicFont) { 32178 return; 32179 } 32180 if (nameRecords.length === 0) { 32181 return; 32182 } 32183 if (properties.defaultEncoding === WinAnsiEncoding) { 32184 return; 32185 } 32186 for (const r of nameRecords) { 32187 if (!isWinNameRecord(r)) { 32188 return; 32189 } 32190 } 32191 const encoding = WinAnsiEncoding; 32192 const toUnicode = [], 32193 glyphsUnicodeMap = getGlyphsUnicode(); 32194 for (const charCode in encoding) { 32195 const glyphName = encoding[charCode]; 32196 if (glyphName === "") { 32197 continue; 32198 } 32199 const unicode = glyphsUnicodeMap[glyphName]; 32200 if (unicode === undefined) { 32201 continue; 32202 } 32203 toUnicode[charCode] = String.fromCharCode(unicode); 32204 } 32205 if (toUnicode.length > 0) { 32206 properties.toUnicode.amend(toUnicode); 32207 } 32208} 32209function adjustType1ToUnicode(properties, builtInEncoding) { 32210 if (properties.isInternalFont) { 32211 return; 32212 } 32213 if (properties.hasIncludedToUnicodeMap) { 32214 return; 32215 } 32216 if (builtInEncoding === properties.defaultEncoding) { 32217 return; 32218 } 32219 if (properties.toUnicode instanceof IdentityToUnicodeMap) { 32220 return; 32221 } 32222 const toUnicode = [], 32223 glyphsUnicodeMap = getGlyphsUnicode(); 32224 for (const charCode in builtInEncoding) { 32225 if (properties.hasEncoding) { 32226 if (properties.baseEncodingName || properties.differences[charCode] !== undefined) { 32227 continue; 32228 } 32229 } 32230 const glyphName = builtInEncoding[charCode]; 32231 const unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap); 32232 if (unicode !== -1) { 32233 toUnicode[charCode] = String.fromCharCode(unicode); 32234 } 32235 } 32236 if (toUnicode.length > 0) { 32237 properties.toUnicode.amend(toUnicode); 32238 } 32239} 32240function amendFallbackToUnicode(properties) { 32241 if (!properties.fallbackToUnicode) { 32242 return; 32243 } 32244 if (properties.toUnicode instanceof IdentityToUnicodeMap) { 32245 return; 32246 } 32247 const toUnicode = []; 32248 for (const charCode in properties.fallbackToUnicode) { 32249 if (properties.toUnicode.has(charCode)) { 32250 continue; 32251 } 32252 toUnicode[charCode] = properties.fallbackToUnicode[charCode]; 32253 } 32254 if (toUnicode.length > 0) { 32255 properties.toUnicode.amend(toUnicode); 32256 } 32257} 32258class fonts_Glyph { 32259 constructor(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) { 32260 this.originalCharCode = originalCharCode; 32261 this.fontChar = fontChar; 32262 this.unicode = unicode; 32263 this.accent = accent; 32264 this.width = width; 32265 this.vmetric = vmetric; 32266 this.operatorListId = operatorListId; 32267 this.isSpace = isSpace; 32268 this.isInFont = isInFont; 32269 } 32270 get category() { 32271 return shadow(this, "category", getCharUnicodeCategory(this.unicode), true); 32272 } 32273} 32274function int16(b0, b1) { 32275 return (b0 << 8) + b1; 32276} 32277function writeSignedInt16(bytes, index, value) { 32278 bytes[index + 1] = value; 32279 bytes[index] = value >>> 8; 32280} 32281function signedInt16(b0, b1) { 32282 const value = (b0 << 8) + b1; 32283 return value & 1 << 15 ? value - 0x10000 : value; 32284} 32285function writeUint32(bytes, index, value) { 32286 bytes[index + 3] = value & 0xff; 32287 bytes[index + 2] = value >>> 8; 32288 bytes[index + 1] = value >>> 16; 32289 bytes[index] = value >>> 24; 32290} 32291class TrueTypeTableBuilder { 32292 #buf; 32293 #bufLength = 1024; 32294 #hasExactLength = false; 32295 #pos = 0; 32296 #view; 32297 constructor({ 32298 exactLength, 32299 minLength 32300 }) { 32301 this.#hasExactLength = !!exactLength; 32302 this.#initBuf(exactLength || minLength); 32303 } 32304 #initBuf(minLength) { 32305 if (this.#hasExactLength) { 32306 this.#bufLength = minLength; 32307 } else { 32308 while (this.#bufLength < minLength) { 32309 this.#bufLength *= 2; 32310 } 32311 } 32312 const newBuf = new Uint8Array(this.#bufLength); 32313 if (this.#buf) { 32314 newBuf.set(this.#buf, 0); 32315 } 32316 this.#buf = newBuf; 32317 this.#view = new DataView(newBuf.buffer); 32318 } 32319 get data() { 32320 return this.#buf.subarray(0, this.#pos); 32321 } 32322 get length() { 32323 return this.#pos; 32324 } 32325 skip(n) { 32326 this.#pos += n; 32327 } 32328 setArray(arr) { 32329 const newPos = this.#pos + arr.length; 32330 if (!this.#hasExactLength && newPos > this.#bufLength) { 32331 this.#initBuf(newPos); 32332 } 32333 this.#buf.set(arr, this.#pos); 32334 this.#pos = newPos; 32335 } 32336 setInt16(val) { 32337 const newPos = this.#pos + 2; 32338 if (!this.#hasExactLength && newPos > this.#bufLength) { 32339 this.#initBuf(newPos); 32340 } 32341 this.#view.setInt16(this.#pos, val); 32342 this.#pos = newPos; 32343 } 32344 setSafeInt16(val) { 32345 const newPos = this.#pos + 2; 32346 if (!this.#hasExactLength && newPos > this.#bufLength) { 32347 this.#initBuf(newPos); 32348 } 32349 this.#view.setInt16(this.#pos, MathClamp(val, -0x8000, 0x7fff)); 32350 this.#pos = newPos; 32351 } 32352 setInt32(val) { 32353 const newPos = this.#pos + 4; 32354 if (!this.#hasExactLength && newPos > this.#bufLength) { 32355 this.#initBuf(newPos); 32356 } 32357 this.#view.setInt32(this.#pos, val); 32358 this.#pos = newPos; 32359 } 32360} 32361function isTrueTypeFile(file) { 32362 const header = file.peekBytes(4), 32363 str = bytesToString(header); 32364 return str === "\x00\x01\x00\x00" || str === "true"; 32365} 32366function isTrueTypeCollectionFile(file) { 32367 const header = file.peekBytes(4); 32368 return bytesToString(header) === "ttcf"; 32369} 32370function isOpenTypeFile(file) { 32371 const header = file.peekBytes(4); 32372 return bytesToString(header) === "OTTO"; 32373} 32374function isType1File(file) { 32375 const header = file.peekBytes(2); 32376 if (header[0] === 0x25 && header[1] === 0x21) { 32377 return true; 32378 } 32379 if (header[0] === 0x80 && header[1] === 0x01) { 32380 return true; 32381 } 32382 return false; 32383} 32384function isCFFFile(file) { 32385 const header = file.peekBytes(4); 32386 if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) { 32387 return true; 32388 } 32389 return false; 32390} 32391function getFontFileType(file, { 32392 type, 32393 subtype, 32394 composite 32395}) { 32396 let fileType, fileSubtype; 32397 if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) { 32398 fileType = composite ? "CIDFontType2" : "TrueType"; 32399 } else if (isOpenTypeFile(file)) { 32400 fileType = composite ? "CIDFontType2" : "OpenType"; 32401 } else if (isType1File(file)) { 32402 if (composite) { 32403 fileType = "CIDFontType0"; 32404 } else { 32405 fileType = type === "MMType1" ? "MMType1" : "Type1"; 32406 } 32407 } else if (isCFFFile(file)) { 32408 if (composite) { 32409 fileType = "CIDFontType0"; 32410 fileSubtype = "CIDFontType0C"; 32411 } else { 32412 fileType = type === "MMType1" ? "MMType1" : "Type1"; 32413 fileSubtype = "Type1C"; 32414 } 32415 } else { 32416 warn("getFontFileType: Unable to detect correct font file Type/Subtype."); 32417 fileType = type; 32418 fileSubtype = subtype; 32419 } 32420 return [fileType, fileSubtype]; 32421} 32422function applyStandardFontGlyphMap(map, glyphMap) { 32423 for (const charCode in glyphMap) { 32424 map[+charCode] = glyphMap[charCode]; 32425 } 32426} 32427function buildToFontChar(encoding, glyphsUnicodeMap, differences) { 32428 const toFontChar = []; 32429 let unicode; 32430 for (let i = 0, ii = encoding.length; i < ii; i++) { 32431 unicode = getUnicodeForGlyph(encoding[i], glyphsUnicodeMap); 32432 if (unicode !== -1) { 32433 toFontChar[i] = unicode; 32434 } 32435 } 32436 for (const charCode in differences) { 32437 unicode = getUnicodeForGlyph(differences[charCode], glyphsUnicodeMap); 32438 if (unicode !== -1) { 32439 toFontChar[+charCode] = unicode; 32440 } 32441 } 32442 return toFontChar; 32443} 32444function isMacNameRecord(r) { 32445 return r.platform === 1 && r.encoding === 0 && r.language === 0; 32446} 32447function isWinNameRecord(r) { 32448 return r.platform === 3 && r.encoding === 1 && r.language === 0x409; 32449} 32450function convertCidString(charCode, cid, shouldThrow = false) { 32451 switch (cid.length) { 32452 case 1: 32453 return cid.charCodeAt(0); 32454 case 2: 32455 return cid.charCodeAt(0) << 8 | cid.charCodeAt(1); 32456 } 32457 const msg = `Unsupported CID string (charCode ${charCode}): "${cid}".`; 32458 if (shouldThrow) { 32459 throw new FormatError(msg); 32460 } 32461 warn(msg); 32462 return cid; 32463} 32464function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId, toUnicode) { 32465 const newMap = Object.create(null); 32466 const toUnicodeExtraMap = new Map(); 32467 const toFontChar = []; 32468 const usedGlyphIds = new Set(); 32469 let privateUseAreaIndex = 0; 32470 const privateUseOffetStart = PRIVATE_USE_AREAS[privateUseAreaIndex][0]; 32471 let nextAvailableFontCharCode = privateUseOffetStart; 32472 let privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1]; 32473 const isInPrivateArea = code => PRIVATE_USE_AREAS[0][0] <= code && code <= PRIVATE_USE_AREAS[0][1] || PRIVATE_USE_AREAS[1][0] <= code && code <= PRIVATE_USE_AREAS[1][1]; 32474 let LIGATURE_TO_UNICODE = null; 32475 for (const originalCharCode in charCodeToGlyphId) { 32476 let glyphId = charCodeToGlyphId[originalCharCode]; 32477 if (!hasGlyph(glyphId)) { 32478 continue; 32479 } 32480 if (nextAvailableFontCharCode > privateUseOffetEnd) { 32481 privateUseAreaIndex++; 32482 if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) { 32483 warn("Ran out of space in font private use area."); 32484 break; 32485 } 32486 nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0]; 32487 privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1]; 32488 } 32489 const fontCharCode = nextAvailableFontCharCode++; 32490 if (glyphId === 0) { 32491 glyphId = newGlyphZeroId; 32492 } 32493 let unicode = toUnicode.get(originalCharCode); 32494 if (typeof unicode === "string") { 32495 if (unicode.length === 1) { 32496 unicode = unicode.codePointAt(0); 32497 } else { 32498 if (!LIGATURE_TO_UNICODE) { 32499 LIGATURE_TO_UNICODE = new Map(); 32500 for (let i = 0xfb00; i <= 0xfb4f; i++) { 32501 const normalized = String.fromCharCode(i).normalize("NFKD"); 32502 if (normalized.length > 1) { 32503 LIGATURE_TO_UNICODE.set(normalized, i); 32504 } 32505 } 32506 } 32507 unicode = LIGATURE_TO_UNICODE.get(unicode) || unicode.codePointAt(0); 32508 } 32509 } 32510 if (unicode && !isInPrivateArea(unicode) && !usedGlyphIds.has(glyphId)) { 32511 toUnicodeExtraMap.set(unicode, glyphId); 32512 usedGlyphIds.add(glyphId); 32513 } 32514 newMap[fontCharCode] = glyphId; 32515 toFontChar[originalCharCode] = fontCharCode; 32516 } 32517 return { 32518 toFontChar, 32519 charCodeToGlyphId: newMap, 32520 toUnicodeExtraMap, 32521 nextAvailableFontCharCode 32522 }; 32523} 32524function getRanges(glyphs, toUnicodeExtraMap, numGlyphs) { 32525 const codes = []; 32526 for (const charCode in glyphs) { 32527 if (glyphs[charCode] >= numGlyphs) { 32528 continue; 32529 } 32530 codes.push({ 32531 fontCharCode: charCode | 0, 32532 glyphId: glyphs[charCode] 32533 }); 32534 } 32535 if (toUnicodeExtraMap) { 32536 for (const [unicode, glyphId] of toUnicodeExtraMap) { 32537 if (glyphId >= numGlyphs) { 32538 continue; 32539 } 32540 codes.push({ 32541 fontCharCode: unicode, 32542 glyphId 32543 }); 32544 } 32545 } 32546 if (codes.length === 0) { 32547 codes.push({ 32548 fontCharCode: 0, 32549 glyphId: 0 32550 }); 32551 } 32552 codes.sort((a, b) => a.fontCharCode - b.fontCharCode); 32553 const ranges = []; 32554 const length = codes.length; 32555 for (let n = 0; n < length;) { 32556 const start = codes[n].fontCharCode; 32557 const codeIndices = [codes[n].glyphId]; 32558 ++n; 32559 let end = start; 32560 while (n < length && end + 1 === codes[n].fontCharCode) { 32561 codeIndices.push(codes[n].glyphId); 32562 ++end; 32563 ++n; 32564 if (end === 0xffff) { 32565 break; 32566 } 32567 } 32568 ranges.push([start, end, codeIndices]); 32569 } 32570 return ranges; 32571} 32572function createCmapTable(glyphs, toUnicodeExtraMap, numGlyphs) { 32573 const ranges = getRanges(glyphs, toUnicodeExtraMap, numGlyphs); 32574 const numTables = ranges.at(-1)[1] > 0xffff ? 2 : 1; 32575 const cmap = new TrueTypeTableBuilder({ 32576 exactLength: 12 32577 }); 32578 cmap.skip(2); 32579 cmap.setInt16(numTables); 32580 cmap.setArray([0x00, 0x03]); 32581 cmap.setArray([0x00, 0x01]); 32582 cmap.setInt32(4 + numTables * 8); 32583 let i, ii, j, jj; 32584 for (i = ranges.length - 1; i >= 0; --i) { 32585 if (ranges[i][0] <= 0xffff) { 32586 break; 32587 } 32588 } 32589 const bmpLength = i + 1; 32590 if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) { 32591 ranges[i][1] = 0xfffe; 32592 } 32593 const trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0; 32594 const segCount = bmpLength + trailingRangesCount; 32595 const searchParams = OpenTypeFileBuilder.getSearchParams(segCount, 2); 32596 const segmentsLength = bmpLength * 2 + trailingRangesCount * 2; 32597 const startCount = new TrueTypeTableBuilder({ 32598 exactLength: segmentsLength 32599 }), 32600 endCount = new TrueTypeTableBuilder({ 32601 exactLength: segmentsLength 32602 }), 32603 idDeltas = new TrueTypeTableBuilder({ 32604 exactLength: segmentsLength 32605 }), 32606 idRangeOffsets = new TrueTypeTableBuilder({ 32607 exactLength: segmentsLength 32608 }), 32609 glyphsIds = new TrueTypeTableBuilder({}); 32610 let bias = 0; 32611 for (i = 0, ii = bmpLength; i < ii; i++) { 32612 const [start, end, codes] = ranges[i]; 32613 startCount.setInt16(start); 32614 endCount.setInt16(end); 32615 let contiguous = true; 32616 for (j = 1, jj = codes.length; j < jj; ++j) { 32617 if (codes[j] !== codes[j - 1] + 1) { 32618 contiguous = false; 32619 break; 32620 } 32621 } 32622 if (!contiguous) { 32623 const offset = (segCount - i) * 2 + bias * 2; 32624 bias += end - start + 1; 32625 idDeltas.skip(2); 32626 idRangeOffsets.setInt16(offset); 32627 for (j = 0, jj = codes.length; j < jj; ++j) { 32628 glyphsIds.setInt16(codes[j]); 32629 } 32630 } else { 32631 const startCode = codes[0]; 32632 idDeltas.setInt16(startCode - start & 0xffff); 32633 idRangeOffsets.skip(2); 32634 } 32635 } 32636 if (trailingRangesCount > 0) { 32637 endCount.setArray([0xff, 0xff]); 32638 startCount.setArray([0xff, 0xff]); 32639 idDeltas.setArray([0x00, 0x01]); 32640 idRangeOffsets.skip(2); 32641 } 32642 const format314 = new TrueTypeTableBuilder({ 32643 exactLength: 12 + startCount.length + endCount.length + idDeltas.length + idRangeOffsets.length + glyphsIds.length 32644 }); 32645 format314.skip(2); 32646 format314.setInt16(2 * segCount); 32647 format314.setInt16(searchParams.range); 32648 format314.setInt16(searchParams.entry); 32649 format314.setInt16(searchParams.rangeShift); 32650 format314.setArray(endCount.data); 32651 format314.skip(2); 32652 format314.setArray(startCount.data); 32653 format314.setArray(idDeltas.data); 32654 format314.setArray(idRangeOffsets.data); 32655 format314.setArray(glyphsIds.data); 32656 let cmap31012 = null, 32657 format31012 = null, 32658 header31012 = null; 32659 if (numTables > 1) { 32660 cmap31012 = new TrueTypeTableBuilder({ 32661 exactLength: 8 32662 }); 32663 cmap31012.setArray([0x00, 0x03]); 32664 cmap31012.setArray([0x00, 0x0a]); 32665 cmap31012.setInt32(4 + numTables * 8 + 4 + format314.length); 32666 format31012 = new TrueTypeTableBuilder({}); 32667 for (const range of ranges) { 32668 let start = range[0]; 32669 const codes = range[2]; 32670 let code = codes[0]; 32671 for (j = 1, jj = codes.length; j < jj; ++j) { 32672 if (codes[j] !== codes[j - 1] + 1) { 32673 const end = range[0] + j - 1; 32674 format31012.setInt32(start); 32675 format31012.setInt32(end); 32676 format31012.setInt32(code); 32677 start = end + 1; 32678 code = codes[j]; 32679 } 32680 } 32681 format31012.setInt32(start); 32682 format31012.setInt32(range[1]); 32683 format31012.setInt32(code); 32684 } 32685 header31012 = new TrueTypeTableBuilder({ 32686 exactLength: 16 32687 }); 32688 header31012.setArray([0x00, 0x0c]); 32689 header31012.skip(2); 32690 header31012.setInt32(format31012.length + 16); 32691 header31012.skip(4); 32692 header31012.setInt32(format31012.length / 12); 32693 } 32694 const table = new TrueTypeTableBuilder({ 32695 exactLength: 4 + cmap.length + (cmap31012?.length ?? 0) + format314.length + (header31012?.length ?? 0) + (format31012?.length ?? 0) 32696 }); 32697 table.setArray(cmap.data); 32698 table.setArray(cmap31012?.data ?? []); 32699 table.setArray([0x00, 0x04]); 32700 table.setInt16(format314.length + 4); 32701 table.setArray(format314.data); 32702 table.setArray(header31012?.data ?? []); 32703 table.setArray(format31012?.data ?? []); 32704 return table.data; 32705} 32706function validateOS2Table(os2, file) { 32707 file.pos = (file.start || 0) + os2.offset; 32708 const version = file.getUint16(); 32709 file.skip(60); 32710 const selection = file.getUint16(); 32711 if (version < 4 && selection & 0x0300) { 32712 return false; 32713 } 32714 const firstChar = file.getUint16(); 32715 const lastChar = file.getUint16(); 32716 if (firstChar > lastChar) { 32717 return false; 32718 } 32719 file.skip(6); 32720 const usWinAscent = file.getUint16(); 32721 if (usWinAscent === 0) { 32722 return false; 32723 } 32724 os2.data[8] = os2.data[9] = 0; 32725 return true; 32726} 32727function createOS2Table(properties, charstrings, override) { 32728 override ||= { 32729 unitsPerEm: 0, 32730 yMax: 0, 32731 yMin: 0, 32732 ascent: 0, 32733 descent: 0 32734 }; 32735 let ulUnicodeRange1 = 0; 32736 let ulUnicodeRange2 = 0; 32737 let ulUnicodeRange3 = 0; 32738 let ulUnicodeRange4 = 0; 32739 let firstCharIndex = null; 32740 let lastCharIndex = 0; 32741 let position = -1; 32742 if (charstrings) { 32743 for (let code in charstrings) { 32744 code |= 0; 32745 if (firstCharIndex > code || !firstCharIndex) { 32746 firstCharIndex = code; 32747 } 32748 if (lastCharIndex < code) { 32749 lastCharIndex = code; 32750 } 32751 position = getUnicodeRangeFor(code, position); 32752 if (position < 32) { 32753 ulUnicodeRange1 |= 1 << position; 32754 } else if (position < 64) { 32755 ulUnicodeRange2 |= 1 << position - 32; 32756 } else if (position < 96) { 32757 ulUnicodeRange3 |= 1 << position - 64; 32758 } else if (position < 123) { 32759 ulUnicodeRange4 |= 1 << position - 96; 32760 } else { 32761 throw new FormatError("Unicode ranges Bits > 123 are reserved for internal usage"); 32762 } 32763 } 32764 if (lastCharIndex > 0xffff) { 32765 lastCharIndex = 0xffff; 32766 } 32767 } else { 32768 firstCharIndex = 0; 32769 lastCharIndex = 255; 32770 } 32771 const bbox = properties.bbox || [0, 0, 0, 0]; 32772 const unitsPerEm = override.unitsPerEm || (properties.fontMatrix ? 1 / Math.max(...properties.fontMatrix.slice(0, 4).map(Math.abs)) : 1000); 32773 const scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS; 32774 const typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3])); 32775 let typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1])); 32776 if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) { 32777 typoDescent = -typoDescent; 32778 } 32779 const winAscent = override.yMax || typoAscent; 32780 const winDescent = -override.yMin || -typoDescent; 32781 const os2 = new TrueTypeTableBuilder({ 32782 exactLength: 96 32783 }); 32784 os2.setArray([0x00, 0x03]); 32785 os2.setArray([0x02, 0x24]); 32786 os2.setArray([0x01, 0xf4]); 32787 os2.setArray([0x00, 0x05]); 32788 os2.skip(2); 32789 os2.setArray([0x02, 0x8a]); 32790 os2.setArray([0x02, 0xbb]); 32791 os2.skip(2); 32792 os2.setArray([0x00, 0x8c]); 32793 os2.setArray([0x02, 0x8a]); 32794 os2.setArray([0x02, 0xbb]); 32795 os2.skip(2); 32796 os2.setArray([0x01, 0xdf]); 32797 os2.setArray([0x00, 0x31]); 32798 os2.setArray([0x01, 0x02]); 32799 os2.skip(2); 32800 os2.setArray([0x00, 0x00, 0x06, properties.fixedPitch ? 0x09 : 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]); 32801 os2.setInt32(ulUnicodeRange1); 32802 os2.setInt32(ulUnicodeRange2); 32803 os2.setInt32(ulUnicodeRange3); 32804 os2.setInt32(ulUnicodeRange4); 32805 os2.setArray([0x2a, 0x32, 0x31, 0x2a]); 32806 os2.setInt16(properties.italicAngle ? 1 : 0); 32807 os2.setInt16(firstCharIndex || properties.firstChar); 32808 os2.setInt16(lastCharIndex || properties.lastChar); 32809 os2.setInt16(typoAscent); 32810 os2.setInt16(typoDescent); 32811 os2.setArray([0x00, 0x64]); 32812 os2.setInt16(winAscent); 32813 os2.setInt16(winDescent); 32814 os2.skip(4 + 4); 32815 os2.setInt16(properties.xHeight); 32816 os2.setInt16(properties.capHeight); 32817 os2.skip(2); 32818 os2.setInt16(firstCharIndex || properties.firstChar); 32819 os2.setArray([0x00, 0x03]); 32820 return os2.data; 32821} 32822function createPostTable(properties) { 32823 const post = new TrueTypeTableBuilder({ 32824 exactLength: 32 32825 }); 32826 post.setArray([0x00, 0x03, 0x00, 0x00]); 32827 post.setInt32(Math.floor(properties.italicAngle * 2 ** 16)); 32828 post.skip(2 + 2); 32829 post.setInt32(properties.fixedPitch ? 1 : 0); 32830 post.skip(4 + 4 + 4 + 4); 32831 return post.data; 32832} 32833function createPostscriptName(name) { 32834 return name.replaceAll(/[^\x21-\x7E]|[[\](){}<>/%]/g, "").slice(0, 63); 32835} 32836function createNameTable(name, proto) { 32837 proto ||= [[], []]; 32838 const strings = [proto[0][0] || "Original licence", proto[0][1] || name, proto[0][2] || "Unknown", proto[0][3] || "uniqueID", proto[0][4] || name, proto[0][5] || "Version 0.11", proto[0][6] || createPostscriptName(name), proto[0][7] || "Unknown", proto[0][8] || "Unknown", proto[0][9] || "Unknown"]; 32839 const stringsBytes = strings.map(s => stringToBytes(s)); 32840 const stringsUnicodeBytes = new Array(strings.length); 32841 let i, ii, j, jj, str; 32842 for (i = 0, ii = strings.length; i < ii; i++) { 32843 str = proto[1][i] || strings[i]; 32844 const strUnicode = new TrueTypeTableBuilder({ 32845 exactLength: str.length * 2 32846 }); 32847 for (j = 0, jj = str.length; j < jj; j++) { 32848 strUnicode.setInt16(str.charCodeAt(j)); 32849 } 32850 stringsUnicodeBytes[i] = strUnicode.data; 32851 } 32852 const namesBytes = [stringsBytes, stringsUnicodeBytes]; 32853 const platformsBytes = [[0x00, 0x01], [0x00, 0x03]]; 32854 const encodingsBytes = [[0x00, 0x00], [0x00, 0x01]]; 32855 const languagesBytes = [[0x00, 0x00], [0x04, 0x09]]; 32856 const nameRecords = []; 32857 let strOffset = 0; 32858 for (i = 0, ii = platformsBytes.length; i < ii; i++) { 32859 const strs = namesBytes[i]; 32860 for (j = 0, jj = strs.length; j < jj; j++) { 32861 str = strs[j]; 32862 const nameRecord = new TrueTypeTableBuilder({ 32863 exactLength: 6 + platformsBytes[i].length + encodingsBytes[i].length + languagesBytes[i].length 32864 }); 32865 nameRecord.setArray(platformsBytes[i]); 32866 nameRecord.setArray(encodingsBytes[i]); 32867 nameRecord.setArray(languagesBytes[i]); 32868 nameRecord.setInt16(j); 32869 nameRecord.setInt16(str.length); 32870 nameRecord.setInt16(strOffset); 32871 nameRecords.push(nameRecord.data); 32872 strOffset += str.length; 32873 } 32874 } 32875 const namesRecordCount = stringsBytes.length * platformsBytes.length; 32876 const nameTable = new TrueTypeTableBuilder({ 32877 exactLength: 6 + Math.sumPrecise(nameRecords.map(arr => arr.length)) + Math.sumPrecise(stringsBytes.map(arr => arr.length)) + Math.sumPrecise(stringsUnicodeBytes.map(arr => arr.length)) 32878 }); 32879 nameTable.skip(2); 32880 nameTable.setInt16(namesRecordCount); 32881 nameTable.setInt16(namesRecordCount * 12 + 6); 32882 for (const arr of nameRecords) { 32883 nameTable.setArray(arr); 32884 } 32885 for (const arr of stringsBytes) { 32886 nameTable.setArray(arr); 32887 } 32888 for (const arr of stringsUnicodeBytes) { 32889 nameTable.setArray(arr); 32890 } 32891 return nameTable.data; 32892} 32893class Font { 32894 #charsCache = new Map(); 32895 #glyphCache = new Map(); 32896 charProcOperatorList; 32897 constructor(name, file, properties, evaluatorOptions) { 32898 this.name = name; 32899 this.psName = null; 32900 this.mimetype = null; 32901 this.disableFontFace = evaluatorOptions.disableFontFace; 32902 this.fontExtraProperties = evaluatorOptions.fontExtraProperties; 32903 this.loadedName = properties.loadedName; 32904 this.isType3Font = properties.isType3Font; 32905 this.missingFile = false; 32906 this.cssFontInfo = properties.cssFontInfo; 32907 let isSerifFont = !!(properties.flags & FontFlags.Serif); 32908 if (!isSerifFont && !properties.isSimulatedFlags) { 32909 const stdFontMap = getStdFontMap(), 32910 nonStdFontMap = getNonStdFontMap(), 32911 serifFonts = getSerifFonts(); 32912 for (const namePart of name.split("+")) { 32913 let fontName = normalizeFontName(namePart); 32914 fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName; 32915 fontName = fontName.split("-", 1)[0]; 32916 if (serifFonts[fontName]) { 32917 isSerifFont = true; 32918 break; 32919 } 32920 } 32921 } 32922 this.isSerifFont = isSerifFont; 32923 this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic); 32924 this.isMonospace = !!(properties.flags & FontFlags.FixedPitch); 32925 let { 32926 type, 32927 subtype 32928 } = properties; 32929 this.type = type; 32930 this.subtype = subtype; 32931 this.systemFontInfo = properties.systemFontInfo; 32932 const matches = name.match(/^InvalidPDFjsFont_(.*)_\d+$/); 32933 this.isInvalidPDFjsFont = !!matches; 32934 if (this.isInvalidPDFjsFont) { 32935 this.fallbackName = matches[1]; 32936 } else if (this.isMonospace) { 32937 this.fallbackName = "monospace"; 32938 } else if (this.isSerifFont) { 32939 this.fallbackName = "serif"; 32940 } else { 32941 this.fallbackName = "sans-serif"; 32942 } 32943 if (this.systemFontInfo?.guessFallback) { 32944 this.systemFontInfo.guessFallback = false; 32945 this.systemFontInfo.css += `,${this.fallbackName}`; 32946 } 32947 this.differences = properties.differences; 32948 this.widths = properties.widths; 32949 this.defaultWidth = properties.defaultWidth; 32950 this.composite = properties.composite; 32951 this.cMap = properties.cMap; 32952 this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS; 32953 this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS; 32954 this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS; 32955 this.lineHeight = this.ascent - this.descent; 32956 this.fontMatrix = properties.fontMatrix; 32957 this.bbox = properties.bbox; 32958 this.defaultEncoding = properties.defaultEncoding; 32959 this.toUnicode = properties.toUnicode; 32960 this.toFontChar = []; 32961 if (properties.type === "Type3") { 32962 for (let charCode = 0; charCode < 256; charCode++) { 32963 this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode]; 32964 } 32965 return; 32966 } 32967 this.cidEncoding = properties.cidEncoding || ""; 32968 this.vertical = !!properties.vertical; 32969 if (this.vertical) { 32970 this.vmetrics = properties.vmetrics; 32971 this.defaultVMetrics = properties.defaultVMetrics; 32972 } 32973 if (!file || file.isEmpty) { 32974 if (file) { 32975 warn('Font file is empty in "' + name + '" (' + this.loadedName + ")"); 32976 } 32977 this.fallbackToSystemFont(properties); 32978 return; 32979 } 32980 [type, subtype] = getFontFileType(file, properties); 32981 if (type !== this.type || subtype !== this.subtype) { 32982 info("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`); 32983 } 32984 let data; 32985 try { 32986 switch (type) { 32987 case "MMType1": 32988 info("MMType1 font (" + name + "), falling back to Type1."); 32989 case "Type1": 32990 case "CIDFontType0": 32991 this.mimetype = "font/opentype"; 32992 const cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new CFFFont(file, properties) : new Type1Font(name, file, properties); 32993 adjustWidths(properties); 32994 data = this.convert(name, cff, properties); 32995 break; 32996 case "OpenType": 32997 case "TrueType": 32998 case "CIDFontType2": 32999 this.mimetype = "font/opentype"; 33000 data = this.checkAndRepair(name, file, properties); 33001 adjustWidths(properties); 33002 if (this.isOpenType) { 33003 type = "OpenType"; 33004 } 33005 break; 33006 default: 33007 throw new FormatError(`Font ${type} is not supported`); 33008 } 33009 } catch (e) { 33010 warn(e); 33011 this.fallbackToSystemFont(properties); 33012 return; 33013 } 33014 amendFallbackToUnicode(properties); 33015 this.data = data; 33016 this.type = type; 33017 this.subtype = subtype; 33018 this.fontMatrix = properties.fontMatrix; 33019 this.widths = properties.widths; 33020 this.defaultWidth = properties.defaultWidth; 33021 this.toUnicode = properties.toUnicode; 33022 this.seacMap = properties.seacMap; 33023 } 33024 get renderer() { 33025 const renderer = FontRendererFactory.create(this, SEAC_ANALYSIS_ENABLED); 33026 return shadow(this, "renderer", renderer); 33027 } 33028 #getExportData(props) { 33029 const data = Object.create(null); 33030 for (const prop of props) { 33031 const value = this[prop]; 33032 if (value !== undefined) { 33033 data[prop] = value; 33034 } 33035 } 33036 return data; 33037 } 33038 exportData() { 33039 return { 33040 buffer: compileFontInfo(this.#getExportData(EXPORT_DATA_PROPERTIES)), 33041 charProcOperatorList: this.charProcOperatorList, 33042 extra: this.fontExtraProperties ? this.#getExportData(EXPORT_DATA_EXTRA_PROPERTIES) : undefined 33043 }; 33044 } 33045 fallbackToSystemFont(properties) { 33046 this.missingFile = true; 33047 const { 33048 name, 33049 type 33050 } = this; 33051 let fontName = normalizeFontName(name); 33052 const stdFontMap = getStdFontMap(), 33053 nonStdFontMap = getNonStdFontMap(); 33054 const isStandardFont = !!stdFontMap[fontName]; 33055 const isMappedToStandardFont = !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]); 33056 fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName; 33057 const fontBasicMetricsMap = getFontBasicMetrics(); 33058 const metrics = fontBasicMetricsMap[fontName]; 33059 if (metrics) { 33060 if (isNaN(this.ascent)) { 33061 this.ascent = metrics.ascent / PDF_GLYPH_SPACE_UNITS; 33062 } 33063 if (isNaN(this.descent)) { 33064 this.descent = metrics.descent / PDF_GLYPH_SPACE_UNITS; 33065 } 33066 if (isNaN(this.capHeight)) { 33067 this.capHeight = metrics.capHeight / PDF_GLYPH_SPACE_UNITS; 33068 } 33069 } 33070 this.bold = /bold/gi.test(fontName); 33071 this.italic = /oblique|italic/gi.test(fontName); 33072 this.black = /Black/g.test(name);
vendor: 6,583 bytes, lines 33073-33243
33073 const isNarrow = /Narrow/g.test(name); 33074 this.remeasure = (!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0; 33075 if ((isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) { 33076 const cidToGidMap = properties.cidToGidMap; 33077 const map = []; 33078 applyStandardFontGlyphMap(map, getGlyphMapForStandardFonts()); 33079 if (/Arial-?Black/i.test(name)) { 33080 applyStandardFontGlyphMap(map, getSupplementalGlyphMapForArialBlack()); 33081 } else if (/Calibri/i.test(name)) { 33082 applyStandardFontGlyphMap(map, getSupplementalGlyphMapForCalibri()); 33083 } 33084 if (cidToGidMap) { 33085 for (const charCode in map) { 33086 const cid = map[charCode]; 33087 if (cidToGidMap[cid] !== undefined) { 33088 map[+charCode] = cidToGidMap[cid]; 33089 } 33090 } 33091 if (cidToGidMap.length !== this.toUnicode.length && properties.hasIncludedToUnicodeMap && this.toUnicode instanceof IdentityToUnicodeMap) { 33092 this.toUnicode.forEach(function (charCode, unicodeCharCode) { 33093 const cid = map[charCode]; 33094 if (cidToGidMap[cid] === undefined) { 33095 map[+charCode] = unicodeCharCode; 33096 } 33097 }); 33098 } 33099 } 33100 if (!(this.toUnicode instanceof IdentityToUnicodeMap)) { 33101 this.toUnicode.forEach(function (charCode, unicodeCharCode) { 33102 map[+charCode] = unicodeCharCode; 33103 }); 33104 } 33105 this.toFontChar = map; 33106 this.toUnicode = new ToUnicodeMap(map); 33107 } else if (/Symbol/i.test(fontName)) { 33108 this.toFontChar = buildToFontChar(SymbolSetEncoding, getGlyphsUnicode(), this.differences); 33109 } else if (/Dingbats/i.test(fontName)) { 33110 this.toFontChar = buildToFontChar(ZapfDingbatsEncoding, getDingbatsGlyphsUnicode(), this.differences); 33111 } else if (isStandardFont || isMappedToStandardFont) { 33112 const map = buildToFontChar(this.defaultEncoding, getGlyphsUnicode(), this.differences); 33113 if (type === "CIDFontType2" && !this.cidEncoding.startsWith("Identity-") && !(this.toUnicode instanceof IdentityToUnicodeMap)) { 33114 this.toUnicode.forEach(function (charCode, unicodeCharCode) { 33115 map[+charCode] = unicodeCharCode; 33116 }); 33117 } 33118 this.toFontChar = map; 33119 } else { 33120 const glyphsUnicodeMap = getGlyphsUnicode(); 33121 const map = []; 33122 this.toUnicode.forEach((charCode, unicodeCharCode) => { 33123 if (!this.composite) { 33124 const glyphName = this.differences[charCode] || this.defaultEncoding[charCode]; 33125 const unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap); 33126 if (unicode !== -1) { 33127 unicodeCharCode = unicode; 33128 } 33129 } 33130 map[+charCode] = unicodeCharCode; 33131 }); 33132 if (this.composite && this.toUnicode instanceof IdentityToUnicodeMap) { 33133 if (/Tahoma|Verdana/i.test(name)) { 33134 applyStandardFontGlyphMap(map, getGlyphMapForStandardFonts()); 33135 } 33136 } 33137 this.toFontChar = map; 33138 } 33139 amendFallbackToUnicode(properties); 33140 this.loadedName = fontName.split("-", 1)[0]; 33141 } 33142 checkAndRepair(name, font, properties) { 33143 const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "]; 33144 function readTables(file, numTables) { 33145 const tables = Object.create(null); 33146 tables["OS/2"] = null; 33147 tables.cmap = null; 33148 tables.head = null; 33149 tables.hhea = null; 33150 tables.hmtx = null; 33151 tables.maxp = null; 33152 tables.name = null; 33153 tables.post = null; 33154 for (let i = 0; i < numTables; i++) { 33155 const table = readTableEntry(file); 33156 if (!VALID_TABLES.includes(table.tag)) { 33157 continue; 33158 } 33159 if (table.length === 0) { 33160 continue; 33161 } 33162 tables[table.tag] = table; 33163 } 33164 return tables; 33165 } 33166 function readTableEntry(file) { 33167 const tag = file.getString(4); 33168 const checksum = file.getInt32() >>> 0; 33169 const offset = file.getInt32() >>> 0; 33170 const length = file.getInt32() >>> 0; 33171 const previousPosition = file.pos; 33172 file.pos = file.start || 0; 33173 file.skip(offset); 33174 const data = file.getBytes(length); 33175 file.pos = previousPosition; 33176 if (tag === "head") { 33177 data[8] = data[9] = data[10] = data[11] = 0; 33178 data[17] |= 0x20; 33179 } 33180 return { 33181 tag, 33182 checksum, 33183 length, 33184 offset, 33185 data, 33186 view: new DataView(data.buffer, data.byteOffset, data.byteLength) 33187 }; 33188 } 33189 function readOpenTypeHeader(ttf) { 33190 return { 33191 version: ttf.getString(4), 33192 numTables: ttf.getUint16(), 33193 searchRange: ttf.getUint16(), 33194 entrySelector: ttf.getUint16(), 33195 rangeShift: ttf.getUint16() 33196 }; 33197 } 33198 function readTrueTypeCollectionHeader(ttc) { 33199 const ttcTag = ttc.getString(4); 33200 assert(ttcTag === "ttcf", "Must be a TrueType Collection font."); 33201 const majorVersion = ttc.getUint16(); 33202 const minorVersion = ttc.getUint16(); 33203 const numFonts = ttc.getInt32() >>> 0; 33204 const offsetTable = []; 33205 for (let i = 0; i < numFonts; i++) { 33206 offsetTable.push(ttc.getInt32() >>> 0); 33207 } 33208 const header = { 33209 ttcTag, 33210 majorVersion, 33211 minorVersion, 33212 numFonts, 33213 offsetTable 33214 }; 33215 switch (majorVersion) { 33216 case 1: 33217 return header; 33218 case 2: 33219 header.dsigTag = ttc.getInt32() >>> 0; 33220 header.dsigLength = ttc.getInt32() >>> 0; 33221 header.dsigOffset = ttc.getInt32() >>> 0; 33222 return header; 33223 } 33224 throw new FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`); 33225 } 33226 function readTrueTypeCollectionData(ttc, fontName) { 33227 const { 33228 numFonts, 33229 offsetTable 33230 } = readTrueTypeCollectionHeader(ttc); 33231 const fontNameParts = fontName.split("+"); 33232 let fallbackData; 33233 for (let i = 0; i < numFonts; i++) { 33234 ttc.pos = (ttc.start || 0) + offsetTable[i]; 33235 const potentialHeader = readOpenTypeHeader(ttc); 33236 const potentialTables = readTables(ttc, potentialHeader.numTables); 33237 if (!potentialTables.name) { 33238 throw new FormatError('TrueType Collection font must contain a "name" table.'); 33239 } 33240 const [nameTable] = readNameTable(potentialTables.name); 33241 for (let j = 0, jj = nameTable.length; j < jj; j++) { 33242 for (let k = 0, kk = nameTable[j].length; k < kk; k++) { 33243 const nameEntry = nameTable[j][k]
vendor: 6,959 bytes, lines 33243-33454
33243?.replaceAll(/\s/g, ""); 33244 if (!nameEntry) { 33245 continue; 33246 } 33247 if (nameEntry === fontName) { 33248 return { 33249 header: potentialHeader, 33250 tables: potentialTables 33251 }; 33252 } 33253 if (fontNameParts.length < 2) { 33254 continue; 33255 } 33256 for (const part of fontNameParts) { 33257 if (nameEntry === part) { 33258 fallbackData = { 33259 name: part, 33260 header: potentialHeader, 33261 tables: potentialTables 33262 }; 33263 } 33264 } 33265 } 33266 } 33267 } 33268 if (fallbackData) { 33269 warn(`TrueType Collection does not contain "${fontName}" font, ` + `falling back to "${fallbackData.name}" font instead.`); 33270 return { 33271 header: fallbackData.header, 33272 tables: fallbackData.tables 33273 }; 33274 } 33275 throw new FormatError(`TrueType Collection does not contain "${fontName}" font.`); 33276 } 33277 function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) { 33278 if (!cmap) { 33279 warn("No cmap table available."); 33280 return { 33281 platformId: -1, 33282 encodingId: -1, 33283 mappings: [], 33284 hasShortCmap: false 33285 }; 33286 } 33287 let segment; 33288 let start = (file.start || 0) + cmap.offset; 33289 file.pos = start; 33290 file.skip(2); 33291 const numTables = file.getUint16(); 33292 let potentialTable; 33293 let canBreak = false; 33294 for (let i = 0; i < numTables; i++) { 33295 const platformId = file.getUint16(); 33296 const encodingId = file.getUint16(); 33297 const offset = file.getInt32() >>> 0; 33298 let useTable = false; 33299 if (potentialTable?.platformId === platformId && potentialTable?.encodingId === encodingId) { 33300 continue; 33301 } 33302 if (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 3)) { 33303 useTable = true; 33304 } else if (platformId === 1 && encodingId === 0) { 33305 useTable = true; 33306 } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) { 33307 useTable = true; 33308 if (!isSymbolicFont) { 33309 canBreak = true; 33310 } 33311 } else if (isSymbolicFont && platformId === 3 && encodingId === 0) { 33312 useTable = true; 33313 let correctlySorted = true; 33314 if (i < numTables - 1) { 33315 const nextBytes = file.peekBytes(2), 33316 nextPlatformId = int16(nextBytes[0], nextBytes[1]); 33317 if (nextPlatformId < platformId) { 33318 correctlySorted = false; 33319 } 33320 } 33321 if (correctlySorted) { 33322 canBreak = true; 33323 } 33324 } 33325 if (useTable) { 33326 potentialTable = { 33327 platformId, 33328 encodingId, 33329 offset 33330 }; 33331 } 33332 if (canBreak) { 33333 break; 33334 } 33335 } 33336 if (potentialTable) { 33337 file.pos = start + potentialTable.offset; 33338 } 33339 if (!potentialTable || file.peekByte() === -1) { 33340 warn("Could not find a preferred cmap table."); 33341 return { 33342 platformId: -1, 33343 encodingId: -1, 33344 mappings: [], 33345 hasShortCmap: false 33346 }; 33347 } 33348 const format = file.getUint16(); 33349 let hasShortCmap = false; 33350 const mappings = []; 33351 let j, glyphId; 33352 if (format === 0) { 33353 file.skip(2 + 2); 33354 for (j = 0; j < 256; j++) { 33355 const index = file.getByte(); 33356 if (!index) { 33357 continue; 33358 } 33359 mappings.push({ 33360 charCode: j, 33361 glyphId: index 33362 }); 33363 } 33364 hasShortCmap = true; 33365 } else if (format === 2) { 33366 file.skip(2 + 2); 33367 const subHeaderKeys = []; 33368 let maxSubHeaderKey = 0; 33369 for (let i = 0; i < 256; i++) { 33370 const subHeaderKey = file.getUint16() >> 3; 33371 subHeaderKeys.push(subHeaderKey); 33372 maxSubHeaderKey = Math.max(subHeaderKey, maxSubHeaderKey); 33373 } 33374 const subHeaders = []; 33375 for (let i = 0; i <= maxSubHeaderKey; i++) { 33376 subHeaders.push({ 33377 firstCode: file.getUint16(), 33378 entryCount: file.getUint16(), 33379 idDelta: signedInt16(file.getByte(), file.getByte()), 33380 idRangePos: file.pos + file.getUint16() 33381 }); 33382 } 33383 for (let i = 0; i < 256; i++) { 33384 if (subHeaderKeys[i] === 0) { 33385 file.pos = subHeaders[0].idRangePos + 2 * i; 33386 glyphId = file.getUint16(); 33387 mappings.push({ 33388 charCode: i, 33389 glyphId 33390 }); 33391 } else { 33392 const s = subHeaders[subHeaderKeys[i]]; 33393 for (j = 0; j < s.entryCount; j++) { 33394 const charCode = (i << 8) + j + s.firstCode; 33395 file.pos = s.idRangePos + 2 * j; 33396 glyphId = file.getUint16(); 33397 if (glyphId !== 0) { 33398 glyphId = (glyphId + s.idDelta) % 65536; 33399 } 33400 mappings.push({ 33401 charCode, 33402 glyphId 33403 }); 33404 } 33405 } 33406 } 33407 } else if (format === 4) { 33408 file.skip(2 + 2); 33409 const segCount = file.getUint16() >> 1; 33410 file.skip(6); 33411 const segments = []; 33412 let segIndex; 33413 for (segIndex = 0; segIndex < segCount; segIndex++) { 33414 segments.push({ 33415 end: file.getUint16() 33416 }); 33417 } 33418 file.skip(2); 33419 for (segIndex = 0; segIndex < segCount; segIndex++) { 33420 segments[segIndex].start = file.getUint16(); 33421 } 33422 for (segIndex = 0; segIndex < segCount; segIndex++) { 33423 segments[segIndex].delta = file.getUint16(); 33424 } 33425 let offsetsCount = 0, 33426 offsetIndex; 33427 for (segIndex = 0; segIndex < segCount; segIndex++) { 33428 segment = segments[segIndex]; 33429 const rangeOffset = file.getUint16(); 33430 if (!rangeOffset) { 33431 segment.offsetIndex = -1; 33432 continue; 33433 } 33434 offsetIndex = (rangeOffset >> 1) - (segCount - segIndex); 33435 segment.offsetIndex = offsetIndex; 33436 offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1); 33437 } 33438 const offsets = []; 33439 for (j = 0; j < offsetsCount; j++) { 33440 offsets.push(file.getUint16()); 33441 } 33442 for (segIndex = 0; segIndex < segCount; segIndex++) { 33443 segment = segments[segIndex]; 33444 start = segment.start; 33445 const end = segment.end; 33446 const delta = segment.delta; 33447 offsetIndex = segment.offsetIndex; 33448 for (j = start; j <= end; j++) { 33449 if (j === 0xffff) { 33450 continue; 33451 } 33452 glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start]; 33453 glyphId = glyphId + delta & 0xffff; 33454 mappings.push({
vendor: 6,754 bytes, lines 33455-33663
33455 charCode: j, 33456 glyphId 33457 }); 33458 } 33459 } 33460 } else if (format === 6) { 33461 file.skip(2 + 2); 33462 const firstCode = file.getUint16(); 33463 const entryCount = file.getUint16(); 33464 for (j = 0; j < entryCount; j++) { 33465 glyphId = file.getUint16(); 33466 const charCode = firstCode + j; 33467 mappings.push({ 33468 charCode, 33469 glyphId 33470 }); 33471 } 33472 } else if (format === 12) { 33473 file.skip(2 + 4 + 4); 33474 const nGroups = file.getInt32() >>> 0; 33475 for (j = 0; j < nGroups; j++) { 33476 const startCharCode = file.getInt32() >>> 0; 33477 const endCharCode = file.getInt32() >>> 0; 33478 let glyphCode = file.getInt32() >>> 0; 33479 for (let charCode = startCharCode; charCode <= endCharCode; charCode++) { 33480 mappings.push({ 33481 charCode, 33482 glyphId: glyphCode++ 33483 }); 33484 } 33485 } 33486 } else { 33487 warn("cmap table has unsupported format: " + format); 33488 return { 33489 platformId: -1, 33490 encodingId: -1, 33491 mappings: [], 33492 hasShortCmap: false 33493 }; 33494 } 33495 mappings.sort((a, b) => a.charCode - b.charCode); 33496 const finalMappings = [], 33497 seenCharCodes = new Set(); 33498 for (const map of mappings) { 33499 const { 33500 charCode 33501 } = map; 33502 if (seenCharCodes.has(charCode)) { 33503 continue; 33504 } 33505 seenCharCodes.add(charCode); 33506 finalMappings.push(map); 33507 } 33508 return { 33509 platformId: potentialTable.platformId, 33510 encodingId: potentialTable.encodingId, 33511 mappings: finalMappings, 33512 hasShortCmap 33513 }; 33514 } 33515 function sanitizeMetrics(file, header, metrics, headTable, numGlyphs, dupFirstEntry) { 33516 if (!header) { 33517 if (metrics) { 33518 metrics.data = null; 33519 } 33520 return; 33521 } 33522 file.pos = (file.start || 0) + header.offset; 33523 file.pos += 4; 33524 file.pos += 2; 33525 file.pos += 2; 33526 file.pos += 2; 33527 file.pos += 2; 33528 file.pos += 2; 33529 file.pos += 2; 33530 file.pos += 2; 33531 file.pos += 2; 33532 file.pos += 2; 33533 const caretOffset = file.getUint16(); 33534 file.pos += 8; 33535 file.pos += 2; 33536 let numOfMetrics = file.getUint16(); 33537 if (caretOffset !== 0) { 33538 const macStyle = int16(headTable.data[44], headTable.data[45]); 33539 if (!(macStyle & 2)) { 33540 header.data[22] = 0; 33541 header.data[23] = 0; 33542 } 33543 } 33544 if (numOfMetrics > numGlyphs) { 33545 info(`The numOfMetrics (${numOfMetrics}) should not be ` + `greater than the numGlyphs (${numGlyphs}).`); 33546 numOfMetrics = numGlyphs; 33547 header.data[34] = (numOfMetrics & 0xff00) >> 8; 33548 header.data[35] = numOfMetrics & 0x00ff; 33549 } 33550 const numOfSidebearings = numGlyphs - numOfMetrics; 33551 const numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1); 33552 if (numMissing > 0) { 33553 const entries = new Uint8Array(metrics.length + numMissing * 2); 33554 entries.set(metrics.data); 33555 if (dupFirstEntry) { 33556 entries[metrics.length] = metrics.data[2]; 33557 entries[metrics.length + 1] = metrics.data[3]; 33558 } 33559 metrics.data = entries; 33560 } 33561 } 33562 function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) { 33563 const glyphProfile = { 33564 length: 0, 33565 sizeOfInstructions: 0 33566 }; 33567 if (sourceStart < 0 || sourceStart >= source.length || sourceEnd > source.length || sourceEnd - sourceStart <= 12) { 33568 return glyphProfile; 33569 } 33570 const glyf = source.subarray(sourceStart, sourceEnd); 33571 const xMin = signedInt16(glyf[2], glyf[3]); 33572 const yMin = signedInt16(glyf[4], glyf[5]); 33573 const xMax = signedInt16(glyf[6], glyf[7]); 33574 const yMax = signedInt16(glyf[8], glyf[9]); 33575 if (xMin > xMax) { 33576 writeSignedInt16(glyf, 2, xMax); 33577 writeSignedInt16(glyf, 6, xMin); 33578 } 33579 if (yMin > yMax) { 33580 writeSignedInt16(glyf, 4, yMax); 33581 writeSignedInt16(glyf, 8, yMin); 33582 } 33583 const contoursCount = signedInt16(glyf[0], glyf[1]); 33584 if (contoursCount < 0) { 33585 if (contoursCount < -1) { 33586 return glyphProfile; 33587 } 33588 dest.set(glyf, destStart); 33589 glyphProfile.length = glyf.length; 33590 return glyphProfile; 33591 } 33592 let i, 33593 j = 10, 33594 flagsCount = 0; 33595 for (i = 0; i < contoursCount; i++) { 33596 const endPoint = glyf[j] << 8 | glyf[j + 1]; 33597 flagsCount = endPoint + 1; 33598 j += 2; 33599 } 33600 const instructionsStart = j; 33601 const instructionsLength = glyf[j] << 8 | glyf[j + 1]; 33602 glyphProfile.sizeOfInstructions = instructionsLength; 33603 j += 2 + instructionsLength; 33604 const instructionsEnd = j; 33605 let coordinatesLength = 0; 33606 for (i = 0; i < flagsCount; i++) { 33607 const flag = glyf[j++]; 33608 if (flag & 0xc0) { 33609 glyf[j - 1] = flag & 0x3f; 33610 } 33611 let xLength = 2; 33612 if (flag & 2) { 33613 xLength = 1; 33614 } else if (flag & 16) { 33615 xLength = 0; 33616 } 33617 let yLength = 2; 33618 if (flag & 4) { 33619 yLength = 1; 33620 } else if (flag & 32) { 33621 yLength = 0; 33622 } 33623 const xyLength = xLength + yLength; 33624 coordinatesLength += xyLength; 33625 if (flag & 8) { 33626 const repeat = glyf[j++]; 33627 if (repeat === 0) { 33628 glyf[j - 1] ^= 8; 33629 } 33630 i += repeat; 33631 coordinatesLength += repeat * xyLength; 33632 } 33633 } 33634 if (coordinatesLength === 0) { 33635 return glyphProfile; 33636 } 33637 let glyphDataLength = j + coordinatesLength; 33638 if (glyphDataLength > glyf.length) { 33639 return glyphProfile; 33640 } 33641 if (!hintsValid && instructionsLength > 0) { 33642 dest.set(glyf.subarray(0, instructionsStart), destStart); 33643 dest.set([0, 0], destStart + instructionsStart); 33644 dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2); 33645 glyphDataLength -= instructionsLength; 33646 if (glyf.length - glyphDataLength > 3) { 33647 glyphDataLength = glyphDataLength + 3 & ~3; 33648 } 33649 glyphProfile.length = glyphDataLength; 33650 return glyphProfile; 33651 } 33652 if (glyf.length - glyphDataLength > 3) { 33653 glyphDataLength = glyphDataLength + 3 & ~3; 33654 dest.set(glyf.subarray(0, glyphDataLength), destStart); 33655 glyphProfile.length = glyphDataLength; 33656 return glyphProfile; 33657 } 33658 dest.set(glyf, destStart); 33659 glyphProfile.length = glyf.length; 33660 return glyphProfile; 33661 } 33662 function sanitizeHead(head, numGlyphs, locaLength) { 33663 const
vendor: 3,608 bytes, lines 33663-33759
33663{ 33664 data, 33665 view 33666 } = head; 33667 const version = view.getInt32(0); 33668 if (version >> 16 !== 1) { 33669 info("Attempting to fix invalid version in head table: " + version); 33670 view.setInt32(0, 0x00010000); 33671 } 33672 const indexToLocFormat = signedInt16(data[50], data[51]); 33673 if (indexToLocFormat < 0 || indexToLocFormat > 1) { 33674 info("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat); 33675 const numGlyphsPlusOne = numGlyphs + 1; 33676 if (locaLength === numGlyphsPlusOne << 1) { 33677 data[50] = 0; 33678 data[51] = 0; 33679 } else if (locaLength === numGlyphsPlusOne << 2) { 33680 data[50] = 0; 33681 data[51] = 1; 33682 } else { 33683 throw new FormatError("Could not fix indexToLocFormat: " + indexToLocFormat); 33684 } 33685 } 33686 } 33687 function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) { 33688 let itemSize, itemDecode, itemEncode; 33689 if (isGlyphLocationsLong) { 33690 itemSize = 4; 33691 itemDecode = function fontItemDecodeLong(data, offset) { 33692 return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]; 33693 }; 33694 itemEncode = function fontItemEncodeLong(data, offset, value) { 33695 data[offset] = value >>> 24 & 0xff; 33696 data[offset + 1] = value >> 16 & 0xff; 33697 data[offset + 2] = value >> 8 & 0xff; 33698 data[offset + 3] = value & 0xff; 33699 }; 33700 } else { 33701 itemSize = 2; 33702 itemDecode = function fontItemDecode(data, offset) { 33703 return data[offset] << 9 | data[offset + 1] << 1; 33704 }; 33705 itemEncode = function fontItemEncode(data, offset, value) { 33706 data[offset] = value >> 9 & 0xff; 33707 data[offset + 1] = value >> 1 & 0xff; 33708 }; 33709 } 33710 const numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs; 33711 const locaDataSize = itemSize * (1 + numGlyphsOut); 33712 const locaData = new Uint8Array(locaDataSize); 33713 locaData.set(loca.data.subarray(0, locaDataSize)); 33714 loca.data = locaData; 33715 const oldGlyfData = glyf.data; 33716 const oldGlyfDataLength = oldGlyfData.length; 33717 const newGlyfData = new Uint8Array(oldGlyfDataLength); 33718 let i, j; 33719 const locaEntries = []; 33720 for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) { 33721 let offset = itemDecode(locaData, j); 33722 if (offset > oldGlyfDataLength) { 33723 offset = oldGlyfDataLength; 33724 } 33725 locaEntries.push({ 33726 index: i, 33727 offset, 33728 endOffset: 0 33729 }); 33730 } 33731 locaEntries.sort((a, b) => a.offset - b.offset); 33732 for (i = 0; i < numGlyphs; i++) { 33733 locaEntries[i].endOffset = locaEntries[i + 1].offset; 33734 } 33735 locaEntries.sort((a, b) => a.index - b.index); 33736 for (i = 0; i < numGlyphs; i++) { 33737 const { 33738 offset, 33739 endOffset 33740 } = locaEntries[i]; 33741 if (offset !== 0 || endOffset !== 0) { 33742 break; 33743 } 33744 const nextOffset = locaEntries[i + 1].offset; 33745 if (nextOffset === 0) { 33746 continue; 33747 } 33748 locaEntries[i].endOffset = nextOffset; 33749 break; 33750 } 33751 const last = locaEntries.at(-2); 33752 if (last.offset !== 0 && last.endOffset === 0) { 33753 last.endOffset = oldGlyfDataLength; 33754 } 33755 const missingGlyphs = Object.create(null); 33756 let writeOffset = 0; 33757 itemEncode(locaData, 0, writeOffset); 33758 for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) { 33759 const glyphProfile =
vendor: 13,573 bytes, lines 33759-34161
33759 sanitizeGlyph(oldGlyfData, locaEntries[i].offset, locaEntries[i].endOffset, newGlyfData, writeOffset, hintsValid); 33760 const newLength = glyphProfile.length; 33761 if (newLength === 0) { 33762 missingGlyphs[i] = true; 33763 } 33764 if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) { 33765 maxSizeOfInstructions = glyphProfile.sizeOfInstructions; 33766 } 33767 writeOffset += newLength; 33768 itemEncode(locaData, j, writeOffset); 33769 } 33770 if (writeOffset === 0) { 33771 const simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]); 33772 for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) { 33773 itemEncode(locaData, j, simpleGlyph.length); 33774 } 33775 glyf.data = simpleGlyph; 33776 } else if (dupFirstEntry) { 33777 const firstEntryLength = itemDecode(locaData, itemSize); 33778 if (newGlyfData.length > firstEntryLength + writeOffset) { 33779 glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset); 33780 } else { 33781 glyf.data = new Uint8Array(firstEntryLength + writeOffset); 33782 glyf.data.set(newGlyfData.subarray(0, writeOffset)); 33783 } 33784 glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset); 33785 itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength); 33786 } else { 33787 glyf.data = newGlyfData.subarray(0, writeOffset); 33788 } 33789 return { 33790 missingGlyphs, 33791 maxSizeOfInstructions 33792 }; 33793 } 33794 function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) { 33795 const start = (font.start || 0) + post.offset; 33796 font.pos = start; 33797 const length = post.length, 33798 end = start + length; 33799 const version = font.getInt32(); 33800 font.skip(28); 33801 let glyphNames; 33802 let valid = true; 33803 let i; 33804 switch (version) { 33805 case 0x00010000: 33806 glyphNames = MacStandardGlyphOrdering; 33807 break; 33808 case 0x00020000: 33809 const numGlyphs = font.getUint16(); 33810 if (numGlyphs !== maxpNumGlyphs) { 33811 valid = false; 33812 break; 33813 } 33814 const glyphNameIndexes = []; 33815 for (i = 0; i < numGlyphs; ++i) { 33816 const index = font.getUint16(); 33817 if (index >= 32768) { 33818 valid = false; 33819 break; 33820 } 33821 glyphNameIndexes.push(index); 33822 } 33823 if (!valid) { 33824 break; 33825 } 33826 const customNames = []; 33827 while (font.pos < end) { 33828 const strLen = font.getByte(), 33829 str = font.getString(strLen); 33830 customNames.push(str); 33831 } 33832 glyphNames = []; 33833 for (i = 0; i < numGlyphs; ++i) { 33834 const j = glyphNameIndexes[i]; 33835 if (j < 258) { 33836 glyphNames.push(MacStandardGlyphOrdering[j]); 33837 continue; 33838 } 33839 glyphNames.push(customNames[j - 258]); 33840 } 33841 break; 33842 case 0x00030000: 33843 break; 33844 default: 33845 warn("Unknown/unsupported post table version " + version); 33846 valid = false; 33847 if (propertiesObj.defaultEncoding) { 33848 glyphNames = propertiesObj.defaultEncoding; 33849 } 33850 break; 33851 } 33852 propertiesObj.glyphNames = glyphNames; 33853 return valid; 33854 } 33855 function readNameTable(nameTable) { 33856 const start = (font.start || 0) + nameTable.offset; 33857 font.pos = start; 33858 const names = [[], []], 33859 records = []; 33860 const length = nameTable.length, 33861 end = start + length; 33862 const format = font.getUint16(); 33863 const FORMAT_0_HEADER_LENGTH = 6; 33864 if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) { 33865 return [names, records]; 33866 } 33867 const numRecords = font.getUint16(); 33868 const stringsStart = font.getUint16(); 33869 const NAME_RECORD_LENGTH = 12; 33870 let i, ii; 33871 for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) { 33872 const r = { 33873 platform: font.getUint16(), 33874 encoding: font.getUint16(), 33875 language: font.getUint16(), 33876 name: font.getUint16(), 33877 length: font.getUint16(), 33878 offset: font.getUint16() 33879 }; 33880 if (isMacNameRecord(r) || isWinNameRecord(r)) { 33881 records.push(r); 33882 } 33883 } 33884 for (i = 0, ii = records.length; i < ii; i++) { 33885 const record = records[i]; 33886 if (record.length <= 0) { 33887 continue; 33888 } 33889 const pos = start + stringsStart + record.offset; 33890 if (pos + record.length > end) { 33891 continue; 33892 } 33893 font.pos = pos; 33894 const nameIndex = record.name; 33895 if (record.encoding) { 33896 let str = ""; 33897 for (let j = 0, jj = record.length; j < jj; j += 2) { 33898 str += String.fromCharCode(font.getUint16()); 33899 } 33900 names[1][nameIndex] = str; 33901 } else { 33902 names[0][nameIndex] = font.getString(record.length); 33903 } 33904 } 33905 return [names, records]; 33906 } 33907 const TTOpsStackDeltas = [0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, 0, 0, -2, -5, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, -1, -1, 1, -1, -999, 0, 1, 0, -1, -2, 0, -1, -2, -1, -1, 0, -1, -1, 0, 0, -999, -999, -1, -1, -1, -1, -2, -999, -2, -2, -999, 0, -2, -2, 0, 0, -2, 0, -2, 0, 0, 0, -2, -1, -1, 1, 1, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, 0, -999, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -999, -999, -999, -999, -999, -1, -1, -2, -2, 0, 0, 0, 0, -1, -1, -999, -2, -2, 0, 0, -1, -2, -2, 0, 0, 0, -1, -1, -1, -2]; 33908 function sanitizeTTProgram(table, ttContext) { 33909 let data = table.data; 33910 let i = 0, 33911 j, 33912 n, 33913 b, 33914 funcId, 33915 pc, 33916 lastEndf = 0, 33917 lastDeff = 0; 33918 const stack = []; 33919 const callstack = []; 33920 const functionsCalled = []; 33921 let tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions; 33922 let inFDEF = false, 33923 ifLevel = 0, 33924 inELSE = 0; 33925 for (let ii = data.length; i < ii;) { 33926 const op = data[i++]; 33927 if (op === 0x40) { 33928 n = data[i++]; 33929 if (inFDEF || inELSE) { 33930 i += n; 33931 } else { 33932 for (j = 0; j < n; j++) { 33933 stack.push(data[i++]); 33934 } 33935 } 33936 } else if (op === 0x41) { 33937 n = data[i++]; 33938 if (inFDEF || inELSE) { 33939 i += n * 2; 33940 } else { 33941 for (j = 0; j < n; j++) { 33942 b = data[i++]; 33943 stack.push(signedInt16(b, data[i++])); 33944 } 33945 } 33946 } else if ((op & 0xf8) === 0xb0) { 33947 n = op - 0xb0 + 1; 33948 if (inFDEF || inELSE) { 33949 i += n; 33950 } else { 33951 for (j = 0; j < n; j++) { 33952 stack.push(data[i++]); 33953 } 33954 } 33955 } else if ((op & 0xf8) === 0xb8) { 33956 n = op - 0xb8 + 1; 33957 if (inFDEF || inELSE) { 33958 i += n * 2; 33959 } else { 33960 for (j = 0; j < n; j++) { 33961 b = data[i++]; 33962 stack.push(signedInt16(b, data[i++])); 33963 } 33964 } 33965 } else if (op === 0x2b && !tooComplexToFollowFunctions) { 33966 if (!inFDEF && !inELSE) { 33967 funcId = stack.at(-1); 33968 if (isNaN(funcId)) { 33969 info("TT: CALL empty stack (or invalid entry)."); 33970 } else { 33971 ttContext.functionsUsed[funcId] = true; 33972 if (funcId in ttContext.functionsStackDeltas) { 33973 const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId]; 33974 if (newStackLength < 0) { 33975 warn("TT: CALL invalid functions stack delta."); 33976 ttContext.hintsValid = false; 33977 return; 33978 } 33979 stack.length = newStackLength; 33980 } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) { 33981 callstack.push({ 33982 data, 33983 i, 33984 stackTop: stack.length - 1 33985 }); 33986 functionsCalled.push(funcId); 33987 pc = ttContext.functionsDefined[funcId]; 33988 if (!pc) { 33989 warn("TT: CALL non-existent function"); 33990 ttContext.hintsValid = false; 33991 return; 33992 } 33993 data = pc.data; 33994 i = pc.i; 33995 } 33996 } 33997 } 33998 } else if (op === 0x2c && !tooComplexToFollowFunctions) { 33999 if (inFDEF || inELSE) { 34000 warn("TT: nested FDEFs not allowed"); 34001 tooComplexToFollowFunctions = true; 34002 } 34003 inFDEF = true; 34004 lastDeff = i; 34005 funcId = stack.pop(); 34006 ttContext.functionsDefined[funcId] = { 34007 data, 34008 i 34009 }; 34010 } else if (op === 0x2d) { 34011 if (inFDEF) { 34012 inFDEF = false; 34013 lastEndf = i; 34014 } else { 34015 pc = callstack.pop(); 34016 if (!pc) { 34017 warn("TT: ENDF bad stack"); 34018 ttContext.hintsValid = false; 34019 return; 34020 } 34021 funcId = functionsCalled.pop(); 34022 data = pc.data; 34023 i = pc.i; 34024 ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop; 34025 } 34026 } else if (op === 0x89) { 34027 if (inFDEF || inELSE) { 34028 warn("TT: nested IDEFs not allowed"); 34029 tooComplexToFollowFunctions = true; 34030 } 34031 inFDEF = true; 34032 lastDeff = i; 34033 } else if (op === 0x58) { 34034 ++ifLevel; 34035 } else if (op === 0x1b) { 34036 inELSE = ifLevel; 34037 } else if (op === 0x59) { 34038 if (inELSE === ifLevel) { 34039 inELSE = 0; 34040 } 34041 --ifLevel; 34042 } else if (op === 0x1c) { 34043 if (!inFDEF && !inELSE) { 34044 const offset = stack.at(-1); 34045 if (offset > 0) { 34046 i += offset - 1; 34047 } 34048 } 34049 } 34050 if (!inFDEF && !inELSE) { 34051 let stackDelta = 0; 34052 if (op <= 0x8e) { 34053 stackDelta = TTOpsStackDeltas[op]; 34054 } else if (op >= 0xc0 && op <= 0xdf) { 34055 stackDelta = -1; 34056 } else if (op >= 0xe0) { 34057 stackDelta = -2; 34058 } 34059 if (op >= 0x71 && op <= 0x75) { 34060 n = stack.pop(); 34061 if (!isNaN(n)) { 34062 stackDelta = -n * 2; 34063 } 34064 } 34065 while (stackDelta < 0 && stack.length > 0) { 34066 stack.pop(); 34067 stackDelta++; 34068 } 34069 while (stackDelta > 0) { 34070 stack.push(NaN); 34071 stackDelta--; 34072 } 34073 } 34074 } 34075 ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions; 34076 const content = [data]; 34077 if (i > data.length) { 34078 content.push(new Uint8Array(i - data.length)); 34079 } 34080 if (lastDeff > lastEndf) { 34081 warn("TT: complementing a missing function tail"); 34082 content.push(new Uint8Array([0x22, 0x2d])); 34083 } 34084 foldTTTable(table, content); 34085 } 34086 function checkInvalidFunctions(ttContext, maxFunctionDefs) { 34087 if (ttContext.tooComplexToFollowFunctions) { 34088 return; 34089 } 34090 if (ttContext.functionsDefined.length > maxFunctionDefs) { 34091 warn("TT: more functions defined than expected"); 34092 ttContext.hintsValid = false; 34093 return; 34094 } 34095 for (let j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) { 34096 if (j > maxFunctionDefs) { 34097 warn("TT: invalid function id: " + j); 34098 ttContext.hintsValid = false; 34099 return; 34100 } 34101 if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) { 34102 warn("TT: undefined function: " + j); 34103 ttContext.hintsValid = false; 34104 return; 34105 } 34106 } 34107 } 34108 function foldTTTable(table, content) { 34109 if (content.length > 1) { 34110 let newLength = 0; 34111 let j, jj; 34112 for (j = 0, jj = content.length; j < jj; j++) { 34113 newLength += content[j].length; 34114 } 34115 newLength = newLength + 3 & ~3; 34116 const result = new Uint8Array(newLength); 34117 let pos = 0; 34118 for (j = 0, jj = content.length; j < jj; j++) { 34119 result.set(content[j], pos); 34120 pos += content[j].length; 34121 } 34122 table.data = result; 34123 table.length = newLength; 34124 } 34125 } 34126 function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) { 34127 const ttContext = { 34128 functionsDefined: [], 34129 functionsUsed: [], 34130 functionsStackDeltas: [], 34131 tooComplexToFollowFunctions: false, 34132 hintsValid: true 34133 }; 34134 if (fpgm) { 34135 sanitizeTTProgram(fpgm, ttContext); 34136 } 34137 if (prep) { 34138 sanitizeTTProgram(prep, ttContext); 34139 } 34140 if (fpgm) { 34141 checkInvalidFunctions(ttContext, maxFunctionDefs); 34142 } 34143 if (cvt && cvt.length & 1) { 34144 const cvtData = new Uint8Array(cvt.length + 1); 34145 cvtData.set(cvt.data); 34146 cvt.data = cvtData; 34147 } 34148 return ttContext.hintsValid; 34149 } 34150 font = new Stream(new Uint8Array(font.getBytes())); 34151 let header, tables; 34152 if (isTrueTypeCollectionFile(font)) { 34153 const ttcData = readTrueTypeCollectionData(font, this.name); 34154 header = ttcData.header; 34155 tables = ttcData.tables; 34156 } else { 34157 header = readOpenTypeHeader(font); 34158 tables = readTables(font, header.numTables); 34159 } 34160 const isTrueType = !tables["CFF "]; 34161
vendor: 4,674 bytes, lines 34161-34286
34161if (!isTrueType) { 34162 if (header.version === "OTTO" && !properties.composite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) { 34163 return this.convert(name, new CFFFont(new Stream(tables["CFF "].data), properties), properties); 34164 } 34165 delete tables.glyf; 34166 delete tables.loca; 34167 delete tables.fpgm; 34168 delete tables.prep; 34169 delete tables["cvt "]; 34170 this.isOpenType = true; 34171 } else { 34172 if (!tables.loca) { 34173 throw new FormatError('Required "loca" table is not found'); 34174 } 34175 if (!tables.glyf) { 34176 warn('Required "glyf" table is not found -- trying to recover.'); 34177 tables.glyf = { 34178 tag: "glyf", 34179 data: new Uint8Array(0) 34180 }; 34181 } 34182 this.isOpenType = false; 34183 } 34184 if (!tables.maxp) { 34185 throw new FormatError('Required "maxp" table is not found'); 34186 } 34187 let numGlyphsFromCFF; 34188 if (!isTrueType) { 34189 try { 34190 const parser = new CFFParser(new Stream(tables["CFF "].data), properties, SEAC_ANALYSIS_ENABLED); 34191 const cff = parser.parse(); 34192 cff.duplicateFirstGlyph(); 34193 const compiler = new CFFCompiler(cff); 34194 tables["CFF "].data = compiler.compile(); 34195 numGlyphsFromCFF = cff.charStringCount; 34196 } catch { 34197 warn("Failed to compile font " + properties.loadedName); 34198 } 34199 } 34200 font.pos = (font.start || 0) + tables.maxp.offset; 34201 let version = font.getInt32(); 34202 const numGlyphs = numGlyphsFromCFF ?? font.getUint16(); 34203 if (version === 0x00005000 && tables.maxp.length !== 6) { 34204 tables.maxp.data = tables.maxp.data.subarray(0, 6); 34205 tables.maxp.length = 6; 34206 } 34207 if (version !== 0x00010000 && version !== 0x00005000) { 34208 if (tables.maxp.length === 6) { 34209 version = 0x0005000; 34210 } else if (tables.maxp.length >= 32) { 34211 version = 0x00010000; 34212 } else { 34213 throw new FormatError(`"maxp" table has a wrong version number`); 34214 } 34215 writeUint32(tables.maxp.data, 0, version); 34216 } 34217 let isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]); 34218 if (tables.loca) { 34219 const locaLength = isGlyphLocationsLong ? (numGlyphs + 1) * 4 : (numGlyphs + 1) * 2; 34220 if (tables.loca.length !== locaLength) { 34221 warn("Incorrect 'loca' table length -- attempting to fix it."); 34222 const sortedTables = Object.values(tables).filter(Boolean).sort((a, b) => a.offset - b.offset); 34223 const locaIndex = sortedTables.indexOf(tables.loca); 34224 const nextTable = sortedTables[locaIndex + 1] || null; 34225 if (nextTable && tables.loca.offset + locaLength < nextTable.offset) { 34226 const previousPos = font.pos; 34227 font.pos = font.start || 0; 34228 font.skip(tables.loca.offset); 34229 tables.loca.data = font.getBytes(locaLength); 34230 tables.loca.length = locaLength; 34231 font.pos = previousPos; 34232 } 34233 } 34234 } 34235 if (properties.scaleFactors?.length === numGlyphs && isTrueType) { 34236 const { 34237 scaleFactors 34238 } = properties; 34239 const glyphs = new GlyfTable({ 34240 glyfTable: tables.glyf.data, 34241 isGlyphLocationsLong, 34242 locaTable: tables.loca.data, 34243 numGlyphs 34244 }); 34245 glyphs.scale(scaleFactors); 34246 const { 34247 glyf, 34248 loca, 34249 isLocationLong 34250 } = glyphs.write(); 34251 tables.glyf.data = glyf; 34252 tables.loca.data = loca; 34253 if (isLocationLong !== !!isGlyphLocationsLong) { 34254 tables.head.data[50] = 0; 34255 isGlyphLocationsLong = tables.head.data[51] = isLocationLong ? 1 : 0; 34256 } 34257 const metrics = tables.hmtx.data; 34258 for (let i = 0; i < numGlyphs; i++) { 34259 const j = 4 * i; 34260 const advanceWidth = Math.round(scaleFactors[i] * int16(metrics[j], metrics[j + 1])); 34261 metrics[j] = advanceWidth >> 8 & 0xff; 34262 metrics[j + 1] = advanceWidth & 0xff; 34263 const lsb = Math.round(scaleFactors[i] * signedInt16(metrics[j + 2], metrics[j + 3])); 34264 writeSignedInt16(metrics, j + 2, lsb); 34265 } 34266 } 34267 let numGlyphsOut = numGlyphs + 1; 34268 let dupFirstEntry = true; 34269 if (numGlyphsOut > 0xffff) { 34270 dupFirstEntry = false; 34271 numGlyphsOut = numGlyphs; 34272 warn("Not enough space in glyfs to duplicate first glyph."); 34273 } 34274 let maxFunctionDefs = 0; 34275 let maxSizeOfInstructions = 0; 34276 if (version >= 0x00010000 && tables.maxp.length >= 32) { 34277 font.pos += 8; 34278 const maxZones = font.getUint16(); 34279 if (maxZones > 2) { 34280 tables.maxp.data[14] = 0; 34281 tables.maxp.data[15] = 2; 34282 } 34283 font.pos += 4; 34284 maxFunctionDefs = font.getUint16(); 34285 font.pos += 4; 34286 maxSizeOfInstructions = font.getUint16()
vendor: 6,814 bytes, lines 34286-34448
34286; 34287 } 34288 tables.maxp.data[4] = numGlyphsOut >> 8; 34289 tables.maxp.data[5] = numGlyphsOut & 255; 34290 const hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs); 34291 if (!hintsValid) { 34292 delete tables.fpgm; 34293 delete tables.prep; 34294 delete tables["cvt "]; 34295 } 34296 sanitizeMetrics(font, tables.hhea, tables.hmtx, tables.head, numGlyphsOut, dupFirstEntry); 34297 if (!tables.head) { 34298 throw new FormatError('Required "head" table is not found'); 34299 } 34300 sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0); 34301 let missingGlyphs = Object.create(null); 34302 if (isTrueType) { 34303 const glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions); 34304 missingGlyphs = glyphsInfo.missingGlyphs; 34305 if (version >= 0x00010000 && tables.maxp.length >= 32) { 34306 tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8; 34307 tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255; 34308 } 34309 } 34310 if (!tables.hhea) { 34311 throw new FormatError('Required "hhea" table is not found'); 34312 } 34313 if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) { 34314 tables.hhea.data[10] = 0xff; 34315 tables.hhea.data[11] = 0xff; 34316 } 34317 const metricsOverride = { 34318 unitsPerEm: int16(tables.head.data[18], tables.head.data[19]), 34319 yMax: signedInt16(tables.head.data[42], tables.head.data[43]), 34320 yMin: signedInt16(tables.head.data[38], tables.head.data[39]), 34321 ascent: signedInt16(tables.hhea.data[4], tables.hhea.data[5]), 34322 descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]), 34323 lineGap: signedInt16(tables.hhea.data[8], tables.hhea.data[9]) 34324 }; 34325 this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm; 34326 this.descent = metricsOverride.descent / metricsOverride.unitsPerEm; 34327 this.lineGap = metricsOverride.lineGap / metricsOverride.unitsPerEm; 34328 if (this.cssFontInfo?.lineHeight) { 34329 this.lineHeight = this.cssFontInfo.metrics.lineHeight; 34330 this.lineGap = this.cssFontInfo.metrics.lineGap; 34331 } else { 34332 this.lineHeight = this.ascent - this.descent + this.lineGap; 34333 } 34334 if (tables.post) { 34335 readPostScriptTable(tables.post, properties, numGlyphs); 34336 } 34337 tables.post = { 34338 tag: "post", 34339 data: createPostTable(properties) 34340 }; 34341 const charCodeToGlyphId = Object.create(null); 34342 function hasGlyph(glyphId) { 34343 return !missingGlyphs[glyphId]; 34344 } 34345 if (properties.composite) { 34346 const cidToGidMap = properties.cidToGidMap || []; 34347 const isCidToGidMapEmpty = cidToGidMap.length === 0; 34348 properties.cMap.forEach(function (charCode, cid) { 34349 if (typeof cid === "string") { 34350 cid = convertCidString(charCode, cid, true); 34351 } 34352 if (cid > 0xffff) { 34353 throw new FormatError("Max size of CID is 65,535"); 34354 } 34355 let glyphId = -1; 34356 if (isCidToGidMapEmpty) { 34357 glyphId = cid; 34358 } else if (cidToGidMap[cid] !== undefined) { 34359 glyphId = cidToGidMap[cid]; 34360 } 34361 if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) { 34362 charCodeToGlyphId[charCode] = glyphId; 34363 } 34364 }); 34365 } else { 34366 const cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding); 34367 const cmapPlatformId = cmapTable.platformId; 34368 const cmapEncodingId = cmapTable.encodingId; 34369 const cmapMappings = cmapTable.mappings; 34370 let baseEncoding = [], 34371 forcePostTable = false; 34372 if (properties.hasEncoding && (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding")) { 34373 baseEncoding = getEncoding(properties.baseEncodingName); 34374 } 34375 if (properties.hasEncoding && !this.isSymbolicFont && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0)) { 34376 const glyphsUnicodeMap = getGlyphsUnicode(); 34377 for (let charCode = 0; charCode < 256; charCode++) { 34378 let glyphName; 34379 if (this.differences[charCode] !== undefined) { 34380 glyphName = this.differences[charCode]; 34381 } else if (baseEncoding.length && baseEncoding[charCode] !== "") { 34382 glyphName = baseEncoding[charCode]; 34383 } else { 34384 glyphName = StandardEncoding[charCode]; 34385 } 34386 if (!glyphName) { 34387 continue; 34388 } 34389 const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap); 34390 let unicodeOrCharCode; 34391 if (cmapPlatformId === 3 && cmapEncodingId === 1) { 34392 unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName]; 34393 } else if (cmapPlatformId === 1 && cmapEncodingId === 0) { 34394 unicodeOrCharCode = MacRomanEncoding.indexOf(standardGlyphName); 34395 } 34396 if (unicodeOrCharCode === undefined) { 34397 if (!properties.glyphNames && properties.hasIncludedToUnicodeMap && !(this.toUnicode instanceof IdentityToUnicodeMap)) { 34398 const unicode = this.toUnicode.get(charCode); 34399 if (unicode) { 34400 unicodeOrCharCode = unicode.codePointAt(0); 34401 } 34402 } 34403 if (unicodeOrCharCode === undefined) { 34404 continue; 34405 } 34406 } 34407 for (const mapping of cmapMappings) { 34408 if (mapping.charCode !== unicodeOrCharCode) { 34409 continue; 34410 } 34411 charCodeToGlyphId[charCode] = mapping.glyphId; 34412 break; 34413 } 34414 } 34415 } else if (cmapPlatformId === 0) { 34416 for (const mapping of cmapMappings) { 34417 charCodeToGlyphId[mapping.charCode] = mapping.glyphId; 34418 } 34419 forcePostTable = true; 34420 } else if (cmapPlatformId === 3 && cmapEncodingId === 0) { 34421 for (const mapping of cmapMappings) { 34422 let charCode = mapping.charCode; 34423 if (charCode >= 0xf000 && charCode <= 0xf0ff) { 34424 charCode &= 0xff; 34425 } 34426 charCodeToGlyphId[charCode] = mapping.glyphId; 34427 } 34428 } else { 34429 for (const mapping of cmapMappings) { 34430 charCodeToGlyphId[mapping.charCode] = mapping.glyphId; 34431 } 34432 } 34433 if (properties.glyphNames && (baseEncoding.length || this.differences.length)) { 34434 for (let i = 0; i < 256; ++i) { 34435 if (!forcePostTable && charCodeToGlyphId[i] !== undefined) { 34436 continue; 34437 } 34438 const glyphName = this.differences[i] || baseEncoding[i]; 34439 if (!glyphName) { 34440 continue; 34441 } 34442 const glyphId = properties.glyphNames.indexOf(glyphName); 34443 if (glyphId > 0 && hasGlyph(glyphId)) { 34444 charCodeToGlyphId[i] = glyphId; 34445 } 34446 } 34447 } 34448
vendor: 3,478 bytes, lines 34448-34541
34448} 34449 if (charCodeToGlyphId.length === 0) { 34450 charCodeToGlyphId[0] = 0; 34451 } 34452 let glyphZeroId = numGlyphsOut - 1; 34453 if (!dupFirstEntry) { 34454 glyphZeroId = 0; 34455 } 34456 if (!properties.cssFontInfo) { 34457 const newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId, this.toUnicode); 34458 this.toFontChar = newMapping.toFontChar; 34459 tables.cmap = { 34460 tag: "cmap", 34461 data: createCmapTable(newMapping.charCodeToGlyphId, newMapping.toUnicodeExtraMap, numGlyphsOut) 34462 }; 34463 if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) { 34464 tables["OS/2"] = { 34465 tag: "OS/2", 34466 data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride) 34467 }; 34468 } 34469 } 34470 if (!tables.name) { 34471 tables.name = { 34472 tag: "name", 34473 data: createNameTable(this.name) 34474 }; 34475 } else { 34476 const [namePrototype, nameRecords] = readNameTable(tables.name); 34477 tables.name.data = createNameTable(name, namePrototype); 34478 this.psName = namePrototype[0][6] || null; 34479 if (!properties.composite) { 34480 adjustTrueTypeToUnicode(properties, this.isSymbolicFont, nameRecords); 34481 } 34482 } 34483 const builder = new OpenTypeFileBuilder(header.version); 34484 for (const tableTag in tables) { 34485 builder.addTable(tableTag, tables[tableTag].data); 34486 } 34487 return builder.toArray(); 34488 } 34489 convert(fontName, font, properties) { 34490 properties.fixedPitch = false; 34491 if (properties.builtInEncoding) { 34492 adjustType1ToUnicode(properties, properties.builtInEncoding); 34493 } 34494 let glyphZeroId = 1; 34495 if (font instanceof CFFFont) { 34496 glyphZeroId = font.numGlyphs - 1; 34497 } 34498 const mapping = font.getGlyphMapping(properties); 34499 let newMapping = null; 34500 let newCharCodeToGlyphId = mapping; 34501 let toUnicodeExtraMap = null; 34502 if (!properties.cssFontInfo) { 34503 newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId, this.toUnicode); 34504 this.toFontChar = newMapping.toFontChar; 34505 newCharCodeToGlyphId = newMapping.charCodeToGlyphId; 34506 toUnicodeExtraMap = newMapping.toUnicodeExtraMap; 34507 } 34508 const numGlyphs = font.numGlyphs; 34509 function getCharCodes(charCodeToGlyphId, glyphId) { 34510 let charCodes = null; 34511 for (const charCode in charCodeToGlyphId) { 34512 if (glyphId === charCodeToGlyphId[charCode]) { 34513 (charCodes ||= []).push(charCode | 0); 34514 } 34515 } 34516 return charCodes; 34517 } 34518 function createCharCode(charCodeToGlyphId, glyphId) { 34519 for (const charCode in charCodeToGlyphId) { 34520 if (glyphId === charCodeToGlyphId[charCode]) { 34521 return charCode | 0; 34522 } 34523 } 34524 newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId; 34525 return newMapping.nextAvailableFontCharCode++; 34526 } 34527 const seacs = font.seacs; 34528 if (newMapping && SEAC_ANALYSIS_ENABLED && seacs?.length) { 34529 const matrix = properties.fontMatrix || FONT_IDENTITY_MATRIX; 34530 const charset = font.getCharset(); 34531 const seacMap = Object.create(null); 34532 for (let glyphId in seacs) { 34533 glyphId |= 0; 34534 const seac = seacs[glyphId]; 34535 const baseGlyphName = StandardEncoding[seac[2]]; 34536 const accentGlyphName = StandardEncoding[seac[3]]; 34537 const baseGlyphId = charset.indexOf(baseGlyphName); 34538 const accentGlyphId = charset.indexOf(accentGlyphName); 34539 if (baseGlyphId < 0 || accentGlyphId < 0) { 34540 continue; 34541 }
vendor: 8,717 bytes, lines 34542-34791
34542 const accentOffset = { 34543 x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4], 34544 y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5] 34545 }; 34546 const charCodes = getCharCodes(mapping, glyphId); 34547 if (!charCodes) { 34548 continue; 34549 } 34550 for (const charCode of charCodes) { 34551 const charCodeToGlyphId = newMapping.charCodeToGlyphId; 34552 const baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId); 34553 const accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId); 34554 seacMap[charCode] = { 34555 baseFontCharCode, 34556 accentFontCharCode, 34557 accentOffset 34558 }; 34559 } 34560 } 34561 properties.seacMap = seacMap; 34562 } 34563 const unitsPerEm = properties.fontMatrix ? 1 / Math.max(...properties.fontMatrix.slice(0, 4).map(Math.abs)) : 1000; 34564 const builder = new OpenTypeFileBuilder("\x4F\x54\x54\x4F"); 34565 builder.addTable("CFF ", font.data); 34566 builder.addTable("OS/2", createOS2Table(properties, newCharCodeToGlyphId)); 34567 builder.addTable("cmap", createCmapTable(newCharCodeToGlyphId, toUnicodeExtraMap, numGlyphs)); 34568 builder.addTable("head", function fontTableHead() { 34569 const dateArr = [0x00, 0x00, 0x00, 0x00, 0x9e, 0x0b, 0x7e, 0x27]; 34570 const head = new TrueTypeTableBuilder({ 34571 exactLength: 54 34572 }); 34573 head.setArray([0x00, 0x01, 0x00, 0x00]); 34574 head.setArray([0x00, 0x00, 0x10, 0x00]); 34575 head.skip(4); 34576 head.setArray([0x5f, 0x0f, 0x3c, 0xf5]); 34577 head.skip(2); 34578 head.setSafeInt16(unitsPerEm); 34579 head.setArray(dateArr); 34580 head.setArray(dateArr); 34581 head.skip(2); 34582 head.setSafeInt16(properties.descent); 34583 head.setArray([0x0f, 0xff]); 34584 head.setSafeInt16(properties.ascent); 34585 head.setInt16(properties.italicAngle ? 2 : 0); 34586 head.setArray([0x00, 0x11]); 34587 head.skip(2 + 2 + 2); 34588 return head.data; 34589 }()); 34590 builder.addTable("hhea", function fontTableHhea() { 34591 const hhea = new TrueTypeTableBuilder({ 34592 exactLength: 36 34593 }); 34594 hhea.setArray([0x00, 0x01, 0x00, 0x00]); 34595 hhea.setSafeInt16(properties.ascent); 34596 hhea.setSafeInt16(properties.descent); 34597 hhea.skip(2); 34598 hhea.setArray([0xff, 0xff]); 34599 hhea.skip(2 + 2 + 2); 34600 hhea.setSafeInt16(properties.capHeight); 34601 hhea.setSafeInt16(Math.tan(properties.italicAngle) * properties.xHeight); 34602 hhea.skip(2 + 2 + 2 + 2 + 2 + 2); 34603 hhea.setInt16(numGlyphs); 34604 return hhea.data; 34605 }()); 34606 builder.addTable("hmtx", function fontTableHmtx() { 34607 const charstrings = font.charstrings; 34608 const cffWidths = font.cff?.widths ?? null; 34609 const hmtx = new TrueTypeTableBuilder({ 34610 exactLength: numGlyphs * 4 34611 }); 34612 hmtx.skip(4); 34613 for (let i = 1, ii = numGlyphs; i < ii; i++) { 34614 let width = 0; 34615 if (charstrings) { 34616 width = charstrings[i - 1].width || 0; 34617 } else if (cffWidths) { 34618 width = Math.ceil(cffWidths[i] || 0); 34619 } 34620 hmtx.setInt16(width); 34621 hmtx.skip(2); 34622 } 34623 return hmtx.data; 34624 }()); 34625 builder.addTable("maxp", function fontTableMaxp() { 34626 const maxp = new TrueTypeTableBuilder({ 34627 exactLength: 6 34628 }); 34629 maxp.setArray([0x00, 0x00, 0x50, 0x00]); 34630 maxp.setInt16(numGlyphs); 34631 return maxp.data; 34632 }()); 34633 builder.addTable("name", createNameTable(fontName)); 34634 builder.addTable("post", createPostTable(properties)); 34635 return builder.toArray(); 34636 } 34637 get _spaceWidth() { 34638 const possibleSpaceReplacements = ["space", "minus", "one", "i", "I"]; 34639 let width; 34640 for (const glyphName of possibleSpaceReplacements) { 34641 if (glyphName in this.widths) { 34642 width = this.widths[glyphName]; 34643 break; 34644 } 34645 const glyphsUnicodeMap = getGlyphsUnicode(); 34646 const glyphUnicode = glyphsUnicodeMap[glyphName]; 34647 let charcode = 0; 34648 if (this.composite && this.cMap.contains(glyphUnicode)) { 34649 charcode = this.cMap.lookup(glyphUnicode); 34650 if (typeof charcode === "string") { 34651 charcode = convertCidString(glyphUnicode, charcode); 34652 } 34653 } 34654 if (!charcode && this.toUnicode) { 34655 charcode = this.toUnicode.charCodeOf(glyphUnicode); 34656 } 34657 if (charcode <= 0) { 34658 charcode = glyphUnicode; 34659 } 34660 width = this.widths[charcode]; 34661 if (width) { 34662 break; 34663 } 34664 } 34665 return shadow(this, "_spaceWidth", width || this.defaultWidth); 34666 } 34667 _charToGlyph(charcode, isSpace = false) { 34668 let glyph = this.#glyphCache.get(charcode); 34669 if (glyph?.isSpace === isSpace) { 34670 return glyph; 34671 } 34672 let fontCharCode, width, operatorListId; 34673 let widthCode = charcode; 34674 if (this.cMap?.contains(charcode)) { 34675 widthCode = this.cMap.lookup(charcode); 34676 if (typeof widthCode === "string") { 34677 widthCode = convertCidString(charcode, widthCode); 34678 } 34679 } 34680 width = this.widths[widthCode]; 34681 if (typeof width !== "number") { 34682 width = this.defaultWidth; 34683 } 34684 const vmetric = this.vmetrics?.[widthCode] || this.defaultVMetrics; 34685 let unicode = this.toUnicode.get(charcode) || charcode; 34686 if (typeof unicode === "number") { 34687 unicode = String.fromCharCode(unicode); 34688 } 34689 let isInFont = this.toFontChar[charcode] !== undefined; 34690 fontCharCode = this.toFontChar[charcode] || charcode; 34691 if (this.missingFile) { 34692 const glyphName = this.differences[charcode] || this.defaultEncoding[charcode]; 34693 if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") { 34694 fontCharCode = 0x20; 34695 if (glyphName === "") { 34696 width ||= this._spaceWidth; 34697 unicode = String.fromCharCode(fontCharCode); 34698 } 34699 } 34700 fontCharCode = mapSpecialUnicodeValues(fontCharCode); 34701 } 34702 if (this.isType3Font) { 34703 operatorListId = fontCharCode; 34704 } 34705 let accent = null; 34706 if (this.seacMap?.[charcode]) { 34707 isInFont = true; 34708 const seac = this.seacMap[charcode]; 34709 fontCharCode = seac.baseFontCharCode; 34710 accent = { 34711 fontChar: String.fromCodePoint(seac.accentFontCharCode), 34712 offset: seac.accentOffset 34713 }; 34714 } 34715 let fontChar = ""; 34716 if (typeof fontCharCode === "number") { 34717 if (fontCharCode <= 0x10ffff) { 34718 fontChar = String.fromCodePoint(fontCharCode); 34719 } else { 34720 warn(`charToGlyph - invalid fontCharCode: ${fontCharCode}`); 34721 } 34722 } 34723 if (this.missingFile && this.vertical && fontChar.length === 1) { 34724 const vertical = getVerticalPresentationForm()[fontChar.charCodeAt(0)]; 34725 if (vertical) { 34726 fontChar = unicode = String.fromCharCode(vertical); 34727 } 34728 } 34729 glyph = new fonts_Glyph(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont); 34730 this.#glyphCache.set(charcode, glyph); 34731 return glyph; 34732 } 34733 charsToGlyphs(chars) { 34734 let glyphs = this.#charsCache.get(chars); 34735 if (glyphs) { 34736 return glyphs; 34737 } 34738 glyphs = []; 34739 if (this.cMap) { 34740 const c = Object.create(null), 34741 ii = chars.length; 34742 let i = 0; 34743 while (i < ii) { 34744 this.cMap.readCharCode(chars, i, c); 34745 const { 34746 charcode, 34747 length 34748 } = c; 34749 i += length; 34750 const glyph = this._charToGlyph(charcode, length === 1 && chars.charCodeAt(i - 1) === 0x20); 34751 glyphs.push(glyph); 34752 } 34753 } else { 34754 for (let i = 0, ii = chars.length; i < ii; ++i) { 34755 const charcode = chars.charCodeAt(i); 34756 const glyph = this._charToGlyph(charcode, charcode === 0x20); 34757 glyphs.push(glyph); 34758 } 34759 } 34760 this.#charsCache.set(chars, glyphs); 34761 return glyphs; 34762 } 34763 getCharPositions(chars) { 34764 const positions = []; 34765 if (this.cMap) { 34766 const c = Object.create(null); 34767 let i = 0; 34768 while (i < chars.length) { 34769 this.cMap.readCharCode(chars, i, c); 34770 const length = c.length; 34771 positions.push([i, i + length]); 34772 i += length; 34773 } 34774 } else { 34775 for (let i = 0, ii = chars.length; i < ii; ++i) { 34776 positions.push([i, i + 1]); 34777 } 34778 } 34779 return positions; 34780 } 34781 get glyphCacheValues() { 34782 return this.#glyphCache.values(); 34783 } 34784 encodeString(str) { 34785 const buffers = []; 34786 const currentBuf = []; 34787 const hasCurrentBufErrors = () => buffers.length % 2 === 1; 34788 const getCharCode = this.toUnicode instanceof IdentityToUnicodeMap ? unicode => this.toUnicode.charCodeOf(unicode) : unicode => this.toUnicode.charCodeOf(String.fromCodePoint(unicode)); 34789 for (let i = 0, ii = str.length; i < ii; i++) { 34790 const unicode = str.codePointAt(i); 34791 if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)
vendor: 1,652 bytes, lines 34791-34838
34791) { 34792 i++; 34793 } 34794 if (this.toUnicode) { 34795 const charCode = getCharCode(unicode); 34796 if (charCode !== -1) { 34797 if (hasCurrentBufErrors()) { 34798 buffers.push(currentBuf.join("")); 34799 currentBuf.length = 0; 34800 } 34801 const charCodeLength = this.cMap ? this.cMap.getCharCodeLength(charCode) : 1; 34802 for (let j = charCodeLength - 1; j >= 0; j--) { 34803 currentBuf.push(String.fromCharCode(charCode >> 8 * j & 0xff)); 34804 } 34805 continue; 34806 } 34807 } 34808 if (!hasCurrentBufErrors()) { 34809 buffers.push(currentBuf.join("")); 34810 currentBuf.length = 0; 34811 } 34812 currentBuf.push(String.fromCodePoint(unicode)); 34813 } 34814 buffers.push(currentBuf.join("")); 34815 return buffers; 34816 } 34817} 34818class ErrorFont { 34819 constructor(error) { 34820 this.error = error; 34821 this.loadedName = "g_font_error"; 34822 this.missingFile = true; 34823 } 34824 charsToGlyphs() { 34825 return []; 34826 } 34827 encodeString(chars) { 34828 return [chars]; 34829 } 34830 exportData() { 34831 return { 34832 error: this.error 34833 }; 34834 } 34835} 34836 34837;// ./src/core/calibri_factors.js 34838const CalibriBoldFactors = [1.3877, 1, 1, 1, 0.97801, 0.92482, 0.89552, 0.91133, 0.81988, 0.97566, 0.98152, 0.93548, 0.93548, 1.2798, 0.85284, 0.92794, 1, 0.96134, 1.54657, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.82845, 0.82845, 0.85284, 0.85284, 0.85284, 0.75859, 0.92138, 0.83908, 0.7762, 0.73293, 0.87289, 0.73133, 0.7514, 0.81921, 0.87356, 0.95958, 0.59526, 0.75727, 0.69225, 1.04924, 0.9121, 0.86943, 0.79795, 0.88198, 0.77958, 0.70864, 0.81055, 0.90399, 0.88653, 0.96017, 0.82577, 0.77892,
vendor: 2,638 bytes, line 34838
348380.78257, 0.97507, 1.54657, 0.97507, 0.85284, 0.89552, 0.90176, 0.88762, 0.8785, 0.75241, 0.8785, 0.90518, 0.95015, 0.77618, 0.8785, 0.88401, 0.91916, 0.86304, 0.88401, 0.91488, 0.8785, 0.8801, 0.8785, 0.8785, 0.91343, 0.7173, 1.04106, 0.8785, 0.85075, 0.95794, 0.82616, 0.85162, 0.79492, 0.88331, 1.69808, 0.88331, 0.85284, 0.97801, 0.89552, 0.91133, 0.89552, 0.91133, 1.7801, 0.89552, 1.24487, 1.13254, 1.12401, 0.96839, 0.85284, 0.68787, 0.70645, 0.85592, 0.90747, 1.01466, 1.0088, 0.90323, 1, 1.07463, 1, 0.91056, 0.75806, 1.19118, 0.96839, 0.78864, 0.82845, 0.84133, 0.75859, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.77539, 0.73293, 0.73133, 0.73133, 0.73133, 0.73133, 0.95958, 0.95958, 0.95958, 0.95958, 0.88506, 0.9121, 0.86943, 0.86943, 0.86943, 0.86943, 0.86943, 0.85284, 0.87508, 0.90399, 0.90399, 0.90399, 0.90399, 0.77892, 0.79795, 0.90807, 0.88762, 0.88762, 0.88762, 0.88762, 0.88762, 0.88762, 0.8715, 0.75241, 0.90518, 0.90518, 0.90518, 0.90518, 0.88401, 0.88401, 0.88401, 0.88401, 0.8785, 0.8785, 0.8801, 0.8801, 0.8801, 0.8801, 0.8801, 0.90747, 0.89049, 0.8785, 0.8785, 0.8785, 0.8785, 0.85162, 0.8785, 0.85162, 0.83908, 0.88762, 0.83908, 0.88762, 0.83908, 0.88762, 0.73293, 0.75241, 0.73293, 0.75241, 0.73293, 0.75241, 0.73293, 0.75241, 0.87289, 0.83016, 0.88506, 0.93125, 0.73133, 0.90518, 0.73133, 0.90518, 0.73133, 0.90518, 0.73133, 0.90518, 0.73133, 0.90518, 0.81921, 0.77618, 0.81921, 0.77618, 0.81921, 0.77618, 1, 1, 0.87356, 0.8785, 0.91075, 0.89608, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.76229, 0.90167, 0.59526, 0.91916, 1, 1, 0.86304, 0.69225, 0.88401, 1, 1, 0.70424, 0.79468, 0.91926, 0.88175, 0.70823, 0.94903, 0.9121, 0.8785, 1, 1, 0.9121, 0.8785, 0.87802, 0.88656, 0.8785, 0.86943, 0.8801, 0.86943, 0.8801, 0.86943, 0.8801, 0.87402, 0.89291, 0.77958, 0.91343, 1, 1, 0.77958, 0.91343, 0.70864, 0.7173, 0.70864, 0.7173, 0.70864, 0.7173, 0.70864, 0.7173, 1, 1, 0.81055, 0.75841, 0.81055, 1.06452, 0.90399, 0.8785, 0.90399, 0.8785, 0.90399, 0.8785, 0.90399, 0.8785, 0.90399, 0.8785, 0.90399, 0.8785, 0.96017, 0.95794, 0.77892, 0.85162, 0.77892, 0.78257, 0.79492, 0.78257, 0.79492, 0.78257, 0.79492, 0.9297, 0.56892, 0.83908, 0.88762, 0.77539, 0.8715, 0.87508, 0.89049, 1, 1, 0.81055, 1.04106, 1.20528, 1.20528, 1, 1.15543, 0.70674, 0.98387, 0.94721, 1.33431, 1.45894, 0.95161, 1.06303, 0.83908, 0.80352, 0.57184, 0.6965, 0.56289, 0.82001, 0.56029, 0.81235, 1.02988, 0.83908, 0.7762, 0.68156, 0.80367, 0.73133, 0.78257, 0.87356, 0.86943, 0.95958, 0.75727, 0.89019, 1.04924, 0.9121, 0.7648, 0.86943, 0.87356, 0.79795, 0.78275, 0.81055, 0.77892,
vendor: 2,277 bytes, lines 34838-34843
348380.9762, 0.82577, 0.99819, 0.84896, 0.95958, 0.77892, 0.96108, 1.01407, 0.89049, 1.02988, 0.94211, 0.96108, 0.8936, 0.84021, 0.87842, 0.96399, 0.79109, 0.89049, 1.00813, 1.02988, 0.86077, 0.87445, 0.92099, 0.84723, 0.86513, 0.8801, 0.75638, 0.85714, 0.78216, 0.79586, 0.87965, 0.94211, 0.97747, 0.78287, 0.97926, 0.84971, 1.02988, 0.94211, 0.8801, 0.94211, 0.84971, 0.73133, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90264, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90518, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90548, 1, 1, 1, 1, 1, 1, 0.96017, 0.95794, 0.96017, 0.95794, 0.96017, 0.95794, 0.77892, 0.85162, 1, 1, 0.89552, 0.90527, 1, 0.90363, 0.92794, 0.92794, 0.92794, 0.92794, 0.87012, 0.87012, 0.87012, 0.89552, 0.89552, 1.42259, 0.71143, 1.06152, 1, 1, 1.03372, 1.03372, 0.97171, 1.4956, 2.2807, 0.93835, 0.83406, 0.91133, 0.84107, 0.91133, 1, 1, 1, 0.72021, 1, 1.23108, 0.83489, 0.88525, 0.88525, 0.81499, 0.90527, 1.81055, 0.90527, 1.81055, 1.31006, 1.53711, 0.94434, 1.08696, 1, 0.95018, 0.77192, 0.85284, 0.90747, 1.17534, 0.69825, 0.9716, 1.37077, 0.90747, 0.90747, 0.85356, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941, 0.8941, 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.99862, 0.99862, 1, 1, 1, 1, 1, 1.08004, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90727, 0.90727, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 34839const CalibriBoldMetrics = { 34840 lineHeight: 1.2207, 34841 lineGap: 0.2207 34842}; 34843const CalibriBoldItalicFactors = [1.3877, 1, 1, 1, 0.97801, 0.92482, 0.89552, 0.91133, 0.81988, 0.97566, 0.98152, 0.93548, 0.93548, 1.2798, 0.85284, 0.92794, 1, 0.96134, 1.56239, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.82845, 0.82845, 0.85284, 0.85284, 0.85284, 0.75859, 0.92138, 0.83908, 0.7762, 0.71805, 0.87289, 0.73133, 0.7514, 0.81921, 0.87356, 0.95958, 0.59526, 0.75727, 0.69225, 1.04924, 0.90872, 0.85938, 0.79795, 0.87068, 0.77958, 0.69766, 0.81055, 0.90399, 0.88653, 0.96068, 0.82577, 0.77892,
vendor: 1,685 bytes, line 34843
348430.78257, 0.97507, 1.529, 0.97507, 0.85284, 0.89552, 0.90176, 0.94908, 0.86411, 0.74012, 0.86411, 0.88323, 0.95015, 0.86411, 0.86331, 0.88401, 0.91916, 0.86304, 0.88401, 0.9039, 0.86331, 0.86331, 0.86411, 0.86411, 0.90464, 0.70852, 1.04106, 0.86331, 0.84372, 0.95794, 0.82616, 0.84548, 0.79492, 0.88331, 1.69808, 0.88331, 0.85284, 0.97801, 0.89552, 0.91133, 0.89552, 0.91133, 1.7801, 0.89552, 1.24487, 1.13254, 1.19129, 0.96839, 0.85284, 0.68787, 0.70645, 0.85592, 0.90747, 1.01466, 1.0088, 0.90323, 1, 1.07463, 1, 0.91056, 0.75806, 1.19118, 0.96839, 0.78864, 0.82845, 0.84133, 0.75859, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.77539, 0.71805, 0.73133, 0.73133, 0.73133, 0.73133, 0.95958, 0.95958, 0.95958, 0.95958, 0.88506, 0.90872, 0.85938, 0.85938, 0.85938, 0.85938, 0.85938, 0.85284, 0.87068, 0.90399, 0.90399, 0.90399, 0.90399, 0.77892, 0.79795, 0.90807, 0.94908, 0.94908, 0.94908, 0.94908, 0.94908, 0.94908, 0.85887, 0.74012, 0.88323, 0.88323, 0.88323, 0.88323, 0.88401, 0.88401, 0.88401, 0.88401, 0.8785, 0.86331, 0.86331, 0.86331, 0.86331, 0.86331, 0.86331, 0.90747, 0.89049, 0.86331, 0.86331, 0.86331, 0.86331, 0.84548, 0.86411, 0.84548, 0.83908, 0.94908, 0.83908, 0.94908, 0.83908, 0.94908, 0.71805, 0.74012, 0.71805, 0.74012, 0.71805, 0.74012, 0.71805, 0.74012, 0.87289, 0.79538, 0.88506, 0.92726, 0.73133, 0.88323, 0.73133, 0.88323, 0.73133, 0.88323, 0.73133, 0.88323, 0.73133, 0.88323, 0.81921, 0.86411, 0.81921, 0.86411, 0.81921, 0.86411, 1, 1, 0.87356, 0.86331, 0.91075, 0.8777, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.76467, 0.90167, 0.59526, 0.91916, 1, 1, 0.86304, 0.69225, 0.88401, 1, 1, 0.70424, 0.7
vendor: 3,143 bytes, lines 34843-34848
348437312, 0.91926, 0.88175, 0.70823, 0.94903, 0.90872, 0.86331, 1, 1, 0.90872, 0.86331, 0.86906, 0.88116, 0.86331, 0.85938, 0.86331, 0.85938, 0.86331, 0.85938, 0.86331, 0.87402, 0.86549, 0.77958, 0.90464, 1, 1, 0.77958, 0.90464, 0.69766, 0.70852, 0.69766, 0.70852, 0.69766, 0.70852, 0.69766, 0.70852, 1, 1, 0.81055, 0.75841, 0.81055, 1.06452, 0.90399, 0.86331, 0.90399, 0.86331, 0.90399, 0.86331, 0.90399, 0.86331, 0.90399, 0.86331, 0.90399, 0.86331, 0.96068, 0.95794, 0.77892, 0.84548, 0.77892, 0.78257, 0.79492, 0.78257, 0.79492, 0.78257, 0.79492, 0.9297, 0.56892, 0.83908, 0.94908, 0.77539, 0.85887, 0.87068, 0.89049, 1, 1, 0.81055, 1.04106, 1.20528, 1.20528, 1, 1.15543, 0.70088, 0.98387, 0.94721, 1.33431, 1.45894, 0.95161, 1.48387, 0.83908, 0.80352, 0.57118, 0.6965, 0.56347, 0.79179, 0.55853, 0.80346, 1.02988, 0.83908, 0.7762, 0.67174, 0.86036, 0.73133, 0.78257, 0.87356, 0.86441, 0.95958, 0.75727, 0.89019, 1.04924, 0.90872, 0.74889, 0.85938, 0.87891, 0.79795, 0.7957, 0.81055, 0.77892, 0.97447, 0.82577, 0.97466, 0.87179, 0.95958, 0.77892, 0.94252, 0.95612, 0.8753, 1.02988, 0.92733, 0.94252, 0.87411, 0.84021, 0.8728, 0.95612, 0.74081, 0.8753, 1.02189, 1.02988, 0.84814, 0.87445, 0.91822, 0.84723, 0.85668, 0.86331, 0.81344, 0.87581, 0.76422, 0.82046, 0.96057, 0.92733, 0.99375, 0.78022, 0.95452, 0.86015, 1.02988, 0.92733, 0.86331, 0.92733, 0.86015, 0.73133, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90631, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.88323, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.85174, 1, 1, 1, 1, 1, 1, 0.96068, 0.95794, 0.96068, 0.95794, 0.96068, 0.95794, 0.77892, 0.84548, 1, 1, 0.89552, 0.90527, 1, 0.90363, 0.92794, 0.92794, 0.92794, 0.89807, 0.87012, 0.87012, 0.87012, 0.89552, 0.89552, 1.42259, 0.71094, 1.06152, 1, 1, 1.03372, 1.03372, 0.97171, 1.4956, 2.2807, 0.92972, 0.83406, 0.91133, 0.83326, 0.91133, 1, 1, 1, 0.72021, 1, 1.23108, 0.83489, 0.88525, 0.88525, 0.81499, 0.90616, 1.81055, 0.90527, 1.81055, 1.3107, 1.53711, 0.94434, 1.08696, 1, 0.95018, 0.77192, 0.85284, 0.90747, 1.17534, 0.69825, 0.9716, 1.37077, 0.90747, 0.90747, 0.85356, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941, 0.8941, 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.99862, 0.99862, 1, 1, 1, 1, 1, 1.08004, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90727, 0.90727, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 34844const CalibriBoldItalicMetrics = { 34845 lineHeight: 1.2207, 34846 lineGap: 0.2207 34847}; 34848const CalibriItalicFactors = [1.3877, 1, 1, 1, 1.17223, 1.1293, 0.89552, 0.91133, 0.80395, 1.02269, 1.15601, 0.91056, 0.91056, 1.2798, 0.85284, 0.89807, 1, 0.90861, 1.39543, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.96309, 0.96309, 0.85284, 0.85284, 0.85284, 0.83319, 0.88071, 0.8675, 0.81552, 0.72346, 0.85193, 0.73206, 0.7522, 0.81105, 0.86275, 0.90685, 0.6377, 0.77892,
vendor: 3,657 bytes, line 34848
348480.75593, 1.02638, 0.89249, 0.84118, 0.77452, 0.85374, 0.75186, 0.67789, 0.79776, 0.88844, 0.85066, 0.94309, 0.77818, 0.7306, 0.76659, 1.10369, 1.38313, 1.10369, 1.06139, 0.89552, 0.8739, 0.9245, 0.9245, 0.83203, 0.9245, 0.85865, 1.09842, 0.9245, 0.9245, 1.03297, 1.07692, 0.90918, 1.03297, 0.94959, 0.9245, 0.92274, 0.9245, 0.9245, 1.02933, 0.77832, 1.20562, 0.9245, 0.8916, 0.98986, 0.86621, 0.89453, 0.79004, 0.94152, 1.77256, 0.94152, 0.85284, 0.97801, 0.89552, 0.91133, 0.89552, 0.91133, 1.91729, 0.89552, 1.17889, 1.13254, 1.16359, 0.92098, 0.85284, 0.68787, 0.71353, 0.84737, 0.90747, 1.0088, 1.0044, 0.87683, 1, 1.09091, 1, 0.92229, 0.739, 1.15642, 0.92098, 0.76288, 0.80504, 0.80972, 0.75859, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.76318, 0.72346, 0.73206, 0.73206, 0.73206, 0.73206, 0.90685, 0.90685, 0.90685, 0.90685, 0.86477, 0.89249, 0.84118, 0.84118, 0.84118, 0.84118, 0.84118, 0.85284, 0.84557, 0.88844, 0.88844, 0.88844, 0.88844, 0.7306, 0.77452, 0.86331, 0.9245, 0.9245, 0.9245, 0.9245, 0.9245, 0.9245, 0.84843, 0.83203, 0.85865, 0.85865, 0.85865, 0.85865, 0.82601, 0.82601, 0.82601, 0.82601, 0.94469, 0.9245, 0.92274, 0.92274, 0.92274, 0.92274, 0.92274, 0.90747, 0.86651, 0.9245, 0.9245, 0.9245, 0.9245, 0.89453, 0.9245, 0.89453, 0.8675, 0.9245, 0.8675, 0.9245, 0.8675, 0.9245, 0.72346, 0.83203, 0.72346, 0.83203, 0.72346, 0.83203, 0.72346, 0.83203, 0.85193, 0.8875, 0.86477, 0.99034, 0.73206, 0.85865, 0.73206, 0.85865, 0.73206, 0.85865, 0.73206, 0.85865, 0.73206, 0.85865, 0.81105, 0.9245, 0.81105, 0.9245, 0.81105, 0.9245, 1, 1, 0.86275, 0.9245, 0.90872, 0.93591, 0.90685, 0.82601, 0.90685, 0.82601, 0.90685, 0.82601, 0.90685, 1.03297, 0.90685, 0.82601, 0.77896, 1.05611, 0.6377, 1.07692, 1, 1, 0.90918, 0.75593, 1.03297, 1, 1, 0.76032, 0.9375, 0.98156, 0.93407, 0.77261, 1.11429, 0.89249, 0.9245, 1, 1, 0.89249, 0.9245, 0.92534, 0.86698, 0.9245, 0.84118, 0.92274, 0.84118, 0.92274, 0.84118, 0.92274, 0.8667, 0.86291, 0.75186, 1.02933, 1, 1, 0.75186, 1.02933, 0.67789, 0.77832, 0.67789, 0.77832, 0.67789, 0.77832, 0.67789, 0.77832, 1, 1, 0.79776, 0.97655, 0.79776, 1.23023, 0.88844, 0.9245, 0.88844, 0.9245, 0.88844, 0.9245, 0.88844, 0.9245, 0.88844, 0.9245, 0.88844, 0.9245, 0.94309, 0.98986, 0.7306, 0.89453, 0.7306, 0.76659, 0.79004, 0.76659, 0.79004, 0.76659, 0.79004, 1.09231, 0.54873, 0.8675, 0.9245, 0.76318, 0.84843, 0.84557, 0.86651, 1, 1, 0.79776, 1.20562, 1.18622, 1.18622, 1, 1.1437, 0.67009, 0.96334, 0.93695, 1.35191, 1.40909, 0.95161, 1.48387, 0.8675, 0.90861, 0.6192, 0.7363, 0.64824, 0.82411, 0.56321, 0.85696, 1.23516, 0.8675, 0.81552, 0.7286, 0.84134, 0.73206, 0.76659, 0.86275, 0.84369, 0.90685, 0.77892, 0.85871, 1.02638, 0.89249, 0.75828, 0.84118, 0.85984, 0.77452, 0.76466, 0.79776, 0.7306, 0.90782, 0.77818, 0.903, 0.87291, 0.90685, 0.7306, 0.99058, 1.03667, 0.94635, 1.23516, 0.9849, 0.99058, 0.92393, 0.8916, 0.942, 1.03667, 0.75026, 0.94635, 1.0297, 1.23516, 0.90918, 0.94048, 0.98217, 0.89746, 0.84153, 0.92274, 0.82507, 0.88832, 0.84438, 0.88178, 1.03525, 0.9849, 1.00225, 0.78086, 0.97248, 0.89404, 1.23516, 0.9849, 0.92274, 0.9849, 0.89404, 0.73206, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.89693, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.85865, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90933, 1, 1, 1, 1, 1, 1, 0.94309, 0.98986, 0.94309, 0.98986, 0.94309, 0.98986, 0.7306, 0.89453, 1, 1, 0.89552, 0.90527, 1, 0.90186, 1.12308, 1.12308, 1.12308, 1.12308, 1.2566, 1.2566, 1.2566, 0.89552, 0.89552, 1.42259, 0.68994, 1.03809, 1, 1, 1.0176, 1.01
vendor: 1,221 bytes, lines 34848-34853
3484876, 1.11523, 1.4956, 2.01462, 0.97858, 0.82616, 0.91133, 0.83437, 0.91133, 1, 1, 1, 0.70508, 1, 1.23108, 0.79801, 0.84426, 0.84426, 0.774, 0.90572, 1.81055, 0.90749, 1.81055, 1.28809, 1.55469, 0.94434, 1.07806, 1, 0.97094, 0.7589, 0.85284, 0.90747, 1.19658, 0.69825, 0.97622, 1.33512, 0.90747, 0.90747, 0.85284, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941, 0.8941, 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.99862, 0.99862, 1, 1, 1, 1, 1, 1.0336, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.05859, 1.05859, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 34849const CalibriItalicMetrics = { 34850 lineHeight: 1.2207, 34851 lineGap: 0.2207 34852}; 34853const CalibriRegularFactors = [1.3877, 1, 1, 1, 1.17223, 1.1293, 0.89552, 0.91133, 0.80395, 1.02269, 1.15601, 0.91056, 0.91056, 1.2798, 0.85284, 0.89807, 1, 0.90861, 1.39016, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.96309, 0.96309, 0.85284, 0.85284, 0.85284, 0.83319, 0.88071, 0.8675, 0.81552, 0.73834, 0.85193, 0.73206, 0.7522, 0.81105, 0.86275, 0.90685, 0.6377, 0.77892,
vendor: 3,690 bytes, line 34853
348530.75593, 1.02638, 0.89385, 0.85122, 0.77452, 0.86503, 0.75186, 0.68887, 0.79776, 0.88844, 0.85066, 0.94258, 0.77818, 0.7306, 0.76659, 1.10369, 1.39016, 1.10369, 1.06139, 0.89552, 0.8739, 0.86128, 0.94469, 0.8457, 0.94469, 0.89464, 1.09842, 0.84636, 0.94469, 1.03297, 1.07692, 0.90918, 1.03297, 0.95897, 0.94469, 0.9482, 0.94469, 0.94469, 1.04692, 0.78223, 1.20562, 0.94469, 0.90332, 0.98986, 0.86621, 0.90527, 0.79004, 0.94152, 1.77256, 0.94152, 0.85284, 0.97801, 0.89552, 0.91133, 0.89552, 0.91133, 1.91729, 0.89552, 1.17889, 1.13254, 1.08707, 0.92098, 0.85284, 0.68787, 0.71353, 0.84737, 0.90747, 1.0088, 1.0044, 0.87683, 1, 1.09091, 1, 0.92229, 0.739, 1.15642, 0.92098, 0.76288, 0.80504, 0.80972, 0.75859, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.76318, 0.73834, 0.73206, 0.73206, 0.73206, 0.73206, 0.90685, 0.90685, 0.90685, 0.90685, 0.86477, 0.89385, 0.85122, 0.85122, 0.85122, 0.85122, 0.85122, 0.85284, 0.85311, 0.88844, 0.88844, 0.88844, 0.88844, 0.7306, 0.77452, 0.86331, 0.86128, 0.86128, 0.86128, 0.86128, 0.86128, 0.86128, 0.8693, 0.8457, 0.89464, 0.89464, 0.89464, 0.89464, 0.82601, 0.82601, 0.82601, 0.82601, 0.94469, 0.94469, 0.9482, 0.9482, 0.9482, 0.9482, 0.9482, 0.90747, 0.86651, 0.94469, 0.94469, 0.94469, 0.94469, 0.90527, 0.94469, 0.90527, 0.8675, 0.86128, 0.8675, 0.86128, 0.8675, 0.86128, 0.73834, 0.8457, 0.73834, 0.8457, 0.73834, 0.8457, 0.73834, 0.8457, 0.85193, 0.92454, 0.86477, 0.9921, 0.73206, 0.89464, 0.73206, 0.89464, 0.73206, 0.89464, 0.73206, 0.89464, 0.73206, 0.89464, 0.81105, 0.84636, 0.81105, 0.84636, 0.81105, 0.84636, 1, 1, 0.86275, 0.94469, 0.90872, 0.95786, 0.90685, 0.82601, 0.90685, 0.82601, 0.90685, 0.82601, 0.90685, 1.03297, 0.90685, 0.82601, 0.77741, 1.05611, 0.6377, 1.07692, 1, 1, 0.90918, 0.75593, 1.03297, 1, 1, 0.76032, 0.90452, 0.98156, 1.11842, 0.77261, 1.11429, 0.89385, 0.94469, 1, 1, 0.89385, 0.94469, 0.95877, 0.86901, 0.94469, 0.85122, 0.9482, 0.85122, 0.9482, 0.85122, 0.9482, 0.8667, 0.90016, 0.75186, 1.04692, 1, 1, 0.75186, 1.04692, 0.68887, 0.78223, 0.68887, 0.78223, 0.68887, 0.78223, 0.68887, 0.78223, 1, 1, 0.79776, 0.92188, 0.79776, 1.23023, 0.88844, 0.94469, 0.88844, 0.94469, 0.88844, 0.94469, 0.88844, 0.94469, 0.88844, 0.94469, 0.88844, 0.94469, 0.94258, 0.98986, 0.7306, 0.90527, 0.7306, 0.76659, 0.79004, 0.76659, 0.79004, 0.76659, 0.79004, 1.09231, 0.54873, 0.8675, 0.86128, 0.76318, 0.8693, 0.85311, 0.86651, 1, 1, 0.79776, 1.20562, 1.18622, 1.18622, 1, 1.1437, 0.67742, 0.96334, 0.93695, 1.35191, 1.40909, 0.95161, 1.48387, 0.86686, 0.90861, 0.62267, 0.74359, 0.65649, 0.85498, 0.56963, 0.88254, 1.23516, 0.8675, 0.81552, 0.75443, 0.84503, 0.73206, 0.76659, 0.86275, 0.85122, 0.90685, 0.77892, 0.85746, 1.02638, 0.89385, 0.75657, 0.85122, 0.86275, 0.77452, 0.74171, 0.79776, 0.7306, 0.95165, 0.77818, 0.89772, 0.88831, 0.90685, 0.7306, 0.98142, 1.02191, 0.96576, 1.23516, 0.99018, 0.98142, 0.9236, 0.89258, 0.94035, 1.02191, 0.78848, 0.96576, 0.9561, 1.23516, 0.90918, 0.92578, 0.95424, 0.89746, 0.83969, 0.9482, 0.80113, 0.89442, 0.85208, 0.86155, 0.98022, 0.99018, 1.00452, 0.81209, 0.99247, 0.89181, 1.23516, 0.99018, 0.9482, 0.99018, 0.89181, 0.73206, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.88844, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.89464, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.96766, 1, 1, 1, 1, 1, 1, 0.94258, 0.98986, 0.94258, 0.98986, 0.94258, 0.98986, 0.7306, 0.90527, 1, 1, 0.89552, 0.90527, 1, 0.90186, 1.12308, 1.12308, 1.12308, 1.12308, 1.2566, 1.2566, 1.2566, 0.89552, 0.89552, 1.42259, 0.69043, 1.03809, 1, 1, 1.0176, 1.01
vendor: 56,964 bytes, lines 34853-34897
3485376, 1.11523, 1.4956, 2.01462, 0.99331, 0.82616, 0.91133, 0.84286, 0.91133, 1, 1, 1, 0.70508, 1, 1.23108, 0.79801, 0.84426, 0.84426, 0.774, 0.90527, 1.81055, 0.90527, 1.81055, 1.28809, 1.55469, 0.94434, 1.07806, 1, 0.97094, 0.7589, 0.85284, 0.90747, 1.19658, 0.69825, 0.97622, 1.33512, 0.90747, 0.90747, 0.85356, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941, 0.8941, 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.99862, 0.99862, 1, 1, 1, 1, 1, 1.0336, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.05859, 1.05859, 1, 1, 1, 1.07185, 0.99413, 0.96334, 1.08065, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 34854const CalibriRegularMetrics = { 34855 lineHeight: 1.2207, 34856 lineGap: 0.2207 34857}; 34858 34859;// ./src/core/helvetica_factors.js 34860const HelveticaBoldFactors = [0.76116, 1, 1, 1.0006, 0.99998, 0.99974, 0.99973, 0.99973, 0.99982, 0.99977, 1.00087, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 1.00003, 1.00003, 1.00003, 1.00026, 0.9999, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00026, 1.00022, 0.99977, 1.0006, 0.99973, 0.99977, 1.00026, 0.99999, 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001, 1.00026, 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 0.99998, 1.0006, 0.99998, 1.00003, 0.99973, 0.99998, 0.99973, 1.00026, 0.99973, 1.00026, 0.99973, 0.99998, 1.00026, 1.00026, 1.0006, 1.0006, 0.99973, 1.0006, 0.99982, 1.00026, 1.00026, 1.00026, 1.00026, 0.99959, 0.99973, 0.99998, 1.00026, 0.99973, 1.00022, 0.99973, 0.99973, 1, 0.99959, 1.00077, 0.99959, 1.00003, 0.99998, 0.99973, 0.99973, 0.99973, 0.99973, 1.00077, 0.99973, 0.99998, 1.00025, 0.99968, 0.99973, 1.00003, 1.00025, 0.60299, 1.00024, 1.06409, 1, 1, 0.99998, 1, 0.99973, 1.0006, 0.99998, 1, 0.99936, 0.99973, 1.00002, 1.00002, 1.00002, 1.00026, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1, 0.99977, 1.00001, 1.00001, 1.00001, 1.00001, 1.0006, 1.0006, 1.0006, 1.0006, 0.99977, 0.99977, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00003, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99982, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.06409, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 1.00026, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 1.03374, 0.99977, 1.00026, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.00042, 0.99973, 0.99973, 1.0006, 0.99977, 0.99973, 0.99973, 1.00026, 1.0006, 1.00026, 1.0006, 1.00026, 1.03828, 1.00026, 0.99999, 1.00026, 1.0006, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.9993, 0.9998, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1, 1.00016, 0.99977, 0.99959, 0.99977, 0.99959, 0.99977, 0.99959, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00026, 0.99998, 1.00026, 0.8121, 1.00026, 0.99998, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 1.00016, 1.00022, 1.00001, 0.99973, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 1.0006, 0.99973, 0.99977, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 0.99973, 1.00026, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 1.00034, 0.99977, 1, 0.99997, 1.00026, 1.00078, 1.00036, 0.99973, 1.00013, 1.0006, 0.99977, 0.99977, 0.99988, 0.85148, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006, 0.99977, 1.00001, 0.99999, 0.99977, 1.00069, 1.00022, 0.99977, 1.00001, 0.99984, 1.00026, 1.00001, 1.00024, 1.00001, 0.9999, 1, 1.0006, 1.00001, 1.00041, 0.99962, 1.00026, 1.0006, 0.99995, 1.00041, 0.99942, 0.99973, 0.99927, 1.00082, 0.99902, 1.00026, 1.00087, 1.0006, 1.00069, 0.99973, 0.99867, 0.99973, 0.9993, 1.00026, 1.00049, 1.00056, 1, 0.99988, 0.99935, 0.99995, 0.99954, 1.00055, 0.99945, 1.00032, 1.0006, 0.99995, 1.00026, 0.99995, 1.00032, 1.00001, 1.00008, 0.99971, 1.00019, 0.9994, 1.00001, 1.0006, 1.00044, 0.99973, 1.00023, 1.00047, 1, 0.99942, 0.99561, 0.99989, 1.00035, 0.99977, 1.00035, 0.99977, 1.00019, 0.99944, 1.00001, 1.00021, 0.99926, 1.00035, 1.00035, 0.99942, 1.00048, 0.99999, 0.99977, 1.00022, 1.00035, 1.00001, 0.99977, 1.00026, 0.99989, 1.00057, 1.00001, 0.99936, 1.00052, 1.00012, 0.99996, 1.00043, 1, 1.00035, 0.9994, 0.99976, 1.00035, 0.99973, 1.00052, 1.00041, 1.00119, 1.00037, 0.99973, 1.00002, 0.99986, 1.00041, 1.00041, 0.99902, 0.9996, 1.00034, 0.99999, 1.00026, 0.99999, 1.00026, 0.99973, 1.00052, 0.99973, 1, 0.99973, 1.00041, 1.00075, 0.9994, 1.0003, 0.99999, 1, 1.00041, 0.99955, 1, 0.99915, 0.99973, 0.99973, 1.00026, 1.00119, 0.99955, 0.99973, 1.0006, 0.99911, 1.0006, 1.00026, 0.99972, 1.00026, 0.99902, 1.00041, 0.99973, 0.99999, 1, 1, 1.00038, 1.0005, 1.00016, 1.00022, 1.00016, 1.00022, 1.00016, 1.00022, 1.00001, 0.99973, 1, 1, 0.99973, 1, 1, 0.99955, 1.0006, 1.0006, 1.0006, 1.0006, 1, 1, 1, 0.99973, 0.99973, 0.99972, 1, 1, 1.00106, 0.99999, 0.99998, 0.99998, 0.99999, 0.99998, 1.66475, 1, 0.99973, 0.99973, 1.00023, 0.99973, 0.99971, 1.00047, 1.00023, 1, 0.99991, 0.99984, 1.00002, 1.00002, 1.00002, 1.00002, 1, 1, 1, 1, 1, 1, 1, 0.99972, 1, 1.20985, 1.39713, 1.00003, 1.00031, 1.00015, 1, 0.99561, 1.00027, 1.00031, 1.00031, 0.99915, 1.00031, 1.00031, 0.99999, 1.00003, 0.99999, 0.99999, 1.41144, 1.6, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.40579, 1.40579, 1.36625, 0.99999, 1, 0.99861, 0.99861, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.99972, 0.99999, 0.99999, 0.99999, 0.99999, 1.40483, 1, 0.99977, 1.00054, 1, 1, 0.99953, 0.99962, 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 0.99998, 0.99998, 0.99998, 0.99998, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 34861const HelveticaBoldMetrics = { 34862 lineHeight: 1.2, 34863 lineGap: 0.2 34864}; 34865const HelveticaBoldItalicFactors = [0.76116, 1, 1, 1.0006, 0.99998, 0.99974, 0.99973, 0.99973, 0.99982, 0.99977, 1.00087, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 1.00003, 1.00003, 1.00003, 1.00026, 0.9999, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00026, 1.00022, 0.99977, 1.0006, 0.99973, 0.99977, 1.00026, 0.99999, 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001, 1.00026, 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 0.99998, 1.0006, 0.99998, 1.00003, 0.99973, 0.99998, 0.99973, 1.00026, 0.99973, 1.00026, 0.99973, 0.99998, 1.00026, 1.00026, 1.0006, 1.0006, 0.99973, 1.0006, 0.99982, 1.00026, 1.00026, 1.00026, 1.00026, 0.99959, 0.99973, 0.99998, 1.00026, 0.99973, 1.00022, 0.99973, 0.99973, 1, 0.99959, 1.00077, 0.99959, 1.00003, 0.99998, 0.99973, 0.99973, 0.99973, 0.99973, 1.00077, 0.99973, 0.99998, 1.00025, 0.99968, 0.99973, 1.00003, 1.00025, 0.60299, 1.00024, 1.06409, 1, 1, 0.99998, 1, 0.99973, 1.0006, 0.99998, 1, 0.99936, 0.99973, 1.00002, 1.00002, 1.00002, 1.00026, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1, 0.99977, 1.00001, 1.00001, 1.00001, 1.00001, 1.0006, 1.0006, 1.0006, 1.0006, 0.99977, 0.99977, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00003, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99982, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.06409, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 1.00026, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 1.0044, 0.99977, 1.00026, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99971, 0.99973, 0.99973, 1.0006, 0.99977, 0.99973, 0.99973, 1.00026, 1.0006, 1.00026, 1.0006, 1.00026, 1.01011, 1.00026, 0.99999, 1.00026, 1.0006, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.9993, 0.9998, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1, 1.00016, 0.99977, 0.99959, 0.99977, 0.99959, 0.99977, 0.99959, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00026, 0.99998, 1.00026, 0.8121, 1.00026, 0.99998, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 1.00016, 1.00022, 1.00001, 0.99973, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 1.0006, 0.99973, 0.99977, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 0.99973, 1.00026, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99977, 1, 1, 1.00026, 0.99969, 0.99972, 0.99981, 0.9998, 1.0006, 0.99977, 0.99977, 1.00022, 0.91155, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006, 0.99977, 1.00001, 0.99999, 0.99977, 0.99966, 1.00022, 1.00032, 1.00001, 0.99944, 1.00026, 1.00001, 0.99968, 1.00001, 1.00047, 1, 1.0006, 1.00001, 0.99981, 1.00101, 1.00026, 1.0006, 0.99948, 0.99981, 1.00064, 0.99973, 0.99942, 1.00101, 1.00061, 1.00026, 1.00069, 1.0006, 1.00014, 0.99973, 1.01322, 0.99973, 1.00065, 1.00026, 1.00012, 0.99923, 1, 1.00064, 1.00076, 0.99948, 1.00055, 1.00063, 1.00007, 0.99943, 1.0006, 0.99948, 1.00026, 0.99948, 0.99943, 1.00001, 1.00001, 1.00029, 1.00038, 1.00035, 1.00001, 1.0006, 1.0006, 0.99973, 0.99978, 1.00001, 1.00057, 0.99989, 0.99967, 0.99964, 0.99967, 0.99977, 0.99999, 0.99977, 1.00038, 0.99977, 1.00001, 0.99973, 1.00066, 0.99967, 0.99967, 1.00041, 0.99998, 0.99999, 0.99977, 1.00022, 0.99967, 1.00001, 0.99977, 1.00026, 0.99964, 1.00031, 1.00001, 0.99999, 0.99999, 1, 1.00023, 1, 1, 0.99999, 1.00035, 1.00001, 0.99999, 0.99973, 0.99977, 0.99999, 1.00058, 0.99973, 0.99973, 0.99955, 0.9995, 1.00026, 1.00026, 1.00032, 0.99989, 1.00034, 0.99999, 1.00026, 1.00026, 1.00026, 0.99973, 0.45998, 0.99973, 1.00026, 0.99973, 1.00001, 0.99999, 0.99982, 0.99994, 0.99996, 1, 1.00042, 1.00044, 1.00029, 1.00023, 0.99973, 0.99973, 1.00026, 0.99949, 1.00002, 0.99973, 1.0006, 1.0006, 1.0006, 0.99975, 1.00026, 1.00026, 1.00032, 0.98685, 0.99973, 1.00026, 1, 1, 0.99966, 1.00044, 1.00016, 1.00022, 1.00016, 1.00022, 1.00016, 1.00022, 1.00001, 0.99973, 1, 1, 0.99973, 1, 1, 0.99955, 1.0006, 1.0006, 1.0006, 1.0006, 1, 1, 1, 0.99973, 0.99973, 0.99972, 1, 1, 1.00106, 0.99999, 0.99998, 0.99998, 0.99999, 0.99998, 1.66475, 1, 0.99973, 0.99973, 1, 0.99973, 0.99971, 0.99978, 1, 1, 0.99991, 0.99984, 1.00002, 1.00002, 1.00002, 1.00002, 1.00098, 1, 1, 1, 1.00049, 1, 1, 0.99972, 1, 1.20985, 1.39713, 1.00003, 1.00031, 1.00015, 1, 0.99561, 1.00027, 1.00031, 1.00031, 0.99915, 1.00031, 1.00031, 0.99999, 1.00003, 0.99999, 0.99999, 1.41144, 1.6, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.40579, 1.40579, 1.36625, 0.99999, 1, 0.99861, 0.99861, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.99972, 0.99999, 0.99999, 0.99999, 0.99999, 1.40483, 1, 0.99977, 1.00054, 1, 1, 0.99953, 0.99962, 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 0.99998, 0.99998, 0.99998, 0.99998, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 34866const HelveticaBoldItalicMetrics = { 34867 lineHeight: 1.35, 34868 lineGap: 0.2 34869}; 34870const HelveticaItalicFactors = [0.76116, 1, 1, 1.0006, 1.0006, 1.00006, 0.99973, 0.99973, 0.99982, 1.00001, 1.00043, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1, 1.00003, 1.00003, 1.00003, 0.99973, 0.99987, 1.00001, 1.00001, 0.99977, 0.99977, 1.00001, 1.00026, 1.00022, 0.99977, 1.0006, 1, 1.00001, 0.99973, 0.99999, 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001, 1.00026, 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 1.0006, 1.0006, 1.0006, 0.99949, 0.99973, 0.99998, 0.99973, 0.99973, 1, 0.99973, 0.99973, 1.0006, 0.99973, 0.99973, 0.99924, 0.99924, 1, 0.99924, 0.99999, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 1.0006, 0.99973, 1, 0.99977, 1, 1, 1, 1.00005, 1.0009, 1.00005, 1.00003, 0.99998, 0.99973, 0.99973, 0.99973, 0.99973, 1.0009, 0.99973, 0.99998, 1.00025, 0.99968, 0.99973, 1.00003, 1.00025, 0.60299, 1.00024, 1.06409, 1, 1, 0.99998, 1, 0.9998, 1.0006, 0.99998, 1, 0.99936, 0.99973, 1.00002, 1.00002, 1.00002, 1.00026, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1, 0.99977, 1.00001, 1.00001, 1.00001, 1.00001, 1.0006, 1.0006, 1.0006, 1.0006, 0.99977, 0.99977, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00003, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99982, 1, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.06409, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 1, 0.99973, 1, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1.0288, 0.99977, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99924, 1.0006, 1.0006, 0.99946, 1.00034, 1, 0.99924, 1.00001, 1, 1, 0.99973, 0.99924, 0.99973, 0.99924, 0.99973, 1.06311, 0.99973, 1.00024, 0.99973, 0.99924, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.00041, 0.9998, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1, 1.00016, 0.99977, 0.99998, 0.99977, 0.99998, 0.99977, 0.99998, 1.00001, 1, 1.00001, 1, 1.00001, 1, 1.00001, 1, 1.00026, 1.0006, 1.00026, 0.89547, 1.00026, 1.0006, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.00016, 0.99977, 1.00001, 1, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 0.99924, 0.99973, 1.00001, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 1, 1.00026, 1.0006, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 1.00001, 1, 1.00054, 0.99977, 1.00084, 1.00007, 0.99973, 1.00013, 0.99924, 1.00001, 1.00001, 0.99945, 0.91221, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006, 1.00001, 1.00001, 0.99999, 0.99977, 0.99933, 1.00022, 1.00054, 1.00001, 1.00065, 1.00026, 1.00001, 1.0001, 1.00001, 1.00052, 1, 1.0006, 1.00001, 0.99945, 0.99897, 0.99968, 0.99924, 1.00036, 0.99945, 0.99949, 1, 1.0006, 0.99897, 0.99918, 0.99968, 0.99911, 0.99924, 1, 0.99962, 1.01487, 1, 1.0005, 0.99973, 1.00012, 1.00043, 1, 0.99995, 0.99994, 1.00036, 0.99947, 1.00019, 1.00063, 1.00025, 0.99924, 1.00036, 0.99973, 1.00036, 1.00025, 1.00001, 1.00001, 1.00027, 1.0001, 1.00068, 1.00001, 1.0006, 1.0006, 1, 1.00008, 0.99957, 0.99972, 0.9994, 0.99954, 0.99975, 1.00051, 1.00001, 1.00019, 1.00001, 1.0001, 0.99986, 1.00001, 1.00001, 1.00038, 0.99954, 0.99954, 0.9994, 1.00066, 0.99999, 0.99977, 1.00022, 1.00054, 1.00001, 0.99977, 1.00026, 0.99975, 1.0001, 1.00001, 0.99993, 0.9995, 0.99955, 1.00016, 0.99978, 0.99974, 1.00019, 1.00022, 0.99955, 1.00053, 0.99973, 1.00089, 1.00005, 0.99967, 1.00048, 0.99973, 1.00002, 1.00034, 0.99973, 0.99973, 0.99964, 1.00006, 1.00066, 0.99947, 0.99973, 0.98894, 0.99973, 1, 0.44898, 1, 0.99946, 1, 1.00039, 1.00082, 0.99991, 0.99991, 0.99985, 1.00022, 1.00023, 1.00061, 1.00006, 0.99966, 0.99973, 0.99973, 0.99973, 1.00019, 1.0008, 1, 0.99924, 0.99924, 0.99924, 0.99983, 1.00044, 0.99973, 0.99964, 0.98332, 1, 0.99973, 1, 1, 0.99962, 0.99895, 1.00016, 0.99977, 1.00016, 0.99977, 1.00016, 0.99977, 1.00001, 1, 1, 1, 0.99973, 1, 1, 0.99955, 0.99924, 0.99924, 0.99924, 0.99924, 0.99998, 0.99998, 0.99998, 0.99973, 0.99973, 0.99972, 1, 1, 1.00267, 0.99999, 0.99998, 0.99998, 1, 0.99998, 1.66475, 1, 0.99973, 0.99973, 1.00023, 0.99973, 1.00423, 0.99925, 0.99999, 1, 0.99991, 0.99984, 1.00002, 1.00002, 1.00002, 1.00002, 1.00049, 1, 1.00245, 1, 1, 1, 1, 0.96329, 1, 1.20985, 1.39713, 1.00003, 0.8254, 1.00015, 1, 1.00035, 1.00027, 1.00031, 1.00031, 1.00003, 1.00031, 1.00031, 0.99999, 1.00003, 0.99999, 0.99999, 1.41144, 1.6, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.40579, 1.40579, 1.36625, 0.99999, 1, 0.99861, 0.99861, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.95317, 0.99999, 0.99999, 0.99999, 0.99999, 1.40483, 1, 0.99977, 1.00054, 1, 1, 0.99953, 0.99962, 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 0.99998, 0.99998, 0.99998, 0.99998, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 34871const HelveticaItalicMetrics = { 34872 lineHeight: 1.35, 34873 lineGap: 0.2 34874}; 34875const HelveticaRegularFactors = [0.76116, 1, 1, 1.0006, 1.0006, 1.00006, 0.99973, 0.99973, 0.99982, 1.00001, 1.00043, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1, 1.00003, 1.00003, 1.00003, 0.99973, 0.99987, 1.00001, 1.00001, 0.99977, 0.99977, 1.00001, 1.00026, 1.00022, 0.99977, 1.0006, 1, 1.00001, 0.99973, 0.99999, 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001, 1.00026, 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 1.0006, 1.0006, 1.0006, 0.99949, 0.99973, 0.99998, 0.99973, 0.99973, 1, 0.99973, 0.99973, 1.0006, 0.99973, 0.99973, 0.99924, 0.99924, 1, 0.99924, 0.99999, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 1.0006, 0.99973, 1, 0.99977, 1, 1, 1, 1.00005, 1.0009, 1.00005, 1.00003, 0.99998, 0.99973, 0.99973, 0.99973, 0.99973, 1.0009, 0.99973, 0.99998, 1.00025, 0.99968, 0.99973, 1.00003, 1.00025, 0.60299, 1.00024, 1.06409, 1, 1, 0.99998, 1, 0.9998, 1.0006, 0.99998, 1, 0.99936, 0.99973, 1.00002, 1.00002, 1.00002, 1.00026, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1, 0.99977, 1.00001, 1.00001, 1.00001, 1.00001, 1.0006, 1.0006, 1.0006, 1.0006, 0.99977, 0.99977, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00003, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99982, 1, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.06409, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 1, 0.99973, 1, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1.04596, 0.99977, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99924, 1.0006, 1.0006, 1.00019, 1.00034, 1, 0.99924, 1.00001, 1, 1, 0.99973, 0.99924, 0.99973, 0.99924, 0.99973, 1.02572, 0.99973, 1.00005, 0.99973, 0.99924, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99999, 0.9998, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1, 1.00016, 0.99977, 0.99998, 0.99977, 0.99998, 0.99977, 0.99998, 1.00001, 1, 1.00001, 1, 1.00001, 1, 1.00001, 1, 1.00026, 1.0006, 1.00026, 0.84533, 1.00026, 1.0006, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.00016, 0.99977, 1.00001, 1, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 0.99924, 0.99973, 1.00001, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 1, 1.00026, 1.0006, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99928, 1, 0.99977, 1.00013, 1.00055, 0.99947, 0.99945, 0.99941, 0.99924, 1.00001, 1.00001, 1.0004, 0.91621, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006, 1.00001, 1.00005, 0.99999, 0.99977, 1.00015, 1.00022, 0.99977, 1.00001, 0.99973, 1.00026, 1.00001, 1.00019, 1.00001, 0.99946, 1, 1.0006, 1.00001, 0.99978, 1.00045, 0.99973, 0.99924, 1.00023, 0.99978, 0.99966, 1, 1.00065, 1.00045, 1.00019, 0.99973, 0.99973, 0.99924, 1, 1, 0.96499, 1, 1.00055, 0.99973, 1.00008, 1.00027, 1, 0.9997, 0.99995, 1.00023, 0.99933, 1.00019, 1.00015, 1.00031, 0.99924, 1.00023, 0.99973, 1.00023, 1.00031, 1.00001, 0.99928, 1.00029, 1.00092, 1.00035, 1.00001, 1.0006, 1.0006, 1, 0.99988, 0.99975, 1, 1.00082, 0.99561, 0.9996, 1.00035, 1.00001, 0.99962, 1.00001, 1.00092, 0.99964, 1.00001, 0.99963, 0.99999, 1.00035, 1.00035, 1.00082, 0.99962, 0.99999, 0.99977, 1.00022, 1.00035, 1.00001, 0.99977, 1.00026, 0.9996, 0.99967, 1.00001, 1.00034, 1.00074, 1.00054, 1.00053, 1.00063, 0.99971, 0.99962, 1.00035, 0.99975, 0.99977, 0.99973, 1.00043, 0.99953, 1.0007, 0.99915, 0.99973, 1.00008, 0.99892, 1.00073, 1.00073, 1.00114, 0.99915, 1.00073, 0.99955, 0.99973, 1.00092, 0.99973, 1, 0.99998, 1, 1.0003, 1, 1.00043, 1.00001, 0.99969, 1.0003, 1, 1.00035, 1.00001, 0.9995, 1, 1.00092, 0.99973, 0.99973, 0.99973, 1.0007, 0.9995, 1, 0.99924, 1.0006, 0.99924, 0.99972, 1.00062, 0.99973, 1.00114, 1.00073, 1, 0.99955, 1, 1, 1.00047, 0.99968, 1.00016, 0.99977, 1.00016, 0.99977, 1.00016, 0.99977, 1.00001, 1, 1, 1, 0.99973, 1, 1, 0.99955, 0.99924, 0.99924, 0.99924, 0.99924, 0.99998, 0.99998, 0.99998, 0.99973, 0.99973, 0.99972, 1, 1, 1.00267, 0.99999, 0.99998, 0.99998, 1, 0.99998, 1.66475, 1, 0.99973, 0.99973, 1.00023, 0.99973, 0.99971, 0.99925, 1.00023, 1, 0.99991, 0.99984, 1.00002, 1.00002, 1.00002, 1.00002, 1, 1, 1, 1, 1, 1, 1, 0.96329, 1, 1.20985, 1.39713, 1.00003, 0.8254, 1.00015, 1, 1.00035, 1.00027, 1.00031, 1.00031, 0.99915, 1.00031, 1.00031, 0.99999, 1.00003, 0.99999, 0.99999, 1.41144, 1.6, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.40579, 1.40579, 1.36625, 0.99999, 1, 0.99861, 0.99861, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.95317, 0.99999, 0.99999, 0.99999, 0.99999, 1.40483, 1, 0.99977, 1.00054, 1, 1, 0.99953, 0.99962, 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 34876const HelveticaRegularMetrics = { 34877 lineHeight: 1.2, 34878 lineGap: 0.2 34879}; 34880 34881;// ./src/core/liberationsans_widths.js 34882const LiberationSansBoldWidths = [365, 0, 333, 278, 333, 474, 556, 556, 889, 722, 238, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 333, 333, 584, 584, 584, 611, 975, 722, 722, 722, 722, 667, 611, 778, 722, 278, 556, 722, 611, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 333, 278, 333, 584, 556, 333, 556, 611, 556, 611, 556, 333, 611, 611, 278, 278, 556, 278, 889, 611, 611, 611, 611, 389, 556, 333, 611, 556, 778, 556, 556, 500, 389, 280, 389, 584, 333, 556, 556, 556, 556, 280, 556, 333, 737, 370, 556, 584, 737, 552, 400, 549, 333, 333, 333, 576, 556, 278, 333, 333, 365, 556, 834, 834, 834, 611, 722, 722, 722, 722, 722, 722, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 556, 556, 556, 556, 556, 278, 278, 278, 278, 611, 611, 611, 611, 611, 611, 611, 549, 611, 611, 611, 611, 611, 556, 611, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 719, 722, 611, 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 611, 778, 611, 778, 611, 778, 611, 722, 611, 722, 611, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 785, 556, 556, 278, 722, 556, 556, 611, 278, 611, 278, 611, 385, 611, 479, 611, 278, 722, 611, 722, 611, 722, 611, 708, 723, 611, 778, 611, 778, 611, 778, 611, 1000, 944, 722, 389, 722, 389, 722, 389, 667, 556, 667, 556, 667, 556, 667, 556, 611, 333, 611, 479, 611, 333, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611, 944, 778, 667, 556, 667, 611, 500, 611, 500, 611, 500, 278, 556, 722, 556, 1000, 889, 778, 611, 667, 556, 611, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 465, 722, 333, 853, 906, 474, 825, 927, 838, 278, 722, 722, 601, 719, 667, 611, 722, 778, 278, 722, 667, 833, 722, 644, 778, 722, 667, 600, 611, 667, 821, 667, 809, 802, 278, 667, 615, 451, 611, 278, 582, 615, 610, 556, 606, 475, 460, 611, 541, 278, 558, 556, 612, 556, 445, 611, 766, 619, 520, 684, 446, 582, 715, 576, 753, 845, 278, 582, 611, 582, 845, 667, 669, 885, 567, 711, 667, 278, 276, 556, 1094, 1062, 875, 610, 722, 622, 719, 722, 719, 722, 567, 712, 667, 904, 626, 719, 719, 610, 702, 833, 722, 778, 719, 667, 722, 611, 622, 854, 667, 730, 703, 1005, 1019, 870, 979, 719, 711, 1031, 719, 556, 618, 615, 417, 635, 556, 709, 497, 615, 615, 500, 635, 740, 604, 611, 604, 611, 556, 490, 556, 875, 556, 615, 581, 833, 844, 729, 854, 615, 552, 854, 583, 556, 556, 611, 417, 552, 556, 278, 281, 278, 969, 906, 611, 500, 615, 556, 604, 778, 611, 487, 447, 944, 778, 944, 778, 944, 778, 667, 556, 333, 333, 556, 1000, 1000, 552, 278, 278, 278, 278, 500, 500, 500, 556, 556, 350, 1000, 1000, 240, 479, 333, 333, 604, 333, 167, 396, 556, 556, 1094, 556, 885, 489, 1115, 1000, 768, 600, 834, 834, 834, 834, 1000, 500, 1000, 500, 1000, 500, 500, 494, 612, 823, 713, 584, 549, 713, 979, 722, 274, 549, 549, 583, 549, 549, 604, 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354, 1000, 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052, 917, 750, 750, 531, 656, 594, 510, 500, 750, 750, 611, 611, 333, 333, 333, 333, 333, 333, 333, 333, 222, 222, 333, 333, 333, 333, 333, 333, 333, 333]; 34883const LiberationSansBoldMapping = [-1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713, 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811, 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359, 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542, 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721, 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805, 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642, 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689, 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834, 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]; 34884const LiberationSansBoldItalicWidths = [365, 0, 333, 278, 333, 474, 556, 556, 889, 722, 238, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 333, 333, 584, 584, 584, 611, 975, 722, 722, 722, 722, 667, 611, 778, 722, 278, 556, 722, 611, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 333, 278, 333, 584, 556, 333, 556, 611, 556, 611, 556, 333, 611, 611, 278, 278, 556, 278, 889, 611, 611, 611, 611, 389, 556, 333, 611, 556, 778, 556, 556, 500, 389, 280, 389, 584, 333, 556, 556, 556, 556, 280, 556, 333, 737, 370, 556, 584, 737, 552, 400, 549, 333, 333, 333, 576, 556, 278, 333, 333, 365, 556, 834, 834, 834, 611, 722, 722, 722, 722, 722, 722, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 556, 556, 556, 556, 556, 278, 278, 278, 278, 611, 611, 611, 611, 611, 611, 611, 549, 611, 611, 611, 611, 611, 556, 611, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 740, 722, 611, 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 611, 778, 611, 778, 611, 778, 611, 722, 611, 722, 611, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 782, 556, 556, 278, 722, 556, 556, 611, 278, 611, 278, 611, 396, 611, 479, 611, 278, 722, 611, 722, 611, 722, 611, 708, 723, 611, 778, 611, 778, 611, 778, 611, 1000, 944, 722, 389, 722, 389, 722, 389, 667, 556, 667, 556, 667, 556, 667, 556, 611, 333, 611, 479, 611, 333, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611, 944, 778, 667, 556, 667, 611, 500, 611, 500, 611, 500, 278, 556, 722, 556, 1000, 889, 778, 611, 667, 556, 611, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 722, 333, 854, 906, 473, 844, 930, 847, 278, 722, 722, 610, 671, 667, 611, 722, 778, 278, 722, 667, 833, 722, 657, 778, 718, 667, 590, 611, 667, 822, 667, 829, 781, 278, 667, 620, 479, 611, 278, 591, 620, 621, 556, 610, 479, 492, 611, 558, 278, 566, 556, 603, 556, 450, 611, 712, 605, 532, 664, 409, 591, 704, 578, 773, 834, 278, 591, 611, 591, 834, 667, 667, 886, 614, 719, 667, 278, 278, 556, 1094, 1042, 854, 622, 719, 677, 719, 722, 708, 722, 614, 722, 667, 927, 643, 719, 719, 615, 687, 833, 722, 778, 719, 667, 722, 611, 677, 781, 667, 729, 708, 979, 989, 854, 1000, 708, 719, 1042, 729, 556, 619, 604, 534, 618, 556, 736, 510, 611, 611, 507, 622, 740, 604, 611, 611, 611, 556, 889, 556, 885, 556, 646, 583, 889, 935, 707, 854, 594, 552, 865, 589, 556, 556, 611, 469, 563, 556, 278, 278, 278, 969, 906, 611, 507, 619, 556, 611, 778, 611, 575, 467, 944, 778, 944, 778, 944, 778, 667, 556, 333, 333, 556, 1000, 1000, 552, 278, 278, 278, 278, 500, 500, 500, 556, 556, 350, 1000, 1000, 240, 479, 333, 333, 604, 333, 167, 396, 556, 556, 1104, 556, 885, 516, 1146, 1000, 768, 600, 834, 834, 834, 834, 999, 500, 1000, 500, 1000, 500, 500, 494, 612, 823, 713, 584, 549, 713, 979, 722, 274, 549, 549, 583, 549, 549, 604, 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354, 1000, 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052, 917, 750, 750, 531, 656, 594, 510, 500, 750, 750, 611, 611, 333, 333, 333, 333, 333, 333, 333, 333, 222, 222, 333, 333, 333, 333, 333, 333, 333, 333]; 34885const LiberationSansBoldItalicMapping = [-1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713, 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811, 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359, 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542, 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721, 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805, 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642, 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689, 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834, 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]; 34886const LiberationSansItalicWidths = [365, 0, 333, 278, 278, 355, 556, 556, 889, 667, 191, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 278, 278, 584, 584, 584, 556, 1015, 667, 667, 722, 722, 667, 611, 778, 722, 278, 500, 667, 556, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 278, 278, 278, 469, 556, 333, 556, 556, 500, 556, 556, 278, 556, 556, 222, 222, 500, 222, 833, 556, 556, 556, 556, 333, 500, 278, 556, 500, 722, 500, 500, 500, 334, 260, 334, 584, 333, 556, 556, 556, 556, 260, 556, 333, 737, 370, 556, 584, 737, 552, 400, 549, 333, 333, 333, 576, 537, 278, 333, 333, 365, 556, 834, 834, 834, 611, 667, 667, 667, 667, 667, 667, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 500, 556, 556, 556, 556, 278, 278, 278, 278, 556, 556, 556, 556, 556, 556, 556, 549, 611, 556, 556, 556, 556, 500, 556, 500, 667, 556, 667, 556, 667, 556, 722, 500, 722, 500, 722, 500, 722, 500, 722, 625, 722, 556, 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 556, 778, 556, 778, 556, 778, 556, 722, 556, 722, 556, 278, 278, 278, 278, 278, 278, 278, 222, 278, 278, 733, 444, 500, 222, 667, 500, 500, 556, 222, 556, 222, 556, 281, 556, 400, 556, 222, 722, 556, 722, 556, 722, 556, 615, 723, 556, 778, 556, 778, 556, 778, 556, 1000, 944, 722, 333, 722, 333, 722, 333, 667, 500, 667, 500, 667, 500, 667, 500, 611, 278, 611, 354, 611, 278, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 944, 722, 667, 500, 667, 611, 500, 611, 500, 611, 500, 222, 556, 667, 556, 1000, 889, 778, 611, 667, 500, 611, 278, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 667, 278, 789, 846, 389, 794, 865, 775, 222, 667, 667, 570, 671, 667, 611, 722, 778, 278, 667, 667, 833, 722, 648, 778, 725, 667, 600, 611, 667, 837, 667, 831, 761, 278, 667, 570, 439, 555, 222, 550, 570, 571, 500, 556, 439, 463, 555, 542, 222, 500, 492, 548, 500, 447, 556, 670, 573, 486, 603, 374, 550, 652, 546, 728, 779, 222, 550, 556, 550, 779, 667, 667, 843, 544, 708, 667, 278, 278, 500, 1066, 982, 844, 589, 715, 639, 724, 667, 651, 667, 544, 704, 667, 917, 614, 715, 715, 589, 686, 833, 722, 778, 725, 667, 722, 611, 639, 795, 667, 727, 673, 920, 923, 805, 886, 651, 694, 1022, 682, 556, 562, 522, 493, 553, 556, 688, 465, 556, 556, 472, 564, 686, 550, 556, 556, 556, 500, 833, 500, 835, 500, 572, 518, 830, 851, 621, 736, 526, 492, 752, 534, 556, 556, 556, 378, 496, 500, 222, 222, 222, 910, 828, 556, 472, 565, 500, 556, 778, 556, 492, 339, 944, 722, 944, 722, 944, 722, 667, 500, 333, 333, 556, 1000, 1000, 552, 222, 222, 222, 222, 333, 333, 333, 556, 556, 350, 1000, 1000, 188, 354, 333, 333, 500, 333, 167, 365, 556, 556, 1094, 556, 885, 323, 1083, 1000, 768, 600, 834, 834, 834, 834, 1000, 500, 998, 500, 1000, 500, 500, 494, 612, 823, 713, 584, 549, 713, 979, 719, 274, 549, 549, 584, 549, 549, 604, 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354, 1000, 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052, 917, 750, 750, 531, 656, 594, 510, 500, 750, 750, 500, 500, 333, 333, 333, 333, 333, 333, 333, 333, 222, 222, 294, 294, 324, 324, 316, 328, 398, 285]; 34887const LiberationSansItalicMapping = [-1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713, 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811, 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359, 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542, 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721, 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805, 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642, 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689, 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834, 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]; 34888const LiberationSansRegularWidths = [365, 0, 333, 278, 278, 355, 556, 556, 889, 667, 191, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 278, 278, 584, 584, 584, 556, 1015, 667, 667, 722, 722, 667, 611, 778, 722, 278, 500, 667, 556, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 278, 278, 278, 469, 556, 333, 556, 556, 500, 556, 556, 278, 556, 556, 222, 222, 500, 222, 833, 556, 556, 556, 556, 333, 500, 278, 556, 500, 722, 500, 500, 500, 334, 260, 334, 584, 333, 556, 556, 556, 556, 260, 556, 333, 737, 370, 556, 584, 737, 552, 400, 549, 333, 333, 333, 576, 537, 278, 333, 333, 365, 556, 834, 834, 834, 611, 667, 667, 667, 667, 667, 667, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 500, 556, 556, 556, 556, 278, 278, 278, 278, 556, 556, 556, 556, 556, 556, 556, 549, 611, 556, 556, 556, 556, 500, 556, 500, 667, 556, 667, 556, 667, 556, 722, 500, 722, 500, 722, 500, 722, 500, 722, 615, 722, 556, 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 556, 778, 556, 778, 556, 778, 556, 722, 556, 722, 556, 278, 278, 278, 278, 278, 278, 278, 222, 278, 278, 735, 444, 500, 222, 667, 500, 500, 556, 222, 556, 222, 556, 292, 556, 334, 556, 222, 722, 556, 722, 556, 722, 556, 604, 723, 556, 778, 556, 778, 556, 778, 556, 1000, 944, 722, 333, 722, 333, 722, 333, 667, 500, 667, 500, 667, 500, 667, 500, 611, 278, 611, 375, 611, 278, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 944, 722, 667, 500, 667, 611, 500, 611, 500, 611, 500, 222, 556, 667, 556, 1000, 889, 778, 611, 667, 500, 611, 278, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 667, 278, 784, 838, 384, 774, 855, 752, 222, 667, 667, 551, 668, 667, 611, 722, 778, 278, 667, 668, 833, 722, 650, 778, 722, 667, 618, 611, 667, 798, 667, 835, 748, 278, 667, 578, 446, 556, 222, 547, 578, 575, 500, 557, 446, 441, 556, 556, 222, 500, 500, 576, 500, 448, 556, 690, 569, 482, 617, 395, 547, 648, 525, 713, 781, 222, 547, 556, 547, 781, 667, 667, 865, 542, 719, 667, 278, 278, 500, 1057, 1010, 854, 583, 722, 635, 719, 667, 656, 667, 542, 677, 667, 923, 604, 719, 719, 583, 656, 833, 722, 778, 719, 667, 722, 611, 635, 760, 667, 740, 667, 917, 938, 792, 885, 656, 719, 1010, 722, 556, 573, 531, 365, 583, 556, 669, 458, 559, 559, 438, 583, 688, 552, 556, 542, 556, 500, 458, 500, 823, 500, 573, 521, 802, 823, 625, 719, 521, 510, 750, 542, 556, 556, 556, 365, 510, 500, 222, 278, 222, 906, 812, 556, 438, 559, 500, 552, 778, 556, 489, 411, 944, 722, 944, 722, 944, 722, 667, 500, 333, 333, 556, 1000, 1000, 552, 222, 222, 222, 222, 333, 333, 333, 556, 556, 350, 1000, 1000, 188, 354, 333, 333, 500, 333, 167, 365, 556, 556, 1094, 556, 885, 323, 1073, 1000, 768, 600, 834, 834, 834, 834, 1000, 500, 1000, 500, 1000, 500, 500, 494, 612, 823, 713, 584, 549, 713, 979, 719, 274, 549, 549, 583, 549, 549, 604, 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354, 1000, 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052, 917, 750, 750, 531, 656, 594, 510, 500, 750, 750, 500, 500, 333, 333, 333, 333, 333, 333, 333, 333, 222, 222, 294, 294, 324, 324, 316, 328, 398, 285]; 34889const LiberationSansRegularMapping = [-1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713, 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811, 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359, 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542, 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721, 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805, 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642, 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689, 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834, 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]; 34890 34891;// ./src/core/myriadpro_factors.js 34892const MyriadProBoldFactors = [1.36898, 1, 1, 0.72706, 0.80479, 0.83734, 0.98894, 0.99793, 0.9897, 0.93884, 0.86209, 0.94292, 0.94292, 1.16661, 1.02058, 0.93582, 0.96694, 0.93582, 1.19137, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.78076, 0.78076, 1.02058, 1.02058, 1.02058, 0.72851, 0.78966, 0.90838, 0.83637, 0.82391, 0.96376, 0.80061, 0.86275, 0.8768, 0.95407, 1.0258, 0.73901, 0.85022, 0.83655, 1.0156, 0.95546, 0.92179, 0.87107, 0.92179, 0.82114, 0.8096, 0.89713, 0.94438, 0.95353, 0.94083, 0.91905, 0.90406, 0.9446, 0.94292, 1.18777, 0.94292, 1.02058, 0.89903, 0.90088, 0.94938, 0.97898, 0.81093, 0.97571, 0.94938, 1.024, 0.9577, 0.95933, 0.98621, 1.0474, 0.97455, 0.98981, 0.9672, 0.95933, 0.9446, 0.97898, 0.97407, 0.97646, 0.78036, 1.10208, 0.95442, 0.95298, 0.97579, 0.9332, 0.94039, 0.938, 0.80687, 1.01149, 0.80687, 1.02058, 0.80479, 0.99793, 0.99793, 0.99793, 0.99793, 1.01149, 1.00872, 0.90088, 0.91882, 1.0213, 0.8361, 1.02058, 0.62295, 0.54324, 0.89022, 1.08595, 1, 1, 0.90088, 1, 0.97455, 0.93582, 0.90088, 1, 1.05686, 0.8361, 0.99642, 0.99642, 0.99642, 0.72851, 0.90838, 0.90838, 0.90838, 0.90838, 0.90838, 0.90838, 0.868, 0.82391, 0.80061, 0.80061, 0.80061, 0.80061, 1.0258, 1.0258, 1.0258, 1.0258, 0.97484, 0.95546, 0.92179, 0.92179, 0.92179, 0.92179, 0.92179, 1.02058, 0.92179, 0.94438, 0.94438, 0.94438, 0.94438, 0.90406, 0.86958, 0.98225, 0.94938, 0.94938, 0.94938, 0.94938, 0.94938, 0.94938, 0.9031, 0.81093, 0.94938, 0.94938, 0.94938, 0.94938, 0.98621, 0.98621, 0.98621, 0.98621, 0.93969, 0.95933, 0.9446, 0.9446, 0.9446, 0.9446, 0.9446, 1.08595, 0.9446, 0.95442, 0.95442, 0.95442, 0.95442, 0.94039, 0.97898, 0.94039, 0.90838, 0.94938, 0.90838, 0.94938, 0.90838, 0.94938, 0.82391, 0.81093, 0.82391, 0.81093, 0.82391, 0.81093, 0.82391, 0.81093, 0.96376, 0.84313, 0.97484, 0.97571, 0.80061, 0.94938, 0.80061, 0.94938, 0.80061, 0.94938, 0.80061, 0.94938, 0.80061, 0.94938, 0.8768, 0.9577, 0.8768, 0.9577, 0.8768, 0.9577, 1, 1, 0.95407, 0.95933, 0.97069, 0.95933, 1.0258, 0.98621, 1.0258, 0.98621, 1.0258, 0.98621, 1.0258, 0.98621, 1.0258, 0.98621, 0.887, 1.01591, 0.73901, 1.0474, 1, 1, 0.97455, 0.83655, 0.98981, 1, 1, 0.83655, 0.73977, 0.83655, 0.73903, 0.84638, 1.033, 0.95546, 0.95933, 1, 1, 0.95546, 0.95933, 0.8271, 0.95417, 0.95933, 0.92179, 0.9446, 0.92179, 0.9446, 0.92179, 0.9446, 0.936, 0.91964, 0.82114, 0.97646, 1, 1, 0.82114, 0.97646, 0.8096, 0.78036, 0.8096, 0.78036, 1, 1, 0.8096, 0.78036, 1, 1, 0.89713, 0.77452, 0.89713, 1.10208, 0.94438, 0.95442, 0.94438, 0.95442, 0.94438, 0.95442, 0.94438, 0.95442, 0.94438, 0.95442, 0.94438, 0.95442, 0.94083, 0.97579, 0.90406, 0.94039, 0.90406, 0.9446, 0.938, 0.9446, 0.938, 0.9446, 0.938, 1, 0.99793, 0.90838, 0.94938, 0.868, 0.9031, 0.92179, 0.9446, 1, 1, 0.89713, 1.10208, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90989, 0.9358, 0.91945, 0.83181, 0.75261, 0.87992, 0.82976, 0.96034, 0.83689, 0.97268, 1.0078, 0.90838, 0.83637, 0.8019, 0.90157, 0.80061, 0.9446, 0.95407, 0.92436, 1.0258, 0.85022, 0.97153, 1.0156, 0.95546, 0.89192, 0.92179, 0.92361, 0.87107, 0.96318, 0.89713, 0.93704, 0.95638, 0.91905, 0.91709, 0.92796, 1.0258, 0.93704, 0.94836, 1.0373, 0.95933, 1.0078, 0.95871, 0.94836, 0.96174, 0.92601, 0.9498, 0.98607, 0.95776, 0.95933, 1.05453, 1.0078, 0.98275, 0.9314, 0.95617, 0.91701, 1.05993, 0.9446, 0.78367, 0.9553, 1, 0.86832, 1.0128, 0.95871, 0.99394, 0.87548, 0.96361, 0.86774, 1.0078, 0.95871, 0.9446, 0.95871, 0.86774, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.94083, 0.97579, 0.94083, 0.97579, 0.94083, 0.97579, 0.90406, 0.94039, 0.96694, 1, 0.89903, 1, 1, 1, 0.93582, 0.93582, 0.93582, 1, 0.908, 0.908, 0.918, 0.94219, 0.94219, 0.96544, 1, 1.285, 1, 1, 0.81079, 0.81079, 1, 1, 0.74854, 1, 1, 1, 1, 0.99793, 1, 1, 1, 0.65, 1, 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.17173, 1, 0.80535, 0.76169, 1.02058, 1.0732, 1.05486, 1, 1, 1.30692, 1.08595, 1.08595, 1, 1.08595, 1.08595, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.16161, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 34893const MyriadProBoldMetrics = { 34894 lineHeight: 1.2, 34895 lineGap: 0.2 34896}; 34897const MyriadProBoldItalicFactors = [1.36898, 1, 1, 0.66227, 0.80779, 0.81625, 0.97276, 0.97276, 0.97733, 0.92222, 0.83266, 0.94292, 0.94292, 1.16148, 1.02058, 0.93582, 0.96694, 0.93582, 1.17337, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.78076, 0.78076, 1.02058, 1.02058, 1.02058, 0.71541, 0.76813, 0.85576, 0.80591, 0.80729, 0.94299, 0.77512, 0.83655, 0.86523, 0.92222, 0.9862
vendor: 1,447 bytes, line 34897
348971, 0.71743, 0.81698, 0.79726, 0.98558, 0.92222, 0.90637, 0.83809, 0.90637, 0.80729, 0.76463, 0.86275, 0.90699, 0.91605, 0.9154, 0.85308, 0.85458, 0.90531, 0.94292, 1.21296, 0.94292, 1.02058, 0.89903, 1.18616, 0.99613, 0.91677, 0.78216, 0.91677, 0.90083, 0.98796, 0.9135, 0.92168, 0.95381, 0.98981, 0.95298, 0.95381, 0.93459, 0.92168, 0.91513, 0.92004, 0.91677, 0.95077, 0.748, 1.04502, 0.91677, 0.92061, 0.94236, 0.89544, 0.89364, 0.9, 0.80687, 0.8578, 0.80687, 1.02058, 0.80779, 0.97276, 0.97276, 0.97276, 0.97276, 0.8578, 0.99973, 1.18616, 0.91339, 1.08074, 0.82891, 1.02058, 0.55509, 0.71526, 0.89022, 1.08595, 1, 1, 1.18616, 1, 0.96736, 0.93582, 1.18616, 1, 1.04864, 0.82711, 0.99043, 0.99043, 0.99043, 0.71541, 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.845, 0.80729, 0.77512, 0.77512, 0.77512, 0.77512, 0.98621, 0.98621, 0.98621, 0.98621, 0.95961, 0.92222, 0.90637, 0.90637, 0.90637, 0.90637, 0.90637, 1.02058, 0.90251, 0.90699, 0.90699, 0.90699, 0.90699, 0.85458, 0.83659, 0.94951, 0.99613, 0.99613, 0.99613, 0.99613, 0.99613, 0.99613, 0.85811, 0.78216, 0.90083, 0.90083, 0.90083, 0.90083, 0.95381, 0.95381, 0.95381, 0.95381, 0.9135, 0.92168, 0.91513, 0.91513, 0.91513, 0.91513, 0.91513, 1.08595, 0.91677, 0.91677, 0.91677, 0.91677, 0.91677, 0.89364, 0.92332, 0.89364, 0.85576, 0.99613, 0.85576, 0.99613, 0.85576, 0.99613, 0.80729, 0.78216, 0.80729, 0.78216, 0.80729, 0.78216, 0.80729, 0.78216, 0.94299, 0.76783, 0.95961, 0.916
vendor: 29,736 bytes, lines 34897-34929
3489777, 0.77512, 0.90083, 0.77512, 0.90083, 0.77512, 0.90083, 0.77512, 0.90083, 0.77512, 0.90083, 0.86523, 0.9135, 0.86523, 0.9135, 0.86523, 0.9135, 1, 1, 0.92222, 0.92168, 0.92222, 0.92168, 0.98621, 0.95381, 0.98621, 0.95381, 0.98621, 0.95381, 0.98621, 0.95381, 0.98621, 0.95381, 0.86036, 0.97096, 0.71743, 0.98981, 1, 1, 0.95298, 0.79726, 0.95381, 1, 1, 0.79726, 0.6894, 0.79726, 0.74321, 0.81691, 1.0006, 0.92222, 0.92168, 1, 1, 0.92222, 0.92168, 0.79464, 0.92098, 0.92168, 0.90637, 0.91513, 0.90637, 0.91513, 0.90637, 0.91513, 0.909, 0.87514, 0.80729, 0.95077, 1, 1, 0.80729, 0.95077, 0.76463, 0.748, 0.76463, 0.748, 1, 1, 0.76463, 0.748, 1, 1, 0.86275, 0.72651, 0.86275, 1.04502, 0.90699, 0.91677, 0.90699, 0.91677, 0.90699, 0.91677, 0.90699, 0.91677, 0.90699, 0.91677, 0.90699, 0.91677, 0.9154, 0.94236, 0.85458, 0.89364, 0.85458, 0.90531, 0.9, 0.90531, 0.9, 0.90531, 0.9, 1, 0.97276, 0.85576, 0.99613, 0.845, 0.85811, 0.90251, 0.91677, 1, 1, 0.86275, 1.04502, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.00899, 1.30628, 0.85576, 0.80178, 0.66862, 0.7927, 0.69323, 0.88127, 0.72459, 0.89711, 0.95381, 0.85576, 0.80591, 0.7805, 0.94729, 0.77512, 0.90531, 0.92222, 0.90637, 0.98621, 0.81698, 0.92655, 0.98558, 0.92222, 0.85359, 0.90637, 0.90976, 0.83809, 0.94523, 0.86275, 0.83509, 0.93157, 0.85308, 0.83392, 0.92346, 0.98621, 0.83509, 0.92886, 0.91324, 0.92168, 0.95381, 0.90646, 0.92886, 0.90557, 0.86847, 0.90276, 0.91324, 0.86842, 0.92168, 0.99531, 0.95381, 0.9224, 0.85408, 0.92699, 0.86847, 1.0051, 0.91513, 0.80487, 0.93481, 1, 0.88159, 1.05214, 0.90646, 0.97355, 0.81539, 0.89398, 0.85923, 0.95381, 0.90646, 0.91513, 0.90646, 0.85923, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9154, 0.94236, 0.9154, 0.94236, 0.9154, 0.94236, 0.85458, 0.89364, 0.96694, 1, 0.89903, 1, 1, 1, 0.91782, 0.91782, 0.91782, 1, 0.896, 0.896, 0.896, 0.9332, 0.9332, 0.95973, 1, 1.26, 1, 1, 0.80479, 0.80178, 1, 1, 0.85633, 1, 1, 1, 1, 0.97276, 1, 1, 1, 0.698, 1, 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.14542, 1, 0.79199, 0.78694, 1.02058, 1.03493, 1.05486, 1, 1, 1.23026, 1.08595, 1.08595, 1, 1.08595, 1.08595, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.20006, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 34898const MyriadProBoldItalicMetrics = { 34899 lineHeight: 1.2, 34900 lineGap: 0.2 34901}; 34902const MyriadProItalicFactors = [1.36898, 1, 1, 0.65507, 0.84943, 0.85639, 0.88465, 0.88465, 0.86936, 0.88307, 0.86948, 0.85283, 0.85283, 1.06383, 1.02058, 0.75945, 0.9219, 0.75945, 1.17337, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.75945, 0.75945, 1.02058, 1.02058, 1.02058, 0.69046, 0.70926, 0.85158, 0.77812, 0.76852, 0.89591, 0.70466, 0.76125, 0.80094, 0.86822, 0.83864, 0.728, 0.77212, 0.79475, 0.93637, 0.87514, 0.8588, 0.76013, 0.8588, 0.72421, 0.69866, 0.77598, 0.85991, 0.80811, 0.87832, 0.78112, 0.77512, 0.8562, 1.0222, 1.18417, 1.0222, 1.27014, 0.89903, 1.15012, 0.93859, 0.94399, 0.846, 0.94399, 0.81453, 1.0186, 0.94219, 0.96017, 1.03075, 1.02175, 0.912, 1.03075, 0.96998, 0.96017, 0.93859, 0.94399, 0.94399, 0.95493, 0.746, 1.12658, 0.94578, 0.91, 0.979, 0.882, 0.882, 0.83, 0.85034, 0.83537, 0.85034, 1.02058, 0.70869, 0.88465, 0.88465, 0.88465, 0.88465, 0.83537, 0.90083, 1.15012, 0.9161, 0.94565, 0.73541, 1.02058, 0.53609, 0.69353, 0.79519, 1.08595, 1, 1, 1.15012, 1, 0.91974, 0.75945, 1.15012, 1, 0.9446, 0.73361, 0.9005, 0.9005, 0.9005, 0.62864, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.773, 0.76852, 0.70466, 0.70466, 0.70466, 0.70466, 0.83864, 0.83864, 0.83864, 0.83864, 0.90561, 0.87514, 0.8588, 0.8588, 0.8588, 0.8588, 0.8588, 1.02058, 0.85751, 0.85991, 0.85991, 0.85991, 0.85991, 0.77512, 0.76013, 0.88075, 0.93859, 0.93859, 0.93859, 0.93859, 0.93859, 0.93859, 0.8075, 0.846, 0.81453, 0.81453, 0.81453, 0.81453, 0.82424, 0.82424, 0.82424, 0.82424, 0.9278, 0.96017, 0.93859, 0.93859, 0.93859, 0.93859, 0.93859, 1.08595, 0.8562, 0.94578, 0.94578, 0.94578, 0.94578, 0.882, 0.94578, 0.882, 0.85158, 0.93859, 0.85158, 0.93859, 0.85158, 0.93859, 0.76852, 0.846, 0.76852, 0.846, 0.76852, 0.846, 0.76852, 0.846, 0.89591, 0.8544, 0.90561, 0.94399, 0.70466, 0.81453, 0.70466, 0.81453, 0.70466, 0.81453, 0.70466, 0.81453, 0.70466, 0.81453, 0.80094, 0.94219, 0.80094, 0.94219, 0.80094, 0.94219, 1, 1, 0.86822, 0.96017, 0.86822, 0.96017, 0.83864, 0.82424, 0.83864, 0.82424, 0.83864, 0.82424, 0.83864, 1.03075, 0.83864, 0.82424, 0.81402, 1.02738, 0.728, 1.02175, 1, 1, 0.912, 0.79475, 1.03075, 1, 1, 0.79475, 0.83911, 0.79475, 0.66266, 0.80553, 1.06676, 0.87514, 0.96017, 1, 1, 0.87514, 0.96017, 0.86865, 0.87396, 0.96017, 0.8588, 0.93859, 0.8588, 0.93859, 0.8588, 0.93859, 0.867, 0.84759, 0.72421, 0.95493, 1, 1, 0.72421, 0.95493, 0.69866, 0.746, 0.69866, 0.746, 1, 1, 0.69866, 0.746, 1, 1, 0.77598, 0.88417, 0.77598, 1.12658, 0.85991, 0.94578, 0.85991, 0.94578, 0.85991, 0.94578, 0.85991, 0.94578, 0.85991, 0.94578, 0.85991, 0.94578, 0.87832, 0.979, 0.77512, 0.882, 0.77512, 0.8562, 0.83, 0.8562, 0.83, 0.8562, 0.83, 1, 0.88465, 0.85158, 0.93859, 0.773, 0.8075, 0.85751, 0.8562, 1, 1, 0.77598, 1.12658, 1.15012, 1.15012, 1.15012, 1.15012, 1.15012, 1.15313, 1.15012, 1.15012, 1.15012, 1.08106, 1.03901, 0.85158, 0.77025, 0.62264, 0.7646, 0.65351, 0.86026, 0.69461, 0.89947, 1.03075, 0.85158, 0.77812, 0.76449, 0.88836, 0.70466, 0.8562, 0.86822, 0.8588, 0.83864, 0.77212, 0.85308, 0.93637, 0.87514, 0.82352, 0.8588, 0.85701, 0.76013, 0.89058, 0.77598, 0.8156, 0.82565, 0.78112, 0.77899, 0.89386, 0.83864, 0.8156, 0.9486, 0.92388, 0.96186, 1.03075, 0.91123, 0.9486, 0.93298, 0.878, 0.93942, 0.92388, 0.84596, 0.96186, 0.95119, 1.03075, 0.922, 0.88787, 0.95829, 0.88, 0.93559, 0.93859, 0.78815, 0.93758, 1, 0.89217, 1.03737, 0.91123, 0.93969, 0.77487, 0.85769, 0.86799, 1.03075, 0.91123, 0.93859, 0.91123, 0.86799, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.87832, 0.979, 0.87832, 0.979, 0.87832, 0.979, 0.77512, 0.882, 0.9219, 1, 0.89903, 1, 1, 1, 0.87321, 0.87321, 0.87321, 1, 1.027, 1.027, 1.027, 0.86847, 0.86847, 0.79121, 1, 1.124, 1, 1, 0.73572, 0.73572, 1, 1, 0.85034, 1, 1, 1, 1, 0.88465, 1, 1, 1, 0.669, 1, 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.04828, 1, 0.74948, 0.75187, 1.02058, 0.98391, 1.02119, 1, 1, 1.06233, 1.08595, 1.08595, 1, 1.08595, 1.08595, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.05233, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 34903const MyriadProItalicMetrics = { 34904 lineHeight: 1.2, 34905 lineGap: 0.2 34906}; 34907const MyriadProRegularFactors = [1.36898, 1, 1, 0.76305, 0.82784, 0.94935, 0.89364, 0.92241, 0.89073, 0.90706, 0.98472, 0.85283, 0.85283, 1.0664, 1.02058, 0.74505, 0.9219, 0.74505, 1.23456, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.74505, 0.74505, 1.02058, 1.02058, 1.02058, 0.73002, 0.72601, 0.91755, 0.8126, 0.80314, 0.92222, 0.73764, 0.79726, 0.83051, 0.90284, 0.86023, 0.74, 0.8126, 0.84869, 0.96518, 0.91115, 0.8858, 0.79761, 0.8858, 0.74498, 0.73914, 0.81363, 0.89591, 0.83659, 0.89633, 0.85608, 0.8111, 0.90531, 1.0222, 1.22736, 1.0222, 1.27014, 0.89903, 0.90088, 0.86667, 1.0231, 0.896, 1.01411, 0.90083, 1.05099, 1.00512, 0.99793, 1.05326, 1.09377, 0.938, 1.06226, 1.00119, 0.99793, 0.98714, 1.0231, 1.01231, 0.98196, 0.792, 1.19137, 0.99074, 0.962, 1.01915, 0.926, 0.942, 0.856, 0.85034, 0.92006, 0.85034, 1.02058, 0.69067, 0.92241, 0.92241, 0.92241, 0.92241, 0.92006, 0.9332, 0.90088, 0.91882, 0.93484, 0.75339, 1.02058, 0.56866, 0.54324, 0.79519, 1.08595, 1, 1, 0.90088, 1, 0.95325, 0.74505, 0.90088, 1, 0.97198, 0.75339, 0.91009, 0.91009, 0.91009, 0.66466, 0.91755, 0.91755, 0.91755, 0.91755, 0.91755, 0.91755, 0.788, 0.80314, 0.73764, 0.73764, 0.73764, 0.73764, 0.86023, 0.86023, 0.86023, 0.86023, 0.92915, 0.91115, 0.8858, 0.8858, 0.8858, 0.8858, 0.8858, 1.02058, 0.8858, 0.89591, 0.89591, 0.89591, 0.89591, 0.8111, 0.79611, 0.89713, 0.86667, 0.86667, 0.86667, 0.86667, 0.86667, 0.86667, 0.86936, 0.896, 0.90083, 0.90083, 0.90083, 0.90083, 0.84224, 0.84224, 0.84224, 0.84224, 0.97276, 0.99793, 0.98714, 0.98714, 0.98714, 0.98714, 0.98714, 1.08595, 0.89876, 0.99074, 0.99074, 0.99074, 0.99074, 0.942, 1.0231, 0.942, 0.91755, 0.86667, 0.91755, 0.86667, 0.91755, 0.86667, 0.80314, 0.896, 0.80314, 0.896, 0.80314, 0.896, 0.80314, 0.896, 0.92222, 0.93372, 0.92915, 1.01411, 0.73764, 0.90083, 0.73764, 0.90083, 0.73764, 0.90083, 0.73764, 0.90083, 0.73764, 0.90083, 0.83051, 1.00512, 0.83051, 1.00512, 0.83051, 1.00512, 1, 1, 0.90284, 0.99793, 0.90976, 0.99793, 0.86023, 0.84224, 0.86023, 0.84224, 0.86023, 0.84224, 0.86023, 1.05326, 0.86023, 0.84224, 0.82873, 1.07469, 0.74, 1.09377, 1, 1, 0.938, 0.84869, 1.06226, 1, 1, 0.84869, 0.83704, 0.84869, 0.81441, 0.85588, 1.08927, 0.91115, 0.99793, 1, 1, 0.91115, 0.99793, 0.91887, 0.90991, 0.99793, 0.8858, 0.98714, 0.8858, 0.98714, 0.8858, 0.98714, 0.894, 0.91434, 0.74498, 0.98196, 1, 1, 0.74498, 0.98196, 0.73914, 0.792, 0.73914, 0.792, 1, 1, 0.73914, 0.792, 1, 1, 0.81363, 0.904, 0.81363, 1.19137, 0.89591, 0.99074, 0.89591, 0.99074, 0.89591, 0.99074, 0.89591, 0.99074, 0.89591, 0.99074, 0.89591, 0.99074, 0.89633, 1.01915, 0.8111, 0.942, 0.8111, 0.90531, 0.856, 0.90531, 0.856, 0.90531, 0.856, 1, 0.92241, 0.91755, 0.86667, 0.788, 0.86936, 0.8858, 0.89876, 1, 1, 0.81363, 1.19137, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90388, 1.03901, 0.92138, 0.78105, 0.7154, 0.86169, 0.80513, 0.94007, 0.82528, 0.98612, 1.06226, 0.91755, 0.8126, 0.81884, 0.92819, 0.73764, 0.90531, 0.90284, 0.8858, 0.86023, 0.8126, 0.91172, 0.96518, 0.91115, 0.83089, 0.8858, 0.87791, 0.79761, 0.89297, 0.81363, 0.88157, 0.89992, 0.85608, 0.81992, 0.94307, 0.86023, 0.88157, 0.95308, 0.98699, 0.99793, 1.06226, 0.95817, 0.95308, 0.97358, 0.928, 0.98088, 0.98699, 0.92761, 0.99793, 0.96017, 1.06226, 0.986, 0.944, 0.95978, 0.938, 0.96705, 0.98714, 0.80442, 0.98972, 1, 0.89762, 1.04552, 0.95817, 0.99007, 0.87064, 0.91879, 0.88888, 1.06226, 0.95817, 0.98714, 0.95817, 0.88888, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.89633, 1.01915, 0.89633, 1.01915, 0.89633, 1.01915, 0.8111, 0.942, 0.9219, 1, 0.89903, 1, 1, 1, 0.93173, 0.93173, 0.93173, 1, 1.06304, 1.06304, 1.06904, 0.89903, 0.89903, 0.80549, 1, 1.156, 1, 1, 0.76575, 0.76575, 1, 1, 0.72458, 1, 1, 1, 1, 0.92241, 1, 1, 1, 0.619, 1, 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.07257, 1, 0.74705, 0.71119, 1.02058, 1.024, 1.02119, 1, 1, 1.1536, 1.08595, 1.08595, 1, 1.08595, 1.08595, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.05638, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 34908const MyriadProRegularMetrics = { 34909 lineHeight: 1.2, 34910 lineGap: 0.2 34911}; 34912 34913;// ./src/core/segoeui_factors.js 34914const SegoeuiBoldFactors = [1.76738, 1, 1, 0.99297, 0.9824, 1.04016, 1.06497, 1.03424, 0.97529, 1.17647, 1.23203, 1.1085, 1.1085, 1.16939, 1.2107, 0.9754, 1.21408, 0.9754, 1.59578, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 0.81378, 0.81378, 1.2107, 1.2107, 1.2107, 0.71703, 0.97847, 0.97363, 0.88776, 0.8641, 1.02096, 0.79795, 0.85132, 0.914, 1.06085, 1.1406, 0.8007, 0.89858, 0.83693, 1.14889, 1.09398, 0.97489, 0.92094, 0.97489, 0.90399, 0.84041, 0.95923, 1.00135, 1, 1.06467, 0.98243, 0.90996, 0.99361, 1.1085, 1.56942, 1.1085, 1.2107, 0.74627, 0.94282, 0.96752, 1.01519, 0.86304, 1.01359, 0.97278, 1.15103, 1.01359, 0.98561, 1.02285, 1.02285, 1.00527, 1.02285, 1.0302, 0.99041, 1.0008, 1.01519, 1.01359, 1.02258, 0.79104, 1.16862, 0.99041, 0.97454, 1.02511, 0.99298, 0.96752, 0.95801, 0.94856, 1.16579, 0.94856, 1.2107, 0.9824, 1.03424, 1.03424, 1, 1.03424, 1.16579, 0.8727, 1.3871, 1.18622, 1.10818, 1.04478, 1.2107, 1.18622, 0.75155, 0.94994, 1.28826, 1.21408, 1.21408, 0.91056, 1, 0.91572, 0.9754, 0.64663, 1.18328, 1.24866, 1.04478, 1.14169, 1.15749, 1.17389, 0.71703, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.93506, 0.8641, 0.79795, 0.79795, 0.79795, 0.79795, 1.1406, 1.1406, 1.1406, 1.1406, 1.02096, 1.09398, 0.97426, 0.97426, 0.97426, 0.97426, 0.97426, 1.2107, 0.97489, 1.00135, 1.00135, 1.00135, 1.00135, 0.90996, 0.92094, 1.02798, 0.96752, 0.96752, 0.96752, 0.96752, 0.96752, 0.96752, 0.93136, 0.86304, 0.97278, 0.97278, 0.97278, 0.97278, 1.02285, 1.02285, 1.02285, 1.02285, 0.97122, 0.99041, 1, 1, 1, 1, 1, 1.28826, 1.0008, 0.99041, 0.99041, 0.99041, 0.99041, 0.96752, 1.01519, 0.96752, 0.97363, 0.96752, 0.97363, 0.96752, 0.97363, 0.96752, 0.8641, 0.86304, 0.8641, 0.86304, 0.8641, 0.86304, 0.8641, 0.86304, 1.02096, 1.03057, 1.02096, 1.03517, 0.79795, 0.97278, 0.79795, 0.97278, 0.79795, 0.97278, 0.79795, 0.97278, 0.79795, 0.97278, 0.914, 1.01359, 0.914, 1.01359, 0.914, 1.01359, 1, 1, 1.06085, 0.98561, 1.06085, 1.00879, 1.1406, 1.02285, 1.1406, 1.02285, 1.1406, 1.02285, 1.1406, 1.02285, 1.1406, 1.02285, 0.97138, 1.08692, 0.8007, 1.02285, 1, 1, 1.00527, 0.83693, 1.02285, 1, 1, 0.83693, 0.9455, 0.83693, 0.90418, 0.83693, 1.13005, 1.09398, 0.99041, 1, 1, 1.09398, 0.99041, 0.96692, 1.09251, 0.99041, 0.97489, 1.0008, 0.97489, 1.0008, 0.97489, 1.0008, 0.93994, 0.97931, 0.90399, 1.02258, 1, 1, 0.90399, 1.02258, 0.84041, 0.79104, 0.84041, 0.79104, 0.84041, 0.79104, 0.84041, 0.79104, 1, 1, 0.95923, 1.07034, 0.95923, 1.16862, 1.00135, 0.99041, 1.00135, 0.99041, 1.00135, 0.99041, 1.00135, 0.99041, 1.00135, 0.99041, 1.00135, 0.99041, 1.06467, 1.02511, 0.90996, 0.96752, 0.90996, 0.99361, 0.95801, 0.99361, 0.95801, 0.99361, 0.95801, 1.07733, 1.03424, 0.97363, 0.96752, 0.93506, 0.93136, 0.97489, 1.0008, 1, 1, 0.95923, 1.16862, 1.15103, 1.15103, 1.01173, 1.03959, 0.75953, 0.81378, 0.79912, 1.15103, 1.21994, 0.95161, 0.87815, 1.01149, 0.81525, 0.7676, 0.98167, 1.01134, 1.02546, 0.84097, 1.03089, 1.18102, 0.97363, 0.88776, 0.85134, 0.97826, 0.79795, 0.99361, 1.06085, 0.97489, 1.1406, 0.89858, 1.0388, 1.14889, 1.09398, 0.86039, 0.97489, 1.0595, 0.92094, 0.94793, 0.95923, 0.90996, 0.99346, 0.98243, 1.02112, 0.95493, 1.1406, 0.90996, 1.03574, 1.02597, 1.0008, 1.18102, 1.06628, 1.03574, 1.0192, 1.01932, 1.00886, 0.97531, 1.0106, 1.0008, 1.13189, 1.18102, 1.02277, 0.98683, 1.0016, 0.99561, 1.07237, 1.0008, 0.90434, 0.99921, 0.93803, 0.8965, 1.23085, 1.06628, 1.04983, 0.96268, 1.0499, 0.98439, 1.18102, 1.06628, 1.0008, 1.06628, 0.98439, 0.79795, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.09466, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.97278, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.02065, 1, 1, 1, 1, 1, 1, 1.06467, 1.02511, 1.06467, 1.02511, 1.06467, 1.02511, 0.90996, 0.96752, 1, 1.21408, 0.89903, 1, 1, 0.75155, 1.04394, 1.04394, 1.04394, 1.04394, 0.98633, 0.98633, 0.98633, 0.73047, 0.73047, 1.20642, 0.91211, 1.25635, 1.222, 1.02956, 1.03372, 1.03372, 0.96039, 1.24633, 1, 1.12454, 0.93503, 1.03424, 1.19687, 1.03424, 1, 1, 1, 0.771, 1, 1, 1.15749, 1.15749, 1.15749, 1.10948, 0.86279, 0.94434, 0.86279, 0.94434, 0.86182, 1, 1, 1.16897, 1, 0.96085, 0.90137, 1.2107, 1.18416, 1.13973, 0.69825, 0.9716, 2.10339, 1.29004, 1.29004, 1.21172, 1.29004, 1.29004, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.42603, 1, 0.99862, 0.99862, 1, 0.87025, 0.87025, 0.87025, 0.87025, 1.18874, 1.42603, 1, 1.42603, 1.42603, 0.99862, 1, 1, 1, 1, 1, 1.2886, 1.04315, 1.15296, 1.34163, 1, 1, 1, 1.09193, 1.09193, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 34915const SegoeuiBoldMetrics = { 34916 lineHeight: 1.33008, 34917 lineGap: 0 34918}; 34919const SegoeuiBoldItalicFactors = [1.76738, 1, 1, 0.98946, 1.03959, 1.04016, 1.02809, 1.036, 0.97639, 1.10953, 1.23203, 1.11144, 1.11144, 1.16939, 1.21237, 0.9754, 1.21261, 0.9754, 1.59754, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 0.81378, 0.81378, 1.21237, 1.21237, 1.21237, 0.73541, 0.97847, 0.97363, 0.89723, 0.87897, 1.0426, 0.79429, 0.85292, 0.91149, 1.05815, 1.1406, 0.79631, 0.90128, 0.83853, 1.04396, 1.10615, 0.97552, 0.94436, 0.97552, 0.88641, 0.80527, 0.96083, 1.00135, 1, 1.06777, 0.9817, 0.91142, 0.99361, 1.11144, 1.57293, 1.11144, 1.21237, 0.74627, 1.31818, 1.06585, 0.97042, 0.83055, 0.97042, 0.93503, 1.1261, 0.97042, 0.97922, 1.14236, 0.94552, 1.01054, 1.14236, 1.02471, 0.97922, 0.94165, 0.97042, 0.97042, 1.0276, 0.78929, 1.1261, 0.97922, 0.95874, 1.02197, 0.98507, 0.96752, 0.97168, 0.95107, 1.16579, 0.95107, 1.21237, 1.03959, 1.036, 1.036, 1, 1.036, 1.16579, 0.87357, 1.31818, 1.18754, 1.26781, 1.05356, 1.21237, 1.18622, 0.79487, 0.94994, 1.29004, 1.24047, 1.24047, 1.31818, 1, 0.91484, 0.9754, 1.31818, 1.1349, 1.24866, 1.05356, 1.13934, 1.15574, 1.17389, 0.73541, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.94385, 0.87897, 0.79429, 0.79429, 0.79429, 0.79429, 1.1406, 1.1406, 1.1406, 1.1406, 1.0426, 1.10615, 0.97552, 0.97552, 0.97552, 0.97552, 0.97552, 1.21237, 0.97552, 1.00135, 1.00135, 1.00135, 1.00135, 0.91142, 0.94436, 0.98721, 1.06585, 1.06585, 1.06585, 1.06585, 1.06585, 1.06585, 0.96705, 0.83055, 0.93503, 0.93503, 0.93503, 0.93503, 1.14236, 1.14236, 1.14236, 1.14236, 0.93125, 0.97922, 0.94165, 0.94165, 0.94165, 0.94165, 0.94165, 1.29004, 0.94165, 0.97922, 0.97922, 0.97922, 0.97922, 0.96752, 0.97042, 0.96752, 0.97363, 1.06585, 0.97363, 1.06585, 0.97363, 1.06585, 0.87897, 0.83055, 0.87897, 0.83055, 0.87897, 0.83055, 0.87897, 0.83055, 1.0426, 1.0033, 1.0426, 0.97042, 0.79429, 0.93503, 0.79429, 0.93503, 0.79429, 0.93503, 0.79429, 0.93503, 0.79429, 0.93503, 0.91149, 0.97042, 0.91149, 0.97042, 0.91149, 0.97042, 1, 1, 1.05815, 0.97922, 1.05815, 0.97922, 1.1406, 1.14236, 1.1406, 1.14236, 1.1406, 1.14236, 1.1406, 1.14236, 1.1406, 1.14236, 0.97441, 1.04302, 0.79631, 1.01582, 1, 1, 1.01054, 0.83853, 1.14236, 1, 1, 0.83853, 1.09125, 0.83853, 0.90418, 0.83853, 1.19508, 1.10615, 0.97922, 1, 1, 1.10615, 0.97922, 1.01034, 1.10466, 0.97922, 0.97552, 0.94165, 0.97552, 0.94165, 0.97552, 0.94165, 0.91602, 0.91981, 0.88641, 1.0276, 1, 1, 0.88641, 1.0276, 0.80527, 0.78929, 0.80527, 0.78929, 0.80527, 0.78929, 0.80527, 0.78929, 1, 1, 0.96083, 1.05403, 0.95923, 1.16862, 1.00135, 0.97922, 1.00135, 0.97922, 1.00135, 0.97922, 1.00135, 0.97922, 1.00135, 0.97922, 1.00135, 0.97922, 1.06777, 1.02197, 0.91142, 0.96752, 0.91142, 0.99361, 0.97168, 0.99361, 0.97168, 0.99361, 0.97168, 1.23199, 1.036, 0.97363, 1.06585, 0.94385, 0.96705, 0.97552, 0.94165, 1, 1, 0.96083, 1.1261, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 0.95161, 1.27126, 1.00811, 0.83284, 0.77702, 0.99137, 0.95253, 1.0347, 0.86142, 1.07205, 1.14236, 0.97363, 0.89723, 0.86869, 1.09818, 0.79429, 0.99361, 1.05815, 0.97552, 1.1406, 0.90128, 1.06662, 1.04396, 1.10615, 0.84918, 0.97552, 1.04694, 0.94436, 0.98015, 0.96083, 0.91142, 1.00356, 0.9817, 1.01945, 0.98999, 1.1406, 0.91142, 1.04961, 0.9898, 1.00639, 1.14236, 1.07514, 1.04961, 0.99607, 1.02897, 1.008, 0.9898, 0.95134, 1.00639, 1.11121, 1.14236, 1.00518, 0.97981, 1.02186, 1, 1.08578, 0.94165, 0.99314, 0.98387, 0.93028, 0.93377, 1.35125, 1.07514, 1.10687, 0.93491, 1.04232, 1.00351, 1.14236, 1.07514, 0.94165, 1.07514, 1.00351, 0.79429, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.09097, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.93503, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.96609, 1, 1, 1, 1, 1, 1, 1.06777, 1.02197, 1.06777, 1.02197, 1.06777, 1.02197, 0.91142, 0.96752, 1, 1.21261, 0.89903, 1, 1, 0.75155, 1.04745, 1.04745, 1.04745, 1.04394, 0.98633, 0.98633, 0.98633, 0.72959, 0.72959, 1.20502, 0.91406, 1.26514, 1.222, 1.02956, 1.03372, 1.03372, 0.96039, 1.24633, 1, 1.09125, 0.93327, 1.03336, 1.16541, 1.036, 1, 1, 1, 0.771, 1, 1, 1.15574, 1.15574, 1.15574, 1.15574, 0.86364, 0.94434, 0.86279, 0.94434, 0.86224, 1, 1, 1.16798, 1, 0.96085, 0.90068, 1.21237, 1.18416, 1.13904, 0.69825, 0.9716, 2.10339, 1.29004, 1.29004, 1.21339, 1.29004, 1.29004, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.42603, 1, 0.99862, 0.99862, 1, 0.87025, 0.87025, 0.87025, 0.87025, 1.18775, 1.42603, 1, 1.42603, 1.42603, 0.99862, 1, 1, 1, 1, 1, 1.2886, 1.04315, 1.15296, 1.34163, 1, 1, 1, 1.13269, 1.13269, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 34920const SegoeuiBoldItalicMetrics = { 34921 lineHeight: 1.33008, 34922 lineGap: 0 34923}; 34924const SegoeuiItalicFactors = [1.76738, 1, 1, 0.98946, 1.14763, 1.05365, 1.06234, 0.96927, 0.92586, 1.15373, 1.18414, 0.91349, 0.91349, 1.07403, 1.17308, 0.78383, 1.20088, 0.78383, 1.42531, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.78383, 0.78383, 1.17308, 1.17308, 1.17308, 0.77349, 0.94565, 0.94729, 0.85944, 0.88506, 0.9858, 0.74817, 0.80016, 0.88449, 0.98039, 0.95782, 0.69238, 0.89898, 0.83231, 0.98183, 1.03989, 0.96924, 0.86237, 0.96924, 0.80595, 0.74524, 0.86091, 0.95402, 0.94143, 0.98448, 0.8858, 0.83089, 0.93285, 1.0949, 1.39016, 1.0949, 1.45994, 0.74627, 1.04839, 0.97454, 0.97454, 0.87207, 0.97454, 0.87533, 1.06151, 0.97454, 1.00176, 1.16484, 1.08132, 0.98047, 1.16484, 1.02989, 1.01054, 0.96225, 0.97454, 0.97454, 1.06598, 0.79004, 1.16344, 1.00351, 0.94629, 0.9973, 0.91016, 0.96777, 0.9043, 0.91082, 0.92481, 0.91082, 1.17308, 0.95748, 0.96927, 0.96927, 1, 0.96927, 0.92481, 0.80597, 1.04839, 1.23393, 1.1781, 0.9245, 1.17308, 1.20808, 0.63218, 0.94261, 1.24822, 1.09971, 1.09971, 1.04839, 1, 0.85273, 0.78032, 1.04839, 1.09971, 1.22326, 0.9245, 1.09836, 1.13525, 1.15222, 0.70424, 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.85498, 0.88506, 0.74817, 0.74817, 0.74817, 0.74817, 0.95782, 0.95782, 0.95782, 0.95782, 0.9858, 1.03989, 0.96924, 0.96924, 0.96924, 0.96924, 0.96924, 1.17308, 0.96924, 0.95402, 0.95402, 0.95402, 0.95402, 0.83089, 0.86237, 0.88409, 0.97454, 0.97454, 0.97454, 0.97454, 0.97454, 0.97454, 0.92916, 0.87207, 0.87533, 0.87533, 0.87533, 0.87533, 0.93146, 0.93146, 0.93146, 0.93146, 0.93854, 1.01054, 0.96225, 0.96225, 0.96225, 0.96225, 0.96225, 1.24822, 0.8761, 1.00351, 1.00351, 1.00351, 1.00351, 0.96777, 0.97454, 0.96777, 0.94729, 0.97454, 0.94729, 0.97454, 0.94729, 0.97454, 0.88506, 0.87207, 0.88506, 0.87207, 0.88506, 0.87207, 0.88506, 0.87207, 0.9858, 0.95391, 0.9858, 0.97454, 0.74817, 0.87533, 0.74817, 0.87533, 0.74817, 0.87533, 0.74817, 0.87533, 0.74817, 0.87533, 0.88449, 0.97454, 0.88449, 0.97454, 0.88449, 0.97454, 1, 1, 0.98039, 1.00176, 0.98039, 1.00176, 0.95782, 0.93146, 0.95782, 0.93146, 0.95782, 0.93146, 0.95782, 1.16484, 0.95782, 0.93146, 0.84421, 1.12761, 0.69238, 1.08132, 1, 1, 0.98047, 0.83231, 1.16484, 1, 1, 0.84723, 1.04861, 0.84723, 0.78755, 0.83231, 1.23736, 1.03989, 1.01054, 1, 1, 1.03989, 1.01054, 0.9857, 1.03849, 1.01054, 0.96924, 0.96225, 0.96924, 0.96225, 0.96924, 0.96225, 0.92383, 0.90171, 0.80595, 1.06598, 1, 1, 0.80595, 1.06598, 0.74524, 0.79004, 0.74524, 0.79004, 0.74524, 0.79004, 0.74524, 0.79004, 1, 1, 0.86091, 1.02759, 0.85771, 1.16344, 0.95402, 1.00351, 0.95402, 1.00351, 0.95402, 1.00351, 0.95402, 1.00351, 0.95402, 1.00351, 0.95402, 1.00351, 0.98448, 0.9973, 0.83089, 0.96777, 0.83089, 0.93285, 0.9043, 0.93285, 0.9043, 0.93285, 0.9043, 1.31868, 0.96927, 0.94729, 0.97454, 0.85498, 0.92916, 0.96924, 0.8761, 1, 1, 0.86091, 1.16344, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 0.81965, 0.81965, 0.94729, 0.78032, 0.71022, 0.90883, 0.84171, 0.99877, 0.77596, 1.05734, 1.2, 0.94729, 0.85944, 0.82791, 0.9607, 0.74817, 0.93285, 0.98039, 0.96924, 0.95782, 0.89898, 0.98316, 0.98183, 1.03989, 0.78614, 0.96924, 0.97642, 0.86237, 0.86075, 0.86091, 0.83089, 0.90082, 0.8858, 0.97296, 1.01284, 0.95782, 0.83089, 1.0976, 1.04, 1.03342, 1.2, 1.0675, 1.0976, 0.98205, 1.03809, 1.05097, 1.04, 0.95364, 1.03342, 1.05401, 1.2, 1.02148, 1.0119, 1.04724, 1.0127, 1.02732, 0.96225, 0.8965, 0.97783, 0.93574, 0.94818, 1.30679, 1.0675, 1.11826, 0.99821, 1.0557, 1.0326, 1.2, 1.0675, 0.96225, 1.0675, 1.0326, 0.74817, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.03754, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.87533, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.98705, 1, 1, 1, 1, 1, 1, 0.98448, 0.9973, 0.98448, 0.9973, 0.98448, 0.9973, 0.83089, 0.96777, 1, 1.20088, 0.89903, 1, 1, 0.75155, 0.94945, 0.94945, 0.94945, 0.94945, 1.12317, 1.12317, 1.12317, 0.67603, 0.67603, 1.15621, 0.73584, 1.21191, 1.22135, 1.06483, 0.94868, 0.94868, 0.95996, 1.24633, 1, 1.07497, 0.87709, 0.96927, 1.01473, 0.96927, 1, 1, 1, 0.77295, 1, 1, 1.09836, 1.09836, 1.09836, 1.01522, 0.86321, 0.94434, 0.8649, 0.94434, 0.86182, 1, 1, 1.083, 1, 0.91578, 0.86438, 1.17308, 1.18416, 1.14589, 0.69825, 0.97622, 1.96791, 1.24822, 1.24822, 1.17308, 1.24822, 1.24822, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.42603, 1, 0.99862, 0.99862, 1, 0.87025, 0.87025, 0.87025, 0.87025, 1.17984, 1.42603, 1, 1.42603, 1.42603, 0.99862, 1, 1, 1, 1, 1, 1.2886, 1.04315, 1.15296, 1.34163, 1, 1, 1, 1.10742, 1.10742, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 34925const SegoeuiItalicMetrics = { 34926 lineHeight: 1.33008, 34927 lineGap: 0 34928}; 34929const SegoeuiRegularFactors = [1.76738, 1, 1, 0.98594, 1.02285, 1.10454, 1.06234, 0.96927, 0.92037, 1.19985, 1.2046, 0.90616, 0.90616, 1.07152, 1.1714, 0.78032, 1.20088, 0.78032, 1.40246, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.78032, 0.78032, 1.1714, 1.1714, 1.1714, 0.80597, 0.94084, 0.96706, 0.85944, 0.85734, 0.97093, 0.75842, 0.79936, 0.88198, 0.9831, 0.95782, 0.71387, 0.86969, 0.84636, 1.07796, 1.03584, 0.96924, 0.83968, 0.96924, 0.82826, 0.79649, 0.85771, 0.95132, 0.93119, 0.98965, 0.88433, 0.8287, 0.93365, 1.08612, 1.3638, 1.08612, 1.45786, 0.74627, 0.80499, 0.91484, 1.05707, 0.92383, 1.05882, 0.9403, 1.12654, 1.05882, 1.01756, 1.09011, 1.09011, 0.99414, 1.09011, 1.034, 1.01756, 1.05356, 1.05707, 1.05882, 1.04399, 0.84863, 1.21968, 1.01756, 0.95801, 1.00068, 0.91797, 0.96777, 0.9043, 0.90351, 0.92105, 0.90351, 1.1714, 0.85337, 0.96927, 0.96927, 0.99912, 0.96927, 0.92105, 0.80597, 1.2434, 1.20808, 1.05937, 0.90957, 1.1714, 1.20808, 0.75155, 0.94261, 1.24644, 1.09971, 1.09971, 0.84751, 1, 0.85273, 0.78032, 0.61584, 1.05425, 1.17914, 0.90957, 1.08665, 1.11593, 1.14169, 0.73381, 0.96706, 0.96706, 0.96706, 0.96706, 0.96706, 0.96706, 0.86035, 0.85734, 0.75842, 0.75842, 0.75842, 0.75842, 0.95782, 0.95782, 0.95782, 0.95782, 0.97093, 1.03584, 0.96924, 0.96924, 0.96924, 0.96924, 0.96924, 1.1714, 0.96924, 0.95132, 0.95132, 0.95132, 0.95132, 0.8287, 0.83968, 0.89049, 0.91484, 0.91484, 0.91484, 0.91484, 0.91484, 0.91484, 0.93575, 0.92383, 0.9403, 0.9403, 0.9403, 0.9403, 0.8717, 0.8717, 0.8717, 0.8717, 1.00527, 1.01756, 1.05356, 1.05356, 1.05356, 1.05356, 1.05356, 1.24644, 0.95923, 1.01756, 1.01756, 1.01756, 1.01756, 0.96777, 1.05707, 0.96777, 0.96706, 0.91484, 0.96706, 0.91484, 0.96706, 0.91484, 0.85734, 0.92383, 0.85734, 0.92383, 0.85734, 0.92383, 0.85734, 0.92383, 0.97093, 1.0969, 0.97093, 1.05882, 0.75842, 0.9403, 0.75842, 0.9403, 0.75842, 0.9403, 0.75842, 0.9403, 0.75842, 0.9403, 0.88198, 1.05882, 0.88198, 1.05882, 0.88198, 1.05882, 1, 1, 0.9831, 1.01756, 0.9831, 1.01756, 0.95782, 0.8717, 0.95782, 0.8717, 0.95782, 0.8717, 0.95782, 1.09011, 0.95782, 0.8717, 0.84784, 1.11551, 0.71387, 1.09011, 1, 1, 0.99414, 0.84636, 1.09011, 1, 1, 0.84636, 1.0536, 0.84636, 0.94298, 0.84636, 1.23297, 1.03584, 1.01756, 1, 1, 1.03584, 1.01756, 1.00323, 1.03444, 1.01756, 0.96924, 1.05356, 0.96924, 1.05356, 0.96924, 1.05356, 0.93066, 0.98293, 0.82826, 1.04399, 1, 1, 0.82826, 1.04399, 0.79649, 0.84863, 0.79649, 0.84863, 0.79649, 0.84863, 0.79649, 0.84863, 1, 1, 0.85771, 1.17318, 0.85771, 1.21968, 0.95132, 1.01756, 0.95132, 1.01756, 0.95132, 1.01756, 0.95132, 1.01756, 0.95132, 1.01756, 0.95132, 1.01756, 0.98965, 1.00068, 0.8287, 0.96777, 0.8287, 0.93365, 0.9043, 0.93365, 0.9043, 0.93365, 0.9043, 1.08571, 0.96927, 0.96706, 0.91484, 0.86035, 0.93575, 0.96924, 0.95923, 1, 1, 0.85771, 1.21968, 1.11437, 1.11437, 0.93109, 0.91202, 0.60411, 0.84164, 0.55572, 1.01173, 0.97361, 0.81818, 0.81818, 0.96635, 0.78032, 0.72727, 0.92366, 0.98601, 1.03405, 0.77968, 1.09799, 1.2,
vendor: 8,358 bytes, lines 34929-35136
349290.96706, 0.85944, 0.85638, 0.96491, 0.75842, 0.93365, 0.9831, 0.96924, 0.95782, 0.86969, 0.94152, 1.07796, 1.03584, 0.78437, 0.96924, 0.98715, 0.83968, 0.83491, 0.85771, 0.8287, 0.94492, 0.88433, 0.9287, 1.0098, 0.95782, 0.8287, 1.0625, 0.98248, 1.03424, 1.2, 1.01071, 1.0625, 0.95246, 1.03809, 1.04912, 0.98248, 1.00221, 1.03424, 1.05443, 1.2, 1.04785, 0.99609, 1.00169, 1.05176, 0.99346, 1.05356, 0.9087, 1.03004, 0.95542, 0.93117, 1.23362, 1.01071, 1.07831, 1.02512, 1.05205, 1.03502, 1.2, 1.01071, 1.05356, 1.01071, 1.03502, 0.75842, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.03719, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9403, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.04021, 1, 1, 1, 1, 1, 1, 0.98965, 1.00068, 0.98965, 1.00068, 0.98965, 1.00068, 0.8287, 0.96777, 1, 1.20088, 0.89903, 1, 1, 0.75155, 1.03077, 1.03077, 1.03077, 1.03077, 1.13196, 1.13196, 1.13196, 0.67428, 0.67428, 1.16039, 0.73291, 1.20996, 1.22135, 1.06483, 0.94868, 0.94868, 0.95996, 1.24633, 1, 1.07497, 0.87796, 0.96927, 1.01518, 0.96927, 1, 1, 1, 0.77295, 1, 1, 1.10539, 1.10539, 1.11358, 1.06967, 0.86279, 0.94434, 0.86279, 0.94434, 0.86182, 1, 1, 1.083, 1, 0.91578, 0.86507, 1.1714, 1.18416, 1.14589, 0.69825, 0.97622, 1.9697, 1.24822, 1.24822, 1.17238, 1.24822, 1.24822, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.42603, 1, 0.99862, 0.99862, 1, 0.87025, 0.87025, 0.87025, 0.87025, 1.18083, 1.42603, 1, 1.42603, 1.42603, 0.99862, 1, 1, 1, 1, 1, 1.2886, 1.04315, 1.15296, 1.34163, 1, 1, 1, 1.10938, 1.10938, 1, 1, 1, 1.05425, 1.09971, 1.09971, 1.09971, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; 34930const SegoeuiRegularMetrics = { 34931 lineHeight: 1.33008, 34932 lineGap: 0 34933}; 34934 34935;// ./src/core/xfa_fonts.js 34936 34937 34938 34939 34940 34941 34942 34943 34944 34945 34946 34947const getXFAFontMap = getLookupTableFactory(function (t) { 34948 t["MyriadPro-Regular"] = t["PdfJS-Fallback-Regular"] = { 34949 name: "LiberationSans-Regular", 34950 factors: MyriadProRegularFactors, 34951 baseWidths: LiberationSansRegularWidths, 34952 baseMapping: LiberationSansRegularMapping, 34953 metrics: MyriadProRegularMetrics 34954 }; 34955 t["MyriadPro-Bold"] = t["PdfJS-Fallback-Bold"] = { 34956 name: "LiberationSans-Bold", 34957 factors: MyriadProBoldFactors, 34958 baseWidths: LiberationSansBoldWidths, 34959 baseMapping: LiberationSansBoldMapping, 34960 metrics: MyriadProBoldMetrics 34961 }; 34962 t["MyriadPro-It"] = t["MyriadPro-Italic"] = t["PdfJS-Fallback-Italic"] = { 34963 name: "LiberationSans-Italic", 34964 factors: MyriadProItalicFactors, 34965 baseWidths: LiberationSansItalicWidths, 34966 baseMapping: LiberationSansItalicMapping, 34967 metrics: MyriadProItalicMetrics 34968 }; 34969 t["MyriadPro-BoldIt"] = t["MyriadPro-BoldItalic"] = t["PdfJS-Fallback-BoldItalic"] = { 34970 name: "LiberationSans-BoldItalic", 34971 factors: MyriadProBoldItalicFactors, 34972 baseWidths: LiberationSansBoldItalicWidths, 34973 baseMapping: LiberationSansBoldItalicMapping, 34974 metrics: MyriadProBoldItalicMetrics 34975 }; 34976 t.ArialMT = t.Arial = t["Arial-Regular"] = { 34977 name: "LiberationSans-Regular", 34978 baseWidths: LiberationSansRegularWidths, 34979 baseMapping: LiberationSansRegularMapping 34980 }; 34981 t["Arial-BoldMT"] = t["Arial-Bold"] = { 34982 name: "LiberationSans-Bold", 34983 baseWidths: LiberationSansBoldWidths, 34984 baseMapping: LiberationSansBoldMapping 34985 }; 34986 t["Arial-ItalicMT"] = t["Arial-Italic"] = { 34987 name: "LiberationSans-Italic", 34988 baseWidths: LiberationSansItalicWidths, 34989 baseMapping: LiberationSansItalicMapping 34990 }; 34991 t["Arial-BoldItalicMT"] = t["Arial-BoldItalic"] = { 34992 name: "LiberationSans-BoldItalic", 34993 baseWidths: LiberationSansBoldItalicWidths, 34994 baseMapping: LiberationSansBoldItalicMapping 34995 }; 34996 t["Calibri-Regular"] = { 34997 name: "LiberationSans-Regular", 34998 factors: CalibriRegularFactors, 34999 baseWidths: LiberationSansRegularWidths, 35000 baseMapping: LiberationSansRegularMapping, 35001 metrics: CalibriRegularMetrics 35002 }; 35003 t["Calibri-Bold"] = { 35004 name: "LiberationSans-Bold", 35005 factors: CalibriBoldFactors, 35006 baseWidths: LiberationSansBoldWidths, 35007 baseMapping: LiberationSansBoldMapping, 35008 metrics: CalibriBoldMetrics 35009 }; 35010 t["Calibri-Italic"] = { 35011 name: "LiberationSans-Italic", 35012 factors: CalibriItalicFactors, 35013 baseWidths: LiberationSansItalicWidths, 35014 baseMapping: LiberationSansItalicMapping, 35015 metrics: CalibriItalicMetrics 35016 }; 35017 t["Calibri-BoldItalic"] = { 35018 name: "LiberationSans-BoldItalic", 35019 factors: CalibriBoldItalicFactors, 35020 baseWidths: LiberationSansBoldItalicWidths, 35021 baseMapping: LiberationSansBoldItalicMapping, 35022 metrics: CalibriBoldItalicMetrics 35023 }; 35024 t["Segoeui-Regular"] = { 35025 name: "LiberationSans-Regular", 35026 factors: SegoeuiRegularFactors, 35027 baseWidths: LiberationSansRegularWidths, 35028 baseMapping: LiberationSansRegularMapping, 35029 metrics: SegoeuiRegularMetrics 35030 }; 35031 t["Segoeui-Bold"] = { 35032 name: "LiberationSans-Bold", 35033 factors: SegoeuiBoldFactors, 35034 baseWidths: LiberationSansBoldWidths, 35035 baseMapping: LiberationSansBoldMapping, 35036 metrics: SegoeuiBoldMetrics 35037 }; 35038 t["Segoeui-Italic"] = { 35039 name: "LiberationSans-Italic", 35040 factors: SegoeuiItalicFactors, 35041 baseWidths: LiberationSansItalicWidths, 35042 baseMapping: LiberationSansItalicMapping, 35043 metrics: SegoeuiItalicMetrics 35044 }; 35045 t["Segoeui-BoldItalic"] = { 35046 name: "LiberationSans-BoldItalic", 35047 factors: SegoeuiBoldItalicFactors, 35048 baseWidths: LiberationSansBoldItalicWidths, 35049 baseMapping: LiberationSansBoldItalicMapping, 35050 metrics: SegoeuiBoldItalicMetrics 35051 }; 35052 t["Helvetica-Regular"] = t.Helvetica = { 35053 name: "LiberationSans-Regular", 35054 factors: HelveticaRegularFactors, 35055 baseWidths: LiberationSansRegularWidths, 35056 baseMapping: LiberationSansRegularMapping, 35057 metrics: HelveticaRegularMetrics 35058 }; 35059 t["Helvetica-Bold"] = { 35060 name: "LiberationSans-Bold", 35061 factors: HelveticaBoldFactors, 35062 baseWidths: LiberationSansBoldWidths, 35063 baseMapping: LiberationSansBoldMapping, 35064 metrics: HelveticaBoldMetrics 35065 }; 35066 t["Helvetica-Italic"] = { 35067 name: "LiberationSans-Italic", 35068 factors: HelveticaItalicFactors, 35069 baseWidths: LiberationSansItalicWidths, 35070 baseMapping: LiberationSansItalicMapping, 35071 metrics: HelveticaItalicMetrics 35072 }; 35073 t["Helvetica-BoldItalic"] = { 35074 name: "LiberationSans-BoldItalic", 35075 factors: HelveticaBoldItalicFactors, 35076 baseWidths: LiberationSansBoldItalicWidths, 35077 baseMapping: LiberationSansBoldItalicMapping, 35078 metrics: HelveticaBoldItalicMetrics 35079 }; 35080}); 35081function getXfaFontName(name) { 35082 const fontName = normalizeFontName(name); 35083 const fontMap = getXFAFontMap(); 35084 return fontMap[fontName]; 35085} 35086function getXfaFontWidths(name) { 35087 const info = getXfaFontName(name); 35088 if (!info) { 35089 return null; 35090 } 35091 const { 35092 baseWidths, 35093 baseMapping, 35094 factors 35095 } = info; 35096 const rescaledBaseWidths = !factors ? baseWidths : baseWidths.map((w, i) => w * factors[i]); 35097 let currentCode = -2; 35098 let currentArray; 35099 const newWidths = []; 35100 for (const [unicode, glyphIndex] of baseMapping.map((charUnicode, index) => [charUnicode, index]).sort(([unicode1], [unicode2]) => unicode1 - unicode2)) { 35101 if (unicode === -1) { 35102 continue; 35103 } 35104 if (unicode === currentCode + 1) { 35105 currentArray.push(rescaledBaseWidths[glyphIndex]); 35106 currentCode += 1; 35107 } else { 35108 currentCode = unicode; 35109 currentArray = [rescaledBaseWidths[glyphIndex]]; 35110 newWidths.push(unicode, currentArray); 35111 } 35112 } 35113 return newWidths; 35114} 35115function getXfaFontDict(name) { 35116 const widths = getXfaFontWidths(name); 35117 const dict = new Dict(null); 35118 dict.set("BaseFont", Name.get(name)); 35119 dict.set("Type", Name.get("Font")); 35120 dict.set("Subtype", Name.get("CIDFontType2")); 35121 dict.set("Encoding", Name.get("Identity-H")); 35122 dict.set("CIDToGIDMap", Name.get("Identity")); 35123 dict.set("W", widths); 35124 dict.set("FirstChar", widths[0]); 35125 dict.set("LastChar", widths.at(-2) + widths.at(-1).length - 1); 35126 const descriptor = new Dict(null); 35127 dict.set("FontDescriptor", descriptor); 35128 const systemInfo = new Dict(null); 35129 systemInfo.set("Ordering", "Identity"); 35130 systemInfo.set("Registry", "Adobe"); 35131 systemInfo.set("Supplement", 0); 35132 dict.set("CIDSystemInfo", systemInfo); 35133 return dict; 35134} 35135 35136;// ./src/core/p
vendor: 3,693 bytes, lines 35136-35306
35136ostscript/lexer.js 35137const TOKEN = { 35138 number: 0, 35139 lbrace: 1, 35140 rbrace: 2, 35141 true: 3, 35142 false: 4, 35143 add: 5, 35144 sub: 6, 35145 mul: 7, 35146 div: 8, 35147 idiv: 9, 35148 mod: 10, 35149 exp: 11, 35150 eq: 12, 35151 ne: 13, 35152 gt: 14, 35153 ge: 15, 35154 lt: 16, 35155 le: 17, 35156 and: 18, 35157 or: 19, 35158 xor: 20, 35159 bitshift: 21, 35160 abs: 22, 35161 neg: 23, 35162 ceiling: 24, 35163 floor: 25, 35164 round: 26, 35165 truncate: 27, 35166 not: 28, 35167 sqrt: 29, 35168 sin: 30, 35169 cos: 31, 35170 ln: 32, 35171 log: 33, 35172 atan: 34, 35173 cvi: 35, 35174 cvr: 36, 35175 dup: 37, 35176 exch: 38, 35177 pop: 39, 35178 copy: 40, 35179 index: 41, 35180 roll: 42, 35181 if: 43, 35182 ifelse: 44, 35183 eof: 45, 35184 min: 46, 35185 max: 47 35186}; 35187class Token { 35188 constructor(id, value = null) { 35189 this.id = id; 35190 this.value = value; 35191 } 35192} 35193class lexer_Lexer { 35194 static #singletons = null; 35195 static #operatorSingletons = null; 35196 static #initSingletons() { 35197 const singletons = Object.create(null); 35198 const operatorSingletons = Object.create(null); 35199 for (const [name, id] of Object.entries(TOKEN)) { 35200 if (name === "number") { 35201 continue; 35202 } 35203 const isOperator = id >= TOKEN.true && id <= TOKEN.ifelse; 35204 const token = new Token(id, isOperator ? name : null); 35205 singletons[name] = token; 35206 if (isOperator) { 35207 operatorSingletons[name] = token; 35208 } 35209 } 35210 this.#singletons = singletons; 35211 this.#operatorSingletons = operatorSingletons; 35212 } 35213 constructor(data) { 35214 if (!lexer_Lexer.#singletons) { 35215 lexer_Lexer.#initSingletons(); 35216 } 35217 this.data = data; 35218 this.pos = 0; 35219 this.len = data.length; 35220 this._numberPattern = /[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/y; 35221 this._identifierPattern = /[a-z]+/y; 35222 } 35223 _skipComment() { 35224 const lf = this.data.indexOf("\n", this.pos); 35225 const cr = this.data.indexOf("\r", this.pos); 35226 const eol = Math.min(lf < 0 ? this.len : lf, cr < 0 ? this.len : cr); 35227 this.pos = Math.min(eol + 1, this.len); 35228 } 35229 _getNumber() { 35230 this._numberPattern.lastIndex = this.pos; 35231 const match = this._numberPattern.exec(this.data); 35232 if (!match) { 35233 return new Token(TOKEN.number, 0); 35234 } 35235 const number = parseFloat(match[0]); 35236 if (!Number.isFinite(number)) { 35237 return new Token(TOKEN.number, 0); 35238 } 35239 this.pos = this._numberPattern.lastIndex; 35240 return new Token(TOKEN.number, number); 35241 } 35242 _getOperator() { 35243 this._identifierPattern.lastIndex = this.pos; 35244 const match = this._identifierPattern.exec(this.data); 35245 if (!match) { 35246 return new Token(TOKEN.number, 0); 35247 } 35248 this.pos = this._identifierPattern.lastIndex; 35249 const op = match[0]; 35250 const token = lexer_Lexer.#operatorSingletons[op]; 35251 if (!token) { 35252 return new Token(TOKEN.number, 0); 35253 } 35254 return token; 35255 } 35256 next() { 35257 while (this.pos < this.len) { 35258 const ch = this.data.charCodeAt(this.pos++); 35259 switch (ch) { 35260 case 0x00: 35261 case 0x09: 35262 case 0x0a: 35263 case 0x0c: 35264 case 0x0d: 35265 case 0x20: 35266 break; 35267 case 0x25: 35268 this._skipComment(); 35269 break; 35270 case 0x7b: 35271 return lexer_Lexer.#singletons.lbrace; 35272 case 0x7d: 35273 return lexer_Lexer.#singletons.rbrace; 35274 case 0x2b: 35275 case 0x2d: 35276 this.pos--; 35277 return this._getNumber(); 35278 case 0x2e: 35279 this.pos--; 35280 return this._getNumber(); 35281 default: 35282 if (ch >= 0x30 && ch <= 0x39) { 35283 this.pos--; 35284 return this._getNumber(); 35285 } 35286 if (ch >= 0x61 && ch <= 0x7a) { 35287 this.pos--; 35288 return this._getOperator(); 35289 } 35290 return new Token(TOKEN.number, 0); 35291 } 35292 } 35293 return lexer_Lexer.#singletons.eof; 35294 } 35295} 35296 35297;// ./src/core/postscript/ast.js 35298 35299 35300 35301 35302 35303 35304 35305 35306
vendor: 24,555 bytes, lines 35307-36170
35307 35308 35309 35310const PS_VALUE_TYPE = { 35311 numeric: 0, 35312 boolean: 1, 35313 unknown: 2 35314}; 35315const PS_NODE = { 35316 program: 0, 35317 block: 1, 35318 number: 2, 35319 operator: 3, 35320 if: 4, 35321 ifelse: 5, 35322 arg: 6, 35323 const: 7, 35324 unary: 8, 35325 binary: 9, 35326 ternary: 10 35327}; 35328class PsNode { 35329 constructor(type) { 35330 this.type = type; 35331 } 35332} 35333class PsProgram extends PsNode { 35334 constructor(body) { 35335 super(PS_NODE.program); 35336 this.body = body; 35337 } 35338} 35339class PsBlock extends PsNode { 35340 constructor(instructions) { 35341 super(PS_NODE.block); 35342 this.instructions = instructions; 35343 } 35344} 35345class PsNumber extends PsNode { 35346 constructor(value) { 35347 super(PS_NODE.number); 35348 this.value = value; 35349 } 35350} 35351class PsOperator extends PsNode { 35352 constructor(op) { 35353 super(PS_NODE.operator); 35354 this.op = op; 35355 } 35356} 35357class PsIf extends PsNode { 35358 constructor(then) { 35359 super(PS_NODE.if); 35360 this.then = then; 35361 } 35362} 35363class PsIfElse extends PsNode { 35364 constructor(then, otherwise) { 35365 super(PS_NODE.ifelse); 35366 this.then = then; 35367 this.otherwise = otherwise; 35368 } 35369} 35370class PsArgNode extends PsNode { 35371 constructor(index) { 35372 super(PS_NODE.arg); 35373 this.index = index; 35374 this.valueType = PS_VALUE_TYPE.numeric; 35375 } 35376} 35377class PsConstNode extends PsNode { 35378 constructor(value) { 35379 super(PS_NODE.const); 35380 this.value = value; 35381 this.valueType = typeof value === "boolean" ? PS_VALUE_TYPE.boolean : PS_VALUE_TYPE.numeric; 35382 } 35383} 35384class PsUnaryNode extends PsNode { 35385 constructor(op, operand, valueType = PS_VALUE_TYPE.unknown) { 35386 super(PS_NODE.unary); 35387 this.op = op; 35388 this.operand = operand; 35389 this.valueType = valueType; 35390 } 35391} 35392class PsBinaryNode extends PsNode { 35393 constructor(op, first, second, valueType = PS_VALUE_TYPE.unknown) { 35394 super(PS_NODE.binary); 35395 this.op = op; 35396 this.first = first; 35397 this.second = second; 35398 this.valueType = valueType; 35399 } 35400} 35401class PsTernaryNode extends PsNode { 35402 constructor(cond, then, otherwise, valueType = PS_VALUE_TYPE.unknown) { 35403 super(PS_NODE.ternary); 35404 this.cond = cond; 35405 this.then = then; 35406 this.otherwise = otherwise; 35407 this.valueType = valueType; 35408 } 35409} 35410class ast_Parser { 35411 constructor(lexer) { 35412 this.lexer = lexer; 35413 this._token = null; 35414 } 35415 static _isRegularOperator(id) { 35416 return id >= TOKEN.true && id < TOKEN.if; 35417 } 35418 _advance() { 35419 this._token = this.lexer.next(); 35420 } 35421 _expect(id) { 35422 if (this._token.id !== id) { 35423 throw new FormatError(`PostScript function: expected token id ${id}, got ${this._token.id}.`); 35424 } 35425 const tok = this._token; 35426 this._advance(); 35427 return tok; 35428 } 35429 parse() { 35430 this._advance(); 35431 this._expect(TOKEN.lbrace); 35432 const block = this._parseBlock(); 35433 this._expect(TOKEN.rbrace); 35434 if (this._token.id !== TOKEN.eof) { 35435 warn("PostScript function: unexpected content after closing brace."); 35436 } 35437 return new PsProgram(block); 35438 } 35439 _parseBlock() { 35440 const instructions = []; 35441 while (true) { 35442 const tok = this._token; 35443 switch (tok.id) { 35444 case TOKEN.number: 35445 instructions.push(new PsNumber(tok.value)); 35446 this._advance(); 35447 break; 35448 case TOKEN.lbrace: 35449 { 35450 this._advance(); 35451 const thenBlock = this._parseBlock(); 35452 this._expect(TOKEN.rbrace); 35453 if (this._token.id === TOKEN.if) { 35454 this._advance(); 35455 instructions.push(new PsIf(thenBlock)); 35456 } else if (this._token.id === TOKEN.lbrace) { 35457 this._advance(); 35458 const elseBlock = this._parseBlock(); 35459 this._expect(TOKEN.rbrace); 35460 this._expect(TOKEN.ifelse); 35461 instructions.push(new PsIfElse(thenBlock, elseBlock)); 35462 } else { 35463 throw new FormatError("PostScript function: a procedure block must be followed by 'if' or '{â¦} ifelse'."); 35464 } 35465 break; 35466 } 35467 case TOKEN.rbrace: 35468 case TOKEN.eof: 35469 return new PsBlock(instructions); 35470 case TOKEN.if: 35471 case TOKEN.ifelse: 35472 throw new FormatError(`PostScript function: unexpected '${tok.value}' operator.`); 35473 default: 35474 if (ast_Parser._isRegularOperator(tok.id)) { 35475 instructions.push(new PsOperator(tok.id)); 35476 this._advance(); 35477 break; 35478 } 35479 throw new FormatError(`PostScript function: unexpected token id ${tok.id}.`); 35480 } 35481 } 35482 } 35483} 35484function parsePostScriptFunction(source) { 35485 return new ast_Parser(new lexer_Lexer(source)).parse(); 35486} 35487function _nodesEqual(a, b) { 35488 if (a === b) { 35489 return true; 35490 } 35491 if (a.type !== b.type) { 35492 return false; 35493 } 35494 switch (a.type) { 35495 case PS_NODE.arg: 35496 return a.index === b.index; 35497 case PS_NODE.const: 35498 return a.value === b.value; 35499 case PS_NODE.unary: 35500 return a.op === b.op && _nodesEqual(a.operand, b.operand); 35501 case PS_NODE.binary: 35502 return a.op === b.op && _nodesEqual(a.first, b.first) && _nodesEqual(a.second, b.second); 35503 case PS_NODE.ternary: 35504 return _nodesEqual(a.cond, b.cond) && _nodesEqual(a.then, b.then) && _nodesEqual(a.otherwise, b.otherwise); 35505 default: 35506 return false; 35507 } 35508} 35509function _evalBinaryConst(op, a, b) { 35510 switch (op) { 35511 case TOKEN.add: 35512 return a + b; 35513 case TOKEN.sub: 35514 return a - b; 35515 case TOKEN.mul: 35516 return a * b; 35517 case TOKEN.div: 35518 return b !== 0 ? a / b : 0; 35519 case TOKEN.idiv: 35520 return b !== 0 ? Math.trunc(a / b) : 0; 35521 case TOKEN.mod: 35522 return b !== 0 ? a - Math.trunc(a / b) * b : 0; 35523 case TOKEN.exp: 35524 { 35525 const r = a ** b; 35526 return Number.isFinite(r) ? r : undefined; 35527 } 35528 case TOKEN.atan: 35529 { 35530 let deg = Math.atan2(a, b) * (180 / Math.PI); 35531 if (deg < 0) { 35532 deg += 360; 35533 } 35534 return deg; 35535 } 35536 case TOKEN.eq: 35537 return a === b; 35538 case TOKEN.ne: 35539 return a !== b; 35540 case TOKEN.gt: 35541 return a > b; 35542 case TOKEN.ge: 35543 return a >= b; 35544 case TOKEN.lt: 35545 return a < b; 35546 case TOKEN.le: 35547 return a <= b; 35548 case TOKEN.and: 35549 return typeof a === "boolean" ? a && b : a & b | 0; 35550 case TOKEN.or: 35551 return typeof a === "boolean" ? a || b : a | b | 0; 35552 case TOKEN.xor: 35553 return typeof a === "boolean" ? a !== b : a ^ b | 0; 35554 case TOKEN.bitshift: 35555 return b >= 0 ? a << b | 0 : a >> -b | 0; 35556 case TOKEN.min: 35557 return Math.min(a, b); 35558 case TOKEN.max: 35559 return Math.max(a, b); 35560 default: 35561 return undefined; 35562 } 35563} 35564function _evalUnaryConst(op, v) { 35565 switch (op) { 35566 case TOKEN.abs: 35567 return Math.abs(v); 35568 case TOKEN.neg: 35569 return -v; 35570 case TOKEN.ceiling: 35571 return Math.ceil(v); 35572 case TOKEN.floor: 35573 return Math.floor(v); 35574 case TOKEN.round: 35575 return Math.round(v); 35576 case TOKEN.truncate: 35577 return Math.trunc(v); 35578 case TOKEN.sqrt: 35579 { 35580 const r = Math.sqrt(v); 35581 return Number.isFinite(r) ? r : undefined; 35582 } 35583 case TOKEN.sin: 35584 return Math.sin(v % 360 * Math.PI / 180); 35585 case TOKEN.cos: 35586 return Math.cos(v % 360 * Math.PI / 180); 35587 case TOKEN.ln: 35588 { 35589 const r = Math.log(v); 35590 return Number.isFinite(r) ? r : undefined; 35591 } 35592 case TOKEN.log: 35593 { 35594 const r = Math.log10(v); 35595 return Number.isFinite(r) ? r : undefined; 35596 } 35597 case TOKEN.cvi: 35598 return Math.trunc(v); 35599 case TOKEN.cvr: 35600 return v; 35601 case TOKEN.not: 35602 return typeof v === "boolean" ? !v : ~v; 35603 default: 35604 return undefined; 35605 } 35606} 35607const MAX_STACK_SIZE = 100; 35608function _unaryValueType(op, operandType) { 35609 return op === TOKEN.not ? operandType : PS_VALUE_TYPE.numeric; 35610} 35611function _binaryValueType(op, firstType, secondType) { 35612 switch (op) { 35613 case TOKEN.eq: 35614 case TOKEN.ne: 35615 case TOKEN.gt: 35616 case TOKEN.ge: 35617 case TOKEN.lt: 35618 case TOKEN.le: 35619 return PS_VALUE_TYPE.boolean; 35620 case TOKEN.and: 35621 case TOKEN.or: 35622 case TOKEN.xor: 35623 return firstType === secondType && firstType !== PS_VALUE_TYPE.unknown ? firstType : PS_VALUE_TYPE.unknown; 35624 default: 35625 return PS_VALUE_TYPE.numeric; 35626 } 35627} 35628class PSStackToTree { 35629 static #binaryOps = null; 35630 static #unaryOps = null; 35631 static #idempotentUnary = null; 35632 static #negatedComparison = null; 35633 static #init() { 35634 this.#binaryOps = new Set([TOKEN.add, TOKEN.sub, TOKEN.mul, TOKEN.div, TOKEN.idiv, TOKEN.mod, TOKEN.exp, TOKEN.atan, TOKEN.eq, TOKEN.ne, TOKEN.gt, TOKEN.ge, TOKEN.lt, TOKEN.le, TOKEN.and, TOKEN.or, TOKEN.xor, TOKEN.bitshift]); 35635 this.#unaryOps = new Set([TOKEN.abs, TOKEN.neg, TOKEN.ceiling, TOKEN.floor, TOKEN.round, TOKEN.truncate, TOKEN.sqrt, TOKEN.sin, TOKEN.cos, TOKEN.ln, TOKEN.log, TOKEN.cvi, TOKEN.cvr, TOKEN.not]); 35636 this.#idempotentUnary = new Set([TOKEN.abs, TOKEN.ceiling, TOKEN.cvi, TOKEN.cvr, TOKEN.floor, TOKEN.round, TOKEN.truncate]); 35637 this.#negatedComparison = new Map([[TOKEN.eq, TOKEN.ne], [TOKEN.ne, TOKEN.eq], [TOKEN.lt, TOKEN.ge], [TOKEN.le, TOKEN.gt], [TOKEN.gt, TOKEN.le], [TOKEN.ge, TOKEN.lt]]); 35638 } 35639 evaluate(program, numInputs) { 35640 if (!PSStackToTree.#binaryOps) { 35641 PSStackToTree.#init(); 35642 } 35643 this._failed = false; 35644 if (numInputs > MAX_STACK_SIZE) { 35645 return null; 35646 } 35647 const stack = []; 35648 for (let i = 0; i < numInputs; i++) { 35649 stack.push(new PsArgNode(i)); 35650 } 35651 this._evalBlock(program.body, stack); 35652 if (this._failed) { 35653 return null; 35654 } 35655 PSStackToTree.#markShared(stack); 35656 return stack; 35657 } 35658 static #markShared(outputs) { 35659 const refCount = new Map(); 35660 const visit = node => { 35661 if (!node || node.type === PS_NODE.arg || node.type === PS_NODE.const) { 35662 return; 35663 } 35664 const prev = refCount.get(node) ?? 0; 35665 refCount.set(node, prev + 1); 35666 if (prev > 0) { 35667 return; 35668 } 35669 switch (node.type) { 35670 case PS_NODE.unary: 35671 visit(node.operand); 35672 break; 35673 case PS_NODE.binary: 35674 visit(node.first); 35675 visit(node.second); 35676 break; 35677 case PS_NODE.ternary: 35678 visit(node.cond); 35679 visit(node.then); 35680 visit(node.otherwise); 35681 break; 35682 } 35683 }; 35684 for (const output of outputs) { 35685 visit(output); 35686 } 35687 for (const [node, count] of refCount) { 35688 if (count > 1) { 35689 node.shared = true; 35690 node.sharedCount = count; 35691 } 35692 } 35693 } 35694 _evalBlock(block, stack) { 35695 this._evalBlockFrom(block.instructions, 0, stack); 35696 } 35697 _evalBlockFrom(instructions, startIdx, stack) { 35698 for (let idx = startIdx; idx < instructions.length; idx++) { 35699 if (this._failed) { 35700 break; 35701 } 35702 const instr = instructions[idx]; 35703 switch (instr.type) { 35704 case PS_NODE.number: 35705 stack.push(new PsConstNode(instr.value)); 35706 if (stack.length > MAX_STACK_SIZE) { 35707 this._failed = true; 35708 } 35709 break; 35710 case PS_NODE.operator: 35711 this._evalOp(instr.op, stack); 35712 break; 35713 case PS_NODE.if: 35714 { 35715 if (stack.length < 1) { 35716 this._failed = true; 35717 break; 35718 } 35719 const cond = stack.pop(); 35720 const saved = stack.slice(); 35721 this._evalBlock(instr.then, stack); 35722 if (this._failed) { 35723 break; 35724 } 35725 if (stack.length === saved.length) { 35726 for (let i = 0; i < stack.length; i++) { 35727 if (stack[i] !== saved[i]) { 35728 stack[i] = this._makeTernary(cond, stack[i], saved[i]); 35729 } 35730 } 35731 } else if (stack.length > saved.length) { 35732 if (cond.type === PS_NODE.const) { 35733 if (!cond.value) { 35734 stack.length = 0; 35735 stack.push(...saved); 35736 } 35737 break; 35738 } 35739 const trueStack = stack.slice(); 35740 this._evalBlockFrom(instructions, idx + 1, trueStack); 35741 if (this._failed) { 35742 break; 35743 } 35744 const falseStack = saved; 35745 this._evalBlockFrom(instructions, idx + 1, falseStack); 35746 if (this._failed) { 35747 break; 35748 } 35749 if (trueStack.length !== falseStack.length) { 35750 const zero = new PsConstNode(0); 35751 while (trueStack.length < falseStack.length) { 35752 trueStack.push(zero); 35753 } 35754 while (falseStack.length < trueStack.length) { 35755 falseStack.push(zero); 35756 } 35757 } 35758 stack.length = 0; 35759 for (let i = 0; i < trueStack.length; i++) { 35760 stack.push(this._makeTernary(cond, trueStack[i], falseStack[i])); 35761 } 35762 return; 35763 } else { 35764 this._failed = true; 35765 } 35766 break; 35767 } 35768 case PS_NODE.ifelse: 35769 { 35770 if (stack.length < 1) { 35771 this._failed = true; 35772 break; 35773 } 35774 const cond = stack.pop(); 35775 const snapshot = stack.slice(); 35776 const thenStack = snapshot.slice(); 35777 this._evalBlock(instr.then, thenStack); 35778 if (this._failed) { 35779 break; 35780 } 35781 const elseStack = snapshot.slice(); 35782 this._evalBlock(instr.otherwise, elseStack); 35783 if (this._failed) { 35784 break; 35785 } 35786 if (thenStack.length !== elseStack.length) { 35787 const zero = new PsConstNode(0); 35788 while (thenStack.length < elseStack.length) { 35789 thenStack.push(zero); 35790 } 35791 while (elseStack.length < thenStack.length) { 35792 elseStack.push(zero); 35793 } 35794 } 35795 stack.length = 0; 35796 for (let i = 0; i < thenStack.length; i++) { 35797 stack.push(this._makeTernary(cond, thenStack[i], elseStack[i])); 35798 } 35799 break; 35800 } 35801 } 35802 } 35803 } 35804 _evalOp(op, stack) { 35805 if (PSStackToTree.#binaryOps.has(op)) { 35806 if (stack.length < 2) { 35807 this._failed = true; 35808 return; 35809 } 35810 const first = stack.pop(); 35811 const second = stack.pop(); 35812 stack.push(this._makeBinary(op, first, second)); 35813 return; 35814 } 35815 if (PSStackToTree.#unaryOps.has(op)) { 35816 if (stack.length < 1) { 35817 this._failed = true; 35818 return; 35819 } 35820 stack.push(this._makeUnary(op, stack.pop())); 35821 return; 35822 } 35823 switch (op) { 35824 case TOKEN.true: 35825 stack.push(new PsConstNode(true)); 35826 if (stack.length > MAX_STACK_SIZE) { 35827 this._failed = true; 35828 } 35829 break; 35830 case TOKEN.false: 35831 stack.push(new PsConstNode(false)); 35832 if (stack.length > MAX_STACK_SIZE) { 35833 this._failed = true; 35834 } 35835 break; 35836 case TOKEN.dup: 35837 if (stack.length < 1) { 35838 this._failed = true; 35839 break; 35840 } 35841 stack.push(stack.at(-1)); 35842 if (stack.length > MAX_STACK_SIZE) { 35843 this._failed = true; 35844 } 35845 break; 35846 case TOKEN.exch: 35847 { 35848 if (stack.length < 2) { 35849 this._failed = true; 35850 break; 35851 } 35852 const a = stack.pop(); 35853 const b = stack.pop(); 35854 stack.push(a, b); 35855 break; 35856 } 35857 case TOKEN.pop: 35858 if (stack.length < 1) { 35859 this._failed = true; 35860 break; 35861 } 35862 stack.pop(); 35863 break; 35864 case TOKEN.copy: 35865 { 35866 if (stack.length < 1) { 35867 this._failed = true; 35868 break; 35869 } 35870 const nNode = stack.pop(); 35871 if (nNode.type === PS_NODE.const) { 35872 const n = nNode.value | 0; 35873 if (n === 0) {} else if (n < 0 || n > stack.length) { 35874 this._failed = true; 35875 } else { 35876 stack.push(...stack.slice(-n)); 35877 if (stack.length > MAX_STACK_SIZE) { 35878 this._failed = true; 35879 } 35880 } 35881 } else { 35882 this._failed = true; 35883 } 35884 break; 35885 } 35886 case TOKEN.index: 35887 { 35888 if (stack.length < 1) { 35889 this._failed = true; 35890 break; 35891 } 35892 const nNode = stack.pop(); 35893 if (nNode.type === PS_NODE.const) { 35894 const n = nNode.value | 0; 35895 if (n < 0 || n >= stack.length) { 35896 this._failed = true; 35897 } else { 35898 stack.push(stack.at(-n - 1)); 35899 } 35900 } else { 35901 this._failed = true; 35902 } 35903 break; 35904 } 35905 case TOKEN.roll: 35906 { 35907 if (stack.length < 2) { 35908 this._failed = true; 35909 break; 35910 } 35911 const jNode = stack.pop(); 35912 const nNode = stack.pop(); 35913 if (nNode.type === PS_NODE.const && jNode.type === PS_NODE.const) { 35914 const n = nNode.value | 0; 35915 if (n === 0) {} else if (n < 0 || n > stack.length) { 35916 this._failed = true; 35917 } else { 35918 const j = ((jNode.value | 0) % n + n) % n; 35919 if (j > 0) { 35920 const slice = stack.splice(-n, n); 35921 stack.push(...slice.slice(n - j), ...slice.slice(0, n - j)); 35922 } 35923 } 35924 } else { 35925 this._failed = true; 35926 } 35927 break; 35928 } 35929 default: 35930 this._failed = true; 35931 break; 35932 } 35933 } 35934 _makeBinary(op, first, second) { 35935 if (first.type === PS_NODE.const && second.type === PS_NODE.const) { 35936 const v = _evalBinaryConst(op, second.value, first.value); 35937 if (v !== undefined) { 35938 return new PsConstNode(v); 35939 } 35940 } 35941 if (_nodesEqual(first, second)) { 35942 switch (op) { 35943 case TOKEN.sub: 35944 return new PsConstNode(0); 35945 case TOKEN.xor: 35946 return new PsConstNode(first.valueType === PS_VALUE_TYPE.boolean ? false : 0); 35947 case TOKEN.and: 35948 case TOKEN.or: 35949 return first; 35950 case TOKEN.min: 35951 case TOKEN.max: 35952 return first; 35953 case TOKEN.eq: 35954 case TOKEN.ge: 35955 case TOKEN.le: 35956 return new PsConstNode(true); 35957 case TOKEN.ne: 35958 case TOKEN.gt: 35959 case TOKEN.lt: 35960 return new PsConstNode(false); 35961 } 35962 } 35963 if (first.type === PS_NODE.const) { 35964 const b = first.value; 35965 switch (op) { 35966 case TOKEN.add: 35967 if (b === 0) { 35968 return second; 35969 } 35970 break; 35971 case TOKEN.sub: 35972 if (b === 0) { 35973 return second; 35974 } 35975 break; 35976 case TOKEN.mul: 35977 if (b === 1) { 35978 return second; 35979 } 35980 if (b === 0) { 35981 return first; 35982 } 35983 if (b === -1) { 35984 return this._makeUnary(TOKEN.neg, second); 35985 } 35986 break; 35987 case TOKEN.div: 35988 if (b !== 0) { 35989 return this._makeBinary(TOKEN.mul, new PsConstNode(1 / b), second); 35990 } 35991 break; 35992 case TOKEN.idiv: 35993 if (b === 1) { 35994 return second; 35995 } 35996 break; 35997 case TOKEN.exp: 35998 if (b === 1) { 35999 return second; 36000 } 36001 if (b === -1) { 36002 return this._makeBinary(TOKEN.div, second, new PsConstNode(1)); 36003 } 36004 if (b === 0.5) { 36005 return this._makeUnary(TOKEN.sqrt, second); 36006 } 36007 if (b === 0.25) { 36008 const sqrtOnce = this._makeUnary(TOKEN.sqrt, second); 36009 return this._makeUnary(TOKEN.sqrt, sqrtOnce); 36010 } 36011 if (b === 2) { 36012 return this._makeBinary(TOKEN.mul, second, second); 36013 } 36014 if (b === 3) { 36015 return this._makeBinary(TOKEN.mul, this._makeBinary(TOKEN.mul, second, second), second); 36016 } 36017 if (b === 4) { 36018 const square = this._makeBinary(TOKEN.mul, second, second); 36019 return this._makeBinary(TOKEN.mul, square, square); 36020 } 36021 if (b === 0) { 36022 return new PsConstNode(1); 36023 } 36024 break; 36025 case TOKEN.and: 36026 if (b === true) { 36027 return second; 36028 } 36029 if (b === false) { 36030 return first; 36031 } 36032 break; 36033 case TOKEN.or: 36034 if (b === false) { 36035 return second; 36036 } 36037 if (b === true) { 36038 return first; 36039 } 36040 break; 36041 case TOKEN.min: 36042 if (second.type === PS_NODE.binary && second.op === TOKEN.max && second.first.type === PS_NODE.const && second.first.value >= b) { 36043 return first; 36044 } 36045 break; 36046 case TOKEN.max: 36047 if (second.type === PS_NODE.binary && second.op === TOKEN.min && second.first.type === PS_NODE.const && second.first.value <= b) { 36048 return first; 36049 } 36050 break; 36051 } 36052 } 36053 if (second.type === PS_NODE.const) { 36054 const a = second.value; 36055 switch (op) { 36056 case TOKEN.add: 36057 if (a === 0) { 36058 return first; 36059 } 36060 break; 36061 case TOKEN.sub: 36062 if (a === 0) { 36063 return this._makeUnary(TOKEN.neg, first); 36064 } 36065 break; 36066 case TOKEN.mul: 36067 if (a === 1) { 36068 return first; 36069 } 36070 if (a === 0) { 36071 return second; 36072 } 36073 if (a === -1) { 36074 return this._makeUnary(TOKEN.neg, first); 36075 } 36076 break; 36077 case TOKEN.and: 36078 if (a === true) { 36079 return first; 36080 } 36081 if (a === false) { 36082 return second; 36083 } 36084 break; 36085 case TOKEN.or: 36086 if (a === false) { 36087 return first; 36088 } 36089 if (a === true) { 36090 return second; 36091 } 36092 break; 36093 } 36094 } 36095 return new PsBinaryNode(op, first, second, _binaryValueType(op, first.valueType, second.valueType)); 36096 } 36097 _makeUnary(op, operand) { 36098 if (operand.type === PS_NODE.const) { 36099 const v = _evalUnaryConst(op, operand.value); 36100 if (v !== undefined) { 36101 return new PsConstNode(v); 36102 } 36103 } 36104 if (op === TOKEN.not && operand.type === PS_NODE.binary) { 36105 const negated = PSStackToTree.#negatedComparison.get(operand.op); 36106 if (negated !== undefined) { 36107 return new PsBinaryNode(negated, operand.first, operand.second, PS_VALUE_TYPE.boolean); 36108 } 36109 } 36110 if (op === TOKEN.neg && operand.type === PS_NODE.binary && operand.op === TOKEN.sub) { 36111 return this._makeBinary(TOKEN.sub, operand.second, operand.first); 36112 } 36113 if (operand.type === PS_NODE.unary) { 36114 if (op === TOKEN.neg && operand.op === TOKEN.neg || op === TOKEN.not && operand.op === TOKEN.not) { 36115 return operand.operand; 36116 } 36117 if (op === TOKEN.abs && operand.op === TOKEN.neg) { 36118 return this._makeUnary(TOKEN.abs, operand.operand); 36119 } 36120 if (PSStackToTree.#idempotentUnary.has(op) && op === operand.op) { 36121 return operand; 36122 } 36123 } 36124 return new PsUnaryNode(op, operand, _unaryValueType(op, operand.valueType)); 36125 } 36126 _makeTernary(cond, then, otherwise) { 36127 if (cond.type === PS_NODE.const) { 36128 return cond.value ? then : otherwise; 36129 } 36130 if (_nodesEqual(then, otherwise)) { 36131 return then; 36132 } 36133 if (then.type === PS_NODE.const && otherwise.type === PS_NODE.const) { 36134 if (then.value === true && otherwise.value === false) { 36135 return cond; 36136 } 36137 if (then.value === false && otherwise.value === true) { 36138 return this._makeUnary(TOKEN.not, cond); 36139 } 36140 } 36141 if (cond.type === PS_NODE.binary) { 36142 const { 36143 op: cop, 36144 first: cf, 36145 second: cs 36146 } = cond; 36147 if (cop === TOKEN.gt || cop === TOKEN.ge) { 36148 if (_nodesEqual(then, cf) && _nodesEqual(otherwise, cs)) { 36149 return this._makeBinary(TOKEN.min, cf, cs); 36150 } 36151 if (_nodesEqual(then, cs) && _nodesEqual(otherwise, cf)) { 36152 return this._makeBinary(TOKEN.max, cf, cs); 36153 } 36154 } else if (cop === TOKEN.lt || cop === TOKEN.le) { 36155 if (_nodesEqual(then, cf) && _nodesEqual(otherwise, cs)) { 36156 return this._makeBinary(TOKEN.max, cf, cs); 36157 } 36158 if (_nodesEqual(then, cs) && _nodesEqual(otherwise, cf)) { 36159 return this._makeBinary(TOKEN.min, cf, cs); 36160 } 36161 } 36162 } 36163 return new PsTernaryNode(cond, then, otherwise, then.valueType === otherwise.valueType ? then.valueType : PS_VALUE_TYPE.unknown); 36164 } 36165} 36166 36167;// ./src/core/postscript/js_evaluator.js 36168 36169 36170
36171 36172 36173
vendor: 19,296 bytes, lines 36174-36935
36174 36175 36176 36177 36178const OP = { 36179 ARG: 0, 36180 CONST: 1, 36181 STORE: 2, 36182 IF: 3, 36183 JUMP: 4, 36184 ABS: 5, 36185 NEG: 6, 36186 CEIL: 7, 36187 FLOOR: 8, 36188 ROUND: 9, 36189 TRUNC: 10, 36190 NOT_B: 11, 36191 NOT_N: 12, 36192 SQRT: 13, 36193 SIN: 14, 36194 COS: 15, 36195 LN: 16, 36196 LOG10: 17, 36197 CVI: 18, 36198 SHIFT: 19, 36199 ADD: 20, 36200 SUB: 21, 36201 MUL: 22, 36202 DIV: 23, 36203 IDIV: 24, 36204 MOD: 25, 36205 POW: 26, 36206 EQ: 27, 36207 NE: 28, 36208 GT: 29, 36209 GE: 30, 36210 LT: 31, 36211 LE: 32, 36212 AND: 33, 36213 OR: 34, 36214 XOR: 35, 36215 ATAN: 36, 36216 MIN: 37, 36217 MAX: 38, 36218 TEE_TMP: 39, 36219 LOAD_TMP: 40 36220}; 36221const _DEG_TO_RAD = Math.PI / 180; 36222const _RAD_TO_DEG = 180 / Math.PI; 36223class PsJsCompiler { 36224 static #stack = new Float64Array(64); 36225 static #tmp = new Float64Array(64); 36226 constructor(domain, range) { 36227 this.nIn = domain.length >> 1; 36228 this.nOut = range.length >> 1; 36229 this.range = range; 36230 this.ir = []; 36231 this._tmpMap = new Map(); 36232 this._nextTmp = 0; 36233 } 36234 _compileNode(node) { 36235 if (node.shared) { 36236 const cached = this._tmpMap.get(node); 36237 if (cached !== undefined) { 36238 this.ir.push(OP.LOAD_TMP, cached); 36239 return true; 36240 } 36241 if (!this._compileNodeImpl(node)) { 36242 return false; 36243 } 36244 const slot = this._nextTmp++; 36245 this._tmpMap.set(node, slot); 36246 this.ir.push(OP.TEE_TMP, slot); 36247 return true; 36248 } 36249 return this._compileNodeImpl(node); 36250 } 36251 _compileNodeImpl(node) { 36252 switch (node.type) { 36253 case PS_NODE.arg: 36254 this.ir.push(OP.ARG, node.index); 36255 return true; 36256 case PS_NODE.const: 36257 { 36258 const v = node.value; 36259 this.ir.push(OP.CONST, typeof v === "boolean" ? Number(v) : v); 36260 return true; 36261 } 36262 case PS_NODE.unary: 36263 return this._compileUnary(node); 36264 case PS_NODE.binary: 36265 return this._compileBinary(node); 36266 case PS_NODE.ternary: 36267 return this._compileTernary(node); 36268 default: 36269 return false; 36270 } 36271 } 36272 _compileUnary(node) { 36273 const { 36274 op, 36275 operand, 36276 valueType 36277 } = node; 36278 if (op === TOKEN.cvr) { 36279 return this._compileNode(operand); 36280 } 36281 if (!this._compileNode(operand)) { 36282 return false; 36283 } 36284 switch (op) { 36285 case TOKEN.abs: 36286 this.ir.push(OP.ABS); 36287 break; 36288 case TOKEN.neg: 36289 this.ir.push(OP.NEG); 36290 break; 36291 case TOKEN.ceiling: 36292 this.ir.push(OP.CEIL); 36293 break; 36294 case TOKEN.floor: 36295 this.ir.push(OP.FLOOR); 36296 break; 36297 case TOKEN.round: 36298 this.ir.push(OP.ROUND); 36299 break; 36300 case TOKEN.truncate: 36301 this.ir.push(OP.TRUNC); 36302 break; 36303 case TOKEN.sqrt: 36304 this.ir.push(OP.SQRT); 36305 break; 36306 case TOKEN.sin: 36307 this.ir.push(OP.SIN); 36308 break; 36309 case TOKEN.cos: 36310 this.ir.push(OP.COS); 36311 break; 36312 case TOKEN.ln: 36313 this.ir.push(OP.LN); 36314 break; 36315 case TOKEN.log: 36316 this.ir.push(OP.LOG10); 36317 break; 36318 case TOKEN.cvi: 36319 this.ir.push(OP.CVI); 36320 break; 36321 case TOKEN.not: 36322 if (valueType === PS_VALUE_TYPE.boolean) { 36323 this.ir.push(OP.NOT_B); 36324 } else if (valueType === PS_VALUE_TYPE.numeric) { 36325 this.ir.push(OP.NOT_N); 36326 } else { 36327 return false; 36328 } 36329 break; 36330 default: 36331 return false; 36332 } 36333 return true; 36334 } 36335 _compileBinary(node) { 36336 const { 36337 op, 36338 first, 36339 second 36340 } = node; 36341 if (op === TOKEN.bitshift) { 36342 if (first.type !== PS_NODE.const || !Number.isInteger(first.value)) { 36343 return false; 36344 } 36345 if (!this._compileNode(second)) { 36346 return false; 36347 } 36348 this.ir.push(OP.SHIFT, first.value); 36349 return true; 36350 } 36351 if (!this._compileNode(second)) { 36352 return false; 36353 } 36354 if (!this._compileNode(first)) { 36355 return false; 36356 } 36357 switch (op) { 36358 case TOKEN.add: 36359 this.ir.push(OP.ADD); 36360 break; 36361 case TOKEN.sub: 36362 this.ir.push(OP.SUB); 36363 break; 36364 case TOKEN.mul: 36365 this.ir.push(OP.MUL); 36366 break; 36367 case TOKEN.div: 36368 this.ir.push(OP.DIV); 36369 break; 36370 case TOKEN.idiv: 36371 this.ir.push(OP.IDIV); 36372 break; 36373 case TOKEN.mod: 36374 this.ir.push(OP.MOD); 36375 break; 36376 case TOKEN.exp: 36377 this.ir.push(OP.POW); 36378 break; 36379 case TOKEN.eq: 36380 this.ir.push(OP.EQ); 36381 break; 36382 case TOKEN.ne: 36383 this.ir.push(OP.NE); 36384 break; 36385 case TOKEN.gt: 36386 this.ir.push(OP.GT); 36387 break; 36388 case TOKEN.ge: 36389 this.ir.push(OP.GE); 36390 break; 36391 case TOKEN.lt: 36392 this.ir.push(OP.LT); 36393 break; 36394 case TOKEN.le: 36395 this.ir.push(OP.LE); 36396 break; 36397 case TOKEN.and: 36398 this.ir.push(OP.AND); 36399 break; 36400 case TOKEN.or: 36401 this.ir.push(OP.OR); 36402 break; 36403 case TOKEN.xor: 36404 this.ir.push(OP.XOR); 36405 break; 36406 case TOKEN.atan: 36407 this.ir.push(OP.ATAN); 36408 break; 36409 case TOKEN.min: 36410 this.ir.push(OP.MIN); 36411 break; 36412 case TOKEN.max: 36413 this.ir.push(OP.MAX); 36414 break; 36415 default: 36416 return false; 36417 } 36418 return true; 36419 } 36420 _compileTernary(node) { 36421 if (!this._compileNode(node.cond)) { 36422 return false; 36423 } 36424 this.ir.push(OP.IF, 0); 36425 const ifPatch = this.ir.length - 1; 36426 if (!this._compileNode(node.then)) { 36427 return false; 36428 } 36429 this.ir.push(OP.JUMP, 0); 36430 const jumpPatch = this.ir.length - 1; 36431 this.ir[ifPatch] = this.ir.length; 36432 if (!this._compileNode(node.otherwise)) { 36433 return false; 36434 } 36435 this.ir[jumpPatch] = this.ir.length; 36436 return true; 36437 } 36438 compile(program) { 36439 const outputs = new PSStackToTree().evaluate(program, this.nIn); 36440 if (!outputs || outputs.length < this.nOut) { 36441 return null; 36442 } 36443 for (let i = 0; i < this.nOut; i++) { 36444 if (!this._compileNode(outputs[i])) { 36445 return null; 36446 } 36447 const min = this.range[i * 2]; 36448 const max = this.range[i * 2 + 1]; 36449 this.ir.push(OP.STORE, i, min, max); 36450 } 36451 return new Float64Array(this.ir); 36452 } 36453 static execute(ir, src, srcOffset, dest, destOffset) { 36454 let ip = 0, 36455 sp = 0; 36456 const n = ir.length; 36457 const stack = this.#stack; 36458 const tmp = this.#tmp; 36459 while (ip < n) { 36460 switch (ir[ip++] | 0) { 36461 case OP.ARG: 36462 stack[sp++] = src[srcOffset + (ir[ip++] | 0)]; 36463 break; 36464 case OP.CONST: 36465 stack[sp++] = ir[ip++]; 36466 break; 36467 case OP.STORE: 36468 { 36469 const slot = ir[ip++] | 0; 36470 const min = ir[ip++]; 36471 const max = ir[ip++]; 36472 dest[destOffset + slot] = MathClamp(stack[--sp], min, max); 36473 break; 36474 } 36475 case OP.IF: 36476 { 36477 const tgt = ir[ip++]; 36478 if (stack[--sp] === 0) { 36479 ip = tgt; 36480 } 36481 break; 36482 } 36483 case OP.JUMP: 36484 ip = ir[ip]; 36485 break; 36486 case OP.ABS: 36487 stack[sp - 1] = Math.abs(stack[sp - 1]); 36488 break; 36489 case OP.NEG: 36490 stack[sp - 1] = -stack[sp - 1]; 36491 break; 36492 case OP.CEIL: 36493 stack[sp - 1] = Math.ceil(stack[sp - 1]); 36494 break; 36495 case OP.FLOOR: 36496 stack[sp - 1] = Math.floor(stack[sp - 1]); 36497 break; 36498 case OP.ROUND: 36499 stack[sp - 1] = Math.floor(stack[sp - 1] + 0.5); 36500 break; 36501 case OP.TRUNC: 36502 stack[sp - 1] = Math.trunc(stack[sp - 1]); 36503 break; 36504 case OP.NOT_B: 36505 stack[sp - 1] = stack[sp - 1] !== 0 ? 0 : 1; 36506 break; 36507 case OP.NOT_N: 36508 stack[sp - 1] = ~(stack[sp - 1] | 0); 36509 break; 36510 case OP.SQRT: 36511 stack[sp - 1] = Math.sqrt(stack[sp - 1]); 36512 break; 36513 case OP.SIN: 36514 stack[sp - 1] = Math.sin(stack[sp - 1] % 360 * _DEG_TO_RAD); 36515 break; 36516 case OP.COS: 36517 stack[sp - 1] = Math.cos(stack[sp - 1] % 360 * _DEG_TO_RAD); 36518 break; 36519 case OP.LN: 36520 stack[sp - 1] = Math.log(stack[sp - 1]); 36521 break; 36522 case OP.LOG10: 36523 stack[sp - 1] = Math.log10(stack[sp - 1]); 36524 break; 36525 case OP.CVI: 36526 stack[sp - 1] = Math.trunc(stack[sp - 1]) | 0; 36527 break; 36528 case OP.SHIFT: 36529 { 36530 const amt = ir[ip++]; 36531 const v = stack[sp - 1] | 0; 36532 if (amt > 0) { 36533 stack[sp - 1] = v << amt; 36534 } else if (amt < 0) { 36535 stack[sp - 1] = v >> -amt; 36536 } else { 36537 stack[sp - 1] = v; 36538 } 36539 break; 36540 } 36541 case OP.ADD: 36542 { 36543 const b = stack[--sp]; 36544 stack[sp - 1] += b; 36545 break; 36546 } 36547 case OP.SUB: 36548 { 36549 const b = stack[--sp]; 36550 stack[sp - 1] -= b; 36551 break; 36552 } 36553 case OP.MUL: 36554 { 36555 const b = stack[--sp]; 36556 stack[sp - 1] *= b; 36557 break; 36558 } 36559 case OP.DIV: 36560 { 36561 const b = stack[--sp]; 36562 stack[sp - 1] = b !== 0 ? stack[sp - 1] / b : 0; 36563 break; 36564 } 36565 case OP.IDIV: 36566 { 36567 const b = stack[--sp]; 36568 stack[sp - 1] = b !== 0 ? Math.trunc(stack[sp - 1] / b) : 0; 36569 break; 36570 } 36571 case OP.MOD: 36572 { 36573 const b = stack[--sp]; 36574 stack[sp - 1] = b !== 0 ? stack[sp - 1] % b : 0; 36575 break; 36576 } 36577 case OP.POW: 36578 { 36579 const b = stack[--sp]; 36580 stack[sp - 1] **= b; 36581 break; 36582 } 36583 case OP.EQ: 36584 { 36585 const b = stack[--sp]; 36586 stack[sp - 1] = stack[sp - 1] === b ? 1 : 0; 36587 break; 36588 } 36589 case OP.NE: 36590 { 36591 const b = stack[--sp]; 36592 stack[sp - 1] = stack[sp - 1] !== b ? 1 : 0; 36593 break; 36594 } 36595 case OP.GT: 36596 { 36597 const b = stack[--sp]; 36598 stack[sp - 1] = stack[sp - 1] > b ? 1 : 0; 36599 break; 36600 } 36601 case OP.GE: 36602 { 36603 const b = stack[--sp]; 36604 stack[sp - 1] = stack[sp - 1] >= b ? 1 : 0; 36605 break; 36606 } 36607 case OP.LT: 36608 { 36609 const b = stack[--sp]; 36610 stack[sp - 1] = stack[sp - 1] < b ? 1 : 0; 36611 break; 36612 } 36613 case OP.LE: 36614 { 36615 const b = stack[--sp]; 36616 stack[sp - 1] = stack[sp - 1] <= b ? 1 : 0; 36617 break; 36618 } 36619 case OP.AND: 36620 { 36621 const b = stack[--sp] | 0; 36622 stack[sp - 1] = (stack[sp - 1] | 0) & b; 36623 break; 36624 } 36625 case OP.OR: 36626 { 36627 const b = stack[--sp] | 0; 36628 stack[sp - 1] = stack[sp - 1] | 0 | b; 36629 break; 36630 } 36631 case OP.XOR: 36632 { 36633 const b = stack[--sp] | 0; 36634 stack[sp - 1] = (stack[sp - 1] | 0) ^ b; 36635 break; 36636 } 36637 case OP.ATAN: 36638 { 36639 const b = stack[--sp]; 36640 const deg = Math.atan2(stack[sp - 1], b) * _RAD_TO_DEG; 36641 stack[sp - 1] = deg < 0 ? deg + 360 : deg; 36642 break; 36643 } 36644 case OP.MIN: 36645 { 36646 const b = stack[--sp]; 36647 stack[sp - 1] = Math.min(stack[sp - 1], b); 36648 break; 36649 } 36650 case OP.MAX: 36651 { 36652 const b = stack[--sp]; 36653 stack[sp - 1] = Math.max(stack[sp - 1], b); 36654 break; 36655 } 36656 case OP.TEE_TMP: 36657 tmp[ir[ip++] | 0] = stack[sp - 1]; 36658 break; 36659 case OP.LOAD_TMP: 36660 stack[sp++] = tmp[ir[ip++] | 0]; 36661 break; 36662 } 36663 } 36664 } 36665} 36666class PSStackBasedInterpreter { 36667 static #stack = new Float64Array(100); 36668 static #sp = 0; 36669 static #push(v) { 36670 if (this.#sp < this.#stack.length) { 36671 this.#stack[this.#sp++] = v; 36672 } 36673 } 36674 static #execOp(op) { 36675 const stack = this.#stack; 36676 switch (op) { 36677 case TOKEN.true: 36678 this.#push(1); 36679 break; 36680 case TOKEN.false: 36681 this.#push(0); 36682 break; 36683 case TOKEN.abs: 36684 stack[this.#sp - 1] = Math.abs(stack[this.#sp - 1]); 36685 break; 36686 case TOKEN.neg: 36687 stack[this.#sp - 1] = -stack[this.#sp - 1]; 36688 break; 36689 case TOKEN.ceiling: 36690 stack[this.#sp - 1] = Math.ceil(stack[this.#sp - 1]); 36691 break; 36692 case TOKEN.floor: 36693 stack[this.#sp - 1] = Math.floor(stack[this.#sp - 1]); 36694 break; 36695 case TOKEN.round: 36696 stack[this.#sp - 1] = Math.floor(stack[this.#sp - 1] + 0.5); 36697 break; 36698 case TOKEN.truncate: 36699 stack[this.#sp - 1] = Math.trunc(stack[this.#sp - 1]); 36700 break; 36701 case TOKEN.sqrt: 36702 stack[this.#sp - 1] = Math.sqrt(stack[this.#sp - 1]); 36703 break; 36704 case TOKEN.sin: 36705 stack[this.#sp - 1] = Math.sin(stack[this.#sp - 1] % 360 * _DEG_TO_RAD); 36706 break; 36707 case TOKEN.cos: 36708 stack[this.#sp - 1] = Math.cos(stack[this.#sp - 1] % 360 * _DEG_TO_RAD); 36709 break; 36710 case TOKEN.ln: 36711 stack[this.#sp - 1] = Math.log(stack[this.#sp - 1]); 36712 break; 36713 case TOKEN.log: 36714 stack[this.#sp - 1] = Math.log10(stack[this.#sp - 1]); 36715 break; 36716 case TOKEN.cvi: 36717 stack[this.#sp - 1] = Math.trunc(stack[this.#sp - 1]) | 0; 36718 break; 36719 case TOKEN.cvr: 36720 break; 36721 case TOKEN.not: 36722 { 36723 const v = stack[this.#sp - 1]; 36724 stack[this.#sp - 1] = v === 0 || v === 1 ? 1 - v : ~(v | 0); 36725 break; 36726 } 36727 case TOKEN.add: 36728 { 36729 const b = stack[--this.#sp]; 36730 stack[this.#sp - 1] += b; 36731 break; 36732 } 36733 case TOKEN.sub: 36734 { 36735 const b = stack[--this.#sp]; 36736 stack[this.#sp - 1] -= b; 36737 break; 36738 } 36739 case TOKEN.mul: 36740 { 36741 const b = stack[--this.#sp]; 36742 stack[this.#sp - 1] *= b; 36743 break; 36744 } 36745 case TOKEN.div: 36746 { 36747 const b = stack[--this.#sp]; 36748 stack[this.#sp - 1] = b !== 0 ? stack[this.#sp - 1] / b : 0; 36749 break; 36750 } 36751 case TOKEN.idiv: 36752 { 36753 const b = stack[--this.#sp]; 36754 stack[this.#sp - 1] = b !== 0 ? Math.trunc(stack[this.#sp - 1] / b) : 0; 36755 break; 36756 } 36757 case TOKEN.mod: 36758 { 36759 const b = stack[--this.#sp]; 36760 stack[this.#sp - 1] = b !== 0 ? stack[this.#sp - 1] % b : 0; 36761 break; 36762 } 36763 case TOKEN.exp: 36764 { 36765 const b = stack[--this.#sp]; 36766 stack[this.#sp - 1] **= b; 36767 break; 36768 } 36769 case TOKEN.atan: 36770 { 36771 const dx = stack[--this.#sp]; 36772 const deg = Math.atan2(stack[this.#sp - 1], dx) * _RAD_TO_DEG; 36773 stack[this.#sp - 1] = deg < 0 ? deg + 360 : deg; 36774 break; 36775 } 36776 case TOKEN.eq: 36777 { 36778 const b = stack[--this.#sp]; 36779 stack[this.#sp - 1] = stack[this.#sp - 1] === b ? 1 : 0; 36780 break; 36781 } 36782 case TOKEN.ne: 36783 { 36784 const b = stack[--this.#sp]; 36785 stack[this.#sp - 1] = stack[this.#sp - 1] !== b ? 1 : 0; 36786 break; 36787 } 36788 case TOKEN.gt: 36789 { 36790 const b = stack[--this.#sp]; 36791 stack[this.#sp - 1] = stack[this.#sp - 1] > b ? 1 : 0; 36792 break; 36793 } 36794 case TOKEN.ge: 36795 { 36796 const b = stack[--this.#sp]; 36797 stack[this.#sp - 1] = stack[this.#sp - 1] >= b ? 1 : 0; 36798 break; 36799 } 36800 case TOKEN.lt: 36801 { 36802 const b = stack[--this.#sp]; 36803 stack[this.#sp - 1] = stack[this.#sp - 1] < b ? 1 : 0; 36804 break; 36805 } 36806 case TOKEN.le: 36807 { 36808 const b = stack[--this.#sp]; 36809 stack[this.#sp - 1] = stack[this.#sp - 1] <= b ? 1 : 0; 36810 break; 36811 } 36812 case TOKEN.and: 36813 { 36814 const b = stack[--this.#sp] | 0; 36815 stack[this.#sp - 1] = (stack[this.#sp - 1] | 0) & b; 36816 break; 36817 } 36818 case TOKEN.or: 36819 { 36820 const b = stack[--this.#sp] | 0; 36821 stack[this.#sp - 1] = stack[this.#sp - 1] | 0 | b; 36822 break; 36823 } 36824 case TOKEN.xor: 36825 { 36826 const b = stack[--this.#sp] | 0; 36827 stack[this.#sp - 1] = (stack[this.#sp - 1] | 0) ^ b; 36828 break; 36829 } 36830 case TOKEN.bitshift: 36831 { 36832 const amt = stack[--this.#sp] | 0; 36833 const v = stack[this.#sp - 1] | 0; 36834 stack[this.#sp - 1] = amt > 0 ? v << amt : v >> -amt; 36835 break; 36836 } 36837 case TOKEN.min: 36838 { 36839 const b = stack[--this.#sp]; 36840 stack[this.#sp - 1] = Math.min(stack[this.#sp - 1], b); 36841 break; 36842 } 36843 case TOKEN.max: 36844 { 36845 const b = stack[--this.#sp]; 36846 stack[this.#sp - 1] = Math.max(stack[this.#sp - 1], b); 36847 break; 36848 } 36849 case TOKEN.dup: 36850 this.#push(stack[this.#sp - 1]); 36851 break; 36852 case TOKEN.exch: 36853 { 36854 const a = stack[--this.#sp]; 36855 const b = stack[--this.#sp]; 36856 this.#push(a); 36857 this.#push(b); 36858 break; 36859 } 36860 case TOKEN.pop: 36861 this.#sp--; 36862 break; 36863 case TOKEN.copy: 36864 { 36865 const n = Math.trunc(stack[--this.#sp]); 36866 const base = this.#sp - n; 36867 for (let k = 0; k < n; k++) { 36868 this.#push(stack[base + k]); 36869 } 36870 break; 36871 } 36872 case TOKEN.index: 36873 { 36874 const i = Math.trunc(stack[--this.#sp]); 36875 this.#push(stack[this.#sp - 1 - i]); 36876 break; 36877 } 36878 case TOKEN.roll: 36879 { 36880 const j = Math.trunc(stack[--this.#sp]); 36881 const n = Math.trunc(stack[--this.#sp]); 36882 if (n > 1 && j !== 0) { 36883 const mod = (j % n + n) % n; 36884 if (mod !== 0) { 36885 const base = this.#sp - n; 36886 const sub = stack.slice(base, this.#sp); 36887 for (let k = 0; k < n; k++) { 36888 stack[base + k] = sub[(k - mod + n) % n]; 36889 } 36890 } 36891 } 36892 break; 36893 } 36894 } 36895 } 36896 static #execBlock(instructions) { 36897 for (const instr of instructions) { 36898 switch (instr.type) { 36899 case PS_NODE.number: 36900 this.#push(instr.value); 36901 break; 36902 case PS_NODE.operator: 36903 this.#execOp(instr.op); 36904 break; 36905 case PS_NODE.if: 36906 if (this.#stack[--this.#sp] !== 0) { 36907 this.#execBlock(instr.then.instructions); 36908 } 36909 break; 36910 case PS_NODE.ifelse: 36911 if (this.#stack[--this.#sp] !== 0) { 36912 this.#execBlock(instr.then.instructions); 36913 } else { 36914 this.#execBlock(instr.otherwise.instructions); 36915 } 36916 break; 36917 } 36918 } 36919 } 36920 static build(program, domain, range) { 36921 const nIn = domain.length >> 1; 36922 const nOut = range.length >> 1; 36923 const { 36924 instructions 36925 } = program.body; 36926 return (src, srcOffset, dest, destOffset) => { 36927 this.#sp = 0; 36928 for (let i = 0; i < nIn; i++) { 36929 this.#push(src[srcOffset + i]); 36930 } 36931 this.#execBlock(instructions); 36932 const base = this.#sp - nOut; 36933 for (let i = 0; i < nOut; i++) { 36934 const v = base + i >= 0 ? this.#stack[base + i] : 0; 36935 dest[destOffset + i] = MathClamp(
36935range[i * 2 + 1], range[i * 2], v); 36936 } 36937 }; 36938 } 36939} 36940function buildPostScriptJsFunction(source, domain, range, forceInterpreter = false) { 36941 const program = parsePostScriptFunction(source); 36942 const ir = !forceInterpreter && new PsJsCompiler(domain, range).compile(program); 36943 if (ir) { 36944 return (src, srcOffset, dest, destOffset) => { 36945 PsJsCompiler.execute(ir, src, srcOffset, dest, destOffset); 36946 }; 36947 } 36948 return PSStackBasedInterpreter.build(program, domain, range); 36949} 36950 36951;// ./src/core/postscript/wasm_compiler.js 36952 36953 36954 36955 36956 36957 36958 36959 36960 36961 36962 36963 36964 36965const wasm_compiler_OP = { 36966 if: 0x04, 36967 else: 0x05, 36968 end: 0x0b, 36969 select: 0x1b, 36970 call: 0x10, 36971 local_get: 0x20, 36972 local_set: 0x21, 36973 local_tee: 0x22, 36974 i32_const: 0x41, 36975 i32_eqz: 0x45, 36976 i32_and: 0x71, 36977 i32_or: 0x72, 36978 i32_xor: 0x73, 36979 i32_shl: 0x74, 36980 i32_shr_s: 0x75,
vendor: 4,156 bytes, lines 36981-37111
36981 i32_trunc_f64_s: 0xaa, 36982 f64_const: 0x44, 36983 f64_eq: 0x61, 36984 f64_ne: 0x62, 36985 f64_lt: 0x63, 36986 f64_gt: 0x64, 36987 f64_le: 0x65, 36988 f64_ge: 0x66, 36989 f64_abs: 0x99, 36990 f64_neg: 0x9a, 36991 f64_ceil: 0x9b, 36992 f64_floor: 0x9c, 36993 f64_trunc: 0x9d, 36994 f64_nearest: 0x9e, 36995 f64_sqrt: 0x9f, 36996 f64_add: 0xa0, 36997 f64_sub: 0xa1, 36998 f64_mul: 0xa2, 36999 f64_div: 0xa3, 37000 f64_min: 0xa4, 37001 f64_max: 0xa5, 37002 f64_convert_i32_s: 0xb7, 37003 f64_store: 0x39 37004}; 37005const FUNC_TYPE = 0x60; 37006const F64 = 0x7c; 37007const SECTION = { 37008 type: 0x01, 37009 import: 0x02, 37010 function: 0x03, 37011 memory: 0x05, 37012 export: 0x07, 37013 code: 0x0a 37014}; 37015const EXTERN_FUNC = 0x00; 37016const EXTERN_MEM = 0x02; 37017function unsignedLEB128(n) { 37018 const out = []; 37019 do { 37020 let byte = n & 0x7f; 37021 n >>>= 7; 37022 if (n !== 0) { 37023 byte |= 0x80; 37024 } 37025 out.push(byte); 37026 } while (n !== 0); 37027 return out; 37028} 37029function encodeASCIIString(s) { 37030 return [...unsignedLEB128(s.length), ...Array.from(s, c => c.charCodeAt(0))]; 37031} 37032function section(id, data) { 37033 return [id, ...unsignedLEB128(data.length), ...data]; 37034} 37035function vec(items) { 37036 const out = unsignedLEB128(items.length); 37037 for (const item of items) { 37038 if (typeof item === "number") { 37039 out.push(item); 37040 continue; 37041 } 37042 for (const byte of item) { 37043 out.push(byte); 37044 } 37045 } 37046 return out; 37047} 37048const MATH_IMPORTS = [["sin", "Math", "sin", [F64], [F64]], ["cos", "Math", "cos", [F64], [F64]], ["atan2", "Math", "atan2", [F64, F64], [F64]], ["log", "Math", "log", [F64], [F64]], ["log10", "Math", "log10", [F64], [F64]], ["pow", "Math", "pow", [F64, F64], [F64]]]; 37049const _mathImportObject = { 37050 Math: Object.fromEntries(MATH_IMPORTS.map(([name]) => [name, Math[name]])) 37051}; 37052class PsWasmCompiler { 37053 static #initialized = false; 37054 static #comparisonToOp = null; 37055 static #importIdx = null; 37056 static #degToRad = 0; 37057 static #radToDeg = 0; 37058 static #importTypeEntries = null; 37059 static #importSection = null; 37060 static #functionSection = null; 37061 static #memorySection = null; 37062 static #exportSection = null; 37063 static #wasmMagicVersion = null; 37064 static #f64View = null; 37065 static #f64Arr = null; 37066 static #init() { 37067 this.#comparisonToOp = new Map([[TOKEN.eq, wasm_compiler_OP.f64_eq], [TOKEN.ne, wasm_compiler_OP.f64_ne], [TOKEN.lt, wasm_compiler_OP.f64_lt], [TOKEN.le, wasm_compiler_OP.f64_le], [TOKEN.gt, wasm_compiler_OP.f64_gt], [TOKEN.ge, wasm_compiler_OP.f64_ge]]); 37068 this.#importIdx = Object.create(null); 37069 for (let i = 0; i < MATH_IMPORTS.length; i++) { 37070 this.#importIdx[MATH_IMPORTS[i][0]] = i; 37071 } 37072 this.#degToRad = Math.PI / 180; 37073 this.#radToDeg = 180 / Math.PI; 37074 this.#importTypeEntries = MATH_IMPORTS.map(([,,, params, results]) => [FUNC_TYPE, ...vec(params), ...vec(results)]); 37075 this.#importSection = new Uint8Array(section(SECTION.import, vec(MATH_IMPORTS.map(([, mod, field], i) => [...encodeASCIIString(mod), ...encodeASCIIString(field), EXTERN_FUNC, ...unsignedLEB128(i + 1)])))); 37076 this.#functionSection = new Uint8Array(section(SECTION.function, vec([[0]]))); 37077 this.#memorySection = new Uint8Array(section(SECTION.memory, vec([[0x00, 0x01]]))); 37078 this.#exportSection = new Uint8Array(section(SECTION.export, vec([[...encodeASCIIString("fn"), EXTERN_FUNC, ...unsignedLEB128(MATH_IMPORTS.length)], [...encodeASCIIString("mem"), EXTERN_MEM, 0x00]]))); 37079 this.#wasmMagicVersion = new Uint8Array([0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00]); 37080 const f64Buf = new ArrayBuffer(8); 37081 this.#f64View = new DataView(f64Buf); 37082 this.#f64Arr = new Uint8Array(f64Buf); 37083 this.#initialized = true; 37084 } 37085 constructor(domain, range) { 37086 if (!PsWasmCompiler.#initialized) { 37087 PsWasmCompiler.#init(); 37088 } 37089 this._nIn = domain.length >> 1; 37090 this._nOut = range.length >> 1; 37091 this._range = range; 37092 this._code = []; 37093 this._nextLocal = this._nIn; 37094 this._freeLocals = []; 37095 this._sharedLocals = new Map(); 37096 } 37097 _allocLocal() { 37098 return this._freeLocals.pop() ?? this._nextLocal++; 37099 } 37100 _releaseLocal(idx) { 37101 this._freeLocals.push(idx); 37102 } 37103 _emitULEB128(n) { 37104 do { 37105 let b = n & 0x7f; 37106 n >>>= 7; 37107 if (n !== 0) { 37108 b |= 0x80; 37109 } 37110 this._code.push(b); 37111 } while (n !== 0);
vendor: 6,123 bytes, lines 37111-37321
37111 37112 } 37113 _emitF64Const(value) { 37114 this._code.push(wasm_compiler_OP.f64_const); 37115 PsWasmCompiler.#f64View.setFloat64(0, value, true); 37116 for (let i = 0; i < 8; i++) { 37117 this._code.push(PsWasmCompiler.#f64Arr[i]); 37118 } 37119 } 37120 _emitLocalGet(idx) { 37121 this._code.push(wasm_compiler_OP.local_get); 37122 this._emitULEB128(idx); 37123 } 37124 _emitLocalSet(idx) { 37125 this._code.push(wasm_compiler_OP.local_set); 37126 this._emitULEB128(idx); 37127 } 37128 _emitLocalTee(idx) { 37129 this._code.push(wasm_compiler_OP.local_tee); 37130 this._emitULEB128(idx); 37131 } 37132 _compileNode(node) { 37133 if (node.shared) { 37134 const entry = this._sharedLocals.get(node); 37135 if (entry !== undefined) { 37136 this._emitLocalGet(entry.local); 37137 if (--entry.remaining === 0) { 37138 this._releaseLocal(entry.local); 37139 } 37140 return true; 37141 } 37142 if (!this._compileNodeImpl(node)) { 37143 return false; 37144 } 37145 const local = this._allocLocal(); 37146 this._sharedLocals.set(node, { 37147 local, 37148 remaining: node.sharedCount - 1 37149 }); 37150 this._emitLocalTee(local); 37151 return true; 37152 } 37153 return this._compileNodeImpl(node); 37154 } 37155 _compileNodeImpl(node) { 37156 switch (node.type) { 37157 case PS_NODE.arg: 37158 this._emitLocalGet(node.index); 37159 return true; 37160 case PS_NODE.const: 37161 { 37162 let v = node.value; 37163 if (typeof v === "boolean") { 37164 v = v ? 1 : 0; 37165 } 37166 this._emitF64Const(v); 37167 return true; 37168 } 37169 case PS_NODE.unary: 37170 return this._compileUnaryNode(node); 37171 case PS_NODE.binary: 37172 return this._compileBinaryNode(node); 37173 case PS_NODE.ternary: 37174 return this._compileTernaryNode(node); 37175 default: 37176 return false; 37177 } 37178 } 37179 _compileSinCosNode(node) { 37180 const local = this._allocLocal(); 37181 try { 37182 if (!this._compileNode(node.operand)) { 37183 return false; 37184 } 37185 const code = this._code; 37186 this._emitLocalSet(local); 37187 this._emitLocalGet(local); 37188 this._emitLocalGet(local); 37189 this._emitF64Const(360); 37190 code.push(wasm_compiler_OP.f64_div, wasm_compiler_OP.f64_trunc); 37191 this._emitF64Const(360); 37192 code.push(wasm_compiler_OP.f64_mul, wasm_compiler_OP.f64_sub); 37193 this._emitF64Const(PsWasmCompiler.#degToRad); 37194 code.push(wasm_compiler_OP.f64_mul, wasm_compiler_OP.call); 37195 this._emitULEB128(PsWasmCompiler.#importIdx[node.op === TOKEN.sin ? "sin" : "cos"]); 37196 return true; 37197 } finally { 37198 this._releaseLocal(local); 37199 } 37200 } 37201 _compileUnaryNode(node) { 37202 const code = this._code; 37203 if (node.op === TOKEN.sin || node.op === TOKEN.cos) { 37204 return this._compileSinCosNode(node); 37205 } 37206 if (node.op === TOKEN.not) { 37207 if (node.valueType === PS_VALUE_TYPE.boolean) { 37208 if (!this._compileNodeAsBoolI32(node.operand)) { 37209 return false; 37210 } 37211 code.push(wasm_compiler_OP.i32_eqz, wasm_compiler_OP.f64_convert_i32_s); 37212 return true; 37213 } 37214 if (node.valueType === PS_VALUE_TYPE.numeric) { 37215 if (!this._compileNode(node.operand)) { 37216 return false; 37217 } 37218 code.push(wasm_compiler_OP.i32_trunc_f64_s, wasm_compiler_OP.i32_const, 0x7f, wasm_compiler_OP.i32_xor, wasm_compiler_OP.f64_convert_i32_s); 37219 return true; 37220 } 37221 return false; 37222 } 37223 if (!this._compileNode(node.operand)) { 37224 return false; 37225 } 37226 switch (node.op) { 37227 case TOKEN.abs: 37228 code.push(wasm_compiler_OP.f64_abs); 37229 break; 37230 case TOKEN.neg: 37231 code.push(wasm_compiler_OP.f64_neg); 37232 break; 37233 case TOKEN.sqrt: 37234 code.push(wasm_compiler_OP.f64_sqrt); 37235 break; 37236 case TOKEN.floor: 37237 code.push(wasm_compiler_OP.f64_floor); 37238 break; 37239 case TOKEN.ceiling: 37240 code.push(wasm_compiler_OP.f64_ceil); 37241 break; 37242 case TOKEN.round: 37243 this._emitF64Const(0.5); 37244 code.push(wasm_compiler_OP.f64_add, wasm_compiler_OP.f64_floor); 37245 break; 37246 case TOKEN.truncate: 37247 code.push(wasm_compiler_OP.f64_trunc); 37248 break; 37249 case TOKEN.cvi: 37250 code.push(wasm_compiler_OP.i32_trunc_f64_s, wasm_compiler_OP.f64_convert_i32_s); 37251 break; 37252 case TOKEN.cvr: 37253 break; 37254 case TOKEN.ln: 37255 code.push(wasm_compiler_OP.call); 37256 this._emitULEB128(PsWasmCompiler.#importIdx.log); 37257 break; 37258 case TOKEN.log: 37259 code.push(wasm_compiler_OP.call); 37260 this._emitULEB128(PsWasmCompiler.#importIdx.log10); 37261 break; 37262 default: 37263 return false; 37264 } 37265 return true; 37266 } 37267 _compileSafeDivNode(first, second) { 37268 const tmp = this._allocLocal(); 37269 try { 37270 if (!this._compileNode(second)) { 37271 return false; 37272 } 37273 if (!this._compileNode(first)) { 37274 return false; 37275 } 37276 const code = this._code; 37277 this._emitLocalTee(tmp); 37278 code.push(wasm_compiler_OP.f64_div); 37279 this._emitF64Const(0); 37280 this._emitLocalGet(tmp); 37281 this._emitF64Const(0); 37282 code.push(wasm_compiler_OP.f64_ne, wasm_compiler_OP.select); 37283 return true; 37284 } finally { 37285 this._releaseLocal(tmp); 37286 } 37287 } 37288 _compileSafeIdivNode(first, second) { 37289 const tmp = this._allocLocal(); 37290 try { 37291 if (!this._compileNode(second)) { 37292 return false; 37293 } 37294 if (!this._compileNode(first)) { 37295 return false; 37296 } 37297 const code = this._code; 37298 this._emitLocalTee(tmp); 37299 code.push(wasm_compiler_OP.f64_div, wasm_compiler_OP.f64_trunc); 37300 this._emitF64Const(0); 37301 this._emitLocalGet(tmp); 37302 this._emitF64Const(0); 37303 code.push(wasm_compiler_OP.f64_ne, wasm_compiler_OP.select); 37304 return true; 37305 } finally { 37306 this._releaseLocal(tmp); 37307 } 37308 } 37309 _compileBitshiftNode(first, second) { 37310 if (first.type !== PS_NODE.const || !Number.isInteger(first.value)) { 37311 return false; 37312 } 37313 if (!this._compileNode(second)) { 37314 return false; 37315 } 37316 const code = this._code; 37317 code.push(wasm_compiler_OP.i32_trunc_f64_s); 37318 const shift = first.value; 37319 if (shift > 0) { 37320 code.push(wasm_compiler_OP.i32_const); 37321 this._emit
37321ULEB128(shift); 37322 code.push(wasm_compiler_OP.i32_shl); 37323 } else if (shift < 0) { 37324 code.push(wasm_compiler_OP.i32_const); 37325 this._emitU
vendor: 8,478 bytes, lines 37325-37606
37325LEB128(-shift); 37326 code.push(wasm_compiler_OP.i32_shr_s); 37327 } 37328 code.push(wasm_compiler_OP.f64_convert_i32_s); 37329 return true; 37330 } 37331 _compileModNode(first, second) { 37332 if (first.type === PS_NODE.const && first.value === 0) { 37333 if (!this._compileNode(second)) { 37334 return false; 37335 } 37336 this._code.push(wasm_compiler_OP.drop); 37337 this._emitF64Const(0); 37338 return true; 37339 } 37340 const localA = this._allocLocal(); 37341 try { 37342 if (!this._compileNode(second)) { 37343 return false; 37344 } 37345 this._emitLocalTee(localA); 37346 const code = this._code; 37347 if (first.type === PS_NODE.const) { 37348 this._emitLocalGet(localA); 37349 this._emitF64Const(first.value); 37350 code.push(wasm_compiler_OP.f64_div, wasm_compiler_OP.f64_trunc); 37351 this._emitF64Const(first.value); 37352 code.push(wasm_compiler_OP.f64_mul, wasm_compiler_OP.f64_sub); 37353 } else { 37354 const localB = this._allocLocal(); 37355 try { 37356 if (!this._compileNode(first)) { 37357 return false; 37358 } 37359 this._emitLocalSet(localB); 37360 this._emitLocalGet(localA); 37361 this._emitLocalGet(localB); 37362 code.push(wasm_compiler_OP.f64_div, wasm_compiler_OP.f64_trunc); 37363 this._emitLocalGet(localB); 37364 code.push(wasm_compiler_OP.f64_mul, wasm_compiler_OP.f64_sub); 37365 this._emitF64Const(0); 37366 this._emitLocalGet(localB); 37367 this._emitF64Const(0); 37368 code.push(wasm_compiler_OP.f64_ne, wasm_compiler_OP.select); 37369 } finally { 37370 this._releaseLocal(localB); 37371 } 37372 } 37373 return true; 37374 } finally { 37375 this._releaseLocal(localA); 37376 } 37377 } 37378 _compileAtanNode(first, second) { 37379 const localR = this._allocLocal(); 37380 try { 37381 if (!this._compileNode(second)) { 37382 return false; 37383 } 37384 if (!this._compileNode(first)) { 37385 return false; 37386 } 37387 const code = this._code; 37388 code.push(wasm_compiler_OP.call); 37389 this._emitULEB128(PsWasmCompiler.#importIdx.atan2); 37390 this._emitF64Const(PsWasmCompiler.#radToDeg); 37391 code.push(wasm_compiler_OP.f64_mul); 37392 this._emitLocalTee(localR); 37393 this._emitF64Const(0); 37394 code.push(wasm_compiler_OP.f64_lt, wasm_compiler_OP.if, F64); 37395 this._emitLocalGet(localR); 37396 this._emitF64Const(360); 37397 code.push(wasm_compiler_OP.f64_add, wasm_compiler_OP.else); 37398 this._emitLocalGet(localR); 37399 code.push(wasm_compiler_OP.end); 37400 return true; 37401 } finally { 37402 this._releaseLocal(localR); 37403 } 37404 } 37405 _compileBitwiseNode(op, first, second) { 37406 if (!this._compileBitwiseOperandI32(second)) { 37407 return false; 37408 } 37409 if (!this._compileBitwiseOperandI32(first)) { 37410 return false; 37411 } 37412 const code = this._code; 37413 switch (op) { 37414 case TOKEN.and: 37415 code.push(wasm_compiler_OP.i32_and); 37416 break; 37417 case TOKEN.or: 37418 code.push(wasm_compiler_OP.i32_or); 37419 break; 37420 case TOKEN.xor: 37421 code.push(wasm_compiler_OP.i32_xor); 37422 break; 37423 default: 37424 return false; 37425 } 37426 code.push(wasm_compiler_OP.f64_convert_i32_s); 37427 return true; 37428 } 37429 _compileBitwiseOperandI32(node) { 37430 if (node.valueType === PS_VALUE_TYPE.boolean) { 37431 return this._compileNodeAsBoolI32(node); 37432 } 37433 if (!this._compileNode(node)) { 37434 return false; 37435 } 37436 this._code.push(wasm_compiler_OP.i32_trunc_f64_s); 37437 return true; 37438 } 37439 _compileStandardBinaryNode(op, first, second) { 37440 if (first === second && first.type !== PS_NODE.arg && first.type !== PS_NODE.const && !first.shared) { 37441 const tmp = this._allocLocal(); 37442 try { 37443 if (!this._compileNode(first)) { 37444 return false; 37445 } 37446 this._emitLocalTee(tmp); 37447 this._emitLocalGet(tmp); 37448 } finally { 37449 this._releaseLocal(tmp); 37450 } 37451 } else { 37452 if (!this._compileNode(second)) { 37453 return false; 37454 } 37455 if (!this._compileNode(first)) { 37456 return false; 37457 } 37458 } 37459 const code = this._code; 37460 switch (op) { 37461 case TOKEN.add: 37462 code.push(wasm_compiler_OP.f64_add); 37463 break; 37464 case TOKEN.sub: 37465 code.push(wasm_compiler_OP.f64_sub); 37466 break; 37467 case TOKEN.mul: 37468 code.push(wasm_compiler_OP.f64_mul); 37469 break; 37470 case TOKEN.exp: 37471 code.push(wasm_compiler_OP.call); 37472 this._emitULEB128(PsWasmCompiler.#importIdx.pow); 37473 break; 37474 case TOKEN.eq: 37475 code.push(wasm_compiler_OP.f64_eq, wasm_compiler_OP.f64_convert_i32_s); 37476 break; 37477 case TOKEN.ne: 37478 code.push(wasm_compiler_OP.f64_ne, wasm_compiler_OP.f64_convert_i32_s); 37479 break; 37480 case TOKEN.lt: 37481 code.push(wasm_compiler_OP.f64_lt, wasm_compiler_OP.f64_convert_i32_s); 37482 break; 37483 case TOKEN.le: 37484 code.push(wasm_compiler_OP.f64_le, wasm_compiler_OP.f64_convert_i32_s); 37485 break; 37486 case TOKEN.gt: 37487 code.push(wasm_compiler_OP.f64_gt, wasm_compiler_OP.f64_convert_i32_s); 37488 break; 37489 case TOKEN.ge: 37490 code.push(wasm_compiler_OP.f64_ge, wasm_compiler_OP.f64_convert_i32_s); 37491 break; 37492 case TOKEN.min: 37493 code.push(wasm_compiler_OP.f64_min); 37494 break; 37495 case TOKEN.max: 37496 code.push(wasm_compiler_OP.f64_max); 37497 break; 37498 default: 37499 return false; 37500 } 37501 return true; 37502 } 37503 _compileBinaryNode(node) { 37504 const { 37505 op, 37506 first, 37507 second 37508 } = node; 37509 if (op === TOKEN.bitshift) { 37510 return this._compileBitshiftNode(first, second); 37511 } 37512 if (op === TOKEN.div) { 37513 return this._compileSafeDivNode(first, second); 37514 } 37515 if (op === TOKEN.idiv) { 37516 return this._compileSafeIdivNode(first, second); 37517 } 37518 if (op === TOKEN.mod) { 37519 return this._compileModNode(first, second); 37520 } 37521 if (op === TOKEN.atan) { 37522 return this._compileAtanNode(first, second); 37523 } 37524 if (op === TOKEN.and || op === TOKEN.or || op === TOKEN.xor) { 37525 return this._compileBitwiseNode(op, first, second); 37526 } 37527 return this._compileStandardBinaryNode(op, first, second); 37528 } 37529 _compileNodeAsBoolI32(node) { 37530 if (node.type === PS_NODE.binary) { 37531 const wasmOp = PsWasmCompiler.#comparisonToOp.get(node.op); 37532 if (wasmOp !== undefined) { 37533 if (!this._compileNode(node.second)) { 37534 return false; 37535 } 37536 if (!this._compileNode(node.first)) { 37537 return false; 37538 } 37539 this._code.push(wasmOp); 37540 return true; 37541 } 37542 if (node.valueType === PS_VALUE_TYPE.boolean && (node.op === TOKEN.and || node.op === TOKEN.or || node.op === TOKEN.xor)) { 37543 if (!this._compileNodeAsBoolI32(node.second)) { 37544 return false; 37545 } 37546 if (!this._compileNodeAsBoolI32(node.first)) { 37547 return false; 37548 } 37549 switch (node.op) { 37550 case TOKEN.and: 37551 this._code.push(wasm_compiler_OP.i32_and); 37552 break; 37553 case TOKEN.or: 37554 this._code.push(wasm_compiler_OP.i32_or); 37555 break; 37556 case TOKEN.xor: 37557 this._code.push(wasm_compiler_OP.i32_xor); 37558 break; 37559 } 37560 return true; 37561 } 37562 } 37563 if (node.type === PS_NODE.unary && node.op === TOKEN.not && node.valueType === PS_VALUE_TYPE.boolean) { 37564 if (!this._compileNodeAsBoolI32(node.operand)) { 37565 return false; 37566 } 37567 this._code.push(wasm_compiler_OP.i32_eqz); 37568 return true; 37569 } 37570 if (!this._compileNode(node)) { 37571 return false; 37572 } 37573 if (node.valueType === PS_VALUE_TYPE.boolean) { 37574 this._code.push(wasm_compiler_OP.i32_trunc_f64_s); 37575 } else { 37576 this._emitF64Const(0); 37577 this._code.push(wasm_compiler_OP.f64_ne); 37578 } 37579 return true; 37580 } 37581 _compileTernaryNode(node) { 37582 if (!this._compileNodeAsBoolI32(node.cond)) { 37583 return false; 37584 } 37585 this._code.push(wasm_compiler_OP.if, F64); 37586 if (!this._compileNode(node.then)) { 37587 return false; 37588 } 37589 this._code.push(wasm_compiler_OP.else); 37590 if (!this._compileNode(node.otherwise)) { 37591 return false; 37592 } 37593 this._code.push(wasm_compiler_OP.end); 37594 return true; 37595 } 37596 compile(program) { 37597 const outputs = new PSStackToTree().evaluate(program, this._nIn); 37598 if (!outputs || outputs.length < this._nOut) { 37599 return null; 37600 } 37601 const code = this._code; 37602 for (let i = 0; i < this._nOut; i++) { 37603 const min = this._range[i * 2]; 37604 const max = this._range[i * 2 + 1]; 37605 code.push(wasm_compiler_OP.i32_const); 37606 this._emit
vendor: 8,727 bytes, lines 37606-37922
37606ULEB128(i * 8); 37607 if (!this._compileNode(outputs[i])) { 37608 return null; 37609 } 37610 this._emitF64Const(max); 37611 code.push(wasm_compiler_OP.f64_min); 37612 this._emitF64Const(min); 37613 code.push(wasm_compiler_OP.f64_max, wasm_compiler_OP.f64_store, 0x03, 0x00); 37614 } 37615 code.push(wasm_compiler_OP.end); 37616 const nIn = this._nIn; 37617 const nLocals = this._nextLocal - nIn; 37618 const paramTypes = Array(nIn).fill(F64); 37619 const resultTypes = []; 37620 const funcType = [FUNC_TYPE, ...vec(paramTypes), ...vec(resultTypes)]; 37621 const typeSectionBytes = new Uint8Array(section(SECTION.type, vec([funcType, ...PsWasmCompiler.#importTypeEntries]))); 37622 const localDecls = nLocals > 0 ? vec([[...unsignedLEB128(nLocals), F64]]) : vec([]); 37623 const funcBodyLen = localDecls.length + code.length; 37624 const codeSectionBytes = new Uint8Array(section(SECTION.code, vec([[...unsignedLEB128(funcBodyLen), ...localDecls, ...code]]))); 37625 const magicVersion = PsWasmCompiler.#wasmMagicVersion; 37626 const importSection = PsWasmCompiler.#importSection; 37627 const functionSection = PsWasmCompiler.#functionSection; 37628 const memorySection = PsWasmCompiler.#memorySection; 37629 const exportSection = PsWasmCompiler.#exportSection; 37630 const totalLen = magicVersion.length + typeSectionBytes.length + importSection.length + functionSection.length + memorySection.length + exportSection.length + codeSectionBytes.length; 37631 const result = new Uint8Array(totalLen); 37632 let off = 0; 37633 result.set(magicVersion, off); 37634 off += magicVersion.length; 37635 result.set(typeSectionBytes, off); 37636 off += typeSectionBytes.length; 37637 result.set(importSection, off); 37638 off += importSection.length; 37639 result.set(functionSection, off); 37640 off += functionSection.length; 37641 result.set(memorySection, off); 37642 off += memorySection.length; 37643 result.set(exportSection, off); 37644 off += exportSection.length; 37645 result.set(codeSectionBytes, off); 37646 return result; 37647 } 37648} 37649function compilePostScriptToWasm(source, domain, range) { 37650 return new PsWasmCompiler(domain, range).compile(parsePostScriptFunction(source)); 37651} 37652function _makeWrapper(exports, nIn, nOut) { 37653 const { 37654 fn, 37655 mem 37656 } = exports; 37657 const outView = new Float64Array(mem.buffer, 0, nOut); 37658 let writeOut; 37659 switch (nOut) { 37660 case 1: 37661 writeOut = (dest, destOffset) => { 37662 dest[destOffset] = outView[0]; 37663 }; 37664 break; 37665 case 2: 37666 writeOut = (dest, destOffset) => { 37667 dest[destOffset] = outView[0]; 37668 dest[destOffset + 1] = outView[1]; 37669 }; 37670 break; 37671 case 3: 37672 writeOut = (dest, destOffset) => { 37673 dest[destOffset] = outView[0]; 37674 dest[destOffset + 1] = outView[1]; 37675 dest[destOffset + 2] = outView[2]; 37676 }; 37677 break; 37678 case 4: 37679 writeOut = (dest, destOffset) => { 37680 dest[destOffset] = outView[0]; 37681 dest[destOffset + 1] = outView[1]; 37682 dest[destOffset + 2] = outView[2]; 37683 dest[destOffset + 3] = outView[3]; 37684 }; 37685 break; 37686 default: 37687 writeOut = (dest, destOffset) => { 37688 for (let i = 0; i < nOut; i++) { 37689 dest[destOffset + i] = outView[i]; 37690 } 37691 }; 37692 } 37693 switch (nIn) { 37694 case 1: 37695 return (src, srcOffset, dest, destOffset) => { 37696 fn(src[srcOffset]); 37697 writeOut(dest, destOffset); 37698 }; 37699 case 2: 37700 return (src, srcOffset, dest, destOffset) => { 37701 fn(src[srcOffset], src[srcOffset + 1]); 37702 writeOut(dest, destOffset); 37703 }; 37704 case 3: 37705 return (src, srcOffset, dest, destOffset) => { 37706 fn(src[srcOffset], src[srcOffset + 1], src[srcOffset + 2]); 37707 writeOut(dest, destOffset); 37708 }; 37709 case 4: 37710 return (src, srcOffset, dest, destOffset) => { 37711 fn(src[srcOffset], src[srcOffset + 1], src[srcOffset + 2], src[srcOffset + 3]); 37712 writeOut(dest, destOffset); 37713 }; 37714 default: 37715 { 37716 const inBuf = new Float64Array(nIn); 37717 return (src, srcOffset, dest, destOffset) => { 37718 for (let i = 0; i < nIn; i++) { 37719 inBuf[i] = src[srcOffset + i]; 37720 } 37721 fn(...inBuf); 37722 writeOut(dest, destOffset); 37723 }; 37724 } 37725 } 37726} 37727function buildPostScriptWasmFunction(source, domain, range) { 37728 const bytes = compilePostScriptToWasm(source, domain, range); 37729 if (!bytes) { 37730 return null; 37731 } 37732 try { 37733 const instance = new WebAssembly.Instance(new WebAssembly.Module(bytes), _mathImportObject); 37734 return _makeWrapper(instance.exports, domain.length >> 1, range.length >> 1); 37735 } catch { 37736 return null; 37737 } 37738} 37739 37740;// ./src/core/image_utils.js 37741 37742 37743 37744 37745 37746 37747 37748 37749 37750 37751 37752class BaseLocalCache { 37753 constructor(options) { 37754 this._onlyRefs = options?.onlyRefs === true; 37755 if (!this._onlyRefs) { 37756 this._nameRefMap = new Map(); 37757 this._imageMap = new Map(); 37758 } 37759 this._imageCache = new RefSetCache(); 37760 } 37761 getByName(name) { 37762 if (this._onlyRefs) { 37763 unreachable("Should not call `getByName` method."); 37764 } 37765 const ref = this._nameRefMap.get(name); 37766 if (ref) { 37767 return this.getByRef(ref); 37768 } 37769 return this._imageMap.get(name) || null; 37770 } 37771 getByRef(ref) { 37772 return this._imageCache.get(ref) || null; 37773 } 37774 set(name, ref, data) { 37775 unreachable("Abstract method `set` called."); 37776 } 37777} 37778class LocalImageCache extends BaseLocalCache { 37779 set(name, ref = null, data) { 37780 if (typeof name !== "string") { 37781 throw new Error('LocalImageCache.set - expected "name" argument.'); 37782 } 37783 if (ref) { 37784 if (this._imageCache.has(ref)) { 37785 return; 37786 } 37787 this._nameRefMap.set(name, ref); 37788 this._imageCache.put(ref, data); 37789 return; 37790 } 37791 if (this._imageMap.has(name)) { 37792 return; 37793 } 37794 this._imageMap.set(name, data); 37795 } 37796} 37797class LocalColorSpaceCache extends BaseLocalCache { 37798 set(name = null, ref = null, data) { 37799 if (typeof name !== "string" && !ref) { 37800 throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.'); 37801 } 37802 if (ref) { 37803 if (this._imageCache.has(ref)) { 37804 return; 37805 } 37806 if (name !== null) { 37807 this._nameRefMap.set(name, ref); 37808 } 37809 this._imageCache.put(ref, data); 37810 return; 37811 } 37812 if (this._imageMap.has(name)) { 37813 return; 37814 } 37815 this._imageMap.set(name, data); 37816 } 37817} 37818class LocalFunctionCache extends BaseLocalCache { 37819 constructor(options) { 37820 super({ 37821 onlyRefs: true 37822 }); 37823 } 37824 set(name = null, ref, data) { 37825 if (!ref) { 37826 throw new Error('LocalFunctionCache.set - expected "ref" argument.'); 37827 } 37828 if (this._imageCache.has(ref)) { 37829 return; 37830 } 37831 this._imageCache.put(ref, data); 37832 } 37833} 37834class LocalGStateCache extends BaseLocalCache { 37835 set(name, ref = null, data) { 37836 if (typeof name !== "string") { 37837 throw new Error('LocalGStateCache.set - expected "name" argument.'); 37838 } 37839 if (ref) { 37840 if (this._imageCache.has(ref)) { 37841 return; 37842 } 37843 this._nameRefMap.set(name, ref); 37844 this._imageCache.put(ref, data); 37845 return; 37846 } 37847 if (this._imageMap.has(name)) { 37848 return; 37849 } 37850 this._imageMap.set(name, data); 37851 } 37852} 37853class LocalTilingPatternCache extends BaseLocalCache { 37854 constructor(options) { 37855 super({ 37856 onlyRefs: true 37857 }); 37858 } 37859 set(name = null, ref, data) { 37860 if (!ref) { 37861 throw new Error('LocalTilingPatternCache.set - expected "ref" argument.'); 37862 } 37863 if (this._imageCache.has(ref)) { 37864 return; 37865 } 37866 this._imageCache.put(ref, data); 37867 } 37868} 37869class RegionalImageCache extends BaseLocalCache { 37870 constructor(options) { 37871 super({ 37872 onlyRefs: true 37873 }); 37874 } 37875 set(name = null, ref, data) { 37876 if (!ref) { 37877 throw new Error('RegionalImageCache.set - expected "ref" argument.'); 37878 } 37879 if (this._imageCache.has(ref)) { 37880 return; 37881 } 37882 this._imageCache.put(ref, data); 37883 } 37884} 37885class GlobalColorSpaceCache extends BaseLocalCache { 37886 constructor(options) { 37887 super({ 37888 onlyRefs: true 37889 }); 37890 } 37891 set(name = null, ref, data) { 37892 if (!ref) { 37893 throw new Error('GlobalColorSpaceCache.set - expected "ref" argument.'); 37894 } 37895 if (this._imageCache.has(ref)) { 37896 return; 37897 } 37898 this._imageCache.put(ref, data); 37899 } 37900 clear() { 37901 this._imageCache.clear(); 37902 } 37903} 37904class GlobalImageCache { 37905 static NUM_PAGES_THRESHOLD = 2; 37906 static MIN_IMAGES_TO_CACHE = 10; 37907 static MAX_BYTE_SIZE = 5e7; 37908 #decodeFailedSet = new RefSet(); 37909 constructor() { 37910 this._refCache = new RefSetCache(); 37911 this._imageCache = new RefSetCache(); 37912 } 37913 get #byteSize() { 37914 let byteSize = 0; 37915 for (const imageData of this._imageCache) { 37916 byteSize += imageData.byteSize; 37917 } 37918 return byteSize; 37919 } 37920 get #cacheLimitReached() { 37921 if (this._imageCache.size < GlobalImageCache.MIN_IMAGES_TO_CACHE) { 37922 return false;
vendor: 1,833 bytes, lines 37923-38003
37923 } 37924 if (this.#byteSize < GlobalImageCache.MAX_BYTE_SIZE) { 37925 return false; 37926 } 37927 return true; 37928 } 37929 shouldCache(ref, pageIndex) { 37930 let pageIndexSet = this._refCache.get(ref); 37931 if (!pageIndexSet) { 37932 pageIndexSet = new Set(); 37933 this._refCache.put(ref, pageIndexSet); 37934 } 37935 pageIndexSet.add(pageIndex); 37936 if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) { 37937 return false; 37938 } 37939 if (!this._imageCache.has(ref) && this.#cacheLimitReached) { 37940 return false; 37941 } 37942 return true; 37943 } 37944 addDecodeFailed(ref) { 37945 this.#decodeFailedSet.put(ref); 37946 } 37947 hasDecodeFailed(ref) { 37948 return this.#decodeFailedSet.has(ref); 37949 } 37950 addByteSize(ref, byteSize) { 37951 const imageData = this._imageCache.get(ref); 37952 if (!imageData) { 37953 return; 37954 } 37955 if (imageData.byteSize) { 37956 return; 37957 } 37958 imageData.byteSize = byteSize; 37959 } 37960 getData(ref, pageIndex) { 37961 const pageIndexSet = this._refCache.get(ref); 37962 if (!pageIndexSet) { 37963 return null; 37964 } 37965 if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) { 37966 return null; 37967 } 37968 const imageData = this._imageCache.get(ref); 37969 if (!imageData) { 37970 return null; 37971 } 37972 pageIndexSet.add(pageIndex); 37973 return imageData; 37974 } 37975 setData(ref, data) { 37976 if (!this._refCache.has(ref)) { 37977 throw new Error('GlobalImageCache.setData - expected "shouldCache" to have been called.'); 37978 } 37979 if (this._imageCache.has(ref)) { 37980 return; 37981 } 37982 if (this.#cacheLimitReached) { 37983 warn("GlobalImageCache.setData - cache limit reached."); 37984 return; 37985 } 37986 this._imageCache.put(ref, data); 37987 } 37988 clear(onlyData = false) { 37989 if (!onlyData) { 37990 this.#decodeFailedSet.clear(); 37991 this._refCache.clear(); 37992 } 37993 this._imageCache.clear(); 37994 } 37995} 37996 37997;// ./src/core/function.js 37998 37999 38000 38001 38002 38003
vendor: 17,235 bytes, lines 38004-38526
38004 38005 38006 38007 38008 38009 38010 38011 38012 38013const FunctionType = { 38014 SAMPLED: 0, 38015 EXPONENTIAL_INTERPOLATION: 2, 38016 STITCHING: 3, 38017 POSTSCRIPT_CALCULATOR: 4 38018}; 38019class PDFFunctionFactory { 38020 static #useWasm = true; 38021 static setOptions({ 38022 useWasm 38023 }) { 38024 this.#useWasm = useWasm; 38025 } 38026 constructor({ 38027 xref 38028 }) { 38029 this.xref = xref; 38030 } 38031 get useWasm() { 38032 return PDFFunctionFactory.#useWasm; 38033 } 38034 create(fn, parseArray = false) { 38035 let fnRef, parsedFn; 38036 if (fn instanceof Ref) { 38037 fnRef = fn; 38038 } else if (fn instanceof Dict) { 38039 fnRef = fn.objId; 38040 } else if (fn instanceof BaseStream) { 38041 fnRef = fn.dict?.objId; 38042 } 38043 if (fnRef) { 38044 const cachedFn = this._localFunctionCache.getByRef(fnRef); 38045 if (cachedFn) { 38046 return cachedFn; 38047 } 38048 } 38049 const fnObj = this.xref.fetchIfRef(fn); 38050 if (Array.isArray(fnObj)) { 38051 if (!parseArray) { 38052 throw new Error('PDFFunctionFactory.create - expected "parseArray" argument.'); 38053 } 38054 parsedFn = PDFFunction.parseArray(this, fnObj); 38055 } else { 38056 parsedFn = PDFFunction.parse(this, fnObj); 38057 } 38058 if (fnRef) { 38059 this._localFunctionCache.set(null, fnRef, parsedFn); 38060 } 38061 return parsedFn; 38062 } 38063 get _localFunctionCache() { 38064 return shadow(this, "_localFunctionCache", new LocalFunctionCache()); 38065 } 38066} 38067function toNumberArray(arr) { 38068 if (!Array.isArray(arr)) { 38069 return null; 38070 } 38071 if (!isNumberArray(arr, null)) { 38072 return arr.map(x => +x); 38073 } 38074 return arr; 38075} 38076class PDFFunction { 38077 static getSampleArray(size, outputSize, bps, stream) { 38078 let length = outputSize; 38079 for (const s of size) { 38080 length *= s; 38081 } 38082 const array = new Array(length); 38083 let codeSize = 0; 38084 let codeBuf = 0; 38085 const sampleMul = 1.0 / (2.0 ** bps - 1); 38086 const strBytes = stream.getBytes((length * bps + 7) / 8); 38087 let strIdx = 0; 38088 for (let i = 0; i < length; i++) { 38089 while (codeSize < bps) { 38090 codeBuf <<= 8; 38091 codeBuf |= strBytes[strIdx++]; 38092 codeSize += 8; 38093 } 38094 codeSize -= bps; 38095 array[i] = (codeBuf >> codeSize) * sampleMul; 38096 codeBuf &= (1 << codeSize) - 1; 38097 } 38098 return array; 38099 } 38100 static parse(factory, fn) { 38101 const dict = fn.dict || fn; 38102 const typeNum = dict.get("FunctionType"); 38103 switch (typeNum) { 38104 case FunctionType.SAMPLED: 38105 return this.constructSampled(factory, fn, dict); 38106 case FunctionType.EXPONENTIAL_INTERPOLATION: 38107 return this.constructInterpolated(factory, dict); 38108 case FunctionType.STITCHING: 38109 return this.constructStiched(factory, dict); 38110 case FunctionType.POSTSCRIPT_CALCULATOR: 38111 return this.constructPostScript(factory, fn, dict); 38112 } 38113 throw new FormatError(`Unknown function type: ${typeNum}`); 38114 } 38115 static parseArray(factory, fnObj) { 38116 const { 38117 xref 38118 } = factory; 38119 const fnArray = []; 38120 for (const fn of fnObj) { 38121 fnArray.push(this.parse(factory, xref.fetchIfRef(fn))); 38122 } 38123 return function (src, srcOffset, dest, destOffset) { 38124 for (let i = 0, ii = fnArray.length; i < ii; i++) { 38125 fnArray[i](src, srcOffset, dest, destOffset + i); 38126 } 38127 }; 38128 } 38129 static constructSampled(factory, fn, dict) { 38130 function interpolate(x, xmin, xmax, ymin, ymax) { 38131 return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin)); 38132 } 38133 const domain = toNumberArray(dict.getArray("Domain")); 38134 const range = toNumberArray(dict.getArray("Range")); 38135 if (!domain || !range) { 38136 throw new FormatError("No domain or range"); 38137 } 38138 const inputSize = domain.length / 2; 38139 const outputSize = range.length / 2; 38140 const size = toNumberArray(dict.getArray("Size")); 38141 const bps = dict.get("BitsPerSample"); 38142 const order = dict.get("Order") || 1; 38143 if (order !== 1) { 38144 info("No support for cubic spline interpolation: " + order); 38145 } 38146 let encode = toNumberArray(dict.getArray("Encode")); 38147 if (!encode) { 38148 encode = []; 38149 for (let i = 0; i < inputSize; ++i) { 38150 encode.push(0, size[i] - 1); 38151 } 38152 } 38153 const decode = toNumberArray(dict.getArray("Decode")) || range; 38154 const samples = this.getSampleArray(size, outputSize, bps, fn); 38155 return function constructSampledFn(src, srcOffset, dest, destOffset) { 38156 const cubeVertices = 1 << inputSize; 38157 const cubeN = new Float64Array(cubeVertices).fill(1); 38158 const cubeVertex = new Uint32Array(cubeVertices); 38159 let i, j; 38160 let k = outputSize, 38161 pos = 1; 38162 for (i = 0; i < inputSize; ++i) { 38163 const domain_2i = domain[2 * i]; 38164 const domain_2i_1 = domain[2 * i + 1]; 38165 const xi = MathClamp(src[srcOffset + i], domain_2i, domain_2i_1); 38166 let e = interpolate(xi, domain_2i, domain_2i_1, encode[2 * i], encode[2 * i + 1]); 38167 const size_i = size[i]; 38168 e = MathClamp(e, 0, size_i - 1); 38169 const e0 = e < size_i - 1 ? Math.floor(e) : e - 1; 38170 const n0 = e0 + 1 - e; 38171 const n1 = e - e0; 38172 const offset0 = e0 * k; 38173 const offset1 = offset0 + k; 38174 for (j = 0; j < cubeVertices; j++) { 38175 if (j & pos) { 38176 cubeN[j] *= n1; 38177 cubeVertex[j] += offset1; 38178 } else { 38179 cubeN[j] *= n0; 38180 cubeVertex[j] += offset0; 38181 } 38182 } 38183 k *= size_i; 38184 pos <<= 1; 38185 } 38186 for (j = 0; j < outputSize; ++j) { 38187 let rj = 0; 38188 for (i = 0; i < cubeVertices; i++) { 38189 rj += samples[cubeVertex[i] + j] * cubeN[i]; 38190 } 38191 rj = interpolate(rj, 0, 1, decode[2 * j], decode[2 * j + 1]); 38192 dest[destOffset + j] = MathClamp(rj, range[2 * j], range[2 * j + 1]); 38193 } 38194 }; 38195 } 38196 static constructInterpolated(factory, dict) { 38197 const c0 = toNumberArray(dict.getArray("C0")) || [0]; 38198 const c1 = toNumberArray(dict.getArray("C1")) || [1]; 38199 const n = dict.get("N"); 38200 const diff = []; 38201 for (let i = 0, ii = c0.length; i < ii; ++i) { 38202 diff.push(c1[i] - c0[i]); 38203 } 38204 const length = diff.length; 38205 return function constructInterpolatedFn(src, srcOffset, dest, destOffset) { 38206 const x = n === 1 ? src[srcOffset] : src[srcOffset] ** n; 38207 for (let j = 0; j < length; ++j) { 38208 dest[destOffset + j] = c0[j] + x * diff[j]; 38209 } 38210 }; 38211 } 38212 static constructStiched(factory, dict) { 38213 const domain = toNumberArray(dict.getArray("Domain")); 38214 if (!domain) { 38215 throw new FormatError("No domain"); 38216 } 38217 const inputSize = domain.length / 2; 38218 if (inputSize !== 1) { 38219 throw new FormatError("Bad domain for stiched function"); 38220 } 38221 const { 38222 xref 38223 } = factory; 38224 const fns = []; 38225 for (const fn of dict.get("Functions")) { 38226 fns.push(this.parse(factory, xref.fetchIfRef(fn))); 38227 } 38228 const bounds = toNumberArray(dict.getArray("Bounds")); 38229 const encode = toNumberArray(dict.getArray("Encode")); 38230 const tmpBuf = new Float32Array(1); 38231 return function constructStichedFn(src, srcOffset, dest, destOffset) { 38232 const v = MathClamp(src[srcOffset], domain[0], domain[1]); 38233 const length = bounds.length; 38234 let i; 38235 for (i = 0; i < length; ++i) { 38236 if (v < bounds[i]) { 38237 break; 38238 } 38239 } 38240 const dmin = i > 0 ? bounds[i - 1] : domain[0]; 38241 const dmax = i < length ? bounds[i] : domain[1]; 38242 const rmin = encode[2 * i]; 38243 const rmax = encode[2 * i + 1]; 38244 tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin); 38245 fns[i](tmpBuf, 0, dest, destOffset); 38246 }; 38247 } 38248 static constructPostScript(factory, fn, dict) { 38249 const domain = toNumberArray(dict.getArray("Domain")); 38250 const range = toNumberArray(dict.getArray("Range")); 38251 if (!domain) { 38252 throw new FormatError("No domain."); 38253 } 38254 if (!range) { 38255 throw new FormatError("No range."); 38256 } 38257 const psCode = fn.getString(); 38258 try { 38259 if (factory.useWasm) { 38260 const wasmFn = buildPostScriptWasmFunction(psCode, domain, range); 38261 if (wasmFn) { 38262 return wasmFn; 38263 } 38264 } 38265 } catch {} 38266 warn("Failed to compile PostScript function to wasm, falling back to JS"); 38267 return buildPostScriptJsFunction(psCode, domain, range); 38268 } 38269} 38270function isPDFFunction(v) { 38271 let fnDict; 38272 if (v instanceof Dict) { 38273 fnDict = v; 38274 } else if (v instanceof BaseStream) { 38275 fnDict = v.dict; 38276 } else { 38277 return false; 38278 } 38279 return fnDict.has("FunctionType"); 38280} 38281 38282;// ./src/core/bidi.js 38283 38284const baseTypes = ["BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "S", "B", "S", "WS", "B", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "B", "B", "B", "S", "WS", "ON", "ON", "ET", "ET", "ET", "ON", "ON", "ON", "ON", "ON", "ES", "CS", "ES", "CS", "CS", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "CS", "ON", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "ON", "ON", "ON", "BN", "BN", "BN", "BN", "BN", "BN", "B", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "CS", "ON", "ET", "ET", "ET", "ET", "ON", "ON", "ON", "ON", "L", "ON", "ON", "BN", "ON", "ON", "ET", "ET", "EN", "EN", "ON", "L", "ON", "ON", "ON", "EN", "L", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "L", "L", "L", "L", "L", "L", "L", "L"]; 38285const arabicTypes = ["AN", "AN", "AN", "AN", "AN", "AN", "ON", "ON", "AL", "ET", "ET", "AL", "CS", "AL", "ON", "ON", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "ET", "AN", "AN", "AL", "AL", "AL", "NSM", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AN", "ON", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "NSM", "NSM", "ON", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "AL", "AL", "AL", "AL", "AL", "AL"]; 38286function isOdd(i) { 38287 return (i & 1) !== 0; 38288} 38289function isEven(i) { 38290 return (i & 1) === 0; 38291} 38292function findUnequal(arr, start, value) { 38293 let j, jj; 38294 for (j = start, jj = arr.length; j < jj; ++j) { 38295 if (arr[j] !== value) { 38296 return j; 38297 } 38298 } 38299 return j; 38300} 38301function reverseValues(arr, start, end) { 38302 for (let i = start, j = end - 1; i < j; ++i, --j) { 38303 const temp = arr[i]; 38304 arr[i] = arr[j]; 38305 arr[j] = temp; 38306 } 38307} 38308function createBidiText(str, isLTR, vertical = false) { 38309 let dir = "ltr"; 38310 if (vertical) { 38311 dir = "ttb"; 38312 } else if (!isLTR) { 38313 dir = "rtl"; 38314 } 38315 return { 38316 str, 38317 dir 38318 }; 38319} 38320const chars = []; 38321const types = []; 38322function bidi(str, startLevel = -1, vertical = false) { 38323 let isLTR = true; 38324 const strLength = str.length; 38325 if (strLength === 0 || vertical) { 38326 return createBidiText(str, isLTR, vertical); 38327 } 38328 chars.length = strLength; 38329 types.length = strLength; 38330 let numBidi = 0; 38331 let i, ii; 38332 for (i = 0; i < strLength; ++i) { 38333 chars[i] = str.charAt(i); 38334 const charCode = str.charCodeAt(i); 38335 let charType = "L"; 38336 if (charCode <= 0x00ff) { 38337 charType = baseTypes[charCode]; 38338 } else if (0x0590 <= charCode && charCode <= 0x05f4) { 38339 charType = "R"; 38340 } else if (0x0600 <= charCode && charCode <= 0x06ff) { 38341 charType = arabicTypes[charCode & 0xff]; 38342 if (!charType) { 38343 warn("Bidi: invalid Unicode character " + charCode.toString(16)); 38344 } 38345 } else if (0x0700 <= charCode && charCode <= 0x08ac || 0xfb50 <= charCode && charCode <= 0xfdff || 0xfe70 <= charCode && charCode <= 0xfeff) { 38346 charType = "AL"; 38347 } 38348 if (charType === "R" || charType === "AL" || charType === "AN") { 38349 numBidi++; 38350 } 38351 types[i] = charType; 38352 } 38353 if (numBidi === 0) { 38354 isLTR = true; 38355 return createBidiText(str, isLTR); 38356 } 38357 if (startLevel === -1) { 38358 if (numBidi / strLength < 0.3 && strLength > 4) { 38359 isLTR = true; 38360 startLevel = 0; 38361 } else { 38362 isLTR = false; 38363 startLevel = 1; 38364 } 38365 } 38366 const levels = []; 38367 for (i = 0; i < strLength; ++i) { 38368 levels[i] = startLevel; 38369 } 38370 const e = isOdd(startLevel) ? "R" : "L"; 38371 const sor = e; 38372 const eor = sor; 38373 let lastType = sor; 38374 for (i = 0; i < strLength; ++i) { 38375 if (types[i] === "NSM") { 38376 types[i] = lastType; 38377 } else { 38378 lastType = types[i]; 38379 } 38380 } 38381 lastType = sor; 38382 let t; 38383 for (i = 0; i < strLength; ++i) { 38384 t = types[i]; 38385 if (t === "EN") { 38386 types[i] = lastType === "AL" ? "AN" : "EN"; 38387 } else if (t === "R" || t === "L" || t === "AL") { 38388 lastType = t; 38389 } 38390 } 38391 for (i = 0; i < strLength; ++i) { 38392 t = types[i]; 38393 if (t === "AL") { 38394 types[i] = "R"; 38395 } 38396 } 38397 for (i = 1; i < strLength - 1; ++i) { 38398 if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") { 38399 types[i] = "EN"; 38400 } 38401 if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) { 38402 types[i] = types[i - 1]; 38403 } 38404 } 38405 for (i = 0; i < strLength; ++i) { 38406 if (types[i] === "EN") { 38407 for (let j = i - 1; j >= 0; --j) { 38408 if (types[j] !== "ET") { 38409 break; 38410 } 38411 types[j] = "EN"; 38412 } 38413 for (let j = i + 1; j < strLength; ++j) { 38414 if (types[j] !== "ET") { 38415 break; 38416 } 38417 types[j] = "EN"; 38418 } 38419 } 38420 } 38421 for (i = 0; i < strLength; ++i) { 38422 t = types[i]; 38423 if (t === "WS" || t === "ES" || t === "ET" || t === "CS") { 38424 types[i] = "ON"; 38425 } 38426 } 38427 lastType = sor; 38428 for (i = 0; i < strLength; ++i) { 38429 t = types[i]; 38430 if (t === "EN") { 38431 types[i] = lastType === "L" ? "L" : "EN"; 38432 } else if (t === "R" || t === "L") { 38433 lastType = t; 38434 } 38435 } 38436 for (i = 0; i < strLength; ++i) { 38437 if (types[i] === "ON") { 38438 const end = findUnequal(types, i + 1, "ON"); 38439 let before = sor; 38440 for (let j = i - 1; j >= 0; j--) { 38441 const tt = types[j]; 38442 if (tt === "L") { 38443 before = "L"; 38444 break; 38445 } 38446 if (tt === "R" || tt === "EN" || tt === "AN") { 38447 before = "R"; 38448 break; 38449 } 38450 } 38451 let after = eor; 38452 for (let j = end; j < strLength; j++) { 38453 const tt = types[j]; 38454 if (tt === "L") { 38455 after = "L"; 38456 break; 38457 } 38458 if (tt === "R" || tt === "EN" || tt === "AN") { 38459 after = "R"; 38460 break; 38461 } 38462 } 38463 if (before === after) { 38464 types.fill(before, i, end); 38465 } 38466 i = end - 1; 38467 } 38468 } 38469 for (i = 0; i < strLength; ++i) { 38470 if (types[i] === "ON") { 38471 types[i] = e; 38472 } 38473 } 38474 for (i = 0; i < strLength; ++i) { 38475 t = types[i]; 38476 if (isEven(levels[i])) { 38477 if (t === "R") { 38478 levels[i] += 1; 38479 } else if (t === "AN" || t === "EN") { 38480 levels[i] += 2; 38481 } 38482 } else if (t === "L" || t === "AN" || t === "EN") { 38483 levels[i] += 1; 38484 } 38485 } 38486 let highestLevel = -1; 38487 let lowestOddLevel = 99; 38488 let level; 38489 for (i = 0, ii = levels.length; i < ii; ++i) { 38490 level = levels[i]; 38491 if (highestLevel < level) { 38492 highestLevel = level; 38493 } 38494 if (lowestOddLevel > level && isOdd(level)) { 38495 lowestOddLevel = level; 38496 } 38497 } 38498 for (level = highestLevel; level >= lowestOddLevel; --level) { 38499 let start = -1; 38500 for (i = 0, ii = levels.length; i < ii; ++i) { 38501 if (levels[i] < level) { 38502 if (start >= 0) { 38503 reverseValues(chars, start, i); 38504 start = -1; 38505 } 38506 } else if (start < 0) { 38507 start = i; 38508 } 38509 } 38510 if (start >= 0) { 38511 reverseValues(chars, start, levels.length); 38512 } 38513 } 38514 for (i = 0, ii = chars.length; i < ii; ++i) { 38515 const ch = chars[i]; 38516 if (ch === "<" || ch === ">") { 38517 chars[i] = ""; 38518 } 38519 } 38520 return createBidiText(chars.join(""), isLTR); 38521} 38522 38523;// ./src/core/font_substitutions.js 38524 38525 38526
38527 38528 38529 38530 38531 38532 38533 38534 38535 38536 38537 38538 38539const NORMAL = { 38540 style: "normal", 38541 weight: "normal" 38542}; 38543const BOLD = { 38544 style: "normal", 38545 weight: "bold" 38546}; 38547const ITALIC = { 38548 style: "italic", 38549 weight: "normal" 38550}; 38551const BOLDITALIC = { 38552 style: "italic", 38553 weight: "bold" 38554}; 38555const substitutionMap = new Map([["Times-Roman", { 38556 local: ["Times New Roman", "Times-Roman", "Times", "Liberation Serif", "Nimbus Roman", "Nimbus Roman L", "Tinos", "Thorndale", "TeX Gyre Termes", "FreeSerif", "Linux Libertine O", "Libertinus Serif", "PT Astra Serif", "DejaVu Serif", "Bitstream Vera Serif", "Ubuntu"], 38557 style: NORMAL, 38558 ultimate: "serif" 38559}], ["Times-Bold", { 38560 alias: "Times-Roman", 38561 style: BOLD, 38562 ultimate: "serif" 38563}], ["Times-Italic", { 38564 alias: "Times-Roman", 38565 style: ITALIC, 38566 ultimate: "serif" 38567}], ["Times-BoldItalic", { 38568 alias: "Times-Roman", 38569 style: BOLDITALIC, 38570 ultimate: "serif" 38571}], ["Helvetica", { 38572 local: ["Helvetica", "Helvetica Neue", "Arial", "Arial Nova", "Liberation Sans", "Arimo", "Nimbus Sans", "Nimbus Sans L", "A030", "TeX Gyre Heros", "FreeSans", "DejaVu Sans", "Albany", "Bitstream Vera Sans", "Arial Unicode MS", "Microsoft Sans Serif", "Apple Symbols", "Cantarell"], 38573 path: "LiberationSans-Regular.ttf", 38574 style: NORMAL, 38575 ultimate: "sans-serif" 38576}], ["Helvetica-Bold", { 38577 alias: "Helvetica", 38578 path: "LiberationSans-Bold.ttf", 38579 style: BOLD, 38580 ultimate: "sans-serif" 38581}], ["Helvetica-Oblique", { 38582 alias: "Helvetica", 38583 path: "LiberationSans-Italic.ttf", 38584 style: ITALIC, 38585 ultimate: "sans-serif" 38586}], ["Helvetica-BoldOblique", { 38587 alias: "Helvetica", 38588 path: "LiberationSans-BoldItalic.ttf", 38589 style: BOLDITALIC, 38590 ultimate: "sans-serif" 38591}], ["Courier", { 38592 local: ["Courier", "Courier New", "Liberation Mono", "Nimbus Mono", "Nimbus Mono L", "Cousine", "Cumberland", "TeX Gyre Cursor", "FreeMono", "Linux Libertine Mono O", "Libertinus Mono"], 38593 style: NORMAL, 38594 ultimate: "monospace" 38595}], ["Courier-Bold", { 38596 alias: "Courier", 38597 style: BOLD, 38598 ultimate: "monospace" 38599}], ["Courier-Oblique", { 38600 alias: "Courier", 38601 style: ITALIC, 38602 ultimate: "monospace" 38603}], ["Courier-BoldOblique", { 38604 alias: "Courier", 38605 style: BOLDITALIC, 38606 ultimate: "monospace" 38607}], ["ArialBlack", { 38608 local: ["Arial Black"], 38609 style: { 38610 style: "normal", 38611 weight: "900" 38612 }, 38613 fallback: "Helvetica-Bold" 38614}], ["ArialBlack-Bold", { 38615 alias: "ArialBlack" 38616}], ["ArialBlack-Italic", { 38617 alias: "ArialBlack", 38618 style: { 38619 style: "italic", 38620 weight: "900" 38621 }, 38622 fallback: "Helvetica-BoldOblique" 38623}], ["ArialBlack-BoldItalic", { 38624 alias: "ArialBlack-Italic" 38625}], ["ArialNarrow", { 38626 local: ["Arial Narrow", "Liberation Sans Narrow", "Helvetica Condensed", "Nimbus Sans Narrow", "TeX Gyre Heros Cn"], 38627 style: NORMAL, 38628 fallback: "Helvetica" 38629}], ["ArialNarrow-Bold", { 38630 alias: "ArialNarrow", 38631 style: BOLD, 38632 fallback: "Helvetica-Bold" 38633}], ["ArialNarrow-Italic", { 38634 alias: "ArialNarrow", 38635 style: ITALIC, 38636 fallback: "Helvetica-Oblique" 38637}], ["ArialNarrow-BoldItalic", { 38638 alias: "ArialNarrow", 38639 style: BOLDITALIC, 38640 fallback: "Helvetica-BoldOblique" 38641}], ["Calibri", { 38642 local: ["Calibri", "Carlito"], 38643 style: NORMAL, 38644 fallback: "Helvetica" 38645}], ["Calibri-Bold", { 38646 alias: "Calibri", 38647 style: BOLD, 38648 fallback: "Helvetica-Bold" 38649}], ["Calibri-Italic", { 38650 alias: "Calibri", 38651 style: ITALIC, 38652 fallback: "Helvetica-Oblique" 38653}], ["Calibri-BoldItalic", { 38654 alias: "Calibri", 38655 style: BOLDITALIC, 38656 fallback: "Helvetica-BoldOblique" 38657}], ["Wingdings", { 38658 local: ["Wingdings", "URW Dingbats"], 38659 style: NORMAL 38660}], ["Wingdings-Regular", { 38661 alias: "Wingdings" 38662}], ["Wingdings-Bold", { 38663 alias: "Wingdings" 38664}], ["\xCB\xCE\xCC\xE5", { 38665 local: ["SimSun", "SimSun Regular", "NSimSun"], 38666 style: NORMAL, 38667 ultimate: "serif" 38668}], ["\xBA\xDA\xCC\xE5", { 38669 local: ["SimHei", "SimHei Regular"], 38670 style: NORMAL, 38671 ultimate: "sans-serif" 38672}], ["\xBF\xAC\xCC\xE5", { 38673 local: ["KaiTi", "SimKai", "SimKai Regular"], 38674 style: NORMAL, 38675 ultimate: "sans-serif" 38676}], ["\xB7\xC2\xCB\xCE", { 38677 local: ["FangSong", "SimFang", "SimFang Regular"], 38678 style: NORMAL, 38679 ultimate: "serif" 38680}], ["\xBF\xAC\xCC\xE5_GB2312", { 38681 alias: "\xBF\xAC\xCC\xE5" 38682}], ["\xB7\xC2\xCB\xCE_GB2312", { 38683 alias: "\xB7\xC2\xCB\xCE" 38684}], ["\xC1\xA5\xCA\xE9", { 38685 local: ["SimLi", "SimLi Regular"], 38686 style: NORMAL, 38687 ultimate: "serif" 38688}], ["\xD0\xC2\xCB\xCE", { 38689 alias: "\xCB\xCE\xCC\xE5
vendor: 7,346 bytes, lines 38689-38945
38689" 38690}]]); 38691const fontAliases = new Map([["Arial-Black", "ArialBlack"]]); 38692function getStyleToAppend(style) { 38693 switch (style) { 38694 case BOLD: 38695 return "Bold"; 38696 case ITALIC: 38697 return "Italic"; 38698 case BOLDITALIC: 38699 return "Bold Italic"; 38700 default: 38701 if (style?.weight === "bold") { 38702 return "Bold"; 38703 } 38704 if (style?.style === "italic") { 38705 return "Italic"; 38706 } 38707 } 38708 return ""; 38709} 38710function getFamilyName(str) { 38711 const keywords = new Set(["thin", "extralight", "ultralight", "demilight", "semilight", "light", "book", "regular", "normal", "medium", "demibold", "semibold", "bold", "extrabold", "ultrabold", "black", "heavy", "extrablack", "ultrablack", "roman", "italic", "oblique", "ultracondensed", "extracondensed", "condensed", "semicondensed", "normal", "semiexpanded", "expanded", "extraexpanded", "ultraexpanded", "bolditalic"]); 38712 return str.split(/[- ,+]+/g).filter(tok => !keywords.has(tok.toLowerCase())).join(" "); 38713} 38714function generateFont({ 38715 alias, 38716 local, 38717 path, 38718 fallback, 38719 style, 38720 ultimate 38721}, src, localFontPath, useFallback = true, usePath = true, append = "") { 38722 const result = { 38723 style: null, 38724 ultimate: null 38725 }; 38726 if (local) { 38727 const extra = append ? ` ${append}` : ""; 38728 for (const name of local) { 38729 src.push(`local(${name}${extra})`); 38730 } 38731 } 38732 if (alias) { 38733 const substitution = substitutionMap.get(alias); 38734 const aliasAppend = append || getStyleToAppend(style); 38735 Object.assign(result, generateFont(substitution, src, localFontPath, useFallback && !fallback, usePath && !path, aliasAppend)); 38736 } 38737 if (style) { 38738 result.style = style; 38739 } 38740 if (ultimate) { 38741 result.ultimate = ultimate; 38742 } 38743 if (useFallback && fallback) { 38744 const fallbackInfo = substitutionMap.get(fallback); 38745 const { 38746 ultimate: fallbackUltimate 38747 } = generateFont(fallbackInfo, src, localFontPath, useFallback, usePath && !path, append); 38748 result.ultimate ||= fallbackUltimate; 38749 } 38750 if (usePath && path && localFontPath) { 38751 src.push(`url(${localFontPath}${path})`); 38752 } 38753 return result; 38754} 38755function getFontSubstitution(systemFontCache, idFactory, localFontPath, baseFontName, standardFontName, type) { 38756 if (baseFontName.startsWith("InvalidPDFjsFont_")) { 38757 return null; 38758 } 38759 if ((type === "TrueType" || type === "Type1") && /^[A-Z]{6}\+/.test(baseFontName)) { 38760 baseFontName = baseFontName.slice(7); 38761 } 38762 baseFontName = normalizeFontName(baseFontName); 38763 const key = baseFontName; 38764 let substitutionInfo = systemFontCache.get(key); 38765 if (substitutionInfo) { 38766 return substitutionInfo; 38767 } 38768 let substitution = substitutionMap.get(baseFontName); 38769 if (!substitution) { 38770 for (const [alias, subst] of fontAliases) { 38771 if (baseFontName.startsWith(alias)) { 38772 baseFontName = `${subst}${baseFontName.substring(alias.length)}`; 38773 substitution = substitutionMap.get(baseFontName); 38774 break; 38775 } 38776 } 38777 } 38778 let mustAddBaseFont = false; 38779 if (!substitution) { 38780 substitution = substitutionMap.get(standardFontName); 38781 mustAddBaseFont = true; 38782 } 38783 const loadedName = `${idFactory.getDocId()}_s${idFactory.createFontId()}`; 38784 if (!substitution) { 38785 if (!validateFontName(baseFontName)) { 38786 warn(`Cannot substitute the font because of its name: ${baseFontName}`); 38787 systemFontCache.set(key, null); 38788 return null; 38789 } 38790 const bold = /bold/gi.test(baseFontName); 38791 const italic = /oblique|italic/gi.test(baseFontName); 38792 const style = bold && italic && BOLDITALIC || bold && BOLD || italic && ITALIC || NORMAL; 38793 substitutionInfo = { 38794 css: `"${getFamilyName(baseFontName)}",${loadedName}`, 38795 guessFallback: true, 38796 loadedName, 38797 baseFontName, 38798 src: `local(${baseFontName})`, 38799 style 38800 }; 38801 systemFontCache.set(key, substitutionInfo); 38802 return substitutionInfo; 38803 } 38804 const src = []; 38805 if (mustAddBaseFont && validateFontName(baseFontName)) { 38806 src.push(`local(${baseFontName})`); 38807 } 38808 const { 38809 style, 38810 ultimate 38811 } = generateFont(substitution, src, localFontPath); 38812 const guessFallback = ultimate === null; 38813 const fallback = guessFallback ? "" : `,${ultimate}`; 38814 substitutionInfo = { 38815 css: `"${getFamilyName(baseFontName)}",${loadedName}${fallback}`, 38816 guessFallback, 38817 loadedName, 38818 baseFontName, 38819 src: src.join(","), 38820 style 38821 }; 38822 systemFontCache.set(key, substitutionInfo); 38823 return substitutionInfo; 38824} 38825 38826;// ./src/shared/murmurhash3.js 38827 38828 38829 38830 38831 38832 38833 38834 38835const SEED = 0xc3d2e1f0; 38836const MASK_HIGH = 0xffff0000; 38837const MASK_LOW = 0xffff; 38838class MurmurHash3_64 { 38839 constructor(seed) { 38840 this.h1 = seed ? seed & 0xffffffff : SEED; 38841 this.h2 = seed ? seed & 0xffffffff : SEED; 38842 } 38843 update(input) { 38844 let data, length; 38845 if (typeof input === "string") { 38846 data = new Uint8Array(input.length * 2); 38847 length = 0; 38848 for (let i = 0, ii = input.length; i < ii; i++) { 38849 const code = input.charCodeAt(i); 38850 if (code <= 0xff) { 38851 data[length++] = code; 38852 } else { 38853 data[length++] = code >>> 8; 38854 data[length++] = code & 0xff; 38855 } 38856 } 38857 } else if (ArrayBuffer.isView(input)) { 38858 data = input.slice(); 38859 length = data.byteLength; 38860 } else { 38861 throw new Error("Invalid data format, must be a string or TypedArray."); 38862 } 38863 const blockCounts = length >> 2; 38864 const tailLength = length - blockCounts * 4; 38865 const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts); 38866 let k1 = 0, 38867 k2 = 0; 38868 let h1 = this.h1, 38869 h2 = this.h2; 38870 const C1 = 0xcc9e2d51, 38871 C2 = 0x1b873593; 38872 const C1_LOW = C1 & MASK_LOW, 38873 C2_LOW = C2 & MASK_LOW; 38874 for (let i = 0; i < blockCounts; i++) { 38875 if (i & 1) { 38876 k1 = dataUint32[i]; 38877 k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW; 38878 k1 = k1 << 15 | k1 >>> 17; 38879 k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW; 38880 h1 ^= k1; 38881 h1 = h1 << 13 | h1 >>> 19; 38882 h1 = h1 * 5 + 0xe6546b64; 38883 } else { 38884 k2 = dataUint32[i]; 38885 k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW; 38886 k2 = k2 << 15 | k2 >>> 17; 38887 k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW; 38888 h2 ^= k2; 38889 h2 = h2 << 13 | h2 >>> 19; 38890 h2 = h2 * 5 + 0xe6546b64; 38891 } 38892 } 38893 k1 = 0; 38894 switch (tailLength) { 38895 case 3: 38896 k1 ^= data[blockCounts * 4 + 2] << 16; 38897 case 2: 38898 k1 ^= data[blockCounts * 4 + 1] << 8; 38899 case 1: 38900 k1 ^= data[blockCounts * 4]; 38901 k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW; 38902 k1 = k1 << 15 | k1 >>> 17; 38903 k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW; 38904 if (blockCounts & 1) { 38905 h1 ^= k1; 38906 } else { 38907 h2 ^= k1; 38908 } 38909 } 38910 this.h1 = h1; 38911 this.h2 = h2; 38912 } 38913 hexdigest() { 38914 let h1 = this.h1, 38915 h2 = this.h2; 38916 h1 ^= h2 >>> 1; 38917 h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW; 38918 h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16; 38919 h1 ^= h2 >>> 1; 38920 h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW; 38921 h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16; 38922 h1 ^= h2 >>> 1; 38923 return (h1 >>> 0).toString(16).padStart(8, "0") + (h2 >>> 0).toString(16).padStart(8, "0"); 38924 } 38925} 38926 38927;// ./src/core/image.js 38928 38929 38930 38931 38932 38933 38934 38935 38936 38937 38938 38939 38940 38941 38942 38943 38944 38945
vendor: 3,251 bytes, lines 38946-39040
38946 38947class PDFImage { 38948 constructor({ 38949 xref, 38950 res, 38951 image, 38952 isInline = false, 38953 smask = null, 38954 mask = null, 38955 isMask = false, 38956 pdfFunctionFactory, 38957 globalColorSpaceCache, 38958 localColorSpaceCache 38959 }) { 38960 this.image = image; 38961 const dict = image.dict; 38962 const filter = dict.get("F", "Filter"); 38963 let filterName; 38964 if (filter instanceof Name) { 38965 filterName = filter.name; 38966 } else if (Array.isArray(filter)) { 38967 const filterZero = xref.fetchIfRef(filter[0]); 38968 if (filterZero instanceof Name) { 38969 filterName = filterZero.name; 38970 } 38971 } 38972 switch (filterName) { 38973 case "JPXDecode": 38974 ({ 38975 width: image.width, 38976 height: image.height, 38977 componentsCount: image.numComps, 38978 bitsPerComponent: image.bitsPerComponent 38979 } = JpxImage.parseImageProperties(image.stream)); 38980 image.stream.reset(); 38981 const reducePower = ImageResizer.getReducePowerForJPX(image.width, image.height, image.numComps); 38982 this.jpxDecoderOptions = { 38983 numComponents: 0, 38984 isIndexedColormap: false, 38985 smaskInData: dict.has("SMaskInData"), 38986 reducePower 38987 }; 38988 if (reducePower) { 38989 const factor = 2 ** reducePower; 38990 image.width = Math.ceil(image.width / factor); 38991 image.height = Math.ceil(image.height / factor); 38992 } 38993 break; 38994 case "JBIG2Decode": 38995 image.bitsPerComponent = 1; 38996 image.numComps = 1; 38997 break; 38998 } 38999 let width = dict.get("W", "Width"); 39000 let height = dict.get("H", "Height"); 39001 if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) { 39002 warn("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary."); 39003 width = image.width; 39004 height = image.height; 39005 } else { 39006 const validWidth = typeof width === "number" && width > 0, 39007 validHeight = typeof height === "number" && height > 0; 39008 if (!validWidth || !validHeight) { 39009 if (!image.fallbackDims) { 39010 throw new FormatError(`Invalid image width: ${width} or height: ${height}`); 39011 } 39012 warn("PDFImage - using the Width/Height of the parent image, for SMask/Mask data."); 39013 if (!validWidth) { 39014 width = image.fallbackDims.width; 39015 } 39016 if (!validHeight) { 39017 height = image.fallbackDims.height; 39018 } 39019 } 39020 } 39021 this.width = width; 39022 this.height = height; 39023 this.interpolate = dict.get("I", "Interpolate"); 39024 this.imageMask = dict.get("IM", "ImageMask") || false; 39025 this.matte = dict.get("Matte") || false; 39026 let bitsPerComponent = image.bitsPerComponent; 39027 if (!bitsPerComponent) { 39028 bitsPerComponent = dict.get("BPC", "BitsPerComponent"); 39029 if (!bitsPerComponent) { 39030 if (this.imageMask) { 39031 bitsPerComponent = 1; 39032 } else { 39033 throw new FormatError(`Bits per component missing in image: ${this.imageMask}`); 39034 } 39035 } 39036 } 39037 this.bpc = bitsPerComponent; 39038 if (!this.imageMask) { 39039 let colorSpace = dict.getRaw("CS") || dict.getRaw("ColorSpace"); 39040 const hasColorSpace = !!colorSpace;
vendor: 8,738 bytes, lines 39040-39346
39040 39041 if (!hasColorSpace) { 39042 if (this.jpxDecoderOptions) { 39043 colorSpace = Name.get("DeviceRGBA"); 39044 } else { 39045 switch (image.numComps) { 39046 case 1: 39047 colorSpace = Name.get("DeviceGray"); 39048 break; 39049 case 3: 39050 colorSpace = Name.get("DeviceRGB"); 39051 break; 39052 case 4: 39053 colorSpace = Name.get("DeviceCMYK"); 39054 break; 39055 default: 39056 throw new Error(`Images with ${image.numComps} color components not supported.`); 39057 } 39058 } 39059 } else if (this.jpxDecoderOptions?.smaskInData) { 39060 colorSpace = Name.get("DeviceRGBA"); 39061 } 39062 this.colorSpace = ColorSpaceUtils.parse({ 39063 cs: colorSpace, 39064 xref, 39065 resources: isInline ? res : null, 39066 pdfFunctionFactory, 39067 globalColorSpaceCache, 39068 localColorSpaceCache 39069 }); 39070 this.numComps = this.colorSpace.numComps; 39071 if (this.jpxDecoderOptions) { 39072 this.jpxDecoderOptions.numComponents = hasColorSpace ? this.numComps : 0; 39073 this.jpxDecoderOptions.isIndexedColormap = this.colorSpace.name === "Indexed"; 39074 } 39075 } else { 39076 this.numComps = 1; 39077 } 39078 this.decode = dict.getArray("D", "Decode"); 39079 this.needsDecode = false; 39080 if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !ColorSpace.isDefaultDecode(this.decode, 1))) { 39081 this.needsDecode = true; 39082 const max = (1 << bitsPerComponent) - 1; 39083 this.decodeCoefficients = []; 39084 this.decodeAddends = []; 39085 const isIndexed = this.colorSpace?.name === "Indexed"; 39086 for (let i = 0, j = 0; i < this.decode.length; i += 2, ++j) { 39087 const dmin = this.decode[i]; 39088 const dmax = this.decode[i + 1]; 39089 this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin; 39090 this.decodeAddends[j] = isIndexed ? dmin : max * dmin; 39091 } 39092 } 39093 if (smask) { 39094 smask.fallbackDims ??= { 39095 width, 39096 height 39097 }; 39098 this.smask = new PDFImage({ 39099 xref, 39100 res, 39101 image: smask, 39102 isInline, 39103 pdfFunctionFactory, 39104 globalColorSpaceCache, 39105 localColorSpaceCache 39106 }); 39107 } else if (mask) { 39108 if (mask instanceof BaseStream) { 39109 const maskDict = mask.dict, 39110 imageMask = maskDict.get("IM", "ImageMask"); 39111 if (!imageMask) { 39112 warn("Ignoring /Mask in image without /ImageMask."); 39113 } else { 39114 mask.fallbackDims ??= { 39115 width, 39116 height 39117 }; 39118 this.mask = new PDFImage({ 39119 xref, 39120 res, 39121 image: mask, 39122 isInline, 39123 isMask: true, 39124 pdfFunctionFactory, 39125 globalColorSpaceCache, 39126 localColorSpaceCache 39127 }); 39128 } 39129 } else { 39130 this.mask = mask; 39131 } 39132 } 39133 } 39134 static async buildImage({ 39135 xref, 39136 res, 39137 image, 39138 isInline = false, 39139 pdfFunctionFactory, 39140 globalColorSpaceCache, 39141 localColorSpaceCache 39142 }) { 39143 const imageData = image; 39144 let smaskData = null; 39145 let maskData = null; 39146 const smask = image.dict.get("SMask"); 39147 const mask = image.dict.get("Mask"); 39148 if (smask) { 39149 if (smask instanceof BaseStream) { 39150 smaskData = smask; 39151 } else { 39152 warn("Unsupported /SMask format."); 39153 } 39154 } else if (mask) { 39155 if (mask instanceof BaseStream || Array.isArray(mask)) { 39156 maskData = mask; 39157 } else { 39158 warn("Unsupported /Mask format."); 39159 } 39160 } 39161 return new PDFImage({ 39162 xref, 39163 res, 39164 image: imageData, 39165 isInline, 39166 smask: smaskData, 39167 mask: maskData, 39168 pdfFunctionFactory, 39169 globalColorSpaceCache, 39170 localColorSpaceCache 39171 }); 39172 } 39173 static async createMask({ 39174 image, 39175 isOffscreenCanvasSupported = false 39176 }) { 39177 const { 39178 dict 39179 } = image; 39180 const width = dict.get("W", "Width"); 39181 const height = dict.get("H", "Height"); 39182 const interpolate = dict.get("I", "Interpolate"); 39183 const decode = dict.getArray("D", "Decode"); 39184 const inverseDecode = decode?.[0] > 0; 39185 const computedLength = (width + 7 >> 3) * height; 39186 const imgArray = await image.getImageData(computedLength); 39187 const isSingleOpaquePixel = width === 1 && height === 1 && inverseDecode === (imgArray.length === 0 || !!(imgArray[0] & 128)); 39188 if (isSingleOpaquePixel) { 39189 return { 39190 isSingleOpaquePixel 39191 }; 39192 } 39193 if (isOffscreenCanvasSupported) { 39194 if (ImageResizer.needsToBeResized(width, height)) { 39195 const data = new Uint8ClampedArray(width * height * 4); 39196 convertBlackAndWhiteToRGBA({ 39197 src: imgArray, 39198 dest: data, 39199 width, 39200 height, 39201 nonBlackColor: 0, 39202 inverseDecode 39203 }); 39204 return ImageResizer.createImage({ 39205 kind: ImageKind.RGBA_32BPP, 39206 data, 39207 width, 39208 height, 39209 interpolate 39210 }); 39211 } 39212 const canvas = new OffscreenCanvas(width, height); 39213 const ctx = canvas.getContext("2d"); 39214 const imgData = ctx.createImageData(width, height); 39215 convertBlackAndWhiteToRGBA({ 39216 src: imgArray, 39217 dest: imgData.data, 39218 width, 39219 height, 39220 nonBlackColor: 0, 39221 inverseDecode 39222 }); 39223 ctx.putImageData(imgData, 0, 0); 39224 const bitmap = canvas.transferToImageBitmap(); 39225 return { 39226 data: null, 39227 width, 39228 height, 39229 interpolate, 39230 bitmap 39231 }; 39232 } 39233 const actualLength = imgArray.byteLength; 39234 const haveFullData = computedLength === actualLength; 39235 let data; 39236 if (image instanceof DecodeStream && (!inverseDecode || haveFullData)) { 39237 data = imgArray; 39238 } else if (!inverseDecode) { 39239 data = new Uint8Array(imgArray); 39240 } else { 39241 data = new Uint8Array(computedLength); 39242 data.set(imgArray); 39243 data.fill(0xff, actualLength); 39244 } 39245 if (inverseDecode) { 39246 for (let i = 0; i < actualLength; i++) { 39247 data[i] ^= 0xff; 39248 } 39249 } 39250 return { 39251 data, 39252 width, 39253 height, 39254 interpolate 39255 }; 39256 } 39257 get drawWidth() { 39258 return Math.max(this.width, this.smask?.width || 0, this.mask?.width || 0); 39259 } 39260 get drawHeight() { 39261 return Math.max(this.height, this.smask?.height || 0, this.mask?.height || 0); 39262 } 39263 decodeBuffer(buffer) { 39264 const bpc = this.bpc; 39265 const numComps = this.numComps; 39266 const decodeAddends = this.decodeAddends; 39267 const decodeCoefficients = this.decodeCoefficients; 39268 const max = (1 << bpc) - 1; 39269 let i, ii; 39270 if (bpc === 1) { 39271 for (i = 0, ii = buffer.length; i < ii; i++) { 39272 buffer[i] = +!buffer[i]; 39273 } 39274 return; 39275 } 39276 let index = 0; 39277 for (i = 0, ii = this.width * this.height; i < ii; i++) { 39278 for (let j = 0; j < numComps; j++) { 39279 buffer[index] = MathClamp(decodeAddends[j] + buffer[index] * decodeCoefficients[j], 0, max); 39280 index++; 39281 } 39282 } 39283 } 39284 getComponents(buffer) { 39285 const bpc = this.bpc; 39286 if (bpc === 8) { 39287 return buffer; 39288 } 39289 const width = this.width; 39290 const height = this.height; 39291 const numComps = this.numComps; 39292 const length = width * height * numComps; 39293 let bufferPos = 0; 39294 let output; 39295 if (bpc <= 8) { 39296 output = new Uint8Array(length); 39297 } else if (bpc <= 16) { 39298 output = new Uint16Array(length); 39299 } else { 39300 output = new Uint32Array(length); 39301 } 39302 const rowComps = width * numComps; 39303 const max = (1 << bpc) - 1; 39304 let i = 0, 39305 ii, 39306 buf; 39307 if (bpc === 1) { 39308 let mask, loop1End, loop2End; 39309 for (let j = 0; j < height; j++) { 39310 loop1End = i + (rowComps & ~7); 39311 loop2End = i + rowComps; 39312 while (i < loop1End) { 39313 buf = buffer[bufferPos++]; 39314 output[i] = buf >> 7 & 1; 39315 output[i + 1] = buf >> 6 & 1; 39316 output[i + 2] = buf >> 5 & 1; 39317 output[i + 3] = buf >> 4 & 1; 39318 output[i + 4] = buf >> 3 & 1; 39319 output[i + 5] = buf >> 2 & 1; 39320 output[i + 6] = buf >> 1 & 1; 39321 output[i + 7] = buf & 1; 39322 i += 8; 39323 } 39324 if (i < loop2End) { 39325 buf = buffer[bufferPos++]; 39326 mask = 128; 39327 while (i < loop2End) { 39328 output[i++] = +!!(buf & mask); 39329 mask >>= 1; 39330 } 39331 } 39332 } 39333 } else { 39334 let bits = 0; 39335 buf = 0; 39336 for (i = 0, ii = length; i < ii; ++i) { 39337 if (i % rowComps === 0) { 39338 buf = 0; 39339 bits = 0; 39340 } 39341 while (bits < bpc) { 39342 buf = buf << 8 | buffer[bufferPos++]; 39343 bits += 8; 39344 } 39345 const remainingBits = bits - bpc; 39346
vendor: 1,863 bytes, lines 39346-39411
39346let value = buf >> remainingBits; 39347 if (value < 0) { 39348 value = 0; 39349 } else if (value > max) { 39350 value = max; 39351 } 39352 output[i] = value; 39353 buf &= (1 << remainingBits) - 1; 39354 bits = remainingBits; 39355 } 39356 } 39357 return output; 39358 } 39359 async fillOpacity(rgbaBuf, width, height, actualHeight, image) { 39360 let apply; 39361 if (this.smask) { 39362 apply = (buffer, options) => this.smask.fillGrayBuffer(buffer, { 39363 ...options, 39364 destWidth: width, 39365 destHeight: height 39366 }); 39367 } else if (this.mask) { 39368 if (this.mask instanceof PDFImage) { 39369 apply = (buffer, options) => this.mask.fillGrayBuffer(buffer, { 39370 ...options, 39371 invertOutput: true, 39372 destWidth: width, 39373 destHeight: height 39374 }); 39375 } else if (Array.isArray(this.mask)) { 39376 apply = (buffer, { 39377 maxRows, 39378 offset, 39379 stride 39380 }) => { 39381 for (let i = 0, ii = width * maxRows; i < ii; ++i) { 39382 let opacity = 0; 39383 const imageOffset = i * this.numComps; 39384 for (let j = 0; j < this.numComps; ++j) { 39385 const color = image[imageOffset + j]; 39386 const maskOffset = j * 2; 39387 if (color < this.mask[maskOffset] || color > this.mask[maskOffset + 1]) { 39388 opacity = 255; 39389 break; 39390 } 39391 } 39392 buffer[i * stride + offset] = opacity; 39393 } 39394 }; 39395 } else { 39396 throw new FormatError("Unknown mask format."); 39397 } 39398 } else { 39399 apply = (buffer, { 39400 maxRows, 39401 offset, 39402 stride 39403 }) => { 39404 for (let i = 0, ii = width * maxRows; i < ii; ++i) { 39405 buffer[i * stride + offset] = 255; 39406 } 39407 }; 39408 } 39409 await apply(rgbaBuf, { 39410 maxRows: actualHeight, 39411 offset: 3,
vendor: 5,378 bytes, lines 39412-39562
39412 stride: 4 39413 }); 39414 } 39415 undoPreblend(buffer, width, height) { 39416 const matte = this.smask?.matte; 39417 if (!matte) { 39418 return; 39419 } 39420 const matteRgb = this.colorSpace.getRgb(matte, 0); 39421 const matteR = matteRgb[0]; 39422 const matteG = matteRgb[1]; 39423 const matteB = matteRgb[2]; 39424 const length = width * height * 4; 39425 for (let i = 0; i < length; i += 4) { 39426 const alpha = buffer[i + 3]; 39427 if (alpha === 0) { 39428 buffer[i] = 255; 39429 buffer[i + 1] = 255; 39430 buffer[i + 2] = 255; 39431 continue; 39432 } 39433 const k = 255 / alpha; 39434 buffer[i] = (buffer[i] - matteR) * k + matteR; 39435 buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG; 39436 buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB; 39437 } 39438 } 39439 async createImageData(forceRGBA = false, isOffscreenCanvasSupported = false) { 39440 const drawWidth = this.drawWidth; 39441 const drawHeight = this.drawHeight; 39442 const imgData = { 39443 width: drawWidth, 39444 height: drawHeight, 39445 interpolate: this.interpolate, 39446 kind: 0, 39447 data: null 39448 }; 39449 const numComps = this.numComps; 39450 const originalWidth = this.width; 39451 const originalHeight = this.height; 39452 const bpc = this.bpc; 39453 const rowBytes = originalWidth * numComps * bpc + 7 >> 3; 39454 const mustBeResized = isOffscreenCanvasSupported && ImageResizer.needsToBeResized(drawWidth, drawHeight); 39455 if (!this.smask && !this.mask && this.colorSpace.name === "DeviceRGBA") { 39456 imgData.kind = ImageKind.RGBA_32BPP; 39457 const imgArray = imgData.data = await this.getImageBytes(originalHeight * originalWidth * 4, { 39458 internal: isOffscreenCanvasSupported && mustBeResized 39459 }); 39460 if (isOffscreenCanvasSupported) { 39461 if (!mustBeResized) { 39462 return this.createBitmap(ImageKind.RGBA_32BPP, drawWidth, drawHeight, imgArray); 39463 } 39464 return ImageResizer.createImage(imgData, false); 39465 } 39466 return imgData; 39467 } 39468 if (!forceRGBA) { 39469 let kind; 39470 if (this.colorSpace.name === "DeviceGray" && bpc === 1) { 39471 kind = ImageKind.GRAYSCALE_1BPP; 39472 } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) { 39473 kind = ImageKind.RGB_24BPP; 39474 } 39475 if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) { 39476 const image = await this.#getImage(originalWidth, originalHeight); 39477 if (image) { 39478 return image; 39479 } 39480 const data = await this.getImageBytes(originalHeight * rowBytes, { 39481 internal: isOffscreenCanvasSupported && mustBeResized 39482 }); 39483 if (isOffscreenCanvasSupported) { 39484 if (mustBeResized) { 39485 return ImageResizer.createImage({ 39486 data, 39487 kind, 39488 width: drawWidth, 39489 height: drawHeight, 39490 interpolate: this.interpolate 39491 }, this.needsDecode); 39492 } 39493 return this.createBitmap(kind, originalWidth, originalHeight, data); 39494 } 39495 imgData.kind = kind; 39496 imgData.data = data; 39497 if (this.needsDecode) { 39498 assert(kind === ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale."); 39499 const buffer = imgData.data; 39500 for (let i = 0, ii = buffer.length; i < ii; i++) { 39501 buffer[i] ^= 0xff; 39502 } 39503 } 39504 return imgData; 39505 } 39506 if (this.image instanceof JpegStream && !this.smask && !this.mask && !this.needsDecode) { 39507 let imageLength = originalHeight * rowBytes; 39508 if (isOffscreenCanvasSupported && !mustBeResized) { 39509 let isHandled = false; 39510 switch (this.colorSpace.name) { 39511 case "DeviceGray": 39512 imageLength *= 4; 39513 isHandled = true; 39514 break; 39515 case "DeviceRGB": 39516 imageLength = imageLength / 3 * 4; 39517 isHandled = true; 39518 break; 39519 case "DeviceCMYK": 39520 isHandled = true; 39521 break; 39522 } 39523 if (isHandled) { 39524 const image = await this.#getImage(drawWidth, drawHeight); 39525 if (image) { 39526 return image; 39527 } 39528 const rgba = await this.getImageBytes(imageLength, { 39529 drawWidth, 39530 drawHeight, 39531 forceRGBA: true, 39532 internal: true 39533 }); 39534 return this.createBitmap(ImageKind.RGBA_32BPP, drawWidth, drawHeight, rgba); 39535 } 39536 } else { 39537 switch (this.colorSpace.name) { 39538 case "DeviceGray": 39539 imageLength *= 3; 39540 case "DeviceRGB": 39541 case "DeviceCMYK": 39542 imgData.kind = ImageKind.RGB_24BPP; 39543 imgData.data = await this.getImageBytes(imageLength, { 39544 drawWidth, 39545 drawHeight, 39546 forceRGB: true, 39547 internal: mustBeResized 39548 }); 39549 if (mustBeResized) { 39550 return ImageResizer.createImage(imgData); 39551 } 39552 return imgData; 39553 } 39554 } 39555 } 39556 } 39557 const imgArray = await this.getImageBytes(originalHeight * rowBytes, { 39558 internal: true 39559 }); 39560 const actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight; 39561 const comps = this.getComponents(imgArray); 39562 let alpha01, maybeUndoPreblend;
vendor: 8,500 bytes, lines 39563-39901
39563 let canvas, ctx, canvasImgData, data; 39564 if (isOffscreenCanvasSupported && !mustBeResized) { 39565 canvas = new OffscreenCanvas(drawWidth, drawHeight); 39566 ctx = canvas.getContext("2d"); 39567 canvasImgData = ctx.createImageData(drawWidth, drawHeight); 39568 data = canvasImgData.data; 39569 } 39570 imgData.kind = ImageKind.RGBA_32BPP; 39571 if (!forceRGBA && !this.smask && !this.mask) { 39572 if (!isOffscreenCanvasSupported || mustBeResized) { 39573 imgData.kind = ImageKind.RGB_24BPP; 39574 data = new Uint8ClampedArray(drawWidth * drawHeight * 3); 39575 alpha01 = 0; 39576 } else { 39577 const arr = new Uint32Array(data.buffer); 39578 arr.fill(FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff); 39579 alpha01 = 1; 39580 } 39581 maybeUndoPreblend = false; 39582 } else { 39583 if (!isOffscreenCanvasSupported || mustBeResized) { 39584 data = new Uint8ClampedArray(drawWidth * drawHeight * 4); 39585 } 39586 alpha01 = 1; 39587 maybeUndoPreblend = true; 39588 await this.fillOpacity(data, drawWidth, drawHeight, actualHeight, comps); 39589 } 39590 if (this.needsDecode) { 39591 this.decodeBuffer(comps); 39592 } 39593 this.colorSpace.fillRgb(data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01); 39594 if (maybeUndoPreblend) { 39595 this.undoPreblend(data, drawWidth, actualHeight); 39596 } 39597 if (isOffscreenCanvasSupported && !mustBeResized) { 39598 ctx.putImageData(canvasImgData, 0, 0); 39599 const bitmap = canvas.transferToImageBitmap(); 39600 return { 39601 data: null, 39602 width: drawWidth, 39603 height: drawHeight, 39604 bitmap, 39605 interpolate: this.interpolate 39606 }; 39607 } 39608 imgData.data = data; 39609 if (mustBeResized) { 39610 return ImageResizer.createImage(imgData); 39611 } 39612 return imgData; 39613 } 39614 async fillGrayBuffer(buffer, { 39615 destWidth, 39616 destHeight, 39617 invertOutput, 39618 maxRows, 39619 offset = 0, 39620 stride = 1 39621 } = {}) { 39622 const numComps = this.numComps; 39623 if (numComps !== 1) { 39624 throw new FormatError(`Reading gray scale from a color image: ${numComps}`); 39625 } 39626 const srcWidth = this.width; 39627 const srcHeight = this.height; 39628 const bpc = this.bpc; 39629 const rowBytes = srcWidth * numComps * bpc + 7 >> 3; 39630 const imgArray = await this.getImageBytes(srcHeight * rowBytes, { 39631 internal: true 39632 }); 39633 const comps = this.getComponents(imgArray); 39634 const resolvedDestWidth = destWidth ?? srcWidth; 39635 const resolvedDestHeight = destHeight ?? srcHeight; 39636 const needsResampling = resolvedDestWidth !== srcWidth || resolvedDestHeight !== srcHeight; 39637 const rows = maxRows === undefined ? resolvedDestHeight : Math.min(resolvedDestHeight, maxRows); 39638 let outputWidth = srcWidth; 39639 let yRatio = 0; 39640 let xScaled = null; 39641 if (needsResampling) { 39642 outputWidth = resolvedDestWidth; 39643 yRatio = srcHeight / resolvedDestHeight; 39644 const xRatio = srcWidth / resolvedDestWidth; 39645 xScaled = new Uint32Array(resolvedDestWidth); 39646 for (let i = 0; i < resolvedDestWidth; i++) { 39647 xScaled[i] = Math.floor(i * xRatio); 39648 } 39649 } 39650 const mask = invertOutput ? 0xff : 0; 39651 if (bpc === 1) { 39652 if (xScaled) { 39653 const xMap = xScaled; 39654 let destIndex = offset; 39655 if (this.needsDecode) { 39656 for (let row = 0; row < rows; row++) { 39657 const py = Math.floor(row * yRatio) * srcWidth; 39658 for (let col = 0; col < outputWidth; col++) { 39659 buffer[destIndex] = comps[py + xMap[col]] - 1 & 255 ^ mask; 39660 destIndex += stride; 39661 } 39662 } 39663 } else { 39664 for (let row = 0; row < rows; row++) { 39665 const py = Math.floor(row * yRatio) * srcWidth; 39666 for (let col = 0; col < outputWidth; col++) { 39667 buffer[destIndex] = -comps[py + xMap[col]] & 255 ^ mask; 39668 destIndex += stride; 39669 } 39670 } 39671 } 39672 } else { 39673 const length = outputWidth * rows; 39674 if (this.needsDecode) { 39675 for (let i = 0; i < length; ++i) { 39676 buffer[i * stride + offset] = comps[i] - 1 & 255 ^ mask; 39677 } 39678 } else { 39679 for (let i = 0; i < length; ++i) { 39680 buffer[i * stride + offset] = -comps[i] & 255 ^ mask; 39681 } 39682 } 39683 } 39684 return; 39685 } 39686 if (this.needsDecode) { 39687 this.decodeBuffer(comps); 39688 } 39689 const scale = 255 / ((1 << bpc) - 1); 39690 if (xScaled) { 39691 const xMap = xScaled; 39692 let destIndex = offset; 39693 for (let row = 0; row < rows; row++) { 39694 const py = Math.floor(row * yRatio) * srcWidth; 39695 for (let col = 0; col < outputWidth; col++) { 39696 buffer[destIndex] = scale * comps[py + xMap[col]] ^ mask; 39697 destIndex += stride; 39698 } 39699 } 39700 } else { 39701 const length = outputWidth * rows; 39702 for (let i = 0; i < length; ++i) { 39703 buffer[i * stride + offset] = scale * comps[i] ^ mask; 39704 } 39705 } 39706 } 39707 createBitmap(kind, width, height, src) { 39708 const canvas = new OffscreenCanvas(width, height); 39709 const ctx = canvas.getContext("2d"); 39710 let imgData; 39711 if (kind === ImageKind.RGBA_32BPP) { 39712 imgData = new ImageData(src, width, height); 39713 } else { 39714 imgData = ctx.createImageData(width, height); 39715 convertToRGBA({ 39716 kind, 39717 src, 39718 dest: new Uint32Array(imgData.data.buffer), 39719 width, 39720 height, 39721 inverseDecode: this.needsDecode 39722 }); 39723 } 39724 ctx.putImageData(imgData, 0, 0); 39725 const bitmap = canvas.transferToImageBitmap(); 39726 return { 39727 data: null, 39728 width, 39729 height, 39730 bitmap, 39731 interpolate: this.interpolate 39732 }; 39733 } 39734 async #getImage(width, height) { 39735 const bitmap = await this.image.getTransferableImage(); 39736 if (!bitmap) { 39737 return null; 39738 } 39739 return { 39740 data: null, 39741 width, 39742 height, 39743 bitmap, 39744 interpolate: this.interpolate 39745 }; 39746 } 39747 async getImageBytes(length, { 39748 drawWidth, 39749 drawHeight, 39750 forceRGBA = false, 39751 forceRGB = false, 39752 internal = false 39753 }) { 39754 this.image.reset(); 39755 this.image.drawWidth = drawWidth || this.width; 39756 this.image.drawHeight = drawHeight || this.height; 39757 this.image.forceRGBA = !!forceRGBA; 39758 this.image.forceRGB = !!forceRGB; 39759 const imageBytes = await this.image.getImageData(length, this.jpxDecoderOptions); 39760 if (internal || this.image instanceof DecodeStream) { 39761 return imageBytes; 39762 } 39763 assert(imageBytes instanceof Uint8Array, 'PDFImage.getImageBytes: Unsupported "imageBytes" type.'); 39764 return new Uint8Array(imageBytes); 39765 } 39766} 39767 39768;// ./src/core/evaluator.js 39769 39770 39771 39772 39773 39774 39775 39776 39777 39778 39779 39780 39781 39782 39783 39784 39785 39786 39787 39788 39789 39790 39791 39792 39793 39794 39795 39796 39797 39798 39799 39800 39801 39802 39803 39804 39805 39806 39807 39808 39809 39810 39811 39812 39813 39814 39815 39816 39817 39818 39819 39820 39821const DefaultPartialEvaluatorOptions = Object.freeze({ 39822 maxImageSize: -1, 39823 disableFontFace: false, 39824 ignoreErrors: false, 39825 isOffscreenCanvasSupported: false, 39826 isImageDecoderSupported: false, 39827 canvasMaxAreaInBytes: -1, 39828 fontExtraProperties: false, 39829 useSystemFonts: true, 39830 useWasm: true, 39831 useWorkerFetch: true, 39832 cMapUrl: null, 39833 cMapPacked: true, 39834 iccUrl: null, 39835 standardFontDataUrl: null, 39836 wasmUrl: null, 39837 hasGPU: false 39838}); 39839const PatternType = { 39840 TILING: 1, 39841 SHADING: 2 39842}; 39843const TEXT_CHUNK_BATCH_SIZE = 10; 39844const deferred = Promise.resolve(); 39845function normalizeBlendMode(value, parsingArray = false) { 39846 if (Array.isArray(value)) { 39847 for (const val of value) { 39848 const maybeBM = normalizeBlendMode(val, true); 39849 if (maybeBM) { 39850 return maybeBM; 39851 } 39852 } 39853 warn(`Unsupported blend mode Array: ${value}`); 39854 return "source-over"; 39855 } 39856 if (!(value instanceof Name)) { 39857 if (parsingArray) { 39858 return null; 39859 } 39860 return "source-over"; 39861 } 39862 switch (value.name) { 39863 case "Normal": 39864 case "Compatible": 39865 return "source-over"; 39866 case "Multiply": 39867 return "multiply"; 39868 case "Screen": 39869 return "screen"; 39870 case "Overlay": 39871 return "overlay"; 39872 case "Darken": 39873 return "darken"; 39874 case "Lighten": 39875 return "lighten"; 39876 case "ColorDodge": 39877 return "color-dodge"; 39878 case "ColorBurn": 39879 return "color-burn"; 39880 case "HardLight": 39881 return "hard-light"; 39882 case "SoftLight": 39883 return "soft-light"; 39884 case "Difference": 39885 return "difference"; 39886 case "Exclusion": 39887 return "exclusion"; 39888 case "Hue": 39889 return "hue"; 39890 case "Saturation": 39891 return "saturation"; 39892 case "Color": 39893 return "color"; 39894 case "Luminosity": 39895 return "luminosity"; 39896 } 39897 if (parsingArray) { 39898 return null; 39899 } 39900 warn(`Unsupported blend mode: ${value.name}`); 39901 return
vendor: 7,338 bytes, lines 39901-40150
39901 "source-over"; 39902} 39903function addCachedImageOps(opList, { 39904 objId, 39905 fn, 39906 args, 39907 optionalContent, 39908 hasMask 39909}) { 39910 if (objId) { 39911 opList.addDependency(objId); 39912 } 39913 opList.addImageOps(fn, args, optionalContent, hasMask); 39914 if (fn === OPS.paintImageMaskXObject && args[0]?.count > 0) { 39915 args[0].count++; 39916 } 39917} 39918class TimeSlotManager { 39919 static TIME_SLOT_DURATION_MS = 20; 39920 static CHECK_TIME_EVERY = 100; 39921 constructor() { 39922 this.reset(); 39923 } 39924 check() { 39925 if (++this.checked < TimeSlotManager.CHECK_TIME_EVERY) { 39926 return false; 39927 } 39928 this.checked = 0; 39929 return this.endTime <= Date.now(); 39930 } 39931 reset() { 39932 this.endTime = Date.now() + TimeSlotManager.TIME_SLOT_DURATION_MS; 39933 this.checked = 0; 39934 } 39935} 39936class PartialEvaluator { 39937 constructor({ 39938 xref, 39939 handler, 39940 pageIndex, 39941 idFactory, 39942 fontCache, 39943 builtInCMapCache, 39944 standardFontDataCache, 39945 globalColorSpaceCache, 39946 globalImageCache, 39947 systemFontCache, 39948 options = null 39949 }) { 39950 this.xref = xref; 39951 this.handler = handler; 39952 this.pageIndex = pageIndex; 39953 this.idFactory = idFactory; 39954 this.fontCache = fontCache; 39955 this.builtInCMapCache = builtInCMapCache; 39956 this.standardFontDataCache = standardFontDataCache; 39957 this.globalColorSpaceCache = globalColorSpaceCache; 39958 this.globalImageCache = globalImageCache; 39959 this.systemFontCache = systemFontCache; 39960 this.options = options || DefaultPartialEvaluatorOptions; 39961 this.type3FontRefs = null; 39962 this._regionalImageCache = new RegionalImageCache(); 39963 this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this); 39964 } 39965 get _pdfFunctionFactory() { 39966 return shadow(this, "_pdfFunctionFactory", new PDFFunctionFactory({ 39967 xref: this.xref 39968 })); 39969 } 39970 get parsingType3Font() { 39971 return !!this.type3FontRefs; 39972 } 39973 clone(newOptions = null) { 39974 const newEvaluator = Object.create(this); 39975 newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions); 39976 return newEvaluator; 39977 } 39978 hasBlendModes(resources, nonBlendModesSet) { 39979 if (!(resources instanceof Dict)) { 39980 return false; 39981 } 39982 if (resources.objId && nonBlendModesSet.has(resources.objId)) { 39983 return false; 39984 } 39985 const processed = new RefSet(nonBlendModesSet); 39986 if (resources.objId) { 39987 processed.put(resources.objId); 39988 } 39989 const nodes = [resources], 39990 xref = this.xref; 39991 while (nodes.length) { 39992 const node = nodes.shift(); 39993 const graphicStates = node.get("ExtGState"); 39994 if (graphicStates instanceof Dict) { 39995 for (let graphicState of graphicStates.getRawValues()) { 39996 if (graphicState instanceof Ref) { 39997 if (processed.has(graphicState)) { 39998 continue; 39999 } 40000 try { 40001 graphicState = xref.fetch(graphicState); 40002 } catch (ex) { 40003 processed.put(graphicState); 40004 info(`hasBlendModes - ignoring ExtGState: "${ex}".`); 40005 continue; 40006 } 40007 } 40008 if (!(graphicState instanceof Dict)) { 40009 continue; 40010 } 40011 if (graphicState.objId) { 40012 processed.put(graphicState.objId); 40013 } 40014 const bm = graphicState.get("BM"); 40015 if (bm instanceof Name) { 40016 if (bm.name !== "Normal") { 40017 return true; 40018 } 40019 continue; 40020 } 40021 if (bm !== undefined && Array.isArray(bm)) { 40022 for (const element of bm) { 40023 if (element instanceof Name && element.name !== "Normal") { 40024 return true; 40025 } 40026 } 40027 } 40028 } 40029 } 40030 const xObjects = node.get("XObject"); 40031 if (!(xObjects instanceof Dict)) { 40032 continue; 40033 } 40034 for (let xObject of xObjects.getRawValues()) { 40035 if (xObject instanceof Ref) { 40036 if (processed.has(xObject)) { 40037 continue; 40038 } 40039 try { 40040 xObject = xref.fetch(xObject); 40041 } catch (ex) { 40042 processed.put(xObject); 40043 info(`hasBlendModes - ignoring XObject: "${ex}".`); 40044 continue; 40045 } 40046 } 40047 if (!(xObject instanceof BaseStream)) { 40048 continue; 40049 } 40050 if (xObject.dict.objId) { 40051 processed.put(xObject.dict.objId); 40052 } 40053 const xResources = xObject.dict.get("Resources"); 40054 if (!(xResources instanceof Dict)) { 40055 continue; 40056 } 40057 if (xResources.objId && processed.has(xResources.objId)) { 40058 continue; 40059 } 40060 nodes.push(xResources); 40061 if (xResources.objId) { 40062 processed.put(xResources.objId); 40063 } 40064 } 40065 } 40066 for (const ref of processed) { 40067 nonBlendModesSet.put(ref); 40068 } 40069 return false; 40070 } 40071 async fetchBuiltInCMap(name) { 40072 const cachedData = this.builtInCMapCache.get(name); 40073 if (cachedData) { 40074 return cachedData; 40075 } 40076 let data; 40077 if (this.options.useWorkerFetch) { 40078 data = { 40079 cMapData: await fetchBinaryData(`${this.options.cMapUrl}${name}.bcmap`), 40080 isCompressed: true 40081 }; 40082 } else { 40083 data = { 40084 cMapData: await this.handler.sendWithPromise("FetchBinaryData", { 40085 kind: "cMapUrl", 40086 filename: `${name}${this.options.cMapPacked ? ".bcmap" : ""}` 40087 }), 40088 isCompressed: this.options.cMapPacked 40089 }; 40090 } 40091 this.builtInCMapCache.set(name, data); 40092 return data; 40093 } 40094 async fetchStandardFontData(name) { 40095 const cachedData = this.standardFontDataCache.get(name); 40096 if (cachedData) { 40097 return new Stream(cachedData); 40098 } 40099 if (this.options.useSystemFonts && name !== "Symbol" && name !== "ZapfDingbats") { 40100 return null; 40101 } 40102 const standardFontNameToFileName = getFontNameToFileMap(), 40103 filename = standardFontNameToFileName[name]; 40104 let data; 40105 try { 40106 if (this.options.useWorkerFetch) { 40107 data = await fetchBinaryData(`${this.options.standardFontDataUrl}${filename}`); 40108 } else { 40109 data = await this.handler.sendWithPromise("FetchBinaryData", { 40110 kind: "standardFontDataUrl", 40111 filename 40112 }); 40113 } 40114 } catch (ex) { 40115 warn(ex); 40116 return null; 40117 } 40118 this.standardFontDataCache.set(name, data); 40119 return new Stream(data); 40120 } 40121 async buildFormXObject(resources, xobj, smask, operatorList, task, initialState, localColorSpaceCache, seenRefs) { 40122 const { 40123 dict 40124 } = xobj; 40125 const matrix = lookupMatrix(dict.getArray("Matrix"), null); 40126 const bbox = lookupNormalRect(dict.getArray("BBox"), null); 40127 let f32bbox = bbox && new Float32Array(bbox); 40128 if (f32bbox?.some(x => !isFinite(x))) { 40129 f32bbox = null; 40130 } 40131 let optionalContent, groupOptions; 40132 if (dict.has("OC")) { 40133 optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources); 40134 } 40135 if (optionalContent !== undefined) { 40136 operatorList.addOp(OPS.beginMarkedContentProps, ["OC", optionalContent]); 40137 } 40138 const group = dict.get("Group"); 40139 let newOpList; 40140 const f32matrix = matrix && new Float32Array(matrix); 40141 const args = [f32matrix, !group && f32bbox || null]; 40142 const localResources = dict.get("Resources"); 40143 if (group) { 40144 groupOptions = { 40145 matrix, 40146 bbox: f32bbox, 40147 smask, 40148 isolated: false, 40149 knockout: false, 40150 needsIsolation: false
40150 40151 }; 40152 const groupSubtype = group.get("S"); 40153 let colorSpace = null; 40154 if (isName(groupSubtype, "Transparency")) { 40155 groupOptions.isolated = group.get("I") || false; 40156 groupOptions.knockout = group.get("K") || false; 40157 if (group.has("CS")) { 40158 const cs = this._getColorSpace(group.getRaw("CS"), resources, localColorSpaceCache); 40159 colorSpace = cs instanceof ColorSpace ? cs : await this._handleColorSpace(cs); 40160 } 40161 } 40162 if (smask?.backdrop) { 40163 colorSpace ||= ColorSpaceUtils.rgb; 40164 smask.backdrop = colorSpace.getRgbHex(smask.backdrop, 0); 40165 } 40166 newOpList = new CheckedOperatorList(); 40167 } else { 40168 newOpList = operatorList; 40169 operatorList.addOp(OPS.paintFormXObjectBegin, args); 40170 } 40171 await this.getOperatorList({ 40172 stream: xobj, 40173 task, 40174 resources: localResources instanceof Dict ? localResources : resources, 40175 operatorList: newOpList, 40176 initialState, 40177 prevRefs: seenRefs 40178 }); 40179 if (group) { 40180 groupOptions.needsIsolation = newOpList.needsIsolation
vendor: 7,352 bytes, lines 40180-40403
40180 || !!smask; 40181 operatorList.addOp(OPS.beginGroup, [groupOptions]); 40182 operatorList.addOp(OPS.paintFormXObjectBegin, args); 40183 operatorList.addOpList(newOpList); 40184 operatorList.addOp(OPS.paintFormXObjectEnd, []); 40185 operatorList.addOp(OPS.endGroup, [groupOptions]); 40186 } else { 40187 operatorList.addOp(OPS.paintFormXObjectEnd, []); 40188 } 40189 if (optionalContent !== undefined) { 40190 operatorList.addOp(OPS.endMarkedContent, []); 40191 } 40192 } 40193 _sendImgData(objId, imgData, cacheGlobally = false) { 40194 const transfers = imgData ? [imgData.bitmap || imgData.data.buffer] : null; 40195 if (this.parsingType3Font || cacheGlobally) { 40196 return this.handler.send("commonobj", [objId, "Image", imgData], transfers); 40197 } 40198 return this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], transfers); 40199 } 40200 async buildPaintImageXObject({ 40201 resources, 40202 image, 40203 isInline = false, 40204 operatorList, 40205 cacheKey, 40206 localImageCache, 40207 localColorSpaceCache 40208 }) { 40209 const { 40210 maxImageSize, 40211 ignoreErrors, 40212 isOffscreenCanvasSupported 40213 } = this.options; 40214 const { 40215 dict 40216 } = image; 40217 const imageRef = dict.objId; 40218 const w = dict.get("W", "Width"); 40219 const h = dict.get("H", "Height"); 40220 if (!(w && typeof w === "number") || !(h && typeof h === "number")) { 40221 warn("Image dimensions are missing, or not numbers."); 40222 return; 40223 } 40224 if (maxImageSize !== -1 && w * h > maxImageSize) { 40225 const msg = "Image exceeded maximum allowed size and was removed."; 40226 if (!ignoreErrors) { 40227 throw new Error(msg); 40228 } 40229 warn(msg); 40230 return; 40231 } 40232 let optionalContent; 40233 if (dict.has("OC")) { 40234 optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources); 40235 } 40236 const imageMask = dict.get("IM", "ImageMask") || false; 40237 let imgData, fn, args; 40238 if (imageMask) { 40239 imgData = await PDFImage.createMask({ 40240 image, 40241 isOffscreenCanvasSupported: isOffscreenCanvasSupported && !this.parsingType3Font 40242 }); 40243 if (imgData.isSingleOpaquePixel) { 40244 fn = OPS.paintSolidColorImageMask; 40245 args = []; 40246 operatorList.addImageOps(fn, args, optionalContent); 40247 if (cacheKey) { 40248 const cacheData = { 40249 fn, 40250 args, 40251 optionalContent 40252 }; 40253 localImageCache.set(cacheKey, imageRef, cacheData); 40254 if (imageRef) { 40255 this._regionalImageCache.set(null, imageRef, cacheData); 40256 } 40257 } 40258 return; 40259 } 40260 if (this.parsingType3Font) { 40261 args = compileType3Glyph(imgData); 40262 if (args) { 40263 operatorList.addImageOps(OPS.constructPath, args, optionalContent); 40264 return; 40265 } 40266 warn("Cannot compile Type3 glyph."); 40267 operatorList.addImageOps(OPS.paintImageMaskXObject, [imgData], optionalContent); 40268 return; 40269 } 40270 const objId = `mask_${this.idFactory.createObjId()}`; 40271 operatorList.addDependency(objId); 40272 imgData.dataLen = imgData.bitmap ? imgData.width * imgData.height * 4 : imgData.data.length; 40273 this._sendImgData(objId, imgData); 40274 fn = OPS.paintImageMaskXObject; 40275 args = [{ 40276 data: objId, 40277 width: imgData.width, 40278 height: imgData.height, 40279 interpolate: imgData.interpolate, 40280 count: 1 40281 }]; 40282 operatorList.addImageOps(fn, args, optionalContent); 40283 if (cacheKey) { 40284 const cacheData = { 40285 objId, 40286 fn, 40287 args, 40288 optionalContent 40289 }; 40290 localImageCache.set(cacheKey, imageRef, cacheData); 40291 if (imageRef) { 40292 this._regionalImageCache.set(null, imageRef, cacheData); 40293 } 40294 } 40295 return; 40296 } 40297 const SMALL_IMAGE_DIMENSIONS = 200; 40298 const hasMask = dict.has("SMask") || dict.has("Mask"); 40299 if (isInline && w + h < SMALL_IMAGE_DIMENSIONS && !hasMask) { 40300 try { 40301 const imageObj = new PDFImage({ 40302 xref: this.xref, 40303 res: resources, 40304 image, 40305 isInline, 40306 pdfFunctionFactory: this._pdfFunctionFactory, 40307 globalColorSpaceCache: this.globalColorSpaceCache, 40308 localColorSpaceCache 40309 }); 40310 imgData = await imageObj.createImageData(true, false); 40311 operatorList.addImageOps(OPS.paintInlineImageXObject, [imgData], optionalContent); 40312 } catch (reason) { 40313 const msg = `Unable to decode inline image: "${reason}".`; 40314 if (!ignoreErrors) { 40315 throw new Error(msg); 40316 } 40317 warn(msg); 40318 } 40319 return; 40320 } 40321 let objId = `img_${this.idFactory.createObjId()}`, 40322 cacheGlobally = false, 40323 globalCacheData = null; 40324 if (this.parsingType3Font) { 40325 objId = `${this.idFactory.getDocId()}_type3_${objId}`; 40326 } else if (cacheKey && imageRef) { 40327 cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex); 40328 if (cacheGlobally) { 40329 assert(!isInline, "Cannot cache an inline image globally."); 40330 objId = `${this.idFactory.getDocId()}_${objId}`; 40331 } 40332 } 40333 operatorList.addDependency(objId); 40334 fn = OPS.paintImageXObject; 40335 args = [objId, w, h]; 40336 operatorList.addImageOps(fn, args, optionalContent, hasMask); 40337 if (cacheGlobally) { 40338 globalCacheData = { 40339 objId, 40340 fn, 40341 args, 40342 optionalContent, 40343 hasMask, 40344 byteSize: 0 40345 }; 40346 if (this.globalImageCache.hasDecodeFailed(imageRef)) { 40347 this.globalImageCache.setData(imageRef, globalCacheData); 40348 this._sendImgData(objId, null, cacheGlobally); 40349 return; 40350 } 40351 if (w * h > 250000 || hasMask) { 40352 const localLength = await this.handler.sendWithPromise("commonobj", [objId, "CopyLocalImage", { 40353 imageRef 40354 }]); 40355 if (localLength) { 40356 this.globalImageCache.setData(imageRef, globalCacheData); 40357 this.globalImageCache.addByteSize(imageRef, localLength); 40358 return; 40359 } 40360 } 40361 } 40362 PDFImage.buildImage({ 40363 xref: this.xref, 40364 res: resources, 40365 image, 40366 isInline, 40367 pdfFunctionFactory: this._pdfFunctionFactory, 40368 globalColorSpaceCache: this.globalColorSpaceCache, 40369 localColorSpaceCache 40370 }).then(async imageObj => { 40371 imgData = await imageObj.createImageData(false, isOffscreenCanvasSupported); 40372 imgData.dataLen = imgData.bitmap ? imgData.width * imgData.height * 4 : imgData.data.length; 40373 imgData.ref = imageRef; 40374 if (cacheGlobally) { 40375 this.globalImageCache.addByteSize(imageRef, imgData.dataLen); 40376 } 40377 return this._sendImgData(objId, imgData, cacheGlobally); 40378 }).catch(reason => { 40379 warn(`Unable to decode image "${objId}": "${reason}".`); 40380 if (imageRef) { 40381 this.globalImageCache.addDecodeFailed(imageRef); 40382 } 40383 return this._sendImgData(objId, null, cacheGlobally); 40384 }); 40385 if (cacheKey) { 40386 const cacheData = { 40387 objId, 40388 fn, 40389 args, 40390 optionalContent, 40391 hasMask 40392 }; 40393 localImageCache.set(cacheKey, imageRef, cacheData); 40394 if (imageRef) { 40395 this._regionalImageCache.set(null, imageRef, cacheData); 40396 if (cacheGlobally) { 40397 assert(globalCacheData, "The global cache-data must be available."); 40398 this.globalImageCache.setData(imageRef, globalCacheData); 40399 } 40400 } 40401 } 40402 } 40403
vendor: 2,429 bytes, lines 40403-40476
40403handleSMask(smask, resources, operatorList, task, stateManager, localColorSpaceCache, seenRefs) { 40404 const smaskContent = smask.get("G"); 40405 const smaskOptions = { 40406 subtype: smask.get("S").name, 40407 backdrop: smask.get("BC") 40408 }; 40409 const transferObj = smask.get("TR"); 40410 if (isPDFFunction(transferObj)) { 40411 const transferFn = this._pdfFunctionFactory.create(transferObj); 40412 const transferMap = new Uint8Array(256); 40413 const tmp = new Float32Array(1); 40414 for (let i = 0; i < 256; i++) { 40415 tmp[0] = i / 255; 40416 transferFn(tmp, 0, tmp, 0); 40417 transferMap[i] = tmp[0] * 255 | 0; 40418 } 40419 smaskOptions.transferMap = transferMap; 40420 } 40421 return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone({ 40422 newPath: true 40423 }), localColorSpaceCache, seenRefs); 40424 } 40425 handleTransferFunction(tr) { 40426 let transferArray; 40427 if (Array.isArray(tr)) { 40428 transferArray = tr; 40429 if (tr.length > 1 && tr.every(map => map === tr[0])) { 40430 transferArray = [tr[0]]; 40431 } 40432 } else if (isPDFFunction(tr)) { 40433 transferArray = [tr]; 40434 } else { 40435 return null; 40436 } 40437 const transferMaps = []; 40438 let numFns = 0, 40439 numEffectfulFns = 0; 40440 for (const entry of transferArray) { 40441 const transferObj = this.xref.fetchIfRef(entry); 40442 numFns++; 40443 if (isName(transferObj, "Identity")) { 40444 transferMaps.push(null); 40445 continue; 40446 } else if (!isPDFFunction(transferObj)) { 40447 return null; 40448 } 40449 const transferFn = this._pdfFunctionFactory.create(transferObj); 40450 const transferMap = new Uint8Array(256), 40451 tmp = new Float32Array(1); 40452 for (let j = 0; j < 256; j++) { 40453 tmp[0] = j / 255; 40454 transferFn(tmp, 0, tmp, 0); 40455 transferMap[j] = tmp[0] * 255 | 0; 40456 } 40457 transferMaps.push(transferMap); 40458 numEffectfulFns++; 40459 } 40460 if (!(numFns === 1 || numFns === 4)) { 40461 return null; 40462 } 40463 if (numEffectfulFns === 0) { 40464 return null; 40465 } 40466 return transferMaps; 40467 } 40468 handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, localTilingPatternCache) { 40469 const tilingOpList = new CheckedOperatorList(); 40470 const patternResources = Dict.merge({ 40471 xref: this.xref, 40472 dictArray: [patternDict.get("Resources"), resources] 40473 }); 40474 return this.getOperatorList({ 40475 stream: pattern, 40476 task,
vendor: 1,402 bytes, lines 40477-40514
40477 resources: patternResources, 40478 operatorList: tilingOpList 40479 }).then(function () { 40480 const operatorListIR = tilingOpList.getIR(); 40481 const { 40482 needsIsolation 40483 } = tilingOpList; 40484 const tilingPatternIR = getTilingPatternIR(operatorListIR, patternDict, color, needsIsolation); 40485 operatorList.addDependencies(tilingOpList.dependencies); 40486 operatorList.addOp(fn, tilingPatternIR); 40487 if (patternDict.objId) { 40488 localTilingPatternCache.set(null, patternDict.objId, { 40489 operatorListIR, 40490 needsIsolation, 40491 dict: patternDict 40492 }); 40493 } 40494 }).catch(reason => { 40495 if (reason instanceof AbortException) { 40496 return; 40497 } 40498 if (this.options.ignoreErrors) { 40499 warn(`handleTilingType - ignoring pattern: "${reason}".`); 40500 return; 40501 } 40502 throw reason; 40503 }); 40504 } 40505 async handleSetFont(resources, fontArgs, fontRef, operatorList, task, state, fallbackFontDict = null, cssFontInfo = null) { 40506 const fontName = fontArgs?.[0] instanceof Name ? fontArgs[0].name : null; 40507 const translated = await this.loadFont(fontName, fontRef, resources, task, fallbackFontDict, cssFontInfo); 40508 if (translated.font.isType3Font) { 40509 operatorList.addDependencies(translated.type3Dependencies); 40510 } 40511 state.font = translated.font; 40512 translated.send(this.handler); 40513 return translated.loadedName; 40514 }
vendor: 8,782 bytes, lines 40515-40793
40515 handleText(chars, state) { 40516 const font = state.font; 40517 const glyphs = font.charsToGlyphs(chars); 40518 if (font.data) { 40519 const isAddToPathSet = !!(state.textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG); 40520 if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || state.strokeColorSpace.name === "Pattern" || font.disableFontFace) { 40521 PartialEvaluator.buildFontPaths(font, glyphs, this.handler, this.options); 40522 } 40523 } 40524 return glyphs; 40525 } 40526 ensureStateFont(state) { 40527 if (state.font) { 40528 return; 40529 } 40530 const reason = new FormatError("Missing setFont (Tf) operator before text rendering operator."); 40531 if (this.options.ignoreErrors) { 40532 warn(`ensureStateFont: "${reason}".`); 40533 return; 40534 } 40535 throw reason; 40536 } 40537 async setGState({ 40538 resources, 40539 gState, 40540 operatorList, 40541 cacheKey, 40542 task, 40543 stateManager, 40544 localGStateCache, 40545 localColorSpaceCache, 40546 seenRefs 40547 }) { 40548 const gStateRef = gState.objId; 40549 let isSimpleGState = true; 40550 const gStateObj = []; 40551 let promise = Promise.resolve(); 40552 for (const [key, value] of gState) { 40553 switch (key) { 40554 case "Type": 40555 break; 40556 case "LW": 40557 if (typeof value !== "number") { 40558 warn(`Invalid LW (line width): ${value}`); 40559 break; 40560 } 40561 gStateObj.push([key, Math.abs(value)]); 40562 break; 40563 case "LC": 40564 case "LJ": 40565 case "ML": 40566 case "D": 40567 case "RI": 40568 case "FL": 40569 case "CA": 40570 case "ca": 40571 gStateObj.push([key, value]); 40572 break; 40573 case "Font": 40574 isSimpleGState = false; 40575 promise = promise.then(() => this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) { 40576 operatorList.addDependency(loadedName); 40577 gStateObj.push([key, [loadedName, value[1]]]); 40578 })); 40579 break; 40580 case "BM": 40581 gStateObj.push([key, normalizeBlendMode(value)]); 40582 break; 40583 case "SMask": 40584 if (isName(value, "None")) { 40585 gStateObj.push([key, false]); 40586 break; 40587 } 40588 if (value instanceof Dict) { 40589 isSimpleGState = false; 40590 promise = promise.then(() => this.handleSMask(value, resources, operatorList, task, stateManager, localColorSpaceCache, seenRefs)); 40591 gStateObj.push([key, true]); 40592 } else { 40593 warn("Unsupported SMask type"); 40594 } 40595 break; 40596 case "TR": 40597 const transferMaps = this.handleTransferFunction(value); 40598 gStateObj.push([key, transferMaps]); 40599 break; 40600 case "OP": 40601 case "op": 40602 case "OPM": 40603 case "BG": 40604 case "BG2": 40605 case "UCR": 40606 case "UCR2": 40607 case "TR2": 40608 case "HT": 40609 case "SM": 40610 case "SA": 40611 case "AIS": 40612 case "TK": 40613 info("graphic state operator " + key); 40614 break; 40615 default: 40616 info("Unknown graphic state operator " + key); 40617 break; 40618 } 40619 } 40620 await promise; 40621 if (gStateObj.length > 0) { 40622 operatorList.addOp(OPS.setGState, [gStateObj]); 40623 } 40624 if (isSimpleGState) { 40625 localGStateCache.set(cacheKey, gStateRef, gStateObj); 40626 } 40627 } 40628 loadFont(fontName, font, resources, task, fallbackFontDict = null, cssFontInfo = null) { 40629 const errorFont = async () => new TranslatedFont({ 40630 loadedName: "g_font_error", 40631 font: new ErrorFont(`Font "${fontName}" is not available.`), 40632 dict: font 40633 }); 40634 let fontRef; 40635 if (font) { 40636 if (font instanceof Ref) { 40637 fontRef = font; 40638 } 40639 } else { 40640 const fontRes = resources.get("Font"); 40641 if (fontRes) { 40642 fontRef = fontRes.getRaw(fontName); 40643 } 40644 } 40645 if (fontRef) { 40646 if (this.type3FontRefs?.has(fontRef)) { 40647 return errorFont(); 40648 } 40649 if (this.fontCache.has(fontRef)) { 40650 return this.fontCache.get(fontRef); 40651 } 40652 try { 40653 font = this.xref.fetchIfRef(fontRef); 40654 } catch (ex) { 40655 warn(`loadFont - lookup failed: "${ex}".`); 40656 } 40657 } 40658 if (!(font instanceof Dict)) { 40659 if (!this.options.ignoreErrors && !this.parsingType3Font) { 40660 warn(`Font "${fontName}" is not available.`); 40661 return errorFont(); 40662 } 40663 warn(`Font "${fontName}" is not available -- attempting to fallback to a default font.`); 40664 font = fallbackFontDict || PartialEvaluator.fallbackFontDict; 40665 } 40666 if (font.cacheKey && this.fontCache.has(font.cacheKey)) { 40667 return this.fontCache.get(font.cacheKey); 40668 } 40669 const { 40670 promise, 40671 resolve 40672 } = Promise.withResolvers(); 40673 let preEvaluatedFont; 40674 try { 40675 preEvaluatedFont = this.preEvaluateFont(font); 40676 preEvaluatedFont.cssFontInfo = cssFontInfo; 40677 } catch (reason) { 40678 warn(`loadFont - preEvaluateFont failed: "${reason}".`); 40679 return errorFont(); 40680 } 40681 const { 40682 descriptor, 40683 hash 40684 } = preEvaluatedFont; 40685 const fontRefIsRef = fontRef instanceof Ref; 40686 let fontID; 40687 if (hash && descriptor instanceof Dict) { 40688 const fontAliases = descriptor.fontAliases ||= Object.create(null); 40689 if (fontAliases[hash]) { 40690 const aliasFontRef = fontAliases[hash].aliasRef; 40691 if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) { 40692 this.fontCache.putAlias(fontRef, aliasFontRef); 40693 return this.fontCache.get(fontRef); 40694 } 40695 } else { 40696 fontAliases[hash] = { 40697 fontID: this.idFactory.createFontId() 40698 }; 40699 } 40700 if (fontRefIsRef) { 40701 fontAliases[hash].aliasRef = fontRef; 40702 } 40703 fontID = fontAliases[hash].fontID; 40704 } else { 40705 fontID = this.idFactory.createFontId(); 40706 } 40707 assert(fontID?.startsWith("f"), 'The "fontID" must be (correctly) defined.'); 40708 if (fontRefIsRef) { 40709 this.fontCache.put(fontRef, promise); 40710 } else { 40711 font.cacheKey = `cacheKey_${fontID}`; 40712 this.fontCache.put(font.cacheKey, promise); 40713 } 40714 font.loadedName = `${this.idFactory.getDocId()}_${fontID}`; 40715 this.translateFont(preEvaluatedFont).then(async translatedFont => { 40716 const translated = new TranslatedFont({ 40717 loadedName: font.loadedName, 40718 font: translatedFont, 40719 dict: font 40720 }); 40721 if (translatedFont.isType3Font) { 40722 try { 40723 await translated.loadType3Data(this, resources, task); 40724 } catch (reason) { 40725 throw new Error(`Type3 font load error: ${reason}`); 40726 } 40727 } 40728 resolve(translated); 40729 }).catch(reason => { 40730 warn(`loadFont - translateFont failed: "${reason}".`); 40731 resolve(new TranslatedFont({ 40732 loadedName: font.loadedName, 40733 font: new ErrorFont(reason?.message), 40734 dict: font 40735 })); 40736 }); 40737 return promise; 40738 } 40739 buildPath(fn, args, state) { 40740 const { 40741 pathMinMax: minMax, 40742 pathBuffer 40743 } = state; 40744 switch (fn | 0) { 40745 case OPS.rectangle: 40746 { 40747 const x = state.currentPointX = args[0]; 40748 const y = state.currentPointY = args[1]; 40749 const width = args[2]; 40750 const height = args[3]; 40751 const xw = x + width; 40752 const yh = y + height; 40753 if (width === 0 || height === 0) { 40754 pathBuffer.push(DrawOPS.moveTo, x, y, DrawOPS.lineTo, xw, yh, DrawOPS.closePath); 40755 } else { 40756 pathBuffer.push(DrawOPS.moveTo, x, y, DrawOPS.lineTo, xw, y, DrawOPS.lineTo, xw, yh, DrawOPS.lineTo, x, yh, DrawOPS.closePath); 40757 } 40758 Util.rectBoundingBox(x, y, xw, yh, minMax); 40759 break; 40760 } 40761 case OPS.moveTo: 40762 { 40763 const x = state.currentPointX = args[0]; 40764 const y = state.currentPointY = args[1]; 40765 pathBuffer.push(DrawOPS.moveTo, x, y); 40766 Util.pointBoundingBox(x, y, minMax); 40767 break; 40768 } 40769 case OPS.lineTo: 40770 { 40771 const x = state.currentPointX = args[0]; 40772 const y = state.currentPointY = args[1]; 40773 pathBuffer.push(DrawOPS.lineTo, x, y); 40774 Util.pointBoundingBox(x, y, minMax); 40775 break; 40776 } 40777 case OPS.curveTo: 40778 { 40779 const startX = state.currentPointX; 40780 const startY = state.currentPointY; 40781 const [x1, y1, x2, y2, x, y] = args; 40782 state.currentPointX = x; 40783 state.currentPointY = y; 40784 pathBuffer.push(DrawOPS.curveTo, x1, y1, x2, y2, x, y); 40785 Util.bezierBoundingBox(startX, startY, x1, y1, x2, y2, x, y, minMax); 40786 break; 40787 } 40788 case OPS.curveTo2: 40789 { 40790 const startX = state.currentPointX; 40791 const startY = state.currentPointY; 40792 const [x1, y1, x, y] = args; 40793 state.currentPointX = x;
vendor: 7,673 bytes, lines 40794-41018
40794 state.currentPointY = y; 40795 pathBuffer.push(DrawOPS.curveTo, startX, startY, x1, y1, x, y); 40796 Util.bezierBoundingBox(startX, startY, startX, startY, x1, y1, x, y, minMax); 40797 break; 40798 } 40799 case OPS.curveTo3: 40800 { 40801 const startX = state.currentPointX; 40802 const startY = state.currentPointY; 40803 const [x1, y1, x, y] = args; 40804 state.currentPointX = x; 40805 state.currentPointY = y; 40806 pathBuffer.push(DrawOPS.curveTo, x1, y1, x, y, x, y); 40807 Util.bezierBoundingBox(startX, startY, x1, y1, x, y, x, y, minMax); 40808 break; 40809 } 40810 case OPS.closePath: 40811 pathBuffer.push(DrawOPS.closePath); 40812 break; 40813 } 40814 } 40815 _getColorSpace(cs, resources, localColorSpaceCache) { 40816 return ColorSpaceUtils.parse({ 40817 cs, 40818 xref: this.xref, 40819 resources, 40820 pdfFunctionFactory: this._pdfFunctionFactory, 40821 globalColorSpaceCache: this.globalColorSpaceCache, 40822 localColorSpaceCache, 40823 asyncIfNotCached: true 40824 }); 40825 } 40826 async _handleColorSpace(csPromise) { 40827 try { 40828 return await csPromise; 40829 } catch (ex) { 40830 if (ex instanceof AbortException) { 40831 return null; 40832 } 40833 if (this.options.ignoreErrors) { 40834 warn(`_handleColorSpace - ignoring ColorSpace: "${ex}".`); 40835 return null; 40836 } 40837 throw ex; 40838 } 40839 } 40840 parseShading({ 40841 shading, 40842 resources, 40843 localColorSpaceCache, 40844 localShadingPatternCache 40845 }) { 40846 let id = localShadingPatternCache.get(shading); 40847 if (id) { 40848 return id; 40849 } 40850 let patternIR; 40851 try { 40852 const shadingFill = Pattern.parseShading(shading, this.xref, resources, this._pdfFunctionFactory, this.globalColorSpaceCache, localColorSpaceCache); 40853 patternIR = shadingFill.getIR(); 40854 } catch (reason) { 40855 if (reason instanceof AbortException) { 40856 return null; 40857 } 40858 if (this.options.ignoreErrors) { 40859 warn(`parseShading - ignoring shading: "${reason}".`); 40860 localShadingPatternCache.set(shading, null); 40861 return null; 40862 } 40863 throw reason; 40864 } 40865 id = `pattern_${this.idFactory.createObjId()}`; 40866 if (this.parsingType3Font) { 40867 id = `${this.idFactory.getDocId()}_type3_${id}`; 40868 } 40869 localShadingPatternCache.set(shading, id); 40870 if (this.parsingType3Font) { 40871 const buffer = compilePatternInfo(patternIR); 40872 this.handler.send("commonobj", [id, "Pattern", buffer], [buffer]); 40873 } else { 40874 this.handler.send("obj", [id, this.pageIndex, "Pattern", patternIR]); 40875 } 40876 return id; 40877 } 40878 handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache) { 40879 const patternName = args.pop(); 40880 if (patternName instanceof Name) { 40881 const rawPattern = patterns.getRaw(patternName.name); 40882 const localTilingPattern = rawPattern instanceof Ref && localTilingPatternCache.getByRef(rawPattern); 40883 if (localTilingPattern) { 40884 try { 40885 const color = cs.base ? cs.base.getRgbHex(args, 0) : null; 40886 const tilingPatternIR = getTilingPatternIR(localTilingPattern.operatorListIR, localTilingPattern.dict, color, localTilingPattern.needsIsolation); 40887 operatorList.addOp(fn, tilingPatternIR); 40888 return undefined; 40889 } catch {} 40890 } 40891 const pattern = this.xref.fetchIfRef(rawPattern); 40892 if (pattern) { 40893 const dict = pattern instanceof BaseStream ? pattern.dict : pattern; 40894 const typeNum = dict.get("PatternType"); 40895 if (typeNum === PatternType.TILING) { 40896 const color = cs.base ? cs.base.getRgbHex(args, 0) : null; 40897 return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, localTilingPatternCache); 40898 } else if (typeNum === PatternType.SHADING) { 40899 const shading = dict.get("Shading"); 40900 const objId = this.parseShading({ 40901 shading, 40902 resources, 40903 localColorSpaceCache, 40904 localShadingPatternCache 40905 }); 40906 if (objId) { 40907 const matrix = lookupMatrix(dict.getArray("Matrix"), null); 40908 operatorList.addOp(fn, ["Shading", objId, matrix]); 40909 } 40910 return undefined; 40911 } 40912 throw new FormatError(`Unknown PatternType: ${typeNum}`); 40913 } 40914 } 40915 throw new FormatError(`Unknown PatternName: ${patternName}`); 40916 } 40917 _parseVisibilityExpression(array, nestingCounter, currentResult) { 40918 const MAX_NESTING = 10; 40919 if (++nestingCounter > MAX_NESTING) { 40920 warn("Visibility expression is too deeply nested"); 40921 return; 40922 } 40923 const length = array.length; 40924 const operator = this.xref.fetchIfRef(array[0]); 40925 if (length < 2 || !(operator instanceof Name)) { 40926 warn("Invalid visibility expression"); 40927 return; 40928 } 40929 switch (operator.name) { 40930 case "And": 40931 case "Or": 40932 case "Not": 40933 currentResult.push(operator.name); 40934 break; 40935 default: 40936 warn(`Invalid operator ${operator.name} in visibility expression`); 40937 return; 40938 } 40939 for (let i = 1; i < length; i++) { 40940 const raw = array[i]; 40941 const object = this.xref.fetchIfRef(raw); 40942 if (Array.isArray(object)) { 40943 const nestedResult = []; 40944 currentResult.push(nestedResult); 40945 this._parseVisibilityExpression(object, nestingCounter, nestedResult); 40946 } else if (raw instanceof Ref) { 40947 currentResult.push(raw.toString()); 40948 } 40949 } 40950 } 40951 async parseMarkedContentProps(contentProperties, resources) { 40952 let optionalContent; 40953 if (contentProperties instanceof Name) { 40954 const properties = resources.get("Properties"); 40955 optionalContent = properties.get(contentProperties.name); 40956 } else if (contentProperties instanceof Dict) { 40957 optionalContent = contentProperties; 40958 } else { 40959 throw new FormatError("Optional content properties malformed."); 40960 } 40961 const optionalContentType = optionalContent.get("Type")?.name; 40962 if (optionalContentType === "OCG") { 40963 return { 40964 type: optionalContentType, 40965 id: optionalContent.objId 40966 }; 40967 } else if (optionalContentType === "OCMD") { 40968 const expression = optionalContent.get("VE"); 40969 if (Array.isArray(expression)) { 40970 const result = []; 40971 this._parseVisibilityExpression(expression, 0, result); 40972 if (result.length > 0) { 40973 return { 40974 type: "OCMD", 40975 expression: result 40976 }; 40977 } 40978 } 40979 const optionalContentGroups = optionalContent.get("OCGs"); 40980 if (Array.isArray(optionalContentGroups) || optionalContentGroups instanceof Dict) { 40981 const groupIds = []; 40982 if (Array.isArray(optionalContentGroups)) { 40983 for (const ocg of optionalContentGroups) { 40984 groupIds.push(ocg.toString()); 40985 } 40986 } else { 40987 groupIds.push(optionalContentGroups.objId); 40988 } 40989 return { 40990 type: optionalContentType, 40991 ids: groupIds, 40992 policy: optionalContent.get("P") instanceof Name ? optionalContent.get("P").name : null, 40993 expression: null 40994 }; 40995 } else if (optionalContentGroups instanceof Ref) { 40996 return { 40997 type: optionalContentType, 40998 id: optionalContentGroups.toString() 40999 }; 41000 } 41001 } 41002 return null; 41003 } 41004 async getOperatorList({ 41005 stream, 41006 task, 41007 resources, 41008 operatorList, 41009 initialState = null, 41010 fallbackFontDict = null, 41011 prevRefs = null 41012 }) { 41013 if (stream.isAsync) { 41014 const bytes = await stream.asyncGetBytes(); 41015 if (bytes) { 41016 stream = new Stream(bytes, 0, bytes.length, stream.dict); 41017 } 41018 }
vendor: 16,897 bytes, lines 41018-41453
41018 41019 const objId = stream.dict?.objId; 41020 const seenRefs = new RefSet(prevRefs); 41021 if (objId) { 41022 if (prevRefs?.has(objId)) { 41023 throw new Error(`getOperatorList - ignoring circular reference: ${objId}`); 41024 } 41025 seenRefs.put(objId); 41026 } 41027 resources ||= Dict.empty; 41028 initialState ||= new EvalState(); 41029 if (!operatorList) { 41030 throw new Error('getOperatorList: missing "operatorList" parameter'); 41031 } 41032 const self = this; 41033 const xref = this.xref; 41034 const localImageCache = new LocalImageCache(); 41035 const localColorSpaceCache = new LocalColorSpaceCache(); 41036 const localGStateCache = new LocalGStateCache(); 41037 const localTilingPatternCache = new LocalTilingPatternCache(); 41038 const localShadingPatternCache = new Map(); 41039 const xobjs = resources.get("XObject") || Dict.empty; 41040 const patterns = resources.get("Pattern") || Dict.empty; 41041 const stateManager = new StateManager(initialState); 41042 const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager); 41043 const timeSlotManager = new TimeSlotManager(); 41044 function closePendingRestoreOPS(argument) { 41045 for (let i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) { 41046 operatorList.addOp(OPS.restore, []); 41047 } 41048 } 41049 return new Promise(function promiseBody(resolve, reject) { 41050 const next = function (promise) { 41051 Promise.all([promise, operatorList.ready]).then(function () { 41052 try { 41053 promiseBody(resolve, reject); 41054 } catch (ex) { 41055 reject(ex); 41056 } 41057 }, reject); 41058 }; 41059 task.ensureNotTerminated(); 41060 timeSlotManager.reset(); 41061 const operation = {}; 41062 let stop, i, ii, cs, name, isValidName; 41063 while (!(stop = timeSlotManager.check())) { 41064 operation.args = null; 41065 if (!preprocessor.read(operation)) { 41066 break; 41067 } 41068 let args = operation.args; 41069 let fn = operation.fn; 41070 switch (fn | 0) { 41071 case OPS.paintXObject: 41072 isValidName = args[0] instanceof Name; 41073 name = args[0].name; 41074 if (isValidName) { 41075 const localImage = localImageCache.getByName(name); 41076 if (localImage) { 41077 addCachedImageOps(operatorList, localImage); 41078 args = null; 41079 continue; 41080 } 41081 } 41082 next(new Promise(function (resolveXObject, rejectXObject) { 41083 if (!isValidName) { 41084 throw new FormatError("XObject must be referred to by name."); 41085 } 41086 let xobj = xobjs.getRaw(name); 41087 if (xobj instanceof Ref) { 41088 const cachedImage = localImageCache.getByRef(xobj) || self._regionalImageCache.getByRef(xobj) || self.globalImageCache.getData(xobj, self.pageIndex); 41089 if (cachedImage) { 41090 addCachedImageOps(operatorList, cachedImage); 41091 resolveXObject(); 41092 return; 41093 } 41094 xobj = xref.fetch(xobj); 41095 } 41096 if (!(xobj instanceof BaseStream)) { 41097 throw new FormatError("XObject should be a stream"); 41098 } 41099 const type = xobj.dict.get("Subtype"); 41100 if (!(type instanceof Name)) { 41101 throw new FormatError("XObject should have a Name subtype"); 41102 } 41103 if (type.name === "Form") { 41104 stateManager.save(); 41105 self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone({ 41106 newPath: true 41107 }), localColorSpaceCache, seenRefs).then(function () { 41108 stateManager.restore(); 41109 resolveXObject(); 41110 }, rejectXObject); 41111 return; 41112 } else if (type.name === "Image") { 41113 self.buildPaintImageXObject({ 41114 resources, 41115 image: xobj, 41116 operatorList, 41117 cacheKey: name, 41118 localImageCache, 41119 localColorSpaceCache 41120 }).then(resolveXObject, rejectXObject); 41121 return; 41122 } else if (type.name === "PS") { 41123 info("Ignored XObject subtype PS"); 41124 } else { 41125 throw new FormatError(`Unhandled XObject subtype ${type.name}`); 41126 } 41127 resolveXObject(); 41128 }).catch(function (reason) { 41129 if (reason instanceof AbortException) { 41130 return; 41131 } 41132 if (self.options.ignoreErrors) { 41133 warn(`getOperatorList - ignoring XObject: "${reason}".`); 41134 return; 41135 } 41136 throw reason; 41137 })); 41138 return; 41139 case OPS.setFont: 41140 const fontSize = args[1]; 41141 next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state, fallbackFontDict).then(function (loadedName) { 41142 operatorList.addDependency(loadedName); 41143 operatorList.addOp(OPS.setFont, [loadedName, fontSize]); 41144 })); 41145 return; 41146 case OPS.endInlineImage: 41147 const cacheKey = args[0].cacheKey; 41148 if (cacheKey) { 41149 const localImage = localImageCache.getByName(cacheKey); 41150 if (localImage) { 41151 addCachedImageOps(operatorList, localImage); 41152 args = null; 41153 continue; 41154 } 41155 } 41156 next(self.buildPaintImageXObject({ 41157 resources, 41158 image: args[0], 41159 isInline: true, 41160 operatorList, 41161 cacheKey, 41162 localImageCache, 41163 localColorSpaceCache 41164 })); 41165 return; 41166 case OPS.showText: 41167 if (!stateManager.state.font) { 41168 self.ensureStateFont(stateManager.state); 41169 continue; 41170 } 41171 args[0] = self.handleText(args[0], stateManager.state); 41172 break; 41173 case OPS.showSpacedText: 41174 if (!stateManager.state.font) { 41175 self.ensureStateFont(stateManager.state); 41176 continue; 41177 } 41178 const combinedGlyphs = [], 41179 state = stateManager.state; 41180 for (const arrItem of args[0]) { 41181 if (typeof arrItem === "string") { 41182 combinedGlyphs.push(...self.handleText(arrItem, state)); 41183 } else if (typeof arrItem === "number") { 41184 combinedGlyphs.push(arrItem); 41185 } 41186 } 41187 args[0] = combinedGlyphs; 41188 fn = OPS.showText; 41189 break; 41190 case OPS.nextLineShowText: 41191 if (!stateManager.state.font) { 41192 self.ensureStateFont(stateManager.state); 41193 continue; 41194 } 41195 operatorList.addOp(OPS.nextLine); 41196 args[0] = self.handleText(args[0], stateManager.state); 41197 fn = OPS.showText; 41198 break; 41199 case OPS.nextLineSetSpacingShowText: 41200 if (!stateManager.state.font) { 41201 self.ensureStateFont(stateManager.state); 41202 continue; 41203 } 41204 operatorList.addOp(OPS.nextLine); 41205 operatorList.addOp(OPS.setWordSpacing, [args.shift()]); 41206 operatorList.addOp(OPS.setCharSpacing, [args.shift()]); 41207 args[0] = self.handleText(args[0], stateManager.state); 41208 fn = OPS.showText; 41209 break; 41210 case OPS.setTextRenderingMode: 41211 stateManager.state.textRenderingMode = args[0]; 41212 break; 41213 case OPS.setFillColorSpace: 41214 { 41215 const fillCS = self._getColorSpace(args[0], resources, localColorSpaceCache); 41216 if (fillCS instanceof ColorSpace) { 41217 stateManager.state.fillColorSpace = fillCS; 41218 continue; 41219 } 41220 next(self._handleColorSpace(fillCS).then(colorSpace => { 41221 stateManager.state.fillColorSpace = colorSpace || ColorSpaceUtils.gray; 41222 })); 41223 return; 41224 } 41225 case OPS.setStrokeColorSpace: 41226 { 41227 const strokeCS = self._getColorSpace(args[0], resources, localColorSpaceCache); 41228 if (strokeCS instanceof ColorSpace) { 41229 stateManager.state.strokeColorSpace = strokeCS; 41230 continue; 41231 } 41232 next(self._handleColorSpace(strokeCS).then(colorSpace => { 41233 stateManager.state.strokeColorSpace = colorSpace || ColorSpaceUtils.gray; 41234 })); 41235 return; 41236 } 41237 case OPS.setFillColor: 41238 cs = stateManager.state.fillColorSpace; 41239 args = [cs.getRgbHex(args, 0)]; 41240 fn = OPS.setFillRGBColor; 41241 break; 41242 case OPS.setStrokeColor: 41243 cs = stateManager.state.strokeColorSpace; 41244 args = [cs.getRgbHex(args, 0)]; 41245 fn = OPS.setStrokeRGBColor; 41246 break; 41247 case OPS.setFillGray: 41248 stateManager.state.fillColorSpace = ColorSpaceUtils.gray; 41249 args = [ColorSpaceUtils.gray.getRgbHex(args, 0)]; 41250 fn = OPS.setFillRGBColor; 41251 break; 41252 case OPS.setStrokeGray: 41253 stateManager.state.strokeColorSpace = ColorSpaceUtils.gray; 41254 args = [ColorSpaceUtils.gray.getRgbHex(args, 0)]; 41255 fn = OPS.setStrokeRGBColor; 41256 break; 41257 case OPS.setFillCMYKColor: 41258 stateManager.state.fillColorSpace = ColorSpaceUtils.cmyk; 41259 args = [ColorSpaceUtils.cmyk.getRgbHex(args, 0)]; 41260 fn = OPS.setFillRGBColor; 41261 break; 41262 case OPS.setStrokeCMYKColor: 41263 stateManager.state.strokeColorSpace = ColorSpaceUtils.cmyk; 41264 args = [ColorSpaceUtils.cmyk.getRgbHex(args, 0)]; 41265 fn = OPS.setStrokeRGBColor; 41266 break; 41267 case OPS.setFillRGBColor: 41268 stateManager.state.fillColorSpace = ColorSpaceUtils.rgb; 41269 args = [ColorSpaceUtils.rgb.getRgbHex(args, 0)]; 41270 break; 41271 case OPS.setStrokeRGBColor: 41272 stateManager.state.strokeColorSpace = ColorSpaceUtils.rgb; 41273 args = [ColorSpaceUtils.rgb.getRgbHex(args, 0)]; 41274 break; 41275 case OPS.setFillColorN: 41276 cs = stateManager.state.patternFillColorSpace; 41277 if (!cs) { 41278 if (isNumberArray(args, null)) { 41279 args = [ColorSpaceUtils.gray.getRgbHex(args, 0)]; 41280 fn = OPS.setFillRGBColor; 41281 break; 41282 } 41283 args = []; 41284 fn = OPS.setFillTransparent; 41285 break; 41286 } 41287 if (cs.name === "Pattern") { 41288 next(self.handleColorN(operatorList, OPS.setFillColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache)); 41289 return; 41290 } 41291 args = [cs.getRgbHex(args, 0)]; 41292 fn = OPS.setFillRGBColor; 41293 break; 41294 case OPS.setStrokeColorN: 41295 cs = stateManager.state.patternStrokeColorSpace; 41296 if (!cs) { 41297 if (isNumberArray(args, null)) { 41298 args = [ColorSpaceUtils.gray.getRgbHex(args, 0)]; 41299 fn = OPS.setStrokeRGBColor; 41300 break; 41301 } 41302 args = []; 41303 fn = OPS.setStrokeTransparent; 41304 break; 41305 } 41306 if (cs.name === "Pattern") { 41307 next(self.handleColorN(operatorList, OPS.setStrokeColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache)); 41308 return; 41309 } 41310 args = [cs.getRgbHex(args, 0)]; 41311 fn = OPS.setStrokeRGBColor; 41312 break; 41313 case OPS.shadingFill: 41314 let shading; 41315 try { 41316 const shadingRes = resources.get("Shading"); 41317 if (!shadingRes) { 41318 throw new FormatError("No shading resource found"); 41319 } 41320 shading = shadingRes.get(args[0].name); 41321 if (!shading) { 41322 throw new FormatError("No shading object found"); 41323 } 41324 } catch (reason) { 41325 if (reason instanceof AbortException) { 41326 continue; 41327 } 41328 if (self.options.ignoreErrors) { 41329 warn(`getOperatorList - ignoring Shading: "${reason}".`); 41330 continue; 41331 } 41332 throw reason; 41333 } 41334 const patternId = self.parseShading({ 41335 shading, 41336 resources, 41337 localColorSpaceCache, 41338 localShadingPatternCache 41339 }); 41340 if (!patternId) { 41341 continue; 41342 } 41343 args = [patternId]; 41344 fn = OPS.shadingFill; 41345 break; 41346 case OPS.setGState: 41347 isValidName = args[0] instanceof Name; 41348 name = args[0].name; 41349 if (isValidName) { 41350 const localGStateObj = localGStateCache.getByName(name); 41351 if (localGStateObj) { 41352 if (localGStateObj.length > 0) { 41353 operatorList.addOp(OPS.setGState, [localGStateObj]); 41354 } 41355 args = null; 41356 continue; 41357 } 41358 } 41359 next(new Promise(function (resolveGState, rejectGState) { 41360 if (!isValidName) { 41361 throw new FormatError("GState must be referred to by name."); 41362 } 41363 const extGState = resources.get("ExtGState"); 41364 if (!(extGState instanceof Dict)) { 41365 throw new FormatError("ExtGState should be a dictionary."); 41366 } 41367 const gState = extGState.get(name); 41368 if (!(gState instanceof Dict)) { 41369 throw new FormatError("GState should be a dictionary."); 41370 } 41371 self.setGState({ 41372 resources, 41373 gState, 41374 operatorList, 41375 cacheKey: name, 41376 task, 41377 stateManager, 41378 localGStateCache, 41379 localColorSpaceCache, 41380 seenRefs 41381 }).then(resolveGState, rejectGState); 41382 }).catch(function (reason) { 41383 if (reason instanceof AbortException) { 41384 return; 41385 } 41386 if (self.options.ignoreErrors) { 41387 warn(`getOperatorList - ignoring ExtGState: "${reason}".`); 41388 return; 41389 } 41390 throw reason; 41391 })); 41392 return; 41393 case OPS.setLineWidth: 41394 { 41395 const [thickness] = args; 41396 if (typeof thickness !== "number") { 41397 warn(`Invalid setLineWidth: ${thickness}`); 41398 continue; 41399 } 41400 args[0] = Math.abs(thickness); 41401 break; 41402 } 41403 case OPS.setDash: 41404 { 41405 const dashPhase = args[1]; 41406 if (typeof dashPhase !== "number") { 41407 warn(`Invalid setDash: ${dashPhase}`); 41408 continue; 41409 } 41410 const dashArray = args[0]; 41411 if (!Array.isArray(dashArray)) { 41412 warn(`Invalid setDash: ${dashArray}`); 41413 continue; 41414 } 41415 if (dashArray.some(x => typeof x !== "number")) { 41416 args[0] = dashArray.filter(x => typeof x === "number"); 41417 } 41418 break; 41419 } 41420 case OPS.moveTo: 41421 case OPS.lineTo: 41422 case OPS.curveTo: 41423 case OPS.curveTo2: 41424 case OPS.curveTo3: 41425 case OPS.closePath: 41426 case OPS.rectangle: 41427 self.buildPath(fn, args, stateManager.state); 41428 continue; 41429 case OPS.stroke: 41430 case OPS.closeStroke: 41431 case OPS.fill: 41432 case OPS.eoFill: 41433 case OPS.fillStroke: 41434 case OPS.eoFillStroke: 41435 case OPS.closeFillStroke: 41436 case OPS.closeEOFillStroke: 41437 case OPS.endPath: 41438 { 41439 const { 41440 state: { 41441 pathBuffer, 41442 pathMinMax 41443 } 41444 } = stateManager; 41445 if (fn === OPS.closeStroke || fn === OPS.closeFillStroke || fn === OPS.closeEOFillStroke) { 41446 pathBuffer.push(DrawOPS.closePath); 41447 } 41448 if (pathBuffer.length === 0) { 41449 operatorList.addOp(OPS.constructPath, [fn, [null], null]); 41450 } else { 41451 operatorList.addOp(OPS.constructPath, [fn, [new Float32Array(pathBuffer)], pathMinMax.slice()]); 41452 pathBuffer.length = 0; 41453 pathMinMax.set(
vendor: 1,311 bytes, lines 41453-41486
41453BBOX_INIT, 0); 41454 } 41455 continue; 41456 } 41457 case OPS.setTextMatrix: 41458 operatorList.addOp(fn, [new Float32Array(args)]); 41459 continue; 41460 case OPS.markPoint: 41461 case OPS.markPointProps: 41462 case OPS.beginCompat: 41463 case OPS.endCompat: 41464 continue; 41465 case OPS.beginMarkedContentProps: 41466 if (!(args[0] instanceof Name)) { 41467 warn(`Expected name for beginMarkedContentProps arg0=${args[0]}`); 41468 operatorList.addOp(OPS.beginMarkedContentProps, ["OC", null]); 41469 continue; 41470 } 41471 if (args[0].name === "OC") { 41472 next(self.parseMarkedContentProps(args[1], resources).then(data => { 41473 operatorList.addOp(OPS.beginMarkedContentProps, ["OC", data]); 41474 }).catch(reason => { 41475 if (reason instanceof AbortException) { 41476 return; 41477 } 41478 if (self.options.ignoreErrors) { 41479 warn(`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`); 41480 operatorList.addOp(OPS.beginMarkedContentProps, ["OC", null]); 41481 return; 41482 } 41483 throw reason; 41484 })); 41485 return; 41486 }
vendor: 1,987 bytes, lines 41487-41560
41487 args = [args[0].name, args[1] instanceof Dict ? args[1].get("MCID") : null]; 41488 break; 41489 case OPS.beginMarkedContent: 41490 case OPS.endMarkedContent: 41491 default: 41492 if (args !== null) { 41493 for (i = 0, ii = args.length; i < ii; i++) { 41494 if (args[i] instanceof Dict) { 41495 break; 41496 } 41497 } 41498 if (i < ii) { 41499 warn("getOperatorList - ignoring operator: " + fn); 41500 continue; 41501 } 41502 } 41503 } 41504 operatorList.addOp(fn, args); 41505 } 41506 if (stop) { 41507 next(deferred); 41508 return; 41509 } 41510 closePendingRestoreOPS(); 41511 resolve(); 41512 }).catch(reason => { 41513 if (reason instanceof AbortException) { 41514 return; 41515 } 41516 if (this.options.ignoreErrors) { 41517 warn(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`); 41518 closePendingRestoreOPS(); 41519 return; 41520 } 41521 throw reason; 41522 }); 41523 } 41524 async getTextContent({ 41525 stream, 41526 task, 41527 resources, 41528 stateManager = null, 41529 includeMarkedContent = false, 41530 sink, 41531 seenStyles = new Set(), 41532 viewBox, 41533 lang = null, 41534 markedContentData = null, 41535 disableNormalization = false, 41536 keepWhiteSpace = false, 41537 prevRefs = null, 41538 intersector = null 41539 }) { 41540 if (stream.isAsync) { 41541 const bytes = await stream.asyncGetBytes(); 41542 if (bytes) { 41543 stream = new Stream(bytes, 0, bytes.length, stream.dict); 41544 } 41545 } 41546 const objId = stream.dict?.objId; 41547 const seenRefs = new RefSet(prevRefs); 41548 if (objId) { 41549 if (prevRefs?.has(objId)) { 41550 throw new Error(`getTextContent - ignoring circular reference: ${objId}`); 41551 } 41552 seenRefs.put(objId); 41553 } 41554 resources ||= Dict.empty; 41555 stateManager ||= new StateManager(new TextState()); 41556 if (includeMarkedContent) { 41557 markedContentData ||= { 41558 level: 0 41559 }; 41560 }
vendor: 17,316 bytes, lines 41560-42026
41560 41561 const textContent = { 41562 items: [], 41563 styles: Object.create(null), 41564 lang 41565 }; 41566 const textContentItem = { 41567 initialized: false, 41568 str: [], 41569 totalWidth: 0, 41570 totalHeight: 0, 41571 width: 0, 41572 height: 0, 41573 vertical: false, 41574 prevTransform: null, 41575 prevTextRise: 0, 41576 textAdvanceScale: 0, 41577 spaceInFlowMin: 0, 41578 spaceInFlowMax: 0, 41579 trackingSpaceMin: Infinity, 41580 negativeSpaceMax: -Infinity, 41581 notASpace: -Infinity, 41582 transform: null, 41583 fontName: null, 41584 hasEOL: false 41585 }; 41586 const twoLastChars = [" ", " "]; 41587 let twoLastCharsPos = 0; 41588 function saveLastChar(char) { 41589 const nextPos = (twoLastCharsPos + 1) % 2; 41590 const ret = twoLastChars[twoLastCharsPos] !== " " && twoLastChars[nextPos] === " "; 41591 twoLastChars[twoLastCharsPos] = char; 41592 twoLastCharsPos = nextPos; 41593 return !keepWhiteSpace && ret; 41594 } 41595 function shouldAddWhitepsace() { 41596 return !keepWhiteSpace && twoLastChars[twoLastCharsPos] !== " " && twoLastChars[(twoLastCharsPos + 1) % 2] === " "; 41597 } 41598 function resetLastChars() { 41599 twoLastChars[0] = twoLastChars[1] = " "; 41600 twoLastCharsPos = 0; 41601 } 41602 const TRACKING_SPACE_FACTOR = 0.102; 41603 const NOT_A_SPACE_FACTOR = 0.03; 41604 const NEGATIVE_SPACE_FACTOR = -0.2; 41605 const SPACE_IN_FLOW_MIN_FACTOR = 0.102; 41606 const SPACE_IN_FLOW_MAX_FACTOR = 0.6; 41607 const VERTICAL_SHIFT_RATIO = 0.25; 41608 const self = this; 41609 const xref = this.xref; 41610 const showSpacedTextBuffer = []; 41611 let xobjs = null; 41612 const emptyXObjectCache = new LocalImageCache(); 41613 const emptyGStateCache = new LocalGStateCache(); 41614 const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager); 41615 let textState, currentTextState; 41616 function pushWhitespace({ 41617 width = 0, 41618 height = 0, 41619 transform = textContentItem.prevTransform, 41620 fontName = textContentItem.fontName 41621 }) { 41622 intersector?.addExtraChar(" "); 41623 textContent.items.push({ 41624 str: " ", 41625 dir: "ltr", 41626 width, 41627 height, 41628 transform, 41629 fontName, 41630 hasEOL: false 41631 }); 41632 } 41633 function getCurrentTextTransform() { 41634 const font = textState.font; 41635 const tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise]; 41636 if (font.isType3Font && (textState.fontSize <= 1 || font.isCharBBox) && !isArrayEqual(textState.fontMatrix, FONT_IDENTITY_MATRIX)) { 41637 const glyphHeight = font.bbox[3] - font.bbox[1]; 41638 if (glyphHeight > 0) { 41639 tsm[3] *= glyphHeight * textState.fontMatrix[3]; 41640 } 41641 } 41642 return Util.transform(textState.ctm, Util.transform(textState.textMatrix, tsm)); 41643 } 41644 function ensureTextContentItem() { 41645 if (textContentItem.initialized) { 41646 return textContentItem; 41647 } 41648 const { 41649 font, 41650 loadedName 41651 } = textState; 41652 if (!seenStyles.has(loadedName)) { 41653 seenStyles.add(loadedName); 41654 textContent.styles[loadedName] = { 41655 fontFamily: font.fallbackName, 41656 ascent: font.ascent, 41657 descent: font.descent, 41658 vertical: font.vertical 41659 }; 41660 if (self.options.fontExtraProperties && font.systemFontInfo) { 41661 const style = textContent.styles[loadedName]; 41662 style.fontSubstitution = font.systemFontInfo.css; 41663 style.fontSubstitutionLoadedName = font.systemFontInfo.loadedName; 41664 } 41665 } 41666 textContentItem.fontName = loadedName; 41667 const trm = textContentItem.transform = getCurrentTextTransform(); 41668 if (!font.vertical) { 41669 textContentItem.width = textContentItem.totalWidth = 0; 41670 textContentItem.height = textContentItem.totalHeight = Math.hypot(trm[2], trm[3]); 41671 textContentItem.vertical = false; 41672 } else { 41673 textContentItem.width = textContentItem.totalWidth = Math.hypot(trm[0], trm[1]); 41674 textContentItem.height = textContentItem.totalHeight = 0; 41675 textContentItem.vertical = true; 41676 } 41677 const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]); 41678 const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]); 41679 textContentItem.textAdvanceScale = scaleCtmX * scaleLineX; 41680 const { 41681 fontSize 41682 } = textState; 41683 textContentItem.trackingSpaceMin = fontSize * TRACKING_SPACE_FACTOR; 41684 textContentItem.notASpace = fontSize * NOT_A_SPACE_FACTOR; 41685 textContentItem.negativeSpaceMax = fontSize * NEGATIVE_SPACE_FACTOR; 41686 textContentItem.spaceInFlowMin = fontSize * SPACE_IN_FLOW_MIN_FACTOR; 41687 textContentItem.spaceInFlowMax = fontSize * SPACE_IN_FLOW_MAX_FACTOR; 41688 textContentItem.hasEOL = false; 41689 textContentItem.initialized = true; 41690 return textContentItem; 41691 } 41692 function updateAdvanceScale() { 41693 if (!textContentItem.initialized) { 41694 return; 41695 } 41696 const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]); 41697 const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]); 41698 const scaleFactor = scaleCtmX * scaleLineX; 41699 if (scaleFactor === textContentItem.textAdvanceScale) { 41700 return; 41701 } 41702 if (!textContentItem.vertical) { 41703 textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale; 41704 textContentItem.width = 0; 41705 } else { 41706 textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale; 41707 textContentItem.height = 0; 41708 } 41709 textContentItem.textAdvanceScale = scaleFactor; 41710 } 41711 function runBidiTransform(textChunk) { 41712 let text = textChunk.str.join(""); 41713 if (!disableNormalization) { 41714 text = normalizeUnicode(text); 41715 } 41716 const bidiResult = bidi(text, -1, textChunk.vertical); 41717 return { 41718 str: bidiResult.str, 41719 dir: bidiResult.dir, 41720 width: Math.abs(textChunk.totalWidth), 41721 height: Math.abs(textChunk.totalHeight), 41722 transform: textChunk.transform, 41723 fontName: textChunk.fontName, 41724 hasEOL: textChunk.hasEOL 41725 }; 41726 } 41727 async function handleSetFont(fontName, fontRef) { 41728 const translated = await self.loadFont(fontName, fontRef, resources, task); 41729 textState.loadedName = translated.loadedName; 41730 textState.font = translated.font; 41731 textState.fontMatrix = translated.font.fontMatrix || FONT_IDENTITY_MATRIX; 41732 } 41733 function applyInverseRotation(x, y, matrix) { 41734 const scale = Math.hypot(matrix[0], matrix[1]); 41735 return [(matrix[0] * x + matrix[1] * y) / scale, (matrix[2] * x + matrix[3] * y) / scale]; 41736 } 41737 function compareWithLastPosition(glyphWidth) { 41738 const currentTransform = getCurrentTextTransform(); 41739 let posX = currentTransform[4]; 41740 let posY = currentTransform[5]; 41741 if (textState.font?.vertical) { 41742 if (posX < viewBox[0] || posX > viewBox[2] || posY + glyphWidth < viewBox[1] || posY > viewBox[3]) { 41743 return false; 41744 } 41745 } else if (posX + glyphWidth < viewBox[0] || posX > viewBox[2] || posY < viewBox[1] || posY > viewBox[3]) { 41746 return false; 41747 } 41748 if (!textState.font || !textContentItem.prevTransform) { 41749 return true; 41750 } 41751 let lastPosX = textContentItem.prevTransform[4]; 41752 let lastPosY = textContentItem.prevTransform[5]; 41753 if (lastPosX === posX && lastPosY === posY) { 41754 return true; 41755 } 41756 let rotate = -1; 41757 if (currentTransform[0] && currentTransform[1] === 0 && currentTransform[2] === 0) { 41758 rotate = currentTransform[0] > 0 ? 0 : 180; 41759 } else if (currentTransform[1] && currentTransform[0] === 0 && currentTransform[3] === 0) { 41760 rotate = currentTransform[1] > 0 ? 90 : 270; 41761 } 41762 switch (rotate) { 41763 case 0: 41764 break; 41765 case 90: 41766 [posX, posY] = [posY, posX]; 41767 [lastPosX, lastPosY] = [lastPosY, lastPosX]; 41768 break; 41769 case 180: 41770 [posX, posY, lastPosX, lastPosY] = [-posX, -posY, -lastPosX, -lastPosY]; 41771 break; 41772 case 270: 41773 [posX, posY] = [-posY, -posX]; 41774 [lastPosX, lastPosY] = [-lastPosY, -lastPosX]; 41775 break; 41776 default: 41777 [posX, posY] = applyInverseRotation(posX, posY, currentTransform); 41778 [lastPosX, lastPosY] = applyInverseRotation(lastPosX, lastPosY, textContentItem.prevTransform); 41779 } 41780 if (textState.font.vertical) { 41781 const advanceY = (lastPosY - posY) / textContentItem.textAdvanceScale; 41782 const advanceX = posX - lastPosX; 41783 const textOrientation = Math.sign(textContentItem.height || textContentItem.totalHeight); 41784 if (advanceY < textOrientation * textContentItem.negativeSpaceMax) { 41785 if (Math.abs(advanceX) > 0.5 * textContentItem.width) { 41786 appendEOL(); 41787 return true; 41788 } 41789 resetLastChars(); 41790 flushTextContentItem(); 41791 return true; 41792 } 41793 if (Math.abs(advanceX) > textContentItem.width) { 41794 appendEOL(); 41795 return true; 41796 } 41797 if (advanceY <= textOrientation * textContentItem.notASpace) { 41798 resetLastChars(); 41799 } 41800 if (advanceY <= textOrientation * textContentItem.trackingSpaceMin) { 41801 if (shouldAddWhitepsace()) { 41802 resetLastChars(); 41803 flushTextContentItem(); 41804 pushWhitespace({ 41805 height: Math.abs(advanceY) 41806 }); 41807 } else { 41808 textContentItem.height += advanceY; 41809 } 41810 } else if (!addFakeSpaces(advanceY, textContentItem.prevTransform, textOrientation)) { 41811 if (textContentItem.str.length === 0) { 41812 resetLastChars(); 41813 pushWhitespace({ 41814 height: Math.abs(advanceY) 41815 }); 41816 } else { 41817 textContentItem.height += advanceY; 41818 } 41819 } 41820 if (Math.abs(advanceX) > textContentItem.width * VERTICAL_SHIFT_RATIO) { 41821 flushTextContentItem(); 41822 } 41823 return true; 41824 } 41825 const advanceX = (posX - lastPosX) / textContentItem.textAdvanceScale; 41826 const advanceY = posY - lastPosY; 41827 const textOrientation = Math.sign(textContentItem.width || textContentItem.totalWidth); 41828 if (advanceX < textOrientation * textContentItem.negativeSpaceMax) { 41829 if (Math.abs(advanceY) > 0.5 * textContentItem.height) { 41830 appendEOL(); 41831 return true; 41832 } 41833 resetLastChars(); 41834 flushTextContentItem(); 41835 return true; 41836 } 41837 const textRiseDelta = textState.textRise - textContentItem.prevTextRise; 41838 const advanceYCorrected = textRiseDelta === 0 ? advanceY : advanceY - currentTransform[3] / textState.fontSize * textRiseDelta; 41839 if (Math.abs(advanceYCorrected) > textContentItem.height) { 41840 appendEOL(); 41841 return true; 41842 } 41843 if (advanceX <= textOrientation * textContentItem.notASpace) { 41844 resetLastChars(); 41845 } 41846 if (advanceX <= textOrientation * textContentItem.trackingSpaceMin) { 41847 if (shouldAddWhitepsace()) { 41848 resetLastChars(); 41849 flushTextContentItem(); 41850 pushWhitespace({ 41851 width: Math.abs(advanceX) 41852 }); 41853 } else { 41854 textContentItem.width += advanceX; 41855 } 41856 } else if (!addFakeSpaces(advanceX, textContentItem.prevTransform, textOrientation)) { 41857 if (textContentItem.str.length === 0) { 41858 resetLastChars(); 41859 pushWhitespace({ 41860 width: Math.abs(advanceX) 41861 }); 41862 } else { 41863 textContentItem.width += advanceX; 41864 } 41865 } 41866 if (Math.abs(advanceY) > textContentItem.height * VERTICAL_SHIFT_RATIO) { 41867 flushTextContentItem(); 41868 } 41869 return true; 41870 } 41871 function buildTextContentItem({ 41872 chars, 41873 extraSpacing 41874 }) { 41875 if (currentTextState !== textState && (currentTextState.fontSize !== textState.fontSize || currentTextState.fontName !== textState.fontName && (currentTextState.font.name !== textState.font.name || currentTextState.font.vertical !== textState.font.vertical))) { 41876 flushTextContentItem(); 41877 currentTextState = textState.clone(); 41878 } 41879 const font = textState.font; 41880 const baseCharSpacing = font.vertical ? -textState.charSpacing : textState.charSpacing; 41881 if (!chars) { 41882 const charSpacing = baseCharSpacing + extraSpacing; 41883 if (charSpacing) { 41884 if (!font.vertical) { 41885 textState.translateTextMatrix(charSpacing * textState.textHScale, 0); 41886 } else { 41887 textState.translateTextMatrix(0, -charSpacing); 41888 } 41889 } 41890 if (keepWhiteSpace) { 41891 compareWithLastPosition(0); 41892 } 41893 return; 41894 } 41895 const glyphs = font.charsToGlyphs(chars); 41896 const scale = textState.fontMatrix[0] * textState.fontSize; 41897 for (let i = 0, ii = glyphs.length; i < ii; i++) { 41898 const glyph = glyphs[i]; 41899 const { 41900 category, 41901 originalCharCode 41902 } = glyph; 41903 if (category.isInvisibleFormatMark) { 41904 continue; 41905 } 41906 let charSpacing = baseCharSpacing + (i + 1 === ii ? extraSpacing : 0); 41907 let glyphWidth = glyph.width; 41908 if (font.vertical) { 41909 glyphWidth = glyph.vmetric ? glyph.vmetric[0] : -glyphWidth; 41910 } 41911 let scaledDim = glyphWidth * scale; 41912 if (originalCharCode === 0x20) { 41913 charSpacing += textState.wordSpacing; 41914 } 41915 if (!keepWhiteSpace && category.isWhitespace) { 41916 if (!font.vertical) { 41917 charSpacing += scaledDim; 41918 textState.translateTextMatrix(charSpacing * textState.textHScale, 0); 41919 } else { 41920 charSpacing += -scaledDim; 41921 textState.translateTextMatrix(0, -charSpacing); 41922 } 41923 saveLastChar(" "); 41924 continue; 41925 } 41926 if (!category.isZeroWidthDiacritic && !compareWithLastPosition(scaledDim)) { 41927 if (!font.vertical) { 41928 textState.translateTextMatrix(scaledDim * textState.textHScale, 0); 41929 } else { 41930 textState.translateTextMatrix(0, scaledDim); 41931 } 41932 continue; 41933 } 41934 const textChunk = ensureTextContentItem(); 41935 if (category.isZeroWidthDiacritic) { 41936 scaledDim = 0; 41937 } 41938 if (!font.vertical) { 41939 scaledDim *= textState.textHScale; 41940 intersector?.addGlyph(getCurrentTextTransform(), scaledDim, 0, glyph.unicode); 41941 textState.translateTextMatrix(scaledDim, 0); 41942 textChunk.width += scaledDim; 41943 } else { 41944 intersector?.addGlyph(getCurrentTextTransform(), 0, scaledDim, glyph.unicode); 41945 textState.translateTextMatrix(0, scaledDim); 41946 scaledDim = Math.abs(scaledDim); 41947 textChunk.height += scaledDim; 41948 } 41949 if (scaledDim) { 41950 textChunk.prevTransform = getCurrentTextTransform(); 41951 textChunk.prevTextRise = textState.textRise; 41952 } 41953 const glyphUnicode = glyph.unicode; 41954 if (saveLastChar(glyphUnicode)) { 41955 textChunk.str.push(" "); 41956 intersector?.addExtraChar(" "); 41957 } 41958 if (!intersector) { 41959 textChunk.str.push(glyphUnicode); 41960 } 41961 if (charSpacing) { 41962 if (!font.vertical) { 41963 textState.translateTextMatrix(charSpacing * textState.textHScale, 0); 41964 } else { 41965 textState.translateTextMatrix(0, -charSpacing); 41966 } 41967 } 41968 } 41969 } 41970 function appendEOL() { 41971 intersector?.addExtraChar("\n"); 41972 resetLastChars(); 41973 if (textContentItem.initialized) { 41974 textContentItem.hasEOL = true; 41975 flushTextContentItem(); 41976 } else { 41977 textContent.items.push({ 41978 str: "", 41979 dir: "ltr", 41980 width: 0, 41981 height: 0, 41982 transform: getCurrentTextTransform(), 41983 fontName: textState.loadedName, 41984 hasEOL: true 41985 }); 41986 } 41987 } 41988 function addFakeSpaces(width, transf, textOrientation) { 41989 if (textOrientation * textContentItem.spaceInFlowMin <= width && width <= textOrientation * textContentItem.spaceInFlowMax) { 41990 if (textContentItem.initialized) { 41991 resetLastChars(); 41992 textContentItem.str.push(" "); 41993 intersector?.addExtraChar(" "); 41994 } 41995 return false; 41996 } 41997 const fontName = textContentItem.fontName; 41998 let height = 0; 41999 if (textContentItem.vertical) { 42000 height = width; 42001 width = 0; 42002 } 42003 flushTextContentItem(); 42004 resetLastChars(); 42005 pushWhitespace({ 42006 width: Math.abs(width), 42007 height: Math.abs(height), 42008 transform: transf || getCurrentTextTransform(), 42009 fontName 42010 }); 42011 return true; 42012 } 42013 function flushTextContentItem() { 42014 if (!textContentItem.initialized || !textContentItem.str) { 42015 return; 42016 } 42017 if (!textContentItem.vertical) { 42018 textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale; 42019 } else { 42020 textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale; 42021 } 42022 textContent.items.push(runBidiTransform(textContentItem)); 42023 textContentItem.initialized = false; 42024 textContentItem.str.length = 0; 42025 } 42026 function
vendor: 1,497 bytes, lines 42026-42073
42026enqueueChunk(batch = false) { 42027 const length = textContent.items.length; 42028 if (length === 0) { 42029 return; 42030 } 42031 if (batch && length < TEXT_CHUNK_BATCH_SIZE) { 42032 return; 42033 } 42034 sink?.enqueue(textContent, length); 42035 textContent.items = []; 42036 textContent.styles = Object.create(null); 42037 } 42038 const timeSlotManager = new TimeSlotManager(); 42039 return new Promise(function promiseBody(resolve, reject) { 42040 const next = function (promise) { 42041 enqueueChunk(true); 42042 Promise.all([promise, sink?.ready]).then(function () { 42043 try { 42044 promiseBody(resolve, reject); 42045 } catch (ex) { 42046 reject(ex); 42047 } 42048 }, reject); 42049 }; 42050 task.ensureNotTerminated(); 42051 timeSlotManager.reset(); 42052 const operation = {}; 42053 let stop, 42054 name, 42055 isValidName, 42056 args = []; 42057 while (!(stop = timeSlotManager.check())) { 42058 args.length = 0; 42059 operation.args = args; 42060 if (!preprocessor.read(operation)) { 42061 break; 42062 } 42063 textState = stateManager.state; 42064 currentTextState ||= textState.clone(); 42065 const fn = operation.fn; 42066 args = operation.args; 42067 switch (fn | 0) { 42068 case OPS.setFont: 42069 const fontNameArg = args[0].name, 42070 fontSizeArg = args[1]; 42071 if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) { 42072 break; 42073 }
vendor: 10,289 bytes, lines 42073-42345
42073 42074 textState.fontName = fontNameArg; 42075 textState.fontSize = fontSizeArg; 42076 next(handleSetFont(fontNameArg, null)); 42077 return; 42078 case OPS.setTextRise: 42079 textState.textRise = args[0]; 42080 break; 42081 case OPS.setHScale: 42082 textState.textHScale = args[0] / 100; 42083 break; 42084 case OPS.setLeading: 42085 textState.leading = args[0]; 42086 break; 42087 case OPS.moveText: 42088 textState.translateTextLineMatrix(args[0], args[1]); 42089 textState.textMatrix = textState.textLineMatrix.slice(); 42090 break; 42091 case OPS.setLeadingMoveText: 42092 textState.leading = -args[1]; 42093 textState.translateTextLineMatrix(args[0], args[1]); 42094 textState.textMatrix = textState.textLineMatrix.slice(); 42095 break; 42096 case OPS.nextLine: 42097 textState.carriageReturn(); 42098 break; 42099 case OPS.setTextMatrix: 42100 textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]); 42101 textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]); 42102 updateAdvanceScale(); 42103 break; 42104 case OPS.setCharSpacing: 42105 textState.charSpacing = args[0]; 42106 break; 42107 case OPS.setWordSpacing: 42108 textState.wordSpacing = args[0]; 42109 break; 42110 case OPS.beginText: 42111 textState.textMatrix = IDENTITY_MATRIX.slice(); 42112 textState.textLineMatrix = IDENTITY_MATRIX.slice(); 42113 break; 42114 case OPS.showSpacedText: 42115 if (!stateManager.state.font) { 42116 self.ensureStateFont(stateManager.state); 42117 continue; 42118 } 42119 const spaceFactor = (textState.font.vertical ? 1 : -1) * textState.fontSize / 1000; 42120 const elements = args[0]; 42121 for (let i = 0, ii = elements.length; i < ii; i++) { 42122 const item = elements[i]; 42123 if (typeof item === "string") { 42124 showSpacedTextBuffer.push(item); 42125 } else if (typeof item === "number" && item !== 0) { 42126 const str = showSpacedTextBuffer.join(""); 42127 showSpacedTextBuffer.length = 0; 42128 buildTextContentItem({ 42129 chars: str, 42130 extraSpacing: item * spaceFactor 42131 }); 42132 } 42133 } 42134 if (showSpacedTextBuffer.length > 0) { 42135 const str = showSpacedTextBuffer.join(""); 42136 showSpacedTextBuffer.length = 0; 42137 buildTextContentItem({ 42138 chars: str, 42139 extraSpacing: 0 42140 }); 42141 } 42142 break; 42143 case OPS.showText: 42144 if (!stateManager.state.font) { 42145 self.ensureStateFont(stateManager.state); 42146 continue; 42147 } 42148 buildTextContentItem({ 42149 chars: args[0], 42150 extraSpacing: 0 42151 }); 42152 break; 42153 case OPS.nextLineShowText: 42154 if (!stateManager.state.font) { 42155 self.ensureStateFont(stateManager.state); 42156 continue; 42157 } 42158 textState.carriageReturn(); 42159 buildTextContentItem({ 42160 chars: args[0], 42161 extraSpacing: 0 42162 }); 42163 break; 42164 case OPS.nextLineSetSpacingShowText: 42165 if (!stateManager.state.font) { 42166 self.ensureStateFont(stateManager.state); 42167 continue; 42168 } 42169 textState.wordSpacing = args[0]; 42170 textState.charSpacing = args[1]; 42171 textState.carriageReturn(); 42172 buildTextContentItem({ 42173 chars: args[2], 42174 extraSpacing: 0 42175 }); 42176 break; 42177 case OPS.paintXObject: 42178 flushTextContentItem(); 42179 xobjs ??= resources.get("XObject") || Dict.empty; 42180 isValidName = args[0] instanceof Name; 42181 name = args[0].name; 42182 if (isValidName && emptyXObjectCache.getByName(name)) { 42183 break; 42184 } 42185 next(new Promise(function (resolveXObject, rejectXObject) { 42186 if (!isValidName) { 42187 throw new FormatError("XObject must be referred to by name."); 42188 } 42189 let xobj = xobjs.getRaw(name); 42190 if (xobj instanceof Ref) { 42191 if (emptyXObjectCache.getByRef(xobj)) { 42192 resolveXObject(); 42193 return; 42194 } 42195 const globalImage = self.globalImageCache.getData(xobj, self.pageIndex); 42196 if (globalImage) { 42197 resolveXObject(); 42198 return; 42199 } 42200 xobj = xref.fetch(xobj); 42201 } 42202 if (!(xobj instanceof BaseStream)) { 42203 throw new FormatError("XObject should be a stream"); 42204 } 42205 const { 42206 dict 42207 } = xobj; 42208 const type = dict.get("Subtype"); 42209 if (!(type instanceof Name)) { 42210 throw new FormatError("XObject should have a Name subtype"); 42211 } 42212 if (type.name !== "Form") { 42213 emptyXObjectCache.set(name, dict.objId, true); 42214 resolveXObject(); 42215 return; 42216 } 42217 const currentState = stateManager.state.clone(); 42218 const xObjStateManager = new StateManager(currentState); 42219 const matrix = lookupMatrix(dict.getArray("Matrix"), null); 42220 if (matrix) { 42221 xObjStateManager.transform(matrix); 42222 } 42223 const localResources = dict.get("Resources"); 42224 enqueueChunk(); 42225 const sinkWrapper = { 42226 enqueueInvoked: false, 42227 enqueue(chunk, size) { 42228 this.enqueueInvoked = true; 42229 sink.enqueue(chunk, size); 42230 }, 42231 get desiredSize() { 42232 return sink.desiredSize ?? 0; 42233 }, 42234 get ready() { 42235 return sink.ready; 42236 } 42237 }; 42238 self.getTextContent({ 42239 stream: xobj, 42240 task, 42241 resources: localResources instanceof Dict ? localResources : resources, 42242 stateManager: xObjStateManager, 42243 includeMarkedContent, 42244 sink: sink && sinkWrapper, 42245 seenStyles, 42246 viewBox, 42247 lang, 42248 markedContentData, 42249 disableNormalization, 42250 keepWhiteSpace, 42251 prevRefs: seenRefs 42252 }).then(function () { 42253 if (!sinkWrapper.enqueueInvoked) { 42254 emptyXObjectCache.set(name, dict.objId, true); 42255 } 42256 resolveXObject(); 42257 }, rejectXObject); 42258 }).catch(function (reason) { 42259 if (reason instanceof AbortException) { 42260 return; 42261 } 42262 if (self.options.ignoreErrors) { 42263 warn(`getTextContent - ignoring XObject: "${reason}".`); 42264 return; 42265 } 42266 throw reason; 42267 })); 42268 return; 42269 case OPS.setGState: 42270 isValidName = args[0] instanceof Name; 42271 name = args[0].name; 42272 if (isValidName && emptyGStateCache.getByName(name)) { 42273 break; 42274 } 42275 next(new Promise(function (resolveGState, rejectGState) { 42276 if (!isValidName) { 42277 throw new FormatError("GState must be referred to by name."); 42278 } 42279 const extGState = resources.get("ExtGState"); 42280 if (!(extGState instanceof Dict)) { 42281 throw new FormatError("ExtGState should be a dictionary."); 42282 } 42283 const gState = extGState.get(name); 42284 if (!(gState instanceof Dict)) { 42285 throw new FormatError("GState should be a dictionary."); 42286 } 42287 const gStateFont = gState.get("Font"); 42288 if (!gStateFont) { 42289 emptyGStateCache.set(name, gState.objId, true); 42290 resolveGState(); 42291 return; 42292 } 42293 flushTextContentItem(); 42294 textState.fontName = null; 42295 textState.fontSize = gStateFont[1]; 42296 handleSetFont(null, gStateFont[0]).then(resolveGState, rejectGState); 42297 }).catch(function (reason) { 42298 if (reason instanceof AbortException) { 42299 return; 42300 } 42301 if (self.options.ignoreErrors) { 42302 warn(`getTextContent - ignoring ExtGState: "${reason}".`); 42303 return; 42304 } 42305 throw reason; 42306 })); 42307 return; 42308 case OPS.beginMarkedContent: 42309 flushTextContentItem(); 42310 if (includeMarkedContent) { 42311 markedContentData.level++; 42312 textContent.items.push({ 42313 type: "beginMarkedContent", 42314 tag: args[0] instanceof Name ? args[0].name : null 42315 }); 42316 } 42317 break; 42318 case OPS.beginMarkedContentProps: 42319 flushTextContentItem(); 42320 if (includeMarkedContent) { 42321 markedContentData.level++; 42322 let mcid = null; 42323 if (args[1] instanceof Dict) { 42324 mcid = args[1].get("MCID"); 42325 } 42326 textContent.items.push({ 42327 type: "beginMarkedContentProps", 42328 id: Number.isInteger(mcid) ? `${self.idFactory.getPageObjId()}_mc${mcid}` : null, 42329 tag: args[0] instanceof Name ? args[0].name : null 42330 }); 42331 } 42332 break; 42333 case OPS.endMarkedContent: 42334 flushTextContentItem(); 42335 if (includeMarkedContent) { 42336 if (markedContentData.level === 0) { 42337 break; 42338 } 42339 markedContentData.level--; 42340 textContent.items.push({ 42341 type: "endMarkedContent" 42342 }); 42343 } 42344 break; 42345
42345} 42346 if (textContent.items.length >= (sink?.desiredSize ?? 1)) { 42347 stop = true; 42348 break; 42349 } 42350 } 42351 if (stop) { 42352 next(deferred); 42353 return; 42354 } 42355 flushTextContentItem(); 42356 enqueueChunk(); 42357 resolve(); 42358 }).catch(reason => { 42359 if (reason instanceof AbortException) { 42360 return; 42361 } 42362 if (this.options.ignoreErrors) { 42363 warn(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`); 42364 flushTextContentItem
vendor: 16,169 bytes, lines 42364-42812
42364(); 42365 enqueueChunk(); 42366 return; 42367 } 42368 throw reason; 42369 }); 42370 } 42371 async extractDataStructures(dict, properties) { 42372 const xref = this.xref; 42373 let cidToGidBytes; 42374 const toUnicodePromise = this.readToUnicode(properties.toUnicode); 42375 if (properties.composite) { 42376 const cidSystemInfo = dict.get("CIDSystemInfo"); 42377 if (cidSystemInfo instanceof Dict && !properties.cidSystemInfo) { 42378 properties.cidSystemInfo = { 42379 registry: stringToPDFString(cidSystemInfo.get("Registry")), 42380 ordering: stringToPDFString(cidSystemInfo.get("Ordering")), 42381 supplement: cidSystemInfo.get("Supplement") 42382 }; 42383 } 42384 try { 42385 const cidToGidMap = dict.get("CIDToGIDMap"); 42386 if (cidToGidMap instanceof BaseStream) { 42387 cidToGidBytes = cidToGidMap.getBytes(); 42388 } 42389 } catch (ex) { 42390 if (!this.options.ignoreErrors) { 42391 throw ex; 42392 } 42393 warn(`extractDataStructures - ignoring CIDToGIDMap data: "${ex}".`); 42394 } 42395 } 42396 const differences = []; 42397 let baseEncodingName = null; 42398 let encoding; 42399 if (dict.has("Encoding")) { 42400 encoding = dict.get("Encoding"); 42401 if (encoding instanceof Dict) { 42402 baseEncodingName = encoding.get("BaseEncoding"); 42403 baseEncodingName = baseEncodingName instanceof Name ? baseEncodingName.name : null; 42404 if (encoding.has("Differences")) { 42405 const diffEncoding = encoding.get("Differences"); 42406 let index = 0; 42407 for (const entry of diffEncoding) { 42408 const data = xref.fetchIfRef(entry); 42409 if (typeof data === "number") { 42410 index = data; 42411 } else if (data instanceof Name) { 42412 differences[index++] = data.name; 42413 } else { 42414 throw new FormatError(`Invalid entry in 'Differences' array: ${data}`); 42415 } 42416 } 42417 } 42418 } else if (encoding instanceof Name) { 42419 baseEncodingName = encoding.name; 42420 } else { 42421 const msg = "Encoding is not a Name nor a Dict"; 42422 if (!this.options.ignoreErrors) { 42423 throw new FormatError(msg); 42424 } 42425 warn(msg); 42426 } 42427 if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") { 42428 baseEncodingName = null; 42429 } 42430 } 42431 const nonEmbeddedFont = !properties.file || properties.isInternalFont, 42432 isSymbolsFontName = getSymbolsFonts()[properties.name]; 42433 if (baseEncodingName && nonEmbeddedFont && isSymbolsFontName) { 42434 baseEncodingName = null; 42435 } 42436 if (baseEncodingName === "WinAnsiEncoding" && nonEmbeddedFont && properties.name?.charCodeAt(0) >= 0xb7) { 42437 const fontName = properties.name; 42438 const chineseFontNames = ["\xCB\xCE\xCC\xE5", "\xBA\xDA\xCC\xE5", "\xBF\xAC\xCC\xE5", "\xB7\xC2\xCB\xCE", "\xBF\xAC\xCC\xE5_GB2312", "\xB7\xC2\xCB\xCE_GB2312", "\xC1\xA5\xCA\xE9", "\xD0\xC2\xCB\xCE", "\xB7\xC2\xCB\xCE\xCC\xE5", "\xD0\xA1\xB1\xEA\xCB\xCE"]; 42439 if (chineseFontNames.includes(fontName)) { 42440 baseEncodingName = null; 42441 properties.defaultEncoding = "Adobe-GB1-UCS2"; 42442 properties.composite = true; 42443 properties.cidEncoding = Name.get("GBK-EUC-H"); 42444 const cMap = await CMapFactory.create({ 42445 encoding: properties.cidEncoding, 42446 fetchBuiltInCMap: this._fetchBuiltInCMapBound, 42447 useCMap: null 42448 }); 42449 properties.cMap = cMap; 42450 properties.vertical = properties.cMap.vertical; 42451 properties.cidSystemInfo = { 42452 registry: "Adobe", 42453 ordering: "GB1", 42454 supplement: 0 42455 }; 42456 } 42457 } 42458 if (baseEncodingName) { 42459 properties.defaultEncoding = getEncoding(baseEncodingName); 42460 } else { 42461 let isSymbolicFont = !!(properties.flags & FontFlags.Symbolic); 42462 const isNonsymbolicFont = !!(properties.flags & FontFlags.Nonsymbolic); 42463 if (properties.type === "TrueType" && isSymbolicFont && isNonsymbolicFont && differences.length !== 0) { 42464 properties.flags &= ~FontFlags.Symbolic; 42465 isSymbolicFont = false; 42466 } 42467 encoding = StandardEncoding; 42468 if (properties.type === "TrueType" && !isNonsymbolicFont) { 42469 encoding = WinAnsiEncoding; 42470 } 42471 if (isSymbolicFont || isSymbolsFontName) { 42472 encoding = MacRomanEncoding; 42473 if (nonEmbeddedFont) { 42474 if (/Symbol/i.test(properties.name)) { 42475 encoding = SymbolSetEncoding; 42476 } else if (/Dingbats/i.test(properties.name)) { 42477 encoding = ZapfDingbatsEncoding; 42478 } else if (/Wingdings/i.test(properties.name)) { 42479 encoding = WinAnsiEncoding; 42480 } 42481 } 42482 } 42483 properties.defaultEncoding = encoding; 42484 } 42485 properties.differences = differences; 42486 properties.baseEncodingName = baseEncodingName; 42487 properties.hasEncoding = !!baseEncodingName || differences.length > 0; 42488 properties.dict = dict; 42489 properties.toUnicode = await toUnicodePromise; 42490 const builtToUnicode = await this.buildToUnicode(properties); 42491 properties.toUnicode = builtToUnicode; 42492 if (cidToGidBytes) { 42493 properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode); 42494 } 42495 return properties; 42496 } 42497 _simpleFontToUnicode(properties, forceGlyphs = false) { 42498 assert(!properties.composite, "Must be a simple font."); 42499 const toUnicode = []; 42500 const encoding = properties.defaultEncoding.slice(); 42501 const baseEncodingName = properties.baseEncodingName; 42502 const differences = properties.differences; 42503 for (const charcode in differences) { 42504 const glyphName = differences[charcode]; 42505 if (glyphName === ".notdef") { 42506 continue; 42507 } 42508 encoding[charcode] = glyphName; 42509 } 42510 const glyphsUnicodeMap = getGlyphsUnicode(); 42511 for (const charcode in encoding) { 42512 let glyphName = encoding[charcode]; 42513 if (glyphName === "") { 42514 continue; 42515 } 42516 let unicode = glyphsUnicodeMap[glyphName]; 42517 if (unicode !== undefined) { 42518 toUnicode[charcode] = String.fromCharCode(unicode); 42519 continue; 42520 } 42521 let code = 0; 42522 switch (glyphName[0]) { 42523 case "G": 42524 if (glyphName.length === 3) { 42525 code = parseInt(glyphName.substring(1), 16); 42526 } 42527 break; 42528 case "g": 42529 if (glyphName.length === 5) { 42530 code = parseInt(glyphName.substring(1), 16); 42531 } 42532 break; 42533 case "C": 42534 case "c": 42535 if (glyphName.length >= 3 && glyphName.length <= 4) { 42536 const codeStr = glyphName.substring(1); 42537 if (forceGlyphs) { 42538 code = parseInt(codeStr, 16); 42539 break; 42540 } 42541 code = +codeStr; 42542 if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) { 42543 return this._simpleFontToUnicode(properties, true); 42544 } 42545 } 42546 break; 42547 case "u": 42548 unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap); 42549 if (unicode !== -1) { 42550 code = unicode; 42551 } 42552 break; 42553 default: 42554 switch (glyphName) { 42555 case "f_h": 42556 case "f_t": 42557 case "T_h": 42558 toUnicode[charcode] = glyphName.replaceAll("_", ""); 42559 continue; 42560 } 42561 break; 42562 } 42563 if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) { 42564 if (baseEncodingName && code === +charcode) { 42565 const baseEncoding = getEncoding(baseEncodingName); 42566 if (baseEncoding && (glyphName = baseEncoding[charcode])) { 42567 toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]); 42568 continue; 42569 } 42570 } 42571 toUnicode[charcode] = String.fromCodePoint(code); 42572 } 42573 } 42574 return toUnicode; 42575 } 42576 async buildToUnicode(properties) { 42577 properties.hasIncludedToUnicodeMap = properties.toUnicode?.length > 0; 42578 if (properties.hasIncludedToUnicodeMap) { 42579 if (!properties.composite && properties.hasEncoding) { 42580 properties.fallbackToUnicode = this._simpleFontToUnicode(properties); 42581 } 42582 return properties.toUnicode; 42583 } 42584 if (!properties.composite) { 42585 return new ToUnicodeMap(this._simpleFontToUnicode(properties)); 42586 } 42587 if (properties.composite && (properties.cMap.builtInCMap && !(properties.cMap instanceof IdentityCMap) || properties.cidSystemInfo?.registry === "Adobe" && (properties.cidSystemInfo.ordering === "GB1" || properties.cidSystemInfo.ordering === "CNS1" || properties.cidSystemInfo.ordering === "Japan1" || properties.cidSystemInfo.ordering === "Korea1"))) { 42588 const { 42589 registry, 42590 ordering 42591 } = properties.cidSystemInfo; 42592 const ucs2CMapName = Name.get(`${registry}-${ordering}-UCS2`); 42593 const ucs2CMap = await CMapFactory.create({ 42594 encoding: ucs2CMapName, 42595 fetchBuiltInCMap: this._fetchBuiltInCMapBound, 42596 useCMap: null 42597 }); 42598 const toUnicode = [], 42599 buf = []; 42600 properties.cMap.forEach(function (charcode, cid) { 42601 if (cid > 0xffff) { 42602 throw new FormatError("Max size of CID is 65,535"); 42603 } 42604 const ucs2 = ucs2CMap.lookup(cid); 42605 if (ucs2) { 42606 buf.length = 0; 42607 for (let i = 0, ii = ucs2.length; i < ii; i += 2) { 42608 buf.push((ucs2.charCodeAt(i) << 8) + ucs2.charCodeAt(i + 1)); 42609 } 42610 toUnicode[charcode] = String.fromCharCode(...buf); 42611 } 42612 }); 42613 return new ToUnicodeMap(toUnicode); 42614 } 42615 return new IdentityToUnicodeMap(properties.firstChar, properties.lastChar); 42616 } 42617 async readToUnicode(cmapObj) { 42618 if (!cmapObj) { 42619 return null; 42620 } 42621 if (cmapObj instanceof Name) { 42622 const cmap = await CMapFactory.create({ 42623 encoding: cmapObj, 42624 fetchBuiltInCMap: this._fetchBuiltInCMapBound, 42625 useCMap: null 42626 }); 42627 if (cmap instanceof IdentityCMap) { 42628 return new IdentityToUnicodeMap(0, 0xffff); 42629 } 42630 return new ToUnicodeMap(cmap.getMap()); 42631 } 42632 if (cmapObj instanceof BaseStream) { 42633 try { 42634 const cmap = await CMapFactory.create({ 42635 encoding: cmapObj, 42636 fetchBuiltInCMap: this._fetchBuiltInCMapBound, 42637 useCMap: null 42638 }); 42639 if (cmap instanceof IdentityCMap) { 42640 return new IdentityToUnicodeMap(0, 0xffff); 42641 } 42642 const map = new Array(cmap.length); 42643 cmap.forEach(function (charCode, token) { 42644 if (typeof token === "number") { 42645 map[charCode] = String.fromCodePoint(token); 42646 return; 42647 } 42648 if (token.length % 2 !== 0) { 42649 token = "\u0000" + token; 42650 } 42651 const str = []; 42652 for (let k = 0; k < token.length; k += 2) { 42653 const w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1); 42654 if ((w1 & 0xf800) !== 0xd800) { 42655 str.push(w1); 42656 continue; 42657 } 42658 k += 2; 42659 const w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1); 42660 str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000); 42661 } 42662 map[charCode] = String.fromCodePoint(...str); 42663 }); 42664 return new ToUnicodeMap(map); 42665 } catch (reason) { 42666 if (reason instanceof AbortException) { 42667 return null; 42668 } 42669 if (this.options.ignoreErrors) { 42670 warn(`readToUnicode - ignoring ToUnicode data: "${reason}".`); 42671 return null; 42672 } 42673 throw reason; 42674 } 42675 } 42676 return null; 42677 } 42678 readCidToGidMap(glyphsData, toUnicode) { 42679 const result = []; 42680 for (let j = 0, jj = glyphsData.length; j < jj; j++) { 42681 const glyphID = glyphsData[j++] << 8 | glyphsData[j]; 42682 const code = j >> 1; 42683 if (glyphID === 0 && !toUnicode.has(code)) { 42684 continue; 42685 } 42686 result[code] = glyphID; 42687 } 42688 return result; 42689 } 42690 extractWidths(dict, descriptor, properties) { 42691 const xref = this.xref; 42692 let glyphsWidths = []; 42693 let defaultWidth = 0; 42694 const glyphsVMetrics = []; 42695 let defaultVMetrics; 42696 if (properties.composite) { 42697 const dw = dict.get("DW"); 42698 defaultWidth = typeof dw === "number" ? Math.ceil(dw) : 1000; 42699 const widths = dict.get("W"); 42700 if (Array.isArray(widths)) { 42701 for (let i = 0, ii = widths.length; i < ii; i++) { 42702 let start = xref.fetchIfRef(widths[i++]); 42703 if (!Number.isInteger(start)) { 42704 break; 42705 } 42706 const code = xref.fetchIfRef(widths[i]); 42707 if (Array.isArray(code)) { 42708 for (const c of code) { 42709 const width = xref.fetchIfRef(c); 42710 if (typeof width === "number") { 42711 glyphsWidths[start] = width; 42712 } 42713 start++; 42714 } 42715 } else if (Number.isInteger(code)) { 42716 const width = xref.fetchIfRef(widths[++i]); 42717 if (typeof width !== "number") { 42718 continue; 42719 } 42720 for (let j = start; j <= code; j++) { 42721 glyphsWidths[j] = width; 42722 } 42723 } else { 42724 break; 42725 } 42726 } 42727 } 42728 if (properties.vertical) { 42729 const dw2 = dict.getArray("DW2"); 42730 let vmetrics = isNumberArray(dw2, 2) ? dw2 : [880, -1000]; 42731 defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]]; 42732 vmetrics = dict.get("W2"); 42733 if (Array.isArray(vmetrics)) { 42734 for (let i = 0, ii = vmetrics.length; i < ii; i++) { 42735 let start = xref.fetchIfRef(vmetrics[i++]); 42736 if (!Number.isInteger(start)) { 42737 break; 42738 } 42739 const code = xref.fetchIfRef(vmetrics[i]); 42740 if (Array.isArray(code)) { 42741 for (let j = 0, jj = code.length; j < jj; j++) { 42742 const vmetric = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])]; 42743 if (isNumberArray(vmetric, null)) { 42744 glyphsVMetrics[start] = vmetric; 42745 } 42746 start++; 42747 } 42748 } else if (Number.isInteger(code)) { 42749 const vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])]; 42750 if (!isNumberArray(vmetric, null)) { 42751 continue; 42752 } 42753 for (let j = start; j <= code; j++) { 42754 glyphsVMetrics[j] = vmetric; 42755 } 42756 } else { 42757 break; 42758 } 42759 } 42760 } 42761 } 42762 } else { 42763 const widths = dict.get("Widths"); 42764 if (Array.isArray(widths)) { 42765 let j = properties.firstChar; 42766 for (const w of widths) { 42767 const width = xref.fetchIfRef(w); 42768 if (typeof width === "number") { 42769 glyphsWidths[j] = width; 42770 } 42771 j++; 42772 } 42773 const missingWidth = descriptor.get("MissingWidth"); 42774 defaultWidth = typeof missingWidth === "number" ? missingWidth : 0; 42775 } else { 42776 const baseFontName = dict.get("BaseFont"); 42777 if (baseFontName instanceof Name) { 42778 const metrics = this.getBaseFontMetrics(baseFontName.name); 42779 glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties); 42780 defaultWidth = metrics.defaultWidth; 42781 } 42782 } 42783 } 42784 let isMonospace = true; 42785 let firstWidth = defaultWidth; 42786 for (const glyph in glyphsWidths) { 42787 const glyphWidth = glyphsWidths[glyph]; 42788 if (!glyphWidth) { 42789 continue; 42790 } 42791 if (!firstWidth) { 42792 firstWidth = glyphWidth; 42793 continue; 42794 } 42795 if (firstWidth !== glyphWidth) { 42796 isMonospace = false; 42797 break; 42798 } 42799 } 42800 if (isMonospace) { 42801 properties.flags |= FontFlags.FixedPitch; 42802 } else { 42803 properties.flags &= ~FontFlags.FixedPitch; 42804 } 42805 properties.defaultWidth = defaultWidth; 42806 properties.widths = glyphsWidths; 42807 properties.defaultVMetrics = defaultVMetrics; 42808 properties.vmetrics = glyphsVMetrics; 42809 } 42810 isSerifFont(baseFontName) { 42811 const fontNameWoStyle = baseFontName.split("-", 1)[0]; 42812 return fontNameWoStyle in getSerifFonts() || /serif/
vendor: 10,254 bytes, lines 42812-43098
42812gi.test(fontNameWoStyle); 42813 } 42814 getBaseFontMetrics(name) { 42815 let defaultWidth = 0; 42816 let widths = Object.create(null); 42817 let monospace = false; 42818 let fontName = normalizeFontName(name); 42819 const stdFontMap = getStdFontMap(); 42820 fontName = stdFontMap[fontName] || fontName; 42821 const Metrics = getMetrics(); 42822 const glyphWidths = Metrics[fontName] ?? Metrics[this.isSerifFont(name) ? "Times-Roman" : "Helvetica"]; 42823 if (typeof glyphWidths === "number") { 42824 defaultWidth = glyphWidths; 42825 monospace = true; 42826 } else { 42827 widths = glyphWidths(); 42828 } 42829 return { 42830 defaultWidth, 42831 monospace, 42832 widths 42833 }; 42834 } 42835 buildCharCodeToWidth(widthsByGlyphName, properties) { 42836 const widths = Object.create(null); 42837 const differences = properties.differences; 42838 const encoding = properties.defaultEncoding; 42839 for (let charCode = 0; charCode < 256; charCode++) { 42840 if (charCode in differences && widthsByGlyphName[differences[charCode]]) { 42841 widths[charCode] = widthsByGlyphName[differences[charCode]]; 42842 continue; 42843 } 42844 if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) { 42845 widths[charCode] = widthsByGlyphName[encoding[charCode]]; 42846 continue; 42847 } 42848 } 42849 return widths; 42850 } 42851 preEvaluateFont(dict) { 42852 const baseDict = dict; 42853 let type = dict.get("Subtype"); 42854 if (!(type instanceof Name)) { 42855 throw new FormatError("invalid font Subtype"); 42856 } 42857 let composite = false; 42858 let hash; 42859 if (type.name === "Type0") { 42860 const df = dict.get("DescendantFonts"); 42861 if (!df) { 42862 throw new FormatError("Descendant fonts are not specified"); 42863 } 42864 dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df; 42865 if (!(dict instanceof Dict)) { 42866 throw new FormatError("Descendant font is not a dictionary."); 42867 } 42868 type = dict.get("Subtype"); 42869 if (!(type instanceof Name)) { 42870 throw new FormatError("invalid font Subtype"); 42871 } 42872 composite = true; 42873 } 42874 let firstChar = dict.get("FirstChar"); 42875 if (!Number.isInteger(firstChar)) { 42876 firstChar = 0; 42877 } 42878 let lastChar = dict.get("LastChar"); 42879 if (!Number.isInteger(lastChar)) { 42880 lastChar = composite ? 0xffff : 0xff; 42881 } 42882 const descriptor = dict.get("FontDescriptor"); 42883 const toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode"); 42884 if (descriptor) { 42885 hash = new MurmurHash3_64(); 42886 const encoding = baseDict.getRaw("Encoding"); 42887 if (encoding instanceof Name) { 42888 hash.update(encoding.name); 42889 } else if (encoding instanceof Ref) { 42890 hash.update(encoding.toString()); 42891 } else if (encoding instanceof Dict) { 42892 for (const entry of encoding.getRawValues()) { 42893 if (entry instanceof Name) { 42894 hash.update(entry.name); 42895 } else if (entry instanceof Ref) { 42896 hash.update(entry.toString()); 42897 } else if (Array.isArray(entry)) { 42898 const diffLength = entry.length, 42899 diffBuf = new Array(diffLength); 42900 for (let j = 0; j < diffLength; j++) { 42901 const diffEntry = entry[j]; 42902 if (diffEntry instanceof Name) { 42903 diffBuf[j] = diffEntry.name; 42904 } else if (typeof diffEntry === "number" || diffEntry instanceof Ref) { 42905 diffBuf[j] = diffEntry.toString(); 42906 } 42907 } 42908 hash.update(diffBuf.join()); 42909 } 42910 } 42911 } 42912 hash.update(`${firstChar}-${lastChar}`); 42913 if (toUnicode instanceof BaseStream) { 42914 const stream = toUnicode.stream || toUnicode; 42915 const uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start); 42916 hash.update(uint8array); 42917 } else if (toUnicode instanceof Name) { 42918 hash.update(toUnicode.name); 42919 } 42920 const widths = dict.get("Widths") || baseDict.get("Widths"); 42921 if (Array.isArray(widths)) { 42922 const widthsBuf = []; 42923 for (const entry of widths) { 42924 if (typeof entry === "number" || entry instanceof Ref) { 42925 widthsBuf.push(entry.toString()); 42926 } 42927 } 42928 hash.update(widthsBuf.join()); 42929 } 42930 if (composite) { 42931 hash.update("compositeFont"); 42932 const compositeWidths = dict.get("W") || baseDict.get("W"); 42933 if (Array.isArray(compositeWidths)) { 42934 const widthsBuf = []; 42935 for (const entry of compositeWidths) { 42936 if (typeof entry === "number" || entry instanceof Ref) { 42937 widthsBuf.push(entry.toString()); 42938 } else if (Array.isArray(entry)) { 42939 const subWidthsBuf = []; 42940 for (const element of entry) { 42941 if (typeof element === "number" || element instanceof Ref) { 42942 subWidthsBuf.push(element.toString()); 42943 } 42944 } 42945 widthsBuf.push(`[${subWidthsBuf.join()}]`); 42946 } 42947 } 42948 hash.update(widthsBuf.join()); 42949 } 42950 const cidToGidMap = dict.getRaw("CIDToGIDMap") || baseDict.getRaw("CIDToGIDMap"); 42951 if (cidToGidMap instanceof Name) { 42952 hash.update(cidToGidMap.name); 42953 } else if (cidToGidMap instanceof Ref) { 42954 hash.update(cidToGidMap.toString()); 42955 } else if (cidToGidMap instanceof BaseStream) { 42956 hash.update(cidToGidMap.peekBytes()); 42957 } 42958 } 42959 if (type.name === "Type3") { 42960 const charProcs = baseDict.get("CharProcs"); 42961 if (charProcs instanceof Dict) { 42962 for (const [key, entry] of charProcs.getRawEntries()) { 42963 hash.update(entry instanceof Ref ? `${key}\0${entry}` : key); 42964 } 42965 } 42966 } 42967 } 42968 return { 42969 descriptor, 42970 dict, 42971 baseDict, 42972 composite, 42973 type: type.name, 42974 firstChar, 42975 lastChar, 42976 toUnicode, 42977 hash: hash ? hash.hexdigest() : "" 42978 }; 42979 } 42980 async translateFont({ 42981 descriptor, 42982 dict, 42983 baseDict, 42984 composite, 42985 type, 42986 firstChar, 42987 lastChar, 42988 toUnicode, 42989 cssFontInfo 42990 }) { 42991 const isType3Font = type === "Type3"; 42992 if (!descriptor) { 42993 if (isType3Font) { 42994 descriptor = Dict.empty; 42995 } else { 42996 let baseFontName = dict.get("BaseFont"); 42997 if (!(baseFontName instanceof Name)) { 42998 throw new FormatError("Base font is not specified"); 42999 } 43000 baseFontName = normalizeFontName(baseFontName.name); 43001 const metrics = this.getBaseFontMetrics(baseFontName); 43002 const fontNameWoStyle = baseFontName.split("-", 1)[0]; 43003 const flags = (this.isSerifFont(fontNameWoStyle) ? FontFlags.Serif : 0) | (metrics.monospace ? FontFlags.FixedPitch : 0) | (getSymbolsFonts()[fontNameWoStyle] ? FontFlags.Symbolic : FontFlags.Nonsymbolic); 43004 const properties = { 43005 type, 43006 name: baseFontName, 43007 loadedName: baseDict.loadedName, 43008 systemFontInfo: null, 43009 widths: metrics.widths, 43010 defaultWidth: metrics.defaultWidth, 43011 isSimulatedFlags: true, 43012 flags, 43013 firstChar, 43014 lastChar, 43015 toUnicode, 43016 xHeight: 0, 43017 capHeight: 0, 43018 italicAngle: 0, 43019 isType3Font 43020 }; 43021 const widths = dict.get("Widths"); 43022 const standardFontName = getStandardFontName(baseFontName); 43023 let file = null; 43024 if (standardFontName) { 43025 file = await this.fetchStandardFontData(standardFontName); 43026 properties.isInternalFont = !!file; 43027 } 43028 if (!properties.isInternalFont && this.options.useSystemFonts) { 43029 properties.systemFontInfo = getFontSubstitution(this.systemFontCache, this.idFactory, this.options.standardFontDataUrl, baseFontName, standardFontName, type); 43030 } 43031 const newProperties = await this.extractDataStructures(dict, properties); 43032 if (Array.isArray(widths)) { 43033 const glyphWidths = []; 43034 let j = firstChar; 43035 for (const w of widths) { 43036 const width = this.xref.fetchIfRef(w); 43037 if (typeof width === "number") { 43038 glyphWidths[j] = width; 43039 } 43040 j++; 43041 } 43042 newProperties.widths = glyphWidths; 43043 } else { 43044 newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties); 43045 } 43046 return new Font(baseFontName, file, newProperties, this.options); 43047 } 43048 } 43049 let fontName = descriptor.get("FontName"); 43050 let baseFont = dict.get("BaseFont"); 43051 if (typeof fontName === "string") { 43052 fontName = Name.get(fontName); 43053 } 43054 if (typeof baseFont === "string") { 43055 baseFont = Name.get(baseFont); 43056 } 43057 const fontNameStr = fontName?.name; 43058 const baseFontStr = baseFont?.name; 43059 if (isType3Font) { 43060 if (!fontNameStr) { 43061 fontName = Name.get(type); 43062 } 43063 } else if (fontNameStr !== baseFontStr) { 43064 info(`The FontDescriptor's FontName is "${fontNameStr}" but ` + `should be the same as the Font's BaseFont "${baseFontStr}".`); 43065 if (fontNameStr && baseFontStr && (baseFontStr.startsWith(fontNameStr) || !isKnownFontName(fontNameStr) && isKnownFontName(baseFontStr))) { 43066 fontName = null; 43067 } 43068 fontName ||= baseFont; 43069 } 43070 if (!(fontName instanceof Name)) { 43071 throw new FormatError("invalid font name"); 43072 } 43073 let fontFile, subtype, length1, length2, length3; 43074 try { 43075 fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3"); 43076 if (fontFile) { 43077 if (!(fontFile instanceof BaseStream)) { 43078 throw new FormatError("FontFile should be a stream"); 43079 } else { 43080 if (fontFile.isAsync) { 43081 const bytes = await fontFile.asyncGetBytes(); 43082 if (bytes) { 43083 fontFile = new Stream(bytes, 0, bytes.length, fontFile.dict); 43084 } 43085 } 43086 if (fontFile.isEmpty) { 43087 throw new FormatError("FontFile is empty"); 43088 } 43089 } 43090 } 43091 } catch (ex) { 43092 if (!this.options.ignoreErrors) { 43093 throw ex; 43094 } 43095 warn(`translateFont - fetching "${fontName.name}" font file: "${ex}".`); 43096 fontFile = null; 43097 } 43098 let isInternalFont = false;
vendor: 7,687 bytes, lines 43099-43328
43099 let glyphScaleFactors = null; 43100 let systemFontInfo = null; 43101 if (fontFile) { 43102 if (fontFile.dict) { 43103 const subtypeEntry = fontFile.dict.get("Subtype"); 43104 if (subtypeEntry instanceof Name) { 43105 subtype = subtypeEntry.name; 43106 } 43107 length1 = fontFile.dict.get("Length1"); 43108 length2 = fontFile.dict.get("Length2"); 43109 length3 = fontFile.dict.get("Length3"); 43110 } 43111 } else if (cssFontInfo) { 43112 const standardFontName = getXfaFontName(fontName.name); 43113 if (standardFontName) { 43114 cssFontInfo.fontFamily = `${cssFontInfo.fontFamily}-PdfJS-XFA`; 43115 cssFontInfo.metrics = standardFontName.metrics || null; 43116 glyphScaleFactors = standardFontName.factors || null; 43117 fontFile = await this.fetchStandardFontData(standardFontName.name); 43118 isInternalFont = !!fontFile; 43119 baseDict = dict = getXfaFontDict(fontName.name); 43120 composite = true; 43121 } 43122 } else if (!isType3Font) { 43123 const standardFontName = getStandardFontName(fontName.name); 43124 if (standardFontName) { 43125 fontFile = await this.fetchStandardFontData(standardFontName); 43126 isInternalFont = !!fontFile; 43127 } 43128 if (!isInternalFont && this.options.useSystemFonts) { 43129 systemFontInfo = getFontSubstitution(this.systemFontCache, this.idFactory, this.options.standardFontDataUrl, fontName.name, standardFontName, type); 43130 } 43131 } 43132 const fontMatrix = lookupMatrix(dict.getArray("FontMatrix"), FONT_IDENTITY_MATRIX); 43133 const bbox = lookupNormalRect(descriptor.getArray("FontBBox") || dict.getArray("FontBBox"), isType3Font ? [0, 0, 0, 0] : undefined); 43134 let ascent = descriptor.get("Ascent"); 43135 if (typeof ascent !== "number") { 43136 ascent = undefined; 43137 } 43138 let descent = descriptor.get("Descent"); 43139 if (typeof descent !== "number") { 43140 descent = undefined; 43141 } 43142 let xHeight = descriptor.get("XHeight"); 43143 if (typeof xHeight !== "number") { 43144 xHeight = 0; 43145 } 43146 let capHeight = descriptor.get("CapHeight"); 43147 if (typeof capHeight !== "number") { 43148 capHeight = 0; 43149 } 43150 let flags = descriptor.get("Flags"); 43151 if (!Number.isInteger(flags)) { 43152 flags = 0; 43153 } 43154 let italicAngle = descriptor.get("ItalicAngle"); 43155 if (typeof italicAngle !== "number") { 43156 italicAngle = 0; 43157 } 43158 const properties = { 43159 type, 43160 name: fontName.name, 43161 subtype, 43162 file: fontFile, 43163 length1, 43164 length2, 43165 length3, 43166 isInternalFont, 43167 loadedName: baseDict.loadedName, 43168 composite, 43169 fixedPitch: false, 43170 fontMatrix, 43171 firstChar, 43172 lastChar, 43173 toUnicode, 43174 bbox, 43175 ascent, 43176 descent, 43177 xHeight, 43178 capHeight, 43179 flags, 43180 italicAngle, 43181 isType3Font, 43182 cssFontInfo, 43183 scaleFactors: glyphScaleFactors, 43184 systemFontInfo 43185 }; 43186 if (composite) { 43187 const cidEncoding = baseDict.get("Encoding"); 43188 if (cidEncoding instanceof Name) { 43189 properties.cidEncoding = cidEncoding.name; 43190 } 43191 const cMap = await CMapFactory.create({ 43192 encoding: cidEncoding, 43193 fetchBuiltInCMap: this._fetchBuiltInCMapBound, 43194 useCMap: null 43195 }); 43196 properties.cMap = cMap; 43197 properties.vertical = properties.cMap.vertical; 43198 } 43199 const newProperties = await this.extractDataStructures(dict, properties); 43200 this.extractWidths(dict, descriptor, newProperties); 43201 return new Font(fontName.name, fontFile, newProperties, this.options); 43202 } 43203 static buildFontPaths(font, glyphs, handler, evaluatorOptions) { 43204 function buildPath(fontChar) { 43205 const glyphName = `${font.loadedName}_path_${fontChar}`; 43206 try { 43207 if (font.renderer.hasBuiltPath(fontChar)) { 43208 return; 43209 } 43210 const buffer = compileFontPathInfo(font.renderer.getPathJs(fontChar)); 43211 handler.send("commonobj", [glyphName, "FontPath", buffer], [buffer]); 43212 } catch (reason) { 43213 if (evaluatorOptions.ignoreErrors) { 43214 warn(`buildFontPaths - ignoring ${glyphName} glyph: "${reason}".`); 43215 return; 43216 } 43217 throw reason; 43218 } 43219 } 43220 for (const glyph of glyphs) { 43221 buildPath(glyph.fontChar); 43222 const accent = glyph.accent; 43223 if (accent?.fontChar) { 43224 buildPath(accent.fontChar); 43225 } 43226 } 43227 } 43228 static get fallbackFontDict() { 43229 const dict = new Dict(); 43230 dict.set("BaseFont", Name.get("Helvetica")); 43231 dict.set("Type", Name.get("FallbackType")); 43232 dict.set("Subtype", Name.get("FallbackType")); 43233 dict.set("Encoding", Name.get("WinAnsiEncoding")); 43234 return shadow(this, "fallbackFontDict", dict); 43235 } 43236} 43237class TranslatedFont { 43238 #sent = false; 43239 #type3Loaded = null; 43240 constructor({ 43241 loadedName, 43242 font, 43243 dict 43244 }) { 43245 this.loadedName = loadedName; 43246 this.font = font; 43247 this.dict = dict; 43248 this.type3Dependencies = font.isType3Font ? new Set() : null; 43249 } 43250 send(handler) { 43251 if (this.#sent) { 43252 return; 43253 } 43254 this.#sent = true; 43255 const fontData = this.font.exportData(), 43256 transfers = fontData.buffer ? [fontData.buffer] : null; 43257 handler.send("commonobj", [this.loadedName, "Font", fontData], transfers); 43258 } 43259 fallback(handler, evaluatorOptions) { 43260 if (!this.font.data) { 43261 return; 43262 } 43263 this.font.disableFontFace = true; 43264 PartialEvaluator.buildFontPaths(this.font, this.font.glyphCacheValues, handler, evaluatorOptions); 43265 } 43266 loadType3Data(evaluator, resources, task) { 43267 if (this.#type3Loaded) { 43268 return this.#type3Loaded; 43269 } 43270 const { 43271 font, 43272 type3Dependencies 43273 } = this; 43274 assert(font.isType3Font, "Must be a Type3 font."); 43275 const type3Evaluator = evaluator.clone({ 43276 ignoreErrors: false 43277 }); 43278 const type3FontRefs = new RefSet(evaluator.type3FontRefs); 43279 if (this.dict.objId && !type3FontRefs.has(this.dict.objId)) { 43280 type3FontRefs.put(this.dict.objId); 43281 } 43282 type3Evaluator.type3FontRefs = type3FontRefs; 43283 let loadCharProcsPromise = Promise.resolve(); 43284 const charProcs = this.dict.get("CharProcs"); 43285 const fontResources = this.dict.get("Resources") || resources; 43286 const charProcOperatorList = Object.create(null); 43287 const [x0, y0, x1, y1] = font.bbox, 43288 width = x1 - x0, 43289 height = y1 - y0; 43290 const fontBBoxSize = Math.hypot(width, height); 43291 for (const key of charProcs.getKeys()) { 43292 loadCharProcsPromise = loadCharProcsPromise.then(() => { 43293 const glyphStream = charProcs.get(key); 43294 const operatorList = new OperatorList(); 43295 return type3Evaluator.getOperatorList({ 43296 stream: glyphStream, 43297 task, 43298 resources: fontResources, 43299 operatorList 43300 }).then(() => { 43301 switch (operatorList.fnArray[0]) { 43302 case OPS.setCharWidthAndBounds: 43303 this.#removeType3ColorOperators(operatorList, fontBBoxSize); 43304 break; 43305 case OPS.setCharWidth: 43306 if (!fontBBoxSize) { 43307 this.#guessType3FontBBox(operatorList); 43308 } 43309 break; 43310 } 43311 charProcOperatorList[key] = operatorList.getIR(); 43312 for (const dependency of operatorList.dependencies) { 43313 type3Dependencies.add(dependency); 43314 } 43315 }).catch(function (reason) { 43316 warn(`Type3 font resource "${key}" is not available.`); 43317 const dummyOperatorList = new OperatorList(); 43318 charProcOperatorList[key] = dummyOperatorList.getIR(); 43319 }); 43320 }); 43321 } 43322 this.#type3Loaded = loadCharProcsPromise.then(() => { 43323 font.charProcOperatorList = charProcOperatorList; 43324 if (this._bbox) { 43325 font.isCharBBox = true; 43326 font.bbox = this._bbox; 43327 } 43328 }
vendor: 15,528 bytes, lines 43328-44000
43328); 43329 return this.#type3Loaded; 43330 } 43331 #removeType3ColorOperators(operatorList, fontBBoxSize = NaN) { 43332 const charBBox = Util.normalizeRect(operatorList.argsArray[0].slice(2)), 43333 width = charBBox[2] - charBBox[0], 43334 height = charBBox[3] - charBBox[1]; 43335 const charBBoxSize = Math.hypot(width, height); 43336 if (width === 0 || height === 0) { 43337 operatorList.fnArray.splice(0, 1); 43338 operatorList.argsArray.splice(0, 1); 43339 } else if (fontBBoxSize === 0 || Math.round(charBBoxSize / fontBBoxSize) >= 10) { 43340 this._bbox ??= BBOX_INIT.slice(); 43341 Util.rectBoundingBox(...charBBox, this._bbox); 43342 } 43343 let i = 0, 43344 ii = operatorList.length; 43345 while (i < ii) { 43346 switch (operatorList.fnArray[i]) { 43347 case OPS.setCharWidthAndBounds: 43348 break; 43349 case OPS.setStrokeColorSpace: 43350 case OPS.setFillColorSpace: 43351 case OPS.setStrokeColor: 43352 case OPS.setStrokeColorN: 43353 case OPS.setFillColor: 43354 case OPS.setFillColorN: 43355 case OPS.setStrokeGray: 43356 case OPS.setFillGray: 43357 case OPS.setStrokeRGBColor: 43358 case OPS.setFillRGBColor: 43359 case OPS.setStrokeCMYKColor: 43360 case OPS.setFillCMYKColor: 43361 case OPS.shadingFill: 43362 case OPS.setRenderingIntent: 43363 operatorList.fnArray.splice(i, 1); 43364 operatorList.argsArray.splice(i, 1); 43365 ii--; 43366 continue; 43367 case OPS.setGState: 43368 const [gStateObj] = operatorList.argsArray[i]; 43369 let j = 0, 43370 jj = gStateObj.length; 43371 while (j < jj) { 43372 const [gStateKey] = gStateObj[j]; 43373 switch (gStateKey) { 43374 case "TR": 43375 case "TR2": 43376 case "HT": 43377 case "BG": 43378 case "BG2": 43379 case "UCR": 43380 case "UCR2": 43381 gStateObj.splice(j, 1); 43382 jj--; 43383 continue; 43384 } 43385 j++; 43386 } 43387 break; 43388 } 43389 i++; 43390 } 43391 } 43392 #guessType3FontBBox(operatorList) { 43393 let i = 1; 43394 const ii = operatorList.length; 43395 while (i < ii) { 43396 switch (operatorList.fnArray[i]) { 43397 case OPS.constructPath: 43398 const minMax = operatorList.argsArray[i][2]; 43399 this._bbox ??= BBOX_INIT.slice(); 43400 Util.rectBoundingBox(...minMax, this._bbox); 43401 break; 43402 } 43403 i++; 43404 } 43405 } 43406} 43407class StateManager { 43408 constructor(initialState = new EvalState()) { 43409 this.state = initialState; 43410 this.stateStack = []; 43411 } 43412 save() { 43413 const old = this.state; 43414 this.stateStack.push(this.state); 43415 this.state = old.clone(); 43416 } 43417 restore() { 43418 const prev = this.stateStack.pop(); 43419 if (prev) { 43420 this.state = prev; 43421 } 43422 } 43423 transform(args) { 43424 this.state.ctm = Util.transform(this.state.ctm, args); 43425 } 43426} 43427class TextState { 43428 ctm = new Float32Array(IDENTITY_MATRIX); 43429 fontName = null; 43430 fontSize = 0; 43431 loadedName = null; 43432 font = null; 43433 fontMatrix = FONT_IDENTITY_MATRIX; 43434 textMatrix = IDENTITY_MATRIX.slice(); 43435 textLineMatrix = IDENTITY_MATRIX.slice(); 43436 charSpacing = 0; 43437 wordSpacing = 0; 43438 leading = 0; 43439 textHScale = 1; 43440 textRise = 0; 43441 setTextMatrix(a, b, c, d, e, f) { 43442 const m = this.textMatrix; 43443 m[0] = a; 43444 m[1] = b; 43445 m[2] = c; 43446 m[3] = d; 43447 m[4] = e; 43448 m[5] = f; 43449 } 43450 setTextLineMatrix(a, b, c, d, e, f) { 43451 const m = this.textLineMatrix; 43452 m[0] = a; 43453 m[1] = b; 43454 m[2] = c; 43455 m[3] = d; 43456 m[4] = e; 43457 m[5] = f; 43458 } 43459 translateTextMatrix(x, y) { 43460 const m = this.textMatrix; 43461 m[4] = m[0] * x + m[2] * y + m[4]; 43462 m[5] = m[1] * x + m[3] * y + m[5]; 43463 } 43464 translateTextLineMatrix(x, y) { 43465 const m = this.textLineMatrix; 43466 m[4] = m[0] * x + m[2] * y + m[4]; 43467 m[5] = m[1] * x + m[3] * y + m[5]; 43468 } 43469 carriageReturn() { 43470 this.translateTextLineMatrix(0, -this.leading); 43471 this.textMatrix = this.textLineMatrix.slice(); 43472 } 43473 clone() { 43474 const clone = Object.assign(Object.create(this), this); 43475 clone.textMatrix = this.textMatrix.slice(); 43476 clone.textLineMatrix = this.textLineMatrix.slice(); 43477 clone.fontMatrix = this.fontMatrix.slice(); 43478 return clone; 43479 } 43480} 43481class EvalState { 43482 ctm = new Float32Array(IDENTITY_MATRIX); 43483 font = null; 43484 textRenderingMode = TextRenderingMode.FILL; 43485 _fillColorSpace = ColorSpaceUtils.gray; 43486 _strokeColorSpace = ColorSpaceUtils.gray; 43487 patternFillColorSpace = null; 43488 patternStrokeColorSpace = null; 43489 currentPointX = 0; 43490 currentPointY = 0; 43491 pathMinMax = F32_BBOX_INIT.slice(); 43492 pathBuffer = []; 43493 get fillColorSpace() { 43494 return this._fillColorSpace; 43495 } 43496 set fillColorSpace(colorSpace) { 43497 this._fillColorSpace = this.patternFillColorSpace = colorSpace; 43498 } 43499 get strokeColorSpace() { 43500 return this._strokeColorSpace; 43501 } 43502 set strokeColorSpace(colorSpace) { 43503 this._strokeColorSpace = this.patternStrokeColorSpace = colorSpace; 43504 } 43505 clone({ 43506 newPath = false 43507 } = {}) { 43508 const clone = Object.create(this); 43509 if (newPath) { 43510 clone.pathBuffer = []; 43511 clone.pathMinMax = F32_BBOX_INIT.slice(); 43512 } 43513 return clone; 43514 } 43515} 43516class EvaluatorPreprocessor { 43517 static get opMap() { 43518 return shadow(this, "opMap", Object.assign(Object.create(null), { 43519 w: { 43520 id: OPS.setLineWidth, 43521 numArgs: 1, 43522 variableArgs: false 43523 }, 43524 J: { 43525 id: OPS.setLineCap, 43526 numArgs: 1, 43527 variableArgs: false 43528 }, 43529 j: { 43530 id: OPS.setLineJoin, 43531 numArgs: 1, 43532 variableArgs: false 43533 }, 43534 M: { 43535 id: OPS.setMiterLimit, 43536 numArgs: 1, 43537 variableArgs: false 43538 }, 43539 d: { 43540 id: OPS.setDash, 43541 numArgs: 2, 43542 variableArgs: false 43543 }, 43544 ri: { 43545 id: OPS.setRenderingIntent, 43546 numArgs: 1, 43547 variableArgs: false 43548 }, 43549 i: { 43550 id: OPS.setFlatness, 43551 numArgs: 1, 43552 variableArgs: false 43553 }, 43554 gs: { 43555 id: OPS.setGState, 43556 numArgs: 1, 43557 variableArgs: false 43558 }, 43559 q: { 43560 id: OPS.save, 43561 numArgs: 0, 43562 variableArgs: false 43563 }, 43564 Q: { 43565 id: OPS.restore, 43566 numArgs: 0, 43567 variableArgs: false 43568 }, 43569 cm: { 43570 id: OPS.transform, 43571 numArgs: 6, 43572 variableArgs: false 43573 }, 43574 m: { 43575 id: OPS.moveTo, 43576 numArgs: 2, 43577 variableArgs: false 43578 }, 43579 l: { 43580 id: OPS.lineTo, 43581 numArgs: 2, 43582 variableArgs: false 43583 }, 43584 c: { 43585 id: OPS.curveTo, 43586 numArgs: 6, 43587 variableArgs: false 43588 }, 43589 v: { 43590 id: OPS.curveTo2, 43591 numArgs: 4, 43592 variableArgs: false 43593 }, 43594 y: { 43595 id: OPS.curveTo3, 43596 numArgs: 4, 43597 variableArgs: false 43598 }, 43599 h: { 43600 id: OPS.closePath, 43601 numArgs: 0, 43602 variableArgs: false 43603 }, 43604 re: { 43605 id: OPS.rectangle, 43606 numArgs: 4, 43607 variableArgs: false 43608 }, 43609 S: { 43610 id: OPS.stroke, 43611 numArgs: 0, 43612 variableArgs: false 43613 }, 43614 s: { 43615 id: OPS.closeStroke, 43616 numArgs: 0, 43617 variableArgs: false 43618 }, 43619 f: { 43620 id: OPS.fill, 43621 numArgs: 0, 43622 variableArgs: false 43623 }, 43624 F: { 43625 id: OPS.fill, 43626 numArgs: 0, 43627 variableArgs: false 43628 }, 43629 "f*": { 43630 id: OPS.eoFill, 43631 numArgs: 0, 43632 variableArgs: false 43633 }, 43634 B: { 43635 id: OPS.fillStroke, 43636 numArgs: 0, 43637 variableArgs: false 43638 }, 43639 "B*": { 43640 id: OPS.eoFillStroke, 43641 numArgs: 0, 43642 variableArgs: false 43643 }, 43644 b: { 43645 id: OPS.closeFillStroke, 43646 numArgs: 0, 43647 variableArgs: false 43648 }, 43649 "b*": { 43650 id: OPS.closeEOFillStroke, 43651 numArgs: 0, 43652 variableArgs: false 43653 }, 43654 n: { 43655 id: OPS.endPath, 43656 numArgs: 0, 43657 variableArgs: false 43658 }, 43659 W: { 43660 id: OPS.clip, 43661 numArgs: 0, 43662 variableArgs: false 43663 }, 43664 "W*": { 43665 id: OPS.eoClip, 43666 numArgs: 0, 43667 variableArgs: false 43668 }, 43669 BT: { 43670 id: OPS.beginText, 43671 numArgs: 0, 43672 variableArgs: false 43673 }, 43674 ET: { 43675 id: OPS.endText, 43676 numArgs: 0, 43677 variableArgs: false 43678 }, 43679 Tc: { 43680 id: OPS.setCharSpacing, 43681 numArgs: 1, 43682 variableArgs: false 43683 }, 43684 Tw: { 43685 id: OPS.setWordSpacing, 43686 numArgs: 1, 43687 variableArgs: false 43688 }, 43689 Tz: { 43690 id: OPS.setHScale, 43691 numArgs: 1, 43692 variableArgs: false 43693 }, 43694 TL: { 43695 id: OPS.setLeading, 43696 numArgs: 1, 43697 variableArgs: false 43698 }, 43699 Tf: { 43700 id: OPS.setFont, 43701 numArgs: 2, 43702 variableArgs: false 43703 }, 43704 Tr: { 43705 id: OPS.setTextRenderingMode, 43706 numArgs: 1, 43707 variableArgs: false 43708 }, 43709 Ts: { 43710 id: OPS.setTextRise, 43711 numArgs: 1, 43712 variableArgs: false 43713 }, 43714 Td: { 43715 id: OPS.moveText, 43716 numArgs: 2, 43717 variableArgs: false 43718 }, 43719 TD: { 43720 id: OPS.setLeadingMoveText, 43721 numArgs: 2, 43722 variableArgs: false 43723 }, 43724 Tm: { 43725 id: OPS.setTextMatrix, 43726 numArgs: 6, 43727 variableArgs: false 43728 }, 43729 "T*": { 43730 id: OPS.nextLine, 43731 numArgs: 0, 43732 variableArgs: false 43733 }, 43734 Tj: { 43735 id: OPS.showText, 43736 numArgs: 1, 43737 variableArgs: false 43738 }, 43739 TJ: { 43740 id: OPS.showSpacedText, 43741 numArgs: 1, 43742 variableArgs: false 43743 }, 43744 "'": { 43745 id: OPS.nextLineShowText, 43746 numArgs: 1, 43747 variableArgs: false 43748 }, 43749 '"': { 43750 id: OPS.nextLineSetSpacingShowText, 43751 numArgs: 3, 43752 variableArgs: false 43753 }, 43754 d0: { 43755 id: OPS.setCharWidth, 43756 numArgs: 2, 43757 variableArgs: false 43758 }, 43759 d1: { 43760 id: OPS.setCharWidthAndBounds, 43761 numArgs: 6, 43762 variableArgs: false 43763 }, 43764 CS: { 43765 id: OPS.setStrokeColorSpace, 43766 numArgs: 1, 43767 variableArgs: false 43768 }, 43769 cs: { 43770 id: OPS.setFillColorSpace, 43771 numArgs: 1, 43772 variableArgs: false 43773 }, 43774 SC: { 43775 id: OPS.setStrokeColor, 43776 numArgs: 4, 43777 variableArgs: true 43778 }, 43779 SCN: { 43780 id: OPS.setStrokeColorN, 43781 numArgs: 33, 43782 variableArgs: true 43783 }, 43784 sc: { 43785 id: OPS.setFillColor, 43786 numArgs: 4, 43787 variableArgs: true 43788 }, 43789 scn: { 43790 id: OPS.setFillColorN, 43791 numArgs: 33, 43792 variableArgs: true 43793 }, 43794 G: { 43795 id: OPS.setStrokeGray, 43796 numArgs: 1, 43797 variableArgs: false 43798 }, 43799 g: { 43800 id: OPS.setFillGray, 43801 numArgs: 1, 43802 variableArgs: false 43803 }, 43804 RG: { 43805 id: OPS.setStrokeRGBColor, 43806 numArgs: 3, 43807 variableArgs: false 43808 }, 43809 rg: { 43810 id: OPS.setFillRGBColor, 43811 numArgs: 3, 43812 variableArgs: false 43813 }, 43814 K: { 43815 id: OPS.setStrokeCMYKColor, 43816 numArgs: 4, 43817 variableArgs: false 43818 }, 43819 k: { 43820 id: OPS.setFillCMYKColor, 43821 numArgs: 4, 43822 variableArgs: false 43823 }, 43824 sh: { 43825 id: OPS.shadingFill, 43826 numArgs: 1, 43827 variableArgs: false 43828 }, 43829 BI: { 43830 id: OPS.beginInlineImage, 43831 numArgs: 0, 43832 variableArgs: false 43833 }, 43834 ID: { 43835 id: OPS.beginImageData, 43836 numArgs: 0, 43837 variableArgs: false 43838 }, 43839 EI: { 43840 id: OPS.endInlineImage, 43841 numArgs: 1, 43842 variableArgs: false 43843 }, 43844 Do: { 43845 id: OPS.paintXObject, 43846 numArgs: 1, 43847 variableArgs: false 43848 }, 43849 MP: { 43850 id: OPS.markPoint, 43851 numArgs: 1, 43852 variableArgs: false 43853 }, 43854 DP: { 43855 id: OPS.markPointProps, 43856 numArgs: 2, 43857 variableArgs: false 43858 }, 43859 BMC: { 43860 id: OPS.beginMarkedContent, 43861 numArgs: 1, 43862 variableArgs: false 43863 }, 43864 BDC: { 43865 id: OPS.beginMarkedContentProps, 43866 numArgs: 2, 43867 variableArgs: false 43868 }, 43869 EMC: { 43870 id: OPS.endMarkedContent, 43871 numArgs: 0, 43872 variableArgs: false 43873 }, 43874 BX: { 43875 id: OPS.beginCompat, 43876 numArgs: 0, 43877 variableArgs: false 43878 }, 43879 EX: { 43880 id: OPS.endCompat, 43881 numArgs: 0, 43882 variableArgs: false 43883 }, 43884 BM: null, 43885 BD: null, 43886 true: null, 43887 fa: null, 43888 fal: null, 43889 fals: null, 43890 false: null, 43891 nu: null, 43892 nul: null, 43893 null: null 43894 })); 43895 } 43896 static MAX_INVALID_PATH_OPS = 10; 43897 constructor(stream, xref, stateManager = new StateManager()) { 43898 this.parser = new Parser({ 43899 lexer: new Lexer(stream, EvaluatorPreprocessor.opMap), 43900 xref 43901 }); 43902 this.stateManager = stateManager; 43903 this.nonProcessedArgs = []; 43904 this._isPathOp = false; 43905 this._numInvalidPathOPS = 0; 43906 } 43907 get savedStatesDepth() { 43908 return this.stateManager.stateStack.length; 43909 } 43910 read(operation) { 43911 let args = operation.args; 43912 while (true) { 43913 const obj = this.parser.getObj(); 43914 if (obj instanceof Cmd) { 43915 const cmd = obj.cmd; 43916 const opSpec = EvaluatorPreprocessor.opMap[cmd]; 43917 if (!opSpec) { 43918 warn(`Unknown command "${cmd}".`); 43919 continue; 43920 } 43921 const fn = opSpec.id; 43922 const numArgs = opSpec.numArgs; 43923 let argsLength = args !== null ? args.length : 0; 43924 if (!this._isPathOp) { 43925 this._numInvalidPathOPS = 0; 43926 } 43927 this._isPathOp = fn >= OPS.moveTo && fn <= OPS.endPath; 43928 if (!opSpec.variableArgs) { 43929 if (argsLength !== numArgs) { 43930 const nonProcessedArgs = this.nonProcessedArgs; 43931 while (argsLength > numArgs) { 43932 nonProcessedArgs.push(args.shift()); 43933 argsLength--; 43934 } 43935 while (argsLength < numArgs && nonProcessedArgs.length !== 0) { 43936 if (args === null) { 43937 args = []; 43938 } 43939 args.unshift(nonProcessedArgs.pop()); 43940 argsLength++; 43941 } 43942 } 43943 if (argsLength < numArgs) { 43944 const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`; 43945 if (this._isPathOp && ++this._numInvalidPathOPS > EvaluatorPreprocessor.MAX_INVALID_PATH_OPS) { 43946 throw new FormatError(`Invalid ${partialMsg}`); 43947 } 43948 warn(`Skipping ${partialMsg}`); 43949 if (args !== null) { 43950 args.length = 0; 43951 } 43952 continue; 43953 } 43954 } else if (argsLength > numArgs) { 43955 info(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`); 43956 } 43957 this.preprocessCommand(fn, args); 43958 operation.fn = fn; 43959 operation.args = args; 43960 return true; 43961 } 43962 if (obj === EOF) { 43963 return false; 43964 } 43965 if (obj !== null) { 43966 if (args === null) { 43967 args = []; 43968 } 43969 args.push(obj); 43970 if (args.length > 33) { 43971 throw new FormatError("Too many arguments"); 43972 } 43973 } 43974 } 43975 } 43976 preprocessCommand(fn, args) { 43977 switch (fn | 0) { 43978 case OPS.save: 43979 this.stateManager.save(); 43980 break; 43981 case OPS.restore: 43982 this.stateManager.restore(); 43983 break; 43984 case OPS.transform: 43985 this.stateManager.transform(args); 43986 break; 43987 } 43988 } 43989} 43990 43991;// ./src/core/default_appearance.js 43992 43993 43994 43995 43996 43997 43998 43999 44000
vendor: 7,143 bytes, lines 44001-44225
44001 44002 44003 44004 44005 44006 44007class DefaultAppearanceEvaluator extends EvaluatorPreprocessor { 44008 constructor(str) { 44009 super(new StringStream(str)); 44010 } 44011 parse() { 44012 const operation = { 44013 fn: 0, 44014 args: [] 44015 }; 44016 const result = { 44017 fontSize: 0, 44018 fontName: "", 44019 fontColor: new Uint8ClampedArray(3) 44020 }; 44021 try { 44022 while (true) { 44023 operation.args.length = 0; 44024 if (!this.read(operation)) { 44025 break; 44026 } 44027 if (this.savedStatesDepth !== 0) { 44028 continue; 44029 } 44030 const { 44031 fn, 44032 args 44033 } = operation; 44034 switch (fn | 0) { 44035 case OPS.setFont: 44036 const [fontName, fontSize] = args; 44037 if (fontName instanceof Name) { 44038 result.fontName = fontName.name; 44039 } 44040 if (typeof fontSize === "number" && fontSize > 0) { 44041 result.fontSize = fontSize; 44042 } 44043 break; 44044 case OPS.setFillRGBColor: 44045 ColorSpaceUtils.rgb.getRgbItem(args, 0, result.fontColor, 0); 44046 break; 44047 case OPS.setFillGray: 44048 ColorSpaceUtils.gray.getRgbItem(args, 0, result.fontColor, 0); 44049 break; 44050 case OPS.setFillCMYKColor: 44051 ColorSpaceUtils.cmyk.getRgbItem(args, 0, result.fontColor, 0); 44052 break; 44053 } 44054 } 44055 } catch (reason) { 44056 warn(`parseDefaultAppearance - ignoring errors: "${reason}".`); 44057 } 44058 return result; 44059 } 44060} 44061function parseDefaultAppearance(str) { 44062 return new DefaultAppearanceEvaluator(str).parse(); 44063} 44064class AppearanceStreamEvaluator extends EvaluatorPreprocessor { 44065 constructor(stream, xref, globalColorSpaceCache) { 44066 super(stream); 44067 this.stream = stream; 44068 this.xref = xref; 44069 this.globalColorSpaceCache = globalColorSpaceCache; 44070 this.resources = stream.dict?.get("Resources"); 44071 } 44072 parse() { 44073 const operation = { 44074 fn: 0, 44075 args: [] 44076 }; 44077 let result = { 44078 scaleFactor: 1, 44079 fontSize: 0, 44080 fontName: "", 44081 fontColor: new Uint8ClampedArray(3), 44082 fillColorSpace: ColorSpaceUtils.gray 44083 }; 44084 let breakLoop = false; 44085 const stack = []; 44086 try { 44087 while (true) { 44088 operation.args.length = 0; 44089 if (breakLoop || !this.read(operation)) { 44090 break; 44091 } 44092 const { 44093 fn, 44094 args 44095 } = operation; 44096 switch (fn | 0) { 44097 case OPS.save: 44098 stack.push({ 44099 scaleFactor: result.scaleFactor, 44100 fontSize: result.fontSize, 44101 fontName: result.fontName, 44102 fontColor: result.fontColor.slice(), 44103 fillColorSpace: result.fillColorSpace 44104 }); 44105 break; 44106 case OPS.restore: 44107 result = stack.pop() || result; 44108 break; 44109 case OPS.setTextMatrix: 44110 result.scaleFactor *= Math.hypot(args[0], args[1]); 44111 break; 44112 case OPS.setFont: 44113 const [fontName, fontSize] = args; 44114 if (fontName instanceof Name) { 44115 result.fontName = fontName.name; 44116 } 44117 if (typeof fontSize === "number" && fontSize > 0) { 44118 result.fontSize = fontSize * result.scaleFactor; 44119 } 44120 break; 44121 case OPS.setFillColorSpace: 44122 result.fillColorSpace = ColorSpaceUtils.parse({ 44123 cs: args[0], 44124 xref: this.xref, 44125 resources: this.resources, 44126 pdfFunctionFactory: this._pdfFunctionFactory, 44127 globalColorSpaceCache: this.globalColorSpaceCache, 44128 localColorSpaceCache: this._localColorSpaceCache 44129 }); 44130 break; 44131 case OPS.setFillColor: 44132 const cs = result.fillColorSpace; 44133 cs.getRgbItem(args, 0, result.fontColor, 0); 44134 break; 44135 case OPS.setFillRGBColor: 44136 ColorSpaceUtils.rgb.getRgbItem(args, 0, result.fontColor, 0); 44137 break; 44138 case OPS.setFillGray: 44139 ColorSpaceUtils.gray.getRgbItem(args, 0, result.fontColor, 0); 44140 break; 44141 case OPS.setFillCMYKColor: 44142 ColorSpaceUtils.cmyk.getRgbItem(args, 0, result.fontColor, 0); 44143 break; 44144 case OPS.showText: 44145 case OPS.showSpacedText: 44146 case OPS.nextLineShowText: 44147 case OPS.nextLineSetSpacingShowText: 44148 breakLoop = true; 44149 break; 44150 } 44151 } 44152 } catch (reason) { 44153 warn(`parseAppearanceStream - ignoring errors: "${reason}".`); 44154 } 44155 this.stream.reset(); 44156 delete result.scaleFactor; 44157 delete result.fillColorSpace; 44158 return result; 44159 } 44160 get _localColorSpaceCache() { 44161 return shadow(this, "_localColorSpaceCache", new LocalColorSpaceCache()); 44162 } 44163 get _pdfFunctionFactory() { 44164 return shadow(this, "_pdfFunctionFactory", new PDFFunctionFactory({ 44165 xref: this.xref 44166 })); 44167 } 44168} 44169function parseAppearanceStream(stream, xref, globalColorSpaceCache) { 44170 return new AppearanceStreamEvaluator(stream, xref, globalColorSpaceCache).parse(); 44171} 44172function getPdfColor(color, isFill) { 44173 if (color[0] === color[1] && color[1] === color[2]) { 44174 const gray = color[0] / 255; 44175 return `${numberToString(gray)} ${isFill ? "g" : "G"}`; 44176 } 44177 return Array.from(color, c => numberToString(c / 255)).join(" ") + ` ${isFill ? "rg" : "RG"}`; 44178} 44179function createDefaultAppearance({ 44180 fontSize, 44181 fontName, 44182 fontColor 44183}) { 44184 return `/${escapePDFName(fontName)} ${fontSize} Tf ${getPdfColor(fontColor, true)}`; 44185} 44186class FakeUnicodeFont { 44187 static #fontNameId = 1; 44188 constructor(xref, fontFamily) { 44189 this.xref = xref; 44190 this.widths = null; 44191 this.firstChar = Infinity; 44192 this.lastChar = -Infinity; 44193 this.fontFamily = fontFamily; 44194 const canvas = new OffscreenCanvas(1, 1); 44195 this.ctxMeasure = canvas.getContext("2d", { 44196 willReadFrequently: true 44197 }); 44198 this.fontName = Name.get(`InvalidPDFjsFont_${fontFamily}_${FakeUnicodeFont.#fontNameId++}`); 44199 } 44200 get fontDescriptorRef() { 44201 if (!FakeUnicodeFont._fontDescriptorRef) { 44202 const fontDescriptor = new Dict(this.xref); 44203 fontDescriptor.setIfName("Type", "FontDescriptor"); 44204 fontDescriptor.set("FontName", this.fontName); 44205 fontDescriptor.set("FontFamily", "MyriadPro Regular"); 44206 fontDescriptor.set("FontBBox", [0, 0, 0, 0]); 44207 fontDescriptor.setIfName("FontStretch", "Normal"); 44208 fontDescriptor.set("FontWeight", 400); 44209 fontDescriptor.set("ItalicAngle", 0); 44210 FakeUnicodeFont._fontDescriptorRef = this.xref.getNewPersistentRef(fontDescriptor); 44211 } 44212 return FakeUnicodeFont._fontDescriptorRef; 44213 } 44214 get descendantFontRef() { 44215 const descendantFont = new Dict(this.xref); 44216 descendantFont.set("BaseFont", this.fontName); 44217 descendantFont.setIfName("Type", "Font"); 44218 descendantFont.setIfName("Subtype", "CIDFontType0"); 44219 descendantFont.setIfName("CIDToGIDMap", "Identity"); 44220 descendantFont.set("FirstChar", this.firstChar); 44221 descendantFont.set("LastChar", this.lastChar); 44222 descendantFont.set("FontDescriptor", this.fontDescriptorRef); 44223 descendantFont.set("DW", 1000); 44224 const widths = []; 44225 const chars = [...this.widths
vendor: 5,572 bytes, lines 44225-44384
44225].sort(); 44226 let currentChar = null; 44227 let currentWidths = null; 44228 for (const [char, width] of chars) { 44229 if (!currentChar) { 44230 currentChar = char; 44231 currentWidths = [width]; 44232 continue; 44233 } 44234 if (char === currentChar + currentWidths.length) { 44235 currentWidths.push(width); 44236 } else { 44237 widths.push(currentChar, currentWidths); 44238 currentChar = char; 44239 currentWidths = [width]; 44240 } 44241 } 44242 if (currentChar) { 44243 widths.push(currentChar, currentWidths); 44244 } 44245 descendantFont.set("W", widths); 44246 const cidSystemInfo = new Dict(this.xref); 44247 cidSystemInfo.set("Ordering", "Identity"); 44248 cidSystemInfo.set("Registry", "Adobe"); 44249 cidSystemInfo.set("Supplement", 0); 44250 descendantFont.set("CIDSystemInfo", cidSystemInfo); 44251 return this.xref.getNewPersistentRef(descendantFont); 44252 } 44253 get baseFontRef() { 44254 const baseFont = new Dict(this.xref); 44255 baseFont.set("BaseFont", this.fontName); 44256 baseFont.setIfName("Type", "Font"); 44257 baseFont.setIfName("Subtype", "Type0"); 44258 baseFont.setIfName("Encoding", "Identity-H"); 44259 baseFont.set("DescendantFonts", [this.descendantFontRef]); 44260 baseFont.setIfName("ToUnicode", "Identity-H"); 44261 return this.xref.getNewPersistentRef(baseFont); 44262 } 44263 get resources() { 44264 const resources = new Dict(this.xref); 44265 const font = new Dict(this.xref); 44266 font.set(this.fontName.name, this.baseFontRef); 44267 resources.set("Font", font); 44268 return resources; 44269 } 44270 _createContext() { 44271 this.widths = new Map(); 44272 this.ctxMeasure.font = `1000px ${this.fontFamily}`; 44273 return this.ctxMeasure; 44274 } 44275 createFontResources(text) { 44276 const ctx = this._createContext(); 44277 for (const line of text.split(/\r\n?|\n/)) { 44278 for (const char of line.split("")) { 44279 const code = char.charCodeAt(0); 44280 if (this.widths.has(code)) { 44281 continue; 44282 } 44283 const metrics = ctx.measureText(char); 44284 const width = Math.ceil(metrics.width); 44285 this.widths.set(code, width); 44286 this.firstChar = Math.min(code, this.firstChar); 44287 this.lastChar = Math.max(code, this.lastChar); 44288 } 44289 } 44290 return this.resources; 44291 } 44292 static getFirstPositionInfo(rect, rotation, fontSize) { 44293 const [x1, y1, x2, y2] = rect; 44294 let w = x2 - x1; 44295 let h = y2 - y1; 44296 if (rotation % 180 !== 0) { 44297 [w, h] = [h, w]; 44298 } 44299 const lineHeight = LINE_FACTOR * fontSize; 44300 const lineDescent = LINE_DESCENT_FACTOR * fontSize; 44301 return { 44302 coords: [0, h + lineDescent - lineHeight], 44303 bbox: [0, 0, w, h], 44304 matrix: rotation !== 0 ? getRotationMatrix(rotation, h, lineHeight) : undefined 44305 }; 44306 } 44307 createAppearance(text, rect, rotation, fontSize, bgColor, strokeAlpha) { 44308 const ctx = this._createContext(); 44309 const lines = []; 44310 let maxWidth = -Infinity; 44311 for (const line of text.split(/\r\n?|\n/)) { 44312 lines.push(line); 44313 const lineWidth = ctx.measureText(line).width; 44314 maxWidth = Math.max(maxWidth, lineWidth); 44315 for (const code of codePointIter(line)) { 44316 const char = String.fromCodePoint(code); 44317 let width = this.widths.get(code); 44318 if (width === undefined) { 44319 const metrics = ctx.measureText(char); 44320 width = Math.ceil(metrics.width); 44321 this.widths.set(code, width); 44322 this.firstChar = Math.min(code, this.firstChar); 44323 this.lastChar = Math.max(code, this.lastChar); 44324 } 44325 } 44326 } 44327 maxWidth *= fontSize / 1000; 44328 const [x1, y1, x2, y2] = rect; 44329 let w = x2 - x1; 44330 let h = y2 - y1; 44331 if (rotation % 180 !== 0) { 44332 [w, h] = [h, w]; 44333 } 44334 let hscale = 1; 44335 if (maxWidth > w) { 44336 hscale = w / maxWidth; 44337 } 44338 let vscale = 1; 44339 const lineHeight = LINE_FACTOR * fontSize; 44340 const lineDescent = LINE_DESCENT_FACTOR * fontSize; 44341 const maxHeight = lineHeight * lines.length; 44342 if (maxHeight > h) { 44343 vscale = h / maxHeight; 44344 } 44345 const fscale = Math.min(hscale, vscale); 44346 const newFontSize = fontSize * fscale; 44347 const buffer = ["q", `0 0 ${numberToString(w)} ${numberToString(h)} re W n`, `BT`, `1 0 0 1 0 ${numberToString(h + lineDescent)} Tm 0 Tc ${getPdfColor(bgColor, true)}`, `/${this.fontName.name} ${numberToString(newFontSize)} Tf`]; 44348 const { 44349 resources 44350 } = this; 44351 strokeAlpha = typeof strokeAlpha === "number" && strokeAlpha >= 0 && strokeAlpha <= 1 ? strokeAlpha : 1; 44352 if (strokeAlpha !== 1) { 44353 buffer.push("/R0 gs"); 44354 const extGState = new Dict(this.xref); 44355 const r0 = new Dict(this.xref); 44356 r0.set("ca", strokeAlpha); 44357 r0.set("CA", strokeAlpha); 44358 r0.setIfName("Type", "ExtGState"); 44359 extGState.set("R0", r0); 44360 resources.set("ExtGState", extGState); 44361 } 44362 const vShift = numberToString(lineHeight); 44363 for (const line of lines) { 44364 buffer.push(`0 -${vShift} Td <${stringToUTF16HexString(line)}> Tj`); 44365 } 44366 buffer.push("ET", "Q"); 44367 const appearance = buffer.join("\n"); 44368 const appearanceStreamDict = new Dict(this.xref); 44369 appearanceStreamDict.setIfName("Subtype", "Form"); 44370 appearanceStreamDict.setIfName("Type", "XObject"); 44371 appearanceStreamDict.set("BBox", [0, 0, w, h]); 44372 appearanceStreamDict.set("Length", appearance.length); 44373 appearanceStreamDict.set("Resources", resources); 44374 if (rotation) { 44375 const matrix = getRotationMatrix(rotation, w, h); 44376 appearanceStreamDict.set("Matrix", matrix); 44377 } 44378 const ap = new StringStream(appearance); 44379 ap.dict = appearanceStreamDict; 44380 return ap; 44381 } 44382} 44383 44384;// ./src/shared/scripting_utils.js
vendor: 5,516 bytes, lines 44385-44604
44385/* unused harmony import specifier */ var scripting_utils_MathClamp; 44386 44387 44388 44389function makeColorComp(n) { 44390 return Math.floor(scripting_utils_MathClamp(n, 0, 1) * 255).toString(16).padStart(2, "0"); 44391} 44392function scaleAndClamp(x) { 44393 return scripting_utils_MathClamp(x, 0, 1) * 255; 44394} 44395class ColorConverters { 44396 static CMYK_G([c, y, m, k]) { 44397 return ["G", 1 - Math.min(1, 0.3 * c + 0.59 * m + 0.11 * y + k)]; 44398 } 44399 static G_CMYK([g]) { 44400 return ["CMYK", 0, 0, 0, 1 - g]; 44401 } 44402 static G_RGB([g]) { 44403 return ["RGB", g, g, g]; 44404 } 44405 static G_rgb([g]) { 44406 g = scaleAndClamp(g); 44407 return [g, g, g]; 44408 } 44409 static G_HTML([g]) { 44410 const G = makeColorComp(g); 44411 return `#${G}${G}${G}`; 44412 } 44413 static RGB_G([r, g, b]) { 44414 return ["G", 0.3 * r + 0.59 * g + 0.11 * b]; 44415 } 44416 static RGB_rgb(color) { 44417 return color.map(scaleAndClamp); 44418 } 44419 static RGB_HTML(color) { 44420 return `#${color.map(makeColorComp).join("")}`; 44421 } 44422 static T_HTML() { 44423 return "#00000000"; 44424 } 44425 static T_rgb() { 44426 return [null]; 44427 } 44428 static CMYK_RGB([c, y, m, k]) { 44429 return ["RGB", 1 - Math.min(1, c + k), 1 - Math.min(1, m + k), 1 - Math.min(1, y + k)]; 44430 } 44431 static CMYK_rgb([c, y, m, k]) { 44432 return [scaleAndClamp(1 - Math.min(1, c + k)), scaleAndClamp(1 - Math.min(1, m + k)), scaleAndClamp(1 - Math.min(1, y + k))]; 44433 } 44434 static CMYK_HTML(components) { 44435 const rgb = this.CMYK_RGB(components).slice(1); 44436 return this.RGB_HTML(rgb); 44437 } 44438 static RGB_CMYK([r, g, b]) { 44439 const c = 1 - r; 44440 const m = 1 - g; 44441 const y = 1 - b; 44442 const k = Math.min(c, m, y); 44443 return ["CMYK", c, m, y, k]; 44444 } 44445} 44446const DateFormats = ["m/d", "m/d/yy", "mm/dd/yy", "mm/yy", "d-mmm", "d-mmm-yy", "dd-mmm-yy", "yy-mm-dd", "mmm-yy", "mmmm-yy", "mmm d, yyyy", "mmmm d, yyyy", "m/d/yy h:MM tt", "m/d/yy HH:MM"]; 44447const TimeFormats = ["HH:MM", "h:MM tt", "HH:MM:ss", "h:MM:ss tt"]; 44448 44449// EXTERNAL MODULE: ./node_modules/core-js/modules/es.json.stringify.js 44450var es_json_stringify = __webpack_require__(3110); 44451;// ./src/core/name_number_tree.js 44452 44453 44454 44455 44456 44457class NameOrNumberTree { 44458 constructor(root, xref, type) { 44459 this.root = root; 44460 this.xref = xref; 44461 this._type = type; 44462 } 44463 getAll(isRaw = false) { 44464 const map = new Map(); 44465 if (!this.root) { 44466 return map; 44467 } 44468 const xref = this.xref; 44469 const processed = new RefSet(); 44470 if (this.root instanceof Ref) { 44471 processed.put(this.root); 44472 } 44473 const queue = [this.root]; 44474 while (queue.length > 0) { 44475 const obj = xref.fetchIfRef(queue.shift()); 44476 if (!(obj instanceof Dict)) { 44477 continue; 44478 } 44479 if (obj.has("Kids")) { 44480 const kids = obj.get("Kids"); 44481 if (!Array.isArray(kids)) { 44482 continue; 44483 } 44484 for (const kid of kids) { 44485 if (kid instanceof Ref) { 44486 if (processed.has(kid)) { 44487 throw new FormatError(`Duplicate entry in "${this._type}" tree.`); 44488 } 44489 processed.put(kid); 44490 } 44491 queue.push(kid); 44492 } 44493 continue; 44494 } 44495 const entries = obj.get(this._type); 44496 if (!Array.isArray(entries)) { 44497 continue; 44498 } 44499 for (let i = 0, ii = entries.length; i < ii; i += 2) { 44500 map.set(xref.fetchIfRef(entries[i]), isRaw ? entries[i + 1] : xref.fetchIfRef(entries[i + 1])); 44501 } 44502 } 44503 return map; 44504 } 44505 getRaw(key) { 44506 if (!this.root) { 44507 return null; 44508 } 44509 const xref = this.xref; 44510 let kidsOrEntries = xref.fetchIfRef(this.root); 44511 let loopCount = 0; 44512 const MAX_LEVELS = 10; 44513 while (kidsOrEntries.has("Kids")) { 44514 if (++loopCount > MAX_LEVELS) { 44515 warn(`Search depth limit reached for "${this._type}" tree.`); 44516 return null; 44517 } 44518 const kids = kidsOrEntries.get("Kids"); 44519 if (!Array.isArray(kids)) { 44520 return null; 44521 } 44522 let l = 0, 44523 r = kids.length - 1; 44524 while (l <= r) { 44525 const m = l + r >> 1; 44526 const kid = xref.fetchIfRef(kids[m]); 44527 const limits = kid.get("Limits"); 44528 if (key < xref.fetchIfRef(limits[0])) { 44529 r = m - 1; 44530 } else if (key > xref.fetchIfRef(limits[1])) { 44531 l = m + 1; 44532 } else { 44533 kidsOrEntries = kid; 44534 break; 44535 } 44536 } 44537 if (l > r) { 44538 return null; 44539 } 44540 } 44541 const entries = kidsOrEntries.get(this._type); 44542 if (Array.isArray(entries)) { 44543 let l = 0, 44544 r = entries.length - 2; 44545 while (l <= r) { 44546 const tmp = l + r >> 1, 44547 m = tmp + (tmp & 1); 44548 const currentKey = xref.fetchIfRef(entries[m]); 44549 if (key < currentKey) { 44550 r = m - 2; 44551 } else if (key > currentKey) { 44552 l = m + 2; 44553 } else { 44554 return entries[m + 1]; 44555 } 44556 } 44557 } 44558 return null; 44559 } 44560 get(key) { 44561 return this.xref.fetchIfRef(this.getRaw(key)); 44562 } 44563} 44564class NameTree extends NameOrNumberTree { 44565 constructor(root, xref) { 44566 super(root, xref, "Names"); 44567 } 44568} 44569class NumberTree extends NameOrNumberTree { 44570 constructor(root, xref) { 44571 super(root, xref, "Nums"); 44572 } 44573} 44574 44575;// ./src/core/cleanup_helper.js 44576 44577 44578 44579 44580 44581function clearGlobalCaches() { 44582 clearPatternCaches(); 44583 clearPrimitiveCaches(); 44584 clearUnicodeCaches(); 44585 JBig2CCITTFaxImage.cleanup(); 44586 JpxImage.cleanup(); 44587} 44588 44589;// ./src/core/file_spec.js 44590 44591 44592 44593function pickPlatformItem(dict) { 44594 if (dict instanceof Dict) { 44595 for (const key of ["UF", "F", "Unix", "Mac", "DOS"]) { 44596 if (dict.has(key)) { 44597 return dict.get(key); 44598 } 44599 } 44600 } 44601 return null; 44602} 44603class FileSpec { 44604 #contentAvailable = false;
44605 constructor(root, skipContent = false) { 44606 if (!(root instanceof Dict)) { 44607 return; 44608 } 44609 this.root = root; 44610 if (root.has("FS")) { 44611 this.fs = root.get("FS"); 44612 } 44613 if (root.has("RF")) { 44614 warn("Related file specifications are not supported"); 44615 } 44616 if (!skipContent) { 44617 if (root.has("EF")) { 44618 this.#contentAvailable = true; 44619 } else { 44620 warn("Non-embedded file specifications are not supported"); 44621 } 44622 } 44623 } 44624 get filename() { 44625 const item = pickPlatformItem(this.root); 44626 if (item && typeof item === "string") { 44627 return stringToPDFString(item, true).replaceAll("\\\\", "\\").replaceAll("\\/", "/").replaceAll("\\", "/"); 44628 } 44629 return ""; 44630 } 44631 get content() { 44632 if (!this.#contentAvailable) { 44633 return null; 44634 } 44635 const ef = pickPlatformItem(this.root?.get("EF")); 44636 if (ef instanceof BaseStream) { 44637 return ef.getBytes(); 44638 } 44639 warn("Embedded file specification points to non-existing/invalid content"); 44640 return null; 44641 } 44642 get description() { 44643 const desc = this.root?.get("Desc"); 44644 if (desc && typeof desc === "string") { 44645 return stringToPDFString(desc); 44646 } 44647 return ""; 44648 } 44649 get serializable() { 44650 const { 44651 filename, 44652 content, 44653 description 44654 } = this; 44655 return { 44656 rawFilename: filename, 44657 filename: stripPath(filename) || "unnamed", 44658 content, 44659
vendor: 11,730 bytes, lines 44659-45088
44659description 44660 }; 44661 } 44662} 44663 44664;// ./src/core/xml_parser.js 44665 44666 44667 44668 44669const XMLParserErrorCode = { 44670 NoError: 0, 44671 EndOfDocument: -1, 44672 UnterminatedCdat: -2, 44673 UnterminatedXmlDeclaration: -3, 44674 UnterminatedDoctypeDeclaration: -4, 44675 UnterminatedComment: -5, 44676 MalformedElement: -6, 44677 OutOfMemory: -7, 44678 UnterminatedAttributeValue: -8, 44679 UnterminatedElement: -9, 44680 ElementNeverBegun: -10 44681}; 44682function isWhitespace(s, index) { 44683 const ch = s[index]; 44684 return ch === " " || ch === "\n" || ch === "\r" || ch === "\t"; 44685} 44686function isWhitespaceString(s) { 44687 for (let i = 0, ii = s.length; i < ii; i++) { 44688 if (!isWhitespace(s, i)) { 44689 return false; 44690 } 44691 } 44692 return true; 44693} 44694class XMLParserBase { 44695 _resolveEntities(s) { 44696 return s.replaceAll(/&([^;]+);/g, (all, entity) => { 44697 if (entity.substring(0, 2) === "#x") { 44698 return String.fromCodePoint(parseInt(entity.substring(2), 16)); 44699 } else if (entity.substring(0, 1) === "#") { 44700 return String.fromCodePoint(parseInt(entity.substring(1), 10)); 44701 } 44702 switch (entity) { 44703 case "lt": 44704 return "<"; 44705 case "gt": 44706 return ">"; 44707 case "amp": 44708 return "&"; 44709 case "quot": 44710 return '"'; 44711 case "apos": 44712 return "'"; 44713 } 44714 return this.onResolveEntity(entity); 44715 }); 44716 } 44717 _parseContent(s, start) { 44718 const attributes = []; 44719 let pos = start; 44720 function skipWs() { 44721 while (pos < s.length && isWhitespace(s, pos)) { 44722 ++pos; 44723 } 44724 } 44725 while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") { 44726 ++pos; 44727 } 44728 const name = s.substring(start, pos); 44729 skipWs(); 44730 while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") { 44731 skipWs(); 44732 let attrName = "", 44733 attrValue = ""; 44734 while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") { 44735 attrName += s[pos]; 44736 ++pos; 44737 } 44738 skipWs(); 44739 if (s[pos] !== "=") { 44740 return null; 44741 } 44742 ++pos; 44743 skipWs(); 44744 const attrEndChar = s[pos]; 44745 if (attrEndChar !== '"' && attrEndChar !== "'") { 44746 return null; 44747 } 44748 const attrEndIndex = s.indexOf(attrEndChar, ++pos); 44749 if (attrEndIndex < 0) { 44750 return null; 44751 } 44752 attrValue = s.substring(pos, attrEndIndex); 44753 attributes.push({ 44754 name: attrName, 44755 value: this._resolveEntities(attrValue) 44756 }); 44757 pos = attrEndIndex + 1; 44758 skipWs(); 44759 } 44760 return { 44761 name, 44762 attributes, 44763 parsed: pos - start 44764 }; 44765 } 44766 _parseProcessingInstruction(s, start) { 44767 let pos = start; 44768 function skipWs() { 44769 while (pos < s.length && isWhitespace(s, pos)) { 44770 ++pos; 44771 } 44772 } 44773 while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "?" && s[pos] !== "/") { 44774 ++pos; 44775 } 44776 const name = s.substring(start, pos); 44777 skipWs(); 44778 const attrStart = pos; 44779 while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) { 44780 ++pos; 44781 } 44782 const value = s.substring(attrStart, pos); 44783 return { 44784 name, 44785 value, 44786 parsed: pos - start 44787 }; 44788 } 44789 parseXml(s) { 44790 let i = 0; 44791 while (i < s.length) { 44792 const ch = s[i]; 44793 let j = i; 44794 if (ch === "<") { 44795 ++j; 44796 const ch2 = s[j]; 44797 let q; 44798 switch (ch2) { 44799 case "/": 44800 ++j; 44801 q = s.indexOf(">", j); 44802 if (q < 0) { 44803 this.onError(XMLParserErrorCode.UnterminatedElement); 44804 return; 44805 } 44806 this.onEndElement(s.substring(j, q)); 44807 j = q + 1; 44808 break; 44809 case "?": 44810 ++j; 44811 const pi = this._parseProcessingInstruction(s, j); 44812 if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") { 44813 this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration); 44814 return; 44815 } 44816 this.onPi(pi.name, pi.value); 44817 j += pi.parsed + 2; 44818 break; 44819 case "!": 44820 if (s.substring(j + 1, j + 3) === "--") { 44821 q = s.indexOf("-->", j + 3); 44822 if (q < 0) { 44823 this.onError(XMLParserErrorCode.UnterminatedComment); 44824 return; 44825 } 44826 this.onComment(s.substring(j + 3, q)); 44827 j = q + 3; 44828 } else if (s.substring(j + 1, j + 8) === "[CDATA[") { 44829 q = s.indexOf("]]>", j + 8); 44830 if (q < 0) { 44831 this.onError(XMLParserErrorCode.UnterminatedCdat); 44832 return; 44833 } 44834 this.onCdata(s.substring(j + 8, q)); 44835 j = q + 3; 44836 } else if (s.substring(j + 1, j + 8) === "DOCTYPE") { 44837 const q2 = s.indexOf("[", j + 8); 44838 let complexDoctype = false; 44839 q = s.indexOf(">", j + 8); 44840 if (q < 0) { 44841 this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration); 44842 return; 44843 } 44844 if (q2 > 0 && q > q2) { 44845 q = s.indexOf("]>", j + 8); 44846 if (q < 0) { 44847 this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration); 44848 return; 44849 } 44850 complexDoctype = true; 44851 } 44852 const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0)); 44853 this.onDoctype(doctypeContent); 44854 j = q + (complexDoctype ? 2 : 1); 44855 } else { 44856 this.onError(XMLParserErrorCode.MalformedElement); 44857 return; 44858 } 44859 break; 44860 default: 44861 const content = this._parseContent(s, j); 44862 if (content === null) { 44863 this.onError(XMLParserErrorCode.MalformedElement); 44864 return; 44865 } 44866 let isClosed = false; 44867 if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") { 44868 isClosed = true; 44869 } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") { 44870 this.onError(XMLParserErrorCode.UnterminatedElement); 44871 return; 44872 } 44873 this.onBeginElement(content.name, content.attributes, isClosed); 44874 j += content.parsed + (isClosed ? 2 : 1); 44875 break; 44876 } 44877 } else { 44878 while (j < s.length && s[j] !== "<") { 44879 j++; 44880 } 44881 const text = s.substring(i, j); 44882 this.onText(this._resolveEntities(text)); 44883 } 44884 i = j; 44885 } 44886 } 44887 onResolveEntity(name) { 44888 return `&${name};`; 44889 } 44890 onPi(name, value) {} 44891 onComment(text) {} 44892 onCdata(text) {} 44893 onDoctype(doctypeContent) {} 44894 onText(text) {} 44895 onBeginElement(name, attributes, isEmpty) {} 44896 onEndElement(name) {} 44897 onError(code) {} 44898} 44899class SimpleDOMNode { 44900 constructor(nodeName, nodeValue) { 44901 this.nodeName = nodeName; 44902 this.nodeValue = nodeValue; 44903 Object.defineProperty(this, "parentNode", { 44904 value: null, 44905 writable: true 44906 }); 44907 } 44908 get firstChild() { 44909 return this.childNodes?.[0]; 44910 } 44911 get nextSibling() { 44912 const childNodes = this.parentNode.childNodes; 44913 if (!childNodes) { 44914 return undefined; 44915 } 44916 const index = childNodes.indexOf(this); 44917 if (index === -1) { 44918 return undefined; 44919 } 44920 return childNodes[index + 1]; 44921 } 44922 get textContent() { 44923 if (!this.childNodes) { 44924 return this.nodeValue || ""; 44925 } 44926 return this.childNodes.map(child => child.textContent).join(""); 44927 } 44928 get children() { 44929 return this.childNodes || []; 44930 } 44931 hasChildNodes() { 44932 return this.childNodes?.length > 0; 44933 } 44934 searchNode(paths, pos) { 44935 if (pos >= paths.length) { 44936 return this; 44937 } 44938 const component = paths[pos]; 44939 if (component.name.startsWith("#") && pos < paths.length - 1) { 44940 return this.searchNode(paths, pos + 1); 44941 } 44942 const stack = []; 44943 let node = this; 44944 while (true) { 44945 if (component.name === node.nodeName) { 44946 if (component.pos === 0) { 44947 const res = node.searchNode(paths, pos + 1); 44948 if (res !== null) { 44949 return res; 44950 } 44951 } else if (stack.length === 0) { 44952 return null; 44953 } else { 44954 const [parent] = stack.pop(); 44955 let siblingPos = 0; 44956 for (const child of parent.childNodes) { 44957 if (component.name === child.nodeName) { 44958 if (siblingPos === component.pos) { 44959 return child.searchNode(paths, pos + 1); 44960 } 44961 siblingPos++; 44962 } 44963 } 44964 return node.searchNode(paths, pos + 1); 44965 } 44966 } 44967 if (node.childNodes?.length > 0) { 44968 stack.push([node, 0]); 44969 node = node.childNodes[0]; 44970 } else if (stack.length === 0) { 44971 return null; 44972 } else { 44973 while (stack.length !== 0) { 44974 const [parent, currentPos] = stack.pop(); 44975 const newPos = currentPos + 1; 44976 if (newPos < parent.childNodes.length) { 44977 stack.push([parent, newPos]); 44978 node = parent.childNodes[newPos]; 44979 break; 44980 } 44981 } 44982 if (stack.length === 0) { 44983 return null; 44984 } 44985 } 44986 } 44987 } 44988 dump(buffer) { 44989 if (this.nodeName === "#text") { 44990 buffer.push(encodeToXmlString(this.nodeValue)); 44991 return; 44992 } 44993 buffer.push(`<${this.nodeName}`); 44994 if (this.attributes) { 44995 for (const attribute of this.attributes) { 44996 buffer.push(` ${attribute.name}="${encodeToXmlString(attribute.value)}"`); 44997 } 44998 } 44999 if (this.hasChildNodes()) { 45000 buffer.push(">"); 45001 for (const child of this.childNodes) { 45002 child.dump(buffer); 45003 } 45004 buffer.push(`</${this.nodeName}>`); 45005 } else if (this.nodeValue) { 45006 buffer.push(`>${encodeToXmlString(this.nodeValue)}</${this.nodeName}>`); 45007 } else { 45008 buffer.push("/>"); 45009 } 45010 } 45011} 45012class SimpleXMLParser extends XMLParserBase { 45013 constructor({ 45014 hasAttributes = false, 45015 lowerCaseName = false 45016 }) { 45017 super(); 45018 this._currentFragment = null; 45019 this._stack = null; 45020 this._errorCode = XMLParserErrorCode.NoError; 45021 this._hasAttributes = hasAttributes; 45022 this._lowerCaseName = lowerCaseName; 45023 } 45024 parseFromString(data) { 45025 this._currentFragment = []; 45026 this._stack = []; 45027 this._errorCode = XMLParserErrorCode.NoError; 45028 this.parseXml(data); 45029 if (this._errorCode !== XMLParserErrorCode.NoError) { 45030 return undefined; 45031 } 45032 const [documentElement] = this._currentFragment; 45033 if (!documentElement) { 45034 return undefined; 45035 } 45036 return { 45037 documentElement 45038 }; 45039 } 45040 onText(text) { 45041 if (isWhitespaceString(text)) { 45042 return; 45043 } 45044 const node = new SimpleDOMNode("#text", text); 45045 this._currentFragment.push(node); 45046 } 45047 onCdata(text) { 45048 const node = new SimpleDOMNode("#text", text); 45049 this._currentFragment.push(node); 45050 } 45051 onBeginElement(name, attributes, isEmpty) { 45052 if (this._lowerCaseName) { 45053 name = name.toLowerCase(); 45054 } 45055 const node = new SimpleDOMNode(name); 45056 node.childNodes = []; 45057 if (this._hasAttributes) { 45058 node.attributes = attributes; 45059 } 45060 this._currentFragment.push(node); 45061 if (isEmpty) { 45062 return; 45063 } 45064 this._stack.push(this._currentFragment); 45065 this._currentFragment = node.childNodes; 45066 } 45067 onEndElement(name) { 45068 this._currentFragment = this._stack.pop() || []; 45069 const lastElement = this._currentFragment.at(-1); 45070 if (!lastElement) { 45071 return null; 45072 } 45073 for (const childNode of lastElement.childNodes) { 45074 childNode.parentNode = lastElement; 45075 } 45076 return lastElement; 45077 } 45078 onError(code) { 45079 this._errorCode = code; 45080 } 45081} 45082 45083;// ./src/core/metadata_parser.js 45084 45085 45086 45087 45088
vendor: 4,164 bytes, lines 45089-45240
45089 45090 45091class MetadataParser { 45092 constructor(data) { 45093 data = this._repair(data); 45094 const parser = new SimpleXMLParser({ 45095 lowerCaseName: true 45096 }); 45097 const xmlDocument = parser.parseFromString(data); 45098 this._metadataMap = new Map(); 45099 this._data = data; 45100 if (xmlDocument) { 45101 this._parse(xmlDocument); 45102 } 45103 } 45104 _repair(data) { 45105 return data.replace(/^[^<]+/, "").replaceAll(/>\\376\\377([^<]+)/g, function (all, codes) { 45106 const bytes = codes.replaceAll(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) { 45107 return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1); 45108 }).replaceAll(/&(amp|apos|gt|lt|quot);/g, function (str, name) { 45109 switch (name) { 45110 case "amp": 45111 return "&"; 45112 case "apos": 45113 return "'"; 45114 case "gt": 45115 return ">"; 45116 case "lt": 45117 return "<"; 45118 case "quot": 45119 return '"'; 45120 } 45121 throw new Error(`_repair: ${name} isn't defined.`); 45122 }); 45123 const charBuf = [">"]; 45124 for (let i = 0, ii = bytes.length; i < ii; i += 2) { 45125 const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1); 45126 if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) { 45127 charBuf.push(String.fromCharCode(code)); 45128 } else { 45129 charBuf.push("&#x" + (0x10000 + code).toString(16).substring(1) + ";"); 45130 } 45131 } 45132 return charBuf.join(""); 45133 }); 45134 } 45135 _getSequence(entry) { 45136 const name = entry.nodeName; 45137 if (name !== "rdf:bag" && name !== "rdf:seq" && name !== "rdf:alt") { 45138 return null; 45139 } 45140 return entry.childNodes.filter(node => node.nodeName === "rdf:li"); 45141 } 45142 _parseArray(entry) { 45143 if (!entry.hasChildNodes()) { 45144 return; 45145 } 45146 const [seqNode] = entry.childNodes; 45147 const sequence = this._getSequence(seqNode) || []; 45148 this._metadataMap.set(entry.nodeName, sequence.map(node => node.textContent.trim())); 45149 } 45150 _parse(xmlDocument) { 45151 let rdf = xmlDocument.documentElement; 45152 if (rdf.nodeName !== "rdf:rdf") { 45153 rdf = rdf.firstChild; 45154 while (rdf && rdf.nodeName !== "rdf:rdf") { 45155 rdf = rdf.nextSibling; 45156 } 45157 } 45158 if (!rdf || rdf.nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) { 45159 return; 45160 } 45161 for (const desc of rdf.childNodes) { 45162 if (desc.nodeName !== "rdf:description") { 45163 continue; 45164 } 45165 for (const entry of desc.childNodes) { 45166 const name = entry.nodeName; 45167 switch (name) { 45168 case "#text": 45169 continue; 45170 case "dc:creator": 45171 case "dc:subject": 45172 this._parseArray(entry); 45173 continue; 45174 } 45175 this._metadataMap.set(name, entry.textContent.trim()); 45176 } 45177 } 45178 } 45179 get serializable() { 45180 return { 45181 parsedData: this._metadataMap, 45182 rawData: this._data 45183 }; 45184 } 45185} 45186 45187;// ./src/core/struct_tree.js 45188 45189 45190 45191 45192 45193 45194 45195 45196const MAX_DEPTH = 40; 45197const StructElementType = { 45198 PAGE_CONTENT: 1, 45199 STREAM_CONTENT: 2, 45200 OBJECT: 3, 45201 ANNOTATION: 4, 45202 ELEMENT: 5 45203}; 45204class StructTreeRoot { 45205 constructor(xref, rootDict, rootRef) { 45206 this.xref = xref; 45207 this.dict = rootDict; 45208 this.ref = rootRef instanceof Ref ? rootRef : null; 45209 this.roleMap = new Map(); 45210 this.structParentIds = null; 45211 this.kidRefToPosition = undefined; 45212 this.parentTree = null; 45213 } 45214 getKidPosition(kidRef) { 45215 if (this.kidRefToPosition === undefined) { 45216 const obj = this.dict.get("K"); 45217 if (Array.isArray(obj)) { 45218 const map = this.kidRefToPosition = new Map(); 45219 for (let i = 0, ii = obj.length; i < ii; i++) { 45220 const ref = obj[i]; 45221 if (ref) { 45222 map.set(ref.toString(), i); 45223 } 45224 } 45225 } else if (obj instanceof Dict) { 45226 this.kidRefToPosition = new Map([[obj.objId, 0]]); 45227 } else if (!obj) { 45228 this.kidRefToPosition = new Map(); 45229 } else { 45230 this.kidRefToPosition = null; 45231 } 45232 } 45233 return this.kidRefToPosition ? this.kidRefToPosition.get(kidRef) ?? NaN : -1; 45234 } 45235 init() { 45236 this.readRoleMap(); 45237 const parentTree = this.dict.get("ParentTree"); 45238 if (!parentTree) { 45239 return; 45240 }
vendor: 4,229 bytes, lines 45241-45381
45241 this.parentTree = new NumberTree(parentTree, this.xref); 45242 } 45243 #addIdToPage(pageRef, id, type) { 45244 if (!(pageRef instanceof Ref) || id < 0) { 45245 return; 45246 } 45247 this.structParentIds ||= new RefSetCache(); 45248 let ids = this.structParentIds.get(pageRef); 45249 if (!ids) { 45250 ids = []; 45251 this.structParentIds.put(pageRef, ids); 45252 } 45253 ids.push([id, type]); 45254 } 45255 addAnnotationIdToPage(pageRef, id) { 45256 this.#addIdToPage(pageRef, id, StructElementType.ANNOTATION); 45257 } 45258 readRoleMap() { 45259 const roleMapDict = this.dict.get("RoleMap"); 45260 if (!(roleMapDict instanceof Dict)) { 45261 return; 45262 } 45263 for (const [key, value] of roleMapDict) { 45264 if (value instanceof Name) { 45265 this.roleMap.set(key, value.name); 45266 } 45267 } 45268 } 45269 static async canCreateStructureTree({ 45270 catalogRef, 45271 pdfManager, 45272 newAnnotationsByPage 45273 }) { 45274 if (!(catalogRef instanceof Ref)) { 45275 warn("Cannot save the struct tree: no catalog reference."); 45276 return false; 45277 } 45278 let nextKey = 0; 45279 let hasNothingToUpdate = true; 45280 for (const [pageIndex, elements] of newAnnotationsByPage) { 45281 const { 45282 ref: pageRef 45283 } = await pdfManager.getPage(pageIndex); 45284 if (!(pageRef instanceof Ref)) { 45285 warn(`Cannot save the struct tree: page ${pageIndex} has no ref.`); 45286 hasNothingToUpdate = true; 45287 break; 45288 } 45289 for (const element of elements) { 45290 if (element.accessibilityData?.type) { 45291 element.parentTreeId = nextKey++; 45292 hasNothingToUpdate = false; 45293 } 45294 } 45295 } 45296 if (hasNothingToUpdate) { 45297 for (const elements of newAnnotationsByPage.values()) { 45298 for (const element of elements) { 45299 delete element.parentTreeId; 45300 } 45301 } 45302 return false; 45303 } 45304 return true; 45305 } 45306 static async createStructureTree({ 45307 newAnnotationsByPage, 45308 xref, 45309 catalogRef, 45310 pdfManager, 45311 changes 45312 }) { 45313 const root = await pdfManager.ensureCatalog("cloneDict"); 45314 const cache = new RefSetCache(); 45315 cache.put(catalogRef, root); 45316 const structTreeRootRef = xref.getNewTemporaryRef(); 45317 root.set("StructTreeRoot", structTreeRootRef); 45318 const structTreeRoot = new Dict(xref); 45319 structTreeRoot.set("Type", Name.get("StructTreeRoot")); 45320 const parentTreeRef = xref.getNewTemporaryRef(); 45321 structTreeRoot.set("ParentTree", parentTreeRef); 45322 const kids = []; 45323 structTreeRoot.set("K", kids); 45324 cache.put(structTreeRootRef, structTreeRoot); 45325 const parentTree = new Dict(xref); 45326 const nums = []; 45327 parentTree.set("Nums", nums); 45328 const nextKey = await this.#writeKids({ 45329 newAnnotationsByPage, 45330 structTreeRootRef, 45331 structTreeRoot: null, 45332 kids, 45333 nums, 45334 xref, 45335 pdfManager, 45336 changes, 45337 cache 45338 }); 45339 structTreeRoot.set("ParentTreeNextKey", nextKey); 45340 cache.put(parentTreeRef, parentTree); 45341 for (const [ref, obj] of cache.items()) { 45342 changes.put(ref, { 45343 data: obj 45344 }); 45345 } 45346 } 45347 async canUpdateStructTree({ 45348 pdfManager, 45349 newAnnotationsByPage 45350 }) { 45351 if (!this.ref) { 45352 warn("Cannot update the struct tree: no root reference."); 45353 return false; 45354 } 45355 let nextKey = this.dict.get("ParentTreeNextKey"); 45356 if (!Number.isInteger(nextKey) || nextKey < 0) { 45357 warn("Cannot update the struct tree: invalid next key."); 45358 return false; 45359 } 45360 const parentTree = this.dict.get("ParentTree"); 45361 if (!(parentTree instanceof Dict)) { 45362 warn("Cannot update the struct tree: ParentTree isn't a dict."); 45363 return false; 45364 } 45365 const nums = parentTree.get("Nums"); 45366 if (!Array.isArray(nums)) { 45367 warn("Cannot update the struct tree: nums isn't an array."); 45368 return false; 45369 } 45370 const numberTree = new NumberTree(parentTree, this.xref); 45371 for (const pageIndex of newAnnotationsByPage.keys()) { 45372 const { 45373 pageDict 45374 } = await pdfManager.getPage(pageIndex); 45375 if (!pageDict.has("StructParents")) { 45376 continue; 45377 } 45378 const id = pageDict.get("StructParents"); 45379 if (!Number.isInteger(id) || !Array.isArray(numberTree.get(id))) { 45380 warn(`Cannot save the struct tree: page ${pageIndex} has a wrong id.`); 45381 return false;
vendor: 15,201 bytes, lines 45382-45942
45382 } 45383 } 45384 let hasNothingToUpdate = true; 45385 for (const [pageIndex, elements] of newAnnotationsByPage) { 45386 const { 45387 pageDict 45388 } = await pdfManager.getPage(pageIndex); 45389 StructTreeRoot.#collectParents({ 45390 elements, 45391 xref: this.xref, 45392 pageDict, 45393 numberTree 45394 }); 45395 for (const element of elements) { 45396 if (element.accessibilityData?.type) { 45397 if (!(element.accessibilityData.structParent >= 0)) { 45398 element.parentTreeId = nextKey++; 45399 } 45400 hasNothingToUpdate = false; 45401 } 45402 } 45403 } 45404 if (hasNothingToUpdate) { 45405 for (const elements of newAnnotationsByPage.values()) { 45406 for (const element of elements) { 45407 delete element.parentTreeId; 45408 delete element.structTreeParent; 45409 } 45410 } 45411 return false; 45412 } 45413 return true; 45414 } 45415 async updateStructureTree({ 45416 newAnnotationsByPage, 45417 pdfManager, 45418 changes 45419 }) { 45420 const { 45421 ref: structTreeRootRef, 45422 xref 45423 } = this; 45424 const structTreeRoot = this.dict.clone(); 45425 const cache = new RefSetCache(); 45426 cache.put(structTreeRootRef, structTreeRoot); 45427 let parentTreeRef = structTreeRoot.getRaw("ParentTree"); 45428 let parentTree; 45429 if (parentTreeRef instanceof Ref) { 45430 parentTree = xref.fetch(parentTreeRef); 45431 } else { 45432 parentTree = parentTreeRef; 45433 parentTreeRef = xref.getNewTemporaryRef(); 45434 structTreeRoot.set("ParentTree", parentTreeRef); 45435 } 45436 parentTree = parentTree.clone(); 45437 cache.put(parentTreeRef, parentTree); 45438 let nums = parentTree.getRaw("Nums"); 45439 let numsRef = null; 45440 if (nums instanceof Ref) { 45441 numsRef = nums; 45442 nums = xref.fetch(numsRef); 45443 } 45444 nums = nums.slice(); 45445 if (!numsRef) { 45446 parentTree.set("Nums", nums); 45447 } 45448 const newNextKey = await StructTreeRoot.#writeKids({ 45449 newAnnotationsByPage, 45450 structTreeRootRef, 45451 structTreeRoot: this, 45452 kids: null, 45453 nums, 45454 xref, 45455 pdfManager, 45456 changes, 45457 cache 45458 }); 45459 if (newNextKey === -1) { 45460 return; 45461 } 45462 structTreeRoot.set("ParentTreeNextKey", newNextKey); 45463 if (numsRef) { 45464 cache.put(numsRef, nums); 45465 } 45466 for (const [ref, obj] of cache.items()) { 45467 changes.put(ref, { 45468 data: obj 45469 }); 45470 } 45471 } 45472 static async #writeKids({ 45473 newAnnotationsByPage, 45474 structTreeRootRef, 45475 structTreeRoot, 45476 kids, 45477 nums, 45478 xref, 45479 pdfManager, 45480 changes, 45481 cache 45482 }) { 45483 const objr = Name.get("OBJR"); 45484 let nextKey = -1; 45485 let structTreePageObjs; 45486 for (const [pageIndex, elements] of newAnnotationsByPage) { 45487 const page = await pdfManager.getPage(pageIndex); 45488 const { 45489 ref: pageRef 45490 } = page; 45491 const isPageRef = pageRef instanceof Ref; 45492 for (const { 45493 accessibilityData, 45494 ref, 45495 parentTreeId, 45496 structTreeParent 45497 } of elements) { 45498 if (!accessibilityData?.type) { 45499 continue; 45500 } 45501 const { 45502 structParent 45503 } = accessibilityData; 45504 if (structTreeRoot && Number.isInteger(structParent) && structParent >= 0) { 45505 let objs = (structTreePageObjs ||= new Map()).get(pageIndex); 45506 if (objs === undefined) { 45507 const structTreePage = new StructTreePage(structTreeRoot, page.pageDict); 45508 objs = structTreePage.collectObjects(pageRef); 45509 structTreePageObjs.set(pageIndex, objs); 45510 } 45511 const objRef = objs?.get(structParent); 45512 if (objRef) { 45513 const tagDict = xref.fetch(objRef).clone(); 45514 StructTreeRoot.#writeProperties(tagDict, accessibilityData); 45515 changes.put(objRef, { 45516 data: tagDict 45517 }); 45518 continue; 45519 } 45520 } 45521 nextKey = Math.max(nextKey, parentTreeId); 45522 const tagRef = xref.getNewTemporaryRef(); 45523 const tagDict = new Dict(xref); 45524 StructTreeRoot.#writeProperties(tagDict, accessibilityData); 45525 await this.#updateParentTag({ 45526 structTreeParent, 45527 tagDict, 45528 newTagRef: tagRef, 45529 structTreeRootRef, 45530 fallbackKids: kids, 45531 xref, 45532 cache 45533 }); 45534 const objDict = new Dict(xref); 45535 tagDict.set("K", objDict); 45536 objDict.set("Type", objr); 45537 if (isPageRef) { 45538 objDict.set("Pg", pageRef); 45539 } 45540 objDict.set("Obj", ref); 45541 cache.put(tagRef, tagDict); 45542 nums.push(parentTreeId, tagRef); 45543 } 45544 } 45545 return nextKey + 1; 45546 } 45547 static #writeProperties(tagDict, { 45548 type, 45549 title, 45550 lang, 45551 alt, 45552 expanded, 45553 actualText 45554 }) { 45555 tagDict.set("S", Name.get(type)); 45556 if (title) { 45557 tagDict.set("T", stringToAsciiOrUTF16BE(title)); 45558 } 45559 if (lang) { 45560 tagDict.set("Lang", stringToAsciiOrUTF16BE(lang)); 45561 } 45562 if (alt) { 45563 tagDict.set("Alt", stringToAsciiOrUTF16BE(alt)); 45564 } 45565 if (expanded) { 45566 tagDict.set("E", stringToAsciiOrUTF16BE(expanded)); 45567 } 45568 if (actualText) { 45569 tagDict.set("ActualText", stringToAsciiOrUTF16BE(actualText)); 45570 } 45571 } 45572 static #collectParents({ 45573 elements, 45574 xref, 45575 pageDict, 45576 numberTree 45577 }) { 45578 const idToElements = new Map(); 45579 for (const element of elements) { 45580 if (element.structTreeParentId) { 45581 const id = parseInt(element.structTreeParentId.split("_mc")[1], 10); 45582 idToElements.getOrInsertComputed(id, makeArr).push(element); 45583 } 45584 } 45585 const id = pageDict.get("StructParents"); 45586 if (!Number.isInteger(id)) { 45587 return; 45588 } 45589 const parentArray = numberTree.get(id); 45590 const updateElement = (kid, pageKid, kidRef) => { 45591 const elems = idToElements.get(kid); 45592 if (elems) { 45593 const parentRef = pageKid.getRaw("P"); 45594 const parentDict = xref.fetchIfRef(parentRef); 45595 if (parentRef instanceof Ref && parentDict instanceof Dict) { 45596 const params = { 45597 ref: kidRef, 45598 dict: pageKid 45599 }; 45600 for (const element of elems) { 45601 element.structTreeParent = params; 45602 } 45603 } 45604 return true; 45605 } 45606 return false; 45607 }; 45608 for (const kidRef of parentArray) { 45609 if (!(kidRef instanceof Ref)) { 45610 continue; 45611 } 45612 const pageKid = xref.fetch(kidRef); 45613 const k = pageKid.get("K"); 45614 if (Number.isInteger(k)) { 45615 updateElement(k, pageKid, kidRef); 45616 continue; 45617 } 45618 if (!Array.isArray(k)) { 45619 continue; 45620 } 45621 for (let kid of k) { 45622 kid = xref.fetchIfRef(kid); 45623 if (Number.isInteger(kid) && updateElement(kid, pageKid, kidRef)) { 45624 break; 45625 } 45626 if (!(kid instanceof Dict)) { 45627 continue; 45628 } 45629 if (!isName(kid.get("Type"), "MCR")) { 45630 break; 45631 } 45632 const mcid = kid.get("MCID"); 45633 if (Number.isInteger(mcid) && updateElement(mcid, pageKid, kidRef)) { 45634 break; 45635 } 45636 } 45637 } 45638 } 45639 static async #updateParentTag({ 45640 structTreeParent, 45641 tagDict, 45642 newTagRef, 45643 structTreeRootRef, 45644 fallbackKids, 45645 xref, 45646 cache 45647 }) { 45648 let ref = null; 45649 let parentRef; 45650 if (structTreeParent) { 45651 ({ 45652 ref 45653 } = structTreeParent); 45654 parentRef = structTreeParent.dict.getRaw("P") || structTreeRootRef; 45655 } else { 45656 parentRef = structTreeRootRef; 45657 } 45658 tagDict.set("P", parentRef); 45659 const parentDict = xref.fetchIfRef(parentRef); 45660 if (!parentDict) { 45661 fallbackKids.push(newTagRef); 45662 return; 45663 } 45664 let cachedParentDict = cache.get(parentRef); 45665 if (!cachedParentDict) { 45666 cachedParentDict = parentDict.clone(); 45667 cache.put(parentRef, cachedParentDict); 45668 } 45669 const parentKidsRaw = cachedParentDict.getRaw("K"); 45670 let cachedParentKids = parentKidsRaw instanceof Ref ? cache.get(parentKidsRaw) : null; 45671 if (!cachedParentKids) { 45672 cachedParentKids = xref.fetchIfRef(parentKidsRaw); 45673 cachedParentKids = Array.isArray(cachedParentKids) ? cachedParentKids.slice() : [parentKidsRaw]; 45674 const parentKidsRef = xref.getNewTemporaryRef(); 45675 cachedParentDict.set("K", parentKidsRef); 45676 cache.put(parentKidsRef, cachedParentKids); 45677 } 45678 const index = cachedParentKids.indexOf(ref); 45679 cachedParentKids.splice(index >= 0 ? index + 1 : cachedParentKids.length, 0, newTagRef); 45680 } 45681} 45682class StructElementNode { 45683 constructor(tree, dict) { 45684 this.tree = tree; 45685 this.xref = tree.xref; 45686 this.dict = dict; 45687 this.kids = []; 45688 this.parseKids(); 45689 } 45690 get role() { 45691 const nameObj = this.dict.get("S"); 45692 const name = nameObj instanceof Name ? nameObj.name : ""; 45693 const { 45694 root 45695 } = this.tree; 45696 return root.roleMap.get(name) ?? name; 45697 } 45698 get mathML() { 45699 let AFs = this.dict.get("AF") || []; 45700 if (!Array.isArray(AFs)) { 45701 AFs = [AFs]; 45702 } 45703 for (let af of AFs) { 45704 af = this.xref.fetchIfRef(af); 45705 if (!(af instanceof Dict)) { 45706 continue; 45707 } 45708 if (!isName(af.get("Type"), "Filespec")) { 45709 continue; 45710 } 45711 if (!isName(af.get("AFRelationship"), "Supplement")) { 45712 continue; 45713 } 45714 const ef = af.get("EF"); 45715 if (!(ef instanceof Dict)) { 45716 continue; 45717 } 45718 const fileStream = ef.get("UF") || ef.get("F"); 45719 if (!(fileStream instanceof BaseStream)) { 45720 continue; 45721 } 45722 if (!isName(fileStream.dict.get("Type"), "EmbeddedFile")) { 45723 continue; 45724 } 45725 if (!isName(fileStream.dict.get("Subtype"), "application/mathml+xml")) { 45726 continue; 45727 } 45728 return stringToUTF8String(fileStream.getString()); 45729 } 45730 const A = this.dict.get("A"); 45731 if (A instanceof Dict) { 45732 const O = A.get("O"); 45733 if (isName(O, "MSFT_Office")) { 45734 const mathml = A.get("MSFT_MathML"); 45735 return mathml ? stringToPDFString(mathml) : null; 45736 } 45737 } 45738 return null; 45739 } 45740 parseKids() { 45741 let pageObjId = null; 45742 const objRef = this.dict.getRaw("Pg"); 45743 if (objRef instanceof Ref) { 45744 pageObjId = objRef.toString(); 45745 } 45746 const kids = this.dict.get("K"); 45747 if (Array.isArray(kids)) { 45748 for (const kid of kids) { 45749 const element = this.parseKid(pageObjId, this.xref.fetchIfRef(kid)); 45750 if (element) { 45751 this.kids.push(element); 45752 } 45753 } 45754 } else { 45755 const element = this.parseKid(pageObjId, kids); 45756 if (element) { 45757 this.kids.push(element); 45758 } 45759 } 45760 } 45761 parseKid(pageObjId, kid) { 45762 if (Number.isInteger(kid)) { 45763 if (this.tree.pageDict.objId !== pageObjId) { 45764 return null; 45765 } 45766 return new StructElement({ 45767 type: StructElementType.PAGE_CONTENT, 45768 mcid: kid, 45769 pageObjId 45770 }); 45771 } 45772 if (!(kid instanceof Dict)) { 45773 return null; 45774 } 45775 const pageRef = kid.getRaw("Pg"); 45776 if (pageRef instanceof Ref) { 45777 pageObjId = pageRef.toString(); 45778 } 45779 const type = kid.get("Type") instanceof Name ? kid.get("Type").name : null; 45780 if (type === "MCR") { 45781 if (this.tree.pageDict.objId !== pageObjId) { 45782 return null; 45783 } 45784 const kidRef = kid.getRaw("Stm"); 45785 return new StructElement({ 45786 type: StructElementType.STREAM_CONTENT, 45787 refObjId: kidRef instanceof Ref ? kidRef.toString() : null, 45788 pageObjId, 45789 mcid: kid.get("MCID") 45790 }); 45791 } 45792 if (type === "OBJR") { 45793 if (this.tree.pageDict.objId !== pageObjId) { 45794 return null; 45795 } 45796 const kidRef = kid.getRaw("Obj"); 45797 return new StructElement({ 45798 type: StructElementType.OBJECT, 45799 refObjId: kidRef instanceof Ref ? kidRef.toString() : null, 45800 pageObjId 45801 }); 45802 } 45803 return new StructElement({ 45804 type: StructElementType.ELEMENT, 45805 dict: kid 45806 }); 45807 } 45808} 45809class StructElement { 45810 constructor({ 45811 type, 45812 dict = null, 45813 mcid = null, 45814 pageObjId = null, 45815 refObjId = null 45816 }) { 45817 this.type = type; 45818 this.dict = dict; 45819 this.mcid = mcid; 45820 this.pageObjId = pageObjId; 45821 this.refObjId = refObjId; 45822 this.parentNode = null; 45823 } 45824} 45825class StructTreePage { 45826 constructor(structTreeRoot, pageDict) { 45827 this.root = structTreeRoot; 45828 this.xref = structTreeRoot?.xref ?? null; 45829 this.rootDict = structTreeRoot?.dict ?? null; 45830 this.pageDict = pageDict; 45831 this.nodes = []; 45832 } 45833 collectObjects(pageRef) { 45834 if (!this.root || !this.rootDict || !(pageRef instanceof Ref)) { 45835 return null; 45836 } 45837 const parentTree = this.rootDict.get("ParentTree"); 45838 if (!parentTree) { 45839 return null; 45840 } 45841 const ids = this.root.structParentIds?.get(pageRef); 45842 if (!ids) { 45843 return null; 45844 } 45845 const map = new Map(); 45846 const numberTree = new NumberTree(parentTree, this.xref); 45847 for (const [elemId] of ids) { 45848 const obj = numberTree.getRaw(elemId); 45849 if (obj instanceof Ref) { 45850 map.set(elemId, obj); 45851 } 45852 } 45853 return map; 45854 } 45855 parse(pageRef) { 45856 if (!this.root || !this.rootDict || !(pageRef instanceof Ref)) { 45857 return; 45858 } 45859 const { 45860 parentTree 45861 } = this.root; 45862 if (!parentTree) { 45863 return; 45864 } 45865 const id = this.pageDict.get("StructParents"); 45866 const ids = this.root.structParentIds?.get(pageRef); 45867 if (!Number.isInteger(id) && !ids) { 45868 return; 45869 } 45870 const map = new Map(); 45871 if (Number.isInteger(id)) { 45872 const parentArray = parentTree.get(id); 45873 if (Array.isArray(parentArray)) { 45874 for (const ref of parentArray) { 45875 if (ref instanceof Ref) { 45876 this.addNode(this.xref.fetch(ref), map); 45877 } 45878 } 45879 } 45880 } 45881 if (!ids) { 45882 return; 45883 } 45884 for (const [elemId, type] of ids) { 45885 const obj = parentTree.get(elemId); 45886 if (obj) { 45887 const elem = this.addNode(this.xref.fetchIfRef(obj), map); 45888 if (elem?.kids?.length === 1 && elem.kids[0].type === StructElementType.OBJECT) { 45889 elem.kids[0].type = type; 45890 } 45891 } 45892 } 45893 } 45894 addNode(dict, map, level = 0) { 45895 if (level > MAX_DEPTH) { 45896 warn("StructTree MAX_DEPTH reached."); 45897 return null; 45898 } 45899 if (!(dict instanceof Dict)) { 45900 return null; 45901 } 45902 if (map.has(dict)) { 45903 return map.get(dict); 45904 } 45905 const element = new StructElementNode(this, dict); 45906 map.set(dict, element); 45907 switch (element.role) { 45908 case "L": 45909 case "LBody": 45910 case "LI": 45911 case "Table": 45912 case "THead": 45913 case "TBody": 45914 case "TFoot": 45915 case "TR": 45916 { 45917 for (const kid of element.kids) { 45918 if (kid.type === StructElementType.ELEMENT) { 45919 this.addNode(kid.dict, map, level - 1); 45920 } 45921 } 45922 } 45923 } 45924 const parent = dict.get("P"); 45925 if (!(parent instanceof Dict) || isName(parent.get("Type"), "StructTreeRoot")) { 45926 if (!this.addTopLevelNode(dict, element)) { 45927 map.delete(dict); 45928 } 45929 return element; 45930 } 45931 const parentNode = this.addNode(parent, map, level + 1); 45932 if (!parentNode) { 45933 return element; 45934 } 45935 let save = false; 45936 for (const kid of parentNode.kids) { 45937 if (kid.type === StructElementType.ELEMENT && kid.dict === dict) { 45938 kid.parentNode = element; 45939 save = true; 45940 } 45941 } 45942 if (!save) {
45943 map.delete(dict); 45944 } 45945 return element; 45946 } 45947 addTopLevelNode(dict, element) { 45948 const index = this.root.getKidPosition(dict.objId); 45949 if (isNaN(index)) { 45950 return false; 45951 } 45952 if (index !== -1) { 45953 this.nodes[index] = element; 45954 } 45955 return true; 45956 } 45957 get serializable() { 45958 function nodeToSerializable(node, parent, level = 0) { 45959 if (level > MAX_DEPTH) { 45960 warn("StructTree too deep to be fully serialized."); 45961 return; 45962 } 45963 const obj = Object.create(null); 45964 obj.role = node.role; 45965 obj.children = []; 45966 parent.children.push(obj); 45967 let alt = node.dict.get("Alt"); 45968 if (typeof alt !== "string") { 45969 alt = node.dict.get("ActualText"); 45970 } 45971 if (typeof alt === "string") { 45972 obj.alt = stringToPDFString(alt); 45973 } 45974 if (obj.role === "Formula") { 45975 const { 45976 mathML 45977 } = node; 45978 if (mathML) { 45979 obj.mathML = mathML; 45980 } 45981 } 45982 const a = node.dict.get("A"); 45983 if (a instanceof Dict) { 45984 const bbox = lookupNormalRect(a.getArray("BBox"), null); 45985 if (bbox) { 45986 obj.bbox = bbox; 45987 } else { 45988 const width = a.get("Width"); 45989 const height = a.get("Height"); 45990 if (typeof width === "number" && width > 0 && typeof height === "number" && height > 0) { 45991 obj.bbox = [0, 0, width, height]; 45992 } 45993 } 45994 } 45995 const lang = node.dict.get("Lang"); 45996 if (typeof lang === "string") { 45997 obj.lang = stringToPDFString(lang); 45998 } 45999 for (const kid of node.kids) { 46000 const kidElement = kid.type === StructElementType.ELEMENT ? kid.parentNode : null; 46001 if (kidElement) {
vendor: 26,165 bytes, lines 46002-46923
46002 nodeToSerializable(kidElement, obj, level + 1); 46003 continue; 46004 } else if (kid.type === StructElementType.PAGE_CONTENT || kid.type === StructElementType.STREAM_CONTENT) { 46005 obj.children.push({ 46006 type: "content", 46007 id: `p${kid.pageObjId}_mc${kid.mcid}` 46008 }); 46009 } else if (kid.type === StructElementType.OBJECT) { 46010 obj.children.push({ 46011 type: "object", 46012 id: kid.refObjId 46013 }); 46014 } else if (kid.type === StructElementType.ANNOTATION) { 46015 obj.children.push({ 46016 type: "annotation", 46017 id: `${AnnotationPrefix}${kid.refObjId}` 46018 }); 46019 } 46020 } 46021 } 46022 const root = Object.create(null); 46023 root.children = []; 46024 root.role = "Root"; 46025 for (const child of this.nodes) { 46026 if (!child) { 46027 continue; 46028 } 46029 nodeToSerializable(child, root); 46030 } 46031 return root; 46032 } 46033} 46034 46035;// ./src/core/catalog.js 46036 46037 46038 46039 46040 46041 46042 46043 46044 46045 46046 46047 46048 46049 46050 46051 46052 46053 46054 46055 46056 46057 46058 46059 46060 46061 46062 46063 46064 46065const isRef = v => v instanceof Ref; 46066const isValidExplicitDest = _isValidExplicitDest.bind(null, isRef, isName); 46067function fetchDest(dest) { 46068 if (dest instanceof Dict) { 46069 dest = dest.get("D"); 46070 } 46071 return isValidExplicitDest(dest) ? dest : null; 46072} 46073function fetchRemoteDest(action) { 46074 let dest = action.get("D"); 46075 if (dest) { 46076 if (dest instanceof Name) { 46077 dest = dest.name; 46078 } 46079 if (typeof dest === "string") { 46080 return stringToPDFString(dest, true); 46081 } else if (isValidExplicitDest(dest)) { 46082 return JSON.stringify(dest); 46083 } 46084 } 46085 return null; 46086} 46087class Catalog { 46088 #actualNumPages = null; 46089 #catDict = null; 46090 builtInCMapCache = new Map(); 46091 fontCache = new RefSetCache(); 46092 globalColorSpaceCache = new GlobalColorSpaceCache(); 46093 globalImageCache = new GlobalImageCache(); 46094 nonBlendModesSet = new RefSet(); 46095 pageDictCache = new RefSetCache(); 46096 pageIndexCache = new RefSetCache(); 46097 pageKidsCountCache = new RefSetCache(); 46098 standardFontDataCache = new Map(); 46099 systemFontCache = new Map(); 46100 constructor(pdfManager, xref) { 46101 this.pdfManager = pdfManager; 46102 this.xref = xref; 46103 this.#catDict = xref.getCatalogObj(); 46104 if (!(this.#catDict instanceof Dict)) { 46105 throw new FormatError("Catalog object is not a dictionary."); 46106 } 46107 this.toplevelPagesDict; 46108 } 46109 cloneDict() { 46110 return this.#catDict.clone(); 46111 } 46112 get version() { 46113 const version = this.#catDict.get("Version"); 46114 if (version instanceof Name) { 46115 if (PDF_VERSION_REGEXP.test(version.name)) { 46116 return shadow(this, "version", version.name); 46117 } 46118 warn(`Invalid PDF catalog version: ${version.name}`); 46119 } 46120 return shadow(this, "version", null); 46121 } 46122 get lang() { 46123 const lang = this.#catDict.get("Lang"); 46124 return shadow(this, "lang", lang && typeof lang === "string" ? stringToPDFString(lang) : null); 46125 } 46126 get needsRendering() { 46127 const needsRendering = this.#catDict.get("NeedsRendering"); 46128 return shadow(this, "needsRendering", typeof needsRendering === "boolean" ? needsRendering : false); 46129 } 46130 get collection() { 46131 let collection = null; 46132 try { 46133 const obj = this.#catDict.get("Collection"); 46134 if (obj instanceof Dict && obj.size > 0) { 46135 collection = obj; 46136 } 46137 } catch (ex) { 46138 if (ex instanceof MissingDataException) { 46139 throw ex; 46140 } 46141 info("Cannot fetch Collection entry; assuming no collection is present."); 46142 } 46143 return shadow(this, "collection", collection); 46144 } 46145 get acroForm() { 46146 let acroForm = null; 46147 try { 46148 const obj = this.#catDict.get("AcroForm"); 46149 if (obj instanceof Dict && obj.size > 0) { 46150 acroForm = obj; 46151 } 46152 } catch (ex) { 46153 if (ex instanceof MissingDataException) { 46154 throw ex; 46155 } 46156 info("Cannot fetch AcroForm entry; assuming no forms are present."); 46157 } 46158 return shadow(this, "acroForm", acroForm); 46159 } 46160 get acroFormRef() { 46161 const value = this.#catDict.getRaw("AcroForm"); 46162 return shadow(this, "acroFormRef", value instanceof Ref ? value : null); 46163 } 46164 get metadata() { 46165 const streamRef = this.#catDict.getRaw("Metadata"); 46166 if (!(streamRef instanceof Ref)) { 46167 return shadow(this, "metadata", null); 46168 } 46169 let metadata = null; 46170 try { 46171 const stream = this.xref.fetch(streamRef, !this.xref.encrypt?.encryptMetadata); 46172 if (stream instanceof BaseStream && stream.dict instanceof Dict) { 46173 const type = stream.dict.get("Type"); 46174 const subtype = stream.dict.get("Subtype"); 46175 if (isName(type, "Metadata") && isName(subtype, "XML")) { 46176 const data = stringToUTF8String(stream.getString()); 46177 if (data) { 46178 metadata = new MetadataParser(data).serializable; 46179 } 46180 } 46181 } 46182 } catch (ex) { 46183 if (ex instanceof MissingDataException) { 46184 throw ex; 46185 } 46186 info(`Skipping invalid Metadata: "${ex}".`); 46187 } 46188 return shadow(this, "metadata", metadata); 46189 } 46190 get markInfo() { 46191 let markInfo = null; 46192 try { 46193 markInfo = this.#readMarkInfo(); 46194 } catch (ex) { 46195 if (ex instanceof MissingDataException) { 46196 throw ex; 46197 } 46198 warn("Unable to read mark info."); 46199 } 46200 return shadow(this, "markInfo", markInfo); 46201 } 46202 #readMarkInfo() { 46203 const obj = this.#catDict.get("MarkInfo"); 46204 if (!(obj instanceof Dict)) { 46205 return null; 46206 } 46207 const markInfo = { 46208 Marked: false, 46209 UserProperties: false, 46210 Suspects: false 46211 }; 46212 for (const key in markInfo) { 46213 const value = obj.get(key); 46214 if (typeof value === "boolean") { 46215 markInfo[key] = value; 46216 } 46217 } 46218 return markInfo; 46219 } 46220 get hasStructTree() { 46221 return this.#catDict.has("StructTreeRoot"); 46222 } 46223 get structTreeRoot() { 46224 let structTree = null; 46225 try { 46226 structTree = this.#readStructTreeRoot(); 46227 } catch (ex) { 46228 if (ex instanceof MissingDataException) { 46229 throw ex; 46230 } 46231 warn("Unable read to structTreeRoot info."); 46232 } 46233 return shadow(this, "structTreeRoot", structTree); 46234 } 46235 #readStructTreeRoot() { 46236 const rawObj = this.#catDict.getRaw("StructTreeRoot"); 46237 const obj = this.xref.fetchIfRef(rawObj); 46238 if (!(obj instanceof Dict)) { 46239 return null; 46240 } 46241 const root = new StructTreeRoot(this.xref, obj, rawObj); 46242 root.init(); 46243 return root; 46244 } 46245 get toplevelPagesDict() { 46246 const pagesObj = this.#catDict.get("Pages"); 46247 if (!(pagesObj instanceof Dict)) { 46248 throw new FormatError("Invalid top-level pages dictionary."); 46249 } 46250 return shadow(this, "toplevelPagesDict", pagesObj); 46251 } 46252 get documentOutline() { 46253 let obj = null; 46254 try { 46255 obj = this.#readDocumentOutline(); 46256 } catch (ex) { 46257 if (ex instanceof MissingDataException) { 46258 throw ex; 46259 } 46260 warn("Unable to read document outline."); 46261 } 46262 return shadow(this, "documentOutline", obj); 46263 } 46264 #readDocumentOutline(options = {}) { 46265 let obj = this.#catDict.get("Outlines"); 46266 if (!(obj instanceof Dict)) { 46267 return null; 46268 } 46269 obj = obj.getRaw("First"); 46270 if (!(obj instanceof Ref)) { 46271 return null; 46272 } 46273 const root = { 46274 items: [] 46275 }; 46276 const queue = [{ 46277 obj, 46278 parent: root 46279 }]; 46280 const processed = new RefSet(); 46281 processed.put(obj); 46282 const xref = this.xref, 46283 blackColor = new Uint8ClampedArray(3); 46284 while (queue.length > 0) { 46285 const i = queue.shift(); 46286 const outlineDict = xref.fetchIfRef(i.obj); 46287 if (outlineDict === null) { 46288 continue; 46289 } 46290 if (!outlineDict.has("Title")) { 46291 warn("Invalid outline item encountered."); 46292 } 46293 const data = { 46294 url: null, 46295 dest: null, 46296 action: null 46297 }; 46298 Catalog.parseDestDictionary({ 46299 destDict: outlineDict, 46300 resultObj: data, 46301 docBaseUrl: this.baseUrl, 46302 docAttachments: this.attachments 46303 }); 46304 const title = outlineDict.get("Title"); 46305 const flags = outlineDict.get("F") || 0; 46306 const color = outlineDict.getArray("C"); 46307 const count = outlineDict.get("Count"); 46308 let rgbColor = blackColor; 46309 if (isNumberArray(color, 3) && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) { 46310 rgbColor = ColorSpaceUtils.rgb.getRgb(color, 0); 46311 } 46312 const outlineItem = { 46313 action: data.action, 46314 attachment: data.attachment, 46315 dest: data.dest, 46316 url: data.url, 46317 unsafeUrl: data.unsafeUrl, 46318 newWindow: data.newWindow, 46319 setOCGState: data.setOCGState, 46320 title: typeof title === "string" ? stringToPDFString(title) : "", 46321 color: rgbColor, 46322 count: Number.isInteger(count) ? count : undefined, 46323 bold: !!(flags & 2), 46324 italic: !!(flags & 1), 46325 items: [] 46326 }; 46327 if (options.keepRawDict) { 46328 outlineItem.rawDict = outlineDict; 46329 } 46330 i.parent.items.push(outlineItem); 46331 obj = outlineDict.getRaw("First"); 46332 if (obj instanceof Ref && !processed.has(obj)) { 46333 queue.push({ 46334 obj, 46335 parent: outlineItem 46336 }); 46337 processed.put(obj); 46338 } 46339 obj = outlineDict.getRaw("Next"); 46340 if (obj instanceof Ref && !processed.has(obj)) { 46341 queue.push({ 46342 obj, 46343 parent: i.parent 46344 }); 46345 processed.put(obj); 46346 } 46347 } 46348 return root.items.length > 0 ? root.items : null; 46349 } 46350 get documentOutlineForEditor() { 46351 let obj = null; 46352 try { 46353 obj = this.#readDocumentOutline({ 46354 keepRawDict: true 46355 }); 46356 } catch (ex) { 46357 if (ex instanceof MissingDataException) { 46358 throw ex; 46359 } 46360 warn("Unable to read document outline."); 46361 } 46362 return shadow(this, "documentOutlineForEditor", obj); 46363 } 46364 get permissions() { 46365 let permissions = null; 46366 try { 46367 permissions = this.#readPermissions(); 46368 } catch (ex) { 46369 if (ex instanceof MissingDataException) { 46370 throw ex; 46371 } 46372 warn("Unable to read permissions."); 46373 } 46374 return shadow(this, "permissions", permissions); 46375 } 46376 #readPermissions() { 46377 const encrypt = this.xref.trailer.get("Encrypt"); 46378 if (!(encrypt instanceof Dict)) { 46379 return null; 46380 } 46381 let flags = encrypt.get("P"); 46382 if (typeof flags !== "number") { 46383 return null; 46384 } 46385 flags += 2 ** 32; 46386 const permissions = []; 46387 for (const key in PermissionFlag) { 46388 const value = PermissionFlag[key]; 46389 if (flags & value) { 46390 permissions.push(value); 46391 } 46392 } 46393 return permissions; 46394 } 46395 get optionalContentConfig() { 46396 let config = null; 46397 try { 46398 const properties = this.#catDict.get("OCProperties"); 46399 if (!properties) { 46400 return shadow(this, "optionalContentConfig", null); 46401 } 46402 const defaultConfig = properties.get("D"); 46403 if (!defaultConfig) { 46404 return shadow(this, "optionalContentConfig", null); 46405 } 46406 const groupsData = properties.get("OCGs"); 46407 if (!Array.isArray(groupsData)) { 46408 return shadow(this, "optionalContentConfig", null); 46409 } 46410 const groupRefCache = new RefSetCache(); 46411 for (const groupRef of groupsData) { 46412 if (!(groupRef instanceof Ref) || groupRefCache.has(groupRef)) { 46413 continue; 46414 } 46415 groupRefCache.put(groupRef, this.#readOptionalContentGroup(groupRef)); 46416 } 46417 config = this.#readOptionalContentConfig(defaultConfig, groupRefCache); 46418 } catch (ex) { 46419 if (ex instanceof MissingDataException) { 46420 throw ex; 46421 } 46422 warn(`Unable to read optional content config: ${ex}`); 46423 } 46424 return shadow(this, "optionalContentConfig", config); 46425 } 46426 #readOptionalContentGroup(groupRef) { 46427 const group = this.xref.fetch(groupRef); 46428 const obj = { 46429 id: groupRef.toString(), 46430 name: null, 46431 intent: null, 46432 usage: { 46433 print: null, 46434 view: null 46435 }, 46436 rbGroups: [] 46437 }; 46438 const name = group.get("Name"); 46439 if (typeof name === "string") { 46440 obj.name = stringToPDFString(name); 46441 } 46442 let intent = group.getArray("Intent"); 46443 if (!Array.isArray(intent)) { 46444 intent = [intent]; 46445 } 46446 if (intent.every(i => i instanceof Name)) { 46447 obj.intent = intent.map(i => i.name); 46448 } 46449 const usage = group.get("Usage"); 46450 if (!(usage instanceof Dict)) { 46451 return obj; 46452 } 46453 const usageObj = obj.usage; 46454 const print = usage.get("Print"); 46455 if (print instanceof Dict) { 46456 const printState = print.get("PrintState"); 46457 if (printState instanceof Name) { 46458 switch (printState.name) { 46459 case "ON": 46460 case "OFF": 46461 usageObj.print = { 46462 printState: printState.name 46463 }; 46464 } 46465 } 46466 } 46467 const view = usage.get("View"); 46468 if (view instanceof Dict) { 46469 const viewState = view.get("ViewState"); 46470 if (viewState instanceof Name) { 46471 switch (viewState.name) { 46472 case "ON": 46473 case "OFF": 46474 usageObj.view = { 46475 viewState: viewState.name 46476 }; 46477 } 46478 } 46479 } 46480 return obj; 46481 } 46482 #readOptionalContentConfig(config, groupRefCache) { 46483 function parseOnOff(refs) { 46484 const onParsed = []; 46485 if (Array.isArray(refs)) { 46486 for (const value of refs) { 46487 if (value instanceof Ref && groupRefCache.has(value)) { 46488 onParsed.push(value.toString()); 46489 } 46490 } 46491 } 46492 return onParsed; 46493 } 46494 function parseOrder(refs, nestedLevels = 0) { 46495 if (!Array.isArray(refs)) { 46496 return null; 46497 } 46498 const order = []; 46499 for (const value of refs) { 46500 if (value instanceof Ref && groupRefCache.has(value)) { 46501 parsedOrderRefs.put(value); 46502 order.push(value.toString()); 46503 continue; 46504 } 46505 const nestedOrder = parseNestedOrder(value, nestedLevels); 46506 if (nestedOrder) { 46507 order.push(nestedOrder); 46508 } 46509 } 46510 if (nestedLevels > 0) { 46511 return order; 46512 } 46513 const hiddenGroups = []; 46514 for (const [groupRef] of groupRefCache.items()) { 46515 if (parsedOrderRefs.has(groupRef)) { 46516 continue; 46517 } 46518 hiddenGroups.push(groupRef.toString()); 46519 } 46520 if (hiddenGroups.length) { 46521 order.push({ 46522 name: null, 46523 order: hiddenGroups 46524 }); 46525 } 46526 return order; 46527 } 46528 function parseNestedOrder(ref, nestedLevels) { 46529 if (++nestedLevels > MAX_NESTED_LEVELS) { 46530 warn("parseNestedOrder - reached MAX_NESTED_LEVELS."); 46531 return null; 46532 } 46533 const value = xref.fetchIfRef(ref); 46534 if (!Array.isArray(value)) { 46535 return null; 46536 } 46537 const nestedName = xref.fetchIfRef(value[0]); 46538 if (typeof nestedName !== "string") { 46539 return null; 46540 } 46541 const nestedOrder = parseOrder(value.slice(1), nestedLevels); 46542 if (!nestedOrder?.length) { 46543 return null; 46544 } 46545 return { 46546 name: stringToPDFString(nestedName), 46547 order: nestedOrder 46548 }; 46549 } 46550 function parseRBGroups(rbGroups) { 46551 if (!Array.isArray(rbGroups)) { 46552 return; 46553 } 46554 for (const value of rbGroups) { 46555 const rbGroup = xref.fetchIfRef(value); 46556 if (!Array.isArray(rbGroup) || !rbGroup.length) { 46557 continue; 46558 } 46559 const parsedRbGroup = new Set(); 46560 for (const ref of rbGroup) { 46561 if (ref instanceof Ref && groupRefCache.has(ref) && !parsedRbGroup.has(ref.toString())) { 46562 parsedRbGroup.add(ref.toString()); 46563 groupRefCache.get(ref).rbGroups.push(parsedRbGroup); 46564 } 46565 } 46566 } 46567 } 46568 const xref = this.xref, 46569 parsedOrderRefs = new RefSet(), 46570 MAX_NESTED_LEVELS = 10; 46571 parseRBGroups(config.get("RBGroups")); 46572 return { 46573 name: typeof config.get("Name") === "string" ? stringToPDFString(config.get("Name")) : null, 46574 creator: typeof config.get("Creator") === "string" ? stringToPDFString(config.get("Creator")) : null, 46575 baseState: config.get("BaseState") instanceof Name ? config.get("BaseState").name : null, 46576 on: parseOnOff(config.get("ON")), 46577 off: parseOnOff(config.get("OFF")), 46578 order: parseOrder(config.get("Order")), 46579 groups: [...groupRefCache] 46580 }; 46581 } 46582 setActualNumPages(num = null) { 46583 this.#actualNumPages = num; 46584 } 46585 get hasActualNumPages() { 46586 return this.#actualNumPages !== null; 46587 } 46588 get _pagesCount() { 46589 const obj = this.toplevelPagesDict.get("Count"); 46590 if (!Number.isInteger(obj)) { 46591 throw new FormatError("Page count in top-level pages dictionary is not an integer."); 46592 } 46593 return shadow(this, "_pagesCount", obj); 46594 } 46595 get numPages() { 46596 return this.#actualNumPages ?? this._pagesCount; 46597 } 46598 get destinations() { 46599 const rawDests = this.#readDests(), 46600 dests = Object.create(null); 46601 for (const obj of rawDests) { 46602 if (obj instanceof NameTree) { 46603 for (const [key, value] of obj.getAll()) { 46604 const dest = fetchDest(value); 46605 if (dest) { 46606 dests[stringToPDFString(key, true)] = dest; 46607 } 46608 } 46609 } else if (obj instanceof Dict) { 46610 for (const [key, value] of obj) { 46611 const dest = fetchDest(value); 46612 if (dest) { 46613 dests[stringToPDFString(key, true)] ||= dest; 46614 } 46615 } 46616 } 46617 } 46618 return shadow(this, "destinations", dests); 46619 } 46620 getDestination(id) { 46621 if (Object.hasOwn(this, "destinations")) { 46622 return this.destinations[id] ?? null; 46623 } 46624 const rawDests = this.#readDests(); 46625 for (const obj of rawDests) { 46626 if (obj instanceof NameTree || obj instanceof Dict) { 46627 const dest = fetchDest(obj.get(id)); 46628 if (dest) { 46629 return dest; 46630 } 46631 } 46632 } 46633 if (rawDests.length) { 46634 const dest = this.destinations[id]; 46635 if (dest) { 46636 return dest; 46637 } 46638 } 46639 return null; 46640 } 46641 #readDests() { 46642 const obj = this.#catDict.get("Names"); 46643 const rawDests = []; 46644 if (obj?.has("Dests")) { 46645 rawDests.push(new NameTree(obj.getRaw("Dests"), this.xref)); 46646 } 46647 if (this.#catDict.has("Dests")) { 46648 rawDests.push(this.#catDict.get("Dests")); 46649 } 46650 return rawDests; 46651 } 46652 get rawPageLabels() { 46653 const obj = this.#catDict.getRaw("PageLabels"); 46654 if (!obj) { 46655 return null; 46656 } 46657 const numberTree = new NumberTree(obj, this.xref); 46658 return numberTree.getAll(); 46659 } 46660 get pageLabels() { 46661 let obj = null; 46662 try { 46663 obj = this.#readPageLabels(); 46664 } catch (ex) { 46665 if (ex instanceof MissingDataException) { 46666 throw ex; 46667 } 46668 warn("Unable to read page labels."); 46669 } 46670 return shadow(this, "pageLabels", obj); 46671 } 46672 #readPageLabels() { 46673 const nums = this.rawPageLabels; 46674 if (!nums) { 46675 return null; 46676 } 46677 const pageLabels = new Array(this.numPages); 46678 let style = null, 46679 prefix = ""; 46680 let currentLabel = "", 46681 currentIndex = 1; 46682 for (let i = 0, ii = this.numPages; i < ii; i++) { 46683 const labelDict = nums.get(i); 46684 if (labelDict !== undefined) { 46685 if (!(labelDict instanceof Dict)) { 46686 throw new FormatError("PageLabel is not a dictionary."); 46687 } 46688 if (labelDict.has("Type") && !isName(labelDict.get("Type"), "PageLabel")) { 46689 throw new FormatError("Invalid type in PageLabel dictionary."); 46690 } 46691 if (labelDict.has("S")) { 46692 const s = labelDict.get("S"); 46693 if (!(s instanceof Name)) { 46694 throw new FormatError("Invalid style in PageLabel dictionary."); 46695 } 46696 style = s.name; 46697 } else { 46698 style = null; 46699 } 46700 if (labelDict.has("P")) { 46701 const p = labelDict.get("P"); 46702 if (typeof p !== "string") { 46703 throw new FormatError("Invalid prefix in PageLabel dictionary."); 46704 } 46705 prefix = stringToPDFString(p); 46706 } else { 46707 prefix = ""; 46708 } 46709 if (labelDict.has("St")) { 46710 const st = labelDict.get("St"); 46711 if (!(Number.isInteger(st) && st >= 1)) { 46712 throw new FormatError("Invalid start in PageLabel dictionary."); 46713 } 46714 currentIndex = st; 46715 } else { 46716 currentIndex = 1; 46717 } 46718 } 46719 switch (style) { 46720 case "D": 46721 currentLabel = currentIndex; 46722 break; 46723 case "R": 46724 case "r": 46725 currentLabel = toRomanNumerals(currentIndex, style === "r"); 46726 break; 46727 case "A": 46728 case "a": 46729 const LIMIT = 26; 46730 const A_UPPER_CASE = 0x41, 46731 A_LOWER_CASE = 0x61; 46732 const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE; 46733 const letterIndex = currentIndex - 1; 46734 const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT); 46735 currentLabel = character.repeat(Math.floor(letterIndex / LIMIT) + 1); 46736 break; 46737 default: 46738 if (style) { 46739 throw new FormatError(`Invalid style "${style}" in PageLabel dictionary.`); 46740 } 46741 currentLabel = ""; 46742 } 46743 pageLabels[i] = prefix + currentLabel; 46744 currentIndex++; 46745 } 46746 return pageLabels; 46747 } 46748 get pageLayout() { 46749 const obj = this.#catDict.get("PageLayout"); 46750 let pageLayout = ""; 46751 if (obj instanceof Name) { 46752 switch (obj.name) { 46753 case "SinglePage": 46754 case "OneColumn": 46755 case "TwoColumnLeft": 46756 case "TwoColumnRight": 46757 case "TwoPageLeft": 46758 case "TwoPageRight": 46759 pageLayout = obj.name; 46760 } 46761 } 46762 return shadow(this, "pageLayout", pageLayout); 46763 } 46764 get pageMode() { 46765 const obj = this.#catDict.get("PageMode"); 46766 let pageMode = "UseNone"; 46767 if (obj instanceof Name) { 46768 switch (obj.name) { 46769 case "UseNone": 46770 case "UseOutlines": 46771 case "UseThumbs": 46772 case "FullScreen": 46773 case "UseOC": 46774 case "UseAttachments": 46775 pageMode = obj.name; 46776 } 46777 } 46778 return shadow(this, "pageMode", pageMode); 46779 } 46780 get viewerPreferences() { 46781 const obj = this.#catDict.get("ViewerPreferences"); 46782 if (!(obj instanceof Dict)) { 46783 return shadow(this, "viewerPreferences", null); 46784 } 46785 let prefs = null; 46786 for (const [key, value] of obj) { 46787 let prefValue; 46788 switch (key) { 46789 case "HideToolbar": 46790 case "HideMenubar": 46791 case "HideWindowUI": 46792 case "FitWindow": 46793 case "CenterWindow": 46794 case "DisplayDocTitle": 46795 case "PickTrayByPDFSize": 46796 if (typeof value === "boolean") { 46797 prefValue = value; 46798 } 46799 break; 46800 case "NonFullScreenPageMode": 46801 if (value instanceof Name) { 46802 switch (value.name) { 46803 case "UseNone": 46804 case "UseOutlines": 46805 case "UseThumbs": 46806 case "UseOC": 46807 prefValue = value.name; 46808 break; 46809 default: 46810 prefValue = "UseNone"; 46811 } 46812 } 46813 break; 46814 case "Direction": 46815 if (value instanceof Name) { 46816 switch (value.name) { 46817 case "L2R": 46818 case "R2L": 46819 prefValue = value.name; 46820 break; 46821 default: 46822 prefValue = "L2R"; 46823 } 46824 } 46825 break; 46826 case "ViewArea": 46827 case "ViewClip": 46828 case "PrintArea": 46829 case "PrintClip": 46830 if (value instanceof Name) { 46831 switch (value.name) { 46832 case "MediaBox": 46833 case "CropBox": 46834 case "BleedBox": 46835 case "TrimBox": 46836 case "ArtBox": 46837 prefValue = value.name; 46838 break; 46839 default: 46840 prefValue = "CropBox"; 46841 } 46842 } 46843 break; 46844 case "PrintScaling": 46845 if (value instanceof Name) { 46846 switch (value.name) { 46847 case "None": 46848 case "AppDefault": 46849 prefValue = value.name; 46850 break; 46851 default: 46852 prefValue = "AppDefault"; 46853 } 46854 } 46855 break; 46856 case "Duplex": 46857 if (value instanceof Name) { 46858 switch (value.name) { 46859 case "Simplex": 46860 case "DuplexFlipShortEdge": 46861 case "DuplexFlipLongEdge": 46862 prefValue = value.name; 46863 break; 46864 default: 46865 prefValue = "None"; 46866 } 46867 } 46868 break; 46869 case "PrintPageRange": 46870 if (Array.isArray(value) && value.length % 2 === 0) { 46871 const isValid = value.every((page, i, arr) => Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages); 46872 if (isValid) { 46873 prefValue = value; 46874 } 46875 } 46876 break; 46877 case "NumCopies": 46878 if (Number.isInteger(value) && value > 0) { 46879 prefValue = value; 46880 } 46881 break; 46882 default: 46883 warn(`Ignoring non-standard key in ViewerPreferences: ${key}.`); 46884 continue; 46885 } 46886 if (prefValue === undefined) { 46887 warn(`Bad value, for key "${key}", in ViewerPreferences: ${value}.`); 46888 continue; 46889 } 46890 prefs ??= Object.create(null); 46891 prefs[key] = prefValue; 46892 } 46893 return shadow(this, "viewerPreferences", prefs); 46894 } 46895 get openAction() { 46896 const obj = this.#catDict.get("OpenAction"); 46897 const openAction = Object.create(null); 46898 if (obj instanceof Dict) { 46899 const destDict = new Dict(this.xref); 46900 destDict.set("A", obj); 46901 const resultObj = { 46902 url: null, 46903 dest: null, 46904 action: null 46905 }; 46906 Catalog.parseDestDictionary({ 46907 destDict, 46908 resultObj 46909 }); 46910 if (Array.isArray(resultObj.dest)) { 46911 openAction.dest = resultObj.dest; 46912 } else if (resultObj.action) { 46913 openAction.action = resultObj.action; 46914 } 46915 } else if (isValidExplicitDest(obj)) { 46916 openAction.dest = obj; 46917 } 46918 return shadow(this, "openAction", objectSize(openAction) > 0 ? openAction : null); 46919 } 46920 get attachments() { 46921 const obj = this.#catDict.get("Names"); 46922 let attachments = null; 46923 if (obj instanceof Dict && obj.has("EmbeddedFiles")) {
46924 const nameTree = new NameTree(obj.getRaw("EmbeddedFiles"), this.xref); 46925 for (const [key, value] of nameTree.getAll()) { 46926 const fs = new FileSpec(value); 46927 attachments ??= Object.create(null); 46928 attachments[stringToPDFString(key, true)] = fs.serializable; 46929 } 46930 } 46931 return shadow(this, "attachments", attachments); 46932 } 46933 get rawEmbeddedFiles() { 46934 const obj = this.#catDict.get("Names"); 46935 if (!(obj instanceof Dict) || !obj.has("EmbeddedFiles")) { 46936 return null; 46937 } 46938 const nameTree = new NameTree(obj.getRaw("EmbeddedFiles"), this.xref); 46939 return nameTree.getAll(true
vendor: 11,484 bytes, lines 46939-47300
46939); 46940 } 46941 get xfaImages() { 46942 const obj = this.#catDict.get("Names"); 46943 let xfaImages = null; 46944 if (obj instanceof Dict && obj.has("XFAImages")) { 46945 const nameTree = new NameTree(obj.getRaw("XFAImages"), this.xref); 46946 for (const [key, value] of nameTree.getAll()) { 46947 if (value instanceof BaseStream) { 46948 xfaImages ??= new Map(); 46949 xfaImages.set(stringToPDFString(key, true), value.getBytes()); 46950 } 46951 } 46952 } 46953 return shadow(this, "xfaImages", xfaImages); 46954 } 46955 #collectJavaScript() { 46956 const obj = this.#catDict.get("Names"); 46957 let javaScript = null; 46958 function appendIfJavaScriptDict(name, jsDict) { 46959 if (!(jsDict instanceof Dict)) { 46960 return; 46961 } 46962 if (!isName(jsDict.get("S"), "JavaScript")) { 46963 return; 46964 } 46965 let js = jsDict.get("JS"); 46966 if (js instanceof BaseStream) { 46967 js = js.getString(); 46968 } else if (typeof js !== "string") { 46969 return; 46970 } 46971 js = stringToPDFString(js, true).replaceAll("\x00", ""); 46972 if (js) { 46973 (javaScript ||= new Map()).set(name, js); 46974 } 46975 } 46976 if (obj instanceof Dict && obj.has("JavaScript")) { 46977 const nameTree = new NameTree(obj.getRaw("JavaScript"), this.xref); 46978 for (const [key, value] of nameTree.getAll()) { 46979 appendIfJavaScriptDict(stringToPDFString(key, true), value); 46980 } 46981 } 46982 const openAction = this.#catDict.get("OpenAction"); 46983 if (openAction) { 46984 appendIfJavaScriptDict("OpenAction", openAction); 46985 } 46986 return javaScript; 46987 } 46988 get jsActions() { 46989 const javaScript = this.#collectJavaScript(); 46990 let actions = collectActions(this.xref, this.#catDict, DocumentActionEventType); 46991 if (javaScript) { 46992 actions ||= Object.create(null); 46993 for (const [key, val] of javaScript) { 46994 if (key in actions) { 46995 actions[key].push(val); 46996 } else { 46997 actions[key] = [val]; 46998 } 46999 } 47000 } 47001 return shadow(this, "jsActions", actions); 47002 } 47003 async cleanup(manuallyTriggered = false) { 47004 clearGlobalCaches(); 47005 this.globalColorSpaceCache.clear(); 47006 this.globalImageCache.clear(manuallyTriggered); 47007 this.pageKidsCountCache.clear(); 47008 this.pageIndexCache.clear(); 47009 this.pageDictCache.clear(); 47010 this.nonBlendModesSet.clear(); 47011 for (const { 47012 dict 47013 } of await Promise.all(this.fontCache)) { 47014 delete dict.cacheKey; 47015 } 47016 this.fontCache.clear(); 47017 this.builtInCMapCache.clear(); 47018 this.standardFontDataCache.clear(); 47019 this.systemFontCache.clear(); 47020 } 47021 async getPageDict(pageIndex) { 47022 const nodesToVisit = [this.toplevelPagesDict]; 47023 const visitedNodes = new RefSet(); 47024 const pagesRef = this.#catDict.getRaw("Pages"); 47025 if (pagesRef instanceof Ref) { 47026 visitedNodes.put(pagesRef); 47027 } 47028 const xref = this.xref, 47029 pageKidsCountCache = this.pageKidsCountCache, 47030 pageIndexCache = this.pageIndexCache, 47031 pageDictCache = this.pageDictCache; 47032 let currentPageIndex = 0; 47033 while (nodesToVisit.length) { 47034 const currentNode = nodesToVisit.pop(); 47035 if (currentNode instanceof Ref) { 47036 const count = pageKidsCountCache.get(currentNode); 47037 if (count >= 0 && currentPageIndex + count <= pageIndex) { 47038 currentPageIndex += count; 47039 continue; 47040 } 47041 if (visitedNodes.has(currentNode)) { 47042 throw new FormatError("Pages tree contains circular reference."); 47043 } 47044 visitedNodes.put(currentNode); 47045 const obj = await (pageDictCache.get(currentNode) || xref.fetchAsync(currentNode)); 47046 if (obj instanceof Dict) { 47047 let type = obj.getRaw("Type"); 47048 if (type instanceof Ref) { 47049 type = await xref.fetchAsync(type); 47050 } 47051 if (isName(type, "Page") || !obj.has("Kids")) { 47052 if (!pageKidsCountCache.has(currentNode)) { 47053 pageKidsCountCache.put(currentNode, 1); 47054 } 47055 if (!pageIndexCache.has(currentNode)) { 47056 pageIndexCache.put(currentNode, currentPageIndex); 47057 } 47058 if (currentPageIndex === pageIndex) { 47059 return [obj, currentNode]; 47060 } 47061 currentPageIndex++; 47062 continue; 47063 } 47064 } 47065 nodesToVisit.push(obj); 47066 continue; 47067 } 47068 if (!(currentNode instanceof Dict)) { 47069 throw new FormatError("Page dictionary kid reference points to wrong type of object."); 47070 } 47071 const { 47072 objId 47073 } = currentNode; 47074 let count = currentNode.getRaw("Count"); 47075 if (count instanceof Ref) { 47076 count = await xref.fetchAsync(count); 47077 } 47078 if (Number.isInteger(count) && count >= 0) { 47079 if (objId && !pageKidsCountCache.has(objId)) { 47080 pageKidsCountCache.put(objId, count); 47081 } 47082 if (currentPageIndex + count <= pageIndex) { 47083 currentPageIndex += count; 47084 continue; 47085 } 47086 } 47087 let kids = currentNode.getRaw("Kids"); 47088 if (kids instanceof Ref) { 47089 kids = await xref.fetchAsync(kids); 47090 } 47091 if (!Array.isArray(kids)) { 47092 let type = currentNode.getRaw("Type"); 47093 if (type instanceof Ref) { 47094 type = await xref.fetchAsync(type); 47095 } 47096 if (isName(type, "Page") || !currentNode.has("Kids")) { 47097 if (currentPageIndex === pageIndex) { 47098 return [currentNode, null]; 47099 } 47100 currentPageIndex++; 47101 continue; 47102 } 47103 throw new FormatError("Page dictionary kids object is not an array."); 47104 } 47105 for (let last = kids.length - 1; last >= 0; last--) { 47106 const lastKid = kids[last]; 47107 nodesToVisit.push(lastKid); 47108 if (currentNode === this.toplevelPagesDict && lastKid instanceof Ref && !pageDictCache.has(lastKid)) { 47109 pageDictCache.put(lastKid, xref.fetchAsync(lastKid)); 47110 } 47111 } 47112 } 47113 throw new Error(`Page index ${pageIndex} not found.`); 47114 } 47115 async getAllPageDicts(recoveryMode = false) { 47116 const { 47117 ignoreErrors 47118 } = this.pdfManager.evaluatorOptions; 47119 const queue = [{ 47120 currentNode: this.toplevelPagesDict, 47121 posInKids: 0 47122 }]; 47123 const visitedNodes = new RefSet(); 47124 const pagesRef = this.#catDict.getRaw("Pages"); 47125 if (pagesRef instanceof Ref) { 47126 visitedNodes.put(pagesRef); 47127 } 47128 const map = new Map(), 47129 xref = this.xref, 47130 pageIndexCache = this.pageIndexCache; 47131 let pageIndex = 0; 47132 function addPageDict(pageDict, pageRef) { 47133 if (pageRef && !pageIndexCache.has(pageRef)) { 47134 pageIndexCache.put(pageRef, pageIndex); 47135 } 47136 map.set(pageIndex++, [pageDict, pageRef]); 47137 } 47138 function addPageError(error) { 47139 if (error instanceof XRefEntryException && !recoveryMode) { 47140 throw error; 47141 } 47142 if (recoveryMode && ignoreErrors && pageIndex === 0) { 47143 warn(`getAllPageDicts - Skipping invalid first page: "${error}".`); 47144 error = Dict.empty; 47145 } 47146 map.set(pageIndex++, [error, null]); 47147 } 47148 while (queue.length > 0) { 47149 const queueItem = queue.at(-1); 47150 const { 47151 currentNode, 47152 posInKids 47153 } = queueItem; 47154 let kids = currentNode.getRaw("Kids"); 47155 if (kids instanceof Ref) { 47156 try { 47157 kids = await xref.fetchAsync(kids); 47158 } catch (ex) { 47159 addPageError(ex); 47160 break; 47161 } 47162 } 47163 if (!Array.isArray(kids)) { 47164 addPageError(new FormatError("Page dictionary kids object is not an array.")); 47165 break; 47166 } 47167 if (posInKids >= kids.length) { 47168 queue.pop(); 47169 continue; 47170 } 47171 const kidObj = kids[posInKids]; 47172 let obj; 47173 if (kidObj instanceof Ref) { 47174 if (visitedNodes.has(kidObj)) { 47175 addPageError(new FormatError("Pages tree contains circular reference.")); 47176 break; 47177 } 47178 visitedNodes.put(kidObj); 47179 try { 47180 obj = await xref.fetchAsync(kidObj); 47181 } catch (ex) { 47182 addPageError(ex); 47183 break; 47184 } 47185 } else { 47186 obj = kidObj; 47187 } 47188 if (!(obj instanceof Dict)) { 47189 addPageError(new FormatError("Page dictionary kid reference points to wrong type of object.")); 47190 break; 47191 } 47192 let type = obj.getRaw("Type"); 47193 if (type instanceof Ref) { 47194 try { 47195 type = await xref.fetchAsync(type); 47196 } catch (ex) { 47197 addPageError(ex); 47198 break; 47199 } 47200 } 47201 if (isName(type, "Page") || !obj.has("Kids")) { 47202 addPageDict(obj, kidObj instanceof Ref ? kidObj : null); 47203 } else { 47204 queue.push({ 47205 currentNode: obj, 47206 posInKids: 0 47207 }); 47208 } 47209 queueItem.posInKids++; 47210 } 47211 return map; 47212 } 47213 getPageIndex(pageRef) { 47214 const cachedPageIndex = this.pageIndexCache.get(pageRef); 47215 if (cachedPageIndex !== undefined) { 47216 return Promise.resolve(cachedPageIndex); 47217 } 47218 const xref = this.xref; 47219 function pagesBeforeRef(kidRef) { 47220 let total = 0, 47221 parentRef; 47222 return xref.fetchAsync(kidRef).then(function (node) { 47223 if (isRefsEqual(kidRef, pageRef) && !isDict(node, "Page") && !(node instanceof Dict && !node.has("Type") && node.has("Contents"))) { 47224 throw new FormatError("The reference does not point to a /Page dictionary."); 47225 } 47226 if (!node) { 47227 return null; 47228 } 47229 if (!(node instanceof Dict)) { 47230 throw new FormatError("Node must be a dictionary."); 47231 } 47232 parentRef = node.getRaw("Parent"); 47233 return node.getAsync("Parent"); 47234 }).then(function (parent) { 47235 if (!parent) { 47236 return null; 47237 } 47238 if (!(parent instanceof Dict)) { 47239 throw new FormatError("Parent must be a dictionary."); 47240 } 47241 return parent.getAsync("Kids"); 47242 }).then(function (kids) { 47243 if (!kids) { 47244 return null; 47245 } 47246 const kidPromises = []; 47247 let found = false; 47248 for (const kid of kids) { 47249 if (!(kid instanceof Ref)) { 47250 throw new FormatError("Kid must be a reference."); 47251 } 47252 if (isRefsEqual(kid, kidRef)) { 47253 found = true; 47254 break; 47255 } 47256 kidPromises.push(xref.fetchAsync(kid).then(function (obj) { 47257 if (!(obj instanceof Dict)) { 47258 throw new FormatError("Kid node must be a dictionary."); 47259 } 47260 if (obj.has("Count")) { 47261 total += obj.get("Count"); 47262 } else { 47263 total++; 47264 } 47265 })); 47266 } 47267 if (!found) { 47268 throw new FormatError("Kid reference not found in parent's kids."); 47269 } 47270 return Promise.all(kidPromises).then(() => [total, parentRef]); 47271 }); 47272 } 47273 let total = 0; 47274 const next = ref => pagesBeforeRef(ref).then(args => { 47275 if (!args) { 47276 this.pageIndexCache.put(pageRef, total); 47277 return total; 47278 } 47279 const [count, parentRef] = args; 47280 total += count; 47281 return next(parentRef); 47282 }); 47283 return next(pageRef); 47284 } 47285 get baseUrl() { 47286 const uri = this.#catDict.get("URI"); 47287 if (uri instanceof Dict) { 47288 const base = uri.get("Base"); 47289 if (typeof base === "string") { 47290 const absoluteUrl = createValidAbsoluteUrl(base, null, { 47291 tryConvertEncoding: true 47292 }); 47293 if (absoluteUrl) { 47294 return shadow(this, "baseUrl", absoluteUrl.href); 47295 } 47296 } 47297 } 47298 return shadow(this, "baseUrl", this.pdfManager.docBaseUrl); 47299 } 47300 static
vendor: 10,231 bytes, lines 47300-47651
47300#getDestFromStructElement(xref, seRef) { 47301 const seDict = xref.fetchIfRef(seRef); 47302 if (!(seDict instanceof Dict)) { 47303 return null; 47304 } 47305 let pageRef = null; 47306 const directPg = seDict.getRaw("Pg"); 47307 if (directPg instanceof Ref) { 47308 pageRef = directPg; 47309 } 47310 if (!pageRef) { 47311 const queue = [seDict]; 47312 while (queue.length > 0 && !pageRef) { 47313 const node = queue.shift(); 47314 const kids = node.get("K"); 47315 let kidsArr; 47316 if (Array.isArray(kids)) { 47317 kidsArr = kids; 47318 } else if (kids) { 47319 kidsArr = [kids]; 47320 } else { 47321 continue; 47322 } 47323 for (const kid of kidsArr) { 47324 const kidObj = xref.fetchIfRef(kid); 47325 if (!(kidObj instanceof Dict)) { 47326 continue; 47327 } 47328 const pg = kidObj.getRaw("Pg"); 47329 if (pg instanceof Ref) { 47330 pageRef = pg; 47331 break; 47332 } 47333 queue.push(kidObj); 47334 } 47335 } 47336 } 47337 if (!pageRef) { 47338 const MAX_DEPTH = 40; 47339 let current = seDict; 47340 for (let depth = 0; depth < MAX_DEPTH; depth++) { 47341 const parentRaw = current.getRaw("P"); 47342 if (!(parentRaw instanceof Ref)) { 47343 break; 47344 } 47345 const parentDict = xref.fetch(parentRaw); 47346 if (!(parentDict instanceof Dict)) { 47347 break; 47348 } 47349 if (isName(parentDict.get("Type"), "StructTreeRoot")) { 47350 break; 47351 } 47352 const pg = parentDict.getRaw("Pg"); 47353 if (pg instanceof Ref) { 47354 pageRef = pg; 47355 break; 47356 } 47357 current = parentDict; 47358 } 47359 } 47360 if (!pageRef) { 47361 return null; 47362 } 47363 let x = null, 47364 y = null; 47365 const attrs = seDict.get("A"); 47366 if (attrs instanceof Dict) { 47367 const bbox = lookupRect(attrs.getArray("BBox"), null); 47368 if (bbox) { 47369 x = bbox[0]; 47370 y = bbox[3]; 47371 } 47372 } 47373 return [pageRef, { 47374 name: "XYZ" 47375 }, x, y, null]; 47376 } 47377 static parseDestDictionary({ 47378 destDict, 47379 resultObj, 47380 docBaseUrl = null, 47381 docAttachments = null 47382 }) { 47383 if (!(destDict instanceof Dict)) { 47384 warn("parseDestDictionary: `destDict` must be a dictionary."); 47385 return; 47386 } 47387 let action = destDict.get("A"), 47388 url, 47389 dest; 47390 if (!(action instanceof Dict)) { 47391 if (destDict.has("Dest")) { 47392 action = destDict.get("Dest"); 47393 } else { 47394 action = destDict.get("AA"); 47395 if (action instanceof Dict) { 47396 if (action.has("D")) { 47397 action = action.get("D"); 47398 } else if (action.has("U")) { 47399 action = action.get("U"); 47400 } 47401 } 47402 } 47403 } 47404 if (action instanceof Dict) { 47405 const actionType = action.get("S"); 47406 if (!(actionType instanceof Name)) { 47407 warn("parseDestDictionary: Invalid type in Action dictionary."); 47408 return; 47409 } 47410 const actionName = actionType.name; 47411 switch (actionName) { 47412 case "ResetForm": 47413 const flags = action.get("Flags"); 47414 const include = ((typeof flags === "number" ? flags : 0) & 1) === 0; 47415 const fields = []; 47416 const refs = []; 47417 for (const obj of action.get("Fields") || []) { 47418 if (obj instanceof Ref) { 47419 refs.push(obj.toString()); 47420 } else if (typeof obj === "string") { 47421 fields.push(stringToPDFString(obj)); 47422 } 47423 } 47424 resultObj.resetForm = { 47425 fields, 47426 refs, 47427 include 47428 }; 47429 break; 47430 case "URI": 47431 url = action.get("URI"); 47432 if (url instanceof Name) { 47433 url = "/" + url.name; 47434 } 47435 break; 47436 case "GoTo": 47437 dest = action.get("D"); 47438 break; 47439 case "Launch": 47440 case "GoToR": 47441 const urlDict = action.get("F"); 47442 if (urlDict instanceof Dict) { 47443 const fs = new FileSpec(urlDict, true); 47444 ({ 47445 rawFilename: url 47446 } = fs.serializable); 47447 } else if (typeof urlDict === "string") { 47448 url = urlDict; 47449 } else { 47450 break; 47451 } 47452 const remoteDest = fetchRemoteDest(action); 47453 if (remoteDest) { 47454 url = url.split("#", 1)[0] + "#" + remoteDest; 47455 } 47456 const newWindow = action.get("NewWindow"); 47457 if (typeof newWindow === "boolean") { 47458 resultObj.newWindow = newWindow; 47459 } 47460 break; 47461 case "GoToE": 47462 const target = action.get("T"); 47463 let attachment; 47464 if (docAttachments && target instanceof Dict) { 47465 const relationship = target.get("R"); 47466 const name = target.get("N"); 47467 if (isName(relationship, "C") && typeof name === "string") { 47468 attachment = docAttachments[stringToPDFString(name, true)]; 47469 } 47470 } 47471 if (attachment) { 47472 resultObj.attachment = attachment; 47473 const attachmentDest = fetchRemoteDest(action); 47474 if (attachmentDest) { 47475 resultObj.attachmentDest = attachmentDest; 47476 } 47477 } else { 47478 warn(`parseDestDictionary - unimplemented "GoToE" action.`); 47479 } 47480 break; 47481 case "Named": 47482 const namedAction = action.get("N"); 47483 if (namedAction instanceof Name) { 47484 resultObj.action = namedAction.name; 47485 } 47486 break; 47487 case "SetOCGState": 47488 const state = action.get("State"); 47489 const preserveRB = action.get("PreserveRB"); 47490 if (!Array.isArray(state) || state.length === 0) { 47491 break; 47492 } 47493 const stateArr = []; 47494 for (const elem of state) { 47495 if (elem instanceof Name) { 47496 switch (elem.name) { 47497 case "ON": 47498 case "OFF": 47499 case "Toggle": 47500 stateArr.push(elem.name); 47501 break; 47502 } 47503 } else if (elem instanceof Ref) { 47504 stateArr.push(elem.toString()); 47505 } 47506 } 47507 if (stateArr.length !== state.length) { 47508 break; 47509 } 47510 resultObj.setOCGState = { 47511 state: stateArr, 47512 preserveRB: typeof preserveRB === "boolean" ? preserveRB : true 47513 }; 47514 break; 47515 case "JavaScript": 47516 const jsAction = action.get("JS"); 47517 let js; 47518 if (jsAction instanceof BaseStream) { 47519 js = jsAction.getString(); 47520 } else if (typeof jsAction === "string") { 47521 js = jsAction; 47522 } 47523 const jsURL = js && recoverJsURL(stringToPDFString(js, true)); 47524 if (jsURL) { 47525 url = jsURL.url; 47526 resultObj.newWindow = jsURL.newWindow; 47527 break; 47528 } 47529 default: 47530 if (actionName === "JavaScript" || actionName === "SubmitForm") { 47531 break; 47532 } 47533 warn(`parseDestDictionary - unsupported action: "${actionName}".`); 47534 break; 47535 } 47536 } else if (destDict.has("Dest")) { 47537 dest = destDict.get("Dest"); 47538 } 47539 if (typeof url === "string") { 47540 const absoluteUrl = createValidAbsoluteUrl(url, docBaseUrl, { 47541 addDefaultProtocol: true, 47542 tryConvertEncoding: true 47543 }); 47544 if (absoluteUrl) { 47545 resultObj.url = absoluteUrl.href; 47546 } 47547 resultObj.unsafeUrl = url; 47548 } 47549 if (dest) { 47550 if (dest instanceof Name) { 47551 dest = dest.name; 47552 } 47553 if (typeof dest === "string") { 47554 resultObj.dest = stringToPDFString(dest, true); 47555 } else if (isValidExplicitDest(dest)) { 47556 resultObj.dest = dest; 47557 } 47558 } 47559 if (!resultObj.dest && !resultObj.url && !resultObj.action && !resultObj.attachment && !resultObj.setOCGState && !resultObj.resetForm) { 47560 const seRef = destDict.getRaw("SE"); 47561 if (seRef instanceof Ref) { 47562 try { 47563 const seDest = Catalog.#getDestFromStructElement(destDict.xref, seRef); 47564 if (seDest) { 47565 resultObj.dest = seDest; 47566 } 47567 } catch (ex) { 47568 if (ex instanceof MissingDataException) { 47569 throw ex; 47570 } 47571 info("SE parsing failed."); 47572 } 47573 } 47574 } 47575 } 47576} 47577 47578;// ./src/core/object_loader.js 47579 47580 47581 47582 47583 47584function mayHaveChildren(value) { 47585 return value instanceof Ref || value instanceof Dict || value instanceof BaseStream || Array.isArray(value); 47586} 47587function addChildren(node, nodesToVisit) { 47588 if (node instanceof Dict) { 47589 node = node.getRawValues(); 47590 } else if (node instanceof BaseStream) { 47591 node = node.dict.getRawValues(); 47592 } else if (!Array.isArray(node)) { 47593 return; 47594 } 47595 for (const rawValue of node) { 47596 if (mayHaveChildren(rawValue)) { 47597 nodesToVisit.push(rawValue); 47598 } 47599 } 47600} 47601class ObjectLoader { 47602 refSet = new RefSet(); 47603 constructor(dict, keys, xref) { 47604 this.dict = dict; 47605 this.keys = keys; 47606 this.xref = xref; 47607 } 47608 async load() { 47609 const { 47610 keys, 47611 dict 47612 } = this; 47613 const nodesToVisit = []; 47614 for (const key of keys) { 47615 const rawValue = dict.getRaw(key); 47616 if (rawValue !== undefined) { 47617 nodesToVisit.push(rawValue); 47618 } 47619 } 47620 await this.#walk(nodesToVisit); 47621 this.refSet = null; 47622 } 47623 async #walk(nodesToVisit) { 47624 const nodesToRevisit = []; 47625 const pendingRequests = []; 47626 while (nodesToVisit.length) { 47627 let currentNode = nodesToVisit.pop(); 47628 if (currentNode instanceof Ref) { 47629 if (this.refSet.has(currentNode)) { 47630 continue; 47631 } 47632 try { 47633 this.refSet.put(currentNode); 47634 currentNode = this.xref.fetch(currentNode); 47635 } catch (ex) { 47636 if (!(ex instanceof MissingDataException)) { 47637 warn(`ObjectLoader.#walk - requesting all data: "${ex}".`); 47638 await this.xref.stream.manager.requestAllChunks(); 47639 return; 47640 } 47641 nodesToRevisit.push(currentNode); 47642 pendingRequests.push({ 47643 begin: ex.begin, 47644 end: ex.end 47645 }); 47646 } 47647 } 47648 if (currentNode instanceof BaseStream) { 47649 const baseStreams = currentNode.getBaseStreams(); 47650 if (baseStreams) { 47651 let foundMissingData = false;
vendor: 12,903 bytes, lines 47652-48192
47652 for (const stream of baseStreams) { 47653 if (stream.isDataLoaded) { 47654 continue; 47655 } 47656 foundMissingData = true; 47657 pendingRequests.push({ 47658 begin: stream.start, 47659 end: stream.end 47660 }); 47661 } 47662 if (foundMissingData) { 47663 nodesToRevisit.push(currentNode); 47664 } 47665 } 47666 } 47667 addChildren(currentNode, nodesToVisit); 47668 } 47669 if (pendingRequests.length) { 47670 await this.xref.stream.manager.requestRanges(pendingRequests); 47671 for (const node of nodesToRevisit) { 47672 if (node instanceof Ref) { 47673 this.refSet.remove(node); 47674 } 47675 } 47676 await this.#walk(nodesToRevisit); 47677 } 47678 } 47679 static async load(obj, keys, xref) { 47680 if (xref.stream.isDataLoaded) { 47681 return; 47682 } 47683 const objLoader = new ObjectLoader(obj, keys, xref); 47684 await objLoader.load(); 47685 } 47686} 47687 47688;// ./src/core/xfa/symbol_utils.js 47689const $acceptWhitespace = Symbol(); 47690const $addHTML = Symbol(); 47691const $appendChild = Symbol(); 47692const $childrenToHTML = Symbol(); 47693const $clean = Symbol(); 47694const $cleanPage = Symbol(); 47695const $cleanup = Symbol(); 47696const $clone = Symbol(); 47697const $consumed = Symbol(); 47698const $content = Symbol("content"); 47699const $data = Symbol("data"); 47700const $dump = Symbol(); 47701const $extra = Symbol("extra"); 47702const $finalize = Symbol(); 47703const $flushHTML = Symbol(); 47704const $getAttributeIt = Symbol(); 47705const $getAttributes = Symbol(); 47706const $getAvailableSpace = Symbol(); 47707const $getChildrenByClass = Symbol(); 47708const $getChildrenByName = Symbol(); 47709const $getChildrenByNameIt = Symbol(); 47710const $getDataValue = Symbol(); 47711const $getExtra = Symbol(); 47712const $getRealChildrenByNameIt = Symbol(); 47713const $getChildren = Symbol(); 47714const $getContainedChildren = Symbol(); 47715const $getNextPage = Symbol(); 47716const $getSubformParent = Symbol(); 47717const $getParent = Symbol(); 47718const $getTemplateRoot = Symbol(); 47719const $globalData = Symbol(); 47720const $hasSettableValue = Symbol(); 47721const $ids = Symbol(); 47722const $indexOf = Symbol(); 47723const $insertAt = Symbol(); 47724const $isCDATAXml = Symbol(); 47725const $isBindable = Symbol(); 47726const $isDataValue = Symbol(); 47727const $isDescendent = Symbol(); 47728const $isNsAgnostic = Symbol(); 47729const $isSplittable = Symbol(); 47730const $isThereMoreWidth = Symbol(); 47731const $isTransparent = Symbol(); 47732const $isUsable = Symbol(); 47733const $lastAttribute = Symbol(); 47734const $namespaceId = Symbol("namespaceId"); 47735const $nodeName = Symbol("nodeName"); 47736const $nsAttributes = Symbol(); 47737const $onChild = Symbol(); 47738const $onChildCheck = Symbol(); 47739const $onText = Symbol(); 47740const $pushGlyphs = Symbol(); 47741const $popPara = Symbol(); 47742const $pushPara = Symbol(); 47743const $removeChild = Symbol(); 47744const $root = Symbol("root"); 47745const $resolvePrototypes = Symbol(); 47746const $searchNode = Symbol(); 47747const $setId = Symbol(); 47748const $setSetAttributes = Symbol(); 47749const $setValue = Symbol(); 47750const $tabIndex = Symbol(); 47751const $text = Symbol(); 47752const $toPages = Symbol(); 47753const $toHTML = Symbol(); 47754const $toString = Symbol(); 47755const $toStyle = Symbol(); 47756const $uid = Symbol("uid"); 47757 47758// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.flat-map.js 47759var es_iterator_flat_map = __webpack_require__(531); 47760// EXTERNAL MODULE: ./node_modules/core-js/modules/es.uint8-array.from-base64.js 47761var es_uint8_array_from_base64 = __webpack_require__(5213); 47762;// ./src/core/xfa/namespaces.js 47763const $buildXFAObject = Symbol(); 47764const NamespaceIds = { 47765 config: { 47766 id: 0, 47767 check: ns => ns.startsWith("http://www.xfa.org/schema/xci/") 47768 }, 47769 connectionSet: { 47770 id: 1, 47771 check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-connection-set/") 47772 }, 47773 datasets: { 47774 id: 2, 47775 check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-data/") 47776 }, 47777 form: { 47778 id: 3, 47779 check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-form/") 47780 }, 47781 localeSet: { 47782 id: 4, 47783 check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-locale-set/") 47784 }, 47785 pdf: { 47786 id: 5, 47787 check: ns => ns === "http://ns.adobe.com/xdp/pdf/" 47788 }, 47789 signature: { 47790 id: 6, 47791 check: ns => ns === "http://www.w3.org/2000/09/xmldsig#" 47792 }, 47793 sourceSet: { 47794 id: 7, 47795 check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-source-set/") 47796 }, 47797 stylesheet: { 47798 id: 8, 47799 check: ns => ns === "http://www.w3.org/1999/XSL/Transform" 47800 }, 47801 template: { 47802 id: 9, 47803 check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-template/") 47804 }, 47805 xdc: { 47806 id: 10, 47807 check: ns => ns.startsWith("http://www.xfa.org/schema/xdc/") 47808 }, 47809 xdp: { 47810 id: 11, 47811 check: ns => ns === "http://ns.adobe.com/xdp/" 47812 }, 47813 xfdf: { 47814 id: 12, 47815 check: ns => ns === "http://ns.adobe.com/xfdf/" 47816 }, 47817 xhtml: { 47818 id: 13, 47819 check: ns => ns === "http://www.w3.org/1999/xhtml" 47820 }, 47821 xmpmeta: { 47822 id: 14, 47823 check: ns => ns === "http://ns.adobe.com/xmpmeta/" 47824 } 47825}; 47826 47827;// ./src/core/xfa/utils.js 47828 47829 47830 47831 47832 47833 47834 47835const dimConverters = { 47836 pt: x => x, 47837 cm: x => x / 2.54 * 72, 47838 mm: x => x / (10 * 2.54) * 72, 47839 in: x => x * 72, 47840 px: x => x 47841}; 47842const measurementPattern = /([+-]?\d+\.?\d*)(.*)/; 47843function stripQuotes(str) { 47844 if (str.startsWith("'") || str.startsWith('"')) { 47845 return str.slice(1, -1); 47846 } 47847 return str; 47848} 47849function getInteger({ 47850 data, 47851 defaultValue, 47852 validate 47853}) { 47854 if (!data) { 47855 return defaultValue; 47856 } 47857 data = data.trim(); 47858 const n = parseInt(data, 10); 47859 if (!isNaN(n) && validate(n)) { 47860 return n; 47861 } 47862 return defaultValue; 47863} 47864function getFloat({ 47865 data, 47866 defaultValue, 47867 validate 47868}) { 47869 if (!data) { 47870 return defaultValue; 47871 } 47872 data = data.trim(); 47873 const n = parseFloat(data); 47874 if (!isNaN(n) && validate(n)) { 47875 return n; 47876 } 47877 return defaultValue; 47878} 47879function getKeyword({ 47880 data, 47881 defaultValue, 47882 validate 47883}) { 47884 if (!data) { 47885 return defaultValue; 47886 } 47887 data = data.trim(); 47888 if (validate(data)) { 47889 return data; 47890 } 47891 return defaultValue; 47892} 47893function getStringOption(data, options) { 47894 return getKeyword({ 47895 data, 47896 defaultValue: options[0], 47897 validate: k => options.includes(k) 47898 }); 47899} 47900function getMeasurement(str, def = "0") { 47901 def ||= "0"; 47902 if (!str) { 47903 return getMeasurement(def); 47904 } 47905 const match = str.trim().match(measurementPattern); 47906 if (!match) { 47907 return getMeasurement(def); 47908 } 47909 const [, valueStr, unit] = match; 47910 const value = parseFloat(valueStr); 47911 if (isNaN(value)) { 47912 return getMeasurement(def); 47913 } 47914 if (value === 0) { 47915 return 0; 47916 } 47917 const conv = dimConverters[unit]; 47918 if (conv) { 47919 return conv(value); 47920 } 47921 return value; 47922} 47923function getRatio(data) { 47924 if (!data) { 47925 return { 47926 num: 1, 47927 den: 1 47928 }; 47929 } 47930 const ratio = data.split(":", 2).map(x => parseFloat(x.trim())).filter(x => !isNaN(x)); 47931 if (ratio.length === 1) { 47932 ratio.push(1); 47933 } 47934 if (ratio.length === 0) { 47935 return { 47936 num: 1, 47937 den: 1 47938 }; 47939 } 47940 const [num, den] = ratio; 47941 return { 47942 num, 47943 den 47944 }; 47945} 47946function getRelevant(data) { 47947 if (!data) { 47948 return []; 47949 } 47950 return data.trim().split(/\s+/).map(e => ({ 47951 excluded: e[0] === "-", 47952 viewname: e.substring(1) 47953 })); 47954} 47955function getColor(data, def = [0, 0, 0]) { 47956 let [r, g, b] = def; 47957 if (!data) { 47958 return { 47959 r, 47960 g, 47961 b 47962 }; 47963 } 47964 const color = data.split(",", 3).map(c => MathClamp(parseInt(c.trim(), 10), 0, 255)).map(c => isNaN(c) ? 0 : c); 47965 if (color.length < 3) { 47966 return { 47967 r, 47968 g, 47969 b 47970 }; 47971 } 47972 [r, g, b] = color; 47973 return { 47974 r, 47975 g, 47976 b 47977 }; 47978} 47979function getBBox(data) { 47980 const def = -1; 47981 if (!data) { 47982 return { 47983 x: def, 47984 y: def, 47985 width: def, 47986 height: def 47987 }; 47988 } 47989 const bbox = data.split(",", 4).map(m => getMeasurement(m.trim(), "-1")); 47990 if (bbox.length < 4 || bbox[2] < 0 || bbox[3] < 0) { 47991 return { 47992 x: def, 47993 y: def, 47994 width: def, 47995 height: def 47996 }; 47997 } 47998 const [x, y, width, height] = bbox; 47999 return { 48000 x, 48001 y, 48002 width, 48003 height 48004 }; 48005} 48006class HTMLResult { 48007 static get FAILURE() { 48008 return shadow(this, "FAILURE", new HTMLResult(false, null, null, null)); 48009 } 48010 static get EMPTY() { 48011 return shadow(this, "EMPTY", new HTMLResult(true, null, null, null)); 48012 } 48013 constructor(success, html, bbox, breakNode) { 48014 this.success = success; 48015 this.html = html; 48016 this.bbox = bbox; 48017 this.breakNode = breakNode; 48018 } 48019 isBreak() { 48020 return !!this.breakNode; 48021 } 48022 static breakNode(node) { 48023 return new HTMLResult(false, null, null, node); 48024 } 48025 static success(html, bbox = null) { 48026 return new HTMLResult(true, html, bbox, null); 48027 } 48028} 48029 48030;// ./src/core/xfa/fonts.js 48031 48032 48033 48034 48035 48036 48037 48038 48039 48040 48041 48042 48043 48044 48045 48046 48047class FontFinder { 48048 constructor(pdfFonts) { 48049 this.fonts = new Map(); 48050 this.cache = new Map(); 48051 this.warned = new Set(); 48052 this.defaultFont = null; 48053 this.add(pdfFonts); 48054 } 48055 add(pdfFonts, reallyMissingFonts = null) { 48056 for (const pdfFont of pdfFonts) { 48057 this.addPdfFont(pdfFont); 48058 } 48059 for (const pdfFont of this.fonts.values()) { 48060 if (!pdfFont.regular) { 48061 pdfFont.regular = pdfFont.italic || pdfFont.bold || pdfFont.bolditalic; 48062 } 48063 } 48064 if (!reallyMissingFonts || reallyMissingFonts.size === 0) { 48065 return; 48066 } 48067 const myriad = this.fonts.get("PdfJS-Fallback-PdfJS-XFA"); 48068 for (const missing of reallyMissingFonts) { 48069 this.fonts.set(missing, myriad); 48070 } 48071 } 48072 addPdfFont(pdfFont) { 48073 const cssFontInfo = pdfFont.cssFontInfo; 48074 const name = cssFontInfo.fontFamily; 48075 const font = this.fonts.getOrInsertComputed(name, makeObj); 48076 this.defaultFont ??= font; 48077 let property = ""; 48078 const fontWeight = parseFloat(cssFontInfo.fontWeight); 48079 if (parseFloat(cssFontInfo.italicAngle) !== 0) { 48080 property = fontWeight >= 700 ? "bolditalic" : "italic"; 48081 } else if (fontWeight >= 700) { 48082 property = "bold"; 48083 } 48084 if (!property) { 48085 if (pdfFont.name.includes("Bold") || pdfFont.psName?.includes("Bold")) { 48086 property = "bold"; 48087 } 48088 if (pdfFont.name.includes("Italic") || pdfFont.name.endsWith("It") || pdfFont.psName?.includes("Italic") || pdfFont.psName?.endsWith("It")) { 48089 property += "italic"; 48090 } 48091 } 48092 if (!property) { 48093 property = "regular"; 48094 } 48095 font[property] = pdfFont; 48096 } 48097 getDefault() { 48098 return this.defaultFont; 48099 } 48100 find(fontName, mustWarn = true) { 48101 let font = this.fonts.get(fontName) || this.cache.get(fontName); 48102 if (font) { 48103 return font; 48104 } 48105 const pattern = /,|-|_| |bolditalic|bold|italic|regular|it/gi; 48106 let name = fontName.replaceAll(pattern, ""); 48107 font = this.fonts.get(name); 48108 if (font) { 48109 this.cache.set(fontName, font); 48110 return font; 48111 } 48112 name = name.toLowerCase(); 48113 const maybe = []; 48114 for (const [family, pdfFont] of this.fonts) { 48115 if (family.replaceAll(pattern, "").toLowerCase().startsWith(name)) { 48116 maybe.push(pdfFont); 48117 } 48118 } 48119 if (maybe.length === 0) { 48120 for (const pdfFont of this.fonts.values()) { 48121 if (pdfFont.regular.name?.replaceAll(pattern, "").toLowerCase().startsWith(name)) { 48122 maybe.push(pdfFont); 48123 } 48124 } 48125 } 48126 if (maybe.length === 0) { 48127 name = name.replaceAll(/psmt|mt/gi, ""); 48128 for (const [family, pdfFont] of this.fonts) { 48129 if (family.replaceAll(pattern, "").toLowerCase().startsWith(name)) { 48130 maybe.push(pdfFont); 48131 } 48132 } 48133 } 48134 if (maybe.length === 0) { 48135 for (const pdfFont of this.fonts.values()) { 48136 if (pdfFont.regular.name?.replaceAll(pattern, "").toLowerCase().startsWith(name)) { 48137 maybe.push(pdfFont); 48138 } 48139 } 48140 } 48141 if (maybe.length >= 1) { 48142 if (maybe.length !== 1 && mustWarn) { 48143 warn(`XFA - Too many choices to guess the correct font: ${fontName}`); 48144 } 48145 this.cache.set(fontName, maybe[0]); 48146 return maybe[0]; 48147 } 48148 if (mustWarn && !this.warned.has(fontName)) { 48149 this.warned.add(fontName); 48150 warn(`XFA - Cannot find the font: ${fontName}`); 48151 } 48152 return null; 48153 } 48154} 48155function selectFont(xfaFont, typeface) { 48156 if (xfaFont.posture === "italic") { 48157 if (xfaFont.weight === "bold") { 48158 return typeface.bolditalic; 48159 } 48160 return typeface.italic; 48161 } else if (xfaFont.weight === "bold") { 48162 return typeface.bold; 48163 } 48164 return typeface.regular; 48165} 48166function fonts_getMetrics(xfaFont, real = false) { 48167 let pdfFont = null; 48168 if (xfaFont) { 48169 const name = stripQuotes(xfaFont.typeface); 48170 const typeface = xfaFont[$globalData].fontFinder.find(name); 48171 pdfFont = selectFont(xfaFont, typeface); 48172 } 48173 if (!pdfFont) { 48174 return { 48175 lineHeight: 12, 48176 lineGap: 2, 48177 lineNoGap: 10 48178 }; 48179 } 48180 const size = xfaFont.size || 10; 48181 const lineHeight = pdfFont.lineHeight ? Math.max(real ? 0 : 1.2, pdfFont.lineHeight) : 1.2; 48182 const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap; 48183 return { 48184 lineHeight: lineHeight * size, 48185 lineGap: lineGap * size, 48186 lineNoGap: Math.max(1, lineHeight - lineGap) * size 48187 }; 48188} 48189 48190;// ./src/core/xfa/text.js 48191 48192
vendor: 6,666 bytes, lines 48193-48398
48193 48194 48195const WIDTH_FACTOR = 1.02; 48196class FontInfo { 48197 constructor(xfaFont, margin, lineHeight, fontFinder) { 48198 this.lineHeight = lineHeight; 48199 this.paraMargin = margin || { 48200 top: 0, 48201 bottom: 0, 48202 left: 0, 48203 right: 0 48204 }; 48205 if (!xfaFont) { 48206 [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder); 48207 return; 48208 } 48209 this.xfaFont = { 48210 typeface: xfaFont.typeface, 48211 posture: xfaFont.posture, 48212 weight: xfaFont.weight, 48213 size: xfaFont.size, 48214 letterSpacing: xfaFont.letterSpacing 48215 }; 48216 const typeface = fontFinder.find(xfaFont.typeface); 48217 if (!typeface) { 48218 [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder); 48219 return; 48220 } 48221 this.pdfFont = selectFont(xfaFont, typeface); 48222 if (!this.pdfFont) { 48223 [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder); 48224 } 48225 } 48226 defaultFont(fontFinder) { 48227 const font = fontFinder.find("Helvetica", false) || fontFinder.find("Myriad Pro", false) || fontFinder.find("Arial", false) || fontFinder.getDefault(); 48228 if (font?.regular) { 48229 const pdfFont = font.regular; 48230 const info = pdfFont.cssFontInfo; 48231 const xfaFont = { 48232 typeface: info.fontFamily, 48233 posture: "normal", 48234 weight: "normal", 48235 size: 10, 48236 letterSpacing: 0 48237 }; 48238 return [pdfFont, xfaFont]; 48239 } 48240 const xfaFont = { 48241 typeface: "Courier", 48242 posture: "normal", 48243 weight: "normal", 48244 size: 10, 48245 letterSpacing: 0 48246 }; 48247 return [null, xfaFont]; 48248 } 48249} 48250class FontSelector { 48251 constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder) { 48252 this.fontFinder = fontFinder; 48253 this.stack = [new FontInfo(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder)]; 48254 } 48255 pushData(xfaFont, margin, lineHeight) { 48256 const lastFont = this.stack.at(-1); 48257 for (const name of ["typeface", "posture", "weight", "size", "letterSpacing"]) { 48258 xfaFont[name] ||= lastFont.xfaFont[name]; 48259 } 48260 for (const name of ["top", "bottom", "left", "right"]) { 48261 if (isNaN(margin[name])) { 48262 margin[name] = lastFont.paraMargin[name]; 48263 } 48264 } 48265 const fontInfo = new FontInfo(xfaFont, margin, lineHeight || lastFont.lineHeight, this.fontFinder); 48266 fontInfo.pdfFont ||= lastFont.pdfFont; 48267 this.stack.push(fontInfo); 48268 } 48269 popFont() { 48270 this.stack.pop(); 48271 } 48272 topFont() { 48273 return this.stack.at(-1); 48274 } 48275} 48276class TextMeasure { 48277 constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts) { 48278 this.glyphs = []; 48279 this.fontSelector = new FontSelector(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts); 48280 this.extraHeight = 0; 48281 } 48282 pushData(xfaFont, margin, lineHeight) { 48283 this.fontSelector.pushData(xfaFont, margin, lineHeight); 48284 } 48285 popFont(xfaFont) { 48286 return this.fontSelector.popFont(); 48287 } 48288 addPara() { 48289 const lastFont = this.fontSelector.topFont(); 48290 this.extraHeight += lastFont.paraMargin.top + lastFont.paraMargin.bottom; 48291 } 48292 addString(str) { 48293 if (!str) { 48294 return; 48295 } 48296 const lastFont = this.fontSelector.topFont(); 48297 const fontSize = lastFont.xfaFont.size; 48298 if (lastFont.pdfFont) { 48299 const letterSpacing = lastFont.xfaFont.letterSpacing; 48300 const pdfFont = lastFont.pdfFont; 48301 const fontLineHeight = pdfFont.lineHeight || 1.2; 48302 const lineHeight = lastFont.lineHeight || Math.max(1.2, fontLineHeight) * fontSize; 48303 const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap; 48304 const noGap = fontLineHeight - lineGap; 48305 const firstLineHeight = Math.max(1, noGap) * fontSize; 48306 const scale = fontSize / 1000; 48307 const fallbackWidth = pdfFont.defaultWidth || pdfFont.charsToGlyphs(" ")[0].width; 48308 for (const line of str.split(/[\u2029\n]/)) { 48309 const encodedLine = pdfFont.encodeString(line).join(""); 48310 const glyphs = pdfFont.charsToGlyphs(encodedLine); 48311 for (const glyph of glyphs) { 48312 const width = glyph.width || fallbackWidth; 48313 this.glyphs.push([width * scale + letterSpacing, lineHeight, firstLineHeight, glyph.unicode, false]); 48314 } 48315 this.glyphs.push([0, 0, 0, "\n", true]); 48316 } 48317 this.glyphs.pop(); 48318 return; 48319 } 48320 for (const line of str.split(/[\u2029\n]/)) { 48321 for (const char of line.split("")) { 48322 this.glyphs.push([fontSize, 1.2 * fontSize, fontSize, char, false]); 48323 } 48324 this.glyphs.push([0, 0, 0, "\n", true]); 48325 } 48326 this.glyphs.pop(); 48327 } 48328 compute(maxWidth) { 48329 let lastSpacePos = -1, 48330 lastSpaceWidth = 0, 48331 width = 0, 48332 height = 0, 48333 currentLineWidth = 0, 48334 currentLineHeight = 0; 48335 let isBroken = false; 48336 let isFirstLine = true; 48337 for (let i = 0, ii = this.glyphs.length; i < ii; i++) { 48338 const [glyphWidth, lineHeight, firstLineHeight, char, isEOL] = this.glyphs[i]; 48339 const isSpace = char === " "; 48340 const glyphHeight = isFirstLine ? firstLineHeight : lineHeight; 48341 if (isEOL) { 48342 width = Math.max(width, currentLineWidth); 48343 currentLineWidth = 0; 48344 height += currentLineHeight; 48345 currentLineHeight = glyphHeight; 48346 lastSpacePos = -1; 48347 lastSpaceWidth = 0; 48348 isFirstLine = false; 48349 continue; 48350 } 48351 if (isSpace) { 48352 if (currentLineWidth + glyphWidth > maxWidth) { 48353 width = Math.max(width, currentLineWidth); 48354 currentLineWidth = 0; 48355 height += currentLineHeight; 48356 currentLineHeight = glyphHeight; 48357 lastSpacePos = -1; 48358 lastSpaceWidth = 0; 48359 isBroken = true; 48360 isFirstLine = false; 48361 } else { 48362 currentLineHeight = Math.max(glyphHeight, currentLineHeight); 48363 lastSpaceWidth = currentLineWidth; 48364 currentLineWidth += glyphWidth; 48365 lastSpacePos = i; 48366 } 48367 continue; 48368 } 48369 if (currentLineWidth + glyphWidth > maxWidth) { 48370 height += currentLineHeight; 48371 currentLineHeight = glyphHeight; 48372 if (lastSpacePos !== -1) { 48373 i = lastSpacePos; 48374 width = Math.max(width, lastSpaceWidth); 48375 currentLineWidth = 0; 48376 lastSpacePos = -1; 48377 lastSpaceWidth = 0; 48378 } else { 48379 width = Math.max(width, currentLineWidth); 48380 currentLineWidth = glyphWidth; 48381 } 48382 isBroken = true; 48383 isFirstLine = false; 48384 continue; 48385 } 48386 currentLineWidth += glyphWidth; 48387 currentLineHeight = Math.max(glyphHeight, currentLineHeight); 48388 } 48389 width = Math.max(width, currentLineWidth); 48390 height += currentLineHeight + this.extraHeight; 48391 return { 48392 width: WIDTH_FACTOR * width, 48393 height, 48394 isBroken 48395 }; 48396 } 48397} 48398
vendor: 3,807 bytes, lines 48399-48535
48399// EXTERNAL MODULE: ./node_modules/core-js/modules/es.weak-map.get-or-insert.js 48400var es_weak_map_get_or_insert = __webpack_require__(8454); 48401// EXTERNAL MODULE: ./node_modules/core-js/modules/es.weak-map.get-or-insert-computed.js 48402var es_weak_map_get_or_insert_computed = __webpack_require__(9452); 48403;// ./src/core/xfa/som.js 48404 48405 48406 48407 48408 48409 48410 48411 48412 48413 48414const namePattern = /^[^.[]+/; 48415const indexPattern = /^[^\]]+/; 48416const operators = { 48417 dot: 0, 48418 dotDot: 1, 48419 dotHash: 2, 48420 dotBracket: 3, 48421 dotParen: 4 48422}; 48423const shortcuts = new Map([["$data", (root, current) => root.datasets ? root.datasets.data : root], ["$record", (root, current) => (root.datasets ? root.datasets.data : root)[$getChildren]()[0]], ["$template", (root, current) => root.template], ["$connectionSet", (root, current) => root.connectionSet], ["$form", (root, current) => root.form], ["$layout", (root, current) => root.layout], ["$host", (root, current) => root.host], ["$dataWindow", (root, current) => root.dataWindow], ["$event", (root, current) => root.event], ["!", (root, current) => root.datasets], ["$xfa", (root, current) => root], ["xfa", (root, current) => root], ["$", (root, current) => current]]); 48424const somCache = new WeakMap(); 48425function parseIndex(index) { 48426 index = index.trim(); 48427 if (index === "*") { 48428 return Infinity; 48429 } 48430 return parseInt(index, 10) || 0; 48431} 48432function parseExpression(expr, dotDotAllowed, noExpr = true) { 48433 let match = expr.match(namePattern); 48434 if (!match) { 48435 return null; 48436 } 48437 let [name] = match; 48438 const parsed = [{ 48439 name, 48440 cacheName: "." + name, 48441 index: 0, 48442 js: null, 48443 formCalc: null, 48444 operator: operators.dot 48445 }]; 48446 let pos = name.length; 48447 while (pos < expr.length) { 48448 const spos = pos; 48449 const char = expr.charAt(pos++); 48450 if (char === "[") { 48451 match = expr.slice(pos).match(indexPattern); 48452 if (!match) { 48453 warn("XFA - Invalid index in SOM expression"); 48454 return null; 48455 } 48456 parsed.at(-1).index = parseIndex(match[0]); 48457 pos += match[0].length + 1; 48458 continue; 48459 } 48460 let operator; 48461 switch (expr.charAt(pos)) { 48462 case ".": 48463 if (!dotDotAllowed) { 48464 return null; 48465 } 48466 pos++; 48467 operator = operators.dotDot; 48468 break; 48469 case "#": 48470 pos++; 48471 operator = operators.dotHash; 48472 break; 48473 case "[": 48474 if (noExpr) { 48475 warn("XFA - SOM expression contains a FormCalc subexpression which is not supported for now."); 48476 return null; 48477 } 48478 operator = operators.dotBracket; 48479 break; 48480 case "(": 48481 if (noExpr) { 48482 warn("XFA - SOM expression contains a JavaScript subexpression which is not supported for now."); 48483 return null; 48484 } 48485 operator = operators.dotParen; 48486 break; 48487 default: 48488 operator = operators.dot; 48489 break; 48490 } 48491 match = expr.slice(pos).match(namePattern); 48492 if (!match) { 48493 break; 48494 } 48495 [name] = match; 48496 pos += name.length; 48497 parsed.push({ 48498 name, 48499 cacheName: expr.slice(spos, pos), 48500 operator, 48501 index: 0, 48502 js: null, 48503 formCalc: null 48504 }); 48505 } 48506 return parsed; 48507} 48508function searchNode(root, container, expr, dotDotAllowed = true, useCache = true) { 48509 const parsed = parseExpression(expr, dotDotAllowed); 48510 if (!parsed) { 48511 return null; 48512 } 48513 const fn = shortcuts.get(parsed[0].name); 48514 let i = 0; 48515 let isQualified; 48516 if (fn) { 48517 isQualified = true; 48518 root = [fn(root, container)]; 48519 i = 1; 48520 } else { 48521 isQualified = container === null; 48522 root = [container || root]; 48523 } 48524 for (let ii = parsed.length; i < ii; i++) { 48525 const { 48526 name, 48527 cacheName, 48528 operator, 48529 index 48530 } = parsed[i]; 48531 const nodes = []; 48532 for (const node of root) { 48533 if (!node.isXFAObject) { 48534 continue; 48535 }
vendor: 6,067 bytes, lines 48536-48789
48536 let children, cached; 48537 if (useCache) { 48538 cached = somCache.getOrInsertComputed(node, makeMap); 48539 children = cached.get(cacheName); 48540 } 48541 if (!children) { 48542 switch (operator) { 48543 case operators.dot: 48544 children = node[$getChildrenByName](name, false); 48545 break; 48546 case operators.dotDot: 48547 children = node[$getChildrenByName](name, true); 48548 break; 48549 case operators.dotHash: 48550 children = node[$getChildrenByClass](name); 48551 children = children.isXFAObjectArray ? children.children : [children]; 48552 break; 48553 default: 48554 break; 48555 } 48556 if (useCache) { 48557 cached.set(cacheName, children); 48558 } 48559 } 48560 if (children.length > 0) { 48561 nodes.push(children); 48562 } 48563 } 48564 if (nodes.length === 0 && !isQualified && i === 0) { 48565 const parent = container[$getParent](); 48566 container = parent; 48567 if (!container) { 48568 return null; 48569 } 48570 i = -1; 48571 root = [container]; 48572 continue; 48573 } 48574 root = isFinite(index) ? nodes.filter(node => index < node.length).map(node => node[index]) : nodes.flat(); 48575 } 48576 if (root.length === 0) { 48577 return null; 48578 } 48579 return root; 48580} 48581function createDataNode(root, container, expr) { 48582 const parsed = parseExpression(expr); 48583 if (!parsed) { 48584 return null; 48585 } 48586 if (parsed.some(x => x.operator === operators.dotDot)) { 48587 return null; 48588 } 48589 const fn = shortcuts.get(parsed[0].name); 48590 let i = 0; 48591 if (fn) { 48592 root = fn(root, container); 48593 i = 1; 48594 } else { 48595 root = container || root; 48596 } 48597 for (let ii = parsed.length; i < ii; i++) { 48598 const { 48599 name, 48600 operator, 48601 index 48602 } = parsed[i]; 48603 if (!isFinite(index)) { 48604 parsed[i].index = 0; 48605 return root.createNodes(parsed.slice(i)); 48606 } 48607 let children; 48608 switch (operator) { 48609 case operators.dot: 48610 children = root[$getChildrenByName](name, false); 48611 break; 48612 case operators.dotDot: 48613 children = root[$getChildrenByName](name, true); 48614 break; 48615 case operators.dotHash: 48616 children = root[$getChildrenByClass](name); 48617 children = children.isXFAObjectArray ? children.children : [children]; 48618 break; 48619 default: 48620 break; 48621 } 48622 if (children.length === 0) { 48623 return root.createNodes(parsed.slice(i)); 48624 } 48625 if (index < children.length) { 48626 const child = children[index]; 48627 if (!child.isXFAObject) { 48628 warn(`XFA - Cannot create a node.`); 48629 return null; 48630 } 48631 root = child; 48632 } else { 48633 parsed[i].index = index - children.length; 48634 return root.createNodes(parsed.slice(i)); 48635 } 48636 } 48637 return null; 48638} 48639 48640;// ./src/core/xfa/xfa_object.js 48641 48642 48643 48644 48645 48646 48647 48648 48649 48650 48651 48652 48653 48654 48655 48656 48657 48658 48659 48660 48661const _applyPrototype = Symbol(); 48662const _attributes = Symbol(); 48663const _attributeNames = Symbol(); 48664const _children = Symbol("_children"); 48665const _cloneAttribute = Symbol(); 48666const _dataValue = Symbol(); 48667const _defaultValue = Symbol(); 48668const _filteredChildrenGenerator = Symbol(); 48669const _getPrototype = Symbol(); 48670const _getUnsetAttributes = Symbol(); 48671const _hasChildren = Symbol(); 48672const _max = Symbol(); 48673const _options = Symbol(); 48674const _parent = Symbol("parent"); 48675const _resolvePrototypesHelper = Symbol(); 48676const _setAttributes = Symbol(); 48677const _validator = Symbol(); 48678let uid = 0; 48679const NS_DATASETS = NamespaceIds.datasets.id; 48680class XFAObject { 48681 constructor(nsId, name, hasChildren = false) { 48682 this[$namespaceId] = nsId; 48683 this[$nodeName] = name; 48684 this[_hasChildren] = hasChildren; 48685 this[_parent] = null; 48686 this[_children] = []; 48687 this[$uid] = `${name}${uid++}`; 48688 this[$globalData] = null; 48689 } 48690 get isXFAObject() { 48691 return true; 48692 } 48693 get isXFAObjectArray() { 48694 return false; 48695 } 48696 createNodes(path) { 48697 let root = this, 48698 node = null; 48699 for (const { 48700 name, 48701 index 48702 } of path) { 48703 for (let i = 0, ii = isFinite(index) ? index : 0; i <= ii; i++) { 48704 const nsId = root[$namespaceId] === NS_DATASETS ? -1 : root[$namespaceId]; 48705 node = new XmlObject(nsId, name); 48706 root[$appendChild](node); 48707 } 48708 root = node; 48709 } 48710 return node; 48711 } 48712 [$onChild](child) { 48713 if (!this[_hasChildren] || !this[$onChildCheck](child)) { 48714 return false; 48715 } 48716 const name = child[$nodeName]; 48717 const node = this[name]; 48718 if (node instanceof XFAObjectArray) { 48719 if (node.push(child)) { 48720 this[$appendChild](child); 48721 return true; 48722 } 48723 } else { 48724 if (node !== null) { 48725 this[$removeChild](node); 48726 } 48727 this[name] = child; 48728 this[$appendChild](child); 48729 return true; 48730 } 48731 let id = ""; 48732 if (this.id) { 48733 id = ` (id: ${this.id})`; 48734 } else if (this.name) { 48735 id = ` (name: ${this.name} ${this.h.value})`; 48736 } 48737 warn(`XFA - node "${this[$nodeName]}"${id} has already enough "${name}"!`); 48738 return false; 48739 } 48740 [$onChildCheck](child) { 48741 return Object.hasOwn(this, child[$nodeName]) && child[$namespaceId] === this[$namespaceId]; 48742 } 48743 [$isNsAgnostic]() { 48744 return false; 48745 } 48746 [$acceptWhitespace]() { 48747 return false; 48748 } 48749 [$isCDATAXml]() { 48750 return false; 48751 } 48752 [$isBindable]() { 48753 return false; 48754 } 48755 [$popPara]() { 48756 if (this.para) { 48757 this[$getTemplateRoot]()[$extra].paraStack.pop(); 48758 } 48759 } 48760 [$pushPara]() { 48761 this[$getTemplateRoot]()[$extra].paraStack.push(this.para); 48762 } 48763 [$setId](ids) { 48764 if (this.id && this[$namespaceId] === NamespaceIds.template.id) { 48765 ids.set(this.id, this); 48766 } 48767 } 48768 [$getTemplateRoot]() { 48769 return this[$globalData].template; 48770 } 48771 [$isSplittable]() { 48772 return false; 48773 } 48774 [$isThereMoreWidth]() { 48775 return false; 48776 } 48777 [$appendChild](child) { 48778 child[_parent] = this; 48779 this[_children].push(child); 48780 if (!child[$globalData] && this[$globalData]) { 48781 child[$globalData] = this[$globalData]; 48782 } 48783 } 48784 [$removeChild](child) { 48785 const i = this[_children].indexOf(child); 48786 this[_children].splice(i, 1); 48787 } 48788 [$hasSettableValue]() { 48789 return Object.hasOwn(this,
vendor: 12,019 bytes, lines 48789-49227
48789"value"); 48790 } 48791 [$setValue](_) {} 48792 [$onText](_) {} 48793 [$finalize]() {} 48794 [$clean](builder) { 48795 delete this[_hasChildren]; 48796 if (this[$cleanup]) { 48797 builder.clean(this[$cleanup]); 48798 delete this[$cleanup]; 48799 } 48800 } 48801 [$indexOf](child) { 48802 return this[_children].indexOf(child); 48803 } 48804 [$insertAt](i, child) { 48805 child[_parent] = this; 48806 this[_children].splice(i, 0, child); 48807 if (!child[$globalData] && this[$globalData]) { 48808 child[$globalData] = this[$globalData]; 48809 } 48810 } 48811 [$isTransparent]() { 48812 return !this.name; 48813 } 48814 [$lastAttribute]() { 48815 return ""; 48816 } 48817 [$text]() { 48818 if (this[_children].length === 0) { 48819 return this[$content]; 48820 } 48821 return this[_children].map(c => c[$text]()).join(""); 48822 } 48823 get [_attributeNames]() { 48824 const proto = Object.getPrototypeOf(this); 48825 if (!proto._attributes) { 48826 const attributes = proto._attributes = new Set(); 48827 for (const name of Object.getOwnPropertyNames(this)) { 48828 if (this[name] === null || this[name] instanceof XFAObject || this[name] instanceof XFAObjectArray) { 48829 break; 48830 } 48831 attributes.add(name); 48832 } 48833 } 48834 return shadow(this, _attributeNames, proto._attributes); 48835 } 48836 [$isDescendent](parent) { 48837 let node = this; 48838 while (node) { 48839 if (node === parent) { 48840 return true; 48841 } 48842 node = node[$getParent](); 48843 } 48844 return false; 48845 } 48846 [$getParent]() { 48847 return this[_parent]; 48848 } 48849 [$getSubformParent]() { 48850 return this[$getParent](); 48851 } 48852 [$getChildren](name = null) { 48853 if (!name) { 48854 return this[_children]; 48855 } 48856 return this[name]; 48857 } 48858 [$dump]() { 48859 const dumped = Object.create(null); 48860 if (this[$content]) { 48861 dumped.$content = this[$content]; 48862 } 48863 for (const name of Object.getOwnPropertyNames(this)) { 48864 const value = this[name]; 48865 if (value === null) { 48866 continue; 48867 } 48868 if (value instanceof XFAObject) { 48869 dumped[name] = value[$dump](); 48870 } else if (value instanceof XFAObjectArray) { 48871 if (!value.isEmpty()) { 48872 dumped[name] = value.dump(); 48873 } 48874 } else { 48875 dumped[name] = value; 48876 } 48877 } 48878 return dumped; 48879 } 48880 [$toStyle]() { 48881 return null; 48882 } 48883 [$toHTML]() { 48884 return HTMLResult.EMPTY; 48885 } 48886 *[$getContainedChildren]() { 48887 for (const node of this[$getChildren]()) { 48888 yield node; 48889 } 48890 } 48891 *[_filteredChildrenGenerator](filter, include) { 48892 for (const node of this[$getContainedChildren]()) { 48893 if (!filter || include === filter.has(node[$nodeName])) { 48894 const availableSpace = this[$getAvailableSpace](); 48895 const res = node[$toHTML](availableSpace); 48896 if (!res.success) { 48897 this[$extra].failingNode = node; 48898 } 48899 yield res; 48900 } 48901 } 48902 } 48903 [$flushHTML]() { 48904 return null; 48905 } 48906 [$addHTML](html, bbox) { 48907 this[$extra].children.push(html); 48908 } 48909 [$getAvailableSpace]() {} 48910 [$childrenToHTML]({ 48911 filter = null, 48912 include = true 48913 }) { 48914 if (!this[$extra].generator) { 48915 this[$extra].generator = this[_filteredChildrenGenerator](filter, include); 48916 } else { 48917 const availableSpace = this[$getAvailableSpace](); 48918 const res = this[$extra].failingNode[$toHTML](availableSpace); 48919 if (!res.success) { 48920 return res; 48921 } 48922 if (res.html) { 48923 this[$addHTML](res.html, res.bbox); 48924 } 48925 delete this[$extra].failingNode; 48926 } 48927 while (true) { 48928 const gen = this[$extra].generator.next(); 48929 if (gen.done) { 48930 break; 48931 } 48932 const res = gen.value; 48933 if (!res.success) { 48934 return res; 48935 } 48936 if (res.html) { 48937 this[$addHTML](res.html, res.bbox); 48938 } 48939 } 48940 this[$extra].generator = null; 48941 return HTMLResult.EMPTY; 48942 } 48943 [$setSetAttributes](attributes) { 48944 this[_setAttributes] = new Set(Object.keys(attributes)); 48945 } 48946 [_getUnsetAttributes](protoAttributes) { 48947 const allAttr = this[_attributeNames]; 48948 const setAttr = this[_setAttributes]; 48949 return [...protoAttributes].filter(x => allAttr.has(x) && !setAttr.has(x)); 48950 } 48951 [$resolvePrototypes](ids, ancestors = new Set()) { 48952 for (const child of this[_children]) { 48953 child[_resolvePrototypesHelper](ids, ancestors); 48954 } 48955 } 48956 [_resolvePrototypesHelper](ids, ancestors) { 48957 const proto = this[_getPrototype](ids, ancestors); 48958 if (proto) { 48959 this[_applyPrototype](proto, ids, ancestors); 48960 } else { 48961 this[$resolvePrototypes](ids, ancestors); 48962 } 48963 } 48964 [_getPrototype](ids, ancestors) { 48965 const { 48966 use, 48967 usehref 48968 } = this; 48969 if (!use && !usehref) { 48970 return null; 48971 } 48972 let proto = null; 48973 let somExpression = null; 48974 let id = null; 48975 let ref = use; 48976 if (usehref) { 48977 ref = usehref; 48978 if (usehref.startsWith("#som(") && usehref.endsWith(")")) { 48979 somExpression = usehref.slice("#som(".length, -1); 48980 } else if (usehref.startsWith(".#som(") && usehref.endsWith(")")) { 48981 somExpression = usehref.slice(".#som(".length, -1); 48982 } else if (usehref.startsWith("#")) { 48983 id = usehref.slice(1); 48984 } else if (usehref.startsWith(".#")) { 48985 id = usehref.slice(2); 48986 } 48987 } else if (use.startsWith("#")) { 48988 id = use.slice(1); 48989 } else { 48990 somExpression = use; 48991 } 48992 this.use = this.usehref = ""; 48993 if (id) { 48994 proto = ids.get(id); 48995 } else { 48996 proto = searchNode(ids.get($root), this, somExpression, true, false); 48997 if (proto) { 48998 proto = proto[0]; 48999 } 49000 } 49001 if (!proto) { 49002 warn(`XFA - Invalid prototype reference: ${ref}.`); 49003 return null; 49004 } 49005 if (proto[$nodeName] !== this[$nodeName]) { 49006 warn(`XFA - Incompatible prototype: ${proto[$nodeName]} !== ${this[$nodeName]}.`); 49007 return null; 49008 } 49009 if (ancestors.has(proto)) { 49010 warn(`XFA - Cycle detected in prototypes use.`); 49011 return null; 49012 } 49013 ancestors.add(proto); 49014 const protoProto = proto[_getPrototype](ids, ancestors); 49015 if (protoProto) { 49016 proto[_applyPrototype](protoProto, ids, ancestors); 49017 } 49018 proto[$resolvePrototypes](ids, ancestors); 49019 ancestors.delete(proto); 49020 return proto; 49021 } 49022 [_applyPrototype](proto, ids, ancestors) { 49023 if (ancestors.has(proto)) { 49024 warn(`XFA - Cycle detected in prototypes use.`); 49025 return; 49026 } 49027 if (!this[$content] && proto[$content]) { 49028 this[$content] = proto[$content]; 49029 } 49030 const newAncestors = new Set(ancestors); 49031 newAncestors.add(proto); 49032 for (const unsetAttrName of this[_getUnsetAttributes](proto[_setAttributes])) { 49033 this[unsetAttrName] = proto[unsetAttrName]; 49034 if (this[_setAttributes]) { 49035 this[_setAttributes].add(unsetAttrName); 49036 } 49037 } 49038 for (const name of Object.getOwnPropertyNames(this)) { 49039 if (this[_attributeNames].has(name)) { 49040 continue; 49041 } 49042 const value = this[name]; 49043 const protoValue = proto[name]; 49044 if (value instanceof XFAObjectArray) { 49045 for (const child of value[_children]) { 49046 child[_resolvePrototypesHelper](ids, ancestors); 49047 } 49048 for (let i = value[_children].length, ii = protoValue[_children].length; i < ii; i++) { 49049 const child = proto[_children][i][$clone](); 49050 if (value.push(child)) { 49051 child[_parent] = this; 49052 this[_children].push(child); 49053 child[_resolvePrototypesHelper](ids, ancestors); 49054 } else { 49055 break; 49056 } 49057 } 49058 continue; 49059 } 49060 if (value !== null) { 49061 value[$resolvePrototypes](ids, ancestors); 49062 if (protoValue) { 49063 value[_applyPrototype](protoValue, ids, ancestors); 49064 } 49065 continue; 49066 } 49067 if (protoValue !== null) { 49068 const child = protoValue[$clone](); 49069 child[_parent] = this; 49070 this[name] = child; 49071 this[_children].push(child); 49072 child[_resolvePrototypesHelper](ids, ancestors); 49073 } 49074 } 49075 } 49076 static [_cloneAttribute](obj) { 49077 if (Array.isArray(obj)) { 49078 return obj.map(x => XFAObject[_cloneAttribute](x)); 49079 } 49080 if (typeof obj === "object" && obj !== null) { 49081 return Object.assign({}, obj); 49082 } 49083 return obj; 49084 } 49085 [$clone]() { 49086 const clone = Object.create(Object.getPrototypeOf(this)); 49087 for (const $symbol of Object.getOwnPropertySymbols(this)) { 49088 try { 49089 clone[$symbol] = this[$symbol]; 49090 } catch { 49091 shadow(clone, $symbol, this[$symbol]); 49092 } 49093 } 49094 clone[$uid] = `${clone[$nodeName]}${uid++}`; 49095 clone[_children] = []; 49096 for (const name of Object.getOwnPropertyNames(this)) { 49097 if (this[_attributeNames].has(name)) { 49098 clone[name] = XFAObject[_cloneAttribute](this[name]); 49099 continue; 49100 } 49101 const value = this[name]; 49102 clone[name] = value instanceof XFAObjectArray ? new XFAObjectArray(value[_max]) : null; 49103 } 49104 for (const child of this[_children]) { 49105 const name = child[$nodeName]; 49106 const clonedChild = child[$clone](); 49107 clone[_children].push(clonedChild); 49108 clonedChild[_parent] = clone; 49109 if (clone[name] === null) { 49110 clone[name] = clonedChild; 49111 } else { 49112 clone[name][_children].push(clonedChild); 49113 } 49114 } 49115 return clone; 49116 } 49117 [$getChildren](name = null) { 49118 if (!name) { 49119 return this[_children]; 49120 } 49121 return this[_children].filter(c => c[$nodeName] === name); 49122 } 49123 [$getChildrenByClass](name) { 49124 return this[name]; 49125 } 49126 [$getChildrenByName](name, allTransparent, first = true) { 49127 return Array.from(this[$getChildrenByNameIt](name, allTransparent, first)); 49128 } 49129 *[$getChildrenByNameIt](name, allTransparent, first = true) { 49130 if (name === "parent") { 49131 yield this[_parent]; 49132 return; 49133 } 49134 for (const child of this[_children]) { 49135 if (child[$nodeName] === name) { 49136 yield child; 49137 } 49138 if (child.name === name) { 49139 yield child; 49140 } 49141 if (allTransparent || child[$isTransparent]()) { 49142 yield* child[$getChildrenByNameIt](name, allTransparent, false); 49143 } 49144 } 49145 if (first && this[_attributeNames].has(name)) { 49146 yield new XFAAttribute(this, name, this[name]); 49147 } 49148 } 49149} 49150class XFAObjectArray { 49151 constructor(max = Infinity) { 49152 this[_max] = max; 49153 this[_children] = []; 49154 } 49155 get isXFAObject() { 49156 return false; 49157 } 49158 get isXFAObjectArray() { 49159 return true; 49160 } 49161 push(child) { 49162 const len = this[_children].length; 49163 if (len <= this[_max]) { 49164 this[_children].push(child); 49165 return true; 49166 } 49167 warn(`XFA - node "${child[$nodeName]}" accepts no more than ${this[_max]} children`); 49168 return false; 49169 } 49170 isEmpty() { 49171 return this[_children].length === 0; 49172 } 49173 dump() { 49174 return this[_children].length === 1 ? this[_children][0][$dump]() : this[_children].map(x => x[$dump]()); 49175 } 49176 [$clone]() { 49177 const clone = new XFAObjectArray(this[_max]); 49178 clone[_children] = this[_children].map(c => c[$clone]()); 49179 return clone; 49180 } 49181 get children() { 49182 return this[_children]; 49183 } 49184 clear() { 49185 this[_children].length = 0; 49186 } 49187} 49188class XFAAttribute { 49189 constructor(node, name, value) { 49190 this[_parent] = node; 49191 this[$nodeName] = name; 49192 this[$content] = value; 49193 this[$consumed] = false; 49194 this[$uid] = `attribute${uid++}`; 49195 } 49196 [$getParent]() { 49197 return this[_parent]; 49198 } 49199 [$isDataValue]() { 49200 return true; 49201 } 49202 [$getDataValue]() { 49203 return this[$content].trim(); 49204 } 49205 [$setValue](value) { 49206 value = value.value || ""; 49207 this[$content] = value.toString(); 49208 } 49209 [$text]() { 49210 return this[$content]; 49211 } 49212 [$isDescendent](parent) { 49213 return this[_parent] === parent || this[_parent][$isDescendent](parent); 49214 } 49215} 49216class XmlObject extends XFAObject { 49217 constructor(nsId, name, attributes = {}) { 49218 super(nsId, name); 49219 this[$content] = ""; 49220 this[_dataValue] = null; 49221 if (name !== "#text") { 49222 const map = new Map(); 49223 this[_attributes] = map; 49224 for (const [attrName, value] of Object.entries(attributes)) { 49225 map.set(attrName, new XFAAttribute(this, attrName, value)); 49226 } 49227 if (
vendor: 3,433 bytes, lines 49227-49348
49227Object.hasOwn(attributes, $nsAttributes)) { 49228 const dataNode = attributes[$nsAttributes].xfa.dataNode; 49229 if (dataNode !== undefined) { 49230 if (dataNode === "dataGroup") { 49231 this[_dataValue] = false; 49232 } else if (dataNode === "dataValue") { 49233 this[_dataValue] = true; 49234 } 49235 } 49236 } 49237 } 49238 this[$consumed] = false; 49239 } 49240 [$toString](buf) { 49241 const tagName = this[$nodeName]; 49242 if (tagName === "#text") { 49243 buf.push(encodeToXmlString(this[$content])); 49244 return; 49245 } 49246 const utf8TagName = utf8StringToString(tagName); 49247 const prefix = this[$namespaceId] === NS_DATASETS ? "xfa:" : ""; 49248 buf.push(`<${prefix}${utf8TagName}`); 49249 for (const [name, value] of this[_attributes]) { 49250 const utf8Name = utf8StringToString(name); 49251 buf.push(` ${utf8Name}="${encodeToXmlString(value[$content])}"`); 49252 } 49253 if (this[_dataValue] !== null) { 49254 if (this[_dataValue]) { 49255 buf.push(` xfa:dataNode="dataValue"`); 49256 } else { 49257 buf.push(` xfa:dataNode="dataGroup"`); 49258 } 49259 } 49260 if (!this[$content] && this[_children].length === 0) { 49261 buf.push("/>"); 49262 return; 49263 } 49264 buf.push(">"); 49265 if (this[$content]) { 49266 if (typeof this[$content] === "string") { 49267 buf.push(encodeToXmlString(this[$content])); 49268 } else { 49269 this[$content][$toString](buf); 49270 } 49271 } else { 49272 for (const child of this[_children]) { 49273 child[$toString](buf); 49274 } 49275 } 49276 buf.push(`</${prefix}${utf8TagName}>`); 49277 } 49278 [$onChild](child) { 49279 if (this[$content]) { 49280 const node = new XmlObject(this[$namespaceId], "#text"); 49281 this[$appendChild](node); 49282 node[$content] = this[$content]; 49283 this[$content] = ""; 49284 } 49285 this[$appendChild](child); 49286 return true; 49287 } 49288 [$onText](str) { 49289 this[$content] += str; 49290 } 49291 [$finalize]() { 49292 if (this[$content] && this[_children].length > 0) { 49293 const node = new XmlObject(this[$namespaceId], "#text"); 49294 this[$appendChild](node); 49295 node[$content] = this[$content]; 49296 delete this[$content]; 49297 } 49298 } 49299 [$toHTML]() { 49300 if (this[$nodeName] === "#text") { 49301 return HTMLResult.success({ 49302 name: "#text", 49303 value: this[$content] 49304 }); 49305 } 49306 return HTMLResult.EMPTY; 49307 } 49308 [$getChildren](name = null) { 49309 if (!name) { 49310 return this[_children]; 49311 } 49312 return this[_children].filter(c => c[$nodeName] === name); 49313 } 49314 [$getAttributes]() { 49315 return this[_attributes]; 49316 } 49317 [$getChildrenByClass](name) { 49318 const value = this[_attributes].get(name); 49319 if (value !== undefined) { 49320 return value; 49321 } 49322 return this[$getChildren](name); 49323 } 49324 *[$getChildrenByNameIt](name, allTransparent) { 49325 const value = this[_attributes].get(name); 49326 if (value) { 49327 yield value; 49328 } 49329 for (const child of this[_children]) { 49330 if (child[$nodeName] === name) { 49331 yield child; 49332 } 49333 if (allTransparent) { 49334 yield* child[$getChildrenByNameIt](name, allTransparent); 49335 } 49336 } 49337 } 49338 *[$getAttributeIt](name, skipConsumed) { 49339 const value = this[_attributes].get(name); 49340 if (value && (!skipConsumed || !value[$consumed])) { 49341 yield value; 49342 } 49343 for (const child of this[_children]) { 49344 yield* child[$getAttributeIt](name, skipConsumed); 49345 } 49346 } 49347 *[$getRealChildrenByNameIt](name, allTransparent, skipConsumed) { 49348 for (const child of this[_children]) {
vendor: 2,864 bytes, lines 49349-49464
49349 if (child[$nodeName] === name && (!skipConsumed || !child[$consumed])) { 49350 yield child; 49351 } 49352 if (allTransparent) { 49353 yield* child[$getRealChildrenByNameIt](name, allTransparent, skipConsumed); 49354 } 49355 } 49356 } 49357 [$isDataValue]() { 49358 if (this[_dataValue] === null) { 49359 return this[_children].length === 0 || this[_children][0][$namespaceId] === NamespaceIds.xhtml.id; 49360 } 49361 return this[_dataValue]; 49362 } 49363 [$getDataValue]() { 49364 if (this[_dataValue] === null) { 49365 if (this[_children].length === 0) { 49366 return this[$content].trim(); 49367 } 49368 if (this[_children][0][$namespaceId] === NamespaceIds.xhtml.id) { 49369 return this[_children][0][$text]().trim(); 49370 } 49371 return null; 49372 } 49373 return this[$content].trim(); 49374 } 49375 [$setValue](value) { 49376 value = value.value || ""; 49377 this[$content] = value.toString(); 49378 } 49379 [$dump](hasNS = false) { 49380 const dumped = Object.create(null); 49381 if (hasNS) { 49382 dumped.$ns = this[$namespaceId]; 49383 } 49384 if (this[$content]) { 49385 dumped.$content = this[$content]; 49386 } 49387 dumped.$name = this[$nodeName]; 49388 dumped.children = []; 49389 for (const child of this[_children]) { 49390 dumped.children.push(child[$dump](hasNS)); 49391 } 49392 dumped.attributes = Object.create(null); 49393 for (const [name, value] of this[_attributes]) { 49394 dumped.attributes[name] = value[$content]; 49395 } 49396 return dumped; 49397 } 49398} 49399class ContentObject extends XFAObject { 49400 constructor(nsId, name) { 49401 super(nsId, name); 49402 this[$content] = ""; 49403 } 49404 [$onText](text) { 49405 this[$content] += text; 49406 } 49407 [$finalize]() {} 49408} 49409class OptionObject extends ContentObject { 49410 constructor(nsId, name, options) { 49411 super(nsId, name); 49412 this[_options] = options; 49413 } 49414 [$finalize]() { 49415 this[$content] = getKeyword({ 49416 data: this[$content], 49417 defaultValue: this[_options][0], 49418 validate: k => this[_options].includes(k) 49419 }); 49420 } 49421 [$clean](builder) { 49422 super[$clean](builder); 49423 delete this[_options]; 49424 } 49425} 49426class StringObject extends ContentObject { 49427 [$finalize]() { 49428 this[$content] = this[$content].trim(); 49429 } 49430} 49431class IntegerObject extends ContentObject { 49432 constructor(nsId, name, defaultValue, validator) { 49433 super(nsId, name); 49434 this[_defaultValue] = defaultValue; 49435 this[_validator] = validator; 49436 } 49437 [$finalize]() { 49438 this[$content] = getInteger({ 49439 data: this[$content], 49440 defaultValue: this[_defaultValue], 49441 validate: this[_validator] 49442 }); 49443 } 49444 [$clean](builder) { 49445 super[$clean](builder); 49446 delete this[_defaultValue]; 49447 delete this[_validator]; 49448 } 49449} 49450class Option01 extends IntegerObject { 49451 constructor(nsId, name) { 49452 super(nsId, name, 0, n => n === 1); 49453 } 49454} 49455class Option10 extends IntegerObject { 49456 constructor(nsId, name) { 49457 super(nsId, name, 1, n => n === 0); 49458 } 49459} 49460 49461;// ./src/core/xfa/html_utils.js 49462 49463 49464
vendor: 9,642 bytes, lines 49465-49814
49465 49466 49467 49468 49469 49470 49471 49472 49473function measureToString(m) { 49474 if (typeof m === "string") { 49475 return "0px"; 49476 } 49477 return Number.isInteger(m) ? `${m}px` : `${m.toFixed(2)}px`; 49478} 49479const converters = { 49480 anchorType(node, style) { 49481 const parent = node[$getSubformParent](); 49482 if (!parent || parent.layout && parent.layout !== "position") { 49483 return; 49484 } 49485 if (!("transform" in style)) { 49486 style.transform = ""; 49487 } 49488 switch (node.anchorType) { 49489 case "bottomCenter": 49490 style.transform += "translate(-50%, -100%)"; 49491 break; 49492 case "bottomLeft": 49493 style.transform += "translate(0,-100%)"; 49494 break; 49495 case "bottomRight": 49496 style.transform += "translate(-100%,-100%)"; 49497 break; 49498 case "middleCenter": 49499 style.transform += "translate(-50%,-50%)"; 49500 break; 49501 case "middleLeft": 49502 style.transform += "translate(0,-50%)"; 49503 break; 49504 case "middleRight": 49505 style.transform += "translate(-100%,-50%)"; 49506 break; 49507 case "topCenter": 49508 style.transform += "translate(-50%,0)"; 49509 break; 49510 case "topRight": 49511 style.transform += "translate(-100%,0)"; 49512 break; 49513 } 49514 }, 49515 dimensions(node, style) { 49516 const parent = node[$getSubformParent](); 49517 let width = node.w; 49518 const height = node.h; 49519 if (parent.layout?.includes("row")) { 49520 const extra = parent[$extra]; 49521 const colSpan = node.colSpan; 49522 let w; 49523 if (colSpan === -1) { 49524 w = Math.sumPrecise(extra.columnWidths.slice(extra.currentColumn)); 49525 extra.currentColumn = 0; 49526 } else { 49527 w = Math.sumPrecise(extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan)); 49528 extra.currentColumn = (extra.currentColumn + node.colSpan) % extra.columnWidths.length; 49529 } 49530 if (!isNaN(w)) { 49531 width = node.w = w; 49532 } 49533 } 49534 style.width = width !== "" ? measureToString(width) : "auto"; 49535 style.height = height !== "" ? measureToString(height) : "auto"; 49536 }, 49537 position(node, style) { 49538 const parent = node[$getSubformParent](); 49539 if (parent?.layout && parent.layout !== "position") { 49540 return; 49541 } 49542 style.position = "absolute"; 49543 style.left = measureToString(node.x); 49544 style.top = measureToString(node.y); 49545 }, 49546 rotate(node, style) { 49547 if (node.rotate) { 49548 if (!("transform" in style)) { 49549 style.transform = ""; 49550 } 49551 style.transform += `rotate(-${node.rotate}deg)`; 49552 style.transformOrigin = "top left"; 49553 } 49554 }, 49555 presence(node, style) { 49556 switch (node.presence) { 49557 case "invisible": 49558 style.visibility = "hidden"; 49559 break; 49560 case "hidden": 49561 case "inactive": 49562 style.display = "none"; 49563 break; 49564 } 49565 }, 49566 hAlign(node, style) { 49567 if (node[$nodeName] === "para") { 49568 switch (node.hAlign) { 49569 case "justifyAll": 49570 style.textAlign = "justify-all"; 49571 break; 49572 case "radix": 49573 style.textAlign = "left"; 49574 break; 49575 default: 49576 style.textAlign = node.hAlign; 49577 } 49578 } else { 49579 switch (node.hAlign) { 49580 case "left": 49581 style.alignSelf = "start"; 49582 break; 49583 case "center": 49584 style.alignSelf = "center"; 49585 break; 49586 case "right": 49587 style.alignSelf = "end"; 49588 break; 49589 } 49590 } 49591 }, 49592 margin(node, style) { 49593 if (node.margin) { 49594 style.margin = node.margin[$toStyle]().margin; 49595 } 49596 } 49597}; 49598function setMinMaxDimensions(node, style) { 49599 const parent = node[$getSubformParent](); 49600 if (parent.layout === "position") { 49601 if (node.minW > 0) { 49602 style.minWidth = measureToString(node.minW); 49603 } 49604 if (node.maxW > 0) { 49605 style.maxWidth = measureToString(node.maxW); 49606 } 49607 if (node.minH > 0) { 49608 style.minHeight = measureToString(node.minH); 49609 } 49610 if (node.maxH > 0) { 49611 style.maxHeight = measureToString(node.maxH); 49612 } 49613 } 49614} 49615function layoutText(text, xfaFont, margin, lineHeight, fontFinder, width) { 49616 const measure = new TextMeasure(xfaFont, margin, lineHeight, fontFinder); 49617 if (typeof text === "string") { 49618 measure.addString(text); 49619 } else { 49620 text[$pushGlyphs](measure); 49621 } 49622 return measure.compute(width); 49623} 49624function layoutNode(node, availableSpace) { 49625 let height = null; 49626 let width = null; 49627 let isBroken = false; 49628 if ((!node.w || !node.h) && node.value) { 49629 let marginH = 0; 49630 let marginV = 0; 49631 if (node.margin) { 49632 marginH = node.margin.leftInset + node.margin.rightInset; 49633 marginV = node.margin.topInset + node.margin.bottomInset; 49634 } 49635 let lineHeight = null; 49636 let margin = null; 49637 if (node.para) { 49638 margin = Object.create(null); 49639 lineHeight = node.para.lineHeight === "" ? null : node.para.lineHeight; 49640 margin.top = node.para.spaceAbove === "" ? 0 : node.para.spaceAbove; 49641 margin.bottom = node.para.spaceBelow === "" ? 0 : node.para.spaceBelow; 49642 margin.left = node.para.marginLeft === "" ? 0 : node.para.marginLeft; 49643 margin.right = node.para.marginRight === "" ? 0 : node.para.marginRight; 49644 } 49645 let font = node.font; 49646 if (!font) { 49647 const root = node[$getTemplateRoot](); 49648 let parent = node[$getParent](); 49649 while (parent && parent !== root) { 49650 if (parent.font) { 49651 font = parent.font; 49652 break; 49653 } 49654 parent = parent[$getParent](); 49655 } 49656 } 49657 const maxWidth = (node.w || availableSpace.width) - marginH; 49658 const fontFinder = node[$globalData].fontFinder; 49659 if (node.value.exData && node.value.exData[$content] && node.value.exData.contentType === "text/html") { 49660 const res = layoutText(node.value.exData[$content], font, margin, lineHeight, fontFinder, maxWidth); 49661 width = res.width; 49662 height = res.height; 49663 isBroken = res.isBroken; 49664 } else { 49665 const text = node.value[$text](); 49666 if (text) { 49667 const res = layoutText(text, font, margin, lineHeight, fontFinder, maxWidth); 49668 width = res.width; 49669 height = res.height; 49670 isBroken = res.isBroken; 49671 } 49672 } 49673 if (width !== null && !node.w) { 49674 width += marginH; 49675 } 49676 if (height !== null && !node.h) { 49677 height += marginV; 49678 } 49679 } 49680 return { 49681 w: width, 49682 h: height, 49683 isBroken 49684 }; 49685} 49686function computeBbox(node, html, availableSpace) { 49687 let bbox; 49688 if (node.w !== "" && node.h !== "") { 49689 bbox = [node.x, node.y, node.w, node.h]; 49690 } else { 49691 if (!availableSpace) { 49692 return null; 49693 } 49694 let width = node.w; 49695 if (width === "") { 49696 if (node.maxW === 0) { 49697 const parent = node[$getSubformParent](); 49698 width = parent.layout === "position" && parent.w !== "" ? 0 : node.minW; 49699 } else { 49700 width = Math.min(node.maxW, availableSpace.width); 49701 } 49702 html.attributes.style.width = measureToString(width); 49703 } 49704 let height = node.h; 49705 if (height === "") { 49706 if (node.maxH === 0) { 49707 const parent = node[$getSubformParent](); 49708 height = parent.layout === "position" && parent.h !== "" ? 0 : node.minH; 49709 } else { 49710 height = Math.min(node.maxH, availableSpace.height); 49711 } 49712 html.attributes.style.height = measureToString(height); 49713 } 49714 bbox = [node.x, node.y, width, height]; 49715 } 49716 return bbox; 49717} 49718function fixDimensions(node) { 49719 const parent = node[$getSubformParent](); 49720 if (parent.layout?.includes("row")) { 49721 const extra = parent[$extra]; 49722 const colSpan = node.colSpan; 49723 let width; 49724 if (colSpan === -1) { 49725 width = Math.sumPrecise(extra.columnWidths.slice(extra.currentColumn)); 49726 } else { 49727 width = Math.sumPrecise(extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan)); 49728 } 49729 if (!isNaN(width)) { 49730 node.w = width; 49731 } 49732 } 49733 if (parent.layout && parent.layout !== "position") { 49734 node.x = node.y = 0; 49735 } 49736 if (node.layout === "table") { 49737 if (node.w === "" && Array.isArray(node.columnWidths)) { 49738 node.w = Math.sumPrecise(node.columnWidths); 49739 } 49740 } 49741} 49742function layoutClass(node) { 49743 switch (node.layout) { 49744 case "position": 49745 return "xfaPosition"; 49746 case "lr-tb": 49747 return "xfaLrTb"; 49748 case "rl-row": 49749 return "xfaRlRow"; 49750 case "rl-tb": 49751 return "xfaRlTb"; 49752 case "row": 49753 return "xfaRow"; 49754 case "table": 49755 return "xfaTable"; 49756 case "tb": 49757 return "xfaTb"; 49758 default: 49759 return "xfaPosition"; 49760 } 49761} 49762function toStyle(node, ...names) { 49763 const style = Object.create(null); 49764 for (const name of names) { 49765 const value = node[name]; 49766 if (value === null) { 49767 continue; 49768 } 49769 if (Object.hasOwn(converters, name)) { 49770 converters[name](node, style); 49771 continue; 49772 } 49773 if (value instanceof XFAObject) { 49774 const newStyle = value[$toStyle](); 49775 if (newStyle) { 49776 Object.assign(style, newStyle); 49777 } else { 49778 warn(`(DEBUG) - XFA - style for ${name} not implemented yet`); 49779 } 49780 } 49781 } 49782 return style; 49783} 49784function createWrapper(node, html) { 49785 const { 49786 attributes 49787 } = html; 49788 const { 49789 style 49790 } = attributes; 49791 const wrapper = { 49792 name: "div", 49793 attributes: { 49794 class: ["xfaWrapper"], 49795 style: Object.create(null) 49796 }, 49797 children: [] 49798 }; 49799 attributes.class.push("xfaWrapped"); 49800 if (node.border) { 49801 const { 49802 widths, 49803 insets 49804 } = node.border[$extra]; 49805 let width, height; 49806 let top = insets[0]; 49807 let left = insets[3]; 49808 const insetsH = insets[0] + insets[2]; 49809 const insetsW = insets[1] + insets[3]; 49810 switch (node.border.hand) { 49811 case "even": 49812 top -= widths[0] / 2; 49813 left -= widths[3] / 2; 49814 width = `calc(100% + ${(widths[1] + widths[3]) / 2 - insetsW}px)`;
vendor: 11,984 bytes, lines 49815-50270
49815 height = `calc(100% + ${(widths[0] + widths[2]) / 2 - insetsH}px)`; 49816 break; 49817 case "left": 49818 top -= widths[0]; 49819 left -= widths[3]; 49820 width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`; 49821 height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`; 49822 break; 49823 case "right": 49824 width = insetsW ? `calc(100% - ${insetsW}px)` : "100%"; 49825 height = insetsH ? `calc(100% - ${insetsH}px)` : "100%"; 49826 break; 49827 } 49828 const classNames = ["xfaBorder"]; 49829 if (isPrintOnly(node.border)) { 49830 classNames.push("xfaPrintOnly"); 49831 } 49832 const border = { 49833 name: "div", 49834 attributes: { 49835 class: classNames, 49836 style: { 49837 top: `${top}px`, 49838 left: `${left}px`, 49839 width, 49840 height 49841 } 49842 }, 49843 children: [] 49844 }; 49845 for (const key of ["border", "borderWidth", "borderColor", "borderRadius", "borderStyle"]) { 49846 if (style[key] !== undefined) { 49847 border.attributes.style[key] = style[key]; 49848 delete style[key]; 49849 } 49850 } 49851 wrapper.children.push(border, html); 49852 } else { 49853 wrapper.children.push(html); 49854 } 49855 for (const key of ["background", "backgroundClip", "top", "left", "width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "transform", "transformOrigin", "visibility"]) { 49856 if (style[key] !== undefined) { 49857 wrapper.attributes.style[key] = style[key]; 49858 delete style[key]; 49859 } 49860 } 49861 wrapper.attributes.style.position = style.position === "absolute" ? "absolute" : "relative"; 49862 delete style.position; 49863 if (style.alignSelf) { 49864 wrapper.attributes.style.alignSelf = style.alignSelf; 49865 delete style.alignSelf; 49866 } 49867 return wrapper; 49868} 49869function fixTextIndent(styles) { 49870 const indent = getMeasurement(styles.textIndent, "0px"); 49871 if (indent >= 0) { 49872 return; 49873 } 49874 const align = styles.textAlign === "right" ? "right" : "left"; 49875 const name = "padding" + (align === "left" ? "Left" : "Right"); 49876 const padding = getMeasurement(styles[name], "0px"); 49877 styles[name] = `${padding - indent}px`; 49878} 49879function setAccess(node, classNames) { 49880 switch (node.access) { 49881 case "nonInteractive": 49882 classNames.push("xfaNonInteractive"); 49883 break; 49884 case "readOnly": 49885 classNames.push("xfaReadOnly"); 49886 break; 49887 case "protected": 49888 classNames.push("xfaDisabled"); 49889 break; 49890 } 49891} 49892function isPrintOnly(node) { 49893 return node.relevant.length > 0 && !node.relevant[0].excluded && node.relevant[0].viewname === "print"; 49894} 49895function getCurrentPara(node) { 49896 const stack = node[$getTemplateRoot]()[$extra].paraStack; 49897 return stack.length ? stack.at(-1) : null; 49898} 49899function setPara(node, nodeStyle, value) { 49900 if (value.attributes.class?.includes("xfaRich")) { 49901 if (nodeStyle) { 49902 if (node.h === "") { 49903 nodeStyle.height = "auto"; 49904 } 49905 if (node.w === "") { 49906 nodeStyle.width = "auto"; 49907 } 49908 } 49909 const para = getCurrentPara(node); 49910 if (para) { 49911 const valueStyle = value.attributes.style; 49912 valueStyle.display = "flex"; 49913 valueStyle.flexDirection = "column"; 49914 switch (para.vAlign) { 49915 case "top": 49916 valueStyle.justifyContent = "start"; 49917 break; 49918 case "bottom": 49919 valueStyle.justifyContent = "end"; 49920 break; 49921 case "middle": 49922 valueStyle.justifyContent = "center"; 49923 break; 49924 } 49925 const paraStyle = para[$toStyle](); 49926 for (const [key, val] of Object.entries(paraStyle)) { 49927 if (!(key in valueStyle)) { 49928 valueStyle[key] = val; 49929 } 49930 } 49931 } 49932 } 49933} 49934function setFontFamily(xfaFont, node, fontFinder, style) { 49935 if (!fontFinder) { 49936 delete style.fontFamily; 49937 return; 49938 } 49939 const name = stripQuotes(xfaFont.typeface); 49940 style.fontFamily = `"${name}"`; 49941 const typeface = fontFinder.find(name); 49942 if (typeface) { 49943 const { 49944 fontFamily 49945 } = typeface.regular.cssFontInfo; 49946 if (fontFamily !== name) { 49947 style.fontFamily = `"${fontFamily}"`; 49948 } 49949 const para = getCurrentPara(node); 49950 if (para && para.lineHeight !== "") { 49951 return; 49952 } 49953 if (style.lineHeight) { 49954 return; 49955 } 49956 const pdfFont = selectFont(xfaFont, typeface); 49957 if (pdfFont) { 49958 style.lineHeight = Math.max(1.2, pdfFont.lineHeight); 49959 } 49960 } 49961} 49962function fixURL(str) { 49963 const absoluteUrl = createValidAbsoluteUrl(str, null, { 49964 addDefaultProtocol: true, 49965 tryConvertEncoding: true 49966 }); 49967 return absoluteUrl ? absoluteUrl.href : null; 49968} 49969 49970;// ./src/core/xfa/layout.js 49971 49972 49973 49974 49975 49976function createLine(node, children) { 49977 return { 49978 name: "div", 49979 attributes: { 49980 class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"] 49981 }, 49982 children 49983 }; 49984} 49985function flushHTML(node) { 49986 if (!node[$extra]) { 49987 return null; 49988 } 49989 const attributes = node[$extra].attributes; 49990 const html = { 49991 name: "div", 49992 attributes, 49993 children: node[$extra].children 49994 }; 49995 if (node[$extra].failingNode) { 49996 const htmlFromFailing = node[$extra].failingNode[$flushHTML](); 49997 if (htmlFromFailing) { 49998 if (node.layout.endsWith("-tb")) { 49999 html.children.push(createLine(node, [htmlFromFailing])); 50000 } else { 50001 html.children.push(htmlFromFailing); 50002 } 50003 } 50004 } 50005 if (html.children.length === 0) { 50006 return null; 50007 } 50008 return html; 50009} 50010function addHTML(node, html, bbox) { 50011 const extra = node[$extra]; 50012 const availableSpace = extra.availableSpace; 50013 const [x, y, w, h] = bbox; 50014 switch (node.layout) { 50015 case "position": 50016 { 50017 extra.width = Math.max(extra.width, x + w); 50018 extra.height = Math.max(extra.height, y + h); 50019 extra.children.push(html); 50020 break; 50021 } 50022 case "lr-tb": 50023 case "rl-tb": 50024 if (!extra.line || extra.attempt === 1) { 50025 extra.line = createLine(node, []); 50026 extra.children.push(extra.line); 50027 extra.numberInLine = 0; 50028 } 50029 extra.numberInLine += 1; 50030 extra.line.children.push(html); 50031 if (extra.attempt === 0) { 50032 extra.currentWidth += w; 50033 extra.height = Math.max(extra.height, extra.prevHeight + h); 50034 } else { 50035 extra.currentWidth = w; 50036 extra.prevHeight = extra.height; 50037 extra.height += h; 50038 extra.attempt = 0; 50039 } 50040 extra.width = Math.max(extra.width, extra.currentWidth); 50041 break; 50042 case "rl-row": 50043 case "row": 50044 { 50045 extra.children.push(html); 50046 extra.width += w; 50047 extra.height = Math.max(extra.height, h); 50048 const height = measureToString(extra.height); 50049 for (const child of extra.children) { 50050 child.attributes.style.height = height; 50051 } 50052 break; 50053 } 50054 case "table": 50055 { 50056 extra.width = MathClamp(w, extra.width, availableSpace.width); 50057 extra.height += h; 50058 extra.children.push(html); 50059 break; 50060 } 50061 case "tb": 50062 { 50063 extra.width = MathClamp(w, extra.width, availableSpace.width); 50064 extra.height += h; 50065 extra.children.push(html); 50066 break; 50067 } 50068 } 50069} 50070function getAvailableSpace(node) { 50071 const availableSpace = node[$extra].availableSpace; 50072 const marginV = node.margin ? node.margin.topInset + node.margin.bottomInset : 0; 50073 const marginH = node.margin ? node.margin.leftInset + node.margin.rightInset : 0; 50074 switch (node.layout) { 50075 case "lr-tb": 50076 case "rl-tb": 50077 if (node[$extra].attempt === 0) { 50078 return { 50079 width: availableSpace.width - marginH - node[$extra].currentWidth, 50080 height: availableSpace.height - marginV - node[$extra].prevHeight 50081 }; 50082 } 50083 return { 50084 width: availableSpace.width - marginH, 50085 height: availableSpace.height - marginV - node[$extra].height 50086 }; 50087 case "rl-row": 50088 case "row": 50089 const width = Math.sumPrecise(node[$extra].columnWidths.slice(node[$extra].currentColumn)); 50090 return { 50091 width, 50092 height: availableSpace.height - marginH 50093 }; 50094 case "table": 50095 case "tb": 50096 return { 50097 width: availableSpace.width - marginH, 50098 height: availableSpace.height - marginV - node[$extra].height 50099 }; 50100 case "position": 50101 default: 50102 return availableSpace; 50103 } 50104} 50105function getTransformedBBox(node) { 50106 let w = node.w === "" ? NaN : node.w; 50107 let h = node.h === "" ? NaN : node.h; 50108 let [centerX, centerY] = [0, 0]; 50109 switch (node.anchorType || "") { 50110 case "bottomCenter": 50111 [centerX, centerY] = [w / 2, h]; 50112 break; 50113 case "bottomLeft": 50114 [centerX, centerY] = [0, h]; 50115 break; 50116 case "bottomRight": 50117 [centerX, centerY] = [w, h]; 50118 break; 50119 case "middleCenter": 50120 [centerX, centerY] = [w / 2, h / 2]; 50121 break; 50122 case "middleLeft": 50123 [centerX, centerY] = [0, h / 2]; 50124 break; 50125 case "middleRight": 50126 [centerX, centerY] = [w, h / 2]; 50127 break; 50128 case "topCenter": 50129 [centerX, centerY] = [w / 2, 0]; 50130 break; 50131 case "topRight": 50132 [centerX, centerY] = [w, 0]; 50133 break; 50134 } 50135 let x, y; 50136 switch (node.rotate || 0) { 50137 case 0: 50138 [x, y] = [-centerX, -centerY]; 50139 break; 50140 case 90: 50141 [x, y] = [-centerY, centerX]; 50142 [w, h] = [h, -w]; 50143 break; 50144 case 180: 50145 [x, y] = [centerX, centerY]; 50146 [w, h] = [-w, -h]; 50147 break; 50148 case 270: 50149 [x, y] = [centerY, -centerX]; 50150 [w, h] = [-h, w]; 50151 break; 50152 } 50153 return [node.x + x + Math.min(0, w), node.y + y + Math.min(0, h), Math.abs(w), Math.abs(h)]; 50154} 50155function checkDimensions(node, space) { 50156 if (node[$getTemplateRoot]()[$extra].firstUnsplittable === null) { 50157 return true; 50158 } 50159 if (node.w === 0 || node.h === 0) { 50160 return true; 50161 } 50162 const ERROR = 2; 50163 const parent = node[$getSubformParent](); 50164 const attempt = parent[$extra]?.attempt || 0; 50165 const [, y, w, h] = getTransformedBBox(node); 50166 switch (parent.layout) { 50167 case "lr-tb": 50168 case "rl-tb": 50169 if (attempt === 0) { 50170 if (!node[$getTemplateRoot]()[$extra].noLayoutFailure) { 50171 if (node.h !== "" && Math.round(h - space.height) > ERROR) { 50172 return false; 50173 } 50174 if (node.w !== "") { 50175 if (Math.round(w - space.width) <= ERROR) { 50176 return true; 50177 } 50178 if (parent[$extra].numberInLine === 0) { 50179 return space.height > ERROR; 50180 } 50181 return false; 50182 } 50183 return space.width > ERROR; 50184 } 50185 if (node.w !== "") { 50186 return Math.round(w - space.width) <= ERROR; 50187 } 50188 return space.width > ERROR; 50189 } 50190 if (node[$getTemplateRoot]()[$extra].noLayoutFailure) { 50191 return true; 50192 } 50193 if (node.h !== "" && Math.round(h - space.height) > ERROR) { 50194 return false; 50195 } 50196 if (node.w === "" || Math.round(w - space.width) <= ERROR) { 50197 return space.height > ERROR; 50198 } 50199 if (parent[$isThereMoreWidth]()) { 50200 return false; 50201 } 50202 return space.height > ERROR; 50203 case "table": 50204 case "tb": 50205 if (node[$getTemplateRoot]()[$extra].noLayoutFailure) { 50206 return true; 50207 } 50208 if (node.h !== "" && !node[$isSplittable]()) { 50209 return Math.round(h - space.height) <= ERROR; 50210 } 50211 if (node.w === "" || Math.round(w - space.width) <= ERROR) { 50212 return space.height > ERROR; 50213 } 50214 if (parent[$isThereMoreWidth]()) { 50215 return false; 50216 } 50217 return space.height > ERROR; 50218 case "position": 50219 if (node[$getTemplateRoot]()[$extra].noLayoutFailure) { 50220 return true; 50221 } 50222 if (node.h === "" || Math.round(h + y - space.height) <= ERROR) { 50223 return true; 50224 } 50225 const area = node[$getTemplateRoot]()[$extra].currentContentArea; 50226 return h + y > area.h; 50227 case "rl-row": 50228 case "row": 50229 if (node[$getTemplateRoot]()[$extra].noLayoutFailure) { 50230 return true; 50231 } 50232 if (node.h !== "") { 50233 return Math.round(h - space.height) <= ERROR; 50234 } 50235 return true; 50236 default: 50237 return true; 50238 } 50239} 50240 50241;// ./src/core/xfa/template.js 50242 50243 50244 50245 50246 50247 50248 50249 50250 50251 50252 50253 50254 50255 50256 50257 50258 50259 50260 50261 50262 50263 50264 50265 50266 50267 50268 50269 50270
50271 50272 50273 50274 50275 50276 50277 50278 50279const TEMPLATE_NS_ID = NamespaceIds.template.id; 50280const SVG_NS = "http://www.w3.org/2000/svg"
vendor: 61,840 bytes, lines 50280-52207
50280; 50281const MAX_ATTEMPTS_FOR_LRTB_LAYOUT = 2; 50282const MAX_EMPTY_PAGES = 3; 50283const DEFAULT_TAB_INDEX = 5000; 50284const HEADING_PATTERN = /^H(\d+)$/; 50285const MIMES = new Set(["image/gif", "image/jpeg", "image/jpg", "image/pjpeg", "image/png", "image/apng", "image/x-png", "image/bmp", "image/x-ms-bmp", "image/tiff", "image/tif", "application/octet-stream"]); 50286const IMAGES_HEADERS = [[[0x42, 0x4d], "image/bmp"], [[0xff, 0xd8, 0xff], "image/jpeg"], [[0x49, 0x49, 0x2a, 0x00], "image/tiff"], [[0x4d, 0x4d, 0x00, 0x2a], "image/tiff"], [[0x47, 0x49, 0x46, 0x38, 0x39, 0x61], "image/gif"], [[0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a], "image/png"]]; 50287function getBorderDims(node) { 50288 if (!node || !node.border) { 50289 return { 50290 w: 0, 50291 h: 0 50292 }; 50293 } 50294 const borderExtra = node.border[$getExtra](); 50295 if (!borderExtra) { 50296 return { 50297 w: 0, 50298 h: 0 50299 }; 50300 } 50301 return { 50302 w: borderExtra.widths[0] + borderExtra.widths[2] + borderExtra.insets[0] + borderExtra.insets[2], 50303 h: borderExtra.widths[1] + borderExtra.widths[3] + borderExtra.insets[1] + borderExtra.insets[3] 50304 }; 50305} 50306function hasMargin(node) { 50307 return node.margin && (node.margin.topInset || node.margin.rightInset || node.margin.bottomInset || node.margin.leftInset); 50308} 50309function _setValue(templateNode, value) { 50310 if (!templateNode.value) { 50311 const nodeValue = new Value({}); 50312 templateNode[$appendChild](nodeValue); 50313 templateNode.value = nodeValue; 50314 } 50315 templateNode.value[$setValue](value); 50316} 50317function* getContainedChildren(node) { 50318 for (const child of node[$getChildren]()) { 50319 if (child instanceof SubformSet) { 50320 yield* child[$getContainedChildren](); 50321 continue; 50322 } 50323 yield child; 50324 } 50325} 50326function isRequired(node) { 50327 return node.validate?.nullTest === "error"; 50328} 50329function setTabIndex(node) { 50330 while (node) { 50331 if (!node.traversal) { 50332 node[$tabIndex] = node[$getParent]()[$tabIndex]; 50333 return; 50334 } 50335 if (node[$tabIndex]) { 50336 return; 50337 } 50338 let next = null; 50339 for (const child of node.traversal[$getChildren]()) { 50340 if (child.operation === "next") { 50341 next = child; 50342 break; 50343 } 50344 } 50345 if (!next || !next.ref) { 50346 node[$tabIndex] = node[$getParent]()[$tabIndex]; 50347 return; 50348 } 50349 const root = node[$getTemplateRoot](); 50350 node[$tabIndex] = ++root[$tabIndex]; 50351 const ref = root[$searchNode](next.ref, node); 50352 if (!ref) { 50353 return; 50354 } 50355 node = ref[0]; 50356 } 50357} 50358function applyAssist(obj, attributes) { 50359 const assist = obj.assist; 50360 if (assist) { 50361 const assistTitle = assist[$toHTML](); 50362 if (assistTitle) { 50363 attributes.title = assistTitle; 50364 } 50365 const role = assist.role; 50366 const match = role.match(HEADING_PATTERN); 50367 if (match) { 50368 const ariaRole = "heading"; 50369 const ariaLevel = match[1]; 50370 attributes.role = ariaRole; 50371 attributes["aria-level"] = ariaLevel; 50372 } 50373 } 50374 if (obj.layout === "table") { 50375 attributes.role = "table"; 50376 } else if (obj.layout === "row") { 50377 attributes.role = "row"; 50378 } else { 50379 const parent = obj[$getParent](); 50380 if (parent.layout === "row") { 50381 attributes.role = parent.assist?.role === "TH" ? "columnheader" : "cell"; 50382 } 50383 } 50384} 50385function ariaLabel(obj) { 50386 if (!obj.assist) { 50387 return null; 50388 } 50389 const assist = obj.assist; 50390 if (assist.speak && assist.speak[$content] !== "") { 50391 return assist.speak[$content]; 50392 } 50393 if (assist.toolTip) { 50394 return assist.toolTip[$content]; 50395 } 50396 return null; 50397} 50398function valueToHtml(value) { 50399 return HTMLResult.success({ 50400 name: "div", 50401 attributes: { 50402 class: ["xfaRich"], 50403 style: Object.create(null) 50404 }, 50405 children: [{ 50406 name: "span", 50407 attributes: { 50408 style: Object.create(null) 50409 }, 50410 value 50411 }] 50412 }); 50413} 50414function setFirstUnsplittable(node) { 50415 const root = node[$getTemplateRoot](); 50416 if (root[$extra].firstUnsplittable === null) { 50417 root[$extra].firstUnsplittable = node; 50418 root[$extra].noLayoutFailure = true; 50419 } 50420} 50421function unsetFirstUnsplittable(node) { 50422 const root = node[$getTemplateRoot](); 50423 if (root[$extra].firstUnsplittable === node) { 50424 root[$extra].noLayoutFailure = false; 50425 } 50426} 50427function handleBreak(node) { 50428 if (node[$extra]) { 50429 return false; 50430 } 50431 node[$extra] = Object.create(null); 50432 if (node.targetType === "auto") { 50433 return false; 50434 } 50435 const root = node[$getTemplateRoot](); 50436 let target = null; 50437 if (node.target) { 50438 target = root[$searchNode](node.target, node[$getParent]()); 50439 if (!target) { 50440 return false; 50441 } 50442 target = target[0]; 50443 } 50444 const { 50445 currentPageArea, 50446 currentContentArea 50447 } = root[$extra]; 50448 if (node.targetType === "pageArea") { 50449 if (!(target instanceof PageArea)) { 50450 target = null; 50451 } 50452 if (node.startNew) { 50453 node[$extra].target = target || currentPageArea; 50454 return true; 50455 } else if (target && target !== currentPageArea) { 50456 node[$extra].target = target; 50457 return true; 50458 } 50459 return false; 50460 } 50461 if (!(target instanceof ContentArea)) { 50462 target = null; 50463 } 50464 const pageArea = target && target[$getParent](); 50465 let index; 50466 let nextPageArea = pageArea; 50467 if (node.startNew) { 50468 if (target) { 50469 const contentAreas = pageArea.contentArea.children; 50470 const indexForCurrent = contentAreas.indexOf(currentContentArea); 50471 const indexForTarget = contentAreas.indexOf(target); 50472 if (indexForCurrent !== -1 && indexForCurrent < indexForTarget) { 50473 nextPageArea = null; 50474 } 50475 index = indexForTarget - 1; 50476 } else { 50477 index = currentPageArea.contentArea.children.indexOf(currentContentArea); 50478 } 50479 } else if (target && target !== currentContentArea) { 50480 const contentAreas = pageArea.contentArea.children; 50481 index = contentAreas.indexOf(target) - 1; 50482 nextPageArea = pageArea === currentPageArea ? null : pageArea; 50483 } else { 50484 return false; 50485 } 50486 node[$extra].target = nextPageArea; 50487 node[$extra].index = index; 50488 return true; 50489} 50490function handleOverflow(node, extraNode, space) { 50491 const root = node[$getTemplateRoot](); 50492 const saved = root[$extra].noLayoutFailure; 50493 const savedMethod = extraNode[$getSubformParent]; 50494 extraNode[$getSubformParent] = () => node; 50495 root[$extra].noLayoutFailure = true; 50496 const res = extraNode[$toHTML](space); 50497 node[$addHTML](res.html, res.bbox); 50498 root[$extra].noLayoutFailure = saved; 50499 extraNode[$getSubformParent] = savedMethod; 50500} 50501class AppearanceFilter extends StringObject { 50502 constructor(attributes) { 50503 super(TEMPLATE_NS_ID, "appearanceFilter"); 50504 this.id = attributes.id || ""; 50505 this.type = getStringOption(attributes.type, ["optional", "required"]); 50506 this.use = attributes.use || ""; 50507 this.usehref = attributes.usehref || ""; 50508 } 50509} 50510class Arc extends XFAObject { 50511 constructor(attributes) { 50512 super(TEMPLATE_NS_ID, "arc", true); 50513 this.circular = getInteger({ 50514 data: attributes.circular, 50515 defaultValue: 0, 50516 validate: x => x === 1 50517 }); 50518 this.hand = getStringOption(attributes.hand, ["even", "left", "right"]); 50519 this.id = attributes.id || ""; 50520 this.startAngle = getFloat({ 50521 data: attributes.startAngle, 50522 defaultValue: 0, 50523 validate: x => true 50524 }); 50525 this.sweepAngle = getFloat({ 50526 data: attributes.sweepAngle, 50527 defaultValue: 360, 50528 validate: x => true 50529 }); 50530 this.use = attributes.use || ""; 50531 this.usehref = attributes.usehref || ""; 50532 this.edge = null; 50533 this.fill = null; 50534 } 50535 [$toHTML]() { 50536 const edge = this.edge || new Edge({}); 50537 const edgeStyle = edge[$toStyle](); 50538 const style = Object.create(null); 50539 if (this.fill?.presence === "visible") { 50540 Object.assign(style, this.fill[$toStyle]()); 50541 } else { 50542 style.fill = "transparent"; 50543 } 50544 style.strokeWidth = measureToString(edge.presence === "visible" ? edge.thickness : 0); 50545 style.stroke = edgeStyle.color; 50546 let arc; 50547 const attributes = { 50548 xmlns: SVG_NS, 50549 style: { 50550 width: "100%", 50551 height: "100%", 50552 overflow: "visible" 50553 } 50554 }; 50555 if (this.sweepAngle === 360) { 50556 arc = { 50557 name: "ellipse", 50558 attributes: { 50559 xmlns: SVG_NS, 50560 cx: "50%", 50561 cy: "50%", 50562 rx: "50%", 50563 ry: "50%", 50564 style 50565 } 50566 }; 50567 } else { 50568 const startAngle = this.startAngle * Math.PI / 180; 50569 const sweepAngle = this.sweepAngle * Math.PI / 180; 50570 const largeArc = this.sweepAngle > 180 ? 1 : 0; 50571 const [x1, y1, x2, y2] = [50 * (1 + Math.cos(startAngle)), 50 * (1 - Math.sin(startAngle)), 50 * (1 + Math.cos(startAngle + sweepAngle)), 50 * (1 - Math.sin(startAngle + sweepAngle))]; 50572 arc = { 50573 name: "path", 50574 attributes: { 50575 xmlns: SVG_NS, 50576 d: `M ${x1} ${y1} A 50 50 0 ${largeArc} 0 ${x2} ${y2}`, 50577 vectorEffect: "non-scaling-stroke", 50578 style 50579 } 50580 }; 50581 Object.assign(attributes, { 50582 viewBox: "0 0 100 100", 50583 preserveAspectRatio: "none" 50584 }); 50585 } 50586 const svg = { 50587 name: "svg", 50588 children: [arc], 50589 attributes 50590 }; 50591 const parent = this[$getParent]()[$getParent](); 50592 if (hasMargin(parent)) { 50593 return HTMLResult.success({ 50594 name: "div", 50595 attributes: { 50596 style: { 50597 display: "inline", 50598 width: "100%", 50599 height: "100%" 50600 } 50601 }, 50602 children: [svg] 50603 }); 50604 } 50605 svg.attributes.style.position = "absolute"; 50606 return HTMLResult.success(svg); 50607 } 50608} 50609class Area extends XFAObject { 50610 constructor(attributes) { 50611 super(TEMPLATE_NS_ID, "area", true); 50612 this.colSpan = getInteger({ 50613 data: attributes.colSpan, 50614 defaultValue: 1, 50615 validate: n => n >= 1 || n === -1 50616 }); 50617 this.id = attributes.id || ""; 50618 this.name = attributes.name || ""; 50619 this.relevant = getRelevant(attributes.relevant); 50620 this.use = attributes.use || ""; 50621 this.usehref = attributes.usehref || ""; 50622 this.x = getMeasurement(attributes.x, "0pt"); 50623 this.y = getMeasurement(attributes.y, "0pt"); 50624 this.desc = null; 50625 this.extras = null; 50626 this.area = new XFAObjectArray(); 50627 this.draw = new XFAObjectArray(); 50628 this.exObject = new XFAObjectArray(); 50629 this.exclGroup = new XFAObjectArray(); 50630 this.field = new XFAObjectArray(); 50631 this.subform = new XFAObjectArray(); 50632 this.subformSet = new XFAObjectArray(); 50633 } 50634 *[$getContainedChildren]() { 50635 yield* getContainedChildren(this); 50636 } 50637 [$isTransparent]() { 50638 return true; 50639 } 50640 [$isBindable]() { 50641 return true; 50642 } 50643 [$addHTML](html, bbox) { 50644 const [x, y, w, h] = bbox; 50645 this[$extra].width = Math.max(this[$extra].width, x + w); 50646 this[$extra].height = Math.max(this[$extra].height, y + h); 50647 this[$extra].children.push(html); 50648 } 50649 [$getAvailableSpace]() { 50650 return this[$extra].availableSpace; 50651 } 50652 [$toHTML](availableSpace) { 50653 const style = toStyle(this, "position"); 50654 const attributes = { 50655 style, 50656 id: this[$uid], 50657 class: ["xfaArea"] 50658 }; 50659 if (isPrintOnly(this)) { 50660 attributes.class.push("xfaPrintOnly"); 50661 } 50662 if (this.name) { 50663 attributes.xfaName = this.name; 50664 } 50665 const children = []; 50666 this[$extra] = { 50667 children, 50668 width: 0, 50669 height: 0, 50670 availableSpace 50671 }; 50672 const result = this[$childrenToHTML]({ 50673 filter: new Set(["area", "draw", "field", "exclGroup", "subform", "subformSet"]), 50674 include: true 50675 }); 50676 if (!result.success) { 50677 if (result.isBreak()) { 50678 return result; 50679 } 50680 delete this[$extra]; 50681 return HTMLResult.FAILURE; 50682 } 50683 style.width = measureToString(this[$extra].width); 50684 style.height = measureToString(this[$extra].height); 50685 const html = { 50686 name: "div", 50687 attributes, 50688 children 50689 }; 50690 const bbox = [this.x, this.y, this[$extra].width, this[$extra].height]; 50691 delete this[$extra]; 50692 return HTMLResult.success(html, bbox); 50693 } 50694} 50695class Assist extends XFAObject { 50696 constructor(attributes) { 50697 super(TEMPLATE_NS_ID, "assist", true); 50698 this.id = attributes.id || ""; 50699 this.role = attributes.role || ""; 50700 this.use = attributes.use || ""; 50701 this.usehref = attributes.usehref || ""; 50702 this.speak = null; 50703 this.toolTip = null; 50704 } 50705 [$toHTML]() { 50706 return this.toolTip?.[$content] || null; 50707 } 50708} 50709class Barcode extends XFAObject { 50710 constructor(attributes) { 50711 super(TEMPLATE_NS_ID, "barcode", true); 50712 this.charEncoding = getKeyword({ 50713 data: attributes.charEncoding ? attributes.charEncoding.toLowerCase() : "", 50714 defaultValue: "", 50715 validate: k => ["utf-8", "big-five", "fontspecific", "gbk", "gb-18030", "gb-2312", "ksc-5601", "none", "shift-jis", "ucs-2", "utf-16"].includes(k) || k.match(/iso-8859-\d{2}/) 50716 }); 50717 this.checksum = getStringOption(attributes.checksum, ["none", "1mod10", "1mod10_1mod11", "2mod10", "auto"]); 50718 this.dataColumnCount = getInteger({ 50719 data: attributes.dataColumnCount, 50720 defaultValue: -1, 50721 validate: x => x >= 0 50722 }); 50723 this.dataLength = getInteger({ 50724 data: attributes.dataLength, 50725 defaultValue: -1, 50726 validate: x => x >= 0 50727 }); 50728 this.dataPrep = getStringOption(attributes.dataPrep, ["none", "flateCompress"]); 50729 this.dataRowCount = getInteger({ 50730 data: attributes.dataRowCount, 50731 defaultValue: -1, 50732 validate: x => x >= 0 50733 }); 50734 this.endChar = attributes.endChar || ""; 50735 this.errorCorrectionLevel = getInteger({ 50736 data: attributes.errorCorrectionLevel, 50737 defaultValue: -1, 50738 validate: x => x >= 0 && x <= 8 50739 }); 50740 this.id = attributes.id || ""; 50741 this.moduleHeight = getMeasurement(attributes.moduleHeight, "5mm"); 50742 this.moduleWidth = getMeasurement(attributes.moduleWidth, "0.25mm"); 50743 this.printCheckDigit = getInteger({ 50744 data: attributes.printCheckDigit, 50745 defaultValue: 0, 50746 validate: x => x === 1 50747 }); 50748 this.rowColumnRatio = getRatio(attributes.rowColumnRatio); 50749 this.startChar = attributes.startChar || ""; 50750 this.textLocation = getStringOption(attributes.textLocation, ["below", "above", "aboveEmbedded", "belowEmbedded", "none"]); 50751 this.truncate = getInteger({ 50752 data: attributes.truncate, 50753 defaultValue: 0, 50754 validate: x => x === 1 50755 }); 50756 this.type = getStringOption(attributes.type ? attributes.type.toLowerCase() : "", ["aztec", "codabar", "code2of5industrial", "code2of5interleaved", "code2of5matrix", "code2of5standard", "code3of9", "code3of9extended", "code11", "code49", "code93", "code128", "code128a", "code128b", "code128c", "code128sscc", "datamatrix", "ean8", "ean8add2", "ean8add5", "ean13", "ean13add2", "ean13add5", "ean13pwcd", "fim", "logmars", "maxicode", "msi", "pdf417", "pdf417macro", "plessey", "postauscust2", "postauscust3", "postausreplypaid", "postausstandard", "postukrm4scc", "postusdpbc", "postusimb", "postusstandard", "postus5zip", "qrcode", "rfid", "rss14", "rss14expanded", "rss14limited", "rss14stacked", "rss14stackedomni", "rss14truncated", "telepen", "ucc128", "ucc128random", "ucc128sscc", "upca", "upcaadd2", "upcaadd5", "upcapwcd", "upce", "upceadd2", "upceadd5", "upcean2", "upcean5", "upsmaxicode"]); 50757 this.upsMode = getStringOption(attributes.upsMode, ["usCarrier", "internationalCarrier", "secureSymbol", "standardSymbol"]); 50758 this.use = attributes.use || ""; 50759 this.usehref = attributes.usehref || ""; 50760 this.wideNarrowRatio = getRatio(attributes.wideNarrowRatio); 50761 this.encrypt = null; 50762 this.extras = null; 50763 } 50764} 50765class Bind extends XFAObject { 50766 constructor(attributes) { 50767 super(TEMPLATE_NS_ID, "bind", true); 50768 this.match = getStringOption(attributes.match, ["once", "dataRef", "global", "none"]); 50769 this.ref = attributes.ref || ""; 50770 this.picture = null; 50771 } 50772} 50773class BindItems extends XFAObject { 50774 constructor(attributes) { 50775 super(TEMPLATE_NS_ID, "bindItems"); 50776 this.connection = attributes.connection || ""; 50777 this.labelRef = attributes.labelRef || ""; 50778 this.ref = attributes.ref || ""; 50779 this.valueRef = attributes.valueRef || ""; 50780 } 50781} 50782class Bookend extends XFAObject { 50783 constructor(attributes) { 50784 super(TEMPLATE_NS_ID, "bookend"); 50785 this.id = attributes.id || ""; 50786 this.leader = attributes.leader || ""; 50787 this.trailer = attributes.trailer || ""; 50788 this.use = attributes.use || ""; 50789 this.usehref = attributes.usehref || ""; 50790 } 50791} 50792class BooleanElement extends Option01 { 50793 constructor(attributes) { 50794 super(TEMPLATE_NS_ID, "boolean"); 50795 this.id = attributes.id || ""; 50796 this.name = attributes.name || ""; 50797 this.use = attributes.use || ""; 50798 this.usehref = attributes.usehref || ""; 50799 } 50800 [$toHTML](availableSpace) { 50801 return valueToHtml(this[$content] === 1 ? "1" : "0"); 50802 } 50803} 50804class Border extends XFAObject { 50805 constructor(attributes) { 50806 super(TEMPLATE_NS_ID, "border", true); 50807 this.break = getStringOption(attributes.break, ["close", "open"]); 50808 this.hand = getStringOption(attributes.hand, ["even", "left", "right"]); 50809 this.id = attributes.id || ""; 50810 this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 50811 this.relevant = getRelevant(attributes.relevant); 50812 this.use = attributes.use || ""; 50813 this.usehref = attributes.usehref || ""; 50814 this.corner = new XFAObjectArray(4); 50815 this.edge = new XFAObjectArray(4); 50816 this.extras = null; 50817 this.fill = null; 50818 this.margin = null; 50819 } 50820 [$getExtra]() { 50821 if (!this[$extra]) { 50822 const edges = this.edge.children.slice(); 50823 if (edges.length < 4) { 50824 const defaultEdge = edges.at(-1) || new Edge({}); 50825 for (let i = edges.length; i < 4; i++) { 50826 edges.push(defaultEdge); 50827 } 50828 } 50829 const widths = edges.map(edge => edge.thickness); 50830 const insets = [0, 0, 0, 0]; 50831 if (this.margin) { 50832 insets[0] = this.margin.topInset; 50833 insets[1] = this.margin.rightInset; 50834 insets[2] = this.margin.bottomInset; 50835 insets[3] = this.margin.leftInset; 50836 } 50837 this[$extra] = { 50838 widths, 50839 insets, 50840 edges 50841 }; 50842 } 50843 return this[$extra]; 50844 } 50845 [$toStyle]() { 50846 const { 50847 edges 50848 } = this[$getExtra](); 50849 const edgeStyles = edges.map(node => { 50850 const style = node[$toStyle](); 50851 style.color ||= "#000000"; 50852 return style; 50853 }); 50854 const style = Object.create(null); 50855 if (this.margin) { 50856 Object.assign(style, this.margin[$toStyle]()); 50857 } 50858 if (this.fill?.presence === "visible") { 50859 Object.assign(style, this.fill[$toStyle]()); 50860 } 50861 if (this.corner.children.some(node => node.radius !== 0)) { 50862 const cornerStyles = this.corner.children.map(node => node[$toStyle]()); 50863 if (cornerStyles.length === 2 || cornerStyles.length === 3) { 50864 const last = cornerStyles.at(-1); 50865 for (let i = cornerStyles.length; i < 4; i++) { 50866 cornerStyles.push(last); 50867 } 50868 } 50869 style.borderRadius = cornerStyles.map(s => s.radius).join(" "); 50870 } 50871 switch (this.presence) { 50872 case "invisible": 50873 case "hidden": 50874 style.borderStyle = ""; 50875 break; 50876 case "inactive": 50877 style.borderStyle = "none"; 50878 break; 50879 default: 50880 style.borderStyle = edgeStyles.map(s => s.style).join(" "); 50881 break; 50882 } 50883 style.borderWidth = edgeStyles.map(s => s.width).join(" "); 50884 style.borderColor = edgeStyles.map(s => s.color).join(" "); 50885 return style; 50886 } 50887} 50888class Break extends XFAObject { 50889 constructor(attributes) { 50890 super(TEMPLATE_NS_ID, "break", true); 50891 this.after = getStringOption(attributes.after, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]); 50892 this.afterTarget = attributes.afterTarget || ""; 50893 this.before = getStringOption(attributes.before, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]); 50894 this.beforeTarget = attributes.beforeTarget || ""; 50895 this.bookendLeader = attributes.bookendLeader || ""; 50896 this.bookendTrailer = attributes.bookendTrailer || ""; 50897 this.id = attributes.id || ""; 50898 this.overflowLeader = attributes.overflowLeader || ""; 50899 this.overflowTarget = attributes.overflowTarget || ""; 50900 this.overflowTrailer = attributes.overflowTrailer || ""; 50901 this.startNew = getInteger({ 50902 data: attributes.startNew, 50903 defaultValue: 0, 50904 validate: x => x === 1 50905 }); 50906 this.use = attributes.use || ""; 50907 this.usehref = attributes.usehref || ""; 50908 this.extras = null; 50909 } 50910} 50911class BreakAfter extends XFAObject { 50912 constructor(attributes) { 50913 super(TEMPLATE_NS_ID, "breakAfter", true); 50914 this.id = attributes.id || ""; 50915 this.leader = attributes.leader || ""; 50916 this.startNew = getInteger({ 50917 data: attributes.startNew, 50918 defaultValue: 0, 50919 validate: x => x === 1 50920 }); 50921 this.target = attributes.target || ""; 50922 this.targetType = getStringOption(attributes.targetType, ["auto", "contentArea", "pageArea"]); 50923 this.trailer = attributes.trailer || ""; 50924 this.use = attributes.use || ""; 50925 this.usehref = attributes.usehref || ""; 50926 this.script = null; 50927 } 50928} 50929class BreakBefore extends XFAObject { 50930 constructor(attributes) { 50931 super(TEMPLATE_NS_ID, "breakBefore", true); 50932 this.id = attributes.id || ""; 50933 this.leader = attributes.leader || ""; 50934 this.startNew = getInteger({ 50935 data: attributes.startNew, 50936 defaultValue: 0, 50937 validate: x => x === 1 50938 }); 50939 this.target = attributes.target || ""; 50940 this.targetType = getStringOption(attributes.targetType, ["auto", "contentArea", "pageArea"]); 50941 this.trailer = attributes.trailer || ""; 50942 this.use = attributes.use || ""; 50943 this.usehref = attributes.usehref || ""; 50944 this.script = null; 50945 } 50946 [$toHTML](availableSpace) { 50947 this[$extra] = {}; 50948 return HTMLResult.FAILURE; 50949 } 50950} 50951class Button extends XFAObject { 50952 constructor(attributes) { 50953 super(TEMPLATE_NS_ID, "button", true); 50954 this.highlight = getStringOption(attributes.highlight, ["inverted", "none", "outline", "push"]); 50955 this.id = attributes.id || ""; 50956 this.use = attributes.use || ""; 50957 this.usehref = attributes.usehref || ""; 50958 this.extras = null; 50959 } 50960 [$toHTML](availableSpace) { 50961 const parent = this[$getParent](); 50962 const grandpa = parent[$getParent](); 50963 const htmlButton = { 50964 name: "button", 50965 attributes: { 50966 id: this[$uid], 50967 class: ["xfaButton"], 50968 style: {} 50969 }, 50970 children: [] 50971 }; 50972 for (const event of grandpa.event.children) { 50973 if (event.activity !== "click" || !event.script) { 50974 continue; 50975 } 50976 const jsURL = recoverJsURL(event.script[$content]); 50977 if (!jsURL) { 50978 continue; 50979 } 50980 const href = fixURL(jsURL.url); 50981 if (!href) { 50982 continue; 50983 } 50984 htmlButton.children.push({ 50985 name: "a", 50986 attributes: { 50987 id: "link" + this[$uid], 50988 href, 50989 newWindow: jsURL.newWindow, 50990 class: ["xfaLink"], 50991 style: {} 50992 }, 50993 children: [] 50994 }); 50995 } 50996 return HTMLResult.success(htmlButton); 50997 } 50998} 50999class Calculate extends XFAObject { 51000 constructor(attributes) { 51001 super(TEMPLATE_NS_ID, "calculate", true); 51002 this.id = attributes.id || ""; 51003 this.override = getStringOption(attributes.override, ["disabled", "error", "ignore", "warning"]); 51004 this.use = attributes.use || ""; 51005 this.usehref = attributes.usehref || ""; 51006 this.extras = null; 51007 this.message = null; 51008 this.script = null; 51009 } 51010} 51011class Caption extends XFAObject { 51012 constructor(attributes) { 51013 super(TEMPLATE_NS_ID, "caption", true); 51014 this.id = attributes.id || ""; 51015 this.placement = getStringOption(attributes.placement, ["left", "bottom", "inline", "right", "top"]); 51016 this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 51017 this.reserve = Math.ceil(getMeasurement(attributes.reserve)); 51018 this.use = attributes.use || ""; 51019 this.usehref = attributes.usehref || ""; 51020 this.extras = null; 51021 this.font = null; 51022 this.margin = null; 51023 this.para = null; 51024 this.value = null; 51025 } 51026 [$setValue](value) { 51027 _setValue(this, value); 51028 } 51029 [$getExtra](availableSpace) { 51030 if (!this[$extra]) { 51031 let { 51032 width, 51033 height 51034 } = availableSpace; 51035 switch (this.placement) { 51036 case "left": 51037 case "right": 51038 case "inline": 51039 width = this.reserve <= 0 ? width : this.reserve; 51040 break; 51041 case "top": 51042 case "bottom": 51043 height = this.reserve <= 0 ? height : this.reserve; 51044 break; 51045 } 51046 this[$extra] = layoutNode(this, { 51047 width, 51048 height 51049 }); 51050 } 51051 return this[$extra]; 51052 } 51053 [$toHTML](availableSpace) { 51054 if (!this.value) { 51055 return HTMLResult.EMPTY; 51056 } 51057 this[$pushPara](); 51058 const value = this.value[$toHTML](availableSpace).html; 51059 if (!value) { 51060 this[$popPara](); 51061 return HTMLResult.EMPTY; 51062 } 51063 const savedReserve = this.reserve; 51064 if (this.reserve <= 0) { 51065 const { 51066 w, 51067 h 51068 } = this[$getExtra](availableSpace); 51069 switch (this.placement) { 51070 case "left": 51071 case "right": 51072 case "inline": 51073 this.reserve = w; 51074 break; 51075 case "top": 51076 case "bottom": 51077 this.reserve = h; 51078 break; 51079 } 51080 } 51081 const children = []; 51082 if (typeof value === "string") { 51083 children.push({ 51084 name: "#text", 51085 value 51086 }); 51087 } else { 51088 children.push(value); 51089 } 51090 const style = toStyle(this, "font", "margin", "visibility"); 51091 switch (this.placement) { 51092 case "left": 51093 case "right": 51094 if (this.reserve > 0) { 51095 style.width = measureToString(this.reserve); 51096 } 51097 break; 51098 case "top": 51099 case "bottom": 51100 if (this.reserve > 0) { 51101 style.height = measureToString(this.reserve); 51102 } 51103 break; 51104 } 51105 setPara(this, null, value); 51106 this[$popPara](); 51107 this.reserve = savedReserve; 51108 return HTMLResult.success({ 51109 name: "div", 51110 attributes: { 51111 style, 51112 class: ["xfaCaption"] 51113 }, 51114 children 51115 }); 51116 } 51117} 51118class Certificate extends StringObject { 51119 constructor(attributes) { 51120 super(TEMPLATE_NS_ID, "certificate"); 51121 this.id = attributes.id || ""; 51122 this.name = attributes.name || ""; 51123 this.use = attributes.use || ""; 51124 this.usehref = attributes.usehref || ""; 51125 } 51126} 51127class Certificates extends XFAObject { 51128 constructor(attributes) { 51129 super(TEMPLATE_NS_ID, "certificates", true); 51130 this.credentialServerPolicy = getStringOption(attributes.credentialServerPolicy, ["optional", "required"]); 51131 this.id = attributes.id || ""; 51132 this.url = attributes.url || ""; 51133 this.urlPolicy = attributes.urlPolicy || ""; 51134 this.use = attributes.use || ""; 51135 this.usehref = attributes.usehref || ""; 51136 this.encryption = null; 51137 this.issuers = null; 51138 this.keyUsage = null; 51139 this.oids = null; 51140 this.signing = null; 51141 this.subjectDNs = null; 51142 } 51143} 51144class CheckButton extends XFAObject { 51145 constructor(attributes) { 51146 super(TEMPLATE_NS_ID, "checkButton", true); 51147 this.id = attributes.id || ""; 51148 this.mark = getStringOption(attributes.mark, ["default", "check", "circle", "cross", "diamond", "square", "star"]); 51149 this.shape = getStringOption(attributes.shape, ["square", "round"]); 51150 this.size = getMeasurement(attributes.size, "10pt"); 51151 this.use = attributes.use || ""; 51152 this.usehref = attributes.usehref || ""; 51153 this.border = null; 51154 this.extras = null; 51155 this.margin = null; 51156 } 51157 [$toHTML](availableSpace) { 51158 const style = toStyle(this, "margin"); 51159 const size = measureToString(this.size); 51160 style.width = style.height = size; 51161 let type; 51162 let className; 51163 let groupId; 51164 const field = this[$getParent]()[$getParent](); 51165 const items = field.items.children.length && field.items.children[0][$toHTML]().html || []; 51166 const exportedValue = { 51167 on: (items[0] !== undefined ? items[0] : "on").toString(), 51168 off: (items[1] !== undefined ? items[1] : "off").toString() 51169 }; 51170 const value = field.value?.[$text]() || "off"; 51171 const checked = value === exportedValue.on || undefined; 51172 const container = field[$getSubformParent](); 51173 const fieldId = field[$uid]; 51174 let dataId; 51175 if (container instanceof ExclGroup) { 51176 groupId = container[$uid]; 51177 type = "radio"; 51178 className = "xfaRadio"; 51179 dataId = container[$data]?.[$uid] || container[$uid]; 51180 } else { 51181 type = "checkbox"; 51182 className = "xfaCheckbox"; 51183 dataId = field[$data]?.[$uid] || field[$uid]; 51184 } 51185 const input = { 51186 name: "input", 51187 attributes: { 51188 class: [className], 51189 style, 51190 fieldId, 51191 dataId, 51192 type, 51193 checked, 51194 xfaOn: exportedValue.on, 51195 xfaOff: exportedValue.off, 51196 "aria-label": ariaLabel(field), 51197 "aria-required": false 51198 } 51199 }; 51200 if (groupId) { 51201 input.attributes.name = groupId; 51202 } 51203 if (isRequired(field)) { 51204 input.attributes["aria-required"] = true; 51205 input.attributes.required = true; 51206 } 51207 return HTMLResult.success({ 51208 name: "label", 51209 attributes: { 51210 class: ["xfaLabel"] 51211 }, 51212 children: [input] 51213 }); 51214 } 51215} 51216class ChoiceList extends XFAObject { 51217 constructor(attributes) { 51218 super(TEMPLATE_NS_ID, "choiceList", true); 51219 this.commitOn = getStringOption(attributes.commitOn, ["select", "exit"]); 51220 this.id = attributes.id || ""; 51221 this.open = getStringOption(attributes.open, ["userControl", "always", "multiSelect", "onEntry"]); 51222 this.textEntry = getInteger({ 51223 data: attributes.textEntry, 51224 defaultValue: 0, 51225 validate: x => x === 1 51226 }); 51227 this.use = attributes.use || ""; 51228 this.usehref = attributes.usehref || ""; 51229 this.border = null; 51230 this.extras = null; 51231 this.margin = null; 51232 } 51233 [$toHTML](availableSpace) { 51234 const style = toStyle(this, "border", "margin"); 51235 const ui = this[$getParent](); 51236 const field = ui[$getParent](); 51237 const fontSize = field.font?.size || 10; 51238 const optionStyle = { 51239 fontSize: `calc(${fontSize}px * var(--total-scale-factor))` 51240 }; 51241 const children = []; 51242 if (field.items.children.length > 0) { 51243 const items = field.items; 51244 let displayedIndex = 0; 51245 let saveIndex = 0; 51246 if (items.children.length === 2) { 51247 displayedIndex = items.children[0].save; 51248 saveIndex = 1 - displayedIndex; 51249 } 51250 const displayed = items.children[displayedIndex][$toHTML]().html; 51251 const values = items.children[saveIndex][$toHTML]().html; 51252 let selected = false; 51253 const value = field.value?.[$text]() || ""; 51254 for (let i = 0, ii = displayed.length; i < ii; i++) { 51255 const option = { 51256 name: "option", 51257 attributes: { 51258 value: values[i] || displayed[i], 51259 style: optionStyle 51260 }, 51261 value: displayed[i] 51262 }; 51263 if (values[i] === value) { 51264 option.attributes.selected = selected = true; 51265 } 51266 children.push(option); 51267 } 51268 if (!selected) { 51269 children.splice(0, 0, { 51270 name: "option", 51271 attributes: { 51272 hidden: true, 51273 selected: true 51274 }, 51275 value: " " 51276 }); 51277 } 51278 } 51279 const selectAttributes = { 51280 class: ["xfaSelect"], 51281 fieldId: field[$uid], 51282 dataId: field[$data]?.[$uid] || field[$uid], 51283 style, 51284 "aria-label": ariaLabel(field), 51285 "aria-required": false 51286 }; 51287 if (isRequired(field)) { 51288 selectAttributes["aria-required"] = true; 51289 selectAttributes.required = true; 51290 } 51291 if (this.open === "multiSelect") { 51292 selectAttributes.multiple = true; 51293 } 51294 return HTMLResult.success({ 51295 name: "label", 51296 attributes: { 51297 class: ["xfaLabel"] 51298 }, 51299 children: [{ 51300 name: "select", 51301 children, 51302 attributes: selectAttributes 51303 }] 51304 }); 51305 } 51306} 51307class Color extends XFAObject { 51308 constructor(attributes) { 51309 super(TEMPLATE_NS_ID, "color", true); 51310 this.cSpace = getStringOption(attributes.cSpace, ["SRGB"]); 51311 this.id = attributes.id || ""; 51312 this.use = attributes.use || ""; 51313 this.usehref = attributes.usehref || ""; 51314 this.value = attributes.value ? getColor(attributes.value) : ""; 51315 this.extras = null; 51316 } 51317 [$hasSettableValue]() { 51318 return false; 51319 } 51320 [$toStyle]() { 51321 return this.value ? Util.makeHexColor(this.value.r, this.value.g, this.value.b) : null; 51322 } 51323} 51324class Comb extends XFAObject { 51325 constructor(attributes) { 51326 super(TEMPLATE_NS_ID, "comb"); 51327 this.id = attributes.id || ""; 51328 this.numberOfCells = getInteger({ 51329 data: attributes.numberOfCells, 51330 defaultValue: 0, 51331 validate: x => x >= 0 51332 }); 51333 this.use = attributes.use || ""; 51334 this.usehref = attributes.usehref || ""; 51335 } 51336} 51337class Connect extends XFAObject { 51338 constructor(attributes) { 51339 super(TEMPLATE_NS_ID, "connect", true); 51340 this.connection = attributes.connection || ""; 51341 this.id = attributes.id || ""; 51342 this.ref = attributes.ref || ""; 51343 this.usage = getStringOption(attributes.usage, ["exportAndImport", "exportOnly", "importOnly"]); 51344 this.use = attributes.use || ""; 51345 this.usehref = attributes.usehref || ""; 51346 this.picture = null; 51347 } 51348} 51349class ContentArea extends XFAObject { 51350 constructor(attributes) { 51351 super(TEMPLATE_NS_ID, "contentArea", true); 51352 this.h = getMeasurement(attributes.h); 51353 this.id = attributes.id || ""; 51354 this.name = attributes.name || ""; 51355 this.relevant = getRelevant(attributes.relevant); 51356 this.use = attributes.use || ""; 51357 this.usehref = attributes.usehref || ""; 51358 this.w = getMeasurement(attributes.w); 51359 this.x = getMeasurement(attributes.x, "0pt"); 51360 this.y = getMeasurement(attributes.y, "0pt"); 51361 this.desc = null; 51362 this.extras = null; 51363 } 51364 [$toHTML](availableSpace) { 51365 const left = measureToString(this.x); 51366 const top = measureToString(this.y); 51367 const style = { 51368 left, 51369 top, 51370 width: measureToString(this.w), 51371 height: measureToString(this.h) 51372 }; 51373 const classNames = ["xfaContentarea"]; 51374 if (isPrintOnly(this)) { 51375 classNames.push("xfaPrintOnly"); 51376 } 51377 return HTMLResult.success({ 51378 name: "div", 51379 children: [], 51380 attributes: { 51381 style, 51382 class: classNames, 51383 id: this[$uid] 51384 } 51385 }); 51386 } 51387} 51388class Corner extends XFAObject { 51389 constructor(attributes) { 51390 super(TEMPLATE_NS_ID, "corner", true); 51391 this.id = attributes.id || ""; 51392 this.inverted = getInteger({ 51393 data: attributes.inverted, 51394 defaultValue: 0, 51395 validate: x => x === 1 51396 }); 51397 this.join = getStringOption(attributes.join, ["square", "round"]); 51398 this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 51399 this.radius = getMeasurement(attributes.radius); 51400 this.stroke = getStringOption(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]); 51401 this.thickness = getMeasurement(attributes.thickness, "0.5pt"); 51402 this.use = attributes.use || ""; 51403 this.usehref = attributes.usehref || ""; 51404 this.color = null; 51405 this.extras = null; 51406 } 51407 [$toStyle]() { 51408 const style = toStyle(this, "visibility"); 51409 style.radius = measureToString(this.join === "square" ? 0 : this.radius); 51410 return style; 51411 } 51412} 51413class DateElement extends ContentObject { 51414 constructor(attributes) { 51415 super(TEMPLATE_NS_ID, "date"); 51416 this.id = attributes.id || ""; 51417 this.name = attributes.name || ""; 51418 this.use = attributes.use || ""; 51419 this.usehref = attributes.usehref || ""; 51420 } 51421 [$finalize]() { 51422 const date = this[$content].trim(); 51423 this[$content] = date ? new Date(date) : null; 51424 } 51425 [$toHTML](availableSpace) { 51426 return valueToHtml(this[$content] ? this[$content].toString() : ""); 51427 } 51428} 51429class DateTime extends ContentObject { 51430 constructor(attributes) { 51431 super(TEMPLATE_NS_ID, "dateTime"); 51432 this.id = attributes.id || ""; 51433 this.name = attributes.name || ""; 51434 this.use = attributes.use || ""; 51435 this.usehref = attributes.usehref || ""; 51436 } 51437 [$finalize]() { 51438 const date = this[$content].trim(); 51439 this[$content] = date ? new Date(date) : null; 51440 } 51441 [$toHTML](availableSpace) { 51442 return valueToHtml(this[$content] ? this[$content].toString() : ""); 51443 } 51444} 51445class DateTimeEdit extends XFAObject { 51446 constructor(attributes) { 51447 super(TEMPLATE_NS_ID, "dateTimeEdit", true); 51448 this.hScrollPolicy = getStringOption(attributes.hScrollPolicy, ["auto", "off", "on"]); 51449 this.id = attributes.id || ""; 51450 this.picker = getStringOption(attributes.picker, ["host", "none"]); 51451 this.use = attributes.use || ""; 51452 this.usehref = attributes.usehref || ""; 51453 this.border = null; 51454 this.comb = null; 51455 this.extras = null; 51456 this.margin = null; 51457 } 51458 [$toHTML](availableSpace) { 51459 const style = toStyle(this, "border", "font", "margin"); 51460 const field = this[$getParent]()[$getParent](); 51461 const html = { 51462 name: "input", 51463 attributes: { 51464 type: "text", 51465 fieldId: field[$uid], 51466 dataId: field[$data]?.[$uid] || field[$uid], 51467 class: ["xfaTextfield"], 51468 style, 51469 "aria-label": ariaLabel(field), 51470 "aria-required": false 51471 } 51472 }; 51473 if (isRequired(field)) { 51474 html.attributes["aria-required"] = true; 51475 html.attributes.required = true; 51476 } 51477 return HTMLResult.success({ 51478 name: "label", 51479 attributes: { 51480 class: ["xfaLabel"] 51481 }, 51482 children: [html] 51483 }); 51484 } 51485} 51486class Decimal extends ContentObject { 51487 constructor(attributes) { 51488 super(TEMPLATE_NS_ID, "decimal"); 51489 this.fracDigits = getInteger({ 51490 data: attributes.fracDigits, 51491 defaultValue: 2, 51492 validate: x => true 51493 }); 51494 this.id = attributes.id || ""; 51495 this.leadDigits = getInteger({ 51496 data: attributes.leadDigits, 51497 defaultValue: -1, 51498 validate: x => true 51499 }); 51500 this.name = attributes.name || ""; 51501 this.use = attributes.use || ""; 51502 this.usehref = attributes.usehref || ""; 51503 } 51504 [$finalize]() { 51505 const number = parseFloat(this[$content].trim()); 51506 this[$content] = isNaN(number) ? null : number; 51507 } 51508 [$toHTML](availableSpace) { 51509 return valueToHtml(this[$content] !== null ? this[$content].toString() : ""); 51510 } 51511} 51512class DefaultUi extends XFAObject { 51513 constructor(attributes) { 51514 super(TEMPLATE_NS_ID, "defaultUi", true); 51515 this.id = attributes.id || ""; 51516 this.use = attributes.use || ""; 51517 this.usehref = attributes.usehref || ""; 51518 this.extras = null; 51519 } 51520} 51521class Desc extends XFAObject { 51522 constructor(attributes) { 51523 super(TEMPLATE_NS_ID, "desc", true); 51524 this.id = attributes.id || ""; 51525 this.use = attributes.use || ""; 51526 this.usehref = attributes.usehref || ""; 51527 this.boolean = new XFAObjectArray(); 51528 this.date = new XFAObjectArray(); 51529 this.dateTime = new XFAObjectArray(); 51530 this.decimal = new XFAObjectArray(); 51531 this.exData = new XFAObjectArray(); 51532 this.float = new XFAObjectArray(); 51533 this.image = new XFAObjectArray(); 51534 this.integer = new XFAObjectArray(); 51535 this.text = new XFAObjectArray(); 51536 this.time = new XFAObjectArray(); 51537 } 51538} 51539class DigestMethod extends OptionObject { 51540 constructor(attributes) { 51541 super(TEMPLATE_NS_ID, "digestMethod", ["", "SHA1", "SHA256", "SHA512", "RIPEMD160"]); 51542 this.id = attributes.id || ""; 51543 this.use = attributes.use || ""; 51544 this.usehref = attributes.usehref || ""; 51545 } 51546} 51547class DigestMethods extends XFAObject { 51548 constructor(attributes) { 51549 super(TEMPLATE_NS_ID, "digestMethods", true); 51550 this.id = attributes.id || ""; 51551 this.type = getStringOption(attributes.type, ["optional", "required"]); 51552 this.use = attributes.use || ""; 51553 this.usehref = attributes.usehref || ""; 51554 this.digestMethod = new XFAObjectArray(); 51555 } 51556} 51557class Draw extends XFAObject { 51558 constructor(attributes) { 51559 super(TEMPLATE_NS_ID, "draw", true); 51560 this.anchorType = getStringOption(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]); 51561 this.colSpan = getInteger({ 51562 data: attributes.colSpan, 51563 defaultValue: 1, 51564 validate: n => n >= 1 || n === -1 51565 }); 51566 this.h = attributes.h ? getMeasurement(attributes.h) : ""; 51567 this.hAlign = getStringOption(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]); 51568 this.id = attributes.id || ""; 51569 this.locale = attributes.locale || ""; 51570 this.maxH = getMeasurement(attributes.maxH, "0pt"); 51571 this.maxW = getMeasurement(attributes.maxW, "0pt"); 51572 this.minH = getMeasurement(attributes.minH, "0pt"); 51573 this.minW = getMeasurement(attributes.minW, "0pt"); 51574 this.name = attributes.name || ""; 51575 this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 51576 this.relevant = getRelevant(attributes.relevant); 51577 this.rotate = getInteger({ 51578 data: attributes.rotate, 51579 defaultValue: 0, 51580 validate: x => x % 90 === 0 51581 }); 51582 this.use = attributes.use || ""; 51583 this.usehref = attributes.usehref || ""; 51584 this.w = attributes.w ? getMeasurement(attributes.w) : ""; 51585 this.x = getMeasurement(attributes.x, "0pt"); 51586 this.y = getMeasurement(attributes.y, "0pt"); 51587 this.assist = null; 51588 this.border = null; 51589 this.caption = null; 51590 this.desc = null; 51591 this.extras = null; 51592 this.font = null; 51593 this.keep = null; 51594 this.margin = null; 51595 this.para = null; 51596 this.traversal = null; 51597 this.ui = null; 51598 this.value = null; 51599 this.setProperty = new XFAObjectArray(); 51600 } 51601 [$setValue](value) { 51602 _setValue(this, value); 51603 } 51604 [$toHTML](availableSpace) { 51605 setTabIndex(this); 51606 if (this.presence === "hidden" || this.presence === "inactive") { 51607 return HTMLResult.EMPTY; 51608 } 51609 fixDimensions(this); 51610 this[$pushPara](); 51611 const savedW = this.w; 51612 const savedH = this.h; 51613 const { 51614 w, 51615 h, 51616 isBroken 51617 } = layoutNode(this, availableSpace); 51618 if (w && this.w === "") { 51619 if (isBroken && this[$getSubformParent]()[$isThereMoreWidth]()) { 51620 this[$popPara](); 51621 return HTMLResult.FAILURE; 51622 } 51623 this.w = w; 51624 } 51625 if (h && this.h === "") { 51626 this.h = h; 51627 } 51628 setFirstUnsplittable(this); 51629 if (!checkDimensions(this, availableSpace)) { 51630 this.w = savedW; 51631 this.h = savedH; 51632 this[$popPara](); 51633 return HTMLResult.FAILURE; 51634 } 51635 unsetFirstUnsplittable(this); 51636 const style = toStyle(this, "font", "hAlign", "dimensions", "position", "presence", "rotate", "anchorType", "border", "margin"); 51637 setMinMaxDimensions(this, style); 51638 if (style.margin) { 51639 style.padding = style.margin; 51640 delete style.margin; 51641 } 51642 const classNames = ["xfaDraw"]; 51643 if (this.font) { 51644 classNames.push("xfaFont"); 51645 } 51646 if (isPrintOnly(this)) { 51647 classNames.push("xfaPrintOnly"); 51648 } 51649 const attributes = { 51650 style, 51651 id: this[$uid], 51652 class: classNames 51653 }; 51654 if (this.name) { 51655 attributes.xfaName = this.name; 51656 } 51657 const html = { 51658 name: "div", 51659 attributes, 51660 children: [] 51661 }; 51662 applyAssist(this, attributes); 51663 const bbox = computeBbox(this, html, availableSpace); 51664 const value = this.value ? this.value[$toHTML](availableSpace).html : null; 51665 if (value === null) { 51666 this.w = savedW; 51667 this.h = savedH; 51668 this[$popPara](); 51669 return HTMLResult.success(createWrapper(this, html), bbox); 51670 } 51671 html.children.push(value); 51672 setPara(this, style, value); 51673 this.w = savedW; 51674 this.h = savedH; 51675 this[$popPara](); 51676 return HTMLResult.success(createWrapper(this, html), bbox); 51677 } 51678} 51679class Edge extends XFAObject { 51680 constructor(attributes) { 51681 super(TEMPLATE_NS_ID, "edge", true); 51682 this.cap = getStringOption(attributes.cap, ["square", "butt", "round"]); 51683 this.id = attributes.id || ""; 51684 this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 51685 this.stroke = getStringOption(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]); 51686 this.thickness = getMeasurement(attributes.thickness, "0.5pt"); 51687 this.use = attributes.use || ""; 51688 this.usehref = attributes.usehref || ""; 51689 this.color = null; 51690 this.extras = null; 51691 } 51692 [$toStyle]() { 51693 const style = toStyle(this, "visibility"); 51694 Object.assign(style, { 51695 linecap: this.cap, 51696 width: measureToString(this.thickness), 51697 color: this.color ? this.color[$toStyle]() : "#000000", 51698 style: "" 51699 }); 51700 if (this.presence !== "visible") { 51701 style.style = "none"; 51702 } else { 51703 switch (this.stroke) { 51704 case "solid": 51705 style.style = "solid"; 51706 break; 51707 case "dashDot": 51708 style.style = "dashed"; 51709 break; 51710 case "dashDotDot": 51711 style.style = "dashed"; 51712 break; 51713 case "dashed": 51714 style.style = "dashed"; 51715 break; 51716 case "dotted": 51717 style.style = "dotted"; 51718 break; 51719 case "embossed": 51720 style.style = "ridge"; 51721 break; 51722 case "etched": 51723 style.style = "groove"; 51724 break; 51725 case "lowered": 51726 style.style = "inset"; 51727 break; 51728 case "raised": 51729 style.style = "outset"; 51730 break; 51731 } 51732 } 51733 return style; 51734 } 51735} 51736class Encoding extends OptionObject { 51737 constructor(attributes) { 51738 super(TEMPLATE_NS_ID, "encoding", ["adbe.x509.rsa_sha1", "adbe.pkcs7.detached", "adbe.pkcs7.sha1"]); 51739 this.id = attributes.id || ""; 51740 this.use = attributes.use || ""; 51741 this.usehref = attributes.usehref || ""; 51742 } 51743} 51744class Encodings extends XFAObject { 51745 constructor(attributes) { 51746 super(TEMPLATE_NS_ID, "encodings", true); 51747 this.id = attributes.id || ""; 51748 this.type = getStringOption(attributes.type, ["optional", "required"]); 51749 this.use = attributes.use || ""; 51750 this.usehref = attributes.usehref || ""; 51751 this.encoding = new XFAObjectArray(); 51752 } 51753} 51754class Encrypt extends XFAObject { 51755 constructor(attributes) { 51756 super(TEMPLATE_NS_ID, "encrypt", true); 51757 this.id = attributes.id || ""; 51758 this.use = attributes.use || ""; 51759 this.usehref = attributes.usehref || ""; 51760 this.certificate = null; 51761 } 51762} 51763class EncryptData extends XFAObject { 51764 constructor(attributes) { 51765 super(TEMPLATE_NS_ID, "encryptData", true); 51766 this.id = attributes.id || ""; 51767 this.operation = getStringOption(attributes.operation, ["encrypt", "decrypt"]); 51768 this.target = attributes.target || ""; 51769 this.use = attributes.use || ""; 51770 this.usehref = attributes.usehref || ""; 51771 this.filter = null; 51772 this.manifest = null; 51773 } 51774} 51775class Encryption extends XFAObject { 51776 constructor(attributes) { 51777 super(TEMPLATE_NS_ID, "encryption", true); 51778 this.id = attributes.id || ""; 51779 this.type = getStringOption(attributes.type, ["optional", "required"]); 51780 this.use = attributes.use || ""; 51781 this.usehref = attributes.usehref || ""; 51782 this.certificate = new XFAObjectArray(); 51783 } 51784} 51785class EncryptionMethod extends OptionObject { 51786 constructor(attributes) { 51787 super(TEMPLATE_NS_ID, "encryptionMethod", ["", "AES256-CBC", "TRIPLEDES-CBC", "AES128-CBC", "AES192-CBC"]); 51788 this.id = attributes.id || ""; 51789 this.use = attributes.use || ""; 51790 this.usehref = attributes.usehref || ""; 51791 } 51792} 51793class EncryptionMethods extends XFAObject { 51794 constructor(attributes) { 51795 super(TEMPLATE_NS_ID, "encryptionMethods", true); 51796 this.id = attributes.id || ""; 51797 this.type = getStringOption(attributes.type, ["optional", "required"]); 51798 this.use = attributes.use || ""; 51799 this.usehref = attributes.usehref || ""; 51800 this.encryptionMethod = new XFAObjectArray(); 51801 } 51802} 51803class Event extends XFAObject { 51804 constructor(attributes) { 51805 super(TEMPLATE_NS_ID, "event", true); 51806 this.activity = getStringOption(attributes.activity, ["click", "change", "docClose", "docReady", "enter", "exit", "full", "indexChange", "initialize", "mouseDown", "mouseEnter", "mouseExit", "mouseUp", "postExecute", "postOpen", "postPrint", "postSave", "postSign", "postSubmit", "preExecute", "preOpen", "prePrint", "preSave", "preSign", "preSubmit", "ready", "validationState"]); 51807 this.id = attributes.id || ""; 51808 this.listen = getStringOption(attributes.listen, ["refOnly", "refAndDescendents"]); 51809 this.name = attributes.name || ""; 51810 this.ref = attributes.ref || ""; 51811 this.use = attributes.use || ""; 51812 this.usehref = attributes.usehref || ""; 51813 this.extras = null; 51814 this.encryptData = null; 51815 this.execute = null; 51816 this.script = null; 51817 this.signData = null; 51818 this.submit = null; 51819 } 51820} 51821class ExData extends ContentObject { 51822 constructor(attributes) { 51823 super(TEMPLATE_NS_ID, "exData"); 51824 this.contentType = attributes.contentType || ""; 51825 this.href = attributes.href || ""; 51826 this.id = attributes.id || ""; 51827 this.maxLength = getInteger({ 51828 data: attributes.maxLength, 51829 defaultValue: -1, 51830 validate: x => x >= -1 51831 }); 51832 this.name = attributes.name || ""; 51833 this.rid = attributes.rid || ""; 51834 this.transferEncoding = getStringOption(attributes.transferEncoding, ["none", "base64", "package"]); 51835 this.use = attributes.use || ""; 51836 this.usehref = attributes.usehref || ""; 51837 } 51838 [$isCDATAXml]() { 51839 return this.contentType === "text/html"; 51840 } 51841 [$onChild](child) { 51842 if (this.contentType === "text/html" && child[$namespaceId] === NamespaceIds.xhtml.id) { 51843 this[$content] = child; 51844 return true; 51845 } 51846 if (this.contentType === "text/xml") { 51847 this[$content] = child; 51848 return true; 51849 } 51850 return false; 51851 } 51852 [$toHTML](availableSpace) { 51853 if (this.contentType !== "text/html" || !this[$content]) { 51854 return HTMLResult.EMPTY; 51855 } 51856 return this[$content][$toHTML](availableSpace); 51857 } 51858} 51859class ExObject extends XFAObject { 51860 constructor(attributes) { 51861 super(TEMPLATE_NS_ID, "exObject", true); 51862 this.archive = attributes.archive || ""; 51863 this.classId = attributes.classId || ""; 51864 this.codeBase = attributes.codeBase || ""; 51865 this.codeType = attributes.codeType || ""; 51866 this.id = attributes.id || ""; 51867 this.name = attributes.name || ""; 51868 this.use = attributes.use || ""; 51869 this.usehref = attributes.usehref || ""; 51870 this.extras = null; 51871 this.boolean = new XFAObjectArray(); 51872 this.date = new XFAObjectArray(); 51873 this.dateTime = new XFAObjectArray(); 51874 this.decimal = new XFAObjectArray(); 51875 this.exData = new XFAObjectArray(); 51876 this.exObject = new XFAObjectArray(); 51877 this.float = new XFAObjectArray(); 51878 this.image = new XFAObjectArray(); 51879 this.integer = new XFAObjectArray(); 51880 this.text = new XFAObjectArray(); 51881 this.time = new XFAObjectArray(); 51882 } 51883} 51884class ExclGroup extends XFAObject { 51885 constructor(attributes) { 51886 super(TEMPLATE_NS_ID, "exclGroup", true); 51887 this.access = getStringOption(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]); 51888 this.accessKey = attributes.accessKey || ""; 51889 this.anchorType = getStringOption(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]); 51890 this.colSpan = getInteger({ 51891 data: attributes.colSpan, 51892 defaultValue: 1, 51893 validate: n => n >= 1 || n === -1 51894 }); 51895 this.h = attributes.h ? getMeasurement(attributes.h) : ""; 51896 this.hAlign = getStringOption(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]); 51897 this.id = attributes.id || ""; 51898 this.layout = getStringOption(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]); 51899 this.maxH = getMeasurement(attributes.maxH, "0pt"); 51900 this.maxW = getMeasurement(attributes.maxW, "0pt"); 51901 this.minH = getMeasurement(attributes.minH, "0pt"); 51902 this.minW = getMeasurement(attributes.minW, "0pt"); 51903 this.name = attributes.name || ""; 51904 this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 51905 this.relevant = getRelevant(attributes.relevant); 51906 this.use = attributes.use || ""; 51907 this.usehref = attributes.usehref || ""; 51908 this.w = attributes.w ? getMeasurement(attributes.w) : ""; 51909 this.x = getMeasurement(attributes.x, "0pt"); 51910 this.y = getMeasurement(attributes.y, "0pt"); 51911 this.assist = null; 51912 this.bind = null; 51913 this.border = null; 51914 this.calculate = null; 51915 this.caption = null; 51916 this.desc = null; 51917 this.extras = null; 51918 this.margin = null; 51919 this.para = null; 51920 this.traversal = null; 51921 this.validate = null; 51922 this.connect = new XFAObjectArray(); 51923 this.event = new XFAObjectArray(); 51924 this.field = new XFAObjectArray(); 51925 this.setProperty = new XFAObjectArray(); 51926 } 51927 [$isBindable]() { 51928 return true; 51929 } 51930 [$hasSettableValue]() { 51931 return true; 51932 } 51933 [$setValue](value) { 51934 for (const field of this.field.children) { 51935 if (!field.value) { 51936 const nodeValue = new Value({}); 51937 field[$appendChild](nodeValue); 51938 field.value = nodeValue; 51939 } 51940 field.value[$setValue](value); 51941 } 51942 } 51943 [$isThereMoreWidth]() { 51944 return this.layout.endsWith("-tb") && this[$extra].attempt === 0 && this[$extra].numberInLine > 0 || this[$getParent]()[$isThereMoreWidth](); 51945 } 51946 [$isSplittable]() { 51947 const parent = this[$getSubformParent](); 51948 if (!parent[$isSplittable]()) { 51949 return false; 51950 } 51951 if (this[$extra]._isSplittable !== undefined) { 51952 return this[$extra]._isSplittable; 51953 } 51954 if (this.layout === "position" || this.layout.includes("row")) { 51955 this[$extra]._isSplittable = false; 51956 return false; 51957 } 51958 if (parent.layout?.endsWith("-tb") && parent[$extra].numberInLine !== 0) { 51959 return false; 51960 } 51961 this[$extra]._isSplittable = true; 51962 return true; 51963 } 51964 [$flushHTML]() { 51965 return flushHTML(this); 51966 } 51967 [$addHTML](html, bbox) { 51968 addHTML(this, html, bbox); 51969 } 51970 [$getAvailableSpace]() { 51971 return getAvailableSpace(this); 51972 } 51973 [$toHTML](availableSpace) { 51974 setTabIndex(this); 51975 if (this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) { 51976 return HTMLResult.EMPTY; 51977 } 51978 fixDimensions(this); 51979 const children = []; 51980 const attributes = { 51981 id: this[$uid], 51982 class: [] 51983 }; 51984 setAccess(this, attributes.class); 51985 this[$extra] ||= Object.create(null); 51986 Object.assign(this[$extra], { 51987 children, 51988 attributes, 51989 attempt: 0, 51990 line: null, 51991 numberInLine: 0, 51992 availableSpace: { 51993 width: Math.min(this.w || Infinity, availableSpace.width), 51994 height: Math.min(this.h || Infinity, availableSpace.height) 51995 }, 51996 width: 0, 51997 height: 0, 51998 prevHeight: 0, 51999 currentWidth: 0 52000 }); 52001 const isSplittable = this[$isSplittable](); 52002 if (!isSplittable) { 52003 setFirstUnsplittable(this); 52004 } 52005 if (!checkDimensions(this, availableSpace)) { 52006 return HTMLResult.FAILURE; 52007 } 52008 const filter = new Set(["field"]); 52009 if (this.layout.includes("row")) { 52010 const columnWidths = this[$getSubformParent]().columnWidths; 52011 if (Array.isArray(columnWidths) && columnWidths.length > 0) { 52012 this[$extra].columnWidths = columnWidths; 52013 this[$extra].currentColumn = 0; 52014 } 52015 } 52016 const style = toStyle(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign"); 52017 const classNames = ["xfaExclgroup"]; 52018 const cl = layoutClass(this); 52019 if (cl) { 52020 classNames.push(cl); 52021 } 52022 if (isPrintOnly(this)) { 52023 classNames.push("xfaPrintOnly"); 52024 } 52025 attributes.style = style; 52026 attributes.class = classNames; 52027 if (this.name) { 52028 attributes.xfaName = this.name; 52029 } 52030 this[$pushPara](); 52031 const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb"; 52032 const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1; 52033 for (; this[$extra].attempt < maxRun; this[$extra].attempt++) { 52034 if (isLrTb && this[$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) { 52035 this[$extra].numberInLine = 0; 52036 } 52037 const result = this[$childrenToHTML]({ 52038 filter, 52039 include: true 52040 }); 52041 if (result.success) { 52042 break; 52043 } 52044 if (result.isBreak()) { 52045 this[$popPara](); 52046 return result; 52047 } 52048 if (isLrTb && this[$extra].attempt === 0 && this[$extra].numberInLine === 0 && !this[$getTemplateRoot]()[$extra].noLayoutFailure) { 52049 this[$extra].attempt = maxRun; 52050 break; 52051 } 52052 } 52053 this[$popPara](); 52054 if (!isSplittable) { 52055 unsetFirstUnsplittable(this); 52056 } 52057 if (this[$extra].attempt === maxRun) { 52058 if (!isSplittable) { 52059 delete this[$extra]; 52060 } 52061 return HTMLResult.FAILURE; 52062 } 52063 let marginH = 0; 52064 let marginV = 0; 52065 if (this.margin) { 52066 marginH = this.margin.leftInset + this.margin.rightInset; 52067 marginV = this.margin.topInset + this.margin.bottomInset; 52068 } 52069 const width = Math.max(this[$extra].width + marginH, this.w || 0); 52070 const height = Math.max(this[$extra].height + marginV, this.h || 0); 52071 const bbox = [this.x, this.y, width, height]; 52072 if (this.w === "") { 52073 style.width = measureToString(width); 52074 } 52075 if (this.h === "") { 52076 style.height = measureToString(height); 52077 } 52078 const html = { 52079 name: "div", 52080 attributes, 52081 children 52082 }; 52083 applyAssist(this, attributes); 52084 delete this[$extra]; 52085 return HTMLResult.success(createWrapper(this, html), bbox); 52086 } 52087} 52088class Execute extends XFAObject { 52089 constructor(attributes) { 52090 super(TEMPLATE_NS_ID, "execute"); 52091 this.connection = attributes.connection || ""; 52092 this.executeType = getStringOption(attributes.executeType, ["import", "remerge"]); 52093 this.id = attributes.id || ""; 52094 this.runAt = getStringOption(attributes.runAt, ["client", "both", "server"]); 52095 this.use = attributes.use || ""; 52096 this.usehref = attributes.usehref || ""; 52097 } 52098} 52099class Extras extends XFAObject { 52100 constructor(attributes) { 52101 super(TEMPLATE_NS_ID, "extras", true); 52102 this.id = attributes.id || ""; 52103 this.name = attributes.name || ""; 52104 this.use = attributes.use || ""; 52105 this.usehref = attributes.usehref || ""; 52106 this.boolean = new XFAObjectArray(); 52107 this.date = new XFAObjectArray(); 52108 this.dateTime = new XFAObjectArray(); 52109 this.decimal = new XFAObjectArray(); 52110 this.exData = new XFAObjectArray(); 52111 this.extras = new XFAObjectArray(); 52112 this.float = new XFAObjectArray(); 52113 this.image = new XFAObjectArray(); 52114 this.integer = new XFAObjectArray(); 52115 this.text = new XFAObjectArray(); 52116 this.time = new XFAObjectArray(); 52117 } 52118} 52119class Field extends XFAObject { 52120 constructor(attributes) { 52121 super(TEMPLATE_NS_ID, "field", true); 52122 this.access = getStringOption(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]); 52123 this.accessKey = attributes.accessKey || ""; 52124 this.anchorType = getStringOption(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]); 52125 this.colSpan = getInteger({ 52126 data: attributes.colSpan, 52127 defaultValue: 1, 52128 validate: n => n >= 1 || n === -1 52129 }); 52130 this.h = attributes.h ? getMeasurement(attributes.h) : ""; 52131 this.hAlign = getStringOption(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]); 52132 this.id = attributes.id || ""; 52133 this.locale = attributes.locale || ""; 52134 this.maxH = getMeasurement(attributes.maxH, "0pt"); 52135 this.maxW = getMeasurement(attributes.maxW, "0pt"); 52136 this.minH = getMeasurement(attributes.minH, "0pt"); 52137 this.minW = getMeasurement(attributes.minW, "0pt"); 52138 this.name = attributes.name || ""; 52139 this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 52140 this.relevant = getRelevant(attributes.relevant); 52141 this.rotate = getInteger({ 52142 data: attributes.rotate, 52143 defaultValue: 0, 52144 validate: x => x % 90 === 0 52145 }); 52146 this.use = attributes.use || ""; 52147 this.usehref = attributes.usehref || ""; 52148 this.w = attributes.w ? getMeasurement(attributes.w) : ""; 52149 this.x = getMeasurement(attributes.x, "0pt"); 52150 this.y = getMeasurement(attributes.y, "0pt"); 52151 this.assist = null; 52152 this.bind = null; 52153 this.border = null; 52154 this.calculate = null; 52155 this.caption = null; 52156 this.desc = null; 52157 this.extras = null; 52158 this.font = null; 52159 this.format = null; 52160 this.items = new XFAObjectArray(2); 52161 this.keep = null; 52162 this.margin = null; 52163 this.para = null; 52164 this.traversal = null; 52165 this.ui = null; 52166 this.validate = null; 52167 this.value = null; 52168 this.bindItems = new XFAObjectArray(); 52169 this.connect = new XFAObjectArray(); 52170 this.event = new XFAObjectArray(); 52171 this.setProperty = new XFAObjectArray(); 52172 } 52173 [$isBindable]() { 52174 return true; 52175 } 52176 [$setValue](value) { 52177 _setValue(this, value); 52178 } 52179 [$toHTML](availableSpace) { 52180 setTabIndex(this); 52181 if (!this.ui) { 52182 this.ui = new Ui({}); 52183 this.ui[$globalData] = this[$globalData]; 52184 this[$appendChild](this.ui); 52185 let node; 52186 switch (this.items.children.length) { 52187 case 0: 52188 node = new TextEdit({}); 52189 this.ui.textEdit = node; 52190 break; 52191 case 1: 52192 node = new CheckButton({}); 52193 this.ui.checkButton = node; 52194 break; 52195 case 2: 52196 node = new ChoiceList({}); 52197 this.ui.choiceList = node; 52198 break; 52199 } 52200 this.ui[$appendChild](node); 52201 } 52202 if (!this.ui || this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) { 52203 return HTMLResult.EMPTY; 52204 } 52205 if (this.caption) { 52206 delete this.caption[$extra]; 52207 }
vendor: 6,271 bytes, lines 52208-52411
52208 this[$pushPara](); 52209 const caption = this.caption ? this.caption[$toHTML](availableSpace).html : null; 52210 const savedW = this.w; 52211 const savedH = this.h; 52212 let marginH = 0; 52213 let marginV = 0; 52214 if (this.margin) { 52215 marginH = this.margin.leftInset + this.margin.rightInset; 52216 marginV = this.margin.topInset + this.margin.bottomInset; 52217 } 52218 let borderDims = null; 52219 if (this.w === "" || this.h === "") { 52220 let width = null; 52221 let height = null; 52222 let uiW = 0; 52223 let uiH = 0; 52224 if (this.ui.checkButton) { 52225 uiW = uiH = this.ui.checkButton.size; 52226 } else { 52227 const { 52228 w, 52229 h 52230 } = layoutNode(this, availableSpace); 52231 if (w !== null) { 52232 uiW = w; 52233 uiH = h; 52234 } else { 52235 uiH = fonts_getMetrics(this.font, true).lineNoGap; 52236 } 52237 } 52238 borderDims = getBorderDims(this.ui[$getExtra]()); 52239 uiW += borderDims.w; 52240 uiH += borderDims.h; 52241 if (this.caption) { 52242 const { 52243 w, 52244 h, 52245 isBroken 52246 } = this.caption[$getExtra](availableSpace); 52247 if (isBroken && this[$getSubformParent]()[$isThereMoreWidth]()) { 52248 this[$popPara](); 52249 return HTMLResult.FAILURE; 52250 } 52251 width = w; 52252 height = h; 52253 switch (this.caption.placement) { 52254 case "left": 52255 case "right": 52256 case "inline": 52257 width += uiW; 52258 break; 52259 case "top": 52260 case "bottom": 52261 height += uiH; 52262 break; 52263 } 52264 } else { 52265 width = uiW; 52266 height = uiH; 52267 } 52268 if (width && this.w === "") { 52269 width += marginH; 52270 this.w = Math.min(this.maxW <= 0 ? Infinity : this.maxW, this.minW + 1 < width ? width : this.minW); 52271 } 52272 if (height && this.h === "") { 52273 height += marginV; 52274 this.h = Math.min(this.maxH <= 0 ? Infinity : this.maxH, this.minH + 1 < height ? height : this.minH); 52275 } 52276 } 52277 this[$popPara](); 52278 fixDimensions(this); 52279 setFirstUnsplittable(this); 52280 if (!checkDimensions(this, availableSpace)) { 52281 this.w = savedW; 52282 this.h = savedH; 52283 this[$popPara](); 52284 return HTMLResult.FAILURE; 52285 } 52286 unsetFirstUnsplittable(this); 52287 const style = toStyle(this, "font", "dimensions", "position", "rotate", "anchorType", "presence", "margin", "hAlign"); 52288 setMinMaxDimensions(this, style); 52289 const classNames = ["xfaField"]; 52290 if (this.font) { 52291 classNames.push("xfaFont"); 52292 } 52293 if (isPrintOnly(this)) { 52294 classNames.push("xfaPrintOnly"); 52295 } 52296 const attributes = { 52297 style, 52298 id: this[$uid], 52299 class: classNames 52300 }; 52301 if (style.margin) { 52302 style.padding = style.margin; 52303 delete style.margin; 52304 } 52305 setAccess(this, classNames); 52306 if (this.name) { 52307 attributes.xfaName = this.name; 52308 } 52309 const children = []; 52310 const html = { 52311 name: "div", 52312 attributes, 52313 children 52314 }; 52315 applyAssist(this, attributes); 52316 const borderStyle = this.border ? this.border[$toStyle]() : null; 52317 const bbox = computeBbox(this, html, availableSpace); 52318 const ui = this.ui[$toHTML]().html; 52319 if (!ui) { 52320 Object.assign(style, borderStyle); 52321 return HTMLResult.success(createWrapper(this, html), bbox); 52322 } 52323 if (this[$tabIndex]) { 52324 if (ui.children?.[0]) { 52325 ui.children[0].attributes.tabindex = this[$tabIndex]; 52326 } else { 52327 ui.attributes.tabindex = this[$tabIndex]; 52328 } 52329 } 52330 ui.attributes.style ||= Object.create(null); 52331 let aElement = null; 52332 if (this.ui.button) { 52333 if (ui.children.length === 1) { 52334 [aElement] = ui.children.splice(0, 1); 52335 } 52336 Object.assign(ui.attributes.style, borderStyle); 52337 } else { 52338 Object.assign(style, borderStyle); 52339 } 52340 children.push(ui); 52341 if (this.value) { 52342 if (this.ui.imageEdit) { 52343 ui.children.push(this.value[$toHTML]().html); 52344 } else if (!this.ui.button) { 52345 let value = ""; 52346 if (this.value.exData) { 52347 value = this.value.exData[$text](); 52348 } else if (this.value.text) { 52349 value = this.value.text[$getExtra](); 52350 } else { 52351 const htmlValue = this.value[$toHTML]().html; 52352 if (htmlValue !== null) { 52353 value = htmlValue.children[0].value; 52354 } 52355 } 52356 if (this.ui.textEdit && this.value.text?.maxChars) { 52357 ui.children[0].attributes.maxLength = this.value.text.maxChars; 52358 } 52359 if (value) { 52360 if (this.ui.numericEdit) { 52361 value = parseFloat(value); 52362 value = isNaN(value) ? "" : value.toString(); 52363 } 52364 if (ui.children[0].name === "textarea") { 52365 ui.children[0].attributes.textContent = value; 52366 } else { 52367 ui.children[0].attributes.value = value; 52368 } 52369 } 52370 } 52371 } 52372 if (!this.ui.imageEdit && ui.children?.[0] && this.h) { 52373 borderDims = borderDims || getBorderDims(this.ui[$getExtra]()); 52374 let captionHeight = 0; 52375 if (this.caption && ["top", "bottom"].includes(this.caption.placement)) { 52376 captionHeight = this.caption.reserve; 52377 if (captionHeight <= 0) { 52378 captionHeight = this.caption[$getExtra](availableSpace).h; 52379 } 52380 const inputHeight = this.h - captionHeight - marginV - borderDims.h; 52381 ui.children[0].attributes.style.height = measureToString(inputHeight); 52382 } else { 52383 ui.children[0].attributes.style.height = "100%"; 52384 } 52385 } 52386 if (aElement) { 52387 ui.children.push(aElement); 52388 } 52389 if (!caption) { 52390 if (ui.attributes.class) { 52391 ui.attributes.class.push("xfaLeft"); 52392 } 52393 this.w = savedW; 52394 this.h = savedH; 52395 return HTMLResult.success(createWrapper(this, html), bbox); 52396 } 52397 if (this.ui.button) { 52398 if (style.padding) { 52399 delete style.padding; 52400 } 52401 if (caption.name === "div") { 52402 caption.name = "span"; 52403 } 52404 ui.children.push(caption); 52405 return HTMLResult.success(html, bbox); 52406 } else if (this.ui.checkButton) { 52407 caption.attributes.class[0] = "xfaCaptionForCheckButton"; 52408 } 52409 ui.attributes.class ||= []; 52410 ui.children.splice(0, 0, caption); 52411 switch (this.caption.placement) {
vendor: 67,244 bytes, lines 52412-54421
52412 case "left": 52413 ui.attributes.class.push("xfaLeft"); 52414 break; 52415 case "right": 52416 ui.attributes.class.push("xfaRight"); 52417 break; 52418 case "top": 52419 ui.attributes.class.push("xfaTop"); 52420 break; 52421 case "bottom": 52422 ui.attributes.class.push("xfaBottom"); 52423 break; 52424 case "inline": 52425 ui.attributes.class.push("xfaLeft"); 52426 break; 52427 } 52428 this.w = savedW; 52429 this.h = savedH; 52430 return HTMLResult.success(createWrapper(this, html), bbox); 52431 } 52432} 52433class Fill extends XFAObject { 52434 constructor(attributes) { 52435 super(TEMPLATE_NS_ID, "fill", true); 52436 this.id = attributes.id || ""; 52437 this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 52438 this.use = attributes.use || ""; 52439 this.usehref = attributes.usehref || ""; 52440 this.color = null; 52441 this.extras = null; 52442 this.linear = null; 52443 this.pattern = null; 52444 this.radial = null; 52445 this.solid = null; 52446 this.stipple = null; 52447 } 52448 [$toStyle]() { 52449 const parent = this[$getParent](); 52450 const grandpa = parent[$getParent](); 52451 const ggrandpa = grandpa[$getParent](); 52452 const style = Object.create(null); 52453 let propName = "color"; 52454 let altPropName = propName; 52455 if (parent instanceof Border) { 52456 propName = "background-color"; 52457 altPropName = "background"; 52458 if (ggrandpa instanceof Ui) { 52459 style.backgroundColor = "white"; 52460 } 52461 } 52462 if (parent instanceof Rectangle || parent instanceof Arc) { 52463 propName = altPropName = "fill"; 52464 style.fill = "white"; 52465 } 52466 for (const name of Object.getOwnPropertyNames(this)) { 52467 if (name === "extras" || name === "color") { 52468 continue; 52469 } 52470 const obj = this[name]; 52471 if (!(obj instanceof XFAObject)) { 52472 continue; 52473 } 52474 const color = obj[$toStyle](this.color); 52475 if (color) { 52476 style[color.startsWith("#") ? propName : altPropName] = color; 52477 } 52478 return style; 52479 } 52480 if (this.color?.value) { 52481 const color = this.color[$toStyle](); 52482 style[color.startsWith("#") ? propName : altPropName] = color; 52483 } 52484 return style; 52485 } 52486} 52487class Filter extends XFAObject { 52488 constructor(attributes) { 52489 super(TEMPLATE_NS_ID, "filter", true); 52490 this.addRevocationInfo = getStringOption(attributes.addRevocationInfo, ["", "required", "optional", "none"]); 52491 this.id = attributes.id || ""; 52492 this.name = attributes.name || ""; 52493 this.use = attributes.use || ""; 52494 this.usehref = attributes.usehref || ""; 52495 this.version = getInteger({ 52496 data: this.version, 52497 defaultValue: 5, 52498 validate: x => x >= 1 && x <= 5 52499 }); 52500 this.appearanceFilter = null; 52501 this.certificates = null; 52502 this.digestMethods = null; 52503 this.encodings = null; 52504 this.encryptionMethods = null; 52505 this.handler = null; 52506 this.lockDocument = null; 52507 this.mdp = null; 52508 this.reasons = null; 52509 this.timeStamp = null; 52510 } 52511} 52512class Float extends ContentObject { 52513 constructor(attributes) { 52514 super(TEMPLATE_NS_ID, "float"); 52515 this.id = attributes.id || ""; 52516 this.name = attributes.name || ""; 52517 this.use = attributes.use || ""; 52518 this.usehref = attributes.usehref || ""; 52519 } 52520 [$finalize]() { 52521 const number = parseFloat(this[$content].trim()); 52522 this[$content] = isNaN(number) ? null : number; 52523 } 52524 [$toHTML](availableSpace) { 52525 return valueToHtml(this[$content] !== null ? this[$content].toString() : ""); 52526 } 52527} 52528class template_Font extends XFAObject { 52529 constructor(attributes) { 52530 super(TEMPLATE_NS_ID, "font", true); 52531 this.baselineShift = getMeasurement(attributes.baselineShift); 52532 this.fontHorizontalScale = getFloat({ 52533 data: attributes.fontHorizontalScale, 52534 defaultValue: 100, 52535 validate: x => x >= 0 52536 }); 52537 this.fontVerticalScale = getFloat({ 52538 data: attributes.fontVerticalScale, 52539 defaultValue: 100, 52540 validate: x => x >= 0 52541 }); 52542 this.id = attributes.id || ""; 52543 this.kerningMode = getStringOption(attributes.kerningMode, ["none", "pair"]); 52544 this.letterSpacing = getMeasurement(attributes.letterSpacing, "0"); 52545 this.lineThrough = getInteger({ 52546 data: attributes.lineThrough, 52547 defaultValue: 0, 52548 validate: x => x === 1 || x === 2 52549 }); 52550 this.lineThroughPeriod = getStringOption(attributes.lineThroughPeriod, ["all", "word"]); 52551 this.overline = getInteger({ 52552 data: attributes.overline, 52553 defaultValue: 0, 52554 validate: x => x === 1 || x === 2 52555 }); 52556 this.overlinePeriod = getStringOption(attributes.overlinePeriod, ["all", "word"]); 52557 this.posture = getStringOption(attributes.posture, ["normal", "italic"]); 52558 this.size = getMeasurement(attributes.size, "10pt"); 52559 this.typeface = attributes.typeface || "Courier"; 52560 this.underline = getInteger({ 52561 data: attributes.underline, 52562 defaultValue: 0, 52563 validate: x => x === 1 || x === 2 52564 }); 52565 this.underlinePeriod = getStringOption(attributes.underlinePeriod, ["all", "word"]); 52566 this.use = attributes.use || ""; 52567 this.usehref = attributes.usehref || ""; 52568 this.weight = getStringOption(attributes.weight, ["normal", "bold"]); 52569 this.extras = null; 52570 this.fill = null; 52571 } 52572 [$clean](builder) { 52573 super[$clean](builder); 52574 this[$globalData].usedTypefaces.add(this.typeface); 52575 } 52576 [$toStyle]() { 52577 const style = toStyle(this, "fill"); 52578 const color = style.color; 52579 if (color) { 52580 if (color === "#000000") { 52581 delete style.color; 52582 } else if (!color.startsWith("#")) { 52583 style.background = color; 52584 style.backgroundClip = "text"; 52585 style.color = "transparent"; 52586 } 52587 } 52588 if (this.baselineShift) { 52589 style.verticalAlign = measureToString(this.baselineShift); 52590 } 52591 style.fontKerning = this.kerningMode === "none" ? "none" : "normal"; 52592 style.letterSpacing = measureToString(this.letterSpacing); 52593 if (this.lineThrough !== 0) { 52594 style.textDecoration = "line-through"; 52595 if (this.lineThrough === 2) { 52596 style.textDecorationStyle = "double"; 52597 } 52598 } 52599 if (this.overline !== 0) { 52600 style.textDecoration = "overline"; 52601 if (this.overline === 2) { 52602 style.textDecorationStyle = "double"; 52603 } 52604 } 52605 style.fontStyle = this.posture; 52606 style.fontSize = measureToString(0.99 * this.size); 52607 setFontFamily(this, this, this[$globalData].fontFinder, style); 52608 if (this.underline !== 0) { 52609 style.textDecoration = "underline"; 52610 if (this.underline === 2) { 52611 style.textDecorationStyle = "double"; 52612 } 52613 } 52614 style.fontWeight = this.weight; 52615 return style; 52616 } 52617} 52618class Format extends XFAObject { 52619 constructor(attributes) { 52620 super(TEMPLATE_NS_ID, "format", true); 52621 this.id = attributes.id || ""; 52622 this.use = attributes.use || ""; 52623 this.usehref = attributes.usehref || ""; 52624 this.extras = null; 52625 this.picture = null; 52626 } 52627} 52628class Handler extends StringObject { 52629 constructor(attributes) { 52630 super(TEMPLATE_NS_ID, "handler"); 52631 this.id = attributes.id || ""; 52632 this.type = getStringOption(attributes.type, ["optional", "required"]); 52633 this.use = attributes.use || ""; 52634 this.usehref = attributes.usehref || ""; 52635 } 52636} 52637class Hyphenation extends XFAObject { 52638 constructor(attributes) { 52639 super(TEMPLATE_NS_ID, "hyphenation"); 52640 this.excludeAllCaps = getInteger({ 52641 data: attributes.excludeAllCaps, 52642 defaultValue: 0, 52643 validate: x => x === 1 52644 }); 52645 this.excludeInitialCap = getInteger({ 52646 data: attributes.excludeInitialCap, 52647 defaultValue: 0, 52648 validate: x => x === 1 52649 }); 52650 this.hyphenate = getInteger({ 52651 data: attributes.hyphenate, 52652 defaultValue: 0, 52653 validate: x => x === 1 52654 }); 52655 this.id = attributes.id || ""; 52656 this.pushCharacterCount = getInteger({ 52657 data: attributes.pushCharacterCount, 52658 defaultValue: 3, 52659 validate: x => x >= 0 52660 }); 52661 this.remainCharacterCount = getInteger({ 52662 data: attributes.remainCharacterCount, 52663 defaultValue: 3, 52664 validate: x => x >= 0 52665 }); 52666 this.use = attributes.use || ""; 52667 this.usehref = attributes.usehref || ""; 52668 this.wordCharacterCount = getInteger({ 52669 data: attributes.wordCharacterCount, 52670 defaultValue: 7, 52671 validate: x => x >= 0 52672 }); 52673 } 52674} 52675class Image extends StringObject { 52676 constructor(attributes) { 52677 super(TEMPLATE_NS_ID, "image"); 52678 this.aspect = getStringOption(attributes.aspect, ["fit", "actual", "height", "none", "width"]); 52679 this.contentType = attributes.contentType || ""; 52680 this.href = attributes.href || ""; 52681 this.id = attributes.id || ""; 52682 this.name = attributes.name || ""; 52683 this.transferEncoding = getStringOption(attributes.transferEncoding, ["base64", "none", "package"]); 52684 this.use = attributes.use || ""; 52685 this.usehref = attributes.usehref || ""; 52686 } 52687 [$toHTML]() { 52688 if (this.contentType && !MIMES.has(this.contentType.toLowerCase())) { 52689 return HTMLResult.EMPTY; 52690 } 52691 let buffer = this[$globalData].images?.get(this.href); 52692 if (!buffer && (this.href || !this[$content])) { 52693 return HTMLResult.EMPTY; 52694 } 52695 if (!buffer && this.transferEncoding === "base64") { 52696 buffer = Uint8Array.fromBase64(this[$content]); 52697 } 52698 if (!buffer) { 52699 return HTMLResult.EMPTY; 52700 } 52701 if (!this.contentType) { 52702 for (const [header, type] of IMAGES_HEADERS) { 52703 if (buffer.length > header.length && header.every((x, i) => x === buffer[i])) { 52704 this.contentType = type; 52705 break; 52706 } 52707 } 52708 if (!this.contentType) { 52709 return HTMLResult.EMPTY; 52710 } 52711 } 52712 const blob = new Blob([buffer], { 52713 type: this.contentType 52714 }); 52715 let style; 52716 switch (this.aspect) { 52717 case "fit": 52718 case "actual": 52719 break; 52720 case "height": 52721 style = { 52722 height: "100%", 52723 objectFit: "fill" 52724 }; 52725 break; 52726 case "none": 52727 style = { 52728 width: "100%", 52729 height: "100%", 52730 objectFit: "fill" 52731 }; 52732 break; 52733 case "width": 52734 style = { 52735 width: "100%", 52736 objectFit: "fill" 52737 }; 52738 break; 52739 } 52740 const parent = this[$getParent](); 52741 return HTMLResult.success({ 52742 name: "img", 52743 attributes: { 52744 class: ["xfaImage"], 52745 style, 52746 src: URL.createObjectURL(blob), 52747 alt: parent ? ariaLabel(parent[$getParent]()) : null 52748 } 52749 }); 52750 } 52751} 52752class ImageEdit extends XFAObject { 52753 constructor(attributes) { 52754 super(TEMPLATE_NS_ID, "imageEdit", true); 52755 this.data = getStringOption(attributes.data, ["link", "embed"]); 52756 this.id = attributes.id || ""; 52757 this.use = attributes.use || ""; 52758 this.usehref = attributes.usehref || ""; 52759 this.border = null; 52760 this.extras = null; 52761 this.margin = null; 52762 } 52763 [$toHTML](availableSpace) { 52764 if (this.data === "embed") { 52765 return HTMLResult.success({ 52766 name: "div", 52767 children: [], 52768 attributes: {} 52769 }); 52770 } 52771 return HTMLResult.EMPTY; 52772 } 52773} 52774class Integer extends ContentObject { 52775 constructor(attributes) { 52776 super(TEMPLATE_NS_ID, "integer"); 52777 this.id = attributes.id || ""; 52778 this.name = attributes.name || ""; 52779 this.use = attributes.use || ""; 52780 this.usehref = attributes.usehref || ""; 52781 } 52782 [$finalize]() { 52783 const number = parseInt(this[$content].trim(), 10); 52784 this[$content] = isNaN(number) ? null : number; 52785 } 52786 [$toHTML](availableSpace) { 52787 return valueToHtml(this[$content] !== null ? this[$content].toString() : ""); 52788 } 52789} 52790class Issuers extends XFAObject { 52791 constructor(attributes) { 52792 super(TEMPLATE_NS_ID, "issuers", true); 52793 this.id = attributes.id || ""; 52794 this.type = getStringOption(attributes.type, ["optional", "required"]); 52795 this.use = attributes.use || ""; 52796 this.usehref = attributes.usehref || ""; 52797 this.certificate = new XFAObjectArray(); 52798 } 52799} 52800class Items extends XFAObject { 52801 constructor(attributes) { 52802 super(TEMPLATE_NS_ID, "items", true); 52803 this.id = attributes.id || ""; 52804 this.name = attributes.name || ""; 52805 this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 52806 this.ref = attributes.ref || ""; 52807 this.save = getInteger({ 52808 data: attributes.save, 52809 defaultValue: 0, 52810 validate: x => x === 1 52811 }); 52812 this.use = attributes.use || ""; 52813 this.usehref = attributes.usehref || ""; 52814 this.boolean = new XFAObjectArray(); 52815 this.date = new XFAObjectArray(); 52816 this.dateTime = new XFAObjectArray(); 52817 this.decimal = new XFAObjectArray(); 52818 this.exData = new XFAObjectArray(); 52819 this.float = new XFAObjectArray(); 52820 this.image = new XFAObjectArray(); 52821 this.integer = new XFAObjectArray(); 52822 this.text = new XFAObjectArray(); 52823 this.time = new XFAObjectArray(); 52824 } 52825 [$toHTML]() { 52826 const output = []; 52827 for (const child of this[$getChildren]()) { 52828 output.push(child[$text]()); 52829 } 52830 return HTMLResult.success(output); 52831 } 52832} 52833class Keep extends XFAObject { 52834 constructor(attributes) { 52835 super(TEMPLATE_NS_ID, "keep", true); 52836 this.id = attributes.id || ""; 52837 const options = ["none", "contentArea", "pageArea"]; 52838 this.intact = getStringOption(attributes.intact, options); 52839 this.next = getStringOption(attributes.next, options); 52840 this.previous = getStringOption(attributes.previous, options); 52841 this.use = attributes.use || ""; 52842 this.usehref = attributes.usehref || ""; 52843 this.extras = null; 52844 } 52845} 52846class KeyUsage extends XFAObject { 52847 constructor(attributes) { 52848 super(TEMPLATE_NS_ID, "keyUsage"); 52849 const options = ["", "yes", "no"]; 52850 this.crlSign = getStringOption(attributes.crlSign, options); 52851 this.dataEncipherment = getStringOption(attributes.dataEncipherment, options); 52852 this.decipherOnly = getStringOption(attributes.decipherOnly, options); 52853 this.digitalSignature = getStringOption(attributes.digitalSignature, options); 52854 this.encipherOnly = getStringOption(attributes.encipherOnly, options); 52855 this.id = attributes.id || ""; 52856 this.keyAgreement = getStringOption(attributes.keyAgreement, options); 52857 this.keyCertSign = getStringOption(attributes.keyCertSign, options); 52858 this.keyEncipherment = getStringOption(attributes.keyEncipherment, options); 52859 this.nonRepudiation = getStringOption(attributes.nonRepudiation, options); 52860 this.type = getStringOption(attributes.type, ["optional", "required"]); 52861 this.use = attributes.use || ""; 52862 this.usehref = attributes.usehref || ""; 52863 } 52864} 52865class Line extends XFAObject { 52866 constructor(attributes) { 52867 super(TEMPLATE_NS_ID, "line", true); 52868 this.hand = getStringOption(attributes.hand, ["even", "left", "right"]); 52869 this.id = attributes.id || ""; 52870 this.slope = getStringOption(attributes.slope, ["\\", "/"]); 52871 this.use = attributes.use || ""; 52872 this.usehref = attributes.usehref || ""; 52873 this.edge = null; 52874 } 52875 [$toHTML]() { 52876 const parent = this[$getParent]()[$getParent](); 52877 const edge = this.edge || new Edge({}); 52878 const edgeStyle = edge[$toStyle](); 52879 const style = Object.create(null); 52880 const thickness = edge.presence === "visible" ? edge.thickness : 0; 52881 style.strokeWidth = measureToString(thickness); 52882 style.stroke = edgeStyle.color; 52883 let x1, y1, x2, y2; 52884 let width = "100%"; 52885 let height = "100%"; 52886 if (parent.w <= thickness) { 52887 [x1, y1, x2, y2] = ["50%", 0, "50%", "100%"]; 52888 width = style.strokeWidth; 52889 } else if (parent.h <= thickness) { 52890 [x1, y1, x2, y2] = [0, "50%", "100%", "50%"]; 52891 height = style.strokeWidth; 52892 } else if (this.slope === "\\") { 52893 [x1, y1, x2, y2] = [0, 0, "100%", "100%"]; 52894 } else { 52895 [x1, y1, x2, y2] = [0, "100%", "100%", 0]; 52896 } 52897 const line = { 52898 name: "line", 52899 attributes: { 52900 xmlns: SVG_NS, 52901 x1, 52902 y1, 52903 x2, 52904 y2, 52905 style 52906 } 52907 }; 52908 const svg = { 52909 name: "svg", 52910 children: [line], 52911 attributes: { 52912 xmlns: SVG_NS, 52913 width, 52914 height, 52915 style: { 52916 overflow: "visible" 52917 } 52918 } 52919 }; 52920 if (hasMargin(parent)) { 52921 return HTMLResult.success({ 52922 name: "div", 52923 attributes: { 52924 style: { 52925 display: "inline", 52926 width: "100%", 52927 height: "100%" 52928 } 52929 }, 52930 children: [svg] 52931 }); 52932 } 52933 svg.attributes.style.position = "absolute"; 52934 return HTMLResult.success(svg); 52935 } 52936} 52937class Linear extends XFAObject { 52938 constructor(attributes) { 52939 super(TEMPLATE_NS_ID, "linear", true); 52940 this.id = attributes.id || ""; 52941 this.type = getStringOption(attributes.type, ["toRight", "toBottom", "toLeft", "toTop"]); 52942 this.use = attributes.use || ""; 52943 this.usehref = attributes.usehref || ""; 52944 this.color = null; 52945 this.extras = null; 52946 } 52947 [$toStyle](startColor) { 52948 startColor = startColor ? startColor[$toStyle]() : "#FFFFFF"; 52949 const transf = this.type.replace(/([RBLT])/, " $1").toLowerCase(); 52950 const endColor = this.color ? this.color[$toStyle]() : "#000000"; 52951 return `linear-gradient(${transf}, ${startColor}, ${endColor})`; 52952 } 52953} 52954class LockDocument extends ContentObject { 52955 constructor(attributes) { 52956 super(TEMPLATE_NS_ID, "lockDocument"); 52957 this.id = attributes.id || ""; 52958 this.type = getStringOption(attributes.type, ["optional", "required"]); 52959 this.use = attributes.use || ""; 52960 this.usehref = attributes.usehref || ""; 52961 } 52962 [$finalize]() { 52963 this[$content] = getStringOption(this[$content], ["auto", "0", "1"]); 52964 } 52965} 52966class Manifest extends XFAObject { 52967 constructor(attributes) { 52968 super(TEMPLATE_NS_ID, "manifest", true); 52969 this.action = getStringOption(attributes.action, ["include", "all", "exclude"]); 52970 this.id = attributes.id || ""; 52971 this.name = attributes.name || ""; 52972 this.use = attributes.use || ""; 52973 this.usehref = attributes.usehref || ""; 52974 this.extras = null; 52975 this.ref = new XFAObjectArray(); 52976 } 52977} 52978class Margin extends XFAObject { 52979 constructor(attributes) { 52980 super(TEMPLATE_NS_ID, "margin", true); 52981 this.bottomInset = getMeasurement(attributes.bottomInset, "0"); 52982 this.id = attributes.id || ""; 52983 this.leftInset = getMeasurement(attributes.leftInset, "0"); 52984 this.rightInset = getMeasurement(attributes.rightInset, "0"); 52985 this.topInset = getMeasurement(attributes.topInset, "0"); 52986 this.use = attributes.use || ""; 52987 this.usehref = attributes.usehref || ""; 52988 this.extras = null; 52989 } 52990 [$toStyle]() { 52991 return { 52992 margin: measureToString(this.topInset) + " " + measureToString(this.rightInset) + " " + measureToString(this.bottomInset) + " " + measureToString(this.leftInset) 52993 }; 52994 } 52995} 52996class Mdp extends XFAObject { 52997 constructor(attributes) { 52998 super(TEMPLATE_NS_ID, "mdp"); 52999 this.id = attributes.id || ""; 53000 this.permissions = getInteger({ 53001 data: attributes.permissions, 53002 defaultValue: 2, 53003 validate: x => x === 1 || x === 3 53004 }); 53005 this.signatureType = getStringOption(attributes.signatureType, ["filler", "author"]); 53006 this.use = attributes.use || ""; 53007 this.usehref = attributes.usehref || ""; 53008 } 53009} 53010class Medium extends XFAObject { 53011 constructor(attributes) { 53012 super(TEMPLATE_NS_ID, "medium"); 53013 this.id = attributes.id || ""; 53014 this.imagingBBox = getBBox(attributes.imagingBBox); 53015 this.long = getMeasurement(attributes.long); 53016 this.orientation = getStringOption(attributes.orientation, ["portrait", "landscape"]); 53017 this.short = getMeasurement(attributes.short); 53018 this.stock = attributes.stock || ""; 53019 this.trayIn = getStringOption(attributes.trayIn, ["auto", "delegate", "pageFront"]); 53020 this.trayOut = getStringOption(attributes.trayOut, ["auto", "delegate"]); 53021 this.use = attributes.use || ""; 53022 this.usehref = attributes.usehref || ""; 53023 } 53024} 53025class Message extends XFAObject { 53026 constructor(attributes) { 53027 super(TEMPLATE_NS_ID, "message", true); 53028 this.id = attributes.id || ""; 53029 this.use = attributes.use || ""; 53030 this.usehref = attributes.usehref || ""; 53031 this.text = new XFAObjectArray(); 53032 } 53033} 53034class NumericEdit extends XFAObject { 53035 constructor(attributes) { 53036 super(TEMPLATE_NS_ID, "numericEdit", true); 53037 this.hScrollPolicy = getStringOption(attributes.hScrollPolicy, ["auto", "off", "on"]); 53038 this.id = attributes.id || ""; 53039 this.use = attributes.use || ""; 53040 this.usehref = attributes.usehref || ""; 53041 this.border = null; 53042 this.comb = null; 53043 this.extras = null; 53044 this.margin = null; 53045 } 53046 [$toHTML](availableSpace) { 53047 const style = toStyle(this, "border", "font", "margin"); 53048 const field = this[$getParent]()[$getParent](); 53049 const html = { 53050 name: "input", 53051 attributes: { 53052 type: "text", 53053 fieldId: field[$uid], 53054 dataId: field[$data]?.[$uid] || field[$uid], 53055 class: ["xfaTextfield"], 53056 style, 53057 "aria-label": ariaLabel(field), 53058 "aria-required": false 53059 } 53060 }; 53061 if (isRequired(field)) { 53062 html.attributes["aria-required"] = true; 53063 html.attributes.required = true; 53064 } 53065 return HTMLResult.success({ 53066 name: "label", 53067 attributes: { 53068 class: ["xfaLabel"] 53069 }, 53070 children: [html] 53071 }); 53072 } 53073} 53074class Occur extends XFAObject { 53075 constructor(attributes) { 53076 super(TEMPLATE_NS_ID, "occur", true); 53077 this.id = attributes.id || ""; 53078 this.initial = attributes.initial !== "" ? getInteger({ 53079 data: attributes.initial, 53080 defaultValue: "", 53081 validate: x => true 53082 }) : ""; 53083 this.max = attributes.max !== "" ? getInteger({ 53084 data: attributes.max, 53085 defaultValue: -1, 53086 validate: x => true 53087 }) : ""; 53088 this.min = attributes.min !== "" ? getInteger({ 53089 data: attributes.min, 53090 defaultValue: 1, 53091 validate: x => true 53092 }) : ""; 53093 this.use = attributes.use || ""; 53094 this.usehref = attributes.usehref || ""; 53095 this.extras = null; 53096 } 53097 [$clean]() { 53098 const parent = this[$getParent](); 53099 const originalMin = this.min; 53100 if (this.min === "") { 53101 this.min = parent instanceof PageArea || parent instanceof PageSet ? 0 : 1; 53102 } 53103 if (this.max === "") { 53104 if (originalMin === "") { 53105 this.max = parent instanceof PageArea || parent instanceof PageSet ? -1 : 1; 53106 } else { 53107 this.max = this.min; 53108 } 53109 } 53110 if (this.max !== -1 && this.max < this.min) { 53111 this.max = this.min; 53112 } 53113 if (this.initial === "") { 53114 this.initial = parent instanceof Template ? 1 : this.min; 53115 } 53116 } 53117} 53118class Oid extends StringObject { 53119 constructor(attributes) { 53120 super(TEMPLATE_NS_ID, "oid"); 53121 this.id = attributes.id || ""; 53122 this.name = attributes.name || ""; 53123 this.use = attributes.use || ""; 53124 this.usehref = attributes.usehref || ""; 53125 } 53126} 53127class Oids extends XFAObject { 53128 constructor(attributes) { 53129 super(TEMPLATE_NS_ID, "oids", true); 53130 this.id = attributes.id || ""; 53131 this.type = getStringOption(attributes.type, ["optional", "required"]); 53132 this.use = attributes.use || ""; 53133 this.usehref = attributes.usehref || ""; 53134 this.oid = new XFAObjectArray(); 53135 } 53136} 53137class Overflow extends XFAObject { 53138 constructor(attributes) { 53139 super(TEMPLATE_NS_ID, "overflow"); 53140 this.id = attributes.id || ""; 53141 this.leader = attributes.leader || ""; 53142 this.target = attributes.target || ""; 53143 this.trailer = attributes.trailer || ""; 53144 this.use = attributes.use || ""; 53145 this.usehref = attributes.usehref || ""; 53146 } 53147 [$getExtra]() { 53148 if (!this[$extra]) { 53149 const parent = this[$getParent](); 53150 const root = this[$getTemplateRoot](); 53151 const target = root[$searchNode](this.target, parent); 53152 const leader = root[$searchNode](this.leader, parent); 53153 const trailer = root[$searchNode](this.trailer, parent); 53154 this[$extra] = { 53155 target: target?.[0] || null, 53156 leader: leader?.[0] || null, 53157 trailer: trailer?.[0] || null, 53158 addLeader: false, 53159 addTrailer: false 53160 }; 53161 } 53162 return this[$extra]; 53163 } 53164} 53165class PageArea extends XFAObject { 53166 constructor(attributes) { 53167 super(TEMPLATE_NS_ID, "pageArea", true); 53168 this.blankOrNotBlank = getStringOption(attributes.blankOrNotBlank, ["any", "blank", "notBlank"]); 53169 this.id = attributes.id || ""; 53170 this.initialNumber = getInteger({ 53171 data: attributes.initialNumber, 53172 defaultValue: 1, 53173 validate: x => true 53174 }); 53175 this.name = attributes.name || ""; 53176 this.numbered = getInteger({ 53177 data: attributes.numbered, 53178 defaultValue: 1, 53179 validate: x => true 53180 }); 53181 this.oddOrEven = getStringOption(attributes.oddOrEven, ["any", "even", "odd"]); 53182 this.pagePosition = getStringOption(attributes.pagePosition, ["any", "first", "last", "only", "rest"]); 53183 this.relevant = getRelevant(attributes.relevant); 53184 this.use = attributes.use || ""; 53185 this.usehref = attributes.usehref || ""; 53186 this.desc = null; 53187 this.extras = null; 53188 this.medium = null; 53189 this.occur = null; 53190 this.area = new XFAObjectArray(); 53191 this.contentArea = new XFAObjectArray(); 53192 this.draw = new XFAObjectArray(); 53193 this.exclGroup = new XFAObjectArray(); 53194 this.field = new XFAObjectArray(); 53195 this.subform = new XFAObjectArray(); 53196 } 53197 [$isUsable]() { 53198 if (!this[$extra]) { 53199 this[$extra] = { 53200 numberOfUse: 0 53201 }; 53202 return true; 53203 } 53204 return !this.occur || this.occur.max === -1 || this[$extra].numberOfUse < this.occur.max; 53205 } 53206 [$cleanPage]() { 53207 delete this[$extra]; 53208 } 53209 [$getNextPage]() { 53210 this[$extra] ||= { 53211 numberOfUse: 0 53212 }; 53213 const parent = this[$getParent](); 53214 if (parent.relation === "orderedOccurrence") { 53215 if (this[$isUsable]()) { 53216 this[$extra].numberOfUse += 1; 53217 return this; 53218 } 53219 } 53220 return parent[$getNextPage](); 53221 } 53222 [$getAvailableSpace]() { 53223 return this[$extra].space || { 53224 width: 0, 53225 height: 0 53226 }; 53227 } 53228 [$toHTML]() { 53229 this[$extra] ||= { 53230 numberOfUse: 1 53231 }; 53232 const children = []; 53233 this[$extra].children = children; 53234 const style = Object.create(null); 53235 if (this.medium && this.medium.short && this.medium.long) { 53236 style.width = measureToString(this.medium.short); 53237 style.height = measureToString(this.medium.long); 53238 this[$extra].space = { 53239 width: this.medium.short, 53240 height: this.medium.long 53241 }; 53242 if (this.medium.orientation === "landscape") { 53243 const x = style.width; 53244 style.width = style.height; 53245 style.height = x; 53246 this[$extra].space = { 53247 width: this.medium.long, 53248 height: this.medium.short 53249 }; 53250 } 53251 } else { 53252 warn("XFA - No medium specified in pageArea: please file a bug."); 53253 } 53254 this[$childrenToHTML]({ 53255 filter: new Set(["area", "draw", "field", "subform"]), 53256 include: true 53257 }); 53258 this[$childrenToHTML]({ 53259 filter: new Set(["contentArea"]), 53260 include: true 53261 }); 53262 return HTMLResult.success({ 53263 name: "div", 53264 children, 53265 attributes: { 53266 class: ["xfaPage"], 53267 id: this[$uid], 53268 style, 53269 xfaName: this.name 53270 } 53271 }); 53272 } 53273} 53274class PageSet extends XFAObject { 53275 constructor(attributes) { 53276 super(TEMPLATE_NS_ID, "pageSet", true); 53277 this.duplexImposition = getStringOption(attributes.duplexImposition, ["longEdge", "shortEdge"]); 53278 this.id = attributes.id || ""; 53279 this.name = attributes.name || ""; 53280 this.relation = getStringOption(attributes.relation, ["orderedOccurrence", "duplexPaginated", "simplexPaginated"]); 53281 this.relevant = getRelevant(attributes.relevant); 53282 this.use = attributes.use || ""; 53283 this.usehref = attributes.usehref || ""; 53284 this.extras = null; 53285 this.occur = null; 53286 this.pageArea = new XFAObjectArray(); 53287 this.pageSet = new XFAObjectArray(); 53288 } 53289 [$cleanPage]() { 53290 for (const page of this.pageArea.children) { 53291 page[$cleanPage](); 53292 } 53293 for (const page of this.pageSet.children) { 53294 page[$cleanPage](); 53295 } 53296 } 53297 [$isUsable]() { 53298 return !this.occur || this.occur.max === -1 || this[$extra].numberOfUse < this.occur.max; 53299 } 53300 [$getNextPage]() { 53301 this[$extra] ||= { 53302 numberOfUse: 1, 53303 pageIndex: -1, 53304 pageSetIndex: -1 53305 }; 53306 if (this.relation === "orderedOccurrence") { 53307 if (this[$extra].pageIndex + 1 < this.pageArea.children.length) { 53308 this[$extra].pageIndex += 1; 53309 const pageArea = this.pageArea.children[this[$extra].pageIndex]; 53310 return pageArea[$getNextPage](); 53311 } 53312 if (this[$extra].pageSetIndex + 1 < this.pageSet.children.length) { 53313 this[$extra].pageSetIndex += 1; 53314 return this.pageSet.children[this[$extra].pageSetIndex][$getNextPage](); 53315 } 53316 if (this[$isUsable]()) { 53317 this[$extra].numberOfUse += 1; 53318 this[$extra].pageIndex = -1; 53319 this[$extra].pageSetIndex = -1; 53320 return this[$getNextPage](); 53321 } 53322 const parent = this[$getParent](); 53323 if (parent instanceof PageSet) { 53324 return parent[$getNextPage](); 53325 } 53326 this[$cleanPage](); 53327 return this[$getNextPage](); 53328 } 53329 const pageNumber = this[$getTemplateRoot]()[$extra].pageNumber; 53330 const parity = pageNumber % 2 === 0 ? "even" : "odd"; 53331 const position = pageNumber === 0 ? "first" : "rest"; 53332 let page = this.pageArea.children.find(p => p.oddOrEven === parity && p.pagePosition === position); 53333 if (page) { 53334 return page; 53335 } 53336 page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === position); 53337 if (page) { 53338 return page; 53339 } 53340 page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === "any"); 53341 if (page) { 53342 return page; 53343 } 53344 return this.pageArea.children[0]; 53345 } 53346} 53347class Para extends XFAObject { 53348 constructor(attributes) { 53349 super(TEMPLATE_NS_ID, "para", true); 53350 this.hAlign = getStringOption(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]); 53351 this.id = attributes.id || ""; 53352 this.lineHeight = attributes.lineHeight ? getMeasurement(attributes.lineHeight, "0pt") : ""; 53353 this.marginLeft = attributes.marginLeft ? getMeasurement(attributes.marginLeft, "0pt") : ""; 53354 this.marginRight = attributes.marginRight ? getMeasurement(attributes.marginRight, "0pt") : ""; 53355 this.orphans = getInteger({ 53356 data: attributes.orphans, 53357 defaultValue: 0, 53358 validate: x => x >= 0 53359 }); 53360 this.preserve = attributes.preserve || ""; 53361 this.radixOffset = attributes.radixOffset ? getMeasurement(attributes.radixOffset, "0pt") : ""; 53362 this.spaceAbove = attributes.spaceAbove ? getMeasurement(attributes.spaceAbove, "0pt") : ""; 53363 this.spaceBelow = attributes.spaceBelow ? getMeasurement(attributes.spaceBelow, "0pt") : ""; 53364 this.tabDefault = attributes.tabDefault ? getMeasurement(this.tabDefault) : ""; 53365 this.tabStops = (attributes.tabStops || "").trim().split(/\s+/).map((x, i) => i % 2 === 1 ? getMeasurement(x) : x); 53366 this.textIndent = attributes.textIndent ? getMeasurement(attributes.textIndent, "0pt") : ""; 53367 this.use = attributes.use || ""; 53368 this.usehref = attributes.usehref || ""; 53369 this.vAlign = getStringOption(attributes.vAlign, ["top", "bottom", "middle"]); 53370 this.widows = getInteger({ 53371 data: attributes.widows, 53372 defaultValue: 0, 53373 validate: x => x >= 0 53374 }); 53375 this.hyphenation = null; 53376 } 53377 [$toStyle]() { 53378 const style = toStyle(this, "hAlign"); 53379 if (this.marginLeft !== "") { 53380 style.paddingLeft = measureToString(this.marginLeft); 53381 } 53382 if (this.marginRight !== "") { 53383 style.paddingRight = measureToString(this.marginRight); 53384 } 53385 if (this.spaceAbove !== "") { 53386 style.paddingTop = measureToString(this.spaceAbove); 53387 } 53388 if (this.spaceBelow !== "") { 53389 style.paddingBottom = measureToString(this.spaceBelow); 53390 } 53391 if (this.textIndent !== "") { 53392 style.textIndent = measureToString(this.textIndent); 53393 fixTextIndent(style); 53394 } 53395 if (this.lineHeight > 0) { 53396 style.lineHeight = measureToString(this.lineHeight); 53397 } 53398 if (this.tabDefault !== "") { 53399 style.tabSize = measureToString(this.tabDefault); 53400 } 53401 if (this.tabStops.length > 0) {} 53402 if (this.hyphenatation) { 53403 Object.assign(style, this.hyphenatation[$toStyle]()); 53404 } 53405 return style; 53406 } 53407} 53408class PasswordEdit extends XFAObject { 53409 constructor(attributes) { 53410 super(TEMPLATE_NS_ID, "passwordEdit", true); 53411 this.hScrollPolicy = getStringOption(attributes.hScrollPolicy, ["auto", "off", "on"]); 53412 this.id = attributes.id || ""; 53413 this.passwordChar = attributes.passwordChar || "*"; 53414 this.use = attributes.use || ""; 53415 this.usehref = attributes.usehref || ""; 53416 this.border = null; 53417 this.extras = null; 53418 this.margin = null; 53419 } 53420} 53421class template_Pattern extends XFAObject { 53422 constructor(attributes) { 53423 super(TEMPLATE_NS_ID, "pattern", true); 53424 this.id = attributes.id || ""; 53425 this.type = getStringOption(attributes.type, ["crossHatch", "crossDiagonal", "diagonalLeft", "diagonalRight", "horizontal", "vertical"]); 53426 this.use = attributes.use || ""; 53427 this.usehref = attributes.usehref || ""; 53428 this.color = null; 53429 this.extras = null; 53430 } 53431 [$toStyle](startColor) { 53432 startColor = startColor ? startColor[$toStyle]() : "#FFFFFF"; 53433 const endColor = this.color ? this.color[$toStyle]() : "#000000"; 53434 const width = 5; 53435 const cmd = "repeating-linear-gradient"; 53436 const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${2 * width}px`; 53437 switch (this.type) { 53438 case "crossHatch": 53439 return `${cmd}(to top,${colors}) ${cmd}(to right,${colors})`; 53440 case "crossDiagonal": 53441 return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`; 53442 case "diagonalLeft": 53443 return `${cmd}(45deg,${colors})`; 53444 case "diagonalRight": 53445 return `${cmd}(-45deg,${colors})`; 53446 case "horizontal": 53447 return `${cmd}(to top,${colors})`; 53448 case "vertical": 53449 return `${cmd}(to right,${colors})`; 53450 } 53451 return ""; 53452 } 53453} 53454class Picture extends StringObject { 53455 constructor(attributes) { 53456 super(TEMPLATE_NS_ID, "picture"); 53457 this.id = attributes.id || ""; 53458 this.use = attributes.use || ""; 53459 this.usehref = attributes.usehref || ""; 53460 } 53461} 53462class Proto extends XFAObject { 53463 constructor(attributes) { 53464 super(TEMPLATE_NS_ID, "proto", true); 53465 this.appearanceFilter = new XFAObjectArray(); 53466 this.arc = new XFAObjectArray(); 53467 this.area = new XFAObjectArray(); 53468 this.assist = new XFAObjectArray(); 53469 this.barcode = new XFAObjectArray(); 53470 this.bindItems = new XFAObjectArray(); 53471 this.bookend = new XFAObjectArray(); 53472 this.boolean = new XFAObjectArray(); 53473 this.border = new XFAObjectArray(); 53474 this.break = new XFAObjectArray(); 53475 this.breakAfter = new XFAObjectArray(); 53476 this.breakBefore = new XFAObjectArray(); 53477 this.button = new XFAObjectArray(); 53478 this.calculate = new XFAObjectArray(); 53479 this.caption = new XFAObjectArray(); 53480 this.certificate = new XFAObjectArray(); 53481 this.certificates = new XFAObjectArray(); 53482 this.checkButton = new XFAObjectArray(); 53483 this.choiceList = new XFAObjectArray(); 53484 this.color = new XFAObjectArray(); 53485 this.comb = new XFAObjectArray(); 53486 this.connect = new XFAObjectArray(); 53487 this.contentArea = new XFAObjectArray(); 53488 this.corner = new XFAObjectArray(); 53489 this.date = new XFAObjectArray(); 53490 this.dateTime = new XFAObjectArray(); 53491 this.dateTimeEdit = new XFAObjectArray(); 53492 this.decimal = new XFAObjectArray(); 53493 this.defaultUi = new XFAObjectArray(); 53494 this.desc = new XFAObjectArray(); 53495 this.digestMethod = new XFAObjectArray(); 53496 this.digestMethods = new XFAObjectArray(); 53497 this.draw = new XFAObjectArray(); 53498 this.edge = new XFAObjectArray(); 53499 this.encoding = new XFAObjectArray(); 53500 this.encodings = new XFAObjectArray(); 53501 this.encrypt = new XFAObjectArray(); 53502 this.encryptData = new XFAObjectArray(); 53503 this.encryption = new XFAObjectArray(); 53504 this.encryptionMethod = new XFAObjectArray(); 53505 this.encryptionMethods = new XFAObjectArray(); 53506 this.event = new XFAObjectArray(); 53507 this.exData = new XFAObjectArray(); 53508 this.exObject = new XFAObjectArray(); 53509 this.exclGroup = new XFAObjectArray(); 53510 this.execute = new XFAObjectArray(); 53511 this.extras = new XFAObjectArray(); 53512 this.field = new XFAObjectArray(); 53513 this.fill = new XFAObjectArray(); 53514 this.filter = new XFAObjectArray(); 53515 this.float = new XFAObjectArray(); 53516 this.font = new XFAObjectArray(); 53517 this.format = new XFAObjectArray(); 53518 this.handler = new XFAObjectArray(); 53519 this.hyphenation = new XFAObjectArray(); 53520 this.image = new XFAObjectArray(); 53521 this.imageEdit = new XFAObjectArray(); 53522 this.integer = new XFAObjectArray(); 53523 this.issuers = new XFAObjectArray(); 53524 this.items = new XFAObjectArray(); 53525 this.keep = new XFAObjectArray(); 53526 this.keyUsage = new XFAObjectArray(); 53527 this.line = new XFAObjectArray(); 53528 this.linear = new XFAObjectArray(); 53529 this.lockDocument = new XFAObjectArray(); 53530 this.manifest = new XFAObjectArray(); 53531 this.margin = new XFAObjectArray(); 53532 this.mdp = new XFAObjectArray(); 53533 this.medium = new XFAObjectArray(); 53534 this.message = new XFAObjectArray(); 53535 this.numericEdit = new XFAObjectArray(); 53536 this.occur = new XFAObjectArray(); 53537 this.oid = new XFAObjectArray(); 53538 this.oids = new XFAObjectArray(); 53539 this.overflow = new XFAObjectArray(); 53540 this.pageArea = new XFAObjectArray(); 53541 this.pageSet = new XFAObjectArray(); 53542 this.para = new XFAObjectArray(); 53543 this.passwordEdit = new XFAObjectArray(); 53544 this.pattern = new XFAObjectArray(); 53545 this.picture = new XFAObjectArray(); 53546 this.radial = new XFAObjectArray(); 53547 this.reason = new XFAObjectArray(); 53548 this.reasons = new XFAObjectArray(); 53549 this.rectangle = new XFAObjectArray(); 53550 this.ref = new XFAObjectArray(); 53551 this.script = new XFAObjectArray(); 53552 this.setProperty = new XFAObjectArray(); 53553 this.signData = new XFAObjectArray(); 53554 this.signature = new XFAObjectArray(); 53555 this.signing = new XFAObjectArray(); 53556 this.solid = new XFAObjectArray(); 53557 this.speak = new XFAObjectArray(); 53558 this.stipple = new XFAObjectArray(); 53559 this.subform = new XFAObjectArray(); 53560 this.subformSet = new XFAObjectArray(); 53561 this.subjectDN = new XFAObjectArray(); 53562 this.subjectDNs = new XFAObjectArray(); 53563 this.submit = new XFAObjectArray(); 53564 this.text = new XFAObjectArray(); 53565 this.textEdit = new XFAObjectArray(); 53566 this.time = new XFAObjectArray(); 53567 this.timeStamp = new XFAObjectArray(); 53568 this.toolTip = new XFAObjectArray(); 53569 this.traversal = new XFAObjectArray(); 53570 this.traverse = new XFAObjectArray(); 53571 this.ui = new XFAObjectArray(); 53572 this.validate = new XFAObjectArray(); 53573 this.value = new XFAObjectArray(); 53574 this.variables = new XFAObjectArray(); 53575 } 53576} 53577class Radial extends XFAObject { 53578 constructor(attributes) { 53579 super(TEMPLATE_NS_ID, "radial", true); 53580 this.id = attributes.id || ""; 53581 this.type = getStringOption(attributes.type, ["toEdge", "toCenter"]); 53582 this.use = attributes.use || ""; 53583 this.usehref = attributes.usehref || ""; 53584 this.color = null; 53585 this.extras = null; 53586 } 53587 [$toStyle](startColor) { 53588 startColor = startColor ? startColor[$toStyle]() : "#FFFFFF"; 53589 const endColor = this.color ? this.color[$toStyle]() : "#000000"; 53590 const colors = this.type === "toEdge" ? `${startColor},${endColor}` : `${endColor},${startColor}`; 53591 return `radial-gradient(circle at center, ${colors})`; 53592 } 53593} 53594class Reason extends StringObject { 53595 constructor(attributes) { 53596 super(TEMPLATE_NS_ID, "reason"); 53597 this.id = attributes.id || ""; 53598 this.name = attributes.name || ""; 53599 this.use = attributes.use || ""; 53600 this.usehref = attributes.usehref || ""; 53601 } 53602} 53603class Reasons extends XFAObject { 53604 constructor(attributes) { 53605 super(TEMPLATE_NS_ID, "reasons", true); 53606 this.id = attributes.id || ""; 53607 this.type = getStringOption(attributes.type, ["optional", "required"]); 53608 this.use = attributes.use || ""; 53609 this.usehref = attributes.usehref || ""; 53610 this.reason = new XFAObjectArray(); 53611 } 53612} 53613class Rectangle extends XFAObject { 53614 constructor(attributes) { 53615 super(TEMPLATE_NS_ID, "rectangle", true); 53616 this.hand = getStringOption(attributes.hand, ["even", "left", "right"]); 53617 this.id = attributes.id || ""; 53618 this.use = attributes.use || ""; 53619 this.usehref = attributes.usehref || ""; 53620 this.corner = new XFAObjectArray(4); 53621 this.edge = new XFAObjectArray(4); 53622 this.fill = null; 53623 } 53624 [$toHTML]() { 53625 const edge = this.edge.children.length ? this.edge.children[0] : new Edge({}); 53626 const edgeStyle = edge[$toStyle](); 53627 const style = Object.create(null); 53628 if (this.fill?.presence === "visible") { 53629 Object.assign(style, this.fill[$toStyle]()); 53630 } else { 53631 style.fill = "transparent"; 53632 } 53633 style.strokeWidth = measureToString(edge.presence === "visible" ? edge.thickness : 0); 53634 style.stroke = edgeStyle.color; 53635 const corner = this.corner.children.length ? this.corner.children[0] : new Corner({}); 53636 const cornerStyle = corner[$toStyle](); 53637 const rect = { 53638 name: "rect", 53639 attributes: { 53640 xmlns: SVG_NS, 53641 width: "100%", 53642 height: "100%", 53643 x: 0, 53644 y: 0, 53645 rx: cornerStyle.radius, 53646 ry: cornerStyle.radius, 53647 style 53648 } 53649 }; 53650 const svg = { 53651 name: "svg", 53652 children: [rect], 53653 attributes: { 53654 xmlns: SVG_NS, 53655 style: { 53656 overflow: "visible" 53657 }, 53658 width: "100%", 53659 height: "100%" 53660 } 53661 }; 53662 const parent = this[$getParent]()[$getParent](); 53663 if (hasMargin(parent)) { 53664 return HTMLResult.success({ 53665 name: "div", 53666 attributes: { 53667 style: { 53668 display: "inline", 53669 width: "100%", 53670 height: "100%" 53671 } 53672 }, 53673 children: [svg] 53674 }); 53675 } 53676 svg.attributes.style.position = "absolute"; 53677 return HTMLResult.success(svg); 53678 } 53679} 53680class RefElement extends StringObject { 53681 constructor(attributes) { 53682 super(TEMPLATE_NS_ID, "ref"); 53683 this.id = attributes.id || ""; 53684 this.use = attributes.use || ""; 53685 this.usehref = attributes.usehref || ""; 53686 } 53687} 53688class Script extends StringObject { 53689 constructor(attributes) { 53690 super(TEMPLATE_NS_ID, "script"); 53691 this.binding = attributes.binding || ""; 53692 this.contentType = attributes.contentType || ""; 53693 this.id = attributes.id || ""; 53694 this.name = attributes.name || ""; 53695 this.runAt = getStringOption(attributes.runAt, ["client", "both", "server"]); 53696 this.use = attributes.use || ""; 53697 this.usehref = attributes.usehref || ""; 53698 } 53699} 53700class SetProperty extends XFAObject { 53701 constructor(attributes) { 53702 super(TEMPLATE_NS_ID, "setProperty"); 53703 this.connection = attributes.connection || ""; 53704 this.ref = attributes.ref || ""; 53705 this.target = attributes.target || ""; 53706 } 53707} 53708class SignData extends XFAObject { 53709 constructor(attributes) { 53710 super(TEMPLATE_NS_ID, "signData", true); 53711 this.id = attributes.id || ""; 53712 this.operation = getStringOption(attributes.operation, ["sign", "clear", "verify"]); 53713 this.ref = attributes.ref || ""; 53714 this.target = attributes.target || ""; 53715 this.use = attributes.use || ""; 53716 this.usehref = attributes.usehref || ""; 53717 this.filter = null; 53718 this.manifest = null; 53719 } 53720} 53721class Signature extends XFAObject { 53722 constructor(attributes) { 53723 super(TEMPLATE_NS_ID, "signature", true); 53724 this.id = attributes.id || ""; 53725 this.type = getStringOption(attributes.type, ["PDF1.3", "PDF1.6"]); 53726 this.use = attributes.use || ""; 53727 this.usehref = attributes.usehref || ""; 53728 this.border = null; 53729 this.extras = null; 53730 this.filter = null; 53731 this.manifest = null; 53732 this.margin = null; 53733 } 53734} 53735class Signing extends XFAObject { 53736 constructor(attributes) { 53737 super(TEMPLATE_NS_ID, "signing", true); 53738 this.id = attributes.id || ""; 53739 this.type = getStringOption(attributes.type, ["optional", "required"]); 53740 this.use = attributes.use || ""; 53741 this.usehref = attributes.usehref || ""; 53742 this.certificate = new XFAObjectArray(); 53743 } 53744} 53745class Solid extends XFAObject { 53746 constructor(attributes) { 53747 super(TEMPLATE_NS_ID, "solid", true); 53748 this.id = attributes.id || ""; 53749 this.use = attributes.use || ""; 53750 this.usehref = attributes.usehref || ""; 53751 this.extras = null; 53752 } 53753 [$toStyle](startColor) { 53754 return startColor ? startColor[$toStyle]() : "#FFFFFF"; 53755 } 53756} 53757class Speak extends StringObject { 53758 constructor(attributes) { 53759 super(TEMPLATE_NS_ID, "speak"); 53760 this.disable = getInteger({ 53761 data: attributes.disable, 53762 defaultValue: 0, 53763 validate: x => x === 1 53764 }); 53765 this.id = attributes.id || ""; 53766 this.priority = getStringOption(attributes.priority, ["custom", "caption", "name", "toolTip"]); 53767 this.rid = attributes.rid || ""; 53768 this.use = attributes.use || ""; 53769 this.usehref = attributes.usehref || ""; 53770 } 53771} 53772class Stipple extends XFAObject { 53773 constructor(attributes) { 53774 super(TEMPLATE_NS_ID, "stipple", true); 53775 this.id = attributes.id || ""; 53776 this.rate = getInteger({ 53777 data: attributes.rate, 53778 defaultValue: 50, 53779 validate: x => x >= 0 && x <= 100 53780 }); 53781 this.use = attributes.use || ""; 53782 this.usehref = attributes.usehref || ""; 53783 this.color = null; 53784 this.extras = null; 53785 } 53786 [$toStyle](bgColor) { 53787 const alpha = this.rate / 100; 53788 return Util.makeHexColor(Math.round(bgColor.value.r * (1 - alpha) + this.value.r * alpha), Math.round(bgColor.value.g * (1 - alpha) + this.value.g * alpha), Math.round(bgColor.value.b * (1 - alpha) + this.value.b * alpha)); 53789 } 53790} 53791class Subform extends XFAObject { 53792 constructor(attributes) { 53793 super(TEMPLATE_NS_ID, "subform", true); 53794 this.access = getStringOption(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]); 53795 this.allowMacro = getInteger({ 53796 data: attributes.allowMacro, 53797 defaultValue: 0, 53798 validate: x => x === 1 53799 }); 53800 this.anchorType = getStringOption(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]); 53801 this.colSpan = getInteger({ 53802 data: attributes.colSpan, 53803 defaultValue: 1, 53804 validate: n => n >= 1 || n === -1 53805 }); 53806 this.columnWidths = (attributes.columnWidths || "").trim().split(/\s+/).map(x => x === "-1" ? -1 : getMeasurement(x)); 53807 this.h = attributes.h ? getMeasurement(attributes.h) : ""; 53808 this.hAlign = getStringOption(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]); 53809 this.id = attributes.id || ""; 53810 this.layout = getStringOption(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]); 53811 this.locale = attributes.locale || ""; 53812 this.maxH = getMeasurement(attributes.maxH, "0pt"); 53813 this.maxW = getMeasurement(attributes.maxW, "0pt"); 53814 this.mergeMode = getStringOption(attributes.mergeMode, ["consumeData", "matchTemplate"]); 53815 this.minH = getMeasurement(attributes.minH, "0pt"); 53816 this.minW = getMeasurement(attributes.minW, "0pt"); 53817 this.name = attributes.name || ""; 53818 this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]); 53819 this.relevant = getRelevant(attributes.relevant); 53820 this.restoreState = getStringOption(attributes.restoreState, ["manual", "auto"]); 53821 this.scope = getStringOption(attributes.scope, ["name", "none"]); 53822 this.use = attributes.use || ""; 53823 this.usehref = attributes.usehref || ""; 53824 this.w = attributes.w ? getMeasurement(attributes.w) : ""; 53825 this.x = getMeasurement(attributes.x, "0pt"); 53826 this.y = getMeasurement(attributes.y, "0pt"); 53827 this.assist = null; 53828 this.bind = null; 53829 this.bookend = null; 53830 this.border = null; 53831 this.break = null; 53832 this.calculate = null; 53833 this.desc = null; 53834 this.extras = null; 53835 this.keep = null; 53836 this.margin = null; 53837 this.occur = null; 53838 this.overflow = null; 53839 this.pageSet = null; 53840 this.para = null; 53841 this.traversal = null; 53842 this.validate = null; 53843 this.variables = null; 53844 this.area = new XFAObjectArray(); 53845 this.breakAfter = new XFAObjectArray(); 53846 this.breakBefore = new XFAObjectArray(); 53847 this.connect = new XFAObjectArray(); 53848 this.draw = new XFAObjectArray(); 53849 this.event = new XFAObjectArray(); 53850 this.exObject = new XFAObjectArray(); 53851 this.exclGroup = new XFAObjectArray(); 53852 this.field = new XFAObjectArray(); 53853 this.proto = new XFAObjectArray(); 53854 this.setProperty = new XFAObjectArray(); 53855 this.subform = new XFAObjectArray(); 53856 this.subformSet = new XFAObjectArray(); 53857 } 53858 [$getSubformParent]() { 53859 const parent = this[$getParent](); 53860 if (parent instanceof SubformSet) { 53861 return parent[$getSubformParent](); 53862 } 53863 return parent; 53864 } 53865 [$isBindable]() { 53866 return true; 53867 } 53868 [$isThereMoreWidth]() { 53869 return this.layout.endsWith("-tb") && this[$extra].attempt === 0 && this[$extra].numberInLine > 0 || this[$getParent]()[$isThereMoreWidth](); 53870 } 53871 *[$getContainedChildren]() { 53872 yield* getContainedChildren(this); 53873 } 53874 [$flushHTML]() { 53875 return flushHTML(this); 53876 } 53877 [$addHTML](html, bbox) { 53878 addHTML(this, html, bbox); 53879 } 53880 [$getAvailableSpace]() { 53881 return getAvailableSpace(this); 53882 } 53883 [$isSplittable]() { 53884 const parent = this[$getSubformParent](); 53885 if (!parent[$isSplittable]()) { 53886 return false; 53887 } 53888 if (this[$extra]._isSplittable !== undefined) { 53889 return this[$extra]._isSplittable; 53890 } 53891 if (this.layout === "position" || this.layout.includes("row")) { 53892 this[$extra]._isSplittable = false; 53893 return false; 53894 } 53895 if (this.keep && this.keep.intact !== "none") { 53896 this[$extra]._isSplittable = false; 53897 return false; 53898 } 53899 if (parent.layout?.endsWith("-tb") && parent[$extra].numberInLine !== 0) { 53900 return false; 53901 } 53902 this[$extra]._isSplittable = true; 53903 return true; 53904 } 53905 [$toHTML](availableSpace) { 53906 setTabIndex(this); 53907 if (this.break) { 53908 if (this.break.after !== "auto" || this.break.afterTarget !== "") { 53909 const node = new BreakAfter({ 53910 targetType: this.break.after, 53911 target: this.break.afterTarget, 53912 startNew: this.break.startNew.toString() 53913 }); 53914 node[$globalData] = this[$globalData]; 53915 this[$appendChild](node); 53916 this.breakAfter.push(node); 53917 } 53918 if (this.break.before !== "auto" || this.break.beforeTarget !== "") { 53919 const node = new BreakBefore({ 53920 targetType: this.break.before, 53921 target: this.break.beforeTarget, 53922 startNew: this.break.startNew.toString() 53923 }); 53924 node[$globalData] = this[$globalData]; 53925 this[$appendChild](node); 53926 this.breakBefore.push(node); 53927 } 53928 if (this.break.overflowTarget !== "") { 53929 const node = new Overflow({ 53930 target: this.break.overflowTarget, 53931 leader: this.break.overflowLeader, 53932 trailer: this.break.overflowTrailer 53933 }); 53934 node[$globalData] = this[$globalData]; 53935 this[$appendChild](node); 53936 this.overflow.push(node); 53937 } 53938 this[$removeChild](this.break); 53939 this.break = null; 53940 } 53941 if (this.presence === "hidden" || this.presence === "inactive") { 53942 return HTMLResult.EMPTY; 53943 } 53944 if (this.breakBefore.children.length > 1 || this.breakAfter.children.length > 1) { 53945 warn("XFA - Several breakBefore or breakAfter in subforms: please file a bug."); 53946 } 53947 if (this.breakBefore.children.length >= 1) { 53948 const breakBefore = this.breakBefore.children[0]; 53949 if (handleBreak(breakBefore)) { 53950 return HTMLResult.breakNode(breakBefore); 53951 } 53952 } 53953 if (this[$extra]?.afterBreakAfter) { 53954 return HTMLResult.EMPTY; 53955 } 53956 fixDimensions(this); 53957 const children = []; 53958 const attributes = { 53959 id: this[$uid], 53960 class: [] 53961 }; 53962 setAccess(this, attributes.class); 53963 this[$extra] ||= Object.create(null); 53964 Object.assign(this[$extra], { 53965 children, 53966 line: null, 53967 attributes, 53968 attempt: 0, 53969 numberInLine: 0, 53970 availableSpace: { 53971 width: Math.min(this.w || Infinity, availableSpace.width), 53972 height: Math.min(this.h || Infinity, availableSpace.height) 53973 }, 53974 width: 0, 53975 height: 0, 53976 prevHeight: 0, 53977 currentWidth: 0 53978 }); 53979 const root = this[$getTemplateRoot](); 53980 const savedNoLayoutFailure = root[$extra].noLayoutFailure; 53981 const isSplittable = this[$isSplittable](); 53982 if (!isSplittable) { 53983 setFirstUnsplittable(this); 53984 } 53985 if (!checkDimensions(this, availableSpace)) { 53986 return HTMLResult.FAILURE; 53987 } 53988 const filter = new Set(["area", "draw", "exclGroup", "field", "subform", "subformSet"]); 53989 if (this.layout.includes("row")) { 53990 const columnWidths = this[$getSubformParent]().columnWidths; 53991 if (Array.isArray(columnWidths) && columnWidths.length > 0) { 53992 this[$extra].columnWidths = columnWidths; 53993 this[$extra].currentColumn = 0; 53994 } 53995 } 53996 const style = toStyle(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign"); 53997 const classNames = ["xfaSubform"]; 53998 const cl = layoutClass(this); 53999 if (cl) { 54000 classNames.push(cl); 54001 } 54002 attributes.style = style; 54003 attributes.class = classNames; 54004 if (this.name) { 54005 attributes.xfaName = this.name; 54006 } 54007 if (this.overflow) { 54008 const overflowExtra = this.overflow[$getExtra](); 54009 if (overflowExtra.addLeader) { 54010 overflowExtra.addLeader = false; 54011 handleOverflow(this, overflowExtra.leader, availableSpace); 54012 } 54013 } 54014 this[$pushPara](); 54015 const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb"; 54016 const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1; 54017 for (; this[$extra].attempt < maxRun; this[$extra].attempt++) { 54018 if (isLrTb && this[$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) { 54019 this[$extra].numberInLine = 0; 54020 } 54021 const result = this[$childrenToHTML]({ 54022 filter, 54023 include: true 54024 }); 54025 if (result.success) { 54026 break; 54027 } 54028 if (result.isBreak()) { 54029 this[$popPara](); 54030 return result; 54031 } 54032 if (isLrTb && this[$extra].attempt === 0 && this[$extra].numberInLine === 0 && !root[$extra].noLayoutFailure) { 54033 this[$extra].attempt = maxRun; 54034 break; 54035 } 54036 } 54037 this[$popPara](); 54038 if (!isSplittable) { 54039 unsetFirstUnsplittable(this); 54040 } 54041 root[$extra].noLayoutFailure = savedNoLayoutFailure; 54042 if (this[$extra].attempt === maxRun) { 54043 if (this.overflow) { 54044 this[$getTemplateRoot]()[$extra].overflowNode = this.overflow; 54045 } 54046 if (!isSplittable) { 54047 delete this[$extra]; 54048 } 54049 return HTMLResult.FAILURE; 54050 } 54051 if (this.overflow) { 54052 const overflowExtra = this.overflow[$getExtra](); 54053 if (overflowExtra.addTrailer) { 54054 overflowExtra.addTrailer = false; 54055 handleOverflow(this, overflowExtra.trailer, availableSpace); 54056 } 54057 } 54058 let marginH = 0; 54059 let marginV = 0; 54060 if (this.margin) { 54061 marginH = this.margin.leftInset + this.margin.rightInset; 54062 marginV = this.margin.topInset + this.margin.bottomInset; 54063 } 54064 const width = Math.max(this[$extra].width + marginH, this.w || 0); 54065 const height = Math.max(this[$extra].height + marginV, this.h || 0); 54066 const bbox = [this.x, this.y, width, height]; 54067 if (this.w === "") { 54068 style.width = measureToString(width); 54069 } 54070 if (this.h === "") { 54071 style.height = measureToString(height); 54072 } 54073 if ((style.width === "0px" || style.height === "0px") && children.length === 0) { 54074 return HTMLResult.EMPTY; 54075 } 54076 const html = { 54077 name: "div", 54078 attributes, 54079 children 54080 }; 54081 applyAssist(this, attributes); 54082 const result = HTMLResult.success(createWrapper(this, html), bbox); 54083 if (this.breakAfter.children.length >= 1) { 54084 const breakAfter = this.breakAfter.children[0]; 54085 if (handleBreak(breakAfter)) { 54086 this[$extra].afterBreakAfter = result; 54087 return HTMLResult.breakNode(breakAfter); 54088 } 54089 } 54090 delete this[$extra]; 54091 return result; 54092 } 54093} 54094class SubformSet extends XFAObject { 54095 constructor(attributes) { 54096 super(TEMPLATE_NS_ID, "subformSet", true); 54097 this.id = attributes.id || ""; 54098 this.name = attributes.name || ""; 54099 this.relation = getStringOption(attributes.relation, ["ordered", "choice", "unordered"]); 54100 this.relevant = getRelevant(attributes.relevant); 54101 this.use = attributes.use || ""; 54102 this.usehref = attributes.usehref || ""; 54103 this.bookend = null; 54104 this.break = null; 54105 this.desc = null; 54106 this.extras = null; 54107 this.occur = null; 54108 this.overflow = null; 54109 this.breakAfter = new XFAObjectArray(); 54110 this.breakBefore = new XFAObjectArray(); 54111 this.subform = new XFAObjectArray(); 54112 this.subformSet = new XFAObjectArray(); 54113 } 54114 *[$getContainedChildren]() { 54115 yield* getContainedChildren(this); 54116 } 54117 [$getSubformParent]() { 54118 let parent = this[$getParent](); 54119 while (!(parent instanceof Subform)) { 54120 parent = parent[$getParent](); 54121 } 54122 return parent; 54123 } 54124 [$isBindable]() { 54125 return true; 54126 } 54127} 54128class SubjectDN extends ContentObject { 54129 constructor(attributes) { 54130 super(TEMPLATE_NS_ID, "subjectDN"); 54131 this.delimiter = attributes.delimiter || ","; 54132 this.id = attributes.id || ""; 54133 this.name = attributes.name || ""; 54134 this.use = attributes.use || ""; 54135 this.usehref = attributes.usehref || ""; 54136 } 54137 [$finalize]() { 54138 this[$content] = new Map(this[$content].split(this.delimiter).map(kv => { 54139 kv = kv.split("=", 2); 54140 kv[0] = kv[0].trim(); 54141 return kv; 54142 })); 54143 } 54144} 54145class SubjectDNs extends XFAObject { 54146 constructor(attributes) { 54147 super(TEMPLATE_NS_ID, "subjectDNs", true); 54148 this.id = attributes.id || ""; 54149 this.type = getStringOption(attributes.type, ["optional", "required"]); 54150 this.use = attributes.use || ""; 54151 this.usehref = attributes.usehref || ""; 54152 this.subjectDN = new XFAObjectArray(); 54153 } 54154} 54155class Submit extends XFAObject { 54156 constructor(attributes) { 54157 super(TEMPLATE_NS_ID, "submit", true); 54158 this.embedPDF = getInteger({ 54159 data: attributes.embedPDF, 54160 defaultValue: 0, 54161 validate: x => x === 1 54162 }); 54163 this.format = getStringOption(attributes.format, ["xdp", "formdata", "pdf", "urlencoded", "xfd", "xml"]); 54164 this.id = attributes.id || ""; 54165 this.target = attributes.target || ""; 54166 this.textEncoding = getKeyword({ 54167 data: attributes.textEncoding ? attributes.textEncoding.toLowerCase() : "", 54168 defaultValue: "", 54169 validate: k => ["utf-8", "big-five", "fontspecific", "gbk", "gb-18030", "gb-2312", "ksc-5601", "none", "shift-jis", "ucs-2", "utf-16"].includes(k) || k.match(/iso-8859-\d{2}/) 54170 }); 54171 this.use = attributes.use || ""; 54172 this.usehref = attributes.usehref || ""; 54173 this.xdpContent = attributes.xdpContent || ""; 54174 this.encrypt = null; 54175 this.encryptData = new XFAObjectArray(); 54176 this.signData = new XFAObjectArray(); 54177 } 54178} 54179class Template extends XFAObject { 54180 constructor(attributes) { 54181 super(TEMPLATE_NS_ID, "template", true); 54182 this.baseProfile = getStringOption(attributes.baseProfile, ["full", "interactiveForms"]); 54183 this.extras = null; 54184 this.subform = new XFAObjectArray(); 54185 } 54186 [$finalize]() { 54187 if (this.subform.children.length === 0) { 54188 warn("XFA - No subforms in template node."); 54189 } 54190 if (this.subform.children.length >= 2) { 54191 warn("XFA - Several subforms in template node: please file a bug."); 54192 } 54193 this[$tabIndex] = DEFAULT_TAB_INDEX; 54194 } 54195 [$isSplittable]() { 54196 return true; 54197 } 54198 [$searchNode](expr, container) { 54199 if (expr.startsWith("#")) { 54200 return [this[$ids].get(expr.slice(1))]; 54201 } 54202 return searchNode(this, container, expr, true, true); 54203 } 54204 *[$toPages]() { 54205 if (!this.subform.children.length) { 54206 return HTMLResult.success({ 54207 name: "div", 54208 children: [] 54209 }); 54210 } 54211 this[$extra] = { 54212 overflowNode: null, 54213 firstUnsplittable: null, 54214 currentContentArea: null, 54215 currentPageArea: null, 54216 noLayoutFailure: false, 54217 pageNumber: 1, 54218 pagePosition: "first", 54219 oddOrEven: "odd", 54220 blankOrNotBlank: "nonBlank", 54221 paraStack: [] 54222 }; 54223 const root = this.subform.children[0]; 54224 root.pageSet[$cleanPage](); 54225 const pageAreas = root.pageSet.pageArea.children; 54226 const mainHtml = { 54227 name: "div", 54228 children: [] 54229 }; 54230 let pageArea = null; 54231 let breakBefore = null; 54232 let breakBeforeTarget = null; 54233 if (root.breakBefore.children.length >= 1) { 54234 breakBefore = root.breakBefore.children[0]; 54235 breakBeforeTarget = breakBefore.target; 54236 } else if (root.subform.children.length >= 1 && root.subform.children[0].breakBefore.children.length >= 1) { 54237 breakBefore = root.subform.children[0].breakBefore.children[0]; 54238 breakBeforeTarget = breakBefore.target; 54239 } else if (root.break?.beforeTarget) { 54240 breakBefore = root.break; 54241 breakBeforeTarget = breakBefore.beforeTarget; 54242 } else if (root.subform.children.length >= 1 && root.subform.children[0].break?.beforeTarget) { 54243 breakBefore = root.subform.children[0].break; 54244 breakBeforeTarget = breakBefore.beforeTarget; 54245 } 54246 if (breakBefore) { 54247 const target = this[$searchNode](breakBeforeTarget, breakBefore[$getParent]()); 54248 if (target instanceof PageArea) { 54249 pageArea = target; 54250 breakBefore[$extra] = {}; 54251 } 54252 } 54253 pageArea ||= pageAreas[0]; 54254 pageArea[$extra] = { 54255 numberOfUse: 1 54256 }; 54257 const pageAreaParent = pageArea[$getParent](); 54258 pageAreaParent[$extra] = { 54259 numberOfUse: 1, 54260 pageIndex: pageAreaParent.pageArea.children.indexOf(pageArea), 54261 pageSetIndex: 0 54262 }; 54263 let targetPageArea; 54264 let leader = null; 54265 let trailer = null; 54266 let hasSomething = true; 54267 let hasSomethingCounter = 0; 54268 let startIndex = 0; 54269 while (true) { 54270 if (!hasSomething) { 54271 mainHtml.children.pop(); 54272 if (++hasSomethingCounter === MAX_EMPTY_PAGES) { 54273 warn("XFA - Something goes wrong: please file a bug."); 54274 return mainHtml; 54275 } 54276 } else { 54277 hasSomethingCounter = 0; 54278 } 54279 targetPageArea = null; 54280 this[$extra].currentPageArea = pageArea; 54281 const page = pageArea[$toHTML]().html; 54282 mainHtml.children.push(page); 54283 if (leader) { 54284 this[$extra].noLayoutFailure = true; 54285 page.children.push(leader[$toHTML](pageArea[$extra].space).html); 54286 leader = null; 54287 } 54288 if (trailer) { 54289 this[$extra].noLayoutFailure = true; 54290 page.children.push(trailer[$toHTML](pageArea[$extra].space).html); 54291 trailer = null; 54292 } 54293 const contentAreas = pageArea.contentArea.children; 54294 const htmlContentAreas = page.children.filter(node => node.attributes.class.includes("xfaContentarea")); 54295 hasSomething = false; 54296 this[$extra].firstUnsplittable = null; 54297 this[$extra].noLayoutFailure = false; 54298 const flush = index => { 54299 const html = root[$flushHTML](); 54300 if (html) { 54301 hasSomething ||= html.children?.length > 0; 54302 htmlContentAreas[index].children.push(html); 54303 } 54304 }; 54305 for (let i = startIndex, ii = contentAreas.length; i < ii; i++) { 54306 const contentArea = this[$extra].currentContentArea = contentAreas[i]; 54307 const space = { 54308 width: contentArea.w, 54309 height: contentArea.h 54310 }; 54311 startIndex = 0; 54312 if (leader) { 54313 htmlContentAreas[i].children.push(leader[$toHTML](space).html); 54314 leader = null; 54315 } 54316 if (trailer) { 54317 htmlContentAreas[i].children.push(trailer[$toHTML](space).html); 54318 trailer = null; 54319 } 54320 const html = root[$toHTML](space); 54321 if (html.success) { 54322 if (html.html) { 54323 hasSomething ||= html.html.children?.length > 0; 54324 htmlContentAreas[i].children.push(html.html); 54325 } else if (!hasSomething && mainHtml.children.length > 1) { 54326 mainHtml.children.pop(); 54327 } 54328 return mainHtml; 54329 } 54330 if (html.isBreak()) { 54331 const node = html.breakNode; 54332 flush(i); 54333 if (node.targetType === "auto") { 54334 continue; 54335 } 54336 if (node.leader) { 54337 leader = this[$searchNode](node.leader, node[$getParent]()); 54338 leader = leader ? leader[0] : null; 54339 } 54340 if (node.trailer) { 54341 trailer = this[$searchNode](node.trailer, node[$getParent]()); 54342 trailer = trailer ? trailer[0] : null; 54343 } 54344 if (node.targetType === "pageArea") { 54345 targetPageArea = node[$extra].target; 54346 i = Infinity; 54347 } else if (!node[$extra].target) { 54348 i = node[$extra].index; 54349 } else { 54350 targetPageArea = node[$extra].target; 54351 startIndex = node[$extra].index + 1; 54352 i = Infinity; 54353 } 54354 continue; 54355 } 54356 if (this[$extra].overflowNode) { 54357 const node = this[$extra].overflowNode; 54358 this[$extra].overflowNode = null; 54359 const overflowExtra = node[$getExtra](); 54360 const target = overflowExtra.target; 54361 overflowExtra.addLeader = overflowExtra.leader !== null; 54362 overflowExtra.addTrailer = overflowExtra.trailer !== null; 54363 flush(i); 54364 const currentIndex = i; 54365 i = Infinity; 54366 if (target instanceof PageArea) { 54367 targetPageArea = target; 54368 } else if (target instanceof ContentArea) { 54369 const index = contentAreas.indexOf(target); 54370 if (index !== -1) { 54371 if (index > currentIndex) { 54372 i = index - 1; 54373 } else { 54374 startIndex = index; 54375 } 54376 } else { 54377 targetPageArea = target[$getParent](); 54378 startIndex = targetPageArea.contentArea.children.indexOf(target); 54379 } 54380 } 54381 continue; 54382 } 54383 flush(i); 54384 } 54385 this[$extra].pageNumber += 1; 54386 if (targetPageArea) { 54387 if (targetPageArea[$isUsable]()) { 54388 targetPageArea[$extra].numberOfUse += 1; 54389 } else { 54390 targetPageArea = null; 54391 } 54392 } 54393 pageArea = targetPageArea || pageArea[$getNextPage](); 54394 yield null; 54395 } 54396 } 54397} 54398class Text extends ContentObject { 54399 constructor(attributes) { 54400 super(TEMPLATE_NS_ID, "text"); 54401 this.id = attributes.id || ""; 54402 this.maxChars = getInteger({ 54403 data: attributes.maxChars, 54404 defaultValue: 0, 54405 validate: x => x >= 0 54406 }); 54407 this.name = attributes.name || ""; 54408 this.rid = attributes.rid || ""; 54409 this.use = attributes.use || ""; 54410 this.usehref = attributes.usehref || ""; 54411 } 54412 [$acceptWhitespace]() { 54413 return true; 54414 } 54415 [$onChild](child) { 54416 if (child[$namespaceId] === NamespaceIds.xhtml.id) { 54417 this[$content] = child; 54418 return true; 54419 } 54420 warn(`XFA - Invalid content in Text: ${child[$nodeName]}.`); 54421 return false;
vendor: 10,112 bytes, lines 54422-54773
54422 } 54423 [$onText](str) { 54424 if (this[$content] instanceof XFAObject) { 54425 return; 54426 } 54427 super[$onText](str); 54428 } 54429 [$finalize]() { 54430 if (typeof this[$content] === "string") { 54431 this[$content] = this[$content].replaceAll("\r\n", "\n"); 54432 } 54433 } 54434 [$getExtra]() { 54435 if (typeof this[$content] === "string") { 54436 return this[$content].split(/[\u2029\u2028\n]/).filter(line => !!line).join("\n"); 54437 } 54438 return this[$content][$text](); 54439 } 54440 [$toHTML](availableSpace) { 54441 if (typeof this[$content] === "string") { 54442 const html = valueToHtml(this[$content]).html; 54443 if (this[$content].includes("\u2029")) { 54444 html.name = "div"; 54445 html.children = []; 54446 this[$content].split("\u2029").map(para => para.split(/[\u2028\n]/).flatMap(line => [{ 54447 name: "span", 54448 value: line 54449 }, { 54450 name: "br" 54451 }])).forEach(lines => { 54452 html.children.push({ 54453 name: "p", 54454 children: lines 54455 }); 54456 }); 54457 } else if (/[\u2028\n]/.test(this[$content])) { 54458 html.name = "div"; 54459 html.children = []; 54460 this[$content].split(/[\u2028\n]/).forEach(line => { 54461 html.children.push({ 54462 name: "span", 54463 value: line 54464 }, { 54465 name: "br" 54466 }); 54467 }); 54468 } 54469 return HTMLResult.success(html); 54470 } 54471 return this[$content][$toHTML](availableSpace); 54472 } 54473} 54474class TextEdit extends XFAObject { 54475 constructor(attributes) { 54476 super(TEMPLATE_NS_ID, "textEdit", true); 54477 this.allowRichText = getInteger({ 54478 data: attributes.allowRichText, 54479 defaultValue: 0, 54480 validate: x => x === 1 54481 }); 54482 this.hScrollPolicy = getStringOption(attributes.hScrollPolicy, ["auto", "off", "on"]); 54483 this.id = attributes.id || ""; 54484 this.multiLine = getInteger({ 54485 data: attributes.multiLine, 54486 defaultValue: "", 54487 validate: x => x === 0 || x === 1 54488 }); 54489 this.use = attributes.use || ""; 54490 this.usehref = attributes.usehref || ""; 54491 this.vScrollPolicy = getStringOption(attributes.vScrollPolicy, ["auto", "off", "on"]); 54492 this.border = null; 54493 this.comb = null; 54494 this.extras = null; 54495 this.margin = null; 54496 } 54497 [$toHTML](availableSpace) { 54498 const style = toStyle(this, "border", "font", "margin"); 54499 let html; 54500 const field = this[$getParent]()[$getParent](); 54501 if (this.multiLine === "") { 54502 this.multiLine = field instanceof Draw ? 1 : 0; 54503 } 54504 if (this.multiLine === 1) { 54505 html = { 54506 name: "textarea", 54507 attributes: { 54508 dataId: field[$data]?.[$uid] || field[$uid], 54509 fieldId: field[$uid], 54510 class: ["xfaTextfield"], 54511 style, 54512 "aria-label": ariaLabel(field), 54513 "aria-required": false 54514 } 54515 }; 54516 } else { 54517 html = { 54518 name: "input", 54519 attributes: { 54520 type: "text", 54521 dataId: field[$data]?.[$uid] || field[$uid], 54522 fieldId: field[$uid], 54523 class: ["xfaTextfield"], 54524 style, 54525 "aria-label": ariaLabel(field), 54526 "aria-required": false 54527 } 54528 }; 54529 } 54530 if (isRequired(field)) { 54531 html.attributes["aria-required"] = true; 54532 html.attributes.required = true; 54533 } 54534 return HTMLResult.success({ 54535 name: "label", 54536 attributes: { 54537 class: ["xfaLabel"] 54538 }, 54539 children: [html] 54540 }); 54541 } 54542} 54543class Time extends StringObject { 54544 constructor(attributes) { 54545 super(TEMPLATE_NS_ID, "time"); 54546 this.id = attributes.id || ""; 54547 this.name = attributes.name || ""; 54548 this.use = attributes.use || ""; 54549 this.usehref = attributes.usehref || ""; 54550 } 54551 [$finalize]() { 54552 const date = this[$content].trim(); 54553 this[$content] = date ? new Date(date) : null; 54554 } 54555 [$toHTML](availableSpace) { 54556 return valueToHtml(this[$content] ? this[$content].toString() : ""); 54557 } 54558} 54559class TimeStamp extends XFAObject { 54560 constructor(attributes) { 54561 super(TEMPLATE_NS_ID, "timeStamp"); 54562 this.id = attributes.id || ""; 54563 this.server = attributes.server || ""; 54564 this.type = getStringOption(attributes.type, ["optional", "required"]); 54565 this.use = attributes.use || ""; 54566 this.usehref = attributes.usehref || ""; 54567 } 54568} 54569class ToolTip extends StringObject { 54570 constructor(attributes) { 54571 super(TEMPLATE_NS_ID, "toolTip"); 54572 this.id = attributes.id || ""; 54573 this.rid = attributes.rid || ""; 54574 this.use = attributes.use || ""; 54575 this.usehref = attributes.usehref || ""; 54576 } 54577} 54578class Traversal extends XFAObject { 54579 constructor(attributes) { 54580 super(TEMPLATE_NS_ID, "traversal", true); 54581 this.id = attributes.id || ""; 54582 this.use = attributes.use || ""; 54583 this.usehref = attributes.usehref || ""; 54584 this.extras = null; 54585 this.traverse = new XFAObjectArray(); 54586 } 54587} 54588class Traverse extends XFAObject { 54589 constructor(attributes) { 54590 super(TEMPLATE_NS_ID, "traverse", true); 54591 this.id = attributes.id || ""; 54592 this.operation = getStringOption(attributes.operation, ["next", "back", "down", "first", "left", "right", "up"]); 54593 this.ref = attributes.ref || ""; 54594 this.use = attributes.use || ""; 54595 this.usehref = attributes.usehref || ""; 54596 this.extras = null; 54597 this.script = null; 54598 } 54599 get name() { 54600 return this.operation; 54601 } 54602 [$isTransparent]() { 54603 return false; 54604 } 54605} 54606class Ui extends XFAObject { 54607 constructor(attributes) { 54608 super(TEMPLATE_NS_ID, "ui", true); 54609 this.id = attributes.id || ""; 54610 this.use = attributes.use || ""; 54611 this.usehref = attributes.usehref || ""; 54612 this.extras = null; 54613 this.picture = null; 54614 this.barcode = null; 54615 this.button = null; 54616 this.checkButton = null; 54617 this.choiceList = null; 54618 this.dateTimeEdit = null; 54619 this.defaultUi = null; 54620 this.imageEdit = null; 54621 this.numericEdit = null; 54622 this.passwordEdit = null; 54623 this.signature = null; 54624 this.textEdit = null; 54625 } 54626 [$getExtra]() { 54627 if (this[$extra] === undefined) { 54628 for (const name of Object.getOwnPropertyNames(this)) { 54629 if (name === "extras" || name === "picture") { 54630 continue; 54631 } 54632 const obj = this[name]; 54633 if (!(obj instanceof XFAObject)) { 54634 continue; 54635 } 54636 this[$extra] = obj; 54637 return obj; 54638 } 54639 this[$extra] = null; 54640 } 54641 return this[$extra]; 54642 } 54643 [$toHTML](availableSpace) { 54644 const obj = this[$getExtra](); 54645 if (obj) { 54646 return obj[$toHTML](availableSpace); 54647 } 54648 return HTMLResult.EMPTY; 54649 } 54650} 54651class Validate extends XFAObject { 54652 constructor(attributes) { 54653 super(TEMPLATE_NS_ID, "validate", true); 54654 this.formatTest = getStringOption(attributes.formatTest, ["warning", "disabled", "error"]); 54655 this.id = attributes.id || ""; 54656 this.nullTest = getStringOption(attributes.nullTest, ["disabled", "error", "warning"]); 54657 this.scriptTest = getStringOption(attributes.scriptTest, ["error", "disabled", "warning"]); 54658 this.use = attributes.use || ""; 54659 this.usehref = attributes.usehref || ""; 54660 this.extras = null; 54661 this.message = null; 54662 this.picture = null; 54663 this.script = null; 54664 } 54665} 54666class Value extends XFAObject { 54667 constructor(attributes) { 54668 super(TEMPLATE_NS_ID, "value", true); 54669 this.id = attributes.id || ""; 54670 this.override = getInteger({ 54671 data: attributes.override, 54672 defaultValue: 0, 54673 validate: x => x === 1 54674 }); 54675 this.relevant = getRelevant(attributes.relevant); 54676 this.use = attributes.use || ""; 54677 this.usehref = attributes.usehref || ""; 54678 this.arc = null; 54679 this.boolean = null; 54680 this.date = null; 54681 this.dateTime = null; 54682 this.decimal = null; 54683 this.exData = null; 54684 this.float = null; 54685 this.image = null; 54686 this.integer = null; 54687 this.line = null; 54688 this.rectangle = null; 54689 this.text = null; 54690 this.time = null; 54691 } 54692 [$setValue](value) { 54693 const parent = this[$getParent](); 54694 if (parent instanceof Field) { 54695 if (parent.ui?.imageEdit) { 54696 if (!this.image) { 54697 this.image = new Image({}); 54698 this[$appendChild](this.image); 54699 } 54700 this.image[$content] = value[$content]; 54701 return; 54702 } 54703 } 54704 const valueName = value[$nodeName]; 54705 if (this[valueName] !== null) { 54706 this[valueName][$content] = value[$content]; 54707 return; 54708 } 54709 for (const name of Object.getOwnPropertyNames(this)) { 54710 const obj = this[name]; 54711 if (obj instanceof XFAObject) { 54712 this[name] = null; 54713 this[$removeChild](obj); 54714 } 54715 } 54716 this[value[$nodeName]] = value; 54717 this[$appendChild](value); 54718 } 54719 [$text]() { 54720 if (this.exData) { 54721 if (typeof this.exData[$content] === "string") { 54722 return this.exData[$content].trim(); 54723 } 54724 return this.exData[$content][$text]().trim(); 54725 } 54726 for (const name of Object.getOwnPropertyNames(this)) { 54727 if (name === "image") { 54728 continue; 54729 } 54730 const obj = this[name]; 54731 if (obj instanceof XFAObject) { 54732 return (obj[$content] || "").toString().trim(); 54733 } 54734 } 54735 return null; 54736 } 54737 [$toHTML](availableSpace) { 54738 for (const name of Object.getOwnPropertyNames(this)) { 54739 const obj = this[name]; 54740 if (!(obj instanceof XFAObject)) { 54741 continue; 54742 } 54743 return obj[$toHTML](availableSpace); 54744 } 54745 return HTMLResult.EMPTY; 54746 } 54747} 54748class Variables extends XFAObject { 54749 constructor(attributes) { 54750 super(TEMPLATE_NS_ID, "variables", true); 54751 this.id = attributes.id || ""; 54752 this.use = attributes.use || ""; 54753 this.usehref = attributes.usehref || ""; 54754 this.boolean = new XFAObjectArray(); 54755 this.date = new XFAObjectArray(); 54756 this.dateTime = new XFAObjectArray(); 54757 this.decimal = new XFAObjectArray(); 54758 this.exData = new XFAObjectArray(); 54759 this.float = new XFAObjectArray(); 54760 this.image = new XFAObjectArray(); 54761 this.integer = new XFAObjectArray(); 54762 this.manifest = new XFAObjectArray(); 54763 this.script = new XFAObjectArray(); 54764 this.text = new XFAObjectArray(); 54765 this.time = new XFAObjectArray(); 54766 } 54767 [$isTransparent]() { 54768 return true; 54769 } 54770} 54771class TemplateNamespace { 54772 static [$buildXFAObject](name, attributes) { 54773 if (
54773Object.hasOwn(TemplateNamespace, name)) { 54774 const node = TemplateNamespace[name](attributes); 54775 node[$setSetAttributes](attributes); 54776 return node; 54777 } 54778 return undefined; 54779 } 54780 static appearanceFilter(attrs) { 54781 return new AppearanceFilter(attrs); 54782 } 54783 static arc(attrs) { 54784 return new Arc(attrs); 54785 } 54786 static area(attrs) { 54787 return new Area(attrs); 54788 } 54789 static assist(attrs) { 54790 return new Assist(attrs); 54791 } 54792 static barcode(attrs) { 54793 return new Barcode(attrs); 54794 } 54795 static bind(attrs) { 54796 return new Bind(attrs); 54797 } 54798 static bindItems(attrs) { 54799 return new BindItems(attrs); 54800 } 54801 static bookend(attrs) { 54802 return new Bookend(attrs); 54803 } 54804 static boolean(attrs) { 54805 return new BooleanElement(attrs); 54806 } 54807 static border(attrs) { 54808 return new Border(attrs); 54809 } 54810 static break(attrs) { 54811 return new Break(attrs); 54812 } 54813 static breakAfter(attrs) { 54814 return new BreakAfter(attrs); 54815 } 54816 static breakBefore(attrs) { 54817 return new BreakBefore(attrs); 54818 } 54819 static button(attrs) { 54820 return new Button(attrs); 54821 } 54822 static calculate(attrs) { 54823 return new Calculate(attrs); 54824 } 54825 static caption(attrs) { 54826 return new Caption(attrs); 54827 } 54828 static certificate(attrs) { 54829 return new Certificate(attrs); 54830 } 54831 static certificates(attrs) { 54832 return new Certificates(attrs); 54833 } 54834 static checkButton(attrs) { 54835 return new CheckButton(attrs); 54836 } 54837 static choiceList(attrs) { 54838 return new ChoiceList(attrs); 54839 } 54840 static color(attrs) { 54841 return new Color(attrs); 54842 } 54843 static comb(attrs) { 54844 return new Comb(attrs); 54845 } 54846 static connect(attrs) { 54847 return new Connect(attrs); 54848 } 54849 static contentArea(attrs) { 54850 return new ContentArea(attrs); 54851 } 54852 static corner(attrs) { 54853 return new Corner(attrs); 54854 } 54855 static date(attrs) { 54856 return new DateElement(attrs); 54857 } 54858 static dateTime(attrs) { 54859 return new DateTime(attrs); 54860 } 54861 static dateTimeEdit(attrs) { 54862 return new DateTimeEdit(attrs); 54863 } 54864 static decimal(attrs) { 54865 return new Decimal(attrs); 54866 } 54867 static defaultUi(attrs) { 54868 return new DefaultUi(attrs); 54869 } 54870 static desc(attrs) { 54871 return new Desc(attrs); 54872 } 54873 static digestMethod(attrs) { 54874 return new DigestMethod(attrs); 54875 } 54876 static digestMethods(attrs) { 54877 return new DigestMethods(attrs); 54878 } 54879 static draw(attrs) { 54880 return new Draw(attrs); 54881 } 54882 static edge(attrs) { 54883 return new Edge(attrs); 54884 } 54885 static encoding(attrs) { 54886 return new Encoding(attrs); 54887 } 54888 static encodings(attrs) { 54889 return new Encodings(attrs); 54890 } 54891 static encrypt(attrs) { 54892 return new Encrypt(attrs); 54893 } 54894 static encryptData(attrs) { 54895 return new EncryptData(attrs); 54896 } 54897 static encryption(attrs) { 54898 return new Encryption(attrs); 54899 } 54900 static encryptionMethod(attrs) { 54901 return new EncryptionMethod(attrs); 54902 } 54903 static encryptionMethods(attrs) { 54904 return new EncryptionMethods(attrs); 54905 } 54906 static event(attrs) { 54907 return new Event(attrs); 54908 } 54909 static exData(attrs) { 54910 return new ExData(attrs); 54911 } 54912 static exObject(attrs) { 54913 return new ExObject(attrs); 54914 } 54915 static exclGroup(attrs) { 54916 return new ExclGroup(attrs); 54917 } 54918 static execute(attrs) { 54919 return new Execute(attrs); 54920 } 54921 static extras(attrs) { 54922 return new Extras(attrs); 54923 } 54924 static field(attrs) { 54925 return new Field(attrs); 54926 } 54927 static fill(attrs) { 54928 return new Fill(attrs); 54929 } 54930 static filter(attrs) { 54931 return new Filter(attrs); 54932 } 54933 static float(attrs) { 54934 return new Float(attrs); 54935 } 54936 static font(attrs) { 54937 return new template_Font(attrs); 54938 } 54939 static format(attrs) { 54940 return new Format(attrs); 54941 } 54942 static handler(attrs) { 54943 return new Handler(attrs); 54944 } 54945 static hyphenation(attrs) { 54946 return new Hyphenation(attrs); 54947 } 54948 static image(attrs) { 54949 return new Image(attrs); 54950 } 54951 static imageEdit(attrs) { 54952 return new ImageEdit(attrs); 54953 } 54954 static integer(attrs) { 54955 return new Integer(attrs); 54956 } 54957 static issuers(attrs) { 54958 return new Issuers(attrs); 54959 } 54960 static items(attrs) { 54961 return new Items(attrs); 54962 } 54963 static keep(attrs) { 54964 return new Keep(attrs); 54965 } 54966 static keyUsage(attrs) { 54967 return new KeyUsage(attrs); 54968 } 54969 static line(attrs) { 54970 return new Line(attrs); 54971 } 54972 static linear(attrs) { 54973 return new Linear(attrs); 54974 } 54975 static lockDocument(attrs) { 54976 return new LockDocument(attrs); 54977 } 54978 static manifest(attrs) { 54979 return new Manifest(attrs); 54980 } 54981 static margin(attrs) { 54982 return new Margin(attrs); 54983 } 54984 static mdp(attrs) { 54985 return new Mdp(attrs); 54986 } 54987 static medium(attrs) { 54988 return new Medium(attrs); 54989 } 54990 static message(attrs) {
vendor: 4,626 bytes, lines 54991-55194
54991 return new Message(attrs); 54992 } 54993 static numericEdit(attrs) { 54994 return new NumericEdit(attrs); 54995 } 54996 static occur(attrs) { 54997 return new Occur(attrs); 54998 } 54999 static oid(attrs) { 55000 return new Oid(attrs); 55001 } 55002 static oids(attrs) { 55003 return new Oids(attrs); 55004 } 55005 static overflow(attrs) { 55006 return new Overflow(attrs); 55007 } 55008 static pageArea(attrs) { 55009 return new PageArea(attrs); 55010 } 55011 static pageSet(attrs) { 55012 return new PageSet(attrs); 55013 } 55014 static para(attrs) { 55015 return new Para(attrs); 55016 } 55017 static passwordEdit(attrs) { 55018 return new PasswordEdit(attrs); 55019 } 55020 static pattern(attrs) { 55021 return new template_Pattern(attrs); 55022 } 55023 static picture(attrs) { 55024 return new Picture(attrs); 55025 } 55026 static proto(attrs) { 55027 return new Proto(attrs); 55028 } 55029 static radial(attrs) { 55030 return new Radial(attrs); 55031 } 55032 static reason(attrs) { 55033 return new Reason(attrs); 55034 } 55035 static reasons(attrs) { 55036 return new Reasons(attrs); 55037 } 55038 static rectangle(attrs) { 55039 return new Rectangle(attrs); 55040 } 55041 static ref(attrs) { 55042 return new RefElement(attrs); 55043 } 55044 static script(attrs) { 55045 return new Script(attrs); 55046 } 55047 static setProperty(attrs) { 55048 return new SetProperty(attrs); 55049 } 55050 static signData(attrs) { 55051 return new SignData(attrs); 55052 } 55053 static signature(attrs) { 55054 return new Signature(attrs); 55055 } 55056 static signing(attrs) { 55057 return new Signing(attrs); 55058 } 55059 static solid(attrs) { 55060 return new Solid(attrs); 55061 } 55062 static speak(attrs) { 55063 return new Speak(attrs); 55064 } 55065 static stipple(attrs) { 55066 return new Stipple(attrs); 55067 } 55068 static subform(attrs) { 55069 return new Subform(attrs); 55070 } 55071 static subformSet(attrs) { 55072 return new SubformSet(attrs); 55073 } 55074 static subjectDN(attrs) { 55075 return new SubjectDN(attrs); 55076 } 55077 static subjectDNs(attrs) { 55078 return new SubjectDNs(attrs); 55079 } 55080 static submit(attrs) { 55081 return new Submit(attrs); 55082 } 55083 static template(attrs) { 55084 return new Template(attrs); 55085 } 55086 static text(attrs) { 55087 return new Text(attrs); 55088 } 55089 static textEdit(attrs) { 55090 return new TextEdit(attrs); 55091 } 55092 static time(attrs) { 55093 return new Time(attrs); 55094 } 55095 static timeStamp(attrs) { 55096 return new TimeStamp(attrs); 55097 } 55098 static toolTip(attrs) { 55099 return new ToolTip(attrs); 55100 } 55101 static traversal(attrs) { 55102 return new Traversal(attrs); 55103 } 55104 static traverse(attrs) { 55105 return new Traverse(attrs); 55106 } 55107 static ui(attrs) { 55108 return new Ui(attrs); 55109 } 55110 static validate(attrs) { 55111 return new Validate(attrs); 55112 } 55113 static value(attrs) { 55114 return new Value(attrs); 55115 } 55116 static variables(attrs) { 55117 return new Variables(attrs); 55118 } 55119} 55120 55121;// ./src/core/xfa/bind.js 55122 55123 55124 55125 55126 55127 55128 55129 55130 55131 55132 55133const bind_NS_DATASETS = NamespaceIds.datasets.id; 55134function createText(content) { 55135 const node = new Text({}); 55136 node[$content] = content; 55137 return node; 55138} 55139class Binder { 55140 constructor(root) { 55141 this.root = root; 55142 this.datasets = root.datasets; 55143 this.data = root.datasets?.data || new XmlObject(NamespaceIds.datasets.id, "data"); 55144 this.emptyMerge = this.data[$getChildren]().length === 0; 55145 this.root.form = this.form = root.template[$clone](); 55146 } 55147 _isConsumeData() { 55148 return !this.emptyMerge && this._mergeMode; 55149 } 55150 _isMatchTemplate() { 55151 return !this._isConsumeData(); 55152 } 55153 bind() { 55154 this._bindElement(this.form, this.data); 55155 return this.form; 55156 } 55157 getData() { 55158 return this.data; 55159 } 55160 _bindValue(formNode, data, picture) { 55161 formNode[$data] = data; 55162 if (formNode[$hasSettableValue]()) { 55163 if (data[$isDataValue]()) { 55164 const value = data[$getDataValue](); 55165 formNode[$setValue](createText(value)); 55166 } else if (formNode instanceof Field && formNode.ui?.choiceList?.open === "multiSelect") { 55167 const value = data[$getChildren]().map(child => child[$content].trim()).join("\n"); 55168 formNode[$setValue](createText(value)); 55169 } else if (this._isConsumeData()) { 55170 warn(`XFA - Nodes haven't the same type.`); 55171 } 55172 } else if (!data[$isDataValue]() || this._isMatchTemplate()) { 55173 this._bindElement(formNode, data); 55174 } else { 55175 warn(`XFA - Nodes haven't the same type.`); 55176 } 55177 } 55178 _findDataByNameToConsume(name, isValue, dataNode, global) { 55179 if (!name) { 55180 return null; 55181 } 55182 let generator, match; 55183 for (let i = 0; i < 3; i++) { 55184 generator = dataNode[$getRealChildrenByNameIt](name, false, true); 55185 while (true) { 55186 match = generator.next().value; 55187 if (!match) { 55188 break; 55189 } 55190 if (isValue === match[$isDataValue]()) { 55191 return match; 55192 } 55193 } 55194 if (dataNode[$namespaceId] === NamespaceIds.datasets.id
vendor: 11,079 bytes, lines 55194-55548
55194 && dataNode[$nodeName] === "data") { 55195 break; 55196 } 55197 dataNode = dataNode[$getParent](); 55198 } 55199 if (!global) { 55200 return null; 55201 } 55202 generator = this.data[$getRealChildrenByNameIt](name, true, false); 55203 match = generator.next().value; 55204 if (match) { 55205 return match; 55206 } 55207 generator = this.data[$getAttributeIt](name, true); 55208 match = generator.next().value; 55209 if (match?.[$isDataValue]()) { 55210 return match; 55211 } 55212 return null; 55213 } 55214 _setProperties(formNode, dataNode) { 55215 if (!Object.hasOwn(formNode, "setProperty")) { 55216 return; 55217 } 55218 for (const { 55219 ref, 55220 target, 55221 connection 55222 } of formNode.setProperty.children) { 55223 if (connection) { 55224 continue; 55225 } 55226 if (!ref) { 55227 continue; 55228 } 55229 const nodes = searchNode(this.root, dataNode, ref, false, false); 55230 if (!nodes) { 55231 warn(`XFA - Invalid reference: ${ref}.`); 55232 continue; 55233 } 55234 const [node] = nodes; 55235 if (!node[$isDescendent](this.data)) { 55236 warn(`XFA - Invalid node: must be a data node.`); 55237 continue; 55238 } 55239 const targetNodes = searchNode(this.root, formNode, target, false, false); 55240 if (!targetNodes) { 55241 warn(`XFA - Invalid target: ${target}.`); 55242 continue; 55243 } 55244 const [targetNode] = targetNodes; 55245 if (!targetNode[$isDescendent](formNode)) { 55246 warn(`XFA - Invalid target: must be a property or subproperty.`); 55247 continue; 55248 } 55249 const targetParent = targetNode[$getParent](); 55250 if (targetNode instanceof SetProperty || targetParent instanceof SetProperty) { 55251 warn(`XFA - Invalid target: cannot be a setProperty or one of its properties.`); 55252 continue; 55253 } 55254 if (targetNode instanceof BindItems || targetParent instanceof BindItems) { 55255 warn(`XFA - Invalid target: cannot be a bindItems or one of its properties.`); 55256 continue; 55257 } 55258 const content = node[$text](); 55259 const name = targetNode[$nodeName]; 55260 if (targetNode instanceof XFAAttribute) { 55261 const attrs = Object.create(null); 55262 attrs[name] = content; 55263 const obj = Reflect.construct(Object.getPrototypeOf(targetParent).constructor, [attrs]); 55264 targetParent[name] = obj[name]; 55265 continue; 55266 } 55267 if (!Object.hasOwn(targetNode, $content)) { 55268 warn(`XFA - Invalid node to use in setProperty`); 55269 continue; 55270 } 55271 targetNode[$data] = node; 55272 targetNode[$content] = content; 55273 targetNode[$finalize](); 55274 } 55275 } 55276 _bindItems(formNode, dataNode) { 55277 if (!Object.hasOwn(formNode, "items") || !Object.hasOwn(formNode, "bindItems") || formNode.bindItems.isEmpty()) { 55278 return; 55279 } 55280 for (const item of formNode.items.children) { 55281 formNode[$removeChild](item); 55282 } 55283 formNode.items.clear(); 55284 const labels = new Items({}); 55285 const values = new Items({}); 55286 formNode[$appendChild](labels); 55287 formNode.items.push(labels); 55288 formNode[$appendChild](values); 55289 formNode.items.push(values); 55290 for (const { 55291 ref, 55292 labelRef, 55293 valueRef, 55294 connection 55295 } of formNode.bindItems.children) { 55296 if (connection) { 55297 continue; 55298 } 55299 if (!ref) { 55300 continue; 55301 } 55302 const nodes = searchNode(this.root, dataNode, ref, false, false); 55303 if (!nodes) { 55304 warn(`XFA - Invalid reference: ${ref}.`); 55305 continue; 55306 } 55307 for (const node of nodes) { 55308 if (!node[$isDescendent](this.datasets)) { 55309 warn(`XFA - Invalid ref (${ref}): must be a datasets child.`); 55310 continue; 55311 } 55312 const labelNodes = searchNode(this.root, node, labelRef, true, false); 55313 if (!labelNodes) { 55314 warn(`XFA - Invalid label: ${labelRef}.`); 55315 continue; 55316 } 55317 const [labelNode] = labelNodes; 55318 if (!labelNode[$isDescendent](this.datasets)) { 55319 warn(`XFA - Invalid label: must be a datasets child.`); 55320 continue; 55321 } 55322 const valueNodes = searchNode(this.root, node, valueRef, true, false); 55323 if (!valueNodes) { 55324 warn(`XFA - Invalid value: ${valueRef}.`); 55325 continue; 55326 } 55327 const [valueNode] = valueNodes; 55328 if (!valueNode[$isDescendent](this.datasets)) { 55329 warn(`XFA - Invalid value: must be a datasets child.`); 55330 continue; 55331 } 55332 const label = createText(labelNode[$text]()); 55333 const value = createText(valueNode[$text]()); 55334 labels[$appendChild](label); 55335 labels.text.push(label); 55336 values[$appendChild](value); 55337 values.text.push(value); 55338 } 55339 } 55340 } 55341 _bindOccurrences(formNode, matches, picture) { 55342 let baseClone; 55343 if (matches.length > 1) { 55344 baseClone = formNode[$clone](); 55345 baseClone[$removeChild](baseClone.occur); 55346 baseClone.occur = null; 55347 } 55348 this._bindValue(formNode, matches[0], picture); 55349 this._setProperties(formNode, matches[0]); 55350 this._bindItems(formNode, matches[0]); 55351 if (matches.length === 1) { 55352 return; 55353 } 55354 const parent = formNode[$getParent](); 55355 const name = formNode[$nodeName]; 55356 const pos = parent[$indexOf](formNode); 55357 for (let i = 1, ii = matches.length; i < ii; i++) { 55358 const match = matches[i]; 55359 const clone = baseClone[$clone](); 55360 parent[name].push(clone); 55361 parent[$insertAt](pos + i, clone); 55362 this._bindValue(clone, match, picture); 55363 this._setProperties(clone, match); 55364 this._bindItems(clone, match); 55365 } 55366 } 55367 _createOccurrences(formNode) { 55368 if (!this.emptyMerge) { 55369 return; 55370 } 55371 const { 55372 occur 55373 } = formNode; 55374 if (!occur || occur.initial <= 1) { 55375 return; 55376 } 55377 const parent = formNode[$getParent](); 55378 const name = formNode[$nodeName]; 55379 if (!(parent[name] instanceof XFAObjectArray)) { 55380 return; 55381 } 55382 let currentNumber; 55383 if (formNode.name) { 55384 currentNumber = parent[name].children.filter(e => e.name === formNode.name).length; 55385 } else { 55386 currentNumber = parent[name].children.length; 55387 } 55388 const pos = parent[$indexOf](formNode) + 1; 55389 const ii = occur.initial - currentNumber; 55390 if (ii) { 55391 const nodeClone = formNode[$clone](); 55392 nodeClone[$removeChild](nodeClone.occur); 55393 nodeClone.occur = null; 55394 parent[name].push(nodeClone); 55395 parent[$insertAt](pos, nodeClone); 55396 for (let i = 1; i < ii; i++) { 55397 const clone = nodeClone[$clone](); 55398 parent[name].push(clone); 55399 parent[$insertAt](pos + i, clone); 55400 } 55401 } 55402 } 55403 _getOccurInfo(formNode) { 55404 const { 55405 name, 55406 occur 55407 } = formNode; 55408 if (!occur || !name) { 55409 return [1, 1]; 55410 } 55411 const max = occur.max === -1 ? Infinity : occur.max; 55412 return [occur.min, max]; 55413 } 55414 _setAndBind(formNode, dataNode) { 55415 this._setProperties(formNode, dataNode); 55416 this._bindItems(formNode, dataNode); 55417 this._bindElement(formNode, dataNode); 55418 } 55419 _bindElement(formNode, dataNode) { 55420 const uselessNodes = []; 55421 this._createOccurrences(formNode); 55422 for (const child of formNode[$getChildren]()) { 55423 if (child[$data]) { 55424 continue; 55425 } 55426 if (this._mergeMode === undefined && child[$nodeName] === "subform") { 55427 this._mergeMode = child.mergeMode === "consumeData"; 55428 const dataChildren = dataNode[$getChildren](); 55429 if (dataChildren.length > 0) { 55430 this._bindOccurrences(child, [dataChildren[0]], null); 55431 } else if (this.emptyMerge) { 55432 const nsId = dataNode[$namespaceId] === bind_NS_DATASETS ? -1 : dataNode[$namespaceId]; 55433 const dataChild = child[$data] = new XmlObject(nsId, child.name || "root"); 55434 dataNode[$appendChild](dataChild); 55435 this._bindElement(child, dataChild); 55436 } 55437 continue; 55438 } 55439 if (!child[$isBindable]()) { 55440 continue; 55441 } 55442 let global = false; 55443 let picture = null; 55444 let ref = null; 55445 let match = null; 55446 if (child.bind) { 55447 switch (child.bind.match) { 55448 case "none": 55449 this._setAndBind(child, dataNode); 55450 continue; 55451 case "global": 55452 global = true; 55453 break; 55454 case "dataRef": 55455 if (!child.bind.ref) { 55456 warn(`XFA - ref is empty in node ${child[$nodeName]}.`); 55457 this._setAndBind(child, dataNode); 55458 continue; 55459 } 55460 ref = child.bind.ref; 55461 break; 55462 default: 55463 break; 55464 } 55465 if (child.bind.picture) { 55466 picture = child.bind.picture[$content]; 55467 } 55468 } 55469 const [min, max] = this._getOccurInfo(child); 55470 if (ref) { 55471 match = searchNode(this.root, dataNode, ref, true, false); 55472 if (match === null) { 55473 match = createDataNode(this.data, dataNode, ref); 55474 if (!match) { 55475 continue; 55476 } 55477 if (this._isConsumeData()) { 55478 match[$consumed] = true; 55479 } 55480 this._setAndBind(child, match); 55481 continue; 55482 } else { 55483 if (this._isConsumeData()) { 55484 match = match.filter(node => !node[$consumed]); 55485 } 55486 if (match.length > max) { 55487 match = match.slice(0, max); 55488 } else if (match.length === 0) { 55489 match = null; 55490 } 55491 if (match && this._isConsumeData()) { 55492 match.forEach(node => { 55493 node[$consumed] = true; 55494 }); 55495 } 55496 } 55497 } else { 55498 if (!child.name) { 55499 this._setAndBind(child, dataNode); 55500 continue; 55501 } 55502 if (this._isConsumeData()) { 55503 const matches = []; 55504 while (matches.length < max) { 55505 const found = this._findDataByNameToConsume(child.name, child[$hasSettableValue](), dataNode, global); 55506 if (!found) { 55507 break; 55508 } 55509 found[$consumed] = true; 55510 matches.push(found); 55511 } 55512 match = matches.length > 0 ? matches : null; 55513 } else { 55514 match = dataNode[$getRealChildrenByNameIt](child.name, false, this.emptyMerge).next().value; 55515 if (!match) { 55516 if (min === 0) { 55517 uselessNodes.push(child); 55518 continue; 55519 } 55520 const nsId = dataNode[$namespaceId] === bind_NS_DATASETS ? -1 : dataNode[$namespaceId]; 55521 match = child[$data] = new XmlObject(nsId, child.name); 55522 if (this.emptyMerge) { 55523 match[$consumed] = true; 55524 } 55525 dataNode[$appendChild](match); 55526 this._setAndBind(child, match); 55527 continue; 55528 } 55529 if (this.emptyMerge) { 55530 match[$consumed] = true; 55531 } 55532 match = [match]; 55533 } 55534 } 55535 if (match) { 55536 this._bindOccurrences(child, match, picture); 55537 } else if (min > 0) { 55538 this._setAndBind(child, dataNode); 55539 } else { 55540 uselessNodes.push(child); 55541 } 55542 } 55543 uselessNodes.forEach(node => node[$getParent]()[$removeChild](node)); 55544 } 55545} 55546 55547;// ./src/core/xfa/data.js 55548
vendor: 1,331 bytes, lines 55549-55599
55549 55550class DataHandler { 55551 constructor(root, data) { 55552 this.data = data; 55553 this.dataset = root.datasets || null; 55554 } 55555 serialize(storage) { 55556 const stack = [[-1, this.data[$getChildren]()]]; 55557 while (stack.length > 0) { 55558 const last = stack.at(-1); 55559 const [i, children] = last; 55560 if (i + 1 === children.length) { 55561 stack.pop(); 55562 continue; 55563 } 55564 const child = children[++last[0]]; 55565 const storageEntry = storage.get(child[$uid]); 55566 if (storageEntry) { 55567 child[$setValue](storageEntry); 55568 } else { 55569 const attributes = child[$getAttributes](); 55570 for (const value of attributes.values()) { 55571 const entry = storage.get(value[$uid]); 55572 if (entry) { 55573 value[$setValue](entry); 55574 break; 55575 } 55576 } 55577 } 55578 const nodes = child[$getChildren](); 55579 if (nodes.length > 0) { 55580 stack.push([-1, nodes]); 55581 } 55582 } 55583 const buf = [`<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">`]; 55584 if (this.dataset) { 55585 for (const child of this.dataset[$getChildren]()) { 55586 if (child[$nodeName] !== "data") { 55587 child[$toString](buf); 55588 } 55589 } 55590 } 55591 this.data[$toString](buf); 55592 buf.push("</xfa:datasets>"); 55593 return buf.join(""); 55594 } 55595} 55596 55597;// ./src/core/xfa/config.js 55598 55599
vendor: 23,955 bytes, lines 55600-56502
55600 55601 55602 55603 55604 55605 55606 55607 55608 55609 55610 55611 55612const CONFIG_NS_ID = NamespaceIds.config.id; 55613class Acrobat extends XFAObject { 55614 constructor(attributes) { 55615 super(CONFIG_NS_ID, "acrobat", true); 55616 this.acrobat7 = null; 55617 this.autoSave = null; 55618 this.common = null; 55619 this.validate = null; 55620 this.validateApprovalSignatures = null; 55621 this.submitUrl = new XFAObjectArray(); 55622 } 55623} 55624class Acrobat7 extends XFAObject { 55625 constructor(attributes) { 55626 super(CONFIG_NS_ID, "acrobat7", true); 55627 this.dynamicRender = null; 55628 } 55629} 55630class ADBE_JSConsole extends OptionObject { 55631 constructor(attributes) { 55632 super(CONFIG_NS_ID, "ADBE_JSConsole", ["delegate", "Enable", "Disable"]); 55633 } 55634} 55635class ADBE_JSDebugger extends OptionObject { 55636 constructor(attributes) { 55637 super(CONFIG_NS_ID, "ADBE_JSDebugger", ["delegate", "Enable", "Disable"]); 55638 } 55639} 55640class AddSilentPrint extends Option01 { 55641 constructor(attributes) { 55642 super(CONFIG_NS_ID, "addSilentPrint"); 55643 } 55644} 55645class AddViewerPreferences extends Option01 { 55646 constructor(attributes) { 55647 super(CONFIG_NS_ID, "addViewerPreferences"); 55648 } 55649} 55650class AdjustData extends Option10 { 55651 constructor(attributes) { 55652 super(CONFIG_NS_ID, "adjustData"); 55653 } 55654} 55655class AdobeExtensionLevel extends IntegerObject { 55656 constructor(attributes) { 55657 super(CONFIG_NS_ID, "adobeExtensionLevel", 0, n => n >= 1 && n <= 8); 55658 } 55659} 55660class Agent extends XFAObject { 55661 constructor(attributes) { 55662 super(CONFIG_NS_ID, "agent", true); 55663 this.name = attributes.name ? attributes.name.trim() : ""; 55664 this.common = new XFAObjectArray(); 55665 } 55666} 55667class AlwaysEmbed extends ContentObject { 55668 constructor(attributes) { 55669 super(CONFIG_NS_ID, "alwaysEmbed"); 55670 } 55671} 55672class Amd extends StringObject { 55673 constructor(attributes) { 55674 super(CONFIG_NS_ID, "amd"); 55675 } 55676} 55677class config_Area extends XFAObject { 55678 constructor(attributes) { 55679 super(CONFIG_NS_ID, "area"); 55680 this.level = getInteger({ 55681 data: attributes.level, 55682 defaultValue: 0, 55683 validate: n => n >= 1 && n <= 3 55684 }); 55685 this.name = getStringOption(attributes.name, ["", "barcode", "coreinit", "deviceDriver", "font", "general", "layout", "merge", "script", "signature", "sourceSet", "templateCache"]); 55686 } 55687} 55688class Attributes extends OptionObject { 55689 constructor(attributes) { 55690 super(CONFIG_NS_ID, "attributes", ["preserve", "delegate", "ignore"]); 55691 } 55692} 55693class AutoSave extends OptionObject { 55694 constructor(attributes) { 55695 super(CONFIG_NS_ID, "autoSave", ["disabled", "enabled"]); 55696 } 55697} 55698class Base extends StringObject { 55699 constructor(attributes) { 55700 super(CONFIG_NS_ID, "base"); 55701 } 55702} 55703class BatchOutput extends XFAObject { 55704 constructor(attributes) { 55705 super(CONFIG_NS_ID, "batchOutput"); 55706 this.format = getStringOption(attributes.format, ["none", "concat", "zip", "zipCompress"]); 55707 } 55708} 55709class BehaviorOverride extends ContentObject { 55710 constructor(attributes) { 55711 super(CONFIG_NS_ID, "behaviorOverride"); 55712 } 55713 [$finalize]() { 55714 this[$content] = new Map(this[$content].trim().split(/\s+/).filter(x => x.includes(":")).map(x => x.split(":", 2))); 55715 } 55716} 55717class Cache extends XFAObject { 55718 constructor(attributes) { 55719 super(CONFIG_NS_ID, "cache", true); 55720 this.templateCache = null; 55721 } 55722} 55723class Change extends Option01 { 55724 constructor(attributes) { 55725 super(CONFIG_NS_ID, "change"); 55726 } 55727} 55728class Common extends XFAObject { 55729 constructor(attributes) { 55730 super(CONFIG_NS_ID, "common", true); 55731 this.data = null; 55732 this.locale = null; 55733 this.localeSet = null; 55734 this.messaging = null; 55735 this.suppressBanner = null; 55736 this.template = null; 55737 this.validationMessaging = null; 55738 this.versionControl = null; 55739 this.log = new XFAObjectArray(); 55740 } 55741} 55742class Compress extends XFAObject { 55743 constructor(attributes) { 55744 super(CONFIG_NS_ID, "compress"); 55745 this.scope = getStringOption(attributes.scope, ["imageOnly", "document"]); 55746 } 55747} 55748class CompressLogicalStructure extends Option01 { 55749 constructor(attributes) { 55750 super(CONFIG_NS_ID, "compressLogicalStructure"); 55751 } 55752} 55753class CompressObjectStream extends Option10 { 55754 constructor(attributes) { 55755 super(CONFIG_NS_ID, "compressObjectStream"); 55756 } 55757} 55758class Compression extends XFAObject { 55759 constructor(attributes) { 55760 super(CONFIG_NS_ID, "compression", true); 55761 this.compressLogicalStructure = null; 55762 this.compressObjectStream = null; 55763 this.level = null; 55764 this.type = null; 55765 } 55766} 55767class Config extends XFAObject { 55768 constructor(attributes) { 55769 super(CONFIG_NS_ID, "config", true); 55770 this.acrobat = null; 55771 this.present = null; 55772 this.trace = null; 55773 this.agent = new XFAObjectArray(); 55774 } 55775} 55776class Conformance extends OptionObject { 55777 constructor(attributes) { 55778 super(CONFIG_NS_ID, "conformance", ["A", "B"]); 55779 } 55780} 55781class ContentCopy extends Option01 { 55782 constructor(attributes) { 55783 super(CONFIG_NS_ID, "contentCopy"); 55784 } 55785} 55786class Copies extends IntegerObject { 55787 constructor(attributes) { 55788 super(CONFIG_NS_ID, "copies", 1, n => n >= 1); 55789 } 55790} 55791class Creator extends StringObject { 55792 constructor(attributes) { 55793 super(CONFIG_NS_ID, "creator"); 55794 } 55795} 55796class CurrentPage extends IntegerObject { 55797 constructor(attributes) { 55798 super(CONFIG_NS_ID, "currentPage", 0, n => n >= 0); 55799 } 55800} 55801class Data extends XFAObject { 55802 constructor(attributes) { 55803 super(CONFIG_NS_ID, "data", true); 55804 this.adjustData = null; 55805 this.attributes = null; 55806 this.incrementalLoad = null; 55807 this.outputXSL = null; 55808 this.range = null; 55809 this.record = null; 55810 this.startNode = null; 55811 this.uri = null; 55812 this.window = null; 55813 this.xsl = null; 55814 this.excludeNS = new XFAObjectArray(); 55815 this.transform = new XFAObjectArray(); 55816 } 55817} 55818class Debug extends XFAObject { 55819 constructor(attributes) { 55820 super(CONFIG_NS_ID, "debug", true); 55821 this.uri = null; 55822 } 55823} 55824class DefaultTypeface extends ContentObject { 55825 constructor(attributes) { 55826 super(CONFIG_NS_ID, "defaultTypeface"); 55827 this.writingScript = getStringOption(attributes.writingScript, ["*", "Arabic", "Cyrillic", "EastEuropeanRoman", "Greek", "Hebrew", "Japanese", "Korean", "Roman", "SimplifiedChinese", "Thai", "TraditionalChinese", "Vietnamese"]); 55828 } 55829} 55830class Destination extends OptionObject { 55831 constructor(attributes) { 55832 super(CONFIG_NS_ID, "destination", ["pdf", "pcl", "ps", "webClient", "zpl"]); 55833 } 55834} 55835class DocumentAssembly extends Option01 { 55836 constructor(attributes) { 55837 super(CONFIG_NS_ID, "documentAssembly"); 55838 } 55839} 55840class Driver extends XFAObject { 55841 constructor(attributes) { 55842 super(CONFIG_NS_ID, "driver", true); 55843 this.name = attributes.name ? attributes.name.trim() : ""; 55844 this.fontInfo = null; 55845 this.xdc = null; 55846 } 55847} 55848class DuplexOption extends OptionObject { 55849 constructor(attributes) { 55850 super(CONFIG_NS_ID, "duplexOption", ["simplex", "duplexFlipLongEdge", "duplexFlipShortEdge"]); 55851 } 55852} 55853class DynamicRender extends OptionObject { 55854 constructor(attributes) { 55855 super(CONFIG_NS_ID, "dynamicRender", ["forbidden", "required"]); 55856 } 55857} 55858class Embed extends Option01 { 55859 constructor(attributes) { 55860 super(CONFIG_NS_ID, "embed"); 55861 } 55862} 55863class config_Encrypt extends Option01 { 55864 constructor(attributes) { 55865 super(CONFIG_NS_ID, "encrypt"); 55866 } 55867} 55868class config_Encryption extends XFAObject { 55869 constructor(attributes) { 55870 super(CONFIG_NS_ID, "encryption", true); 55871 this.encrypt = null; 55872 this.encryptionLevel = null; 55873 this.permissions = null; 55874 } 55875} 55876class EncryptionLevel extends OptionObject { 55877 constructor(attributes) { 55878 super(CONFIG_NS_ID, "encryptionLevel", ["40bit", "128bit"]); 55879 } 55880} 55881class Enforce extends StringObject { 55882 constructor(attributes) { 55883 super(CONFIG_NS_ID, "enforce"); 55884 } 55885} 55886class Equate extends XFAObject { 55887 constructor(attributes) { 55888 super(CONFIG_NS_ID, "equate"); 55889 this.force = getInteger({ 55890 data: attributes.force, 55891 defaultValue: 1, 55892 validate: n => n === 0 55893 }); 55894 this.from = attributes.from || ""; 55895 this.to = attributes.to || ""; 55896 } 55897} 55898class EquateRange extends XFAObject { 55899 constructor(attributes) { 55900 super(CONFIG_NS_ID, "equateRange"); 55901 this.from = attributes.from || ""; 55902 this.to = attributes.to || ""; 55903 this._unicodeRange = attributes.unicodeRange || ""; 55904 } 55905 get unicodeRange() { 55906 const ranges = []; 55907 const unicodeRegex = /U\+([0-9a-fA-F]+)/; 55908 const unicodeRange = this._unicodeRange; 55909 for (let range of unicodeRange.split(",").map(x => x.trim()).filter(x => !!x)) { 55910 range = range.split("-", 2).map(x => { 55911 const found = x.match(unicodeRegex); 55912 if (!found) { 55913 return 0; 55914 } 55915 return parseInt(found[1], 16); 55916 }); 55917 if (range.length === 1) { 55918 range.push(range[0]); 55919 } 55920 ranges.push(range); 55921 } 55922 return shadow(this, "unicodeRange", ranges); 55923 } 55924} 55925class Exclude extends ContentObject { 55926 constructor(attributes) { 55927 super(CONFIG_NS_ID, "exclude"); 55928 } 55929 [$finalize]() { 55930 this[$content] = this[$content].trim().split(/\s+/).filter(x => x && ["calculate", "close", "enter", "exit", "initialize", "ready", "validate"].includes(x)); 55931 } 55932} 55933class ExcludeNS extends StringObject { 55934 constructor(attributes) { 55935 super(CONFIG_NS_ID, "excludeNS"); 55936 } 55937} 55938class FlipLabel extends OptionObject { 55939 constructor(attributes) { 55940 super(CONFIG_NS_ID, "flipLabel", ["usePrinterSetting", "on", "off"]); 55941 } 55942} 55943class config_FontInfo extends XFAObject { 55944 constructor(attributes) { 55945 super(CONFIG_NS_ID, "fontInfo", true); 55946 this.embed = null; 55947 this.map = null; 55948 this.subsetBelow = null; 55949 this.alwaysEmbed = new XFAObjectArray(); 55950 this.defaultTypeface = new XFAObjectArray(); 55951 this.neverEmbed = new XFAObjectArray(); 55952 } 55953} 55954class FormFieldFilling extends Option01 { 55955 constructor(attributes) { 55956 super(CONFIG_NS_ID, "formFieldFilling"); 55957 } 55958} 55959class GroupParent extends StringObject { 55960 constructor(attributes) { 55961 super(CONFIG_NS_ID, "groupParent"); 55962 } 55963} 55964class IfEmpty extends OptionObject { 55965 constructor(attributes) { 55966 super(CONFIG_NS_ID, "ifEmpty", ["dataValue", "dataGroup", "ignore", "remove"]); 55967 } 55968} 55969class IncludeXDPContent extends StringObject { 55970 constructor(attributes) { 55971 super(CONFIG_NS_ID, "includeXDPContent"); 55972 } 55973} 55974class IncrementalLoad extends OptionObject { 55975 constructor(attributes) { 55976 super(CONFIG_NS_ID, "incrementalLoad", ["none", "forwardOnly"]); 55977 } 55978} 55979class IncrementalMerge extends Option01 { 55980 constructor(attributes) { 55981 super(CONFIG_NS_ID, "incrementalMerge"); 55982 } 55983} 55984class Interactive extends Option01 { 55985 constructor(attributes) { 55986 super(CONFIG_NS_ID, "interactive"); 55987 } 55988} 55989class Jog extends OptionObject { 55990 constructor(attributes) { 55991 super(CONFIG_NS_ID, "jog", ["usePrinterSetting", "none", "pageSet"]); 55992 } 55993} 55994class LabelPrinter extends XFAObject { 55995 constructor(attributes) { 55996 super(CONFIG_NS_ID, "labelPrinter", true); 55997 this.name = getStringOption(attributes.name, ["zpl", "dpl", "ipl", "tcpl"]); 55998 this.batchOutput = null; 55999 this.flipLabel = null; 56000 this.fontInfo = null; 56001 this.xdc = null; 56002 } 56003} 56004class Layout extends OptionObject { 56005 constructor(attributes) { 56006 super(CONFIG_NS_ID, "layout", ["paginate", "panel"]); 56007 } 56008} 56009class Level extends IntegerObject { 56010 constructor(attributes) { 56011 super(CONFIG_NS_ID, "level", 0, n => n > 0); 56012 } 56013} 56014class Linearized extends Option01 { 56015 constructor(attributes) { 56016 super(CONFIG_NS_ID, "linearized"); 56017 } 56018} 56019class Locale extends StringObject { 56020 constructor(attributes) { 56021 super(CONFIG_NS_ID, "locale"); 56022 } 56023} 56024class LocaleSet extends StringObject { 56025 constructor(attributes) { 56026 super(CONFIG_NS_ID, "localeSet"); 56027 } 56028} 56029class Log extends XFAObject { 56030 constructor(attributes) { 56031 super(CONFIG_NS_ID, "log", true); 56032 this.mode = null; 56033 this.threshold = null; 56034 this.to = null; 56035 this.uri = null; 56036 } 56037} 56038class MapElement extends XFAObject { 56039 constructor(attributes) { 56040 super(CONFIG_NS_ID, "map", true); 56041 this.equate = new XFAObjectArray(); 56042 this.equateRange = new XFAObjectArray(); 56043 } 56044} 56045class MediumInfo extends XFAObject { 56046 constructor(attributes) { 56047 super(CONFIG_NS_ID, "mediumInfo", true); 56048 this.map = null; 56049 } 56050} 56051class config_Message extends XFAObject { 56052 constructor(attributes) { 56053 super(CONFIG_NS_ID, "message", true); 56054 this.msgId = null; 56055 this.severity = null; 56056 } 56057} 56058class Messaging extends XFAObject { 56059 constructor(attributes) { 56060 super(CONFIG_NS_ID, "messaging", true); 56061 this.message = new XFAObjectArray(); 56062 } 56063} 56064class Mode extends OptionObject { 56065 constructor(attributes) { 56066 super(CONFIG_NS_ID, "mode", ["append", "overwrite"]); 56067 } 56068} 56069class ModifyAnnots extends Option01 { 56070 constructor(attributes) { 56071 super(CONFIG_NS_ID, "modifyAnnots"); 56072 } 56073} 56074class MsgId extends IntegerObject { 56075 constructor(attributes) { 56076 super(CONFIG_NS_ID, "msgId", 1, n => n >= 1); 56077 } 56078} 56079class NameAttr extends StringObject { 56080 constructor(attributes) { 56081 super(CONFIG_NS_ID, "nameAttr"); 56082 } 56083} 56084class NeverEmbed extends ContentObject { 56085 constructor(attributes) { 56086 super(CONFIG_NS_ID, "neverEmbed"); 56087 } 56088} 56089class NumberOfCopies extends IntegerObject { 56090 constructor(attributes) { 56091 super(CONFIG_NS_ID, "numberOfCopies", null, n => n >= 2 && n <= 5); 56092 } 56093} 56094class OpenAction extends XFAObject { 56095 constructor(attributes) { 56096 super(CONFIG_NS_ID, "openAction", true); 56097 this.destination = null; 56098 } 56099} 56100class Output extends XFAObject { 56101 constructor(attributes) { 56102 super(CONFIG_NS_ID, "output", true); 56103 this.to = null; 56104 this.type = null; 56105 this.uri = null; 56106 } 56107} 56108class OutputBin extends StringObject { 56109 constructor(attributes) { 56110 super(CONFIG_NS_ID, "outputBin"); 56111 } 56112} 56113class OutputXSL extends XFAObject { 56114 constructor(attributes) { 56115 super(CONFIG_NS_ID, "outputXSL", true); 56116 this.uri = null; 56117 } 56118} 56119class Overprint extends OptionObject { 56120 constructor(attributes) { 56121 super(CONFIG_NS_ID, "overprint", ["none", "both", "draw", "field"]); 56122 } 56123} 56124class Packets extends StringObject { 56125 constructor(attributes) { 56126 super(CONFIG_NS_ID, "packets"); 56127 } 56128 [$finalize]() { 56129 if (this[$content] === "*") { 56130 return; 56131 } 56132 this[$content] = this[$content].trim().split(/\s+/).filter(x => ["config", "datasets", "template", "xfdf", "xslt"].includes(x)); 56133 } 56134} 56135class PageOffset extends XFAObject { 56136 constructor(attributes) { 56137 super(CONFIG_NS_ID, "pageOffset"); 56138 this.x = getInteger({ 56139 data: attributes.x, 56140 defaultValue: "useXDCSetting", 56141 validate: n => true 56142 }); 56143 this.y = getInteger({ 56144 data: attributes.y, 56145 defaultValue: "useXDCSetting", 56146 validate: n => true 56147 }); 56148 } 56149} 56150class PageRange extends StringObject { 56151 constructor(attributes) { 56152 super(CONFIG_NS_ID, "pageRange"); 56153 } 56154 [$finalize]() { 56155 const numbers = this[$content].trim().split(/\s+/).map(x => parseInt(x, 10)); 56156 const ranges = []; 56157 for (let i = 0, ii = numbers.length; i < ii; i += 2) { 56158 ranges.push(numbers.slice(i, i + 2)); 56159 } 56160 this[$content] = ranges; 56161 } 56162} 56163class Pagination extends OptionObject { 56164 constructor(attributes) { 56165 super(CONFIG_NS_ID, "pagination", ["simplex", "duplexShortEdge", "duplexLongEdge"]); 56166 } 56167} 56168class PaginationOverride extends OptionObject { 56169 constructor(attributes) { 56170 super(CONFIG_NS_ID, "paginationOverride", ["none", "forceDuplex", "forceDuplexLongEdge", "forceDuplexShortEdge", "forceSimplex"]); 56171 } 56172} 56173class Part extends IntegerObject { 56174 constructor(attributes) { 56175 super(CONFIG_NS_ID, "part", 1, n => false); 56176 } 56177} 56178class Pcl extends XFAObject { 56179 constructor(attributes) { 56180 super(CONFIG_NS_ID, "pcl", true); 56181 this.name = attributes.name || ""; 56182 this.batchOutput = null; 56183 this.fontInfo = null; 56184 this.jog = null; 56185 this.mediumInfo = null; 56186 this.outputBin = null; 56187 this.pageOffset = null; 56188 this.staple = null; 56189 this.xdc = null; 56190 } 56191} 56192class Pdf extends XFAObject { 56193 constructor(attributes) { 56194 super(CONFIG_NS_ID, "pdf", true); 56195 this.name = attributes.name || ""; 56196 this.adobeExtensionLevel = null; 56197 this.batchOutput = null; 56198 this.compression = null; 56199 this.creator = null; 56200 this.encryption = null; 56201 this.fontInfo = null; 56202 this.interactive = null; 56203 this.linearized = null; 56204 this.openAction = null; 56205 this.pdfa = null; 56206 this.producer = null; 56207 this.renderPolicy = null; 56208 this.scriptModel = null; 56209 this.silentPrint = null; 56210 this.submitFormat = null; 56211 this.tagged = null; 56212 this.version = null; 56213 this.viewerPreferences = null; 56214 this.xdc = null; 56215 } 56216} 56217class Pdfa extends XFAObject { 56218 constructor(attributes) { 56219 super(CONFIG_NS_ID, "pdfa", true); 56220 this.amd = null; 56221 this.conformance = null; 56222 this.includeXDPContent = null; 56223 this.part = null; 56224 } 56225} 56226class Permissions extends XFAObject { 56227 constructor(attributes) { 56228 super(CONFIG_NS_ID, "permissions", true); 56229 this.accessibleContent = null; 56230 this.change = null; 56231 this.contentCopy = null; 56232 this.documentAssembly = null; 56233 this.formFieldFilling = null; 56234 this.modifyAnnots = null; 56235 this.plaintextMetadata = null; 56236 this.print = null; 56237 this.printHighQuality = null; 56238 } 56239} 56240class PickTrayByPDFSize extends Option01 { 56241 constructor(attributes) { 56242 super(CONFIG_NS_ID, "pickTrayByPDFSize"); 56243 } 56244} 56245class config_Picture extends StringObject { 56246 constructor(attributes) { 56247 super(CONFIG_NS_ID, "picture"); 56248 } 56249} 56250class PlaintextMetadata extends Option01 { 56251 constructor(attributes) { 56252 super(CONFIG_NS_ID, "plaintextMetadata"); 56253 } 56254} 56255class Presence extends OptionObject { 56256 constructor(attributes) { 56257 super(CONFIG_NS_ID, "presence", ["preserve", "dissolve", "dissolveStructure", "ignore", "remove"]); 56258 } 56259} 56260class Present extends XFAObject { 56261 constructor(attributes) { 56262 super(CONFIG_NS_ID, "present", true); 56263 this.behaviorOverride = null; 56264 this.cache = null; 56265 this.common = null; 56266 this.copies = null; 56267 this.destination = null; 56268 this.incrementalMerge = null; 56269 this.layout = null; 56270 this.output = null; 56271 this.overprint = null; 56272 this.pagination = null; 56273 this.paginationOverride = null; 56274 this.script = null; 56275 this.validate = null; 56276 this.xdp = null; 56277 this.driver = new XFAObjectArray(); 56278 this.labelPrinter = new XFAObjectArray(); 56279 this.pcl = new XFAObjectArray(); 56280 this.pdf = new XFAObjectArray(); 56281 this.ps = new XFAObjectArray(); 56282 this.submitUrl = new XFAObjectArray(); 56283 this.webClient = new XFAObjectArray(); 56284 this.zpl = new XFAObjectArray(); 56285 } 56286} 56287class Print extends Option01 { 56288 constructor(attributes) { 56289 super(CONFIG_NS_ID, "print"); 56290 } 56291} 56292class PrintHighQuality extends Option01 { 56293 constructor(attributes) { 56294 super(CONFIG_NS_ID, "printHighQuality"); 56295 } 56296} 56297class PrintScaling extends OptionObject { 56298 constructor(attributes) { 56299 super(CONFIG_NS_ID, "printScaling", ["appdefault", "noScaling"]); 56300 } 56301} 56302class PrinterName extends StringObject { 56303 constructor(attributes) { 56304 super(CONFIG_NS_ID, "printerName"); 56305 } 56306} 56307class Producer extends StringObject { 56308 constructor(attributes) { 56309 super(CONFIG_NS_ID, "producer"); 56310 } 56311} 56312class Ps extends XFAObject { 56313 constructor(attributes) { 56314 super(CONFIG_NS_ID, "ps", true); 56315 this.name = attributes.name || ""; 56316 this.batchOutput = null; 56317 this.fontInfo = null; 56318 this.jog = null; 56319 this.mediumInfo = null; 56320 this.outputBin = null; 56321 this.staple = null; 56322 this.xdc = null; 56323 } 56324} 56325class Range extends ContentObject { 56326 constructor(attributes) { 56327 super(CONFIG_NS_ID, "range"); 56328 } 56329 [$finalize]() { 56330 this[$content] = this[$content].split(",", 2).map(range => range.split("-").map(x => parseInt(x.trim(), 10))).filter(range => range.every(x => !isNaN(x))).map(range => { 56331 if (range.length === 1) { 56332 range.push(range[0]); 56333 } 56334 return range; 56335 }); 56336 } 56337} 56338class Record extends ContentObject { 56339 constructor(attributes) { 56340 super(CONFIG_NS_ID, "record"); 56341 } 56342 [$finalize]() { 56343 this[$content] = this[$content].trim(); 56344 const n = parseInt(this[$content], 10); 56345 if (!isNaN(n) && n >= 0) { 56346 this[$content] = n; 56347 } 56348 } 56349} 56350class Relevant extends ContentObject { 56351 constructor(attributes) { 56352 super(CONFIG_NS_ID, "relevant"); 56353 } 56354 [$finalize]() { 56355 this[$content] = this[$content].trim().split(/\s+/); 56356 } 56357} 56358class Rename extends ContentObject { 56359 constructor(attributes) { 56360 super(CONFIG_NS_ID, "rename"); 56361 } 56362 [$finalize]() { 56363 this[$content] = this[$content].trim(); 56364 if (this[$content].toLowerCase().startsWith("xml") || new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*", "u").test(this[$content])) { 56365 warn("XFA - Rename: invalid XFA name"); 56366 } 56367 } 56368} 56369class RenderPolicy extends OptionObject { 56370 constructor(attributes) { 56371 super(CONFIG_NS_ID, "renderPolicy", ["server", "client"]); 56372 } 56373} 56374class RunScripts extends OptionObject { 56375 constructor(attributes) { 56376 super(CONFIG_NS_ID, "runScripts", ["both", "client", "none", "server"]); 56377 } 56378} 56379class config_Script extends XFAObject { 56380 constructor(attributes) { 56381 super(CONFIG_NS_ID, "script", true); 56382 this.currentPage = null; 56383 this.exclude = null; 56384 this.runScripts = null; 56385 } 56386} 56387class ScriptModel extends OptionObject { 56388 constructor(attributes) { 56389 super(CONFIG_NS_ID, "scriptModel", ["XFA", "none"]); 56390 } 56391} 56392class Severity extends OptionObject { 56393 constructor(attributes) { 56394 super(CONFIG_NS_ID, "severity", ["ignore", "error", "information", "trace", "warning"]); 56395 } 56396} 56397class SilentPrint extends XFAObject { 56398 constructor(attributes) { 56399 super(CONFIG_NS_ID, "silentPrint", true); 56400 this.addSilentPrint = null; 56401 this.printerName = null; 56402 } 56403} 56404class Staple extends XFAObject { 56405 constructor(attributes) { 56406 super(CONFIG_NS_ID, "staple"); 56407 this.mode = getStringOption(attributes.mode, ["usePrinterSetting", "on", "off"]); 56408 } 56409} 56410class StartNode extends StringObject { 56411 constructor(attributes) { 56412 super(CONFIG_NS_ID, "startNode"); 56413 } 56414} 56415class StartPage extends IntegerObject { 56416 constructor(attributes) { 56417 super(CONFIG_NS_ID, "startPage", 0, n => true); 56418 } 56419} 56420class SubmitFormat extends OptionObject { 56421 constructor(attributes) { 56422 super(CONFIG_NS_ID, "submitFormat", ["html", "delegate", "fdf", "xml", "pdf"]); 56423 } 56424} 56425class SubmitUrl extends StringObject { 56426 constructor(attributes) { 56427 super(CONFIG_NS_ID, "submitUrl"); 56428 } 56429} 56430class SubsetBelow extends IntegerObject { 56431 constructor(attributes) { 56432 super(CONFIG_NS_ID, "subsetBelow", 100, n => n >= 0 && n <= 100); 56433 } 56434} 56435class SuppressBanner extends Option01 { 56436 constructor(attributes) { 56437 super(CONFIG_NS_ID, "suppressBanner"); 56438 } 56439} 56440class Tagged extends Option01 { 56441 constructor(attributes) { 56442 super(CONFIG_NS_ID, "tagged"); 56443 } 56444} 56445class config_Template extends XFAObject { 56446 constructor(attributes) { 56447 super(CONFIG_NS_ID, "template", true); 56448 this.base = null; 56449 this.relevant = null; 56450 this.startPage = null; 56451 this.uri = null; 56452 this.xsl = null; 56453 } 56454} 56455class Threshold extends OptionObject { 56456 constructor(attributes) { 56457 super(CONFIG_NS_ID, "threshold", ["trace", "error", "information", "warning"]); 56458 } 56459} 56460class To extends OptionObject { 56461 constructor(attributes) { 56462 super(CONFIG_NS_ID, "to", ["null", "memory", "stderr", "stdout", "system", "uri"]); 56463 } 56464} 56465class TemplateCache extends XFAObject { 56466 constructor(attributes) { 56467 super(CONFIG_NS_ID, "templateCache"); 56468 this.maxEntries = getInteger({ 56469 data: attributes.maxEntries, 56470 defaultValue: 5, 56471 validate: n => n >= 0 56472 }); 56473 } 56474} 56475class Trace extends XFAObject { 56476 constructor(attributes) { 56477 super(CONFIG_NS_ID, "trace", true); 56478 this.area = new XFAObjectArray(); 56479 } 56480} 56481class Transform extends XFAObject { 56482 constructor(attributes) { 56483 super(CONFIG_NS_ID, "transform", true); 56484 this.groupParent = null; 56485 this.ifEmpty = null; 56486 this.nameAttr = null; 56487 this.picture = null; 56488 this.presence = null; 56489 this.rename = null; 56490 this.whitespace = null; 56491 } 56492} 56493class Type extends OptionObject { 56494 constructor(attributes) { 56495 super(CONFIG_NS_ID, "type", ["none", "ascii85", "asciiHex", "ccittfax", "flate", "lzw", "runLength", "native", "xdp", "mergedXDP"]); 56496 } 56497} 56498class Uri extends StringObject { 56499 constructor(attributes) { 56500 super(CONFIG_NS_ID, "uri"); 56501 } 56502}
vendor: 26,649 bytes, lines 56503-57565
56503class config_Validate extends OptionObject { 56504 constructor(attributes) { 56505 super(CONFIG_NS_ID, "validate", ["preSubmit", "prePrint", "preExecute", "preSave"]); 56506 } 56507} 56508class ValidateApprovalSignatures extends ContentObject { 56509 constructor(attributes) { 56510 super(CONFIG_NS_ID, "validateApprovalSignatures"); 56511 } 56512 [$finalize]() { 56513 this[$content] = this[$content].trim().split(/\s+/).filter(x => ["docReady", "postSign"].includes(x)); 56514 } 56515} 56516class ValidationMessaging extends OptionObject { 56517 constructor(attributes) { 56518 super(CONFIG_NS_ID, "validationMessaging", ["allMessagesIndividually", "allMessagesTogether", "firstMessageOnly", "noMessages"]); 56519 } 56520} 56521class Version extends OptionObject { 56522 constructor(attributes) { 56523 super(CONFIG_NS_ID, "version", ["1.7", "1.6", "1.5", "1.4", "1.3", "1.2"]); 56524 } 56525} 56526class VersionControl extends XFAObject { 56527 constructor(attributes) { 56528 super(CONFIG_NS_ID, "VersionControl"); 56529 this.outputBelow = getStringOption(attributes.outputBelow, ["warn", "error", "update"]); 56530 this.sourceAbove = getStringOption(attributes.sourceAbove, ["warn", "error"]); 56531 this.sourceBelow = getStringOption(attributes.sourceBelow, ["update", "maintain"]); 56532 } 56533} 56534class ViewerPreferences extends XFAObject { 56535 constructor(attributes) { 56536 super(CONFIG_NS_ID, "viewerPreferences", true); 56537 this.ADBE_JSConsole = null; 56538 this.ADBE_JSDebugger = null; 56539 this.addViewerPreferences = null; 56540 this.duplexOption = null; 56541 this.enforce = null; 56542 this.numberOfCopies = null; 56543 this.pageRange = null; 56544 this.pickTrayByPDFSize = null; 56545 this.printScaling = null; 56546 } 56547} 56548class WebClient extends XFAObject { 56549 constructor(attributes) { 56550 super(CONFIG_NS_ID, "webClient", true); 56551 this.name = attributes.name ? attributes.name.trim() : ""; 56552 this.fontInfo = null; 56553 this.xdc = null; 56554 } 56555} 56556class Whitespace extends OptionObject { 56557 constructor(attributes) { 56558 super(CONFIG_NS_ID, "whitespace", ["preserve", "ltrim", "normalize", "rtrim", "trim"]); 56559 } 56560} 56561class Window extends ContentObject { 56562 constructor(attributes) { 56563 super(CONFIG_NS_ID, "window"); 56564 } 56565 [$finalize]() { 56566 const pair = this[$content].split(",", 2).map(x => parseInt(x.trim(), 10)); 56567 if (pair.some(x => isNaN(x))) { 56568 this[$content] = [0, 0]; 56569 return; 56570 } 56571 if (pair.length === 1) { 56572 pair.push(pair[0]); 56573 } 56574 this[$content] = pair; 56575 } 56576} 56577class Xdc extends XFAObject { 56578 constructor(attributes) { 56579 super(CONFIG_NS_ID, "xdc", true); 56580 this.uri = new XFAObjectArray(); 56581 this.xsl = new XFAObjectArray(); 56582 } 56583} 56584class Xdp extends XFAObject { 56585 constructor(attributes) { 56586 super(CONFIG_NS_ID, "xdp", true); 56587 this.packets = null; 56588 } 56589} 56590class Xsl extends XFAObject { 56591 constructor(attributes) { 56592 super(CONFIG_NS_ID, "xsl", true); 56593 this.debug = null; 56594 this.uri = null; 56595 } 56596} 56597class Zpl extends XFAObject { 56598 constructor(attributes) { 56599 super(CONFIG_NS_ID, "zpl", true); 56600 this.name = attributes.name ? attributes.name.trim() : ""; 56601 this.batchOutput = null; 56602 this.flipLabel = null; 56603 this.fontInfo = null; 56604 this.xdc = null; 56605 } 56606} 56607class ConfigNamespace { 56608 static [$buildXFAObject](name, attributes) { 56609 if (Object.hasOwn(ConfigNamespace, name)) { 56610 return ConfigNamespace[name](attributes); 56611 } 56612 return undefined; 56613 } 56614 static acrobat(attrs) { 56615 return new Acrobat(attrs); 56616 } 56617 static acrobat7(attrs) { 56618 return new Acrobat7(attrs); 56619 } 56620 static ADBE_JSConsole(attrs) { 56621 return new ADBE_JSConsole(attrs); 56622 } 56623 static ADBE_JSDebugger(attrs) { 56624 return new ADBE_JSDebugger(attrs); 56625 } 56626 static addSilentPrint(attrs) { 56627 return new AddSilentPrint(attrs); 56628 } 56629 static addViewerPreferences(attrs) { 56630 return new AddViewerPreferences(attrs); 56631 } 56632 static adjustData(attrs) { 56633 return new AdjustData(attrs); 56634 } 56635 static adobeExtensionLevel(attrs) { 56636 return new AdobeExtensionLevel(attrs); 56637 } 56638 static agent(attrs) { 56639 return new Agent(attrs); 56640 } 56641 static alwaysEmbed(attrs) { 56642 return new AlwaysEmbed(attrs); 56643 } 56644 static amd(attrs) { 56645 return new Amd(attrs); 56646 } 56647 static area(attrs) { 56648 return new config_Area(attrs); 56649 } 56650 static attributes(attrs) { 56651 return new Attributes(attrs); 56652 } 56653 static autoSave(attrs) { 56654 return new AutoSave(attrs); 56655 } 56656 static base(attrs) { 56657 return new Base(attrs); 56658 } 56659 static batchOutput(attrs) { 56660 return new BatchOutput(attrs); 56661 } 56662 static behaviorOverride(attrs) { 56663 return new BehaviorOverride(attrs); 56664 } 56665 static cache(attrs) { 56666 return new Cache(attrs); 56667 } 56668 static change(attrs) { 56669 return new Change(attrs); 56670 } 56671 static common(attrs) { 56672 return new Common(attrs); 56673 } 56674 static compress(attrs) { 56675 return new Compress(attrs); 56676 } 56677 static compressLogicalStructure(attrs) { 56678 return new CompressLogicalStructure(attrs); 56679 } 56680 static compressObjectStream(attrs) { 56681 return new CompressObjectStream(attrs); 56682 } 56683 static compression(attrs) { 56684 return new Compression(attrs); 56685 } 56686 static config(attrs) { 56687 return new Config(attrs); 56688 } 56689 static conformance(attrs) { 56690 return new Conformance(attrs); 56691 } 56692 static contentCopy(attrs) { 56693 return new ContentCopy(attrs); 56694 } 56695 static copies(attrs) { 56696 return new Copies(attrs); 56697 } 56698 static creator(attrs) { 56699 return new Creator(attrs); 56700 } 56701 static currentPage(attrs) { 56702 return new CurrentPage(attrs); 56703 } 56704 static data(attrs) { 56705 return new Data(attrs); 56706 } 56707 static debug(attrs) { 56708 return new Debug(attrs); 56709 } 56710 static defaultTypeface(attrs) { 56711 return new DefaultTypeface(attrs); 56712 } 56713 static destination(attrs) { 56714 return new Destination(attrs); 56715 } 56716 static documentAssembly(attrs) { 56717 return new DocumentAssembly(attrs); 56718 } 56719 static driver(attrs) { 56720 return new Driver(attrs); 56721 } 56722 static duplexOption(attrs) { 56723 return new DuplexOption(attrs); 56724 } 56725 static dynamicRender(attrs) { 56726 return new DynamicRender(attrs); 56727 } 56728 static embed(attrs) { 56729 return new Embed(attrs); 56730 } 56731 static encrypt(attrs) { 56732 return new config_Encrypt(attrs); 56733 } 56734 static encryption(attrs) { 56735 return new config_Encryption(attrs); 56736 } 56737 static encryptionLevel(attrs) { 56738 return new EncryptionLevel(attrs); 56739 } 56740 static enforce(attrs) { 56741 return new Enforce(attrs); 56742 } 56743 static equate(attrs) { 56744 return new Equate(attrs); 56745 } 56746 static equateRange(attrs) { 56747 return new EquateRange(attrs); 56748 } 56749 static exclude(attrs) { 56750 return new Exclude(attrs); 56751 } 56752 static excludeNS(attrs) { 56753 return new ExcludeNS(attrs); 56754 } 56755 static flipLabel(attrs) { 56756 return new FlipLabel(attrs); 56757 } 56758 static fontInfo(attrs) { 56759 return new config_FontInfo(attrs); 56760 } 56761 static formFieldFilling(attrs) { 56762 return new FormFieldFilling(attrs); 56763 } 56764 static groupParent(attrs) { 56765 return new GroupParent(attrs); 56766 } 56767 static ifEmpty(attrs) { 56768 return new IfEmpty(attrs); 56769 } 56770 static includeXDPContent(attrs) { 56771 return new IncludeXDPContent(attrs); 56772 } 56773 static incrementalLoad(attrs) { 56774 return new IncrementalLoad(attrs); 56775 } 56776 static incrementalMerge(attrs) { 56777 return new IncrementalMerge(attrs); 56778 } 56779 static interactive(attrs) { 56780 return new Interactive(attrs); 56781 } 56782 static jog(attrs) { 56783 return new Jog(attrs); 56784 } 56785 static labelPrinter(attrs) { 56786 return new LabelPrinter(attrs); 56787 } 56788 static layout(attrs) { 56789 return new Layout(attrs); 56790 } 56791 static level(attrs) { 56792 return new Level(attrs); 56793 } 56794 static linearized(attrs) { 56795 return new Linearized(attrs); 56796 } 56797 static locale(attrs) { 56798 return new Locale(attrs); 56799 } 56800 static localeSet(attrs) { 56801 return new LocaleSet(attrs); 56802 } 56803 static log(attrs) { 56804 return new Log(attrs); 56805 } 56806 static map(attrs) { 56807 return new MapElement(attrs); 56808 } 56809 static mediumInfo(attrs) { 56810 return new MediumInfo(attrs); 56811 } 56812 static message(attrs) { 56813 return new config_Message(attrs); 56814 } 56815 static messaging(attrs) { 56816 return new Messaging(attrs); 56817 } 56818 static mode(attrs) { 56819 return new Mode(attrs); 56820 } 56821 static modifyAnnots(attrs) { 56822 return new ModifyAnnots(attrs); 56823 } 56824 static msgId(attrs) { 56825 return new MsgId(attrs); 56826 } 56827 static nameAttr(attrs) { 56828 return new NameAttr(attrs); 56829 } 56830 static neverEmbed(attrs) { 56831 return new NeverEmbed(attrs); 56832 } 56833 static numberOfCopies(attrs) { 56834 return new NumberOfCopies(attrs); 56835 } 56836 static openAction(attrs) { 56837 return new OpenAction(attrs); 56838 } 56839 static output(attrs) { 56840 return new Output(attrs); 56841 } 56842 static outputBin(attrs) { 56843 return new OutputBin(attrs); 56844 } 56845 static outputXSL(attrs) { 56846 return new OutputXSL(attrs); 56847 } 56848 static overprint(attrs) { 56849 return new Overprint(attrs); 56850 } 56851 static packets(attrs) { 56852 return new Packets(attrs); 56853 } 56854 static pageOffset(attrs) { 56855 return new PageOffset(attrs); 56856 } 56857 static pageRange(attrs) { 56858 return new PageRange(attrs); 56859 } 56860 static pagination(attrs) { 56861 return new Pagination(attrs); 56862 } 56863 static paginationOverride(attrs) { 56864 return new PaginationOverride(attrs); 56865 } 56866 static part(attrs) { 56867 return new Part(attrs); 56868 } 56869 static pcl(attrs) { 56870 return new Pcl(attrs); 56871 } 56872 static pdf(attrs) { 56873 return new Pdf(attrs); 56874 } 56875 static pdfa(attrs) { 56876 return new Pdfa(attrs); 56877 } 56878 static permissions(attrs) { 56879 return new Permissions(attrs); 56880 } 56881 static pickTrayByPDFSize(attrs) { 56882 return new PickTrayByPDFSize(attrs); 56883 } 56884 static picture(attrs) { 56885 return new config_Picture(attrs); 56886 } 56887 static plaintextMetadata(attrs) { 56888 return new PlaintextMetadata(attrs); 56889 } 56890 static presence(attrs) { 56891 return new Presence(attrs); 56892 } 56893 static present(attrs) { 56894 return new Present(attrs); 56895 } 56896 static print(attrs) { 56897 return new Print(attrs); 56898 } 56899 static printHighQuality(attrs) { 56900 return new PrintHighQuality(attrs); 56901 } 56902 static printScaling(attrs) { 56903 return new PrintScaling(attrs); 56904 } 56905 static printerName(attrs) { 56906 return new PrinterName(attrs); 56907 } 56908 static producer(attrs) { 56909 return new Producer(attrs); 56910 } 56911 static ps(attrs) { 56912 return new Ps(attrs); 56913 } 56914 static range(attrs) { 56915 return new Range(attrs); 56916 } 56917 static record(attrs) { 56918 return new Record(attrs); 56919 } 56920 static relevant(attrs) { 56921 return new Relevant(attrs); 56922 } 56923 static rename(attrs) { 56924 return new Rename(attrs); 56925 } 56926 static renderPolicy(attrs) { 56927 return new RenderPolicy(attrs); 56928 } 56929 static runScripts(attrs) { 56930 return new RunScripts(attrs); 56931 } 56932 static script(attrs) { 56933 return new config_Script(attrs); 56934 } 56935 static scriptModel(attrs) { 56936 return new ScriptModel(attrs); 56937 } 56938 static severity(attrs) { 56939 return new Severity(attrs); 56940 } 56941 static silentPrint(attrs) { 56942 return new SilentPrint(attrs); 56943 } 56944 static staple(attrs) { 56945 return new Staple(attrs); 56946 } 56947 static startNode(attrs) { 56948 return new StartNode(attrs); 56949 } 56950 static startPage(attrs) { 56951 return new StartPage(attrs); 56952 } 56953 static submitFormat(attrs) { 56954 return new SubmitFormat(attrs); 56955 } 56956 static submitUrl(attrs) { 56957 return new SubmitUrl(attrs); 56958 } 56959 static subsetBelow(attrs) { 56960 return new SubsetBelow(attrs); 56961 } 56962 static suppressBanner(attrs) { 56963 return new SuppressBanner(attrs); 56964 } 56965 static tagged(attrs) { 56966 return new Tagged(attrs); 56967 } 56968 static template(attrs) { 56969 return new config_Template(attrs); 56970 } 56971 static templateCache(attrs) { 56972 return new TemplateCache(attrs); 56973 } 56974 static threshold(attrs) { 56975 return new Threshold(attrs); 56976 } 56977 static to(attrs) { 56978 return new To(attrs); 56979 } 56980 static trace(attrs) { 56981 return new Trace(attrs); 56982 } 56983 static transform(attrs) { 56984 return new Transform(attrs); 56985 } 56986 static type(attrs) { 56987 return new Type(attrs); 56988 } 56989 static uri(attrs) { 56990 return new Uri(attrs); 56991 } 56992 static validate(attrs) { 56993 return new config_Validate(attrs); 56994 } 56995 static validateApprovalSignatures(attrs) { 56996 return new ValidateApprovalSignatures(attrs); 56997 } 56998 static validationMessaging(attrs) { 56999 return new ValidationMessaging(attrs); 57000 } 57001 static version(attrs) { 57002 return new Version(attrs); 57003 } 57004 static versionControl(attrs) { 57005 return new VersionControl(attrs); 57006 } 57007 static viewerPreferences(attrs) { 57008 return new ViewerPreferences(attrs); 57009 } 57010 static webClient(attrs) { 57011 return new WebClient(attrs); 57012 } 57013 static whitespace(attrs) { 57014 return new Whitespace(attrs); 57015 } 57016 static window(attrs) { 57017 return new Window(attrs); 57018 } 57019 static xdc(attrs) { 57020 return new Xdc(attrs); 57021 } 57022 static xdp(attrs) { 57023 return new Xdp(attrs); 57024 } 57025 static xsl(attrs) { 57026 return new Xsl(attrs); 57027 } 57028 static zpl(attrs) { 57029 return new Zpl(attrs); 57030 } 57031} 57032 57033;// ./src/core/xfa/connection_set.js 57034 57035 57036const CONNECTION_SET_NS_ID = NamespaceIds.connectionSet.id; 57037class ConnectionSet extends XFAObject { 57038 constructor(attributes) { 57039 super(CONNECTION_SET_NS_ID, "connectionSet", true); 57040 this.wsdlConnection = new XFAObjectArray(); 57041 this.xmlConnection = new XFAObjectArray(); 57042 this.xsdConnection = new XFAObjectArray(); 57043 } 57044} 57045class EffectiveInputPolicy extends XFAObject { 57046 constructor(attributes) { 57047 super(CONNECTION_SET_NS_ID, "effectiveInputPolicy"); 57048 this.id = attributes.id || ""; 57049 this.name = attributes.name || ""; 57050 this.use = attributes.use || ""; 57051 this.usehref = attributes.usehref || ""; 57052 } 57053} 57054class EffectiveOutputPolicy extends XFAObject { 57055 constructor(attributes) { 57056 super(CONNECTION_SET_NS_ID, "effectiveOutputPolicy"); 57057 this.id = attributes.id || ""; 57058 this.name = attributes.name || ""; 57059 this.use = attributes.use || ""; 57060 this.usehref = attributes.usehref || ""; 57061 } 57062} 57063class Operation extends StringObject { 57064 constructor(attributes) { 57065 super(CONNECTION_SET_NS_ID, "operation"); 57066 this.id = attributes.id || ""; 57067 this.input = attributes.input || ""; 57068 this.name = attributes.name || ""; 57069 this.output = attributes.output || ""; 57070 this.use = attributes.use || ""; 57071 this.usehref = attributes.usehref || ""; 57072 } 57073} 57074class RootElement extends StringObject { 57075 constructor(attributes) { 57076 super(CONNECTION_SET_NS_ID, "rootElement"); 57077 this.id = attributes.id || ""; 57078 this.name = attributes.name || ""; 57079 this.use = attributes.use || ""; 57080 this.usehref = attributes.usehref || ""; 57081 } 57082} 57083class SoapAction extends StringObject { 57084 constructor(attributes) { 57085 super(CONNECTION_SET_NS_ID, "soapAction"); 57086 this.id = attributes.id || ""; 57087 this.name = attributes.name || ""; 57088 this.use = attributes.use || ""; 57089 this.usehref = attributes.usehref || ""; 57090 } 57091} 57092class SoapAddress extends StringObject { 57093 constructor(attributes) { 57094 super(CONNECTION_SET_NS_ID, "soapAddress"); 57095 this.id = attributes.id || ""; 57096 this.name = attributes.name || ""; 57097 this.use = attributes.use || ""; 57098 this.usehref = attributes.usehref || ""; 57099 } 57100} 57101class connection_set_Uri extends StringObject { 57102 constructor(attributes) { 57103 super(CONNECTION_SET_NS_ID, "uri"); 57104 this.id = attributes.id || ""; 57105 this.name = attributes.name || ""; 57106 this.use = attributes.use || ""; 57107 this.usehref = attributes.usehref || ""; 57108 } 57109} 57110class WsdlAddress extends StringObject { 57111 constructor(attributes) { 57112 super(CONNECTION_SET_NS_ID, "wsdlAddress"); 57113 this.id = attributes.id || ""; 57114 this.name = attributes.name || ""; 57115 this.use = attributes.use || ""; 57116 this.usehref = attributes.usehref || ""; 57117 } 57118} 57119class WsdlConnection extends XFAObject { 57120 constructor(attributes) { 57121 super(CONNECTION_SET_NS_ID, "wsdlConnection", true); 57122 this.dataDescription = attributes.dataDescription || ""; 57123 this.name = attributes.name || ""; 57124 this.effectiveInputPolicy = null; 57125 this.effectiveOutputPolicy = null; 57126 this.operation = null; 57127 this.soapAction = null; 57128 this.soapAddress = null; 57129 this.wsdlAddress = null; 57130 } 57131} 57132class XmlConnection extends XFAObject { 57133 constructor(attributes) { 57134 super(CONNECTION_SET_NS_ID, "xmlConnection", true); 57135 this.dataDescription = attributes.dataDescription || ""; 57136 this.name = attributes.name || ""; 57137 this.uri = null; 57138 } 57139} 57140class XsdConnection extends XFAObject { 57141 constructor(attributes) { 57142 super(CONNECTION_SET_NS_ID, "xsdConnection", true); 57143 this.dataDescription = attributes.dataDescription || ""; 57144 this.name = attributes.name || ""; 57145 this.rootElement = null; 57146 this.uri = null; 57147 } 57148} 57149class ConnectionSetNamespace { 57150 static [$buildXFAObject](name, attributes) { 57151 if (Object.hasOwn(ConnectionSetNamespace, name)) { 57152 return ConnectionSetNamespace[name](attributes); 57153 } 57154 return undefined; 57155 } 57156 static connectionSet(attrs) { 57157 return new ConnectionSet(attrs); 57158 } 57159 static effectiveInputPolicy(attrs) { 57160 return new EffectiveInputPolicy(attrs); 57161 } 57162 static effectiveOutputPolicy(attrs) { 57163 return new EffectiveOutputPolicy(attrs); 57164 } 57165 static operation(attrs) { 57166 return new Operation(attrs); 57167 } 57168 static rootElement(attrs) { 57169 return new RootElement(attrs); 57170 } 57171 static soapAction(attrs) { 57172 return new SoapAction(attrs); 57173 } 57174 static soapAddress(attrs) { 57175 return new SoapAddress(attrs); 57176 } 57177 static uri(attrs) { 57178 return new connection_set_Uri(attrs); 57179 } 57180 static wsdlAddress(attrs) { 57181 return new WsdlAddress(attrs); 57182 } 57183 static wsdlConnection(attrs) { 57184 return new WsdlConnection(attrs); 57185 } 57186 static xmlConnection(attrs) { 57187 return new XmlConnection(attrs); 57188 } 57189 static xsdConnection(attrs) { 57190 return new XsdConnection(attrs); 57191 } 57192} 57193 57194;// ./src/core/xfa/datasets.js 57195 57196 57197 57198const DATASETS_NS_ID = NamespaceIds.datasets.id; 57199class datasets_Data extends XmlObject { 57200 constructor(attributes) { 57201 super(DATASETS_NS_ID, "data", attributes); 57202 } 57203 [$isNsAgnostic]() { 57204 return true; 57205 } 57206} 57207class Datasets extends XFAObject { 57208 constructor(attributes) { 57209 super(DATASETS_NS_ID, "datasets", true); 57210 this.data = null; 57211 this.Signature = null; 57212 } 57213 [$onChild](child) { 57214 const name = child[$nodeName]; 57215 if (name === "data" && child[$namespaceId] === DATASETS_NS_ID || name === "Signature" && child[$namespaceId] === NamespaceIds.signature.id) { 57216 this[name] = child; 57217 } 57218 this[$appendChild](child); 57219 } 57220} 57221class DatasetsNamespace { 57222 static [$buildXFAObject](name, attributes) { 57223 if (Object.hasOwn(DatasetsNamespace, name)) { 57224 return DatasetsNamespace[name](attributes); 57225 } 57226 return undefined; 57227 } 57228 static datasets(attributes) { 57229 return new Datasets(attributes); 57230 } 57231 static data(attributes) { 57232 return new datasets_Data(attributes); 57233 } 57234} 57235 57236;// ./src/core/xfa/locale_set.js 57237 57238 57239 57240const LOCALE_SET_NS_ID = NamespaceIds.localeSet.id; 57241class CalendarSymbols extends XFAObject { 57242 constructor(attributes) { 57243 super(LOCALE_SET_NS_ID, "calendarSymbols", true); 57244 this.name = "gregorian"; 57245 this.dayNames = new XFAObjectArray(2); 57246 this.eraNames = null; 57247 this.meridiemNames = null; 57248 this.monthNames = new XFAObjectArray(2); 57249 } 57250} 57251class CurrencySymbol extends StringObject { 57252 constructor(attributes) { 57253 super(LOCALE_SET_NS_ID, "currencySymbol"); 57254 this.name = getStringOption(attributes.name, ["symbol", "isoname", "decimal"]); 57255 } 57256} 57257class CurrencySymbols extends XFAObject { 57258 constructor(attributes) { 57259 super(LOCALE_SET_NS_ID, "currencySymbols", true); 57260 this.currencySymbol = new XFAObjectArray(3); 57261 } 57262} 57263class DatePattern extends StringObject { 57264 constructor(attributes) { 57265 super(LOCALE_SET_NS_ID, "datePattern"); 57266 this.name = getStringOption(attributes.name, ["full", "long", "med", "short"]); 57267 } 57268} 57269class DatePatterns extends XFAObject { 57270 constructor(attributes) { 57271 super(LOCALE_SET_NS_ID, "datePatterns", true); 57272 this.datePattern = new XFAObjectArray(4); 57273 } 57274} 57275class DateTimeSymbols extends ContentObject { 57276 constructor(attributes) { 57277 super(LOCALE_SET_NS_ID, "dateTimeSymbols"); 57278 } 57279} 57280class Day extends StringObject { 57281 constructor(attributes) { 57282 super(LOCALE_SET_NS_ID, "day"); 57283 } 57284} 57285class DayNames extends XFAObject { 57286 constructor(attributes) { 57287 super(LOCALE_SET_NS_ID, "dayNames", true); 57288 this.abbr = getInteger({ 57289 data: attributes.abbr, 57290 defaultValue: 0, 57291 validate: x => x === 1 57292 }); 57293 this.day = new XFAObjectArray(7); 57294 } 57295} 57296class Era extends StringObject { 57297 constructor(attributes) { 57298 super(LOCALE_SET_NS_ID, "era"); 57299 } 57300} 57301class EraNames extends XFAObject { 57302 constructor(attributes) { 57303 super(LOCALE_SET_NS_ID, "eraNames", true); 57304 this.era = new XFAObjectArray(2); 57305 } 57306} 57307class locale_set_Locale extends XFAObject { 57308 constructor(attributes) { 57309 super(LOCALE_SET_NS_ID, "locale", true); 57310 this.desc = attributes.desc || ""; 57311 this.name = "isoname"; 57312 this.calendarSymbols = null; 57313 this.currencySymbols = null; 57314 this.datePatterns = null; 57315 this.dateTimeSymbols = null; 57316 this.numberPatterns = null; 57317 this.numberSymbols = null; 57318 this.timePatterns = null; 57319 this.typeFaces = null; 57320 } 57321} 57322class locale_set_LocaleSet extends XFAObject { 57323 constructor(attributes) { 57324 super(LOCALE_SET_NS_ID, "localeSet", true); 57325 this.locale = new XFAObjectArray(); 57326 } 57327} 57328class Meridiem extends StringObject { 57329 constructor(attributes) { 57330 super(LOCALE_SET_NS_ID, "meridiem"); 57331 } 57332} 57333class MeridiemNames extends XFAObject { 57334 constructor(attributes) { 57335 super(LOCALE_SET_NS_ID, "meridiemNames", true); 57336 this.meridiem = new XFAObjectArray(2); 57337 } 57338} 57339class Month extends StringObject { 57340 constructor(attributes) { 57341 super(LOCALE_SET_NS_ID, "month"); 57342 } 57343} 57344class MonthNames extends XFAObject { 57345 constructor(attributes) { 57346 super(LOCALE_SET_NS_ID, "monthNames", true); 57347 this.abbr = getInteger({ 57348 data: attributes.abbr, 57349 defaultValue: 0, 57350 validate: x => x === 1 57351 }); 57352 this.month = new XFAObjectArray(12); 57353 } 57354} 57355class NumberPattern extends StringObject { 57356 constructor(attributes) { 57357 super(LOCALE_SET_NS_ID, "numberPattern"); 57358 this.name = getStringOption(attributes.name, ["full", "long", "med", "short"]); 57359 } 57360} 57361class NumberPatterns extends XFAObject { 57362 constructor(attributes) { 57363 super(LOCALE_SET_NS_ID, "numberPatterns", true); 57364 this.numberPattern = new XFAObjectArray(4); 57365 } 57366} 57367class NumberSymbol extends StringObject { 57368 constructor(attributes) { 57369 super(LOCALE_SET_NS_ID, "numberSymbol"); 57370 this.name = getStringOption(attributes.name, ["decimal", "grouping", "percent", "minus", "zero"]); 57371 } 57372} 57373class NumberSymbols extends XFAObject { 57374 constructor(attributes) { 57375 super(LOCALE_SET_NS_ID, "numberSymbols", true); 57376 this.numberSymbol = new XFAObjectArray(5); 57377 } 57378} 57379class TimePattern extends StringObject { 57380 constructor(attributes) { 57381 super(LOCALE_SET_NS_ID, "timePattern"); 57382 this.name = getStringOption(attributes.name, ["full", "long", "med", "short"]); 57383 } 57384} 57385class TimePatterns extends XFAObject { 57386 constructor(attributes) { 57387 super(LOCALE_SET_NS_ID, "timePatterns", true); 57388 this.timePattern = new XFAObjectArray(4); 57389 } 57390} 57391class TypeFace extends XFAObject { 57392 constructor(attributes) { 57393 super(LOCALE_SET_NS_ID, "typeFace", true); 57394 this.name = attributes.name | ""; 57395 } 57396} 57397class TypeFaces extends XFAObject { 57398 constructor(attributes) { 57399 super(LOCALE_SET_NS_ID, "typeFaces", true); 57400 this.typeFace = new XFAObjectArray(); 57401 } 57402} 57403class LocaleSetNamespace { 57404 static [$buildXFAObject](name, attributes) { 57405 if (Object.hasOwn(LocaleSetNamespace, name)) { 57406 return LocaleSetNamespace[name](attributes); 57407 } 57408 return undefined; 57409 } 57410 static calendarSymbols(attrs) { 57411 return new CalendarSymbols(attrs); 57412 } 57413 static currencySymbol(attrs) { 57414 return new CurrencySymbol(attrs); 57415 } 57416 static currencySymbols(attrs) { 57417 return new CurrencySymbols(attrs); 57418 } 57419 static datePattern(attrs) { 57420 return new DatePattern(attrs); 57421 } 57422 static datePatterns(attrs) { 57423 return new DatePatterns(attrs); 57424 } 57425 static dateTimeSymbols(attrs) { 57426 return new DateTimeSymbols(attrs); 57427 } 57428 static day(attrs) { 57429 return new Day(attrs); 57430 } 57431 static dayNames(attrs) { 57432 return new DayNames(attrs); 57433 } 57434 static era(attrs) { 57435 return new Era(attrs); 57436 } 57437 static eraNames(attrs) { 57438 return new EraNames(attrs); 57439 } 57440 static locale(attrs) { 57441 return new locale_set_Locale(attrs); 57442 } 57443 static localeSet(attrs) { 57444 return new locale_set_LocaleSet(attrs); 57445 } 57446 static meridiem(attrs) { 57447 return new Meridiem(attrs); 57448 } 57449 static meridiemNames(attrs) { 57450 return new MeridiemNames(attrs); 57451 } 57452 static month(attrs) { 57453 return new Month(attrs); 57454 } 57455 static monthNames(attrs) { 57456 return new MonthNames(attrs); 57457 } 57458 static numberPattern(attrs) { 57459 return new NumberPattern(attrs); 57460 } 57461 static numberPatterns(attrs) { 57462 return new NumberPatterns(attrs); 57463 } 57464 static numberSymbol(attrs) { 57465 return new NumberSymbol(attrs); 57466 } 57467 static numberSymbols(attrs) { 57468 return new NumberSymbols(attrs); 57469 } 57470 static timePattern(attrs) { 57471 return new TimePattern(attrs); 57472 } 57473 static timePatterns(attrs) { 57474 return new TimePatterns(attrs); 57475 } 57476 static typeFace(attrs) { 57477 return new TypeFace(attrs); 57478 } 57479 static typeFaces(attrs) { 57480 return new TypeFaces(attrs); 57481 } 57482} 57483 57484;// ./src/core/xfa/signature.js 57485 57486 57487const SIGNATURE_NS_ID = NamespaceIds.signature.id; 57488class signature_Signature extends XFAObject { 57489 constructor(attributes) { 57490 super(SIGNATURE_NS_ID, "signature", true); 57491 } 57492} 57493class SignatureNamespace { 57494 static [$buildXFAObject](name, attributes) { 57495 if (Object.hasOwn(SignatureNamespace, name)) { 57496 return SignatureNamespace[name](attributes); 57497 } 57498 return undefined; 57499 } 57500 static signature(attributes) { 57501 return new signature_Signature(attributes); 57502 } 57503} 57504 57505;// ./src/core/xfa/stylesheet.js 57506 57507 57508const STYLESHEET_NS_ID = NamespaceIds.stylesheet.id; 57509class Stylesheet extends XFAObject { 57510 constructor(attributes) { 57511 super(STYLESHEET_NS_ID, "stylesheet", true); 57512 } 57513} 57514class StylesheetNamespace { 57515 static [$buildXFAObject](name, attributes) { 57516 if (Object.hasOwn(StylesheetNamespace, name)) { 57517 return StylesheetNamespace[name](attributes); 57518 } 57519 return undefined; 57520 } 57521 static stylesheet(attributes) { 57522 return new Stylesheet(attributes); 57523 } 57524} 57525 57526;// ./src/core/xfa/xdp.js 57527 57528 57529 57530const XDP_NS_ID = NamespaceIds.xdp.id; 57531class xdp_Xdp extends XFAObject { 57532 constructor(attributes) { 57533 super(XDP_NS_ID, "xdp", true); 57534 this.uuid = attributes.uuid || ""; 57535 this.timeStamp = attributes.timeStamp || ""; 57536 this.config = null; 57537 this.connectionSet = null; 57538 this.datasets = null; 57539 this.localeSet = null; 57540 this.stylesheet = new XFAObjectArray(); 57541 this.template = null; 57542 } 57543 [$onChildCheck](child) { 57544 const ns = NamespaceIds[child[$nodeName]]; 57545 return ns && child[$namespaceId] === ns.id; 57546 } 57547} 57548class XdpNamespace { 57549 static [$buildXFAObject](name, attributes) { 57550 if (Object.hasOwn(XdpNamespace, name)) { 57551 return XdpNamespace[name](attributes); 57552 } 57553 return undefined; 57554 } 57555 static xdp(attributes) { 57556 return new xdp_Xdp(attributes); 57557 } 57558} 57559 57560;// ./src/core/xfa/xhtml.js 57561 57562 57563 57564 57565
57566 57567 57568 57569 57570 57571 57572 57573 57574 57575 57576 57577 57578 57579const XHTML_NS_ID = NamespaceIds.xhtml.id; 57580const $richText = Symbol(); 57581const VALID_STYLES = new Set(["color", "font", "font-family", "font-size", "font-stretch", "font-style", "font-weight", "margin", "margin-bottom", "margin-left", "margin-right", "margin-top", "letter-spacing", "line-height", "orphans", "page-break-after", "page-break-before", "page-break-inside", "tab-interval", "tab-stop", "text-align", "text-decoration", "text-indent", "vertical-align", "widows", "kerning-mode", "xfa-font-horizontal-scale", "xfa-font-vertical-scale", "xfa-spacerun", "xfa-tab-stops"]); 57582const StyleMapping = new Map([["page-break-after", "breakAfter"], ["page-break-before", "breakBefore"], ["page-break-inside", "breakInside"], ["kerning-mode", value => value === "none" ? "none" : "normal"], ["xfa-font-horizontal-scale", value => `scaleX(${Math.max(0, parseInt(value, 10) / 100).toFixed(2)})`], ["xfa-font-vertical-scale", value => `scaleY(${Math.max(0, parseInt(value, 10
vendor: 9,698 bytes, lines 57582-57926
57582) / 100).toFixed(2)})`], ["xfa-spacerun", ""], ["xfa-tab-stops", ""], ["font-size", (value, original) => { 57583 value = original.fontSize = Math.abs(getMeasurement(value)); 57584 return measureToString(0.99 * value); 57585}], ["letter-spacing", value => measureToString(getMeasurement(value))], ["line-height", value => measureToString(getMeasurement(value))], ["margin", value => measureToString(getMeasurement(value))], ["margin-bottom", value => measureToString(getMeasurement(value))], ["margin-left", value => measureToString(getMeasurement(value))], ["margin-right", value => measureToString(getMeasurement(value))], ["margin-top", value => measureToString(getMeasurement(value))], ["text-indent", value => measureToString(getMeasurement(value))], ["font-family", value => value], ["vertical-align", value => measureToString(getMeasurement(value))]]); 57586const spacesRegExp = /\s+/g; 57587const crlfRegExp = /[\r\n]+/g; 57588const crlfForRichTextRegExp = /\r\n?/g; 57589function mapStyle(styleStr, node, richText) { 57590 const style = Object.create(null); 57591 if (!styleStr) { 57592 return style; 57593 } 57594 const original = Object.create(null); 57595 for (const [key, value] of styleStr.split(";").map(s => s.split(":", 2))) { 57596 const mapping = StyleMapping.get(key); 57597 if (mapping === "") { 57598 continue; 57599 } 57600 let newValue = value; 57601 if (mapping) { 57602 newValue = typeof mapping === "string" ? mapping : mapping(value, original); 57603 } 57604 if (key.endsWith("scale")) { 57605 style.transform = style.transform ? `${style[key]} ${newValue}` : newValue; 57606 } else { 57607 style[key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())] = newValue; 57608 } 57609 } 57610 if (style.fontFamily) { 57611 setFontFamily({ 57612 typeface: style.fontFamily, 57613 weight: style.fontWeight || "normal", 57614 posture: style.fontStyle || "normal", 57615 size: original.fontSize || 0 57616 }, node, node[$globalData].fontFinder, style); 57617 } 57618 if (richText && style.verticalAlign && style.verticalAlign !== "0px" && style.fontSize) { 57619 const SUB_SUPER_SCRIPT_FACTOR = 0.583; 57620 const VERTICAL_FACTOR = 0.333; 57621 const fontSize = getMeasurement(style.fontSize); 57622 style.fontSize = measureToString(fontSize * SUB_SUPER_SCRIPT_FACTOR); 57623 style.verticalAlign = measureToString(Math.sign(getMeasurement(style.verticalAlign)) * fontSize * VERTICAL_FACTOR); 57624 } 57625 if (richText && style.fontSize) { 57626 style.fontSize = `calc(${style.fontSize} * var(--total-scale-factor))`; 57627 } 57628 fixTextIndent(style); 57629 return style; 57630} 57631function checkStyle(node) { 57632 if (!node.style) { 57633 return ""; 57634 } 57635 return node.style.split(";").filter(s => !!s.trim()).map(s => s.split(":", 2).map(t => t.trim())).filter(([key, value]) => { 57636 if (key === "font-family") { 57637 node[$globalData].usedTypefaces.add(value); 57638 } 57639 return VALID_STYLES.has(key); 57640 }).map(kv => kv.join(":")).join(";"); 57641} 57642const NoWhites = new Set(["body", "html"]); 57643class XhtmlObject extends XmlObject { 57644 constructor(attributes, name) { 57645 super(XHTML_NS_ID, name); 57646 this[$richText] = false; 57647 this.style = attributes.style || ""; 57648 } 57649 [$clean](builder) { 57650 super[$clean](builder); 57651 this.style = checkStyle(this); 57652 } 57653 [$acceptWhitespace]() { 57654 return !NoWhites.has(this[$nodeName]); 57655 } 57656 [$onText](str, richText = false) { 57657 if (!richText) { 57658 str = str.replaceAll(crlfRegExp, ""); 57659 if (!this.style.includes("xfa-spacerun:yes")) { 57660 str = str.replaceAll(spacesRegExp, " "); 57661 } 57662 } else { 57663 this[$richText] = true; 57664 } 57665 if (str) { 57666 this[$content] += str; 57667 } 57668 } 57669 [$pushGlyphs](measure, mustPop = true) { 57670 const xfaFont = Object.create(null); 57671 const margin = { 57672 top: NaN, 57673 bottom: NaN, 57674 left: NaN, 57675 right: NaN 57676 }; 57677 let lineHeight = null; 57678 for (const [key, value] of this.style.split(";").map(s => s.split(":", 2))) { 57679 switch (key) { 57680 case "font-family": 57681 xfaFont.typeface = stripQuotes(value); 57682 break; 57683 case "font-size": 57684 xfaFont.size = getMeasurement(value); 57685 break; 57686 case "font-weight": 57687 xfaFont.weight = value; 57688 break; 57689 case "font-style": 57690 xfaFont.posture = value; 57691 break; 57692 case "letter-spacing": 57693 xfaFont.letterSpacing = getMeasurement(value); 57694 break; 57695 case "margin": 57696 const values = value.split(/ \t/).map(x => getMeasurement(x)); 57697 switch (values.length) { 57698 case 1: 57699 margin.top = margin.bottom = margin.left = margin.right = values[0]; 57700 break; 57701 case 2: 57702 margin.top = margin.bottom = values[0]; 57703 margin.left = margin.right = values[1]; 57704 break; 57705 case 3: 57706 margin.top = values[0]; 57707 margin.bottom = values[2]; 57708 margin.left = margin.right = values[1]; 57709 break; 57710 case 4: 57711 margin.top = values[0]; 57712 margin.left = values[1]; 57713 margin.bottom = values[2]; 57714 margin.right = values[3]; 57715 break; 57716 } 57717 break; 57718 case "margin-top": 57719 margin.top = getMeasurement(value); 57720 break; 57721 case "margin-bottom": 57722 margin.bottom = getMeasurement(value); 57723 break; 57724 case "margin-left": 57725 margin.left = getMeasurement(value); 57726 break; 57727 case "margin-right": 57728 margin.right = getMeasurement(value); 57729 break; 57730 case "line-height": 57731 lineHeight = getMeasurement(value); 57732 break; 57733 } 57734 } 57735 measure.pushData(xfaFont, margin, lineHeight); 57736 if (this[$content]) { 57737 measure.addString(this[$content]); 57738 } else { 57739 for (const child of this[$getChildren]()) { 57740 if (child[$nodeName] === "#text") { 57741 measure.addString(child[$content]); 57742 continue; 57743 } 57744 child[$pushGlyphs](measure); 57745 } 57746 } 57747 if (mustPop) { 57748 measure.popFont(); 57749 } 57750 } 57751 [$toHTML](availableSpace) { 57752 const children = []; 57753 this[$extra] = { 57754 children 57755 }; 57756 this[$childrenToHTML]({}); 57757 if (children.length === 0 && !this[$content]) { 57758 return HTMLResult.EMPTY; 57759 } 57760 let value; 57761 if (this[$richText]) { 57762 value = this[$content] ? this[$content].replaceAll(crlfForRichTextRegExp, "\n") : undefined; 57763 } else { 57764 value = this[$content] || undefined; 57765 } 57766 return HTMLResult.success({ 57767 name: this[$nodeName], 57768 attributes: { 57769 href: this.href, 57770 style: mapStyle(this.style, this, this[$richText]) 57771 }, 57772 children, 57773 value 57774 }); 57775 } 57776} 57777class A extends XhtmlObject { 57778 constructor(attributes) { 57779 super(attributes, "a"); 57780 this.href = fixURL(attributes.href) || ""; 57781 } 57782} 57783class B extends XhtmlObject { 57784 constructor(attributes) { 57785 super(attributes, "b"); 57786 } 57787 [$pushGlyphs](measure) { 57788 measure.pushFont({ 57789 weight: "bold" 57790 }); 57791 super[$pushGlyphs](measure); 57792 measure.popFont(); 57793 } 57794} 57795class Body extends XhtmlObject { 57796 constructor(attributes) { 57797 super(attributes, "body"); 57798 } 57799 [$toHTML](availableSpace) { 57800 const res = super[$toHTML](availableSpace); 57801 const { 57802 html 57803 } = res; 57804 if (!html) { 57805 return HTMLResult.EMPTY; 57806 } 57807 html.name = "div"; 57808 html.attributes.class = ["xfaRich"]; 57809 return res; 57810 } 57811} 57812class Br extends XhtmlObject { 57813 constructor(attributes) { 57814 super(attributes, "br"); 57815 } 57816 [$text]() { 57817 return "\n"; 57818 } 57819 [$pushGlyphs](measure) { 57820 measure.addString("\n"); 57821 } 57822 [$toHTML](availableSpace) { 57823 return HTMLResult.success({ 57824 name: "br" 57825 }); 57826 } 57827} 57828class Html extends XhtmlObject { 57829 constructor(attributes) { 57830 super(attributes, "html"); 57831 } 57832 [$toHTML](availableSpace) { 57833 const children = []; 57834 this[$extra] = { 57835 children 57836 }; 57837 this[$childrenToHTML]({}); 57838 if (children.length === 0) { 57839 return HTMLResult.success({ 57840 name: "div", 57841 attributes: { 57842 class: ["xfaRich"], 57843 style: {} 57844 }, 57845 value: this[$content] || "" 57846 }); 57847 } 57848 if (children.length === 1) { 57849 const child = children[0]; 57850 if (child.attributes?.class.includes("xfaRich")) { 57851 return HTMLResult.success(child); 57852 } 57853 } 57854 return HTMLResult.success({ 57855 name: "div", 57856 attributes: { 57857 class: ["xfaRich"], 57858 style: {} 57859 }, 57860 children 57861 }); 57862 } 57863} 57864class I extends XhtmlObject { 57865 constructor(attributes) { 57866 super(attributes, "i"); 57867 } 57868 [$pushGlyphs](measure) { 57869 measure.pushFont({ 57870 posture: "italic" 57871 }); 57872 super[$pushGlyphs](measure); 57873 measure.popFont(); 57874 } 57875} 57876class Li extends XhtmlObject { 57877 constructor(attributes) { 57878 super(attributes, "li"); 57879 } 57880} 57881class Ol extends XhtmlObject { 57882 constructor(attributes) { 57883 super(attributes, "ol"); 57884 } 57885} 57886class P extends XhtmlObject { 57887 constructor(attributes) { 57888 super(attributes, "p"); 57889 } 57890 [$pushGlyphs](measure) { 57891 super[$pushGlyphs](measure, false); 57892 measure.addString("\n"); 57893 measure.addPara(); 57894 measure.popFont(); 57895 } 57896 [$text]() { 57897 const siblings = this[$getParent]()[$getChildren](); 57898 if (siblings.at(-1) === this) { 57899 return super[$text](); 57900 } 57901 return super[$text]() + "\n"; 57902 } 57903} 57904class Span extends XhtmlObject { 57905 constructor(attributes) { 57906 super(attributes, "span"); 57907 } 57908} 57909class Sub extends XhtmlObject { 57910 constructor(attributes) { 57911 super(attributes, "sub"); 57912 } 57913} 57914class Sup extends XhtmlObject { 57915 constructor(attributes) { 57916 super(attributes, "sup"); 57917 } 57918} 57919class Ul extends XhtmlObject { 57920 constructor(attributes) { 57921 super(attributes, "ul"); 57922 } 57923} 57924class XhtmlNamespace { 57925 static [$buildXFAObject](name, attributes) { 57926 if (
vendor: 2,130 bytes, lines 57926-58044
57926Object.hasOwn(XhtmlNamespace, name)) { 57927 return XhtmlNamespace[name](attributes); 57928 } 57929 return undefined; 57930 } 57931 static a(attributes) { 57932 return new A(attributes); 57933 } 57934 static b(attributes) { 57935 return new B(attributes); 57936 } 57937 static body(attributes) { 57938 return new Body(attributes); 57939 } 57940 static br(attributes) { 57941 return new Br(attributes); 57942 } 57943 static html(attributes) { 57944 return new Html(attributes); 57945 } 57946 static i(attributes) { 57947 return new I(attributes); 57948 } 57949 static li(attributes) { 57950 return new Li(attributes); 57951 } 57952 static ol(attributes) { 57953 return new Ol(attributes); 57954 } 57955 static p(attributes) { 57956 return new P(attributes); 57957 } 57958 static span(attributes) { 57959 return new Span(attributes); 57960 } 57961 static sub(attributes) { 57962 return new Sub(attributes); 57963 } 57964 static sup(attributes) { 57965 return new Sup(attributes); 57966 } 57967 static ul(attributes) { 57968 return new Ul(attributes); 57969 } 57970} 57971 57972;// ./src/core/xfa/setup.js 57973 57974 57975 57976 57977 57978 57979 57980 57981 57982const NamespaceSetUp = { 57983 config: ConfigNamespace, 57984 connection: ConnectionSetNamespace, 57985 datasets: DatasetsNamespace, 57986 localeSet: LocaleSetNamespace, 57987 signature: SignatureNamespace, 57988 stylesheet: StylesheetNamespace, 57989 template: TemplateNamespace, 57990 xdp: XdpNamespace, 57991 xhtml: XhtmlNamespace 57992}; 57993 57994;// ./src/core/xfa/unknown.js 57995 57996 57997class UnknownNamespace { 57998 constructor(nsId) { 57999 this.namespaceId = nsId; 58000 } 58001 [$buildXFAObject](name, attributes) { 58002 return new XmlObject(this.namespaceId, name, attributes); 58003 } 58004} 58005 58006;// ./src/core/xfa/builder.js 58007 58008 58009 58010 58011 58012 58013 58014 58015 58016 58017 58018 58019 58020class Root extends XFAObject { 58021 constructor(ids) { 58022 super(-1, "root", Object.create(null)); 58023 this.element = null; 58024 this[$ids] = ids; 58025 } 58026 [$onChild](child) { 58027 this.element = child; 58028 return true; 58029 } 58030 [$finalize]() { 58031 super[$finalize](); 58032 if (this.element.template instanceof Template) { 58033 this[$ids].set($root, this.element); 58034 this.element.template[$resolvePrototypes](this[$ids]); 58035 this.element.template[$ids] = this[$ids]; 58036 } 58037 } 58038} 58039class Empty extends XFAObject { 58040 constructor() { 58041 super(-1, "", Object.create(null)); 58042 } 58043 [$onChild](_) { 58044 return false;
vendor: 23,137 bytes, lines 58045-58843
58045 } 58046} 58047class Builder { 58048 constructor(rootNameSpace = null) { 58049 this._namespaceStack = []; 58050 this._nsAgnosticLevel = 0; 58051 this._namespacePrefixes = new Map(); 58052 this._namespaces = new Map(); 58053 this._nextNsId = Math.max(...Object.values(NamespaceIds).map(({ 58054 id 58055 }) => id)); 58056 this._currentNamespace = rootNameSpace || new UnknownNamespace(++this._nextNsId); 58057 } 58058 buildRoot(ids) { 58059 return new Root(ids); 58060 } 58061 build({ 58062 nsPrefix, 58063 name, 58064 attributes, 58065 namespace, 58066 prefixes 58067 }) { 58068 const hasNamespaceDef = namespace !== null; 58069 if (hasNamespaceDef) { 58070 this._namespaceStack.push(this._currentNamespace); 58071 this._currentNamespace = this._searchNamespace(namespace); 58072 } 58073 if (prefixes) { 58074 this._addNamespacePrefix(prefixes); 58075 } 58076 if (Object.hasOwn(attributes, $nsAttributes)) { 58077 const dataTemplate = NamespaceSetUp.datasets; 58078 const nsAttrs = attributes[$nsAttributes]; 58079 let xfaAttrs = null; 58080 for (const [ns, attrs] of Object.entries(nsAttrs)) { 58081 const nsToUse = this._getNamespaceToUse(ns); 58082 if (nsToUse === dataTemplate) { 58083 xfaAttrs = { 58084 xfa: attrs 58085 }; 58086 break; 58087 } 58088 } 58089 if (xfaAttrs) { 58090 attributes[$nsAttributes] = xfaAttrs; 58091 } else { 58092 delete attributes[$nsAttributes]; 58093 } 58094 } 58095 const namespaceToUse = this._getNamespaceToUse(nsPrefix); 58096 const node = namespaceToUse?.[$buildXFAObject](name, attributes) || new Empty(); 58097 if (node[$isNsAgnostic]()) { 58098 this._nsAgnosticLevel++; 58099 } 58100 if (hasNamespaceDef || prefixes || node[$isNsAgnostic]()) { 58101 node[$cleanup] = { 58102 hasNamespace: hasNamespaceDef, 58103 prefixes, 58104 nsAgnostic: node[$isNsAgnostic]() 58105 }; 58106 } 58107 return node; 58108 } 58109 isNsAgnostic() { 58110 return this._nsAgnosticLevel > 0; 58111 } 58112 _searchNamespace(nsName) { 58113 let ns = this._namespaces.get(nsName); 58114 if (ns) { 58115 return ns; 58116 } 58117 for (const [name, { 58118 check 58119 }] of Object.entries(NamespaceIds)) { 58120 if (check(nsName)) { 58121 ns = NamespaceSetUp[name]; 58122 if (ns) { 58123 this._namespaces.set(nsName, ns); 58124 return ns; 58125 } 58126 break; 58127 } 58128 } 58129 ns = new UnknownNamespace(++this._nextNsId); 58130 this._namespaces.set(nsName, ns); 58131 return ns; 58132 } 58133 _addNamespacePrefix(prefixes) { 58134 for (const { 58135 prefix, 58136 value 58137 } of prefixes) { 58138 const namespace = this._searchNamespace(value); 58139 this._namespacePrefixes.getOrInsertComputed(prefix, makeArr).push(namespace); 58140 } 58141 } 58142 _getNamespaceToUse(prefix) { 58143 if (!prefix) { 58144 return this._currentNamespace; 58145 } 58146 const prefixStack = this._namespacePrefixes.get(prefix); 58147 if (prefixStack?.length > 0) { 58148 return prefixStack.at(-1); 58149 } 58150 warn(`Unknown namespace prefix: ${prefix}.`); 58151 return null; 58152 } 58153 clean(data) { 58154 const { 58155 hasNamespace, 58156 prefixes, 58157 nsAgnostic 58158 } = data; 58159 if (hasNamespace) { 58160 this._currentNamespace = this._namespaceStack.pop(); 58161 } 58162 if (prefixes) { 58163 prefixes.forEach(({ 58164 prefix 58165 }) => { 58166 this._namespacePrefixes.get(prefix).pop(); 58167 }); 58168 } 58169 if (nsAgnostic) { 58170 this._nsAgnosticLevel--; 58171 } 58172 } 58173} 58174 58175;// ./src/core/xfa/parser.js 58176 58177 58178 58179 58180 58181 58182 58183 58184 58185 58186 58187 58188 58189 58190class XFAParser extends XMLParserBase { 58191 constructor(rootNameSpace = null, richText = false) { 58192 super(); 58193 this._builder = new Builder(rootNameSpace); 58194 this._stack = []; 58195 this._globalData = { 58196 usedTypefaces: new Set() 58197 }; 58198 this._ids = new Map(); 58199 this._current = this._builder.buildRoot(this._ids); 58200 this._errorCode = XMLParserErrorCode.NoError; 58201 this._whiteRegex = /^\s+$/; 58202 this._nbsps = /\xa0+/g; 58203 this._richText = richText; 58204 } 58205 parse(data) { 58206 this.parseXml(data); 58207 if (this._errorCode !== XMLParserErrorCode.NoError) { 58208 return undefined; 58209 } 58210 this._current[$finalize](); 58211 return this._current.element; 58212 } 58213 onText(text) { 58214 text = text.replace(this._nbsps, match => match.slice(1) + " "); 58215 if (this._richText || this._current[$acceptWhitespace]()) { 58216 this._current[$onText](text, this._richText); 58217 return; 58218 } 58219 if (this._whiteRegex.test(text)) { 58220 return; 58221 } 58222 this._current[$onText](text.trim()); 58223 } 58224 onCdata(text) { 58225 this._current[$onText](text); 58226 } 58227 _mkAttributes(attributes, tagName) { 58228 let namespace = null; 58229 let prefixes = null; 58230 const attributeObj = Object.create({}); 58231 for (const { 58232 name, 58233 value 58234 } of attributes) { 58235 if (name === "xmlns") { 58236 if (!namespace) { 58237 namespace = value; 58238 } else { 58239 warn(`XFA - multiple namespace definition in <${tagName}>`); 58240 } 58241 } else if (name.startsWith("xmlns:")) { 58242 const prefix = name.substring("xmlns:".length); 58243 prefixes ??= []; 58244 prefixes.push({ 58245 prefix, 58246 value 58247 }); 58248 } else { 58249 const i = name.indexOf(":"); 58250 if (i === -1) { 58251 attributeObj[name] = value; 58252 } else { 58253 const nsAttrs = attributeObj[$nsAttributes] ??= Object.create(null); 58254 const [ns, attrName] = [name.slice(0, i), name.slice(i + 1)]; 58255 const attrs = nsAttrs[ns] ||= Object.create(null); 58256 attrs[attrName] = value; 58257 } 58258 } 58259 } 58260 return [namespace, prefixes, attributeObj]; 58261 } 58262 _getNameAndPrefix(name, nsAgnostic) { 58263 const i = name.indexOf(":"); 58264 if (i === -1) { 58265 return [name, null]; 58266 } 58267 return [name.substring(i + 1), nsAgnostic ? "" : name.substring(0, i)]; 58268 } 58269 onBeginElement(tagName, attributes, isEmpty) { 58270 const [namespace, prefixes, attributesObj] = this._mkAttributes(attributes, tagName); 58271 const [name, nsPrefix] = this._getNameAndPrefix(tagName, this._builder.isNsAgnostic()); 58272 const node = this._builder.build({ 58273 nsPrefix, 58274 name, 58275 attributes: attributesObj, 58276 namespace, 58277 prefixes 58278 }); 58279 node[$globalData] = this._globalData; 58280 if (isEmpty) { 58281 node[$finalize](); 58282 if (this._current[$onChild](node)) { 58283 node[$setId](this._ids); 58284 } 58285 node[$clean](this._builder); 58286 return; 58287 } 58288 this._stack.push(this._current); 58289 this._current = node; 58290 } 58291 onEndElement(name) { 58292 const node = this._current; 58293 if (node[$isCDATAXml]() && typeof node[$content] === "string") { 58294 const parser = new XFAParser(); 58295 parser._globalData = this._globalData; 58296 const root = parser.parse(node[$content]); 58297 node[$content] = null; 58298 node[$onChild](root); 58299 } 58300 node[$finalize](); 58301 this._current = this._stack.pop(); 58302 if (this._current[$onChild](node)) { 58303 node[$setId](this._ids); 58304 } 58305 node[$clean](this._builder); 58306 } 58307 onError(code) { 58308 this._errorCode = code; 58309 } 58310} 58311 58312;// ./src/core/xfa/factory.js 58313 58314 58315 58316 58317 58318 58319 58320 58321 58322 58323 58324 58325 58326 58327class XFAFactory { 58328 constructor(data) { 58329 try { 58330 this.root = new XFAParser().parse(XFAFactory._createDocument(data)); 58331 const binder = new Binder(this.root); 58332 this.form = binder.bind(); 58333 this.dataHandler = new DataHandler(this.root, binder.getData()); 58334 this.form[$globalData].template = this.form; 58335 } catch (e) { 58336 warn(`XFA - an error occurred during parsing and binding: ${e}`); 58337 } 58338 } 58339 isValid() { 58340 return !!(this.root && this.form); 58341 } 58342 _createPagesHelper() { 58343 const iterator = this.form[$toPages](); 58344 return new Promise((resolve, reject) => { 58345 const nextIteration = () => { 58346 try { 58347 const value = iterator.next(); 58348 if (value.done) { 58349 resolve(value.value); 58350 } else { 58351 setTimeout(nextIteration, 0); 58352 } 58353 } catch (e) { 58354 reject(e); 58355 } 58356 }; 58357 setTimeout(nextIteration, 0); 58358 }); 58359 } 58360 async _createPages() { 58361 try { 58362 this.pages = await this._createPagesHelper(); 58363 this.dims = this.pages.children.map(c => { 58364 const { 58365 width, 58366 height 58367 } = c.attributes.style; 58368 return [0, 0, parseInt(width, 10), parseInt(height, 10)]; 58369 }); 58370 } catch (e) { 58371 warn(`XFA - an error occurred during layout: ${e}`); 58372 } 58373 } 58374 getBoundingBox(pageIndex) { 58375 return this.dims[pageIndex]; 58376 } 58377 async getNumPages() { 58378 if (!this.pages) { 58379 await this._createPages(); 58380 } 58381 return this.dims.length; 58382 } 58383 setImages(images) { 58384 this.form[$globalData].images = images; 58385 } 58386 setFonts(fonts) { 58387 this.form[$globalData].fontFinder = new FontFinder(fonts); 58388 const missingFonts = []; 58389 for (let typeface of this.form[$globalData].usedTypefaces) { 58390 typeface = stripQuotes(typeface); 58391 const font = this.form[$globalData].fontFinder.find(typeface); 58392 if (!font) { 58393 missingFonts.push(typeface); 58394 } 58395 } 58396 if (missingFonts.length > 0) { 58397 return missingFonts; 58398 } 58399 return null; 58400 } 58401 appendFonts(fonts, reallyMissingFonts) { 58402 this.form[$globalData].fontFinder.add(fonts, reallyMissingFonts); 58403 } 58404 async getPages() { 58405 if (!this.pages) { 58406 await this._createPages(); 58407 } 58408 const pages = this.pages; 58409 this.pages = null; 58410 return pages; 58411 } 58412 serializeData(storage) { 58413 return this.dataHandler.serialize(storage); 58414 } 58415 static _createDocument(data) { 58416 if (!data["/xdp:xdp"]) { 58417 return data["xdp:xdp"]; 58418 } 58419 return Object.values(data).join(""); 58420 } 58421 static getRichTextAsHtml(rc) { 58422 if (!rc || typeof rc !== "string") { 58423 return null; 58424 } 58425 try { 58426 let root = new XFAParser(XhtmlNamespace, true).parse(rc); 58427 if (!["body", "xhtml"].includes(root[$nodeName])) { 58428 const newRoot = XhtmlNamespace.body({}); 58429 newRoot[$appendChild](root); 58430 root = newRoot; 58431 } 58432 const result = root[$toHTML](); 58433 if (!result.success) { 58434 return null; 58435 } 58436 const { 58437 html 58438 } = result; 58439 const { 58440 attributes 58441 } = html; 58442 if (attributes) { 58443 if (attributes.class) { 58444 attributes.class = attributes.class.filter(attr => !attr.startsWith("xfa")); 58445 } 58446 attributes.dir = "auto"; 58447 } 58448 return { 58449 html, 58450 str: root[$text]() 58451 }; 58452 } catch (e) { 58453 warn(`XFA - an error occurred during parsing of rich text: ${e}`); 58454 } 58455 return null; 58456 } 58457} 58458 58459;// ./src/core/annotation.js 58460 58461 58462 58463 58464 58465 58466 58467 58468 58469 58470 58471 58472 58473 58474 58475 58476 58477 58478 58479 58480 58481 58482 58483 58484 58485 58486 58487 58488 58489 58490 58491 58492 58493class AnnotationFactory { 58494 static createGlobals(pdfManager) { 58495 return Promise.all([pdfManager.ensureCatalog("acroForm"), pdfManager.ensureDoc("xfaDatasets"), pdfManager.ensureCatalog("structTreeRoot"), pdfManager.ensureCatalog("baseUrl"), pdfManager.ensureCatalog("attachments"), pdfManager.ensureCatalog("globalColorSpaceCache")]).then(([acroForm, xfaDatasets, structTreeRoot, baseUrl, attachments, globalColorSpaceCache]) => ({ 58496 pdfManager, 58497 acroForm: acroForm instanceof Dict ? acroForm : Dict.empty, 58498 xfaDatasets, 58499 structTreeRoot, 58500 baseUrl, 58501 attachments, 58502 globalColorSpaceCache 58503 }), reason => { 58504 warn(`createGlobals: "${reason}".`); 58505 return null; 58506 }); 58507 } 58508 static async create(xref, ref, annotationGlobals, idFactory, collectFields, orphanFields, collectByType, pageRef) { 58509 const pageIndex = collectFields ? await this._getPageIndex(xref, ref, annotationGlobals.pdfManager) : null; 58510 return annotationGlobals.pdfManager.ensure(this, "_create", [xref, ref, annotationGlobals, idFactory, collectFields, orphanFields, collectByType, pageIndex, pageRef]); 58511 } 58512 static _create(xref, ref, annotationGlobals, idFactory, collectFields = false, orphanFields = null, collectByType = null, pageIndex = null, pageRef = null) { 58513 const dict = xref.fetchIfRef(ref); 58514 if (!(dict instanceof Dict)) { 58515 return undefined; 58516 } 58517 let subtype = dict.get("Subtype"); 58518 subtype = subtype instanceof Name ? subtype.name : null; 58519 if (collectByType && !collectByType.has(AnnotationType[subtype?.toUpperCase()])) { 58520 return null; 58521 } 58522 const { 58523 acroForm, 58524 pdfManager 58525 } = annotationGlobals; 58526 const id = ref instanceof Ref ? ref.toString() : `annot_${idFactory.createObjId()}`; 58527 const parameters = { 58528 xref, 58529 ref, 58530 dict, 58531 subtype, 58532 id, 58533 annotationGlobals, 58534 collectFields, 58535 orphanFields, 58536 needAppearances: !collectFields && acroForm.get("NeedAppearances") === true, 58537 pageIndex, 58538 evaluatorOptions: pdfManager.evaluatorOptions, 58539 pageRef 58540 }; 58541 switch (subtype) { 58542 case "Link": 58543 return new LinkAnnotation(parameters); 58544 case "Text": 58545 return new TextAnnotation(parameters); 58546 case "Widget": 58547 let fieldType = getInheritableProperty({ 58548 dict, 58549 key: "FT" 58550 }); 58551 fieldType = fieldType instanceof Name ? fieldType.name : null; 58552 switch (fieldType) { 58553 case "Tx": 58554 return new TextWidgetAnnotation(parameters); 58555 case "Btn": 58556 return new ButtonWidgetAnnotation(parameters); 58557 case "Ch": 58558 return new ChoiceWidgetAnnotation(parameters); 58559 case "Sig": 58560 return new SignatureWidgetAnnotation(parameters); 58561 } 58562 warn(`Unimplemented widget field type "${fieldType}", ` + "falling back to base field type."); 58563 return new WidgetAnnotation(parameters); 58564 case "Popup": 58565 return new PopupAnnotation(parameters); 58566 case "FreeText": 58567 return new FreeTextAnnotation(parameters); 58568 case "Line": 58569 return new LineAnnotation(parameters); 58570 case "Square": 58571 return new SquareAnnotation(parameters); 58572 case "Circle": 58573 return new CircleAnnotation(parameters); 58574 case "PolyLine": 58575 return new PolylineAnnotation(parameters); 58576 case "Polygon": 58577 return new PolygonAnnotation(parameters); 58578 case "Caret": 58579 return new CaretAnnotation(parameters); 58580 case "Ink": 58581 return new InkAnnotation(parameters); 58582 case "Highlight": 58583 return new HighlightAnnotation(parameters); 58584 case "Underline": 58585 return new UnderlineAnnotation(parameters); 58586 case "Squiggly": 58587 return new SquigglyAnnotation(parameters); 58588 case "StrikeOut": 58589 return new StrikeOutAnnotation(parameters); 58590 case "Stamp": 58591 return new StampAnnotation(parameters); 58592 case "FileAttachment": 58593 return new FileAttachmentAnnotation(parameters); 58594 default: 58595 if (!collectFields) { 58596 if (!subtype) { 58597 warn("Annotation is missing the required /Subtype."); 58598 } else { 58599 warn(`Unimplemented annotation type "${subtype}", ` + "falling back to base annotation."); 58600 } 58601 } 58602 return new Annotation(parameters); 58603 } 58604 } 58605 static async _getPageIndex(xref, ref, pdfManager) { 58606 try { 58607 const annotDict = await xref.fetchIfRefAsync(ref); 58608 if (!(annotDict instanceof Dict)) { 58609 return -1; 58610 } 58611 const pageRef = annotDict.getRaw("P"); 58612 if (pageRef instanceof Ref) { 58613 try { 58614 const pageIndex = await pdfManager.ensureCatalog("getPageIndex", [pageRef]); 58615 return pageIndex; 58616 } catch (ex) { 58617 info(`_getPageIndex -- not a valid page reference: "${ex}".`); 58618 } 58619 } 58620 if (annotDict.has("Kids")) { 58621 return -1; 58622 } 58623 const numPages = await pdfManager.ensureDoc("numPages"); 58624 for (let pageIndex = 0; pageIndex < numPages; pageIndex++) { 58625 const page = await pdfManager.getPage(pageIndex); 58626 const annotations = await pdfManager.ensure(page, "annotations"); 58627 for (const annotRef of annotations) { 58628 if (annotRef instanceof Ref && isRefsEqual(annotRef, ref)) { 58629 return pageIndex; 58630 } 58631 } 58632 } 58633 } catch (ex) { 58634 warn(`_getPageIndex: "${ex}".`); 58635 } 58636 return -1; 58637 } 58638 static generateImages(annotations, xref, isOffscreenCanvasSupported) { 58639 if (!isOffscreenCanvasSupported) { 58640 warn("generateImages: OffscreenCanvas is not supported, cannot save or print some annotations with images."); 58641 return null; 58642 } 58643 let imagePromises; 58644 for (const { 58645 bitmapId, 58646 bitmap 58647 } of annotations) { 58648 if (!bitmap) { 58649 continue; 58650 } 58651 imagePromises ||= new Map(); 58652 imagePromises.set(bitmapId, StampAnnotation.createImage(bitmap, xref)); 58653 } 58654 return imagePromises; 58655 } 58656 static async saveNewAnnotations(evaluator, xref, task, annotations, imagePromises, changes) { 58657 let baseFontRef; 58658 const promises = []; 58659 const { 58660 isOffscreenCanvasSupported 58661 } = evaluator.options; 58662 for (const annotation of annotations) { 58663 if (annotation.deleted) { 58664 continue; 58665 } 58666 switch (annotation.annotationType) { 58667 case AnnotationEditorType.FREETEXT: 58668 if (!baseFontRef) { 58669 const baseFont = new Dict(xref); 58670 baseFont.setIfName("BaseFont", "Helvetica"); 58671 baseFont.setIfName("Type", "Font"); 58672 baseFont.setIfName("Subtype", "Type1"); 58673 baseFont.setIfName("Encoding", "WinAnsiEncoding"); 58674 baseFontRef = xref.getNewTemporaryRef(); 58675 changes.put(baseFontRef, { 58676 data: baseFont 58677 }); 58678 } 58679 promises.push(FreeTextAnnotation.createNewAnnotation(xref, annotation, changes, { 58680 evaluator, 58681 task, 58682 baseFontRef 58683 })); 58684 break; 58685 case AnnotationEditorType.HIGHLIGHT: 58686 if (annotation.quadPoints) { 58687 promises.push(HighlightAnnotation.createNewAnnotation(xref, annotation, changes)); 58688 } else { 58689 promises.push(InkAnnotation.createNewAnnotation(xref, annotation, changes)); 58690 } 58691 break; 58692 case AnnotationEditorType.INK: 58693 promises.push(InkAnnotation.createNewAnnotation(xref, annotation, changes)); 58694 break; 58695 case AnnotationEditorType.STAMP: 58696 const image = isOffscreenCanvasSupported ? await imagePromises?.get(annotation.bitmapId) : null; 58697 if (image?.imageStream) { 58698 const { 58699 imageStream, 58700 smaskStream 58701 } = image; 58702 if (smaskStream) { 58703 const smaskRef = xref.getNewTemporaryRef(); 58704 changes.put(smaskRef, { 58705 data: smaskStream 58706 }); 58707 imageStream.dict.set("SMask", smaskRef); 58708 } 58709 const imageRef = image.imageRef = xref.getNewTemporaryRef(); 58710 changes.put(imageRef, { 58711 data: imageStream 58712 }); 58713 image.imageStream = image.smaskStream = null; 58714 } 58715 promises.push(StampAnnotation.createNewAnnotation(xref, annotation, changes, { 58716 image 58717 })); 58718 break; 58719 case AnnotationEditorType.SIGNATURE: 58720 promises.push(StampAnnotation.createNewAnnotation(xref, annotation, changes, {})); 58721 break; 58722 } 58723 } 58724 return { 58725 annotations: (await Promise.all(promises)).flat() 58726 }; 58727 } 58728 static async printNewAnnotations(annotationGlobals, evaluator, task, annotations, imagePromises) { 58729 if (!annotations) { 58730 return null; 58731 } 58732 const { 58733 options, 58734 xref 58735 } = evaluator; 58736 const promises = []; 58737 for (const annotation of annotations) { 58738 if (annotation.deleted) { 58739 continue; 58740 } 58741 switch (annotation.annotationType) { 58742 case AnnotationEditorType.FREETEXT: 58743 promises.push(FreeTextAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, { 58744 evaluator, 58745 task, 58746 evaluatorOptions: options 58747 })); 58748 break; 58749 case AnnotationEditorType.HIGHLIGHT: 58750 if (annotation.quadPoints) { 58751 promises.push(HighlightAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, { 58752 evaluatorOptions: options 58753 })); 58754 } else { 58755 promises.push(InkAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, { 58756 evaluatorOptions: options 58757 })); 58758 } 58759 break; 58760 case AnnotationEditorType.INK: 58761 promises.push(InkAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, { 58762 evaluatorOptions: options 58763 })); 58764 break; 58765 case AnnotationEditorType.STAMP: 58766 const image = options.isOffscreenCanvasSupported ? await imagePromises?.get(annotation.bitmapId) : null; 58767 if (image?.imageStream) { 58768 const { 58769 imageStream, 58770 smaskStream 58771 } = image; 58772 if (smaskStream) { 58773 imageStream.dict.set("SMask", smaskStream); 58774 } 58775 image.imageRef = new JpegStream(imageStream, imageStream.length); 58776 image.imageStream = image.smaskStream = null; 58777 } 58778 promises.push(StampAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, { 58779 image, 58780 evaluatorOptions: options 58781 })); 58782 break; 58783 case AnnotationEditorType.SIGNATURE: 58784 promises.push(StampAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, { 58785 evaluatorOptions: options 58786 })); 58787 break; 58788 } 58789 } 58790 return Promise.all(promises); 58791 } 58792} 58793function getRgbColor(color, defaultColor = new Uint8ClampedArray(3)) { 58794 if (!Array.isArray(color)) { 58795 return defaultColor; 58796 } 58797 const rgbColor = defaultColor || new Uint8ClampedArray(3); 58798 switch (color.length) { 58799 case 0: 58800 return null; 58801 case 1: 58802 ColorSpaceUtils.gray.getRgbItem(color, 0, rgbColor, 0); 58803 return rgbColor; 58804 case 3: 58805 ColorSpaceUtils.rgb.getRgbItem(color, 0, rgbColor, 0); 58806 return rgbColor; 58807 case 4: 58808 ColorSpaceUtils.cmyk.getRgbItem(color, 0, rgbColor, 0); 58809 return rgbColor; 58810 default: 58811 return defaultColor; 58812 } 58813} 58814function getPdfColorArray(color, defaultValue = null) { 58815 return color && Array.from(color, c => c / 255) || defaultValue; 58816} 58817function getQuadPoints(dict, rect) { 58818 const quadPoints = dict.getArray("QuadPoints"); 58819 if (!isNumberArray(quadPoints, null) || quadPoints.length === 0 || quadPoints.length % 8 > 0) { 58820 return null; 58821 } 58822 const newQuadPoints = new Float32Array(quadPoints.length); 58823 for (let i = 0, ii = quadPoints.length; i < ii; i += 8) { 58824 const [x1, y1, x2, y2, x3, y3, x4, y4] = quadPoints.slice(i, i + 8); 58825 const minX = Math.min(x1, x2, x3, x4); 58826 const maxX = Math.max(x1, x2, x3, x4); 58827 const minY = Math.min(y1, y2, y3, y4); 58828 const maxY = Math.max(y1, y2, y3, y4); 58829 if (rect !== null && (minX < rect[0] || maxX > rect[2] || minY < rect[1] || maxY > rect[3])) { 58830 return null; 58831 } 58832 newQuadPoints.set([minX, maxY, maxX, maxY, minX, minY, maxX, minY], i); 58833 } 58834 return newQuadPoints; 58835} 58836function getTransformMatrix(rect, bbox, matrix) { 58837 const minMax = F32_BBOX_INIT.slice(); 58838 Util.axialAlignedBoundingBox(bbox, matrix, minMax); 58839 const [minX, minY, maxX, maxY] = minMax; 58840 if (minX === maxX || minY === maxY) { 58841 return [1, 0, 0, 1, rect[0], rect[1]]; 58842 } 58843 const xRatio = (rect[2] - rect[0]) / (maxX - minX);
vendor: 9,708 bytes, lines 58844-59150
58844 const yRatio = (rect[3] - rect[1]) / (maxY - minY); 58845 return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio]; 58846} 58847class Annotation { 58848 constructor(params) { 58849 const { 58850 annotationGlobals, 58851 dict, 58852 orphanFields, 58853 ref, 58854 subtype, 58855 xref 58856 } = params; 58857 const parentRef = orphanFields?.get(ref); 58858 if (parentRef) { 58859 dict.set("Parent", parentRef); 58860 } 58861 this.setTitle(dict.get("T")); 58862 this.setContents(dict.get("Contents")); 58863 this.setModificationDate(dict.get("M")); 58864 this.setFlags(dict.get("F")); 58865 this.setRectangle(dict.getArray("Rect")); 58866 this.setColor(dict.getArray("C")); 58867 this.setBorderStyle(dict); 58868 this.setAppearance(dict); 58869 this.setOptionalContent(dict); 58870 const MK = dict.get("MK"); 58871 this.setBorderAndBackgroundColors(MK); 58872 this.setRotation(MK, dict); 58873 this.ref = params.ref instanceof Ref ? params.ref : null; 58874 this._streams = []; 58875 if (this.appearance) { 58876 this._streams.push(this.appearance); 58877 } 58878 const isLocked = !!(this.flags & AnnotationFlag.LOCKED); 58879 const isContentLocked = !!(this.flags & AnnotationFlag.LOCKEDCONTENTS); 58880 this.data = { 58881 annotationType: AnnotationType[subtype?.toUpperCase()], 58882 annotationFlags: this.flags, 58883 borderStyle: this.borderStyle, 58884 color: this.color, 58885 backgroundColor: this.backgroundColor, 58886 borderColor: this.borderColor, 58887 rotation: this.rotation, 58888 contentsObj: this._contents, 58889 hasAppearance: !!this.appearance, 58890 id: params.id, 58891 modificationDate: this.modificationDate, 58892 rect: this.rectangle, 58893 subtype, 58894 hasOwnCanvas: false, 58895 noRotate: !!(this.flags & AnnotationFlag.NOROTATE), 58896 noHTML: isLocked && isContentLocked, 58897 isEditable: false, 58898 structParent: -1 58899 }; 58900 if (annotationGlobals.structTreeRoot) { 58901 let structParent = dict.get("StructParent"); 58902 this.data.structParent = structParent = Number.isInteger(structParent) && structParent >= 0 ? structParent : -1; 58903 annotationGlobals.structTreeRoot.addAnnotationIdToPage(params.pageRef, structParent); 58904 } 58905 if (params.collectFields) { 58906 const kids = dict.get("Kids"); 58907 if (Array.isArray(kids)) { 58908 const kidIds = []; 58909 for (const kid of kids) { 58910 if (kid instanceof Ref) { 58911 kidIds.push(kid.toString()); 58912 } 58913 } 58914 if (kidIds.length !== 0) { 58915 this.data.kidIds = kidIds; 58916 } 58917 } 58918 this.data.actions = collectActions(xref, dict, AnnotationActionEventType); 58919 this.data.fieldName = this._constructFieldName(dict); 58920 this.data.pageIndex = params.pageIndex; 58921 } 58922 const it = dict.get("IT"); 58923 if (it instanceof Name) { 58924 this.data.it = it.name; 58925 } 58926 this._isOffscreenCanvasSupported = params.evaluatorOptions.isOffscreenCanvasSupported; 58927 this._fallbackFontDict = null; 58928 this._needAppearances = false; 58929 } 58930 _hasFlag(flags, flag) { 58931 return !!(flags & flag); 58932 } 58933 _buildFlags(noView, noPrint) { 58934 let { 58935 flags 58936 } = this; 58937 if (noView === undefined) { 58938 if (noPrint === undefined) { 58939 return undefined; 58940 } 58941 if (noPrint) { 58942 return flags & ~AnnotationFlag.PRINT; 58943 } 58944 return flags & ~AnnotationFlag.HIDDEN | AnnotationFlag.PRINT; 58945 } 58946 if (noView) { 58947 flags |= AnnotationFlag.PRINT; 58948 if (noPrint) { 58949 return flags & ~AnnotationFlag.NOVIEW | AnnotationFlag.HIDDEN; 58950 } 58951 return flags & ~AnnotationFlag.HIDDEN | AnnotationFlag.NOVIEW; 58952 } 58953 flags &= ~(AnnotationFlag.HIDDEN | AnnotationFlag.NOVIEW); 58954 if (noPrint) { 58955 return flags & ~AnnotationFlag.PRINT; 58956 } 58957 return flags | AnnotationFlag.PRINT; 58958 } 58959 _isViewable(flags) { 58960 return !this._hasFlag(flags, AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, AnnotationFlag.NOVIEW); 58961 } 58962 _isPrintable(flags) { 58963 return this._hasFlag(flags, AnnotationFlag.PRINT) && !this._hasFlag(flags, AnnotationFlag.HIDDEN) && !this._hasFlag(flags, AnnotationFlag.INVISIBLE); 58964 } 58965 mustBeViewed(annotationStorage, _renderForms) { 58966 const noView = annotationStorage?.get(this.data.id)?.noView; 58967 if (noView !== undefined) { 58968 return !noView; 58969 } 58970 return this.viewable && !this._hasFlag(this.flags, AnnotationFlag.HIDDEN); 58971 } 58972 mustBePrinted(annotationStorage) { 58973 const noPrint = annotationStorage?.get(this.data.id)?.noPrint; 58974 if (noPrint !== undefined) { 58975 return !noPrint; 58976 } 58977 return this.printable; 58978 } 58979 mustBeViewedWhenEditing(isEditing, modifiedIds = null) { 58980 return isEditing ? !this.data.isEditable : !modifiedIds?.has(this.data.id); 58981 } 58982 get viewable() { 58983 if (this.data.quadPoints === null) { 58984 return false; 58985 } 58986 if (this.flags === 0) { 58987 return true; 58988 } 58989 return this._isViewable(this.flags); 58990 } 58991 get printable() { 58992 if (this.data.quadPoints === null) { 58993 return false; 58994 } 58995 if (this.flags === 0) { 58996 return false; 58997 } 58998 return this._isPrintable(this.flags); 58999 } 59000 _parseStringHelper(data) { 59001 const str = typeof data === "string" ? stringToPDFString(data) : ""; 59002 const dir = str && bidi(str).dir === "rtl" ? "rtl" : "ltr"; 59003 return { 59004 str, 59005 dir 59006 }; 59007 } 59008 setDefaultAppearance(params) { 59009 const { 59010 dict, 59011 annotationGlobals 59012 } = params; 59013 const defaultAppearance = getInheritableProperty({ 59014 dict, 59015 key: "DA" 59016 }) || annotationGlobals.acroForm.get("DA"); 59017 this._defaultAppearance = typeof defaultAppearance === "string" ? defaultAppearance : ""; 59018 this.data.defaultAppearanceData = parseDefaultAppearance(this._defaultAppearance); 59019 } 59020 setTitle(title) { 59021 this._title = this._parseStringHelper(title); 59022 } 59023 setContents(contents) { 59024 this._contents = this._parseStringHelper(contents); 59025 } 59026 setModificationDate(modificationDate) { 59027 this.modificationDate = typeof modificationDate === "string" ? modificationDate : null; 59028 } 59029 setFlags(flags) { 59030 this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0; 59031 if (this.flags & AnnotationFlag.INVISIBLE && this.constructor.name !== "Annotation") { 59032 this.flags ^= AnnotationFlag.INVISIBLE; 59033 } 59034 } 59035 hasFlag(flag) { 59036 return this._hasFlag(this.flags, flag); 59037 } 59038 setRectangle(rectangle) { 59039 this.rectangle = lookupNormalRect(rectangle, [0, 0, 0, 0]); 59040 } 59041 setColor(color) { 59042 this.color = getRgbColor(color); 59043 } 59044 setLineEndings(lineEndings) { 59045 this.lineEndings = ["None", "None"]; 59046 if (Array.isArray(lineEndings) && lineEndings.length === 2) { 59047 for (let i = 0; i < 2; i++) { 59048 const obj = lineEndings[i]; 59049 if (obj instanceof Name) { 59050 switch (obj.name) { 59051 case "None": 59052 continue; 59053 case "Square": 59054 case "Circle": 59055 case "Diamond": 59056 case "OpenArrow": 59057 case "ClosedArrow": 59058 case "Butt": 59059 case "ROpenArrow": 59060 case "RClosedArrow": 59061 case "Slash": 59062 this.lineEndings[i] = obj.name; 59063 continue; 59064 } 59065 } 59066 warn(`Ignoring invalid lineEnding: ${obj}`); 59067 } 59068 } 59069 } 59070 setRotation(mk, dict) { 59071 this.rotation = 0; 59072 let angle = mk instanceof Dict ? mk.get("R") || 0 : dict.get("Rotate") || 0; 59073 if (Number.isInteger(angle) && angle !== 0) { 59074 angle %= 360; 59075 if (angle < 0) { 59076 angle += 360; 59077 } 59078 if (angle % 90 === 0) { 59079 this.rotation = angle; 59080 } 59081 } 59082 } 59083 setBorderAndBackgroundColors(mk) { 59084 if (mk instanceof Dict) { 59085 this.borderColor = getRgbColor(mk.getArray("BC"), null); 59086 this.backgroundColor = getRgbColor(mk.getArray("BG"), null); 59087 } else { 59088 this.borderColor = this.backgroundColor = null; 59089 } 59090 } 59091 setBorderStyle(borderStyle) { 59092 this.borderStyle = new AnnotationBorderStyle(); 59093 if (!(borderStyle instanceof Dict)) { 59094 return; 59095 } 59096 if (borderStyle.has("BS")) { 59097 const dict = borderStyle.get("BS"); 59098 if (dict instanceof Dict) { 59099 const dictType = dict.get("Type"); 59100 if (!dictType || isName(dictType, "Border")) { 59101 this.borderStyle.setWidth(dict.get("W"), this.rectangle); 59102 this.borderStyle.setStyle(dict.get("S")); 59103 this.borderStyle.setDashArray(dict.getArray("D")); 59104 } 59105 } 59106 } else if (borderStyle.has("Border")) { 59107 const array = borderStyle.getArray("Border"); 59108 if (Array.isArray(array)) { 59109 if (array.length >= 3) { 59110 this.borderStyle.setHorizontalCornerRadius(array[0]); 59111 this.borderStyle.setVerticalCornerRadius(array[1]); 59112 this.borderStyle.setWidth(array[2], this.rectangle); 59113 if (array.length === 4) { 59114 this.borderStyle.setDashArray(array[3], true); 59115 } 59116 } else if (array.length === 0) { 59117 this.borderStyle.setWidth(0); 59118 } 59119 } 59120 } else { 59121 this.borderStyle.setWidth(0); 59122 } 59123 } 59124 setAppearance(dict) { 59125 this.appearance = null; 59126 const appearanceStates = dict.get("AP"); 59127 if (!(appearanceStates instanceof Dict)) { 59128 return; 59129 } 59130 const normalAppearanceState = appearanceStates.get("N"); 59131 if (normalAppearanceState instanceof BaseStream) { 59132 this.appearance = normalAppearanceState; 59133 return; 59134 } 59135 if (!(normalAppearanceState instanceof Dict)) { 59136 return; 59137 } 59138 const as = dict.get("AS"); 59139 if (!(as instanceof Name) || !normalAppearanceState.has(as.name)) { 59140 return; 59141 } 59142 const appearance = normalAppearanceState.get(as.name); 59143 if (appearance instanceof BaseStream) { 59144 this.appearance = appearance; 59145 } 59146 } 59147 setOptionalContent(dict) { 59148 this.oc = null; 59149 const oc = dict.get("OC"); 59150 if (oc instanceof Name) {
vendor: 15,323 bytes, lines 59151-59650
59151 warn("setOptionalContent: Support for /Name-entry is not implemented."); 59152 } else if (oc instanceof Dict) { 59153 this.oc = oc; 59154 } 59155 } 59156 async loadResources(keys, appearance) { 59157 const resources = await appearance.dict.getAsync("Resources"); 59158 if (resources) { 59159 await ObjectLoader.load(resources, keys, resources.xref); 59160 } 59161 return resources; 59162 } 59163 async getOperatorList(evaluator, task, intent, annotationStorage) { 59164 const { 59165 hasOwnCanvas, 59166 id, 59167 rect 59168 } = this.data; 59169 let appearance = this.appearance; 59170 const isUsingOwnCanvas = !!(hasOwnCanvas && intent & RenderingIntentFlag.DISPLAY); 59171 if (isUsingOwnCanvas && (this.width === 0 || this.height === 0)) { 59172 this.data.hasOwnCanvas = false; 59173 return { 59174 opList: new OperatorList(), 59175 separateForm: false, 59176 separateCanvas: false 59177 }; 59178 } 59179 if (!appearance) { 59180 if (!isUsingOwnCanvas) { 59181 return { 59182 opList: new OperatorList(), 59183 separateForm: false, 59184 separateCanvas: false 59185 }; 59186 } 59187 appearance = new StringStream(""); 59188 appearance.dict = new Dict(); 59189 } 59190 const appearanceDict = appearance.dict; 59191 const resources = await this.loadResources(RESOURCES_KEYS_OPERATOR_LIST, appearance); 59192 const bbox = lookupRect(appearanceDict.getArray("BBox"), [0, 0, 1, 1]); 59193 const matrix = lookupMatrix(appearanceDict.getArray("Matrix"), IDENTITY_MATRIX); 59194 const transform = getTransformMatrix(rect, bbox, matrix); 59195 const opList = new OperatorList(); 59196 let optionalContent; 59197 if (this.oc) { 59198 optionalContent = await evaluator.parseMarkedContentProps(this.oc, null); 59199 } 59200 if (optionalContent !== undefined) { 59201 opList.addOp(OPS.beginMarkedContentProps, ["OC", optionalContent]); 59202 } 59203 opList.addOp(OPS.beginAnnotation, [id, rect, transform, matrix, isUsingOwnCanvas]); 59204 await evaluator.getOperatorList({ 59205 stream: appearance, 59206 task, 59207 resources, 59208 operatorList: opList, 59209 fallbackFontDict: this._fallbackFontDict 59210 }); 59211 opList.addOp(OPS.endAnnotation, []); 59212 if (optionalContent !== undefined) { 59213 opList.addOp(OPS.endMarkedContent, []); 59214 } 59215 this.reset(); 59216 return { 59217 opList, 59218 separateForm: false, 59219 separateCanvas: isUsingOwnCanvas 59220 }; 59221 } 59222 async save(evaluator, task, annotationStorage, changes) { 59223 return null; 59224 } 59225 get overlaysTextContent() { 59226 return false; 59227 } 59228 get hasTextContent() { 59229 return false; 59230 } 59231 async extractTextContent(evaluator, task, viewBox) { 59232 if (!this.appearance) { 59233 return; 59234 } 59235 const resources = await this.loadResources(RESOURCES_KEYS_TEXT_CONTENT, this.appearance); 59236 const text = []; 59237 const buffer = []; 59238 let firstPosition = null; 59239 const sink = { 59240 desiredSize: Math.Infinity, 59241 ready: true, 59242 enqueue(chunk, size) { 59243 for (const item of chunk.items) { 59244 if (item.str === undefined) { 59245 continue; 59246 } 59247 firstPosition ||= item.transform.slice(-2); 59248 buffer.push(item.str); 59249 if (item.hasEOL) { 59250 text.push(buffer.join("").trimEnd()); 59251 buffer.length = 0; 59252 } 59253 } 59254 } 59255 }; 59256 await evaluator.getTextContent({ 59257 stream: this.appearance, 59258 task, 59259 resources, 59260 includeMarkedContent: true, 59261 keepWhiteSpace: true, 59262 sink, 59263 viewBox 59264 }); 59265 this.reset(); 59266 if (buffer.length) { 59267 text.push(buffer.join("").trimEnd()); 59268 } 59269 if (text.length > 1 || text[0]) { 59270 const appearanceDict = this.appearance.dict; 59271 const bbox = lookupRect(appearanceDict.getArray("BBox"), null); 59272 const matrix = lookupMatrix(appearanceDict.getArray("Matrix"), null); 59273 this.data.textPosition = this._transformPoint(firstPosition, bbox, matrix); 59274 this.data.textContent = text; 59275 } 59276 } 59277 _transformPoint(coords, bbox, matrix) { 59278 const { 59279 rect 59280 } = this.data; 59281 bbox ||= [0, 0, 1, 1]; 59282 matrix ||= [1, 0, 0, 1, 0, 0]; 59283 const transform = getTransformMatrix(rect, bbox, matrix); 59284 transform[4] -= rect[0]; 59285 transform[5] -= rect[1]; 59286 const p = coords.slice(); 59287 Util.applyTransform(p, transform); 59288 Util.applyTransform(p, matrix); 59289 return p; 59290 } 59291 getFieldObject() { 59292 if (this.data.kidIds) { 59293 return { 59294 id: this.data.id, 59295 actions: this.data.actions, 59296 name: this.data.fieldName, 59297 strokeColor: this.data.borderColor, 59298 fillColor: this.data.backgroundColor, 59299 type: "", 59300 kidIds: this.data.kidIds, 59301 page: this.data.pageIndex, 59302 rotation: this.rotation 59303 }; 59304 } 59305 return null; 59306 } 59307 reset() { 59308 for (const stream of this._streams) { 59309 stream.reset(); 59310 } 59311 } 59312 _constructFieldName(dict) { 59313 if (!dict.has("T") && !dict.has("Parent")) { 59314 warn("Unknown field name, falling back to empty field name."); 59315 return ""; 59316 } 59317 if (!dict.has("Parent")) { 59318 return stringToPDFString(dict.get("T")); 59319 } 59320 const fieldName = []; 59321 if (dict.has("T")) { 59322 fieldName.unshift(stringToPDFString(dict.get("T"))); 59323 } 59324 let loopDict = dict; 59325 const visited = new RefSet(); 59326 if (dict.objId) { 59327 visited.put(dict.objId); 59328 } 59329 while (loopDict.has("Parent")) { 59330 loopDict = loopDict.get("Parent"); 59331 if (!(loopDict instanceof Dict) || loopDict.objId && visited.has(loopDict.objId)) { 59332 break; 59333 } 59334 if (loopDict.objId) { 59335 visited.put(loopDict.objId); 59336 } 59337 if (loopDict.has("T")) { 59338 fieldName.unshift(stringToPDFString(loopDict.get("T"))); 59339 } 59340 } 59341 return fieldName.join("."); 59342 } 59343 get width() { 59344 return this.data.rect[2] - this.data.rect[0]; 59345 } 59346 get height() { 59347 return this.data.rect[3] - this.data.rect[1]; 59348 } 59349} 59350class AnnotationBorderStyle { 59351 width = 1; 59352 rawWidth = 1; 59353 style = AnnotationBorderStyleType.SOLID; 59354 dashArray = [3]; 59355 horizontalCornerRadius = 0; 59356 verticalCornerRadius = 0; 59357 setWidth(width, rect = [0, 0, 0, 0]) { 59358 if (width instanceof Name) { 59359 this.width = 0; 59360 return; 59361 } 59362 if (typeof width === "number") { 59363 if (width > 0) { 59364 this.rawWidth = width; 59365 const maxWidth = (rect[2] - rect[0]) / 2; 59366 const maxHeight = (rect[3] - rect[1]) / 2; 59367 if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) { 59368 warn(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`); 59369 width = 1; 59370 } 59371 } 59372 this.width = width; 59373 } 59374 } 59375 setStyle(style) { 59376 if (!(style instanceof Name)) { 59377 return; 59378 } 59379 switch (style.name) { 59380 case "S": 59381 this.style = AnnotationBorderStyleType.SOLID; 59382 break; 59383 case "D": 59384 this.style = AnnotationBorderStyleType.DASHED; 59385 break; 59386 case "B": 59387 this.style = AnnotationBorderStyleType.BEVELED; 59388 break; 59389 case "I": 59390 this.style = AnnotationBorderStyleType.INSET; 59391 break; 59392 case "U": 59393 this.style = AnnotationBorderStyleType.UNDERLINE; 59394 break; 59395 default: 59396 break; 59397 } 59398 } 59399 setDashArray(dashArray, forceStyle = false) { 59400 if (Array.isArray(dashArray)) { 59401 let isValid = true; 59402 let allZeros = true; 59403 for (const element of dashArray) { 59404 const validNumber = +element >= 0; 59405 if (!validNumber) { 59406 isValid = false; 59407 break; 59408 } else if (element > 0) { 59409 allZeros = false; 59410 } 59411 } 59412 if (dashArray.length === 0 || isValid && !allZeros) { 59413 this.dashArray = dashArray; 59414 if (forceStyle) { 59415 this.setStyle(Name.get("D")); 59416 } 59417 } else { 59418 this.width = 0; 59419 } 59420 } else if (dashArray) { 59421 this.width = 0; 59422 } 59423 } 59424 setHorizontalCornerRadius(radius) { 59425 if (Number.isInteger(radius)) { 59426 this.horizontalCornerRadius = radius; 59427 } 59428 } 59429 setVerticalCornerRadius(radius) { 59430 if (Number.isInteger(radius)) { 59431 this.verticalCornerRadius = radius; 59432 } 59433 } 59434} 59435class MarkupAnnotation extends Annotation { 59436 constructor(params) { 59437 super(params); 59438 const { 59439 dict 59440 } = params; 59441 if (dict.has("IRT")) { 59442 const rawIRT = dict.getRaw("IRT"); 59443 this.data.inReplyTo = rawIRT instanceof Ref ? rawIRT.toString() : null; 59444 const rt = dict.get("RT"); 59445 this.data.replyType = rt instanceof Name ? rt.name : AnnotationReplyType.REPLY; 59446 } 59447 let popupRef = null; 59448 if (this.data.replyType === AnnotationReplyType.GROUP) { 59449 const parent = dict.get("IRT"); 59450 this.setTitle(parent.get("T")); 59451 this.data.titleObj = this._title; 59452 this.setContents(parent.get("Contents")); 59453 this.data.contentsObj = this._contents; 59454 if (!parent.has("CreationDate")) { 59455 this.data.creationDate = null; 59456 } else { 59457 this.setCreationDate(parent.get("CreationDate")); 59458 this.data.creationDate = this.creationDate; 59459 } 59460 if (!parent.has("M")) { 59461 this.data.modificationDate = null; 59462 } else { 59463 this.setModificationDate(parent.get("M")); 59464 this.data.modificationDate = this.modificationDate; 59465 } 59466 popupRef = parent.getRaw("Popup"); 59467 if (!parent.has("C")) { 59468 this.data.color = null; 59469 } else { 59470 this.setColor(parent.getArray("C")); 59471 this.data.color = this.color; 59472 } 59473 } else { 59474 this.data.titleObj = this._title; 59475 this.setCreationDate(dict.get("CreationDate")); 59476 this.data.creationDate = this.creationDate; 59477 popupRef = dict.getRaw("Popup"); 59478 if (!dict.has("C")) { 59479 this.data.color = null; 59480 } 59481 } 59482 this.data.popupRef = popupRef instanceof Ref ? popupRef.toString() : null; 59483 if (dict.has("RC")) { 59484 this.data.richText = XFAFactory.getRichTextAsHtml(dict.get("RC")); 59485 } 59486 } 59487 setCreationDate(creationDate) { 59488 this.creationDate = typeof creationDate === "string" ? creationDate : null; 59489 } 59490 _setDefaultAppearance({ 59491 xref, 59492 extra, 59493 strokeColor, 59494 fillColor, 59495 blendMode, 59496 strokeAlpha, 59497 fillAlpha, 59498 pointsCallback 59499 }) { 59500 const bbox = this.data.rect = BBOX_INIT.slice(); 59501 const buffer = ["q"]; 59502 if (extra) { 59503 buffer.push(extra); 59504 } 59505 if (strokeColor) { 59506 buffer.push(`${strokeColor[0]} ${strokeColor[1]} ${strokeColor[2]} RG`); 59507 } 59508 if (fillColor) { 59509 buffer.push(`${fillColor[0]} ${fillColor[1]} ${fillColor[2]} rg`); 59510 } 59511 const pointsArray = this.data.quadPoints || Float32Array.from([this.rectangle[0], this.rectangle[3], this.rectangle[2], this.rectangle[3], this.rectangle[0], this.rectangle[1], this.rectangle[2], this.rectangle[1]]); 59512 for (let i = 0, ii = pointsArray.length; i < ii; i += 8) { 59513 const points = pointsCallback(buffer, pointsArray.subarray(i, i + 8)); 59514 Util.rectBoundingBox(...points, bbox); 59515 } 59516 buffer.push("Q"); 59517 const formDict = new Dict(xref); 59518 const appearanceStreamDict = new Dict(xref); 59519 appearanceStreamDict.setIfName("Subtype", "Form"); 59520 const appearanceStream = new StringStream(buffer.join(" ")); 59521 appearanceStream.dict = appearanceStreamDict; 59522 formDict.set("Fm0", appearanceStream); 59523 const gsDict = new Dict(xref); 59524 if (blendMode) { 59525 gsDict.setIfName("BM", blendMode); 59526 } 59527 gsDict.setIfNumber("CA", strokeAlpha); 59528 gsDict.setIfNumber("ca", fillAlpha); 59529 const stateDict = new Dict(xref); 59530 stateDict.set("GS0", gsDict); 59531 const resources = new Dict(xref); 59532 resources.set("ExtGState", stateDict); 59533 resources.set("XObject", formDict); 59534 const appearanceDict = new Dict(xref); 59535 appearanceDict.set("Resources", resources); 59536 appearanceDict.set("BBox", bbox); 59537 this.appearance = new StringStream("/GS0 gs /Fm0 Do"); 59538 this.appearance.dict = appearanceDict; 59539 this._streams.push(this.appearance, appearanceStream); 59540 } 59541 static async createNewAnnotation(xref, annotation, changes, params) { 59542 const annotationRef = annotation.ref ||= xref.getNewTemporaryRef(); 59543 const ap = await this.createNewAppearanceStream(annotation, xref, params); 59544 let annotationDict; 59545 if (ap) { 59546 const apRef = xref.getNewTemporaryRef(); 59547 annotationDict = this.createNewDict(annotation, xref, { 59548 apRef 59549 }); 59550 changes.put(apRef, { 59551 data: ap 59552 }); 59553 } else { 59554 annotationDict = this.createNewDict(annotation, xref, {}); 59555 } 59556 if (Number.isInteger(annotation.parentTreeId)) { 59557 annotationDict.set("StructParent", annotation.parentTreeId); 59558 } 59559 changes.put(annotationRef, { 59560 data: annotationDict 59561 }); 59562 const retRef = { 59563 ref: annotationRef 59564 }; 59565 const { 59566 popup 59567 } = annotation; 59568 if (popup) { 59569 if (popup.deleted) { 59570 annotationDict.delete("Popup"); 59571 annotationDict.delete("Contents"); 59572 annotationDict.delete("RC"); 59573 return retRef; 59574 } 59575 const popupRef = popup.ref ||= xref.getNewTemporaryRef(); 59576 popup.parent = annotationRef; 59577 const popupDict = PopupAnnotation.createNewDict(popup, xref); 59578 changes.put(popupRef, { 59579 data: popupDict 59580 }); 59581 annotationDict.setIfDefined("Contents", stringToAsciiOrUTF16BE(popup.contents)); 59582 annotationDict.set("Popup", popupRef); 59583 return [retRef, { 59584 ref: popupRef 59585 }]; 59586 } 59587 return retRef; 59588 } 59589 static async createNewPrintAnnotation(annotationGlobals, xref, annotation, params) { 59590 const ap = await this.createNewAppearanceStream(annotation, xref, params); 59591 const annotationDict = this.createNewDict(annotation, xref, ap ? { 59592 ap 59593 } : {}); 59594 const newAnnotation = new this.prototype.constructor({ 59595 dict: annotationDict, 59596 xref, 59597 annotationGlobals, 59598 evaluatorOptions: params.evaluatorOptions 59599 }); 59600 if (annotation.ref) { 59601 newAnnotation.ref = newAnnotation.refToReplace = annotation.ref; 59602 } 59603 return newAnnotation; 59604 } 59605} 59606class WidgetAnnotation extends Annotation { 59607 constructor(params) { 59608 super(params); 59609 const { 59610 dict, 59611 xref, 59612 annotationGlobals 59613 } = params; 59614 const data = this.data; 59615 this._needAppearances = params.needAppearances; 59616 if (data.fieldName === undefined) { 59617 data.fieldName = this._constructFieldName(dict); 59618 } 59619 if (data.actions === undefined) { 59620 data.actions = collectActions(xref, dict, AnnotationActionEventType); 59621 } 59622 let fieldValue = getInheritableProperty({ 59623 dict, 59624 key: "V", 59625 getArray: true 59626 }); 59627 data.fieldValue = this._decodeFormValue(fieldValue); 59628 const defaultFieldValue = getInheritableProperty({ 59629 dict, 59630 key: "DV", 59631 getArray: true 59632 }); 59633 data.defaultFieldValue = this._decodeFormValue(defaultFieldValue); 59634 if (fieldValue === undefined && annotationGlobals.xfaDatasets) { 59635 const path = this._title.str; 59636 if (path) { 59637 this._hasValueFromXFA = true; 59638 data.fieldValue = fieldValue = annotationGlobals.xfaDatasets.getValue(path); 59639 } 59640 } 59641 if (fieldValue === undefined && data.defaultFieldValue !== null) { 59642 data.fieldValue = data.defaultFieldValue; 59643 } 59644 data.alternativeText = stringToPDFString(dict.get("TU") || ""); 59645 this.setDefaultAppearance(params); 59646 data.hasAppearance ||= this._needAppearances && data.fieldValue !== undefined && data.fieldValue !== null; 59647 const fieldType = getInheritableProperty({ 59648 dict, 59649 key: "FT" 59650 });
vendor: 10,950 bytes, lines 59651-59960
59651 data.fieldType = fieldType instanceof Name ? fieldType.name : null; 59652 const localResources = getInheritableProperty({ 59653 dict, 59654 key: "DR" 59655 }); 59656 const acroFormResources = annotationGlobals.acroForm.get("DR"); 59657 const appearanceResources = this.appearance?.dict.get("Resources"); 59658 this._fieldResources = { 59659 localResources, 59660 acroFormResources, 59661 appearanceResources, 59662 mergedResources: Dict.merge({ 59663 xref, 59664 dictArray: [localResources, appearanceResources, acroFormResources], 59665 mergeSubDicts: true 59666 }) 59667 }; 59668 data.fieldFlags = getInheritableProperty({ 59669 dict, 59670 key: "Ff" 59671 }); 59672 if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) { 59673 data.fieldFlags = 0; 59674 } 59675 data.password = this.hasFieldFlag(AnnotationFieldFlag.PASSWORD); 59676 data.readOnly = this.hasFieldFlag(AnnotationFieldFlag.READONLY); 59677 data.required = this.hasFieldFlag(AnnotationFieldFlag.REQUIRED); 59678 data.hidden = this._hasFlag(data.annotationFlags, AnnotationFlag.HIDDEN) || this._hasFlag(data.annotationFlags, AnnotationFlag.NOVIEW); 59679 } 59680 _decodeFormValue(formValue) { 59681 if (Array.isArray(formValue)) { 59682 const arr = formValue.map(item => this._decodeFormValue(item)).filter(item => item !== null); 59683 return arr.length > 0 ? arr : null; 59684 } else if (formValue instanceof Name) { 59685 return formValue.name; 59686 } else if (typeof formValue === "string") { 59687 return stringToPDFString(formValue); 59688 } 59689 return null; 59690 } 59691 hasFieldFlag(flag) { 59692 return !!(this.data.fieldFlags & flag); 59693 } 59694 _isViewable(flags) { 59695 return true; 59696 } 59697 mustBeViewed(annotationStorage, renderForms) { 59698 if (renderForms) { 59699 return this.viewable; 59700 } 59701 return super.mustBeViewed(annotationStorage, renderForms) && !this._hasFlag(this.flags, AnnotationFlag.NOVIEW); 59702 } 59703 getRotationMatrix(annotationStorage) { 59704 let rotation = annotationStorage?.get(this.data.id)?.rotation; 59705 if (rotation === undefined) { 59706 rotation = this.rotation; 59707 } 59708 return rotation === 0 ? IDENTITY_MATRIX : getRotationMatrix(rotation, this.width, this.height); 59709 } 59710 getBorderAndBackgroundAppearances(annotationStorage) { 59711 let rotation = annotationStorage?.get(this.data.id)?.rotation; 59712 if (rotation === undefined) { 59713 rotation = this.rotation; 59714 } 59715 if (!this.backgroundColor && !this.borderColor) { 59716 return ""; 59717 } 59718 const rect = rotation === 0 || rotation === 180 ? `0 0 ${this.width} ${this.height} re` : `0 0 ${this.height} ${this.width} re`; 59719 let str = ""; 59720 if (this.backgroundColor) { 59721 str = `${getPdfColor(this.backgroundColor, true)} ${rect} f `; 59722 } 59723 if (this.borderColor) { 59724 const borderWidth = this.borderStyle.width || 1; 59725 str += `${borderWidth} w ${getPdfColor(this.borderColor, false)} ${rect} S `; 59726 } 59727 return str; 59728 } 59729 async getOperatorList(evaluator, task, intent, annotationStorage) { 59730 if (intent & RenderingIntentFlag.ANNOTATIONS_FORMS && !(this instanceof SignatureWidgetAnnotation) && !this.data.noHTML && !this.data.hasOwnCanvas) { 59731 return { 59732 opList: new OperatorList(), 59733 separateForm: true, 59734 separateCanvas: false 59735 }; 59736 } 59737 if (!this._hasText) { 59738 return super.getOperatorList(evaluator, task, intent, annotationStorage); 59739 } 59740 const content = await this._getAppearance(evaluator, task, intent, annotationStorage); 59741 if (this.appearance && content === null) { 59742 return super.getOperatorList(evaluator, task, intent, annotationStorage); 59743 } 59744 const opList = new OperatorList(); 59745 if (!this._defaultAppearance || content === null) { 59746 return { 59747 opList, 59748 separateForm: false, 59749 separateCanvas: false 59750 }; 59751 } 59752 const isUsingOwnCanvas = !!(this.data.hasOwnCanvas && intent & RenderingIntentFlag.DISPLAY); 59753 const matrix = [1, 0, 0, 1, 0, 0]; 59754 const bbox = [0, 0, this.width, this.height]; 59755 const transform = getTransformMatrix(this.data.rect, bbox, matrix); 59756 let optionalContent; 59757 if (this.oc) { 59758 optionalContent = await evaluator.parseMarkedContentProps(this.oc, null); 59759 } 59760 if (optionalContent !== undefined) { 59761 opList.addOp(OPS.beginMarkedContentProps, ["OC", optionalContent]); 59762 } 59763 opList.addOp(OPS.beginAnnotation, [this.data.id, this.data.rect, transform, this.getRotationMatrix(annotationStorage), isUsingOwnCanvas]); 59764 const stream = new StringStream(content); 59765 await evaluator.getOperatorList({ 59766 stream, 59767 task, 59768 resources: this._fieldResources.mergedResources, 59769 operatorList: opList 59770 }); 59771 opList.addOp(OPS.endAnnotation, []); 59772 if (optionalContent !== undefined) { 59773 opList.addOp(OPS.endMarkedContent, []); 59774 } 59775 return { 59776 opList, 59777 separateForm: false, 59778 separateCanvas: isUsingOwnCanvas 59779 }; 59780 } 59781 _getMKDict(rotation) { 59782 const mk = new Dict(null); 59783 if (rotation) { 59784 mk.set("R", rotation); 59785 } 59786 mk.setIfArray("BC", getPdfColorArray(this.borderColor)); 59787 mk.setIfArray("BG", getPdfColorArray(this.backgroundColor)); 59788 return mk.size > 0 ? mk : null; 59789 } 59790 amendSavedDict(annotationStorage, dict) {} 59791 setValue(dict, value, xref, changes) { 59792 const { 59793 dict: parentDict, 59794 ref: parentRef 59795 } = getParentToUpdate(dict, this.ref, xref); 59796 if (!parentDict) { 59797 dict.set("V", value); 59798 } else if (!changes.has(parentRef)) { 59799 const newParentDict = parentDict.clone(); 59800 newParentDict.set("V", value); 59801 changes.put(parentRef, { 59802 data: newParentDict 59803 }); 59804 return newParentDict; 59805 } 59806 return null; 59807 } 59808 async save(evaluator, task, annotationStorage, changes) { 59809 const storageEntry = annotationStorage?.get(this.data.id); 59810 const flags = this._buildFlags(storageEntry?.noView, storageEntry?.noPrint); 59811 let value = storageEntry?.value, 59812 rotation = storageEntry?.rotation; 59813 if (value === this.data.fieldValue || value === undefined) { 59814 if (!this._hasValueFromXFA && rotation === undefined && flags === undefined) { 59815 return; 59816 } 59817 value ||= this.data.fieldValue; 59818 } 59819 if (rotation === undefined && !this._hasValueFromXFA && Array.isArray(value) && Array.isArray(this.data.fieldValue) && isArrayEqual(value, this.data.fieldValue) && flags === undefined) { 59820 return; 59821 } 59822 if (rotation === undefined) { 59823 rotation = this.rotation; 59824 } 59825 let appearance = null; 59826 if (!this._needAppearances) { 59827 appearance = await this._getAppearance(evaluator, task, RenderingIntentFlag.SAVE, annotationStorage); 59828 if (appearance === null && flags === undefined) { 59829 return; 59830 } 59831 } else {} 59832 let needAppearances = false; 59833 if (appearance?.needAppearances) { 59834 needAppearances = true; 59835 appearance = null; 59836 } 59837 const { 59838 xref 59839 } = evaluator; 59840 const originalDict = xref.fetchIfRef(this.ref); 59841 if (!(originalDict instanceof Dict)) { 59842 return; 59843 } 59844 const dict = new Dict(xref); 59845 for (const [key, rawVal] of originalDict.getRawEntries()) { 59846 if (key !== "AP") { 59847 dict.set(key, rawVal); 59848 } 59849 } 59850 if (flags !== undefined) { 59851 dict.set("F", flags); 59852 if (appearance === null && !needAppearances) { 59853 const ap = originalDict.getRaw("AP"); 59854 if (ap) { 59855 dict.set("AP", ap); 59856 } 59857 } 59858 } 59859 const xfa = { 59860 path: this.data.fieldName, 59861 value 59862 }; 59863 const newParentDict = this.setValue(dict, Array.isArray(value) ? value.map(stringToAsciiOrUTF16BE) : stringToAsciiOrUTF16BE(value), xref, changes); 59864 this.amendSavedDict(annotationStorage, newParentDict || dict); 59865 const maybeMK = this._getMKDict(rotation); 59866 if (maybeMK) { 59867 dict.set("MK", maybeMK); 59868 } 59869 changes.put(this.ref, { 59870 data: dict, 59871 xfa, 59872 needAppearances 59873 }); 59874 if (appearance !== null) { 59875 const newRef = xref.getNewTemporaryRef(); 59876 const AP = new Dict(xref); 59877 dict.set("AP", AP); 59878 AP.set("N", newRef); 59879 const resources = this._getSaveFieldResources(xref); 59880 const appearanceStream = new StringStream(appearance); 59881 const appearanceDict = appearanceStream.dict = new Dict(xref); 59882 appearanceDict.setIfName("Subtype", "Form"); 59883 appearanceDict.set("Resources", resources); 59884 const bbox = rotation % 180 === 0 ? [0, 0, this.width, this.height] : [0, 0, this.height, this.width]; 59885 appearanceDict.set("BBox", bbox); 59886 const rotationMatrix = this.getRotationMatrix(annotationStorage); 59887 if (rotationMatrix !== IDENTITY_MATRIX) { 59888 appearanceDict.set("Matrix", rotationMatrix); 59889 } 59890 changes.put(newRef, { 59891 data: appearanceStream, 59892 xfa: null, 59893 needAppearances: false 59894 }); 59895 } 59896 dict.set("M", `D:${getModificationDate()}`); 59897 } 59898 async _getAppearance(evaluator, task, intent, annotationStorage) { 59899 if (this.data.password) { 59900 return null; 59901 } 59902 const storageEntry = annotationStorage?.get(this.data.id); 59903 let value, rotation; 59904 if (storageEntry) { 59905 value = storageEntry.formattedValue || storageEntry.value; 59906 rotation = storageEntry.rotation; 59907 } 59908 if (rotation === undefined && value === undefined && !this._needAppearances) { 59909 if (!this._hasValueFromXFA || this.appearance) { 59910 return null; 59911 } 59912 } 59913 const colors = this.getBorderAndBackgroundAppearances(annotationStorage); 59914 if (value === undefined) { 59915 value = this.data.fieldValue; 59916 if (!value) { 59917 return `/Tx BMC q ${colors}Q EMC`; 59918 } 59919 } 59920 if (Array.isArray(value) && value.length === 1) { 59921 value = value[0]; 59922 } 59923 assert(typeof value === "string", "Expected `value` to be a string."); 59924 value = value.trimEnd(); 59925 if (this.data.combo) { 59926 const option = this.data.options.find(({ 59927 exportValue 59928 }) => value === exportValue); 59929 value = option?.displayValue || value; 59930 } 59931 if (value === "") { 59932 return `/Tx BMC q ${colors}Q EMC`; 59933 } 59934 if (rotation === undefined) { 59935 rotation = this.rotation; 59936 } 59937 let lineCount = -1; 59938 let lines; 59939 if (this.data.multiLine) { 59940 lines = value.split(/\r\n?|\n/).map(line => line.normalize("NFC")); 59941 lineCount = lines.length; 59942 } else { 59943 lines = [value.replace(/\r\n?|\n/, "").normalize("NFC")]; 59944 } 59945 const defaultPadding = 1; 59946 const defaultHPadding = 2; 59947 let { 59948 width: totalWidth, 59949 height: totalHeight 59950 } = this; 59951 if (rotation === 90 || rotation === 270) { 59952 [totalWidth, totalHeight] = [totalHeight, totalWidth]; 59953 } 59954 if (!this._defaultAppearance) { 59955 this.data.defaultAppearanceData = parseDefaultAppearance(this._defaultAppearance = "/Helvetica 0 Tf 0 g"); 59956 } 59957 let font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources); 59958 let defaultAppearance, fontSize, lineHeight; 59959 const encodedLines = []; 59960 let encodingError = false;
vendor: 11,251 bytes, lines 59961-60252
59961 for (const line of lines) { 59962 const encodedString = font.encodeString(line); 59963 if (encodedString.length > 1) { 59964 encodingError = true; 59965 } 59966 encodedLines.push(encodedString.join("")); 59967 } 59968 if (encodingError && intent & RenderingIntentFlag.SAVE) { 59969 return { 59970 needAppearances: true 59971 }; 59972 } 59973 if (encodingError && this._isOffscreenCanvasSupported) { 59974 const fontFamily = this.data.comb ? "monospace" : "sans-serif"; 59975 const fakeUnicodeFont = new FakeUnicodeFont(evaluator.xref, fontFamily); 59976 const resources = fakeUnicodeFont.createFontResources(lines.join("")); 59977 const newFont = resources.getRaw("Font"); 59978 if (this._fieldResources.mergedResources.has("Font")) { 59979 const oldFont = this._fieldResources.mergedResources.get("Font"); 59980 for (const [key, rawVal] of newFont.getRawEntries()) { 59981 oldFont.set(key, rawVal); 59982 } 59983 } else { 59984 this._fieldResources.mergedResources.set("Font", newFont); 59985 } 59986 const fontName = fakeUnicodeFont.fontName.name; 59987 font = await WidgetAnnotation._getFontData(evaluator, task, { 59988 fontName, 59989 fontSize: 0 59990 }, resources); 59991 for (let i = 0, ii = encodedLines.length; i < ii; i++) { 59992 encodedLines[i] = stringToUTF16String(lines[i]); 59993 } 59994 const savedDefaultAppearance = Object.assign(Object.create(null), this.data.defaultAppearanceData); 59995 this.data.defaultAppearanceData.fontSize = 0; 59996 this.data.defaultAppearanceData.fontName = fontName; 59997 [defaultAppearance, fontSize, lineHeight] = this._computeFontSize(totalHeight - 2 * defaultPadding, totalWidth - 2 * defaultHPadding, value, font, lineCount); 59998 this.data.defaultAppearanceData = savedDefaultAppearance; 59999 } else { 60000 if (!this._isOffscreenCanvasSupported) { 60001 warn("_getAppearance: OffscreenCanvas is not supported, annotation may not render correctly."); 60002 } 60003 [defaultAppearance, fontSize, lineHeight] = this._computeFontSize(totalHeight - 2 * defaultPadding, totalWidth - 2 * defaultHPadding, value, font, lineCount); 60004 } 60005 let descent = font.descent; 60006 if (isNaN(descent)) { 60007 descent = BASELINE_FACTOR * lineHeight; 60008 } else { 60009 descent = Math.max(BASELINE_FACTOR * lineHeight, Math.abs(descent) * fontSize); 60010 } 60011 const defaultVPadding = Math.min(Math.floor((totalHeight - fontSize) / 2), defaultPadding); 60012 const alignment = this.data.textAlignment; 60013 if (this.data.multiLine) { 60014 return this._getMultilineAppearance(defaultAppearance, encodedLines, font, fontSize, totalWidth, totalHeight, alignment, defaultHPadding, defaultVPadding, descent, lineHeight, annotationStorage); 60015 } 60016 if (this.data.comb) { 60017 return this._getCombAppearance(defaultAppearance, font, encodedLines[0], fontSize, totalWidth, totalHeight, defaultHPadding, defaultVPadding, descent, lineHeight, alignment, bidi(lines[0]).dir === "rtl", annotationStorage); 60018 } 60019 const bottomPadding = defaultVPadding + descent; 60020 if (alignment === 0 || alignment > 2) { 60021 return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${numberToString(defaultHPadding)} ${numberToString(bottomPadding)} Tm (${escapeString(encodedLines[0])}) Tj` + " ET Q EMC"; 60022 } 60023 const prevInfo = { 60024 shift: 0 60025 }; 60026 const renderedText = this._renderText(encodedLines[0], font, fontSize, totalWidth, alignment, prevInfo, defaultHPadding, bottomPadding); 60027 return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 0 Tm ${renderedText}` + " ET Q EMC"; 60028 } 60029 static async _getFontData(evaluator, task, appearanceData, resources) { 60030 const operatorList = new OperatorList(); 60031 const initialState = { 60032 font: null, 60033 clone() { 60034 return this; 60035 } 60036 }; 60037 const { 60038 fontName, 60039 fontSize 60040 } = appearanceData; 60041 await evaluator.handleSetFont(resources, [fontName && Name.get(fontName), fontSize], null, operatorList, task, initialState, null); 60042 return initialState.font; 60043 } 60044 _getTextWidth(text, font) { 60045 return Math.sumPrecise(font.charsToGlyphs(text).map(g => g.width)) / 1000; 60046 } 60047 _computeFontSize(height, width, text, font, lineCount) { 60048 let { 60049 fontSize 60050 } = this.data.defaultAppearanceData; 60051 let lineHeight = (fontSize || 12) * LINE_FACTOR, 60052 numberOfLines = Math.round(height / lineHeight); 60053 if (!fontSize) { 60054 const roundWithTwoDigits = x => Math.floor(x * 100) / 100; 60055 if (lineCount === -1) { 60056 const textWidth = this._getTextWidth(text, font); 60057 fontSize = roundWithTwoDigits(Math.min(height / LINE_FACTOR, width / textWidth)); 60058 numberOfLines = 1; 60059 } else { 60060 const lines = text.split(/\r\n?|\n/); 60061 const cachedLines = []; 60062 for (const line of lines) { 60063 const encoded = font.encodeString(line).join(""); 60064 const glyphs = font.charsToGlyphs(encoded); 60065 const positions = font.getCharPositions(encoded); 60066 cachedLines.push({ 60067 line: encoded, 60068 glyphs, 60069 positions 60070 }); 60071 } 60072 const isTooBig = fsize => { 60073 let totalHeight = 0; 60074 for (const cache of cachedLines) { 60075 const chunks = this._splitLine(null, font, fsize, width, cache); 60076 totalHeight += chunks.length * fsize; 60077 if (totalHeight > height) { 60078 return true; 60079 } 60080 } 60081 return false; 60082 }; 60083 numberOfLines = Math.max(numberOfLines, lineCount); 60084 while (true) { 60085 lineHeight = height / numberOfLines; 60086 fontSize = roundWithTwoDigits(lineHeight / LINE_FACTOR); 60087 if (isTooBig(fontSize)) { 60088 numberOfLines++; 60089 continue; 60090 } 60091 break; 60092 } 60093 } 60094 const { 60095 fontName, 60096 fontColor 60097 } = this.data.defaultAppearanceData; 60098 this._defaultAppearance = createDefaultAppearance({ 60099 fontSize, 60100 fontName, 60101 fontColor 60102 }); 60103 } 60104 return [this._defaultAppearance, fontSize, height / numberOfLines]; 60105 } 60106 _renderText(text, font, fontSize, totalWidth, alignment, prevInfo, hPadding, vPadding) { 60107 let shift; 60108 if (alignment === 1) { 60109 const width = this._getTextWidth(text, font) * fontSize; 60110 shift = (totalWidth - width) / 2; 60111 } else if (alignment === 2) { 60112 const width = this._getTextWidth(text, font) * fontSize; 60113 shift = totalWidth - width - hPadding; 60114 } else { 60115 shift = hPadding; 60116 } 60117 const shiftStr = numberToString(shift - prevInfo.shift); 60118 prevInfo.shift = shift; 60119 vPadding = numberToString(vPadding); 60120 return `${shiftStr} ${vPadding} Td (${escapeString(text)}) Tj`; 60121 } 60122 _getSaveFieldResources(xref) { 60123 const { 60124 localResources, 60125 appearanceResources, 60126 acroFormResources 60127 } = this._fieldResources; 60128 const fontName = this.data.defaultAppearanceData?.fontName; 60129 if (!fontName) { 60130 return localResources || Dict.empty; 60131 } 60132 for (const resources of [localResources, appearanceResources]) { 60133 if (resources instanceof Dict) { 60134 const localFont = resources.get("Font"); 60135 if (localFont instanceof Dict && localFont.has(fontName)) { 60136 return resources; 60137 } 60138 } 60139 } 60140 if (acroFormResources instanceof Dict) { 60141 const acroFormFont = acroFormResources.get("Font"); 60142 if (acroFormFont instanceof Dict && acroFormFont.has(fontName)) { 60143 const subFontDict = new Dict(xref); 60144 subFontDict.set(fontName, acroFormFont.getRaw(fontName)); 60145 const subResourcesDict = new Dict(xref); 60146 subResourcesDict.set("Font", subFontDict); 60147 return Dict.merge({ 60148 xref, 60149 dictArray: [subResourcesDict, localResources], 60150 mergeSubDicts: true 60151 }); 60152 } 60153 } 60154 return localResources || Dict.empty; 60155 } 60156 getFieldObject() { 60157 return null; 60158 } 60159} 60160class TextWidgetAnnotation extends WidgetAnnotation { 60161 constructor(params) { 60162 super(params); 60163 const { 60164 dict 60165 } = params; 60166 if (dict.has("PMD")) { 60167 this.flags |= AnnotationFlag.HIDDEN; 60168 this.data.hidden = true; 60169 warn("Barcodes are not supported"); 60170 } 60171 this.data.hasOwnCanvas = this.data.readOnly && !this.data.noHTML; 60172 this._hasText = true; 60173 if (typeof this.data.fieldValue !== "string") { 60174 this.data.fieldValue = ""; 60175 } 60176 let alignment = getInheritableProperty({ 60177 dict, 60178 key: "Q" 60179 }); 60180 if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) { 60181 alignment = null; 60182 } 60183 this.data.textAlignment = alignment; 60184 let maximumLength = getInheritableProperty({ 60185 dict, 60186 key: "MaxLen" 60187 }); 60188 if (!Number.isInteger(maximumLength) || maximumLength < 0) { 60189 maximumLength = 0; 60190 } 60191 this.data.maxLen = maximumLength; 60192 this.data.multiLine = this.hasFieldFlag(AnnotationFieldFlag.MULTILINE); 60193 this.data.comb = this.hasFieldFlag(AnnotationFieldFlag.COMB) && !this.data.multiLine && !this.data.password && !this.hasFieldFlag(AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== 0; 60194 this.data.doNotScroll = this.hasFieldFlag(AnnotationFieldFlag.DONOTSCROLL); 60195 const { 60196 data: { 60197 actions 60198 } 60199 } = this; 60200 if (!actions) { 60201 return; 60202 } 60203 const AFDateTime = /^AF(Date|Time)_(?:Keystroke|Format)(?:Ex)?\(['"]?([^'"]+)['"]?\);$/; 60204 let canUseHTMLDateTime = false; 60205 if (actions.Format?.length === 1 && actions.Keystroke?.length === 1 && AFDateTime.test(actions.Format[0]) && AFDateTime.test(actions.Keystroke[0]) || actions.Format?.length === 0 && actions.Keystroke?.length === 1 && AFDateTime.test(actions.Keystroke[0]) || actions.Keystroke?.length === 0 && actions.Format?.length === 1 && AFDateTime.test(actions.Format[0])) { 60206 canUseHTMLDateTime = true; 60207 } 60208 const actionsToVisit = []; 60209 if (actions.Format) { 60210 actionsToVisit.push(...actions.Format); 60211 } 60212 if (actions.Keystroke) { 60213 actionsToVisit.push(...actions.Keystroke); 60214 } 60215 if (canUseHTMLDateTime) { 60216 delete actions.Keystroke; 60217 actions.Format = actionsToVisit; 60218 } 60219 for (const formatAction of actionsToVisit) { 60220 const m = formatAction.match(AFDateTime); 60221 if (!m) { 60222 continue; 60223 } 60224 const isDate = m[1] === "Date"; 60225 let format = m[2]; 60226 const num = parseInt(format, 10); 60227 if (!isNaN(num) && Math.floor(Math.log10(num)) + 1 === m[2].length) { 60228 format = (isDate ? DateFormats : TimeFormats)[num] ?? format; 60229 } 60230 this.data.datetimeFormat = format; 60231 if (!canUseHTMLDateTime) { 60232 break; 60233 } 60234 if (isDate) { 60235 if (/HH|MM|ss|h/.test(format)) { 60236 this.data.datetimeType = "datetime-local"; 60237 this.data.timeStep = /ss/.test(format) ? 1 : 60; 60238 } else { 60239 this.data.datetimeType = "date"; 60240 } 60241 break; 60242 } 60243 this.data.datetimeType = "time"; 60244 this.data.timeStep = /ss/.test(format) ? 1 : 60; 60245 break; 60246 } 60247 } 60248 get hasTextContent() { 60249 return !!this.appearance && !this._needAppearances; 60250 } 60251 _getCombAppearance(defaultAppearance, font, text, fontSize, width, height, hPadding, vPadding, descent, lineHeight, alignment, isRTL, annotationStorage) { 60252 const combWidth = width / this.data.maxLen;
60253 const colors = this.getBorderAndBackgroundAppearances(annotationStorage); 60254 const buf = []; 60255 const positions = font.getCharPositions(text); 60256 for (const [start, end] of positions) { 60257 buf.push(`(${escapeString(text.substring(start, end))}) Tj`); 60258 } 60259 if (isRTL) { 60260 buf.reverse(); 60261 } 60262 const textWidth = combWidth * positions.length; 60263 let hShift = hPadding; 60264 if (alignment === 1) { 60265 hShift += Math.floor((width - textWidth) / (2 * combWidth)) * combWidth; 60266 } else if (alignment === 2) { 60267 hShift += width - textWidth; 60268 } 60269 const renderedComb = buf.join(` ${numberToString(combWidth)} 0 Td `); 60270 return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${numberToString(hShift
vendor: 11,937 bytes, lines 60270-60607
60270)} ${numberToString(vPadding + descent)} Tm ${renderedComb}` + " ET Q EMC"; 60271 } 60272 _getMultilineAppearance(defaultAppearance, lines, font, fontSize, width, height, alignment, hPadding, vPadding, descent, lineHeight, annotationStorage) { 60273 const buf = []; 60274 const totalWidth = width - 2 * hPadding; 60275 const prevInfo = { 60276 shift: 0 60277 }; 60278 for (let i = 0, ii = lines.length; i < ii; i++) { 60279 const line = lines[i]; 60280 const chunks = this._splitLine(line, font, fontSize, totalWidth); 60281 for (let j = 0, jj = chunks.length; j < jj; j++) { 60282 const chunk = chunks[j]; 60283 const vShift = i === 0 && j === 0 ? -vPadding - (lineHeight - descent) : -lineHeight; 60284 buf.push(this._renderText(chunk, font, fontSize, width, alignment, prevInfo, hPadding, vShift)); 60285 } 60286 } 60287 const colors = this.getBorderAndBackgroundAppearances(annotationStorage); 60288 const renderedText = buf.join("\n"); 60289 return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 ${numberToString(height)} Tm ${renderedText}` + " ET Q EMC"; 60290 } 60291 _splitLine(line, font, fontSize, width, cache = {}) { 60292 line = cache.line || line; 60293 const glyphs = cache.glyphs || font.charsToGlyphs(line); 60294 if (glyphs.length <= 1) { 60295 return [line]; 60296 } 60297 const positions = cache.positions || font.getCharPositions(line); 60298 const scale = fontSize / 1000; 60299 const chunks = []; 60300 let lastSpacePosInStringStart = -1, 60301 lastSpacePosInStringEnd = -1, 60302 lastSpacePos = -1, 60303 startChunk = 0, 60304 currentWidth = 0; 60305 for (let i = 0, ii = glyphs.length; i < ii; i++) { 60306 const [start, end] = positions[i]; 60307 const glyph = glyphs[i]; 60308 const glyphWidth = glyph.width * scale; 60309 if (glyph.unicode === " ") { 60310 if (currentWidth + glyphWidth > width) { 60311 chunks.push(line.substring(startChunk, start)); 60312 startChunk = start; 60313 currentWidth = glyphWidth; 60314 lastSpacePosInStringStart = -1; 60315 lastSpacePos = -1; 60316 } else { 60317 currentWidth += glyphWidth; 60318 lastSpacePosInStringStart = start; 60319 lastSpacePosInStringEnd = end; 60320 lastSpacePos = i; 60321 } 60322 } else if (currentWidth + glyphWidth > width) { 60323 if (lastSpacePosInStringStart !== -1) { 60324 chunks.push(line.substring(startChunk, lastSpacePosInStringEnd)); 60325 startChunk = lastSpacePosInStringEnd; 60326 i = lastSpacePos + 1; 60327 lastSpacePosInStringStart = -1; 60328 currentWidth = 0; 60329 } else { 60330 chunks.push(line.substring(startChunk, start)); 60331 startChunk = start; 60332 currentWidth = glyphWidth; 60333 } 60334 } else { 60335 currentWidth += glyphWidth; 60336 } 60337 } 60338 if (startChunk < line.length) { 60339 chunks.push(line.substring(startChunk, line.length)); 60340 } 60341 return chunks; 60342 } 60343 async extractTextContent(evaluator, task, viewBox) { 60344 await super.extractTextContent(evaluator, task, viewBox); 60345 const text = this.data.textContent; 60346 if (!text) { 60347 return; 60348 } 60349 const allText = text.join("\n"); 60350 if (allText === this.data.fieldValue) { 60351 return; 60352 } 60353 const regex = allText.replaceAll(/([.*+?^${}()|[\]\\])|(\s+)/g, (_m, p1) => p1 ? `\\${p1}` : "\\s+"); 60354 if (new RegExp(`^\\s*${regex}\\s*$`).test(this.data.fieldValue)) { 60355 this.data.textContent = this.data.fieldValue.split("\n"); 60356 } 60357 } 60358 getFieldObject() { 60359 return { 60360 id: this.data.id, 60361 value: this.data.fieldValue, 60362 defaultValue: this.data.defaultFieldValue || "", 60363 multiline: this.data.multiLine, 60364 password: this.data.password, 60365 charLimit: this.data.maxLen, 60366 comb: this.data.comb, 60367 editable: !this.data.readOnly, 60368 hidden: this.data.hidden, 60369 name: this.data.fieldName, 60370 rect: this.data.rect, 60371 actions: this.data.actions, 60372 page: this.data.pageIndex, 60373 strokeColor: this.data.borderColor, 60374 fillColor: this.data.backgroundColor, 60375 rotation: this.rotation, 60376 datetimeFormat: this.data.datetimeFormat, 60377 hasDatetimeHTML: !!this.data.datetimeType, 60378 type: "text" 60379 }; 60380 } 60381} 60382class ButtonWidgetAnnotation extends WidgetAnnotation { 60383 constructor(params) { 60384 super(params); 60385 this.checkedAppearance = null; 60386 this.uncheckedAppearance = null; 60387 const isRadio = this.hasFieldFlag(AnnotationFieldFlag.RADIO), 60388 isPushButton = this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON); 60389 this.data.checkBox = !isRadio && !isPushButton; 60390 this.data.radioButton = isRadio && !isPushButton; 60391 this.data.pushButton = isPushButton; 60392 this.data.isTooltipOnly = false; 60393 if (this.data.checkBox) { 60394 this._processCheckBox(params); 60395 } else if (this.data.radioButton) { 60396 this._processRadioButton(params); 60397 } else if (this.data.pushButton) { 60398 this.data.hasOwnCanvas = true; 60399 this.data.noHTML = false; 60400 this._processPushButton(params); 60401 } else { 60402 warn("Invalid field flags for button widget annotation"); 60403 } 60404 } 60405 async getOperatorList(evaluator, task, intent, annotationStorage) { 60406 if (this.data.pushButton) { 60407 return super.getOperatorList(evaluator, task, intent, false, annotationStorage); 60408 } 60409 let value = null; 60410 let rotation = null; 60411 if (annotationStorage) { 60412 const storageEntry = annotationStorage.get(this.data.id); 60413 value = storageEntry ? storageEntry.value : null; 60414 rotation = storageEntry ? storageEntry.rotation : null; 60415 } 60416 if (value === null && this.appearance) { 60417 return super.getOperatorList(evaluator, task, intent, annotationStorage); 60418 } 60419 if (value === null || value === undefined) { 60420 value = this.data.checkBox ? this.data.fieldValue === this.data.exportValue : this.data.fieldValue === this.data.buttonValue; 60421 } 60422 const appearance = value ? this.checkedAppearance : this.uncheckedAppearance; 60423 if (appearance) { 60424 const savedAppearance = this.appearance; 60425 const savedMatrix = lookupMatrix(appearance.dict.getArray("Matrix"), IDENTITY_MATRIX); 60426 if (rotation) { 60427 appearance.dict.set("Matrix", this.getRotationMatrix(annotationStorage)); 60428 } 60429 this.appearance = appearance; 60430 const operatorList = super.getOperatorList(evaluator, task, intent, annotationStorage); 60431 this.appearance = savedAppearance; 60432 appearance.dict.set("Matrix", savedMatrix); 60433 return operatorList; 60434 } 60435 return { 60436 opList: new OperatorList(), 60437 separateForm: false, 60438 separateCanvas: false 60439 }; 60440 } 60441 async save(evaluator, task, annotationStorage, changes) { 60442 if (this.data.checkBox) { 60443 this._saveCheckbox(evaluator, task, annotationStorage, changes); 60444 return; 60445 } 60446 if (this.data.radioButton) { 60447 this._saveRadioButton(evaluator, task, annotationStorage, changes); 60448 } 60449 } 60450 async _saveCheckbox(evaluator, task, annotationStorage, changes) { 60451 if (!annotationStorage) { 60452 return; 60453 } 60454 const storageEntry = annotationStorage.get(this.data.id); 60455 const flags = this._buildFlags(storageEntry?.noView, storageEntry?.noPrint); 60456 let rotation = storageEntry?.rotation, 60457 value = storageEntry?.value; 60458 if (rotation === undefined && flags === undefined) { 60459 if (value === undefined) { 60460 return; 60461 } 60462 const defaultValue = this.data.fieldValue === this.data.exportValue; 60463 if (defaultValue === value) { 60464 return; 60465 } 60466 } 60467 let dict = evaluator.xref.fetchIfRef(this.ref); 60468 if (!(dict instanceof Dict)) { 60469 return; 60470 } 60471 dict = dict.clone(); 60472 if (rotation === undefined) { 60473 rotation = this.rotation; 60474 } 60475 if (value === undefined) { 60476 value = this.data.fieldValue === this.data.exportValue; 60477 } 60478 const xfa = { 60479 path: this.data.fieldName, 60480 value: value ? this.data.exportValue : "" 60481 }; 60482 const name = Name.get(value ? this.data.exportValue : "Off"); 60483 this.setValue(dict, name, evaluator.xref, changes); 60484 dict.set("AS", name); 60485 dict.set("M", `D:${getModificationDate()}`); 60486 if (flags !== undefined) { 60487 dict.set("F", flags); 60488 } 60489 const maybeMK = this._getMKDict(rotation); 60490 if (maybeMK) { 60491 dict.set("MK", maybeMK); 60492 } 60493 changes.put(this.ref, { 60494 data: dict, 60495 xfa, 60496 needAppearances: false 60497 }); 60498 } 60499 async _saveRadioButton(evaluator, task, annotationStorage, changes) { 60500 if (!annotationStorage) { 60501 return; 60502 } 60503 const storageEntry = annotationStorage.get(this.data.id); 60504 const flags = this._buildFlags(storageEntry?.noView, storageEntry?.noPrint); 60505 let rotation = storageEntry?.rotation, 60506 value = storageEntry?.value; 60507 if (rotation === undefined && flags === undefined) { 60508 if (value === undefined) { 60509 return; 60510 } 60511 const defaultValue = this.data.fieldValue === this.data.buttonValue; 60512 if (defaultValue === value) { 60513 return; 60514 } 60515 } 60516 let dict = evaluator.xref.fetchIfRef(this.ref); 60517 if (!(dict instanceof Dict)) { 60518 return; 60519 } 60520 dict = dict.clone(); 60521 if (value === undefined) { 60522 value = this.data.fieldValue === this.data.buttonValue; 60523 } 60524 if (rotation === undefined) { 60525 rotation = this.rotation; 60526 } 60527 const xfa = { 60528 path: this.data.fieldName, 60529 value: value ? this.data.buttonValue : "" 60530 }; 60531 const name = Name.get(value ? this.data.buttonValue : "Off"); 60532 if (value) { 60533 this.setValue(dict, name, evaluator.xref, changes); 60534 } 60535 dict.set("AS", name); 60536 dict.set("M", `D:${getModificationDate()}`); 60537 if (flags !== undefined) { 60538 dict.set("F", flags); 60539 } 60540 const maybeMK = this._getMKDict(rotation); 60541 if (maybeMK) { 60542 dict.set("MK", maybeMK); 60543 } 60544 changes.put(this.ref, { 60545 data: dict, 60546 xfa, 60547 needAppearances: false 60548 }); 60549 } 60550 _getDefaultCheckedAppearance(params, type) { 60551 const { 60552 width, 60553 height 60554 } = this; 60555 const bbox = [0, 0, width, height]; 60556 const FONT_RATIO = 0.8; 60557 const fontSize = Math.min(width, height) * FONT_RATIO; 60558 let metrics, char; 60559 if (type === "check") { 60560 metrics = { 60561 width: 0.755 * fontSize, 60562 height: 0.705 * fontSize 60563 }; 60564 char = "\x33"; 60565 } else if (type === "disc") { 60566 metrics = { 60567 width: 0.791 * fontSize, 60568 height: 0.705 * fontSize 60569 }; 60570 char = "\x6C"; 60571 } else { 60572 unreachable(`_getDefaultCheckedAppearance - unsupported type: ${type}`); 60573 } 60574 const xShift = numberToString((width - metrics.width) / 2); 60575 const yShift = numberToString((height - metrics.height) / 2); 60576 const appearance = `q BT /PdfJsZaDb ${fontSize} Tf 0 g ${xShift} ${yShift} Td (${char}) Tj ET Q`; 60577 const appearanceStreamDict = new Dict(params.xref); 60578 appearanceStreamDict.set("FormType", 1); 60579 appearanceStreamDict.setIfName("Subtype", "Form"); 60580 appearanceStreamDict.setIfName("Type", "XObject"); 60581 appearanceStreamDict.set("BBox", bbox); 60582 appearanceStreamDict.set("Matrix", [1, 0, 0, 1, 0, 0]); 60583 appearanceStreamDict.set("Length", appearance.length); 60584 const resources = new Dict(params.xref); 60585 const font = new Dict(params.xref); 60586 font.set("PdfJsZaDb", this.fallbackFontDict); 60587 resources.set("Font", font); 60588 appearanceStreamDict.set("Resources", resources); 60589 this.checkedAppearance = new StringStream(appearance); 60590 this.checkedAppearance.dict = appearanceStreamDict; 60591 this._streams.push(this.checkedAppearance); 60592 } 60593 _processCheckBox(params) { 60594 const customAppearance = params.dict.get("AP"); 60595 if (!(customAppearance instanceof Dict)) { 60596 return; 60597 } 60598 const normalAppearance = customAppearance.get("N"); 60599 if (!(normalAppearance instanceof Dict)) { 60600 return; 60601 } 60602 const asValue = this._decodeFormValue(params.dict.get("AS")); 60603 if (typeof asValue === "string") { 60604 this.data.fieldValue = asValue; 60605 } 60606 const yes = this.data.fieldValue !== null && this.data.fieldValue !== "Off" ? this.data.fieldValue : "Yes"; 60607 const exportValues =
vendor: 21,448 bytes, lines 60607-61255
60607[...normalAppearance.getKeys()]; 60608 if (exportValues.length === 0) { 60609 exportValues.push("Off", yes); 60610 } else if (exportValues.length === 1) { 60611 if (exportValues[0] === "Off") { 60612 exportValues.push(yes); 60613 } else { 60614 exportValues.unshift("Off"); 60615 } 60616 } else if (exportValues.includes(yes)) { 60617 exportValues.length = 0; 60618 exportValues.push("Off", yes); 60619 } else { 60620 const otherYes = exportValues.find(v => v !== "Off"); 60621 exportValues.length = 0; 60622 exportValues.push("Off", otherYes); 60623 } 60624 if (!exportValues.includes(this.data.fieldValue)) { 60625 this.data.fieldValue = "Off"; 60626 } 60627 this.data.exportValue = exportValues[1]; 60628 const checkedAppearance = normalAppearance.get(this.data.exportValue); 60629 this.checkedAppearance = checkedAppearance instanceof BaseStream ? checkedAppearance : null; 60630 const uncheckedAppearance = normalAppearance.get("Off"); 60631 this.uncheckedAppearance = uncheckedAppearance instanceof BaseStream ? uncheckedAppearance : null; 60632 if (this.checkedAppearance) { 60633 this._streams.push(this.checkedAppearance); 60634 } else { 60635 this._getDefaultCheckedAppearance(params, "check"); 60636 } 60637 if (this.uncheckedAppearance) { 60638 this._streams.push(this.uncheckedAppearance); 60639 } 60640 this._fallbackFontDict = this.fallbackFontDict; 60641 if (this.data.defaultFieldValue === null) { 60642 this.data.defaultFieldValue = "Off"; 60643 } 60644 } 60645 _processRadioButton(params) { 60646 this.data.buttonValue = null; 60647 const fieldParent = params.dict.get("Parent"); 60648 if (fieldParent instanceof Dict) { 60649 this.parent = params.dict.getRaw("Parent"); 60650 const fieldParentValue = fieldParent.get("V"); 60651 if (fieldParentValue instanceof Name) { 60652 this.data.fieldValue = this._decodeFormValue(fieldParentValue); 60653 } 60654 } 60655 const appearanceStates = params.dict.get("AP"); 60656 if (!(appearanceStates instanceof Dict)) { 60657 return; 60658 } 60659 const normalAppearance = appearanceStates.get("N"); 60660 if (!(normalAppearance instanceof Dict)) { 60661 return; 60662 } 60663 for (const key of normalAppearance.getKeys()) { 60664 if (key !== "Off") { 60665 this.data.buttonValue = key; 60666 break; 60667 } 60668 } 60669 const checkedAppearance = normalAppearance.get(this.data.buttonValue); 60670 this.checkedAppearance = checkedAppearance instanceof BaseStream ? checkedAppearance : null; 60671 const uncheckedAppearance = normalAppearance.get("Off"); 60672 this.uncheckedAppearance = uncheckedAppearance instanceof BaseStream ? uncheckedAppearance : null; 60673 if (this.checkedAppearance) { 60674 this._streams.push(this.checkedAppearance); 60675 } else { 60676 this._getDefaultCheckedAppearance(params, "disc"); 60677 } 60678 if (this.uncheckedAppearance) { 60679 this._streams.push(this.uncheckedAppearance); 60680 } 60681 this._fallbackFontDict = this.fallbackFontDict; 60682 if (this.data.defaultFieldValue === null) { 60683 this.data.defaultFieldValue = "Off"; 60684 } 60685 } 60686 _processPushButton(params) { 60687 const { 60688 dict, 60689 annotationGlobals 60690 } = params; 60691 if (!dict.has("A") && !dict.has("AA") && !this.data.alternativeText) { 60692 warn("Push buttons without action dictionaries are not supported"); 60693 return; 60694 } 60695 this.data.isTooltipOnly = !dict.has("A") && !dict.has("AA"); 60696 Catalog.parseDestDictionary({ 60697 destDict: dict, 60698 resultObj: this.data, 60699 docBaseUrl: annotationGlobals.baseUrl, 60700 docAttachments: annotationGlobals.attachments 60701 }); 60702 } 60703 getFieldObject() { 60704 let type = "button"; 60705 let exportValues; 60706 if (this.data.checkBox) { 60707 type = "checkbox"; 60708 exportValues = this.data.exportValue; 60709 } else if (this.data.radioButton) { 60710 type = "radiobutton"; 60711 exportValues = this.data.buttonValue; 60712 } 60713 return { 60714 id: this.data.id, 60715 value: this.data.fieldValue || "Off", 60716 defaultValue: this.data.defaultFieldValue, 60717 exportValues, 60718 editable: !this.data.readOnly, 60719 name: this.data.fieldName, 60720 rect: this.data.rect, 60721 hidden: this.data.hidden, 60722 actions: this.data.actions, 60723 page: this.data.pageIndex, 60724 strokeColor: this.data.borderColor, 60725 fillColor: this.data.backgroundColor, 60726 rotation: this.rotation, 60727 type 60728 }; 60729 } 60730 get fallbackFontDict() { 60731 const dict = new Dict(); 60732 dict.setIfName("BaseFont", "ZapfDingbats"); 60733 dict.setIfName("Type", "FallbackType"); 60734 dict.setIfName("Subtype", "FallbackType"); 60735 dict.setIfName("Encoding", "ZapfDingbatsEncoding"); 60736 return shadow(this, "fallbackFontDict", dict); 60737 } 60738} 60739class ChoiceWidgetAnnotation extends WidgetAnnotation { 60740 constructor(params) { 60741 super(params); 60742 const { 60743 dict, 60744 xref 60745 } = params; 60746 this.indices = dict.getArray("I"); 60747 this.hasIndices = Array.isArray(this.indices) && this.indices.length > 0; 60748 this.data.options = []; 60749 const options = getInheritableProperty({ 60750 dict, 60751 key: "Opt" 60752 }); 60753 if (Array.isArray(options)) { 60754 for (let i = 0, ii = options.length; i < ii; i++) { 60755 const option = xref.fetchIfRef(options[i]); 60756 const isOptionArray = Array.isArray(option); 60757 this.data.options[i] = { 60758 exportValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[0]) : option), 60759 displayValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[1]) : option) 60760 }; 60761 } 60762 } 60763 if (!this.hasIndices) { 60764 if (typeof this.data.fieldValue === "string") { 60765 this.data.fieldValue = [this.data.fieldValue]; 60766 } else { 60767 this.data.fieldValue ||= []; 60768 } 60769 } else { 60770 this.data.fieldValue = []; 60771 const ii = this.data.options.length; 60772 for (const i of this.indices) { 60773 if (Number.isInteger(i) && i >= 0 && i < ii) { 60774 this.data.fieldValue.push(this.data.options[i].exportValue); 60775 } 60776 } 60777 } 60778 if (this.data.options.length === 0 && this.data.fieldValue.length > 0) { 60779 this.data.options = this.data.fieldValue.map(value => ({ 60780 exportValue: value, 60781 displayValue: value 60782 })); 60783 } 60784 this.data.combo = this.hasFieldFlag(AnnotationFieldFlag.COMBO); 60785 this.data.multiSelect = this.hasFieldFlag(AnnotationFieldFlag.MULTISELECT); 60786 this._hasText = true; 60787 } 60788 getFieldObject() { 60789 const type = this.data.combo ? "combobox" : "listbox"; 60790 const value = this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null; 60791 return { 60792 id: this.data.id, 60793 value, 60794 defaultValue: this.data.defaultFieldValue, 60795 editable: !this.data.readOnly, 60796 name: this.data.fieldName, 60797 rect: this.data.rect, 60798 numItems: this.data.fieldValue.length, 60799 multipleSelection: this.data.multiSelect, 60800 hidden: this.data.hidden, 60801 actions: this.data.actions, 60802 items: this.data.options, 60803 page: this.data.pageIndex, 60804 strokeColor: this.data.borderColor, 60805 fillColor: this.data.backgroundColor, 60806 rotation: this.rotation, 60807 type 60808 }; 60809 } 60810 amendSavedDict(annotationStorage, dict) { 60811 if (!this.hasIndices) { 60812 return; 60813 } 60814 let values = annotationStorage?.get(this.data.id)?.value; 60815 if (!Array.isArray(values)) { 60816 values = [values]; 60817 } 60818 const indices = []; 60819 const { 60820 options 60821 } = this.data; 60822 for (let i = 0, j = 0, ii = options.length; i < ii; i++) { 60823 if (options[i].exportValue === values[j]) { 60824 indices.push(i); 60825 j += 1; 60826 } 60827 } 60828 dict.set("I", indices); 60829 } 60830 async _getAppearance(evaluator, task, intent, annotationStorage) { 60831 if (this.data.combo) { 60832 return super._getAppearance(evaluator, task, intent, annotationStorage); 60833 } 60834 let exportedValue, rotation; 60835 const storageEntry = annotationStorage?.get(this.data.id); 60836 if (storageEntry) { 60837 rotation = storageEntry.rotation; 60838 exportedValue = storageEntry.value; 60839 } 60840 if (rotation === undefined && exportedValue === undefined && !this._needAppearances) { 60841 return null; 60842 } 60843 if (exportedValue === undefined) { 60844 exportedValue = this.data.fieldValue; 60845 } else if (!Array.isArray(exportedValue)) { 60846 exportedValue = [exportedValue]; 60847 } 60848 const defaultPadding = 1; 60849 const defaultHPadding = 2; 60850 let { 60851 width: totalWidth, 60852 height: totalHeight 60853 } = this; 60854 if (rotation === 90 || rotation === 270) { 60855 [totalWidth, totalHeight] = [totalHeight, totalWidth]; 60856 } 60857 const lineCount = this.data.options.length; 60858 const valueIndices = []; 60859 for (let i = 0; i < lineCount; i++) { 60860 const { 60861 exportValue 60862 } = this.data.options[i]; 60863 if (exportedValue.includes(exportValue)) { 60864 valueIndices.push(i); 60865 } 60866 } 60867 if (!this._defaultAppearance) { 60868 this.data.defaultAppearanceData = parseDefaultAppearance(this._defaultAppearance = "/Helvetica 0 Tf 0 g"); 60869 } 60870 const font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources); 60871 let defaultAppearance; 60872 let { 60873 fontSize 60874 } = this.data.defaultAppearanceData; 60875 if (!fontSize) { 60876 const lineHeight = (totalHeight - defaultPadding) / lineCount; 60877 let lineWidth = -1; 60878 let value; 60879 for (const { 60880 displayValue 60881 } of this.data.options) { 60882 const width = this._getTextWidth(displayValue, font); 60883 if (width > lineWidth) { 60884 lineWidth = width; 60885 value = displayValue; 60886 } 60887 } 60888 [defaultAppearance, fontSize] = this._computeFontSize(lineHeight, totalWidth - 2 * defaultHPadding, value, font, -1); 60889 } else { 60890 defaultAppearance = this._defaultAppearance; 60891 } 60892 const lineHeight = fontSize * LINE_FACTOR; 60893 const vPadding = (lineHeight - fontSize) / 2; 60894 const numberOfVisibleLines = Math.floor(totalHeight / lineHeight); 60895 let firstIndex = 0; 60896 if (valueIndices.length > 0) { 60897 const minIndex = Math.min(...valueIndices); 60898 const maxIndex = Math.max(...valueIndices); 60899 firstIndex = Math.max(0, maxIndex - numberOfVisibleLines + 1); 60900 if (firstIndex > minIndex) { 60901 firstIndex = minIndex; 60902 } 60903 } 60904 const end = Math.min(firstIndex + numberOfVisibleLines + 1, lineCount); 60905 const buf = ["/Tx BMC q", `1 1 ${totalWidth} ${totalHeight} re W n`]; 60906 if (valueIndices.length) { 60907 buf.push("0.600006 0.756866 0.854904 rg"); 60908 for (const index of valueIndices) { 60909 if (firstIndex <= index && index < end) { 60910 buf.push(`1 ${totalHeight - (index - firstIndex + 1) * lineHeight} ${totalWidth} ${lineHeight} re f`); 60911 } 60912 } 60913 } 60914 buf.push("BT", defaultAppearance, `1 0 0 1 0 ${totalHeight} Tm`); 60915 const prevInfo = { 60916 shift: 0 60917 }; 60918 for (let i = firstIndex; i < end; i++) { 60919 const { 60920 displayValue 60921 } = this.data.options[i]; 60922 const vpadding = i === firstIndex ? vPadding : 0; 60923 buf.push(this._renderText(displayValue, font, fontSize, totalWidth, 0, prevInfo, defaultHPadding, -lineHeight + vpadding)); 60924 } 60925 buf.push("ET Q EMC"); 60926 return buf.join("\n"); 60927 } 60928} 60929class SignatureWidgetAnnotation extends WidgetAnnotation { 60930 constructor(params) { 60931 super(params); 60932 this.data.fieldValue = null; 60933 this.data.hasOwnCanvas = this.data.noRotate; 60934 this.data.noHTML = !this.data.hasOwnCanvas; 60935 } 60936 getFieldObject() { 60937 return { 60938 id: this.data.id, 60939 value: null, 60940 page: this.data.pageIndex, 60941 type: "signature" 60942 }; 60943 } 60944} 60945class TextAnnotation extends MarkupAnnotation { 60946 constructor(params) { 60947 const DEFAULT_ICON_SIZE = 22; 60948 super(params); 60949 this.data.noRotate = true; 60950 this.data.hasOwnCanvas = this.data.noRotate; 60951 this.data.noHTML = false; 60952 const { 60953 dict 60954 } = params; 60955 if (this.data.hasAppearance) { 60956 this.data.name = "NoIcon"; 60957 } else { 60958 this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE; 60959 this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE; 60960 this.data.name = dict.has("Name") ? dict.get("Name").name : "Note"; 60961 } 60962 if (dict.has("State")) { 60963 this.data.state = dict.get("State") || null; 60964 this.data.stateModel = dict.get("StateModel") || null; 60965 } else { 60966 this.data.state = null; 60967 this.data.stateModel = null; 60968 } 60969 } 60970} 60971class LinkAnnotation extends Annotation { 60972 constructor(params) { 60973 super(params); 60974 const { 60975 dict, 60976 annotationGlobals 60977 } = params; 60978 this.data.noHTML = false; 60979 const quadPoints = getQuadPoints(dict, this.rectangle); 60980 if (quadPoints) { 60981 this.data.quadPoints = quadPoints; 60982 } 60983 this.data.borderColor ||= this.data.color; 60984 Catalog.parseDestDictionary({ 60985 destDict: dict, 60986 resultObj: this.data, 60987 docBaseUrl: annotationGlobals.baseUrl, 60988 docAttachments: annotationGlobals.attachments 60989 }); 60990 } 60991 get overlaysTextContent() { 60992 return true; 60993 } 60994} 60995class PopupAnnotation extends Annotation { 60996 constructor(params) { 60997 super(params); 60998 const { 60999 dict 61000 } = params; 61001 this.data.noHTML = false; 61002 if (this.width === 0 || this.height === 0) { 61003 this.data.rect = null; 61004 } 61005 let parentItem = dict.get("Parent"); 61006 if (!parentItem) { 61007 warn("Popup annotation has a missing or invalid parent annotation."); 61008 return; 61009 } 61010 this.data.parentRect = lookupNormalRect(parentItem.getArray("Rect"), null); 61011 this.data.creationDate = parentItem.get("CreationDate") || ""; 61012 const rt = parentItem.get("RT"); 61013 if (isName(rt, AnnotationReplyType.GROUP)) { 61014 parentItem = parentItem.get("IRT"); 61015 } 61016 if (!parentItem.has("M")) { 61017 this.data.modificationDate = null; 61018 } else { 61019 this.setModificationDate(parentItem.get("M")); 61020 this.data.modificationDate = this.modificationDate; 61021 } 61022 if (!parentItem.has("C")) { 61023 this.data.color = null; 61024 } else { 61025 this.setColor(parentItem.getArray("C")); 61026 this.data.color = this.color; 61027 } 61028 if (!this.viewable) { 61029 const parentFlags = parentItem.get("F"); 61030 if (this._isViewable(parentFlags)) { 61031 this.setFlags(parentFlags); 61032 } 61033 } 61034 this.setTitle(parentItem.get("T")); 61035 this.data.titleObj = this._title; 61036 this.setContents(parentItem.get("Contents")); 61037 this.data.contentsObj = this._contents; 61038 if (parentItem.has("RC")) { 61039 this.data.richText = XFAFactory.getRichTextAsHtml(parentItem.get("RC")); 61040 } 61041 this.data.open = !!dict.get("Open"); 61042 } 61043 static createNewDict(annotation, xref, _params) { 61044 const { 61045 oldAnnotation, 61046 rect, 61047 parent 61048 } = annotation; 61049 const popup = oldAnnotation || new Dict(xref); 61050 popup.setIfNotExists("Type", Name.get("Annot")); 61051 popup.setIfNotExists("Subtype", Name.get("Popup")); 61052 popup.setIfNotExists("Open", false); 61053 popup.setIfArray("Rect", rect); 61054 popup.set("Parent", parent); 61055 return popup; 61056 } 61057 static async createNewAppearanceStream(annotation, xref, params) { 61058 return null; 61059 } 61060} 61061class FreeTextAnnotation extends MarkupAnnotation { 61062 constructor(params) { 61063 super(params); 61064 this.data.hasOwnCanvas = this.data.noRotate; 61065 this.data.isEditable = !this.data.noHTML; 61066 this.data.noHTML = false; 61067 const { 61068 annotationGlobals, 61069 xref 61070 } = params; 61071 this.setDefaultAppearance(params); 61072 this._hasAppearance = !!this.appearance; 61073 if (this._hasAppearance) { 61074 const { 61075 fontColor, 61076 fontSize 61077 } = parseAppearanceStream(this.appearance, xref, annotationGlobals.globalColorSpaceCache); 61078 this.data.defaultAppearanceData.fontColor = fontColor; 61079 this.data.defaultAppearanceData.fontSize = fontSize || 10; 61080 } else { 61081 this.data.defaultAppearanceData.fontSize ||= 10; 61082 const { 61083 fontColor, 61084 fontSize 61085 } = this.data.defaultAppearanceData; 61086 if (this._contents.str) { 61087 this.data.textContent = this._contents.str.split(/\r\n?|\n/).map(line => line.trimEnd()); 61088 const { 61089 coords, 61090 bbox, 61091 matrix 61092 } = FakeUnicodeFont.getFirstPositionInfo(this.rectangle, this.rotation, fontSize); 61093 this.data.textPosition = this._transformPoint(coords, bbox, matrix); 61094 } 61095 if (this._isOffscreenCanvasSupported) { 61096 const strokeAlpha = params.dict.get("CA"); 61097 const fakeUnicodeFont = new FakeUnicodeFont(xref, "sans-serif"); 61098 this.appearance = fakeUnicodeFont.createAppearance(this._contents.str, this.rectangle, this.rotation, fontSize, fontColor, strokeAlpha); 61099 this._streams.push(this.appearance); 61100 } else { 61101 warn("FreeTextAnnotation: OffscreenCanvas is not supported, annotation may not render correctly."); 61102 } 61103 } 61104 } 61105 get hasTextContent() { 61106 return this._hasAppearance; 61107 } 61108 static createNewDict(annotation, xref, { 61109 apRef, 61110 ap 61111 }) { 61112 const { 61113 color, 61114 date, 61115 fontSize, 61116 oldAnnotation, 61117 rect, 61118 rotation, 61119 user, 61120 value 61121 } = annotation; 61122 const freetext = oldAnnotation || new Dict(xref); 61123 freetext.setIfNotExists("Type", Name.get("Annot")); 61124 freetext.setIfNotExists("Subtype", Name.get("FreeText")); 61125 freetext.set(oldAnnotation ? "M" : "CreationDate", `D:${getModificationDate(date)}`); 61126 if (oldAnnotation) { 61127 freetext.delete("RC"); 61128 } 61129 freetext.setIfArray("Rect", rect); 61130 const da = `/Helv ${fontSize} Tf ${getPdfColor(color, true)}`; 61131 freetext.set("DA", da); 61132 freetext.setIfDefined("Contents", stringToAsciiOrUTF16BE(value)); 61133 freetext.setIfNotExists("F", 4); 61134 freetext.setIfNotExists("Border", [0, 0, 0]); 61135 freetext.setIfNumber("Rotate", rotation); 61136 freetext.setIfDefined("T", stringToAsciiOrUTF16BE(user)); 61137 if (apRef || ap) { 61138 const n = new Dict(xref); 61139 freetext.set("AP", n); 61140 n.set("N", apRef || ap); 61141 } 61142 return freetext; 61143 } 61144 static async createNewAppearanceStream(annotation, xref, params) { 61145 const { 61146 baseFontRef, 61147 evaluator, 61148 task 61149 } = params; 61150 const { 61151 color, 61152 fontSize, 61153 rect, 61154 rotation, 61155 value 61156 } = annotation; 61157 if (!color) { 61158 return null; 61159 } 61160 const resources = new Dict(xref); 61161 const font = new Dict(xref); 61162 if (baseFontRef) { 61163 font.set("Helv", baseFontRef); 61164 } else { 61165 const baseFont = new Dict(xref); 61166 baseFont.setIfName("BaseFont", "Helvetica"); 61167 baseFont.setIfName("Type", "Font"); 61168 baseFont.setIfName("Subtype", "Type1"); 61169 baseFont.setIfName("Encoding", "WinAnsiEncoding"); 61170 font.set("Helv", baseFont); 61171 } 61172 resources.set("Font", font); 61173 const helv = await WidgetAnnotation._getFontData(evaluator, task, { 61174 fontName: "Helv", 61175 fontSize 61176 }, resources); 61177 const [x1, y1, x2, y2] = rect; 61178 let w = x2 - x1; 61179 let h = y2 - y1; 61180 if (rotation % 180 !== 0) { 61181 [w, h] = [h, w]; 61182 } 61183 const lines = value.split("\n"); 61184 const scale = fontSize / 1000; 61185 let totalWidth = -Infinity; 61186 const encodedLines = []; 61187 for (let line of lines) { 61188 const encoded = helv.encodeString(line); 61189 if (encoded.length > 1) { 61190 return null; 61191 } 61192 line = encoded.join(""); 61193 encodedLines.push(line); 61194 let lineWidth = 0; 61195 const glyphs = helv.charsToGlyphs(line); 61196 for (const glyph of glyphs) { 61197 lineWidth += glyph.width * scale; 61198 } 61199 totalWidth = Math.max(totalWidth, lineWidth); 61200 } 61201 let hscale = 1; 61202 if (totalWidth > w) { 61203 hscale = w / totalWidth; 61204 } 61205 let vscale = 1; 61206 const lineHeight = LINE_FACTOR * fontSize; 61207 const lineAscent = (LINE_FACTOR - LINE_DESCENT_FACTOR) * fontSize; 61208 const totalHeight = lineHeight * lines.length; 61209 if (totalHeight > h) { 61210 vscale = h / totalHeight; 61211 } 61212 const fscale = Math.min(hscale, vscale); 61213 const newFontSize = fontSize * fscale; 61214 let firstPoint, clipBox, matrix; 61215 switch (rotation) { 61216 case 0: 61217 matrix = [1, 0, 0, 1]; 61218 clipBox = [rect[0], rect[1], w, h]; 61219 firstPoint = [rect[0], rect[3] - lineAscent]; 61220 break; 61221 case 90: 61222 matrix = [0, 1, -1, 0]; 61223 clipBox = [rect[1], -rect[2], w, h]; 61224 firstPoint = [rect[1], -rect[0] - lineAscent]; 61225 break; 61226 case 180: 61227 matrix = [-1, 0, 0, -1]; 61228 clipBox = [-rect[2], -rect[3], w, h]; 61229 firstPoint = [-rect[2], -rect[1] - lineAscent]; 61230 break; 61231 case 270: 61232 matrix = [0, -1, 1, 0]; 61233 clipBox = [-rect[3], rect[0], w, h]; 61234 firstPoint = [-rect[3], rect[2] - lineAscent]; 61235 break; 61236 } 61237 const buffer = ["q", `${matrix.join(" ")} 0 0 cm`, `${clipBox.join(" ")} re W n`, `BT`, `${getPdfColor(color, true)}`, `0 Tc /Helv ${numberToString(newFontSize)} Tf`]; 61238 buffer.push(`${firstPoint.join(" ")} Td (${escapeString(encodedLines[0])}) Tj`); 61239 const vShift = numberToString(lineHeight); 61240 for (let i = 1, ii = encodedLines.length; i < ii; i++) { 61241 const line = encodedLines[i]; 61242 buffer.push(`0 -${vShift} Td (${escapeString(line)}) Tj`); 61243 } 61244 buffer.push("ET", "Q"); 61245 const appearance = buffer.join("\n"); 61246 const appearanceStreamDict = new Dict(xref); 61247 appearanceStreamDict.set("FormType", 1); 61248 appearanceStreamDict.setIfName("Subtype", "Form"); 61249 appearanceStreamDict.setIfName("Type", "XObject"); 61250 appearanceStreamDict.set("BBox", rect); 61251 appearanceStreamDict.set("Resources", resources); 61252 appearanceStreamDict.set("Matrix", [1, 0, 0, 1, -rect[0], -rect[1]]); 61253 const ap = new StringStream(appearance); 61254 ap.dict = appearanceStreamDict; 61255 return ap
vendor: 5,658 bytes, lines 61255-61408
61255; 61256 } 61257} 61258class LineAnnotation extends MarkupAnnotation { 61259 constructor(params) { 61260 super(params); 61261 const { 61262 dict, 61263 xref 61264 } = params; 61265 this.data.hasOwnCanvas = this.data.noRotate; 61266 this.data.noHTML = false; 61267 const lineCoordinates = lookupRect(dict.getArray("L"), [0, 0, 0, 0]); 61268 this.data.lineCoordinates = Util.normalizeRect(lineCoordinates); 61269 this.setLineEndings(dict.getArray("LE")); 61270 this.data.lineEndings = this.lineEndings; 61271 if (!this.appearance) { 61272 const strokeColor = getPdfColorArray(this.color, [0, 0, 0]); 61273 const strokeAlpha = dict.get("CA"); 61274 const interiorColor = getRgbColor(dict.getArray("IC"), null); 61275 const fillColor = getPdfColorArray(interiorColor); 61276 const fillAlpha = fillColor ? strokeAlpha : null; 61277 const borderWidth = this.borderStyle.width || 1, 61278 borderAdjust = 2 * borderWidth; 61279 const bbox = [this.data.lineCoordinates[0] - borderAdjust, this.data.lineCoordinates[1] - borderAdjust, this.data.lineCoordinates[2] + borderAdjust, this.data.lineCoordinates[3] + borderAdjust]; 61280 if (!Util.intersect(this.rectangle, bbox)) { 61281 this.rectangle = bbox; 61282 } 61283 this._setDefaultAppearance({ 61284 xref, 61285 extra: `${borderWidth} w`, 61286 strokeColor, 61287 fillColor, 61288 strokeAlpha, 61289 fillAlpha, 61290 pointsCallback: (buffer, points) => { 61291 buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`, `${lineCoordinates[2]} ${lineCoordinates[3]} l`, "S"); 61292 return [points[0] - borderWidth, points[7] - borderWidth, points[2] + borderWidth, points[3] + borderWidth]; 61293 } 61294 }); 61295 } 61296 } 61297} 61298class SquareAnnotation extends MarkupAnnotation { 61299 constructor(params) { 61300 super(params); 61301 const { 61302 dict, 61303 xref 61304 } = params; 61305 this.data.hasOwnCanvas = this.data.noRotate; 61306 this.data.noHTML = false; 61307 if (!this.appearance) { 61308 const strokeColor = getPdfColorArray(this.color, [0, 0, 0]); 61309 const strokeAlpha = dict.get("CA"); 61310 const interiorColor = getRgbColor(dict.getArray("IC"), null); 61311 const fillColor = getPdfColorArray(interiorColor); 61312 const fillAlpha = fillColor ? strokeAlpha : null; 61313 if (this.borderStyle.width === 0 && !fillColor) { 61314 return; 61315 } 61316 this._setDefaultAppearance({ 61317 xref, 61318 extra: `${this.borderStyle.width} w`, 61319 strokeColor, 61320 fillColor, 61321 strokeAlpha, 61322 fillAlpha, 61323 pointsCallback: (buffer, points) => { 61324 const x = points[4] + this.borderStyle.width / 2; 61325 const y = points[5] + this.borderStyle.width / 2; 61326 const width = points[6] - points[4] - this.borderStyle.width; 61327 const height = points[3] - points[7] - this.borderStyle.width; 61328 buffer.push(`${x} ${y} ${width} ${height} re`); 61329 if (fillColor) { 61330 buffer.push("B"); 61331 } else { 61332 buffer.push("S"); 61333 } 61334 return [points[0], points[7], points[2], points[3]]; 61335 } 61336 }); 61337 } 61338 } 61339} 61340class CircleAnnotation extends MarkupAnnotation { 61341 constructor(params) { 61342 super(params); 61343 const { 61344 dict, 61345 xref 61346 } = params; 61347 if (!this.appearance) { 61348 const strokeColor = getPdfColorArray(this.color, [0, 0, 0]); 61349 const strokeAlpha = dict.get("CA"); 61350 const interiorColor = getRgbColor(dict.getArray("IC"), null); 61351 const fillColor = getPdfColorArray(interiorColor); 61352 const fillAlpha = fillColor ? strokeAlpha : null; 61353 if (this.borderStyle.width === 0 && !fillColor) { 61354 return; 61355 } 61356 const controlPointsDistance = 4 / 3 * Math.tan(Math.PI / (2 * 4)); 61357 this._setDefaultAppearance({ 61358 xref, 61359 extra: `${this.borderStyle.width} w`, 61360 strokeColor, 61361 fillColor, 61362 strokeAlpha, 61363 fillAlpha, 61364 pointsCallback: (buffer, points) => { 61365 const x0 = points[0] + this.borderStyle.width / 2; 61366 const y0 = points[1] - this.borderStyle.width / 2; 61367 const x1 = points[6] - this.borderStyle.width / 2; 61368 const y1 = points[7] + this.borderStyle.width / 2; 61369 const xMid = x0 + (x1 - x0) / 2; 61370 const yMid = y0 + (y1 - y0) / 2; 61371 const xOffset = (x1 - x0) / 2 * controlPointsDistance; 61372 const yOffset = (y1 - y0) / 2 * controlPointsDistance; 61373 buffer.push(`${xMid} ${y1} m`, `${xMid + xOffset} ${y1} ${x1} ${yMid + yOffset} ${x1} ${yMid} c`, `${x1} ${yMid - yOffset} ${xMid + xOffset} ${y0} ${xMid} ${y0} c`, `${xMid - xOffset} ${y0} ${x0} ${yMid - yOffset} ${x0} ${yMid} c`, `${x0} ${yMid + yOffset} ${xMid - xOffset} ${y1} ${xMid} ${y1} c`, "h"); 61374 if (fillColor) { 61375 buffer.push("B"); 61376 } else { 61377 buffer.push("S"); 61378 } 61379 return [points[0], points[7], points[2], points[3]]; 61380 } 61381 }); 61382 } 61383 } 61384} 61385class PolylineAnnotation extends MarkupAnnotation { 61386 constructor(params) { 61387 super(params); 61388 const { 61389 dict, 61390 xref 61391 } = params; 61392 this.data.hasOwnCanvas = this.data.noRotate; 61393 this.data.noHTML = false; 61394 this.data.vertices = null; 61395 if (!(this instanceof PolygonAnnotation)) { 61396 this.setLineEndings(dict.getArray("LE")); 61397 this.data.lineEndings = this.lineEndings; 61398 } 61399 const rawVertices = dict.getArray("Vertices"); 61400 if (!isNumberArray(rawVertices, null)) { 61401 return; 61402 } 61403 const vertices = this.data.vertices = Float32Array.from(rawVertices); 61404 if (!this.appearance) { 61405 const strokeColor = getPdfColorArray(this.color, [0, 0, 0]); 61406 const strokeAlpha = dict.get("CA"); 61407 let fillColor = getRgbColor(dict.getArray("IC"), null); 61408
vendor: 23,606 bytes, lines 61408-62111
61408if (fillColor) { 61409 fillColor = getPdfColorArray(fillColor); 61410 } 61411 let operator; 61412 if (fillColor) { 61413 if (this.color) { 61414 operator = fillColor.every((c, i) => c === strokeColor[i]) ? "f" : "B"; 61415 } else { 61416 operator = "f"; 61417 } 61418 } else { 61419 operator = "S"; 61420 } 61421 const borderWidth = this.borderStyle.width || 1, 61422 borderAdjust = 2 * borderWidth; 61423 const bbox = BBOX_INIT.slice(); 61424 for (let i = 0, ii = vertices.length; i < ii; i += 2) { 61425 Util.rectBoundingBox(vertices[i] - borderAdjust, vertices[i + 1] - borderAdjust, vertices[i] + borderAdjust, vertices[i + 1] + borderAdjust, bbox); 61426 } 61427 if (!Util.intersect(this.rectangle, bbox)) { 61428 this.rectangle = bbox; 61429 } 61430 this._setDefaultAppearance({ 61431 xref, 61432 extra: `${borderWidth} w`, 61433 strokeColor, 61434 strokeAlpha, 61435 fillColor, 61436 fillAlpha: fillColor ? strokeAlpha : null, 61437 pointsCallback: (buffer, points) => { 61438 for (let i = 0, ii = vertices.length; i < ii; i += 2) { 61439 buffer.push(`${vertices[i]} ${vertices[i + 1]} ${i === 0 ? "m" : "l"}`); 61440 } 61441 buffer.push(operator); 61442 return [points[0], points[7], points[2], points[3]]; 61443 } 61444 }); 61445 } 61446 } 61447} 61448class PolygonAnnotation extends PolylineAnnotation {} 61449class CaretAnnotation extends MarkupAnnotation {} 61450class InkAnnotation extends MarkupAnnotation { 61451 constructor(params) { 61452 super(params); 61453 this.data.hasOwnCanvas = this.data.noRotate; 61454 this.data.noHTML = false; 61455 const { 61456 dict, 61457 xref 61458 } = params; 61459 this.data.inkLists = []; 61460 this.data.isEditable = !this.data.noHTML; 61461 this.data.noHTML = false; 61462 this.data.opacity = dict.get("CA") || 1; 61463 const rawInkLists = dict.getArray("InkList"); 61464 if (!Array.isArray(rawInkLists)) { 61465 return; 61466 } 61467 for (let i = 0, ii = rawInkLists.length; i < ii; ++i) { 61468 if (!Array.isArray(rawInkLists[i])) { 61469 continue; 61470 } 61471 const inkList = new Float32Array(rawInkLists[i].length); 61472 this.data.inkLists.push(inkList); 61473 for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) { 61474 const x = xref.fetchIfRef(rawInkLists[i][j]), 61475 y = xref.fetchIfRef(rawInkLists[i][j + 1]); 61476 if (typeof x === "number" && typeof y === "number") { 61477 inkList[j] = x; 61478 inkList[j + 1] = y; 61479 } 61480 } 61481 } 61482 if (!this.appearance) { 61483 const strokeColor = getPdfColorArray(this.color, [0, 0, 0]); 61484 const strokeAlpha = dict.get("CA"); 61485 const borderWidth = this.borderStyle.width || 1, 61486 borderAdjust = 2 * borderWidth; 61487 const bbox = BBOX_INIT.slice(); 61488 for (const inkList of this.data.inkLists) { 61489 for (let i = 0, ii = inkList.length; i < ii; i += 2) { 61490 Util.rectBoundingBox(inkList[i] - borderAdjust, inkList[i + 1] - borderAdjust, inkList[i] + borderAdjust, inkList[i + 1] + borderAdjust, bbox); 61491 } 61492 } 61493 if (!Util.intersect(this.rectangle, bbox)) { 61494 this.rectangle = bbox; 61495 } 61496 this._setDefaultAppearance({ 61497 xref, 61498 extra: `${borderWidth} w`, 61499 strokeColor, 61500 strokeAlpha, 61501 pointsCallback: (buffer, points) => { 61502 for (const inkList of this.data.inkLists) { 61503 for (let i = 0, ii = inkList.length; i < ii; i += 2) { 61504 buffer.push(`${inkList[i]} ${inkList[i + 1]} ${i === 0 ? "m" : "l"}`); 61505 } 61506 buffer.push("S"); 61507 } 61508 return [points[0], points[7], points[2], points[3]]; 61509 } 61510 }); 61511 } 61512 } 61513 static createNewDict(annotation, xref, { 61514 apRef, 61515 ap 61516 }) { 61517 const { 61518 oldAnnotation, 61519 color, 61520 date, 61521 opacity, 61522 paths, 61523 outlines, 61524 rect, 61525 rotation, 61526 thickness, 61527 user 61528 } = annotation; 61529 const ink = oldAnnotation || new Dict(xref); 61530 ink.setIfNotExists("Type", Name.get("Annot")); 61531 ink.setIfNotExists("Subtype", Name.get("Ink")); 61532 ink.set(oldAnnotation ? "M" : "CreationDate", `D:${getModificationDate(date)}`); 61533 ink.setIfArray("Rect", rect); 61534 ink.setIfArray("InkList", outlines?.points || paths?.points); 61535 ink.setIfNotExists("F", 4); 61536 ink.setIfNumber("Rotate", rotation); 61537 ink.setIfDefined("T", stringToAsciiOrUTF16BE(user)); 61538 if (outlines) { 61539 ink.setIfName("IT", "InkHighlight"); 61540 } 61541 if (thickness > 0) { 61542 const bs = new Dict(xref); 61543 ink.set("BS", bs); 61544 bs.set("W", thickness); 61545 } 61546 ink.setIfArray("C", getPdfColorArray(color)); 61547 ink.setIfNumber("CA", opacity); 61548 if (ap || apRef) { 61549 const n = new Dict(xref); 61550 ink.set("AP", n); 61551 n.set("N", apRef || ap); 61552 } 61553 return ink; 61554 } 61555 static async createNewAppearanceStream(annotation, xref, params) { 61556 if (annotation.outlines) { 61557 return this.createNewAppearanceStreamForHighlight(annotation, xref, params); 61558 } 61559 const { 61560 color, 61561 rect, 61562 paths, 61563 thickness, 61564 opacity 61565 } = annotation; 61566 if (!color) { 61567 return null; 61568 } 61569 const appearanceBuffer = [`${thickness} w 1 J 1 j`, `${getPdfColor(color, false)}`]; 61570 if (opacity !== 1) { 61571 appearanceBuffer.push("/R0 gs"); 61572 } 61573 for (const outline of paths.lines) { 61574 appearanceBuffer.push(`${numberToString(outline[4])} ${numberToString(outline[5])} m`); 61575 for (let i = 6, ii = outline.length; i < ii; i += 6) { 61576 if (isNaN(outline[i])) { 61577 appearanceBuffer.push(`${numberToString(outline[i + 4])} ${numberToString(outline[i + 5])} l`); 61578 } else { 61579 const [c1x, c1y, c2x, c2y, x, y] = outline.slice(i, i + 6); 61580 appearanceBuffer.push([c1x, c1y, c2x, c2y, x, y].map(numberToString).join(" ") + " c"); 61581 } 61582 } 61583 if (outline.length === 6) { 61584 appearanceBuffer.push(`${numberToString(outline[4])} ${numberToString(outline[5])} l`); 61585 } 61586 } 61587 appearanceBuffer.push("S"); 61588 const appearance = appearanceBuffer.join("\n"); 61589 const appearanceStreamDict = new Dict(xref); 61590 appearanceStreamDict.set("FormType", 1); 61591 appearanceStreamDict.setIfName("Subtype", "Form"); 61592 appearanceStreamDict.setIfName("Type", "XObject"); 61593 appearanceStreamDict.set("BBox", rect); 61594 appearanceStreamDict.set("Length", appearance.length); 61595 if (opacity !== 1) { 61596 const resources = new Dict(xref); 61597 const extGState = new Dict(xref); 61598 const r0 = new Dict(xref); 61599 r0.set("CA", opacity); 61600 r0.setIfName("Type", "ExtGState"); 61601 extGState.set("R0", r0); 61602 resources.set("ExtGState", extGState); 61603 appearanceStreamDict.set("Resources", resources); 61604 } 61605 const ap = new StringStream(appearance); 61606 ap.dict = appearanceStreamDict; 61607 return ap; 61608 } 61609 static async createNewAppearanceStreamForHighlight(annotation, xref, params) { 61610 const { 61611 color, 61612 rect, 61613 outlines: { 61614 outline 61615 }, 61616 opacity 61617 } = annotation; 61618 if (!color) { 61619 return null; 61620 } 61621 const appearanceBuffer = [`${getPdfColor(color, true)}`, "/R0 gs"]; 61622 appearanceBuffer.push(`${numberToString(outline[4])} ${numberToString(outline[5])} m`); 61623 for (let i = 6, ii = outline.length; i < ii; i += 6) { 61624 if (isNaN(outline[i])) { 61625 appearanceBuffer.push(`${numberToString(outline[i + 4])} ${numberToString(outline[i + 5])} l`); 61626 } else { 61627 const [c1x, c1y, c2x, c2y, x, y] = outline.slice(i, i + 6); 61628 appearanceBuffer.push([c1x, c1y, c2x, c2y, x, y].map(numberToString).join(" ") + " c"); 61629 } 61630 } 61631 appearanceBuffer.push("h f"); 61632 const appearance = appearanceBuffer.join("\n"); 61633 const appearanceStreamDict = new Dict(xref); 61634 appearanceStreamDict.set("FormType", 1); 61635 appearanceStreamDict.setIfName("Subtype", "Form"); 61636 appearanceStreamDict.setIfName("Type", "XObject"); 61637 appearanceStreamDict.set("BBox", rect); 61638 appearanceStreamDict.set("Length", appearance.length); 61639 const resources = new Dict(xref); 61640 const extGState = new Dict(xref); 61641 resources.set("ExtGState", extGState); 61642 appearanceStreamDict.set("Resources", resources); 61643 const r0 = new Dict(xref); 61644 extGState.set("R0", r0); 61645 r0.setIfName("BM", "Multiply"); 61646 if (opacity !== 1) { 61647 r0.set("ca", opacity); 61648 r0.setIfName("Type", "ExtGState"); 61649 } 61650 const ap = new StringStream(appearance); 61651 ap.dict = appearanceStreamDict; 61652 return ap; 61653 } 61654} 61655class HighlightAnnotation extends MarkupAnnotation { 61656 constructor(params) { 61657 super(params); 61658 const { 61659 dict, 61660 xref 61661 } = params; 61662 this.data.isEditable = !this.data.noHTML; 61663 this.data.noHTML = false; 61664 this.data.opacity = dict.get("CA") || 1; 61665 const quadPoints = this.data.quadPoints = getQuadPoints(dict, null); 61666 if (quadPoints) { 61667 const resources = this.appearance?.dict.get("Resources"); 61668 if (!this.appearance || !resources?.has("ExtGState")) { 61669 if (this.appearance) { 61670 warn("HighlightAnnotation - ignoring built-in appearance stream."); 61671 } 61672 const fillColor = getPdfColorArray(this.color, [1, 1, 0]); 61673 const fillAlpha = dict.get("CA"); 61674 this._setDefaultAppearance({ 61675 xref, 61676 fillColor, 61677 blendMode: "Multiply", 61678 fillAlpha, 61679 pointsCallback: (buffer, points) => { 61680 buffer.push(`${points[0]} ${points[1]} m`, `${points[2]} ${points[3]} l`, `${points[6]} ${points[7]} l`, `${points[4]} ${points[5]} l`, "f"); 61681 return [points[0], points[7], points[2], points[3]]; 61682 } 61683 }); 61684 } 61685 } else { 61686 this.data.popupRef = null; 61687 } 61688 } 61689 get overlaysTextContent() { 61690 return true; 61691 } 61692 static createNewDict(annotation, xref, { 61693 apRef, 61694 ap 61695 }) { 61696 const { 61697 color, 61698 date, 61699 oldAnnotation, 61700 opacity, 61701 rect, 61702 rotation, 61703 user, 61704 quadPoints 61705 } = annotation; 61706 const highlight = oldAnnotation || new Dict(xref); 61707 highlight.setIfNotExists("Type", Name.get("Annot")); 61708 highlight.setIfNotExists("Subtype", Name.get("Highlight")); 61709 highlight.set(oldAnnotation ? "M" : "CreationDate", `D:${getModificationDate(date)}`); 61710 highlight.setIfArray("Rect", rect); 61711 highlight.setIfNotExists("F", 4); 61712 highlight.setIfNotExists("Border", [0, 0, 0]); 61713 highlight.setIfNumber("Rotate", rotation); 61714 highlight.setIfArray("QuadPoints", quadPoints); 61715 highlight.setIfArray("C", getPdfColorArray(color)); 61716 highlight.setIfNumber("CA", opacity); 61717 highlight.setIfDefined("T", stringToAsciiOrUTF16BE(user)); 61718 if (apRef || ap) { 61719 const n = new Dict(xref); 61720 highlight.set("AP", n); 61721 n.set("N", apRef || ap); 61722 } 61723 return highlight; 61724 } 61725 static async createNewAppearanceStream(annotation, xref, params) { 61726 const { 61727 color, 61728 rect, 61729 outlines, 61730 opacity 61731 } = annotation; 61732 if (!color) { 61733 return null; 61734 } 61735 const appearanceBuffer = [`${getPdfColor(color, true)}`, "/R0 gs"]; 61736 const buffer = []; 61737 for (const outline of outlines) { 61738 buffer.length = 0; 61739 buffer.push(`${numberToString(outline[0])} ${numberToString(outline[1])} m`); 61740 for (let i = 2, ii = outline.length; i < ii; i += 2) { 61741 buffer.push(`${numberToString(outline[i])} ${numberToString(outline[i + 1])} l`); 61742 } 61743 buffer.push("h"); 61744 appearanceBuffer.push(buffer.join("\n")); 61745 } 61746 appearanceBuffer.push("f*"); 61747 const appearance = appearanceBuffer.join("\n"); 61748 const appearanceStreamDict = new Dict(xref); 61749 appearanceStreamDict.set("FormType", 1); 61750 appearanceStreamDict.setIfName("Subtype", "Form"); 61751 appearanceStreamDict.setIfName("Type", "XObject"); 61752 appearanceStreamDict.set("BBox", rect); 61753 appearanceStreamDict.set("Length", appearance.length); 61754 const resources = new Dict(xref); 61755 const extGState = new Dict(xref); 61756 resources.set("ExtGState", extGState); 61757 appearanceStreamDict.set("Resources", resources); 61758 const r0 = new Dict(xref); 61759 extGState.set("R0", r0); 61760 r0.setIfName("BM", "Multiply"); 61761 if (opacity !== 1) { 61762 r0.set("ca", opacity); 61763 r0.setIfName("Type", "ExtGState"); 61764 } 61765 const ap = new StringStream(appearance); 61766 ap.dict = appearanceStreamDict; 61767 return ap; 61768 } 61769} 61770class UnderlineAnnotation extends MarkupAnnotation { 61771 constructor(params) { 61772 super(params); 61773 const { 61774 dict, 61775 xref 61776 } = params; 61777 const quadPoints = this.data.quadPoints = getQuadPoints(dict, null); 61778 if (quadPoints) { 61779 if (!this.appearance) { 61780 const strokeColor = getPdfColorArray(this.color, [0, 0, 0]); 61781 const strokeAlpha = dict.get("CA"); 61782 this._setDefaultAppearance({ 61783 xref, 61784 extra: "[] 0 d 0.571 w", 61785 strokeColor, 61786 strokeAlpha, 61787 pointsCallback: (buffer, points) => { 61788 buffer.push(`${points[4]} ${points[5] + 1.3} m`, `${points[6]} ${points[7] + 1.3} l`, "S"); 61789 return [points[0], points[7], points[2], points[3]]; 61790 } 61791 }); 61792 } 61793 } else { 61794 this.data.popupRef = null; 61795 } 61796 } 61797 get overlaysTextContent() { 61798 return true; 61799 } 61800} 61801class SquigglyAnnotation extends MarkupAnnotation { 61802 constructor(params) { 61803 super(params); 61804 const { 61805 dict, 61806 xref 61807 } = params; 61808 const quadPoints = this.data.quadPoints = getQuadPoints(dict, null); 61809 if (quadPoints) { 61810 if (!this.appearance) { 61811 const strokeColor = getPdfColorArray(this.color, [0, 0, 0]); 61812 const strokeAlpha = dict.get("CA"); 61813 this._setDefaultAppearance({ 61814 xref, 61815 extra: "[] 0 d 1 w", 61816 strokeColor, 61817 strokeAlpha, 61818 pointsCallback: (buffer, points) => { 61819 const dy = (points[1] - points[5]) / 6; 61820 let shift = dy; 61821 let x = points[4]; 61822 const y = points[5]; 61823 const xEnd = points[6]; 61824 buffer.push(`${x} ${y + shift} m`); 61825 do { 61826 x += 2; 61827 shift = shift === 0 ? dy : 0; 61828 buffer.push(`${x} ${y + shift} l`); 61829 } while (x < xEnd); 61830 buffer.push("S"); 61831 return [points[4], y - 2 * dy, xEnd, y + 2 * dy]; 61832 } 61833 }); 61834 } 61835 } else { 61836 this.data.popupRef = null; 61837 } 61838 } 61839 get overlaysTextContent() { 61840 return true; 61841 } 61842} 61843class StrikeOutAnnotation extends MarkupAnnotation { 61844 constructor(params) { 61845 super(params); 61846 const { 61847 dict, 61848 xref 61849 } = params; 61850 const quadPoints = this.data.quadPoints = getQuadPoints(dict, null); 61851 if (quadPoints) { 61852 if (!this.appearance) { 61853 const strokeColor = getPdfColorArray(this.color, [0, 0, 0]); 61854 const strokeAlpha = dict.get("CA"); 61855 this._setDefaultAppearance({ 61856 xref, 61857 extra: "[] 0 d 1 w", 61858 strokeColor, 61859 strokeAlpha, 61860 pointsCallback: (buffer, points) => { 61861 buffer.push(`${(points[0] + points[4]) / 2} ` + `${(points[1] + points[5]) / 2} m`, `${(points[2] + points[6]) / 2} ` + `${(points[3] + points[7]) / 2} l`, "S"); 61862 return [points[0], points[7], points[2], points[3]]; 61863 } 61864 }); 61865 } 61866 } else { 61867 this.data.popupRef = null; 61868 } 61869 } 61870 get overlaysTextContent() { 61871 return true; 61872 } 61873} 61874class StampAnnotation extends MarkupAnnotation { 61875 #savedHasOwnCanvas = null; 61876 constructor(params) { 61877 super(params); 61878 this.data.hasOwnCanvas = this.data.noRotate; 61879 this.data.isEditable = !this.data.noHTML; 61880 this.data.noHTML = false; 61881 } 61882 mustBeViewedWhenEditing(isEditing, modifiedIds = null) { 61883 if (isEditing) { 61884 if (!this.data.isEditable) { 61885 return true; 61886 } 61887 this.#savedHasOwnCanvas ??= this.data.hasOwnCanvas; 61888 this.data.hasOwnCanvas = true; 61889 return true; 61890 } 61891 if (this.#savedHasOwnCanvas !== null) { 61892 this.data.hasOwnCanvas = this.#savedHasOwnCanvas; 61893 this.#savedHasOwnCanvas = null; 61894 } 61895 return !modifiedIds?.has(this.data.id); 61896 } 61897 static async createImage(bitmap, xref) { 61898 const { 61899 width, 61900 height 61901 } = bitmap; 61902 const canvas = new OffscreenCanvas(width, height); 61903 const ctx = canvas.getContext("2d", { 61904 alpha: true 61905 }); 61906 ctx.drawImage(bitmap, 0, 0); 61907 const data = ctx.getImageData(0, 0, width, height).data; 61908 const buf32 = new Uint32Array(data.buffer); 61909 const hasAlpha = buf32.some(FeatureTest.isLittleEndian ? x => x >>> 24 !== 0xff : x => (x & 0xff) !== 0xff); 61910 if (hasAlpha) { 61911 ctx.fillStyle = "white"; 61912 ctx.fillRect(0, 0, width, height); 61913 ctx.drawImage(bitmap, 0, 0); 61914 } 61915 const jpegBytesPromise = canvas.convertToBlob({ 61916 type: "image/jpeg", 61917 quality: 1 61918 }).then(blob => blob.bytes()); 61919 const xobjectName = Name.get("XObject"); 61920 const imageName = Name.get("Image"); 61921 const image = new Dict(xref); 61922 image.set("Type", xobjectName); 61923 image.set("Subtype", imageName); 61924 image.set("BitsPerComponent", 8); 61925 image.setIfName("ColorSpace", "DeviceRGB"); 61926 image.setIfName("Filter", "DCTDecode"); 61927 image.set("BBox", [0, 0, width, height]); 61928 image.set("Width", width); 61929 image.set("Height", height); 61930 let smaskStream = null; 61931 if (hasAlpha) { 61932 const alphaBuffer = new Uint8Array(buf32.length); 61933 if (FeatureTest.isLittleEndian) { 61934 for (let i = 0, ii = buf32.length; i < ii; i++) { 61935 alphaBuffer[i] = buf32[i] >>> 24; 61936 } 61937 } else { 61938 for (let i = 0, ii = buf32.length; i < ii; i++) { 61939 alphaBuffer[i] = buf32[i] & 0xff; 61940 } 61941 } 61942 const smask = new Dict(xref); 61943 smask.set("Type", xobjectName); 61944 smask.set("Subtype", imageName); 61945 smask.set("BitsPerComponent", 8); 61946 smask.setIfName("ColorSpace", "DeviceGray"); 61947 smask.set("Width", width); 61948 smask.set("Height", height); 61949 smaskStream = new Stream(alphaBuffer, 0, 0, smask); 61950 } 61951 const imageStream = new Stream(await jpegBytesPromise, 0, 0, image); 61952 return { 61953 imageStream, 61954 smaskStream, 61955 width, 61956 height 61957 }; 61958 } 61959 static createNewDict(annotation, xref, { 61960 apRef, 61961 ap 61962 }) { 61963 const { 61964 date, 61965 oldAnnotation, 61966 rect, 61967 rotation, 61968 user 61969 } = annotation; 61970 const stamp = oldAnnotation || new Dict(xref); 61971 stamp.setIfNotExists("Type", Name.get("Annot")); 61972 stamp.setIfNotExists("Subtype", Name.get("Stamp")); 61973 stamp.set(oldAnnotation ? "M" : "CreationDate", `D:${getModificationDate(date)}`); 61974 stamp.setIfArray("Rect", rect); 61975 stamp.setIfNotExists("F", 4); 61976 stamp.setIfNotExists("Border", [0, 0, 0]); 61977 stamp.setIfNumber("Rotate", rotation); 61978 stamp.setIfDefined("T", stringToAsciiOrUTF16BE(user)); 61979 if (apRef || ap) { 61980 const n = new Dict(xref); 61981 stamp.set("AP", n); 61982 n.set("N", apRef || ap); 61983 } 61984 return stamp; 61985 } 61986 static async #createNewAppearanceStreamForDrawing(annotation, xref) { 61987 const { 61988 areContours, 61989 color, 61990 rect, 61991 lines, 61992 thickness 61993 } = annotation; 61994 if (!color) { 61995 return null; 61996 } 61997 const appearanceBuffer = [`${thickness} w 1 J 1 j`, `${getPdfColor(color, areContours)}`]; 61998 for (const line of lines) { 61999 appearanceBuffer.push(`${numberToString(line[4])} ${numberToString(line[5])} m`); 62000 for (let i = 6, ii = line.length; i < ii; i += 6) { 62001 if (isNaN(line[i])) { 62002 appearanceBuffer.push(`${numberToString(line[i + 4])} ${numberToString(line[i + 5])} l`); 62003 } else { 62004 const [c1x, c1y, c2x, c2y, x, y] = line.slice(i, i + 6); 62005 appearanceBuffer.push([c1x, c1y, c2x, c2y, x, y].map(numberToString).join(" ") + " c"); 62006 } 62007 } 62008 if (line.length === 6) { 62009 appearanceBuffer.push(`${numberToString(line[4])} ${numberToString(line[5])} l`); 62010 } 62011 } 62012 appearanceBuffer.push(areContours ? "F" : "S"); 62013 const appearance = appearanceBuffer.join("\n"); 62014 const appearanceStreamDict = new Dict(xref); 62015 appearanceStreamDict.set("FormType", 1); 62016 appearanceStreamDict.setIfName("Subtype", "Form"); 62017 appearanceStreamDict.setIfName("Type", "XObject"); 62018 appearanceStreamDict.set("BBox", rect); 62019 appearanceStreamDict.set("Length", appearance.length); 62020 const ap = new StringStream(appearance); 62021 ap.dict = appearanceStreamDict; 62022 return ap; 62023 } 62024 static async createNewAppearanceStream(annotation, xref, params) { 62025 if (annotation.oldAnnotation) { 62026 return null; 62027 } 62028 if (annotation.isSignature) { 62029 return this.#createNewAppearanceStreamForDrawing(annotation, xref); 62030 } 62031 const { 62032 rotation 62033 } = annotation; 62034 const { 62035 imageRef, 62036 width, 62037 height 62038 } = params.image; 62039 const resources = new Dict(xref); 62040 const xobject = new Dict(xref); 62041 resources.set("XObject", xobject); 62042 xobject.set("Im0", imageRef); 62043 const appearance = `q ${width} 0 0 ${height} 0 0 cm /Im0 Do Q`; 62044 const appearanceStreamDict = new Dict(xref); 62045 appearanceStreamDict.set("FormType", 1); 62046 appearanceStreamDict.setIfName("Subtype", "Form"); 62047 appearanceStreamDict.setIfName("Type", "XObject"); 62048 appearanceStreamDict.set("BBox", [0, 0, width, height]); 62049 appearanceStreamDict.set("Resources", resources); 62050 if (rotation) { 62051 const matrix = getRotationMatrix(rotation, width, height); 62052 appearanceStreamDict.set("Matrix", matrix); 62053 } 62054 const ap = new StringStream(appearance); 62055 ap.dict = appearanceStreamDict; 62056 return ap; 62057 } 62058} 62059class FileAttachmentAnnotation extends MarkupAnnotation { 62060 constructor(params) { 62061 super(params); 62062 const { 62063 dict 62064 } = params; 62065 const file = new FileSpec(dict.get("FS")); 62066 this.data.hasOwnCanvas = this.data.noRotate; 62067 this.data.noHTML = false; 62068 this.data.file = file.serializable; 62069 const name = dict.get("Name"); 62070 this.data.name = name instanceof Name ? stringToPDFString(name.name) : "PushPin"; 62071 const fillAlpha = dict.get("ca"); 62072 this.data.fillAlpha = typeof fillAlpha === "number" && fillAlpha >= 0 && fillAlpha <= 1 ? fillAlpha : null; 62073 } 62074} 62075 62076;// ./src/core/calculate_md5.js 62077 62078 62079 62080 62081 62082 62083 62084 62085 62086const PARAMS = { 62087 get r() { 62088 return shadow(this, "r", new Uint8Array([7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21])); 62089 }, 62090 get k() { 62091 return shadow(this, "k", new Int32Array([-680876936, -389564586, 606105819, -1044525330, -176418897, 1200080426, -1473231341, -45705983, 1770035416, -1958414417, -42063, -1990404162, 1804603682, -40341101, -1502002290, 1236535329, -165796510, -1069501632, 643717713, -373897302, -701558691, 38016083, -660478335, -405537848, 568446438, -1019803690, -187363961, 1163531501, -1444681467, -51403784, 1735328473, -1926607734, -378558, -2022574463, 1839030562, -35309556, -1530992060, 1272893353, -155497632, -1094730640, 681279174, -358537222, -722521979, 76029189, -640364487, -421815835, 530742520, -995338651, -198630844, 1126891415, -1416354905, -57434055, 1700485571, -1894986606, -1051523, -2054922799, 1873313359, -30611744, -1560198380, 1309151649, -145523070, -1120210379, 718787259, -343485551])); 62092 } 62093}; 62094function calculateMD5(data, offset, length) { 62095 let h0 = 1732584193, 62096 h1 = -271733879, 62097 h2 = -1732584194, 62098 h3 = 271733878; 62099 const paddedLength = length + 72 & ~63; 62100 const padded = new Uint8Array(paddedLength); 62101 let i, j; 62102 for (i = 0; i < length; ++i) { 62103 padded[i] = data[offset++]; 62104 } 62105 padded[i++] = 0x80; 62106 const n = paddedLength - 8; 62107 if (i < n) { 62108 i = n; 62109 } 62110 padded[i++] = length << 3 & 0xff; 62111 padded[i++] = length >> 5 & 0xff;
vendor: 7,833 bytes, lines 62112-62409
62112 padded[i++] = length >> 13 & 0xff; 62113 padded[i++] = length >> 21 & 0xff; 62114 padded[i++] = length >>> 29 & 0xff; 62115 i += 3; 62116 const w = new Int32Array(16); 62117 const { 62118 k, 62119 r 62120 } = PARAMS; 62121 for (i = 0; i < paddedLength;) { 62122 for (j = 0; j < 16; ++j, i += 4) { 62123 w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24; 62124 } 62125 let a = h0, 62126 b = h1, 62127 c = h2, 62128 d = h3, 62129 f, 62130 g; 62131 for (j = 0; j < 64; ++j) { 62132 if (j < 16) { 62133 f = b & c | ~b & d; 62134 g = j; 62135 } else if (j < 32) { 62136 f = d & b | ~d & c; 62137 g = 5 * j + 1 & 15; 62138 } else if (j < 48) { 62139 f = b ^ c ^ d; 62140 g = 3 * j + 5 & 15; 62141 } else { 62142 f = c ^ (b | ~d); 62143 g = 7 * j & 15; 62144 } 62145 const tmp = d, 62146 rotateArg = a + f + k[j] + w[g] | 0, 62147 rotate = r[j]; 62148 d = c; 62149 c = b; 62150 b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0; 62151 a = tmp; 62152 } 62153 h0 = h0 + a | 0; 62154 h1 = h1 + b | 0; 62155 h2 = h2 + c | 0; 62156 h3 = h3 + d | 0; 62157 } 62158 return new Uint8Array([h0 & 0xFF, h0 >> 8 & 0xFF, h0 >> 16 & 0xFF, h0 >>> 24 & 0xFF, h1 & 0xFF, h1 >> 8 & 0xFF, h1 >> 16 & 0xFF, h1 >>> 24 & 0xFF, h2 & 0xFF, h2 >> 8 & 0xFF, h2 >> 16 & 0xFF, h2 >>> 24 & 0xFF, h3 & 0xFF, h3 >> 8 & 0xFF, h3 >> 16 & 0xFF, h3 >>> 24 & 0xFF]); 62159} 62160 62161;// ./src/core/dataset_reader.js 62162 62163 62164 62165 62166 62167function decodeString(str) { 62168 try { 62169 return stringToUTF8String(str); 62170 } catch (ex) { 62171 warn(`UTF-8 decoding failed: "${ex}".`); 62172 return str; 62173 } 62174} 62175class DatasetXMLParser extends SimpleXMLParser { 62176 node = null; 62177 onEndElement(name) { 62178 const node = super.onEndElement(name); 62179 if (node && name === "xfa:datasets") { 62180 this.node = node; 62181 throw new Error("Aborting DatasetXMLParser."); 62182 } 62183 } 62184} 62185class DatasetReader { 62186 constructor(data) { 62187 if (data.datasets) { 62188 this.node = new SimpleXMLParser({ 62189 hasAttributes: true 62190 }).parseFromString(data.datasets).documentElement; 62191 } else { 62192 const parser = new DatasetXMLParser({ 62193 hasAttributes: true 62194 }); 62195 try { 62196 parser.parseFromString(data["xdp:xdp"]); 62197 } catch {} 62198 this.node = parser.node; 62199 } 62200 } 62201 getValue(path) { 62202 if (!this.node || !path) { 62203 return ""; 62204 } 62205 const node = this.node.searchNode(parseXFAPath(path), 0); 62206 if (!node) { 62207 return ""; 62208 } 62209 const first = node.firstChild; 62210 if (first?.nodeName === "value") { 62211 return node.children.map(child => decodeString(child.textContent)); 62212 } 62213 return decodeString(node.textContent); 62214 } 62215} 62216 62217;// ./src/core/intersector.js 62218 62219class SingleIntersector { 62220 #annotation; 62221 minX = Infinity; 62222 minY = Infinity; 62223 maxX = -Infinity; 62224 maxY = -Infinity; 62225 #quadPoints = null; 62226 #text = []; 62227 #extraChars = []; 62228 #lastIntersectingQuadIndex = -1; 62229 #canTakeExtraChars = false; 62230 constructor(annotation) { 62231 this.#annotation = annotation; 62232 const quadPoints = annotation.data.quadPoints; 62233 if (!quadPoints) { 62234 [this.minX, this.minY, this.maxX, this.maxY] = annotation.data.rect; 62235 return; 62236 } 62237 for (let i = 0, ii = quadPoints.length; i < ii; i += 8) { 62238 this.minX = Math.min(this.minX, quadPoints[i]); 62239 this.maxX = Math.max(this.maxX, quadPoints[i + 2]); 62240 this.minY = Math.min(this.minY, quadPoints[i + 5]); 62241 this.maxY = Math.max(this.maxY, quadPoints[i + 1]); 62242 } 62243 if (quadPoints.length > 8) { 62244 this.#quadPoints = quadPoints; 62245 } 62246 } 62247 #intersects(x, y) { 62248 if (this.minX >= x || this.maxX <= x || this.minY >= y || this.maxY <= y) { 62249 return false; 62250 } 62251 const quadPoints = this.#quadPoints; 62252 if (!quadPoints) { 62253 return true; 62254 } 62255 if (this.#lastIntersectingQuadIndex >= 0) { 62256 const i = this.#lastIntersectingQuadIndex; 62257 if (!(quadPoints[i] >= x || quadPoints[i + 2] <= x || quadPoints[i + 5] >= y || quadPoints[i + 1] <= y)) { 62258 return true; 62259 } 62260 this.#lastIntersectingQuadIndex = -1; 62261 } 62262 for (let i = 0, ii = quadPoints.length; i < ii; i += 8) { 62263 if (!(quadPoints[i] >= x || quadPoints[i + 2] <= x || quadPoints[i + 5] >= y || quadPoints[i + 1] <= y)) { 62264 this.#lastIntersectingQuadIndex = i; 62265 return true; 62266 } 62267 } 62268 return false; 62269 } 62270 addGlyph(x, y, glyph) { 62271 if (!this.#intersects(x, y)) { 62272 this.disableExtraChars(); 62273 return false; 62274 } 62275 if (this.#extraChars.length > 0) { 62276 this.#text.push(this.#extraChars.join("")); 62277 this.#extraChars.length = 0; 62278 } 62279 this.#text.push(glyph); 62280 this.#canTakeExtraChars = true; 62281 return true; 62282 } 62283 addExtraChar(char) { 62284 if (this.#canTakeExtraChars) { 62285 this.#extraChars.push(char); 62286 } 62287 } 62288 disableExtraChars() { 62289 if (!this.#canTakeExtraChars) { 62290 return; 62291 } 62292 this.#canTakeExtraChars = false; 62293 this.#extraChars.length = 0; 62294 } 62295 setText() { 62296 this.#annotation.data.overlaidText = this.#text.join(""); 62297 } 62298} 62299const STEPS = 64; 62300class Intersector { 62301 #intersectors = []; 62302 #grid = []; 62303 #minX; 62304 #maxX; 62305 #minY; 62306 #maxY; 62307 #invXRatio; 62308 #invYRatio; 62309 constructor(annotations) { 62310 let minX = Infinity; 62311 let minY = Infinity; 62312 let maxX = -Infinity; 62313 let maxY = -Infinity; 62314 const intersectors = this.#intersectors; 62315 for (const annotation of annotations) { 62316 if (!annotation.data.quadPoints && !annotation.data.rect) { 62317 continue; 62318 } 62319 const intersector = new SingleIntersector(annotation); 62320 intersectors.push(intersector); 62321 minX = Math.min(minX, intersector.minX); 62322 minY = Math.min(minY, intersector.minY); 62323 maxX = Math.max(maxX, intersector.maxX); 62324 maxY = Math.max(maxY, intersector.maxY); 62325 } 62326 this.#minX = minX; 62327 this.#minY = minY; 62328 this.#maxX = maxX; 62329 this.#maxY = maxY; 62330 this.#invXRatio = (STEPS - 1) / (maxX - minX); 62331 this.#invYRatio = (STEPS - 1) / (maxY - minY); 62332 for (const intersector of intersectors) { 62333 const iMin = this.#getGridIndex(intersector.minX, intersector.minY); 62334 const iMax = this.#getGridIndex(intersector.maxX, intersector.maxY); 62335 const w = (iMax - iMin) % STEPS; 62336 const h = Math.floor((iMax - iMin) / STEPS); 62337 for (let i = iMin; i <= iMin + h * STEPS; i += STEPS) { 62338 for (let j = 0; j <= w; j++) { 62339 let existing = this.#grid[i + j]; 62340 if (!existing) { 62341 this.#grid[i + j] = existing = []; 62342 } 62343 existing.push(intersector); 62344 } 62345 } 62346 } 62347 } 62348 #getGridIndex(x, y) { 62349 const i = Math.floor((x - this.#minX) * this.#invXRatio); 62350 const j = Math.floor((y - this.#minY) * this.#invYRatio); 62351 return i + j * STEPS; 62352 } 62353 addGlyph(transform, width, height, glyph) { 62354 const x = transform[4] + width / 2; 62355 const y = transform[5] + height / 2; 62356 if (x < this.#minX || y < this.#minY || x > this.#maxX || y > this.#maxY) { 62357 return; 62358 } 62359 const intersectors = this.#grid[this.#getGridIndex(x, y)]; 62360 if (!intersectors) { 62361 return; 62362 } 62363 for (const intersector of intersectors) { 62364 intersector.addGlyph(x, y, glyph); 62365 } 62366 } 62367 addExtraChar(char) { 62368 for (const intersector of this.#intersectors) { 62369 intersector.addExtraChar(char); 62370 } 62371 } 62372 setText() { 62373 for (const intersector of this.#intersectors) { 62374 intersector.setText(); 62375 } 62376 } 62377} 62378 62379;// ./src/core/calculate_sha_other.js 62380 62381 62382 62383 62384 62385 62386 62387 62388 62389class Word64 { 62390 constructor(highInteger, lowInteger) { 62391 this.high = highInteger | 0; 62392 this.low = lowInteger | 0; 62393 } 62394 and(word) { 62395 this.high &= word.high; 62396 this.low &= word.low; 62397 } 62398 xor(word) { 62399 this.high ^= word.high; 62400 this.low ^= word.low; 62401 } 62402 shiftRight(places) { 62403 if (places >= 32) { 62404 this.low = this.high >>> places - 32 | 0; 62405 this.high = 0; 62406 } else { 62407 this.low = this.low >>> places | this.high << 32 - places; 62408 this.high = this.high >>> places | 0; 62409 }
vendor: 8,870 bytes, lines 62409-62655
62409 62410 } 62411 rotateRight(places) { 62412 let low, high; 62413 if (places & 32) { 62414 high = this.low; 62415 low = this.high; 62416 } else { 62417 low = this.low; 62418 high = this.high; 62419 } 62420 places &= 31; 62421 this.low = low >>> places | high << 32 - places; 62422 this.high = high >>> places | low << 32 - places; 62423 } 62424 not() { 62425 this.high = ~this.high; 62426 this.low = ~this.low; 62427 } 62428 add(word) { 62429 const lowAdd = (this.low >>> 0) + (word.low >>> 0); 62430 let highAdd = (this.high >>> 0) + (word.high >>> 0); 62431 if (lowAdd > 0xffffffff) { 62432 highAdd += 1; 62433 } 62434 this.low = lowAdd | 0; 62435 this.high = highAdd | 0; 62436 } 62437 copyTo(bytes, offset) { 62438 bytes[offset] = this.high >>> 24 & 0xff; 62439 bytes[offset + 1] = this.high >> 16 & 0xff; 62440 bytes[offset + 2] = this.high >> 8 & 0xff; 62441 bytes[offset + 3] = this.high & 0xff; 62442 bytes[offset + 4] = this.low >>> 24 & 0xff; 62443 bytes[offset + 5] = this.low >> 16 & 0xff; 62444 bytes[offset + 6] = this.low >> 8 & 0xff; 62445 bytes[offset + 7] = this.low & 0xff; 62446 } 62447 assign(word) { 62448 this.high = word.high; 62449 this.low = word.low; 62450 } 62451} 62452const calculate_sha_other_PARAMS = { 62453 get k() { 62454 return shadow(this, "k", [new Word64(0x428a2f98, 0xd728ae22), new Word64(0x71374491, 0x23ef65cd), new Word64(0xb5c0fbcf, 0xec4d3b2f), new Word64(0xe9b5dba5, 0x8189dbbc), new Word64(0x3956c25b, 0xf348b538), new Word64(0x59f111f1, 0xb605d019), new Word64(0x923f82a4, 0xaf194f9b), new Word64(0xab1c5ed5, 0xda6d8118), new Word64(0xd807aa98, 0xa3030242), new Word64(0x12835b01, 0x45706fbe), new Word64(0x243185be, 0x4ee4b28c), new Word64(0x550c7dc3, 0xd5ffb4e2), new Word64(0x72be5d74, 0xf27b896f), new Word64(0x80deb1fe, 0x3b1696b1), new Word64(0x9bdc06a7, 0x25c71235), new Word64(0xc19bf174, 0xcf692694), new Word64(0xe49b69c1, 0x9ef14ad2), new Word64(0xefbe4786, 0x384f25e3), new Word64(0x0fc19dc6, 0x8b8cd5b5), new Word64(0x240ca1cc, 0x77ac9c65), new Word64(0x2de92c6f, 0x592b0275), new Word64(0x4a7484aa, 0x6ea6e483), new Word64(0x5cb0a9dc, 0xbd41fbd4), new Word64(0x76f988da, 0x831153b5), new Word64(0x983e5152, 0xee66dfab), new Word64(0xa831c66d, 0x2db43210), new Word64(0xb00327c8, 0x98fb213f), new Word64(0xbf597fc7, 0xbeef0ee4), new Word64(0xc6e00bf3, 0x3da88fc2), new Word64(0xd5a79147, 0x930aa725), new Word64(0x06ca6351, 0xe003826f), new Word64(0x14292967, 0x0a0e6e70), new Word64(0x27b70a85, 0x46d22ffc), new Word64(0x2e1b2138, 0x5c26c926), new Word64(0x4d2c6dfc, 0x5ac42aed), new Word64(0x53380d13, 0x9d95b3df), new Word64(0x650a7354, 0x8baf63de), new Word64(0x766a0abb, 0x3c77b2a8), new Word64(0x81c2c92e, 0x47edaee6), new Word64(0x92722c85, 0x1482353b), new Word64(0xa2bfe8a1, 0x4cf10364), new Word64(0xa81a664b, 0xbc423001), new Word64(0xc24b8b70, 0xd0f89791), new Word64(0xc76c51a3, 0x0654be30), new Word64(0xd192e819, 0xd6ef5218), new Word64(0xd6990624, 0x5565a910), new Word64(0xf40e3585, 0x5771202a), new Word64(0x106aa070, 0x32bbd1b8), new Word64(0x19a4c116, 0xb8d2d0c8), new Word64(0x1e376c08, 0x5141ab53), new Word64(0x2748774c, 0xdf8eeb99), new Word64(0x34b0bcb5, 0xe19b48a8), new Word64(0x391c0cb3, 0xc5c95a63), new Word64(0x4ed8aa4a, 0xe3418acb), new Word64(0x5b9cca4f, 0x7763e373), new Word64(0x682e6ff3, 0xd6b2b8a3), new Word64(0x748f82ee, 0x5defb2fc), new Word64(0x78a5636f, 0x43172f60), new Word64(0x84c87814, 0xa1f0ab72), new Word64(0x8cc70208, 0x1a6439ec), new Word64(0x90befffa, 0x23631e28), new Word64(0xa4506ceb, 0xde82bde9), new Word64(0xbef9a3f7, 0xb2c67915), new Word64(0xc67178f2, 0xe372532b), new Word64(0xca273ece, 0xea26619c), new Word64(0xd186b8c7, 0x21c0c207), new Word64(0xeada7dd6, 0xcde0eb1e), new Word64(0xf57d4f7f, 0xee6ed178), new Word64(0x06f067aa, 0x72176fba), new Word64(0x0a637dc5, 0xa2c898a6), new Word64(0x113f9804, 0xbef90dae), new Word64(0x1b710b35, 0x131c471b), new Word64(0x28db77f5, 0x23047d84), new Word64(0x32caab7b, 0x40c72493), new Word64(0x3c9ebe0a, 0x15c9bebc), new Word64(0x431d67c4, 0x9c100d4c), new Word64(0x4cc5d4be, 0xcb3e42b6), new Word64(0x597f299c, 0xfc657e2a), new Word64(0x5fcb6fab, 0x3ad6faec), new Word64(0x6c44198c, 0x4a475817)]); 62455 } 62456}; 62457function ch(result, x, y, z, tmp) { 62458 result.assign(x); 62459 result.and(y); 62460 tmp.assign(x); 62461 tmp.not(); 62462 tmp.and(z); 62463 result.xor(tmp); 62464} 62465function maj(result, x, y, z, tmp) { 62466 result.assign(x); 62467 result.and(y); 62468 tmp.assign(x); 62469 tmp.and(z); 62470 result.xor(tmp); 62471 tmp.assign(y); 62472 tmp.and(z); 62473 result.xor(tmp); 62474} 62475function sigma(result, x, tmp) { 62476 result.assign(x); 62477 result.rotateRight(28); 62478 tmp.assign(x); 62479 tmp.rotateRight(34); 62480 result.xor(tmp); 62481 tmp.assign(x); 62482 tmp.rotateRight(39); 62483 result.xor(tmp); 62484} 62485function sigmaPrime(result, x, tmp) { 62486 result.assign(x); 62487 result.rotateRight(14); 62488 tmp.assign(x); 62489 tmp.rotateRight(18); 62490 result.xor(tmp); 62491 tmp.assign(x); 62492 tmp.rotateRight(41); 62493 result.xor(tmp); 62494} 62495function littleSigma(result, x, tmp) { 62496 result.assign(x); 62497 result.rotateRight(1); 62498 tmp.assign(x); 62499 tmp.rotateRight(8); 62500 result.xor(tmp); 62501 tmp.assign(x); 62502 tmp.shiftRight(7); 62503 result.xor(tmp); 62504} 62505function littleSigmaPrime(result, x, tmp) { 62506 result.assign(x); 62507 result.rotateRight(19); 62508 tmp.assign(x); 62509 tmp.rotateRight(61); 62510 result.xor(tmp); 62511 tmp.assign(x); 62512 tmp.shiftRight(6); 62513 result.xor(tmp); 62514} 62515function calculateSHA512(data, offset, length, mode384 = false) { 62516 let h0, h1, h2, h3, h4, h5, h6, h7; 62517 if (!mode384) { 62518 h0 = new Word64(0x6a09e667, 0xf3bcc908); 62519 h1 = new Word64(0xbb67ae85, 0x84caa73b); 62520 h2 = new Word64(0x3c6ef372, 0xfe94f82b); 62521 h3 = new Word64(0xa54ff53a, 0x5f1d36f1); 62522 h4 = new Word64(0x510e527f, 0xade682d1); 62523 h5 = new Word64(0x9b05688c, 0x2b3e6c1f); 62524 h6 = new Word64(0x1f83d9ab, 0xfb41bd6b); 62525 h7 = new Word64(0x5be0cd19, 0x137e2179); 62526 } else { 62527 h0 = new Word64(0xcbbb9d5d, 0xc1059ed8); 62528 h1 = new Word64(0x629a292a, 0x367cd507); 62529 h2 = new Word64(0x9159015a, 0x3070dd17); 62530 h3 = new Word64(0x152fecd8, 0xf70e5939); 62531 h4 = new Word64(0x67332667, 0xffc00b31); 62532 h5 = new Word64(0x8eb44a87, 0x68581511); 62533 h6 = new Word64(0xdb0c2e0d, 0x64f98fa7); 62534 h7 = new Word64(0x47b5481d, 0xbefa4fa4); 62535 } 62536 const paddedLength = Math.ceil((length + 17) / 128) * 128; 62537 const padded = new Uint8Array(paddedLength); 62538 let i, j; 62539 for (i = 0; i < length; ++i) { 62540 padded[i] = data[offset++]; 62541 } 62542 padded[i++] = 0x80; 62543 const n = paddedLength - 16; 62544 if (i < n) { 62545 i = n; 62546 } 62547 i += 11; 62548 padded[i++] = length >>> 29 & 0xff; 62549 padded[i++] = length >> 21 & 0xff; 62550 padded[i++] = length >> 13 & 0xff; 62551 padded[i++] = length >> 5 & 0xff; 62552 padded[i++] = length << 3 & 0xff; 62553 const w = new Array(80); 62554 for (i = 0; i < 80; i++) { 62555 w[i] = new Word64(0, 0); 62556 } 62557 const { 62558 k 62559 } = calculate_sha_other_PARAMS; 62560 let a = new Word64(0, 0), 62561 b = new Word64(0, 0), 62562 c = new Word64(0, 0); 62563 let d = new Word64(0, 0), 62564 e = new Word64(0, 0), 62565 f = new Word64(0, 0); 62566 let g = new Word64(0, 0), 62567 h = new Word64(0, 0); 62568 const t1 = new Word64(0, 0), 62569 t2 = new Word64(0, 0); 62570 const tmp1 = new Word64(0, 0), 62571 tmp2 = new Word64(0, 0); 62572 let tmp3; 62573 for (i = 0; i < paddedLength;) { 62574 for (j = 0; j < 16; ++j) { 62575 w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3]; 62576 w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7]; 62577 i += 8; 62578 } 62579 for (j = 16; j < 80; ++j) { 62580 tmp3 = w[j]; 62581 littleSigmaPrime(tmp3, w[j - 2], tmp2); 62582 tmp3.add(w[j - 7]); 62583 littleSigma(tmp1, w[j - 15], tmp2); 62584 tmp3.add(tmp1); 62585 tmp3.add(w[j - 16]); 62586 } 62587 a.assign(h0); 62588 b.assign(h1); 62589 c.assign(h2); 62590 d.assign(h3); 62591 e.assign(h4); 62592 f.assign(h5); 62593 g.assign(h6); 62594 h.assign(h7); 62595 for (j = 0; j < 80; ++j) { 62596 t1.assign(h); 62597 sigmaPrime(tmp1, e, tmp2); 62598 t1.add(tmp1); 62599 ch(tmp1, e, f, g, tmp2); 62600 t1.add(tmp1); 62601 t1.add(k[j]); 62602 t1.add(w[j]); 62603 sigma(t2, a, tmp2); 62604 maj(tmp1, a, b, c, tmp2); 62605 t2.add(tmp1); 62606 tmp3 = h; 62607 h = g; 62608 g = f; 62609 f = e; 62610 d.add(t1); 62611 e = d; 62612 d = c; 62613 c = b; 62614 b = a; 62615 tmp3.assign(t1); 62616 tmp3.add(t2); 62617 a = tmp3; 62618 } 62619 h0.add(a); 62620 h1.add(b); 62621 h2.add(c); 62622 h3.add(d); 62623 h4.add(e); 62624 h5.add(f); 62625 h6.add(g); 62626 h7.add(h); 62627 } 62628 let result; 62629 if (!mode384) { 62630 result = new Uint8Array(64); 62631 h0.copyTo(result, 0); 62632 h1.copyTo(result, 8); 62633 h2.copyTo(result, 16); 62634 h3.copyTo(result, 24); 62635 h4.copyTo(result, 32); 62636 h5.copyTo(result, 40); 62637 h6.copyTo(result, 48); 62638 h7.copyTo(result, 56); 62639 } else { 62640 result = new Uint8Array(48); 62641 h0.copyTo(result, 0); 62642 h1.copyTo(result, 8); 62643 h2.copyTo(result, 16); 62644 h3.copyTo(result, 24); 62645 h4.copyTo(result, 32); 62646 h5.copyTo(result, 40); 62647 } 62648 return result; 62649} 62650function calculateSHA384(data, offset, length) { 62651 return calculateSHA512(data, offset, length, true); 62652} 62653 62654;// ./src/core/calculate_sha256.js 62655
vendor: 3,995 bytes, lines 62656-62774
62656 62657 62658 62659 62660 62661 62662 62663 62664const calculate_sha256_PARAMS = { 62665 get k() { 62666 return shadow(this, "k", [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2]); 62667 } 62668}; 62669function rotr(x, n) { 62670 return x >>> n | x << 32 - n; 62671} 62672function calculate_sha256_ch(x, y, z) { 62673 return x & y ^ ~x & z; 62674} 62675function calculate_sha256_maj(x, y, z) { 62676 return x & y ^ x & z ^ y & z; 62677} 62678function calculate_sha256_sigma(x) { 62679 return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22); 62680} 62681function calculate_sha256_sigmaPrime(x) { 62682 return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25); 62683} 62684function calculate_sha256_littleSigma(x) { 62685 return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3; 62686} 62687function calculate_sha256_littleSigmaPrime(x) { 62688 return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10; 62689} 62690function calculateSHA256(data, offset, length) { 62691 let h0 = 0x6a09e667, 62692 h1 = 0xbb67ae85, 62693 h2 = 0x3c6ef372, 62694 h3 = 0xa54ff53a, 62695 h4 = 0x510e527f, 62696 h5 = 0x9b05688c, 62697 h6 = 0x1f83d9ab, 62698 h7 = 0x5be0cd19; 62699 const paddedLength = Math.ceil((length + 9) / 64) * 64; 62700 const padded = new Uint8Array(paddedLength); 62701 let i, j; 62702 for (i = 0; i < length; ++i) { 62703 padded[i] = data[offset++]; 62704 } 62705 padded[i++] = 0x80; 62706 const n = paddedLength - 8; 62707 if (i < n) { 62708 i = n; 62709 } 62710 i += 3; 62711 padded[i++] = length >>> 29 & 0xff; 62712 padded[i++] = length >> 21 & 0xff; 62713 padded[i++] = length >> 13 & 0xff; 62714 padded[i++] = length >> 5 & 0xff; 62715 padded[i++] = length << 3 & 0xff; 62716 const w = new Uint32Array(64); 62717 const { 62718 k 62719 } = calculate_sha256_PARAMS; 62720 for (i = 0; i < paddedLength;) { 62721 for (j = 0; j < 16; ++j) { 62722 w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3]; 62723 i += 4; 62724 } 62725 for (j = 16; j < 64; ++j) { 62726 w[j] = calculate_sha256_littleSigmaPrime(w[j - 2]) + w[j - 7] + calculate_sha256_littleSigma(w[j - 15]) + w[j - 16] | 0; 62727 } 62728 let a = h0, 62729 b = h1, 62730 c = h2, 62731 d = h3, 62732 e = h4, 62733 f = h5, 62734 g = h6, 62735 h = h7, 62736 t1, 62737 t2; 62738 for (j = 0; j < 64; ++j) { 62739 t1 = h + calculate_sha256_sigmaPrime(e) + calculate_sha256_ch(e, f, g) + k[j] + w[j]; 62740 t2 = calculate_sha256_sigma(a) + calculate_sha256_maj(a, b, c); 62741 h = g; 62742 g = f; 62743 f = e; 62744 e = d + t1 | 0; 62745 d = c; 62746 c = b; 62747 b = a; 62748 a = t1 + t2 | 0; 62749 } 62750 h0 = h0 + a | 0; 62751 h1 = h1 + b | 0; 62752 h2 = h2 + c | 0; 62753 h3 = h3 + d | 0; 62754 h4 = h4 + e | 0; 62755 h5 = h5 + f | 0; 62756 h6 = h6 + g | 0; 62757 h7 = h7 + h | 0; 62758 } 62759 return new Uint8Array([h0 >> 24 & 0xFF, h0 >> 16 & 0xFF, h0 >> 8 & 0xFF, h0 & 0xFF, h1 >> 24 & 0xFF, h1 >> 16 & 0xFF, h1 >> 8 & 0xFF, h1 & 0xFF, h2 >> 24 & 0xFF, h2 >> 16 & 0xFF, h2 >> 8 & 0xFF, h2 & 0xFF, h3 >> 24 & 0xFF, h3 >> 16 & 0xFF, h3 >> 8 & 0xFF, h3 & 0xFF, h4 >> 24 & 0xFF, h4 >> 16 & 0xFF, h4 >> 8 & 0xFF, h4 & 0xFF, h5 >> 24 & 0xFF, h5 >> 16 & 0xFF, h5 >> 8 & 0xFF, h5 & 0xFF, h6 >> 24 & 0xFF, h6 >> 16 & 0xFF, h6 >> 8 & 0xFF, h6 & 0xFF, h7 >> 24 & 0xFF, h7 >> 16 & 0xFF, h7 >> 8 & 0xFF, h7 & 0xFF]); 62760} 62761 62762;// ./src/core/decrypt_stream.js 62763 62764const chunkSize = 512; 62765class DecryptStream extends DecodeStream { 62766 constructor(str, maybeLength, decrypt) { 62767 super(maybeLength); 62768 this.stream = str; 62769 this.dict = str.dict; 62770 this.decrypt = decrypt; 62771 this.nextChunk = null; 62772 this.initialized = false; 62773 } 62774 readBlock() {
vendor: 716 bytes, lines 62775-62811
62775 let chunk; 62776 if (this.initialized) { 62777 chunk = this.nextChunk; 62778 } else { 62779 chunk = this.stream.getBytes(chunkSize); 62780 this.initialized = true; 62781 } 62782 if (!chunk?.length) { 62783 this.eof = true; 62784 return; 62785 } 62786 this.nextChunk = this.stream.getBytes(chunkSize); 62787 const hasMoreData = this.nextChunk?.length > 0; 62788 const decrypt = this.decrypt; 62789 chunk = decrypt(chunk, !hasMoreData); 62790 const bufferLength = this.bufferLength, 62791 newLength = bufferLength + chunk.length, 62792 buffer = this.ensureBuffer(newLength); 62793 buffer.set(chunk, bufferLength); 62794 this.bufferLength = newLength; 62795 } 62796 getOriginalStream() { 62797 return this; 62798 } 62799} 62800 62801;// ./src/core/crypto.js 62802 62803 62804 62805 62806 62807 62808 62809 62810 62811
vendor: 5,194 bytes, lines 62812-62874
62812 62813 62814 62815 62816 62817 62818 62819 62820class ARCFourCipher { 62821 a = 0; 62822 b = 0; 62823 constructor(key) { 62824 const s = new Uint8Array(256); 62825 const keyLength = key.length; 62826 for (let i = 0; i < 256; ++i) { 62827 s[i] = i; 62828 } 62829 for (let i = 0, j = 0; i < 256; ++i) { 62830 const tmp = s[i]; 62831 j = j + tmp + key[i % keyLength] & 0xff; 62832 s[i] = s[j]; 62833 s[j] = tmp; 62834 } 62835 this.s = s; 62836 } 62837 encryptBlock(data) { 62838 let a = this.a, 62839 b = this.b; 62840 const s = this.s; 62841 const n = data.length; 62842 const output = new Uint8Array(n); 62843 for (let i = 0; i < n; ++i) { 62844 a = a + 1 & 0xff; 62845 const tmp = s[a]; 62846 b = b + tmp & 0xff; 62847 const tmp2 = s[b]; 62848 s[a] = tmp2; 62849 s[b] = tmp; 62850 output[i] = data[i] ^ s[tmp + tmp2 & 0xff]; 62851 } 62852 this.a = a; 62853 this.b = b; 62854 return output; 62855 } 62856 decryptBlock(data) { 62857 return this.encryptBlock(data); 62858 } 62859 encrypt(data) { 62860 return this.encryptBlock(data); 62861 } 62862} 62863class NullCipher { 62864 decryptBlock(data) { 62865 return data; 62866 } 62867 encrypt(data) { 62868 return data; 62869 } 62870} 62871class AESBaseCipher { 62872 _s = new Uint8Array([0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16]); 62873 _inv_s = new Uint8Array([0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d]); 62874 _mix = new Uint32Array([0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a
vendor: 4,150 bytes, lines 62874-62950
62874750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3]); 62875 _mixCol = new Uint8Array(256).map((_, i) => i < 128 ? i << 1 : i << 1 ^ 0x1b); 62876 constructor() { 62877 this.buffer = new Uint8Array(16); 62878 this.bufferPosition = 0; 62879 } 62880 _expandKey(cipherKey) { 62881 unreachable("Cannot call `_expandKey` on the base class"); 62882 } 62883 _decrypt(input, key) { 62884 let t, u, v; 62885 const state = new Uint8Array(16); 62886 state.set(input); 62887 for (let j = 0, k = this._keySize; j < 16; ++j, ++k) { 62888 state[j] ^= key[k]; 62889 } 62890 for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) { 62891 t = state[13]; 62892 state[13] = state[9]; 62893 state[9] = state[5]; 62894 state[5] = state[1]; 62895 state[1] = t; 62896 t = state[14]; 62897 u = state[10]; 62898 state[14] = state[6]; 62899 state[10] = state[2]; 62900 state[6] = t; 62901 state[2] = u; 62902 t = state[15]; 62903 u = state[11]; 62904 v = state[7]; 62905 state[15] = state[3]; 62906 state[11] = t; 62907 state[7] = u; 62908 state[3] = v; 62909 for (let j = 0; j < 16; ++j) { 62910 state[j] = this._inv_s[state[j]]; 62911 } 62912 for (let j = 0, k = i * 16; j < 16; ++j, ++k) { 62913 state[j] ^= key[k]; 62914 } 62915 for (let j = 0; j < 16; j += 4) { 62916 const s0 = this._mix[state[j]]; 62917 const s1 = this._mix[state[j + 1]]; 62918 const s2 = this._mix[state[j + 2]]; 62919 const s3 = this._mix[state[j + 3]]; 62920 t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8; 62921 state[j] = t >>> 24 & 0xff; 62922 state[j + 1] = t >> 16 & 0xff; 62923 state[j + 2] = t >> 8 & 0xff; 62924 state[j + 3] = t & 0xff; 62925 } 62926 } 62927 t = state[13]; 62928 state[13] = state[9]; 62929 state[9] = state[5]; 62930 state[5] = state[1]; 62931 state[1] = t; 62932 t = state[14]; 62933 u = state[10]; 62934 state[14] = state[6]; 62935 state[10] = state[2]; 62936 state[6] = t; 62937 state[2] = u; 62938 t = state[15]; 62939 u = state[11]; 62940 v = state[7]; 62941 state[15] = state[3]; 62942 state[11] = t; 62943 state[7] = u; 62944 state[3] = v; 62945 for (let j = 0; j < 16; ++j) { 62946 state[j] = this._inv_s[state[j]]; 62947 state[j] ^= key[j]; 62948 } 62949 return state; 62950 }
vendor: 8,061 bytes, lines 62951-63196
62951 _encrypt(input, key) { 62952 const s = this._s; 62953 let t, u, v; 62954 const state = new Uint8Array(16); 62955 state.set(input); 62956 for (let j = 0; j < 16; ++j) { 62957 state[j] ^= key[j]; 62958 } 62959 for (let i = 1; i < this._cyclesOfRepetition; i++) { 62960 for (let j = 0; j < 16; ++j) { 62961 state[j] = s[state[j]]; 62962 } 62963 v = state[1]; 62964 state[1] = state[5]; 62965 state[5] = state[9]; 62966 state[9] = state[13]; 62967 state[13] = v; 62968 v = state[2]; 62969 u = state[6]; 62970 state[2] = state[10]; 62971 state[6] = state[14]; 62972 state[10] = v; 62973 state[14] = u; 62974 v = state[3]; 62975 u = state[7]; 62976 t = state[11]; 62977 state[3] = state[15]; 62978 state[7] = v; 62979 state[11] = u; 62980 state[15] = t; 62981 for (let j = 0; j < 16; j += 4) { 62982 const s0 = state[j]; 62983 const s1 = state[j + 1]; 62984 const s2 = state[j + 2]; 62985 const s3 = state[j + 3]; 62986 t = s0 ^ s1 ^ s2 ^ s3; 62987 state[j] ^= t ^ this._mixCol[s0 ^ s1]; 62988 state[j + 1] ^= t ^ this._mixCol[s1 ^ s2]; 62989 state[j + 2] ^= t ^ this._mixCol[s2 ^ s3]; 62990 state[j + 3] ^= t ^ this._mixCol[s3 ^ s0]; 62991 } 62992 for (let j = 0, k = i * 16; j < 16; ++j, ++k) { 62993 state[j] ^= key[k]; 62994 } 62995 } 62996 for (let j = 0; j < 16; ++j) { 62997 state[j] = s[state[j]]; 62998 } 62999 v = state[1]; 63000 state[1] = state[5]; 63001 state[5] = state[9]; 63002 state[9] = state[13]; 63003 state[13] = v; 63004 v = state[2]; 63005 u = state[6]; 63006 state[2] = state[10]; 63007 state[6] = state[14]; 63008 state[10] = v; 63009 state[14] = u; 63010 v = state[3]; 63011 u = state[7]; 63012 t = state[11]; 63013 state[3] = state[15]; 63014 state[7] = v; 63015 state[11] = u; 63016 state[15] = t; 63017 for (let j = 0, k = this._keySize; j < 16; ++j, ++k) { 63018 state[j] ^= key[k]; 63019 } 63020 return state; 63021 } 63022 _decryptBlock2(data, finalize) { 63023 const sourceLength = data.length; 63024 let buffer = this.buffer, 63025 bufferLength = this.bufferPosition; 63026 const result = []; 63027 let iv = this.iv; 63028 for (let i = 0; i < sourceLength; ++i) { 63029 buffer[bufferLength] = data[i]; 63030 ++bufferLength; 63031 if (bufferLength < 16) { 63032 continue; 63033 } 63034 const plain = this._decrypt(buffer, this._key); 63035 for (let j = 0; j < 16; ++j) { 63036 plain[j] ^= iv[j]; 63037 } 63038 iv = buffer; 63039 result.push(plain); 63040 buffer = new Uint8Array(16); 63041 bufferLength = 0; 63042 } 63043 this.buffer = buffer; 63044 this.bufferLength = bufferLength; 63045 this.iv = iv; 63046 if (result.length === 0) { 63047 return new Uint8Array(0); 63048 } 63049 let outputLength = 16 * result.length; 63050 if (finalize) { 63051 const lastBlock = result.at(-1); 63052 let psLen = lastBlock[15]; 63053 if (psLen <= 16) { 63054 for (let i = 15, ii = 16 - psLen; i >= ii; --i) { 63055 if (lastBlock[i] !== psLen) { 63056 psLen = 0; 63057 break; 63058 } 63059 } 63060 outputLength -= psLen; 63061 result[result.length - 1] = lastBlock.subarray(0, 16 - psLen); 63062 } 63063 } 63064 const output = new Uint8Array(outputLength); 63065 for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) { 63066 output.set(result[i], j); 63067 } 63068 return output; 63069 } 63070 decryptBlock(data, finalize, iv = null) { 63071 const sourceLength = data.length; 63072 const buffer = this.buffer; 63073 let bufferLength = this.bufferPosition; 63074 if (iv) { 63075 this.iv = iv; 63076 } else { 63077 for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) { 63078 buffer[bufferLength] = data[i]; 63079 } 63080 if (bufferLength < 16) { 63081 this.bufferLength = bufferLength; 63082 return new Uint8Array(0); 63083 } 63084 this.iv = buffer; 63085 data = data.subarray(16); 63086 } 63087 this.buffer = new Uint8Array(16); 63088 this.bufferLength = 0; 63089 this.decryptBlock = this._decryptBlock2; 63090 return this.decryptBlock(data, finalize); 63091 } 63092 encrypt(data, iv) { 63093 const sourceLength = data.length; 63094 let buffer = this.buffer, 63095 bufferLength = this.bufferPosition; 63096 const result = []; 63097 iv ||= new Uint8Array(16); 63098 for (let i = 0; i < sourceLength; ++i) { 63099 buffer[bufferLength] = data[i]; 63100 ++bufferLength; 63101 if (bufferLength < 16) { 63102 continue; 63103 } 63104 for (let j = 0; j < 16; ++j) { 63105 buffer[j] ^= iv[j]; 63106 } 63107 const cipher = this._encrypt(buffer, this._key); 63108 iv = cipher; 63109 result.push(cipher); 63110 buffer = new Uint8Array(16); 63111 bufferLength = 0; 63112 } 63113 this.buffer = buffer; 63114 this.bufferLength = bufferLength; 63115 this.iv = iv; 63116 if (result.length === 0) { 63117 return new Uint8Array(0); 63118 } 63119 const outputLength = 16 * result.length; 63120 const output = new Uint8Array(outputLength); 63121 for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) { 63122 output.set(result[i], j); 63123 } 63124 return output; 63125 } 63126} 63127class AES128Cipher extends AESBaseCipher { 63128 _rcon = new Uint8Array([0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d]); 63129 constructor(key) { 63130 super(); 63131 this._cyclesOfRepetition = 10; 63132 this._keySize = 160; 63133 this._key = this._expandKey(key); 63134 } 63135 _expandKey(cipherKey) { 63136 const b = 176; 63137 const s = this._s; 63138 const rcon = this._rcon; 63139 const result = new Uint8Array(b); 63140 result.set(cipherKey); 63141 for (let j = 16, i = 1; j < b; ++i) { 63142 let t1 = result[j - 3]; 63143 let t2 = result[j - 2]; 63144 let t3 = result[j - 1]; 63145 let t4 = result[j - 4]; 63146 t1 = s[t1]; 63147 t2 = s[t2]; 63148 t3 = s[t3]; 63149 t4 = s[t4]; 63150 t1 ^= rcon[i]; 63151 for (let n = 0; n < 4; ++n) { 63152 result[j] = t1 ^= result[j - 16]; 63153 j++; 63154 result[j] = t2 ^= result[j - 16]; 63155 j++; 63156 result[j] = t3 ^= result[j - 16]; 63157 j++; 63158 result[j] = t4 ^= result[j - 16]; 63159 j++; 63160 } 63161 } 63162 return result; 63163 } 63164} 63165class AES256Cipher extends AESBaseCipher { 63166 constructor(key) { 63167 super(); 63168 this._cyclesOfRepetition = 14; 63169 this._keySize = 224; 63170 this._key = this._expandKey(key); 63171 } 63172 _expandKey(cipherKey) { 63173 const b = 240; 63174 const s = this._s; 63175 const result = new Uint8Array(b); 63176 result.set(cipherKey); 63177 let r = 1; 63178 let t1, t2, t3, t4; 63179 for (let j = 32, i = 1; j < b; ++i) { 63180 if (j % 32 === 16) { 63181 t1 = s[t1]; 63182 t2 = s[t2]; 63183 t3 = s[t3]; 63184 t4 = s[t4]; 63185 } else if (j % 32 === 0) { 63186 t1 = result[j - 3]; 63187 t2 = result[j - 2]; 63188 t3 = result[j - 1]; 63189 t4 = result[j - 4]; 63190 t1 = s[t1]; 63191 t2 = s[t2]; 63192 t3 = s[t3]; 63193 t4 = s[t4]; 63194 t1 ^= r; 63195 if ((r <<= 1) >= 256) { 63196 r = (r ^ 0x1b) & 0xff;
vendor: 30,244 bytes, lines 63197-64096
63197 } 63198 } 63199 for (let n = 0; n < 4; ++n) { 63200 result[j] = t1 ^= result[j - 32]; 63201 j++; 63202 result[j] = t2 ^= result[j - 32]; 63203 j++; 63204 result[j] = t3 ^= result[j - 32]; 63205 j++; 63206 result[j] = t4 ^= result[j - 32]; 63207 j++; 63208 } 63209 } 63210 return result; 63211 } 63212} 63213class PDFBase { 63214 _hash(password, input, userBytes) { 63215 unreachable("Abstract method `_hash` called"); 63216 } 63217 checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) { 63218 const hashData = new Uint8Array(password.length + 56); 63219 hashData.set(password, 0); 63220 hashData.set(ownerValidationSalt, password.length); 63221 hashData.set(userBytes, password.length + ownerValidationSalt.length); 63222 const result = this._hash(password, hashData, userBytes); 63223 return isArrayEqual(result, ownerPassword); 63224 } 63225 checkUserPassword(password, userValidationSalt, userPassword) { 63226 const hashData = new Uint8Array(password.length + 8); 63227 hashData.set(password, 0); 63228 hashData.set(userValidationSalt, password.length); 63229 const result = this._hash(password, hashData, []); 63230 return isArrayEqual(result, userPassword); 63231 } 63232 getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) { 63233 const hashData = new Uint8Array(password.length + 56); 63234 hashData.set(password, 0); 63235 hashData.set(ownerKeySalt, password.length); 63236 hashData.set(userBytes, password.length + ownerKeySalt.length); 63237 const key = this._hash(password, hashData, userBytes); 63238 const cipher = new AES256Cipher(key); 63239 return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16)); 63240 } 63241 getUserKey(password, userKeySalt, userEncryption) { 63242 const hashData = new Uint8Array(password.length + 8); 63243 hashData.set(password, 0); 63244 hashData.set(userKeySalt, password.length); 63245 const key = this._hash(password, hashData, []); 63246 const cipher = new AES256Cipher(key); 63247 return cipher.decryptBlock(userEncryption, false, new Uint8Array(16)); 63248 } 63249} 63250class PDF17 extends PDFBase { 63251 _hash(password, input, userBytes) { 63252 return calculateSHA256(input, 0, input.length); 63253 } 63254} 63255class PDF20 extends PDFBase { 63256 _hash(password, input, userBytes) { 63257 let k = calculateSHA256(input, 0, input.length).subarray(0, 32); 63258 let e = [0]; 63259 let i = 0; 63260 while (i < 64 || e.at(-1) > i - 32) { 63261 const combinedLength = password.length + k.length + userBytes.length, 63262 combinedArray = new Uint8Array(combinedLength); 63263 let writeOffset = 0; 63264 combinedArray.set(password, writeOffset); 63265 writeOffset += password.length; 63266 combinedArray.set(k, writeOffset); 63267 writeOffset += k.length; 63268 combinedArray.set(userBytes, writeOffset); 63269 const k1 = new Uint8Array(combinedLength * 64); 63270 for (let j = 0, pos = 0; j < 64; j++, pos += combinedLength) { 63271 k1.set(combinedArray, pos); 63272 } 63273 const cipher = new AES128Cipher(k.subarray(0, 16)); 63274 e = cipher.encrypt(k1, k.subarray(16, 32)); 63275 const remainder = Math.sumPrecise(e.slice(0, 16)) % 3; 63276 if (remainder === 0) { 63277 k = calculateSHA256(e, 0, e.length); 63278 } else if (remainder === 1) { 63279 k = calculateSHA384(e, 0, e.length); 63280 } else if (remainder === 2) { 63281 k = calculateSHA512(e, 0, e.length); 63282 } 63283 i++; 63284 } 63285 return k.subarray(0, 32); 63286 } 63287} 63288class CipherTransform { 63289 constructor(stringCipherConstructor, streamCipherConstructor) { 63290 this.StringCipherConstructor = stringCipherConstructor; 63291 this.StreamCipherConstructor = streamCipherConstructor; 63292 } 63293 createStream(stream, length) { 63294 const cipher = new this.StreamCipherConstructor(); 63295 return new DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) { 63296 return cipher.decryptBlock(data, finalize); 63297 }); 63298 } 63299 decryptString(s) { 63300 const cipher = new this.StringCipherConstructor(); 63301 let data = stringToBytes(s); 63302 data = cipher.decryptBlock(data, true); 63303 return bytesToString(data); 63304 } 63305 encryptString(s) { 63306 const cipher = new this.StringCipherConstructor(); 63307 if (cipher instanceof AESBaseCipher) { 63308 const strLen = s.length; 63309 const pad = 16 - strLen % 16; 63310 s += String.fromCharCode(pad).repeat(pad); 63311 const iv = new Uint8Array(16); 63312 crypto.getRandomValues(iv); 63313 let data = stringToBytes(s); 63314 data = cipher.encrypt(data, iv); 63315 const buf = new Uint8Array(16 + data.length); 63316 buf.set(iv); 63317 buf.set(data, 16); 63318 return bytesToString(buf); 63319 } 63320 let data = stringToBytes(s); 63321 data = cipher.encrypt(data); 63322 return bytesToString(data); 63323 } 63324} 63325class CipherTransformFactory { 63326 static get _defaultPasswordBytes() { 63327 return shadow(this, "_defaultPasswordBytes", new Uint8Array([0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41, 0x64, 0x00, 0x4e, 0x56, 0xff, 0xfa, 0x01, 0x08, 0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68, 0x3e, 0x80, 0x2f, 0x0c, 0xa9, 0xfe, 0x64, 0x53, 0x69, 0x7a])); 63328 } 63329 #createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) { 63330 if (password) { 63331 const passwordLength = Math.min(127, password.length); 63332 password = password.subarray(0, passwordLength); 63333 } else { 63334 password = []; 63335 } 63336 const pdfAlgorithm = revision === 6 ? new PDF20() : new PDF17(); 63337 if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) { 63338 return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption); 63339 } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) { 63340 return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption); 63341 } 63342 return null; 63343 } 63344 #prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) { 63345 const hashDataSize = 40 + ownerPassword.length + fileId.length; 63346 const hashData = new Uint8Array(hashDataSize); 63347 let i = 0, 63348 j, 63349 n; 63350 if (password) { 63351 n = Math.min(32, password.length); 63352 for (; i < n; ++i) { 63353 hashData[i] = password[i]; 63354 } 63355 } 63356 j = 0; 63357 while (i < 32) { 63358 hashData[i++] = CipherTransformFactory._defaultPasswordBytes[j++]; 63359 } 63360 hashData.set(ownerPassword, i); 63361 i += ownerPassword.length; 63362 hashData[i++] = flags & 0xff; 63363 hashData[i++] = flags >> 8 & 0xff; 63364 hashData[i++] = flags >> 16 & 0xff; 63365 hashData[i++] = flags >>> 24 & 0xff; 63366 hashData.set(fileId, i); 63367 i += fileId.length; 63368 if (revision >= 4 && !encryptMetadata) { 63369 hashData.fill(0xff, i, i + 4); 63370 i += 4; 63371 } 63372 let hash = calculateMD5(hashData, 0, i); 63373 const keyLengthInBytes = keyLength >> 3; 63374 if (revision >= 3) { 63375 for (j = 0; j < 50; ++j) { 63376 hash = calculateMD5(hash, 0, keyLengthInBytes); 63377 } 63378 } 63379 const encryptionKey = hash.subarray(0, keyLengthInBytes); 63380 let cipher, checkData; 63381 if (revision >= 3) { 63382 i = 0; 63383 hashData.set(CipherTransformFactory._defaultPasswordBytes, i); 63384 i += 32; 63385 hashData.set(fileId, i); 63386 i += fileId.length; 63387 cipher = new ARCFourCipher(encryptionKey); 63388 checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i)); 63389 n = encryptionKey.length; 63390 const derivedKey = new Uint8Array(n); 63391 for (j = 1; j <= 19; ++j) { 63392 for (let k = 0; k < n; ++k) { 63393 derivedKey[k] = encryptionKey[k] ^ j; 63394 } 63395 cipher = new ARCFourCipher(derivedKey); 63396 checkData = cipher.encryptBlock(checkData); 63397 } 63398 } else { 63399 cipher = new ARCFourCipher(encryptionKey); 63400 checkData = cipher.encryptBlock(CipherTransformFactory._defaultPasswordBytes); 63401 } 63402 return checkData.every((data, k) => userPassword[k] === data) ? encryptionKey : null; 63403 } 63404 #decodeUserPassword(password, ownerPassword, revision, keyLength) { 63405 const hashData = new Uint8Array(32); 63406 let i = 0; 63407 const n = Math.min(32, password.length); 63408 for (; i < n; ++i) { 63409 hashData[i] = password[i]; 63410 } 63411 let j = 0; 63412 while (i < 32) { 63413 hashData[i++] = CipherTransformFactory._defaultPasswordBytes[j++]; 63414 } 63415 let hash = calculateMD5(hashData, 0, i); 63416 const keyLengthInBytes = keyLength >> 3; 63417 if (revision >= 3) { 63418 for (j = 0; j < 50; ++j) { 63419 hash = calculateMD5(hash, 0, hash.length); 63420 } 63421 } 63422 let cipher, userPassword; 63423 if (revision >= 3) { 63424 userPassword = ownerPassword; 63425 const derivedKey = new Uint8Array(keyLengthInBytes); 63426 for (j = 19; j >= 0; j--) { 63427 for (let k = 0; k < keyLengthInBytes; ++k) { 63428 derivedKey[k] = hash[k] ^ j; 63429 } 63430 cipher = new ARCFourCipher(derivedKey); 63431 userPassword = cipher.encryptBlock(userPassword); 63432 } 63433 } else { 63434 cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes)); 63435 userPassword = cipher.encryptBlock(ownerPassword); 63436 } 63437 return userPassword; 63438 } 63439 #buildObjectKey(num, gen, encryptionKey, isAes = false) { 63440 const n = encryptionKey.length; 63441 const key = new Uint8Array(n + 9); 63442 key.set(encryptionKey); 63443 let i = n; 63444 key[i++] = num & 0xff; 63445 key[i++] = num >> 8 & 0xff; 63446 key[i++] = num >> 16 & 0xff; 63447 key[i++] = gen & 0xff; 63448 key[i++] = gen >> 8 & 0xff; 63449 if (isAes) { 63450 key[i++] = 0x73; 63451 key[i++] = 0x41; 63452 key[i++] = 0x6c; 63453 key[i++] = 0x54; 63454 } 63455 const hash = calculateMD5(key, 0, i); 63456 return hash.subarray(0, Math.min(n + 5, 16)); 63457 } 63458 #buildCipherConstructor(cf, name, num, gen, key) { 63459 if (!(name instanceof Name)) { 63460 throw new FormatError("Invalid crypt filter name."); 63461 } 63462 const self = this; 63463 const cryptFilter = cf.get(name.name); 63464 const cfm = cryptFilter?.get("CFM"); 63465 if (!cfm || cfm.name === "None") { 63466 return function () { 63467 return new NullCipher(); 63468 }; 63469 } 63470 if (cfm.name === "V2") { 63471 return function () { 63472 return new ARCFourCipher(self.#buildObjectKey(num, gen, key, false)); 63473 }; 63474 } 63475 if (cfm.name === "AESV2") { 63476 return function () { 63477 return new AES128Cipher(self.#buildObjectKey(num, gen, key, true)); 63478 }; 63479 } 63480 if (cfm.name === "AESV3") { 63481 return function () { 63482 return new AES256Cipher(key); 63483 }; 63484 } 63485 throw new FormatError("Unknown crypto method"); 63486 } 63487 constructor(dict, fileId, password) { 63488 const filter = dict.get("Filter"); 63489 if (!isName(filter, "Standard")) { 63490 throw new FormatError("unknown encryption method"); 63491 } 63492 this.filterName = filter.name; 63493 this.dict = dict; 63494 const algorithm = dict.get("V"); 63495 if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) { 63496 throw new FormatError("unsupported encryption algorithm"); 63497 } 63498 this.algorithm = algorithm; 63499 let keyLength = dict.get("Length"); 63500 if (!keyLength) { 63501 if (algorithm <= 3) { 63502 keyLength = 40; 63503 } else { 63504 const cfDict = dict.get("CF"); 63505 const streamCryptoName = dict.get("StmF"); 63506 if (cfDict instanceof Dict && streamCryptoName instanceof Name) { 63507 cfDict.suppressEncryption = true; 63508 const handlerDict = cfDict.get(streamCryptoName.name); 63509 keyLength = handlerDict?.get("Length") || 128; 63510 if (keyLength < 40) { 63511 keyLength <<= 3; 63512 } 63513 } 63514 } 63515 } 63516 if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) { 63517 throw new FormatError("invalid key length"); 63518 } 63519 const ownerBytes = stringToBytes(dict.get("O")), 63520 userBytes = stringToBytes(dict.get("U")); 63521 const ownerPassword = ownerBytes.subarray(0, 32); 63522 const userPassword = userBytes.subarray(0, 32); 63523 const flags = dict.get("P"); 63524 const revision = dict.get("R"); 63525 const encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false; 63526 this.encryptMetadata = encryptMetadata; 63527 const fileIdBytes = stringToBytes(fileId); 63528 let passwordBytes; 63529 if (password) { 63530 if (revision === 6) { 63531 try { 63532 password = utf8StringToString(password); 63533 } catch { 63534 warn("CipherTransformFactory: Unable to convert UTF8 encoded password."); 63535 } 63536 } 63537 passwordBytes = stringToBytes(password); 63538 } 63539 let encryptionKey; 63540 if (algorithm !== 5) { 63541 encryptionKey = this.#prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata); 63542 } else { 63543 const ownerValidationSalt = ownerBytes.subarray(32, 40); 63544 const ownerKeySalt = ownerBytes.subarray(40, 48); 63545 const uBytes = userBytes.subarray(0, 48); 63546 const userValidationSalt = userBytes.subarray(32, 40); 63547 const userKeySalt = userBytes.subarray(40, 48); 63548 const ownerEncryption = stringToBytes(dict.get("OE")); 63549 const userEncryption = stringToBytes(dict.get("UE")); 63550 const perms = stringToBytes(dict.get("Perms")); 63551 encryptionKey = this.#createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms); 63552 } 63553 if (!encryptionKey) { 63554 if (!password) { 63555 throw new PasswordException("No password given", PasswordResponses.NEED_PASSWORD); 63556 } 63557 const decodedPassword = this.#decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength); 63558 encryptionKey = this.#prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata); 63559 } 63560 if (!encryptionKey) { 63561 throw new PasswordException("Incorrect Password", PasswordResponses.INCORRECT_PASSWORD); 63562 } 63563 if (algorithm === 4 && encryptionKey.length < 16) { 63564 this.encryptionKey = new Uint8Array(16); 63565 this.encryptionKey.set(encryptionKey); 63566 } else { 63567 this.encryptionKey = encryptionKey; 63568 } 63569 if (algorithm >= 4) { 63570 const cf = dict.get("CF"); 63571 if (cf instanceof Dict) { 63572 cf.suppressEncryption = true; 63573 } 63574 this.cf = cf; 63575 this.stmf = dict.get("StmF") || Name.get("Identity"); 63576 this.strf = dict.get("StrF") || Name.get("Identity"); 63577 this.eff = dict.get("EFF") || this.stmf; 63578 } 63579 } 63580 createCipherTransform(num, gen) { 63581 if (this.algorithm === 4 || this.algorithm === 5) { 63582 return new CipherTransform(this.#buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey), this.#buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey)); 63583 } 63584 const key = this.#buildObjectKey(num, gen, this.encryptionKey, false); 63585 const cipherConstructor = function () { 63586 return new ARCFourCipher(key); 63587 }; 63588 return new CipherTransform(cipherConstructor, cipherConstructor); 63589 } 63590} 63591 63592;// ./src/core/xref.js 63593 63594 63595 63596 63597 63598 63599 63600 63601 63602 63603 63604 63605 63606 63607 63608 63609 63610 63611 63612 63613 63614 63615 63616 63617class XRef { 63618 constructor(stream, pdfManager) { 63619 this.stream = stream; 63620 this.pdfManager = pdfManager; 63621 this.entries = []; 63622 this._xrefStms = new Set(); 63623 this._cacheMap = new Map(); 63624 this._pendingRefs = new RefSet(); 63625 this._newPersistentRefNum = null; 63626 this._newTemporaryRefNum = null; 63627 this._persistentRefsCache = null; 63628 } 63629 getNewPersistentRef(obj) { 63630 if (this._newPersistentRefNum === null) { 63631 this._newPersistentRefNum = this.entries.length || 1; 63632 } 63633 const num = this._newPersistentRefNum++; 63634 this._cacheMap.set(num, obj); 63635 return Ref.get(num, 0); 63636 } 63637 getNewTemporaryRef() { 63638 if (this._newTemporaryRefNum === null) { 63639 this._newTemporaryRefNum = this.entries.length || 1; 63640 if (this._newPersistentRefNum) { 63641 this._persistentRefsCache = new Map(); 63642 for (let i = this._newTemporaryRefNum; i < this._newPersistentRefNum; i++) { 63643 this._persistentRefsCache.set(i, this._cacheMap.get(i)); 63644 this._cacheMap.delete(i); 63645 } 63646 } 63647 } 63648 return Ref.get(this._newTemporaryRefNum++, 0); 63649 } 63650 resetNewTemporaryRef() { 63651 this._newTemporaryRefNum = null; 63652 if (this._persistentRefsCache) { 63653 for (const [num, obj] of this._persistentRefsCache) { 63654 this._cacheMap.set(num, obj); 63655 } 63656 } 63657 this._persistentRefsCache = null; 63658 } 63659 setStartXRef(startXRef) { 63660 this.startXRefQueue = [startXRef]; 63661 } 63662 parse(recoveryMode = false) { 63663 let trailerDict; 63664 if (!recoveryMode) { 63665 trailerDict = this.readXRef(); 63666 } else { 63667 warn("Indexing all PDF objects"); 63668 trailerDict = this.indexObjects(); 63669 } 63670 trailerDict.assignXref(this); 63671 this.trailer = trailerDict; 63672 let encrypt; 63673 try { 63674 encrypt = trailerDict.get("Encrypt"); 63675 } catch (ex) { 63676 if (ex instanceof MissingDataException) { 63677 throw ex; 63678 } 63679 warn(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`); 63680 } 63681 if (encrypt instanceof Dict) { 63682 const ids = trailerDict.get("ID"); 63683 const fileId = ids?.length ? ids[0] : ""; 63684 encrypt.suppressEncryption = true; 63685 this.encrypt = new CipherTransformFactory(encrypt, fileId, this.pdfManager.password); 63686 } 63687 let root; 63688 try { 63689 root = trailerDict.get("Root"); 63690 } catch (ex) { 63691 if (ex instanceof MissingDataException) { 63692 throw ex; 63693 } 63694 warn(`XRef.parse - Invalid "Root" reference: "${ex}".`); 63695 } 63696 if (root instanceof Dict) { 63697 try { 63698 const pages = root.get("Pages"); 63699 if (pages instanceof Dict) { 63700 this.root = root; 63701 return; 63702 } 63703 } catch (ex) { 63704 if (ex instanceof MissingDataException) { 63705 throw ex; 63706 } 63707 warn(`XRef.parse - Invalid "Pages" reference: "${ex}".`); 63708 } 63709 } 63710 if (!recoveryMode) { 63711 throw new XRefParseException(); 63712 } 63713 throw new InvalidPDFException("Invalid Root reference."); 63714 } 63715 processXRefTable(parser) { 63716 if (!("tableState" in this)) { 63717 this.tableState = { 63718 entryNum: 0, 63719 streamPos: parser.lexer.stream.pos, 63720 parserBuf1: parser.buf1, 63721 parserBuf2: parser.buf2 63722 }; 63723 } 63724 const obj = this.readXRefTable(parser); 63725 if (!isCmd(obj, "trailer")) { 63726 throw new FormatError("Invalid XRef table: could not find trailer dictionary"); 63727 } 63728 let dict = parser.getObj(); 63729 if (!(dict instanceof Dict) && dict.dict) { 63730 dict = dict.dict; 63731 } 63732 if (!(dict instanceof Dict)) { 63733 throw new FormatError("Invalid XRef table: could not parse trailer dictionary"); 63734 } 63735 delete this.tableState; 63736 return dict; 63737 } 63738 readXRefTable(parser) { 63739 const stream = parser.lexer.stream; 63740 const tableState = this.tableState; 63741 stream.pos = tableState.streamPos; 63742 parser.buf1 = tableState.parserBuf1; 63743 parser.buf2 = tableState.parserBuf2; 63744 let obj; 63745 while (true) { 63746 if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) { 63747 if (isCmd(obj = parser.getObj(), "trailer")) { 63748 break; 63749 } 63750 tableState.firstEntryNum = obj; 63751 tableState.entryCount = parser.getObj(); 63752 } 63753 let first = tableState.firstEntryNum; 63754 const count = tableState.entryCount; 63755 if (!Number.isInteger(first) || !Number.isInteger(count)) { 63756 throw new FormatError("Invalid XRef table: wrong types in subsection header"); 63757 } 63758 for (let i = tableState.entryNum; i < count; i++) { 63759 tableState.streamPos = stream.pos; 63760 tableState.entryNum = i; 63761 tableState.parserBuf1 = parser.buf1; 63762 tableState.parserBuf2 = parser.buf2; 63763 const entry = {}; 63764 entry.offset = parser.getObj(); 63765 entry.gen = parser.getObj(); 63766 const type = parser.getObj(); 63767 if (type instanceof Cmd) { 63768 switch (type.cmd) { 63769 case "f": 63770 entry.free = true; 63771 break; 63772 case "n": 63773 entry.uncompressed = true; 63774 break; 63775 } 63776 } 63777 if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) { 63778 throw new FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`); 63779 } 63780 if (i === 0 && entry.free && first === 1) { 63781 first = 0; 63782 } 63783 if (!this.entries[i + first]) { 63784 this.entries[i + first] = entry; 63785 } 63786 } 63787 tableState.entryNum = 0; 63788 tableState.streamPos = stream.pos; 63789 tableState.parserBuf1 = parser.buf1; 63790 tableState.parserBuf2 = parser.buf2; 63791 delete tableState.firstEntryNum; 63792 delete tableState.entryCount; 63793 } 63794 if (this.entries[0] && !this.entries[0].free) { 63795 throw new FormatError("Invalid XRef table: unexpected first object"); 63796 } 63797 return obj; 63798 } 63799 processXRefStream(stream) { 63800 if (!("streamState" in this)) { 63801 const { 63802 dict, 63803 pos 63804 } = stream; 63805 const byteWidths = dict.get("W"); 63806 const range = dict.get("Index") || [0, dict.get("Size")]; 63807 this.streamState = { 63808 entryRanges: range, 63809 byteWidths, 63810 entryNum: 0, 63811 streamPos: pos 63812 }; 63813 } 63814 this.readXRefStream(stream); 63815 delete this.streamState; 63816 return stream.dict; 63817 } 63818 readXRefStream(stream) { 63819 const streamState = this.streamState; 63820 stream.pos = streamState.streamPos; 63821 const [typeFieldWidth, offsetFieldWidth, generationFieldWidth] = streamState.byteWidths; 63822 const entryRanges = streamState.entryRanges; 63823 while (entryRanges.length > 0) { 63824 const [first, n] = entryRanges; 63825 if (!Number.isInteger(first) || !Number.isInteger(n)) { 63826 throw new FormatError(`Invalid XRef range fields: ${first}, ${n}`); 63827 } 63828 if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) { 63829 throw new FormatError(`Invalid XRef entry fields length: ${first}, ${n}`); 63830 } 63831 for (let i = streamState.entryNum; i < n; ++i) { 63832 streamState.entryNum = i; 63833 streamState.streamPos = stream.pos; 63834 let type = 0, 63835 offset = 0, 63836 generation = 0; 63837 for (let j = 0; j < typeFieldWidth; ++j) { 63838 const typeByte = stream.getByte(); 63839 if (typeByte === -1) { 63840 throw new FormatError("Invalid XRef byteWidths 'type'."); 63841 } 63842 type = type << 8 | typeByte; 63843 } 63844 if (typeFieldWidth === 0) { 63845 type = 1; 63846 } 63847 for (let j = 0; j < offsetFieldWidth; ++j) { 63848 const offsetByte = stream.getByte(); 63849 if (offsetByte === -1) { 63850 throw new FormatError("Invalid XRef byteWidths 'offset'."); 63851 } 63852 offset = offset << 8 | offsetByte; 63853 } 63854 for (let j = 0; j < generationFieldWidth; ++j) { 63855 const generationByte = stream.getByte(); 63856 if (generationByte === -1) { 63857 throw new FormatError("Invalid XRef byteWidths 'generation'."); 63858 } 63859 generation = generation << 8 | generationByte; 63860 } 63861 const entry = {}; 63862 entry.offset = offset; 63863 entry.gen = generation; 63864 switch (type) { 63865 case 0: 63866 entry.free = true; 63867 break; 63868 case 1: 63869 entry.uncompressed = true; 63870 break; 63871 case 2: 63872 break; 63873 default: 63874 throw new FormatError(`Invalid XRef entry type: ${type}`); 63875 } 63876 if (!this.entries[first + i]) { 63877 this.entries[first + i] = entry; 63878 } 63879 } 63880 streamState.entryNum = 0; 63881 streamState.streamPos = stream.pos; 63882 entryRanges.splice(0, 2); 63883 } 63884 } 63885 indexObjects() { 63886 const TAB = 0x9, 63887 LF = 0xa, 63888 CR = 0xd, 63889 SPACE = 0x20; 63890 const PERCENT = 0x25, 63891 LT = 0x3c; 63892 function readToken(data, offset) { 63893 let token = "", 63894 ch = data[offset]; 63895 while (ch !== LF && ch !== CR && ch !== LT) { 63896 if (++offset >= data.length) { 63897 break; 63898 } 63899 token += String.fromCharCode(ch); 63900 ch = data[offset]; 63901 } 63902 return token; 63903 } 63904 function skipUntil(data, offset, what) { 63905 const length = what.length, 63906 dataLength = data.length; 63907 let skipped = 0; 63908 while (offset < dataLength) { 63909 let i = 0; 63910 while (i < length && data[offset + i] === what[i]) { 63911 ++i; 63912 } 63913 if (i >= length) { 63914 break; 63915 } 63916 offset++; 63917 skipped++; 63918 } 63919 return skipped; 63920 } 63921 const gEndobjRegExp = /\b(endobj|\d+\s+\d+\s+obj|xref|trailer\s*<<)\b/g; 63922 const gStartxrefRegExp = /\b(startxref|\d+\s+\d+\s+obj)\b/g; 63923 const objRegExp = /^(\d+)\s+(\d+)\s+obj\b/; 63924 const trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]); 63925 const startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]); 63926 const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]); 63927 this.entries.length = 0; 63928 this._cacheMap.clear(); 63929 const stream = this.stream; 63930 stream.pos = 0; 63931 const buffer = stream.getBytes(), 63932 bufferStr = bytesToString(buffer), 63933 length = buffer.length; 63934 let position = stream.start; 63935 const trailers = [], 63936 xrefStms = []; 63937 while (position < length) { 63938 let ch = buffer[position]; 63939 if (ch === TAB || ch === LF || ch === CR || ch === SPACE) { 63940 ++position; 63941 continue; 63942 } 63943 if (ch === PERCENT) { 63944 do { 63945 ++position; 63946 if (position >= length) { 63947 break; 63948 } 63949 ch = buffer[position]; 63950 } while (ch !== LF && ch !== CR); 63951 continue; 63952 } 63953 const token = readToken(buffer, position); 63954 let m; 63955 if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) { 63956 position += skipUntil(buffer, position, trailerBytes); 63957 trailers.push(position); 63958 position += skipUntil(buffer, position, startxrefBytes); 63959 } else if (m = objRegExp.exec(token)) { 63960 const num = m[1] | 0, 63961 gen = m[2] | 0; 63962 const startPos = position + token.length; 63963 let contentLength, 63964 updateEntries = false; 63965 if (!this.entries[num]) { 63966 updateEntries = true; 63967 } else if (this.entries[num].gen === gen) { 63968 try { 63969 const parser = new Parser({ 63970 lexer: new Lexer(stream.makeSubStream(startPos)) 63971 }); 63972 parser.getObj(); 63973 updateEntries = true; 63974 } catch (ex) { 63975 if (ex instanceof ParserEOFException) { 63976 warn(`indexObjects -- checking object (${token}): "${ex}".`); 63977 } else { 63978 updateEntries = true; 63979 } 63980 } 63981 } 63982 if (updateEntries) { 63983 this.entries[num] = { 63984 offset: position - stream.start, 63985 gen, 63986 uncompressed: true 63987 }; 63988 } 63989 gEndobjRegExp.lastIndex = startPos; 63990 const match = gEndobjRegExp.exec(bufferStr); 63991 if (match) { 63992 const endPos = gEndobjRegExp.lastIndex + 1; 63993 contentLength = endPos - position; 63994 if (match[1] !== "endobj") { 63995 warn(`indexObjects: Found "${match[1]}" inside of another "obj", ` + 'caused by missing "endobj" -- trying to recover.'); 63996 contentLength -= match[1].length + 1; 63997 } 63998 } else { 63999 contentLength = length - position; 64000 } 64001 const content = buffer.subarray(position, position + contentLength); 64002 const xrefTagOffset = skipUntil(content, 0, xrefBytes); 64003 if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) { 64004 xrefStms.push(position - stream.start); 64005 this._xrefStms.add(position - stream.start); 64006 } 64007 position += contentLength; 64008 } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) { 64009 trailers.push(position); 64010 const startPos = position + token.length; 64011 let contentLength; 64012 gStartxrefRegExp.lastIndex = startPos; 64013 const match = gStartxrefRegExp.exec(bufferStr); 64014 if (match) { 64015 const endPos = gStartxrefRegExp.lastIndex + 1; 64016 contentLength = endPos - position; 64017 if (match[1] !== "startxref") { 64018 warn(`indexObjects: Found "${match[1]}" after "trailer", ` + 'caused by missing "startxref" -- trying to recover.'); 64019 contentLength -= match[1].length + 1; 64020 } 64021 } else { 64022 contentLength = length - position; 64023 } 64024 position += contentLength; 64025 } else { 64026 position += token.length + 1; 64027 } 64028 } 64029 for (const xrefStm of xrefStms) { 64030 this.startXRefQueue.push(xrefStm); 64031 this.readXRef(true); 64032 } 64033 const trailerDicts = []; 64034 let isEncrypted = false; 64035 for (const trailer of trailers) { 64036 stream.pos = trailer; 64037 const parser = new Parser({ 64038 lexer: new Lexer(stream), 64039 xref: this, 64040 allowStreams: true, 64041 recoveryMode: true 64042 }); 64043 const obj = parser.getObj(); 64044 if (!isCmd(obj, "trailer")) { 64045 continue; 64046 } 64047 const dict = parser.getObj(); 64048 if (!(dict instanceof Dict)) { 64049 continue; 64050 } 64051 trailerDicts.push(dict); 64052 if (dict.has("Encrypt")) { 64053 isEncrypted = true; 64054 } 64055 } 64056 let trailerDict, trailerError; 64057 for (const dict of [...trailerDicts, "genFallback", ...trailerDicts]) { 64058 if (dict === "genFallback") { 64059 if (!trailerError) { 64060 break; 64061 } 64062 this._generationFallback = true; 64063 continue; 64064 } 64065 let validPagesDict = false; 64066 try { 64067 const rootDict = dict.get("Root"); 64068 if (!(rootDict instanceof Dict)) { 64069 continue; 64070 } 64071 const pagesDict = rootDict.get("Pages"); 64072 if (!(pagesDict instanceof Dict)) { 64073 continue; 64074 } 64075 const pagesCount = pagesDict.get("Count"); 64076 if (Number.isInteger(pagesCount)) { 64077 validPagesDict = true; 64078 } 64079 } catch (ex) { 64080 trailerError = ex; 64081 continue; 64082 } 64083 if (validPagesDict && (!isEncrypted || dict.has("Encrypt")) && dict.has("ID")) { 64084 return dict; 64085 } 64086 trailerDict = dict; 64087 } 64088 if (trailerDict) { 64089 return trailerDict; 64090 } 64091 if (this.topDict) { 64092 return this.topDict; 64093 } 64094 if (!trailerDicts.length) { 64095 for (const num in this.entries) { 64096
64096const entry = this.entries[num]; 64097 if (!entry) { 64098 continue; 64099 } 64100 const ref = Ref.get(parseInt(num, 10
vendor: 8,229 bytes, lines 64100-64395
64100), entry.gen); 64101 let obj; 64102 try { 64103 obj = this.fetch(ref); 64104 } catch { 64105 continue; 64106 } 64107 if (obj instanceof BaseStream) { 64108 obj = obj.dict; 64109 } 64110 if (obj instanceof Dict && obj.has("Root")) { 64111 return obj; 64112 } 64113 } 64114 } 64115 throw new InvalidPDFException("Invalid PDF structure."); 64116 } 64117 readXRef(recoveryMode = false) { 64118 const stream = this.stream; 64119 const startXRefParsedCache = new Set(); 64120 while (this.startXRefQueue.length) { 64121 try { 64122 const startXRef = this.startXRefQueue[0]; 64123 if (startXRefParsedCache.has(startXRef)) { 64124 warn("readXRef - skipping XRef table since it was already parsed."); 64125 this.startXRefQueue.shift(); 64126 continue; 64127 } 64128 startXRefParsedCache.add(startXRef); 64129 stream.pos = startXRef + stream.start; 64130 const parser = new Parser({ 64131 lexer: new Lexer(stream), 64132 xref: this, 64133 allowStreams: true 64134 }); 64135 let obj = parser.getObj(); 64136 let dict; 64137 if (isCmd(obj, "xref")) { 64138 dict = this.processXRefTable(parser); 64139 if (!this.topDict) { 64140 this.topDict = dict; 64141 } 64142 obj = dict.get("XRefStm"); 64143 if (Number.isInteger(obj) && !this._xrefStms.has(obj)) { 64144 this._xrefStms.add(obj); 64145 this.startXRefQueue.push(obj); 64146 } 64147 } else if (Number.isInteger(obj)) { 64148 if (!Number.isInteger(parser.getObj()) || !isCmd(parser.getObj(), "obj") || !((obj = parser.getObj()) instanceof BaseStream)) { 64149 throw new FormatError("Invalid XRef stream"); 64150 } 64151 dict = this.processXRefStream(obj); 64152 if (!this.topDict) { 64153 this.topDict = dict; 64154 } 64155 if (!dict) { 64156 throw new FormatError("Failed to read XRef stream"); 64157 } 64158 } else { 64159 throw new FormatError("Invalid XRef stream header"); 64160 } 64161 obj = dict.get("Prev"); 64162 if (Number.isInteger(obj)) { 64163 this.startXRefQueue.push(obj); 64164 } else if (obj instanceof Ref) { 64165 this.startXRefQueue.push(obj.num); 64166 } 64167 } catch (e) { 64168 if (e instanceof MissingDataException) { 64169 throw e; 64170 } 64171 info("(while reading XRef): " + e); 64172 } 64173 this.startXRefQueue.shift(); 64174 } 64175 if (this.topDict) { 64176 return this.topDict; 64177 } 64178 if (recoveryMode) { 64179 return undefined; 64180 } 64181 throw new XRefParseException(); 64182 } 64183 getEntry(i) { 64184 const xrefEntry = this.entries[i]; 64185 if (xrefEntry && !xrefEntry.free && xrefEntry.offset) { 64186 return xrefEntry; 64187 } 64188 return null; 64189 } 64190 fetchIfRef(obj, suppressEncryption = false) { 64191 if (obj instanceof Ref) { 64192 return this.fetch(obj, suppressEncryption); 64193 } 64194 return obj; 64195 } 64196 fetch(ref, suppressEncryption = false) { 64197 if (!(ref instanceof Ref)) { 64198 throw new Error("ref object is not a reference"); 64199 } 64200 const num = ref.num; 64201 const cacheEntry = this._cacheMap.get(num); 64202 if (cacheEntry !== undefined) { 64203 if (cacheEntry instanceof Dict && !cacheEntry.objId) { 64204 cacheEntry.objId = ref.toString(); 64205 } 64206 return cacheEntry; 64207 } 64208 let xrefEntry = this.getEntry(num); 64209 if (xrefEntry === null) { 64210 return xrefEntry; 64211 } 64212 if (this._pendingRefs.has(ref)) { 64213 this._pendingRefs.remove(ref); 64214 warn(`Ignoring circular reference: ${ref}.`); 64215 return CIRCULAR_REF; 64216 } 64217 this._pendingRefs.put(ref); 64218 try { 64219 xrefEntry = xrefEntry.uncompressed ? this.fetchUncompressed(ref, xrefEntry, suppressEncryption) : this.fetchCompressed(ref, xrefEntry, suppressEncryption); 64220 this._pendingRefs.remove(ref); 64221 } catch (ex) { 64222 this._pendingRefs.remove(ref); 64223 throw ex; 64224 } 64225 if (xrefEntry instanceof Dict) { 64226 xrefEntry.objId = ref.toString(); 64227 } else if (xrefEntry instanceof BaseStream) { 64228 xrefEntry.dict.objId = ref.toString(); 64229 } 64230 return xrefEntry; 64231 } 64232 fetchUncompressed(ref, xrefEntry, suppressEncryption = false) { 64233 const gen = ref.gen; 64234 let num = ref.num; 64235 if (xrefEntry.gen !== gen) { 64236 const msg = `Inconsistent generation in XRef: ${ref}`; 64237 if (this._generationFallback && xrefEntry.gen < gen) { 64238 warn(msg); 64239 return this.fetchUncompressed(Ref.get(num, xrefEntry.gen), xrefEntry, suppressEncryption); 64240 } 64241 throw new XRefEntryException(msg); 64242 } 64243 const stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start); 64244 const parser = new Parser({ 64245 lexer: new Lexer(stream), 64246 xref: this, 64247 allowStreams: true 64248 }); 64249 const obj1 = parser.getObj(); 64250 const obj2 = parser.getObj(); 64251 const obj3 = parser.getObj(); 64252 if (obj1 !== num || obj2 !== gen || !(obj3 instanceof Cmd)) { 64253 throw new XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`); 64254 } 64255 if (obj3.cmd !== "obj") { 64256 if (obj3.cmd.startsWith("obj")) { 64257 num = parseInt(obj3.cmd.substring(3), 10); 64258 if (!Number.isNaN(num)) { 64259 return num; 64260 } 64261 } 64262 throw new XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`); 64263 } 64264 xrefEntry = this.encrypt && !suppressEncryption ? parser.getObj(this.encrypt.createCipherTransform(num, gen)) : parser.getObj(); 64265 if (!(xrefEntry instanceof BaseStream)) { 64266 this._cacheMap.set(num, xrefEntry); 64267 } 64268 return xrefEntry; 64269 } 64270 fetchCompressed(ref, xrefEntry, suppressEncryption = false) { 64271 const tableOffset = xrefEntry.offset; 64272 const stream = this.fetch(Ref.get(tableOffset, 0)); 64273 if (!(stream instanceof BaseStream)) { 64274 throw new FormatError("bad ObjStm stream"); 64275 } 64276 const first = stream.dict.get("First"); 64277 const n = stream.dict.get("N"); 64278 if (!Number.isInteger(first) || !Number.isInteger(n)) { 64279 throw new FormatError("invalid first and n parameters for ObjStm stream"); 64280 } 64281 let parser = new Parser({ 64282 lexer: new Lexer(stream), 64283 xref: this, 64284 allowStreams: true 64285 }); 64286 const nums = new Array(n); 64287 const offsets = new Array(n); 64288 for (let i = 0; i < n; ++i) { 64289 const num = parser.getObj(); 64290 if (!Number.isInteger(num)) { 64291 throw new FormatError(`invalid object number in the ObjStm stream: ${num}`); 64292 } 64293 const offset = parser.getObj(); 64294 if (!Number.isInteger(offset)) { 64295 throw new FormatError(`invalid object offset in the ObjStm stream: ${offset}`); 64296 } 64297 nums[i] = num; 64298 const entry = this.getEntry(num); 64299 if (entry?.offset === tableOffset && entry.gen !== i) { 64300 entry.gen = i; 64301 } 64302 offsets[i] = offset; 64303 } 64304 const start = (stream.start || 0) + first; 64305 const entries = new Array(n); 64306 for (let i = 0; i < n; ++i) { 64307 const length = i < n - 1 ? offsets[i + 1] - offsets[i] : undefined; 64308 if (length < 0) { 64309 throw new FormatError("Invalid offset in the ObjStm stream."); 64310 } 64311 parser = new Parser({ 64312 lexer: new Lexer(stream.makeSubStream(start + offsets[i], length, stream.dict)), 64313 xref: this, 64314 allowStreams: true 64315 }); 64316 const obj = parser.getObj(); 64317 entries[i] = obj; 64318 if (obj instanceof BaseStream) { 64319 continue; 64320 } 64321 const num = nums[i], 64322 entry = this.entries[num]; 64323 if (entry && entry.offset === tableOffset && entry.gen === i) { 64324 this._cacheMap.set(num, obj); 64325 } 64326 } 64327 xrefEntry = entries[xrefEntry.gen]; 64328 if (xrefEntry === undefined) { 64329 throw new XRefEntryException(`Bad (compressed) XRef entry: ${ref}`); 64330 } 64331 return xrefEntry; 64332 } 64333 async fetchIfRefAsync(obj, suppressEncryption) { 64334 if (obj instanceof Ref) { 64335 return this.fetchAsync(obj, suppressEncryption); 64336 } 64337 return obj; 64338 } 64339 async fetchAsync(ref, suppressEncryption) { 64340 try { 64341 return this.fetch(ref, suppressEncryption); 64342 } catch (ex) { 64343 if (!(ex instanceof MissingDataException)) { 64344 throw ex; 64345 } 64346 await this.pdfManager.requestRange(ex.begin, ex.end); 64347 return this.fetchAsync(ref, suppressEncryption); 64348 } 64349 } 64350 getCatalogObj() { 64351 return this.root; 64352 } 64353} 64354 64355;// ./src/core/document.js 64356 64357 64358 64359 64360 64361 64362 64363 64364 64365 64366 64367 64368 64369 64370 64371 64372 64373 64374 64375 64376 64377 64378 64379 64380 64381 64382 64383 64384 64385 64386 64387 64388 64389 64390 64391 64392 64393 64394 64395
vendor: 11,396 bytes, lines 64396-64735
64396 64397 64398 64399 64400 64401 64402const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792]; 64403class Page { 64404 #resourcesPromise = null; 64405 constructor({ 64406 pdfManager, 64407 xref, 64408 pageIndex, 64409 pageDict, 64410 ref, 64411 globalIdFactory, 64412 fontCache, 64413 builtInCMapCache, 64414 standardFontDataCache, 64415 globalColorSpaceCache, 64416 globalImageCache, 64417 systemFontCache, 64418 nonBlendModesSet, 64419 xfaFactory 64420 }) { 64421 this.pdfManager = pdfManager; 64422 this.pageIndex = pageIndex; 64423 this.pageDict = pageDict; 64424 this.xref = xref; 64425 this.ref = ref; 64426 this.fontCache = fontCache; 64427 this.builtInCMapCache = builtInCMapCache; 64428 this.standardFontDataCache = standardFontDataCache; 64429 this.globalColorSpaceCache = globalColorSpaceCache; 64430 this.globalImageCache = globalImageCache; 64431 this.systemFontCache = systemFontCache; 64432 this.nonBlendModesSet = nonBlendModesSet; 64433 this.evaluatorOptions = pdfManager.evaluatorOptions; 64434 this.xfaFactory = xfaFactory; 64435 const idCounters = { 64436 obj: 0 64437 }; 64438 this._localIdFactory = class extends globalIdFactory { 64439 static createObjId() { 64440 return `p${pageIndex}_${++idCounters.obj}`; 64441 } 64442 static getPageObjId() { 64443 return `p${ref.toString()}`; 64444 } 64445 }; 64446 } 64447 #createPartialEvaluator(handler, pageIndex = this.pageIndex) { 64448 return new PartialEvaluator({ 64449 xref: this.xref, 64450 handler, 64451 pageIndex, 64452 idFactory: this._localIdFactory, 64453 fontCache: this.fontCache, 64454 builtInCMapCache: this.builtInCMapCache, 64455 standardFontDataCache: this.standardFontDataCache, 64456 globalColorSpaceCache: this.globalColorSpaceCache, 64457 globalImageCache: this.globalImageCache, 64458 systemFontCache: this.systemFontCache, 64459 options: this.evaluatorOptions 64460 }); 64461 } 64462 createAnnotationEvaluator(handler) { 64463 return this.#createPartialEvaluator(handler); 64464 } 64465 #getInheritableProperty(key, getArray = false) { 64466 const value = getInheritableProperty({ 64467 dict: this.pageDict, 64468 key, 64469 getArray, 64470 stopWhenFound: false 64471 }); 64472 if (!Array.isArray(value)) { 64473 return value; 64474 } 64475 if (value.length === 1 || !(value[0] instanceof Dict)) { 64476 return value[0]; 64477 } 64478 return Dict.merge({ 64479 xref: this.xref, 64480 dictArray: value 64481 }); 64482 } 64483 get content() { 64484 return this.pageDict.getArray("Contents"); 64485 } 64486 get resources() { 64487 const resources = this.#getInheritableProperty("Resources"); 64488 return shadow(this, "resources", resources instanceof Dict ? resources : Dict.empty); 64489 } 64490 getBoundingBox(name) { 64491 if (this.xfaData) { 64492 return this.xfaData.bbox; 64493 } 64494 const box = lookupNormalRect(this.#getInheritableProperty(name, true), null); 64495 if (box) { 64496 if (box[2] - box[0] > 0 && box[3] - box[1] > 0) { 64497 return box; 64498 } 64499 warn(`Empty, or invalid, /${name} entry.`); 64500 } 64501 return null; 64502 } 64503 get mediaBox() { 64504 return shadow(this, "mediaBox", this.getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX); 64505 } 64506 get cropBox() { 64507 return shadow(this, "cropBox", this.getBoundingBox("CropBox") || this.mediaBox); 64508 } 64509 get userUnit() { 64510 const obj = this.pageDict.get("UserUnit"); 64511 return shadow(this, "userUnit", typeof obj === "number" && obj > 0 ? obj : 1.0); 64512 } 64513 get view() { 64514 const { 64515 cropBox, 64516 mediaBox 64517 } = this; 64518 if (cropBox !== mediaBox && !isArrayEqual(cropBox, mediaBox)) { 64519 const box = Util.intersect(cropBox, mediaBox); 64520 if (box && box[2] - box[0] > 0 && box[3] - box[1] > 0) { 64521 return shadow(this, "view", box); 64522 } 64523 warn("Empty /CropBox and /MediaBox intersection."); 64524 } 64525 return shadow(this, "view", mediaBox); 64526 } 64527 get rotate() { 64528 let rotate = this.#getInheritableProperty("Rotate") || 0; 64529 if (rotate % 90 !== 0) { 64530 rotate = 0; 64531 } else if (rotate >= 360) { 64532 rotate %= 360; 64533 } else if (rotate < 0) { 64534 rotate = (rotate % 360 + 360) % 360; 64535 } 64536 return shadow(this, "rotate", rotate); 64537 } 64538 #onSubStreamError(reason, objId) { 64539 if (this.evaluatorOptions.ignoreErrors) { 64540 warn(`getContentStream - ignoring sub-stream (${objId}): "${reason}".`); 64541 return; 64542 } 64543 throw reason; 64544 } 64545 async getContentStream() { 64546 const content = await this.pdfManager.ensure(this, "content"); 64547 if (content instanceof BaseStream && !content.isImageStream) { 64548 if (content.isAsync) { 64549 const bytes = await content.asyncGetBytes(); 64550 if (bytes) { 64551 return new Stream(bytes, 0, bytes.length, content.dict); 64552 } 64553 } 64554 return content; 64555 } 64556 if (Array.isArray(content)) { 64557 const promises = []; 64558 for (let i = 0, ii = content.length; i < ii; i++) { 64559 const item = content[i]; 64560 if (item instanceof BaseStream && item.isAsync) { 64561 promises.push(item.asyncGetBytes().then(bytes => { 64562 if (bytes) { 64563 content[i] = new Stream(bytes, 0, bytes.length, item.dict); 64564 } 64565 })); 64566 } 64567 } 64568 if (promises.length > 0) { 64569 await Promise.all(promises); 64570 } 64571 return new StreamsSequenceStream(content, this.#onSubStreamError.bind(this)); 64572 } 64573 return new NullStream(); 64574 } 64575 get xfaData() { 64576 return shadow(this, "xfaData", this.xfaFactory ? { 64577 bbox: this.xfaFactory.getBoundingBox(this.pageIndex) 64578 } : null); 64579 } 64580 async #replaceIdByRef(annotations, deletedAnnotations, existingAnnotations) { 64581 const promises = []; 64582 for (const annotation of annotations) { 64583 if (annotation.id) { 64584 const ref = Ref.fromString(annotation.id); 64585 if (!ref) { 64586 warn(`A non-linked annotation cannot be modified: ${annotation.id}`); 64587 continue; 64588 } 64589 if (annotation.deleted) { 64590 deletedAnnotations.put(ref, ref); 64591 if (annotation.popupRef) { 64592 const popupRef = Ref.fromString(annotation.popupRef); 64593 if (popupRef) { 64594 deletedAnnotations.put(popupRef, popupRef); 64595 } 64596 } 64597 continue; 64598 } 64599 if (annotation.popup?.deleted) { 64600 const popupRef = Ref.fromString(annotation.popupRef); 64601 if (popupRef) { 64602 deletedAnnotations.put(popupRef, popupRef); 64603 } 64604 } 64605 existingAnnotations?.put(ref); 64606 annotation.ref = ref; 64607 promises.push(this.xref.fetchAsync(ref).then(obj => { 64608 if (obj instanceof Dict) { 64609 annotation.oldAnnotation = obj.clone(); 64610 } 64611 }, () => { 64612 warn(`Cannot fetch \`oldAnnotation\` for: ${ref}.`); 64613 })); 64614 delete annotation.id; 64615 } 64616 } 64617 await Promise.all(promises); 64618 } 64619 async saveNewAnnotations(handler, task, annotations, imagePromises, changes) { 64620 if (this.xfaFactory) { 64621 throw new Error("XFA: Cannot save new annotations."); 64622 } 64623 const partialEvaluator = this.#createPartialEvaluator(handler); 64624 const deletedAnnotations = new RefSetCache(); 64625 const existingAnnotations = new RefSet(); 64626 await this.#replaceIdByRef(annotations, deletedAnnotations, existingAnnotations); 64627 const pageDict = this.pageDict; 64628 const annotationsArray = this.annotations.filter(a => !(a instanceof Ref && deletedAnnotations.has(a))); 64629 const newData = await AnnotationFactory.saveNewAnnotations(partialEvaluator, this.xref, task, annotations, imagePromises, changes); 64630 for (const { 64631 ref 64632 } of newData.annotations) { 64633 if (ref instanceof Ref && !existingAnnotations.has(ref)) { 64634 annotationsArray.push(ref); 64635 } 64636 } 64637 const dict = pageDict.clone(); 64638 dict.set("Annots", annotationsArray); 64639 changes.put(this.ref, { 64640 data: dict 64641 }); 64642 for (const deletedRef of deletedAnnotations) { 64643 changes.put(deletedRef, { 64644 data: null 64645 }); 64646 } 64647 } 64648 async save(handler, task, annotationStorage, changes) { 64649 const partialEvaluator = this.#createPartialEvaluator(handler); 64650 const annotations = await this._parsedAnnotations; 64651 const promises = []; 64652 for (const annotation of annotations) { 64653 promises.push(annotation.save(partialEvaluator, task, annotationStorage, changes).catch(function (reason) { 64654 warn("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`); 64655 return null; 64656 })); 64657 } 64658 return Promise.all(promises); 64659 } 64660 async loadResources(keys) { 64661 await (this.#resourcesPromise ??= this.pdfManager.ensure(this, "resources")); 64662 await ObjectLoader.load(this.resources, keys, this.xref); 64663 } 64664 async #getMergedResources(streamDict, keys) { 64665 const localResources = streamDict?.get("Resources"); 64666 if (!(localResources instanceof Dict && localResources.size)) { 64667 return this.resources; 64668 } 64669 await ObjectLoader.load(localResources, keys, this.xref); 64670 return Dict.merge({ 64671 xref: this.xref, 64672 dictArray: [localResources, this.resources], 64673 mergeSubDicts: true 64674 }); 64675 } 64676 async getOperatorList({ 64677 handler, 64678 sink, 64679 task, 64680 intent, 64681 cacheKey, 64682 pageIndex = this.pageIndex, 64683 annotationStorage = null, 64684 modifiedIds = null 64685 }) { 64686 const contentStreamPromise = this.getContentStream(); 64687 const resourcesPromise = this.loadResources(RESOURCES_KEYS_OPERATOR_LIST); 64688 const partialEvaluator = this.#createPartialEvaluator(handler, pageIndex); 64689 const newAnnotsByPage = !this.xfaFactory ? getNewAnnotationsMap(annotationStorage) : null; 64690 const newAnnots = newAnnotsByPage?.get(this.pageIndex); 64691 let newAnnotationsPromise = Promise.resolve(null); 64692 let deletedAnnotations = null; 64693 if (newAnnots) { 64694 const annotationGlobalsPromise = this.pdfManager.ensureDoc("annotationGlobals"); 64695 let imagePromises; 64696 const missingBitmaps = new Set(); 64697 for (const { 64698 bitmapId, 64699 bitmap 64700 } of newAnnots) { 64701 if (bitmapId && !bitmap && !missingBitmaps.has(bitmapId)) { 64702 missingBitmaps.add(bitmapId); 64703 } 64704 } 64705 const { 64706 isOffscreenCanvasSupported 64707 } = this.evaluatorOptions; 64708 if (missingBitmaps.size > 0) { 64709 const annotationWithBitmaps = newAnnots.slice(); 64710 for (const [key, annotation] of annotationStorage) { 64711 if (!key.startsWith(AnnotationEditorPrefix)) { 64712 continue; 64713 } 64714 if (annotation.bitmap && missingBitmaps.has(annotation.bitmapId)) { 64715 annotationWithBitmaps.push(annotation); 64716 } 64717 } 64718 imagePromises = AnnotationFactory.generateImages(annotationWithBitmaps, this.xref, isOffscreenCanvasSupported); 64719 } else { 64720 imagePromises = AnnotationFactory.generateImages(newAnnots, this.xref, isOffscreenCanvasSupported); 64721 } 64722 deletedAnnotations = new RefSet(); 64723 newAnnotationsPromise = Promise.all([annotationGlobalsPromise, this.#replaceIdByRef(newAnnots, deletedAnnotations, null)]).then(([annotationGlobals]) => { 64724 if (!annotationGlobals) { 64725 return null; 64726 } 64727 return AnnotationFactory.printNewAnnotations(annotationGlobals, partialEvaluator, task, newAnnots, imagePromises); 64728 }); 64729 } 64730 const pageListPromise = Promise.all([contentStreamPromise, resourcesPromise]).then(async ([contentStream]) => { 64731 const resources = await this.#getMergedResources(contentStream.dict, RESOURCES_KEYS_OPERATOR_LIST); 64732 const opList = new OperatorList(intent, sink); 64733 handler.send("StartRenderPage", { 64734 transparency: partialEvaluator.hasBlendModes(resources, this.nonBlendModesSet), 64735
vendor: 7,574 bytes, lines 64735-64941
64735pageIndex, 64736 cacheKey 64737 }); 64738 await partialEvaluator.getOperatorList({ 64739 stream: contentStream, 64740 task, 64741 resources, 64742 operatorList: opList 64743 }); 64744 return opList; 64745 }); 64746 let [pageOpList, annotations, newAnnotations] = await Promise.all([pageListPromise, this._parsedAnnotations, newAnnotationsPromise]); 64747 if (newAnnotations) { 64748 annotations = annotations.filter(a => !(a.ref && deletedAnnotations.has(a.ref))); 64749 for (let i = 0, ii = newAnnotations.length; i < ii; i++) { 64750 const newAnnotation = newAnnotations[i]; 64751 if (newAnnotation.refToReplace) { 64752 const j = annotations.findIndex(a => a.ref && isRefsEqual(a.ref, newAnnotation.refToReplace)); 64753 if (j >= 0) { 64754 annotations.splice(j, 1, newAnnotation); 64755 newAnnotations.splice(i--, 1); 64756 ii--; 64757 } 64758 } 64759 } 64760 annotations = annotations.concat(newAnnotations); 64761 } 64762 if (annotations.length === 0 || intent & RenderingIntentFlag.ANNOTATIONS_DISABLE) { 64763 pageOpList.flush(true); 64764 return { 64765 length: pageOpList.totalLength 64766 }; 64767 } 64768 const renderForms = !!(intent & RenderingIntentFlag.ANNOTATIONS_FORMS), 64769 isEditing = !!(intent & RenderingIntentFlag.IS_EDITING), 64770 intentAny = !!(intent & RenderingIntentFlag.ANY), 64771 intentDisplay = !!(intent & RenderingIntentFlag.DISPLAY), 64772 intentPrint = !!(intent & RenderingIntentFlag.PRINT); 64773 const opListPromises = []; 64774 for (const annotation of annotations) { 64775 if (intentAny || intentDisplay && annotation.mustBeViewed(annotationStorage, renderForms) && annotation.mustBeViewedWhenEditing(isEditing, modifiedIds) || intentPrint && annotation.mustBePrinted(annotationStorage)) { 64776 opListPromises.push(annotation.getOperatorList(partialEvaluator, task, intent, annotationStorage).catch(function (reason) { 64777 warn("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`); 64778 return { 64779 opList: null, 64780 separateForm: false, 64781 separateCanvas: false 64782 }; 64783 })); 64784 } 64785 } 64786 const opLists = await Promise.all(opListPromises); 64787 let form = false, 64788 canvas = false; 64789 for (const { 64790 opList, 64791 separateForm, 64792 separateCanvas 64793 } of opLists) { 64794 pageOpList.addOpList(opList); 64795 form ||= separateForm; 64796 canvas ||= separateCanvas; 64797 } 64798 pageOpList.flush(true, { 64799 form, 64800 canvas 64801 }); 64802 return { 64803 length: pageOpList.totalLength 64804 }; 64805 } 64806 async extractTextContent({ 64807 handler, 64808 task, 64809 includeMarkedContent, 64810 disableNormalization, 64811 sink, 64812 intersector = null 64813 }) { 64814 const contentStreamPromise = this.getContentStream(); 64815 const resourcesPromise = this.loadResources(RESOURCES_KEYS_TEXT_CONTENT); 64816 const langPromise = this.pdfManager.ensureCatalog("lang"); 64817 const [contentStream,, lang] = await Promise.all([contentStreamPromise, resourcesPromise, langPromise]); 64818 const resources = await this.#getMergedResources(contentStream.dict, RESOURCES_KEYS_TEXT_CONTENT); 64819 const partialEvaluator = this.#createPartialEvaluator(handler); 64820 return partialEvaluator.getTextContent({ 64821 stream: contentStream, 64822 task, 64823 resources, 64824 includeMarkedContent, 64825 disableNormalization, 64826 sink, 64827 viewBox: this.view, 64828 lang, 64829 intersector 64830 }); 64831 } 64832 async getStructTree() { 64833 const structTreeRoot = await this.pdfManager.ensureCatalog("structTreeRoot"); 64834 if (!structTreeRoot) { 64835 return null; 64836 } 64837 await this._parsedAnnotations; 64838 try { 64839 const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [structTreeRoot]); 64840 const data = await this.pdfManager.ensure(structTree, "serializable"); 64841 return data; 64842 } catch (ex) { 64843 warn(`getStructTree: "${ex}".`); 64844 return null; 64845 } 64846 } 64847 _parseStructTree(structTreeRoot) { 64848 const tree = new StructTreePage(structTreeRoot, this.pageDict); 64849 tree.parse(this.ref); 64850 return tree; 64851 } 64852 async getAnnotationsData(handler, task, intent) { 64853 const annotations = await this._parsedAnnotations; 64854 if (annotations.length === 0) { 64855 return annotations; 64856 } 64857 const annotationsData = [], 64858 textContentPromises = []; 64859 let partialEvaluator; 64860 const intentAny = !!(intent & RenderingIntentFlag.ANY), 64861 intentDisplay = !!(intent & RenderingIntentFlag.DISPLAY), 64862 intentPrint = !!(intent & RenderingIntentFlag.PRINT); 64863 const highlightedAnnotations = []; 64864 for (const annotation of annotations) { 64865 const isVisible = intentAny || intentDisplay && annotation.viewable; 64866 if (isVisible || intentPrint && annotation.printable) { 64867 annotationsData.push(annotation.data); 64868 } 64869 if (annotation.hasTextContent && isVisible) { 64870 partialEvaluator ??= this.#createPartialEvaluator(handler); 64871 textContentPromises.push(annotation.extractTextContent(partialEvaluator, task, [-Infinity, -Infinity, Infinity, Infinity]).catch(function (reason) { 64872 warn(`getAnnotationsData - ignoring textContent during "${task.name}" task: "${reason}".`); 64873 })); 64874 } else if (annotation.overlaysTextContent && isVisible) { 64875 highlightedAnnotations.push(annotation); 64876 } 64877 } 64878 if (highlightedAnnotations.length > 0) { 64879 const intersector = new Intersector(highlightedAnnotations); 64880 textContentPromises.push(this.extractTextContent({ 64881 handler, 64882 task, 64883 includeMarkedContent: false, 64884 disableNormalization: false, 64885 sink: null, 64886 viewBox: this.view, 64887 lang: null, 64888 intersector 64889 }).then(() => { 64890 intersector.setText(); 64891 })); 64892 } 64893 await Promise.all(textContentPromises); 64894 return annotationsData; 64895 } 64896 get annotations() { 64897 const annots = this.#getInheritableProperty("Annots"); 64898 return shadow(this, "annotations", Array.isArray(annots) ? annots : []); 64899 } 64900 get _parsedAnnotations() { 64901 const promise = this.pdfManager.ensure(this, "annotations").then(async annots => { 64902 if (annots.length === 0) { 64903 return annots; 64904 } 64905 const [annotationGlobals, fieldObjects] = await Promise.all([this.pdfManager.ensureDoc("annotationGlobals"), this.pdfManager.ensureDoc("fieldObjects")]); 64906 if (!annotationGlobals) { 64907 return []; 64908 } 64909 const orphanFields = fieldObjects?.orphanFields; 64910 const annotationPromises = []; 64911 for (const annotationRef of annots) { 64912 annotationPromises.push(AnnotationFactory.create(this.xref, annotationRef, annotationGlobals, this._localIdFactory, false, orphanFields, null, this.ref).catch(function (reason) { 64913 warn(`_parsedAnnotations: "${reason}".`); 64914 return null; 64915 })); 64916 } 64917 const sortedAnnotations = []; 64918 let popupAnnotations, widgetAnnotations; 64919 for (const annotation of await Promise.all(annotationPromises)) { 64920 if (!annotation) { 64921 continue; 64922 } 64923 if (annotation instanceof WidgetAnnotation) { 64924 (widgetAnnotations ||= []).push(annotation); 64925 continue; 64926 } 64927 if (annotation instanceof PopupAnnotation) { 64928 (popupAnnotations ||= []).push(annotation); 64929 continue; 64930 } 64931 sortedAnnotations.push(annotation); 64932 } 64933 if (widgetAnnotations) { 64934 sortedAnnotations.push(...widgetAnnotations); 64935 } 64936 if (popupAnnotations) { 64937 sortedAnnotations.push(...popupAnnotations); 64938 } 64939 return sortedAnnotations; 64940 }); 64941
vendor: 2,744 bytes, lines 64941-65021
64941return shadow(this, "_parsedAnnotations", promise); 64942 } 64943 get jsActions() { 64944 const actions = collectActions(this.xref, this.pageDict, PageActionEventType); 64945 return shadow(this, "jsActions", actions); 64946 } 64947 async collectAnnotationsByType(handler, task, types, promises, annotationGlobals) { 64948 const { 64949 pageIndex 64950 } = this; 64951 if (Object.hasOwn(this, "_parsedAnnotations")) { 64952 const cachedAnnotations = await this._parsedAnnotations; 64953 for (const { 64954 data 64955 } of cachedAnnotations) { 64956 if (!types || types.has(data.annotationType)) { 64957 data.pageIndex = pageIndex; 64958 promises.push(Promise.resolve(data)); 64959 } 64960 } 64961 return; 64962 } 64963 const annots = await this.pdfManager.ensure(this, "annotations"); 64964 let partialEvaluator; 64965 for (const annotationRef of annots) { 64966 promises.push(AnnotationFactory.create(this.xref, annotationRef, annotationGlobals, this._localIdFactory, false, null, types, this.ref).then(async annotation => { 64967 if (!annotation) { 64968 return null; 64969 } 64970 annotation.data.pageIndex = pageIndex; 64971 if (annotation.hasTextContent && annotation.viewable) { 64972 partialEvaluator ??= this.#createPartialEvaluator(handler); 64973 await annotation.extractTextContent(partialEvaluator, task, [-Infinity, -Infinity, Infinity, Infinity]); 64974 } 64975 return annotation.data; 64976 }).catch(function (reason) { 64977 warn(`collectAnnotationsByType: "${reason}".`); 64978 return null; 64979 })); 64980 } 64981 } 64982} 64983const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]); 64984const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]); 64985const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]); 64986function find(stream, signature, limit = 1024, backwards = false) { 64987 const signatureLength = signature.length; 64988 const scanBytes = stream.peekBytes(limit); 64989 const scanLength = scanBytes.length - signatureLength; 64990 if (scanLength <= 0) { 64991 return false; 64992 } 64993 if (backwards) { 64994 const signatureEnd = signatureLength - 1; 64995 let pos = scanBytes.length - 1; 64996 while (pos >= signatureEnd) { 64997 let j = 0; 64998 while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) { 64999 j++; 65000 } 65001 if (j >= signatureLength) { 65002 stream.pos += pos - signatureEnd; 65003 return true; 65004 } 65005 pos--; 65006 } 65007 } else { 65008 let pos = 0; 65009 while (pos <= scanLength) { 65010 let j = 0; 65011 while (j < signatureLength && scanBytes[pos + j] === signature[j]) { 65012 j++; 65013 } 65014 if (j >= signatureLength) { 65015 stream.pos += pos; 65016 return true; 65017 } 65018 pos++; 65019 } 65020 } 65021 return false;
vendor: 8,602 bytes, lines 65022-65325
65022} 65023class PDFDocument { 65024 #pagePromises = new Map(); 65025 #version = null; 65026 constructor(pdfManager, stream) { 65027 if (stream.length <= 0) { 65028 throw new InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes."); 65029 } 65030 this.pdfManager = pdfManager; 65031 this.stream = stream; 65032 this.xref = new XRef(stream, pdfManager); 65033 const idCounters = { 65034 font: 0 65035 }; 65036 this._globalIdFactory = class { 65037 static getDocId() { 65038 return `g_${pdfManager.docId}`; 65039 } 65040 static createFontId() { 65041 return `f${++idCounters.font}`; 65042 } 65043 static createObjId() { 65044 unreachable("Abstract method `createObjId` called."); 65045 } 65046 static getPageObjId() { 65047 unreachable("Abstract method `getPageObjId` called."); 65048 } 65049 }; 65050 } 65051 parse(recoveryMode) { 65052 this.xref.parse(recoveryMode); 65053 this.catalog = new Catalog(this.pdfManager, this.xref); 65054 } 65055 get linearization() { 65056 let linearization = null; 65057 try { 65058 linearization = Linearization.create(this.stream); 65059 } catch (err) { 65060 if (err instanceof MissingDataException) { 65061 throw err; 65062 } 65063 info(err); 65064 } 65065 return shadow(this, "linearization", linearization); 65066 } 65067 get startXRef() { 65068 const stream = this.stream; 65069 let startXRef = 0; 65070 if (this.linearization) { 65071 stream.reset(); 65072 if (find(stream, ENDOBJ_SIGNATURE)) { 65073 stream.skip(6); 65074 let ch = stream.peekByte(); 65075 while (isWhiteSpace(ch)) { 65076 stream.pos++; 65077 ch = stream.peekByte(); 65078 } 65079 startXRef = stream.pos - stream.start; 65080 } 65081 } else { 65082 const step = 1024; 65083 const startXRefLength = STARTXREF_SIGNATURE.length; 65084 let found = false, 65085 pos = stream.end; 65086 while (!found && pos > 0) { 65087 pos -= step - startXRefLength; 65088 if (pos < 0) { 65089 pos = 0; 65090 } 65091 stream.pos = pos; 65092 found = find(stream, STARTXREF_SIGNATURE, step, true); 65093 } 65094 if (found) { 65095 stream.skip(9); 65096 let ch; 65097 do { 65098 ch = stream.getByte(); 65099 } while (isWhiteSpace(ch)); 65100 let str = ""; 65101 while (ch >= 0x20 && ch <= 0x39) { 65102 str += String.fromCharCode(ch); 65103 ch = stream.getByte(); 65104 } 65105 startXRef = parseInt(str, 10); 65106 if (isNaN(startXRef)) { 65107 startXRef = 0; 65108 } 65109 } 65110 } 65111 return shadow(this, "startXRef", startXRef); 65112 } 65113 checkHeader() { 65114 const stream = this.stream; 65115 stream.reset(); 65116 if (!find(stream, PDF_HEADER_SIGNATURE)) { 65117 return; 65118 } 65119 stream.moveStart(); 65120 stream.skip(PDF_HEADER_SIGNATURE.length); 65121 let version = "", 65122 ch; 65123 while ((ch = stream.getByte()) > 0x20 && version.length < 7) { 65124 version += String.fromCharCode(ch); 65125 } 65126 if (PDF_VERSION_REGEXP.test(version)) { 65127 this.#version = version; 65128 } else { 65129 warn(`Invalid PDF header version: ${version}`); 65130 } 65131 } 65132 parseStartXRef() { 65133 this.xref.setStartXRef(this.startXRef); 65134 } 65135 get numPages() { 65136 let num = 0; 65137 if (this.catalog.hasActualNumPages) { 65138 num = this.catalog.numPages; 65139 } else if (this.xfaFactory) { 65140 num = this.xfaFactory.getNumPages(); 65141 } else if (this.linearization) { 65142 num = this.linearization.numPages; 65143 } else { 65144 num = this.catalog.numPages; 65145 } 65146 return shadow(this, "numPages", num); 65147 } 65148 #hasOnlyDocumentSignatures(fields, recursionDepth = 0) { 65149 const RECURSION_LIMIT = 10; 65150 if (!Array.isArray(fields)) { 65151 return false; 65152 } 65153 return fields.every(field => { 65154 field = this.xref.fetchIfRef(field); 65155 if (!(field instanceof Dict)) { 65156 return false; 65157 } 65158 if (field.has("Kids")) { 65159 if (++recursionDepth > RECURSION_LIMIT) { 65160 warn("#hasOnlyDocumentSignatures: maximum recursion depth reached"); 65161 return false; 65162 } 65163 return this.#hasOnlyDocumentSignatures(field.get("Kids"), recursionDepth); 65164 } 65165 const isSignature = isName(field.get("FT"), "Sig"); 65166 const rectangle = field.get("Rect"); 65167 const isInvisible = Array.isArray(rectangle) && rectangle.every(value => value === 0); 65168 return isSignature && isInvisible; 65169 }); 65170 } 65171 get _xfaStreams() { 65172 const { 65173 acroForm 65174 } = this.catalog; 65175 if (!acroForm) { 65176 return null; 65177 } 65178 const xfa = acroForm.get("XFA"); 65179 const entries = new Map(["xdp:xdp", "template", "datasets", "config", "connectionSet", "localeSet", "stylesheet", "/xdp:xdp"].map(e => [e, null])); 65180 if (xfa instanceof BaseStream && !xfa.isEmpty) { 65181 entries.set("xdp:xdp", xfa); 65182 return entries; 65183 } 65184 if (!Array.isArray(xfa) || xfa.length === 0) { 65185 return null; 65186 } 65187 for (let i = 0, ii = xfa.length; i < ii; i += 2) { 65188 let name; 65189 if (i === 0) { 65190 name = "xdp:xdp"; 65191 } else if (i === ii - 2) { 65192 name = "/xdp:xdp"; 65193 } else { 65194 name = xfa[i]; 65195 } 65196 if (!entries.has(name)) { 65197 continue; 65198 } 65199 const data = this.xref.fetchIfRef(xfa[i + 1]); 65200 if (!(data instanceof BaseStream) || data.isEmpty) { 65201 continue; 65202 } 65203 entries.set(name, data); 65204 } 65205 return entries; 65206 } 65207 get xfaDatasets() { 65208 const streams = this._xfaStreams; 65209 if (!streams) { 65210 return shadow(this, "xfaDatasets", null); 65211 } 65212 for (const key of ["datasets", "xdp:xdp"]) { 65213 const stream = streams.get(key); 65214 if (!stream) { 65215 continue; 65216 } 65217 try { 65218 const str = stringToUTF8String(stream.getString()); 65219 const data = { 65220 [key]: str 65221 }; 65222 return shadow(this, "xfaDatasets", new DatasetReader(data)); 65223 } catch { 65224 warn("XFA - Invalid utf-8 string."); 65225 break; 65226 } 65227 } 65228 return shadow(this, "xfaDatasets", null); 65229 } 65230 get xfaData() { 65231 const streams = this._xfaStreams; 65232 if (!streams) { 65233 return null; 65234 } 65235 const data = Object.create(null); 65236 for (const [key, stream] of streams) { 65237 if (!stream) { 65238 continue; 65239 } 65240 try { 65241 data[key] = stringToUTF8String(stream.getString()); 65242 } catch { 65243 warn("XFA - Invalid utf-8 string."); 65244 return null; 65245 } 65246 } 65247 return data; 65248 } 65249 get xfaFactory() { 65250 let data; 65251 if (this.pdfManager.enableXfa && this.catalog.needsRendering && this.formInfo.hasXfa && !this.formInfo.hasAcroForm) { 65252 data = this.xfaData; 65253 } 65254 return shadow(this, "xfaFactory", data ? new XFAFactory(data) : null); 65255 } 65256 get isPureXfa() { 65257 return this.xfaFactory ? this.xfaFactory.isValid() : false; 65258 } 65259 get htmlForXfa() { 65260 return this.xfaFactory ? this.xfaFactory.getPages() : null; 65261 } 65262 async #loadXfaImages() { 65263 const xfaImages = await this.pdfManager.ensureCatalog("xfaImages"); 65264 if (!xfaImages) { 65265 return; 65266 } 65267 this.xfaFactory.setImages(xfaImages); 65268 } 65269 async #loadXfaFonts(handler, task) { 65270 const acroForm = await this.pdfManager.ensureCatalog("acroForm"); 65271 if (!acroForm) { 65272 return; 65273 } 65274 const resources = await acroForm.getAsync("DR"); 65275 if (!(resources instanceof Dict)) { 65276 return; 65277 } 65278 await ObjectLoader.load(resources, ["Font"], this.xref); 65279 const fontRes = resources.get("Font"); 65280 if (!(fontRes instanceof Dict)) { 65281 return; 65282 } 65283 const options = Object.assign(Object.create(null), this.pdfManager.evaluatorOptions, { 65284 useSystemFonts: false 65285 }); 65286 const { 65287 builtInCMapCache, 65288 fontCache, 65289 standardFontDataCache 65290 } = this.catalog; 65291 const partialEvaluator = new PartialEvaluator({ 65292 xref: this.xref, 65293 handler, 65294 pageIndex: -1, 65295 idFactory: this._globalIdFactory, 65296 fontCache, 65297 builtInCMapCache, 65298 standardFontDataCache, 65299 options 65300 }); 65301 const operatorList = new OperatorList(); 65302 const pdfFonts = []; 65303 const initialState = { 65304 get font() { 65305 return pdfFonts.at(-1); 65306 }, 65307 set font(font) { 65308 pdfFonts.push(font); 65309 }, 65310 clone() { 65311 return this; 65312 } 65313 }; 65314 const parseFont = (fontName, fallbackFontDict, cssFontInfo) => partialEvaluator.handleSetFont(resources, [Name.get(fontName), 1], null, operatorList, task, initialState, fallbackFontDict, cssFontInfo).catch(reason => { 65315 warn(`loadXfaFonts: "${reason}".`); 65316 return null; 65317 }); 65318 const promises = []; 65319 for (const [fontName, font] of fontRes) { 65320 const descriptor = font.get("FontDescriptor"); 65321 if (!(descriptor instanceof Dict)) { 65322 continue; 65323 } 65324 let fontFamily = descriptor.get("FontFamily"); 65325 fontFamily = fontFamily.replaceAll(/[ ]+(\d)/g, "$1"
vendor: 4,890 bytes, lines 65325-65490
65325); 65326 const fontWeight = descriptor.get("FontWeight"); 65327 const italicAngle = -descriptor.get("ItalicAngle"); 65328 const cssFontInfo = { 65329 fontFamily, 65330 fontWeight, 65331 italicAngle 65332 }; 65333 if (!validateCSSFont(cssFontInfo)) { 65334 continue; 65335 } 65336 promises.push(parseFont(fontName, null, cssFontInfo)); 65337 } 65338 await Promise.all(promises); 65339 const missingFonts = this.xfaFactory.setFonts(pdfFonts); 65340 if (!missingFonts) { 65341 return; 65342 } 65343 options.ignoreErrors = true; 65344 promises.length = 0; 65345 pdfFonts.length = 0; 65346 const reallyMissingFonts = new Set(); 65347 for (const missing of missingFonts) { 65348 if (!getXfaFontName(`${missing}-Regular`)) { 65349 reallyMissingFonts.add(missing); 65350 } 65351 } 65352 if (reallyMissingFonts.size) { 65353 missingFonts.push("PdfJS-Fallback"); 65354 } 65355 for (const missing of missingFonts) { 65356 if (reallyMissingFonts.has(missing)) { 65357 continue; 65358 } 65359 for (const fontInfo of [{ 65360 name: "Regular", 65361 fontWeight: 400, 65362 italicAngle: 0 65363 }, { 65364 name: "Bold", 65365 fontWeight: 700, 65366 italicAngle: 0 65367 }, { 65368 name: "Italic", 65369 fontWeight: 400, 65370 italicAngle: 12 65371 }, { 65372 name: "BoldItalic", 65373 fontWeight: 700, 65374 italicAngle: 12 65375 }]) { 65376 const name = `${missing}-${fontInfo.name}`; 65377 promises.push(parseFont(name, getXfaFontDict(name), { 65378 fontFamily: missing, 65379 fontWeight: fontInfo.fontWeight, 65380 italicAngle: fontInfo.italicAngle 65381 })); 65382 } 65383 } 65384 await Promise.all(promises); 65385 this.xfaFactory.appendFonts(pdfFonts, reallyMissingFonts); 65386 } 65387 loadXfaResources(handler, task) { 65388 return Promise.all([this.#loadXfaFonts(handler, task).catch(() => {}), this.#loadXfaImages()]); 65389 } 65390 serializeXfaData(annotationStorage) { 65391 return this.xfaFactory ? this.xfaFactory.serializeData(annotationStorage) : null; 65392 } 65393 get version() { 65394 return this.catalog.version || this.#version; 65395 } 65396 get formInfo() { 65397 const formInfo = { 65398 hasFields: false, 65399 hasAcroForm: false, 65400 hasXfa: false, 65401 hasSignatures: false 65402 }; 65403 const { 65404 acroForm 65405 } = this.catalog; 65406 if (!acroForm) { 65407 return shadow(this, "formInfo", formInfo); 65408 } 65409 try { 65410 const fields = acroForm.get("Fields"); 65411 const hasFields = Array.isArray(fields) && fields.length > 0; 65412 formInfo.hasFields = hasFields; 65413 const xfa = acroForm.get("XFA"); 65414 formInfo.hasXfa = Array.isArray(xfa) && xfa.length > 0 || xfa instanceof BaseStream && !xfa.isEmpty; 65415 const sigFlags = acroForm.get("SigFlags"); 65416 const hasSignatures = !!(sigFlags & 0x1); 65417 const hasOnlyDocumentSignatures = hasSignatures && this.#hasOnlyDocumentSignatures(fields); 65418 formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures; 65419 formInfo.hasSignatures = hasSignatures; 65420 } catch (ex) { 65421 if (ex instanceof MissingDataException) { 65422 throw ex; 65423 } 65424 warn(`Cannot fetch form information: "${ex}".`); 65425 } 65426 return shadow(this, "formInfo", formInfo); 65427 } 65428 get documentInfo() { 65429 const { 65430 catalog, 65431 formInfo, 65432 xref 65433 } = this; 65434 const docInfo = { 65435 PDFFormatVersion: this.version, 65436 Language: catalog.lang, 65437 EncryptFilterName: xref.encrypt?.filterName ?? null, 65438 IsLinearized: !!this.linearization, 65439 IsAcroFormPresent: formInfo.hasAcroForm, 65440 IsXFAPresent: formInfo.hasXfa, 65441 IsCollectionPresent: !!catalog.collection, 65442 IsSignaturesPresent: formInfo.hasSignatures 65443 }; 65444 let infoDict; 65445 try { 65446 infoDict = xref.trailer.get("Info"); 65447 } catch (err) { 65448 if (err instanceof MissingDataException) { 65449 throw err; 65450 } 65451 info("The document information dictionary is invalid."); 65452 } 65453 if (!(infoDict instanceof Dict)) { 65454 return shadow(this, "documentInfo", docInfo); 65455 } 65456 for (const [key, value] of infoDict) { 65457 switch (key) { 65458 case "Title": 65459 case "Author": 65460 case "Subject": 65461 case "Keywords": 65462 case "Creator": 65463 case "Producer": 65464 case "CreationDate": 65465 case "ModDate": 65466 if (typeof value === "string") { 65467 docInfo[key] = stringToPDFString(value); 65468 continue; 65469 } 65470 break; 65471 case "Trapped": 65472 if (value instanceof Name) { 65473 docInfo[key] = value; 65474 continue; 65475 } 65476 break; 65477 default: 65478 let customValue; 65479 switch (typeof value) { 65480 case "string": 65481 customValue = stringToPDFString(value); 65482 break; 65483 case "number": 65484 case "boolean": 65485 customValue = value; 65486 break; 65487 default: 65488 if (value instanceof Name) { 65489 customValue = value; 65490
vendor: 18,964 bytes, lines 65490-66110
65490} 65491 break; 65492 } 65493 if (customValue === undefined) { 65494 warn(`Bad value, for custom key "${key}", in Info: ${value}.`); 65495 continue; 65496 } 65497 docInfo.Custom ??= Object.create(null); 65498 docInfo.Custom[key] = customValue; 65499 continue; 65500 } 65501 warn(`Bad value, for key "${key}", in Info: ${value}.`); 65502 } 65503 return shadow(this, "documentInfo", docInfo); 65504 } 65505 get fingerprints() { 65506 const FINGERPRINT_FIRST_BYTES = 1024; 65507 const EMPTY_FINGERPRINT = "\x00".repeat(16); 65508 function validate(data) { 65509 return typeof data === "string" && data.length === 16 && data !== EMPTY_FINGERPRINT; 65510 } 65511 const id = this.xref.trailer.get("ID"); 65512 let hashOriginal, hashModified; 65513 if (Array.isArray(id) && validate(id[0])) { 65514 hashOriginal = stringToBytes(id[0]); 65515 if (id[1] !== id[0] && validate(id[1])) { 65516 hashModified = stringToBytes(id[1]); 65517 } 65518 } else { 65519 hashOriginal = calculateMD5(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES); 65520 } 65521 return shadow(this, "fingerprints", [hashOriginal.toHex(), hashModified?.toHex() ?? null]); 65522 } 65523 async #getLinearizationPage(pageIndex) { 65524 const { 65525 catalog, 65526 linearization, 65527 xref 65528 } = this; 65529 const ref = Ref.get(linearization.objectNumberFirst, 0); 65530 try { 65531 const obj = await xref.fetchAsync(ref); 65532 if (obj instanceof Dict) { 65533 let type = obj.getRaw("Type"); 65534 if (type instanceof Ref) { 65535 type = await xref.fetchAsync(type); 65536 } 65537 if (isName(type, "Page") || !obj.has("Type") && !obj.has("Kids") && obj.has("Contents")) { 65538 if (!catalog.pageKidsCountCache.has(ref)) { 65539 catalog.pageKidsCountCache.put(ref, 1); 65540 } 65541 if (!catalog.pageIndexCache.has(ref)) { 65542 catalog.pageIndexCache.put(ref, 0); 65543 } 65544 return [obj, ref]; 65545 } 65546 } 65547 throw new FormatError("The Linearization dictionary doesn't point to a valid Page dictionary."); 65548 } catch (reason) { 65549 warn(`_getLinearizationPage: "${reason.message}".`); 65550 return catalog.getPageDict(pageIndex); 65551 } 65552 } 65553 getPage(pageIndex) { 65554 const cachedPromise = this.#pagePromises.get(pageIndex); 65555 if (cachedPromise) { 65556 return cachedPromise; 65557 } 65558 const { 65559 catalog, 65560 linearization, 65561 xfaFactory 65562 } = this; 65563 let promise; 65564 if (xfaFactory) { 65565 promise = Promise.resolve([Dict.empty, null]); 65566 } else if (linearization?.pageFirst === pageIndex) { 65567 promise = this.#getLinearizationPage(pageIndex); 65568 } else { 65569 promise = catalog.getPageDict(pageIndex); 65570 } 65571 promise = promise.then(([pageDict, ref]) => new Page({ 65572 pdfManager: this.pdfManager, 65573 xref: this.xref, 65574 pageIndex, 65575 pageDict, 65576 ref, 65577 globalIdFactory: this._globalIdFactory, 65578 fontCache: catalog.fontCache, 65579 builtInCMapCache: catalog.builtInCMapCache, 65580 standardFontDataCache: catalog.standardFontDataCache, 65581 globalColorSpaceCache: catalog.globalColorSpaceCache, 65582 globalImageCache: catalog.globalImageCache, 65583 systemFontCache: catalog.systemFontCache, 65584 nonBlendModesSet: catalog.nonBlendModesSet, 65585 xfaFactory 65586 })); 65587 this.#pagePromises.set(pageIndex, promise); 65588 return promise; 65589 } 65590 async checkFirstPage(recoveryMode = false) { 65591 if (recoveryMode) { 65592 return; 65593 } 65594 try { 65595 await this.getPage(0); 65596 } catch (reason) { 65597 if (reason instanceof XRefEntryException) { 65598 this.#pagePromises.delete(0); 65599 await this.cleanup(); 65600 throw new XRefParseException(); 65601 } 65602 } 65603 } 65604 async checkLastPage(recoveryMode = false) { 65605 const { 65606 catalog, 65607 pdfManager 65608 } = this; 65609 catalog.setActualNumPages(); 65610 let numPages; 65611 try { 65612 await Promise.all([pdfManager.ensureDoc("xfaFactory"), pdfManager.ensureDoc("linearization"), pdfManager.ensureCatalog("numPages")]); 65613 if (this.xfaFactory) { 65614 return; 65615 } else if (this.linearization) { 65616 numPages = this.linearization.numPages; 65617 } else { 65618 numPages = catalog.numPages; 65619 } 65620 if (!Number.isInteger(numPages)) { 65621 throw new FormatError("Page count is not an integer."); 65622 } else if (numPages <= 1) { 65623 return; 65624 } 65625 await this.getPage(numPages - 1); 65626 } catch (reason) { 65627 this.#pagePromises.delete(numPages - 1); 65628 await this.cleanup(); 65629 if (reason instanceof XRefEntryException && !recoveryMode) { 65630 throw new XRefParseException(); 65631 } 65632 warn(`checkLastPage - invalid /Pages tree /Count: ${numPages}.`); 65633 let pagesTree; 65634 try { 65635 pagesTree = await catalog.getAllPageDicts(recoveryMode); 65636 } catch (reasonAll) { 65637 if (reasonAll instanceof XRefEntryException && !recoveryMode) { 65638 throw new XRefParseException(); 65639 } 65640 catalog.setActualNumPages(1); 65641 return; 65642 } 65643 for (const [pageIndex, [pageDict, ref]] of pagesTree) { 65644 let promise; 65645 if (pageDict instanceof Error) { 65646 promise = Promise.reject(pageDict); 65647 promise.catch(() => {}); 65648 } else { 65649 promise = Promise.resolve(new Page({ 65650 pdfManager, 65651 xref: this.xref, 65652 pageIndex, 65653 pageDict, 65654 ref, 65655 globalIdFactory: this._globalIdFactory, 65656 fontCache: catalog.fontCache, 65657 builtInCMapCache: catalog.builtInCMapCache, 65658 standardFontDataCache: catalog.standardFontDataCache, 65659 globalColorSpaceCache: this.globalColorSpaceCache, 65660 globalImageCache: catalog.globalImageCache, 65661 systemFontCache: catalog.systemFontCache, 65662 nonBlendModesSet: catalog.nonBlendModesSet, 65663 xfaFactory: null 65664 })); 65665 } 65666 this.#pagePromises.set(pageIndex, promise); 65667 } 65668 catalog.setActualNumPages(pagesTree.size); 65669 } 65670 } 65671 async fontFallback(id, handler) { 65672 const { 65673 catalog, 65674 pdfManager 65675 } = this; 65676 for (const translatedFont of await Promise.all(catalog.fontCache)) { 65677 if (translatedFont.loadedName === id) { 65678 translatedFont.fallback(handler, pdfManager.evaluatorOptions); 65679 return; 65680 } 65681 } 65682 } 65683 async cleanup(manuallyTriggered = false) { 65684 return this.catalog ? this.catalog.cleanup(manuallyTriggered) : clearGlobalCaches(); 65685 } 65686 async #collectFieldObjects(name, parentRef, fieldRef, promises, annotationGlobals, visitedRefs, orphanFields) { 65687 const { 65688 xref 65689 } = this; 65690 if (!(fieldRef instanceof Ref) || visitedRefs.has(fieldRef)) { 65691 return; 65692 } 65693 visitedRefs.put(fieldRef); 65694 const field = await xref.fetchAsync(fieldRef); 65695 if (!(field instanceof Dict)) { 65696 return; 65697 } 65698 let subtype = await field.getAsync("Subtype"); 65699 subtype = subtype instanceof Name ? subtype.name : null; 65700 switch (subtype) { 65701 case "Link": 65702 return; 65703 } 65704 if (field.has("T")) { 65705 const partName = stringToPDFString(await field.getAsync("T")); 65706 name = name === "" ? partName : `${name}.${partName}`; 65707 } else { 65708 let obj = field; 65709 while (true) { 65710 obj = obj.getRaw("Parent") || parentRef; 65711 if (obj instanceof Ref) { 65712 if (visitedRefs.has(obj)) { 65713 break; 65714 } 65715 obj = await xref.fetchAsync(obj); 65716 } 65717 if (!(obj instanceof Dict)) { 65718 break; 65719 } 65720 if (obj.has("T")) { 65721 const partName = stringToPDFString(await obj.getAsync("T")); 65722 name = name === "" ? partName : `${name}.${partName}`; 65723 break; 65724 } 65725 } 65726 } 65727 if (parentRef && !field.has("Parent") && isName(field.get("Subtype"), "Widget")) { 65728 orphanFields.put(fieldRef, parentRef); 65729 } 65730 promises.getOrInsertComputed(name, makeArr).push(AnnotationFactory.create(xref, fieldRef, annotationGlobals, null, true, orphanFields, null, null).then(annotation => annotation?.getFieldObject()).catch(function (reason) { 65731 warn(`#collectFieldObjects: "${reason}".`); 65732 return null; 65733 })); 65734 if (!field.has("Kids")) { 65735 return; 65736 } 65737 const kids = await field.getAsync("Kids"); 65738 if (Array.isArray(kids)) { 65739 for (const kid of kids) { 65740 await this.#collectFieldObjects(name, fieldRef, kid, promises, annotationGlobals, visitedRefs, orphanFields); 65741 } 65742 } 65743 } 65744 get fieldObjects() { 65745 const promise = this.pdfManager.ensureDoc("formInfo").then(async formInfo => { 65746 if (!formInfo.hasFields) { 65747 return null; 65748 } 65749 const annotationGlobals = await this.annotationGlobals; 65750 if (!annotationGlobals) { 65751 return null; 65752 } 65753 const { 65754 acroForm 65755 } = annotationGlobals; 65756 const visitedRefs = new RefSet(); 65757 const allFields = Object.create(null); 65758 const fieldPromises = new Map(); 65759 const orphanFields = new RefSetCache(); 65760 for (const fieldRef of acroForm.get("Fields")) { 65761 await this.#collectFieldObjects("", null, fieldRef, fieldPromises, annotationGlobals, visitedRefs, orphanFields); 65762 } 65763 const allPromises = []; 65764 for (const [name, promises] of fieldPromises) { 65765 allPromises.push(Promise.all(promises).then(fields => { 65766 fields = fields.filter(field => !!field); 65767 if (fields.length > 0) { 65768 allFields[name] = fields; 65769 } 65770 })); 65771 } 65772 await Promise.all(allPromises); 65773 return { 65774 allFields: objectSize(allFields) > 0 ? allFields : null, 65775 orphanFields 65776 }; 65777 }); 65778 return shadow(this, "fieldObjects", promise); 65779 } 65780 get hasJSActions() { 65781 const promise = this.pdfManager.ensureDoc("_parseHasJSActions"); 65782 return shadow(this, "hasJSActions", promise); 65783 } 65784 async _parseHasJSActions() { 65785 const [catalogJsActions, fieldObjects] = await Promise.all([this.pdfManager.ensureCatalog("jsActions"), this.pdfManager.ensureDoc("fieldObjects")]); 65786 if (catalogJsActions) { 65787 return true; 65788 } 65789 if (fieldObjects?.allFields) { 65790 return Object.values(fieldObjects.allFields).some(fieldObject => fieldObject.some(object => object.actions !== null)); 65791 } 65792 return false; 65793 } 65794 get calculationOrderIds() { 65795 const calculationOrder = this.catalog.acroForm?.get("CO"); 65796 if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) { 65797 return shadow(this, "calculationOrderIds", null); 65798 } 65799 const ids = []; 65800 for (const id of calculationOrder) { 65801 if (id instanceof Ref) { 65802 ids.push(id.toString()); 65803 } 65804 } 65805 return shadow(this, "calculationOrderIds", ids.length ? ids : null); 65806 } 65807 get annotationGlobals() { 65808 return shadow(this, "annotationGlobals", AnnotationFactory.createGlobals(this.pdfManager)); 65809 } 65810 async toJSObject(value, firstCall = true) { 65811 throw new Error("Not implemented: toJSObject"); 65812 } 65813} 65814 65815;// ./src/core/pdf_manager.js 65816 65817 65818 65819 65820 65821 65822 65823 65824 65825 65826 65827 65828 65829function parseDocBaseUrl(url) { 65830 if (url) { 65831 const absoluteUrl = createValidAbsoluteUrl(url); 65832 if (absoluteUrl) { 65833 return absoluteUrl.href; 65834 } 65835 warn(`Invalid absolute docBaseUrl: "${url}".`); 65836 } 65837 return null; 65838} 65839class BasePdfManager { 65840 constructor({ 65841 docBaseUrl, 65842 docId, 65843 enableXfa, 65844 evaluatorOptions, 65845 handler, 65846 password 65847 }) { 65848 this._docBaseUrl = parseDocBaseUrl(docBaseUrl); 65849 this._docId = docId; 65850 this._password = password; 65851 this.enableXfa = enableXfa; 65852 evaluatorOptions.isOffscreenCanvasSupported &&= FeatureTest.isOffscreenCanvasSupported; 65853 evaluatorOptions.isImageDecoderSupported &&= FeatureTest.isImageDecoderSupported; 65854 this.evaluatorOptions = Object.freeze(evaluatorOptions); 65855 ImageResizer.setOptions(evaluatorOptions); 65856 JpegStream.setOptions(evaluatorOptions); 65857 OperatorList.setOptions(evaluatorOptions); 65858 const options = { 65859 ...evaluatorOptions, 65860 handler 65861 }; 65862 JpxImage.setOptions(options); 65863 IccColorSpace.setOptions(options); 65864 CmykICCBasedCS.setOptions(options); 65865 JBig2CCITTFaxImage.setOptions(options); 65866 PDFFunctionFactory.setOptions(options); 65867 Pattern.setOptions(options); 65868 } 65869 get docId() { 65870 return this._docId; 65871 } 65872 get password() { 65873 return this._password; 65874 } 65875 get docBaseUrl() { 65876 return this._docBaseUrl; 65877 } 65878 ensureDoc(prop, args) { 65879 return this.ensure(this.pdfDocument, prop, args); 65880 } 65881 ensureXRef(prop, args) { 65882 return this.ensure(this.pdfDocument.xref, prop, args); 65883 } 65884 ensureCatalog(prop, args) { 65885 return this.ensure(this.pdfDocument.catalog, prop, args); 65886 } 65887 getPage(pageIndex) { 65888 return this.pdfDocument.getPage(pageIndex); 65889 } 65890 fontFallback(id, handler) { 65891 return this.pdfDocument.fontFallback(id, handler); 65892 } 65893 cleanup(manuallyTriggered = false) { 65894 return this.pdfDocument.cleanup(manuallyTriggered); 65895 } 65896 async ensure(obj, prop, args) { 65897 unreachable("Abstract method `ensure` called"); 65898 } 65899 requestRange(begin, end) { 65900 unreachable("Abstract method `requestRange` called"); 65901 } 65902 requestLoadedStream(noFetch = false) { 65903 unreachable("Abstract method `requestLoadedStream` called"); 65904 } 65905 sendProgressiveData(chunk) { 65906 unreachable("Abstract method `sendProgressiveData` called"); 65907 } 65908 updatePassword(password) { 65909 this._password = password; 65910 } 65911 terminate(reason) { 65912 unreachable("Abstract method `terminate` called"); 65913 } 65914} 65915class LocalPdfManager extends BasePdfManager { 65916 constructor(args) { 65917 super(args); 65918 const stream = new Stream(args.source); 65919 this.pdfDocument = new PDFDocument(this, stream); 65920 this._loadedStreamPromise = Promise.resolve(stream); 65921 } 65922 async ensure(obj, prop, args) { 65923 const value = obj[prop]; 65924 if (typeof value === "function") { 65925 return value.apply(obj, args); 65926 } 65927 return value; 65928 } 65929 requestRange(begin, end) { 65930 return Promise.resolve(); 65931 } 65932 requestLoadedStream(noFetch = false) { 65933 return this._loadedStreamPromise; 65934 } 65935 terminate(reason) {} 65936} 65937class NetworkPdfManager extends BasePdfManager { 65938 constructor(args) { 65939 super(args); 65940 this.streamManager = new ChunkedStreamManager(args.source, { 65941 msgHandler: args.handler, 65942 length: args.length, 65943 disableAutoFetch: args.disableAutoFetch, 65944 rangeChunkSize: args.rangeChunkSize 65945 }); 65946 this.pdfDocument = new PDFDocument(this, this.streamManager.getStream()); 65947 } 65948 async ensure(obj, prop, args) { 65949 try { 65950 const value = obj[prop]; 65951 if (typeof value === "function") { 65952 return await value.apply(obj, args); 65953 } 65954 return value; 65955 } catch (ex) { 65956 if (!(ex instanceof MissingDataException)) { 65957 throw ex; 65958 } 65959 await this.requestRange(ex.begin, ex.end); 65960 return this.ensure(obj, prop, args); 65961 } 65962 } 65963 requestRange(begin, end) { 65964 return this.streamManager.requestRange(begin, end); 65965 } 65966 requestLoadedStream(noFetch = false) { 65967 return this.streamManager.requestAllChunks(noFetch); 65968 } 65969 sendProgressiveData(chunk) { 65970 this.streamManager.onReceiveData({ 65971 chunk 65972 }); 65973 } 65974 terminate(reason) { 65975 this.streamManager.abort(reason); 65976 } 65977} 65978 65979// EXTERNAL MODULE: ./node_modules/core-js/modules/es.promise.try.js 65980var es_promise_try = __webpack_require__(1689); 65981;// ./src/shared/message_handler.js 65982 65983 65984 65985const CallbackKind = { 65986 DATA: 1, 65987 ERROR: 2 65988}; 65989const StreamKind = { 65990 CANCEL: 1, 65991 CANCEL_COMPLETE: 2, 65992 CLOSE: 3, 65993 ENQUEUE: 4, 65994 ERROR: 5, 65995 PULL: 6, 65996 PULL_COMPLETE: 7, 65997 START_COMPLETE: 8 65998}; 65999function onFn() {} 66000function wrapReason(ex) { 66001 if (ex instanceof AbortException || ex instanceof InvalidPDFException || ex instanceof PasswordException || ex instanceof ResponseException || ex instanceof UnknownErrorException) { 66002 return ex; 66003 } 66004 if (!(ex instanceof Error || typeof ex === "object" && ex !== null)) { 66005 unreachable('wrapReason: Expected "reason" to be a (possibly cloned) Error.'); 66006 } 66007 switch (ex.name) { 66008 case "AbortException": 66009 return new AbortException(ex.message); 66010 case "InvalidPDFException": 66011 return new InvalidPDFException(ex.message); 66012 case "PasswordException": 66013 return new PasswordException(ex.message, ex.code); 66014 case "ResponseException": 66015 return new ResponseException(ex.message, ex.status, ex.missing); 66016 case "UnknownErrorException": 66017 return new UnknownErrorException(ex.message, ex.details); 66018 } 66019 return new UnknownErrorException(ex.message, ex.toString()); 66020} 66021class MessageHandler { 66022 #messageAC = new AbortController(); 66023 constructor(sourceName, targetName, comObj) { 66024 this.sourceName = sourceName; 66025 this.targetName = targetName; 66026 this.comObj = comObj; 66027 this.callbackId = 1; 66028 this.streamId = 1; 66029 this.streamSinks = Object.create(null); 66030 this.streamControllers = Object.create(null); 66031 this.callbackCapabilities = Object.create(null); 66032 this.actionHandler = Object.create(null); 66033 comObj.addEventListener("message", this.#onMessage.bind(this), { 66034 signal: this.#messageAC.signal 66035 }); 66036 } 66037 #onMessage({ 66038 data 66039 }) { 66040 if (data.targetName !== this.sourceName) { 66041 return; 66042 } 66043 if (data.stream) { 66044 this.#processStreamMessage(data); 66045 return; 66046 } 66047 if (data.callback) { 66048 const callbackId = data.callbackId; 66049 const capability = this.callbackCapabilities[callbackId]; 66050 if (!capability) { 66051 throw new Error(`Cannot resolve callback ${callbackId}`); 66052 } 66053 delete this.callbackCapabilities[callbackId]; 66054 if (data.callback === CallbackKind.DATA) { 66055 capability.resolve(data.data); 66056 } else if (data.callback === CallbackKind.ERROR) { 66057 capability.reject(wrapReason(data.reason)); 66058 } else { 66059 throw new Error("Unexpected callback case"); 66060 } 66061 return; 66062 } 66063 const action = this.actionHandler[data.action]; 66064 if (!action) { 66065 throw new Error(`Unknown action from worker: ${data.action}`); 66066 } 66067 if (data.callbackId) { 66068 const sourceName = this.sourceName, 66069 targetName = data.sourceName, 66070 comObj = this.comObj; 66071 Promise.try(action, data.data).then(function (result) { 66072 comObj.postMessage({ 66073 sourceName, 66074 targetName, 66075 callback: CallbackKind.DATA, 66076 callbackId: data.callbackId, 66077 data: result 66078 }); 66079 }, function (reason) { 66080 comObj.postMessage({ 66081 sourceName, 66082 targetName, 66083 callback: CallbackKind.ERROR, 66084 callbackId: data.callbackId, 66085 reason: wrapReason(reason) 66086 }); 66087 }); 66088 return; 66089 } 66090 if (data.streamId) { 66091 this.#createStreamSink(data); 66092 return; 66093 } 66094 action(data.data); 66095 } 66096 on(actionName, handler) { 66097 const ah = this.actionHandler; 66098 if (ah[actionName]) { 66099 throw new Error(`There is already an actionName called "${actionName}"`); 66100 } 66101 ah[actionName] = handler; 66102 } 66103 send(actionName, data, transfers) { 66104 this.comObj.postMessage({ 66105 sourceName: this.sourceName, 66106 targetName: this.targetName, 66107 action: actionName, 66108 data 66109 }, transfers); 66110 }
vendor: 32,457 bytes, lines 66111-67236
66111 sendWithPromise(actionName, data, transfers) { 66112 const callbackId = this.callbackId++; 66113 const capability = Promise.withResolvers(); 66114 this.callbackCapabilities[callbackId] = capability; 66115 try { 66116 this.comObj.postMessage({ 66117 sourceName: this.sourceName, 66118 targetName: this.targetName, 66119 action: actionName, 66120 callbackId, 66121 data 66122 }, transfers); 66123 } catch (ex) { 66124 capability.reject(ex); 66125 } 66126 return capability.promise; 66127 } 66128 sendWithStream(actionName, data, queueingStrategy, transfers) { 66129 const streamId = this.streamId++, 66130 sourceName = this.sourceName, 66131 targetName = this.targetName, 66132 comObj = this.comObj; 66133 return new ReadableStream({ 66134 start: controller => { 66135 const startCapability = Promise.withResolvers(); 66136 this.streamControllers[streamId] = { 66137 controller, 66138 startCall: startCapability, 66139 pullCall: null, 66140 cancelCall: null, 66141 isClosed: false 66142 }; 66143 comObj.postMessage({ 66144 sourceName, 66145 targetName, 66146 action: actionName, 66147 streamId, 66148 data, 66149 desiredSize: controller.desiredSize 66150 }, transfers); 66151 return startCapability.promise; 66152 }, 66153 pull: controller => { 66154 const pullCapability = Promise.withResolvers(); 66155 this.streamControllers[streamId].pullCall = pullCapability; 66156 comObj.postMessage({ 66157 sourceName, 66158 targetName, 66159 stream: StreamKind.PULL, 66160 streamId, 66161 desiredSize: controller.desiredSize 66162 }); 66163 return pullCapability.promise; 66164 }, 66165 cancel: reason => { 66166 assert(reason instanceof Error, "cancel must have a valid reason"); 66167 const cancelCapability = Promise.withResolvers(); 66168 this.streamControllers[streamId].cancelCall = cancelCapability; 66169 this.streamControllers[streamId].isClosed = true; 66170 comObj.postMessage({ 66171 sourceName, 66172 targetName, 66173 stream: StreamKind.CANCEL, 66174 streamId, 66175 reason: wrapReason(reason) 66176 }); 66177 return cancelCapability.promise; 66178 } 66179 }, queueingStrategy); 66180 } 66181 #createStreamSink(data) { 66182 const streamId = data.streamId, 66183 sourceName = this.sourceName, 66184 targetName = data.sourceName, 66185 comObj = this.comObj; 66186 const self = this, 66187 action = this.actionHandler[data.action]; 66188 const streamSink = { 66189 enqueue(chunk, size = 1, transfers) { 66190 if (this.isCancelled) { 66191 return; 66192 } 66193 const lastDesiredSize = this.desiredSize; 66194 this.desiredSize -= size; 66195 if (lastDesiredSize > 0 && this.desiredSize <= 0) { 66196 this.sinkCapability = Promise.withResolvers(); 66197 this.ready = this.sinkCapability.promise; 66198 } 66199 comObj.postMessage({ 66200 sourceName, 66201 targetName, 66202 stream: StreamKind.ENQUEUE, 66203 streamId, 66204 chunk 66205 }, transfers); 66206 }, 66207 close() { 66208 if (this.isCancelled) { 66209 return; 66210 } 66211 this.isCancelled = true; 66212 comObj.postMessage({ 66213 sourceName, 66214 targetName, 66215 stream: StreamKind.CLOSE, 66216 streamId 66217 }); 66218 delete self.streamSinks[streamId]; 66219 }, 66220 error(reason) { 66221 assert(reason instanceof Error, "error must have a valid reason"); 66222 if (this.isCancelled) { 66223 return; 66224 } 66225 this.isCancelled = true; 66226 comObj.postMessage({ 66227 sourceName, 66228 targetName, 66229 stream: StreamKind.ERROR, 66230 streamId, 66231 reason: wrapReason(reason) 66232 }); 66233 }, 66234 sinkCapability: Promise.withResolvers(), 66235 onPull: null, 66236 onCancel: null, 66237 isCancelled: false, 66238 desiredSize: data.desiredSize, 66239 ready: null 66240 }; 66241 streamSink.sinkCapability.resolve(); 66242 streamSink.ready = streamSink.sinkCapability.promise; 66243 this.streamSinks[streamId] = streamSink; 66244 Promise.try(action, data.data, streamSink).then(function () { 66245 comObj.postMessage({ 66246 sourceName, 66247 targetName, 66248 stream: StreamKind.START_COMPLETE, 66249 streamId, 66250 success: true 66251 }); 66252 }, function (reason) { 66253 comObj.postMessage({ 66254 sourceName, 66255 targetName, 66256 stream: StreamKind.START_COMPLETE, 66257 streamId, 66258 reason: wrapReason(reason) 66259 }); 66260 }); 66261 } 66262 #processStreamMessage(data) { 66263 const streamId = data.streamId, 66264 sourceName = this.sourceName, 66265 targetName = data.sourceName, 66266 comObj = this.comObj; 66267 const streamController = this.streamControllers[streamId], 66268 streamSink = this.streamSinks[streamId]; 66269 switch (data.stream) { 66270 case StreamKind.START_COMPLETE: 66271 if (data.success) { 66272 streamController.startCall.resolve(); 66273 } else { 66274 streamController.startCall.reject(wrapReason(data.reason)); 66275 } 66276 break; 66277 case StreamKind.PULL_COMPLETE: 66278 if (data.success) { 66279 streamController.pullCall.resolve(); 66280 } else { 66281 streamController.pullCall.reject(wrapReason(data.reason)); 66282 } 66283 break; 66284 case StreamKind.PULL: 66285 if (!streamSink) { 66286 comObj.postMessage({ 66287 sourceName, 66288 targetName, 66289 stream: StreamKind.PULL_COMPLETE, 66290 streamId, 66291 success: true 66292 }); 66293 break; 66294 } 66295 if (streamSink.desiredSize <= 0 && data.desiredSize > 0) { 66296 streamSink.sinkCapability.resolve(); 66297 } 66298 streamSink.desiredSize = data.desiredSize; 66299 Promise.try(streamSink.onPull || onFn).then(function () { 66300 comObj.postMessage({ 66301 sourceName, 66302 targetName, 66303 stream: StreamKind.PULL_COMPLETE, 66304 streamId, 66305 success: true 66306 }); 66307 }, function (reason) { 66308 comObj.postMessage({ 66309 sourceName, 66310 targetName, 66311 stream: StreamKind.PULL_COMPLETE, 66312 streamId, 66313 reason: wrapReason(reason) 66314 }); 66315 }); 66316 break; 66317 case StreamKind.ENQUEUE: 66318 assert(streamController, "enqueue should have stream controller"); 66319 if (streamController.isClosed) { 66320 break; 66321 } 66322 streamController.controller.enqueue(data.chunk); 66323 break; 66324 case StreamKind.CLOSE: 66325 assert(streamController, "close should have stream controller"); 66326 if (streamController.isClosed) { 66327 break; 66328 } 66329 streamController.isClosed = true; 66330 streamController.controller.close(); 66331 this.#deleteStreamController(streamController, streamId); 66332 break; 66333 case StreamKind.ERROR: 66334 assert(streamController, "error should have stream controller"); 66335 streamController.controller.error(wrapReason(data.reason)); 66336 this.#deleteStreamController(streamController, streamId); 66337 break; 66338 case StreamKind.CANCEL_COMPLETE: 66339 if (data.success) { 66340 streamController.cancelCall.resolve(); 66341 } else { 66342 streamController.cancelCall.reject(wrapReason(data.reason)); 66343 } 66344 this.#deleteStreamController(streamController, streamId); 66345 break; 66346 case StreamKind.CANCEL: 66347 if (!streamSink) { 66348 break; 66349 } 66350 const dataReason = wrapReason(data.reason); 66351 Promise.try(streamSink.onCancel || onFn, dataReason).then(function () { 66352 comObj.postMessage({ 66353 sourceName, 66354 targetName, 66355 stream: StreamKind.CANCEL_COMPLETE, 66356 streamId, 66357 success: true 66358 }); 66359 }, function (reason) { 66360 comObj.postMessage({ 66361 sourceName, 66362 targetName, 66363 stream: StreamKind.CANCEL_COMPLETE, 66364 streamId, 66365 reason: wrapReason(reason) 66366 }); 66367 }); 66368 streamSink.sinkCapability.reject(dataReason); 66369 streamSink.isCancelled = true; 66370 delete this.streamSinks[streamId]; 66371 break; 66372 default: 66373 throw new Error("Unexpected stream case"); 66374 } 66375 } 66376 async #deleteStreamController(streamController, streamId) { 66377 await Promise.allSettled([streamController.startCall?.promise, streamController.pullCall?.promise, streamController.cancelCall?.promise]); 66378 delete this.streamControllers[streamId]; 66379 } 66380 destroy() { 66381 this.#messageAC?.abort(); 66382 this.#messageAC = null; 66383 } 66384} 66385 66386;// ./src/core/writer.js 66387 66388 66389 66390 66391 66392 66393 66394 66395 66396 66397 66398 66399 66400 66401 66402 66403 66404 66405 66406async function writeObject(ref, obj, buffer, { 66407 encrypt = null, 66408 encryptRef = null 66409}) { 66410 const transform = encrypt && encryptRef !== ref ? encrypt.createCipherTransform(ref.num, ref.gen) : null; 66411 buffer.push(`${ref.num} ${ref.gen} obj\n`); 66412 await writeValue(obj, buffer, transform); 66413 buffer.push("\nendobj\n"); 66414} 66415async function writeDict(dict, buffer, transform) { 66416 buffer.push("<<"); 66417 for (const [key, rawObj] of dict.getRawEntries()) { 66418 buffer.push(` /${escapePDFName(key)} `); 66419 await writeValue(rawObj, buffer, transform); 66420 } 66421 buffer.push(">>"); 66422} 66423async function writeStream(stream, buffer, transform) { 66424 stream = stream.getOriginalStream(); 66425 stream.reset(); 66426 let bytes = stream.getBytes(); 66427 const { 66428 dict 66429 } = stream; 66430 const [filter, params] = await Promise.all([dict.getAsync("Filter"), dict.getAsync("DecodeParms")]); 66431 const filterZero = Array.isArray(filter) ? await dict.xref.fetchIfRefAsync(filter[0]) : filter; 66432 const isFilterZeroFlateDecode = isName(filterZero, "FlateDecode"); 66433 const MIN_LENGTH_FOR_COMPRESSING = 256; 66434 if (bytes.length >= MIN_LENGTH_FOR_COMPRESSING && !isFilterZeroFlateDecode) { 66435 try { 66436 const cs = new CompressionStream("deflate"); 66437 const writer = cs.writable.getWriter(); 66438 await writer.ready; 66439 writer.write(bytes).then(async () => { 66440 await writer.ready; 66441 await writer.close(); 66442 }).catch(() => {}); 66443 bytes = await new Response(cs.readable).bytes(); 66444 let newFilter, newParams; 66445 if (!filter) { 66446 newFilter = Name.get("FlateDecode"); 66447 } else if (!isFilterZeroFlateDecode) { 66448 newFilter = Array.isArray(filter) ? [Name.get("FlateDecode"), ...filter] : [Name.get("FlateDecode"), filter]; 66449 if (params) { 66450 newParams = Array.isArray(params) ? [null, ...params] : [null, params]; 66451 } 66452 } 66453 if (newFilter) { 66454 dict.set("Filter", newFilter); 66455 } 66456 if (newParams) { 66457 dict.set("DecodeParms", newParams); 66458 } 66459 } catch (ex) { 66460 info(`writeStream - cannot compress data: "${ex}".`); 66461 } 66462 } 66463 let string = bytesToString(bytes); 66464 if (transform) { 66465 string = transform.encryptString(string); 66466 } 66467 dict.set("Length", string.length); 66468 await writeDict(dict, buffer, transform); 66469 buffer.push(" stream\n", string, "\nendstream"); 66470} 66471async function writeArray(array, buffer, transform) { 66472 buffer.push("["); 66473 for (let i = 0, ii = array.length; i < ii; i++) { 66474 await writeValue(array[i], buffer, transform); 66475 if (i < ii - 1) { 66476 buffer.push(" "); 66477 } 66478 } 66479 buffer.push("]"); 66480} 66481async function writeValue(value, buffer, transform) { 66482 if (value instanceof Name) { 66483 buffer.push(`/${escapePDFName(value.name)}`); 66484 } else if (value instanceof Ref) { 66485 buffer.push(`${value.num} ${value.gen} R`); 66486 } else if (Array.isArray(value) || ArrayBuffer.isView(value)) { 66487 await writeArray(value, buffer, transform); 66488 } else if (typeof value === "string") { 66489 if (transform) { 66490 value = transform.encryptString(value); 66491 } 66492 buffer.push(`(${escapeString(value)})`); 66493 } else if (typeof value === "number") { 66494 buffer.push(value.toFixed(10).replace(/\.?0+$/, "")); 66495 } else if (typeof value === "boolean") { 66496 buffer.push(value.toString()); 66497 } else if (value instanceof Dict) { 66498 await writeDict(value, buffer, transform); 66499 } else if (value instanceof BaseStream) { 66500 await writeStream(value, buffer, transform); 66501 } else if (value === null) { 66502 buffer.push("null"); 66503 } else { 66504 warn(`Unhandled value in writer: ${typeof value}, please file a bug.`); 66505 } 66506} 66507function writeInt(number, size, offset, buffer) { 66508 for (let i = size + offset - 1; i > offset - 1; i--) { 66509 buffer[i] = number & 0xff; 66510 number >>= 8; 66511 } 66512 return offset + size; 66513} 66514function writeString(string, offset, buffer) { 66515 const ii = string.length; 66516 for (let i = 0; i < ii; i++) { 66517 buffer[offset + i] = string.charCodeAt(i) & 0xff; 66518 } 66519 return offset + ii; 66520} 66521function computeMD5(filesize, xrefInfo) { 66522 const time = Math.floor(Date.now() / 1000); 66523 const filename = xrefInfo.filename || ""; 66524 const md5Buffer = [time.toString(), filename, filesize.toString(), ...xrefInfo.infoMap.values()]; 66525 const md5BufferLen = Math.sumPrecise(md5Buffer.map(str => str.length)); 66526 const array = new Uint8Array(md5BufferLen); 66527 let offset = 0; 66528 for (const str of md5Buffer) { 66529 offset = writeString(str, offset, array); 66530 } 66531 return bytesToString(calculateMD5(array, 0, array.length)); 66532} 66533function writeXFADataForAcroform(str, changes) { 66534 const xml = new SimpleXMLParser({ 66535 hasAttributes: true 66536 }).parseFromString(str); 66537 for (const { 66538 xfa 66539 } of changes) { 66540 if (!xfa) { 66541 continue; 66542 } 66543 const { 66544 path, 66545 value 66546 } = xfa; 66547 if (!path) { 66548 continue; 66549 } 66550 const nodePath = parseXFAPath(path); 66551 let node = xml.documentElement.searchNode(nodePath, 0); 66552 if (!node && nodePath.length > 1) { 66553 node = xml.documentElement.searchNode([nodePath.at(-1)], 0); 66554 } 66555 if (node) { 66556 node.childNodes = Array.isArray(value) ? value.map(val => new SimpleDOMNode("value", val)) : [new SimpleDOMNode("#text", value)]; 66557 } else { 66558 warn(`Node not found for path: ${path}`); 66559 } 66560 } 66561 const buffer = []; 66562 xml.documentElement.dump(buffer); 66563 return buffer.join(""); 66564} 66565async function updateAcroform({ 66566 xref, 66567 acroForm, 66568 acroFormRef, 66569 hasXfa, 66570 hasXfaDatasetsEntry, 66571 xfaDatasetsRef, 66572 needAppearances, 66573 changes 66574}) { 66575 if (hasXfa && !hasXfaDatasetsEntry && !xfaDatasetsRef) { 66576 warn("XFA - Cannot save it"); 66577 } 66578 if (!needAppearances && (!hasXfa || !xfaDatasetsRef || hasXfaDatasetsEntry)) { 66579 return; 66580 } 66581 const dict = acroForm.clone(); 66582 if (hasXfa && !hasXfaDatasetsEntry) { 66583 const newXfa = acroForm.get("XFA").slice(); 66584 newXfa.splice(2, 0, "datasets"); 66585 newXfa.splice(3, 0, xfaDatasetsRef); 66586 dict.set("XFA", newXfa); 66587 } 66588 if (needAppearances) { 66589 dict.set("NeedAppearances", true); 66590 } 66591 changes.put(acroFormRef, { 66592 data: dict 66593 }); 66594} 66595function updateXFA({ 66596 xfaData, 66597 xfaDatasetsRef, 66598 changes, 66599 xref 66600}) { 66601 if (xfaData === null) { 66602 const datasets = xref.fetchIfRef(xfaDatasetsRef); 66603 xfaData = writeXFADataForAcroform(datasets.getString(), changes); 66604 } 66605 const xfaDataStream = new StringStream(xfaData); 66606 xfaDataStream.dict = new Dict(xref); 66607 xfaDataStream.dict.setIfName("Type", "EmbeddedFile"); 66608 changes.put(xfaDatasetsRef, { 66609 data: xfaDataStream 66610 }); 66611} 66612async function getXRefTable(xrefInfo, baseOffset, newRefs, newXref, buffer) { 66613 buffer.push("xref\n"); 66614 const indexes = getIndexes(newRefs); 66615 let indexesPosition = 0; 66616 for (const { 66617 ref, 66618 data 66619 } of newRefs) { 66620 if (ref.num === indexes[indexesPosition]) { 66621 buffer.push(`${indexes[indexesPosition]} ${indexes[indexesPosition + 1]}\n`); 66622 indexesPosition += 2; 66623 } 66624 if (data !== null) { 66625 buffer.push(`${baseOffset.toString().padStart(10, "0")} ${Math.min(ref.gen, 0xffff).toString().padStart(5, "0")} n\r\n`); 66626 baseOffset += data.length; 66627 } else { 66628 buffer.push(`0000000000 ${Math.min(ref.gen + 1, 0xffff).toString().padStart(5, "0")} f\r\n`); 66629 } 66630 } 66631 computeIDs(baseOffset, xrefInfo, newXref); 66632 buffer.push("trailer\n"); 66633 await writeDict(newXref, buffer, null); 66634 buffer.push("\nstartxref\n", baseOffset.toString(), "\n%%EOF\n"); 66635} 66636function getIndexes(newRefs) { 66637 const indexes = []; 66638 for (const { 66639 ref 66640 } of newRefs) { 66641 if (ref.num === indexes.at(-2) + indexes.at(-1)) { 66642 indexes[indexes.length - 1] += 1; 66643 } else { 66644 indexes.push(ref.num, 1); 66645 } 66646 } 66647 return indexes; 66648} 66649async function getXRefStreamTable(xrefInfo, baseOffset, newRefs, newXref, buffer) { 66650 const xrefTableData = []; 66651 let maxOffset = 0; 66652 let maxGen = 0; 66653 for (const { 66654 ref, 66655 data, 66656 objStreamRef, 66657 index 66658 } of newRefs) { 66659 let gen; 66660 maxOffset = Math.max(maxOffset, baseOffset); 66661 if (objStreamRef) { 66662 gen = index; 66663 xrefTableData.push([2, objStreamRef.num, gen]); 66664 } else if (data !== null) { 66665 gen = Math.min(ref.gen, 0xffff); 66666 xrefTableData.push([1, baseOffset, gen]); 66667 baseOffset += data.length; 66668 } else { 66669 gen = Math.min(ref.gen + 1, 0xffff); 66670 xrefTableData.push([0, 0, gen]); 66671 } 66672 maxGen = Math.max(maxGen, gen); 66673 } 66674 newXref.set("Index", getIndexes(newRefs)); 66675 const offsetSize = getSizeInBytes(maxOffset); 66676 const maxGenSize = getSizeInBytes(maxGen); 66677 const sizes = [1, offsetSize, maxGenSize]; 66678 newXref.set("W", sizes); 66679 computeIDs(baseOffset, xrefInfo, newXref); 66680 const structSize = Math.sumPrecise(sizes); 66681 const data = new Uint8Array(structSize * xrefTableData.length); 66682 const stream = new Stream(data); 66683 stream.dict = newXref; 66684 let offset = 0; 66685 for (const [type, objOffset, gen] of xrefTableData) { 66686 offset = writeInt(type, sizes[0], offset, data); 66687 offset = writeInt(objOffset, sizes[1], offset, data); 66688 offset = writeInt(gen, sizes[2], offset, data); 66689 } 66690 await writeObject(xrefInfo.newRef, stream, buffer, {}); 66691 buffer.push("startxref\n", baseOffset.toString(), "\n%%EOF\n"); 66692} 66693function computeIDs(baseOffset, xrefInfo, newXref) { 66694 if (Array.isArray(xrefInfo.fileIds) && xrefInfo.fileIds.length > 0) { 66695 const md5 = computeMD5(baseOffset, xrefInfo); 66696 newXref.set("ID", [xrefInfo.fileIds[0] || md5, md5]); 66697 } 66698} 66699function getTrailerDict(xrefInfo, changes, useXrefStream) { 66700 const newXref = new Dict(null); 66701 newXref.setIfDefined("Prev", xrefInfo?.startXRef); 66702 const refForXrefTable = xrefInfo.newRef; 66703 if (useXrefStream) { 66704 changes.put(refForXrefTable, { 66705 data: "" 66706 }); 66707 newXref.set("Size", refForXrefTable.num + 1); 66708 newXref.setIfName("Type", "XRef"); 66709 } else { 66710 newXref.set("Size", refForXrefTable.num); 66711 } 66712 newXref.setIfDefined("Root", xrefInfo?.rootRef); 66713 newXref.setIfDefined("Info", xrefInfo?.infoRef); 66714 newXref.setIfDefined("Encrypt", xrefInfo?.encryptRef); 66715 return newXref; 66716} 66717async function writeChanges(changes, xref, buffer = []) { 66718 const newRefs = []; 66719 for (const [ref, { 66720 data, 66721 objStreamRef, 66722 index 66723 }] of changes.items()) { 66724 if (objStreamRef) { 66725 newRefs.push({ 66726 ref, 66727 data, 66728 objStreamRef, 66729 index 66730 }); 66731 continue; 66732 } 66733 if (data === null || typeof data === "string") { 66734 newRefs.push({ 66735 ref, 66736 data 66737 }); 66738 continue; 66739 } 66740 await writeObject(ref, data, buffer, xref); 66741 newRefs.push({ 66742 ref, 66743 data: buffer.join("") 66744 }); 66745 buffer.length = 0; 66746 } 66747 return newRefs.sort((a, b) => a.ref.num - b.ref.num); 66748} 66749async function incrementalUpdate({ 66750 originalData, 66751 xrefInfo, 66752 changes, 66753 xref = null, 66754 hasXfa = false, 66755 xfaDatasetsRef = null, 66756 hasXfaDatasetsEntry = false, 66757 needAppearances, 66758 acroFormRef = null, 66759 acroForm = null, 66760 xfaData = null, 66761 useXrefStream = false 66762}) { 66763 await updateAcroform({ 66764 xref, 66765 acroForm, 66766 acroFormRef, 66767 hasXfa, 66768 hasXfaDatasetsEntry, 66769 xfaDatasetsRef, 66770 needAppearances, 66771 changes 66772 }); 66773 if (hasXfa) { 66774 updateXFA({ 66775 xfaData, 66776 xfaDatasetsRef, 66777 changes, 66778 xref 66779 }); 66780 } 66781 const newXref = getTrailerDict(xrefInfo, changes, useXrefStream); 66782 const buffer = []; 66783 const newRefs = await writeChanges(changes, xref, buffer); 66784 let baseOffset = originalData.length; 66785 const lastByte = originalData.at(-1); 66786 if (lastByte !== 0x0a && lastByte !== 0x0d) { 66787 buffer.push("\n"); 66788 baseOffset += 1; 66789 } 66790 for (const { 66791 data 66792 } of newRefs) { 66793 if (data !== null) { 66794 buffer.push(data); 66795 } 66796 } 66797 await (useXrefStream ? getXRefStreamTable(xrefInfo, baseOffset, newRefs, newXref, buffer) : getXRefTable(xrefInfo, baseOffset, newRefs, newXref, buffer)); 66798 const totalLength = originalData.length + Math.sumPrecise(buffer.map(str => str.length)); 66799 const array = new Uint8Array(totalLength); 66800 array.set(originalData); 66801 let offset = originalData.length; 66802 for (const str of buffer) { 66803 offset = writeString(str, offset, array); 66804 } 66805 return array; 66806} 66807 66808;// ./src/core/editor/pdf_editor.js 66809 66810 66811 66812 66813 66814 66815 66816 66817 66818 66819 66820 66821 66822 66823 66824 66825 66826 66827 66828 66829 66830 66831 66832const MAX_LEAVES_PER_PAGES_NODE = 16; 66833const MAX_IN_NAME_TREE_NODE = 64; 66834class PageData { 66835 constructor(page, documentData) { 66836 this.page = page; 66837 this.documentData = documentData; 66838 this.annotations = null; 66839 this.pointingNamedDestinations = null; 66840 documentData.pagesMap.put(page.ref, this); 66841 } 66842} 66843class DocumentData { 66844 constructor(document) { 66845 this.document = document; 66846 this.destinations = null; 66847 this.pageLabels = null; 66848 this.pagesMap = new RefSetCache(); 66849 this.oldRefMapping = new RefSetCache(); 66850 this.dedupNamedDestinations = new Map(); 66851 this.usedNamedDestinations = new Set(); 66852 this.postponedRefCopies = new RefSetCache(); 66853 this.usedStructParents = new Set(); 66854 this.oldStructParentMapping = new Map(); 66855 this.structTreeRoot = null; 66856 this.parentTree = null; 66857 this.idTree = null; 66858 this.roleMap = null; 66859 this.classMap = null; 66860 this.namespaces = null; 66861 this.structTreeAF = null; 66862 this.structTreePronunciationLexicon = []; 66863 this.acroForm = null; 66864 this.acroFormDefaultAppearance = ""; 66865 this.acroFormDefaultResources = null; 66866 this.acroFormQ = 0; 66867 this.hasSignatureAnnotations = false; 66868 this.fieldToParent = new RefSetCache(); 66869 this.outline = null; 66870 this.embeddedFiles = null; 66871 } 66872} 66873class XRefWrapper { 66874 constructor(entries, getNewRef) { 66875 this.entries = entries; 66876 this._getNewRef = getNewRef; 66877 } 66878 fetch(ref) { 66879 return ref instanceof Ref ? this.entries[ref.num] : ref; 66880 } 66881 fetchIfRefAsync(ref) { 66882 return Promise.resolve(this.fetch(ref)); 66883 } 66884 fetchIfRef(ref) { 66885 return this.fetch(ref); 66886 } 66887 fetchAsync(ref) { 66888 return Promise.resolve(this.fetch(ref)); 66889 } 66890 getNewTemporaryRef() { 66891 return this._getNewRef(); 66892 } 66893} 66894class PDFEditor { 66895 hasSingleFile = false; 66896 isSingleFile = false; 66897 #newAnnotationsParams = null; 66898 currentDocument = null; 66899 oldPages = []; 66900 newPages = []; 66901 xref = [null]; 66902 xrefWrapper = new XRefWrapper(this.xref, () => this.newRef); 66903 newRefCount = 1; 66904 namesDict = null; 66905 version = "1.7"; 66906 pageLabels = null; 66907 namedDestinations = new Map(); 66908 parentTree = new Map(); 66909 structTreeKids = []; 66910 idTree = new Map(); 66911 classMap = new Dict(); 66912 roleMap = new Dict(); 66913 namespaces = new Map(); 66914 structTreeAF = []; 66915 structTreePronunciationLexicon = []; 66916 fields = []; 66917 acroFormDefaultAppearance = ""; 66918 acroFormDefaultResources = null; 66919 acroFormNeedAppearances = false; 66920 acroFormSigFlags = 0; 66921 acroFormCalculationOrder = null; 66922 acroFormQ = 0; 66923 outlineItems = null; 66924 embeddedFiles = new Map(); 66925 constructor({ 66926 useObjectStreams = true, 66927 title = "", 66928 author = "" 66929 } = {}) { 66930 [this.rootRef, this.rootDict] = this.newDict; 66931 [this.infoRef, this.infoDict] = this.newDict; 66932 [this.pagesRef, this.pagesDict] = this.newDict; 66933 this.useObjectStreams = useObjectStreams; 66934 this.objStreamRefs = useObjectStreams ? new Set() : null; 66935 this.title = title; 66936 this.author = author; 66937 } 66938 get newRef() { 66939 const ref = Ref.get(this.newRefCount++, 0); 66940 return ref; 66941 } 66942 get newDict() { 66943 const ref = this.newRef; 66944 const dict = this.xref[ref.num] = new Dict(); 66945 return [ref, dict]; 66946 } 66947 async #cloneObject(obj, xref) { 66948 const ref = this.newRef; 66949 this.xref[ref.num] = await this.#collectDependencies(obj, true, xref); 66950 return ref; 66951 } 66952 cloneDict(dict) { 66953 const newDict = dict.clone(); 66954 newDict.xref = this.xrefWrapper; 66955 return newDict; 66956 } 66957 async #collectDependencies(obj, mustClone, xref) { 66958 if (obj instanceof Ref) { 66959 const { 66960 currentDocument: { 66961 oldRefMapping 66962 } 66963 } = this; 66964 let newRef = oldRefMapping.get(obj); 66965 if (newRef) { 66966 return newRef; 66967 } 66968 const oldRef = obj; 66969 obj = await xref.fetchAsync(oldRef); 66970 if (typeof obj === "number") { 66971 return obj; 66972 } 66973 newRef = this.newRef; 66974 oldRefMapping.put(oldRef, newRef); 66975 this.xref[newRef.num] = await this.#collectDependencies(obj, true, xref); 66976 return newRef; 66977 } 66978 const promises = []; 66979 const { 66980 currentDocument: { 66981 postponedRefCopies 66982 } 66983 } = this; 66984 if (Array.isArray(obj)) { 66985 if (mustClone) { 66986 obj = obj.slice(); 66987 } 66988 for (let i = 0, ii = obj.length; i < ii; i++) { 66989 const postponedActions = obj[i] instanceof Ref && postponedRefCopies.get(obj[i]); 66990 if (postponedActions) { 66991 postponedActions.push(ref => obj[i] = ref); 66992 continue; 66993 } 66994 promises.push(this.#collectDependencies(obj[i], true, xref).then(newObj => obj[i] = newObj)); 66995 } 66996 await Promise.all(promises); 66997 return obj; 66998 } 66999 let dict; 67000 if (obj instanceof BaseStream) { 67001 ({ 67002 dict 67003 } = obj = obj.getOriginalStream().clone()); 67004 dict.xref = this.xrefWrapper; 67005 } else if (obj instanceof Dict) { 67006 if (mustClone) { 67007 obj = obj.clone(); 67008 obj.xref = this.xrefWrapper; 67009 } 67010 dict = obj; 67011 } 67012 if (dict) { 67013 for (const [key, rawObj] of dict.getRawEntries()) { 67014 const postponedActions = rawObj instanceof Ref && postponedRefCopies.get(rawObj); 67015 if (postponedActions) { 67016 postponedActions.push(ref => dict.set(key, ref)); 67017 continue; 67018 } 67019 promises.push(this.#collectDependencies(rawObj, true, xref).then(newObj => dict.set(key, newObj))); 67020 } 67021 await Promise.all(promises); 67022 } 67023 return obj; 67024 } 67025 async #cloneStructTreeNode(parentStructRef, node, xref, removedStructElements, dedupIDs, dedupClasses, dedupRoles, visited = new RefSet()) { 67026 const { 67027 currentDocument: { 67028 pagesMap, 67029 oldRefMapping 67030 } 67031 } = this; 67032 const pg = node.getRaw("Pg"); 67033 if (pg instanceof Ref && !pagesMap.has(pg)) { 67034 return null; 67035 } 67036 let kids; 67037 const k = kids = node.getRaw("K"); 67038 if (k instanceof Ref) { 67039 if (visited.has(k)) { 67040 return null; 67041 } 67042 kids = await xref.fetchAsync(k); 67043 if (!Array.isArray(kids)) { 67044 kids = [k]; 67045 } 67046 } 67047 kids = Array.isArray(kids) ? kids : [kids]; 67048 const newKids = []; 67049 const structElemIndices = []; 67050 for (let kid of kids) { 67051 const kidRef = kid instanceof Ref ? kid : null; 67052 if (kidRef) { 67053 if (visited.has(kidRef)) { 67054 continue; 67055 } 67056 visited.put(kidRef); 67057 kid = await xref.fetchAsync(kidRef); 67058 } 67059 if (typeof kid === "number") { 67060 newKids.push(kid); 67061 continue; 67062 } 67063 if (!(kid instanceof Dict)) { 67064 continue; 67065 } 67066 const pgRef = kid.getRaw("Pg"); 67067 if (pgRef instanceof Ref && !pagesMap.has(pgRef)) { 67068 continue; 67069 } 67070 const type = kid.get("Type"); 67071 if (!type || isName(type, "StructElem")) { 67072 let setAsSpan = false; 67073 if (kidRef && removedStructElements.has(kidRef)) { 67074 if (!isName(kid.get("S"), "Link")) { 67075 continue; 67076 } 67077 setAsSpan = true; 67078 } 67079 const newKidRef = await this.#cloneStructTreeNode(kidRef, kid, xref, removedStructElements, dedupIDs, dedupClasses, dedupRoles, visited); 67080 if (newKidRef) { 67081 structElemIndices.push(newKids.length); 67082 newKids.push(newKidRef); 67083 if (kidRef) { 67084 oldRefMapping.put(kidRef, newKidRef); 67085 } 67086 if (setAsSpan) { 67087 this.xref[newKidRef.num].setIfName("S", "Span"); 67088 } 67089 } 67090 continue; 67091 } 67092 if (isName(type, "OBJR")) { 67093 if (!kidRef) { 67094 continue; 67095 } 67096 const newKidRef = oldRefMapping.get(kidRef); 67097 if (!newKidRef) { 67098 continue; 67099 } 67100 const newKid = this.xref[newKidRef.num]; 67101 const objRef = newKid.getRaw("Obj"); 67102 if (objRef instanceof Ref) { 67103 const obj = this.xref[objRef.num]; 67104 if (obj instanceof Dict && !obj.has("StructParent") && parentStructRef) { 67105 const structParent = this.parentTree.size; 67106 this.parentTree.set(structParent, [oldRefMapping, parentStructRef]); 67107 obj.set("StructParent", structParent); 67108 } 67109 } 67110 newKids.push(newKidRef); 67111 continue; 67112 } 67113 if (isName(type, "MCR")) { 67114 const newKid = await this.#collectDependencies(kidRef || kid, true, xref); 67115 newKids.push(newKid); 67116 continue; 67117 } 67118 if (kidRef) { 67119 const newKidRef = await this.#collectDependencies(kidRef, true, xref); 67120 newKids.push(newKidRef); 67121 } 67122 } 67123 if (kids.length !== 0 && newKids.length === 0) { 67124 return null; 67125 } 67126 const newNodeRef = this.newRef; 67127 const newNode = this.xref[newNodeRef.num] = this.cloneDict(node); 67128 newNode.delete("ID"); 67129 newNode.delete("C"); 67130 newNode.delete("K"); 67131 newNode.delete("P"); 67132 newNode.delete("S"); 67133 await this.#collectDependencies(newNode, false, xref); 67134 const classNames = node.get("C"); 67135 if (classNames instanceof Name) { 67136 const newClassName = dedupClasses.get(classNames.name); 67137 if (newClassName) { 67138 newNode.set("C", Name.get(newClassName)); 67139 } else { 67140 newNode.set("C", classNames); 67141 } 67142 } else if (Array.isArray(classNames)) { 67143 const newClassNames = []; 67144 for (const className of classNames) { 67145 if (className instanceof Name) { 67146 const newClassName = dedupClasses.get(className.name); 67147 if (newClassName) { 67148 newClassNames.push(Name.get(newClassName)); 67149 } else { 67150 newClassNames.push(className); 67151 } 67152 } 67153 } 67154 newNode.set("C", newClassNames); 67155 } 67156 const roleName = node.get("S"); 67157 if (roleName instanceof Name) { 67158 const newRoleName = dedupRoles.get(roleName.name); 67159 if (newRoleName) { 67160 newNode.set("S", Name.get(newRoleName)); 67161 } else { 67162 newNode.set("S", roleName); 67163 } 67164 } 67165 const id = node.get("ID"); 67166 if (typeof id === "string") { 67167 const stringId = stringToPDFString(id, false); 67168 const newId = dedupIDs.get(stringId); 67169 if (newId) { 67170 newNode.set("ID", stringToAsciiOrUTF16BE(newId)); 67171 } else { 67172 newNode.set("ID", id); 67173 } 67174 } 67175 let attributes = newNode.get("A"); 67176 if (attributes) { 67177 if (!Array.isArray(attributes)) { 67178 attributes = [attributes]; 67179 } 67180 for (let attr of attributes) { 67181 attr = this.xrefWrapper.fetch(attr); 67182 if (isName(attr.get("O"), "Table") && attr.has("Headers")) { 67183 const headers = this.xrefWrapper.fetch(attr.getRaw("Headers")); 67184 if (Array.isArray(headers)) { 67185 for (let i = 0, ii = headers.length; i < ii; i++) { 67186 const newId = dedupIDs.get(stringToPDFString(headers[i], false)); 67187 if (newId) { 67188 headers[i] = newId; 67189 } 67190 } 67191 } 67192 } 67193 } 67194 } 67195 for (const index of structElemIndices) { 67196 const structElemRef = newKids[index]; 67197 const structElem = this.xref[structElemRef.num]; 67198 structElem.set("P", newNodeRef); 67199 } 67200 if (newKids.length === 1) { 67201 newNode.set("K", newKids[0]); 67202 } else if (newKids.length > 1) { 67203 newNode.set("K", newKids); 67204 } 67205 return newNodeRef; 67206 } 67207 #getFilteredPageIndices({ 67208 document, 67209 includePages, 67210 excludePages 67211 }) { 67212 if (!document) { 67213 return []; 67214 } 67215 let keptIndices, keptRanges, deletedIndices, deletedRanges; 67216 for (const page of includePages || []) { 67217 if (Array.isArray(page)) { 67218 (keptRanges ||= []).push(page); 67219 } else { 67220 (keptIndices ||= new Set()).add(page); 67221 } 67222 } 67223 for (const page of excludePages || []) { 67224 if (Array.isArray(page)) { 67225 (deletedRanges ||= []).push(page); 67226 } else { 67227 (deletedIndices ||= new Set()).add(page); 67228 } 67229 } 67230 const indices = []; 67231 for (let i = 0, ii = document.numPages; i < ii; i++) { 67232 if (deletedIndices?.has(i)) { 67233 continue; 67234 } 67235 if (deletedRanges) { 67236 let isDeleted = false;
67237 for (const [start, end] of deletedRanges) { 67238 if (i >= start && i <= end) { 67239 isDeleted = true; 67240 break; 67241 } 67242 } 67243 if (isDeleted) { 67244 continue; 67245 } 67246 } 67247 let takePage = false; 67248 if (keptIndices) { 67249 takePage = keptIndices.has(i); 67250 } 67251 if (!takePage && keptRanges) { 67252 for (const [start, end] of keptRanges) { 67253 if (i >= start && i <= end) { 67254 takePage = true; 67255 break; 67256 } 67257 } 67258 } 67259 if (!takePage && !keptIndices && !keptRanges) { 67260 takePage = true; 67261 } 67262 if (takePage) { 67263 indices.push(i); 67264 } 67265 } 67266 return indices; 67267 } 67268 #resolveInsertAfterIndices(pageInfos) { 67269 const sequence = []; 67270 const insertAfterList = []; 67271 for (let i = 0; i < pageInfos.length; i++) { 67272 const info = pageInfos[i]; 67273 if (!info.document || info.pageIndices) { 67274 continue; 67275 } 67276 const count = this.#getFilteredPageIndices(info).length; 67277 if (info.insertAfter === undefined) { 67278 for (let j = 0; j < count; j++) { 67279 sequence.push(i); 67280 } 67281 } else { 67282 insertAfterList.push({ 67283 i, 67284 insertAfter: info.insertAfter, 67285 count 67286 }); 67287 } 67288 } 67289 insertAfterList.sort((a, b) => a.insertAfter - b.insertAfter); 67290 if (insertAfterList.length > 0) { 67291 for (const info of pageInfos) { 67292 if (!info.document || !info.pageIndices) { 67293 continue; 67294 } 67295 const filteredCount = this.#getFilteredPageIndices(info).length; 67296 if (info.pageIndices.length < filteredCount) { 67297 throw new Error("extractPages: partial pageIndices cannot be combined with insertAfter entries."); 67298 } 67299 } 67300 } 67301 const hasExplicitLayout = insertAfterList.length > 0 && pageInfos.some(info => info.document && info.pageIndices); 67302 if (sequence.length === 0 && hasExplicitLayout) { 67303 const updatedPageInfos = pageInfos.slice(); 67304 let maxExistingPos = -1; 67305 for (const info of pageInfos) { 67306 if (info.document && info.pageIndices) { 67307 for (const idx of info.pageIndices) { 67308 if (idx > maxExistingPos) { 67309 maxExistingPos = idx; 67310 } 67311 } 67312 } 67313 } 67314 let offset = 0; 67315 for (const { 67316 i, 67317 insertAfter, 67318 count 67319 } of insertAfterList) { 67320 const threshold = Math.min(Math.max(insertAfter, -1) + offset, maxExistingPos); 67321 for (let j = 0; j < updatedPageInfos.length; j++) { 67322 const existingInfo = updatedPageInfos[j]; 67323 if (!existingInfo.document || !existingInfo.pageIndices || existingInfo.pageIndices.every(idx => idx <= threshold)) { 67324 continue; 67325 } 67326 updatedPageInfos[j] = { 67327 ...existingInfo, 67328 pageIndices: existingInfo.pageIndices.map(idx => idx > threshold ? idx + count : idx) 67329 }; 67330 } 67331 const insertedIndices = []; 67332 for (let k = 0; k < count; k++) { 67333 insertedIndices.push(threshold + 1 + k); 67334 } 67335 const newInfo = { 67336 ...updatedPageInfos[i], 67337 pageIndices: insertedIndices 67338 }; 67339 delete newInfo.insertAfter; 67340 updatedPageInfos[i] = newInfo; 67341 offset += count; 67342 maxExistingPos += count; 67343 } 67344 return updatedPageInfos; 67345 } 67346 let offset = 0; 67347 for (const { 67348 i, 67349 insertAfter, 67350 count 67351 } of insertAfterList) { 67352 const insertPos = insertAfter + 1 + offset; 67353 sequence.splice(insertPos, 0, ...new Array(count).fill(i)); 67354 offset += count; 67355 } 67356 const pageIndicesArr = new Array(pageInfos.length); 67357 for (let pos = 0; pos < sequence.length; pos++) { 67358 const infoIdx = sequence[pos]; 67359 (pageIndicesArr[infoIdx] ||= []).push(pos); 67360 } 67361 return pageInfos.map((info, i) => { 67362 if (!info.document || info.pageIndices) { 67363 return info; 67364 } 67365 const newInfo = { 67366 ...info, 67367 pageIndices: pageIndicesArr[i] || [] 67368 }; 67369 delete newInfo.insertAfter; 67370 return newInfo; 67371 }); 67372 } 67373 async extractPages(pageInfos, annotationStorage, handler, task) { 67374 if (pageInfos.some(info => info.insertAfter !== undefined)) { 67375 pageInfos = this.#resolveInsertAfterIndices(pageInfos); 67376 } 67377 const promises = []; 67378 let newIndex = 0; 67379 this.isSingleFile = pageInfos.length === 1 || pageInfos.every(info => info.document === pageInfos[0].document); 67380 this.hasSingleFile = pageInfos.length === 1; 67381 const allDocumentData = []; 67382 if (annotationStorage) { 67383 this.#newAnnotationsParams = { 67384 handler, 67385 task, 67386 newAnnotationsByPage: getNewAnnotationsMap(annotationStorage), 67387 imagesPromises: AnnotationFactory.generateImages(annotationStorage.values(), this.xrefWrapper, true) 67388 }; 67389 } 67390 for (const { 67391 document, 67392 includePages, 67393 excludePages, 67394 pageIndices 67395 } of pageInfos) { 67396 if (!document) { 67397 continue; 67398 } 67399 if (pageIndices) { 67400 newIndex = -1; 67401 } 67402 const documentData = new DocumentData(document); 67403 allDocumentData.push(documentData); 67404 promises.push(this.#collectDocumentData(documentData)); 67405 let pageIndex = 0; 67406 for (const i of this.#getFilteredPageIndices({ 67407 document, 67408 includePages, 67409 excludePages 67410 })) { 67411 let newPageIndex; 67412 if (pageIndices) { 67413 newPageIndex = pageIndices[pageIndex++]; 67414 } 67415 if (newPageIndex === undefined) { 67416 if (newIndex !== -1) { 67417 newPageIndex = newIndex++; 67418 } else { 67419 for (newPageIndex = 0; this.oldPages[newPageIndex] !== undefined; newPageIndex++) {} 67420 } 67421 } 67422 this.oldPages[newPageIndex] = null; 67423 promises.push(document.getPage(i).then(page => { 67424 this.oldPages[newPageIndex] = new PageData(page, documentData); 67425 })); 67426 } 67427 } 67428 await Promise.all(promises); 67429 promises.length = 0; 67430 this.#collectValidDestinations(allDocumentData); 67431 this.#collectOutlineDestinations(allDocumentData); 67432 this.#collectPageLabels(); 67433 for (const page of this.oldPages) { 67434 promises.push(this.#postCollectPageData(page)); 67435 } 67436 await Promise.all(promises); 67437 this.#findDuplicateNamedDestinations(); 67438 this.#setPostponedRefCopies(allDocumentData); 67439 for (let i = 0, ii = this.oldPages.length; i < ii; i++) { 67440 this.newPages[i] = await this.#makePageCopy(i, null); 67441 } 67442 this.#fixPostponedRefCopies(allDocumentData); 67443 await this.#mergeStructTrees(allDocumentData); 67444 await this.#mergeAcroForms(allDocumentData); 67445 this.#buildOutline(allDocumentData); 67446 await this.#collectEmbeddedFiles(allDocumentData); 67447 return this.writePDF(); 67448 } 67449 async #collectDocumentData(documentData) { 67450 const { 67451 document: { 67452 pdfManager, 67453 xref 67454 } 67455 } = documentData; 67456 await Promise.all([pdfManager.ensureCatalog("destinations").then(destinations => documentData.destinations = destinations), pdfManager.ensureCatalog("rawPageLabels").then(pageLabels => documentData.pageLabels = pageLabels), pdfManager.ensureCatalog("structTreeRoot").then(structTreeRoot => documentData.structTreeRoot = structTreeRoot), pdfManager.ensureCatalog("acroForm").then(acroForm => documentData.acroForm = acroForm), pdfManager.ensureCatalog("documentOutlineForEditor").then(outline => documentData.outline = outline), pdfManager.ensureCatalog("rawEmbeddedFiles").then(ef => documentData.embeddedFiles = ef)]); 67457 const structTreeRoot = documentData.structTreeRoot; 67458 if (structTreeRoot) { 67459 const rootDict = structTreeRoot.dict; 67460 const parentTree = rootDict.get("ParentTree"); 67461 if (parentTree) {
vendor: 12,434 bytes, lines 67462-67845
67462 const numberTree = new NumberTree(parentTree, xref); 67463 documentData.parentTree = numberTree.getAll(true); 67464 } 67465 const idTree = rootDict.get("IDTree"); 67466 if (idTree) { 67467 const nameTree = new NameTree(idTree, xref); 67468 documentData.idTree = nameTree.getAll(true); 67469 } 67470 documentData.roleMap = rootDict.get("RoleMap") || null; 67471 documentData.classMap = rootDict.get("ClassMap") || null; 67472 let namespaces = rootDict.get("Namespaces") || null; 67473 if (namespaces && !Array.isArray(namespaces)) { 67474 namespaces = [namespaces]; 67475 } 67476 documentData.namespaces = namespaces; 67477 documentData.structTreeAF = rootDict.get("AF") || null; 67478 documentData.structTreePronunciationLexicon = rootDict.get("PronunciationLexicon") || null; 67479 } 67480 } 67481 async #postCollectPageData(pageData) { 67482 const { 67483 page: { 67484 xref, 67485 annotations 67486 }, 67487 documentData: { 67488 pagesMap, 67489 destinations, 67490 usedNamedDestinations, 67491 fieldToParent 67492 } 67493 } = pageData; 67494 if (!annotations) { 67495 return; 67496 } 67497 const promises = []; 67498 let newAnnotations = []; 67499 let newIndex = 0; 67500 let { 67501 hasSignatureAnnotations 67502 } = pageData.documentData; 67503 for (const annotationRef of annotations) { 67504 const newAnnotationIndex = newIndex++; 67505 promises.push(xref.fetchIfRefAsync(annotationRef).then(async annotationDict => { 67506 if (!isName(annotationDict.get("Subtype"), "Link")) { 67507 if (isName(annotationDict.get("Subtype"), "Widget")) { 67508 hasSignatureAnnotations ||= isName(annotationDict.get("FT"), "Sig"); 67509 const parentRef = annotationDict.get("Parent") || null; 67510 annotationDict.delete("Parent"); 67511 fieldToParent.put(annotationRef, parentRef); 67512 } 67513 newAnnotations[newAnnotationIndex] = annotationRef; 67514 return; 67515 } 67516 const action = annotationDict.get("A"); 67517 const dest = action instanceof Dict ? action.get("D") : annotationDict.get("Dest"); 67518 if (!dest || Array.isArray(dest) && (!(dest[0] instanceof Ref) || pagesMap.has(dest[0]))) { 67519 newAnnotations[newAnnotationIndex] = annotationRef; 67520 } else if (typeof dest === "string") { 67521 const destString = stringToPDFString(dest, true); 67522 if (destinations.has(destString)) { 67523 newAnnotations[newAnnotationIndex] = annotationRef; 67524 usedNamedDestinations.add(destString); 67525 } 67526 } 67527 })); 67528 } 67529 await Promise.all(promises); 67530 newAnnotations = newAnnotations.filter(annot => !!annot); 67531 pageData.annotations = newAnnotations.length > 0 ? newAnnotations : null; 67532 pageData.documentData.hasSignatureAnnotations ||= hasSignatureAnnotations; 67533 } 67534 #setPostponedRefCopies(allDocumentData) { 67535 for (const { 67536 postponedRefCopies, 67537 pagesMap 67538 } of allDocumentData) { 67539 for (const oldPageRef of pagesMap.keys()) { 67540 postponedRefCopies.put(oldPageRef, []); 67541 } 67542 } 67543 } 67544 #fixPostponedRefCopies(allDocumentData) { 67545 for (const { 67546 postponedRefCopies, 67547 oldRefMapping 67548 } of allDocumentData) { 67549 for (const [oldRef, actions] of postponedRefCopies.items()) { 67550 const newRef = oldRefMapping.get(oldRef); 67551 for (const action of actions) { 67552 action(newRef); 67553 } 67554 } 67555 postponedRefCopies.clear(); 67556 } 67557 } 67558 #visitObject(obj, callback, visited = new RefSet()) { 67559 if (obj instanceof Ref) { 67560 if (!visited.has(obj)) { 67561 visited.put(obj); 67562 this.#visitObject(this.xref[obj.num], callback, visited); 67563 } 67564 return; 67565 } 67566 if (Array.isArray(obj)) { 67567 for (const item of obj) { 67568 this.#visitObject(item, callback, visited); 67569 } 67570 return; 67571 } 67572 let dict; 67573 if (obj instanceof BaseStream) { 67574 ({ 67575 dict 67576 } = obj); 67577 } else if (obj instanceof Dict) { 67578 dict = obj; 67579 } 67580 if (dict) { 67581 callback(dict); 67582 for (const value of dict.getRawValues()) { 67583 this.#visitObject(value, callback, visited); 67584 } 67585 } 67586 } 67587 async #mergeStructTrees(allDocumentData) { 67588 let newStructParentId = 0; 67589 const { 67590 parentTree: newParentTree 67591 } = this; 67592 for (let i = 0, ii = this.newPages.length; i < ii; i++) { 67593 const { 67594 documentData: { 67595 parentTree, 67596 oldRefMapping, 67597 oldStructParentMapping, 67598 usedStructParents, 67599 document: { 67600 xref 67601 } 67602 } 67603 } = this.oldPages[i]; 67604 if (!parentTree) { 67605 continue; 67606 } 67607 const pageRef = this.newPages[i]; 67608 const pageDict = this.xref[pageRef.num]; 67609 const visited = new RefSet(); 67610 visited.put(pageRef); 67611 this.#visitObject(pageDict, dict => { 67612 const structParent = dict.get("StructParent") ?? dict.get("StructParents"); 67613 if (typeof structParent !== "number") { 67614 return; 67615 } 67616 usedStructParents.add(structParent); 67617 let parent = parentTree.get(structParent); 67618 const parentRef = parent instanceof Ref ? parent : null; 67619 if (parentRef) { 67620 const array = xref.fetch(parentRef); 67621 if (Array.isArray(array)) { 67622 parent = array; 67623 } 67624 } 67625 if (Array.isArray(parent) && parent.every(ref => ref === null)) { 67626 parent = null; 67627 } 67628 if (!parent) { 67629 if (dict.has("StructParent")) { 67630 dict.delete("StructParent"); 67631 } else { 67632 dict.delete("StructParents"); 67633 } 67634 return; 67635 } 67636 let newStructParent = oldStructParentMapping.get(structParent); 67637 if (newStructParent === undefined) { 67638 newStructParent = newStructParentId++; 67639 oldStructParentMapping.set(structParent, newStructParent); 67640 newParentTree.set(newStructParent, [oldRefMapping, parent]); 67641 } 67642 if (dict.has("StructParent")) { 67643 dict.set("StructParent", newStructParent); 67644 } else { 67645 dict.set("StructParents", newStructParent); 67646 } 67647 }, visited); 67648 } 67649 const { 67650 structTreeKids, 67651 idTree: newIdTree, 67652 classMap: newClassMap, 67653 roleMap: newRoleMap, 67654 namespaces: newNamespaces, 67655 structTreeAF: newStructTreeAF, 67656 structTreePronunciationLexicon: newStructTreePronunciationLexicon 67657 } = this; 67658 for (const documentData of allDocumentData) { 67659 const { 67660 document: { 67661 xref 67662 }, 67663 oldRefMapping, 67664 parentTree, 67665 usedStructParents, 67666 structTreeRoot, 67667 idTree, 67668 classMap, 67669 roleMap, 67670 namespaces, 67671 structTreeAF, 67672 structTreePronunciationLexicon 67673 } = documentData; 67674 if (!structTreeRoot) { 67675 continue; 67676 } 67677 this.currentDocument = documentData; 67678 const removedStructElements = new RefSet(); 67679 for (const [key, value] of parentTree || []) { 67680 if (!usedStructParents.has(key) && value instanceof Ref) { 67681 removedStructElements.put(value); 67682 } 67683 } 67684 const dedupIDs = new Map(); 67685 for (const [id, nodeRef] of idTree || []) { 67686 let _id = id; 67687 if (newIdTree.has(id)) { 67688 for (let i = 1;; i++) { 67689 const newId = `${id}_${i}`; 67690 if (!newIdTree.has(newId)) { 67691 dedupIDs.set(id, newId); 67692 _id = newId; 67693 break; 67694 } 67695 } 67696 } 67697 newIdTree.set(_id, nodeRef); 67698 } 67699 const dedupClasses = new Map(); 67700 if (classMap?.size > 0) { 67701 for (let [className, classDict] of classMap) { 67702 classDict = await this.#collectDependencies(classDict, true, xref); 67703 if (newClassMap.has(className)) { 67704 for (let i = 1;; i++) { 67705 const newClassName = `${className}_${i}`; 67706 if (!newClassMap.has(newClassName)) { 67707 dedupClasses.set(className, newClassName); 67708 className = newClassName; 67709 break; 67710 } 67711 } 67712 } 67713 newClassMap.set(className, classDict); 67714 } 67715 } 67716 const dedupRoles = new Map(); 67717 if (roleMap?.size > 0) { 67718 for (const [roleName, mappedName] of roleMap) { 67719 const newMappedName = newRoleMap.get(roleName); 67720 if (!newMappedName) { 67721 newRoleMap.set(roleName, mappedName); 67722 continue; 67723 } 67724 if (newMappedName === mappedName) { 67725 continue; 67726 } 67727 for (let i = 1;; i++) { 67728 const newRoleName = `${roleName}_${i}`; 67729 if (!newRoleMap.has(newRoleName)) { 67730 dedupRoles.set(roleName, newRoleName); 67731 newRoleMap.set(newRoleName, mappedName); 67732 break; 67733 } 67734 } 67735 } 67736 } 67737 if (namespaces?.length > 0) { 67738 for (const namespaceRef of namespaces) { 67739 const namespace = await xref.fetchIfRefAsync(namespaceRef); 67740 let ns = namespace.get("NS"); 67741 if (!ns || newNamespaces.has(ns)) { 67742 continue; 67743 } 67744 ns = stringToPDFString(ns, false); 67745 const newNamespace = await this.#collectDependencies(namespace, true, xref); 67746 newNamespaces.set(ns, newNamespace); 67747 } 67748 } 67749 if (structTreeAF) { 67750 for (const afRef of structTreeAF) { 67751 newStructTreeAF.push(await this.#collectDependencies(afRef, true, xref)); 67752 } 67753 } 67754 if (structTreePronunciationLexicon) { 67755 for (const lexiconRef of structTreePronunciationLexicon) { 67756 newStructTreePronunciationLexicon.push(await this.#collectDependencies(lexiconRef, true, xref)); 67757 } 67758 } 67759 let kids = structTreeRoot.dict.get("K"); 67760 if (!kids) { 67761 continue; 67762 } 67763 kids = Array.isArray(kids) ? kids : [kids]; 67764 for (let kid of kids) { 67765 const kidRef = kid instanceof Ref ? kid : null; 67766 if (kidRef && removedStructElements.has(kidRef)) { 67767 continue; 67768 } 67769 kid = await xref.fetchIfRefAsync(kid); 67770 const newKidRef = await this.#cloneStructTreeNode(kidRef, kid, xref, removedStructElements, dedupIDs, dedupClasses, dedupRoles); 67771 if (newKidRef) { 67772 structTreeKids.push(newKidRef); 67773 } 67774 } 67775 for (const [id, nodeRef] of idTree || []) { 67776 const newNodeRef = nodeRef instanceof Ref && oldRefMapping.get(nodeRef); 67777 const newId = dedupIDs.get(id) || id; 67778 if (newNodeRef) { 67779 newIdTree.set(newId, newNodeRef); 67780 } else { 67781 newIdTree.delete(newId); 67782 } 67783 } 67784 } 67785 for (const [key, [oldRefMapping, parent]] of newParentTree) { 67786 if (!parent) { 67787 newParentTree.delete(key); 67788 continue; 67789 } 67790 if (!Array.isArray(parent)) { 67791 const newParent = oldRefMapping.get(parent); 67792 if (newParent === undefined) { 67793 newParentTree.delete(key); 67794 } else { 67795 newParentTree.set(key, newParent); 67796 } 67797 continue; 67798 } 67799 const newParents = parent.map(ref => ref instanceof Ref && oldRefMapping.get(ref) || null); 67800 if (newParents.length === 0 || newParents.every(ref => ref === null)) { 67801 newParentTree.delete(key); 67802 continue; 67803 } 67804 newParentTree.set(key, newParents); 67805 } 67806 this.currentDocument = null; 67807 } 67808 #collectValidDestinations(allDocumentData) { 67809 for (const documentData of allDocumentData) { 67810 if (!documentData.destinations) { 67811 continue; 67812 } 67813 const { 67814 destinations, 67815 pagesMap 67816 } = documentData; 67817 const newDestinations = documentData.destinations = new Map(); 67818 for (const [key, dest] of Object.entries(destinations)) { 67819 const pageRef = dest[0]; 67820 const pageData = pageRef instanceof Ref && pagesMap.get(pageRef); 67821 if (!pageData) { 67822 continue; 67823 } 67824 (pageData.pointingNamedDestinations ||= new Set()).add(key); 67825 newDestinations.set(key, dest); 67826 } 67827 } 67828 } 67829 #findDuplicateNamedDestinations() { 67830 const { 67831 namedDestinations 67832 } = this; 67833 const getUniqueDestinationName = name => { 67834 if (!namedDestinations.has(name)) { 67835 return name; 67836 } 67837 for (let i = 1;; i++) { 67838 const dedupedName = `${name}_${i}`; 67839 if (!namedDestinations.has(dedupedName)) { 67840 return dedupedName; 67841 } 67842 } 67843 }; 67844 for (let i = 0, ii = this.oldPages.length; i < ii; i++) { 67845 const page = this.oldPages[i];
vendor: 11,746 bytes, lines 67845-68209
67845 67846 const { 67847 documentData: { 67848 destinations, 67849 dedupNamedDestinations, 67850 usedNamedDestinations 67851 } 67852 } = page; 67853 let { 67854 pointingNamedDestinations 67855 } = page; 67856 if (!pointingNamedDestinations) { 67857 continue; 67858 } 67859 page.pointingNamedDestinations = pointingNamedDestinations = pointingNamedDestinations.intersection(usedNamedDestinations); 67860 for (const pointingDest of pointingNamedDestinations) { 67861 if (!usedNamedDestinations.has(pointingDest)) { 67862 continue; 67863 } 67864 const dest = destinations.get(pointingDest).slice(); 67865 if (!namedDestinations.has(pointingDest)) { 67866 namedDestinations.set(pointingDest, dest); 67867 continue; 67868 } 67869 const newName = getUniqueDestinationName(`${pointingDest}_p${i + 1}`); 67870 dedupNamedDestinations.set(pointingDest, newName); 67871 namedDestinations.set(newName, dest); 67872 } 67873 } 67874 } 67875 #fixNamedDestinations(annotations, dedupNamedDestinations) { 67876 if (dedupNamedDestinations.size === 0) { 67877 return; 67878 } 67879 const fixDestination = (dict, key, dest) => { 67880 if (typeof dest === "string") { 67881 dict.set(key, dedupNamedDestinations.get(stringToPDFString(dest, true)) || dest); 67882 } 67883 }; 67884 for (const annotRef of annotations) { 67885 const annotDict = this.xref[annotRef.num]; 67886 if (!isName(annotDict.get("Subtype"), "Link")) { 67887 continue; 67888 } 67889 const action = annotDict.get("A"); 67890 if (action instanceof Dict && action.has("D")) { 67891 const dest = action.get("D"); 67892 fixDestination(action, "D", dest); 67893 continue; 67894 } 67895 const dest = annotDict.get("Dest"); 67896 fixDestination(annotDict, "Dest", dest); 67897 } 67898 } 67899 #collectOutlineDestinations(allDocumentData) { 67900 const collect = (items, destinations, usedNamedDestinations) => { 67901 for (const item of items) { 67902 if (typeof item.dest === "string" && destinations?.has(item.dest)) { 67903 usedNamedDestinations.add(item.dest); 67904 } 67905 if (item.items.length > 0) { 67906 collect(item.items, destinations, usedNamedDestinations); 67907 } 67908 } 67909 }; 67910 for (const documentData of allDocumentData) { 67911 const { 67912 outline, 67913 destinations, 67914 usedNamedDestinations 67915 } = documentData; 67916 if (outline?.length) { 67917 collect(outline, destinations, usedNamedDestinations); 67918 } 67919 } 67920 } 67921 #isValidOutlineDest(item, documentData) { 67922 const { 67923 dest, 67924 action, 67925 url, 67926 unsafeUrl, 67927 attachment, 67928 setOCGState 67929 } = item; 67930 if (action || url || unsafeUrl || attachment || setOCGState) { 67931 return true; 67932 } 67933 if (!dest) { 67934 return false; 67935 } 67936 if (typeof dest === "string") { 67937 const name = documentData.dedupNamedDestinations.get(dest) || dest; 67938 return this.namedDestinations.has(name); 67939 } 67940 if (Array.isArray(dest) && dest[0] instanceof Ref) { 67941 return !!documentData.oldRefMapping.get(dest[0]); 67942 } 67943 return false; 67944 } 67945 #filterOutlineItems(items, documentData) { 67946 const result = []; 67947 for (const item of items) { 67948 const filteredChildren = this.#filterOutlineItems(item.items, documentData); 67949 const hasValidOwnDest = this.#isValidOutlineDest(item, documentData); 67950 if (hasValidOwnDest || filteredChildren.length > 0) { 67951 result.push({ 67952 ...item, 67953 dest: hasValidOwnDest ? item.dest : null, 67954 rawDict: hasValidOwnDest ? item.rawDict : null, 67955 items: filteredChildren, 67956 _documentData: documentData 67957 }); 67958 } 67959 } 67960 return result; 67961 } 67962 #buildOutline(allDocumentData) { 67963 const outlineItems = []; 67964 for (const documentData of allDocumentData) { 67965 const { 67966 outline 67967 } = documentData; 67968 if (!outline?.length) { 67969 continue; 67970 } 67971 outlineItems.push(...this.#filterOutlineItems(outline, documentData)); 67972 } 67973 this.outlineItems = outlineItems.length > 0 ? outlineItems : null; 67974 } 67975 async #setOutlineItemDest(itemDict, item) { 67976 const { 67977 dest, 67978 rawDict 67979 } = item; 67980 const documentData = item._documentData; 67981 if (dest) { 67982 if (typeof dest === "string") { 67983 const name = documentData.dedupNamedDestinations.get(dest) || dest; 67984 itemDict.set("Dest", stringToAsciiOrUTF16BE(name)); 67985 } else if (Array.isArray(dest)) { 67986 const newDest = dest.slice(); 67987 if (newDest[0] instanceof Ref) { 67988 newDest[0] = documentData.oldRefMapping.get(newDest[0]) || newDest[0]; 67989 } 67990 itemDict.set("Dest", newDest); 67991 } 67992 return; 67993 } 67994 const actionDict = rawDict?.get("A"); 67995 if (actionDict instanceof Dict) { 67996 this.currentDocument = documentData; 67997 const actionRef = await this.#cloneObject(actionDict, documentData.document.xref); 67998 this.currentDocument = null; 67999 itemDict.set("A", actionRef); 68000 } 68001 } 68002 async #makeOutline() { 68003 const { 68004 outlineItems 68005 } = this; 68006 if (!outlineItems?.length) { 68007 return; 68008 } 68009 const [outlineRootRef, outlineRootDict] = this.newDict; 68010 outlineRootDict.setIfName("Type", "Outlines"); 68011 const assignRefs = items => { 68012 for (const item of items) { 68013 [item._ref] = this.newDict; 68014 if (item.items.length > 0) { 68015 assignRefs(item.items); 68016 } 68017 } 68018 }; 68019 assignRefs(outlineItems); 68020 const fillItems = async (items, parentRef) => { 68021 let totalCount = 0; 68022 for (let i = 0; i < items.length; i++) { 68023 const item = items[i]; 68024 const dict = this.xref[item._ref.num]; 68025 dict.set("Title", stringToAsciiOrUTF16BE(item.title)); 68026 dict.set("Parent", parentRef); 68027 if (i > 0) { 68028 dict.set("Prev", items[i - 1]._ref); 68029 } 68030 if (i < items.length - 1) { 68031 dict.set("Next", items[i + 1]._ref); 68032 } 68033 if (item.items.length > 0) { 68034 dict.set("First", item.items[0]._ref); 68035 dict.set("Last", item.items.at(-1)._ref); 68036 const childCount = await fillItems(item.items, item._ref); 68037 if (item.count !== undefined) { 68038 dict.set("Count", item.count < 0 ? -childCount : childCount); 68039 } 68040 totalCount += item.count !== undefined && item.count < 0 ? 1 : childCount + 1; 68041 } else { 68042 totalCount += 1; 68043 } 68044 await this.#setOutlineItemDest(dict, item); 68045 const flags = (item.bold ? 2 : 0) | (item.italic ? 1 : 0); 68046 if (flags !== 0) { 68047 dict.set("F", flags); 68048 } 68049 if (item.color && (item.color[0] !== 0 || item.color[1] !== 0 || item.color[2] !== 0)) { 68050 dict.set("C", [item.color[0] / 255, item.color[1] / 255, item.color[2] / 255]); 68051 } 68052 } 68053 return totalCount; 68054 }; 68055 const totalCount = await fillItems(outlineItems, outlineRootRef); 68056 outlineRootDict.set("First", outlineItems[0]._ref); 68057 outlineRootDict.set("Last", outlineItems.at(-1)._ref); 68058 outlineRootDict.set("Count", totalCount); 68059 this.rootDict.set("Outlines", outlineRootRef); 68060 } 68061 async #mergeAcroForms(allDocumentData) { 68062 this.#setAcroFormDefaultBasicValues(allDocumentData); 68063 this.#setAcroFormDefaultAppearance(allDocumentData); 68064 this.#setAcroFormQ(allDocumentData); 68065 await this.#setAcroFormDefaultResources(allDocumentData); 68066 const newFields = this.fields; 68067 for (const documentData of allDocumentData) { 68068 let fields = documentData.acroForm?.get("Fields") || null; 68069 if (!fields && documentData.fieldToParent.size > 0) { 68070 fields = this.#fixFields(documentData.fieldToParent, documentData.document.xref); 68071 } 68072 if (Array.isArray(fields) && fields.length > 0) { 68073 this.currentDocument = documentData; 68074 await this.#cloneFields(newFields, fields); 68075 this.currentDocument = null; 68076 } 68077 } 68078 this.#setAcroFormCalculationOrder(allDocumentData); 68079 } 68080 #setAcroFormQ(allDocumentData) { 68081 let firstQ = 0; 68082 let firstDocData = null; 68083 for (const documentData of allDocumentData) { 68084 const q = documentData.acroForm?.get("Q"); 68085 if (typeof q !== "number" || q === 0) { 68086 continue; 68087 } 68088 if (firstDocData?.acroFormQ > 0) { 68089 documentData.acroFormQ = q; 68090 continue; 68091 } 68092 if (firstQ === 0) { 68093 firstQ = q; 68094 firstDocData = documentData; 68095 continue; 68096 } 68097 if (q === firstQ) { 68098 continue; 68099 } 68100 firstDocData.acroFormQ ||= firstQ; 68101 documentData.acroFormQ = q; 68102 firstQ = 0; 68103 } 68104 if (firstQ > 0) { 68105 this.acroFormQ = firstQ; 68106 } 68107 } 68108 #setAcroFormDefaultBasicValues(allDocumentData) { 68109 let sigFlags = 0; 68110 let needAppearances = false; 68111 for (const documentData of allDocumentData) { 68112 if (!documentData.acroForm) { 68113 continue; 68114 } 68115 const sf = documentData.acroForm.get("SigFlags"); 68116 if (typeof sf === "number" && documentData.hasSignatureAnnotations) { 68117 sigFlags |= sf; 68118 } 68119 if (documentData.acroForm.get("NeedAppearances") === true) { 68120 needAppearances = true; 68121 } 68122 } 68123 this.acroFormSigFlags = sigFlags; 68124 this.acroFormNeedAppearances = needAppearances; 68125 } 68126 #setAcroFormCalculationOrder(allDocumentData) { 68127 const calculationOrder = []; 68128 for (const documentData of allDocumentData) { 68129 const co = documentData.acroForm?.get("CO") || null; 68130 if (!Array.isArray(co)) { 68131 continue; 68132 } 68133 const { 68134 oldRefMapping 68135 } = documentData; 68136 for (const coRef of co) { 68137 const newCoRef = coRef instanceof Ref && oldRefMapping.get(coRef); 68138 if (newCoRef) { 68139 calculationOrder.push(newCoRef); 68140 } 68141 } 68142 } 68143 this.acroFormCalculationOrder = calculationOrder.length > 0 ? calculationOrder : null; 68144 } 68145 #setAcroFormDefaultAppearance(allDocumentData) { 68146 let firstDA = null; 68147 let firstDocData = null; 68148 for (const documentData of allDocumentData) { 68149 const da = documentData.acroForm?.get("DA") || null; 68150 if (!da || typeof da !== "string") { 68151 continue; 68152 } 68153 if (firstDocData?.acroFormDefaultAppearance) { 68154 documentData.acroFormDefaultAppearance = da; 68155 continue; 68156 } 68157 if (!firstDA) { 68158 firstDA = da; 68159 firstDocData = documentData; 68160 continue; 68161 } 68162 if (da === firstDA) { 68163 continue; 68164 } 68165 firstDocData.acroFormDefaultAppearance ||= firstDA; 68166 documentData.acroFormDefaultAppearance = da; 68167 firstDA = null; 68168 } 68169 if (firstDA) { 68170 this.acroFormDefaultAppearance = firstDA; 68171 } 68172 } 68173 async #setAcroFormDefaultResources(allDocumentData) { 68174 let firstDR = null; 68175 let firstDRRef = null; 68176 let firstDocData = null; 68177 for (const documentData of allDocumentData) { 68178 const dr = documentData.acroForm?.get("DR") || null; 68179 if (!dr || !(dr instanceof Dict)) { 68180 continue; 68181 } 68182 if (firstDocData?.acroFormDefaultResources) { 68183 documentData.acroFormDefaultResources = dr; 68184 continue; 68185 } 68186 if (!firstDR) { 68187 firstDR = dr; 68188 firstDRRef = documentData.acroForm.getRaw("DR"); 68189 firstDocData = documentData; 68190 continue; 68191 } 68192 if (deepCompare(firstDR, dr)) { 68193 continue; 68194 } 68195 firstDocData.acroFormDefaultResources ||= firstDR; 68196 documentData.acroFormDefaultResources = dr; 68197 firstDR = null; 68198 firstDRRef = null; 68199 } 68200 if (firstDR) { 68201 this.currentDocument = firstDocData; 68202 this.acroFormDefaultResources = await this.#collectDependencies(firstDRRef, true, firstDocData.document.xref); 68203 this.currentDocument = null; 68204 } 68205 } 68206 #fixFields(fieldToParent, xref) { 68207 const newFields = []; 68208 const processed = new RefSet(); 68209 for (const [fieldRef, parentRef] of fieldToParent
vendor: 31,764 bytes, lines 68209-69319
68209) { 68210 if (!parentRef) { 68211 newFields.push(fieldRef); 68212 continue; 68213 } 68214 let parent = parentRef; 68215 let lastNonNullParent = parentRef; 68216 while (true) { 68217 parent = xref.fetchIfRef(parent)?.getRaw("Parent") || null; 68218 if (!parent) { 68219 break; 68220 } 68221 lastNonNullParent = parent; 68222 } 68223 if (lastNonNullParent instanceof Ref && !processed.has(lastNonNullParent)) { 68224 newFields.push(lastNonNullParent); 68225 processed.put(lastNonNullParent); 68226 } 68227 } 68228 return newFields; 68229 } 68230 async #cloneFields(newFields, fields) { 68231 const processed = new RefSet(); 68232 const stack = [{ 68233 kids: fields, 68234 newKids: newFields, 68235 pos: 0, 68236 oldParentRef: null, 68237 parentRef: null, 68238 parent: null 68239 }]; 68240 const { 68241 document: { 68242 xref 68243 }, 68244 oldRefMapping, 68245 fieldToParent, 68246 acroFormDefaultAppearance, 68247 acroFormDefaultResources, 68248 acroFormQ 68249 } = this.currentDocument; 68250 const daToFix = []; 68251 const drToFix = []; 68252 while (stack.length > 0) { 68253 const data = stack.at(-1); 68254 const { 68255 kids, 68256 newKids, 68257 parent, 68258 pos 68259 } = data; 68260 if (pos === kids.length) { 68261 stack.pop(); 68262 if (newKids.length === 0 || !parent) { 68263 continue; 68264 } 68265 const parentDict = this.xref[data.parentRef.num] = this.cloneDict(parent); 68266 parentDict.delete("Parent"); 68267 parentDict.delete("Kids"); 68268 await this.#collectDependencies(parentDict, false, xref); 68269 parentDict.set("Kids", newKids); 68270 if (stack.length > 0) { 68271 const lastData = stack.at(-1); 68272 if (!lastData.parentRef && lastData.oldParentRef) { 68273 const parentRef = lastData.parentRef = this.newRef; 68274 parentDict.set("Parent", parentRef); 68275 oldRefMapping.put(lastData.oldParentRef, parentRef); 68276 } 68277 lastData.newKids.push(data.parentRef); 68278 } 68279 continue; 68280 } 68281 const oldKidRef = kids[data.pos++]; 68282 if (!(oldKidRef instanceof Ref) || processed.has(oldKidRef)) { 68283 continue; 68284 } 68285 processed.put(oldKidRef); 68286 const kid = xref.fetchIfRef(oldKidRef); 68287 if (kid.has("Kids")) { 68288 const kidsArray = kid.get("Kids"); 68289 if (!Array.isArray(kidsArray)) { 68290 continue; 68291 } 68292 stack.push({ 68293 kids: kidsArray, 68294 newKids: [], 68295 pos: 0, 68296 oldParentRef: oldKidRef, 68297 parentRef: null, 68298 parent: kid 68299 }); 68300 continue; 68301 } 68302 if (!fieldToParent.has(oldKidRef)) { 68303 continue; 68304 } 68305 const newRef = oldRefMapping.get(oldKidRef); 68306 if (!newRef) { 68307 continue; 68308 } 68309 newKids.push(newRef); 68310 if (!data.parentRef && data.oldParentRef) { 68311 data.parentRef = this.newRef; 68312 oldRefMapping.put(data.oldParentRef, data.parentRef); 68313 } 68314 const newKid = this.xref[newRef.num]; 68315 if (data.parentRef) { 68316 newKid.set("Parent", data.parentRef); 68317 } 68318 if (acroFormDefaultAppearance && isName(newKid.get("FT"), "Tx") && !newKid.has("DA")) { 68319 daToFix.push(newKid); 68320 } 68321 if (acroFormDefaultResources && !newKid.has("Kids") && newKid.get("AP") instanceof Dict) { 68322 drToFix.push(newKid); 68323 } 68324 if (acroFormQ && !newKid.has("Q")) { 68325 newKid.set("Q", acroFormQ); 68326 } 68327 } 68328 for (const field of daToFix) { 68329 const da = getInheritableProperty({ 68330 dict: field, 68331 key: "DA" 68332 }); 68333 if (!da) { 68334 field.set("DA", acroFormDefaultAppearance); 68335 } 68336 } 68337 const resourcesValuesCache = new Map(); 68338 for (const field of drToFix) { 68339 const ap = field.get("AP"); 68340 for (const [, value] of ap) { 68341 if (!(value instanceof BaseStream)) { 68342 continue; 68343 } 68344 let resources = value.dict.getRaw("Resources"); 68345 if (!resources) { 68346 const newResourcesRef = await resourcesValuesCache.getOrInsertComputed(acroFormDefaultResources, () => this.#cloneObject(acroFormDefaultResources, xref)); 68347 value.dict.set("Resources", newResourcesRef); 68348 continue; 68349 } 68350 resources = xref.fetchIfRef(resources); 68351 for (const [resKey, resValue] of acroFormDefaultResources.getRawEntries()) { 68352 if (!resources.has(resKey)) { 68353 let newResValue = resValue; 68354 if (resValue instanceof Ref) { 68355 newResValue = await this.#collectDependencies(resValue, true, xref); 68356 } else if (resValue instanceof Dict || resValue instanceof BaseStream || Array.isArray(resValue)) { 68357 newResValue = await resourcesValuesCache.getOrInsertComputed(resValue, () => this.#cloneObject(resValue, xref)); 68358 } 68359 resources.set(resKey, newResValue); 68360 } 68361 } 68362 } 68363 } 68364 } 68365 async #collectPageLabels() { 68366 if (!this.hasSingleFile) { 68367 return; 68368 } 68369 const { 68370 documentData: { 68371 document, 68372 pageLabels 68373 } 68374 } = this.oldPages[0]; 68375 if (!pageLabels) { 68376 return; 68377 } 68378 const numPages = document.numPages; 68379 const oldPageLabels = []; 68380 const oldPageIndices = new Set(this.oldPages.map(({ 68381 page: { 68382 pageIndex 68383 } 68384 }) => pageIndex)); 68385 let currentLabel = null; 68386 let stFirstIndex = -1; 68387 for (let i = 0; i < numPages; i++) { 68388 const newLabel = pageLabels.get(i); 68389 if (newLabel) { 68390 currentLabel = newLabel; 68391 stFirstIndex = currentLabel.has("St") ? i : -1; 68392 } 68393 if (!oldPageIndices.has(i)) { 68394 continue; 68395 } 68396 if (stFirstIndex !== -1) { 68397 const st = currentLabel.get("St"); 68398 currentLabel = this.cloneDict(currentLabel); 68399 currentLabel.set("St", st + (i - stFirstIndex)); 68400 stFirstIndex = -1; 68401 } 68402 oldPageLabels.push(currentLabel); 68403 } 68404 currentLabel = oldPageLabels[0]; 68405 let currentIndex = 0; 68406 const newPageLabels = this.pageLabels = [[0, currentLabel]]; 68407 for (let i = 0, ii = oldPageLabels.length; i < ii; i++) { 68408 const label = oldPageLabels[i]; 68409 if (label === currentLabel) { 68410 continue; 68411 } 68412 currentIndex = i; 68413 currentLabel = label; 68414 newPageLabels.push([currentIndex, currentLabel]); 68415 } 68416 } 68417 async #makePageCopy(pageIndex) { 68418 const { 68419 page, 68420 documentData, 68421 annotations, 68422 pointingNamedDestinations 68423 } = this.oldPages[pageIndex]; 68424 this.currentDocument = documentData; 68425 const { 68426 dedupNamedDestinations, 68427 oldRefMapping 68428 } = documentData; 68429 const { 68430 xref, 68431 rotate, 68432 mediaBox, 68433 resources, 68434 ref: oldPageRef 68435 } = page; 68436 const pageRef = this.newRef; 68437 const pageDict = this.xref[pageRef.num] = this.cloneDict(page.pageDict); 68438 oldRefMapping.put(oldPageRef, pageRef); 68439 if (pointingNamedDestinations) { 68440 for (const pointingDest of pointingNamedDestinations) { 68441 const name = dedupNamedDestinations.get(pointingDest) || pointingDest; 68442 const dest = this.namedDestinations.get(name); 68443 dest[0] = pageRef; 68444 } 68445 } 68446 for (const key of ["Rotate", "MediaBox", "CropBox", "BleedBox", "TrimBox", "ArtBox", "Resources", "Annots", "Parent", "UserUnit"]) { 68447 pageDict.delete(key); 68448 } 68449 const lastRef = this.newRefCount; 68450 await this.#collectDependencies(pageDict, false, xref); 68451 pageDict.set("Rotate", rotate); 68452 pageDict.set("MediaBox", mediaBox); 68453 for (const boxName of ["CropBox", "BleedBox", "TrimBox", "ArtBox"]) { 68454 const box = page.getBoundingBox(boxName); 68455 if (box?.some((value, index) => value !== mediaBox[index])) { 68456 pageDict.set(boxName, box); 68457 } 68458 } 68459 const userUnit = page.userUnit; 68460 if (userUnit !== 1) { 68461 pageDict.set("UserUnit", userUnit); 68462 } 68463 pageDict.setIfDict("Resources", await this.#collectDependencies(resources, true, xref)); 68464 let newAnnots = null; 68465 if (annotations) { 68466 const newAnnotations = await this.#collectDependencies(annotations, true, xref); 68467 this.#fixNamedDestinations(newAnnotations, dedupNamedDestinations); 68468 if (Array.isArray(newAnnotations) && newAnnotations.length > 0) { 68469 newAnnots = newAnnotations; 68470 } 68471 } 68472 const newAnnotations = this.#newAnnotationsParams?.newAnnotationsByPage?.get(pageIndex); 68473 if (newAnnotations) { 68474 const { 68475 handler, 68476 task, 68477 imagesPromises 68478 } = this.#newAnnotationsParams; 68479 const changes = new RefSetCache(); 68480 const newData = await AnnotationFactory.saveNewAnnotations(page.createAnnotationEvaluator(handler), this.xrefWrapper, task, newAnnotations, imagesPromises, changes); 68481 for (const [ref, { 68482 data 68483 }] of changes.items()) { 68484 this.xref[ref.num] = data; 68485 } 68486 newAnnots ||= []; 68487 for (const { 68488 ref 68489 } of newData.annotations) { 68490 newAnnots.push(ref); 68491 } 68492 } 68493 pageDict.setIfArray("Annots", newAnnots); 68494 if (this.useObjectStreams) { 68495 const newLastRef = this.newRefCount; 68496 const pageObjectRefs = []; 68497 for (let i = lastRef; i < newLastRef; i++) { 68498 const obj = this.xref[i]; 68499 if (obj instanceof BaseStream) { 68500 continue; 68501 } 68502 pageObjectRefs.push(Ref.get(i, 0)); 68503 } 68504 for (let i = 0; i < pageObjectRefs.length; i += 0xffff) { 68505 const objStreamRef = this.newRef; 68506 this.objStreamRefs.add(objStreamRef.num); 68507 this.xref[objStreamRef.num] = pageObjectRefs.slice(i, i + 0xffff); 68508 } 68509 } 68510 this.currentDocument = null; 68511 return pageRef; 68512 } 68513 #makePageTree() { 68514 const { 68515 newPages: pages, 68516 rootDict, 68517 pagesRef, 68518 pagesDict 68519 } = this; 68520 rootDict.set("Pages", pagesRef); 68521 pagesDict.setIfName("Type", "Pages"); 68522 pagesDict.set("Count", pages.length); 68523 const maxLeaves = MAX_LEAVES_PER_PAGES_NODE <= 1 ? pages.length : MAX_LEAVES_PER_PAGES_NODE; 68524 const stack = [{ 68525 dict: pagesDict, 68526 kids: pages, 68527 parentRef: pagesRef 68528 }]; 68529 while (stack.length > 0) { 68530 const { 68531 dict, 68532 kids, 68533 parentRef 68534 } = stack.pop(); 68535 if (kids.length <= maxLeaves) { 68536 dict.set("Kids", kids); 68537 for (const ref of kids) { 68538 this.xref[ref.num].set("Parent", parentRef); 68539 } 68540 continue; 68541 } 68542 const chunkSize = Math.max(maxLeaves, Math.ceil(kids.length / maxLeaves)); 68543 const kidsChunks = []; 68544 for (let i = 0; i < kids.length; i += chunkSize) { 68545 kidsChunks.push(kids.slice(i, i + chunkSize)); 68546 } 68547 const kidsRefs = []; 68548 dict.set("Kids", kidsRefs); 68549 for (const chunk of kidsChunks) { 68550 const [kidRef, kidDict] = this.newDict; 68551 kidsRefs.push(kidRef); 68552 kidDict.setIfName("Type", "Pages"); 68553 kidDict.set("Parent", parentRef); 68554 kidDict.set("Count", chunk.length); 68555 stack.push({ 68556 dict: kidDict, 68557 kids: chunk, 68558 parentRef: kidRef 68559 }); 68560 } 68561 } 68562 } 68563 #makeNameNumTree(map, areNames) { 68564 const allEntries = map.sort(areNames ? ([keyA], [keyB]) => keyA.localeCompare(keyB) : ([keyA], [keyB]) => keyA - keyB); 68565 const maxLeaves = MAX_IN_NAME_TREE_NODE <= 1 ? allEntries.length : MAX_IN_NAME_TREE_NODE; 68566 const [treeRef, treeDict] = this.newDict; 68567 const stack = [{ 68568 dict: treeDict, 68569 entries: allEntries, 68570 isRoot: true 68571 }]; 68572 const valueType = areNames ? "Names" : "Nums"; 68573 while (stack.length > 0) { 68574 const { 68575 dict, 68576 entries, 68577 isRoot 68578 } = stack.pop(); 68579 if (entries.length <= maxLeaves) { 68580 if (!isRoot) { 68581 dict.set("Limits", [entries[0][0], entries.at(-1)[0]]); 68582 } 68583 dict.set(valueType, entries.flat()); 68584 continue; 68585 } 68586 const entriesChunks = []; 68587 const chunkSize = Math.max(maxLeaves, Math.ceil(entries.length / maxLeaves)); 68588 for (let i = 0; i < entries.length; i += chunkSize) { 68589 entriesChunks.push(entries.slice(i, i + chunkSize)); 68590 } 68591 const entriesRefs = []; 68592 dict.set("Kids", entriesRefs); 68593 for (const chunk of entriesChunks) { 68594 const [entriesRef, entriesDict] = this.newDict; 68595 entriesRefs.push(entriesRef); 68596 entriesDict.set("Limits", [chunk[0][0], chunk.at(-1)[0]]); 68597 stack.push({ 68598 dict: entriesDict, 68599 entries: chunk 68600 }); 68601 } 68602 } 68603 return treeRef; 68604 } 68605 #makePageLabelsTree() { 68606 const { 68607 pageLabels 68608 } = this; 68609 if (!pageLabels || pageLabels.length === 0) { 68610 return; 68611 } 68612 const { 68613 rootDict 68614 } = this; 68615 const pageLabelsRef = this.#makeNameNumTree(this.pageLabels, false); 68616 rootDict.set("PageLabels", pageLabelsRef); 68617 } 68618 async #collectEmbeddedFiles(allDocumentData) { 68619 const { 68620 embeddedFiles 68621 } = this; 68622 for (const documentData of allDocumentData) { 68623 const { 68624 embeddedFiles: docEmbeddedFiles, 68625 document: { 68626 xref 68627 } 68628 } = documentData; 68629 if (!docEmbeddedFiles?.size) { 68630 continue; 68631 } 68632 this.currentDocument = documentData; 68633 for (const [key, valueRef] of docEmbeddedFiles) { 68634 let name = key; 68635 if (embeddedFiles.has(name)) { 68636 const displayName = stringToPDFString(key, true); 68637 for (let i = 1;; i++) { 68638 const deduped = `${displayName}_${i}`; 68639 if (!embeddedFiles.has(deduped)) { 68640 name = deduped; 68641 break; 68642 } 68643 } 68644 } 68645 embeddedFiles.set(name, await this.#collectDependencies(valueRef, true, xref)); 68646 } 68647 this.currentDocument = null; 68648 } 68649 } 68650 #makeEmbeddedFilesTree() { 68651 const { 68652 embeddedFiles 68653 } = this; 68654 if (embeddedFiles.size === 0) { 68655 return; 68656 } 68657 if (!this.namesDict) { 68658 [this.namesRef, this.namesDict] = this.newDict; 68659 this.rootDict.set("Names", this.namesRef); 68660 } 68661 this.namesDict.set("EmbeddedFiles", this.#makeNameNumTree(Array.from(embeddedFiles.entries()), true)); 68662 } 68663 #makeDestinationsTree() { 68664 const { 68665 namedDestinations 68666 } = this; 68667 if (namedDestinations.size === 0) { 68668 return; 68669 } 68670 if (!this.namesDict) { 68671 [this.namesRef, this.namesDict] = this.newDict; 68672 this.rootDict.set("Names", this.namesRef); 68673 } 68674 this.namesDict.set("Dests", this.#makeNameNumTree(Array.from(namedDestinations.entries()), true)); 68675 } 68676 #makeStructTree() { 68677 const { 68678 structTreeKids 68679 } = this; 68680 if (!structTreeKids || structTreeKids.length === 0) { 68681 return; 68682 } 68683 const { 68684 rootDict 68685 } = this; 68686 const structTreeRef = this.newRef; 68687 const structTree = this.xref[structTreeRef.num] = new Dict(); 68688 structTree.setIfName("Type", "StructTreeRoot"); 68689 structTree.setIfArray("K", structTreeKids); 68690 for (const kidRef of structTreeKids) { 68691 const kid = this.xref[kidRef.num]; 68692 const type = kid.get("Type"); 68693 if (!type || isName(type, "StructElem")) { 68694 kid.set("P", structTreeRef); 68695 } 68696 } 68697 if (this.parentTree.size > 0) { 68698 const parentTreeRef = this.#makeNameNumTree(Array.from(this.parentTree.entries()), false); 68699 const parentTree = this.xref[parentTreeRef.num]; 68700 parentTree.setIfName("Type", "ParentTree"); 68701 structTree.set("ParentTree", parentTreeRef); 68702 structTree.set("ParentTreeNextKey", this.parentTree.size); 68703 } 68704 if (this.idTree.size > 0) { 68705 const idTreeRef = this.#makeNameNumTree(Array.from(this.idTree.entries()), true); 68706 const idTree = this.xref[idTreeRef.num]; 68707 idTree.setIfName("Type", "IDTree"); 68708 structTree.set("IDTree", idTreeRef); 68709 } 68710 if (this.classMap.size > 0) { 68711 const classMapRef = this.newRef; 68712 this.xref[classMapRef.num] = this.classMap; 68713 structTree.set("ClassMap", classMapRef); 68714 } 68715 if (this.roleMap.size > 0) { 68716 const roleMapRef = this.newRef; 68717 this.xref[roleMapRef.num] = this.roleMap; 68718 structTree.set("RoleMap", roleMapRef); 68719 } 68720 if (this.namespaces.size > 0) { 68721 const namespacesRef = this.newRef; 68722 this.xref[namespacesRef.num] = Array.from(this.namespaces.values()); 68723 structTree.set("Namespaces", namespacesRef); 68724 } 68725 if (this.structTreeAF.length > 0) { 68726 const structTreeAFRef = this.newRef; 68727 this.xref[structTreeAFRef.num] = this.structTreeAF; 68728 structTree.set("AF", structTreeAFRef); 68729 } 68730 if (this.structTreePronunciationLexicon.length > 0) { 68731 const structTreePronunciationLexiconRef = this.newRef; 68732 this.xref[structTreePronunciationLexiconRef.num] = this.structTreePronunciationLexicon; 68733 structTree.set("PronunciationLexicon", structTreePronunciationLexiconRef); 68734 } 68735 rootDict.set("StructTreeRoot", structTreeRef); 68736 } 68737 #makeAcroForm() { 68738 if (this.fields.length === 0) { 68739 return; 68740 } 68741 const { 68742 rootDict 68743 } = this; 68744 const acroFormRef = this.newRef; 68745 const acroForm = this.xref[acroFormRef.num] = new Dict(); 68746 rootDict.set("AcroForm", acroFormRef); 68747 acroForm.set("Fields", this.fields); 68748 if (this.acroFormNeedAppearances) { 68749 acroForm.set("NeedAppearances", true); 68750 } 68751 if (this.acroFormSigFlags > 0) { 68752 acroForm.set("SigFlags", this.acroFormSigFlags); 68753 } 68754 acroForm.setIfArray("CO", this.acroFormCalculationOrder); 68755 acroForm.setIfDict("DR", this.acroFormDefaultResources); 68756 if (this.acroFormDefaultAppearance) { 68757 acroForm.set("DA", this.acroFormDefaultAppearance); 68758 } 68759 if (this.acroFormQ > 0) { 68760 acroForm.set("Q", this.acroFormQ); 68761 } 68762 } 68763 async #makeRoot() { 68764 const { 68765 rootDict 68766 } = this; 68767 rootDict.setIfName("Type", "Catalog"); 68768 rootDict.setIfName("Version", this.version); 68769 this.#makeAcroForm(); 68770 this.#makePageTree(); 68771 this.#makePageLabelsTree(); 68772 this.#makeEmbeddedFilesTree(); 68773 this.#makeDestinationsTree(); 68774 this.#makeStructTree(); 68775 await this.#makeOutline(); 68776 } 68777 #makeInfo() { 68778 const infoMap = new Map(); 68779 if (this.isSingleFile) { 68780 const { 68781 xref: { 68782 trailer 68783 } 68784 } = this.oldPages[0].documentData.document; 68785 const oldInfoDict = trailer.get("Info"); 68786 for (const [key, value] of oldInfoDict || []) { 68787 if (typeof value === "string") { 68788 infoMap.set(key, stringToPDFString(value)); 68789 } 68790 } 68791 } 68792 infoMap.delete("ModDate"); 68793 infoMap.set("CreationDate", getModificationDate()); 68794 infoMap.set("Creator", "PDF.js"); 68795 infoMap.set("Producer", "Firefox"); 68796 if (this.author) { 68797 infoMap.set("Author", this.author); 68798 } 68799 if (this.title) { 68800 infoMap.set("Title", this.title); 68801 } 68802 for (const [key, value] of infoMap) { 68803 this.infoDict.set(key, stringToAsciiOrUTF16BE(value)); 68804 } 68805 return infoMap; 68806 } 68807 async #makeEncrypt() { 68808 if (!this.isSingleFile) { 68809 return [null, null, null]; 68810 } 68811 const { 68812 documentData 68813 } = this.oldPages[0]; 68814 const { 68815 document: { 68816 xref: { 68817 trailer, 68818 encrypt 68819 } 68820 } 68821 } = documentData; 68822 if (!trailer.has("Encrypt")) { 68823 return [null, null, null]; 68824 } 68825 const encryptDict = trailer.get("Encrypt"); 68826 if (!(encryptDict instanceof Dict)) { 68827 return [null, null, null]; 68828 } 68829 this.currentDocument = documentData; 68830 const result = [await this.#cloneObject(encryptDict, trailer.xref), encrypt, trailer.get("ID")]; 68831 this.currentDocument = null; 68832 return result; 68833 } 68834 async #createChanges() { 68835 const changes = new RefSetCache(); 68836 changes.put(Ref.get(0, 0xffff), { 68837 data: null 68838 }); 68839 for (let i = 1, ii = this.xref.length; i < ii; i++) { 68840 if (this.objStreamRefs?.has(i)) { 68841 await this.#createObjectStream(Ref.get(i, 0), this.xref[i], changes); 68842 } else { 68843 changes.put(Ref.get(i, 0), { 68844 data: this.xref[i] 68845 }); 68846 } 68847 } 68848 return [changes, this.newRef]; 68849 } 68850 async #createObjectStream(objStreamRef, objRefs, changes) { 68851 const streamBuffer = [""]; 68852 const objOffsets = []; 68853 let offset = 0; 68854 const buffer = []; 68855 for (let i = 0, ii = objRefs.length; i < ii; i++) { 68856 const objRef = objRefs[i]; 68857 changes.put(objRef, { 68858 data: null, 68859 objStreamRef, 68860 index: i 68861 }); 68862 objOffsets.push(`${objRef.num} ${offset}`); 68863 const data = this.xref[objRef.num]; 68864 await writeValue(data, buffer, null); 68865 const obj = buffer.join(""); 68866 buffer.length = 0; 68867 streamBuffer.push(obj); 68868 offset += obj.length + 1; 68869 } 68870 streamBuffer[0] = objOffsets.join("\n"); 68871 const objStream = new StringStream(streamBuffer.join("\n")); 68872 const objStreamDict = objStream.dict = new Dict(); 68873 objStreamDict.setIfName("Type", "ObjStm"); 68874 objStreamDict.set("N", objRefs.length); 68875 objStreamDict.set("First", streamBuffer[0].length + 1); 68876 changes.put(objStreamRef, { 68877 data: objStream 68878 }); 68879 } 68880 async writePDF() { 68881 await this.#makeRoot(); 68882 const infoMap = this.#makeInfo(); 68883 const [encryptRef, encrypt, fileIds] = await this.#makeEncrypt(); 68884 const [changes, xrefTableRef] = await this.#createChanges(); 68885 const header = stringToBytes(`%PDF-${this.version}\n%\xfa\xde\xfa\xce`); 68886 return incrementalUpdate({ 68887 originalData: header, 68888 changes, 68889 xrefInfo: { 68890 startXRef: null, 68891 rootRef: this.rootRef, 68892 infoRef: this.infoRef, 68893 encryptRef, 68894 newRef: xrefTableRef, 68895 fileIds: fileIds || [null, null], 68896 infoMap 68897 }, 68898 useXrefStream: this.useObjectStreams, 68899 xref: { 68900 encrypt, 68901 encryptRef 68902 } 68903 }); 68904 } 68905} 68906 68907;// ./src/shared/base_pdf_stream.js 68908 68909 68910 68911 68912 68913 68914 68915 68916 68917class BasePDFStream { 68918 #PDFStreamReader = null; 68919 #PDFStreamRangeReader = null; 68920 _fullReader = null; 68921 _rangeReaders = new Set(); 68922 _source = null; 68923 constructor(source, PDFStreamReader, PDFStreamRangeReader) { 68924 this._source = source; 68925 this.#PDFStreamReader = PDFStreamReader; 68926 this.#PDFStreamRangeReader = PDFStreamRangeReader; 68927 } 68928 get _progressiveDataLength() { 68929 return this._fullReader?._loaded ?? 0; 68930 } 68931 getFullReader() { 68932 assert(!this._fullReader, "BasePDFStream.getFullReader can only be called once."); 68933 return this._fullReader = new this.#PDFStreamReader(this); 68934 } 68935 getRangeReader(begin, end) { 68936 if (end <= this._progressiveDataLength) { 68937 return null; 68938 } 68939 const reader = new this.#PDFStreamRangeReader(this, begin, end); 68940 this._rangeReaders.add(reader); 68941 return reader; 68942 } 68943 cancelAllRequests(reason) { 68944 this._fullReader?.cancel(reason); 68945 for (const reader of new Set(this._rangeReaders)) { 68946 reader.cancel(reason); 68947 } 68948 } 68949} 68950class BasePDFStreamReader { 68951 onProgress = null; 68952 _contentLength = 0; 68953 _filename = null; 68954 _headersCapability = Promise.withResolvers(); 68955 _isRangeSupported = false; 68956 _isStreamingSupported = false; 68957 _loaded = 0; 68958 _stream = null; 68959 constructor(stream) { 68960 this._stream = stream; 68961 } 68962 _callOnProgress() { 68963 this.onProgress?.({ 68964 loaded: this._loaded, 68965 total: this._contentLength 68966 }); 68967 } 68968 get headersReady() { 68969 return this._headersCapability.promise; 68970 } 68971 get filename() { 68972 return this._filename; 68973 } 68974 get contentLength() { 68975 return this._contentLength; 68976 } 68977 get isRangeSupported() { 68978 return this._isRangeSupported; 68979 } 68980 get isStreamingSupported() { 68981 return this._isStreamingSupported; 68982 } 68983 async read() { 68984 unreachable("Abstract method `read` called"); 68985 } 68986 cancel(reason) { 68987 unreachable("Abstract method `cancel` called"); 68988 } 68989} 68990class BasePDFStreamRangeReader { 68991 _stream = null; 68992 constructor(stream, begin, end) { 68993 this._stream = stream; 68994 } 68995 async read() { 68996 unreachable("Abstract method `read` called"); 68997 } 68998 cancel(reason) { 68999 unreachable("Abstract method `cancel` called"); 69000 } 69001} 69002 69003;// ./src/core/worker_stream.js 69004 69005class PDFWorkerStream extends BasePDFStream { 69006 constructor(source) { 69007 super(source, PDFWorkerStreamReader, PDFWorkerStreamRangeReader); 69008 } 69009} 69010class PDFWorkerStreamReader extends BasePDFStreamReader { 69011 _reader = null; 69012 constructor(stream) { 69013 super(stream); 69014 const { 69015 msgHandler 69016 } = stream._source; 69017 const readableStream = msgHandler.sendWithStream("GetReader"); 69018 this._reader = readableStream.getReader(); 69019 msgHandler.sendWithPromise("ReaderHeadersReady").then(data => { 69020 this._contentLength = data.contentLength; 69021 this._isStreamingSupported = data.isStreamingSupported; 69022 this._isRangeSupported = data.isRangeSupported; 69023 this._headersCapability.resolve(); 69024 }, this._headersCapability.reject); 69025 } 69026 async read() { 69027 const { 69028 value, 69029 done 69030 } = await this._reader.read(); 69031 if (done) { 69032 return { 69033 value: undefined, 69034 done: true 69035 }; 69036 } 69037 return { 69038 value: value.buffer, 69039 done: false 69040 }; 69041 } 69042 cancel(reason) { 69043 this._reader.cancel(reason); 69044 } 69045} 69046class PDFWorkerStreamRangeReader extends BasePDFStreamRangeReader { 69047 _reader = null; 69048 constructor(stream, begin, end) { 69049 super(stream, begin, end); 69050 const { 69051 msgHandler 69052 } = stream._source; 69053 const readableStream = msgHandler.sendWithStream("GetRangeReader", { 69054 begin, 69055 end 69056 }); 69057 this._reader = readableStream.getReader(); 69058 } 69059 async read() { 69060 const { 69061 value, 69062 done 69063 } = await this._reader.read(); 69064 if (done) { 69065 return { 69066 value: undefined, 69067 done: true 69068 }; 69069 } 69070 return { 69071 value: value.buffer, 69072 done: false 69073 }; 69074 } 69075 cancel(reason) { 69076 this._reader.cancel(reason); 69077 } 69078} 69079 69080;// ./src/core/worker.js 69081 69082 69083 69084 69085 69086 69087 69088 69089 69090 69091 69092 69093 69094 69095 69096 69097 69098 69099 69100 69101 69102 69103 69104 69105 69106 69107 69108 69109 69110 69111 69112 69113 69114 69115 69116class WorkerTask { 69117 constructor(name) { 69118 this.name = name; 69119 this.terminated = false; 69120 this._capability = Promise.withResolvers(); 69121 } 69122 get finished() { 69123 return this._capability.promise; 69124 } 69125 finish() { 69126 this._capability.resolve(); 69127 } 69128 terminate() { 69129 this.terminated = true; 69130 } 69131 ensureNotTerminated() { 69132 if (this.terminated) { 69133 throw new Error("Worker task was terminated"); 69134 } 69135 } 69136} 69137class WorkerMessageHandler { 69138 static { 69139 if (typeof window === "undefined" && !isNodeJS && typeof self !== "undefined" && typeof self.postMessage === "function" && "onmessage" in self) { 69140 this.initializeFromPort(self); 69141 } 69142 } 69143 static setup(handler, port) { 69144 let testMessageProcessed = false; 69145 handler.on("test", data => { 69146 if (testMessageProcessed) { 69147 return; 69148 } 69149 testMessageProcessed = true; 69150 handler.send("test", data instanceof Uint8Array); 69151 }); 69152 handler.on("configure", data => { 69153 setVerbosityLevel(data.verbosity); 69154 }); 69155 handler.on("GetDocRequest", data => this.createDocumentHandler(data, port)); 69156 } 69157 static createDocumentHandler(docParams, port) { 69158 let pdfManager; 69159 let terminated = false; 69160 let cancelXHRs = null; 69161 const WorkerTasks = new Set(); 69162 const verbosity = getVerbosityLevel(); 69163 const { 69164 docId, 69165 apiVersion 69166 } = docParams; 69167 const workerVersion = "5.7.284"; 69168 if (apiVersion !== workerVersion) { 69169 throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`); 69170 } 69171 const buildMsg = (type, prop) => `The \`${type}.prototype\` contains unexpected enumerable property ` + `"${prop}", thus breaking e.g. \`for...in\` iteration of ${type}s.`; 69172 for (const prop in {}) { 69173 throw new Error(buildMsg("Object", prop)); 69174 } 69175 for (const prop in []) { 69176 throw new Error(buildMsg("Array", prop)); 69177 } 69178 const workerHandlerName = docId + "_worker"; 69179 let handler = new MessageHandler(workerHandlerName, docId, port); 69180 function ensureNotTerminated() { 69181 if (terminated) { 69182 throw new Error("Worker was terminated"); 69183 } 69184 } 69185 function startWorkerTask(task) { 69186 WorkerTasks.add(task); 69187 } 69188 function finishWorkerTask(task) { 69189 task.finish(); 69190 WorkerTasks.delete(task); 69191 } 69192 async function loadDocument(recoveryMode) { 69193 await pdfManager.ensureDoc("checkHeader"); 69194 await pdfManager.ensureDoc("parseStartXRef"); 69195 await pdfManager.ensureDoc("parse", [recoveryMode]); 69196 await pdfManager.ensureDoc("checkFirstPage", [recoveryMode]); 69197 await pdfManager.ensureDoc("checkLastPage", [recoveryMode]); 69198 const isPureXfa = await pdfManager.ensureDoc("isPureXfa"); 69199 if (isPureXfa) { 69200 const task = new WorkerTask("loadXfaResources"); 69201 startWorkerTask(task); 69202 await pdfManager.ensureDoc("loadXfaResources", [handler, task]); 69203 finishWorkerTask(task); 69204 } 69205 const [numPages, fingerprints] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprints")]); 69206 const htmlForXfa = isPureXfa ? await pdfManager.ensureDoc("htmlForXfa") : null; 69207 return { 69208 numPages, 69209 fingerprints, 69210 htmlForXfa 69211 }; 69212 } 69213 async function getPdfManager({ 69214 data, 69215 password, 69216 disableAutoFetch, 69217 rangeChunkSize, 69218 docBaseUrl, 69219 enableXfa, 69220 evaluatorOptions 69221 }) { 69222 const pdfManagerArgs = { 69223 source: null, 69224 disableAutoFetch, 69225 docBaseUrl, 69226 docId, 69227 enableXfa, 69228 evaluatorOptions, 69229 handler, 69230 length: 0, 69231 password, 69232 rangeChunkSize 69233 }; 69234 if (data) { 69235 pdfManagerArgs.source = data; 69236 return new LocalPdfManager(pdfManagerArgs); 69237 } 69238 const pdfStream = new PDFWorkerStream({ 69239 msgHandler: handler 69240 }), 69241 fullReader = pdfStream.getFullReader(); 69242 const { 69243 promise, 69244 resolve, 69245 reject 69246 } = Promise.withResolvers(); 69247 let newPdfManager, 69248 cachedChunks = []; 69249 cancelXHRs = reason => pdfStream.cancelAllRequests(reason); 69250 fullReader.headersReady.then(() => { 69251 if (!fullReader.isRangeSupported) { 69252 return; 69253 } 69254 pdfManagerArgs.source = pdfStream; 69255 pdfManagerArgs.length = fullReader.contentLength; 69256 pdfManagerArgs.disableAutoFetch ||= fullReader.isStreamingSupported; 69257 newPdfManager = new NetworkPdfManager(pdfManagerArgs); 69258 for (const chunk of cachedChunks) { 69259 newPdfManager.sendProgressiveData(chunk); 69260 } 69261 cachedChunks = null; 69262 resolve(newPdfManager); 69263 cancelXHRs = null; 69264 }).catch(reason => { 69265 reject(reason); 69266 cancelXHRs = null; 69267 }); 69268 async function readData() { 69269 let loaded = 0; 69270 while (true) { 69271 const { 69272 value, 69273 done 69274 } = await fullReader.read(); 69275 ensureNotTerminated(); 69276 if (done) { 69277 break; 69278 } 69279 loaded += value.byteLength; 69280 if (!fullReader.isStreamingSupported) { 69281 handler.send("DocProgress", { 69282 loaded, 69283 total: fullReader.contentLength 69284 }); 69285 } 69286 if (newPdfManager) { 69287 newPdfManager.sendProgressiveData(value); 69288 } else { 69289 cachedChunks.push(value); 69290 } 69291 } 69292 if (!newPdfManager) { 69293 pdfManagerArgs.source = arrayBuffersToBytes(cachedChunks); 69294 cachedChunks = null; 69295 newPdfManager = new LocalPdfManager(pdfManagerArgs); 69296 resolve(newPdfManager); 69297 } 69298 cancelXHRs = null; 69299 } 69300 readData().catch(reason => { 69301 reject(reason); 69302 cancelXHRs = null; 69303 }); 69304 return promise; 69305 } 69306 function setupDoc(data) { 69307 function onSuccess(doc) { 69308 ensureNotTerminated(); 69309 handler.send("GetDoc", { 69310 pdfInfo: doc 69311 }); 69312 } 69313 function onFailure(ex) { 69314 if (terminated) { 69315 return; 69316 } 69317 if (ex instanceof PasswordException) { 69318 const task = new WorkerTask(`PasswordException: response ${ex.code}`); 69319 startWorkerTask(task);
vendor: 7,073 bytes, lines 69320-69513
69320 handler.sendWithPromise("PasswordRequest", ex).then(function ({ 69321 password 69322 }) { 69323 finishWorkerTask(task); 69324 pdfManager.updatePassword(password); 69325 pdfManagerReady(); 69326 }).catch(function () { 69327 finishWorkerTask(task); 69328 handler.send("DocException", ex); 69329 }); 69330 } else { 69331 handler.send("DocException", wrapReason(ex)); 69332 } 69333 } 69334 function pdfManagerReady() { 69335 ensureNotTerminated(); 69336 loadDocument(false).then(onSuccess, function (reason) { 69337 ensureNotTerminated(); 69338 if (!(reason instanceof XRefParseException)) { 69339 onFailure(reason); 69340 return; 69341 } 69342 pdfManager.requestLoadedStream().then(function () { 69343 ensureNotTerminated(); 69344 loadDocument(true).then(onSuccess, onFailure); 69345 }); 69346 }); 69347 } 69348 ensureNotTerminated(); 69349 getPdfManager(data).then(function (newPdfManager) { 69350 if (terminated) { 69351 newPdfManager.terminate(new AbortException("Worker was terminated.")); 69352 throw new Error("Worker was terminated"); 69353 } 69354 pdfManager = newPdfManager; 69355 pdfManager.requestLoadedStream(true).then(stream => { 69356 handler.send("DataLoaded", { 69357 length: stream.bytes.byteLength 69358 }); 69359 }); 69360 }).then(pdfManagerReady, onFailure); 69361 } 69362 handler.on("GetPage", function (data) { 69363 return pdfManager.getPage(data.pageIndex).then(function (page) { 69364 return Promise.all([pdfManager.ensure(page, "rotate"), pdfManager.ensure(page, "ref"), pdfManager.ensure(page, "userUnit"), pdfManager.ensure(page, "view")]).then(function ([rotate, ref, userUnit, view]) { 69365 return { 69366 rotate, 69367 ref, 69368 refStr: ref?.toString() ?? null, 69369 userUnit, 69370 view 69371 }; 69372 }); 69373 }); 69374 }); 69375 handler.on("GetPageIndex", function (data) { 69376 const pageRef = Ref.get(data.num, data.gen); 69377 return pdfManager.ensureCatalog("getPageIndex", [pageRef]); 69378 }); 69379 handler.on("GetDestinations", function (data) { 69380 return pdfManager.ensureCatalog("destinations"); 69381 }); 69382 handler.on("GetDestination", function (data) { 69383 return pdfManager.ensureCatalog("getDestination", [data.id]); 69384 }); 69385 handler.on("GetPageLabels", function (data) { 69386 return pdfManager.ensureCatalog("pageLabels"); 69387 }); 69388 handler.on("GetPageLayout", function (data) { 69389 return pdfManager.ensureCatalog("pageLayout"); 69390 }); 69391 handler.on("GetPageMode", function (data) { 69392 return pdfManager.ensureCatalog("pageMode"); 69393 }); 69394 handler.on("GetViewerPreferences", function (data) { 69395 return pdfManager.ensureCatalog("viewerPreferences"); 69396 }); 69397 handler.on("GetOpenAction", function (data) { 69398 return pdfManager.ensureCatalog("openAction"); 69399 }); 69400 handler.on("GetAttachments", function (data) { 69401 return pdfManager.ensureCatalog("attachments"); 69402 }); 69403 handler.on("GetDocJSActions", function (data) { 69404 return pdfManager.ensureCatalog("jsActions"); 69405 }); 69406 handler.on("GetPageJSActions", function ({ 69407 pageIndex 69408 }) { 69409 return pdfManager.getPage(pageIndex).then(page => pdfManager.ensure(page, "jsActions")); 69410 }); 69411 handler.on("GetAnnotationsByType", async function ({ 69412 types, 69413 pageIndexesToSkip 69414 }) { 69415 const [numPages, annotationGlobals] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("annotationGlobals")]); 69416 if (!annotationGlobals) { 69417 return null; 69418 } 69419 const pagePromises = []; 69420 const annotationPromises = []; 69421 let task = null; 69422 try { 69423 for (let i = 0, ii = numPages; i < ii; i++) { 69424 if (pageIndexesToSkip?.has(i)) { 69425 continue; 69426 } 69427 if (!task) { 69428 task = new WorkerTask("GetAnnotationsByType"); 69429 startWorkerTask(task); 69430 } 69431 pagePromises.push(pdfManager.getPage(i).then(async page => { 69432 if (!page) { 69433 return []; 69434 } 69435 return page.collectAnnotationsByType(handler, task, types, annotationPromises, annotationGlobals) || []; 69436 })); 69437 } 69438 await Promise.all(pagePromises); 69439 const annotations = await Promise.all(annotationPromises); 69440 return annotations.filter(a => !!a); 69441 } finally { 69442 if (task) { 69443 finishWorkerTask(task); 69444 } 69445 } 69446 }); 69447 handler.on("GetOutline", function (data) { 69448 return pdfManager.ensureCatalog("documentOutline"); 69449 }); 69450 handler.on("GetOptionalContentConfig", function (data) { 69451 return pdfManager.ensureCatalog("optionalContentConfig"); 69452 }); 69453 handler.on("GetPermissions", function (data) { 69454 return pdfManager.ensureCatalog("permissions"); 69455 }); 69456 handler.on("GetMetadata", function (data) { 69457 return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata"), pdfManager.ensureCatalog("hasStructTree")]); 69458 }); 69459 handler.on("GetMarkInfo", function (data) { 69460 return pdfManager.ensureCatalog("markInfo"); 69461 }); 69462 handler.on("GetData", function (data) { 69463 return pdfManager.requestLoadedStream().then(stream => stream.bytes); 69464 }); 69465 handler.on("GetAnnotations", function ({ 69466 pageIndex, 69467 intent 69468 }) { 69469 return pdfManager.getPage(pageIndex).then(function (page) { 69470 const task = new WorkerTask(`GetAnnotations: page ${pageIndex}`); 69471 startWorkerTask(task); 69472 return page.getAnnotationsData(handler, task, intent).then(data => { 69473 finishWorkerTask(task); 69474 return data; 69475 }, reason => { 69476 finishWorkerTask(task); 69477 throw reason; 69478 }); 69479 }); 69480 }); 69481 handler.on("GetFieldObjects", function (data) { 69482 return pdfManager.ensureDoc("fieldObjects").then(fieldObjects => fieldObjects?.allFields || null); 69483 }); 69484 handler.on("HasJSActions", function (data) { 69485 return pdfManager.ensureDoc("hasJSActions"); 69486 }); 69487 handler.on("GetCalculationOrderIds", function (data) { 69488 return pdfManager.ensureDoc("calculationOrderIds"); 69489 }); 69490 handler.on("ExtractPages", async function ({ 69491 pageInfos, 69492 annotationStorage 69493 }) { 69494 if (!pageInfos) { 69495 warn("extractPages: nothing to extract."); 69496 return null; 69497 } 69498 if (!Array.isArray(pageInfos)) { 69499 pageInfos = [pageInfos]; 69500 } 69501 let newDocumentId = 0; 69502 for (const pageInfo of pageInfos) { 69503 if (pageInfo.document === null) { 69504 pageInfo.document = pdfManager.pdfDocument; 69505 } else if (ArrayBuffer.isView(pageInfo.document)) { 69506 const manager = new LocalPdfManager({ 69507 source: pageInfo.document, 69508 docId: `${docId}_extractPages_${newDocumentId++}`, 69509 handler, 69510 password: pageInfo.password ?? null, 69511 evaluatorOptions: Object.assign({}, pdfManager.evaluatorOptions) 69512 }); 69513 let recoveryMode = false;
69514 let isValid = true; 69515 while (true) { 69516 try { 69517 await manager.requestLoadedStream(); 69518 await manager.ensureDoc("checkHeader"); 69519 await manager.ensureDoc("parseStartXRef"); 69520 await manager.ensureDoc("parse", [recoveryMode]); 69521 break; 69522 } catch (e) { 69523 if (e instanceof XRefParseException) { 69524 if (recoveryMode === false) { 69525 recoveryMode = true; 69526 continue; 69527 } else { 69528 isValid = false; 69529 warn("extractPages: XRefParseException."); 69530 } 69531 } else if (e instanceof PasswordException) { 69532 const task = new WorkerTask(`PasswordException: response ${e.code}`); 69533 startWorkerTask(task); 69534 try { 69535 const { 69536 password 69537 } = await handler.sendWithPromise("PasswordRequest", e); 69538 manager.updatePassword(password); 69539 } catch { 69540 isValid = false; 69541 warn("extractPages: invalid password."); 69542 } finally { 69543 finishWorkerTask(task); 69544 } 69545 } else { 69546 isValid = false; 69547 warn("extractPages: invalid document."); 69548 } 69549 if (!isValid) { 69550 break; 69551 } 69552 } 69553 } 69554 if (!isValid) { 69555 pageInfo.document = null; 69556 } 69557 const isPureXfa = await manager.ensureDoc("isPureXfa"); 69558 if (isPureXfa) { 69559 pageInfo.document = null; 69560 warn("extractPages does not support pure XFA documents."); 69561 } else { 69562 pageInfo.document = manager.pdfDocument; 69563 } 69564 } else { 69565 warn("extractPages: invalid document."); 69566 } 69567 } 69568 let task;
vendor: 8,756 bytes, lines 69569-69816
69569 try { 69570 const pdfEditor = new PDFEditor(); 69571 task = new WorkerTask(`ExtractPages: ${pageInfos.length} page(s)`); 69572 startWorkerTask(task); 69573 const buffer = await pdfEditor.extractPages(pageInfos, annotationStorage, handler, task); 69574 return buffer; 69575 } catch (reason) { 69576 warn(`extractPages: "${reason}".`); 69577 return null; 69578 } finally { 69579 if (task) { 69580 finishWorkerTask(task); 69581 } 69582 } 69583 }); 69584 handler.on("SaveDocument", async function ({ 69585 isPureXfa, 69586 numPages, 69587 annotationStorage, 69588 filename 69589 }) { 69590 const globalPromises = [pdfManager.requestLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("acroFormRef"), pdfManager.ensureDoc("startXRef"), pdfManager.ensureDoc("xref"), pdfManager.ensureCatalog("structTreeRoot")]; 69591 const changes = new RefSetCache(); 69592 const promises = []; 69593 const newAnnotationsByPage = !isPureXfa ? getNewAnnotationsMap(annotationStorage) : null; 69594 const [stream, acroForm, acroFormRef, startXRef, xref, _structTreeRoot] = await Promise.all(globalPromises); 69595 const catalogRef = xref.trailer.getRaw("Root") || null; 69596 let structTreeRoot; 69597 if (newAnnotationsByPage) { 69598 if (!_structTreeRoot) { 69599 if (await StructTreeRoot.canCreateStructureTree({ 69600 catalogRef, 69601 pdfManager, 69602 newAnnotationsByPage 69603 })) { 69604 structTreeRoot = null; 69605 } 69606 } else if (await _structTreeRoot.canUpdateStructTree({ 69607 pdfManager, 69608 newAnnotationsByPage 69609 })) { 69610 structTreeRoot = _structTreeRoot; 69611 } 69612 const imagePromises = AnnotationFactory.generateImages(annotationStorage.values(), xref, pdfManager.evaluatorOptions.isOffscreenCanvasSupported); 69613 const newAnnotationPromises = structTreeRoot === undefined ? promises : []; 69614 for (const [pageIndex, annotations] of newAnnotationsByPage) { 69615 newAnnotationPromises.push(pdfManager.getPage(pageIndex).then(page => { 69616 const task = new WorkerTask(`Save (editor): page ${pageIndex}`); 69617 startWorkerTask(task); 69618 return page.saveNewAnnotations(handler, task, annotations, imagePromises, changes).finally(function () { 69619 finishWorkerTask(task); 69620 }); 69621 })); 69622 } 69623 if (structTreeRoot === null) { 69624 promises.push(Promise.all(newAnnotationPromises).then(async () => { 69625 await StructTreeRoot.createStructureTree({ 69626 newAnnotationsByPage, 69627 xref, 69628 catalogRef, 69629 pdfManager, 69630 changes 69631 }); 69632 })); 69633 } else if (structTreeRoot) { 69634 promises.push(Promise.all(newAnnotationPromises).then(async () => { 69635 await structTreeRoot.updateStructureTree({ 69636 newAnnotationsByPage, 69637 pdfManager, 69638 changes 69639 }); 69640 })); 69641 } 69642 } 69643 if (isPureXfa) { 69644 promises.push(pdfManager.ensureDoc("serializeXfaData", [annotationStorage])); 69645 } else { 69646 for (let pageIndex = 0; pageIndex < numPages; pageIndex++) { 69647 promises.push(pdfManager.getPage(pageIndex).then(function (page) { 69648 const task = new WorkerTask(`Save: page ${pageIndex}`); 69649 startWorkerTask(task); 69650 return page.save(handler, task, annotationStorage, changes).finally(function () { 69651 finishWorkerTask(task); 69652 }); 69653 })); 69654 } 69655 } 69656 const refs = await Promise.all(promises); 69657 let xfaData = null; 69658 if (isPureXfa) { 69659 xfaData = refs[0]; 69660 if (!xfaData) { 69661 return stream.bytes; 69662 } 69663 } else if (changes.size === 0) { 69664 return stream.bytes; 69665 } 69666 const needAppearances = acroFormRef && acroForm instanceof Dict && changes.values().some(ref => ref.needAppearances); 69667 const xfa = acroForm instanceof Dict && acroForm.get("XFA") || null; 69668 let xfaDatasetsRef = null; 69669 let hasXfaDatasetsEntry = false; 69670 if (Array.isArray(xfa)) { 69671 for (let i = 0, ii = xfa.length; i < ii; i += 2) { 69672 if (xfa[i] === "datasets") { 69673 xfaDatasetsRef = xfa[i + 1]; 69674 hasXfaDatasetsEntry = true; 69675 } 69676 } 69677 if (xfaDatasetsRef === null) { 69678 xfaDatasetsRef = xref.getNewTemporaryRef(); 69679 } 69680 } else if (xfa) { 69681 warn("Unsupported XFA type."); 69682 } 69683 let newXrefInfo = Object.create(null); 69684 if (xref.trailer) { 69685 const infoMap = new Map(); 69686 const xrefInfo = xref.trailer.get("Info") || null; 69687 if (xrefInfo instanceof Dict) { 69688 for (const [key, value] of xrefInfo) { 69689 if (typeof value === "string") { 69690 infoMap.set(key, stringToPDFString(value)); 69691 } 69692 } 69693 } 69694 newXrefInfo = { 69695 rootRef: catalogRef, 69696 encryptRef: xref.trailer.getRaw("Encrypt") || null, 69697 newRef: xref.getNewTemporaryRef(), 69698 infoRef: xref.trailer.getRaw("Info") || null, 69699 infoMap, 69700 fileIds: xref.trailer.get("ID") || null, 69701 startXRef, 69702 filename 69703 }; 69704 } 69705 return incrementalUpdate({ 69706 originalData: stream.bytes, 69707 xrefInfo: newXrefInfo, 69708 changes, 69709 xref, 69710 hasXfa: !!xfa, 69711 xfaDatasetsRef, 69712 hasXfaDatasetsEntry, 69713 needAppearances, 69714 acroFormRef, 69715 acroForm, 69716 xfaData, 69717 useXrefStream: isDict(xref.topDict, "XRef") 69718 }).finally(() => { 69719 xref.resetNewTemporaryRef(); 69720 }); 69721 }); 69722 handler.on("GetOperatorList", function (data, sink) { 69723 const { 69724 pageId, 69725 pageIndex 69726 } = data; 69727 pdfManager.getPage(pageId).then(function (page) { 69728 const task = new WorkerTask(`GetOperatorList: page ${pageIndex}`); 69729 startWorkerTask(task); 69730 const start = verbosity >= VerbosityLevel.INFOS ? Date.now() : 0; 69731 page.getOperatorList({ 69732 handler, 69733 sink, 69734 task, 69735 intent: data.intent, 69736 cacheKey: data.cacheKey, 69737 annotationStorage: data.annotationStorage, 69738 modifiedIds: data.modifiedIds, 69739 pageIndex 69740 }).then(function (operatorListInfo) { 69741 finishWorkerTask(task); 69742 if (start) { 69743 info(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}ms, len=${operatorListInfo.length}`); 69744 } 69745 sink.close(); 69746 }, function (reason) { 69747 finishWorkerTask(task); 69748 if (task.terminated) { 69749 return; 69750 } 69751 sink.error(reason); 69752 }); 69753 }); 69754 }); 69755 handler.on("GetTextContent", function (data, sink) { 69756 const { 69757 pageId, 69758 pageIndex, 69759 includeMarkedContent, 69760 disableNormalization 69761 } = data; 69762 pdfManager.getPage(pageId).then(function (page) { 69763 const task = new WorkerTask("GetTextContent: page " + pageIndex); 69764 startWorkerTask(task); 69765 const start = verbosity >= VerbosityLevel.INFOS ? Date.now() : 0; 69766 page.extractTextContent({ 69767 handler, 69768 task, 69769 sink, 69770 includeMarkedContent, 69771 disableNormalization 69772 }).then(function () { 69773 finishWorkerTask(task); 69774 if (start) { 69775 info(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`); 69776 } 69777 sink.close(); 69778 }, function (reason) { 69779 finishWorkerTask(task); 69780 if (task.terminated) { 69781 return; 69782 } 69783 sink.error(reason); 69784 }); 69785 }); 69786 }); 69787 handler.on("GetStructTree", function (data) { 69788 return pdfManager.getPage(data.pageIndex).then(page => pdfManager.ensure(page, "getStructTree")); 69789 }); 69790 handler.on("FontFallback", function (data) { 69791 return pdfManager.fontFallback(data.id, handler); 69792 }); 69793 handler.on("Cleanup", function (data) { 69794 return pdfManager.cleanup(true); 69795 }); 69796 handler.on("Terminate", async function (data) { 69797 terminated = true; 69798 const waitOn = []; 69799 if (pdfManager) { 69800 pdfManager.terminate(new AbortException("Worker was terminated.")); 69801 const cleanupPromise = pdfManager.cleanup(); 69802 waitOn.push(cleanupPromise); 69803 pdfManager = null; 69804 } else { 69805 clearGlobalCaches(); 69806 } 69807 cancelXHRs?.(new AbortException("Worker was terminated.")); 69808 for (const task of WorkerTasks) { 69809 waitOn.push(task.finished); 69810 task.terminate(); 69811 } 69812 await Promise.all(waitOn); 69813 handler.destroy(); 69814 handler = null; 69815 }); 69816 handler.on("Ready", function (data
vendor: 442 bytes, lines 69816-69837
69816) { 69817 setupDoc(docParams); 69818 docParams = null; 69819 }); 69820 return workerHandlerName; 69821 } 69822 static initializeFromPort(port) { 69823 const handler = new MessageHandler("worker", "main", port); 69824 this.setup(handler, port); 69825 handler.send("ready", null); 69826 } 69827} 69828 69829;// ./src/pdf.worker.js 69830 69831globalThis.pdfjsWorker = { 69832 WorkerMessageHandler: WorkerMessageHandler 69833}; 69834 69835export { WorkerMessageHandler }; 69836 69837//# sourceMappingURL=pdf.worker.mjs.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.