1/*! 2 * jQuery JavaScript Library v3.3.1 3 * https://jquery.com/ 4 * 5 * Includes Sizzle.js 6 * https://sizzlejs.com/ 7 * 8 * Copyright JS Foundation and other contributors 9 * Released under the MIT license 10 * https://jquery.org/license 11 * 12 * Date: 2018-01-20T17:24Z 13 */
vendor: 42,618 bytes, lines 14-1590
14 15( function( global, factory ) { 16 17 "use strict"; 18 19 if ( typeof module === "object" && typeof module.exports === "object" ) { 20 21 // For CommonJS and CommonJS-like environments where a proper `window` 22 // is present, execute the factory and get jQuery. 23 // For environments that do not have a `window` with a `document` 24 // (such as Node.js), expose a factory as module.exports. 25 // This accentuates the need for the creation of a real `window`. 26 // e.g. var jQuery = require("jquery")(window); 27 // See ticket #14549 for more info. 28 module.exports = global.document ? 29 factory( global, true ) : 30 function( w ) { 31 if ( !w.document ) { 32 throw new Error( "jQuery requires a window with a document" ); 33 } 34 return factory( w ); 35 }; 36 } else { 37 factory( global ); 38 } 39 40// Pass this if window is not defined yet 41} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { 42 43// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 44// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode 45// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common 46// enough that all such attempts are guarded in a try block. 47"use strict"; 48 49var arr = []; 50 51var document = window.document; 52 53var getProto = Object.getPrototypeOf; 54 55var slice = arr.slice; 56 57var concat = arr.concat; 58 59var push = arr.push; 60 61var indexOf = arr.indexOf; 62 63var class2type = {}; 64 65var toString = class2type.toString; 66 67var hasOwn = class2type.hasOwnProperty; 68 69var fnToString = hasOwn.toString; 70 71var ObjectFunctionString = fnToString.call( Object ); 72 73var support = {}; 74 75var isFunction = function isFunction( obj ) { 76 77 // Support: Chrome <=57, Firefox <=52 78 // In some browsers, typeof returns "function" for HTML <object> elements 79 // (i.e., `typeof document.createElement( "object" ) === "function"`). 80 // We don't want to classify *any* DOM node as a function. 81 return typeof obj === "function" && typeof obj.nodeType !== "number"; 82 }; 83 84 85var isWindow = function isWindow( obj ) { 86 return obj != null && obj === obj.window; 87 }; 88 89 90 91 92 var preservedScriptAttributes = { 93 type: true, 94 src: true, 95 noModule: true 96 }; 97 98 function DOMEval( code, doc, node ) { 99 doc = doc || document; 100 101 var i, 102 script = doc.createElement( "script" ); 103 104 script.text = code; 105 if ( node ) { 106 for ( i in preservedScriptAttributes ) { 107 if ( node[ i ] ) { 108 script[ i ] = node[ i ]; 109 } 110 } 111 } 112 doc.head.appendChild( script ).parentNode.removeChild( script ); 113 } 114 115 116function toType( obj ) { 117 if ( obj == null ) { 118 return obj + ""; 119 } 120 121 // Support: Android <=2.3 only (functionish RegExp) 122 return typeof obj === "object" || typeof obj === "function" ? 123 class2type[ toString.call( obj ) ] || "object" : 124 typeof obj; 125} 126/* global Symbol */ 127// Defining this global in .eslintrc.json would create a danger of using the global 128// unguarded in another place, it seems safer to define global only for this module 129 130 131 132var 133 version = "3.3.1", 134 135 // Define a local copy of jQuery 136 jQuery = function( selector, context ) { 137 138 // The jQuery object is actually just the init constructor 'enhanced' 139 // Need init if jQuery is called (just allow error to be thrown if not included) 140 return new jQuery.fn.init( selector, context ); 141 }, 142 143 // Support: Android <=4.0 only 144 // Make sure we trim BOM and NBSP 145 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; 146 147jQuery.fn = jQuery.prototype = { 148 149 // The current version of jQuery being used 150 jquery: version, 151 152 constructor: jQuery, 153 154 // The default length of a jQuery object is 0 155 length: 0, 156 157 toArray: function() { 158 return slice.call( this ); 159 }, 160 161 // Get the Nth element in the matched element set OR 162 // Get the whole matched element set as a clean array 163 get: function( num ) { 164 165 // Return all the elements in a clean array 166 if ( num == null ) { 167 return slice.call( this ); 168 } 169 170 // Return just the one element from the set 171 return num < 0 ? this[ num + this.length ] : this[ num ]; 172 }, 173 174 // Take an array of elements and push it onto the stack 175 // (returning the new matched element set) 176 pushStack: function( elems ) { 177 178 // Build a new jQuery matched element set 179 var ret = jQuery.merge( this.constructor(), elems ); 180 181 // Add the old object onto the stack (as a reference) 182 ret.prevObject = this; 183 184 // Return the newly-formed element set 185 return ret; 186 }, 187 188 // Execute a callback for every element in the matched set. 189 each: function( callback ) { 190 return jQuery.each( this, callback ); 191 }, 192 193 map: function( callback ) { 194 return this.pushStack( jQuery.map( this, function( elem, i ) { 195 return callback.call( elem, i, elem ); 196 } ) ); 197 }, 198 199 slice: function() { 200 return this.pushStack( slice.apply( this, arguments ) ); 201 }, 202 203 first: function() { 204 return this.eq( 0 ); 205 }, 206 207 last: function() { 208 return this.eq( -1 ); 209 }, 210 211 eq: function( i ) { 212 var len = this.length, 213 j = +i + ( i < 0 ? len : 0 ); 214 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); 215 }, 216 217 end: function() { 218 return this.prevObject || this.constructor(); 219 }, 220 221 // For internal use only. 222 // Behaves like an Array's method, not like a jQuery method. 223 push: push, 224 sort: arr.sort, 225 splice: arr.splice 226}; 227 228jQuery.extend = jQuery.fn.extend = function() { 229 var options, name, src, copy, copyIsArray, clone, 230 target = arguments[ 0 ] || {}, 231 i = 1, 232 length = arguments.length, 233 deep = false; 234 235 // Handle a deep copy situation 236 if ( typeof target === "boolean" ) { 237 deep = target; 238 239 // Skip the boolean and the target 240 target = arguments[ i ] || {}; 241 i++; 242 } 243 244 // Handle case when target is a string or something (possible in deep copy) 245 if ( typeof target !== "object" && !isFunction( target ) ) { 246 target = {}; 247 } 248 249 // Extend jQuery itself if only one argument is passed 250 if ( i === length ) { 251 target = this; 252 i--; 253 } 254 255 for ( ; i < length; i++ ) { 256 257 // Only deal with non-null/undefined values 258 if ( ( options = arguments[ i ] ) != null ) { 259 260 // Extend the base object 261 for ( name in options ) { 262 src = target[ name ]; 263 copy = options[ name ]; 264 265 // Prevent never-ending loop 266 if ( target === copy ) { 267 continue; 268 } 269 270 // Recurse if we're merging plain objects or arrays 271 if ( deep && copy && ( jQuery.isPlainObject( copy ) || 272 ( copyIsArray = Array.isArray( copy ) ) ) ) { 273 274 if ( copyIsArray ) { 275 copyIsArray = false; 276 clone = src && Array.isArray( src ) ? src : []; 277 278 } else { 279 clone = src && jQuery.isPlainObject( src ) ? src : {}; 280 } 281 282 // Never move original objects, clone them 283 target[ name ] = jQuery.extend( deep, clone, copy ); 284 285 // Don't bring in undefined values 286 } else if ( copy !== undefined ) { 287 target[ name ] = copy; 288 } 289 } 290 } 291 } 292 293 // Return the modified object 294 return target; 295}; 296 297jQuery.extend( { 298 299 // Unique for each copy of jQuery on the page 300 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), 301 302 // Assume jQuery is ready without the ready module 303 isReady: true, 304 305 error: function( msg ) { 306 throw new Error( msg ); 307 }, 308 309 noop: function() {}, 310 311 isPlainObject: function( obj ) { 312 var proto, Ctor; 313 314 // Detect obvious negatives 315 // Use toString instead of jQuery.type to catch host objects 316 if ( !obj || toString.call( obj ) !== "[object Object]" ) { 317 return false; 318 } 319 320 proto = getProto( obj ); 321 322 // Objects with no prototype (e.g., `Object.create( null )`) are plain 323 if ( !proto ) { 324 return true; 325 } 326 327 // Objects with prototype are plain iff they were constructed by a global Object function 328 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; 329 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; 330 }, 331 332 isEmptyObject: function( obj ) { 333 334 /* eslint-disable no-unused-vars */ 335 // See https://github.com/eslint/eslint/issues/6125 336 var name; 337 338 for ( name in obj ) { 339 return false; 340 } 341 return true; 342 }, 343 344 // Evaluates a script in a global context 345 globalEval: function( code ) { 346 DOMEval( code ); 347 }, 348 349 each: function( obj, callback ) { 350 var length, i = 0; 351 352 if ( isArrayLike( obj ) ) { 353 length = obj.length; 354 for ( ; i < length; i++ ) { 355 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 356 break; 357 } 358 } 359 } else { 360 for ( i in obj ) { 361 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 362 break; 363 } 364 } 365 } 366 367 return obj; 368 }, 369 370 // Support: Android <=4.0 only 371 trim: function( text ) { 372 return text == null ? 373 "" : 374 ( text + "" ).replace( rtrim, "" ); 375 }, 376 377 // results is for internal usage only 378 makeArray: function( arr, results ) { 379 var ret = results || []; 380 381 if ( arr != null ) { 382 if ( isArrayLike( Object( arr ) ) ) { 383 jQuery.merge( ret, 384 typeof arr === "string" ? 385 [ arr ] : arr 386 ); 387 } else { 388 push.call( ret, arr ); 389 } 390 } 391 392 return ret; 393 }, 394 395 inArray: function( elem, arr, i ) { 396 return arr == null ? -1 : indexOf.call( arr, elem, i ); 397 }, 398 399 // Support: Android <=4.0 only, PhantomJS 1 only 400 // push.apply(_, arraylike) throws on ancient WebKit 401 merge: function( first, second ) { 402 var len = +second.length, 403 j = 0, 404 i = first.length; 405 406 for ( ; j < len; j++ ) { 407 first[ i++ ] = second[ j ]; 408 } 409 410 first.length = i; 411 412 return first; 413 }, 414 415 grep: function( elems, callback, invert ) { 416 var callbackInverse, 417 matches = [], 418 i = 0, 419 length = elems.length, 420 callbackExpect = !invert; 421 422 // Go through the array, only saving the items 423 // that pass the validator function 424 for ( ; i < length; i++ ) { 425 callbackInverse = !callback( elems[ i ], i ); 426 if ( callbackInverse !== callbackExpect ) { 427 matches.push( elems[ i ] ); 428 } 429 } 430 431 return matches; 432 }, 433 434 // arg is for internal usage only 435 map: function( elems, callback, arg ) { 436 var length, value, 437 i = 0, 438 ret = []; 439 440 // Go through the array, translating each of the items to their new values 441 if ( isArrayLike( elems ) ) { 442 length = elems.length; 443 for ( ; i < length; i++ ) { 444 value = callback( elems[ i ], i, arg ); 445 446 if ( value != null ) { 447 ret.push( value ); 448 } 449 } 450 451 // Go through every key on the object, 452 } else { 453 for ( i in elems ) { 454 value = callback( elems[ i ], i, arg ); 455 456 if ( value != null ) { 457 ret.push( value ); 458 } 459 } 460 } 461 462 // Flatten any nested arrays 463 return concat.apply( [], ret ); 464 }, 465 466 // A global GUID counter for objects 467 guid: 1, 468 469 // jQuery.support is not used in Core but other projects attach their 470 // properties to it so it needs to exist. 471 support: support 472} ); 473 474if ( typeof Symbol === "function" ) { 475 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; 476} 477 478// Populate the class2type map 479jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 480function( i, name ) { 481 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 482} ); 483 484function isArrayLike( obj ) { 485 486 // Support: real iOS 8.2 only (not reproducible in simulator) 487 // `in` check used to prevent JIT error (gh-2145) 488 // hasOwn isn't used here due to false negatives 489 // regarding Nodelist length in IE 490 var length = !!obj && "length" in obj && obj.length, 491 type = toType( obj ); 492 493 if ( isFunction( obj ) || isWindow( obj ) ) { 494 return false; 495 } 496 497 return type === "array" || length === 0 || 498 typeof length === "number" && length > 0 && ( length - 1 ) in obj; 499} 500var Sizzle = 501/*! 502 * Sizzle CSS Selector Engine v2.3.3 503 * https://sizzlejs.com/ 504 * 505 * Copyright jQuery Foundation and other contributors 506 * Released under the MIT license 507 * http://jquery.org/license 508 * 509 * Date: 2016-08-08 510 */ 511(function( window ) { 512 513var i, 514 support, 515 Expr, 516 getText, 517 isXML, 518 tokenize, 519 compile, 520 select, 521 outermostContext, 522 sortInput, 523 hasDuplicate, 524 525 // Local document vars 526 setDocument, 527 document, 528 docElem, 529 documentIsHTML, 530 rbuggyQSA, 531 rbuggyMatches, 532 matches, 533 contains, 534 535 // Instance-specific data 536 expando = "sizzle" + 1 * new Date(), 537 preferredDoc = window.document, 538 dirruns = 0, 539 done = 0, 540 classCache = createCache(), 541 tokenCache = createCache(), 542 compilerCache = createCache(), 543 sortOrder = function( a, b ) { 544 if ( a === b ) { 545 hasDuplicate = true; 546 } 547 return 0; 548 }, 549 550 // Instance methods 551 hasOwn = ({}).hasOwnProperty, 552 arr = [], 553 pop = arr.pop, 554 push_native = arr.push, 555 push = arr.push, 556 slice = arr.slice, 557 // Use a stripped-down indexOf as it's faster than native 558 // https://jsperf.com/thor-indexof-vs-for/5 559 indexOf = function( list, elem ) { 560 var i = 0, 561 len = list.length; 562 for ( ; i < len; i++ ) { 563 if ( list[i] === elem ) { 564 return i; 565 } 566 } 567 return -1; 568 }, 569 570 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", 571 572 // Regular expressions 573 574 // http://www.w3.org/TR/css3-selectors/#whitespace 575 whitespace = "[\\x20\\t\\r\\n\\f]", 576 577 // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier 578 identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+", 579 580 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors 581 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + 582 // Operator (capture 2) 583 "*([*^$|!~]?=)" + whitespace + 584 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" 585 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + 586 "*\\]", 587 588 pseudos = ":(" + identifier + ")(?:\\((" + 589 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: 590 // 1. quoted (capture 3; capture 4 or capture 5) 591 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + 592 // 2. simple (capture 6) 593 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + 594 // 3. anything else (capture 2) 595 ".*" + 596 ")\\)|)", 597 598 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 599 rwhitespace = new RegExp( whitespace + "+", "g" ), 600 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), 601 602 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), 603 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), 604 605 rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), 606 607 rpseudo = new RegExp( pseudos ), 608 ridentifier = new RegExp( "^" + identifier + "$" ), 609 610 matchExpr = { 611 "ID": new RegExp( "^#(" + identifier + ")" ), 612 "CLASS": new RegExp( "^\\.(" + identifier + ")" ), 613 "TAG": new RegExp( "^(" + identifier + "|[*])" ), 614 "ATTR": new RegExp( "^" + attributes ), 615 "PSEUDO": new RegExp( "^" + pseudos ), 616 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + 617 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + 618 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), 619 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), 620 // For use in libraries implementing .is() 621 // We use this for POS matching in `select` 622 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + 623 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) 624 }, 625 626 rinputs = /^(?:input|select|textarea|button)$/i, 627 rheader = /^h\d$/i, 628 629 rnative = /^[^{]+\{\s*\[native \w/, 630 631 // Easily-parseable/retrievable ID or TAG or CLASS selectors 632 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 633 634 rsibling = /[+~]/, 635 636 // CSS escapes 637 // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters 638 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), 639 funescape = function( _, escaped, escapedWhitespace ) { 640 var high = "0x" + escaped - 0x10000; 641 // NaN means non-codepoint 642 // Support: Firefox<24 643 // Workaround erroneous numeric interpretation of +"0x" 644 return high !== high || escapedWhitespace ? 645 escaped : 646 high < 0 ? 647 // BMP codepoint 648 String.fromCharCode( high + 0x10000 ) : 649 // Supplemental Plane codepoint (surrogate pair) 650 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); 651 }, 652 653 // CSS string/identifier serialization 654 // https://drafts.csswg.org/cssom/#common-serializing-idioms 655 rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, 656 fcssescape = function( ch, asCodePoint ) { 657 if ( asCodePoint ) { 658 659 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 660 if ( ch === "\0" ) { 661 return "\uFFFD"; 662 } 663 664 // Control characters and (dependent upon position) numbers get escaped as code points 665 return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; 666 } 667 668 // Other potentially-special ASCII characters get backslash-escaped 669 return "\\" + ch; 670 }, 671 672 // Used for iframes 673 // See setDocument() 674 // Removing the function wrapper causes a "Permission Denied" 675 // error in IE 676 unloadHandler = function() { 677 setDocument(); 678 }, 679 680 disabledAncestor = addCombinator( 681 function( elem ) { 682 return elem.disabled === true && ("form" in elem || "label" in elem); 683 }, 684 { dir: "parentNode", next: "legend" } 685 ); 686 687// Optimize for push.apply( _, NodeList ) 688try { 689 push.apply( 690 (arr = slice.call( preferredDoc.childNodes )), 691 preferredDoc.childNodes 692 ); 693 // Support: Android<4.0 694 // Detect silently failing push.apply 695 arr[ preferredDoc.childNodes.length ].nodeType; 696} catch ( e ) { 697 push = { apply: arr.length ? 698 699 // Leverage slice if possible 700 function( target, els ) { 701 push_native.apply( target, slice.call(els) ); 702 } : 703 704 // Support: IE<9 705 // Otherwise append directly 706 function( target, els ) { 707 var j = target.length, 708 i = 0; 709 // Can't trust NodeList.length 710 while ( (target[j++] = els[i++]) ) {} 711 target.length = j - 1; 712 } 713 }; 714} 715 716function Sizzle( selector, context, results, seed ) { 717 var m, i, elem, nid, match, groups, newSelector, 718 newContext = context && context.ownerDocument, 719 720 // nodeType defaults to 9, since context defaults to document 721 nodeType = context ? context.nodeType : 9; 722 723 results = results || []; 724 725 // Return early from calls with invalid selector or context 726 if ( typeof selector !== "string" || !selector || 727 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { 728 729 return results; 730 } 731 732 // Try to shortcut find operations (as opposed to filters) in HTML documents 733 if ( !seed ) { 734 735 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { 736 setDocument( context ); 737 } 738 context = context || document; 739 740 if ( documentIsHTML ) { 741 742 // If the selector is sufficiently simple, try using a "get*By*" DOM method 743 // (excepting DocumentFragment context, where the methods don't exist) 744 if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { 745 746 // ID selector 747 if ( (m = match[1]) ) { 748 749 // Document context 750 if ( nodeType === 9 ) { 751 if ( (elem = context.getElementById( m )) ) { 752 753 // Support: IE, Opera, Webkit 754 // TODO: identify versions 755 // getElementById can match elements by name instead of ID 756 if ( elem.id === m ) { 757 results.push( elem ); 758 return results; 759 } 760 } else { 761 return results; 762 } 763 764 // Element context 765 } else { 766 767 // Support: IE, Opera, Webkit 768 // TODO: identify versions 769 // getElementById can match elements by name instead of ID 770 if ( newContext && (elem = newContext.getElementById( m )) && 771 contains( context, elem ) && 772 elem.id === m ) { 773 774 results.push( elem ); 775 return results; 776 } 777 } 778 779 // Type selector 780 } else if ( match[2] ) { 781 push.apply( results, context.getElementsByTagName( selector ) ); 782 return results; 783 784 // Class selector 785 } else if ( (m = match[3]) && support.getElementsByClassName && 786 context.getElementsByClassName ) { 787 788 push.apply( results, context.getElementsByClassName( m ) ); 789 return results; 790 } 791 } 792 793 // Take advantage of querySelectorAll 794 if ( support.qsa && 795 !compilerCache[ selector + " " ] && 796 (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { 797 798 if ( nodeType !== 1 ) { 799 newContext = context; 800 newSelector = selector; 801 802 // qSA looks outside Element context, which is not what we want 803 // Thanks to Andrew Dupont for this workaround technique 804 // Support: IE <=8 805 // Exclude object elements 806 } else if ( context.nodeName.toLowerCase() !== "object" ) { 807 808 // Capture the context ID, setting it first if necessary 809 if ( (nid = context.getAttribute( "id" )) ) { 810 nid = nid.replace( rcssescape, fcssescape ); 811 } else { 812 context.setAttribute( "id", (nid = expando) ); 813 } 814 815 // Prefix every selector in the list 816 groups = tokenize( selector ); 817 i = groups.length; 818 while ( i-- ) { 819 groups[i] = "#" + nid + " " + toSelector( groups[i] ); 820 } 821 newSelector = groups.join( "," ); 822 823 // Expand context for sibling selectors 824 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || 825 context; 826 } 827 828 if ( newSelector ) { 829 try { 830 push.apply( results, 831 newContext.querySelectorAll( newSelector ) 832 ); 833 return results; 834 } catch ( qsaError ) { 835 } finally { 836 if ( nid === expando ) { 837 context.removeAttribute( "id" ); 838 } 839 } 840 } 841 } 842 } 843 } 844 845 // All others 846 return select( selector.replace( rtrim, "$1" ), context, results, seed ); 847} 848 849/** 850 * Create key-value caches of limited size 851 * @returns {function(string, object)} Returns the Object data after storing it on itself with 852 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 853 * deleting the oldest entry 854 */ 855function createCache() { 856 var keys = []; 857 858 function cache( key, value ) { 859 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) 860 if ( keys.push( key + " " ) > Expr.cacheLength ) { 861 // Only keep the most recent entries 862 delete cache[ keys.shift() ]; 863 } 864 return (cache[ key + " " ] = value); 865 } 866 return cache; 867} 868 869/** 870 * Mark a function for special use by Sizzle 871 * @param {Function} fn The function to mark 872 */ 873function markFunction( fn ) { 874 fn[ expando ] = true; 875 return fn; 876} 877 878/** 879 * Support testing using an element 880 * @param {Function} fn Passed the created element and returns a boolean result 881 */ 882function assert( fn ) { 883 var el = document.createElement("fieldset"); 884 885 try { 886 return !!fn( el ); 887 } catch (e) { 888 return false; 889 } finally { 890 // Remove from its parent by default 891 if ( el.parentNode ) { 892 el.parentNode.removeChild( el ); 893 } 894 // release memory in IE 895 el = null; 896 } 897} 898 899/** 900 * Adds the same handler for all of the specified attrs 901 * @param {String} attrs Pipe-separated list of attributes 902 * @param {Function} handler The method that will be applied 903 */ 904function addHandle( attrs, handler ) { 905 var arr = attrs.split("|"), 906 i = arr.length; 907 908 while ( i-- ) { 909 Expr.attrHandle[ arr[i] ] = handler; 910 } 911} 912 913/** 914 * Checks document order of two siblings 915 * @param {Element} a 916 * @param {Element} b 917 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b 918 */ 919function siblingCheck( a, b ) { 920 var cur = b && a, 921 diff = cur && a.nodeType === 1 && b.nodeType === 1 && 922 a.sourceIndex - b.sourceIndex; 923 924 // Use IE sourceIndex if available on both nodes 925 if ( diff ) { 926 return diff; 927 } 928 929 // Check if b follows a 930 if ( cur ) { 931 while ( (cur = cur.nextSibling) ) { 932 if ( cur === b ) { 933 return -1; 934 } 935 } 936 } 937 938 return a ? 1 : -1; 939} 940 941/** 942 * Returns a function to use in pseudos for input types 943 * @param {String} type 944 */ 945function createInputPseudo( type ) { 946 return function( elem ) { 947 var name = elem.nodeName.toLowerCase(); 948 return name === "input" && elem.type === type; 949 }; 950} 951 952/** 953 * Returns a function to use in pseudos for buttons 954 * @param {String} type 955 */ 956function createButtonPseudo( type ) { 957 return function( elem ) { 958 var name = elem.nodeName.toLowerCase(); 959 return (name === "input" || name === "button") && elem.type === type; 960 }; 961} 962 963/** 964 * Returns a function to use in pseudos for :enabled/:disabled 965 * @param {Boolean} disabled true for :disabled; false for :enabled 966 */ 967function createDisabledPseudo( disabled ) { 968 969 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable 970 return function( elem ) { 971 972 // Only certain elements can match :enabled or :disabled 973 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled 974 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled 975 if ( "form" in elem ) { 976 977 // Check for inherited disabledness on relevant non-disabled elements: 978 // * listed form-associated elements in a disabled fieldset 979 // https://html.spec.whatwg.org/multipage/forms.html#category-listed 980 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled 981 // * option elements in a disabled optgroup 982 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled 983 // All such elements have a "form" property. 984 if ( elem.parentNode && elem.disabled === false ) { 985 986 // Option elements defer to a parent optgroup if present 987 if ( "label" in elem ) { 988 if ( "label" in elem.parentNode ) { 989 return elem.parentNode.disabled === disabled; 990 } else { 991 return elem.disabled === disabled; 992 } 993 } 994 995 // Support: IE 6 - 11 996 // Use the isDisabled shortcut property to check for disabled fieldset ancestors 997 return elem.isDisabled === disabled || 998 999 // Where there is no isDisabled, check manually 1000 /* jshint -W018 */ 1001 elem.isDisabled !== !disabled && 1002 disabledAncestor( elem ) === disabled; 1003 } 1004 1005 return elem.disabled === disabled; 1006 1007 // Try to winnow out elements that can't be disabled before trusting the disabled property. 1008 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't 1009 // even exist on them, let alone have a boolean value. 1010 } else if ( "label" in elem ) { 1011 return elem.disabled === disabled; 1012 } 1013 1014 // Remaining elements are neither :enabled nor :disabled 1015 return false; 1016 }; 1017} 1018 1019/** 1020 * Returns a function to use in pseudos for positionals 1021 * @param {Function} fn 1022 */ 1023function createPositionalPseudo( fn ) { 1024 return markFunction(function( argument ) { 1025 argument = +argument; 1026 return markFunction(function( seed, matches ) { 1027 var j, 1028 matchIndexes = fn( [], seed.length, argument ), 1029 i = matchIndexes.length; 1030 1031 // Match elements found at the specified indexes 1032 while ( i-- ) { 1033 if ( seed[ (j = matchIndexes[i]) ] ) { 1034 seed[j] = !(matches[j] = seed[j]); 1035 } 1036 } 1037 }); 1038 }); 1039} 1040 1041/** 1042 * Checks a node for validity as a Sizzle context 1043 * @param {Element|Object=} context 1044 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value 1045 */ 1046function testContext( context ) { 1047 return context && typeof context.getElementsByTagName !== "undefined" && context; 1048} 1049 1050// Expose support vars for convenience 1051support = Sizzle.support = {}; 1052 1053/** 1054 * Detects XML nodes 1055 * @param {Element|Object} elem An element or a document 1056 * @returns {Boolean} True iff elem is a non-HTML XML node 1057 */ 1058isXML = Sizzle.isXML = function( elem ) { 1059 // documentElement is verified for cases where it doesn't yet exist 1060 // (such as loading iframes in IE - #4833) 1061 var documentElement = elem && (elem.ownerDocument || elem).documentElement; 1062 return documentElement ? documentElement.nodeName !== "HTML" : false; 1063}; 1064 1065/** 1066 * Sets document-related variables once based on the current document 1067 * @param {Element|Object} [doc] An element or document object to use to set the document 1068 * @returns {Object} Returns the current document 1069 */ 1070setDocument = Sizzle.setDocument = function( node ) { 1071 var hasCompare, subWindow, 1072 doc = node ? node.ownerDocument || node : preferredDoc; 1073 1074 // Return early if doc is invalid or already selected 1075 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { 1076 return document; 1077 } 1078 1079 // Update global variables 1080 document = doc; 1081 docElem = document.documentElement; 1082 documentIsHTML = !isXML( document ); 1083 1084 // Support: IE 9-11, Edge 1085 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) 1086 if ( preferredDoc !== document && 1087 (subWindow = document.defaultView) && subWindow.top !== subWindow ) { 1088 1089 // Support: IE 11, Edge 1090 if ( subWindow.addEventListener ) { 1091 subWindow.addEventListener( "unload", unloadHandler, false ); 1092 1093 // Support: IE 9 - 10 only 1094 } else if ( subWindow.attachEvent ) { 1095 subWindow.attachEvent( "onunload", unloadHandler ); 1096 } 1097 } 1098 1099 /* Attributes 1100 ---------------------------------------------------------------------- */ 1101 1102 // Support: IE<8 1103 // Verify that getAttribute really returns attributes and not properties 1104 // (excepting IE8 booleans) 1105 support.attributes = assert(function( el ) { 1106 el.className = "i"; 1107 return !el.getAttribute("className"); 1108 }); 1109 1110 /* getElement(s)By* 1111 ---------------------------------------------------------------------- */ 1112 1113 // Check if getElementsByTagName("*") returns only elements 1114 support.getElementsByTagName = assert(function( el ) { 1115 el.appendChild( document.createComment("") ); 1116 return !el.getElementsByTagName("*").length; 1117 }); 1118 1119 // Support: IE<9 1120 support.getElementsByClassName = rnative.test( document.getElementsByClassName ); 1121 1122 // Support: IE<10 1123 // Check if getElementById returns elements by name 1124 // The broken getElementById methods don't pick up programmatically-set names, 1125 // so use a roundabout getElementsByName test 1126 support.getById = assert(function( el ) { 1127 docElem.appendChild( el ).id = expando; 1128 return !document.getElementsByName || !document.getElementsByName( expando ).length; 1129 }); 1130 1131 // ID filter and find 1132 if ( support.getById ) { 1133 Expr.filter["ID"] = function( id ) { 1134 var attrId = id.replace( runescape, funescape ); 1135 return function( elem ) { 1136 return elem.getAttribute("id") === attrId; 1137 }; 1138 }; 1139 Expr.find["ID"] = function( id, context ) { 1140 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 1141 var elem = context.getElementById( id ); 1142 return elem ? [ elem ] : []; 1143 } 1144 }; 1145 } else { 1146 Expr.filter["ID"] = function( id ) { 1147 var attrId = id.replace( runescape, funescape ); 1148 return function( elem ) { 1149 var node = typeof elem.getAttributeNode !== "undefined" && 1150 elem.getAttributeNode("id"); 1151 return node && node.value === attrId; 1152 }; 1153 }; 1154 1155 // Support: IE 6 - 7 only 1156 // getElementById is not reliable as a find shortcut 1157 Expr.find["ID"] = function( id, context ) { 1158 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 1159 var node, i, elems, 1160 elem = context.getElementById( id ); 1161 1162 if ( elem ) { 1163 1164 // Verify the id attribute 1165 node = elem.getAttributeNode("id"); 1166 if ( node && node.value === id ) { 1167 return [ elem ]; 1168 } 1169 1170 // Fall back on getElementsByName 1171 elems = context.getElementsByName( id ); 1172 i = 0; 1173 while ( (elem = elems[i++]) ) { 1174 node = elem.getAttributeNode("id"); 1175 if ( node && node.value === id ) { 1176 return [ elem ]; 1177 } 1178 } 1179 } 1180 1181 return []; 1182 } 1183 }; 1184 } 1185 1186 // Tag 1187 Expr.find["TAG"] = support.getElementsByTagName ? 1188 function( tag, context ) { 1189 if ( typeof context.getElementsByTagName !== "undefined" ) { 1190 return context.getElementsByTagName( tag ); 1191 1192 // DocumentFragment nodes don't have gEBTN 1193 } else if ( support.qsa ) { 1194 return context.querySelectorAll( tag ); 1195 } 1196 } : 1197 1198 function( tag, context ) { 1199 var elem, 1200 tmp = [], 1201 i = 0, 1202 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too 1203 results = context.getElementsByTagName( tag ); 1204 1205 // Filter out possible comments 1206 if ( tag === "*" ) { 1207 while ( (elem = results[i++]) ) { 1208 if ( elem.nodeType === 1 ) { 1209 tmp.push( elem ); 1210 } 1211 } 1212 1213 return tmp; 1214 } 1215 return results; 1216 }; 1217 1218 // Class 1219 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { 1220 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { 1221 return context.getElementsByClassName( className ); 1222 } 1223 }; 1224 1225 /* QSA/matchesSelector 1226 ---------------------------------------------------------------------- */ 1227 1228 // QSA and matchesSelector support 1229 1230 // matchesSelector(:active) reports false when true (IE9/Opera 11.5) 1231 rbuggyMatches = []; 1232 1233 // qSa(:focus) reports false when true (Chrome 21) 1234 // We allow this because of a bug in IE8/9 that throws an error 1235 // whenever `document.activeElement` is accessed on an iframe 1236 // So, we allow :focus to pass through QSA all the time to avoid the IE error 1237 // See https://bugs.jquery.com/ticket/13378 1238 rbuggyQSA = []; 1239 1240 if ( (support.qsa = rnative.test( document.querySelectorAll )) ) { 1241 // Build QSA regex 1242 // Regex strategy adopted from Diego Perini 1243 assert(function( el ) { 1244 // Select is set to empty string on purpose 1245 // This is to test IE's treatment of not explicitly 1246 // setting a boolean content attribute, 1247 // since its presence should be enough 1248 // https://bugs.jquery.com/ticket/12359 1249 docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" + 1250 "<select id='" + expando + "-\r\\' msallowcapture=''>" + 1251 "<option selected=''></option></select>"; 1252 1253 // Support: IE8, Opera 11-12.16 1254 // Nothing should be selected when empty strings follow ^= or $= or *= 1255 // The test attribute must be unknown in Opera but "safe" for WinRT 1256 // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section 1257 if ( el.querySelectorAll("[msallowcapture^='']").length ) { 1258 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); 1259 } 1260 1261 // Support: IE8 1262 // Boolean attributes and "value" are not treated correctly 1263 if ( !el.querySelectorAll("[selected]").length ) { 1264 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); 1265 } 1266 1267 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ 1268 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { 1269 rbuggyQSA.push("~="); 1270 } 1271 1272 // Webkit/Opera - :checked should return selected option elements 1273 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 1274 // IE8 throws error here and will not see later tests 1275 if ( !el.querySelectorAll(":checked").length ) { 1276 rbuggyQSA.push(":checked"); 1277 } 1278 1279 // Support: Safari 8+, iOS 8+ 1280 // https://bugs.webkit.org/show_bug.cgi?id=136851 1281 // In-page `selector#id sibling-combinator selector` fails 1282 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { 1283 rbuggyQSA.push(".#.+[+~]"); 1284 } 1285 }); 1286 1287 assert(function( el ) { 1288 el.innerHTML = "<a href='' disabled='disabled'></a>" + 1289 "<select disabled='disabled'><option/></select>"; 1290 1291 // Support: Windows 8 Native Apps 1292 // The type and name attributes are restricted during .innerHTML assignment 1293 var input = document.createElement("input"); 1294 input.setAttribute( "type", "hidden" ); 1295 el.appendChild( input ).setAttribute( "name", "D" ); 1296 1297 // Support: IE8 1298 // Enforce case-sensitivity of name attribute 1299 if ( el.querySelectorAll("[name=d]").length ) { 1300 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); 1301 } 1302 1303 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) 1304 // IE8 throws error here and will not see later tests 1305 if ( el.querySelectorAll(":enabled").length !== 2 ) { 1306 rbuggyQSA.push( ":enabled", ":disabled" ); 1307 } 1308 1309 // Support: IE9-11+ 1310 // IE's :disabled selector does not pick up the children of disabled fieldsets 1311 docElem.appendChild( el ).disabled = true; 1312 if ( el.querySelectorAll(":disabled").length !== 2 ) { 1313 rbuggyQSA.push( ":enabled", ":disabled" ); 1314 } 1315 1316 // Opera 10-11 does not throw on post-comma invalid pseudos 1317 el.querySelectorAll("*,:x"); 1318 rbuggyQSA.push(",.*:"); 1319 }); 1320 } 1321 1322 if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || 1323 docElem.webkitMatchesSelector || 1324 docElem.mozMatchesSelector || 1325 docElem.oMatchesSelector || 1326 docElem.msMatchesSelector) )) ) { 1327 1328 assert(function( el ) { 1329 // Check to see if it's possible to do matchesSelector 1330 // on a disconnected node (IE 9) 1331 support.disconnectedMatch = matches.call( el, "*" ); 1332 1333 // This should fail with an exception 1334 // Gecko does not error, returns false instead 1335 matches.call( el, "[s!='']:x" ); 1336 rbuggyMatches.push( "!=", pseudos ); 1337 }); 1338 } 1339 1340 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); 1341 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); 1342 1343 /* Contains 1344 ---------------------------------------------------------------------- */ 1345 hasCompare = rnative.test( docElem.compareDocumentPosition ); 1346 1347 // Element contains another 1348 // Purposefully self-exclusive 1349 // As in, an element does not contain itself 1350 contains = hasCompare || rnative.test( docElem.contains ) ? 1351 function( a, b ) { 1352 var adown = a.nodeType === 9 ? a.documentElement : a, 1353 bup = b && b.parentNode; 1354 return a === bup || !!( bup && bup.nodeType === 1 && ( 1355 adown.contains ? 1356 adown.contains( bup ) : 1357 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 1358 )); 1359 } : 1360 function( a, b ) { 1361 if ( b ) { 1362 while ( (b = b.parentNode) ) { 1363 if ( b === a ) { 1364 return true; 1365 } 1366 } 1367 } 1368 return false; 1369 }; 1370 1371 /* Sorting 1372 ---------------------------------------------------------------------- */ 1373 1374 // Document order sorting 1375 sortOrder = hasCompare ? 1376 function( a, b ) { 1377 1378 // Flag for duplicate removal 1379 if ( a === b ) { 1380 hasDuplicate = true; 1381 return 0; 1382 } 1383 1384 // Sort on method existence if only one input has compareDocumentPosition 1385 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 1386 if ( compare ) { 1387 return compare; 1388 } 1389 1390 // Calculate position if both inputs belong to the same document 1391 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? 1392 a.compareDocumentPosition( b ) : 1393 1394 // Otherwise we know they are disconnected 1395 1; 1396 1397 // Disconnected nodes 1398 if ( compare & 1 || 1399 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { 1400 1401 // Choose the first element that is related to our preferred document 1402 if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { 1403 return -1; 1404 } 1405 if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { 1406 return 1; 1407 } 1408 1409 // Maintain original order 1410 return sortInput ? 1411 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 1412 0; 1413 } 1414 1415 return compare & 4 ? -1 : 1; 1416 } : 1417 function( a, b ) { 1418 // Exit early if the nodes are identical 1419 if ( a === b ) { 1420 hasDuplicate = true; 1421 return 0; 1422 } 1423 1424 var cur, 1425 i = 0, 1426 aup = a.parentNode, 1427 bup = b.parentNode, 1428 ap = [ a ], 1429 bp = [ b ]; 1430 1431 // Parentless nodes are either documents or disconnected 1432 if ( !aup || !bup ) { 1433 return a === document ? -1 : 1434 b === document ? 1 : 1435 aup ? -1 : 1436 bup ? 1 : 1437 sortInput ? 1438 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 1439 0; 1440 1441 // If the nodes are siblings, we can do a quick check 1442 } else if ( aup === bup ) { 1443 return siblingCheck( a, b ); 1444 } 1445 1446 // Otherwise we need full lists of their ancestors for comparison 1447 cur = a; 1448 while ( (cur = cur.parentNode) ) { 1449 ap.unshift( cur ); 1450 } 1451 cur = b; 1452 while ( (cur = cur.parentNode) ) { 1453 bp.unshift( cur ); 1454 } 1455 1456 // Walk down the tree looking for a discrepancy 1457 while ( ap[i] === bp[i] ) { 1458 i++; 1459 } 1460 1461 return i ? 1462 // Do a sibling check if the nodes have a common ancestor 1463 siblingCheck( ap[i], bp[i] ) : 1464 1465 // Otherwise nodes in our document sort first 1466 ap[i] === preferredDoc ? -1 : 1467 bp[i] === preferredDoc ? 1 : 1468 0; 1469 }; 1470 1471 return document; 1472}; 1473 1474Sizzle.matches = function( expr, elements ) { 1475 return Sizzle( expr, null, null, elements ); 1476}; 1477 1478Sizzle.matchesSelector = function( elem, expr ) { 1479 // Set document vars if needed 1480 if ( ( elem.ownerDocument || elem ) !== document ) { 1481 setDocument( elem ); 1482 } 1483 1484 // Make sure that attribute selectors are quoted 1485 expr = expr.replace( rattributeQuotes, "='$1']" ); 1486 1487 if ( support.matchesSelector && documentIsHTML && 1488 !compilerCache[ expr + " " ] && 1489 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && 1490 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { 1491 1492 try { 1493 var ret = matches.call( elem, expr ); 1494 1495 // IE 9's matchesSelector returns false on disconnected nodes 1496 if ( ret || support.disconnectedMatch || 1497 // As well, disconnected nodes are said to be in a document 1498 // fragment in IE 9 1499 elem.document && elem.document.nodeType !== 11 ) { 1500 return ret; 1501 } 1502 } catch (e) {} 1503 } 1504 1505 return Sizzle( expr, document, null, [ elem ] ).length > 0; 1506}; 1507 1508Sizzle.contains = function( context, elem ) { 1509 // Set document vars if needed 1510 if ( ( context.ownerDocument || context ) !== document ) { 1511 setDocument( context ); 1512 } 1513 return contains( context, elem ); 1514}; 1515 1516Sizzle.attr = function( elem, name ) { 1517 // Set document vars if needed 1518 if ( ( elem.ownerDocument || elem ) !== document ) { 1519 setDocument( elem ); 1520 } 1521 1522 var fn = Expr.attrHandle[ name.toLowerCase() ], 1523 // Don't get fooled by Object.prototype properties (jQuery #13807) 1524 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? 1525 fn( elem, name, !documentIsHTML ) : 1526 undefined; 1527 1528 return val !== undefined ? 1529 val : 1530 support.attributes || !documentIsHTML ? 1531 elem.getAttribute( name ) : 1532 (val = elem.getAttributeNode(name)) && val.specified ? 1533 val.value : 1534 null; 1535}; 1536 1537Sizzle.escape = function( sel ) { 1538 return (sel + "").replace( rcssescape, fcssescape ); 1539}; 1540 1541Sizzle.error = function( msg ) { 1542 throw new Error( "Syntax error, unrecognized expression: " + msg ); 1543}; 1544 1545/** 1546 * Document sorting and removing duplicates 1547 * @param {ArrayLike} results 1548 */ 1549Sizzle.uniqueSort = function( results ) { 1550 var elem, 1551 duplicates = [], 1552 j = 0, 1553 i = 0; 1554 1555 // Unless we *know* we can detect duplicates, assume their presence 1556 hasDuplicate = !support.detectDuplicates; 1557 sortInput = !support.sortStable && results.slice( 0 ); 1558 results.sort( sortOrder ); 1559 1560 if ( hasDuplicate ) { 1561 while ( (elem = results[i++]) ) { 1562 if ( elem === results[ i ] ) { 1563 j = duplicates.push( i ); 1564 } 1565 } 1566 while ( j-- ) { 1567 results.splice( duplicates[ j ], 1 ); 1568 } 1569 } 1570 1571 // Clear input after sorting to release objects 1572 // See https://github.com/jquery/sizzle/pull/225 1573 sortInput = null; 1574 1575 return results; 1576}; 1577 1578/** 1579 * Utility function for retrieving the text value of an array of DOM nodes 1580 * @param {Array|Element} elem 1581 */ 1582getText = Sizzle.getText = function( elem ) { 1583 var node, 1584 ret = "", 1585 i = 0, 1586 nodeType = elem.nodeType; 1587 1588 if ( !nodeType ) { 1589 // If no nodeType, this is expected to be an array 1590 while ( (node = elem[i++]) ) {
vendor: 11,976 bytes, lines 1591-1989
1591 // Do not traverse comment nodes 1592 ret += getText( node ); 1593 } 1594 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { 1595 // Use textContent for elements 1596 // innerText usage removed for consistency of new lines (jQuery #11153) 1597 if ( typeof elem.textContent === "string" ) { 1598 return elem.textContent; 1599 } else { 1600 // Traverse its children 1601 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 1602 ret += getText( elem ); 1603 } 1604 } 1605 } else if ( nodeType === 3 || nodeType === 4 ) { 1606 return elem.nodeValue; 1607 } 1608 // Do not include comment or processing instruction nodes 1609 1610 return ret; 1611}; 1612 1613Expr = Sizzle.selectors = { 1614 1615 // Can be adjusted by the user 1616 cacheLength: 50, 1617 1618 createPseudo: markFunction, 1619 1620 match: matchExpr, 1621 1622 attrHandle: {}, 1623 1624 find: {}, 1625 1626 relative: { 1627 ">": { dir: "parentNode", first: true }, 1628 " ": { dir: "parentNode" }, 1629 "+": { dir: "previousSibling", first: true }, 1630 "~": { dir: "previousSibling" } 1631 }, 1632 1633 preFilter: { 1634 "ATTR": function( match ) { 1635 match[1] = match[1].replace( runescape, funescape ); 1636 1637 // Move the given value to match[3] whether quoted or unquoted 1638 match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); 1639 1640 if ( match[2] === "~=" ) { 1641 match[3] = " " + match[3] + " "; 1642 } 1643 1644 return match.slice( 0, 4 ); 1645 }, 1646 1647 "CHILD": function( match ) { 1648 /* matches from matchExpr["CHILD"] 1649 1 type (only|nth|...) 1650 2 what (child|of-type) 1651 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 1652 4 xn-component of xn+y argument ([+-]?\d*n|) 1653 5 sign of xn-component 1654 6 x of xn-component 1655 7 sign of y-component 1656 8 y of y-component 1657 */ 1658 match[1] = match[1].toLowerCase(); 1659 1660 if ( match[1].slice( 0, 3 ) === "nth" ) { 1661 // nth-* requires argument 1662 if ( !match[3] ) { 1663 Sizzle.error( match[0] ); 1664 } 1665 1666 // numeric x and y parameters for Expr.filter.CHILD 1667 // remember that false/true cast respectively to 0/1 1668 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); 1669 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); 1670 1671 // other types prohibit arguments 1672 } else if ( match[3] ) { 1673 Sizzle.error( match[0] ); 1674 } 1675 1676 return match; 1677 }, 1678 1679 "PSEUDO": function( match ) { 1680 var excess, 1681 unquoted = !match[6] && match[2]; 1682 1683 if ( matchExpr["CHILD"].test( match[0] ) ) { 1684 return null; 1685 } 1686 1687 // Accept quoted arguments as-is 1688 if ( match[3] ) { 1689 match[2] = match[4] || match[5] || ""; 1690 1691 // Strip excess characters from unquoted arguments 1692 } else if ( unquoted && rpseudo.test( unquoted ) && 1693 // Get excess from tokenize (recursively) 1694 (excess = tokenize( unquoted, true )) && 1695 // advance to the next closing parenthesis 1696 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { 1697 1698 // excess is a negative index 1699 match[0] = match[0].slice( 0, excess ); 1700 match[2] = unquoted.slice( 0, excess ); 1701 } 1702 1703 // Return only captures needed by the pseudo filter method (type and argument) 1704 return match.slice( 0, 3 ); 1705 } 1706 }, 1707 1708 filter: { 1709 1710 "TAG": function( nodeNameSelector ) { 1711 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); 1712 return nodeNameSelector === "*" ? 1713 function() { return true; } : 1714 function( elem ) { 1715 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; 1716 }; 1717 }, 1718 1719 "CLASS": function( className ) { 1720 var pattern = classCache[ className + " " ]; 1721 1722 return pattern || 1723 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && 1724 classCache( className, function( elem ) { 1725 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); 1726 }); 1727 }, 1728 1729 "ATTR": function( name, operator, check ) { 1730 return function( elem ) { 1731 var result = Sizzle.attr( elem, name ); 1732 1733 if ( result == null ) { 1734 return operator === "!="; 1735 } 1736 if ( !operator ) { 1737 return true; 1738 } 1739 1740 result += ""; 1741 1742 return operator === "=" ? result === check : 1743 operator === "!=" ? result !== check : 1744 operator === "^=" ? check && result.indexOf( check ) === 0 : 1745 operator === "*=" ? check && result.indexOf( check ) > -1 : 1746 operator === "$=" ? check && result.slice( -check.length ) === check : 1747 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : 1748 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : 1749 false; 1750 }; 1751 }, 1752 1753 "CHILD": function( type, what, argument, first, last ) { 1754 var simple = type.slice( 0, 3 ) !== "nth", 1755 forward = type.slice( -4 ) !== "last", 1756 ofType = what === "of-type"; 1757 1758 return first === 1 && last === 0 ? 1759 1760 // Shortcut for :nth-*(n) 1761 function( elem ) { 1762 return !!elem.parentNode; 1763 } : 1764 1765 function( elem, context, xml ) { 1766 var cache, uniqueCache, outerCache, node, nodeIndex, start, 1767 dir = simple !== forward ? "nextSibling" : "previousSibling", 1768 parent = elem.parentNode, 1769 name = ofType && elem.nodeName.toLowerCase(), 1770 useCache = !xml && !ofType, 1771 diff = false; 1772 1773 if ( parent ) { 1774 1775 // :(first|last|only)-(child|of-type) 1776 if ( simple ) { 1777 while ( dir ) { 1778 node = elem; 1779 while ( (node = node[ dir ]) ) { 1780 if ( ofType ? 1781 node.nodeName.toLowerCase() === name : 1782 node.nodeType === 1 ) { 1783 1784 return false; 1785 } 1786 } 1787 // Reverse direction for :only-* (if we haven't yet done so) 1788 start = dir = type === "only" && !start && "nextSibling"; 1789 } 1790 return true; 1791 } 1792 1793 start = [ forward ? parent.firstChild : parent.lastChild ]; 1794 1795 // non-xml :nth-child(...) stores cache data on `parent` 1796 if ( forward && useCache ) { 1797 1798 // Seek `elem` from a previously-cached index 1799 1800 // ...in a gzip-friendly way 1801 node = parent; 1802 outerCache = node[ expando ] || (node[ expando ] = {}); 1803 1804 // Support: IE <9 only 1805 // Defend against cloned attroperties (jQuery gh-1709) 1806 uniqueCache = outerCache[ node.uniqueID ] || 1807 (outerCache[ node.uniqueID ] = {}); 1808 1809 cache = uniqueCache[ type ] || []; 1810 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 1811 diff = nodeIndex && cache[ 2 ]; 1812 node = nodeIndex && parent.childNodes[ nodeIndex ]; 1813 1814 while ( (node = ++nodeIndex && node && node[ dir ] || 1815 1816 // Fallback to seeking `elem` from the start 1817 (diff = nodeIndex = 0) || start.pop()) ) { 1818 1819 // When found, cache indexes on `parent` and break 1820 if ( node.nodeType === 1 && ++diff && node === elem ) { 1821 uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; 1822 break; 1823 } 1824 } 1825 1826 } else { 1827 // Use previously-cached element index if available 1828 if ( useCache ) { 1829 // ...in a gzip-friendly way 1830 node = elem; 1831 outerCache = node[ expando ] || (node[ expando ] = {}); 1832 1833 // Support: IE <9 only 1834 // Defend against cloned attroperties (jQuery gh-1709) 1835 uniqueCache = outerCache[ node.uniqueID ] || 1836 (outerCache[ node.uniqueID ] = {}); 1837 1838 cache = uniqueCache[ type ] || []; 1839 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 1840 diff = nodeIndex; 1841 } 1842 1843 // xml :nth-child(...) 1844 // or :nth-last-child(...) or :nth(-last)?-of-type(...) 1845 if ( diff === false ) { 1846 // Use the same loop as above to seek `elem` from the start 1847 while ( (node = ++nodeIndex && node && node[ dir ] || 1848 (diff = nodeIndex = 0) || start.pop()) ) { 1849 1850 if ( ( ofType ? 1851 node.nodeName.toLowerCase() === name : 1852 node.nodeType === 1 ) && 1853 ++diff ) { 1854 1855 // Cache the index of each encountered element 1856 if ( useCache ) { 1857 outerCache = node[ expando ] || (node[ expando ] = {}); 1858 1859 // Support: IE <9 only 1860 // Defend against cloned attroperties (jQuery gh-1709) 1861 uniqueCache = outerCache[ node.uniqueID ] || 1862 (outerCache[ node.uniqueID ] = {}); 1863 1864 uniqueCache[ type ] = [ dirruns, diff ]; 1865 } 1866 1867 if ( node === elem ) { 1868 break; 1869 } 1870 } 1871 } 1872 } 1873 } 1874 1875 // Incorporate the offset, then check against cycle size 1876 diff -= last; 1877 return diff === first || ( diff % first === 0 && diff / first >= 0 ); 1878 } 1879 }; 1880 }, 1881 1882 "PSEUDO": function( pseudo, argument ) { 1883 // pseudo-class names are case-insensitive 1884 // http://www.w3.org/TR/selectors/#pseudo-classes 1885 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 1886 // Remember that setFilters inherits from pseudos 1887 var args, 1888 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || 1889 Sizzle.error( "unsupported pseudo: " + pseudo ); 1890 1891 // The user may use createPseudo to indicate that 1892 // arguments are needed to create the filter function 1893 // just as Sizzle does 1894 if ( fn[ expando ] ) { 1895 return fn( argument ); 1896 } 1897 1898 // But maintain support for old signatures 1899 if ( fn.length > 1 ) { 1900 args = [ pseudo, pseudo, "", argument ]; 1901 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? 1902 markFunction(function( seed, matches ) { 1903 var idx, 1904 matched = fn( seed, argument ), 1905 i = matched.length; 1906 while ( i-- ) { 1907 idx = indexOf( seed, matched[i] ); 1908 seed[ idx ] = !( matches[ idx ] = matched[i] ); 1909 } 1910 }) : 1911 function( elem ) { 1912 return fn( elem, 0, args ); 1913 }; 1914 } 1915 1916 return fn; 1917 } 1918 }, 1919 1920 pseudos: { 1921 // Potentially complex pseudos 1922 "not": markFunction(function( selector ) { 1923 // Trim the selector passed to compile 1924 // to avoid treating leading and trailing 1925 // spaces as combinators 1926 var input = [], 1927 results = [], 1928 matcher = compile( selector.replace( rtrim, "$1" ) ); 1929 1930 return matcher[ expando ] ? 1931 markFunction(function( seed, matches, context, xml ) { 1932 var elem, 1933 unmatched = matcher( seed, null, xml, [] ), 1934 i = seed.length; 1935 1936 // Match elements unmatched by `matcher` 1937 while ( i-- ) { 1938 if ( (elem = unmatched[i]) ) { 1939 seed[i] = !(matches[i] = elem); 1940 } 1941 } 1942 }) : 1943 function( elem, context, xml ) { 1944 input[0] = elem; 1945 matcher( input, null, xml, results ); 1946 // Don't keep the element (issue #299) 1947 input[0] = null; 1948 return !results.pop(); 1949 }; 1950 }), 1951 1952 "has": markFunction(function( selector ) { 1953 return function( elem ) { 1954 return Sizzle( selector, elem ).length > 0; 1955 }; 1956 }), 1957 1958 "contains": markFunction(function( text ) { 1959 text = text.replace( runescape, funescape ); 1960 return function( elem ) { 1961 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; 1962 }; 1963 }), 1964 1965 // "Whether an element is represented by a :lang() selector 1966 // is based solely on the element's language value 1967 // being equal to the identifier C, 1968 // or beginning with the identifier C immediately followed by "-". 1969 // The matching of C against the element's language value is performed case-insensitively. 1970 // The identifier C does not have to be a valid language name." 1971 // http://www.w3.org/TR/selectors/#lang-pseudo 1972 "lang": markFunction( function( lang ) { 1973 // lang value must be a valid identifier 1974 if ( !ridentifier.test(lang || "") ) { 1975 Sizzle.error( "unsupported lang: " + lang ); 1976 } 1977 lang = lang.replace( runescape, funescape ).toLowerCase(); 1978 return function( elem ) { 1979 var elemLang; 1980 do { 1981 if ( (elemLang = documentIsHTML ? 1982 elem.lang : 1983 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { 1984 1985 elemLang = elemLang.toLowerCase(); 1986 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; 1987 } 1988 } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); 1989 return false;
vendor: 23,967 bytes, lines 1990-2861
1990 }; 1991 }), 1992 1993 // Miscellaneous 1994 "target": function( elem ) { 1995 var hash = window.location && window.location.hash; 1996 return hash && hash.slice( 1 ) === elem.id; 1997 }, 1998 1999 "root": function( elem ) { 2000 return elem === docElem; 2001 }, 2002 2003 "focus": function( elem ) { 2004 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); 2005 }, 2006 2007 // Boolean properties 2008 "enabled": createDisabledPseudo( false ), 2009 "disabled": createDisabledPseudo( true ), 2010 2011 "checked": function( elem ) { 2012 // In CSS3, :checked should return both checked and selected elements 2013 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 2014 var nodeName = elem.nodeName.toLowerCase(); 2015 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); 2016 }, 2017 2018 "selected": function( elem ) { 2019 // Accessing this property makes selected-by-default 2020 // options in Safari work properly 2021 if ( elem.parentNode ) { 2022 elem.parentNode.selectedIndex; 2023 } 2024 2025 return elem.selected === true; 2026 }, 2027 2028 // Contents 2029 "empty": function( elem ) { 2030 // http://www.w3.org/TR/selectors/#empty-pseudo 2031 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), 2032 // but not by others (comment: 8; processing instruction: 7; etc.) 2033 // nodeType < 6 works because attributes (2) do not appear as children 2034 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 2035 if ( elem.nodeType < 6 ) { 2036 return false; 2037 } 2038 } 2039 return true; 2040 }, 2041 2042 "parent": function( elem ) { 2043 return !Expr.pseudos["empty"]( elem ); 2044 }, 2045 2046 // Element/input types 2047 "header": function( elem ) { 2048 return rheader.test( elem.nodeName ); 2049 }, 2050 2051 "input": function( elem ) { 2052 return rinputs.test( elem.nodeName ); 2053 }, 2054 2055 "button": function( elem ) { 2056 var name = elem.nodeName.toLowerCase(); 2057 return name === "input" && elem.type === "button" || name === "button"; 2058 }, 2059 2060 "text": function( elem ) { 2061 var attr; 2062 return elem.nodeName.toLowerCase() === "input" && 2063 elem.type === "text" && 2064 2065 // Support: IE<8 2066 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" 2067 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); 2068 }, 2069 2070 // Position-in-collection 2071 "first": createPositionalPseudo(function() { 2072 return [ 0 ]; 2073 }), 2074 2075 "last": createPositionalPseudo(function( matchIndexes, length ) { 2076 return [ length - 1 ]; 2077 }), 2078 2079 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { 2080 return [ argument < 0 ? argument + length : argument ]; 2081 }), 2082 2083 "even": createPositionalPseudo(function( matchIndexes, length ) { 2084 var i = 0; 2085 for ( ; i < length; i += 2 ) { 2086 matchIndexes.push( i ); 2087 } 2088 return matchIndexes; 2089 }), 2090 2091 "odd": createPositionalPseudo(function( matchIndexes, length ) { 2092 var i = 1; 2093 for ( ; i < length; i += 2 ) { 2094 matchIndexes.push( i ); 2095 } 2096 return matchIndexes; 2097 }), 2098 2099 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { 2100 var i = argument < 0 ? argument + length : argument; 2101 for ( ; --i >= 0; ) { 2102 matchIndexes.push( i ); 2103 } 2104 return matchIndexes; 2105 }), 2106 2107 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { 2108 var i = argument < 0 ? argument + length : argument; 2109 for ( ; ++i < length; ) { 2110 matchIndexes.push( i ); 2111 } 2112 return matchIndexes; 2113 }) 2114 } 2115}; 2116 2117Expr.pseudos["nth"] = Expr.pseudos["eq"]; 2118 2119// Add button/input type pseudos 2120for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { 2121 Expr.pseudos[ i ] = createInputPseudo( i ); 2122} 2123for ( i in { submit: true, reset: true } ) { 2124 Expr.pseudos[ i ] = createButtonPseudo( i ); 2125} 2126 2127// Easy API for creating new setFilters 2128function setFilters() {} 2129setFilters.prototype = Expr.filters = Expr.pseudos; 2130Expr.setFilters = new setFilters(); 2131 2132tokenize = Sizzle.tokenize = function( selector, parseOnly ) { 2133 var matched, match, tokens, type, 2134 soFar, groups, preFilters, 2135 cached = tokenCache[ selector + " " ]; 2136 2137 if ( cached ) { 2138 return parseOnly ? 0 : cached.slice( 0 ); 2139 } 2140 2141 soFar = selector; 2142 groups = []; 2143 preFilters = Expr.preFilter; 2144 2145 while ( soFar ) { 2146 2147 // Comma and first run 2148 if ( !matched || (match = rcomma.exec( soFar )) ) { 2149 if ( match ) { 2150 // Don't consume trailing commas as valid 2151 soFar = soFar.slice( match[0].length ) || soFar; 2152 } 2153 groups.push( (tokens = []) ); 2154 } 2155 2156 matched = false; 2157 2158 // Combinators 2159 if ( (match = rcombinators.exec( soFar )) ) { 2160 matched = match.shift(); 2161 tokens.push({ 2162 value: matched, 2163 // Cast descendant combinators to space 2164 type: match[0].replace( rtrim, " " ) 2165 }); 2166 soFar = soFar.slice( matched.length ); 2167 } 2168 2169 // Filters 2170 for ( type in Expr.filter ) { 2171 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || 2172 (match = preFilters[ type ]( match ))) ) { 2173 matched = match.shift(); 2174 tokens.push({ 2175 value: matched, 2176 type: type, 2177 matches: match 2178 }); 2179 soFar = soFar.slice( matched.length ); 2180 } 2181 } 2182 2183 if ( !matched ) { 2184 break; 2185 } 2186 } 2187 2188 // Return the length of the invalid excess 2189 // if we're just parsing 2190 // Otherwise, throw an error or return tokens 2191 return parseOnly ? 2192 soFar.length : 2193 soFar ? 2194 Sizzle.error( selector ) : 2195 // Cache the tokens 2196 tokenCache( selector, groups ).slice( 0 ); 2197}; 2198 2199function toSelector( tokens ) { 2200 var i = 0, 2201 len = tokens.length, 2202 selector = ""; 2203 for ( ; i < len; i++ ) { 2204 selector += tokens[i].value; 2205 } 2206 return selector; 2207} 2208 2209function addCombinator( matcher, combinator, base ) { 2210 var dir = combinator.dir, 2211 skip = combinator.next, 2212 key = skip || dir, 2213 checkNonElements = base && key === "parentNode", 2214 doneName = done++; 2215 2216 return combinator.first ? 2217 // Check against closest ancestor/preceding element 2218 function( elem, context, xml ) { 2219 while ( (elem = elem[ dir ]) ) { 2220 if ( elem.nodeType === 1 || checkNonElements ) { 2221 return matcher( elem, context, xml ); 2222 } 2223 } 2224 return false; 2225 } : 2226 2227 // Check against all ancestor/preceding elements 2228 function( elem, context, xml ) { 2229 var oldCache, uniqueCache, outerCache, 2230 newCache = [ dirruns, doneName ]; 2231 2232 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching 2233 if ( xml ) { 2234 while ( (elem = elem[ dir ]) ) { 2235 if ( elem.nodeType === 1 || checkNonElements ) { 2236 if ( matcher( elem, context, xml ) ) { 2237 return true; 2238 } 2239 } 2240 } 2241 } else { 2242 while ( (elem = elem[ dir ]) ) { 2243 if ( elem.nodeType === 1 || checkNonElements ) { 2244 outerCache = elem[ expando ] || (elem[ expando ] = {}); 2245 2246 // Support: IE <9 only 2247 // Defend against cloned attroperties (jQuery gh-1709) 2248 uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); 2249 2250 if ( skip && skip === elem.nodeName.toLowerCase() ) { 2251 elem = elem[ dir ] || elem; 2252 } else if ( (oldCache = uniqueCache[ key ]) && 2253 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { 2254 2255 // Assign to newCache so results back-propagate to previous elements 2256 return (newCache[ 2 ] = oldCache[ 2 ]); 2257 } else { 2258 // Reuse newcache so results back-propagate to previous elements 2259 uniqueCache[ key ] = newCache; 2260 2261 // A match means we're done; a fail means we have to keep checking 2262 if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { 2263 return true; 2264 } 2265 } 2266 } 2267 } 2268 } 2269 return false; 2270 }; 2271} 2272 2273function elementMatcher( matchers ) { 2274 return matchers.length > 1 ? 2275 function( elem, context, xml ) { 2276 var i = matchers.length; 2277 while ( i-- ) { 2278 if ( !matchers[i]( elem, context, xml ) ) { 2279 return false; 2280 } 2281 } 2282 return true; 2283 } : 2284 matchers[0]; 2285} 2286 2287function multipleContexts( selector, contexts, results ) { 2288 var i = 0, 2289 len = contexts.length; 2290 for ( ; i < len; i++ ) { 2291 Sizzle( selector, contexts[i], results ); 2292 } 2293 return results; 2294} 2295 2296function condense( unmatched, map, filter, context, xml ) { 2297 var elem, 2298 newUnmatched = [], 2299 i = 0, 2300 len = unmatched.length, 2301 mapped = map != null; 2302 2303 for ( ; i < len; i++ ) { 2304 if ( (elem = unmatched[i]) ) { 2305 if ( !filter || filter( elem, context, xml ) ) { 2306 newUnmatched.push( elem ); 2307 if ( mapped ) { 2308 map.push( i ); 2309 } 2310 } 2311 } 2312 } 2313 2314 return newUnmatched; 2315} 2316 2317function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { 2318 if ( postFilter && !postFilter[ expando ] ) { 2319 postFilter = setMatcher( postFilter ); 2320 } 2321 if ( postFinder && !postFinder[ expando ] ) { 2322 postFinder = setMatcher( postFinder, postSelector ); 2323 } 2324 return markFunction(function( seed, results, context, xml ) { 2325 var temp, i, elem, 2326 preMap = [], 2327 postMap = [], 2328 preexisting = results.length, 2329 2330 // Get initial elements from seed or context 2331 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), 2332 2333 // Prefilter to get matcher input, preserving a map for seed-results synchronization 2334 matcherIn = preFilter && ( seed || !selector ) ? 2335 condense( elems, preMap, preFilter, context, xml ) : 2336 elems, 2337 2338 matcherOut = matcher ? 2339 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, 2340 postFinder || ( seed ? preFilter : preexisting || postFilter ) ? 2341 2342 // ...intermediate processing is necessary 2343 [] : 2344 2345 // ...otherwise use results directly 2346 results : 2347 matcherIn; 2348 2349 // Find primary matches 2350 if ( matcher ) { 2351 matcher( matcherIn, matcherOut, context, xml ); 2352 } 2353 2354 // Apply postFilter 2355 if ( postFilter ) { 2356 temp = condense( matcherOut, postMap ); 2357 postFilter( temp, [], context, xml ); 2358 2359 // Un-match failing elements by moving them back to matcherIn 2360 i = temp.length; 2361 while ( i-- ) { 2362 if ( (elem = temp[i]) ) { 2363 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); 2364 } 2365 } 2366 } 2367 2368 if ( seed ) { 2369 if ( postFinder || preFilter ) { 2370 if ( postFinder ) { 2371 // Get the final matcherOut by condensing this intermediate into postFinder contexts 2372 temp = []; 2373 i = matcherOut.length; 2374 while ( i-- ) { 2375 if ( (elem = matcherOut[i]) ) { 2376 // Restore matcherIn since elem is not yet a final match 2377 temp.push( (matcherIn[i] = elem) ); 2378 } 2379 } 2380 postFinder( null, (matcherOut = []), temp, xml ); 2381 } 2382 2383 // Move matched elements from seed to results to keep them synchronized 2384 i = matcherOut.length; 2385 while ( i-- ) { 2386 if ( (elem = matcherOut[i]) && 2387 (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { 2388 2389 seed[temp] = !(results[temp] = elem); 2390 } 2391 } 2392 } 2393 2394 // Add elements to results, through postFinder if defined 2395 } else { 2396 matcherOut = condense( 2397 matcherOut === results ? 2398 matcherOut.splice( preexisting, matcherOut.length ) : 2399 matcherOut 2400 ); 2401 if ( postFinder ) { 2402 postFinder( null, results, matcherOut, xml ); 2403 } else { 2404 push.apply( results, matcherOut ); 2405 } 2406 } 2407 }); 2408} 2409 2410function matcherFromTokens( tokens ) { 2411 var checkContext, matcher, j, 2412 len = tokens.length, 2413 leadingRelative = Expr.relative[ tokens[0].type ], 2414 implicitRelative = leadingRelative || Expr.relative[" "], 2415 i = leadingRelative ? 1 : 0, 2416 2417 // The foundational matcher ensures that elements are reachable from top-level context(s) 2418 matchContext = addCombinator( function( elem ) { 2419 return elem === checkContext; 2420 }, implicitRelative, true ), 2421 matchAnyContext = addCombinator( function( elem ) { 2422 return indexOf( checkContext, elem ) > -1; 2423 }, implicitRelative, true ), 2424 matchers = [ function( elem, context, xml ) { 2425 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( 2426 (checkContext = context).nodeType ? 2427 matchContext( elem, context, xml ) : 2428 matchAnyContext( elem, context, xml ) ); 2429 // Avoid hanging onto element (issue #299) 2430 checkContext = null; 2431 return ret; 2432 } ]; 2433 2434 for ( ; i < len; i++ ) { 2435 if ( (matcher = Expr.relative[ tokens[i].type ]) ) { 2436 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; 2437 } else { 2438 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); 2439 2440 // Return special upon seeing a positional matcher 2441 if ( matcher[ expando ] ) { 2442 // Find the next relative operator (if any) for proper handling 2443 j = ++i; 2444 for ( ; j < len; j++ ) { 2445 if ( Expr.relative[ tokens[j].type ] ) { 2446 break; 2447 } 2448 } 2449 return setMatcher( 2450 i > 1 && elementMatcher( matchers ), 2451 i > 1 && toSelector( 2452 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 2453 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) 2454 ).replace( rtrim, "$1" ), 2455 matcher, 2456 i < j && matcherFromTokens( tokens.slice( i, j ) ), 2457 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), 2458 j < len && toSelector( tokens ) 2459 ); 2460 } 2461 matchers.push( matcher ); 2462 } 2463 } 2464 2465 return elementMatcher( matchers ); 2466} 2467 2468function matcherFromGroupMatchers( elementMatchers, setMatchers ) { 2469 var bySet = setMatchers.length > 0, 2470 byElement = elementMatchers.length > 0, 2471 superMatcher = function( seed, context, xml, results, outermost ) { 2472 var elem, j, matcher, 2473 matchedCount = 0, 2474 i = "0", 2475 unmatched = seed && [], 2476 setMatched = [], 2477 contextBackup = outermostContext, 2478 // We must always have either seed elements or outermost context 2479 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), 2480 // Use integer dirruns iff this is the outermost matcher 2481 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), 2482 len = elems.length; 2483 2484 if ( outermost ) { 2485 outermostContext = context === document || context || outermost; 2486 } 2487 2488 // Add elements passing elementMatchers directly to results 2489 // Support: IE<9, Safari 2490 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id 2491 for ( ; i !== len && (elem = elems[i]) != null; i++ ) { 2492 if ( byElement && elem ) { 2493 j = 0; 2494 if ( !context && elem.ownerDocument !== document ) { 2495 setDocument( elem ); 2496 xml = !documentIsHTML; 2497 } 2498 while ( (matcher = elementMatchers[j++]) ) { 2499 if ( matcher( elem, context || document, xml) ) { 2500 results.push( elem ); 2501 break; 2502 } 2503 } 2504 if ( outermost ) { 2505 dirruns = dirrunsUnique; 2506 } 2507 } 2508 2509 // Track unmatched elements for set filters 2510 if ( bySet ) { 2511 // They will have gone through all possible matchers 2512 if ( (elem = !matcher && elem) ) { 2513 matchedCount--; 2514 } 2515 2516 // Lengthen the array for every element, matched or not 2517 if ( seed ) { 2518 unmatched.push( elem ); 2519 } 2520 } 2521 } 2522 2523 // `i` is now the count of elements visited above, and adding it to `matchedCount` 2524 // makes the latter nonnegative. 2525 matchedCount += i; 2526 2527 // Apply set filters to unmatched elements 2528 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` 2529 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have 2530 // no element matchers and no seed. 2531 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that 2532 // case, which will result in a "00" `matchedCount` that differs from `i` but is also 2533 // numerically zero. 2534 if ( bySet && i !== matchedCount ) { 2535 j = 0; 2536 while ( (matcher = setMatchers[j++]) ) { 2537 matcher( unmatched, setMatched, context, xml ); 2538 } 2539 2540 if ( seed ) { 2541 // Reintegrate element matches to eliminate the need for sorting 2542 if ( matchedCount > 0 ) { 2543 while ( i-- ) { 2544 if ( !(unmatched[i] || setMatched[i]) ) { 2545 setMatched[i] = pop.call( results ); 2546 } 2547 } 2548 } 2549 2550 // Discard index placeholder values to get only actual matches 2551 setMatched = condense( setMatched ); 2552 } 2553 2554 // Add matches to results 2555 push.apply( results, setMatched ); 2556 2557 // Seedless set matches succeeding multiple successful matchers stipulate sorting 2558 if ( outermost && !seed && setMatched.length > 0 && 2559 ( matchedCount + setMatchers.length ) > 1 ) { 2560 2561 Sizzle.uniqueSort( results ); 2562 } 2563 } 2564 2565 // Override manipulation of globals by nested matchers 2566 if ( outermost ) { 2567 dirruns = dirrunsUnique; 2568 outermostContext = contextBackup; 2569 } 2570 2571 return unmatched; 2572 }; 2573 2574 return bySet ? 2575 markFunction( superMatcher ) : 2576 superMatcher; 2577} 2578 2579compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { 2580 var i, 2581 setMatchers = [], 2582 elementMatchers = [], 2583 cached = compilerCache[ selector + " " ]; 2584 2585 if ( !cached ) { 2586 // Generate a function of recursive functions that can be used to check each element 2587 if ( !match ) { 2588 match = tokenize( selector ); 2589 } 2590 i = match.length; 2591 while ( i-- ) { 2592 cached = matcherFromTokens( match[i] ); 2593 if ( cached[ expando ] ) { 2594 setMatchers.push( cached ); 2595 } else { 2596 elementMatchers.push( cached ); 2597 } 2598 } 2599 2600 // Cache the compiled function 2601 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); 2602 2603 // Save selector and tokenization 2604 cached.selector = selector; 2605 } 2606 return cached; 2607}; 2608 2609/** 2610 * A low-level selection function that works with Sizzle's compiled 2611 * selector functions 2612 * @param {String|Function} selector A selector or a pre-compiled 2613 * selector function built with Sizzle.compile 2614 * @param {Element} context 2615 * @param {Array} [results] 2616 * @param {Array} [seed] A set of elements to match against 2617 */ 2618select = Sizzle.select = function( selector, context, results, seed ) { 2619 var i, tokens, token, type, find, 2620 compiled = typeof selector === "function" && selector, 2621 match = !seed && tokenize( (selector = compiled.selector || selector) ); 2622 2623 results = results || []; 2624 2625 // Try to minimize operations if there is only one selector in the list and no seed 2626 // (the latter of which guarantees us context) 2627 if ( match.length === 1 ) { 2628 2629 // Reduce context if the leading compound selector is an ID 2630 tokens = match[0] = match[0].slice( 0 ); 2631 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && 2632 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) { 2633 2634 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; 2635 if ( !context ) { 2636 return results; 2637 2638 // Precompiled matchers will still verify ancestry, so step up a level 2639 } else if ( compiled ) { 2640 context = context.parentNode; 2641 } 2642 2643 selector = selector.slice( tokens.shift().value.length ); 2644 } 2645 2646 // Fetch a seed set for right-to-left matching 2647 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; 2648 while ( i-- ) { 2649 token = tokens[i]; 2650 2651 // Abort if we hit a combinator 2652 if ( Expr.relative[ (type = token.type) ] ) { 2653 break; 2654 } 2655 if ( (find = Expr.find[ type ]) ) { 2656 // Search, expanding context for leading sibling combinators 2657 if ( (seed = find( 2658 token.matches[0].replace( runescape, funescape ), 2659 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context 2660 )) ) { 2661 2662 // If seed is empty or no tokens remain, we can return early 2663 tokens.splice( i, 1 ); 2664 selector = seed.length && toSelector( tokens ); 2665 if ( !selector ) { 2666 push.apply( results, seed ); 2667 return results; 2668 } 2669 2670 break; 2671 } 2672 } 2673 } 2674 } 2675 2676 // Compile and execute a filtering function if one is not provided 2677 // Provide `match` to avoid retokenization if we modified the selector above 2678 ( compiled || compile( selector, match ) )( 2679 seed, 2680 context, 2681 !documentIsHTML, 2682 results, 2683 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context 2684 ); 2685 return results; 2686}; 2687 2688// One-time assignments 2689 2690// Sort stability 2691support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; 2692 2693// Support: Chrome 14-35+ 2694// Always assume duplicates if they aren't passed to the comparison function 2695support.detectDuplicates = !!hasDuplicate; 2696 2697// Initialize against the default document 2698setDocument(); 2699 2700// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) 2701// Detached nodes confoundingly follow *each other* 2702support.sortDetached = assert(function( el ) { 2703 // Should return 1, but returns 4 (following) 2704 return el.compareDocumentPosition( document.createElement("fieldset") ) & 1; 2705}); 2706 2707// Support: IE<8 2708// Prevent attribute/property "interpolation" 2709// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx 2710if ( !assert(function( el ) { 2711 el.innerHTML = "<a href='#'></a>"; 2712 return el.firstChild.getAttribute("href") === "#" ; 2713}) ) { 2714 addHandle( "type|href|height|width", function( elem, name, isXML ) { 2715 if ( !isXML ) { 2716 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); 2717 } 2718 }); 2719} 2720 2721// Support: IE<9 2722// Use defaultValue in place of getAttribute("value") 2723if ( !support.attributes || !assert(function( el ) { 2724 el.innerHTML = "<input/>"; 2725 el.firstChild.setAttribute( "value", "" ); 2726 return el.firstChild.getAttribute( "value" ) === ""; 2727}) ) { 2728 addHandle( "value", function( elem, name, isXML ) { 2729 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { 2730 return elem.defaultValue; 2731 } 2732 }); 2733} 2734 2735// Support: IE<9 2736// Use getAttributeNode to fetch booleans when getAttribute lies 2737if ( !assert(function( el ) { 2738 return el.getAttribute("disabled") == null; 2739}) ) { 2740 addHandle( booleans, function( elem, name, isXML ) { 2741 var val; 2742 if ( !isXML ) { 2743 return elem[ name ] === true ? name.toLowerCase() : 2744 (val = elem.getAttributeNode( name )) && val.specified ? 2745 val.value : 2746 null; 2747 } 2748 }); 2749} 2750 2751return Sizzle; 2752 2753})( window ); 2754 2755 2756 2757jQuery.find = Sizzle; 2758jQuery.expr = Sizzle.selectors; 2759 2760// Deprecated 2761jQuery.expr[ ":" ] = jQuery.expr.pseudos; 2762jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; 2763jQuery.text = Sizzle.getText; 2764jQuery.isXMLDoc = Sizzle.isXML; 2765jQuery.contains = Sizzle.contains; 2766jQuery.escapeSelector = Sizzle.escape; 2767 2768 2769 2770 2771var dir = function( elem, dir, until ) { 2772 var matched = [], 2773 truncate = until !== undefined; 2774 2775 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { 2776 if ( elem.nodeType === 1 ) { 2777 if ( truncate && jQuery( elem ).is( until ) ) { 2778 break; 2779 } 2780 matched.push( elem ); 2781 } 2782 } 2783 return matched; 2784}; 2785 2786 2787var siblings = function( n, elem ) { 2788 var matched = []; 2789 2790 for ( ; n; n = n.nextSibling ) { 2791 if ( n.nodeType === 1 && n !== elem ) { 2792 matched.push( n ); 2793 } 2794 } 2795 2796 return matched; 2797}; 2798 2799 2800var rneedsContext = jQuery.expr.match.needsContext; 2801 2802 2803 2804function nodeName( elem, name ) { 2805 2806 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 2807 2808}; 2809var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); 2810 2811 2812 2813// Implement the identical functionality for filter and not 2814function winnow( elements, qualifier, not ) { 2815 if ( isFunction( qualifier ) ) { 2816 return jQuery.grep( elements, function( elem, i ) { 2817 return !!qualifier.call( elem, i, elem ) !== not; 2818 } ); 2819 } 2820 2821 // Single element 2822 if ( qualifier.nodeType ) { 2823 return jQuery.grep( elements, function( elem ) { 2824 return ( elem === qualifier ) !== not; 2825 } ); 2826 } 2827 2828 // Arraylike of elements (jQuery, arguments, Array) 2829 if ( typeof qualifier !== "string" ) { 2830 return jQuery.grep( elements, function( elem ) { 2831 return ( indexOf.call( qualifier, elem ) > -1 ) !== not; 2832 } ); 2833 } 2834 2835 // Filtered directly for both simple and complex selectors 2836 return jQuery.filter( qualifier, elements, not ); 2837} 2838 2839jQuery.filter = function( expr, elems, not ) { 2840 var elem = elems[ 0 ]; 2841 2842 if ( not ) { 2843 expr = ":not(" + expr + ")"; 2844 } 2845 2846 if ( elems.length === 1 && elem.nodeType === 1 ) { 2847 return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; 2848 } 2849 2850 return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { 2851 return elem.nodeType === 1; 2852 } ) ); 2853}; 2854 2855jQuery.fn.extend( { 2856 find: function( selector ) { 2857 var i, ret, 2858 len = this.length, 2859 self = this; 2860 2861 if ( typeof selector !== "string" ) {
vendor: 4,662 bytes, lines 2862-3047
2862 return this.pushStack( jQuery( selector ).filter( function() { 2863 for ( i = 0; i < len; i++ ) { 2864 if ( jQuery.contains( self[ i ], this ) ) { 2865 return true; 2866 } 2867 } 2868 } ) ); 2869 } 2870 2871 ret = this.pushStack( [] ); 2872 2873 for ( i = 0; i < len; i++ ) { 2874 jQuery.find( selector, self[ i ], ret ); 2875 } 2876 2877 return len > 1 ? jQuery.uniqueSort( ret ) : ret; 2878 }, 2879 filter: function( selector ) { 2880 return this.pushStack( winnow( this, selector || [], false ) ); 2881 }, 2882 not: function( selector ) { 2883 return this.pushStack( winnow( this, selector || [], true ) ); 2884 }, 2885 is: function( selector ) { 2886 return !!winnow( 2887 this, 2888 2889 // If this is a positional/relative selector, check membership in the returned set 2890 // so $("p:first").is("p:last") won't return true for a doc with two "p". 2891 typeof selector === "string" && rneedsContext.test( selector ) ? 2892 jQuery( selector ) : 2893 selector || [], 2894 false 2895 ).length; 2896 } 2897} ); 2898 2899 2900// Initialize a jQuery object 2901 2902 2903// A central reference to the root jQuery(document) 2904var rootjQuery, 2905 2906 // A simple way to check for HTML strings 2907 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) 2908 // Strict HTML recognition (#11290: must start with <) 2909 // Shortcut simple #id case for speed 2910 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, 2911 2912 init = jQuery.fn.init = function( selector, context, root ) { 2913 var match, elem; 2914 2915 // HANDLE: $(""), $(null), $(undefined), $(false) 2916 if ( !selector ) { 2917 return this; 2918 } 2919 2920 // Method init() accepts an alternate rootjQuery 2921 // so migrate can support jQuery.sub (gh-2101) 2922 root = root || rootjQuery; 2923 2924 // Handle HTML strings 2925 if ( typeof selector === "string" ) { 2926 if ( selector[ 0 ] === "<" && 2927 selector[ selector.length - 1 ] === ">" && 2928 selector.length >= 3 ) { 2929 2930 // Assume that strings that start and end with <> are HTML and skip the regex check 2931 match = [ null, selector, null ]; 2932 2933 } else { 2934 match = rquickExpr.exec( selector ); 2935 } 2936 2937 // Match html or make sure no context is specified for #id 2938 if ( match && ( match[ 1 ] || !context ) ) { 2939 2940 // HANDLE: $(html) -> $(array) 2941 if ( match[ 1 ] ) { 2942 context = context instanceof jQuery ? context[ 0 ] : context; 2943 2944 // Option to run scripts is true for back-compat 2945 // Intentionally let the error be thrown if parseHTML is not present 2946 jQuery.merge( this, jQuery.parseHTML( 2947 match[ 1 ], 2948 context && context.nodeType ? context.ownerDocument || context : document, 2949 true 2950 ) ); 2951 2952 // HANDLE: $(html, props) 2953 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { 2954 for ( match in context ) { 2955 2956 // Properties of context are called as methods if possible 2957 if ( isFunction( this[ match ] ) ) { 2958 this[ match ]( context[ match ] ); 2959 2960 // ...and otherwise set as attributes 2961 } else { 2962 this.attr( match, context[ match ] ); 2963 } 2964 } 2965 } 2966 2967 return this; 2968 2969 // HANDLE: $(#id) 2970 } else { 2971 elem = document.getElementById( match[ 2 ] ); 2972 2973 if ( elem ) { 2974 2975 // Inject the element directly into the jQuery object 2976 this[ 0 ] = elem; 2977 this.length = 1; 2978 } 2979 return this; 2980 } 2981 2982 // HANDLE: $(expr, $(...)) 2983 } else if ( !context || context.jquery ) { 2984 return ( context || root ).find( selector ); 2985 2986 // HANDLE: $(expr, context) 2987 // (which is just equivalent to: $(context).find(expr) 2988 } else { 2989 return this.constructor( context ).find( selector ); 2990 } 2991 2992 // HANDLE: $(DOMElement) 2993 } else if ( selector.nodeType ) { 2994 this[ 0 ] = selector; 2995 this.length = 1; 2996 return this; 2997 2998 // HANDLE: $(function) 2999 // Shortcut for document ready 3000 } else if ( isFunction( selector ) ) { 3001 return root.ready !== undefined ? 3002 root.ready( selector ) : 3003 3004 // Execute immediately if ready is not present 3005 selector( jQuery ); 3006 } 3007 3008 return jQuery.makeArray( selector, this ); 3009 }; 3010 3011// Give the init function the jQuery prototype for later instantiation 3012init.prototype = jQuery.fn; 3013 3014// Initialize central reference 3015rootjQuery = jQuery( document ); 3016 3017 3018var rparentsprev = /^(?:parents|prev(?:Until|All))/, 3019 3020 // Methods guaranteed to produce a unique set when starting from a unique set 3021 guaranteedUnique = { 3022 children: true, 3023 contents: true, 3024 next: true, 3025 prev: true 3026 }; 3027 3028jQuery.fn.extend( { 3029 has: function( target ) { 3030 var targets = jQuery( target, this ), 3031 l = targets.length; 3032 3033 return this.filter( function() { 3034 var i = 0; 3035 for ( ; i < l; i++ ) { 3036 if ( jQuery.contains( this, targets[ i ] ) ) { 3037 return true; 3038 } 3039 } 3040 } ); 3041 }, 3042 3043 closest: function( selectors, context ) { 3044 var cur, 3045 i = 0, 3046 l = this.length, 3047 matched = [],
vendor: 6,003 bytes, lines 3048-3274
3048 targets = typeof selectors !== "string" && jQuery( selectors ); 3049 3050 // Positional selectors never match, since there's no _selection_ context 3051 if ( !rneedsContext.test( selectors ) ) { 3052 for ( ; i < l; i++ ) { 3053 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { 3054 3055 // Always skip document fragments 3056 if ( cur.nodeType < 11 && ( targets ? 3057 targets.index( cur ) > -1 : 3058 3059 // Don't pass non-elements to Sizzle 3060 cur.nodeType === 1 && 3061 jQuery.find.matchesSelector( cur, selectors ) ) ) { 3062 3063 matched.push( cur ); 3064 break; 3065 } 3066 } 3067 } 3068 } 3069 3070 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); 3071 }, 3072 3073 // Determine the position of an element within the set 3074 index: function( elem ) { 3075 3076 // No argument, return index in parent 3077 if ( !elem ) { 3078 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; 3079 } 3080 3081 // Index in selector 3082 if ( typeof elem === "string" ) { 3083 return indexOf.call( jQuery( elem ), this[ 0 ] ); 3084 } 3085 3086 // Locate the position of the desired element 3087 return indexOf.call( this, 3088 3089 // If it receives a jQuery object, the first element is used 3090 elem.jquery ? elem[ 0 ] : elem 3091 ); 3092 }, 3093 3094 add: function( selector, context ) { 3095 return this.pushStack( 3096 jQuery.uniqueSort( 3097 jQuery.merge( this.get(), jQuery( selector, context ) ) 3098 ) 3099 ); 3100 }, 3101 3102 addBack: function( selector ) { 3103 return this.add( selector == null ? 3104 this.prevObject : this.prevObject.filter( selector ) 3105 ); 3106 } 3107} ); 3108 3109function sibling( cur, dir ) { 3110 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} 3111 return cur; 3112} 3113 3114jQuery.each( { 3115 parent: function( elem ) { 3116 var parent = elem.parentNode; 3117 return parent && parent.nodeType !== 11 ? parent : null; 3118 }, 3119 parents: function( elem ) { 3120 return dir( elem, "parentNode" ); 3121 }, 3122 parentsUntil: function( elem, i, until ) { 3123 return dir( elem, "parentNode", until ); 3124 }, 3125 next: function( elem ) { 3126 return sibling( elem, "nextSibling" ); 3127 }, 3128 prev: function( elem ) { 3129 return sibling( elem, "previousSibling" ); 3130 }, 3131 nextAll: function( elem ) { 3132 return dir( elem, "nextSibling" ); 3133 }, 3134 prevAll: function( elem ) { 3135 return dir( elem, "previousSibling" ); 3136 }, 3137 nextUntil: function( elem, i, until ) { 3138 return dir( elem, "nextSibling", until ); 3139 }, 3140 prevUntil: function( elem, i, until ) { 3141 return dir( elem, "previousSibling", until ); 3142 }, 3143 siblings: function( elem ) { 3144 return siblings( ( elem.parentNode || {} ).firstChild, elem ); 3145 }, 3146 children: function( elem ) { 3147 return siblings( elem.firstChild ); 3148 }, 3149 contents: function( elem ) { 3150 if ( nodeName( elem, "iframe" ) ) { 3151 return elem.contentDocument; 3152 } 3153 3154 // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only 3155 // Treat the template element as a regular one in browsers that 3156 // don't support it. 3157 if ( nodeName( elem, "template" ) ) { 3158 elem = elem.content || elem; 3159 } 3160 3161 return jQuery.merge( [], elem.childNodes ); 3162 } 3163}, function( name, fn ) { 3164 jQuery.fn[ name ] = function( until, selector ) { 3165 var matched = jQuery.map( this, fn, until ); 3166 3167 if ( name.slice( -5 ) !== "Until" ) { 3168 selector = until; 3169 } 3170 3171 if ( selector && typeof selector === "string" ) { 3172 matched = jQuery.filter( selector, matched ); 3173 } 3174 3175 if ( this.length > 1 ) { 3176 3177 // Remove duplicates 3178 if ( !guaranteedUnique[ name ] ) { 3179 jQuery.uniqueSort( matched ); 3180 } 3181 3182 // Reverse order for parents* and prev-derivatives 3183 if ( rparentsprev.test( name ) ) { 3184 matched.reverse(); 3185 } 3186 } 3187 3188 return this.pushStack( matched ); 3189 }; 3190} ); 3191var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); 3192 3193 3194 3195// Convert String-formatted options into Object-formatted ones 3196function createOptions( options ) { 3197 var object = {}; 3198 jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { 3199 object[ flag ] = true; 3200 } ); 3201 return object; 3202} 3203 3204/* 3205 * Create a callback list using the following parameters: 3206 * 3207 * options: an optional list of space-separated options that will change how 3208 * the callback list behaves or a more traditional option object 3209 * 3210 * By default a callback list will act like an event callback list and can be 3211 * "fired" multiple times. 3212 * 3213 * Possible options: 3214 * 3215 * once: will ensure the callback list can only be fired once (like a Deferred) 3216 * 3217 * memory: will keep track of previous values and will call any callback added 3218 * after the list has been fired right away with the latest "memorized" 3219 * values (like a Deferred) 3220 * 3221 * unique: will ensure a callback can only be added once (no duplicate in the list) 3222 * 3223 * stopOnFalse: interrupt callings when a callback returns false 3224 * 3225 */ 3226jQuery.Callbacks = function( options ) { 3227 3228 // Convert options from String-formatted to Object-formatted if needed 3229 // (we check in cache first) 3230 options = typeof options === "string" ? 3231 createOptions( options ) : 3232 jQuery.extend( {}, options ); 3233 3234 var // Flag to know if list is currently firing 3235 firing, 3236 3237 // Last fire value for non-forgettable lists 3238 memory, 3239 3240 // Flag to know if list was already fired 3241 fired, 3242 3243 // Flag to prevent firing 3244 locked, 3245 3246 // Actual callback list 3247 list = [], 3248 3249 // Queue of execution data for repeatable lists 3250 queue = [], 3251 3252 // Index of currently firing callback (modified by add/remove as needed) 3253 firingIndex = -1, 3254 3255 // Fire callbacks 3256 fire = function() { 3257 3258 // Enforce single-firing 3259 locked = locked || options.once; 3260 3261 // Execute callbacks for all pending executions, 3262 // respecting firingIndex overrides and runtime changes 3263 fired = firing = true; 3264 for ( ; queue.length; firingIndex = -1 ) { 3265 memory = queue.shift(); 3266 while ( ++firingIndex < list.length ) { 3267 3268 // Run callback and check for early termination 3269 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && 3270 options.stopOnFalse ) { 3271 3272 // Jump to end and forget the data so .add doesn't re-fire 3273 firingIndex = list.length; 3274 memory = false;
vendor: 4,918 bytes, lines 3275-3484
3275 } 3276 } 3277 } 3278 3279 // Forget the data if we're done with it 3280 if ( !options.memory ) { 3281 memory = false; 3282 } 3283 3284 firing = false; 3285 3286 // Clean up if we're done firing for good 3287 if ( locked ) { 3288 3289 // Keep an empty list if we have data for future add calls 3290 if ( memory ) { 3291 list = []; 3292 3293 // Otherwise, this object is spent 3294 } else { 3295 list = ""; 3296 } 3297 } 3298 }, 3299 3300 // Actual Callbacks object 3301 self = { 3302 3303 // Add a callback or a collection of callbacks to the list 3304 add: function() { 3305 if ( list ) { 3306 3307 // If we have memory from a past run, we should fire after adding 3308 if ( memory && !firing ) { 3309 firingIndex = list.length - 1; 3310 queue.push( memory ); 3311 } 3312 3313 ( function add( args ) { 3314 jQuery.each( args, function( _, arg ) { 3315 if ( isFunction( arg ) ) { 3316 if ( !options.unique || !self.has( arg ) ) { 3317 list.push( arg ); 3318 } 3319 } else if ( arg && arg.length && toType( arg ) !== "string" ) { 3320 3321 // Inspect recursively 3322 add( arg ); 3323 } 3324 } ); 3325 } )( arguments ); 3326 3327 if ( memory && !firing ) { 3328 fire(); 3329 } 3330 } 3331 return this; 3332 }, 3333 3334 // Remove a callback from the list 3335 remove: function() { 3336 jQuery.each( arguments, function( _, arg ) { 3337 var index; 3338 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { 3339 list.splice( index, 1 ); 3340 3341 // Handle firing indexes 3342 if ( index <= firingIndex ) { 3343 firingIndex--; 3344 } 3345 } 3346 } ); 3347 return this; 3348 }, 3349 3350 // Check if a given callback is in the list. 3351 // If no argument is given, return whether or not list has callbacks attached. 3352 has: function( fn ) { 3353 return fn ? 3354 jQuery.inArray( fn, list ) > -1 : 3355 list.length > 0; 3356 }, 3357 3358 // Remove all callbacks from the list 3359 empty: function() { 3360 if ( list ) { 3361 list = []; 3362 } 3363 return this; 3364 }, 3365 3366 // Disable .fire and .add 3367 // Abort any current/pending executions 3368 // Clear all callbacks and values 3369 disable: function() { 3370 locked = queue = []; 3371 list = memory = ""; 3372 return this; 3373 }, 3374 disabled: function() { 3375 return !list; 3376 }, 3377 3378 // Disable .fire 3379 // Also disable .add unless we have memory (since it would have no effect) 3380 // Abort any pending executions 3381 lock: function() { 3382 locked = queue = []; 3383 if ( !memory && !firing ) { 3384 list = memory = ""; 3385 } 3386 return this; 3387 }, 3388 locked: function() { 3389 return !!locked; 3390 }, 3391 3392 // Call all callbacks with the given context and arguments 3393 fireWith: function( context, args ) { 3394 if ( !locked ) { 3395 args = args || []; 3396 args = [ context, args.slice ? args.slice() : args ]; 3397 queue.push( args ); 3398 if ( !firing ) { 3399 fire(); 3400 } 3401 } 3402 return this; 3403 }, 3404 3405 // Call all the callbacks with the given arguments 3406 fire: function() { 3407 self.fireWith( this, arguments ); 3408 return this; 3409 }, 3410 3411 // To know if the callbacks have already been called at least once 3412 fired: function() { 3413 return !!fired; 3414 } 3415 }; 3416 3417 return self; 3418}; 3419 3420 3421function Identity( v ) { 3422 return v; 3423} 3424function Thrower( ex ) { 3425 throw ex; 3426} 3427 3428function adoptValue( value, resolve, reject, noValue ) { 3429 var method; 3430 3431 try { 3432 3433 // Check for promise aspect first to privilege synchronous behavior 3434 if ( value && isFunction( ( method = value.promise ) ) ) { 3435 method.call( value ).done( resolve ).fail( reject ); 3436 3437 // Other thenables 3438 } else if ( value && isFunction( ( method = value.then ) ) ) { 3439 method.call( value, resolve, reject ); 3440 3441 // Other non-thenables 3442 } else { 3443 3444 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: 3445 // * false: [ value ].slice( 0 ) => resolve( value ) 3446 // * true: [ value ].slice( 1 ) => resolve() 3447 resolve.apply( undefined, [ value ].slice( noValue ) ); 3448 } 3449 3450 // For Promises/A+, convert exceptions into rejections 3451 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in 3452 // Deferred#then to conditionally suppress rejection. 3453 } catch ( value ) { 3454 3455 // Support: Android 4.0 only 3456 // Strict mode functions invoked without .call/.apply get global-object context 3457 reject.apply( undefined, [ value ] ); 3458 } 3459} 3460 3461jQuery.extend( { 3462 3463 Deferred: function( func ) { 3464 var tuples = [ 3465 3466 // action, add listener, callbacks, 3467 // ... .then handlers, argument index, [final state] 3468 [ "notify", "progress", jQuery.Callbacks( "memory" ), 3469 jQuery.Callbacks( "memory" ), 2 ], 3470 [ "resolve", "done", jQuery.Callbacks( "once memory" ), 3471 jQuery.Callbacks( "once memory" ), 0, "resolved" ], 3472 [ "reject", "fail", jQuery.Callbacks( "once memory" ), 3473 jQuery.Callbacks( "once memory" ), 1, "rejected" ] 3474 ], 3475 state = "pending", 3476 promise = { 3477 state: function() { 3478 return state; 3479 }, 3480 always: function() { 3481 deferred.done( arguments ).fail( arguments ); 3482 return this; 3483 }, 3484 "catch": function( fn ) {
vendor: 15,167 bytes, lines 3485-4076
3485 return promise.then( null, fn ); 3486 }, 3487 3488 // Keep pipe for back-compat 3489 pipe: function( /* fnDone, fnFail, fnProgress */ ) { 3490 var fns = arguments; 3491 3492 return jQuery.Deferred( function( newDefer ) { 3493 jQuery.each( tuples, function( i, tuple ) { 3494 3495 // Map tuples (progress, done, fail) to arguments (done, fail, progress) 3496 var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; 3497 3498 // deferred.progress(function() { bind to newDefer or newDefer.notify }) 3499 // deferred.done(function() { bind to newDefer or newDefer.resolve }) 3500 // deferred.fail(function() { bind to newDefer or newDefer.reject }) 3501 deferred[ tuple[ 1 ] ]( function() { 3502 var returned = fn && fn.apply( this, arguments ); 3503 if ( returned && isFunction( returned.promise ) ) { 3504 returned.promise() 3505 .progress( newDefer.notify ) 3506 .done( newDefer.resolve ) 3507 .fail( newDefer.reject ); 3508 } else { 3509 newDefer[ tuple[ 0 ] + "With" ]( 3510 this, 3511 fn ? [ returned ] : arguments 3512 ); 3513 } 3514 } ); 3515 } ); 3516 fns = null; 3517 } ).promise(); 3518 }, 3519 then: function( onFulfilled, onRejected, onProgress ) { 3520 var maxDepth = 0; 3521 function resolve( depth, deferred, handler, special ) { 3522 return function() { 3523 var that = this, 3524 args = arguments, 3525 mightThrow = function() { 3526 var returned, then; 3527 3528 // Support: Promises/A+ section 2.3.3.3.3 3529 // https://promisesaplus.com/#point-59 3530 // Ignore double-resolution attempts 3531 if ( depth < maxDepth ) { 3532 return; 3533 } 3534 3535 returned = handler.apply( that, args ); 3536 3537 // Support: Promises/A+ section 2.3.1 3538 // https://promisesaplus.com/#point-48 3539 if ( returned === deferred.promise() ) { 3540 throw new TypeError( "Thenable self-resolution" ); 3541 } 3542 3543 // Support: Promises/A+ sections 2.3.3.1, 3.5 3544 // https://promisesaplus.com/#point-54 3545 // https://promisesaplus.com/#point-75 3546 // Retrieve `then` only once 3547 then = returned && 3548 3549 // Support: Promises/A+ section 2.3.4 3550 // https://promisesaplus.com/#point-64 3551 // Only check objects and functions for thenability 3552 ( typeof returned === "object" || 3553 typeof returned === "function" ) && 3554 returned.then; 3555 3556 // Handle a returned thenable 3557 if ( isFunction( then ) ) { 3558 3559 // Special processors (notify) just wait for resolution 3560 if ( special ) { 3561 then.call( 3562 returned, 3563 resolve( maxDepth, deferred, Identity, special ), 3564 resolve( maxDepth, deferred, Thrower, special ) 3565 ); 3566 3567 // Normal processors (resolve) also hook into progress 3568 } else { 3569 3570 // ...and disregard older resolution values 3571 maxDepth++; 3572 3573 then.call( 3574 returned, 3575 resolve( maxDepth, deferred, Identity, special ), 3576 resolve( maxDepth, deferred, Thrower, special ), 3577 resolve( maxDepth, deferred, Identity, 3578 deferred.notifyWith ) 3579 ); 3580 } 3581 3582 // Handle all other returned values 3583 } else { 3584 3585 // Only substitute handlers pass on context 3586 // and multiple values (non-spec behavior) 3587 if ( handler !== Identity ) { 3588 that = undefined; 3589 args = [ returned ]; 3590 } 3591 3592 // Process the value(s) 3593 // Default process is resolve 3594 ( special || deferred.resolveWith )( that, args ); 3595 } 3596 }, 3597 3598 // Only normal processors (resolve) catch and reject exceptions 3599 process = special ? 3600 mightThrow : 3601 function() { 3602 try { 3603 mightThrow(); 3604 } catch ( e ) { 3605 3606 if ( jQuery.Deferred.exceptionHook ) { 3607 jQuery.Deferred.exceptionHook( e, 3608 process.stackTrace ); 3609 } 3610 3611 // Support: Promises/A+ section 2.3.3.3.4.1 3612 // https://promisesaplus.com/#point-61 3613 // Ignore post-resolution exceptions 3614 if ( depth + 1 >= maxDepth ) { 3615 3616 // Only substitute handlers pass on context 3617 // and multiple values (non-spec behavior) 3618 if ( handler !== Thrower ) { 3619 that = undefined; 3620 args = [ e ]; 3621 } 3622 3623 deferred.rejectWith( that, args ); 3624 } 3625 } 3626 }; 3627 3628 // Support: Promises/A+ section 2.3.3.3.1 3629 // https://promisesaplus.com/#point-57 3630 // Re-resolve promises immediately to dodge false rejection from 3631 // subsequent errors 3632 if ( depth ) { 3633 process(); 3634 } else { 3635 3636 // Call an optional hook to record the stack, in case of exception 3637 // since it's otherwise lost when execution goes async 3638 if ( jQuery.Deferred.getStackHook ) { 3639 process.stackTrace = jQuery.Deferred.getStackHook(); 3640 } 3641 window.setTimeout( process ); 3642 } 3643 }; 3644 } 3645 3646 return jQuery.Deferred( function( newDefer ) { 3647 3648 // progress_handlers.add( ... ) 3649 tuples[ 0 ][ 3 ].add( 3650 resolve( 3651 0, 3652 newDefer, 3653 isFunction( onProgress ) ? 3654 onProgress : 3655 Identity, 3656 newDefer.notifyWith 3657 ) 3658 ); 3659 3660 // fulfilled_handlers.add( ... ) 3661 tuples[ 1 ][ 3 ].add( 3662 resolve( 3663 0, 3664 newDefer, 3665 isFunction( onFulfilled ) ? 3666 onFulfilled : 3667 Identity 3668 ) 3669 ); 3670 3671 // rejected_handlers.add( ... ) 3672 tuples[ 2 ][ 3 ].add( 3673 resolve( 3674 0, 3675 newDefer, 3676 isFunction( onRejected ) ? 3677 onRejected : 3678 Thrower 3679 ) 3680 ); 3681 } ).promise(); 3682 }, 3683 3684 // Get a promise for this deferred 3685 // If obj is provided, the promise aspect is added to the object 3686 promise: function( obj ) { 3687 return obj != null ? jQuery.extend( obj, promise ) : promise; 3688 } 3689 }, 3690 deferred = {}; 3691 3692 // Add list-specific methods 3693 jQuery.each( tuples, function( i, tuple ) { 3694 var list = tuple[ 2 ], 3695 stateString = tuple[ 5 ]; 3696 3697 // promise.progress = list.add 3698 // promise.done = list.add 3699 // promise.fail = list.add 3700 promise[ tuple[ 1 ] ] = list.add; 3701 3702 // Handle state 3703 if ( stateString ) { 3704 list.add( 3705 function() { 3706 3707 // state = "resolved" (i.e., fulfilled) 3708 // state = "rejected" 3709 state = stateString; 3710 }, 3711 3712 // rejected_callbacks.disable 3713 // fulfilled_callbacks.disable 3714 tuples[ 3 - i ][ 2 ].disable, 3715 3716 // rejected_handlers.disable 3717 // fulfilled_handlers.disable 3718 tuples[ 3 - i ][ 3 ].disable, 3719 3720 // progress_callbacks.lock 3721 tuples[ 0 ][ 2 ].lock, 3722 3723 // progress_handlers.lock 3724 tuples[ 0 ][ 3 ].lock 3725 ); 3726 } 3727 3728 // progress_handlers.fire 3729 // fulfilled_handlers.fire 3730 // rejected_handlers.fire 3731 list.add( tuple[ 3 ].fire ); 3732 3733 // deferred.notify = function() { deferred.notifyWith(...) } 3734 // deferred.resolve = function() { deferred.resolveWith(...) } 3735 // deferred.reject = function() { deferred.rejectWith(...) } 3736 deferred[ tuple[ 0 ] ] = function() { 3737 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); 3738 return this; 3739 }; 3740 3741 // deferred.notifyWith = list.fireWith 3742 // deferred.resolveWith = list.fireWith 3743 // deferred.rejectWith = list.fireWith 3744 deferred[ tuple[ 0 ] + "With" ] = list.fireWith; 3745 } ); 3746 3747 // Make the deferred a promise 3748 promise.promise( deferred ); 3749 3750 // Call given func if any 3751 if ( func ) { 3752 func.call( deferred, deferred ); 3753 } 3754 3755 // All done! 3756 return deferred; 3757 }, 3758 3759 // Deferred helper 3760 when: function( singleValue ) { 3761 var 3762 3763 // count of uncompleted subordinates 3764 remaining = arguments.length, 3765 3766 // count of unprocessed arguments 3767 i = remaining, 3768 3769 // subordinate fulfillment data 3770 resolveContexts = Array( i ), 3771 resolveValues = slice.call( arguments ), 3772 3773 // the master Deferred 3774 master = jQuery.Deferred(), 3775 3776 // subordinate callback factory 3777 updateFunc = function( i ) { 3778 return function( value ) { 3779 resolveContexts[ i ] = this; 3780 resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; 3781 if ( !( --remaining ) ) { 3782 master.resolveWith( resolveContexts, resolveValues ); 3783 } 3784 }; 3785 }; 3786 3787 // Single- and empty arguments are adopted like Promise.resolve 3788 if ( remaining <= 1 ) { 3789 adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject, 3790 !remaining ); 3791 3792 // Use .then() to unwrap secondary thenables (cf. gh-3000) 3793 if ( master.state() === "pending" || 3794 isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { 3795 3796 return master.then(); 3797 } 3798 } 3799 3800 // Multiple arguments are aggregated like Promise.all array elements 3801 while ( i-- ) { 3802 adoptValue( resolveValues[ i ], updateFunc( i ), master.reject ); 3803 } 3804 3805 return master.promise(); 3806 } 3807} ); 3808 3809 3810// These usually indicate a programmer mistake during development, 3811// warn about them ASAP rather than swallowing them by default. 3812var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; 3813 3814jQuery.Deferred.exceptionHook = function( error, stack ) { 3815 3816 // Support: IE 8 - 9 only 3817 // Console exists when dev tools are open, which can happen at any time 3818 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { 3819 window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); 3820 } 3821}; 3822 3823 3824 3825 3826jQuery.readyException = function( error ) { 3827 window.setTimeout( function() { 3828 throw error; 3829 } ); 3830}; 3831 3832 3833 3834 3835// The deferred used on DOM ready 3836var readyList = jQuery.Deferred(); 3837 3838jQuery.fn.ready = function( fn ) { 3839 3840 readyList 3841 .then( fn ) 3842 3843 // Wrap jQuery.readyException in a function so that the lookup 3844 // happens at the time of error handling instead of callback 3845 // registration. 3846 .catch( function( error ) { 3847 jQuery.readyException( error ); 3848 } ); 3849 3850 return this; 3851}; 3852 3853jQuery.extend( { 3854 3855 // Is the DOM ready to be used? Set to true once it occurs. 3856 isReady: false, 3857 3858 // A counter to track how many items to wait for before 3859 // the ready event fires. See #6781 3860 readyWait: 1, 3861 3862 // Handle when the DOM is ready 3863 ready: function( wait ) { 3864 3865 // Abort if there are pending holds or we're already ready 3866 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { 3867 return; 3868 } 3869 3870 // Remember that the DOM is ready 3871 jQuery.isReady = true; 3872 3873 // If a normal DOM Ready event fired, decrement, and wait if need be 3874 if ( wait !== true && --jQuery.readyWait > 0 ) { 3875 return; 3876 } 3877 3878 // If there are functions bound, to execute 3879 readyList.resolveWith( document, [ jQuery ] ); 3880 } 3881} ); 3882 3883jQuery.ready.then = readyList.then; 3884 3885// The ready event handler and self cleanup method 3886function completed() { 3887 document.removeEventListener( "DOMContentLoaded", completed ); 3888 window.removeEventListener( "load", completed ); 3889 jQuery.ready(); 3890} 3891 3892// Catch cases where $(document).ready() is called 3893// after the browser event has already occurred. 3894// Support: IE <=9 - 10 only 3895// Older IE sometimes signals "interactive" too soon 3896if ( document.readyState === "complete" || 3897 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { 3898 3899 // Handle it asynchronously to allow scripts the opportunity to delay ready 3900 window.setTimeout( jQuery.ready ); 3901 3902} else { 3903 3904 // Use the handy event callback 3905 document.addEventListener( "DOMContentLoaded", completed ); 3906 3907 // A fallback to window.onload, that will always work 3908 window.addEventListener( "load", completed ); 3909} 3910 3911 3912 3913 3914// Multifunctional method to get and set values of a collection 3915// The value/s can optionally be executed if it's a function 3916var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { 3917 var i = 0, 3918 len = elems.length, 3919 bulk = key == null; 3920 3921 // Sets many values 3922 if ( toType( key ) === "object" ) { 3923 chainable = true; 3924 for ( i in key ) { 3925 access( elems, fn, i, key[ i ], true, emptyGet, raw ); 3926 } 3927 3928 // Sets one value 3929 } else if ( value !== undefined ) { 3930 chainable = true; 3931 3932 if ( !isFunction( value ) ) { 3933 raw = true; 3934 } 3935 3936 if ( bulk ) { 3937 3938 // Bulk operations run against the entire set 3939 if ( raw ) { 3940 fn.call( elems, value ); 3941 fn = null; 3942 3943 // ...except when executing function values 3944 } else { 3945 bulk = fn; 3946 fn = function( elem, key, value ) { 3947 return bulk.call( jQuery( elem ), value ); 3948 }; 3949 } 3950 } 3951 3952 if ( fn ) { 3953 for ( ; i < len; i++ ) { 3954 fn( 3955 elems[ i ], key, raw ? 3956 value : 3957 value.call( elems[ i ], i, fn( elems[ i ], key ) ) 3958 ); 3959 } 3960 } 3961 } 3962 3963 if ( chainable ) { 3964 return elems; 3965 } 3966 3967 // Gets 3968 if ( bulk ) { 3969 return fn.call( elems ); 3970 } 3971 3972 return len ? fn( elems[ 0 ], key ) : emptyGet; 3973}; 3974 3975 3976// Matches dashed string for camelizing 3977var rmsPrefix = /^-ms-/, 3978 rdashAlpha = /-([a-z])/g; 3979 3980// Used by camelCase as callback to replace() 3981function fcamelCase( all, letter ) { 3982 return letter.toUpperCase(); 3983} 3984 3985// Convert dashed to camelCase; used by the css and data modules 3986// Support: IE <=9 - 11, Edge 12 - 15 3987// Microsoft forgot to hump their vendor prefix (#9572) 3988function camelCase( string ) { 3989 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); 3990} 3991var acceptData = function( owner ) { 3992 3993 // Accepts only: 3994 // - Node 3995 // - Node.ELEMENT_NODE 3996 // - Node.DOCUMENT_NODE 3997 // - Object 3998 // - Any 3999 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); 4000}; 4001 4002 4003 4004 4005function Data() { 4006 this.expando = jQuery.expando + Data.uid++; 4007} 4008 4009Data.uid = 1; 4010 4011Data.prototype = { 4012 4013 cache: function( owner ) { 4014 4015 // Check if the owner object already has a cache 4016 var value = owner[ this.expando ]; 4017 4018 // If not, create one 4019 if ( !value ) { 4020 value = {}; 4021 4022 // We can accept data for non-element nodes in modern browsers, 4023 // but we should not, see #8335. 4024 // Always return an empty object. 4025 if ( acceptData( owner ) ) { 4026 4027 // If it is a node unlikely to be stringify-ed or looped over 4028 // use plain assignment 4029 if ( owner.nodeType ) { 4030 owner[ this.expando ] = value; 4031 4032 // Otherwise secure it in a non-enumerable property 4033 // configurable must be true to allow the property to be 4034 // deleted when data is removed 4035 } else { 4036 Object.defineProperty( owner, this.expando, { 4037 value: value, 4038 configurable: true 4039 } ); 4040 } 4041 } 4042 } 4043 4044 return value; 4045 }, 4046 set: function( owner, data, value ) { 4047 var prop, 4048 cache = this.cache( owner ); 4049 4050 // Handle: [ owner, key, value ] args 4051 // Always use camelCase key (gh-2257) 4052 if ( typeof data === "string" ) { 4053 cache[ camelCase( data ) ] = value; 4054 4055 // Handle: [ owner, { properties } ] args 4056 } else { 4057 4058 // Copy the properties one-by-one to the cache object 4059 for ( prop in data ) { 4060 cache[ camelCase( prop ) ] = data[ prop ]; 4061 } 4062 } 4063 return cache; 4064 }, 4065 get: function( owner, key ) { 4066 return key === undefined ? 4067 this.cache( owner ) : 4068 4069 // Always use camelCase key (gh-2257) 4070 owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; 4071 }, 4072 access: function( owner, key, value ) { 4073 4074 // In cases where either: 4075 // 4076 // 1. No key was specified
vendor: 8,694 bytes, lines 4077-4435
4077 // 2. A string key was specified, but no value provided 4078 // 4079 // Take the "read" path and allow the get method to determine 4080 // which value to return, respectively either: 4081 // 4082 // 1. The entire cache object 4083 // 2. The data stored at the key 4084 // 4085 if ( key === undefined || 4086 ( ( key && typeof key === "string" ) && value === undefined ) ) { 4087 4088 return this.get( owner, key ); 4089 } 4090 4091 // When the key is not a string, or both a key and value 4092 // are specified, set or extend (existing objects) with either: 4093 // 4094 // 1. An object of properties 4095 // 2. A key and value 4096 // 4097 this.set( owner, key, value ); 4098 4099 // Since the "set" path can have two possible entry points 4100 // return the expected data based on which path was taken[*] 4101 return value !== undefined ? value : key; 4102 }, 4103 remove: function( owner, key ) { 4104 var i, 4105 cache = owner[ this.expando ]; 4106 4107 if ( cache === undefined ) { 4108 return; 4109 } 4110 4111 if ( key !== undefined ) { 4112 4113 // Support array or space separated string of keys 4114 if ( Array.isArray( key ) ) { 4115 4116 // If key is an array of keys... 4117 // We always set camelCase keys, so remove that. 4118 key = key.map( camelCase ); 4119 } else { 4120 key = camelCase( key ); 4121 4122 // If a key with the spaces exists, use it. 4123 // Otherwise, create an array by matching non-whitespace 4124 key = key in cache ? 4125 [ key ] : 4126 ( key.match( rnothtmlwhite ) || [] ); 4127 } 4128 4129 i = key.length; 4130 4131 while ( i-- ) { 4132 delete cache[ key[ i ] ]; 4133 } 4134 } 4135 4136 // Remove the expando if there's no more data 4137 if ( key === undefined || jQuery.isEmptyObject( cache ) ) { 4138 4139 // Support: Chrome <=35 - 45 4140 // Webkit & Blink performance suffers when deleting properties 4141 // from DOM nodes, so set to undefined instead 4142 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) 4143 if ( owner.nodeType ) { 4144 owner[ this.expando ] = undefined; 4145 } else { 4146 delete owner[ this.expando ]; 4147 } 4148 } 4149 }, 4150 hasData: function( owner ) { 4151 var cache = owner[ this.expando ]; 4152 return cache !== undefined && !jQuery.isEmptyObject( cache ); 4153 } 4154}; 4155var dataPriv = new Data(); 4156 4157var dataUser = new Data(); 4158 4159 4160 4161// Implementation Summary 4162// 4163// 1. Enforce API surface and semantic compatibility with 1.9.x branch 4164// 2. Improve the module's maintainability by reducing the storage 4165// paths to a single mechanism. 4166// 3. Use the same single mechanism to support "private" and "user" data. 4167// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) 4168// 5. Avoid exposing implementation details on user objects (eg. expando properties) 4169// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 4170 4171var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, 4172 rmultiDash = /[A-Z]/g; 4173 4174function getData( data ) { 4175 if ( data === "true" ) { 4176 return true; 4177 } 4178 4179 if ( data === "false" ) { 4180 return false; 4181 } 4182 4183 if ( data === "null" ) { 4184 return null; 4185 } 4186 4187 // Only convert to a number if it doesn't change the string 4188 if ( data === +data + "" ) { 4189 return +data; 4190 } 4191 4192 if ( rbrace.test( data ) ) { 4193 return JSON.parse( data ); 4194 } 4195 4196 return data; 4197} 4198 4199function dataAttr( elem, key, data ) { 4200 var name; 4201 4202 // If nothing was found internally, try to fetch any 4203 // data from the HTML5 data-* attribute 4204 if ( data === undefined && elem.nodeType === 1 ) { 4205 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); 4206 data = elem.getAttribute( name ); 4207 4208 if ( typeof data === "string" ) { 4209 try { 4210 data = getData( data ); 4211 } catch ( e ) {} 4212 4213 // Make sure we set the data so it isn't changed later 4214 dataUser.set( elem, key, data ); 4215 } else { 4216 data = undefined; 4217 } 4218 } 4219 return data; 4220} 4221 4222jQuery.extend( { 4223 hasData: function( elem ) { 4224 return dataUser.hasData( elem ) || dataPriv.hasData( elem ); 4225 }, 4226 4227 data: function( elem, name, data ) { 4228 return dataUser.access( elem, name, data ); 4229 }, 4230 4231 removeData: function( elem, name ) { 4232 dataUser.remove( elem, name ); 4233 }, 4234 4235 // TODO: Now that all calls to _data and _removeData have been replaced 4236 // with direct calls to dataPriv methods, these can be deprecated. 4237 _data: function( elem, name, data ) { 4238 return dataPriv.access( elem, name, data ); 4239 }, 4240 4241 _removeData: function( elem, name ) { 4242 dataPriv.remove( elem, name ); 4243 } 4244} ); 4245 4246jQuery.fn.extend( { 4247 data: function( key, value ) { 4248 var i, name, data, 4249 elem = this[ 0 ], 4250 attrs = elem && elem.attributes; 4251 4252 // Gets all values 4253 if ( key === undefined ) { 4254 if ( this.length ) { 4255 data = dataUser.get( elem ); 4256 4257 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { 4258 i = attrs.length; 4259 while ( i-- ) { 4260 4261 // Support: IE 11 only 4262 // The attrs elements can be null (#14894) 4263 if ( attrs[ i ] ) { 4264 name = attrs[ i ].name; 4265 if ( name.indexOf( "data-" ) === 0 ) { 4266 name = camelCase( name.slice( 5 ) ); 4267 dataAttr( elem, name, data[ name ] ); 4268 } 4269 } 4270 } 4271 dataPriv.set( elem, "hasDataAttrs", true ); 4272 } 4273 } 4274 4275 return data; 4276 } 4277 4278 // Sets multiple values 4279 if ( typeof key === "object" ) { 4280 return this.each( function() { 4281 dataUser.set( this, key ); 4282 } ); 4283 } 4284 4285 return access( this, function( value ) { 4286 var data; 4287 4288 // The calling jQuery object (element matches) is not empty 4289 // (and therefore has an element appears at this[ 0 ]) and the 4290 // `value` parameter was not undefined. An empty jQuery object 4291 // will result in `undefined` for elem = this[ 0 ] which will 4292 // throw an exception if an attempt to read a data cache is made. 4293 if ( elem && value === undefined ) { 4294 4295 // Attempt to get data from the cache 4296 // The key will always be camelCased in Data 4297 data = dataUser.get( elem, key ); 4298 if ( data !== undefined ) { 4299 return data; 4300 } 4301 4302 // Attempt to "discover" the data in 4303 // HTML5 custom data-* attrs 4304 data = dataAttr( elem, key ); 4305 if ( data !== undefined ) { 4306 return data; 4307 } 4308 4309 // We tried really hard, but the data doesn't exist. 4310 return; 4311 } 4312 4313 // Set the data... 4314 this.each( function() { 4315 4316 // We always store the camelCased key 4317 dataUser.set( this, key, value ); 4318 } ); 4319 }, null, value, arguments.length > 1, null, true ); 4320 }, 4321 4322 removeData: function( key ) { 4323 return this.each( function() { 4324 dataUser.remove( this, key ); 4325 } ); 4326 } 4327} ); 4328 4329 4330jQuery.extend( { 4331 queue: function( elem, type, data ) { 4332 var queue; 4333 4334 if ( elem ) { 4335 type = ( type || "fx" ) + "queue"; 4336 queue = dataPriv.get( elem, type ); 4337 4338 // Speed up dequeue by getting out quickly if this is just a lookup 4339 if ( data ) { 4340 if ( !queue || Array.isArray( data ) ) { 4341 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); 4342 } else { 4343 queue.push( data ); 4344 } 4345 } 4346 return queue || []; 4347 } 4348 }, 4349 4350 dequeue: function( elem, type ) { 4351 type = type || "fx"; 4352 4353 var queue = jQuery.queue( elem, type ), 4354 startLength = queue.length, 4355 fn = queue.shift(), 4356 hooks = jQuery._queueHooks( elem, type ), 4357 next = function() { 4358 jQuery.dequeue( elem, type ); 4359 }; 4360 4361 // If the fx queue is dequeued, always remove the progress sentinel 4362 if ( fn === "inprogress" ) { 4363 fn = queue.shift(); 4364 startLength--; 4365 } 4366 4367 if ( fn ) { 4368 4369 // Add a progress sentinel to prevent the fx queue from being 4370 // automatically dequeued 4371 if ( type === "fx" ) { 4372 queue.unshift( "inprogress" ); 4373 } 4374 4375 // Clear up the last queue stop function 4376 delete hooks.stop; 4377 fn.call( elem, next, hooks ); 4378 } 4379 4380 if ( !startLength && hooks ) { 4381 hooks.empty.fire(); 4382 } 4383 }, 4384 4385 // Not public - generate a queueHooks object, or return the current one 4386 _queueHooks: function( elem, type ) { 4387 var key = type + "queueHooks"; 4388 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { 4389 empty: jQuery.Callbacks( "once memory" ).add( function() { 4390 dataPriv.remove( elem, [ type + "queue", key ] ); 4391 } ) 4392 } ); 4393 } 4394} ); 4395 4396jQuery.fn.extend( { 4397 queue: function( type, data ) { 4398 var setter = 2; 4399 4400 if ( typeof type !== "string" ) { 4401 data = type; 4402 type = "fx"; 4403 setter--; 4404 } 4405 4406 if ( arguments.length < setter ) { 4407 return jQuery.queue( this[ 0 ], type ); 4408 } 4409 4410 return data === undefined ? 4411 this : 4412 this.each( function() { 4413 var queue = jQuery.queue( this, type, data ); 4414 4415 // Ensure a hooks for this queue 4416 jQuery._queueHooks( this, type ); 4417 4418 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { 4419 jQuery.dequeue( this, type ); 4420 } 4421 } ); 4422 }, 4423 dequeue: function( type ) { 4424 return this.each( function() { 4425 jQuery.dequeue( this, type ); 4426 } ); 4427 }, 4428 clearQueue: function( type ) { 4429 return this.queue( type || "fx", [] ); 4430 }, 4431 4432 // Get a promise resolved when queues of a certain type 4433 // are emptied (fx is the type by default) 4434 promise: function( type, obj ) { 4435 var tmp,
vendor: 37,137 bytes, lines 4436-5861
4436 count = 1, 4437 defer = jQuery.Deferred(), 4438 elements = this, 4439 i = this.length, 4440 resolve = function() { 4441 if ( !( --count ) ) { 4442 defer.resolveWith( elements, [ elements ] ); 4443 } 4444 }; 4445 4446 if ( typeof type !== "string" ) { 4447 obj = type; 4448 type = undefined; 4449 } 4450 type = type || "fx"; 4451 4452 while ( i-- ) { 4453 tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); 4454 if ( tmp && tmp.empty ) { 4455 count++; 4456 tmp.empty.add( resolve ); 4457 } 4458 } 4459 resolve(); 4460 return defer.promise( obj ); 4461 } 4462} ); 4463var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; 4464 4465var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); 4466 4467 4468var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; 4469 4470var isHiddenWithinTree = function( elem, el ) { 4471 4472 // isHiddenWithinTree might be called from jQuery#filter function; 4473 // in that case, element will be second argument 4474 elem = el || elem; 4475 4476 // Inline style trumps all 4477 return elem.style.display === "none" || 4478 elem.style.display === "" && 4479 4480 // Otherwise, check computed style 4481 // Support: Firefox <=43 - 45 4482 // Disconnected elements can have computed display: none, so first confirm that elem is 4483 // in the document. 4484 jQuery.contains( elem.ownerDocument, elem ) && 4485 4486 jQuery.css( elem, "display" ) === "none"; 4487 }; 4488 4489var swap = function( elem, options, callback, args ) { 4490 var ret, name, 4491 old = {}; 4492 4493 // Remember the old values, and insert the new ones 4494 for ( name in options ) { 4495 old[ name ] = elem.style[ name ]; 4496 elem.style[ name ] = options[ name ]; 4497 } 4498 4499 ret = callback.apply( elem, args || [] ); 4500 4501 // Revert the old values 4502 for ( name in options ) { 4503 elem.style[ name ] = old[ name ]; 4504 } 4505 4506 return ret; 4507}; 4508 4509 4510 4511 4512function adjustCSS( elem, prop, valueParts, tween ) { 4513 var adjusted, scale, 4514 maxIterations = 20, 4515 currentValue = tween ? 4516 function() { 4517 return tween.cur(); 4518 } : 4519 function() { 4520 return jQuery.css( elem, prop, "" ); 4521 }, 4522 initial = currentValue(), 4523 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), 4524 4525 // Starting value computation is required for potential unit mismatches 4526 initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && 4527 rcssNum.exec( jQuery.css( elem, prop ) ); 4528 4529 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { 4530 4531 // Support: Firefox <=54 4532 // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) 4533 initial = initial / 2; 4534 4535 // Trust units reported by jQuery.css 4536 unit = unit || initialInUnit[ 3 ]; 4537 4538 // Iteratively approximate from a nonzero starting point 4539 initialInUnit = +initial || 1; 4540 4541 while ( maxIterations-- ) { 4542 4543 // Evaluate and update our best guess (doubling guesses that zero out). 4544 // Finish if the scale equals or crosses 1 (making the old*new product non-positive). 4545 jQuery.style( elem, prop, initialInUnit + unit ); 4546 if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { 4547 maxIterations = 0; 4548 } 4549 initialInUnit = initialInUnit / scale; 4550 4551 } 4552 4553 initialInUnit = initialInUnit * 2; 4554 jQuery.style( elem, prop, initialInUnit + unit ); 4555 4556 // Make sure we update the tween properties later on 4557 valueParts = valueParts || []; 4558 } 4559 4560 if ( valueParts ) { 4561 initialInUnit = +initialInUnit || +initial || 0; 4562 4563 // Apply relative offset (+=/-=) if specified 4564 adjusted = valueParts[ 1 ] ? 4565 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : 4566 +valueParts[ 2 ]; 4567 if ( tween ) { 4568 tween.unit = unit; 4569 tween.start = initialInUnit; 4570 tween.end = adjusted; 4571 } 4572 } 4573 return adjusted; 4574} 4575 4576 4577var defaultDisplayMap = {}; 4578 4579function getDefaultDisplay( elem ) { 4580 var temp, 4581 doc = elem.ownerDocument, 4582 nodeName = elem.nodeName, 4583 display = defaultDisplayMap[ nodeName ]; 4584 4585 if ( display ) { 4586 return display; 4587 } 4588 4589 temp = doc.body.appendChild( doc.createElement( nodeName ) ); 4590 display = jQuery.css( temp, "display" ); 4591 4592 temp.parentNode.removeChild( temp ); 4593 4594 if ( display === "none" ) { 4595 display = "block"; 4596 } 4597 defaultDisplayMap[ nodeName ] = display; 4598 4599 return display; 4600} 4601 4602function showHide( elements, show ) { 4603 var display, elem, 4604 values = [], 4605 index = 0, 4606 length = elements.length; 4607 4608 // Determine new display value for elements that need to change 4609 for ( ; index < length; index++ ) { 4610 elem = elements[ index ]; 4611 if ( !elem.style ) { 4612 continue; 4613 } 4614 4615 display = elem.style.display; 4616 if ( show ) { 4617 4618 // Since we force visibility upon cascade-hidden elements, an immediate (and slow) 4619 // check is required in this first loop unless we have a nonempty display value (either 4620 // inline or about-to-be-restored) 4621 if ( display === "none" ) { 4622 values[ index ] = dataPriv.get( elem, "display" ) || null; 4623 if ( !values[ index ] ) { 4624 elem.style.display = ""; 4625 } 4626 } 4627 if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { 4628 values[ index ] = getDefaultDisplay( elem ); 4629 } 4630 } else { 4631 if ( display !== "none" ) { 4632 values[ index ] = "none"; 4633 4634 // Remember what we're overwriting 4635 dataPriv.set( elem, "display", display ); 4636 } 4637 } 4638 } 4639 4640 // Set the display of the elements in a second loop to avoid constant reflow 4641 for ( index = 0; index < length; index++ ) { 4642 if ( values[ index ] != null ) { 4643 elements[ index ].style.display = values[ index ]; 4644 } 4645 } 4646 4647 return elements; 4648} 4649 4650jQuery.fn.extend( { 4651 show: function() { 4652 return showHide( this, true ); 4653 }, 4654 hide: function() { 4655 return showHide( this ); 4656 }, 4657 toggle: function( state ) { 4658 if ( typeof state === "boolean" ) { 4659 return state ? this.show() : this.hide(); 4660 } 4661 4662 return this.each( function() { 4663 if ( isHiddenWithinTree( this ) ) { 4664 jQuery( this ).show(); 4665 } else { 4666 jQuery( this ).hide(); 4667 } 4668 } ); 4669 } 4670} ); 4671var rcheckableType = ( /^(?:checkbox|radio)$/i ); 4672 4673var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i ); 4674 4675var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); 4676 4677 4678 4679// We have to close these tags to support XHTML (#13200) 4680var wrapMap = { 4681 4682 // Support: IE <=9 only 4683 option: [ 1, "<select multiple='multiple'>", "</select>" ], 4684 4685 // XHTML parsers do not magically insert elements in the 4686 // same way that tag soup parsers do. So we cannot shorten 4687 // this by omitting <tbody> or other required elements. 4688 thead: [ 1, "<table>", "</table>" ], 4689 col: [ 2, "<table><colgroup>", "</colgroup></table>" ], 4690 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 4691 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 4692 4693 _default: [ 0, "", "" ] 4694}; 4695 4696// Support: IE <=9 only 4697wrapMap.optgroup = wrapMap.option; 4698 4699wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 4700wrapMap.th = wrapMap.td; 4701 4702 4703function getAll( context, tag ) { 4704 4705 // Support: IE <=9 - 11 only 4706 // Use typeof to avoid zero-argument method invocation on host objects (#15151) 4707 var ret; 4708 4709 if ( typeof context.getElementsByTagName !== "undefined" ) { 4710 ret = context.getElementsByTagName( tag || "*" ); 4711 4712 } else if ( typeof context.querySelectorAll !== "undefined" ) { 4713 ret = context.querySelectorAll( tag || "*" ); 4714 4715 } else { 4716 ret = []; 4717 } 4718 4719 if ( tag === undefined || tag && nodeName( context, tag ) ) { 4720 return jQuery.merge( [ context ], ret ); 4721 } 4722 4723 return ret; 4724} 4725 4726 4727// Mark scripts as having already been evaluated 4728function setGlobalEval( elems, refElements ) { 4729 var i = 0, 4730 l = elems.length; 4731 4732 for ( ; i < l; i++ ) { 4733 dataPriv.set( 4734 elems[ i ], 4735 "globalEval", 4736 !refElements || dataPriv.get( refElements[ i ], "globalEval" ) 4737 ); 4738 } 4739} 4740 4741 4742var rhtml = /<|&#?\w+;/; 4743 4744function buildFragment( elems, context, scripts, selection, ignored ) { 4745 var elem, tmp, tag, wrap, contains, j, 4746 fragment = context.createDocumentFragment(), 4747 nodes = [], 4748 i = 0, 4749 l = elems.length; 4750 4751 for ( ; i < l; i++ ) { 4752 elem = elems[ i ]; 4753 4754 if ( elem || elem === 0 ) { 4755 4756 // Add nodes directly 4757 if ( toType( elem ) === "object" ) { 4758 4759 // Support: Android <=4.0 only, PhantomJS 1 only 4760 // push.apply(_, arraylike) throws on ancient WebKit 4761 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); 4762 4763 // Convert non-html into a text node 4764 } else if ( !rhtml.test( elem ) ) { 4765 nodes.push( context.createTextNode( elem ) ); 4766 4767 // Convert html into DOM nodes 4768 } else { 4769 tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); 4770 4771 // Deserialize a standard representation 4772 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); 4773 wrap = wrapMap[ tag ] || wrapMap._default; 4774 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; 4775 4776 // Descend through wrappers to the right content 4777 j = wrap[ 0 ]; 4778 while ( j-- ) { 4779 tmp = tmp.lastChild; 4780 } 4781 4782 // Support: Android <=4.0 only, PhantomJS 1 only 4783 // push.apply(_, arraylike) throws on ancient WebKit 4784 jQuery.merge( nodes, tmp.childNodes ); 4785 4786 // Remember the top-level container 4787 tmp = fragment.firstChild; 4788 4789 // Ensure the created nodes are orphaned (#12392) 4790 tmp.textContent = ""; 4791 } 4792 } 4793 } 4794 4795 // Remove wrapper from fragment 4796 fragment.textContent = ""; 4797 4798 i = 0; 4799 while ( ( elem = nodes[ i++ ] ) ) { 4800 4801 // Skip elements already in the context collection (trac-4087) 4802 if ( selection && jQuery.inArray( elem, selection ) > -1 ) { 4803 if ( ignored ) { 4804 ignored.push( elem ); 4805 } 4806 continue; 4807 } 4808 4809 contains = jQuery.contains( elem.ownerDocument, elem ); 4810 4811 // Append to fragment 4812 tmp = getAll( fragment.appendChild( elem ), "script" ); 4813 4814 // Preserve script evaluation history 4815 if ( contains ) { 4816 setGlobalEval( tmp ); 4817 } 4818 4819 // Capture executables 4820 if ( scripts ) { 4821 j = 0; 4822 while ( ( elem = tmp[ j++ ] ) ) { 4823 if ( rscriptType.test( elem.type || "" ) ) { 4824 scripts.push( elem ); 4825 } 4826 } 4827 } 4828 } 4829 4830 return fragment; 4831} 4832 4833 4834( function() { 4835 var fragment = document.createDocumentFragment(), 4836 div = fragment.appendChild( document.createElement( "div" ) ), 4837 input = document.createElement( "input" ); 4838 4839 // Support: Android 4.0 - 4.3 only 4840 // Check state lost if the name is set (#11217) 4841 // Support: Windows Web Apps (WWA) 4842 // `name` and `type` must use .setAttribute for WWA (#14901) 4843 input.setAttribute( "type", "radio" ); 4844 input.setAttribute( "checked", "checked" ); 4845 input.setAttribute( "name", "t" ); 4846 4847 div.appendChild( input ); 4848 4849 // Support: Android <=4.1 only 4850 // Older WebKit doesn't clone checked state correctly in fragments 4851 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; 4852 4853 // Support: IE <=11 only 4854 // Make sure textarea (and checkbox) defaultValue is properly cloned 4855 div.innerHTML = "<textarea>x</textarea>"; 4856 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; 4857} )(); 4858var documentElement = document.documentElement; 4859 4860 4861 4862var 4863 rkeyEvent = /^key/, 4864 rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, 4865 rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 4866 4867function returnTrue() { 4868 return true; 4869} 4870 4871function returnFalse() { 4872 return false; 4873} 4874 4875// Support: IE <=9 only 4876// See #13393 for more info 4877function safeActiveElement() { 4878 try { 4879 return document.activeElement; 4880 } catch ( err ) { } 4881} 4882 4883function on( elem, types, selector, data, fn, one ) { 4884 var origFn, type; 4885 4886 // Types can be a map of types/handlers 4887 if ( typeof types === "object" ) { 4888 4889 // ( types-Object, selector, data ) 4890 if ( typeof selector !== "string" ) { 4891 4892 // ( types-Object, data ) 4893 data = data || selector; 4894 selector = undefined; 4895 } 4896 for ( type in types ) { 4897 on( elem, type, selector, data, types[ type ], one ); 4898 } 4899 return elem; 4900 } 4901 4902 if ( data == null && fn == null ) { 4903 4904 // ( types, fn ) 4905 fn = selector; 4906 data = selector = undefined; 4907 } else if ( fn == null ) { 4908 if ( typeof selector === "string" ) { 4909 4910 // ( types, selector, fn ) 4911 fn = data; 4912 data = undefined; 4913 } else { 4914 4915 // ( types, data, fn ) 4916 fn = data; 4917 data = selector; 4918 selector = undefined; 4919 } 4920 } 4921 if ( fn === false ) { 4922 fn = returnFalse; 4923 } else if ( !fn ) { 4924 return elem; 4925 } 4926 4927 if ( one === 1 ) { 4928 origFn = fn; 4929 fn = function( event ) { 4930 4931 // Can use an empty set, since event contains the info 4932 jQuery().off( event ); 4933 return origFn.apply( this, arguments ); 4934 }; 4935 4936 // Use same guid so caller can remove using origFn 4937 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); 4938 } 4939 return elem.each( function() { 4940 jQuery.event.add( this, types, fn, data, selector ); 4941 } ); 4942} 4943 4944/* 4945 * Helper functions for managing events -- not part of the public interface. 4946 * Props to Dean Edwards' addEvent library for many of the ideas. 4947 */ 4948jQuery.event = { 4949 4950 global: {}, 4951 4952 add: function( elem, types, handler, data, selector ) { 4953 4954 var handleObjIn, eventHandle, tmp, 4955 events, t, handleObj, 4956 special, handlers, type, namespaces, origType, 4957 elemData = dataPriv.get( elem ); 4958 4959 // Don't attach events to noData or text/comment nodes (but allow plain objects) 4960 if ( !elemData ) { 4961 return; 4962 } 4963 4964 // Caller can pass in an object of custom data in lieu of the handler 4965 if ( handler.handler ) { 4966 handleObjIn = handler; 4967 handler = handleObjIn.handler; 4968 selector = handleObjIn.selector; 4969 } 4970 4971 // Ensure that invalid selectors throw exceptions at attach time 4972 // Evaluate against documentElement in case elem is a non-element node (e.g., document) 4973 if ( selector ) { 4974 jQuery.find.matchesSelector( documentElement, selector ); 4975 } 4976 4977 // Make sure that the handler has a unique ID, used to find/remove it later 4978 if ( !handler.guid ) { 4979 handler.guid = jQuery.guid++; 4980 } 4981 4982 // Init the element's event structure and main handler, if this is the first 4983 if ( !( events = elemData.events ) ) { 4984 events = elemData.events = {}; 4985 } 4986 if ( !( eventHandle = elemData.handle ) ) { 4987 eventHandle = elemData.handle = function( e ) { 4988 4989 // Discard the second event of a jQuery.event.trigger() and 4990 // when an event is called after a page has unloaded 4991 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? 4992 jQuery.event.dispatch.apply( elem, arguments ) : undefined; 4993 }; 4994 } 4995 4996 // Handle multiple events separated by a space 4997 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 4998 t = types.length; 4999 while ( t-- ) { 5000 tmp = rtypenamespace.exec( types[ t ] ) || []; 5001 type = origType = tmp[ 1 ]; 5002 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 5003 5004 // There *must* be a type, no attaching namespace-only handlers 5005 if ( !type ) { 5006 continue; 5007 } 5008 5009 // If event changes its type, use the special event handlers for the changed type 5010 special = jQuery.event.special[ type ] || {}; 5011 5012 // If selector defined, determine special event api type, otherwise given type 5013 type = ( selector ? special.delegateType : special.bindType ) || type; 5014 5015 // Update special based on newly reset type 5016 special = jQuery.event.special[ type ] || {}; 5017 5018 // handleObj is passed to all event handlers 5019 handleObj = jQuery.extend( { 5020 type: type, 5021 origType: origType, 5022 data: data, 5023 handler: handler, 5024 guid: handler.guid, 5025 selector: selector, 5026 needsContext: selector && jQuery.expr.match.needsContext.test( selector ), 5027 namespace: namespaces.join( "." ) 5028 }, handleObjIn ); 5029 5030 // Init the event handler queue if we're the first 5031 if ( !( handlers = events[ type ] ) ) { 5032 handlers = events[ type ] = []; 5033 handlers.delegateCount = 0; 5034 5035 // Only use addEventListener if the special events handler returns false 5036 if ( !special.setup || 5037 special.setup.call( elem, data, namespaces, eventHandle ) === false ) { 5038 5039 if ( elem.addEventListener ) { 5040 elem.addEventListener( type, eventHandle ); 5041 } 5042 } 5043 } 5044 5045 if ( special.add ) { 5046 special.add.call( elem, handleObj ); 5047 5048 if ( !handleObj.handler.guid ) { 5049 handleObj.handler.guid = handler.guid; 5050 } 5051 } 5052 5053 // Add to the element's handler list, delegates in front 5054 if ( selector ) { 5055 handlers.splice( handlers.delegateCount++, 0, handleObj ); 5056 } else { 5057 handlers.push( handleObj ); 5058 } 5059 5060 // Keep track of which events have ever been used, for event optimization 5061 jQuery.event.global[ type ] = true; 5062 } 5063 5064 }, 5065 5066 // Detach an event or set of events from an element 5067 remove: function( elem, types, handler, selector, mappedTypes ) { 5068 5069 var j, origCount, tmp, 5070 events, t, handleObj, 5071 special, handlers, type, namespaces, origType, 5072 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); 5073 5074 if ( !elemData || !( events = elemData.events ) ) { 5075 return; 5076 } 5077 5078 // Once for each type.namespace in types; type may be omitted 5079 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 5080 t = types.length; 5081 while ( t-- ) { 5082 tmp = rtypenamespace.exec( types[ t ] ) || []; 5083 type = origType = tmp[ 1 ]; 5084 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 5085 5086 // Unbind all events (on this namespace, if provided) for the element 5087 if ( !type ) { 5088 for ( type in events ) { 5089 jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); 5090 } 5091 continue; 5092 } 5093 5094 special = jQuery.event.special[ type ] || {}; 5095 type = ( selector ? special.delegateType : special.bindType ) || type; 5096 handlers = events[ type ] || []; 5097 tmp = tmp[ 2 ] && 5098 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); 5099 5100 // Remove matching events 5101 origCount = j = handlers.length; 5102 while ( j-- ) { 5103 handleObj = handlers[ j ]; 5104 5105 if ( ( mappedTypes || origType === handleObj.origType ) && 5106 ( !handler || handler.guid === handleObj.guid ) && 5107 ( !tmp || tmp.test( handleObj.namespace ) ) && 5108 ( !selector || selector === handleObj.selector || 5109 selector === "**" && handleObj.selector ) ) { 5110 handlers.splice( j, 1 ); 5111 5112 if ( handleObj.selector ) { 5113 handlers.delegateCount--; 5114 } 5115 if ( special.remove ) { 5116 special.remove.call( elem, handleObj ); 5117 } 5118 } 5119 } 5120 5121 // Remove generic event handler if we removed something and no more handlers exist 5122 // (avoids potential for endless recursion during removal of special event handlers) 5123 if ( origCount && !handlers.length ) { 5124 if ( !special.teardown || 5125 special.teardown.call( elem, namespaces, elemData.handle ) === false ) { 5126 5127 jQuery.removeEvent( elem, type, elemData.handle ); 5128 } 5129 5130 delete events[ type ]; 5131 } 5132 } 5133 5134 // Remove data and the expando if it's no longer used 5135 if ( jQuery.isEmptyObject( events ) ) { 5136 dataPriv.remove( elem, "handle events" ); 5137 } 5138 }, 5139 5140 dispatch: function( nativeEvent ) { 5141 5142 // Make a writable jQuery.Event from the native event object 5143 var event = jQuery.event.fix( nativeEvent ); 5144 5145 var i, j, ret, matched, handleObj, handlerQueue, 5146 args = new Array( arguments.length ), 5147 handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [], 5148 special = jQuery.event.special[ event.type ] || {}; 5149 5150 // Use the fix-ed jQuery.Event rather than the (read-only) native event 5151 args[ 0 ] = event; 5152 5153 for ( i = 1; i < arguments.length; i++ ) { 5154 args[ i ] = arguments[ i ]; 5155 } 5156 5157 event.delegateTarget = this; 5158 5159 // Call the preDispatch hook for the mapped type, and let it bail if desired 5160 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { 5161 return; 5162 } 5163 5164 // Determine handlers 5165 handlerQueue = jQuery.event.handlers.call( this, event, handlers ); 5166 5167 // Run delegates first; they may want to stop propagation beneath us 5168 i = 0; 5169 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { 5170 event.currentTarget = matched.elem; 5171 5172 j = 0; 5173 while ( ( handleObj = matched.handlers[ j++ ] ) && 5174 !event.isImmediatePropagationStopped() ) { 5175 5176 // Triggered event must either 1) have no namespace, or 2) have namespace(s) 5177 // a subset or equal to those in the bound event (both can have no namespace). 5178 if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) { 5179 5180 event.handleObj = handleObj; 5181 event.data = handleObj.data; 5182 5183 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || 5184 handleObj.handler ).apply( matched.elem, args ); 5185 5186 if ( ret !== undefined ) { 5187 if ( ( event.result = ret ) === false ) { 5188 event.preventDefault(); 5189 event.stopPropagation(); 5190 } 5191 } 5192 } 5193 } 5194 } 5195 5196 // Call the postDispatch hook for the mapped type 5197 if ( special.postDispatch ) { 5198 special.postDispatch.call( this, event ); 5199 } 5200 5201 return event.result; 5202 }, 5203 5204 handlers: function( event, handlers ) { 5205 var i, handleObj, sel, matchedHandlers, matchedSelectors, 5206 handlerQueue = [], 5207 delegateCount = handlers.delegateCount, 5208 cur = event.target; 5209 5210 // Find delegate handlers 5211 if ( delegateCount && 5212 5213 // Support: IE <=9 5214 // Black-hole SVG <use> instance trees (trac-13180) 5215 cur.nodeType && 5216 5217 // Support: Firefox <=42 5218 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) 5219 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click 5220 // Support: IE 11 only 5221 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) 5222 !( event.type === "click" && event.button >= 1 ) ) { 5223 5224 for ( ; cur !== this; cur = cur.parentNode || this ) { 5225 5226 // Don't check non-elements (#13208) 5227 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) 5228 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { 5229 matchedHandlers = []; 5230 matchedSelectors = {}; 5231 for ( i = 0; i < delegateCount; i++ ) { 5232 handleObj = handlers[ i ]; 5233 5234 // Don't conflict with Object.prototype properties (#13203) 5235 sel = handleObj.selector + " "; 5236 5237 if ( matchedSelectors[ sel ] === undefined ) { 5238 matchedSelectors[ sel ] = handleObj.needsContext ? 5239 jQuery( sel, this ).index( cur ) > -1 : 5240 jQuery.find( sel, this, null, [ cur ] ).length; 5241 } 5242 if ( matchedSelectors[ sel ] ) { 5243 matchedHandlers.push( handleObj ); 5244 } 5245 } 5246 if ( matchedHandlers.length ) { 5247 handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); 5248 } 5249 } 5250 } 5251 } 5252 5253 // Add the remaining (directly-bound) handlers 5254 cur = this; 5255 if ( delegateCount < handlers.length ) { 5256 handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); 5257 } 5258 5259 return handlerQueue; 5260 }, 5261 5262 addProp: function( name, hook ) { 5263 Object.defineProperty( jQuery.Event.prototype, name, { 5264 enumerable: true, 5265 configurable: true, 5266 5267 get: isFunction( hook ) ? 5268 function() { 5269 if ( this.originalEvent ) { 5270 return hook( this.originalEvent ); 5271 } 5272 } : 5273 function() { 5274 if ( this.originalEvent ) { 5275 return this.originalEvent[ name ]; 5276 } 5277 }, 5278 5279 set: function( value ) { 5280 Object.defineProperty( this, name, { 5281 enumerable: true, 5282 configurable: true, 5283 writable: true, 5284 value: value 5285 } ); 5286 } 5287 } ); 5288 }, 5289 5290 fix: function( originalEvent ) { 5291 return originalEvent[ jQuery.expando ] ? 5292 originalEvent : 5293 new jQuery.Event( originalEvent ); 5294 }, 5295 5296 special: { 5297 load: { 5298 5299 // Prevent triggered image.load events from bubbling to window.load 5300 noBubble: true 5301 }, 5302 focus: { 5303 5304 // Fire native event if possible so blur/focus sequence is correct 5305 trigger: function() { 5306 if ( this !== safeActiveElement() && this.focus ) { 5307 this.focus(); 5308 return false; 5309 } 5310 }, 5311 delegateType: "focusin" 5312 }, 5313 blur: { 5314 trigger: function() { 5315 if ( this === safeActiveElement() && this.blur ) { 5316 this.blur(); 5317 return false; 5318 } 5319 }, 5320 delegateType: "focusout" 5321 }, 5322 click: { 5323 5324 // For checkbox, fire native event so checked state will be right 5325 trigger: function() { 5326 if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) { 5327 this.click(); 5328 return false; 5329 } 5330 }, 5331 5332 // For cross-browser consistency, don't fire native .click() on links 5333 _default: function( event ) { 5334 return nodeName( event.target, "a" ); 5335 } 5336 }, 5337 5338 beforeunload: { 5339 postDispatch: function( event ) { 5340 5341 // Support: Firefox 20+ 5342 // Firefox doesn't alert if the returnValue field is not set. 5343 if ( event.result !== undefined && event.originalEvent ) { 5344 event.originalEvent.returnValue = event.result; 5345 } 5346 } 5347 } 5348 } 5349}; 5350 5351jQuery.removeEvent = function( elem, type, handle ) { 5352 5353 // This "if" is needed for plain objects 5354 if ( elem.removeEventListener ) { 5355 elem.removeEventListener( type, handle ); 5356 } 5357}; 5358 5359jQuery.Event = function( src, props ) { 5360 5361 // Allow instantiation without the 'new' keyword 5362 if ( !( this instanceof jQuery.Event ) ) { 5363 return new jQuery.Event( src, props ); 5364 } 5365 5366 // Event object 5367 if ( src && src.type ) { 5368 this.originalEvent = src; 5369 this.type = src.type; 5370 5371 // Events bubbling up the document may have been marked as prevented 5372 // by a handler lower down the tree; reflect the correct value. 5373 this.isDefaultPrevented = src.defaultPrevented || 5374 src.defaultPrevented === undefined && 5375 5376 // Support: Android <=2.3 only 5377 src.returnValue === false ? 5378 returnTrue : 5379 returnFalse; 5380 5381 // Create target properties 5382 // Support: Safari <=6 - 7 only 5383 // Target should not be a text node (#504, #13143) 5384 this.target = ( src.target && src.target.nodeType === 3 ) ? 5385 src.target.parentNode : 5386 src.target; 5387 5388 this.currentTarget = src.currentTarget; 5389 this.relatedTarget = src.relatedTarget; 5390 5391 // Event type 5392 } else { 5393 this.type = src; 5394 } 5395 5396 // Put explicitly provided properties onto the event object 5397 if ( props ) { 5398 jQuery.extend( this, props ); 5399 } 5400 5401 // Create a timestamp if incoming event doesn't have one 5402 this.timeStamp = src && src.timeStamp || Date.now(); 5403 5404 // Mark it as fixed 5405 this[ jQuery.expando ] = true; 5406}; 5407 5408// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 5409// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 5410jQuery.Event.prototype = { 5411 constructor: jQuery.Event, 5412 isDefaultPrevented: returnFalse, 5413 isPropagationStopped: returnFalse, 5414 isImmediatePropagationStopped: returnFalse, 5415 isSimulated: false, 5416 5417 preventDefault: function() { 5418 var e = this.originalEvent; 5419 5420 this.isDefaultPrevented = returnTrue; 5421 5422 if ( e && !this.isSimulated ) { 5423 e.preventDefault(); 5424 } 5425 }, 5426 stopPropagation: function() { 5427 var e = this.originalEvent; 5428 5429 this.isPropagationStopped = returnTrue; 5430 5431 if ( e && !this.isSimulated ) { 5432 e.stopPropagation(); 5433 } 5434 }, 5435 stopImmediatePropagation: function() { 5436 var e = this.originalEvent; 5437 5438 this.isImmediatePropagationStopped = returnTrue; 5439 5440 if ( e && !this.isSimulated ) { 5441 e.stopImmediatePropagation(); 5442 } 5443 5444 this.stopPropagation(); 5445 } 5446}; 5447 5448// Includes all common event props including KeyEvent and MouseEvent specific props 5449jQuery.each( { 5450 altKey: true, 5451 bubbles: true, 5452 cancelable: true, 5453 changedTouches: true, 5454 ctrlKey: true, 5455 detail: true, 5456 eventPhase: true, 5457 metaKey: true, 5458 pageX: true, 5459 pageY: true, 5460 shiftKey: true, 5461 view: true, 5462 "char": true, 5463 charCode: true, 5464 key: true, 5465 keyCode: true, 5466 button: true, 5467 buttons: true, 5468 clientX: true, 5469 clientY: true, 5470 offsetX: true, 5471 offsetY: true, 5472 pointerId: true, 5473 pointerType: true, 5474 screenX: true, 5475 screenY: true, 5476 targetTouches: true, 5477 toElement: true, 5478 touches: true, 5479 5480 which: function( event ) { 5481 var button = event.button; 5482 5483 // Add which for key events 5484 if ( event.which == null && rkeyEvent.test( event.type ) ) { 5485 return event.charCode != null ? event.charCode : event.keyCode; 5486 } 5487 5488 // Add which for click: 1 === left; 2 === middle; 3 === right 5489 if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) { 5490 if ( button & 1 ) { 5491 return 1; 5492 } 5493 5494 if ( button & 2 ) { 5495 return 3; 5496 } 5497 5498 if ( button & 4 ) { 5499 return 2; 5500 } 5501 5502 return 0; 5503 } 5504 5505 return event.which; 5506 } 5507}, jQuery.event.addProp ); 5508 5509// Create mouseenter/leave events using mouseover/out and event-time checks 5510// so that event delegation works in jQuery. 5511// Do the same for pointerenter/pointerleave and pointerover/pointerout 5512// 5513// Support: Safari 7 only 5514// Safari sends mouseenter too often; see: 5515// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 5516// for the description of the bug (it existed in older Chrome versions as well). 5517jQuery.each( { 5518 mouseenter: "mouseover", 5519 mouseleave: "mouseout", 5520 pointerenter: "pointerover", 5521 pointerleave: "pointerout" 5522}, function( orig, fix ) { 5523 jQuery.event.special[ orig ] = { 5524 delegateType: fix, 5525 bindType: fix, 5526 5527 handle: function( event ) { 5528 var ret, 5529 target = this, 5530 related = event.relatedTarget, 5531 handleObj = event.handleObj; 5532 5533 // For mouseenter/leave call the handler if related is outside the target. 5534 // NB: No relatedTarget if the mouse left/entered the browser window 5535 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { 5536 event.type = handleObj.origType; 5537 ret = handleObj.handler.apply( this, arguments ); 5538 event.type = fix; 5539 } 5540 return ret; 5541 } 5542 }; 5543} ); 5544 5545jQuery.fn.extend( { 5546 5547 on: function( types, selector, data, fn ) { 5548 return on( this, types, selector, data, fn ); 5549 }, 5550 one: function( types, selector, data, fn ) { 5551 return on( this, types, selector, data, fn, 1 ); 5552 }, 5553 off: function( types, selector, fn ) { 5554 var handleObj, type; 5555 if ( types && types.preventDefault && types.handleObj ) { 5556 5557 // ( event ) dispatched jQuery.Event 5558 handleObj = types.handleObj; 5559 jQuery( types.delegateTarget ).off( 5560 handleObj.namespace ? 5561 handleObj.origType + "." + handleObj.namespace : 5562 handleObj.origType, 5563 handleObj.selector, 5564 handleObj.handler 5565 ); 5566 return this; 5567 } 5568 if ( typeof types === "object" ) { 5569 5570 // ( types-object [, selector] ) 5571 for ( type in types ) { 5572 this.off( type, selector, types[ type ] ); 5573 } 5574 return this; 5575 } 5576 if ( selector === false || typeof selector === "function" ) { 5577 5578 // ( types [, fn] ) 5579 fn = selector; 5580 selector = undefined; 5581 } 5582 if ( fn === false ) { 5583 fn = returnFalse; 5584 } 5585 return this.each( function() { 5586 jQuery.event.remove( this, types, fn, selector ); 5587 } ); 5588 } 5589} ); 5590 5591 5592var 5593 5594 /* eslint-disable max-len */ 5595 5596 // See https://github.com/eslint/eslint/issues/3229 5597 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi, 5598 5599 /* eslint-enable */ 5600 5601 // Support: IE <=10 - 11, Edge 12 - 13 only 5602 // In IE/Edge using regex groups here causes severe slowdowns. 5603 // See https://connect.microsoft.com/IE/feedback/details/1736512/ 5604 rnoInnerhtml = /<script|<style|<link/i, 5605 5606 // checked="checked" or checked 5607 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 5608 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g; 5609 5610// Prefer a tbody over its parent table for containing new rows 5611function manipulationTarget( elem, content ) { 5612 if ( nodeName( elem, "table" ) && 5613 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { 5614 5615 return jQuery( elem ).children( "tbody" )[ 0 ] || elem; 5616 } 5617 5618 return elem; 5619} 5620 5621// Replace/restore the type attribute of script elements for safe DOM manipulation 5622function disableScript( elem ) { 5623 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; 5624 return elem; 5625} 5626function restoreScript( elem ) { 5627 if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { 5628 elem.type = elem.type.slice( 5 ); 5629 } else { 5630 elem.removeAttribute( "type" ); 5631 } 5632 5633 return elem; 5634} 5635 5636function cloneCopyEvent( src, dest ) { 5637 var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; 5638 5639 if ( dest.nodeType !== 1 ) { 5640 return; 5641 } 5642 5643 // 1. Copy private data: events, handlers, etc. 5644 if ( dataPriv.hasData( src ) ) { 5645 pdataOld = dataPriv.access( src ); 5646 pdataCur = dataPriv.set( dest, pdataOld ); 5647 events = pdataOld.events; 5648 5649 if ( events ) { 5650 delete pdataCur.handle; 5651 pdataCur.events = {}; 5652 5653 for ( type in events ) { 5654 for ( i = 0, l = events[ type ].length; i < l; i++ ) { 5655 jQuery.event.add( dest, type, events[ type ][ i ] ); 5656 } 5657 } 5658 } 5659 } 5660 5661 // 2. Copy user data 5662 if ( dataUser.hasData( src ) ) { 5663 udataOld = dataUser.access( src ); 5664 udataCur = jQuery.extend( {}, udataOld ); 5665 5666 dataUser.set( dest, udataCur ); 5667 } 5668} 5669 5670// Fix IE bugs, see support tests 5671function fixInput( src, dest ) { 5672 var nodeName = dest.nodeName.toLowerCase(); 5673 5674 // Fails to persist the checked state of a cloned checkbox or radio button. 5675 if ( nodeName === "input" && rcheckableType.test( src.type ) ) { 5676 dest.checked = src.checked; 5677 5678 // Fails to return the selected option to the default selected state when cloning options 5679 } else if ( nodeName === "input" || nodeName === "textarea" ) { 5680 dest.defaultValue = src.defaultValue; 5681 } 5682} 5683 5684function domManip( collection, args, callback, ignored ) { 5685 5686 // Flatten any nested arrays 5687 args = concat.apply( [], args ); 5688 5689 var fragment, first, scripts, hasScripts, node, doc, 5690 i = 0, 5691 l = collection.length, 5692 iNoClone = l - 1, 5693 value = args[ 0 ], 5694 valueIsFunction = isFunction( value ); 5695 5696 // We can't cloneNode fragments that contain checked, in WebKit 5697 if ( valueIsFunction || 5698 ( l > 1 && typeof value === "string" && 5699 !support.checkClone && rchecked.test( value ) ) ) { 5700 return collection.each( function( index ) { 5701 var self = collection.eq( index ); 5702 if ( valueIsFunction ) { 5703 args[ 0 ] = value.call( this, index, self.html() ); 5704 } 5705 domManip( self, args, callback, ignored ); 5706 } ); 5707 } 5708 5709 if ( l ) { 5710 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); 5711 first = fragment.firstChild; 5712 5713 if ( fragment.childNodes.length === 1 ) { 5714 fragment = first; 5715 } 5716 5717 // Require either new content or an interest in ignored elements to invoke the callback 5718 if ( first || ignored ) { 5719 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); 5720 hasScripts = scripts.length; 5721 5722 // Use the original fragment for the last item 5723 // instead of the first because it can end up 5724 // being emptied incorrectly in certain situations (#8070). 5725 for ( ; i < l; i++ ) { 5726 node = fragment; 5727 5728 if ( i !== iNoClone ) { 5729 node = jQuery.clone( node, true, true ); 5730 5731 // Keep references to cloned scripts for later restoration 5732 if ( hasScripts ) { 5733 5734 // Support: Android <=4.0 only, PhantomJS 1 only 5735 // push.apply(_, arraylike) throws on ancient WebKit 5736 jQuery.merge( scripts, getAll( node, "script" ) ); 5737 } 5738 } 5739 5740 callback.call( collection[ i ], node, i ); 5741 } 5742 5743 if ( hasScripts ) { 5744 doc = scripts[ scripts.length - 1 ].ownerDocument; 5745 5746 // Reenable scripts 5747 jQuery.map( scripts, restoreScript ); 5748 5749 // Evaluate executable scripts on first document insertion 5750 for ( i = 0; i < hasScripts; i++ ) { 5751 node = scripts[ i ]; 5752 if ( rscriptType.test( node.type || "" ) && 5753 !dataPriv.access( node, "globalEval" ) && 5754 jQuery.contains( doc, node ) ) { 5755 5756 if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { 5757 5758 // Optional AJAX dependency, but won't run scripts if not present 5759 if ( jQuery._evalUrl ) { 5760 jQuery._evalUrl( node.src ); 5761 } 5762 } else { 5763 DOMEval( node.textContent.replace( rcleanScript, "" ), doc, node ); 5764 } 5765 } 5766 } 5767 } 5768 } 5769 } 5770 5771 return collection; 5772} 5773 5774function remove( elem, selector, keepData ) { 5775 var node, 5776 nodes = selector ? jQuery.filter( selector, elem ) : elem, 5777 i = 0; 5778 5779 for ( ; ( node = nodes[ i ] ) != null; i++ ) { 5780 if ( !keepData && node.nodeType === 1 ) { 5781 jQuery.cleanData( getAll( node ) ); 5782 } 5783 5784 if ( node.parentNode ) { 5785 if ( keepData && jQuery.contains( node.ownerDocument, node ) ) { 5786 setGlobalEval( getAll( node, "script" ) ); 5787 } 5788 node.parentNode.removeChild( node ); 5789 } 5790 } 5791 5792 return elem; 5793} 5794 5795jQuery.extend( { 5796 htmlPrefilter: function( html ) { 5797 return html.replace( rxhtmlTag, "<$1></$2>" ); 5798 }, 5799 5800 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 5801 var i, l, srcElements, destElements, 5802 clone = elem.cloneNode( true ), 5803 inPage = jQuery.contains( elem.ownerDocument, elem ); 5804 5805 // Fix IE cloning issues 5806 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && 5807 !jQuery.isXMLDoc( elem ) ) { 5808 5809 // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 5810 destElements = getAll( clone ); 5811 srcElements = getAll( elem ); 5812 5813 for ( i = 0, l = srcElements.length; i < l; i++ ) { 5814 fixInput( srcElements[ i ], destElements[ i ] ); 5815 } 5816 } 5817 5818 // Copy the events from the original to the clone 5819 if ( dataAndEvents ) { 5820 if ( deepDataAndEvents ) { 5821 srcElements = srcElements || getAll( elem ); 5822 destElements = destElements || getAll( clone ); 5823 5824 for ( i = 0, l = srcElements.length; i < l; i++ ) { 5825 cloneCopyEvent( srcElements[ i ], destElements[ i ] ); 5826 } 5827 } else { 5828 cloneCopyEvent( elem, clone ); 5829 } 5830 } 5831 5832 // Preserve script evaluation history 5833 destElements = getAll( clone, "script" ); 5834 if ( destElements.length > 0 ) { 5835 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); 5836 } 5837 5838 // Return the cloned set 5839 return clone; 5840 }, 5841 5842 cleanData: function( elems ) { 5843 var data, elem, type, 5844 special = jQuery.event.special, 5845 i = 0; 5846 5847 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { 5848 if ( acceptData( elem ) ) { 5849 if ( ( data = elem[ dataPriv.expando ] ) ) { 5850 if ( data.events ) { 5851 for ( type in data.events ) { 5852 if ( special[ type ] ) { 5853 jQuery.event.remove( elem, type ); 5854 5855 // This is a shortcut to avoid jQuery.event.remove's overhead 5856 } else { 5857 jQuery.removeEvent( elem, type, data.handle ); 5858 } 5859 } 5860 } 5861
vendor: 1,119 bytes, lines 5862-5906
5862 // Support: Chrome <=35 - 45+ 5863 // Assign undefined instead of using delete, see Data#remove 5864 elem[ dataPriv.expando ] = undefined; 5865 } 5866 if ( elem[ dataUser.expando ] ) { 5867 5868 // Support: Chrome <=35 - 45+ 5869 // Assign undefined instead of using delete, see Data#remove 5870 elem[ dataUser.expando ] = undefined; 5871 } 5872 } 5873 } 5874 } 5875} ); 5876 5877jQuery.fn.extend( { 5878 detach: function( selector ) { 5879 return remove( this, selector, true ); 5880 }, 5881 5882 remove: function( selector ) { 5883 return remove( this, selector ); 5884 }, 5885 5886 text: function( value ) { 5887 return access( this, function( value ) { 5888 return value === undefined ? 5889 jQuery.text( this ) : 5890 this.empty().each( function() { 5891 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 5892 this.textContent = value; 5893 } 5894 } ); 5895 }, null, value, arguments.length ); 5896 }, 5897 5898 append: function() { 5899 return domManip( this, arguments, function( elem ) { 5900 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 5901 var target = manipulationTarget( this, elem ); 5902 target.appendChild( elem ); 5903 } 5904 } ); 5905 }, 5906
vendor: 52,786 bytes, lines 5907-7961
5907 prepend: function() { 5908 return domManip( this, arguments, function( elem ) { 5909 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 5910 var target = manipulationTarget( this, elem ); 5911 target.insertBefore( elem, target.firstChild ); 5912 } 5913 } ); 5914 }, 5915 5916 before: function() { 5917 return domManip( this, arguments, function( elem ) { 5918 if ( this.parentNode ) { 5919 this.parentNode.insertBefore( elem, this ); 5920 } 5921 } ); 5922 }, 5923 5924 after: function() { 5925 return domManip( this, arguments, function( elem ) { 5926 if ( this.parentNode ) { 5927 this.parentNode.insertBefore( elem, this.nextSibling ); 5928 } 5929 } ); 5930 }, 5931 5932 empty: function() { 5933 var elem, 5934 i = 0; 5935 5936 for ( ; ( elem = this[ i ] ) != null; i++ ) { 5937 if ( elem.nodeType === 1 ) { 5938 5939 // Prevent memory leaks 5940 jQuery.cleanData( getAll( elem, false ) ); 5941 5942 // Remove any remaining nodes 5943 elem.textContent = ""; 5944 } 5945 } 5946 5947 return this; 5948 }, 5949 5950 clone: function( dataAndEvents, deepDataAndEvents ) { 5951 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 5952 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 5953 5954 return this.map( function() { 5955 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); 5956 } ); 5957 }, 5958 5959 html: function( value ) { 5960 return access( this, function( value ) { 5961 var elem = this[ 0 ] || {}, 5962 i = 0, 5963 l = this.length; 5964 5965 if ( value === undefined && elem.nodeType === 1 ) { 5966 return elem.innerHTML; 5967 } 5968 5969 // See if we can take a shortcut and just use innerHTML 5970 if ( typeof value === "string" && !rnoInnerhtml.test( value ) && 5971 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { 5972 5973 value = jQuery.htmlPrefilter( value ); 5974 5975 try { 5976 for ( ; i < l; i++ ) { 5977 elem = this[ i ] || {}; 5978 5979 // Remove element nodes and prevent memory leaks 5980 if ( elem.nodeType === 1 ) { 5981 jQuery.cleanData( getAll( elem, false ) ); 5982 elem.innerHTML = value; 5983 } 5984 } 5985 5986 elem = 0; 5987 5988 // If using innerHTML throws an exception, use the fallback method 5989 } catch ( e ) {} 5990 } 5991 5992 if ( elem ) { 5993 this.empty().append( value ); 5994 } 5995 }, null, value, arguments.length ); 5996 }, 5997 5998 replaceWith: function() { 5999 var ignored = []; 6000 6001 // Make the changes, replacing each non-ignored context element with the new content 6002 return domManip( this, arguments, function( elem ) { 6003 var parent = this.parentNode; 6004 6005 if ( jQuery.inArray( this, ignored ) < 0 ) { 6006 jQuery.cleanData( getAll( this ) ); 6007 if ( parent ) { 6008 parent.replaceChild( elem, this ); 6009 } 6010 } 6011 6012 // Force callback invocation 6013 }, ignored ); 6014 } 6015} ); 6016 6017jQuery.each( { 6018 appendTo: "append", 6019 prependTo: "prepend", 6020 insertBefore: "before", 6021 insertAfter: "after", 6022 replaceAll: "replaceWith" 6023}, function( name, original ) { 6024 jQuery.fn[ name ] = function( selector ) { 6025 var elems, 6026 ret = [], 6027 insert = jQuery( selector ), 6028 last = insert.length - 1, 6029 i = 0; 6030 6031 for ( ; i <= last; i++ ) { 6032 elems = i === last ? this : this.clone( true ); 6033 jQuery( insert[ i ] )[ original ]( elems ); 6034 6035 // Support: Android <=4.0 only, PhantomJS 1 only 6036 // .get() because push.apply(_, arraylike) throws on ancient WebKit 6037 push.apply( ret, elems.get() ); 6038 } 6039 6040 return this.pushStack( ret ); 6041 }; 6042} ); 6043var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); 6044 6045var getStyles = function( elem ) { 6046 6047 // Support: IE <=11 only, Firefox <=30 (#15098, #14150) 6048 // IE throws on elements created in popups 6049 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 6050 var view = elem.ownerDocument.defaultView; 6051 6052 if ( !view || !view.opener ) { 6053 view = window; 6054 } 6055 6056 return view.getComputedStyle( elem ); 6057 }; 6058 6059var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); 6060 6061 6062 6063( function() { 6064 6065 // Executing both pixelPosition & boxSizingReliable tests require only one layout 6066 // so they're executed at the same time to save the second computation. 6067 function computeStyleTests() { 6068 6069 // This is a singleton, we need to execute it only once 6070 if ( !div ) { 6071 return; 6072 } 6073 6074 container.style.cssText = "position:absolute;left:-11111px;width:60px;" + 6075 "margin-top:1px;padding:0;border:0"; 6076 div.style.cssText = 6077 "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + 6078 "margin:auto;border:1px;padding:1px;" + 6079 "width:60%;top:1%"; 6080 documentElement.appendChild( container ).appendChild( div ); 6081 6082 var divStyle = window.getComputedStyle( div ); 6083 pixelPositionVal = divStyle.top !== "1%"; 6084 6085 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 6086 reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; 6087 6088 // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 6089 // Some styles come back with percentage values, even though they shouldn't 6090 div.style.right = "60%"; 6091 pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; 6092 6093 // Support: IE 9 - 11 only 6094 // Detect misreporting of content dimensions for box-sizing:border-box elements 6095 boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; 6096 6097 // Support: IE 9 only 6098 // Detect overflow:scroll screwiness (gh-3699) 6099 div.style.position = "absolute"; 6100 scrollboxSizeVal = div.offsetWidth === 36 || "absolute"; 6101 6102 documentElement.removeChild( container ); 6103 6104 // Nullify the div so it wouldn't be stored in the memory and 6105 // it will also be a sign that checks already performed 6106 div = null; 6107 } 6108 6109 function roundPixelMeasures( measure ) { 6110 return Math.round( parseFloat( measure ) ); 6111 } 6112 6113 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, 6114 reliableMarginLeftVal, 6115 container = document.createElement( "div" ), 6116 div = document.createElement( "div" ); 6117 6118 // Finish early in limited (non-browser) environments 6119 if ( !div.style ) { 6120 return; 6121 } 6122 6123 // Support: IE <=9 - 11 only 6124 // Style of cloned element affects source element cloned (#8908) 6125 div.style.backgroundClip = "content-box"; 6126 div.cloneNode( true ).style.backgroundClip = ""; 6127 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 6128 6129 jQuery.extend( support, { 6130 boxSizingReliable: function() { 6131 computeStyleTests(); 6132 return boxSizingReliableVal; 6133 }, 6134 pixelBoxStyles: function() { 6135 computeStyleTests(); 6136 return pixelBoxStylesVal; 6137 }, 6138 pixelPosition: function() { 6139 computeStyleTests(); 6140 return pixelPositionVal; 6141 }, 6142 reliableMarginLeft: function() { 6143 computeStyleTests(); 6144 return reliableMarginLeftVal; 6145 }, 6146 scrollboxSize: function() { 6147 computeStyleTests(); 6148 return scrollboxSizeVal; 6149 } 6150 } ); 6151} )(); 6152 6153 6154function curCSS( elem, name, computed ) { 6155 var width, minWidth, maxWidth, ret, 6156 6157 // Support: Firefox 51+ 6158 // Retrieving style before computed somehow 6159 // fixes an issue with getting wrong values 6160 // on detached elements 6161 style = elem.style; 6162 6163 computed = computed || getStyles( elem ); 6164 6165 // getPropertyValue is needed for: 6166 // .css('filter') (IE 9 only, #12537) 6167 // .css('--customProperty) (#3144) 6168 if ( computed ) { 6169 ret = computed.getPropertyValue( name ) || computed[ name ]; 6170 6171 if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { 6172 ret = jQuery.style( elem, name ); 6173 } 6174 6175 // A tribute to the "awesome hack by Dean Edwards" 6176 // Android Browser returns percentage for some values, 6177 // but width seems to be reliably pixels. 6178 // This is against the CSSOM draft spec: 6179 // https://drafts.csswg.org/cssom/#resolved-values 6180 if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { 6181 6182 // Remember the original values 6183 width = style.width; 6184 minWidth = style.minWidth; 6185 maxWidth = style.maxWidth; 6186 6187 // Put in the new values to get a computed value out 6188 style.minWidth = style.maxWidth = style.width = ret; 6189 ret = computed.width; 6190 6191 // Revert the changed values 6192 style.width = width; 6193 style.minWidth = minWidth; 6194 style.maxWidth = maxWidth; 6195 } 6196 } 6197 6198 return ret !== undefined ? 6199 6200 // Support: IE <=9 - 11 only 6201 // IE returns zIndex value as an integer. 6202 ret + "" : 6203 ret; 6204} 6205 6206 6207function addGetHookIf( conditionFn, hookFn ) { 6208 6209 // Define the hook, we'll check on the first run if it's really needed. 6210 return { 6211 get: function() { 6212 if ( conditionFn() ) { 6213 6214 // Hook not needed (or it's not possible to use it due 6215 // to missing dependency), remove it. 6216 delete this.get; 6217 return; 6218 } 6219 6220 // Hook needed; redefine it so that the support test is not executed again. 6221 return ( this.get = hookFn ).apply( this, arguments ); 6222 } 6223 }; 6224} 6225 6226 6227var 6228 6229 // Swappable if display is none or starts with table 6230 // except "table", "table-cell", or "table-caption" 6231 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display 6232 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 6233 rcustomProp = /^--/, 6234 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 6235 cssNormalTransform = { 6236 letterSpacing: "0", 6237 fontWeight: "400" 6238 }, 6239 6240 cssPrefixes = [ "Webkit", "Moz", "ms" ], 6241 emptyStyle = document.createElement( "div" ).style; 6242 6243// Return a css property mapped to a potentially vendor prefixed property 6244function vendorPropName( name ) { 6245 6246 // Shortcut for names that are not vendor prefixed 6247 if ( name in emptyStyle ) { 6248 return name; 6249 } 6250 6251 // Check for vendor prefixed names 6252 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), 6253 i = cssPrefixes.length; 6254 6255 while ( i-- ) { 6256 name = cssPrefixes[ i ] + capName; 6257 if ( name in emptyStyle ) { 6258 return name; 6259 } 6260 } 6261} 6262 6263// Return a property mapped along what jQuery.cssProps suggests or to 6264// a vendor prefixed property. 6265function finalPropName( name ) { 6266 var ret = jQuery.cssProps[ name ]; 6267 if ( !ret ) { 6268 ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name; 6269 } 6270 return ret; 6271} 6272 6273function setPositiveNumber( elem, value, subtract ) { 6274 6275 // Any relative (+/-) values have already been 6276 // normalized at this point 6277 var matches = rcssNum.exec( value ); 6278 return matches ? 6279 6280 // Guard against undefined "subtract", e.g., when used as in cssHooks 6281 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : 6282 value; 6283} 6284 6285function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { 6286 var i = dimension === "width" ? 1 : 0, 6287 extra = 0, 6288 delta = 0; 6289 6290 // Adjustment may not be necessary 6291 if ( box === ( isBorderBox ? "border" : "content" ) ) { 6292 return 0; 6293 } 6294 6295 for ( ; i < 4; i += 2 ) { 6296 6297 // Both box models exclude margin 6298 if ( box === "margin" ) { 6299 delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); 6300 } 6301 6302 // If we get here with a content-box, we're seeking "padding" or "border" or "margin" 6303 if ( !isBorderBox ) { 6304 6305 // Add padding 6306 delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 6307 6308 // For "border" or "margin", add border 6309 if ( box !== "padding" ) { 6310 delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6311 6312 // But still keep track of it otherwise 6313 } else { 6314 extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6315 } 6316 6317 // If we get here with a border-box (content + padding + border), we're seeking "content" or 6318 // "padding" or "margin" 6319 } else { 6320 6321 // For "content", subtract padding 6322 if ( box === "content" ) { 6323 delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 6324 } 6325 6326 // For "content" or "padding", subtract border 6327 if ( box !== "margin" ) { 6328 delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6329 } 6330 } 6331 } 6332 6333 // Account for positive content-box scroll gutter when requested by providing computedVal 6334 if ( !isBorderBox && computedVal >= 0 ) { 6335 6336 // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border 6337 // Assuming integer scroll gutter, subtract the rest and round down 6338 delta += Math.max( 0, Math.ceil( 6339 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 6340 computedVal - 6341 delta - 6342 extra - 6343 0.5 6344 ) ); 6345 } 6346 6347 return delta; 6348} 6349 6350function getWidthOrHeight( elem, dimension, extra ) { 6351 6352 // Start with computed style 6353 var styles = getStyles( elem ), 6354 val = curCSS( elem, dimension, styles ), 6355 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 6356 valueIsBorderBox = isBorderBox; 6357 6358 // Support: Firefox <=54 6359 // Return a confounding non-pixel value or feign ignorance, as appropriate. 6360 if ( rnumnonpx.test( val ) ) { 6361 if ( !extra ) { 6362 return val; 6363 } 6364 val = "auto"; 6365 } 6366 6367 // Check for style in case a browser which returns unreliable values 6368 // for getComputedStyle silently falls back to the reliable elem.style 6369 valueIsBorderBox = valueIsBorderBox && 6370 ( support.boxSizingReliable() || val === elem.style[ dimension ] ); 6371 6372 // Fall back to offsetWidth/offsetHeight when value is "auto" 6373 // This happens for inline elements with no explicit setting (gh-3571) 6374 // Support: Android <=4.1 - 4.3 only 6375 // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) 6376 if ( val === "auto" || 6377 !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) { 6378 6379 val = elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ]; 6380 6381 // offsetWidth/offsetHeight provide border-box values 6382 valueIsBorderBox = true; 6383 } 6384 6385 // Normalize "" and auto 6386 val = parseFloat( val ) || 0; 6387 6388 // Adjust for the element's box model 6389 return ( val + 6390 boxModelAdjustment( 6391 elem, 6392 dimension, 6393 extra || ( isBorderBox ? "border" : "content" ), 6394 valueIsBorderBox, 6395 styles, 6396 6397 // Provide the current computed size to request scroll gutter calculation (gh-3589) 6398 val 6399 ) 6400 ) + "px"; 6401} 6402 6403jQuery.extend( { 6404 6405 // Add in style property hooks for overriding the default 6406 // behavior of getting and setting a style property 6407 cssHooks: { 6408 opacity: { 6409 get: function( elem, computed ) { 6410 if ( computed ) { 6411 6412 // We should always get a number back from opacity 6413 var ret = curCSS( elem, "opacity" ); 6414 return ret === "" ? "1" : ret; 6415 } 6416 } 6417 } 6418 }, 6419 6420 // Don't automatically add "px" to these possibly-unitless properties 6421 cssNumber: { 6422 "animationIterationCount": true, 6423 "columnCount": true, 6424 "fillOpacity": true, 6425 "flexGrow": true, 6426 "flexShrink": true, 6427 "fontWeight": true, 6428 "lineHeight": true, 6429 "opacity": true, 6430 "order": true, 6431 "orphans": true, 6432 "widows": true, 6433 "zIndex": true, 6434 "zoom": true 6435 }, 6436 6437 // Add in properties whose names you wish to fix before 6438 // setting or getting the value 6439 cssProps: {}, 6440 6441 // Get and set the style property on a DOM Node 6442 style: function( elem, name, value, extra ) { 6443 6444 // Don't set styles on text and comment nodes 6445 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 6446 return; 6447 } 6448 6449 // Make sure that we're working with the right name 6450 var ret, type, hooks, 6451 origName = camelCase( name ), 6452 isCustomProp = rcustomProp.test( name ), 6453 style = elem.style; 6454 6455 // Make sure that we're working with the right name. We don't 6456 // want to query the value if it is a CSS custom property 6457 // since they are user-defined. 6458 if ( !isCustomProp ) { 6459 name = finalPropName( origName ); 6460 } 6461 6462 // Gets hook for the prefixed version, then unprefixed version 6463 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 6464 6465 // Check if we're setting a value 6466 if ( value !== undefined ) { 6467 type = typeof value; 6468 6469 // Convert "+=" or "-=" to relative numbers (#7345) 6470 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { 6471 value = adjustCSS( elem, name, ret ); 6472 6473 // Fixes bug #9237 6474 type = "number"; 6475 } 6476 6477 // Make sure that null and NaN values aren't set (#7116) 6478 if ( value == null || value !== value ) { 6479 return; 6480 } 6481 6482 // If a number was passed in, add the unit (except for certain CSS properties) 6483 if ( type === "number" ) { 6484 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); 6485 } 6486 6487 // background-* props affect original clone's values 6488 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { 6489 style[ name ] = "inherit"; 6490 } 6491 6492 // If a hook was provided, use that value, otherwise just set the specified value 6493 if ( !hooks || !( "set" in hooks ) || 6494 ( value = hooks.set( elem, value, extra ) ) !== undefined ) { 6495 6496 if ( isCustomProp ) { 6497 style.setProperty( name, value ); 6498 } else { 6499 style[ name ] = value; 6500 } 6501 } 6502 6503 } else { 6504 6505 // If a hook was provided get the non-computed value from there 6506 if ( hooks && "get" in hooks && 6507 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { 6508 6509 return ret; 6510 } 6511 6512 // Otherwise just get the value from the style object 6513 return style[ name ]; 6514 } 6515 }, 6516 6517 css: function( elem, name, extra, styles ) { 6518 var val, num, hooks, 6519 origName = camelCase( name ), 6520 isCustomProp = rcustomProp.test( name ); 6521 6522 // Make sure that we're working with the right name. We don't 6523 // want to modify the value if it is a CSS custom property 6524 // since they are user-defined. 6525 if ( !isCustomProp ) { 6526 name = finalPropName( origName ); 6527 } 6528 6529 // Try prefixed name followed by the unprefixed name 6530 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 6531 6532 // If a hook was provided get the computed value from there 6533 if ( hooks && "get" in hooks ) { 6534 val = hooks.get( elem, true, extra ); 6535 } 6536 6537 // Otherwise, if a way to get the computed value exists, use that 6538 if ( val === undefined ) { 6539 val = curCSS( elem, name, styles ); 6540 } 6541 6542 // Convert "normal" to computed value 6543 if ( val === "normal" && name in cssNormalTransform ) { 6544 val = cssNormalTransform[ name ]; 6545 } 6546 6547 // Make numeric if forced or a qualifier was provided and val looks numeric 6548 if ( extra === "" || extra ) { 6549 num = parseFloat( val ); 6550 return extra === true || isFinite( num ) ? num || 0 : val; 6551 } 6552 6553 return val; 6554 } 6555} ); 6556 6557jQuery.each( [ "height", "width" ], function( i, dimension ) { 6558 jQuery.cssHooks[ dimension ] = { 6559 get: function( elem, computed, extra ) { 6560 if ( computed ) { 6561 6562 // Certain elements can have dimension info if we invisibly show them 6563 // but it must have a current display style that would benefit 6564 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && 6565 6566 // Support: Safari 8+ 6567 // Table columns in Safari have non-zero offsetWidth & zero 6568 // getBoundingClientRect().width unless display is changed. 6569 // Support: IE <=11 only 6570 // Running getBoundingClientRect on a disconnected node 6571 // in IE throws an error. 6572 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? 6573 swap( elem, cssShow, function() { 6574 return getWidthOrHeight( elem, dimension, extra ); 6575 } ) : 6576 getWidthOrHeight( elem, dimension, extra ); 6577 } 6578 }, 6579 6580 set: function( elem, value, extra ) { 6581 var matches, 6582 styles = getStyles( elem ), 6583 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 6584 subtract = extra && boxModelAdjustment( 6585 elem, 6586 dimension, 6587 extra, 6588 isBorderBox, 6589 styles 6590 ); 6591 6592 // Account for unreliable border-box dimensions by comparing offset* to computed and 6593 // faking a content-box to get border and padding (gh-3699) 6594 if ( isBorderBox && support.scrollboxSize() === styles.position ) { 6595 subtract -= Math.ceil( 6596 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 6597 parseFloat( styles[ dimension ] ) - 6598 boxModelAdjustment( elem, dimension, "border", false, styles ) - 6599 0.5 6600 ); 6601 } 6602 6603 // Convert to pixels if value adjustment is needed 6604 if ( subtract && ( matches = rcssNum.exec( value ) ) && 6605 ( matches[ 3 ] || "px" ) !== "px" ) { 6606 6607 elem.style[ dimension ] = value; 6608 value = jQuery.css( elem, dimension ); 6609 } 6610 6611 return setPositiveNumber( elem, value, subtract ); 6612 } 6613 }; 6614} ); 6615 6616jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, 6617 function( elem, computed ) { 6618 if ( computed ) { 6619 return ( parseFloat( curCSS( elem, "marginLeft" ) ) || 6620 elem.getBoundingClientRect().left - 6621 swap( elem, { marginLeft: 0 }, function() { 6622 return elem.getBoundingClientRect().left; 6623 } ) 6624 ) + "px"; 6625 } 6626 } 6627); 6628 6629// These hooks are used by animate to expand properties 6630jQuery.each( { 6631 margin: "", 6632 padding: "", 6633 border: "Width" 6634}, function( prefix, suffix ) { 6635 jQuery.cssHooks[ prefix + suffix ] = { 6636 expand: function( value ) { 6637 var i = 0, 6638 expanded = {}, 6639 6640 // Assumes a single number if not a string 6641 parts = typeof value === "string" ? value.split( " " ) : [ value ]; 6642 6643 for ( ; i < 4; i++ ) { 6644 expanded[ prefix + cssExpand[ i ] + suffix ] = 6645 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; 6646 } 6647 6648 return expanded; 6649 } 6650 }; 6651 6652 if ( prefix !== "margin" ) { 6653 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; 6654 } 6655} ); 6656 6657jQuery.fn.extend( { 6658 css: function( name, value ) { 6659 return access( this, function( elem, name, value ) { 6660 var styles, len, 6661 map = {}, 6662 i = 0; 6663 6664 if ( Array.isArray( name ) ) { 6665 styles = getStyles( elem ); 6666 len = name.length; 6667 6668 for ( ; i < len; i++ ) { 6669 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); 6670 } 6671 6672 return map; 6673 } 6674 6675 return value !== undefined ? 6676 jQuery.style( elem, name, value ) : 6677 jQuery.css( elem, name ); 6678 }, name, value, arguments.length > 1 ); 6679 } 6680} ); 6681 6682 6683function Tween( elem, options, prop, end, easing ) { 6684 return new Tween.prototype.init( elem, options, prop, end, easing ); 6685} 6686jQuery.Tween = Tween; 6687 6688Tween.prototype = { 6689 constructor: Tween, 6690 init: function( elem, options, prop, end, easing, unit ) { 6691 this.elem = elem; 6692 this.prop = prop; 6693 this.easing = easing || jQuery.easing._default; 6694 this.options = options; 6695 this.start = this.now = this.cur(); 6696 this.end = end; 6697 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); 6698 }, 6699 cur: function() { 6700 var hooks = Tween.propHooks[ this.prop ]; 6701 6702 return hooks && hooks.get ? 6703 hooks.get( this ) : 6704 Tween.propHooks._default.get( this ); 6705 }, 6706 run: function( percent ) { 6707 var eased, 6708 hooks = Tween.propHooks[ this.prop ]; 6709 6710 if ( this.options.duration ) { 6711 this.pos = eased = jQuery.easing[ this.easing ]( 6712 percent, this.options.duration * percent, 0, 1, this.options.duration 6713 ); 6714 } else { 6715 this.pos = eased = percent; 6716 } 6717 this.now = ( this.end - this.start ) * eased + this.start; 6718 6719 if ( this.options.step ) { 6720 this.options.step.call( this.elem, this.now, this ); 6721 } 6722 6723 if ( hooks && hooks.set ) { 6724 hooks.set( this ); 6725 } else { 6726 Tween.propHooks._default.set( this ); 6727 } 6728 return this; 6729 } 6730}; 6731 6732Tween.prototype.init.prototype = Tween.prototype; 6733 6734Tween.propHooks = { 6735 _default: { 6736 get: function( tween ) { 6737 var result; 6738 6739 // Use a property on the element directly when it is not a DOM element, 6740 // or when there is no matching style property that exists. 6741 if ( tween.elem.nodeType !== 1 || 6742 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { 6743 return tween.elem[ tween.prop ]; 6744 } 6745 6746 // Passing an empty string as a 3rd parameter to .css will automatically 6747 // attempt a parseFloat and fallback to a string if the parse fails. 6748 // Simple values such as "10px" are parsed to Float; 6749 // complex values such as "rotate(1rad)" are returned as-is. 6750 result = jQuery.css( tween.elem, tween.prop, "" ); 6751 6752 // Empty strings, null, undefined and "auto" are converted to 0. 6753 return !result || result === "auto" ? 0 : result; 6754 }, 6755 set: function( tween ) { 6756 6757 // Use step hook for back compat. 6758 // Use cssHook if its there. 6759 // Use .style if available and use plain properties where available. 6760 if ( jQuery.fx.step[ tween.prop ] ) { 6761 jQuery.fx.step[ tween.prop ]( tween ); 6762 } else if ( tween.elem.nodeType === 1 && 6763 ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || 6764 jQuery.cssHooks[ tween.prop ] ) ) { 6765 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); 6766 } else { 6767 tween.elem[ tween.prop ] = tween.now; 6768 } 6769 } 6770 } 6771}; 6772 6773// Support: IE <=9 only 6774// Panic based approach to setting things on disconnected nodes 6775Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 6776 set: function( tween ) { 6777 if ( tween.elem.nodeType && tween.elem.parentNode ) { 6778 tween.elem[ tween.prop ] = tween.now; 6779 } 6780 } 6781}; 6782 6783jQuery.easing = { 6784 linear: function( p ) { 6785 return p; 6786 }, 6787 swing: function( p ) { 6788 return 0.5 - Math.cos( p * Math.PI ) / 2; 6789 }, 6790 _default: "swing" 6791}; 6792 6793jQuery.fx = Tween.prototype.init; 6794 6795// Back compat <1.8 extension point 6796jQuery.fx.step = {}; 6797 6798 6799 6800 6801var 6802 fxNow, inProgress, 6803 rfxtypes = /^(?:toggle|show|hide)$/, 6804 rrun = /queueHooks$/; 6805 6806function schedule() { 6807 if ( inProgress ) { 6808 if ( document.hidden === false && window.requestAnimationFrame ) { 6809 window.requestAnimationFrame( schedule ); 6810 } else { 6811 window.setTimeout( schedule, jQuery.fx.interval ); 6812 } 6813 6814 jQuery.fx.tick(); 6815 } 6816} 6817 6818// Animations created synchronously will run synchronously 6819function createFxNow() { 6820 window.setTimeout( function() { 6821 fxNow = undefined; 6822 } ); 6823 return ( fxNow = Date.now() ); 6824} 6825 6826// Generate parameters to create a standard animation 6827function genFx( type, includeWidth ) { 6828 var which, 6829 i = 0, 6830 attrs = { height: type }; 6831 6832 // If we include width, step value is 1 to do all cssExpand values, 6833 // otherwise step value is 2 to skip over Left and Right 6834 includeWidth = includeWidth ? 1 : 0; 6835 for ( ; i < 4; i += 2 - includeWidth ) { 6836 which = cssExpand[ i ]; 6837 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; 6838 } 6839 6840 if ( includeWidth ) { 6841 attrs.opacity = attrs.width = type; 6842 } 6843 6844 return attrs; 6845} 6846 6847function createTween( value, prop, animation ) { 6848 var tween, 6849 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), 6850 index = 0, 6851 length = collection.length; 6852 for ( ; index < length; index++ ) { 6853 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { 6854 6855 // We're done with this property 6856 return tween; 6857 } 6858 } 6859} 6860 6861function defaultPrefilter( elem, props, opts ) { 6862 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, 6863 isBox = "width" in props || "height" in props, 6864 anim = this, 6865 orig = {}, 6866 style = elem.style, 6867 hidden = elem.nodeType && isHiddenWithinTree( elem ), 6868 dataShow = dataPriv.get( elem, "fxshow" ); 6869 6870 // Queue-skipping animations hijack the fx hooks 6871 if ( !opts.queue ) { 6872 hooks = jQuery._queueHooks( elem, "fx" ); 6873 if ( hooks.unqueued == null ) { 6874 hooks.unqueued = 0; 6875 oldfire = hooks.empty.fire; 6876 hooks.empty.fire = function() { 6877 if ( !hooks.unqueued ) { 6878 oldfire(); 6879 } 6880 }; 6881 } 6882 hooks.unqueued++; 6883 6884 anim.always( function() { 6885 6886 // Ensure the complete handler is called before this completes 6887 anim.always( function() { 6888 hooks.unqueued--; 6889 if ( !jQuery.queue( elem, "fx" ).length ) { 6890 hooks.empty.fire(); 6891 } 6892 } ); 6893 } ); 6894 } 6895 6896 // Detect show/hide animations 6897 for ( prop in props ) { 6898 value = props[ prop ]; 6899 if ( rfxtypes.test( value ) ) { 6900 delete props[ prop ]; 6901 toggle = toggle || value === "toggle"; 6902 if ( value === ( hidden ? "hide" : "show" ) ) { 6903 6904 // Pretend to be hidden if this is a "show" and 6905 // there is still data from a stopped show/hide 6906 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { 6907 hidden = true; 6908 6909 // Ignore all other no-op show/hide data 6910 } else { 6911 continue; 6912 } 6913 } 6914 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); 6915 } 6916 } 6917 6918 // Bail out if this is a no-op like .hide().hide() 6919 propTween = !jQuery.isEmptyObject( props ); 6920 if ( !propTween && jQuery.isEmptyObject( orig ) ) { 6921 return; 6922 } 6923 6924 // Restrict "overflow" and "display" styles during box animations 6925 if ( isBox && elem.nodeType === 1 ) { 6926 6927 // Support: IE <=9 - 11, Edge 12 - 15 6928 // Record all 3 overflow attributes because IE does not infer the shorthand 6929 // from identically-valued overflowX and overflowY and Edge just mirrors 6930 // the overflowX value there. 6931 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; 6932 6933 // Identify a display type, preferring old show/hide data over the CSS cascade 6934 restoreDisplay = dataShow && dataShow.display; 6935 if ( restoreDisplay == null ) { 6936 restoreDisplay = dataPriv.get( elem, "display" ); 6937 } 6938 display = jQuery.css( elem, "display" ); 6939 if ( display === "none" ) { 6940 if ( restoreDisplay ) { 6941 display = restoreDisplay; 6942 } else { 6943 6944 // Get nonempty value(s) by temporarily forcing visibility 6945 showHide( [ elem ], true ); 6946 restoreDisplay = elem.style.display || restoreDisplay; 6947 display = jQuery.css( elem, "display" ); 6948 showHide( [ elem ] ); 6949 } 6950 } 6951 6952 // Animate inline elements as inline-block 6953 if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { 6954 if ( jQuery.css( elem, "float" ) === "none" ) { 6955 6956 // Restore the original display value at the end of pure show/hide animations 6957 if ( !propTween ) { 6958 anim.done( function() { 6959 style.display = restoreDisplay; 6960 } ); 6961 if ( restoreDisplay == null ) { 6962 display = style.display; 6963 restoreDisplay = display === "none" ? "" : display; 6964 } 6965 } 6966 style.display = "inline-block"; 6967 } 6968 } 6969 } 6970 6971 if ( opts.overflow ) { 6972 style.overflow = "hidden"; 6973 anim.always( function() { 6974 style.overflow = opts.overflow[ 0 ]; 6975 style.overflowX = opts.overflow[ 1 ]; 6976 style.overflowY = opts.overflow[ 2 ]; 6977 } ); 6978 } 6979 6980 // Implement show/hide animations 6981 propTween = false; 6982 for ( prop in orig ) { 6983 6984 // General show/hide setup for this element animation 6985 if ( !propTween ) { 6986 if ( dataShow ) { 6987 if ( "hidden" in dataShow ) { 6988 hidden = dataShow.hidden; 6989 } 6990 } else { 6991 dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); 6992 } 6993 6994 // Store hidden/visible for toggle so `.stop().toggle()` "reverses" 6995 if ( toggle ) { 6996 dataShow.hidden = !hidden; 6997 } 6998 6999 // Show elements before animating them 7000 if ( hidden ) { 7001 showHide( [ elem ], true ); 7002 } 7003 7004 /* eslint-disable no-loop-func */ 7005 7006 anim.done( function() { 7007 7008 /* eslint-enable no-loop-func */ 7009 7010 // The final step of a "hide" animation is actually hiding the element 7011 if ( !hidden ) { 7012 showHide( [ elem ] ); 7013 } 7014 dataPriv.remove( elem, "fxshow" ); 7015 for ( prop in orig ) { 7016 jQuery.style( elem, prop, orig[ prop ] ); 7017 } 7018 } ); 7019 } 7020 7021 // Per-property setup 7022 propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); 7023 if ( !( prop in dataShow ) ) { 7024 dataShow[ prop ] = propTween.start; 7025 if ( hidden ) { 7026 propTween.end = propTween.start; 7027 propTween.start = 0; 7028 } 7029 } 7030 } 7031} 7032 7033function propFilter( props, specialEasing ) { 7034 var index, name, easing, value, hooks; 7035 7036 // camelCase, specialEasing and expand cssHook pass 7037 for ( index in props ) { 7038 name = camelCase( index ); 7039 easing = specialEasing[ name ]; 7040 value = props[ index ]; 7041 if ( Array.isArray( value ) ) { 7042 easing = value[ 1 ]; 7043 value = props[ index ] = value[ 0 ]; 7044 } 7045 7046 if ( index !== name ) { 7047 props[ name ] = value; 7048 delete props[ index ]; 7049 } 7050 7051 hooks = jQuery.cssHooks[ name ]; 7052 if ( hooks && "expand" in hooks ) { 7053 value = hooks.expand( value ); 7054 delete props[ name ]; 7055 7056 // Not quite $.extend, this won't overwrite existing keys. 7057 // Reusing 'index' because we have the correct "name" 7058 for ( index in value ) { 7059 if ( !( index in props ) ) { 7060 props[ index ] = value[ index ]; 7061 specialEasing[ index ] = easing; 7062 } 7063 } 7064 } else { 7065 specialEasing[ name ] = easing; 7066 } 7067 } 7068} 7069 7070function Animation( elem, properties, options ) { 7071 var result, 7072 stopped, 7073 index = 0, 7074 length = Animation.prefilters.length, 7075 deferred = jQuery.Deferred().always( function() { 7076 7077 // Don't match elem in the :animated selector 7078 delete tick.elem; 7079 } ), 7080 tick = function() { 7081 if ( stopped ) { 7082 return false; 7083 } 7084 var currentTime = fxNow || createFxNow(), 7085 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), 7086 7087 // Support: Android 2.3 only 7088 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) 7089 temp = remaining / animation.duration || 0, 7090 percent = 1 - temp, 7091 index = 0, 7092 length = animation.tweens.length; 7093 7094 for ( ; index < length; index++ ) { 7095 animation.tweens[ index ].run( percent ); 7096 } 7097 7098 deferred.notifyWith( elem, [ animation, percent, remaining ] ); 7099 7100 // If there's more to do, yield 7101 if ( percent < 1 && length ) { 7102 return remaining; 7103 } 7104 7105 // If this was an empty animation, synthesize a final progress notification 7106 if ( !length ) { 7107 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 7108 } 7109 7110 // Resolve the animation and report its conclusion 7111 deferred.resolveWith( elem, [ animation ] ); 7112 return false; 7113 }, 7114 animation = deferred.promise( { 7115 elem: elem, 7116 props: jQuery.extend( {}, properties ), 7117 opts: jQuery.extend( true, { 7118 specialEasing: {}, 7119 easing: jQuery.easing._default 7120 }, options ), 7121 originalProperties: properties, 7122 originalOptions: options, 7123 startTime: fxNow || createFxNow(), 7124 duration: options.duration, 7125 tweens: [], 7126 createTween: function( prop, end ) { 7127 var tween = jQuery.Tween( elem, animation.opts, prop, end, 7128 animation.opts.specialEasing[ prop ] || animation.opts.easing ); 7129 animation.tweens.push( tween ); 7130 return tween; 7131 }, 7132 stop: function( gotoEnd ) { 7133 var index = 0, 7134 7135 // If we are going to the end, we want to run all the tweens 7136 // otherwise we skip this part 7137 length = gotoEnd ? animation.tweens.length : 0; 7138 if ( stopped ) { 7139 return this; 7140 } 7141 stopped = true; 7142 for ( ; index < length; index++ ) { 7143 animation.tweens[ index ].run( 1 ); 7144 } 7145 7146 // Resolve when we played the last frame; otherwise, reject 7147 if ( gotoEnd ) { 7148 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 7149 deferred.resolveWith( elem, [ animation, gotoEnd ] ); 7150 } else { 7151 deferred.rejectWith( elem, [ animation, gotoEnd ] ); 7152 } 7153 return this; 7154 } 7155 } ), 7156 props = animation.props; 7157 7158 propFilter( props, animation.opts.specialEasing ); 7159 7160 for ( ; index < length; index++ ) { 7161 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); 7162 if ( result ) { 7163 if ( isFunction( result.stop ) ) { 7164 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = 7165 result.stop.bind( result ); 7166 } 7167 return result; 7168 } 7169 } 7170 7171 jQuery.map( props, createTween, animation ); 7172 7173 if ( isFunction( animation.opts.start ) ) { 7174 animation.opts.start.call( elem, animation ); 7175 } 7176 7177 // Attach callbacks from options 7178 animation 7179 .progress( animation.opts.progress ) 7180 .done( animation.opts.done, animation.opts.complete ) 7181 .fail( animation.opts.fail ) 7182 .always( animation.opts.always ); 7183 7184 jQuery.fx.timer( 7185 jQuery.extend( tick, { 7186 elem: elem, 7187 anim: animation, 7188 queue: animation.opts.queue 7189 } ) 7190 ); 7191 7192 return animation; 7193} 7194 7195jQuery.Animation = jQuery.extend( Animation, { 7196 7197 tweeners: { 7198 "*": [ function( prop, value ) { 7199 var tween = this.createTween( prop, value ); 7200 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); 7201 return tween; 7202 } ] 7203 }, 7204 7205 tweener: function( props, callback ) { 7206 if ( isFunction( props ) ) { 7207 callback = props; 7208 props = [ "*" ]; 7209 } else { 7210 props = props.match( rnothtmlwhite ); 7211 } 7212 7213 var prop, 7214 index = 0, 7215 length = props.length; 7216 7217 for ( ; index < length; index++ ) { 7218 prop = props[ index ]; 7219 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; 7220 Animation.tweeners[ prop ].unshift( callback ); 7221 } 7222 }, 7223 7224 prefilters: [ defaultPrefilter ], 7225 7226 prefilter: function( callback, prepend ) { 7227 if ( prepend ) { 7228 Animation.prefilters.unshift( callback ); 7229 } else { 7230 Animation.prefilters.push( callback ); 7231 } 7232 } 7233} ); 7234 7235jQuery.speed = function( speed, easing, fn ) { 7236 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { 7237 complete: fn || !fn && easing || 7238 isFunction( speed ) && speed, 7239 duration: speed, 7240 easing: fn && easing || easing && !isFunction( easing ) && easing 7241 }; 7242 7243 // Go to the end state if fx are off 7244 if ( jQuery.fx.off ) { 7245 opt.duration = 0; 7246 7247 } else { 7248 if ( typeof opt.duration !== "number" ) { 7249 if ( opt.duration in jQuery.fx.speeds ) { 7250 opt.duration = jQuery.fx.speeds[ opt.duration ]; 7251 7252 } else { 7253 opt.duration = jQuery.fx.speeds._default; 7254 } 7255 } 7256 } 7257 7258 // Normalize opt.queue - true/undefined/null -> "fx" 7259 if ( opt.queue == null || opt.queue === true ) { 7260 opt.queue = "fx"; 7261 } 7262 7263 // Queueing 7264 opt.old = opt.complete; 7265 7266 opt.complete = function() { 7267 if ( isFunction( opt.old ) ) { 7268 opt.old.call( this ); 7269 } 7270 7271 if ( opt.queue ) { 7272 jQuery.dequeue( this, opt.queue ); 7273 } 7274 }; 7275 7276 return opt; 7277}; 7278 7279jQuery.fn.extend( { 7280 fadeTo: function( speed, to, easing, callback ) { 7281 7282 // Show any hidden elements after setting opacity to 0 7283 return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() 7284 7285 // Animate to the value specified 7286 .end().animate( { opacity: to }, speed, easing, callback ); 7287 }, 7288 animate: function( prop, speed, easing, callback ) { 7289 var empty = jQuery.isEmptyObject( prop ), 7290 optall = jQuery.speed( speed, easing, callback ), 7291 doAnimation = function() { 7292 7293 // Operate on a copy of prop so per-property easing won't be lost 7294 var anim = Animation( this, jQuery.extend( {}, prop ), optall ); 7295 7296 // Empty animations, or finishing resolves immediately 7297 if ( empty || dataPriv.get( this, "finish" ) ) { 7298 anim.stop( true ); 7299 } 7300 }; 7301 doAnimation.finish = doAnimation; 7302 7303 return empty || optall.queue === false ? 7304 this.each( doAnimation ) : 7305 this.queue( optall.queue, doAnimation ); 7306 }, 7307 stop: function( type, clearQueue, gotoEnd ) { 7308 var stopQueue = function( hooks ) { 7309 var stop = hooks.stop; 7310 delete hooks.stop; 7311 stop( gotoEnd ); 7312 }; 7313 7314 if ( typeof type !== "string" ) { 7315 gotoEnd = clearQueue; 7316 clearQueue = type; 7317 type = undefined; 7318 } 7319 if ( clearQueue && type !== false ) { 7320 this.queue( type || "fx", [] ); 7321 } 7322 7323 return this.each( function() { 7324 var dequeue = true, 7325 index = type != null && type + "queueHooks", 7326 timers = jQuery.timers, 7327 data = dataPriv.get( this ); 7328 7329 if ( index ) { 7330 if ( data[ index ] && data[ index ].stop ) { 7331 stopQueue( data[ index ] ); 7332 } 7333 } else { 7334 for ( index in data ) { 7335 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { 7336 stopQueue( data[ index ] ); 7337 } 7338 } 7339 } 7340 7341 for ( index = timers.length; index--; ) { 7342 if ( timers[ index ].elem === this && 7343 ( type == null || timers[ index ].queue === type ) ) { 7344 7345 timers[ index ].anim.stop( gotoEnd ); 7346 dequeue = false; 7347 timers.splice( index, 1 ); 7348 } 7349 } 7350 7351 // Start the next in the queue if the last step wasn't forced. 7352 // Timers currently will call their complete callbacks, which 7353 // will dequeue but only if they were gotoEnd. 7354 if ( dequeue || !gotoEnd ) { 7355 jQuery.dequeue( this, type ); 7356 } 7357 } ); 7358 }, 7359 finish: function( type ) { 7360 if ( type !== false ) { 7361 type = type || "fx"; 7362 } 7363 return this.each( function() { 7364 var index, 7365 data = dataPriv.get( this ), 7366 queue = data[ type + "queue" ], 7367 hooks = data[ type + "queueHooks" ], 7368 timers = jQuery.timers, 7369 length = queue ? queue.length : 0; 7370 7371 // Enable finishing flag on private data 7372 data.finish = true; 7373 7374 // Empty the queue first 7375 jQuery.queue( this, type, [] ); 7376 7377 if ( hooks && hooks.stop ) { 7378 hooks.stop.call( this, true ); 7379 } 7380 7381 // Look for any active animations, and finish them 7382 for ( index = timers.length; index--; ) { 7383 if ( timers[ index ].elem === this && timers[ index ].queue === type ) { 7384 timers[ index ].anim.stop( true ); 7385 timers.splice( index, 1 ); 7386 } 7387 } 7388 7389 // Look for any animations in the old queue and finish them 7390 for ( index = 0; index < length; index++ ) { 7391 if ( queue[ index ] && queue[ index ].finish ) { 7392 queue[ index ].finish.call( this ); 7393 } 7394 } 7395 7396 // Turn off finishing flag 7397 delete data.finish; 7398 } ); 7399 } 7400} ); 7401 7402jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) { 7403 var cssFn = jQuery.fn[ name ]; 7404 jQuery.fn[ name ] = function( speed, easing, callback ) { 7405 return speed == null || typeof speed === "boolean" ? 7406 cssFn.apply( this, arguments ) : 7407 this.animate( genFx( name, true ), speed, easing, callback ); 7408 }; 7409} ); 7410 7411// Generate shortcuts for custom animations 7412jQuery.each( { 7413 slideDown: genFx( "show" ), 7414 slideUp: genFx( "hide" ), 7415 slideToggle: genFx( "toggle" ), 7416 fadeIn: { opacity: "show" }, 7417 fadeOut: { opacity: "hide" }, 7418 fadeToggle: { opacity: "toggle" } 7419}, function( name, props ) { 7420 jQuery.fn[ name ] = function( speed, easing, callback ) { 7421 return this.animate( props, speed, easing, callback ); 7422 }; 7423} ); 7424 7425jQuery.timers = []; 7426jQuery.fx.tick = function() { 7427 var timer, 7428 i = 0, 7429 timers = jQuery.timers; 7430 7431 fxNow = Date.now(); 7432 7433 for ( ; i < timers.length; i++ ) { 7434 timer = timers[ i ]; 7435 7436 // Run the timer and safely remove it when done (allowing for external removal) 7437 if ( !timer() && timers[ i ] === timer ) { 7438 timers.splice( i--, 1 ); 7439 } 7440 } 7441 7442 if ( !timers.length ) { 7443 jQuery.fx.stop(); 7444 } 7445 fxNow = undefined; 7446}; 7447 7448jQuery.fx.timer = function( timer ) { 7449 jQuery.timers.push( timer ); 7450 jQuery.fx.start(); 7451}; 7452 7453jQuery.fx.interval = 13; 7454jQuery.fx.start = function() { 7455 if ( inProgress ) { 7456 return; 7457 } 7458 7459 inProgress = true; 7460 schedule(); 7461}; 7462 7463jQuery.fx.stop = function() { 7464 inProgress = null; 7465}; 7466 7467jQuery.fx.speeds = { 7468 slow: 600, 7469 fast: 200, 7470 7471 // Default speed 7472 _default: 400 7473}; 7474 7475 7476// Based off of the plugin by Clint Helfers, with permission. 7477// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ 7478jQuery.fn.delay = function( time, type ) { 7479 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 7480 type = type || "fx"; 7481 7482 return this.queue( type, function( next, hooks ) { 7483 var timeout = window.setTimeout( next, time ); 7484 hooks.stop = function() { 7485 window.clearTimeout( timeout ); 7486 }; 7487 } ); 7488}; 7489 7490 7491( function() { 7492 var input = document.createElement( "input" ), 7493 select = document.createElement( "select" ), 7494 opt = select.appendChild( document.createElement( "option" ) ); 7495 7496 input.type = "checkbox"; 7497 7498 // Support: Android <=4.3 only 7499 // Default value for a checkbox should be "on" 7500 support.checkOn = input.value !== ""; 7501 7502 // Support: IE <=11 only 7503 // Must access selectedIndex to make default options select 7504 support.optSelected = opt.selected; 7505 7506 // Support: IE <=11 only 7507 // An input loses its value after becoming a radio 7508 input = document.createElement( "input" ); 7509 input.value = "t"; 7510 input.type = "radio"; 7511 support.radioValue = input.value === "t"; 7512} )(); 7513 7514 7515var boolHook, 7516 attrHandle = jQuery.expr.attrHandle; 7517 7518jQuery.fn.extend( { 7519 attr: function( name, value ) { 7520 return access( this, jQuery.attr, name, value, arguments.length > 1 ); 7521 }, 7522 7523 removeAttr: function( name ) { 7524 return this.each( function() { 7525 jQuery.removeAttr( this, name ); 7526 } ); 7527 } 7528} ); 7529 7530jQuery.extend( { 7531 attr: function( elem, name, value ) { 7532 var ret, hooks, 7533 nType = elem.nodeType; 7534 7535 // Don't get/set attributes on text, comment and attribute nodes 7536 if ( nType === 3 || nType === 8 || nType === 2 ) { 7537 return; 7538 } 7539 7540 // Fallback to prop when attributes are not supported 7541 if ( typeof elem.getAttribute === "undefined" ) { 7542 return jQuery.prop( elem, name, value ); 7543 } 7544 7545 // Attribute hooks are determined by the lowercase version 7546 // Grab necessary hook if one is defined 7547 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 7548 hooks = jQuery.attrHooks[ name.toLowerCase() ] || 7549 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); 7550 } 7551 7552 if ( value !== undefined ) { 7553 if ( value === null ) { 7554 jQuery.removeAttr( elem, name ); 7555 return; 7556 } 7557 7558 if ( hooks && "set" in hooks && 7559 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 7560 return ret; 7561 } 7562 7563 elem.setAttribute( name, value + "" ); 7564 return value; 7565 } 7566 7567 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 7568 return ret; 7569 } 7570 7571 ret = jQuery.find.attr( elem, name ); 7572 7573 // Non-existent attributes return null, we normalize to undefined 7574 return ret == null ? undefined : ret; 7575 }, 7576 7577 attrHooks: { 7578 type: { 7579 set: function( elem, value ) { 7580 if ( !support.radioValue && value === "radio" && 7581 nodeName( elem, "input" ) ) { 7582 var val = elem.value; 7583 elem.setAttribute( "type", value ); 7584 if ( val ) { 7585 elem.value = val; 7586 } 7587 return value; 7588 } 7589 } 7590 } 7591 }, 7592 7593 removeAttr: function( elem, value ) { 7594 var name, 7595 i = 0, 7596 7597 // Attribute names can contain non-HTML whitespace characters 7598 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 7599 attrNames = value && value.match( rnothtmlwhite ); 7600 7601 if ( attrNames && elem.nodeType === 1 ) { 7602 while ( ( name = attrNames[ i++ ] ) ) { 7603 elem.removeAttribute( name ); 7604 } 7605 } 7606 } 7607} ); 7608 7609// Hooks for boolean attributes 7610boolHook = { 7611 set: function( elem, value, name ) { 7612 if ( value === false ) { 7613 7614 // Remove boolean attributes when set to false 7615 jQuery.removeAttr( elem, name ); 7616 } else { 7617 elem.setAttribute( name, name ); 7618 } 7619 return name; 7620 } 7621}; 7622 7623jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { 7624 var getter = attrHandle[ name ] || jQuery.find.attr; 7625 7626 attrHandle[ name ] = function( elem, name, isXML ) { 7627 var ret, handle, 7628 lowercaseName = name.toLowerCase(); 7629 7630 if ( !isXML ) { 7631 7632 // Avoid an infinite loop by temporarily removing this function from the getter 7633 handle = attrHandle[ lowercaseName ]; 7634 attrHandle[ lowercaseName ] = ret; 7635 ret = getter( elem, name, isXML ) != null ? 7636 lowercaseName : 7637 null; 7638 attrHandle[ lowercaseName ] = handle; 7639 } 7640 return ret; 7641 }; 7642} ); 7643 7644 7645 7646 7647var rfocusable = /^(?:input|select|textarea|button)$/i, 7648 rclickable = /^(?:a|area)$/i; 7649 7650jQuery.fn.extend( { 7651 prop: function( name, value ) { 7652 return access( this, jQuery.prop, name, value, arguments.length > 1 ); 7653 }, 7654 7655 removeProp: function( name ) { 7656 return this.each( function() { 7657 delete this[ jQuery.propFix[ name ] || name ]; 7658 } ); 7659 } 7660} ); 7661 7662jQuery.extend( { 7663 prop: function( elem, name, value ) { 7664 var ret, hooks, 7665 nType = elem.nodeType; 7666 7667 // Don't get/set properties on text, comment and attribute nodes 7668 if ( nType === 3 || nType === 8 || nType === 2 ) { 7669 return; 7670 } 7671 7672 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 7673 7674 // Fix name and attach hooks 7675 name = jQuery.propFix[ name ] || name; 7676 hooks = jQuery.propHooks[ name ]; 7677 } 7678 7679 if ( value !== undefined ) { 7680 if ( hooks && "set" in hooks && 7681 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 7682 return ret; 7683 } 7684 7685 return ( elem[ name ] = value ); 7686 } 7687 7688 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 7689 return ret; 7690 } 7691 7692 return elem[ name ]; 7693 }, 7694 7695 propHooks: { 7696 tabIndex: { 7697 get: function( elem ) { 7698 7699 // Support: IE <=9 - 11 only 7700 // elem.tabIndex doesn't always return the 7701 // correct value when it hasn't been explicitly set 7702 // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ 7703 // Use proper attribute retrieval(#12072) 7704 var tabindex = jQuery.find.attr( elem, "tabindex" ); 7705 7706 if ( tabindex ) { 7707 return parseInt( tabindex, 10 ); 7708 } 7709 7710 if ( 7711 rfocusable.test( elem.nodeName ) || 7712 rclickable.test( elem.nodeName ) && 7713 elem.href 7714 ) { 7715 return 0; 7716 } 7717 7718 return -1; 7719 } 7720 } 7721 }, 7722 7723 propFix: { 7724 "for": "htmlFor", 7725 "class": "className" 7726 } 7727} ); 7728 7729// Support: IE <=11 only 7730// Accessing the selectedIndex property 7731// forces the browser to respect setting selected 7732// on the option 7733// The getter ensures a default option is selected 7734// when in an optgroup 7735// eslint rule "no-unused-expressions" is disabled for this code 7736// since it considers such accessions noop 7737if ( !support.optSelected ) { 7738 jQuery.propHooks.selected = { 7739 get: function( elem ) { 7740 7741 /* eslint no-unused-expressions: "off" */ 7742 7743 var parent = elem.parentNode; 7744 if ( parent && parent.parentNode ) { 7745 parent.parentNode.selectedIndex; 7746 } 7747 return null; 7748 }, 7749 set: function( elem ) { 7750 7751 /* eslint no-unused-expressions: "off" */ 7752 7753 var parent = elem.parentNode; 7754 if ( parent ) { 7755 parent.selectedIndex; 7756 7757 if ( parent.parentNode ) { 7758 parent.parentNode.selectedIndex; 7759 } 7760 } 7761 } 7762 }; 7763} 7764 7765jQuery.each( [ 7766 "tabIndex", 7767 "readOnly", 7768 "maxLength", 7769 "cellSpacing", 7770 "cellPadding", 7771 "rowSpan", 7772 "colSpan", 7773 "useMap", 7774 "frameBorder", 7775 "contentEditable" 7776], function() { 7777 jQuery.propFix[ this.toLowerCase() ] = this; 7778} ); 7779 7780 7781 7782 7783 // Strip and collapse whitespace according to HTML spec 7784 // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace 7785 function stripAndCollapse( value ) { 7786 var tokens = value.match( rnothtmlwhite ) || []; 7787 return tokens.join( " " ); 7788 } 7789 7790 7791function getClass( elem ) { 7792 return elem.getAttribute && elem.getAttribute( "class" ) || ""; 7793} 7794 7795function classesToArray( value ) { 7796 if ( Array.isArray( value ) ) { 7797 return value; 7798 } 7799 if ( typeof value === "string" ) { 7800 return value.match( rnothtmlwhite ) || []; 7801 } 7802 return []; 7803} 7804 7805jQuery.fn.extend( { 7806 addClass: function( value ) { 7807 var classes, elem, cur, curValue, clazz, j, finalValue, 7808 i = 0; 7809 7810 if ( isFunction( value ) ) { 7811 return this.each( function( j ) { 7812 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); 7813 } ); 7814 } 7815 7816 classes = classesToArray( value ); 7817 7818 if ( classes.length ) { 7819 while ( ( elem = this[ i++ ] ) ) { 7820 curValue = getClass( elem ); 7821 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 7822 7823 if ( cur ) { 7824 j = 0; 7825 while ( ( clazz = classes[ j++ ] ) ) { 7826 if ( cur.indexOf( " " + clazz + " " ) < 0 ) { 7827 cur += clazz + " "; 7828 } 7829 } 7830 7831 // Only assign if different to avoid unneeded rendering. 7832 finalValue = stripAndCollapse( cur ); 7833 if ( curValue !== finalValue ) { 7834 elem.setAttribute( "class", finalValue ); 7835 } 7836 } 7837 } 7838 } 7839 7840 return this; 7841 }, 7842 7843 removeClass: function( value ) { 7844 var classes, elem, cur, curValue, clazz, j, finalValue, 7845 i = 0; 7846 7847 if ( isFunction( value ) ) { 7848 return this.each( function( j ) { 7849 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); 7850 } ); 7851 } 7852 7853 if ( !arguments.length ) { 7854 return this.attr( "class", "" ); 7855 } 7856 7857 classes = classesToArray( value ); 7858 7859 if ( classes.length ) { 7860 while ( ( elem = this[ i++ ] ) ) { 7861 curValue = getClass( elem ); 7862 7863 // This expression is here for better compressibility (see addClass) 7864 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 7865 7866 if ( cur ) { 7867 j = 0; 7868 while ( ( clazz = classes[ j++ ] ) ) { 7869 7870 // Remove *all* instances 7871 while ( cur.indexOf( " " + clazz + " " ) > -1 ) { 7872 cur = cur.replace( " " + clazz + " ", " " ); 7873 } 7874 } 7875 7876 // Only assign if different to avoid unneeded rendering. 7877 finalValue = stripAndCollapse( cur ); 7878 if ( curValue !== finalValue ) { 7879 elem.setAttribute( "class", finalValue ); 7880 } 7881 } 7882 } 7883 } 7884 7885 return this; 7886 }, 7887 7888 toggleClass: function( value, stateVal ) { 7889 var type = typeof value, 7890 isValidValue = type === "string" || Array.isArray( value ); 7891 7892 if ( typeof stateVal === "boolean" && isValidValue ) { 7893 return stateVal ? this.addClass( value ) : this.removeClass( value ); 7894 } 7895 7896 if ( isFunction( value ) ) { 7897 return this.each( function( i ) { 7898 jQuery( this ).toggleClass( 7899 value.call( this, i, getClass( this ), stateVal ), 7900 stateVal 7901 ); 7902 } ); 7903 } 7904 7905 return this.each( function() { 7906 var className, i, self, classNames; 7907 7908 if ( isValidValue ) { 7909 7910 // Toggle individual class names 7911 i = 0; 7912 self = jQuery( this ); 7913 classNames = classesToArray( value ); 7914 7915 while ( ( className = classNames[ i++ ] ) ) { 7916 7917 // Check each className given, space separated list 7918 if ( self.hasClass( className ) ) { 7919 self.removeClass( className ); 7920 } else { 7921 self.addClass( className ); 7922 } 7923 } 7924 7925 // Toggle whole class name 7926 } else if ( value === undefined || type === "boolean" ) { 7927 className = getClass( this ); 7928 if ( className ) { 7929 7930 // Store className if set 7931 dataPriv.set( this, "__className__", className ); 7932 } 7933 7934 // If the element has a class name or if we're passed `false`, 7935 // then remove the whole classname (if there was one, the above saved it). 7936 // Otherwise bring back whatever was previously saved (if anything), 7937 // falling back to the empty string if nothing was stored. 7938 if ( this.setAttribute ) { 7939 this.setAttribute( "class", 7940 className || value === false ? 7941 "" : 7942 dataPriv.get( this, "__className__" ) || "" 7943 ); 7944 } 7945 } 7946 } ); 7947 }, 7948 7949 hasClass: function( selector ) { 7950 var className, elem, 7951 i = 0; 7952 7953 className = " " + selector + " "; 7954 while ( ( elem = this[ i++ ] ) ) { 7955 if ( elem.nodeType === 1 && 7956 ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { 7957 return true; 7958 } 7959 } 7960 7961 return false;
vendor: 5,544 bytes, lines 7962-8197
7962 } 7963} ); 7964 7965 7966 7967 7968var rreturn = /\r/g; 7969 7970jQuery.fn.extend( { 7971 val: function( value ) { 7972 var hooks, ret, valueIsFunction, 7973 elem = this[ 0 ]; 7974 7975 if ( !arguments.length ) { 7976 if ( elem ) { 7977 hooks = jQuery.valHooks[ elem.type ] || 7978 jQuery.valHooks[ elem.nodeName.toLowerCase() ]; 7979 7980 if ( hooks && 7981 "get" in hooks && 7982 ( ret = hooks.get( elem, "value" ) ) !== undefined 7983 ) { 7984 return ret; 7985 } 7986 7987 ret = elem.value; 7988 7989 // Handle most common string cases 7990 if ( typeof ret === "string" ) { 7991 return ret.replace( rreturn, "" ); 7992 } 7993 7994 // Handle cases where value is null/undef or number 7995 return ret == null ? "" : ret; 7996 } 7997 7998 return; 7999 } 8000 8001 valueIsFunction = isFunction( value ); 8002 8003 return this.each( function( i ) { 8004 var val; 8005 8006 if ( this.nodeType !== 1 ) { 8007 return; 8008 } 8009 8010 if ( valueIsFunction ) { 8011 val = value.call( this, i, jQuery( this ).val() ); 8012 } else { 8013 val = value; 8014 } 8015 8016 // Treat null/undefined as ""; convert numbers to string 8017 if ( val == null ) { 8018 val = ""; 8019 8020 } else if ( typeof val === "number" ) { 8021 val += ""; 8022 8023 } else if ( Array.isArray( val ) ) { 8024 val = jQuery.map( val, function( value ) { 8025 return value == null ? "" : value + ""; 8026 } ); 8027 } 8028 8029 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; 8030 8031 // If set returns undefined, fall back to normal setting 8032 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { 8033 this.value = val; 8034 } 8035 } ); 8036 } 8037} ); 8038 8039jQuery.extend( { 8040 valHooks: { 8041 option: { 8042 get: function( elem ) { 8043 8044 var val = jQuery.find.attr( elem, "value" ); 8045 return val != null ? 8046 val : 8047 8048 // Support: IE <=10 - 11 only 8049 // option.text throws exceptions (#14686, #14858) 8050 // Strip and collapse whitespace 8051 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace 8052 stripAndCollapse( jQuery.text( elem ) ); 8053 } 8054 }, 8055 select: { 8056 get: function( elem ) { 8057 var value, option, i, 8058 options = elem.options, 8059 index = elem.selectedIndex, 8060 one = elem.type === "select-one", 8061 values = one ? null : [], 8062 max = one ? index + 1 : options.length; 8063 8064 if ( index < 0 ) { 8065 i = max; 8066 8067 } else { 8068 i = one ? index : 0; 8069 } 8070 8071 // Loop through all the selected options 8072 for ( ; i < max; i++ ) { 8073 option = options[ i ]; 8074 8075 // Support: IE <=9 only 8076 // IE8-9 doesn't update selected after form reset (#2551) 8077 if ( ( option.selected || i === index ) && 8078 8079 // Don't return options that are disabled or in a disabled optgroup 8080 !option.disabled && 8081 ( !option.parentNode.disabled || 8082 !nodeName( option.parentNode, "optgroup" ) ) ) { 8083 8084 // Get the specific value for the option 8085 value = jQuery( option ).val(); 8086 8087 // We don't need an array for one selects 8088 if ( one ) { 8089 return value; 8090 } 8091 8092 // Multi-Selects return an array 8093 values.push( value ); 8094 } 8095 } 8096 8097 return values; 8098 }, 8099 8100 set: function( elem, value ) { 8101 var optionSet, option, 8102 options = elem.options, 8103 values = jQuery.makeArray( value ), 8104 i = options.length; 8105 8106 while ( i-- ) { 8107 option = options[ i ]; 8108 8109 /* eslint-disable no-cond-assign */ 8110 8111 if ( option.selected = 8112 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 8113 ) { 8114 optionSet = true; 8115 } 8116 8117 /* eslint-enable no-cond-assign */ 8118 } 8119 8120 // Force browsers to behave consistently when non-matching value is set 8121 if ( !optionSet ) { 8122 elem.selectedIndex = -1; 8123 } 8124 return values; 8125 } 8126 } 8127 } 8128} ); 8129 8130// Radios and checkboxes getter/setter 8131jQuery.each( [ "radio", "checkbox" ], function() { 8132 jQuery.valHooks[ this ] = { 8133 set: function( elem, value ) { 8134 if ( Array.isArray( value ) ) { 8135 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); 8136 } 8137 } 8138 }; 8139 if ( !support.checkOn ) { 8140 jQuery.valHooks[ this ].get = function( elem ) { 8141 return elem.getAttribute( "value" ) === null ? "on" : elem.value; 8142 }; 8143 } 8144} ); 8145 8146 8147 8148 8149// Return jQuery for attributes-only inclusion 8150 8151 8152support.focusin = "onfocusin" in window; 8153 8154 8155var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 8156 stopPropagationCallback = function( e ) { 8157 e.stopPropagation(); 8158 }; 8159 8160jQuery.extend( jQuery.event, { 8161 8162 trigger: function( event, data, elem, onlyHandlers ) { 8163 8164 var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, 8165 eventPath = [ elem || document ], 8166 type = hasOwn.call( event, "type" ) ? event.type : event, 8167 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; 8168 8169 cur = lastElement = tmp = elem = elem || document; 8170 8171 // Don't do events on text and comment nodes 8172 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 8173 return; 8174 } 8175 8176 // focus/blur morphs to focusin/out; ensure we're not firing them right now 8177 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { 8178 return; 8179 } 8180 8181 if ( type.indexOf( "." ) > -1 ) { 8182 8183 // Namespaced trigger; create a regexp to match event type in handle() 8184 namespaces = type.split( "." ); 8185 type = namespaces.shift(); 8186 namespaces.sort(); 8187 } 8188 ontype = type.indexOf( ":" ) < 0 && "on" + type; 8189 8190 // Caller can pass in a jQuery.Event object, Object, or just an event type string 8191 event = event[ jQuery.expando ] ? 8192 event : 8193 new jQuery.Event( type, typeof event === "object" && event ); 8194 8195 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) 8196 event.isTrigger = onlyHandlers ? 2 : 3; 8197 event.namespace = namespaces.join( "." );
vendor: 32,532 bytes, lines 8198-9469
8198 event.rnamespace = event.namespace ? 8199 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : 8200 null; 8201 8202 // Clean up the event in case it is being reused 8203 event.result = undefined; 8204 if ( !event.target ) { 8205 event.target = elem; 8206 } 8207 8208 // Clone any incoming data and prepend the event, creating the handler arg list 8209 data = data == null ? 8210 [ event ] : 8211 jQuery.makeArray( data, [ event ] ); 8212 8213 // Allow special events to draw outside the lines 8214 special = jQuery.event.special[ type ] || {}; 8215 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { 8216 return; 8217 } 8218 8219 // Determine event propagation path in advance, per W3C events spec (#9951) 8220 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) 8221 if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { 8222 8223 bubbleType = special.delegateType || type; 8224 if ( !rfocusMorph.test( bubbleType + type ) ) { 8225 cur = cur.parentNode; 8226 } 8227 for ( ; cur; cur = cur.parentNode ) { 8228 eventPath.push( cur ); 8229 tmp = cur; 8230 } 8231 8232 // Only add window if we got to document (e.g., not plain obj or detached DOM) 8233 if ( tmp === ( elem.ownerDocument || document ) ) { 8234 eventPath.push( tmp.defaultView || tmp.parentWindow || window ); 8235 } 8236 } 8237 8238 // Fire handlers on the event path 8239 i = 0; 8240 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { 8241 lastElement = cur; 8242 event.type = i > 1 ? 8243 bubbleType : 8244 special.bindType || type; 8245 8246 // jQuery handler 8247 handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] && 8248 dataPriv.get( cur, "handle" ); 8249 if ( handle ) { 8250 handle.apply( cur, data ); 8251 } 8252 8253 // Native handler 8254 handle = ontype && cur[ ontype ]; 8255 if ( handle && handle.apply && acceptData( cur ) ) { 8256 event.result = handle.apply( cur, data ); 8257 if ( event.result === false ) { 8258 event.preventDefault(); 8259 } 8260 } 8261 } 8262 event.type = type; 8263 8264 // If nobody prevented the default action, do it now 8265 if ( !onlyHandlers && !event.isDefaultPrevented() ) { 8266 8267 if ( ( !special._default || 8268 special._default.apply( eventPath.pop(), data ) === false ) && 8269 acceptData( elem ) ) { 8270 8271 // Call a native DOM method on the target with the same name as the event. 8272 // Don't do default actions on window, that's where global variables be (#6170) 8273 if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { 8274 8275 // Don't re-trigger an onFOO event when we call its FOO() method 8276 tmp = elem[ ontype ]; 8277 8278 if ( tmp ) { 8279 elem[ ontype ] = null; 8280 } 8281 8282 // Prevent re-triggering of the same event, since we already bubbled it above 8283 jQuery.event.triggered = type; 8284 8285 if ( event.isPropagationStopped() ) { 8286 lastElement.addEventListener( type, stopPropagationCallback ); 8287 } 8288 8289 elem[ type ](); 8290 8291 if ( event.isPropagationStopped() ) { 8292 lastElement.removeEventListener( type, stopPropagationCallback ); 8293 } 8294 8295 jQuery.event.triggered = undefined; 8296 8297 if ( tmp ) { 8298 elem[ ontype ] = tmp; 8299 } 8300 } 8301 } 8302 } 8303 8304 return event.result; 8305 }, 8306 8307 // Piggyback on a donor event to simulate a different one 8308 // Used only for `focus(in | out)` events 8309 simulate: function( type, elem, event ) { 8310 var e = jQuery.extend( 8311 new jQuery.Event(), 8312 event, 8313 { 8314 type: type, 8315 isSimulated: true 8316 } 8317 ); 8318 8319 jQuery.event.trigger( e, null, elem ); 8320 } 8321 8322} ); 8323 8324jQuery.fn.extend( { 8325 8326 trigger: function( type, data ) { 8327 return this.each( function() { 8328 jQuery.event.trigger( type, data, this ); 8329 } ); 8330 }, 8331 triggerHandler: function( type, data ) { 8332 var elem = this[ 0 ]; 8333 if ( elem ) { 8334 return jQuery.event.trigger( type, data, elem, true ); 8335 } 8336 } 8337} ); 8338 8339 8340// Support: Firefox <=44 8341// Firefox doesn't have focus(in | out) events 8342// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 8343// 8344// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 8345// focus(in | out) events fire after focus & blur events, 8346// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order 8347// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 8348if ( !support.focusin ) { 8349 jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { 8350 8351 // Attach a single capturing handler on the document while someone wants focusin/focusout 8352 var handler = function( event ) { 8353 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); 8354 }; 8355 8356 jQuery.event.special[ fix ] = { 8357 setup: function() { 8358 var doc = this.ownerDocument || this, 8359 attaches = dataPriv.access( doc, fix ); 8360 8361 if ( !attaches ) { 8362 doc.addEventListener( orig, handler, true ); 8363 } 8364 dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); 8365 }, 8366 teardown: function() { 8367 var doc = this.ownerDocument || this, 8368 attaches = dataPriv.access( doc, fix ) - 1; 8369 8370 if ( !attaches ) { 8371 doc.removeEventListener( orig, handler, true ); 8372 dataPriv.remove( doc, fix ); 8373 8374 } else { 8375 dataPriv.access( doc, fix, attaches ); 8376 } 8377 } 8378 }; 8379 } ); 8380} 8381var location = window.location; 8382 8383var nonce = Date.now(); 8384 8385var rquery = ( /\?/ ); 8386 8387 8388 8389// Cross-browser xml parsing 8390jQuery.parseXML = function( data ) { 8391 var xml; 8392 if ( !data || typeof data !== "string" ) { 8393 return null; 8394 } 8395 8396 // Support: IE 9 - 11 only 8397 // IE throws on parseFromString with invalid input. 8398 try { 8399 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); 8400 } catch ( e ) { 8401 xml = undefined; 8402 } 8403 8404 if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { 8405 jQuery.error( "Invalid XML: " + data ); 8406 } 8407 return xml; 8408}; 8409 8410 8411var 8412 rbracket = /\[\]$/, 8413 rCRLF = /\r?\n/g, 8414 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 8415 rsubmittable = /^(?:input|select|textarea|keygen)/i; 8416 8417function buildParams( prefix, obj, traditional, add ) { 8418 var name; 8419 8420 if ( Array.isArray( obj ) ) { 8421 8422 // Serialize array item. 8423 jQuery.each( obj, function( i, v ) { 8424 if ( traditional || rbracket.test( prefix ) ) { 8425 8426 // Treat each array item as a scalar. 8427 add( prefix, v ); 8428 8429 } else { 8430 8431 // Item is non-scalar (array or object), encode its numeric index. 8432 buildParams( 8433 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", 8434 v, 8435 traditional, 8436 add 8437 ); 8438 } 8439 } ); 8440 8441 } else if ( !traditional && toType( obj ) === "object" ) { 8442 8443 // Serialize object item. 8444 for ( name in obj ) { 8445 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); 8446 } 8447 8448 } else { 8449 8450 // Serialize scalar item. 8451 add( prefix, obj ); 8452 } 8453} 8454 8455// Serialize an array of form elements or a set of 8456// key/values into a query string 8457jQuery.param = function( a, traditional ) { 8458 var prefix, 8459 s = [], 8460 add = function( key, valueOrFunction ) { 8461 8462 // If value is a function, invoke it and use its return value 8463 var value = isFunction( valueOrFunction ) ? 8464 valueOrFunction() : 8465 valueOrFunction; 8466 8467 s[ s.length ] = encodeURIComponent( key ) + "=" + 8468 encodeURIComponent( value == null ? "" : value ); 8469 }; 8470 8471 // If an array was passed in, assume that it is an array of form elements. 8472 if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 8473 8474 // Serialize the form elements 8475 jQuery.each( a, function() { 8476 add( this.name, this.value ); 8477 } ); 8478 8479 } else { 8480 8481 // If traditional, encode the "old" way (the way 1.3.2 or older 8482 // did it), otherwise encode params recursively. 8483 for ( prefix in a ) { 8484 buildParams( prefix, a[ prefix ], traditional, add ); 8485 } 8486 } 8487 8488 // Return the resulting serialization 8489 return s.join( "&" ); 8490}; 8491 8492jQuery.fn.extend( { 8493 serialize: function() { 8494 return jQuery.param( this.serializeArray() ); 8495 }, 8496 serializeArray: function() { 8497 return this.map( function() { 8498 8499 // Can add propHook for "elements" to filter or add form elements 8500 var elements = jQuery.prop( this, "elements" ); 8501 return elements ? jQuery.makeArray( elements ) : this; 8502 } ) 8503 .filter( function() { 8504 var type = this.type; 8505 8506 // Use .is( ":disabled" ) so that fieldset[disabled] works 8507 return this.name && !jQuery( this ).is( ":disabled" ) && 8508 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && 8509 ( this.checked || !rcheckableType.test( type ) ); 8510 } ) 8511 .map( function( i, elem ) { 8512 var val = jQuery( this ).val(); 8513 8514 if ( val == null ) { 8515 return null; 8516 } 8517 8518 if ( Array.isArray( val ) ) { 8519 return jQuery.map( val, function( val ) { 8520 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 8521 } ); 8522 } 8523 8524 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 8525 } ).get(); 8526 } 8527} ); 8528 8529 8530var 8531 r20 = /%20/g, 8532 rhash = /#.*$/, 8533 rantiCache = /([?&])_=[^&]*/, 8534 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, 8535 8536 // #7653, #8125, #8152: local protocol detection 8537 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, 8538 rnoContent = /^(?:GET|HEAD)$/, 8539 rprotocol = /^\/\//, 8540 8541 /* Prefilters 8542 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 8543 * 2) These are called: 8544 * - BEFORE asking for a transport 8545 * - AFTER param serialization (s.data is a string if s.processData is true) 8546 * 3) key is the dataType 8547 * 4) the catchall symbol "*" can be used 8548 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 8549 */ 8550 prefilters = {}, 8551 8552 /* Transports bindings 8553 * 1) key is the dataType 8554 * 2) the catchall symbol "*" can be used 8555 * 3) selection will start with transport dataType and THEN go to "*" if needed 8556 */ 8557 transports = {}, 8558 8559 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression 8560 allTypes = "*/".concat( "*" ), 8561 8562 // Anchor tag for parsing the document origin 8563 originAnchor = document.createElement( "a" ); 8564 originAnchor.href = location.href; 8565 8566// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 8567function addToPrefiltersOrTransports( structure ) { 8568 8569 // dataTypeExpression is optional and defaults to "*" 8570 return function( dataTypeExpression, func ) { 8571 8572 if ( typeof dataTypeExpression !== "string" ) { 8573 func = dataTypeExpression; 8574 dataTypeExpression = "*"; 8575 } 8576 8577 var dataType, 8578 i = 0, 8579 dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; 8580 8581 if ( isFunction( func ) ) { 8582 8583 // For each dataType in the dataTypeExpression 8584 while ( ( dataType = dataTypes[ i++ ] ) ) { 8585 8586 // Prepend if requested 8587 if ( dataType[ 0 ] === "+" ) { 8588 dataType = dataType.slice( 1 ) || "*"; 8589 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); 8590 8591 // Otherwise append 8592 } else { 8593 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); 8594 } 8595 } 8596 } 8597 }; 8598} 8599 8600// Base inspection function for prefilters and transports 8601function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { 8602 8603 var inspected = {}, 8604 seekingTransport = ( structure === transports ); 8605 8606 function inspect( dataType ) { 8607 var selected; 8608 inspected[ dataType ] = true; 8609 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { 8610 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); 8611 if ( typeof dataTypeOrTransport === "string" && 8612 !seekingTransport && !inspected[ dataTypeOrTransport ] ) { 8613 8614 options.dataTypes.unshift( dataTypeOrTransport ); 8615 inspect( dataTypeOrTransport ); 8616 return false; 8617 } else if ( seekingTransport ) { 8618 return !( selected = dataTypeOrTransport ); 8619 } 8620 } ); 8621 return selected; 8622 } 8623 8624 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); 8625} 8626 8627// A special extend for ajax options 8628// that takes "flat" options (not to be deep extended) 8629// Fixes #9887 8630function ajaxExtend( target, src ) { 8631 var key, deep, 8632 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 8633 8634 for ( key in src ) { 8635 if ( src[ key ] !== undefined ) { 8636 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; 8637 } 8638 } 8639 if ( deep ) { 8640 jQuery.extend( true, target, deep ); 8641 } 8642 8643 return target; 8644} 8645 8646/* Handles responses to an ajax request: 8647 * - finds the right dataType (mediates between content-type and expected dataType) 8648 * - returns the corresponding response 8649 */ 8650function ajaxHandleResponses( s, jqXHR, responses ) { 8651 8652 var ct, type, finalDataType, firstDataType, 8653 contents = s.contents, 8654 dataTypes = s.dataTypes; 8655 8656 // Remove auto dataType and get content-type in the process 8657 while ( dataTypes[ 0 ] === "*" ) { 8658 dataTypes.shift(); 8659 if ( ct === undefined ) { 8660 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); 8661 } 8662 } 8663 8664 // Check if we're dealing with a known content-type 8665 if ( ct ) { 8666 for ( type in contents ) { 8667 if ( contents[ type ] && contents[ type ].test( ct ) ) { 8668 dataTypes.unshift( type ); 8669 break; 8670 } 8671 } 8672 } 8673 8674 // Check to see if we have a response for the expected dataType 8675 if ( dataTypes[ 0 ] in responses ) { 8676 finalDataType = dataTypes[ 0 ]; 8677 } else { 8678 8679 // Try convertible dataTypes 8680 for ( type in responses ) { 8681 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { 8682 finalDataType = type; 8683 break; 8684 } 8685 if ( !firstDataType ) { 8686 firstDataType = type; 8687 } 8688 } 8689 8690 // Or just use first one 8691 finalDataType = finalDataType || firstDataType; 8692 } 8693 8694 // If we found a dataType 8695 // We add the dataType to the list if needed 8696 // and return the corresponding response 8697 if ( finalDataType ) { 8698 if ( finalDataType !== dataTypes[ 0 ] ) { 8699 dataTypes.unshift( finalDataType ); 8700 } 8701 return responses[ finalDataType ]; 8702 } 8703} 8704 8705/* Chain conversions given the request and the original response 8706 * Also sets the responseXXX fields on the jqXHR instance 8707 */ 8708function ajaxConvert( s, response, jqXHR, isSuccess ) { 8709 var conv2, current, conv, tmp, prev, 8710 converters = {}, 8711 8712 // Work with a copy of dataTypes in case we need to modify it for conversion 8713 dataTypes = s.dataTypes.slice(); 8714 8715 // Create converters map with lowercased keys 8716 if ( dataTypes[ 1 ] ) { 8717 for ( conv in s.converters ) { 8718 converters[ conv.toLowerCase() ] = s.converters[ conv ]; 8719 } 8720 } 8721 8722 current = dataTypes.shift(); 8723 8724 // Convert to each sequential dataType 8725 while ( current ) { 8726 8727 if ( s.responseFields[ current ] ) { 8728 jqXHR[ s.responseFields[ current ] ] = response; 8729 } 8730 8731 // Apply the dataFilter if provided 8732 if ( !prev && isSuccess && s.dataFilter ) { 8733 response = s.dataFilter( response, s.dataType ); 8734 } 8735 8736 prev = current; 8737 current = dataTypes.shift(); 8738 8739 if ( current ) { 8740 8741 // There's only work to do if current dataType is non-auto 8742 if ( current === "*" ) { 8743 8744 current = prev; 8745 8746 // Convert response if prev dataType is non-auto and differs from current 8747 } else if ( prev !== "*" && prev !== current ) { 8748 8749 // Seek a direct converter 8750 conv = converters[ prev + " " + current ] || converters[ "* " + current ]; 8751 8752 // If none found, seek a pair 8753 if ( !conv ) { 8754 for ( conv2 in converters ) { 8755 8756 // If conv2 outputs current 8757 tmp = conv2.split( " " ); 8758 if ( tmp[ 1 ] === current ) { 8759 8760 // If prev can be converted to accepted input 8761 conv = converters[ prev + " " + tmp[ 0 ] ] || 8762 converters[ "* " + tmp[ 0 ] ]; 8763 if ( conv ) { 8764 8765 // Condense equivalence converters 8766 if ( conv === true ) { 8767 conv = converters[ conv2 ]; 8768 8769 // Otherwise, insert the intermediate dataType 8770 } else if ( converters[ conv2 ] !== true ) { 8771 current = tmp[ 0 ]; 8772 dataTypes.unshift( tmp[ 1 ] ); 8773 } 8774 break; 8775 } 8776 } 8777 } 8778 } 8779 8780 // Apply converter (if not an equivalence) 8781 if ( conv !== true ) { 8782 8783 // Unless errors are allowed to bubble, catch and return them 8784 if ( conv && s.throws ) { 8785 response = conv( response ); 8786 } else { 8787 try { 8788 response = conv( response ); 8789 } catch ( e ) { 8790 return { 8791 state: "parsererror", 8792 error: conv ? e : "No conversion from " + prev + " to " + current 8793 }; 8794 } 8795 } 8796 } 8797 } 8798 } 8799 } 8800 8801 return { state: "success", data: response }; 8802} 8803 8804jQuery.extend( { 8805 8806 // Counter for holding the number of active queries 8807 active: 0, 8808 8809 // Last-Modified header cache for next request 8810 lastModified: {}, 8811 etag: {}, 8812 8813 ajaxSettings: { 8814 url: location.href, 8815 type: "GET", 8816 isLocal: rlocalProtocol.test( location.protocol ), 8817 global: true, 8818 processData: true, 8819 async: true, 8820 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 8821 8822 /* 8823 timeout: 0, 8824 data: null, 8825 dataType: null, 8826 username: null, 8827 password: null, 8828 cache: null, 8829 throws: false, 8830 traditional: false, 8831 headers: {}, 8832 */ 8833 8834 accepts: { 8835 "*": allTypes, 8836 text: "text/plain", 8837 html: "text/html", 8838 xml: "application/xml, text/xml", 8839 json: "application/json, text/javascript" 8840 }, 8841 8842 contents: { 8843 xml: /\bxml\b/, 8844 html: /\bhtml/, 8845 json: /\bjson\b/ 8846 }, 8847 8848 responseFields: { 8849 xml: "responseXML", 8850 text: "responseText", 8851 json: "responseJSON" 8852 }, 8853 8854 // Data converters 8855 // Keys separate source (or catchall "*") and destination types with a single space 8856 converters: { 8857 8858 // Convert anything to text 8859 "* text": String, 8860 8861 // Text to html (true = no transformation) 8862 "text html": true, 8863 8864 // Evaluate text as a json expression 8865 "text json": JSON.parse, 8866 8867 // Parse text as xml 8868 "text xml": jQuery.parseXML 8869 }, 8870 8871 // For options that shouldn't be deep extended: 8872 // you can add your own custom options here if 8873 // and when you create one that shouldn't be 8874 // deep extended (see ajaxExtend) 8875 flatOptions: { 8876 url: true, 8877 context: true 8878 } 8879 }, 8880 8881 // Creates a full fledged settings object into target 8882 // with both ajaxSettings and settings fields. 8883 // If target is omitted, writes into ajaxSettings. 8884 ajaxSetup: function( target, settings ) { 8885 return settings ? 8886 8887 // Building a settings object 8888 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : 8889 8890 // Extending ajaxSettings 8891 ajaxExtend( jQuery.ajaxSettings, target ); 8892 }, 8893 8894 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), 8895 ajaxTransport: addToPrefiltersOrTransports( transports ), 8896 8897 // Main method 8898 ajax: function( url, options ) { 8899 8900 // If url is an object, simulate pre-1.5 signature 8901 if ( typeof url === "object" ) { 8902 options = url; 8903 url = undefined; 8904 } 8905 8906 // Force options to be an object 8907 options = options || {}; 8908 8909 var transport, 8910 8911 // URL without anti-cache param 8912 cacheURL, 8913 8914 // Response headers 8915 responseHeadersString, 8916 responseHeaders, 8917 8918 // timeout handle 8919 timeoutTimer, 8920 8921 // Url cleanup var 8922 urlAnchor, 8923 8924 // Request state (becomes false upon send and true upon completion) 8925 completed, 8926 8927 // To know if global events are to be dispatched 8928 fireGlobals, 8929 8930 // Loop variable 8931 i, 8932 8933 // uncached part of the url 8934 uncached, 8935 8936 // Create the final options object 8937 s = jQuery.ajaxSetup( {}, options ), 8938 8939 // Callbacks context 8940 callbackContext = s.context || s, 8941 8942 // Context for global events is callbackContext if it is a DOM node or jQuery collection 8943 globalEventContext = s.context && 8944 ( callbackContext.nodeType || callbackContext.jquery ) ? 8945 jQuery( callbackContext ) : 8946 jQuery.event, 8947 8948 // Deferreds 8949 deferred = jQuery.Deferred(), 8950 completeDeferred = jQuery.Callbacks( "once memory" ), 8951 8952 // Status-dependent callbacks 8953 statusCode = s.statusCode || {}, 8954 8955 // Headers (they are sent all at once) 8956 requestHeaders = {}, 8957 requestHeadersNames = {}, 8958 8959 // Default abort message 8960 strAbort = "canceled", 8961 8962 // Fake xhr 8963 jqXHR = { 8964 readyState: 0, 8965 8966 // Builds headers hashtable if needed 8967 getResponseHeader: function( key ) { 8968 var match; 8969 if ( completed ) { 8970 if ( !responseHeaders ) { 8971 responseHeaders = {}; 8972 while ( ( match = rheaders.exec( responseHeadersString ) ) ) { 8973 responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ]; 8974 } 8975 } 8976 match = responseHeaders[ key.toLowerCase() ]; 8977 } 8978 return match == null ? null : match; 8979 }, 8980 8981 // Raw string 8982 getAllResponseHeaders: function() { 8983 return completed ? responseHeadersString : null; 8984 }, 8985 8986 // Caches the header 8987 setRequestHeader: function( name, value ) { 8988 if ( completed == null ) { 8989 name = requestHeadersNames[ name.toLowerCase() ] = 8990 requestHeadersNames[ name.toLowerCase() ] || name; 8991 requestHeaders[ name ] = value; 8992 } 8993 return this; 8994 }, 8995 8996 // Overrides response content-type header 8997 overrideMimeType: function( type ) { 8998 if ( completed == null ) { 8999 s.mimeType = type; 9000 } 9001 return this; 9002 }, 9003 9004 // Status-dependent callbacks 9005 statusCode: function( map ) { 9006 var code; 9007 if ( map ) { 9008 if ( completed ) { 9009 9010 // Execute the appropriate callbacks 9011 jqXHR.always( map[ jqXHR.status ] ); 9012 } else { 9013 9014 // Lazy-add the new callbacks in a way that preserves old ones 9015 for ( code in map ) { 9016 statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; 9017 } 9018 } 9019 } 9020 return this; 9021 }, 9022 9023 // Cancel the request 9024 abort: function( statusText ) { 9025 var finalText = statusText || strAbort; 9026 if ( transport ) { 9027 transport.abort( finalText ); 9028 } 9029 done( 0, finalText ); 9030 return this; 9031 } 9032 }; 9033 9034 // Attach deferreds 9035 deferred.promise( jqXHR ); 9036 9037 // Add protocol if not provided (prefilters might expect it) 9038 // Handle falsy url in the settings object (#10093: consistency with old signature) 9039 // We also use the url parameter if available 9040 s.url = ( ( url || s.url || location.href ) + "" ) 9041 .replace( rprotocol, location.protocol + "//" ); 9042 9043 // Alias method option to type as per ticket #12004 9044 s.type = options.method || options.type || s.method || s.type; 9045 9046 // Extract dataTypes list 9047 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; 9048 9049 // A cross-domain request is in order when the origin doesn't match the current origin. 9050 if ( s.crossDomain == null ) { 9051 urlAnchor = document.createElement( "a" ); 9052 9053 // Support: IE <=8 - 11, Edge 12 - 15 9054 // IE throws exception on accessing the href property if url is malformed, 9055 // e.g. http://example.com:80x/ 9056 try { 9057 urlAnchor.href = s.url; 9058 9059 // Support: IE <=8 - 11 only 9060 // Anchor's host property isn't correctly set when s.url is relative 9061 urlAnchor.href = urlAnchor.href; 9062 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== 9063 urlAnchor.protocol + "//" + urlAnchor.host; 9064 } catch ( e ) { 9065 9066 // If there is an error parsing the URL, assume it is crossDomain, 9067 // it can be rejected by the transport if it is invalid 9068 s.crossDomain = true; 9069 } 9070 } 9071 9072 // Convert data if not already a string 9073 if ( s.data && s.processData && typeof s.data !== "string" ) { 9074 s.data = jQuery.param( s.data, s.traditional ); 9075 } 9076 9077 // Apply prefilters 9078 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); 9079 9080 // If request was aborted inside a prefilter, stop there 9081 if ( completed ) { 9082 return jqXHR; 9083 } 9084 9085 // We can fire global events as of now if asked to 9086 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) 9087 fireGlobals = jQuery.event && s.global; 9088 9089 // Watch for a new set of requests 9090 if ( fireGlobals && jQuery.active++ === 0 ) { 9091 jQuery.event.trigger( "ajaxStart" ); 9092 } 9093 9094 // Uppercase the type 9095 s.type = s.type.toUpperCase(); 9096 9097 // Determine if request has content 9098 s.hasContent = !rnoContent.test( s.type ); 9099 9100 // Save the URL in case we're toying with the If-Modified-Since 9101 // and/or If-None-Match header later on 9102 // Remove hash to simplify url manipulation 9103 cacheURL = s.url.replace( rhash, "" ); 9104 9105 // More options handling for requests with no content 9106 if ( !s.hasContent ) { 9107 9108 // Remember the hash so we can put it back 9109 uncached = s.url.slice( cacheURL.length ); 9110 9111 // If data is available and should be processed, append data to url 9112 if ( s.data && ( s.processData || typeof s.data === "string" ) ) { 9113 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; 9114 9115 // #9682: remove data so that it's not used in an eventual retry 9116 delete s.data; 9117 } 9118 9119 // Add or update anti-cache param if needed 9120 if ( s.cache === false ) { 9121 cacheURL = cacheURL.replace( rantiCache, "$1" ); 9122 uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached; 9123 } 9124 9125 // Put hash and anti-cache on the URL that will be requested (gh-1732) 9126 s.url = cacheURL + uncached; 9127 9128 // Change '%20' to '+' if this is encoded form body content (gh-2658) 9129 } else if ( s.data && s.processData && 9130 ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { 9131 s.data = s.data.replace( r20, "+" ); 9132 } 9133 9134 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9135 if ( s.ifModified ) { 9136 if ( jQuery.lastModified[ cacheURL ] ) { 9137 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); 9138 } 9139 if ( jQuery.etag[ cacheURL ] ) { 9140 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); 9141 } 9142 } 9143 9144 // Set the correct header, if data is being sent 9145 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { 9146 jqXHR.setRequestHeader( "Content-Type", s.contentType ); 9147 } 9148 9149 // Set the Accepts header for the server, depending on the dataType 9150 jqXHR.setRequestHeader( 9151 "Accept", 9152 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? 9153 s.accepts[ s.dataTypes[ 0 ] ] + 9154 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : 9155 s.accepts[ "*" ] 9156 ); 9157 9158 // Check for headers option 9159 for ( i in s.headers ) { 9160 jqXHR.setRequestHeader( i, s.headers[ i ] ); 9161 } 9162 9163 // Allow custom headers/mimetypes and early abort 9164 if ( s.beforeSend && 9165 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { 9166 9167 // Abort if not done already and return 9168 return jqXHR.abort(); 9169 } 9170 9171 // Aborting is no longer a cancellation 9172 strAbort = "abort"; 9173 9174 // Install callbacks on deferreds 9175 completeDeferred.add( s.complete ); 9176 jqXHR.done( s.success ); 9177 jqXHR.fail( s.error ); 9178 9179 // Get transport 9180 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); 9181 9182 // If no transport, we auto-abort 9183 if ( !transport ) { 9184 done( -1, "No Transport" ); 9185 } else { 9186 jqXHR.readyState = 1; 9187 9188 // Send global event 9189 if ( fireGlobals ) { 9190 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); 9191 } 9192 9193 // If request was aborted inside ajaxSend, stop there 9194 if ( completed ) { 9195 return jqXHR; 9196 } 9197 9198 // Timeout 9199 if ( s.async && s.timeout > 0 ) { 9200 timeoutTimer = window.setTimeout( function() { 9201 jqXHR.abort( "timeout" ); 9202 }, s.timeout ); 9203 } 9204 9205 try { 9206 completed = false; 9207 transport.send( requestHeaders, done ); 9208 } catch ( e ) { 9209 9210 // Rethrow post-completion exceptions 9211 if ( completed ) { 9212 throw e; 9213 } 9214 9215 // Propagate others as results 9216 done( -1, e ); 9217 } 9218 } 9219 9220 // Callback for when everything is done 9221 function done( status, nativeStatusText, responses, headers ) { 9222 var isSuccess, success, error, response, modified, 9223 statusText = nativeStatusText; 9224 9225 // Ignore repeat invocations 9226 if ( completed ) { 9227 return; 9228 } 9229 9230 completed = true; 9231 9232 // Clear timeout if it exists 9233 if ( timeoutTimer ) { 9234 window.clearTimeout( timeoutTimer ); 9235 } 9236 9237 // Dereference transport for early garbage collection 9238 // (no matter how long the jqXHR object will be used) 9239 transport = undefined; 9240 9241 // Cache response headers 9242 responseHeadersString = headers || ""; 9243 9244 // Set readyState 9245 jqXHR.readyState = status > 0 ? 4 : 0; 9246 9247 // Determine if successful 9248 isSuccess = status >= 200 && status < 300 || status === 304; 9249 9250 // Get response data 9251 if ( responses ) { 9252 response = ajaxHandleResponses( s, jqXHR, responses ); 9253 } 9254 9255 // Convert no matter what (that way responseXXX fields are always set) 9256 response = ajaxConvert( s, response, jqXHR, isSuccess ); 9257 9258 // If successful, handle type chaining 9259 if ( isSuccess ) { 9260 9261 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9262 if ( s.ifModified ) { 9263 modified = jqXHR.getResponseHeader( "Last-Modified" ); 9264 if ( modified ) { 9265 jQuery.lastModified[ cacheURL ] = modified; 9266 } 9267 modified = jqXHR.getResponseHeader( "etag" ); 9268 if ( modified ) { 9269 jQuery.etag[ cacheURL ] = modified; 9270 } 9271 } 9272 9273 // if no content 9274 if ( status === 204 || s.type === "HEAD" ) { 9275 statusText = "nocontent"; 9276 9277 // if not modified 9278 } else if ( status === 304 ) { 9279 statusText = "notmodified"; 9280 9281 // If we have data, let's convert it 9282 } else { 9283 statusText = response.state; 9284 success = response.data; 9285 error = response.error; 9286 isSuccess = !error; 9287 } 9288 } else { 9289 9290 // Extract error from statusText and normalize for non-aborts 9291 error = statusText; 9292 if ( status || !statusText ) { 9293 statusText = "error"; 9294 if ( status < 0 ) { 9295 status = 0; 9296 } 9297 } 9298 } 9299 9300 // Set data for the fake xhr object 9301 jqXHR.status = status; 9302 jqXHR.statusText = ( nativeStatusText || statusText ) + ""; 9303 9304 // Success/Error 9305 if ( isSuccess ) { 9306 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); 9307 } else { 9308 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); 9309 } 9310 9311 // Status-dependent callbacks 9312 jqXHR.statusCode( statusCode ); 9313 statusCode = undefined; 9314 9315 if ( fireGlobals ) { 9316 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", 9317 [ jqXHR, s, isSuccess ? success : error ] ); 9318 } 9319 9320 // Complete 9321 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); 9322 9323 if ( fireGlobals ) { 9324 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); 9325 9326 // Handle the global AJAX counter 9327 if ( !( --jQuery.active ) ) { 9328 jQuery.event.trigger( "ajaxStop" ); 9329 } 9330 } 9331 } 9332 9333 return jqXHR; 9334 }, 9335 9336 getJSON: function( url, data, callback ) { 9337 return jQuery.get( url, data, callback, "json" ); 9338 }, 9339 9340 getScript: function( url, callback ) { 9341 return jQuery.get( url, undefined, callback, "script" ); 9342 } 9343} ); 9344 9345jQuery.each( [ "get", "post" ], function( i, method ) { 9346 jQuery[ method ] = function( url, data, callback, type ) { 9347 9348 // Shift arguments if data argument was omitted 9349 if ( isFunction( data ) ) { 9350 type = type || callback; 9351 callback = data; 9352 data = undefined; 9353 } 9354 9355 // The url can be an options object (which then must have .url) 9356 return jQuery.ajax( jQuery.extend( { 9357 url: url, 9358 type: method, 9359 dataType: type, 9360 data: data, 9361 success: callback 9362 }, jQuery.isPlainObject( url ) && url ) ); 9363 }; 9364} ); 9365 9366 9367jQuery._evalUrl = function( url ) { 9368 return jQuery.ajax( { 9369 url: url, 9370 9371 // Make this explicit, since user can override this through ajaxSetup (#11264) 9372 type: "GET", 9373 dataType: "script", 9374 cache: true, 9375 async: false, 9376 global: false, 9377 "throws": true 9378 } ); 9379}; 9380 9381 9382jQuery.fn.extend( { 9383 wrapAll: function( html ) { 9384 var wrap; 9385 9386 if ( this[ 0 ] ) { 9387 if ( isFunction( html ) ) { 9388 html = html.call( this[ 0 ] ); 9389 } 9390 9391 // The elements to wrap the target around 9392 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); 9393 9394 if ( this[ 0 ].parentNode ) { 9395 wrap.insertBefore( this[ 0 ] ); 9396 } 9397 9398 wrap.map( function() { 9399 var elem = this; 9400 9401 while ( elem.firstElementChild ) { 9402 elem = elem.firstElementChild; 9403 } 9404 9405 return elem; 9406 } ).append( this ); 9407 } 9408 9409 return this; 9410 }, 9411 9412 wrapInner: function( html ) { 9413 if ( isFunction( html ) ) { 9414 return this.each( function( i ) { 9415 jQuery( this ).wrapInner( html.call( this, i ) ); 9416 } ); 9417 } 9418 9419 return this.each( function() { 9420 var self = jQuery( this ), 9421 contents = self.contents(); 9422 9423 if ( contents.length ) { 9424 contents.wrapAll( html ); 9425 9426 } else { 9427 self.append( html ); 9428 } 9429 } ); 9430 }, 9431 9432 wrap: function( html ) { 9433 var htmlIsFunction = isFunction( html ); 9434 9435 return this.each( function( i ) { 9436 jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); 9437 } ); 9438 }, 9439 9440 unwrap: function( selector ) { 9441 this.parent( selector ).not( "body" ).each( function() { 9442 jQuery( this ).replaceWith( this.childNodes ); 9443 } ); 9444 return this; 9445 } 9446} ); 9447 9448 9449jQuery.expr.pseudos.hidden = function( elem ) { 9450 return !jQuery.expr.pseudos.visible( elem ); 9451}; 9452jQuery.expr.pseudos.visible = function( elem ) { 9453 return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); 9454}; 9455 9456 9457 9458 9459jQuery.ajaxSettings.xhr = function() { 9460 try { 9461 return new window.XMLHttpRequest(); 9462 } catch ( e ) {} 9463}; 9464 9465var xhrSuccessStatus = { 9466 9467 // File protocol always yields status code 0, assume 200 9468 0: 200, 9469
vendor: 1,240 bytes, lines 9470-9512
9470 // Support: IE <=9 only 9471 // #1450: sometimes IE returns 1223 when it should be 204 9472 1223: 204 9473 }, 9474 xhrSupported = jQuery.ajaxSettings.xhr(); 9475 9476support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); 9477support.ajax = xhrSupported = !!xhrSupported; 9478 9479jQuery.ajaxTransport( function( options ) { 9480 var callback, errorCallback; 9481 9482 // Cross domain only allowed if supported through XMLHttpRequest 9483 if ( support.cors || xhrSupported && !options.crossDomain ) { 9484 return { 9485 send: function( headers, complete ) { 9486 var i, 9487 xhr = options.xhr(); 9488 9489 xhr.open( 9490 options.type, 9491 options.url, 9492 options.async, 9493 options.username, 9494 options.password 9495 ); 9496 9497 // Apply custom fields if provided 9498 if ( options.xhrFields ) { 9499 for ( i in options.xhrFields ) { 9500 xhr[ i ] = options.xhrFields[ i ]; 9501 } 9502 } 9503 9504 // Override mime type if needed 9505 if ( options.mimeType && xhr.overrideMimeType ) { 9506 xhr.overrideMimeType( options.mimeType ); 9507 } 9508 9509 // X-Requested-With header 9510 // For cross-domain requests, seeing as conditions for a preflight are 9511 // akin to a jigsaw puzzle, we simply never set it to be sure. 9512 // (it can always be set on a per-request basis or even using ajaxSetup)
vendor: 5,627 bytes, lines 9513-9734
9513 // For same-domain requests, won't change header if already provided. 9514 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { 9515 headers[ "X-Requested-With" ] = "XMLHttpRequest"; 9516 } 9517 9518 // Set headers 9519 for ( i in headers ) { 9520 xhr.setRequestHeader( i, headers[ i ] ); 9521 } 9522 9523 // Callback 9524 callback = function( type ) { 9525 return function() { 9526 if ( callback ) { 9527 callback = errorCallback = xhr.onload = 9528 xhr.onerror = xhr.onabort = xhr.ontimeout = 9529 xhr.onreadystatechange = null; 9530 9531 if ( type === "abort" ) { 9532 xhr.abort(); 9533 } else if ( type === "error" ) { 9534 9535 // Support: IE <=9 only 9536 // On a manual native abort, IE9 throws 9537 // errors on any property access that is not readyState 9538 if ( typeof xhr.status !== "number" ) { 9539 complete( 0, "error" ); 9540 } else { 9541 complete( 9542 9543 // File: protocol always yields status 0; see #8605, #14207 9544 xhr.status, 9545 xhr.statusText 9546 ); 9547 } 9548 } else { 9549 complete( 9550 xhrSuccessStatus[ xhr.status ] || xhr.status, 9551 xhr.statusText, 9552 9553 // Support: IE <=9 only 9554 // IE9 has no XHR2 but throws on binary (trac-11426) 9555 // For XHR2 non-text, let the caller handle it (gh-2498) 9556 ( xhr.responseType || "text" ) !== "text" || 9557 typeof xhr.responseText !== "string" ? 9558 { binary: xhr.response } : 9559 { text: xhr.responseText }, 9560 xhr.getAllResponseHeaders() 9561 ); 9562 } 9563 } 9564 }; 9565 }; 9566 9567 // Listen to events 9568 xhr.onload = callback(); 9569 errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); 9570 9571 // Support: IE 9 only 9572 // Use onreadystatechange to replace onabort 9573 // to handle uncaught aborts 9574 if ( xhr.onabort !== undefined ) { 9575 xhr.onabort = errorCallback; 9576 } else { 9577 xhr.onreadystatechange = function() { 9578 9579 // Check readyState before timeout as it changes 9580 if ( xhr.readyState === 4 ) { 9581 9582 // Allow onerror to be called first, 9583 // but that will not handle a native abort 9584 // Also, save errorCallback to a variable 9585 // as xhr.onerror cannot be accessed 9586 window.setTimeout( function() { 9587 if ( callback ) { 9588 errorCallback(); 9589 } 9590 } ); 9591 } 9592 }; 9593 } 9594 9595 // Create the abort callback 9596 callback = callback( "abort" ); 9597 9598 try { 9599 9600 // Do send the request (this may raise an exception) 9601 xhr.send( options.hasContent && options.data || null ); 9602 } catch ( e ) { 9603 9604 // #14683: Only rethrow if this hasn't been notified as an error yet 9605 if ( callback ) { 9606 throw e; 9607 } 9608 } 9609 }, 9610 9611 abort: function() { 9612 if ( callback ) { 9613 callback(); 9614 } 9615 } 9616 }; 9617 } 9618} ); 9619 9620 9621 9622 9623// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) 9624jQuery.ajaxPrefilter( function( s ) { 9625 if ( s.crossDomain ) { 9626 s.contents.script = false; 9627 } 9628} ); 9629 9630// Install script dataType 9631jQuery.ajaxSetup( { 9632 accepts: { 9633 script: "text/javascript, application/javascript, " + 9634 "application/ecmascript, application/x-ecmascript" 9635 }, 9636 contents: { 9637 script: /\b(?:java|ecma)script\b/ 9638 }, 9639 converters: { 9640 "text script": function( text ) { 9641 jQuery.globalEval( text ); 9642 return text; 9643 } 9644 } 9645} ); 9646 9647// Handle cache's special case and crossDomain 9648jQuery.ajaxPrefilter( "script", function( s ) { 9649 if ( s.cache === undefined ) { 9650 s.cache = false; 9651 } 9652 if ( s.crossDomain ) { 9653 s.type = "GET"; 9654 } 9655} ); 9656 9657// Bind script tag hack transport 9658jQuery.ajaxTransport( "script", function( s ) { 9659 9660 // This transport only deals with cross domain requests 9661 if ( s.crossDomain ) { 9662 var script, callback; 9663 return { 9664 send: function( _, complete ) { 9665 script = jQuery( "<script>" ).prop( { 9666 charset: s.scriptCharset, 9667 src: s.url 9668 } ).on( 9669 "load error", 9670 callback = function( evt ) { 9671 script.remove(); 9672 callback = null; 9673 if ( evt ) { 9674 complete( evt.type === "error" ? 404 : 200, evt.type ); 9675 } 9676 } 9677 ); 9678 9679 // Use native DOM manipulation to avoid our domManip AJAX trickery 9680 document.head.appendChild( script[ 0 ] ); 9681 }, 9682 abort: function() { 9683 if ( callback ) { 9684 callback(); 9685 } 9686 } 9687 }; 9688 } 9689} ); 9690 9691 9692 9693 9694var oldCallbacks = [], 9695 rjsonp = /(=)\?(?=&|$)|\?\?/; 9696 9697// Default jsonp settings 9698jQuery.ajaxSetup( { 9699 jsonp: "callback", 9700 jsonpCallback: function() { 9701 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); 9702 this[ callback ] = true; 9703 return callback; 9704 } 9705} ); 9706 9707// Detect, normalize options and install callbacks for jsonp requests 9708jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 9709 9710 var callbackName, overwritten, responseContainer, 9711 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? 9712 "url" : 9713 typeof s.data === "string" && 9714 ( s.contentType || "" ) 9715 .indexOf( "application/x-www-form-urlencoded" ) === 0 && 9716 rjsonp.test( s.data ) && "data" 9717 ); 9718 9719 // Handle iff the expected data type is "jsonp" or we have a parameter to set 9720 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { 9721 9722 // Get callback name, remembering preexisting value associated with it 9723 callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ? 9724 s.jsonpCallback() : 9725 s.jsonpCallback; 9726 9727 // Insert callback into url or form data 9728 if ( jsonProp ) { 9729 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); 9730 } else if ( s.jsonp !== false ) { 9731 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; 9732 } 9733 9734 // Use data converter to retrieve json after script execution
vendor: 2,987 bytes, lines 9735-9844
9735 s.converters[ "script json" ] = function() { 9736 if ( !responseContainer ) { 9737 jQuery.error( callbackName + " was not called" ); 9738 } 9739 return responseContainer[ 0 ]; 9740 }; 9741 9742 // Force json dataType 9743 s.dataTypes[ 0 ] = "json"; 9744 9745 // Install callback 9746 overwritten = window[ callbackName ]; 9747 window[ callbackName ] = function() { 9748 responseContainer = arguments; 9749 }; 9750 9751 // Clean-up function (fires after converters) 9752 jqXHR.always( function() { 9753 9754 // If previous value didn't exist - remove it 9755 if ( overwritten === undefined ) { 9756 jQuery( window ).removeProp( callbackName ); 9757 9758 // Otherwise restore preexisting value 9759 } else { 9760 window[ callbackName ] = overwritten; 9761 } 9762 9763 // Save back as free 9764 if ( s[ callbackName ] ) { 9765 9766 // Make sure that re-using the options doesn't screw things around 9767 s.jsonpCallback = originalSettings.jsonpCallback; 9768 9769 // Save the callback name for future use 9770 oldCallbacks.push( callbackName ); 9771 } 9772 9773 // Call if it was a function and we have a response 9774 if ( responseContainer && isFunction( overwritten ) ) { 9775 overwritten( responseContainer[ 0 ] ); 9776 } 9777 9778 responseContainer = overwritten = undefined; 9779 } ); 9780 9781 // Delegate to script 9782 return "script"; 9783 } 9784} ); 9785 9786 9787 9788 9789// Support: Safari 8 only 9790// In Safari 8 documents created via document.implementation.createHTMLDocument 9791// collapse sibling forms: the second one becomes a child of the first one. 9792// Because of that, this security measure has to be disabled in Safari 8. 9793// https://bugs.webkit.org/show_bug.cgi?id=137337 9794support.createHTMLDocument = ( function() { 9795 var body = document.implementation.createHTMLDocument( "" ).body; 9796 body.innerHTML = "<form></form><form></form>"; 9797 return body.childNodes.length === 2; 9798} )(); 9799 9800 9801// Argument "data" should be string of html 9802// context (optional): If specified, the fragment will be created in this context, 9803// defaults to document 9804// keepScripts (optional): If true, will include scripts passed in the html string 9805jQuery.parseHTML = function( data, context, keepScripts ) { 9806 if ( typeof data !== "string" ) { 9807 return []; 9808 } 9809 if ( typeof context === "boolean" ) { 9810 keepScripts = context; 9811 context = false; 9812 } 9813 9814 var base, parsed, scripts; 9815 9816 if ( !context ) { 9817 9818 // Stop scripts or inline event handlers from being executed immediately 9819 // by using document.implementation 9820 if ( support.createHTMLDocument ) { 9821 context = document.implementation.createHTMLDocument( "" ); 9822 9823 // Set the base href for the created document 9824 // so any parsed elements with URLs 9825 // are based on the document's URL (gh-2965) 9826 base = context.createElement( "base" ); 9827 base.href = document.location.href; 9828 context.head.appendChild( base ); 9829 } else { 9830 context = document; 9831 } 9832 } 9833 9834 parsed = rsingleTag.exec( data ); 9835 scripts = !keepScripts && []; 9836 9837 // Single tag 9838 if ( parsed ) { 9839 return [ context.createElement( parsed[ 1 ] ) ]; 9840 } 9841 9842 parsed = buildFragment( [ data ], context, scripts ); 9843 9844 if ( scripts && scripts.length ) {
vendor: 14,511 bytes, lines 9845-10365
9845 jQuery( scripts ).remove(); 9846 } 9847 9848 return jQuery.merge( [], parsed.childNodes ); 9849}; 9850 9851 9852/** 9853 * Load a url into a page 9854 */ 9855jQuery.fn.load = function( url, params, callback ) { 9856 var selector, type, response, 9857 self = this, 9858 off = url.indexOf( " " ); 9859 9860 if ( off > -1 ) { 9861 selector = stripAndCollapse( url.slice( off ) ); 9862 url = url.slice( 0, off ); 9863 } 9864 9865 // If it's a function 9866 if ( isFunction( params ) ) { 9867 9868 // We assume that it's the callback 9869 callback = params; 9870 params = undefined; 9871 9872 // Otherwise, build a param string 9873 } else if ( params && typeof params === "object" ) { 9874 type = "POST"; 9875 } 9876 9877 // If we have elements to modify, make the request 9878 if ( self.length > 0 ) { 9879 jQuery.ajax( { 9880 url: url, 9881 9882 // If "type" variable is undefined, then "GET" method will be used. 9883 // Make value of this field explicit since 9884 // user can override it through ajaxSetup method 9885 type: type || "GET", 9886 dataType: "html", 9887 data: params 9888 } ).done( function( responseText ) { 9889 9890 // Save response for use in complete callback 9891 response = arguments; 9892 9893 self.html( selector ? 9894 9895 // If a selector was specified, locate the right elements in a dummy div 9896 // Exclude scripts to avoid IE 'Permission Denied' errors 9897 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : 9898 9899 // Otherwise use the full result 9900 responseText ); 9901 9902 // If the request succeeds, this function gets "data", "status", "jqXHR" 9903 // but they are ignored because response was set above. 9904 // If it fails, this function gets "jqXHR", "status", "error" 9905 } ).always( callback && function( jqXHR, status ) { 9906 self.each( function() { 9907 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); 9908 } ); 9909 } ); 9910 } 9911 9912 return this; 9913}; 9914 9915 9916 9917 9918// Attach a bunch of functions for handling common AJAX events 9919jQuery.each( [ 9920 "ajaxStart", 9921 "ajaxStop", 9922 "ajaxComplete", 9923 "ajaxError", 9924 "ajaxSuccess", 9925 "ajaxSend" 9926], function( i, type ) { 9927 jQuery.fn[ type ] = function( fn ) { 9928 return this.on( type, fn ); 9929 }; 9930} ); 9931 9932 9933 9934 9935jQuery.expr.pseudos.animated = function( elem ) { 9936 return jQuery.grep( jQuery.timers, function( fn ) { 9937 return elem === fn.elem; 9938 } ).length; 9939}; 9940 9941 9942 9943 9944jQuery.offset = { 9945 setOffset: function( elem, options, i ) { 9946 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, 9947 position = jQuery.css( elem, "position" ), 9948 curElem = jQuery( elem ), 9949 props = {}; 9950 9951 // Set position first, in-case top/left are set even on static elem 9952 if ( position === "static" ) { 9953 elem.style.position = "relative"; 9954 } 9955 9956 curOffset = curElem.offset(); 9957 curCSSTop = jQuery.css( elem, "top" ); 9958 curCSSLeft = jQuery.css( elem, "left" ); 9959 calculatePosition = ( position === "absolute" || position === "fixed" ) && 9960 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; 9961 9962 // Need to be able to calculate position if either 9963 // top or left is auto and position is either absolute or fixed 9964 if ( calculatePosition ) { 9965 curPosition = curElem.position(); 9966 curTop = curPosition.top; 9967 curLeft = curPosition.left; 9968 9969 } else { 9970 curTop = parseFloat( curCSSTop ) || 0; 9971 curLeft = parseFloat( curCSSLeft ) || 0; 9972 } 9973 9974 if ( isFunction( options ) ) { 9975 9976 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) 9977 options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); 9978 } 9979 9980 if ( options.top != null ) { 9981 props.top = ( options.top - curOffset.top ) + curTop; 9982 } 9983 if ( options.left != null ) { 9984 props.left = ( options.left - curOffset.left ) + curLeft; 9985 } 9986 9987 if ( "using" in options ) { 9988 options.using.call( elem, props ); 9989 9990 } else { 9991 curElem.css( props ); 9992 } 9993 } 9994}; 9995 9996jQuery.fn.extend( { 9997 9998 // offset() relates an element's border box to the document origin 9999 offset: function( options ) { 10000 10001 // Preserve chaining for setter 10002 if ( arguments.length ) { 10003 return options === undefined ? 10004 this : 10005 this.each( function( i ) { 10006 jQuery.offset.setOffset( this, options, i ); 10007 } ); 10008 } 10009 10010 var rect, win, 10011 elem = this[ 0 ]; 10012 10013 if ( !elem ) { 10014 return; 10015 } 10016 10017 // Return zeros for disconnected and hidden (display: none) elements (gh-2310) 10018 // Support: IE <=11 only 10019 // Running getBoundingClientRect on a 10020 // disconnected node in IE throws an error 10021 if ( !elem.getClientRects().length ) { 10022 return { top: 0, left: 0 }; 10023 } 10024 10025 // Get document-relative position by adding viewport scroll to viewport-relative gBCR 10026 rect = elem.getBoundingClientRect(); 10027 win = elem.ownerDocument.defaultView; 10028 return { 10029 top: rect.top + win.pageYOffset, 10030 left: rect.left + win.pageXOffset 10031 }; 10032 }, 10033 10034 // position() relates an element's margin box to its offset parent's padding box 10035 // This corresponds to the behavior of CSS absolute positioning 10036 position: function() { 10037 if ( !this[ 0 ] ) { 10038 return; 10039 } 10040 10041 var offsetParent, offset, doc, 10042 elem = this[ 0 ], 10043 parentOffset = { top: 0, left: 0 }; 10044 10045 // position:fixed elements are offset from the viewport, which itself always has zero offset 10046 if ( jQuery.css( elem, "position" ) === "fixed" ) { 10047 10048 // Assume position:fixed implies availability of getBoundingClientRect 10049 offset = elem.getBoundingClientRect(); 10050 10051 } else { 10052 offset = this.offset(); 10053 10054 // Account for the *real* offset parent, which can be the document or its root element 10055 // when a statically positioned element is identified 10056 doc = elem.ownerDocument; 10057 offsetParent = elem.offsetParent || doc.documentElement; 10058 while ( offsetParent && 10059 ( offsetParent === doc.body || offsetParent === doc.documentElement ) && 10060 jQuery.css( offsetParent, "position" ) === "static" ) { 10061 10062 offsetParent = offsetParent.parentNode; 10063 } 10064 if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) { 10065 10066 // Incorporate borders into its offset, since they are outside its content origin 10067 parentOffset = jQuery( offsetParent ).offset(); 10068 parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true ); 10069 parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true ); 10070 } 10071 } 10072 10073 // Subtract parent offsets and element margins 10074 return { 10075 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), 10076 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) 10077 }; 10078 }, 10079 10080 // This method will return documentElement in the following cases: 10081 // 1) For the element inside the iframe without offsetParent, this method will return 10082 // documentElement of the parent window 10083 // 2) For the hidden or detached element 10084 // 3) For body or html element, i.e. in case of the html node - it will return itself 10085 // 10086 // but those exceptions were never presented as a real life use-cases 10087 // and might be considered as more preferable results. 10088 // 10089 // This logic, however, is not guaranteed and can change at any point in the future 10090 offsetParent: function() { 10091 return this.map( function() { 10092 var offsetParent = this.offsetParent; 10093 10094 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { 10095 offsetParent = offsetParent.offsetParent; 10096 } 10097 10098 return offsetParent || documentElement; 10099 } ); 10100 } 10101} ); 10102 10103// Create scrollLeft and scrollTop methods 10104jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { 10105 var top = "pageYOffset" === prop; 10106 10107 jQuery.fn[ method ] = function( val ) { 10108 return access( this, function( elem, method, val ) { 10109 10110 // Coalesce documents and windows 10111 var win; 10112 if ( isWindow( elem ) ) { 10113 win = elem; 10114 } else if ( elem.nodeType === 9 ) { 10115 win = elem.defaultView; 10116 } 10117 10118 if ( val === undefined ) { 10119 return win ? win[ prop ] : elem[ method ]; 10120 } 10121 10122 if ( win ) { 10123 win.scrollTo( 10124 !top ? val : win.pageXOffset, 10125 top ? val : win.pageYOffset 10126 ); 10127 10128 } else { 10129 elem[ method ] = val; 10130 } 10131 }, method, val, arguments.length ); 10132 }; 10133} ); 10134 10135// Support: Safari <=7 - 9.1, Chrome <=37 - 49 10136// Add the top/left cssHooks using jQuery.fn.position 10137// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 10138// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 10139// getComputedStyle returns percent when specified for top/left/bottom/right; 10140// rather than make the css module depend on the offset module, just check for it here 10141jQuery.each( [ "top", "left" ], function( i, prop ) { 10142 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, 10143 function( elem, computed ) { 10144 if ( computed ) { 10145 computed = curCSS( elem, prop ); 10146 10147 // If curCSS returns percentage, fallback to offset 10148 return rnumnonpx.test( computed ) ? 10149 jQuery( elem ).position()[ prop ] + "px" : 10150 computed; 10151 } 10152 } 10153 ); 10154} ); 10155 10156 10157// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 10158jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { 10159 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, 10160 function( defaultExtra, funcName ) { 10161 10162 // Margin is only for outerHeight, outerWidth 10163 jQuery.fn[ funcName ] = function( margin, value ) { 10164 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), 10165 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); 10166 10167 return access( this, function( elem, type, value ) { 10168 var doc; 10169 10170 if ( isWindow( elem ) ) { 10171 10172 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) 10173 return funcName.indexOf( "outer" ) === 0 ? 10174 elem[ "inner" + name ] : 10175 elem.document.documentElement[ "client" + name ]; 10176 } 10177 10178 // Get document width or height 10179 if ( elem.nodeType === 9 ) { 10180 doc = elem.documentElement; 10181 10182 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], 10183 // whichever is greatest 10184 return Math.max( 10185 elem.body[ "scroll" + name ], doc[ "scroll" + name ], 10186 elem.body[ "offset" + name ], doc[ "offset" + name ], 10187 doc[ "client" + name ] 10188 ); 10189 } 10190 10191 return value === undefined ? 10192 10193 // Get width or height on the element, requesting but not forcing parseFloat 10194 jQuery.css( elem, type, extra ) : 10195 10196 // Set width or height on the element 10197 jQuery.style( elem, type, value, extra ); 10198 }, type, chainable ? margin : undefined, chainable ); 10199 }; 10200 } ); 10201} ); 10202 10203 10204jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " + 10205 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 10206 "change select submit keydown keypress keyup contextmenu" ).split( " " ), 10207 function( i, name ) { 10208 10209 // Handle event binding 10210 jQuery.fn[ name ] = function( data, fn ) { 10211 return arguments.length > 0 ? 10212 this.on( name, null, data, fn ) : 10213 this.trigger( name ); 10214 }; 10215} ); 10216 10217jQuery.fn.extend( { 10218 hover: function( fnOver, fnOut ) { 10219 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); 10220 } 10221} ); 10222 10223 10224 10225 10226jQuery.fn.extend( { 10227 10228 bind: function( types, data, fn ) { 10229 return this.on( types, null, data, fn ); 10230 }, 10231 unbind: function( types, fn ) { 10232 return this.off( types, null, fn ); 10233 }, 10234 10235 delegate: function( selector, types, data, fn ) { 10236 return this.on( types, selector, data, fn ); 10237 }, 10238 undelegate: function( selector, types, fn ) { 10239 10240 // ( namespace ) or ( selector, types [, fn] ) 10241 return arguments.length === 1 ? 10242 this.off( selector, "**" ) : 10243 this.off( types, selector || "**", fn ); 10244 } 10245} ); 10246 10247// Bind a function to a context, optionally partially applying any 10248// arguments. 10249// jQuery.proxy is deprecated to promote standards (specifically Function#bind) 10250// However, it is not slated for removal any time soon 10251jQuery.proxy = function( fn, context ) { 10252 var tmp, args, proxy; 10253 10254 if ( typeof context === "string" ) { 10255 tmp = fn[ context ]; 10256 context = fn; 10257 fn = tmp; 10258 } 10259 10260 // Quick check to determine if target is callable, in the spec 10261 // this throws a TypeError, but we will just return undefined. 10262 if ( !isFunction( fn ) ) { 10263 return undefined; 10264 } 10265 10266 // Simulated bind 10267 args = slice.call( arguments, 2 ); 10268 proxy = function() { 10269 return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); 10270 }; 10271 10272 // Set the guid of unique handler to the same of original handler, so it can be removed 10273 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 10274 10275 return proxy; 10276}; 10277 10278jQuery.holdReady = function( hold ) { 10279 if ( hold ) { 10280 jQuery.readyWait++; 10281 } else { 10282 jQuery.ready( true ); 10283 } 10284}; 10285jQuery.isArray = Array.isArray; 10286jQuery.parseJSON = JSON.parse; 10287jQuery.nodeName = nodeName; 10288jQuery.isFunction = isFunction; 10289jQuery.isWindow = isWindow; 10290jQuery.camelCase = camelCase; 10291jQuery.type = toType; 10292 10293jQuery.now = Date.now; 10294 10295jQuery.isNumeric = function( obj ) { 10296 10297 // As of jQuery 3.0, isNumeric is limited to 10298 // strings and numbers (primitives or objects) 10299 // that can be coerced to finite numbers (gh-2662) 10300 var type = jQuery.type( obj ); 10301 return ( type === "number" || type === "string" ) && 10302 10303 // parseFloat NaNs numeric-cast false positives ("") 10304 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 10305 // subtraction forces infinities to NaN 10306 !isNaN( obj - parseFloat( obj ) ); 10307}; 10308 10309 10310 10311 10312// Register as a named AMD module, since jQuery can be concatenated with other 10313// files that may use define, but not via a proper concatenation script that 10314// understands anonymous AMD modules. A named AMD is safest and most robust 10315// way to register. Lowercase jquery is used because AMD module names are 10316// derived from file names, and jQuery is normally delivered in a lowercase 10317// file name. Do this after creating the global so that if an AMD module wants 10318// to call noConflict to hide this version of jQuery, it will work. 10319 10320// Note that for maximum portability, libraries that are not jQuery should 10321// declare themselves as anonymous modules, and avoid setting a global if an 10322// AMD loader is present. jQuery is a special case. For more information, see 10323// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 10324 10325if ( typeof define === "function" && define.amd ) { 10326 define( "jquery", [], function() { 10327 return jQuery; 10328 } ); 10329} 10330 10331 10332 10333 10334var 10335 10336 // Map over jQuery in case of overwrite 10337 _jQuery = window.jQuery, 10338 10339 // Map over the $ in case of overwrite 10340 _$ = window.$; 10341 10342jQuery.noConflict = function( deep ) { 10343 if ( window.$ === jQuery ) { 10344 window.$ = _$; 10345 } 10346 10347 if ( deep && window.jQuery === jQuery ) { 10348 window.jQuery = _jQuery; 10349 } 10350 10351 return jQuery; 10352}; 10353 10354// Expose jQuery and $ identifiers, even in AMD 10355// (#7102#comment:10, https://github.com/jquery/jquery/pull/557) 10356// and CommonJS for browser emulators (#13566) 10357if ( !noGlobal ) { 10358 window.jQuery = window.$ = jQuery; 10359} 10360 10361 10362 10363 10364return jQuery; 10365} );
10366(function($, undefined) { 10367 10368/** 10369 * Unobtrusive scripting adapter for jQuery 10370 * https://github.com/rails/jquery-ujs 10371 * 10372 * Requires jQuery 1.8.0 or later. 10373 * 10374 * Released under the MIT license 10375 * 10376 */ 10377 10378 // Cut down on the number of issues from people inadvertently including jquery_ujs twice 10379 // by detecting and raising an error when it happens. 10380 'use strict'; 10381 10382 if ( $.rails !== undefined ) { 10383 $.error('jquery-ujs has already been loaded!'); 10384 } 10385 10386 // Shorthand to make it a little easier to call public rails functions from within rails.js 10387 var rails; 10388 var $document = $(document); 10389 10390 $.rails = rails = { 10391 // Link elements bound by jquery-ujs 10392 linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]', 10393 10394 // Button elements bound by jquery-ujs 10395 buttonClickSelector: 'button[data-remote]:not([form]):not(form button), button[data-confirm]:not([form]):not(form button)', 10396 10397 // Select elements bound by jquery-ujs 10398 inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]', 10399 10400 // Form elements bound by jquery-ujs 10401 formSubmitSelector: 'form', 10402 10403 // Form input elements bound by jquery-ujs 10404 formInputClickSelector: 'form input[type=submit], form input[type=image], form button[type=submit], form button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])', 10405 10406 // Form input elements disabled during form submission 10407 disableSelector: 'input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled', 10408 10409 // Form input elements re-enabled after form submission 10410 enableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled', 10411 10412 // Form required input elements 10413 requiredInputSelector: 'input[name][required]:not([disabled]), textarea[name][required]:not([disabled])', 10414 10415 // Form file input elements 10416 fileInputSelector: 'input[name][type=file]:not([disabled])', 10417 10418 // Link onClick disable selector with possible reenable after remote submission 10419 linkDisableSelector: 'a[data-disable-with], a[data-disable]', 10420 10421 // Button onClick disable selector with possible reenable after remote submission 10422 buttonDisableSelector: 'button[data-remote][data-disable-with], button[data-remote][data-disable]', 10423 10424 // Up-to-date Cross-Site Request Forgery token 10425 csrfToken: function() { 10426 return $('meta[name=csrf-token]').attr('content'); 10427 }, 10428 10429 // URL param that must contain the CSRF token 10430 csrfParam: function() { 10431 return $('meta[name=csrf-param]').attr('content'); 10432 }, 10433 10434 // Make sure that every Ajax request sends the CSRF token 10435 CSRFProtection: function(xhr) { 10436 var token = rails.csrfToken(); 10437 if (token) xhr.setRequestHeader('X-CSRF-Token', token); 10438 }, 10439 10440 // Make sure that all forms have actual up-to-date tokens (cached forms contain old ones) 10441 refreshCSRFTokens: function(){ 10442 $('form input[name="' + rails.csrfParam() + '"]').val(rails.csrfToken()); 10443 }, 10444 10445 // Triggers an event on an element and returns false if the event result is false 10446 fire: function(obj, name, data) { 10447 var event = $.Event(name); 10448 obj.trigger(event, data); 10449 return event.result !== false; 10450 }, 10451 10452 // Default confirm dialog, may be overridden with custom confirm dialog in $.rails.confirm 10453 confirm: function(message) { 10454 return confirm(message); 10455 }, 10456 10457 // Default ajax function, may be overridden with custom function in $.rails.ajax 10458 ajax: function(options) { 10459 return $.ajax(options); 10460 }, 10461 10462 // Default way to get an element's href. May be overridden at $.rails.href. 10463 href: function(element) { 10464 return element[0].href; 10465 }, 10466 10467 // Checks "data-remote" if true to handle the request through a XHR request. 10468 isRemote: function(element) { 10469 return element.data('remote') !== undefined && element.data('remote') !== false; 10470 }, 10471 10472 // Submits "remote" forms and links with ajax 10473 handleRemote: function(element) { 10474 var method, url, data, withCredentials, dataType, options; 10475 10476 if (rails.fire(element, 'ajax:before')) { 10477 withCredentials = element.data('with-credentials') || null; 10478 dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType); 10479 10480 if (element.is('form')) { 10481 method = element.data('ujs:submit-button-formmethod') || element.attr('method'); 10482 url = element.data('ujs:submit-button-formaction') || element.attr('action'); 10483 data = $(element[0]).serializeArray(); 10484 // memoized value from clicked submit button 10485 var button = element.data('ujs:submit-button'); 10486 if (button) { 10487 data.push(button); 10488 element.data('ujs:submit-button', null); 10489 } 10490 element.data('ujs:submit-button-formmethod', null); 10491 element.data('ujs:submit-button-formaction', null); 10492 } else if (element.is(rails.inputChangeSelector)) { 10493 method = element.data('method'); 10494 url = element.data('url'); 10495 data = element.serialize(); 10496 if (element.data('params')) data = data + '&' + element.data('params'); 10497 } else if (element.is(rails.buttonClickSelector)) { 10498 method = element.data('method') || 'get'; 10499 url = element.data('url'); 10500 data = element.serialize(); 10501 if (element.data('params')) data = data + '&' + element.data('params'); 10502 } else { 10503 method = element.data('method'); 10504 url = rails.href(element); 10505 data = element.data('params') || null; 10506 } 10507 10508 options = { 10509 type: method || 'GET', data: data, dataType: dataType, 10510 // stopping the "ajax:beforeSend" event will cancel the ajax request 10511 beforeSend: function(xhr, settings) { 10512 if (settings.dataType === undefined) { 10513 xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script); 10514 } 10515 if (rails.fire(element, 'ajax:beforeSend', [xhr, settings])) {
10516 element.trigger('ajax:send', xhr); 10517 } else { 10518 return false; 10519 } 10520 }, 10521 success: function(data, status, xhr) { 10522 element.trigger('ajax:success', [data, status, xhr]); 10523 }, 10524 complete: function(xhr, status) { 10525 element.trigger('ajax:complete', [xhr, status]); 10526 }, 10527 error: function(xhr, status, error) { 10528 element.trigger('ajax:error', [xhr, status, error]); 10529 }, 10530 crossDomain: rails.isCrossDomain(url) 10531 }; 10532 10533 // There is no withCredentials for IE6-8 when 10534 // "Enable native XMLHTTP support" is disabled 10535 if (withCredentials) { 10536 options.xhrFields = { 10537 withCredentials: withCredentials 10538 }; 10539 } 10540 10541 // Only pass url to `ajax` options if not blank 10542 if (url) { options.url = url; } 10543 10544 return rails.ajax(options); 10545 } else { 10546 return false; 10547 } 10548 }, 10549 10550 // Determines if the request is a cross domain request. 10551 isCrossDomain: function(url) { 10552 var originAnchor = document.createElement('a'); 10553 originAnchor.href = location.href; 10554 var urlAnchor = document.createElement('a'); 10555 10556 try { 10557 urlAnchor.href = url; 10558 // This is a workaround to a IE bug. 10559 urlAnchor.href = urlAnchor.href; 10560 10561 // If URL protocol is false or is a string containing a single colon 10562 // *and* host are false, assume it is not a cross-domain request 10563 // (should only be the case for IE7 and IE compatibility mode). 10564 // Otherwise, evaluate protocol and host of the URL against the origin 10565 // protocol and host. 10566 return !(((!urlAnchor.protocol || urlAnchor.protocol === ':') && !urlAnchor.host) || 10567 (originAnchor.protocol + '//' + originAnchor.host === 10568 urlAnchor.protocol + '//' + urlAnchor.host)); 10569 } catch (e) { 10570 // If there is an error parsing the URL, assume it is crossDomain. 10571 return true; 10572 } 10573 }, 10574 10575 // Handles "data-method" on links such as: 10576 // <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a> 10577 handleMethod: function(link) { 10578 var href = rails.href(link), 10579 method = link.data('method'), 10580 target = link.attr('target'), 10581 csrfToken = rails.csrfToken(), 10582 csrfParam = rails.csrfParam(), 10583 form = $('<form method="post" action="' + href + '"></form>'), 10584 metadataInput = '<input name="_method" value="' + method + '" type="hidden" />'; 10585 10586 if (csrfParam !== undefined && csrfToken !== undefined && !rails.isCrossDomain(href)) { 10587 metadataInput += '<input name="' + csrfParam + '" value="' + csrfToken + '" type="hidden" />'; 10588 } 10589 10590 if (target) { form.attr('target', target); } 10591 10592 form.hide().append(metadataInput).appendTo('body'); 10593 form.submit(); 10594 }, 10595 10596 // Helper function that returns form elements that match the specified CSS selector 10597 // If form is actually a "form" element this will return associated elements outside the from that have 10598 // the html form attribute set 10599 formElements: function(form, selector) { 10600 return form.is('form') ? $(form[0].elements).filter(selector) : form.find(selector); 10601 }, 10602 10603 /* Disables form elements: 10604 - Caches element value in 'ujs:enable-with' data store 10605 - Replaces element text with value of 'data-disable-with' attribute 10606 - Sets disabled property to true 10607 */ 10608 disableFormElements: function(form) { 10609 rails.formElements(form, rails.disableSelector).each(function() { 10610 rails.disableFormElement($(this)); 10611 }); 10612 }, 10613 10614 disableFormElement: function(element) { 10615 var method, replacement; 10616 10617 method = element.is('button') ? 'html' : 'val'; 10618 replacement = element.data('disable-with'); 10619 10620 if (replacement !== undefined) { 10621 element.data('ujs:enable-with', element[method]()); 10622 element[method](replacement); 10623 } 10624 10625 element.prop('disabled', true); 10626 element.data('ujs:disabled', true); 10627 }, 10628 10629 /* Re-enables disabled form elements: 10630 - Replaces element text with cached value from 'ujs:enable-with' data store (created in `disableFormElements`) 10631 - Sets disabled property to false 10632 */ 10633 enableFormElements: function(form) { 10634 rails.formElements(form, rails.enableSelector).each(function() { 10635 rails.enableFormElement($(this)); 10636 }); 10637 }, 10638 10639 enableFormElement: function(element) { 10640 var method = element.is('button') ? 'html' : 'val'; 10641 if (element.data('ujs:enable-with') !== undefined) { 10642 element[method](element.data('ujs:enable-with')); 10643 element.removeData('ujs:enable-with'); // clean up cache 10644 } 10645 element.prop('disabled', false); 10646 element.removeData('ujs:disabled'); 10647 }, 10648 10649 /* For 'data-confirm' attribute: 10650 - Fires `confirm` event 10651 - Shows the confirmation dialog 10652 - Fires the `confirm:complete` event 10653 10654 Returns `true` if no function stops the chain and user chose yes; `false` otherwise. 10655 Attaching a handler to the element's `confirm` event that returns a `falsy` value cancels the confirmation dialog. 10656 Attaching a handler to the element's `confirm:complete` event that returns a `falsy` value makes this function
10657 return false. The `confirm:complete` event is fired whether or not the user answered true or false to the dialog. 10658 */ 10659 allowAction: function(element) { 10660 var message = element.data('confirm'), 10661 answer = false, callback; 10662 if (!message) { return true; } 10663 10664 if (rails.fire(element, 'confirm')) { 10665 try { 10666 answer = rails.confirm(message); 10667 } catch (e) { 10668 (console.error || console.log).call(console, e.stack || e); 10669 } 10670 callback = rails.fire(element, 'confirm:complete', [answer]); 10671 } 10672 return answer && callback; 10673 }, 10674 10675 // Helper function which checks for blank inputs in a form that match the specified CSS selector 10676 blankInputs: function(form, specifiedSelector, nonBlank) { 10677 var foundInputs = $(), 10678 input, 10679 valueToCheck, 10680 radiosForNameWithNoneSelected, 10681 radioName, 10682 selector = specifiedSelector || 'input,textarea', 10683 requiredInputs = form.find(selector), 10684 checkedRadioButtonNames = {}; 10685 10686 requiredInputs.each(function() { 10687 input = $(this); 10688 if (input.is('input[type=radio]')) { 10689 10690 // Don't count unchecked required radio as blank if other radio with same name is checked, 10691 // regardless of whether same-name radio input has required attribute or not. The spec 10692 // states https://www.w3.org/TR/html5/forms.html#the-required-attribute 10693 radioName = input.attr('name'); 10694 10695 // Skip if we've already seen the radio with this name. 10696 if (!checkedRadioButtonNames[radioName]) { 10697 10698 // If none checked 10699 if (form.find('input[type=radio]:checked[name="' + radioName + '"]').length === 0) { 10700 radiosForNameWithNoneSelected = form.find( 10701 'input[type=radio][name="' + radioName + '"]'); 10702 foundInputs = foundInputs.add(radiosForNameWithNoneSelected); 10703 } 10704 10705 // We only need to check each name once. 10706 checkedRadioButtonNames[radioName] = radioName; 10707 } 10708 } else { 10709 valueToCheck = input.is('input[type=checkbox],input[type=radio]') ? input.is(':checked') : !!input.val(); 10710 if (valueToCheck === nonBlank) { 10711 foundInputs = foundInputs.add(input); 10712 } 10713 } 10714 }); 10715 return foundInputs.length ? foundInputs : false; 10716 }, 10717 10718 // Helper function which checks for non-blank inputs in a form that match the specified CSS selector 10719 nonBlankInputs: function(form, specifiedSelector) { 10720 return rails.blankInputs(form, specifiedSelector, true); // true specifies nonBlank 10721 }, 10722 10723 // Helper function, needed to provide consistent behavior in IE 10724 stopEverything: function(e) { 10725 $(e.target).trigger('ujs:everythingStopped'); 10726 e.stopImmediatePropagation(); 10727 return false; 10728 }, 10729 10730 // Replace element's html with the 'data-disable-with' after storing original html 10731 // and prevent clicking on it 10732 disableElement: function(element) { 10733 var replacement = element.data('disable-with'); 10734 10735 if (replacement !== undefined) { 10736 element.data('ujs:enable-with', element.html()); // store enabled state 10737 element.html(replacement); 10738 } 10739 10740 element.bind('click.railsDisable', function(e) { // prevent further clicking 10741 return rails.stopEverything(e); 10742 }); 10743 element.data('ujs:disabled', true); 10744 }, 10745 10746 // Restore element to its original state which was disabled by 'disableElement' above 10747 enableElement: function(element) { 10748 if (element.data('ujs:enable-with') !== undefined) { 10749 element.html(element.data('ujs:enable-with')); // set to old enabled state 10750 element.removeData('ujs:enable-with'); // clean up cache 10751 } 10752 element.unbind('click.railsDisable'); // enable element 10753 element.removeData('ujs:disabled'); 10754 } 10755 }; 10756 10757 if (rails.fire($document, 'rails:attachBindings')) { 10758 10759 $.ajaxPrefilter(function(options, originalOptions, xhr){ if ( !options.crossDomain ) { rails.CSRFProtection(xhr); }}); 10760 10761 // This event works the same as the load event, except that it fires every 10762 // time the page is loaded. 10763 // 10764 // See https://github.com/rails/jquery-ujs/issues/357 10765 // See https://developer.mozilla.org/en-US/docs/Using_Firefox_1.5_caching 10766 $(window).on('pageshow.rails', function () { 10767 $($.rails.enableSelector).each(function () { 10768 var element = $(this); 10769 10770 if (element.data('ujs:disabled')) { 10771 $.rails.enableFormElement(element); 10772 } 10773 }); 10774 10775 $($.rails.linkDisableSelector).each(function () { 10776 var element = $(this); 10777 10778 if (element.data('ujs:disabled')) { 10779 $.rails.enableElement(element); 10780 } 10781 }); 10782 }); 10783 10784 $document.on('ajax:complete', rails.linkDisableSelector, function() { 10785 rails.enableElement($(this)); 10786 }); 10787 10788 $document.on('ajax:complete', rails.buttonDisableSelector, function() { 10789 rails.enableFormElement($(this)); 10790 }); 10791 10792 $document.on('click.rails', rails.linkClickSelector, function(e) { 10793 var link = $(this), method = link.data('method'), data = link.data('params'), metaClick = e.metaKey || e.ctrlKey; 10794 if (!rails.allowAction(link)) return rails.stopEverything(e); 10795 10796 if (!metaClick && link.is(rails.linkDisableSelector)) rails.disableElement(link); 10797 10798 if (rails.isRemote(link)) { 10799 if (metaClick && (!method || method === 'GET') && !data) { return true; } 10800 10801 var handleRemote = rails.handleRemote(link); 10802 // Response from rails.handleRemote() will either be false or a deferred object promise. 10803 if (handleRemote === false) { 10804 rails.enableElement(link); 10805 } else { 10806 handleRemote.fail( function() { rails.enableElement(link); } ); 10807 } 10808 return false;
10809 10810 } else if (method) { 10811 rails.handleMethod(link); 10812 return false; 10813 } 10814 }); 10815 10816 $document.on('click.rails', rails.buttonClickSelector, function(e) { 10817 var button = $(this); 10818 10819 if (!rails.allowAction(button) || !rails.isRemote(button)) return rails.stopEverything(e); 10820 10821 if (button.is(rails.buttonDisableSelector)) rails.disableFormElement(button); 10822 10823 var handleRemote = rails.handleRemote(button); 10824 // Response from rails.handleRemote() will either be false or a deferred object promise. 10825 if (handleRemote === false) { 10826 rails.enableFormElement(button); 10827 } else { 10828 handleRemote.fail( function() { rails.enableFormElement(button); } ); 10829 } 10830 return false; 10831 }); 10832 10833 $document.on('change.rails', rails.inputChangeSelector, function(e) { 10834 var link = $(this); 10835 if (!rails.allowAction(link) || !rails.isRemote(link)) return rails.stopEverything(e); 10836 10837 rails.handleRemote(link); 10838 return false; 10839 }); 10840 10841 $document.on('submit.rails', rails.formSubmitSelector, function(e) { 10842 var form = $(this), 10843 remote = rails.isRemote(form), 10844 blankRequiredInputs, 10845 nonBlankFileInputs; 10846 10847 if (!rails.allowAction(form)) return rails.stopEverything(e); 10848 10849 // Skip other logic when required values are missing or file upload is present 10850 if (form.attr('novalidate') === undefined) { 10851 if (form.data('ujs:formnovalidate-button') === undefined) { 10852 blankRequiredInputs = rails.blankInputs(form, rails.requiredInputSelector, false); 10853 if (blankRequiredInputs && rails.fire(form, 'ajax:aborted:required', [blankRequiredInputs])) { 10854 return rails.stopEverything(e); 10855 } 10856 } else { 10857 // Clear the formnovalidate in case the next button click is not on a formnovalidate button 10858 // Not strictly necessary to do here, since it is also reset on each button click, but just to be certain 10859 form.data('ujs:formnovalidate-button', undefined); 10860 } 10861 } 10862 10863 if (remote) { 10864 nonBlankFileInputs = rails.nonBlankInputs(form, rails.fileInputSelector); 10865 if (nonBlankFileInputs) { 10866 // Slight timeout so that the submit button gets properly serialized 10867 // (make it easy for event handler to serialize form without disabled values) 10868 setTimeout(function(){ rails.disableFormElements(form); }, 13); 10869 var aborted = rails.fire(form, 'ajax:aborted:file', [nonBlankFileInputs]); 10870 10871 // Re-enable form elements if event bindings return false (canceling normal form submission) 10872 if (!aborted) { setTimeout(function(){ rails.enableFormElements(form); }, 13); } 10873 10874 return aborted; 10875 } 10876 10877 rails.handleRemote(form); 10878 return false; 10879 10880 } else { 10881 // Slight timeout so that the submit button gets properly serialized 10882 setTimeout(function(){ rails.disableFormElements(form); }, 13); 10883 } 10884 }); 10885 10886 $document.on('click.rails', rails.formInputClickSelector, function(event) { 10887 var button = $(this); 10888 10889 if (!rails.allowAction(button)) return rails.stopEverything(event); 10890 10891 // Register the pressed submit button 10892 var name = button.attr('name'), 10893 data = name ? {name:name, value:button.val()} : null; 10894 10895 var form = button.closest('form'); 10896 if (form.length === 0) { 10897 form = $('#' + button.attr('form')); 10898 } 10899 form.data('ujs:submit-button', data); 10900 10901 // Save attributes from button 10902 form.data('ujs:formnovalidate-button', button.attr('formnovalidate')); 10903 form.data('ujs:submit-button-formaction', button.attr('formaction')); 10904 form.data('ujs:submit-button-formmethod', button.attr('formmethod')); 10905 }); 10906 10907 $document.on('ajax:send.rails', rails.formSubmitSelector, function(event) { 10908 if (this === event.target) rails.disableFormElements($(this)); 10909 }); 10910 10911 $document.on('ajax:complete.rails', rails.formSubmitSelector, function(event) { 10912 if (this === event.target) rails.enableFormElements($(this)); 10913 }); 10914 10915 $(function(){ 10916 rails.refreshCSRFTokens(); 10917 }); 10918 } 10919 10920})( jQuery ); 10921/* Modernizr 2.6.2 (Custom Build) | MIT & BSD 10922 * Build: http://modernizr.com/download/#-csstransforms3d-touch-shiv-cssclasses-prefixed-teststyles-testprop-testallprops-prefixes-domprefixes-load 10923 */ 10924 10925;window.Modernizr=function(a,b,c){function z(a){j.cssText=a}function A(a,b){return z(m.join(a+";")+(b||""))}function B(a,b){return typeof a===b}function C(a,b){return!!~(""+a).indexOf(b)}function D(a,b){for(var d in a){var e=a[d];if(!C(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function E(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:B(f,"function")?f.bind(d||b):f}return!1}function F(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+o.join(d+" ")+d).split(" ");return B(b,"string")||B(b,"undefined")?D(e,b):(e=(a+" "+p.join(d+" ")+d).split(" "),E(e,b,c))}var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m=" -webkit- -moz- -o- -ms- ".split(" "),n="Webkit Moz O ms",o=n.split(" "),p=n.toLowerCase().split(" "),q={},r={},s={},t=[],u=t.slice,v,w=function(a,c,d,e){var f,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),l.appendChild(j);return f=["­",'<style id="s',h,'">',a,"</style>"].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},x={}.hasOwnProperty,y;!B(x,"undefined")&&!B(x.call,"undefined")?y=function(a,b){return x.call(a,b)}:y=function(a,b){return b in a&&B(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;
vendor: 9,271 bytes, lines 10925-10970
10925var d=u.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(u.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(u.call(arguments)))};return e}),q.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:w(["@media (",m.join("touch-enabled),("),h,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=a.offsetTop===9}),c},q.csstransforms3d=function(){var a=!!F("perspective");return a&&"webkitPerspective"in g.style&&w("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(b,c){a=b.offsetLeft===9&&b.offsetHeight===3}),a};for(var G in q)y(q,G)&&(v=G.toLowerCase(),e[v]=q[G](),t.push((e[v]?"":"no-")+v));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)y(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},z(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e<g;e++)d.createElement(f[e]);return d}function p(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return r.shivMethods?n(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+l().join().replace(/\w+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(r,b.frag)}function q(a){a||(a=b);var c=m(a);return r.shivCSS&&!f&&!c.hasCSS&&(c.hasCSS=!!k(a,"article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#FF0;color:#000}")),j||p(a,c),a}var c=a.html5||{},d=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,e=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,f,g="_html5shiv",h=0,i={},j;(function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._prefixes=m,e._domPrefixes=p,e._cssomPrefixes=o,e.testProp=function(a){return D([a])},e.testAllProps=F,e.testStyles=w,e.prefixed=function(a,b,c){return b?F(a,b,c):F(a,"pfx")},g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+t.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f<d;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));for(f=0;f<b;f++)c=x[f](c);return c}function g(a,e,f,g,h){var i=b(a),j=i.autoCallback;i.url.split(".").pop().split("?").shift(),i.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]),i.instead?i.instead(a,e,f,g,h):(y[i.url]?i.noexec=!0:y[i.url]=1,f.load(i.url,i.forceCSS||!i.forceJS&&"css"==i.url.split(".").pop().split("?").shift()?"c":c,i.noexec,i.attrs,i.timeout),(d(e)||d(j))&&f.load(function(){k(),e&&e(i.origUrl,h,g),j&&j(i.origUrl,h,g),y[i.url]=2})))}function h(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;return b}(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&&l()}var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;c(h?a.yep:a.nope,!!i),i&&c(i)}var i,j,l=this.yepnope.loader;if(e(a))g(a,0,l,0);else if(w(a))for(i=0;i<a.length;i++)j=a[i],e(j)?g(j,0,l,0):w(j)?B(j):Object(j)===j&&h(j,l);else Object(a)===a&&h(a,l)},B.addPrefix=function(a,b){z[a]=b},B.addFilter=function(a){x.push(a)},B.errorTimeout=1e4,null==b.readyState&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var k=b.createElement("script"),l,o,e=e||B.errorTimeout;k.src=a;for(o in d)k.setAttribute(o,d[o]);c=j?h:c||f,k.onreadystatechange=k.onload=function(){!l&&g(k.readyState)&&(l=1,c(),k.onload=k.onreadystatechange=null)},m(function(){l||(l=1,c(1))},e),i?k.onload():n.parentNode.insertBefore(k,n)},a.yepnope.injectCss=function(a,c,d,e,g,i){var e=b.createElement("link"),j,c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(n.parentNode.insertBefore(e,n),m(c,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))}; 10926$(document).ready(function() { 10927 var $books = $( '#bk-list > li > div.bk-book' ), booksCount = $books.length; 10928 10929 $books.each( function() { 10930 var $book = $( this ), 10931 $other = $books.not( $book ), 10932 $parent = $book.parent(), 10933 $page = $book.children( 'div.bk-page' ), 10934 $bookview = $parent.find( 'button.bk-bookview' ), 10935 $content = $page.children( 'div.bk-content' ), current = 0; 10936 10937 // $parent.find( 'button.bk-bookback' ).on( 'click', function() { 10938 // $bookview.removeClass( 'bk-active' ); 10939 // if( $book.data( 'flip' ) ) { 10940 // $book.data( { opened : false, flip : false } ).removeClass( 'bk-viewback' ).addClass( 'bk-bookdefault' ); 10941 // } 10942 // else { 10943 // $book.data( { opened : false, flip : true } ).removeClass( 'bk-viewinside bk-bookdefault' ).addClass( 'bk-viewback' ); 10944 // } 10945 // } ); 10946 10947 $bookview.on( 'click', function() { 10948 10949 var $this = $( this ); 10950 $other.data( 'opened', false ).removeClass( 'bk-viewinside' ).parent().css( 'z-index', 0 ).find( 'button.bk-bookview' ).removeClass( 'bk-active' ); 10951 if( !$other.hasClass( 'bk-viewback' ) ) { 10952 $other.addClass( 'bk-bookdefault' ); 10953 } 10954 10955 if( $book.data( 'opened' ) ) { 10956 $this.removeClass( 'bk-active' ); 10957 $book.data( { opened : false, flip : false } ).removeClass( 'bk-viewinside' ).addClass( 'bk-bookdefault' ); 10958 } 10959 else { 10960 $this.addClass( 'bk-active' ); 10961 $book.data( { opened : true, flip : false } ).removeClass( 'bk-viewback bk-bookdefault' ).addClass( 'bk-viewinside' ); 10962 $parent.css( 'z-index', booksCount ); 10963 current = 0; 10964 $content.removeClass( 'bk-content-current' ).eq( current ).addClass( 'bk-content-current' ); 10965 } 10966 10967 } ); 10968 10969 if( $content.length > 1 ) { 10970
10971 var $navPrev = $( '<span class="bk-page-prev"><</span>' ), $navNext = $( '<span class="bk-page-next">></span>' ); 10972 $page.append( $( '<nav></nav>' ).append( $navPrev, $navNext ) ); 10973 10974 $navPrev.on( 'click', function() { 10975 if( current > 0 ) { 10976 --current; 10977 $content.removeClass( 'bk-content-current' ).eq( current ).addClass( 'bk-content-current' ); 10978 } 10979 return false; 10980 } ); 10981 10982 $navNext.on( 'click', function() { 10983 if( current < $content.length - 1 ) { 10984 ++current; 10985 $content.removeClass( 'bk-content-current' ).eq( current ).addClass( 'bk-content-current' ); 10986 } 10987 return false; 10988 } ); 10989 } 10990 }); 10991}); 10992$(document).ready(function () { 10993 if (mobile_version()) { 10994 $('#mobile_version').attr('value', 'yes') 10995 } 10996 $('#cover_subtitle').keypress(function (e) { 10997 if (e.keyCode == 13) { 10998 e.preventDefault(); 10999 return false; 11000 } 11001 }); 11002 11003 $('#cover_title').keypress(function (e) { 11004 if (e.keyCode == 13) { 11005 e.preventDefault(); 11006 return false; 11007 } 11008 }); 11009 11010 $('#playground_form').on('input', '#cover_title', function () { 11011 remove_extra_line("#cover_title") 11012 $('.cover_title').html($(this).html()); 11013 }); 11014 11015 $('#playground_form').on('input', '#cover_subtitle', function () { 11016 remove_extra_line("#cover_subtitle") 11017 $('.cover_subtitle').html($(this).html()); 11018 }); 11019 11020 function remove_extra_line(Object) { 11021 if ($(Object + " > p").length > 1) { 11022 $(Object + " > p").each(function () { 11023 $(this).replaceWith($(this).text() + " "); 11024 }); 11025 $(Object).wrapInner("<p></p>"); 11026 } 11027 } 11028 11029 $('#playground_form').on('input', '#cover_author_first_name', function () { 11030 $('#author_first_name').html($(this).val()); 11031 }); 11032 11033 $('#playground_form').on('input', '#cover_author_last_name', function () { 11034 $('#author_last_name').html($(this).val()); 11035 }); 11036 11037 $('#playground_form').on('input', '#cover_blurb', function () { 11038 $('.cover_back_blurb').html($(this).html()); 11039 }); 11040 11041 $('#playground_form').on('input', '#cover_vita', function () { 11042 $('.cover_back_vita').html($(this).html()); 11043 }); 11044 11045 $(document).on('click', 'button.bk-bookback', function () { 11046 $('.book-1').toggleClass('bk-bookdefault bk-viewback'); 11047 }); 11048 11049 $(document).on('click', 'button.select-imprint', function (event) { 11050 11051 const imprintId = $(event.target).parent().data('imprint-id'); 11052 end_point = '/cover_playgrounds/' + $('#project_playground_token').val() + '/set_selected_imprint' 11053 11054 $.ajax({ 11055 type: 'PUT', 11056 async: true, 11057 data: { imprint_id: imprintId }, 11058 url: end_point, 11059 beforeSend: function (xhr) { 11060 xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content')); 11061 $("#loader").removeClass('hidden'); 11062 }, 11063 success: function (data) { 11064 $("#loader").addClass('hidden'); 11065 $('#second_step').addClass('hidden'); 11066 $('#first_step').removeClass('hidden'); 11067 } 11068 }); 11069 11070 }); 11071 11072 $(document).on('click', 'button.choose-layout', function () { 11073 11074 end_point = '/cover_playgrounds/' + $('#project_playground_token').val() + '/choose_cover_layout' 11075 11076 $.ajax({ 11077 type: 'GET', 11078 async: true, 11079 url: end_point, 11080 beforeSend: function (xhr) { 11081 xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content')); 11082 $("#loader").removeClass('hidden'); 11083 }, 11084 success: function (data) { 11085 $("#loader").addClass('hidden'); 11086 $('#ing_image_code_form_field').val('') 11087 } 11088 }); 11089 11090 }); 11091 11092 $('.playground-page').on('click', '#make_book', function (e) { 11093 console.log('click on make_book', e) 11094 11095 e.preventDefault() 11096 e.stopPropagation() 11097 e.stopImmediatePropagation() 11098 11099 const make_book_link = $(e.target).closest('a') 11100 if ($('#validation-form').valid()) { 11101 window.location = make_book_link.data('url') 11102 }else{ 11103 $('#validation-form').validate() 11104 } 11105 }) 11106 11107 $('.playground-page').on('click', '#go_to_next_step, #back_cover_btn', function () { 11108 validator = $("#validation-form").validate(); 11109 author_fields_validity = true 11110 11111 $(".coauthor_field").each(function () { 11112 author_fields_validity = validator.element($(this)) 11113 11114 if (!author_fields_validity) 11115 return false;
11116 }); 11117 11118 if (author_fields_validity && validator.element('#cover_title') && validator.element('#cover_subtitle') && validator.element('#cover_author_first_name') && validator.element('#cover_author_last_name') && validator.element('#ing_image_code_form_field')) { 11119 end_point = '/cover_playgrounds/' + $('#project_playground_token').val() + '/store_cover_front_details' 11120 11121 $.ajax({ 11122 type: 'PUT', 11123 async: true, 11124 url: end_point, 11125 data: $('#validation-form').serialize(), 11126 beforeSend: function (xhr) { 11127 xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content')); 11128 $("#loader").removeClass('hidden'); 11129 }, 11130 success: function (data) { 11131 piwik_service.trackEvent('playground', 'font_cover', 'completed_front_cover_step'); 11132 $("#loader").addClass('hidden'); 11133 if (data.success) { 11134 $('#first_step').addClass('hidden'); 11135 $('#second_step').removeClass('hidden'); 11136 $('#cover_face').text('Back Cover'); 11137 $('#cover_face_icon').addClass('fa-rotate-180 fa-flip-horizontal'); 11138 11139 $('.book-1').removeClass('bk-bookdefault'); 11140 $('.book-1').addClass('bk-viewback'); 11141 11142 $('#front_cover_section').removeClass('active'); 11143 $('#back_cover_section').addClass('active'); 11144 11145 if ($('#project_email').val() === '') { 11146 $('#account-email-modal').modal('show'); 11147 } 11148 11149 uppy = Uppy.Core({ 11150 debug: true, 11151 autoProceed: true, 11152 restrictions: { allowedFileTypes: [ '.jpg', '.jpeg', '.png', '.bmp' ] } 11153 }) 11154 11155 if ($('.UppyInput').length && $('.uppy-FileInput-input').length == 0) { 11156 uppy 11157 .use(Uppy.FileInput, { 11158 target: '.UppyInput', 11159 pretty: true, 11160 input_string: $('.grid').data('upload-file-text') 11161 }) 11162 .use(Uppy.XHRUpload, { 11163 endpoint: '/cover_playgrounds/upload_author_image?playground_token=' + $('#project_playground_token').val(), 11164 headers: { 11165 'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content') 11166 } 11167 }) 11168 .use(Uppy.StatusBar, { 11169 target: '.UppyInput-Progress', 11170 hideUploadButton: true, 11171 hideAfterFinish: false 11172 }) 11173 11174 uppy.on('upload-success', (result) => { 11175 $.ajax({ 11176 type: 'GET', 11177 async: true, 11178 url: '/cover_playgrounds/display_uploaded_author_image?playground_token=' + $('#project_playground_token').val(), 11179 beforeSend: function (xhr) { 11180 xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content')) 11181 }, 11182 }); 11183 }); 11184 } 11185 } else { 11186 alert(data.error) 11187 } 11188 } 11189 }); 11190 } 11191 11192 if (mobile_version()) { 11193 slide_to_section('#cover_section'); 11194 } 11195 }); 11196 11197 $('.playground-page').on('click', '#back_btn, #front_cover_btn', function () { 11198 $('#first_step').removeClass('hidden'); 11199 $('#second_step').addClass('hidden'); 11200 $('#cover_face').text('Front Cover'); 11201 $('#cover_face_icon').removeClass('fa-rotate-180 fa-flip-horizontal'); 11202 11203 $('.book-1').removeClass('bk-viewback'); 11204 $('.book-1').addClass('bk-bookdefault'); 11205 11206 $('#front_cover_section').addClass('active'); 11207 $('#back_cover_section').removeClass('active'); 11208 11209 if (mobile_version()) { 11210 slide_to_section('#cover_section'); 11211 } 11212 }); 11213 11214 $('#disable_emails').on('change', function () { 11215 $('#project_disable_author_emails').attr("value", this.checked); 11216 }); 11217 11218 $('#language_select').on('change', function () { 11219 searchParams = new URLSearchParams(window.location.search); 11220 searchParams.set("locale", encodeURIComponent($(this).val())); 11221 window.location.search = searchParams.toString(); 11222 }); 11223 11224 $('#parent_isbn_selection_btn').on('click', function () { 11225 isbn_selection_validatior = $("#parent_isbn_selection").validate(); 11226 11227 if (isbn_selection_validatior.element('#isbn') && isbn_selection_validatior.element('#imprint_code')) { 11228 $('#cover_check_overlay').show() 11229 $('#cover_image_search_loader').removeClass('hidden'); 11230 $('#parent_isbn_selection').submit(); 11231 } 11232 }); 11233 11234 $('body').on('click', "#translation_yes", function () { 11235 $('#deepl_translation').val('yes') 11236 $('.parent_isbn_selection_box').removeClass('hide'); 11237 $('.parent_isbn_selection_box').slideDown(); 11238 if ($('#is_translate_field').data('default') == 'yes') { 11239 $('#translate_section_field').addClass('hide') 11240 $('#is_translate_field').attr('value', 'no') 11241 } 11242 }); 11243 11244 $('body').on('click', "#translation_no", function () { 11245 $('#deepl_translation').val('no') 11246 $('.parent_isbn_selection_box').fadeOut(); 11247 $('.parent_isbn_selection_box').addClass('hide'); 11248 if ($('#is_translate_field').data('default') == 'yes') { 11249 $('#translate_section_field').removeClass('hide'); 11250 $('#translate_section_field').slideDown(); 11251 $('#is_translate_field').attr('value', 'yes') 11252 } 11253 11254 $('#cover_check_overlay').show() 11255 $('#cover_image_search_loader').removeClass('hidden'); 11256 $('#parent_isbn_selection').submit(); 11257 }); 11258 11259 $('#cover_check_imprint_selection').on('change', function () { 11260 $('#cover_check_overlay').show() 11261 $('#cover_image_search_loader').removeClass('hidden'); 11262 $('#imprint_selection_form').submit(); 11263 }); 11264 11265 if (mobile_version()) { 11266 slide_to_section('#cover_section'); 11267 11268 $('.book-1').on('click', function () { 11269 slide_to_section('#cover_face'); 11270 }); 11271 } 11272 11273 $('#playground_form').on('click', '#remove-author', function () { 11274 $('#co_authors').children('.single_coauthor').last().remove(); 11275 $('#cover_co_authors').children('.single_coauthor').last().remove(); 11276 $('#add-author').attr('href', '/cover_playgrounds/' + $('#project_playground_token').val() + '/add_coauthor?coauthors_count=' + $('#co_authors').find('.single_coauthor').length); 11277 11278 if ($('#co_authors').find('.single_coauthor').length == 0) { 11279 $(this).addClass('hidden'); 11280 } 11281 }); 11282 11283 $('#playground_form').on('input', '#co_authors input', function () { 11284 target_id = $(this).attr('id'); 11285 $('#cover_' + target_id).html($(this).val()); 11286 }); 11287 11288 $('#playground_form').on('click', '#submit_btn', function () { 11289 piwik_service.trackEvent('playground', 'back_cover', 'completed_back_cover_step') 11290 $('#validation-form').submit(); 11291 }); 11292 11293 $('#playground_form').on('input', '#ing_image_code_field', function () { 11294 $('#ing_image_code_form_field').val($(this).val()) 11295 }); 11296 11297 $(document).on('click', '.browse', function () { 11298 var file = $(this).parent().parent().parent().find('.file'); 11299 file.trigger('click'); 11300 }); 11301 11302 $(document).on('change', '.file', function () { 11303 $(this).parent().find('.form-control').val($(this).val().replace(/C:\\fakepath\\/i, '')); 11304 }); 11305 11306 $('.make-a-book-form-docx').on('click', '#go_to_author_details', function () { 11307 validator = $("#validation-form").validate(); 11308 11309 if (validator.element('#manuscript_input') && validator.element('#book_tag_list') && validator.element('#book_category_select') && validator.element('#book_language_select') && validator.element('#cover_shorttitle')) { 11310 if ($('.translation_radio').length == 0 || $('#translation_no').is(':checked') || ($('#translation_yes').is(':checked') && validator.element('#translation_isbn'))) { 11311 end_point = '/cover_playgrounds/' + $('#author_playground_token').val() + '/store_make_book_first_step' 11312 11313 $.ajax({ 11314 type: 'POST', 11315 async: true, 11316 url: end_point, 11317 data: $('#validation-form').serialize(), 11318 beforeSend: function (xhr) { 11319 xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content')); 11320 $("#loader").removeClass('hidden'); 11321 }, 11322 success: function (data) { 11323 piwik_service.trackEvent('playground', 'make_a_book', 'make_a_book_first_step') 11324 $("#loader").addClass('hidden'); 11325 $('.first-section').addClass('hidden'); 11326 $('.translations-form').addClass('hidden'); 11327 $('#form_section').attr('class', '').addClass('col-xs-12 col-sm-12 col-md-12 col-lg-12'); 11328 $('#cover_section').addClass('hidden'); 11329 11330 $('.second-section').removeClass('hidden'); 11331 $('#cover_face').text($('#translated-headings').data('author-details')); 11332 }, 11333 error: function (response, status, error) { 11334 $("#loader").addClass('hidden'); 11335 var res = jQuery.parseJSON(response.responseText); 11336 alert(res.message) 11337 } 11338 }); 11339 } 11340 } 11341 }); 11342 11343 $('.make-a-book-form').on('click', '#back_to_make_book', function () { 11344 $('.first-section').removeClass('hidden'); 11345 $('.translations-form').removeClass('hidden'); 11346 $('#cover_section').removeClass('hidden'); 11347 11348 $('#form_section').attr('class', '').addClass('col-xs-12 col-sm-7 col-md-7 col
11348-lg-7') 11349 $('.second-section').addClass('hidden'); 11350 $('#cover_face').text($('#translated-headings').data('make-book')); 11351 }); 11352 11353 $('.make-a-book-form').on('change', '#book_category_select', function () { 11354 $('#categoryentry_num').val($("option:selected", this).data('category_num')); 11355 }); 11356 11357 $('.make-a-book-form').on('input', '#book_language_select', function () { 11358 $('#project_country_id').val($(this).val()); 11359 }); 11360 11361 $('.make-a-book-form').on('input', '#author_first_name', function () { 11362 $('#account_forname').val($(this).val()); 11363 }); 11364 11365 $('.make-a-book-form').on('input', '#author_last_name', function () { 11366 $('#account_surename').val($(this).val()); 11367 }); 11368 11369 $('.make-a-book-form').on('input', '#author_email', function () { 11370 $('#account_email').val($(this).val()); 11371 }); 11372 11373 $('#account_email').val($('#author_email').val()) 11374 $('#account_forname').val($('#author_first_name').val()) 11375 $('#account_surename').val($('#author_last_name').val()) 11376 $('#project_country_id').val($('#book_language_select').val()) 11377 11378 $('.make-a-book-form-docx').on('change', '#docx_input', function () { 11379 if ($(this)[0].files.length == 0) 11380 return 11381 11382 var val = $(this).val().toLowerCase(); 11383 var regex = new RegExp("(.*?)\.(docx|doc)$"); 11384 if (!(regex.test(val))) { 11385 $(this).val(''); 11386 alert($('#docx_upload_field_error').text()); 11387 return 11388 } 11389 11390 piwik_service.trackEvent('playground', 'translation_docx_file', 'selected_docx_file'); 11391 $('#docx_filename').val($(this)[0].files[0].name); 11392 }); 11393 11394 function readPDFFile(pdf, file_name) { 11395 var loadingTask = pdfjsLib.getDocument(pdf); 11396 11397 loadingTask.promise.then(function (pdf) { 11398 $('#pages_count').val(pdf.numPages) 11399 11400 if (pdf.numPages < 42) { 11401 $('#manuscript_input').val('') 11402 $('#manuscript_name').val('') 11403 $('#min_pages_not_fulfilled').modal('show') 11404 } else { 11405 11406 formData = new FormData(); 11407 formData.append('file_name', file_name); 11408 formData.append('pages_count', pdf.numPages); 11409 11410 validator = $("#validation-form").validate(); 11411 11412 if (validator.element('#manuscript_input')) { 11413 end_point = '/cover_playgrounds/' + $('#author_playground_token').val() + '/store_pages_count' 11414 $.ajax({ 11415 type: 'POST', 11416 async: true, 11417 url: end_point, 11418 data: formData, 11419 processData: false, 11420 contentType: false, 11421 beforeSend: function (xhr) { 11422 xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content')); 11423 $("#pages_count_feedback_modal").modal('toggle'); 11424 }, 11425 success: function (data) { 11426 $("#pages_count_feedback_modal").modal('toggle'); 11427 }, 11428 error: function (response, status, error) { 11429 $("#pages_count_feedback_modal").modal('toggle'); 11430 $('#manuscript_name').val('') 11431 $('#manuscript_input').val('') 11432 var res = jQuery.parseJSON(response.responseText); 11433 alert(res.message) 11434 } 11435 }); 11436 } 11437 } 11438 11439 }); 11440 } 11441 11442 11443 $('.make-a-book-form').on('change', '#manuscript_input', function () { 11444 try { 11445 if ($(this)[0].files.length == 0) 11446 return 11447 11448 var val = $(this).val().toLowerCase(); 11449 var regex = new RegExp("(.*?)\.(pdf)$"); 11450 if (!(regex.test(val))) { 11451 $(this).val(''); 11452 alert($('#pdf_upload_field_error').text()); 11453 return 11454 } 11455 11456 piwik_service.trackEvent('playground', 'make_a_book', 'selected_manuscript') 11457 11458 file = $(this)[0].files[0] 11459 reader = new FileReader(); 11460 reader.readAsArrayBuffer(file); 11461 reader.onloadend = function (e) {
11462 readPDFFile(new Uint8Array(e.target.result), file.name); 11463 } 11464 } catch (err) { 11465 $('#manuscript_name').val('') 11466 $('#manuscript_input').val('') 11467 alert(err.message) 11468 } 11469 }); 11470 11471 $('.make-a-book-form').on('click', '#publish_btn', function () { 11472 $('.upload-progress').removeClass('hidden'); 11473 piwik_service.trackEvent('playground', 'make_a_book', 'submitted_book_to_publish') 11474 11475 $(this).closest('form').submit(); 11476 $('.upload-progress-docx').removeClass('hidden'); 11477 }); 11478 11479 $('.playground-page').on('change', '#author_image_input', function () { 11480 formData = new FormData(); 11481 formData.append('author_image', $(this)[0].files[0]); 11482 11483 $.ajax({ 11484 type: 'POST', 11485 async: true, 11486 url: '/cover_playgrounds/upload_author_image', 11487 data: formData, 11488 processData: false, 11489 contentType: false, 11490 beforeSend: function (xhr) { 11491 xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content')); 11492 $("#loader").removeClass('hidden'); 11493 }, 11494 success: function (data) { 11495 $("#loader").addClass('hidden'); 11496 } 11497 }); 11498 }); 11499 11500 $('.playground-page').on('click', '.author-image', function () { 11501 end_point = '/cover_playgrounds/display_author_image?playground_token=' + $('#project_playground_token').val(); 11502 11503 $.ajax({ 11504 type: 'GET', 11505 async: true, 11506 url: end_point, 11507 beforeSend: function (xhr) { 11508 xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content')) 11509 }, 11510 }); 11511 }); 11512 11513 $('.playground-page').on('submit', '#author_image_crop_form', function () { 11514 $('#loader').removeClass('hidden'); 11515 }); 11516 11517 $('#author_image_modal').on('shown.bs.modal', function (e) { 11518 image = $('#author_image_crop'); 11519 dataX = $('#x1'); 11520 dataY = $('#y1'); 11521 dataHeight = $('#author_image_height'); 11522 dataWidth = $('#author_image_width'); 11523 dataRotate = $('#author_image_rotate'); 11524 11525 image_height = image.height() + 4; 11526 image_width = image.width(); 11527 11528 $('.preview_author_image_crop').css({ 11529 width: '100%', 11530 overflow: 'hidden', 11531 height: image_height - 10, 11532 maxWidth: image_width, 11533 maxHeight: image_height 11534 }); 11535 11536 if (image) { 11537 image.cropper({ 11538 aspectRatio: 3 / 4, 11539 preview: '.preview_author_image_crop', 11540 responsive: true, 11541 viewMode: 2, 11542 crop: function (event) { 11543 dataX.val(Math.round(event.x)); 11544 dataY.val(Math.round(event.y)); 11545 dataHeight.val(Math.round(event.height)); 11546 dataWidth.val(Math.round(event.width)); 11547 dataRotate.val(event.rotate); 11548 } 11549 }); 11550 11551 var cropper = image.data('cropper'); 11552 11553 $('.playground-page').on('click', '#rotate_btn', function () { 11554 cropper.rotate(90) 11555 }); 11556 } 11557 }); 11558 11559 var language = $('#country_select_data').data('language'); 11560 var countries = $('#country_select_data').data('countries'); 11561 11562 $('#account_country_id').change(function () { 11563 $("li[data-country-id='" + $(this).val() + "']").click(); 11564 }); 11565 11566 $('.phone-dropdown-container').each(function () { 11567 initPhoneDropDown(this, countries, language); 11568 }); 11569 11570 $('#author_image_delete_btn').on('click', function () { 11571 end_point = '/cover_playgrounds/delete_author_image?playground_token=' + $('#project_playground_token').val(); 11572 11573 if (confirm("You want to delete image, Sure ?")) { 11574 $.ajax({ 11575 type: 'POST', 11576 url: end_point, 11577 beforeSend: function (xhr) { 11578 xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content')) 11579 } 11580 }); 11581 } 11582 }); 11583 11584 $('.chosen-select').chosen({ 11585 width: '100%' 11586 }); 11587 11588 $('.make-a-book-form').on('change', '#book_language_select, #book_category_select, #account_country_id, #manuscript_input', function () { 11589 $(this).valid(); 11590 }); 11591 11592 $('#account_birthdate').datepicker({ 11593 autoclose: true, 11594 }); 11595 11596 $('#with_reason_radio').on('click', function () { 11597 $('#purge-reason').slideDown(); 11598 }); 11599 11600 $('#without_reason_radio').on('click', function () { 11601 $('#purge-reason').find('textarea').val(null);
11602 $('#purge-reason').slideUp(); 11603 }); 11604 11605 $('#delete_immediately').on('click', function () { 11606 if ($(this).is(':checked')) { 11607 text_to_place = $('#immediate_purge_warning').text(); 11608 } else { 11609 text_to_place = $('#late_purge_warning').text(); 11610 } 11611 11612 $('#purge-notification').fadeOut(function () { 11613 $(this).html(text_to_place); 11614 $(this).fadeIn(); 11615 }); 11616 }) 11617 11618 var hasAlignmentButtons = $('#alignment_config_data').data('alignment-enabled') === true; 11619 11620 var frontCoverButtons = [ 'bold', 'italic', 'subscript', 'superscript' ]; 11621 11622 if (hasAlignmentButtons) { 11623 frontCoverButtons.push('justifyLeft', 'justifyCenter', 'justifyRight'); 11624 } 11625 11626 var frontCoverOptions = { 11627 buttonLabels: 'fontawesome', 11628 toolbar: { 11629 buttons: frontCoverButtons 11630 }, 11631 placeholder: { 11632 text: $('#medium-editor-placeholder').text() 11633 } 11634 } 11635 11636 var editor = new MediumEditor('.editable', frontCoverOptions); 11637 11638 editor.subscribe('editableInput', function (_, editable) { 11639 update_editable_input(editable); 11640 }); 11641 11642 var backCoverButtons = [ 'bold', 'italic', 'subscript', 'superscript', 'justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull' ]; 11643 11644 var backCoverOptions = { 11645 buttonLabels: 'fontawesome', 11646 toolbar: { 11647 buttons: backCoverButtons 11648 }, 11649 placeholder: { 11650 text: $('#medium-editor-placeholder').text() 11651 } 11652 } 11653 11654 var cover_back_editor = new MediumEditor('.cover-back-editable', backCoverOptions); 11655 11656 cover_back_editor.subscribe('editableInput', function (_, editable) { 11657 update_editable_input(editable); 11658 }); 11659 11660 $('#book_tag_list').tagsInput({ 11661 'width': '100%', 11662 'height': 'auto', 11663 'maxChars': 255 11664 }); 11665 11666 $('#set-ing-cover').on('ajax:beforeSend', function (xhr, settings) { 11667 $("#cover_image_loader").removeClass('hidden'); 11668 $('.modal-content').addClass('set-opacity'); 11669 }) 11670 11671 $('#set-ing-cover').on('ajax:success', function (e, data, status, xhr) { 11672 $("#cover_image_loader").addClass('hidden'); 11673 $('.modal-content').removeClass('set-opacity'); 11674 11675 if (data.hasOwnProperty('success') && !data.success) { 11676 alert(data.error); 11677 } 11678 }); 11679 11680 $('#search-cover-image').on('ajax:beforeSend', function (xhr, settings) { 11681 $("#cover_image_search_loader").removeClass('hidden'); 11682 $('#image_search_modal .modal-content').addClass('set-opacity'); 11683 }) 11684 11685 $('#search-cover-image').on('ajax:success', function (e, data, status, xhr) { 11686 $("#cover_image_search_loader").addClass('hidden'); 11687 $('#image_search_modal .modal-content').removeClass('set-opacity'); 11688 11689 if (data.hasOwnProperty('success') && !data.success) { 11690 alert(data.error); 11691 } 11692 }); 11693 11694 $('#set_search_image_cover').on('ajax:beforeSend', function (xhr, settings) { 11695 $("#cover_image_search_loader").removeClass('hidden'); 11696 $('#image_search_modal .modal-content').addClass('set-opacity'); 11697 }) 11698 11699 $('#set_search_image_cover').on('ajax:success', function (e, data, status, xhr) { 11700 $("#cover_image_search_loader").addClass('hidden'); 11701 $('#image_search_modal .modal-content').removeClass('set-opacity'); 11702 11703 if (data.hasOwnProperty('success') && !data.success) { 11704 alert(data.error); 11705 } 11706 }); 11707 11708 $('#playground_price_simulator').on('ajax:beforeSend', function (xhr, settings) { 11709 $("#finish_playground_loader").removeClass('hidden'); 11710 $('.finish-playground-page').addClass('set-opacity'); 11711 }) 11712 11713 $('#playground_price_simulator').on('ajax:success', function (e, data, status, xhr) { 11714 $("#finish_playground_loader").addClass('hidden'); 11715 $('.finish-playground-page').removeClass('set-opacity'); 11716 }); 11717 11718 $('.finish-playground-page').on('change', '#number_of_copies_calculator', function () { 11719 if ($(this)[0].checkValidity()) { 11720 $('#number_of_copies').attr('value', $(this).val()) 11721 } else { 11722 $('#number_of_copies').attr('value', '') 11723 min_copies = $('#number_of_copies').attr('min') 11724 alert(`Number of copies should be greater or equal to ${min_copies}`) 11725 } 11726 }) 11727 11728 $('.finish-playground-page').on('submit', '#print_info_form', function (evt) { 11729 if (!$('#number_of_copies')[0].checkValidity()) { 11730 min_copies = $('#number_of_copies').attr('min') 11731 alert(`Number of copies should be greater or equal to ${min_copies}`) 11732 return false;
11733 } 11734 }) 11735 11736 $('.playground-page').on('click', '.search-pagiantion a', function () { 11737 $("#cover_image_search_loader").removeClass('hidden'); 11738 $('#image_search_modal .modal-content').addClass('set-opacity'); 11739 }) 11740 11741 $('.playground-page').on('click', '.bk-front', function () { 11742 end_point = '/cover_playgrounds/display_cover_image?playground_token=' + $('#project_playground_token').val(); 11743 11744 $.ajax({ 11745 type: 'GET', 11746 async: true, 11747 url: end_point, 11748 beforeSend: function (xhr) { 11749 xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content')) 11750 }, 11751 }); 11752 }); 11753 11754 $('.playground-editor-crop').on('click', '#editor_recrop_btn', function () { 11755 end_point = '/cover_playgrounds/display_editors_cover_image_cropper?playground_token=' + $('#project_playground_token').val() + '&imprint_code=' + $('#imprint_code').val(); 11756 11757 $.ajax({ 11758 type: 'GET', 11759 async: true, 11760 url: end_point, 11761 beforeSend: function (xhr) { 11762 xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content')) 11763 }, 11764 }); 11765 }); 11766 11767 var cover_crop = function () { 11768 11769 console.log('cover_crop', $('#image-measure').data('front-image-width'), $('#image-measure').data('front-image-height'), $('#image-measure').data('front-image-width') / $('#image-measure').data('front-image-height')) 11770 11771 image = $('#cover_image_crop'); 11772 dataX = $('#cover_image_x1'); 11773 dataY = $('#cover_image_y1'); 11774 dataHeight = $('#cover_image_height'); 11775 dataWidth = $('#cover_image_width'); 11776 11777 console.log('image: ', image.val()) 11778 console.log('dataX: ', dataX.val()) 11779 console.log('dataY: ', dataY.val()) 11780 console.log('dataHeight: ', dataHeight.val()) 11781 console.log('dataWidth: ', dataWidth.val()) 11782 11783 if (image) { 11784 image.cropper({ 11785 aspectRatio: $('#image-measure').data('front-image-width') / $('#image-measure').data('front-image-height'), 11786 preview: '.preview_cover_image_crop', 11787 responsive: true, 11788 width: 850, 11789 height: 400, 11790 checkCrossOrigin: false, 11791 zoomable: true, 11792 viewMode: 3, 11793 data: { 11794 x: parseInt(dataX.val()), 11795 y: parseInt(dataY.val()), 11796 width: parseInt(dataWidth.val()), 11797 height: parseInt(dataHeight.val()) 11798 }, 11799 crop: function (event) { 11800 dataX.val(Math.round(event.x)); 11801 dataY.val(Math.round(event.y)); 11802 dataHeight.val(Math.round(event.height)); 11803 dataWidth.val(Math.round(event.width)); 11804 } 11805 }); 11806 } 11807 } 11808 11809 $('#cover_image_cropper').on('shown.bs.modal', function (e) { 11810 cover_crop() 11811 }); 11812 11813 $('#cover_image_cropper_remote').on('shown.bs.modal', function (e) { 11814 cover_crop() 11815 }); 11816 11817 $(document).on('click', '.cookiebanner-close', function () { 11818 $('head').append( 11819 `<script type="text/javascript">
vendor: 471 bytes, lines 11819-11828
11819 11820 !function(f,b,e,v,n,t,s) 11821 {if(f.fbq)return;n=f.fbq=function(){n.callMethod? 11822 n.callMethod.apply(n,arguments):n.queue.push(arguments)}; 11823 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; 11824 n.queue=[];t=b.createElement(e);t.async=!0; 11825 t.src=v;s=b.getElementsByTagName(e)[0]; 11826 s.parentNode.insertBefore(t,s)}(window, document,'script', 11827 'https://connect.facebook.net/en_US/fbevents.js'); 11828 fbq('init', '
118282360964383997362
vendor: 44 bytes, lines 11828-11830
11828'); 11829 fbq('track', 'PageView'); 11830
11830</script> 11831 <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=2360964383997362&ev=PageView&noscript=1" /></noscript>` 11832 ); 11833 11834 $('body').append( 11835 `<script type="text/javascript"> 11836 _linkedin_partner_id = "1509521"; 11837 window._linkedin_data_partner_ids = window._linkedin_data_partner_ids || []; 11838 window._linkedin_data_partner_ids.push(_linkedin_partner_id); 11839 </script><script type="text/javascript"> 11840 (function(){var s = document.getElementsByTagName("script")[0]; 11841 var b = document.createElement("script"); 11842 b.type = "text/javascript";b.async = true; 11843 b.src = "https://snap.licdn.com/li.lms-analytics/insight.min.js"; 11844 s.parentNode.insertBefore(b, s);})(); 11845 </script> 11846 <noscript><img height="1" width="1" style="display:none;" alt="" src="https://px.ads.linkedin.com/collect/?pid=1509521&fmt=gif" /></noscript>` 11847 ) 11848 }); 11849 11850 $('.playground-page').on('click', '.color-picker-link', function () { 11851 end_point = '/cover_playgrounds/set_bg_color?playground_token=' + $('#project_playground_token').val(); 11852 color = $(this).data('color') 11853 bgColor = $(this).data('bgcolor') 11854 11855 $.ajax({ 11856 type: 'POST', 11857 async: true, 11858 url: end_point, 11859 data: { 11860 color: color, 11861 bgcolor: bgColor 11862 }, 11863 beforeSend: function (xhr) { 11864 xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content')); 11865 $("#loader").removeClass('hidden'); 11866 }, 11867 success: function (data) { 11868 $("#loader").addClass('hidden'); 11869 } 11870 }); 11871 }); 11872 11873 $('.copy-share-link').on('click', function () { 11874 temp = $("<input>"); 11875 $("body").append(temp); 11876 temp.val($(this).data('share-link')).select(); 11877 document.execCommand("copy"); 11878 temp.remove(); 11879 $(this).text('Copied!'); 11880 }); 11881 11882 function slide_to_section(section_id) { 11883 $('html, body').animate({ 11884 scrollTop: $(section_id).offset().top 11885 }, 1000); 11886 } 11887 11888 function mobile_version() { 11889 return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) 11890 } 11891 11892 function is_deepl_supported_language() { 11893 var deepl_languages = $('#deepl_languages').val().split(' ') 11894 var selected_language = $('#book_language_select :selected').data('language_name') 11895 return jQuery.inArray(selected_language, deepl_languages) != -1 11896 } 11897 11898 function update_editable_input(editable) { 11899 $('.' + editable.id.split('_').pop() + '-editor').val(editable.innerHTML); 11900 } 11901 11902 $(document).on('click', '.continue-publishing', function () { 11903 piwik_service.trackEvent('playground', 'take_a_look', 'completed_take_a_look_step'); 11904 }); 11905 11906 $(document).on('click', '.searched-image', function () { 11907 $('.selected').hide(); 11908 $('.selected').css("opacity", 0); 11909 11910 image_code = $(this).find('.searched_image_code'); 11911 $('#ing_image_code_field_searched').attr('value', image_code.val()); 11912 11913 $('#image_selection_btn').attr('disabled', false); 11914 caption = $(this).find('.selected'); 11915 caption.show(); 11916 caption.css("opacity", 1); 11917 if (mobile_version()) { 11918 $('#image_search_modal').animate({ 11919 scrollTop: $('#image_search_modal')[0].scrollHeight 11920 }, 1000); 11921 } 11922 }); 11923 11924 $(document).on('keypress', '.isbn_field_validator', function (evt) { 11925 var charCode = (evt.which) ? evt.which : evt.keyCode; 11926 if (charCode != 46 && charCode != 45 && charCode > 31 && (charCode < 48 || charCode > 57)) 11927 return false; 11928 11929 return true; 11930 }); 11931 11932 $('.collapse.in').prev('.panel-heading').addClass('active'); 11933 $('#accordion') 11934 .on('show.bs.collapse', function (a) { 11935 $(a.target).prev('.panel-heading').addClass('active'); 11936 }) 11937 .on('hide.bs.collapse', function (a) { 11938 $(a.target).prev('.panel-heading').removeClass('active'); 11939 }); 11940 11941 $('#referral_skip').click(function () { 11942 $('#referral-body').collapse('hide') 11943 }) 11944 11945 $('#marketing_skip').click(function () { 11946 $('#print-details').collapse('show') 11947 }) 11948 11949 $('.copy-btn').click(function () { 11950 var copyText = document.getElementById("copy_to_clipboard"); 11951 copyText.select(); 11952 document.execCommand("copy"); 11953 $(this).text('Copied'); 11954 }); 11955 11956 $("#invitation_form").validate({ 11957 rules: { 11958 'referral[invitation_email]': { required: true }, 11959 'author[email]': { required: true }, 11960 'referral[subject]': { required: true }, 11961 'referral[message]': { required: true } 11962 } 11963 }); 11964 11965 $('#mailto-btn').on('click', function (event, options) { 11966 options = options || {}; 11967 11968 if (!options.mailto_href_updated == true) { 11969 event.preventDefault(); 11970 11971 to_email = $('#referral_invitation_email').val(); 11972 body_content = $('.body-content').val(); 11973 subject_content = $('.subject-content').val(); 11974 11975 mailto_href = 'mailto:' + to_email + '?subject=' + subject_content + '&body=' + body_content; 11976 $('#mailto-btn').attr('href', mailto_href); 11977 11978 $(event.currentTarget).trigger('click', { 'mailto_href_updated': true }); 11979 } 11980 }); 11981 11982 $('#mailto-btn').bind('click', function () { 11983 window.location.href = $('#mailto-btn').attr('href'); 11984 }); 11985 11986 if ($('#ing_image_code_form_field').val().trim() === '') { 11987 $('#choose-cover-layout-modal').modal('show'); 11988 } 11989}); 11990jQuery.fn.shake = function(interval,distance,times){ 11991 interval = typeof interval == "undefined" ? 100 : interval; 11992 distance = typeof distance == "undefined" ? 10 : distance; 11993 times = typeof times == "undefined" ? 3 : times; 11994 const jTarget = $(this); 11995 jTarget.css('position','relative');
vendor: 4,221 bytes, lines 11996-12102
11996 for(let iter=0;iter<(times+1);iter++){ 11997 jTarget.animate({ left: ((iter%2==0 ? distance : distance*-1))}, interval); 11998 } 11999 return jTarget.animate({ left: 0},interval); 12000} 12001; 12002/** 12003 * @licstart The following is the entire license notice for the 12004 * Javascript code in this page 12005 * 12006 * Copyright 2020 Mozilla Foundation 12007 * 12008 * Licensed under the Apache License, Version 2.0 (the "License"); 12009 * you may not use this file except in compliance with the License. 12010 * You may obtain a copy of the License at 12011 * 12012 * http://www.apache.org/licenses/LICENSE-2.0 12013 * 12014 * Unless required by applicable law or agreed to in writing, software 12015 * distributed under the License is distributed on an "AS IS" BASIS, 12016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12017 * See the License for the specific language governing permissions and 12018 * limitations under the License. 12019 * 12020 * @licend The above is the entire license notice for the 12021 * Javascript code in this page 12022 */ 12023 12024 12025(function webpackUniversalModuleDefinition(root, factory) { 12026 if(typeof exports === 'object' && typeof module === 'object') 12027 module.exports = factory(); 12028 else if(typeof define === 'function' && define.amd) 12029 define("pdfjs-dist/build/pdf", [], factory); 12030 else if(typeof exports === 'object') 12031 exports["pdfjs-dist/build/pdf"] = factory(); 12032 else 12033 root["pdfjs-dist/build/pdf"] = root.pdfjsLib = factory(); 12034})(this, function() { 12035return /******/ (function(modules) { // webpackBootstrap 12036/******/ // The module cache 12037/******/ var installedModules = {}; 12038/******/ 12039/******/ // The require function 12040/******/ function __w_pdfjs_require__(moduleId) { 12041/******/ 12042/******/ // Check if module is in cache 12043/******/ if(installedModules[moduleId]) { 12044/******/ return installedModules[moduleId].exports; 12045/******/ } 12046/******/ // Create a new module (and put it into the cache) 12047/******/ var module = installedModules[moduleId] = { 12048/******/ i: moduleId, 12049/******/ l: false, 12050/******/ exports: {} 12051/******/ }; 12052/******/ 12053/******/ // Execute the module function 12054/******/ modules[moduleId].call(module.exports, module, module.exports, __w_pdfjs_require__); 12055/******/ 12056/******/ // Flag the module as loaded 12057/******/ module.l = true; 12058/******/ 12059/******/ // Return the exports of the module 12060/******/ return module.exports; 12061/******/ } 12062/******/ 12063/******/ 12064/******/ // expose the modules object (__webpack_modules__) 12065/******/ __w_pdfjs_require__.m = modules; 12066/******/ 12067/******/ // expose the module cache 12068/******/ __w_pdfjs_require__.c = installedModules; 12069/******/ 12070/******/ // define getter function for harmony exports 12071/******/ __w_pdfjs_require__.d = function(exports, name, getter) { 12072/******/ if(!__w_pdfjs_require__.o(exports, name)) { 12073/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 12074/******/ } 12075/******/ }; 12076/******/ 12077/******/ // define __esModule on exports 12078/******/ __w_pdfjs_require__.r = function(exports) { 12079/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 12080/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 12081/******/ } 12082/******/ Object.defineProperty(exports, '__esModule', { value: true }); 12083/******/ }; 12084/******/ 12085/******/ // create a fake namespace object 12086/******/ // mode & 1: value is a module id, require it 12087/******/ // mode & 2: merge all properties of value into the ns 12088/******/ // mode & 4: return value when already ns object 12089/******/ // mode & 8|1: behave like require 12090/******/ __w_pdfjs_require__.t = function(value, mode) { 12091/******/ if(mode & 1) value = __w_pdfjs_require__(value); 12092/******/ if(mode & 8) return value; 12093/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 12094/******/ var ns = Object.create(null); 12095/******/ __w_pdfjs_require__.r(ns); 12096/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 12097/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __w_pdfjs_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 12098/******/ return ns; 12099/******/ }; 12100/******/ 12101/******/ // getDefaultExport function for compatibility with non-harmony modules 12102/******/ __w_pdfjs_require__.n = function(module) {
12103/******/ var getter = module && module.__esModule ? 12104/******/ function getDefault() { return module['default']; } : 12105/******/ function getModuleExports() { return module; }; 12106/******/ __w_pdfjs_require__.d(getter, 'a', getter); 12107/******/ return getter; 12108/******/ }; 12109/******/ 12110/******/ // Object.prototype.hasOwnProperty.call 12111/******/ __w_pdfjs_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 12112/******/ 12113/******/ // __webpack_public_path__ 12114/******/ __w_pdfjs_require__.p = ""; 12115/******/ 12116/******/ 12117/******/ // Load entry module and return exports 12118/******/ return __w_pdfjs_require__(__w_pdfjs_require__.s = 0); 12119/******/ }) 12120/************************************************************************/ 12121/******/ ([ 12122/* 0 */ 12123/***/ (function(module, exports, __w_pdfjs_require__) { 12124 12125"use strict"; 12126 12127 12128var pdfjsVersion = '2.4.456'; 12129var pdfjsBuild = '228a591c'; 12130 12131var pdfjsSharedUtil = __w_pdfjs_require__(1); 12132 12133var pdfjsDisplayAPI = __w_pdfjs_require__(3); 12134 12135var pdfjsDisplayTextLayer = __w_pdfjs_require__(16); 12136 12137var pdfjsDisplayAnnotationLayer = __w_pdfjs_require__(17); 12138 12139var pdfjsDisplayDisplayUtils = __w_pdfjs_require__(4); 12140 12141var pdfjsDisplaySVG = __w_pdfjs_require__(18); 12142 12143const pdfjsDisplayWorkerOptions = __w_pdfjs_require__(10); 12144 12145const pdfjsDisplayAPICompatibility = __w_pdfjs_require__(6); 12146 12147{ 12148 const { 12149 isNodeJS 12150 } = __w_pdfjs_require__(7); 12151 12152 if (isNodeJS) { 12153 const PDFNodeStream = __w_pdfjs_require__(19).PDFNodeStream; 12154 12155 pdfjsDisplayAPI.setPDFNetworkStreamFactory(params => { 12156 return new PDFNodeStream(params); 12157 }); 12158 } else { 12159 const PDFNetworkStream = __w_pdfjs_require__(22).PDFNetworkStream; 12160 12161 let PDFFetchStream; 12162 12163 if (pdfjsDisplayDisplayUtils.isFetchSupported()) { 12164 PDFFetchStream = __w_pdfjs_require__(23).PDFFetchStream; 12165 } 12166 12167 pdfjsDisplayAPI.setPDFNetworkStreamFactory(params => { 12168 if (PDFFetchStream && pdfjsDisplayDisplayUtils.isValidFetchUrl(params.url)) { 12169 return new PDFFetchStream(params); 12170 } 12171 12172 return new PDFNetworkStream(params); 12173 }); 12174 } 12175} 12176exports.build = pdfjsDisplayAPI.build; 12177exports.version = pdfjsDisplayAPI.version; 12178exports.getDocument = pdfjsDisplayAPI.getDocument; 12179exports.LoopbackPort = pdfjsDisplayAPI.LoopbackPort; 12180exports.PDFDataRangeTransport = pdfjsDisplayAPI.PDFDataRangeTransport; 12181exports.PDFWorker = pdfjsDisplayAPI.PDFWorker; 12182exports.renderTextLayer = pdfjsDisplayTextLayer.renderTextLayer; 12183exports.AnnotationLayer = pdfjsDisplayAnnotationLayer.AnnotationLayer; 12184exports.createPromiseCapability = pdfjsSharedUtil.createPromiseCapability; 12185exports.PasswordResponses = pdfjsSharedUtil.PasswordResponses; 12186exports.InvalidPDFException = pdfjsSharedUtil.InvalidPDFException; 12187exports.MissingPDFException = pdfjsSharedUtil.MissingPDFException; 12188exports.SVGGraphics = pdfjsDisplaySVG.SVGGraphics; 12189exports.NativeImageDecoding = pdfjsSharedUtil.NativeImageDecoding; 12190exports.CMapCompressionType = pdfjsSharedUtil.CMapCompressionType; 12191exports.PermissionFlag = pdfjsSharedUtil.PermissionFlag; 12192exports.UnexpectedResponseException = pdfjsSharedUtil.UnexpectedResponseException; 12193exports.OPS = pdfjsSharedUtil.OPS; 12194exports.VerbosityLevel = pdfjsSharedUtil.VerbosityLevel; 12195exports.UNSUPPORTED_FEATURES = pdfjsSharedUtil.UNSUPPORTED_FEATURES; 12196exports.createValidAbsoluteUrl = pdfjsSharedUtil.createValidAbsoluteUrl; 12197exports.createObjectURL = pdfjsSharedUtil.createObjectURL; 12198exports.removeNullCharacters = pdfjsSharedUtil.removeNullCharacters; 12199exports.shadow = pdfjsSharedUtil.shadow; 12200exports.Util = pdfjsSharedUtil.Util; 12201exports.RenderingCancelledException = pdfjsDisplayDisplayUtils.RenderingCancelledException; 12202exports.getFilenameFromUrl = pdfjsDisplayDisplayUtils.getFilenameFromUrl; 12203exports.LinkTarget = pdfjsDisplayDisplayUtils.LinkTarget; 12204exports.addLinkAttributes = pdfjsDisplayDisplayUtils.addLinkAttributes; 12205exports.loadScript = pdfjsDisplayDisplayUtils.loadScript; 12206exports.PDFDateString = pdfjsDisplayDisplayUtils.PDFDateString; 12207exports.GlobalWorkerOptions = pdfjsDisplayWorkerOptions.GlobalWorkerOptions; 12208exports.apiCompatibilityParams = pdfjsDisplayAPICompatibility.apiCompatibilityParams; 12209 12210/***/ }), 12211/* 1 */ 12212/***/ (function(module, exports, __w_pdfjs_require__) { 12213 12214"use strict"; 12215 12216 12217Object.defineProperty(exports, "__esModule", { 12218 value: true 12219}); 12220exports.arrayByteLength = arrayByteLength; 12221exports.arraysToBytes = arraysToBytes; 12222exports.assert = assert; 12223exports.bytesToString = bytesToString; 12224exports.createPromiseCapability = createPromiseCapability; 12225exports.getVerbosityLevel = getVerbosityLevel; 12226exports.info = info; 12227exports.isArrayBuffer = isArrayBuffer; 12228exports.isArrayEqual = isArrayEqual; 12229exports.isBool = isBool; 12230exports.isEmptyObj = isEmptyObj; 12231exports.isNum = isNum; 12232exports.isString = isString; 12233exports.isSameOrigin = isSameOrigin; 12234exports.createValidAbsoluteUrl = createValidAbsoluteUrl; 12235exports.removeNullCharacters = removeNullCharacters; 12236exports.setVerbosityLevel = setVerbosityLevel; 12237exports.shadow = shadow; 12238exports.string32 = string32; 12239exports.stringToBytes = stringToBytes; 12240exports.stringToPDFString = stringToPDFString; 12241exports.stringToUTF8String = stringToUTF8String; 12242exports.utf8StringToString = utf8StringToString; 12243exports.warn = warn; 12244exports.unreachable = unreachable; 12245exports.IsEvalSupportedCached = exports.IsLittleEndianCached = exports.createObjectURL = exports.FormatError = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.NativeImageDecoding = exports.MissingPDFException = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exp
12245orts.FontType = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = exports.BaseException = void 0; 12246 12247__w_pdfjs_require__(2); 12248 12249const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0]; 12250exports.IDENTITY_MATRIX = IDENTITY_MATRIX; 12251const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0]; 12252exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX; 12253const NativeImageDecoding = { 12254 NONE: "none", 12255 DECODE: "decode", 12256 DISPLAY: "display" 12257}; 12258exports.NativeImageDecoding = NativeImageDecoding; 12259const PermissionFlag = { 12260 PRINT: 0x04, 12261 MODIFY_CONTENTS: 0x08, 12262 COPY: 0x10, 12263 MODIFY_ANNOTATIONS: 0x20, 12264 FILL_INTERACTIVE_FORMS: 0x100, 12265 COPY_FOR_ACCESSIBILITY: 0x200, 12266 ASSEMBLE: 0x400, 12267 PRINT_HIGH_QUALITY: 0x800 12268}; 12269exports.PermissionFlag = PermissionFlag; 12270const TextRenderingMode = { 12271 FILL: 0, 12272 STROKE: 1, 12273 FILL_STROKE: 2, 12274 INVISIBLE: 3, 12275 FILL_ADD_TO_PATH: 4, 12276 STROKE_ADD_TO_PATH: 5, 12277 FILL_STROKE_ADD_TO_PATH: 6, 12278 ADD_TO_PATH: 7, 12279 FILL_STROKE_MASK: 3, 12280 ADD_TO_PATH_FLAG: 4 12281}; 12282exports.TextRenderingMode = TextRenderingMode; 12283const ImageKind = { 12284 GRAYSCALE_1BPP: 1, 12285 RGB_24BPP: 2, 12286 RGBA_32BPP: 3 12287}; 12288exports.ImageKind = ImageKind; 12289const AnnotationType = { 12290 TEXT: 1, 12291 LINK: 2, 12292 FREETEXT: 3, 12293 LINE: 4, 12294 SQUARE: 5, 12295 CIRCLE: 6, 12296 POLYGON: 7, 12297 POLYLINE: 8, 12298 HIGHLIGHT: 9, 12299 UNDERLINE: 10, 12300 SQUIGGLY: 11, 12301 STRIKEOUT: 12, 12302 STAMP: 13, 12303 CARET: 14, 12304 INK: 15, 12305 POPUP: 16, 12306 FILEATTACHMENT: 17, 12307 SOUND: 18, 12308 MOVIE: 19, 12309 WIDGET: 20, 12310 SCREEN: 21, 12311 PRINTERMARK: 22, 12312 TRAPNET: 23, 12313 WATERMARK: 24, 12314 THREED: 25, 12315 REDACT: 26 12316}; 12317exports.AnnotationType = AnnotationType; 12318const AnnotationStateModelType = { 12319 MARKED: "Marked", 12320 REVIEW: "Review" 12321}; 12322exports.AnnotationStateModelType = AnnotationStateModelType; 12323const AnnotationMarkedState = { 12324 MARKED: "Marked", 12325 UNMARKED: "Unmarked" 12326}; 12327exports.AnnotationMarkedState = AnnotationMarkedState; 12328const AnnotationReviewState = { 12329 ACCEPTED: "Accepted", 12330 REJECTED: "Rejected", 12331 CANCELLED: "Cancelled", 12332 COMPLETED: "Completed", 12333 NONE: "None" 12334}; 12335exports.AnnotationReviewState = AnnotationReviewState; 12336const AnnotationReplyType = { 12337 GROUP: "Group", 12338 REPLY: "R" 12339}; 12340exports.AnnotationReplyType = AnnotationReplyType; 12341const AnnotationFlag = { 12342 INVISIBLE: 0x01, 12343 HIDDEN: 0x02, 12344 PRINT: 0x04, 12345 NOZOOM: 0x08, 12346 NOROTATE: 0x10, 12347 NOVIEW: 0x20, 12348 READONLY: 0x40, 12349 LOCKED: 0x80, 12350 TOGGLENOVIEW: 0x100, 12351 LOCKEDCONTENTS: 0x200 12352}; 12353exports.AnnotationFlag = AnnotationFlag; 12354const AnnotationFieldFlag = { 12355 READONLY: 0x0000001, 12356 REQUIRED: 0x0000002, 12357 NOEXPORT: 0x0000004, 12358 MULTILINE: 0x0001000, 12359 PASSWORD: 0x0002000, 12360 NOTOGGLETOOFF: 0x0004000, 12361 RADIO: 0x0008000, 12362 PUSHBUTTON: 0x0010000, 12363 COMBO: 0x0020000, 12364 EDIT: 0x0040000, 12365 SORT: 0x0080000, 12366 FILESELECT: 0x0100000, 12367 MULTISELECT: 0x0200000, 12368 DONOTSPELLCHECK: 0x0400000, 12369 DONOTSCROLL: 0x0800000, 12370 COMB: 0x1000000, 12371 RICHTEXT: 0x2000000, 12372 RADIOSINUNISON: 0x2000000, 12373 COMMITONSELCHANGE: 0x4000000 12374}; 12375exports.AnnotationFieldFlag = AnnotationFieldFlag; 12376const AnnotationBorderStyleType = { 12377 SOLID: 1, 12378 DASHED: 2, 12379 BEVELED: 3, 12380 INSET: 4, 12381 UNDERLINE: 5 12382}; 12383exports.AnnotationBorderStyleType = AnnotationBorderStyleType; 12384const StreamType = { 12385 UNKNOWN: "UNKNOWN", 12386 FLATE: "FLATE", 12387 LZW: "LZW", 12388 DCT: "DCT", 12389 JPX: "JPX", 12390 JBIG: "JBIG", 12391 A85: "A85", 12392 AHX: "AHX", 12393 CCF: "CCF", 12394 RLX: "RLX" 12395}; 12396exports.StreamType = StreamType; 12397const FontType = { 12398 UNKNOWN: "UNKNOWN", 12399 TYPE1: "TYPE1", 12400 TYPE1C: "TYPE1C", 12401 CIDFONTTYPE0: "CIDFONTTYPE0", 12402 CIDFONTTYPE0C: "CIDFONTTYPE0C", 12403 TRUETYPE: "TRUETYPE", 12404 CIDFONTTYPE2: "CIDFONTTYPE2", 12405 TYPE3: "TYPE3", 12406 OPENTYPE: "OPENTYPE", 12407 TYPE0: "TYPE0", 12408 MMTYPE1: "MMTYPE1" 12409}; 12410exports.FontType = FontType; 12411const VerbosityLevel = { 12412 ERRORS: 0, 12413 WARNINGS: 1, 12414 INFOS: 5 12415}; 12416exports.VerbosityLevel = VerbosityLevel; 12417const CMapCompressionType = { 12418 NONE: 0, 12419 BINARY: 1, 12420 STREAM: 2 12421}; 12422exports.CMapCompressionType = CMapCompressionType; 12423const OPS = { 12424 dependency: 1, 12425 setLineWidth: 2, 12426 setLineCap: 3, 12427 setLineJoin: 4, 12428 setMiterLimit: 5, 12429 setDash: 6, 12430 setRenderingIntent: 7,
12431 setFlatness: 8, 12432 setGState: 9, 12433 save: 10, 12434 restore: 11, 12435 transform: 12, 12436 moveTo: 13, 12437 lineTo: 14, 12438 curveTo: 15, 12439 curveTo2: 16, 12440 curveTo3: 17, 12441 closePath: 18, 12442 rectangle: 19, 12443 stroke: 20, 12444 closeStroke: 21, 12445 fill: 22, 12446 eoFill: 23, 12447 fillStroke: 24, 12448 eoFillStroke: 25, 12449 closeFillStroke: 26, 12450 closeEOFillStroke: 27, 12451 endPath: 28, 12452 clip: 29, 12453 eoClip: 30, 12454 beginText: 31, 12455 endText: 32, 12456 setCharSpacing: 33, 12457 setWordSpacing: 34, 12458 setHScale: 35, 12459 setLeading: 36, 12460 setFont: 37, 12461 setTextRenderingMode: 38, 12462 setTextRise: 39, 12463 moveText: 40, 12464 setLeadingMoveText: 41, 12465 setTextMatrix: 42, 12466 nextLine: 43, 12467 showText: 44, 12468 showSpacedText: 45, 12469 nextLineShowText: 46, 12470 nextLineSetSpacingShowText: 47, 12471 setCharWidth: 48, 12472 setCharWidthAndBounds: 49, 12473 setStrokeColorSpace: 50, 12474 setFillColorSpace: 51, 12475 setStrokeColor: 52, 12476 setStrokeColorN: 53, 12477 setFillColor: 54, 12478 setFillColorN: 55, 12479 setStrokeGray: 56, 12480 setFillGray: 57, 12481 setStrokeRGBColor: 58, 12482 setFillRGBColor: 59, 12483 setStrokeCMYKColor: 60, 12484 setFillCMYKColor: 61, 12485 shadingFill: 62, 12486 beginInlineImage: 63, 12487 beginImageData: 64, 12488 endInlineImage: 65, 12489 paintXObject: 66, 12490 markPoint: 67, 12491 markPointProps: 68, 12492 beginMarkedContent: 69, 12493 beginMarkedContentProps: 70, 12494 endMarkedContent: 71, 12495 beginCompat: 72, 12496 endCompat: 73, 12497 paintFormXObjectBegin: 74, 12498 paintFormXObjectEnd: 75, 12499 beginGroup: 76, 12500 endGroup: 77, 12501 beginAnnotations: 78, 12502 endAnnotations: 79, 12503 beginAnnotation: 80, 12504 endAnnotation: 81, 12505 paintJpegXObject: 82, 12506 paintImageMaskXObject: 83, 12507 paintImageMaskXObjectGroup: 84, 12508 paintImageXObject: 85, 12509 paintInlineImageXObject: 86, 12510 paintInlineImageXObjectGroup: 87, 12511 paintImageXObjectRepeat: 88, 12512 paintImageMaskXObjectRepeat: 89, 12513 paintSolidColorImageMask: 90, 12514 constructPath: 91 12515}; 12516exports.OPS = OPS; 12517const UNSUPPORTED_FEATURES = { 12518 unknown: "unknown", 12519 forms: "forms", 12520 javaScript: "javaScript", 12521 smask: "smask", 12522 shadingPattern: "shadingPattern", 12523 font: "font" 12524}; 12525exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES; 12526const PasswordResponses = { 12527 NEED_PASSWORD: 1, 12528 INCORRECT_PASSWORD: 2 12529}; 12530exports.PasswordResponses = PasswordResponses; 12531let verbosity = VerbosityLevel.WARNINGS; 12532 12533function setVerbosityLevel(level) { 12534 if (Number.isInteger(level)) { 12535 verbosity = level; 12536 } 12537} 12538 12539function getVerbosityLevel() { 12540 return verbosity; 12541} 12542 12543function info(msg) { 12544 if (verbosity >= VerbosityLevel.INFOS) { 12545 console.log(`Info: ${msg}`); 12546 } 12547} 12548 12549function warn(msg) { 12550 if (verbosity >= VerbosityLevel.WARNINGS) { 12551 console.log(`Warning: ${msg}`); 12552 } 12553} 12554 12555function unreachable(msg) { 12556 throw new Error(msg); 12557} 12558 12559function assert(cond, msg) { 12560 if (!cond) { 12561 unreachable(msg); 12562 } 12563} 12564 12565function isSameOrigin(baseUrl, otherUrl) { 12566 let base; 12567 12568 try { 12569 base = new URL(baseUrl); 12570 12571 if (!base.origin || base.origin === "null") { 12572 return false; 12573 } 12574 } catch (e) { 12575 return false; 12576 } 12577 12578 const other = new URL(otherUrl, base); 12579 return base.origin === other.origin; 12580} 12581 12582function _isValidProtocol(url) { 12583 if (!url) { 12584 return false; 12585 } 12586 12587 switch (url.protocol) { 12588 case "http:": 12589 case "https:": 12590 case "ftp:": 12591 case "mailto:": 12592 case "tel:": 12593 return true; 12594 12595 default: 12596 return false; 12597 } 12598} 12599 12600function createValidAbsoluteUrl(url, baseUrl) { 12601 if (!url) { 12602 return null; 12603 } 12604 12605 try { 12606 const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url); 12607 12608 if (_isValidProtocol(absoluteUrl)) { 12609 return absoluteUrl; 12610 } 12611 } catch (ex) {} 12612 12613 return null; 12614} 12615 12616function shadow(obj, prop, value) { 12617 Object.defineProperty(obj, prop, { 12618 value, 12619 enumerable: true, 12620 configurable: true, 12621 writable: false 12622 }); 12623 return value; 12624} 12625 12626const BaseException = function BaseExceptionClosure() { 12627 function BaseException(message) { 12628 if (this.constructor === BaseException) { 12629 unreachable("Cannot initialize BaseException."); 12630 } 12631 12632 this.message = message; 12633 this.name = this.constructor.name; 12634 } 12635 12636 BaseException.prototype = new Error(); 12637 BaseException.constructor = BaseException; 12638 return BaseException; 12639}(); 12640 12641exports.BaseException = BaseException; 12642 12643class PasswordException extends BaseException { 12644 constructor(msg, code) { 12645 super(msg); 12646 this.code = code; 12647 } 12648 12649} 12650 12651exports.PasswordException = PasswordException; 12652 12653class UnknownErrorException extends BaseException { 12654 constructor(msg, details) { 12655 super(msg); 12656 this.details = details; 12657 } 12658 12659} 12660 12661exports.UnknownErrorException = UnknownErrorException; 12662 12663class InvalidPDFException extends BaseException {} 12664 12665exports.InvalidPDFException = InvalidPDFException; 12666 12667class MissingPDFException extends BaseException {} 12668 12669exports.MissingPDFException = MissingPDFException; 12670 12671class UnexpectedResponseException extends BaseException { 12672 constructor(msg, status) { 12673 super(msg); 12674 this.status = status; 12675 } 12676 12677} 12678 12679exports.UnexpectedResponseException = UnexpectedResponseException; 12680 12681class FormatError extends BaseException {} 12682 12683exports.FormatError = FormatError; 12684 12685class AbortException extends BaseException {} 12686 12687exports.AbortException = AbortException; 12688const NullCharactersRegExp = /\x00/g; 12689 12690function removeNullCharacters(str) { 12691 if (typeof str !== "string") { 12692 warn("The argument for removeNullCharacters must be a string."); 12693 return str; 12694 } 12695 12696 return str.replace(NullCharactersRegExp, ""); 12697} 12698 12699function bytesToString(bytes) { 12700 assert(bytes !== null && typeof bytes === "object" && bytes.length !== undefined, "Invalid argument for bytesToString"); 12701 const length = bytes.length; 12702 const MAX_ARGUMENT_COUNT = 8192; 12703 12704 if (length < MAX_ARGUMENT_COUNT) { 12705 return String.fromCharCode.apply(null, bytes); 12706 } 12707 12708 const strBuf = []; 12709 12710 for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) { 12711 const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length); 12712 const chunk = bytes.subarray(i, chunkEnd); 12713 strBuf.push(String.fromCharCode.apply(null, chunk)); 12714 } 12715 12716 return strBuf.join(""); 12717} 12718 12719function stringToBytes(str) { 12720 assert(typeof str === "string", "Invalid argument for stringToBytes"); 12721 const length = str.length; 12722 const bytes = new Uint8Array(length); 12723 12724 for (let i = 0; i < length; ++i) { 12725 bytes[i] = str.charCodeAt(i) & 0xff;
12726 } 12727 12728 return bytes; 12729} 12730 12731function arrayByteLength(arr) { 12732 if (arr.length !== undefined) { 12733 return arr.length; 12734 } 12735 12736 assert(arr.byteLength !== undefined); 12737 return arr.byteLength; 12738} 12739 12740function arraysToBytes(arr) { 12741 const length = arr.length; 12742 12743 if (length === 1 && arr[0] instanceof Uint8Array) { 12744 return arr[0]; 12745 } 12746 12747 let resultLength = 0; 12748 12749 for (let i = 0; i < length; i++) { 12750 resultLength += arrayByteLength(arr[i]); 12751 } 12752 12753 let pos = 0; 12754 const data = new Uint8Array(resultLength); 12755 12756 for (let i = 0; i < length; i++) { 12757 let item = arr[i]; 12758 12759 if (!(item instanceof Uint8Array)) { 12760 if (typeof item === "string") { 12761 item = stringToBytes(item); 12762 } else { 12763 item = new Uint8Array(item); 12764 } 12765 } 12766 12767 const itemLength = item.byteLength; 12768 data.set(item, pos); 12769 pos += itemLength; 12770 } 12771 12772 return data; 12773} 12774 12775function string32(value) { 12776 return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff); 12777} 12778 12779function isLittleEndian() { 12780 const buffer8 = new Uint8Array(4); 12781 buffer8[0] = 1; 12782 const view32 = new Uint32Array(buffer8.buffer, 0, 1); 12783 return view32[0] === 1; 12784} 12785 12786const IsLittleEndianCached = { 12787 get value() { 12788 return shadow(this, "value", isLittleEndian()); 12789 } 12790 12791}; 12792exports.IsLittleEndianCached = IsLittleEndianCached; 12793 12794function isEvalSupported() { 12795 try { 12796 new Function(""); 12797 return true; 12798 } catch (e) { 12799 return false; 12800 } 12801} 12802 12803const IsEvalSupportedCached = { 12804 get value() { 12805 return shadow(this, "value", isEvalSupported()); 12806 } 12807 12808}; 12809exports.IsEvalSupportedCached = IsEvalSupportedCached; 12810const rgbBuf = ["rgb(", 0, ",", 0, ",", 0, ")"]; 12811 12812class Util { 12813 static makeCssRgb(r, g, b) { 12814 rgbBuf[1] = r; 12815 rgbBuf[3] = g; 12816 rgbBuf[5] = b; 12817 return rgbBuf.join(""); 12818 } 12819 12820 static transform(m1, m2) { 12821 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]]; 12822 } 12823 12824 static applyTransform(p, m) { 12825 const xt = p[0] * m[0] + p[1] * m[2] + m[4]; 12826 const yt = p[0] * m[1] + p[1] * m[3] + m[5]; 12827 return [xt, yt]; 12828 } 12829 12830 static applyInverseTransform(p, m) { 12831 const d = m[0] * m[3] - m[1] * m[2]; 12832 const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d; 12833 const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d; 12834 return [xt, yt]; 12835 } 12836 12837 static getAxialAlignedBoundingBox(r, m) { 12838 const p1 = Util.applyTransform(r, m); 12839 const p2 = Util.applyTransform(r.slice(2, 4), m); 12840 const p3 = Util.applyTransform([r[0], r[3]], m); 12841 const p4 = Util.applyTransform([r[2], r[1]], m); 12842 return [Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math.max(p1[1], p2[1], p3[1], p4[1])]; 12843 } 12844 12845 static inverseTransform(m) { 12846 const d = m[0] * m[3] - m[1] * m[2]; 12847 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]; 12848 } 12849 12850 static apply3dTransform(m, v) { 12851 return [m[0] * v[0] + m[1] * v[1] + m[2] * v[2], m[3] * v[0] + m[4] * v[1] + m[5] * v[2], m[6] * v[0] + m[7] * v[1] + m[8] * v[2]]; 12852 } 12853 12854 static singularValueDecompose2dScale(m) { 12855 const transpose = [m[0], m[2], m[1], m[3]]; 12856 const a = m[0] * transpose[0] + m[1] * transpose[2]; 12857 const b = m[0] * transpose[1] + m[1] * transpose[3]; 12858 const c = m[2] * transpose[0] + m[3] * transpose[2]; 12859 const d = m[2] * transpose[1] + m[3] * transpose[3]; 12860 const first = (a + d) / 2; 12861 const second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2; 12862 const sx = first + second || 1; 12863 const sy = first - second || 1; 12864 return [Math.sqrt(sx), Math.sqrt(sy)]; 12865 } 12866 12867 static normalizeRect(rect) { 12868 const r = rect.slice(0); 12869 12870 if (rect[0] > rect[2]) { 12871 r[0] = rect[2]; 12872 r[2] = rect[0]; 12873 } 12874 12875 if (rect[1] > rect[3]) { 12876 r[1] = rect[3]; 12877 r[3] = rect[1]; 12878 } 12879 12880 return r; 12881 } 12882 12883 static intersect(rect1, rect2) { 12884 function compare(a, b) { 12885 return a - b; 12886 } 12887 12888 const orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare);
12889 const orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare); 12890 const result = []; 12891 rect1 = Util.normalizeRect(rect1); 12892 rect2 = Util.normalizeRect(rect2); 12893 12894 if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) { 12895 result[0] = orderedX[1]; 12896 result[2] = orderedX[2]; 12897 } else { 12898 return null; 12899 } 12900 12901 if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) { 12902 result[1] = orderedY[1]; 12903 result[3] = orderedY[2]; 12904 } else { 12905 return null; 12906 } 12907 12908 return result; 12909 } 12910 12911} 12912 12913exports.Util = Util; 12914const 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]; 12915 12916function stringToPDFString(str) { 12917 const length = str.length, 12918 strBuf = []; 12919 12920 if (str[0] === "\xFE" && str[1] === "\xFF") { 12921 for (let i = 2; i < length; i += 2) { 12922 strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1))); 12923 } 12924 } else if (str[0] === "\xFF" && str[1] === "\xFE") { 12925 for (let i = 2; i < length; i += 2) { 12926 strBuf.push(String.fromCharCode(str.charCodeAt(i + 1) << 8 | str.charCodeAt(i))); 12927 } 12928 } else { 12929 for (let i = 0; i < length; ++i) { 12930 const code = PDFStringTranslateTable[str.charCodeAt(i)]; 12931 strBuf.push(code ? String.fromCharCode(code) : str.charAt(i)); 12932 } 12933 } 12934 12935 return strBuf.join(""); 12936} 12937 12938function stringToUTF8String(str) { 12939 return decodeURIComponent(escape(str)); 12940} 12941 12942function utf8StringToString(str) { 12943 return unescape(encodeURIComponent(str)); 12944} 12945 12946function isEmptyObj(obj) { 12947 for (const key in obj) { 12948 return false; 12949 } 12950 12951 return true; 12952} 12953 12954function isBool(v) { 12955 return typeof v === "boolean"; 12956} 12957 12958function isNum(v) { 12959 return typeof v === "number"; 12960} 12961 12962function isString(v) { 12963 return typeof v === "string"; 12964} 12965 12966function isArrayBuffer(v) { 12967 return typeof v === "object" && v !== null && v.byteLength !== undefined; 12968} 12969 12970function isArrayEqual(arr1, arr2) { 12971 if (arr1.length !== arr2.length) { 12972 return false; 12973 } 12974 12975 return arr1.every(function (element, index) { 12976 return element === arr2[index]; 12977 }); 12978} 12979 12980function createPromiseCapability() { 12981 const capability = Object.create(null); 12982 let isSettled = false; 12983 Object.defineProperty(capability, "settled", { 12984 get() { 12985 return isSettled; 12986 } 12987 12988 }); 12989 capability.promise = new Promise(function (resolve, reject) { 12990 capability.resolve = function (data) { 12991 isSettled = true; 12992 resolve(data); 12993 }; 12994 12995 capability.reject = function (reason) { 12996 isSettled = true; 12997 reject(reason); 12998 }; 12999 }); 13000 return capability; 13001} 13002 13003const createObjectURL = function createObjectURLClosure() { 13004 const digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; 13005 return function createObjectURL(data, contentType, forceDataSchema = false) { 13006 if (!forceDataSchema && URL.createObjectURL) { 13007 const blob = new Blob([data], { 13008 type: contentType 13009 }); 13010 return URL.createObjectURL(blob); 13011 } 13012 13013 let buffer = `data:${contentType};base64,`; 13014 13015 for (let i = 0, ii = data.length; i < ii; i += 3) { 13016 const b1 = data[i] & 0xff; 13017 const b2 = data[i + 1] & 0xff; 13018 const b3 = data[i + 2] & 0xff;
13019 const d1 = b1 >> 2, 13020 d2 = (b1 & 3) << 4 | b2 >> 4; 13021 const d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64; 13022 const d4 = i + 2 < ii ? b3 & 0x3f : 64; 13023 buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4]; 13024 } 13025 13026 return buffer; 13027 }; 13028}(); 13029 13030exports.createObjectURL = createObjectURL; 13031 13032/***/ }), 13033/* 2 */ 13034/***/ (function(module, exports, __w_pdfjs_require__) { 13035 13036"use strict"; 13037 13038 13039; 13040 13041/***/ }), 13042/* 3 */ 13043/***/ (function(module, exports, __w_pdfjs_require__) { 13044 13045"use strict"; 13046 13047 13048Object.defineProperty(exports, "__esModule", { 13049 value: true 13050}); 13051exports.getDocument = getDocument; 13052exports.setPDFNetworkStreamFactory = setPDFNetworkStreamFactory; 13053exports.build = exports.version = exports.PDFPageProxy = exports.PDFDocumentProxy = exports.PDFWorker = exports.PDFDataRangeTransport = exports.LoopbackPort = void 0; 13054 13055var _util = __w_pdfjs_require__(1); 13056 13057var _display_utils = __w_pdfjs_require__(4); 13058 13059var _font_loader = __w_pdfjs_require__(5); 13060 13061var _api_compatibility = __w_pdfjs_require__(6); 13062 13063var _canvas = __w_pdfjs_require__(8); 13064 13065var _worker_options = __w_pdfjs_require__(10); 13066 13067var _is_node = __w_pdfjs_require__(7); 13068 13069var _message_handler = __w_pdfjs_require__(11); 13070 13071var _metadata = __w_pdfjs_require__(12); 13072 13073var _transport_stream = __w_pdfjs_require__(14); 13074 13075var _webgl = __w_pdfjs_require__(15); 13076 13077const DEFAULT_RANGE_CHUNK_SIZE = 65536; 13078const RENDERING_CANCELLED_TIMEOUT = 100; 13079let createPDFNetworkStream; 13080 13081function setPDFNetworkStreamFactory(pdfNetworkStreamFactory) { 13082 createPDFNetworkStream = pdfNetworkStreamFactory; 13083} 13084 13085function getDocument(src) { 13086 const task = new PDFDocumentLoadingTask(); 13087 let source; 13088 13089 if (typeof src === "string") { 13090 source = { 13091 url: src 13092 }; 13093 } else if ((0, _util.isArrayBuffer)(src)) { 13094 source = { 13095 data: src 13096 }; 13097 } else if (src instanceof PDFDataRangeTransport) { 13098 source = { 13099 range: src 13100 }; 13101 } else { 13102 if (typeof src !== "object") { 13103 throw new Error("Invalid parameter in getDocument, " + "need either Uint8Array, string or a parameter object"); 13104 } 13105 13106 if (!src.url && !src.data && !src.range) { 13107 throw new Error("Invalid parameter object: need either .data, .range or .url"); 13108 } 13109 13110 source = src; 13111 } 13112 13113 const params = Object.create(null); 13114 let rangeTransport = null, 13115 worker = null; 13116 13117 for (const key in source) { 13118 if (key === "url" && typeof window !== "undefined") { 13119 params[key] = new URL(source[key], window.location).href; 13120 continue; 13121 } else if (key === "range") { 13122 rangeTransport = source[key]; 13123 continue; 13124 } else if (key === "worker") { 13125 worker = source[key]; 13126 continue; 13127 } else if (key === "data" && !(source[key] instanceof Uint8Array)) { 13128 const pdfBytes = source[key]; 13129 13130 if (typeof pdfBytes === "string") { 13131 params[key] = (0, _util.stringToBytes)(pdfBytes); 13132 } else if (typeof pdfBytes === "object" && pdfBytes !== null && !isNaN(pdfBytes.length)) { 13133 params[key] = new Uint8Array(pdfBytes); 13134 } else if ((0, _util.isArrayBuffer)(pdfBytes)) { 13135 params[key] = new Uint8Array(pdfBytes); 13136 } else { 13137 throw new Error("Invalid PDF binary data: either typed array, " + "string or array-like object is expected in the " + "data property."); 13138 } 13139 13140 continue; 13141 } 13142 13143 params[key] = source[key]; 13144 } 13145 13146 params.rangeChunkSize = params.rangeChunkSize || DEFAULT_RANGE_CHUNK_SIZE; 13147 params.CMapReaderFactory = params.CMapReaderFactory || _display_utils.DOMCMapReaderFactory; 13148 params.ignoreErrors = params.stopAtErrors !== true; 13149 params.pdfBug = params.pdfBug === true; 13150 const NativeImageDecoderValues = Object.values(_util.NativeImageDecoding); 13151 13152 if (params.nativeImageDecoderSupport === undefined || !NativeImageDecoderValues.includes(params.nativeImageDecoderSupport)) { 13153 params.nativeImageDecoderSupport = _api_compatibility.apiCompatibilityParams.nativeImageDecoderSupport || _util.NativeImageDecoding.DECODE; 13154 } 13155 13156 if (!Number.isInteger(params.maxImageSize)) { 13157 params.maxImageSize = -1; 13158 } 13159 13160 if (typeof params.isEvalSupported !== "boolean") { 13161 params.isEvalSupported = true; 13162 } 13163 13164 if (typeof params.disableFontFace !== "boolean") { 13165 params.disableFontFace = _api_compatibility.apiCompatibilityParams.disableFontFace || false; 13166 } 13167 13168 if (typeof params.disableRange !== "boolean") { 13169 params.disableRange = false;
13170 } 13171 13172 if (typeof params.disableStream !== "boolean") { 13173 params.disableStream = false; 13174 } 13175 13176 if (typeof params.disableAutoFetch !== "boolean") { 13177 params.disableAutoFetch = false; 13178 } 13179 13180 if (typeof params.disableCreateObjectURL !== "boolean") { 13181 params.disableCreateObjectURL = _api_compatibility.apiCompatibilityParams.disableCreateObjectURL || false; 13182 } 13183 13184 (0, _util.setVerbosityLevel)(params.verbosity); 13185 13186 if (!worker) { 13187 const workerParams = { 13188 verbosity: params.verbosity, 13189 port: _worker_options.GlobalWorkerOptions.workerPort 13190 }; 13191 worker = workerParams.port ? PDFWorker.fromPort(workerParams) : new PDFWorker(workerParams); 13192 task._worker = worker; 13193 } 13194 13195 const docId = task.docId; 13196 worker.promise.then(function () { 13197 if (task.destroyed) { 13198 throw new Error("Loading aborted"); 13199 } 13200 13201 return _fetchDocument(worker, params, rangeTransport, docId).then(function (workerId) { 13202 if (task.destroyed) { 13203 throw new Error("Loading aborted"); 13204 } 13205 13206 let networkStream; 13207 13208 if (rangeTransport) { 13209 networkStream = new _transport_stream.PDFDataTransportStream({ 13210 length: params.length, 13211 initialData: params.initialData, 13212 progressiveDone: params.progressiveDone, 13213 disableRange: params.disableRange, 13214 disableStream: params.disableStream 13215 }, rangeTransport); 13216 } else if (!params.data) { 13217 networkStream = createPDFNetworkStream({ 13218 url: params.url, 13219 length: params.length, 13220 httpHeaders: params.httpHeaders, 13221 withCredentials: params.withCredentials, 13222 rangeChunkSize: params.rangeChunkSize, 13223 disableRange: params.disableRange, 13224 disableStream: params.disableStream 13225 }); 13226 } 13227 13228 const messageHandler = new _message_handler.MessageHandler(docId, workerId, worker.port); 13229 messageHandler.postMessageTransfers = worker.postMessageTransfers; 13230 const transport = new WorkerTransport(messageHandler, task, networkStream, params); 13231 task._transport = transport; 13232 messageHandler.send("Ready", null); 13233 }); 13234 }).catch(task._capability.reject); 13235 return task; 13236} 13237 13238function _fetchDocument(worker, source, pdfDataRangeTransport, docId) { 13239 if (worker.destroyed) { 13240 return Promise.reject(new Error("Worker was destroyed")); 13241 } 13242 13243 if (pdfDataRangeTransport) { 13244 source.length = pdfDataRangeTransport.length; 13245 source.initialData = pdfDataRangeTransport.initialData; 13246 source.progressiveDone = pdfDataRangeTransport.progressiveDone; 13247 } 13248 13249 return worker.messageHandler.sendWithPromise("GetDocRequest", { 13250 docId, 13251 apiVersion: '2.4.456', 13252 source: { 13253 data: source.data, 13254 url: source.url, 13255 password: source.password, 13256 disableAutoFetch: source.disableAutoFetch, 13257 rangeChunkSize: source.rangeChunkSize, 13258 length: source.length 13259 }, 13260 maxImageSize: source.maxImageSize, 13261 disableFontFace: source.disableFontFace, 13262 disableCreateObjectURL: source.disableCreateObjectURL, 13263 postMessageTransfers: worker.postMessageTransfers, 13264 docBaseUrl: source.docBaseUrl, 13265 nativeImageDecoderSupport: source.nativeImageDecoderSupport, 13266 ignoreErrors: source.ignoreErrors, 13267 isEvalSupported: source.isEvalSupported 13268 }).then(function (workerId) { 13269 if (worker.destroyed) { 13270 throw new Error("Worker was destroyed"); 13271 } 13272 13273 return workerId; 13274 }); 13275} 13276 13277const PDFDocumentLoadingTask = function PDFDocumentLoadingTaskClosure() { 13278 let nextDocumentId = 0; 13279 13280 class PDFDocumentLoadingTask { 13281 constructor() { 13282 this._capability = (0, _util.createPromiseCapability)(); 13283 this._transport = null; 13284 this._worker = null; 13285 this.docId = "d" + nextDocumentId++; 13286 this.destroyed = false; 13287 this.onPassword = null; 13288 this.onProgress = null; 13289 this.onUnsupportedFeature = null; 13290 } 13291 13292 get promise() { 13293 return this._capability.promise; 13294 } 13295 13296 destroy() { 13297 this.destroyed = true; 13298 const transportDestroyed = !this._transport ? Promise.resolve() : this._transport.destroy(); 13299 return transportDestroyed.then(() => { 13300 this._transport = null; 13301 13302 if (this._worker) { 13303 this._worker.destroy(); 13304 13305 this._worker = null; 13306 } 13307 }); 13308 } 13309 13310 then(onFulfilled, onRejected) { 13311 throw new Error("Removed API method: " + "PDFDocumentLoadingTask.then, use the `promise` getter instead."); 13312 } 13313 13314 } 13315 13316 return PDFDocumentLoadingTask; 13317}(); 13318 13319class PDFDataRangeTransport { 13320 constructor(length, initialData, progressiveDone = false) { 13321 this.length = length; 13322 this.initialData = initialData; 13323 this.progressiveDone = progressiveDone; 13324 this._rangeListeners = []; 13325 this._progressListeners = []; 13326 this._progressiveReadListeners = []; 13327 this._progressiveDoneListeners = []; 13328 this._readyCapability = (0, _util.createPromiseCapability)(); 13329 } 13330 13331 addRangeListener(listener) { 13332 this._rangeListeners.push(listener); 13333 } 13334 13335 addProgressListener(listener) { 13336 this._progressListeners.push(listener); 13337 } 13338 13339 addProgressiveReadListener(listener) { 13340 this._progressiveReadListeners.push(listener); 13341 } 13342 13343 addProgressiveDoneListener(listener) { 13344 this._progressiveDoneListeners.push(listener); 13345 } 13346 13347 onDataRange(begin, chunk) { 13348 for (const listener of this._rangeListeners) { 13349 listener(begin, chunk); 13350 } 13351 } 13352 13353 onDataProgress(loaded, total) { 13354 this._readyCapability.promise.then(() => { 13355 for (const listener of this._progressListeners) { 13356 listener(loaded, total); 13357 } 13358 }); 13359 } 13360 13361 onDataProgressiveRead(chunk) { 13362 this._readyCapability.promise.then(() => { 13363 for (const listener of this._progressiveReadListeners) { 13364 listener(chunk); 13365 } 13366 }); 13367 } 13368 13369 onDataProgressiveDone() { 13370 this._readyCapability.promise.then(() => { 13371 for (const listener of this._progressiveDoneListeners) { 13372 listener(); 13373 } 13374 }); 13375 } 13376 13377 transportReady() { 13378 this._readyCapability.resolve(); 13379 } 13380 13381 requestDataRange(begin, end) { 13382 (0, _util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange"); 13383 } 13384 13385 abort() {} 13386 13387} 13388 13389exports.PDFDataRangeTransport = PDFDataRangeTransport; 13390 13391class PDFDocumentProxy { 13392 constructor(pdfInfo, transport) { 13393 this._pdfInfo = pdfInfo; 13394 this._transport = transport; 13395 } 13396 13397 get numPages() { 13398 return this._pdfInfo.numPages; 13399 } 13400 13401 get fingerprint() { 13402 return this._pdfInfo.fingerprint; 13403 } 13404 13405 getPage(pageNumber) { 13406 return this._transport.getPage(pageNumber); 13407 } 13408 13409 getPageIndex(ref) { 13410 return this._transport.getPageIndex(ref); 13411 } 13412 13413 getDestinations() { 13414 return this._transport.getDestinations(); 13415 } 13416 13417 getDestination(id) { 13418 return this._transport.getDestination(id); 13419 } 13420 13421 getPageLabels() { 13422 return this._transport.getPageLabels(); 13423 } 13424 13425 getPageLayout() { 13426 return this._transport.getPageLayout(); 13427 } 13428 13429 getPageMode() { 13430 return this._transport.getPageMode(); 13431 } 13432 13433 getViewerPreferences() { 13434 return this._transport.getViewerPreferences(); 13435 } 13436 13437 getOpenAction() { 13438 return this._transport.getOpenAction(); 13439 } 13440 13441 getOpenActionDestination() { 13442 (0, _display_utils.deprecated)("getOpenActionDestination, use getOpenAction instead."); 13443 return this.getOpenAction().then(function (openAction) { 13444 return openAction && openAction.dest ? openAction.dest : null; 13445 }); 13446 } 13447 13448 getAttachments() { 13449 return this._transport.getAttachments(); 13450 } 13451 13452 getJavaScript() { 13453 return this._transport.getJavaScript(); 13454 } 13455 13456 getOutline() { 13457 return this._transport.getOutline(); 13458 } 13459 13460 getPermissions() { 13461 return this._transport.getPermissions(); 13462 } 13463 13464 getMetadata() { 13465 return this._transport.getMetadata(); 13466 } 13467 13468 getData() { 13469 return this._transport.getData(); 13470 } 13471 13472 getDownloadInfo() { 13473 return this._transport.downloadInfoCapability.promise; 13474 } 13475 13476 getStats() { 13477 return this._transport.getStats(); 13478 } 13479 13480 cleanup() { 13481 return this._transport.startCleanup(); 13482 } 13483 13484 destroy() { 13485 return this.loadingTask.destroy(); 13486 } 13487 13488 get loadingParams() { 13489 return this._transport.loadingParams; 13490 } 13491 13492 get loadingTask() { 13493 return this._transport.loadingTask; 13494 } 13495 13496} 13497 13498exports.PDFDocumentProxy = PDFDocumentProxy; 13499 13500class PDFPageProxy { 13501 constructor(pageIndex, pageInfo, transport, pdfBug = false) { 13502 this._pageIndex = pageIndex; 13503 this._pageInfo = pageInfo; 13504 this._transport = transport; 13505 this._stats = pdfBug ? new _display_utils.StatTimer() : null; 13506 this._pdfBug = pdfBug; 13507 this.commonObjs = transport.commonObjs; 13508 this.objs = new PDFObjects(); 13509 this.cleanupAfterRender = false;
13510 this.pendingCleanup = false; 13511 this.intentStates = Object.create(null); 13512 this.destroyed = false; 13513 } 13514 13515 get pageNumber() { 13516 return this._pageIndex + 1; 13517 } 13518 13519 get rotate() { 13520 return this._pageInfo.rotate; 13521 } 13522 13523 get ref() { 13524 return this._pageInfo.ref; 13525 } 13526 13527 get userUnit() { 13528 return this._pageInfo.userUnit; 13529 } 13530 13531 get view() { 13532 return this._pageInfo.view; 13533 } 13534 13535 getViewport({ 13536 scale, 13537 rotation = this.rotate, 13538 offsetX = 0, 13539 offsetY = 0, 13540 dontFlip = false 13541 } = {}) { 13542 if (arguments.length > 1 || typeof arguments[0] === "number") { 13543 throw new Error("PDFPageProxy.getViewport is called with obsolete arguments."); 13544 } 13545 13546 return new _display_utils.PageViewport({ 13547 viewBox: this.view, 13548 scale, 13549 rotation, 13550 offsetX, 13551 offsetY, 13552 dontFlip 13553 }); 13554 } 13555 13556 getAnnotations({ 13557 intent = null 13558 } = {}) { 13559 if (!this.annotationsPromise || this.annotationsIntent !== intent) { 13560 this.annotationsPromise = this._transport.getAnnotations(this._pageIndex, intent); 13561 this.annotationsIntent = intent; 13562 } 13563 13564 return this.annotationsPromise; 13565 } 13566 13567 render({ 13568 canvasContext, 13569 viewport, 13570 intent = "display", 13571 enableWebGL = false, 13572 renderInteractiveForms = false, 13573 transform = null, 13574 imageLayer = null, 13575 canvasFactory = null, 13576 background = null 13577 }) { 13578 if (this._stats) { 13579 this._stats.time("Overall"); 13580 } 13581 13582 const renderingIntent = intent === "print" ? "print" : "display"; 13583 this.pendingCleanup = false; 13584 13585 if (!this.intentStates[renderingIntent]) { 13586 this.intentStates[renderingIntent] = Object.create(null); 13587 } 13588 13589 const intentState = this.intentStates[renderingIntent]; 13590 13591 if (intentState.streamReaderCancelTimeout) { 13592 clearTimeout(intentState.streamReaderCancelTimeout); 13593 intentState.streamReaderCancelTimeout = null; 13594 } 13595 13596 const canvasFactoryInstance = canvasFactory || new _display_utils.DOMCanvasFactory(); 13597 const webGLContext = new _webgl.WebGLContext({ 13598 enable: enableWebGL 13599 }); 13600 13601 if (!intentState.displayReadyCapability) { 13602 intentState.displayReadyCapability = (0, _util.createPromiseCapability)(); 13603 intentState.operatorList = { 13604 fnArray: [], 13605 argsArray: [], 13606 lastChunk: false 13607 }; 13608 13609 if (this._stats) { 13610 this._stats.time("Page Request"); 13611 } 13612 13613 this._pumpOperatorList({ 13614 pageIndex: this._pageIndex, 13615 intent: renderingIntent, 13616 renderInteractiveForms: renderInteractiveForms === true 13617 }); 13618 } 13619 13620 const complete = error => { 13621 const i = intentState.renderTasks.indexOf(internalRenderTask); 13622 13623 if (i >= 0) { 13624 intentState.renderTasks.splice(i, 1); 13625 } 13626 13627 if (this.cleanupAfterRender || renderingIntent === "print") { 13628 this.pendingCleanup = true; 13629 } 13630 13631 this._tryCleanup(); 13632 13633 if (error) { 13634 internalRenderTask.capability.reject(error); 13635 13636 this._abortOperatorList({ 13637 intentState, 13638 reason: error 13639 }); 13640 } else { 13641 internalRenderTask.capability.resolve(); 13642 } 13643 13644 if (this._stats) { 13645 this._stats.timeEnd("Rendering"); 13646 13647 this._stats.timeEnd("Overall"); 13648 } 13649 }; 13650 13651 const internalRenderTask = new InternalRenderTask({ 13652 callback: complete, 13653 params: { 13654 canvasContext, 13655 viewport, 13656 transform, 13657 imageLayer, 13658 background 13659 }, 13660 objs: this.objs, 13661 commonObjs: this.commonObjs, 13662 operatorList: intentState.operatorList, 13663 pageIndex: this._pageIndex, 13664 canvasFactory: canvasFactoryInstance, 13665 webGLContext, 13666 useRequestAnimationFrame: renderingIntent !== "print", 13667 pdfBug: this._pdfBug 13668 }); 13669 13670 if (!intentState.renderTasks) { 13671 intentState.renderTasks = []; 13672 } 13673 13674 intentState.renderTasks.push(internalRenderTask); 13675 const renderTask = internalRenderTask.task; 13676 intentState.displayReadyCapability.promise.then(transparency => { 13677 if (this.pendingCleanup) { 13678 complete(); 13679 return; 13680 } 13681 13682 if (this._stats) {
13683 this._stats.time("Rendering"); 13684 } 13685 13686 internalRenderTask.initializeGraphics(transparency); 13687 internalRenderTask.operatorListChanged(); 13688 }).catch(complete); 13689 return renderTask; 13690 } 13691 13692 getOperatorList() { 13693 function operatorListChanged() { 13694 if (intentState.operatorList.lastChunk) { 13695 intentState.opListReadCapability.resolve(intentState.operatorList); 13696 const i = intentState.renderTasks.indexOf(opListTask); 13697 13698 if (i >= 0) { 13699 intentState.renderTasks.splice(i, 1); 13700 } 13701 } 13702 } 13703 13704 const renderingIntent = "oplist"; 13705 13706 if (!this.intentStates[renderingIntent]) { 13707 this.intentStates[renderingIntent] = Object.create(null); 13708 } 13709 13710 const intentState = this.intentStates[renderingIntent]; 13711 let opListTask; 13712 13713 if (!intentState.opListReadCapability) { 13714 opListTask = {}; 13715 opListTask.operatorListChanged = operatorListChanged; 13716 intentState.opListReadCapability = (0, _util.createPromiseCapability)(); 13717 intentState.renderTasks = []; 13718 intentState.renderTasks.push(opListTask); 13719 intentState.operatorList = { 13720 fnArray: [], 13721 argsArray: [], 13722 lastChunk: false 13723 }; 13724 13725 if (this._stats) { 13726 this._stats.time("Page Request"); 13727 } 13728 13729 this._pumpOperatorList({ 13730 pageIndex: this._pageIndex, 13731 intent: renderingIntent 13732 }); 13733 } 13734 13735 return intentState.opListReadCapability.promise; 13736 } 13737 13738 streamTextContent({ 13739 normalizeWhitespace = false, 13740 disableCombineTextItems = false 13741 } = {}) { 13742 const TEXT_CONTENT_CHUNK_SIZE = 100; 13743 return this._transport.messageHandler.sendWithStream("GetTextContent", { 13744 pageIndex: this._pageIndex, 13745 normalizeWhitespace: normalizeWhitespace === true, 13746 combineTextItems: disableCombineTextItems !== true 13747 }, { 13748 highWaterMark: TEXT_CONTENT_CHUNK_SIZE, 13749 13750 size(textContent) { 13751 return textContent.items.length; 13752 } 13753 13754 }); 13755 } 13756 13757 getTextContent(params = {}) { 13758 const readableStream = this.streamTextContent(params); 13759 return new Promise(function (resolve, reject) { 13760 function pump() { 13761 reader.read().then(function ({ 13762 value, 13763 done 13764 }) { 13765 if (done) { 13766 resolve(textContent); 13767 return; 13768 } 13769 13770 Object.assign(textContent.styles, value.styles); 13771 textContent.items.push(...value.items); 13772 pump(); 13773 }, reject); 13774 } 13775 13776 const reader = readableStream.getReader(); 13777 const textContent = { 13778 items: [], 13779 styles: Object.create(null) 13780 }; 13781 pump(); 13782 }); 13783 } 13784 13785 _destroy() { 13786 this.destroyed = true; 13787 this._transport.pageCache[this._pageIndex] = null; 13788 const waitOn = []; 13789 Object.keys(this.intentStates).forEach(intent => { 13790 const intentState = this.intentStates[intent]; 13791 13792 this._abortOperatorList({ 13793 intentState, 13794 reason: new Error("Page was destroyed."), 13795 force: true 13796 }); 13797 13798 if (intent === "oplist") { 13799 return; 13800 } 13801 13802 intentState.renderTasks.forEach(function (renderTask) { 13803 const renderCompleted = renderTask.capability.promise.catch(function () {}); 13804 waitOn.push(renderCompleted); 13805 renderTask.cancel(); 13806 }); 13807 }); 13808 this.objs.clear(); 13809 this.annotationsPromise = null; 13810 this.pendingCleanup = false; 13811 return Promise.all(waitOn); 13812 } 13813 13814 cleanup(resetStats = false) { 13815 this.pendingCleanup = true; 13816 return this._tryCleanup(resetStats); 13817 } 13818 13819 _tryCleanup(resetStats = false) { 13820 if (!this.pendingCleanup || Object.keys(this.intentStates).some(intent => { 13821 const intentState = this.intentStates[intent]; 13822 return intentState.renderTasks.length !== 0 || !intentState.operatorList.lastChunk; 13823 })) { 13824 return false; 13825 } 13826 13827 Object.keys(this.intentStates).forEach(intent => { 13828 delete this.intentStates[intent]; 13829 }); 13830 this.objs.clear(); 13831 this.annotationsPromise = null; 13832 13833 if (resetStats && this._stats) { 13834 this._stats = new _display_utils.StatTimer(); 13835 } 13836 13837 this.pendingCleanup = false;
13838 return true; 13839 } 13840 13841 _startRenderPage(transparency, intent) { 13842 const intentState = this.intentStates[intent]; 13843 13844 if (!intentState) { 13845 return; 13846 } 13847 13848 if (this._stats) { 13849 this._stats.timeEnd("Page Request"); 13850 } 13851 13852 if (intentState.displayReadyCapability) { 13853 intentState.displayReadyCapability.resolve(transparency); 13854 } 13855 } 13856 13857 _renderPageChunk(operatorListChunk, intentState) { 13858 for (let i = 0, ii = operatorListChunk.length; i < ii; i++) { 13859 intentState.operatorList.fnArray.push(operatorListChunk.fnArray[i]); 13860 intentState.operatorList.argsArray.push(operatorListChunk.argsArray[i]); 13861 } 13862 13863 intentState.operatorList.lastChunk = operatorListChunk.lastChunk; 13864 13865 for (let i = 0; i < intentState.renderTasks.length; i++) { 13866 intentState.renderTasks[i].operatorListChanged(); 13867 } 13868 13869 if (operatorListChunk.lastChunk) { 13870 this._tryCleanup(); 13871 } 13872 } 13873 13874 _pumpOperatorList(args) { 13875 (0, _util.assert)(args.intent, 'PDFPageProxy._pumpOperatorList: Expected "intent" argument.'); 13876 13877 const readableStream = this._transport.messageHandler.sendWithStream("GetOperatorList", args); 13878 13879 const reader = readableStream.getReader(); 13880 const intentState = this.intentStates[args.intent]; 13881 intentState.streamReader = reader; 13882 13883 const pump = () => { 13884 reader.read().then(({ 13885 value, 13886 done 13887 }) => { 13888 if (done) { 13889 intentState.streamReader = null; 13890 return; 13891 } 13892 13893 if (this._transport.destroyed) { 13894 return; 13895 } 13896 13897 this._renderPageChunk(value, intentState); 13898 13899 pump(); 13900 }, reason => { 13901 intentState.streamReader = null; 13902 13903 if (this._transport.destroyed) { 13904 return; 13905 } 13906 13907 if (intentState.operatorList) { 13908 intentState.operatorList.lastChunk = true; 13909 13910 for (let i = 0; i < intentState.renderTasks.length; i++) { 13911 intentState.renderTasks[i].operatorListChanged(); 13912 } 13913 13914 this._tryCleanup(); 13915 } 13916 13917 if (intentState.displayReadyCapability) { 13918 intentState.displayReadyCapability.reject(reason); 13919 } else if (intentState.opListReadCapability) { 13920 intentState.opListReadCapability.reject(reason); 13921 } else { 13922 throw reason; 13923 } 13924 }); 13925 }; 13926 13927 pump(); 13928 } 13929 13930 _abortOperatorList({ 13931 intentState, 13932 reason, 13933 force = false 13934 }) { 13935 (0, _util.assert)(reason instanceof Error || typeof reason === "object" && reason !== null, 'PDFPageProxy._abortOperatorList: Expected "reason" argument.'); 13936 13937 if (!intentState.streamReader) { 13938 return; 13939 } 13940 13941 if (!force) { 13942 if (intentState.renderTasks.length !== 0) { 13943 return; 13944 } 13945 13946 if (reason instanceof _display_utils.RenderingCancelledException) { 13947 intentState.streamReaderCancelTimeout = setTimeout(() => { 13948 this._abortOperatorList({ 13949 intentState, 13950 reason, 13951 force: true 13952 }); 13953 13954 intentState.streamReaderCancelTimeout = null; 13955 }, RENDERING_CANCELLED_TIMEOUT); 13956 return; 13957 } 13958 } 13959 13960 intentState.streamReader.cancel(new _util.AbortException(reason && reason.message)); 13961 intentState.streamReader = null; 13962 13963 if (this._transport.destroyed) { 13964 return; 13965 } 13966 13967 Object.keys(this.intentStates).some(intent => { 13968 if (this.intentStates[intent] === intentState) { 13969 delete this.intentStates[intent]; 13970 return true; 13971 } 13972 13973 return false; 13974 }); 13975 this.cleanup(); 13976 } 13977 13978 get stats() { 13979 return this._stats; 13980 } 13981 13982} 13983 13984exports.PDFPageProxy = PDFPageProxy; 13985 13986class LoopbackPort { 13987 constructor(defer = true) { 13988 this._listeners = []; 13989 this._defer = defer; 13990 this._deferred = Promise.resolve(undefined); 13991 } 13992 13993 postMessage(obj, transfers) { 13994 function cloneValue(value) { 13995 if (typeof value !== "object" || value === null) { 13996 return value; 13997 } 13998 13999 if (cloned.has(value)) { 14000 return cloned.get(value); 14001 } 14002 14003 let buffer, result; 14004 14005 if ((buffer = value.buffer) && (0, _util.isArrayBuffer)(buffer)) { 14006 const transferable = transfers && transfers.includes(buffer); 14007 14008 if (transferable) { 14009 result = new value.constructor(buffer, value.byteOffset, value.byteLength); 14010 } else { 14011 result = new value.constructor(value); 14012 } 14013 14014 cloned.set(value, result); 14015 return result; 14016 } 14017 14018 result = Array.isArray(value) ? [] : {}; 14019 cloned.set(value, result); 14020 14021 for (const i in value) { 14022 let desc, 14023 p = value; 14024 14025 while (!(desc = Object.getOwnPropertyDescriptor(p, i))) { 14026 p = Object.getPrototypeOf(p); 14027 } 14028 14029 if (typeof desc.value === "undefined") { 14030 continue; 14031 } 14032 14033 if (typeof desc.value === "function") { 14034 if (value.hasOwnProperty && value.hasOwnProperty(i)) { 14035 throw new Error(`LoopbackPort.postMessage - cannot clone: ${value[i]}`); 14036 } 14037 14038 continue; 14039 } 14040 14041 result[i] = cloneValue(desc.value); 14042 } 14043 14044 return result; 14045 } 14046 14047 if (!this._defer) {
14048 this._listeners.forEach(listener => { 14049 listener.call(this, { 14050 data: obj 14051 }); 14052 }); 14053 14054 return; 14055 } 14056 14057 const cloned = new WeakMap(); 14058 const e = { 14059 data: cloneValue(obj) 14060 }; 14061 14062 this._deferred.then(() => { 14063 this._listeners.forEach(listener => { 14064 listener.call(this, e); 14065 }); 14066 }); 14067 } 14068 14069 addEventListener(name, listener) { 14070 this._listeners.push(listener); 14071 } 14072 14073 removeEventListener(name, listener) { 14074 const i = this._listeners.indexOf(listener); 14075 14076 this._listeners.splice(i, 1); 14077 } 14078 14079 terminate() { 14080 this._listeners.length = 0; 14081 } 14082 14083} 14084 14085exports.LoopbackPort = LoopbackPort; 14086 14087const PDFWorker = function PDFWorkerClosure() { 14088 const pdfWorkerPorts = new WeakMap(); 14089 let isWorkerDisabled = false; 14090 let fallbackWorkerSrc; 14091 let nextFakeWorkerId = 0; 14092 let fakeWorkerCapability; 14093 14094 if (_is_node.isNodeJS && typeof require === "function") { 14095 isWorkerDisabled = true; 14096 fallbackWorkerSrc = "./pdf.worker.js"; 14097 } else if (typeof document === "object" && "currentScript" in document) { 14098 const pdfjsFilePath = document.currentScript && document.currentScript.src; 14099 14100 if (pdfjsFilePath) { 14101 fallbackWorkerSrc = pdfjsFilePath.replace(/(\.(?:min\.)?js)(\?.*)?$/i, ".worker$1$2"); 14102 } 14103 } 14104 14105 function getWorkerSrc() { 14106 if (_worker_options.GlobalWorkerOptions.workerSrc) { 14107 return _worker_options.GlobalWorkerOptions.workerSrc; 14108 } 14109 14110 if (typeof fallbackWorkerSrc !== "undefined") { 14111 if (!_is_node.isNodeJS) { 14112 (0, _display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.'); 14113 } 14114 14115 return fallbackWorkerSrc; 14116 } 14117 14118 throw new Error('No "GlobalWorkerOptions.workerSrc" specified.'); 14119 } 14120 14121 function getMainThreadWorkerMessageHandler() { 14122 let mainWorkerMessageHandler; 14123 14124 try { 14125 mainWorkerMessageHandler = globalThis.pdfjsWorker && globalThis.pdfjsWorker.WorkerMessageHandler; 14126 } catch (ex) {} 14127 14128 return mainWorkerMessageHandler || null; 14129 } 14130 14131 function setupFakeWorkerGlobal() { 14132 if (fakeWorkerCapability) { 14133 return fakeWorkerCapability.promise; 14134 } 14135 14136 fakeWorkerCapability = (0, _util.createPromiseCapability)(); 14137 14138 const loader = async function () { 14139 const mainWorkerMessageHandler = getMainThreadWorkerMessageHandler(); 14140 14141 if (mainWorkerMessageHandler) { 14142 return mainWorkerMessageHandler; 14143 } 14144 14145 if (_is_node.isNodeJS && typeof require === "function") { 14146 const worker = eval("require")(getWorkerSrc()); 14147 return worker.WorkerMessageHandler; 14148 } 14149 14150 await (0, _display_utils.loadScript)(getWorkerSrc()); 14151 return window.pdfjsWorker.WorkerMessageHandler; 14152 }; 14153 14154 loader().then(fakeWorkerCapability.resolve, fakeWorkerCapability.reject); 14155 return fakeWorkerCapability.promise; 14156 } 14157 14158 function createCDNWrapper(url) { 14159 const wrapper = "importScripts('" + url + "');"; 14160 return URL.createObjectURL(new Blob([wrapper])); 14161 } 14162 14163 class PDFWorker { 14164 constructor({ 14165 name = null, 14166 port = null, 14167 verbosity = (0, _util.getVerbosityLevel)() 14168 } = {}) { 14169 if (port && pdfWorkerPorts.has(port)) { 14170 throw new Error("Cannot use more than one PDFWorker per port"); 14171 } 14172 14173 this.name = name; 14174 this.destroyed = false; 14175 this.postMessageTransfers = true; 14176 this.verbosity = verbosity; 14177 this._readyCapability = (0, _util.createPromiseCapability)(); 14178 this._port = null; 14179 this._webWorker = null; 14180 this._messageHandler = null; 14181 14182 if (port) { 14183 pdfWorkerPorts.set(port, this); 14184 14185 this._initializeFromPort(port); 14186 14187 return; 14188 } 14189 14190 this._initialize(); 14191 } 14192 14193 get promise() { 14194 return this._readyCapability.promise; 14195 } 14196 14197 get port() { 14198 return this._port; 14199 } 14200 14201 get messageHandler() { 14202 return this._messageHandler; 14203 } 14204 14205 _initializeFromPort(port) { 14206 this._port = port; 14207 this._messageHandler = new _message_handler.MessageHandler("main", "worker", port); 14208 14209 this._messageHandler.on("ready", function () {}); 14210 14211 this._readyCapability.resolve(); 14212 } 14213 14214 _initialize() { 14215 if (typeof Worker !== "undefined" && !isWorkerDisabled && !getMainThreadWorkerMessageHandler()) { 14216 let workerSrc = getWorkerSrc(); 14217 14218 try { 14219 if (!(0, _util.isSameOrigin)(window.location.href, workerSrc)) { 14220 workerSrc = createCDNWrapper(new URL(workerSrc, window.location).href); 14221 } 14222 14223 const worker = new Worker(workerSrc); 14224 const messageHandler = new _message_handler.MessageHandler("main", "worker", worker); 14225 14226 const terminateEarly = () => { 14227 worker.removeEventListener("error", onWorkerError); 14228 messageHandler.destroy(); 14229 worker.terminate(); 14230 14231 if (this.destroyed) { 14232 this._readyCapability.reject(new Error("Worker was destroyed")); 14233 } else { 14234 this._setupFakeWorker(); 14235 } 14236 }; 14237 14238 const onWorkerError = () => { 14239 if (!this._webWorker) { 14240 terminateEarly(); 14241 } 14242 }; 14243 14244 worker.addEventListener("error", onWorkerError); 14245 messageHandler.on("test", data => { 14246 worker.removeEventListener("error", onWorkerError); 14247 14248 if (this.destroyed) { 14249 terminateEarly(); 14250 return; 14251 } 14252 14253 if (data) { 14254 this._messageHandler = messageHandler; 14255 this._port = worker; 14256 this._webWorker = worker; 14257 14258 if (!data.supportTransfers) { 14259 this.postMessageTransfers = false;
14260 } 14261 14262 this._readyCapability.resolve(); 14263 14264 messageHandler.send("configure", { 14265 verbosity: this.verbosity 14266 }); 14267 } else { 14268 this._setupFakeWorker(); 14269 14270 messageHandler.destroy(); 14271 worker.terminate(); 14272 } 14273 }); 14274 messageHandler.on("ready", data => { 14275 worker.removeEventListener("error", onWorkerError); 14276 14277 if (this.destroyed) { 14278 terminateEarly(); 14279 return; 14280 } 14281 14282 try { 14283 sendTest(); 14284 } catch (e) { 14285 this._setupFakeWorker(); 14286 } 14287 }); 14288 14289 const sendTest = () => { 14290 const testObj = new Uint8Array([this.postMessageTransfers ? 255 : 0]); 14291 14292 try { 14293 messageHandler.send("test", testObj, [testObj.buffer]); 14294 } catch (ex) { 14295 (0, _util.warn)("Cannot use postMessage transfers."); 14296 testObj[0] = 0; 14297 messageHandler.send("test", testObj); 14298 } 14299 }; 14300 14301 sendTest(); 14302 return; 14303 } catch (e) { 14304 (0, _util.info)("The worker has been disabled."); 14305 } 14306 } 14307 14308 this._setupFakeWorker(); 14309 } 14310 14311 _setupFakeWorker() { 14312 if (!isWorkerDisabled) { 14313 (0, _util.warn)("Setting up fake worker."); 14314 isWorkerDisabled = true; 14315 } 14316 14317 setupFakeWorkerGlobal().then(WorkerMessageHandler => { 14318 if (this.destroyed) { 14319 this._readyCapability.reject(new Error("Worker was destroyed")); 14320 14321 return; 14322 } 14323 14324 const port = new LoopbackPort(); 14325 this._port = port; 14326 const id = "fake" + nextFakeWorkerId++; 14327 const workerHandler = new _message_handler.MessageHandler(id + "_worker", id, port); 14328 WorkerMessageHandler.setup(workerHandler, port); 14329 const messageHandler = new _message_handler.MessageHandler(id, id + "_worker", port); 14330 this._messageHandler = messageHandler; 14331 14332 this._readyCapability.resolve(); 14333 14334 messageHandler.send("configure", { 14335 verbosity: this.verbosity 14336 }); 14337 }).catch(reason => { 14338 this._readyCapability.reject(new Error(`Setting up fake worker failed: "${reason.message}".`)); 14339 }); 14340 } 14341 14342 destroy() { 14343 this.destroyed = true; 14344 14345 if (this._webWorker) { 14346 this._webWorker.terminate(); 14347 14348 this._webWorker = null; 14349 } 14350 14351 pdfWorkerPorts.delete(this._port); 14352 this._port = null; 14353 14354 if (this._messageHandler) { 14355 this._messageHandler.destroy(); 14356 14357 this._messageHandler = null; 14358 } 14359 } 14360 14361 static fromPort(params) { 14362 if (!params || !params.port) { 14363 throw new Error("PDFWorker.fromPort - invalid method signature."); 14364 } 14365 14366 if (pdfWorkerPorts.has(params.port)) { 14367 return pdfWorkerPorts.get(params.port); 14368 } 14369 14370 return new PDFWorker(params); 14371 } 14372 14373 static getWorkerSrc() { 14374 return getWorkerSrc(); 14375 } 14376 14377 } 14378 14379 return PDFWorker; 14380}(); 14381 14382exports.PDFWorker = PDFWorker; 14383 14384class WorkerTransport { 14385 constructor(messageHandler, loadingTask, networkStream, params) { 14386 this.messageHandler = messageHandler; 14387 this.loadingTask = loadingTask; 14388 this.commonObjs = new PDFObjects(); 14389 this.fontLoader = new _font_loader.FontLoader({ 14390 docId: loadingTask.docId, 14391 onUnsupportedFeature: this._onUnsupportedFeature.bind(this) 14392 }); 14393 this._params = params; 14394 this.CMapReaderFactory = new params.CMapReaderFactory({ 14395 baseUrl: params.cMapUrl, 14396 isCompressed: params.cMapPacked 14397 }); 14398 this.destroyed = false; 14399 this.destroyCapability = null; 14400 this._passwordCapability = null; 14401 this._networkStream = networkStream; 14402 this._fullReader = null; 14403 this._lastProgress = null; 14404 this.pageCache = []; 14405 this.pagePromises = []; 14406 this.downloadInfoCapability = (0, _util.createPromiseCapability)(); 14407 this.setupMessageHandler(); 14408 } 14409 14410 destroy() { 14411 if (this.destroyCapability) { 14412 return this.destroyCapability.promise; 14413 } 14414 14415 this.destroyed = true; 14416 this.destroyCapability = (0, _util.createPromiseCapability)(); 14417 14418 if (this._passwordCapability) { 14419 this._passwordCapability.reject(new Error("Worker was destroyed during onPassword callback")); 14420 } 14421 14422 const waitOn = []; 14423 this.pageCache.forEach(function (page) { 14424 if (page) { 14425 waitOn.push(page._destroy()); 14426 } 14427 }); 14428 this.pageCache.length = 0; 14429 this.pagePromises.length = 0;
14430 const terminated = this.messageHandler.sendWithPromise("Terminate", null); 14431 waitOn.push(terminated); 14432 Promise.all(waitOn).then(() => { 14433 this.fontLoader.clear(); 14434 14435 if (this._networkStream) { 14436 this._networkStream.cancelAllRequests(new _util.AbortException("Worker was terminated.")); 14437 } 14438 14439 if (this.messageHandler) { 14440 this.messageHandler.destroy(); 14441 this.messageHandler = null; 14442 } 14443 14444 this.destroyCapability.resolve(); 14445 }, this.destroyCapability.reject); 14446 return this.destroyCapability.promise; 14447 } 14448 14449 setupMessageHandler() { 14450 const { 14451 messageHandler, 14452 loadingTask 14453 } = this; 14454 messageHandler.on("GetReader", (data, sink) => { 14455 (0, _util.assert)(this._networkStream); 14456 this._fullReader = this._networkStream.getFullReader(); 14457 14458 this._fullReader.onProgress = evt => { 14459 this._lastProgress = { 14460 loaded: evt.loaded, 14461 total: evt.total 14462 }; 14463 }; 14464 14465 sink.onPull = () => { 14466 this._fullReader.read().then(function ({ 14467 value, 14468 done 14469 }) { 14470 if (done) { 14471 sink.close(); 14472 return; 14473 } 14474 14475 (0, _util.assert)((0, _util.isArrayBuffer)(value)); 14476 sink.enqueue(new Uint8Array(value), 1, [value]); 14477 }).catch(reason => { 14478 sink.error(reason); 14479 }); 14480 }; 14481 14482 sink.onCancel = reason => { 14483 this._fullReader.cancel(reason); 14484 }; 14485 }); 14486 messageHandler.on("ReaderHeadersReady", data => { 14487 const headersCapability = (0, _util.createPromiseCapability)(); 14488 const fullReader = this._fullReader; 14489 fullReader.headersReady.then(() => { 14490 if (!fullReader.isStreamingSupported || !fullReader.isRangeSupported) { 14491 if (this._lastProgress && loadingTask.onProgress) { 14492 loadingTask.onProgress(this._lastProgress); 14493 } 14494 14495 fullReader.onProgress = evt => { 14496 if (loadingTask.onProgress) { 14497 loadingTask.onProgress({ 14498 loaded: evt.loaded, 14499 total: evt.total 14500 }); 14501 } 14502 }; 14503 } 14504 14505 headersCapability.resolve({ 14506 isStreamingSupported: fullReader.isStreamingSupported, 14507 isRangeSupported: fullReader.isRangeSupported, 14508 contentLength: fullReader.contentLength 14509 }); 14510 }, headersCapability.reject); 14511 return headersCapability.promise; 14512 }); 14513 messageHandler.on("GetRangeReader", (data, sink) => { 14514 (0, _util.assert)(this._networkStream); 14515 14516 const rangeReader = this._networkStream.getRangeReader(data.begin, data.end); 14517 14518 if (!rangeReader) { 14519 sink.close(); 14520 return; 14521 } 14522 14523 sink.onPull = () => { 14524 rangeReader.read().then(function ({ 14525 value, 14526 done 14527 }) { 14528 if (done) { 14529 sink.close(); 14530 return; 14531 } 14532 14533 (0, _util.assert)((0, _util.isArrayBuffer)(value)); 14534 sink.enqueue(new Uint8Array(value), 1, [value]); 14535 }).catch(reason => { 14536 sink.error(reason); 14537 }); 14538 }; 14539 14540 sink.onCancel = reason => { 14541 rangeReader.cancel(reason); 14542 }; 14543 }); 14544 messageHandler.on("GetDoc", ({ 14545 pdfInfo 14546 }) => { 14547 this._numPages = pdfInfo.numPages; 14548 14549 loadingTask._capability.resolve(new PDFDocumentProxy(pdfInfo, this)); 14550 }); 14551 messageHandler.on("DocException", function (ex) { 14552 let reason; 14553 14554 switch (ex.name) { 14555 case "PasswordException": 14556 reason = new _util.PasswordException(ex.message, ex.code); 14557 break; 14558 14559 case "InvalidPDFException": 14560 reason = new _util.InvalidPDFException(ex.message); 14561 break; 14562 14563 case "MissingPDFException": 14564 reason = new _util.MissingPDFException(ex.message); 14565 break; 14566 14567 case "UnexpectedResponseException": 14568 reason = new _util.UnexpectedResponseException(ex.message, ex.status); 14569 break; 14570 14571 case "UnknownErrorException": 14572 reason = new _util.UnknownErrorException(ex.message, ex.details); 14573 break; 14574 } 14575 14576 loadingTask._capability.reject(reason); 14577 }); 14578 messageHandler.on("PasswordRequest", exception => { 14579 this._passwordCapability = (0, _util.createPromiseCapability)(); 14580 14581 if (loadingTask.onPassword) { 14582 const updatePassword = password => { 14583 this._passwordCapability.resolve({ 14584 password 14585 }); 14586 }; 14587 14588 try { 14589 loadingTask.onPassword(updatePassword, exception.code); 14590 } catch (ex) { 14591 this._passwordCapability.reject(ex); 14592 } 14593 } else { 14594 this._passwordCapability.reject(new _util.PasswordException(exception.message, exception.code)); 14595 } 14596 14597 return this._passwordCapability.promise; 14598 }); 14599 messageHandler.on("DataLoaded", data => { 14600 if (loadingTask.onProgress) { 14601 loadingTask.onProgress({ 14602 loaded: data.length, 14603 total: data.length 14604 }); 14605 } 14606 14607 this.downloadInfoCapability.resolve(data); 14608 }); 14609 messageHandler.on("StartRenderPage", data => { 14610 if (this.destroyed) { 14611 return; 14612 } 14613 14614 const page = this.pageCache[data.pageIndex]; 14615 14616 page._startRenderPage(data.transparency, data.intent); 14617 }); 14618 messageHandler.on("commonobj", data => { 14619 if (this.destroyed) { 14620 return; 14621 } 14622 14623 const [id, type, exportedData] = data; 14624 14625 if (this.commonObjs.has(id)) { 14626 return; 14627 } 14628 14629 switch (type) { 14630 case "Font": 14631 const params = this._params; 14632 14633 if ("error" in exportedData) { 14634 const exportedError = exportedData.error; 14635 (0, _util.warn)(`Error during font loading: ${exportedError}`); 14636 this.commonObjs.resolve(id, exportedError); 14637 break; 14638 } 14639 14640 let fontRegistry = null; 14641 14642 if (params.pdfBug && globalThis.FontInspector && globalThis.FontInspector.enabled) { 14643 fontRegistry = { 14644 registerFont(font, url) { 14645 globalThis.FontInspector.fontAdded(font, url); 14646 } 14647 14648 }; 14649 } 14650 14651 const font = new _font_loader.FontFaceObject(exportedData, { 14652 isEvalSupported: params.isEvalSupported, 14653 disableFontFace: params.disableFontFace, 14654 ignoreErrors: params.ignoreErrors, 14655 onUnsupportedFeature: this._onUnsupportedFeature.bind(this), 14656 fontRegistry 14657 }); 14658 this.fontLoader.bind(font).then(() => { 14659 this.commonObjs.resolve(id, font); 14660 }, reason => {
14661 messageHandler.sendWithPromise("FontFallback", { 14662 id 14663 }).finally(() => { 14664 this.commonObjs.resolve(id, font); 14665 }); 14666 }); 14667 break; 14668 14669 case "FontPath": 14670 case "FontType3Res": 14671 this.commonObjs.resolve(id, exportedData); 14672 break; 14673 14674 default: 14675 throw new Error(`Got unknown common object type ${type}`); 14676 } 14677 }); 14678 messageHandler.on("obj", data => { 14679 if (this.destroyed) { 14680 return undefined; 14681 } 14682 14683 const [id, pageIndex, type, imageData] = data; 14684 const pageProxy = this.pageCache[pageIndex]; 14685 14686 if (pageProxy.objs.has(id)) { 14687 return undefined; 14688 } 14689 14690 switch (type) { 14691 case "JpegStream": 14692 return new Promise((resolve, reject) => { 14693 const img = new Image(); 14694 14695 img.onload = function () { 14696 resolve(img); 14697 }; 14698 14699 img.onerror = function () { 14700 reject(new Error("Error during JPEG image loading")); 14701 (0, _display_utils.releaseImageResources)(img); 14702 }; 14703 14704 img.src = imageData; 14705 }).then(img => { 14706 pageProxy.objs.resolve(id, img); 14707 }); 14708 14709 case "Image": 14710 pageProxy.objs.resolve(id, imageData); 14711 const MAX_IMAGE_SIZE_TO_STORE = 8000000; 14712 14713 if (imageData && "data" in imageData && imageData.data.length > MAX_IMAGE_SIZE_TO_STORE) { 14714 pageProxy.cleanupAfterRender = true; 14715 } 14716 14717 break; 14718 14719 default: 14720 throw new Error(`Got unknown object type ${type}`); 14721 } 14722 14723 return undefined; 14724 }); 14725 messageHandler.on("DocProgress", data => { 14726 if (this.destroyed) { 14727 return; 14728 } 14729 14730 if (loadingTask.onProgress) { 14731 loadingTask.onProgress({ 14732 loaded: data.loaded, 14733 total: data.total 14734 }); 14735 } 14736 }); 14737 messageHandler.on("UnsupportedFeature", this._onUnsupportedFeature.bind(this)); 14738 messageHandler.on("JpegDecode", data => { 14739 if (this.destroyed) { 14740 return Promise.reject(new Error("Worker was destroyed")); 14741 } 14742 14743 if (typeof document === "undefined") { 14744 return Promise.reject(new Error('"document" is not defined.')); 14745 } 14746 14747 const [imageUrl, components] = data; 14748 14749 if (components !== 3 && components !== 1) { 14750 return Promise.reject(new Error("Only 3 components or 1 component can be returned")); 14751 } 14752 14753 return new Promise(function (resolve, reject) { 14754 const img = new Image(); 14755 14756 img.onload = function () { 14757 const { 14758 width, 14759 height 14760 } = img; 14761 const size = width * height; 14762 const rgbaLength = size * 4; 14763 const buf = new Uint8ClampedArray(size * components); 14764 let tmpCanvas = document.createElement("canvas"); 14765 tmpCanvas.width = width; 14766 tmpCanvas.height = height; 14767 let tmpCtx = tmpCanvas.getContext("2d"); 14768 tmpCtx.drawImage(img, 0, 0); 14769 const data = tmpCtx.getImageData(0, 0, width, height).data; 14770 14771 if (components === 3) { 14772 for (let i = 0, j = 0; i < rgbaLength; i += 4, j += 3) { 14773 buf[j] = data[i]; 14774 buf[j + 1] = data[i + 1]; 14775 buf[j + 2] = data[i + 2]; 14776 } 14777 } else if (components === 1) { 14778 for (let i = 0, j = 0; i < rgbaLength; i += 4, j++) { 14779 buf[j] = data[i]; 14780 } 14781 } 14782 14783 resolve({ 14784 data: buf, 14785 width, 14786 height 14787 }); 14788 (0, _display_utils.releaseImageResources)(img); 14789 tmpCanvas.width = 0; 14790 tmpCanvas.height = 0; 14791 tmpCanvas = null; 14792 tmpCtx = null; 14793 }; 14794 14795 img.onerror = function () { 14796 reject(new Error("JpegDecode failed to load image")); 14797 (0, _display_utils.releaseImageResources)(img); 14798 }; 14799 14800 img.src = imageUrl; 14801 }); 14802 }); 14803 messageHandler.on("FetchBuiltInCMap", (data, sink) => { 14804 if (this.destroyed) { 14805 sink.error(new Error("Worker was destroyed")); 14806 return; 14807 } 14808 14809 let fetched = false;
14810 14811 sink.onPull = () => { 14812 if (fetched) { 14813 sink.close(); 14814 return; 14815 } 14816 14817 fetched = true; 14818 this.CMapReaderFactory.fetch(data).then(function (builtInCMap) { 14819 sink.enqueue(builtInCMap, 1, [builtInCMap.cMapData.buffer]); 14820 }).catch(function (reason) { 14821 sink.error(reason); 14822 }); 14823 }; 14824 }); 14825 } 14826 14827 _onUnsupportedFeature({ 14828 featureId 14829 }) { 14830 if (this.destroyed) { 14831 return; 14832 } 14833 14834 if (this.loadingTask.onUnsupportedFeature) { 14835 this.loadingTask.onUnsupportedFeature(featureId); 14836 } 14837 } 14838 14839 getData() { 14840 return this.messageHandler.sendWithPromise("GetData", null); 14841 } 14842 14843 getPage(pageNumber) { 14844 if (!Number.isInteger(pageNumber) || pageNumber <= 0 || pageNumber > this._numPages) { 14845 return Promise.reject(new Error("Invalid page request")); 14846 } 14847 14848 const pageIndex = pageNumber - 1; 14849 14850 if (pageIndex in this.pagePromises) { 14851 return this.pagePromises[pageIndex]; 14852 } 14853 14854 const promise = this.messageHandler.sendWithPromise("GetPage", { 14855 pageIndex 14856 }).then(pageInfo => { 14857 if (this.destroyed) { 14858 throw new Error("Transport destroyed"); 14859 } 14860 14861 const page = new PDFPageProxy(pageIndex, pageInfo, this, this._params.pdfBug); 14862 this.pageCache[pageIndex] = page; 14863 return page; 14864 }); 14865 this.pagePromises[pageIndex] = promise; 14866 return promise; 14867 } 14868 14869 getPageIndex(ref) { 14870 return this.messageHandler.sendWithPromise("GetPageIndex", { 14871 ref 14872 }).catch(function (reason) { 14873 return Promise.reject(new Error(reason)); 14874 }); 14875 } 14876 14877 getAnnotations(pageIndex, intent) { 14878 return this.messageHandler.sendWithPromise("GetAnnotations", { 14879 pageIndex, 14880 intent 14881 }); 14882 } 14883 14884 getDestinations() { 14885 return this.messageHandler.sendWithPromise("GetDestinations", null); 14886 } 14887 14888 getDestination(id) { 14889 if (typeof id !== "string") { 14890 return Promise.reject(new Error("Invalid destination request.")); 14891 } 14892 14893 return this.messageHandler.sendWithPromise("GetDestination", { 14894 id 14895 }); 14896 } 14897 14898 getPageLabels() { 14899 return this.messageHandler.sendWithPromise("GetPageLabels", null); 14900 } 14901 14902 getPageLayout() { 14903 return this.messageHandler.sendWithPromise("GetPageLayout", null); 14904 } 14905 14906 getPageMode() { 14907 return this.messageHandler.sendWithPromise("GetPageMode", null); 14908 } 14909 14910 getViewerPreferences() { 14911 return this.messageHandler.sendWithPromise("GetViewerPreferences", null); 14912 } 14913 14914 getOpenAction() { 14915 return this.messageHandler.sendWithPromise("GetOpenAction", null); 14916 } 14917 14918 getAttachments() { 14919 return this.messageHandler.sendWithPromise("GetAttachments", null); 14920 } 14921 14922 getJavaScript() { 14923 return this.messageHandler.sendWithPromise("GetJavaScript", null); 14924 } 14925 14926 getOutline() { 14927 return this.messageHandler.sendWithPromise("GetOutline", null); 14928 } 14929 14930 getPermissions() { 14931 return this.messageHandler.sendWithPromise("GetPermissions", null); 14932 } 14933 14934 getMetadata() { 14935 return this.messageHandler.sendWithPromise("GetMetadata", null).then(results => { 14936 return { 14937 info: results[0], 14938 metadata: results[1] ? new _metadata.Metadata(results[1]) : null, 14939 contentDispositionFilename: this._fullReader ? this._fullReader.filename : null 14940 }; 14941 }); 14942 } 14943 14944 getStats() { 14945 return this.messageHandler.sendWithPromise("GetStats", null); 14946 } 14947 14948 startCleanup() { 14949 return this.messageHandler.sendWithPromise("Cleanup", null).then(() => { 14950 for (let i = 0, ii = this.pageCache.length; i < ii; i++) { 14951 const page = this.pageCache[i]; 14952 14953 if (page) { 14954 const cleanupSuccessful = page.cleanup(); 14955 14956 if (!cleanupSuccessful) { 14957 throw new Error(`startCleanup: Page ${i + 1} is currently rendering.`); 14958 } 14959 } 14960 } 14961 14962 this.commonObjs.clear(); 14963 this.fontLoader.clear(); 14964 }); 14965 } 14966 14967 get loadingParams() { 14968 const params = this._params; 14969 return (0, _util.shadow)(this, "loadingParams", { 14970 disableAutoFetch: params.disableAutoFetch, 14971 disableCreateObjectURL: params.disableCreateObjectURL, 14972 disableFontFace: params.disableFontFace, 14973 nativeImageDecoderSupport: params.nativeImageDecoderSupport 14974 }); 14975 } 14976 14977} 14978 14979class PDFObjects { 14980 constructor() { 14981 this._objs = Object.create(null); 14982 } 14983 14984 _ensureObj(objId) { 14985 if (this._objs[objId]) { 14986 return this._objs[objId]; 14987 } 14988 14989 return this._objs[objId] = { 14990 capability: (0, _util.createPromiseCapability)(), 14991 data: null, 14992 resolved: false 14993 }; 14994 } 14995 14996 get(objId, callback = null) { 14997 if (callback) { 14998 this._ensureObj(objId).capability.promise.then(callback); 14999 15000 return null; 15001 } 15002 15003 const obj = this._objs[objId]; 15004 15005 if (!obj || !obj.resolved) { 15006 throw new Error(`Requesting object that isn't resolved yet ${objId}.`); 15007 } 15008 15009 return obj.data; 15010 } 15011
15012 has(objId) { 15013 const obj = this._objs[objId]; 15014 return obj ? obj.resolved : false; 15015 } 15016 15017 resolve(objId, data) { 15018 const obj = this._ensureObj(objId); 15019 15020 obj.resolved = true; 15021 obj.data = data; 15022 obj.capability.resolve(data); 15023 } 15024 15025 clear() { 15026 for (const objId in this._objs) { 15027 const { 15028 data 15029 } = this._objs[objId]; 15030 15031 if (typeof Image !== "undefined" && data instanceof Image) { 15032 (0, _display_utils.releaseImageResources)(data); 15033 } 15034 } 15035 15036 this._objs = Object.create(null); 15037 } 15038 15039} 15040 15041class RenderTask { 15042 constructor(internalRenderTask) { 15043 this._internalRenderTask = internalRenderTask; 15044 this.onContinue = null; 15045 } 15046 15047 get promise() { 15048 return this._internalRenderTask.capability.promise; 15049 } 15050 15051 cancel() { 15052 this._internalRenderTask.cancel(); 15053 } 15054 15055 then(onFulfilled, onRejected) { 15056 throw new Error("Removed API method: " + "RenderTask.then, use the `promise` getter instead."); 15057 } 15058 15059} 15060 15061const InternalRenderTask = function InternalRenderTaskClosure() { 15062 const canvasInRendering = new WeakSet(); 15063 15064 class InternalRenderTask { 15065 constructor({ 15066 callback, 15067 params, 15068 objs, 15069 commonObjs, 15070 operatorList, 15071 pageIndex, 15072 canvasFactory, 15073 webGLContext, 15074 useRequestAnimationFrame = false, 15075 pdfBug = false 15076 }) { 15077 this.callback = callback; 15078 this.params = params; 15079 this.objs = objs; 15080 this.commonObjs = commonObjs; 15081 this.operatorListIdx = null; 15082 this.operatorList = operatorList; 15083 this._pageIndex = pageIndex; 15084 this.canvasFactory = canvasFactory; 15085 this.webGLContext = webGLContext; 15086 this._pdfBug = pdfBug; 15087 this.running = false; 15088 this.graphicsReadyCallback = null; 15089 this.graphicsReady = false; 15090 this._useRequestAnimationFrame = useRequestAnimationFrame === true && typeof window !== "undefined"; 15091 this.cancelled = false; 15092 this.capability = (0, _util.createPromiseCapability)(); 15093 this.task = new RenderTask(this); 15094 this._continueBound = this._continue.bind(this); 15095 this._scheduleNextBound = this._scheduleNext.bind(this); 15096 this._nextBound = this._next.bind(this); 15097 this._canvas = params.canvasContext.canvas; 15098 } 15099
15100 initializeGraphics(transparency = false) { 15101 if (this.cancelled) { 15102 return; 15103 } 15104 15105 if (this._canvas) { 15106 if (canvasInRendering.has(this._canvas)) { 15107 throw new Error("Cannot use the same canvas during multiple render() operations. " + "Use different canvas or ensure previous operations were " + "cancelled or completed."); 15108 } 15109 15110 canvasInRendering.add(this._canvas); 15111 } 15112 15113 if (this._pdfBug && globalThis.StepperManager && globalThis.StepperManager.enabled) { 15114 this.stepper = globalThis.StepperManager.create(this._pageIndex); 15115 this.stepper.init(this.operatorList); 15116 this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint(); 15117 } 15118 15119 const { 15120 canvasContext, 15121 viewport, 15122 transform, 15123 imageLayer, 15124 background 15125 } = this.params; 15126 this.gfx = new _canvas.CanvasGraphics(canvasContext, this.commonObjs, this.objs, this.canvasFactory, this.webGLContext, imageLayer); 15127 this.gfx.beginDrawing({ 15128 transform, 15129 viewport, 15130 transparency, 15131 background 15132 }); 15133 this.operatorListIdx = 0; 15134 this.graphicsReady = true; 15135 15136 if (this.graphicsReadyCallback) { 15137 this.graphicsReadyCallback(); 15138 } 15139 } 15140 15141 cancel(error = null) { 15142 this.running = false; 15143 this.cancelled = true; 15144 15145 if (this.gfx) { 15146 this.gfx.endDrawing(); 15147 } 15148 15149 if (this._canvas) { 15150 canvasInRendering.delete(this._canvas); 15151 } 15152 15153 this.callback(error || new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex + 1}`, "canvas")); 15154 } 15155 15156 operatorListChanged() { 15157 if (!this.graphicsReady) { 15158 if (!this.graphicsReadyCallback) { 15159 this.graphicsReadyCallback = this._continueBound; 15160 } 15161 15162 return; 15163 } 15164 15165 if (this.stepper) { 15166 this.stepper.updateOperatorList(this.operatorList); 15167 } 15168 15169 if (this.running) { 15170 return; 15171 } 15172 15173 this._continue(); 15174 } 15175 15176 _continue() { 15177 this.running = true; 15178 15179 if (this.cancelled) { 15180 return; 15181 } 15182 15183 if (this.task.onContinue) { 15184 this.task.onContinue(this._scheduleNextBound); 15185 } else { 15186 this._scheduleNext(); 15187 } 15188 } 15189 15190 _scheduleNext() { 15191 if (this._useRequestAnimationFrame) { 15192 window.requestAnimationFrame(() => { 15193 this._nextBound().catch(this.cancel.bind(this)); 15194 }); 15195 } else { 15196 Promise.resolve().then(this._nextBound).catch(this.cancel.bind(this)); 15197 } 15198 } 15199 15200 async _next() { 15201 if (this.cancelled) { 15202 return; 15203 } 15204 15205 this.operatorListIdx = this.gfx.executeOperatorList(this.operatorList, this.operatorListIdx, this._continueBound, this.stepper); 15206 15207 if (this.operatorListIdx === this.operatorList.argsArray.length) { 15208 this.running = false; 15209 15210 if (this.operatorList.lastChunk) { 15211 this.gfx.endDrawing(); 15212 15213 if (this._canvas) { 15214 canvasInRendering.delete(this._canvas); 15215 } 15216 15217 this.callback(); 15218 } 15219 } 15220 } 15221 15222 } 15223 15224 return InternalRenderTask; 15225}(); 15226 15227const version = '2.4.456'; 15228exports.version = version; 15229const build = '228a591c'; 15230exports.build = build; 15231 15232/***/ }), 15233/* 4 */ 15234/***/ (function(module, exports, __w_pdfjs_require__) { 15235 15236"use strict"; 15237 15238 15239Object.defineProperty(exports, "__esModule", { 15240 value: true 15241}); 15242exports.addLinkAttributes = addLinkAttributes; 15243exports.getFilenameFromUrl = getFilenameFromUrl; 15244exports.isFetchSupported = isFetchSupported; 15245exports.isValidFetchUrl = isValidFetchUrl; 15246exports.loadScript = loadScript; 15247exports.deprecated = deprecated; 15248exports.releaseImageResources = releaseImageResources; 15249exports.PDFDateString = exports.StatTimer = exports.DOMSVGFactory = exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.LinkTarget = exports.RenderingCancelledException = exports.PageViewport = void 0; 15250 15251var _util = __w_pdfjs_require__(1); 15252 15253const DEFAULT_LINK_REL = "noopener noreferrer nofollow"; 15254exports.DEFAULT_LINK_REL = DEFAULT_LINK_REL; 15255const SVG_NS = "http://www.w3.org/2000/svg"; 15256 15257class DOMCanvasFactory { 15258 create(width, height) { 15259 if (width <= 0 || height <= 0) { 15260 throw new Error("Invalid canvas size"); 15261 } 15262 15263 const canvas = document.createElement("canvas"); 15264 const context = canvas.getContext("2d"); 15265 canvas.width = width; 15266 canvas.height = height; 15267 return { 15268 canvas, 15269 context 15270 }; 15271 } 15272 15273 reset(canvasAndContext, width, height) { 15274 if (!canvasAndContext.canvas) { 15275 throw new Error("Canvas is not specified"); 15276 } 15277 15278 if (width <= 0 || height <= 0) { 15279 throw new Error("Invalid canvas size"); 15280 } 15281 15282 canvasAndContext.canvas.width = width; 15283 canvasAndContext.canvas.height = height; 15284 } 15285 15286 destroy(canvasAndContext) { 15287 if (!canvasAndContext.canvas) { 15288 throw new Error("Canvas is not specified"); 15289 } 15290 15291 canvasAndContext.canvas.width = 0; 15292 canvasAndContext.canvas.height = 0; 15293 canvasAndContext.canvas = null; 15294 canvasAndContext.context = null; 15295 } 15296 15297} 15298 15299exports.DOMCanvasFactory = DOMCanvasFactory; 15300 15301class DOMCMapReaderFactory { 15302 constructor({ 15303 baseUrl = null, 15304 isCompressed = false 15305 }) { 15306 this.baseUrl = baseUrl; 15307 this.isCompressed = isCompressed; 15308 } 15309 15310 async fetch({ 15311 name 15312 }) { 15313 if (!this.baseUrl) { 15314 throw new Error('The CMap "baseUrl" parameter must be specified, ensure that ' + 'the "cMapUrl" and "cMapPacked" API parameters are provided.'); 15315 } 15316 15317 if (!name) { 15318 throw new Error("CMap name must be specified."); 15319 } 15320 15321 const url = this.baseUrl + name + (this.isCompressed ? ".bcmap" : ""); 15322 const compressionType = this.isCompressed ? _util.CMapCompressionType.BINARY : _util.CMapCompressionType.NONE; 15323 15324 if (isFetchSupported() && isValidFetchUrl(url, document.baseURI)) { 15325 return fetch(url).then(async response => { 15326 if (!response.ok) { 15327 throw new Error(response.statusText); 15328 } 15329 15330 let cMapData; 15331 15332 if (this.isCompressed) { 15333 cMapData = new Uint8Array((await response.arrayBuffer())); 15334 } else { 15335 cMapData = (0, _util.stringToBytes)((await response.text())); 15336 } 15337 15338 return { 15339 cMapData, 15340 compressionType 15341 }; 15342 }).catch(reason => { 15343 throw new Error(`Unable to load ${this.isCompressed ? "binary " : ""}` + `CMap at: ${url}`); 15344 }); 15345 } 15346 15347 return new Promise((resolve, reject) => { 15348 const request = new XMLHttpRequest(); 15349 request.open("GET", url, true); 15350 15351 if (this.isCompressed) { 15352 request.responseType = "arraybuffer"; 15353 } 15354 15355 request.onreadystatechange = () => { 15356 if (request.readyState !== XMLHttpRequest.DONE) { 15357 return; 15358 } 15359 15360 if (request.status === 200 || request.status === 0) { 15361 let cMapData; 15362 15363 if (this.isCompressed && request.response) { 15364 cMapData = new Uint8Array(request.response); 15365 } else if (!this.isCompressed && request.responseText) { 15366 cMapData = (0, _util.stringToBytes)(request.responseText); 15367 } 15368 15369 if (cMapData) { 15370 resolve({ 15371 cMapData, 15372 compressionType 15373 }); 15374 return; 15375 } 15376 } 15377 15378 reject(new Error(request.statusText)); 15379 }; 15380 15381 request.send(null); 15382 }).catch(reason => { 15383 throw new Error(`Unable to load ${this.isCompressed ? "binary " : ""}` + `CMap at: ${url}`); 15384 }); 15385 } 15386 15387} 15388 15389exports.DOMCMapReaderFactory = DOMCMapReaderFactory; 15390 15391class DOMSVGFactory { 15392 create(width, height) { 15393 (0, _util.assert)(width > 0 && height > 0, "Invalid SVG dimensions"); 15394 const svg = document.createElementNS(SVG_NS, "svg:svg"); 15395 svg.setAttribute("version", "1.1"); 15396 svg.setAttribute("width", width + "px"); 15397 svg.setAttribute("height", height + "px"); 15398 svg.setAttribute("preserveAspectRatio", "none"); 15399 svg.setAttribute("viewBox", "0 0 " + width + " " + height); 15400 return svg; 15401 } 15402 15403 createElement(type) { 15404 (0, _util.assert)(typeof type === "string", "Invalid SVG element type"); 15405 return document.createElementNS(SVG_NS, type); 15406 } 15407 15408} 15409 15410exports.DOMSVGFactory = DOMSVGFactory; 15411 15412class PageViewport { 15413 constructor({
15414 viewBox, 15415 scale, 15416 rotation, 15417 offsetX = 0, 15418 offsetY = 0, 15419 dontFlip = false 15420 }) { 15421 this.viewBox = viewBox; 15422 this.scale = scale; 15423 this.rotation = rotation; 15424 this.offsetX = offsetX; 15425 this.offsetY = offsetY; 15426 const centerX = (viewBox[2] + viewBox[0]) / 2; 15427 const centerY = (viewBox[3] + viewBox[1]) / 2; 15428 let rotateA, rotateB, rotateC, rotateD; 15429 rotation = rotation % 360; 15430 rotation = rotation < 0 ? rotation + 360 : rotation; 15431 15432 switch (rotation) { 15433 case 180: 15434 rotateA = -1; 15435 rotateB = 0; 15436 rotateC = 0; 15437 rotateD = 1; 15438 break; 15439 15440 case 90: 15441 rotateA = 0; 15442 rotateB = 1; 15443 rotateC = 1; 15444 rotateD = 0; 15445 break; 15446 15447 case 270: 15448 rotateA = 0; 15449 rotateB = -1; 15450 rotateC = -1; 15451 rotateD = 0; 15452 break; 15453 15454 default: 15455 rotateA = 1; 15456 rotateB = 0; 15457 rotateC = 0; 15458 rotateD = -1; 15459 break; 15460 } 15461 15462 if (dontFlip) { 15463 rotateC = -rotateC; 15464 rotateD = -rotateD; 15465 } 15466 15467 let offsetCanvasX, offsetCanvasY; 15468 let width, height; 15469 15470 if (rotateA === 0) { 15471 offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX; 15472 offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY; 15473 width = Math.abs(viewBox[3] - viewBox[1]) * scale; 15474 height = Math.abs(viewBox[2] - viewBox[0]) * scale; 15475 } else { 15476 offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX; 15477 offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY; 15478 width = Math.abs(viewBox[2] - viewBox[0]) * scale; 15479 height = Math.abs(viewBox[3] - viewBox[1]) * scale; 15480 } 15481 15482 this.transform = [rotateA * scale, rotateB * scale, rotateC * scale, rotateD * scale, offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY, offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY]; 15483 this.width = width; 15484 this.height = height; 15485 } 15486 15487 clone({ 15488 scale = this.scale, 15489 rotation = this.rotation, 15490 offsetX = this.offsetX, 15491 offsetY = this.offsetY, 15492 dontFlip = false 15493 } = {}) { 15494 return new PageViewport({ 15495 viewBox: this.viewBox.slice(), 15496 scale, 15497 rotation, 15498 offsetX, 15499 offsetY, 15500 dontFlip 15501 }); 15502 } 15503 15504 convertToViewportPoint(x, y) { 15505 return _util.Util.applyTransform([x, y], this.transform); 15506 } 15507 15508 convertToViewportRectangle(rect) { 15509 const topLeft = _util.Util.applyTransform([rect[0], rect[1]], this.transform); 15510 15511 const bottomRight = _util.Util.applyTransform([rect[2], rect[3]], this.transform); 15512 15513 return [topLeft[0], topLeft[1], bottomRight[0], bottomRight[1]]; 15514 } 15515 15516 convertToPdfPoint(x, y) { 15517 return _util.Util.applyInverseTransform([x, y], this.transform); 15518 } 15519 15520} 15521 15522exports.PageViewport = PageViewport; 15523 15524class RenderingCancelledException extends _util.BaseException { 15525 constructor(msg, type) { 15526 super(msg); 15527 this.type = type; 15528 } 15529 15530} 15531 15532exports.RenderingCancelledException = RenderingCancelledException; 15533const LinkTarget = { 15534 NONE: 0, 15535 SELF: 1, 15536 BLANK: 2, 15537 PARENT: 3, 15538 TOP: 4 15539}; 15540exports.LinkTarget = LinkTarget; 15541 15542function addLinkAttributes(link, { 15543 url, 15544 target, 15545 rel, 15546 enabled = true 15547} = {}) { 15548 (0, _util.assert)(url && typeof url === "string", 'addLinkAttributes: A valid "url" parameter must provided.'); 15549 const urlNullRemoved = (0, _util.removeNullCharacters)(url); 15550 15551 if (enabled) { 15552 link.href = link.title = urlNullRemoved; 15553 } else { 15554 link.href = ""; 15555 link.title = `Disabled: ${urlNullRemoved}`; 15556 15557 link.onclick = () => { 15558 return false; 15559 }; 15560 } 15561 15562 let targetStr = ""; 15563 15564 switch (target) { 15565 case LinkTarget.NONE: 15566 break; 15567 15568 case LinkTarget.SELF: 15569 targetStr = "_self"; 15570 break; 15571 15572 case LinkTarget.BLANK: 15573 targetStr = "_blank"; 15574 break; 15575 15576 case LinkTarget.PARENT: 15577 targetStr = "_parent"; 15578 break; 15579 15580 case LinkTarget.TOP: 15581 targetStr = "_top"; 15582 break; 15583 } 15584 15585 link.target = targetStr; 15586 link.rel = typeof rel === "string" ? rel : DEFAULT_LINK_REL; 15587} 15588 15589function getFilenameFromUrl(url) { 15590 const anchor = url.indexOf("#"); 15591 const query = url.indexOf("?"); 15592 const end = Math.min(anchor > 0 ? anchor : url.length, query > 0 ? query : url.length); 15593 return url.substring(url.lastIndexOf("/", end) + 1, end); 15594} 15595 15596class StatTimer {
15597 constructor() { 15598 this.started = Object.create(null); 15599 this.times = []; 15600 } 15601 15602 time(name) { 15603 if (name in this.started) { 15604 (0, _util.warn)(`Timer is already running for ${name}`); 15605 } 15606 15607 this.started[name] = Date.now(); 15608 } 15609 15610 timeEnd(name) { 15611 if (!(name in this.started)) { 15612 (0, _util.warn)(`Timer has not been started for ${name}`); 15613 } 15614 15615 this.times.push({ 15616 name, 15617 start: this.started[name], 15618 end: Date.now() 15619 }); 15620 delete this.started[name]; 15621 } 15622 15623 toString() { 15624 const outBuf = []; 15625 let longest = 0; 15626 15627 for (const time of this.times) { 15628 const name = time.name; 15629 15630 if (name.length > longest) { 15631 longest = name.length; 15632 } 15633 } 15634 15635 for (const time of this.times) { 15636 const duration = time.end - time.start; 15637 outBuf.push(`${time.name.padEnd(longest)} ${duration}ms\n`); 15638 } 15639 15640 return outBuf.join(""); 15641 } 15642 15643} 15644 15645exports.StatTimer = StatTimer; 15646 15647function isFetchSupported() { 15648 return typeof fetch !== "undefined" && typeof Response !== "undefined" && "body" in Response.prototype && typeof ReadableStream !== "undefined"; 15649} 15650 15651function isValidFetchUrl(url, baseUrl) { 15652 try { 15653 const { 15654 protocol 15655 } = baseUrl ? new URL(url, baseUrl) : new URL(url); 15656 return protocol === "http:" || protocol === "https:"; 15657 } catch (ex) { 15658 return false; 15659 } 15660} 15661 15662function loadScript(src) { 15663 return new Promise((resolve, reject) => { 15664 const script = document.createElement("script"); 15665 script.src = src; 15666 script.onload = resolve; 15667 15668 script.onerror = function () { 15669 reject(new Error(`Cannot load script at: ${script.src}`)); 15670 }; 15671 15672 (document.head || document.documentElement).appendChild(script); 15673 }); 15674} 15675 15676function deprecated(details) { 15677 console.log("Deprecated API usage: " + details); 15678} 15679 15680function releaseImageResources(img) { 15681 (0, _util.assert)(img instanceof Image, "Invalid `img` parameter."); 15682 const url = img.src; 15683 15684 if (typeof url === "string" && url.startsWith("blob:") && URL.revokeObjectURL) { 15685 URL.revokeObjectURL(url); 15686 } 15687 15688 img.removeAttribute("src"); 15689} 15690 15691let pdfDateStringRegex; 15692 15693class PDFDateString { 15694 static toDateObject(input) { 15695 if (!input || !(0, _util.isString)(input)) { 15696 return null; 15697 } 15698 15699 if (!pdfDateStringRegex) { 15700 pdfDateStringRegex = new RegExp("^D:" + "(\\d{4})" + "(\\d{2})?" + "(\\d{2})?" + "(\\d{2})?" + "(\\d{2})?" + "(\\d{2})?" + "([Z|+|-])?" + "(\\d{2})?" + "'?" + "(\\d{2})?" + "'?"); 15701 } 15702 15703 const matches = pdfDateStringRegex.exec(input); 15704 15705 if (!matches) { 15706 return null; 15707 } 15708 15709 const year = parseInt(matches[1], 10); 15710 let month = parseInt(matches[2], 10);
15711 month = month >= 1 && month <= 12 ? month - 1 : 0; 15712 let day = parseInt(matches[3], 10); 15713 day = day >= 1 && day <= 31 ? day : 1; 15714 let hour = parseInt(matches[4], 10); 15715 hour = hour >= 0 && hour <= 23 ? hour : 0; 15716 let minute = parseInt(matches[5], 10); 15717 minute = minute >= 0 && minute <= 59 ? minute : 0; 15718 let second = parseInt(matches[6], 10); 15719 second = second >= 0 && second <= 59 ? second : 0; 15720 const universalTimeRelation = matches[7] || "Z"; 15721 let offsetHour = parseInt(matches[8], 10); 15722 offsetHour = offsetHour >= 0 && offsetHour <= 23 ? offsetHour : 0; 15723 let offsetMinute = parseInt(matches[9], 10) || 0; 15724 offsetMinute = offsetMinute >= 0 && offsetMinute <= 59 ? offsetMinute : 0; 15725 15726 if (universalTimeRelation === "-") { 15727 hour += offsetHour; 15728 minute += offsetMinute; 15729 } else if (universalTimeRelation === "+") { 15730 hour -= offsetHour; 15731 minute -= offsetMinute; 15732 } 15733 15734 return new Date(Date.UTC(year, month, day, hour, minute, second)); 15735 } 15736 15737} 15738 15739exports.PDFDateString = PDFDateString; 15740 15741/***/ }), 15742/* 5 */ 15743/***/ (function(module, exports, __w_pdfjs_require__) { 15744 15745"use strict"; 15746 15747 15748Object.defineProperty(exports, "__esModule", { 15749 value: true 15750}); 15751exports.FontLoader = exports.FontFaceObject = void 0; 15752 15753var _util = __w_pdfjs_require__(1); 15754 15755class BaseFontLoader { 15756 constructor({ 15757 docId, 15758 onUnsupportedFeature 15759 }) { 15760 if (this.constructor === BaseFontLoader) { 15761 (0, _util.unreachable)("Cannot initialize BaseFontLoader."); 15762 } 15763 15764 this.docId = docId; 15765 this._onUnsupportedFeature = onUnsupportedFeature; 15766 this.nativeFontFaces = []; 15767 this.styleElement = null; 15768 } 15769 15770 addNativeFontFace(nativeFontFace) { 15771 this.nativeFontFaces.push(nativeFontFace); 15772 document.fonts.add(nativeFontFace); 15773 } 15774 15775 insertRule(rule) { 15776 let styleElement = this.styleElement; 15777 15778 if (!styleElement) { 15779 styleElement = this.styleElement = document.createElement("style"); 15780 styleElement.id = `PDFJS_FONT_STYLE_TAG_${this.docId}`; 15781 document.documentElement.getElementsByTagName("head")[0].appendChild(styleElement); 15782 } 15783 15784 const styleSheet = styleElement.sheet; 15785 styleSheet.insertRule(rule, styleSheet.cssRules.length); 15786 } 15787 15788 clear() { 15789 this.nativeFontFaces.forEach(function (nativeFontFace) { 15790 document.fonts.delete(nativeFontFace); 15791 }); 15792 this.nativeFontFaces.length = 0; 15793 15794 if (this.styleElement) { 15795 this.styleElement.remove(); 15796 this.styleElement = null; 15797 } 15798 } 15799 15800 async bind(font) { 15801 if (font.attached || font.missingFile) { 15802 return; 15803 } 15804 15805 font.attached = true; 15806 15807 if (this.isFontLoadingAPISupported) { 15808 const nativeFontFace = font.createNativeFontFace(); 15809 15810 if (nativeFontFace) { 15811 this.addNativeFontFace(nativeFontFace); 15812 15813 try { 15814 await nativeFontFace.loaded; 15815 } catch (ex) { 15816 this._onUnsupportedFeature({ 15817 featureId: _util.UNSUPPORTED_FEATURES.font 15818 }); 15819 15820 (0, _util.warn)(`Failed to load font '${nativeFontFace.family}': '${ex}'.`); 15821 font.disableFontFace = true; 15822 throw ex; 15823 } 15824 } 15825 15826 return; 15827 } 15828 15829 const rule = font.createFontFaceRule(); 15830 15831 if (rule) { 15832 this.insertRule(rule); 15833 15834 if (this.isSyncFontLoadingSupported) { 15835 return; 15836 } 15837 15838 await new Promise(resolve => { 15839 const request = this._queueLoadingCallback(resolve); 15840 15841 this._prepareFontLoadEvent([rule], [font], request); 15842 }); 15843 } 15844 } 15845 15846 _queueLoadingCallback(callback) { 15847 (0, _util.unreachable)("Abstract method `_queueLoadingCallback`."); 15848 } 15849 15850 get isFontLoadingAPISupported() { 15851 const supported = typeof document !== "undefined" && !!document.fonts; 15852 return (0, _util.shadow)(this, "isFontLoadingAPISupported", supported); 15853 } 15854 15855 get isSyncFontLoadingSupported() { 15856 (0, _util.unreachable)("Abstract method `isSyncFontLoadingSupported`."); 15857 } 15858 15859 get _loadTestFont() { 15860 (0, _util.unreachable)("Abstract method `_loadTestFont`."); 15861 } 15862 15863 _prepareFontLoadEvent(rules, fontsToLoad, request) { 15864 (0, _util.unreachable)("Abstract method `_prepareFontLoadEvent`."); 15865 } 15866 15867} 15868 15869let FontLoader; 15870exports.FontLoader = FontLoader; 15871{ 15872 exports.FontLoader = FontLoader = class GenericFontLoader extends BaseFontLoader {
15873 constructor(docId) { 15874 super(docId); 15875 this.loadingContext = { 15876 requests: [], 15877 nextRequestId: 0 15878 }; 15879 this.loadTestFontId = 0; 15880 } 15881 15882 get isSyncFontLoadingSupported() { 15883 let supported = false; 15884 15885 if (typeof navigator === "undefined") { 15886 supported = true; 15887 } else { 15888 const m = /Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(navigator.userAgent); 15889 15890 if (m && m[1] >= 14) { 15891 supported = true; 15892 } 15893 } 15894 15895 return (0, _util.shadow)(this, "isSyncFontLoadingSupported", supported); 15896 } 15897 15898 _queueLoadingCallback(callback) { 15899 function completeRequest() { 15900 (0, _util.assert)(!request.done, "completeRequest() cannot be called twice."); 15901 request.done = true; 15902 15903 while (context.requests.length > 0 && context.requests[0].done) { 15904 const otherRequest = context.requests.shift(); 15905 setTimeout(otherRequest.callback, 0); 15906 } 15907 } 15908 15909 const context = this.loadingContext; 15910 const request = { 15911 id: `pdfjs-font-loading-${context.nextRequestId++}`, 15912 done: false, 15913 complete: completeRequest, 15914 callback 15915 }; 15916 context.requests.push(request); 15917 return request; 15918 } 15919 15920 get _loadTestFont() { 15921 const getLoadTestFont = function () { 15922 return atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQA" + "FQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAA" + "ALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgA" + "AAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1" + "AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD" + "6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACM" + "AooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4D" + "IP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAA" + "AAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUA" + "AQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgAB" + "AAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABY" + "AAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAA" + "AC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAA" + "AAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQAC" + "AQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3" + "Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTj" + "FQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="); 15923 }; 15924 15925 return (0, _util.shadow)(this, "_loadTestFont", getLoadTestFont()); 15926 } 15927 15928 _prepareFontLoadEvent(rules, fonts, request) { 15929 function int32(data, offset) { 15930 return data.charCodeAt(offset) << 24 | data.charCodeAt(offset + 1) << 16 | data.charCodeAt(offset + 2) << 8 | data.charCodeAt(offset + 3) & 0xff; 15931 } 15932 15933 function spliceString(s, offset, remove, insert) { 15934 const chunk1 = s.substring(0, offset); 15935 const chunk2 = s.substring(offset + remove); 15936 return chunk1 + insert + chunk2; 15937 } 15938 15939 let i, ii; 15940 const canvas = document.createElement("canvas"); 15941 canvas.width = 1; 15942 canvas.height = 1; 15943 const ctx = canvas.getContext("2d"); 15944 let called = 0; 15945 15946 function isFontReady(name, callback) { 15947 called++; 15948 15949 if (called > 30) { 15950 (0, _util.warn)("Load test font never loaded."); 15951 callback(); 15952 return; 15953 } 15954 15955 ctx.font = "30px " + name; 15956 ctx.fillText(".", 0, 20); 15957 const imageData = ctx.getImageData(0, 0, 1, 1); 15958 15959 if (imageData.data[3] > 0) { 15960 callback(); 15961 return; 15962 } 15963 15964 setTimeout(isFontReady.bind(null, name, callback)); 15965 } 15966 15967 const loadTestFontId = `lt${Date.now()}${this.loadTestFontId++}`; 15968 let data = this._loadTestFont; 15969 const COMMENT_OFFSET = 976;
15970 data = spliceString(data, COMMENT_OFFSET, loadTestFontId.length, loadTestFontId); 15971 const CFF_CHECKSUM_OFFSET = 16; 15972 const XXXX_VALUE = 0x58585858; 15973 let checksum = int32(data, CFF_CHECKSUM_OFFSET); 15974 15975 for (i = 0, ii = loadTestFontId.length - 3; i < ii; i += 4) { 15976 checksum = checksum - XXXX_VALUE + int32(loadTestFontId, i) | 0; 15977 } 15978 15979 if (i < loadTestFontId.length) { 15980 checksum = checksum - XXXX_VALUE + int32(loadTestFontId + "XXX", i) | 0; 15981 } 15982 15983 data = spliceString(data, CFF_CHECKSUM_OFFSET, 4, (0, _util.string32)(checksum)); 15984 const url = `url(data:font/opentype;base64,${btoa(data)});`; 15985 const rule = `@font-face {font-family:"${loadTestFontId}";src:${url}}`; 15986 this.insertRule(rule); 15987 const names = []; 15988 15989 for (i = 0, ii = fonts.length; i < ii; i++) { 15990 names.push(fonts[i].loadedName); 15991 } 15992 15993 names.push(loadTestFontId); 15994 const div = document.createElement("div"); 15995 div.style.visibility = "hidden"; 15996 div.style.width = div.style.height = "10px"; 15997 div.style.position = "absolute"; 15998 div.style.top = div.style.left = "0px"; 15999 16000 for (i = 0, ii = names.length; i < ii; ++i) { 16001 const span = document.createElement("span"); 16002 span.textContent = "Hi"; 16003 span.style.fontFamily = names[i]; 16004 div.appendChild(span); 16005 } 16006 16007 document.body.appendChild(div); 16008 isFontReady(loadTestFontId, function () { 16009 document.body.removeChild(div); 16010 request.complete(); 16011 }); 16012 } 16013 16014 }; 16015} 16016 16017class FontFaceObject { 16018 constructor(translatedData, { 16019 isEvalSupported = true, 16020 disableFontFace = false, 16021 ignoreErrors = false, 16022 onUnsupportedFeature = null, 16023 fontRegistry = null 16024 }) { 16025 this.compiledGlyphs = Object.create(null); 16026 16027 for (const i in translatedData) { 16028 this[i] = translatedData[i]; 16029 } 16030 16031 this.isEvalSupported = isEvalSupported !== false; 16032 this.disableFontFace = disableFontFace === true; 16033 this.ignoreErrors = ignoreErrors === true; 16034 this._onUnsupportedFeature = onUnsupportedFeature; 16035 this.fontRegistry = fontRegistry; 16036 } 16037 16038 createNativeFontFace() { 16039 if (!this.data || this.disableFontFace) { 16040 return null; 16041 } 16042 16043 const nativeFontFace = new FontFace(this.loadedName, this.data, {}); 16044 16045 if (this.fontRegistry) { 16046 this.fontRegistry.registerFont(this); 16047 } 16048 16049 return nativeFontFace; 16050 } 16051 16052 createFontFaceRule() { 16053 if (!this.data || this.disableFontFace) { 16054 return null; 16055 } 16056 16057 const data = (0, _util.bytesToString)(new Uint8Array(this.data)); 16058 const url = `url(data:${this.mimetype};base64,${btoa(data)});`; 16059 const rule = `@font-face {font-family:"${this.loadedName}";src:${url}}`; 16060 16061 if (this.fontRegistry) { 16062 this.fontRegistry.registerFont(this, url); 16063 } 16064 16065 return rule; 16066 } 16067 16068 getPathGenerator(objs, character) { 16069 if (this.compiledGlyphs[character] !== undefined) { 16070 return this.compiledGlyphs[character]; 16071 } 16072 16073 let cmds, current; 16074 16075 try { 16076 cmds = objs.get(this.loadedName + "_path_" + character); 16077 } catch (ex) { 16078 if (!this.ignoreErrors) { 16079 throw ex; 16080 } 16081 16082 if (this._onUnsupportedFeature) { 16083 this._onUnsupportedFeature({ 16084 featureId: _util.UNSUPPORTED_FEATURES.font 16085 }); 16086 } 16087 16088 (0, _util.warn)(`getPathGenerator - ignoring character: "${ex}".`); 16089 return this.compiledGlyphs[character] = function (c, size) {}; 16090 } 16091 16092 if (this.isEvalSupported && _util.IsEvalSupportedCached.value) { 16093 let args, 16094 js = ""; 16095 16096 for (let i = 0, ii = cmds.length; i < ii; i++) { 16097 current = cmds[i]; 16098 16099 if (current.args !== undefined) { 16100 args = current.args.join(","); 16101 } else { 16102 args = ""; 16103 } 16104 16105 js += "c." + current.cmd + "(" + args + ");\n"; 16106 } 16107 16108 return this.compiledGlyphs[character] = new Function("c", "size", js); 16109 } 16110 16111 return this.compiledGlyphs[character] = function (c, size) { 16112 for (let i = 0, ii = cmds.length; i < ii; i++) { 16113 current = cmds[i]; 16114 16115 if (current.cmd === "scale") { 16116 current.args = [size, -size]; 16117 } 16118 16119 c[current.cmd].apply(c, current.args); 16120 } 16121 }; 16122 } 16123 16124} 16125 16126exports.FontFaceObject = FontFaceObject; 16127 16128/***/ }), 16129/* 6 */ 16130/***/ (function(module, exports, __w_pdfjs_require__) { 16131 16132"use strict"; 16133 16134 16135const compatibilityParams = Object.create(null); 16136{ 16137 const { 16138 isNodeJS 16139 } = __w_pdfjs_require__(7); 16140 16141 const userAgent = typeof navigator !== "undefined" && navigator.userAgent || ""; 16142 const isIE = /Trident/.test(userAgent); 16143 const isIOSChrome = /CriOS/.test(userAgent); 16144 16145 (function checkOnBlobSupport() { 16146 if (isIE || isIOSChrome) { 16147 compatibilityParams.disableCreateObjectURL = true; 16148 } 16149 })(); 16150 16151 (function checkFontFaceAndImage() { 16152 if (isNodeJS) { 16153 compatibilityParams.disableFontFace = true; 16154 compatibilityParams.nativeImageDecoderSupport = "none"; 16155 } 16156 })(); 16157} 16158exports.apiCompatibilityParams = Object.freeze(compatibilityParams); 16159 16160/***/ }), 16161/* 7 */ 16162/***/ (function(module, exports, __w_pdfjs_require__) { 16163 16164"use strict"; 16165 16166 16167Object.defineProperty(exports, "__esModule", { 16168 value: true 16169}); 16170exports.isNodeJS = void 0; 16171const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions["nw"] && !process.versions["electron"]; 16172exports.isNodeJS = isNodeJS; 16173 16174/***/ }), 16175/* 8 */ 16176/***/ (function(module, exports, __w_pdfjs_require__) { 16177 16178"use strict"; 16179 16180 16181Object.defineProperty(exports, "__esModule", { 16182 value: true 16183}); 16184exports.CanvasGraphics = void 0; 16185 16186var _util = __w_pdfjs_require__(1); 16187 16188var _pattern_helper = __w_pdfjs_require__(9); 16189 16190var MIN_FONT_SIZE = 16; 16191var MAX_FONT_SIZE = 100; 16192var MAX_GROUP_SIZE = 4096; 16193var MIN_WIDTH_FACTOR = 0.65; 16194var COMPILE_TYPE3_GLYPHS = true; 16195var MAX_SIZE_TO_COMPILE = 1000; 16196var FULL_CHUNK_HEIGHT = 16; 16197 16198function addContextCurrentTransform(ctx) { 16199 if (!ctx.mozCurrentTransform) { 16200 ctx._originalSave = ctx.save; 16201 ctx._originalRestore = ctx.restore; 16202 ctx._originalRotate = ctx.rotate; 16203 ctx._originalScale = ctx.scale; 16204 ctx._originalTranslate = ctx.translate; 16205 ctx._originalTransform = ctx.transform; 16206 ctx._originalSetTransform = ctx.setTransform; 16207 ctx._transformMatrix = ctx._transformMatrix || [1, 0, 0, 1, 0, 0]; 16208 ctx._transformStack = [];
vendor: 6,630 bytes, lines 16209-16500
16209 Object.defineProperty(ctx, "mozCurrentTransform", { 16210 get: function getCurrentTransform() { 16211 return this._transformMatrix; 16212 } 16213 }); 16214 Object.defineProperty(ctx, "mozCurrentTransformInverse", { 16215 get: function getCurrentTransformInverse() { 16216 var m = this._transformMatrix; 16217 var a = m[0], 16218 b = m[1], 16219 c = m[2], 16220 d = m[3], 16221 e = m[4], 16222 f = m[5]; 16223 var ad_bc = a * d - b * c; 16224 var bc_ad = b * c - a * d; 16225 return [d / ad_bc, b / bc_ad, c / bc_ad, a / ad_bc, (d * e - c * f) / bc_ad, (b * e - a * f) / ad_bc]; 16226 } 16227 }); 16228 16229 ctx.save = function ctxSave() { 16230 var old = this._transformMatrix; 16231 16232 this._transformStack.push(old); 16233 16234 this._transformMatrix = old.slice(0, 6); 16235 16236 this._originalSave(); 16237 }; 16238 16239 ctx.restore = function ctxRestore() { 16240 var prev = this._transformStack.pop(); 16241 16242 if (prev) { 16243 this._transformMatrix = prev; 16244 16245 this._originalRestore(); 16246 } 16247 }; 16248 16249 ctx.translate = function ctxTranslate(x, y) { 16250 var m = this._transformMatrix; 16251 m[4] = m[0] * x + m[2] * y + m[4]; 16252 m[5] = m[1] * x + m[3] * y + m[5]; 16253 16254 this._originalTranslate(x, y); 16255 }; 16256 16257 ctx.scale = function ctxScale(x, y) { 16258 var m = this._transformMatrix; 16259 m[0] = m[0] * x; 16260 m[1] = m[1] * x; 16261 m[2] = m[2] * y; 16262 m[3] = m[3] * y; 16263 16264 this._originalScale(x, y); 16265 }; 16266 16267 ctx.transform = function ctxTransform(a, b, c, d, e, f) { 16268 var m = this._transformMatrix; 16269 this._transformMatrix = [m[0] * a + m[2] * b, m[1] * a + m[3] * b, m[0] * c + m[2] * d, m[1] * c + m[3] * d, m[0] * e + m[2] * f + m[4], m[1] * e + m[3] * f + m[5]]; 16270 16271 ctx._originalTransform(a, b, c, d, e, f); 16272 }; 16273 16274 ctx.setTransform = function ctxSetTransform(a, b, c, d, e, f) { 16275 this._transformMatrix = [a, b, c, d, e, f]; 16276 16277 ctx._originalSetTransform(a, b, c, d, e, f); 16278 }; 16279 16280 ctx.rotate = function ctxRotate(angle) { 16281 var cosValue = Math.cos(angle); 16282 var sinValue = Math.sin(angle); 16283 var m = this._transformMatrix; 16284 this._transformMatrix = [m[0] * cosValue + m[2] * sinValue, m[1] * cosValue + m[3] * sinValue, m[0] * -sinValue + m[2] * cosValue, m[1] * -sinValue + m[3] * cosValue, m[4], m[5]]; 16285 16286 this._originalRotate(angle); 16287 }; 16288 } 16289} 16290 16291var CachedCanvases = function CachedCanvasesClosure() { 16292 function CachedCanvases(canvasFactory) { 16293 this.canvasFactory = canvasFactory; 16294 this.cache = Object.create(null); 16295 } 16296 16297 CachedCanvases.prototype = { 16298 getCanvas: function CachedCanvases_getCanvas(id, width, height, trackTransform) { 16299 var canvasEntry; 16300 16301 if (this.cache[id] !== undefined) { 16302 canvasEntry = this.cache[id]; 16303 this.canvasFactory.reset(canvasEntry, width, height); 16304 canvasEntry.context.setTransform(1, 0, 0, 1, 0, 0); 16305 } else { 16306 canvasEntry = this.canvasFactory.create(width, height); 16307 this.cache[id] = canvasEntry; 16308 } 16309 16310 if (trackTransform) { 16311 addContextCurrentTransform(canvasEntry.context); 16312 } 16313 16314 return canvasEntry; 16315 }, 16316 16317 clear() { 16318 for (var id in this.cache) { 16319 var canvasEntry = this.cache[id]; 16320 this.canvasFactory.destroy(canvasEntry); 16321 delete this.cache[id]; 16322 } 16323 } 16324 16325 }; 16326 return CachedCanvases; 16327}(); 16328 16329function compileType3Glyph(imgData) { 16330 var POINT_TO_PROCESS_LIMIT = 1000; 16331 var width = imgData.width, 16332 height = imgData.height; 16333 var i, 16334 j, 16335 j0, 16336 width1 = width + 1; 16337 var points = new Uint8Array(width1 * (height + 1)); 16338 var POINT_TYPES = new Uint8Array([0, 2, 4, 0, 1, 0, 5, 4, 8, 10, 0, 8, 0, 2, 1, 0]); 16339 var lineSize = width + 7 & ~7, 16340 data0 = imgData.data; 16341 var data = new Uint8Array(lineSize * height), 16342 pos = 0, 16343 ii; 16344 16345 for (i = 0, ii = data0.length; i < ii; i++) { 16346 var mask = 128, 16347 elem = data0[i]; 16348 16349 while (mask > 0) { 16350 data[pos++] = elem & mask ? 0 : 255; 16351 mask >>= 1; 16352 } 16353 } 16354 16355 var count = 0; 16356 pos = 0; 16357 16358 if (data[pos] !== 0) { 16359 points[0] = 1; 16360 ++count; 16361 } 16362 16363 for (j = 1; j < width; j++) { 16364 if (data[pos] !== data[pos + 1]) { 16365 points[j] = data[pos] ? 2 : 1; 16366 ++count; 16367 } 16368 16369 pos++; 16370 } 16371 16372 if (data[pos] !== 0) { 16373 points[j] = 2; 16374 ++count; 16375 } 16376 16377 for (i = 1; i < height; i++) { 16378 pos = i * lineSize; 16379 j0 = i * width1; 16380 16381 if (data[pos - lineSize] !== data[pos]) { 16382 points[j0] = data[pos] ? 1 : 8; 16383 ++count; 16384 } 16385 16386 var sum = (data[pos] ? 4 : 0) + (data[pos - lineSize] ? 8 : 0); 16387 16388 for (j = 1; j < width; j++) { 16389 sum = (sum >> 2) + (data[pos + 1] ? 4 : 0) + (data[pos - lineSize + 1] ? 8 : 0); 16390 16391 if (POINT_TYPES[sum]) { 16392 points[j0 + j] = POINT_TYPES[sum]; 16393 ++count; 16394 } 16395 16396 pos++; 16397 } 16398 16399 if (data[pos - lineSize] !== data[pos]) { 16400 points[j0 + j] = data[pos] ? 2 : 4; 16401 ++count; 16402 } 16403 16404 if (count > POINT_TO_PROCESS_LIMIT) { 16405 return null; 16406 } 16407 } 16408 16409 pos = lineSize * (height - 1); 16410 j0 = i * width1; 16411 16412 if (data[pos] !== 0) { 16413 points[j0] = 8; 16414 ++count; 16415 } 16416 16417 for (j = 1; j < width; j++) { 16418 if (data[pos] !== data[pos + 1]) { 16419 points[j0 + j] = data[pos] ? 4 : 8; 16420 ++count; 16421 } 16422 16423 pos++; 16424 } 16425 16426 if (data[pos] !== 0) { 16427 points[j0 + j] = 4; 16428 ++count; 16429 } 16430 16431 if (count > POINT_TO_PROCESS_LIMIT) { 16432 return null; 16433 } 16434 16435 var steps = new Int32Array([0, width1, -1, 0, -width1, 0, 0, 0, 1]); 16436 var outlines = []; 16437 16438 for (i = 0; count && i <= height; i++) { 16439 var p = i * width1; 16440 var end = p + width; 16441 16442 while (p < end && !points[p]) { 16443 p++; 16444 } 16445 16446 if (p === end) { 16447 continue; 16448 } 16449 16450 var coords = [p % width1, i]; 16451 var type = points[p], 16452 p0 = p, 16453 pp; 16454 16455 do { 16456 var step = steps[type]; 16457 16458 do { 16459 p += step; 16460 } while (!points[p]); 16461 16462 pp = points[p]; 16463 16464 if (pp !== 5 && pp !== 10) { 16465 type = pp; 16466 points[p] = 0; 16467 } else { 16468 type = pp & 0x33 * type >> 4; 16469 points[p] &= type >> 2 | type << 2; 16470 } 16471 16472 coords.push(p % width1); 16473 coords.push(p / width1 | 0); 16474 16475 if (!points[p]) { 16476 --count; 16477 } 16478 } while (p0 !== p); 16479 16480 outlines.push(coords); 16481 --i; 16482 } 16483 16484 var drawOutline = function (c) { 16485 c.save(); 16486 c.scale(1 / width, -1 / height); 16487 c.translate(0, -height); 16488 c.beginPath(); 16489 16490 for (var i = 0, ii = outlines.length; i < ii; i++) { 16491 var o = outlines[i]; 16492 c.moveTo(o[0], o[1]); 16493 16494 for (var j = 2, jj = o.length; j < jj; j += 2) { 16495 c.lineTo(o[j], o[j + 1]); 16496 } 16497 } 16498 16499 c.fill(); 16500 c.beginPath();
16501 c.restore(); 16502 }; 16503 16504 return drawOutline; 16505} 16506 16507var CanvasExtraState = function CanvasExtraStateClosure() { 16508 function CanvasExtraState() { 16509 this.alphaIsShape = false; 16510 this.fontSize = 0; 16511 this.fontSizeScale = 1; 16512 this.textMatrix = _util.IDENTITY_MATRIX; 16513 this.textMatrixScale = 1; 16514 this.fontMatrix = _util.FONT_IDENTITY_MATRIX; 16515 this.leading = 0; 16516 this.x = 0; 16517 this.y = 0; 16518 this.lineX = 0; 16519 this.lineY = 0; 16520 this.charSpacing = 0; 16521 this.wordSpacing = 0; 16522 this.textHScale = 1; 16523 this.textRenderingMode = _util.TextRenderingMode.FILL; 16524 this.textRise = 0; 16525 this.fillColor = "#000000"; 16526 this.strokeColor = "#000000"; 16527 this.patternFill = false; 16528 this.fillAlpha = 1; 16529 this.strokeAlpha = 1; 16530 this.lineWidth = 1; 16531 this.activeSMask = null; 16532 this.resumeSMaskCtx = null; 16533 } 16534 16535 CanvasExtraState.prototype = { 16536 clone: function CanvasExtraState_clone() { 16537 return Object.create(this); 16538 }, 16539 setCurrentPoint: function CanvasExtraState_setCurrentPoint(x, y) { 16540 this.x = x; 16541 this.y = y; 16542 } 16543 }; 16544 return CanvasExtraState; 16545}(); 16546 16547var CanvasGraphics = function CanvasGraphicsClosure() { 16548 var EXECUTION_TIME = 15; 16549 var EXECUTION_STEPS = 10; 16550 16551 function CanvasGraphics(canvasCtx, commonObjs, objs, canvasFactory, webGLContext, imageLayer) { 16552 this.ctx = canvasCtx; 16553 this.current = new CanvasExtraState(); 16554 this.stateStack = []; 16555 this.pendingClip = null; 16556 this.pendingEOFill = false; 16557 this.res = null; 16558 this.xobjs = null; 16559 this.commonObjs = commonObjs; 16560 this.objs = objs; 16561 this.canvasFactory = canvasFactory; 16562 this.webGLContext = webGLContext; 16563 this.imageLayer = imageLayer; 16564 this.groupStack = []; 16565 this.processingType3 = null; 16566 this.baseTransform = null; 16567 this.baseTransformStack = []; 16568 this.groupLevel = 0; 16569 this.smaskStack = []; 16570 this.smaskCounter = 0; 16571 this.tempSMask = null; 16572 this.cachedCanvases = new CachedCanvases(this.canvasFactory); 16573 16574 if (canvasCtx) { 16575 addContextCurrentTransform(canvasCtx); 16576 } 16577 16578 this._cachedGetSinglePixelWidth = null; 16579 } 16580 16581 function putBinaryImageData(ctx, imgData) { 16582 if (typeof ImageData !== "undefined" && imgData instanceof ImageData) { 16583 ctx.putImageData(imgData, 0, 0); 16584 return; 16585 } 16586 16587 var height = imgData.height, 16588 width = imgData.width; 16589 var partialChunkHeight = height % FULL_CHUNK_HEIGHT; 16590 var fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT; 16591 var totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1; 16592 var chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT); 16593 var srcPos = 0, 16594 destPos; 16595 var src = imgData.data; 16596 var dest = chunkImgData.data; 16597 var i, j, thisChunkHeight, elemsInThisChunk; 16598 16599 if (imgData.kind === _util.ImageKind.GRAYSCALE_1BPP) { 16600 var srcLength = src.byteLength; 16601 var dest32 = new Uint32Array(dest.buffer, 0, dest.byteLength >> 2); 16602 var dest32DataLength = dest32.length; 16603 var fullSrcDiff = width + 7 >> 3; 16604 var white = 0xffffffff; 16605 var black = _util.IsLittleEndianCached.value ? 0xff000000 : 0x000000ff; 16606 16607 for (i = 0; i < totalChunks; i++) { 16608 thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight; 16609 destPos = 0; 16610 16611 for (j = 0; j < thisChunkHeight; j++) { 16612 var srcDiff = srcLength - srcPos; 16613 var k = 0; 16614 var kEnd = srcDiff > fullSrcDiff ? width : srcDiff * 8 - 7; 16615 var kEndUnrolled = kEnd & ~7; 16616 var mask = 0; 16617 var srcByte = 0; 16618 16619 for (; k < kEndUnrolled; k += 8) { 16620 srcByte = src[srcPos++]; 16621 dest32[destPos++] = srcByte & 128 ? white : black; 16622 dest32[destPos++] = srcByte & 64 ? white : black; 16623 dest32[destPos++] = srcByte & 32 ? white : black; 16624 dest32[destPos++] = srcByte & 16 ? white : black; 16625 dest32[destPos++] = srcByte & 8 ? white : black; 16626 dest32[destPos++] = srcByte & 4 ? white : black; 16627 dest32[destPos++] = srcByte & 2 ? white : black; 16628 dest32[destPos++] = srcByte & 1 ? white : black; 16629 } 16630 16631 for (; k < kEnd; k++) { 16632 if (mask === 0) { 16633 srcByte = src[srcPos++]; 16634 mask = 128; 16635 } 16636 16637 dest32[destPos++] = srcByte & mask ? white : black; 16638 mask >>= 1; 16639 } 16640 } 16641 16642 while (destPos < dest32DataLength) { 16643 dest32[destPos++] = 0; 16644 } 16645 16646 ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT); 16647 } 16648 } else if (imgData.kind === _util.ImageKind.RGBA_32BPP) { 16649 j = 0; 16650 elemsInThisChunk = width * FULL_CHUNK_HEIGHT * 4; 16651 16652 for (i = 0; i < fullChunks; i++) { 16653 dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk)); 16654 srcPos += elemsInThisChunk; 16655 ctx.putImageData(chunkImgData, 0, j); 16656 j += FULL_CHUNK_HEIGHT; 16657 } 16658 16659 if (i < totalChunks) { 16660 elemsInThisChunk = width * partialChunkHeight * 4; 16661 dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk)); 16662 ctx.putImageData(chunkImgData, 0, j); 16663 } 16664 } else if (imgData.kind === _util.ImageKind.RGB_24BPP) { 16665 thisChunkHeight = FULL_CHUNK_HEIGHT; 16666 elemsInThisChunk = width * thisChunkHeight; 16667 16668 for (i = 0; i < totalChunks; i++) { 16669 if (i >= fullChunks) { 16670 thisChunkHeight = partialChunkHeight; 16671 elemsInThisChunk = width * thisChunkHeight; 16672 } 16673 16674 destPos = 0; 16675
16676 for (j = elemsInThisChunk; j--;) { 16677 dest[destPos++] = src[srcPos++]; 16678 dest[destPos++] = src[srcPos++]; 16679 dest[destPos++] = src[srcPos++]; 16680 dest[destPos++] = 255; 16681 } 16682 16683 ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT); 16684 } 16685 } else { 16686 throw new Error(`bad image kind: ${imgData.kind}`); 16687 } 16688 } 16689 16690 function putBinaryImageMask(ctx, imgData) { 16691 var height = imgData.height, 16692 width = imgData.width; 16693 var partialChunkHeight = height % FULL_CHUNK_HEIGHT; 16694 var fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT; 16695 var totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1; 16696 var chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT); 16697 var srcPos = 0; 16698 var src = imgData.data; 16699 var dest = chunkImgData.data; 16700 16701 for (var i = 0; i < totalChunks; i++) { 16702 var thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight; 16703 var destPos = 3; 16704 16705 for (var j = 0; j < thisChunkHeight; j++) { 16706 var mask = 0; 16707 16708 for (var k = 0; k < width; k++) { 16709 if (!mask) { 16710 var elem = src[srcPos++]; 16711 mask = 128; 16712 } 16713 16714 dest[destPos] = elem & mask ? 0 : 255; 16715 destPos += 4; 16716 mask >>= 1; 16717 } 16718 } 16719 16720 ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT); 16721 } 16722 } 16723 16724 function copyCtxState(sourceCtx, destCtx) { 16725 var properties = ["strokeStyle", "fillStyle", "fillRule", "globalAlpha", "lineWidth", "lineCap", "lineJoin", "miterLimit", "globalCompositeOperation", "font"]; 16726 16727 for (var i = 0, ii = properties.length; i < ii; i++) { 16728 var property = properties[i]; 16729 16730 if (sourceCtx[property] !== undefined) { 16731 destCtx[property] = sourceCtx[property]; 16732 } 16733 } 16734 16735 if (sourceCtx.setLineDash !== undefined) { 16736 destCtx.setLineDash(sourceCtx.getLineDash()); 16737 destCtx.lineDashOffset = sourceCtx.lineDashOffset; 16738 } 16739 } 16740 16741 function resetCtxToDefault(ctx) { 16742 ctx.strokeStyle = "#000000"; 16743 ctx.fillStyle = "#000000"; 16744 ctx.fillRule = "nonzero"; 16745 ctx.globalAlpha = 1; 16746 ctx.lineWidth = 1; 16747 ctx.lineCap = "butt"; 16748 ctx.lineJoin = "miter"; 16749 ctx.miterLimit = 10; 16750 ctx.globalCompositeOperation = "source-over"; 16751 ctx.font = "10px sans-serif"; 16752 16753 if (ctx.setLineDash !== undefined) { 16754 ctx.setLineDash([]); 16755 ctx.lineDashOffset = 0; 16756 } 16757 } 16758 16759 function composeSMaskBackdrop(bytes, r0, g0, b0) { 16760 var length = bytes.length; 16761 16762 for (var i = 3; i < length; i += 4) { 16763 var alpha = bytes[i]; 16764 16765 if (alpha === 0) { 16766 bytes[i - 3] = r0; 16767 bytes[i - 2] = g0; 16768 bytes[i - 1] = b0; 16769 } else if (alpha < 255) { 16770 var alpha_ = 255 - alpha; 16771 bytes[i - 3] = bytes[i - 3] * alpha + r0 * alpha_ >> 8; 16772 bytes[i - 2] = bytes[i - 2] * alpha + g0 * alpha_ >> 8; 16773 bytes[i - 1] = bytes[i - 1] * alpha + b0 * alpha_ >> 8; 16774 } 16775 } 16776 } 16777 16778 function composeSMaskAlpha(maskData, layerData, transferMap) { 16779 var length = maskData.length; 16780 var scale = 1 / 255; 16781 16782 for (var i = 3; i < length; i += 4) { 16783 var alpha = transferMap ? transferMap[maskData[i]] : maskData[i]; 16784 layerData[i] = layerData[i] * alpha * scale | 0; 16785 } 16786 } 16787 16788 function composeSMaskLuminosity(maskData, layerData, transferMap) { 16789 var length = maskData.length; 16790 16791 for (var i = 3; i < length; i += 4) { 16792 var y = maskData[i - 3] * 77 + maskData[i - 2] * 152 + maskData[i - 1] * 28; 16793 layerData[i] = transferMap ? layerData[i] * transferMap[y >> 8] >> 8 : layerData[i] * y >> 16; 16794 } 16795 } 16796 16797 function genericComposeSMask(maskCtx, layerCtx, width, height, subtype, backdrop, transferMap) { 16798 var hasBackdrop = !!backdrop; 16799 var r0 = hasBackdrop ? backdrop[0] : 0; 16800 var g0 = hasBackdrop ? backdrop[1] : 0; 16801 var b0 = hasBackdrop ? backdrop[2] : 0; 16802 var composeFn; 16803 16804 if (subtype === "Luminosity") { 16805 composeFn = composeSMaskLuminosity; 16806 } else { 16807 composeFn = composeSMaskAlpha; 16808 } 16809 16810 var PIXELS_TO_PROCESS = 1048576; 16811 var chunkSize = Math.min(height, Math.ceil(PIXELS_TO_PROCESS / width)); 16812 16813 for (var row = 0; row < height; row += chunkSize) { 16814 var chunkHeight = Math.min(chunkSize, height - row); 16815 var maskData = maskCtx.getImageData(0, row, width, chunkHeight); 16816 var layerData = layerCtx.getImageData(0, row, width, chunkHeight); 16817 16818 if (hasBackdrop) { 16819 composeSMaskBackdrop(maskData.data, r0, g0, b0); 16820 } 16821 16822 composeFn(maskData.data, layerData.data, transferMap); 16823 maskCtx.putImageData(layerData, 0, row); 16824 } 16825 } 16826 16827 function composeSMask(ctx, smask, layerCtx, webGLContext) { 16828 var mask = smask.canvas; 16829 var maskCtx = smask.context; 16830 ctx.setTransform(smask.scaleX, 0, 0, smask.scaleY, smask.offsetX, smask.offsetY); 16831 var backdrop = smask.backdrop || null; 16832 16833 if (!smask.transferMap && webGLContext.isEnabled) { 16834 const composed = webGLContext.composeSMask({ 16835 layer: layerCtx.canvas, 16836 mask, 16837 properties: { 16838 subtype: smask.subtype, 16839 backdrop 16840 } 16841 }); 16842 ctx.setTransform(1, 0, 0, 1, 0, 0); 16843 ctx.drawImage(composed, smask.offsetX, smask.offsetY); 16844 return; 16845 } 16846 16847 genericComposeSMask(maskCtx, layerCtx, mask.width, mask.height, smask.subtype, backdrop, smask.transferMap); 16848 ctx.drawImage(mask, 0, 0); 16849 } 16850
16851 var LINE_CAP_STYLES = ["butt", "round", "square"]; 16852 var LINE_JOIN_STYLES = ["miter", "round", "bevel"]; 16853 var NORMAL_CLIP = {}; 16854 var EO_CLIP = {}; 16855 CanvasGraphics.prototype = { 16856 beginDrawing({ 16857 transform, 16858 viewport, 16859 transparency = false, 16860 background = null 16861 }) { 16862 var width = this.ctx.canvas.width; 16863 var height = this.ctx.canvas.height; 16864 this.ctx.save(); 16865 this.ctx.fillStyle = background || "rgb(255, 255, 255)"; 16866 this.ctx.fillRect(0, 0, width, height); 16867 this.ctx.restore(); 16868 16869 if (transparency) { 16870 var transparentCanvas = this.cachedCanvases.getCanvas("transparent", width, height, true); 16871 this.compositeCtx = this.ctx; 16872 this.transparentCanvas = transparentCanvas.canvas; 16873 this.ctx = transparentCanvas.context; 16874 this.ctx.save(); 16875 this.ctx.transform.apply(this.ctx, this.compositeCtx.mozCurrentTransform); 16876 } 16877 16878 this.ctx.save(); 16879 resetCtxToDefault(this.ctx); 16880 16881 if (transform) { 16882 this.ctx.transform.apply(this.ctx, transform); 16883 } 16884 16885 this.ctx.transform.apply(this.ctx, viewport.transform); 16886 this.baseTransform = this.ctx.mozCurrentTransform.slice(); 16887 16888 if (this.imageLayer) { 16889 this.imageLayer.beginLayout(); 16890 } 16891 }, 16892 16893 executeOperatorList: function CanvasGraphics_executeOperatorList(operatorList, executionStartIdx, continueCallback, stepper) { 16894 var argsArray = operatorList.argsArray; 16895 var fnArray = operatorList.fnArray; 16896 var i = executionStartIdx || 0; 16897 var argsArrayLen = argsArray.length; 16898 16899 if (argsArrayLen === i) { 16900 return i; 16901 } 16902 16903 var chunkOperations = argsArrayLen - i > EXECUTION_STEPS && typeof continueCallback === "function"; 16904 var endTime = chunkOperations ? Date.now() + EXECUTION_TIME : 0; 16905 var steps = 0; 16906 var commonObjs = this.commonObjs; 16907 var objs = this.objs; 16908 var fnId; 16909 16910 while (true) { 16911 if (stepper !== undefined && i === stepper.nextBreakPoint) { 16912 stepper.breakIt(i, continueCallback); 16913 return i; 16914 } 16915 16916 fnId = fnArray[i]; 16917 16918 if (fnId !== _util.OPS.dependency) { 16919 this[fnId].apply(this, argsArray[i]); 16920 } else { 16921 for (const depObjId of argsArray[i]) { 16922 const objsPool = depObjId.startsWith("g_") ? commonObjs : objs; 16923 16924 if (!objsPool.has(depObjId)) { 16925 objsPool.get(depObjId, continueCallback); 16926 return i; 16927 } 16928 } 16929 } 16930 16931 i++; 16932 16933 if (i === argsArrayLen) { 16934 return i; 16935 } 16936 16937 if (chunkOperations && ++steps > EXECUTION_STEPS) { 16938 if (Date.now() > endTime) { 16939 continueCallback(); 16940 return i; 16941 } 16942 16943 steps = 0; 16944 } 16945 } 16946 }, 16947 endDrawing: function CanvasGraphics_endDrawing() { 16948 if (this.current.activeSMask !== null) { 16949 this.endSMaskGroup(); 16950 } 16951 16952 this.ctx.restore(); 16953 16954 if (this.transparentCanvas) { 16955 this.ctx = this.compositeCtx; 16956 this.ctx.save(); 16957 this.ctx.setTransform(1, 0, 0, 1, 0, 0); 16958 this.ctx.drawImage(this.transparentCanvas, 0, 0); 16959 this.ctx.restore(); 16960 this.transparentCanvas = null; 16961 } 16962 16963 this.cachedCanvases.clear(); 16964 this.webGLContext.clear(); 16965 16966 if (this.imageLayer) { 16967 this.imageLayer.endLayout(); 16968 } 16969 }, 16970 setLineWidth: function CanvasGraphics_setLineWidth(width) { 16971 this.current.lineWidth = width; 16972 this.ctx.lineWidth = width; 16973 }, 16974 setLineCap: function CanvasGraphics_setLineCap(style) { 16975 this.ctx.lineCap = LINE_CAP_STYLES[style]; 16976 }, 16977 setLineJoin: function CanvasGraphics_setLineJoin(style) { 16978 this.ctx.lineJoin = LINE_JOIN_STYLES[style]; 16979 }, 16980 setMiterLimit: function CanvasGraphics_setMiterLimit(limit) { 16981 this.ctx.miterLimit = limit; 16982 }, 16983 setDash: function CanvasGraphics_setDash(dashArray, dashPhase) { 16984 var ctx = this.ctx; 16985 16986 if (ctx.setLineDash !== undefined) { 16987 ctx.setLineDash(dashArray); 16988 ctx.lineDashOffset = dashPhase; 16989 } 16990 }, 16991
vendor: 4,106 bytes, lines 16992-17117
16992 setRenderingIntent(intent) {}, 16993 16994 setFlatness(flatness) {}, 16995 16996 setGState: function CanvasGraphics_setGState(states) { 16997 for (var i = 0, ii = states.length; i < ii; i++) { 16998 var state = states[i]; 16999 var key = state[0]; 17000 var value = state[1]; 17001 17002 switch (key) { 17003 case "LW": 17004 this.setLineWidth(value); 17005 break; 17006 17007 case "LC": 17008 this.setLineCap(value); 17009 break; 17010 17011 case "LJ": 17012 this.setLineJoin(value); 17013 break; 17014 17015 case "ML": 17016 this.setMiterLimit(value); 17017 break; 17018 17019 case "D": 17020 this.setDash(value[0], value[1]); 17021 break; 17022 17023 case "RI": 17024 this.setRenderingIntent(value); 17025 break; 17026 17027 case "FL": 17028 this.setFlatness(value); 17029 break; 17030 17031 case "Font": 17032 this.setFont(value[0], value[1]); 17033 break; 17034 17035 case "CA": 17036 this.current.strokeAlpha = state[1]; 17037 break; 17038 17039 case "ca": 17040 this.current.fillAlpha = state[1]; 17041 this.ctx.globalAlpha = state[1]; 17042 break; 17043 17044 case "BM": 17045 this.ctx.globalCompositeOperation = value; 17046 break; 17047 17048 case "SMask": 17049 if (this.current.activeSMask) { 17050 if (this.stateStack.length > 0 && this.stateStack[this.stateStack.length - 1].activeSMask === this.current.activeSMask) { 17051 this.suspendSMaskGroup(); 17052 } else { 17053 this.endSMaskGroup(); 17054 } 17055 } 17056 17057 this.current.activeSMask = value ? this.tempSMask : null; 17058 17059 if (this.current.activeSMask) { 17060 this.beginSMaskGroup(); 17061 } 17062 17063 this.tempSMask = null; 17064 break; 17065 } 17066 } 17067 }, 17068 beginSMaskGroup: function CanvasGraphics_beginSMaskGroup() { 17069 var activeSMask = this.current.activeSMask; 17070 var drawnWidth = activeSMask.canvas.width; 17071 var drawnHeight = activeSMask.canvas.height; 17072 var cacheId = "smaskGroupAt" + this.groupLevel; 17073 var scratchCanvas = this.cachedCanvases.getCanvas(cacheId, drawnWidth, drawnHeight, true); 17074 var currentCtx = this.ctx; 17075 var currentTransform = currentCtx.mozCurrentTransform; 17076 this.ctx.save(); 17077 var groupCtx = scratchCanvas.context; 17078 groupCtx.scale(1 / activeSMask.scaleX, 1 / activeSMask.scaleY); 17079 groupCtx.translate(-activeSMask.offsetX, -activeSMask.offsetY); 17080 groupCtx.transform.apply(groupCtx, currentTransform); 17081 activeSMask.startTransformInverse = groupCtx.mozCurrentTransformInverse; 17082 copyCtxState(currentCtx, groupCtx); 17083 this.ctx = groupCtx; 17084 this.setGState([["BM", "source-over"], ["ca", 1], ["CA", 1]]); 17085 this.groupStack.push(currentCtx); 17086 this.groupLevel++; 17087 }, 17088 suspendSMaskGroup: function CanvasGraphics_endSMaskGroup() { 17089 var groupCtx = this.ctx; 17090 this.groupLevel--; 17091 this.ctx = this.groupStack.pop(); 17092 composeSMask(this.ctx, this.current.activeSMask, groupCtx, this.webGLContext); 17093 this.ctx.restore(); 17094 this.ctx.save(); 17095 copyCtxState(groupCtx, this.ctx); 17096 this.current.resumeSMaskCtx = groupCtx; 17097 17098 var deltaTransform = _util.Util.transform(this.current.activeSMask.startTransformInverse, groupCtx.mozCurrentTransform); 17099 17100 this.ctx.transform.apply(this.ctx, deltaTransform); 17101 groupCtx.save(); 17102 groupCtx.setTransform(1, 0, 0, 1, 0, 0); 17103 groupCtx.clearRect(0, 0, groupCtx.canvas.width, groupCtx.canvas.height); 17104 groupCtx.restore(); 17105 }, 17106 resumeSMaskGroup: function CanvasGraphics_endSMaskGroup() { 17107 var groupCtx = this.current.resumeSMaskCtx; 17108 var currentCtx = this.ctx; 17109 this.ctx = groupCtx; 17110 this.groupStack.push(currentCtx); 17111 this.groupLevel++; 17112 }, 17113 endSMaskGroup: function CanvasGraphics_endSMaskGroup() { 17114 var groupCtx = this.ctx; 17115 this.groupLevel--; 17116 this.ctx = this.groupStack.pop(); 17117 composeSMask(this.ctx, this.current.activeSMask, groupCtx, this.webGLContext);
17118 this.ctx.restore(); 17119 copyCtxState(groupCtx, this.ctx); 17120 17121 var deltaTransform = _util.Util.transform(this.current.activeSMask.startTransformInverse, groupCtx.mozCurrentTransform); 17122 17123 this.ctx.transform.apply(this.ctx, deltaTransform); 17124 }, 17125 save: function CanvasGraphics_save() { 17126 this.ctx.save(); 17127 var old = this.current; 17128 this.stateStack.push(old); 17129 this.current = old.clone(); 17130 this.current.resumeSMaskCtx = null; 17131 }, 17132 restore: function CanvasGraphics_restore() { 17133 if (this.current.resumeSMaskCtx) { 17134 this.resumeSMaskGroup(); 17135 } 17136 17137 if (this.current.activeSMask !== null && (this.stateStack.length === 0 || this.stateStack[this.stateStack.length - 1].activeSMask !== this.current.activeSMask)) { 17138 this.endSMaskGroup(); 17139 } 17140 17141 if (this.stateStack.length !== 0) { 17142 this.current = this.stateStack.pop(); 17143 this.ctx.restore(); 17144 this.pendingClip = null; 17145 this._cachedGetSinglePixelWidth = null; 17146 } 17147 }, 17148 transform: function CanvasGraphics_transform(a, b, c, d, e, f) { 17149 this.ctx.transform(a, b, c, d, e, f); 17150 this._cachedGetSinglePixelWidth = null; 17151 }, 17152 constructPath: function CanvasGraphics_constructPath(ops, args) { 17153 var ctx = this.ctx; 17154 var current = this.current; 17155 var x = current.x, 17156 y = current.y; 17157 17158 for (var i = 0, j = 0, ii = ops.length; i < ii; i++) { 17159 switch (ops[i] | 0) { 17160 case _util.OPS.rectangle: 17161 x = args[j++]; 17162 y = args[j++]; 17163 var width = args[j++]; 17164 var height = args[j++]; 17165 17166 if (width === 0) { 17167 width = this.getSinglePixelWidth(); 17168 } 17169 17170 if (height === 0) { 17171 height = this.getSinglePixelWidth(); 17172 } 17173 17174 var xw = x + width; 17175 var yh = y + height; 17176 this.ctx.moveTo(x, y); 17177 this.ctx.lineTo(xw, y); 17178 this.ctx.lineTo(xw, yh); 17179 this.ctx.lineTo(x, yh); 17180 this.ctx.lineTo(x, y); 17181 this.ctx.closePath(); 17182 break; 17183 17184 case _util.OPS.moveTo: 17185 x = args[j++]; 17186 y = args[j++]; 17187 ctx.moveTo(x, y); 17188 break; 17189 17190 case _util.OPS.lineTo: 17191 x = args[j++]; 17192 y = args[j++]; 17193 ctx.lineTo(x, y); 17194 break; 17195 17196 case _util.OPS.curveTo: 17197 x = args[j + 4]; 17198 y = args[j + 5]; 17199 ctx.bezierCurveTo(args[j], args[j + 1], args[j + 2], args[j + 3], x, y); 17200 j += 6; 17201 break; 17202 17203 case _util.OPS.curveTo2: 17204 ctx.bezierCurveTo(x, y, args[j], args[j + 1], args[j + 2], args[j + 3]); 17205 x = args[j + 2]; 17206 y = args[j + 3]; 17207 j += 4; 17208 break; 17209 17210 case _util.OPS.curveTo3: 17211 x = args[j + 2]; 17212 y = args[j + 3]; 17213 ctx.bezierCurveTo(args[j], args[j + 1], x, y, x, y); 17214 j += 4; 17215 break; 17216 17217 case _util.OPS.closePath: 17218 ctx.closePath(); 17219 break; 17220 } 17221 } 17222 17223 current.setCurrentPoint(x, y); 17224 }, 17225 closePath: function CanvasGraphics_closePath() { 17226 this.ctx.closePath(); 17227 }, 17228 stroke: function CanvasGraphics_stroke(consumePath) { 17229 consumePath = typeof consumePath !== "undefined" ? consumePath : true; 17230 var ctx = this.ctx; 17231 var strokeColor = this.current.strokeColor; 17232 ctx.globalAlpha = this.current.strokeAlpha; 17233 17234 if (strokeColor && strokeColor.hasOwnProperty("type") && strokeColor.type === "Pattern") { 17235 ctx.save(); 17236 const transform = ctx.mozCurrentTransform; 17237 17238 const scale = _util.Util.singularValueDecompose2dScale(transform)[0]; 17239 17240 ctx.strokeStyle = strokeColor.getPattern(ctx, this); 17241 ctx.lineWidth = Math.max(this.getSinglePixelWidth() * MIN_WIDTH_FACTOR, this.current.lineWidth * scale); 17242 ctx.stroke(); 17243 ctx.restore(); 17244 } else { 17245 ctx.lineWidth = Math.max(this.getSinglePixelWidth() * MIN_WIDTH_FACTOR, this.current.lineWidth); 17246 ctx.stroke(); 17247 } 17248 17249 if (consumePath) { 17250 this.consumePath(); 17251 } 17252 17253 ctx.globalAlpha = this.current.fillAlpha; 17254 }, 17255 closeStroke: function CanvasGraphics_closeStroke() { 17256 this.closePath(); 17257 this.stroke(); 17258 }, 17259 fill: function CanvasGraphics_fill(consumePath) {
17260 consumePath = typeof consumePath !== "undefined" ? consumePath : true; 17261 var ctx = this.ctx; 17262 var fillColor = this.current.fillColor; 17263 var isPatternFill = this.current.patternFill; 17264 var needRestore = false; 17265 17266 if (isPatternFill) { 17267 ctx.save(); 17268 17269 if (this.baseTransform) { 17270 ctx.setTransform.apply(ctx, this.baseTransform); 17271 } 17272 17273 ctx.fillStyle = fillColor.getPattern(ctx, this); 17274 needRestore = true; 17275 } 17276 17277 if (this.pendingEOFill) { 17278 ctx.fill("evenodd"); 17279 this.pendingEOFill = false; 17280 } else { 17281 ctx.fill(); 17282 } 17283 17284 if (needRestore) { 17285 ctx.restore(); 17286 } 17287 17288 if (consumePath) { 17289 this.consumePath(); 17290 } 17291 }, 17292 eoFill: function CanvasGraphics_eoFill() { 17293 this.pendingEOFill = true; 17294 this.fill(); 17295 }, 17296 fillStroke: function CanvasGraphics_fillStroke() { 17297 this.fill(false); 17298 this.stroke(false); 17299 this.consumePath(); 17300 }, 17301 eoFillStroke: function CanvasGraphics_eoFillStroke() { 17302 this.pendingEOFill = true; 17303 this.fillStroke(); 17304 }, 17305 closeFillStroke: function CanvasGraphics_closeFillStroke() { 17306 this.closePath(); 17307 this.fillStroke(); 17308 }, 17309 closeEOFillStroke: function CanvasGraphics_closeEOFillStroke() { 17310 this.pendingEOFill = true; 17311 this.closePath(); 17312 this.fillStroke(); 17313 }, 17314 endPath: function CanvasGraphics_endPath() { 17315 this.consumePath(); 17316 }, 17317 clip: function CanvasGraphics_clip() { 17318 this.pendingClip = NORMAL_CLIP; 17319 }, 17320 eoClip: function CanvasGraphics_eoClip() { 17321 this.pendingClip = EO_CLIP; 17322 }, 17323 beginText: function CanvasGraphics_beginText() { 17324 this.current.textMatrix = _util.IDENTITY_MATRIX; 17325 this.current.textMatrixScale = 1; 17326 this.current.x = this.current.lineX = 0; 17327 this.current.y = this.current.lineY = 0; 17328 }, 17329 endText: function CanvasGraphics_endText() { 17330 var paths = this.pendingTextPaths; 17331 var ctx = this.ctx; 17332 17333 if (paths === undefined) { 17334 ctx.beginPath(); 17335 return; 17336 } 17337 17338 ctx.save(); 17339 ctx.beginPath(); 17340 17341 for (var i = 0; i < paths.length; i++) { 17342 var path = paths[i]; 17343 ctx.setTransform.apply(ctx, path.transform); 17344 ctx.translate(path.x, path.y); 17345 path.addToPath(ctx, path.fontSize); 17346 } 17347 17348 ctx.restore(); 17349 ctx.clip(); 17350 ctx.beginPath(); 17351 delete this.pendingTextPaths; 17352 }, 17353 setCharSpacing: function CanvasGraphics_setCharSpacing(spacing) { 17354 this.current.charSpacing = spacing; 17355 }, 17356 setWordSpacing: function CanvasGraphics_setWordSpacing(spacing) { 17357 this.current.wordSpacing = spacing; 17358 }, 17359 setHScale: function CanvasGraphics_setHScale(scale) { 17360 this.current.textHScale = scale / 100; 17361 }, 17362 setLeading: function CanvasGraphics_setLeading(leading) { 17363 this.current.leading = -leading; 17364 }, 17365 setFont: function CanvasGraphics_setFont(fontRefName, size) { 17366 var fontObj = this.commonObjs.get(fontRefName); 17367 var current = this.current; 17368 17369 if (!fontObj) { 17370 throw new Error(`Can't find font for ${fontRefName}`); 17371 } 17372 17373 current.fontMatrix = fontObj.fontMatrix ? fontObj.fontMatrix : _util.FONT_IDENTITY_MATRIX; 17374 17375 if (current.fontMatrix[0] === 0 || current.fontMatrix[3] === 0) { 17376 (0, _util.warn)("Invalid font matrix for font " + fontRefName); 17377 } 17378 17379 if (size < 0) { 17380 size = -size; 17381 current.fontDirection = -1; 17382 } else { 17383 current.fontDirection = 1; 17384 } 17385 17386 this.current.font = fontObj; 17387 this.current.fontSize = size; 17388 17389 if (fontObj.isType3Font) { 17390 return; 17391 } 17392 17393 var name = fontObj.loadedName || "sans-serif"; 17394 let bold = "normal"; 17395 17396 if (fontObj.black) { 17397 bold = "900"; 17398 } else if (fontObj.bold) { 17399 bold = "bold"; 17400 } 17401 17402 var italic = fontObj.italic ? "italic" : "normal"; 17403 var typeface = `"${name}", ${fontObj.fallbackName}`; 17404 let browserFontSize = size; 17405 17406 if (size < MIN_FONT_SIZE) { 17407 browserFontSize = MIN_FONT_SIZE; 17408 } else if (size > MAX_FONT_SIZE) { 17409 browserFontSize = MAX_FONT_SIZE; 17410 } 17411 17412 this.current.fontSizeScale = size / browserFontSize; 17413 this.ctx.font = `${italic} ${bold} ${browserFontSize}px ${typeface}`; 17414 }, 17415 setTextRenderingMode: function CanvasGraphics_setTextRenderingMode(mode) { 17416 this.current.textRenderingMode = mode; 17417 }, 17418 setTextRise: function CanvasGraphics_setTextRise(rise) { 17419 this.current.textRise = rise; 17420 }, 17421 moveText: function CanvasGraphics_moveText(x, y) { 17422 this.current.x = this.current.lineX += x; 17423 this.current.y = this.current.lineY += y; 17424 },
17425 setLeadingMoveText: function CanvasGraphics_setLeadingMoveText(x, y) { 17426 this.setLeading(-y); 17427 this.moveText(x, y); 17428 }, 17429 setTextMatrix: function CanvasGraphics_setTextMatrix(a, b, c, d, e, f) { 17430 this.current.textMatrix = [a, b, c, d, e, f]; 17431 this.current.textMatrixScale = Math.sqrt(a * a + b * b); 17432 this.current.x = this.current.lineX = 0; 17433 this.current.y = this.current.lineY = 0; 17434 }, 17435 nextLine: function CanvasGraphics_nextLine() { 17436 this.moveText(0, this.current.leading); 17437 }, 17438 17439 paintChar(character, x, y, patternTransform) { 17440 var ctx = this.ctx; 17441 var current = this.current; 17442 var font = current.font; 17443 var textRenderingMode = current.textRenderingMode; 17444 var fontSize = current.fontSize / current.fontSizeScale; 17445 var fillStrokeMode = textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK; 17446 var isAddToPathSet = !!(textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG); 17447 const patternFill = current.patternFill && font.data; 17448 var addToPath; 17449 17450 if (font.disableFontFace || isAddToPathSet || patternFill) { 17451 addToPath = font.getPathGenerator(this.commonObjs, character); 17452 } 17453 17454 if (font.disableFontFace || patternFill) { 17455 ctx.save(); 17456 ctx.translate(x, y); 17457 ctx.beginPath(); 17458 addToPath(ctx, fontSize); 17459 17460 if (patternTransform) { 17461 ctx.setTransform.apply(ctx, patternTransform); 17462 } 17463 17464 if (fillStrokeMode === _util.TextRenderingMode.FILL || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { 17465 ctx.fill(); 17466 } 17467 17468 if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { 17469 ctx.stroke(); 17470 } 17471 17472 ctx.restore(); 17473 } else { 17474 if (fillStrokeMode === _util.TextRenderingMode.FILL || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { 17475 ctx.fillText(character, x, y); 17476 } 17477 17478 if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { 17479 ctx.strokeText(character, x, y); 17480 } 17481 } 17482 17483 if (isAddToPathSet) { 17484 var paths = this.pendingTextPaths || (this.pendingTextPaths = []); 17485 paths.push({ 17486 transform: ctx.mozCurrentTransform, 17487 x, 17488 y, 17489 fontSize, 17490 addToPath 17491 }); 17492 } 17493 }, 17494 17495 get isFontSubpixelAAEnabled() { 17496 const { 17497 context: ctx 17498 } = this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled", 10, 10); 17499 ctx.scale(1.5, 1); 17500 ctx.fillText("I", 0, 10); 17501 var data = ctx.getImageData(0, 0, 10, 10).data; 17502 var enabled = false; 17503 17504 for (var i = 3; i < data.length; i += 4) { 17505 if (data[i] > 0 && data[i] < 255) { 17506 enabled = true; 17507 break; 17508 } 17509 } 17510 17511 return (0, _util.shadow)(this, "isFontSubpixelAAEnabled", enabled); 17512 }, 17513 17514 showText: function CanvasGraphics_showText(glyphs) { 17515 var current = this.current; 17516 var font = current.font; 17517 17518 if (font.isType3Font) { 17519 return this.showType3Text(glyphs); 17520 } 17521 17522 var fontSize = current.fontSize; 17523 17524 if (fontSize === 0) { 17525 return undefined; 17526 } 17527 17528 var ctx = this.ctx; 17529 var fontSizeScale = current.fontSizeScale; 17530 var charSpacing = current.charSpacing; 17531 var wordSpacing = current.wordSpacing; 17532 var fontDirection = current.fontDirection; 17533 var textHScale = current.textHScale * fontDirection; 17534 var glyphsLength = glyphs.length; 17535 var vertical = font.vertical; 17536 var spacingDir = vertical ? 1 : -1; 17537 var defaultVMetrics = font.defaultVMetrics; 17538 var widthAdvanceScale = fontSize * current.fontMatrix[0]; 17539 var simpleFillText = current.textRenderingMode === _util.TextRenderingMode.FILL && !font.disableFontFace && !current.patternFill; 17540 ctx.save(); 17541 let patternTransform; 17542 17543 if (current.patternFill) { 17544 ctx.save(); 17545 const pattern = current.fillColor.getPattern(ctx, this); 17546 patternTransform = ctx.mozCurrentTransform;
17547 ctx.restore(); 17548 ctx.fillStyle = pattern; 17549 } 17550 17551 ctx.transform.apply(ctx, current.textMatrix); 17552 ctx.translate(current.x, current.y + current.textRise); 17553 17554 if (fontDirection > 0) { 17555 ctx.scale(textHScale, -1); 17556 } else { 17557 ctx.scale(textHScale, 1); 17558 } 17559 17560 var lineWidth = current.lineWidth; 17561 var scale = current.textMatrixScale; 17562 17563 if (scale === 0 || lineWidth === 0) { 17564 var fillStrokeMode = current.textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK; 17565 17566 if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { 17567 this._cachedGetSinglePixelWidth = null; 17568 lineWidth = this.getSinglePixelWidth() * MIN_WIDTH_FACTOR; 17569 } 17570 } else { 17571 lineWidth /= scale; 17572 } 17573 17574 if (fontSizeScale !== 1.0) { 17575 ctx.scale(fontSizeScale, fontSizeScale); 17576 lineWidth /= fontSizeScale; 17577 } 17578 17579 ctx.lineWidth = lineWidth; 17580 var x = 0, 17581 i; 17582 17583 for (i = 0; i < glyphsLength; ++i) { 17584 var glyph = glyphs[i]; 17585 17586 if ((0, _util.isNum)(glyph)) { 17587 x += spacingDir * glyph * fontSize / 1000; 17588 continue; 17589 } 17590 17591 var restoreNeeded = false; 17592 var spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing; 17593 var character = glyph.fontChar; 17594 var accent = glyph.accent; 17595 var scaledX, scaledY, scaledAccentX, scaledAccentY; 17596 var width = glyph.width; 17597 17598 if (vertical) { 17599 var vmetric, vx, vy; 17600 vmetric = glyph.vmetric || defaultVMetrics; 17601 vx = glyph.vmetric ? vmetric[1] : width * 0.5; 17602 vx = -vx * widthAdvanceScale; 17603 vy = vmetric[2] * widthAdvanceScale; 17604 width = vmetric ? -vmetric[0] : width; 17605 scaledX = vx / fontSizeScale; 17606 scaledY = (x + vy) / fontSizeScale; 17607 } else { 17608 scaledX = x / fontSizeScale; 17609 scaledY = 0; 17610 } 17611 17612 if (font.remeasure && width > 0) { 17613 var measuredWidth = ctx.measureText(character).width * 1000 / fontSize * fontSizeScale; 17614 17615 if (width < measuredWidth && this.isFontSubpixelAAEnabled) { 17616 var characterScaleX = width / measuredWidth; 17617 restoreNeeded = true; 17618 ctx.save(); 17619 ctx.scale(characterScaleX, 1); 17620 scaledX /= characterScaleX; 17621 } else if (width !== measuredWidth) { 17622 scaledX += (width - measuredWidth) / 2000 * fontSize / fontSizeScale; 17623 } 17624 } 17625 17626 if (glyph.isInFont || font.missingFile) { 17627 if (simpleFillText && !accent) { 17628 ctx.fillText(character, scaledX, scaledY); 17629 } else { 17630 this.paintChar(character, scaledX, scaledY, patternTransform); 17631 17632 if (accent) { 17633 scaledAccentX = scaledX + accent.offset.x / fontSizeScale; 17634 scaledAccentY = scaledY - accent.offset.y / fontSizeScale; 17635 this.paintChar(accent.fontChar, scaledAccentX, scaledAccentY, patternTransform); 17636 } 17637 } 17638 } 17639 17640 var charWidth; 17641 17642 if (vertical) { 17643 charWidth = width * widthAdvanceScale - spacing * fontDirection; 17644 } else { 17645 charWidth = width * widthAdvanceScale + spacing * fontDirection; 17646 } 17647 17648 x += charWidth; 17649 17650 if (restoreNeeded) { 17651 ctx.restore(); 17652 } 17653 } 17654 17655 if (vertical) { 17656 current.y -= x; 17657 } else { 17658 current.x += x * textHScale; 17659 } 17660 17661 ctx.restore(); 17662 }, 17663 showType3Text: function CanvasGraphics_showType3Text(glyphs) { 17664 var ctx = this.ctx; 17665 var current = this.current; 17666 var font = current.font; 17667 var fontSize = current.fontSize; 17668 var fontDirection = current.fontDirection; 17669 var spacingDir = font.vertical ? 1 : -1; 17670 var charSpacing = current.charSpacing; 17671 var wordSpacing = current.wordSpacing; 17672 var textHScale = current.textHScale * fontDirection; 17673 var fontMatrix = current.fontMatrix || _util.FONT_IDENTITY_MATRIX; 17674 var glyphsLength = glyphs.length; 17675 var isTextInvisible = current.textRenderingMode === _util.TextRenderingMode.INVISIBLE; 17676 var i, glyph, width, spacingLength; 17677 17678 if (isTextInvisible || fontSize === 0) { 17679 return; 17680 } 17681 17682 this._cachedGetSinglePixelWidth = null; 17683 ctx.save(); 17684 ctx.transform.apply(ctx, current.textMatrix); 17685 ctx.translate(current.x, current.y); 17686 ctx.scale(textHScale, fontDirection); 17687 17688 for (i = 0; i < glyphsLength; ++i) { 17689 glyph = glyphs[i]; 17690
17691 if ((0, _util.isNum)(glyph)) { 17692 spacingLength = spacingDir * glyph * fontSize / 1000; 17693 this.ctx.translate(spacingLength, 0); 17694 current.x += spacingLength * textHScale; 17695 continue; 17696 } 17697 17698 var spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing; 17699 var operatorList = font.charProcOperatorList[glyph.operatorListId]; 17700 17701 if (!operatorList) { 17702 (0, _util.warn)(`Type3 character "${glyph.operatorListId}" is not available.`); 17703 continue; 17704 } 17705 17706 this.processingType3 = glyph; 17707 this.save(); 17708 ctx.scale(fontSize, fontSize); 17709 ctx.transform.apply(ctx, fontMatrix); 17710 this.executeOperatorList(operatorList); 17711 this.restore(); 17712 17713 var transformed = _util.Util.applyTransform([glyph.width, 0], fontMatrix); 17714 17715 width = transformed[0] * fontSize + spacing; 17716 ctx.translate(width, 0); 17717 current.x += width * textHScale; 17718 } 17719 17720 ctx.restore(); 17721 this.processingType3 = null; 17722 }, 17723 setCharWidth: function CanvasGraphics_setCharWidth(xWidth, yWidth) {}, 17724 setCharWidthAndBounds: function CanvasGraphics_setCharWidthAndBounds(xWidth, yWidth, llx, lly, urx, ury) { 17725 this.ctx.rect(llx, lly, urx - llx, ury - lly); 17726 this.clip(); 17727 this.endPath(); 17728 }, 17729 getColorN_Pattern: function CanvasGraphics_getColorN_Pattern(IR) { 17730 var pattern; 17731 17732 if (IR[0] === "TilingPattern") { 17733 var color = IR[1]; 17734 var baseTransform = this.baseTransform || this.ctx.mozCurrentTransform.slice(); 17735 var canvasGraphicsFactory = { 17736 createCanvasGraphics: ctx => { 17737 return new CanvasGraphics(ctx, this.commonObjs, this.objs, this.canvasFactory, this.webGLContext); 17738 } 17739 }; 17740 pattern = new _pattern_helper.TilingPattern(IR, color, this.ctx, canvasGraphicsFactory, baseTransform); 17741 } else { 17742 pattern = (0, _pattern_helper.getShadingPatternFromIR)(IR); 17743 } 17744 17745 return pattern; 17746 }, 17747 setStrokeColorN: function CanvasGraphics_setStrokeColorN() { 17748 this.current.strokeColor = this.getColorN_Pattern(arguments); 17749 }, 17750 setFillColorN: function CanvasGraphics_setFillColorN() { 17751 this.current.fillColor = this.getColorN_Pattern(arguments); 17752 this.current.patternFill = true; 17753 }, 17754 setStrokeRGBColor: function CanvasGraphics_setStrokeRGBColor(r, g, b) { 17755 var color = _util.Util.makeCssRgb(r, g, b); 17756 17757 this.ctx.strokeStyle = color; 17758 this.current.strokeColor = color; 17759 }, 17760 setFillRGBColor: function CanvasGraphics_setFillRGBColor(r, g, b) { 17761 var color = _util.Util.makeCssRgb(r, g, b); 17762 17763 this.ctx.fillStyle = color; 17764 this.current.fillColor = color; 17765 this.current.patternFill = false; 17766 }, 17767 shadingFill: function CanvasGraphics_shadingFill(patternIR) { 17768 var ctx = this.ctx; 17769 this.save(); 17770 var pattern = (0, _pattern_helper.getShadingPatternFromIR)(patternIR); 17771 ctx.fillStyle = pattern.getPattern(ctx, this, true); 17772 var inv = ctx.mozCurrentTransformInverse; 17773 17774 if (inv) { 17775 var canvas = ctx.canvas; 17776 var width = canvas.width; 17777 var height = canvas.height; 17778 17779 var bl = _util.Util.applyTransform([0, 0], inv); 17780 17781 var br = _util.Util.applyTransform([0, height], inv); 17782 17783 var ul = _util.Util.applyTransform([width, 0], inv); 17784 17785 var ur = _util.Util.applyTransform([width, height], inv); 17786 17787 var x0 = Math.min(bl[0], br[0], ul[0], ur[0]); 17788 var y0 = Math.min(bl[1], br[1], ul[1], ur[1]); 17789 var x1 = Math.max(bl[0], br[0], ul[0], ur[0]); 17790 var y1 = Math.max(bl[1], br[1], ul[1], ur[1]); 17791 this.ctx.fillRect(x0, y0, x1 - x0, y1 - y0); 17792 } else { 17793 this.ctx.fillRect(-1e10, -1e10, 2e10, 2e10); 17794 } 17795 17796 this.restore(); 17797 }, 17798 beginInlineImage: function CanvasGraphics_beginInlineImage() { 17799 (0, _util.unreachable)("Should not call beginInlineImage"); 17800 }, 17801 beginImageData: function CanvasGraphics_beginImageData() { 17802 (0, _util.unreachable)("Should not call beginImageData"); 17803 }, 17804 paintFormXObjectBegin: function CanvasGraphics_paintFormXObjectBegin(matrix, bbox) { 17805 this.save(); 17806 this.baseTransformStack.push(this.baseTransform); 17807 17808 if (Array.isArray(matrix) && matrix.length === 6) { 17809 this.transform.apply(this, matrix); 17810 } 17811 17812 this.baseTransform = this.ctx.mozCurrentTransform; 17813 17814 if (bbox) { 17815 var width = bbox[2] - bbox[0]; 17816 var height = bbox[3] - bbox[1]; 17817 this.ctx.rect(bbox[0], bbox[1], width, height); 17818 this.clip(); 17819 this.endPath(); 17820 } 17821 }, 17822 paintFormXObjectEnd: function CanvasGraphics_paintFormXObjectEnd() {
17823 this.restore(); 17824 this.baseTransform = this.baseTransformStack.pop(); 17825 }, 17826 beginGroup: function CanvasGraphics_beginGroup(group) { 17827 this.save(); 17828 var currentCtx = this.ctx; 17829 17830 if (!group.isolated) { 17831 (0, _util.info)("TODO: Support non-isolated groups."); 17832 } 17833 17834 if (group.knockout) { 17835 (0, _util.warn)("Knockout groups not supported."); 17836 } 17837 17838 var currentTransform = currentCtx.mozCurrentTransform; 17839 17840 if (group.matrix) { 17841 currentCtx.transform.apply(currentCtx, group.matrix); 17842 } 17843 17844 if (!group.bbox) { 17845 throw new Error("Bounding box is required."); 17846 } 17847 17848 var bounds = _util.Util.getAxialAlignedBoundingBox(group.bbox, currentCtx.mozCurrentTransform); 17849 17850 var canvasBounds = [0, 0, currentCtx.canvas.width, currentCtx.canvas.height]; 17851 bounds = _util.Util.intersect(bounds, canvasBounds) || [0, 0, 0, 0]; 17852 var offsetX = Math.floor(bounds[0]); 17853 var offsetY = Math.floor(bounds[1]); 17854 var drawnWidth = Math.max(Math.ceil(bounds[2]) - offsetX, 1); 17855 var drawnHeight = Math.max(Math.ceil(bounds[3]) - offsetY, 1); 17856 var scaleX = 1, 17857 scaleY = 1; 17858 17859 if (drawnWidth > MAX_GROUP_SIZE) { 17860 scaleX = drawnWidth / MAX_GROUP_SIZE; 17861 drawnWidth = MAX_GROUP_SIZE; 17862 } 17863 17864 if (drawnHeight > MAX_GROUP_SIZE) { 17865 scaleY = drawnHeight / MAX_GROUP_SIZE; 17866 drawnHeight = MAX_GROUP_SIZE; 17867 } 17868 17869 var cacheId = "groupAt" + this.groupLevel; 17870 17871 if (group.smask) { 17872 cacheId += "_smask_" + this.smaskCounter++ % 2; 17873 } 17874 17875 var scratchCanvas = this.cachedCanvases.getCanvas(cacheId, drawnWidth, drawnHeight, true); 17876 var groupCtx = scratchCanvas.context; 17877 groupCtx.scale(1 / scaleX, 1 / scaleY); 17878 groupCtx.translate(-offsetX, -offsetY); 17879 groupCtx.transform.apply(groupCtx, currentTransform); 17880 17881 if (group.smask) { 17882 this.smaskStack.push({ 17883 canvas: scratchCanvas.canvas, 17884 context: groupCtx, 17885 offsetX, 17886 offsetY, 17887 scaleX, 17888 scaleY, 17889 subtype: group.smask.subtype, 17890 backdrop: group.smask.backdrop, 17891 transferMap: group.smask.transferMap || null, 17892 startTransformInverse: null 17893 }); 17894 } else { 17895 currentCtx.setTransform(1, 0, 0, 1, 0, 0); 17896 currentCtx.translate(offsetX, offsetY); 17897 currentCtx.scale(scaleX, scaleY); 17898 } 17899 17900 copyCtxState(currentCtx, groupCtx); 17901 this.ctx = groupCtx; 17902 this.setGState([["BM", "source-over"], ["ca", 1], ["CA", 1]]); 17903 this.groupStack.push(currentCtx); 17904 this.groupLevel++; 17905 this.current.activeSMask = null; 17906 }, 17907 endGroup: function CanvasGraphics_endGroup(group) { 17908 this.groupLevel--; 17909 var groupCtx = this.ctx; 17910 this.ctx = this.groupStack.pop(); 17911 17912 if (this.ctx.imageSmoothingEnabled !== undefined) { 17913 this.ctx.imageSmoothingEnabled = false; 17914 } else { 17915 this.ctx.mozImageSmoothingEnabled = false; 17916 } 17917 17918 if (group.smask) { 17919 this.tempSMask = this.smaskStack.pop(); 17920 } else { 17921 this.ctx.drawImage(groupCtx.canvas, 0, 0); 17922 } 17923 17924 this.restore(); 17925 }, 17926 beginAnnotations: function CanvasGraphics_beginAnnotations() { 17927 this.save(); 17928 17929 if (this.baseTransform) { 17930 this.ctx.setTransform.apply(this.ctx, this.baseTransform); 17931 } 17932 }, 17933 endAnnotations: function CanvasGraphics_endAnnotations() { 17934 this.restore(); 17935 }, 17936 beginAnnotation: function CanvasGraphics_beginAnnotation(rect, transform, matrix) { 17937 this.save(); 17938 resetCtxToDefault(this.ctx); 17939 this.current = new CanvasExtraState(); 17940 17941 if (Array.isArray(rect) && rect.length === 4) { 17942 var width = rect[2] - rect[0]; 17943 var height = rect[3] - rect[1]; 17944 this.ctx.rect(rect[0], rect[1], width, height); 17945 this.clip(); 17946 this.endPath(); 17947 } 17948 17949 this.transform.apply(this, transform); 17950 this.transform.apply(this, matrix); 17951 }, 17952 endAnnotation: function CanvasGraphics_endAnnotation() { 17953 this.restore(); 17954 }, 17955 paintJpegXObject: function CanvasGraphics_paintJpegXObject(objId, w, h) { 17956 const domImage = this.processingType3 ? this.commonObjs.get(objId) : this.objs.get(objId); 17957 17958 if (!domImage) { 17959 (0, _util.warn)("Dependent image isn't ready yet"); 17960 return; 17961 } 17962 17963 this.save(); 17964 var ctx = this.ctx; 17965 ctx.scale(1 / w, -1 / h); 17966 ctx.drawImage(domImage, 0, 0, domImage.width, domImage.height, 0, -h, w, h); 17967 17968 if (this.imageLayer) { 17969 var currentTransform = ctx.mozCurrentTransformInverse; 17970 var position = this.getCanvasPosition(0, 0); 17971 this.imageLayer.appendImage({ 17972 objId, 17973 left: position[0], 17974 top: position[1], 17975 width: w / currentTransform[0], 17976 height: h / currentTransform[3] 17977 }); 17978 } 17979
17980 this.restore(); 17981 }, 17982 paintImageMaskXObject: function CanvasGraphics_paintImageMaskXObject(img) { 17983 var ctx = this.ctx; 17984 var width = img.width, 17985 height = img.height; 17986 var fillColor = this.current.fillColor; 17987 var isPatternFill = this.current.patternFill; 17988 var glyph = this.processingType3; 17989 17990 if (COMPILE_TYPE3_GLYPHS && glyph && glyph.compiled === undefined) { 17991 if (width <= MAX_SIZE_TO_COMPILE && height <= MAX_SIZE_TO_COMPILE) { 17992 glyph.compiled = compileType3Glyph({ 17993 data: img.data, 17994 width, 17995 height 17996 }); 17997 } else { 17998 glyph.compiled = null; 17999 } 18000 } 18001 18002 if (glyph && glyph.compiled) { 18003 glyph.compiled(ctx); 18004 return; 18005 } 18006 18007 var maskCanvas = this.cachedCanvases.getCanvas("maskCanvas", width, height); 18008 var maskCtx = maskCanvas.context; 18009 maskCtx.save(); 18010 putBinaryImageMask(maskCtx, img); 18011 maskCtx.globalCompositeOperation = "source-in"; 18012 maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this) : fillColor; 18013 maskCtx.fillRect(0, 0, width, height); 18014 maskCtx.restore(); 18015 this.paintInlineImageXObject(maskCanvas.canvas); 18016 }, 18017 paintImageMaskXObjectRepeat: function CanvasGraphics_paintImageMaskXObjectRepeat(imgData, scaleX, scaleY, positions) { 18018 var width = imgData.width; 18019 var height = imgData.height; 18020 var fillColor = this.current.fillColor; 18021 var isPatternFill = this.current.patternFill; 18022 var maskCanvas = this.cachedCanvases.getCanvas("maskCanvas", width, height); 18023 var maskCtx = maskCanvas.context; 18024 maskCtx.save(); 18025 putBinaryImageMask(maskCtx, imgData); 18026 maskCtx.globalCompositeOperation = "source-in"; 18027 maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this) : fillColor; 18028 maskCtx.fillRect(0, 0, width, height); 18029 maskCtx.restore(); 18030 var ctx = this.ctx; 18031 18032 for (var i = 0, ii = positions.length; i < ii; i += 2) { 18033 ctx.save(); 18034 ctx.transform(scaleX, 0, 0, scaleY, positions[i], positions[i + 1]); 18035 ctx.scale(1, -1); 18036 ctx.drawImage(maskCanvas.canvas, 0, 0, width, height, 0, -1, 1, 1); 18037 ctx.restore(); 18038 } 18039 }, 18040 paintImageMaskXObjectGroup: function CanvasGraphics_paintImageMaskXObjectGroup(images) { 18041 var ctx = this.ctx; 18042 var fillColor = this.current.fillColor; 18043 var isPatternFill = this.current.patternFill; 18044 18045 for (var i = 0, ii = images.length; i < ii; i++) { 18046 var image = images[i]; 18047 var width = image.width, 18048 height = image.height; 18049 var maskCanvas = this.cachedCanvases.getCanvas("maskCanvas", width, height); 18050 var maskCtx = maskCanvas.context; 18051 maskCtx.save(); 18052 putBinaryImageMask(maskCtx, image); 18053 maskCtx.globalCompositeOperation = "source-in"; 18054 maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this) : fillColor; 18055 maskCtx.fillRect(0, 0, width, height); 18056 maskCtx.restore(); 18057 ctx.save(); 18058 ctx.transform.apply(ctx, image.transform); 18059 ctx.scale(1, -1); 18060 ctx.drawImage(maskCanvas.canvas, 0, 0, width, height, 0, -1, 1, 1); 18061 ctx.restore(); 18062 } 18063 }, 18064 paintImageXObject: function CanvasGraphics_paintImageXObject(objId) { 18065 const imgData = this.processingType3 ? this.commonObjs.get(objId) : this.objs.get(objId); 18066 18067 if (!imgData) { 18068 (0, _util.warn)("Dependent image isn't ready yet"); 18069 return; 18070 } 18071 18072 this.paintInlineImageXObject(imgData); 18073 }, 18074 paintImageXObjectRepeat: function CanvasGraphics_paintImageXObjectRepeat(objId, scaleX, scaleY, positions) { 18075 const imgData = this.processingType3 ? this.commonObjs.get(objId) : this.objs.get(objId); 18076 18077 if (!imgData) { 18078 (0, _util.warn)("Dependent image isn't ready yet"); 18079 return; 18080 } 18081 18082 var width = imgData.width; 18083 var height = imgData.height; 18084 var map = []; 18085 18086 for (var i = 0, ii = positions.length; i < ii; i += 2) { 18087 map.push({ 18088 transform: [scaleX, 0, 0, scaleY, positions[i], positions[i + 1]], 18089 x: 0, 18090 y: 0, 18091 w: width, 18092 h: height 18093 }); 18094 } 18095 18096 this.paintInlineImageXObjectGroup(imgData, map); 18097 }, 18098 paintInlineImageXObject: function CanvasGraphics_paintInlineImageXObject(imgData) { 18099 var width = imgData.width; 18100 var height = imgData.height; 18101 var ctx = this.ctx; 18102 this.save(); 18103 ctx.scale(1 / width, -1 / height); 18104 var currentTransform = ctx.mozCurrentTransformInverse; 18105 var a = currentTransform[0], 18106 b = currentTransform[1]; 18107 var widthScale = Math.max(Math.sqrt(a * a + b * b), 1); 18108 var c = currentTransform[2], 18109 d = currentTransform[3]; 18110 var heightScale = Math.max(Math.sqrt(c * c + d * d), 1); 18111 var imgToPaint, tmpCanvas; 18112 18113 if (typeof HTMLElement === "function" && imgData instanceof HTMLElement || !imgData.data) { 18114 imgToPaint = imgData; 18115 } else { 18116 tmpCanvas = this.cachedCanvases.getCanvas("inlineImage", width, height); 18117 var tmpCtx = tmpCanvas.context; 18118 putBinaryImageData(tmpCtx, imgData); 18119 imgToPaint = tmpCanvas.canvas; 18120 } 18121 18122 var paintWidth = width, 18123 paintHeight = height; 18124 var tmpCanvasId = "prescale1"; 18125 18126 while (widthScale > 2 && paintWidth > 1 || heightScale > 2 && paintHeight > 1) { 18127 var newWidth = paintWidth, 18128 newHeight = paintHeight; 18129 18130 if (widthScale > 2 && paintWidth > 1) { 18131 newWidth = Math.ceil(paintWidth / 2);
18132 widthScale /= paintWidth / newWidth; 18133 } 18134 18135 if (heightScale > 2 && paintHeight > 1) { 18136 newHeight = Math.ceil(paintHeight / 2); 18137 heightScale /= paintHeight / newHeight; 18138 } 18139 18140 tmpCanvas = this.cachedCanvases.getCanvas(tmpCanvasId, newWidth, newHeight); 18141 tmpCtx = tmpCanvas.context; 18142 tmpCtx.clearRect(0, 0, newWidth, newHeight); 18143 tmpCtx.drawImage(imgToPaint, 0, 0, paintWidth, paintHeight, 0, 0, newWidth, newHeight); 18144 imgToPaint = tmpCanvas.canvas; 18145 paintWidth = newWidth; 18146 paintHeight = newHeight; 18147 tmpCanvasId = tmpCanvasId === "prescale1" ? "prescale2" : "prescale1"; 18148 } 18149 18150 ctx.drawImage(imgToPaint, 0, 0, paintWidth, paintHeight, 0, -height, width, height); 18151 18152 if (this.imageLayer) { 18153 var position = this.getCanvasPosition(0, -height); 18154 this.imageLayer.appendImage({ 18155 imgData, 18156 left: position[0], 18157 top: position[1], 18158 width: width / currentTransform[0], 18159 height: height / currentTransform[3] 18160 }); 18161 } 18162 18163 this.restore(); 18164 }, 18165 paintInlineImageXObjectGroup: function CanvasGraphics_paintInlineImageXObjectGroup(imgData, map) { 18166 var ctx = this.ctx; 18167 var w = imgData.width; 18168 var h = imgData.height; 18169 var tmpCanvas = this.cachedCanvases.getCanvas("inlineImage", w, h); 18170 var tmpCtx = tmpCanvas.context; 18171 putBinaryImageData(tmpCtx, imgData); 18172 18173 for (var i = 0, ii = map.length; i < ii; i++) { 18174 var entry = map[i]; 18175 ctx.save(); 18176 ctx.transform.apply(ctx, entry.transform); 18177 ctx.scale(1, -1); 18178 ctx.drawImage(tmpCanvas.canvas, entry.x, entry.y, entry.w, entry.h, 0, -1, 1, 1); 18179 18180 if (this.imageLayer) { 18181 var position = this.getCanvasPosition(entry.x, entry.y); 18182 this.imageLayer.appendImage({ 18183 imgData, 18184 left: position[0], 18185 top: position[1], 18186 width: w, 18187 height: h 18188 }); 18189 } 18190 18191 ctx.restore(); 18192 } 18193 }, 18194 paintSolidColorImageMask: function CanvasGraphics_paintSolidColorImageMask() { 18195 this.ctx.fillRect(0, 0, 1, 1); 18196 }, 18197 paintXObject: function CanvasGraphics_paintXObject() { 18198 (0, _util.warn)("Unsupported 'paintXObject' command."); 18199 }, 18200 markPoint: function CanvasGraphics_markPoint(tag) {}, 18201 markPointProps: function CanvasGraphics_markPointProps(tag, properties) {}, 18202 beginMarkedContent: function CanvasGraphics_beginMarkedContent(tag) {}, 18203 beginMarkedContentProps: function CanvasGraphics_beginMarkedContentProps(tag, properties) {}, 18204 endMarkedContent: function CanvasGraphics_endMarkedContent() {}, 18205 beginCompat: function CanvasGraphics_beginCompat() {}, 18206 endCompat: function CanvasGraphics_endCompat() {}, 18207 consumePath: function CanvasGraphics_consumePath() { 18208 var ctx = this.ctx; 18209 18210 if (this.pendingClip) { 18211 if (this.pendingClip === EO_CLIP) { 18212 ctx.clip("evenodd"); 18213 } else { 18214 ctx.clip(); 18215 } 18216 18217 this.pendingClip = null; 18218 } 18219 18220 ctx.beginPath(); 18221 }, 18222 18223 getSinglePixelWidth(scale) { 18224 if (this._cachedGetSinglePixelWidth === null) { 18225 const inverse = this.ctx.mozCurrentTransformInverse; 18226 this._cachedGetSinglePixelWidth = Math.sqrt(Math.max(inverse[0] * inverse[0] + inverse[1] * inverse[1], inverse[2] * inverse[2] + inverse[3] * inverse[3])); 18227 } 18228 18229 return this._cachedGetSinglePixelWidth; 18230 }, 18231 18232 getCanvasPosition: function CanvasGraphics_getCanvasPosition(x, y) { 18233 var transform = this.ctx.mozCurrentTransform; 18234 return [transform[0] * x + transform[2] * y + transform[4], transform[1] * x + transform[3] * y + transform[5]]; 18235 } 18236 }; 18237 18238 for (var op in _util.OPS) { 18239 CanvasGraphics.prototype[_util.OPS[op]] = CanvasGraphics.prototype[op]; 18240 } 18241 18242 return CanvasGraphics; 18243}(); 18244 18245exports.CanvasGraphics = CanvasGraphics; 18246 18247/***/ }), 18248/* 9 */ 18249/***/ (function(module, exports, __w_pdfjs_require__) { 18250 18251"use strict"; 18252 18253 18254Object.defineProperty(exports, "__esModule", { 18255 value: true 18256}); 18257exports.getShadingPatternFromIR = getShadingPatternFromIR; 18258exports.TilingPattern = void 0; 18259 18260var _util = __w_pdfjs_require__(1); 18261 18262var ShadingIRs = {}; 18263 18264function applyBoundingBox(ctx, bbox) { 18265 if (!bbox || typeof Path2D === "undefined") { 18266 return; 18267 } 18268 18269 const width = bbox[2] - bbox[0]; 18270 const height = bbox[3] - bbox[1]; 18271 const region = new Path2D(); 18272 region.rect(bbox[0], bbox[1], width, height); 18273 ctx.clip(region); 18274} 18275 18276ShadingIRs.RadialAxial = { 18277 fromIR: function RadialAxial_fromIR(raw) { 18278 var type = raw[1]; 18279 var bbox = raw[2]; 18280 var colorStops = raw[3]; 18281 var p0 = raw[4]; 18282 var p1 = raw[5]; 18283 var r0 = raw[6]; 18284 var r1 = raw[7]; 18285 return { 18286 type: "Pattern", 18287 getPattern: function RadialAxial_getPattern(ctx) { 18288 applyBoundingBox(ctx, bbox); 18289 var grad; 18290 18291 if (type === "axial") { 18292 grad = ctx.createLinearGradient(p0[0], p0[1], p1[0], p1[1]); 18293 } else if (type === "radial") { 18294 grad = ctx.createRadialGradient(p0[0], p0[1], r0, p1[0], p1[1], r1); 18295 } 18296 18297 for (var i = 0, ii = colorStops.length; i < ii; ++i) { 18298 var c = colorStops[i];
18299 grad.addColorStop(c[0], c[1]); 18300 } 18301 18302 return grad; 18303 } 18304 }; 18305 } 18306}; 18307 18308var createMeshCanvas = function createMeshCanvasClosure() { 18309 function drawTriangle(data, context, p1, p2, p3, c1, c2, c3) { 18310 var coords = context.coords, 18311 colors = context.colors; 18312 var bytes = data.data, 18313 rowSize = data.width * 4; 18314 var tmp; 18315 18316 if (coords[p1 + 1] > coords[p2 + 1]) { 18317 tmp = p1; 18318 p1 = p2; 18319 p2 = tmp; 18320 tmp = c1; 18321 c1 = c2; 18322 c2 = tmp; 18323 } 18324 18325 if (coords[p2 + 1] > coords[p3 + 1]) { 18326 tmp = p2; 18327 p2 = p3; 18328 p3 = tmp; 18329 tmp = c2; 18330 c2 = c3; 18331 c3 = tmp; 18332 } 18333 18334 if (coords[p1 + 1] > coords[p2 + 1]) { 18335 tmp = p1; 18336 p1 = p2; 18337 p2 = tmp; 18338 tmp = c1; 18339 c1 = c2; 18340 c2 = tmp; 18341 } 18342 18343 var x1 = (coords[p1] + context.offsetX) * context.scaleX; 18344 var y1 = (coords[p1 + 1] + context.offsetY) * context.scaleY; 18345 var x2 = (coords[p2] + context.offsetX) * context.scaleX; 18346 var y2 = (coords[p2 + 1] + context.offsetY) * context.scaleY; 18347 var x3 = (coords[p3] + context.offsetX) * context.scaleX; 18348 var y3 = (coords[p3 + 1] + context.offsetY) * context.scaleY; 18349 18350 if (y1 >= y3) { 18351 return; 18352 } 18353 18354 var c1r = colors[c1], 18355 c1g = colors[c1 + 1], 18356 c1b = colors[c1 + 2]; 18357 var c2r = colors[c2], 18358 c2g = colors[c2 + 1], 18359 c2b = colors[c2 + 2]; 18360 var c3r = colors[c3], 18361 c3g = colors[c3 + 1], 18362 c3b = colors[c3 + 2]; 18363 var minY = Math.round(y1), 18364 maxY = Math.round(y3); 18365 var xa, car, cag, cab; 18366 var xb, cbr, cbg, cbb; 18367 18368 for (var y = minY; y <= maxY; y++) { 18369 if (y < y2) { 18370 let k; 18371 18372 if (y < y1) { 18373 k = 0; 18374 } else if (y1 === y2) { 18375 k = 1; 18376 } else { 18377 k = (y1 - y) / (y1 - y2); 18378 } 18379 18380 xa = x1 - (x1 - x2) * k; 18381 car = c1r - (c1r - c2r) * k; 18382 cag = c1g - (c1g - c2g) * k; 18383 cab = c1b - (c1b - c2b) * k; 18384 } else { 18385 let k; 18386 18387 if (y > y3) { 18388 k = 1; 18389 } else if (y2 === y3) { 18390 k = 0; 18391 } else { 18392 k = (y2 - y) / (y2 - y3); 18393 } 18394 18395 xa = x2 - (x2 - x3) * k; 18396 car = c2r - (c2r - c3r) * k; 18397 cag = c2g - (c2g - c3g) * k; 18398 cab = c2b - (c2b - c3b) * k; 18399 } 18400 18401 let k; 18402 18403 if (y < y1) { 18404 k = 0; 18405 } else if (y > y3) { 18406 k = 1; 18407 } else { 18408 k = (y1 - y) / (y1 - y3); 18409 } 18410 18411 xb = x1 - (x1 - x3) * k; 18412 cbr = c1r - (c1r - c3r) * k; 18413 cbg = c1g - (c1g - c3g) * k; 18414 cbb = c1b - (c1b - c3b) * k; 18415 var x1_ = Math.round(Math.min(xa, xb)); 18416 var x2_ = Math.round(Math.max(xa, xb)); 18417 var j = rowSize * y + x1_ * 4; 18418 18419 for (var x = x1_; x <= x2_; x++) { 18420 let k = (xa - x) / (xa - xb); 18421 18422 if (k < 0) { 18423 k = 0; 18424 } else if (k > 1) { 18425 k = 1; 18426 } 18427 18428 bytes[j++] = car - (car - cbr) * k | 0; 18429 bytes[j++] = cag - (cag - cbg) * k | 0; 18430 bytes[j++] = cab - (cab - cbb) * k | 0; 18431 bytes[j++] = 255; 18432 } 18433 } 18434 } 18435 18436 function drawFigure(data, figure, context) { 18437 var ps = figure.coords; 18438 var cs = figure.colors; 18439 var i, ii; 18440 18441 switch (figure.type) { 18442 case "lattice": 18443 var verticesPerRow = figure.verticesPerRow; 18444 var rows = Math.floor(ps.length / verticesPerRow) - 1; 18445 var cols = verticesPerRow - 1; 18446 18447 for (i = 0; i < rows; i++) { 18448 var q = i * verticesPerRow; 18449 18450 for (var j = 0; j < cols; j++, q++) { 18451 drawTriangle(data, context, ps[q], ps[q + 1], ps[q + verticesPerRow], cs[q], cs[q + 1], cs[q + verticesPerRow]); 18452 drawTriangle(data, context, ps[q + verticesPerRow + 1], ps[q + 1], ps[q + verticesPerRow], cs[q + verticesPerRow + 1], cs[q + 1], cs[q + verticesPerRow]); 18453 } 18454 } 18455 18456 break; 18457 18458 case "triangles": 18459 for (i = 0, ii = ps.length; i < ii; i += 3) { 18460 drawTriangle(data, context, ps[i], ps[i + 1], ps[i + 2], cs[i], cs[i + 1], cs[i + 2]); 18461 } 18462 18463 break; 18464 18465 default: 18466 throw new Error("illegal figure"); 18467 } 18468 } 18469 18470 function createMeshCanvas(bounds, combinesScale, coords, colors, figures, backgroundColor, cachedCanvases, webGLContext) { 18471 var EXPECTED_SCALE = 1.1; 18472 var MAX_PATTERN_SIZE = 3000; 18473 var BORDER_SIZE = 2; 18474 var offsetX = Math.floor(bounds[0]); 18475 var offsetY = Math.floor(bounds[1]); 18476 var boundsWidth = Math.ceil(bounds[2]) - offsetX;
18477 var boundsHeight = Math.ceil(bounds[3]) - offsetY; 18478 var width = Math.min(Math.ceil(Math.abs(boundsWidth * combinesScale[0] * EXPECTED_SCALE)), MAX_PATTERN_SIZE); 18479 var height = Math.min(Math.ceil(Math.abs(boundsHeight * combinesScale[1] * EXPECTED_SCALE)), MAX_PATTERN_SIZE); 18480 var scaleX = boundsWidth / width; 18481 var scaleY = boundsHeight / height; 18482 var context = { 18483 coords, 18484 colors, 18485 offsetX: -offsetX, 18486 offsetY: -offsetY, 18487 scaleX: 1 / scaleX, 18488 scaleY: 1 / scaleY 18489 }; 18490 var paddedWidth = width + BORDER_SIZE * 2; 18491 var paddedHeight = height + BORDER_SIZE * 2; 18492 var canvas, tmpCanvas, i, ii; 18493 18494 if (webGLContext.isEnabled) { 18495 canvas = webGLContext.drawFigures({ 18496 width, 18497 height, 18498 backgroundColor, 18499 figures, 18500 context 18501 }); 18502 tmpCanvas = cachedCanvases.getCanvas("mesh", paddedWidth, paddedHeight, false); 18503 tmpCanvas.context.drawImage(canvas, BORDER_SIZE, BORDER_SIZE); 18504 canvas = tmpCanvas.canvas; 18505 } else { 18506 tmpCanvas = cachedCanvases.getCanvas("mesh", paddedWidth, paddedHeight, false); 18507 var tmpCtx = tmpCanvas.context; 18508 var data = tmpCtx.createImageData(width, height); 18509 18510 if (backgroundColor) { 18511 var bytes = data.data; 18512 18513 for (i = 0, ii = bytes.length; i < ii; i += 4) { 18514 bytes[i] = backgroundColor[0]; 18515 bytes[i + 1] = backgroundColor[1]; 18516 bytes[i + 2] = backgroundColor[2]; 18517 bytes[i + 3] = 255; 18518 } 18519 } 18520 18521 for (i = 0; i < figures.length; i++) { 18522 drawFigure(data, figures[i], context); 18523 } 18524 18525 tmpCtx.putImageData(data, BORDER_SIZE, BORDER_SIZE); 18526 canvas = tmpCanvas.canvas; 18527 } 18528 18529 return { 18530 canvas, 18531 offsetX: offsetX - BORDER_SIZE * scaleX, 18532 offsetY: offsetY - BORDER_SIZE * scaleY, 18533 scaleX, 18534 scaleY 18535 }; 18536 } 18537 18538 return createMeshCanvas; 18539}(); 18540 18541ShadingIRs.Mesh = { 18542 fromIR: function Mesh_fromIR(raw) { 18543 var coords = raw[2]; 18544 var colors = raw[3]; 18545 var figures = raw[4]; 18546 var bounds = raw[5]; 18547 var matrix = raw[6]; 18548 var bbox = raw[7]; 18549 var background = raw[8]; 18550 return { 18551 type: "Pattern", 18552 getPattern: function Mesh_getPattern(ctx, owner, shadingFill) { 18553 applyBoundingBox(ctx, bbox); 18554 var scale; 18555 18556 if (shadingFill) { 18557 scale = _util.Util.singularValueDecompose2dScale(ctx.mozCurrentTransform); 18558 } else { 18559 scale = _util.Util.singularValueDecompose2dScale(owner.baseTransform); 18560 18561 if (matrix) { 18562 var matrixScale = _util.Util.singularValueDecompose2dScale(matrix); 18563 18564 scale = [scale[0] * matrixScale[0], scale[1] * matrixScale[1]]; 18565 } 18566 } 18567 18568 var temporaryPatternCanvas = createMeshCanvas(bounds, scale, coords, colors, figures, shadingFill ? null : background, owner.cachedCanvases, owner.webGLContext); 18569 18570 if (!shadingFill) { 18571 ctx.setTransform.apply(ctx, owner.baseTransform); 18572 18573 if (matrix) { 18574 ctx.transform.apply(ctx, matrix); 18575 } 18576 } 18577 18578 ctx.translate(temporaryPatternCanvas.offsetX, temporaryPatternCanvas.offsetY); 18579 ctx.scale(temporaryPatternCanvas.scaleX, temporaryPatternCanvas.scaleY); 18580 return ctx.createPattern(temporaryPatternCanvas.canvas, "no-repeat"); 18581 } 18582 }; 18583 } 18584}; 18585ShadingIRs.Dummy = { 18586 fromIR: function Dummy_fromIR() { 18587 return { 18588 type: "Pattern", 18589 getPattern: function Dummy_fromIR_getPattern() { 18590 return "hotpink"; 18591 } 18592 }; 18593 } 18594}; 18595 18596function getShadingPatternFromIR(raw) { 18597 var shadingIR = ShadingIRs[raw[0]]; 18598 18599 if (!shadingIR) { 18600 throw new Error(`Unknown IR type: ${raw[0]}`); 18601 } 18602 18603 return shadingIR.fromIR(raw); 18604} 18605 18606var TilingPattern = function TilingPatternClosure() { 18607 var PaintType = { 18608 COLORED: 1, 18609 UNCOLORED: 2 18610 }; 18611 var MAX_PATTERN_SIZE = 3000; 18612 18613 function TilingPattern(IR, color, ctx, canvasGraphicsFactory, baseTransform) { 18614 this.operatorList = IR[2]; 18615 this.matrix = IR[3] || [1, 0, 0, 1, 0, 0]; 18616 this.bbox = IR[4]; 18617 this.xstep = IR[5]; 18618 this.ystep = IR[6]; 18619 this.paintType = IR[7]; 18620 this.tilingType = IR[8]; 18621 this.color = color; 18622 this.canvasGraphicsFactory = canvasGraphicsFactory; 18623 this.baseTransform = baseTransform; 18624 this.type = "Pattern"; 18625 this.ctx = ctx; 18626 } 18627 18628 TilingPattern.prototype = { 18629 createPatternCanvas: function TilinPattern_createPatternCanvas(owner) { 18630 var operatorList = this.operatorList; 18631 var bbox = this.bbox; 18632 var xstep = this.xstep; 18633 var ystep = this.ystep; 18634 var paintType = this.paintType; 18635 var tilingType = this.tilingType; 18636 var color = this.color; 18637 var canvasGraphicsFactory = this.canvasGraphicsFactory; 18638 (0, _util.info)("TilingType: " + tilingType); 18639 var x0 = bbox[0], 18640 y0 = bbox[1], 18641 x1 = bbox[2], 18642 y1 = bbox[3]; 18643 18644 var matrixScale = _util.Util.singularValueDecompose2dScale(this.matrix
18644); 18645 18646 var curMatrixScale = _util.Util.singularValueDecompose2dScale(this.baseTransform); 18647 18648 var combinedScale = [matrixScale[0] * curMatrixScale[0], matrixScale[1] * curMatrixScale[1]]; 18649 var dimx = this.getSizeAndScale(xstep, this.ctx.canvas.width, combinedScale[0]); 18650 var dimy = this.getSizeAndScale(ystep, this.ctx.canvas.height, combinedScale[1]); 18651 var tmpCanvas = owner.cachedCanvases.getCanvas("pattern", dimx.size, dimy.size, true); 18652 var tmpCtx = tmpCanvas.context; 18653 var graphics = canvasGraphicsFactory.createCanvasGraphics(tmpCtx); 18654 graphics.groupLevel = owner.groupLevel; 18655 this.setFillAndStrokeStyleToContext(graphics, paintType, color); 18656 graphics.transform(dimx.scale, 0, 0, dimy.scale, 0, 0); 18657 graphics.transform(1, 0, 0, 1, -x0, -y0); 18658 this.clipBbox(graphics, bbox, x0, y0, x1, y1); 18659 graphics.executeOperatorList(operatorList); 18660 this.ctx.transform(1, 0, 0, 1, x0, y0); 18661 this.ctx.scale(1 / dimx.scale, 1 / dimy.scale); 18662 return tmpCanvas.canvas; 18663 }, 18664 getSizeAndScale: function TilingPattern_getSizeAndScale(step, realOutputSize, scale) { 18665 step = Math.abs(step); 18666 var maxSize = Math.max(MAX_PATTERN_SIZE, realOutputSize); 18667 var size = Math.ceil(step * scale); 18668 18669 if (size >= maxSize) { 18670 size = maxSize; 18671 } else { 18672 scale = size / step; 18673 } 18674 18675 return { 18676 scale, 18677 size 18678 }; 18679 }, 18680 clipBbox: function clipBbox(graphics, bbox, x0, y0, x1, y1) { 18681 if (Array.isArray(bbox) && bbox.length === 4) { 18682 var bboxWidth = x1 - x0; 18683 var bboxHeight = y1 - y0; 18684 graphics.ctx.rect(x0, y0, bboxWidth, bboxHeight); 18685 graphics.clip(); 18686 graphics.endPath(); 18687 } 18688 }, 18689 setFillAndStrokeStyleToContext: function setFillAndStrokeStyleToContext(graphics, paintType, color) { 18690 const context = graphics.ctx, 18691 current = graphics.current; 18692 18693 switch (paintType) { 18694 case PaintType.COLORED: 18695 var ctx = this.ctx; 18696 context.fillStyle = ctx.fillStyle; 18697 context.strokeStyle = ctx.strokeStyle; 18698 current.fillColor = ctx.fillStyle; 18699 current.strokeColor = ctx.strokeStyle; 18700 break; 18701 18702 case PaintType.UNCOLORED: 18703 var cssColor = _util.Util.makeCssRgb(color[0], color[1], color[2]); 18704 18705 context.fillStyle = cssColor; 18706 context.strokeStyle = cssColor; 18707 current.fillColor = cssColor; 18708 current.strokeColor = cssColor; 18709 break; 18710 18711 default: 18712 throw new _util.FormatError(`Unsupported paint type: ${paintType}`); 18713 } 18714 }, 18715 getPattern: function TilingPattern_getPattern(ctx, owner) { 18716 ctx = this.ctx; 18717 ctx.setTransform.apply(ctx, this.baseTransform); 18718 ctx.transform.apply(ctx, this.matrix); 18719 var temporaryPatternCanvas = this.createPatternCanvas(owner); 18720 return ctx.createPattern(temporaryPatternCanvas, "repeat"); 18721 } 18722 }; 18723 return TilingPattern; 18724}(); 18725 18726exports.TilingPattern = TilingPattern; 18727 18728/***/ }), 18729/* 10 */ 18730/***/ (function(module, exports, __w_pdfjs_require__) { 18731 18732"use strict"; 18733 18734 18735Object.defineProperty(exports, "__esModule", { 18736 value: true 18737}); 18738exports.GlobalWorkerOptions = void 0; 18739const GlobalWorkerOptions = Object.create(null); 18740exports.GlobalWorkerOptions = GlobalWorkerOptions; 18741GlobalWorkerOptions.workerPort = GlobalWorkerOptions.workerPort === undefined ? null : GlobalWorkerOptions.workerPort; 18742GlobalWorkerOptions.workerSrc = GlobalWorkerOptions.workerSrc === undefined ? "" : GlobalWorkerOptions.workerSrc; 18743 18744/***/ }), 18745/* 11 */ 18746/***/ (function(module, exports, __w_pdfjs_require__) { 18747 18748"use strict"; 18749 18750 18751Object.defineProperty(exports, "__esModule", { 18752 value: true 18753}); 18754exports.MessageHandler = void 0; 18755 18756var _util = __w_pdfjs_require__(1); 18757 18758const CallbackKind = { 18759 UNKNOWN: 0, 18760 DATA: 1, 18761 ERROR: 2 18762}; 18763const StreamKind = { 18764 UNKNOWN: 0, 18765 CANCEL: 1, 18766 CANCEL_COMPLETE: 2, 18767 CLOSE: 3, 18768 ENQUEUE: 4, 18769 ERROR: 5, 18770 PULL: 6, 18771 PULL_COMPLETE: 7, 18772 START_COMPLETE: 8 18773}; 18774 18775function wrapReason(reason) { 18776 if (typeof reason !== "object" || reason === null) { 18777 return reason; 18778 } 18779 18780 switch (reason.name) { 18781 case "AbortException": 18782 return new _util.AbortException(reason.message); 18783 18784 case "MissingPDFException": 18785 return new _util.MissingPDFException(reason.message); 18786 18787 case "UnexpectedResponseException": 18788 return new _util.UnexpectedResponseException(reason.message, reason.status); 18789 18790 case "UnknownErrorException": 18791 return new _util.UnknownErrorException(reason.message, reason.details); 18792 18793 default: 18794 return new _util.UnknownErrorException(reason.message, reason.toString()); 18795 } 18796} 18797 18798class MessageHandler {
18799 constructor(sourceName, targetName, comObj) { 18800 this.sourceName = sourceName; 18801 this.targetName = targetName; 18802 this.comObj = comObj; 18803 this.callbackId = 1; 18804 this.streamId = 1; 18805 this.postMessageTransfers = true; 18806 this.streamSinks = Object.create(null); 18807 this.streamControllers = Object.create(null); 18808 this.callbackCapabilities = Object.create(null); 18809 this.actionHandler = Object.create(null); 18810 18811 this._onComObjOnMessage = event => { 18812 const data = event.data; 18813 18814 if (data.targetName !== this.sourceName) { 18815 return; 18816 } 18817 18818 if (data.stream) { 18819 this._processStreamMessage(data); 18820 18821 return; 18822 } 18823 18824 if (data.callback) { 18825 const callbackId = data.callbackId; 18826 const capability = this.callbackCapabilities[callbackId]; 18827 18828 if (!capability) { 18829 throw new Error(`Cannot resolve callback ${callbackId}`); 18830 } 18831 18832 delete this.callbackCapabilities[callbackId]; 18833 18834 if (data.callback === CallbackKind.DATA) { 18835 capability.resolve(data.data); 18836 } else if (data.callback === CallbackKind.ERROR) { 18837 capability.reject(wrapReason(data.reason)); 18838 } else { 18839 throw new Error("Unexpected callback case"); 18840 } 18841 18842 return; 18843 } 18844 18845 const action = this.actionHandler[data.action]; 18846 18847 if (!action) { 18848 throw new Error(`Unknown action from worker: ${data.action}`); 18849 } 18850 18851 if (data.callbackId) { 18852 const sourceName = this.sourceName; 18853 const targetName = data.sourceName; 18854 new Promise(function (resolve) { 18855 resolve(action(data.data)); 18856 }).then(function (result) { 18857 comObj.postMessage({ 18858 sourceName, 18859 targetName, 18860 callback: CallbackKind.DATA, 18861 callbackId: data.callbackId, 18862 data: result 18863 }); 18864 }, function (reason) { 18865 comObj.postMessage({ 18866 sourceName, 18867 targetName, 18868 callback: CallbackKind.ERROR, 18869 callbackId: data.callbackId, 18870 reason: wrapReason(reason) 18871 }); 18872 }); 18873 return; 18874 } 18875 18876 if (data.streamId) { 18877 this._createStreamSink(data); 18878 18879 return; 18880 } 18881 18882 action(data.data); 18883 }; 18884 18885 comObj.addEventListener("message", this._onComObjOnMessage); 18886 } 18887 18888 on(actionName, handler) { 18889 const ah = this.actionHandler; 18890 18891 if (ah[actionName]) { 18892 throw new Error(`There is already an actionName called "${actionName}"`); 18893 } 18894 18895 ah[actionName] = handler; 18896 } 18897 18898 send(actionName, data, transfers) { 18899 this._postMessage({ 18900 sourceName: this.sourceName, 18901 targetName: this.targetName, 18902 action: actionName, 18903 data 18904 }, transfers); 18905 } 18906 18907 sendWithPromise(actionName, data, transfers) { 18908 const callbackId = this.callbackId++; 18909 const capability = (0, _util.createPromiseCapability)(); 18910 this.callbackCapabilities[callbackId] = capability; 18911 18912 try { 18913 this._postMessage({ 18914 sourceName: this.sourceName, 18915 targetName: this.targetName, 18916 action: actionName, 18917 callbackId, 18918 data 18919 }, transfers); 18920 } catch (ex) { 18921 capability.reject(ex); 18922 } 18923 18924 return capability.promise; 18925 } 18926 18927 sendWithStream(actionName, data, queueingStrategy, transfers) { 18928 const streamId = this.streamId++; 18929 const sourceName = this.sourceName; 18930 const targetName = this.targetName; 18931 const comObj = this.comObj; 18932 return new ReadableStream({ 18933 start: controller => { 18934 const startCapability = (0, _util.createPromiseCapability)(); 18935 this.streamControllers[streamId] = { 18936 controller, 18937 startCall: startCapability, 18938 pullCall: null, 18939 cancelCall: null, 18940 isClosed: false 18941 }; 18942 18943 this._postMessage({ 18944 sourceName, 18945 targetName, 18946 action: actionName, 18947 streamId, 18948 data, 18949 desiredSize: controller.desiredSize 18950 }, transfers); 18951 18952 return startCapability.promise; 18953 }, 18954 pull: controller => { 18955 const pullCapability = (0, _util.createPromiseCapability)(); 18956 this.streamControllers[streamId].pullCall = pullCapability; 18957 comObj.postMessage({ 18958 sourceName, 18959 targetName, 18960 stream: StreamKind.PULL, 18961 streamId, 18962 desiredSize: controller.desiredSize 18963 }); 18964 return pullCapability.promise; 18965 }, 18966 cancel: reason => { 18967 (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason"); 18968 const cancelCapability = (0, _util.createPromiseCapability)(); 18969 this.streamControllers[streamId].cancelCall = cancelCapability; 18970 this.streamControllers[streamId].isClosed = true; 18971 comObj.postMessage({ 18972 sourceName, 18973 targetName, 18974 stream: StreamKind.CANCEL, 18975 streamId, 18976 reason: wrapReason(reason) 18977 }); 18978 return cancelCapability.promise; 18979 } 18980 }, queueingStrategy); 18981 } 18982 18983 _createStreamSink(data) { 18984 const self = this; 18985 const action = this.actionHandler[data.action]; 18986 const streamId = data.streamId; 18987 const sourceName = this.sourceName; 18988 const targetName = data.sourceName; 18989 const comObj = this.comObj; 18990 const streamSink = { 18991 enqueue(chunk, size = 1, transfers) { 18992 if (this.isCancelled) { 18993 return; 18994 } 18995 18996 const lastDesiredSize = this.desiredSize; 18997 this.desiredSize -= size; 18998 18999 if (lastDesiredSize > 0 && this.desiredSize <= 0) { 19000 this.sinkCapability = (0, _util.createPromiseCapability)(); 19001 this.ready = this.sinkCapability.promise; 19002 } 19003 19004 self._postMessage({ 19005 sourceName, 19006 targetName, 19007 stream: StreamKind.ENQUEUE, 19008 streamId, 19009 chunk 19010 }, transfers); 19011 }, 19012 19013 close() { 19014 if (this.isCancelled) { 19015 return; 19016 } 19017 19018 this.isCancelled = true; 19019 comObj.postMessage({ 19020 sourceName, 19021 targetName, 19022 stream: StreamKind.CLOSE, 19023 streamId 19024 }); 19025 delete self.streamSinks[streamId]; 19026 }, 19027 19028 error(reason) { 19029 (0, _util.assert)(reason instanceof Error, "error must have a valid reason"); 19030 19031 if (this.isCancelled) { 19032 return; 19033 } 19034 19035 this.isCancelled = true; 19036 comObj.postMessage({ 19037 sourceName, 19038 targetName, 19039 stream: StreamKind.ERROR, 19040 streamId, 19041 reason: wrapReason(reason) 19042 }); 19043 }, 19044 19045 sinkCapability: (0, _util.createPromiseCapability)(), 19046 onPull: null, 19047 onCancel: null, 19048 isCancelled: false, 19049 desiredSize: data.desiredSize, 19050 ready: null 19051 }; 19052 streamSink.sinkCapability.resolve(); 19053 streamSink.ready = streamSink.sinkCapability.promise; 19054 this.streamSinks[streamId] = streamSink; 19055 new Promise(function (resolve) { 19056 resolve(action(data.data, streamSink)); 19057 }).then(function () { 19058 comObj.postMessage({ 19059 sourceName, 19060 targetName, 19061 stream: StreamKind.START_COMPLETE, 19062 streamId, 19063 success: true 19064 }); 19065 }, function (reason) { 19066 comObj.postMessage({ 19067 sourceName, 19068 targetName, 19069 stream: StreamKind.START_COMPLETE, 19070 streamId, 19071 reason: wrapReason(reason) 19072 }); 19073 }); 19074 } 19075 19076 _processStreamMessage(data) { 19077 const streamId = data.streamId; 19078 const sourceName = this.sourceName; 19079 const targetName = data.sourceName; 19080 const comObj = this.comObj; 19081 19082 switch (data.stream) { 19083 case StreamKind.START_COMPLETE: 19084 if (data.success) { 19085 this.streamControllers[streamId].startCall.resolve(); 19086 } else { 19087 this.streamControllers[streamId].startCall.reject(wrapReason(data.reason)); 19088 } 19089 19090 break; 19091 19092 case StreamKind.PULL_COMPLETE: 19093 if (data.success) { 19094 this.streamControllers[streamId].pullCall.resolve(); 19095 } else { 19096 this.streamControllers[streamId].pullCall.reject(wrapReason(data.reason)); 19097 } 19098 19099 break; 19100 19101 case StreamKind.PULL: 19102 if (!this.streamSinks[streamId]) { 19103 comObj.postMessage({ 19104 sourceName, 19105 targetName, 19106 stream: StreamKind.PULL_COMPLETE, 19107 streamId, 19108 success: true 19109 }); 19110 break; 19111 } 19112 19113 if (this.streamSinks[streamId].desiredSize <= 0 && data.desiredSize > 0) { 19114 this.streamSinks[streamId].sinkCapability.resolve(); 19115 } 19116 19117 this.streamSinks[streamId].desiredSize = data.desiredSize; 19118 const { 19119 onPull 19120 } = this.streamSinks[data.streamId]; 19121 new Promise(function (resolve) { 19122 resolve(onPull && onPull()); 19123 }).then(function () { 19124 comObj.postMessage({ 19125 sourceName, 19126 targetName, 19127 stream: StreamKind.PULL_COMPLETE, 19128 streamId, 19129 success: true 19130 }); 19131 }, function (reason) { 19132 comObj.postMessage({ 19133 sourceName, 19134 targetName, 19135 stream: StreamKind.PULL_COMPLETE, 19136 streamId, 19137 reason: wrapReason(reason) 19138 }); 19139 }); 19140 break; 19141 19142 case StreamKind.ENQUEUE: 19143 (0, _util.assert)(this.streamControllers[streamId], "enqueue should have stream controller"); 19144 19145 if (this.streamControllers[streamId].isClosed) { 19146 break; 19147 } 19148 19149 this.streamControllers[streamId].controller.enqueue(data.chunk); 19150 break; 19151 19152 case StreamKind.CLOSE: 19153 (0, _util.assert)(this.streamControllers[streamId], "close should have stream controller"); 19154 19155 if (this.streamControllers[streamId].isClosed) { 19156 break; 19157 } 19158 19159 this.streamControllers[streamId].isClosed = true; 19160 this.streamControllers[streamId].controller.close(); 19161 19162 this._deleteStreamController(streamId); 19163 19164 break; 19165 19166 case StreamKind.ERROR: 19167 (0, _util.assert)(this.streamControllers[streamId], "error should have stream controller"); 19168 this.streamControllers[streamId].controller.error(wrapReason(data.reason)); 19169 19170 this._deleteStreamController(streamId); 19171 19172 break; 19173 19174 case StreamKind.CANCEL_COMPLETE: 19175 if (data.success) { 19176 this.streamControllers[streamId].cancelCall.resolve(); 19177 } else { 19178 this.streamControllers[streamId].cancelCall.reject(wrapReason(data.reason)); 19179 } 19180 19181 this._deleteStreamController(streamId); 19182 19183 break; 19184 19185 case StreamKind.CANCEL: 19186 if (!this.streamSinks[streamId]) { 19187 break; 19188 } 19189 19190 const { 19191 onCancel 19192 } = this.streamSinks[data.streamId]; 19193 new Promise(function (resolve) { 19194 resolve(onCancel && onCancel(wrapReason(data.reason))); 19195 }).then(function () { 19196 comObj.postMessage({ 19197 sourceName, 19198 targetName, 19199 stream: StreamKind.CANCEL_COMPLETE, 19200 streamId, 19201 success: true 19202 }); 19203 }, function (reason) { 19204 comObj.postMessage({ 19205 sourceName, 19206 targetName, 19207 stream: StreamKind.CANCEL_COMPLETE, 19208 streamId, 19209 reason: wrapReason(reason) 19210 }); 19211 }); 19212 this.streamSinks[streamId].sinkCapability.reject(wrapReason(data.reason)); 19213 this.streamSinks[streamId].isCancelled = true; 19214 delete this.streamSinks[streamId]; 19215 break; 19216 19217 default: 19218 throw new Error("Unexpected stream case"); 19219 } 19220 } 19221 19222 async _deleteStreamController(streamId) { 19223 await Promise.allSettled([this.streamControllers[streamId].startCall, this.streamControllers[streamId].pullCall, this.streamControllers[streamId].cancelCall].map(function (capability) { 19224 return capability && capability.promise; 19225 })); 19226 delete this.streamControllers[streamId]; 19227 } 19228 19229 _postMessage(message, transfers) { 19230 if (transfers && this.postMessageTransfers) { 19231 this.comObj.postMessage(message, transfers); 19232 } else { 19233 this.comObj.postMessage(message); 19234 } 19235 } 19236 19237 destroy() { 19238 this.comObj.removeEventListener("message", this._onComObjOnMessage); 19239 } 19240 19241} 19242 19243exports.MessageHandler = MessageHandler; 19244 19245/***/ }), 19246/* 12 */ 19247/***/ (function(module, exports, __w_pdfjs_require__) { 19248 19249"use strict"; 19250 19251 19252Object.defineProperty(exports, "__esModule", { 19253 value: true 19254}); 19255exports.Metadata = void 0; 19256 19257var _util = __w_pdfjs_require__(1); 19258 19259var _xml_parser = __w_pdfjs_require__(13); 19260 19261class Metadata { 19262 constructor(data) { 19263 (0, _util.assert)(typeof data === "string", "Metadata: input is not a string"); 19264 data = this._repair(data); 19265 const parser = new _xml_parser.SimpleXMLParser(); 19266 const xmlDocument = parser.parseFromString(data); 19267 this._metadataMap = new Map(); 19268 19269 if (xmlDocument) { 19270 this._parse(xmlDocument); 19271 } 19272 } 19273 19274 _repair(data) { 19275 return data.replace(/^[^<]+/, "").replace(/>\\376\\377([^<]+)/g, function (all, codes) { 19276 const bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) { 19277 return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1); 19278 }).replace(/&(amp|apos|gt|lt|quot);/g, function (str, name) { 19279 switch (name) { 19280 case "amp": 19281 return "&"; 19282 19283 case "apos": 19284 return "'"; 19285 19286 case "gt": 19287 return ">"; 19288 19289 case "lt": 19290 return "<"; 19291 19292 case "quot": 19293 return '"'; 19294 } 19295 19296 throw new Error(`_repair: ${name} isn't defined.`); 19297 }); 19298 let chars = ""; 19299 19300 for (let i = 0, ii = bytes.length; i < ii; i += 2) {
vendor: 6,595 bytes, lines 19301-19595
19301 const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1); 19302 19303 if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) { 19304 chars += String.fromCharCode(code); 19305 } else { 19306 chars += "&#x" + (0x10000 + code).toString(16).substring(1) + ";"; 19307 } 19308 } 19309 19310 return ">" + chars; 19311 }); 19312 } 19313 19314 _parse(xmlDocument) { 19315 let rdf = xmlDocument.documentElement; 19316 19317 if (rdf.nodeName.toLowerCase() !== "rdf:rdf") { 19318 rdf = rdf.firstChild; 19319 19320 while (rdf && rdf.nodeName.toLowerCase() !== "rdf:rdf") { 19321 rdf = rdf.nextSibling; 19322 } 19323 } 19324 19325 const nodeName = rdf ? rdf.nodeName.toLowerCase() : null; 19326 19327 if (!rdf || nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) { 19328 return; 19329 } 19330 19331 const children = rdf.childNodes; 19332 19333 for (let i = 0, ii = children.length; i < ii; i++) { 19334 const desc = children[i]; 19335 19336 if (desc.nodeName.toLowerCase() !== "rdf:description") { 19337 continue; 19338 } 19339 19340 for (let j = 0, jj = desc.childNodes.length; j < jj; j++) { 19341 if (desc.childNodes[j].nodeName.toLowerCase() !== "#text") { 19342 const entry = desc.childNodes[j]; 19343 const name = entry.nodeName.toLowerCase(); 19344 19345 this._metadataMap.set(name, entry.textContent.trim()); 19346 } 19347 } 19348 } 19349 } 19350 19351 get(name) { 19352 return this._metadataMap.has(name) ? this._metadataMap.get(name) : null; 19353 } 19354 19355 getAll() { 19356 const obj = Object.create(null); 19357 19358 for (const [key, value] of this._metadataMap) { 19359 obj[key] = value; 19360 } 19361 19362 return obj; 19363 } 19364 19365 has(name) { 19366 return this._metadataMap.has(name); 19367 } 19368 19369} 19370 19371exports.Metadata = Metadata; 19372 19373/***/ }), 19374/* 13 */ 19375/***/ (function(module, exports, __w_pdfjs_require__) { 19376 19377"use strict"; 19378 19379 19380Object.defineProperty(exports, "__esModule", { 19381 value: true 19382}); 19383exports.SimpleXMLParser = void 0; 19384const XMLParserErrorCode = { 19385 NoError: 0, 19386 EndOfDocument: -1, 19387 UnterminatedCdat: -2, 19388 UnterminatedXmlDeclaration: -3, 19389 UnterminatedDoctypeDeclaration: -4, 19390 UnterminatedComment: -5, 19391 MalformedElement: -6, 19392 OutOfMemory: -7, 19393 UnterminatedAttributeValue: -8, 19394 UnterminatedElement: -9, 19395 ElementNeverBegun: -10 19396}; 19397 19398function isWhitespace(s, index) { 19399 const ch = s[index]; 19400 return ch === " " || ch === "\n" || ch === "\r" || ch === "\t"; 19401} 19402 19403function isWhitespaceString(s) { 19404 for (let i = 0, ii = s.length; i < ii; i++) { 19405 if (!isWhitespace(s, i)) { 19406 return false; 19407 } 19408 } 19409 19410 return true; 19411} 19412 19413class XMLParserBase { 19414 _resolveEntities(s) { 19415 return s.replace(/&([^;]+);/g, (all, entity) => { 19416 if (entity.substring(0, 2) === "#x") { 19417 return String.fromCharCode(parseInt(entity.substring(2), 16)); 19418 } else if (entity.substring(0, 1) === "#") { 19419 return String.fromCharCode(parseInt(entity.substring(1), 10)); 19420 } 19421 19422 switch (entity) { 19423 case "lt": 19424 return "<"; 19425 19426 case "gt": 19427 return ">"; 19428 19429 case "amp": 19430 return "&"; 19431 19432 case "quot": 19433 return '"'; 19434 } 19435 19436 return this.onResolveEntity(entity); 19437 }); 19438 } 19439 19440 _parseContent(s, start) { 19441 const attributes = []; 19442 let pos = start; 19443 19444 function skipWs() { 19445 while (pos < s.length && isWhitespace(s, pos)) { 19446 ++pos; 19447 } 19448 } 19449 19450 while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") { 19451 ++pos; 19452 } 19453 19454 const name = s.substring(start, pos); 19455 skipWs(); 19456 19457 while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") { 19458 skipWs(); 19459 let attrName = "", 19460 attrValue = ""; 19461 19462 while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") { 19463 attrName += s[pos]; 19464 ++pos; 19465 } 19466 19467 skipWs(); 19468 19469 if (s[pos] !== "=") { 19470 return null; 19471 } 19472 19473 ++pos; 19474 skipWs(); 19475 const attrEndChar = s[pos]; 19476 19477 if (attrEndChar !== '"' && attrEndChar !== "'") { 19478 return null; 19479 } 19480 19481 const attrEndIndex = s.indexOf(attrEndChar, ++pos); 19482 19483 if (attrEndIndex < 0) { 19484 return null; 19485 } 19486 19487 attrValue = s.substring(pos, attrEndIndex); 19488 attributes.push({ 19489 name: attrName, 19490 value: this._resolveEntities(attrValue) 19491 }); 19492 pos = attrEndIndex + 1; 19493 skipWs(); 19494 } 19495 19496 return { 19497 name, 19498 attributes, 19499 parsed: pos - start 19500 }; 19501 } 19502 19503 _parseProcessingInstruction(s, start) { 19504 let pos = start; 19505 19506 function skipWs() { 19507 while (pos < s.length && isWhitespace(s, pos)) { 19508 ++pos; 19509 } 19510 } 19511 19512 while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") { 19513 ++pos; 19514 } 19515 19516 const name = s.substring(start, pos); 19517 skipWs(); 19518 const attrStart = pos; 19519 19520 while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) { 19521 ++pos; 19522 } 19523 19524 const value = s.substring(attrStart, pos); 19525 return { 19526 name, 19527 value, 19528 parsed: pos - start 19529 }; 19530 } 19531 19532 parseXml(s) { 19533 let i = 0; 19534 19535 while (i < s.length) { 19536 const ch = s[i]; 19537 let j = i; 19538 19539 if (ch === "<") { 19540 ++j; 19541 const ch2 = s[j]; 19542 let q; 19543 19544 switch (ch2) { 19545 case "/": 19546 ++j; 19547 q = s.indexOf(">", j); 19548 19549 if (q < 0) { 19550 this.onError(XMLParserErrorCode.UnterminatedElement); 19551 return; 19552 } 19553 19554 this.onEndElement(s.substring(j, q)); 19555 j = q + 1; 19556 break; 19557 19558 case "?": 19559 ++j; 19560 19561 const pi = this._parseProcessingInstruction(s, j); 19562 19563 if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") { 19564 this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration); 19565 return; 19566 } 19567 19568 this.onPi(pi.name, pi.value); 19569 j += pi.parsed + 2; 19570 break; 19571 19572 case "!": 19573 if (s.substring(j + 1, j + 3) === "--") { 19574 q = s.indexOf("-->", j + 3); 19575 19576 if (q < 0) { 19577 this.onError(XMLParserErrorCode.UnterminatedComment); 19578 return; 19579 } 19580 19581 this.onComment(s.substring(j + 3, q)); 19582 j = q + 3; 19583 } else if (s.substring(j + 1, j + 8) === "[CDATA[") { 19584 q = s.indexOf("]]>", j + 8); 19585 19586 if (q < 0) { 19587 this.onError(XMLParserErrorCode.UnterminatedCdat); 19588 return; 19589 } 19590 19591 this.onCdata(s.substring(j + 8, q)); 19592 j = q + 3; 19593 } else if (s.substring(j + 1, j + 8) === "DOCTYPE") { 19594 const q2 = s.indexOf("[", j + 8); 19595 let complexDoctype = false;
19596 q = s.indexOf(">", j + 8); 19597 19598 if (q < 0) { 19599 this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration); 19600 return; 19601 } 19602 19603 if (q2 > 0 && q > q2) { 19604 q = s.indexOf("]>", j + 8); 19605 19606 if (q < 0) { 19607 this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration); 19608 return; 19609 } 19610 19611 complexDoctype = true; 19612 } 19613 19614 const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0)); 19615 this.onDoctype(doctypeContent); 19616 j = q + (complexDoctype ? 2 : 1); 19617 } else { 19618 this.onError(XMLParserErrorCode.MalformedElement); 19619 return; 19620 } 19621 19622 break; 19623 19624 default: 19625 const content = this._parseContent(s, j); 19626 19627 if (content === null) { 19628 this.onError(XMLParserErrorCode.MalformedElement); 19629 return; 19630 } 19631 19632 let isClosed = false; 19633 19634 if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") { 19635 isClosed = true; 19636 } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") { 19637 this.onError(XMLParserErrorCode.UnterminatedElement); 19638 return; 19639 } 19640 19641 this.onBeginElement(content.name, content.attributes, isClosed); 19642 j += content.parsed + (isClosed ? 2 : 1); 19643 break; 19644 } 19645 } else { 19646 while (j < s.length && s[j] !== "<") { 19647 j++; 19648 } 19649 19650 const text = s.substring(i, j); 19651 this.onText(this._resolveEntities(text)); 19652 } 19653 19654 i = j; 19655 } 19656 } 19657 19658 onResolveEntity(name) { 19659 return `&${name};`; 19660 } 19661 19662 onPi(name, value) {} 19663 19664 onComment(text) {} 19665 19666 onCdata(text) {} 19667 19668 onDoctype(doctypeContent) {} 19669 19670 onText(text) {} 19671 19672 onBeginElement(name, attributes, isEmpty) {} 19673 19674 onEndElement(name) {} 19675 19676 onError(code) {} 19677 19678} 19679 19680class SimpleDOMNode { 19681 constructor(nodeName, nodeValue) { 19682 this.nodeName = nodeName; 19683 this.nodeValue = nodeValue; 19684 Object.defineProperty(this, "parentNode", { 19685 value: null, 19686 writable: true 19687 }); 19688 } 19689 19690 get firstChild() { 19691 return this.childNodes && this.childNodes[0]; 19692 } 19693 19694 get nextSibling() { 19695 const childNodes = this.parentNode.childNodes; 19696 19697 if (!childNodes) { 19698 return undefined; 19699 } 19700 19701 const index = childNodes.indexOf(this); 19702 19703 if (index === -1) { 19704 return undefined; 19705 } 19706 19707 return childNodes[index + 1]; 19708 } 19709 19710 get textContent() { 19711 if (!this.childNodes) { 19712 return this.nodeValue || ""; 19713 } 19714 19715 return this.childNodes.map(function (child) { 19716 return child.textContent; 19717 }).join(""); 19718 } 19719 19720 hasChildNodes() { 19721 return this.childNodes && this.childNodes.length > 0; 19722 } 19723 19724} 19725 19726class SimpleXMLParser extends XMLParserBase { 19727 constructor() { 19728 super(); 19729 this._currentFragment = null; 19730 this._stack = null; 19731 this._errorCode = XMLParserErrorCode.NoError; 19732 } 19733 19734 parseFromString(data) { 19735 this._currentFragment = []; 19736 this._stack = []; 19737 this._errorCode = XMLParserErrorCode.NoError; 19738 this.parseXml(data); 19739 19740 if (this._errorCode !== XMLParserErrorCode.NoError) { 19741 return undefined; 19742 } 19743 19744 const [documentElement] = this._currentFragment; 19745 19746 if (!documentElement) { 19747 return undefined; 19748 } 19749 19750 return { 19751 documentElement 19752 }; 19753 } 19754 19755 onResolveEntity(name) { 19756 switch (name) { 19757 case "apos": 19758 return "'"; 19759 } 19760 19761 return super.onResolveEntity(name); 19762 } 19763 19764 onText(text) { 19765 if (isWhitespaceString(text)) { 19766 return; 19767 } 19768 19769 const node = new SimpleDOMNode("#text", text); 19770 19771 this._currentFragment.push(node); 19772 } 19773 19774 onCdata(text) { 19775 const node = new SimpleDOMNode("#text", text); 19776 19777 this._currentFragment.push(node); 19778 } 19779 19780 onBeginElement(name, attributes, isEmpty) { 19781 const node = new SimpleDOMNode(name); 19782 node.childNodes = []; 19783 19784 this._currentFragment.push(node); 19785 19786 if (isEmpty) { 19787 return; 19788 } 19789 19790 this._stack.push(this._currentFragment); 19791 19792 this._currentFragment = node.childNodes; 19793 } 19794 19795 onEndElement(name) { 19796 this._currentFragment = this._stack.pop() || []; 19797 const lastElement = this._currentFragment[this._currentFragment.length - 1]; 19798 19799 if (!lastElement) { 19800 return; 19801 } 19802 19803 for (let i = 0, ii = lastElement.childNodes.length; i < ii; i++) { 19804 lastElement.childNodes[i].parentNode = lastElement; 19805 } 19806 } 19807 19808 onError(code) { 19809 this._errorCode = code; 19810 } 19811 19812} 19813 19814exports.SimpleXMLParser = SimpleXMLParser; 19815 19816/***/ }), 19817/* 14 */ 19818/***/ (function(module, exports, __w_pdfjs_require__) { 19819 19820"use strict"; 19821 19822 19823Object.defineProperty(exports, "__esModule", { 19824 value: true 19825}); 19826exports.PDFDataTransportStream = void 0; 19827 19828var _util = __w_pdfjs_require__(1); 19829 19830class PDFDataTransportStream { 19831 constructor(params, pdfDataRangeTransport) { 19832 (0, _util.assert)(pdfDataRangeTransport); 19833 this._queuedChunks = []; 19834 this._progressiveDone = params.progressiveDone || false; 19835 const initialData = params.initialData; 19836 19837 if (initialData && initialData.length > 0) { 19838 const buffer = new Uint8Array(initialData).buffer; 19839 19840 this._queuedChunks.push(buffer); 19841 } 19842 19843 this._pdfDataRangeTransport = pdfDataRangeTransport; 19844 this._isStreamingSupported = !params.disableStream; 19845 this._isRangeSupported = !params.disableRange; 19846 this._contentLength = params.length; 19847 this._fullRequestReader = null; 19848 this._rangeReaders = []; 19849 19850 this._pdfDataRangeTransport.addRangeListener((begin, chunk) => { 19851 this._onReceiveData({ 19852 begin, 19853 chunk 19854 }); 19855 }); 19856 19857 this._pdfDataRangeTransport.addProgressListener((loaded, total) => { 19858 this._onProgress({ 19859 loaded, 19860 total 19861 }); 19862 }); 19863 19864 this._pdfDataRangeTransport.addProgressiveReadListener(chunk => { 19865 this._onReceiveData({ 19866 chunk 19867 }); 19868 }); 19869 19870 this._pdfDataRangeTransport.addProgressiveDoneListener(() => { 19871 this._onProgressiveDone(); 19872 }); 19873 19874 this._pdfDataRangeTransport.transportReady(); 19875 } 19876 19877 _onReceiveData(args) { 19878 const buffer = new Uint8Array(args.chunk).buffer; 19879 19880 if (args.begin === undefined) { 19881 if (this._fullRequestReader) { 19882 this._fullRequestReader._enqueue(buffer); 19883 } else { 19884 this._queuedChunks.push(buffer); 19885 } 19886 } else { 19887 const found = this._rangeReaders.some(function (rangeReader) { 19888 if (rangeReader._begin !== args.begin) { 19889 return false;
19890 } 19891 19892 rangeReader._enqueue(buffer); 19893 19894 return true; 19895 }); 19896 19897 (0, _util.assert)(found); 19898 } 19899 } 19900 19901 get _progressiveDataLength() { 19902 return this._fullRequestReader ? this._fullRequestReader._loaded : 0; 19903 } 19904 19905 _onProgress(evt) { 19906 if (evt.total === undefined) { 19907 const firstReader = this._rangeReaders[0]; 19908 19909 if (firstReader && firstReader.onProgress) { 19910 firstReader.onProgress({ 19911 loaded: evt.loaded 19912 }); 19913 } 19914 } else { 19915 const fullReader = this._fullRequestReader; 19916 19917 if (fullReader && fullReader.onProgress) { 19918 fullReader.onProgress({ 19919 loaded: evt.loaded, 19920 total: evt.total 19921 }); 19922 } 19923 } 19924 } 19925 19926 _onProgressiveDone() { 19927 if (this._fullRequestReader) { 19928 this._fullRequestReader.progressiveDone(); 19929 } 19930 19931 this._progressiveDone = true; 19932 } 19933 19934 _removeRangeReader(reader) { 19935 const i = this._rangeReaders.indexOf(reader); 19936 19937 if (i >= 0) { 19938 this._rangeReaders.splice(i, 1); 19939 } 19940 } 19941 19942 getFullReader() { 19943 (0, _util.assert)(!this._fullRequestReader); 19944 const queuedChunks = this._queuedChunks; 19945 this._queuedChunks = null; 19946 return new PDFDataTransportStreamReader(this, queuedChunks, this._progressiveDone); 19947 } 19948 19949 getRangeReader(begin, end) { 19950 if (end <= this._progressiveDataLength) { 19951 return null; 19952 } 19953 19954 const reader = new PDFDataTransportStreamRangeReader(this, begin, end); 19955 19956 this._pdfDataRangeTransport.requestDataRange(begin, end); 19957 19958 this._rangeReaders.push(reader); 19959 19960 return reader; 19961 } 19962 19963 cancelAllRequests(reason) { 19964 if (this._fullRequestReader) { 19965 this._fullRequestReader.cancel(reason); 19966 } 19967 19968 const readers = this._rangeReaders.slice(0); 19969 19970 readers.forEach(function (rangeReader) { 19971 rangeReader.cancel(reason); 19972 }); 19973 19974 this._pdfDataRangeTransport.abort(); 19975 } 19976 19977} 19978 19979exports.PDFDataTransportStream = PDFDataTransportStream; 19980 19981class PDFDataTransportStreamReader { 19982 constructor(stream, queuedChunks, progressiveDone = false) { 19983 this._stream = stream; 19984 this._done = progressiveDone || false; 19985 this._filename = null; 19986 this._queuedChunks = queuedChunks || []; 19987 this._loaded = 0; 19988 19989 for (const chunk of this._queuedChunks) { 19990 this._loaded += chunk.byteLength; 19991 } 19992 19993 this._requests = []; 19994 this._headersReady = Promise.resolve(); 19995 stream._fullRequestReader = this; 19996 this.onProgress = null; 19997 } 19998 19999 _enqueue(chunk) { 20000 if (this._done) { 20001 return; 20002 } 20003 20004 if (this._requests.length > 0) { 20005 const requestCapability = this._requests.shift(); 20006 20007 requestCapability.resolve({ 20008 value: chunk, 20009 done: false 20010 }); 20011 } else { 20012 this._queuedChunks.push(chunk); 20013 } 20014 20015 this._loaded += chunk.byteLength; 20016 } 20017 20018 get headersReady() { 20019 return this._headersReady; 20020 } 20021 20022 get filename() { 20023 return this._filename; 20024 } 20025 20026 get isRangeSupported() { 20027 return this._stream._isRangeSupported; 20028 } 20029 20030 get isStreamingSupported() { 20031 return this._stream._isStreamingSupported; 20032 } 20033 20034 get contentLength() { 20035 return this._stream._contentLength; 20036 } 20037 20038 async read() { 20039 if (this._queuedChunks.length > 0) { 20040 const chunk = this._queuedChunks.shift(); 20041 20042 return { 20043 value: chunk, 20044 done: false 20045 }; 20046 } 20047 20048 if (this._done) { 20049 return { 20050 value: undefined, 20051 done: true 20052 }; 20053 } 20054 20055 const requestCapability = (0, _util.createPromiseCapability)(); 20056 20057 this._requests.push(requestCapability); 20058 20059 return requestCapability.promise; 20060 } 20061 20062 cancel(reason) { 20063 this._done = true; 20064 20065 this._requests.forEach(function (requestCapability) { 20066 requestCapability.resolve({ 20067 value: undefined, 20068 done: true 20069 }); 20070 }); 20071 20072 this._requests = []; 20073 } 20074 20075 progressiveDone() { 20076 if (this._done) { 20077 return; 20078 } 20079 20080 this._done = true; 20081 } 20082 20083} 20084 20085class PDFDataTransportStreamRangeReader { 20086 constructor(stream, begin, end) { 20087 this._stream = stream; 20088 this._begin = begin; 20089 this._end = end; 20090 this._queuedChunk = null; 20091 this._requests = []; 20092 this._done = false; 20093 this.onProgress = null; 20094 } 20095 20096 _enqueue(chunk) { 20097 if (this._done) { 20098 return; 20099 } 20100 20101 if (this._requests.length === 0) { 20102 this._queuedChunk = chunk; 20103 } else { 20104 const requestsCapability = this._requests.shift(); 20105 20106 requestsCapability.resolve({ 20107 value: chunk, 20108 done: false 20109 }); 20110
20111 this._requests.forEach(function (requestCapability) { 20112 requestCapability.resolve({ 20113 value: undefined, 20114 done: true 20115 }); 20116 }); 20117 20118 this._requests = []; 20119 } 20120 20121 this._done = true; 20122 20123 this._stream._removeRangeReader(this); 20124 } 20125 20126 get isStreamingSupported() { 20127 return false; 20128 } 20129 20130 async read() { 20131 if (this._queuedChunk) { 20132 const chunk = this._queuedChunk; 20133 this._queuedChunk = null; 20134 return { 20135 value: chunk, 20136 done: false 20137 }; 20138 } 20139 20140 if (this._done) { 20141 return { 20142 value: undefined, 20143 done: true 20144 }; 20145 } 20146 20147 const requestCapability = (0, _util.createPromiseCapability)(); 20148 20149 this._requests.push(requestCapability); 20150 20151 return requestCapability.promise; 20152 } 20153 20154 cancel(reason) { 20155 this._done = true; 20156 20157 this._requests.forEach(function (requestCapability) { 20158 requestCapability.resolve({ 20159 value: undefined, 20160 done: true 20161 }); 20162 }); 20163 20164 this._requests = []; 20165 20166 this._stream._removeRangeReader(this); 20167 } 20168 20169} 20170 20171/***/ }), 20172/* 15 */ 20173/***/ (function(module, exports, __w_pdfjs_require__) { 20174 20175"use strict"; 20176 20177 20178Object.defineProperty(exports, "__esModule", { 20179 value: true 20180}); 20181exports.WebGLContext = void 0; 20182 20183var _util = __w_pdfjs_require__(1); 20184 20185class WebGLContext { 20186 constructor({ 20187 enable = false 20188 }) { 20189 this._enabled = enable === true; 20190 } 20191 20192 get isEnabled() { 20193 let enabled = this._enabled; 20194 20195 if (enabled) { 20196 enabled = WebGLUtils.tryInitGL(); 20197 } 20198 20199 return (0, _util.shadow)(this, "isEnabled", enabled); 20200 } 20201 20202 composeSMask({ 20203 layer, 20204 mask, 20205 properties 20206 }) { 20207 return WebGLUtils.composeSMask(layer, mask, properties); 20208 } 20209 20210 drawFigures({ 20211 width, 20212 height, 20213 backgroundColor, 20214 figures, 20215 context 20216 }) { 20217 return WebGLUtils.drawFigures(width, height, backgroundColor, figures, context); 20218 } 20219 20220 clear() { 20221 WebGLUtils.cleanup(); 20222 } 20223 20224} 20225 20226exports.WebGLContext = WebGLContext; 20227 20228var WebGLUtils = function WebGLUtilsClosure() { 20229 function loadShader(gl, code, shaderType) { 20230 var shader = gl.createShader(shaderType); 20231 gl.shaderSource(shader, code); 20232 gl.compileShader(shader); 20233 var compiled = gl.getShaderParameter(shader, gl.COMPILE_STATUS); 20234 20235 if (!compiled) { 20236 var errorMsg = gl.getShaderInfoLog(shader); 20237 throw new Error("Error during shader compilation: " + errorMsg); 20238 } 20239 20240 return shader; 20241 } 20242 20243 function createVertexShader(gl, code) { 20244 return loadShader(gl, code, gl.VERTEX_SHADER); 20245 } 20246 20247 function createFragmentShader(gl, code) { 20248 return loadShader(gl, code, gl.FRAGMENT_SHADER); 20249 } 20250 20251 function createProgram(gl, shaders) { 20252 var program = gl.createProgram(); 20253 20254 for (var i = 0, ii = shaders.length; i < ii; ++i) { 20255 gl.attachShader(program, shaders[i]); 20256 } 20257 20258 gl.linkProgram(program); 20259 var linked = gl.getProgramParameter(program, gl.LINK_STATUS); 20260 20261 if (!linked) { 20262 var errorMsg = gl.getProgramInfoLog(program); 20263 throw new Error("Error during program linking: " + errorMsg); 20264 } 20265 20266 return program; 20267 } 20268 20269 function createTexture(gl, image, textureId) { 20270 gl.activeTexture(textureId); 20271 var texture = gl.createTexture(); 20272 gl.bindTexture(gl.TEXTURE_2D, texture); 20273 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); 20274 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); 20275 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); 20276 gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); 20277 gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image); 20278 return texture; 20279 } 20280 20281 var currentGL, currentCanvas; 20282 20283 function generateGL() { 20284 if (currentGL) { 20285 return; 20286 } 20287 20288 currentCanvas = document.createElement("canvas"); 20289 currentGL = currentCanvas.getContext("webgl", { 20290 premultipliedalpha: false 20291 }); 20292 } 20293 20294 var smaskVertexShaderCode = "\ 20295 attribute vec2 a_position; \ 20296 attribute vec2 a_texCoord; \ 20297 \ 20298 uniform vec2 u_resolution; \ 20299 \ 20300 varying vec2 v_texCoord; \ 20301 \ 20302 void main() { \ 20303 vec2 clipSpace = (a_position / u_resolution) * 2.0 - 1.0; \ 20304 gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); \ 20305 \ 20306 v_texCoord = a_texCoord; \ 20307 } "; 20308 var smaskFragmentShaderCode = "\ 20309 precision mediump float; \ 20310 \ 20311 uniform vec4 u_backdrop; \ 20312 uniform int u_subtype; \ 20313 uniform sampler2D u_image; \ 20314 uniform sampler2D u_mask; \ 20315 \ 20316 varying vec2 v_texCoord; \ 20317 \ 20318 void main() { \ 20319 vec4 imageColor = texture2D(u_image, v_texCoord); \ 20320 vec4 maskColor = texture2D(u_mask, v_texCoord); \ 20321 if (u_backdrop.a > 0.0) { \ 20322 maskColor.rgb = maskColor.rgb * maskColor.a + \ 20323 u_backdrop.rgb * (1.0 - maskColor.a); \ 20324 } \ 20325 float lum; \ 20326 if (u_subtype == 0) { \ 20327 lum = maskColor.a; \ 20328 } else { \ 20329 lum = maskColor.r * 0.3 + maskColor.g * 0.59 + \ 20330 maskColor.b * 0.11; \ 20331 } \ 20332 imageColor.a *= lum; \ 20333 imageColor.rgb *= imageColor.a; \ 20334 gl_FragColor = imageColor; \ 20335 } "; 20336 var smaskCache = null; 20337 20338 function initSmaskGL() { 20339 var canvas, gl; 20340 generateGL(); 20341 canvas = currentCanvas; 20342 currentCanvas = null; 20343 gl = currentGL; 20344 currentGL = null; 20345 var vertexShader = createVertexShader(gl, smaskVertexShaderCode); 20346 var fragmentShader = createFragmentShader(gl, smaskFragmentShaderCode); 20347 var program = createProgram(gl, [vertexShader, fragmentShader]); 20348 gl.useProgram(program); 20349 var cache = {}; 20350 cache.gl = gl; 20351 cache.canvas = canvas; 20352 cache.resolutionLocation = gl.getUniformLocation(program, "u_resolution"); 20353 cache.positionLocation = gl.getAttribLocation(program, "a_position"); 20354 cache.backdropLocation = gl.getUniformLocation(program, "u_backdrop"); 20355 cache.subtypeLocation = gl.getUniformLocation(program, "u_subtype"); 20356 var texCoordLocation = gl.getAttribLocation(program, "a_texCoord"); 20357 var texLayerLocation = gl.getUniformLocation(program, "u_image"); 20358 var texMaskLocation = gl.getUniformLocation(program, "u_mask"); 20359 var texCoordBuffer = gl.createBuffer(); 20360 gl.bindBuffer(gl.ARRAY_BUFFER, texCoordBuffer); 20361 gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0]), gl.STATIC_DRAW); 20362 gl.enableVertexAttribArray(texCoordLocation); 20363 gl.vertexAttribPointer(texCoordLocation, 2, gl.FLOAT, false, 0, 0); 20364 gl.uniform1i(texLayerLocation, 0); 20365 gl.uniform1i(texMaskLocation, 1); 20366 smaskCache = cache; 20367 } 20368 20369 function composeSMask(layer, mask, properties) { 20370 var width = layer.width, 20371 height = layer.height; 20372 20373 if (!smaskCache) { 20374 initSmaskGL(); 20375 } 20376 20377 var cache = smaskCache,
vendor: 5,336 bytes, lines 20378-20509
20378 canvas = cache.canvas, 20379 gl = cache.gl; 20380 canvas.width = width; 20381 canvas.height = height; 20382 gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); 20383 gl.uniform2f(cache.resolutionLocation, width, height); 20384 20385 if (properties.backdrop) { 20386 gl.uniform4f(cache.resolutionLocation, properties.backdrop[0], properties.backdrop[1], properties.backdrop[2], 1); 20387 } else { 20388 gl.uniform4f(cache.resolutionLocation, 0, 0, 0, 0); 20389 } 20390 20391 gl.uniform1i(cache.subtypeLocation, properties.subtype === "Luminosity" ? 1 : 0); 20392 var texture = createTexture(gl, layer, gl.TEXTURE0); 20393 var maskTexture = createTexture(gl, mask, gl.TEXTURE1); 20394 var buffer = gl.createBuffer(); 20395 gl.bindBuffer(gl.ARRAY_BUFFER, buffer); 20396 gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([0, 0, width, 0, 0, height, 0, height, width, 0, width, height]), gl.STATIC_DRAW); 20397 gl.enableVertexAttribArray(cache.positionLocation); 20398 gl.vertexAttribPointer(cache.positionLocation, 2, gl.FLOAT, false, 0, 0); 20399 gl.clearColor(0, 0, 0, 0); 20400 gl.enable(gl.BLEND); 20401 gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA); 20402 gl.clear(gl.COLOR_BUFFER_BIT); 20403 gl.drawArrays(gl.TRIANGLES, 0, 6); 20404 gl.flush(); 20405 gl.deleteTexture(texture); 20406 gl.deleteTexture(maskTexture); 20407 gl.deleteBuffer(buffer); 20408 return canvas; 20409 } 20410 20411 var figuresVertexShaderCode = "\ 20412 attribute vec2 a_position; \ 20413 attribute vec3 a_color; \ 20414 \ 20415 uniform vec2 u_resolution; \ 20416 uniform vec2 u_scale; \ 20417 uniform vec2 u_offset; \ 20418 \ 20419 varying vec4 v_color; \ 20420 \ 20421 void main() { \ 20422 vec2 position = (a_position + u_offset) * u_scale; \ 20423 vec2 clipSpace = (position / u_resolution) * 2.0 - 1.0; \ 20424 gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); \ 20425 \ 20426 v_color = vec4(a_color / 255.0, 1.0); \ 20427 } "; 20428 var figuresFragmentShaderCode = "\ 20429 precision mediump float; \ 20430 \ 20431 varying vec4 v_color; \ 20432 \ 20433 void main() { \ 20434 gl_FragColor = v_color; \ 20435 } "; 20436 var figuresCache = null; 20437 20438 function initFiguresGL() { 20439 var canvas, gl; 20440 generateGL(); 20441 canvas = currentCanvas; 20442 currentCanvas = null; 20443 gl = currentGL; 20444 currentGL = null; 20445 var vertexShader = createVertexShader(gl, figuresVertexShaderCode); 20446 var fragmentShader = createFragmentShader(gl, figuresFragmentShaderCode); 20447 var program = createProgram(gl, [vertexShader, fragmentShader]); 20448 gl.useProgram(program); 20449 var cache = {}; 20450 cache.gl = gl; 20451 cache.canvas = canvas; 20452 cache.resolutionLocation = gl.getUniformLocation(program, "u_resolution"); 20453 cache.scaleLocation = gl.getUniformLocation(program, "u_scale"); 20454 cache.offsetLocation = gl.getUniformLocation(program, "u_offset"); 20455 cache.positionLocation = gl.getAttribLocation(program, "a_position"); 20456 cache.colorLocation = gl.getAttribLocation(program, "a_color"); 20457 figuresCache = cache; 20458 } 20459 20460 function drawFigures(width, height, backgroundColor, figures, context) { 20461 if (!figuresCache) { 20462 initFiguresGL(); 20463 } 20464 20465 var cache = figuresCache, 20466 canvas = cache.canvas, 20467 gl = cache.gl; 20468 canvas.width = width; 20469 canvas.height = height; 20470 gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); 20471 gl.uniform2f(cache.resolutionLocation, width, height); 20472 var count = 0; 20473 var i, ii, rows; 20474 20475 for (i = 0, ii = figures.length; i < ii; i++) { 20476 switch (figures[i].type) { 20477 case "lattice": 20478 rows = figures[i].coords.length / figures[i].verticesPerRow | 0; 20479 count += (rows - 1) * (figures[i].verticesPerRow - 1) * 6; 20480 break; 20481 20482 case "triangles": 20483 count += figures[i].coords.length; 20484 break; 20485 } 20486 } 20487 20488 var coords = new Float32Array(count * 2); 20489 var colors = new Uint8Array(count * 3); 20490 var coordsMap = context.coords, 20491 colorsMap = context.colors; 20492 var pIndex = 0, 20493 cIndex = 0; 20494 20495 for (i = 0, ii = figures.length; i < ii; i++) { 20496 var figure = figures[i], 20497 ps = figure.coords, 20498 cs = figure.colors; 20499 20500 switch (figure.type) { 20501 case "lattice": 20502 var cols = figure.verticesPerRow; 20503 rows = ps.length / cols | 0; 20504 20505 for (var row = 1; row < rows; row++) { 20506 var offset = row * cols + 1; 20507 20508 for (var col = 1; col < cols; col++, offset++) { 20509 coords[pIndex] = coordsMap[ps[offset - cols - 1]];
20510 coords[pIndex + 1] = coordsMap[ps[offset - cols - 1] + 1]; 20511 coords[pIndex + 2] = coordsMap[ps[offset - cols]]; 20512 coords[pIndex + 3] = coordsMap[ps[offset - cols] + 1]; 20513 coords[pIndex + 4] = coordsMap[ps[offset - 1]]; 20514 coords[pIndex + 5] = coordsMap[ps[offset - 1] + 1]; 20515 colors[cIndex] = colorsMap[cs[offset - cols - 1]]; 20516 colors[cIndex + 1] = colorsMap[cs[offset - cols - 1] + 1]; 20517 colors[cIndex + 2] = colorsMap[cs[offset - cols - 1] + 2]; 20518 colors[cIndex + 3] = colorsMap[cs[offset - cols]]; 20519 colors[cIndex + 4] = colorsMap[cs[offset - cols] + 1]; 20520 colors[cIndex + 5] = colorsMap[cs[offset - cols] + 2]; 20521 colors[cIndex + 6] = colorsMap[cs[offset - 1]]; 20522 colors[cIndex + 7] = colorsMap[cs[offset - 1] + 1]; 20523 colors[cIndex + 8] = colorsMap[cs[offset - 1] + 2]; 20524 coords[pIndex + 6] = coords[pIndex + 2]; 20525 coords[pIndex + 7] = coords[pIndex + 3]; 20526 coords[pIndex + 8] = coords[pIndex + 4]; 20527 coords[pIndex + 9] = coords[pIndex + 5]; 20528 coords[pIndex + 10] = coordsMap[ps[offset]]; 20529 coords[pIndex + 11] = coordsMap[ps[offset] + 1]; 20530 colors[cIndex + 9] = colors[cIndex + 3]; 20531 colors[cIndex + 10] = colors[cIndex + 4]; 20532 colors[cIndex + 11] = colors[cIndex + 5]; 20533 colors[cIndex + 12] = colors[cIndex + 6]; 20534 colors[cIndex + 13] = colors[cIndex + 7]; 20535 colors[cIndex + 14] = colors[cIndex + 8]; 20536 colors[cIndex + 15] = colorsMap[cs[offset]]; 20537 colors[cIndex + 16] = colorsMap[cs[offset] + 1]; 20538 colors[cIndex + 17] = colorsMap[cs[offset] + 2]; 20539 pIndex += 12; 20540 cIndex += 18; 20541 } 20542 } 20543 20544 break; 20545 20546 case "triangles": 20547 for (var j = 0, jj = ps.length; j < jj; j++) { 20548 coords[pIndex] = coordsMap[ps[j]]; 20549 coords[pIndex + 1] = coordsMap[ps[j] + 1]; 20550 colors[cIndex] = colorsMap[cs[j]]; 20551 colors[cIndex + 1] = colorsMap[cs[j] + 1]; 20552 colors[cIndex + 2] = colorsMap[cs[j] + 2]; 20553 pIndex += 2; 20554 cIndex += 3; 20555 } 20556 20557 break; 20558 } 20559 } 20560 20561 if (backgroundColor) { 20562 gl.clearColor(backgroundColor[0] / 255, backgroundColor[1] / 255, backgroundColor[2] / 255, 1.0); 20563 } else { 20564 gl.clearColor(0, 0, 0, 0); 20565 } 20566 20567 gl.clear(gl.COLOR_BUFFER_BIT); 20568 var coordsBuffer = gl.createBuffer(); 20569 gl.bindBuffer(gl.ARRAY_BUFFER, coordsBuffer); 20570 gl.bufferData(gl.ARRAY_BUFFER, coords, gl.STATIC_DRAW); 20571 gl.enableVertexAttribArray(cache.positionLocation); 20572 gl.vertexAttribPointer(cache.positionLocation, 2, gl.FLOAT, false, 0, 0); 20573 var colorsBuffer = gl.createBuffer(); 20574 gl.bindBuffer(gl.ARRAY_BUFFER, colorsBuffer); 20575 gl.bufferData(gl.ARRAY_BUFFER, colors, gl.STATIC_DRAW); 20576 gl.enableVertexAttribArray(cache.colorLocation); 20577 gl.vertexAttribPointer(cache.colorLocation, 3, gl.UNSIGNED_BYTE, false, 0, 0); 20578 gl.uniform2f(cache.scaleLocation, context.scaleX, context.scaleY); 20579 gl.uniform2f(cache.offsetLocation, context.offsetX, context.offsetY); 20580 gl.drawArrays(gl.TRIANGLES, 0, count); 20581 gl.flush(); 20582 gl.deleteBuffer(coordsBuffer); 20583 gl.deleteBuffer(colorsBuffer); 20584 return canvas; 20585 } 20586 20587 return { 20588 tryInitGL() { 20589 try { 20590 generateGL(); 20591 return !!currentGL; 20592 } catch (ex) {} 20593 20594 return false; 20595 }, 20596 20597 composeSMask, 20598 drawFigures, 20599 20600 cleanup() { 20601 if (smaskCache && smaskCache.canvas) { 20602 smaskCache.canvas.width = 0; 20603 smaskCache.canvas.height = 0; 20604 } 20605 20606 if (figuresCache && figuresCache.canvas) { 20607 figuresCache.canvas.width = 0; 20608 figuresCache.canvas.height = 0; 20609 } 20610 20611 smaskCache = null; 20612 figuresCache = null; 20613 } 20614 20615 }; 20616}(); 20617 20618/***/ }), 20619/* 16 */ 20620/***/ (function(module, exports, __w_pdfjs_require__) { 20621 20622"use strict"; 20623 20624 20625Object.defineProperty(exports, "__esModule", { 20626 value: true 20627}); 20628exports.renderTextLayer = void 0; 20629 20630var _util = __w_pdfjs_require__(1); 20631 20632var renderTextLayer = function renderTextLayerClosure() { 20633 var MAX_TEXT_DIVS_TO_RENDER = 100000; 20634 var NonWhitespaceRegexp = /\S/; 20635 20636 function isAllWhitespace(str) { 20637 return !NonWhitespaceRegexp.test(str); 20638 } 20639 20640 function appendText(task, geom, styles) { 20641 var textDiv = document.createElement("span"); 20642 var textDivProperties = { 20643 angle: 0, 20644 canvasWidth: 0, 20645 isWhitespace: false, 20646 originalTransform: null, 20647 paddingBottom: 0, 20648 paddingLeft: 0, 20649 paddingRight: 0, 20650 paddingTop: 0, 20651 scale: 1 20652 }; 20653 20654 task._textDivs.push(textDiv); 20655 20656 if (isAllWhitespace(geom.str)) { 20657 textDivProperties.isWhitespace = true; 20658 20659 task._textDivProperties.set(textDiv, textDivProperties); 20660 20661 return; 20662 } 20663 20664 var tx = _util.Util.transform(task._viewport.transform, geom.transform); 20665 20666 var angle = Math.atan2(tx[1], tx[0]); 20667 var style = styles[geom.fontName]; 20668 20669 if (style.vertical) { 20670 angle += Math.PI / 2; 20671 } 20672 20673 var fontHeight = Math.sqrt(tx[2] * tx[2] + tx[3] * tx[3]); 20674 var fontAscent = fontHeight; 20675 20676 if (style.ascent) { 20677 fontAscent = style.ascent * fontAscent; 20678 }
20678 else if (style.descent) { 20679 fontAscent = (1 + style.descent) * fontAscent; 20680 } 20681 20682 let left, top; 20683 20684 if (angle === 0) { 20685 left = tx[4]; 20686 top = tx[5] - fontAscent; 20687 } else { 20688 left = tx[4] + fontAscent * Math.sin(angle); 20689 top = tx[5] - fontAscent * Math.cos(angle); 20690 } 20691 20692 textDiv.style.left = `${left}px`; 20693 textDiv.style.top = `${top}px`; 20694 textDiv.style.fontSize = `${fontHeight}px`; 20695 textDiv.style.fontFamily = style.fontFamily; 20696 textDiv.textContent = geom.str; 20697 20698 if (task._fontInspectorEnabled) { 20699 textDiv.dataset.fontName = geom.fontName; 20700 } 20701 20702 if (angle !== 0) { 20703 textDivProperties.angle = angle * (180 / Math.PI); 20704 } 20705 20706 if (geom.str.length > 1) { 20707 if (style.vertical) { 20708 textDivProperties.canvasWidth = geom.height * task._viewport.scale; 20709 } else { 20710 textDivProperties.canvasWidth = geom.width * task._viewport.scale; 20711 } 20712 } 20713 20714 task._textDivProperties.set(textDiv, textDivProperties); 20715 20716 if (task._textContentStream) { 20717 task._layoutText(textDiv); 20718 } 20719 20720 if (task._enhanceTextSelection) { 20721 var angleCos = 1, 20722 angleSin = 0; 20723 20724 if (angle !== 0) { 20725 angleCos = Math.cos(angle); 20726 angleSin = Math.sin(angle); 20727 } 20728 20729 var divWidth = (style.vertical ? geom.height : geom.width) * task._viewport.scale; 20730 var divHeight = fontHeight; 20731 var m, b; 20732 20733 if (angle !== 0) { 20734 m = [angleCos, angleSin, -angleSin, angleCos, left, top]; 20735 b = _util.Util.getAxialAlignedBoundingBox([0, 0, divWidth, divHeight], m); 20736 } else { 20737 b = [left, top, left + divWidth, top + divHeight]; 20738 } 20739 20740 task._bounds.push({ 20741 left: b[0], 20742 top: b[1], 20743 right: b[2], 20744 bottom: b[3], 20745 div: textDiv, 20746 size: [divWidth, divHeight], 20747 m 20748 }); 20749 } 20750 } 20751 20752 function render(task) { 20753 if (task._canceled) { 20754 return; 20755 } 20756 20757 var textDivs = task._textDivs; 20758 var capability = task._capability; 20759 var textDivsLength = textDivs.length; 20760 20761 if (textDivsLength > MAX_TEXT_DIVS_TO_RENDER) { 20762 task._renderingDone = true; 20763 capability.resolve(); 20764 return; 20765 } 20766 20767 if (!task._textContentStream) { 20768 for (var i = 0; i < textDivsLength; i++) { 20769 task._layoutText(textDivs[i]); 20770 } 20771 } 20772 20773 task._renderingDone = true; 20774 capability.resolve(); 20775 } 20776 20777 function expand(task) { 20778 var bounds = task._bounds; 20779 var viewport = task._viewport; 20780 var expanded = expandBounds(viewport.width, viewport.height, bounds); 20781 20782 for (var i = 0; i < expanded.length; i++) { 20783 var div = bounds[i].div; 20784 20785 var divProperties = task._textDivProperties.get(div); 20786 20787 if (divProperties.angle === 0) { 20788 divProperties.paddingLeft = bounds[i].left - expanded[i].left; 20789 divProperties.paddingTop = bounds[i].top - expanded[i].top; 20790 divProperties.paddingRight = expanded[i].right - bounds[i].right; 20791 divProperties.paddingBottom = expanded[i].bottom - bounds[i].bottom; 20792 20793 task._textDivProperties.set(div, divProperties); 20794 20795 continue; 20796 } 20797 20798 var e = expanded[i], 20799 b = bounds[i]; 20800 var m = b.m, 20801 c = m[0], 20802 s = m[1]; 20803 var points = [[0, 0], [0, b.size[1]], [b.size[0], 0], b.size]; 20804 var ts = new Float64Array(64); 20805 points.forEach(function (p, i) { 20806 var t = _util.Util.applyTransform(p, m); 20807 20808 ts[i + 0] = c && (e.left - t[0]) / c; 20809 ts[i + 4] = s && (e.top - t[1]) / s; 20810 ts[i + 8] = c && (e.right - t[0]) / c; 20811 ts[i + 12] = s && (e.bottom - t[1]) / s; 20812 ts[i + 16] = s && (e.left - t[0]) / -s; 20813 ts[i + 20] = c && (e.top - t[1]) / c; 20814 ts[i + 24] = s && (e.right - t[0]) / -s; 20815 ts[i + 28] = c && (e.bottom - t[1]) / c; 20816 ts[i + 32] = c && (e.left - t[0]) / -c; 20817 ts[i + 36] = s && (e.top - t[1]) / -s; 20818 ts[i + 40] = c && (e.right - t[0]) / -c; 20819 ts[i + 44] = s && (e.bottom - t[1]) / -s; 20820 ts[i + 48] = s && (e.left - t[0]) / s; 20821 ts[i + 52] = c && (e.top - t[1]) / -c; 20822 ts[i + 56] = s && (e.right - t[0]) / s; 20823 ts[i + 60] = c && (e.bottom - t[1]) / -c; 20824 }); 20825 20826 var findPositiveMin = function (ts, offset, count) { 20827 var result = 0; 20828 20829 for (var i = 0; i < count; i++) { 20830 var t = ts[offset++]; 20831 20832 if (t > 0) { 20833 result = result ? Math.min(t, result) : t; 20834 } 20835 } 20836 20837 return result; 20838 }; 20839 20840 var boxScale = 1 + Math.min(Math.abs(c), Math.abs(s));
20841 divProperties.paddingLeft = findPositiveMin(ts, 32, 16) / boxScale; 20842 divProperties.paddingTop = findPositiveMin(ts, 48, 16) / boxScale; 20843 divProperties.paddingRight = findPositiveMin(ts, 0, 16) / boxScale; 20844 divProperties.paddingBottom = findPositiveMin(ts, 16, 16) / boxScale; 20845 20846 task._textDivProperties.set(div, divProperties); 20847 } 20848 } 20849 20850 function expandBounds(width, height, boxes) { 20851 var bounds = boxes.map(function (box, i) { 20852 return { 20853 x1: box.left, 20854 y1: box.top, 20855 x2: box.right, 20856 y2: box.bottom, 20857 index: i, 20858 x1New: undefined, 20859 x2New: undefined 20860 }; 20861 }); 20862 expandBoundsLTR(width, bounds); 20863 var expanded = new Array(boxes.length); 20864 bounds.forEach(function (b) { 20865 var i = b.index; 20866 expanded[i] = { 20867 left: b.x1New, 20868 top: 0, 20869 right: b.x2New, 20870 bottom: 0 20871 }; 20872 }); 20873 boxes.map(function (box, i) { 20874 var e = expanded[i], 20875 b = bounds[i]; 20876 b.x1 = box.top; 20877 b.y1 = width - e.right; 20878 b.x2 = box.bottom; 20879 b.y2 = width - e.left; 20880 b.index = i; 20881 b.x1New = undefined; 20882 b.x2New = undefined; 20883 }); 20884 expandBoundsLTR(height, bounds); 20885 bounds.forEach(function (b) { 20886 var i = b.index; 20887 expanded[i].top = b.x1New; 20888 expanded[i].bottom = b.x2New; 20889 }); 20890 return expanded; 20891 } 20892 20893 function expandBoundsLTR(width, bounds) { 20894 bounds.sort(function (a, b) { 20895 return a.x1 - b.x1 || a.index - b.index; 20896 }); 20897 var fakeBoundary = { 20898 x1: -Infinity, 20899 y1: -Infinity, 20900 x2: 0, 20901 y2: Infinity, 20902 index: -1, 20903 x1New: 0, 20904 x2New: 0 20905 }; 20906 var horizon = [{ 20907 start: -Infinity, 20908 end: Infinity, 20909 boundary: fakeBoundary 20910 }]; 20911 bounds.forEach(function (boundary) { 20912 var i = 0; 20913 20914 while (i < horizon.length && horizon[i].end <= boundary.y1) { 20915 i++; 20916 } 20917 20918 var j = horizon.length - 1; 20919 20920 while (j >= 0 && horizon[j].start >= boundary.y2) { 20921 j--; 20922 } 20923 20924 var horizonPart, affectedBoundary; 20925 var q, 20926 k, 20927 maxXNew = -Infinity; 20928 20929 for (q = i; q <= j; q++) { 20930 horizonPart = horizon[q]; 20931 affectedBoundary = horizonPart.boundary; 20932 var xNew; 20933 20934 if (affectedBoundary.x2 > boundary.x1) { 20935 xNew = affectedBoundary.index > boundary.index ? affectedBoundary.x1New : boundary.x1; 20936 } else if (affectedBoundary.x2New === undefined) { 20937 xNew = (affectedBoundary.x2 + boundary.x1) / 2; 20938 } else { 20939 xNew = affectedBoundary.x2New; 20940 } 20941 20942 if (xNew > maxXNew) { 20943 maxXNew = xNew; 20944 } 20945 } 20946 20947 boundary.x1New = maxXNew; 20948 20949 for (q = i; q <= j; q++) { 20950 horizonPart = horizon[q]; 20951 affectedBoundary = horizonPart.boundary; 20952 20953 if (affectedBoundary.x2New === undefined) { 20954 if (affectedBoundary.x2 > boundary.x1) { 20955 if (affectedBoundary.index > boundary.index) { 20956 affectedBoundary.x2New = affectedBoundary.x2; 20957 } 20958 } else { 20959 affectedBoundary.x2New = maxXNew; 20960 } 20961 } else if (affectedBoundary.x2New > maxXNew) { 20962 affectedBoundary.x2New = Math.max(maxXNew, affectedBoundary.x2); 20963 } 20964 } 20965 20966 var changedHorizon = [], 20967 lastBoundary = null; 20968 20969 for (q = i; q <= j; q++) { 20970 horizonPart = horizon[q]; 20971 affectedBoundary = horizonPart.boundary; 20972 var useBoundary = affectedBoundary.x2 > boundary.x2 ? affectedBoundary : boundary; 20973 20974 if (lastBoundary === useBoundary) { 20975 changedHorizon[changedHorizon.length - 1].end = horizonPart.end; 20976 } else { 20977 changedHorizon.push({ 20978 start: horizonPart.start, 20979 end: horizonPart.end, 20980 boundary: useBoundary 20981 }); 20982 lastBoundary = useBoundary; 20983 } 20984 } 20985 20986 if (horizon[i].start < boundary.y1) { 20987 changedHorizon[0].start = boundary.y1; 20988 changedHorizon.unshift({ 20989 start: horizon[i].start, 20990 end: boundary.y1, 20991 boundary: horizon[i].boundary 20992 }); 20993 } 20994 20995 if (boundary.y2 < horizon[j].end) { 20996 changedHorizon[changedHorizon.length - 1].end = boundary.y2; 20997 changedHorizon.push({ 20998 start: boundary.y2, 20999 end: horizon[j].end, 21000 boundary: horizon[j].boundary 21001 }); 21002 } 21003 21004 for (q = i; q <= j; q++) { 21005 horizonPart = horizon[q]; 21006 affectedBoundary = horizonPart.boundary; 21007 21008 if (affectedBoundary.x2New !== undefined) { 21009 continue; 21010 } 21011 21012 var used = false;
21013 21014 for (k = i - 1; !used && k >= 0 && horizon[k].start >= affectedBoundary.y1; k--) { 21015 used = horizon[k].boundary === affectedBoundary; 21016 } 21017 21018 for (k = j + 1; !used && k < horizon.length && horizon[k].end <= affectedBoundary.y2; k++) { 21019 used = horizon[k].boundary === affectedBoundary; 21020 } 21021 21022 for (k = 0; !used && k < changedHorizon.length; k++) { 21023 used = changedHorizon[k].boundary === affectedBoundary; 21024 } 21025 21026 if (!used) { 21027 affectedBoundary.x2New = maxXNew; 21028 } 21029 } 21030 21031 Array.prototype.splice.apply(horizon, [i, j - i + 1].concat(changedHorizon)); 21032 }); 21033 horizon.forEach(function (horizonPart) { 21034 var affectedBoundary = horizonPart.boundary; 21035 21036 if (affectedBoundary.x2New === undefined) { 21037 affectedBoundary.x2New = Math.max(width, affectedBoundary.x2); 21038 } 21039 }); 21040 } 21041 21042 function TextLayerRenderTask({ 21043 textContent, 21044 textContentStream, 21045 container, 21046 viewport, 21047 textDivs, 21048 textContentItemsStr, 21049 enhanceTextSelection 21050 }) { 21051 this._textContent = textContent; 21052 this._textContentStream = textContentStream; 21053 this._container = container; 21054 this._viewport = viewport; 21055 this._textDivs = textDivs || []; 21056 this._textContentItemsStr = textContentItemsStr || []; 21057 this._enhanceTextSelection = !!enhanceTextSelection; 21058 this._fontInspectorEnabled = !!(globalThis.FontInspector && globalThis.FontInspector.enabled); 21059 this._reader = null; 21060 this._layoutTextLastFontSize = null; 21061 this._layoutTextLastFontFamily = null; 21062 this._layoutTextCtx = null; 21063 this._textDivProperties = new WeakMap(); 21064 this._renderingDone = false; 21065 this._canceled = false; 21066 this._capability = (0, _util.createPromiseCapability)(); 21067 this._renderTimer = null; 21068 this._bounds = []; 21069 21070 this._capability.promise.finally(() => { 21071 if (this._layoutTextCtx) { 21072 this._layoutTextCtx.canvas.width = 0; 21073 this._layoutTextCtx.canvas.height = 0; 21074 this._layoutTextCtx = null; 21075 } 21076 }).catch(() => {}); 21077 } 21078 21079 TextLayerRenderTask.prototype = { 21080 get promise() { 21081 return this._capability.promise; 21082 }, 21083 21084 cancel: function TextLayer_cancel() { 21085 this._canceled = true; 21086 21087 if (this._reader) { 21088 this._reader.cancel(new _util.AbortException("TextLayer task cancelled.")); 21089 21090 this._reader = null; 21091 } 21092 21093 if (this._renderTimer !== null) { 21094 clearTimeout(this._renderTimer); 21095 this._renderTimer = null; 21096 } 21097 21098 this._capability.reject(new Error("TextLayer task cancelled.")); 21099 }, 21100 21101 _processItems(items, styleCache) { 21102 for (let i = 0, len = items.length; i < len; i++) { 21103 this._textContentItemsStr.push(items[i].str); 21104 21105 appendText(this, items[i], styleCache); 21106 } 21107 }, 21108 21109 _layoutText(textDiv) { 21110 const textDivProperties = this._textDivProperties.get(textDiv); 21111 21112 if (textDivProperties.isWhitespace) { 21113 return; 21114 } 21115 21116 let transform = ""; 21117 21118 if (textDivProperties.canvasWidth !== 0) { 21119 const { 21120 fontSize, 21121 fontFamily 21122 } = textDiv.style; 21123 21124 if (fontSize !== this._layoutTextLastFontSize || fontFamily !== this._layoutTextLastFontFamily) { 21125 this._layoutTextCtx.font = `${fontSize} ${fontFamily}`; 21126 this._layoutTextLastFontSize = fontSize; 21127 this._layoutTextLastFontFamily = fontFamily; 21128 } 21129 21130 const { 21131 width 21132 } = this._layoutTextCtx.measureText(textDiv.textContent); 21133 21134 if (width > 0) { 21135 textDivProperties.scale = textDivProperties.canvasWidth / width; 21136 transform = `scaleX(${textDivProperties.scale})`; 21137 } 21138 } 21139 21140 if (textDivProperties.angle !== 0) { 21141 transform = `rotate(${textDivProperties.angle}deg) ${transform}`; 21142 } 21143 21144 if (transform.length > 0) { 21145 if (this._enhanceTextSelection) { 21146 textDivProperties.originalTransform = transform; 21147 } 21148 21149 textDiv.style.transform = transform; 21150 } 21151 21152 this._textDivProperties.set(textDiv, textDivProperties); 21153 21154 this._container.appendChild(textDiv); 21155 }, 21156 21157 _render: function TextLayer_render(timeout) { 21158 const capability = (0, _util.createPromiseCapability)(); 21159 let styleCache = Object.create(null); 21160 const canvas = document.createElement("canvas"); 21161 canvas.mozOpaque = true; 21162 this._layoutTextCtx = canvas.getContext("2d", { 21163 alpha: false 21164 }); 21165 21166 if (this._textContent) { 21167 const textItems = this._textContent.items; 21168 const textStyles = this._textContent.styles; 21169 21170 this._processItems(textItems, textStyles); 21171 21172 capability.resolve(); 21173 } else if (this._textContentStream) { 21174 const pump = () => { 21175 this._reader.read().then(({ 21176 value, 21177 done 21178 }) => { 21179 if (done) { 21180 capability.resolve(); 21181 return; 21182 } 21183 21184 Object.assign(styleCache, value.styles); 21185 21186 this._processItems(value.items, styleCache); 21187 21188 pump(); 21189 }, capability.reject); 21190 }; 21191 21192 this._reader = this._textContentStream.getReader(); 21193 pump(); 21194 } else { 21195 throw new Error('Neither "textContent" nor "textContentStream"' + " parameters specified."); 21196 } 21197 21198 capability.promise.then(() => { 21199 styleCache = null; 21200 21201 if (!timeout) { 21202 render(this); 21203 } else { 21204 this._renderTimer = setTimeout(() => { 21205 render(this); 21206 this._renderTimer = null; 21207 }, timeout); 21208 } 21209 }, this._capability.reject); 21210 }, 21211 expandTextDivs: function TextLayer_expandTextDivs(expandDivs) { 21212 if (!this._enhanceTextSelection || !this._renderingDone) { 21213 return; 21214 } 21215 21216 if (this._bounds !== null) { 21217 expand(this); 21218 this._bounds = null; 21219 } 21220 21221 const transformBuf = [], 21222 paddingBuf = []; 21223 21224 for (var i = 0, ii = this._textDivs.length; i < ii; i++) { 21225 const div = this._textDivs[i]; 21226 21227 const divProps = this._textDivProperties.get(div); 21228 21229 if (divProps.isWhitespace) { 21230 continue; 21231 } 21232 21233 if (expandDivs) { 21234 transformBuf.length = 0; 21235 paddingBuf.length = 0; 21236 21237 if (divProps.originalTransform) { 21238 transformBuf.push(divProps.originalTransform); 21239 } 21240 21241 if (divProps.paddingTop > 0) { 21242 paddingBuf.push(`${divProps.paddingTop}px`); 21243 transformBuf.push(`translateY(${-divProps.paddingTop}px)`); 21244 } else { 21245 paddingBuf.push(0); 21246 } 21247 21248 if (divProps.paddingRight > 0) { 21249 paddingBuf.push(`${divProps.paddingRight / divProps.scale}px`); 21250 } else { 21251 paddingBuf.push(0); 21252 } 21253 21254 if (divProps.paddingBottom > 0) { 21255 paddingBuf.push(`${divProps.paddingBottom}px`); 21256 } else { 21257 paddingBuf.push(0); 21258 } 21259 21260 if (divProps.paddingLeft > 0) { 21261 paddingBuf.push(`${divProps.paddingLeft / divProps.scale}px`); 21262 transformBuf.push(`translateX(${-divProps.paddingLeft / divProps.scale}px)`); 21263 } else { 21264 paddingBuf.push(0); 21265 } 21266 21267 div.style.padding = paddingBuf.join(" "); 21268 21269 if (transformBuf.length) { 21270 div.style.transform = transformBuf.join(" "); 21271 } 21272 } else { 21273 div.style.padding = null; 21274 div.style.transform = divProps.originalTransform; 21275 } 21276 } 21277 } 21278 }; 21279 21280 function renderTextLayer(renderParameters) { 21281 var task = new TextLayerRenderTask({ 21282 textContent: renderParameters.textContent, 21283 textContentStream: renderParameters.textContentStream, 21284 container: renderParameters.container, 21285 viewport: renderParameters.viewport, 21286 textDivs: renderParameters.textDivs, 21287 textContentItemsStr: renderParameters.textContentItemsStr, 21288 enhanceTextSelection: renderParameters.enhanceTextSelection 21289 }); 21290 21291 task._render(renderParameters.timeout); 21292 21293 return task; 21294 } 21295 21296 return renderTextLayer; 21297}(); 21298 21299exports.renderTextLayer = renderTextLayer; 21300 21301/***/ }), 21302/* 17 */ 21303/***/ (function(module, exports, __w_pdfjs_require__) { 21304 21305"use strict"; 21306 21307 21308Object.defineProperty(exports, "__esModule", { 21309 value: true 21310}); 21311exports.AnnotationLayer = void 0; 21312 21313var _display_utils = __w_pdfjs_require__(4); 21314 21315var _util = __w_pdfjs_require__(1); 21316 21317class AnnotationElementFactory { 21318 static create(parameters) { 21319 const subtype = parameters.data.annotationType; 21320 21321 switch (subtype) { 21322 case _util.AnnotationType.LINK: 21323 return new LinkAnnotationElement(parameters); 21324 21325 case _util.AnnotationType.TEXT: 21326 return new TextAnnotationElement(parameters); 21327 21328 case _util.AnnotationType.WIDGET: 21329 const fieldType = parameters.data.fieldType; 21330 21331 switch (fieldType) { 21332 case "Tx": 21333 return new TextWidgetAnnotationElement(parameters); 21334 21335 case "Btn": 21336 if (parameters.data.radioButton) { 21337 return new RadioButtonWidgetAnnotationElement(parameters); 21338 } else if (parameters.data.checkBox) { 21339 return new CheckboxWidgetAnnotationElement(parameters); 21340 } 21341 21342 return new PushButtonWidgetAnnotationElement(parameters); 21343 21344 case "Ch": 21345 return new ChoiceWidgetAnnotationElement(parameters); 21346 } 21347 21348 return new WidgetAnnotationElement(parameters); 21349 21350 case _util.AnnotationType.POPUP: 21351 return new PopupAnnotationElement(parameters); 21352 21353 case _util.AnnotationType.FREETEXT: 21354 return new FreeTextAnnotationElement(parameters); 21355 21356 case _util.AnnotationType.LINE: 21357 return new LineAnnotationElement(parameters); 21358 21359 case _util.AnnotationType.SQUARE: 21360 return new SquareAnnotationElement(parameters); 21361 21362 case _util.AnnotationType.CIRCLE: 21363 return new CircleAnnotationElement(parameters); 21364 21365 case _util.AnnotationType.POLYLINE: 21366 return new PolylineAnnotationElement(parameters); 21367 21368 case _util.AnnotationType.CARET: 21369 return new CaretAnnotationElement(parameters); 21370 21371 case _util.AnnotationType.INK: 21372 return new InkAnnotationElement(parameters); 21373 21374 case _util.AnnotationType.POLYGON: 21375 return new PolygonAnnotationElement(parameters); 21376 21377 case _util.AnnotationType.HIGHLIGHT: 21378 return new HighlightAnnotationElement(parameters); 21379 21380 case _util.AnnotationType.UNDERLINE: 21381 return new UnderlineAnnotationElement(parameters); 21382 21383 case _util.AnnotationType.SQUIGGLY: 21384 return new SquigglyAnnotationElement(parameters); 21385 21386 case _util.AnnotationType.STRIKEOUT: 21387 return new StrikeOutAnnotationElement(parameters); 21388 21389 case _util.AnnotationType.STAMP: 21390 return new StampAnnotationElement(parameters); 21391 21392 case _util.AnnotationType.FILEATTACHMENT: 21393 return new FileAttachmentAnnotationElement(parameters); 21394 21395 default: 21396 return new AnnotationElement(parameters); 21397 } 21398 } 21399 21400} 21401 21402class AnnotationElement { 21403 constructor(parameters, isRenderable = false, ignoreBorder = false) { 21404 this.isRenderable = isRenderable; 21405 this.data = parameters.data; 21406 this.layer = parameters.layer; 21407 this.page = parameters.page; 21408 this.viewport = parameters.viewport; 21409 this.linkService = parameters.linkService; 21410 this.downloadManager = parameters.downloadManager; 21411 this.imageResourcesPath = parameters.imageResourcesPath; 21412 this.renderInteractiveForms = parameters.renderInteractiveForms; 21413 this.svgFactory = parameters.svgFactory; 21414 21415 if (isRenderable) { 21416 this.container = this._createContainer(ignoreBorder); 21417 } 21418 } 21419 21420 _createContainer(ignoreBorder = false) { 21421 const data = this.data, 21422 page = this.page, 21423 viewport = this.viewport; 21424 const container = document.createElement("section"); 21425 let width = data.rect[2] - data.rect[0]; 21426 let height = data.rect[3] - data.rect[1]; 21427 container.setAttribute("data-annotation-id", data.id); 21428 21429 const rect = _util.Util.normalizeRect([data.rect[0], page.view[3] - data.rect[1] + page.view[1], data.rect[2], page.view[3] - data.rect[3] + page.view[1]]); 21430 21431 container.style.transform = `matrix(${viewport.transform.join(",")})`; 21432 container.style.transformOrigin = `-${rect[0]}px -${rect[1]}px`; 21433 21434 if (!ignoreBorder && data.borderStyle.width > 0) { 21435 container.style.borderWidth = `${data.borderStyle.width}px`; 21436 21437 if (data.borderStyle.style !== _util.AnnotationBorderStyleType.UNDERLINE) { 21438 width = width - 2 * data.borderStyle.width; 21439 height = height - 2 * data.borderStyle.width; 21440 } 21441 21442 const horizontalRadius = data.borderStyle.horizontalCornerRadius; 21443 const verticalRadius = data.borderStyle.verticalCornerRadius; 21444 21445 if (horizontalRadius > 0 || verticalRadius > 0) { 21446 const radius = `${horizontalRadius}px / ${verticalRadius}px`;
21447 container.style.borderRadius = radius; 21448 } 21449 21450 switch (data.borderStyle.style) { 21451 case _util.AnnotationBorderStyleType.SOLID: 21452 container.style.borderStyle = "solid"; 21453 break; 21454 21455 case _util.AnnotationBorderStyleType.DASHED: 21456 container.style.borderStyle = "dashed"; 21457 break; 21458 21459 case _util.AnnotationBorderStyleType.BEVELED: 21460 (0, _util.warn)("Unimplemented border style: beveled"); 21461 break; 21462 21463 case _util.AnnotationBorderStyleType.INSET: 21464 (0, _util.warn)("Unimplemented border style: inset"); 21465 break; 21466 21467 case _util.AnnotationBorderStyleType.UNDERLINE: 21468 container.style.borderBottomStyle = "solid"; 21469 break; 21470 21471 default: 21472 break; 21473 } 21474 21475 if (data.color) { 21476 container.style.borderColor = _util.Util.makeCssRgb(data.color[0] | 0, data.color[1] | 0, data.color[2] | 0); 21477 } else { 21478 container.style.borderWidth = 0; 21479 } 21480 } 21481 21482 container.style.left = `${rect[0]}px`; 21483 container.style.top = `${rect[1]}px`; 21484 container.style.width = `${width}px`; 21485 container.style.height = `${height}px`; 21486 return container; 21487 } 21488 21489 _createPopup(container, trigger, data) { 21490 if (!trigger) { 21491 trigger = document.createElement("div"); 21492 trigger.style.height = container.style.height; 21493 trigger.style.width = container.style.width; 21494 container.appendChild(trigger); 21495 } 21496 21497 const popupElement = new PopupElement({ 21498 container, 21499 trigger, 21500 color: data.color, 21501 title: data.title, 21502 modificationDate: data.modificationDate, 21503 contents: data.contents, 21504 hideWrapper: true 21505 }); 21506 const popup = popupElement.render(); 21507 popup.style.left = container.style.width; 21508 container.appendChild(popup); 21509 } 21510 21511 render() { 21512 (0, _util.unreachable)("Abstract method `AnnotationElement.render` called"); 21513 } 21514 21515} 21516 21517class LinkAnnotationElement extends AnnotationElement { 21518 constructor(parameters) { 21519 const isRenderable = !!(parameters.data.url || parameters.data.dest || parameters.data.action); 21520 super(parameters, isRenderable); 21521 } 21522 21523 render() { 21524 this.container.className = "linkAnnotation"; 21525 const { 21526 data, 21527 linkService 21528 } = this; 21529 const link = document.createElement("a"); 21530 21531 if (data.url) { 21532 (0, _display_utils.addLinkAttributes)(link, { 21533 url: data.url, 21534 target: data.newWindow ? _display_utils.LinkTarget.BLANK : linkService.externalLinkTarget, 21535 rel: linkService.externalLinkRel, 21536 enabled: linkService.externalLinkEnabled 21537 }); 21538 } else if (data.action) { 21539 this._bindNamedAction(link, data.action); 21540 } else { 21541 this._bindLink(link, data.dest); 21542 } 21543 21544 this.container.appendChild(link); 21545 return this.container; 21546 } 21547 21548 _bindLink(link, destination) { 21549 link.href = this.linkService.getDestinationHash(destination); 21550 21551 link.onclick = () => { 21552 if (destination) { 21553 this.linkService.navigateTo(destination); 21554 } 21555 21556 return false; 21557 }; 21558 21559 if (destination) { 21560 link.className = "internalLink"; 21561 } 21562 } 21563 21564 _bindNamedAction(link, action) { 21565 link.href = this.linkService.getAnchorUrl(""); 21566 21567 link.onclick = () => { 21568 this.linkService.executeNamedAction(action); 21569 return false; 21570 }; 21571 21572 link.className = "internalLink"; 21573 } 21574 21575} 21576 21577class TextAnnotationElement extends AnnotationElement { 21578 constructor(parameters) { 21579 const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); 21580 super(parameters, isRenderable); 21581 } 21582 21583 render() { 21584 this.container.className = "textAnnotation"; 21585 const image = document.createElement("img"); 21586 image.style.height = this.container.style.height; 21587 image.style.width = this.container.style.width; 21588 image.src = this.imageResourcesPath + "annotation-" + this.data.name.toLowerCase() + ".svg"; 21589 image.alt = "[{{type}} Annotation]"; 21590 image.dataset.l10nId = "text_annotation_type"; 21591 image.dataset.l10nArgs = JSON.stringify({ 21592 type: this.data.name 21593 }); 21594 21595 if (!this.data.hasPopup) { 21596 this._createPopup(this.container, image, this.data); 21597 } 21598 21599 this.container.appendChild(image); 21600 return this.container; 21601 } 21602 21603} 21604 21605class WidgetAnnotationElement extends AnnotationElement { 21606 render() { 21607 return this.container; 21608 } 21609 21610} 21611 21612class TextWidgetAnnotationElement extends WidgetAnnotationElement { 21613 constructor(parameters) { 21614 const isRenderable = parameters.renderInteractiveForms || !parameters.data.hasAppearance && !!parameters.data.fieldValue; 21615 super(parameters, isRenderable); 21616 } 21617 21618 render() { 21619 const TEXT_ALIGNMENT = ["left", "center", "right"]; 21620 this.container.className = "textWidgetAnnotation"; 21621 let element = null; 21622 21623 if (this.renderInteractiveForms) { 21624 if (this.data.multiLine) { 21625 element = document.createElement("textarea"); 21626 element.textContent = this.data.fieldValue; 21627 } else { 21628 element = document.createElement("input"); 21629 element.type = "text"; 21630 element.setAttribute("value", this.data.fieldValue); 21631 } 21632 21633 element.disabled = this.data.readOnly; 21634 21635 if (this.data.maxLen !== null) { 21636 element.maxLength = this.data.maxLen; 21637 } 21638 21639 if (this.data.comb) { 21640 const fieldWidth = this.data.rect[2] - this.data.rect[0]; 21641 const combWidth = fieldWidth / this.data.maxLen; 21642 element.classList.add("comb"); 21643 element.style.letterSpacing = `calc(${combWidth}px - 1ch)`; 21644 } 21645 } else { 21646 element = document.createElement("div"); 21647 element.textContent = this.data.fieldValue; 21648 element.style.verticalAlign = "middle"; 21649 element.style.display = "table-cell"; 21650 let font = null; 21651 21652 if (this.data.fontRefName && this.page.commonObjs.has(this.data.fontRefName)) { 21653 font = this.page.commonObjs.get(this.data.fontRefName); 21654 } 21655 21656 this._setTextStyle(element, font); 21657 } 21658 21659 if (this.data.textAlignment !== null) { 21660 element.style.textAlign = TEXT_ALIGNMENT[this.data.textAlignment]; 21661 } 21662 21663 this.container.appendChild(element); 21664 return this.container; 21665 } 21666 21667 _setTextStyle(element, font) { 21668 const style = element.style; 21669 style.fontSize = `${this.data.fontSize}px`; 21670 style.direction = this.data.fontDirection < 0 ? "rtl" : "ltr"; 21671 21672 if (!font) { 21673 return; 21674 } 21675 21676 let bold = "normal"; 21677 21678 if (font.black) { 21679 bold = "900"; 21680 } else if (font.bold) { 21681 bold = "bold"; 21682 } 21683 21684 style.fontWeight = bold; 21685 style.fontStyle = font.italic ? "italic" : "normal"; 21686 const fontFamily = font.loadedName ? `"${font.loadedName}", ` : ""; 21687 const fallbackName = font.fallbackName || "Helvetica, sans-serif"; 21688 style.fontFamily = fontFamily + fallbackName; 21689 } 21690 21691} 21692 21693class CheckboxWidgetAnnotationElement extends WidgetAnnotationElement { 21694 constructor(parameters) { 21695 super(parameters, parameters.renderInteractiveForms); 21696 } 21697 21698 render() { 21699 this.container.className = "buttonWidgetAnnotation checkBox"; 21700 const element = document.createElement("input"); 21701 element.disabled = this.data.readOnly; 21702 element.type = "checkbox"; 21703 21704 if (this.data.fieldValue && this.data.fieldValue !== "Off") { 21705 element.setAttribute("checked", true); 21706 } 21707 21708 this.container.appendChild(element); 21709 return this.container; 21710 } 21711 21712} 21713 21714class RadioButtonWidgetAnnotationElement extends WidgetAnnotationElement { 21715 constructor(parameters) { 21716 super(parameters, parameters.renderInteractiveForms); 21717 } 21718 21719 render() { 21720 this.container.className = "buttonWidgetAnnotation radioButton"; 21721 const element = document.createElement("input"); 21722 element.disabled = this.data.readOnly; 21723 element.type = "radio"; 21724 element.name = this.data.fieldName; 21725 21726 if (this.data.fieldValue === this.data.buttonValue) { 21727 element.setAttribute("checked", true); 21728 } 21729 21730 this.container.appendChild(element); 21731 return this.container; 21732 } 21733 21734} 21735 21736class PushButtonWidgetAnnotationElement extends LinkAnnotationElement { 21737 render() { 21738 const container = super.render(); 21739 container.className = "buttonWidgetAnnotation pushButton"; 21740 return container; 21741 } 21742 21743} 21744 21745class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement { 21746 constructor(parameters) { 21747 super(parameters, parameters.renderInteractiveForms); 21748 } 21749 21750 render() { 21751 this.container.className = "choiceWidgetAnnotation"; 21752 const selectElement = document.createElement("select"); 21753 selectElement.disabled = this.data.readOnly; 21754 21755 if (!this.data.combo) { 21756 selectElement.size = this.data.options.length; 21757 21758 if (this.data.multiSelect) { 21759 selectElement.multiple = true; 21760 } 21761 } 21762 21763 for (const option of this.data.options) { 21764 const optionElement = document.createElement("option"); 21765 optionElement.textContent = option.displayValue; 21766 optionElement.value = option.exportValue; 21767 21768 if (this.data.fieldValue.includes(option.displayValue)) { 21769 optionElement.setAttribute("selected", true); 21770 } 21771 21772 selectElement.appendChild(optionElement); 21773 } 21774 21775 this.container.appendChild(selectElement); 21776 return this.container; 21777 } 21778 21779} 21780 21781class PopupAnnotationElement extends AnnotationElement { 21782 constructor(parameters) { 21783 const isRenderable = !!(parameters.data.title || parameters.data.contents); 21784 super(parameters, isRenderable); 21785 } 21786 21787 render() { 21788 const IGNORE_TYPES = ["Line", "Square", "Circle", "PolyLine", "Polygon", "Ink"]; 21789 this.container.className = "popupAnnotation"; 21790 21791 if (IGNORE_TYPES.includes(this.data.parentType)) { 21792 return this.container; 21793 } 21794 21795 const selector = `[data-annotation-id="${this.data.parentId}"]`; 21796 const parentElement = this.layer.querySelector(selector); 21797 21798 if (!parentElement) { 21799 return this.container; 21800 } 21801 21802 const popup = new PopupElement({ 21803 container: this.container, 21804 trigger: parentElement, 21805 color: this.data.color, 21806 title: this.data.title, 21807 modificationDate: this.data.modificationDate, 21808 contents: this.data.contents 21809 }); 21810 const parentLeft = parseFloat(parentElement.style.left); 21811 const parentWidth = parseFloat(parentElement.style.width); 21812 this.container.style.transformOrigin = `-${parentLeft + parentWidth}px -${parentElement.style.top}`; 21813 this.container.style.left = `${parentLeft + parentWidth}px`;
21814 this.container.appendChild(popup.render()); 21815 return this.container; 21816 } 21817 21818} 21819 21820class PopupElement { 21821 constructor(parameters) { 21822 this.container = parameters.container; 21823 this.trigger = parameters.trigger; 21824 this.color = parameters.color; 21825 this.title = parameters.title; 21826 this.modificationDate = parameters.modificationDate; 21827 this.contents = parameters.contents; 21828 this.hideWrapper = parameters.hideWrapper || false; 21829 this.pinned = false; 21830 } 21831 21832 render() { 21833 const BACKGROUND_ENLIGHT = 0.7; 21834 const wrapper = document.createElement("div"); 21835 wrapper.className = "popupWrapper"; 21836 this.hideElement = this.hideWrapper ? wrapper : this.container; 21837 this.hideElement.setAttribute("hidden", true); 21838 const popup = document.createElement("div"); 21839 popup.className = "popup"; 21840 const color = this.color; 21841 21842 if (color) { 21843 const r = BACKGROUND_ENLIGHT * (255 - color[0]) + color[0]; 21844 const g = BACKGROUND_ENLIGHT * (255 - color[1]) + color[1]; 21845 const b = BACKGROUND_ENLIGHT * (255 - color[2]) + color[2]; 21846 popup.style.backgroundColor = _util.Util.makeCssRgb(r | 0, g | 0, b | 0); 21847 } 21848 21849 const title = document.createElement("h1"); 21850 title.textContent = this.title; 21851 popup.appendChild(title); 21852 21853 const dateObject = _display_utils.PDFDateString.toDateObject(this.modificationDate); 21854 21855 if (dateObject) { 21856 const modificationDate = document.createElement("span"); 21857 modificationDate.textContent = "{{date}}, {{time}}"; 21858 modificationDate.dataset.l10nId = "annotation_date_string"; 21859 modificationDate.dataset.l10nArgs = JSON.stringify({ 21860 date: dateObject.toLocaleDateString(), 21861 time: dateObject.toLocaleTimeString() 21862 }); 21863 popup.appendChild(modificationDate); 21864 } 21865 21866 const contents = this._formatContents(this.contents); 21867 21868 popup.appendChild(contents); 21869 this.trigger.addEventListener("click", this._toggle.bind(this)); 21870 this.trigger.addEventListener("mouseover", this._show.bind(this, false)); 21871 this.trigger.addEventListener("mouseout", this._hide.bind(this, false)); 21872 popup.addEventListener("click", this._hide.bind(this, true)); 21873 wrapper.appendChild(popup); 21874 return wrapper; 21875 } 21876 21877 _formatContents(contents) { 21878 const p = document.createElement("p"); 21879 const lines = contents.split(/(?:\r\n?|\n)/); 21880 21881 for (let i = 0, ii = lines.length; i < ii; ++i) { 21882 const line = lines[i]; 21883 p.appendChild(document.createTextNode(line)); 21884 21885 if (i < ii - 1) { 21886 p.appendChild(document.createElement("br")); 21887 } 21888 } 21889 21890 return p; 21891 } 21892 21893 _toggle() { 21894 if (this.pinned) { 21895 this._hide(true); 21896 } else { 21897 this._show(true); 21898 } 21899 } 21900 21901 _show(pin = false) { 21902 if (pin) { 21903 this.pinned = true; 21904 } 21905 21906 if (this.hideElement.hasAttribute("hidden")) { 21907 this.hideElement.removeAttribute("hidden"); 21908 this.container.style.zIndex += 1; 21909 } 21910 } 21911 21912 _hide(unpin = true) { 21913 if (unpin) { 21914 this.pinned = false; 21915 } 21916 21917 if (!this.hideElement.hasAttribute("hidden") && !this.pinned) { 21918 this.hideElement.setAttribute("hidden", true); 21919 this.container.style.zIndex -= 1; 21920 } 21921 } 21922 21923} 21924 21925class FreeTextAnnotationElement extends AnnotationElement { 21926 constructor(parameters) { 21927 const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); 21928 super(parameters, isRenderable, true); 21929 } 21930 21931 render() { 21932 this.container.className = "freeTextAnnotation"; 21933 21934 if (!this.data.hasPopup) { 21935 this._createPopup(this.container, null, this.data); 21936 } 21937 21938 return this.container; 21939 } 21940 21941} 21942 21943class LineAnnotationElement extends AnnotationElement { 21944 constructor(parameters) { 21945 const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); 21946 super(parameters, isRenderable, true); 21947 } 21948 21949 render() { 21950 this.container.className = "lineAnnotation"; 21951 const data = this.data; 21952 const width = data.rect[2] - data.rect[0]; 21953 const height = data.rect[3] - data.rect[1]; 21954 const svg = this.svgFactory.create(width, height); 21955 const line = this.svgFactory.createElement("svg:line"); 21956 line.setAttribute("x1", data.rect[2] - data.lineCoordinates[0]); 21957 line.setAttribute("y1", data.rect[3] - data.lineCoordinates[1]); 21958 line.setAttribute("x2", data.rect[2] - data.lineCoordinates[2]); 21959 line.setAttribute("y2", data.rect[3] - data.lineCoordinates[3]); 21960 line.setAttribute("stroke-width", data.borderStyle.width || 1); 21961 line.setAttribute("stroke", "transparent"); 21962 svg.appendChild(line); 21963 this.container.append(svg); 21964 21965 this._createPopup(this.container, line, data); 21966 21967 return this.container; 21968 } 21969 21970} 21971 21972class SquareAnnotationElement extends AnnotationElement { 21973 constructor(parameters) { 21974 const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); 21975 super(parameters, isRenderable, true); 21976 } 21977 21978 render() { 21979 this.container.className = "squareAnnotation"; 21980 const data = this.data; 21981 const width = data.rect[2] - data.rect[0]; 21982 const height = data.rect[3] - data.rect[1]; 21983 const svg = this.svgFactory.create(width, height); 21984 const borderWidth = data.borderStyle.width; 21985 const square = this.svgFactory.createElement("svg:rect"); 21986 square.setAttribute("x", borderWidth / 2); 21987 square.setAttribute("y", borderWidth / 2); 21988 square.setAttribute("width", width - borderWidth); 21989 square.setAttribute("height", height - borderWidth); 21990 square.setAttribute("stroke-width", borderWidth || 1); 21991 square.setAttribute("stroke", "transparent"); 21992 square.setAttribute("fill", "none"); 21993 svg.appendChild(square); 21994 this.container.append(svg); 21995 21996 this._createPopup(this.container, square, data); 21997 21998 return this.container; 21999 } 22000 22001} 22002 22003class CircleAnnotationElement extends AnnotationElement { 22004 constructor(parameters) { 22005 const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); 22006 super(parameters, isRenderable, true); 22007 } 22008 22009 render() { 22010 this.container.className = "circleAnnotation"; 22011 const data = this.data; 22012 const width = data.rect[2] - data.rect[0]; 22013 const height = data.rect[3] - data.rect[1]; 22014 const svg = this.svgFactory.create(width, height); 22015 const borderWidth = data.borderStyle.width; 22016 const circle = this.svgFactory.createElement("svg:ellipse"); 22017 circle.setAttribute("cx", width / 2); 22018 circle.setAttribute("cy", height / 2); 22019 circle.setAttribute("rx", width / 2 - borderWidth / 2); 22020 circle.setAttribute("ry", height / 2 - borderWidth / 2); 22021 circle.setAttribute("stroke-width", borderWidth || 1); 22022 circle.setAttribute("stroke", "transparent"); 22023 circle.setAttribute("fill", "none"); 22024 svg.appendChild(circle); 22025 this.container.append(svg); 22026 22027 this._createPopup(this.container, circle, data); 22028 22029 return this.container; 22030 } 22031 22032} 22033 22034class PolylineAnnotationElement extends AnnotationElement { 22035 constructor(parameters) { 22036 const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); 22037 super(parameters, isRenderable, true); 22038 this.containerClassName = "polylineAnnotation"; 22039 this.svgElementName = "svg:polyline"; 22040 } 22041 22042 render() { 22043 this.container.className = this.containerClassName; 22044 const data = this.data; 22045 const width = data.rect[2] - data.rect[0]; 22046 const height = data.rect[3] - data.rect[1]; 22047 const svg = this.svgFactory.create(width, height); 22048 let points = []; 22049 22050 for (const coordinate of data.vertices) { 22051 const x = coordinate.x - data.rect[0];
22052 const y = data.rect[3] - coordinate.y; 22053 points.push(x + "," + y); 22054 } 22055 22056 points = points.join(" "); 22057 const polyline = this.svgFactory.createElement(this.svgElementName); 22058 polyline.setAttribute("points", points); 22059 polyline.setAttribute("stroke-width", data.borderStyle.width || 1); 22060 polyline.setAttribute("stroke", "transparent"); 22061 polyline.setAttribute("fill", "none"); 22062 svg.appendChild(polyline); 22063 this.container.append(svg); 22064 22065 this._createPopup(this.container, polyline, data); 22066 22067 return this.container; 22068 } 22069 22070} 22071 22072class PolygonAnnotationElement extends PolylineAnnotationElement { 22073 constructor(parameters) { 22074 super(parameters); 22075 this.containerClassName = "polygonAnnotation"; 22076 this.svgElementName = "svg:polygon"; 22077 } 22078 22079} 22080 22081class CaretAnnotationElement extends AnnotationElement { 22082 constructor(parameters) { 22083 const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); 22084 super(parameters, isRenderable, true); 22085 } 22086 22087 render() { 22088 this.container.className = "caretAnnotation"; 22089 22090 if (!this.data.hasPopup) { 22091 this._createPopup(this.container, null, this.data); 22092 } 22093 22094 return this.container; 22095 } 22096 22097} 22098 22099class InkAnnotationElement extends AnnotationElement { 22100 constructor(parameters) { 22101 const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); 22102 super(parameters, isRenderable, true); 22103 this.containerClassName = "inkAnnotation"; 22104 this.svgElementName = "svg:polyline"; 22105 } 22106 22107 render() { 22108 this.container.className = this.containerClassName; 22109 const data = this.data; 22110 const width = data.rect[2] - data.rect[0]; 22111 const height = data.rect[3] - data.rect[1]; 22112 const svg = this.svgFactory.create(width, height); 22113 22114 for (const inkList of data.inkLists) { 22115 let points = []; 22116 22117 for (const coordinate of inkList) { 22118 const x = coordinate.x - data.rect[0]; 22119 const y = data.rect[3] - coordinate.y; 22120 points.push(`${x},${y}`); 22121 } 22122 22123 points = points.join(" "); 22124 const polyline = this.svgFactory.createElement(this.svgElementName); 22125 polyline.setAttribute("points", points); 22126 polyline.setAttribute("stroke-width", data.borderStyle.width || 1); 22127 polyline.setAttribute("stroke", "transparent"); 22128 polyline.setAttribute("fill", "none"); 22129 22130 this._createPopup(this.container, polyline, data); 22131 22132 svg.appendChild(polyline); 22133 } 22134 22135 this.container.append(svg); 22136 return this.container; 22137 } 22138 22139} 22140 22141class HighlightAnnotationElement extends AnnotationElement { 22142 constructor(parameters) { 22143 const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); 22144 super(parameters, isRenderable, true); 22145 } 22146 22147 render() { 22148 this.container.className = "highlightAnnotation"; 22149 22150 if (!this.data.hasPopup) { 22151 this._createPopup(this.container, null, this.data); 22152 } 22153 22154 return this.container; 22155 } 22156 22157} 22158 22159class UnderlineAnnotationElement extends AnnotationElement { 22160 constructor(parameters) { 22161 const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); 22162 super(parameters, isRenderable, true); 22163 } 22164 22165 render() { 22166 this.container.className = "underlineAnnotation"; 22167 22168 if (!this.data.hasPopup) { 22169 this._createPopup(this.container, null, this.data); 22170 } 22171 22172 return this.container; 22173 } 22174 22175} 22176 22177class SquigglyAnnotationElement extends AnnotationElement { 22178 constructor(parameters) { 22179 const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); 22180 super(parameters, isRenderable, true); 22181 } 22182 22183 render() { 22184 this.container.className = "squigglyAnnotation"; 22185 22186 if (!this.data.hasPopup) { 22187 this._createPopup(this.container, null, this.data); 22188 } 22189 22190 return this.container; 22191 } 22192 22193} 22194 22195class StrikeOutAnnotationElement extends AnnotationElement { 22196 constructor(parameters) { 22197 const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); 22198 super(parameters, isRenderable, true); 22199 } 22200 22201 render() { 22202 this.container.className = "strikeoutAnnotation"; 22203 22204 if (!this.data.hasPopup) { 22205 this._createPopup(this.container, null, this.data); 22206 } 22207 22208 return this.container; 22209 } 22210 22211} 22212 22213class StampAnnotationElement extends AnnotationElement { 22214 constructor(parameters) { 22215 const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); 22216 super(parameters, isRenderable, true); 22217 } 22218 22219 render() { 22220 this.container.className = "stampAnnotation"; 22221 22222 if (!this.data.hasPopup) { 22223 this._createPopup(this.container, null, this.data); 22224 } 22225 22226 return this.container; 22227 } 22228 22229} 22230 22231class FileAttachmentAnnotationElement extends AnnotationElement { 22232 constructor(parameters) { 22233 super(parameters, true); 22234 const { 22235 filename, 22236 content 22237 } = this.data.file; 22238 this.filename = (0, _display_utils.getFilenameFromUrl)(filename); 22239 this.content = content; 22240 22241 if (this.linkService.eventBus) { 22242 this.linkService.eventBus.dispatch("fileattachmentannotation", { 22243 source: this, 22244 id: (0, _util.stringToPDFString)(filename), 22245 filename, 22246 content 22247 }); 22248 } 22249 } 22250 22251 render() { 22252 this.container.className = "fileAttachmentAnnotation"; 22253 const trigger = document.createElement("div"); 22254 trigger.style.height = this.container.style.height; 22255 trigger.style.width = this.container.style.width; 22256 trigger.addEventListener("dblclick", this._download.bind(this)); 22257 22258 if (!this.data.hasPopup && (this.data.title || this.data.contents)) { 22259 this._createPopup(this.container, trigger, this.data); 22260 } 22261 22262 this.container.appendChild(trigger); 22263 return this.container; 22264 } 22265 22266 _download() { 22267 if (!this.downloadManager) { 22268 (0, _util.warn)("Download cannot be started due to unavailable download manager"); 22269 return; 22270 } 22271 22272 this.downloadManager.downloadData(this.content, this.filename, ""); 22273 } 22274 22275} 22276 22277class AnnotationLayer { 22278 static render(parameters) { 22279 const sortedAnnotations = [], 22280 popupAnnotations = []; 22281 22282 for (const data of parameters.annotations) { 22283 if (!data) { 22284 continue; 22285 } 22286 22287 if (data.annotationType === _util.AnnotationType.POPUP) { 22288 popupAnnotations.push(data); 22289 continue; 22290 } 22291 22292 sortedAnnotations.push(data); 22293 } 22294 22295 if (popupAnnotations.length) { 22296 sortedAnnotations.push(...popupAnnotations); 22297 } 22298 22299 for (const data of sortedAnnotations) { 22300 const element = AnnotationElementFactory.create({ 22301 data, 22302 layer: parameters.div, 22303 page: parameters.page, 22304 viewport: parameters.viewport, 22305 linkService: parameters.linkService, 22306 downloadManager: parameters.downloadManager, 22307 imageResourcesPath: parameters.imageResourcesPath || "", 22308 renderInteractiveForms: parameters.renderInteractiveForms || false, 22309 svgFactory: new _display_utils.DOMSVGFactory() 22310 }); 22311 22312 if (element.isRenderable) { 22313 parameters.div.appendChild(element.render()); 22314 } 22315 } 22316 } 22317 22318 static update(parameters) { 22319 for (const data of parameters.annotations) { 22320 const element = parameters.div.querySelector(`[data-annotation-id="${data.id}"]`); 22321 22322 if (element) { 22323 element.style.transform = `matrix(${parameters.viewport.transform.join(",")})`; 22324 } 22325 } 22326 22327 parameters.div.removeAttribute("hidden"); 22328 } 22329 22330} 22331 22332exports.AnnotationLayer = AnnotationLayer; 22333 22334/***/ }), 22335/* 18 */ 22336/***/ (function(module, exports, __w_pdfjs_require__) { 22337 22338"use strict"; 22339 22340 22341Object.defineProperty(exports, "__esModule", { 22342 value: true 22343}); 22344exports.SVGGraphics = void 0; 22345 22346var _util = __w_pdfjs_require__(1); 22347 22348var _display_utils = __w_pdfjs_require__(4); 22349 22350var _is_node = __w_pdfjs_require__(7); 22351 22352let SVGGraphics = function () { 22353 throw new Error("Not implemented: SVGGraphics"); 22354}; 22355 22356exports.SVGGraphics = SVGGraphics; 22357{ 22358 const SVG_DEFAULTS = { 22359 fontStyle: "normal", 22360 fontWeight: "normal", 22361 fillColor: "#000000" 22362 }; 22363 const XML_NS = "http://www.w3.org/XML/1998/namespace"; 22364 const XLINK_NS = "http://www.w3.org/1999/xlink"; 22365 const LINE_CAP_STYLES = ["butt", "round", "square"]; 22366 const LINE_JOIN_STYLES = ["miter", "round", "bevel"]; 22367 22368 const convertImgDataToPng = function () { 22369 const PNG_HEADER = new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]); 22370 const CHUNK_WRAPPER_SIZE = 12; 22371 const crcTable = new Int32Array(256); 22372 22373 for (let i = 0; i < 256; i++) { 22374 let c = i; 22375 22376 for (let h = 0; h < 8; h++) { 22377 if (c & 1) { 22378 c = 0xedb88320 ^ c >> 1 & 0x7fffffff; 22379 } else { 22380 c = c >> 1 & 0x7fffffff; 22381 } 22382 } 22383 22384 crcTable[i] = c; 22385 } 22386 22387 function crc32(data, start, end) { 22388 let crc = -1; 22389 22390 for (let i = start; i < end; i++) { 22391 const a = (crc ^ data[i]) & 0xff;
22392 const b = crcTable[a]; 22393 crc = crc >>> 8 ^ b; 22394 } 22395 22396 return crc ^ -1; 22397 } 22398 22399 function writePngChunk(type, body, data, offset) { 22400 let p = offset; 22401 const len = body.length; 22402 data[p] = len >> 24 & 0xff; 22403 data[p + 1] = len >> 16 & 0xff; 22404 data[p + 2] = len >> 8 & 0xff; 22405 data[p + 3] = len & 0xff; 22406 p += 4; 22407 data[p] = type.charCodeAt(0) & 0xff; 22408 data[p + 1] = type.charCodeAt(1) & 0xff; 22409 data[p + 2] = type.charCodeAt(2) & 0xff; 22410 data[p + 3] = type.charCodeAt(3) & 0xff; 22411 p += 4; 22412 data.set(body, p); 22413 p += body.length; 22414 const crc = crc32(data, offset + 4, p); 22415 data[p] = crc >> 24 & 0xff; 22416 data[p + 1] = crc >> 16 & 0xff; 22417 data[p + 2] = crc >> 8 & 0xff; 22418 data[p + 3] = crc & 0xff; 22419 } 22420 22421 function adler32(data, start, end) { 22422 let a = 1; 22423 let b = 0; 22424 22425 for (let i = start; i < end; ++i) { 22426 a = (a + (data[i] & 0xff)) % 65521; 22427 b = (b + a) % 65521; 22428 } 22429 22430 return b << 16 | a; 22431 } 22432 22433 function deflateSync(literals) { 22434 if (!_is_node.isNodeJS) { 22435 return deflateSyncUncompressed(literals); 22436 } 22437 22438 try { 22439 let input; 22440 22441 if (parseInt(process.versions.node) >= 8) { 22442 input = literals; 22443 } else { 22444 input = Buffer.from(literals); 22445 } 22446 22447 const output = require("zlib").deflateSync(input, { 22448 level: 9 22449 }); 22450 22451 return output instanceof Uint8Array ? output : new Uint8Array(output); 22452 } catch (e) { 22453 (0, _util.warn)("Not compressing PNG because zlib.deflateSync is unavailable: " + e); 22454 } 22455 22456 return deflateSyncUncompressed(literals); 22457 } 22458 22459 function deflateSyncUncompressed(literals) { 22460 let len = literals.length; 22461 const maxBlockLength = 0xffff; 22462 const deflateBlocks = Math.ceil(len / maxBlockLength); 22463 const idat = new Uint8Array(2 + len + deflateBlocks * 5 + 4); 22464 let pi = 0; 22465 idat[pi++] = 0x78; 22466 idat[pi++] = 0x9c; 22467 let pos = 0; 22468 22469 while (len > maxBlockLength) { 22470 idat[pi++] = 0x00; 22471 idat[pi++] = 0xff; 22472 idat[pi++] = 0xff; 22473 idat[pi++] = 0x00; 22474 idat[pi++] = 0x00; 22475 idat.set(literals.subarray(pos, pos + maxBlockLength), pi); 22476 pi += maxBlockLength; 22477 pos += maxBlockLength; 22478 len -= maxBlockLength; 22479 } 22480 22481 idat[pi++] = 0x01; 22482 idat[pi++] = len & 0xff; 22483 idat[pi++] = len >> 8 & 0xff; 22484 idat[pi++] = ~len & 0xffff & 0xff; 22485 idat[pi++] = (~len & 0xffff) >> 8 & 0xff; 22486 idat.set(literals.subarray(pos), pi); 22487 pi += literals.length - pos; 22488 const adler = adler32(literals, 0, literals.length); 22489 idat[pi++] = adler >> 24 & 0xff; 22490 idat[pi++] = adler >> 16 & 0xff; 22491 idat[pi++] = adler >> 8 & 0xff; 22492 idat[pi++] = adler & 0xff; 22493 return idat; 22494 } 22495 22496 function encode(imgData, kind, forceDataSchema, isMask) { 22497 const width = imgData.width; 22498 const height = imgData.height; 22499 let bitDepth, colorType, lineSize; 22500 const bytes = imgData.data; 22501 22502 switch (kind) { 22503 case _util.ImageKind.GRAYSCALE_1BPP: 22504 colorType = 0; 22505 bitDepth = 1; 22506 lineSize = width + 7 >> 3; 22507 break; 22508 22509 case _util.ImageKind.RGB_24BPP: 22510 colorType = 2; 22511 bitDepth = 8; 22512 lineSize = width * 3; 22513 break; 22514 22515 case _util.ImageKind.RGBA_32BPP: 22516 colorType = 6; 22517 bitDepth = 8; 22518 lineSize = width * 4; 22519 break; 22520 22521 default: 22522 throw new Error("invalid format"); 22523 } 22524 22525 const literals = new Uint8Array((1 + lineSize) * height); 22526 let offsetLiterals = 0, 22527 offsetBytes = 0; 22528 22529 for (let y = 0; y < height; ++y) { 22530 literals[offsetLiterals++] = 0; 22531 literals.set(bytes.subarray(offsetBytes, offsetBytes + lineSize), offsetLiterals); 22532 offsetBytes += lineSize; 22533 offsetLiterals += lineSize; 22534 } 22535 22536 if (kind === _util.ImageKind.GRAYSCALE_1BPP && isMask) { 22537 offsetLiterals = 0; 22538 22539 for (let y = 0; y < height; y++) { 22540 offsetLiterals++; 22541 22542 for (let i = 0; i < lineSize; i++) { 22543 literals[offsetLiterals++] ^= 0xff; 22544 } 22545 } 22546 } 22547 22548 const ihdr = new Uint8Array([width >> 24 & 0xff, width >> 16 & 0xff, width >> 8 & 0xff, width & 0xff, height >> 24 & 0xff, height >> 16 & 0xff, height >> 8 & 0xff, height & 0xff, bitDepth, colorType, 0x00, 0x00, 0x00]); 22549 const idat = deflateSync(literals); 22550 const pngLength = PNG_HEADER.length + CHUNK_WRAPPER_SIZE * 3 + ihdr.length + idat.length; 22551 const data = new Uint8Array(pngLength); 22552 let offset = 0; 22553 data.set(PNG_HEADER, offset); 22554 offset += PNG_HEADER.length; 22555 writePngChunk("IHDR", ihdr, data, offset); 22556 offset += CHUNK_WRAPPER_SIZE + ihdr.length; 22557 writePngChunk("IDATA", idat, data, offset); 22558 offset += CHUNK_WRAPPER_SIZE + idat.length; 22559 writePngChunk("IEND", new Uint8Array(0), data, offset); 22560 return (0, _util.createObjectURL)(data, "image/png", forceDataSchema); 22561 } 22562 22563 return function convertImgDataToPng(imgData, forceDataSchema, isMask) {
22564 const kind = imgData.kind === undefined ? _util.ImageKind.GRAYSCALE_1BPP : imgData.kind; 22565 return encode(imgData, kind, forceDataSchema, isMask); 22566 }; 22567 }(); 22568 22569 class SVGExtraState { 22570 constructor() { 22571 this.fontSizeScale = 1; 22572 this.fontWeight = SVG_DEFAULTS.fontWeight; 22573 this.fontSize = 0; 22574 this.textMatrix = _util.IDENTITY_MATRIX; 22575 this.fontMatrix = _util.FONT_IDENTITY_MATRIX; 22576 this.leading = 0; 22577 this.textRenderingMode = _util.TextRenderingMode.FILL; 22578 this.textMatrixScale = 1; 22579 this.x = 0; 22580 this.y = 0; 22581 this.lineX = 0; 22582 this.lineY = 0; 22583 this.charSpacing = 0; 22584 this.wordSpacing = 0; 22585 this.textHScale = 1; 22586 this.textRise = 0; 22587 this.fillColor = SVG_DEFAULTS.fillColor; 22588 this.strokeColor = "#000000"; 22589 this.fillAlpha = 1; 22590 this.strokeAlpha = 1; 22591 this.lineWidth = 1; 22592 this.lineJoin = ""; 22593 this.lineCap = ""; 22594 this.miterLimit = 0; 22595 this.dashArray = []; 22596 this.dashPhase = 0; 22597 this.dependencies = []; 22598 this.activeClipUrl = null; 22599 this.clipGroup = null; 22600 this.maskId = ""; 22601 } 22602 22603 clone() { 22604 return Object.create(this); 22605 } 22606 22607 setCurrentPoint(x, y) { 22608 this.x = x; 22609 this.y = y; 22610 } 22611 22612 } 22613 22614 function opListToTree(opList) { 22615 let opTree = []; 22616 const tmp = []; 22617 22618 for (const opListElement of opList) { 22619 if (opListElement.fn === "save") { 22620 opTree.push({ 22621 fnId: 92, 22622 fn: "group", 22623 items: [] 22624 }); 22625 tmp.push(opTree); 22626 opTree = opTree[opTree.length - 1].items; 22627 continue; 22628 } 22629 22630 if (opListElement.fn === "restore") { 22631 opTree = tmp.pop(); 22632 } else { 22633 opTree.push(opListElement); 22634 } 22635 } 22636 22637 return opTree; 22638 } 22639 22640 function pf(value) { 22641 if (Number.isInteger(value)) { 22642 return value.toString(); 22643 } 22644 22645 const s = value.toFixed(10); 22646 let i = s.length - 1; 22647 22648 if (s[i] !== "0") { 22649 return s; 22650 } 22651 22652 do { 22653 i--; 22654 } while (s[i] === "0"); 22655 22656 return s.substring(0, s[i] === "." ? i : i + 1); 22657 } 22658 22659 function pm(m) { 22660 if (m[4] === 0 && m[5] === 0) { 22661 if (m[1] === 0 && m[2] === 0) { 22662 if (m[0] === 1 && m[3] === 1) { 22663 return ""; 22664 } 22665 22666 return `scale(${pf(m[0])} ${pf(m[3])})`; 22667 } 22668 22669 if (m[0] === m[3] && m[1] === -m[2]) { 22670 const a = Math.acos(m[0]) * 180 / Math.PI; 22671 return `rotate(${pf(a)})`; 22672 } 22673 } else { 22674 if (m[0] === 1 && m[1] === 0 && m[2] === 0 && m[3] === 1) { 22675 return `translate(${pf(m[4])} ${pf(m[5])})`; 22676 } 22677 } 22678 22679 return `matrix(${pf(m[0])} ${pf(m[1])} ${pf(m[2])} ${pf(m[3])} ${pf(m[4])} ` + `${pf(m[5])})`; 22680 } 22681 22682 let clipCount = 0; 22683 let maskCount = 0; 22684 let shadingCount = 0; 22685 exports.SVGGraphics = SVGGraphics = class SVGGraphics { 22686 constructor(commonObjs, objs, forceDataSchema) { 22687 this.svgFactory = new _display_utils.DOMSVGFactory(); 22688 this.current = new SVGExtraState(); 22689 this.transformMatrix = _util.IDENTITY_MATRIX; 22690 this.transformStack = []; 22691 this.extraStack = []; 22692 this.commonObjs = commonObjs; 22693 this.objs = objs; 22694 this.pendingClip = null; 22695 this.pendingEOFill = false; 22696 this.embedFonts = false; 22697 this.embeddedFonts = Object.create(null); 22698 this.cssStyle = null; 22699 this.forceDataSchema = !!forceDataSchema; 22700 this._operatorIdMapping = []; 22701 22702 for (const op in _util.OPS) { 22703 this._operatorIdMapping[_util.OPS[op]] = op; 22704 } 22705 } 22706 22707 save() { 22708 this.transformStack.push(this.transformMatrix); 22709 const old = this.current; 22710 this.extraStack.push(old); 22711 this.current = old.clone(); 22712 } 22713 22714 restore() { 22715 this.transformMatrix = this.transformStack.pop(); 22716 this.current = this.extraStack.pop(); 22717 this.pendingClip = null; 22718 this.tgrp = null; 22719 } 22720 22721 group(items) { 22722 this.save(); 22723 this.executeOpTree(items); 22724 this.restore(); 22725 } 22726 22727 loadDependencies(operatorList) { 22728 const fnArray = operatorList.fnArray; 22729 const argsArray = operatorList.argsArray; 22730 22731 for (let i = 0, ii = fnArray.length; i < ii; i++) { 22732 if (fnArray[i] !== _util.OPS.dependency) { 22733 continue; 22734 } 22735 22736 for (const obj of argsArray[i]) { 22737 const objsPool = obj.startsWith("g_") ? this.commonObjs : this.objs; 22738 const promise = new Promise(resolve => { 22739 objsPool.get(obj, resolve); 22740 }); 22741 this.current.dependencies.push(promise); 22742 } 22743 } 22744 22745 return Promise.all(this.current.dependencies); 22746 } 22747 22748 transform(a, b, c, d, e, f) { 22749 const transformMatrix = [a, b, c, d, e, f]; 22750 this.transformMatrix = _util.Util.transform(this.transformMatrix, transformMatrix); 22751 this.tgrp = null; 22752 } 22753 22754 getSVG(operatorList, viewport) { 22755 this.viewport = viewport; 22756 22757 const svgElement = this._initialize(viewport); 22758 22759 return this.loadDependencies(operatorList).then(() => { 22760 this.transformMatrix = _util.IDENTITY_MATRIX; 22761 this.executeOpTree(this.convertOpList(operatorList)); 22762 return svgElement; 22763 }); 22764 } 22765 22766 convertOpList(operatorList) { 22767 const operatorIdMapping = this._operatorIdMapping; 22768 const argsArray = operatorList.argsArray; 22769 const fnArray = operatorList.fnArray; 22770 const opList = []; 22771 22772 for (let i = 0, ii = fnArray.length; i < ii; i++) { 22773 const fnId = fnArray[i]; 22774 opList.push({ 22775 fnId, 22776 fn: operatorIdMapping[fnId], 22777 args: argsArray[i] 22778 }); 22779 } 22780 22781 return opListToTree(opList); 22782 } 22783 22784 executeOpTree(opTree) { 22785 for (const opTreeElement of opTree) { 22786 const fn = opTreeElement.fn; 22787 const fnId = opTreeElement.fnId; 22788 const args = opTreeElement.args; 22789
22790 switch (fnId | 0) { 22791 case _util.OPS.beginText: 22792 this.beginText(); 22793 break; 22794 22795 case _util.OPS.dependency: 22796 break; 22797 22798 case _util.OPS.setLeading: 22799 this.setLeading(args); 22800 break; 22801 22802 case _util.OPS.setLeadingMoveText: 22803 this.setLeadingMoveText(args[0], args[1]); 22804 break; 22805 22806 case _util.OPS.setFont: 22807 this.setFont(args); 22808 break; 22809 22810 case _util.OPS.showText: 22811 this.showText(args[0]); 22812 break; 22813 22814 case _util.OPS.showSpacedText: 22815 this.showText(args[0]); 22816 break; 22817 22818 case _util.OPS.endText: 22819 this.endText(); 22820 break; 22821 22822 case _util.OPS.moveText: 22823 this.moveText(args[0], args[1]); 22824 break; 22825 22826 case _util.OPS.setCharSpacing: 22827 this.setCharSpacing(args[0]); 22828 break; 22829 22830 case _util.OPS.setWordSpacing: 22831 this.setWordSpacing(args[0]); 22832 break; 22833 22834 case _util.OPS.setHScale: 22835 this.setHScale(args[0]); 22836 break; 22837 22838 case _util.OPS.setTextMatrix: 22839 this.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]); 22840 break; 22841 22842 case _util.OPS.setTextRise: 22843 this.setTextRise(args[0]); 22844 break; 22845 22846 case _util.OPS.setTextRenderingMode: 22847 this.setTextRenderingMode(args[0]); 22848 break; 22849 22850 case _util.OPS.setLineWidth: 22851 this.setLineWidth(args[0]); 22852 break; 22853 22854 case _util.OPS.setLineJoin: 22855 this.setLineJoin(args[0]); 22856 break; 22857 22858 case _util.OPS.setLineCap: 22859 this.setLineCap(args[0]); 22860 break; 22861 22862 case _util.OPS.setMiterLimit: 22863 this.setMiterLimit(args[0]); 22864 break; 22865 22866 case _util.OPS.setFillRGBColor: 22867 this.setFillRGBColor(args[0], args[1], args[2]); 22868 break; 22869 22870 case _util.OPS.setStrokeRGBColor: 22871 this.setStrokeRGBColor(args[0], args[1], args[2]); 22872 break; 22873 22874 case _util.OPS.setStrokeColorN: 22875 this.setStrokeColorN(args); 22876 break; 22877 22878 case _util.OPS.setFillColorN: 22879 this.setFillColorN(args); 22880 break; 22881 22882 case _util.OPS.shadingFill: 22883 this.shadingFill(args[0]); 22884 break; 22885 22886 case _util.OPS.setDash: 22887 this.setDash(args[0], args[1]); 22888 break; 22889 22890 case _util.OPS.setRenderingIntent: 22891 this.setRenderingIntent(args[0]); 22892 break; 22893 22894 case _util.OPS.setFlatness: 22895 this.setFlatness(args[0]); 22896 break; 22897 22898 case _util.OPS.setGState: 22899 this.setGState(args[0]); 22900 break; 22901 22902 case _util.OPS.fill: 22903 this.fill(); 22904 break; 22905 22906 case _util.OPS.eoFill: 22907 this.eoFill(); 22908 break; 22909 22910 case _util.OPS.stroke: 22911 this.stroke(); 22912 break; 22913 22914 case _util.OPS.fillStroke: 22915 this.fillStroke(); 22916 break; 22917 22918 case _util.OPS.eoFillStroke: 22919 this.eoFillStroke(); 22920 break; 22921 22922 case _util.OPS.clip: 22923 this.clip("nonzero"); 22924 break; 22925 22926 case _util.OPS.eoClip: 22927 this.clip("evenodd"); 22928 break; 22929 22930 case _util.OPS.paintSolidColorImageMask: 22931 this.paintSolidColorImageMask(); 22932 break; 22933 22934 case _util.OPS.paintJpegXObject: 22935 this.paintJpegXObject(args[0], args[1], args[2]); 22936 break; 22937 22938 case _util.OPS.paintImageXObject: 22939 this.paintImageXObject(args[0]); 22940 break; 22941 22942 case _util.OPS.paintInlineImageXObject: 22943 this.paintInlineImageXObject(args[0]); 22944 break; 22945 22946 case _util.OPS.paintImageMaskXObject: 22947 this.paintImageMaskXObject(args[0]); 22948 break; 22949 22950 case _util.OPS.paintFormXObjectBegin: 22951 this.paintFormXObjectBegin(args[0], args[1]); 22952 break; 22953 22954 case _util.OPS.paintFormXObjectEnd: 22955 this.paintFormXObjectEnd(); 22956 break; 22957 22958 case _util.OPS.closePath: 22959 this.closePath(); 22960 break; 22961 22962 case _util.OPS.closeStroke: 22963 this.closeStroke(); 22964 break; 22965 22966 case _util.OPS.closeFillStroke: 22967 this.closeFillStroke(); 22968 break; 22969 22970 case _util.OPS.closeEOFillStroke: 22971 this.closeEOFillStroke(); 22972 break; 22973 22974 case _util.OPS.nextLine: 22975 this.nextLine(); 22976 break; 22977 22978 case _util.OPS.transform: 22979 this.transform(args[0], args[1], args[2], args[3], args[4], args[5]); 22980 break; 22981 22982 case _util.OPS.constructPath: 22983 this.constructPath(args[0], args[1]); 22984 break; 22985 22986 case _util.OPS.endPath: 22987 this.endPath(); 22988 break; 22989 22990 case 92: 22991 this.group(opTreeElement.items); 22992 break; 22993 22994 default: 22995 (0, _util.warn)(`Unimplemented operator ${fn}`); 22996 break; 22997 } 22998 } 22999 } 23000 23001 setWordSpacing(wordSpacing) { 23002 this.current.wordSpacing = wordSpacing; 23003 } 23004 23005 setCharSpacing(charSpacing) { 23006 this.current.charSpacing = charSpacing; 23007 } 23008 23009 nextLine() { 23010 this.moveText(0, this.current.leading); 23011 } 23012 23013 setTextMatrix(a, b, c, d, e, f) { 23014 const current = this.current; 23015 current.textMatrix = current.lineMatrix = [a, b, c, d, e, f]; 23016 current.textMatrixScale = Math.sqrt(a * a + b * b); 23017 current.x = current.lineX = 0; 23018 current.y = current.lineY = 0; 23019 current.xcoords = []; 23020 current.tspan = this.svgFactory.createElement("svg:tspan"); 23021 current.tspan.setAttributeNS(null, "font-family", current.fontFamily); 23022 current.tspan.setAttributeNS(null, "font-size", `${pf(current.fontSize)}px`); 23023 current.tspan.setAttributeNS(null, "y", pf(-current.y)); 23024 current.txtElement = this.svgFactory.createElement("svg:text"); 23025 current.txtElement.appendChild(current.tspan); 23026 } 23027 23028 beginText() { 23029 const current = this.current; 23030 current.x = current.lineX = 0; 23031 current.y = current.lineY = 0; 23032 current.textMatrix = _util.IDENTITY_MATRIX; 23033 current.lineMatrix = _util.IDENTITY_MATRIX; 23034 current.textMatrixScale = 1; 23035 current.tspan = this.svgFactory.createElement("svg:tspan"); 23036 current.txtElement = this.svgFactory.createElement("svg:text"); 23037 current.txtgrp = this.svgFactory.createElement("svg:g"); 23038 current.xcoords = []; 23039 } 23040 23041 moveText(x, y) { 23042 const current = this.current; 23043 current.x = current.lineX += x; 23044 current.y = current.lineY += y; 23045 current.xcoords = []; 23046 current.tspan = this.svgFactory.createElement("svg:tspan"); 23047 current.tspan.setAttributeNS(null, "font-family", current.fontFamily); 23048 current.tspan.setAttributeNS(null, "font-size", `${pf(current.fontSize)}px`); 23049 current.tspan.setAttributeNS(null, "y", pf(-current.y)); 23050 } 23051 23052 showText(glyphs) { 23053 const current = this.current; 23054 const font = current.font; 23055 const fontSize = current.fontSize; 23056 23057 if (fontSize === 0) { 23058 return; 23059 } 23060 23061 const charSpacing = current.charSpacing; 23062 const wordSpacing = current.wordSpacing; 23063 const fontDirection = current.fontDirection; 23064 const textHScale = current.textHScale * fontDirection; 23065 const vertical = font.vertical; 23066 const widthAdvanceScale = fontSize * current.fontMatrix[0]; 23067 let x = 0; 23068 23069 for (const glyph of glyphs) { 23070 if (glyph === null) { 23071 x += fontDirection * wordSpacing; 23072 continue; 23073 }
23073 else if ((0, _util.isNum)(glyph)) { 23074 x += -glyph * fontSize * 0.001; 23075 continue; 23076 } 23077 23078 const width = glyph.width; 23079 const character = glyph.fontChar; 23080 const spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing; 23081 const charWidth = width * widthAdvanceScale + spacing * fontDirection; 23082 23083 if (!glyph.isInFont && !font.missingFile) { 23084 x += charWidth; 23085 continue; 23086 } 23087 23088 current.xcoords.push(current.x + x); 23089 current.tspan.textContent += character; 23090 x += charWidth; 23091 } 23092 23093 if (vertical) { 23094 current.y -= x * textHScale; 23095 } else { 23096 current.x += x * textHScale; 23097 } 23098 23099 current.tspan.setAttributeNS(null, "x", current.xcoords.map(pf).join(" ")); 23100 current.tspan.setAttributeNS(null, "y", pf(-current.y)); 23101 current.tspan.setAttributeNS(null, "font-family", current.fontFamily); 23102 current.tspan.setAttributeNS(null, "font-size", `${pf(current.fontSize)}px`); 23103 23104 if (current.fontStyle !== SVG_DEFAULTS.fontStyle) { 23105 current.tspan.setAttributeNS(null, "font-style", current.fontStyle); 23106 } 23107 23108 if (current.fontWeight !== SVG_DEFAULTS.fontWeight) { 23109 current.tspan.setAttributeNS(null, "font-weight", current.fontWeight); 23110 } 23111 23112 const fillStrokeMode = current.textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK; 23113 23114 if (fillStrokeMode === _util.TextRenderingMode.FILL || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { 23115 if (current.fillColor !== SVG_DEFAULTS.fillColor) { 23116 current.tspan.setAttributeNS(null, "fill", current.fillColor); 23117 } 23118 23119 if (current.fillAlpha < 1) { 23120 current.tspan.setAttributeNS(null, "fill-opacity", current.fillAlpha); 23121 } 23122 } else if (current.textRenderingMode === _util.TextRenderingMode.ADD_TO_PATH) { 23123 current.tspan.setAttributeNS(null, "fill", "transparent"); 23124 } else { 23125 current.tspan.setAttributeNS(null, "fill", "none"); 23126 } 23127 23128 if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { 23129 const lineWidthScale = 1 / (current.textMatrixScale || 1); 23130 23131 this._setStrokeAttributes(current.tspan, lineWidthScale); 23132 } 23133 23134 let textMatrix = current.textMatrix; 23135 23136 if (current.textRise !== 0) { 23137 textMatrix = textMatrix.slice(); 23138 textMatrix[5] += current.textRise; 23139 } 23140 23141 current.txtElement.setAttributeNS(null, "transform", `${pm(textMatrix)} scale(${pf(textHScale)}, -1)`); 23142 current.txtElement.setAttributeNS(XML_NS, "xml:space", "preserve"); 23143 current.txtElement.appendChild(current.tspan); 23144 current.txtgrp.appendChild(current.txtElement); 23145 23146 this._ensureTransformGroup().appendChild(current.txtElement); 23147 } 23148 23149 setLeadingMoveText(x, y) { 23150 this.setLeading(-y); 23151 this.moveText(x, y); 23152 } 23153 23154 addFontStyle(fontObj) { 23155 if (!this.cssStyle) { 23156 this.cssStyle = this.svgFactory.createElement("svg:style"); 23157 this.cssStyle.setAttributeNS(null, "type", "text/css"); 23158 this.defs.appendChild(this.cssStyle); 23159 } 23160 23161 const url = (0, _util.createObjectURL)(fontObj.data, fontObj.mimetype, this.forceDataSchema); 23162 this.cssStyle.textContent += `@font-face { font-family: "${fontObj.loadedName}";` + ` src: url(${url}); }\n`; 23163 } 23164 23165 setFont(details) { 23166 const current = this.current; 23167 const fontObj = this.commonObjs.get(details[0]); 23168 let size = details[1]; 23169 current.font = fontObj; 23170 23171 if (this.embedFonts && fontObj.data && !this.embeddedFonts[fontObj.loadedName]) { 23172 this.addFontStyle(fontObj); 23173 this.embeddedFonts[fontObj.loadedName] = fontObj; 23174 } 23175 23176 current.fontMatrix = fontObj.fontMatrix ? fontObj.fontMatrix : _util.FONT_IDENTITY_MATRIX; 23177 let bold = "normal"; 23178 23179 if (fontObj.black) { 23180 bold = "900"; 23181 } else if (fontObj.bold) { 23182 bold = "bold"; 23183 } 23184 23185 const italic = fontObj.italic ? "italic" : "normal"; 23186 23187 if (size < 0) { 23188 size = -size; 23189 current.fontDirection = -1; 23190 } else { 23191 current.fontDirection = 1; 23192 } 23193 23194 current.fontSize = size; 23195 current.fontFamily = fontObj.loadedName; 23196 current.fontWeight = bold; 23197 current.fontStyle = italic; 23198 current.tspan = this.svgFactory.createElement("svg:tspan"); 23199 current.tspan.setAttributeNS(null, "y", pf(-current.y)); 23200 current.xcoords = []; 23201 } 23202 23203 endText() { 23204 const current = this.current; 23205 23206 if (current.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG && current.txtElement && current.txtElement.hasChildNodes()) { 23207 current.element = current.txtElement; 23208 this.clip("nonzero"); 23209 this.endPath(); 23210 } 23211 } 23212 23213 setLineWidth(width) { 23214 if (width > 0) { 23215 this.current.lineWidth = width; 23216 } 23217 } 23218 23219 setLineCap(style) { 23220 this.current.lineCap = LINE_CAP_STYLES[style]; 23221 } 23222 23223 setLineJoin(style) { 23224 this.current.lineJoin = LINE_JOIN_STYLES[style]; 23225 } 23226 23227 setMiterLimit(limit) { 23228 this.current.miterLimit = limit; 23229 } 23230 23231 setStrokeAlpha(strokeAlpha) { 23232 this.current.strokeAlpha = strokeAlpha; 23233 } 23234 23235 setStrokeRGBColor(r, g, b) { 23236 this.current.strokeColor = _util.Util.makeCssRgb(r, g, b); 23237 } 23238 23239 setFillAlpha(fillAlpha) { 23240 this.current.fillAlpha = fillAlpha; 23241 } 23242 23243 setFillRGBColor(r, g, b) { 23244 this.current.fillColor = _util.Util.makeCssRgb(r, g, b); 23245 this.current.tspan = this.svgFactory.createElement("svg:tspan"); 23246 this.current.xcoords = []; 23247 } 23248 23249 setStrokeColorN(args) { 23250 this.current.strokeColor = this._makeColorN_Pattern(args); 23251 } 23252 23253 setFillColorN(args) { 23254 this.current.fillColor = this._makeColorN_Pattern(args); 23255 } 23256 23257 shadingFill(args) { 23258 const width = this.viewport.width; 23259 const height = this.viewport.height; 23260 23261 const inv = _util.Util.inverseTransform(this.transformMatrix); 23262 23263 const bl = _util.Util.applyTransform([0, 0], inv); 23264 23265 const br = _util.Util.applyTransform([0, height], inv); 23266 23267 const ul = _util.Util.applyTransform([width, 0], inv); 23268 23269 const ur = _util.Util.applyTransform([width, height], inv); 23270 23271 const x0 = Math.min(bl[0], br[0], ul[0], ur[0]); 23272 const y0 = Math.min(bl[1], br[1], ul[1], ur[1]); 23273 const x1 = Math.max(bl[0], br[0], ul[0], ur[0]); 23274 const y1 = Math.max(bl[1], br[1], ul[1], ur[1]); 23275 const rect = this.svgFactory.createElement("svg:rect"); 23276 rect.setAttributeNS(null, "x", x0); 23277 rect.setAttributeNS(null, "y", y0); 23278 rect.setAttributeNS(null, "width", x1 - x0); 23279 rect.setAttributeNS(null, "height", y1 - y0); 23280 rect.setAttributeNS(null, "fill", this._makeShadingPattern(args)); 23281 23282 this._ensureTransformGroup().appendChild(rect); 23283 } 23284 23285 _makeColorN_Pattern(args) { 23286 if (args[0] === "TilingPattern") { 23287 return this._makeTilingPattern(args); 23288 } 23289 23290 return this._makeShadingPattern(args); 23291 } 23292 23293 _makeTilingPattern(args) { 23294 const color = args[1]; 23295 const operatorList = args[2]; 23296 const matrix = args[3] || _util.IDENTITY_MATRIX; 23297 const [x0, y0, x1, y1] = args[4]; 23298 const xstep = args[5]; 23299 const ystep = args[6]; 23300 const paintType = args[7]; 23301 const tilingId = `shading${shadingCount++}`; 23302
23303 const [tx0, ty0] = _util.Util.applyTransform([x0, y0], matrix); 23304 23305 const [tx1, ty1] = _util.Util.applyTransform([x1, y1], matrix); 23306 23307 const [xscale, yscale] = _util.Util.singularValueDecompose2dScale(matrix); 23308 23309 const txstep = xstep * xscale; 23310 const tystep = ystep * yscale; 23311 const tiling = this.svgFactory.createElement("svg:pattern"); 23312 tiling.setAttributeNS(null, "id", tilingId); 23313 tiling.setAttributeNS(null, "patternUnits", "userSpaceOnUse"); 23314 tiling.setAttributeNS(null, "width", txstep); 23315 tiling.setAttributeNS(null, "height", tystep); 23316 tiling.setAttributeNS(null, "x", `${tx0}`); 23317 tiling.setAttributeNS(null, "y", `${ty0}`); 23318 const svg = this.svg; 23319 const transformMatrix = this.transformMatrix; 23320 const fillColor = this.current.fillColor; 23321 const strokeColor = this.current.strokeColor; 23322 const bbox = this.svgFactory.create(tx1 - tx0, ty1 - ty0); 23323 this.svg = bbox; 23324 this.transformMatrix = matrix; 23325 23326 if (paintType === 2) { 23327 const cssColor = _util.Util.makeCssRgb(...color); 23328 23329 this.current.fillColor = cssColor; 23330 this.current.strokeColor = cssColor; 23331 } 23332 23333 this.executeOpTree(this.convertOpList(operatorList)); 23334 this.svg = svg; 23335 this.transformMatrix = transformMatrix; 23336 this.current.fillColor = fillColor; 23337 this.current.strokeColor = strokeColor; 23338 tiling.appendChild(bbox.childNodes[0]); 23339 this.defs.appendChild(tiling); 23340 return `url(#${tilingId})`; 23341 } 23342 23343 _makeShadingPattern(args) { 23344 switch (args[0]) { 23345 case "RadialAxial": 23346 const shadingId = `shading${shadingCount++}`; 23347 const colorStops = args[3]; 23348 let gradient; 23349 23350 switch (args[1]) { 23351 case "axial": 23352 const point0 = args[4]; 23353 const point1 = args[5]; 23354 gradient = this.svgFactory.createElement("svg:linearGradient"); 23355 gradient.setAttributeNS(null, "id", shadingId); 23356 gradient.setAttributeNS(null, "gradientUnits", "userSpaceOnUse"); 23357 gradient.setAttributeNS(null, "x1", point0[0]); 23358 gradient.setAttributeNS(null, "y1", point0[1]); 23359 gradient.setAttributeNS(null, "x2", point1[0]); 23360 gradient.setAttributeNS(null, "y2", point1[1]); 23361 break; 23362 23363 case "radial": 23364 const focalPoint = args[4]; 23365 const circlePoint = args[5]; 23366 const focalRadius = args[6]; 23367 const circleRadius = args[7]; 23368 gradient = this.svgFactory.createElement("svg:radialGradient"); 23369 gradient.setAttributeNS(null, "id", shadingId); 23370 gradient.setAttributeNS(null, "gradientUnits", "userSpaceOnUse"); 23371 gradient.setAttributeNS(null, "cx", circlePoint[0]); 23372 gradient.setAttributeNS(null, "cy", circlePoint[1]); 23373 gradient.setAttributeNS(null, "r", circleRadius); 23374 gradient.setAttributeNS(null, "fx", focalPoint[0]); 23375 gradient.setAttributeNS(null, "fy", focalPoint[1]); 23376 gradient.setAttributeNS(null, "fr", focalRadius); 23377 break; 23378 23379 default: 23380 throw new Error(`Unknown RadialAxial type: ${args[1]}`); 23381 } 23382 23383 for (const colorStop of colorStops) { 23384 const stop = this.svgFactory.createElement("svg:stop"); 23385 stop.setAttributeNS(null, "offset", colorStop[0]); 23386 stop.setAttributeNS(null, "stop-color", colorStop[1]); 23387 gradient.appendChild(stop); 23388 } 23389 23390 this.defs.appendChild(gradient); 23391 return `url(#${shadingId})`; 23392 23393 case "Mesh": 23394 (0, _util.warn)("Unimplemented pattern Mesh"); 23395 return null; 23396 23397 case "Dummy": 23398 return "hotpink"; 23399 23400 default: 23401 throw new Error(`Unknown IR type: ${args[0]}`); 23402 } 23403 } 23404 23405 setDash(dashArray, dashPhase) { 23406 this.current.dashArray = dashArray; 23407 this.current.dashPhase = dashPhase; 23408 } 23409 23410 constructPath(ops, args) { 23411 const current = this.current; 23412 let x = current.x, 23413 y = current.y; 23414 let d = []; 23415 let j = 0; 23416 23417 for (const op of ops) { 23418 switch (op | 0) { 23419 case _util.OPS.rectangle: 23420 x = args[j++]; 23421 y = args[j++]; 23422 const width = args[j++]; 23423 const height = args[j++]; 23424 const xw = x + width; 23425 const yh = y + height; 23426 d.push("M", pf(x), pf(y), "L", pf(xw), pf(y), "L", pf(xw), pf(yh), "L", pf(x), pf(yh), "Z"); 23427 break; 23428 23429 case _util.OPS.moveTo: 23430 x = args[j++]; 23431 y = args[j++]; 23432 d.push("M", pf(x), pf(y)); 23433 break; 23434 23435 case _util.OPS.lineTo: 23436 x = args[j++]; 23437 y = args[j++]; 23438 d.push("L", pf(x), pf(y)); 23439 break; 23440 23441 case _util.OPS.curveTo: 23442 x = args[j + 4]; 23443 y = args[j + 5]; 23444 d.push("C", pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), pf(args[j + 3]), pf(x), pf(y)); 23445 j += 6; 23446 break; 23447 23448 case _util.OPS.curveTo2: 23449 d.push("C", pf(x), pf(y), pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), pf(args[j + 3])); 23450 x = args[j + 2]; 23451 y = args[j + 3]; 23452 j += 4; 23453 break; 23454 23455 case _util.OPS.curveTo3: 23456 x = args[j + 2]; 23457 y = args[j + 3]; 23458 d.push("C", pf(args[j]), pf(args[j + 1]), pf(x), pf(y), pf(x), pf(y)); 23459 j += 4; 23460 break; 23461 23462 case _util.OPS.closePath: 23463 d.push("Z"); 23464 break; 23465 } 23466 } 23467 23468 d = d.join(" "); 23469 23470 if (current.path && ops.length > 0 && ops[0] !== _util.OPS.rectangle && ops[0] !== _util.OPS.moveTo) { 23471 d = current.path.getAttributeNS(null, "d") + d; 23472 } else { 23473 current.path = this.svgFactory.createElement("svg:path"); 23474 23475 this._ensureTransformGroup().appendChild(current.path); 23476 } 23477 23478 current.path.setAttributeNS(null, "d", d); 23479 current.path.setAttributeNS(null, "fill", "none"); 23480 current.element = current.path; 23481 current.setCurrentPoint(x, y); 23482 } 23483 23484 endPath() { 23485 const current = this.current; 23486 current.path = null; 23487 23488 if (!this.pendingClip) { 23489 return; 23490 } 23491 23492 if (!current.element) { 23493 this.pendingClip = null; 23494 return; 23495 } 23496 23497 const clipId = `clippath${clipCount++}`; 23498 const clipPath = this.svgFactory.createElement("svg:clipPath"); 23499 clipPath.setAttributeNS(null, "id", clipId); 23500 clipPath.setAttributeNS(null, "transform", pm(this.transformMatrix)); 23501 const clipElement = current.element.cloneNode(true); 23502 23503 if (this.pendingClip === "evenodd") { 23504 clipElement.setAttributeNS(null, "clip-rule", "evenodd"); 23505 } else { 23506 clipElement.setAttributeNS(null, "clip-rule", "nonzero"); 23507 } 23508 23509 this.pendingClip = null; 23510 clipPath.appendChild(clipElement); 23511 this.defs.appendChild(clipPath); 23512 23513 if (current.activeClipUrl) { 23514 current.clipGroup = null; 23515 this.extraStack.forEach(function (prev) { 23516 prev.clipGroup = null; 23517 }); 23518 clipPath.setAttributeNS(null, "clip-path", current.activeClipUrl); 23519 } 23520 23521 current.activeClipUrl = `url(#${clipId})`; 23522 this.tgrp = null; 23523 } 23524 23525 clip(type) { 23526 this.pendingClip = type; 23527 } 23528 23529 closePath() { 23530 const current = this.current; 23531 23532 if (current.path) { 23533 const d = `${current.path.getAttributeNS(null, "d")}Z`; 23534 current.path.setAttributeNS(null, "d", d); 23535 } 23536 } 23537 23538 setLeading(leading) { 23539 this.current.leading = -leading; 23540 } 23541 23542 setTextRise(textRise) { 23543 this.current.textRise = textRise; 23544 } 23545 23546 setTextRenderingMode(textRenderingMode) { 23547 this.current.textRenderingMode = textRenderingMode; 23548 } 23549 23550 setHScale(scale) { 23551 this.current.textHScale = scale / 100; 23552 } 23553
23554 setRenderingIntent(intent) {} 23555 23556 setFlatness(flatness) {} 23557 23558 setGState(states) { 23559 for (const [key, value] of states) { 23560 switch (key) { 23561 case "LW": 23562 this.setLineWidth(value); 23563 break; 23564 23565 case "LC": 23566 this.setLineCap(value); 23567 break; 23568 23569 case "LJ": 23570 this.setLineJoin(value); 23571 break; 23572 23573 case "ML": 23574 this.setMiterLimit(value); 23575 break; 23576 23577 case "D": 23578 this.setDash(value[0], value[1]); 23579 break; 23580 23581 case "RI": 23582 this.setRenderingIntent(value); 23583 break; 23584 23585 case "FL": 23586 this.setFlatness(value); 23587 break; 23588 23589 case "Font": 23590 this.setFont(value); 23591 break; 23592 23593 case "CA": 23594 this.setStrokeAlpha(value); 23595 break; 23596 23597 case "ca": 23598 this.setFillAlpha(value); 23599 break; 23600 23601 default: 23602 (0, _util.warn)(`Unimplemented graphic state operator ${key}`); 23603 break; 23604 } 23605 } 23606 } 23607 23608 fill() { 23609 const current = this.current; 23610 23611 if (current.element) { 23612 current.element.setAttributeNS(null, "fill", current.fillColor); 23613 current.element.setAttributeNS(null, "fill-opacity", current.fillAlpha); 23614 this.endPath(); 23615 } 23616 } 23617 23618 stroke() { 23619 const current = this.current; 23620 23621 if (current.element) { 23622 this._setStrokeAttributes(current.element); 23623 23624 current.element.setAttributeNS(null, "fill", "none"); 23625 this.endPath(); 23626 } 23627 } 23628 23629 _setStrokeAttributes(element, lineWidthScale = 1) { 23630 const current = this.current; 23631 let dashArray = current.dashArray; 23632 23633 if (lineWidthScale !== 1 && dashArray.length > 0) { 23634 dashArray = dashArray.map(function (value) { 23635 return lineWidthScale * value; 23636 }); 23637 } 23638 23639 element.setAttributeNS(null, "stroke", current.strokeColor); 23640 element.setAttributeNS(null, "stroke-opacity", current.strokeAlpha); 23641 element.setAttributeNS(null, "stroke-miterlimit", pf(current.miterLimit)); 23642 element.setAttributeNS(null, "stroke-linecap", current.lineCap); 23643 element.setAttributeNS(null, "stroke-linejoin", current.lineJoin); 23644 element.setAttributeNS(null, "stroke-width", pf(lineWidthScale * current.lineWidth) + "px"); 23645 element.setAttributeNS(null, "stroke-dasharray", dashArray.map(pf).join(" ")); 23646 element.setAttributeNS(null, "stroke-dashoffset", pf(lineWidthScale * current.dashPhase) + "px"); 23647 } 23648 23649 eoFill() { 23650 if (this.current.element) { 23651 this.current.element.setAttributeNS(null, "fill-rule", "evenodd"); 23652 } 23653 23654 this.fill(); 23655 } 23656 23657 fillStroke() { 23658 this.stroke(); 23659 this.fill(); 23660 } 23661 23662 eoFillStroke() { 23663 if (this.current.element) { 23664 this.current.element.setAttributeNS(null, "fill-rule", "evenodd"); 23665 } 23666 23667 this.fillStroke(); 23668 } 23669 23670 closeStroke() { 23671 this.closePath(); 23672 this.stroke(); 23673 } 23674 23675 closeFillStroke() { 23676 this.closePath(); 23677 this.fillStroke(); 23678 } 23679 23680 closeEOFillStroke() { 23681 this.closePath(); 23682 this.eoFillStroke(); 23683 } 23684 23685 paintSolidColorImageMask() { 23686 const rect = this.svgFactory.createElement("svg:rect"); 23687 rect.setAttributeNS(null, "x", "0"); 23688 rect.setAttributeNS(null, "y", "0"); 23689 rect.setAttributeNS(null, "width", "1px"); 23690 rect.setAttributeNS(null, "height", "1px"); 23691 rect.setAttributeNS(null, "fill", this.current.fillColor); 23692 23693 this._ensureTransformGroup().appendChild(rect); 23694 } 23695 23696 paintJpegXObject(objId, w, h) { 23697 const imgObj = this.objs.get(objId); 23698 const imgEl = this.svgFactory.createElement("svg:image"); 23699 imgEl.setAttributeNS(XLINK_NS, "xlink:href", imgObj.src); 23700 imgEl.setAttributeNS(null, "width", pf(w)); 23701 imgEl.setAttributeNS(null, "height", pf(h)); 23702 imgEl.setAttributeNS(null, "x", "0"); 23703 imgEl.setAttributeNS(null, "y", pf(-h)); 23704 imgEl.setAttributeNS(null, "transform", `scale(${pf(1 / w)} ${pf(-1 / h)})`); 23705 23706 this._ensureTransformGroup().appendChild(imgEl); 23707 } 23708 23709 paintImageXObject(objId) { 23710 const imgData = this.objs.get(objId); 23711 23712 if (!imgData) { 23713 (0, _util.warn)(`Dependent image with object ID ${objId} is not ready yet`); 23714 return; 23715 } 23716 23717 this.paintInlineImageXObject(imgData); 23718 } 23719 23720 paintInlineImageXObject(imgData, mask) { 23721 const width = imgData.width; 23722 const height = imgData.height; 23723 const imgSrc = convertImgDataToPng(imgData, this.forceDataSchema, !!mask); 23724 const cliprect = this.svgFactory.createElement("svg:rect"); 23725 cliprect.setAttributeNS(null, "x", "0"); 23726 cliprect.setAttributeNS(null, "y", "0"); 23727 cliprect.setAttributeNS(null, "width", pf(width)); 23728 cliprect.setAttributeNS(null, "height", pf(height)); 23729 this.current.element = cliprect; 23730 this.clip("nonzero"); 23731 const imgEl = this.svgFactory.createElement("svg:image"); 23732 imgEl.setAttributeNS(XLINK_NS, "xlink:href", imgSrc); 23733 imgEl.setAttributeNS(null, "x", "0"); 23734 imgEl.setAttributeNS(null, "y", pf(-height)); 23735 imgEl.setAttributeNS(null, "width", pf(width) + "px"); 23736 imgEl.setAttributeNS(null, "height", pf(height) + "px"); 23737 imgEl.setAttributeNS(null, "transform", `scale(${pf(1 / width)} ${pf(-1 / height)})`); 23738 23739 if (mask) { 23740 mask.appendChild(imgEl); 23741 } else { 23742 this._ensureTransformGroup().appendChild(imgEl); 23743 } 23744 } 23745 23746 paintImageMaskXObject(imgData) { 23747 const current = this.current; 23748 const width = imgData.width; 23749 const height = imgData.height; 23750 const fillColor = current.fillColor; 23751 current.maskId = `mask${maskCount++}`; 23752 const mask = this.svgFactory.createElement("svg:mask"); 23753 mask.setAttributeNS(null, "id", current.maskId); 23754 const rect = this.svgFactory.createElement("svg:rect"); 23755 rect.setAttributeNS(null, "x", "0"); 23756 rect.setAttributeNS(null, "y", "0"); 23757 rect.setAttributeNS(null, "width", pf(width)); 23758 rect.setAttributeNS(null, "height", pf(height)); 23759 rect.setAttributeNS(null, "fill", fillColor); 23760 rect.setAttributeNS(null, "mask", `url(#${current.maskId})`); 23761 this.defs.appendChild(mask); 23762 23763 this._ensureTransformGroup().appendChild(rect); 23764 23765 this.paintInlineImageXObject(imgData, mask); 23766 } 23767 23768 paintFormXObjectBegin(matrix, bbox) { 23769 if (Array.isArray(matrix) && matrix.length === 6) {
23770 this.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]); 23771 } 23772 23773 if (bbox) { 23774 const width = bbox[2] - bbox[0]; 23775 const height = bbox[3] - bbox[1]; 23776 const cliprect = this.svgFactory.createElement("svg:rect"); 23777 cliprect.setAttributeNS(null, "x", bbox[0]); 23778 cliprect.setAttributeNS(null, "y", bbox[1]); 23779 cliprect.setAttributeNS(null, "width", pf(width)); 23780 cliprect.setAttributeNS(null, "height", pf(height)); 23781 this.current.element = cliprect; 23782 this.clip("nonzero"); 23783 this.endPath(); 23784 } 23785 } 23786 23787 paintFormXObjectEnd() {} 23788 23789 _initialize(viewport) { 23790 const svg = this.svgFactory.create(viewport.width, viewport.height); 23791 const definitions = this.svgFactory.createElement("svg:defs"); 23792 svg.appendChild(definitions); 23793 this.defs = definitions; 23794 const rootGroup = this.svgFactory.createElement("svg:g"); 23795 rootGroup.setAttributeNS(null, "transform", pm(viewport.transform)); 23796 svg.appendChild(rootGroup); 23797 this.svg = rootGroup; 23798 return svg; 23799 } 23800 23801 _ensureClipGroup() { 23802 if (!this.current.clipGroup) { 23803 const clipGroup = this.svgFactory.createElement("svg:g"); 23804 clipGroup.setAttributeNS(null, "clip-path", this.current.activeClipUrl); 23805 this.svg.appendChild(clipGroup); 23806 this.current.clipGroup = clipGroup; 23807 } 23808 23809 return this.current.clipGroup; 23810 } 23811 23812 _ensureTransformGroup() { 23813 if (!this.tgrp) { 23814 this.tgrp = this.svgFactory.createElement("svg:g"); 23815 this.tgrp.setAttributeNS(null, "transform", pm(this.transformMatrix)); 23816 23817 if (this.current.activeClipUrl) { 23818 this._ensureClipGroup().appendChild(this.tgrp); 23819 } else { 23820 this.svg.appendChild(this.tgrp); 23821 } 23822 } 23823 23824 return this.tgrp; 23825 } 23826 23827 }; 23828} 23829 23830/***/ }), 23831/* 19 */ 23832/***/ (function(module, exports, __w_pdfjs_require__) { 23833 23834"use strict"; 23835 23836 23837Object.defineProperty(exports, "__esModule", { 23838 value: true 23839}); 23840exports.PDFNodeStream = void 0; 23841 23842var _util = __w_pdfjs_require__(1); 23843 23844var _network_utils = __w_pdfjs_require__(20); 23845 23846const fs = require("fs"); 23847 23848const http = require("http"); 23849 23850const https = require("https"); 23851 23852const url = require("url"); 23853
23854const fileUriRegex = /^file:\/\/\/[a-zA-Z]:\//; 23855 23856function parseUrl(sourceUrl) { 23857 const parsedUrl = url.parse(sourceUrl); 23858 23859 if (parsedUrl.protocol === "file:" || parsedUrl.host) { 23860 return parsedUrl; 23861 } 23862 23863 if (/^[a-z]:[/\\]/i.test(sourceUrl)) { 23864 return url.parse(`file:///${sourceUrl}`); 23865 } 23866 23867 if (!parsedUrl.host) { 23868 parsedUrl.protocol = "file:"; 23869 } 23870 23871 return parsedUrl; 23872} 23873 23874class PDFNodeStream { 23875 constructor(source) { 23876 this.source = source; 23877 this.url = parseUrl(source.url); 23878 this.isHttp = this.url.protocol === "http:" || this.url.protocol === "https:"; 23879 this.isFsUrl = this.url.protocol === "file:"; 23880 this.httpHeaders = this.isHttp && source.httpHeaders || {}; 23881 this._fullRequestReader = null; 23882 this._rangeRequestReaders = []; 23883 } 23884 23885 get _progressiveDataLength() { 23886 return this._fullRequestReader ? this._fullRequestReader._loaded : 0; 23887 } 23888 23889 getFullReader() { 23890 (0, _util.assert)(!this._fullRequestReader); 23891 this._fullRequestReader = this.isFsUrl ? new PDFNodeStreamFsFullReader(this) : new PDFNodeStreamFullReader(this); 23892 return this._fullRequestReader; 23893 } 23894 23895 getRangeReader(start, end) { 23896 if (end <= this._progressiveDataLength) { 23897 return null; 23898 } 23899 23900 const rangeReader = this.isFsUrl ? new PDFNodeStreamFsRangeReader(this, start, end) : new PDFNodeStreamRangeReader(this, start, end); 23901 23902 this._rangeRequestReaders.push(rangeReader); 23903 23904 return rangeReader; 23905 } 23906 23907 cancelAllRequests(reason) { 23908 if (this._fullRequestReader) { 23909 this._fullRequestReader.cancel(reason); 23910 } 23911 23912 const readers = this._rangeRequestReaders.slice(0); 23913 23914 readers.forEach(function (reader) { 23915 reader.cancel(reason); 23916 }); 23917 } 23918 23919} 23920 23921exports.PDFNodeStream = PDFNodeStream; 23922 23923class BaseFullReader { 23924 constructor(stream) { 23925 this._url = stream.url; 23926 this._done = false; 23927 this._storedError = null; 23928 this.onProgress = null; 23929 const source = stream.source; 23930 this._contentLength = source.length; 23931 this._loaded = 0; 23932 this._filename = null; 23933 this._disableRange = source.disableRange || false; 23934 this._rangeChunkSize = source.rangeChunkSize; 23935 23936 if (!this._rangeChunkSize && !this._disableRange) { 23937 this._disableRange = true; 23938 } 23939 23940 this._isStreamingSupported = !source.disableStream; 23941 this._isRangeSupported = !source.disableRange; 23942 this._readableStream = null; 23943 this._readCapability = (0, _util.createPromiseCapability)(); 23944 this._headersCapability = (0, _util.createPromiseCapability)(); 23945 } 23946 23947 get headersReady() { 23948 return this._headersCapability.promise; 23949 } 23950 23951 get filename() { 23952 return this._filename; 23953 } 23954 23955 get contentLength() { 23956 return this._contentLength; 23957 } 23958 23959 get isRangeSupported() { 23960 return this._isRangeSupported; 23961 } 23962 23963 get isStreamingSupported() { 23964 return this._isStreamingSupported; 23965 } 23966 23967 async read() { 23968 await this._readCapability.promise; 23969 23970 if (this._done) { 23971 return { 23972 value: undefined, 23973 done: true 23974 }; 23975 } 23976 23977 if (this._storedError) { 23978 throw this._storedError; 23979 } 23980 23981 const chunk = this._readableStream.read(); 23982 23983 if (chunk === null) { 23984 this._readCapability = (0, _util.createPromiseCapability)(); 23985 return this.read(); 23986 } 23987 23988 this._loaded += chunk.length; 23989 23990 if (this.onProgress) { 23991 this.onProgress({ 23992 loaded: this._loaded, 23993 total: this._contentLength 23994 }); 23995 } 23996 23997 const buffer = new Uint8Array(chunk).buffer; 23998 return { 23999 value: buffer, 24000 done: false 24001 }; 24002 } 24003 24004 cancel(reason) { 24005 if (!this._readableStream) { 24006 this._error(reason); 24007 24008 return; 24009 } 24010 24011 this._readableStream.destroy(reason); 24012 } 24013 24014 _error(reason) { 24015 this._storedError = reason; 24016 24017 this._readCapability.resolve(); 24018 } 24019 24020 _setReadableStream(readableStream) { 24021 this._readableStream = readableStream; 24022 readableStream.on("readable", () => { 24023 this._readCapability.resolve(); 24024 }); 24025 readableStream.on("end", () => { 24026 readableStream.destroy(); 24027 this._done = true; 24028 24029 this._readCapability.resolve(); 24030 }); 24031 readableStream.on("error", reason => { 24032 this._error(reason); 24033 }); 24034 24035 if (!this._isStreamingSupported && this._isRangeSupported) { 24036 this._error(new _util.AbortException("streaming is disabled")); 24037 } 24038 24039 if (this._storedError) { 24040 this._readableStream.destroy(this._storedError); 24041 } 24042 } 24043 24044} 24045 24046class BaseRangeReader { 24047 constructor(stream) { 24048 this._url = stream.url; 24049 this._done = false;
24050 this._storedError = null; 24051 this.onProgress = null; 24052 this._loaded = 0; 24053 this._readableStream = null; 24054 this._readCapability = (0, _util.createPromiseCapability)(); 24055 const source = stream.source; 24056 this._isStreamingSupported = !source.disableStream; 24057 } 24058 24059 get isStreamingSupported() { 24060 return this._isStreamingSupported; 24061 } 24062 24063 async read() { 24064 await this._readCapability.promise; 24065 24066 if (this._done) { 24067 return { 24068 value: undefined, 24069 done: true 24070 }; 24071 } 24072 24073 if (this._storedError) { 24074 throw this._storedError; 24075 } 24076 24077 const chunk = this._readableStream.read(); 24078 24079 if (chunk === null) { 24080 this._readCapability = (0, _util.createPromiseCapability)(); 24081 return this.read(); 24082 } 24083 24084 this._loaded += chunk.length; 24085 24086 if (this.onProgress) { 24087 this.onProgress({ 24088 loaded: this._loaded 24089 }); 24090 } 24091 24092 const buffer = new Uint8Array(chunk).buffer; 24093 return { 24094 value: buffer, 24095 done: false 24096 }; 24097 } 24098 24099 cancel(reason) { 24100 if (!this._readableStream) { 24101 this._error(reason); 24102 24103 return; 24104 } 24105 24106 this._readableStream.destroy(reason); 24107 } 24108 24109 _error(reason) { 24110 this._storedError = reason; 24111 24112 this._readCapability.resolve(); 24113 } 24114 24115 _setReadableStream(readableStream) { 24116 this._readableStream = readableStream; 24117 readableStream.on("readable", () => { 24118 this._readCapability.resolve(); 24119 }); 24120 readableStream.on("end", () => { 24121 readableStream.destroy(); 24122 this._done = true; 24123 24124 this._readCapability.resolve(); 24125 }); 24126 readableStream.on("error", reason => { 24127 this._error(reason); 24128 }); 24129 24130 if (this._storedError) { 24131 this._readableStream.destroy(this._storedError); 24132 } 24133 } 24134 24135} 24136 24137function createRequestOptions(url, headers) { 24138 return { 24139 protocol: url.protocol, 24140 auth: url.auth, 24141 host: url.hostname, 24142 port: url.port, 24143 path: url.path, 24144 method: "GET", 24145 headers 24146 }; 24147} 24148 24149class PDFNodeStreamFullReader extends BaseFullReader { 24150 constructor(stream) { 24151 super(stream); 24152 24153 const handleResponse = response => { 24154 if (response.statusCode === 404) { 24155 const error = new _util.MissingPDFException(`Missing PDF "${this._url}".`); 24156 this._storedError = error; 24157 24158 this._headersCapability.reject(error); 24159 24160 return; 24161 } 24162 24163 this._headersCapability.resolve(); 24164 24165 this._setReadableStream(response); 24166 24167 const getResponseHeader = name => { 24168 return this._readableStream.headers[name.toLowerCase()]; 24169 }; 24170 24171 const { 24172 allowRangeRequests, 24173 suggestedLength 24174 } = (0, _network_utils.validateRangeRequestCapabilities)({ 24175 getResponseHeader, 24176 isHttp: stream.isHttp, 24177 rangeChunkSize: this._rangeChunkSize, 24178 disableRange: this._disableRange 24179 }); 24180 this._isRangeSupported = allowRangeRequests; 24181 this._contentLength = suggestedLength || this._contentLength; 24182 this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader); 24183 }; 24184 24185 this._request = null; 24186 24187 if (this._url.protocol === "http:") { 24188 this._request = http.request(createRequestOptions(this._url, stream.httpHeaders), handleResponse); 24189 } else { 24190 this._request = https.request(createRequestOptions(this._url, stream.httpHeaders), handleResponse); 24191 } 24192 24193 this._request.on("error", reason => { 24194 this._storedError = reason; 24195 24196 this._headersCapability.reject(reason); 24197 }); 24198 24199 this._request.end(); 24200 } 24201 24202} 24203 24204class PDFNodeStreamRangeReader extends BaseRangeReader { 24205 constructor(stream, start, end) { 24206 super(stream); 24207 this._httpHeaders = {}; 24208 24209 for (const property in stream.httpHeaders) { 24210 const value = stream.httpHeaders[property]; 24211 24212 if (typeof value === "undefined") { 24213 continue; 24214 } 24215 24216 this._httpHeaders[property] = value; 24217 } 24218 24219 this._httpHeaders["Range"] = `bytes=${start}-${end - 1}`; 24220 24221 const handleResponse = response => { 24222 if (response.statusCode === 404) { 24223 const error = new _util.MissingPDFException(`Missing PDF "${this._url}".`); 24224 this._storedError = error; 24225 return; 24226 } 24227 24228 this._setReadableStream(response); 24229 }; 24230 24231 this._request = null; 24232 24233 if (this._url.protocol === "http:") { 24234 this._request = http.request(createRequestOptions(this._url, this._httpHeaders), handleResponse); 24235 } else { 24236 this._request = https.request(createRequestOptions(this._url, this._httpHeaders), handleResponse); 24237 } 24238 24239 this._request.on("error", reason => { 24240 this._storedError = reason; 24241 }); 24242 24243 this._request.end(); 24244 } 24245 24246} 24247 24248class PDFNodeStreamFsFullReader extends BaseFullReader { 24249 constructor(stream) { 24250 super(stream); 24251 let path = decodeURIComponent(this._url.path); 24252 24253 if (fileUriRegex.test(this._url.href)) { 24254 path = path.replace(/^\//, ""); 24255 } 24256 24257 fs.lstat(path, (error, stat) => { 24258 if (error) { 24259 if (error.code === "ENOENT") { 24260 error = new _util.MissingPDFException(`Missing PDF "${path}".`); 24261 } 24262 24263 this._storedError = error; 24264 24265 this._headersCapability.reject(error); 24266 24267 return; 24268 } 24269 24270 this._contentLength = stat.size; 24271 24272 this._setReadableStream(fs.createReadStream(path)); 24273 24274 this._headersCapability.resolve(); 24275 }); 24276 } 24277 24278} 24279 24280class PDFNodeStreamFsRangeReader extends BaseRangeReader { 24281 constructor(stream, start, end) { 24282 super(stream); 24283 let path = decodeURIComponent(this._url.path); 24284 24285 if (fileUriRegex.test(this._url.href)) { 24286 path = path.replace(/^\//, ""); 24287 } 24288 24289 this._setReadableStream(fs.createReadStream(path, { 24290 start, 24291 end: end - 1 24292 })); 24293 } 24294 24295} 24296 24297/***/ }), 24298/* 20 */ 24299/***/ (function(module, exports, __w_pdfjs_require__) { 24300 24301"use strict"; 24302 24303 24304Object.defineProperty(exports, "__esModule", { 24305 value: true 24306}); 24307exports.createResponseStatusError = createResponseStatusError; 24308exports.extractFilenameFromHeader = extractFilenameFromHeader; 24309exports.validateRangeRequestCapabilities = validateRangeRequestCapabilities; 24310exports.validateResponseStatus = validateResponseStatus; 24311 24312var _util = __w_pdfjs_require__(1); 24313 24314var _content_disposition = __w_pdfjs_require__(21); 24315 24316function validateRangeRequestCapabilities({ 24317 getResponseHeader, 24318 isHttp, 24319 rangeChunkSize, 24320 disableRange 24321}) { 24322 (0, _util.assert)(rangeChunkSize > 0, "Range chunk size must be larger than zero"); 24323 const returnValues = { 24324 allowRangeRequests: false, 24325 suggestedLength: undefined 24326 }; 24327 const length = parseInt(getResponseHeader("Content-Length"), 10); 24328 24329 if (!Number.isInteger(length)) { 24330 return returnValues; 24331 } 24332 24333 returnValues.suggestedLength = length; 24334 24335 if (length <= 2 * rangeChunkSize) { 24336 return returnValues; 24337 } 24338 24339 if (disableRange || !isHttp) { 24340 return returnValues; 24341 } 24342 24343 if (getResponseHeader("Accept-Ranges") !== "bytes") { 24344 return returnValues; 24345 } 24346 24347 const contentEncoding = getResponseHeader("Content-Encoding") || "identity"; 24348 24349 if (contentEncoding !== "identity") { 24350 return returnValues; 24351 } 24352 24353 returnValues.allowRangeRequests = true; 24354 return returnValues; 24355} 24356 24357function extractFilenameFromHeader(getResponseHeader) { 24358 const contentDisposition = getResponseHeader("Content-Disposition"); 24359 24360 if (contentDisposition) { 24361 let filename = (0, _content_disposition.getFilenameFromContentDispositionHeader)(contentDisposition); 24362 24363 if (filename.includes("%")) {
24364 try { 24365 filename = decodeURIComponent(filename); 24366 } catch (ex) {} 24367 } 24368 24369 if (/\.pdf$/i.test(filename)) { 24370 return filename; 24371 } 24372 } 24373 24374 return null; 24375} 24376 24377function createResponseStatusError(status, url) { 24378 if (status === 404 || status === 0 && url.startsWith("file:")) { 24379 return new _util.MissingPDFException('Missing PDF "' + url + '".'); 24380 } 24381 24382 return new _util.UnexpectedResponseException("Unexpected server response (" + status + ') while retrieving PDF "' + url + '".', status); 24383} 24384 24385function validateResponseStatus(status) { 24386 return status === 200 || status === 206; 24387} 24388 24389/***/ }), 24390/* 21 */ 24391/***/ (function(module, exports, __w_pdfjs_require__) { 24392 24393"use strict"; 24394 24395 24396Object.defineProperty(exports, "__esModule", { 24397 value: true 24398}); 24399exports.getFilenameFromContentDispositionHeader = getFilenameFromContentDispositionHeader; 24400 24401function getFilenameFromContentDispositionHeader(contentDisposition) { 24402 let needsEncodingFixup = true; 24403 let tmp = toParamRegExp("filename\\*", "i").exec(contentDisposition); 24404 24405 if (tmp) { 24406 tmp = tmp[1]; 24407 let filename = rfc2616unquote(tmp); 24408 filename = unescape(filename); 24409 filename = rfc5987decode(filename); 24410 filename = rfc2047decode(filename); 24411 return fixupEncoding(filename); 24412 } 24413 24414 tmp = rfc2231getparam(contentDisposition); 24415 24416 if (tmp) { 24417 const filename = rfc2047decode(tmp); 24418 return fixupEncoding(filename); 24419 } 24420 24421 tmp = toParamRegExp("filename", "i").exec(contentDisposition); 24422 24423 if (tmp) { 24424 tmp = tmp[1]; 24425 let filename = rfc2616unquote(tmp); 24426 filename = rfc2047decode(filename); 24427 return fixupEncoding(filename); 24428 } 24429 24430 function toParamRegExp(attributePattern, flags) { 24431 return new RegExp("(?:^|;)\\s*" + attributePattern + "\\s*=\\s*" + "(" + '[^";\\s][^;\\s]*' + "|" + '"(?:[^"\\\\]|\\\\"?)+"?' + ")", flags); 24432 } 24433 24434 function textdecode(encoding, value) { 24435 if (encoding) { 24436 if (!/^[\x00-\xFF]+$/.test(value)) { 24437 return value; 24438 } 24439 24440 try { 24441 const decoder = new TextDecoder(encoding, { 24442 fatal: true 24443 }); 24444 const bytes = Array.from(value, function (ch) { 24445 return ch.charCodeAt(0) & 0xff; 24446 }); 24447 value = decoder.decode(new Uint8Array(bytes)); 24448 needsEncodingFixup = false; 24449 } catch (e) { 24450 if (/^utf-?8$/i.test(encoding)) { 24451 try { 24452 value = decodeURIComponent(escape(value)); 24453 needsEncodingFixup = false; 24454 } catch (err) {} 24455 } 24456 } 24457 } 24458 24459 return value; 24460 } 24461 24462 function fixupEncoding(value) { 24463 if (needsEncodingFixup && /[\x80-\xff]/.test(value)) { 24464 value = textdecode("utf-8", value); 24465 24466 if (needsEncodingFixup) { 24467 value = textdecode("iso-8859-1", value); 24468 } 24469 } 24470 24471 return value; 24472 } 24473 24474 function rfc2231getparam(contentDisposition) { 24475 const matches = []; 24476 let match; 24477 const iter = toParamRegExp("filename\\*((?!0\\d)\\d+)(\\*?)", "ig"); 24478 24479 while ((match = iter.exec(contentDisposition)) !== null) { 24480 let [, n, quot, part] = match; 24481 n = parseInt(n, 10); 24482 24483 if (n in matches) { 24484 if (n === 0) { 24485 break; 24486 } 24487 24488 continue; 24489 } 24490 24491 matches[n] = [quot, part]; 24492 } 24493 24494 const parts = []; 24495 24496 for (let n = 0; n < matches.length; ++n) { 24497 if (!(n in matches)) { 24498 break; 24499 } 24500 24501 let [quot, part] = matches[n]; 24502 part = rfc2616unquote(part); 24503 24504 if (quot) { 24505 part = unescape(part); 24506 24507 if (n === 0) { 24508 part = rfc5987decode(part); 24509 } 24510 } 24511 24512 parts.push(part); 24513 } 24514 24515 return parts.join(""); 24516 } 24517 24518 function rfc2616unquote(value) { 24519 if (value.startsWith('"')) { 24520 const parts = value.slice(1).split('\\"'); 24521 24522 for (let i = 0; i < parts.length; ++i) { 24523 const quotindex = parts[i].indexOf('"'); 24524 24525 if (quotindex !== -1) { 24526 parts[i] = parts[i].slice(0, quotindex); 24527 parts.length = i + 1; 24528 } 24529 24530 parts[i] = parts[i].replace(/\\(.)/g, "$1"); 24531 } 24532 24533 value = parts.join('"'); 24534 } 24535 24536 return value; 24537 } 24538 24539 function rfc5987decode(extvalue) { 24540 const encodingend = extvalue.indexOf("'"); 24541 24542 if (encodingend === -1) { 24543 return extvalue; 24544 } 24545 24546 const encoding = extvalue.slice(0, encodingend); 24547 const langvalue = extvalue.slice(encodingend + 1); 24548 const value = langvalue.replace(/^[^']*'/, ""); 24549 return textdecode(encoding, value); 24550 } 24551 24552 function rfc2047decode(value) { 24553 if (!value.startsWith("=?") || /[\x00-\x19\x80-\xff]/.test(value)) { 24554 return value; 24555 } 24556 24557 return value.replace(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g, function (_, charset, encoding, text) { 24558 if (encoding === "q" || encoding === "Q") { 24559 text = text.replace(/_/g, " "); 24560 text = text.replace(/=([0-9a-fA-F]{2})/g, function (_, hex) { 24561 return String.fromCharCode(parseInt(hex, 16)); 24562 }); 24563 return textdecode(charset, text); 24564 } 24565
24566 try { 24567 text = atob(text); 24568 } catch (e) {} 24569 24570 return textdecode(charset, text); 24571 }); 24572 } 24573 24574 return ""; 24575} 24576 24577/***/ }), 24578/* 22 */ 24579/***/ (function(module, exports, __w_pdfjs_require__) { 24580 24581"use strict"; 24582 24583 24584Object.defineProperty(exports, "__esModule", { 24585 value: true 24586}); 24587exports.PDFNetworkStream = void 0; 24588 24589var _util = __w_pdfjs_require__(1); 24590 24591var _network_utils = __w_pdfjs_require__(20); 24592 24593; 24594const OK_RESPONSE = 200; 24595const PARTIAL_CONTENT_RESPONSE = 206; 24596 24597function getArrayBuffer(xhr) { 24598 const data = xhr.response; 24599 24600 if (typeof data !== "string") { 24601 return data; 24602 } 24603 24604 const array = (0, _util.stringToBytes)(data); 24605 return array.buffer; 24606} 24607 24608class NetworkManager { 24609 constructor(url, args) { 24610 this.url = url; 24611 args = args || {}; 24612 this.isHttp = /^https?:/i.test(url); 24613 this.httpHeaders = this.isHttp && args.httpHeaders || {}; 24614 this.withCredentials = args.withCredentials || false; 24615 24616 this.getXhr = args.getXhr || function NetworkManager_getXhr() { 24617 return new XMLHttpRequest(); 24618 }; 24619 24620 this.currXhrId = 0; 24621 this.pendingRequests = Object.create(null); 24622 } 24623 24624 requestRange(begin, end, listeners) { 24625 const args = { 24626 begin, 24627 end 24628 }; 24629 24630 for (const prop in listeners) { 24631 args[prop] = listeners[prop]; 24632 } 24633 24634 return this.request(args); 24635 } 24636 24637 requestFull(listeners) { 24638 return this.request(listeners); 24639 } 24640 24641 request(args) { 24642 const xhr = this.getXhr(); 24643 const xhrId = this.currXhrId++; 24644 const pendingRequest = this.pendingRequests[xhrId] = { 24645 xhr 24646 }; 24647 xhr.open("GET", this.url); 24648 xhr.withCredentials = this.withCredentials; 24649 24650 for (const property in this.httpHeaders) { 24651 const value = this.httpHeaders[property]; 24652 24653 if (typeof value === "undefined") { 24654 continue; 24655 } 24656 24657 xhr.setRequestHeader(property, value); 24658 } 24659 24660 if (this.isHttp && "begin" in args && "end" in args) { 24661 xhr.setRequestHeader("Range", `bytes=${args.begin}-${args.end - 1}`); 24662 pendingRequest.expectedStatus = PARTIAL_CONTENT_RESPONSE; 24663 } else { 24664 pendingRequest.expectedStatus = OK_RESPONSE; 24665 } 24666 24667 xhr.responseType = "arraybuffer"; 24668 24669 if (args.onError) { 24670 xhr.onerror = function (evt) { 24671 args.onError(xhr.status); 24672 }; 24673 } 24674 24675 xhr.onreadystatechange = this.onStateChange.bind(this, xhrId); 24676 xhr.onprogress = this.onProgress.bind(this, xhrId); 24677 pendingRequest.onHeadersReceived = args.onHeadersReceived; 24678 pendingRequest.onDone = args.onDone; 24679 pendingRequest.onError = args.onError; 24680 pendingRequest.onProgress = args.onProgress; 24681 xhr.send(null); 24682 return xhrId; 24683 } 24684 24685 onProgress(xhrId, evt) { 24686 const pendingRequest = this.pendingRequests[xhrId]; 24687 24688 if (!pendingRequest) { 24689 return; 24690 } 24691 24692 if (pendingRequest.onProgress) { 24693 pendingRequest.onProgress(evt); 24694 } 24695 } 24696 24697 onStateChange(xhrId, evt) { 24698 const pendingRequest = this.pendingRequests[xhrId]; 24699 24700 if (!pendingRequest) { 24701 return; 24702 } 24703 24704 const xhr = pendingRequest.xhr; 24705 24706 if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) { 24707 pendingRequest.onHeadersReceived(); 24708 delete pendingRequest.onHeadersReceived; 24709 } 24710 24711 if (xhr.readyState !== 4) { 24712 return; 24713 } 24714 24715 if (!(xhrId in this.pendingRequests)) { 24716 return; 24717 } 24718 24719 delete this.pendingRequests[xhrId]; 24720 24721 if (xhr.status === 0 && this.isHttp) { 24722 if (pendingRequest.onError) { 24723 pendingRequest.onError(xhr.status); 24724 } 24725 24726 return; 24727 } 24728 24729 const xhrStatus = xhr.status || OK_RESPONSE; 24730 const ok_response_on_range_request = xhrStatus === OK_RESPONSE && pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE; 24731 24732 if (!ok_response_on_range_request && xhrStatus !== pendingRequest.expectedStatus) { 24733 if (pendingRequest.onError) { 24734 pendingRequest.onError(xhr.status); 24735 } 24736 24737 return; 24738 } 24739 24740 const chunk = getArrayBuffer(xhr); 24741 24742 if (xhrStatus === PARTIAL_CONTENT_RESPONSE) { 24743 const rangeHeader = xhr.getResponseHeader("Content-Range"); 24744 const matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader); 24745 pendingRequest.onDone({ 24746 begin: parseInt(matches[1], 10), 24747 chunk 24748 }); 24749 } else if (chunk) { 24750 pendingRequest.onDone({ 24751 begin: 0, 24752 chunk 24753 }); 24754 } else if (pendingRequest.onError) { 24755 pendingRequest.onError(xhr.status); 24756 } 24757 } 24758 24759 hasPendingRequests() { 24760 for (const xhrId in this.pendingRequests) { 24761 return true; 24762 } 24763 24764 return false;
24765 } 24766 24767 getRequestXhr(xhrId) { 24768 return this.pendingRequests[xhrId].xhr; 24769 } 24770 24771 isPendingRequest(xhrId) { 24772 return xhrId in this.pendingRequests; 24773 } 24774 24775 abortAllRequests() { 24776 for (const xhrId in this.pendingRequests) { 24777 this.abortRequest(xhrId | 0); 24778 } 24779 } 24780 24781 abortRequest(xhrId) { 24782 const xhr = this.pendingRequests[xhrId].xhr; 24783 delete this.pendingRequests[xhrId]; 24784 xhr.abort(); 24785 } 24786 24787} 24788 24789class PDFNetworkStream { 24790 constructor(source) { 24791 this._source = source; 24792 this._manager = new NetworkManager(source.url, { 24793 httpHeaders: source.httpHeaders, 24794 withCredentials: source.withCredentials 24795 }); 24796 this._rangeChunkSize = source.rangeChunkSize; 24797 this._fullRequestReader = null; 24798 this._rangeRequestReaders = []; 24799 } 24800 24801 _onRangeRequestReaderClosed(reader) { 24802 const i = this._rangeRequestReaders.indexOf(reader); 24803 24804 if (i >= 0) { 24805 this._rangeRequestReaders.splice(i, 1); 24806 } 24807 } 24808 24809 getFullReader() { 24810 (0, _util.assert)(!this._fullRequestReader); 24811 this._fullRequestReader = new PDFNetworkStreamFullRequestReader(this._manager, this._source); 24812 return this._fullRequestReader; 24813 } 24814 24815 getRangeReader(begin, end) { 24816 const reader = new PDFNetworkStreamRangeRequestReader(this._manager, begin, end); 24817 reader.onClosed = this._onRangeRequestReaderClosed.bind(this); 24818 24819 this._rangeRequestReaders.push(reader); 24820 24821 return reader; 24822 } 24823 24824 cancelAllRequests(reason) { 24825 if (this._fullRequestReader) { 24826 this._fullRequestReader.cancel(reason); 24827 } 24828 24829 const readers = this._rangeRequestReaders.slice(0); 24830 24831 readers.forEach(function (reader) { 24832 reader.cancel(reason); 24833 }); 24834 } 24835 24836} 24837 24838exports.PDFNetworkStream = PDFNetworkStream; 24839 24840class PDFNetworkStreamFullRequestReader { 24841 constructor(manager, source) { 24842 this._manager = manager; 24843 const args = { 24844 onHeadersReceived: this._onHeadersReceived.bind(this), 24845 onDone: this._onDone.bind(this), 24846 onError: this._onError.bind(this), 24847 onProgress: this._onProgress.bind(this) 24848 }; 24849 this._url = source.url; 24850 this._fullRequestId = manager.requestFull(args); 24851 this._headersReceivedCapability = (0, _util.createPromiseCapability)(); 24852 this._disableRange = source.disableRange || false; 24853 this._contentLength = source.length; 24854 this._rangeChunkSize = source.rangeChunkSize; 24855 24856 if (!this._rangeChunkSize && !this._disableRange) { 24857 this._disableRange = true; 24858 } 24859 24860 this._isStreamingSupported = false; 24861 this._isRangeSupported = false; 24862 this._cachedChunks = []; 24863 this._requests = []; 24864 this._done = false; 24865 this._storedError = undefined; 24866 this._filename = null; 24867 this.onProgress = null; 24868 } 24869 24870 _onHeadersReceived() { 24871 const fullRequestXhrId = this._fullRequestId; 24872 24873 const fullRequestXhr = this._manager.getRequestXhr(fullRequestXhrId); 24874 24875 const getResponseHeader = name => { 24876 return fullRequestXhr.getResponseHeader(name); 24877 }; 24878 24879 const { 24880 allowRangeRequests, 24881 suggestedLength 24882 } = (0, _network_utils.validateRangeRequestCapabilities)({ 24883 getResponseHeader, 24884 isHttp: this._manager.isHttp, 24885 rangeChunkSize: this._rangeChunkSize, 24886 disableRange: this._disableRange 24887 }); 24888 24889 if (allowRangeRequests) { 24890 this._isRangeSupported = true; 24891 } 24892 24893 this._contentLength = suggestedLength || this._contentLength; 24894 this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader); 24895 24896 if (this._isRangeSupported) { 24897 this._manager.abortRequest(fullRequestXhrId); 24898 } 24899 24900 this._headersReceivedCapability.resolve(); 24901 } 24902 24903 _onDone(args) { 24904 if (args) { 24905 if (this._requests.length > 0) { 24906 const requestCapability = this._requests.shift(); 24907 24908 requestCapability.resolve({ 24909 value: args.chunk, 24910 done: false 24911 }); 24912 } else { 24913 this._cachedChunks.push(args.chunk); 24914 } 24915 } 24916 24917 this._done = true; 24918 24919 if (this._cachedChunks.length > 0) { 24920 return; 24921 } 24922 24923 this._requests.forEach(function (requestCapability) { 24924 requestCapability.resolve({ 24925 value: undefined, 24926 done: true 24927 }); 24928 }); 24929 24930 this._requests = []; 24931 } 24932 24933 _onError(status) { 24934 const url = this._url; 24935 const exception = (0, _network_utils.createResponseStatusError)(status, url); 24936 this._storedError = exception; 24937 24938 this._headersReceivedCapability.reject(exception); 24939
24940 this._requests.forEach(function (requestCapability) { 24941 requestCapability.reject(exception); 24942 }); 24943 24944 this._requests = []; 24945 this._cachedChunks = []; 24946 } 24947 24948 _onProgress(data) { 24949 if (this.onProgress) { 24950 this.onProgress({ 24951 loaded: data.loaded, 24952 total: data.lengthComputable ? data.total : this._contentLength 24953 }); 24954 } 24955 } 24956 24957 get filename() { 24958 return this._filename; 24959 } 24960 24961 get isRangeSupported() { 24962 return this._isRangeSupported; 24963 } 24964 24965 get isStreamingSupported() { 24966 return this._isStreamingSupported; 24967 } 24968 24969 get contentLength() { 24970 return this._contentLength; 24971 } 24972 24973 get headersReady() { 24974 return this._headersReceivedCapability.promise; 24975 } 24976 24977 async read() { 24978 if (this._storedError) { 24979 throw this._storedError; 24980 } 24981 24982 if (this._cachedChunks.length > 0) { 24983 const chunk = this._cachedChunks.shift(); 24984 24985 return { 24986 value: chunk, 24987 done: false 24988 }; 24989 } 24990 24991 if (this._done) { 24992 return { 24993 value: undefined, 24994 done: true 24995 }; 24996 } 24997 24998 const requestCapability = (0, _util.createPromiseCapability)(); 24999 25000 this._requests.push(requestCapability); 25001 25002 return requestCapability.promise; 25003 } 25004 25005 cancel(reason) { 25006 this._done = true; 25007 25008 this._headersReceivedCapability.reject(reason); 25009 25010 this._requests.forEach(function (requestCapability) { 25011 requestCapability.resolve({ 25012 value: undefined, 25013 done: true 25014 }); 25015 }); 25016 25017 this._requests = []; 25018 25019 if (this._manager.isPendingRequest(this._fullRequestId)) { 25020 this._manager.abortRequest(this._fullRequestId); 25021 } 25022 25023 this._fullRequestReader = null; 25024 } 25025 25026} 25027 25028class PDFNetworkStreamRangeRequestReader { 25029 constructor(manager, begin, end) { 25030 this._manager = manager; 25031 const args = { 25032 onDone: this._onDone.bind(this), 25033 onProgress: this._onProgress.bind(this) 25034 }; 25035 this._requestId = manager.requestRange(begin, end, args); 25036 this._requests = []; 25037 this._queuedChunk = null; 25038 this._done = false; 25039 this.onProgress = null; 25040 this.onClosed = null; 25041 } 25042 25043 _close() { 25044 if (this.onClosed) { 25045 this.onClosed(this); 25046 } 25047 } 25048 25049 _onDone(data) { 25050 const chunk = data.chunk; 25051 25052 if (this._requests.length > 0) { 25053 const requestCapability = this._requests.shift(); 25054 25055 requestCapability.resolve({ 25056 value: chunk, 25057 done: false 25058 }); 25059 } else { 25060 this._queuedChunk = chunk; 25061 } 25062 25063 this._done = true; 25064 25065 this._requests.forEach(function (requestCapability) { 25066 requestCapability.resolve({ 25067 value: undefined, 25068 done: true 25069 }); 25070 }); 25071 25072 this._requests = []; 25073 25074 this._close(); 25075 } 25076 25077 _onProgress(evt) { 25078 if (!this.isStreamingSupported && this.onProgress) { 25079 this.onProgress({ 25080 loaded: evt.loaded 25081 }); 25082 } 25083 } 25084 25085 get isStreamingSupported() { 25086 return false; 25087 } 25088 25089 async read() { 25090 if (this._queuedChunk !== null) { 25091 const chunk = this._queuedChunk; 25092 this._queuedChunk = null; 25093 return { 25094 value: chunk, 25095 done: false 25096 }; 25097 } 25098 25099 if (this._done) { 25100 return { 25101 value: undefined, 25102 done: true 25103 }; 25104 } 25105 25106 const requestCapability = (0, _util.createPromiseCapability)(); 25107 25108 this._requests.push(requestCapability); 25109 25110 return requestCapability.promise; 25111 } 25112 25113 cancel(reason) { 25114 this._done = true; 25115 25116 this._requests.forEach(function (requestCapability) { 25117 requestCapability.resolve({ 25118 value: undefined, 25119 done: true 25120 }); 25121 }); 25122 25123 this._requests = []; 25124 25125 if (this._manager.isPendingRequest(this._requestId)) { 25126 this._manager.abortRequest(this._requestId); 25127 } 25128 25129 this._close(); 25130 } 25131 25132} 25133 25134/***/ }), 25135/* 23 */ 25136/***/ (function(module, exports, __w_pdfjs_require__) { 25137 25138"use strict"; 25139 25140 25141Object.defineProperty(exports, "__esModule", { 25142 value: true 25143}); 25144exports.PDFFetchStream = void 0; 25145 25146var _util = __w_pdfjs_require__(1); 25147 25148var _network_utils = __w_pdfjs_require__(20); 25149 25150function createFetchOptions(headers, withCredentials, abortController) { 25151 return { 25152 method: "GET", 25153 headers, 25154 signal: abortController && abortController.signal, 25155 mode: "cors", 25156 credentials: withCredentials ? "include" : "same-origin", 25157 redirect: "follow" 25158 }; 25159} 25160 25161function createHeaders(httpHeaders) { 25162 const headers = new Headers(); 25163 25164 for (const property in httpHeaders) { 25165 const value = httpHeaders[property]; 25166 25167 if (typeof value === "undefined") { 25168 continue; 25169 } 25170 25171 headers.append(property, value); 25172 } 25173 25174 return headers; 25175} 25176 25177class PDFFetchStream { 25178 constructor(source) { 25179 this.source = source; 25180 this.isHttp = /^https?:/i.test(source.url); 25181 this.httpHeaders = this.isHttp && source.httpHeaders || {}; 25182 this._fullRequestReader = null; 25183 this._rangeRequestReaders = []; 25184 } 25185 25186 get _progressiveDataLength() { 25187 return this._fullRequestReader ? this._fullRequestReader._loaded : 0; 25188 } 25189 25190 getFullReader() { 25191 (0, _util.assert)(!this._fullRequestReader); 25192 this._fullRequestReader = new PDFFetchStreamReader(this); 25193 return this._fullRequestReader; 25194 } 25195 25196 getRangeReader(begin, end) { 25197 if (end <= this._progressiveDataLength) { 25198 return null; 25199 } 25200 25201 const reader = new PDFFetchStreamRangeReader(this, begin, end); 25202 25203 this._rangeRequestReaders.push(reader); 25204 25205 return reader; 25206 } 25207 25208 cancelAllRequests(reason) { 25209 if (this._fullRequestReader) { 25210 this._fullRequestReader.cancel(reason); 25211 } 25212 25213 const readers = this._rangeRequestReaders.slice(0); 25214
25215 readers.forEach(function (reader) { 25216 reader.cancel(reason); 25217 }); 25218 } 25219 25220} 25221 25222exports.PDFFetchStream = PDFFetchStream; 25223 25224class PDFFetchStreamReader { 25225 constructor(stream) { 25226 this._stream = stream; 25227 this._reader = null; 25228 this._loaded = 0; 25229 this._filename = null; 25230 const source = stream.source; 25231 this._withCredentials = source.withCredentials || false; 25232 this._contentLength = source.length; 25233 this._headersCapability = (0, _util.createPromiseCapability)(); 25234 this._disableRange = source.disableRange || false; 25235 this._rangeChunkSize = source.rangeChunkSize; 25236 25237 if (!this._rangeChunkSize && !this._disableRange) { 25238 this._disableRange = true; 25239 } 25240 25241 if (typeof AbortController !== "undefined") { 25242 this._abortController = new AbortController(); 25243 } 25244 25245 this._isStreamingSupported = !source.disableStream; 25246 this._isRangeSupported = !source.disableRange; 25247 this._headers = createHeaders(this._stream.httpHeaders); 25248 const url = source.url; 25249 fetch(url, createFetchOptions(this._headers, this._withCredentials, this._abortController)).then(response => { 25250 if (!(0, _network_utils.validateResponseStatus)(response.status)) { 25251 throw (0, _network_utils.createResponseStatusError)(response.status, url); 25252 } 25253 25254 this._reader = response.body.getReader(); 25255 25256 this._headersCapability.resolve(); 25257 25258 const getResponseHeader = name => { 25259 return response.headers.get(name); 25260 }; 25261 25262 const { 25263 allowRangeRequests, 25264 suggestedLength 25265 } = (0, _network_utils.validateRangeRequestCapabilities)({ 25266 getResponseHeader, 25267 isHttp: this._stream.isHttp, 25268 rangeChunkSize: this._rangeChunkSize, 25269 disableRange: this._disableRange 25270 }); 25271 this._isRangeSupported = allowRangeRequests; 25272 this._contentLength = suggestedLength || this._contentLength; 25273 this._filename = (0, _network_utils.extractFilenameFromHeader)(getResponseHeader); 25274 25275 if (!this._isStreamingSupported && this._isRangeSupported) { 25276 this.cancel(new _util.AbortException("Streaming is disabled.")); 25277 } 25278 }).catch(this._headersCapability.reject); 25279 this.onProgress = null; 25280 } 25281 25282 get headersReady() { 25283 return this._headersCapability.promise; 25284 } 25285 25286 get filename() { 25287 return this._filename; 25288 } 25289 25290 get contentLength() { 25291 return this._contentLength; 25292 } 25293 25294 get isRangeSupported() { 25295 return this._isRangeSupported; 25296 } 25297 25298 get isStreamingSupported() { 25299 return this._isStreamingSupported; 25300 } 25301 25302 async read() { 25303 await this._headersCapability.promise; 25304 const { 25305 value, 25306 done 25307 } = await this._reader.read(); 25308 25309 if (done) { 25310 return { 25311 value, 25312 done 25313 }; 25314 } 25315 25316 this._loaded += value.byteLength; 25317 25318 if (this.onProgress) { 25319 this.onProgress({ 25320 loaded: this._loaded, 25321 total: this._contentLength 25322 }); 25323 } 25324 25325 const buffer = new Uint8Array(value).buffer; 25326 return { 25327 value: buffer, 25328 done: false 25329 }; 25330 } 25331 25332 cancel(reason) { 25333 if (this._reader) { 25334 this._reader.cancel(reason); 25335 } 25336 25337 if (this._abortController) { 25338 this._abortController.abort(); 25339 } 25340 } 25341 25342} 25343 25344class PDFFetchStreamRangeReader { 25345 constructor(stream, begin, end) { 25346 this._stream = stream; 25347 this._reader = null; 25348 this._loaded = 0; 25349 const source = stream.source; 25350 this._withCredentials = source.withCredentials || false; 25351 this._readCapability = (0, _util.createPromiseCapability)(); 25352 this._isStreamingSupported = !source.disableStream; 25353 25354 if (typeof AbortController !== "undefined") { 25355 this._abortController = new AbortController(); 25356 } 25357 25358 this._headers = createHeaders(this._stream.httpHeaders); 25359 25360 this._headers.append("Range", `bytes=${begin}-${end - 1}`); 25361 25362 const url = source.url; 25363 fetch(url, createFetchOptions(this._headers, this._withCredentials, this._abortController)).then(response => { 25364 if (!(0, _network_utils.validateResponseStatus)(response.status)) { 25365 throw (0, _network_utils.createResponseStatusError)(response.status, url); 25366 } 25367 25368 this._readCapability.resolve(); 25369 25370 this._reader = response.body.getReader(); 25371 }); 25372 this.onProgress = null; 25373 } 25374 25375 get isStreamingSupported() { 25376 return this._isStreamingSupported; 25377 } 25378 25379 async read() { 25380 await this._readCapability.promise; 25381 const { 25382 value, 25383 done 25384 } = await this._reader.read(); 25385 25386 if (done) { 25387 return { 25388 value, 25389 done 25390 }; 25391 } 25392 25393 this._loaded += value.byteLength; 25394 25395 if (this.onProgress) { 25396 this.onProgress({ 25397 loaded: this._loaded 25398 }); 25399 } 25400 25401 const buffer = new Uint8Array(value).buffer; 25402 return { 25403 value: buffer, 25404 done: false 25405 }; 25406 } 25407 25408 cancel(reason) { 25409 if (this._reader) { 25410 this._reader.cancel(reason); 25411 } 25412 25413 if (this._abortController) { 25414 this._abortController.abort(); 25415 } 25416 } 25417 25418} 25419 25420/***/ }) 25421/******/ ]); 25422});
vendor: 4,103 bytes, lines 25423-25525
25423//# sourceMappingURL=pdf.js.map 25424; 25425/** 25426 * @licstart The following is the entire license notice for the 25427 * Javascript code in this page 25428 * 25429 * Copyright 2020 Mozilla Foundation 25430 * 25431 * Licensed under the Apache License, Version 2.0 (the "License"); 25432 * you may not use this file except in compliance with the License. 25433 * You may obtain a copy of the License at 25434 * 25435 * http://www.apache.org/licenses/LICENSE-2.0 25436 * 25437 * Unless required by applicable law or agreed to in writing, software 25438 * distributed under the License is distributed on an "AS IS" BASIS, 25439 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25440 * See the License for the specific language governing permissions and 25441 * limitations under the License. 25442 * 25443 * @licend The above is the entire license notice for the 25444 * Javascript code in this page 25445 */ 25446 25447 25448(function webpackUniversalModuleDefinition(root, factory) { 25449 if(typeof exports === 'object' && typeof module === 'object') 25450 module.exports = factory(); 25451 else if(typeof define === 'function' && define.amd) 25452 define("pdfjs-dist/build/pdf.worker", [], factory); 25453 else if(typeof exports === 'object') 25454 exports["pdfjs-dist/build/pdf.worker"] = factory(); 25455 else 25456 root["pdfjs-dist/build/pdf.worker"] = root.pdfjsWorker = factory(); 25457})(this, function() { 25458return /******/ (function(modules) { // webpackBootstrap 25459/******/ // The module cache 25460/******/ var installedModules = {}; 25461/******/ 25462/******/ // The require function 25463/******/ function __w_pdfjs_require__(moduleId) { 25464/******/ 25465/******/ // Check if module is in cache 25466/******/ if(installedModules[moduleId]) { 25467/******/ return installedModules[moduleId].exports; 25468/******/ } 25469/******/ // Create a new module (and put it into the cache) 25470/******/ var module = installedModules[moduleId] = { 25471/******/ i: moduleId, 25472/******/ l: false, 25473/******/ exports: {} 25474/******/ }; 25475/******/ 25476/******/ // Execute the module function 25477/******/ modules[moduleId].call(module.exports, module, module.exports, __w_pdfjs_require__); 25478/******/ 25479/******/ // Flag the module as loaded 25480/******/ module.l = true; 25481/******/ 25482/******/ // Return the exports of the module 25483/******/ return module.exports; 25484/******/ } 25485/******/ 25486/******/ 25487/******/ // expose the modules object (__webpack_modules__) 25488/******/ __w_pdfjs_require__.m = modules; 25489/******/ 25490/******/ // expose the module cache 25491/******/ __w_pdfjs_require__.c = installedModules; 25492/******/ 25493/******/ // define getter function for harmony exports 25494/******/ __w_pdfjs_require__.d = function(exports, name, getter) { 25495/******/ if(!__w_pdfjs_require__.o(exports, name)) { 25496/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 25497/******/ } 25498/******/ }; 25499/******/ 25500/******/ // define __esModule on exports 25501/******/ __w_pdfjs_require__.r = function(exports) { 25502/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 25503/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 25504/******/ } 25505/******/ Object.defineProperty(exports, '__esModule', { value: true }); 25506/******/ }; 25507/******/ 25508/******/ // create a fake namespace object 25509/******/ // mode & 1: value is a module id, require it 25510/******/ // mode & 2: merge all properties of value into the ns 25511/******/ // mode & 4: return value when already ns object 25512/******/ // mode & 8|1: behave like require 25513/******/ __w_pdfjs_require__.t = function(value, mode) { 25514/******/ if(mode & 1) value = __w_pdfjs_require__(value); 25515/******/ if(mode & 8) return value; 25516/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 25517/******/ var ns = Object.create(null); 25518/******/ __w_pdfjs_require__.r(ns); 25519/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 25520/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __w_pdfjs_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 25521/******/ return ns; 25522/******/ }; 25523/******/ 25524/******/ // getDefaultExport function for compatibility with non-harmony modules 25525/******/ __w_pdfjs_require__.n = function(module) {
25526/******/ var getter = module && module.__esModule ? 25527/******/ function getDefault() { return module['default']; } : 25528/******/ function getModuleExports() { return module; }; 25529/******/ __w_pdfjs_require__.d(getter, 'a', getter); 25530/******/ return getter; 25531/******/ }; 25532/******/ 25533/******/ // Object.prototype.hasOwnProperty.call 25534/******/ __w_pdfjs_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 25535/******/ 25536/******/ // __webpack_public_path__ 25537/******/ __w_pdfjs_require__.p = ""; 25538/******/ 25539/******/ 25540/******/ // Load entry module and return exports 25541/******/ return __w_pdfjs_require__(__w_pdfjs_require__.s = 0); 25542/******/ }) 25543/************************************************************************/ 25544/******/ ([ 25545/* 0 */ 25546/***/ (function(module, exports, __w_pdfjs_require__) { 25547 25548"use strict"; 25549 25550 25551const pdfjsVersion = '2.4.456'; 25552const pdfjsBuild = '228a591c'; 25553 25554const pdfjsCoreWorker = __w_pdfjs_require__(1); 25555 25556exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler; 25557 25558/***/ }), 25559/* 1 */ 25560/***/ (function(module, exports, __w_pdfjs_require__) { 25561 25562"use strict"; 25563 25564 25565Object.defineProperty(exports, "__esModule", { 25566 value: true 25567}); 25568exports.WorkerMessageHandler = exports.WorkerTask = void 0; 25569 25570var _util = __w_pdfjs_require__(2); 25571 25572var _primitives = __w_pdfjs_require__(4); 25573 25574var _pdf_manager = __w_pdfjs_require__(5); 25575 25576var _is_node = __w_pdfjs_require__(44); 25577 25578var _message_handler = __w_pdfjs_require__(45); 25579 25580var _worker_stream = __w_pdfjs_require__(46); 25581 25582var _core_utils = __w_pdfjs_require__(7); 25583 25584var WorkerTask = function WorkerTaskClosure() { 25585 function WorkerTask(name) { 25586 this.name = name; 25587 this.terminated = false; 25588 this._capability = (0, _util.createPromiseCapability)(); 25589 } 25590 25591 WorkerTask.prototype = { 25592 get finished() { 25593 return this._capability.promise; 25594 }, 25595 25596 finish() { 25597 this._capability.resolve(); 25598 }, 25599 25600 terminate() { 25601 this.terminated = true; 25602 }, 25603 25604 ensureNotTerminated() { 25605 if (this.terminated) { 25606 throw new Error("Worker task was terminated"); 25607 } 25608 } 25609 25610 }; 25611 return WorkerTask; 25612}(); 25613 25614exports.WorkerTask = WorkerTask; 25615var WorkerMessageHandler = { 25616 setup(handler, port) { 25617 var testMessageProcessed = false; 25618 handler.on("test", function wphSetupTest(data) { 25619 if (testMessageProcessed) { 25620 return; 25621 } 25622 25623 testMessageProcessed = true; 25624 25625 if (!(data instanceof Uint8Array)) { 25626 handler.send("test", null); 25627 return; 25628 } 25629 25630 const supportTransfers = data[0] === 255; 25631 handler.postMessageTransfers = supportTransfers; 25632 handler.send("test", { 25633 supportTransfers 25634 }); 25635 }); 25636 handler.on("configure", function wphConfigure(data) { 25637 (0, _util.setVerbosityLevel)(data.verbosity); 25638 }); 25639 handler.on("GetDocRequest", function wphSetupDoc(data) { 25640 return WorkerMessageHandler.createDocumentHandler(data, port); 25641 }); 25642 }, 25643 25644 createDocumentHandler(docParams, port) { 25645 var pdfManager; 25646 var terminated = false; 25647 var cancelXHRs = null; 25648 var WorkerTasks = []; 25649 const verbosity = (0, _util.getVerbosityLevel)(); 25650 const apiVersion = docParams.apiVersion; 25651 const workerVersion = '2.4.456'; 25652 25653 if (apiVersion !== workerVersion) { 25654 throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`); 25655 } 25656 25657 const enumerableProperties = []; 25658 25659 for (const property in []) { 25660 enumerableProperties.push(property); 25661 } 25662 25663 if (enumerableProperties.length) { 25664 throw new Error("The `Array.prototype` contains unexpected enumerable properties: " + enumerableProperties.join(", ") + "; thus breaking e.g. `for...in` iteration of `Array`s."); 25665 } 25666 25667 var docId = docParams.docId; 25668 var docBaseUrl = docParams.docBaseUrl; 25669 var workerHandlerName = docParams.docId + "_worker"; 25670 var handler = new _message_handler.MessageHandler(workerHandlerName, docId, port); 25671 handler.postMessageTransfers = docParams.postMessageTransfers; 25672 25673 function ensureNotTerminated() { 25674 if (terminated) { 25675 throw new Error("Worker was terminated"); 25676 } 25677 } 25678 25679 function startWorkerTask(task) { 25680 WorkerTasks.push(task); 25681 } 25682 25683 function finishWorkerTask(task) { 25684 task.finish(); 25685 var i = WorkerTasks.indexOf(task); 25686 WorkerTasks.splice(i, 1); 25687 } 25688 25689 async function loadDocument(recoveryMode) { 25690 await pdfManager.ensureDoc("checkHeader"); 25691 await pdfManager.ensureDoc("parseStartXRef"); 25692 await pdfManager.ensureDoc("parse", [recoveryMode]); 25693 25694 if (!recoveryMode) { 25695 await pdfManager.ensureDoc("checkFirstPage"); 25696 } 25697 25698 const [numPages, fingerprint] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprint")]); 25699 return { 25700 numPages, 25701 fingerprint 25702 }; 25703 } 25704 25705 function getPdfManager(data, evaluatorOptions) { 25706 var pdfManagerCapability = (0, _util.createPromiseCapability)(); 25707 var pdfManager; 25708 var source = data.source; 25709 25710 if (source.data) { 25711 try { 25712 pdfManager = new _pdf_manager.LocalPdfManager(docId, source.data, source.password, evaluatorOptions, docBaseUrl); 25713 pdfManagerCapability.resolve(pdfManager); 25714 } catch (ex) { 25715 pdfManagerCapability.reject(ex); 25716 } 25717 25718 return pdfManagerCapability.promise; 25719 } 25720 25721 var pdfStream, 25722 cachedChunks = []; 25723
25724 try { 25725 pdfStream = new _worker_stream.PDFWorkerStream(handler); 25726 } catch (ex) { 25727 pdfManagerCapability.reject(ex); 25728 return pdfManagerCapability.promise; 25729 } 25730 25731 var fullRequest = pdfStream.getFullReader(); 25732 fullRequest.headersReady.then(function () { 25733 if (!fullRequest.isRangeSupported) { 25734 return; 25735 } 25736 25737 var disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported; 25738 pdfManager = new _pdf_manager.NetworkPdfManager(docId, pdfStream, { 25739 msgHandler: handler, 25740 password: source.password, 25741 length: fullRequest.contentLength, 25742 disableAutoFetch, 25743 rangeChunkSize: source.rangeChunkSize 25744 }, evaluatorOptions, docBaseUrl); 25745 25746 for (let i = 0; i < cachedChunks.length; i++) { 25747 pdfManager.sendProgressiveData(cachedChunks[i]); 25748 } 25749 25750 cachedChunks = []; 25751 pdfManagerCapability.resolve(pdfManager); 25752 cancelXHRs = null; 25753 }).catch(function (reason) { 25754 pdfManagerCapability.reject(reason); 25755 cancelXHRs = null; 25756 }); 25757 var loaded = 0; 25758 25759 var flushChunks = function () { 25760 var pdfFile = (0, _util.arraysToBytes)(cachedChunks); 25761 25762 if (source.length && pdfFile.length !== source.length) { 25763 (0, _util.warn)("reported HTTP length is different from actual"); 25764 } 25765 25766 try { 25767 pdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, source.password, evaluatorOptions, docBaseUrl); 25768 pdfManagerCapability.resolve(pdfManager); 25769 } catch (ex) { 25770 pdfManagerCapability.reject(ex); 25771 } 25772 25773 cachedChunks = []; 25774 }; 25775 25776 var readPromise = new Promise(function (resolve, reject) { 25777 var readChunk = function (chunk) { 25778 try { 25779 ensureNotTerminated(); 25780 25781 if (chunk.done) { 25782 if (!pdfManager) { 25783 flushChunks(); 25784 } 25785 25786 cancelXHRs = null; 25787 return; 25788 } 25789 25790 var data = chunk.value; 25791 loaded += (0, _util.arrayByteLength)(data); 25792 25793 if (!fullRequest.isStreamingSupported) { 25794 handler.send("DocProgress", { 25795 loaded, 25796 total: Math.max(loaded, fullRequest.contentLength || 0) 25797 }); 25798 } 25799 25800 if (pdfManager) { 25801 pdfManager.sendProgressiveData(data); 25802 } else { 25803 cachedChunks.push(data); 25804 } 25805 25806 fullRequest.read().then(readChunk, reject); 25807 } catch (e) { 25808 reject(e); 25809 } 25810 }; 25811 25812 fullRequest.read().then(readChunk, reject); 25813 }); 25814 readPromise.catch(function (e) { 25815 pdfManagerCapability.reject(e); 25816 cancelXHRs = null; 25817 }); 25818 25819 cancelXHRs = function (reason) { 25820 pdfStream.cancelAllRequests(reason); 25821 }; 25822 25823 return pdfManagerCapability.promise; 25824 } 25825 25826 function setupDoc(data) { 25827 function onSuccess(doc) { 25828 ensureNotTerminated(); 25829 handler.send("GetDoc", { 25830 pdfInfo: doc 25831 }); 25832 } 25833 25834 function onFailure(ex) { 25835 ensureNotTerminated(); 25836 25837 if (ex instanceof _util.PasswordException) { 25838 var task = new WorkerTask(`PasswordException: response ${ex.code}`); 25839 startWorkerTask(task); 25840 handler.sendWithPromise("PasswordRequest", ex).then(function (data) { 25841 finishWorkerTask(task); 25842 pdfManager.updatePassword(data.password); 25843 pdfManagerReady(); 25844 }).catch(function () { 25845 finishWorkerTask(task); 25846 handler.send("DocException", ex); 25847 }); 25848 } else if (ex instanceof _util.InvalidPDFException || ex instanceof _util.MissingPDFException || ex instanceof _util.UnexpectedResponseException || ex instanceof _util.UnknownErrorException) { 25849 handler.send("DocException", ex); 25850 } else { 25851 handler.send("DocException", new _util.UnknownErrorException(ex.message, ex.toString())); 25852 } 25853 } 25854 25855 function pdfManagerReady() { 25856 ensureNotTerminated(); 25857 loadDocument(false).then(onSuccess, function loadFailure(ex) { 25858 ensureNotTerminated(); 25859 25860 if (!(ex instanceof _core_utils.XRefParseException)) { 25861 onFailure(ex); 25862 return; 25863 } 25864 25865 pdfManager.requestLoadedStream(); 25866 pdfManager.onLoadedStream().then(function () { 25867 ensureNotTerminated();
25868 loadDocument(true).then(onSuccess, onFailure); 25869 }); 25870 }, onFailure); 25871 } 25872 25873 ensureNotTerminated(); 25874 var evaluatorOptions = { 25875 forceDataSchema: data.disableCreateObjectURL, 25876 maxImageSize: data.maxImageSize, 25877 disableFontFace: data.disableFontFace, 25878 nativeImageDecoderSupport: data.nativeImageDecoderSupport, 25879 ignoreErrors: data.ignoreErrors, 25880 isEvalSupported: data.isEvalSupported 25881 }; 25882 getPdfManager(data, evaluatorOptions).then(function (newPdfManager) { 25883 if (terminated) { 25884 newPdfManager.terminate(new _util.AbortException("Worker was terminated.")); 25885 throw new Error("Worker was terminated"); 25886 } 25887 25888 pdfManager = newPdfManager; 25889 pdfManager.onLoadedStream().then(function (stream) { 25890 handler.send("DataLoaded", { 25891 length: stream.bytes.byteLength 25892 }); 25893 }); 25894 }).then(pdfManagerReady, onFailure); 25895 } 25896 25897 handler.on("GetPage", function wphSetupGetPage(data) { 25898 return pdfManager.getPage(data.pageIndex).then(function (page) { 25899 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]) { 25900 return { 25901 rotate, 25902 ref, 25903 userUnit, 25904 view 25905 }; 25906 }); 25907 }); 25908 }); 25909 handler.on("GetPageIndex", function wphSetupGetPageIndex(data) { 25910 var ref = _primitives.Ref.get(data.ref.num, data.ref.gen); 25911 25912 var catalog = pdfManager.pdfDocument.catalog; 25913 return catalog.getPageIndex(ref); 25914 }); 25915 handler.on("GetDestinations", function wphSetupGetDestinations(data) { 25916 return pdfManager.ensureCatalog("destinations"); 25917 }); 25918 handler.on("GetDestination", function wphSetupGetDestination(data) { 25919 return pdfManager.ensureCatalog("getDestination", [data.id]); 25920 }); 25921 handler.on("GetPageLabels", function wphSetupGetPageLabels(data) { 25922 return pdfManager.ensureCatalog("pageLabels"); 25923 }); 25924 handler.on("GetPageLayout", function wphSetupGetPageLayout(data) { 25925 return pdfManager.ensureCatalog("pageLayout"); 25926 }); 25927 handler.on("GetPageMode", function wphSetupGetPageMode(data) { 25928 return pdfManager.ensureCatalog("pageMode"); 25929 }); 25930 handler.on("GetViewerPreferences", function (data) { 25931 return pdfManager.ensureCatalog("viewerPreferences"); 25932 }); 25933 handler.on("GetOpenAction", function (data) { 25934 return pdfManager.ensureCatalog("openAction"); 25935 }); 25936 handler.on("GetAttachments", function wphSetupGetAttachments(data) { 25937 return pdfManager.ensureCatalog("attachments"); 25938 }); 25939 handler.on("GetJavaScript", function wphSetupGetJavaScript(data) { 25940 return pdfManager.ensureCatalog("javaScript"); 25941 }); 25942 handler.on("GetOutline", function wphSetupGetOutline(data) { 25943 return pdfManager.ensureCatalog("documentOutline"); 25944 }); 25945 handler.on("GetPermissions", function (data) { 25946 return pdfManager.ensureCatalog("permissions"); 25947 }); 25948 handler.on("GetMetadata", function wphSetupGetMetadata(data) { 25949 return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata")]); 25950 }); 25951 handler.on("GetData", function wphSetupGetData(data) { 25952 pdfManager.requestLoadedStream(); 25953 return pdfManager.onLoadedStream().then(function (stream) { 25954 return stream.bytes; 25955 }); 25956 }); 25957 handler.on("GetStats", function wphSetupGetStats(data) { 25958 return pdfManager.pdfDocument.xref.stats; 25959 }); 25960 handler.on("GetAnnotations", function ({ 25961 pageIndex, 25962 intent 25963 }) { 25964 return pdfManager.getPage(pageIndex).then(function (page) { 25965 return page.getAnnotationsData(intent); 25966 }); 25967 }); 25968 handler.on("GetOperatorList", function wphSetupRenderPage(data, sink) { 25969 var pageIndex = data.pageIndex; 25970 pdfManager.getPage(pageIndex).then(function (page) { 25971 var task = new WorkerTask(`GetOperatorList: page ${pageIndex}`); 25972 startWorkerTask(task); 25973 const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0; 25974 page.getOperatorList({ 25975 handler, 25976 sink, 25977 task, 25978 intent: data.intent, 25979 renderInteractiveForms: data.renderInteractiveForms 25980 }).then(function (operatorListInfo) { 25981 finishWorkerTask(task); 25982 25983 if (start) { 25984 (0, _util.info)(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}
25984ms, len=${operatorListInfo.length}`); 25985 } 25986 25987 sink.close(); 25988 }, function (reason) { 25989 finishWorkerTask(task); 25990 25991 if (task.terminated) { 25992 return; 25993 } 25994 25995 handler.send("UnsupportedFeature", { 25996 featureId: _util.UNSUPPORTED_FEATURES.unknown 25997 }); 25998 sink.error(reason); 25999 }); 26000 }); 26001 }, this); 26002 handler.on("GetTextContent", function wphExtractText(data, sink) { 26003 var pageIndex = data.pageIndex; 26004 26005 sink.onPull = function (desiredSize) {}; 26006 26007 sink.onCancel = function (reason) {}; 26008 26009 pdfManager.getPage(pageIndex).then(function (page) { 26010 var task = new WorkerTask("GetTextContent: page " + pageIndex); 26011 startWorkerTask(task); 26012 const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0; 26013 page.extractTextContent({ 26014 handler, 26015 task, 26016 sink, 26017 normalizeWhitespace: data.normalizeWhitespace, 26018 combineTextItems: data.combineTextItems 26019 }).then(function () { 26020 finishWorkerTask(task); 26021 26022 if (start) { 26023 (0, _util.info)(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`); 26024 } 26025 26026 sink.close(); 26027 }, function (reason) { 26028 finishWorkerTask(task); 26029 26030 if (task.terminated) { 26031 return; 26032 } 26033 26034 sink.error(reason); 26035 }); 26036 }); 26037 }); 26038 handler.on("FontFallback", function (data) { 26039 return pdfManager.fontFallback(data.id, handler); 26040 }); 26041 handler.on("Cleanup", function wphCleanup(data) { 26042 return pdfManager.cleanup(); 26043 }); 26044 handler.on("Terminate", function wphTerminate(data) { 26045 terminated = true; 26046 const waitOn = []; 26047 26048 if (pdfManager) { 26049 pdfManager.terminate(new _util.AbortException("Worker was terminated.")); 26050 const cleanupPromise = pdfManager.cleanup(); 26051 waitOn.push(cleanupPromise); 26052 pdfManager = null; 26053 } else { 26054 (0, _primitives.clearPrimitiveCaches)(); 26055 } 26056 26057 if (cancelXHRs) { 26058 cancelXHRs(new _util.AbortException("Worker was terminated.")); 26059 } 26060 26061 WorkerTasks.forEach(function (task) { 26062 waitOn.push(task.finished); 26063 task.terminate(); 26064 }); 26065 return Promise.all(waitOn).then(function () { 26066 handler.destroy(); 26067 handler = null; 26068 }); 26069 }); 26070 handler.on("Ready", function wphReady(data) { 26071 setupDoc(docParams); 26072 docParams = null; 26073 }); 26074 return workerHandlerName; 26075 }, 26076 26077 initializeFromPort(port) { 26078 var handler = new _message_handler.MessageHandler("worker", "main", port); 26079 WorkerMessageHandler.setup(handler, port); 26080 handler.send("ready", null); 26081 } 26082 26083}; 26084exports.WorkerMessageHandler = WorkerMessageHandler; 26085 26086function isMessagePort(maybePort) { 26087 return typeof maybePort.postMessage === "function" && "onmessage" in maybePort; 26088} 26089 26090if (typeof window === "undefined" && !_is_node.isNodeJS && typeof self !== "undefined" && isMessagePort(self)) { 26091 WorkerMessageHandler.initializeFromPort(self); 26092} 26093 26094/***/ }), 26095/* 2 */ 26096/***/ (function(module, exports, __w_pdfjs_require__) { 26097 26098"use strict"; 26099 26100 26101Object.defineProperty(exports, "__esModule", { 26102 value: true 26103}); 26104exports.arrayByteLength = arrayByteLength; 26105exports.arraysToBytes = arraysToBytes; 26106exports.assert = assert; 26107exports.bytesToString = bytesToString; 26108exports.createPromiseCapability = createPromiseCapability; 26109exports.getVerbosityLevel = getVerbosityLevel; 26110exports.info = info; 26111exports.isArrayBuffer = isArrayBuffer; 26112exports.isArrayEqual = isArrayEqual; 26113exports.isBool = isBool; 26114exports.isEmptyObj = isEmptyObj; 26115exports.isNum = isNum; 26116exports.isString = isString; 26117exports.isSameOrigin = isSameOrigin; 26118exports.createValidAbsoluteUrl = createValidAbsoluteUrl; 26119exports.removeNullCharacters = removeNullCharacters; 26120exports.setVerbosityLevel = setVerbosityLevel; 26121exports.shadow = shadow; 26122exports.string32 = string32; 26123exports.stringToBytes = stringToBytes; 26124exports.stringToPDFString = stringToPDFString; 26125exports.stringToUTF8String = stringToUTF8String; 26126exports.utf8StringToString = utf8StringToString; 26127exports.warn = warn; 26128exports.unreachable = unreachable; 26129exports.IsEvalSupportedCached = exports.IsLittleEndianCached = exports.createObjectURL = exports.FormatError = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.NativeImageDecoding = exports.MissingPDFException = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exp
26129orts.FontType = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = exports.BaseException = void 0; 26130 26131__w_pdfjs_require__(3); 26132 26133const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0]; 26134exports.IDENTITY_MATRIX = IDENTITY_MATRIX; 26135const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0]; 26136exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX; 26137const NativeImageDecoding = { 26138 NONE: "none", 26139 DECODE: "decode", 26140 DISPLAY: "display" 26141}; 26142exports.NativeImageDecoding = NativeImageDecoding; 26143const PermissionFlag = { 26144 PRINT: 0x04, 26145 MODIFY_CONTENTS: 0x08, 26146 COPY: 0x10, 26147 MODIFY_ANNOTATIONS: 0x20, 26148 FILL_INTERACTIVE_FORMS: 0x100, 26149 COPY_FOR_ACCESSIBILITY: 0x200, 26150 ASSEMBLE: 0x400, 26151 PRINT_HIGH_QUALITY: 0x800 26152}; 26153exports.PermissionFlag = PermissionFlag; 26154const TextRenderingMode = { 26155 FILL: 0, 26156 STROKE: 1, 26157 FILL_STROKE: 2, 26158 INVISIBLE: 3, 26159 FILL_ADD_TO_PATH: 4, 26160 STROKE_ADD_TO_PATH: 5, 26161 FILL_STROKE_ADD_TO_PATH: 6, 26162 ADD_TO_PATH: 7, 26163 FILL_STROKE_MASK: 3, 26164 ADD_TO_PATH_FLAG: 4 26165}; 26166exports.TextRenderingMode = TextRenderingMode; 26167const ImageKind = { 26168 GRAYSCALE_1BPP: 1, 26169 RGB_24BPP: 2, 26170 RGBA_32BPP: 3 26171}; 26172exports.ImageKind = ImageKind; 26173const AnnotationType = { 26174 TEXT: 1, 26175 LINK: 2, 26176 FREETEXT: 3, 26177 LINE: 4, 26178 SQUARE: 5, 26179 CIRCLE: 6, 26180 POLYGON: 7, 26181 POLYLINE: 8, 26182 HIGHLIGHT: 9, 26183 UNDERLINE: 10, 26184 SQUIGGLY: 11, 26185 STRIKEOUT: 12, 26186 STAMP: 13, 26187 CARET: 14, 26188 INK: 15, 26189 POPUP: 16, 26190 FILEATTACHMENT: 17, 26191 SOUND: 18, 26192 MOVIE: 19, 26193 WIDGET: 20, 26194 SCREEN: 21, 26195 PRINTERMARK: 22, 26196 TRAPNET: 23, 26197 WATERMARK: 24, 26198 THREED: 25, 26199 REDACT: 26 26200}; 26201exports.AnnotationType = AnnotationType; 26202const AnnotationStateModelType = { 26203 MARKED: "Marked", 26204 REVIEW: "Review" 26205}; 26206exports.AnnotationStateModelType = AnnotationStateModelType; 26207const AnnotationMarkedState = { 26208 MARKED: "Marked", 26209 UNMARKED: "Unmarked" 26210}; 26211exports.AnnotationMarkedState = AnnotationMarkedState; 26212const AnnotationReviewState = { 26213 ACCEPTED: "Accepted", 26214 REJECTED: "Rejected", 26215 CANCELLED: "Cancelled", 26216 COMPLETED: "Completed", 26217 NONE: "None" 26218}; 26219exports.AnnotationReviewState = AnnotationReviewState; 26220const AnnotationReplyType = { 26221 GROUP: "Group", 26222 REPLY: "R" 26223}; 26224exports.AnnotationReplyType = AnnotationReplyType; 26225const AnnotationFlag = { 26226 INVISIBLE: 0x01, 26227 HIDDEN: 0x02, 26228 PRINT: 0x04, 26229 NOZOOM: 0x08, 26230 NOROTATE: 0x10, 26231 NOVIEW: 0x20, 26232 READONLY: 0x40, 26233 LOCKED: 0x80, 26234 TOGGLENOVIEW: 0x100, 26235 LOCKEDCONTENTS: 0x200 26236}; 26237exports.AnnotationFlag = AnnotationFlag; 26238const AnnotationFieldFlag = { 26239 READONLY: 0x0000001, 26240 REQUIRED: 0x0000002, 26241 NOEXPORT: 0x0000004, 26242 MULTILINE: 0x0001000, 26243 PASSWORD: 0x0002000, 26244 NOTOGGLETOOFF: 0x0004000, 26245 RADIO: 0x0008000, 26246 PUSHBUTTON: 0x0010000, 26247 COMBO: 0x0020000, 26248 EDIT: 0x0040000, 26249 SORT: 0x0080000, 26250 FILESELECT: 0x0100000, 26251 MULTISELECT: 0x0200000, 26252 DONOTSPELLCHECK: 0x0400000, 26253 DONOTSCROLL: 0x0800000, 26254 COMB: 0x1000000, 26255 RICHTEXT: 0x2000000, 26256 RADIOSINUNISON: 0x2000000, 26257 COMMITONSELCHANGE: 0x4000000 26258}; 26259exports.AnnotationFieldFlag = AnnotationFieldFlag; 26260const AnnotationBorderStyleType = { 26261 SOLID: 1, 26262 DASHED: 2, 26263 BEVELED: 3, 26264 INSET: 4, 26265 UNDERLINE: 5 26266}; 26267exports.AnnotationBorderStyleType = AnnotationBorderStyleType; 26268const StreamType = { 26269 UNKNOWN: "UNKNOWN", 26270 FLATE: "FLATE", 26271 LZW: "LZW", 26272 DCT: "DCT", 26273 JPX: "JPX", 26274 JBIG: "JBIG", 26275 A85: "A85", 26276 AHX: "AHX", 26277 CCF: "CCF", 26278 RLX: "RLX" 26279}; 26280exports.StreamType = StreamType; 26281const FontType = { 26282 UNKNOWN: "UNKNOWN", 26283 TYPE1: "TYPE1", 26284 TYPE1C: "TYPE1C", 26285 CIDFONTTYPE0: "CIDFONTTYPE0", 26286 CIDFONTTYPE0C: "CIDFONTTYPE0C", 26287 TRUETYPE: "TRUETYPE", 26288 CIDFONTTYPE2: "CIDFONTTYPE2", 26289 TYPE3: "TYPE3", 26290 OPENTYPE: "OPENTYPE", 26291 TYPE0: "TYPE0", 26292 MMTYPE1: "MMTYPE1" 26293}; 26294exports.FontType = FontType; 26295const VerbosityLevel = { 26296 ERRORS: 0, 26297 WARNINGS: 1, 26298 INFOS: 5 26299}; 26300exports.VerbosityLevel = VerbosityLevel; 26301const CMapCompressionType = { 26302 NONE: 0, 26303 BINARY: 1, 26304 STREAM: 2 26305}; 26306exports.CMapCompressionType = CMapCompressionType; 26307const OPS = { 26308 dependency: 1, 26309 setLineWidth: 2, 26310 setLineCap: 3, 26311 setLineJoin: 4, 26312 setMiterLimit: 5, 26313 setDash: 6, 26314 setRenderingIntent: 7,
26315 setFlatness: 8, 26316 setGState: 9, 26317 save: 10, 26318 restore: 11, 26319 transform: 12, 26320 moveTo: 13, 26321 lineTo: 14, 26322 curveTo: 15, 26323 curveTo2: 16, 26324 curveTo3: 17, 26325 closePath: 18, 26326 rectangle: 19, 26327 stroke: 20, 26328 closeStroke: 21, 26329 fill: 22, 26330 eoFill: 23, 26331 fillStroke: 24, 26332 eoFillStroke: 25, 26333 closeFillStroke: 26, 26334 closeEOFillStroke: 27, 26335 endPath: 28, 26336 clip: 29, 26337 eoClip: 30, 26338 beginText: 31, 26339 endText: 32, 26340 setCharSpacing: 33, 26341 setWordSpacing: 34, 26342 setHScale: 35, 26343 setLeading: 36, 26344 setFont: 37, 26345 setTextRenderingMode: 38, 26346 setTextRise: 39, 26347 moveText: 40, 26348 setLeadingMoveText: 41, 26349 setTextMatrix: 42, 26350 nextLine: 43, 26351 showText: 44, 26352 showSpacedText: 45, 26353 nextLineShowText: 46, 26354 nextLineSetSpacingShowText: 47, 26355 setCharWidth: 48, 26356 setCharWidthAndBounds: 49, 26357 setStrokeColorSpace: 50, 26358 setFillColorSpace: 51, 26359 setStrokeColor: 52, 26360 setStrokeColorN: 53, 26361 setFillColor: 54, 26362 setFillColorN: 55, 26363 setStrokeGray: 56, 26364 setFillGray: 57, 26365 setStrokeRGBColor: 58, 26366 setFillRGBColor: 59, 26367 setStrokeCMYKColor: 60, 26368 setFillCMYKColor: 61, 26369 shadingFill: 62, 26370 beginInlineImage: 63, 26371 beginImageData: 64, 26372 endInlineImage: 65, 26373 paintXObject: 66, 26374 markPoint: 67, 26375 markPointProps: 68, 26376 beginMarkedContent: 69, 26377 beginMarkedContentProps: 70, 26378 endMarkedContent: 71, 26379 beginCompat: 72, 26380 endCompat: 73, 26381 paintFormXObjectBegin: 74, 26382 paintFormXObjectEnd: 75, 26383 beginGroup: 76, 26384 endGroup: 77, 26385 beginAnnotations: 78, 26386 endAnnotations: 79, 26387 beginAnnotation: 80, 26388 endAnnotation: 81, 26389 paintJpegXObject: 82, 26390 paintImageMaskXObject: 83, 26391 paintImageMaskXObjectGroup: 84, 26392 paintImageXObject: 85, 26393 paintInlineImageXObject: 86, 26394 paintInlineImageXObjectGroup: 87, 26395 paintImageXObjectRepeat: 88, 26396 paintImageMaskXObjectRepeat: 89, 26397 paintSolidColorImageMask: 90, 26398 constructPath: 91 26399}; 26400exports.OPS = OPS; 26401const UNSUPPORTED_FEATURES = { 26402 unknown: "unknown", 26403 forms: "forms", 26404 javaScript: "javaScript", 26405 smask: "smask", 26406 shadingPattern: "shadingPattern", 26407 font: "font" 26408}; 26409exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES; 26410const PasswordResponses = { 26411 NEED_PASSWORD: 1, 26412 INCORRECT_PASSWORD: 2 26413}; 26414exports.PasswordResponses = PasswordResponses; 26415let verbosity = VerbosityLevel.WARNINGS; 26416 26417function setVerbosityLevel(level) { 26418 if (Number.isInteger(level)) { 26419 verbosity = level; 26420 } 26421} 26422 26423function getVerbosityLevel() { 26424 return verbosity; 26425} 26426 26427function info(msg) { 26428 if (verbosity >= VerbosityLevel.INFOS) { 26429 console.log(`Info: ${msg}`); 26430 } 26431} 26432 26433function warn(msg) { 26434 if (verbosity >= VerbosityLevel.WARNINGS) { 26435 console.log(`Warning: ${msg}`); 26436 } 26437} 26438 26439function unreachable(msg) { 26440 throw new Error(msg); 26441} 26442 26443function assert(cond, msg) { 26444 if (!cond) { 26445 unreachable(msg); 26446 } 26447} 26448 26449function isSameOrigin(baseUrl, otherUrl) { 26450 let base; 26451 26452 try { 26453 base = new URL(baseUrl); 26454 26455 if (!base.origin || base.origin === "null") { 26456 return false; 26457 } 26458 } catch (e) { 26459 return false; 26460 } 26461 26462 const other = new URL(otherUrl, base); 26463 return base.origin === other.origin; 26464} 26465 26466function _isValidProtocol(url) { 26467 if (!url) { 26468 return false; 26469 } 26470 26471 switch (url.protocol) { 26472 case "http:": 26473 case "https:": 26474 case "ftp:": 26475 case "mailto:": 26476 case "tel:": 26477 return true; 26478 26479 default: 26480 return false; 26481 } 26482} 26483 26484function createValidAbsoluteUrl(url, baseUrl) { 26485 if (!url) { 26486 return null; 26487 } 26488 26489 try { 26490 const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url); 26491 26492 if (_isValidProtocol(absoluteUrl)) { 26493 return absoluteUrl; 26494 } 26495 } catch (ex) {} 26496 26497 return null; 26498} 26499 26500function shadow(obj, prop, value) { 26501 Object.defineProperty(obj, prop, { 26502 value, 26503 enumerable: true, 26504 configurable: true, 26505 writable: false 26506 }); 26507 return value; 26508} 26509 26510const BaseException = function BaseExceptionClosure() { 26511 function BaseException(message) { 26512 if (this.constructor === BaseException) { 26513 unreachable("Cannot initialize BaseException."); 26514 } 26515 26516 this.message = message; 26517 this.name = this.constructor.name; 26518 } 26519 26520 BaseException.prototype = new Error(); 26521 BaseException.constructor = BaseException; 26522 return BaseException; 26523}(); 26524 26525exports.BaseException = BaseException; 26526 26527class PasswordException extends BaseException { 26528 constructor(msg, code) { 26529 super(msg); 26530 this.code = code; 26531 } 26532 26533} 26534 26535exports.PasswordException = PasswordException; 26536 26537class UnknownErrorException extends BaseException { 26538 constructor(msg, details) { 26539 super(msg); 26540 this.details = details; 26541 } 26542 26543} 26544 26545exports.UnknownErrorException = UnknownErrorException; 26546 26547class InvalidPDFException extends BaseException {} 26548 26549exports.InvalidPDFException = InvalidPDFException; 26550 26551class MissingPDFException extends BaseException {} 26552 26553exports.MissingPDFException = MissingPDFException; 26554 26555class UnexpectedResponseException extends BaseException { 26556 constructor(msg, status) { 26557 super(msg); 26558 this.status = status; 26559 } 26560 26561} 26562 26563exports.UnexpectedResponseException = UnexpectedResponseException; 26564 26565class FormatError extends BaseException {} 26566 26567exports.FormatError = FormatError; 26568 26569class AbortException extends BaseException {} 26570 26571exports.AbortException = AbortException; 26572const NullCharactersRegExp = /\x00/g; 26573 26574function removeNullCharacters(str) { 26575 if (typeof str !== "string") { 26576 warn("The argument for removeNullCharacters must be a string."); 26577 return str; 26578 } 26579 26580 return str.replace(NullCharactersRegExp, ""); 26581} 26582 26583function bytesToString(bytes) { 26584 assert(bytes !== null && typeof bytes === "object" && bytes.length !== undefined, "Invalid argument for bytesToString"); 26585 const length = bytes.length; 26586 const MAX_ARGUMENT_COUNT = 8192; 26587 26588 if (length < MAX_ARGUMENT_COUNT) { 26589 return String.fromCharCode.apply(null, bytes); 26590 } 26591 26592 const strBuf = []; 26593 26594 for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) { 26595 const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length); 26596 const chunk = bytes.subarray(i, chunkEnd); 26597 strBuf.push(String.fromCharCode.apply(null, chunk)); 26598 } 26599 26600 return strBuf.join(""); 26601} 26602 26603function stringToBytes(str) { 26604 assert(typeof str === "string", "Invalid argument for stringToBytes"); 26605 const length = str.length; 26606 const bytes = new Uint8Array(length); 26607 26608 for (let i = 0; i < length; ++i) { 26609 bytes[i] = str.charCodeAt(i) & 0xff;
26610 } 26611 26612 return bytes; 26613} 26614 26615function arrayByteLength(arr) { 26616 if (arr.length !== undefined) { 26617 return arr.length; 26618 } 26619 26620 assert(arr.byteLength !== undefined); 26621 return arr.byteLength; 26622} 26623 26624function arraysToBytes(arr) { 26625 const length = arr.length; 26626 26627 if (length === 1 && arr[0] instanceof Uint8Array) { 26628 return arr[0]; 26629 } 26630 26631 let resultLength = 0; 26632 26633 for (let i = 0; i < length; i++) { 26634 resultLength += arrayByteLength(arr[i]); 26635 } 26636 26637 let pos = 0; 26638 const data = new Uint8Array(resultLength); 26639 26640 for (let i = 0; i < length; i++) { 26641 let item = arr[i]; 26642 26643 if (!(item instanceof Uint8Array)) { 26644 if (typeof item === "string") { 26645 item = stringToBytes(item); 26646 } else { 26647 item = new Uint8Array(item); 26648 } 26649 } 26650 26651 const itemLength = item.byteLength; 26652 data.set(item, pos); 26653 pos += itemLength; 26654 } 26655 26656 return data; 26657} 26658 26659function string32(value) { 26660 return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff); 26661} 26662 26663function isLittleEndian() { 26664 const buffer8 = new Uint8Array(4); 26665 buffer8[0] = 1; 26666 const view32 = new Uint32Array(buffer8.buffer, 0, 1); 26667 return view32[0] === 1; 26668} 26669 26670const IsLittleEndianCached = { 26671 get value() { 26672 return shadow(this, "value", isLittleEndian()); 26673 } 26674 26675}; 26676exports.IsLittleEndianCached = IsLittleEndianCached; 26677 26678function isEvalSupported() { 26679 try { 26680 new Function(""); 26681 return true; 26682 } catch (e) { 26683 return false; 26684 } 26685} 26686 26687const IsEvalSupportedCached = { 26688 get value() { 26689 return shadow(this, "value", isEvalSupported()); 26690 } 26691 26692}; 26693exports.IsEvalSupportedCached = IsEvalSupportedCached; 26694const rgbBuf = ["rgb(", 0, ",", 0, ",", 0, ")"]; 26695 26696class Util { 26697 static makeCssRgb(r, g, b) { 26698 rgbBuf[1] = r; 26699 rgbBuf[3] = g; 26700 rgbBuf[5] = b; 26701 return rgbBuf.join(""); 26702 } 26703 26704 static transform(m1, m2) { 26705 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]]; 26706 } 26707 26708 static applyTransform(p, m) { 26709 const xt = p[0] * m[0] + p[1] * m[2] + m[4]; 26710 const yt = p[0] * m[1] + p[1] * m[3] + m[5]; 26711 return [xt, yt]; 26712 } 26713 26714 static applyInverseTransform(p, m) { 26715 const d = m[0] * m[3] - m[1] * m[2]; 26716 const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d; 26717 const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d; 26718 return [xt, yt]; 26719 } 26720 26721 static getAxialAlignedBoundingBox(r, m) { 26722 const p1 = Util.applyTransform(r, m); 26723 const p2 = Util.applyTransform(r.slice(2, 4), m); 26724 const p3 = Util.applyTransform([r[0], r[3]], m); 26725 const p4 = Util.applyTransform([r[2], r[1]], m); 26726 return [Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math.max(p1[1], p2[1], p3[1], p4[1])]; 26727 } 26728 26729 static inverseTransform(m) { 26730 const d = m[0] * m[3] - m[1] * m[2]; 26731 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]; 26732 } 26733 26734 static apply3dTransform(m, v) { 26735 return [m[0] * v[0] + m[1] * v[1] + m[2] * v[2], m[3] * v[0] + m[4] * v[1] + m[5] * v[2], m[6] * v[0] + m[7] * v[1] + m[8] * v[2]]; 26736 } 26737 26738 static singularValueDecompose2dScale(m) { 26739 const transpose = [m[0], m[2], m[1], m[3]]; 26740 const a = m[0] * transpose[0] + m[1] * transpose[2]; 26741 const b = m[0] * transpose[1] + m[1] * transpose[3]; 26742 const c = m[2] * transpose[0] + m[3] * transpose[2]; 26743 const d = m[2] * transpose[1] + m[3] * transpose[3]; 26744 const first = (a + d) / 2; 26745 const second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2; 26746 const sx = first + second || 1; 26747 const sy = first - second || 1; 26748 return [Math.sqrt(sx), Math.sqrt(sy)]; 26749 } 26750 26751 static normalizeRect(rect) { 26752 const r = rect.slice(0); 26753 26754 if (rect[0] > rect[2]) { 26755 r[0] = rect[2]; 26756 r[2] = rect[0]; 26757 } 26758 26759 if (rect[1] > rect[3]) { 26760 r[1] = rect[3]; 26761 r[3] = rect[1]; 26762 } 26763 26764 return r; 26765 } 26766 26767 static intersect(rect1, rect2) { 26768 function compare(a, b) { 26769 return a - b; 26770 } 26771 26772 const orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare);
26773 const orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare); 26774 const result = []; 26775 rect1 = Util.normalizeRect(rect1); 26776 rect2 = Util.normalizeRect(rect2); 26777 26778 if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) { 26779 result[0] = orderedX[1]; 26780 result[2] = orderedX[2]; 26781 } else { 26782 return null; 26783 } 26784 26785 if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) { 26786 result[1] = orderedY[1]; 26787 result[3] = orderedY[2]; 26788 } else { 26789 return null; 26790 } 26791 26792 return result; 26793 } 26794 26795} 26796 26797exports.Util = Util; 26798const 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]; 26799 26800function stringToPDFString(str) { 26801 const length = str.length, 26802 strBuf = []; 26803 26804 if (str[0] === "\xFE" && str[1] === "\xFF") { 26805 for (let i = 2; i < length; i += 2) { 26806 strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1))); 26807 } 26808 } else if (str[0] === "\xFF" && str[1] === "\xFE") { 26809 for (let i = 2; i < length; i += 2) { 26810 strBuf.push(String.fromCharCode(str.charCodeAt(i + 1) << 8 | str.charCodeAt(i))); 26811 } 26812 } else { 26813 for (let i = 0; i < length; ++i) { 26814 const code = PDFStringTranslateTable[str.charCodeAt(i)]; 26815 strBuf.push(code ? String.fromCharCode(code) : str.charAt(i)); 26816 } 26817 } 26818 26819 return strBuf.join(""); 26820} 26821 26822function stringToUTF8String(str) { 26823 return decodeURIComponent(escape(str)); 26824} 26825 26826function utf8StringToString(str) { 26827 return unescape(encodeURIComponent(str)); 26828} 26829 26830function isEmptyObj(obj) { 26831 for (const key in obj) { 26832 return false; 26833 } 26834 26835 return true; 26836} 26837 26838function isBool(v) { 26839 return typeof v === "boolean"; 26840} 26841 26842function isNum(v) { 26843 return typeof v === "number"; 26844} 26845 26846function isString(v) { 26847 return typeof v === "string"; 26848} 26849 26850function isArrayBuffer(v) { 26851 return typeof v === "object" && v !== null && v.byteLength !== undefined; 26852} 26853 26854function isArrayEqual(arr1, arr2) { 26855 if (arr1.length !== arr2.length) { 26856 return false; 26857 } 26858 26859 return arr1.every(function (element, index) { 26860 return element === arr2[index]; 26861 }); 26862} 26863 26864function createPromiseCapability() { 26865 const capability = Object.create(null); 26866 let isSettled = false; 26867 Object.defineProperty(capability, "settled", { 26868 get() { 26869 return isSettled; 26870 } 26871 26872 }); 26873 capability.promise = new Promise(function (resolve, reject) { 26874 capability.resolve = function (data) { 26875 isSettled = true; 26876 resolve(data); 26877 }; 26878 26879 capability.reject = function (reason) { 26880 isSettled = true; 26881 reject(reason); 26882 }; 26883 }); 26884 return capability; 26885} 26886 26887const createObjectURL = function createObjectURLClosure() { 26888 const digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; 26889 return function createObjectURL(data, contentType, forceDataSchema = false) { 26890 if (!forceDataSchema && URL.createObjectURL) { 26891 const blob = new Blob([data], { 26892 type: contentType 26893 }); 26894 return URL.createObjectURL(blob); 26895 } 26896 26897 let buffer = `data:${contentType};base64,`; 26898 26899 for (let i = 0, ii = data.length; i < ii; i += 3) { 26900 const b1 = data[i] & 0xff; 26901 const b2 = data[i + 1] & 0xff; 26902 const b3 = data[i + 2] & 0xff;
26903 const d1 = b1 >> 2, 26904 d2 = (b1 & 3) << 4 | b2 >> 4; 26905 const d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64; 26906 const d4 = i + 2 < ii ? b3 & 0x3f : 64; 26907 buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4]; 26908 } 26909 26910 return buffer; 26911 }; 26912}(); 26913 26914exports.createObjectURL = createObjectURL; 26915 26916/***/ }), 26917/* 3 */ 26918/***/ (function(module, exports, __w_pdfjs_require__) { 26919 26920"use strict"; 26921 26922 26923; 26924 26925/***/ }), 26926/* 4 */ 26927/***/ (function(module, exports, __w_pdfjs_require__) { 26928 26929"use strict"; 26930 26931 26932Object.defineProperty(exports, "__esModule", { 26933 value: true 26934}); 26935exports.clearPrimitiveCaches = clearPrimitiveCaches; 26936exports.isEOF = isEOF; 26937exports.isCmd = isCmd; 26938exports.isDict = isDict; 26939exports.isName = isName; 26940exports.isRef = isRef; 26941exports.isRefsEqual = isRefsEqual; 26942exports.isStream = isStream; 26943exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.Dict = exports.Cmd = exports.EOF = void 0; 26944 26945var _util = __w_pdfjs_require__(2); 26946 26947var EOF = {}; 26948exports.EOF = EOF; 26949 26950var Name = function NameClosure() { 26951 let nameCache = Object.create(null); 26952 26953 function Name(name) { 26954 this.name = name; 26955 } 26956 26957 Name.prototype = {}; 26958 26959 Name.get = function Name_get(name) { 26960 var nameValue = nameCache[name]; 26961 return nameValue ? nameValue : nameCache[name] = new Name(name); 26962 }; 26963 26964 Name._clearCache = function () { 26965 nameCache = Object.create(null); 26966 }; 26967 26968 return Name; 26969}(); 26970 26971exports.Name = Name; 26972 26973var Cmd = function CmdClosure() { 26974 let cmdCache = Object.create(null); 26975 26976 function Cmd(cmd) { 26977 this.cmd = cmd; 26978 } 26979 26980 Cmd.prototype = {}; 26981 26982 Cmd.get = function Cmd_get(cmd) { 26983 var cmdValue = cmdCache[cmd]; 26984 return cmdValue ? cmdValue : cmdCache[cmd] = new Cmd(cmd); 26985 }; 26986 26987 Cmd._clearCache = function () { 26988 cmdCache = Object.create(null); 26989 }; 26990 26991 return Cmd; 26992}(); 26993 26994exports.Cmd = Cmd; 26995 26996var Dict = function DictClosure() { 26997 var nonSerializable = function nonSerializableClosure() { 26998 return nonSerializable; 26999 }; 27000 27001 function Dict(xref) { 27002 this._map = Object.create(null); 27003 this.xref = xref; 27004 this.objId = null; 27005 this.suppressEncryption = false; 27006 this.__nonSerializable__ = nonSerializable; 27007 } 27008 27009 Dict.prototype = { 27010 assignXref: function Dict_assignXref(newXref) { 27011 this.xref = newXref; 27012 }, 27013 27014 get(key1, key2, key3) { 27015 let value = this._map[key1]; 27016 27017 if (value === undefined && key2 !== undefined) { 27018 value = this._map[key2]; 27019 27020 if (value === undefined && key3 !== undefined) { 27021 value = this._map[key3]; 27022 } 27023 } 27024 27025 if (value instanceof Ref && this.xref) { 27026 return this.xref.fetch(value, this.suppressEncryption); 27027 } 27028 27029 return value; 27030 }, 27031 27032 async getAsync(key1, key2, key3) { 27033 let value = this._map[key1]; 27034 27035 if (value === undefined && key2 !== undefined) { 27036 value = this._map[key2]; 27037 27038 if (value === undefined && key3 !== undefined) { 27039 value = this._map[key3]; 27040 } 27041 } 27042 27043 if (value instanceof Ref && this.xref) { 27044 return this.xref.fetchAsync(value, this.suppressEncryption); 27045 } 27046 27047 return value; 27048 }, 27049 27050 getArray(key1, key2, key3) { 27051 let value = this.get(key1, key2, key3); 27052 27053 if (!Array.isArray(value) || !this.xref) { 27054 return value; 27055 } 27056 27057 value = value.slice(); 27058 27059 for (let i = 0, ii = value.length; i < ii; i++) { 27060 if (!(value[i] instanceof Ref)) { 27061 continue; 27062 } 27063 27064 value[i] = this.xref.fetch(value[i], this.suppressEncryption); 27065 } 27066 27067 return value; 27068 }, 27069 27070 getRaw: function Dict_getRaw(key) { 27071 return this._map[key]; 27072 }, 27073 getKeys: function Dict_getKeys() { 27074 return Object.keys(this._map); 27075 }, 27076 set: function Dict_set(key, value) { 27077 this._map[key] = value; 27078 }, 27079 has: function Dict_has(key) { 27080 return this._map[key] !== undefined; 27081 }, 27082 forEach: function Dict_forEach(callback) { 27083 for (var key in this._map) { 27084 callback(key, this.get(key)); 27085 } 27086 } 27087 }; 27088 Dict.empty = new Dict(null); 27089 27090 Dict.merge = function (xref, dictArray) { 27091 const mergedDict = new Dict(xref); 27092 27093 for (let i = 0, ii = dictArray.length; i < ii; i++) { 27094 const dict = dictArray[i]; 27095 27096 if (!isDict(dict)) { 27097 continue; 27098 } 27099 27100 for (const keyName in dict._map) { 27101 if (mergedDict._map[keyName] !== undefined) { 27102 continue; 27103 } 27104 27105 mergedDict._map[keyName] = dict._map[keyName]; 27106 } 27107 } 27108 27109 return mergedDict; 27110 }; 27111 27112 return Dict; 27113}(); 27114 27115exports.Dict = Dict; 27116 27117var Ref = function RefClosure() { 27118 let refCache = Object.create(null); 27119 27120 function Ref(num, gen) { 27121 this.num = num; 27122 this.gen = gen; 27123 } 27124 27125 Ref.prototype = { 27126 toString: function Ref_toString() { 27127 if (this.gen === 0) { 27128 return `${this.num}R`; 27129 } 27130 27131 return `${this.num}R${this.gen}`; 27132 } 27133 }; 27134 27135 Ref.get = function (num, gen) {
27136 const key = gen === 0 ? `${num}R` : `${num}R${gen}`; 27137 const refValue = refCache[key]; 27138 return refValue ? refValue : refCache[key] = new Ref(num, gen); 27139 }; 27140 27141 Ref._clearCache = function () { 27142 refCache = Object.create(null); 27143 }; 27144 27145 return Ref; 27146}(); 27147 27148exports.Ref = Ref; 27149 27150var RefSet = function RefSetClosure() { 27151 function RefSet() { 27152 this.dict = Object.create(null); 27153 } 27154 27155 RefSet.prototype = { 27156 has: function RefSet_has(ref) { 27157 return ref.toString() in this.dict; 27158 }, 27159 put: function RefSet_put(ref) { 27160 this.dict[ref.toString()] = true; 27161 }, 27162 remove: function RefSet_remove(ref) { 27163 delete this.dict[ref.toString()]; 27164 } 27165 }; 27166 return RefSet; 27167}(); 27168 27169exports.RefSet = RefSet; 27170 27171var RefSetCache = function RefSetCacheClosure() { 27172 function RefSetCache() { 27173 this.dict = Object.create(null); 27174 } 27175 27176 RefSetCache.prototype = { 27177 get: function RefSetCache_get(ref) { 27178 return this.dict[ref.toString()]; 27179 }, 27180 has: function RefSetCache_has(ref) { 27181 return ref.toString() in this.dict; 27182 }, 27183 put: function RefSetCache_put(ref, obj) { 27184 this.dict[ref.toString()] = obj; 27185 }, 27186 putAlias: function RefSetCache_putAlias(ref, aliasRef) { 27187 this.dict[ref.toString()] = this.get(aliasRef); 27188 }, 27189 forEach: function RefSetCache_forEach(callback) { 27190 for (const i in this.dict) { 27191 callback(this.dict[i]); 27192 } 27193 }, 27194 clear: function RefSetCache_clear() { 27195 this.dict = Object.create(null); 27196 } 27197 }; 27198 return RefSetCache; 27199}(); 27200 27201exports.RefSetCache = RefSetCache; 27202 27203function isEOF(v) { 27204 return v === EOF; 27205} 27206 27207function isName(v, name) { 27208 return v instanceof Name && (name === undefined || v.name === name); 27209} 27210 27211function isCmd(v, cmd) { 27212 return v instanceof Cmd && (cmd === undefined || v.cmd === cmd); 27213} 27214 27215function isDict(v, type) { 27216 return v instanceof Dict && (type === undefined || isName(v.get("Type"), type)); 27217} 27218 27219function isRef(v) { 27220 return v instanceof Ref; 27221} 27222 27223function isRefsEqual(v1, v2) { 27224 return v1.num === v2.num && v1.gen === v2.gen; 27225} 27226 27227function isStream(v) { 27228 return typeof v === "object" && v !== null && v.getBytes !== undefined; 27229} 27230 27231function clearPrimitiveCaches() { 27232 Cmd._clearCache(); 27233 27234 Name._clearCache(); 27235 27236 Ref._clearCache(); 27237} 27238 27239/***/ }), 27240/* 5 */ 27241/***/ (function(module, exports, __w_pdfjs_require__) { 27242 27243"use strict"; 27244 27245 27246Object.defineProperty(exports, "__esModule", { 27247 value: true 27248}); 27249exports.NetworkPdfManager = exports.LocalPdfManager = void 0; 27250 27251var _util = __w_pdfjs_require__(2); 27252 27253var _chunked_stream = __w_pdfjs_require__(6); 27254 27255var _core_utils = __w_pdfjs_require__(7); 27256 27257var _document = __w_pdfjs_require__(8); 27258 27259var _stream = __w_pdfjs_require__(11); 27260 27261class BasePdfManager { 27262 constructor() { 27263 if (this.constructor === BasePdfManager) { 27264 (0, _util.unreachable)("Cannot initialize BasePdfManager."); 27265 } 27266 } 27267 27268 get docId() { 27269 return this._docId; 27270 } 27271 27272 get password() { 27273 return this._password; 27274 } 27275 27276 get docBaseUrl() { 27277 let docBaseUrl = null; 27278 27279 if (this._docBaseUrl) { 27280 const absoluteUrl = (0, _util.createValidAbsoluteUrl)(this._docBaseUrl); 27281 27282 if (absoluteUrl) { 27283 docBaseUrl = absoluteUrl.href; 27284 } else { 27285 (0, _util.warn)(`Invalid absolute docBaseUrl: "${this._docBaseUrl}".`); 27286 } 27287 } 27288 27289 return (0, _util.shadow)(this, "docBaseUrl", docBaseUrl); 27290 } 27291 27292 onLoadedStream() { 27293 (0, _util.unreachable)("Abstract method `onLoadedStream` called"); 27294 } 27295 27296 ensureDoc(prop, args) { 27297 return this.ensure(this.pdfDocument, prop, args); 27298 } 27299 27300 ensureXRef(prop, args) { 27301 return this.ensure(this.pdfDocument.xref, prop, args); 27302 } 27303 27304 ensureCatalog(prop, args) { 27305 return this.ensure(this.pdfDocument.catalog, prop, args); 27306 } 27307 27308 getPage(pageIndex) { 27309 return this.pdfDocument.getPage(pageIndex); 27310 } 27311 27312 fontFallback(id, handler) { 27313 return this.pdfDocument.fontFallback(id, handler); 27314 } 27315 27316 cleanup() { 27317 return this.pdfDocument.cleanup(); 27318 } 27319 27320 async ensure(obj, prop, args) { 27321 (0, _util.unreachable)("Abstract method `ensure` called"); 27322 } 27323 27324 requestRange(begin, end) { 27325 (0, _util.unreachable)("Abstract method `requestRange` called"); 27326 } 27327 27328 requestLoadedStream() { 27329 (0, _util.unreachable)("Abstract method `requestLoadedStream` called"); 27330 } 27331 27332 sendProgressiveData(chunk) { 27333 (0, _util.unreachable)("Abstract method `sendProgressiveData` called"); 27334 } 27335 27336 updatePassword(password) { 27337 this._password = password; 27338 } 27339 27340 terminate(reason) { 27341 (0, _util.unreachable)("Abstract method `terminate` called"); 27342 } 27343 27344} 27345 27346class LocalPdfManager extends BasePdfManager { 27347 constructor(docId, data, password, evaluatorOptions, docBaseUrl) { 27348 super(); 27349 this._docId = docId; 27350 this._password = password; 27351 this._docBaseUrl = docBaseUrl; 27352 this.evaluatorOptions = evaluatorOptions; 27353 const stream = new _stream.Stream(data); 27354 this.pdfDocument = new _document.PDFDocument(this, stream); 27355 this._loadedStreamPromise = Promise.resolve(stream); 27356 } 27357 27358 async ensure(obj, prop, args) { 27359 const value = obj[prop]; 27360 27361 if (typeof value === "function") {
27362 return value.apply(obj, args); 27363 } 27364 27365 return value; 27366 } 27367 27368 requestRange(begin, end) { 27369 return Promise.resolve(); 27370 } 27371 27372 requestLoadedStream() {} 27373 27374 onLoadedStream() { 27375 return this._loadedStreamPromise; 27376 } 27377 27378 terminate(reason) {} 27379 27380} 27381 27382exports.LocalPdfManager = LocalPdfManager; 27383 27384class NetworkPdfManager extends BasePdfManager { 27385 constructor(docId, pdfNetworkStream, args, evaluatorOptions, docBaseUrl) { 27386 super(); 27387 this._docId = docId; 27388 this._password = args.password; 27389 this._docBaseUrl = docBaseUrl; 27390 this.msgHandler = args.msgHandler; 27391 this.evaluatorOptions = evaluatorOptions; 27392 this.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, { 27393 msgHandler: args.msgHandler, 27394 length: args.length, 27395 disableAutoFetch: args.disableAutoFetch, 27396 rangeChunkSize: args.rangeChunkSize 27397 }); 27398 this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream()); 27399 } 27400 27401 async ensure(obj, prop, args) { 27402 try { 27403 const value = obj[prop]; 27404 27405 if (typeof value === "function") { 27406 return value.apply(obj, args); 27407 } 27408 27409 return value; 27410 } catch (ex) { 27411 if (!(ex instanceof _core_utils.MissingDataException)) { 27412 throw ex; 27413 } 27414 27415 await this.requestRange(ex.begin, ex.end); 27416 return this.ensure(obj, prop, args); 27417 } 27418 } 27419 27420 requestRange(begin, end) { 27421 return this.streamManager.requestRange(begin, end); 27422 } 27423 27424 requestLoadedStream() { 27425 this.streamManager.requestAllChunks(); 27426 } 27427 27428 sendProgressiveData(chunk) { 27429 this.streamManager.onReceiveData({ 27430 chunk 27431 }); 27432 } 27433 27434 onLoadedStream() { 27435 return this.streamManager.onLoadedStream(); 27436 } 27437 27438 terminate(reason) { 27439 this.streamManager.abort(reason); 27440 } 27441 27442} 27443 27444exports.NetworkPdfManager = NetworkPdfManager; 27445 27446/***/ }), 27447/* 6 */ 27448/***/ (function(module, exports, __w_pdfjs_require__) { 27449 27450"use strict"; 27451 27452 27453Object.defineProperty(exports, "__esModule", { 27454 value: true 27455}); 27456exports.ChunkedStreamManager = exports.ChunkedStream = void 0; 27457 27458var _util = __w_pdfjs_require__(2); 27459 27460var _core_utils = __w_pdfjs_require__(7); 27461 27462class ChunkedStream { 27463 constructor(length, chunkSize, manager) { 27464 this.bytes = new Uint8Array(length); 27465 this.start = 0; 27466 this.pos = 0; 27467 this.end = length; 27468 this.chunkSize = chunkSize; 27469 this.loadedChunks = []; 27470 this.numChunksLoaded = 0; 27471 this.numChunks = Math.ceil(length / chunkSize); 27472 this.manager = manager; 27473 this.progressiveDataLength = 0; 27474 this.lastSuccessfulEnsureByteChunk = -1; 27475 } 27476 27477 getMissingChunks() { 27478 const chunks = []; 27479 27480 for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) { 27481 if (!this.loadedChunks[chunk]) { 27482 chunks.push(chunk); 27483 } 27484 } 27485 27486 return chunks; 27487 } 27488 27489 getBaseStreams() { 27490 return [this]; 27491 } 27492 27493 allChunksLoaded() { 27494 return this.numChunksLoaded === this.numChunks; 27495 } 27496 27497 onReceiveData(begin, chunk) { 27498 const chunkSize = this.chunkSize; 27499 27500 if (begin % chunkSize !== 0) { 27501 throw new Error(`Bad begin offset: ${begin}`); 27502 } 27503 27504 const end = begin + chunk.byteLength; 27505 27506 if (end % chunkSize !== 0 && end !== this.bytes.length) { 27507 throw new Error(`Bad end offset: ${end}`); 27508 } 27509 27510 this.bytes.set(new Uint8Array(chunk), begin); 27511 const beginChunk = Math.floor(begin / chunkSize); 27512 const endChunk = Math.floor((end - 1) / chunkSize) + 1; 27513 27514 for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) { 27515 if (!this.loadedChunks[curChunk]) { 27516 this.loadedChunks[curChunk] = true; 27517 ++this.numChunksLoaded; 27518 } 27519 } 27520 } 27521 27522 onReceiveProgressiveData(data) { 27523 let position = this.progressiveDataLength; 27524 const beginChunk = Math.floor(position / this.chunkSize); 27525 this.bytes.set(new Uint8Array(data), position); 27526 position += data.byteLength; 27527 this.progressiveDataLength = position; 27528 const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize); 27529 27530 for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) { 27531 if (!this.loadedChunks[curChunk]) { 27532 this.loadedChunks[curChunk] = true; 27533 ++this.numChunksLoaded; 27534 } 27535 } 27536 } 27537 27538 ensureByte(pos) { 27539 if (pos < this.progressiveDataLength) { 27540 return; 27541 } 27542 27543 const chunk = Math.floor(pos / this.chunkSize); 27544 27545 if (chunk === this.lastSuccessfulEnsureByteChunk) { 27546 return; 27547 } 27548 27549 if (!this.loadedChunks[chunk]) { 27550 throw new _core_utils.MissingDataException(pos, pos + 1); 27551 } 27552 27553 this.lastSuccessfulEnsureByteChunk = chunk; 27554 } 27555 27556 ensureRange(begin, end) { 27557 if (begin >= end) { 27558 return; 27559 } 27560 27561 if (end <= this.progressiveDataLength) { 27562 return; 27563 } 27564 27565 const chunkSize = this.chunkSize; 27566 const beginChunk = Math.floor(begin / chunkSize); 27567 const endChunk = Math.floor((end - 1) / chunkSize) + 1; 27568 27569 for (let chunk = beginChunk; chunk < endChunk; ++chunk) { 27570 if (!this.loadedChunks[chunk]) { 27571 throw new _core_utils.MissingDataException(begin, end); 27572 } 27573 } 27574 } 27575 27576 nextEmptyChunk(beginChunk) { 27577 const numChunks = this.numChunks; 27578 27579 for (let i = 0; i < numChunks; ++i) { 27580 const chunk = (beginChunk + i) % numChunks; 27581 27582 if (!this.loadedChunks[chunk]) { 27583 return chunk; 27584 } 27585 } 27586 27587 return null; 27588 } 27589 27590 hasChunk(chunk) { 27591 return !!this.loadedChunks[chunk]; 27592 } 27593 27594 get length() {
27595 return this.end - this.start; 27596 } 27597 27598 get isEmpty() { 27599 return this.length === 0; 27600 } 27601 27602 getByte() { 27603 const pos = this.pos; 27604 27605 if (pos >= this.end) { 27606 return -1; 27607 } 27608 27609 if (pos >= this.progressiveDataLength) { 27610 this.ensureByte(pos); 27611 } 27612 27613 return this.bytes[this.pos++]; 27614 } 27615 27616 getUint16() { 27617 const b0 = this.getByte(); 27618 const b1 = this.getByte(); 27619 27620 if (b0 === -1 || b1 === -1) { 27621 return -1; 27622 } 27623 27624 return (b0 << 8) + b1; 27625 } 27626 27627 getInt32() { 27628 const b0 = this.getByte(); 27629 const b1 = this.getByte(); 27630 const b2 = this.getByte(); 27631 const b3 = this.getByte(); 27632 return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3; 27633 } 27634 27635 getBytes(length, forceClamped = false) { 27636 const bytes = this.bytes; 27637 const pos = this.pos; 27638 const strEnd = this.end; 27639 27640 if (!length) { 27641 if (strEnd > this.progressiveDataLength) { 27642 this.ensureRange(pos, strEnd); 27643 } 27644 27645 const subarray = bytes.subarray(pos, strEnd); 27646 return forceClamped ? new Uint8ClampedArray(subarray) : subarray; 27647 } 27648 27649 let end = pos + length; 27650 27651 if (end > strEnd) { 27652 end = strEnd; 27653 } 27654 27655 if (end > this.progressiveDataLength) { 27656 this.ensureRange(pos, end); 27657 } 27658 27659 this.pos = end; 27660 const subarray = bytes.subarray(pos, end); 27661 return forceClamped ? new Uint8ClampedArray(subarray) : subarray; 27662 } 27663 27664 peekByte() { 27665 const peekedByte = this.getByte(); 27666 27667 if (peekedByte !== -1) { 27668 this.pos--; 27669 } 27670 27671 return peekedByte; 27672 } 27673 27674 peekBytes(length, forceClamped = false) { 27675 const bytes = this.getBytes(length, forceClamped); 27676 this.pos -= bytes.length; 27677 return bytes; 27678 } 27679 27680 getByteRange(begin, end) { 27681 if (begin < 0) { 27682 begin = 0; 27683 } 27684 27685 if (end > this.end) { 27686 end = this.end; 27687 } 27688 27689 if (end > this.progressiveDataLength) { 27690 this.ensureRange(begin, end); 27691 } 27692 27693 return this.bytes.subarray(begin, end); 27694 } 27695 27696 skip(n) { 27697 if (!n) { 27698 n = 1; 27699 } 27700 27701 this.pos += n; 27702 } 27703 27704 reset() { 27705 this.pos = this.start; 27706 } 27707 27708 moveStart() { 27709 this.start = this.pos; 27710 } 27711 27712 makeSubStream(start, length, dict) { 27713 if (length) { 27714 if (start + length > this.progressiveDataLength) { 27715 this.ensureRange(start, start + length); 27716 } 27717 } else { 27718 if (start >= this.progressiveDataLength) { 27719 this.ensureByte(start); 27720 } 27721 } 27722 27723 function ChunkedStreamSubstream() {} 27724 27725 ChunkedStreamSubstream.prototype = Object.create(this); 27726 27727 ChunkedStreamSubstream.prototype.getMissingChunks = function () { 27728 const chunkSize = this.chunkSize; 27729 const beginChunk = Math.floor(this.start / chunkSize); 27730 const endChunk = Math.floor((this.end - 1) / chunkSize) + 1; 27731 const missingChunks = []; 27732 27733 for (let chunk = beginChunk; chunk < endChunk; ++chunk) { 27734 if (!this.loadedChunks[chunk]) { 27735 missingChunks.push(chunk); 27736 } 27737 } 27738 27739 return missingChunks; 27740 }; 27741 27742 ChunkedStreamSubstream.prototype.allChunksLoaded = function () { 27743 if (this.numChunksLoaded === this.numChunks) { 27744 return true; 27745 } 27746 27747 return this.getMissingChunks().length === 0; 27748 }; 27749 27750 const subStream = new ChunkedStreamSubstream(); 27751 subStream.pos = subStream.start = start; 27752 subStream.end = start + length || this.end; 27753 subStream.dict = dict; 27754 return subStream; 27755 } 27756 27757} 27758 27759exports.ChunkedStream = ChunkedStream; 27760 27761class ChunkedStreamManager { 27762 constructor(pdfNetworkStream, args) { 27763 this.length = args.length; 27764 this.chunkSize = args.rangeChunkSize; 27765 this.stream = new ChunkedStream(this.length, this.chunkSize, this); 27766 this.pdfNetworkStream = pdfNetworkStream; 27767 this.disableAutoFetch = args.disableAutoFetch; 27768 this.msgHandler = args.msgHandler; 27769 this.currRequestId = 0; 27770 this.chunksNeededByRequest = Object.create(null); 27771 this.requestsByChunk = Object.create(null); 27772 this.promisesByRequest = Object.create(null); 27773 this.progressiveDataLength = 0; 27774 this.aborted = false; 27775 this._loadedStreamCapability = (0, _util.createPromiseCapability)(); 27776 } 27777 27778 onLoadedStream() { 27779 return this._loadedStreamCapability.promise; 27780 } 27781 27782 sendRequest(begin, end) { 27783 const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end); 27784 27785 if (!rangeReader.isStreamingSupported) { 27786 rangeReader.onProgress = this.onProgress.bind(this); 27787 } 27788
27789 let chunks = [], 27790 loaded = 0; 27791 const promise = new Promise((resolve, reject) => { 27792 const readChunk = chunk => { 27793 try { 27794 if (!chunk.done) { 27795 const data = chunk.value; 27796 chunks.push(data); 27797 loaded += (0, _util.arrayByteLength)(data); 27798 27799 if (rangeReader.isStreamingSupported) { 27800 this.onProgress({ 27801 loaded 27802 }); 27803 } 27804 27805 rangeReader.read().then(readChunk, reject); 27806 return; 27807 } 27808 27809 const chunkData = (0, _util.arraysToBytes)(chunks); 27810 chunks = null; 27811 resolve(chunkData); 27812 } catch (e) { 27813 reject(e); 27814 } 27815 }; 27816 27817 rangeReader.read().then(readChunk, reject); 27818 }); 27819 promise.then(data => { 27820 if (this.aborted) { 27821 return; 27822 } 27823 27824 this.onReceiveData({ 27825 chunk: data, 27826 begin 27827 }); 27828 }); 27829 } 27830 27831 requestAllChunks() { 27832 const missingChunks = this.stream.getMissingChunks(); 27833 27834 this._requestChunks(missingChunks); 27835 27836 return this._loadedStreamCapability.promise; 27837 } 27838 27839 _requestChunks(chunks) { 27840 const requestId = this.currRequestId++; 27841 const chunksNeeded = Object.create(null); 27842 this.chunksNeededByRequest[requestId] = chunksNeeded; 27843 27844 for (const chunk of chunks) { 27845 if (!this.stream.hasChunk(chunk)) { 27846 chunksNeeded[chunk] = true; 27847 } 27848 } 27849 27850 if ((0, _util.isEmptyObj)(chunksNeeded)) { 27851 return Promise.resolve(); 27852 } 27853 27854 const capability = (0, _util.createPromiseCapability)(); 27855 this.promisesByRequest[requestId] = capability; 27856 const chunksToRequest = []; 27857 27858 for (let chunk in chunksNeeded) { 27859 chunk = chunk | 0; 27860 27861 if (!(chunk in this.requestsByChunk)) { 27862 this.requestsByChunk[chunk] = []; 27863 chunksToRequest.push(chunk); 27864 } 27865 27866 this.requestsByChunk[chunk].push(requestId); 27867 } 27868 27869 if (!chunksToRequest.length) { 27870 return capability.promise; 27871 } 27872 27873 const groupedChunksToRequest = this.groupChunks(chunksToRequest); 27874 27875 for (const groupedChunk of groupedChunksToRequest) { 27876 const begin = groupedChunk.beginChunk * this.chunkSize; 27877 const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length); 27878 this.sendRequest(begin, end); 27879 } 27880 27881 return capability.promise; 27882 } 27883 27884 getStream() { 27885 return this.stream; 27886 } 27887 27888 requestRange(begin, end) { 27889 end = Math.min(end, this.length); 27890 const beginChunk = this.getBeginChunk(begin); 27891 const endChunk = this.getEndChunk(end); 27892 const chunks = []; 27893 27894 for (let chunk = beginChunk; chunk < endChunk; ++chunk) { 27895 chunks.push(chunk); 27896 } 27897 27898 return this._requestChunks(chunks); 27899 } 27900 27901 requestRanges(ranges = []) { 27902 const chunksToRequest = []; 27903 27904 for (const range of ranges) { 27905 const beginChunk = this.getBeginChunk(range.begin); 27906 const endChunk = this.getEndChunk(range.end); 27907 27908 for (let chunk = beginChunk; chunk < endChunk; ++chunk) { 27909 if (!chunksToRequest.includes(chunk)) { 27910 chunksToRequest.push(chunk); 27911 } 27912 } 27913 } 27914 27915 chunksToRequest.sort(function (a, b) { 27916 return a - b; 27917 }); 27918 return this._requestChunks(chunksToRequest); 27919 } 27920 27921 groupChunks(chunks) { 27922 const groupedChunks = []; 27923 let beginChunk = -1; 27924 let prevChunk = -1; 27925 27926 for (let i = 0, ii = chunks.length; i < ii; ++i) { 27927 const chunk = chunks[i]; 27928 27929 if (beginChunk < 0) { 27930 beginChunk = chunk; 27931 } 27932 27933 if (prevChunk >= 0 && prevChunk + 1 !== chunk) { 27934 groupedChunks.push({ 27935 beginChunk, 27936 endChunk: prevChunk + 1 27937 }); 27938 beginChunk = chunk; 27939 } 27940 27941 if (i + 1 === chunks.length) { 27942 groupedChunks.push({ 27943 beginChunk, 27944 endChunk: chunk + 1 27945 }); 27946 } 27947 27948 prevChunk = chunk; 27949 } 27950 27951 return groupedChunks; 27952 } 27953 27954 onProgress(args) { 27955 this.msgHandler.send("DocProgress", { 27956 loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded, 27957 total: this.length 27958 }); 27959 } 27960 27961 onReceiveData(args) { 27962 const chunk = args.chunk; 27963 const isProgressive = args.begin === undefined; 27964 const begin = isProgressive ? this.progressiveDataLength : args.begin; 27965 const end = begin + chunk.byteLength; 27966 const beginChunk = Math.floor(begin / this.chunkSize); 27967 const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize); 27968 27969 if (isProgressive) { 27970 this.stream.onReceiveProgressiveData(chunk); 27971 this.progressiveDataLength = end; 27972 } else { 27973 this.stream.onReceiveData(begin, chunk); 27974 } 27975 27976 if (this.stream.allChunksLoaded()) { 27977 this._loadedStreamCapability.resolve(this.stream); 27978 } 27979 27980 const loadedRequests = []; 27981 27982 for (let chunk = beginChunk; chunk < endChunk; ++chunk) { 27983 const requestIds = this.requestsByChunk[chunk] || []; 27984 delete this.requestsByChunk[chunk]; 27985 27986 for (const requestId of requestIds) { 27987 const chunksNeeded = this.chunksNeededByRequest[requestId]; 27988 27989 if (chunk in chunksNeeded) { 27990 delete chunksNeeded[chunk]; 27991 } 27992 27993 if (!(0, _util.isEmptyObj)(chunksNeeded)) { 27994 continue; 27995 } 27996 27997 loadedRequests.push(requestId); 27998 } 27999 } 28000 28001 if (!this.disableAutoFetch && (0, _util.isEmptyObj)(this.requestsByChunk)) { 28002 let nextEmptyChunk; 28003 28004 if (this.stream.numChunksLoaded === 1) { 28005 const lastChunk = this.stream.numChunks - 1; 28006 28007 if (!this.stream.hasChunk(lastChunk)) { 28008 nextEmptyChunk = lastChunk; 28009 } 28010 } else { 28011 nextEmptyChunk = this.stream.nextEmptyChunk(endChunk); 28012 } 28013 28014 if (Number.isInteger(nextEmptyChunk)) { 28015 this._requestChunks([nextEmptyChunk]); 28016 } 28017 } 28018 28019 for (const requestId of loadedRequests) { 28020 const capability = this.promisesByRequest[requestId]; 28021 delete this.promisesByRequest[requestId]; 28022 capability.resolve(); 28023 } 28024 28025 this.msgHandler.send("DocProgress", { 28026 loaded: this.stream.numChunksLoaded * this.chunkSize, 28027 total: this.length 28028 }); 28029 } 28030 28031 onError(err) { 28032 this._loadedStreamCapability.reject(err); 28033 } 28034 28035 getBeginChunk(begin) { 28036 return Math.floor(begin / this.chunkSize); 28037 } 28038
28039 getEndChunk(end) { 28040 return Math.floor((end - 1) / this.chunkSize) + 1; 28041 } 28042 28043 abort(reason) { 28044 this.aborted = true; 28045 28046 if (this.pdfNetworkStream) { 28047 this.pdfNetworkStream.cancelAllRequests(reason); 28048 } 28049 28050 for (const requestId in this.promisesByRequest) { 28051 this.promisesByRequest[requestId].reject(reason); 28052 } 28053 } 28054 28055} 28056 28057exports.ChunkedStreamManager = ChunkedStreamManager; 28058 28059/***/ }), 28060/* 7 */ 28061/***/ (function(module, exports, __w_pdfjs_require__) { 28062 28063"use strict"; 28064 28065 28066Object.defineProperty(exports, "__esModule", { 28067 value: true 28068}); 28069exports.getLookupTableFactory = getLookupTableFactory; 28070exports.getInheritableProperty = getInheritableProperty; 28071exports.toRomanNumerals = toRomanNumerals; 28072exports.log2 = log2; 28073exports.readInt8 = readInt8; 28074exports.readUint16 = readUint16; 28075exports.readUint32 = readUint32; 28076exports.isWhiteSpace = isWhiteSpace; 28077exports.XRefParseException = exports.XRefEntryException = exports.MissingDataException = void 0; 28078 28079var _util = __w_pdfjs_require__(2); 28080 28081function getLookupTableFactory(initializer) { 28082 let lookup; 28083 return function () { 28084 if (initializer) { 28085 lookup = Object.create(null); 28086 initializer(lookup); 28087 initializer = null; 28088 } 28089 28090 return lookup; 28091 }; 28092} 28093 28094class MissingDataException extends _util.BaseException { 28095 constructor(begin, end) { 28096 super(`Missing data [${begin}, ${end})`); 28097 this.begin = begin; 28098 this.end = end; 28099 } 28100 28101} 28102 28103exports.MissingDataException = MissingDataException; 28104 28105class XRefEntryException extends _util.BaseException {} 28106 28107exports.XRefEntryException = XRefEntryException; 28108 28109class XRefParseException extends _util.BaseException {} 28110 28111exports.XRefParseException = XRefParseException; 28112 28113function getInheritableProperty({ 28114 dict, 28115 key, 28116 getArray = false, 28117 stopWhenFound = true 28118}) { 28119 const LOOP_LIMIT = 100; 28120 let loopCount = 0; 28121 let values; 28122 28123 while (dict) { 28124 const value = getArray ? dict.getArray(key) : dict.get(key); 28125 28126 if (value !== undefined) { 28127 if (stopWhenFound) { 28128 return value; 28129 } 28130 28131 if (!values) { 28132 values = []; 28133 } 28134 28135 values.push(value); 28136 } 28137 28138 if (++loopCount > LOOP_LIMIT) { 28139 (0, _util.warn)(`getInheritableProperty: maximum loop count exceeded for "${key}"`); 28140 break; 28141 } 28142 28143 dict = dict.get("Parent"); 28144 } 28145 28146 return values; 28147} 28148 28149const 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"]; 28150 28151function toRomanNumerals(number, lowerCase = false) { 28152 (0, _util.assert)(Number.isInteger(number) && number > 0, "The number should be a positive integer."); 28153 const romanBuf = []; 28154 let pos; 28155 28156 while (number >= 1000) { 28157 number -= 1000; 28158 romanBuf.push("M"); 28159 } 28160 28161 pos = number / 100 | 0; 28162 number %= 100; 28163 romanBuf.push(ROMAN_NUMBER_MAP[pos]); 28164 pos = number / 10 | 0; 28165 number %= 10; 28166 romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]); 28167 romanBuf.push(ROMAN_NUMBER_MAP[20 + number]); 28168 const romanStr = romanBuf.join(""); 28169 return lowerCase ? romanStr.toLowerCase() : romanStr; 28170} 28171 28172function log2(x) { 28173 if (x <= 0) { 28174 return 0; 28175 } 28176 28177 return Math.ceil(Math.log2(x)); 28178} 28179 28180function readInt8(data, offset) { 28181 return data[offset] << 24 >> 24; 28182} 28183 28184function readUint16(data, offset) { 28185 return data[offset] << 8 | data[offset + 1]; 28186} 28187 28188function readUint32(data, offset) { 28189 return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0; 28190} 28191 28192function isWhiteSpace(ch) { 28193 return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a; 28194} 28195 28196/***/ }), 28197/* 8 */ 28198/***/ (function(module, exports, __w_pdfjs_require__) { 28199 28200"use strict"; 28201 28202 28203Object.defineProperty(exports, "__esModule", { 28204 value: true 28205}); 28206exports.PDFDocument = exports.Page = void 0; 28207 28208var _util = __w_pdfjs_require__(2); 28209 28210var _obj = __w_pdfjs_require__(9); 28211 28212var _primitives = __w_pdfjs_require__(4); 28213 28214var _core_utils = __w_pdfjs_require__(7); 28215 28216var _stream = __w_pdfjs_require__(11); 28217 28218var _annotation = __w_pdfjs_require__(23); 28219 28220var _crypto = __w_pdfjs_require__(21); 28221 28222var _parser = __w_pdfjs_require__(10); 28223 28224var _operator_list = __w_pdfjs_require__(24); 28225 28226var _evaluator = __w_pdfjs_require__(25); 28227 28228var _function = __w_pdfjs_require__(39); 28229 28230const DEFAULT_USER_UNIT = 1.0; 28231const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792]; 28232 28233function isAnnotationRenderable(annotation, intent) { 28234 return intent === "display" && annotation.viewable || intent === "print" && annotation.printable; 28235} 28236 28237class Page { 28238 constructor({ 28239 pdfManager, 28240 xref, 28241 pageIndex, 28242 pageDict, 28243 ref, 28244 fontCache, 28245 builtInCMapCache, 28246 pdfFunctionFactory 28247 }) { 28248 this.pdfManager = pdfManager; 28249 this.pageIndex = pageIndex; 28250 this.pageDict = pageDict; 28251 this.xref = xref; 28252 this.ref = ref; 28253 this.fontCache = fontCache; 28254 this.builtInCMapCache = builtInCMapCache; 28255 this.pdfFunctionFactory = pdfFunctionFactory; 28256 this.evaluatorOptions = pdfManager.evaluatorOptions; 28257 this.resourcesPromise = null; 28258 const idCounters = { 28259 obj: 0 28260 }; 28261 this.idFactory = { 28262 createObjId() { 28263 return `p${pageIndex}_${++idCounters.obj}`; 28264 }, 28265 28266 getDocId() { 28267 return `g_${pdfManager.docId}`; 28268 } 28269 28270 }; 28271 } 28272 28273 _getInheritableProperty(key, getArray = false) { 28274 const value = (0, _core_utils.getInheritableProperty)({ 28275 dict: this.pageDict, 28276 key, 28277 getArray, 28278 stopWhenFound: false 28279 }); 28280 28281 if (!Array.isArray(value)) { 28282 return value; 28283 } 28284 28285 if (value.length === 1 || !(0, _primitives.isDict)(value[0])) { 28286 return value[0]; 28287 } 28288 28289 return _primitives.Dict.merge(this.xref, value); 28290 } 28291 28292 get content() { 28293 return this.pageDict.get("Contents"); 28294 } 28295 28296 get resources() { 28297 return (0, _util.shadow)(this, "resources", this._getInheritableProperty("Resources") || _primitives.Dict.empty); 28298 } 28299 28300 _getBoundingBox(name) { 28301 const box = this._getInheritableProperty(name, true); 28302 28303 if (Array.isArray(box) && box.length === 4) { 28304 if (box[2] - box[0] !== 0 && box[3] - box[1] !== 0) { 28305 return box; 28306 } 28307 28308 (0, _util.warn)(`Empty /${name} entry.`); 28309 } 28310 28311 return null; 28312 } 28313 28314 get mediaBox() { 28315 return (0, _util.shadow)(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX); 28316 } 28317 28318 get cropBox() { 28319 return (0, _util.shadow)(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox); 28320 } 28321 28322 get userUnit() { 28323 let obj = this.pageDict.get("UserUnit"); 28324 28325 if (!(0, _util.isNum)(obj) || obj <= 0) { 28326 obj = DEFAULT_USER_UNIT; 28327 } 28328 28329 return (0, _util.shadow)(this, "userUnit", obj); 28330 } 28331 28332 get view() { 28333 const { 28334 cropBox, 28335 mediaBox 28336 } = this; 28337 let view; 28338 28339 if (cropBox === mediaBox || (0, _util.isArrayEqual)(cropBox, mediaBox)) { 28340 view = mediaBox; 28341 } else { 28342 const box = _util.Util.intersect(cropBox, mediaBox); 28343 28344 if (box && box[2] - box[0] !== 0 && box[3] - box[1] !== 0) { 28345 view = box; 28346 } else { 28347 (0, _util.warn)("Empty /CropBox and /MediaBox intersection."); 28348 } 28349 } 28350 28351 return (0, _util.shadow)(this, "view", view || mediaBox); 28352 } 28353 28354 get rotate() { 28355 let rotate = this._getInheritableProperty("Rotate") || 0; 28356 28357 if (rotate % 90 !== 0) { 28358 rotate = 0; 28359 } else if (rotate >= 360) { 28360 rotate = rotate % 360; 28361 } else if (rotate < 0) { 28362 rotate = (rotate % 360 + 360) % 360; 28363 } 28364 28365 return (0, _util.shadow)(this, "rotate", rotate); 28366 } 28367 28368 getContentStream() { 28369 const content = this.content; 28370 let stream; 28371 28372 if (Array.isArray(content)) { 28373 const xref = this.xref; 28374 const streams = []; 28375 28376 for (const stream of content) { 28377 streams.push(xref.fetchIfRef(stream)); 28378 } 28379 28380 stream = new _stream.StreamsSequenceStream(streams); 28381 } else if ((0, _primitives.isStream)(content)) { 28382 stream = content; 28383 } else { 28384 stream = new _stream.NullStream(); 28385 } 28386 28387 return stream; 28388 } 28389 28390 loadResources(keys) { 28391 if (!this.resourcesPromise) { 28392 this.resourcesPromise = this.pdfManager.ensure(this, "resources"); 28393 } 28394 28395 return this.resourcesPromise.then(() => { 28396 const objectLoader = new _obj.ObjectLoader(this.resources, keys, this.xref); 28397 return objectLoader.load(); 28398 }); 28399 } 28400 28401 getOperatorList({ 28402 handler, 28403 sink, 28404 task, 28405 intent, 28406 renderInteractiveForms 28407 }) { 28408 const contentStreamPromise = this.pdfManager.ensure(this, "getContentStream"); 28409 const resourcesPromise = this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"]); 28410 const partialEvaluator = new _evaluator.PartialEvaluator({ 28411 xref: this.xref, 28412 handler, 28413 pageIndex: this.pageIndex, 28414 idFactory: this.idFactory, 28415 fontCache: this.fontCache, 28416 builtInCMapCache: this.builtInCMapCache, 28417 options: this.evaluatorOptions, 28418 pdfFunctionFactory: this.pdfFunctionFactory 28419 }); 28420 const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]); 28421 const pageListPromise = dataPromises.then(([contentStream]) => { 28422 const opList = new _operator_list.OperatorList(intent, sink, this.pageIndex); 28423 handler.send("StartRenderPage", { 28424 transparency: partialEvaluator.hasBlendModes(this.resources), 28425 pageIndex: this.pageIndex, 28426 intent 28427 }); 28428 return partialEvaluator.getOperatorList({ 28429 stream: contentStream, 28430 task, 28431 resources: this.resources, 28432 operatorList: opList 28433 }).then(function () { 28434 return opList; 28435 }); 28436 }); 28437 return Promise.all([pageListPromise, this._parsedAnnotations]).then(function ([pageOpList, annotations]) { 28438 if (annotations.length === 0) { 28439 pageOpList.flush(true); 28440 return { 28441 length: pageOpList.totalLength 28442 }; 28443 } 28444 28445 const opListPromises = []; 28446 28447 for (const annotation of annotations) { 28448 if (isAnnotationRenderable(annotation, intent)) { 28449 opListPromises.push(annotation.getOperatorList(partialEvaluator, task, renderInteractiveForms)); 28450 } 28451 } 28452 28453 return Promise.all(opListPromises).then(function (opLists) { 28454 pageOpList.addOp(_util.OPS.beginAnnotations, []); 28455 28456 for (const opList of opLists) { 28457 pageOpList.addOpList(opList); 28458 } 28459 28460 pageOpList.addOp(_util.OPS.endAnnotations, []); 28461 pageOpList.flush(true); 28462 return { 28463 length: pageOpList.totalLength 28464 }; 28465 }); 28466 }); 28467 } 28468 28469 extractTextContent({ 28470 handler, 28471 task, 28472 normalizeWhitespace, 28473 sink, 28474 combineTextItems 28475 }) { 28476 const contentStreamPromise = this.pdfManager.ensure(this, "getContentStream"); 28477 const resourcesPromise = this.loadResources(["ExtGState", "XObject", "Font"]); 28478 const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]); 28479 return dataPromises.then(([contentStream]) => { 28480 const partialEvaluator = new _evaluator.PartialEvaluator({ 28481 xref: this.xref, 28482 handler, 28483 pageIndex: this.pageIndex, 28484 idFactory: this.idFactory, 28485 fontCache: this.fontCache, 28486 builtInCMapCache: this.builtInCMapCache, 28487 options: this.evaluatorOptions, 28488 pdfFunctionFactory: this.pdfFunctionFactory 28489 }); 28490 return partialEvaluator.getTextContent({ 28491 stream: contentStream, 28492 task, 28493 resources: this.resources, 28494 normalizeWhitespace, 28495 combineTextItems, 28496 sink 28497 }); 28498 }); 28499 } 28500 28501 getAnnotationsData(intent) { 28502 return this._parsedAnnotations.then(function (annotations) { 28503 const annotationsData = []; 28504 28505 for (let i = 0, ii = annotations.length; i < ii; i++) { 28506 if (!intent || isAnnotationRenderable(annotations[i], intent)) { 28507 annotationsData.push(annotations[i].data); 28508 } 28509 } 28510 28511 return annotationsData; 28512 }); 28513 } 28514 28515 get annotations() { 28516 return (0, _util.shadow)(this, "annotations", this._getInheritableProperty("Annots") || []); 28517 } 28518 28519 get _parsedAnnotations() { 28520 const parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(() => { 28521 const annotationRefs = this.annotations; 28522 const annotationPromises = []; 28523 28524 for (let i = 0, ii = annotationRefs.length; i < ii; i++) { 28525 annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRefs[i], this.pdfManager, this.idFactory)); 28526 } 28527 28528 return Promise.all(annotationPromises).then(function (annotations) { 28529 return annotations.filter(function isDefined(annotation) { 28530 return !!annotation; 28531 }); 28532 }, function (reason) { 28533 (0, _util.warn)(`_parsedAnnotations: "${reason}".`); 28534 return []; 28535 }); 28536 }); 28537 return (0, _util.shadow)(this, "_parsedAnnotations", parsedAnnotations); 28538 } 28539 28540} 28541 28542exports.Page = Page; 28543const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]); 28544const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]); 28545const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]); 28546const FINGERPRINT_FIRST_BYTES = 1024; 28547const EMPTY_FINGERPRINT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; 28548const PDF_HEADER_VERSION_REGEXP = /^[1-9]\.[0-9]$/; 28549 28550function find(stream, signature, limit = 1024, backwards = false) { 28551 const signatureLength = signature.length; 28552 const scanBytes = stream.peekBytes(limit); 28553 const scanLength = scanBytes.length - signatureLength; 28554 28555 if (scanLength <= 0) { 28556 return false;
28557 } 28558 28559 if (backwards) { 28560 const signatureEnd = signatureLength - 1; 28561 let pos = scanBytes.length - 1; 28562 28563 while (pos >= signatureEnd) { 28564 let j = 0; 28565 28566 while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) { 28567 j++; 28568 } 28569 28570 if (j >= signatureLength) { 28571 stream.pos += pos - signatureEnd; 28572 return true; 28573 } 28574 28575 pos--; 28576 } 28577 } else { 28578 let pos = 0; 28579 28580 while (pos <= scanLength) { 28581 let j = 0; 28582 28583 while (j < signatureLength && scanBytes[pos + j] === signature[j]) { 28584 j++; 28585 } 28586 28587 if (j >= signatureLength) { 28588 stream.pos += pos; 28589 return true; 28590 } 28591 28592 pos++; 28593 } 28594 } 28595 28596 return false; 28597} 28598 28599class PDFDocument { 28600 constructor(pdfManager, arg) { 28601 let stream; 28602 28603 if ((0, _primitives.isStream)(arg)) { 28604 stream = arg; 28605 } else if ((0, _util.isArrayBuffer)(arg)) { 28606 stream = new _stream.Stream(arg); 28607 } else { 28608 throw new Error("PDFDocument: Unknown argument type"); 28609 } 28610 28611 if (stream.length <= 0) { 28612 throw new _util.InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes."); 28613 } 28614 28615 this.pdfManager = pdfManager; 28616 this.stream = stream; 28617 this.xref = new _obj.XRef(stream, pdfManager); 28618 this.pdfFunctionFactory = new _function.PDFFunctionFactory({ 28619 xref: this.xref, 28620 isEvalSupported: pdfManager.evaluatorOptions.isEvalSupported 28621 }); 28622 this._pagePromises = []; 28623 } 28624 28625 parse(recoveryMode) { 28626 this.setup(recoveryMode); 28627 const version = this.catalog.catDict.get("Version"); 28628 28629 if ((0, _primitives.isName)(version)) { 28630 this.pdfFormatVersion = version.name; 28631 } 28632 28633 try { 28634 this.acroForm = this.catalog.catDict.get("AcroForm"); 28635 28636 if (this.acroForm) { 28637 this.xfa = this.acroForm.get("XFA"); 28638 const fields = this.acroForm.get("Fields"); 28639 28640 if ((!Array.isArray(fields) || fields.length === 0) && !this.xfa) { 28641 this.acroForm = null; 28642 } 28643 } 28644 } catch (ex) { 28645 if (ex instanceof _core_utils.MissingDataException) { 28646 throw ex; 28647 } 28648 28649 (0, _util.info)("Cannot fetch AcroForm entry; assuming no AcroForms are present"); 28650 this.acroForm = null; 28651 } 28652 28653 try { 28654 const collection = this.catalog.catDict.get("Collection"); 28655 28656 if ((0, _primitives.isDict)(collection) && collection.getKeys().length > 0) { 28657 this.collection = collection; 28658 } 28659 } catch (ex) { 28660 if (ex instanceof _core_utils.MissingDataException) { 28661 throw ex; 28662 } 28663 28664 (0, _util.info)("Cannot fetch Collection dictionary."); 28665 } 28666 } 28667 28668 get linearization() { 28669 let linearization = null; 28670 28671 try { 28672 linearization = _parser.Linearization.create(this.stream); 28673 } catch (err) { 28674 if (err instanceof _core_utils.MissingDataException) { 28675 throw err; 28676 } 28677 28678 (0, _util.info)(err); 28679 } 28680 28681 return (0, _util.shadow)(this, "linearization", linearization); 28682 } 28683 28684 get startXRef() { 28685 const stream = this.stream; 28686 let startXRef = 0; 28687 28688 if (this.linearization) { 28689 stream.reset(); 28690 28691 if (find(stream, ENDOBJ_SIGNATURE)) { 28692 startXRef = stream.pos + 6 - stream.start; 28693 } 28694 } else { 28695 const step = 1024; 28696 const startXRefLength = STARTXREF_SIGNATURE.length; 28697 let found = false, 28698 pos = stream.end; 28699 28700 while (!found && pos > 0) { 28701 pos -= step - startXRefLength; 28702 28703 if (pos < 0) { 28704 pos = 0; 28705 } 28706 28707 stream.pos = pos; 28708 found = find(stream, STARTXREF_SIGNATURE, step, true); 28709 } 28710 28711 if (found) { 28712 stream.skip(9); 28713 let ch; 28714 28715 do { 28716 ch = stream.getByte(); 28717 } while ((0, _core_utils.isWhiteSpace)(ch)); 28718 28719 let str = ""; 28720 28721 while (ch >= 0x20 && ch <= 0x39) { 28722 str += String.fromCharCode(ch); 28723 ch = stream.getByte(); 28724 } 28725 28726 startXRef = parseInt(str, 10); 28727 28728 if (isNaN(startXRef)) { 28729 startXRef = 0; 28730 } 28731 } 28732 } 28733 28734 return (0, _util.shadow)(this, "startXRef", startXRef); 28735 } 28736 28737 checkHeader() { 28738 const stream = this.stream; 28739 stream.reset(); 28740 28741 if (!find(stream, PDF_HEADER_SIGNATURE)) { 28742 return; 28743 } 28744 28745 stream.moveStart(); 28746 const MAX_PDF_VERSION_LENGTH = 12; 28747 let version = "", 28748 ch; 28749 28750 while ((ch = stream.getByte()) > 0x20) { 28751 if (version.length >= MAX_PDF_VERSION_LENGTH) { 28752 break; 28753 } 28754 28755 version += String.fromCharCode(ch); 28756 } 28757 28758 if (!this.pdfFormatVersion) { 28759 this.pdfFormatVersion = version.substring(5); 28760 } 28761 } 28762 28763 parseStartXRef() { 28764 this.xref.setStartXRef(this.startXRef); 28765 } 28766 28767 setup(recoveryMode) { 28768 this.xref.parse(recoveryMode); 28769 this.catalog = new _obj.Catalog(this.pdfManager, this.xref); 28770 } 28771 28772 get numPages() { 28773 const linearization = this.linearization; 28774 const num = linearization ? linearization.numPages : this.catalog.numPages; 28775 return (0, _util.shadow)(this, "numPages", num); 28776 } 28777 28778 get documentInfo() { 28779 const DocumentInfoValidators = { 28780 Title: _util.isString, 28781 Author: _util.isString, 28782 Subject: _util.isString, 28783 Keywords: _util.isString, 28784 Creator: _util.isString, 28785 Producer: _util.isString, 28786 CreationDate: _util.isString, 28787 ModDate: _util.isString, 28788 Trapped: _primitives.isName 28789 }; 28790 let version = this.pdfFormatVersion; 28791 28792 if (typeof version !== "string" || !PDF_HEADER_VERSION_REGEXP.test(version)) { 28793 (0, _util.warn)(`Invalid PDF header version number: ${version}`); 28794 version = null; 28795 } 28796 28797 const docInfo = { 28798 PDFFormatVersion: version, 28799 IsLinearized: !!this.linearization, 28800 IsAcroFormPresent: !!this.acroForm, 28801 IsXFAPresent: !!this.xfa, 28802 IsCollectionPresent: !!this.collection 28803 }; 28804 let infoDict; 28805 28806 try { 28807 infoDict = this.xref.trailer.get("Info"); 28808 } catch (err) { 28809 if (err instanceof _core_utils.MissingDataException) { 28810 throw err; 28811 } 28812 28813 (0, _util.info)("The document information dictionary is invali
28813d."); 28814 } 28815 28816 if ((0, _primitives.isDict)(infoDict)) { 28817 for (const key of infoDict.getKeys()) { 28818 const value = infoDict.get(key); 28819 28820 if (DocumentInfoValidators[key]) { 28821 if (DocumentInfoValidators[key](value)) { 28822 docInfo[key] = typeof value !== "string" ? value : (0, _util.stringToPDFString)(value); 28823 } else { 28824 (0, _util.info)(`Bad value in document info for "${key}".`); 28825 } 28826 } else if (typeof key === "string") { 28827 let customValue; 28828 28829 if ((0, _util.isString)(value)) { 28830 customValue = (0, _util.stringToPDFString)(value); 28831 } else if ((0, _primitives.isName)(value) || (0, _util.isNum)(value) || (0, _util.isBool)(value)) { 28832 customValue = value; 28833 } else { 28834 (0, _util.info)(`Unsupported value in document info for (custom) "${key}".`); 28835 continue; 28836 } 28837 28838 if (!docInfo["Custom"]) { 28839 docInfo["Custom"] = Object.create(null); 28840 } 28841 28842 docInfo["Custom"][key] = customValue; 28843 } 28844 } 28845 } 28846 28847 return (0, _util.shadow)(this, "documentInfo", docInfo); 28848 } 28849 28850 get fingerprint() { 28851 let hash; 28852 const idArray = this.xref.trailer.get("ID"); 28853 28854 if (Array.isArray(idArray) && idArray[0] && (0, _util.isString)(idArray[0]) && idArray[0] !== EMPTY_FINGERPRINT) { 28855 hash = (0, _util.stringToBytes)(idArray[0]); 28856 } else { 28857 hash = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES); 28858 } 28859 28860 const fingerprintBuf = []; 28861 28862 for (let i = 0, ii = hash.length; i < ii; i++) { 28863 const hex = hash[i].toString(16); 28864 fingerprintBuf.push(hex.padStart(2, "0")); 28865 } 28866 28867 return (0, _util.shadow)(this, "fingerprint", fingerprintBuf.join("")); 28868 } 28869 28870 _getLinearizationPage(pageIndex) { 28871 const { 28872 catalog, 28873 linearization 28874 } = this; 28875 (0, _util.assert)(linearization && linearization.pageFirst === pageIndex); 28876 28877 const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0); 28878 28879 return this.xref.fetchAsync(ref).then(obj => { 28880 if ((0, _primitives.isDict)(obj, "Page") || (0, _primitives.isDict)(obj) && !obj.has("Type") && obj.has("Contents")) { 28881 if (ref && !catalog.pageKidsCountCache.has(ref)) { 28882 catalog.pageKidsCountCache.put(ref, 1); 28883 } 28884 28885 return [obj, ref]; 28886 } 28887 28888 throw new _util.FormatError("The Linearization dictionary doesn't point " + "to a valid Page dictionary."); 28889 }).catch(reason => { 28890 (0, _util.info)(reason); 28891 return catalog.getPageDict(pageIndex); 28892 }); 28893 } 28894 28895 getPage(pageIndex) { 28896 if (this._pagePromises[pageIndex] !== undefined) { 28897 return this._pagePromises[pageIndex]; 28898 } 28899 28900 const { 28901 catalog, 28902 linearization 28903 } = this; 28904 const promise = linearization && linearization.pageFirst === pageIndex ? this._getLinearizationPage(pageIndex) : catalog.getPageDict(pageIndex); 28905 return this._pagePromises[pageIndex] = promise.then(([pageDict, ref]) => { 28906 return new Page({ 28907 pdfManager: this.pdfManager, 28908 xref: this.xref, 28909 pageIndex, 28910 pageDict, 28911 ref, 28912 fontCache: catalog.fontCache, 28913 builtInCMapCache: catalog.builtInCMapCache, 28914 pdfFunctionFactory: this.pdfFunctionFactory 28915 }); 28916 }); 28917 } 28918 28919 checkFirstPage() { 28920 return this.getPage(0).catch(async reason => { 28921 if (reason instanceof _core_utils.XRefEntryException) { 28922 this._pagePromises.length = 0; 28923 await this.cleanup(); 28924 throw new _core_utils.XRefParseException(); 28925 } 28926 }); 28927 } 28928 28929 fontFallback(id, handler) { 28930 return this.catalog.fontFallback(id, handler); 28931 } 28932 28933 async cleanup() { 28934 return this.catalog ? this.catalog.cleanup() : (0, _primitives.clearPrimitiveCaches)(); 28935 } 28936 28937} 28938 28939exports.PDFDocument = PDFDocument; 28940 28941/***/ }), 28942/* 9 */ 28943/***/ (function(module, exports, __w_pdfjs_require__) { 28944 28945"use strict"; 28946 28947 28948Object.defineProperty(exports, "__esModule", { 28949 value: true 28950}); 28951exports.FileSpec = exports.XRef = exports.ObjectLoader = exports.Catalog = void 0; 28952 28953var _util = __w_pdfjs_require__(2); 28954 28955var _primitives = __w_pdfjs_require__(4); 28956 28957var _parser = __w_pdfjs_require__(10); 28958 28959var _core_utils = __w_pdfjs_require__(7); 28960 28961var _crypto = __w_pdfjs_require__(21); 28962 28963var _colorspace = __w_pdfjs_require__(22); 28964 28965function fetchDestination(dest) { 28966 return (0, _primitives.isDict)(dest) ? dest.get("D") : dest; 28967} 28968 28969class Catalog { 28970 constructor(pdfManager, xref) { 28971 this.pdfManager = pdfManager; 28972 this.xref = xref; 28973 this.catDict = xref.getCatalogObj(); 28974 28975 if (!(0, _primitives.isDict)(this.catDict)) { 28976 throw new _util.FormatError("Catalog object is not a dictionary."); 28977 } 28978 28979 this.fontCache = new _primitives.RefSetCache(); 28980 this.builtInCMapCache = new Map(); 28981 this.pageKidsCountCache = new _primitives.RefSetCache(); 28982 } 28983 28984 get metadata() { 28985 const streamRef = this.catDict.getRaw("Metadata"); 28986 28987 if (!(0, _primitives.isRef)(streamRef)) { 28988 return (0, _util.shadow)(this, "metadata", null); 28989 } 28990 28991 const suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata); 28992 const stream = this.xref.fetch(streamRef, suppressEncryption); 28993 let metadata; 28994 28995 if (stream && (0, _primitives.isDict)(stream.dict)) { 28996 const type = stream.dict.get("Type"); 28997 const subtype = stream.dict.get("Subtype"); 28998 28999 if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) { 29000 try { 29001 metadata = (0, _util.stringToUTF8String)((0, _util.bytesToString)(stream.getBytes())); 29002 } catch (e) { 29003 if (e instanceof _core_utils.MissingDataException) { 29004 throw e; 29005 } 29006 29007 (0, _util.info)("Skipping invalid metadata."); 29008 } 29009 } 29010 } 29011 29012 return (0, _util.shadow)(this, "metadata", metadata); 29013 } 29014 29015 get toplevelPagesDict() { 29016 const pagesObj = this.catDict.get("Pages"); 29017 29018 if (!(0, _primitives.isDict)(pagesObj)) { 29019 throw new _util.FormatError("Invalid top-level pages dictionary."); 29020 } 29021 29022 return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj); 29023 } 29024 29025 get documentOutline() { 29026 let obj = null; 29027 29028 try { 29029 obj = this._readDocumentOutline(); 29030 } catch (ex) { 29031 if (ex instanceof _core_utils.MissingDataException) { 29032 throw ex; 29033 } 29034 29035 (0, _util.warn)("Unable to read document outline."); 29036 } 29037 29038 return (0, _util.shadow)(this, "documentOutline", obj); 29039 } 29040 29041 _readDocumentOutline() { 29042 let obj = this.catDict.get("Outlines"); 29043 29044 if (!(0, _primitives.isDict)(obj)) { 29045 return null; 29046 } 29047 29048 obj = obj.getRaw("First"); 29049 29050 if (!(0, _primitives.isRef)(obj)) { 29051 return null; 29052 } 29053 29054 const root = { 29055 items: [] 29056 }; 29057 const queue = [{ 29058 obj, 29059 parent: root 29060 }]; 29061 const processed = new _primitives.RefSet(); 29062 processed.put(obj); 29063 const xref = this.xref, 29064 blackColor = new Uint8ClampedArray(3); 29065 29066 while (queue.length > 0) { 29067 const i = queue.shift(); 29068 const outlineDict = xref.fetchIfRef(i.obj); 29069 29070 if (outlineDict === null) { 29071 continue; 29072 } 29073 29074 if (!outlineDict.has("Title")) { 29075 throw new _util.FormatError("Invalid outline item encountered."); 29076 } 29077 29078 const data = { 29079 url: null, 29080 dest: null 29081 }; 29082 Catalog.parseDestDictionary({ 29083 destDict: outlineDict, 29084 resultObj: data, 29085 docBaseUrl: this.pdfManager.docBaseUrl 29086 }); 29087 const title = outlineDict.get("Title"); 29088 const flags = outlineDict.get("F") || 0; 29089 const color = outlineDict.getArray("C"); 29090 const count = outlineDict.get("Count"); 29091 let rgbColor = blackColor; 29092 29093 if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) { 29094 rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0); 29095 } 29096 29097 const outlineItem = { 29098 dest: data.dest, 29099 url: data.url, 29100 unsafeUrl: data.unsafeUrl, 29101 newWindow: data.newWindow, 29102 title: (0, _util.stringToPDFString)(title), 29103 color: rgbColor, 29104 count: Number.isInteger(count) ? count : undefined, 29105 bold: !!(flags & 2), 29106 italic: !!(flags & 1), 29107 items: [] 29108 }; 29109 i.parent.items.push(outlineItem); 29110 obj = outlineDict.getRaw("First"); 29111 29112 if ((0, _primitives.isRef)(obj) && !processed.has(obj)) { 29113 queue.push({ 29114 obj, 29115 parent: outlineItem 29116 }); 29117 processed.put(obj); 29118 } 29119 29120 obj = outlineDict.getRaw("Next"); 29121 29122 if ((0, _primitives.isRef)(obj) && !processed.has(obj)) { 29123 queue.push({ 29124 obj, 29125 parent: i.parent 29126 }); 29127 processed.put(obj); 29128 } 29129 } 29130 29131 return root.items.length > 0 ? root.items : null; 29132 } 29133 29134 get permissions() { 29135 let permissions = null; 29136 29137 try { 29138 permissions = this._readPermissions(); 29139 } catch (ex) { 29140 if (ex instanceof _core_utils.MissingDataException) { 29141 throw ex; 29142 } 29143 29144 (0, _util.warn)("Unable to read permissions."); 29145 } 29146 29147 return (0, _util.shadow)(this, "permissions", permissions); 29148 } 29149 29150 _readPermissions() { 29151 const encrypt = this.xref.trailer.get("Encrypt"); 29152 29153 if (!(0, _primitives.isDict)(encrypt)) { 29154 return null; 29155 } 29156 29157 let flags = encrypt.get("P"); 29158 29159 if (!(0, _util.isNum)(flags)) { 29160 return null; 29161 } 29162 29163 flags += 2 ** 32; 29164 const permissions = []; 29165 29166 for (const key in _util.PermissionFlag) { 29167 const value = _util.PermissionFlag[key]; 29168 29169 if (flags & value) { 29170 permissions.push(value); 29171 } 29172 } 29173 29174 return permissions; 29175 } 29176 29177 get numPages() { 29178 const obj = this.toplevelPagesDict.get("Count"); 29179 29180 if (!Number.isInteger(obj)) { 29181 throw new _util.FormatError("Page count in top-level pages dictionary is not an integer."); 29182 } 29183 29184 return (0, _util.shadow)(this, "numPages", obj); 29185 } 29186 29187 get destinations() { 29188 const obj = this._readDests(), 29189 dests = Object.create(null); 29190 29191 if (obj instanceof NameTree) { 29192 const names = obj.getAll(); 29193 29194 for (const name in names) { 29195 dests[name] = fetchDestination(names[name]); 29196 } 29197 } else if (obj instanceof _primitives.Dict) {
29198 obj.forEach(function (key, value) { 29199 if (value) { 29200 dests[key] = fetchDestination(value); 29201 } 29202 }); 29203 } 29204 29205 return (0, _util.shadow)(this, "destinations", dests); 29206 } 29207 29208 getDestination(destinationId) { 29209 const obj = this._readDests(); 29210 29211 if (obj instanceof NameTree || obj instanceof _primitives.Dict) { 29212 return fetchDestination(obj.get(destinationId) || null); 29213 } 29214 29215 return null; 29216 } 29217 29218 _readDests() { 29219 const obj = this.catDict.get("Names"); 29220 29221 if (obj && obj.has("Dests")) { 29222 return new NameTree(obj.getRaw("Dests"), this.xref); 29223 } else if (this.catDict.has("Dests")) { 29224 return this.catDict.get("Dests"); 29225 } 29226 29227 return undefined; 29228 } 29229 29230 get pageLabels() { 29231 let obj = null; 29232 29233 try { 29234 obj = this._readPageLabels(); 29235 } catch (ex) { 29236 if (ex instanceof _core_utils.MissingDataException) { 29237 throw ex; 29238 } 29239 29240 (0, _util.warn)("Unable to read page labels."); 29241 } 29242 29243 return (0, _util.shadow)(this, "pageLabels", obj); 29244 } 29245 29246 _readPageLabels() { 29247 const obj = this.catDict.getRaw("PageLabels"); 29248 29249 if (!obj) { 29250 return null; 29251 } 29252 29253 const pageLabels = new Array(this.numPages); 29254 let style = null, 29255 prefix = ""; 29256 const numberTree = new NumberTree(obj, this.xref); 29257 const nums = numberTree.getAll(); 29258 let currentLabel = "", 29259 currentIndex = 1; 29260 29261 for (let i = 0, ii = this.numPages; i < ii; i++) { 29262 if (i in nums) { 29263 const labelDict = nums[i]; 29264 29265 if (!(0, _primitives.isDict)(labelDict)) { 29266 throw new _util.FormatError("PageLabel is not a dictionary."); 29267 } 29268 29269 if (labelDict.has("Type") && !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")) { 29270 throw new _util.FormatError("Invalid type in PageLabel dictionary."); 29271 } 29272 29273 if (labelDict.has("S")) { 29274 const s = labelDict.get("S"); 29275 29276 if (!(0, _primitives.isName)(s)) { 29277 throw new _util.FormatError("Invalid style in PageLabel dictionary."); 29278 } 29279 29280 style = s.name; 29281 } else { 29282 style = null; 29283 } 29284 29285 if (labelDict.has("P")) { 29286 const p = labelDict.get("P"); 29287 29288 if (!(0, _util.isString)(p)) { 29289 throw new _util.FormatError("Invalid prefix in PageLabel dictionary."); 29290 } 29291 29292 prefix = (0, _util.stringToPDFString)(p); 29293 } else { 29294 prefix = ""; 29295 } 29296 29297 if (labelDict.has("St")) { 29298 const st = labelDict.get("St"); 29299 29300 if (!(Number.isInteger(st) && st >= 1)) { 29301 throw new _util.FormatError("Invalid start in PageLabel dictionary."); 29302 } 29303 29304 currentIndex = st; 29305 } else { 29306 currentIndex = 1; 29307 } 29308 } 29309 29310 switch (style) { 29311 case "D": 29312 currentLabel = currentIndex; 29313 break; 29314 29315 case "R": 29316 case "r": 29317 currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === "r"); 29318 break; 29319 29320 case "A": 29321 case "a": 29322 const LIMIT = 26; 29323 const A_UPPER_CASE = 0x41, 29324 A_LOWER_CASE = 0x61; 29325 const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE; 29326 const letterIndex = currentIndex - 1; 29327 const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT); 29328 const charBuf = []; 29329 29330 for (let j = 0, jj = letterIndex / LIMIT | 0; j <= jj; j++) { 29331 charBuf.push(character); 29332 } 29333 29334 currentLabel = charBuf.join(""); 29335 break; 29336 29337 default: 29338 if (style) { 29339 throw new _util.FormatError(`Invalid style "${style}" in PageLabel dictionary.`); 29340 } 29341 29342 currentLabel = ""; 29343 } 29344 29345 pageLabels[i] = prefix + currentLabel; 29346 currentIndex++; 29347 } 29348 29349 return pageLabels; 29350 } 29351 29352 get pageLayout() { 29353 const obj = this.catDict.get("PageLayout"); 29354 let pageLayout = ""; 29355 29356 if ((0, _primitives.isName)(obj)) { 29357 switch (obj.name) { 29358 case "SinglePage": 29359 case "OneColumn": 29360 case "TwoColumnLeft": 29361 case "TwoColumnRight": 29362 case "TwoPageLeft": 29363 case "TwoPageRight": 29364 pageLayout = obj.name; 29365 } 29366 } 29367 29368 return (0, _util.shadow)(this, "pageLayout", pageLayout); 29369 } 29370 29371 get pageMode() { 29372 const obj = this.catDict.get("PageMode"); 29373 let pageMode = "UseNone"; 29374 29375 if ((0, _primitives.isName)(obj)) { 29376 switch (obj.name) { 29377 case "UseNone": 29378 case "UseOutlines": 29379 case "UseThumbs": 29380 case "FullScreen": 29381 case "UseOC": 29382 case "UseAttachments": 29383 pageMode = obj.name; 29384 } 29385 } 29386 29387 return (0, _util.shadow)(this, "pageMode", pageMode); 29388 } 29389 29390 get viewerPreferences() { 29391 const ViewerPreferencesValidators = { 29392 HideToolbar: _util.isBool, 29393 HideMenubar: _util.isBool, 29394 HideWindowUI: _util.isBool, 29395 FitWindow: _util.isBool, 29396 CenterWindow: _util.isBool, 29397 DisplayDocTitle: _util.isBool, 29398 NonFullScreenPageMode: _primitives.isName, 29399 Direction: _primitives.isName, 29400 ViewArea: _primitives.isName, 29401 ViewClip: _primitives.isName, 29402 PrintArea: _primitives.isName, 29403 PrintClip: _primitives.isName, 29404 PrintScaling: _primitives.isName, 29405 Duplex: _primitives.isName, 29406 PickTrayByPDFSize: _util.isBool, 29407 PrintPageRange: Array.isArray, 29408 NumCopies: Number.isInteger 29409 }; 29410 const obj = this.catDict.get("ViewerPreferences"); 29411 const prefs = Object.create(null); 29412 29413 if ((0, _primitives.isDict)(obj)) { 29414 for (const key in ViewerPreferencesValidators) { 29415 if (!obj.has(key)) { 29416 continue; 29417 } 29418 29419 const value = obj.get(key); 29420 29421 if (!ViewerPreferencesValidators[key](value)) { 29422 (0, _util.info)(`Bad value in ViewerPreferences for "${key}".`); 29423 continue; 29424 } 29425 29426 let prefValue; 29427 29428 switch (key) { 29429 case "NonFullScreenPageMode": 29430 switch (value.name) { 29431 case "UseNone": 29432 case "UseOutlines": 29433 case "UseThumbs": 29434 case "UseOC": 29435 prefValue = value.name; 29436 break; 29437 29438 default: 29439 prefValue = "UseNone"; 29440 } 29441 29442 break; 29443 29444 case "Direction": 29445 switch (value.name) { 29446 case "L2R": 29447 case "R2L": 29448 prefValue = value.name; 29449 break; 29450 29451 default: 29452 prefValue = "L2R"; 29453 } 29454 29455 break; 29456 29457 case "ViewArea": 29458 case "ViewClip": 29459 case "PrintArea": 29460 case "PrintClip": 29461 switch (value.name) { 29462 case "MediaBox": 29463 case "CropBox": 29464 case "BleedBox": 29465 case "TrimBox": 29466 case "ArtBox": 29467 prefValue = value.name; 29468 break; 29469 29470 default: 29471 prefValue = "CropBox"; 29472 } 29473 29474 break; 29475 29476 case "PrintScaling": 29477 switch (value.name) { 29478 case "None": 29479 case "AppDefault": 29480 prefValue = value.name; 29481 break; 29482 29483 default: 29484 prefValue = "AppDefault"; 29485 } 29486 29487 break; 29488 29489 case "Duplex": 29490 switch (value.name) { 29491 case "Simplex": 29492 case "DuplexFlipShortEdge": 29493 case "DuplexFlipLongEdge": 29494 prefValue = value.name; 29495 break; 29496 29497 default: 29498 prefValue = "None"; 29499 } 29500 29501 break; 29502 29503 case "PrintPageRange": 29504 const length = value.length; 29505 29506 if (length % 2 !== 0) { 29507 break; 29508 } 29509 29510 const isValid = value.every((page, i, arr) => { 29511 return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages; 29512 }); 29513 29514 if (isValid) { 29515 prefValue = value; 29516 } 29517 29518 break; 29519 29520 case "NumCopies": 29521 if (value > 0) { 29522 prefValue = value; 29523 } 29524 29525 break; 29526 29527 default: 29528 (0, _util.assert)(typeof value === "boolean"); 29529 prefValue = value; 29530 } 29531 29532 if (prefValue !== undefined) { 29533 prefs[key] = prefValue; 29534 } else { 29535 (0, _util.info)(`Bad value in ViewerPreferences for "${key}".`); 29536 } 29537 } 29538 } 29539 29540 return (0, _util.shadow)(this, "viewerPreferences", prefs); 29541 } 29542 29543 get openAction() { 29544 const obj = this.catDict.get("OpenAction"); 29545 let openAction = null; 29546 29547 if ((0, _primitives.isDict)(obj)) { 29548 const destDict = new _primitives.Dict(this.xref); 29549 destDict.set("A", obj); 29550 const resultObj = { 29551 url: null, 29552 dest: null, 29553 action: null 29554 }; 29555 Catalog.parseDestDictionary({ 29556 destDict, 29557 resultObj 29558 }); 29559 29560 if (Array.isArray(resultObj.dest)) { 29561 if (!openAction) { 29562 openAction = Object.create(null); 29563 } 29564 29565 openAction.dest = resultObj.dest; 29566 } else if (resultObj.action) { 29567 if (!openAction) { 29568 openAction = Object.create(null); 29569 } 29570 29571 openAction.action = resultObj.action; 29572 } 29573 } else if (Array.isArray(obj)) { 29574 if (!openAction) { 29575 openAction = Object.create(null); 29576 } 29577 29578 openAction.dest = obj; 29579 } 29580 29581 return (0, _util.shadow)(this, "openAction", openAction); 29582 } 29583 29584 get attachments() { 29585 const obj = this.catDict.get("Names"); 29586 let attachments = null; 29587 29588 if (obj && obj.has("EmbeddedFiles")) {
29589 const nameTree = new NameTree(obj.getRaw("EmbeddedFiles"), this.xref); 29590 const names = nameTree.getAll(); 29591 29592 for (const name in names) { 29593 const fs = new FileSpec(names[name], this.xref); 29594 29595 if (!attachments) { 29596 attachments = Object.create(null); 29597 } 29598 29599 attachments[(0, _util.stringToPDFString)(name)] = fs.serializable; 29600 } 29601 } 29602 29603 return (0, _util.shadow)(this, "attachments", attachments); 29604 } 29605 29606 get javaScript() { 29607 const obj = this.catDict.get("Names"); 29608 let javaScript = null; 29609 29610 function appendIfJavaScriptDict(jsDict) { 29611 const type = jsDict.get("S"); 29612 29613 if (!(0, _primitives.isName)(type, "JavaScript")) { 29614 return; 29615 } 29616 29617 let js = jsDict.get("JS"); 29618 29619 if ((0, _primitives.isStream)(js)) { 29620 js = (0, _util.bytesToString)(js.getBytes()); 29621 } else if (!(0, _util.isString)(js)) { 29622 return; 29623 } 29624 29625 if (!javaScript) { 29626 javaScript = []; 29627 } 29628 29629 javaScript.push((0, _util.stringToPDFString)(js)); 29630 } 29631 29632 if (obj && obj.has("JavaScript")) { 29633 const nameTree = new NameTree(obj.getRaw("JavaScript"), this.xref); 29634 const names = nameTree.getAll(); 29635 29636 for (const name in names) { 29637 const jsDict = names[name]; 29638 29639 if ((0, _primitives.isDict)(jsDict)) { 29640 appendIfJavaScriptDict(jsDict); 29641 } 29642 } 29643 } 29644 29645 const openAction = this.catDict.get("OpenAction"); 29646 29647 if ((0, _primitives.isDict)(openAction) && (0, _primitives.isName)(openAction.get("S"), "JavaScript")) { 29648 appendIfJavaScriptDict(openAction); 29649 } 29650 29651 return (0, _util.shadow)(this, "javaScript", javaScript); 29652 } 29653 29654 fontFallback(id, handler) { 29655 const promises = []; 29656 this.fontCache.forEach(function (promise) { 29657 promises.push(promise); 29658 }); 29659 return Promise.all(promises).then(translatedFonts => { 29660 for (const translatedFont of translatedFonts) { 29661 if (translatedFont.loadedName === id) { 29662 translatedFont.fallback(handler); 29663 return; 29664 } 29665 } 29666 }); 29667 } 29668 29669 cleanup() { 29670 (0, _primitives.clearPrimitiveCaches)(); 29671 this.pageKidsCountCache.clear(); 29672 const promises = []; 29673 this.fontCache.forEach(function (promise) { 29674 promises.push(promise); 29675 }); 29676 return Promise.all(promises).then(translatedFonts => { 29677 for (const { 29678 dict 29679 } of translatedFonts) { 29680 delete dict.translated; 29681 } 29682 29683 this.fontCache.clear(); 29684 this.builtInCMapCache.clear(); 29685 }); 29686 } 29687 29688 getPageDict(pageIndex) { 29689 const capability = (0, _util.createPromiseCapability)(); 29690 const nodesToVisit = [this.catDict.getRaw("Pages")]; 29691 const visitedNodes = new _primitives.RefSet(); 29692 const xref = this.xref, 29693 pageKidsCountCache = this.pageKidsCountCache; 29694 let count, 29695 currentPageIndex = 0; 29696 29697 function next() { 29698 while (nodesToVisit.length) { 29699 const currentNode = nodesToVisit.pop(); 29700 29701 if ((0, _primitives.isRef)(currentNode)) { 29702 count = pageKidsCountCache.get(currentNode); 29703 29704 if (count > 0 && currentPageIndex + count < pageIndex) { 29705 currentPageIndex += count; 29706 continue; 29707 } 29708 29709 if (visitedNodes.has(currentNode)) { 29710 capability.reject(new _util.FormatError("Pages tree contains circular reference.")); 29711 return; 29712 } 29713 29714 visitedNodes.put(currentNode); 29715 xref.fetchAsync(currentNode).then(function (obj) { 29716 if ((0, _primitives.isDict)(obj, "Page") || (0, _primitives.isDict)(obj) && !obj.has("Kids")) { 29717 if (pageIndex === currentPageIndex) { 29718 if (currentNode && !pageKidsCountCache.has(currentNode)) { 29719 pageKidsCountCache.put(currentNode, 1); 29720 } 29721 29722 capability.resolve([obj, currentNode]); 29723 } else { 29724 currentPageIndex++; 29725 next(); 29726 } 29727 29728 return; 29729 } 29730 29731 nodesToVisit.push(obj); 29732 next(); 29733 }, capability.reject); 29734 return; 29735 } 29736 29737 if (!(0, _primitives.isDict)(currentNode)) { 29738 capability.reject(new _util.FormatError("Page dictionary kid reference points to wrong type of object.")); 29739 return; 29740 } 29741 29742 count = currentNode.get("Count"); 29743 29744 if (Number.isInteger(count) && count >= 0) { 29745 const objId = currentNode.objId; 29746
29747 if (objId && !pageKidsCountCache.has(objId)) { 29748 pageKidsCountCache.put(objId, count); 29749 } 29750 29751 if (currentPageIndex + count <= pageIndex) { 29752 currentPageIndex += count; 29753 continue; 29754 } 29755 } 29756 29757 const kids = currentNode.get("Kids"); 29758 29759 if (!Array.isArray(kids)) { 29760 if ((0, _primitives.isName)(currentNode.get("Type"), "Page") || !currentNode.has("Type") && currentNode.has("Contents")) { 29761 if (currentPageIndex === pageIndex) { 29762 capability.resolve([currentNode, null]); 29763 return; 29764 } 29765 29766 currentPageIndex++; 29767 continue; 29768 } 29769 29770 capability.reject(new _util.FormatError("Page dictionary kids object is not an array.")); 29771 return; 29772 } 29773 29774 for (let last = kids.length - 1; last >= 0; last--) { 29775 nodesToVisit.push(kids[last]); 29776 } 29777 } 29778 29779 capability.reject(new Error(`Page index ${pageIndex} not found.`)); 29780 } 29781 29782 next(); 29783 return capability.promise; 29784 } 29785 29786 getPageIndex(pageRef) { 29787 const xref = this.xref; 29788 29789 function pagesBeforeRef(kidRef) { 29790 let total = 0, 29791 parentRef; 29792 return xref.fetchAsync(kidRef).then(function (node) { 29793 if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, "Page") && !((0, _primitives.isDict)(node) && !node.has("Type") && node.has("Contents"))) { 29794 throw new _util.FormatError("The reference does not point to a /Page dictionary."); 29795 } 29796 29797 if (!node) { 29798 return null; 29799 } 29800 29801 if (!(0, _primitives.isDict)(node)) { 29802 throw new _util.FormatError("Node must be a dictionary."); 29803 } 29804 29805 parentRef = node.getRaw("Parent"); 29806 return node.getAsync("Parent"); 29807 }).then(function (parent) { 29808 if (!parent) { 29809 return null; 29810 } 29811 29812 if (!(0, _primitives.isDict)(parent)) { 29813 throw new _util.FormatError("Parent must be a dictionary."); 29814 } 29815 29816 return parent.getAsync("Kids"); 29817 }).then(function (kids) { 29818 if (!kids) { 29819 return null; 29820 } 29821 29822 const kidPromises = []; 29823 let found = false; 29824 29825 for (let i = 0, ii = kids.length; i < ii; i++) { 29826 const kid = kids[i]; 29827 29828 if (!(0, _primitives.isRef)(kid)) { 29829 throw new _util.FormatError("Kid must be a reference."); 29830 } 29831 29832 if ((0, _primitives.isRefsEqual)(kid, kidRef)) { 29833 found = true; 29834 break; 29835 } 29836 29837 kidPromises.push(xref.fetchAsync(kid).then(function (kid) { 29838 if (!(0, _primitives.isDict)(kid)) { 29839 throw new _util.FormatError("Kid node must be a dictionary."); 29840 } 29841 29842 if (kid.has("Count")) { 29843 total += kid.get("Count"); 29844 } else { 29845 total++; 29846 } 29847 })); 29848 } 29849 29850 if (!found) { 29851 throw new _util.FormatError("Kid reference not found in parent's kids."); 29852 } 29853 29854 return Promise.all(kidPromises).then(function () { 29855 return [total, parentRef]; 29856 }); 29857 }); 29858 } 29859 29860 let total = 0; 29861 29862 function next(ref) { 29863 return pagesBeforeRef(ref).then(function (args) { 29864 if (!args) { 29865 return total; 29866 } 29867 29868 const [count, parentRef] = args; 29869 total += count; 29870 return next(parentRef); 29871 }); 29872 } 29873 29874 return next(pageRef); 29875 } 29876 29877 static parseDestDictionary(params) { 29878 function addDefaultProtocolToUrl(url) { 29879 return url.startsWith("www.") ? `http://${url}` : url; 29880 } 29881 29882 function tryConvertUrlEncoding(url) { 29883 try { 29884 return (0, _util.stringToUTF8String)(url); 29885 } catch (e) { 29886 return url; 29887 } 29888 } 29889 29890 const destDict = params.destDict; 29891 29892 if (!(0, _primitives.isDict)(destDict)) { 29893 (0, _util.warn)("parseDestDictionary: `destDict` must be a dictionary."); 29894 return; 29895 } 29896 29897 const resultObj = params.resultObj; 29898 29899 if (typeof resultObj !== "object") { 29900 (0, _util.warn)("parseDestDictionary: `resultObj` must be an object."); 29901 return; 29902 } 29903 29904 const docBaseUrl = params.docBaseUrl || null; 29905 let action = destDict.get("A"), 29906 url, 29907 dest; 29908 29909 if (!(0, _primitives.isDict)(action) && destDict.has("Dest")) { 29910 action = destDict.get("Dest"); 29911 } 29912 29913 if ((0, _primitives.isDict)(action)) { 29914 const actionType = action.get("S"); 29915 29916 if (!(0, _primitives.isName)(actionType)) { 29917 (0, _util.warn)("parseDestDictionary: Invalid type in Action dictionary."); 29918 return; 29919 } 29920
29921 const actionName = actionType.name; 29922 29923 switch (actionName) { 29924 case "URI": 29925 url = action.get("URI"); 29926 29927 if ((0, _primitives.isName)(url)) { 29928 url = "/" + url.name; 29929 } else if ((0, _util.isString)(url)) { 29930 url = addDefaultProtocolToUrl(url); 29931 } 29932 29933 break; 29934 29935 case "GoTo": 29936 dest = action.get("D"); 29937 break; 29938 29939 case "Launch": 29940 case "GoToR": 29941 const urlDict = action.get("F"); 29942 29943 if ((0, _primitives.isDict)(urlDict)) { 29944 url = urlDict.get("F") || null; 29945 } else if ((0, _util.isString)(urlDict)) { 29946 url = urlDict; 29947 } 29948 29949 let remoteDest = action.get("D"); 29950 29951 if (remoteDest) { 29952 if ((0, _primitives.isName)(remoteDest)) { 29953 remoteDest = remoteDest.name; 29954 } 29955 29956 if ((0, _util.isString)(url)) { 29957 const baseUrl = url.split("#")[0]; 29958 29959 if ((0, _util.isString)(remoteDest)) { 29960 url = baseUrl + "#" + remoteDest; 29961 } else if (Array.isArray(remoteDest)) { 29962 url = baseUrl + "#" + JSON.stringify(remoteDest); 29963 } 29964 } 29965 } 29966 29967 const newWindow = action.get("NewWindow"); 29968 29969 if ((0, _util.isBool)(newWindow)) { 29970 resultObj.newWindow = newWindow; 29971 } 29972 29973 break; 29974 29975 case "Named": 29976 const namedAction = action.get("N"); 29977 29978 if ((0, _primitives.isName)(namedAction)) { 29979 resultObj.action = namedAction.name; 29980 } 29981 29982 break; 29983 29984 case "JavaScript": 29985 const jsAction = action.get("JS"); 29986 let js; 29987 29988 if ((0, _primitives.isStream)(jsAction)) { 29989 js = (0, _util.bytesToString)(jsAction.getBytes()); 29990 } else if ((0, _util.isString)(jsAction)) { 29991 js = jsAction; 29992 } 29993 29994 if (js) { 29995 const URL_OPEN_METHODS = ["app.launchURL", "window.open"]; 29996 const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").split(".").join("\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i"); 29997 const jsUrl = regex.exec((0, _util.stringToPDFString)(js)); 29998 29999 if (jsUrl && jsUrl[2]) { 30000 url = jsUrl[2]; 30001 30002 if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") { 30003 resultObj.newWindow = true; 30004 } 30005 30006 break; 30007 } 30008 } 30009 30010 default: 30011 (0, _util.warn)(`parseDestDictionary: unsupported action type "${actionName}".`); 30012 break; 30013 } 30014 } else if (destDict.has("Dest")) { 30015 dest = destDict.get("Dest"); 30016 } 30017 30018 if ((0, _util.isString)(url)) { 30019 url = tryConvertUrlEncoding(url); 30020 const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl); 30021 30022 if (absoluteUrl) { 30023 resultObj.url = absoluteUrl.href; 30024 } 30025 30026 resultObj.unsafeUrl = url; 30027 } 30028 30029 if (dest) { 30030 if ((0, _primitives.isName)(dest)) { 30031 dest = dest.name; 30032 } 30033 30034 if ((0, _util.isString)(dest) || Array.isArray(dest)) { 30035 resultObj.dest = dest; 30036 } 30037 } 30038 } 30039 30040} 30041 30042exports.Catalog = Catalog; 30043 30044var XRef = function XRefClosure() { 30045 function XRef(stream, pdfManager) { 30046 this.stream = stream; 30047 this.pdfManager = pdfManager; 30048 this.entries = []; 30049 this.xrefstms = Object.create(null); 30050 this._cacheMap = new Map(); 30051 this.stats = { 30052 streamTypes: Object.create(null), 30053 fontTypes: Object.create(null) 30054 }; 30055 } 30056 30057 XRef.prototype = { 30058 setStartXRef: function XRef_setStartXRef(startXRef) { 30059 this.startXRefQueue = [startXRef]; 30060 }, 30061 parse: function XRef_parse(recoveryMode) { 30062 var trailerDict; 30063 30064 if (!recoveryMode) { 30065 trailerDict = this.readXRef(); 30066 } else { 30067 (0, _util.warn)("Indexing all PDF objects"); 30068 trailerDict = this.indexObjects(); 30069 } 30070 30071 trailerDict.assignXref(this); 30072 this.trailer = trailerDict; 30073 let encrypt; 30074 30075 try { 30076 encrypt = trailerDict.get("Encrypt"); 30077 } catch (ex) { 30078 if (ex instanceof _core_utils.MissingDataException) { 30079 throw ex; 30080 } 30081 30082 (0, _util.warn)(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`); 30083 } 30084 30085 if ((0, _primitives.isDict)(encrypt)) { 30086 var ids = trailerDict.get("ID"); 30087 var fileId = ids && ids.length ? ids[0] : ""; 30088 encrypt.suppressEncryption = true; 30089 this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password); 30090 } 30091 30092 let root; 30093
30094 try { 30095 root = trailerDict.get("Root"); 30096 } catch (ex) { 30097 if (ex instanceof _core_utils.MissingDataException) { 30098 throw ex; 30099 } 30100 30101 (0, _util.warn)(`XRef.parse - Invalid "Root" reference: "${ex}".`); 30102 } 30103 30104 if ((0, _primitives.isDict)(root) && root.has("Pages")) { 30105 this.root = root; 30106 } else { 30107 if (!recoveryMode) { 30108 throw new _core_utils.XRefParseException(); 30109 } 30110 30111 throw new _util.FormatError("Invalid root reference"); 30112 } 30113 }, 30114 processXRefTable: function XRef_processXRefTable(parser) { 30115 if (!("tableState" in this)) { 30116 this.tableState = { 30117 entryNum: 0, 30118 streamPos: parser.lexer.stream.pos, 30119 parserBuf1: parser.buf1, 30120 parserBuf2: parser.buf2 30121 }; 30122 } 30123 30124 var obj = this.readXRefTable(parser); 30125 30126 if (!(0, _primitives.isCmd)(obj, "trailer")) { 30127 throw new _util.FormatError("Invalid XRef table: could not find trailer dictionary"); 30128 } 30129 30130 var dict = parser.getObj(); 30131 30132 if (!(0, _primitives.isDict)(dict) && dict.dict) { 30133 dict = dict.dict; 30134 } 30135 30136 if (!(0, _primitives.isDict)(dict)) { 30137 throw new _util.FormatError("Invalid XRef table: could not parse trailer dictionary"); 30138 } 30139 30140 delete this.tableState; 30141 return dict; 30142 }, 30143 readXRefTable: function XRef_readXRefTable(parser) { 30144 var stream = parser.lexer.stream; 30145 var tableState = this.tableState; 30146 stream.pos = tableState.streamPos; 30147 parser.buf1 = tableState.parserBuf1; 30148 parser.buf2 = tableState.parserBuf2; 30149 var obj; 30150 30151 while (true) { 30152 if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) { 30153 if ((0, _primitives.isCmd)(obj = parser.getObj(), "trailer")) { 30154 break; 30155 } 30156 30157 tableState.firstEntryNum = obj; 30158 tableState.entryCount = parser.getObj(); 30159 } 30160 30161 var first = tableState.firstEntryNum; 30162 var count = tableState.entryCount; 30163 30164 if (!Number.isInteger(first) || !Number.isInteger(count)) { 30165 throw new _util.FormatError("Invalid XRef table: wrong types in subsection header"); 30166 } 30167 30168 for (var i = tableState.entryNum; i < count; i++) { 30169 tableState.streamPos = stream.pos; 30170 tableState.entryNum = i; 30171 tableState.parserBuf1 = parser.buf1; 30172 tableState.parserBuf2 = parser.buf2; 30173 var entry = {}; 30174 entry.offset = parser.getObj(); 30175 entry.gen = parser.getObj(); 30176 var type = parser.getObj(); 30177 30178 if (type instanceof _primitives.Cmd) { 30179 switch (type.cmd) { 30180 case "f": 30181 entry.free = true; 30182 break; 30183 30184 case "n": 30185 entry.uncompressed = true; 30186 break; 30187 } 30188 } 30189 30190 if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) { 30191 throw new _util.FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`); 30192 } 30193 30194 if (i === 0 && entry.free && first === 1) { 30195 first = 0; 30196 } 30197 30198 if (!this.entries[i + first]) { 30199 this.entries[i + first] = entry; 30200 } 30201 } 30202 30203 tableState.entryNum = 0; 30204 tableState.streamPos = stream.pos; 30205 tableState.parserBuf1 = parser.buf1; 30206 tableState.parserBuf2 = parser.buf2; 30207 delete tableState.firstEntryNum; 30208 delete tableState.entryCount; 30209 } 30210 30211 if (this.entries[0] && !this.entries[0].free) { 30212 throw new _util.FormatError("Invalid XRef table: unexpected first object"); 30213 } 30214 30215 return obj; 30216 }, 30217 processXRefStream: function XRef_processXRefStream(stream) { 30218 if (!("streamState" in this)) { 30219 var streamParameters = stream.dict; 30220 var byteWidths = streamParameters.get("W"); 30221 var range = streamParameters.get("Index"); 30222 30223 if (!range) { 30224 range = [0, streamParameters.get("Size")]; 30225 } 30226 30227 this.streamState = { 30228 entryRanges: range, 30229 byteWidths, 30230 entryNum: 0, 30231 streamPos: stream.pos 30232 }; 30233 } 30234 30235 this.readXRefStream(stream); 30236 delete this.streamState; 30237 return stream.dict; 30238 }, 30239 readXRefStream: function XRef_readXRefStream(stream) { 30240 var i, j; 30241 var streamState = this.streamState; 30242 stream.pos = streamState.streamPos;
30243 var byteWidths = streamState.byteWidths; 30244 var typeFieldWidth = byteWidths[0]; 30245 var offsetFieldWidth = byteWidths[1]; 30246 var generationFieldWidth = byteWidths[2]; 30247 var entryRanges = streamState.entryRanges; 30248 30249 while (entryRanges.length > 0) { 30250 var first = entryRanges[0]; 30251 var n = entryRanges[1]; 30252 30253 if (!Number.isInteger(first) || !Number.isInteger(n)) { 30254 throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`); 30255 } 30256 30257 if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) { 30258 throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`); 30259 } 30260 30261 for (i = streamState.entryNum; i < n; ++i) { 30262 streamState.entryNum = i; 30263 streamState.streamPos = stream.pos; 30264 var type = 0, 30265 offset = 0, 30266 generation = 0; 30267 30268 for (j = 0; j < typeFieldWidth; ++j) { 30269 type = type << 8 | stream.getByte(); 30270 } 30271 30272 if (typeFieldWidth === 0) { 30273 type = 1; 30274 } 30275 30276 for (j = 0; j < offsetFieldWidth; ++j) { 30277 offset = offset << 8 | stream.getByte(); 30278 } 30279 30280 for (j = 0; j < generationFieldWidth; ++j) { 30281 generation = generation << 8 | stream.getByte(); 30282 } 30283 30284 var entry = {}; 30285 entry.offset = offset; 30286 entry.gen = generation; 30287 30288 switch (type) { 30289 case 0: 30290 entry.free = true; 30291 break; 30292 30293 case 1: 30294 entry.uncompressed = true; 30295 break; 30296 30297 case 2: 30298 break; 30299 30300 default: 30301 throw new _util.FormatError(`Invalid XRef entry type: ${type}`); 30302 } 30303 30304 if (!this.entries[first + i]) { 30305 this.entries[first + i] = entry; 30306 } 30307 } 30308 30309 streamState.entryNum = 0; 30310 streamState.streamPos = stream.pos; 30311 entryRanges.splice(0, 2); 30312 } 30313 }, 30314 indexObjects: function XRef_indexObjects() { 30315 var TAB = 0x9, 30316 LF = 0xa, 30317 CR = 0xd, 30318 SPACE = 0x20; 30319 var PERCENT = 0x25, 30320 LT = 0x3c; 30321 30322 function readToken(data, offset) { 30323 var token = "", 30324 ch = data[offset]; 30325 30326 while (ch !== LF && ch !== CR && ch !== LT) { 30327 if (++offset >= data.length) { 30328 break; 30329 } 30330 30331 token += String.fromCharCode(ch); 30332 ch = data[offset]; 30333 } 30334 30335 return token; 30336 } 30337 30338 function skipUntil(data, offset, what) { 30339 var length = what.length, 30340 dataLength = data.length; 30341 var skipped = 0; 30342 30343 while (offset < dataLength) { 30344 var i = 0; 30345 30346 while (i < length && data[offset + i] === what[i]) { 30347 ++i; 30348 } 30349 30350 if (i >= length) { 30351 break; 30352 } 30353 30354 offset++; 30355 skipped++; 30356 } 30357 30358 return skipped; 30359 } 30360 30361 var objRegExp = /^(\d+)\s+(\d+)\s+obj\b/; 30362 const endobjRegExp = /\bendobj[\b\s]$/; 30363 const nestedObjRegExp = /\s+(\d+\s+\d+\s+obj[\b\s<])$/; 30364 const CHECK_CONTENT_LENGTH = 25; 30365 var trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]); 30366 var startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]); 30367 const objBytes = new Uint8Array([111, 98, 106]); 30368 var xrefBytes = new Uint8Array([47, 88, 82, 101, 102]); 30369 this.entries.length = 0; 30370 var stream = this.stream; 30371 stream.pos = 0; 30372 var buffer = stream.getBytes(); 30373 var position = stream.start, 30374 length = buffer.length; 30375 var trailers = [], 30376 xrefStms = []; 30377 30378 while (position < length) { 30379 var ch = buffer[position]; 30380 30381 if (ch === TAB || ch === LF || ch === CR || ch === SPACE) { 30382 ++position; 30383 continue; 30384 } 30385 30386 if (ch === PERCENT) { 30387 do { 30388 ++position; 30389 30390 if (position >= length) { 30391 break; 30392 } 30393 30394 ch = buffer[position]; 30395 } while (ch !== LF && ch !== CR); 30396 30397 continue; 30398 } 30399 30400 var token = readToken(buffer, position); 30401 var m; 30402 30403 if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) { 30404 position += skipUntil(buffer, position, trailerBytes); 30405 trailers.push(position); 30406 position += skipUntil(buffer, position, startxrefBytes); 30407 } else if (m = objRegExp.exec(token)) { 30408 const num = m[1] | 0, 30409 gen = m[2] | 0; 30410 30411 if (!this.entries[num] || this.entries[num].gen === gen) { 30412 this.entries[num] = { 30413 offset: position - stream.start, 30414 gen, 30415 uncompressed: true 30416 }; 30417 } 30418 30419 let contentLength, 30420 startPos = position + token.length; 30421 30422 while (startPos < buffer.length) {
30423 const endPos = startPos + skipUntil(buffer, startPos, objBytes) + 4; 30424 contentLength = endPos - position; 30425 const checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, startPos); 30426 const tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos)); 30427 30428 if (endobjRegExp.test(tokenStr)) { 30429 break; 30430 } else { 30431 const objToken = nestedObjRegExp.exec(tokenStr); 30432 30433 if (objToken && objToken[1]) { 30434 (0, _util.warn)('indexObjects: Found new "obj" inside of another "obj", ' + 'caused by missing "endobj" -- trying to recover.'); 30435 contentLength -= objToken[1].length; 30436 break; 30437 } 30438 } 30439 30440 startPos = endPos; 30441 } 30442 30443 const content = buffer.subarray(position, position + contentLength); 30444 var xrefTagOffset = skipUntil(content, 0, xrefBytes); 30445 30446 if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) { 30447 xrefStms.push(position - stream.start); 30448 this.xrefstms[position - stream.start] = 1; 30449 } 30450 30451 position += contentLength; 30452 } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) { 30453 trailers.push(position); 30454 position += skipUntil(buffer, position, startxrefBytes); 30455 } else { 30456 position += token.length + 1; 30457 } 30458 } 30459 30460 var i, ii; 30461 30462 for (i = 0, ii = xrefStms.length; i < ii; ++i) { 30463 this.startXRefQueue.push(xrefStms[i]); 30464 this.readXRef(true); 30465 } 30466 30467 let trailerDict; 30468 30469 for (i = 0, ii = trailers.length; i < ii; ++i) { 30470 stream.pos = trailers[i]; 30471 const parser = new _parser.Parser({ 30472 lexer: new _parser.Lexer(stream), 30473 xref: this, 30474 allowStreams: true, 30475 recoveryMode: true 30476 }); 30477 var obj = parser.getObj(); 30478 30479 if (!(0, _primitives.isCmd)(obj, "trailer")) { 30480 continue; 30481 } 30482 30483 const dict = parser.getObj(); 30484 30485 if (!(0, _primitives.isDict)(dict)) { 30486 continue; 30487 } 30488 30489 let rootDict; 30490 30491 try { 30492 rootDict = dict.get("Root"); 30493 } catch (ex) { 30494 if (ex instanceof _core_utils.MissingDataException) { 30495 throw ex; 30496 } 30497 30498 continue; 30499 } 30500 30501 if (!(0, _primitives.isDict)(rootDict) || !rootDict.has("Pages")) { 30502 continue; 30503 } 30504 30505 if (dict.has("ID")) { 30506 return dict; 30507 } 30508 30509 trailerDict = dict; 30510 } 30511 30512 if (trailerDict) { 30513 return trailerDict; 30514 } 30515 30516 throw new _util.InvalidPDFException("Invalid PDF structure."); 30517 }, 30518 readXRef: function XRef_readXRef(recoveryMode) { 30519 var stream = this.stream; 30520 const startXRefParsedCache = Object.create(null); 30521 30522 try { 30523 while (this.startXRefQueue.length) { 30524 var startXRef = this.startXRefQueue[0]; 30525 30526 if (startXRefParsedCache[startXRef]) { 30527 (0, _util.warn)("readXRef - skipping XRef table since it was already parsed."); 30528 this.startXRefQueue.shift(); 30529 continue; 30530 } 30531 30532 startXRefParsedCache[startXRef] = true; 30533 stream.pos = startXRef + stream.start; 30534 const parser = new _parser.Parser({ 30535 lexer: new _parser.Lexer(stream), 30536 xref: this, 30537 allowStreams: true 30538 }); 30539 var obj = parser.getObj(); 30540 var dict; 30541 30542 if ((0, _primitives.isCmd)(obj, "xref")) { 30543 dict = this.processXRefTable(parser); 30544 30545 if (!this.topDict) { 30546 this.topDict = dict; 30547 } 30548 30549 obj = dict.get("XRefStm"); 30550 30551 if (Number.isInteger(obj)) { 30552 var pos = obj; 30553 30554 if (!(pos in this.xrefstms)) { 30555 this.xrefstms[pos] = 1; 30556 this.startXRefQueue.push(pos); 30557 } 30558 } 30559 } else if (Number.isInteger(obj)) { 30560 if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), "obj") || !(0, _primitives.isStream)(obj = parser.getObj())) { 30561 throw new _util.FormatError("Invalid XRef stream"); 30562 } 30563 30564 dict = this.processXRefStream(obj); 30565 30566 if (!this.topDict) { 30567 this.topDict = dict; 30568 } 30569 30570 if (!dict) { 30571 throw new _util.FormatError("Failed to read XRef stream"); 30572 } 30573 } else { 30574 throw new _util.FormatError("Invalid XRef stream header"); 30575 } 30576 30577 obj = dict.get("Prev"); 30578 30579 if (Number.isInteger(obj)) { 30580 this.startXRefQueue.push(obj); 30581 } else if ((0, _primitives.isRef)(obj)) { 30582 this.startXRefQueue.push(obj.num); 30583 } 30584 30585 this.startXRefQueue.shift(); 30586 } 30587 30588 return this.topDict; 30589 } catch (e) { 30590 if (e instanceof _core_utils.MissingDataException) { 30591 throw e; 30592 } 30593 30594 (0, _util.info)("(while reading XRef): " + e); 30595 } 30596 30597 if (recoveryMode) { 30598 return undefined; 30599 } 30600 30601 throw new _core_utils.XRefParseException(); 30602 }, 30603 getEntry: function XRef_getEntry(i) { 30604 var xrefEntry = this.entries[i]; 30605 30606 if (xrefEntry && !xrefEntry.free && xrefEntry.offset) { 30607 return xrefEntry; 30608 } 30609 30610 return null; 30611 }, 30612 fetchIfRef: function XRef_fetchIfRef(obj, suppressEncryption) { 30613 if (obj instanceof _primitives.Ref) { 30614 return this.fetch(obj, suppressEncryption); 30615 } 30616 30617 return obj; 30618 }, 30619 fetch: function XRef_fetch(ref, suppressEncryption) { 30620 if (!(ref instanceof _primitives.Ref)) { 30621 throw new Error("ref object is not a reference"); 30622 } 30623 30624 const num = ref.num; 30625 30626 const cacheEntry = this._cacheMap.get(num); 30627 30628 if (cacheEntry !== undefined) { 30629 if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) { 30630 cacheEntry.objId = ref.toString(); 30631 } 30632 30633 return cacheEntry; 30634 } 30635 30636 let xrefEntry = this.getEntry(num); 30637 30638 if (xrefEntry === null) { 30639 this._cacheMap.set(num, xrefEntry); 30640 30641 return xrefEntry; 30642 } 30643 30644 if (xrefEntry.uncompressed) { 30645 xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption); 30646 } else { 30647 xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption); 30648 } 30649 30650 if ((0, _primitives.isDict)(xrefEntry)) { 30651 xrefEntry.objId = ref.toString(); 30652 } else if ((0, _primitives.isStream)(xrefEntry)) { 30653 xrefEntry.dict.objId = ref.toString(); 30654 } 30655 30656 return xrefEntry; 30657 }, 30658 30659 fetchUncompressed(ref, xrefEntry, suppressEncryption = false) { 30660 var gen = ref.gen; 30661 var num = ref.num; 30662 30663 if (xrefEntry.gen !== gen) { 30664 throw new _core_utils.XRefEntryException(`Inconsistent generation in XRef: ${ref}`); 30665 } 30666 30667 var stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start); 30668 const parser = new _parser.Parser({ 30669 lexer: new _parser.Lexer(stream), 30670 xref: this, 30671 allowStreams: true 30672 }); 30673 var obj1 = parser.getObj(); 30674 var obj2 = parser.getObj(); 30675 var obj3 = parser.getObj(); 30676 30677 if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) { 30678 throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`); 30679 } 30680 30681 if (obj3.cmd !== "obj") { 30682 if (obj3.cmd.startsWith("obj")) { 30683 num = parseInt(obj3.cmd.substring(3), 10); 30684 30685 if (!Number.isNaN(num)) { 30686 return num; 30687 } 30688 } 30689 30690 throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`); 30691 } 30692 30693 if (this.encrypt && !suppressEncryption) { 30694 xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen)); 30695 } else { 30696 xrefEntry = parser.getObj(); 30697 } 30698 30699 if (!(0, _primitives.isStream)(xrefEntry)) { 30700 this._cacheMap.set(num, xrefEntry); 30701 } 30702 30703 return xrefEntry; 30704 }, 30705 30706 fetchCompressed(ref, xrefEntry, suppressEncryption = false) { 30707 const tableOffset = xrefEntry.offset; 30708 const stream = this.fetch(_primitives.Ref.get(tableOffset, 0)); 30709 30710 if (!(0, _primitives.isStream)(stream)) { 30711 throw new _util.FormatError("bad ObjStm stream"); 30712 } 30713 30714 const first = stream.dict.get("First"); 30715 const n = stream.dict.get("N"); 30716 30717 if (!Number.isInteger(first) || !Number.isInteger(n)) { 30718 throw new _util.FormatError("invalid first and n parameters for ObjStm stream"); 30719 } 30720 30721 const parser = new _parser.Parser({ 30722 lexer: new _parser.Lexer(stream), 30723 xref: this, 30724 allowStreams: true 30725 }); 30726 const nums = new Array(n); 30727 30728 for (let i = 0; i < n; ++i) { 30729 const num = parser.getObj(); 30730 30731 if (!Number.isInteger(num)) { 30732 throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`); 30733 } 30734 30735 const offset = parser.getObj(); 30736 30737 if (!Number.isInteger(offset)) { 30738 throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`); 30739 } 30740 30741 nums[i] = num; 30742 } 30743 30744 const entries = new Array(n); 30745 30746 for (let i = 0; i < n; ++i) { 30747 const obj = parser.getObj();
30748 entries[i] = obj; 30749 30750 if (parser.buf1 instanceof _primitives.Cmd && parser.buf1.cmd === "endobj") { 30751 parser.shift(); 30752 } 30753 30754 if ((0, _primitives.isStream)(obj)) { 30755 continue; 30756 } 30757 30758 const num = nums[i], 30759 entry = this.entries[num]; 30760 30761 if (entry && entry.offset === tableOffset && entry.gen === i) { 30762 this._cacheMap.set(num, obj); 30763 } 30764 } 30765 30766 xrefEntry = entries[xrefEntry.gen]; 30767 30768 if (xrefEntry === undefined) { 30769 throw new _core_utils.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`); 30770 } 30771 30772 return xrefEntry; 30773 }, 30774 30775 async fetchIfRefAsync(obj, suppressEncryption) { 30776 if (obj instanceof _primitives.Ref) { 30777 return this.fetchAsync(obj, suppressEncryption); 30778 } 30779 30780 return obj; 30781 }, 30782 30783 async fetchAsync(ref, suppressEncryption) { 30784 try { 30785 return this.fetch(ref, suppressEncryption); 30786 } catch (ex) { 30787 if (!(ex instanceof _core_utils.MissingDataException)) { 30788 throw ex; 30789 } 30790 30791 await this.pdfManager.requestRange(ex.begin, ex.end); 30792 return this.fetchAsync(ref, suppressEncryption); 30793 } 30794 }, 30795 30796 getCatalogObj: function XRef_getCatalogObj() { 30797 return this.root; 30798 } 30799 }; 30800 return XRef; 30801}(); 30802 30803exports.XRef = XRef; 30804 30805class NameOrNumberTree { 30806 constructor(root, xref, type) { 30807 if (this.constructor === NameOrNumberTree) { 30808 (0, _util.unreachable)("Cannot initialize NameOrNumberTree."); 30809 } 30810 30811 this.root = root; 30812 this.xref = xref; 30813 this._type = type; 30814 } 30815 30816 getAll() { 30817 const dict = Object.create(null); 30818 30819 if (!this.root) { 30820 return dict; 30821 } 30822 30823 const xref = this.xref; 30824 const processed = new _primitives.RefSet(); 30825 processed.put(this.root); 30826 const queue = [this.root]; 30827 30828 while (queue.length > 0) { 30829 const obj = xref.fetchIfRef(queue.shift()); 30830 30831 if (!(0, _primitives.isDict)(obj)) { 30832 continue; 30833 } 30834 30835 if (obj.has("Kids")) { 30836 const kids = obj.get("Kids"); 30837 30838 for (let i = 0, ii = kids.length; i < ii; i++) { 30839 const kid = kids[i]; 30840 30841 if (processed.has(kid)) { 30842 throw new _util.FormatError(`Duplicate entry in "${this._type}" tree.`); 30843 } 30844 30845 queue.push(kid); 30846 processed.put(kid); 30847 } 30848 30849 continue; 30850 } 30851 30852 const entries = obj.get(this._type); 30853 30854 if (Array.isArray(entries)) { 30855 for (let i = 0, ii = entries.length; i < ii; i += 2) { 30856 dict[xref.fetchIfRef(entries[i])] = xref.fetchIfRef(entries[i + 1]); 30857 } 30858 } 30859 } 30860 30861 return dict; 30862 } 30863 30864 get(key) { 30865 if (!this.root) { 30866 return null; 30867 } 30868 30869 const xref = this.xref; 30870 let kidsOrEntries = xref.fetchIfRef(this.root); 30871 let loopCount = 0; 30872 const MAX_LEVELS = 10; 30873 30874 while (kidsOrEntries.has("Kids")) { 30875 if (++loopCount > MAX_LEVELS) { 30876 (0, _util.warn)(`Search depth limit reached for "${this._type}" tree.`); 30877 return null; 30878 } 30879 30880 const kids = kidsOrEntries.get("Kids"); 30881 30882 if (!Array.isArray(kids)) { 30883 return null; 30884 } 30885 30886 let l = 0, 30887 r = kids.length - 1; 30888 30889 while (l <= r) { 30890 const m = l + r >> 1; 30891 const kid = xref.fetchIfRef(kids[m]); 30892 const limits = kid.get("Limits"); 30893 30894 if (key < xref.fetchIfRef(limits[0])) { 30895 r = m - 1; 30896 } else if (key > xref.fetchIfRef(limits[1])) { 30897 l = m + 1; 30898 } else { 30899 kidsOrEntries = xref.fetchIfRef(kids[m]); 30900 break; 30901 } 30902 } 30903 30904 if (l > r) { 30905 return null; 30906 } 30907 } 30908 30909 const entries = kidsOrEntries.get(this._type); 30910 30911 if (Array.isArray(entries)) { 30912 let l = 0, 30913 r = entries.length - 2; 30914 30915 while (l <= r) { 30916 const tmp = l + r >> 1, 30917 m = tmp + (tmp & 1); 30918 const currentKey = xref.fetchIfRef(entries[m]); 30919 30920 if (key < currentKey) { 30921 r = m - 2; 30922 } else if (key > currentKey) { 30923 l = m + 2; 30924 } else { 30925 return xref.fetchIfRef(entries[m + 1]); 30926 } 30927 } 30928 30929 (0, _util.info)(`Falling back to an exhaustive search, for key "${key}", ` + `in "${this._type}" tree.`); 30930 30931 for (let m = 0, mm = entries.length; m < mm; m += 2) { 30932 const currentKey = xref.fetchIfRef(entries[m]); 30933 30934 if (currentKey === key) { 30935 (0, _util.warn)(`The "${key}" key was found at an incorrect, ` + `i.e. out-of-order, position in "${this._type}" tree.`); 30936 return xref.fetchIfRef(entries[m + 1]); 30937 } 30938 } 30939 } 30940 30941 return null; 30942 } 30943 30944} 30945 30946class NameTree extends NameOrNumberTree { 30947 constructor(root, xref) { 30948 super(root, xref, "Names"); 30949 } 30950 30951} 30952 30953class NumberTree extends NameOrNumberTree { 30954 constructor(root, xref) { 30955 super(root, xref, "Nums"); 30956 } 30957 30958} 30959 30960var FileSpec = function FileSpecClosure() { 30961 function FileSpec(root, xref) { 30962 if (!root || !(0, _primitives.isDict)(root)) { 30963 return; 30964 } 30965 30966 this.xref = xref; 30967 this.root = root; 30968 30969 if (root.has("FS")) { 30970 this.fs = root.get("FS"); 30971 } 30972 30973 this.description = root.has("Desc") ? (0, _util.stringToPDFString)(root.get("Desc")) : ""; 30974 30975 if (root.has("RF")) { 30976 (0, _util.warn)("Related file specifications are not supported"); 30977 } 30978 30979 this.contentAvailable = true; 30980 30981 if (!root.has("EF")) { 30982 this.contentAvailable = false;
30983 (0, _util.warn)("Non-embedded file specifications are not supported"); 30984 } 30985 } 30986 30987 function pickPlatformItem(dict) { 30988 if (dict.has("UF")) { 30989 return dict.get("UF"); 30990 } else if (dict.has("F")) { 30991 return dict.get("F"); 30992 } else if (dict.has("Unix")) { 30993 return dict.get("Unix"); 30994 } else if (dict.has("Mac")) { 30995 return dict.get("Mac"); 30996 } else if (dict.has("DOS")) { 30997 return dict.get("DOS"); 30998 } 30999 31000 return null; 31001 } 31002 31003 FileSpec.prototype = { 31004 get filename() { 31005 if (!this._filename && this.root) { 31006 var filename = pickPlatformItem(this.root) || "unnamed"; 31007 this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\/g, "\\").replace(/\\\//g, "/").replace(/\\/g, "/"); 31008 } 31009 31010 return this._filename; 31011 }, 31012 31013 get content() { 31014 if (!this.contentAvailable) { 31015 return null; 31016 } 31017 31018 if (!this.contentRef && this.root) { 31019 this.contentRef = pickPlatformItem(this.root.get("EF")); 31020 } 31021 31022 var content = null; 31023 31024 if (this.contentRef) { 31025 var xref = this.xref; 31026 var fileObj = xref.fetchIfRef(this.contentRef); 31027 31028 if (fileObj && (0, _primitives.isStream)(fileObj)) { 31029 content = fileObj.getBytes(); 31030 } else { 31031 (0, _util.warn)("Embedded file specification points to non-existing/invalid " + "content"); 31032 } 31033 } else { 31034 (0, _util.warn)("Embedded file specification does not have a content"); 31035 } 31036 31037 return content; 31038 }, 31039 31040 get serializable() { 31041 return { 31042 filename: this.filename, 31043 content: this.content 31044 }; 31045 } 31046 31047 }; 31048 return FileSpec; 31049}(); 31050 31051exports.FileSpec = FileSpec; 31052 31053const ObjectLoader = function () { 31054 function mayHaveChildren(value) { 31055 return value instanceof _primitives.Ref || value instanceof _primitives.Dict || Array.isArray(value) || (0, _primitives.isStream)(value); 31056 } 31057 31058 function addChildren(node, nodesToVisit) { 31059 if (node instanceof _primitives.Dict || (0, _primitives.isStream)(node)) { 31060 const dict = node instanceof _primitives.Dict ? node : node.dict; 31061 const dictKeys = dict.getKeys(); 31062 31063 for (let i = 0, ii = dictKeys.length; i < ii; i++) { 31064 const rawValue = dict.getRaw(dictKeys[i]); 31065 31066 if (mayHaveChildren(rawValue)) { 31067 nodesToVisit.push(rawValue); 31068 } 31069 } 31070 } else if (Array.isArray(node)) { 31071 for (let i = 0, ii = node.length; i < ii; i++) { 31072 const value = node[i]; 31073 31074 if (mayHaveChildren(value)) { 31075 nodesToVisit.push(value); 31076 } 31077 } 31078 } 31079 } 31080 31081 function ObjectLoader(dict, keys, xref) { 31082 this.dict = dict; 31083 this.keys = keys; 31084 this.xref = xref; 31085 this.refSet = null; 31086 } 31087 31088 ObjectLoader.prototype = { 31089 async load() { 31090 if (!this.xref.stream.allChunksLoaded || this.xref.stream.allChunksLoaded()) { 31091 return undefined; 31092 } 31093 31094 const { 31095 keys, 31096 dict 31097 } = this; 31098 this.refSet = new _primitives.RefSet(); 31099 const nodesToVisit = []; 31100 31101 for (let i = 0, ii = keys.length; i < ii; i++) { 31102 const rawValue = dict.getRaw(keys[i]); 31103 31104 if (rawValue !== undefined) { 31105 nodesToVisit.push(rawValue); 31106 } 31107 } 31108 31109 return this._walk(nodesToVisit); 31110 }, 31111 31112 async _walk(nodesToVisit) { 31113 const nodesToRevisit = []; 31114 const pendingRequests = []; 31115 31116 while (nodesToVisit.length) { 31117 let currentNode = nodesToVisit.pop(); 31118 31119 if (currentNode instanceof _primitives.Ref) { 31120 if (this.refSet.has(currentNode)) { 31121 continue; 31122 } 31123 31124 try { 31125 this.refSet.put(currentNode); 31126 currentNode = this.xref.fetch(currentNode); 31127 } catch (ex) { 31128 if (!(ex instanceof _core_utils.MissingDataException)) { 31129 throw ex; 31130 } 31131 31132 nodesToRevisit.push(currentNode); 31133 pendingRequests.push({ 31134 begin: ex.begin, 31135 end: ex.end 31136 }); 31137 } 31138 } 31139 31140 if (currentNode && currentNode.getBaseStreams) { 31141 const baseStreams = currentNode.getBaseStreams(); 31142 let foundMissingData = false;
31143 31144 for (let i = 0, ii = baseStreams.length; i < ii; i++) { 31145 const stream = baseStreams[i]; 31146 31147 if (stream.allChunksLoaded && !stream.allChunksLoaded()) { 31148 foundMissingData = true; 31149 pendingRequests.push({ 31150 begin: stream.start, 31151 end: stream.end 31152 }); 31153 } 31154 } 31155 31156 if (foundMissingData) { 31157 nodesToRevisit.push(currentNode); 31158 } 31159 } 31160 31161 addChildren(currentNode, nodesToVisit); 31162 } 31163 31164 if (pendingRequests.length) { 31165 await this.xref.stream.manager.requestRanges(pendingRequests); 31166 31167 for (let i = 0, ii = nodesToRevisit.length; i < ii; i++) { 31168 const node = nodesToRevisit[i]; 31169 31170 if (node instanceof _primitives.Ref) { 31171 this.refSet.remove(node); 31172 } 31173 } 31174 31175 return this._walk(nodesToRevisit); 31176 } 31177 31178 this.refSet = null; 31179 return undefined; 31180 } 31181 31182 }; 31183 return ObjectLoader; 31184}(); 31185 31186exports.ObjectLoader = ObjectLoader; 31187 31188/***/ }), 31189/* 10 */ 31190/***/ (function(module, exports, __w_pdfjs_require__) { 31191 31192"use strict"; 31193 31194 31195Object.defineProperty(exports, "__esModule", { 31196 value: true 31197}); 31198exports.Parser = exports.Linearization = exports.Lexer = void 0; 31199 31200var _stream = __w_pdfjs_require__(11); 31201 31202var _util = __w_pdfjs_require__(2); 31203 31204var _primitives = __w_pdfjs_require__(4); 31205 31206var _core_utils = __w_pdfjs_require__(7); 31207 31208var _ccitt_stream = __w_pdfjs_require__(12); 31209 31210var _jbig2_stream = __w_pdfjs_require__(14); 31211 31212var _jpeg_stream = __w_pdfjs_require__(17); 31213 31214var _jpx_stream = __w_pdfjs_require__(19); 31215 31216const MAX_LENGTH_TO_CACHE = 1000; 31217const MAX_ADLER32_LENGTH = 5552; 31218 31219function computeAdler32(bytes) { 31220 const bytesLength = bytes.length; 31221 let a = 1, 31222 b = 0; 31223 31224 for (let i = 0; i < bytesLength; ++i) { 31225 a += bytes[i] & 0xff; 31226 b += a; 31227 } 31228 31229 return b % 65521 << 16 | a % 65521; 31230} 31231 31232class Parser { 31233 constructor({ 31234 lexer, 31235 xref, 31236 allowStreams = false, 31237 recoveryMode = false 31238 }) { 31239 this.lexer = lexer; 31240 this.xref = xref; 31241 this.allowStreams = allowStreams; 31242 this.recoveryMode = recoveryMode; 31243 this.imageCache = Object.create(null); 31244 this.refill(); 31245 } 31246 31247 refill() { 31248 this.buf1 = this.lexer.getObj(); 31249 this.buf2 = this.lexer.getObj(); 31250 } 31251 31252 shift() { 31253 if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === "ID") { 31254 this.buf1 = this.buf2; 31255 this.buf2 = null; 31256 } else { 31257 this.buf1 = this.buf2; 31258 this.buf2 = this.lexer.getObj(); 31259 } 31260 } 31261 31262 tryShift() { 31263 try { 31264 this.shift(); 31265 return true; 31266 } catch (e) { 31267 if (e instanceof _core_utils.MissingDataException) { 31268 throw e; 31269 } 31270 31271 return false; 31272 } 31273 } 31274 31275 getObj(cipherTransform = null) { 31276 const buf1 = this.buf1; 31277 this.shift(); 31278 31279 if (buf1 instanceof _primitives.Cmd) { 31280 switch (buf1.cmd) { 31281 case "BI": 31282 return this.makeInlineImage(cipherTransform); 31283 31284 case "[": 31285 const array = []; 31286 31287 while (!(0, _primitives.isCmd)(this.buf1, "]") && !(0, _primitives.isEOF)(this.buf1)) { 31288 array.push(this.getObj(cipherTransform)); 31289 } 31290 31291 if ((0, _primitives.isEOF)(this.buf1)) { 31292 if (!this.recoveryMode) { 31293 throw new _util.FormatError("End of file inside array"); 31294 } 31295 31296 return array; 31297 } 31298 31299 this.shift(); 31300 return array; 31301 31302 case "<<": 31303 const dict = new _primitives.Dict(this.xref); 31304 31305 while (!(0, _primitives.isCmd)(this.buf1, ">>") && !(0, _primitives.isEOF)(this.buf1)) { 31306 if (!(0, _primitives.isName)(this.buf1)) { 31307 (0, _util.info)("Malformed dictionary: key must be a name object"); 31308 this.shift(); 31309 continue; 31310 } 31311 31312 const key = this.buf1.name; 31313 this.shift(); 31314 31315 if ((0, _primitives.isEOF)(this.buf1)) { 31316 break; 31317 } 31318 31319 dict.set(key, this.getObj(cipherTransform)); 31320 } 31321 31322 if ((0, _primitives.isEOF)(this.buf1)) { 31323 if (!this.recoveryMode) { 31324 throw new _util.FormatError("End of file inside dictionary"); 31325 } 31326 31327 return dict; 31328 } 31329 31330 if ((0, _primitives.isCmd)(this.buf2, "stream")) { 31331 return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict; 31332 } 31333 31334 this.shift(); 31335 return dict; 31336 31337 default: 31338 return buf1; 31339 } 31340 } 31341 31342 if (Number.isInteger(buf1)) { 31343 if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) { 31344 const ref = _primitives.Ref.get(buf1, this.buf1); 31345 31346 this.shift(); 31347 this.shift(); 31348 return ref; 31349 } 31350 31351 return buf1; 31352 } 31353 31354 if (typeof buf1 === "string") { 31355 if (cipherTransform) { 31356 return cipherTransform.decryptString(buf1); 31357 } 31358 31359 return buf1; 31360 } 31361 31362 return buf1; 31363 } 31364 31365 findDefaultInlineStreamEnd(stream) { 31366 const E = 0x45, 31367 I = 0x49, 31368 SPACE = 0x20, 31369 LF = 0xa, 31370 CR = 0xd; 31371 const n = 10, 31372 NUL = 0x0; 31373 const startPos = stream.pos; 31374 let state = 0, 31375 ch, 31376 maybeEIPos; 31377 31378 while ((ch = stream.getByte()) !== -1) { 31379 if (state === 0) { 31380 state = ch === E ? 1 : 0; 31381 } else if (state === 1) { 31382 state = ch === I ? 2 : 0; 31383 } else { 31384 (0, _util.assert)(state === 2); 31385 31386 if (ch === SPACE || ch === LF || ch === CR) { 31387 maybeEIPos = stream.pos; 31388 const followingBytes = stream.peekBytes(n); 31389 31390 for (let i = 0, ii = followingBytes.length; i < ii; i++) { 31391 ch = followingBytes[i]; 31392 31393 if (ch === NUL && followingBytes[i + 1] !== NUL) { 31394 continue; 31395 } 31396 31397 if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) { 31398 state = 0; 31399 break; 31400 } 31401 } 31402 31403 if (state === 2) { 31404 break; 31405 } 31406 } else { 31407 state = 0; 31408 } 31409 } 31410 } 31411 31412 if (ch === -1) { 31413 (0, _util.warn)("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker"); 31414 31415 if (maybeEIPos) {
vendor: 4,406 bytes, lines 31416-31615
31416 (0, _util.warn)('... trying to recover by using the last "EI" occurrence.'); 31417 stream.skip(-(stream.pos - maybeEIPos)); 31418 } 31419 } 31420 31421 let endOffset = 4; 31422 stream.skip(-endOffset); 31423 ch = stream.peekByte(); 31424 stream.skip(endOffset); 31425 31426 if (!(0, _core_utils.isWhiteSpace)(ch)) { 31427 endOffset--; 31428 } 31429 31430 return stream.pos - endOffset - startPos; 31431 } 31432 31433 findDCTDecodeInlineStreamEnd(stream) { 31434 const startPos = stream.pos; 31435 let foundEOI = false, 31436 b, 31437 markerLength; 31438 31439 while ((b = stream.getByte()) !== -1) { 31440 if (b !== 0xff) { 31441 continue; 31442 } 31443 31444 switch (stream.getByte()) { 31445 case 0x00: 31446 break; 31447 31448 case 0xff: 31449 stream.skip(-1); 31450 break; 31451 31452 case 0xd9: 31453 foundEOI = true; 31454 break; 31455 31456 case 0xc0: 31457 case 0xc1: 31458 case 0xc2: 31459 case 0xc3: 31460 case 0xc5: 31461 case 0xc6: 31462 case 0xc7: 31463 case 0xc9: 31464 case 0xca: 31465 case 0xcb: 31466 case 0xcd: 31467 case 0xce: 31468 case 0xcf: 31469 case 0xc4: 31470 case 0xcc: 31471 case 0xda: 31472 case 0xdb: 31473 case 0xdc: 31474 case 0xdd: 31475 case 0xde: 31476 case 0xdf: 31477 case 0xe0: 31478 case 0xe1: 31479 case 0xe2: 31480 case 0xe3: 31481 case 0xe4: 31482 case 0xe5: 31483 case 0xe6: 31484 case 0xe7: 31485 case 0xe8: 31486 case 0xe9: 31487 case 0xea: 31488 case 0xeb: 31489 case 0xec: 31490 case 0xed: 31491 case 0xee: 31492 case 0xef: 31493 case 0xfe: 31494 markerLength = stream.getUint16(); 31495 31496 if (markerLength > 2) { 31497 stream.skip(markerLength - 2); 31498 } else { 31499 stream.skip(-2); 31500 } 31501 31502 break; 31503 } 31504 31505 if (foundEOI) { 31506 break; 31507 } 31508 } 31509 31510 const length = stream.pos - startPos; 31511 31512 if (b === -1) { 31513 (0, _util.warn)("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead."); 31514 stream.skip(-length); 31515 return this.findDefaultInlineStreamEnd(stream); 31516 } 31517 31518 this.inlineStreamSkipEI(stream); 31519 return length; 31520 } 31521 31522 findASCII85DecodeInlineStreamEnd(stream) { 31523 const TILDE = 0x7e, 31524 GT = 0x3e; 31525 const startPos = stream.pos; 31526 let ch; 31527 31528 while ((ch = stream.getByte()) !== -1) { 31529 if (ch === TILDE) { 31530 const tildePos = stream.pos; 31531 ch = stream.peekByte(); 31532 31533 while ((0, _core_utils.isWhiteSpace)(ch)) { 31534 stream.skip(); 31535 ch = stream.peekByte(); 31536 } 31537 31538 if (ch === GT) { 31539 stream.skip(); 31540 break; 31541 } 31542 31543 if (stream.pos > tildePos) { 31544 const maybeEI = stream.peekBytes(2); 31545 31546 if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) { 31547 break; 31548 } 31549 } 31550 } 31551 } 31552 31553 const length = stream.pos - startPos; 31554 31555 if (ch === -1) { 31556 (0, _util.warn)("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead."); 31557 stream.skip(-length); 31558 return this.findDefaultInlineStreamEnd(stream); 31559 } 31560 31561 this.inlineStreamSkipEI(stream); 31562 return length; 31563 } 31564 31565 findASCIIHexDecodeInlineStreamEnd(stream) { 31566 const GT = 0x3e; 31567 const startPos = stream.pos; 31568 let ch; 31569 31570 while ((ch = stream.getByte()) !== -1) { 31571 if (ch === GT) { 31572 break; 31573 } 31574 } 31575 31576 const length = stream.pos - startPos; 31577 31578 if (ch === -1) { 31579 (0, _util.warn)("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead."); 31580 stream.skip(-length); 31581 return this.findDefaultInlineStreamEnd(stream); 31582 } 31583 31584 this.inlineStreamSkipEI(stream); 31585 return length; 31586 } 31587 31588 inlineStreamSkipEI(stream) { 31589 const E = 0x45, 31590 I = 0x49; 31591 let state = 0, 31592 ch; 31593 31594 while ((ch = stream.getByte()) !== -1) { 31595 if (state === 0) { 31596 state = ch === E ? 1 : 0; 31597 } else if (state === 1) { 31598 state = ch === I ? 2 : 0; 31599 } else if (state === 2) { 31600 break; 31601 } 31602 } 31603 } 31604 31605 makeInlineImage(cipherTransform) { 31606 const lexer = this.lexer; 31607 const stream = lexer.stream; 31608 const dict = new _primitives.Dict(this.xref); 31609 let dictLength; 31610 31611 while (!(0, _primitives.isCmd)(this.buf1, "ID") && !(0, _primitives.isEOF)(this.buf1)) { 31612 if (!(0, _primitives.isName)(this.buf1)) { 31613 throw new _util.FormatError("Dictionary key must be a name object"); 31614 } 31615
31616 const key = this.buf1.name; 31617 this.shift(); 31618 31619 if ((0, _primitives.isEOF)(this.buf1)) { 31620 break; 31621 } 31622 31623 dict.set(key, this.getObj(cipherTransform)); 31624 } 31625 31626 if (lexer.beginInlineImagePos !== -1) { 31627 dictLength = stream.pos - lexer.beginInlineImagePos; 31628 } 31629 31630 const filter = dict.get("Filter", "F"); 31631 let filterName; 31632 31633 if ((0, _primitives.isName)(filter)) { 31634 filterName = filter.name; 31635 } else if (Array.isArray(filter)) { 31636 const filterZero = this.xref.fetchIfRef(filter[0]); 31637 31638 if ((0, _primitives.isName)(filterZero)) { 31639 filterName = filterZero.name; 31640 } 31641 } 31642 31643 const startPos = stream.pos; 31644 let length; 31645 31646 if (filterName === "DCTDecode" || filterName === "DCT") { 31647 length = this.findDCTDecodeInlineStreamEnd(stream); 31648 } else if (filterName === "ASCII85Decode" || filterName === "A85") { 31649 length = this.findASCII85DecodeInlineStreamEnd(stream); 31650 } else if (filterName === "ASCIIHexDecode" || filterName === "AHx") { 31651 length = this.findASCIIHexDecodeInlineStreamEnd(stream); 31652 } else { 31653 length = this.findDefaultInlineStreamEnd(stream); 31654 } 31655 31656 let imageStream = stream.makeSubStream(startPos, length, dict); 31657 let cacheKey; 31658 31659 if (length < MAX_LENGTH_TO_CACHE && dictLength < MAX_ADLER32_LENGTH) { 31660 const imageBytes = imageStream.getBytes(); 31661 imageStream.reset(); 31662 const initialStreamPos = stream.pos; 31663 stream.pos = lexer.beginInlineImagePos; 31664 const dictBytes = stream.getBytes(dictLength); 31665 stream.pos = initialStreamPos; 31666 cacheKey = computeAdler32(imageBytes) + "_" + computeAdler32(dictBytes); 31667 const cacheEntry = this.imageCache[cacheKey]; 31668 31669 if (cacheEntry !== undefined) { 31670 this.buf2 = _primitives.Cmd.get("EI"); 31671 this.shift(); 31672 cacheEntry.reset(); 31673 return cacheEntry; 31674 } 31675 } 31676 31677 if (cipherTransform) { 31678 imageStream = cipherTransform.createStream(imageStream, length); 31679 } 31680 31681 imageStream = this.filter(imageStream, dict, length); 31682 imageStream.dict = dict; 31683 31684 if (cacheKey !== undefined) { 31685 imageStream.cacheKey = `inline_${length}_${cacheKey}`; 31686 this.imageCache[cacheKey] = imageStream; 31687 } 31688 31689 this.buf2 = _primitives.Cmd.get("EI"); 31690 this.shift(); 31691 return imageStream; 31692 } 31693 31694 _findStreamLength(startPos, signature) { 31695 const { 31696 stream 31697 } = this.lexer; 31698 stream.pos = startPos; 31699 const SCAN_BLOCK_LENGTH = 2048; 31700 const signatureLength = signature.length; 31701 31702 while (stream.pos < stream.end) { 31703 const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH); 31704 const scanLength = scanBytes.length - signatureLength; 31705 31706 if (scanLength <= 0) { 31707 break; 31708 } 31709 31710 let pos = 0; 31711 31712 while (pos < scanLength) { 31713 let j = 0; 31714 31715 while (j < signatureLength && scanBytes[pos + j] === signature[j]) { 31716 j++; 31717 } 31718 31719 if (j >= signatureLength) { 31720 stream.pos += pos; 31721 return stream.pos - startPos; 31722 } 31723 31724 pos++; 31725 } 31726 31727 stream.pos += scanLength; 31728 } 31729 31730 return -1; 31731 } 31732 31733 makeStream(dict, cipherTransform) { 31734 const lexer = this.lexer; 31735 let stream = lexer.stream; 31736 lexer.skipToNextLine(); 31737 const startPos = stream.pos - 1; 31738 let length = dict.get("Length"); 31739 31740 if (!Number.isInteger(length)) { 31741 (0, _util.info)(`Bad length "${length}" in stream`); 31742 length = 0; 31743 } 31744 31745 stream.pos = startPos + length; 31746 lexer.nextChar(); 31747 31748 if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, "endstream")) { 31749 this.shift(); 31750 } else { 31751 const ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6E, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6D]); 31752 31753 let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE); 31754 31755 if (actualLength < 0) { 31756 const MAX_TRUNCATION = 1; 31757 31758 for (let i = 1; i <= MAX_TRUNCATION; i++) { 31759 const end = ENDSTREAM_SIGNATURE.length - i; 31760 const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end); 31761 31762 const maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE); 31763 31764 if (maybeLength >= 0) { 31765 const lastByte = stream.peekBytes(end + 1)[end]; 31766 31767 if (!(0, _core_utils.isWhiteSpace)(lastByte)) { 31768 break; 31769 } 31770 31771 (0, _util.info)(`Found "${(0, _util.bytesToString)(TRUNCATED_SIGNATURE)}" when ` + "searching for endstream command."); 31772 actualLength = maybeLength; 31773 break; 31774 } 31775 } 31776 31777 if (actualLength < 0) { 31778 throw new _util.FormatError("Missing endstream command."); 31779 } 31780 } 31781 31782 length = actualLength; 31783 lexer.nextChar(); 31784 this.shift(); 31785 this.shift(); 31786 } 31787 31788 this.shift(); 31789 stream = stream.makeSubStream(startPos, length, dict); 31790 31791 if (cipherTransform) { 31792 stream = cipherTransform.createStream(stream, length); 31793 } 31794 31795 stream = this.filter(stream, dict, length); 31796 stream.dict = dict; 31797 return stream; 31798 } 31799 31800 filter(stream, dict, length) { 31801 let filter = dict.get("Filter", "F"); 31802 let params = dict.get("DecodeParms", "DP"); 31803 31804 if ((0, _primitives.isName)(filter)) { 31805 if (Array.isArray(params)) { 31806 (0, _util.warn)("/DecodeParms should not contain an Array, " + "when /Filter contains a Name."); 31807 } 31808 31809 return this.makeFilter(stream, filter.name, length, params); 31810 } 31811 31812 let maybeLength = length; 31813 31814 if (Array.isArray(filter)) { 31815 const filterArray = filter; 31816 const paramsArray = params; 31817 31818 for (let i = 0, ii = filterArray.length; i < ii; ++i) { 31819 filter = this.xref.fetchIfRef(filterArray[i]); 31820 31821 if (!(0, _primitives.isName)(filter)) { 31822 throw new _util.FormatError(`Bad filter name "${filter}"`); 31823 } 31824 31825 params = null; 31826 31827 if (Array.isArray(paramsArray) && i in paramsArray) { 31828 params = this.xref.fetchIfRef(paramsArray[i]); 31829 } 31830 31831 stream = this.makeFilter(stream, filter.name, maybeLength, params); 31832 maybeLength = null; 31833 } 31834 } 31835 31836 return stream; 31837 } 31838 31839 makeFilter(stream, name, maybeLength, params) { 31840 if (maybeLength === 0) { 31841 (0, _util.warn)(`Empty "${name}" stream.`); 31842 return new _stream.NullStream(); 31843 } 31844 31845 try { 31846 const xrefStreamStats = this.xref.stats.streamTypes; 31847 31848 if (name === "FlateDecode" || name === "Fl") { 31849 xrefStreamStats[_util.StreamType.FLATE] = true; 31850 31851 if (params) { 31852 return new _stream.PredictorStream(new _stream.FlateStream(stream, maybeLength), maybeLength, params); 31853 } 31854 31855 return new _stream.FlateStream(stream, maybeLength); 31856 } 31857 31858 if (name === "LZWDecode" || name === "LZW") { 31859 xrefStreamStats[_util.StreamType.LZW] = true; 31860 let earlyChange = 1; 31861 31862 if (params) { 31863 if (params.has("EarlyChange")) { 31864 earlyChange = params.get("EarlyChange"); 31865 } 31866 31867 return new _stream.PredictorStream(new _stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params); 31868 } 31869 31870 return new _stream.LZWStream(stream, maybeLength, earlyChange); 31871 } 31872 31873 if (name === "DCTDecode" || name === "DCT") { 31874 xrefStreamStats[_util.StreamType.DCT] = true; 31875 return new _jpeg_stream.JpegStream(stream, maybeLength, stream.dict, params); 31876 } 31877 31878 if (name === "JPXDecode" || name === "JPX") { 31879 xrefStreamStats[_util.StreamType.JPX] = true; 31880 return new _jpx_stream.JpxStream(stream, maybeLength, stream.dict, params); 31881 } 31882 31883 if (name === "ASCII85Decode" || name === "A85") { 31884 xrefStreamStats[_util.StreamType.A85] = true; 31885 return new _stream.Ascii85Stream(stream, maybeLength); 31886 } 31887 31888 if (name === "ASCIIHexDecode" || name === "AHx") { 31889 xrefStreamStats[_util.StreamType.AHX] = true; 31890 return new _stream.AsciiHexStream(stream, maybeLength); 31891 } 31892 31893 if (name === "CCITTFaxDecode" || name === "CCF") { 31894 xrefStreamStats[_util.StreamType.CCF] = true; 31895 return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params); 31896 } 31897 31898 if (name === "RunLengthDecode" || name === "RL") { 31899 xrefStreamStats[_util.StreamType.RLX] = true; 31900 return new _stream.RunLengthStream(stream, maybeLength); 31901 } 31902 31903 if (name === "JBIG2Decode") { 31904 xrefStreamStats[_util.StreamType.JBIG] = true; 31905 return new _jbig2_stream.Jbig2Stream(stream, maybeLength, stream.dict, params); 31906 } 31907 31908 (0, _util.warn)(`Filter "${name}" is not supported.`); 31909 return stream; 31910 } catch (ex) { 31911 if (ex instanceof _core_utils.MissingDataException) { 31912 throw ex; 31913 } 31914 31915 (0, _util.warn)(`Invalid stream: "${ex}"`); 31916 return new _stream.NullStream(); 31917 } 31918 } 31919 31920} 31921 31922exports.Parser = Parser; 31923const 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]; 31924 31925function toHexDigit(ch) { 31926 if (ch >= 0x30 && ch <= 0x39) { 31927 return ch & 0x0f; 31928 } 31929 31930 if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) { 31931 return (ch & 0x0f) + 9; 31932 } 31933 31934 return -1; 31935} 31936 31937class Lexer { 31938 constructor(stream, knownCommands = null) { 31939 this.stream = stream; 31940 this.nextChar(); 31941 this.strBuf = []; 31942 this.knownCommands = knownCommands; 31943 this._hexStringNumWarn = 0; 31944 this.beginInlineImagePos = -1; 31945 } 31946 31947 nextChar() { 31948 return this.currentChar = this.stream.getByte(); 31949 } 31950 31951 peekChar() { 31952 return this.stream.peekByte(); 31953 } 31954 31955 getNumber() {
vendor: 11,075 bytes, lines 31956-32454
31956 let ch = this.currentChar; 31957 let eNotation = false; 31958 let divideBy = 0; 31959 let sign = 0; 31960 31961 if (ch === 0x2d) { 31962 sign = -1; 31963 ch = this.nextChar(); 31964 31965 if (ch === 0x2d) { 31966 ch = this.nextChar(); 31967 } 31968 } else if (ch === 0x2b) { 31969 sign = 1; 31970 ch = this.nextChar(); 31971 } 31972 31973 if (ch === 0x0a || ch === 0x0d) { 31974 do { 31975 ch = this.nextChar(); 31976 } while (ch === 0x0a || ch === 0x0d); 31977 } 31978 31979 if (ch === 0x2e) { 31980 divideBy = 10; 31981 ch = this.nextChar(); 31982 } 31983 31984 if (ch < 0x30 || ch > 0x39) { 31985 if (divideBy === 10 && sign === 0 && ((0, _core_utils.isWhiteSpace)(ch) || ch === -1)) { 31986 (0, _util.warn)("Lexer.getNumber - treating a single decimal point as zero."); 31987 return 0; 31988 } 31989 31990 throw new _util.FormatError(`Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`); 31991 } 31992 31993 sign = sign || 1; 31994 let baseValue = ch - 0x30; 31995 let powerValue = 0; 31996 let powerValueSign = 1; 31997 31998 while ((ch = this.nextChar()) >= 0) { 31999 if (ch >= 0x30 && ch <= 0x39) { 32000 const currentDigit = ch - 0x30; 32001 32002 if (eNotation) { 32003 powerValue = powerValue * 10 + currentDigit; 32004 } else { 32005 if (divideBy !== 0) { 32006 divideBy *= 10; 32007 } 32008 32009 baseValue = baseValue * 10 + currentDigit; 32010 } 32011 } else if (ch === 0x2e) { 32012 if (divideBy === 0) { 32013 divideBy = 1; 32014 } else { 32015 break; 32016 } 32017 } else if (ch === 0x2d) { 32018 (0, _util.warn)("Badly formatted number: minus sign in the middle"); 32019 } else if (ch === 0x45 || ch === 0x65) { 32020 ch = this.peekChar(); 32021 32022 if (ch === 0x2b || ch === 0x2d) { 32023 powerValueSign = ch === 0x2d ? -1 : 1; 32024 this.nextChar(); 32025 } else if (ch < 0x30 || ch > 0x39) { 32026 break; 32027 } 32028 32029 eNotation = true; 32030 } else { 32031 break; 32032 } 32033 } 32034 32035 if (divideBy !== 0) { 32036 baseValue /= divideBy; 32037 } 32038 32039 if (eNotation) { 32040 baseValue *= 10 ** (powerValueSign * powerValue); 32041 } 32042 32043 return sign * baseValue; 32044 } 32045 32046 getString() { 32047 let numParen = 1; 32048 let done = false; 32049 const strBuf = this.strBuf; 32050 strBuf.length = 0; 32051 let ch = this.nextChar(); 32052 32053 while (true) { 32054 let charBuffered = false; 32055 32056 switch (ch | 0) { 32057 case -1: 32058 (0, _util.warn)("Unterminated string"); 32059 done = true; 32060 break; 32061 32062 case 0x28: 32063 ++numParen; 32064 strBuf.push("("); 32065 break; 32066 32067 case 0x29: 32068 if (--numParen === 0) { 32069 this.nextChar(); 32070 done = true; 32071 } else { 32072 strBuf.push(")"); 32073 } 32074 32075 break; 32076 32077 case 0x5c: 32078 ch = this.nextChar(); 32079 32080 switch (ch) { 32081 case -1: 32082 (0, _util.warn)("Unterminated string"); 32083 done = true; 32084 break; 32085 32086 case 0x6e: 32087 strBuf.push("\n"); 32088 break; 32089 32090 case 0x72: 32091 strBuf.push("\r"); 32092 break; 32093 32094 case 0x74: 32095 strBuf.push("\t"); 32096 break; 32097 32098 case 0x62: 32099 strBuf.push("\b"); 32100 break; 32101 32102 case 0x66: 32103 strBuf.push("\f"); 32104 break; 32105 32106 case 0x5c: 32107 case 0x28: 32108 case 0x29: 32109 strBuf.push(String.fromCharCode(ch)); 32110 break; 32111 32112 case 0x30: 32113 case 0x31: 32114 case 0x32: 32115 case 0x33: 32116 case 0x34: 32117 case 0x35: 32118 case 0x36: 32119 case 0x37: 32120 let x = ch & 0x0f; 32121 ch = this.nextChar(); 32122 charBuffered = true; 32123 32124 if (ch >= 0x30 && ch <= 0x37) { 32125 x = (x << 3) + (ch & 0x0f); 32126 ch = this.nextChar(); 32127 32128 if (ch >= 0x30 && ch <= 0x37) { 32129 charBuffered = false; 32130 x = (x << 3) + (ch & 0x0f); 32131 } 32132 } 32133 32134 strBuf.push(String.fromCharCode(x)); 32135 break; 32136 32137 case 0x0d: 32138 if (this.peekChar() === 0x0a) { 32139 this.nextChar(); 32140 } 32141 32142 break; 32143 32144 case 0x0a: 32145 break; 32146 32147 default: 32148 strBuf.push(String.fromCharCode(ch)); 32149 break; 32150 } 32151 32152 break; 32153 32154 default: 32155 strBuf.push(String.fromCharCode(ch)); 32156 break; 32157 } 32158 32159 if (done) { 32160 break; 32161 } 32162 32163 if (!charBuffered) { 32164 ch = this.nextChar(); 32165 } 32166 } 32167 32168 return strBuf.join(""); 32169 } 32170 32171 getName() { 32172 let ch, previousCh; 32173 const strBuf = this.strBuf; 32174 strBuf.length = 0; 32175 32176 while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) { 32177 if (ch === 0x23) { 32178 ch = this.nextChar(); 32179 32180 if (specialChars[ch]) { 32181 (0, _util.warn)("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number."); 32182 strBuf.push("#"); 32183 break; 32184 } 32185 32186 const x = toHexDigit(ch); 32187 32188 if (x !== -1) { 32189 previousCh = ch; 32190 ch = this.nextChar(); 32191 const x2 = toHexDigit(ch); 32192 32193 if (x2 === -1) { 32194 (0, _util.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number."); 32195 strBuf.push("#", String.fromCharCode(previousCh)); 32196 32197 if (specialChars[ch]) { 32198 break; 32199 } 32200 32201 strBuf.push(String.fromCharCode(ch)); 32202 continue; 32203 } 32204 32205 strBuf.push(String.fromCharCode(x << 4 | x2)); 32206 } else { 32207 strBuf.push("#", String.fromCharCode(ch)); 32208 } 32209 } else { 32210 strBuf.push(String.fromCharCode(ch)); 32211 } 32212 } 32213 32214 if (strBuf.length > 127) { 32215 (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`); 32216 } 32217 32218 return _primitives.Name.get(strBuf.join("")); 32219 } 32220 32221 _hexStringWarn(ch) { 32222 const MAX_HEX_STRING_NUM_WARN = 5; 32223 32224 if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) { 32225 (0, _util.warn)("getHexString - ignoring additional invalid characters."); 32226 return; 32227 } 32228 32229 if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) { 32230 return; 32231 } 32232 32233 (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`); 32234 } 32235 32236 getHexString() { 32237 const strBuf = this.strBuf; 32238 strBuf.length = 0; 32239 let ch = this.currentChar; 32240 let isFirstHex = true; 32241 let firstDigit, secondDigit; 32242 this._hexStringNumWarn = 0; 32243 32244 while (true) { 32245 if (ch < 0) { 32246 (0, _util.warn)("Unterminated hex string"); 32247 break; 32248 } else if (ch === 0x3e) { 32249 this.nextChar(); 32250 break; 32251 } else if (specialChars[ch] === 1) { 32252 ch = this.nextChar(); 32253 continue; 32254 } else { 32255 if (isFirstHex) { 32256 firstDigit = toHexDigit(ch); 32257 32258 if (firstDigit === -1) { 32259 this._hexStringWarn(ch); 32260 32261 ch = this.nextChar(); 32262 continue; 32263 } 32264 } else { 32265 secondDigit = toHexDigit(ch); 32266 32267 if (secondDigit === -1) { 32268 this._hexStringWarn(ch); 32269 32270 ch = this.nextChar(); 32271 continue; 32272 } 32273 32274 strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit)); 32275 } 32276 32277 isFirstHex = !isFirstHex; 32278 ch = this.nextChar(); 32279 } 32280 } 32281 32282 return strBuf.join(""); 32283 } 32284 32285 getObj() { 32286 let comment = false; 32287 let ch = this.currentChar; 32288 32289 while (true) { 32290 if (ch < 0) { 32291 return _primitives.EOF; 32292 } 32293 32294 if (comment) { 32295 if (ch === 0x0a || ch === 0x0d) { 32296 comment = false; 32297 } 32298 } else if (ch === 0x25) { 32299 comment = true; 32300 } else if (specialChars[ch] !== 1) { 32301 break; 32302 } 32303 32304 ch = this.nextChar(); 32305 } 32306 32307 switch (ch | 0) { 32308 case 0x30: 32309 case 0x31: 32310 case 0x32: 32311 case 0x33: 32312 case 0x34: 32313 case 0x35: 32314 case 0x36: 32315 case 0x37: 32316 case 0x38: 32317 case 0x39: 32318 case 0x2b: 32319 case 0x2d: 32320 case 0x2e: 32321 return this.getNumber(); 32322 32323 case 0x28: 32324 return this.getString(); 32325 32326 case 0x2f: 32327 return this.getName(); 32328 32329 case 0x5b: 32330 this.nextChar(); 32331 return _primitives.Cmd.get("["); 32332 32333 case 0x5d: 32334 this.nextChar(); 32335 return _primitives.Cmd.get("]"); 32336 32337 case 0x3c: 32338 ch = this.nextChar(); 32339 32340 if (ch === 0x3c) { 32341 this.nextChar(); 32342 return _primitives.Cmd.get("<<"); 32343 } 32344 32345 return this.getHexString(); 32346 32347 case 0x3e: 32348 ch = this.nextChar(); 32349 32350 if (ch === 0x3e) { 32351 this.nextChar(); 32352 return _primitives.Cmd.get(">>"); 32353 } 32354 32355 return _primitives.Cmd.get(">"); 32356 32357 case 0x7b: 32358 this.nextChar(); 32359 return _primitives.Cmd.get("{"); 32360 32361 case 0x7d: 32362 this.nextChar(); 32363 return _primitives.Cmd.get("}"); 32364 32365 case 0x29: 32366 this.nextChar(); 32367 throw new _util.FormatError(`Illegal character: ${ch}`); 32368 } 32369 32370 let str = String.fromCharCode(ch); 32371 const knownCommands = this.knownCommands; 32372 let knownCommandFound = knownCommands && knownCommands[str] !== undefined; 32373 32374 while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) { 32375 const possibleCommand = str + String.fromCharCode(ch); 32376 32377 if (knownCommandFound && knownCommands[possibleCommand] === undefined) { 32378 break; 32379 } 32380 32381 if (str.length === 128) { 32382 throw new _util.FormatError(`Command token too long: ${str.length}`); 32383 } 32384 32385 str = possibleCommand; 32386 knownCommandFound = knownCommands && knownCommands[str] !== undefined; 32387 } 32388 32389 if (str === "true") { 32390 return true; 32391 } 32392 32393 if (str === "false") { 32394 return false; 32395 } 32396 32397 if (str === "null") { 32398 return null; 32399 } 32400 32401 if (str === "BI") { 32402 this.beginInlineImagePos = this.stream.pos; 32403 } 32404 32405 return _primitives.Cmd.get(str); 32406 } 32407 32408 skipToNextLine() { 32409 let ch = this.currentChar; 32410 32411 while (ch >= 0) { 32412 if (ch === 0x0d) { 32413 ch = this.nextChar(); 32414 32415 if (ch === 0x0a) { 32416 this.nextChar(); 32417 } 32418 32419 break; 32420 } else if (ch === 0x0a) { 32421 this.nextChar(); 32422 break; 32423 } 32424 32425 ch = this.nextChar(); 32426 } 32427 } 32428 32429} 32430 32431exports.Lexer = Lexer; 32432 32433class Linearization { 32434 static create(stream) { 32435 function getInt(linDict, name, allowZeroValue = false) { 32436 const obj = linDict.get(name); 32437 32438 if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) { 32439 return obj; 32440 } 32441 32442 throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid."); 32443 } 32444 32445 function getHints(linDict) { 32446 const hints = linDict.get("H"); 32447 let hintsLength; 32448 32449 if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) { 32450 for (let index = 0; index < hintsLength; index++) { 32451 const hint = hints[index]; 32452 32453 if (!(Number.isInteger(hint) && hint > 0)) { 32454 throw new Error(`Hint (${index}
32454) in the linearization dictionary is invalid.`); 32455 } 32456 } 32457 32458 return hints; 32459 } 32460 32461 throw new Error("Hint array in the linearization dictionary is invalid."); 32462 } 32463 32464 const parser = new Parser({ 32465 lexer: new Lexer(stream), 32466 xref: null 32467 }); 32468 const obj1 = parser.getObj(); 32469 const obj2 = parser.getObj(); 32470 const obj3 = parser.getObj(); 32471 const linDict = parser.getObj(); 32472 let obj, length; 32473 32474 if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && (0, _primitives.isCmd)(obj3, "obj") && (0, _primitives.isDict)(linDict) && (0, _util.isNum)(obj = linDict.get("Linearized")) && obj > 0)) { 32475 return null; 32476 } else if ((length = getInt(linDict, "L")) !== stream.length) { 32477 throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length."); 32478 } 32479 32480 return { 32481 length, 32482 hints: getHints(linDict), 32483 objectNumberFirst: getInt(linDict, "O"), 32484 endFirst: getInt(linDict, "E"), 32485 numPages: getInt(linDict, "N"), 32486 mainXRefEntriesOffset: getInt(linDict, "T"), 32487 pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0 32488 }; 32489 } 32490 32491} 32492 32493exports.Linearization = Linearization; 32494 32495/***/ }), 32496/* 11 */ 32497/***/ (function(module, exports, __w_pdfjs_require__) { 32498 32499"use strict"; 32500 32501 32502Object.defineProperty(exports, "__esModule", { 32503 value: true 32504}); 32505exports.LZWStream = exports.StringStream = exports.StreamsSequenceStream = exports.Stream = exports.RunLengthStream = exports.PredictorStream = exports.NullStream = exports.FlateStream = exports.DecodeStream = exports.DecryptStream = exports.AsciiHexStream = exports.Ascii85Stream = void 0; 32506 32507var _util = __w_pdfjs_require__(2); 32508 32509var _primitives = __w_pdfjs_require__(4); 32510 32511var _core_utils = __w_pdfjs_require__(7); 32512 32513var Stream = function StreamClosure() { 32514 function Stream(arrayBuffer, start, length, dict) { 32515 this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer); 32516 this.start = start || 0; 32517 this.pos = this.start; 32518 this.end = start + length || this.bytes.length; 32519 this.dict = dict; 32520 } 32521 32522 Stream.prototype = { 32523 get length() { 32524 return this.end - this.start; 32525 }, 32526 32527 get isEmpty() { 32528 return this.length === 0; 32529 }, 32530 32531 getByte: function Stream_getByte() { 32532 if (this.pos >= this.end) { 32533 return -1; 32534 } 32535 32536 return this.bytes[this.pos++]; 32537 }, 32538 getUint16: function Stream_getUint16() { 32539 var b0 = this.getByte(); 32540 var b1 = this.getByte(); 32541 32542 if (b0 === -1 || b1 === -1) { 32543 return -1; 32544 } 32545 32546 return (b0 << 8) + b1; 32547 }, 32548 getInt32: function Stream_getInt32() { 32549 var b0 = this.getByte(); 32550 var b1 = this.getByte(); 32551 var b2 = this.getByte(); 32552 var b3 = this.getByte(); 32553 return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3; 32554 }, 32555 32556 getBytes(length, forceClamped = false) { 32557 var bytes = this.bytes; 32558 var pos = this.pos; 32559 var strEnd = this.end; 32560 32561 if (!length) { 32562 const subarray = bytes.subarray(pos, strEnd); 32563 return forceClamped ? new Uint8ClampedArray(subarray) : subarray; 32564 } 32565 32566 var end = pos + length; 32567 32568 if (end > strEnd) { 32569 end = strEnd; 32570 } 32571 32572 this.pos = end; 32573 const subarray = bytes.subarray(pos, end); 32574 return forceClamped ? new Uint8ClampedArray(subarray) : subarray; 32575 }, 32576 32577 peekByte: function Stream_peekByte() { 32578 var peekedByte = this.getByte(); 32579 32580 if (peekedByte !== -1) { 32581 this.pos--; 32582 } 32583 32584 return peekedByte; 32585 }, 32586 32587 peekBytes(length, forceClamped = false) { 32588 var bytes = this.getBytes(length, forceClamped); 32589 this.pos -= bytes.length; 32590 return bytes; 32591 }, 32592 32593 getByteRange(begin, end) { 32594 if (begin < 0) { 32595 begin = 0; 32596 } 32597 32598 if (end > this.end) { 32599 end = this.end; 32600 } 32601 32602 return this.bytes.subarray(begin, end); 32603 }, 32604 32605 skip: function Stream_skip(n) { 32606 if (!n) { 32607 n = 1; 32608 } 32609 32610 this.pos += n; 32611 }, 32612 reset: function Stream_reset() { 32613 this.pos = this.start; 32614 }, 32615 moveStart: function Stream_moveStart() { 32616 this.start = this.pos; 32617 }, 32618 makeSubStream: function Stream_makeSubStream(start, length, dict) { 32619 return new Stream(this.bytes.buffer, start, length, dict); 32620 } 32621 }; 32622 return Stream; 32623}(); 32624 32625exports.Stream = Stream; 32626 32627var StringStream = function StringStreamClosure() { 32628 function StringStream(str) { 32629 const bytes = (0, _util.stringToBytes)(str); 32630 Stream.call(this, bytes); 32631 } 32632 32633 StringStream.prototype = Stream.prototype; 32634 return StringStream; 32635}(); 32636 32637exports.StringStream = StringStream; 32638 32639var DecodeStream = function DecodeStreamClosure() { 32640 var emptyBuffer = new Uint8Array(0); 32641 32642 function DecodeStream(maybeMinBufferLength) { 32643 this._rawMinBufferLength = maybeMinBufferLength || 0; 32644 this.pos = 0; 32645 this.bufferLength = 0; 32646 this.eof = false;
32647 this.buffer = emptyBuffer; 32648 this.minBufferLength = 512; 32649 32650 if (maybeMinBufferLength) { 32651 while (this.minBufferLength < maybeMinBufferLength) { 32652 this.minBufferLength *= 2; 32653 } 32654 } 32655 } 32656 32657 DecodeStream.prototype = { 32658 get isEmpty() { 32659 while (!this.eof && this.bufferLength === 0) { 32660 this.readBlock(); 32661 } 32662 32663 return this.bufferLength === 0; 32664 }, 32665 32666 ensureBuffer: function DecodeStream_ensureBuffer(requested) { 32667 var buffer = this.buffer; 32668 32669 if (requested <= buffer.byteLength) { 32670 return buffer; 32671 } 32672 32673 var size = this.minBufferLength; 32674 32675 while (size < requested) { 32676 size *= 2; 32677 } 32678 32679 var buffer2 = new Uint8Array(size); 32680 buffer2.set(buffer); 32681 return this.buffer = buffer2; 32682 }, 32683 getByte: function DecodeStream_getByte() { 32684 var pos = this.pos; 32685 32686 while (this.bufferLength <= pos) { 32687 if (this.eof) { 32688 return -1; 32689 } 32690 32691 this.readBlock(); 32692 } 32693 32694 return this.buffer[this.pos++]; 32695 }, 32696 getUint16: function DecodeStream_getUint16() { 32697 var b0 = this.getByte(); 32698 var b1 = this.getByte(); 32699 32700 if (b0 === -1 || b1 === -1) { 32701 return -1; 32702 } 32703 32704 return (b0 << 8) + b1; 32705 }, 32706 getInt32: function DecodeStream_getInt32() { 32707 var b0 = this.getByte(); 32708 var b1 = this.getByte(); 32709 var b2 = this.getByte(); 32710 var b3 = this.getByte(); 32711 return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3; 32712 }, 32713 32714 getBytes(length, forceClamped = false) { 32715 var end, 32716 pos = this.pos; 32717 32718 if (length) { 32719 this.ensureBuffer(pos + length); 32720 end = pos + length; 32721 32722 while (!this.eof && this.bufferLength < end) { 32723 this.readBlock(); 32724 } 32725 32726 var bufEnd = this.bufferLength; 32727 32728 if (end > bufEnd) { 32729 end = bufEnd; 32730 } 32731 } else { 32732 while (!this.eof) { 32733 this.readBlock(); 32734 } 32735 32736 end = this.bufferLength; 32737 } 32738 32739 this.pos = end; 32740 const subarray = this.buffer.subarray(pos, end); 32741 return forceClamped && !(subarray instanceof Uint8ClampedArray) ? new Uint8ClampedArray(subarray) : subarray; 32742 }, 32743 32744 peekByte: function DecodeStream_peekByte() { 32745 var peekedByte = this.getByte(); 32746 32747 if (peekedByte !== -1) { 32748 this.pos--; 32749 } 32750 32751 return peekedByte; 32752 }, 32753 32754 peekBytes(length, forceClamped = false) { 32755 var bytes = this.getBytes(length, forceClamped); 32756 this.pos -= bytes.length; 32757 return bytes; 32758 }, 32759 32760 makeSubStream: function DecodeStream_makeSubStream(start, length, dict) { 32761 var end = start + length; 32762 32763 while (this.bufferLength <= end && !this.eof) { 32764 this.readBlock(); 32765 } 32766 32767 return new Stream(this.buffer, start, length, dict); 32768 }, 32769 32770 getByteRange(begin, end) { 32771 (0, _util.unreachable)("Should not call DecodeStream.getByteRange"); 32772 }, 32773 32774 skip: function DecodeStream_skip(n) { 32775 if (!n) { 32776 n = 1; 32777 } 32778 32779 this.pos += n; 32780 }, 32781 reset: function DecodeStream_reset() { 32782 this.pos = 0; 32783 }, 32784 getBaseStreams: function DecodeStream_getBaseStreams() { 32785 if (this.str && this.str.getBaseStreams) { 32786 return this.str.getBaseStreams(); 32787 } 32788 32789 return []; 32790 } 32791 }; 32792 return DecodeStream; 32793}(); 32794 32795exports.DecodeStream = DecodeStream; 32796 32797var StreamsSequenceStream = function StreamsSequenceStreamClosure() { 32798 function StreamsSequenceStream(streams) { 32799 this.streams = streams; 32800 let maybeLength = 0; 32801 32802 for (let i = 0, ii = streams.length; i < ii; i++) { 32803 const stream = streams[i]; 32804 32805 if (stream instanceof DecodeStream) { 32806 maybeLength += stream._rawMinBufferLength; 32807 } else { 32808 maybeLength += stream.length; 32809 } 32810 } 32811 32812 DecodeStream.call(this, maybeLength); 32813 } 32814 32815 StreamsSequenceStream.prototype = Object.create(DecodeStream.prototype); 32816 32817 StreamsSequenceStream.prototype.readBlock = function streamSequenceStreamReadBlock() { 32818 var streams = this.streams; 32819 32820 if (streams.length === 0) { 32821 this.eof = true; 32822 return; 32823 } 32824 32825 var stream = streams.shift(); 32826 var chunk = stream.getBytes(); 32827 var bufferLength = this.bufferLength; 32828 var newLength = bufferLength + chunk.length; 32829 var buffer = this.ensureBuffer(newLength); 32830 buffer.set(chunk, bufferLength); 32831 this.bufferLength = newLength; 32832 }; 32833 32834 StreamsSequenceStream.prototype.getBaseStreams = function StreamsSequenceStream_getBaseStreams() { 32835 var baseStreams = []; 32836 32837 for (var i = 0, ii = this.streams.length; i < ii; i++) { 32838 var stream = this.streams[i]; 32839 32840 if (stream.getBaseStreams) { 32841 baseStreams.push(...stream.getBaseStreams()); 32842 } 32843 } 32844 32845 return baseStreams; 32846 }; 32847 32848 return StreamsSequenceStream; 32849}(); 32850 32851exports.StreamsSequenceStream = StreamsSequenceStream; 32852 32853var FlateStream = function FlateStreamClosure() { 32854 var codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]); 32855 var lengthDecode = new Int32Array([0x00003, 0x00004, 0x00005, 0x00006, 0x00007, 0x00008, 0x00009, 0x0000a, 0x1000b, 0x1000d, 0x1000f, 0x10011, 0x20013, 0x20017, 0x2001b, 0x2001f, 0x30023, 0x3002b, 0x30033, 0x3003b, 0x40043, 0x40053, 0x40063, 0x40073, 0x50083, 0x500a3, 0x500c3, 0x500e3, 0x00102, 0x00102, 0x00102]); 32856 var distDecode = new Int32Array([0x00001, 0x00002, 0x00003, 0x00004, 0x10005, 0x10007, 0x20009, 0x2000d, 0x30011, 0x30019, 0x40021, 0x40031, 0x50041, 0x50061, 0x60081, 0x600c1, 0x70101, 0x70181, 0x80201, 0x80301, 0x90401, 0x90601, 0xa0801, 0xa0c01, 0xb1001, 0xb1801, 0xc2001, 0xc3001, 0xd4001, 0xd6001]);
32857 var fixedLitCodeTab = [new Int32Array([0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c0, 0x70108, 0x80060, 0x80020, 0x900a0, 0x80000, 0x80080, 0x80040, 0x900e0, 0x70104, 0x80058, 0x80018, 0x90090, 0x70114, 0x80078, 0x80038, 0x900d0, 0x7010c, 0x80068, 0x80028, 0x900b0, 0x80008, 0x80088, 0x80048, 0x900f0, 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c8, 0x7010a, 0x80064, 0x80024, 0x900a8, 0x80004, 0x80084, 0x80044, 0x900e8, 0x70106, 0x8005c, 0x8001c, 0x90098, 0x70116, 0x8007c, 0x8003c, 0x900d8, 0x7010e, 0x8006c, 0x8002c, 0x900b8, 0x8000c, 0x8008c, 0x8004c, 0x900f8, 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c4, 0x70109, 0x80062, 0x80022, 0x900a4, 0x80002, 0x80082, 0x80042, 0x900e4, 0x70105, 0x8005a, 0x8001a, 0x90094, 0x70115, 0x8007a, 0x8003a, 0x900d4, 0x7010d, 0x8006a, 0x8002a, 0x900b4, 0x8000a, 0x8008a, 0x8004a, 0x900f4, 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cc, 0x7010b, 0x80066, 0x80026, 0x900ac, 0x80006, 0x80086, 0x80046, 0x900ec, 0x70107, 0x8005e, 0x8001e, 0x9009c, 0x70117, 0x8007e, 0x8003e, 0x900dc, 0x7010f, 0x8006e, 0x8002e, 0x900bc, 0x8000e, 0x8008e, 0x8004e, 0x900fc, 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c2, 0x70108, 0x80061, 0x80021, 0x900a2, 0x80001, 0x80081, 0x80041, 0x900e2, 0x70104, 0x80059, 0x80019, 0x90092, 0x70114, 0x80079, 0x80039, 0x900d2, 0x7010c, 0x80069, 0x80029, 0x900b2, 0x80009, 0x80089, 0x80049, 0x900f2, 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900ca, 0x7010a, 0x80065, 0x80025, 0x900aa, 0x80005, 0x80085, 0x80045, 0x900ea, 0x70106, 0x8005d, 0x8001d, 0x9009a, 0x70116, 0x8007d, 0x8003d, 0x900da, 0x7010e, 0x8006d, 0x8002d, 0x900ba, 0x8000d, 0x8008d, 0x8004d, 0x900fa, 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c6, 0x70109, 0x80063, 0x80023, 0x900a6, 0x80003, 0x80083, 0x80043, 0x900e6, 0x70105, 0x8005b, 0x8001b, 0x90096, 0x70115, 0x8007b, 0x8003b, 0x900d6, 0x7010d, 0x8006b, 0x8002b, 0x900b6, 0x8000b, 0x8008b, 0x8004b, 0x900f6, 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900ce, 0x7010b, 0x80067, 0x80027, 0x900ae, 0x80007, 0x80087, 0x80047, 0x900ee, 0x70107, 0x8005f, 0x8001f, 0x9009e, 0x70117, 0x8007f, 0x8003f, 0x900de, 0x7010f, 0x8006f, 0x8002f, 0x900be, 0x8000f, 0x8008f, 0x8004f, 0x900fe, 0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c1, 0x70108, 0x80060, 0x80020, 0x900a1, 0x80000, 0x80080, 0x80040, 0x900e1, 0x70104, 0x80058, 0x80018, 0x90091, 0x70114, 0x80078, 0x80038, 0x900d1, 0x7010c, 0x80068, 0x80028, 0x900b1, 0x80008, 0x80088, 0x80048, 0x900f1, 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c9, 0x7010a, 0x80064, 0x80024, 0x900a9, 0x80004, 0x80084, 0x80044, 0x900e9, 0x70106, 0x8005c, 0x8001c, 0x90099, 0x70116, 0x8007c, 0x8003c, 0x900d9, 0x7010e, 0x8006c, 0x8002c, 0x900b9, 0x8000c, 0x8008c, 0x8004c, 0x900f9, 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c5, 0x70109, 0x80062, 0x80022, 0x900a5, 0x80002, 0x80082, 0x80042, 0x900e5, 0x70105, 0x8005a, 0x8001a, 0x90095, 0x70115, 0x8007a, 0x8003a, 0x900d5, 0x7010d, 0x8006a, 0x8002a, 0x900b5, 0x8000a, 0x8008a, 0x8004a, 0x900f5, 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cd, 0x7010b, 0x80066, 0x80026, 0x900ad, 0x80006, 0x80086, 0x80046, 0x900ed, 0x70107, 0x8005e, 0x8001e, 0x9009d, 0x70117, 0x8007e, 0x8003e, 0x900dd, 0x7010f, 0x8006e, 0x8002e, 0x900bd, 0x8000e, 0x8008e, 0x8004e, 0x900fd, 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c3, 0x70108, 0x80061, 0x80021, 0x900a3, 0x80001, 0x80081, 0x80041, 0x900e3, 0x70104, 0x80059, 0x80019, 0x90093, 0x70114, 0x80079, 0x80039, 0x900d3, 0x7010c, 0x80069, 0x80029, 0x900b3, 0x80009, 0x80089, 0x80049, 0x900f3, 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900cb, 0x7010a, 0x80065, 0x80025, 0x900ab, 0x80005, 0x80085, 0x80045, 0x900eb, 0x70106, 0x8005d, 0x8001d, 0x9009b, 0x70116, 0x8007d, 0x8003d, 0x900db, 0x7010e, 0x8006d, 0x8002d, 0x900bb, 0x8000d, 0x8008d, 0x8004d, 0x900fb, 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c7, 0x70109, 0x80063, 0x80023, 0x900a7, 0x80003, 0x80083, 0x80043, 0x900e7, 0x70105, 0x8005b, 0x8001b, 0x90097, 0x70115, 0x8007b, 0x8003b, 0x900d7, 0x7010d, 0x8006b, 0x8002b, 0x900b7, 0x8000b, 0x8008b, 0x8004b,
328570x900f7, 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]; 32858 var fixedDistCodeTab = [new Int32Array([0x50000, 0x50010, 0x50008, 0x50018, 0x50004, 0x50014, 0x5000c, 0x5001c, 0x50002, 0x50012, 0x5000a, 0x5001a, 0x50006, 0x50016, 0x5000e, 0x00000, 0x50001, 0x50011, 0x50009, 0x50019, 0x50005, 0x50015, 0x5000d, 0x5001d, 0x50003, 0x50013, 0x5000b, 0x5001b, 0x50007, 0x50017, 0x5000f, 0x00000]), 5]; 32859 32860 function FlateStream(str, maybeLength) { 32861 this.str = str; 32862 this.dict = str.dict; 32863 var cmf = str.getByte(); 32864 var flg = str.getByte(); 32865 32866 if (cmf === -1 || flg === -1) { 32867 throw new _util.FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`); 32868 } 32869 32870 if ((cmf & 0x0f) !== 0x08) { 32871 throw new _util.FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`); 32872 } 32873 32874 if (((cmf << 8) + flg) % 31 !== 0) { 32875 throw new _util.FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`); 32876 } 32877 32878 if (flg & 0x20) { 32879 throw new _util.FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`); 32880 } 32881 32882 this.codeSize = 0; 32883 this.codeBuf = 0; 32884 DecodeStream.call(this, maybeLength); 32885 } 32886 32887 FlateStream.prototype = Object.create(DecodeStream.prototype); 32888 32889 FlateStream.prototype.getBits = function FlateStream_getBits(bits) { 32890 var str = this.str; 32891 var codeSize = this.codeSize; 32892 var codeBuf = this.codeBuf; 32893 var b; 32894 32895 while (codeSize < bits) { 32896 if ((b = str.getByte()) === -1) { 32897 throw new _util.FormatError("Bad encoding in flate stream"); 32898 } 32899 32900 codeBuf |= b << codeSize; 32901 codeSize += 8; 32902 } 32903 32904 b = codeBuf & (1 << bits) - 1; 32905 this.codeBuf = codeBuf >> bits; 32906 this.codeSize = codeSize -= bits; 32907 return b; 32908 }; 32909 32910 FlateStream.prototype.getCode = function FlateStream_getCode(table) { 32911 var str = this.str; 32912 var codes = table[0]; 32913 var maxLen = table[1]; 32914 var codeSize = this.codeSize; 32915 var codeBuf = this.codeBuf; 32916 var b; 32917 32918 while (codeSize < maxLen) { 32919 if ((b = str.getByte()) === -1) { 32920 break; 32921 } 32922 32923 codeBuf |= b << codeSize; 32924 codeSize += 8; 32925 } 32926 32927 var code = codes[codeBuf & (1 << maxLen) - 1]; 32928 var codeLen = code >> 16; 32929 var codeVal = code & 0xffff; 32930 32931 if (codeLen < 1 || codeSize < codeLen) { 32932 throw new _util.FormatError("Bad encoding in flate stream"); 32933 } 32934 32935 this.codeBuf = codeBuf >> codeLen; 32936 this.codeSize = codeSize - codeLen; 32937 return codeVal; 32938 }; 32939 32940 FlateStream.prototype.generateHuffmanTable = function flateStreamGenerateHuffmanTable(lengths) { 32941 var n = lengths.length; 32942 var maxLen = 0; 32943 var i; 32944 32945 for (i = 0; i < n; ++i) { 32946 if (lengths[i] > maxLen) { 32947 maxLen = lengths[i]; 32948 } 32949 } 32950 32951 var size = 1 << maxLen; 32952 var codes = new Int32Array(size); 32953 32954 for (var len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) { 32955 for (var val = 0; val < n; ++val) { 32956 if (lengths[val] === len) { 32957 var code2 = 0; 32958 var t = code; 32959 32960 for (i = 0; i < len; ++i) { 32961 code2 = code2 << 1 | t & 1; 32962 t >>= 1; 32963 } 32964 32965 for (i = code2; i < size; i += skip) { 32966 codes[i] = len << 16 | val; 32967 } 32968 32969 ++code; 32970 } 32971 } 32972 } 32973 32974 return [codes, maxLen]; 32975 }; 32976 32977 FlateStream.prototype.readBlock = function FlateStream_readBlock() { 32978 var buffer, len; 32979 var str = this.str; 32980 var hdr = this.getBits(3); 32981 32982 if (hdr & 1) { 32983 this.eof = true; 32984 } 32985 32986 hdr >>= 1; 32987 32988 if (hdr === 0) { 32989 var b; 32990 32991 if ((b = str.getByte()) === -1) { 32992 throw new _util.FormatError("Bad block header in flate stream"); 32993 } 32994 32995 var blockLen = b; 32996 32997 if ((b = str.getByte()) === -1) { 32998 throw new _util.FormatError("Bad block header in flate stream"); 32999 } 33000 33001 blockLen |= b << 8; 33002 33003 if ((b = str.getByte()) === -1) { 33004 throw new _util.FormatError("Bad block header in flate stream"); 33005 } 33006 33007 var check = b; 33008 33009 if ((b = str.getByte()) === -1) { 33010 throw new _util.FormatError("Bad block header in flate stream"); 33011 } 33012 33013 check |= b << 8; 33014 33015 if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) { 33016 throw new _util.FormatError("Bad uncompressed block length in flate stream"); 33017 } 33018 33019 this.codeBuf = 0; 33020 this.codeSize = 0; 33021 const bufferLength = this.bufferLength, 33022 end = bufferLength + blockLen; 33023 buffer = this.ensureBuffer(end); 33024 this.bufferLength = end; 33025 33026 if (blockLen === 0) { 33027 if (str.peekByte() === -1) { 33028 this.eof = true; 33029 } 33030 } else { 33031 const block = str.getBytes(blockLen); 33032 buffer.set(block, bufferLength); 33033 33034 if (block.length < blockLen) { 33035 this.eof = true; 33036 } 33037 } 33038 33039 return; 33040 } 33041 33042 var litCodeTable; 33043 var distCodeTable; 33044 33045 if (hdr === 1) {
33046 litCodeTable = fixedLitCodeTab; 33047 distCodeTable = fixedDistCodeTab; 33048 } else if (hdr === 2) { 33049 var numLitCodes = this.getBits(5) + 257; 33050 var numDistCodes = this.getBits(5) + 1; 33051 var numCodeLenCodes = this.getBits(4) + 4; 33052 var codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length); 33053 var i; 33054 33055 for (i = 0; i < numCodeLenCodes; ++i) { 33056 codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3); 33057 } 33058 33059 var codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths); 33060 len = 0; 33061 i = 0; 33062 var codes = numLitCodes + numDistCodes; 33063 var codeLengths = new Uint8Array(codes); 33064 var bitsLength, bitsOffset, what; 33065 33066 while (i < codes) { 33067 var code = this.getCode(codeLenCodeTab); 33068 33069 if (code === 16) { 33070 bitsLength = 2; 33071 bitsOffset = 3; 33072 what = len; 33073 } else if (code === 17) { 33074 bitsLength = 3; 33075 bitsOffset = 3; 33076 what = len = 0; 33077 } else if (code === 18) { 33078 bitsLength = 7; 33079 bitsOffset = 11; 33080 what = len = 0; 33081 } else { 33082 codeLengths[i++] = len = code; 33083 continue; 33084 } 33085 33086 var repeatLength = this.getBits(bitsLength) + bitsOffset; 33087 33088 while (repeatLength-- > 0) { 33089 codeLengths[i++] = what; 33090 } 33091 } 33092 33093 litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes)); 33094 distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes)); 33095 } else { 33096 throw new _util.FormatError("Unknown block type in flate stream"); 33097 } 33098 33099 buffer = this.buffer; 33100 var limit = buffer ? buffer.length : 0; 33101 var pos = this.bufferLength; 33102 33103 while (true) { 33104 var code1 = this.getCode(litCodeTable); 33105 33106 if (code1 < 256) { 33107 if (pos + 1 >= limit) { 33108 buffer = this.ensureBuffer(pos + 1); 33109 limit = buffer.length; 33110 } 33111 33112 buffer[pos++] = code1; 33113 continue; 33114 } 33115 33116 if (code1 === 256) { 33117 this.bufferLength = pos; 33118 return; 33119 } 33120 33121 code1 -= 257; 33122 code1 = lengthDecode[code1]; 33123 var code2 = code1 >> 16; 33124 33125 if (code2 > 0) { 33126 code2 = this.getBits(code2); 33127 } 33128 33129 len = (code1 & 0xffff) + code2; 33130 code1 = this.getCode(distCodeTable); 33131 code1 = distDecode[code1]; 33132 code2 = code1 >> 16; 33133 33134 if (code2 > 0) { 33135 code2 = this.getBits(code2); 33136 } 33137 33138 var dist = (code1 & 0xffff) + code2; 33139 33140 if (pos + len >= limit) { 33141 buffer = this.ensureBuffer(pos + len); 33142 limit = buffer.length; 33143 } 33144 33145 for (var k = 0; k < len; ++k, ++pos) { 33146 buffer[pos] = buffer[pos - dist]; 33147 } 33148 } 33149 }; 33150 33151 return FlateStream; 33152}(); 33153 33154exports.FlateStream = FlateStream; 33155 33156var PredictorStream = function PredictorStreamClosure() { 33157 function PredictorStream(str, maybeLength, params) { 33158 if (!(0, _primitives.isDict)(params)) { 33159 return str; 33160 } 33161 33162 var predictor = this.predictor = params.get("Predictor") || 1; 33163 33164 if (predictor <= 1) { 33165 return str; 33166 } 33167 33168 if (predictor !== 2 && (predictor < 10 || predictor > 15)) { 33169 throw new _util.FormatError(`Unsupported predictor: ${predictor}`); 33170 } 33171 33172 if (predictor === 2) { 33173 this.readBlock = this.readBlockTiff; 33174 } else { 33175 this.readBlock = this.readBlockPng; 33176 } 33177 33178 this.str = str; 33179 this.dict = str.dict; 33180 var colors = this.colors = params.get("Colors") || 1; 33181 var bits = this.bits = params.get("BitsPerComponent") || 8; 33182 var columns = this.columns = params.get("Columns") || 1; 33183 this.pixBytes = colors * bits + 7 >> 3; 33184 this.rowBytes = columns * colors * bits + 7 >> 3; 33185 DecodeStream.call(this, maybeLength); 33186 return this; 33187 } 33188 33189 PredictorStream.prototype = Object.create(DecodeStream.prototype); 33190 33191 PredictorStream.prototype.readBlockTiff = function predictorStreamReadBlockTiff() { 33192 var rowBytes = this.rowBytes; 33193 var bufferLength = this.bufferLength; 33194 var buffer = this.ensureBuffer(bufferLength + rowBytes); 33195 var bits = this.bits; 33196 var colors = this.colors; 33197 var rawBytes = this.str.getBytes(rowBytes); 33198 this.eof = !rawBytes.length; 33199 33200 if (this.eof) { 33201 return; 33202 } 33203 33204 var inbuf = 0, 33205 outbuf = 0; 33206 var inbits = 0, 33207 outbits = 0; 33208 var pos = bufferLength; 33209 var i; 33210 33211 if (bits === 1 && colors === 1) { 33212 for (i = 0; i < rowBytes; ++i) { 33213 var c = rawBytes[i] ^ inbuf; 33214 c ^= c >> 1; 33215 c ^= c >> 2; 33216 c ^= c >> 4; 33217 inbuf = (c & 1) << 7; 33218 buffer[pos++] = c; 33219 } 33220 } else if (bits === 8) { 33221 for (i = 0; i < colors; ++i) { 33222 buffer[pos++] = rawBytes[i]; 33223 } 33224 33225 for (; i < rowBytes; ++i) { 33226 buffer[pos] = buffer[pos - colors] + rawBytes[i]; 33227 pos++; 33228 } 33229 } else if (bits === 16) { 33230 var bytesPerPixel = colors * 2; 33231 33232 for (i = 0; i < bytesPerPixel; ++i) { 33233 buffer[pos++] = rawBytes[i]; 33234 } 33235 33236 for (; i < rowBytes; i += 2) { 33237 var sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff); 33238 buffer[pos++] = sum >> 8 & 0xff; 33239 buffer[pos++] = sum & 0xff; 33240 } 33241 } else { 33242 var compArray = new Uint8Array(colors + 1); 33243 var bitMask = (1 << bits) - 1; 33244 var j = 0, 33245 k = bufferLength; 33246 var columns = this.columns; 33247 33248 for (i = 0; i < columns; ++i) { 33249 for (var kk = 0; kk < colors; ++kk) { 33250 if (inbits < bits) { 33251 inbuf = inbuf << 8 | rawBytes[j++] & 0xff;
vendor: 11,429 bytes, lines 33252-33728
33252 inbits += 8; 33253 } 33254 33255 compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask; 33256 inbits -= bits; 33257 outbuf = outbuf << bits | compArray[kk]; 33258 outbits += bits; 33259 33260 if (outbits >= 8) { 33261 buffer[k++] = outbuf >> outbits - 8 & 0xff; 33262 outbits -= 8; 33263 } 33264 } 33265 } 33266 33267 if (outbits > 0) { 33268 buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1); 33269 } 33270 } 33271 33272 this.bufferLength += rowBytes; 33273 }; 33274 33275 PredictorStream.prototype.readBlockPng = function predictorStreamReadBlockPng() { 33276 var rowBytes = this.rowBytes; 33277 var pixBytes = this.pixBytes; 33278 var predictor = this.str.getByte(); 33279 var rawBytes = this.str.getBytes(rowBytes); 33280 this.eof = !rawBytes.length; 33281 33282 if (this.eof) { 33283 return; 33284 } 33285 33286 var bufferLength = this.bufferLength; 33287 var buffer = this.ensureBuffer(bufferLength + rowBytes); 33288 var prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength); 33289 33290 if (prevRow.length === 0) { 33291 prevRow = new Uint8Array(rowBytes); 33292 } 33293 33294 var i, 33295 j = bufferLength, 33296 up, 33297 c; 33298 33299 switch (predictor) { 33300 case 0: 33301 for (i = 0; i < rowBytes; ++i) { 33302 buffer[j++] = rawBytes[i]; 33303 } 33304 33305 break; 33306 33307 case 1: 33308 for (i = 0; i < pixBytes; ++i) { 33309 buffer[j++] = rawBytes[i]; 33310 } 33311 33312 for (; i < rowBytes; ++i) { 33313 buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff; 33314 j++; 33315 } 33316 33317 break; 33318 33319 case 2: 33320 for (i = 0; i < rowBytes; ++i) { 33321 buffer[j++] = prevRow[i] + rawBytes[i] & 0xff; 33322 } 33323 33324 break; 33325 33326 case 3: 33327 for (i = 0; i < pixBytes; ++i) { 33328 buffer[j++] = (prevRow[i] >> 1) + rawBytes[i]; 33329 } 33330 33331 for (; i < rowBytes; ++i) { 33332 buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff; 33333 j++; 33334 } 33335 33336 break; 33337 33338 case 4: 33339 for (i = 0; i < pixBytes; ++i) { 33340 up = prevRow[i]; 33341 c = rawBytes[i]; 33342 buffer[j++] = up + c; 33343 } 33344 33345 for (; i < rowBytes; ++i) { 33346 up = prevRow[i]; 33347 var upLeft = prevRow[i - pixBytes]; 33348 var left = buffer[j - pixBytes]; 33349 var p = left + up - upLeft; 33350 var pa = p - left; 33351 33352 if (pa < 0) { 33353 pa = -pa; 33354 } 33355 33356 var pb = p - up; 33357 33358 if (pb < 0) { 33359 pb = -pb; 33360 } 33361 33362 var pc = p - upLeft; 33363 33364 if (pc < 0) { 33365 pc = -pc; 33366 } 33367 33368 c = rawBytes[i]; 33369 33370 if (pa <= pb && pa <= pc) { 33371 buffer[j++] = left + c; 33372 } else if (pb <= pc) { 33373 buffer[j++] = up + c; 33374 } else { 33375 buffer[j++] = upLeft + c; 33376 } 33377 } 33378 33379 break; 33380 33381 default: 33382 throw new _util.FormatError(`Unsupported predictor: ${predictor}`); 33383 } 33384 33385 this.bufferLength += rowBytes; 33386 }; 33387 33388 return PredictorStream; 33389}(); 33390 33391exports.PredictorStream = PredictorStream; 33392 33393var DecryptStream = function DecryptStreamClosure() { 33394 function DecryptStream(str, maybeLength, decrypt) { 33395 this.str = str; 33396 this.dict = str.dict; 33397 this.decrypt = decrypt; 33398 this.nextChunk = null; 33399 this.initialized = false; 33400 DecodeStream.call(this, maybeLength); 33401 } 33402 33403 var chunkSize = 512; 33404 DecryptStream.prototype = Object.create(DecodeStream.prototype); 33405 33406 DecryptStream.prototype.readBlock = function DecryptStream_readBlock() { 33407 var chunk; 33408 33409 if (this.initialized) { 33410 chunk = this.nextChunk; 33411 } else { 33412 chunk = this.str.getBytes(chunkSize); 33413 this.initialized = true; 33414 } 33415 33416 if (!chunk || chunk.length === 0) { 33417 this.eof = true; 33418 return; 33419 } 33420 33421 this.nextChunk = this.str.getBytes(chunkSize); 33422 var hasMoreData = this.nextChunk && this.nextChunk.length > 0; 33423 var decrypt = this.decrypt; 33424 chunk = decrypt(chunk, !hasMoreData); 33425 var bufferLength = this.bufferLength; 33426 var i, 33427 n = chunk.length; 33428 var buffer = this.ensureBuffer(bufferLength + n); 33429 33430 for (i = 0; i < n; i++) { 33431 buffer[bufferLength++] = chunk[i]; 33432 } 33433 33434 this.bufferLength = bufferLength; 33435 }; 33436 33437 return DecryptStream; 33438}(); 33439 33440exports.DecryptStream = DecryptStream; 33441 33442var Ascii85Stream = function Ascii85StreamClosure() { 33443 function Ascii85Stream(str, maybeLength) { 33444 this.str = str; 33445 this.dict = str.dict; 33446 this.input = new Uint8Array(5); 33447 33448 if (maybeLength) { 33449 maybeLength = 0.8 * maybeLength; 33450 } 33451 33452 DecodeStream.call(this, maybeLength); 33453 } 33454 33455 Ascii85Stream.prototype = Object.create(DecodeStream.prototype); 33456 33457 Ascii85Stream.prototype.readBlock = function Ascii85Stream_readBlock() { 33458 var TILDA_CHAR = 0x7e; 33459 var Z_LOWER_CHAR = 0x7a; 33460 var EOF = -1; 33461 var str = this.str; 33462 var c = str.getByte(); 33463 33464 while ((0, _core_utils.isWhiteSpace)(c)) { 33465 c = str.getByte(); 33466 } 33467 33468 if (c === EOF || c === TILDA_CHAR) { 33469 this.eof = true; 33470 return; 33471 } 33472 33473 var bufferLength = this.bufferLength, 33474 buffer; 33475 var i; 33476 33477 if (c === Z_LOWER_CHAR) { 33478 buffer = this.ensureBuffer(bufferLength + 4); 33479 33480 for (i = 0; i < 4; ++i) { 33481 buffer[bufferLength + i] = 0; 33482 } 33483 33484 this.bufferLength += 4; 33485 } else { 33486 var input = this.input; 33487 input[0] = c; 33488 33489 for (i = 1; i < 5; ++i) { 33490 c = str.getByte(); 33491 33492 while ((0, _core_utils.isWhiteSpace)(c)) { 33493 c = str.getByte(); 33494 } 33495 33496 input[i] = c; 33497 33498 if (c === EOF || c === TILDA_CHAR) { 33499 break; 33500 } 33501 } 33502 33503 buffer = this.ensureBuffer(bufferLength + i - 1); 33504 this.bufferLength += i - 1; 33505 33506 if (i < 5) { 33507 for (; i < 5; ++i) { 33508 input[i] = 0x21 + 84; 33509 } 33510 33511 this.eof = true; 33512 } 33513 33514 var t = 0; 33515 33516 for (i = 0; i < 5; ++i) { 33517 t = t * 85 + (input[i] - 0x21); 33518 } 33519 33520 for (i = 3; i >= 0; --i) { 33521 buffer[bufferLength + i] = t & 0xff; 33522 t >>= 8; 33523 } 33524 } 33525 }; 33526 33527 return Ascii85Stream; 33528}(); 33529 33530exports.Ascii85Stream = Ascii85Stream; 33531 33532var AsciiHexStream = function AsciiHexStreamClosure() { 33533 function AsciiHexStream(str, maybeLength) { 33534 this.str = str; 33535 this.dict = str.dict; 33536 this.firstDigit = -1; 33537 33538 if (maybeLength) { 33539 maybeLength = 0.5 * maybeLength; 33540 } 33541 33542 DecodeStream.call(this, maybeLength); 33543 } 33544 33545 AsciiHexStream.prototype = Object.create(DecodeStream.prototype); 33546 33547 AsciiHexStream.prototype.readBlock = function AsciiHexStream_readBlock() { 33548 var UPSTREAM_BLOCK_SIZE = 8000; 33549 var bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE); 33550 33551 if (!bytes.length) { 33552 this.eof = true; 33553 return; 33554 } 33555 33556 var maxDecodeLength = bytes.length + 1 >> 1; 33557 var buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength); 33558 var bufferLength = this.bufferLength; 33559 var firstDigit = this.firstDigit; 33560 33561 for (var i = 0, ii = bytes.length; i < ii; i++) { 33562 var ch = bytes[i], 33563 digit; 33564 33565 if (ch >= 0x30 && ch <= 0x39) { 33566 digit = ch & 0x0f; 33567 } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) { 33568 digit = (ch & 0x0f) + 9; 33569 } else if (ch === 0x3e) { 33570 this.eof = true; 33571 break; 33572 } else { 33573 continue; 33574 } 33575 33576 if (firstDigit < 0) { 33577 firstDigit = digit; 33578 } else { 33579 buffer[bufferLength++] = firstDigit << 4 | digit; 33580 firstDigit = -1; 33581 } 33582 } 33583 33584 if (firstDigit >= 0 && this.eof) { 33585 buffer[bufferLength++] = firstDigit << 4; 33586 firstDigit = -1; 33587 } 33588 33589 this.firstDigit = firstDigit; 33590 this.bufferLength = bufferLength; 33591 }; 33592 33593 return AsciiHexStream; 33594}(); 33595 33596exports.AsciiHexStream = AsciiHexStream; 33597 33598var RunLengthStream = function RunLengthStreamClosure() { 33599 function RunLengthStream(str, maybeLength) { 33600 this.str = str; 33601 this.dict = str.dict; 33602 DecodeStream.call(this, maybeLength); 33603 } 33604 33605 RunLengthStream.prototype = Object.create(DecodeStream.prototype); 33606 33607 RunLengthStream.prototype.readBlock = function RunLengthStream_readBlock() { 33608 var repeatHeader = this.str.getBytes(2); 33609 33610 if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) { 33611 this.eof = true; 33612 return; 33613 } 33614 33615 var buffer; 33616 var bufferLength = this.bufferLength; 33617 var n = repeatHeader[0]; 33618 33619 if (n < 128) { 33620 buffer = this.ensureBuffer(bufferLength + n + 1); 33621 buffer[bufferLength++] = repeatHeader[1]; 33622 33623 if (n > 0) { 33624 var source = this.str.getBytes(n); 33625 buffer.set(source, bufferLength); 33626 bufferLength += n; 33627 } 33628 } else { 33629 n = 257 - n; 33630 var b = repeatHeader[1]; 33631 buffer = this.ensureBuffer(bufferLength + n + 1); 33632 33633 for (var i = 0; i < n; i++) { 33634 buffer[bufferLength++] = b; 33635 } 33636 } 33637 33638 this.bufferLength = bufferLength; 33639 }; 33640 33641 return RunLengthStream; 33642}(); 33643 33644exports.RunLengthStream = RunLengthStream; 33645 33646var LZWStream = function LZWStreamClosure() { 33647 function LZWStream(str, maybeLength, earlyChange) { 33648 this.str = str; 33649 this.dict = str.dict; 33650 this.cachedData = 0; 33651 this.bitsCached = 0; 33652 var maxLzwDictionarySize = 4096; 33653 var lzwState = { 33654 earlyChange, 33655 codeLength: 9, 33656 nextCode: 258, 33657 dictionaryValues: new Uint8Array(maxLzwDictionarySize), 33658 dictionaryLengths: new Uint16Array(maxLzwDictionarySize), 33659 dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize), 33660 currentSequence: new Uint8Array(maxLzwDictionarySize), 33661 currentSequenceLength: 0 33662 }; 33663 33664 for (var i = 0; i < 256; ++i) { 33665 lzwState.dictionaryValues[i] = i; 33666 lzwState.dictionaryLengths[i] = 1; 33667 } 33668 33669 this.lzwState = lzwState; 33670 DecodeStream.call(this, maybeLength); 33671 } 33672 33673 LZWStream.prototype = Object.create(DecodeStream.prototype); 33674 33675 LZWStream.prototype.readBits = function LZWStream_readBits(n) { 33676 var bitsCached = this.bitsCached; 33677 var cachedData = this.cachedData; 33678 33679 while (bitsCached < n) { 33680 var c = this.str.getByte(); 33681 33682 if (c === -1) { 33683 this.eof = true; 33684 return null; 33685 } 33686 33687 cachedData = cachedData << 8 | c; 33688 bitsCached += 8; 33689 } 33690 33691 this.bitsCached = bitsCached -= n; 33692 this.cachedData = cachedData; 33693 this.lastCode = null; 33694 return cachedData >>> bitsCached & (1 << n) - 1; 33695 }; 33696 33697 LZWStream.prototype.readBlock = function LZWStream_readBlock() { 33698 var blockSize = 512; 33699 var estimatedDecodedSize = blockSize * 2, 33700 decodedSizeDelta = blockSize; 33701 var i, j, q; 33702 var lzwState = this.lzwState; 33703 33704 if (!lzwState) { 33705 return; 33706 } 33707 33708 var earlyChange = lzwState.earlyChange; 33709 var nextCode = lzwState.nextCode; 33710 var dictionaryValues = lzwState.dictionaryValues; 33711 var dictionaryLengths = lzwState.dictionaryLengths; 33712 var dictionaryPrevCodes = lzwState.dictionaryPrevCodes; 33713 var codeLength = lzwState.codeLength; 33714 var prevCode = lzwState.prevCode; 33715 var currentSequence = lzwState.currentSequence; 33716 var currentSequenceLength = lzwState.currentSequenceLength; 33717 var decodedLength = 0; 33718 var currentBufferLength = this.bufferLength; 33719 var buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize); 33720 33721 for (i = 0; i < blockSize; i++) { 33722 var code = this.readBits(codeLength); 33723 var hasPrev = currentSequenceLength > 0; 33724 33725 if (code < 256) { 33726 currentSequence[0] = code; 33727 currentSequenceLength = 1; 33728 } else if (code >= 258) {
33729 if (code < nextCode) { 33730 currentSequenceLength = dictionaryLengths[code]; 33731 33732 for (j = currentSequenceLength - 1, q = code; j >= 0; j--) { 33733 currentSequence[j] = dictionaryValues[q]; 33734 q = dictionaryPrevCodes[q]; 33735 } 33736 } else { 33737 currentSequence[currentSequenceLength++] = currentSequence[0]; 33738 } 33739 } else if (code === 256) { 33740 codeLength = 9; 33741 nextCode = 258; 33742 currentSequenceLength = 0; 33743 continue; 33744 } else { 33745 this.eof = true; 33746 delete this.lzwState; 33747 break; 33748 } 33749 33750 if (hasPrev) { 33751 dictionaryPrevCodes[nextCode] = prevCode; 33752 dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1; 33753 dictionaryValues[nextCode] = currentSequence[0]; 33754 nextCode++; 33755 codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0; 33756 } 33757 33758 prevCode = code; 33759 decodedLength += currentSequenceLength; 33760 33761 if (estimatedDecodedSize < decodedLength) { 33762 do { 33763 estimatedDecodedSize += decodedSizeDelta; 33764 } while (estimatedDecodedSize < decodedLength); 33765 33766 buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize); 33767 } 33768 33769 for (j = 0; j < currentSequenceLength; j++) { 33770 buffer[currentBufferLength++] = currentSequence[j]; 33771 } 33772 } 33773 33774 lzwState.nextCode = nextCode; 33775 lzwState.codeLength = codeLength; 33776 lzwState.prevCode = prevCode; 33777 lzwState.currentSequenceLength = currentSequenceLength; 33778 this.bufferLength = currentBufferLength; 33779 }; 33780 33781 return LZWStream; 33782}(); 33783 33784exports.LZWStream = LZWStream; 33785 33786var NullStream = function NullStreamClosure() { 33787 function NullStream() { 33788 Stream.call(this, new Uint8Array(0)); 33789 } 33790 33791 NullStream.prototype = Stream.prototype; 33792 return NullStream; 33793}(); 33794 33795exports.NullStream = NullStream; 33796 33797/***/ }), 33798/* 12 */ 33799/***/ (function(module, exports, __w_pdfjs_require__) { 33800 33801"use strict"; 33802 33803 33804Object.defineProperty(exports, "__esModule", { 33805 value: true 33806}); 33807exports.CCITTFaxStream = void 0; 33808 33809var _primitives = __w_pdfjs_require__(4); 33810 33811var _ccitt = __w_pdfjs_require__(13); 33812 33813var _stream = __w_pdfjs_require__(11); 33814 33815var CCITTFaxStream = function CCITTFaxStreamClosure() { 33816 function CCITTFaxStream(str, maybeLength, params) { 33817 this.str = str; 33818 this.dict = str.dict; 33819 33820 if (!(0, _primitives.isDict)(params)) { 33821 params = _primitives.Dict.empty; 33822 } 33823 33824 const source = { 33825 next() { 33826 return str.getByte(); 33827 } 33828 33829 }; 33830 this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, { 33831 K: params.get("K"), 33832 EndOfLine: params.get("EndOfLine"), 33833 EncodedByteAlign: params.get("EncodedByteAlign"), 33834 Columns: params.get("Columns"), 33835 Rows: params.get("Rows"), 33836 EndOfBlock: params.get("EndOfBlock"), 33837 BlackIs1: params.get("BlackIs1") 33838 }); 33839 33840 _stream.DecodeStream.call(this, maybeLength); 33841 } 33842 33843 CCITTFaxStream.prototype = Object.create(_stream.DecodeStream.prototype); 33844 33845 CCITTFaxStream.prototype.readBlock = function () { 33846 while (!this.eof) { 33847 const c = this.ccittFaxDecoder.readNextChar(); 33848 33849 if (c === -1) { 33850 this.eof = true; 33851 return; 33852 } 33853 33854 this.ensureBuffer(this.bufferLength + 1); 33855 this.buffer[this.bufferLength++] = c; 33856 } 33857 }; 33858 33859 return CCITTFaxStream; 33860}(); 33861 33862exports.CCITTFaxStream = CCITTFaxStream; 33863 33864/***/ }), 33865/* 13 */ 33866/***/ (function(module, exports, __w_pdfjs_require__) { 33867 33868"use strict"; 33869 33870 33871Object.defineProperty(exports, "__esModule", { 33872 value: true 33873}); 33874exports.CCITTFaxDecoder = void 0; 33875 33876var _util = __w_pdfjs_require__(2); 33877 33878const CCITTFaxDecoder = function CCITTFaxDecoder() { 33879 const ccittEOL = -2; 33880 const ccittEOF = -1; 33881 const twoDimPass = 0; 33882 const twoDimHoriz = 1; 33883 const twoDimVert0 = 2; 33884 const twoDimVertR1 = 3; 33885 const twoDimVertL1 = 4; 33886 const twoDimVertR2 = 5; 33887 const twoDimVertL2 = 6; 33888 const twoDimVertR3 = 7; 33889 const twoDimVertL3 = 8; 33890 const twoDimTable = [[-1, -1], [-1, -1], [7, twoDimVertL3], [7, twoDimVertR3], [6, twoDimVertL2], [6, twoDimVertL2], [6, twoDimVertR2], [6, twoDimVertR2], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0]];
33891 const whiteTable1 = [[-1, -1], [12, ccittEOL], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [11, 1792], [11, 1792], [12, 1984], [12, 2048], [12, 2112], [12, 2176], [12, 2240], [12, 2304], [11, 1856], [11, 1856], [11, 1920], [11, 1920], [12, 2368], [12, 2432], [12, 2496], [12, 2560]]; 33892 const whiteTable2 = [[-1, -1], [-1, -1], [-1, -1], [-1, -1], [8, 29], [8, 29], [8, 30], [8, 30], [8, 45], [8, 45], [8, 46], [8, 46], [7, 22], [7, 22], [7, 22], [7, 22], [7, 23], [7, 23], [7, 23], [7, 23], [8, 47], [8, 47], [8, 48], [8, 48], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [7, 20], [7, 20], [7, 20], [7, 20], [8, 33], [8, 33], [8, 34], [8, 34], [8, 35], [8, 35], [8, 36], [8, 36], [8, 37], [8, 37], [8, 38], [8, 38], [7, 19], [7, 19], [7, 19], [7, 19], [8, 31], [8, 31], [8, 32], [8, 32], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [8, 53], [8, 53], [8, 54], [8, 54], [7, 26], [7, 26], [7, 26], [7, 26], [8, 39], [8, 39], [8, 40], [8, 40], [8, 41], [8, 41], [8, 42], [8, 42], [8, 43], [8, 43], [8, 44], [8, 44], [7, 21], [7, 21], [7, 21], [7, 21], [7, 28], [7, 28], [7, 28], [7, 28], [8, 61], [8, 61], [8, 62], [8, 62], [8, 63], [8, 63], [8, 0], [8, 0], [8, 320], [8, 320], [8, 384], [8, 384], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [7, 27], [7, 27], [7, 27], [7, 27], [8, 59], [8, 59], [8, 60], [8, 60], [9, 1472], [9, 1536], [9, 1600], [9, 1728], [7, 18], [7, 18], [7, 18], [7, 18], [7, 24], [7, 24], [7, 24], [7, 24], [8, 49], [8, 49], [8, 50], [8, 50], [8, 51], [8, 51], [8, 52], [8, 52], [7, 25], [7, 25], [7, 25], [7, 25], [8, 55], [8, 55], [8, 56], [8, 56], [8, 57], [8, 57], [8, 58], [8, 58], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [8, 448], [8, 448], [8, 512], [8, 512], [9, 704], [9, 768], [8, 640], [8, 640], [8, 576], [8, 576], [9, 832], [9, 896], [9, 960], [9, 1024], [9, 1088], [9, 1152], [9, 1216], [9, 1280], [9, 1344], [9, 1408], [7, 256], [7, 256], [7, 256], [7, 256], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7]];
33893 const blackTable1 = [[-1, -1], [-1, -1], [12, ccittEOL], [12, ccittEOL], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [11, 1792], [11, 1792], [11, 1792], [11, 1792], [12, 1984], [12, 1984], [12, 2048], [12, 2048], [12, 2112], [12, 2112], [12, 2176], [12, 2176], [12, 2240], [12, 2240], [12, 2304], [12, 2304], [11, 1856], [11, 1856], [11, 1856], [11, 1856], [11, 1920], [11, 1920], [11, 1920], [11, 1920], [12, 2368], [12, 2368], [12, 2432], [12, 2432], [12, 2496], [12, 2496], [12, 2560], [12, 2560], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [12, 52], [12, 52], [13, 640], [13, 704], [13, 768], [13, 832], [12, 55], [12, 55], [12, 56], [12, 56], [13, 1280], [13, 1344], [13, 1408], [13, 1472], [12, 59], [12, 59], [12, 60], [12, 60], [13, 1536], [13, 1600], [11, 24], [11, 24], [11, 24], [11, 24], [11, 25], [11, 25], [11, 25], [11, 25], [13, 1664], [13, 1728], [12, 320], [12, 320], [12, 384], [12, 384], [12, 448], [12, 448], [13, 512], [13, 576], [12, 53], [12, 53], [12, 54], [12, 54], [13, 896], [13, 960], [13, 1024], [13, 1088], [13, 1152], [13, 1216], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64]]; 33894 const blackTable2 = [[8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [11, 23], [11, 23], [12, 50], [12, 51], [12, 44], [12, 45], [12, 46], [12, 47], [12, 57], [12, 58], [12, 61], [12, 256], [10, 16], [10, 16], [10, 16], [10, 16], [10, 17], [10, 17], [10, 17], [10, 17], [12, 48], [12, 49], [12, 62], [12, 63], [12, 30], [12, 31], [12, 32], [12, 33], [12, 40], [12, 41], [11, 22], [11, 22], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [12, 128], [12, 192], [12, 26], [12, 27], [12, 28], [12, 29], [11, 19], [11, 19], [11, 20], [11, 20], [12, 34], [12, 35], [12, 36], [12, 37], [12, 38], [12, 39], [11, 21], [11, 21], [12, 42], [12, 43], [10, 0], [10, 0], [10, 0], [10, 0], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12]]; 33895 const blackTable3 = [[-1, -1], [-1, -1], [-1, -1], [-1, -1], [6, 9], [6, 8], [5, 7], [5, 7], [4, 6], [4, 6], [4, 6], [4, 6], [4, 5], [4, 5], [4, 5], [4, 5], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2]]; 33896 33897 function CCITTFaxDecoder(source, options = {}) { 33898 if (!source || typeof source.next !== "function") { 33899 throw new Error('CCITTFaxDecoder - invalid "source" parameter.'); 33900 } 33901 33902 this.source = source; 33903 this.eof = false; 33904 this.encoding = options["K"] || 0; 33905 this.eoline = options["EndOfLine"] || false; 33906 this.byteAlign = options["EncodedByteAlign"] || false; 33907 this.columns = options["Columns"] || 1728; 33908 this.rows = options["Rows"] || 0; 33909 let eoblock = options["EndOfBlock"]; 33910 33911 if (eoblock === null || eoblock === undefined) { 33912 eoblock = true; 33913 } 33914 33915 this.eoblock = eoblock; 33916 this.black = options["BlackIs1"] || false; 33917 this.codingLine = new Uint32Array(this.columns + 1); 33918 this.refLine = new Uint32Array(this.columns + 2); 33919 this.codingLine[0] = this.columns; 33920 this.codingPos = 0; 33921 this.row = 0; 33922 this.nextLine2D = this.encoding < 0; 33923 this.inputBits = 0; 33924 this.inputBuf = 0; 33925 this.outputBits = 0; 33926 this.rowsDone = false;
vendor: 4,301 bytes, lines 33927-34089
33927 let code1; 33928 33929 while ((code1 = this._lookBits(12)) === 0) { 33930 this._eatBits(1); 33931 } 33932 33933 if (code1 === 1) { 33934 this._eatBits(12); 33935 } 33936 33937 if (this.encoding > 0) { 33938 this.nextLine2D = !this._lookBits(1); 33939 33940 this._eatBits(1); 33941 } 33942 } 33943 33944 CCITTFaxDecoder.prototype = { 33945 readNextChar() { 33946 if (this.eof) { 33947 return -1; 33948 } 33949 33950 const refLine = this.refLine; 33951 const codingLine = this.codingLine; 33952 const columns = this.columns; 33953 let refPos, blackPixels, bits, i; 33954 33955 if (this.outputBits === 0) { 33956 if (this.rowsDone) { 33957 this.eof = true; 33958 } 33959 33960 if (this.eof) { 33961 return -1; 33962 } 33963 33964 this.err = false; 33965 let code1, code2, code3; 33966 33967 if (this.nextLine2D) { 33968 for (i = 0; codingLine[i] < columns; ++i) { 33969 refLine[i] = codingLine[i]; 33970 } 33971 33972 refLine[i++] = columns; 33973 refLine[i] = columns; 33974 codingLine[0] = 0; 33975 this.codingPos = 0; 33976 refPos = 0; 33977 blackPixels = 0; 33978 33979 while (codingLine[this.codingPos] < columns) { 33980 code1 = this._getTwoDimCode(); 33981 33982 switch (code1) { 33983 case twoDimPass: 33984 this._addPixels(refLine[refPos + 1], blackPixels); 33985 33986 if (refLine[refPos + 1] < columns) { 33987 refPos += 2; 33988 } 33989 33990 break; 33991 33992 case twoDimHoriz: 33993 code1 = code2 = 0; 33994 33995 if (blackPixels) { 33996 do { 33997 code1 += code3 = this._getBlackCode(); 33998 } while (code3 >= 64); 33999 34000 do { 34001 code2 += code3 = this._getWhiteCode(); 34002 } while (code3 >= 64); 34003 } else { 34004 do { 34005 code1 += code3 = this._getWhiteCode(); 34006 } while (code3 >= 64); 34007 34008 do { 34009 code2 += code3 = this._getBlackCode(); 34010 } while (code3 >= 64); 34011 } 34012 34013 this._addPixels(codingLine[this.codingPos] + code1, blackPixels); 34014 34015 if (codingLine[this.codingPos] < columns) { 34016 this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1); 34017 } 34018 34019 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 34020 refPos += 2; 34021 } 34022 34023 break; 34024 34025 case twoDimVertR3: 34026 this._addPixels(refLine[refPos] + 3, blackPixels); 34027 34028 blackPixels ^= 1; 34029 34030 if (codingLine[this.codingPos] < columns) { 34031 ++refPos; 34032 34033 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 34034 refPos += 2; 34035 } 34036 } 34037 34038 break; 34039 34040 case twoDimVertR2: 34041 this._addPixels(refLine[refPos] + 2, blackPixels); 34042 34043 blackPixels ^= 1; 34044 34045 if (codingLine[this.codingPos] < columns) { 34046 ++refPos; 34047 34048 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 34049 refPos += 2; 34050 } 34051 } 34052 34053 break; 34054 34055 case twoDimVertR1: 34056 this._addPixels(refLine[refPos] + 1, blackPixels); 34057 34058 blackPixels ^= 1; 34059 34060 if (codingLine[this.codingPos] < columns) { 34061 ++refPos; 34062 34063 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 34064 refPos += 2; 34065 } 34066 } 34067 34068 break; 34069 34070 case twoDimVert0: 34071 this._addPixels(refLine[refPos], blackPixels); 34072 34073 blackPixels ^= 1; 34074 34075 if (codingLine[this.codingPos] < columns) { 34076 ++refPos; 34077 34078 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 34079 refPos += 2; 34080 } 34081 } 34082 34083 break; 34084 34085 case twoDimVertL3: 34086 this._addPixelsNeg(refLine[refPos] - 3, blackPixels); 34087 34088 blackPixels ^= 1; 34089
vendor: 14,493 bytes, lines 34090-34740
34090 if (codingLine[this.codingPos] < columns) { 34091 if (refPos > 0) { 34092 --refPos; 34093 } else { 34094 ++refPos; 34095 } 34096 34097 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 34098 refPos += 2; 34099 } 34100 } 34101 34102 break; 34103 34104 case twoDimVertL2: 34105 this._addPixelsNeg(refLine[refPos] - 2, blackPixels); 34106 34107 blackPixels ^= 1; 34108 34109 if (codingLine[this.codingPos] < columns) { 34110 if (refPos > 0) { 34111 --refPos; 34112 } else { 34113 ++refPos; 34114 } 34115 34116 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 34117 refPos += 2; 34118 } 34119 } 34120 34121 break; 34122 34123 case twoDimVertL1: 34124 this._addPixelsNeg(refLine[refPos] - 1, blackPixels); 34125 34126 blackPixels ^= 1; 34127 34128 if (codingLine[this.codingPos] < columns) { 34129 if (refPos > 0) { 34130 --refPos; 34131 } else { 34132 ++refPos; 34133 } 34134 34135 while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) { 34136 refPos += 2; 34137 } 34138 } 34139 34140 break; 34141 34142 case ccittEOF: 34143 this._addPixels(columns, 0); 34144 34145 this.eof = true; 34146 break; 34147 34148 default: 34149 (0, _util.info)("bad 2d code"); 34150 34151 this._addPixels(columns, 0); 34152 34153 this.err = true; 34154 } 34155 } 34156 } else { 34157 codingLine[0] = 0; 34158 this.codingPos = 0; 34159 blackPixels = 0; 34160 34161 while (codingLine[this.codingPos] < columns) { 34162 code1 = 0; 34163 34164 if (blackPixels) { 34165 do { 34166 code1 += code3 = this._getBlackCode(); 34167 } while (code3 >= 64); 34168 } else { 34169 do { 34170 code1 += code3 = this._getWhiteCode(); 34171 } while (code3 >= 64); 34172 } 34173 34174 this._addPixels(codingLine[this.codingPos] + code1, blackPixels); 34175 34176 blackPixels ^= 1; 34177 } 34178 } 34179 34180 let gotEOL = false; 34181 34182 if (this.byteAlign) { 34183 this.inputBits &= ~7; 34184 } 34185 34186 if (!this.eoblock && this.row === this.rows - 1) { 34187 this.rowsDone = true; 34188 } else { 34189 code1 = this._lookBits(12); 34190 34191 if (this.eoline) { 34192 while (code1 !== ccittEOF && code1 !== 1) { 34193 this._eatBits(1); 34194 34195 code1 = this._lookBits(12); 34196 } 34197 } else { 34198 while (code1 === 0) { 34199 this._eatBits(1); 34200 34201 code1 = this._lookBits(12); 34202 } 34203 } 34204 34205 if (code1 === 1) { 34206 this._eatBits(12); 34207 34208 gotEOL = true; 34209 } else if (code1 === ccittEOF) { 34210 this.eof = true; 34211 } 34212 } 34213 34214 if (!this.eof && this.encoding > 0 && !this.rowsDone) { 34215 this.nextLine2D = !this._lookBits(1); 34216 34217 this._eatBits(1); 34218 } 34219 34220 if (this.eoblock && gotEOL && this.byteAlign) { 34221 code1 = this._lookBits(12); 34222 34223 if (code1 === 1) { 34224 this._eatBits(12); 34225 34226 if (this.encoding > 0) { 34227 this._lookBits(1); 34228 34229 this._eatBits(1); 34230 } 34231 34232 if (this.encoding >= 0) { 34233 for (i = 0; i < 4; ++i) { 34234 code1 = this._lookBits(12); 34235 34236 if (code1 !== 1) { 34237 (0, _util.info)("bad rtc code: " + code1); 34238 } 34239 34240 this._eatBits(12); 34241 34242 if (this.encoding > 0) { 34243 this._lookBits(1); 34244 34245 this._eatBits(1); 34246 } 34247 } 34248 } 34249 34250 this.eof = true; 34251 } 34252 } else if (this.err && this.eoline) { 34253 while (true) { 34254 code1 = this._lookBits(13); 34255 34256 if (code1 === ccittEOF) { 34257 this.eof = true; 34258 return -1; 34259 } 34260 34261 if (code1 >> 1 === 1) { 34262 break; 34263 } 34264 34265 this._eatBits(1); 34266 } 34267 34268 this._eatBits(12); 34269 34270 if (this.encoding > 0) { 34271 this._eatBits(1); 34272 34273 this.nextLine2D = !(code1 & 1); 34274 } 34275 } 34276 34277 if (codingLine[0] > 0) { 34278 this.outputBits = codingLine[this.codingPos = 0]; 34279 } else { 34280 this.outputBits = codingLine[this.codingPos = 1]; 34281 } 34282 34283 this.row++; 34284 } 34285 34286 let c; 34287 34288 if (this.outputBits >= 8) { 34289 c = this.codingPos & 1 ? 0 : 0xff; 34290 this.outputBits -= 8; 34291 34292 if (this.outputBits === 0 && codingLine[this.codingPos] < columns) { 34293 this.codingPos++; 34294 this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1]; 34295 } 34296 } else { 34297 bits = 8; 34298 c = 0; 34299 34300 do { 34301 if (this.outputBits > bits) { 34302 c <<= bits; 34303 34304 if (!(this.codingPos & 1)) { 34305 c |= 0xff >> 8 - bits; 34306 } 34307 34308 this.outputBits -= bits; 34309 bits = 0; 34310 } else { 34311 c <<= this.outputBits; 34312 34313 if (!(this.codingPos & 1)) { 34314 c |= 0xff >> 8 - this.outputBits; 34315 } 34316 34317 bits -= this.outputBits; 34318 this.outputBits = 0; 34319 34320 if (codingLine[this.codingPos] < columns) { 34321 this.codingPos++; 34322 this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1]; 34323 } else if (bits > 0) { 34324 c <<= bits; 34325 bits = 0; 34326 } 34327 } 34328 } while (bits); 34329 } 34330 34331 if (this.black) { 34332 c ^= 0xff; 34333 } 34334 34335 return c; 34336 }, 34337 34338 _addPixels(a1, blackPixels) { 34339 const codingLine = this.codingLine; 34340 let codingPos = this.codingPos; 34341 34342 if (a1 > codingLine[codingPos]) { 34343 if (a1 > this.columns) { 34344 (0, _util.info)("row is wrong length"); 34345 this.err = true; 34346 a1 = this.columns; 34347 } 34348 34349 if (codingPos & 1 ^ blackPixels) { 34350 ++codingPos; 34351 } 34352 34353 codingLine[codingPos] = a1; 34354 } 34355 34356 this.codingPos = codingPos; 34357 }, 34358 34359 _addPixelsNeg(a1, blackPixels) { 34360 const codingLine = this.codingLine; 34361 let codingPos = this.codingPos; 34362 34363 if (a1 > codingLine[codingPos]) { 34364 if (a1 > this.columns) { 34365 (0, _util.info)("row is wrong length"); 34366 this.err = true; 34367 a1 = this.columns; 34368 } 34369 34370 if (codingPos & 1 ^ blackPixels) { 34371 ++codingPos; 34372 } 34373 34374 codingLine[codingPos] = a1; 34375 } else if (a1 < codingLine[codingPos]) { 34376 if (a1 < 0) { 34377 (0, _util.info)("invalid code"); 34378 this.err = true; 34379 a1 = 0; 34380 } 34381 34382 while (codingPos > 0 && a1 < codingLine[codingPos - 1]) { 34383 --codingPos; 34384 } 34385 34386 codingLine[codingPos] = a1; 34387 } 34388 34389 this.codingPos = codingPos; 34390 }, 34391 34392 _findTableCode(start, end, table, limit) { 34393 const limitValue = limit || 0; 34394 34395 for (let i = start; i <= end; ++i) { 34396 let code = this._lookBits(i); 34397 34398 if (code === ccittEOF) { 34399 return [true, 1, false]; 34400 } 34401 34402 if (i < end) { 34403 code <<= end - i; 34404 } 34405 34406 if (!limitValue || code >= limitValue) { 34407 const p = table[code - limitValue]; 34408 34409 if (p[0] === i) { 34410 this._eatBits(i); 34411 34412 return [true, p[1], true]; 34413 } 34414 } 34415 } 34416 34417 return [false, 0, false]; 34418 }, 34419 34420 _getTwoDimCode() { 34421 let code = 0; 34422 let p; 34423 34424 if (this.eoblock) { 34425 code = this._lookBits(7); 34426 p = twoDimTable[code]; 34427 34428 if (p && p[0] > 0) { 34429 this._eatBits(p[0]); 34430 34431 return p[1]; 34432 } 34433 } else { 34434 const result = this._findTableCode(1, 7, twoDimTable); 34435 34436 if (result[0] && result[2]) { 34437 return result[1]; 34438 } 34439 } 34440 34441 (0, _util.info)("Bad two dim code"); 34442 return ccittEOF; 34443 }, 34444 34445 _getWhiteCode() { 34446 let code = 0; 34447 let p; 34448 34449 if (this.eoblock) { 34450 code = this._lookBits(12); 34451 34452 if (code === ccittEOF) { 34453 return 1; 34454 } 34455 34456 if (code >> 5 === 0) { 34457 p = whiteTable1[code]; 34458 } else { 34459 p = whiteTable2[code >> 3]; 34460 } 34461 34462 if (p[0] > 0) { 34463 this._eatBits(p[0]); 34464 34465 return p[1]; 34466 } 34467 } else { 34468 let result = this._findTableCode(1, 9, whiteTable2); 34469 34470 if (result[0]) { 34471 return result[1]; 34472 } 34473 34474 result = this._findTableCode(11, 12, whiteTable1); 34475 34476 if (result[0]) { 34477 return result[1]; 34478 } 34479 } 34480 34481 (0, _util.info)("bad white code"); 34482 34483 this._eatBits(1); 34484 34485 return 1; 34486 }, 34487 34488 _getBlackCode() { 34489 let code, p; 34490 34491 if (this.eoblock) { 34492 code = this._lookBits(13); 34493 34494 if (code === ccittEOF) { 34495 return 1; 34496 } 34497 34498 if (code >> 7 === 0) { 34499 p = blackTable1[code]; 34500 } else if (code >> 9 === 0 && code >> 7 !== 0) { 34501 p = blackTable2[(code >> 1) - 64]; 34502 } else { 34503 p = blackTable3[code >> 7]; 34504 } 34505 34506 if (p[0] > 0) { 34507 this._eatBits(p[0]); 34508 34509 return p[1]; 34510 } 34511 } else { 34512 let result = this._findTableCode(2, 6, blackTable3); 34513 34514 if (result[0]) { 34515 return result[1]; 34516 } 34517 34518 result = this._findTableCode(7, 12, blackTable2, 64); 34519 34520 if (result[0]) { 34521 return result[1]; 34522 } 34523 34524 result = this._findTableCode(10, 13, blackTable1); 34525 34526 if (result[0]) { 34527 return result[1]; 34528 } 34529 } 34530 34531 (0, _util.info)("bad black code"); 34532 34533 this._eatBits(1); 34534 34535 return 1; 34536 }, 34537 34538 _lookBits(n) { 34539 let c; 34540 34541 while (this.inputBits < n) { 34542 if ((c = this.source.next()) === -1) { 34543 if (this.inputBits === 0) { 34544 return ccittEOF; 34545 } 34546 34547 return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n; 34548 } 34549 34550 this.inputBuf = this.inputBuf << 8 | c; 34551 this.inputBits += 8; 34552 } 34553 34554 return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n; 34555 }, 34556 34557 _eatBits(n) { 34558 if ((this.inputBits -= n) < 0) { 34559 this.inputBits = 0; 34560 } 34561 } 34562 34563 }; 34564 return CCITTFaxDecoder; 34565}(); 34566 34567exports.CCITTFaxDecoder = CCITTFaxDecoder; 34568 34569/***/ }), 34570/* 14 */ 34571/***/ (function(module, exports, __w_pdfjs_require__) { 34572 34573"use strict"; 34574 34575 34576Object.defineProperty(exports, "__esModule", { 34577 value: true 34578}); 34579exports.Jbig2Stream = void 0; 34580 34581var _primitives = __w_pdfjs_require__(4); 34582 34583var _stream = __w_pdfjs_require__(11); 34584 34585var _jbig = __w_pdfjs_require__(15); 34586 34587var _util = __w_pdfjs_require__(2); 34588 34589const Jbig2Stream = function Jbig2StreamClosure() { 34590 function Jbig2Stream(stream, maybeLength, dict, params) { 34591 this.stream = stream; 34592 this.maybeLength = maybeLength; 34593 this.dict = dict; 34594 this.params = params; 34595 34596 _stream.DecodeStream.call(this, maybeLength); 34597 } 34598 34599 Jbig2Stream.prototype = Object.create(_stream.DecodeStream.prototype); 34600 Object.defineProperty(Jbig2Stream.prototype, "bytes", { 34601 get() { 34602 return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength)); 34603 }, 34604 34605 configurable: true 34606 }); 34607 34608 Jbig2Stream.prototype.ensureBuffer = function (requested) {}; 34609 34610 Jbig2Stream.prototype.readBlock = function () { 34611 if (this.eof) { 34612 return; 34613 } 34614 34615 const jbig2Image = new _jbig.Jbig2Image(); 34616 const chunks = []; 34617 34618 if ((0, _primitives.isDict)(this.params)) { 34619 const globalsStream = this.params.get("JBIG2Globals"); 34620 34621 if ((0, _primitives.isStream)(globalsStream)) { 34622 const globals = globalsStream.getBytes(); 34623 chunks.push({ 34624 data: globals, 34625 start: 0, 34626 end: globals.length 34627 }); 34628 } 34629 } 34630 34631 chunks.push({ 34632 data: this.bytes, 34633 start: 0, 34634 end: this.bytes.length 34635 }); 34636 const data = jbig2Image.parseChunks(chunks); 34637 const dataLength = data.length; 34638 34639 for (let i = 0; i < dataLength; i++) { 34640 data[i] ^= 0xff; 34641 } 34642 34643 this.buffer = data; 34644 this.bufferLength = dataLength; 34645 this.eof = true; 34646 }; 34647 34648 return Jbig2Stream; 34649}(); 34650 34651exports.Jbig2Stream = Jbig2Stream; 34652 34653/***/ }), 34654/* 15 */ 34655/***/ (function(module, exports, __w_pdfjs_require__) { 34656 34657"use strict"; 34658 34659 34660Object.defineProperty(exports, "__esModule", { 34661 value: true 34662}); 34663exports.Jbig2Image = void 0; 34664 34665var _util = __w_pdfjs_require__(2); 34666 34667var _core_utils = __w_pdfjs_require__(7); 34668 34669var _arithmetic_decoder = __w_pdfjs_require__(16); 34670 34671var _ccitt = __w_pdfjs_require__(13); 34672 34673class Jbig2Error extends _util.BaseException { 34674 constructor(msg) { 34675 super(`JBIG2 error: ${msg}`); 34676 } 34677 34678} 34679 34680var Jbig2Image = function Jbig2ImageClosure() { 34681 function ContextCache() {} 34682 34683 ContextCache.prototype = { 34684 getContexts(id) { 34685 if (id in this) { 34686 return this[id]; 34687 } 34688 34689 return this[id] = new Int8Array(1 << 16); 34690 } 34691 34692 }; 34693 34694 function DecodingContext(data, start, end) { 34695 this.data = data; 34696 this.start = start; 34697 this.end = end; 34698 } 34699 34700 DecodingContext.prototype = { 34701 get decoder() { 34702 var decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end); 34703 return (0, _util.shadow)(this, "decoder", decoder); 34704 }, 34705 34706 get contextCache() { 34707 var cache = new ContextCache(); 34708 return (0, _util.shadow)(this, "contextCache", cache); 34709 } 34710 34711 }; 34712 34713 function decodeInteger(contextCache, procedure, decoder) { 34714 var contexts = contextCache.getContexts(procedure); 34715 var prev = 1; 34716 34717 function readBits(length) { 34718 var v = 0; 34719 34720 for (var i = 0; i < length; i++) { 34721 var bit = decoder.readBit(contexts, prev); 34722 prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256; 34723 v = v << 1 | bit; 34724 } 34725 34726 return v >>> 0; 34727 } 34728 34729 var sign = readBits(1); 34730 var value = readBits(1) ? readBits(1) ? readBits(1) ? readBits(1) ? readBits(1) ? readBits(32) + 4436 : readBits(12) + 340 : readBits(8) + 84 : readBits(6) + 20 : readBits(4) + 4 : readBits(2); 34731 34732 if (sign === 0) { 34733 return value; 34734 } else if (value > 0) { 34735 return -value; 34736 } 34737 34738 return null; 34739 } 34740
vendor: 7,274 bytes, lines 34741-35078
34741 function decodeIAID(contextCache, decoder, codeLength) { 34742 var contexts = contextCache.getContexts("IAID"); 34743 var prev = 1; 34744 34745 for (var i = 0; i < codeLength; i++) { 34746 var bit = decoder.readBit(contexts, prev); 34747 prev = prev << 1 | bit; 34748 } 34749 34750 if (codeLength < 31) { 34751 return prev & (1 << codeLength) - 1; 34752 } 34753 34754 return prev & 0x7fffffff; 34755 } 34756 34757 var SegmentTypes = ["SymbolDictionary", null, null, null, "IntermediateTextRegion", null, "ImmediateTextRegion", "ImmediateLosslessTextRegion", null, null, null, null, null, null, null, null, "PatternDictionary", null, null, null, "IntermediateHalftoneRegion", null, "ImmediateHalftoneRegion", "ImmediateLosslessHalftoneRegion", null, null, null, null, null, null, null, null, null, null, null, null, "IntermediateGenericRegion", null, "ImmediateGenericRegion", "ImmediateLosslessGenericRegion", "IntermediateGenericRefinementRegion", null, "ImmediateGenericRefinementRegion", "ImmediateLosslessGenericRefinementRegion", null, null, null, null, "PageInformation", "EndOfPage", "EndOfStripe", "EndOfFile", "Profiles", "Tables", null, null, null, null, null, null, null, null, "Extension"]; 34758 var CodingTemplates = [[{ 34759 x: -1, 34760 y: -2 34761 }, { 34762 x: 0, 34763 y: -2 34764 }, { 34765 x: 1, 34766 y: -2 34767 }, { 34768 x: -2, 34769 y: -1 34770 }, { 34771 x: -1, 34772 y: -1 34773 }, { 34774 x: 0, 34775 y: -1 34776 }, { 34777 x: 1, 34778 y: -1 34779 }, { 34780 x: 2, 34781 y: -1 34782 }, { 34783 x: -4, 34784 y: 0 34785 }, { 34786 x: -3, 34787 y: 0 34788 }, { 34789 x: -2, 34790 y: 0 34791 }, { 34792 x: -1, 34793 y: 0 34794 }], [{ 34795 x: -1, 34796 y: -2 34797 }, { 34798 x: 0, 34799 y: -2 34800 }, { 34801 x: 1, 34802 y: -2 34803 }, { 34804 x: 2, 34805 y: -2 34806 }, { 34807 x: -2, 34808 y: -1 34809 }, { 34810 x: -1, 34811 y: -1 34812 }, { 34813 x: 0, 34814 y: -1 34815 }, { 34816 x: 1, 34817 y: -1 34818 }, { 34819 x: 2, 34820 y: -1 34821 }, { 34822 x: -3, 34823 y: 0 34824 }, { 34825 x: -2, 34826 y: 0 34827 }, { 34828 x: -1, 34829 y: 0 34830 }], [{ 34831 x: -1, 34832 y: -2 34833 }, { 34834 x: 0, 34835 y: -2 34836 }, { 34837 x: 1, 34838 y: -2 34839 }, { 34840 x: -2, 34841 y: -1 34842 }, { 34843 x: -1, 34844 y: -1 34845 }, { 34846 x: 0, 34847 y: -1 34848 }, { 34849 x: 1, 34850 y: -1 34851 }, { 34852 x: -2, 34853 y: 0 34854 }, { 34855 x: -1, 34856 y: 0 34857 }], [{ 34858 x: -3, 34859 y: -1 34860 }, { 34861 x: -2, 34862 y: -1 34863 }, { 34864 x: -1, 34865 y: -1 34866 }, { 34867 x: 0, 34868 y: -1 34869 }, { 34870 x: 1, 34871 y: -1 34872 }, { 34873 x: -4, 34874 y: 0 34875 }, { 34876 x: -3, 34877 y: 0 34878 }, { 34879 x: -2, 34880 y: 0 34881 }, { 34882 x: -1, 34883 y: 0 34884 }]]; 34885 var RefinementTemplates = [{ 34886 coding: [{ 34887 x: 0, 34888 y: -1 34889 }, { 34890 x: 1, 34891 y: -1 34892 }, { 34893 x: -1, 34894 y: 0 34895 }], 34896 reference: [{ 34897 x: 0, 34898 y: -1 34899 }, { 34900 x: 1, 34901 y: -1 34902 }, { 34903 x: -1, 34904 y: 0 34905 }, { 34906 x: 0, 34907 y: 0 34908 }, { 34909 x: 1, 34910 y: 0 34911 }, { 34912 x: -1, 34913 y: 1 34914 }, { 34915 x: 0, 34916 y: 1 34917 }, { 34918 x: 1, 34919 y: 1 34920 }] 34921 }, { 34922 coding: [{ 34923 x: -1, 34924 y: -1 34925 }, { 34926 x: 0, 34927 y: -1 34928 }, { 34929 x: 1, 34930 y: -1 34931 }, { 34932 x: -1, 34933 y: 0 34934 }], 34935 reference: [{ 34936 x: 0, 34937 y: -1 34938 }, { 34939 x: -1, 34940 y: 0 34941 }, { 34942 x: 0, 34943 y: 0 34944 }, { 34945 x: 1, 34946 y: 0 34947 }, { 34948 x: 0, 34949 y: 1 34950 }, { 34951 x: 1, 34952 y: 1 34953 }] 34954 }]; 34955 var ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195]; 34956 var RefinementReusedContexts = [0x0020, 0x0008]; 34957 34958 function decodeBitmapTemplate0(width, height, decodingContext) { 34959 var decoder = decodingContext.decoder; 34960 var contexts = decodingContext.contextCache.getContexts("GB"); 34961 var contextLabel, 34962 i, 34963 j, 34964 pixel, 34965 row, 34966 row1, 34967 row2, 34968 bitmap = []; 34969 var OLD_PIXEL_MASK = 0x7bf7; 34970 34971 for (i = 0; i < height; i++) { 34972 row = bitmap[i] = new Uint8Array(width); 34973 row1 = i < 1 ? row : bitmap[i - 1]; 34974 row2 = i < 2 ? row : bitmap[i - 2]; 34975 contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4; 34976 34977 for (j = 0; j < width; j++) { 34978 row[j] = pixel = decoder.readBit(contexts, contextLabel); 34979 contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel; 34980 } 34981 } 34982 34983 return bitmap; 34984 } 34985 34986 function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) { 34987 if (mmr) { 34988 const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end); 34989 return decodeMMRBitmap(input, width, height, false); 34990 } 34991 34992 if (templateIndex === 0 && !skip && !prediction && at.length === 4 && at[0].x === 3 && at[0].y === -1 && at[1].x === -3 && at[1].y === -1 && at[2].x === 2 && at[2].y === -2 && at[3].x === -2 && at[3].y === -2) { 34993 return decodeBitmapTemplate0(width, height, decodingContext); 34994 } 34995 34996 var useskip = !!skip; 34997 var template = CodingTemplates[templateIndex].concat(at); 34998 template.sort(function (a, b) { 34999 return a.y - b.y || a.x - b.x; 35000 }); 35001 var templateLength = template.length; 35002 var templateX = new Int8Array(templateLength); 35003 var templateY = new Int8Array(templateLength); 35004 var changingTemplateEntries = []; 35005 var reuseMask = 0, 35006 minX = 0, 35007 maxX = 0, 35008 minY = 0; 35009 var c, k; 35010 35011 for (k = 0; k < templateLength; k++) { 35012 templateX[k] = template[k].x; 35013 templateY[k] = template[k].y; 35014 minX = Math.min(minX, template[k].x); 35015 maxX = Math.max(maxX, template[k].x); 35016 minY = Math.min(minY, template[k].y); 35017 35018 if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) { 35019 reuseMask |= 1 << templateLength - 1 - k; 35020 } else { 35021 changingTemplateEntries.push(k); 35022 } 35023 } 35024 35025 var changingEntriesLength = changingTemplateEntries.length; 35026 var changingTemplateX = new Int8Array(changingEntriesLength); 35027 var changingTemplateY = new Int8Array(changingEntriesLength); 35028 var changingTemplateBit = new Uint16Array(changingEntriesLength); 35029 35030 for (c = 0; c < changingEntriesLength; c++) { 35031 k = changingTemplateEntries[c]; 35032 changingTemplateX[c] = template[k].x; 35033 changingTemplateY[c] = template[k].y; 35034 changingTemplateBit[c] = 1 << templateLength - 1 - k; 35035 } 35036 35037 var sbb_left = -minX; 35038 var sbb_top = -minY; 35039 var sbb_right = width - maxX; 35040 var pseudoPixelContext = ReusedContexts[templateIndex]; 35041 var row = new Uint8Array(width); 35042 var bitmap = []; 35043 var decoder = decodingContext.decoder; 35044 var contexts = decodingContext.contextCache.getContexts("GB"); 35045 var ltp = 0, 35046 j, 35047 i0, 35048 j0, 35049 contextLabel = 0, 35050 bit, 35051 shift; 35052 35053 for (var i = 0; i < height; i++) { 35054 if (prediction) { 35055 var sltp = decoder.readBit(contexts, pseudoPixelContext); 35056 ltp ^= sltp; 35057 35058 if (ltp) { 35059 bitmap.push(row); 35060 continue; 35061 } 35062 } 35063 35064 row = new Uint8Array(row); 35065 bitmap.push(row); 35066 35067 for (j = 0; j < width; j++) { 35068 if (useskip && skip[i][j]) { 35069 row[j] = 0; 35070 continue; 35071 } 35072 35073 if (j >= sbb_left && j < sbb_right && i >= sbb_top) { 35074 contextLabel = contextLabel << 1 & reuseMask; 35075 35076 for (k = 0; k < changingEntriesLength; k++) { 35077 i0 = i + changingTemplateY[k]; 35078 j0 = j + changingTemplateX[k];
vendor: 4,065 bytes, lines 35079-35211
35079 bit = bitmap[i0][j0]; 35080 35081 if (bit) { 35082 bit = changingTemplateBit[k]; 35083 contextLabel |= bit; 35084 } 35085 } 35086 } else { 35087 contextLabel = 0; 35088 shift = templateLength - 1; 35089 35090 for (k = 0; k < templateLength; k++, shift--) { 35091 j0 = j + templateX[k]; 35092 35093 if (j0 >= 0 && j0 < width) { 35094 i0 = i + templateY[k]; 35095 35096 if (i0 >= 0) { 35097 bit = bitmap[i0][j0]; 35098 35099 if (bit) { 35100 contextLabel |= bit << shift; 35101 } 35102 } 35103 } 35104 } 35105 } 35106 35107 var pixel = decoder.readBit(contexts, contextLabel); 35108 row[j] = pixel; 35109 } 35110 } 35111 35112 return bitmap; 35113 } 35114 35115 function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) { 35116 var codingTemplate = RefinementTemplates[templateIndex].coding; 35117 35118 if (templateIndex === 0) { 35119 codingTemplate = codingTemplate.concat([at[0]]); 35120 } 35121 35122 var codingTemplateLength = codingTemplate.length; 35123 var codingTemplateX = new Int32Array(codingTemplateLength); 35124 var codingTemplateY = new Int32Array(codingTemplateLength); 35125 var k; 35126 35127 for (k = 0; k < codingTemplateLength; k++) { 35128 codingTemplateX[k] = codingTemplate[k].x; 35129 codingTemplateY[k] = codingTemplate[k].y; 35130 } 35131 35132 var referenceTemplate = RefinementTemplates[templateIndex].reference; 35133 35134 if (templateIndex === 0) { 35135 referenceTemplate = referenceTemplate.concat([at[1]]); 35136 } 35137 35138 var referenceTemplateLength = referenceTemplate.length; 35139 var referenceTemplateX = new Int32Array(referenceTemplateLength); 35140 var referenceTemplateY = new Int32Array(referenceTemplateLength); 35141 35142 for (k = 0; k < referenceTemplateLength; k++) { 35143 referenceTemplateX[k] = referenceTemplate[k].x; 35144 referenceTemplateY[k] = referenceTemplate[k].y; 35145 } 35146 35147 var referenceWidth = referenceBitmap[0].length; 35148 var referenceHeight = referenceBitmap.length; 35149 var pseudoPixelContext = RefinementReusedContexts[templateIndex]; 35150 var bitmap = []; 35151 var decoder = decodingContext.decoder; 35152 var contexts = decodingContext.contextCache.getContexts("GR"); 35153 var ltp = 0; 35154 35155 for (var i = 0; i < height; i++) { 35156 if (prediction) { 35157 var sltp = decoder.readBit(contexts, pseudoPixelContext); 35158 ltp ^= sltp; 35159 35160 if (ltp) { 35161 throw new Jbig2Error("prediction is not supported"); 35162 } 35163 } 35164 35165 var row = new Uint8Array(width); 35166 bitmap.push(row); 35167 35168 for (var j = 0; j < width; j++) { 35169 var i0, j0; 35170 var contextLabel = 0; 35171 35172 for (k = 0; k < codingTemplateLength; k++) { 35173 i0 = i + codingTemplateY[k]; 35174 j0 = j + codingTemplateX[k]; 35175 35176 if (i0 < 0 || j0 < 0 || j0 >= width) { 35177 contextLabel <<= 1; 35178 } else { 35179 contextLabel = contextLabel << 1 | bitmap[i0][j0]; 35180 } 35181 } 35182 35183 for (k = 0; k < referenceTemplateLength; k++) { 35184 i0 = i + referenceTemplateY[k] - offsetY; 35185 j0 = j + referenceTemplateX[k] - offsetX; 35186 35187 if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) { 35188 contextLabel <<= 1; 35189 } else { 35190 contextLabel = contextLabel << 1 | referenceBitmap[i0][j0]; 35191 } 35192 } 35193 35194 var pixel = decoder.readBit(contexts, contextLabel); 35195 row[j] = pixel; 35196 } 35197 } 35198 35199 return bitmap; 35200 } 35201 35202 function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) { 35203 if (huffman && refinement) { 35204 throw new Jbig2Error("symbol refinement with Huffman is not supported"); 35205 } 35206 35207 var newSymbols = []; 35208 var currentHeight = 0; 35209 var symbolCodeLength = (0, _core_utils.log2)(symbols.length + numberOfNewSymbols); 35210 var decoder = decodingContext.decoder; 35211 var contextCache = decodingContext.contextCache;
35212 let tableB1, symbolWidths; 35213 35214 if (huffman) { 35215 tableB1 = getStandardTable(1); 35216 symbolWidths = []; 35217 symbolCodeLength = Math.max(symbolCodeLength, 1); 35218 } 35219 35220 while (newSymbols.length < numberOfNewSymbols) { 35221 var deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder); 35222 currentHeight += deltaHeight; 35223 let currentWidth = 0, 35224 totalWidth = 0; 35225 const firstSymbol = huffman ? symbolWidths.length : 0; 35226 35227 while (true) { 35228 var deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder); 35229 35230 if (deltaWidth === null) { 35231 break; 35232 } 35233 35234 currentWidth += deltaWidth; 35235 totalWidth += currentWidth; 35236 var bitmap; 35237 35238 if (refinement) { 35239 var numberOfInstances = decodeInteger(contextCache, "IAAI", decoder); 35240 35241 if (numberOfInstances > 1) { 35242 bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput); 35243 } else { 35244 var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength); 35245 var rdx = decodeInteger(contextCache, "IARDX", decoder); 35246 var rdy = decodeInteger(contextCache, "IARDY", decoder); 35247 var symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length]; 35248 bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext); 35249 } 35250 35251 newSymbols.push(bitmap); 35252 } else if (huffman) { 35253 symbolWidths.push(currentWidth); 35254 } else { 35255 bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext); 35256 newSymbols.push(bitmap); 35257 } 35258 } 35259 35260 if (huffman && !refinement) { 35261 const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput); 35262 huffmanInput.byteAlign(); 35263 let collectiveBitmap; 35264 35265 if (bitmapSize === 0) { 35266 collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight); 35267 } else { 35268 const originalEnd = huffmanInput.end; 35269 const bitmapEnd = huffmanInput.position + bitmapSize; 35270 huffmanInput.end = bitmapEnd; 35271 collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false); 35272 huffmanInput.end = originalEnd; 35273 huffmanInput.position = bitmapEnd; 35274 } 35275 35276 const numberOfSymbolsDecoded = symbolWidths.length; 35277 35278 if (firstSymbol === numberOfSymbolsDecoded - 1) { 35279 newSymbols.push(collectiveBitmap); 35280 } else { 35281 let i, 35282 y, 35283 xMin = 0, 35284 xMax, 35285 bitmapWidth, 35286 symbolBitmap; 35287 35288 for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) { 35289 bitmapWidth = symbolWidths[i]; 35290 xMax = xMin + bitmapWidth; 35291 symbolBitmap = []; 35292 35293 for (y = 0; y < currentHeight; y++) { 35294 symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax)); 35295 } 35296 35297 newSymbols.push(symbolBitmap); 35298 xMin = xMax; 35299 } 35300 } 35301 } 35302 } 35303 35304 var exportedSymbols = []; 35305 var flags = [], 35306 currentFlag = false; 35307 var totalSymbolsLength = symbols.length + numberOfNewSymbols; 35308 35309 while (flags.length < totalSymbolsLength) { 35310 var runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder); 35311 35312 while (runLength--) { 35313 flags.push(currentFlag); 35314 } 35315 35316 currentFlag = !currentFlag; 35317 } 35318 35319 for (var i = 0, ii = symbols.length; i < ii; i++) { 35320 if (flags[i]) { 35321 exportedSymbols.push(symbols[i]); 35322 } 35323 } 35324 35325 for (var j = 0; j < numberOfNewSymbols; i++, j++) { 35326 if (flags[i]) { 35327 exportedSymbols.push(newSymbols[j]); 35328 } 35329 } 35330 35331 return exportedSymbols; 35332 } 35333 35334 function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) { 35335 if (huffman && refinement) { 35336 throw new Jbig2Error("refinement with Huffman is not supported"); 35337 } 35338 35339 var bitmap = []; 35340 var i, row; 35341 35342 for (i = 0; i < height; i++) { 35343 row = new Uint8Array(width); 35344 35345 if (defaultPixelValue) { 35346 for (var j = 0; j < width; j++) { 35347 row[j] = defaultPixelValue; 35348 } 35349 } 35350 35351 bitmap.push(row); 35352 } 35353 35354 var decoder = decodingContext.decoder; 35355 var contextCache = decodingContext.contextCache; 35356 var stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder); 35357 var firstS = 0; 35358 i = 0; 35359 35360 while (i < numberOfSymbolInstances) { 35361 var deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder);
35362 stripT += deltaT; 35363 var deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder); 35364 firstS += deltaFirstS; 35365 var currentS = firstS; 35366 35367 do { 35368 let currentT = 0; 35369 35370 if (stripSize > 1) { 35371 currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder); 35372 } 35373 35374 var t = stripSize * stripT + currentT; 35375 var symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength); 35376 var applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder)); 35377 var symbolBitmap = inputSymbols[symbolId]; 35378 var symbolWidth = symbolBitmap[0].length; 35379 var symbolHeight = symbolBitmap.length; 35380 35381 if (applyRefinement) { 35382 var rdw = decodeInteger(contextCache, "IARDW", decoder); 35383 var rdh = decodeInteger(contextCache, "IARDH", decoder); 35384 var rdx = decodeInteger(contextCache, "IARDX", decoder); 35385 var rdy = decodeInteger(contextCache, "IARDY", decoder); 35386 symbolWidth += rdw; 35387 symbolHeight += rdh; 35388 symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext); 35389 } 35390 35391 var offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1); 35392 var offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0); 35393 var s2, t2, symbolRow; 35394 35395 if (transposed) { 35396 for (s2 = 0; s2 < symbolHeight; s2++) { 35397 row = bitmap[offsetS + s2]; 35398 35399 if (!row) { 35400 continue; 35401 } 35402 35403 symbolRow = symbolBitmap[s2]; 35404 var maxWidth = Math.min(width - offsetT, symbolWidth); 35405 35406 switch (combinationOperator) { 35407 case 0: 35408 for (t2 = 0; t2 < maxWidth; t2++) { 35409 row[offsetT + t2] |= symbolRow[t2]; 35410 } 35411 35412 break; 35413 35414 case 2: 35415 for (t2 = 0; t2 < maxWidth; t2++) { 35416 row[offsetT + t2] ^= symbolRow[t2]; 35417 } 35418 35419 break; 35420 35421 default: 35422 throw new Jbig2Error(`operator ${combinationOperator} is not supported`); 35423 } 35424 } 35425 35426 currentS += symbolHeight - 1; 35427 } else { 35428 for (t2 = 0; t2 < symbolHeight; t2++) { 35429 row = bitmap[offsetT + t2]; 35430 35431 if (!row) { 35432 continue; 35433 } 35434 35435 symbolRow = symbolBitmap[t2]; 35436 35437 switch (combinationOperator) { 35438 case 0: 35439 for (s2 = 0; s2 < symbolWidth; s2++) { 35440 row[offsetS + s2] |= symbolRow[s2]; 35441 } 35442 35443 break; 35444 35445 case 2: 35446 for (s2 = 0; s2 < symbolWidth; s2++) { 35447 row[offsetS + s2] ^= symbolRow[s2]; 35448 } 35449 35450 break; 35451 35452 default: 35453 throw new Jbig2Error(`operator ${combinationOperator} is not supported`); 35454 } 35455 } 35456 35457 currentS += symbolWidth - 1; 35458 } 35459 35460 i++; 35461 var deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder); 35462 35463 if (deltaS === null) { 35464 break; 35465 } 35466 35467 currentS += deltaS + dsOffset; 35468 } while (true); 35469 } 35470 35471 return bitmap; 35472 } 35473 35474 function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) { 35475 const at = []; 35476 35477 if (!mmr) { 35478 at.push({ 35479 x: -patternWidth, 35480 y: 0 35481 }); 35482 35483 if (template === 0) { 35484 at.push({ 35485 x: -3, 35486 y: -1 35487 }); 35488 at.push({ 35489 x: 2, 35490 y: -2 35491 }); 35492 at.push({ 35493 x: -2, 35494 y: -2 35495 }); 35496 } 35497 } 35498 35499 const collectiveWidth = (maxPatternIndex + 1) * patternWidth;
vendor: 13,871 bytes, lines 35500-35930
35500 const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext); 35501 const patterns = []; 35502 35503 for (let i = 0; i <= maxPatternIndex; i++) { 35504 const patternBitmap = []; 35505 const xMin = patternWidth * i; 35506 const xMax = xMin + patternWidth; 35507 35508 for (let y = 0; y < patternHeight; y++) { 35509 patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax)); 35510 } 35511 35512 patterns.push(patternBitmap); 35513 } 35514 35515 return patterns; 35516 } 35517 35518 function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) { 35519 const skip = null; 35520 35521 if (enableSkip) { 35522 throw new Jbig2Error("skip is not supported"); 35523 } 35524 35525 if (combinationOperator !== 0) { 35526 throw new Jbig2Error("operator " + combinationOperator + " is not supported in halftone region"); 35527 } 35528 35529 const regionBitmap = []; 35530 let i, j, row; 35531 35532 for (i = 0; i < regionHeight; i++) { 35533 row = new Uint8Array(regionWidth); 35534 35535 if (defaultPixelValue) { 35536 for (j = 0; j < regionWidth; j++) { 35537 row[j] = defaultPixelValue; 35538 } 35539 } 35540 35541 regionBitmap.push(row); 35542 } 35543 35544 const numberOfPatterns = patterns.length; 35545 const pattern0 = patterns[0]; 35546 const patternWidth = pattern0[0].length, 35547 patternHeight = pattern0.length; 35548 const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns); 35549 const at = []; 35550 35551 if (!mmr) { 35552 at.push({ 35553 x: template <= 1 ? 3 : 2, 35554 y: -1 35555 }); 35556 35557 if (template === 0) { 35558 at.push({ 35559 x: -3, 35560 y: -1 35561 }); 35562 at.push({ 35563 x: 2, 35564 y: -2 35565 }); 35566 at.push({ 35567 x: -2, 35568 y: -2 35569 }); 35570 } 35571 } 35572 35573 const grayScaleBitPlanes = []; 35574 let mmrInput, bitmap; 35575 35576 if (mmr) { 35577 mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end); 35578 } 35579 35580 for (i = bitsPerValue - 1; i >= 0; i--) { 35581 if (mmr) { 35582 bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true); 35583 } else { 35584 bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext); 35585 } 35586 35587 grayScaleBitPlanes[i] = bitmap; 35588 } 35589 35590 let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow; 35591 35592 for (mg = 0; mg < gridHeight; mg++) { 35593 for (ng = 0; ng < gridWidth; ng++) { 35594 bit = 0; 35595 patternIndex = 0; 35596 35597 for (j = bitsPerValue - 1; j >= 0; j--) { 35598 bit = grayScaleBitPlanes[j][mg][ng] ^ bit; 35599 patternIndex |= bit << j; 35600 } 35601 35602 patternBitmap = patterns[patternIndex]; 35603 x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8; 35604 y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8; 35605 35606 if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) { 35607 for (i = 0; i < patternHeight; i++) { 35608 regionRow = regionBitmap[y + i]; 35609 patternRow = patternBitmap[i]; 35610 35611 for (j = 0; j < patternWidth; j++) { 35612 regionRow[x + j] |= patternRow[j]; 35613 } 35614 } 35615 } else { 35616 let regionX, regionY; 35617 35618 for (i = 0; i < patternHeight; i++) { 35619 regionY = y + i; 35620 35621 if (regionY < 0 || regionY >= regionHeight) { 35622 continue; 35623 } 35624 35625 regionRow = regionBitmap[regionY]; 35626 patternRow = patternBitmap[i]; 35627 35628 for (j = 0; j < patternWidth; j++) { 35629 regionX = x + j; 35630 35631 if (regionX >= 0 && regionX < regionWidth) { 35632 regionRow[regionX] |= patternRow[j]; 35633 } 35634 } 35635 } 35636 } 35637 } 35638 } 35639 35640 return regionBitmap; 35641 } 35642 35643 function readSegmentHeader(data, start) { 35644 var segmentHeader = {}; 35645 segmentHeader.number = (0, _core_utils.readUint32)(data, start); 35646 var flags = data[start + 4]; 35647 var segmentType = flags & 0x3f; 35648 35649 if (!SegmentTypes[segmentType]) { 35650 throw new Jbig2Error("invalid segment type: " + segmentType); 35651 } 35652 35653 segmentHeader.type = segmentType; 35654 segmentHeader.typeName = SegmentTypes[segmentType]; 35655 segmentHeader.deferredNonRetain = !!(flags & 0x80); 35656 var pageAssociationFieldSize = !!(flags & 0x40); 35657 var referredFlags = data[start + 5]; 35658 var referredToCount = referredFlags >> 5 & 7; 35659 var retainBits = [referredFlags & 31]; 35660 var position = start + 6; 35661 35662 if (referredFlags === 7) { 35663 referredToCount = (0, _core_utils.readUint32)(data, position - 1) & 0x1fffffff; 35664 position += 3; 35665 var bytes = referredToCount + 7 >> 3; 35666 retainBits[0] = data[position++]; 35667 35668 while (--bytes > 0) { 35669 retainBits.push(data[position++]); 35670 } 35671 } else if (referredFlags === 5 || referredFlags === 6) { 35672 throw new Jbig2Error("invalid referred-to flags"); 35673 } 35674 35675 segmentHeader.retainBits = retainBits; 35676 let referredToSegmentNumberSize = 4; 35677 35678 if (segmentHeader.number <= 256) { 35679 referredToSegmentNumberSize = 1; 35680 } else if (segmentHeader.number <= 65536) { 35681 referredToSegmentNumberSize = 2; 35682 } 35683 35684 var referredTo = []; 35685 var i, ii; 35686 35687 for (i = 0; i < referredToCount; i++) { 35688 let number; 35689 35690 if (referredToSegmentNumberSize === 1) { 35691 number = data[position]; 35692 } else if (referredToSegmentNumberSize === 2) { 35693 number = (0, _core_utils.readUint16)(data, position); 35694 } else { 35695 number = (0, _core_utils.readUint32)(data, position); 35696 } 35697 35698 referredTo.push(number); 35699 position += referredToSegmentNumberSize; 35700 } 35701 35702 segmentHeader.referredTo = referredTo; 35703 35704 if (!pageAssociationFieldSize) { 35705 segmentHeader.pageAssociation = data[position++]; 35706 } else { 35707 segmentHeader.pageAssociation = (0, _core_utils.readUint32)(data, position); 35708 position += 4; 35709 } 35710 35711 segmentHeader.length = (0, _core_utils.readUint32)(data, position); 35712 position += 4; 35713 35714 if (segmentHeader.length === 0xffffffff) { 35715 if (segmentType === 38) { 35716 var genericRegionInfo = readRegionSegmentInformation(data, position); 35717 var genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength]; 35718 var genericRegionMmr = !!(genericRegionSegmentFlags & 1); 35719 var searchPatternLength = 6; 35720 var searchPattern = new Uint8Array(searchPatternLength); 35721 35722 if (!genericRegionMmr) { 35723 searchPattern[0] = 0xff; 35724 searchPattern[1] = 0xac; 35725 } 35726 35727 searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff; 35728 searchPattern[3] = genericRegionInfo.height >> 16 & 0xff; 35729 searchPattern[4] = genericRegionInfo.height >> 8 & 0xff; 35730 searchPattern[5] = genericRegionInfo.height & 0xff; 35731 35732 for (i = position, ii = data.length; i < ii; i++) { 35733 var j = 0; 35734 35735 while (j < searchPatternLength && searchPattern[j] === data[i + j]) { 35736 j++; 35737 } 35738 35739 if (j === searchPatternLength) { 35740 segmentHeader.length = i + searchPatternLength; 35741 break; 35742 } 35743 } 35744 35745 if (segmentHeader.length === 0xffffffff) { 35746 throw new Jbig2Error("segment end was not found"); 35747 } 35748 } else { 35749 throw new Jbig2Error("invalid unknown segment length"); 35750 } 35751 } 35752 35753 segmentHeader.headerEnd = position; 35754 return segmentHeader; 35755 } 35756 35757 function readSegments(header, data, start, end) { 35758 var segments = []; 35759 var position = start; 35760 35761 while (position < end) { 35762 var segmentHeader = readSegmentHeader(data, position); 35763 position = segmentHeader.headerEnd; 35764 var segment = { 35765 header: segmentHeader, 35766 data 35767 }; 35768 35769 if (!header.randomAccess) { 35770 segment.start = position; 35771 position += segmentHeader.length; 35772 segment.end = position; 35773 } 35774 35775 segments.push(segment); 35776 35777 if (segmentHeader.type === 51) { 35778 break; 35779 } 35780 } 35781 35782 if (header.randomAccess) { 35783 for (var i = 0, ii = segments.length; i < ii; i++) { 35784 segments[i].start = position; 35785 position += segments[i].header.length; 35786 segments[i].end = position; 35787 } 35788 } 35789 35790 return segments; 35791 } 35792 35793 function readRegionSegmentInformation(data, start) { 35794 return { 35795 width: (0, _core_utils.readUint32)(data, start), 35796 height: (0, _core_utils.readUint32)(data, start + 4), 35797 x: (0, _core_utils.readUint32)(data, start + 8), 35798 y: (0, _core_utils.readUint32)(data, start + 12), 35799 combinationOperator: data[start + 16] & 7 35800 }; 35801 } 35802 35803 var RegionSegmentInformationFieldLength = 17; 35804 35805 function processSegment(segment, visitor) { 35806 var header = segment.header; 35807 var data = segment.data, 35808 position = segment.start, 35809 end = segment.end; 35810 var args, at, i, atLength; 35811 35812 switch (header.type) { 35813 case 0: 35814 var dictionary = {}; 35815 var dictionaryFlags = (0, _core_utils.readUint16)(data, position); 35816 dictionary.huffman = !!(dictionaryFlags & 1); 35817 dictionary.refinement = !!(dictionaryFlags & 2); 35818 dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3; 35819 dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3; 35820 dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1; 35821 dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1; 35822 dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256); 35823 dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512); 35824 dictionary.template = dictionaryFlags >> 10 & 3; 35825 dictionary.refinementTemplate = dictionaryFlags >> 12 & 1; 35826 position += 2; 35827 35828 if (!dictionary.huffman) { 35829 atLength = dictionary.template === 0 ? 4 : 1; 35830 at = []; 35831 35832 for (i = 0; i < atLength; i++) { 35833 at.push({ 35834 x: (0, _core_utils.readInt8)(data, position), 35835 y: (0, _core_utils.readInt8)(data, position + 1) 35836 }); 35837 position += 2; 35838 } 35839 35840 dictionary.at = at; 35841 } 35842 35843 if (dictionary.refinement && !dictionary.refinementTemplate) { 35844 at = []; 35845 35846 for (i = 0; i < 2; i++) { 35847 at.push({ 35848 x: (0, _core_utils.readInt8)(data, position), 35849 y: (0, _core_utils.readInt8)(data, position + 1) 35850 }); 35851 position += 2; 35852 } 35853 35854 dictionary.refinementAt = at; 35855 } 35856 35857 dictionary.numberOfExportedSymbols = (0, _core_utils.readUint32)(data, position); 35858 position += 4; 35859 dictionary.numberOfNewSymbols = (0, _core_utils.readUint32)(data, position); 35860 position += 4; 35861 args = [dictionary, header.number, header.referredTo, data, position, end]; 35862 break; 35863 35864 case 6: 35865 case 7: 35866 var textRegion = {}; 35867 textRegion.info = readRegionSegmentInformation(data, position); 35868 position += RegionSegmentInformationFieldLength; 35869 var textRegionSegmentFlags = (0, _core_utils.readUint16)(data, position); 35870 position += 2; 35871 textRegion.huffman = !!(textRegionSegmentFlags & 1); 35872 textRegion.refinement = !!(textRegionSegmentFlags & 2); 35873 textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3; 35874 textRegion.stripSize = 1 << textRegion.logStripSize; 35875 textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3; 35876 textRegion.transposed = !!(textRegionSegmentFlags & 64); 35877 textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3; 35878 textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1; 35879 textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27; 35880 textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1; 35881 35882 if (textRegion.huffman) { 35883 var textRegionHuffmanFlags = (0, _core_utils.readUint16)(data, position); 35884 position += 2; 35885 textRegion.huffmanFS = textRegionHuffmanFlags & 3; 35886 textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3; 35887 textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3; 35888 textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3; 35889 textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3; 35890 textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3; 35891 textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3; 35892 textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000); 35893 } 35894 35895 if (textRegion.refinement && !textRegion.refinementTemplate) { 35896 at = []; 35897 35898 for (i = 0; i < 2; i++) { 35899 at.push({ 35900 x: (0, _core_utils.readInt8)(data, position), 35901 y: (0, _core_utils.readInt8)(data, position + 1) 35902 }); 35903 position += 2; 35904 } 35905 35906 textRegion.refinementAt = at; 35907 } 35908 35909 textRegion.numberOfSymbolInstances = (0, _core_utils.readUint32)(data, position); 35910 position += 4; 35911 args = [textRegion, header.referredTo, data, position, end]; 35912 break; 35913 35914 case 16: 35915 const patternDictionary = {}; 35916 const patternDictionaryFlags = data[position++]; 35917 patternDictionary.mmr = !!(patternDictionaryFlags & 1); 35918 patternDictionary.template = patternDictionaryFlags >> 1 & 3; 35919 patternDictionary.patternWidth = data[position++]; 35920 patternDictionary.patternHeight = data[position++]; 35921 patternDictionary.maxPatternIndex = (0, _core_utils.readUint32)(data, position); 35922 position += 4; 35923 args = [patternDictionary, header.number, data, position, end]; 35924 break; 35925 35926 case 22: 35927 case 23: 35928 const halftoneRegion = {}; 35929 halftoneRegion.info = readRegionSegmentInformation(data, position); 35930 position += RegionSegmentInformationFieldLength;
35931 const halftoneRegionFlags = data[position++]; 35932 halftoneRegion.mmr = !!(halftoneRegionFlags & 1); 35933 halftoneRegion.template = halftoneRegionFlags >> 1 & 3; 35934 halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8); 35935 halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7; 35936 halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1; 35937 halftoneRegion.gridWidth = (0, _core_utils.readUint32)(data, position); 35938 position += 4; 35939 halftoneRegion.gridHeight = (0, _core_utils.readUint32)(data, position); 35940 position += 4; 35941 halftoneRegion.gridOffsetX = (0, _core_utils.readUint32)(data, position) & 0xffffffff; 35942 position += 4; 35943 halftoneRegion.gridOffsetY = (0, _core_utils.readUint32)(data, position) & 0xffffffff; 35944 position += 4; 35945 halftoneRegion.gridVectorX = (0, _core_utils.readUint16)(data, position); 35946 position += 2; 35947 halftoneRegion.gridVectorY = (0, _core_utils.readUint16)(data, position); 35948 position += 2; 35949 args = [halftoneRegion, header.referredTo, data, position, end]; 35950 break; 35951 35952 case 38: 35953 case 39: 35954 var genericRegion = {}; 35955 genericRegion.info = readRegionSegmentInformation(data, position); 35956 position += RegionSegmentInformationFieldLength; 35957 var genericRegionSegmentFlags = data[position++]; 35958 genericRegion.mmr = !!(genericRegionSegmentFlags & 1); 35959 genericRegion.template = genericRegionSegmentFlags >> 1 & 3; 35960 genericRegion.prediction = !!(genericRegionSegmentFlags & 8); 35961 35962 if (!genericRegion.mmr) { 35963 atLength = genericRegion.template === 0 ? 4 : 1; 35964 at = []; 35965 35966 for (i = 0; i < atLength; i++) { 35967 at.push({ 35968 x: (0, _core_utils.readInt8)(data, position), 35969 y: (0, _core_utils.readInt8)(data, position + 1) 35970 }); 35971 position += 2; 35972 } 35973 35974 genericRegion.at = at; 35975 } 35976 35977 args = [genericRegion, data, position, end]; 35978 break; 35979 35980 case 48: 35981 var pageInfo = { 35982 width: (0, _core_utils.readUint32)(data, position), 35983 height: (0, _core_utils.readUint32)(data, position + 4), 35984 resolutionX: (0, _core_utils.readUint32)(data, position + 8), 35985 resolutionY: (0, _core_utils.readUint32)(data, position + 12) 35986 }; 35987 35988 if (pageInfo.height === 0xffffffff) { 35989 delete pageInfo.height; 35990 } 35991 35992 var pageSegmentFlags = data[position + 16]; 35993 (0, _core_utils.readUint16)(data, position + 17); 35994 pageInfo.lossless = !!(pageSegmentFlags & 1); 35995 pageInfo.refinement = !!(pageSegmentFlags & 2); 35996 pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1; 35997 pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3; 35998 pageInfo.requiresBuffer = !!(pageSegmentFlags & 32); 35999 pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64); 36000 args = [pageInfo]; 36001 break; 36002 36003 case 49: 36004 break; 36005 36006 case 50: 36007 break; 36008 36009 case 51: 36010 break; 36011 36012 case 53: 36013 args = [header.number, data, position, end]; 36014 break; 36015 36016 case 62: 36017 break; 36018 36019 default: 36020 throw new Jbig2Error(`segment type ${header.typeName}(${header.type})` + " is not implemented"); 36021 } 36022 36023 var callbackName = "on" + header.typeName; 36024 36025 if (callbackName in visitor) { 36026 visitor[callbackName].apply(visitor, args); 36027 } 36028 } 36029 36030 function processSegments(segments, visitor) { 36031 for (var i = 0, ii = segments.length; i < ii; i++) { 36032 processSegment(segments[i], visitor); 36033 } 36034 } 36035 36036 function parseJbig2Chunks(chunks) { 36037 var visitor = new SimpleSegmentVisitor(); 36038 36039 for (var i = 0, ii = chunks.length; i < ii; i++) { 36040 var chunk = chunks[i]; 36041 var segments = readSegments({}, chunk.data, chunk.start, chunk.end); 36042 processSegments(segments, visitor); 36043 } 36044 36045 return visitor.buffer; 36046 } 36047 36048 function parseJbig2(data) { 36049 const end = data.length; 36050 let position = 0; 36051 36052 if (data[position] !== 0x97 || data[position + 1] !== 0x4a || data[position + 2] !== 0x42 || data[position + 3] !== 0x32 || data[position + 4] !== 0x0d || data[position + 5] !== 0x0a || data[position + 6] !== 0x1a || data[position + 7] !== 0x0a) { 36053 throw new Jbig2Error("parseJbig2 - invalid header."); 36054 } 36055 36056 const header = Object.create(null); 36057 position += 8; 36058 const flags = data[position++]; 36059 header.randomAccess = !(flags & 1); 36060 36061 if (!(flags & 2)) { 36062 header.numberOfPages = (0, _core_utils.readUint32)(data, position); 36063 position += 4; 36064 } 36065 36066 const segments = readSegments(header, data, position, end); 36067 const visitor = new SimpleSegmentVisitor(); 36068 processSegments(segments, visitor); 36069 const { 36070 width, 36071 height 36072 } = visitor.currentPageInfo; 36073 const bitPacked = visitor.buffer; 36074 const imgData = new Uint8ClampedArray(width * height); 36075 let q = 0, 36076 k = 0; 36077 36078 for (let i = 0; i < height; i++) { 36079 let mask = 0, 36080 buffer; 36081 36082 for (let j = 0; j < width; j++) { 36083 if (!mask) { 36084 mask = 128; 36085 buffer = bitPacked[k++]; 36086 } 36087
36088 imgData[q++] = buffer & mask ? 0 : 255; 36089 mask >>= 1; 36090 } 36091 } 36092 36093 return { 36094 imgData, 36095 width, 36096 height 36097 }; 36098 } 36099 36100 function SimpleSegmentVisitor() {} 36101 36102 SimpleSegmentVisitor.prototype = { 36103 onPageInformation: function SimpleSegmentVisitor_onPageInformation(info) { 36104 this.currentPageInfo = info; 36105 var rowSize = info.width + 7 >> 3; 36106 var buffer = new Uint8ClampedArray(rowSize * info.height); 36107 36108 if (info.defaultPixelValue) { 36109 for (var i = 0, ii = buffer.length; i < ii; i++) { 36110 buffer[i] = 0xff; 36111 } 36112 } 36113 36114 this.buffer = buffer; 36115 }, 36116 drawBitmap: function SimpleSegmentVisitor_drawBitmap(regionInfo, bitmap) { 36117 var pageInfo = this.currentPageInfo; 36118 var width = regionInfo.width, 36119 height = regionInfo.height; 36120 var rowSize = pageInfo.width + 7 >> 3; 36121 var combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator; 36122 var buffer = this.buffer; 36123 var mask0 = 128 >> (regionInfo.x & 7); 36124 var offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3); 36125 var i, j, mask, offset; 36126 36127 switch (combinationOperator) { 36128 case 0: 36129 for (i = 0; i < height; i++) { 36130 mask = mask0; 36131 offset = offset0; 36132 36133 for (j = 0; j < width; j++) { 36134 if (bitmap[i][j]) { 36135 buffer[offset] |= mask; 36136 } 36137 36138 mask >>= 1; 36139 36140 if (!mask) { 36141 mask = 128; 36142 offset++; 36143 } 36144 } 36145 36146 offset0 += rowSize; 36147 } 36148 36149 break; 36150 36151 case 2: 36152 for (i = 0; i < height; i++) { 36153 mask = mask0; 36154 offset = offset0; 36155 36156 for (j = 0; j < width; j++) { 36157 if (bitmap[i][j]) { 36158 buffer[offset] ^= mask; 36159 } 36160 36161 mask >>= 1; 36162 36163 if (!mask) { 36164 mask = 128; 36165 offset++; 36166 } 36167 } 36168 36169 offset0 += rowSize; 36170 } 36171 36172 break; 36173 36174 default: 36175 throw new Jbig2Error(`operator ${combinationOperator} is not supported`); 36176 } 36177 }, 36178 onImmediateGenericRegion: function SimpleSegmentVisitor_onImmediateGenericRegion(region, data, start, end) { 36179 var regionInfo = region.info; 36180 var decodingContext = new DecodingContext(data, start, end); 36181 var bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext); 36182 this.drawBitmap(regionInfo, bitmap); 36183 }, 36184 onImmediateLosslessGenericRegion: function SimpleSegmentVisitor_onImmediateLosslessGenericRegion() { 36185 this.onImmediateGenericRegion.apply(this, arguments); 36186 }, 36187 onSymbolDictionary: function SimpleSegmentVisitor_onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) { 36188 let huffmanTables, huffmanInput; 36189 36190 if (dictionary.huffman) { 36191 huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables); 36192 huffmanInput = new Reader(data, start, end); 36193 } 36194 36195 var symbols = this.symbols; 36196 36197 if (!symbols) { 36198 this.symbols = symbols = {}; 36199 } 36200 36201 var inputSymbols = []; 36202 36203 for (var i = 0, ii = referredSegments.length; i < ii; i++) { 36204 const referredSymbols = symbols[referredSegments[i]]; 36205 36206 if (referredSymbols) { 36207 inputSymbols = inputSymbols.concat(referredSymbols); 36208 } 36209 } 36210 36211 var decodingContext = new DecodingContext(data, start, end); 36212 symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput); 36213 }, 36214 onImmediateTextRegion: function SimpleSegmentVisitor_onImmediateTextRegion(region, referredSegments, data, start, end) { 36215 var regionInfo = region.info; 36216 let huffmanTables, huffmanInput; 36217 var symbols = this.symbols; 36218 var inputSymbols = []; 36219 36220 for (var i = 0, ii = referredSegments.length; i < ii; i++) { 36221 const referredSymbols = symbols[referredSegments[i]]; 36222 36223 if (referredSymbols) { 36224 inputSymbols = inputSymbols.concat(referredSymbols); 36225 } 36226 } 36227 36228 var symbolCodeLength = (0, _core_utils.log2)(inputSymbols.length); 36229 36230 if (region.huffman) { 36231 huffmanInput = new Reader(data, start, end); 36232 huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput); 36233 } 36234 36235 var decodingContext = new DecodingContext(data, start, end); 36236 var bitmap = decodeTextRegion(region.huffman, region.refinement, regionInfo.width, regionInfo.height, region.defaultPixelValue, region.numberOfSymbolInstances, region.stripSize, inputSymbols, symbolCodeLength, region.transposed, region.dsOffset, region.referenceCorner, region.combinationOperator, huffmanTables, region.refinementTemplate, region.refinementAt, decodingContext, region.logStripSize, huffmanInput); 36237 this.drawBitmap(regionInfo, bitmap); 36238 }, 36239 onImmediateLosslessTextRegion: function SimpleSegmentVisitor_onImmediateLosslessTextRegion() { 36240 this.onImmediateTextRegion.apply(this, arguments); 36241 }, 36242 36243 onPatternDictionary(dictionary, currentSegment, data, start, end) { 36244 let patterns = this.patterns; 36245 36246 if (!patterns) { 36247 this.patterns = patterns = {}; 36248 } 36249 36250 const decodingContext = new DecodingContext(data, start, end); 36251 patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext); 36252 }, 36253 36254 onImmediateHalftoneRegion(region, referredSegments, data, start, end) { 36255 const patterns = this.patterns[referredSegments[0]]; 36256 const regionInfo = region.info; 36257 const decodingContext = new DecodingContext(data, start, end); 36258 const bitmap = decodeHalftoneRegion(region.mmr, patterns, region.template, regionInfo.width, regionInfo.height, region.defaultPixelValue, region.enableSkip, region.combinationOperator, region.gridWidth, region.gridHeight, region.gridOffsetX, region.gridOffsetY, region.gridVectorX, region.gridVectorY, decodingContext); 36259 this.drawBitmap(regionInfo, bitmap); 36260 }, 36261 36262 onImmediateLosslessHalftoneRegion() { 36263 this.onImmediateHalftoneRegion.apply(this, arguments); 36264 }, 36265 36266 onTables(currentSegment, data, start, end) { 36267 let customTables = this.customTables; 36268 36269 if (!customTables) { 36270 this.customTables = customTables = {}; 36271 } 36272 36273 customTables[currentSegment] = decodeTablesSegment(data, start, end); 36274 } 36275 36276 }; 36277 36278 function HuffmanLine(lineData) { 36279 if (lineData.length === 2) { 36280 this.isOOB = true; 36281 this.rangeLow = 0; 36282 this.prefixLength = lineData[0]; 36283 this.rangeLength = 0; 36284 this.prefixCode = lineData[1]; 36285 this.isLowerRange = false;
vendor: 5,173 bytes, lines 36286-36476
36286 } else { 36287 this.isOOB = false; 36288 this.rangeLow = lineData[0]; 36289 this.prefixLength = lineData[1]; 36290 this.rangeLength = lineData[2]; 36291 this.prefixCode = lineData[3]; 36292 this.isLowerRange = lineData[4] === "lower"; 36293 } 36294 } 36295 36296 function HuffmanTreeNode(line) { 36297 this.children = []; 36298 36299 if (line) { 36300 this.isLeaf = true; 36301 this.rangeLength = line.rangeLength; 36302 this.rangeLow = line.rangeLow; 36303 this.isLowerRange = line.isLowerRange; 36304 this.isOOB = line.isOOB; 36305 } else { 36306 this.isLeaf = false; 36307 } 36308 } 36309 36310 HuffmanTreeNode.prototype = { 36311 buildTree(line, shift) { 36312 const bit = line.prefixCode >> shift & 1; 36313 36314 if (shift <= 0) { 36315 this.children[bit] = new HuffmanTreeNode(line); 36316 } else { 36317 let node = this.children[bit]; 36318 36319 if (!node) { 36320 this.children[bit] = node = new HuffmanTreeNode(null); 36321 } 36322 36323 node.buildTree(line, shift - 1); 36324 } 36325 }, 36326 36327 decodeNode(reader) { 36328 if (this.isLeaf) { 36329 if (this.isOOB) { 36330 return null; 36331 } 36332 36333 const htOffset = reader.readBits(this.rangeLength); 36334 return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset); 36335 } 36336 36337 const node = this.children[reader.readBit()]; 36338 36339 if (!node) { 36340 throw new Jbig2Error("invalid Huffman data"); 36341 } 36342 36343 return node.decodeNode(reader); 36344 } 36345 36346 }; 36347 36348 function HuffmanTable(lines, prefixCodesDone) { 36349 if (!prefixCodesDone) { 36350 this.assignPrefixCodes(lines); 36351 } 36352 36353 this.rootNode = new HuffmanTreeNode(null); 36354 36355 for (let i = 0, ii = lines.length; i < ii; i++) { 36356 const line = lines[i]; 36357 36358 if (line.prefixLength > 0) { 36359 this.rootNode.buildTree(line, line.prefixLength - 1); 36360 } 36361 } 36362 } 36363 36364 HuffmanTable.prototype = { 36365 decode(reader) { 36366 return this.rootNode.decodeNode(reader); 36367 }, 36368 36369 assignPrefixCodes(lines) { 36370 const linesLength = lines.length; 36371 let prefixLengthMax = 0; 36372 36373 for (let i = 0; i < linesLength; i++) { 36374 prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength); 36375 } 36376 36377 const histogram = new Uint32Array(prefixLengthMax + 1); 36378 36379 for (let i = 0; i < linesLength; i++) { 36380 histogram[lines[i].prefixLength]++; 36381 } 36382 36383 let currentLength = 1, 36384 firstCode = 0, 36385 currentCode, 36386 currentTemp, 36387 line; 36388 histogram[0] = 0; 36389 36390 while (currentLength <= prefixLengthMax) { 36391 firstCode = firstCode + histogram[currentLength - 1] << 1; 36392 currentCode = firstCode; 36393 currentTemp = 0; 36394 36395 while (currentTemp < linesLength) { 36396 line = lines[currentTemp]; 36397 36398 if (line.prefixLength === currentLength) { 36399 line.prefixCode = currentCode; 36400 currentCode++; 36401 } 36402 36403 currentTemp++; 36404 } 36405 36406 currentLength++; 36407 } 36408 } 36409 36410 }; 36411 36412 function decodeTablesSegment(data, start, end) { 36413 const flags = data[start]; 36414 const lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff; 36415 const highestValue = (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff; 36416 const reader = new Reader(data, start + 9, end); 36417 const prefixSizeBits = (flags >> 1 & 7) + 1; 36418 const rangeSizeBits = (flags >> 4 & 7) + 1; 36419 const lines = []; 36420 let prefixLength, 36421 rangeLength, 36422 currentRangeLow = lowestValue; 36423 36424 do { 36425 prefixLength = reader.readBits(prefixSizeBits); 36426 rangeLength = reader.readBits(rangeSizeBits); 36427 lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0])); 36428 currentRangeLow += 1 << rangeLength; 36429 } while (currentRangeLow < highestValue); 36430 36431 prefixLength = reader.readBits(prefixSizeBits); 36432 lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"])); 36433 prefixLength = reader.readBits(prefixSizeBits); 36434 lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0])); 36435 36436 if (flags & 1) { 36437 prefixLength = reader.readBits(prefixSizeBits); 36438 lines.push(new HuffmanLine([prefixLength, 0])); 36439 } 36440 36441 return new HuffmanTable(lines, false); 36442 } 36443 36444 const standardTablesCache = {}; 36445 36446 function getStandardTable(number) { 36447 let table = standardTablesCache[number]; 36448 36449 if (table) { 36450 return table; 36451 } 36452 36453 let lines; 36454 36455 switch (number) { 36456 case 1: 36457 lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]]; 36458 break; 36459 36460 case 2: 36461 lines = [[0, 1, 0, 0x0], [1, 2, 0, 0x2], [2, 3, 0, 0x6], [3, 4, 3, 0xe], [11, 5, 6, 0x1e], [75, 6, 32, 0x3e], [6, 0x3f]]; 36462 break; 36463 36464 case 3: 36465 lines = [[-256, 8, 8, 0xfe], [0, 1, 0, 0x0], [1, 2, 0, 0x2], [2, 3, 0, 0x6], [3, 4, 3, 0xe], [11, 5, 6, 0x1e], [-257, 8, 32, 0xff, "lower"], [75, 7, 32, 0x7e], [6, 0x3e]]; 36466 break; 36467 36468 case 4: 36469 lines = [[1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 0, 0x6], [4, 4, 3, 0xe], [12, 5, 6, 0x1e], [76, 5, 32, 0x1f]]; 36470 break; 36471 36472 case 5: 36473 lines = [[-255, 7, 8, 0x7e], [1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 0, 0x6], [4, 4, 3, 0xe], [12, 5, 6, 0x1e], [-256, 7, 32, 0x7f, "lower"], [76, 6, 32, 0x3e]]; 36474 break; 36475 36476 case 6:
36477 lines = [[-2048, 5, 10, 0x1c], [-1024, 4, 9, 0x8], [-512, 4, 8, 0x9], [-256, 4, 7, 0xa], [-128, 5, 6, 0x1d], [-64, 5, 5, 0x1e], [-32, 4, 5, 0xb], [0, 2, 7, 0x0], [128, 3, 7, 0x2], [256, 3, 8, 0x3], [512, 4, 9, 0xc], [1024, 4, 10, 0xd], [-2049, 6, 32, 0x3e, "lower"], [2048, 6, 32, 0x3f]]; 36478 break; 36479 36480 case 7: 36481 lines = [[-1024, 4, 9, 0x8], [-512, 3, 8, 0x0], [-256, 4, 7, 0x9], [-128, 5, 6, 0x1a], [-64, 5, 5, 0x1b], [-32, 4, 5, 0xa], [0, 4, 5, 0xb], [32, 5, 5, 0x1c], [64, 5, 6, 0x1d], [128, 4, 7, 0xc], [256, 3, 8, 0x1], [512, 3, 9, 0x2], [1024, 3, 10, 0x3], [-1025, 5, 32, 0x1e, "lower"], [2048, 5, 32, 0x1f]]; 36482 break; 36483 36484 case 8: 36485 lines = [[-15, 8, 3, 0xfc], [-7, 9, 1, 0x1fc], [-5, 8, 1, 0xfd], [-3, 9, 0, 0x1fd], [-2, 7, 0, 0x7c], [-1, 4, 0, 0xa], [0, 2, 1, 0x0], [2, 5, 0, 0x1a], [3, 6, 0, 0x3a], [4, 3, 4, 0x4], [20, 6, 1, 0x3b], [22, 4, 4, 0xb], [38, 4, 5, 0xc], [70, 5, 6, 0x1b], [134, 5, 7, 0x1c], [262, 6, 7, 0x3c], [390, 7, 8, 0x7d], [646, 6, 10, 0x3d], [-16, 9, 32, 0x1fe, "lower"], [1670, 9, 32, 0x1ff], [2, 0x1]]; 36486 break; 36487 36488 case 9: 36489 lines = [[-31, 8, 4, 0xfc], [-15, 9, 2, 0x1fc], [-11, 8, 2, 0xfd], [-7, 9, 1, 0x1fd], [-5, 7, 1, 0x7c], [-3, 4, 1, 0xa], [-1, 3, 1, 0x2], [1, 3, 1, 0x3], [3, 5, 1, 0x1a], [5, 6, 1, 0x3a], [7, 3, 5, 0x4], [39, 6, 2, 0x3b], [43, 4, 5, 0xb], [75, 4, 6, 0xc], [139, 5, 7, 0x1b], [267, 5, 8, 0x1c], [523, 6, 8, 0x3c], [779, 7, 9, 0x7d], [1291, 6, 11, 0x3d], [-32, 9, 32, 0x1fe, "lower"], [3339, 9, 32, 0x1ff], [2, 0x0]]; 36490 break; 36491 36492 case 10: 36493 lines = [[-21, 7, 4, 0x7a], [-5, 8, 0, 0xfc], [-4, 7, 0, 0x7b], [-3, 5, 0, 0x18], [-2, 2, 2, 0x0], [2, 5, 0, 0x19], [3, 6, 0, 0x36], [4, 7, 0, 0x7c], [5, 8, 0, 0xfd], [6, 2, 6, 0x1], [70, 5, 5, 0x1a], [102, 6, 5, 0x37], [134, 6, 6, 0x38], [198, 6, 7, 0x39], [326, 6, 8, 0x3a], [582, 6, 9, 0x3b], [1094, 6, 10, 0x3c], [2118, 7, 11, 0x7d], [-22, 8, 32, 0xfe, "lower"], [4166, 8, 32, 0xff], [2, 0x2]]; 36494 break; 36495 36496 case 11: 36497 lines = [[1, 1, 0, 0x0], [2, 2, 1, 0x2], [4, 4, 0, 0xc], [5, 4, 1, 0xd], [7, 5, 1, 0x1c], [9, 5, 2, 0x1d], [13, 6, 2, 0x3c], [17, 7, 2, 0x7a], [21, 7, 3, 0x7b], [29, 7, 4, 0x7c], [45, 7, 5, 0x7d], [77, 7, 6, 0x7e], [141, 7, 32, 0x7f]]; 36498 break; 36499 36500 case 12: 36501 lines = [[1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 1, 0x6], [5, 5, 0, 0x1c], [6, 5, 1, 0x1d], [8, 6, 1, 0x3c], [10, 7, 0, 0x7a], [11, 7, 1, 0x7b], [13, 7, 2, 0x7c], [17, 7, 3, 0x7d], [25, 7, 4, 0x7e], [41, 8, 5, 0xfe], [73, 8, 32, 0xff]]; 36502 break; 36503 36504 case 13: 36505 lines = [[1, 1, 0, 0x0], [2, 3, 0, 0x4], [3, 4, 0, 0xc], [4, 5, 0, 0x1c], [5, 4, 1, 0xd], [7, 3, 3, 0x5], [15, 6, 1, 0x3a], [17, 6, 2, 0x3b], [21, 6, 3, 0x3c], [29, 6, 4, 0x3d], [45, 6, 5, 0x3e], [77, 7, 6, 0x7e], [141, 7, 32, 0x7f]]; 36506 break; 36507 36508 case 14: 36509 lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]]; 36510 break; 36511 36512 case 15: 36513 lines = [[-24, 7, 4, 0x7c], [-8, 6, 2, 0x3c], [-4, 5, 1, 0x1c], [-2, 4, 0, 0xc], [-1, 3, 0, 0x4], [0, 1, 0, 0x0], [1, 3, 0, 0x5], [2, 4, 0, 0xd], [3, 5, 1, 0x1d], [5, 6, 2, 0x3d], [9, 7, 4, 0x7d], [-25, 7, 32, 0x7e, "lower"], [25, 7, 32, 0x7f]]; 36514 break; 36515 36516 default: 36517 throw new Jbig2Error(`standard table B.${number} does not exist`); 36518 } 36519 36520 for (let i = 0, ii = lines.length; i < ii; i++) { 36521 lines[i] = new HuffmanLine(lines[i]); 36522 } 36523 36524 table = new HuffmanTable(lines, true); 36525 standardTablesCache[number] = table; 36526 return table; 36527 } 36528 36529 function Reader(data, start, end) { 36530 this.data = data; 36531 this.start = start; 36532 this.end = end; 36533 this.position = start; 36534 this.shift = -1; 36535 this.currentByte = 0; 36536 } 36537 36538 Reader.prototype = { 36539 readBit() { 36540 if (this.shift < 0) { 36541 if (this.position >= this.end) { 36542 throw new Jbig2Error("end of data while reading bit"); 36543 } 36544 36545 this.currentByte = this.data[this.position++]; 36546 this.shift = 7; 36547 } 36548 36549 const bit = this.currentByte >> this.shift & 1; 36550 this.shift--; 36551 return bit; 36552 }, 36553 36554 readBits(numBits) { 36555 let result = 0, 36556 i; 36557 36558 for (i = numBits - 1; i >= 0; i--) { 36559 result |= this.readBit() << i; 36560 } 36561 36562 return result; 36563 }, 36564 36565 byteAlign() { 36566 this.shift = -1; 36567 }, 36568 36569 next() { 36570 if (this.position >= this.end) { 36571 return -1; 36572 } 36573 36574 return this.data[this.position++]; 36575 } 36576 36577 }; 36578 36579 function getCustomHuffmanTable(index, referredTo, customTables) {
vendor: 3,357 bytes, lines 36580-36714
36580 let currentIndex = 0; 36581 36582 for (let i = 0, ii = referredTo.length; i < ii; i++) { 36583 const table = customTables[referredTo[i]]; 36584 36585 if (table) { 36586 if (index === currentIndex) { 36587 return table; 36588 } 36589 36590 currentIndex++; 36591 } 36592 } 36593 36594 throw new Jbig2Error("can't find custom Huffman table"); 36595 } 36596 36597 function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) { 36598 const codes = []; 36599 36600 for (let i = 0; i <= 34; i++) { 36601 const codeLength = reader.readBits(4); 36602 codes.push(new HuffmanLine([i, codeLength, 0, 0])); 36603 } 36604 36605 const runCodesTable = new HuffmanTable(codes, false); 36606 codes.length = 0; 36607 36608 for (let i = 0; i < numberOfSymbols;) { 36609 const codeLength = runCodesTable.decode(reader); 36610 36611 if (codeLength >= 32) { 36612 let repeatedLength, numberOfRepeats, j; 36613 36614 switch (codeLength) { 36615 case 32: 36616 if (i === 0) { 36617 throw new Jbig2Error("no previous value in symbol ID table"); 36618 } 36619 36620 numberOfRepeats = reader.readBits(2) + 3; 36621 repeatedLength = codes[i - 1].prefixLength; 36622 break; 36623 36624 case 33: 36625 numberOfRepeats = reader.readBits(3) + 3; 36626 repeatedLength = 0; 36627 break; 36628 36629 case 34: 36630 numberOfRepeats = reader.readBits(7) + 11; 36631 repeatedLength = 0; 36632 break; 36633 36634 default: 36635 throw new Jbig2Error("invalid code length in symbol ID table"); 36636 } 36637 36638 for (j = 0; j < numberOfRepeats; j++) { 36639 codes.push(new HuffmanLine([i, repeatedLength, 0, 0])); 36640 i++; 36641 } 36642 } else { 36643 codes.push(new HuffmanLine([i, codeLength, 0, 0])); 36644 i++; 36645 } 36646 } 36647 36648 reader.byteAlign(); 36649 const symbolIDTable = new HuffmanTable(codes, false); 36650 let customIndex = 0, 36651 tableFirstS, 36652 tableDeltaS, 36653 tableDeltaT; 36654 36655 switch (textRegion.huffmanFS) { 36656 case 0: 36657 case 1: 36658 tableFirstS = getStandardTable(textRegion.huffmanFS + 6); 36659 break; 36660 36661 case 3: 36662 tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables); 36663 customIndex++; 36664 break; 36665 36666 default: 36667 throw new Jbig2Error("invalid Huffman FS selector"); 36668 } 36669 36670 switch (textRegion.huffmanDS) { 36671 case 0: 36672 case 1: 36673 case 2: 36674 tableDeltaS = getStandardTable(textRegion.huffmanDS + 8); 36675 break; 36676 36677 case 3: 36678 tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables); 36679 customIndex++; 36680 break; 36681 36682 default: 36683 throw new Jbig2Error("invalid Huffman DS selector"); 36684 } 36685 36686 switch (textRegion.huffmanDT) { 36687 case 0: 36688 case 1: 36689 case 2: 36690 tableDeltaT = getStandardTable(textRegion.huffmanDT + 11); 36691 break; 36692 36693 case 3: 36694 tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables); 36695 customIndex++; 36696 break; 36697 36698 default: 36699 throw new Jbig2Error("invalid Huffman DT selector"); 36700 } 36701 36702 if (textRegion.refinement) { 36703 throw new Jbig2Error("refinement with Huffman is not supported"); 36704 } 36705 36706 return { 36707 symbolIDTable, 36708 tableFirstS, 36709 tableDeltaS, 36710 tableDeltaT 36711 }; 36712 } 36713 36714 function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {
vendor: 4,574 bytes, lines 36715-36973
36715 let customIndex = 0, 36716 tableDeltaHeight, 36717 tableDeltaWidth; 36718 36719 switch (dictionary.huffmanDHSelector) { 36720 case 0: 36721 case 1: 36722 tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4); 36723 break; 36724 36725 case 3: 36726 tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables); 36727 customIndex++; 36728 break; 36729 36730 default: 36731 throw new Jbig2Error("invalid Huffman DH selector"); 36732 } 36733 36734 switch (dictionary.huffmanDWSelector) { 36735 case 0: 36736 case 1: 36737 tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2); 36738 break; 36739 36740 case 3: 36741 tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables); 36742 customIndex++; 36743 break; 36744 36745 default: 36746 throw new Jbig2Error("invalid Huffman DW selector"); 36747 } 36748 36749 let tableBitmapSize, tableAggregateInstances; 36750 36751 if (dictionary.bitmapSizeSelector) { 36752 tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables); 36753 customIndex++; 36754 } else { 36755 tableBitmapSize = getStandardTable(1); 36756 } 36757 36758 if (dictionary.aggregationInstancesSelector) { 36759 tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables); 36760 } else { 36761 tableAggregateInstances = getStandardTable(1); 36762 } 36763 36764 return { 36765 tableDeltaHeight, 36766 tableDeltaWidth, 36767 tableBitmapSize, 36768 tableAggregateInstances 36769 }; 36770 } 36771 36772 function readUncompressedBitmap(reader, width, height) { 36773 const bitmap = []; 36774 36775 for (let y = 0; y < height; y++) { 36776 const row = new Uint8Array(width); 36777 bitmap.push(row); 36778 36779 for (let x = 0; x < width; x++) { 36780 row[x] = reader.readBit(); 36781 } 36782 36783 reader.byteAlign(); 36784 } 36785 36786 return bitmap; 36787 } 36788 36789 function decodeMMRBitmap(input, width, height, endOfBlock) { 36790 const params = { 36791 K: -1, 36792 Columns: width, 36793 Rows: height, 36794 BlackIs1: true, 36795 EndOfBlock: endOfBlock 36796 }; 36797 const decoder = new _ccitt.CCITTFaxDecoder(input, params); 36798 const bitmap = []; 36799 let currentByte, 36800 eof = false; 36801 36802 for (let y = 0; y < height; y++) { 36803 const row = new Uint8Array(width); 36804 bitmap.push(row); 36805 let shift = -1; 36806 36807 for (let x = 0; x < width; x++) { 36808 if (shift < 0) { 36809 currentByte = decoder.readNextChar(); 36810 36811 if (currentByte === -1) { 36812 currentByte = 0; 36813 eof = true; 36814 } 36815 36816 shift = 7; 36817 } 36818 36819 row[x] = currentByte >> shift & 1; 36820 shift--; 36821 } 36822 } 36823 36824 if (endOfBlock && !eof) { 36825 const lookForEOFLimit = 5; 36826 36827 for (let i = 0; i < lookForEOFLimit; i++) { 36828 if (decoder.readNextChar() === -1) { 36829 break; 36830 } 36831 } 36832 } 36833 36834 return bitmap; 36835 } 36836 36837 function Jbig2Image() {} 36838 36839 Jbig2Image.prototype = { 36840 parseChunks(chunks) { 36841 return parseJbig2Chunks(chunks); 36842 }, 36843 36844 parse(data) { 36845 const { 36846 imgData, 36847 width, 36848 height 36849 } = parseJbig2(data); 36850 this.width = width; 36851 this.height = height; 36852 return imgData; 36853 } 36854 36855 }; 36856 return Jbig2Image; 36857}(); 36858 36859exports.Jbig2Image = Jbig2Image; 36860 36861/***/ }), 36862/* 16 */ 36863/***/ (function(module, exports, __w_pdfjs_require__) { 36864 36865"use strict"; 36866 36867 36868Object.defineProperty(exports, "__esModule", { 36869 value: true 36870}); 36871exports.ArithmeticDecoder = void 0; 36872const QeTable = [{ 36873 qe: 0x5601, 36874 nmps: 1, 36875 nlps: 1, 36876 switchFlag: 1 36877}, { 36878 qe: 0x3401, 36879 nmps: 2, 36880 nlps: 6, 36881 switchFlag: 0 36882}, { 36883 qe: 0x1801, 36884 nmps: 3, 36885 nlps: 9, 36886 switchFlag: 0 36887}, { 36888 qe: 0x0ac1, 36889 nmps: 4, 36890 nlps: 12, 36891 switchFlag: 0 36892}, { 36893 qe: 0x0521, 36894 nmps: 5, 36895 nlps: 29, 36896 switchFlag: 0 36897}, { 36898 qe: 0x0221, 36899 nmps: 38, 36900 nlps: 33, 36901 switchFlag: 0 36902}, { 36903 qe: 0x5601, 36904 nmps: 7, 36905 nlps: 6, 36906 switchFlag: 1 36907}, { 36908 qe: 0x5401, 36909 nmps: 8, 36910 nlps: 14, 36911 switchFlag: 0 36912}, { 36913 qe: 0x4801, 36914 nmps: 9, 36915 nlps: 14, 36916 switchFlag: 0 36917}, { 36918 qe: 0x3801, 36919 nmps: 10, 36920 nlps: 14, 36921 switchFlag: 0 36922}, { 36923 qe: 0x3001, 36924 nmps: 11, 36925 nlps: 17, 36926 switchFlag: 0 36927}, { 36928 qe: 0x2401, 36929 nmps: 12, 36930 nlps: 18, 36931 switchFlag: 0 36932}, { 36933 qe: 0x1c01, 36934 nmps: 13, 36935 nlps: 20, 36936 switchFlag: 0 36937}, { 36938 qe: 0x1601, 36939 nmps: 29, 36940 nlps: 21, 36941 switchFlag: 0 36942}, { 36943 qe: 0x5601, 36944 nmps: 15, 36945 nlps: 14, 36946 switchFlag: 1 36947}, { 36948 qe: 0x5401, 36949 nmps: 16, 36950 nlps: 14, 36951 switchFlag: 0 36952}, { 36953 qe: 0x5101, 36954 nmps: 17, 36955 nlps: 15, 36956 switchFlag: 0 36957}, { 36958 qe: 0x4801, 36959 nmps: 18, 36960 nlps: 16, 36961 switchFlag: 0 36962}, { 36963 qe: 0x3801, 36964 nmps: 19, 36965 nlps: 17, 36966 switchFlag: 0 36967}, { 36968 qe: 0x3401, 36969 nmps: 20, 36970 nlps: 18, 36971 switchFlag: 0 36972}, { 36973 qe: 0x3001,
vendor: 2,484 bytes, lines 36974-37150
36974 nmps: 21, 36975 nlps: 19, 36976 switchFlag: 0 36977}, { 36978 qe: 0x2801, 36979 nmps: 22, 36980 nlps: 19, 36981 switchFlag: 0 36982}, { 36983 qe: 0x2401, 36984 nmps: 23, 36985 nlps: 20, 36986 switchFlag: 0 36987}, { 36988 qe: 0x2201, 36989 nmps: 24, 36990 nlps: 21, 36991 switchFlag: 0 36992}, { 36993 qe: 0x1c01, 36994 nmps: 25, 36995 nlps: 22, 36996 switchFlag: 0 36997}, { 36998 qe: 0x1801, 36999 nmps: 26, 37000 nlps: 23, 37001 switchFlag: 0 37002}, { 37003 qe: 0x1601, 37004 nmps: 27, 37005 nlps: 24, 37006 switchFlag: 0 37007}, { 37008 qe: 0x1401, 37009 nmps: 28, 37010 nlps: 25, 37011 switchFlag: 0 37012}, { 37013 qe: 0x1201, 37014 nmps: 29, 37015 nlps: 26, 37016 switchFlag: 0 37017}, { 37018 qe: 0x1101, 37019 nmps: 30, 37020 nlps: 27, 37021 switchFlag: 0 37022}, { 37023 qe: 0x0ac1, 37024 nmps: 31, 37025 nlps: 28, 37026 switchFlag: 0 37027}, { 37028 qe: 0x09c1, 37029 nmps: 32, 37030 nlps: 29, 37031 switchFlag: 0 37032}, { 37033 qe: 0x08a1, 37034 nmps: 33, 37035 nlps: 30, 37036 switchFlag: 0 37037}, { 37038 qe: 0x0521, 37039 nmps: 34, 37040 nlps: 31, 37041 switchFlag: 0 37042}, { 37043 qe: 0x0441, 37044 nmps: 35, 37045 nlps: 32, 37046 switchFlag: 0 37047}, { 37048 qe: 0x02a1, 37049 nmps: 36, 37050 nlps: 33, 37051 switchFlag: 0 37052}, { 37053 qe: 0x0221, 37054 nmps: 37, 37055 nlps: 34, 37056 switchFlag: 0 37057}, { 37058 qe: 0x0141, 37059 nmps: 38, 37060 nlps: 35, 37061 switchFlag: 0 37062}, { 37063 qe: 0x0111, 37064 nmps: 39, 37065 nlps: 36, 37066 switchFlag: 0 37067}, { 37068 qe: 0x0085, 37069 nmps: 40, 37070 nlps: 37, 37071 switchFlag: 0 37072}, { 37073 qe: 0x0049, 37074 nmps: 41, 37075 nlps: 38, 37076 switchFlag: 0 37077}, { 37078 qe: 0x0025, 37079 nmps: 42, 37080 nlps: 39, 37081 switchFlag: 0 37082}, { 37083 qe: 0x0015, 37084 nmps: 43, 37085 nlps: 40, 37086 switchFlag: 0 37087}, { 37088 qe: 0x0009, 37089 nmps: 44, 37090 nlps: 41, 37091 switchFlag: 0 37092}, { 37093 qe: 0x0005, 37094 nmps: 45, 37095 nlps: 42, 37096 switchFlag: 0 37097}, { 37098 qe: 0x0001, 37099 nmps: 45, 37100 nlps: 43, 37101 switchFlag: 0 37102}, { 37103 qe: 0x5601, 37104 nmps: 46, 37105 nlps: 46, 37106 switchFlag: 0 37107}]; 37108 37109class ArithmeticDecoder { 37110 constructor(data, start, end) { 37111 this.data = data; 37112 this.bp = start; 37113 this.dataEnd = end; 37114 this.chigh = data[start]; 37115 this.clow = 0; 37116 this.byteIn(); 37117 this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f; 37118 this.clow = this.clow << 7 & 0xffff; 37119 this.ct -= 7; 37120 this.a = 0x8000; 37121 } 37122 37123 byteIn() { 37124 const data = this.data; 37125 let bp = this.bp; 37126 37127 if (data[bp] === 0xff) { 37128 if (data[bp + 1] > 0x8f) { 37129 this.clow += 0xff00; 37130 this.ct = 8; 37131 } else { 37132 bp++; 37133 this.clow += data[bp] << 9; 37134 this.ct = 7; 37135 this.bp = bp; 37136 } 37137 } else { 37138 bp++; 37139 this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00; 37140 this.ct = 8; 37141 this.bp = bp; 37142 } 37143 37144 if (this.clow > 0xffff) { 37145 this.chigh += this.clow >> 16; 37146 this.clow &= 0xffff; 37147 } 37148 } 37149 37150 readBit(contexts, pos) {
vendor: 1,696 bytes, lines 37151-37236
37151 let cx_index = contexts[pos] >> 1, 37152 cx_mps = contexts[pos] & 1; 37153 const qeTableIcx = QeTable[cx_index]; 37154 const qeIcx = qeTableIcx.qe; 37155 let d; 37156 let a = this.a - qeIcx; 37157 37158 if (this.chigh < qeIcx) { 37159 if (a < qeIcx) { 37160 a = qeIcx; 37161 d = cx_mps; 37162 cx_index = qeTableIcx.nmps; 37163 } else { 37164 a = qeIcx; 37165 d = 1 ^ cx_mps; 37166 37167 if (qeTableIcx.switchFlag === 1) { 37168 cx_mps = d; 37169 } 37170 37171 cx_index = qeTableIcx.nlps; 37172 } 37173 } else { 37174 this.chigh -= qeIcx; 37175 37176 if ((a & 0x8000) !== 0) { 37177 this.a = a; 37178 return cx_mps; 37179 } 37180 37181 if (a < qeIcx) { 37182 d = 1 ^ cx_mps; 37183 37184 if (qeTableIcx.switchFlag === 1) { 37185 cx_mps = d; 37186 } 37187 37188 cx_index = qeTableIcx.nlps; 37189 } else { 37190 d = cx_mps; 37191 cx_index = qeTableIcx.nmps; 37192 } 37193 } 37194 37195 do { 37196 if (this.ct === 0) { 37197 this.byteIn(); 37198 } 37199 37200 a <<= 1; 37201 this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1; 37202 this.clow = this.clow << 1 & 0xffff; 37203 this.ct--; 37204 } while ((a & 0x8000) === 0); 37205 37206 this.a = a; 37207 contexts[pos] = cx_index << 1 | cx_mps; 37208 return d; 37209 } 37210 37211} 37212 37213exports.ArithmeticDecoder = ArithmeticDecoder; 37214 37215/***/ }), 37216/* 17 */ 37217/***/ (function(module, exports, __w_pdfjs_require__) { 37218 37219"use strict"; 37220 37221 37222Object.defineProperty(exports, "__esModule", { 37223 value: true 37224}); 37225exports.JpegStream = void 0; 37226 37227var _util = __w_pdfjs_require__(2); 37228 37229var _stream = __w_pdfjs_require__(11); 37230 37231var _primitives = __w_pdfjs_require__(4); 37232 37233var _jpg = __w_pdfjs_require__(18); 37234 37235const JpegStream = function JpegStreamClosure() { 37236 function JpegStream(stream, maybeLength, dict, params) {
37237 let ch; 37238 37239 while ((ch = stream.getByte()) !== -1) { 37240 if (ch === 0xff) { 37241 stream.skip(-1); 37242 break; 37243 } 37244 } 37245 37246 this.stream = stream; 37247 this.maybeLength = maybeLength; 37248 this.dict = dict; 37249 this.params = params; 37250 37251 _stream.DecodeStream.call(this, maybeLength); 37252 } 37253 37254 JpegStream.prototype = Object.create(_stream.DecodeStream.prototype); 37255 Object.defineProperty(JpegStream.prototype, "bytes", { 37256 get: function JpegStream_bytes() { 37257 return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength)); 37258 }, 37259 configurable: true 37260 }); 37261 37262 JpegStream.prototype.ensureBuffer = function (requested) {}; 37263 37264 JpegStream.prototype.readBlock = function () { 37265 if (this.eof) { 37266 return; 37267 } 37268 37269 const jpegOptions = { 37270 decodeTransform: undefined, 37271 colorTransform: undefined 37272 }; 37273 const decodeArr = this.dict.getArray("Decode", "D"); 37274 37275 if (this.forceRGB && Array.isArray(decodeArr)) { 37276 const bitsPerComponent = this.dict.get("BitsPerComponent") || 8; 37277 const decodeArrLength = decodeArr.length; 37278 const transform = new Int32Array(decodeArrLength); 37279 let transformNeeded = false; 37280 const maxValue = (1 << bitsPerComponent) - 1; 37281 37282 for (let i = 0; i < decodeArrLength; i += 2) { 37283 transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0; 37284 transform[i + 1] = decodeArr[i] * maxValue | 0; 37285 37286 if (transform[i] !== 256 || transform[i + 1] !== 0) { 37287 transformNeeded = true; 37288 } 37289 } 37290 37291 if (transformNeeded) { 37292 jpegOptions.decodeTransform = transform; 37293 } 37294 } 37295 37296 if ((0, _primitives.isDict)(this.params)) { 37297 const colorTransform = this.params.get("ColorTransform"); 37298 37299 if (Number.isInteger(colorTransform)) { 37300 jpegOptions.colorTransform = colorTransform; 37301 } 37302 } 37303 37304 const jpegImage = new _jpg.JpegImage(jpegOptions); 37305 jpegImage.parse(this.bytes); 37306 const data = jpegImage.getData({ 37307 width: this.drawWidth, 37308 height: this.drawHeight, 37309 forceRGB: this.forceRGB, 37310 isSourcePDF: true 37311 }); 37312 this.buffer = data; 37313 this.bufferLength = data.length; 37314 this.eof = true; 37315 }; 37316 37317 Object.defineProperty(JpegStream.prototype, "maybeValidDimensions", { 37318 get: function JpegStream_maybeValidDimensions() { 37319 const { 37320 dict, 37321 stream 37322 } = this; 37323 const dictHeight = dict.get("Height", "H"); 37324 const startPos = stream.pos; 37325 let validDimensions = true, 37326 foundSOF = false, 37327 b; 37328 37329 while ((b = stream.getByte()) !== -1) { 37330 if (b !== 0xff) { 37331 continue; 37332 } 37333 37334 switch (stream.getByte()) { 37335 case 0xc0: 37336 case 0xc1: 37337 case 0xc2: 37338 foundSOF = true; 37339 stream.pos += 2; 37340 stream.pos += 1; 37341 const scanLines = stream.getUint16(); 37342 37343 if (scanLines === dictHeight) { 37344 break; 37345 } 37346 37347 if (scanLines === 0) { 37348 validDimensions = false; 37349 break; 37350 } 37351 37352 if (scanLines > dictHeight * 10) { 37353 validDimensions = false; 37354 break; 37355 } 37356 37357 break; 37358 37359 case 0xc3: 37360 case 0xc5: 37361 case 0xc6: 37362 case 0xc7: 37363 case 0xc9: 37364 case 0xca: 37365 case 0xcb: 37366 case 0xcd: 37367 case 0xce: 37368 case 0xcf: 37369 foundSOF = true; 37370 break; 37371 37372 case 0xc4: 37373 case 0xcc: 37374 case 0xda: 37375 case 0xdb: 37376 case 0xdc: 37377 case 0xdd: 37378 case 0xde: 37379 case 0xdf: 37380 case 0xe0: 37381 case 0xe1: 37382 case 0xe2: 37383 case 0xe3: 37384 case 0xe4: 37385 case 0xe5: 37386 case 0xe6: 37387 case 0xe7: 37388 case 0xe8: 37389 case 0xe9: 37390 case 0xea: 37391 case 0xeb: 37392 case 0xec: 37393 case 0xed: 37394 case 0xee: 37395 case 0xef: 37396 case 0xfe: 37397 const markerLength = stream.getUint16(); 37398 37399 if (markerLength > 2) { 37400 stream.skip(markerLength - 2); 37401 } else { 37402 stream.skip(-2); 37403 } 37404 37405 break; 37406 37407 case 0xff: 37408 stream.skip(-1); 37409 break; 37410 37411 case 0xd9: 37412 foundSOF = true; 37413 break; 37414 } 37415 37416 if (foundSOF) { 37417 break; 37418 } 37419 } 37420 37421 stream.pos = startPos; 37422 return (0, _util.shadow)(this, "maybeValidDimensions", validDimensions); 37423 }, 37424 configurable: true 37425 }); 37426 37427 JpegStream.prototype.getIR = function (forceDataSchema = false) { 37428 return (0, _util.createObjectURL)(this.bytes, "image/jpeg", forceDataSchema); 37429 }; 37430 37431 return JpegStream; 37432}(); 37433 37434exports.JpegStream = JpegStream; 37435 37436/***/ }), 37437/* 18 */ 37438/***/ (function(module, exports, __w_pdfjs_require__) { 37439 37440"use strict"; 37441 37442 37443Object.defineProperty(exports, "__esModule", { 37444 value: true 37445}); 37446exports.JpegImage = void 0; 37447 37448var _util = __w_pdfjs_require__(2); 37449 37450var _core_utils = __w_pdfjs_require__(7); 37451 37452class JpegError extends _util.BaseException { 37453 constructor(msg) { 37454 super(`JPEG error: ${msg}`); 37455 } 37456 37457} 37458 37459class DNLMarkerError extends _util.BaseException { 37460 constructor(message, scanLines) { 37461 super(message); 37462 this.scanLines = scanLines; 37463 } 37464 37465} 37466 37467class EOIMarkerError extends _util.BaseException {} 37468 37469var JpegImage = function JpegImageClosure() { 37470 var dctZigZag = new Uint8Array([0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63]); 37471 var dctCos1 = 4017; 37472 var dctSin1 = 799; 37473 var dctCos3 = 3406; 37474 var dctSin3 = 2276; 37475 var dctCos6 = 1567; 37476 var dctSin6 = 3784; 37477 var dctSqrt2 = 5793; 37478 var dctSqrt1d2 = 2896; 37479 37480 function JpegImage({ 37481 decodeTransform = null, 37482 colorTransform = -1 37483 } = {}) { 37484 this._decodeTransform = decodeTransform; 37485 this._colorTransform = colorTransform; 37486 } 37487 37488 function buildHuffmanTable(codeLengths, values) { 37489 var k = 0, 37490 code = [], 37491 i, 37492 j, 37493 length = 16; 37494 37495 while (length > 0 && !codeLengths[length - 1]) { 37496 length--; 37497 } 37498 37499 code.push({ 37500 children: [], 37501 index: 0 37502 }); 37503 var p = code[0], 37504 q; 37505 37506 for (i = 0; i < length; i++) { 37507 for (j = 0; j < codeLengths[i]; j++) { 37508 p = code.pop(); 37509 p.children[p.index] = values[k]; 37510 37511 while (p.index > 0) { 37512 p = code.pop(); 37513 } 37514 37515 p.index++; 37516 code.push(p); 37517 37518 while (code.length <= i) { 37519 code.push(q = { 37520 children: [], 37521 index: 0 37522 }); 37523 p.children[p.index] = q.children; 37524 p = q; 37525 } 37526 37527 k++; 37528 } 37529 37530 if (i + 1 < length) { 37531 code.push(q = { 37532 children: [], 37533 index: 0 37534 }); 37535 p.children[p.index] = q.children; 37536 p = q; 37537 } 37538 } 37539 37540 return code[0].children; 37541 } 37542 37543 function getBlockBufferOffset(component, row, col) { 37544 return 64 * ((component.blocksPerLine + 1) * row + col); 37545 } 37546 37547 function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, parseDNLMarker = false) { 37548 var mcusPerLine = frame.mcusPerLine; 37549 var progressive = frame.progressive; 37550 var startOffset = offset, 37551 bitsData = 0, 37552 bitsCount = 0; 37553 37554 function readBit() { 37555 if (bitsCount > 0) { 37556 bitsCount--; 37557 return bitsData >> bitsCount & 1; 37558 } 37559 37560 bitsData = data[offset++]; 37561 37562 if (bitsData === 0xff) { 37563 var nextByte = data[offset++]; 37564 37565 if (nextByte) { 37566 if (nextByte === 0xdc && parseDNLMarker) { 37567 offset += 2; 37568 const scanLines = (0, _core_utils.readUint16)(data, offset); 37569 offset += 2; 37570 37571 if (scanLines > 0 && scanLines !== frame.scanLines) { 37572 throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines); 37573 } 37574 } else if (nextByte === 0xd9) { 37575 if (parseDNLMarker) { 37576 const maybeScanLines = blockRow * 8; 37577 37578 if (maybeScanLines > 0 && maybeScanLines < frame.scanLines / 10) { 37579 throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines); 37580 } 37581 } 37582 37583 throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data"); 37584 } 37585 37586 throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`); 37587 } 37588 } 37589 37590 bitsCount = 7; 37591 return bitsData >>> 7; 37592 } 37593 37594 function decodeHuffman(tree) { 37595 var node = tree; 37596 37597 while (true) { 37598 node = node[readBit()]; 37599 37600 switch (typeof node) { 37601 case "number": 37602 return node; 37603 37604 case "object": 37605 continue; 37606 } 37607 37608 throw new JpegError("invalid huffman sequence"); 37609 } 37610 } 37611 37612 function receive(length) { 37613 var n = 0; 37614 37615 while (length > 0) { 37616 n = n << 1 | readBit(); 37617 length--; 37618 } 37619 37620 return n; 37621 } 37622 37623 function receiveAndExtend(length) { 37624 if (length === 1) { 37625 return readBit() === 1 ? 1 : -1; 37626 } 37627 37628 var n = receive(length); 37629 37630 if (n >= 1 << length - 1) { 37631 return n; 37632 } 37633 37634 return n + (-1 << length) + 1; 37635 } 37636 37637 function decodeBaseline(component, offset) { 37638 var t = decodeHuffman(component.huffmanTableDC); 37639 var diff = t === 0 ? 0 : receiveAndExtend(t); 37640 component.blockData[offset] = component.pred += diff; 37641 var k = 1; 37642 37643 while (k < 64) { 37644 var rs = decodeHuffman(component.huffmanTableAC); 37645 var s = rs & 15, 37646 r = rs >> 4; 37647 37648 if (s === 0) { 37649 if (r < 15) { 37650 break; 37651 } 37652 37653 k += 16; 37654 continue; 37655 } 37656 37657 k += r; 37658 var z = dctZigZag[k]; 37659 component.blockData[offset + z] = receiveAndExtend(s); 37660 k++; 37661 } 37662 } 37663 37664 function decodeDCFirst(component, offset) { 37665 var t = decodeHuffman(component.huffmanTableDC); 37666 var diff = t === 0 ? 0 : receiveAndExtend(t) << successive; 37667 component.blockData[offset] = component.pred += diff; 37668 } 37669 37670 function decodeDCSuccessive(component, offset) { 37671 component.blockData[offset] |= readBit() << successive; 37672 } 37673 37674 var eobrun = 0; 37675 37676 function decodeACFirst(component, offset) { 37677 if (eobrun > 0) { 37678 eobrun--; 37679 return; 37680 } 37681 37682 var k = spectralStart, 37683 e = spectralEnd; 37684 37685 while (k <= e) { 37686 var rs = decodeHuffman(component.huffmanTableAC); 37687 var s = rs & 15, 37688 r = rs >> 4; 37689 37690 if (s === 0) { 37691 if (r < 15) { 37692 eobrun = receive(r) + (1 << r) - 1; 37693 break; 37694 } 37695 37696 k += 16; 37697 continue; 37698 } 37699 37700 k += r; 37701 var z = dctZigZag[k]; 37702 component.blockData[offset + z] = receiveAndExtend(s) * (1 << successive); 37703 k++; 37704 } 37705 } 37706 37707 var successiveACState = 0, 37708 successiveACNextValue; 37709 37710 function decodeACSuccessive(component, offset) { 37711 var k = spectralStart; 37712 var e = spectralEnd; 37713 var r = 0; 37714 var s; 37715 var rs; 37716 37717 while (k <= e) { 37718 const offsetZ = offset + dctZigZag[k]; 37719 const sign = component.blockData[offsetZ] < 0 ? -1 : 1; 37720 37721 switch (successiveACState) { 37722 case 0: 37723 rs = decodeHuffman(component.huffmanTableAC); 37724 s = rs & 15; 37725 r = rs >> 4; 37726 37727 if (s === 0) { 37728 if (r < 15) { 37729 eobrun = receive(r) + (1 << r); 37730 successiveACState = 4; 37731 } else { 37732 r = 16; 37733 successiveACState = 1; 37734 } 37735 } else { 37736 if (s !== 1) { 37737 throw new JpegError("invalid ACn encoding"); 37738 } 37739 37740 successiveACNextValue = receiveAndExtend(s); 37741 successiveACState = r ? 2 : 3; 37742 } 37743 37744 continue; 37745 37746 case 1: 37747 case 2: 37748 if (component.blockData[offsetZ]) { 37749 component.blockData[offsetZ] += sign * (readBit() << successive); 37750 } else { 37751 r--; 37752 37753 if (r === 0) { 37754 successiveACState = successiveACState === 2 ? 3 : 0; 37755 } 37756 } 37757 37758 break; 37759 37760 case 3: 37761 if (component.blockData[offsetZ]) { 37762 component.blockData[offsetZ] += sign * (readBit() << successive); 37763 } else { 37764 component.blockData[offsetZ] = successiveACNextValue << successive; 37765 successiveACState = 0; 37766 } 37767 37768 break; 37769 37770 case 4: 37771 if (component.blockData[offsetZ]) { 37772 component.blockData[offsetZ] += sign * (readBit() << successive); 37773 } 37774 37775 break; 37776 } 37777 37778 k++; 37779 } 37780 37781 if (successiveACState === 4) { 37782 eobrun--; 37783 37784 if (eobrun === 0) { 37785 successiveACState = 0; 37786 } 37787 } 37788 } 37789 37790 let blockRow = 0; 37791 37792 function decodeMcu(component, decode, mcu, row, col) { 37793 var mcuRow = mcu / mcusPerLine | 0; 37794 var mcuCol = mcu % mcusPerLine; 37795 blockRow = mcuRow * component.v + row; 37796 var blockCol = mcuCol * component.h + col; 37797 var offset = getBlockBufferOffset(component, blockRow, blockCol); 37798 decode(component, offset); 37799 } 37800 37801 function decodeBlock(component, decode, mcu) { 37802 blockRow = mcu / component.blocksPerLine | 0; 37803 var blockCol = mcu % component.blocksPerLine; 37804 var offset = getBlockBufferOffset(component, blockRow, blockCol); 37805 decode(component, offset); 37806 } 37807 37808 var componentsLength = components.length; 37809 var component, i, j, k, n; 37810 var decodeFn; 37811 37812 if (progressive) { 37813 if (spectralStart === 0) { 37814 decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive; 37815 } else { 37816 decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive; 37817 } 37818 } else { 37819 decodeFn = decodeBaseline; 37820 } 37821 37822 var mcu = 0, 37823 fileMarker; 37824 var mcuExpected; 37825 37826 if (componentsLength === 1) { 37827 mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn; 37828 } else { 37829 mcuExpected = mcusPerLine * frame.mcusPerColumn; 37830 } 37831 37832 var h, v; 37833 37834 while (mcu < mcuExpected) { 37835 var mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected; 37836 37837 for (i = 0; i < componentsLength; i++) { 37838 components[i].pred = 0; 37839 } 37840 37841 eobrun = 0; 37842 37843 if (componentsLength === 1) { 37844 component = components[0]; 37845 37846 for (n = 0; n < mcuToRead; n++) { 37847 decodeBlock(component, decodeFn, mcu); 37848 mcu++; 37849 } 37850 } else { 37851 for (n = 0; n < mcuToRead; n++) { 37852 for (i = 0; i < componentsLength; i++) { 37853 component = components[i]; 37854 h = component.h; 37855 v = component.v; 37856 37857 for (j = 0; j < v; j++) { 37858 for (k = 0; k < h; k++) { 37859 decodeMcu(component, decodeFn, mcu, j, k); 37860 } 37861 } 37862 } 37863 37864 mcu++; 37865 } 37866 } 37867 37868 bitsCount = 0; 37869 fileMarker = findNextFileMarker(data, offset); 37870 37871 if (!fileMarker) { 37872 break; 37873 } else if (fileMarker.invalid) { 37874 (0, _util.warn)("decodeScan - unexpected MCU data, current marker is: " + fileMarker.invalid); 37875 offset = fileMarker.offset; 37876 } 37877 37878 var marker = fileMarker && fileMarker.marker; 37879 37880 if (!marker || marker <= 0xff00) { 37881 throw new JpegError("decodeScan - a valid marker was not found."); 37882 } 37883 37884 if (marker >= 0xffd0 && marker <= 0xffd7) { 37885 offset += 2; 37886 } else { 37887 break; 37888 } 37889 } 37890 37891 fileMarker = findNextFileMarker(data, offset); 37892 37893 if (fileMarker && fileMarker.invalid) { 37894 (0, _util.warn)("decodeScan - unexpected Scan data, current marker is: " + fileMarker.invalid); 37895 offset = fileMarker.offset; 37896 } 37897 37898 return offset - startOffset; 37899 } 37900 37901 function quantizeAndInverse(component, blockBufferOffset, p) { 37902 var qt = component.quantizationTable, 37903 blockData = component.blockData; 37904 var v0, v1, v2, v3, v4, v5, v6, v7; 37905 va
vendor: 3,720 bytes, lines 37905-38033
37905r p0, p1, p2, p3, p4, p5, p6, p7; 37906 var t; 37907 37908 if (!qt) { 37909 throw new JpegError("missing required Quantization Table."); 37910 } 37911 37912 for (var row = 0; row < 64; row += 8) { 37913 p0 = blockData[blockBufferOffset + row]; 37914 p1 = blockData[blockBufferOffset + row + 1]; 37915 p2 = blockData[blockBufferOffset + row + 2]; 37916 p3 = blockData[blockBufferOffset + row + 3]; 37917 p4 = blockData[blockBufferOffset + row + 4]; 37918 p5 = blockData[blockBufferOffset + row + 5]; 37919 p6 = blockData[blockBufferOffset + row + 6]; 37920 p7 = blockData[blockBufferOffset + row + 7]; 37921 p0 *= qt[row]; 37922 37923 if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) { 37924 t = dctSqrt2 * p0 + 512 >> 10; 37925 p[row] = t; 37926 p[row + 1] = t; 37927 p[row + 2] = t; 37928 p[row + 3] = t; 37929 p[row + 4] = t; 37930 p[row + 5] = t; 37931 p[row + 6] = t; 37932 p[row + 7] = t; 37933 continue; 37934 } 37935 37936 p1 *= qt[row + 1]; 37937 p2 *= qt[row + 2]; 37938 p3 *= qt[row + 3]; 37939 p4 *= qt[row + 4]; 37940 p5 *= qt[row + 5]; 37941 p6 *= qt[row + 6]; 37942 p7 *= qt[row + 7]; 37943 v0 = dctSqrt2 * p0 + 128 >> 8; 37944 v1 = dctSqrt2 * p4 + 128 >> 8; 37945 v2 = p2; 37946 v3 = p6; 37947 v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8; 37948 v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8; 37949 v5 = p3 << 4; 37950 v6 = p5 << 4; 37951 v0 = v0 + v1 + 1 >> 1; 37952 v1 = v0 - v1; 37953 t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8; 37954 v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8; 37955 v3 = t; 37956 v4 = v4 + v6 + 1 >> 1; 37957 v6 = v4 - v6; 37958 v7 = v7 + v5 + 1 >> 1; 37959 v5 = v7 - v5; 37960 v0 = v0 + v3 + 1 >> 1; 37961 v3 = v0 - v3; 37962 v1 = v1 + v2 + 1 >> 1; 37963 v2 = v1 - v2; 37964 t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12; 37965 v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12; 37966 v7 = t; 37967 t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12; 37968 v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12; 37969 v6 = t; 37970 p[row] = v0 + v7; 37971 p[row + 7] = v0 - v7; 37972 p[row + 1] = v1 + v6; 37973 p[row + 6] = v1 - v6; 37974 p[row + 2] = v2 + v5; 37975 p[row + 5] = v2 - v5; 37976 p[row + 3] = v3 + v4; 37977 p[row + 4] = v3 - v4; 37978 } 37979 37980 for (var col = 0; col < 8; ++col) { 37981 p0 = p[col]; 37982 p1 = p[col + 8]; 37983 p2 = p[col + 16]; 37984 p3 = p[col + 24]; 37985 p4 = p[col + 32]; 37986 p5 = p[col + 40]; 37987 p6 = p[col + 48]; 37988 p7 = p[col + 56]; 37989 37990 if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) { 37991 t = dctSqrt2 * p0 + 8192 >> 14; 37992 37993 if (t < -2040) { 37994 t = 0; 37995 } else if (t >= 2024) { 37996 t = 255; 37997 } else { 37998 t = t + 2056 >> 4; 37999 } 38000 38001 blockData[blockBufferOffset + col] = t; 38002 blockData[blockBufferOffset + col + 8] = t; 38003 blockData[blockBufferOffset + col + 16] = t; 38004 blockData[blockBufferOffset + col + 24] = t; 38005 blockData[blockBufferOffset + col + 32] = t; 38006 blockData[blockBufferOffset + col + 40] = t; 38007 blockData[blockBufferOffset + col + 48] = t; 38008 blockData[blockBufferOffset + col + 56] = t; 38009 continue; 38010 } 38011 38012 v0 = dctSqrt2 * p0 + 2048 >> 12; 38013 v1 = dctSqrt2 * p4 + 2048 >> 12; 38014 v2 = p2; 38015 v3 = p6; 38016 v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12; 38017 v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12; 38018 v5 = p3; 38019 v6 = p5; 38020 v0 = (v0 + v1 + 1 >> 1) + 4112; 38021 v1 = v0 - v1; 38022 t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12; 38023 v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12; 38024 v3 = t; 38025 v4 = v4 + v6 + 1 >> 1; 38026 v6 = v4 - v6; 38027 v7 = v7 + v5 + 1 >> 1; 38028 v5 = v7 - v5; 38029 v0 = v0 + v3 + 1 >> 1; 38030 v3 = v0 - v3; 38031 v1 = v1 + v2 + 1 >> 1; 38032 v2 = v1 - v2; 38033 t = v4 * dctSin3 + v7 * dctCos3 + 2048 >>
38033 12; 38034 v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12; 38035 v7 = t; 38036 t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12; 38037 v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12; 38038 v6 = t; 38039 p0 = v0 + v7; 38040 p7 = v0 - v7; 38041 p1 = v1 + v6; 38042 p6 = v1 - v6; 38043 p2 = v2 + v5; 38044 p5 = v2 - v5; 38045 p3 = v3 + v4; 38046 p4 = v3 - v4; 38047 38048 if (p0 < 16) { 38049 p0 = 0; 38050 } else if (p0 >= 4080) { 38051 p0 = 255; 38052 } else { 38053 p0 >>= 4; 38054 } 38055 38056 if (p1 < 16) { 38057 p1 = 0; 38058 } else if (p1 >= 4080) { 38059 p1 = 255; 38060 } else { 38061 p1 >>= 4; 38062 } 38063 38064 if (p2 < 16) { 38065 p2 = 0; 38066 } else if (p2 >= 4080) { 38067 p2 = 255; 38068 } else { 38069 p2 >>= 4; 38070 } 38071 38072 if (p3 < 16) { 38073 p3 = 0; 38074 } else if (p3 >= 4080) { 38075 p3 = 255; 38076 } else { 38077 p3 >>= 4; 38078 } 38079 38080 if (p4 < 16) { 38081 p4 = 0; 38082 } else if (p4 >= 4080) { 38083 p4 = 255; 38084 } else { 38085 p4 >>= 4; 38086 } 38087 38088 if (p5 < 16) { 38089 p5 = 0; 38090 } else if (p5 >= 4080) { 38091 p5 = 255; 38092 } else { 38093 p5 >>= 4; 38094 } 38095 38096 if (p6 < 16) { 38097 p6 = 0; 38098 } else if (p6 >= 4080) { 38099 p6 = 255; 38100 } else { 38101 p6 >>= 4; 38102 } 38103 38104 if (p7 < 16) { 38105 p7 = 0; 38106 } else if (p7 >= 4080) { 38107 p7 = 255; 38108 } else { 38109 p7 >>= 4; 38110 } 38111 38112 blockData[blockBufferOffset + col] = p0; 38113 blockData[blockBufferOffset + col + 8] = p1; 38114 blockData[blockBufferOffset + col + 16] = p2; 38115 blockData[blockBufferOffset + col + 24] = p3; 38116 blockData[blockBufferOffset + col + 32] = p4; 38117 blockData[blockBufferOffset + col + 40] = p5; 38118 blockData[blockBufferOffset + col + 48] = p6; 38119 blockData[blockBufferOffset + col + 56] = p7; 38120 } 38121 } 38122 38123 function buildComponentData(frame, component) { 38124 var blocksPerLine = component.blocksPerLine; 38125 var blocksPerColumn = component.blocksPerColumn; 38126 var computationBuffer = new Int16Array(64); 38127 38128 for (var blockRow = 0; blockRow < blocksPerColumn; blockRow++) { 38129 for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) { 38130 var offset = getBlockBufferOffset(component, blockRow, blockCol); 38131 quantizeAndInverse(component, offset, computationBuffer); 38132 } 38133 } 38134 38135 return component.blockData; 38136 } 38137 38138 function findNextFileMarker(data, currentPos, startPos = currentPos) { 38139 const maxPos = data.length - 1; 38140 var newPos = startPos < currentPos ? startPos : currentPos; 38141 38142 if (currentPos >= maxPos) { 38143 return null; 38144 } 38145 38146 var currentMarker = (0, _core_utils.readUint16)(data, currentPos); 38147 38148 if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) { 38149 return { 38150 invalid: null, 38151 marker: currentMarker, 38152 offset: currentPos 38153 }; 38154 } 38155 38156 var newMarker = (0, _core_utils.readUint16)(data, newPos); 38157 38158 while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) { 38159 if (++newPos >= maxPos) { 38160 return null; 38161 } 38162 38163 newMarker = (0, _core_utils.readUint16)(data, newPos); 38164 } 38165 38166 return { 38167 invalid: currentMarker.toString(16), 38168 marker: newMarker, 38169 offset: newPos 38170 }; 38171 } 38172 38173 JpegImage.prototype = { 38174 parse(data, { 38175 dnlScanLines = null 38176 } = {}) { 38177 function readDataBlock() { 38178 const length = (0, _core_utils.readUint16)(data, offset); 38179 offset += 2; 38180 let endOffset = offset + length - 2; 38181 var fileMarker = findNextFileMarker(data, endOffset, offset); 38182 38183 if (fileMarker && fileMarker.invalid) { 38184 (0, _util.warn)("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid); 38185 endOffset = fileMarker.offset; 38186 } 38187 38188 var array = data.subarray(offset, endOffset); 38189 offset += array.length; 38190 return array; 38191 } 38192 38193 function prepareComponents(frame) { 38194 var mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH); 38195 var mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV); 38196 38197 for (var i = 0; i < frame.components.length; i++) { 38198 component = frame.components[i];
38199 var blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH); 38200 var blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV); 38201 var blocksPerLineForMcu = mcusPerLine * component.h; 38202 var blocksPerColumnForMcu = mcusPerColumn * component.v; 38203 var blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1); 38204 component.blockData = new Int16Array(blocksBufferSize); 38205 component.blocksPerLine = blocksPerLine; 38206 component.blocksPerColumn = blocksPerColumn; 38207 } 38208 38209 frame.mcusPerLine = mcusPerLine; 38210 frame.mcusPerColumn = mcusPerColumn; 38211 } 38212 38213 var offset = 0; 38214 var jfif = null; 38215 var adobe = null; 38216 var frame, resetInterval; 38217 let numSOSMarkers = 0; 38218 var quantizationTables = []; 38219 var huffmanTablesAC = [], 38220 huffmanTablesDC = []; 38221 let fileMarker = (0, _core_utils.readUint16)(data, offset); 38222 offset += 2; 38223 38224 if (fileMarker !== 0xffd8) { 38225 throw new JpegError("SOI not found"); 38226 } 38227 38228 fileMarker = (0, _core_utils.readUint16)(data, offset); 38229 offset += 2; 38230 38231 markerLoop: while (fileMarker !== 0xffd9) { 38232 var i, j, l; 38233 38234 switch (fileMarker) { 38235 case 0xffe0: 38236 case 0xffe1: 38237 case 0xffe2: 38238 case 0xffe3: 38239 case 0xffe4: 38240 case 0xffe5: 38241 case 0xffe6: 38242 case 0xffe7: 38243 case 0xffe8: 38244 case 0xffe9: 38245 case 0xffea: 38246 case 0xffeb: 38247 case 0xffec: 38248 case 0xffed: 38249 case 0xffee: 38250 case 0xffef: 38251 case 0xfffe: 38252 var appData = readDataBlock(); 38253 38254 if (fileMarker === 0xffe0) { 38255 if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) { 38256 jfif = { 38257 version: { 38258 major: appData[5], 38259 minor: appData[6] 38260 }, 38261 densityUnits: appData[7], 38262 xDensity: appData[8] << 8 | appData[9], 38263 yDensity: appData[10] << 8 | appData[11], 38264 thumbWidth: appData[12], 38265 thumbHeight: appData[13], 38266 thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13]) 38267 }; 38268 } 38269 } 38270 38271 if (fileMarker === 0xffee) { 38272 if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) { 38273 adobe = { 38274 version: appData[5] << 8 | appData[6], 38275 flags0: appData[7] << 8 | appData[8], 38276 flags1: appData[9] << 8 | appData[10], 38277 transformCode: appData[11] 38278 }; 38279 } 38280 } 38281 38282 break; 38283 38284 case 0xffdb: 38285 const quantizationTablesLength = (0, _core_utils.readUint16)(data, offset); 38286 offset += 2; 38287 var quantizationTablesEnd = quantizationTablesLength + offset - 2; 38288 var z; 38289 38290 while (offset < quantizationTablesEnd) { 38291 var quantizationTableSpec = data[offset++]; 38292 var tableData = new Uint16Array(64); 38293 38294 if (quantizationTableSpec >> 4 === 0) { 38295 for (j = 0; j < 64; j++) { 38296 z = dctZigZag[j]; 38297 tableData[z] = data[offset++]; 38298 } 38299 } else if (quantizationTableSpec >> 4 === 1) { 38300 for (j = 0; j < 64; j++) { 38301 z = dctZigZag[j]; 38302 tableData[z] = (0, _core_utils.readUint16)(data, offset); 38303 offset += 2; 38304 } 38305 } else { 38306 throw new JpegError("DQT - invalid table spec"); 38307 } 38308 38309 quantizationTables[quantizationTableSpec & 15] = tableData; 38310 } 38311 38312 break; 38313 38314 case 0xffc0: 38315 case 0xffc1: 38316 case 0xffc2: 38317 if (frame) { 38318 throw new JpegError("Only single frame JPEGs supported"); 38319 } 38320 38321 offset += 2; 38322 frame = {}; 38323 frame.extended = fileMarker === 0xffc1; 38324 frame.progressive = fileMarker === 0xffc2; 38325 frame.precision = data[offset++]; 38326 const sofScanLines = (0, _core_utils.readUint16)(data, offset); 38327 offset += 2; 38328 frame.scanLines = dnlScanLines || sofScanLines; 38329 frame.samplesPerLine = (0, _core_utils.readUint16)(data, offset); 38330 offset += 2; 38331 frame.components = []; 38332 frame.componentIds = {}; 38333 var componentsCount = data[offset++], 38334 componentId; 38335 var maxH = 0, 38336 maxV = 0; 38337 38338 for (i = 0; i < componentsCount; i++) { 38339 componentId = data[offset]; 38340 var h = data[offset + 1] >> 4; 38341 var v = data[offset + 1] & 15; 38342 38343 if (maxH < h) { 38344 maxH = h; 38345 } 38346 38347 if (maxV < v) { 38348 maxV = v; 38349 } 38350 38351 var qId = data[offset + 2]; 38352 l = frame.components.push({ 38353 h, 38354 v, 38355 quantizationId: qId, 38356 quantizationTable: null 38357 }); 38358 frame.componentIds[componentId] = l - 1; 38359 offset += 3; 38360 } 38361 38362 frame.maxH = maxH; 38363 frame.maxV = maxV; 38364 prepareComponents(frame); 38365 break; 38366 38367 case 0xffc4: 38368 const huffmanLength = (0, _core_utils.readUint16)(data, offset); 38369 offset += 2; 38370 38371 for (i = 2; i < huffmanLength;) { 38372 var huffmanTableSpec = data[offset++]; 38373 var codeLengths = new Uint8Array(16); 38374 var codeLengthSum = 0; 38375 38376 for (j = 0; j < 16; j++, offset++) { 38377 codeLengthSum += codeLengths[j] = data[offset]; 38378 } 38379 38380 var huffmanValues = new Uint8Array(codeLengthSum); 38381 38382 for (j = 0; j < codeLengthSum; j++, offset++) { 38383 huffmanValues[j] = data[offset]; 38384 } 38385 38386 i += 17 + codeLengthSum; 38387 (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues); 38388 } 38389 38390 break; 38391 38392 case 0xffdd: 38393 offset += 2; 38394 resetInterval = (0, _core_utils.readUint16)(data, offset); 38395 offset += 2; 38396 break; 38397 38398 case 0xffda: 38399 const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines; 38400 offset += 2; 38401 var selectorsCount = data[offset++]; 38402 var components = [], 38403 component; 38404 38405 for (i = 0; i < selectorsCount; i++) { 38406 var componentIndex = frame.componentIds[data[offset++]]; 38407 component = frame.components[componentIndex]; 38408 var tableSpec = data[offset++]; 38409 component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4]; 38410 component.huffmanTableAC = huffmanTablesAC[tableSpec & 15]; 38411 components.push(component); 38412 } 38413 38414 var spectralStart = data[offset++]; 38415 var spectralEnd = data[offset++]; 38416 var successiveApproximation = data[offset++]; 38417 38418 try { 38419 var processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker); 38420 offset += processed; 38421 } catch (ex) { 38422 if (ex instanceof DNLMarkerError) { 38423 (0, _util.warn)(`${ex.message} -- attempting to re-parse the JPEG image.`); 38424 return this.parse(data, { 38425 dnlScanLines: ex.scanLines 38426 }); 38427 } else if (ex instanceof EOIMarkerError) { 38428 (0, _util.warn)(`${ex.message} -- ignoring the rest of the image data.`);
38429 break markerLoop; 38430 } 38431 38432 throw ex; 38433 } 38434 38435 break; 38436 38437 case 0xffdc: 38438 offset += 4; 38439 break; 38440 38441 case 0xffff: 38442 if (data[offset] !== 0xff) { 38443 offset--; 38444 } 38445 38446 break; 38447 38448 default: 38449 const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3); 38450 38451 if (nextFileMarker && nextFileMarker.invalid) { 38452 (0, _util.warn)("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid); 38453 offset = nextFileMarker.offset; 38454 break; 38455 } 38456 38457 if (offset >= data.length - 1) { 38458 (0, _util.warn)("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9)."); 38459 break markerLoop; 38460 } 38461 38462 throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16)); 38463 } 38464 38465 fileMarker = (0, _core_utils.readUint16)(data, offset); 38466 offset += 2; 38467 } 38468 38469 this.width = frame.samplesPerLine; 38470 this.height = frame.scanLines; 38471 this.jfif = jfif; 38472 this.adobe = adobe; 38473 this.components = []; 38474 38475 for (i = 0; i < frame.components.length; i++) { 38476 component = frame.components[i]; 38477 var quantizationTable = quantizationTables[component.quantizationId]; 38478 38479 if (quantizationTable) { 38480 component.quantizationTable = quantizationTable; 38481 } 38482 38483 this.components.push({ 38484 output: buildComponentData(frame, component), 38485 scaleX: component.h / frame.maxH, 38486 scaleY: component.v / frame.maxV, 38487 blocksPerLine: component.blocksPerLine, 38488 blocksPerColumn: component.blocksPerColumn 38489 }); 38490 } 38491 38492 this.numComponents = this.components.length; 38493 return undefined; 38494 }, 38495 38496 _getLinearizedBlockData(width, height, isSourcePDF = false) { 38497 var scaleX = this.width / width, 38498 scaleY = this.height / height; 38499 var component, componentScaleX, componentScaleY, blocksPerScanline; 38500 var x, y, i, j, k; 38501 var index; 38502 var offset = 0; 38503 var output; 38504 var numComponents = this.components.length; 38505 var dataLength = width * height * numComponents; 38506 var data = new Uint8ClampedArray(dataLength); 38507 var xScaleBlockOffset = new Uint32Array(width); 38508 var mask3LSB = 0xfffffff8; 38509 let lastComponentScaleX; 38510 38511 for (i = 0; i < numComponents; i++) { 38512 component = this.components[i]; 38513 componentScaleX = component.scaleX * scaleX; 38514 componentScaleY = component.scaleY * scaleY; 38515 offset = i; 38516 output = component.output; 38517 blocksPerScanline = component.blocksPerLine + 1 << 3; 38518 38519 if (componentScaleX !== lastComponentScaleX) { 38520 for (x = 0; x < width; x++) { 38521 j = 0 | x * componentScaleX; 38522 xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7; 38523 } 38524 38525 lastComponentScaleX = componentScaleX; 38526 } 38527 38528 for (y = 0; y < height; y++) { 38529 j = 0 | y * componentScaleY; 38530 index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3; 38531 38532 for (x = 0; x < width; x++) { 38533 data[offset] = output[index + xScaleBlockOffset[x]]; 38534 offset += numComponents; 38535 } 38536 } 38537 } 38538 38539 let transform = this._decodeTransform; 38540 38541 if (!isSourcePDF && numComponents === 4 && !transform) { 38542 transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]); 38543 } 38544 38545 if (transform) { 38546 for (i = 0; i < dataLength;) { 38547 for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) { 38548 data[i] = (data[i] * transform[k] >> 8) + transform[k + 1]; 38549 } 38550 } 38551 } 38552 38553 return data; 38554 }, 38555 38556 get _isColorConversionNeeded() { 38557 if (this.adobe) { 38558 return !!this.adobe.transformCode; 38559 } 38560 38561 if (this.numComponents === 3) { 38562 if (this._colorTransform === 0) { 38563 return false; 38564 } 38565 38566 return true; 38567 } 38568 38569 if (this._colorTransform === 1) { 38570 return true; 38571 } 38572 38573 return false;
38574 }, 38575 38576 _convertYccToRgb: function convertYccToRgb(data) { 38577 var Y, Cb, Cr; 38578 38579 for (var i = 0, length = data.length; i < length; i += 3) { 38580 Y = data[i]; 38581 Cb = data[i + 1]; 38582 Cr = data[i + 2]; 38583 data[i] = Y - 179.456 + 1.402 * Cr; 38584 data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr; 38585 data[i + 2] = Y - 226.816 + 1.772 * Cb; 38586 } 38587 38588 return data; 38589 }, 38590 _convertYcckToRgb: function convertYcckToRgb(data) { 38591 var Y, Cb, Cr, k; 38592 var offset = 0; 38593 38594 for (var i = 0, length = data.length; i < length; i += 4) { 38595 Y = data[i]; 38596 Cb = data[i + 1]; 38597 Cr = data[i + 2]; 38598 k = data[i + 3]; 38599 data[offset++] = -122.67195406894 + Cb * (-6.60635669420364e-5 * Cb + 0.000437130475926232 * Cr - 5.4080610064599e-5 * Y + 0.00048449797120281 * k - 0.154362151871126) + Cr * (-0.000957964378445773 * Cr + 0.000817076911346625 * Y - 0.00477271405408747 * k + 1.53380253221734) + Y * (0.000961250184130688 * Y - 0.00266257332283933 * k + 0.48357088451265) + k * (-0.000336197177618394 * k + 0.484791561490776); 38600 data[offset++] = 107.268039397724 + Cb * (2.19927104525741e-5 * Cb - 0.000640992018297945 * Cr + 0.000659397001245577 * Y + 0.000426105652938837 * k - 0.176491792462875) + Cr * (-0.000778269941513683 * Cr + 0.00130872261408275 * Y + 0.000770482631801132 * k - 0.151051492775562) + Y * (0.00126935368114843 * Y - 0.00265090189010898 * k + 0.25802910206845) + k * (-0.000318913117588328 * k - 0.213742400323665); 38601 data[offset++] = -20.810012546947 + Cb * (-0.000570115196973677 * Cb - 2.63409051004589e-5 * Cr + 0.0020741088115012 * Y - 0.00288260236853442 * k + 0.814272968359295) + Cr * (-1.53496057440975e-5 * Cr - 0.000132689043961446 * Y + 0.000560833691242812 * k - 0.195152027534049) + Y * (0.00174418132927582 * Y - 0.00255243321439347 * k + 0.116935020465145) + k * (-0.000343531996510555 * k + 0.24165260232407); 38602 } 38603 38604 return data.subarray(0, offset); 38605 }, 38606 _convertYcckToCmyk: function convertYcckToCmyk(data) { 38607 var Y, Cb, Cr; 38608 38609 for (var i = 0, length = data.length; i < length; i += 4) { 38610 Y = data[i]; 38611 Cb = data[i + 1]; 38612 Cr = data[i + 2]; 38613 data[i] = 434.456 - Y - 1.402 * Cr; 38614 data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr; 38615 data[i + 2] = 481.816 - Y - 1.772 * Cb; 38616 } 38617 38618 return data; 38619 }, 38620 _convertCmykToRgb: function convertCmykToRgb(data) { 38621 var c, m, y, k; 38622 var offset = 0; 38623 38624 for (var i = 0, length = data.length; i < length; i += 4) { 38625 c = data[i]; 38626 m = data[i + 1]; 38627 y = data[i + 2]; 38628 k = data[i + 3]; 38629 data[offset++] = 255 + c * (-0.00006747147073602441 * c + 0.0008379262121013727 * m + 0.0002894718188643294 * y + 0.003264231057537806 * k - 1.1185611867203937) + m * (0.000026374107616089405 * m - 0.00008626949158638572 * y - 0.0002748769067499491 * k - 0.02155688794978967) + y * (-0.00003878099212869363 * y - 0.0003267808279485286 * k + 0.0686742238595345) - k * (0.0003361971776183937 * k + 0.7430659151342254); 38630 data[offset++] = 255 + c * (0.00013596372813588848 * c + 0.000924537132573585 * m + 0.00010567359618683593 * y + 0.0004791864687436512 * k - 0.3109689587515875) + m * (-0.00023545346108370344 * m + 0.0002702845253534714 * y + 0.0020200308977307156 * k - 0.7488052167015494) + y * (0.00006834815998235662 * y + 0.00015168452363460973 * k - 0.09751927774728933) - k * (0.00031891311758832814 * k + 0.7364883807733168); 38631 data[offset++] = 255 + c * (0.000013598650411385307 * c + 0.00012423956175490851 * m + 0.0004751985097583589 * y - 0.0000036729317476630422 * k - 0.05562186980264034) + m * (0.00016141380598724676 * m + 0.0009692239130725186 * y + 0.0007782692450036253 * k - 0.44015232367526463) + y * (5.068882914068769e-7 * y + 0.0017778369011375071 * k - 0.7591454649749609) - k * (0.0003435319965105553 * k + 0.7063770186160144); 38632 } 38633 38634 return data.subarray(0, offset); 38635 }, 38636 38637 getData({ 38638 width, 38639 height, 38640 forceRGB = false, 38641 isSourcePDF = false 38642 }) { 38643 if (this.numComponents > 4) { 38644 throw new JpegError("Unsupported color mode"); 38645 } 38646 38647 var data = this._getLinearizedBlockData(width, height, isSourcePDF); 38648 38649 if (this.numComponents === 1 && forceRGB) { 38650 var dataLength = data.length; 38651 var rgbData = new Uint8ClampedArray(dataLength * 3); 38652 var offset = 0; 38653 38654 for (var i = 0; i < dataLength; i++) { 38655 var grayColor = data[i]; 38656 rgbData[offset++] = grayColor; 38657 rgbData[offset++] = grayColor; 38658 rgbData[offset++] = grayColor; 38659 } 38660 38661 return rgbData; 38662 } else if (this.numComponents === 3 && this._isColorConversionNeeded) { 38663 return this._convertYccToRgb(data); 38664 } else if (this.numComponents === 4) { 38665 if (this._isColorConversionNeeded) { 38666 if (forceRGB) { 38667 return this._convertYcckToRgb(data); 38668 } 38669 38670 return this._convertYcckToCmyk(data); 38671 } else if (forceRGB) { 38672 return this._convertCmykToRgb(data); 38673 } 38674 } 38675 38676 return data; 38677 } 38678 38679 }; 38680 return JpegImage; 38681}(); 38682 38683exports.JpegImage = JpegImage; 38684 38685/***/ }), 38686/* 19 */ 38687/***/ (function(module, exports, __w_pdfjs_require__) { 38688 38689"use strict"; 38690 38691 38692Object.defineProperty(exports, "__esModule", { 38693 value: true 38694}); 38695exports.JpxStream = void 0; 38696 38697var _stream = __w_pdfjs_require__(11); 38698 38699var _jpx = __w_pdfjs_require__(20); 38700 38701var _util = __w_pdfjs_require__(2); 38702 38703const JpxStream = function JpxStreamClosure() { 38704 function JpxStream(stream, maybeLength, dict, params) { 38705 this.stream = stream; 38706 this.maybeLength = maybeLength; 38707 this.dict = dict; 38708 this.params = params; 38709 38710 _stream.DecodeStream.call(this, maybeLength); 38711 } 38712 38713 JpxStream.prototype = Object.create(_stream.DecodeStream.prototype); 38714 Object.defineProperty(JpxStream.prototype, "bytes", { 38715 get: function JpxStream_bytes() { 38716 return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength)); 38717 }, 38718 configurable: true 38719 }); 38720 38721 JpxStream.prototype.ensureBuffer = function (requested) {}; 38722 38723 JpxStream.prototype.readBlock = function () { 38724 if (this.eof) { 38725 return; 38726 } 38727 38728 const jpxImage = new _jpx.JpxImage(); 38729 jpxImage.parse(this.bytes); 38730 const width = jpxImage.width; 38731 const height = jpxImage.height; 38732 const componentsCount = jpxImage.componentsCount;
38733 const tileCount = jpxImage.tiles.length; 38734 38735 if (tileCount === 1) { 38736 this.buffer = jpxImage.tiles[0].items; 38737 } else { 38738 const data = new Uint8ClampedArray(width * height * componentsCount); 38739 38740 for (let k = 0; k < tileCount; k++) { 38741 const tileComponents = jpxImage.tiles[k]; 38742 const tileWidth = tileComponents.width; 38743 const tileHeight = tileComponents.height; 38744 const tileLeft = tileComponents.left; 38745 const tileTop = tileComponents.top; 38746 const src = tileComponents.items; 38747 let srcPosition = 0; 38748 let dataPosition = (width * tileTop + tileLeft) * componentsCount; 38749 const imgRowSize = width * componentsCount; 38750 const tileRowSize = tileWidth * componentsCount; 38751 38752 for (let j = 0; j < tileHeight; j++) { 38753 const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize); 38754 data.set(rowBytes, dataPosition); 38755 srcPosition += tileRowSize; 38756 dataPosition += imgRowSize; 38757 } 38758 } 38759 38760 this.buffer = data; 38761 } 38762 38763 this.bufferLength = this.buffer.length; 38764 this.eof = true; 38765 }; 38766 38767 return JpxStream; 38768}(); 38769 38770exports.JpxStream = JpxStream; 38771 38772/***/ }), 38773/* 20 */ 38774/***/ (function(module, exports, __w_pdfjs_require__) { 38775 38776"use strict"; 38777 38778 38779Object.defineProperty(exports, "__esModule", { 38780 value: true 38781}); 38782exports.JpxImage = void 0; 38783 38784var _util = __w_pdfjs_require__(2); 38785 38786var _core_utils = __w_pdfjs_require__(7); 38787 38788var _arithmetic_decoder = __w_pdfjs_require__(16); 38789 38790class JpxError extends _util.BaseException { 38791 constructor(msg) { 38792 super(`JPX error: ${msg}`); 38793 } 38794 38795} 38796 38797var JpxImage = function JpxImageClosure() { 38798 var SubbandsGainLog2 = { 38799 LL: 0, 38800 LH: 1, 38801 HL: 1, 38802 HH: 2 38803 }; 38804 38805 function JpxImage() { 38806 this.failOnCorruptedImage = false; 38807 } 38808 38809 JpxImage.prototype = { 38810 parse: function JpxImage_parse(data) { 38811 var head = (0, _core_utils.readUint16)(data, 0); 38812 38813 if (head === 0xff4f) { 38814 this.parseCodestream(data, 0, data.length); 38815 return; 38816 } 38817 38818 var position = 0, 38819 length = data.length; 38820 38821 while (position < length) { 38822 var headerSize = 8; 38823 var lbox = (0, _core_utils.readUint32)(data, position); 38824 var tbox = (0, _core_utils.readUint32)(data, position + 4); 38825 position += headerSize; 38826 38827 if (lbox === 1) { 38828 lbox = (0, _core_utils.readUint32)(data, position) * 4294967296 + (0, _core_utils.readUint32)(data, position + 4); 38829 position += 8; 38830 headerSize += 8; 38831 } 38832 38833 if (lbox === 0) { 38834 lbox = length - position + headerSize; 38835 } 38836 38837 if (lbox < headerSize) { 38838 throw new JpxError("Invalid box field size"); 38839 } 38840 38841 var dataLength = lbox - headerSize; 38842 var jumpDataLength = true; 38843 38844 switch (tbox) { 38845 case 0x6a703268: 38846 jumpDataLength = false; 38847 break; 38848 38849 case 0x636f6c72: 38850 var method = data[position]; 38851 38852 if (method === 1) { 38853 var colorspace = (0, _core_utils.readUint32)(data, position + 3); 38854 38855 switch (colorspace) { 38856 case 16: 38857 case 17: 38858 case 18: 38859 break; 38860 38861 default: 38862 (0, _util.warn)("Unknown colorspace " + colorspace); 38863 break; 38864 } 38865 } else if (method === 2) { 38866 (0, _util.info)("ICC profile not supported"); 38867 } 38868 38869 break; 38870 38871 case 0x6a703263: 38872 this.parseCodestream(data, position, position + dataLength); 38873 break; 38874 38875 case 0x6a502020: 38876 if ((0, _core_utils.readUint32)(data, position) !== 0x0d0a870a) { 38877 (0, _util.warn)("Invalid JP2 signature"); 38878 } 38879 38880 break; 38881 38882 case 0x6a501a1a: 38883 case 0x66747970: 38884 case 0x72726571: 38885 case 0x72657320: 38886 case 0x69686472: 38887 break; 38888 38889 default: 38890 var headerType = String.fromCharCode(tbox >> 24 & 0xff, tbox >> 16 & 0xff, tbox >> 8 & 0xff, tbox & 0xff); 38891 (0, _util.warn)("Unsupported header type " + tbox + " (" + headerType + ")"); 38892 break; 38893 } 38894 38895 if (jumpDataLength) { 38896 position += dataLength; 38897 } 38898 } 38899 }, 38900 parseImageProperties: function JpxImage_parseImageProperties(stream) { 38901 var newByte = stream.getByte(); 38902 38903 while (newByte >= 0) { 38904 var oldByte = newByte; 38905 newByte = stream.getByte(); 38906 var code = oldByte << 8 | newByte; 38907 38908 if (code === 0xff51) { 38909 stream.skip(4); 38910 var Xsiz = stream.getInt32() >>> 0; 38911 var Ysiz = stream.getInt32() >>> 0; 38912 var XOsiz = stream.getInt32() >>> 0; 38913 var YOsiz = stream.getInt32() >>> 0; 38914 stream.skip(16); 38915 var Csiz = stream.getUint16(); 38916 this.width = Xsiz - XOsiz; 38917 this.height = Ysiz - YOsiz; 38918 this.componentsCount = Csiz; 38919 this.bitsPerComponent = 8; 38920 return; 38921 } 38922 } 38923 38924 throw new JpxError("No size marker found in JPX stream"); 38925 }, 38926 parseCodestream: function JpxImage_parseCodestream(data, start, end) { 38927 var context = {}; 38928 var doNotRecover = false;
38929 38930 try { 38931 var position = start; 38932 38933 while (position + 1 < end) { 38934 var code = (0, _core_utils.readUint16)(data, position); 38935 position += 2; 38936 var length = 0, 38937 j, 38938 sqcd, 38939 spqcds, 38940 spqcdSize, 38941 scalarExpounded, 38942 tile; 38943 38944 switch (code) { 38945 case 0xff4f: 38946 context.mainHeader = true; 38947 break; 38948 38949 case 0xffd9: 38950 break; 38951 38952 case 0xff51: 38953 length = (0, _core_utils.readUint16)(data, position); 38954 var siz = {}; 38955 siz.Xsiz = (0, _core_utils.readUint32)(data, position + 4); 38956 siz.Ysiz = (0, _core_utils.readUint32)(data, position + 8); 38957 siz.XOsiz = (0, _core_utils.readUint32)(data, position + 12); 38958 siz.YOsiz = (0, _core_utils.readUint32)(data, position + 16); 38959 siz.XTsiz = (0, _core_utils.readUint32)(data, position + 20); 38960 siz.YTsiz = (0, _core_utils.readUint32)(data, position + 24); 38961 siz.XTOsiz = (0, _core_utils.readUint32)(data, position + 28); 38962 siz.YTOsiz = (0, _core_utils.readUint32)(data, position + 32); 38963 var componentsCount = (0, _core_utils.readUint16)(data, position + 36); 38964 siz.Csiz = componentsCount; 38965 var components = []; 38966 j = position + 38; 38967 38968 for (var i = 0; i < componentsCount; i++) { 38969 var component = { 38970 precision: (data[j] & 0x7f) + 1, 38971 isSigned: !!(data[j] & 0x80), 38972 XRsiz: data[j + 1], 38973 YRsiz: data[j + 2] 38974 }; 38975 j += 3; 38976 calculateComponentDimensions(component, siz); 38977 components.push(component); 38978 } 38979 38980 context.SIZ = siz; 38981 context.components = components; 38982 calculateTileGrids(context, components); 38983 context.QCC = []; 38984 context.COC = []; 38985 break; 38986 38987 case 0xff5c: 38988 length = (0, _core_utils.readUint16)(data, position); 38989 var qcd = {}; 38990 j = position + 2; 38991 sqcd = data[j++]; 38992 38993 switch (sqcd & 0x1f) { 38994 case 0: 38995 spqcdSize = 8; 38996 scalarExpounded = true; 38997 break; 38998 38999 case 1: 39000 spqcdSize = 16; 39001 scalarExpounded = false; 39002 break; 39003 39004 case 2: 39005 spqcdSize = 16; 39006 scalarExpounded = true; 39007 break; 39008 39009 default: 39010 throw new Error("Invalid SQcd value " + sqcd); 39011 } 39012 39013 qcd.noQuantization = spqcdSize === 8; 39014 qcd.scalarExpounded = scalarExpounded; 39015 qcd.guardBits = sqcd >> 5; 39016 spqcds = []; 39017 39018 while (j < length + position) { 39019 var spqcd = {}; 39020 39021 if (spqcdSize === 8) { 39022 spqcd.epsilon = data[j++] >> 3; 39023 spqcd.mu = 0; 39024 } else { 39025 spqcd.epsilon = data[j] >> 3; 39026 spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1]; 39027 j += 2; 39028 } 39029 39030 spqcds.push(spqcd); 39031 } 39032 39033 qcd.SPqcds = spqcds; 39034 39035 if (context.mainHeader) { 39036 context.QCD = qcd; 39037 } else { 39038 context.currentTile.QCD = qcd; 39039 context.currentTile.QCC = []; 39040 } 39041 39042 break; 39043 39044 case 0xff5d: 39045 length = (0, _core_utils.readUint16)(data, position); 39046 var qcc = {}; 39047 j = position + 2; 39048 var cqcc; 39049 39050 if (context.SIZ.Csiz < 257) { 39051 cqcc = data[j++]; 39052 } else { 39053 cqcc = (0, _core_utils.readUint16)(data, j); 39054 j += 2; 39055 } 39056 39057 sqcd = data[j++]; 39058 39059 switch (sqcd & 0x1f) { 39060 case 0: 39061 spqcdSize = 8; 39062 scalarExpounded = true; 39063 break; 39064 39065 case 1: 39066 spqcdSize = 16; 39067 scalarExpounded = false;
39068 break; 39069 39070 case 2: 39071 spqcdSize = 16; 39072 scalarExpounded = true; 39073 break; 39074 39075 default: 39076 throw new Error("Invalid SQcd value " + sqcd); 39077 } 39078 39079 qcc.noQuantization = spqcdSize === 8; 39080 qcc.scalarExpounded = scalarExpounded; 39081 qcc.guardBits = sqcd >> 5; 39082 spqcds = []; 39083 39084 while (j < length + position) { 39085 spqcd = {}; 39086 39087 if (spqcdSize === 8) { 39088 spqcd.epsilon = data[j++] >> 3; 39089 spqcd.mu = 0; 39090 } else { 39091 spqcd.epsilon = data[j] >> 3; 39092 spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1]; 39093 j += 2; 39094 } 39095 39096 spqcds.push(spqcd); 39097 } 39098 39099 qcc.SPqcds = spqcds; 39100 39101 if (context.mainHeader) { 39102 context.QCC[cqcc] = qcc; 39103 } else { 39104 context.currentTile.QCC[cqcc] = qcc; 39105 } 39106 39107 break; 39108 39109 case 0xff52: 39110 length = (0, _core_utils.readUint16)(data, position); 39111 var cod = {}; 39112 j = position + 2; 39113 var scod = data[j++]; 39114 cod.entropyCoderWithCustomPrecincts = !!(scod & 1); 39115 cod.sopMarkerUsed = !!(scod & 2); 39116 cod.ephMarkerUsed = !!(scod & 4); 39117 cod.progressionOrder = data[j++]; 39118 cod.layersCount = (0, _core_utils.readUint16)(data, j); 39119 j += 2; 39120 cod.multipleComponentTransform = data[j++]; 39121 cod.decompositionLevelsCount = data[j++]; 39122 cod.xcb = (data[j++] & 0xf) + 2; 39123 cod.ycb = (data[j++] & 0xf) + 2; 39124 var blockStyle = data[j++]; 39125 cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1); 39126 cod.resetContextProbabilities = !!(blockStyle & 2); 39127 cod.terminationOnEachCodingPass = !!(blockStyle & 4); 39128 cod.verticallyStripe = !!(blockStyle & 8); 39129 cod.predictableTermination = !!(blockStyle & 16); 39130 cod.segmentationSymbolUsed = !!(blockStyle & 32); 39131 cod.reversibleTransformation = data[j++]; 39132 39133 if (cod.entropyCoderWithCustomPrecincts) { 39134 var precinctsSizes = []; 39135 39136 while (j < length + position) { 39137 var precinctsSize = data[j++]; 39138 precinctsSizes.push({ 39139 PPx: precinctsSize & 0xf, 39140 PPy: precinctsSize >> 4 39141 }); 39142 } 39143 39144 cod.precinctsSizes = precinctsSizes; 39145 } 39146 39147 var unsupported = []; 39148 39149 if (cod.selectiveArithmeticCodingBypass) { 39150 unsupported.push("selectiveArithmeticCodingBypass"); 39151 } 39152 39153 if (cod.resetContextProbabilities) { 39154 unsupported.push("resetContextProbabilities"); 39155 } 39156 39157 if (cod.terminationOnEachCodingPass) { 39158 unsupported.push("terminationOnEachCodingPass"); 39159 } 39160 39161 if (cod.verticallyStripe) { 39162 unsupported.push("verticallyStripe"); 39163 } 39164 39165 if (cod.predictableTermination) { 39166 unsupported.push("predictableTermination"); 39167 } 39168 39169 if (unsupported.length > 0) { 39170 doNotRecover = true; 39171 throw new Error("Unsupported COD options (" + unsupported.join(", ") + ")"); 39172 } 39173 39174 if (context.mainHeader) { 39175 context.COD = cod; 39176 } else { 39177 context.currentTile.COD = cod; 39178 context.currentTile.COC = []; 39179 } 39180 39181 break; 39182 39183 case 0xff90: 39184 length = (0, _core_utils.readUint16)(data, position); 39185 tile = {}; 39186 tile.index = (0, _core_utils.readUint16)(data, position + 2); 39187 tile.length = (0, _core_utils.readUint32)(data, position + 4); 39188 tile.dataEnd = tile.length + position - 2; 39189 tile.partIndex = data[position + 8]; 39190 tile.partsCount = data[position + 9]; 39191 context.mainHeader = false;
39192 39193 if (tile.partIndex === 0) { 39194 tile.COD = context.COD; 39195 tile.COC = context.COC.slice(0); 39196 tile.QCD = context.QCD; 39197 tile.QCC = context.QCC.slice(0); 39198 } 39199 39200 context.currentTile = tile; 39201 break; 39202 39203 case 0xff93: 39204 tile = context.currentTile; 39205 39206 if (tile.partIndex === 0) { 39207 initializeTile(context, tile.index); 39208 buildPackets(context); 39209 } 39210 39211 length = tile.dataEnd - position; 39212 parseTilePackets(context, data, position, length); 39213 break; 39214 39215 case 0xff55: 39216 case 0xff57: 39217 case 0xff58: 39218 case 0xff64: 39219 length = (0, _core_utils.readUint16)(data, position); 39220 break; 39221 39222 case 0xff53: 39223 throw new Error("Codestream code 0xFF53 (COC) is not implemented"); 39224 39225 default: 39226 throw new Error("Unknown codestream code: " + code.toString(16)); 39227 } 39228 39229 position += length; 39230 } 39231 } catch (e) { 39232 if (doNotRecover || this.failOnCorruptedImage) { 39233 throw new JpxError(e.message); 39234 } else { 39235 (0, _util.warn)("JPX: Trying to recover from: " + e.message); 39236 } 39237 } 39238 39239 this.tiles = transformComponents(context); 39240 this.width = context.SIZ.Xsiz - context.SIZ.XOsiz; 39241 this.height = context.SIZ.Ysiz - context.SIZ.YOsiz; 39242 this.componentsCount = context.SIZ.Csiz; 39243 } 39244 }; 39245 39246 function calculateComponentDimensions(component, siz) { 39247 component.x0 = Math.ceil(siz.XOsiz / component.XRsiz); 39248 component.x1 = Math.ceil(siz.Xsiz / component.XRsiz); 39249 component.y0 = Math.ceil(siz.YOsiz / component.YRsiz); 39250 component.y1 = Math.ceil(siz.Ysiz / component.YRsiz); 39251 component.width = component.x1 - component.x0; 39252 component.height = component.y1 - component.y0; 39253 } 39254 39255 function calculateTileGrids(context, components) { 39256 var siz = context.SIZ; 39257 var tile, 39258 tiles = []; 39259 var numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz); 39260 var numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz); 39261 39262 for (var q = 0; q < numYtiles; q++) { 39263 for (var p = 0; p < numXtiles; p++) { 39264 tile = {}; 39265 tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz); 39266 tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz); 39267 tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz); 39268 tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz); 39269 tile.width = tile.tx1 - tile.tx0; 39270 tile.height = tile.ty1 - tile.ty0; 39271 tile.components = []; 39272 tiles.push(tile); 39273 } 39274 } 39275 39276 context.tiles = tiles; 39277 var componentsCount = siz.Csiz; 39278 39279 for (var i = 0, ii = componentsCount; i < ii; i++) { 39280 var component = components[i]; 39281 39282 for (var j = 0, jj = tiles.length; j < jj; j++) { 39283 var tileComponent = {}; 39284 tile = tiles[j]; 39285 tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz); 39286 tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz); 39287 tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz); 39288 tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz); 39289 tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0; 39290 tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0; 39291 tile.components[i] = tileComponent; 39292 } 39293 } 39294 } 39295 39296 function getBlocksDimensions(context, component, r) { 39297 var codOrCoc = component.codingStyleParameters; 39298 var result = {}; 39299 39300 if (!codOrCoc.entropyCoderWithCustomPrecincts) { 39301 result.PPx = 15; 39302 result.PPy = 15; 39303 } else { 39304 result.PPx = codOrCoc.precinctsSizes[r].PPx; 39305 result.PPy = codOrCoc.precinctsSizes[r].PPy; 39306 } 39307 39308 result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx); 39309 result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy); 39310 return result; 39311 } 39312 39313 function buildPrecincts(context, resolution, dimensions) { 39314 var precinctWidth = 1 << dimensions.PPx; 39315 var precinctHeight = 1 << dimensions.PPy; 39316 var isZeroRes = resolution.resLevel === 0; 39317 var precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1); 39318 var precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1); 39319 var numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0; 39320 var numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0; 39321 var numprecincts = numprecinctswide * numprecinctshigh; 39322 resolution.precinctParameters = { 39323 precinctWidth, 39324 precinctHeight, 39325 numprecinctswide, 39326 numprecinctshigh, 39327 numprecincts, 39328 precinctWidthInSubband, 39329 precinctHeightInSubband 39330 }; 39331 } 39332 39333 function buildCodeblocks(context, subband, dimensions) { 39334 var xcb_ = dimensions.xcb_; 39335 var ycb_ = dimensions.ycb_; 39336 var codeblockWidth = 1 << xcb_; 39337 var codeblockHeight = 1 << ycb_; 39338 var cbx0 = subband.tbx0 >> xcb_; 39339 var cby0 = subband.tby0 >> ycb_; 39340 var cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_; 39341 var cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_; 39342 var precinctParameters = subband.resolution.precinctParameters; 39343 var codeblocks = []; 39344 var precincts = []; 39345 var i, j, codeblock, precinctNumber; 39346 39347 for (j = cby0; j < cby1; j++) { 39348 for (i = cbx0; i < cbx1; i++) { 39349 codeblock = { 39350 cbx: i, 39351 cby: j, 39352 tbx0: codeblockWidth * i, 39353 tby0: codeblockHeight * j, 39354 tbx1: codeblockWidth * (i + 1), 39355 tby1: codeblockHeight * (j + 1) 39356 }; 39357 codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0); 39358 codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0); 39359 codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1); 39360 codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1); 39361 var pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband); 39362 var pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband); 39363 precinctNumber = pi + pj * precinctParameters.numprecinctswide; 39364 codeblock.precinctNumber = precinctNumber; 39365 codeblock.subbandType = subband.type; 39366 codeblock.Lblock = 3; 39367 39368 if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) { 39369 continue; 39370 } 39371 39372 codeblocks.push(codeblock); 39373 var precinct = precincts[precinctNumber]; 39374 39375 if (precinct !== undefined) { 39376 if (i < precinct.cbxMin) { 39377 precinct.cbxMin = i; 39378 } else if (i > precinct.cbxMax) { 39379 precinct.cbxMax = i; 39380 } 39381 39382 if (j < precinct.cbyMin) { 39383 precinct.cbxMin = j; 39384 } else if (j >
vendor: 11,156 bytes, lines 39384-39747
39384 precinct.cbyMax) { 39385 precinct.cbyMax = j; 39386 } 39387 } else { 39388 precincts[precinctNumber] = precinct = { 39389 cbxMin: i, 39390 cbyMin: j, 39391 cbxMax: i, 39392 cbyMax: j 39393 }; 39394 } 39395 39396 codeblock.precinct = precinct; 39397 } 39398 } 39399 39400 subband.codeblockParameters = { 39401 codeblockWidth: xcb_, 39402 codeblockHeight: ycb_, 39403 numcodeblockwide: cbx1 - cbx0 + 1, 39404 numcodeblockhigh: cby1 - cby0 + 1 39405 }; 39406 subband.codeblocks = codeblocks; 39407 subband.precincts = precincts; 39408 } 39409 39410 function createPacket(resolution, precinctNumber, layerNumber) { 39411 var precinctCodeblocks = []; 39412 var subbands = resolution.subbands; 39413 39414 for (var i = 0, ii = subbands.length; i < ii; i++) { 39415 var subband = subbands[i]; 39416 var codeblocks = subband.codeblocks; 39417 39418 for (var j = 0, jj = codeblocks.length; j < jj; j++) { 39419 var codeblock = codeblocks[j]; 39420 39421 if (codeblock.precinctNumber !== precinctNumber) { 39422 continue; 39423 } 39424 39425 precinctCodeblocks.push(codeblock); 39426 } 39427 } 39428 39429 return { 39430 layerNumber, 39431 codeblocks: precinctCodeblocks 39432 }; 39433 } 39434 39435 function LayerResolutionComponentPositionIterator(context) { 39436 var siz = context.SIZ; 39437 var tileIndex = context.currentTile.index; 39438 var tile = context.tiles[tileIndex]; 39439 var layersCount = tile.codingStyleDefaultParameters.layersCount; 39440 var componentsCount = siz.Csiz; 39441 var maxDecompositionLevelsCount = 0; 39442 39443 for (var q = 0; q < componentsCount; q++) { 39444 maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount); 39445 } 39446 39447 var l = 0, 39448 r = 0, 39449 i = 0, 39450 k = 0; 39451 39452 this.nextPacket = function JpxImage_nextPacket() { 39453 for (; l < layersCount; l++) { 39454 for (; r <= maxDecompositionLevelsCount; r++) { 39455 for (; i < componentsCount; i++) { 39456 var component = tile.components[i]; 39457 39458 if (r > component.codingStyleParameters.decompositionLevelsCount) { 39459 continue; 39460 } 39461 39462 var resolution = component.resolutions[r]; 39463 var numprecincts = resolution.precinctParameters.numprecincts; 39464 39465 for (; k < numprecincts;) { 39466 var packet = createPacket(resolution, k, l); 39467 k++; 39468 return packet; 39469 } 39470 39471 k = 0; 39472 } 39473 39474 i = 0; 39475 } 39476 39477 r = 0; 39478 } 39479 39480 throw new JpxError("Out of packets"); 39481 }; 39482 } 39483 39484 function ResolutionLayerComponentPositionIterator(context) { 39485 var siz = context.SIZ; 39486 var tileIndex = context.currentTile.index; 39487 var tile = context.tiles[tileIndex]; 39488 var layersCount = tile.codingStyleDefaultParameters.layersCount; 39489 var componentsCount = siz.Csiz; 39490 var maxDecompositionLevelsCount = 0; 39491 39492 for (var q = 0; q < componentsCount; q++) { 39493 maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount); 39494 } 39495 39496 var r = 0, 39497 l = 0, 39498 i = 0, 39499 k = 0; 39500 39501 this.nextPacket = function JpxImage_nextPacket() { 39502 for (; r <= maxDecompositionLevelsCount; r++) { 39503 for (; l < layersCount; l++) { 39504 for (; i < componentsCount; i++) { 39505 var component = tile.components[i]; 39506 39507 if (r > component.codingStyleParameters.decompositionLevelsCount) { 39508 continue; 39509 } 39510 39511 var resolution = component.resolutions[r]; 39512 var numprecincts = resolution.precinctParameters.numprecincts; 39513 39514 for (; k < numprecincts;) { 39515 var packet = createPacket(resolution, k, l); 39516 k++; 39517 return packet; 39518 } 39519 39520 k = 0; 39521 } 39522 39523 i = 0; 39524 } 39525 39526 l = 0; 39527 } 39528 39529 throw new JpxError("Out of packets"); 39530 }; 39531 } 39532 39533 function ResolutionPositionComponentLayerIterator(context) { 39534 var siz = context.SIZ; 39535 var tileIndex = context.currentTile.index; 39536 var tile = context.tiles[tileIndex]; 39537 var layersCount = tile.codingStyleDefaultParameters.layersCount; 39538 var componentsCount = siz.Csiz; 39539 var l, r, c, p; 39540 var maxDecompositionLevelsCount = 0; 39541 39542 for (c = 0; c < componentsCount; c++) { 39543 var component = tile.components[c]; 39544 maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount); 39545 } 39546 39547 var maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1); 39548 39549 for (r = 0; r <= maxDecompositionLevelsCount; ++r) { 39550 var maxNumPrecincts = 0; 39551 39552 for (c = 0; c < componentsCount; ++c) { 39553 var resolutions = tile.components[c].resolutions; 39554 39555 if (r < resolutions.length) { 39556 maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts); 39557 } 39558 } 39559 39560 maxNumPrecinctsInLevel[r] = maxNumPrecincts; 39561 } 39562 39563 l = 0; 39564 r = 0; 39565 c = 0; 39566 p = 0; 39567 39568 this.nextPacket = function JpxImage_nextPacket() { 39569 for (; r <= maxDecompositionLevelsCount; r++) { 39570 for (; p < maxNumPrecinctsInLevel[r]; p++) { 39571 for (; c < componentsCount; c++) { 39572 var component = tile.components[c]; 39573 39574 if (r > component.codingStyleParameters.decompositionLevelsCount) { 39575 continue; 39576 } 39577 39578 var resolution = component.resolutions[r]; 39579 var numprecincts = resolution.precinctParameters.numprecincts; 39580 39581 if (p >= numprecincts) { 39582 continue; 39583 } 39584 39585 for (; l < layersCount;) { 39586 var packet = createPacket(resolution, p, l); 39587 l++; 39588 return packet; 39589 } 39590 39591 l = 0; 39592 } 39593 39594 c = 0; 39595 } 39596 39597 p = 0; 39598 } 39599 39600 throw new JpxError("Out of packets"); 39601 }; 39602 } 39603 39604 function PositionComponentResolutionLayerIterator(context) { 39605 var siz = context.SIZ; 39606 var tileIndex = context.currentTile.index; 39607 var tile = context.tiles[tileIndex]; 39608 var layersCount = tile.codingStyleDefaultParameters.layersCount; 39609 var componentsCount = siz.Csiz; 39610 var precinctsSizes = getPrecinctSizesInImageScale(tile); 39611 var precinctsIterationSizes = precinctsSizes; 39612 var l = 0, 39613 r = 0, 39614 c = 0, 39615 px = 0, 39616 py = 0; 39617 39618 this.nextPacket = function JpxImage_nextPacket() { 39619 for (; py < precinctsIterationSizes.maxNumHigh; py++) { 39620 for (; px < precinctsIterationSizes.maxNumWide; px++) { 39621 for (; c < componentsCount; c++) { 39622 var component = tile.components[c]; 39623 var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount; 39624 39625 for (; r <= decompositionLevelsCount; r++) { 39626 var resolution = component.resolutions[r]; 39627 var sizeInImageScale = precinctsSizes.components[c].resolutions[r]; 39628 var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution); 39629 39630 if (k === null) { 39631 continue; 39632 } 39633 39634 for (; l < layersCount;) { 39635 var packet = createPacket(resolution, k, l); 39636 l++; 39637 return packet; 39638 } 39639 39640 l = 0; 39641 } 39642 39643 r = 0; 39644 } 39645 39646 c = 0; 39647 } 39648 39649 px = 0; 39650 } 39651 39652 throw new JpxError("Out of packets"); 39653 }; 39654 } 39655 39656 function ComponentPositionResolutionLayerIterator(context) { 39657 var siz = context.SIZ; 39658 var tileIndex = context.currentTile.index; 39659 var tile = context.tiles[tileIndex]; 39660 var layersCount = tile.codingStyleDefaultParameters.layersCount; 39661 var componentsCount = siz.Csiz; 39662 var precinctsSizes = getPrecinctSizesInImageScale(tile); 39663 var l = 0, 39664 r = 0, 39665 c = 0, 39666 px = 0, 39667 py = 0; 39668 39669 this.nextPacket = function JpxImage_nextPacket() { 39670 for (; c < componentsCount; ++c) { 39671 var component = tile.components[c]; 39672 var precinctsIterationSizes = precinctsSizes.components[c]; 39673 var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount; 39674 39675 for (; py < precinctsIterationSizes.maxNumHigh; py++) { 39676 for (; px < precinctsIterationSizes.maxNumWide; px++) { 39677 for (; r <= decompositionLevelsCount; r++) { 39678 var resolution = component.resolutions[r]; 39679 var sizeInImageScale = precinctsIterationSizes.resolutions[r]; 39680 var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution); 39681 39682 if (k === null) { 39683 continue; 39684 } 39685 39686 for (; l < layersCount;) { 39687 var packet = createPacket(resolution, k, l); 39688 l++; 39689 return packet; 39690 } 39691 39692 l = 0; 39693 } 39694 39695 r = 0; 39696 } 39697 39698 px = 0; 39699 } 39700 39701 py = 0; 39702 } 39703 39704 throw new JpxError("Out of packets"); 39705 }; 39706 } 39707 39708 function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) { 39709 var posX = pxIndex * precinctIterationSizes.minWidth; 39710 var posY = pyIndex * precinctIterationSizes.minHeight; 39711 39712 if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) { 39713 return null; 39714 } 39715 39716 var startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide; 39717 return posX / sizeInImageScale.height + startPrecinctRowIndex; 39718 } 39719 39720 function getPrecinctSizesInImageScale(tile) { 39721 var componentsCount = tile.components.length; 39722 var minWidth = Number.MAX_VALUE; 39723 var minHeight = Number.MAX_VALUE; 39724 var maxNumWide = 0; 39725 var maxNumHigh = 0; 39726 var sizePerComponent = new Array(componentsCount); 39727 39728 for (var c = 0; c < componentsCount; c++) { 39729 var component = tile.components[c]; 39730 var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount; 39731 var sizePerResolution = new Array(decompositionLevelsCount + 1); 39732 var minWidthCurrentComponent = Number.MAX_VALUE; 39733 var minHeightCurrentComponent = Number.MAX_VALUE; 39734 var maxNumWideCurrentComponent = 0; 39735 var maxNumHighCurrentComponent = 0; 39736 var scale = 1; 39737 39738 for (var r = decompositionLevelsCount; r >= 0; --r) { 39739 var resolution = component.resolutions[r]; 39740 var widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth; 39741 var heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight; 39742 minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution); 39743 minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution); 39744 maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide); 39745 maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh); 39746 sizePerResolution[r] = { 39747 width: widthCurrentResolution,
39748 height: heightCurrentResolution 39749 }; 39750 scale <<= 1; 39751 } 39752 39753 minWidth = Math.min(minWidth, minWidthCurrentComponent); 39754 minHeight = Math.min(minHeight, minHeightCurrentComponent); 39755 maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent); 39756 maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent); 39757 sizePerComponent[c] = { 39758 resolutions: sizePerResolution, 39759 minWidth: minWidthCurrentComponent, 39760 minHeight: minHeightCurrentComponent, 39761 maxNumWide: maxNumWideCurrentComponent, 39762 maxNumHigh: maxNumHighCurrentComponent 39763 }; 39764 } 39765 39766 return { 39767 components: sizePerComponent, 39768 minWidth, 39769 minHeight, 39770 maxNumWide, 39771 maxNumHigh 39772 }; 39773 } 39774 39775 function buildPackets(context) { 39776 var siz = context.SIZ; 39777 var tileIndex = context.currentTile.index; 39778 var tile = context.tiles[tileIndex]; 39779 var componentsCount = siz.Csiz; 39780 39781 for (var c = 0; c < componentsCount; c++) { 39782 var component = tile.components[c]; 39783 var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount; 39784 var resolutions = []; 39785 var subbands = []; 39786 39787 for (var r = 0; r <= decompositionLevelsCount; r++) { 39788 var blocksDimensions = getBlocksDimensions(context, component, r); 39789 var resolution = {}; 39790 var scale = 1 << decompositionLevelsCount - r; 39791 resolution.trx0 = Math.ceil(component.tcx0 / scale); 39792 resolution.try0 = Math.ceil(component.tcy0 / scale); 39793 resolution.trx1 = Math.ceil(component.tcx1 / scale); 39794 resolution.try1 = Math.ceil(component.tcy1 / scale); 39795 resolution.resLevel = r; 39796 buildPrecincts(context, resolution, blocksDimensions); 39797 resolutions.push(resolution); 39798 var subband; 39799 39800 if (r === 0) { 39801 subband = {}; 39802 subband.type = "LL"; 39803 subband.tbx0 = Math.ceil(component.tcx0 / scale); 39804 subband.tby0 = Math.ceil(component.tcy0 / scale); 39805 subband.tbx1 = Math.ceil(component.tcx1 / scale); 39806 subband.tby1 = Math.ceil(component.tcy1 / scale); 39807 subband.resolution = resolution; 39808 buildCodeblocks(context, subband, blocksDimensions); 39809 subbands.push(subband); 39810 resolution.subbands = [subband]; 39811 } else { 39812 var bscale = 1 << decompositionLevelsCount - r + 1; 39813 var resolutionSubbands = []; 39814 subband = {}; 39815 subband.type = "HL"; 39816 subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5); 39817 subband.tby0 = Math.ceil(component.tcy0 / bscale); 39818 subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5); 39819 subband.tby1 = Math.ceil(component.tcy1 / bscale); 39820 subband.resolution = resolution; 39821 buildCodeblocks(context, subband, blocksDimensions); 39822 subbands.push(subband); 39823 resolutionSubbands.push(subband); 39824 subband = {}; 39825 subband.type = "LH"; 39826 subband.tbx0 = Math.ceil(component.tcx0 / bscale); 39827 subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5); 39828 subband.tbx1 = Math.ceil(component.tcx1 / bscale); 39829 subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5); 39830 subband.resolution = resolution; 39831 buildCodeblocks(context, subband, blocksDimensions); 39832 subbands.push(subband); 39833 resolutionSubbands.push(subband); 39834 subband = {}; 39835 subband.type = "HH"; 39836 subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5); 39837 subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5); 39838 subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5); 39839 subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5); 39840 subband.resolution = resolution; 39841 buildCodeblocks(context, subband, blocksDimensions); 39842 subbands.push(subband); 39843 resolutionSubbands.push(subband); 39844 resolution.subbands = resolutionSubbands; 39845 } 39846 } 39847 39848 component.resolutions = resolutions; 39849 component.subbands = subbands; 39850 } 39851 39852 var progressionOrder = tile.codingStyleDefaultParameters.progressionOrder; 39853 39854 switch (progressionOrder) { 39855 case 0: 39856 tile.packetsIterator = new LayerResolutionComponentPositionIterator(context); 39857 break; 39858 39859 case 1: 39860 tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context); 39861 break; 39862 39863 case 2: 39864 tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context); 39865 break; 39866 39867 case 3: 39868 tile.packetsIterator = new PositionComponentResolutionLayerIterator(context); 39869 break; 39870 39871 case 4: 39872 tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context); 39873 break; 39874 39875 default: 39876 throw new JpxError(`Unsupported progression order ${progressionOrder}`); 39877 } 39878 } 39879 39880 function parseTilePackets(context, data, offset, dataLength) { 39881 var position = 0; 39882 var buffer, 39883 bufferSize = 0, 39884 skipNextBit = false;
vendor: 9,133 bytes, lines 39885-40212
39885 39886 function readBits(count) { 39887 while (bufferSize < count) { 39888 var b = data[offset + position]; 39889 position++; 39890 39891 if (skipNextBit) { 39892 buffer = buffer << 7 | b; 39893 bufferSize += 7; 39894 skipNextBit = false; 39895 } else { 39896 buffer = buffer << 8 | b; 39897 bufferSize += 8; 39898 } 39899 39900 if (b === 0xff) { 39901 skipNextBit = true; 39902 } 39903 } 39904 39905 bufferSize -= count; 39906 return buffer >>> bufferSize & (1 << count) - 1; 39907 } 39908 39909 function skipMarkerIfEqual(value) { 39910 if (data[offset + position - 1] === 0xff && data[offset + position] === value) { 39911 skipBytes(1); 39912 return true; 39913 } else if (data[offset + position] === 0xff && data[offset + position + 1] === value) { 39914 skipBytes(2); 39915 return true; 39916 } 39917 39918 return false; 39919 } 39920 39921 function skipBytes(count) { 39922 position += count; 39923 } 39924 39925 function alignToByte() { 39926 bufferSize = 0; 39927 39928 if (skipNextBit) { 39929 position++; 39930 skipNextBit = false; 39931 } 39932 } 39933 39934 function readCodingpasses() { 39935 if (readBits(1) === 0) { 39936 return 1; 39937 } 39938 39939 if (readBits(1) === 0) { 39940 return 2; 39941 } 39942 39943 var value = readBits(2); 39944 39945 if (value < 3) { 39946 return value + 3; 39947 } 39948 39949 value = readBits(5); 39950 39951 if (value < 31) { 39952 return value + 6; 39953 } 39954 39955 value = readBits(7); 39956 return value + 37; 39957 } 39958 39959 var tileIndex = context.currentTile.index; 39960 var tile = context.tiles[tileIndex]; 39961 var sopMarkerUsed = context.COD.sopMarkerUsed; 39962 var ephMarkerUsed = context.COD.ephMarkerUsed; 39963 var packetsIterator = tile.packetsIterator; 39964 39965 while (position < dataLength) { 39966 alignToByte(); 39967 39968 if (sopMarkerUsed && skipMarkerIfEqual(0x91)) { 39969 skipBytes(4); 39970 } 39971 39972 var packet = packetsIterator.nextPacket(); 39973 39974 if (!readBits(1)) { 39975 continue; 39976 } 39977 39978 var layerNumber = packet.layerNumber; 39979 var queue = [], 39980 codeblock; 39981 39982 for (var i = 0, ii = packet.codeblocks.length; i < ii; i++) { 39983 codeblock = packet.codeblocks[i]; 39984 var precinct = codeblock.precinct; 39985 var codeblockColumn = codeblock.cbx - precinct.cbxMin; 39986 var codeblockRow = codeblock.cby - precinct.cbyMin; 39987 var codeblockIncluded = false; 39988 var firstTimeInclusion = false; 39989 var valueReady; 39990 39991 if (codeblock["included"] !== undefined) { 39992 codeblockIncluded = !!readBits(1); 39993 } else { 39994 precinct = codeblock.precinct; 39995 var inclusionTree, zeroBitPlanesTree; 39996 39997 if (precinct["inclusionTree"] !== undefined) { 39998 inclusionTree = precinct.inclusionTree; 39999 } else { 40000 var width = precinct.cbxMax - precinct.cbxMin + 1; 40001 var height = precinct.cbyMax - precinct.cbyMin + 1; 40002 inclusionTree = new InclusionTree(width, height, layerNumber); 40003 zeroBitPlanesTree = new TagTree(width, height); 40004 precinct.inclusionTree = inclusionTree; 40005 precinct.zeroBitPlanesTree = zeroBitPlanesTree; 40006 } 40007 40008 if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) { 40009 while (true) { 40010 if (readBits(1)) { 40011 valueReady = !inclusionTree.nextLevel(); 40012 40013 if (valueReady) { 40014 codeblock.included = true; 40015 codeblockIncluded = firstTimeInclusion = true; 40016 break; 40017 } 40018 } else { 40019 inclusionTree.incrementValue(layerNumber); 40020 break; 40021 } 40022 } 40023 } 40024 } 40025 40026 if (!codeblockIncluded) { 40027 continue; 40028 } 40029 40030 if (firstTimeInclusion) { 40031 zeroBitPlanesTree = precinct.zeroBitPlanesTree; 40032 zeroBitPlanesTree.reset(codeblockColumn, codeblockRow); 40033 40034 while (true) { 40035 if (readBits(1)) { 40036 valueReady = !zeroBitPlanesTree.nextLevel(); 40037 40038 if (valueReady) { 40039 break; 40040 } 40041 } else { 40042 zeroBitPlanesTree.incrementValue(); 40043 } 40044 } 40045 40046 codeblock.zeroBitPlanes = zeroBitPlanesTree.value; 40047 } 40048 40049 var codingpasses = readCodingpasses(); 40050 40051 while (readBits(1)) { 40052 codeblock.Lblock++; 40053 } 40054 40055 var codingpassesLog2 = (0, _core_utils.log2)(codingpasses); 40056 var bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock; 40057 var codedDataLength = readBits(bits); 40058 queue.push({ 40059 codeblock, 40060 codingpasses, 40061 dataLength: codedDataLength 40062 }); 40063 } 40064 40065 alignToByte(); 40066 40067 if (ephMarkerUsed) { 40068 skipMarkerIfEqual(0x92); 40069 } 40070 40071 while (queue.length > 0) { 40072 var packetItem = queue.shift(); 40073 codeblock = packetItem.codeblock; 40074 40075 if (codeblock["data"] === undefined) { 40076 codeblock.data = []; 40077 } 40078 40079 codeblock.data.push({ 40080 data, 40081 start: offset + position, 40082 end: offset + position + packetItem.dataLength, 40083 codingpasses: packetItem.codingpasses 40084 }); 40085 position += packetItem.dataLength; 40086 } 40087 } 40088 40089 return position; 40090 } 40091 40092 function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed) { 40093 var x0 = subband.tbx0; 40094 var y0 = subband.tby0; 40095 var width = subband.tbx1 - subband.tbx0; 40096 var codeblocks = subband.codeblocks; 40097 var right = subband.type.charAt(0) === "H" ? 1 : 0; 40098 var bottom = subband.type.charAt(1) === "H" ? levelWidth : 0; 40099 40100 for (var i = 0, ii = codeblocks.length; i < ii; ++i) { 40101 var codeblock = codeblocks[i]; 40102 var blockWidth = codeblock.tbx1_ - codeblock.tbx0_; 40103 var blockHeight = codeblock.tby1_ - codeblock.tby0_; 40104 40105 if (blockWidth === 0 || blockHeight === 0) { 40106 continue; 40107 } 40108 40109 if (codeblock["data"] === undefined) { 40110 continue; 40111 } 40112 40113 var bitModel, currentCodingpassType; 40114 bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb); 40115 currentCodingpassType = 2; 40116 var data = codeblock.data, 40117 totalLength = 0, 40118 codingpasses = 0; 40119 var j, jj, dataItem; 40120 40121 for (j = 0, jj = data.length; j < jj; j++) { 40122 dataItem = data[j]; 40123 totalLength += dataItem.end - dataItem.start; 40124 codingpasses += dataItem.codingpasses; 40125 } 40126 40127 var encodedData = new Uint8Array(totalLength); 40128 var position = 0; 40129 40130 for (j = 0, jj = data.length; j < jj; j++) { 40131 dataItem = data[j]; 40132 var chunk = dataItem.data.subarray(dataItem.start, dataItem.end); 40133 encodedData.set(chunk, position); 40134 position += chunk.length; 40135 } 40136 40137 var decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength); 40138 bitModel.setDecoder(decoder); 40139 40140 for (j = 0; j < codingpasses; j++) { 40141 switch (currentCodingpassType) { 40142 case 0: 40143 bitModel.runSignificancePropagationPass(); 40144 break; 40145 40146 case 1: 40147 bitModel.runMagnitudeRefinementPass(); 40148 break; 40149 40150 case 2: 40151 bitModel.runCleanupPass(); 40152 40153 if (segmentationSymbolUsed) { 40154 bitModel.checkSegmentationSymbol(); 40155 } 40156 40157 break; 40158 } 40159 40160 currentCodingpassType = (currentCodingpassType + 1) % 3; 40161 } 40162 40163 var offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width; 40164 var sign = bitModel.coefficentsSign; 40165 var magnitude = bitModel.coefficentsMagnitude; 40166 var bitsDecoded = bitModel.bitsDecoded; 40167 var magnitudeCorrection = reversible ? 0 : 0.5; 40168 var k, n, nb; 40169 position = 0; 40170 var interleave = subband.type !== "LL"; 40171 40172 for (j = 0; j < blockHeight; j++) { 40173 var row = offset / width | 0; 40174 var levelOffset = 2 * row * (levelWidth - width) + right + bottom; 40175 40176 for (k = 0; k < blockWidth; k++) { 40177 n = magnitude[position]; 40178 40179 if (n !== 0) { 40180 n = (n + magnitudeCorrection) * delta; 40181 40182 if (sign[position] !== 0) { 40183 n = -n; 40184 } 40185 40186 nb = bitsDecoded[position]; 40187 var pos = interleave ? levelOffset + (offset << 1) : offset; 40188 40189 if (reversible && nb >= mb) { 40190 coefficients[pos] = n; 40191 } else { 40192 coefficients[pos] = n * (1 << mb - nb); 40193 } 40194 } 40195 40196 offset++; 40197 position++; 40198 } 40199 40200 offset += width - blockWidth; 40201 } 40202 } 40203 } 40204 40205 function transformTile(context, tile, c) { 40206 var component = tile.components[c]; 40207 var codingStyleParameters = component.codingStyleParameters; 40208 var quantizationParameters = component.quantizationParameters; 40209 var decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount; 40210 var spqcds = quantizationParameters.SPqcds; 40211 var scalarExpounded = quantizationParameters.scalarExpounded; 40212 var guardBits = quantizationParameters.guardBits;
40213 var segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed; 40214 var precision = context.components[c].precision; 40215 var reversible = codingStyleParameters.reversibleTransformation; 40216 var transform = reversible ? new ReversibleTransform() : new IrreversibleTransform(); 40217 var subbandCoefficients = []; 40218 var b = 0; 40219 40220 for (var i = 0; i <= decompositionLevelsCount; i++) { 40221 var resolution = component.resolutions[i]; 40222 var width = resolution.trx1 - resolution.trx0; 40223 var height = resolution.try1 - resolution.try0; 40224 var coefficients = new Float32Array(width * height); 40225 40226 for (var j = 0, jj = resolution.subbands.length; j < jj; j++) { 40227 var mu, epsilon; 40228 40229 if (!scalarExpounded) { 40230 mu = spqcds[0].mu; 40231 epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0); 40232 } else { 40233 mu = spqcds[b].mu; 40234 epsilon = spqcds[b].epsilon; 40235 b++; 40236 } 40237 40238 var subband = resolution.subbands[j]; 40239 var gainLog2 = SubbandsGainLog2[subband.type]; 40240 var delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048); 40241 var mb = guardBits + epsilon - 1; 40242 copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed); 40243 } 40244 40245 subbandCoefficients.push({ 40246 width, 40247 height, 40248 items: coefficients 40249 }); 40250 } 40251 40252 var result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0); 40253 return { 40254 left: component.tcx0, 40255 top: component.tcy0, 40256 width: result.width, 40257 height: result.height, 40258 items: result.items 40259 }; 40260 } 40261 40262 function transformComponents(context) { 40263 var siz = context.SIZ; 40264 var components = context.components; 40265 var componentsCount = siz.Csiz; 40266 var resultImages = []; 40267 40268 for (var i = 0, ii = context.tiles.length; i < ii; i++) { 40269 var tile = context.tiles[i]; 40270 var transformedTiles = []; 40271 var c; 40272 40273 for (c = 0; c < componentsCount; c++) { 40274 transformedTiles[c] = transformTile(context, tile, c); 40275 } 40276 40277 var tile0 = transformedTiles[0]; 40278 var out = new Uint8ClampedArray(tile0.items.length * componentsCount); 40279 var result = { 40280 left: tile0.left, 40281 top: tile0.top, 40282 width: tile0.width, 40283 height: tile0.height, 40284 items: out 40285 }; 40286 var shift, offset; 40287 var pos = 0, 40288 j, 40289 jj, 40290 y0, 40291 y1, 40292 y2; 40293 40294 if (tile.codingStyleDefaultParameters.multipleComponentTransform) { 40295 var fourComponents = componentsCount === 4; 40296 var y0items = transformedTiles[0].items; 40297 var y1items = transformedTiles[1].items; 40298 var y2items = transformedTiles[2].items; 40299 var y3items = fourComponents ? transformedTiles[3].items : null; 40300 shift = components[0].precision - 8; 40301 offset = (128 << shift) + 0.5; 40302 var component0 = tile.components[0]; 40303 var alpha01 = componentsCount - 3; 40304 jj = y0items.length; 40305 40306 if (!component0.codingStyleParameters.reversibleTransformation) { 40307 for (j = 0; j < jj; j++, pos += alpha01) { 40308 y0 = y0items[j] + offset; 40309 y1 = y1items[j]; 40310 y2 = y2items[j]; 40311 out[pos++] = y0 + 1.402 * y2 >> shift; 40312 out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift; 40313 out[pos++] = y0 + 1.772 * y1 >> shift; 40314 } 40315 } else { 40316 for (j = 0; j < jj; j++, pos += alpha01) { 40317 y0 = y0items[j] + offset; 40318 y1 = y1items[j]; 40319 y2 = y2items[j]; 40320 const g = y0 - (y2 + y1 >> 2); 40321 out[pos++] = g + y2 >> shift; 40322 out[pos++] = g >> shift; 40323 out[pos++] = g + y1 >> shift; 40324 } 40325 } 40326 40327 if (fourComponents) { 40328 for (j = 0, pos = 3; j < jj; j++, pos += 4) { 40329 out[pos] = y3items[j] + offset >> shift; 40330 } 40331 } 40332 } else { 40333 for (c = 0; c < componentsCount; c++) { 40334 var items = transformedTiles[c].items; 40335 shift = components[c].precision - 8; 40336 offset = (128 << shift) + 0.5; 40337 40338 for (pos = c, j = 0, jj = items.length; j < jj; j++) { 40339 out[pos] = items[j] + offset >> shift; 40340 pos += componentsCount; 40341 } 40342 } 40343 } 40344 40345 resultImages.push(result); 40346 } 40347 40348 return resultImages; 40349 } 40350 40351 function initializeTile(context, tileIndex) { 40352 var siz = context.SIZ; 40353 var componentsCount = siz.Csiz; 40354 var tile = context.tiles[tileIndex]; 40355 40356 for (var c = 0; c < componentsCount; c++) { 40357 var component = tile.components[c]; 40358 var qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD; 40359 component.quantizationParameters = qcdOrQcc; 40360 var codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD; 40361 component.codingStyleParameters = codOrCoc; 40362 } 40363 40364 tile.codingStyleDefaultParameters = context.currentTile.COD; 40365 } 40366 40367 var TagTree = function TagTreeClosure() { 40368 function TagTree(width, height) { 40369 var levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1; 40370 this.levels = []; 40371 40372 for (var i = 0; i < levelsLength; i++) { 40373 var level = { 40374 width, 40375 height, 40376 items: [] 40377 }; 40378 this.levels.push(level); 40379 width = Math.ceil(width / 2);
40380 height = Math.ceil(height / 2); 40381 } 40382 } 40383 40384 TagTree.prototype = { 40385 reset: function TagTree_reset(i, j) { 40386 var currentLevel = 0, 40387 value = 0, 40388 level; 40389 40390 while (currentLevel < this.levels.length) { 40391 level = this.levels[currentLevel]; 40392 var index = i + j * level.width; 40393 40394 if (level.items[index] !== undefined) { 40395 value = level.items[index]; 40396 break; 40397 } 40398 40399 level.index = index; 40400 i >>= 1; 40401 j >>= 1; 40402 currentLevel++; 40403 } 40404 40405 currentLevel--; 40406 level = this.levels[currentLevel]; 40407 level.items[level.index] = value; 40408 this.currentLevel = currentLevel; 40409 delete this.value; 40410 }, 40411 incrementValue: function TagTree_incrementValue() { 40412 var level = this.levels[this.currentLevel]; 40413 level.items[level.index]++; 40414 }, 40415 nextLevel: function TagTree_nextLevel() { 40416 var currentLevel = this.currentLevel; 40417 var level = this.levels[currentLevel]; 40418 var value = level.items[level.index]; 40419 currentLevel--; 40420 40421 if (currentLevel < 0) { 40422 this.value = value; 40423 return false; 40424 } 40425 40426 this.currentLevel = currentLevel; 40427 level = this.levels[currentLevel]; 40428 level.items[level.index] = value; 40429 return true; 40430 } 40431 }; 40432 return TagTree; 40433 }(); 40434 40435 var InclusionTree = function InclusionTreeClosure() { 40436 function InclusionTree(width, height, defaultValue) { 40437 var levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1; 40438 this.levels = []; 40439 40440 for (var i = 0; i < levelsLength; i++) { 40441 var items = new Uint8Array(width * height); 40442 40443 for (var j = 0, jj = items.length; j < jj; j++) { 40444 items[j] = defaultValue; 40445 } 40446 40447 var level = { 40448 width, 40449 height, 40450 items 40451 }; 40452 this.levels.push(level); 40453 width = Math.ceil(width / 2); 40454 height = Math.ceil(height / 2); 40455 } 40456 } 40457 40458 InclusionTree.prototype = { 40459 reset: function InclusionTree_reset(i, j, stopValue) { 40460 var currentLevel = 0; 40461 40462 while (currentLevel < this.levels.length) { 40463 var level = this.levels[currentLevel]; 40464 var index = i + j * level.width; 40465 level.index = index; 40466 var value = level.items[index]; 40467 40468 if (value === 0xff) { 40469 break; 40470 } 40471 40472 if (value > stopValue) { 40473 this.currentLevel = currentLevel; 40474 this.propagateValues(); 40475 return false; 40476 } 40477 40478 i >>= 1; 40479 j >>= 1; 40480 currentLevel++; 40481 } 40482 40483 this.currentLevel = currentLevel - 1; 40484 return true; 40485 }, 40486 incrementValue: function InclusionTree_incrementValue(stopValue) { 40487 var level = this.levels[this.currentLevel]; 40488 level.items[level.index] = stopValue + 1; 40489 this.propagateValues(); 40490 }, 40491 propagateValues: function InclusionTree_propagateValues() { 40492 var levelIndex = this.currentLevel; 40493 var level = this.levels[levelIndex]; 40494 var currentValue = level.items[level.index]; 40495 40496 while (--levelIndex >= 0) { 40497 level = this.levels[levelIndex]; 40498 level.items[level.index] = currentValue; 40499 } 40500 }, 40501 nextLevel: function InclusionTree_nextLevel() { 40502 var currentLevel = this.currentLevel; 40503 var level = this.levels[currentLevel]; 40504 var value = level.items[level.index]; 40505 level.items[level.index] = 0xff; 40506 currentLevel--; 40507 40508 if (currentLevel < 0) { 40509 return false; 40510 } 40511 40512 this.currentLevel = currentLevel; 40513 level = this.levels[currentLevel]; 40514 level.items[level.index] = value; 40515 return true; 40516 } 40517 }; 40518 return InclusionTree; 40519 }(); 40520 40521 var BitModel = function BitModelClosure() { 40522 var UNIFORM_CONTEXT = 17; 40523 var RUNLENGTH_CONTEXT = 18; 40524 var LLAndLHContextsLabel = new Uint8Array([0, 5, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 1, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8]); 40525 var HLContextLabel = new Uint8Array([0, 3, 4, 0, 5, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 1, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8]); 40526 var HHContextLabel = new Uint8Array([0, 1, 2, 0, 1, 2, 2, 0, 2, 2, 2, 0, 0, 0, 0, 0, 3, 4, 5, 0, 4, 5, 5, 0, 5, 5, 5, 0, 0, 0, 0, 0, 6, 7, 7, 0, 7, 7, 7, 0, 7, 7, 7, 0, 0, 0, 0, 0, 8, 8, 8, 0, 8, 8, 8, 0, 8, 8, 8, 0, 0, 0, 0, 0, 8, 8, 8, 0, 8, 8, 8, 0, 8, 8, 8]); 40527 40528 function BitModel(width, height, subband, zeroBitPlanes, mb) { 40529 this.width = width; 40530 this.height = height; 40531 let contextLabelTable; 40532 40533 if (subband === "HH") { 40534 contextLabelTable = HHContextLabel; 40535 } else if (subband === "HL") { 40536 contextLabelTable = HLContextLabel; 40537 } else { 40538 contextLabelTable = LLAndLHContextsLabel; 40539 } 40540 40541 this.contextLabelTable = contextLabelTable; 40542 var coefficientCount = width * height; 40543 this.neighborsSignificance = new Uint8Array(coefficientCount); 40544 this.coefficentsSign = new Uint8Array(coefficientCount); 40545 let coefficentsMagnitude; 40546 40547 if (mb > 14) { 40548 coefficentsMagnitude = new Uint32Array(coefficientCount); 40549 } else if (mb > 6) { 40550 coefficentsMagnitude = new Uint16Array(coefficientCount); 40551 } else { 40552 coefficentsMagnitude = new Uint8Array(coefficientCount); 40553 } 40554 40555 this.coefficentsMagnitude = coefficentsMagnitude; 40556 this.processingFlags = new Uint8Array(coefficientCount); 40557 var bitsDecoded = new Uint8Array(coefficientCount); 40558 40559 if (zeroBitPlanes !== 0) { 40560 for (var i = 0; i < coefficientCount; i++) { 40561 bitsDecoded[i] = zeroBitPlanes; 40562 } 40563 } 40564 40565 this.bitsDecoded = bitsDecoded; 40566 this.reset(); 40567 } 40568 40569 BitModel.prototype = { 40570 setDecoder: function BitModel_setDecoder(decoder) { 40571 this.decoder = decoder; 40572 }, 40573 reset: function BitModel_reset() { 40574 this.contexts = new Int8Array(19); 40575 this.contexts[0] = 4 << 1 | 0; 40576 this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0; 40577 this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0; 40578 }, 40579 setNeighborsSignificance: function BitModel_setNeighborsSignificance(row, column, index) { 40580 var neighborsSignificance = this.neighborsSignificance; 40581 var width = this.width, 40582 height = this.height; 40583 var left = column > 0; 40584 var right = column + 1 < width; 40585 var i; 40586 40587 if (row > 0) { 40588 i = index - width; 40589 40590 if (left) { 40591 neighborsSignificance[i - 1] += 0x10; 40592 } 40593 40594 if (right) { 40595 neighborsSignificance[i + 1] += 0x10; 40596 } 40597
vendor: 15,240 bytes, lines 40598-41078
40598 neighborsSignificance[i] += 0x04; 40599 } 40600 40601 if (row + 1 < height) { 40602 i = index + width; 40603 40604 if (left) { 40605 neighborsSignificance[i - 1] += 0x10; 40606 } 40607 40608 if (right) { 40609 neighborsSignificance[i + 1] += 0x10; 40610 } 40611 40612 neighborsSignificance[i] += 0x04; 40613 } 40614 40615 if (left) { 40616 neighborsSignificance[index - 1] += 0x01; 40617 } 40618 40619 if (right) { 40620 neighborsSignificance[index + 1] += 0x01; 40621 } 40622 40623 neighborsSignificance[index] |= 0x80; 40624 }, 40625 runSignificancePropagationPass: function BitModel_runSignificancePropagationPass() { 40626 var decoder = this.decoder; 40627 var width = this.width, 40628 height = this.height; 40629 var coefficentsMagnitude = this.coefficentsMagnitude; 40630 var coefficentsSign = this.coefficentsSign; 40631 var neighborsSignificance = this.neighborsSignificance; 40632 var processingFlags = this.processingFlags; 40633 var contexts = this.contexts; 40634 var labels = this.contextLabelTable; 40635 var bitsDecoded = this.bitsDecoded; 40636 var processedInverseMask = ~1; 40637 var processedMask = 1; 40638 var firstMagnitudeBitMask = 2; 40639 40640 for (var i0 = 0; i0 < height; i0 += 4) { 40641 for (var j = 0; j < width; j++) { 40642 var index = i0 * width + j; 40643 40644 for (var i1 = 0; i1 < 4; i1++, index += width) { 40645 var i = i0 + i1; 40646 40647 if (i >= height) { 40648 break; 40649 } 40650 40651 processingFlags[index] &= processedInverseMask; 40652 40653 if (coefficentsMagnitude[index] || !neighborsSignificance[index]) { 40654 continue; 40655 } 40656 40657 var contextLabel = labels[neighborsSignificance[index]]; 40658 var decision = decoder.readBit(contexts, contextLabel); 40659 40660 if (decision) { 40661 var sign = this.decodeSignBit(i, j, index); 40662 coefficentsSign[index] = sign; 40663 coefficentsMagnitude[index] = 1; 40664 this.setNeighborsSignificance(i, j, index); 40665 processingFlags[index] |= firstMagnitudeBitMask; 40666 } 40667 40668 bitsDecoded[index]++; 40669 processingFlags[index] |= processedMask; 40670 } 40671 } 40672 } 40673 }, 40674 decodeSignBit: function BitModel_decodeSignBit(row, column, index) { 40675 var width = this.width, 40676 height = this.height; 40677 var coefficentsMagnitude = this.coefficentsMagnitude; 40678 var coefficentsSign = this.coefficentsSign; 40679 var contribution, sign0, sign1, significance1; 40680 var contextLabel, decoded; 40681 significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0; 40682 40683 if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) { 40684 sign1 = coefficentsSign[index + 1]; 40685 40686 if (significance1) { 40687 sign0 = coefficentsSign[index - 1]; 40688 contribution = 1 - sign1 - sign0; 40689 } else { 40690 contribution = 1 - sign1 - sign1; 40691 } 40692 } else if (significance1) { 40693 sign0 = coefficentsSign[index - 1]; 40694 contribution = 1 - sign0 - sign0; 40695 } else { 40696 contribution = 0; 40697 } 40698 40699 var horizontalContribution = 3 * contribution; 40700 significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0; 40701 40702 if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) { 40703 sign1 = coefficentsSign[index + width]; 40704 40705 if (significance1) { 40706 sign0 = coefficentsSign[index - width]; 40707 contribution = 1 - sign1 - sign0 + horizontalContribution; 40708 } else { 40709 contribution = 1 - sign1 - sign1 + horizontalContribution; 40710 } 40711 } else if (significance1) { 40712 sign0 = coefficentsSign[index - width]; 40713 contribution = 1 - sign0 - sign0 + horizontalContribution; 40714 } else { 40715 contribution = horizontalContribution; 40716 } 40717 40718 if (contribution >= 0) { 40719 contextLabel = 9 + contribution; 40720 decoded = this.decoder.readBit(this.contexts, contextLabel); 40721 } else { 40722 contextLabel = 9 - contribution; 40723 decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1; 40724 } 40725 40726 return decoded; 40727 }, 40728 runMagnitudeRefinementPass: function BitModel_runMagnitudeRefinementPass() { 40729 var decoder = this.decoder; 40730 var width = this.width, 40731 height = this.height; 40732 var coefficentsMagnitude = this.coefficentsMagnitude; 40733 var neighborsSignificance = this.neighborsSignificance; 40734 var contexts = this.contexts; 40735 var bitsDecoded = this.bitsDecoded; 40736 var processingFlags = this.processingFlags; 40737 var processedMask = 1; 40738 var firstMagnitudeBitMask = 2; 40739 var length = width * height; 40740 var width4 = width * 4; 40741 40742 for (var index0 = 0, indexNext; index0 < length; index0 = indexNext) { 40743 indexNext = Math.min(length, index0 + width4); 40744 40745 for (var j = 0; j < width; j++) { 40746 for (var index = index0 + j; index < indexNext; index += width) { 40747 if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) { 40748 continue; 40749 } 40750 40751 var contextLabel = 16; 40752 40753 if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) { 40754 processingFlags[index] ^= firstMagnitudeBitMask; 40755 var significance = neighborsSignificance[index] & 127; 40756 contextLabel = significance === 0 ? 15 : 14; 40757 } 40758 40759 var bit = decoder.readBit(contexts, contextLabel); 40760 coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit; 40761 bitsDecoded[index]++; 40762 processingFlags[index] |= processedMask; 40763 } 40764 } 40765 } 40766 }, 40767 runCleanupPass: function BitModel_runCleanupPass() { 40768 var decoder = this.decoder; 40769 var width = this.width, 40770 height = this.height; 40771 var neighborsSignificance = this.neighborsSignificance; 40772 var coefficentsMagnitude = this.coefficentsMagnitude; 40773 var coefficentsSign = this.coefficentsSign; 40774 var contexts = this.contexts; 40775 var labels = this.contextLabelTable; 40776 var bitsDecoded = this.bitsDecoded; 40777 var processingFlags = this.processingFlags; 40778 var processedMask = 1; 40779 var firstMagnitudeBitMask = 2; 40780 var oneRowDown = width; 40781 var twoRowsDown = width * 2; 40782 var threeRowsDown = width * 3; 40783 var iNext; 40784 40785 for (var i0 = 0; i0 < height; i0 = iNext) { 40786 iNext = Math.min(i0 + 4, height); 40787 var indexBase = i0 * width; 40788 var checkAllEmpty = i0 + 3 < height; 40789 40790 for (var j = 0; j < width; j++) { 40791 var index0 = indexBase + j; 40792 var allEmpty = checkAllEmpty && processingFlags[index0] === 0 && processingFlags[index0 + oneRowDown] === 0 && processingFlags[index0 + twoRowsDown] === 0 && processingFlags[index0 + threeRowsDown] === 0 && neighborsSignificance[index0] === 0 && neighborsSignificance[index0 + oneRowDown] === 0 && neighborsSignificance[index0 + twoRowsDown] === 0 && neighborsSignificance[index0 + threeRowsDown] === 0; 40793 var i1 = 0, 40794 index = index0; 40795 var i = i0, 40796 sign; 40797 40798 if (allEmpty) { 40799 var hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT); 40800 40801 if (!hasSignificantCoefficent) { 40802 bitsDecoded[index0]++; 40803 bitsDecoded[index0 + oneRowDown]++; 40804 bitsDecoded[index0 + twoRowsDown]++; 40805 bitsDecoded[index0 + threeRowsDown]++; 40806 continue; 40807 } 40808 40809 i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT); 40810 40811 if (i1 !== 0) { 40812 i = i0 + i1; 40813 index += i1 * width; 40814 } 40815 40816 sign = this.decodeSignBit(i, j, index); 40817 coefficentsSign[index] = sign; 40818 coefficentsMagnitude[index] = 1; 40819 this.setNeighborsSignificance(i, j, index); 40820 processingFlags[index] |= firstMagnitudeBitMask; 40821 index = index0; 40822 40823 for (var i2 = i0; i2 <= i; i2++, index += width) { 40824 bitsDecoded[index]++; 40825 } 40826 40827 i1++; 40828 } 40829 40830 for (i = i0 + i1; i < iNext; i++, index += width) { 40831 if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) { 40832 continue; 40833 } 40834 40835 var contextLabel = labels[neighborsSignificance[index]]; 40836 var decision = decoder.readBit(contexts, contextLabel); 40837 40838 if (decision === 1) { 40839 sign = this.decodeSignBit(i, j, index); 40840 coefficentsSign[index] = sign; 40841 coefficentsMagnitude[index] = 1; 40842 this.setNeighborsSignificance(i, j, index); 40843 processingFlags[index] |= firstMagnitudeBitMask; 40844 } 40845 40846 bitsDecoded[index]++; 40847 } 40848 } 40849 } 40850 }, 40851 checkSegmentationSymbol: function BitModel_checkSegmentationSymbol() { 40852 var decoder = this.decoder; 40853 var contexts = this.contexts; 40854 var symbol = decoder.readBit(contexts, UNIFORM_CONTEXT) << 3 | decoder.readBit(contexts, UNIFORM_CONTEXT) << 2 | decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT); 40855 40856 if (symbol !== 0xa) { 40857 throw new JpxError("Invalid segmentation symbol"); 40858 } 40859 } 40860 }; 40861 return BitModel; 40862 }(); 40863 40864 var Transform = function TransformClosure() { 40865 function Transform() {} 40866 40867 Transform.prototype.calculate = function transformCalculate(subbands, u0, v0) { 40868 var ll = subbands[0]; 40869 40870 for (var i = 1, ii = subbands.length; i < ii; i++) { 40871 ll = this.iterate(ll, subbands[i], u0, v0); 40872 } 40873 40874 return ll; 40875 }; 40876 40877 Transform.prototype.extend = function extend(buffer, offset, size) { 40878 var i1 = offset - 1, 40879 j1 = offset + 1; 40880 var i2 = offset + size - 2, 40881 j2 = offset + size; 40882 buffer[i1--] = buffer[j1++]; 40883 buffer[j2++] = buffer[i2--]; 40884 buffer[i1--] = buffer[j1++]; 40885 buffer[j2++] = buffer[i2--]; 40886 buffer[i1--] = buffer[j1++]; 40887 buffer[j2++] = buffer[i2--]; 40888 buffer[i1] = buffer[j1]; 40889 buffer[j2] = buffer[i2]; 40890 }; 40891 40892 Transform.prototype.iterate = function Transform_iterate(ll, hl_lh_hh, u0, v0) { 40893 var llWidth = ll.width, 40894 llHeight = ll.height, 40895 llItems = ll.items; 40896 var width = hl_lh_hh.width; 40897 var height = hl_lh_hh.height; 40898 var items = hl_lh_hh.items; 40899 var i, j, k, l, u, v; 40900 40901 for (k = 0, i = 0; i < llHeight; i++) { 40902 l = i * 2 * width; 40903 40904 for (j = 0; j < llWidth; j++, k++, l += 2) { 40905 items[l] = llItems[k]; 40906 } 40907 } 40908 40909 llItems = ll.items = null; 40910 var bufferPadding = 4; 40911 var rowBuffer = new Float32Array(width + 2 * bufferPadding); 40912 40913 if (width === 1) { 40914 if ((u0 & 1) !== 0) { 40915 for (v = 0, k = 0; v < height; v++, k += width) { 40916 items[k] *= 0.5; 40917 } 40918 } 40919 } else { 40920 for (v = 0, k = 0; v < height; v++, k += width) { 40921 rowBuffer.set(items.subarray(k, k + width), bufferPadding); 40922 this.extend(rowBuffer, bufferPadding, width); 40923 this.filter(rowBuffer, bufferPadding, width); 40924 items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k); 40925 } 40926 } 40927 40928 var numBuffers = 16; 40929 var colBuffers = []; 40930 40931 for (i = 0; i < numBuffers; i++) { 40932 colBuffers.push(new Float32Array(height + 2 * bufferPadding)); 40933 } 40934 40935 var b, 40936 currentBuffer = 0; 40937 ll = bufferPadding + height; 40938 40939 if (height === 1) { 40940 if ((v0 & 1) !== 0) { 40941 for (u = 0; u < width; u++) { 40942 items[u] *= 0.5; 40943 } 40944 } 40945 } else { 40946 for (u = 0; u < width; u++) { 40947 if (currentBuffer === 0) { 40948 numBuffers = Math.min(width - u, numBuffers); 40949 40950 for (k = u, l = bufferPadding; l < ll; k += width, l++) { 40951 for (b = 0; b < numBuffers; b++) { 40952 colBuffers[b][l] = items[k + b]; 40953 } 40954 } 40955 40956 currentBuffer = numBuffers; 40957 } 40958 40959 currentBuffer--; 40960 var buffer = colBuffers[currentBuffer]; 40961 this.extend(buffer, bufferPadding, height); 40962 this.filter(buffer, bufferPadding, height); 40963 40964 if (currentBuffer === 0) { 40965 k = u - numBuffers + 1; 40966 40967 for (l = bufferPadding; l < ll; k += width, l++) { 40968 for (b = 0; b < numBuffers; b++) { 40969 items[k + b] = colBuffers[b][l]; 40970 } 40971 } 40972 } 40973 } 40974 } 40975 40976 return { 40977 width, 40978 height, 40979 items 40980 }; 40981 }; 40982 40983 return Transform; 40984 }(); 40985 40986 var IrreversibleTransform = function IrreversibleTransformClosure() { 40987 function IrreversibleTransform() { 40988 Transform.call(this); 40989 } 40990 40991 IrreversibleTransform.prototype = Object.create(Transform.prototype); 40992 40993 IrreversibleTransform.prototype.filter = function irreversibleTransformFilter(x, offset, length) { 40994 var len = length >> 1; 40995 offset = offset | 0; 40996 var j, n, current, next; 40997 var alpha = -1.586134342059924; 40998 var beta = -0.052980118572961; 40999 var gamma = 0.882911075530934; 41000 var delta = 0.443506852043971; 41001 var K = 1.230174104914001; 41002 var K_ = 1 / K; 41003 j = offset - 3; 41004 41005 for (n = len + 4; n--; j += 2) { 41006 x[j] *= K_; 41007 } 41008 41009 j = offset - 2; 41010 current = delta * x[j - 1]; 41011 41012 for (n = len + 3; n--; j += 2) { 41013 next = delta * x[j + 1]; 41014 x[j] = K * x[j] - current - next; 41015 41016 if (n--) { 41017 j += 2; 41018 current = delta * x[j + 1]; 41019 x[j] = K * x[j] - current - next; 41020 } else { 41021 break; 41022 } 41023 } 41024 41025 j = offset - 1; 41026 current = gamma * x[j - 1]; 41027 41028 for (n = len + 2; n--; j += 2) { 41029 next = gamma * x[j + 1]; 41030 x[j] -= current + next; 41031 41032 if (n--) { 41033 j += 2; 41034 current = gamma * x[j + 1]; 41035 x[j] -= current + next; 41036 } else { 41037 break; 41038 } 41039 } 41040 41041 j = offset; 41042 current = beta * x[j - 1]; 41043 41044 for (n = len + 1; n--; j += 2) { 41045 next = beta * x[j + 1]; 41046 x[j] -= current + next; 41047 41048 if (n--) { 41049 j += 2; 41050 current = beta * x[j + 1]; 41051 x[j] -= current + next; 41052 } else { 41053 break; 41054 } 41055 } 41056 41057 if (len !== 0) { 41058 j = offset + 1; 41059 current = alpha * x[j - 1]; 41060 41061 for (n = len; n--; j += 2) { 41062 next = alpha * x[j + 1]; 41063 x[j] -= current + next; 41064 41065 if (n--) { 41066 j += 2; 41067 current = alpha * x[j + 1]; 41068 x[j] -= current + next; 41069 } else { 41070 break; 41071 } 41072 } 41073 } 41074 }; 41075 41076 return IrreversibleTransform; 41077 }(); 41078
41079 var ReversibleTransform = function ReversibleTransformClosure() { 41080 function ReversibleTransform() { 41081 Transform.call(this); 41082 } 41083 41084 ReversibleTransform.prototype = Object.create(Transform.prototype); 41085 41086 ReversibleTransform.prototype.filter = function reversibleTransformFilter(x, offset, length) { 41087 var len = length >> 1; 41088 offset = offset | 0; 41089 var j, n; 41090 41091 for (j = offset, n = len + 1; n--; j += 2) { 41092 x[j] -= x[j - 1] + x[j + 1] + 2 >> 2; 41093 } 41094 41095 for (j = offset + 1, n = len; n--; j += 2) { 41096 x[j] += x[j - 1] + x[j + 1] >> 1; 41097 } 41098 }; 41099 41100 return ReversibleTransform; 41101 }(); 41102 41103 return JpxImage; 41104}(); 41105 41106exports.JpxImage = JpxImage; 41107 41108/***/ }), 41109/* 21 */ 41110/***/ (function(module, exports, __w_pdfjs_require__) { 41111 41112"use strict"; 41113 41114 41115Object.defineProperty(exports, "__esModule", { 41116 value: true 41117}); 41118exports.calculateSHA512 = exports.calculateSHA384 = exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0; 41119 41120var _util = __w_pdfjs_require__(2); 41121 41122var _primitives = __w_pdfjs_require__(4); 41123 41124var _stream = __w_pdfjs_require__(11); 41125 41126var ARCFourCipher = function ARCFourCipherClosure() { 41127 function ARCFourCipher(key) { 41128 this.a = 0; 41129 this.b = 0; 41130 var s = new Uint8Array(256); 41131 var i, 41132 j = 0, 41133 tmp, 41134 keyLength = key.length; 41135 41136 for (i = 0; i < 256; ++i) { 41137 s[i] = i; 41138 } 41139 41140 for (i = 0; i < 256; ++i) { 41141 tmp = s[i]; 41142 j = j + tmp + key[i % keyLength] & 0xff; 41143 s[i] = s[j]; 41144 s[j] = tmp; 41145 } 41146 41147 this.s = s; 41148 } 41149 41150 ARCFourCipher.prototype = { 41151 encryptBlock: function ARCFourCipher_encryptBlock(data) { 41152 var i, 41153 n = data.length, 41154 tmp, 41155 tmp2; 41156 var a = this.a, 41157 b = this.b, 41158 s = this.s; 41159 var output = new Uint8Array(n); 41160 41161 for (i = 0; i < n; ++i) { 41162 a = a + 1 & 0xff; 41163 tmp = s[a]; 41164 b = b + tmp & 0xff; 41165 tmp2 = s[b]; 41166 s[a] = tmp2; 41167 s[b] = tmp; 41168 output[i] = data[i] ^ s[tmp + tmp2 & 0xff]; 41169 } 41170 41171 this.a = a; 41172 this.b = b; 41173 return output; 41174 } 41175 }; 41176 ARCFourCipher.prototype.decryptBlock = ARCFourCipher.prototype.encryptBlock; 41177 return ARCFourCipher; 41178}(); 41179 41180exports.ARCFourCipher = ARCFourCipher; 41181 41182var calculateMD5 = function calculateMD5Closure() { 41183 var r = new Uint8Array([7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21]); 41184 var k = new Int32Array([-680876936, -389564586, 606105819, -1044525330, -176418897, 1200080426, -1473231341, -45705983, 1770035416, -1958414417, -42063, -1990404162, 1804603682, -40341101, -1502002290, 1236535329, -165796510, -1069501632, 643717713, -373897302, -701558691, 38016083, -660478335, -405537848, 568446438, -1019803690, -187363961, 1163531501, -1444681467, -51403784, 1735328473, -1926607734, -378558, -2022574463, 1839030562, -35309556, -1530992060, 1272893353, -155497632, -1094730640, 681279174, -358537222, -722521979, 76029189, -640364487, -421815835, 530742520, -995338651, -198630844, 1126891415, -1416354905, -57434055, 1700485571, -1894986606, -1051523, -2054922799, 1873313359, -30611744, -1560198380, 1309151649, -145523070, -1120210379, 718787259, -343485551]); 41185 41186 function hash(data, offset, length) { 41187 var h0 = 1732584193, 41188 h1 = -271733879, 41189 h2 = -1732584194, 41190 h3 = 271733878; 41191 var paddedLength = length + 72 & ~63; 41192 var padded = new Uint8Array(paddedLength); 41193 var i, j, n; 41194 41195 for (i = 0; i < length; ++i) { 41196 padded[i] = data[offset++]; 41197 } 41198 41199 padded[i++] = 0x80; 41200 n = paddedLength - 8; 41201 41202 while (i < n) { 41203 padded[i++] = 0; 41204 } 41205 41206 padded[i++] = length << 3 & 0xff; 41207 padded[i++] = length >> 5 & 0xff;
41208 padded[i++] = length >> 13 & 0xff; 41209 padded[i++] = length >> 21 & 0xff; 41210 padded[i++] = length >>> 29 & 0xff; 41211 padded[i++] = 0; 41212 padded[i++] = 0; 41213 padded[i++] = 0; 41214 var w = new Int32Array(16); 41215 41216 for (i = 0; i < paddedLength;) { 41217 for (j = 0; j < 16; ++j, i += 4) { 41218 w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24; 41219 } 41220 41221 var a = h0, 41222 b = h1, 41223 c = h2, 41224 d = h3, 41225 f, 41226 g; 41227 41228 for (j = 0; j < 64; ++j) { 41229 if (j < 16) { 41230 f = b & c | ~b & d; 41231 g = j; 41232 } else if (j < 32) { 41233 f = d & b | ~d & c; 41234 g = 5 * j + 1 & 15; 41235 } else if (j < 48) { 41236 f = b ^ c ^ d; 41237 g = 3 * j + 5 & 15; 41238 } else { 41239 f = c ^ (b | ~d); 41240 g = 7 * j & 15; 41241 } 41242 41243 var tmp = d, 41244 rotateArg = a + f + k[j] + w[g] | 0, 41245 rotate = r[j]; 41246 d = c; 41247 c = b; 41248 b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0; 41249 a = tmp; 41250 } 41251 41252 h0 = h0 + a | 0; 41253 h1 = h1 + b | 0; 41254 h2 = h2 + c | 0; 41255 h3 = h3 + d | 0; 41256 } 41257 41258 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]); 41259 } 41260 41261 return hash; 41262}(); 41263 41264exports.calculateMD5 = calculateMD5; 41265 41266var Word64 = function Word64Closure() { 41267 function Word64(highInteger, lowInteger) { 41268 this.high = highInteger | 0; 41269 this.low = lowInteger | 0; 41270 } 41271 41272 Word64.prototype = { 41273 and: function Word64_and(word) { 41274 this.high &= word.high; 41275 this.low &= word.low; 41276 }, 41277 xor: function Word64_xor(word) { 41278 this.high ^= word.high; 41279 this.low ^= word.low; 41280 }, 41281 or: function Word64_or(word) { 41282 this.high |= word.high; 41283 this.low |= word.low; 41284 }, 41285 shiftRight: function Word64_shiftRight(places) { 41286 if (places >= 32) { 41287 this.low = this.high >>> places - 32 | 0; 41288 this.high = 0; 41289 } else { 41290 this.low = this.low >>> places | this.high << 32 - places; 41291 this.high = this.high >>> places | 0; 41292 } 41293 }, 41294 shiftLeft: function Word64_shiftLeft(places) { 41295 if (places >= 32) { 41296 this.high = this.low << places - 32; 41297 this.low = 0; 41298 } else { 41299 this.high = this.high << places | this.low >>> 32 - places; 41300 this.low = this.low << places; 41301 } 41302 }, 41303 rotateRight: function Word64_rotateRight(places) { 41304 var low, high; 41305 41306 if (places & 32) { 41307 high = this.low; 41308 low = this.high; 41309 } else { 41310 low = this.low; 41311 high = this.high; 41312 } 41313 41314 places &= 31; 41315 this.low = low >>> places | high << 32 - places; 41316 this.high = high >>> places | low << 32 - places; 41317 }, 41318 not: function Word64_not() { 41319 this.high = ~this.high; 41320 this.low = ~this.low; 41321 }, 41322 add: function Word64_add(word) { 41323 var lowAdd = (this.low >>> 0) + (word.low >>> 0); 41324 var highAdd = (this.high >>> 0) + (word.high >>> 0); 41325 41326 if (lowAdd > 0xffffffff) { 41327 highAdd += 1; 41328 } 41329 41330 this.low = lowAdd | 0; 41331 this.high = highAdd | 0; 41332 }, 41333 copyTo: function Word64_copyTo(bytes, offset) { 41334 bytes[offset] = this.high >>> 24 & 0xff; 41335 bytes[offset + 1] = this.high >> 16 & 0xff; 41336 bytes[offset + 2] = this.high >> 8 & 0xff; 41337 bytes[offset + 3] = this.high & 0xff; 41338 bytes[offset + 4] = this.low >>> 24 & 0xff; 41339 bytes[offset + 5] = this.low >> 16 & 0xff; 41340 bytes[offset + 6] = this.low >> 8 & 0xff; 41341 bytes[offset + 7] = this.low & 0xff; 41342 }, 41343 assign: function Word64_assign(word) { 41344 this.high = word.high; 41345 this.low = word.low; 41346 } 41347 }; 41348 return Word64; 41349}(); 41350 41351var calculateSHA256 = function calculateSHA256Closure() { 41352 function rotr(x, n) { 41353 return x >>> n | x << 32 - n; 41354 } 41355 41356 function ch(x, y, z) { 41357 return x & y ^ ~x & z; 41358 } 41359 41360 function maj(x, y, z) { 41361 return x & y ^ x & z ^ y & z; 41362 } 41363 41364 function sigma(x) {
vendor: 1,846 bytes, lines 41365-41412
41365 return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22); 41366 } 41367 41368 function sigmaPrime(x) { 41369 return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25); 41370 } 41371 41372 function littleSigma(x) { 41373 return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3; 41374 } 41375 41376 function littleSigmaPrime(x) { 41377 return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10; 41378 } 41379 41380 var k = [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2]; 41381 41382 function hash(data, offset, length) { 41383 var h0 = 0x6a09e667, 41384 h1 = 0xbb67ae85, 41385 h2 = 0x3c6ef372, 41386 h3 = 0xa54ff53a, 41387 h4 = 0x510e527f, 41388 h5 = 0x9b05688c, 41389 h6 = 0x1f83d9ab, 41390 h7 = 0x5be0cd19; 41391 var paddedLength = Math.ceil((length + 9) / 64) * 64; 41392 var padded = new Uint8Array(paddedLength); 41393 var i, j, n; 41394 41395 for (i = 0; i < length; ++i) { 41396 padded[i] = data[offset++]; 41397 } 41398 41399 padded[i++] = 0x80; 41400 n = paddedLength - 8; 41401 41402 while (i < n) { 41403 padded[i++] = 0; 41404 } 41405 41406 padded[i++] = 0; 41407 padded[i++] = 0; 41408 padded[i++] = 0; 41409 padded[i++] = length >>> 29 & 0xff; 41410 padded[i++] = length >> 21 & 0xff; 41411 padded[i++] = length >> 13 & 0xff; 41412 padded[i++] = length >> 5 & 0xff;
vendor: 4,298 bytes, lines 41413-41533
41413 padded[i++] = length << 3 & 0xff; 41414 var w = new Uint32Array(64); 41415 41416 for (i = 0; i < paddedLength;) { 41417 for (j = 0; j < 16; ++j) { 41418 w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3]; 41419 i += 4; 41420 } 41421 41422 for (j = 16; j < 64; ++j) { 41423 w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0; 41424 } 41425 41426 var a = h0, 41427 b = h1, 41428 c = h2, 41429 d = h3, 41430 e = h4, 41431 f = h5, 41432 g = h6, 41433 h = h7, 41434 t1, 41435 t2; 41436 41437 for (j = 0; j < 64; ++j) { 41438 t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j]; 41439 t2 = sigma(a) + maj(a, b, c); 41440 h = g; 41441 g = f; 41442 f = e; 41443 e = d + t1 | 0; 41444 d = c; 41445 c = b; 41446 b = a; 41447 a = t1 + t2 | 0; 41448 } 41449 41450 h0 = h0 + a | 0; 41451 h1 = h1 + b | 0; 41452 h2 = h2 + c | 0; 41453 h3 = h3 + d | 0; 41454 h4 = h4 + e | 0; 41455 h5 = h5 + f | 0; 41456 h6 = h6 + g | 0; 41457 h7 = h7 + h | 0; 41458 } 41459 41460 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]); 41461 } 41462 41463 return hash; 41464}(); 41465 41466exports.calculateSHA256 = calculateSHA256; 41467 41468var calculateSHA512 = function calculateSHA512Closure() { 41469 function ch(result, x, y, z, tmp) { 41470 result.assign(x); 41471 result.and(y); 41472 tmp.assign(x); 41473 tmp.not(); 41474 tmp.and(z); 41475 result.xor(tmp); 41476 } 41477 41478 function maj(result, x, y, z, tmp) { 41479 result.assign(x); 41480 result.and(y); 41481 tmp.assign(x); 41482 tmp.and(z); 41483 result.xor(tmp); 41484 tmp.assign(y); 41485 tmp.and(z); 41486 result.xor(tmp); 41487 } 41488 41489 function sigma(result, x, tmp) { 41490 result.assign(x); 41491 result.rotateRight(28); 41492 tmp.assign(x); 41493 tmp.rotateRight(34); 41494 result.xor(tmp); 41495 tmp.assign(x); 41496 tmp.rotateRight(39); 41497 result.xor(tmp); 41498 } 41499 41500 function sigmaPrime(result, x, tmp) { 41501 result.assign(x); 41502 result.rotateRight(14); 41503 tmp.assign(x); 41504 tmp.rotateRight(18); 41505 result.xor(tmp); 41506 tmp.assign(x); 41507 tmp.rotateRight(41); 41508 result.xor(tmp); 41509 } 41510 41511 function littleSigma(result, x, tmp) { 41512 result.assign(x); 41513 result.rotateRight(1); 41514 tmp.assign(x); 41515 tmp.rotateRight(8); 41516 result.xor(tmp); 41517 tmp.assign(x); 41518 tmp.shiftRight(7); 41519 result.xor(tmp); 41520 } 41521 41522 function littleSigmaPrime(result, x, tmp) { 41523 result.assign(x); 41524 result.rotateRight(19); 41525 tmp.assign(x); 41526 tmp.rotateRight(61); 41527 result.xor(tmp); 41528 tmp.assign(x); 41529 tmp.shiftRight(6); 41530 result.xor(tmp); 41531 } 41532 41533 var k = [new Word64(0x428a2f98, 0xd728ae22), new Word64(0x71374491, 0x23ef65cd), new Word64(0xb5c0fbcf, 0xec4d3b2f), new Word64(0xe9b5dba5, 0x8189dbbc), new Word64(0x3956c25b, 0xf348b538), new Word64(0x59f111f1, 0xb605d019), new Word64(0x923f82a4, 0xaf194f9b), new Word64(0xab1c5ed5, 0xda6d8118), new Word64(0xd807aa98, 0xa3030242), new Word64(0x12835b01, 0x45706fbe), new Word64(0x243185be, 0x4ee4b28c), new Word64(0x550c7dc3, 0xd5ffb4e2), new Word64(0x72be5d74, 0xf27b896f), new Word64(0x80deb1fe, 0x3b1696b1), new Word64(0x9bdc06a7, 0x25c71235), new Word64(0xc19bf174, 0xcf692694), new Word64(0xe49b69c1, 0x9ef14ad2), new Word64(0xefbe4786, 0x384f25e3), new Word64(0x0fc19dc6, 0x8b8cd5b5), new Word64(0x240ca1cc, 0x77ac9c65), new Word64(0x2de92c6f, 0x592b0275), new Word64(0x4a7484aa, 0x6ea6e483), new Word64(0x5cb0a9dc, 0xbd41fbd4), new Word64(0x76f988da, 0x831153b5), new Word64(0x983e5152, 0xee66dfab), new Word64(0xa831c66d, 0x2db43210), new Word64(0xb00327c8, 0x98fb213f), new Word64(0xbf597fc7, 0xbeef0ee4), new Word64(0xc6e00bf3, 0x3da88fc2), new Word64(0xd5a79147, 0x930aa725), new Word64(0x06ca6351, 0xe003826f), new Word64(0x14292967, 0x0a0e6e70), new Word64(0x27b70a85, 0x46d22ffc), new Word64(0x2e1b2138, 0x5c26c926), new Word64(0x4d2c6dfc, 0x5ac42aed), new Word64(0x53380d13, 0x9d95b3df), new Word64(0x650a7354, 0x8baf63de), new Word64(0x766a0abb,
vendor: 3,125 bytes, lines 41533-41588
415330x3c77b2a8), 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)]; 41534 41535 function hash(data, offset, length, mode384) { 41536 mode384 = !!mode384; 41537 var h0, h1, h2, h3, h4, h5, h6, h7; 41538 41539 if (!mode384) { 41540 h0 = new Word64(0x6a09e667, 0xf3bcc908); 41541 h1 = new Word64(0xbb67ae85, 0x84caa73b); 41542 h2 = new Word64(0x3c6ef372, 0xfe94f82b); 41543 h3 = new Word64(0xa54ff53a, 0x5f1d36f1); 41544 h4 = new Word64(0x510e527f, 0xade682d1); 41545 h5 = new Word64(0x9b05688c, 0x2b3e6c1f); 41546 h6 = new Word64(0x1f83d9ab, 0xfb41bd6b); 41547 h7 = new Word64(0x5be0cd19, 0x137e2179); 41548 } else { 41549 h0 = new Word64(0xcbbb9d5d, 0xc1059ed8); 41550 h1 = new Word64(0x629a292a, 0x367cd507); 41551 h2 = new Word64(0x9159015a, 0x3070dd17); 41552 h3 = new Word64(0x152fecd8, 0xf70e5939); 41553 h4 = new Word64(0x67332667, 0xffc00b31); 41554 h5 = new Word64(0x8eb44a87, 0x68581511); 41555 h6 = new Word64(0xdb0c2e0d, 0x64f98fa7); 41556 h7 = new Word64(0x47b5481d, 0xbefa4fa4); 41557 } 41558 41559 var paddedLength = Math.ceil((length + 17) / 128) * 128; 41560 var padded = new Uint8Array(paddedLength); 41561 var i, j, n; 41562 41563 for (i = 0; i < length; ++i) { 41564 padded[i] = data[offset++]; 41565 } 41566 41567 padded[i++] = 0x80; 41568 n = paddedLength - 16; 41569 41570 while (i < n) { 41571 padded[i++] = 0; 41572 } 41573 41574 padded[i++] = 0; 41575 padded[i++] = 0; 41576 padded[i++] = 0; 41577 padded[i++] = 0; 41578 padded[i++] = 0; 41579 padded[i++] = 0; 41580 padded[i++] = 0; 41581 padded[i++] = 0; 41582 padded[i++] = 0; 41583 padded[i++] = 0; 41584 padded[i++] = 0; 41585 padded[i++] = length >>> 29 & 0xff; 41586 padded[i++] = length >> 21 & 0xff; 41587 padded[i++] = length >> 13 & 0xff; 41588 padded[i++] = length >> 5 & 0xff;
41589 padded[i++] = length << 3 & 0xff; 41590 var w = new Array(80); 41591 41592 for (i = 0; i < 80; i++) { 41593 w[i] = new Word64(0, 0); 41594 } 41595 41596 var a = new Word64(0, 0), 41597 b = new Word64(0, 0), 41598 c = new Word64(0, 0); 41599 var d = new Word64(0, 0), 41600 e = new Word64(0, 0), 41601 f = new Word64(0, 0); 41602 var g = new Word64(0, 0), 41603 h = new Word64(0, 0); 41604 var t1 = new Word64(0, 0), 41605 t2 = new Word64(0, 0); 41606 var tmp1 = new Word64(0, 0), 41607 tmp2 = new Word64(0, 0), 41608 tmp3; 41609 41610 for (i = 0; i < paddedLength;) { 41611 for (j = 0; j < 16; ++j) { 41612 w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3]; 41613 w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7]; 41614 i += 8; 41615 } 41616 41617 for (j = 16; j < 80; ++j) { 41618 tmp3 = w[j]; 41619 littleSigmaPrime(tmp3, w[j - 2], tmp2); 41620 tmp3.add(w[j - 7]); 41621 littleSigma(tmp1, w[j - 15], tmp2); 41622 tmp3.add(tmp1); 41623 tmp3.add(w[j - 16]); 41624 } 41625 41626 a.assign(h0); 41627 b.assign(h1); 41628 c.assign(h2); 41629 d.assign(h3); 41630 e.assign(h4); 41631 f.assign(h5); 41632 g.assign(h6); 41633 h.assign(h7); 41634 41635 for (j = 0; j < 80; ++j) { 41636 t1.assign(h); 41637 sigmaPrime(tmp1, e, tmp2); 41638 t1.add(tmp1); 41639 ch(tmp1, e, f, g, tmp2); 41640 t1.add(tmp1); 41641 t1.add(k[j]); 41642 t1.add(w[j]); 41643 sigma(t2, a, tmp2); 41644 maj(tmp1, a, b, c, tmp2); 41645 t2.add(tmp1); 41646 tmp3 = h; 41647 h = g; 41648 g = f; 41649 f = e; 41650 d.add(t1); 41651 e = d; 41652 d = c; 41653 c = b; 41654 b = a; 41655 tmp3.assign(t1); 41656 tmp3.add(t2); 41657 a = tmp3; 41658 } 41659 41660 h0.add(a); 41661 h1.add(b); 41662 h2.add(c); 41663 h3.add(d); 41664 h4.add(e); 41665 h5.add(f); 41666 h6.add(g); 41667 h7.add(h); 41668 } 41669 41670 var result; 41671 41672 if (!mode384) { 41673 result = new Uint8Array(64); 41674 h0.copyTo(result, 0); 41675 h1.copyTo(result, 8); 41676 h2.copyTo(result, 16); 41677 h3.copyTo(result, 24); 41678 h4.copyTo(result, 32); 41679 h5.copyTo(result, 40); 41680 h6.copyTo(result, 48); 41681 h7.copyTo(result, 56); 41682 } else { 41683 result = new Uint8Array(48); 41684 h0.copyTo(result, 0); 41685 h1.copyTo(result, 8); 41686 h2.copyTo(result, 16); 41687 h3.copyTo(result, 24); 41688 h4.copyTo(result, 32); 41689 h5.copyTo(result, 40); 41690 } 41691 41692 return result; 41693 } 41694 41695 return hash; 41696}(); 41697 41698exports.calculateSHA512 = calculateSHA512; 41699 41700var calculateSHA384 = function calculateSHA384Closure() { 41701 function hash(data, offset, length) { 41702 return calculateSHA512(data, offset, length, true); 41703 } 41704 41705 return hash; 41706}(); 41707 41708exports.calculateSHA384 = calculateSHA384; 41709 41710var NullCipher = function NullCipherClosure() { 41711 function NullCipher() {} 41712 41713 NullCipher.prototype = { 41714 decryptBlock: function NullCipher_decryptBlock(data) { 41715 return data; 41716 } 41717 }; 41718 return NullCipher; 41719}(); 41720 41721class AESBaseCipher { 41722 constructor() { 41723 if (this.constructor === AESBaseCipher) { 41724 (0, _util.unreachable)("Cannot initialize AESBaseCipher."); 41725 } 41726 41727 this._s = new Uint8Array([0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16]); 41728 this._inv_s = new Uint8Array([0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42,
417280xfa, 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]); 41729 this._mix = new Uint32Array([0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23
vendor: 10,568 bytes, lines 41729-42126
41729c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3]); 41730 this._mixCol = new Uint8Array(256); 41731 41732 for (let i = 0; i < 256; i++) { 41733 if (i < 128) { 41734 this._mixCol[i] = i << 1; 41735 } else { 41736 this._mixCol[i] = i << 1 ^ 0x1b; 41737 } 41738 } 41739 41740 this.buffer = new Uint8Array(16); 41741 this.bufferPosition = 0; 41742 } 41743 41744 _expandKey(cipherKey) { 41745 (0, _util.unreachable)("Cannot call `_expandKey` on the base class"); 41746 } 41747 41748 _decrypt(input, key) { 41749 let t, u, v; 41750 const state = new Uint8Array(16); 41751 state.set(input); 41752 41753 for (let j = 0, k = this._keySize; j < 16; ++j, ++k) { 41754 state[j] ^= key[k]; 41755 } 41756 41757 for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) { 41758 t = state[13]; 41759 state[13] = state[9]; 41760 state[9] = state[5]; 41761 state[5] = state[1]; 41762 state[1] = t; 41763 t = state[14]; 41764 u = state[10]; 41765 state[14] = state[6]; 41766 state[10] = state[2]; 41767 state[6] = t; 41768 state[2] = u; 41769 t = state[15]; 41770 u = state[11]; 41771 v = state[7]; 41772 state[15] = state[3]; 41773 state[11] = t; 41774 state[7] = u; 41775 state[3] = v; 41776 41777 for (let j = 0; j < 16; ++j) { 41778 state[j] = this._inv_s[state[j]]; 41779 } 41780 41781 for (let j = 0, k = i * 16; j < 16; ++j, ++k) { 41782 state[j] ^= key[k]; 41783 } 41784 41785 for (let j = 0; j < 16; j += 4) { 41786 const s0 = this._mix[state[j]]; 41787 const s1 = this._mix[state[j + 1]]; 41788 const s2 = this._mix[state[j + 2]]; 41789 const s3 = this._mix[state[j + 3]]; 41790 t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8; 41791 state[j] = t >>> 24 & 0xff; 41792 state[j + 1] = t >> 16 & 0xff; 41793 state[j + 2] = t >> 8 & 0xff; 41794 state[j + 3] = t & 0xff; 41795 } 41796 } 41797 41798 t = state[13]; 41799 state[13] = state[9]; 41800 state[9] = state[5]; 41801 state[5] = state[1]; 41802 state[1] = t; 41803 t = state[14]; 41804 u = state[10]; 41805 state[14] = state[6]; 41806 state[10] = state[2]; 41807 state[6] = t; 41808 state[2] = u; 41809 t = state[15]; 41810 u = state[11]; 41811 v = state[7]; 41812 state[15] = state[3]; 41813 state[11] = t; 41814 state[7] = u; 41815 state[3] = v; 41816 41817 for (let j = 0; j < 16; ++j) { 41818 state[j] = this._inv_s[state[j]]; 41819 state[j] ^= key[j]; 41820 } 41821 41822 return state; 41823 } 41824 41825 _encrypt(input, key) { 41826 const s = this._s; 41827 let t, u, v; 41828 const state = new Uint8Array(16); 41829 state.set(input); 41830 41831 for (let j = 0; j < 16; ++j) { 41832 state[j] ^= key[j]; 41833 } 41834 41835 for (let i = 1; i < this._cyclesOfRepetition; i++) { 41836 for (let j = 0; j < 16; ++j) { 41837 state[j] = s[state[j]]; 41838 } 41839 41840 v = state[1]; 41841 state[1] = state[5]; 41842 state[5] = state[9]; 41843 state[9] = state[13]; 41844 state[13] = v; 41845 v = state[2]; 41846 u = state[6]; 41847 state[2] = state[10]; 41848 state[6] = state[14]; 41849 state[10] = v; 41850 state[14] = u; 41851 v = state[3]; 41852 u = state[7]; 41853 t = state[11]; 41854 state[3] = state[15]; 41855 state[7] = v; 41856 state[11] = u; 41857 state[15] = t; 41858 41859 for (let j = 0; j < 16; j += 4) { 41860 const s0 = state[j + 0]; 41861 const s1 = state[j + 1]; 41862 const s2 = state[j + 2]; 41863 const s3 = state[j + 3]; 41864 t = s0 ^ s1 ^ s2 ^ s3; 41865 state[j + 0] ^= t ^ this._mixCol[s0 ^ s1]; 41866 state[j + 1] ^= t ^ this._mixCol[s1 ^ s2]; 41867 state[j + 2] ^= t ^ this._mixCol[s2 ^ s3]; 41868 state[j + 3] ^= t ^ this._mixCol[s3 ^ s0]; 41869 } 41870 41871 for (let j = 0, k = i * 16; j < 16; ++j, ++k) { 41872 state[j] ^= key[k]; 41873 } 41874 } 41875 41876 for (let j = 0; j < 16; ++j) { 41877 state[j] = s[state[j]]; 41878 } 41879 41880 v = state[1]; 41881 state[1] = state[5]; 41882 state[5] = state[9]; 41883 state[9] = state[13]; 41884 state[13] = v; 41885 v = state[2]; 41886 u = state[6]; 41887 state[2] = state[10]; 41888 state[6] = state[14]; 41889 state[10] = v; 41890 state[14] = u; 41891 v = state[3]; 41892 u = state[7]; 41893 t = state[11]; 41894 state[3] = state[15]; 41895 state[7] = v; 41896 state[11] = u; 41897 state[15] = t; 41898 41899 for (let j = 0, k = this._keySize; j < 16; ++j, ++k) { 41900 state[j] ^= key[k]; 41901 } 41902 41903 return state; 41904 } 41905 41906 _decryptBlock2(data, finalize) { 41907 const sourceLength = data.length; 41908 let buffer = this.buffer, 41909 bufferLength = this.bufferPosition; 41910 const result = []; 41911 let iv = this.iv; 41912 41913 for (let i = 0; i < sourceLength; ++i) { 41914 buffer[bufferLength] = data[i]; 41915 ++bufferLength; 41916 41917 if (bufferLength < 16) { 41918 continue; 41919 } 41920 41921 const plain = this._decrypt(buffer, this._key); 41922 41923 for (let j = 0; j < 16; ++j) { 41924 plain[j] ^= iv[j]; 41925 } 41926 41927 iv = buffer; 41928 result.push(plain); 41929 buffer = new Uint8Array(16); 41930 bufferLength = 0; 41931 } 41932 41933 this.buffer = buffer; 41934 this.bufferLength = bufferLength; 41935 this.iv = iv; 41936 41937 if (result.length === 0) { 41938 return new Uint8Array(0); 41939 } 41940 41941 let outputLength = 16 * result.length; 41942 41943 if (finalize) { 41944 const lastBlock = result[result.length - 1]; 41945 let psLen = lastBlock[15]; 41946 41947 if (psLen <= 16) { 41948 for (let i = 15, ii = 16 - psLen; i >= ii; --i) { 41949 if (lastBlock[i] !== psLen) { 41950 psLen = 0; 41951 break; 41952 } 41953 } 41954 41955 outputLength -= psLen; 41956 result[result.length - 1] = lastBlock.subarray(0, 16 - psLen); 41957 } 41958 } 41959 41960 const output = new Uint8Array(outputLength); 41961 41962 for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) { 41963 output.set(result[i], j); 41964 } 41965 41966 return output; 41967 } 41968 41969 decryptBlock(data, finalize, iv = null) { 41970 const sourceLength = data.length; 41971 const buffer = this.buffer; 41972 let bufferLength = this.bufferPosition; 41973 41974 if (iv) { 41975 this.iv = iv; 41976 } else { 41977 for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) { 41978 buffer[bufferLength] = data[i]; 41979 } 41980 41981 if (bufferLength < 16) { 41982 this.bufferLength = bufferLength; 41983 return new Uint8Array(0); 41984 } 41985 41986 this.iv = buffer; 41987 data = data.subarray(16); 41988 } 41989 41990 this.buffer = new Uint8Array(16); 41991 this.bufferLength = 0; 41992 this.decryptBlock = this._decryptBlock2; 41993 return this.decryptBlock(data, finalize); 41994 } 41995 41996 encrypt(data, iv) { 41997 const sourceLength = data.length; 41998 let buffer = this.buffer, 41999 bufferLength = this.bufferPosition; 42000 const result = []; 42001 42002 if (!iv) { 42003 iv = new Uint8Array(16); 42004 } 42005 42006 for (let i = 0; i < sourceLength; ++i) { 42007 buffer[bufferLength] = data[i]; 42008 ++bufferLength; 42009 42010 if (bufferLength < 16) { 42011 continue; 42012 } 42013 42014 for (let j = 0; j < 16; ++j) { 42015 buffer[j] ^= iv[j]; 42016 } 42017 42018 const cipher = this._encrypt(buffer, this._key); 42019 42020 iv = cipher; 42021 result.push(cipher); 42022 buffer = new Uint8Array(16); 42023 bufferLength = 0; 42024 } 42025 42026 this.buffer = buffer; 42027 this.bufferLength = bufferLength; 42028 this.iv = iv; 42029 42030 if (result.length === 0) { 42031 return new Uint8Array(0); 42032 } 42033 42034 const outputLength = 16 * result.length; 42035 const output = new Uint8Array(outputLength); 42036 42037 for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) { 42038 output.set(result[i], j); 42039 } 42040 42041 return output; 42042 } 42043 42044} 42045 42046class AES128Cipher extends AESBaseCipher { 42047 constructor(key) { 42048 super(); 42049 this._cyclesOfRepetition = 10; 42050 this._keySize = 160; 42051 this._rcon = new Uint8Array([0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d]); 42052 this._key = this._expandKey(key); 42053 } 42054 42055 _expandKey(cipherKey) { 42056 const b = 176; 42057 const s = this._s; 42058 const rcon = this._rcon; 42059 const result = new Uint8Array(b); 42060 result.set(cipherKey); 42061 42062 for (let j = 16, i = 1; j < b; ++i) { 42063 let t1 = result[j - 3]; 42064 let t2 = result[j - 2]; 42065 let t3 = result[j - 1]; 42066 let t4 = result[j - 4]; 42067 t1 = s[t1]; 42068 t2 = s[t2]; 42069 t3 = s[t3]; 42070 t4 = s[t4]; 42071 t1 = t1 ^ rcon[i]; 42072 42073 for (let n = 0; n < 4; ++n) { 42074 result[j] = t1 ^= result[j - 16]; 42075 j++; 42076 result[j] = t2 ^= result[j - 16]; 42077 j++; 42078 result[j] = t3 ^= result[j - 16]; 42079 j++; 42080 result[j] = t4 ^= result[j - 16]; 42081 j++; 42082 } 42083 } 42084 42085 return result; 42086 } 42087 42088} 42089 42090exports.AES128Cipher = AES128Cipher; 42091 42092class AES256Cipher extends AESBaseCipher { 42093 constructor(key) { 42094 super(); 42095 this._cyclesOfRepetition = 14; 42096 this._keySize = 224; 42097 this._key = this._expandKey(key); 42098 } 42099 42100 _expandKey(cipherKey) { 42101 const b = 240; 42102 const s = this._s; 42103 const result = new Uint8Array(b); 42104 result.set(cipherKey); 42105 let r = 1; 42106 let t1, t2, t3, t4; 42107 42108 for (let j = 32, i = 1; j < b; ++i) { 42109 if (j % 32 === 16) { 42110 t1 = s[t1]; 42111 t2 = s[t2]; 42112 t3 = s[t3]; 42113 t4 = s[t4]; 42114 } else if (j % 32 === 0) { 42115 t1 = result[j - 3]; 42116 t2 = result[j - 2]; 42117 t3 = result[j - 1]; 42118 t4 = result[j - 4]; 42119 t1 = s[t1]; 42120 t2 = s[t2]; 42121 t3 = s[t3]; 42122 t4 = s[t4]; 42123 t1 = t1 ^ r; 42124 42125 if ((r <<= 1) >= 256) { 42126 r = (r ^ 0x1b) & 0xff;
42127 } 42128 } 42129 42130 for (let n = 0; n < 4; ++n) { 42131 result[j] = t1 ^= result[j - 32]; 42132 j++; 42133 result[j] = t2 ^= result[j - 32]; 42134 j++; 42135 result[j] = t3 ^= result[j - 32]; 42136 j++; 42137 result[j] = t4 ^= result[j - 32]; 42138 j++; 42139 } 42140 } 42141 42142 return result; 42143 } 42144 42145} 42146 42147exports.AES256Cipher = AES256Cipher; 42148 42149var PDF17 = function PDF17Closure() { 42150 function compareByteArrays(array1, array2) { 42151 if (array1.length !== array2.length) { 42152 return false; 42153 } 42154 42155 for (var i = 0; i < array1.length; i++) { 42156 if (array1[i] !== array2[i]) { 42157 return false; 42158 } 42159 } 42160 42161 return true; 42162 } 42163 42164 function PDF17() {} 42165 42166 PDF17.prototype = { 42167 checkOwnerPassword: function PDF17_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) { 42168 var hashData = new Uint8Array(password.length + 56); 42169 hashData.set(password, 0); 42170 hashData.set(ownerValidationSalt, password.length); 42171 hashData.set(userBytes, password.length + ownerValidationSalt.length); 42172 var result = calculateSHA256(hashData, 0, hashData.length); 42173 return compareByteArrays(result, ownerPassword); 42174 }, 42175 checkUserPassword: function PDF17_checkUserPassword(password, userValidationSalt, userPassword) { 42176 var hashData = new Uint8Array(password.length + 8); 42177 hashData.set(password, 0); 42178 hashData.set(userValidationSalt, password.length); 42179 var result = calculateSHA256(hashData, 0, hashData.length); 42180 return compareByteArrays(result, userPassword); 42181 }, 42182 getOwnerKey: function PDF17_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) { 42183 var hashData = new Uint8Array(password.length + 56); 42184 hashData.set(password, 0); 42185 hashData.set(ownerKeySalt, password.length); 42186 hashData.set(userBytes, password.length + ownerKeySalt.length); 42187 var key = calculateSHA256(hashData, 0, hashData.length); 42188 var cipher = new AES256Cipher(key); 42189 return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16)); 42190 }, 42191 getUserKey: function PDF17_getUserKey(password, userKeySalt, userEncryption) { 42192 var hashData = new Uint8Array(password.length + 8); 42193 hashData.set(password, 0); 42194 hashData.set(userKeySalt, password.length); 42195 var key = calculateSHA256(hashData, 0, hashData.length); 42196 var cipher = new AES256Cipher(key); 42197 return cipher.decryptBlock(userEncryption, false, new Uint8Array(16)); 42198 } 42199 }; 42200 return PDF17; 42201}(); 42202 42203exports.PDF17 = PDF17; 42204 42205var PDF20 = function PDF20Closure() { 42206 function concatArrays(array1, array2) { 42207 var t = new Uint8Array(array1.length + array2.length); 42208 t.set(array1, 0); 42209 t.set(array2, array1.length); 42210 return t; 42211 } 42212 42213 function calculatePDF20Hash(password, input, userBytes) { 42214 var k = calculateSHA256(input, 0, input.length).subarray(0, 32); 42215 var e = [0]; 42216 var i = 0; 42217 42218 while (i < 64 || e[e.length - 1] > i - 32) { 42219 var arrayLength = password.length + k.length + userBytes.length; 42220 var k1 = new Uint8Array(arrayLength * 64); 42221 var array = concatArrays(password, k); 42222 array = concatArrays(array, userBytes); 42223 42224 for (var j = 0, pos = 0; j < 64; j++, pos += arrayLength) { 42225 k1.set(array, pos); 42226 } 42227 42228 var cipher = new AES128Cipher(k.subarray(0, 16)); 42229 e = cipher.encrypt(k1, k.subarray(16, 32)); 42230 var remainder = 0; 42231 42232 for (var z = 0; z < 16; z++) { 42233 remainder *= 256 % 3; 42234 remainder %= 3; 42235 remainder += (e[z] >>> 0) % 3; 42236 remainder %= 3; 42237 } 42238 42239 if (remainder === 0) { 42240 k = calculateSHA256(e, 0, e.length); 42241 } else if (remainder === 1) { 42242 k = calculateSHA384(e, 0, e.length); 42243 } else if (remainder === 2) { 42244 k = calculateSHA512(e, 0, e.length); 42245 } 42246 42247 i++; 42248 } 42249 42250 return k.subarray(0, 32); 42251 } 42252 42253 function PDF20() {} 42254 42255 function compareByteArrays(array1, array2) { 42256 if (array1.length !== array2.length) { 42257 return false; 42258 } 42259 42260 for (var i = 0; i < array1.length; i++) { 42261 if (array1[i] !== array2[i]) { 42262 return false; 42263 } 42264 } 42265 42266 return true; 42267 } 42268 42269 PDF20.prototype = { 42270 hash: function PDF20_hash(password, concatBytes, userBytes) { 42271 return calculatePDF20Hash(password, concatBytes, userBytes); 42272 }, 42273 checkOwnerPassword: function PDF20_checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) { 42274 var hashData = new Uint8Array(password.length + 56); 42275 hashData.set(password, 0); 42276 hashData.set(ownerValidationSalt, password.length); 42277 hashData.set(userBytes, password.length + ownerValidationSalt.length); 42278 var result = calculatePDF20Hash(password, hashData, userBytes); 42279 return compareByteArrays(result, ownerPassword); 42280 }, 42281 checkUserPassword: function PDF20_checkUserPassword(password, userValidationSalt, userPassword) { 42282 var hashData = new Uint8Array(password.length + 8); 42283 hashData.set(password, 0); 42284 hashData.set(userValidationSalt, password.length); 42285 var result = calculatePDF20Hash(password, hashData, []); 42286 return compareByteArrays(result, userPassword); 42287 },
42288 getOwnerKey: function PDF20_getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) { 42289 var hashData = new Uint8Array(password.length + 56); 42290 hashData.set(password, 0); 42291 hashData.set(ownerKeySalt, password.length); 42292 hashData.set(userBytes, password.length + ownerKeySalt.length); 42293 var key = calculatePDF20Hash(password, hashData, userBytes); 42294 var cipher = new AES256Cipher(key); 42295 return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16)); 42296 }, 42297 getUserKey: function PDF20_getUserKey(password, userKeySalt, userEncryption) { 42298 var hashData = new Uint8Array(password.length + 8); 42299 hashData.set(password, 0); 42300 hashData.set(userKeySalt, password.length); 42301 var key = calculatePDF20Hash(password, hashData, []); 42302 var cipher = new AES256Cipher(key); 42303 return cipher.decryptBlock(userEncryption, false, new Uint8Array(16)); 42304 } 42305 }; 42306 return PDF20; 42307}(); 42308 42309exports.PDF20 = PDF20; 42310 42311var CipherTransform = function CipherTransformClosure() { 42312 function CipherTransform(stringCipherConstructor, streamCipherConstructor) { 42313 this.StringCipherConstructor = stringCipherConstructor; 42314 this.StreamCipherConstructor = streamCipherConstructor; 42315 } 42316 42317 CipherTransform.prototype = { 42318 createStream: function CipherTransform_createStream(stream, length) { 42319 var cipher = new this.StreamCipherConstructor(); 42320 return new _stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) { 42321 return cipher.decryptBlock(data, finalize); 42322 }); 42323 }, 42324 decryptString: function CipherTransform_decryptString(s) { 42325 var cipher = new this.StringCipherConstructor(); 42326 var data = (0, _util.stringToBytes)(s); 42327 data = cipher.decryptBlock(data, true); 42328 return (0, _util.bytesToString)(data); 42329 } 42330 }; 42331 return CipherTransform; 42332}(); 42333 42334var CipherTransformFactory = function CipherTransformFactoryClosure() { 42335 var defaultPasswordBytes = new Uint8Array([0x28, 0xBF, 0x4E, 0x5E, 0x4E, 0x75, 0x8A, 0x41, 0x64, 0x00, 0x4E, 0x56, 0xFF, 0xFA, 0x01, 0x08, 0x2E, 0x2E, 0x00, 0xB6, 0xD0, 0x68, 0x3E, 0x80, 0x2F, 0x0C, 0xA9, 0xFE, 0x64, 0x53, 0x69, 0x7A]); 42336 42337 function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) { 42338 if (password) { 42339 var passwordLength = Math.min(127, password.length); 42340 password = password.subarray(0, passwordLength); 42341 } else { 42342 password = []; 42343 } 42344 42345 var pdfAlgorithm; 42346 42347 if (revision === 6) { 42348 pdfAlgorithm = new PDF20(); 42349 } else { 42350 pdfAlgorithm = new PDF17(); 42351 } 42352 42353 if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) { 42354 return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption); 42355 } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) { 42356 return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption); 42357 } 42358 42359 return null; 42360 } 42361 42362 function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) { 42363 var hashDataSize = 40 + ownerPassword.length + fileId.length; 42364 var hashData = new Uint8Array(hashDataSize), 42365 i = 0, 42366 j, 42367 n; 42368 42369 if (password) { 42370 n = Math.min(32, password.length); 42371 42372 for (; i < n; ++i) { 42373 hashData[i] = password[i]; 42374 } 42375 } 42376 42377 j = 0; 42378 42379 while (i < 32) { 42380 hashData[i++] = defaultPasswordBytes[j++]; 42381 } 42382 42383 for (j = 0, n = ownerPassword.length; j < n; ++j) { 42384 hashData[i++] = ownerPassword[j]; 42385 } 42386 42387 hashData[i++] = flags & 0xff; 42388 hashData[i++] = flags >> 8 & 0xff; 42389 hashData[i++] = flags >> 16 & 0xff; 42390 hashData[i++] = flags >>> 24 & 0xff; 42391 42392 for (j = 0, n = fileId.length; j < n; ++j) { 42393 hashData[i++] = fileId[j]; 42394 } 42395 42396 if (revision >= 4 && !encryptMetadata) { 42397 hashData[i++] = 0xff; 42398 hashData[i++] = 0xff; 42399 hashData[i++] = 0xff; 42400 hashData[i++] = 0xff; 42401 } 42402 42403 var hash = calculateMD5(hashData, 0, i); 42404 var keyLengthInBytes = keyLength >> 3; 42405 42406 if (revision >= 3) { 42407 for (j = 0; j < 50; ++j) { 42408 hash = calculateMD5(hash, 0, keyLengthInBytes); 42409 } 42410 } 42411 42412 var encryptionKey = hash.subarray(0, keyLengthInBytes); 42413 var cipher, checkData; 42414 42415 if (revision >= 3) { 42416 for (i = 0; i < 32; ++i) { 42417 hashData[i] = defaultPasswordBytes[i]; 42418 } 42419 42420 for (j = 0, n = fileId.length; j < n; ++j) { 42421 hashData[i++] = fileId[j]; 42422 } 42423 42424 cipher = new ARCFourCipher(encryptionKey); 42425 checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i)); 42426 n = encryptionKey.length; 42427 var derivedKey = new Uint8Array(n), 42428 k; 42429 42430 for (j = 1; j <= 19; ++j) { 42431 for (k = 0; k < n; ++k) { 42432 derivedKey[k] = encryptionKey[k] ^ j; 42433 } 42434 42435 cipher = new ARCFourCipher(derivedKey); 42436 checkData = cipher.encryptBlock(checkData); 42437 } 42438 42439 for (j = 0, n = checkData.length; j < n; ++j) { 42440 if (userPassword[j] !== checkData[j]) { 42441 return null; 42442 } 42443 } 42444 } else { 42445 cipher = new ARCFourCipher(encryptionKey); 42446 checkData = cipher.encryptBlock(defaultPasswordBytes); 42447 42448 for (j = 0, n = checkData.length; j < n; ++j) { 42449 if (userPassword[j] !== checkData[j]) { 42450 return null; 42451 } 42452 } 42453 } 42454 42455 return encryptionKey; 42456 } 42457
42458 function decodeUserPassword(password, ownerPassword, revision, keyLength) { 42459 var hashData = new Uint8Array(32), 42460 i = 0, 42461 j, 42462 n; 42463 n = Math.min(32, password.length); 42464 42465 for (; i < n; ++i) { 42466 hashData[i] = password[i]; 42467 } 42468 42469 j = 0; 42470 42471 while (i < 32) { 42472 hashData[i++] = defaultPasswordBytes[j++]; 42473 } 42474 42475 var hash = calculateMD5(hashData, 0, i); 42476 var keyLengthInBytes = keyLength >> 3; 42477 42478 if (revision >= 3) { 42479 for (j = 0; j < 50; ++j) { 42480 hash = calculateMD5(hash, 0, hash.length); 42481 } 42482 } 42483 42484 var cipher, userPassword; 42485 42486 if (revision >= 3) { 42487 userPassword = ownerPassword; 42488 var derivedKey = new Uint8Array(keyLengthInBytes), 42489 k; 42490 42491 for (j = 19; j >= 0; j--) { 42492 for (k = 0; k < keyLengthInBytes; ++k) { 42493 derivedKey[k] = hash[k] ^ j; 42494 } 42495 42496 cipher = new ARCFourCipher(derivedKey); 42497 userPassword = cipher.encryptBlock(userPassword); 42498 } 42499 } else { 42500 cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes)); 42501 userPassword = cipher.encryptBlock(ownerPassword); 42502 } 42503 42504 return userPassword; 42505 } 42506 42507 var identityName = _primitives.Name.get("Identity"); 42508 42509 function CipherTransformFactory(dict, fileId, password) { 42510 var filter = dict.get("Filter"); 42511 42512 if (!(0, _primitives.isName)(filter, "Standard")) { 42513 throw new _util.FormatError("unknown encryption method"); 42514 } 42515 42516 this.dict = dict; 42517 var algorithm = dict.get("V"); 42518 42519 if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) { 42520 throw new _util.FormatError("unsupported encryption algorithm"); 42521 } 42522 42523 this.algorithm = algorithm; 42524 var keyLength = dict.get("Length"); 42525 42526 if (!keyLength) { 42527 if (algorithm <= 3) { 42528 keyLength = 40; 42529 } else { 42530 var cfDict = dict.get("CF"); 42531 var streamCryptoName = dict.get("StmF"); 42532 42533 if ((0, _primitives.isDict)(cfDict) && (0, _primitives.isName)(streamCryptoName)) { 42534 cfDict.suppressEncryption = true; 42535 var handlerDict = cfDict.get(streamCryptoName.name); 42536 keyLength = handlerDict && handlerDict.get("Length") || 128; 42537 42538 if (keyLength < 40) { 42539 keyLength <<= 3; 42540 } 42541 } 42542 } 42543 } 42544 42545 if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) { 42546 throw new _util.FormatError("invalid key length"); 42547 } 42548 42549 var ownerPassword = (0, _util.stringToBytes)(dict.get("O")).subarray(0, 32); 42550 var userPassword = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 32); 42551 var flags = dict.get("P"); 42552 var revision = dict.get("R"); 42553 var encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false; 42554 this.encryptMetadata = encryptMetadata; 42555 var fileIdBytes = (0, _util.stringToBytes)(fileId); 42556 var passwordBytes; 42557 42558 if (password) { 42559 if (revision === 6) { 42560 try { 42561 password = (0, _util.utf8StringToString)(password); 42562 } catch (ex) { 42563 (0, _util.warn)("CipherTransformFactory: " + "Unable to convert UTF8 encoded password."); 42564 } 42565 } 42566 42567 passwordBytes = (0, _util.stringToBytes)(password); 42568 } 42569 42570 var encryptionKey; 42571 42572 if (algorithm !== 5) { 42573 encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata); 42574 } else { 42575 var ownerValidationSalt = (0, _util.stringToBytes)(dict.get("O")).subarray(32, 40); 42576 var ownerKeySalt = (0, _util.stringToBytes)(dict.get("O")).subarray(40, 48); 42577 var uBytes = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 48); 42578 var userValidationSalt = (0, _util.stringToBytes)(dict.get("U")).subarray(32, 40); 42579 var userKeySalt = (0, _util.stringToBytes)(dict.get("U")).subarray(40, 48); 42580 var ownerEncryption = (0, _util.stringToBytes)(dict.get("OE")); 42581 var userEncryption = (0, _util.stringToBytes)(dict.get("UE")); 42582 var perms = (0, _util.stringToBytes)(dict.get("Perms")); 42583 encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms); 42584 } 42585 42586 if (!encryptionKey && !password) { 42587 throw new _util.PasswordException("No password given", _util.PasswordResponses.NEED_PASSWORD); 42588 } else if (!encryptionKey && password) { 42589 var decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength); 42590 encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata); 42591 } 42592 42593 if (!encryptionKey) { 42594 throw new _util.PasswordException("Incorrect Password", _util.PasswordResponses.INCORRECT_PASSWORD); 42595 } 42596 42597 this.encryptionKey = encryptionKey; 42598 42599 if (algorithm >= 4) { 42600 var cf = dict.get("CF"); 42601 42602 if ((0, _primitives.isDict)(cf)) {
42603 cf.suppressEncryption = true; 42604 } 42605 42606 this.cf = cf; 42607 this.stmf = dict.get("StmF") || identityName; 42608 this.strf = dict.get("StrF") || identityName; 42609 this.eff = dict.get("EFF") || this.stmf; 42610 } 42611 } 42612 42613 function buildObjectKey(num, gen, encryptionKey, isAes) { 42614 var key = new Uint8Array(encryptionKey.length + 9), 42615 i, 42616 n; 42617 42618 for (i = 0, n = encryptionKey.length; i < n; ++i) { 42619 key[i] = encryptionKey[i]; 42620 } 42621 42622 key[i++] = num & 0xff; 42623 key[i++] = num >> 8 & 0xff; 42624 key[i++] = num >> 16 & 0xff; 42625 key[i++] = gen & 0xff; 42626 key[i++] = gen >> 8 & 0xff; 42627 42628 if (isAes) { 42629 key[i++] = 0x73; 42630 key[i++] = 0x41; 42631 key[i++] = 0x6c; 42632 key[i++] = 0x54; 42633 } 42634 42635 var hash = calculateMD5(key, 0, i); 42636 return hash.subarray(0, Math.min(encryptionKey.length + 5, 16)); 42637 } 42638 42639 function buildCipherConstructor(cf, name, num, gen, key) { 42640 if (!(0, _primitives.isName)(name)) { 42641 throw new _util.FormatError("Invalid crypt filter name."); 42642 } 42643 42644 var cryptFilter = cf.get(name.name); 42645 var cfm; 42646
vendor: 4,428 bytes, lines 42647-42798
42647 if (cryptFilter !== null && cryptFilter !== undefined) { 42648 cfm = cryptFilter.get("CFM"); 42649 } 42650 42651 if (!cfm || cfm.name === "None") { 42652 return function cipherTransformFactoryBuildCipherConstructorNone() { 42653 return new NullCipher(); 42654 }; 42655 } 42656 42657 if (cfm.name === "V2") { 42658 return function cipherTransformFactoryBuildCipherConstructorV2() { 42659 return new ARCFourCipher(buildObjectKey(num, gen, key, false)); 42660 }; 42661 } 42662 42663 if (cfm.name === "AESV2") { 42664 return function cipherTransformFactoryBuildCipherConstructorAESV2() { 42665 return new AES128Cipher(buildObjectKey(num, gen, key, true)); 42666 }; 42667 } 42668 42669 if (cfm.name === "AESV3") { 42670 return function cipherTransformFactoryBuildCipherConstructorAESV3() { 42671 return new AES256Cipher(key); 42672 }; 42673 } 42674 42675 throw new _util.FormatError("Unknown crypto method"); 42676 } 42677 42678 CipherTransformFactory.prototype = { 42679 createCipherTransform: function CipherTransformFactory_createCipherTransform(num, gen) { 42680 if (this.algorithm === 4 || this.algorithm === 5) { 42681 return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey)); 42682 } 42683 42684 var key = buildObjectKey(num, gen, this.encryptionKey, false); 42685 42686 var cipherConstructor = function buildCipherCipherConstructor() { 42687 return new ARCFourCipher(key); 42688 }; 42689 42690 return new CipherTransform(cipherConstructor, cipherConstructor); 42691 } 42692 }; 42693 return CipherTransformFactory; 42694}(); 42695 42696exports.CipherTransformFactory = CipherTransformFactory; 42697 42698/***/ }), 42699/* 22 */ 42700/***/ (function(module, exports, __w_pdfjs_require__) { 42701 42702"use strict"; 42703 42704 42705Object.defineProperty(exports, "__esModule", { 42706 value: true 42707}); 42708exports.ColorSpace = void 0; 42709 42710var _util = __w_pdfjs_require__(2); 42711 42712var _primitives = __w_pdfjs_require__(4); 42713 42714function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) { 42715 const COMPONENTS = 3; 42716 alpha01 = alpha01 !== 1 ? 0 : alpha01; 42717 const xRatio = w1 / w2; 42718 const yRatio = h1 / h2; 42719 let newIndex = 0, 42720 oldIndex; 42721 const xScaled = new Uint16Array(w2); 42722 const w1Scanline = w1 * COMPONENTS; 42723 42724 for (let i = 0; i < w2; i++) { 42725 xScaled[i] = Math.floor(i * xRatio) * COMPONENTS; 42726 } 42727 42728 for (let i = 0; i < h2; i++) { 42729 const py = Math.floor(i * yRatio) * w1Scanline; 42730 42731 for (let j = 0; j < w2; j++) { 42732 oldIndex = py + xScaled[j]; 42733 dest[newIndex++] = src[oldIndex++]; 42734 dest[newIndex++] = src[oldIndex++]; 42735 dest[newIndex++] = src[oldIndex++]; 42736 newIndex += alpha01; 42737 } 42738 } 42739} 42740 42741class ColorSpace { 42742 constructor(name, numComps) { 42743 if (this.constructor === ColorSpace) { 42744 (0, _util.unreachable)("Cannot initialize ColorSpace."); 42745 } 42746 42747 this.name = name; 42748 this.numComps = numComps; 42749 } 42750 42751 getRgb(src, srcOffset) { 42752 const rgb = new Uint8ClampedArray(3); 42753 this.getRgbItem(src, srcOffset, rgb, 0); 42754 return rgb; 42755 } 42756 42757 getRgbItem(src, srcOffset, dest, destOffset) { 42758 (0, _util.unreachable)("Should not call ColorSpace.getRgbItem"); 42759 } 42760 42761 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 42762 (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer"); 42763 } 42764 42765 getOutputLength(inputLength, alpha01) { 42766 (0, _util.unreachable)("Should not call ColorSpace.getOutputLength"); 42767 } 42768 42769 isPassthrough(bits) { 42770 return false; 42771 } 42772 42773 isDefaultDecode(decodeMap, bpc) { 42774 return ColorSpace.isDefaultDecode(decodeMap, this.numComps); 42775 } 42776 42777 fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) { 42778 const count = originalWidth * originalHeight; 42779 let rgbBuf = null; 42780 const numComponentColors = 1 << bpc; 42781 const needsResizing = originalHeight !== height || originalWidth !== width; 42782 42783 if (this.isPassthrough(bpc)) { 42784 rgbBuf = comps; 42785 } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") { 42786 const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors); 42787 42788 for (let i = 0; i < numComponentColors; i++) { 42789 allColors[i] = i; 42790 } 42791 42792 const colorMap = new Uint8ClampedArray(numComponentColors * 3); 42793 this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0); 42794 42795 if (!needsResizing) { 42796 let destPos = 0; 42797 42798 for (let i = 0; i < count; ++i) {
42799 const key = comps[i] * 3; 42800 dest[destPos++] = colorMap[key]; 42801 dest[destPos++] = colorMap[key + 1]; 42802 dest[destPos++] = colorMap[key + 2]; 42803 destPos += alpha01; 42804 } 42805 } else { 42806 rgbBuf = new Uint8Array(count * 3); 42807 let rgbPos = 0; 42808 42809 for (let i = 0; i < count; ++i) { 42810 const key = comps[i] * 3; 42811 rgbBuf[rgbPos++] = colorMap[key]; 42812 rgbBuf[rgbPos++] = colorMap[key + 1]; 42813 rgbBuf[rgbPos++] = colorMap[key + 2]; 42814 } 42815 } 42816 } else { 42817 if (!needsResizing) { 42818 this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01); 42819 } else { 42820 rgbBuf = new Uint8ClampedArray(count * 3); 42821 this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0); 42822 } 42823 } 42824 42825 if (rgbBuf) { 42826 if (needsResizing) { 42827 resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01); 42828 } else { 42829 let destPos = 0, 42830 rgbPos = 0; 42831 42832 for (let i = 0, ii = width * actualHeight; i < ii; i++) { 42833 dest[destPos++] = rgbBuf[rgbPos++]; 42834 dest[destPos++] = rgbBuf[rgbPos++]; 42835 dest[destPos++] = rgbBuf[rgbPos++]; 42836 destPos += alpha01; 42837 } 42838 } 42839 } 42840 } 42841 42842 get usesZeroToOneRange() { 42843 return (0, _util.shadow)(this, "usesZeroToOneRange", true); 42844 } 42845 42846 static parse(cs, xref, res, pdfFunctionFactory) { 42847 const IR = this.parseToIR(cs, xref, res, pdfFunctionFactory); 42848 return this.fromIR(IR); 42849 } 42850 42851 static fromIR(IR) { 42852 const name = Array.isArray(IR) ? IR[0] : IR; 42853 let whitePoint, blackPoint, gamma; 42854 42855 switch (name) { 42856 case "DeviceGrayCS": 42857 return this.singletons.gray; 42858 42859 case "DeviceRgbCS": 42860 return this.singletons.rgb; 42861 42862 case "DeviceCmykCS": 42863 return this.singletons.cmyk; 42864 42865 case "CalGrayCS": 42866 whitePoint = IR[1]; 42867 blackPoint = IR[2]; 42868 gamma = IR[3]; 42869 return new CalGrayCS(whitePoint, blackPoint, gamma); 42870 42871 case "CalRGBCS": 42872 whitePoint = IR[1]; 42873 blackPoint = IR[2]; 42874 gamma = IR[3]; 42875 const matrix = IR[4]; 42876 return new CalRGBCS(whitePoint, blackPoint, gamma, matrix); 42877 42878 case "PatternCS": 42879 let basePatternCS = IR[1]; 42880 42881 if (basePatternCS) { 42882 basePatternCS = this.fromIR(basePatternCS); 42883 } 42884 42885 return new PatternCS(basePatternCS); 42886 42887 case "IndexedCS": 42888 const baseIndexedCS = IR[1]; 42889 const hiVal = IR[2]; 42890 const lookup = IR[3]; 42891 return new IndexedCS(this.fromIR(baseIndexedCS), hiVal, lookup); 42892 42893 case "AlternateCS": 42894 const numComps = IR[1]; 42895 const alt = IR[2]; 42896 const tintFn = IR[3]; 42897 return new AlternateCS(numComps, this.fromIR(alt), tintFn); 42898 42899 case "LabCS": 42900 whitePoint = IR[1]; 42901 blackPoint = IR[2]; 42902 const range = IR[3]; 42903 return new LabCS(whitePoint, blackPoint, range); 42904 42905 default: 42906 throw new _util.FormatError(`Unknown colorspace name: ${name}`); 42907 } 42908 } 42909 42910 static parseToIR(cs, xref, res = null, pdfFunctionFactory) { 42911 cs = xref.fetchIfRef(cs); 42912 42913 if ((0, _primitives.isName)(cs)) { 42914 switch (cs.name) { 42915 case "DeviceGray": 42916 case "G": 42917 return "DeviceGrayCS"; 42918 42919 case "DeviceRGB": 42920 case "RGB": 42921 return "DeviceRgbCS"; 42922 42923 case "DeviceCMYK": 42924 case "CMYK": 42925 return "DeviceCmykCS"; 42926 42927 case "Pattern": 42928 return ["PatternCS", null]; 42929 42930 default: 42931 if ((0, _primitives.isDict)(res)) { 42932 const colorSpaces = res.get("ColorSpace"); 42933 42934 if ((0, _primitives.isDict)(colorSpaces)) { 42935 const resCS = colorSpaces.get(cs.name); 42936 42937 if (resCS) { 42938 if ((0, _primitives.isName)(resCS)) { 42939 return this.parseToIR(resCS, xref, res, pdfFunctionFactory); 42940 } 42941 42942 cs = resCS; 42943 break; 42944 } 42945 } 42946 } 42947 42948 throw new _util.FormatError(`unrecognized colorspace ${cs.name}`); 42949 } 42950 } 42951 42952 if (Array.isArray(cs)) { 42953 const mode = xref.fetchIfRef(cs[0]).name; 42954 let numComps, params, alt, whitePoint, blackPoint, gamma; 42955 42956 switch (mode) { 42957 case "DeviceGray": 42958 case "G": 42959 return "DeviceGrayCS"; 42960 42961 case "DeviceRGB": 42962 case "RGB": 42963 return "DeviceRgbCS"; 42964 42965 case "DeviceCMYK": 42966 case "CMYK": 42967 return "DeviceCmykCS"; 42968 42969 case "CalGray": 42970 params = xref.fetchIfRef(cs[1]); 42971 whitePoint = params.getArray("WhitePoint"); 42972 blackPoint = params.getArray("BlackPoint"); 42973 gamma = params.get("Gamma"); 42974 return ["CalGrayCS", whitePoint, blackPoint, gamma]; 42975 42976 case "CalRGB": 42977 params = xref.fetchIfRef(cs[1]); 42978 whitePoint = params.getArray("WhitePoint"); 42979 blackPoint = params.getArray("BlackPoint"); 42980 gamma = params.getArray("Gamma"); 42981 const matrix = params.getArray("Matrix"); 42982 return ["CalRGBCS", whitePoint, blackPoint, gamma, matrix]; 42983 42984 case "ICCBased": 42985 const stream = xref.fetchIfRef(cs[1]); 42986 const dict = stream.dict; 42987 numComps = dict.get("N"); 42988 alt = dict.get("Alternate"); 42989 42990 if (alt) { 42991 const altIR = this.parseToIR(alt, xref, res, pdfFunctionFactory); 42992 const altCS = this.fromIR(altIR, pdfFunctionFactory); 42993 42994 if (altCS.numComps === numComps) { 42995 return altIR; 42996 } 42997 42998 (0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry."); 42999 } 43000 43001 if (numComps === 1) { 43002 return "DeviceGrayCS"; 43003 } else if (numComps === 3) { 43004 return "DeviceRgbCS"; 43005 } else if (numComps === 4) { 43006 return "DeviceCmykCS"; 43007 } 43008 43009 break; 43010 43011 case "Pattern": 43012 let basePatternCS = cs[1] || null; 43013 43014 if (basePatternCS) { 43015 basePatternCS = this.parseToIR(basePatternCS, xref, res, pdfFunctionFactory); 43016 } 43017 43018 return ["PatternCS", basePatternCS]; 43019 43020 case "Indexed": 43021 case "I": 43022 const baseIndexedCS = this.parseToIR(cs[1], xref, res, pdfFunctionFactory); 43023 const hiVal = xref.fetchIfRef(cs[2]) + 1; 43024 let lookup = xref.fetchIfRef(cs[3]); 43025 43026 if ((0, _primitives.isStream)(lookup)) { 43027 lookup = lookup.getBytes(); 43028 } 43029 43030 return ["IndexedCS", baseIndexedCS, hiVal, lookup]; 43031 43032 case "Separation": 43033 case "DeviceN": 43034 const name = xref.fetchIfRef(cs[1]); 43035 numComps = Array.isArray(name) ? name.length : 1; 43036 alt = this.parseToIR(cs[2], xref, res, pdfFunctionFactory); 43037 const tintFn = pdfFunctionFactory.create(xref.fetchIfRef(cs[3])); 43038 return ["AlternateCS", numComps, alt, tintFn]; 43039 43040 case "Lab": 43041 params = xref.fetchIfRef(cs[1]); 43042 whitePoint = params.getArray("WhitePoint"); 43043 blackPoint = params.getArray("BlackPoint"); 43044 const range = params.getArray("Range"); 43045 return ["LabCS", whitePoint, blackPoint, range]; 43046 43047 default: 43048 throw new _util.FormatError(`unimplemented color space object "${mode}"`); 43049 } 43050 } 43051 43052 throw new _util.FormatError(`unrecognized color space object: "${cs}"`); 43053 } 43054 43055 static isDefaultDecode(decode, numComps) { 43056 if (!Array.isArray(decode)) { 43057 return true; 43058 } 43059 43060 if (numComps * 2 !== decode.length) { 43061 (0, _util.warn)("The decode map is not the correct length"); 43062 return true; 43063 } 43064 43065 for (let i = 0, ii = decode.length; i < ii; i += 2) { 43066 if (decode[i] !== 0 || decode[i + 1] !== 1) { 43067 return false;
vendor: 20,124 bytes, lines 43068-43712
43068 } 43069 } 43070 43071 return true; 43072 } 43073 43074 static get singletons() { 43075 return (0, _util.shadow)(this, "singletons", { 43076 get gray() { 43077 return (0, _util.shadow)(this, "gray", new DeviceGrayCS()); 43078 }, 43079 43080 get rgb() { 43081 return (0, _util.shadow)(this, "rgb", new DeviceRgbCS()); 43082 }, 43083 43084 get cmyk() { 43085 return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS()); 43086 } 43087 43088 }); 43089 } 43090 43091} 43092 43093exports.ColorSpace = ColorSpace; 43094 43095class AlternateCS extends ColorSpace { 43096 constructor(numComps, base, tintFn) { 43097 super("Alternate", numComps); 43098 this.base = base; 43099 this.tintFn = tintFn; 43100 this.tmpBuf = new Float32Array(base.numComps); 43101 } 43102 43103 getRgbItem(src, srcOffset, dest, destOffset) { 43104 const tmpBuf = this.tmpBuf; 43105 this.tintFn(src, srcOffset, tmpBuf, 0); 43106 this.base.getRgbItem(tmpBuf, 0, dest, destOffset); 43107 } 43108 43109 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 43110 const tintFn = this.tintFn; 43111 const base = this.base; 43112 const scale = 1 / ((1 << bits) - 1); 43113 const baseNumComps = base.numComps; 43114 const usesZeroToOneRange = base.usesZeroToOneRange; 43115 const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0; 43116 let pos = isPassthrough ? destOffset : 0; 43117 const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count); 43118 const numComps = this.numComps; 43119 const scaled = new Float32Array(numComps); 43120 const tinted = new Float32Array(baseNumComps); 43121 let i, j; 43122 43123 for (i = 0; i < count; i++) { 43124 for (j = 0; j < numComps; j++) { 43125 scaled[j] = src[srcOffset++] * scale; 43126 } 43127 43128 tintFn(scaled, 0, tinted, 0); 43129 43130 if (usesZeroToOneRange) { 43131 for (j = 0; j < baseNumComps; j++) { 43132 baseBuf[pos++] = tinted[j] * 255; 43133 } 43134 } else { 43135 base.getRgbItem(tinted, 0, baseBuf, pos); 43136 pos += baseNumComps; 43137 } 43138 } 43139 43140 if (!isPassthrough) { 43141 base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01); 43142 } 43143 } 43144 43145 getOutputLength(inputLength, alpha01) { 43146 return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01); 43147 } 43148 43149} 43150 43151class PatternCS extends ColorSpace { 43152 constructor(baseCS) { 43153 super("Pattern", null); 43154 this.base = baseCS; 43155 } 43156 43157 isDefaultDecode(decodeMap, bpc) { 43158 (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode"); 43159 } 43160 43161} 43162 43163class IndexedCS extends ColorSpace { 43164 constructor(base, highVal, lookup) { 43165 super("Indexed", 1); 43166 this.base = base; 43167 this.highVal = highVal; 43168 const baseNumComps = base.numComps; 43169 const length = baseNumComps * highVal; 43170 43171 if ((0, _primitives.isStream)(lookup)) { 43172 this.lookup = new Uint8Array(length); 43173 const bytes = lookup.getBytes(length); 43174 this.lookup.set(bytes); 43175 } else if ((0, _util.isString)(lookup)) { 43176 this.lookup = new Uint8Array(length); 43177 43178 for (let i = 0; i < length; ++i) { 43179 this.lookup[i] = lookup.charCodeAt(i); 43180 } 43181 } else if (lookup instanceof Uint8Array) { 43182 this.lookup = lookup; 43183 } else { 43184 throw new _util.FormatError(`Unrecognized lookup table: ${lookup}`); 43185 } 43186 } 43187 43188 getRgbItem(src, srcOffset, dest, destOffset) { 43189 const numComps = this.base.numComps; 43190 const start = src[srcOffset] * numComps; 43191 this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0); 43192 } 43193 43194 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 43195 const base = this.base; 43196 const numComps = base.numComps; 43197 const outputDelta = base.getOutputLength(numComps, alpha01); 43198 const lookup = this.lookup; 43199 43200 for (let i = 0; i < count; ++i) { 43201 const lookupPos = src[srcOffset++] * numComps; 43202 base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01); 43203 destOffset += outputDelta; 43204 } 43205 } 43206 43207 getOutputLength(inputLength, alpha01) { 43208 return this.base.getOutputLength(inputLength * this.base.numComps, alpha01); 43209 } 43210 43211 isDefaultDecode(decodeMap, bpc) { 43212 if (!Array.isArray(decodeMap)) { 43213 return true; 43214 } 43215 43216 if (decodeMap.length !== 2) { 43217 (0, _util.warn)("Decode map length is not correct"); 43218 return true; 43219 } 43220 43221 if (!Number.isInteger(bpc) || bpc < 1) { 43222 (0, _util.warn)("Bits per component is not correct"); 43223 return true; 43224 } 43225 43226 return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1; 43227 } 43228 43229} 43230 43231class DeviceGrayCS extends ColorSpace { 43232 constructor() { 43233 super("DeviceGray", 1); 43234 } 43235 43236 getRgbItem(src, srcOffset, dest, destOffset) { 43237 const c = src[srcOffset] * 255; 43238 dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c; 43239 } 43240 43241 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 43242 const scale = 255 / ((1 << bits) - 1); 43243 let j = srcOffset, 43244 q = destOffset; 43245 43246 for (let i = 0; i < count; ++i) { 43247 const c = scale * src[j++]; 43248 dest[q++] = c; 43249 dest[q++] = c; 43250 dest[q++] = c; 43251 q += alpha01; 43252 } 43253 } 43254 43255 getOutputLength(inputLength, alpha01) { 43256 return inputLength * (3 + alpha01); 43257 } 43258 43259} 43260 43261class DeviceRgbCS extends ColorSpace { 43262 constructor() { 43263 super("DeviceRGB", 3); 43264 } 43265 43266 getRgbItem(src, srcOffset, dest, destOffset) { 43267 dest[destOffset] = src[srcOffset] * 255; 43268 dest[destOffset + 1] = src[srcOffset + 1] * 255; 43269 dest[destOffset + 2] = src[srcOffset + 2] * 255; 43270 } 43271 43272 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 43273 if (bits === 8 && alpha01 === 0) { 43274 dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset); 43275 return; 43276 } 43277 43278 const scale = 255 / ((1 << bits) - 1); 43279 let j = srcOffset, 43280 q = destOffset; 43281 43282 for (let i = 0; i < count; ++i) { 43283 dest[q++] = scale * src[j++]; 43284 dest[q++] = scale * src[j++]; 43285 dest[q++] = scale * src[j++]; 43286 q += alpha01; 43287 } 43288 } 43289 43290 getOutputLength(inputLength, alpha01) { 43291 return inputLength * (3 + alpha01) / 3 | 0; 43292 } 43293 43294 isPassthrough(bits) { 43295 return bits === 8; 43296 } 43297 43298} 43299 43300const DeviceCmykCS = function DeviceCmykCSClosure() { 43301 function convertToRgb(src, srcOffset, srcScale, dest, destOffset) { 43302 const c = src[srcOffset] * srcScale; 43303 const m = src[srcOffset + 1] * srcScale; 43304 const y = src[srcOffset + 2] * srcScale; 43305 const k = src[srcOffset + 3] * srcScale; 43306 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); 43307 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); 43308 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); 43309 } 43310 43311 class DeviceCmykCS extends ColorSpace { 43312 constructor() { 43313 super("DeviceCMYK", 4); 43314 } 43315 43316 getRgbItem(src, srcOffset, dest, destOffset) { 43317 convertToRgb(src, srcOffset, 1, dest, destOffset); 43318 } 43319 43320 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 43321 const scale = 1 / ((1 << bits) - 1); 43322 43323 for (let i = 0; i < count; i++) { 43324 convertToRgb(src, srcOffset, scale, dest, destOffset); 43325 srcOffset += 4; 43326 destOffset += 3 + alpha01; 43327 } 43328 } 43329 43330 getOutputLength(inputLength, alpha01) { 43331 return inputLength / 4 * (3 + alpha01) | 0; 43332 } 43333 43334 } 43335 43336 return DeviceCmykCS; 43337}(); 43338 43339const CalGrayCS = function CalGrayCSClosure() { 43340 function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) { 43341 const A = src[srcOffset] * scale; 43342 const AG = A ** cs.G; 43343 const L = cs.YW * AG; 43344 const val = Math.max(295.8 * L ** 0.333333333333333333 - 40.8, 0); 43345 dest[destOffset] = val; 43346 dest[destOffset + 1] = val; 43347 dest[destOffset + 2] = val; 43348 } 43349 43350 class CalGrayCS extends ColorSpace { 43351 constructor(whitePoint, blackPoint, gamma) { 43352 super("CalGray", 1); 43353 43354 if (!whitePoint) { 43355 throw new _util.FormatError("WhitePoint missing - required for color space CalGray"); 43356 } 43357 43358 blackPoint = blackPoint || [0, 0, 0]; 43359 gamma = gamma || 1; 43360 this.XW = whitePoint[0]; 43361 this.YW = whitePoint[1]; 43362 this.ZW = whitePoint[2]; 43363 this.XB = blackPoint[0]; 43364 this.YB = blackPoint[1]; 43365 this.ZB = blackPoint[2]; 43366 this.G = gamma; 43367 43368 if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) { 43369 throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available"); 43370 } 43371 43372 if (this.XB < 0 || this.YB < 0 || this.ZB < 0) { 43373 (0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`); 43374 this.XB = this.YB = this.ZB = 0; 43375 } 43376 43377 if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) { 43378 (0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`); 43379 } 43380 43381 if (this.G < 1) { 43382 (0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, ` + "falling back to default."); 43383 this.G = 1; 43384 } 43385 } 43386 43387 getRgbItem(src, srcOffset, dest, destOffset) { 43388 convertToRgb(this, src, srcOffset, dest, destOffset, 1); 43389 } 43390 43391 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 43392 const scale = 1 / ((1 << bits) - 1); 43393 43394 for (let i = 0; i < count; ++i) { 43395 convertToRgb(this, src, srcOffset, dest, destOffset, scale); 43396 srcOffset += 1; 43397 destOffset += 3 + alpha01; 43398 } 43399 } 43400 43401 getOutputLength(inputLength, alpha01) { 43402 return inputLength * (3 + alpha01); 43403 } 43404 43405 } 43406 43407 return CalGrayCS; 43408}(); 43409 43410const CalRGBCS = function CalRGBCSClosure() { 43411 const BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]); 43412 const BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([0.9869929, -0.1470543, 0.1599627, 0.4323053, 0.5183603, 0.0492912, -0.0085287, 0.0400428, 0.9684867]); 43413 const 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]); 43414 const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]); 43415 const tempNormalizeMatrix = new Float32Array(3); 43416 const tempConvertMatrix1 = new Float32Array(3); 43417 const tempConvertMatrix2 = new Float32Array(3); 43418 const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0; 43419 43420 function matrixProduct(a, b, result) { 43421 result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; 43422 result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2]; 43423 result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2]; 43424 } 43425 43426 function convertToFlat(sourceWhitePoint, LMS, result) { 43427 result[0] = LMS[0] * 1 / sourceWhitePoint[0]; 43428 result[1] = LMS[1] * 1 / sourceWhitePoint[1]; 43429 result[2] = LMS[2] * 1 / sourceWhitePoint[2]; 43430 } 43431 43432 function convertToD65(sourceWhitePoint, LMS, result) { 43433 const D65X = 0.95047; 43434 const D65Y = 1; 43435 const D65Z = 1.08883; 43436 result[0] = LMS[0] * D65X / sourceWhitePoint[0]; 43437 result[1] = LMS[1] * D65Y / sourceWhitePoint[1]; 43438 result[2] = LMS[2] * D65Z / sourceWhitePoint[2]; 43439 } 43440 43441 function sRGBTransferFunction(color) { 43442 if (color <= 0.0031308) { 43443 return adjustToRange(0, 1, 12.92 * color); 43444 } 43445 43446 return adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055); 43447 } 43448 43449 function adjustToRange(min, max, value) { 43450 return Math.max(min, Math.min(max, value)); 43451 } 43452 43453 function decodeL(L) { 43454 if (L < 0) { 43455 return -decodeL(-L); 43456 } 43457 43458 if (L > 8.0) { 43459 return ((L + 16) / 116) ** 3; 43460 } 43461 43462 return L * DECODE_L_CONSTANT; 43463 } 43464 43465 function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) { 43466 if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) { 43467 result[0] = XYZ_Flat[0]; 43468 result[1] = XYZ_Flat[1]; 43469 result[2] = XYZ_Flat[2]; 43470 return; 43471 } 43472 43473 const zeroDecodeL = decodeL(0); 43474 const X_DST = zeroDecodeL; 43475 const X_SRC = decodeL(sourceBlackPoint[0]); 43476 const Y_DST = zeroDecodeL; 43477 const Y_SRC = decodeL(sourceBlackPoint[1]); 43478 const Z_DST = zeroDecodeL; 43479 const Z_SRC = decodeL(sourceBlackPoint[2]); 43480 const X_Scale = (1 - X_DST) / (1 - X_SRC); 43481 const X_Offset = 1 - X_Scale; 43482 const Y_Scale = (1 - Y_DST) / (1 - Y_SRC); 43483 const Y_Offset = 1 - Y_Scale; 43484 const Z_Scale = (1 - Z_DST) / (1 - Z_SRC); 43485 const Z_Offset = 1 - Z_Scale; 43486 result[0] = XYZ_Flat[0] * X_Scale + X_Offset; 43487 result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset; 43488 result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset; 43489 } 43490 43491 function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) { 43492 if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) { 43493 result[0] = XYZ_In[0]; 43494 result[1] = XYZ_In[1]; 43495 result[2] = XYZ_In[2]; 43496 return; 43497 } 43498 43499 const LMS = result; 43500 matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS); 43501 const LMS_Flat = tempNormalizeMatrix; 43502 convertToFlat(sourceWhitePoint, LMS, LMS_Flat); 43503 matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result); 43504 } 43505 43506 function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) { 43507 const LMS = result; 43508 matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS); 43509 const LMS_D65 = tempNormalizeMatrix; 43510 convertToD65(sourceWhitePoint, LMS, LMS_D65); 43511 matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result); 43512 } 43513 43514 function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) { 43515 const A = adjustToRange(0, 1, src[srcOffset] * scale); 43516 const B = adjustToRange(0, 1, src[srcOffset + 1] * scale); 43517 const C = adjustToRange(0, 1, src[srcOffset + 2] * scale); 43518 const AGR = A ** cs.GR; 43519 const BGG = B ** cs.GG; 43520 const CGB = C ** cs.GB; 43521 const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB; 43522 const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB; 43523 const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB; 43524 const XYZ = tempConvertMatrix1; 43525 XYZ[0] = X; 43526 XYZ[1] = Y; 43527 XYZ[2] = Z; 43528 const XYZ_Flat = tempConvertMatrix2; 43529 normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat); 43530 const XYZ_Black = tempConvertMatrix1; 43531 compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black); 43532 const XYZ_D65 = tempConvertMatrix2; 43533 normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65); 43534 const SRGB = tempConvertMatrix1; 43535 matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB); 43536 dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255; 43537 dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255; 43538 dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255; 43539 } 43540 43541 class CalRGBCS extends ColorSpace { 43542 constructor(whitePoint, blackPoint, gamma, matrix) { 43543 super("CalRGB", 3); 43544 43545 if (!whitePoint) { 43546 throw new _util.FormatError("WhitePoint missing - required for color space CalRGB"); 43547 } 43548 43549 blackPoint = blackPoint || new Float32Array(3); 43550 gamma = gamma || new Float32Array([1, 1, 1]); 43551 matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]); 43552 const XW = whitePoint[0]; 43553 const YW = whitePoint[1]; 43554 const ZW = whitePoint[2]; 43555 this.whitePoint = whitePoint; 43556 const XB = blackPoint[0]; 43557 const YB = blackPoint[1]; 43558 const ZB = blackPoint[2]; 43559 this.blackPoint = blackPoint; 43560 this.GR = gamma[0]; 43561 this.GG = gamma[1]; 43562 this.GB = gamma[2]; 43563 this.MXA = matrix[0]; 43564 this.MYA = matrix[1]; 43565 this.MZA = matrix[2]; 43566 this.MXB = matrix[3]; 43567 this.MYB = matrix[4]; 43568 this.MZB = matrix[5]; 43569 this.MXC = matrix[6]; 43570 this.MYC = matrix[7]; 43571 this.MZC = matrix[8]; 43572 43573 if (XW < 0 || ZW < 0 || YW !== 1) { 43574 throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available"); 43575 } 43576 43577 if (XB < 0 || YB < 0 || ZB < 0) { 43578 (0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default."); 43579 this.blackPoint = new Float32Array(3); 43580 } 43581 43582 if (this.GR < 0 || this.GG < 0 || this.GB < 0) { 43583 (0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`); 43584 this.GR = this.GG = this.GB = 1; 43585 } 43586 } 43587 43588 getRgbItem(src, srcOffset, dest, destOffset) { 43589 convertToRgb(this, src, srcOffset, dest, destOffset, 1); 43590 } 43591 43592 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 43593 const scale = 1 / ((1 << bits) - 1); 43594 43595 for (let i = 0; i < count; ++i) { 43596 convertToRgb(this, src, srcOffset, dest, destOffset, scale); 43597 srcOffset += 3; 43598 destOffset += 3 + alpha01; 43599 } 43600 } 43601 43602 getOutputLength(inputLength, alpha01) { 43603 return inputLength * (3 + alpha01) / 3 | 0; 43604 } 43605 43606 } 43607 43608 return CalRGBCS; 43609}(); 43610 43611const LabCS = function LabCSClosure() { 43612 function fn_g(x) { 43613 let result; 43614 43615 if (x >= 6 / 29) { 43616 result = x * x * x; 43617 } else { 43618 result = 108 / 841 * (x - 4 / 29); 43619 } 43620 43621 return result; 43622 } 43623 43624 function decode(value, high1, low2, high2) { 43625 return low2 + value * (high2 - low2) / high1; 43626 } 43627 43628 function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) { 43629 let Ls = src[srcOffset]; 43630 let as = src[srcOffset + 1]; 43631 let bs = src[srcOffset + 2]; 43632 43633 if (maxVal !== false) { 43634 Ls = decode(Ls, maxVal, 0, 100); 43635 as = decode(as, maxVal, cs.amin, cs.amax); 43636 bs = decode(bs, maxVal, cs.bmin, cs.bmax); 43637 } 43638 43639 if (as > cs.amax) { 43640 as = cs.amax; 43641 } else if (as < cs.amin) { 43642 as = cs.amin; 43643 } 43644 43645 if (bs > cs.bmax) { 43646 bs = cs.bmax; 43647 } else if (bs < cs.bmin) { 43648 bs = cs.bmin; 43649 } 43650 43651 const M = (Ls + 16) / 116; 43652 const L = M + as / 500; 43653 const N = M - bs / 200; 43654 const X = cs.XW * fn_g(L); 43655 const Y = cs.YW * fn_g(M); 43656 const Z = cs.ZW * fn_g(N); 43657 let r, g, b; 43658 43659 if (cs.ZW < 1) { 43660 r = X * 3.1339 + Y * -1.617 + Z * -0.4906; 43661 g = X * -0.9785 + Y * 1.916 + Z * 0.0333; 43662 b = X * 0.072 + Y * -0.229 + Z * 1.4057; 43663 } else { 43664 r = X * 3.2406 + Y * -1.5372 + Z * -0.4986; 43665 g = X * -0.9689 + Y * 1.8758 + Z * 0.0415; 43666 b = X * 0.0557 + Y * -0.204 + Z * 1.057; 43667 } 43668 43669 dest[destOffset] = Math.sqrt(r) * 255; 43670 dest[destOffset + 1] = Math.sqrt(g) * 255; 43671 dest[destOffset + 2] = Math.sqrt(b) * 255; 43672 } 43673 43674 class LabCS extends ColorSpace { 43675 constructor(whitePoint, blackPoint, range) { 43676 super("Lab", 3); 43677 43678 if (!whitePoint) { 43679 throw new _util.FormatError("WhitePoint missing - required for color space Lab"); 43680 } 43681 43682 blackPoint = blackPoint || [0, 0, 0]; 43683 range = range || [-100, 100, -100, 100]; 43684 this.XW = whitePoint[0]; 43685 this.YW = whitePoint[1]; 43686 this.ZW = whitePoint[2]; 43687 this.amin = range[0]; 43688 this.amax = range[1]; 43689 this.bmin = range[2]; 43690 this.bmax = range[3]; 43691 this.XB = blackPoint[0]; 43692 this.YB = blackPoint[1]; 43693 this.ZB = blackPoint[2]; 43694 43695 if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) { 43696 throw new _util.FormatError("Invalid WhitePoint components, no fallback available"); 43697 } 43698 43699 if (this.XB < 0 || this.YB < 0 || this.ZB < 0) { 43700 (0, _util.info)("Invalid BlackPoint, falling back to default"); 43701 this.XB = this.YB = this.ZB = 0; 43702 } 43703 43704 if (this.amin > this.amax || this.bmin > this.bmax) { 43705 (0, _util.info)("Invalid Range, falling back to defaults"); 43706 this.amin = -100; 43707 this.amax = 100; 43708 this.bmin = -100; 43709 this.bmax = 100; 43710 } 43711 } 43712
43713 getRgbItem(src, srcOffset, dest, destOffset) { 43714 convertToRgb(this, src, srcOffset, false, dest, destOffset); 43715 } 43716 43717 getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) { 43718 const maxVal = (1 << bits) - 1; 43719 43720 for (let i = 0; i < count; i++) { 43721 convertToRgb(this, src, srcOffset, maxVal, dest, destOffset); 43722 srcOffset += 3; 43723 destOffset += 3 + alpha01; 43724 } 43725 } 43726 43727 getOutputLength(inputLength, alpha01) { 43728 return inputLength * (3 + alpha01) / 3 | 0; 43729 } 43730 43731 isDefaultDecode(decodeMap, bpc) { 43732 return true; 43733 } 43734 43735 get usesZeroToOneRange() { 43736 return (0, _util.shadow)(this, "usesZeroToOneRange", false); 43737 } 43738 43739 } 43740 43741 return LabCS; 43742}(); 43743 43744/***/ }), 43745/* 23 */ 43746/***/ (function(module, exports, __w_pdfjs_require__) { 43747 43748"use strict"; 43749 43750 43751Object.defineProperty(exports, "__esModule", { 43752 value: true 43753}); 43754exports.getQuadPoints = getQuadPoints; 43755exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0; 43756 43757var _util = __w_pdfjs_require__(2); 43758 43759var _obj = __w_pdfjs_require__(9); 43760 43761var _primitives = __w_pdfjs_require__(4); 43762 43763var _colorspace = __w_pdfjs_require__(22); 43764 43765var _core_utils = __w_pdfjs_require__(7); 43766 43767var _operator_list = __w_pdfjs_require__(24); 43768 43769var _stream = __w_pdfjs_require__(11); 43770 43771class AnnotationFactory { 43772 static create(xref, ref, pdfManager, idFactory) { 43773 return pdfManager.ensure(this, "_create", [xref, ref, pdfManager, idFactory]); 43774 } 43775 43776 static _create(xref, ref, pdfManager, idFactory) { 43777 const dict = xref.fetchIfRef(ref); 43778 43779 if (!(0, _primitives.isDict)(dict)) { 43780 return undefined; 43781 } 43782 43783 const id = (0, _primitives.isRef)(ref) ? ref.toString() : `annot_${idFactory.createObjId()}`; 43784 let subtype = dict.get("Subtype"); 43785 subtype = (0, _primitives.isName)(subtype) ? subtype.name : null; 43786 const parameters = { 43787 xref, 43788 dict, 43789 subtype, 43790 id, 43791 pdfManager 43792 }; 43793 43794 switch (subtype) { 43795 case "Link": 43796 return new LinkAnnotation(parameters); 43797 43798 case "Text": 43799 return new TextAnnotation(parameters); 43800 43801 case "Widget": 43802 let fieldType = (0, _core_utils.getInheritableProperty)({ 43803 dict, 43804 key: "FT" 43805 }); 43806 fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null; 43807 43808 switch (fieldType) { 43809 case "Tx": 43810 return new TextWidgetAnnotation(parameters); 43811 43812 case "Btn": 43813 return new ButtonWidgetAnnotation(parameters); 43814 43815 case "Ch": 43816 return new ChoiceWidgetAnnotation(parameters); 43817 } 43818 43819 (0, _util.warn)('Unimplemented widget field type "' + fieldType + '", ' + "falling back to base field type."); 43820 return new WidgetAnnotation(parameters); 43821 43822 case "Popup": 43823 return new PopupAnnotation(parameters); 43824 43825 case "FreeText": 43826 return new FreeTextAnnotation(parameters); 43827 43828 case "Line": 43829 return new LineAnnotation(parameters); 43830 43831 case "Square": 43832 return new SquareAnnotation(parameters); 43833 43834 case "Circle": 43835 return new CircleAnnotation(parameters); 43836 43837 case "PolyLine": 43838 return new PolylineAnnotation(parameters); 43839 43840 case "Polygon": 43841 return new PolygonAnnotation(parameters); 43842 43843 case "Caret": 43844 return new CaretAnnotation(parameters); 43845 43846 case "Ink": 43847 return new InkAnnotation(parameters); 43848 43849 case "Highlight": 43850 return new HighlightAnnotation(parameters); 43851 43852 case "Underline": 43853 return new UnderlineAnnotation(parameters); 43854 43855 case "Squiggly": 43856 return new SquigglyAnnotation(parameters); 43857 43858 case "StrikeOut": 43859 return new StrikeOutAnnotation(parameters); 43860 43861 case "Stamp": 43862 return new StampAnnotation(parameters); 43863 43864 case "FileAttachment": 43865 return new FileAttachmentAnnotation(parameters); 43866 43867 default: 43868 if (!subtype) { 43869 (0, _util.warn)("Annotation is missing the required /Subtype."); 43870 } else { 43871 (0, _util.warn)('Unimplemented annotation type "' + subtype + '", ' + "falling back to base annotation."); 43872 } 43873 43874 return new Annotation(parameters); 43875 } 43876 } 43877 43878} 43879 43880exports.AnnotationFactory = AnnotationFactory; 43881 43882function getQuadPoints(dict, rect) { 43883 if (!dict.has("QuadPoints")) { 43884 return null; 43885 } 43886 43887 const quadPoints = dict.getArray("QuadPoints"); 43888 43889 if (!Array.isArray(quadPoints) || quadPoints.length % 8 > 0) { 43890 return null; 43891 } 43892 43893 const quadPointsLists = []; 43894 43895 for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) { 43896 quadPointsLists.push([]); 43897 43898 for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) { 43899 const x = quadPoints[j]; 43900 const y = quadPoints[j + 1]; 43901 43902 if (x < rect[0] || x > rect[2] || y < rect[1] || y > rect[3]) { 43903 return null; 43904 } 43905 43906 quadPointsLists[i].push({ 43907 x, 43908 y 43909 }); 43910 } 43911 } 43912 43913 return quadPointsLists; 43914} 43915 43916function getTransformMatrix(rect, bbox, matrix) { 43917 const [minX, minY, maxX, maxY] = _util.Util.getAxialAlignedBoundingBox(bbox, matrix); 43918 43919 if (minX === maxX || minY === maxY) { 43920 return [1, 0, 0, 1, rect[0], rect[1]]; 43921 } 43922 43923 const xRatio = (rect[2] - rect[0]) / (maxX - minX);
43924 const yRatio = (rect[3] - rect[1]) / (maxY - minY); 43925 return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio]; 43926} 43927 43928class Annotation { 43929 constructor(params) { 43930 const dict = params.dict; 43931 this.setContents(dict.get("Contents")); 43932 this.setModificationDate(dict.get("M")); 43933 this.setFlags(dict.get("F")); 43934 this.setRectangle(dict.getArray("Rect")); 43935 this.setColor(dict.getArray("C")); 43936 this.setBorderStyle(dict); 43937 this.setAppearance(dict); 43938 this.data = { 43939 annotationFlags: this.flags, 43940 borderStyle: this.borderStyle, 43941 color: this.color, 43942 contents: this.contents, 43943 hasAppearance: !!this.appearance, 43944 id: params.id, 43945 modificationDate: this.modificationDate, 43946 rect: this.rectangle, 43947 subtype: params.subtype 43948 }; 43949 } 43950 43951 _hasFlag(flags, flag) { 43952 return !!(flags & flag); 43953 } 43954 43955 _isViewable(flags) { 43956 return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.HIDDEN) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW); 43957 } 43958 43959 _isPrintable(flags) { 43960 return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.HIDDEN); 43961 } 43962 43963 get viewable() { 43964 if (this.flags === 0) { 43965 return true; 43966 } 43967 43968 return this._isViewable(this.flags); 43969 } 43970 43971 get printable() { 43972 if (this.flags === 0) { 43973 return false; 43974 } 43975 43976 return this._isPrintable(this.flags); 43977 } 43978 43979 setContents(contents) { 43980 this.contents = (0, _util.stringToPDFString)(contents || ""); 43981 } 43982 43983 setModificationDate(modificationDate) { 43984 this.modificationDate = (0, _util.isString)(modificationDate) ? modificationDate : null; 43985 } 43986 43987 setFlags(flags) { 43988 this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0; 43989 } 43990 43991 hasFlag(flag) { 43992 return this._hasFlag(this.flags, flag); 43993 } 43994 43995 setRectangle(rectangle) { 43996 if (Array.isArray(rectangle) && rectangle.length === 4) { 43997 this.rectangle = _util.Util.normalizeRect(rectangle); 43998 } else { 43999 this.rectangle = [0, 0, 0, 0]; 44000 } 44001 } 44002 44003 setColor(color) { 44004 const rgbColor = new Uint8ClampedArray(3); 44005 44006 if (!Array.isArray(color)) { 44007 this.color = rgbColor; 44008 return; 44009 } 44010 44011 switch (color.length) { 44012 case 0: 44013 this.color = null; 44014 break; 44015 44016 case 1: 44017 _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0); 44018 44019 this.color = rgbColor; 44020 break; 44021 44022 case 3: 44023 _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0); 44024 44025 this.color = rgbColor; 44026 break; 44027 44028 case 4: 44029 _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0); 44030 44031 this.color = rgbColor; 44032 break; 44033 44034 default: 44035 this.color = rgbColor; 44036 break; 44037 } 44038 } 44039 44040 setBorderStyle(borderStyle) { 44041 this.borderStyle = new AnnotationBorderStyle(); 44042 44043 if (!(0, _primitives.isDict)(borderStyle)) { 44044 return; 44045 } 44046 44047 if (borderStyle.has("BS")) { 44048 const dict = borderStyle.get("BS"); 44049 const dictType = dict.get("Type"); 44050 44051 if (!dictType || (0, _primitives.isName)(dictType, "Border")) { 44052 this.borderStyle.setWidth(dict.get("W"), this.rectangle); 44053 this.borderStyle.setStyle(dict.get("S")); 44054 this.borderStyle.setDashArray(dict.getArray("D")); 44055 } 44056 } else if (borderStyle.has("Border")) { 44057 const array = borderStyle.getArray("Border"); 44058 44059 if (Array.isArray(array) && array.length >= 3) { 44060 this.borderStyle.setHorizontalCornerRadius(array[0]); 44061 this.borderStyle.setVerticalCornerRadius(array[1]); 44062 this.borderStyle.setWidth(array[2], this.rectangle); 44063 44064 if (array.length === 4) { 44065 this.borderStyle.setDashArray(array[3]); 44066 } 44067 } 44068 } else { 44069 this.borderStyle.setWidth(0); 44070 } 44071 } 44072 44073 setAppearance(dict) { 44074 this.appearance = null; 44075 const appearanceStates = dict.get("AP"); 44076 44077 if (!(0, _primitives.isDict)(appearanceStates)) { 44078 return; 44079 } 44080 44081 const normalAppearanceState = appearanceStates.get("N"); 44082 44083 if ((0, _primitives.isStream)(normalAppearanceState)) { 44084 this.appearance = normalAppearanceState; 44085 return; 44086 } 44087 44088 if (!(0, _primitives.isDict)(normalAppearanceState)) { 44089 return; 44090 } 44091 44092 const as = dict.get("AS"); 44093 44094 if (!(0, _primitives.isName)(as) || !normalAppearanceState.has(as.name)) { 44095 return; 44096 } 44097 44098 this.appearance = normalAppearanceState.get(as.name); 44099 } 44100 44101 loadResources(keys) { 44102 return this.appearance.dict.getAsync("Resources").then(resources => { 44103 if (!resources) { 44104 return undefined; 44105 } 44106 44107 const objectLoader = new _obj.ObjectLoader(resources, keys, resources.xref); 44108 return objectLoader.load().then(function () { 44109 return resources; 44110 }); 44111 }); 44112 } 44113 44114 getOperatorList(evaluator, task, renderForms) { 44115 if (!this.appearance) { 44116 return Promise.resolve(new _operator_list.OperatorList()); 44117 } 44118 44119 const data = this.data; 44120 const appearanceDict = this.appearance.dict; 44121 const resourcesPromise = this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"]); 44122 const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1]; 44123 const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0]; 44124 const transform = getTransformMatrix(data.rect, bbox, matrix); 44125 return resourcesPromise.then(resources => { 44126 const opList = new _operator_list.OperatorList(); 44127 opList.addOp(_util.OPS.beginAnnotation, [data.rect, transform, matrix]); 44128 return evaluator.getOperatorList({ 44129 stream: this.appearance, 44130 task, 44131 resources, 44132 operatorList: opList 44133 }).then(() => { 44134 opList.addOp(_util.OPS.endAnnotation, []); 44135 this.appearance.reset(); 44136 return opList; 44137 }); 44138 }); 44139 } 44140 44141} 44142 44143exports.Annotation = Annotation; 44144 44145class AnnotationBorderStyle { 44146 constructor() { 44147 this.width = 1; 44148 this.style = _util.AnnotationBorderStyleType.SOLID; 44149 this.dashArray = [3]; 44150 this.horizontalCornerRadius = 0; 44151 this.verticalCornerRadius = 0; 44152 } 44153 44154 setWidth(width, rect = [0, 0, 0, 0]) { 44155 if ((0, _primitives.isName)(width)) { 44156 this.width = 0; 44157 return; 44158 } 44159 44160 if (Number.isInteger(width)) { 44161 if (width > 0) { 44162 const maxWidth = (rect[2] - rect[0]) / 2; 44163 const maxHeight = (rect[3] - rect[1]) / 2; 44164 44165 if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) { 44166 (0, _util.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`); 44167 width = 1; 44168 } 44169 } 44170 44171 this.width = width; 44172 } 44173 } 44174 44175 setStyle(style) { 44176 if (!(0, _primitives.isName)(style)) { 44177 return; 44178 } 44179 44180 switch (style.name) { 44181 case "S": 44182 this.style = _util.AnnotationBorderStyleType.SOLID; 44183 break; 44184 44185 case "D": 44186 this.style = _util.AnnotationBorderStyleType.DASHED; 44187 break; 44188 44189 case "B": 44190 this.style = _util.AnnotationBorderStyleType.BEVELED; 44191 break; 44192 44193 case "I": 44194 this.style = _util.AnnotationBorderStyleType.INSET; 44195 break; 44196 44197 case "U": 44198 this.style = _util.AnnotationBorderStyleType.UNDERLINE; 44199 break; 44200 44201 default: 44202 break; 44203 } 44204 } 44205 44206 setDashArray(dashArray) { 44207 if (Array.isArray(dashArray) && dashArray.length > 0) { 44208 let isValid = true; 44209 let allZeros = true; 44210 44211 for (const element of dashArray) { 44212 const validNumber = +element >= 0; 44213 44214 if (!validNumber) { 44215 isValid = false;
44216 break; 44217 } else if (element > 0) { 44218 allZeros = false; 44219 } 44220 } 44221 44222 if (isValid && !allZeros) { 44223 this.dashArray = dashArray; 44224 } else { 44225 this.width = 0; 44226 } 44227 } else if (dashArray) { 44228 this.width = 0; 44229 } 44230 } 44231 44232 setHorizontalCornerRadius(radius) { 44233 if (Number.isInteger(radius)) { 44234 this.horizontalCornerRadius = radius; 44235 } 44236 } 44237 44238 setVerticalCornerRadius(radius) { 44239 if (Number.isInteger(radius)) { 44240 this.verticalCornerRadius = radius; 44241 } 44242 } 44243 44244} 44245 44246exports.AnnotationBorderStyle = AnnotationBorderStyle; 44247 44248class MarkupAnnotation extends Annotation { 44249 constructor(parameters) { 44250 super(parameters); 44251 const dict = parameters.dict; 44252 44253 if (dict.has("IRT")) { 44254 const rawIRT = dict.getRaw("IRT"); 44255 this.data.inReplyTo = (0, _primitives.isRef)(rawIRT) ? rawIRT.toString() : null; 44256 const rt = dict.get("RT"); 44257 this.data.replyType = (0, _primitives.isName)(rt) ? rt.name : _util.AnnotationReplyType.REPLY; 44258 } 44259 44260 if (this.data.replyType === _util.AnnotationReplyType.GROUP) { 44261 const parent = dict.get("IRT"); 44262 this.data.title = (0, _util.stringToPDFString)(parent.get("T") || ""); 44263 this.setContents(parent.get("Contents")); 44264 this.data.contents = this.contents; 44265 44266 if (!parent.has("CreationDate")) { 44267 this.data.creationDate = null; 44268 } else { 44269 this.setCreationDate(parent.get("CreationDate")); 44270 this.data.creationDate = this.creationDate; 44271 } 44272 44273 if (!parent.has("M")) { 44274 this.data.modificationDate = null; 44275 } else { 44276 this.setModificationDate(parent.get("M")); 44277 this.data.modificationDate = this.modificationDate; 44278 } 44279 44280 this.data.hasPopup = parent.has("Popup"); 44281 44282 if (!parent.has("C")) { 44283 this.data.color = null; 44284 } else { 44285 this.setColor(parent.getArray("C")); 44286 this.data.color = this.color; 44287 } 44288 } else { 44289 this.data.title = (0, _util.stringToPDFString)(dict.get("T") || ""); 44290 this.setCreationDate(dict.get("CreationDate")); 44291 this.data.creationDate = this.creationDate; 44292 this.data.hasPopup = dict.has("Popup"); 44293 44294 if (!dict.has("C")) { 44295 this.data.color = null; 44296 } 44297 } 44298 } 44299 44300 setCreationDate(creationDate) { 44301 this.creationDate = (0, _util.isString)(creationDate) ? creationDate : null; 44302 } 44303 44304} 44305 44306exports.MarkupAnnotation = MarkupAnnotation; 44307 44308class WidgetAnnotation extends Annotation { 44309 constructor(params) { 44310 super(params); 44311 const dict = params.dict; 44312 const data = this.data; 44313 data.annotationType = _util.AnnotationType.WIDGET; 44314 data.fieldName = this._constructFieldName(dict); 44315 data.fieldValue = (0, _core_utils.getInheritableProperty)({ 44316 dict, 44317 key: "V", 44318 getArray: true 44319 }); 44320 data.alternativeText = (0, _util.stringToPDFString)(dict.get("TU") || ""); 44321 data.defaultAppearance = (0, _core_utils.getInheritableProperty)({ 44322 dict, 44323 key: "DA" 44324 }) || ""; 44325 const fieldType = (0, _core_utils.getInheritableProperty)({ 44326 dict, 44327 key: "FT" 44328 }); 44329 data.fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null; 44330 this.fieldResources = (0, _core_utils.getInheritableProperty)({ 44331 dict, 44332 key: "DR" 44333 }) || _primitives.Dict.empty; 44334 data.fieldFlags = (0, _core_utils.getInheritableProperty)({ 44335 dict, 44336 key: "Ff" 44337 }); 44338 44339 if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) { 44340 data.fieldFlags = 0; 44341 } 44342 44343 data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY); 44344 44345 if (data.fieldType === "Sig") { 44346 data.fieldValue = null; 44347 this.setFlags(_util.AnnotationFlag.HIDDEN); 44348 } 44349 } 44350 44351 _constructFieldName(dict) { 44352 if (!dict.has("T") && !dict.has("Parent")) { 44353 (0, _util.warn)("Unknown field name, falling back to empty field name."); 44354 return ""; 44355 } 44356 44357 if (!dict.has("Parent")) { 44358 return (0, _util.stringToPDFString)(dict.get("T")); 44359 } 44360 44361 const fieldName = []; 44362 44363 if (dict.has("T")) { 44364 fieldName.unshift((0, _util.stringToPDFString)(dict.get("T"))); 44365 } 44366 44367 let loopDict = dict; 44368 44369 while (loopDict.has("Parent")) { 44370 loopDict = loopDict.get("Parent"); 44371 44372 if (!(0, _primitives.isDict)(loopDict)) { 44373 break; 44374 } 44375 44376 if (loopDict.has("T")) { 44377 fieldName.unshift((0, _util.stringToPDFString)(loopDict.get("T"))); 44378 } 44379 } 44380 44381 return fieldName.join("."); 44382 } 44383 44384 hasFieldFlag(flag) { 44385 return !!(this.data.fieldFlags & flag); 44386 } 44387 44388 getOperatorList(evaluator, task, renderForms) { 44389 if (renderForms) { 44390 return Promise.resolve(new _operator_list.OperatorList()); 44391 } 44392 44393 return super.getOperatorList(evaluator, task, renderForms); 44394 } 44395 44396} 44397 44398class TextWidgetAnnotation extends WidgetAnnotation { 44399 constructor(params) { 44400 super(params); 44401 const dict = params.dict; 44402 this.data.fieldValue = (0, _util.stringToPDFString)(this.data.fieldValue || ""); 44403 let alignment = (0, _core_utils.getInheritableProperty)({ 44404 dict, 44405 key: "Q" 44406 }); 44407 44408 if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) { 44409 alignment = null; 44410 } 44411 44412 this.data.textAlignment = alignment; 44413 let maximumLength = (0, _core_utils.getInheritableProperty)({ 44414 dict, 44415 key: "MaxLen" 44416 }); 44417 44418 if (!Number.isInteger(maximumLength) || maximumLength < 0) { 44419 maximumLength = null; 44420 } 44421 44422 this.data.maxLen = maximumLength; 44423 this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE); 44424 this.data.comb = this.hasFieldFlag(_util.AnnotationFieldFlag.COMB) && !this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD) && !this.hasFieldFlag(_util.AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== null; 44425 } 44426 44427 getOperatorList(evaluator, task, renderForms) { 44428 if (renderForms || this.appearance) { 44429 return super.getOperatorList(evaluator, task, renderForms); 44430 } 44431 44432 const operatorList = new _operator_list.OperatorList(); 44433 44434 if (!this.data.defaultAppearance) { 44435 return Promise.resolve(operatorList); 44436 } 44437 44438 const stream = new _stream.Stream((0, _util.stringToBytes)(this.data.defaultAppearance)); 44439 return evaluator.getOperatorList({ 44440 stream, 44441 task, 44442 resources: this.fieldResources, 44443 operatorList 44444 }).then(function () { 44445 return operatorList; 44446 }); 44447 } 44448 44449} 44450 44451class ButtonWidgetAnnotation extends WidgetAnnotation { 44452 constructor(params) { 44453 super(params); 44454 this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON); 44455 this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON); 44456 this.data.pushButton = this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON); 44457 44458 if (this.data.checkBox) { 44459 this._processCheckBox(params); 44460 } else if (this.data.radioButton) { 44461 this._processRadioButton(params); 44462 } else if (this.data.pushButton) { 44463 this._processPushButton(params); 44464 } else { 44465 (0, _util.warn)("Invalid field flags for button widget annotation"); 44466 } 44467 } 44468 44469 _processCheckBox(params) { 44470 if ((0, _primitives.isName)(this.data.fieldValue)) { 44471 this.data.fieldValue = this.data.fieldValue.name; 44472 } 44473 44474 const customAppearance = params.dict.get("AP"); 44475 44476 if (!(0, _primitives.isDict)(customAppearance)) { 44477 return; 44478 } 44479 44480 const exportValueOptionsDict = customAppearance.get("D"); 44481 44482 if (!(0, _primitives.isDict)(exportValueOptionsDict)) { 44483 return; 44484 } 44485
44486 const exportValues = exportValueOptionsDict.getKeys(); 44487 const hasCorrectOptionCount = exportValues.length === 2; 44488 44489 if (!hasCorrectOptionCount) { 44490 return; 44491 } 44492 44493 this.data.exportValue = exportValues[0] === "Off" ? exportValues[1] : exportValues[0]; 44494 } 44495 44496 _processRadioButton(params) { 44497 this.data.fieldValue = this.data.buttonValue = null; 44498 const fieldParent = params.dict.get("Parent"); 44499 44500 if ((0, _primitives.isDict)(fieldParent) && fieldParent.has("V")) { 44501 const fieldParentValue = fieldParent.get("V"); 44502 44503 if ((0, _primitives.isName)(fieldParentValue)) { 44504 this.data.fieldValue = fieldParentValue.name; 44505 } 44506 } 44507 44508 const appearanceStates = params.dict.get("AP"); 44509 44510 if (!(0, _primitives.isDict)(appearanceStates)) { 44511 return; 44512 } 44513 44514 const normalAppearanceState = appearanceStates.get("N"); 44515 44516 if (!(0, _primitives.isDict)(normalAppearanceState)) { 44517 return; 44518 } 44519 44520 for (const key of normalAppearanceState.getKeys()) { 44521 if (key !== "Off") { 44522 this.data.buttonValue = key; 44523 break; 44524 } 44525 } 44526 } 44527 44528 _processPushButton(params) { 44529 if (!params.dict.has("A")) { 44530 (0, _util.warn)("Push buttons without action dictionaries are not supported"); 44531 return; 44532 } 44533 44534 _obj.Catalog.parseDestDictionary({ 44535 destDict: params.dict, 44536 resultObj: this.data, 44537 docBaseUrl: params.pdfManager.docBaseUrl 44538 }); 44539 } 44540 44541} 44542 44543class ChoiceWidgetAnnotation extends WidgetAnnotation { 44544 constructor(params) { 44545 super(params); 44546 this.data.options = []; 44547 const options = (0, _core_utils.getInheritableProperty)({ 44548 dict: params.dict, 44549 key: "Opt" 44550 }); 44551 44552 if (Array.isArray(options)) { 44553 const xref = params.xref; 44554 44555 for (let i = 0, ii = options.length; i < ii; i++) { 44556 const option = xref.fetchIfRef(options[i]); 44557 const isOptionArray = Array.isArray(option); 44558 this.data.options[i] = { 44559 exportValue: isOptionArray ? xref.fetchIfRef(option[0]) : option, 44560 displayValue: (0, _util.stringToPDFString)(isOptionArray ? xref.fetchIfRef(option[1]) : option) 44561 }; 44562 } 44563 } 44564 44565 if (!Array.isArray(this.data.fieldValue)) { 44566 this.data.fieldValue = [this.data.fieldValue]; 44567 } 44568 44569 this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO); 44570 this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT); 44571 } 44572 44573} 44574 44575class TextAnnotation extends MarkupAnnotation { 44576 constructor(parameters) { 44577 const DEFAULT_ICON_SIZE = 22; 44578 super(parameters); 44579 const dict = parameters.dict; 44580 this.data.annotationType = _util.AnnotationType.TEXT; 44581 44582 if (this.data.hasAppearance) { 44583 this.data.name = "NoIcon"; 44584 } else { 44585 this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE; 44586 this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE; 44587 this.data.name = dict.has("Name") ? dict.get("Name").name : "Note"; 44588 } 44589 44590 if (dict.has("State")) { 44591 this.data.state = dict.get("State") || null; 44592 this.data.stateModel = dict.get("StateModel") || null; 44593 } else { 44594 this.data.state = null; 44595 this.data.stateModel = null; 44596 } 44597 } 44598 44599} 44600 44601class LinkAnnotation extends Annotation { 44602 constructor(params) { 44603 super(params); 44604 this.data.annotationType = _util.AnnotationType.LINK; 44605 const quadPoints = getQuadPoints(params.dict, this.rectangle); 44606 44607 if (quadPoints) { 44608 this.data.quadPoints = quadPoints; 44609 } 44610 44611 _obj.Catalog.parseDestDictionary({ 44612 destDict: params.dict, 44613 resultObj: this.data, 44614 docBaseUrl: params.pdfManager.docBaseUrl 44615 }); 44616 } 44617 44618} 44619 44620class PopupAnnotation extends Annotation { 44621 constructor(parameters) { 44622 super(parameters); 44623 this.data.annotationType = _util.AnnotationType.POPUP; 44624 let parentItem = parameters.dict.get("Parent"); 44625 44626 if (!parentItem) { 44627 (0, _util.warn)("Popup annotation has a missing or invalid parent annotation."); 44628 return; 44629 } 44630 44631 const parentSubtype = parentItem.get("Subtype"); 44632 this.data.parentType = (0, _primitives.isName)(parentSubtype) ? parentSubtype.name : null; 44633 const rawParent = parameters.dict.getRaw("Parent"); 44634 this.data.parentId = (0, _primitives.isRef)(rawParent) ? rawParent.toString() : null; 44635 const rt = parentItem.get("RT"); 44636 44637 if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) { 44638 parentItem = parentItem.get("IRT"); 44639 } 44640 44641 if (!parentItem.has("M")) { 44642 this.data.modificationDate = null; 44643 } else { 44644 this.setModificationDate(parentItem.get("M")); 44645 this.data.modificationDate = this.modificationDate; 44646 } 44647 44648 if (!parentItem.has("C")) { 44649 this.data.color = null; 44650 } else { 44651 this.setColor(parentItem.getArray("C")); 44652 this.data.color = this.color; 44653 } 44654 44655 if (!this.viewable) { 44656 const parentFlags = parentItem.get("F"); 44657 44658 if (this._isViewable(parentFlags)) { 44659 this.setFlags(parentFlags); 44660 } 44661 } 44662 44663 this.data.title = (0, _util.stringToPDFString)(parentItem.get("T") || ""); 44664 this.data.contents = (0, _util.stringToPDFString)(parentItem.get("Contents") || ""); 44665 } 44666 44667} 44668 44669class FreeTextAnnotation extends MarkupAnnotation { 44670 constructor(parameters) { 44671 super(parameters); 44672 this.data.annotationType = _util.AnnotationType.FREETEXT; 44673 } 44674 44675} 44676 44677class LineAnnotation extends MarkupAnnotation { 44678 constructor(parameters) { 44679 super(parameters); 44680 this.data.annotationType = _util.AnnotationType.LINE; 44681 this.data.lineCoordinates = _util.Util.normalizeRect(parameters.dict.getArray("L")); 44682 } 44683 44684} 44685 44686class SquareAnnotation extends MarkupAnnotation { 44687 constructor(parameters) { 44688 super(parameters); 44689 this.data.annotationType = _util.AnnotationType.SQUARE; 44690 } 44691 44692} 44693 44694class CircleAnnotation extends MarkupAnnotation { 44695 constructor(parameters) { 44696 super(parameters); 44697 this.data.annotationType = _util.AnnotationType.CIRCLE; 44698 } 44699 44700} 44701 44702class PolylineAnnotation extends MarkupAnnotation { 44703 constructor(parameters) { 44704 super(parameters); 44705 this.data.annotationType = _util.AnnotationType.POLYLINE; 44706 const rawVertices = parameters.dict.getArray("Vertices"); 44707 this.data.vertices = []; 44708 44709 for (let i = 0, ii = rawVertices.length; i < ii; i += 2) { 44710 this.data.vertices.push({ 44711 x: rawVertices[i], 44712 y: rawVertices[i + 1] 44713 }); 44714 } 44715 } 44716 44717} 44718 44719class PolygonAnnotation extends PolylineAnnotation { 44720 constructor(parameters) { 44721 super(parameters); 44722 this.data.annotationType = _util.AnnotationType.POLYGON; 44723 } 44724 44725} 44726 44727class CaretAnnotation extends MarkupAnnotation { 44728 constructor(parameters) { 44729 super(parameters); 44730 this.data.annotationType = _util.AnnotationType.CARET; 44731 } 44732 44733} 44734 44735class InkAnnotation extends MarkupAnnotation { 44736 constructor(parameters) { 44737 super(parameters); 44738 this.data.annotationType = _util.AnnotationType.INK; 44739 const xref = parameters.xref; 44740 const originalInkLists = parameters.dict.getArray("InkList"); 44741 this.data.inkLists = []; 44742 44743 for (let i = 0, ii = originalInkLists.length; i < ii; ++i) { 44744 this.data.inkLists.push([]); 44745 44746 for (let j = 0, jj = originalInkLists[i].length; j < jj; j += 2) { 44747 this.data.inkLists[i].push({ 44748 x: xref.fetchIfRef(originalInkLists[i][j]), 44749 y: xref.fetchIfRef(originalInkLists[i][j + 1]) 44750 }); 44751 } 44752 } 44753 } 44754 44755} 44756 44757class HighlightAnnotation extends MarkupAnnotation { 44758 constructor(parameters) { 44759 super(parameters); 44760 this.data.annotationType = _util.AnnotationType.HIGHLIGHT; 44761 const quadPoints = getQuadPoints(parameters.dict, this.rectangle); 44762 44763 if (quadPoints) { 44764 this.data.quadPoints = quadPoints; 44765 } 44766 } 44767 44768} 44769 44770class UnderlineAnnotation extends MarkupAnnotation { 44771 constructor(parameters) { 44772 super(parameters); 44773 this.data.annotationType = _util.AnnotationType.UNDERLINE; 44774 const quadPoints = getQuadPoints(parameters.dict, this.rectangle); 44775 44776 if (quadPoints) { 44777 this.data.quadPoints = quadPoints; 44778 } 44779 } 44780 44781} 44782 44783class SquigglyAnnotation extends MarkupAnnotation { 44784 constructor(parameters) { 44785 super(parameters); 44786 this.data.annotationType = _util.AnnotationType.SQUIGGLY; 44787 const quadPoints = getQuadPoints(parameters.dict, this.rectangle); 44788 44789 if (quadPoints) { 44790 this.data.quadPoints = quadPoints; 44791 } 44792 } 44793 44794} 44795 44796class StrikeOutAnnotation extends MarkupAnnotation { 44797 constructor(parameters) { 44798 super(parameters); 44799 this.data.annotationType = _util.AnnotationType.STRIKEOUT; 44800 const quadPoints = getQuadPoints(parameters.dict, this.rectangle); 44801 44802 if (quadPoints) { 44803 this.data.quadPoints = quadPoints; 44804 } 44805 } 44806 44807} 44808 44809class StampAnnotation extends MarkupAnnotation { 44810 constructor(parameters) { 44811 super(parameters); 44812 this.data.annotationType = _util.AnnotationType.STAMP; 44813 } 44814 44815} 44816 44817class FileAttachmentAnnotation extends MarkupAnnotation { 44818 constructor(parameters) { 44819 super(parameters); 44820 const file = new _obj.FileSpec(parameters.dict.get("FS"), parameters.xref); 44821 this.data.annotationType = _util.AnnotationType.FILEATTACHMENT; 44822 this.data.file = file.serializable; 44823 } 44824 44825} 44826 44827/***/ }), 44828/* 24 */ 44829/***/ (function(module, exports, __w_pdfjs_require__) { 44830 44831"use strict"; 44832 44833 44834Object.defineProperty(exports, "__esModule", { 44835 value: true 44836}); 44837exports.OperatorList = void 0; 44838 44839var _util = __w_pdfjs_require__(2); 44840 44841var QueueOptimizer = function QueueOptimizerClosure() { 44842 function addState(parentState, pattern, checkFn, iterateFn, processFn) { 44843 var state = parentState; 44844 44845 for (var i = 0, ii = pattern.length - 1; i < ii; i++) { 44846 var item = pattern[i]; 44847 state = state[item] || (state[item] = []); 44848 } 44849 44850 state[pattern[pattern.length - 1]] = { 44851 checkFn, 44852 iterateFn, 44853 processFn 44854 }; 44855 } 44856 44857 function handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray) { 44858 var iFirstPIMXO = iFirstSave + 2; 44859 44860 for (var i = 0; i < count; i++) { 44861 var arg = argsArray[iFirstPIMXO + 4 * i]; 44862 var imageMask = arg.length === 1 && arg[0]; 44863 44864 if (imageMask && imageMask.width === 1 && imageMask.height === 1 && (!imageMask.data.length || imageMask.data.length === 1 && imageMask.data[0] === 0)) { 44865 fnArray[iFirstPIMXO + 4 * i] = _util.OPS.paintSolidColorImageMask; 44866 continue; 44867 } 44868 44869 break; 44870 } 44871 44872 return count - i; 44873 } 44874 44875 var InitialState = []; 44876 addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) { 44877 var fnArray = context.fnArray;
vendor: 3,556 bytes, lines 44878-44985
44878 var iFirstSave = context.iCurr - 3; 44879 var pos = (i - iFirstSave) % 4; 44880 44881 switch (pos) { 44882 case 0: 44883 return fnArray[i] === _util.OPS.save; 44884 44885 case 1: 44886 return fnArray[i] === _util.OPS.transform; 44887 44888 case 2: 44889 return fnArray[i] === _util.OPS.paintInlineImageXObject; 44890 44891 case 3: 44892 return fnArray[i] === _util.OPS.restore; 44893 } 44894 44895 throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`); 44896 }, function foundInlineImageGroup(context, i) { 44897 var MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10; 44898 var MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200; 44899 var MAX_WIDTH = 1000; 44900 var IMAGE_PADDING = 1; 44901 var fnArray = context.fnArray, 44902 argsArray = context.argsArray; 44903 var curr = context.iCurr; 44904 var iFirstSave = curr - 3; 44905 var iFirstTransform = curr - 2; 44906 var iFirstPIIXO = curr - 1; 44907 var count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK); 44908 44909 if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) { 44910 return i - (i - iFirstSave) % 4; 44911 } 44912 44913 var maxX = 0; 44914 var map = [], 44915 maxLineHeight = 0; 44916 var currentX = IMAGE_PADDING, 44917 currentY = IMAGE_PADDING; 44918 var q; 44919 44920 for (q = 0; q < count; q++) { 44921 var transform = argsArray[iFirstTransform + (q << 2)]; 44922 var img = argsArray[iFirstPIIXO + (q << 2)][0]; 44923 44924 if (currentX + img.width > MAX_WIDTH) { 44925 maxX = Math.max(maxX, currentX); 44926 currentY += maxLineHeight + 2 * IMAGE_PADDING; 44927 currentX = 0; 44928 maxLineHeight = 0; 44929 } 44930 44931 map.push({ 44932 transform, 44933 x: currentX, 44934 y: currentY, 44935 w: img.width, 44936 h: img.height 44937 }); 44938 currentX += img.width + 2 * IMAGE_PADDING; 44939 maxLineHeight = Math.max(maxLineHeight, img.height); 44940 } 44941 44942 var imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING; 44943 var imgHeight = currentY + maxLineHeight + IMAGE_PADDING; 44944 var imgData = new Uint8ClampedArray(imgWidth * imgHeight * 4); 44945 var imgRowSize = imgWidth << 2; 44946 44947 for (q = 0; q < count; q++) { 44948 var data = argsArray[iFirstPIIXO + (q << 2)][0].data; 44949 var rowSize = map[q].w << 2; 44950 var dataOffset = 0; 44951 var offset = map[q].x + map[q].y * imgWidth << 2; 44952 imgData.set(data.subarray(0, rowSize), offset - imgRowSize); 44953 44954 for (var k = 0, kk = map[q].h; k < kk; k++) { 44955 imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset); 44956 dataOffset += rowSize; 44957 offset += imgRowSize; 44958 } 44959 44960 imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset); 44961 44962 while (offset >= 0) { 44963 data[offset - 4] = data[offset]; 44964 data[offset - 3] = data[offset + 1]; 44965 data[offset - 2] = data[offset + 2]; 44966 data[offset - 1] = data[offset + 3]; 44967 data[offset + rowSize] = data[offset + rowSize - 4]; 44968 data[offset + rowSize + 1] = data[offset + rowSize - 3]; 44969 data[offset + rowSize + 2] = data[offset + rowSize - 2]; 44970 data[offset + rowSize + 3] = data[offset + rowSize - 1]; 44971 offset -= imgRowSize; 44972 } 44973 } 44974 44975 fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup); 44976 argsArray.splice(iFirstSave, count * 4, [{ 44977 width: imgWidth, 44978 height: imgHeight, 44979 kind: _util.ImageKind.RGBA_32BPP, 44980 data: imgData 44981 }, map]); 44982 return iFirstSave + 1; 44983 }); 44984 addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) { 44985 var fnArray = context.fnArray;
44986 var iFirstSave = context.iCurr - 3; 44987 var pos = (i - iFirstSave) % 4; 44988 44989 switch (pos) { 44990 case 0: 44991 return fnArray[i] === _util.OPS.save; 44992 44993 case 1: 44994 return fnArray[i] === _util.OPS.transform; 44995 44996 case 2: 44997 return fnArray[i] === _util.OPS.paintImageMaskXObject; 44998 44999 case 3: 45000 return fnArray[i] === _util.OPS.restore; 45001 } 45002 45003 throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`); 45004 }, function foundImageMaskGroup(context, i) { 45005 var MIN_IMAGES_IN_MASKS_BLOCK = 10; 45006 var MAX_IMAGES_IN_MASKS_BLOCK = 100; 45007 var MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000; 45008 var fnArray = context.fnArray, 45009 argsArray = context.argsArray; 45010 var curr = context.iCurr; 45011 var iFirstSave = curr - 3; 45012 var iFirstTransform = curr - 2; 45013 var iFirstPIMXO = curr - 1; 45014 var count = Math.floor((i - iFirstSave) / 4); 45015 count = handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray); 45016 45017 if (count < MIN_IMAGES_IN_MASKS_BLOCK) { 45018 return i - (i - iFirstSave) % 4; 45019 } 45020 45021 var q; 45022 var isSameImage = false; 45023 var iTransform, transformArgs; 45024 var firstPIMXOArg0 = argsArray[iFirstPIMXO][0]; 45025 45026 if (argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0) { 45027 isSameImage = true; 45028 var firstTransformArg0 = argsArray[iFirstTransform][0]; 45029 var firstTransformArg3 = argsArray[iFirstTransform][3]; 45030 iTransform = iFirstTransform + 4; 45031 var iPIMXO = iFirstPIMXO + 4; 45032 45033 for (q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) { 45034 transformArgs = argsArray[iTransform]; 45035 45036 if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== 0 || transformArgs[2] !== 0 || transformArgs[3] !== firstTransformArg3) { 45037 if (q < MIN_IMAGES_IN_MASKS_BLOCK) { 45038 isSameImage = false; 45039 } else { 45040 count = q; 45041 } 45042 45043 break; 45044 } 45045 } 45046 } 45047 45048 if (isSameImage) { 45049 count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK); 45050 var positions = new Float32Array(count * 2); 45051 iTransform = iFirstTransform; 45052 45053 for (q = 0; q < count; q++, iTransform += 4) { 45054 transformArgs = argsArray[iTransform]; 45055 positions[q << 1] = transformArgs[4]; 45056 positions[(q << 1) + 1] = transformArgs[5]; 45057 } 45058 45059 fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat); 45060 argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg3, positions]); 45061 } else { 45062 count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK); 45063 var images = []; 45064 45065 for (q = 0; q < count; q++) { 45066 transformArgs = argsArray[iFirstTransform + (q << 2)]; 45067 var maskParams = argsArray[iFirstPIMXO + (q << 2)][0]; 45068 images.push({ 45069 data: maskParams.data, 45070 width: maskParams.width, 45071 height: maskParams.height, 45072 transform: transformArgs 45073 }); 45074 } 45075 45076 fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup); 45077 argsArray.splice(iFirstSave, count * 4, [images]); 45078 } 45079 45080 return iFirstSave + 1; 45081 }); 45082 addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) { 45083 var argsArray = context.argsArray;
45084 var iFirstTransform = context.iCurr - 2; 45085 return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0; 45086 }, function iterateImageGroup(context, i) { 45087 var fnArray = context.fnArray, 45088 argsArray = context.argsArray; 45089 var iFirstSave = context.iCurr - 3; 45090 var pos = (i - iFirstSave) % 4; 45091 45092 switch (pos) { 45093 case 0: 45094 return fnArray[i] === _util.OPS.save; 45095 45096 case 1: 45097 if (fnArray[i] !== _util.OPS.transform) { 45098 return false; 45099 } 45100 45101 var iFirstTransform = context.iCurr - 2; 45102 var firstTransformArg0 = argsArray[iFirstTransform][0]; 45103 var firstTransformArg3 = argsArray[iFirstTransform][3]; 45104 45105 if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) { 45106 return false; 45107 } 45108 45109 return true; 45110 45111 case 2: 45112 if (fnArray[i] !== _util.OPS.paintImageXObject) { 45113 return false; 45114 } 45115 45116 var iFirstPIXO = context.iCurr - 1; 45117 var firstPIXOArg0 = argsArray[iFirstPIXO][0]; 45118 45119 if (argsArray[i][0] !== firstPIXOArg0) { 45120 return false; 45121 } 45122 45123 return true; 45124 45125 case 3: 45126 return fnArray[i] === _util.OPS.restore; 45127 } 45128 45129 throw new Error(`iterateImageGroup - invalid pos: ${pos}`); 45130 }, function (context, i) { 45131 var MIN_IMAGES_IN_BLOCK = 3; 45132 var MAX_IMAGES_IN_BLOCK = 1000; 45133 var fnArray = context.fnArray, 45134 argsArray = context.argsArray; 45135 var curr = context.iCurr; 45136 var iFirstSave = curr - 3; 45137 var iFirstTransform = curr - 2; 45138 var iFirstPIXO = curr - 1; 45139 var firstPIXOArg0 = argsArray[iFirstPIXO][0]; 45140 var firstTransformArg0 = argsArray[iFirstTransform][0]; 45141 var firstTransformArg3 = argsArray[iFirstTransform][3]; 45142 var count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK); 45143 45144 if (count < MIN_IMAGES_IN_BLOCK) { 45145 return i - (i - iFirstSave) % 4; 45146 } 45147 45148 var positions = new Float32Array(count * 2); 45149 var iTransform = iFirstTransform; 45150 45151 for (var q = 0; q < count; q++, iTransform += 4) { 45152 var transformArgs = argsArray[iTransform]; 45153 positions[q << 1] = transformArgs[4]; 45154 positions[(q << 1) + 1] = transformArgs[5]; 45155 } 45156 45157 var args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions]; 45158 fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat); 45159 argsArray.splice(iFirstSave, count * 4, args); 45160 return iFirstSave + 1; 45161 }); 45162 addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) { 45163 var fnArray = context.fnArray, 45164 argsArray = context.argsArray;
45165 var iFirstSave = context.iCurr - 4; 45166 var pos = (i - iFirstSave) % 5; 45167 45168 switch (pos) { 45169 case 0: 45170 return fnArray[i] === _util.OPS.beginText; 45171 45172 case 1: 45173 return fnArray[i] === _util.OPS.setFont; 45174 45175 case 2: 45176 return fnArray[i] === _util.OPS.setTextMatrix; 45177 45178 case 3: 45179 if (fnArray[i] !== _util.OPS.showText) { 45180 return false; 45181 } 45182 45183 var iFirstSetFont = context.iCurr - 3; 45184 var firstSetFontArg0 = argsArray[iFirstSetFont][0]; 45185 var firstSetFontArg1 = argsArray[iFirstSetFont][1]; 45186 45187 if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) { 45188 return false; 45189 } 45190 45191 return true; 45192 45193 case 4: 45194 return fnArray[i] === _util.OPS.endText; 45195 } 45196 45197 throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`); 45198 }, function (context, i) { 45199 var MIN_CHARS_IN_BLOCK = 3; 45200 var MAX_CHARS_IN_BLOCK = 1000; 45201 var fnArray = context.fnArray, 45202 argsArray = context.argsArray; 45203 var curr = context.iCurr; 45204 var iFirstBeginText = curr - 4; 45205 var iFirstSetFont = curr - 3; 45206 var iFirstSetTextMatrix = curr - 2; 45207 var iFirstShowText = curr - 1; 45208 var iFirstEndText = curr; 45209 var firstSetFontArg0 = argsArray[iFirstSetFont][0]; 45210 var firstSetFontArg1 = argsArray[iFirstSetFont][1]; 45211 var count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK); 45212 45213 if (count < MIN_CHARS_IN_BLOCK) { 45214 return i - (i - iFirstBeginText) % 5; 45215 } 45216 45217 var iFirst = iFirstBeginText; 45218 45219 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) { 45220 count++; 45221 iFirst -= 5; 45222 } 45223 45224 var iEndText = iFirst + 4; 45225 45226 for (var q = 1; q < count; q++) { 45227 fnArray.splice(iEndText, 3); 45228 argsArray.splice(iEndText, 3); 45229 iEndText += 2; 45230 } 45231 45232 return iEndText + 1; 45233 }); 45234 45235 function QueueOptimizer(queue) { 45236 this.queue = queue; 45237 this.state = null; 45238 this.context = { 45239 iCurr: 0, 45240 fnArray: queue.fnArray, 45241 argsArray: queue.argsArray 45242 }; 45243 this.match = null; 45244 this.lastProcessed = 0; 45245 } 45246 45247 QueueOptimizer.prototype = { 45248 _optimize() { 45249 const fnArray = this.queue.fnArray; 45250 let i = this.lastProcessed, 45251 ii = fnArray.length; 45252 let state = this.state; 45253 let match = this.match; 45254 45255 if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) { 45256 this.lastProcessed = ii; 45257 return; 45258 } 45259 45260 const context = this.context; 45261 45262 while (i < ii) { 45263 if (match) { 45264 const iterate = (0, match.iterateFn)(context, i); 45265 45266 if (iterate) { 45267 i++; 45268 continue; 45269 } 45270 45271 i = (0, match.processFn)(context, i + 1); 45272 ii = fnArray.length; 45273 match = null; 45274 state = null; 45275 45276 if (i >= ii) { 45277 break; 45278 } 45279 } 45280 45281 state = (state || InitialState)[fnArray[i]]; 45282 45283 if (!state || Array.isArray(state)) { 45284 i++; 45285 continue; 45286 } 45287 45288 context.iCurr = i; 45289 i++; 45290 45291 if (state.checkFn && !(0, state.checkFn)(context)) { 45292 state = null; 45293 continue; 45294 } 45295 45296 match = state; 45297 state = null; 45298 } 45299 45300 this.state = state; 45301 this.match = match; 45302 this.lastProcessed = i; 45303 }, 45304 45305 push(fn, args) { 45306 this.queue.fnArray.push(fn); 45307 this.queue.argsArray.push(args); 45308 45309 this._optimize(); 45310 }, 45311 45312 flush() { 45313 while (this.match) { 45314 const length = this.queue.fnArray.length; 45315 this.lastProcessed = (0, this.match.processFn)(this.context, length); 45316 this.match = null; 45317 this.state = null; 45318 45319 this._optimize(); 45320 } 45321 }, 45322 45323 reset() { 45324 this.state = null; 45325 this.match = null; 45326 this.lastProcessed = 0; 45327 } 45328 45329 }; 45330 return QueueOptimizer; 45331}(); 45332 45333var NullOptimizer = function NullOptimizerClosure() { 45334 function NullOptimizer(queue) { 45335 this.queue = queue; 45336 } 45337 45338 NullOptimizer.prototype = { 45339 push(fn, args) { 45340 this.queue.fnArray.push(fn); 45341 this.queue.argsArray.push(args); 45342 }, 45343 45344 flush() {}, 45345 45346 reset() {} 45347 45348 }; 45349 return NullOptimizer; 45350}(); 45351 45352var OperatorList = function OperatorListClosure() { 45353 var CHUNK_SIZE = 1000; 45354 var CHUNK_SIZE_ABOUT = CHUNK_SIZE - 5; 45355 45356 function OperatorList(intent, streamSink, pageIndex) { 45357 this._streamSink = streamSink; 45358 this.fnArray = []; 45359 this.argsArray = []; 45360 45361 if (streamSink && intent !== "oplist") { 45362 this.optimizer = new QueueOptimizer(this); 45363 } else { 45364 this.optimizer = new NullOptimizer(this); 45365 } 45366 45367 this.dependencies = Object.create(null); 45368 this._totalLength = 0; 45369 this.pageIndex = pageIndex; 45370 this.intent = intent; 45371 this.weight = 0; 45372 this._resolved = streamSink ? null : Promise.resolve(); 45373 } 45374 45375 OperatorList.prototype = { 45376 get length() { 45377 return this.argsArray.length; 45378 }, 45379 45380 get ready() { 45381 return this._resolved || this._streamSink.ready; 45382 }, 45383 45384 get totalLength() { 45385 return this._totalLength + this.length; 45386 }, 45387 45388 addOp(fn, args) { 45389 this.optimizer.push(fn, args); 45390 this.weight++; 45391 45392 if (this._streamSink) { 45393 if (this.weight >= CHUNK_SIZE) { 45394 this.flush(); 45395 } else if (this.weight >= CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) { 45396 this.flush(); 45397 } 45398 } 45399 }, 45400 45401 addDependency(dependency) { 45402 if (dependency in this.dependencies) { 45403 return; 45404 } 45405 45406 this.dependencies[dependency] = true;
45407 this.addOp(_util.OPS.dependency, [dependency]); 45408 }, 45409 45410 addDependencies(dependencies) { 45411 for (var key in dependencies) { 45412 this.addDependency(key); 45413 } 45414 }, 45415 45416 addOpList(opList) { 45417 Object.assign(this.dependencies, opList.dependencies); 45418 45419 for (var i = 0, ii = opList.length; i < ii; i++) { 45420 this.addOp(opList.fnArray[i], opList.argsArray[i]); 45421 } 45422 }, 45423 45424 getIR() { 45425 return { 45426 fnArray: this.fnArray, 45427 argsArray: this.argsArray, 45428 length: this.length 45429 }; 45430 }, 45431 45432 get _transfers() { 45433 const transfers = []; 45434 const { 45435 fnArray, 45436 argsArray, 45437 length 45438 } = this; 45439 45440 for (let i = 0; i < length; i++) { 45441 switch (fnArray[i]) { 45442 case _util.OPS.paintInlineImageXObject: 45443 case _util.OPS.paintInlineImageXObjectGroup: 45444 case _util.OPS.paintImageMaskXObject: 45445 const arg = argsArray[i][0]; 45446 ; 45447 45448 if (!arg.cached) { 45449 transfers.push(arg.data.buffer); 45450 } 45451 45452 break; 45453 } 45454 } 45455 45456 return transfers; 45457 }, 45458 45459 flush(lastChunk = false) { 45460 this.optimizer.flush(); 45461 const length = this.length; 45462 this._totalLength += length; 45463 45464 this._streamSink.enqueue({ 45465 fnArray: this.fnArray, 45466 argsArray: this.argsArray, 45467 lastChunk, 45468 length 45469 }, 1, this._transfers); 45470 45471 this.dependencies = Object.create(null); 45472 this.fnArray.length = 0; 45473 this.argsArray.length = 0; 45474 this.weight = 0; 45475 this.optimizer.reset(); 45476 } 45477 45478 }; 45479 return OperatorList; 45480}(); 45481 45482exports.OperatorList = OperatorList; 45483 45484/***/ }), 45485/* 25 */ 45486/***/ (function(module, exports, __w_pdfjs_require__) { 45487 45488"use strict"; 45489 45490 45491Object.defineProperty(exports, "__esModule", { 45492 value: true 45493}); 45494exports.PartialEvaluator = void 0; 45495 45496var _util = __w_pdfjs_require__(2); 45497 45498var _cmap = __w_pdfjs_require__(26); 45499 45500var _primitives = __w_pdfjs_require__(4); 45501 45502var _fonts = __w_pdfjs_require__(27); 45503 45504var _encodings = __w_pdfjs_require__(30); 45505 45506var _core_utils = __w_pdfjs_require__(7); 45507 45508var _unicode = __w_pdfjs_require__(33); 45509 45510var _standard_fonts = __w_pdfjs_require__(32); 45511 45512var _pattern = __w_pdfjs_require__(36); 45513 45514var _parser = __w_pdfjs_require__(10); 45515 45516var _bidi = __w_pdfjs_require__(37); 45517 45518var _colorspace = __w_pdfjs_require__(22); 45519 45520var _stream = __w_pdfjs_require__(11); 45521 45522var _glyphlist = __w_pdfjs_require__(31); 45523 45524var _metrics = __w_pdfjs_require__(38); 45525 45526var _function = __w_pdfjs_require__(39); 45527 45528var _jpeg_stream = __w_pdfjs_require__(17); 45529 45530var _murmurhash = __w_pdfjs_require__(41); 45531 45532var _image_utils = __w_pdfjs_require__(42); 45533 45534var _operator_list = __w_pdfjs_require__(24); 45535 45536var _image = __w_pdfjs_require__(43); 45537 45538var PartialEvaluator = function PartialEvaluatorClosure() { 45539 const DefaultPartialEvaluatorOptions = { 45540 forceDataSchema: false, 45541 maxImageSize: -1, 45542 disableFontFace: false, 45543 nativeImageDecoderSupport: _util.NativeImageDecoding.DECODE, 45544 ignoreErrors: false, 45545 isEvalSupported: true 45546 }; 45547 45548 function PartialEvaluator({ 45549 xref, 45550 handler, 45551 pageIndex, 45552 idFactory, 45553 fontCache, 45554 builtInCMapCache, 45555 options = null, 45556 pdfFunctionFactory 45557 }) { 45558 this.xref = xref; 45559 this.handler = handler; 45560 this.pageIndex = pageIndex; 45561 this.idFactory = idFactory; 45562 this.fontCache = fontCache; 45563 this.builtInCMapCache = builtInCMapCache; 45564 this.options = options || DefaultPartialEvaluatorOptions; 45565 this.pdfFunctionFactory = pdfFunctionFactory; 45566 this.parsingType3Font = false; 45567 45568 this.fetchBuiltInCMap = async name => { 45569 if (this.builtInCMapCache.has(name)) { 45570 return this.builtInCMapCache.get(name); 45571 } 45572 45573 const readableStream = this.handler.sendWithStream("FetchBuiltInCMap", { 45574 name 45575 }); 45576 const reader = readableStream.getReader(); 45577 const data = await new Promise(function (resolve, reject) { 45578 function pump() { 45579 reader.read().then(function ({ 45580 value, 45581 done 45582 }) { 45583 if (done) { 45584 return; 45585 } 45586 45587 resolve(value); 45588 pump(); 45589 }, reject); 45590 } 45591 45592 pump(); 45593 }); 45594 45595 if (data.compressionType !== _util.CMapCompressionType.NONE) { 45596 this.builtInCMapCache.set(name, data); 45597 } 45598 45599 return data; 45600 }; 45601 } 45602 45603 var TIME_SLOT_DURATION_MS = 20; 45604 var CHECK_TIME_EVERY = 100; 45605 45606 function TimeSlotManager() { 45607 this.reset(); 45608 } 45609 45610 TimeSlotManager.prototype = { 45611 check: function TimeSlotManager_check() { 45612 if (++this.checked < CHECK_TIME_EVERY) { 45613 return false;
45614 } 45615 45616 this.checked = 0; 45617 return this.endTime <= Date.now(); 45618 }, 45619 reset: function TimeSlotManager_reset() { 45620 this.endTime = Date.now() + TIME_SLOT_DURATION_MS; 45621 this.checked = 0; 45622 } 45623 }; 45624 45625 function normalizeBlendMode(value, parsingArray = false) { 45626 if (Array.isArray(value)) { 45627 for (let i = 0, ii = value.length; i < ii; i++) { 45628 const maybeBM = normalizeBlendMode(value[i], true); 45629 45630 if (maybeBM) { 45631 return maybeBM; 45632 } 45633 } 45634 45635 (0, _util.warn)(`Unsupported blend mode Array: ${value}`); 45636 return "source-over"; 45637 } 45638 45639 if (!(0, _primitives.isName)(value)) { 45640 if (parsingArray) { 45641 return null; 45642 } 45643 45644 return "source-over"; 45645 } 45646 45647 switch (value.name) { 45648 case "Normal": 45649 case "Compatible": 45650 return "source-over"; 45651 45652 case "Multiply": 45653 return "multiply"; 45654 45655 case "Screen": 45656 return "screen"; 45657 45658 case "Overlay": 45659 return "overlay"; 45660 45661 case "Darken": 45662 return "darken"; 45663 45664 case "Lighten": 45665 return "lighten"; 45666 45667 case "ColorDodge": 45668 return "color-dodge"; 45669 45670 case "ColorBurn": 45671 return "color-burn"; 45672 45673 case "HardLight": 45674 return "hard-light"; 45675 45676 case "SoftLight": 45677 return "soft-light"; 45678 45679 case "Difference": 45680 return "difference"; 45681 45682 case "Exclusion": 45683 return "exclusion"; 45684 45685 case "Hue": 45686 return "hue"; 45687 45688 case "Saturation": 45689 return "saturation"; 45690 45691 case "Color": 45692 return "color"; 45693 45694 case "Luminosity": 45695 return "luminosity"; 45696 } 45697 45698 if (parsingArray) { 45699 return null; 45700 } 45701 45702 (0, _util.warn)(`Unsupported blend mode: ${value.name}`); 45703 return "source-over"; 45704 } 45705 45706 var deferred = Promise.resolve(); 45707 var TILING_PATTERN = 1, 45708 SHADING_PATTERN = 2; 45709 PartialEvaluator.prototype = { 45710 clone(newOptions = DefaultPartialEvaluatorOptions) { 45711 var newEvaluator = Object.create(this); 45712 newEvaluator.options = newOptions; 45713 return newEvaluator; 45714 }, 45715 45716 hasBlendModes: function PartialEvaluator_hasBlendModes(resources) { 45717 if (!(resources instanceof _primitives.Dict)) { 45718 return false; 45719 } 45720 45721 var processed = Object.create(null); 45722 45723 if (resources.objId) { 45724 processed[resources.objId] = true; 45725 } 45726 45727 var nodes = [resources], 45728 xref = this.xref; 45729 45730 while (nodes.length) { 45731 var node = nodes.shift();
45732 var graphicStates = node.get("ExtGState"); 45733 45734 if (graphicStates instanceof _primitives.Dict) { 45735 var graphicStatesKeys = graphicStates.getKeys(); 45736 45737 for (let i = 0, ii = graphicStatesKeys.length; i < ii; i++) { 45738 const key = graphicStatesKeys[i]; 45739 let graphicState = graphicStates.getRaw(key); 45740 45741 if (graphicState instanceof _primitives.Ref) { 45742 if (processed[graphicState.toString()]) { 45743 continue; 45744 } 45745 45746 try { 45747 graphicState = xref.fetch(graphicState); 45748 } catch (ex) { 45749 if (ex instanceof _core_utils.MissingDataException) { 45750 throw ex; 45751 } 45752 45753 if (this.options.ignoreErrors) { 45754 if (graphicState instanceof _primitives.Ref) { 45755 processed[graphicState.toString()] = true; 45756 } 45757 45758 this.handler.send("UnsupportedFeature", { 45759 featureId: _util.UNSUPPORTED_FEATURES.unknown 45760 }); 45761 (0, _util.warn)(`hasBlendModes - ignoring ExtGState: "${ex}".`); 45762 continue; 45763 } 45764 45765 throw ex; 45766 } 45767 } 45768 45769 if (!(graphicState instanceof _primitives.Dict)) { 45770 continue; 45771 } 45772 45773 if (graphicState.objId) { 45774 processed[graphicState.objId] = true; 45775 } 45776 45777 const bm = graphicState.get("BM"); 45778 45779 if (bm instanceof _primitives.Name) { 45780 if (bm.name !== "Normal") { 45781 return true; 45782 } 45783 45784 continue; 45785 } 45786 45787 if (bm !== undefined && Array.isArray(bm)) { 45788 for (let j = 0, jj = bm.length; j < jj; j++) { 45789 if (bm[j] instanceof _primitives.Name && bm[j].name !== "Normal") { 45790 return true; 45791 } 45792 } 45793 } 45794 } 45795 } 45796 45797 var xObjects = node.get("XObject"); 45798 45799 if (!(xObjects instanceof _primitives.Dict)) { 45800 continue; 45801 } 45802 45803 var xObjectsKeys = xObjects.getKeys(); 45804 45805 for (let i = 0, ii = xObjectsKeys.length; i < ii; i++) { 45806 const key = xObjectsKeys[i]; 45807 var xObject = xObjects.getRaw(key); 45808 45809 if (xObject instanceof _primitives.Ref) { 45810 if (processed[xObject.toString()]) { 45811 continue; 45812 } 45813 45814 try { 45815 xObject = xref.fetch(xObject); 45816 } catch (ex) { 45817 if (ex instanceof _core_utils.MissingDataException) { 45818 throw ex; 45819 } 45820 45821 if (this.options.ignoreErrors) { 45822 if (xObject instanceof _primitives.Ref) { 45823 processed[xObject.toString()] = true; 45824 } 45825 45826 this.handler.send("UnsupportedFeature", { 45827 featureId: _util.UNSUPPORTED_FEATURES.unknown 45828 }); 45829 (0, _util.warn)(`hasBlendModes - ignoring XObject: "${ex}".`); 45830 continue; 45831 } 45832 45833 throw ex; 45834 } 45835 } 45836 45837 if (!(0, _primitives.isStream)(xObject)) { 45838 continue; 45839 } 45840 45841 if (xObject.dict.objId) { 45842 if (processed[xObject.dict.objId]) { 45843 continue; 45844 } 45845 45846 processed[xObject.dict.objId] = true; 45847 } 45848 45849 var xResources = xObject.dict.get("Resources"); 45850 45851 if (xResources instanceof _primitives.Dict && (!xResources.objId || !processed[xResources.objId])) { 45852 nodes.push(xResources); 45853 45854 if (xResources.objId) { 45855 processed[xResources.objId] = true; 45856 } 45857 } 45858 } 45859 } 45860 45861 return false; 45862 }, 45863 45864 async buildFormXObject(resources, xobj, smask, operatorList, task, initialState) { 45865 var dict = xobj.dict; 45866 var matrix = dict.getArray("Matrix"); 45867 var bbox = dict.getArray("BBox"); 45868 45869 if (Array.isArray(bbox) && bbox.length === 4) { 45870 bbox = _util.Util.normalizeRect(bbox); 45871 } else { 45872 bbox = null; 45873 } 45874 45875 var group = dict.get("Group"); 45876 45877 if (group) { 45878 var groupOptions = { 45879 matrix, 45880 bbox, 45881 smask, 45882 isolated: false, 45883 knockout: false 45884 }; 45885 var groupSubtype = group.get("S"); 45886 var colorSpace = null; 45887 45888 if ((0, _primitives.isName)(groupSubtype, "Transparency")) { 45889 groupOptions.isolated = group.get("I") || false; 45890 groupOptions.knockout = group.get("K") || false; 45891 45892 if (group.has("CS")) { 45893 colorSpace = await this.parseColorSpace({ 45894 cs: group.get("CS"), 45895 resources 45896 }); 45897 } 45898 } 45899 45900 if (smask && smask.backdrop) { 45901 colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb; 45902 smask.backdrop = colorSpace.getRgb(smask.backdrop, 0); 45903 } 45904 45905 operatorList.addOp(_util.OPS.beginGroup, [groupOptions]); 45906 } 45907 45908 operatorList.addOp(_util.OPS.paintFormXObjectBegin, [matrix, bbox]); 45909 return this.getOperatorList({ 45910 stream: xobj, 45911 task, 45912 resources: dict.get("Resources") || resources, 45913 operatorList, 45914 initialState 45915 }).then(function () { 45916 operatorList.addOp(_util.OPS.paintFormXObjectEnd, []); 45917 45918 if (group) { 45919 operatorList.addOp(_util.OPS.endGroup, [groupOptions]); 45920 } 45921 }); 45922 }, 45923 45924 async buildPaintImageXObject({ 45925 resources, 45926 image, 45927 isInline = false, 45928 operatorList, 45929 cacheKey, 45930 imageCache, 45931 forceDisableNativeImageDecoder = false 45932 }) { 45933 var dict = image.dict; 45934 var w = dict.get("Width", "W"); 45935 var h = dict.get("Height", "H"); 45936 45937 if (!(w && (0, _util.isNum)(w)) || !(h && (0, _util.isNum)(h))) { 45938 (0, _util.warn)("Image dimensions are missing, or not numbers."); 45939 return undefined; 45940 } 45941 45942 var maxImageSize = this.options.maxImageSize; 45943 45944 if (maxImageSize !== -1 && w * h > maxImageSize) { 45945 (0, _util.warn)("Image exceeded maximum allowed size and was removed."); 45946 return undefined; 45947 } 45948 45949 var imageMask = dict.get("ImageMask", "IM") || false; 45950 var imgData, args; 45951 45952 if (imageMask) { 45953 var width = dict.get("Width", "W"); 45954 var height = dict.get("Height", "H"); 45955 var bitStrideLength = width + 7 >> 3; 45956 var imgArray = image.getBytes(bitStrideLength * height, true); 45957 var decode = dict.getArray("Decode", "D"); 45958 imgData = _image.PDFImage.createMask({ 45959 imgArray, 45960 width, 45961 height,
45962 imageIsFromDecodeStream: image instanceof _stream.DecodeStream, 45963 inverseDecode: !!decode && decode[0] > 0 45964 }); 45965 imgData.cached = !!cacheKey; 45966 args = [imgData]; 45967 operatorList.addOp(_util.OPS.paintImageMaskXObject, args); 45968 45969 if (cacheKey) { 45970 imageCache[cacheKey] = { 45971 fn: _util.OPS.paintImageMaskXObject, 45972 args 45973 }; 45974 } 45975 45976 return undefined; 45977 } 45978 45979 var softMask = dict.get("SMask", "SM") || false; 45980 var mask = dict.get("Mask") || false; 45981 var SMALL_IMAGE_DIMENSIONS = 200; 45982 45983 if (isInline && !softMask && !mask && !(image instanceof _jpeg_stream.JpegStream) && w + h < SMALL_IMAGE_DIMENSIONS) { 45984 const imageObj = new _image.PDFImage({ 45985 xref: this.xref, 45986 res: resources, 45987 image, 45988 isInline, 45989 pdfFunctionFactory: this.pdfFunctionFactory 45990 }); 45991 imgData = imageObj.createImageData(true); 45992 operatorList.addOp(_util.OPS.paintInlineImageXObject, [imgData]); 45993 return undefined; 45994 } 45995 45996 const nativeImageDecoderSupport = forceDisableNativeImageDecoder ? _util.NativeImageDecoding.NONE : this.options.nativeImageDecoderSupport; 45997 let objId = `img_${this.idFactory.createObjId()}`; 45998 45999 if (this.parsingType3Font) { 46000 (0, _util.assert)(nativeImageDecoderSupport === _util.NativeImageDecoding.NONE, "Type3 image resources should be completely decoded in the worker."); 46001 objId = `${this.idFactory.getDocId()}_type3res_${objId}`; 46002 } 46003 46004 if (nativeImageDecoderSupport !== _util.NativeImageDecoding.NONE && !softMask && !mask && image instanceof _jpeg_stream.JpegStream && _image_utils.NativeImageDecoder.isSupported(image, this.xref, resources, this.pdfFunctionFactory) && image.maybeValidDimensions) { 46005 return this.handler.sendWithPromise("obj", [objId, this.pageIndex, "JpegStream", image.getIR(this.options.forceDataSchema)]).then(function () { 46006 operatorList.addDependency(objId); 46007 args = [objId, w, h]; 46008 operatorList.addOp(_util.OPS.paintJpegXObject, args); 46009 46010 if (cacheKey) { 46011 imageCache[cacheKey] = { 46012 fn: _util.OPS.paintJpegXObject, 46013 args 46014 }; 46015 } 46016 }, reason => { 46017 (0, _util.warn)("Native JPEG decoding failed -- trying to recover: " + (reason && reason.message)); 46018 return this.buildPaintImageXObject({ 46019 resources, 46020 image, 46021 isInline, 46022 operatorList, 46023 cacheKey, 46024 imageCache, 46025 forceDisableNativeImageDecoder: true 46026 }); 46027 }); 46028 } 46029 46030 var nativeImageDecoder = null; 46031 46032 if (nativeImageDecoderSupport === _util.NativeImageDecoding.DECODE && (image instanceof _jpeg_stream.JpegStream || mask instanceof _jpeg_stream.JpegStream || softMask instanceof _jpeg_stream.JpegStream)) { 46033 nativeImageDecoder = new _image_utils.NativeImageDecoder({ 46034 xref: this.xref, 46035 resources, 46036 handler: this.handler, 46037 forceDataSchema: this.options.forceDataSchema, 46038 pdfFunctionFactory: this.pdfFunctionFactory 46039 }); 46040 } 46041 46042 operatorList.addDependency(objId); 46043 args = [objId, w, h]; 46044 46045 const imgPromise = _image.PDFImage.buildImage({ 46046 handler: this.handler, 46047 xref: this.xref, 46048 res: resources, 46049 image, 46050 isInline, 46051 nativeDecoder: nativeImageDecoder, 46052 pdfFunctionFactory: this.pdfFunctionFactory 46053 }).then(imageObj => { 46054 var imgData = imageObj.createImageData(false); 46055 46056 if (this.parsingType3Font) { 46057 return this.handler.sendWithPromise("commonobj", [objId, "FontType3Res", imgData], [imgData.data.buffer]); 46058 } 46059 46060 this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], [imgData.data.buffer]); 46061 return undefined; 46062 }).catch(reason => { 46063 (0, _util.warn)("Unable to decode image: " + reason); 46064 46065 if (this.parsingType3Font) { 46066 return this.handler.sendWithPromise("commonobj", [objId, "FontType3Res", null]); 46067 } 46068 46069 this.handler.send("obj", [objId, this.pageIndex, "Image", null]); 46070 return undefined; 46071 }); 46072 46073 if (this.parsingType3Font) { 46074 await imgPromise; 46075 } 46076 46077 operatorList.addOp(_util.OPS.paintImageXObject, args); 46078 46079 if (cacheKey) { 46080 imageCache[cacheKey] = { 46081 fn: _util.OPS.paintImageXObject, 46082 args 46083 }; 46084 } 46085 46086 return undefined; 46087 }, 46088 46089 handleSMask: function PartialEvaluator_handleSmask(smask, resources, operatorList, task, stateManager) { 46090 var smaskContent = smask.get("G"); 46091 var smaskOptions = { 46092 subtype: smask.get("S").name, 46093 backdrop: smask.get("BC") 46094 }; 46095 var transferObj = smask.get("TR"); 46096 46097 if ((0, _function.isPDFFunction)(transferObj)) { 46098 const transferFn = this.pdfFunctionFactory.create(transferObj); 46099 var transferMap = new Uint8Array(256); 46100 var tmp = new Float32Array(1); 46101 46102 for (var i = 0; i < 256; i++) { 46103 tmp[0] = i / 255; 46104 transferFn(tmp, 0, tmp, 0); 46105 transferMap[i] = tmp[0] * 255 | 0; 46106 } 46107 46108 smaskOptions.transferMap = transferMap; 46109 } 46110 46111 return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone()); 46112 }, 46113 46114 handleTilingType(fn, args, resources, pattern, patternDict, operatorList, task) { 46115 const tilingOpList = new _operator_list.OperatorList(); 46116 const resourcesArray = [patternDict.get("Resources"), resources]; 46117 46118 const patternResources = _primitives.Dict.merge(this.xref, resourcesArray); 46119 46120 return this.getOperatorList({ 46121 stream: pattern, 46122 task,
46123 resources: patternResources, 46124 operatorList: tilingOpList 46125 }).then(function () { 46126 return (0, _pattern.getTilingPatternIR)({ 46127 fnArray: tilingOpList.fnArray, 46128 argsArray: tilingOpList.argsArray 46129 }, patternDict, args); 46130 }).then(function (tilingPatternIR) { 46131 operatorList.addDependencies(tilingOpList.dependencies); 46132 operatorList.addOp(fn, tilingPatternIR); 46133 }, reason => { 46134 if (reason instanceof _util.AbortException) { 46135 return; 46136 } 46137 46138 if (this.options.ignoreErrors) { 46139 this.handler.send("UnsupportedFeature", { 46140 featureId: _util.UNSUPPORTED_FEATURES.unknown 46141 }); 46142 (0, _util.warn)(`handleTilingType - ignoring pattern: "${reason}".`); 46143 return; 46144 } 46145 46146 throw reason; 46147 }); 46148 }, 46149 46150 handleSetFont: function PartialEvaluator_handleSetFont(resources, fontArgs, fontRef, operatorList, task, state) { 46151 var fontName; 46152 46153 if (fontArgs) { 46154 fontArgs = fontArgs.slice(); 46155 fontName = fontArgs[0].name; 46156 } 46157 46158 return this.loadFont(fontName, fontRef, resources).then(translated => { 46159 if (!translated.font.isType3Font) { 46160 return translated; 46161 } 46162 46163 return translated.loadType3Data(this, resources, operatorList, task).then(function () { 46164 return translated; 46165 }).catch(reason => { 46166 this.handler.send("UnsupportedFeature", { 46167 featureId: _util.UNSUPPORTED_FEATURES.font 46168 }); 46169 return new TranslatedFont("g_font_error", new _fonts.ErrorFont("Type3 font load error: " + reason), translated.font); 46170 }); 46171 }).then(translated => { 46172 state.font = translated.font; 46173 translated.send(this.handler); 46174 return translated.loadedName; 46175 }); 46176 }, 46177
46178 handleText(chars, state) { 46179 const font = state.font; 46180 const glyphs = font.charsToGlyphs(chars); 46181 46182 if (font.data) { 46183 const isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG); 46184 46185 if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) { 46186 PartialEvaluator.buildFontPaths(font, glyphs, this.handler); 46187 } 46188 } 46189 46190 return glyphs; 46191 }, 46192 46193 ensureStateFont(state) { 46194 if (state.font) { 46195 return; 46196 } 46197 46198 const reason = new _util.FormatError("Missing setFont (Tf) operator before text rendering operator."); 46199 46200 if (this.options.ignoreErrors) { 46201 this.handler.send("UnsupportedFeature", { 46202 featureId: _util.UNSUPPORTED_FEATURES.font 46203 }); 46204 (0, _util.warn)(`ensureStateFont: "${reason}".`); 46205 return; 46206 } 46207 46208 throw reason; 46209 }, 46210 46211 setGState: function PartialEvaluator_setGState(resources, gState, operatorList, task, stateManager) { 46212 var gStateObj = []; 46213 var gStateKeys = gState.getKeys(); 46214 var promise = Promise.resolve(); 46215 46216 for (var i = 0, ii = gStateKeys.length; i < ii; i++) { 46217 const key = gStateKeys[i]; 46218 const value = gState.get(key); 46219 46220 switch (key) { 46221 case "Type": 46222 break; 46223 46224 case "LW": 46225 case "LC": 46226 case "LJ": 46227 case "ML": 46228 case "D": 46229 case "RI": 46230 case "FL": 46231 case "CA": 46232 case "ca": 46233 gStateObj.push([key, value]); 46234 break; 46235 46236 case "Font": 46237 promise = promise.then(() => { 46238 return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) { 46239 operatorList.addDependency(loadedName); 46240 gStateObj.push([key, [loadedName, value[1]]]); 46241 }); 46242 }); 46243 break; 46244 46245 case "BM": 46246 gStateObj.push([key, normalizeBlendMode(value)]); 46247 break; 46248 46249 case "SMask": 46250 if ((0, _primitives.isName)(value, "None")) { 46251 gStateObj.push([key, false]); 46252 break; 46253 } 46254 46255 if ((0, _primitives.isDict)(value)) { 46256 promise = promise.then(() => { 46257 return this.handleSMask(value, resources, operatorList, task, stateManager); 46258 }); 46259 gStateObj.push([key, true]); 46260 } else { 46261 (0, _util.warn)("Unsupported SMask type"); 46262 } 46263 46264 break; 46265 46266 case "OP": 46267 case "op": 46268 case "OPM": 46269 case "BG": 46270 case "BG2": 46271 case "UCR": 46272 case "UCR2": 46273 case "TR": 46274 case "TR2": 46275 case "HT": 46276 case "SM": 46277 case "SA": 46278 case "AIS": 46279 case "TK": 46280 (0, _util.info)("graphic state operator " + key); 46281 break; 46282 46283 default: 46284 (0, _util.info)("Unknown graphic state operator " + key); 46285 break; 46286 } 46287 } 46288 46289 return promise.then(function () { 46290 if (gStateObj.length > 0) { 46291 operatorList.addOp(_util.OPS.setGState, [gStateObj]); 46292 } 46293 }); 46294 }, 46295 loadFont: function PartialEvaluator_loadFont(fontName, font, resources) { 46296 function errorFont() { 46297 return Promise.resolve(new TranslatedFont("g_font_error", new _fonts.ErrorFont("Font " + fontName + " is not available"), font)); 46298 } 46299 46300 var fontRef, 46301 xref = this.xref; 46302 46303 if (font) { 46304 if (!(0, _primitives.isRef)(font)) { 46305 throw new _util.FormatError('The "font" object should be a reference.'); 46306 } 46307 46308 fontRef = font; 46309 } else { 46310 var fontRes = resources.get("Font"); 46311 46312 if (fontRes) { 46313 fontRef = fontRes.getRaw(fontName); 46314 } 46315 } 46316 46317 if (!fontRef) { 46318 const partialMsg = `Font "${fontName || font && font.toString()}" is not available`; 46319 46320 if (!this.options.ignoreErrors && !this.parsingType3Font) { 46321 (0, _util.warn)(`${partialMsg}.`); 46322 return errorFont(); 46323 } 46324 46325 this.handler.send("UnsupportedFeature", { 46326 featureId: _util.UNSUPPORTED_FEATURES.font 46327 }); 46328 (0, _util.warn)(`${partialMsg} -- attempting to fallback to a default font.`); 46329 fontRef = PartialEvaluator.getFallbackFontDict(); 46330 } 46331 46332 if (this.fontCache.has(fontRef)) { 46333 return this.fontCache.get(fontRef); 46334 } 46335 46336 font = xref.fetchIfRef(fontRef); 46337 46338 if (!(0, _primitives.isDict)(font)) { 46339 return errorFont(); 46340 } 46341 46342 if (font.translated) { 46343 return font.translated; 46344 } 46345 46346 var fontCapability = (0, _util.createPromiseCapability)(); 46347 var preEvaluatedFont = this.preEvaluateFont(font); 46348 const { 46349 descriptor, 46350 hash 46351 } = preEvaluatedFont; 46352 var fontRefIsRef = (0, _primitives.isRef)(fontRef), 46353 fontID; 46354 46355 if (fontRefIsRef) { 46356 fontID = fontRef.toString(); 46357 } 46358 46359 if (hash && (0, _primitives.isDict)(descriptor)) { 46360 if (!descriptor.fontAliases) { 46361 descriptor.fontAliases = Object.create(null); 46362 } 46363 46364 var fontAliases = descriptor.fontAliases; 46365 46366 if (fontAliases[hash]) { 46367 var aliasFontRef = fontAliases[hash].aliasRef; 46368 46369 if (fontRefIsRef && aliasFontRef && this.fontCache.has(ali
46369asFontRef)) { 46370 this.fontCache.putAlias(fontRef, aliasFontRef); 46371 return this.fontCache.get(fontRef); 46372 } 46373 } else { 46374 fontAliases[hash] = { 46375 fontID: _fonts.Font.getFontID() 46376 }; 46377 } 46378 46379 if (fontRefIsRef) { 46380 fontAliases[hash].aliasRef = fontRef; 46381 } 46382 46383 fontID = fontAliases[hash].fontID; 46384 } 46385 46386 if (fontRefIsRef) { 46387 this.fontCache.put(fontRef, fontCapability.promise); 46388 } else { 46389 if (!fontID) { 46390 fontID = this.idFactory.createObjId(); 46391 } 46392 46393 this.fontCache.put(`id_${fontID}`, fontCapability.promise); 46394 } 46395 46396 (0, _util.assert)(fontID, 'The "fontID" must be defined.'); 46397 font.loadedName = `${this.idFactory.getDocId()}_f${fontID}`; 46398 font.translated = fontCapability.promise; 46399 var translatedPromise; 46400 46401 try { 46402 translatedPromise = this.translateFont(preEvaluatedFont); 46403 } catch (e) { 46404 translatedPromise = Promise.reject(e); 46405 } 46406 46407 translatedPromise.then(function (translatedFont) { 46408 if (translatedFont.fontType !== undefined) { 46409 var xrefFontStats = xref.stats.fontTypes; 46410 xrefFontStats[translatedFont.fontType] = true; 46411 } 46412 46413 fontCapability.resolve(new TranslatedFont(font.loadedName, translatedFont, font)); 46414 }).catch(reason => { 46415 this.handler.send("UnsupportedFeature", { 46416 featureId: _util.UNSUPPORTED_FEATURES.font 46417 }); 46418 46419 try { 46420 var fontFile3 = descriptor && descriptor.get("FontFile3"); 46421 var subtype = fontFile3 && fontFile3.get("Subtype"); 46422 var fontType = (0, _fonts.getFontType)(preEvaluatedFont.type, subtype && subtype.name); 46423 var xrefFontStats = xref.stats.fontTypes; 46424 xrefFontStats[fontType] = true; 46425 } catch (ex) {} 46426 46427 fontCapability.resolve(new TranslatedFont(font.loadedName, new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason), font)); 46428 }); 46429 return fontCapability.promise; 46430 }, 46431 46432 buildPath(operatorList, fn, args, parsingText = false) { 46433 var lastIndex = operatorList.length - 1; 46434 46435 if (!args) { 46436 args = []; 46437 } 46438 46439 if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) { 46440 if (parsingText) { 46441 (0, _util.warn)(`Encountered path operator "${fn}" inside of a text object.`); 46442 operatorList.addOp(_util.OPS.save, null); 46443 } 46444 46445 operatorList.addOp(_util.OPS.constructPath, [[fn], args]); 46446 46447 if (parsingText) { 46448 operatorList.addOp(_util.OPS.restore, null); 46449 } 46450 } else { 46451 var opArgs = operatorList.argsArray[lastIndex]; 46452 opArgs[0].push(fn); 46453 Array.prototype.push.apply(opArgs[1], args); 46454 } 46455 }, 46456 46457 parseColorSpace({ 46458 cs, 46459 resources 46460 }) { 46461 return new Promise(resolve => { 46462 resolve(_colorspace.ColorSpace.parse(cs, this.xref, resources, this.pdfFunctionFactory)); 46463 }).catch(reason => { 46464 if (reason instanceof _util.AbortException) { 46465 return null; 46466 } 46467 46468 if (this.options.ignoreErrors) { 46469 this.handler.send("UnsupportedFeature", { 46470 featureId: _util.UNSUPPORTED_FEATURES.unknown 46471 }); 46472 (0, _util.warn)(`parseColorSpace - ignoring ColorSpace: "${reason}".`); 46473 return null; 46474 } 46475 46476 throw reason; 46477 }); 46478 }, 46479 46480 async handleColorN(operatorList, fn, args, cs, patterns, resources, task) { 46481 var patternName = args[args.length - 1]; 46482 var pattern; 46483 46484 if ((0, _primitives.isName)(patternName) && (pattern = patterns.get(patternName.name))) { 46485 var dict = (0, _primitives.isStream)(pattern) ? pattern.dict : pattern; 46486 var typeNum = dict.get("PatternType"); 46487 46488 if (typeNum === TILING_PATTERN) { 46489 var color = cs.base ? cs.base.getRgb(args, 0) : null; 46490 return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task); 46491 } else if (typeNum === SHADING_PATTERN) { 46492 var shading = dict.get("Shading"); 46493 var matrix = dict.getArray("Matrix"); 46494 pattern = _pattern.Pattern.parseShading(shading, matrix, this.xref, resources, this.handler, this.pdfFunctionFactory); 46495 operatorList.addOp(fn, pattern.getIR()); 46496 return undefined; 46497 } 46498 46499 throw new _util.FormatError(`Unknown PatternType: ${typeNum}`); 46500 } 46501 46502 throw new _util.FormatError(`Unknown PatternName: ${patternName}`); 46503 }, 46504 46505 getOperatorList({ 46506 stream, 46507 task, 46508 resources, 46509 operatorList, 46510 initialState = null 46511 }) { 46512 resources = resources || _primitives.Dict.empty; 46513 initialState = initialState || new EvalState(); 46514 46515 if (!operatorList) { 46516 throw new Error('getOperatorList: missing "operatorList" parameter'); 46517 } 46518 46519 var self = this; 46520 var xref = this.xref; 46521 let parsingText = false;
46522 var imageCache = Object.create(null); 46523 46524 var xobjs = resources.get("XObject") || _primitives.Dict.empty; 46525 46526 var patterns = resources.get("Pattern") || _primitives.Dict.empty; 46527 46528 var stateManager = new StateManager(initialState); 46529 var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager); 46530 var timeSlotManager = new TimeSlotManager(); 46531 46532 function closePendingRestoreOPS(argument) { 46533 for (var i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) { 46534 operatorList.addOp(_util.OPS.restore, []); 46535 } 46536 } 46537 46538 return new Promise(function promiseBody(resolve, reject) { 46539 const next = function (promise) { 46540 Promise.all([promise, operatorList.ready]).then(function () { 46541 try { 46542 promiseBody(resolve, reject); 46543 } catch (ex) { 46544 reject(ex); 46545 } 46546 }, reject); 46547 }; 46548 46549 task.ensureNotTerminated(); 46550 timeSlotManager.reset(); 46551 var stop, 46552 operation = {}, 46553 i, 46554 ii, 46555 cs; 46556 46557 while (!(stop = timeSlotManager.check())) { 46558 operation.args = null; 46559 46560 if (!preprocessor.read(operation)) { 46561 break; 46562 } 46563 46564 var args = operation.args; 46565 var fn = operation.fn; 46566 46567 switch (fn | 0) { 46568 case _util.OPS.paintXObject: 46569 var name = args[0].name; 46570 46571 if (name && imageCache[name] !== undefined) { 46572 operatorList.addOp(imageCache[name].fn, imageCache[name].args); 46573 args = null; 46574 continue; 46575 } 46576 46577 next(new Promise(function (resolveXObject, rejectXObject) { 46578 if (!name) { 46579 throw new _util.FormatError("XObject must be referred to by name."); 46580 } 46581 46582 const xobj = xobjs.get(name); 46583 46584 if (!xobj) { 46585 operatorList.addOp(fn, args); 46586 resolveXObject(); 46587 return; 46588 } 46589 46590 if (!(0, _primitives.isStream)(xobj)) { 46591 throw new _util.FormatError("XObject should be a stream"); 46592 } 46593 46594 const type = xobj.dict.get("Subtype"); 46595 46596 if (!(0, _primitives.isName)(type)) { 46597 throw new _util.FormatError("XObject should have a Name subtype"); 46598 } 46599 46600 if (type.name === "Form") { 46601 stateManager.save(); 46602 self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone()).then(function () { 46603 stateManager.restore(); 46604 resolveXObject(); 46605 }, rejectXObject); 46606 return; 46607 } else if (type.name === "Image") { 46608 self.buildPaintImageXObject({ 46609 resources, 46610 image: xobj, 46611 operatorList, 46612 cacheKey: name, 46613 imageCache 46614 }).then(resolveXObject, rejectXObject); 46615 return; 46616 } else if (type.name === "PS") { 46617 (0, _util.info)("Ignored XObject subtype PS"); 46618 } else { 46619 throw new _util.FormatError(`Unhandled XObject subtype ${type.name}`); 46620 } 46621 46622 resolveXObject(); 46623 }).catch(function (reason) { 46624 if (reason instanceof _util.AbortException) { 46625 return; 46626 } 46627 46628 if (self.options.ignoreErrors) { 46629 self.handler.send("UnsupportedFeature", { 46630 featureId: _util.UNSUPPORTED_FEATURES.unknown 46631 }); 46632 (0, _util.warn)(`getOperatorList - ignoring XObject: "${reason}".`); 46633 return; 46634 } 46635 46636 throw reason; 46637 })); 46638 return; 46639 46640 case _util.OPS.setFont: 46641 var fontSize = args[1]; 46642 next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state).then(function (loadedName) { 46643 operatorList.addDependency(loadedName); 46644 operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]); 46645 })); 46646 return; 46647 46648 case _util.OPS.beginText: 46649 parsingText = true; 46650 break; 46651 46652 case _util.OPS.endText: 46653 parsingText = false;
46654 break; 46655 46656 case _util.OPS.endInlineImage: 46657 var cacheKey = args[0].cacheKey; 46658 46659 if (cacheKey) { 46660 var cacheEntry = imageCache[cacheKey]; 46661 46662 if (cacheEntry !== undefined) { 46663 operatorList.addOp(cacheEntry.fn, cacheEntry.args); 46664 args = null; 46665 continue; 46666 } 46667 } 46668 46669 next(self.buildPaintImageXObject({ 46670 resources, 46671 image: args[0], 46672 isInline: true, 46673 operatorList, 46674 cacheKey, 46675 imageCache 46676 })); 46677 return; 46678 46679 case _util.OPS.showText: 46680 if (!stateManager.state.font) { 46681 self.ensureStateFont(stateManager.state); 46682 continue; 46683 } 46684 46685 args[0] = self.handleText(args[0], stateManager.state); 46686 break; 46687 46688 case _util.OPS.showSpacedText: 46689 if (!stateManager.state.font) { 46690 self.ensureStateFont(stateManager.state); 46691 continue; 46692 } 46693 46694 var arr = args[0]; 46695 var combinedGlyphs = []; 46696 var arrLength = arr.length; 46697 var state = stateManager.state; 46698 46699 for (i = 0; i < arrLength; ++i) { 46700 var arrItem = arr[i]; 46701 46702 if ((0, _util.isString)(arrItem)) { 46703 Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state)); 46704 } else if ((0, _util.isNum)(arrItem)) { 46705 combinedGlyphs.push(arrItem); 46706 } 46707 } 46708 46709 args[0] = combinedGlyphs; 46710 fn = _util.OPS.showText; 46711 break; 46712 46713 case _util.OPS.nextLineShowText: 46714 if (!stateManager.state.font) { 46715 self.ensureStateFont(stateManager.state); 46716 continue; 46717 } 46718 46719 operatorList.addOp(_util.OPS.nextLine); 46720 args[0] = self.handleText(args[0], stateManager.state); 46721 fn = _util.OPS.showText; 46722 break; 46723 46724 case _util.OPS.nextLineSetSpacingShowText: 46725 if (!stateManager.state.font) { 46726 self.ensureStateFont(stateManager.state); 46727 continue; 46728 } 46729 46730 operatorList.addOp(_util.OPS.nextLine); 46731 operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]); 46732 operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]); 46733 args[0] = self.handleText(args[0], stateManager.state); 46734 fn = _util.OPS.showText; 46735 break; 46736 46737 case _util.OPS.setTextRenderingMode: 46738 stateManager.state.textRenderingMode = args[0]; 46739 break; 46740 46741 case _util.OPS.setFillColorSpace: 46742 next(self.parseColorSpace({ 46743 cs: args[0], 46744 resources 46745 }).then(function (colorSpace) { 46746 if (colorSpace) { 46747 stateManager.state.fillColorSpace = colorSpace; 46748 } 46749 })); 46750 return; 46751 46752 case _util.OPS.setStrokeColorSpace: 46753 next(self.parseColorSpace({ 46754 cs: args[0], 46755 resources 46756 }).then(function (colorSpace) { 46757 if (colorSpace) { 46758 stateManager.state.strokeColorSpace = colorSpace; 46759 } 46760 })); 46761 return; 46762 46763 case _util.OPS.setFillColor: 46764 cs = stateManager.state.fillColorSpace; 46765 args = cs.getRgb(args, 0); 46766 fn = _util.OPS.setFillRGBColor; 46767 break; 46768 46769 case _util.OPS.setStrokeColor: 46770 cs = stateManager.state.strokeColorSpace; 46771 args = cs.getRgb(args, 0); 46772 fn = _util.OPS.setStrokeRGBColor; 46773 break; 46774 46775 case _util.OPS.setFillGray: 46776 stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray; 46777 args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0); 46778 fn = _util.OPS.setFillRGBColor; 46779 break; 46780 46781 case _util.OPS.setStrokeGray: 46782 stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray; 46783 args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0); 46784 fn = _util.OPS.setStrokeRGBColor; 46785 break; 46786 46787 case _util.OPS.setFillCMYKColor: 46788 stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk; 46789 args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0); 46790 fn = _util.OPS.setFillRGBColor; 46791 break; 46792 46793 case _util.OPS.setStrokeCMYKColor: 46794 stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk; 46795 args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0); 46796 fn = _util.OPS.setStrokeRGBColor; 46797 break; 46798 46799 case _util.OPS.setFillRGBColor: 46800 stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb; 46801 args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0); 46802 break; 46803 46804 case _util.OPS.setStrokeRGBColor: 46805 stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb; 46806 args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0); 46807 break; 46808 46809 case _util.OPS.setFillColorN: 46810 cs = stateManager.state.fillColorSpace; 46811 46812 if (cs.name === "Pattern") { 46813 next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task)); 46814 return; 46815 } 46816 46817 args = cs.getRgb(args, 0); 46818 fn = _util.OPS.setFillRGBColor; 46819 break; 46820 46821 case _util.OPS.setStrokeColorN: 46822 cs = stateManager.state.strokeColorSpace; 46823 46824 if (cs.name === "Pattern") { 46825 next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task)); 46826 return; 46827 } 46828 46829 args = cs.getRgb(args, 0); 46830 fn = _util.OPS.setStrokeRGBColor; 46831 break; 46832 46833 case _util.OPS.shadingFill: 46834 var shadingRes = resources.get("Shading"); 46835 46836 if (!shadingRes) { 46837 throw new _util.FormatError("No shading resource found"); 46838 } 46839 46840 var shading = shadingRes.get(args[0].name); 46841 46842 if (!shading) { 46843 throw new _util.FormatError("No shading object found"); 46844 } 46845 46846 var shadingFill = _pattern.Pattern.parseShading(shading, null, xref, resources, self.handler, self.pdfFunctionFactory); 46847 46848 var patternIR = shadingFill.getIR(); 46849 args = [patternIR]; 46850 fn = _util.OPS.shadingFill; 46851 break; 46852 46853 case _util.OPS.setGState: 46854 var dictName = args[0];
46855 var extGState = resources.get("ExtGState"); 46856 46857 if (!(0, _primitives.isDict)(extGState) || !extGState.has(dictName.name)) { 46858 break; 46859 } 46860 46861 var gState = extGState.get(dictName.name); 46862 next(self.setGState(resources, gState, operatorList, task, stateManager)); 46863 return; 46864 46865 case _util.OPS.moveTo: 46866 case _util.OPS.lineTo: 46867 case _util.OPS.curveTo: 46868 case _util.OPS.curveTo2: 46869 case _util.OPS.curveTo3: 46870 case _util.OPS.closePath: 46871 case _util.OPS.rectangle: 46872 self.buildPath(operatorList, fn, args, parsingText); 46873 continue; 46874 46875 case _util.OPS.markPoint: 46876 case _util.OPS.markPointProps: 46877 case _util.OPS.beginMarkedContent: 46878 case _util.OPS.beginMarkedContentProps: 46879 case _util.OPS.endMarkedContent: 46880 case _util.OPS.beginCompat: 46881 case _util.OPS.endCompat: 46882 continue; 46883 46884 default: 46885 if (args !== null) { 46886 for (i = 0, ii = args.length; i < ii; i++) { 46887 if (args[i] instanceof _primitives.Dict) { 46888 break; 46889 } 46890 } 46891 46892 if (i < ii) { 46893 (0, _util.warn)("getOperatorList - ignoring operator: " + fn); 46894 continue; 46895 } 46896 } 46897 46898 } 46899 46900 operatorList.addOp(fn, args); 46901 } 46902 46903 if (stop) { 46904 next(deferred); 46905 return; 46906 } 46907 46908 closePendingRestoreOPS(); 46909 resolve(); 46910 }).catch(reason => { 46911 if (reason instanceof _util.AbortException) { 46912 return; 46913 } 46914 46915 if (this.options.ignoreErrors) { 46916 this.handler.send("UnsupportedFeature", { 46917 featureId: _util.UNSUPPORTED_FEATURES.unknown 46918 }); 46919 (0, _util.warn)(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`); 46920 closePendingRestoreOPS(); 46921 return; 46922 } 46923 46924 throw reason; 46925 }); 46926 }, 46927 46928 getTextContent({ 46929 stream, 46930 task, 46931 resources, 46932 stateManager = null, 46933 normalizeWhitespace = false, 46934 combineTextItems = false, 46935 sink, 46936 seenStyles = Object.create(null) 46937 }) { 46938 resources = resources || _primitives.Dict.empty; 46939 stateManager = stateManager || new StateManager(new TextState()); 46940 var WhitespaceRegexp = /\s/g; 46941 var textContent = { 46942 items: [], 46943 styles: Object.create(null) 46944 }; 46945 var textContentItem = { 46946 initialized: false, 46947 str: [], 46948 width: 0, 46949 height: 0, 46950 vertical: false, 46951 lastAdvanceWidth: 0, 46952 lastAdvanceHeight: 0, 46953 textAdvanceScale: 0, 46954 spaceWidth: 0, 46955 fakeSpaceMin: Infinity, 46956 fakeMultiSpaceMin: Infinity, 46957 fakeMultiSpaceMax: -0, 46958 textRunBreakAllowed: false, 46959 transform: null, 46960 fontName: null 46961 }; 46962 var SPACE_FACTOR = 0.3; 46963 var MULTI_SPACE_FACTOR = 1.5; 46964 var MULTI_SPACE_FACTOR_MAX = 4; 46965 var self = this; 46966 var xref = this.xref; 46967 var xobjs = null; 46968 var skipEmptyXObjs = Object.create(null); 46969 var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager); 46970 var textState; 46971 46972 function ensureTextContentItem() { 46973 if (textContentItem.initialized) { 46974 return textContentItem; 46975 } 46976 46977 var font = textState.font; 46978 46979 if (!(font.loadedName in seenStyles)) { 46980 seenStyles[font.loadedName] = true; 46981 textContent.styles[font.loadedName] = { 46982 fontFamily: font.fallbackName, 46983 ascent: font.ascent, 46984 descent: font.descent, 46985 vertical: !!font.vertical 46986 }; 46987 } 46988 46989 textContentItem.fontName = font.loadedName; 46990 var tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise]; 46991 46992 if (font.isType3Font && textState.fontSize <= 1 && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) { 46993 const glyphHeight = font.bbox[3] - font.bbox[1]; 46994 46995 if (glyphHeight > 0) { 46996 tsm[3] *= glyphHeight * textState.fontMatrix[3]; 46997 } 46998 } 46999 47000 var trm = _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm)); 47001 47002 textContentItem.transform = trm; 47003 47004 if (!font.vertical) { 47005 textContentItem.width = 0; 47006 textContentItem.height = Math.sqrt(trm[2] * trm[2] + trm[3] * trm[3]); 47007 textContentItem.vertical = false;
47008 } else { 47009 textContentItem.width = Math.sqrt(trm[0] * trm[0] + trm[1] * trm[1]); 47010 textContentItem.height = 0; 47011 textContentItem.vertical = true; 47012 } 47013 47014 var a = textState.textLineMatrix[0]; 47015 var b = textState.textLineMatrix[1]; 47016 var scaleLineX = Math.sqrt(a * a + b * b); 47017 a = textState.ctm[0]; 47018 b = textState.ctm[1]; 47019 var scaleCtmX = Math.sqrt(a * a + b * b); 47020 textContentItem.textAdvanceScale = scaleCtmX * scaleLineX; 47021 textContentItem.lastAdvanceWidth = 0; 47022 textContentItem.lastAdvanceHeight = 0; 47023 var spaceWidth = font.spaceWidth / 1000 * textState.fontSize; 47024 47025 if (spaceWidth) { 47026 textContentItem.spaceWidth = spaceWidth; 47027 textContentItem.fakeSpaceMin = spaceWidth * SPACE_FACTOR; 47028 textContentItem.fakeMultiSpaceMin = spaceWidth * MULTI_SPACE_FACTOR; 47029 textContentItem.fakeMultiSpaceMax = spaceWidth * MULTI_SPACE_FACTOR_MAX; 47030 textContentItem.textRunBreakAllowed = !font.isMonospace; 47031 } else { 47032 textContentItem.spaceWidth = 0; 47033 textContentItem.fakeSpaceMin = Infinity; 47034 textContentItem.fakeMultiSpaceMin = Infinity; 47035 textContentItem.fakeMultiSpaceMax = 0; 47036 textContentItem.textRunBreakAllowed = false; 47037 } 47038 47039 textContentItem.initialized = true; 47040 return textContentItem; 47041 } 47042 47043 function replaceWhitespace(str) { 47044 var i = 0, 47045 ii = str.length, 47046 code; 47047 47048 while (i < ii && (code = str.charCodeAt(i)) >= 0x20 && code <= 0x7f) { 47049 i++; 47050 } 47051 47052 return i < ii ? str.replace(WhitespaceRegexp, " ") : str; 47053 } 47054 47055 function runBidiTransform(textChunk) { 47056 var str = textChunk.str.join(""); 47057 var bidiResult = (0, _bidi.bidi)(str, -1, textChunk.vertical); 47058 return { 47059 str: normalizeWhitespace ? replaceWhitespace(bidiResult.str) : bidiResult.str, 47060 dir: bidiResult.dir, 47061 width: textChunk.width, 47062 height: textChunk.height, 47063 transform: textChunk.transform, 47064 fontName: textChunk.fontName 47065 }; 47066 } 47067 47068 function handleSetFont(fontName, fontRef) { 47069 return self.loadFont(fontName, fontRef, resources).then(function (translated) { 47070 textState.font = translated.font; 47071 textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX; 47072 }); 47073 } 47074 47075 function buildTextContentItem(chars) { 47076 var font = textState.font; 47077 var textChunk = ensureTextContentItem(); 47078 var width = 0; 47079 var height = 0; 47080 var glyphs = font.charsToGlyphs(chars); 47081 47082 for (var i = 0; i < glyphs.length; i++) { 47083 var glyph = glyphs[i]; 47084 var glyphWidth = null; 47085 47086 if (font.vertical && glyph.vmetric) { 47087 glyphWidth = glyph.vmetric[0]; 47088 } else { 47089 glyphWidth = glyph.width; 47090 } 47091 47092 var glyphUnicode = glyph.unicode; 47093 var NormalizedUnicodes = (0, _unicode.getNormalizedUnicodes)(); 47094 47095 if (NormalizedUnicodes[glyphUnicode] !== undefined) { 47096 glyphUnicode = NormalizedUnicodes[glyphUnicode]; 47097 } 47098 47099 glyphUnicode = (0, _unicode.reverseIfRtl)(glyphUnicode); 47100 var charSpacing = textState.charSpacing; 47101 47102 if (glyph.isSpace) { 47103 var wordSpacing = textState.wordSpacing; 47104 charSpacing += wordSpacing; 47105 47106 if (wordSpacing > 0) { 47107 addFakeSpaces(wordSpacing, textChunk.str); 47108 } 47109 } 47110 47111 var tx = 0; 47112 var ty = 0; 47113 47114 if (!font.vertical) { 47115 var w0 = glyphWidth * textState.fontMatrix[0]; 47116 tx = (w0 * textState.fontSize + charSpacing) * textState.textHScale; 47117 width += tx; 47118 } else { 47119 var w1 = glyphWidth * textState.fontMatrix[0]; 47120 ty = w1 * textState.fontSize + charSpacing; 47121 height += ty; 47122 } 47123 47124 textState.translateTextMatrix(tx, ty); 47125 textChunk.str.push(glyphUnicode); 47126 } 47127 47128 if (!font.vertical) { 47129 textChunk.lastAdvanceWidth = width; 47130 textChunk.width += width; 47131 } else { 47132 textChunk.lastAdvanceHeight = height; 47133 textChunk.height += Math.abs(height); 47134 } 47135 47136 return textChunk; 47137 } 47138 47139 function addFakeSpaces(width, strBuf) { 47140 if (width < textContentItem.fakeSpaceMin) { 47141 return; 47142 } 47143 47144 if (width < textContentItem.fakeMultiSpaceMin) { 47145 strBuf.push(" "); 47146 return; 47147 } 47148 47149 var fakeSpaces = Math.round(width / textContentItem.spaceWi
47149dth); 47150 47151 while (fakeSpaces-- > 0) { 47152 strBuf.push(" "); 47153 } 47154 } 47155 47156 function flushTextContentItem() { 47157 if (!textContentItem.initialized) { 47158 return; 47159 } 47160 47161 if (!textContentItem.vertical) { 47162 textContentItem.width *= textContentItem.textAdvanceScale; 47163 } else { 47164 textContentItem.height *= textContentItem.textAdvanceScale; 47165 } 47166 47167 textContent.items.push(runBidiTransform(textContentItem)); 47168 textContentItem.initialized = false; 47169 textContentItem.str.length = 0; 47170 } 47171 47172 function enqueueChunk() { 47173 const length = textContent.items.length; 47174 47175 if (length > 0) { 47176 sink.enqueue(textContent, length); 47177 textContent.items = []; 47178 textContent.styles = Object.create(null); 47179 } 47180 } 47181 47182 var timeSlotManager = new TimeSlotManager(); 47183 return new Promise(function promiseBody(resolve, reject) { 47184 const next = function (promise) { 47185 enqueueChunk(); 47186 Promise.all([promise, sink.ready]).then(function () { 47187 try { 47188 promiseBody(resolve, reject); 47189 } catch (ex) { 47190 reject(ex); 47191 } 47192 }, reject); 47193 }; 47194 47195 task.ensureNotTerminated(); 47196 timeSlotManager.reset(); 47197 var stop, 47198 operation = {}, 47199 args = []; 47200 47201 while (!(stop = timeSlotManager.check())) { 47202 args.length = 0; 47203 operation.args = args; 47204 47205 if (!preprocessor.read(operation)) { 47206 break; 47207 } 47208 47209 textState = stateManager.state; 47210 var fn = operation.fn; 47211 args = operation.args; 47212 var advance, diff; 47213 47214 switch (fn | 0) { 47215 case _util.OPS.setFont: 47216 var fontNameArg = args[0].name, 47217 fontSizeArg = args[1]; 47218 47219 if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) { 47220 break; 47221 } 47222 47223 flushTextContentItem(); 47224 textState.fontName = fontNameArg; 47225 textState.fontSize = fontSizeArg; 47226 next(handleSetFont(fontNameArg, null)); 47227 return; 47228 47229 case _util.OPS.setTextRise: 47230 flushTextContentItem(); 47231 textState.textRise = args[0]; 47232 break; 47233 47234 case _util.OPS.setHScale: 47235 flushTextContentItem(); 47236 textState.textHScale = args[0] / 100; 47237 break; 47238 47239 case _util.OPS.setLeading: 47240 flushTextContentItem(); 47241 textState.leading = args[0]; 47242 break; 47243 47244 case _util.OPS.moveText: 47245 var isSameTextLine = !textState.font ? false : (textState.font.vertical ? args[0] : args[1]) === 0; 47246 advance = args[0] - args[1]; 47247 47248 if (combineTextItems && isSameTextLine && textContentItem.initialized && advance > 0 && advance <= textContentItem.fakeMultiSpaceMax) { 47249 textState.translateTextLineMatrix(args[0], args[1]); 47250 textContentItem.width += args[0] - textContentItem.lastAdvanceWidth; 47251 textContentItem.height += args[1] - textContentItem.lastAdvanceHeight; 47252 diff = args[0] - textContentItem.lastAdvanceWidth - (args[1] - textContentItem.lastAdvanceHeight); 47253 addFakeSpaces(diff, textContentItem.str); 47254 break; 47255 } 47256 47257 flushTextContentItem(); 47258 textState.translateTextLineMatrix(args[0], args[1]);
vendor: 1,954 bytes, lines 47259-47301
47259 textState.textMatrix = textState.textLineMatrix.slice(); 47260 break; 47261 47262 case _util.OPS.setLeadingMoveText: 47263 flushTextContentItem(); 47264 textState.leading = -args[1]; 47265 textState.translateTextLineMatrix(args[0], args[1]); 47266 textState.textMatrix = textState.textLineMatrix.slice(); 47267 break; 47268 47269 case _util.OPS.nextLine: 47270 flushTextContentItem(); 47271 textState.carriageReturn(); 47272 break; 47273 47274 case _util.OPS.setTextMatrix: 47275 advance = textState.calcTextLineMatrixAdvance(args[0], args[1], args[2], args[3], args[4], args[5]); 47276 47277 if (combineTextItems && advance !== null && textContentItem.initialized && advance.value > 0 && advance.value <= textContentItem.fakeMultiSpaceMax) { 47278 textState.translateTextLineMatrix(advance.width, advance.height); 47279 textContentItem.width += advance.width - textContentItem.lastAdvanceWidth; 47280 textContentItem.height += advance.height - textContentItem.lastAdvanceHeight; 47281 diff = advance.width - textContentItem.lastAdvanceWidth - (advance.height - textContentItem.lastAdvanceHeight); 47282 addFakeSpaces(diff, textContentItem.str); 47283 break; 47284 } 47285 47286 flushTextContentItem(); 47287 textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]); 47288 textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]); 47289 break; 47290 47291 case _util.OPS.setCharSpacing: 47292 textState.charSpacing = args[0]; 47293 break; 47294 47295 case _util.OPS.setWordSpacing: 47296 textState.wordSpacing = args[0]; 47297 break; 47298 47299 case _util.OPS.beginText: 47300 flushTextContentItem(); 47301 textState.textMatrix = _util.IDENTITY_MATRIX.slice();
47302 textState.textLineMatrix = _util.IDENTITY_MATRIX.slice(); 47303 break; 47304 47305 case _util.OPS.showSpacedText: 47306 if (!stateManager.state.font) { 47307 self.ensureStateFont(stateManager.state); 47308 continue; 47309 } 47310 47311 var items = args[0]; 47312 var offset; 47313 47314 for (var j = 0, jj = items.length; j < jj; j++) { 47315 if (typeof items[j] === "string") { 47316 buildTextContentItem(items[j]); 47317 } else if ((0, _util.isNum)(items[j])) { 47318 ensureTextContentItem(); 47319 advance = items[j] * textState.fontSize / 1000; 47320 var breakTextRun = false; 47321 47322 if (textState.font.vertical) { 47323 offset = advance; 47324 textState.translateTextMatrix(0, offset); 47325 breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax; 47326 47327 if (!breakTextRun) { 47328 textContentItem.height += offset; 47329 } 47330 } else { 47331 advance = -advance; 47332 offset = advance * textState.textHScale; 47333 textState.translateTextMatrix(offset, 0); 47334 breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax; 47335 47336 if (!breakTextRun) { 47337 textContentItem.width += offset; 47338 } 47339 } 47340 47341 if (breakTextRun) { 47342 flushTextContentItem(); 47343 } else if (advance > 0) { 47344 addFakeSpaces(advance, textContentItem.str); 47345 } 47346 } 47347 } 47348 47349 break; 47350 47351 case _util.OPS.showText: 47352 if (!stateManager.state.font) { 47353 self.ensureStateFont(stateManager.state); 47354 continue; 47355 } 47356 47357 buildTextContentItem(args[0]); 47358 break; 47359 47360 case _util.OPS.nextLineShowText: 47361 if (!stateManager.state.font) { 47362 self.ensureStateFont(stateManager.state); 47363 continue; 47364 } 47365 47366 flushTextContentItem(); 47367 textState.carriageReturn(); 47368 buildTextContentItem(args[0]); 47369 break; 47370 47371 case _util.OPS.nextLineSetSpacingShowText: 47372 if (!stateManager.state.font) { 47373 self.ensureStateFont(stateManager.state); 47374 continue; 47375 } 47376 47377 flushTextContentItem(); 47378 textState.wordSpacing = args[0]; 47379 textState.charSpacing = args[1]; 47380 textState.carriageReturn(); 47381 buildTextContentItem(args[2]); 47382 break; 47383 47384 case _util.OPS.paintXObject: 47385 flushTextContentItem(); 47386 47387 if (!xobjs) { 47388 xobjs = resources.get("XObject") || _primitives.Dict.empty; 47389 } 47390 47391 var name = args[0].name; 47392 47393 if (name && skipEmptyXObjs[name] !== undefined) { 47394 break; 47395 } 47396 47397 next(new Promise(function (resolveXObject, rejectXObject) { 47398 if (!name) { 47399 throw new _util.FormatError("XObject must be referred to by name."); 47400 } 47401 47402 const xobj = xobjs.get(name); 47403 47404 if (!xobj) { 47405 resolveXObject(); 47406 return; 47407 } 47408 47409 if (!(0, _primitives.isStream)(xobj)) { 47410 throw new _util.FormatError("XObject should be a stream"); 47411 } 47412 47413 const type = xobj.dict.get("Subtype"); 47414 47415 if (!(0, _primitives.isName)(type)) { 47416 throw new _util.FormatError("XObject should have a Name subtype"); 47417 } 47418 47419 if (type.name !== "Form") { 47420 skipEmptyXObjs[name] = true; 47421 resolveXObject(); 47422 return; 47423 } 47424 47425 const currentState = stateManager.state.clone(); 47426 const xObjStateManager = new StateManager(currentState); 47427 const matrix = xobj.dict.getArray("Matrix"); 47428 47429 if (Array.isArray(matrix) && matrix.length === 6) { 47430 xObjStateManager.transform(matrix); 47431 } 47432 47433 enqueueChunk(); 47434 const sinkWrapper = {
47435 enqueueInvoked: false, 47436 47437 enqueue(chunk, size) { 47438 this.enqueueInvoked = true; 47439 sink.enqueue(chunk, size); 47440 }, 47441 47442 get desiredSize() { 47443 return sink.desiredSize; 47444 }, 47445 47446 get ready() { 47447 return sink.ready; 47448 } 47449 47450 }; 47451 self.getTextContent({ 47452 stream: xobj, 47453 task, 47454 resources: xobj.dict.get("Resources") || resources, 47455 stateManager: xObjStateManager, 47456 normalizeWhitespace, 47457 combineTextItems, 47458 sink: sinkWrapper, 47459 seenStyles 47460 }).then(function () { 47461 if (!sinkWrapper.enqueueInvoked) { 47462 skipEmptyXObjs[name] = true; 47463 } 47464 47465 resolveXObject(); 47466 }, rejectXObject); 47467 }).catch(function (reason) { 47468 if (reason instanceof _util.AbortException) { 47469 return; 47470 } 47471 47472 if (self.options.ignoreErrors) { 47473 (0, _util.warn)(`getTextContent - ignoring XObject: "${reason}".`); 47474 return; 47475 } 47476 47477 throw reason; 47478 })); 47479 return; 47480 47481 case _util.OPS.setGState: 47482 flushTextContentItem(); 47483 var dictName = args[0]; 47484 var extGState = resources.get("ExtGState"); 47485 47486 if (!(0, _primitives.isDict)(extGState) || !(0, _primitives.isName)(dictName)) { 47487 break; 47488 } 47489 47490 var gState = extGState.get(dictName.name); 47491 47492 if (!(0, _primitives.isDict)(gState)) { 47493 break; 47494 } 47495 47496 var gStateFont = gState.get("Font"); 47497 47498 if (gStateFont) { 47499 textState.fontName = null; 47500 textState.fontSize = gStateFont[1]; 47501 next(handleSetFont(null, gStateFont[0])); 47502 return; 47503 } 47504 47505 break; 47506 } 47507 47508 if (textContent.items.length >= sink.desiredSize) { 47509 stop = true; 47510 break; 47511 } 47512 } 47513 47514 if (stop) { 47515 next(deferred); 47516 return; 47517 } 47518 47519 flushTextContentItem(); 47520 enqueueChunk(); 47521 resolve(); 47522 }).catch(reason => { 47523 if (reason instanceof _util.AbortException) { 47524 return; 47525 } 47526 47527 if (this.options.ignoreErrors) { 47528 (0, _util.warn)(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`); 47529 flushTextContentItem(); 47530 enqueueChunk(); 47531 return; 47532 } 47533 47534 throw reason; 47535 }); 47536 }, 47537 47538 extractDataStructures: function PartialEvaluator_extractDataStructures(dict, baseDict, properties) { 47539 const xref = this.xref; 47540 let cidToGidBytes; 47541 var toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode"); 47542 var toUnicodePromise = toUnicode ? this.readToUnicode(toUnicode) : Promise.resolve(undefined); 47543 47544 if (properties.composite) { 47545 var cidSystemInfo = dict.get("CIDSystemInfo"); 47546 47547 if ((0, _primitives.isDict)(cidSystemInfo)) { 47548 properties.cidSystemInfo = { 47549 registry: (0, _util.stringToPDFString)(cidSystemInfo.get("Registry")), 47550 ordering: (0, _util.stringToPDFString)(cidSystemInfo.get("Ordering")), 47551 supplement: cidSystemInfo.get("Supplement") 47552 }; 47553 } 47554 47555 var cidToGidMap = dict.get("CIDToGIDMap"); 47556 47557 if ((0, _primitives.isStream)(cidToGidMap)) { 47558 cidToGidBytes = cidToGidMap.getBytes(); 47559 } 47560 } 47561 47562 var differences = []; 47563 var baseEncodingName = null; 47564 var encoding; 47565 47566 if (dict.has("Encoding")) { 47567 encoding = dict.get("Encoding"); 47568 47569 if ((0, _primitives.isDict)(encoding)) { 47570 baseEncodingName = encoding.get("BaseEncoding"); 47571 baseEncodingName = (0, _primitives.isName)(baseEncodingName) ? baseEncodingName.name : null; 47572 47573 if (encoding.has("Differences")) { 47574 var diffEncoding = encoding.get("Differences"); 47575 var index = 0; 47576 47577 for (var j = 0, jj = diffEncoding.length; j < jj; j++) { 47578 var data = xref.fetchIfRef(diffEncoding[j]); 47579 47580 if ((0, _util.isNum)(data)) { 47581 index = data; 47582 } else if ((0, _primitives.isName)(data)) { 47583 differences[index++] = data.name; 47584 } else { 47585 throw new _util.FormatError(`Invalid entry in 'Differences' array: ${data}`); 47586 } 47587 } 47588 } 47589 } else if ((0, _primitives.isName)(encoding)) { 47590 baseEncodingName = encoding.name; 47591 } else { 47592 throw new _util.FormatError("Encoding is not a Name nor a Dict"); 47593 } 47594 47595 if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") { 47596 baseEncodingName = null; 47597 } 47598 } 47599 47600 if (baseEncodingName) { 47601 properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName).slice(); 47602 } else { 47603 var isSymbolicFont = !!(properties.flags & _fonts.FontFlags.Symbolic); 47604 var isNonsymbolicFont = !!(properties.flags & _fonts.FontFlags.Nonsymbolic); 47605 encoding = _encodings.StandardEncoding; 47606 47607 if (properties.type === "TrueType" && !isNonsymbolicFont) { 47608 encoding = _encodings.WinAnsiEncoding; 47609 } 47610 47611 if (isSymbolicFont) { 47612 encoding = _encodings.MacRomanEncoding; 47613 47614 if (!properties.file) { 47615 if (/Symbol/i.test(properties.name)) { 47616 encoding = _encodings.SymbolSetEncoding; 47617 } else if (/Dingbats|Wingdings/i.test(properties.name)) { 47618 encoding = _encodings.ZapfDingbatsEncoding; 47619 } 47620 } 47621 } 47622 47623 properties.defaultEncoding = encoding; 47624 } 47625 47626 properties.differences = differences; 47627 properties.baseEncodingName = baseEncodingName; 47628 properties.hasEncoding = !!baseEncodingName || differences.length > 0; 47629 properties.dict = dict; 47630 return toUnicodePromise.then(toUnicode => { 47631 properties.toUnicode = toUnicode; 47632 return this.buildToUnicode(properties); 47633 }).then(toUnicode => { 47634 properties.toUnicode = toUnicode; 47635 47636 if (cidToGidBytes) { 47637 properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, toUnicode); 47638 } 47639 47640 return properties; 47641 }); 47642 }, 47643 47644 _buildSimpleFontToUnicode(properties, forceGlyphs = false) { 47645 (0, _util.assert)(!properties.composite, "Must be a simple font."); 47646 const toUnicode = []; 47647 const encoding = properties.defaultEncoding.slice(); 47648 const baseEncodingName = properties.baseEncodingName; 47649 const differences = properties.differences; 47650 47651 for (const charcode in differences) { 47652 const glyphName = differences[charcode]; 47653 47654 if (glyphName === ".notdef") { 47655 continue; 47656 } 47657 47658 encoding[charcode] = glyphName; 47659 } 47660 47661 const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 47662 47663 for (const charcode in encoding) { 47664 let glyphName = encoding[charcode]; 47665 47666 if (glyphName === "") { 47667 continue; 47668 } else if (glyphsUnicodeMap[glyphName] === undefined) { 47669 let code = 0; 47670 47671 switch (glyphName[0]) { 47672 case "G": 47673 if (glyphName.length === 3) { 47674 code = parseInt(glyphName.substring(1), 16); 47675 } 47676 47677 break; 47678 47679 case "g": 47680 if (glyphName.length === 5) { 47681 code = parseInt(glyphName.substring(1), 16); 47682 } 47683 47684 break; 47685 47686 case "C": 47687 case "c": 47688 if (glyphName.length >= 3 && glyphName.length <= 4) { 47689 const codeStr = glyphName.substring(1); 47690 47691 if (forceGlyphs) { 47692 code = parseInt(codeStr, 16); 47693 break; 47694 } 47695 47696 code = +codeStr; 47697 47698 if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) { 47699 return this._buildSimpleFontToUnicode(properties, true); 47700 } 47701 } 47702 47703 break; 47704 47705 default: 47706 const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap); 47707 47708 if (unicode !== -1) { 47709 code = unicode; 47710 } 47711 47712 } 47713 47714 if (code > 0 && Number.isInteger(code)) { 47715 if (baseEncodingName && code === +charcode) { 47716 const baseEncoding = (0, _encodings.getEncoding)(baseEncodingName); 47717 47718 if (baseEncoding && (glyphName = baseEncoding[charcode])) { 47719 toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]); 47720 continue; 47721 } 47722 } 47723 47724 toUnicode[charcode] = String.fromCodePoint(code); 47725 } 47726 47727 continue; 47728 } 47729 47730 toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]); 47731 } 47732 47733 return new _fonts.ToUnicodeMap(toUnicode); 47734 }, 47735 47736 buildToUnicode(properties) { 47737 properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0; 47738 47739 if (properties.hasIncludedToUnicodeMap) { 47740 if (!properties.composite && properties.hasEncoding) { 47741 properties.fallbackToUnicode = this._buildSimpleFontToUnicode(properties); 47742 } 47743 47744 return Promise.resolve(properties.toUnicode); 47745 } 47746 47747 if (!properties.composite) { 47748 return Promise.resolve(this._buildSimpleFontToUnicode(properties)); 47749 } 47750 47751 if (properties.composite && (properties.cMap.builtInCMap && !(properties.cMap instanceof _cmap.IdentityCMap) || properties.cidSystemInfo.registry === "Adobe" && (properties.cidSystemInfo.ordering === "GB1" || properties.cidSystemInfo.ordering === "CNS1" || properties.cidSystemInfo.ordering === "Japan1" || properties.cidSystemInfo.ordering === "Korea1"))) { 47752 const registry = properties.cidSystemInfo.registry; 47753 const ordering = properties.cidSystemInfo.ordering; 47754 47755 const ucs2CMapName = _primitives.Name.get(registry + "-" + ordering + "-UCS2"); 47756 47757 return _cmap.CMapFactory.create({ 47758 encoding: ucs2CMapName, 47759 fetchBuiltInCMap: this.fetchBuiltInCMap, 47760 useCMap: null 47761 }).then(function (ucs2CMap) { 47762 const cMap = properties.cMap; 47763 const toUnicode = [];
47764 cMap.forEach(function (charcode, cid) { 47765 if (cid > 0xffff) { 47766 throw new _util.FormatError("Max size of CID is 65,535"); 47767 } 47768 47769 const ucs2 = ucs2CMap.lookup(cid); 47770 47771 if (ucs2) { 47772 toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1)); 47773 } 47774 }); 47775 return new _fonts.ToUnicodeMap(toUnicode); 47776 }); 47777 } 47778 47779 return Promise.resolve(new _fonts.IdentityToUnicodeMap(properties.firstChar, properties.lastChar)); 47780 }, 47781 47782 readToUnicode: function PartialEvaluator_readToUnicode(toUnicode) { 47783 var cmapObj = toUnicode; 47784 47785 if ((0, _primitives.isName)(cmapObj)) { 47786 return _cmap.CMapFactory.create({ 47787 encoding: cmapObj, 47788 fetchBuiltInCMap: this.fetchBuiltInCMap, 47789 useCMap: null 47790 }).then(function (cmap) { 47791 if (cmap instanceof _cmap.IdentityCMap) { 47792 return new _fonts.IdentityToUnicodeMap(0, 0xffff); 47793 } 47794 47795 return new _fonts.ToUnicodeMap(cmap.getMap()); 47796 }); 47797 } else if ((0, _primitives.isStream)(cmapObj)) { 47798 return _cmap.CMapFactory.create({ 47799 encoding: cmapObj, 47800 fetchBuiltInCMap: this.fetchBuiltInCMap, 47801 useCMap: null 47802 }).then(function (cmap) { 47803 if (cmap instanceof _cmap.IdentityCMap) { 47804 return new _fonts.IdentityToUnicodeMap(0, 0xffff); 47805 } 47806 47807 var map = new Array(cmap.length); 47808 cmap.forEach(function (charCode, token) { 47809 var str = []; 47810 47811 for (var k = 0; k < token.length; k += 2) {
47812 var w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1); 47813 47814 if ((w1 & 0xf800) !== 0xd800) { 47815 str.push(w1); 47816 continue; 47817 } 47818 47819 k += 2; 47820 var w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1); 47821 str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000); 47822 } 47823 47824 map[charCode] = String.fromCodePoint.apply(String, str); 47825 }); 47826 return new _fonts.ToUnicodeMap(map); 47827 }, reason => { 47828 if (reason instanceof _util.AbortException) { 47829 return null; 47830 } 47831 47832 if (this.options.ignoreErrors) { 47833 this.handler.send("UnsupportedFeature", { 47834 featureId: _util.UNSUPPORTED_FEATURES.font 47835 }); 47836 (0, _util.warn)(`readToUnicode - ignoring ToUnicode data: "${reason}".`); 47837 return null; 47838 } 47839 47840 throw reason; 47841 }); 47842 } 47843 47844 return Promise.resolve(null); 47845 }, 47846 47847 readCidToGidMap(glyphsData, toUnicode) { 47848 var result = []; 47849 47850 for (var j = 0, jj = glyphsData.length; j < jj; j++) { 47851 var glyphID = glyphsData[j++] << 8 | glyphsData[j]; 47852 const code = j >> 1; 47853 47854 if (glyphID === 0 && !toUnicode.has(code)) { 47855 continue; 47856 } 47857 47858 result[code] = glyphID; 47859 } 47860 47861 return result; 47862 }, 47863 47864 extractWidths: function PartialEvaluator_extractWidths(dict, descriptor, properties) { 47865 var xref = this.xref; 47866 var glyphsWidths = []; 47867 var defaultWidth = 0; 47868 var glyphsVMetrics = []; 47869 var defaultVMetrics; 47870 var i, ii, j, jj, start, code, widths; 47871 47872 if (properties.composite) { 47873 defaultWidth = dict.has("DW") ? dict.get("DW") : 1000; 47874 widths = dict.get("W"); 47875 47876 if (widths) { 47877 for (i = 0, ii = widths.length; i < ii; i++) { 47878 start = xref.fetchIfRef(widths[i++]); 47879 code = xref.fetchIfRef(widths[i]); 47880 47881 if (Array.isArray(code)) { 47882 for (j = 0, jj = code.length; j < jj; j++) { 47883 glyphsWidths[start++] = xref.fetchIfRef(code[j]); 47884 } 47885 } else { 47886 var width = xref.fetchIfRef(widths[++i]); 47887 47888 for (j = start; j <= code; j++) { 47889 glyphsWidths[j] = width; 47890 } 47891 } 47892 } 47893 } 47894 47895 if (properties.vertical) { 47896 var vmetrics = dict.getArray("DW2") || [880, -1000]; 47897 defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]]; 47898 vmetrics = dict.get("W2"); 47899 47900 if (vmetrics) { 47901 for (i = 0, ii = vmetrics.length; i < ii; i++) { 47902 start = xref.fetchIfRef(vmetrics[i++]); 47903 code = xref.fetchIfRef(vmetrics[i]); 47904 47905 if (Array.isArray(code)) { 47906 for (j = 0, jj = code.length; j < jj; j++) { 47907 glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])]; 47908 } 47909 } else { 47910 var vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])]; 47911 47912 for (j = start; j <= code; j++) { 47913 glyphsVMetrics[j] = vmetric; 47914 } 47915 } 47916 } 47917 } 47918 } 47919 } else { 47920 var firstChar = properties.firstChar; 47921 widths = dict.get("Widths"); 47922 47923 if (widths) { 47924 j = firstChar; 47925 47926 for (i = 0, ii = widths.length; i < ii; i++) { 47927 glyphsWidths[j++] = xref.fetchIfRef(widths[i]); 47928 } 47929 47930 defaultWidth = parseFloat(descriptor.get("MissingWidth")) || 0; 47931 } else { 47932 var baseFontName = dict.get("BaseFont"); 47933 47934 if ((0, _primitives.isName)(baseFontName)) { 47935 var metrics = this.getBaseFontMetrics(baseFontName.name); 47936 glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties); 47937 defaultWidth = metrics.defaultWidth; 47938 } 47939 } 47940 } 47941 47942 var isMonospace = true; 47943 var firstWidth = defaultWidth; 47944 47945 for (var glyph in glyphsWidths) { 47946 var glyphWidth = glyphsWidths[glyph]; 47947 47948 if (!glyphWidth) { 47949 continue; 47950 } 47951 47952 if (!firstWidth) { 47953 firstWidth = glyphWidth; 47954 continue; 47955 } 47956 47957 if (firstWidth !== glyphWidth) { 47958 isMonospace = false;
47959 break; 47960 } 47961 } 47962 47963 if (isMonospace) { 47964 properties.flags |= _fonts.FontFlags.FixedPitch; 47965 } 47966 47967 properties.defaultWidth = defaultWidth; 47968 properties.widths = glyphsWidths; 47969 properties.defaultVMetrics = defaultVMetrics; 47970 properties.vmetrics = glyphsVMetrics; 47971 }, 47972 isSerifFont: function PartialEvaluator_isSerifFont(baseFontName) { 47973 var fontNameWoStyle = baseFontName.split("-")[0]; 47974 return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || fontNameWoStyle.search(/serif/gi) !== -1; 47975 }, 47976 getBaseFontMetrics: function PartialEvaluator_getBaseFontMetrics(name) { 47977 var defaultWidth = 0; 47978 var widths = []; 47979 var monospace = false; 47980 var stdFontMap = (0, _standard_fonts.getStdFontMap)(); 47981 var lookupName = stdFontMap[name] || name; 47982 var Metrics = (0, _metrics.getMetrics)(); 47983 47984 if (!(lookupName in Metrics)) { 47985 if (this.isSerifFont(name)) { 47986 lookupName = "Times-Roman"; 47987 } else { 47988 lookupName = "Helvetica"; 47989 } 47990 } 47991 47992 var glyphWidths = Metrics[lookupName]; 47993 47994 if ((0, _util.isNum)(glyphWidths)) { 47995 defaultWidth = glyphWidths; 47996 monospace = true; 47997 } else { 47998 widths = glyphWidths(); 47999 } 48000 48001 return { 48002 defaultWidth, 48003 monospace, 48004 widths 48005 }; 48006 }, 48007 buildCharCodeToWidth: function PartialEvaluator_bulildCharCodeToWidth(widthsByGlyphName, properties) { 48008 var widths = Object.create(null); 48009 var differences = properties.differences; 48010 var encoding = properties.defaultEncoding; 48011 48012 for (var charCode = 0; charCode < 256; charCode++) { 48013 if (charCode in differences && widthsByGlyphName[differences[charCode]]) { 48014 widths[charCode] = widthsByGlyphName[differences[charCode]]; 48015 continue; 48016 } 48017 48018 if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) { 48019 widths[charCode] = widthsByGlyphName[encoding[charCode]]; 48020 continue; 48021 } 48022 } 48023 48024 return widths; 48025 }, 48026 preEvaluateFont: function PartialEvaluator_preEvaluateFont(dict) { 48027 var baseDict = dict; 48028 var type = dict.get("Subtype"); 48029 48030 if (!(0, _primitives.isName)(type)) { 48031 throw new _util.FormatError("invalid font Subtype"); 48032 } 48033 48034 var composite = false; 48035 var uint8array; 48036 48037 if (type.name === "Type0") { 48038 var df = dict.get("DescendantFonts"); 48039 48040 if (!df) { 48041 throw new _util.FormatError("Descendant fonts are not specified"); 48042 } 48043 48044 dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df; 48045 type = dict.get("Subtype"); 48046 48047 if (!(0, _primitives.isName)(type)) { 48048 throw new _util.FormatError("invalid font Subtype"); 48049 } 48050 48051 composite = true; 48052 } 48053 48054 var descriptor = dict.get("FontDescriptor"); 48055 48056 if (descriptor) { 48057 var hash = new _murmurhash.MurmurHash3_64(); 48058 var encoding = baseDict.getRaw("Encoding"); 48059 48060 if ((0, _primitives.isName)(encoding)) { 48061 hash.update(encoding.name); 48062 } else if ((0, _primitives.isRef)(encoding)) { 48063 hash.update(encoding.toString()); 48064 } else if ((0, _primitives.isDict)(encoding)) { 48065 var keys = encoding.getKeys(); 48066 48067 for (var i = 0, ii = keys.length; i < ii; i++) { 48068 var entry = encoding.getRaw(keys[i]); 48069 48070 if ((0, _primitives.isName)(entry)) { 48071 hash.update(entry.name); 48072 } else if ((0, _primitives.isRef)(entry)) { 48073 hash.update(entry.toString()); 48074 } else if (Array.isArray(entry)) { 48075 var diffLength = entry.length, 48076 diffBuf = new Array(diffLength); 48077 48078 for (var j = 0; j < diffLength; j++) { 48079 var diffEntry = entry[j]; 48080 48081 if ((0, _primitives.isName)(diffEntry)) { 48082 diffBuf[j] = diffEntry.name; 48083 } else if ((0, _util.isNum)(diffEntry) || (0, _primitives.isRef)(diffEntry)) { 48084 diffBuf[j] = diffEntry.toString(); 48085 } 48086 } 48087 48088 hash.update(diffBuf.join()); 48089 } 48090 } 48091 } 48092 48093 const firstChar = dict.get("FirstChar") || 0; 48094 const lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff); 48095 hash.update(`${firstChar}-${lastChar}`); 48096 var toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode"); 48097 48098 if ((0, _primitives.isStream)(toUnicode)) { 48099 var stream = toUnicode.str || toUnicode; 48100 uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start); 48101 hash.update(uint8array); 48102 } else if ((0, _primitives.isName)(toUnicode)) { 48103 hash.update(toUnicode.name); 48104 } 48105 48106 var widths = dict.get("Widths") || baseDict.get("Widths"); 48107 48108 if (widths) { 48109 uint8array = new Uint8Array(new Uint32Array(widths).buffer); 48110 hash.update(uint8array); 48111 } 48112 } 48113 48114 return { 48115 descriptor, 48116 dict, 48117 baseDict, 48118 composite,
48119 type: type.name, 48120 hash: hash ? hash.hexdigest() : "" 48121 }; 48122 }, 48123 translateFont: function PartialEvaluator_translateFont(preEvaluatedFont) { 48124 var baseDict = preEvaluatedFont.baseDict; 48125 var dict = preEvaluatedFont.dict; 48126 var composite = preEvaluatedFont.composite; 48127 var descriptor = preEvaluatedFont.descriptor; 48128 var type = preEvaluatedFont.type; 48129 var maxCharIndex = composite ? 0xffff : 0xff; 48130 var properties; 48131 const firstChar = dict.get("FirstChar") || 0; 48132 const lastChar = dict.get("LastChar") || maxCharIndex; 48133 48134 if (!descriptor) { 48135 if (type === "Type3") { 48136 descriptor = new _primitives.Dict(null); 48137 descriptor.set("FontName", _primitives.Name.get(type)); 48138 descriptor.set("FontBBox", dict.getArray("FontBBox") || [0, 0, 0, 0]); 48139 } else { 48140 var baseFontName = dict.get("BaseFont"); 48141 48142 if (!(0, _primitives.isName)(baseFontName)) { 48143 throw new _util.FormatError("Base font is not specified"); 48144 } 48145 48146 baseFontName = baseFontName.name.replace(/[,_]/g, "-"); 48147 var metrics = this.getBaseFontMetrics(baseFontName); 48148 var fontNameWoStyle = baseFontName.split("-")[0]; 48149 var flags = (this.isSerifFont(fontNameWoStyle) ? _fonts.FontFlags.Serif : 0) | (metrics.monospace ? _fonts.FontFlags.FixedPitch : 0) | ((0, _standard_fonts.getSymbolsFonts)()[fontNameWoStyle] ? _fonts.FontFlags.Symbolic : _fonts.FontFlags.Nonsymbolic); 48150 properties = { 48151 type, 48152 name: baseFontName, 48153 widths: metrics.widths, 48154 defaultWidth: metrics.defaultWidth, 48155 flags, 48156 firstChar, 48157 lastChar 48158 }; 48159 const widths = dict.get("Widths"); 48160 return this.extractDataStructures(dict, dict, properties).then(properties => { 48161 if (widths) { 48162 const glyphWidths = []; 48163 let j = firstChar; 48164 48165 for (let i = 0, ii = widths.length; i < ii; i++) { 48166 glyphWidths[j++] = this.xref.fetchIfRef(widths[i]); 48167 } 48168 48169 properties.widths = glyphWidths; 48170 } else { 48171 properties.widths = this.buildCharCodeToWidth(metrics.widths, properties); 48172 } 48173 48174 return new _fonts.Font(baseFontName, null, properties); 48175 }); 48176 } 48177 } 48178 48179 var fontName = descriptor.get("FontName"); 48180 var baseFont = dict.get("BaseFont"); 48181 48182 if ((0, _util.isString)(fontName)) { 48183 fontName = _primitives.Name.get(fontName); 48184 } 48185 48186 if ((0, _util.isString)(baseFont)) { 48187 baseFont = _primitives.Name.get(baseFont); 48188 } 48189 48190 if (type !== "Type3") { 48191 var fontNameStr = fontName && fontName.name; 48192 var baseFontStr = baseFont && baseFont.name; 48193 48194 if (fontNameStr !== baseFontStr) { 48195 (0, _util.info)(`The FontDescriptor\'s FontName is "${fontNameStr}" but ` + `should be the same as the Font\'s BaseFont "${baseFontStr}".`); 48196 48197 if (fontNameStr && baseFontStr && baseFontStr.startsWith(fontNameStr)) { 48198 fontName = baseFont; 48199 } 48200 } 48201 } 48202 48203 fontName = fontName || baseFont; 48204 48205 if (!(0, _primitives.isName)(fontName)) { 48206 throw new _util.FormatError("invalid font name"); 48207 } 48208 48209 var fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3"); 48210 48211 if (fontFile) { 48212 if (fontFile.dict) { 48213 var subtype = fontFile.dict.get("Subtype"); 48214 48215 if (subtype) { 48216 subtype = subtype.name; 48217 } 48218 48219 var length1 = fontFile.dict.get("Length1"); 48220 var length2 = fontFile.dict.get("Length2"); 48221 var length3 = fontFile.dict.get("Length3"); 48222 } 48223 } 48224 48225 properties = { 48226 type, 48227 name: fontName.name, 48228 subtype, 48229 file: fontFile, 48230 length1, 48231 length2, 48232 length3, 48233 loadedName: baseDict.loadedName, 48234 composite, 48235 wideChars: composite, 48236 fixedPitch: false, 48237 fontMatrix: dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX, 48238 firstChar: firstChar || 0,
48239 lastChar: lastChar || maxCharIndex, 48240 bbox: descriptor.getArray("FontBBox"), 48241 ascent: descriptor.get("Ascent"), 48242 descent: descriptor.get("Descent"), 48243 xHeight: descriptor.get("XHeight"), 48244 capHeight: descriptor.get("CapHeight"), 48245 flags: descriptor.get("Flags"), 48246 italicAngle: descriptor.get("ItalicAngle"), 48247 isType3Font: false 48248 }; 48249 var cMapPromise; 48250 48251 if (composite) { 48252 var cidEncoding = baseDict.get("Encoding"); 48253 48254 if ((0, _primitives.isName)(cidEncoding)) { 48255 properties.cidEncoding = cidEncoding.name; 48256 } 48257 48258 cMapPromise = _cmap.CMapFactory.create({ 48259 encoding: cidEncoding, 48260 fetchBuiltInCMap: this.fetchBuiltInCMap, 48261 useCMap: null 48262 }).then(function (cMap) { 48263 properties.cMap = cMap; 48264 properties.vertical = properties.cMap.vertical; 48265 }); 48266 } else { 48267 cMapPromise = Promise.resolve(undefined); 48268 } 48269 48270 return cMapPromise.then(() => { 48271 return this.extractDataStructures(dict, baseDict, properties); 48272 }).then(properties => { 48273 this.extractWidths(dict, descriptor, properties); 48274 48275 if (type === "Type3") { 48276 properties.isType3Font = true; 48277 } 48278 48279 return new _fonts.Font(fontName.name, fontFile, properties); 48280 }); 48281 } 48282 }; 48283 48284 PartialEvaluator.buildFontPaths = function (font, glyphs, handler) { 48285 function buildPath(fontChar) { 48286 if (font.renderer.hasBuiltPath(fontChar)) { 48287 return; 48288 } 48289 48290 handler.send("commonobj", [`${font.loadedName}_path_${fontChar}`, "FontPath", font.renderer.getPathJs(fontChar)]); 48291 } 48292 48293 for (const glyph of glyphs) { 48294 buildPath(glyph.fontChar); 48295 const accent = glyph.accent; 48296 48297 if (accent && accent.fontChar) { 48298 buildPath(accent.fontChar); 48299 } 48300 } 48301 }; 48302 48303 PartialEvaluator.getFallbackFontDict = function () { 48304 if (this._fallbackFontDict) { 48305 return this._fallbackFontDict; 48306 } 48307 48308 const dict = new _primitives.Dict(); 48309 dict.set("BaseFont", _primitives.Name.get("PDFJS-FallbackFont")); 48310 dict.set("Type", _primitives.Name.get("FallbackType")); 48311 dict.set("Subtype", _primitives.Name.get("FallbackType")); 48312 dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding")); 48313 return this._fallbackFontDict = dict; 48314 }; 48315 48316 return PartialEvaluator; 48317}(); 48318 48319exports.PartialEvaluator = PartialEvaluator; 48320 48321var TranslatedFont = function TranslatedFontClosure() { 48322 function TranslatedFont(loadedName, font, dict) { 48323 this.loadedName = loadedName; 48324 this.font = font; 48325 this.dict = dict; 48326 this.type3Loaded = null; 48327 this.sent = false; 48328 } 48329 48330 TranslatedFont.prototype = { 48331 send(handler) { 48332 if (this.sent) { 48333 return; 48334 } 48335 48336 this.sent = true; 48337 handler.send("commonobj", [this.loadedName, "Font", this.font.exportData()]); 48338 }, 48339 48340 fallback(handler) { 48341 if (!this.font.data) { 48342 return; 48343 } 48344 48345 this.font.disableFontFace = true; 48346 const glyphs = this.font.glyphCacheValues; 48347 PartialEvaluator.buildFontPaths(this.font, glyphs, handler); 48348 }, 48349 48350 loadType3Data(evaluator, resources, parentOperatorList, task) { 48351 if (!this.font.isType3Font) {
48352 throw new Error("Must be a Type3 font."); 48353 } 48354 48355 if (this.type3Loaded) { 48356 return this.type3Loaded; 48357 } 48358 48359 var type3Options = Object.create(evaluator.options); 48360 type3Options.ignoreErrors = false; 48361 type3Options.nativeImageDecoderSupport = _util.NativeImageDecoding.NONE; 48362 var type3Evaluator = evaluator.clone(type3Options); 48363 type3Evaluator.parsingType3Font = true; 48364 var translatedFont = this.font; 48365 var loadCharProcsPromise = Promise.resolve(); 48366 var charProcs = this.dict.get("CharProcs"); 48367 var fontResources = this.dict.get("Resources") || resources; 48368 var charProcKeys = charProcs.getKeys(); 48369 var charProcOperatorList = Object.create(null); 48370 48371 for (var i = 0, n = charProcKeys.length; i < n; ++i) { 48372 const key = charProcKeys[i]; 48373 loadCharProcsPromise = loadCharProcsPromise.then(function () { 48374 var glyphStream = charProcs.get(key); 48375 var operatorList = new _operator_list.OperatorList(); 48376 return type3Evaluator.getOperatorList({ 48377 stream: glyphStream, 48378 task, 48379 resources: fontResources, 48380 operatorList 48381 }).then(function () { 48382 charProcOperatorList[key] = operatorList.getIR(); 48383 parentOperatorList.addDependencies(operatorList.dependencies); 48384 }).catch(function (reason) { 48385 (0, _util.warn)(`Type3 font resource "${key}" is not available.`); 48386 var operatorList = new _operator_list.OperatorList(); 48387 charProcOperatorList[key] = operatorList.getIR(); 48388 }); 48389 }); 48390 } 48391 48392 this.type3Loaded = loadCharProcsPromise.then(function () { 48393 translatedFont.charProcOperatorList = charProcOperatorList; 48394 }); 48395 return this.type3Loaded; 48396 } 48397 48398 }; 48399 return TranslatedFont; 48400}(); 48401 48402var StateManager = function StateManagerClosure() { 48403 function StateManager(initialState) { 48404 this.state = initialState; 48405 this.stateStack = []; 48406 } 48407 48408 StateManager.prototype = { 48409 save() { 48410 var old = this.state; 48411 this.stateStack.push(this.state); 48412 this.state = old.clone(); 48413 }, 48414 48415 restore() { 48416 var prev = this.stateStack.pop(); 48417 48418 if (prev) { 48419 this.state = prev; 48420 } 48421 }, 48422 48423 transform(args) { 48424 this.state.ctm = _util.Util.transform(this.state.ctm, args); 48425 } 48426 48427 }; 48428 return StateManager; 48429}(); 48430 48431var TextState = function TextStateClosure() { 48432 function TextState() { 48433 this.ctm = new Float32Array(_util.IDENTITY_MATRIX); 48434 this.fontName = null; 48435 this.fontSize = 0; 48436 this.font = null; 48437 this.fontMatrix = _util.FONT_IDENTITY_MATRIX; 48438 this.textMatrix = _util.IDENTITY_MATRIX.slice();
48439 this.textLineMatrix = _util.IDENTITY_MATRIX.slice(); 48440 this.charSpacing = 0; 48441 this.wordSpacing = 0; 48442 this.leading = 0; 48443 this.textHScale = 1; 48444 this.textRise = 0; 48445 } 48446 48447 TextState.prototype = { 48448 setTextMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) { 48449 var m = this.textMatrix; 48450 m[0] = a; 48451 m[1] = b; 48452 m[2] = c; 48453 m[3] = d; 48454 m[4] = e; 48455 m[5] = f; 48456 }, 48457 setTextLineMatrix: function TextState_setTextMatrix(a, b, c, d, e, f) { 48458 var m = this.textLineMatrix; 48459 m[0] = a; 48460 m[1] = b; 48461 m[2] = c; 48462 m[3] = d; 48463 m[4] = e; 48464 m[5] = f; 48465 }, 48466 translateTextMatrix: function TextState_translateTextMatrix(x, y) { 48467 var m = this.textMatrix; 48468 m[4] = m[0] * x + m[2] * y + m[4]; 48469 m[5] = m[1] * x + m[3] * y + m[5]; 48470 }, 48471 translateTextLineMatrix: function TextState_translateTextMatrix(x, y) { 48472 var m = this.textLineMatrix; 48473 m[4] = m[0] * x + m[2] * y + m[4]; 48474 m[5] = m[1] * x + m[3] * y + m[5]; 48475 }, 48476 calcTextLineMatr
48476ixAdvance: function TextState_calcTextLineMatrixAdvance(a, b, c, d, e, f) { 48477 var font = this.font; 48478 48479 if (!font) { 48480 return null; 48481 } 48482 48483 var m = this.textLineMatrix; 48484 48485 if (!(a === m[0] && b === m[1] && c === m[2] && d === m[3])) { 48486 return null; 48487 } 48488 48489 var txDiff = e - m[4], 48490 tyDiff = f - m[5]; 48491 48492 if (font.vertical && txDiff !== 0 || !font.vertical && tyDiff !== 0) { 48493 return null; 48494 } 48495 48496 var tx, 48497 ty, 48498 denominator = a * d - b * c; 48499 48500 if (font.vertical) { 48501 tx = -tyDiff * c / denominator; 48502 ty = tyDiff * a / denominator; 48503 } else { 48504 tx = txDiff * d / denominator; 48505 ty = -txDiff * b / denominator; 48506 } 48507 48508 return { 48509 width: tx, 48510 height: ty, 48511 value: font.vertical ? ty : tx 48512 }; 48513 }, 48514 calcRenderMatrix: function TextState_calcRendeMatrix(ctm) { 48515 var tsm = [this.fontSize * this.textHScale, 0, 0, this.fontSize, 0, this.textRise]; 48516 return _util.Util.transform(ctm, _util.Util.transform(this.textMatrix, tsm)); 48517 }, 48518 carriageReturn: function TextState_carriageReturn() { 48519 this.translateTextLineMatrix(0, -this.leading);
48520 this.textMatrix = this.textLineMatrix.slice(); 48521 }, 48522 clone: function TextState_clone() { 48523 var clone = Object.create(this); 48524 clone.textMatrix = this.textMatrix.slice(); 48525 clone.textLineMatrix = this.textLineMatrix.slice(); 48526 clone.fontMatrix = this.fontMatrix.slice(); 48527 return clone; 48528 } 48529 }; 48530 return TextState; 48531}(); 48532 48533var EvalState = function EvalStateClosure() { 48534 function EvalState() { 48535 this.ctm = new Float32Array(_util.IDENTITY_MATRIX); 48536 this.font = null; 48537 this.textRenderingMode = _util.TextRenderingMode.FILL; 48538 this.fillColorSpace = _colorspace.ColorSpace.singletons.gray; 48539 this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray; 48540 } 48541 48542 EvalState.prototype = { 48543 clone: function CanvasExtraState_clone() { 48544 return Object.create(this); 48545 } 48546 }; 48547 return EvalState; 48548}(); 48549 48550var EvaluatorPreprocessor = function EvaluatorPreprocessorClosure() { 48551 var getOPMap = (0, _core_utils.getLookupTableFactory)(function (t) { 48552 t["w"] = { 48553 id: _util.OPS.setLineWidth, 48554 numArgs: 1, 48555 variableArgs: false 48556 }; 48557 t["J"] = { 48558 id: _util.OPS.setLineCap, 48559 numArgs: 1, 48560 variableArgs: false 48561 }; 48562 t["j"] = { 48563 id: _util.OPS.setLineJoin, 48564 numArgs: 1, 48565 variableArgs: false 48566 }; 48567 t["M"] = { 48568 id: _util.OPS.setMiterLimit, 48569 numArgs: 1, 48570 variableArgs: false 48571 }; 48572 t["d"] = { 48573 id: _util.OPS.setDash, 48574 numArgs: 2, 48575 variableArgs: false 48576 }; 48577 t["ri"] = { 48578 id: _util.OPS.setRenderingIntent, 48579 numArgs: 1, 48580 variableArgs: false 48581 }; 48582 t["i"] = { 48583 id: _util.OPS.setFlatness, 48584 numArgs: 1, 48585 variableArgs: false 48586 }; 48587 t["gs"] = { 48588 id: _util.OPS.setGState, 48589 numArgs: 1, 48590 variableArgs: false 48591 }; 48592 t["q"] = { 48593 id: _util.OPS.save, 48594 numArgs: 0, 48595 variableArgs: false 48596 }; 48597 t["Q"] = { 48598 id: _util.OPS.restore, 48599 numArgs: 0, 48600 variableArgs: false 48601 }; 48602 t["cm"] = { 48603 id: _util.OPS.transform, 48604 numArgs: 6, 48605 variableArgs: false 48606 }; 48607 t["m"] = { 48608 id: _util.OPS.moveTo, 48609 numArgs: 2, 48610 variableArgs: false 48611 }; 48612 t["l"] = { 48613 id: _util.OPS.lineTo, 48614 numArgs: 2, 48615 variableArgs: false 48616 }; 48617 t["c"] = { 48618 id: _util.OPS.curveTo, 48619 numArgs: 6, 48620 variableArgs: false 48621 }; 48622 t["v"] = { 48623 id: _util.OPS.curveTo2, 48624 numArgs: 4, 48625 variableArgs: false 48626 }; 48627 t["y"] = { 48628 id: _util.OPS.curveTo3, 48629 numArgs: 4, 48630 variableArgs: false 48631 }; 48632 t["h"] = { 48633 id: _util.OPS.closePath, 48634 numArgs: 0, 48635 variableArgs: false 48636 }; 48637 t["re"] = { 48638 id: _util.OPS.rectangle, 48639 numArgs: 4, 48640 variableArgs: false 48641 }; 48642 t["S"] = { 48643 id: _util.OPS.stroke, 48644 numArgs: 0, 48645 variableArgs: false 48646 }; 48647 t["s"] = { 48648 id: _util.OPS.closeStroke, 48649 numArgs: 0, 48650 variableArgs: false 48651 }; 48652 t["f"] = { 48653 id: _util.OPS.fill, 48654 numArgs: 0, 48655 variableArgs: false 48656 }; 48657 t["F"] = { 48658 id: _util.OPS.fill, 48659 numArgs: 0, 48660 variableArgs: false 48661 }; 48662 t["f*"] = { 48663 id: _util.OPS.eoFill, 48664 numArgs: 0, 48665 variableArgs: false 48666 }; 48667 t["B"] = { 48668 id: _util.OPS.fillStroke, 48669 numArgs: 0, 48670 variableArgs: false 48671 }; 48672 t["B*"] = { 48673 id: _util.OPS.eoFillStroke, 48674 numArgs: 0, 48675 variableArgs: false 48676 }; 48677 t["b"] = { 48678 id: _util.OPS.closeFillStroke, 48679 numArgs: 0, 48680 variableArgs: false 48681 }; 48682 t["b*"] = { 48683 id: _util.OPS.closeEOFillStroke, 48684 numArgs: 0, 48685 variableArgs: false 48686 }; 48687 t["n"] = { 48688 id: _util.OPS.endPath, 48689 numArgs: 0, 48690 variableArgs: false 48691 }; 48692 t["W"] = { 48693 id: _util.OPS.clip, 48694 numArgs: 0, 48695 variableArgs: false 48696 }; 48697 t["W*"] = { 48698 id: _util.OPS.eoClip, 48699 numArgs: 0, 48700 variableArgs: false 48701 }; 48702 t["BT"] = { 48703 id: _util.OPS.beginText, 48704 numArgs: 0, 48705 variableArgs: false 48706 }; 48707 t["ET"] = { 48708 id: _util.OPS.endText, 48709 numArgs: 0, 48710 variableArgs: false 48711 }; 48712 t["Tc"] = { 48713 id: _util.OPS.setCharSpacing, 48714 numArgs: 1, 48715 variableArgs: false 48716 }; 48717 t["Tw"] = { 48718 id: _util.OPS.setWordSpacing, 48719 numArgs: 1, 48720 variableArgs: false 48721 }; 48722 t["Tz"] = { 48723 id: _util.OPS.setHScale, 48724 numArgs: 1, 48725 variableArgs: false 48726 }; 48727 t["TL"] = { 48728 id: _util.OPS.setLeading, 48729 numArgs: 1, 48730 variableArgs: false 48731 }; 48732 t["Tf"] = { 48733 id: _util.OPS.setFont, 48734 numArgs: 2, 48735 variableArgs: false 48736 }; 48737 t["Tr"] = { 48738 id: _util.OPS.setTextRenderingMode, 48739 numArgs: 1, 48740 variableArgs: false 48741 }; 48742 t["Ts"] = { 48743 id: _util.OPS.setTextRise, 48744 numArgs: 1, 48745 variableArgs: false 48746 }; 48747 t["Td"] = { 48748 id: _util.OPS.moveText, 48749 numArgs: 2, 48750 variableArgs: false 48751 }; 48752 t["TD"] = { 48753 id: _util.OPS.setLeadingMoveText, 48754 numArgs: 2, 48755 variableArgs: false 48756 }; 48757 t["Tm"] = { 48758 id: _util.OPS.setTextMatrix, 48759 numArgs: 6, 48760 variableArgs: false 48761 }; 48762 t["T*"] = { 48763 id: _util.OPS.nextLine, 48764 numArgs: 0, 48765 variableArgs: false 48766 }; 48767 t["Tj"] = { 48768 id: _util.OPS.showText, 48769 numArgs: 1, 48770 variableArgs: false 48771 }; 48772 t["TJ"] = { 48773 id: _util.OPS.showSpacedText, 48774 numArgs: 1, 48775 variableArgs: false 48776 }; 48777 t["'"] = { 48778 id: _util.OPS.nextLineShowText, 48779 numArgs: 1, 48780 variableArgs: false 48781 }; 48782 t['"'] = { 48783 id: _util.OPS.nextLineSetSpacingShowText, 48784 numArgs: 3, 48785 variableArgs: false 48786 }; 48787 t["d0"] = { 48788 id: _util.OPS.setCharWidth, 48789 numArgs: 2, 48790 variableArgs: false 48791 }; 48792 t["d1"] = { 48793 id: _util.OPS.setCharWidthAndBounds, 48794 numArgs: 6, 48795 variableArgs: false 48796 }; 48797 t["CS"] = { 48798 id: _util.OPS.setStrokeColorSpace, 48799 numArgs: 1, 48800 variableArgs: false 48801 }; 48802 t["cs"] = { 48803 id: _util.OPS.setFillColorSpace, 48804 numArgs: 1, 48805 variableArgs: false 48806 };
48807 t["SC"] = { 48808 id: _util.OPS.setStrokeColor, 48809 numArgs: 4, 48810 variableArgs: true 48811 }; 48812 t["SCN"] = { 48813 id: _util.OPS.setStrokeColorN, 48814 numArgs: 33, 48815 variableArgs: true 48816 }; 48817 t["sc"] = { 48818 id: _util.OPS.setFillColor, 48819 numArgs: 4, 48820 variableArgs: true 48821 }; 48822 t["scn"] = { 48823 id: _util.OPS.setFillColorN, 48824 numArgs: 33, 48825 variableArgs: true 48826 }; 48827 t["G"] = { 48828 id: _util.OPS.setStrokeGray, 48829 numArgs: 1, 48830 variableArgs: false 48831 }; 48832 t["g"] = { 48833 id: _util.OPS.setFillGray, 48834 numArgs: 1, 48835 variableArgs: false 48836 }; 48837 t["RG"] = { 48838 id: _util.OPS.setStrokeRGBColor, 48839 numArgs: 3, 48840 variableArgs: false 48841 }; 48842 t["rg"] = { 48843 id: _util.OPS.setFillRGBColor, 48844 numArgs: 3, 48845 variableArgs: false 48846 }; 48847 t["K"] = { 48848 id: _util.OPS.setStrokeCMYKColor, 48849 numArgs: 4, 48850 variableArgs: false 48851 }; 48852 t["k"] = { 48853 id: _util.OPS.setFillCMYKColor, 48854 numArgs: 4, 48855 variableArgs: false 48856 }; 48857 t["sh"] = { 48858 id: _util.OPS.shadingFill, 48859 numArgs: 1, 48860 variableArgs: false 48861 }; 48862 t["BI"] = { 48863 id: _util.OPS.beginInlineImage, 48864 numArgs: 0, 48865 variableArgs: false 48866 }; 48867 t["ID"] = { 48868 id: _util.OPS.beginImageData, 48869 numArgs: 0, 48870 variableArgs: false 48871 }; 48872 t["EI"] = { 48873 id: _util.OPS.endInlineImage, 48874 numArgs: 1, 48875 variableArgs: false 48876 }; 48877 t["Do"] = { 48878 id: _util.OPS.paintXObject, 48879 numArgs: 1, 48880 variableArgs: false 48881 }; 48882 t["MP"] = { 48883 id: _util.OPS.markPoint, 48884 numArgs: 1, 48885 variableArgs: false 48886 }; 48887 t["DP"] = { 48888 id: _util.OPS.markPointProps, 48889 numArgs: 2, 48890 variableArgs: false 48891 }; 48892 t["BMC"] = { 48893 id: _util.OPS.beginMarkedContent, 48894 numArgs: 1, 48895 variableArgs: false 48896 }; 48897 t["BDC"] = { 48898 id: _util.OPS.beginMarkedContentProps, 48899 numArgs: 2, 48900 variableArgs: false 48901 }; 48902 t["EMC"] = { 48903 id: _util.OPS.endMarkedContent, 48904 numArgs: 0, 48905 variableArgs: false 48906 }; 48907 t["BX"] = { 48908 id: _util.OPS.beginCompat, 48909 numArgs: 0, 48910 variableArgs: false 48911 }; 48912 t["EX"] = { 48913 id: _util.OPS.endCompat, 48914 numArgs: 0, 48915 variableArgs: false 48916 }; 48917 t["BM"] = null; 48918 t["BD"] = null; 48919 t["true"] = null; 48920 t["fa"] = null; 48921 t["fal"] = null; 48922 t["fals"] = null; 48923 t["false"] = null; 48924 t["nu"] = null; 48925 t["nul"] = null; 48926 t["null"] = null; 48927 }); 48928 const MAX_INVALID_PATH_OPS = 20; 48929 48930 function EvaluatorPreprocessor(stream, xref, stateManager) { 48931 this.opMap = getOPMap(); 48932 this.parser = new _parser.Parser({ 48933 lexer: new _parser.Lexer(stream, this.opMap), 48934 xref 48935 }); 48936 this.stateManager = stateManager; 48937 this.nonProcessedArgs = []; 48938 this._numInvalidPathOPS = 0; 48939 } 48940 48941 EvaluatorPreprocessor.prototype = { 48942 get savedStatesDepth() { 48943 return this.stateManager.stateStack.length; 48944 }, 48945 48946 read: function EvaluatorPreprocessor_read(operation) { 48947 var args = operation.args; 48948 48949 while (true) { 48950 var obj = this.parser.getObj(); 48951 48952 if (obj instanceof _primitives.Cmd) { 48953 var cmd = obj.cmd; 48954 var opSpec = this.opMap[cmd]; 48955 48956 if (!opSpec) { 48957 (0, _util.warn)(`Unknown command "${cmd}".`); 48958 continue; 48959 } 48960 48961 var fn = opSpec.id; 48962 var numArgs = opSpec.numArgs; 48963 var argsLength = args !== null ? args.length : 0; 48964 48965 if (!opSpec.variableArgs) { 48966 if (argsLength !== numArgs) { 48967 var nonProcessedArgs = this.nonProcessedArgs; 48968 48969 while (argsLength > numArgs) { 48970 nonProcessedArgs.push(args.shift()); 48971 argsLength--; 48972 } 48973 48974 while (argsLength < numArgs && nonProcessedArgs.length !== 0) { 48975 if (args === null) { 48976 args = []; 48977 } 48978 48979 args.unshift(nonProcessedArgs.pop()); 48980 argsLength++; 48981 } 48982 } 48983 48984 if (argsLength < numArgs) { 48985 const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`; 48986 48987 if (fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath && ++this._numInvalidPathOPS >
48987 MAX_INVALID_PATH_OPS) { 48988 throw new _util.FormatError(`Invalid ${partialMsg}`); 48989 } 48990 48991 (0, _util.warn)(`Skipping ${partialMsg}`); 48992 48993 if (args !== null) { 48994 args.length = 0; 48995 } 48996 48997 continue; 48998 } 48999 } else if (argsLength > numArgs) { 49000 (0, _util.info)(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`); 49001 } 49002 49003 this.preprocessCommand(fn, args); 49004 operation.fn = fn; 49005 operation.args = args; 49006 return true; 49007 } 49008 49009 if (obj === _primitives.EOF) { 49010 return false; 49011 } 49012 49013 if (obj !== null) { 49014 if (args === null) { 49015 args = []; 49016 } 49017 49018 args.push(obj); 49019 49020 if (args.length > 33) { 49021 throw new _util.FormatError("Too many arguments"); 49022 } 49023 } 49024 } 49025 }, 49026 preprocessCommand: function EvaluatorPreprocessor_preprocessCommand(fn, args) { 49027 switch (fn | 0) { 49028 case _util.OPS.save: 49029 this.stateManager.save(); 49030 break; 49031 49032 case _util.OPS.restore: 49033 this.stateManager.restore(); 49034 break; 49035 49036 case _util.OPS.transform: 49037 this.stateManager.transform(args); 49038 break; 49039 } 49040 } 49041 }; 49042 return EvaluatorPreprocessor; 49043}(); 49044 49045/***/ }), 49046/* 26 */ 49047/***/ (function(module, exports, __w_pdfjs_require__) { 49048 49049"use strict"; 49050 49051 49052Object.defineProperty(exports, "__esModule", { 49053 value: true 49054}); 49055exports.CMapFactory = exports.IdentityCMap = exports.CMap = void 0; 49056 49057var _util = __w_pdfjs_require__(2); 49058 49059var _primitives = __w_pdfjs_require__(4); 49060 49061var _parser = __w_pdfjs_require__(10); 49062 49063var _core_utils = __w_pdfjs_require__(7); 49064 49065var _stream = __w_pdfjs_require__(11); 49066 49067var 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"]; 49068 49069class CMap { 49070 constructor(builtInCMap = false) { 49071 this.codespaceRanges = [[], [], [], []]; 49072 this.numCodespaceRanges = 0; 49073 this._map = []; 49074 this.name = ""; 49075 this.vertical = false;
49076 this.useCMap = null; 49077 this.builtInCMap = builtInCMap; 49078 } 49079 49080 addCodespaceRange(n, low, high) { 49081 this.codespaceRanges[n - 1].push(low, high); 49082 this.numCodespaceRanges++; 49083 } 49084 49085 mapCidRange(low, high, dstLow) { 49086 while (low <= high) { 49087 this._map[low++] = dstLow++; 49088 } 49089 } 49090 49091 mapBfRange(low, high, dstLow) { 49092 var lastByte = dstLow.length - 1; 49093 49094 while (low <= high) { 49095 this._map[low++] = dstLow; 49096 dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1); 49097 } 49098 } 49099 49100 mapBfRangeToArray(low, high, array) { 49101 const ii = array.length; 49102 let i = 0; 49103 49104 while (low <= high && i < ii) { 49105 this._map[low] = array[i++]; 49106 ++low; 49107 } 49108 } 49109 49110 mapOne(src, dst) { 49111 this._map[src] = dst; 49112 } 49113 49114 lookup(code) { 49115 return this._map[code]; 49116 } 49117 49118 contains(code) { 49119 return this._map[code] !== undefined; 49120 } 49121 49122 forEach(callback) { 49123 const map = this._map; 49124 const length = map.length; 49125 49126 if (length <= 0x10000) { 49127 for (let i = 0; i < length; i++) { 49128 if (map[i] !== undefined) { 49129 callback(i, map[i]); 49130 } 49131 } 49132 } else { 49133 for (const i in map) { 49134 callback(i, map[i]); 49135 } 49136 } 49137 } 49138 49139 charCodeOf(value) { 49140 const map = this._map; 49141 49142 if (map.length <= 0x10000) { 49143 return map.indexOf(value); 49144 } 49145 49146 for (const charCode in map) { 49147 if (map[charCode] === value) { 49148 return charCode | 0; 49149 } 49150 } 49151 49152 return -1; 49153 } 49154 49155 getMap() { 49156 return this._map; 49157 } 49158
49159 readCharCode(str, offset, out) { 49160 let c = 0; 49161 const codespaceRanges = this.codespaceRanges; 49162 49163 for (let n = 0, nn = codespaceRanges.length; n < nn; n++) { 49164 c = (c << 8 | str.charCodeAt(offset + n)) >>> 0; 49165 const codespaceRange = codespaceRanges[n]; 49166 49167 for (let k = 0, kk = codespaceRange.length; k < kk;) { 49168 const low = codespaceRange[k++]; 49169 const high = codespaceRange[k++]; 49170 49171 if (c >= low && c <= high) { 49172 out.charcode = c; 49173 out.length = n + 1; 49174 return; 49175 } 49176 } 49177 } 49178 49179 out.charcode = 0; 49180 out.length = 1; 49181 } 49182 49183 get length() { 49184 return this._map.length; 49185 } 49186 49187 get isIdentityCMap() { 49188 if (!(this.name === "Identity-H" || this.name === "Identity-V")) { 49189 return false; 49190 } 49191 49192 if (this._map.length !== 0x10000) { 49193 return false; 49194 } 49195 49196 for (let i = 0; i < 0x10000; i++) { 49197 if (this._map[i] !== i) { 49198 return false; 49199 } 49200 } 49201 49202 return true; 49203 } 49204 49205} 49206 49207exports.CMap = CMap; 49208 49209class IdentityCMap extends CMap { 49210 constructor(vertical, n) { 49211 super(); 49212 this.vertical = vertical; 49213 this.addCodespaceRange(n, 0, 0xffff); 49214 } 49215 49216 mapCidRange(low, high, dstLow) { 49217 (0, _util.unreachable)("should not call mapCidRange"); 49218 } 49219 49220 mapBfRange(low, high, dstLow) { 49221 (0, _util.unreachable)("should not call mapBfRange"); 49222 } 49223 49224 mapBfRangeToArray(low, high, array) { 49225 (0, _util.unreachable)("should not call mapBfRangeToArray"); 49226 } 49227 49228 mapOne(src, dst) { 49229 (0, _util.unreachable)("should not call mapCidOne"); 49230 } 49231 49232 lookup(code) { 49233 return Number.isInteger(code) && code <= 0xffff ? code : undefined; 49234 } 49235 49236 contains(code) { 49237 return Number.isInteger(code) && code <= 0xffff; 49238 } 49239 49240 forEach(callback) { 49241 for (let i = 0; i <= 0xffff; i++) { 49242 callback(i, i); 49243 } 49244 } 49245 49246 charCodeOf(value) { 49247 return Number.isInteger(value) && value <= 0xffff ? value : -1; 49248 } 49249 49250 getMap() { 49251 const map = new Array(0x10000); 49252 49253 for (let i = 0; i <= 0xffff; i++) { 49254 map[i] = i; 49255 } 49256 49257 return map; 49258 } 49259 49260 get length() { 49261 return 0x10000; 49262 } 49263 49264 get isIdentityCMap() { 49265 (0, _util.unreachable)("should not access .isIdentityCMap"); 49266 } 49267 49268} 49269 49270exports.IdentityCMap = IdentityCMap; 49271 49272var BinaryCMapReader = function BinaryCMapReaderClosure() { 49273 function hexToInt(a, size) { 49274 var n = 0; 49275 49276 for (var i = 0; i <= size; i++) { 49277 n = n << 8 | a[i]; 49278 } 49279 49280 return n >>> 0; 49281 } 49282 49283 function hexToStr(a, size) { 49284 if (size === 1) { 49285 return String.fromCharCode(a[0], a[1]); 49286 } 49287 49288 if (size === 3) { 49289 return String.fromCharCode(a[0], a[1], a[2], a[3]); 49290 } 49291 49292 return String.fromCharCode.apply(null, a.subarray(0, size + 1)); 49293 } 49294 49295 function addHex(a, b, size) { 49296 var c = 0; 49297 49298 for (var i = size; i >= 0; i--) { 49299 c += a[i] + b[i]; 49300 a[i] = c & 255; 49301 c >>= 8; 49302 } 49303 } 49304 49305 function incHex(a, size) { 49306 var c = 1; 49307 49308 for (var i = size; i >= 0 && c > 0; i--) { 49309 c += a[i]; 49310 a[i] = c & 255; 49311 c >>= 8; 49312 } 49313 } 49314 49315 var MAX_NUM_SIZE = 16; 49316 var MAX_ENCODED_NUM_SIZE = 19; 49317 49318 function BinaryCMapStream(data) { 49319 this.buffer = data; 49320 this.pos = 0; 49321 this.end = data.length; 49322 this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE); 49323 } 49324 49325 BinaryCMapStream.prototype = { 49326 readByte() { 49327 if (this.pos >= this.end) { 49328 return -1; 49329 } 49330 49331 return this.buffer[this.pos++]; 49332 }, 49333 49334 readNumber() { 49335 var n = 0; 49336 var last; 49337 49338 do { 49339 var b = this.readByte(); 49340 49341 if (b < 0) { 49342 throw new _util.FormatError("unexpected EOF in bcmap"); 49343 } 49344 49345 last = !(b & 0x80); 49346 n = n << 7 | b & 0x7f; 49347 } while (!last); 49348 49349 return n; 49350 }, 49351 49352 readSigned() { 49353 var n = this.readNumber(); 49354 return n & 1 ? ~(n >>> 1) : n >>> 1; 49355 }, 49356 49357 readHex(num, size) { 49358 num.set(this.buffer.subarray(this.pos, this.pos + size + 1)); 49359 this.pos += size + 1; 49360 }, 49361 49362 readHexNumber(num, size) { 49363 var last; 49364 var stack = this.tmpBuf, 49365 sp = 0; 49366 49367 do { 49368 var b = this.readByte(); 49369 49370 if (b < 0) { 49371 throw new _util.FormatError("unexpected EOF in bcmap"); 49372 } 49373 49374 last = !(b & 0x80); 49375 stack[sp++] = b & 0x7f; 49376 } while (!last); 49377 49378 var i = size, 49379 buffer = 0, 49380 bufferSize = 0; 49381 49382 while (i >= 0) { 49383 while (bufferSize < 8 && stack.length > 0) { 49384 buffer = stack[--sp] << bufferSize | buffer; 49385 bufferSize += 7; 49386 } 49387 49388 num[i] = buffer & 255; 49389 i--; 49390 buffer >>= 8; 49391 bufferSize -= 8; 49392 } 49393 }, 49394 49395 readHexSigned(num, size) { 49396 this.readHexNumber(num, size); 49397 var sign = num[size] & 1 ? 255 : 0; 49398 var c = 0; 49399 49400 for (var i = 0; i <= size; i++) { 49401 c = (c & 1) << 8 | num[i]; 49402 num[i] = c >> 1 ^ sign; 49403 } 49404 }, 49405 49406 readString() { 49407 var len = this.readNumber(); 49408 var s = ""; 49409 49410 for (var i = 0; i < len; i++) { 49411 s += String.fromCharCode(this.readNumber()); 49412 } 49413 49414 return s; 49415 } 49416 49417 }; 49418 49419 function processBinaryCMap(data, cMap, extend) { 49420 return new Promise(function (resolve, reject) { 49421 var stream = new BinaryCMapStream(data); 49422 var header = stream.readByte(); 49423 cMap.vertical = !!(header & 1); 49424 var useCMap = null; 49425 var start = new Uint8Array(MAX_NUM_SIZE); 49426 var end = new Uint8Array(MAX_NUM_SIZE); 49427 var char = new Uint8Array(MAX_NUM_SIZE);
49428 var charCode = new Uint8Array(MAX_NUM_SIZE); 49429 var tmp = new Uint8Array(MAX_NUM_SIZE); 49430 var code; 49431 var b; 49432 49433 while ((b = stream.readByte()) >= 0) { 49434 var type = b >> 5; 49435 49436 if (type === 7) { 49437 switch (b & 0x1f) { 49438 case 0: 49439 stream.readString(); 49440 break; 49441 49442 case 1: 49443 useCMap = stream.readString(); 49444 break; 49445 } 49446 49447 continue; 49448 } 49449 49450 var sequence = !!(b & 0x10); 49451 var dataSize = b & 15; 49452 49453 if (dataSize + 1 > MAX_NUM_SIZE) { 49454 throw new Error("processBinaryCMap: Invalid dataSize."); 49455 } 49456 49457 var ucs2DataSize = 1; 49458 var subitemsCount = stream.readNumber(); 49459 var i; 49460 49461 switch (type) { 49462 case 0: 49463 stream.readHex(start, dataSize); 49464 stream.readHexNumber(end, dataSize); 49465 addHex(end, start, dataSize); 49466 cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize)); 49467 49468 for (i = 1; i < subitemsCount; i++) { 49469 incHex(end, dataSize); 49470 stream.readHexNumber(start, dataSize); 49471 addHex(start, end, dataSize); 49472 stream.readHexNumber(end, dataSize); 49473 addHex(end, start, dataSize); 49474 cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize)); 49475 } 49476 49477 break; 49478 49479 case 1: 49480 stream.readHex(start, dataSize); 49481 stream.readHexNumber(end, dataSize); 49482 addHex(end, start, dataSize); 49483 stream.readNumber(); 49484 49485 for (i = 1; i < subitemsCount; i++) { 49486 incHex(end, dataSize); 49487 stream.readHexNumber(start, dataSize); 49488 addHex(start, end, dataSize); 49489 stream.readHexNumber(end, dataSize); 49490 addHex(end, start, dataSize); 49491 stream.readNumber(); 49492 } 49493 49494 break; 49495 49496 case 2: 49497 stream.readHex(char, dataSize); 49498 code = stream.readNumber(); 49499 cMap.mapOne(hexToInt(char, dataSize), code); 49500 49501 for (i = 1; i < subitemsCount; i++) { 49502 incHex(char, dataSize); 49503 49504 if (!sequence) { 49505 stream.readHexNumber(tmp, dataSize); 49506 addHex(char, tmp, dataSize); 49507 } 49508 49509 code = stream.readSigned() + (code + 1); 49510 cMap.mapOne(hexToInt(char, dataSize), code); 49511 } 49512 49513 break; 49514 49515 case 3: 49516 stream.readHex(start, dataSize); 49517 stream.readHexNumber(end, dataSize); 49518 addHex(end, start, dataSize); 49519 code = stream.readNumber(); 49520 cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code); 49521 49522 for (i = 1; i < subitemsCount; i++) { 49523 incHex(end, dataSize); 49524 49525 if (!sequence) { 49526 stream.readHexNumber(start, dataSize); 49527 addHex(start, end, dataSize); 49528 } else { 49529 start.set(end); 49530 } 49531 49532 stream.readHexNumber(end, dataSize); 49533 addHex(end, start, dataSize); 49534 code = stream.readNumber(); 49535 cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code); 49536 } 49537 49538 break; 49539 49540 case 4: 49541 stream.readHex(char, ucs2DataSize); 49542 stream.readHex(charCode, dataSize); 49543 cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize)); 49544 49545 for (i = 1; i < subitemsCount; i++) { 49546 incHex(char, ucs2DataSize); 49547 49548 if (!sequence) { 49549 stream.readHexNumber(tmp, ucs2DataSize); 49550 addHex(char, tmp, ucs2DataSize); 49551 } 49552 49553 incHex(charCode, dataSize); 49554 stream.readHexSigned(tmp, dataSize); 49555 addHex(charCode, tmp, dataSize); 49556 cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize)); 49557 } 49558 49559 break; 49560 49561 case 5: 49562 stream.readHex(start, ucs2DataSize); 49563 stream.readHexNumber(end, ucs2DataSize); 49564 addHex(end, start, ucs2DataSize); 49565 stream.readHex(charCode, dataSize); 49566 cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize)); 49567 49568 for (i = 1; i < subitemsCount; i++) { 49569 incHex(end, ucs2DataSize); 49570 49571 if (!sequence) { 49572 stream.readHexNumber(start, ucs2DataSize); 49573 addHex(start, end, ucs2DataSize); 49574 } else { 49575 start.set(end); 49576 } 49577 49578 stream.readHexNumber(end, ucs2DataSize); 49579 addHex(end, start, ucs2DataSize); 49580 stream.readHex(charCode, dataSize); 49581 cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize)); 49582 } 49583 49584 break; 49585 49586 default: 49587 reject(new Error("processBinaryCMap: Unknown type: " + type)); 49588 return; 49589 } 49590 } 49591 49592 if (useCMap) { 49593 resolve(extend(useCMap)); 49594 return; 49595 } 49596 49597 resolve(cMap); 49598 }); 49599 } 49600 49601 function BinaryCMapReader() {} 49602 49603 BinaryCMapReader.prototype = { 49604 process: processBinaryCMap 49605 }; 49606 return BinaryCMapReader; 49607}(); 49608
49609var CMapFactory = function CMapFactoryClosure() { 49610 function strToInt(str) { 49611 var a = 0; 49612 49613 for (var i = 0; i < str.length; i++) { 49614 a = a << 8 | str.charCodeAt(i); 49615 } 49616 49617 return a >>> 0; 49618 } 49619 49620 function expectString(obj) { 49621 if (!(0, _util.isString)(obj)) { 49622 throw new _util.FormatError("Malformed CMap: expected string."); 49623 } 49624 } 49625 49626 function expectInt(obj) { 49627 if (!Number.isInteger(obj)) { 49628 throw new _util.FormatError("Malformed CMap: expected int."); 49629 } 49630 } 49631 49632 function parseBfChar(cMap, lexer) { 49633 while (true) { 49634 var obj = lexer.getObj(); 49635 49636 if ((0, _primitives.isEOF)(obj)) { 49637 break; 49638 } 49639 49640 if ((0, _primitives.isCmd)(obj, "endbfchar")) { 49641 return; 49642 } 49643 49644 expectString(obj); 49645 var src = strToInt(obj); 49646 obj = lexer.getObj(); 49647 expectString(obj); 49648 var dst = obj; 49649 cMap.mapOne(src, dst); 49650 } 49651 } 49652 49653 function parseBfRange(cMap, lexer) { 49654 while (true) { 49655 var obj = lexer.getObj(); 49656 49657 if ((0, _primitives.isEOF)(obj)) { 49658 break; 49659 } 49660 49661 if ((0, _primitives.isCmd)(obj, "endbfrange")) { 49662 return; 49663 } 49664 49665 expectString(obj); 49666 var low = strToInt(obj); 49667 obj = lexer.getObj(); 49668 expectString(obj); 49669 var high = strToInt(obj); 49670 obj = lexer.getObj(); 49671 49672 if (Number.isInteger(obj) || (0, _util.isString)(obj)) { 49673 var dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj; 49674 cMap.mapBfRange(low, high, dstLow); 49675 } else if ((0, _primitives.isCmd)(obj, "[")) { 49676 obj = lexer.getObj(); 49677 var array = []; 49678 49679 while (!(0, _primitives.isCmd)(obj, "]") && !(0, _primitives.isEOF)(obj)) { 49680 array.push(obj); 49681 obj = lexer.getObj(); 49682 } 49683 49684 cMap.mapBfRangeToArray(low, high, array); 49685 } else { 49686 break; 49687 } 49688 } 49689 49690 throw new _util.FormatError("Invalid bf range."); 49691 } 49692 49693 function parseCidChar(cMap, lexer) { 49694 while (true) { 49695 var obj = lexer.getObj(); 49696 49697 if ((0, _primitives.isEOF)(obj)) { 49698 break; 49699 } 49700 49701 if ((0, _primitives.isCmd)(obj, "endcidchar")) { 49702 return; 49703 } 49704 49705 expectString(obj); 49706 var src = strToInt(obj); 49707 obj = lexer.getObj(); 49708 expectInt(obj); 49709 var dst = obj; 49710 cMap.mapOne(src, dst); 49711 } 49712 } 49713 49714 function parseCidRange(cMap, lexer) { 49715 while (true) { 49716 var obj = lexer.getObj(); 49717 49718 if ((0, _primitives.isEOF)(obj)) { 49719 break; 49720 } 49721 49722 if ((0, _primitives.isCmd)(obj, "endcidrange")) { 49723 return; 49724 } 49725 49726 expectString(obj); 49727 var low = strToInt(obj); 49728 obj = lexer.getObj(); 49729 expectString(obj); 49730 var high = strToInt(obj); 49731 obj = lexer.getObj(); 49732 expectInt(obj); 49733 var dstLow = obj; 49734 cMap.mapCidRange(low, high, dstLow); 49735 } 49736 } 49737 49738 function parseCodespaceRange(cMap, lexer) { 49739 while (true) { 49740 var obj = lexer.getObj(); 49741 49742 if ((0, _primitives.isEOF)(obj)) { 49743 break; 49744 } 49745 49746 if ((0, _primitives.isCmd)(obj, "endcodespacerange")) { 49747 return; 49748 } 49749 49750 if (!(0, _util.isString)(obj)) { 49751 break; 49752 } 49753 49754 var low = strToInt(obj); 49755 obj = lexer.getObj(); 49756 49757 if (!(0, _util.isString)(obj)) { 49758 break; 49759 } 49760 49761 var high = strToInt(obj); 49762 cMap.addCodespaceRange(obj.length, low, high); 49763 } 49764 49765 throw new _util.FormatError("Invalid codespace range."); 49766 } 49767 49768 function parseWMode(cMap, lexer) { 49769 var obj = lexer.getObj(); 49770 49771 if (Number.isInteger(obj)) { 49772 cMap.vertical = !!obj; 49773 } 49774 } 49775 49776 function parseCMapName(cMap, lexer) { 49777 var obj = lexer.getObj(); 49778 49779 if ((0, _primitives.isName)(obj) && (0, _util.isString)(obj.name)) { 49780 cMap.name = obj.name; 49781 } 49782 } 49783 49784 function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) { 49785 var previous; 49786 var embeddedUseCMap; 49787 49788 objLoop: while (true) { 49789 try { 49790 var obj = lexer.getObj(); 49791 49792 if ((0, _primitives.isEOF)(obj)) { 49793 break; 49794 } else if ((0, _primitives.isName)(obj)) { 49795 if (obj.name === "WMode") { 49796 parseWMode(cMap, lexer); 49797 } else if (obj.name === "CMapName") {
49798 parseCMapName(cMap, lexer); 49799 } 49800 49801 previous = obj; 49802 } else if ((0, _primitives.isCmd)(obj)) { 49803 switch (obj.cmd) { 49804 case "endcmap": 49805 break objLoop; 49806 49807 case "usecmap": 49808 if ((0, _primitives.isName)(previous)) { 49809 embeddedUseCMap = previous.name; 49810 } 49811 49812 break; 49813 49814 case "begincodespacerange": 49815 parseCodespaceRange(cMap, lexer); 49816 break; 49817 49818 case "beginbfchar": 49819 parseBfChar(cMap, lexer); 49820 break; 49821 49822 case "begincidchar": 49823 parseCidChar(cMap, lexer); 49824 break; 49825 49826 case "beginbfrange": 49827 parseBfRange(cMap, lexer); 49828 break; 49829 49830 case "begincidrange": 49831 parseCidRange(cMap, lexer); 49832 break; 49833 } 49834 } 49835 } catch (ex) { 49836 if (ex instanceof _core_utils.MissingDataException) { 49837 throw ex; 49838 } 49839 49840 (0, _util.warn)("Invalid cMap data: " + ex); 49841 continue; 49842 } 49843 } 49844 49845 if (!useCMap && embeddedUseCMap) { 49846 useCMap = embeddedUseCMap; 49847 } 49848 49849 if (useCMap) { 49850 return extendCMap(cMap, fetchBuiltInCMap, useCMap); 49851 } 49852 49853 return Promise.resolve(cMap); 49854 } 49855 49856 function extendCMap(cMap, fetchBuiltInCMap, useCMap) { 49857 return createBuiltInCMap(useCMap, fetchBuiltInCMap).then(function (newCMap) { 49858 cMap.useCMap = newCMap; 49859 49860 if (cMap.numCodespaceRanges === 0) { 49861 var useCodespaceRanges = cMap.useCMap.codespaceRanges; 49862 49863 for (var i = 0; i < useCodespaceRanges.length; i++) { 49864 cMap.codespaceRanges[i] = useCodespaceRanges[i].slice(); 49865 } 49866 49867 cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges; 49868 } 49869 49870 cMap.useCMap.forEach(function (key, value) { 49871 if (!cMap.contains(key)) { 49872 cMap.mapOne(key, cMap.useCMap.lookup(key)); 49873 } 49874 }); 49875 return cMap; 49876 }); 49877 } 49878 49879 function createBuiltInCMap(name, fetchBuiltInCMap) { 49880 if (name === "Identity-H") { 49881 return Promise.resolve(new IdentityCMap(false, 2)); 49882 } else if (name === "Identity-V") { 49883 return Promise.resolve(new IdentityCMap(true, 2)); 49884 } 49885 49886 if (!BUILT_IN_CMAPS.includes(name)) { 49887 return Promise.reject(new Error("Unknown CMap name: " + name)); 49888 } 49889 49890 if (!fetchBuiltInCMap) { 49891 return Promise.reject(new Error("Built-in CMap parameters are not provided.")); 49892 } 49893 49894 return fetchBuiltInCMap(name).then(function (data) { 49895 var cMapData = data.cMapData, 49896 compressionType = data.compressionType; 49897 var cMap = new CMap(true); 49898 49899 if (compressionType === _util.CMapCompressionType.BINARY) { 49900 return new BinaryCMapReader().process(cMapData, cMap, function (useCMap) { 49901 return extendCMap(cMap, fetchBuiltInCMap, useCMap); 49902 }); 49903 } 49904 49905 if (compressionType === _util.CMapCompressionType.NONE) { 49906 var lexer = new _parser.Lexer(new _stream.Stream(cMapData)); 49907 return parseCMap(cMap, lexer, fetchBuiltInCMap, null); 49908 } 49909 49910 return Promise.reject(new Error("TODO: Only BINARY/NONE CMap compression is currently supported.")); 49911 }); 49912 } 49913 49914 return { 49915 async create(params) { 49916 var encoding = params.encoding; 49917 var fetchBuiltInCMap = params.fetchBuiltInCMap; 49918 var useCMap = params.useCMap; 49919 49920 if ((0, _primitives.isName)(encoding)) { 49921 return createBuiltInCMap(encoding.name, fetchBuiltInCMap); 49922 } else if ((0, _primitives.isStream)(encoding)) { 49923 var cMap = new CMap(); 49924 var lexer = new _parser.Lexer(encoding); 49925 return parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap).then(function (parsedCMap) { 49926 if (parsedCMap.isIdentityCMap) { 49927 return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap); 49928 } 49929 49930 return parsedCMap; 49931 }); 49932 } 49933 49934 throw new Error("Encoding required."); 49935 } 49936 49937 }; 49938}(); 49939 49940exports.CMapFactory = CMapFactory; 49941 49942/***/ }), 49943/* 27 */ 49944/***/ (function(module, exports, __w_pdfjs_require__) { 49945 49946"use strict"; 49947 49948 49949Object.defineProperty(exports, "__esModule", { 49950 value: true 49951}); 49952exports.getFontType = getFontType;
49953exports.IdentityToUnicodeMap = exports.ToUnicodeMap = exports.FontFlags = exports.Font = exports.ErrorFont = exports.SEAC_ANALYSIS_ENABLED = void 0; 49954 49955var _util = __w_pdfjs_require__(2); 49956 49957var _cff_parser = __w_pdfjs_require__(28); 49958 49959var _glyphlist = __w_pdfjs_require__(31); 49960 49961var _encodings = __w_pdfjs_require__(30); 49962 49963var _standard_fonts = __w_pdfjs_require__(32); 49964 49965var _unicode = __w_pdfjs_require__(33); 49966 49967var _core_utils = __w_pdfjs_require__(7); 49968 49969var _font_renderer = __w_pdfjs_require__(34); 49970 49971var _cmap = __w_pdfjs_require__(26); 49972 49973var _stream = __w_pdfjs_require__(11); 49974 49975var _type1_parser = __w_pdfjs_require__(35); 49976 49977const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]]; 49978var PDF_GLYPH_SPACE_UNITS = 1000; 49979var SEAC_ANALYSIS_ENABLED = true; 49980exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED; 49981var FontFlags = { 49982 FixedPitch: 1, 49983 Serif: 2, 49984 Symbolic: 4, 49985 Script: 8, 49986 Nonsymbolic: 32, 49987 Italic: 64, 49988 AllCap: 65536, 49989 SmallCap: 131072, 49990 ForceBold: 262144 49991}; 49992exports.FontFlags = FontFlags; 49993var 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", "periodce
49993ntered", "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"]; 49994 49995function adjustWidths(properties) { 49996 if (!properties.fontMatrix) { 49997 return; 49998 } 49999 50000 if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) { 50001 return; 50002 } 50003 50004 var scale = 0.001 / properties.fontMatrix[0]; 50005 var glyphsWidths = properties.widths; 50006 50007 for (var glyph in glyphsWidths) { 50008 glyphsWidths[glyph] *= scale; 50009 } 50010 50011 properties.defaultWidth *= scale; 50012} 50013 50014function adjustToUnicode(properties, builtInEncoding) { 50015 if (properties.hasIncludedToUnicodeMap) { 50016 return; 50017 } 50018 50019 if (properties.hasEncoding) { 50020 return; 50021 } 50022 50023 if (builtInEncoding === properties.defaultEncoding) { 50024 return; 50025 } 50026 50027 if (properties.toUnicode instanceof IdentityToUnicodeMap) { 50028 return; 50029 } 50030 50031 var toUnicode = [], 50032 glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 50033 50034 for (var charCode in builtInEncoding) { 50035 var glyphName = builtInEncoding[charCode]; 50036 var unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap); 50037 50038 if (unicode !== -1) { 50039 toUnicode[charCode] = String.fromCharCode(unicode); 50040 } 50041 } 50042 50043 properties.toUnicode.amend(toUnicode); 50044} 50045 50046function getFontType(type, subtype) { 50047 switch (type) { 50048 case "Type1": 50049 return subtype === "Type1C" ? _util.FontType.TYPE1C : _util.FontType.TYPE1; 50050 50051 case "CIDFontType0": 50052 return subtype === "CIDFontType0C" ? _util.FontType.CIDFONTTYPE0C : _util.FontType.CIDFONTTYPE0; 50053 50054 case "OpenType": 50055 return _util.FontType.OPENTYPE; 50056 50057 case "TrueType": 50058 return _util.FontType.TRUETYPE; 50059 50060 case "CIDFontType2": 50061 return _util.FontType.CIDFONTTYPE2; 50062 50063 case "MMType1": 50064 return _util.FontType.MMTYPE1; 50065 50066 case "Type0": 50067 return _util.FontType.TYPE0; 50068 50069 default: 50070 return _util.FontType.UNKNOWN; 50071 } 50072} 50073 50074function recoverGlyphName(name, glyphsUnicodeMap) { 50075 if (glyphsUnicodeMap[name] !== undefined) { 50076 return name; 50077 } 50078 50079 var unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap); 50080 50081 if (unicode !== -1) { 50082 for (var key in glyphsUnicodeMap) { 50083 if (glyphsUnicodeMap[key] === unicode) { 50084 return key; 50085 } 50086 } 50087 } 50088 50089 (0, _util.info)("Unable to recover a standard glyph name for: " + name); 50090 return name; 50091} 50092 50093var Glyph = function GlyphClosure() { 50094 function Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) { 50095 this.fontChar = fontChar; 50096 this.unicode = unicode; 50097 this.accent = accent; 50098 this.width = width; 50099 this.vmetric = vmetric; 50100 this.operatorListId = operatorListId; 50101 this.isSpace = isSpace; 50102 this.isInFont = isInFont; 50103 } 50104 50105 Glyph.prototype.matchesForCache = function (fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) { 50106 return this.fontChar === fontChar && this.unicode === unicode && this.accent === accent && this.width === width && this.vmetric === vmetric && this.operatorListId === operatorListId && this.isSpace === isSpace && this.isInFont === isInFont; 50107 }; 50108 50109 return Glyph; 50110}(); 50111 50112var ToUnicodeMap = function ToUnicodeMapClosure() { 50113 function ToUnicodeMap(cmap = []) { 50114 this._map = cmap; 50115 } 50116 50117 ToUnicodeMap.prototype = { 50118 get length() { 50119 return this._map.length; 50120 }, 50121 50122 forEach(callback) { 50123 for (var charCode in this._map) { 50124 callback(charCode, this._map[charCode].charCodeAt(0)); 50125 } 50126 }, 50127 50128 has(i) { 50129 return this._map[i] !== undefined; 50130 }, 50131 50132 get(i) { 50133 return this._map[i]; 50134 }, 50135
50136 charCodeOf(value) { 50137 const map = this._map; 50138 50139 if (map.length <= 0x10000) { 50140 return map.indexOf(value); 50141 } 50142 50143 for (const charCode in map) { 50144 if (map[charCode] === value) { 50145 return charCode | 0; 50146 } 50147 } 50148 50149 return -1; 50150 }, 50151 50152 amend(map) { 50153 for (var charCode in map) { 50154 this._map[charCode] = map[charCode]; 50155 } 50156 } 50157 50158 }; 50159 return ToUnicodeMap; 50160}(); 50161 50162exports.ToUnicodeMap = ToUnicodeMap; 50163 50164var IdentityToUnicodeMap = function IdentityToUnicodeMapClosure() { 50165 function IdentityToUnicodeMap(firstChar, lastChar) { 50166 this.firstChar = firstChar; 50167 this.lastChar = lastChar; 50168 } 50169 50170 IdentityToUnicodeMap.prototype = { 50171 get length() { 50172 return this.lastChar + 1 - this.firstChar; 50173 }, 50174 50175 forEach(callback) { 50176 for (var i = this.firstChar, ii = this.lastChar; i <= ii; i++) { 50177 callback(i, i); 50178 } 50179 }, 50180 50181 has(i) { 50182 return this.firstChar <= i && i <= this.lastChar; 50183 }, 50184 50185 get(i) { 50186 if (this.firstChar <= i && i <= this.lastChar) { 50187 return String.fromCharCode(i); 50188 } 50189 50190 return undefined; 50191 }, 50192 50193 charCodeOf(v) { 50194 return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1; 50195 }, 50196 50197 amend(map) { 50198 (0, _util.unreachable)("Should not call amend()"); 50199 } 50200 50201 }; 50202 return IdentityToUnicodeMap; 50203}(); 50204 50205exports.IdentityToUnicodeMap = IdentityToUnicodeMap; 50206 50207var OpenTypeFileBuilder = function OpenTypeFileBuilderClosure() { 50208 function writeInt16(dest, offset, num) { 50209 dest[offset] = num >> 8 & 0xff; 50210 dest[offset + 1] = num & 0xff; 50211 } 50212 50213 function writeInt32(dest, offset, num) { 50214 dest[offset] = num >> 24 & 0xff; 50215 dest[offset + 1] = num >> 16 & 0xff; 50216 dest[offset + 2] = num >> 8 & 0xff; 50217 dest[offset + 3] = num & 0xff; 50218 } 50219 50220 function writeData(dest, offset, data) { 50221 var i, ii; 50222 50223 if (data instanceof Uint8Array) { 50224 dest.set(data, offset); 50225 } else if (typeof data === "string") { 50226 for (i = 0, ii = data.length; i < ii; i++) { 50227 dest[offset++] = data.charCodeAt(i) & 0xff; 50228 } 50229 } else { 50230 for (i = 0, ii = data.length; i < ii; i++) { 50231 dest[offset++] = data[i] & 0xff; 50232 } 50233 } 50234 } 50235 50236 function OpenTypeFileBuilder(sfnt) { 50237 this.sfnt = sfnt; 50238 this.tables = Object.create(null); 50239 } 50240 50241 OpenTypeFileBuilder.getSearchParams = function OpenTypeFileBuilder_getSearchParams(entriesCount, entrySize) { 50242 var maxPower2 = 1, 50243 log2 = 0; 50244 50245 while ((maxPower2 ^ entriesCount) > maxPower2) { 50246 maxPower2 <<= 1; 50247 log2++; 50248 } 50249 50250 var searchRange = maxPower2 * entrySize; 50251 return { 50252 range: searchRange, 50253 entry: log2, 50254 rangeShift: entrySize * entriesCount - searchRange 50255 }; 50256 }; 50257 50258 var OTF_HEADER_SIZE = 12; 50259 var OTF_TABLE_ENTRY_SIZE = 16; 50260 OpenTypeFileBuilder.prototype = { 50261 toArray: function OpenTypeFileBuilder_toArray() { 50262 var sfnt = this.sfnt; 50263 var tables = this.tables; 50264 var tablesNames = Object.keys(tables); 50265 tablesNames.sort(); 50266 var numTables = tablesNames.length; 50267 var i, j, jj, table, tableName; 50268 var offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE; 50269 var tableOffsets = [offset]; 50270 50271 for (i = 0; i < numTables; i++) { 50272 table = tables[tablesNames[i]]; 50273 var paddedLength = (table.length + 3 & ~3) >>> 0; 50274 offset += paddedLength; 50275 tableOffsets.push(offset); 50276 } 50277 50278 var file = new Uint8Array(offset); 50279 50280 for (i = 0; i < numTables; i++) { 50281 table = tables[tablesNames[i]]; 50282 writeData(file, tableOffsets[i], table); 50283 } 50284 50285 if (sfnt === "true") { 50286 sfnt = (0, _util.string32)(0x00010000); 50287 } 50288 50289 file[0] = sfnt.charCodeAt(0) & 0xff; 50290 file[1] = sfnt.charCodeAt(1) & 0xff; 50291 file[2] = sfnt.charCodeAt(2) & 0xff;
50292 file[3] = sfnt.charCodeAt(3) & 0xff; 50293 writeInt16(file, 4, numTables); 50294 var searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16); 50295 writeInt16(file, 6, searchParams.range); 50296 writeInt16(file, 8, searchParams.entry); 50297 writeInt16(file, 10, searchParams.rangeShift); 50298 offset = OTF_HEADER_SIZE; 50299 50300 for (i = 0; i < numTables; i++) { 50301 tableName = tablesNames[i]; 50302 file[offset] = tableName.charCodeAt(0) & 0xff; 50303 file[offset + 1] = tableName.charCodeAt(1) & 0xff; 50304 file[offset + 2] = tableName.charCodeAt(2) & 0xff; 50305 file[offset + 3] = tableName.charCodeAt(3) & 0xff; 50306 var checksum = 0; 50307 50308 for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) { 50309 var quad = (0, _core_utils.readUint32)(file, j); 50310 checksum = checksum + quad >>> 0; 50311 } 50312 50313 writeInt32(file, offset + 4, checksum); 50314 writeInt32(file, offset + 8, tableOffsets[i]); 50315 writeInt32(file, offset + 12, tables[tableName].length); 50316 offset += OTF_TABLE_ENTRY_SIZE; 50317 } 50318 50319 return file; 50320 }, 50321 addTable: function OpenTypeFileBuilder_addTable(tag, data) { 50322 if (tag in this.tables) { 50323 throw new Error("Table " + tag + " already exists"); 50324 } 50325 50326 this.tables[tag] = data; 50327 } 50328 }; 50329 return OpenTypeFileBuilder; 50330}(); 50331 50332var Font = function FontClosure() { 50333 function Font(name, file, properties) { 50334 var charCode; 50335 this.name = name; 50336 this.loadedName = properties.loadedName; 50337 this.isType3Font = properties.isType3Font; 50338 this.sizes = []; 50339 this.missingFile = false; 50340 this.glyphCache = Object.create(null); 50341 this.isSerifFont = !!(properties.flags & FontFlags.Serif); 50342 this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic); 50343 this.isMonospace = !!(properties.flags & FontFlags.FixedPitch); 50344 var type = properties.type; 50345 var subtype = properties.subtype; 50346 this.type = type; 50347 this.subtype = subtype; 50348 let fallbackName = "sans-serif"; 50349 50350 if (this.isMonospace) { 50351 fallbackName = "monospace"; 50352 } else if (this.isSerifFont) { 50353 fallbackName = "serif"; 50354 } 50355 50356 this.fallbackName = fallbackName; 50357 this.differences = properties.differences; 50358 this.widths = properties.widths; 50359 this.defaultWidth = properties.defaultWidth; 50360 this.composite = properties.composite; 50361 this.wideChars = properties.wideChars; 50362 this.cMap = properties.cMap; 50363 this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS; 50364 this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS; 50365 this.fontMatrix = properties.fontMatrix; 50366 this.bbox = properties.bbox; 50367 this.defaultEncoding = properties.defaultEncoding; 50368 this.toUnicode = properties.toUnicode; 50369 this.fallbackToUnicode = properties.fallbackToUnicode || new ToUnicodeMap(); 50370 this.toFontChar = []; 50371 50372 if (properties.type === "Type3") { 50373 for (charCode = 0; charCode < 256; charCode++) { 50374 this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode]; 50375 } 50376 50377 this.fontType = _util.FontType.TYPE3; 50378 return; 50379 } 50380 50381 this.cidEncoding = properties.cidEncoding; 50382 this.vertical = properties.vertical; 50383 50384 if (this.vertical) { 50385 this.vmetrics = properties.vmetrics; 50386 this.defaultVMetrics = properties.defaultVMetrics; 50387 } 50388 50389 if (!file || file.isEmpty) { 50390 if (file) { 50391 (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ")"); 50392 } 50393 50394 this.fallbackToSystemFont(); 50395 return; 50396 } 50397 50398 [type, subtype] = getFontFileType(file, properties); 50399 50400 if (type !== this.type || subtype !== this.subtype) { 50401 (0, _util.info)("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`); 50402 } 50403 50404 try { 50405 var data; 50406 50407 switch (type) { 50408 case "MMType1": 50409 (0, _util.info)("MMType1 font (" + name + "), falling back to Type1."); 50410 50411 case "Type1": 50412 case "CIDFontType0": 50413 this.mimetype = "font/opentype"; 50414 var cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new CFFFont(file, properties) : new Type1Font(name, file, properties); 50415 adjustWidths(properties); 50416 data = this.convert(name, cff, properties); 50417 break; 50418 50419 case "OpenType": 50420 case "TrueType": 50421 case "CIDFontType2": 50422 this.mimetype = "font/opentype"; 50423 data = this.checkAndRepair(name, file, properties); 50424 50425 if (this.isOpenType) { 50426 adjustWidths(properties); 50427 type = "OpenType"; 50428 } 50429 50430 break; 50431 50432 default: 50433 throw new _util.FormatError(`Font ${type} is not supported`); 50434 } 50435 } catch (e) { 50436 (0, _util.warn)(e); 50437 this.fallbackToSystemFont(); 50438 return; 50439 } 50440 50441 this.data = data; 50442 this.fontType = getFontType(type, subtype); 50443 this.fontMatrix = properties.fontMatrix; 50444 this.widths = properties.widths; 50445 this.defaultWidth = properties.defaultWidth; 50446 this.toUnicode = properties.toUnicode; 50447 this.encoding = properties.baseEncoding; 50448 this.seacMap = properties.seacMap; 50449 } 50450 50451 Font.getFontID = function () { 50452 var ID = 1; 50453 return function Font_getFontID() { 50454 return String(ID++); 50455 }; 50456 }(); 50457 50458 function int16(b0, b1) { 50459 return (b0 << 8) + b1; 50460 } 50461 50462 function writeSignedInt16(bytes, index, value) { 50463 bytes[index + 1] = value; 50464 bytes[index] = value >>> 8; 50465 } 50466 50467 function signedInt16(b0, b1) { 50468 var value = (b0 << 8) + b1; 50469 return value & 1 << 15 ? value - 0x10000 : value; 50470 } 50471 50472 function int32(b0, b1, b2, b3) { 50473 return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3; 50474 } 50475 50476 function string16(value) { 50477 return String.fromCharCode(value >> 8 & 0xff, value & 0xff); 50478 } 50479 50480 function safeString16(value) { 50481 if (value > 0x7fff) { 50482 value = 0x7fff; 50483 } else if (value < -0x8000) { 50484 value = -0x8000; 50485 } 50486 50487 return String.fromCharCode(value >> 8 & 0xff, value & 0xff); 50488 } 50489 50490 function isTrueTypeFile(file) { 50491 var header = file.peekBytes(4); 50492 return (0, _core_utils.readUint32)(header, 0) === 0x00010000 || (0, _util.bytesToString)(header) === "true"; 50493 } 50494 50495 function isTrueTypeCollectionFile(file) { 50496 const header = file.peekBytes(4); 50497 return (0, _util.bytesToString)(header) === "ttcf"; 50498 } 50499 50500 function isOpenTypeFile(file) { 50501 var header = file.peekBytes(4); 50502 return (0, _util.bytesToString)(header) === "OTTO"; 50503 } 50504 50505 function isType1File(file) { 50506 var header = file.peekBytes(2); 50507 50508 if (header[0] === 0x25 && header[1] === 0x21) { 50509 return true; 50510 } 50511 50512 if (header[0] === 0x80 && header[1] === 0x01) { 50513 return true; 50514 } 50515 50516 return false;
50517 } 50518 50519 function isCFFFile(file) { 50520 const header = file.peekBytes(4); 50521 50522 if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) { 50523 return true; 50524 } 50525 50526 return false; 50527 } 50528 50529 function getFontFileType(file, { 50530 type, 50531 subtype, 50532 composite 50533 }) { 50534 let fileType, fileSubtype; 50535 50536 if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) { 50537 if (composite) { 50538 fileType = "CIDFontType2"; 50539 } else { 50540 fileType = "TrueType"; 50541 } 50542 } else if (isOpenTypeFile(file)) { 50543 if (composite) { 50544 fileType = "CIDFontType2"; 50545 } else { 50546 fileType = "OpenType"; 50547 } 50548 } else if (isType1File(file)) { 50549 if (composite) { 50550 fileType = "CIDFontType0"; 50551 } else { 50552 fileType = type === "MMType1" ? "MMType1" : "Type1"; 50553 } 50554 } else if (isCFFFile(file)) { 50555 if (composite) { 50556 fileType = "CIDFontType0"; 50557 fileSubtype = "CIDFontType0C"; 50558 } else { 50559 fileType = type === "MMType1" ? "MMType1" : "Type1"; 50560 fileSubtype = "Type1C"; 50561 } 50562 } else { 50563 (0, _util.warn)("getFontFileType: Unable to detect correct font file Type/Subtype."); 50564 fileType = type; 50565 fileSubtype = subtype; 50566 } 50567 50568 return [fileType, fileSubtype]; 50569 } 50570 50571 function buildToFontChar(encoding, glyphsUnicodeMap, differences) { 50572 var toFontChar = [], 50573 unicode; 50574 50575 for (var i = 0, ii = encoding.length; i < ii; i++) { 50576 unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap); 50577 50578 if (unicode !== -1) { 50579 toFontChar[i] = unicode; 50580 } 50581 } 50582 50583 for (var charCode in differences) { 50584 unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap); 50585 50586 if (unicode !== -1) { 50587 toFontChar[+charCode] = unicode; 50588 } 50589 } 50590 50591 return toFontChar; 50592 } 50593 50594 function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId) { 50595 var newMap = Object.create(null); 50596 var toFontChar = []; 50597 var privateUseAreaIndex = 0; 50598 var nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0]; 50599 var privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1]; 50600 50601 for (var originalCharCode in charCodeToGlyphId) { 50602 originalCharCode |= 0; 50603 var glyphId = charCodeToGlyphId[originalCharCode]; 50604 50605 if (!hasGlyph(glyphId)) { 50606 continue; 50607 } 50608 50609 if (nextAvailableFontCharCode > privateUseOffetEnd) { 50610 privateUseAreaIndex++; 50611 50612 if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) { 50613 (0, _util.warn)("Ran out of space in font private use area."); 50614 break; 50615 } 50616 50617 nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0]; 50618 privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1]; 50619 } 50620 50621 var fontCharCode = nextAvailableFontCharCode++; 50622 50623 if (glyphId === 0) { 50624 glyphId = newGlyphZeroId; 50625 } 50626 50627 newMap[fontCharCode] = glyphId; 50628 toFontChar[originalCharCode] = fontCharCode; 50629 } 50630 50631 return { 50632 toFontChar, 50633 charCodeToGlyphId: newMap, 50634 nextAvailableFontCharCode 50635 }; 50636 } 50637 50638 function getRanges(glyphs, numGlyphs) { 50639 var codes = []; 50640 50641 for (var charCode in glyphs) { 50642 if (glyphs[charCode] >= numGlyphs) { 50643 continue; 50644 } 50645 50646 codes.push({ 50647 fontCharCode: charCode | 0, 50648 glyphId: glyphs[charCode] 50649 }); 50650 } 50651 50652 if (codes.length === 0) { 50653 codes.push({ 50654 fontCharCode: 0, 50655 glyphId: 0 50656 }); 50657 } 50658 50659 codes.sort(function fontGetRangesSort(a, b) { 50660 return a.fontCharCode - b.fontCharCode; 50661 }); 50662 var ranges = []; 50663 var length = codes.length; 50664 50665 for (var n = 0; n < length;) { 50666 var start = codes[n].fontCharCode; 50667 var codeIndices = [codes[n].glyphId]; 50668 ++n; 50669 var end = start; 50670 50671 while (n < length && end + 1 === codes[n].fontCharCode) { 50672 codeIndices.push(codes[n].glyphId); 50673 ++end; 50674 ++n; 50675 50676 if (end === 0xffff) { 50677 break; 50678 } 50679 } 50680 50681 ranges.push([start, end, codeIndices]); 50682 } 50683 50684 return ranges; 50685 } 50686 50687 function createCmapTable(glyphs, numGlyphs) { 50688 var ranges = getRanges(glyphs, numGlyphs); 50689 var numTables = ranges[ranges.length - 1][1] > 0xffff ? 2 : 1; 50690 var cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + (0, _util.string32)(4 + numTables * 8); 50691 var i, ii, j, jj; 50692 50693 for (i = ranges.length - 1; i >= 0; --i) { 50694 if (ranges[i][0] <= 0xffff) { 50695 break; 50696 } 50697 } 50698 50699 var bmpLength = i + 1; 50700 50701 if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) { 50702 ranges[i][1] = 0xfffe; 50703 } 50704 50705 var trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0; 50706 var segCount = bmpLength + trailingRangesCount; 50707 var searchParams = OpenTypeFileBuilder.getSearchParams(segCount, 2); 50708 var startCount = ""; 50709 var endCount = ""; 50710 var idDeltas = ""; 50711 var idRangeOffsets = ""; 50712 var glyphsIds = ""; 50713 var bias = 0; 50714 var range, start, end, codes; 50715 50716 for (i = 0, ii = bmpLength; i < ii; i++) { 50717 range = ranges[i]; 50718 start = range[0]; 50719 end = range[1]; 50720 startCount += string16(start); 50721 endCount += string16(end); 50722 codes = range[2]; 50723 var contiguous = true; 50724 50725 for (j = 1, jj = codes.length; j < jj; ++j) { 50726 if (codes[j] !== codes[j - 1] + 1) { 50727 contiguous = false;
50728 break; 50729 } 50730 } 50731 50732 if (!contiguous) { 50733 var offset = (segCount - i) * 2 + bias * 2; 50734 bias += end - start + 1; 50735 idDeltas += string16(0); 50736 idRangeOffsets += string16(offset); 50737 50738 for (j = 0, jj = codes.length; j < jj; ++j) { 50739 glyphsIds += string16(codes[j]); 50740 } 50741 } else { 50742 var startCode = codes[0]; 50743 idDeltas += string16(startCode - start & 0xffff); 50744 idRangeOffsets += string16(0); 50745 } 50746 } 50747 50748 if (trailingRangesCount > 0) { 50749 endCount += "\xFF\xFF"; 50750 startCount += "\xFF\xFF"; 50751 idDeltas += "\x00\x01"; 50752 idRangeOffsets += "\x00\x00"; 50753 } 50754 50755 var format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds; 50756 var format31012 = ""; 50757 var header31012 = ""; 50758 50759 if (numTables > 1) { 50760 cmap += "\x00\x03" + "\x00\x0A" + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length); 50761 format31012 = ""; 50762 50763 for (i = 0, ii = ranges.length; i < ii; i++) { 50764 range = ranges[i]; 50765 start = range[0]; 50766 codes = range[2]; 50767 var code = codes[0]; 50768 50769 for (j = 1, jj = codes.length; j < jj; ++j) { 50770 if (codes[j] !== codes[j - 1] + 1) { 50771 end = range[0] + j - 1; 50772 format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code); 50773 start = end + 1; 50774 code = codes[j]; 50775 } 50776 } 50777 50778 format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code); 50779 } 50780 50781 header31012 = "\x00\x0C" + "\x00\x00" + (0, _util.string32)(format31012.length + 16) + "\x00\x00\x00\x00" + (0, _util.string32)(format31012.length / 12); 50782 } 50783 50784 return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012; 50785 } 50786 50787 function validateOS2Table(os2) { 50788 var stream = new _stream.Stream(os2.data); 50789 var version = stream.getUint16(); 50790 stream.getBytes(60); 50791 var selection = stream.getUint16(); 50792 50793 if (version < 4 && selection & 0x0300) { 50794 return false; 50795 } 50796 50797 var firstChar = stream.getUint16(); 50798 var lastChar = stream.getUint16(); 50799 50800 if (firstChar > lastChar) { 50801 return false; 50802 } 50803 50804 stream.getBytes(6); 50805 var usWinAscent = stream.getUint16(); 50806 50807 if (usWinAscent === 0) { 50808 return false; 50809 } 50810 50811 os2.data[8] = os2.data[9] = 0; 50812 return true; 50813 } 50814 50815 function createOS2Table(properties, charstrings, override) { 50816 override = override || { 50817 unitsPerEm: 0, 50818 yMax: 0, 50819 yMin: 0, 50820 ascent: 0, 50821 descent: 0 50822 }; 50823 var ulUnicodeRange1 = 0; 50824 var ulUnicodeRange2 = 0; 50825 var ulUnicodeRange3 = 0; 50826 var ulUnicodeRange4 = 0; 50827 var firstCharIndex = null; 50828 var lastCharIndex = 0; 50829 50830 if (charstrings) { 50831 for (var code in charstrings) { 50832 code |= 0; 50833 50834 if (firstCharIndex > code || !firstCharIndex) { 50835 firstCharIndex = code; 50836 } 50837 50838 if (lastCharIndex < code) { 50839 lastCharIndex = code; 50840 } 50841 50842 var position = (0, _unicode.getUnicodeRangeFor)(code); 50843 50844 if (position < 32) { 50845 ulUnicodeRange1 |= 1 << position; 50846 } else if (position < 64) { 50847 ulUnicodeRange2 |= 1 << position - 32; 50848 } else if (position < 96) { 50849 ulUnicodeRange3 |= 1 << position - 64; 50850 } else if (position < 123) { 50851 ulUnicodeRange4 |= 1 << position - 96; 50852 } else { 50853 throw new _util.FormatError("Unicode ranges Bits > 123 are reserved for internal usage"); 50854 } 50855 } 50856 50857 if (lastCharIndex > 0xffff) { 50858 lastCharIndex = 0xffff; 50859 } 50860 } else { 50861 firstCharIndex = 0; 50862 lastCharIndex = 255; 50863 } 50864 50865 var bbox = properties.bbox || [0, 0, 0, 0]; 50866 var unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0]; 50867 var scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS; 50868 var typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3])); 50869 var typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1])); 50870 50871 if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) { 50872 typoDescent = -typoDescent; 50873 } 50874 50875 var winAscent = override.yMax || typoAscent; 50876 var winDescent = -override.yMin || -typoDescent; 50877 return "\x00\x03" + "\x02\x24" + "\x01\xF4" + "\x00\x05" + "\x00\x00" + "\x02\x8A" + "\x02\xBB" + "\x00\x00" + "\x00\x8C" + "\x02\x8A" + "\x02\xBB" + "\x00\x00" + "\x01\xDF" + "\x00\x31" + "\x01\x02" + "\x00\x00" + "\x00\x00\x06" + String.fromCharCode(properties.fixedPitch ? 0x09 : 0x00) + "\x00\x00\x00\x00\x00\x00" + (0, _util.string32)(ulUnicodeRange1) + (0, _util.string32)(ulUnicodeRange2) + (0, _util.string32)(ulUnicodeRange3) + (0, _util.string32)(ulUnicodeRange4) + "\x2A\x32\x31\x2A" + string16(properties.italicAngle ? 1 : 0) + string16(firstCharIndex || properties.firstChar) + string16(lastCharIndex || properties.lastChar) + string16(typoAscent) + string16(typoDescent) + "\x00\x64" + string16(winAscent) + string16(winDescent) + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + string16(properties.xHeight) + string16(properties.capHeight) + string16(0) + string16(firstCharIndex || properties.firstChar) + "\x00\x03"; 50878 } 50879 50880 function createPostTable(properties) { 50881 var angle = Math.floor(properties.italicAngle * 2 ** 16); 50882 return "\x00\x03\x00\x00" + (0, _util.string32)(angle) + "\x00\x00" + "\x00\x00" + (0, _util.string32)(properties.fixedPitch) + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00"; 50883 } 50884 50885 function createNameTable(name, proto) { 50886 if (!proto) { 50887 proto = [[], []]; 50888 } 50889 50890 var strings = [proto[0][0] || "Original licence", proto[0][1] || name, proto[0][2] || "Unknown", proto[0][3] || "uniqueID", proto[0][4] || name, proto[0][5] || "Version 0.11", proto[0][6] || "", proto[0][7] || "Unknown", proto[0][8] || "Unknown", proto[0][9] || "Unknown"]; 50891 var stringsUnicode = []; 50892 var i, ii, j, jj, str; 50893 50894 for (i = 0, ii = strings.length; i < ii; i++) { 50895 str = proto[1][i] || strings[i]; 50896 var strBufUnicode = []; 50897 50898 for (j = 0, jj = str.length; j < jj; j++) { 50899 strBufUnicode.push(string16(str.charCodeAt(j))); 50900 } 50901
50902 stringsUnicode.push(strBufUnicode.join("")); 50903 } 50904 50905 var names = [strings, stringsUnicode]; 50906 var platforms = ["\x00\x01", "\x00\x03"]; 50907 var encodings = ["\x00\x00", "\x00\x01"]; 50908 var languages = ["\x00\x00", "\x04\x09"]; 50909 var namesRecordCount = strings.length * platforms.length; 50910 var nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6); 50911 var strOffset = 0; 50912 50913 for (i = 0, ii = platforms.length; i < ii; i++) { 50914 var strs = names[i]; 50915 50916 for (j = 0, jj = strs.length; j < jj; j++) { 50917 str = strs[j]; 50918 var nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset); 50919 nameTable += nameRecord; 50920 strOffset += str.length; 50921 } 50922 } 50923 50924 nameTable += strings.join("") + stringsUnicode.join(""); 50925 return nameTable; 50926 } 50927 50928 Font.prototype = { 50929 name: null, 50930 font: null, 50931 mimetype: null, 50932 encoding: null, 50933 disableFontFace: false, 50934 50935 get renderer() { 50936 var renderer = _font_renderer.FontRendererFactory.create(this, SEAC_ANALYSIS_ENABLED); 50937 50938 return (0, _util.shadow)(this, "renderer", renderer); 50939 }, 50940 50941 exportData: function Font_exportData() { 50942 var data = {}; 50943 50944 for (var i in this) { 50945 if (this.hasOwnProperty(i)) { 50946 data[i] = this[i]; 50947 } 50948 } 50949 50950 return data; 50951 }, 50952 fallbackToSystemFont: function Font_fallbackToSystemFont() { 50953 this.missingFile = true; 50954 var charCode, unicode; 50955 var name = this.name; 50956 var type = this.type; 50957 var subtype = this.subtype; 50958 let fontName = name.replace(/[,_]/g, "-").replace(/\s/g, ""); 50959 var stdFontMap = (0, _standard_fonts.getStdFontMap)(), 50960 nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)(); 50961 var isStandardFont = !!stdFontMap[fontName] || !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]); 50962 fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName; 50963 this.bold = fontName.search(/bold/gi) !== -1; 50964 this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1; 50965 this.black = name.search(/Black/g) !== -1; 50966 this.remeasure = Object.keys(this.widths).length > 0; 50967 50968 if (isStandardFont && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) { 50969 const GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)(); 50970 const map = []; 50971 50972 for (charCode in GlyphMapForStandardFonts) { 50973 map[+charCode] = GlyphMapForStandardFonts[charCode]; 50974 } 50975 50976 if (/Arial-?Black/i.test(name)) { 50977 var SupplementalGlyphMapForArialBlack = (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)(); 50978 50979 for (charCode in SupplementalGlyphMapForArialBlack) { 50980 map[+charCode] = SupplementalGlyphMapForArialBlack[charCode]; 50981 } 50982 } else if (/Calibri/i.test(name)) { 50983 const SupplementalGlyphMapForCalibri = (0, _standard_fonts.getSupplementalGlyphMapForCalibri)(); 50984 50985 for (charCode in SupplementalGlyphMapForCalibri) { 50986 map[+charCode] = SupplementalGlyphMapForCalibri[charCode]; 50987 } 50988 } 50989 50990 var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap; 50991 50992 if (!isIdentityUnicode) { 50993 this.toUnicode.forEach(function (charCode, unicodeCharCode) { 50994 map[+charCode] = unicodeCharCode; 50995 }); 50996 } 50997 50998 this.toFontChar = map; 50999 this.toUnicode = new ToUnicodeMap(map); 51000 } else if (/Symbol/i.test(fontName)) { 51001 this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences); 51002 } else if (/Dingbats/i.test(fontName)) { 51003 if (/Wingdings/i.test(name)) { 51004 (0, _util.warn)("Non-embedded Wingdings font, falling back to ZapfDingbats."); 51005 } 51006 51007 this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences); 51008 } else if (isStandardFont) { 51009 this.toFontChar = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences); 51010 } else { 51011 const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 51012 const map = []; 51013 this.toUnicode.forEach((charCode, unicodeCharCode) => { 51014 if (!this.composite) { 51015 var glyphName = this.differences[charCode] || this.defaultEncoding[charCode]; 51016 unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap); 51017 51018 if (unicode !== -1) { 51019 unicodeCharCode = unicode; 51020 } 51021 } 51022
51023 map[+charCode] = unicodeCharCode; 51024 }); 51025 51026 if (this.composite && this.toUnicode instanceof IdentityToUnicodeMap) { 51027 if (/Verdana/i.test(name)) { 51028 const GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)(); 51029 51030 for (charCode in GlyphMapForStandardFonts) { 51031 map[+charCode] = GlyphMapForStandardFonts[charCode]; 51032 } 51033 } 51034 } 51035 51036 this.toFontChar = map; 51037 } 51038 51039 this.loadedName = fontName.split("-")[0]; 51040 this.fontType = getFontType(type, subtype); 51041 }, 51042 checkAndRepair: function Font_checkAndRepair(name, font, properties) { 51043 const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "]; 51044 51045 function readTables(file, numTables) { 51046 const tables = Object.create(null); 51047 tables["OS/2"] = null; 51048 tables["cmap"] = null; 51049 tables["head"] = null; 51050 tables["hhea"] = null; 51051 tables["hmtx"] = null; 51052 tables["maxp"] = null; 51053 tables["name"] = null; 51054 tables["post"] = null; 51055 51056 for (let i = 0; i < numTables; i++) { 51057 const table = readTableEntry(font); 51058 51059 if (!VALID_TABLES.includes(table.tag)) { 51060 continue; 51061 } 51062 51063 if (table.length === 0) { 51064 continue; 51065 } 51066 51067 tables[table.tag] = table; 51068 } 51069 51070 return tables; 51071 } 51072 51073 function readTableEntry(file) { 51074 var tag = (0, _util.bytesToString)(file.getBytes(4)); 51075 var checksum = file.getInt32() >>> 0; 51076 var offset = file.getInt32() >>> 0; 51077 var length = file.getInt32() >>> 0; 51078 var previousPosition = file.pos; 51079 file.pos = file.start ? file.start : 0; 51080 file.skip(offset); 51081 var data = file.getBytes(length); 51082 file.pos = previousPosition; 51083 51084 if (tag === "head") { 51085 data[8] = data[9] = data[10] = data[11] = 0; 51086 data[17] |= 0x20; 51087 } 51088 51089 return { 51090 tag, 51091 checksum, 51092 length, 51093 offset, 51094 data 51095 }; 51096 } 51097 51098 function readOpenTypeHeader(ttf) { 51099 return { 51100 version: (0, _util.bytesToString)(ttf.getBytes(4)), 51101 numTables: ttf.getUint16(), 51102 searchRange: ttf.getUint16(), 51103 entrySelector: ttf.getUint16(), 51104 rangeShift: ttf.getUint16() 51105 }; 51106 } 51107 51108 function readTrueTypeCollectionHeader(ttc) { 51109 const ttcTag = (0, _util.bytesToString)(ttc.getBytes(4)); 51110 (0, _util.assert)(ttcTag === "ttcf", "Must be a TrueType Collection font."); 51111 const majorVersion = ttc.getUint16(); 51112 const minorVersion = ttc.getUint16(); 51113 const numFonts = ttc.getInt32() >>> 0; 51114 const offsetTable = []; 51115 51116 for (let i = 0; i < numFonts; i++) { 51117 offsetTable.push(ttc.getInt32() >>> 0); 51118 } 51119 51120 const header = { 51121 ttcTag, 51122 majorVersion, 51123 minorVersion, 51124 numFonts, 51125 offsetTable 51126 }; 51127 51128 switch (majorVersion) { 51129 case 1: 51130 return header; 51131 51132 case 2: 51133 header.dsigTag = ttc.getInt32() >>> 0; 51134 header.dsigLength = ttc.getInt32() >>> 0; 51135 header.dsigOffset = ttc.getInt32() >>> 0; 51136 return header; 51137 } 51138 51139 throw new _util.FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`); 51140 } 51141 51142 function readTrueTypeCollectionData(ttc, fontName) { 51143 const { 51144 numFonts, 51145 offsetTable 51146 } = readTrueTypeCollectionHeader(ttc); 51147 51148 for (let i = 0; i < numFonts; i++) { 51149 ttc.pos = (ttc.start || 0) + offsetTable[i]; 51150 const potentialHeader = readOpenTypeHeader(ttc); 51151 const potentialTables = readTables(ttc, potentialHeader.numTables); 51152 51153 if (!potentialTables["name"]) { 51154 throw new _util.FormatError('TrueType Collection font must contain a "name" table.'); 51155 } 51156 51157 const nameTable = readNameTable(potentialTables["name"]); 51158 51159 for (let j = 0, jj = nameTable.length; j < jj; j++) { 51160 for (let k = 0, kk = nameTable[j].length; k < kk; k++) { 51161 const nameEntry = nameTable[j][k]; 51162 51163 if (nameEntry && nameEntry.replace(/\s/g, "") === fontName) { 51164 return { 51165 header: potentialHeader, 51166 tables: potentialTables 51167 }; 51168 } 51169 } 51170 } 51171 } 51172 51173 throw new _util.FormatError(`TrueType Collection does not contain "${fontName}" font.`); 51174 } 51175 51176 function readCmapTable(cmap, font, isSymbolicFont, hasEncoding) { 51177 if (!cmap) { 51178 (0, _util.warn)("No cmap table available."); 51179 return { 51180 platformId: -1, 51181 encodingId: -1, 51182 mappings: [], 51183 hasShortCmap: false 51184 }; 51185 } 51186 51187 var segment; 51188 var start = (font.start ? font.start : 0) + cmap.offset; 51189 font.pos = start; 51190 font.getUint16(); 51191 var numTables = font.getUint16(); 51192 var potentialTable; 51193 var canBreak = false;
vendor: 4,131 bytes, lines 51194-51338
51194 51195 for (var i = 0; i < numTables; i++) { 51196 var platformId = font.getUint16(); 51197 var encodingId = font.getUint16(); 51198 var offset = font.getInt32() >>> 0; 51199 var useTable = false; 51200 51201 if (potentialTable && potentialTable.platformId === platformId && potentialTable.encodingId === encodingId) { 51202 continue; 51203 } 51204 51205 if (platformId === 0 && encodingId === 0) { 51206 useTable = true; 51207 } else if (platformId === 1 && encodingId === 0) { 51208 useTable = true; 51209 } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) { 51210 useTable = true; 51211 51212 if (!isSymbolicFont) { 51213 canBreak = true; 51214 } 51215 } else if (isSymbolicFont && platformId === 3 && encodingId === 0) { 51216 useTable = true; 51217 canBreak = true; 51218 } 51219 51220 if (useTable) { 51221 potentialTable = { 51222 platformId, 51223 encodingId, 51224 offset 51225 }; 51226 } 51227 51228 if (canBreak) { 51229 break; 51230 } 51231 } 51232 51233 if (potentialTable) { 51234 font.pos = start + potentialTable.offset; 51235 } 51236 51237 if (!potentialTable || font.peekByte() === -1) { 51238 (0, _util.warn)("Could not find a preferred cmap table."); 51239 return { 51240 platformId: -1, 51241 encodingId: -1, 51242 mappings: [], 51243 hasShortCmap: false 51244 }; 51245 } 51246 51247 var format = font.getUint16(); 51248 font.getUint16(); 51249 font.getUint16(); 51250 var hasShortCmap = false; 51251 var mappings = []; 51252 var j, glyphId; 51253 51254 if (format === 0) { 51255 for (j = 0; j < 256; j++) { 51256 var index = font.getByte(); 51257 51258 if (!index) { 51259 continue; 51260 } 51261 51262 mappings.push({ 51263 charCode: j, 51264 glyphId: index 51265 }); 51266 } 51267 51268 hasShortCmap = true; 51269 } else if (format === 4) { 51270 var segCount = font.getUint16() >> 1; 51271 font.getBytes(6); 51272 var segIndex, 51273 segments = []; 51274 51275 for (segIndex = 0; segIndex < segCount; segIndex++) { 51276 segments.push({ 51277 end: font.getUint16() 51278 }); 51279 } 51280 51281 font.getUint16(); 51282 51283 for (segIndex = 0; segIndex < segCount; segIndex++) { 51284 segments[segIndex].start = font.getUint16(); 51285 } 51286 51287 for (segIndex = 0; segIndex < segCount; segIndex++) { 51288 segments[segIndex].delta = font.getUint16(); 51289 } 51290 51291 var offsetsCount = 0; 51292 51293 for (segIndex = 0; segIndex < segCount; segIndex++) { 51294 segment = segments[segIndex]; 51295 var rangeOffset = font.getUint16(); 51296 51297 if (!rangeOffset) { 51298 segment.offsetIndex = -1; 51299 continue; 51300 } 51301 51302 var offsetIndex = (rangeOffset >> 1) - (segCount - segIndex); 51303 segment.offsetIndex = offsetIndex; 51304 offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1); 51305 } 51306 51307 var offsets = []; 51308 51309 for (j = 0; j < offsetsCount; j++) { 51310 offsets.push(font.getUint16()); 51311 } 51312 51313 for (segIndex = 0; segIndex < segCount; segIndex++) { 51314 segment = segments[segIndex]; 51315 start = segment.start; 51316 var end = segment.end; 51317 var delta = segment.delta; 51318 offsetIndex = segment.offsetIndex; 51319 51320 for (j = start; j <= end; j++) { 51321 if (j === 0xffff) { 51322 continue; 51323 } 51324 51325 glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start]; 51326 glyphId = glyphId + delta & 0xffff; 51327 mappings.push({ 51328 charCode: j, 51329 glyphId 51330 }); 51331 } 51332 } 51333 } else if (format === 6) { 51334 var firstCode = font.getUint16(); 51335 var entryCount = font.getUint16(); 51336 51337 for (j = 0; j < entryCount; j++) { 51338 glyphId = font.getUint16();
51339 var charCode = firstCode + j; 51340 mappings.push({ 51341 charCode, 51342 glyphId 51343 }); 51344 } 51345 } else { 51346 (0, _util.warn)("cmap table has unsupported format: " + format); 51347 return { 51348 platformId: -1, 51349 encodingId: -1, 51350 mappings: [], 51351 hasShortCmap: false 51352 }; 51353 } 51354 51355 mappings.sort(function (a, b) { 51356 return a.charCode - b.charCode; 51357 }); 51358 51359 for (i = 1; i < mappings.length; i++) { 51360 if (mappings[i - 1].charCode === mappings[i].charCode) { 51361 mappings.splice(i, 1); 51362 i--; 51363 } 51364 } 51365 51366 return { 51367 platformId: potentialTable.platformId, 51368 encodingId: potentialTable.encodingId, 51369 mappings, 51370 hasShortCmap 51371 }; 51372 } 51373 51374 function sanitizeMetrics(font, header, metrics, numGlyphs, dupFirstEntry) { 51375 if (!header) { 51376 if (metrics) { 51377 metrics.data = null; 51378 } 51379 51380 return; 51381 } 51382 51383 font.pos = (font.start ? font.start : 0) + header.offset; 51384 font.pos += 4; 51385 font.pos += 2; 51386 font.pos += 2; 51387 font.pos += 2; 51388 font.pos += 2; 51389 font.pos += 2; 51390 font.pos += 2; 51391 font.pos += 2; 51392 font.pos += 2; 51393 font.pos += 2; 51394 font.pos += 2; 51395 font.pos += 8; 51396 font.pos += 2; 51397 var numOfMetrics = font.getUint16(); 51398 51399 if (numOfMetrics > numGlyphs) { 51400 (0, _util.info)("The numOfMetrics (" + numOfMetrics + ") should not be " + "greater than the numGlyphs (" + numGlyphs + ")"); 51401 numOfMetrics = numGlyphs; 51402 header.data[34] = (numOfMetrics & 0xff00) >> 8; 51403 header.data[35] = numOfMetrics & 0x00ff; 51404 } 51405 51406 var numOfSidebearings = numGlyphs - numOfMetrics; 51407 var numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1); 51408 51409 if (numMissing > 0) { 51410 var entries = new Uint8Array(metrics.length + numMissing * 2); 51411 entries.set(metrics.data); 51412 51413 if (dupFirstEntry) { 51414 entries[metrics.length] = metrics.data[2]; 51415 entries[metrics.length + 1] = metrics.data[3]; 51416 } 51417 51418 metrics.data = entries; 51419 } 51420 } 51421 51422 function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) { 51423 var glyphProfile = { 51424 length: 0, 51425 sizeOfInstructions: 0 51426 }; 51427 51428 if (sourceEnd - sourceStart <= 12) { 51429 return glyphProfile; 51430 } 51431 51432 var glyf = source.subarray(sourceStart, sourceEnd); 51433 var contoursCount = signedInt16(glyf[0], glyf[1]); 51434 51435 if (contoursCount < 0) { 51436 contoursCount = -1; 51437 writeSignedInt16(glyf, 0, contoursCount); 51438 dest.set(glyf, destStart); 51439 glyphProfile.length = glyf.length; 51440 return glyphProfile; 51441 } 51442 51443 var i, 51444 j = 10, 51445 flagsCount = 0; 51446 51447 for (i = 0; i < contoursCount; i++) { 51448 var endPoint = glyf[j] << 8 | glyf[j + 1]; 51449 flagsCount = endPoint + 1; 51450 j += 2; 51451 } 51452 51453 var instructionsStart = j; 51454 var instructionsLength = glyf[j] << 8 | glyf[j + 1]; 51455 glyphProfile.sizeOfInstructions = instructionsLength; 51456 j += 2 + instructionsLength; 51457 var instructionsEnd = j; 51458 var coordinatesLength = 0; 51459 51460 for (i = 0; i < flagsCount; i++) { 51461 var flag = glyf[j++]; 51462 51463 if (flag & 0xc0) { 51464 glyf[j - 1] = flag & 0x3f; 51465 } 51466 51467 let xLength = 2; 51468 51469 if (flag & 2) { 51470 xLength = 1; 51471 } else if (flag & 16) { 51472 xLength = 0; 51473 } 51474 51475 let yLength = 2; 51476 51477 if (flag & 4) { 51478 yLength = 1; 51479 } else if (flag & 32) { 51480 yLength = 0; 51481 } 51482 51483 const xyLength = xLength + yLength; 51484 coordinatesLength += xyLength; 51485 51486 if (flag & 8) { 51487 var repeat = glyf[j++]; 51488 i += repeat;
51489 coordinatesLength += repeat * xyLength; 51490 } 51491 } 51492 51493 if (coordinatesLength === 0) { 51494 return glyphProfile; 51495 } 51496 51497 var glyphDataLength = j + coordinatesLength; 51498 51499 if (glyphDataLength > glyf.length) { 51500 return glyphProfile; 51501 } 51502 51503 if (!hintsValid && instructionsLength > 0) { 51504 dest.set(glyf.subarray(0, instructionsStart), destStart); 51505 dest.set([0, 0], destStart + instructionsStart); 51506 dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2); 51507 glyphDataLength -= instructionsLength; 51508 51509 if (glyf.length - glyphDataLength > 3) { 51510 glyphDataLength = glyphDataLength + 3 & ~3; 51511 } 51512 51513 glyphProfile.length = glyphDataLength; 51514 return glyphProfile; 51515 } 51516 51517 if (glyf.length - glyphDataLength > 3) { 51518 glyphDataLength = glyphDataLength + 3 & ~3; 51519 dest.set(glyf.subarray(0, glyphDataLength), destStart); 51520 glyphProfile.length = glyphDataLength; 51521 return glyphProfile; 51522 } 51523 51524 dest.set(glyf, destStart); 51525 glyphProfile.length = glyf.length; 51526 return glyphProfile; 51527 } 51528 51529 function sanitizeHead(head, numGlyphs, locaLength) { 51530 var data = head.data; 51531 var version = int32(data[0], data[1], data[2], data[3]); 51532 51533 if (version >> 16 !== 1) { 51534 (0, _util.info)("Attempting to fix invalid version in head table: " + version); 51535 data[0] = 0; 51536 data[1] = 1; 51537 data[2] = 0; 51538 data[3] = 0; 51539 } 51540 51541 var indexToLocFormat = int16(data[50], data[51]); 51542 51543 if (indexToLocFormat < 0 || indexToLocFormat > 1) { 51544 (0, _util.info)("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat); 51545 var numGlyphsPlusOne = numGlyphs + 1; 51546 51547 if (locaLength === numGlyphsPlusOne << 1) { 51548 data[50] = 0; 51549 data[51] = 0; 51550 } else if (locaLength === numGlyphsPlusOne << 2) { 51551 data[50] = 0; 51552 data[51] = 1; 51553 } else { 51554 throw new _util.FormatError("Could not fix indexToLocFormat: " + indexToLocFormat); 51555 } 51556 } 51557 } 51558 51559 function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) { 51560 var itemSize, itemDecode, itemEncode; 51561 51562 if (isGlyphLocationsLong) { 51563 itemSize = 4; 51564 51565 itemDecode = function fontItemDecodeLong(data, offset) { 51566 return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]; 51567 }; 51568 51569 itemEncode = function fontItemEncodeLong(data, offset, value) { 51570 data[offset] = value >>> 24 & 0xff; 51571 data[offset + 1] = value >> 16 & 0xff; 51572 data[offset + 2] = value >> 8 & 0xff; 51573 data[offset + 3] = value & 0xff; 51574 }; 51575 } else { 51576 itemSize = 2; 51577 51578 itemDecode = function fontItemDecode(data, offset) { 51579 return data[offset] << 9 | data[offset + 1] << 1; 51580 }; 51581 51582 itemEncode = function fontItemEncode(data, offset, value) { 51583 data[offset] = value >> 9 & 0xff; 51584 data[offset + 1] = value >> 1 & 0xff; 51585 }; 51586 } 51587 51588 var numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs; 51589 var locaDataSize = itemSize * (1 + numGlyphsOut); 51590 var locaData = new Uint8Array(locaDataSize); 51591 locaData.set(loca.data.subarray(0, locaDataSize)); 51592 loca.data = locaData; 51593 var oldGlyfData = glyf.data; 51594 var oldGlyfDataLength = oldGlyfData.length; 51595 var newGlyfData = new Uint8Array(oldGlyfDataLength); 51596 var startOffset = itemDecode(locaData, 0); 51597 var writeOffset = 0; 51598 var missingGlyphs = Object.create(null); 51599 itemEncode(locaData, 0, writeOffset); 51600 var i, j; 51601 51602 for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) { 51603 var endOffset = itemDecode(locaData, j); 51604 51605 if (endOffset === 0) { 51606 endOffset = startOffset; 51607 } 51608 51609 if (endOffset > oldGlyfDataLength && (oldGlyfDataLength + 3 & ~3) === endOffset) { 51610 endOffset = oldGlyfDataLength; 51611 } 51612 51613 if (endOffset > oldGlyfDataLength) { 51614 startOffset = endOffset; 51615 } 51616 51617 var glyphProfile = sanitizeGlyph(oldGlyfData, startOffset, endOffset, newGlyfData, writeOffset, hintsValid); 51618 var newLength = glyphProfile.length; 51619 51620 if (newLength === 0) { 51621 missingGlyphs[i] = true; 51622 } 51623
vendor: 5,363 bytes, lines 51624-51810
51624 if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) { 51625 maxSizeOfInstructions = glyphProfile.sizeOfInstructions; 51626 } 51627 51628 writeOffset += newLength; 51629 itemEncode(locaData, j, writeOffset); 51630 startOffset = endOffset; 51631 } 51632 51633 if (writeOffset === 0) { 51634 var simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]); 51635 51636 for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) { 51637 itemEncode(locaData, j, simpleGlyph.length); 51638 } 51639 51640 glyf.data = simpleGlyph; 51641 } else if (dupFirstEntry) { 51642 var firstEntryLength = itemDecode(locaData, itemSize); 51643 51644 if (newGlyfData.length > firstEntryLength + writeOffset) { 51645 glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset); 51646 } else { 51647 glyf.data = new Uint8Array(firstEntryLength + writeOffset); 51648 glyf.data.set(newGlyfData.subarray(0, writeOffset)); 51649 } 51650 51651 glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset); 51652 itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength); 51653 } else { 51654 glyf.data = newGlyfData.subarray(0, writeOffset); 51655 } 51656 51657 return { 51658 missingGlyphs, 51659 maxSizeOfInstructions 51660 }; 51661 } 51662 51663 function readPostScriptTable(post, properties, maxpNumGlyphs) { 51664 var start = (font.start ? font.start : 0) + post.offset; 51665 font.pos = start; 51666 var length = post.length, 51667 end = start + length; 51668 var version = font.getInt32(); 51669 font.getBytes(28); 51670 var glyphNames; 51671 var valid = true; 51672 var i; 51673 51674 switch (version) { 51675 case 0x00010000: 51676 glyphNames = MacStandardGlyphOrdering; 51677 break; 51678 51679 case 0x00020000: 51680 var numGlyphs = font.getUint16(); 51681 51682 if (numGlyphs !== maxpNumGlyphs) { 51683 valid = false; 51684 break; 51685 } 51686 51687 var glyphNameIndexes = []; 51688 51689 for (i = 0; i < numGlyphs; ++i) { 51690 var index = font.getUint16(); 51691 51692 if (index >= 32768) { 51693 valid = false; 51694 break; 51695 } 51696 51697 glyphNameIndexes.push(index); 51698 } 51699 51700 if (!valid) { 51701 break; 51702 } 51703 51704 var customNames = []; 51705 var strBuf = []; 51706 51707 while (font.pos < end) { 51708 var stringLength = font.getByte(); 51709 strBuf.length = stringLength; 51710 51711 for (i = 0; i < stringLength; ++i) { 51712 strBuf[i] = String.fromCharCode(font.getByte()); 51713 } 51714 51715 customNames.push(strBuf.join("")); 51716 } 51717 51718 glyphNames = []; 51719 51720 for (i = 0; i < numGlyphs; ++i) { 51721 var j = glyphNameIndexes[i]; 51722 51723 if (j < 258) { 51724 glyphNames.push(MacStandardGlyphOrdering[j]); 51725 continue; 51726 } 51727 51728 glyphNames.push(customNames[j - 258]); 51729 } 51730 51731 break; 51732 51733 case 0x00030000: 51734 break; 51735 51736 default: 51737 (0, _util.warn)("Unknown/unsupported post table version " + version); 51738 valid = false; 51739 51740 if (properties.defaultEncoding) { 51741 glyphNames = properties.defaultEncoding; 51742 } 51743 51744 break; 51745 } 51746 51747 properties.glyphNames = glyphNames; 51748 return valid; 51749 } 51750 51751 function readNameTable(nameTable) { 51752 var start = (font.start ? font.start : 0) + nameTable.offset; 51753 font.pos = start; 51754 var names = [[], []]; 51755 var length = nameTable.length, 51756 end = start + length; 51757 var format = font.getUint16(); 51758 var FORMAT_0_HEADER_LENGTH = 6; 51759 51760 if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) { 51761 return names; 51762 } 51763 51764 var numRecords = font.getUint16(); 51765 var stringsStart = font.getUint16(); 51766 var records = []; 51767 var NAME_RECORD_LENGTH = 12; 51768 var i, ii; 51769 51770 for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) { 51771 var r = { 51772 platform: font.getUint16(), 51773 encoding: font.getUint16(), 51774 language: font.getUint16(), 51775 name: font.getUint16(), 51776 length: font.getUint16(), 51777 offset: font.getUint16() 51778 }; 51779 51780 if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) { 51781 records.push(r); 51782 } 51783 } 51784 51785 for (i = 0, ii = records.length; i < ii; i++) { 51786 var record = records[i]; 51787 51788 if (record.length <= 0) { 51789 continue; 51790 } 51791 51792 var pos = start + stringsStart + record.offset; 51793 51794 if (pos + record.length > end) { 51795 continue; 51796 } 51797 51798 font.pos = pos; 51799 var nameIndex = record.name; 51800 51801 if (record.encoding) { 51802 var str = ""; 51803 51804 for (var j = 0, jj = record.length; j < jj; j += 2) { 51805 str += String.fromCharCode(font.getUint16()); 51806 } 51807 51808 names[1][nameIndex] = str; 51809 } else { 51810 names[0][nameIndex] = (0, _util.bytesToString)(font.getBytes(rec
51810ord.length)); 51811 } 51812 } 51813 51814 return names; 51815 } 51816 51817 var TTOpsStackDeltas = [0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, 0, 0, -2, -5, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, -1, -1, 1, -1, -999, 0, 1, 0, -1, -2, 0, -1, -2, -1, -1, 0, -1, -1, 0, 0, -999, -999, -1, -1, -1, -1, -2, -999, -2, -2, -999, 0, -2, -2, 0, 0, -2, 0, -2, 0, 0, 0, -2, -1, -1, 1, 1, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, 0, -999, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -999, -999, -999, -999, -999, -1, -1, -2, -2, 0, 0, 0, 0, -1, -1, -999, -2, -2, 0, 0, -1, -2, -2, 0, 0, 0, -1, -1, -1, -2]; 51818 51819 function sanitizeTTProgram(table, ttContext) { 51820 var data = table.data; 51821 var i = 0, 51822 j, 51823 n, 51824 b, 51825 funcId, 51826 pc, 51827 lastEndf = 0, 51828 lastDeff = 0; 51829 var stack = []; 51830 var callstack = []; 51831 var functionsCalled = []; 51832 var tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions; 51833 var inFDEF = false, 51834 ifLevel = 0, 51835 inELSE = 0; 51836 51837 for (var ii = data.length; i < ii;) { 51838 var op = data[i++]; 51839 51840 if (op === 0x40) { 51841 n = data[i++]; 51842 51843 if (inFDEF || inELSE) { 51844 i += n; 51845 } else { 51846 for (j = 0; j < n; j++) { 51847 stack.push(data[i++]); 51848 } 51849 } 51850 } else if (op === 0x41) { 51851 n = data[i++]; 51852 51853 if (inFDEF || inELSE) { 51854 i += n * 2; 51855 } else { 51856 for (j = 0; j < n; j++) { 51857 b = data[i++]; 51858 stack.push(b << 8 | data[i++]); 51859 } 51860 } 51861 } else if ((op & 0xf8) === 0xb0) { 51862 n = op - 0xb0 + 1; 51863 51864 if (inFDEF || inELSE) { 51865 i += n; 51866 } else { 51867 for (j = 0; j < n; j++) { 51868 stack.push(data[i++]); 51869 } 51870 } 51871 } else if ((op & 0xf8) === 0xb8) { 51872 n = op - 0xb8 + 1; 51873 51874 if (inFDEF || inELSE) { 51875 i += n * 2; 51876 } else { 51877 for (j = 0; j < n; j++) { 51878 b = data[i++]; 51879 stack.push(b << 8 | data[i++]); 51880 } 51881 } 51882 } else if (op === 0x2b && !tooComplexToFollowFunctions) { 51883 if (!inFDEF && !inELSE) { 51884 funcId = stack[stack.length - 1]; 51885 51886 if (isNaN(funcId)) { 51887 (0, _util.info)("TT: CALL empty stack (or invalid entry)."); 51888 } else { 51889 ttContext.functionsUsed[funcId] = true; 51890 51891 if (funcId in ttContext.functionsStackDeltas) { 51892 const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId]; 51893 51894 if (newStackLength < 0) {
vendor: 4,116 bytes, lines 51895-52033
51895 (0, _util.warn)("TT: CALL invalid functions stack delta."); 51896 ttContext.hintsValid = false; 51897 return; 51898 } 51899 51900 stack.length = newStackLength; 51901 } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) { 51902 callstack.push({ 51903 data, 51904 i, 51905 stackTop: stack.length - 1 51906 }); 51907 functionsCalled.push(funcId); 51908 pc = ttContext.functionsDefined[funcId]; 51909 51910 if (!pc) { 51911 (0, _util.warn)("TT: CALL non-existent function"); 51912 ttContext.hintsValid = false; 51913 return; 51914 } 51915 51916 data = pc.data; 51917 i = pc.i; 51918 } 51919 } 51920 } 51921 } else if (op === 0x2c && !tooComplexToFollowFunctions) { 51922 if (inFDEF || inELSE) { 51923 (0, _util.warn)("TT: nested FDEFs not allowed"); 51924 tooComplexToFollowFunctions = true; 51925 } 51926 51927 inFDEF = true; 51928 lastDeff = i; 51929 funcId = stack.pop(); 51930 ttContext.functionsDefined[funcId] = { 51931 data, 51932 i 51933 }; 51934 } else if (op === 0x2d) { 51935 if (inFDEF) { 51936 inFDEF = false; 51937 lastEndf = i; 51938 } else { 51939 pc = callstack.pop(); 51940 51941 if (!pc) { 51942 (0, _util.warn)("TT: ENDF bad stack"); 51943 ttContext.hintsValid = false; 51944 return; 51945 } 51946 51947 funcId = functionsCalled.pop(); 51948 data = pc.data; 51949 i = pc.i; 51950 ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop; 51951 } 51952 } else if (op === 0x89) { 51953 if (inFDEF || inELSE) { 51954 (0, _util.warn)("TT: nested IDEFs not allowed"); 51955 tooComplexToFollowFunctions = true; 51956 } 51957 51958 inFDEF = true; 51959 lastDeff = i; 51960 } else if (op === 0x58) { 51961 ++ifLevel; 51962 } else if (op === 0x1b) { 51963 inELSE = ifLevel; 51964 } else if (op === 0x59) { 51965 if (inELSE === ifLevel) { 51966 inELSE = 0; 51967 } 51968 51969 --ifLevel; 51970 } else if (op === 0x1c) { 51971 if (!inFDEF && !inELSE) { 51972 var offset = stack[stack.length - 1]; 51973 51974 if (offset > 0) { 51975 i += offset - 1; 51976 } 51977 } 51978 } 51979 51980 if (!inFDEF && !inELSE) { 51981 let stackDelta = 0; 51982 51983 if (op <= 0x8e) { 51984 stackDelta = TTOpsStackDeltas[op]; 51985 } else if (op >= 0xc0 && op <= 0xdf) { 51986 stackDelta = -1; 51987 } else if (op >= 0xe0) { 51988 stackDelta = -2; 51989 } 51990 51991 if (op >= 0x71 && op <= 0x75) { 51992 n = stack.pop(); 51993 51994 if (!isNaN(n)) { 51995 stackDelta = -n * 2; 51996 } 51997 } 51998 51999 while (stackDelta < 0 && stack.length > 0) { 52000 stack.pop(); 52001 stackDelta++; 52002 } 52003 52004 while (stackDelta > 0) { 52005 stack.push(NaN); 52006 stackDelta--; 52007 } 52008 } 52009 } 52010 52011 ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions; 52012 var content = [data]; 52013 52014 if (i > data.length) { 52015 content.push(new Uint8Array(i - data.length)); 52016 } 52017 52018 if (lastDeff > lastEndf) { 52019 (0, _util.warn)("TT: complementing a missing function tail"); 52020 content.push(new Uint8Array([0x22, 0x2d])); 52021 } 52022 52023 foldTTTable(table, content); 52024 } 52025 52026 function checkInvalidFunctions(ttContext, maxFunctionDefs) { 52027 if (ttContext.tooComplexToFollowFunctions) { 52028 return; 52029 } 52030 52031 if (ttContext.functionsDefined.length > maxFunctionDefs) { 52032 (0, _util.warn)("TT: more functions defined than expected"); 52033 ttContext.hintsValid = false;
52034 return; 52035 } 52036 52037 for (var j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) { 52038 if (j > maxFunctionDefs) { 52039 (0, _util.warn)("TT: invalid function id: " + j); 52040 ttContext.hintsValid = false; 52041 return; 52042 } 52043 52044 if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) { 52045 (0, _util.warn)("TT: undefined function: " + j); 52046 ttContext.hintsValid = false; 52047 return; 52048 } 52049 } 52050 } 52051 52052 function foldTTTable(table, content) { 52053 if (content.length > 1) { 52054 var newLength = 0; 52055 var j, jj; 52056 52057 for (j = 0, jj = content.length; j < jj; j++) { 52058 newLength += content[j].length; 52059 } 52060 52061 newLength = newLength + 3 & ~3; 52062 var result = new Uint8Array(newLength); 52063 var pos = 0; 52064 52065 for (j = 0, jj = content.length; j < jj; j++) { 52066 result.set(content[j], pos); 52067 pos += content[j].length; 52068 } 52069 52070 table.data = result; 52071 table.length = newLength; 52072 } 52073 } 52074 52075 function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) { 52076 var ttContext = { 52077 functionsDefined: [], 52078 functionsUsed: [], 52079 functionsStackDeltas: [], 52080 tooComplexToFollowFunctions: false, 52081 hintsValid: true 52082 }; 52083 52084 if (fpgm) { 52085 sanitizeTTProgram(fpgm, ttContext); 52086 } 52087 52088 if (prep) { 52089 sanitizeTTProgram(prep, ttContext); 52090 } 52091 52092 if (fpgm) { 52093 checkInvalidFunctions(ttContext, maxFunctionDefs); 52094 } 52095 52096 if (cvt && cvt.length & 1) { 52097 var cvtData = new Uint8Array(cvt.length + 1); 52098 cvtData.set(cvt.data); 52099 cvt.data = cvtData; 52100 } 52101 52102 return ttContext.hintsValid; 52103 } 52104 52105 font = new _stream.Stream(new Uint8Array(font.getBytes())); 52106 let header, tables; 52107 52108 if (isTrueTypeCollectionFile(font)) { 52109 const ttcData = readTrueTypeCollectionData(font, this.name); 52110 header = ttcData.header; 52111 tables = ttcData.tables; 52112 } else { 52113 header = readOpenTypeHeader(font); 52114 tables = readTables(font, header.numTables); 52115 } 52116 52117 let cff, cffFile; 52118 var isTrueType = !tables["CFF "]; 52119 52120 if (!isTrueType) { 52121 const isComposite = properties.composite && ((properties.cidToGidMap || []).length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap)); 52122 52123 if (header.version === "OTTO" && !isComposite || !tables["head"] || !tables["hhea"] || !tables["maxp"] || !tables["post"]) { 52124 cffFile = new _stream.Stream(tables["CFF "].data); 52125 cff = new CFFFont(cffFile, properties); 52126 adjustWidths(properties); 52127 return this.convert(name, cff, properties); 52128 } 52129 52130 delete tables["glyf"]; 52131 delete tables["loca"]; 52132 delete tables["fpgm"]; 52133 delete tables["prep"]; 52134 delete tables["cvt "]; 52135 this.isOpenType = true; 52136 } else { 52137 if (!tables["loca"]) { 52138 throw new _util.FormatError('Required "loca" table is not found'); 52139 } 52140 52141 if (!tables["glyf"]) { 52142 (0, _util.warn)('Required "glyf" table is not found -- trying to recover.'); 52143 tables["glyf"] = { 52144 tag: "glyf", 52145 data: new Uint8Array(0) 52146 }; 52147 } 52148 52149 this.isOpenType = false;
52150 } 52151 52152 if (!tables["maxp"]) { 52153 throw new _util.FormatError('Required "maxp" table is not found'); 52154 } 52155 52156 font.pos = (font.start || 0) + tables["maxp"].offset; 52157 var version = font.getInt32(); 52158 const numGlyphs = font.getUint16(); 52159 let numGlyphsOut = numGlyphs + 1; 52160 let dupFirstEntry = true; 52161 52162 if (numGlyphsOut > 0xffff) { 52163 dupFirstEntry = false; 52164 numGlyphsOut = numGlyphs; 52165 (0, _util.warn)("Not enough space in glyfs to duplicate first glyph."); 52166 } 52167 52168 var maxFunctionDefs = 0; 52169 var maxSizeOfInstructions = 0; 52170 52171 if (version >= 0x00010000 && tables["maxp"].length >= 22) { 52172 font.pos += 8; 52173 var maxZones = font.getUint16(); 52174 52175 if (maxZones > 2) { 52176 tables["maxp"].data[14] = 0; 52177 tables["maxp"].data[15] = 2; 52178 } 52179 52180 font.pos += 4; 52181 maxFunctionDefs = font.getUint16(); 52182 font.pos += 4; 52183 maxSizeOfInstructions = font.getUint16(); 52184 } 52185 52186 tables["maxp"].data[4] = numGlyphsOut >> 8; 52187 tables["maxp"].data[5] = numGlyphsOut & 255; 52188 var hintsValid = sanitizeTTPrograms(tables["fpgm"], tables["prep"], tables["cvt "], maxFunctionDefs); 52189 52190 if (!hintsValid) { 52191 delete tables["fpgm"]; 52192 delete tables["prep"]; 52193 delete tables["cvt "]; 52194 } 52195 52196 sanitizeMetrics(font, tables["hhea"], tables["hmtx"], numGlyphsOut, dupFirstEntry); 52197 52198 if (!tables["head"]) { 52199 throw new _util.FormatError('Required "head" table is not found'); 52200 } 52201 52202 sanitizeHead(tables["head"], numGlyphs, isTrueType ? tables["loca"].length : 0); 52203 var missingGlyphs = Object.create(null); 52204 52205 if (isTrueType) { 52206 var isGlyphLocationsLong = int16(tables["head"].data[50], tables["head"].data[51]); 52207 var glyphsInfo = sanitizeGlyphLocations(tables["loca"], tables["glyf"], numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions); 52208 missingGlyphs = glyphsInfo.missingGlyphs; 52209 52210 if (version >= 0x00010000 && tables["maxp"].length >= 22) { 52211 tables["maxp"].data[26] = glyphsInfo.maxSizeOfInstructions >> 8; 52212 tables["maxp"].data[27] = glyphsInfo.maxSizeOfInstructions & 255; 52213 } 52214 } 52215 52216 if (!tables["hhea"]) { 52217 throw new _util.FormatError('Required "hhea" table is not found'); 52218 } 52219 52220 if (tables["hhea"].data[10] === 0 && tables["hhea"].data[11] === 0) { 52221 tables["hhea"].data[10] = 0xff; 52222 tables["hhea"].data[11] = 0xff; 52223 } 52224 52225 var metricsOverride = { 52226 unitsPerEm: int16(tables["head"].data[18], tables["head"].data[19]), 52227 yMax: int16(tables["head"].data[42], tables["head"].data[43]), 52228 yMin: signedInt16(tables["head"].data[38], tables["head"].data[39]), 52229 ascent: int16(tables["hhea"].data[4], tables["hhea"].data[5]), 52230 descent: signedInt16(tables["hhea"].data[6], tables["hhea"].data[7]) 52231 }; 52232 this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm; 52233 this.descent = metricsOverride.descent / metricsOverride.unitsPerEm; 52234 52235 if (tables["post"]) { 52236 readPostScriptTable(tables["post"], properties, numGlyphs); 52237 } 52238 52239 tables["post"] = { 52240 tag: "post", 52241 data: createPostTable(properties) 52242 }; 52243 var charCodeToGlyphId = [], 52244 charCode; 52245 52246 function hasGlyph(glyphId) { 52247 return !missingGlyphs[glyphId]; 52248 } 52249 52250 if (properties.composite) { 52251 var cidToGidMap = properties.cidToGidMap || []; 52252 var isCidToGidMapEmpty = cidToGidMap.length === 0; 52253 properties.cMap.forEach(function (charCode, cid) { 52254 if (cid > 0xffff) { 52255 throw new _util.FormatError("Max size of CID is 65,535"); 52256 } 52257 52258 var glyphId = -1; 52259 52260 if (isCidToGidMapEmpty) { 52261 glyphId = cid; 52262 } else if (cidToGidMap[cid] !== undefined) { 52263 glyphId = cidToGidMap[cid]; 52264 } 52265 52266 if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) { 52267 charCodeToGlyphId[charCode] = glyphId; 52268 } 52269 }); 52270 } else { 52271 var cmapTable = readCmapTable(tables["cmap"], font, this.isSymbolicFont, properties.hasEncoding); 52272 var cmapPlatformId = cmapTable.platformId; 52273 var cmapEncodingId = cmapTable.encodingId; 52274 var cmapMappings = cmapTable.mappings; 52275 var cmapMappingsLength = cmapMappings.length; 52276 52277 if (properties.hasEncoding && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0) || cmapPlatformId === -1 && cmapEncodingId === -1 && !!(0, _encodings.getEncoding)(properties.baseEncodingName)) { 52278 var baseEncoding = []; 52279 52280 if (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding") { 52281 baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName); 52282 } 52283 52284 var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 52285 52286 for (charCode = 0; charCode < 256; charCode++) { 52287 var glyphName, standardGlyphName; 52288
52289 if (this.differences && charCode in this.differences) { 52290 glyphName = this.differences[charCode]; 52291 } else if (charCode in baseEncoding && baseEncoding[charCode] !== "") { 52292 glyphName = baseEncoding[charCode]; 52293 } else { 52294 glyphName = _encodings.StandardEncoding[charCode]; 52295 } 52296 52297 if (!glyphName) { 52298 continue; 52299 } 52300 52301 standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap); 52302 var unicodeOrCharCode; 52303 52304 if (cmapPlatformId === 3 && cmapEncodingId === 1) { 52305 unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName]; 52306 } else if (cmapPlatformId === 1 && cmapEncodingId === 0) { 52307 unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName); 52308 } 52309 52310 var found = false; 52311 52312 for (let i = 0; i < cmapMappingsLength; ++i) { 52313 if (cmapMappings[i].charCode !== unicodeOrCharCode) { 52314 continue; 52315 } 52316 52317 charCodeToGlyphId[charCode] = cmapMappings[i].glyphId; 52318 found = true; 52319 break; 52320 } 52321 52322 if (!found && properties.glyphNames) { 52323 var glyphId = properties.glyphNames.indexOf(glyphName); 52324 52325 if (glyphId === -1 && standardGlyphName !== glyphName) { 52326 glyphId = properties.glyphNames.indexOf(standardGlyphName); 52327 } 52328 52329 if (glyphId > 0 && hasGlyph(glyphId)) { 52330 charCodeToGlyphId[charCode] = glyphId; 52331 } 52332 } 52333 } 52334 } else if (cmapPlatformId === 0 && cmapEncodingId === 0) { 52335 for (let i = 0; i < cmapMappingsLength; ++i) { 52336 charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId; 52337 } 52338 } else { 52339 for (let i = 0; i < cmapMappingsLength; ++i) { 52340 charCode = cmapMappings[i].charCode; 52341 52342 if (cmapPlatformId === 3 && charCode >= 0xf000 && charCode <= 0xf0ff) { 52343 charCode &= 0xff; 52344 } 52345 52346 charCodeToGlyphId[charCode] = cmapMappings[i].glyphId; 52347 } 52348 } 52349 } 52350 52351 if (charCodeToGlyphId.length === 0) { 52352 charCodeToGlyphId[0] = 0; 52353 } 52354 52355 let glyphZeroId = numGlyphsOut - 1; 52356 52357 if (!dupFirstEntry) { 52358 glyphZeroId = 0; 52359 } 52360 52361 var newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId); 52362 this.toFontChar = newMapping.toFontChar; 52363 tables["cmap"] = { 52364 tag: "cmap", 52365 data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphsOut) 52366 }; 52367 52368 if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"])) { 52369 tables["OS/2"] = { 52370 tag: "OS/2", 52371 data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride) 52372 }; 52373 } 52374 52375 if (!isTrueType) { 52376 try { 52377 cffFile = new _stream.Stream(tables["CFF "].data); 52378 var parser = new _cff_parser.CFFParser(cffFile, properties, SEAC_ANALYSIS_ENABLED); 52379 cff = parser.parse(); 52380 cff.duplicateFirstGlyph(); 52381 var compiler = new _cff_parser.CFFCompiler(cff); 52382 tables["CFF "].data = compiler.compile(); 52383 } catch (e) { 52384 (0, _util.warn)("Failed to compile font " + properties.loadedName); 52385 } 52386 } 52387 52388 if (!tables["name"]) { 52389 tables["name"] = { 52390 tag: "name", 52391 data: createNameTable(this.name) 52392 }; 52393 } else { 52394 var namePrototype = readNameTable(tables["name"]); 52395 tables["name"].data = createNameTable(name, namePrototype); 52396 } 52397 52398 var builder = new OpenTypeFileBuilder(header.version); 52399 52400 for (var tableTag in tables) { 52401 builder.addTable(tableTag, tables[tableTag].data); 52402 } 52403 52404 return builder.toArray(); 52405 }, 52406 convert: function Font_convert(fontName, font, properties) { 52407 properties.fixedPitch = false; 52408 52409 if (properties.builtInEncoding) { 52410 adjustToUnicode(properties, properties.builtInEncoding); 52411 } 52412 52413 let glyphZeroId = 1; 52414 52415 if (font instanceof CFFFont) { 52416 glyphZeroId = font.numGlyphs - 1; 52417 } 52418 52419 var mapping = font.getGlyphMapping(properties); 52420 var newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId); 52421 this.toFontChar = newMapping.toFontChar; 52422 var numGlyphs = font.numGlyphs; 52423 52424 function getCharCodes(charCodeToGlyphId, glyphId) {
vendor: 5,526 bytes, lines 52425-52576
52425 var charCodes = null; 52426 52427 for (var charCode in charCodeToGlyphId) { 52428 if (glyphId === charCodeToGlyphId[charCode]) { 52429 if (!charCodes) { 52430 charCodes = []; 52431 } 52432 52433 charCodes.push(charCode | 0); 52434 } 52435 } 52436 52437 return charCodes; 52438 } 52439 52440 function createCharCode(charCodeToGlyphId, glyphId) { 52441 for (var charCode in charCodeToGlyphId) { 52442 if (glyphId === charCodeToGlyphId[charCode]) { 52443 return charCode | 0; 52444 } 52445 } 52446 52447 newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId; 52448 return newMapping.nextAvailableFontCharCode++; 52449 } 52450 52451 var seacs = font.seacs; 52452 52453 if (SEAC_ANALYSIS_ENABLED && seacs && seacs.length) { 52454 var matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX; 52455 var charset = font.getCharset(); 52456 var seacMap = Object.create(null); 52457 52458 for (var glyphId in seacs) { 52459 glyphId |= 0; 52460 var seac = seacs[glyphId]; 52461 var baseGlyphName = _encodings.StandardEncoding[seac[2]]; 52462 var accentGlyphName = _encodings.StandardEncoding[seac[3]]; 52463 var baseGlyphId = charset.indexOf(baseGlyphName); 52464 var accentGlyphId = charset.indexOf(accentGlyphName); 52465 52466 if (baseGlyphId < 0 || accentGlyphId < 0) { 52467 continue; 52468 } 52469 52470 var accentOffset = { 52471 x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4], 52472 y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5] 52473 }; 52474 var charCodes = getCharCodes(mapping, glyphId); 52475 52476 if (!charCodes) { 52477 continue; 52478 } 52479 52480 for (var i = 0, ii = charCodes.length; i < ii; i++) { 52481 var charCode = charCodes[i]; 52482 var charCodeToGlyphId = newMapping.charCodeToGlyphId; 52483 var baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId); 52484 var accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId); 52485 seacMap[charCode] = { 52486 baseFontCharCode, 52487 accentFontCharCode, 52488 accentOffset 52489 }; 52490 } 52491 } 52492 52493 properties.seacMap = seacMap; 52494 } 52495 52496 var unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0]; 52497 var builder = new OpenTypeFileBuilder("\x4F\x54\x54\x4F"); 52498 builder.addTable("CFF ", font.data); 52499 builder.addTable("OS/2", createOS2Table(properties, newMapping.charCodeToGlyphId)); 52500 builder.addTable("cmap", createCmapTable(newMapping.charCodeToGlyphId, numGlyphs)); 52501 builder.addTable("head", "\x00\x01\x00\x00" + "\x00\x00\x10\x00" + "\x00\x00\x00\x00" + "\x5F\x0F\x3C\xF5" + "\x00\x00" + safeString16(unitsPerEm) + "\x00\x00\x00\x00\x9e\x0b\x7e\x27" + "\x00\x00\x00\x00\x9e\x0b\x7e\x27" + "\x00\x00" + safeString16(properties.descent) + "\x0F\xFF" + safeString16(properties.ascent) + string16(properties.italicAngle ? 2 : 0) + "\x00\x11" + "\x00\x00" + "\x00\x00" + "\x00\x00"); 52502 builder.addTable("hhea", "\x00\x01\x00\x00" + safeString16(properties.ascent) + safeString16(properties.descent) + "\x00\x00" + "\xFF\xFF" + "\x00\x00" + "\x00\x00" + "\x00\x00" + safeString16(properties.capHeight) + safeString16(Math.tan(properties.italicAngle) * properties.xHeight) + "\x00\x00" + "\x00\x00" + "\x00\x00" + "\x00\x00" + "\x00\x00" + "\x00\x00" + string16(numGlyphs)); 52503 builder.addTable("hmtx", function fontFieldsHmtx() { 52504 var charstrings = font.charstrings; 52505 var cffWidths = font.cff ? font.cff.widths : null; 52506 var hmtx = "\x00\x00\x00\x00"; 52507 52508 for (var i = 1, ii = numGlyphs; i < ii; i++) { 52509 var width = 0; 52510 52511 if (charstrings) { 52512 var charstring = charstrings[i - 1]; 52513 width = "width" in charstring ? charstring.width : 0; 52514 } else if (cffWidths) { 52515 width = Math.ceil(cffWidths[i] || 0); 52516 } 52517 52518 hmtx += string16(width) + string16(0); 52519 } 52520 52521 return hmtx; 52522 }()); 52523 builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs)); 52524 builder.addTable("name", createNameTable(fontName)); 52525 builder.addTable("post", createPostTable(properties)); 52526 return builder.toArray(); 52527 }, 52528 52529 get spaceWidth() { 52530 if ("_shadowWidth" in this) { 52531 return this._shadowWidth; 52532 } 52533 52534 var possibleSpaceReplacements = ["space", "minus", "one", "i", "I"]; 52535 var width; 52536 52537 for (var i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) { 52538 var glyphName = possibleSpaceReplacements[i]; 52539 52540 if (glyphName in this.widths) { 52541 width = this.widths[glyphName]; 52542 break; 52543 } 52544 52545 var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 52546 var glyphUnicode = glyphsUnicodeMap[glyphName]; 52547 var charcode = 0; 52548 52549 if (this.composite) { 52550 if (this.cMap.contains(glyphUnicode)) { 52551 charcode = this.cMap.lookup(glyphUnicode); 52552 } 52553 } 52554 52555 if (!charcode && this.toUnicode) { 52556 charcode = this.toUnicode.charCodeOf(glyphUnicode); 52557 } 52558 52559 if (charcode <= 0) { 52560 charcode = glyphUnicode; 52561 } 52562 52563 width = this.widths[charcode]; 52564 52565 if (width) { 52566 break; 52567 } 52568 } 52569 52570 width = width || this.defaultWidth; 52571 this._shadowWidth = width; 52572 return width; 52573 }, 52574 52575 charToGlyph: function Font_charToGlyph(charcode, isSpace) { 52576 var fontCharCode, width, operatorListId;
52577 var widthCode = charcode; 52578 52579 if (this.cMap && this.cMap.contains(charcode)) { 52580 widthCode = this.cMap.lookup(charcode); 52581 } 52582 52583 width = this.widths[widthCode]; 52584 width = (0, _util.isNum)(width) ? width : this.defaultWidth; 52585 var vmetric = this.vmetrics && this.vmetrics[widthCode]; 52586 let unicode = this.toUnicode.get(charcode) || this.fallbackToUnicode.get(charcode) || charcode; 52587 52588 if (typeof unicode === "number") { 52589 unicode = String.fromCharCode(unicode); 52590 } 52591 52592 var isInFont = charcode in this.toFontChar; 52593 fontCharCode = this.toFontChar[charcode] || charcode; 52594 52595 if (this.missingFile) { 52596 const glyphName = this.differences[charcode] || this.defaultEncoding[charcode]; 52597 52598 if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") { 52599 fontCharCode = 0x20; 52600 } 52601 52602 fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode); 52603 } 52604 52605 if (this.isType3Font) { 52606 operatorListId = fontCharCode; 52607 } 52608 52609 var accent = null; 52610 52611 if (this.seacMap && this.seacMap[charcode]) { 52612 isInFont = true; 52613 var seac = this.seacMap[charcode]; 52614 fontCharCode = seac.baseFontCharCode; 52615 accent = { 52616 fontChar: String.fromCodePoint(seac.accentFontCharCode), 52617 offset: seac.accentOffset 52618 }; 52619 } 52620 52621 var fontChar = typeof fontCharCode === "number" ? String.fromCodePoint(fontCharCode) : ""; 52622 var glyph = this.glyphCache[charcode]; 52623 52624 if (!glyph || !glyph.matchesForCache(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) { 52625 glyph = new Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont); 52626 this.glyphCache[charcode] = glyph; 52627 } 52628 52629 return glyph; 52630 }, 52631 charsToGlyphs: function Font_charsToGlyphs(chars) { 52632 var charsCache = this.charsCache; 52633 var glyphs, glyph, charcode; 52634 52635 if (charsCache) { 52636 glyphs = charsCache[chars]; 52637 52638 if (glyphs) { 52639 return glyphs; 52640 } 52641 } 52642 52643 if (!charsCache) { 52644 charsCache = this.charsCache = Object.create(null); 52645 } 52646 52647 glyphs = []; 52648 var charsCacheKey = chars; 52649 var i = 0, 52650 ii; 52651 52652 if (this.cMap) { 52653 var c = Object.create(null); 52654 52655 while (i < chars.length) { 52656 this.cMap.readCharCode(chars, i, c); 52657 charcode = c.charcode; 52658 var length = c.length; 52659 i += length; 52660 var isSpace = length === 1 && chars.charCodeAt(i - 1) === 0x20; 52661 glyph = this.charToGlyph(charcode, isSpace); 52662 glyphs.push(glyph); 52663 } 52664 } else { 52665 for (i = 0, ii = chars.length; i < ii; ++i) { 52666 charcode = chars.charCodeAt(i); 52667 glyph = this.charToGlyph(charcode, charcode === 0x20); 52668 glyphs.push(glyph); 52669 } 52670 } 52671 52672 return charsCache[charsCacheKey] = glyphs; 52673 }, 52674 52675 get glyphCacheValues() { 52676 return Object.values(this.glyphCache); 52677 } 52678 52679 }; 52680 return Font; 52681}(); 52682 52683exports.Font = Font; 52684 52685var ErrorFont = function ErrorFontClosure() { 52686 function ErrorFont(error) { 52687 this.error = error; 52688 this.loadedName = "g_font_error"; 52689 this.missingFile = true; 52690 } 52691 52692 ErrorFont.prototype = { 52693 charsToGlyphs: function ErrorFont_charsToGlyphs() { 52694 return []; 52695 }, 52696 exportData: function ErrorFont_exportData() { 52697 return { 52698 error: this.error 52699 }; 52700 } 52701 }; 52702 return ErrorFont; 52703}(); 52704 52705exports.ErrorFont = ErrorFont; 52706 52707function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) { 52708 var charCodeToGlyphId = Object.create(null); 52709 var glyphId, charCode, baseEncoding; 52710 var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic); 52711 52712 if (properties.baseEncodingName) { 52713 baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName); 52714 52715 for (charCode = 0; charCode < baseEncoding.length; charCode++) { 52716 glyphId = glyphNames.indexOf(baseEncoding[charCode]); 52717 52718 if (glyphId >= 0) { 52719 charCodeToGlyphId[charCode] = glyphId; 52720 } else { 52721 charCodeToGlyphId[charCode] = 0; 52722 } 52723 } 52724 } else if (isSymbolicFont) { 52725 for (charCode in builtInEncoding) {
52726 charCodeToGlyphId[charCode] = builtInEncoding[charCode]; 52727 } 52728 } else { 52729 baseEncoding = _encodings.StandardEncoding; 52730 52731 for (charCode = 0; charCode < baseEncoding.length; charCode++) { 52732 glyphId = glyphNames.indexOf(baseEncoding[charCode]); 52733 52734 if (glyphId >= 0) { 52735 charCodeToGlyphId[charCode] = glyphId; 52736 } else { 52737 charCodeToGlyphId[charCode] = 0; 52738 } 52739 } 52740 } 52741 52742 var differences = properties.differences, 52743 glyphsUnicodeMap; 52744 52745 if (differences) { 52746 for (charCode in differences) { 52747 var glyphName = differences[charCode]; 52748 glyphId = glyphNames.indexOf(glyphName); 52749 52750 if (glyphId === -1) { 52751 if (!glyphsUnicodeMap) { 52752 glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)(); 52753 } 52754 52755 var standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap); 52756 52757 if (standardGlyphName !== glyphName) { 52758 glyphId = glyphNames.indexOf(standardGlyphName); 52759 } 52760 } 52761 52762 if (glyphId >= 0) { 52763 charCodeToGlyphId[charCode] = glyphId; 52764 } else { 52765 charCodeToGlyphId[charCode] = 0; 52766 } 52767 } 52768 } 52769 52770 return charCodeToGlyphId; 52771} 52772 52773var Type1Font = function Type1FontClosure() { 52774 function findBlock(streamBytes, signature, startIndex) { 52775 var streamBytesLength = streamBytes.length; 52776 var signatureLength = signature.length; 52777 var scanLength = streamBytesLength - signatureLength; 52778 var i = startIndex, 52779 j, 52780 found = false; 52781 52782 while (i < scanLength) { 52783 j = 0; 52784 52785 while (j < signatureLength && streamBytes[i + j] === signature[j]) { 52786 j++; 52787 } 52788 52789 if (j >= signatureLength) { 52790 i += j; 52791 52792 while (i < streamBytesLength && (0, _core_utils.isWhiteSpace)(streamBytes[i])) { 52793 i++; 52794 } 52795 52796 found = true; 52797 break; 52798 } 52799 52800 i++; 52801 } 52802 52803 return { 52804 found, 52805 length: i 52806 }; 52807 } 52808 52809 function getHeaderBlock(stream, suggestedLength) { 52810 var EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63]; 52811 var streamStartPos = stream.pos; 52812 var headerBytes, headerBytesLength, block; 52813 52814 try { 52815 headerBytes = stream.getBytes(suggestedLength); 52816 headerBytesLength = headerBytes.length; 52817 } catch (ex) { 52818 if (ex instanceof _core_utils.MissingDataException) { 52819 throw ex; 52820 } 52821 } 52822 52823 if (headerBytesLength === suggestedLength) { 52824 block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length); 52825 52826 if (block.found && block.length === suggestedLength) { 52827 return { 52828 stream: new _stream.Stream(headerBytes), 52829 length: suggestedLength 52830 }; 52831 } 52832 } 52833 52834 (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.'); 52835 stream.pos = streamStartPos; 52836 var SCAN_BLOCK_LENGTH = 2048; 52837 var actualLength; 52838 52839 while (true) { 52840 var scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH); 52841 block = findBlock(scanBytes, EEXEC_SIGNATURE, 0); 52842 52843 if (block.length === 0) { 52844 break; 52845 } 52846 52847 stream.pos += block.length; 52848 52849 if (block.found) { 52850 actualLength = stream.pos - streamStartPos; 52851 break; 52852 } 52853 } 52854 52855 stream.pos = streamStartPos; 52856 52857 if (actualLength) { 52858 return { 52859 stream: new _stream.Stream(stream.getBytes(actualLength)), 52860 length: actualLength 52861 }; 52862 } 52863 52864 (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.'); 52865 return { 52866 stream: new _stream.Stream(stream.getBytes(suggestedLength)), 52867 length: suggestedLength 52868 }; 52869 } 52870 52871 function getEexecBlock(stream, suggestedLength) { 52872 var eexecBytes = stream.getBytes(); 52873 return { 52874 stream: new _stream.Stream(eexecBytes), 52875 length: eexecBytes.length 52876 }; 52877 } 52878 52879 function Type1Font(name, file, properties) { 52880 var PFB_HEADER_SIZE = 6; 52881 var headerBlockLength = properties.length1; 52882 var eexecBlockLength = properties.length2; 52883 var pfbHeader = file.peekBytes(PFB_HEADER_SIZE); 52884 var pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01; 52885 52886 if (pfbHeaderPresent) { 52887 file.skip(PFB_HEADER_SIZE); 52888 headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2]; 52889 } 52890 52891 var headerBlock = getHeaderBlock(file, headerBlockLength); 52892 var headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, SEAC_ANALYSIS_ENABLED); 52893 headerBlockParser.extractFontHeader(properties); 52894 52895 if (pfbHeaderPresent) { 52896 pfbHeader = file.getBytes(PFB_HEADER_SIZE); 52897 eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2]; 52898 } 52899 52900 var eexecBlock = getEexecBlock(file, eexecBlockLength); 52901 var eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, SEAC_ANALYSIS_ENABLED); 52902 var data = eexecBlockParser.extractFontProgram(properties); 52903 52904 for (var info in data.properties) { 52905 properties[info] = data.properties[info]; 52906 } 52907 52908 var charstrings = data.charstrings; 52909 var type2Charstrings = this.getType2Charstrings(charstrings); 52910 var subrs = this.getType2Subrs(data.subrs); 52911 this.charstrings = charstrings; 52912 this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
52913 this.seacs = this.getSeacs(data.charstrings); 52914 } 52915 52916 Type1Font.prototype = { 52917 get numGlyphs() { 52918 return this.charstrings.length + 1; 52919 }, 52920 52921 getCharset: function Type1Font_getCharset() { 52922 var charset = [".notdef"]; 52923 var charstrings = this.charstrings; 52924 52925 for (var glyphId = 0; glyphId < charstrings.length; glyphId++) { 52926 charset.push(charstrings[glyphId].glyphName); 52927 } 52928 52929 return charset; 52930 }, 52931 getGlyphMapping: function Type1Font_getGlyphMapping(properties) { 52932 var charstrings = this.charstrings; 52933 var glyphNames = [".notdef"], 52934 glyphId; 52935 52936 for (glyphId = 0; glyphId < charstrings.length; glyphId++) { 52937 glyphNames.push(charstrings[glyphId].glyphName); 52938 } 52939 52940 var encoding = properties.builtInEncoding; 52941 52942 if (encoding) { 52943 var builtInEncoding = Object.create(null); 52944 52945 for (var charCode in encoding) { 52946 glyphId = glyphNames.indexOf(encoding[charCode]); 52947 52948 if (glyphId >= 0) { 52949 builtInEncoding[charCode] = glyphId; 52950 } 52951 } 52952 } 52953 52954 return type1FontGlyphMapping(properties, builtInEncoding, glyphNames); 52955 }, 52956 hasGlyphId: function Type1Font_hasGlyphID(id) { 52957 if (id < 0 || id >= this.numGlyphs) { 52958 return false; 52959 } 52960 52961 if (id === 0) { 52962 return true; 52963 } 52964 52965 var glyph = this.charstrings[id - 1]; 52966 return glyph.charstring.length > 0; 52967 }, 52968 getSeacs: function Type1Font_getSeacs(charstrings) { 52969 var i, ii; 52970 var seacMap = []; 52971 52972 for (i = 0, ii = charstrings.length; i < ii; i++) { 52973 var charstring = charstrings[i]; 52974 52975 if (charstring.seac) { 52976 seacMap[i + 1] = charstring.seac; 52977 } 52978 } 52979 52980 return seacMap; 52981 }, 52982 getType2Charstrings: function Type1Font_getType2Charstrings(type1Charstrings) { 52983 var type2Charstrings = []; 52984 52985 for (var i = 0, ii = type1Charstrings.length; i < ii; i++) { 52986 type2Charstrings.push(type1Charstrings[i].charstring); 52987 } 52988 52989 return type2Charstrings; 52990 }, 52991 getType2Subrs: function Type1Font_getType2Subrs(type1Subrs) { 52992 var bias = 0; 52993 var count = type1Subrs.length; 52994 52995 if (count < 1133) { 52996 bias = 107; 52997 } else if (count < 33769) { 52998 bias = 1131; 52999 } else { 53000 bias = 32768; 53001 } 53002 53003 var type2Subrs = []; 53004 var i; 53005 53006 for (i = 0; i < bias; i++) { 53007 type2Subrs.push([0x0b]); 53008 } 53009 53010 for (i = 0; i < count; i++) { 53011 type2Subrs.push(type1Subrs[i]); 53012 } 53013 53014 return type2Subrs; 53015 }, 53016 wrap: function Type1Font_wrap(name, glyphs, charstrings, subrs, properties) { 53017 var cff = new _cff_parser.CFF(); 53018 cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4); 53019 cff.names = [name]; 53020 var topDict = new _cff_parser.CFFTopDict(); 53021 topDict.setByName("version", 391); 53022 topDict.setByName("Notice", 392); 53023 topDict.setByName("FullName", 393); 53024 topDict.setByName("FamilyName", 394); 53025 topDict.setByName("Weight", 395); 53026 topDict.setByName("Encoding", null); 53027 topDict.setByName("FontMatrix", properties.fontMatrix); 53028 topDict.setByName("FontBBox", properties.bbox); 53029 topDict.setByName("charset", null); 53030 topDict.setByName("CharStrings", null); 53031 topDict.setByName("Private", null); 53032 cff.topDict = topDict; 53033 var strings = new _cff_parser.CFFStrings(); 53034 strings.add("Version 0.11"); 53035 strings.add("See original notice"); 53036 strings.add(name); 53037 strings.add(name); 53038 strings.add("Medium"); 53039 cff.strings = strings; 53040 cff.globalSubrIndex = new _cff_parser.CFFIndex(); 53041 var count = glyphs.length; 53042 var charsetArray = [".notdef"]; 53043 var i, ii; 53044 53045 for (i = 0; i < count; i++) { 53046 const glyphName = charstrings[i].glyphName; 53047 53048 const index = _cff_parser.CFFStandardStrings.indexOf(glyphName); 53049 53050 if (index === -1) { 53051 strings.add(glyphName); 53052 } 53053 53054 charsetArray.push(glyphName); 53055 } 53056 53057 cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray); 53058 var charStringsIndex = new _cff_parser.CFFIndex(); 53059 charStringsIndex.add([0x8b, 0x0e]); 53060 53061 for (i = 0; i < count; i++) { 53062 charStringsIndex.add(glyphs[i]); 53063 } 53064 53065 cff.charStrings = charStringsIndex; 53066 var privateDict = new _cff_parser.CFFPrivateDict(); 53067 privateDict.setByName("Subrs", null); 53068 var fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"]; 53069 53070 for (i = 0, ii = fields.length; i < ii; i++) { 53071 var field = fields[i]; 53072 53073 if (!(field in properties.privateData)) { 53074 continue; 53075 } 53076 53077 var value = properties.privateData[field]; 53078 53079 if (Array.isArray(value)) { 53080 for (var j = value.length - 1; j > 0; j--) { 53081 value[j] -= value[j - 1]; 53082 } 53083 } 53084 53085 privateDict.setByName(field, value); 53086 } 53087 53088 cff.topDict.privateDict = privateDict; 53089 var subrIndex = new _cff_parser.CFFIndex(); 53090 53091 for (i = 0, ii = subrs.length; i < ii; i++) { 53092 subrIndex.add(subrs[i]); 53093 } 53094 53095 privateDict.subrsIndex = subrIndex; 53096 var compiler = new _cff_parser.CFFCompiler(cff); 53097 return compiler.compile(); 53098 } 53099 }; 53100 return Type1Font; 53101}(); 53102 53103var CFFFont = function CFFFontClosure() { 53104 function CFFFont(file, properties) { 53105 this.properties = properties; 53106 var parser = new _cff_parser.CFFParser(file, properties, SEAC_ANALYSIS_ENABLED); 53107 this.cff = parser.parse(); 53108 this.cff.duplicateFirstGlyph(); 53109 var compiler = new _cff_parser.CFFCompiler(this.cff); 53110 this.seacs = this.cff.seacs; 53111 53112 try { 53113 this.data = compiler.compile(); 53114 } catch (e) { 53115 (0, _util.warn)("Failed to compile font " + properties.loadedName); 53116 this.data = file; 53117 } 53118 } 53119 53120 CFFFont.prototype = { 53121 get numGlyphs() { 53122 return this.cff.charStrings.count; 53123 }, 53124
53125 getCharset: function CFFFont_getCharset() { 53126 return this.cff.charset.charset; 53127 }, 53128 getGlyphMapping: function CFFFont_getGlyphMapping() { 53129 var cff = this.cff; 53130 var properties = this.properties; 53131 var charsets = cff.charset.charset; 53132 var charCodeToGlyphId; 53133 var glyphId; 53134 53135 if (properties.composite) { 53136 charCodeToGlyphId = Object.create(null); 53137 let charCode; 53138 53139 if (cff.isCIDFont) { 53140 for (glyphId = 0; glyphId < charsets.length; glyphId++) { 53141 var cid = charsets[glyphId]; 53142 charCode = properties.cMap.charCodeOf(cid); 53143 charCodeToGlyphId[charCode] = glyphId; 53144 } 53145 } else { 53146 for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) { 53147 charCode = properties.cMap.charCodeOf(glyphId); 53148 charCodeToGlyphId[charCode] = glyphId; 53149 } 53150 } 53151 53152 return charCodeToGlyphId; 53153 } 53154 53155 var encoding = cff.encoding ? cff.encoding.encoding : null; 53156 charCodeToGlyphId = type1FontGlyphMapping(properties, encoding, charsets); 53157 return charCodeToGlyphId; 53158 }, 53159 hasGlyphId: function CFFFont_hasGlyphID(id) { 53160 return this.cff.hasGlyphId(id); 53161 } 53162 }; 53163 return CFFFont; 53164}(); 53165 53166/***/ }), 53167/* 28 */ 53168/***/ (function(module, exports, __w_pdfjs_require__) { 53169 53170"use strict"; 53171 53172 53173Object.defineProperty(exports, "__esModule", { 53174 value: true 53175}); 53176exports.CFFFDSelect = exports.CFFCompiler = exports.CFFPrivateDict = exports.CFFTopDict = exports.CFFCharset = exports.CFFIndex = exports.CFFStrings = exports.CFFHeader = exports.CFF = exports.CFFParser = exports.CFFStandardStrings = void 0; 53177 53178var _util = __w_pdfjs_require__(2); 53179 53180var _charsets = __w_pdfjs_require__(29); 53181 53182var _encodings = __w_pdfjs_require__(30); 53183 53184var MAX_SUBR_NESTING = 10; 53185var 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
53185ntered", "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"]; 53186exports.CFFStandardStrings = CFFStandardStrings; 53187const NUM_STANDARD_CFF_STRINGS = 391; 53188 53189var CFFParser = function CFFParserClosure() { 53190 var CharstringValidationData = [null, { 53191 id: "hstem", 53192 min: 2, 53193 stackClearing: true, 53194 stem: true 53195 }, null, { 53196 id: "vstem", 53197 min: 2, 53198 stackClearing: true, 53199 stem: true 53200 }, { 53201 id: "vmoveto", 53202 min: 1, 53203 stackClearing: true 53204 }, { 53205 id: "rlineto", 53206 min: 2, 53207 resetStack: true 53208 }, { 53209 id: "hlineto", 53210 min: 1, 53211 resetStack: true 53212 }, { 53213 id: "vlineto", 53214 min: 1, 53215 resetStack: true 53216 }, { 53217 id: "rrcurveto", 53218 min: 6, 53219 resetStack: true 53220 }, null, { 53221 id: "callsubr", 53222 min: 1, 53223 undefStack: true 53224 }, { 53225 id: "return", 53226 min: 0, 53227 undefStack: true 53228 }, null, null, { 53229 id: "endchar", 53230 min: 0, 53231 stackClearing: true 53232 }, null, null, null, { 53233 id: "hstemhm", 53234 min: 2, 53235 stackClearing: true, 53236 stem: true 53237 }, { 53238 id: "hintmask", 53239 min: 0, 53240 stackClearing: true 53241 }, { 53242 id: "cntrmask", 53243 min: 0, 53244 stackClearing: true 53245 }, { 53246 id: "rmoveto", 53247 min: 2, 53248 stackClearing: true 53249 }, { 53250 id: "hmoveto", 53251 min: 1, 53252 stackClearing: true 53253 }, { 53254 id: "vstemhm", 53255 min: 2, 53256 stackClearing: true, 53257 stem: true 53258 }, { 53259 id: "rcurveline", 53260 min: 8, 53261 resetStack: true 53262 }, { 53263 id: "rlinecurve", 53264 min: 8, 53265 resetStack: true 53266 }, { 53267 id: "vvcurveto", 53268 min: 4, 53269 resetStack: true 53270 }, { 53271 id: "hhcurveto", 53272 min: 4, 53273 resetStack: true 53274 }, null, { 53275 id: "callgsubr", 53276 min: 1, 53277 undefStack: true 53278 }, { 53279 id: "vhcurveto", 53280 min: 4, 53281 resetStack: true 53282 }, { 53283 id: "hvcurveto", 53284 min: 4, 53285 resetStack: true 53286 }]; 53287 var CharstringValidationData12 = [null, null, null, { 53288 id: "and", 53289 min: 2, 53290 stackDelta: -1 53291 }, { 53292 id: "or", 53293 min: 2, 53294 stackDelta: -1 53295 }, { 53296 id: "not", 53297 min: 1, 53298 stackDelta: 0 53299 }, null, null, null, { 53300 id: "abs", 53301 min: 1, 53302 stackDelta: 0 53303 }, { 53304 id: "add", 53305 min: 2, 53306 stackDelta: -1, 53307 stackFn: function stack_div(stack, index) { 53308 stack[index - 2] = stack[index - 2] + stack[index - 1]; 53309 } 53310 }, { 53311 id: "sub", 53312 min: 2, 53313 stackDelta: -1, 53314 stackFn: function stack_div(stack, index) { 53315 stack[index - 2] = stack[index - 2] - stack[index - 1]; 53316 } 53317 }, { 53318 id: "div", 53319 min: 2, 53320 stackDelta: -1, 53321 stackFn: function stack_div(stack, index) { 53322 stack[index - 2] = stack[index - 2] / stack[index - 1]; 53323 } 53324 }, null, { 53325 id: "neg", 53326 min: 1, 53327 stackDelta: 0, 53328 stackFn: function stack_div(stack, index) { 53329 stack[index - 1] = -stack[index - 1]; 53330 } 53331 }, { 53332 id: "eq", 53333 min: 2, 53334 stackDelta: -1 53335 }, null, null, { 53336 id: "drop", 53337 min: 1, 53338 stackDelta: -1 53339 }, null, { 53340 id: "put", 53341 min: 2, 53342 stackDelta: -2 53343 }, { 53344 id: "get", 53345 min: 1, 53346 stackDelta: 0 53347 }, { 53348 id: "ifelse", 53349 min: 4, 53350 stackDelta: -3 53351 }, { 53352 id: "random", 53353 min: 0, 53354 stackDelta: 1 53355 }, { 53356 id: "mul", 53357 min: 2, 53358 stackDelta: -1, 53359 stackFn: function stack_div(stack, index) { 53360 stack[index - 2] = stack[index - 2] * stack[index - 1]; 53361 } 53362 }, null, { 53363 id: "sqrt", 53364 min: 1, 53365 stackDelta: 0 53366 }, { 53367 id: "dup", 53368 min: 1, 53369 stackDelta: 1 53370 }, { 53371 id: "exch", 53372 min: 2, 53373 stackDelta: 0 53374 }, { 53375 id: "index", 53376 min: 2, 53377 stackDelta: 0 53378 }, { 53379 id: "roll", 53380 min: 3, 53381 stackDelta: -2 53382 }, null, null, null, { 53383 id: "hflex", 53384 min: 7, 53385 resetStack: true 53386 }, { 53387 id: "flex", 53388 min: 13, 53389 resetStack: true 53390 }, { 53391 id: "hflex1", 53392 min: 9, 53393 resetStack: true 53394 }, { 53395 id: "flex1", 53396 min: 11, 53397 resetStack: true 53398 }]; 53399 53400 function CFFParser(file, properties, seacAnalysisEnabled) { 53401 this.bytes = file.getBytes(); 53402 this.properties = properties; 53403 this.seacAnalysisEnabled = !!seacAnalysisEnabled; 53404 } 53405 53406 CFFParser.prototype = { 53407 parse: function CFFParser_parse() { 53408 var properties = this.properties; 53409 var cff = new CFF(); 53410 this.cff = cff; 53411 var header = this.parseHeader(); 53412 var nameIndex = this.parseIndex(header.endPos); 53413 var topDictIndex = this.parseIndex(nameIndex.endPos); 53414 var stringIndex = this.parseIndex(topDictIndex.endPos); 53415 var globalSubrIndex = this.parseIndex(stringIndex.endPos); 53416 var topDictParsed = this.parseDict(topDictIndex.obj.get(0)); 53417 var topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings); 53418 cff.header = header.obj; 53419 cff.names = this.parseNameIndex(nameIndex.obj); 53420 cff.strings = this.parseStringIndex(stringIndex.obj); 53421 cff.topDict = topDict; 53422 cff.globalSubrIndex = globalSubrIndex.obj; 53423 this.parsePrivateDict(cff.topDict); 53424 cff.isCIDFont = topDict.hasName("ROS"); 53425 var charStringOffset = topDict.getByName("CharStrings"); 53426 var charStringIndex = this.parseIndex(charStringOffset).obj; 53427 var fontMatrix = topDict.getByName("FontMatrix"); 53428 53429 if (fontMatrix) { 53430 properties.fontMatrix = fontMatrix; 53431 } 53432 53433 var fontBBox = topDict.getByName("FontBBox"); 53434 53435 if (fontBBox) { 53436 properties.ascent = Math.max(fontBBox[3], fontBBox[1]); 53437 properties.descent = Math.min(fontBBox[1], fontBBox[3]); 53438 properties.ascentScaled = true; 53439 } 53440 53441 var charset, encoding; 53442 53443 if (cff.isCIDFont) { 53444 var fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj; 53445 53446 for (var i = 0, ii = fdArrayIndex.count; i < ii; ++i) { 53447 var dictRaw = fdArrayIndex.get(i); 53448 var fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings); 53449 this.parsePrivateDict(fontDict); 53450 cff.fdArray.push(fontDict); 53451 } 53452 53453 encoding = null; 53454 charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true); 53455 cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count); 53456 } else { 53457 charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false); 53458 encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset); 53459 } 53460 53461 cff.charset = charset; 53462 cff.encoding = encoding; 53463 var charStringsAndSeacs = this.parseCharStrings({ 53464 charStrings: charStringIndex, 53465 localSubrIndex: topDict.privateDict.subrsIndex, 53466 globalSubrIndex: globalSubrIndex.obj, 53467 fdSelect: cff.fdSelect, 53468 fdArray: cff.fdArray, 53469 privateDict: topDict.privateDict 53470 }); 53471 cff.charStrings = charStringsAndSeacs.charStrings; 53472 cff.seacs = charStringsAndSeacs.seacs; 53473 cff.widths = charStringsAndSeacs.widths; 53474 return cff; 53475 }, 53476 parseHeader: function CFFParser_parseHeader() { 53477 var bytes = this.bytes; 53478 var bytesLength = bytes.length; 53479 var offset = 0; 53480 53481 while (offset < bytesLength && bytes[offset] !== 1) { 53482 ++offset; 53483 } 53484 53485 if (offset >= bytesLength) { 53486 throw new _util.FormatError("Invalid CFF header"); 53487 } 53488 53489 if (offset !== 0) { 53490 (0, _util.info)("cff data is shifted"); 53491 bytes = bytes.subarray(offset); 53492 this.bytes = bytes; 53493 } 53494 53495 var major = bytes[0]; 53496 var minor = bytes[1]; 53497 var hdrSize = bytes[2]; 53498 var offSize = bytes[3]; 53499 var header = new CFFHeader(major, minor, hdrSize, offSize); 53500 return { 53501 obj: header, 53502 endPos: hdrSize 53503 }; 53504 }, 53505 parseDict: function CFFParser_parseDict(dict) { 53506 var pos = 0; 53507 53508 function parseOperand() { 53509 var value = dict[pos++]; 53510 53511 if (value === 30) { 53512 return parseFloatOperand(); 53513 } else if (value === 28) { 53514 value = dict[pos++]; 53515 value = (value << 24 | dict[pos++] << 16) >> 16; 53516 return value; 53517 } else if (value === 29) { 53518 value = dict[pos++]; 53519 value = value << 8 | dict[pos++]; 53520 value = value << 8 | dict[pos++]; 53521 value = value << 8 | dict[pos++]; 53522 return value; 53523 } else if (value >= 32 && value <= 246) { 53524 return value - 139; 53525 } else if (value >= 247 && value <= 250) { 53526 return (value - 247) * 256 + dict[pos++] + 108; 53527 } else if (value >= 251 && value <= 254) { 53528 return -((value - 251) * 256) - dict[pos++] - 108; 53529 } 53530 53531 (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.'); 53532 return NaN; 53533 } 53534 53535 function parseFloatOperand() { 53536 var str = ""; 53537 var eof = 15; 53538 const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"]; 53539 var length = dict.length; 53540 53541 while (pos < length) { 53542 var b = dict[pos++]; 53543 var b1 = b >> 4; 53544 var b2 = b & 15; 53545 53546 if (b1 === eof) { 53547 break; 53548 } 53549 53550 str += lookup[b1]; 53551 53552 if (b2 === eof) { 53553 break; 53554 } 53555 53556 str += lookup[b2]; 53557 } 53558 53559 return parseFloat(str); 53560 } 53561 53562 var operands = []; 53563 var entries = []; 53564 pos = 0; 53565 var end = dict.length; 53566 53567 while (pos < end) { 53568 var b = dict[pos]; 53569 53570 if (b <= 21) { 53571 if (b === 12) { 53572 b = b << 8 | dict[++pos]; 53573 } 53574
53575 entries.push([b, operands]); 53576 operands = []; 53577 ++pos; 53578 } else { 53579 operands.push(parseOperand()); 53580 } 53581 } 53582 53583 return entries; 53584 }, 53585 parseIndex: function CFFParser_parseIndex(pos) { 53586 var cffIndex = new CFFIndex(); 53587 var bytes = this.bytes; 53588 var count = bytes[pos++] << 8 | bytes[pos++]; 53589 var offsets = []; 53590 var end = pos; 53591 var i, ii; 53592 53593 if (count !== 0) { 53594 var offsetSize = bytes[pos++]; 53595 var startPos = pos + (count + 1) * offsetSize - 1; 53596 53597 for (i = 0, ii = count + 1; i < ii; ++i) { 53598 var offset = 0; 53599 53600 for (var j = 0; j < offsetSize; ++j) { 53601 offset <<= 8; 53602 offset += bytes[pos++]; 53603 } 53604 53605 offsets.push(startPos + offset); 53606 } 53607 53608 end = offsets[count]; 53609 } 53610 53611 for (i = 0, ii = offsets.length - 1; i < ii; ++i) { 53612 var offsetStart = offsets[i]; 53613 var offsetEnd = offsets[i + 1]; 53614 cffIndex.add(bytes.subarray(offsetStart, offsetEnd)); 53615 } 53616 53617 return { 53618 obj: cffIndex, 53619 endPos: end 53620 }; 53621 }, 53622 parseNameIndex: function CFFParser_parseNameIndex(index) { 53623 var names = []; 53624 53625 for (var i = 0, ii = index.count; i < ii; ++i) { 53626 var name = index.get(i); 53627 names.push((0, _util.bytesToString)(name)); 53628 } 53629 53630 return names; 53631 }, 53632 parseStringIndex: function CFFParser_parseStringIndex(index) { 53633 var strings = new CFFStrings(); 53634 53635 for (var i = 0, ii = index.count; i < ii; ++i) { 53636 var data = index.get(i); 53637 strings.add((0, _util.bytesToString)(data)); 53638 } 53639 53640 return strings; 53641 }, 53642 createDict: function CFFParser_createDict(Type, dict, strings) { 53643 var cffDict = new Type(strings); 53644 53645 for (var i = 0, ii = dict.length; i < ii; ++i) { 53646 var pair = dict[i]; 53647 var key = pair[0]; 53648 var value = pair[1]; 53649 cffDict.setByKey(key, value); 53650 } 53651 53652 return cffDict; 53653 }, 53654 parseCharString: function CFFParser_parseCharString(state, data, localSubrIndex, globalSubrIndex) { 53655 if (!data || state.callDepth > MAX_SUBR_NESTING) { 53656 return false; 53657 } 53658 53659 var stackSize = state.stackSize; 53660 var stack = state.stack; 53661 var length = data.length; 53662 53663 for (var j = 0; j < length;) { 53664 var value = data[j++]; 53665 var validationCommand = null; 53666 53667 if (value === 12) { 53668 var q = data[j++]; 53669 53670 if (q === 0) { 53671 data[j - 2] = 139; 53672 data[j - 1] = 22; 53673 stackSize = 0; 53674 } else { 53675 validationCommand = CharstringValidationData12[q]; 53676 } 53677 } else if (value === 28) { 53678 stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16; 53679 j += 2; 53680 stackSize++; 53681 } else if (value === 14) { 53682 if (stackSize >= 4) { 53683 stackSize -= 4; 53684 53685 if (this.seacAnalysisEnabled) { 53686 state.seac = stack.slice(stackSize, stackSize + 4); 53687 return false; 53688 } 53689 } 53690 53691 validationCommand = CharstringValidationData[value]; 53692 } else if (value >= 32 && value <= 246) { 53693 stack[stackSize] = value - 139; 53694 stackSize++; 53695 } else if (value >= 247 && value <= 254) { 53696 stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108; 53697 j++; 53698 stackSize++; 53699 } else if (value === 255) { 53700 stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536; 53701 j += 4; 53702 stackSize++; 53703 } else if (value === 19 || value === 20) { 53704 state.hints += stackSize >> 1; 53705 j += state.hints + 7 >> 3; 53706 stackSize %= 2; 53707 validationCommand = CharstringValidationData[value]; 53708 } else if (value === 10 || value === 29) { 53709 var subrsIndex; 53710 53711 if (value === 10) { 53712 subrsIndex = localSubrIndex; 53713 } else { 53714 subrsIndex = globalSubrIndex; 53715 } 53716 53717 if (!subrsIndex) { 53718 validationCommand = CharstringValidationData[value]; 53719 (0, _util.warn)("Missing subrsIndex for " + validationCommand.id); 53720 return false;
53721 } 53722 53723 var bias = 32768; 53724 53725 if (subrsIndex.count < 1240) { 53726 bias = 107; 53727 } else if (subrsIndex.count < 33900) { 53728 bias = 1131; 53729 } 53730 53731 var subrNumber = stack[--stackSize] + bias; 53732 53733 if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) { 53734 validationCommand = CharstringValidationData[value]; 53735 (0, _util.warn)("Out of bounds subrIndex for " + validationCommand.id); 53736 return false; 53737 } 53738 53739 state.stackSize = stackSize; 53740 state.callDepth++; 53741 var valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex); 53742 53743 if (!valid) { 53744 return false; 53745 } 53746 53747 state.callDepth--; 53748 stackSize = state.stackSize; 53749 continue; 53750 } else if (value === 11) { 53751 state.stackSize = stackSize; 53752 return true; 53753 } else { 53754 validationCommand = CharstringValidationData[value]; 53755 } 53756 53757 if (validationCommand) { 53758 if (validationCommand.stem) { 53759 state.hints += stackSize >> 1; 53760 53761 if (value === 3 || value === 23) { 53762 state.hasVStems = true; 53763 } else if (state.hasVStems && (value === 1 || value === 18)) { 53764 (0, _util.warn)("CFF stem hints are in wrong order"); 53765 data[j - 1] = value === 1 ? 3 : 23; 53766 } 53767 } 53768 53769 if ("min" in validationCommand) { 53770 if (!state.undefStack && stackSize < validationCommand.min) { 53771 (0, _util.warn)("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min); 53772 return false; 53773 } 53774 } 53775 53776 if (state.firstStackClearing && validationCommand.stackClearing) { 53777 state.firstStackClearing = false; 53778 stackSize -= validationCommand.min; 53779 53780 if (stackSize >= 2 && validationCommand.stem) { 53781 stackSize %= 2; 53782 } else if (stackSize > 1) { 53783 (0, _util.warn)("Found too many parameters for stack-clearing command"); 53784 } 53785 53786 if (stackSize > 0 && stack[stackSize - 1] >= 0) { 53787 state.width = stack[stackSize - 1]; 53788 } 53789 } 53790 53791 if ("stackDelta" in validationCommand) { 53792 if ("stackFn" in validationCommand) { 53793 validationCommand.stackFn(stack, stackSize); 53794 } 53795 53796 stackSize += validationCommand.stackDelta; 53797 } else if (validationCommand.stackClearing) { 53798 stackSize = 0; 53799 } else if (validationCommand.resetStack) { 53800 stackSize = 0; 53801 state.undefStack = false; 53802 } else if (validationCommand.undefStack) { 53803 stackSize = 0; 53804 state.undefStack = true; 53805 state.firstStackClearing = false; 53806 } 53807 } 53808 } 53809 53810 state.stackSize = stackSize; 53811 return true; 53812 }, 53813 53814 parseCharStrings({ 53815 charStrings, 53816 localSubrIndex, 53817 globalSubrIndex, 53818 fdSelect, 53819 fdArray, 53820 privateDict 53821 }) { 53822 var seacs = []; 53823 var widths = []; 53824 var count = charStrings.count; 53825 53826 for (var i = 0; i < count; i++) { 53827 var charstring = charStrings.get(i); 53828 var state = { 53829 callDepth: 0, 53830 stackSize: 0, 53831 stack: [], 53832 undefStack: true, 53833 hints: 0, 53834 firstStackClearing: true, 53835 seac: null, 53836 width: null, 53837 hasVStems: false 53838 }; 53839 var valid = true; 53840 var localSubrToUse = null; 53841 var privateDictToUse = privateDict; 53842 53843 if (fdSelect && fdArray.length) { 53844 var fdIndex = fdSelect.getFDIndex(i); 53845 53846 if (fdIndex === -1) { 53847 (0, _util.warn)("Glyph index is not in fd select."); 53848 valid = false; 53849 } 53850 53851 if (fdIndex >= fdArray.length) { 53852 (0, _util.warn)("Invalid fd index for glyph index."); 53853 valid = false; 53854 } 53855 53856 if (valid) { 53857 privateDictToUse = fdArray[fdIndex].privateDict; 53858 localSubrToUse = privateDictToUse.subrsIndex; 53859 } 53860 } else if (localSubrIndex) { 53861 localSubrToUse = localSubrIndex; 53862 } 53863 53864 if (valid) { 53865 valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex); 53866 } 53867 53868 if (state.width !== null) { 53869 const nominalWidth = privateDictToUse.getByName("nominalWidthX"); 53870 widths[i] = nominalWidth + state.width; 53871 } else { 53872 const defaultWidth = privateDictToUse.getByName("defaultWidthX"); 53873 widths[i] = defaultWidth; 53874 } 53875 53876 if (state.seac !== null) { 53877 seacs[i] = state.seac; 53878 } 53879 53880 if (!valid) { 53881 charStrings.set(i, new Uint8Array([14])); 53882 } 53883 } 53884 53885 return { 53886 charStrings, 53887 seacs, 53888 widths 53889 }; 53890 }, 53891 53892 emptyPrivateDictionary: function CFFParser_emptyPrivateDictionary(parentDict) { 53893 var privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings); 53894 parentDict.setByKey(18, [0, 0]); 53895 parentDict.privateDict = privateDict; 53896 }, 53897 parsePrivateDict: function CFFParser_parsePrivateDict(parentDict) { 53898 if (!parentDict.hasName("Private")) { 53899 this.emptyPrivateDictionary(parentDict); 53900 return; 53901 } 53902 53903 var privateOffset = parentDict.getByName("Private"); 53904 53905 if (!Array.isArray(privateOffset) || privateOffset.length !== 2) { 53906 parentDict.removeByName("Private"); 53907 return; 53908 } 53909 53910 var size = privateOffset[0]; 53911 var offset = privateOffset[1]; 53912 53913 if (size === 0 || offset >= this.bytes.length) { 53914 this.emptyPrivateDictionary(parentDict); 53915 return; 53916 } 53917 53918 var privateDictEnd = offset + size; 53919 var dictData = this.bytes.subarray(offset, privateDictEnd); 53920 var dict = this.parseDict(dictData); 53921 var privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings); 53922 parentDict.privateDict = privateDict; 53923 53924 if (!privateDict.getByName("Subrs")) { 53925 return; 53926 } 53927 53928 var subrsOffset = privateDict.getByName("Subrs"); 53929 var relativeOffset = offset + subrsOffset; 53930 53931 if (subrsOffset === 0 || relativeOffset >= this.bytes.length) { 53932 this.emptyPrivateDictionary(parentDict); 53933 return; 53934 } 53935 53936 var subrsIndex = this.parseIndex(relativeOffset); 53937 privateDict.subrsIndex = subrsIndex.obj; 53938 }, 53939 parseCharsets: function CFFParser_parseCharsets(pos, length, strings, cid) { 53940 if (pos === 0) { 53941 return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset); 53942 } else if (pos === 1) { 53943 return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset); 53944 } else if (pos === 2) { 53945 return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset); 53946 } 53947 53948 var bytes = this.bytes; 53949 var start = pos; 53950 var format = bytes[pos++]; 53951 var charset = [".notdef"]; 53952 var id, count, i; 53953 length -= 1; 53954 53955 switch (format) { 53956 case 0: 53957 for (i = 0; i < length; i++) {
53958 id = bytes[pos++] << 8 | bytes[pos++]; 53959 charset.push(cid ? id : strings.get(id)); 53960 } 53961 53962 break; 53963 53964 case 1: 53965 while (charset.length <= length) { 53966 id = bytes[pos++] << 8 | bytes[pos++]; 53967 count = bytes[pos++]; 53968 53969 for (i = 0; i <= count; i++) { 53970 charset.push(cid ? id++ : strings.get(id++)); 53971 } 53972 } 53973 53974 break; 53975 53976 case 2: 53977 while (charset.length <= length) { 53978 id = bytes[pos++] << 8 | bytes[pos++]; 53979 count = bytes[pos++] << 8 | bytes[pos++]; 53980 53981 for (i = 0; i <= count; i++) { 53982 charset.push(cid ? id++ : strings.get(id++)); 53983 } 53984 } 53985 53986 break; 53987 53988 default: 53989 throw new _util.FormatError("Unknown charset format"); 53990 } 53991 53992 var end = pos; 53993 var raw = bytes.subarray(start, end); 53994 return new CFFCharset(false, format, charset, raw); 53995 }, 53996 parseEncoding: function CFFParser_parseEncoding(pos, properties, strings, charset) { 53997 var encoding = Object.create(null); 53998 var bytes = this.bytes; 53999 var predefined = false; 54000 var format, i, ii; 54001 var raw = null; 54002 54003 function readSupplement() { 54004 var supplementsCount = bytes[pos++]; 54005 54006 for (i = 0; i < supplementsCount; i++) { 54007 var code = bytes[pos++]; 54008 var sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff); 54009 encoding[code] = charset.indexOf(strings.get(sid)); 54010 } 54011 } 54012 54013 if (pos === 0 || pos === 1) { 54014 predefined = true; 54015 format = pos; 54016 var baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding; 54017 54018 for (i = 0, ii = charset.length; i < ii; i++) { 54019 var index = baseEncoding.indexOf(charset[i]); 54020 54021 if (index !== -1) { 54022 encoding[index] = i; 54023 } 54024 } 54025 } else { 54026 var dataStart = pos; 54027 format = bytes[pos++]; 54028 54029 switch (format & 0x7f) { 54030 case 0: 54031 var glyphsCount = bytes[pos++]; 54032 54033 for (i = 1; i <= glyphsCount; i++) { 54034 encoding[bytes[pos++]] = i; 54035 } 54036 54037 break; 54038 54039 case 1: 54040 var rangesCount = bytes[pos++]; 54041 var gid = 1; 54042 54043 for (i = 0; i < rangesCount; i++) { 54044 var start = bytes[pos++]; 54045 var left = bytes[pos++]; 54046 54047 for (var j = start; j <= start + left; j++) { 54048 encoding[j] = gid++; 54049 } 54050 } 54051 54052 break; 54053 54054 default: 54055 throw new _util.FormatError(`Unknown encoding format: ${format} in CFF`); 54056 } 54057 54058 var dataEnd = pos; 54059 54060 if (format & 0x80) { 54061 bytes[dataStart] &= 0x7f; 54062 readSupplement(); 54063 } 54064 54065 raw = bytes.subarray(dataStart, dataEnd); 54066 } 54067 54068 format = format & 0x7f; 54069 return new CFFEncoding(predefined, format, encoding, raw); 54070 }, 54071 parseFDSelect: function CFFParser_parseFDSelect(pos, length) { 54072 var bytes = this.bytes; 54073 var format = bytes[pos++]; 54074 var fdSelect = []; 54075 var i; 54076 54077 switch (format) { 54078 case 0: 54079 for (i = 0; i < length; ++i) { 54080 var id = bytes[pos++]; 54081 fdSelect.push(id); 54082 } 54083 54084 break; 54085 54086 case 3: 54087 var rangesCount = bytes[pos++] << 8 | bytes[pos++]; 54088 54089 for (i = 0; i < rangesCount; ++i) { 54090 var first = bytes[pos++] << 8 | bytes[pos++]; 54091 54092 if (i === 0 && first !== 0) { 54093 (0, _util.warn)("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover."); 54094 first = 0; 54095 } 54096 54097 var fdIndex = bytes[pos++]; 54098 var next = bytes[pos] << 8 | bytes[pos + 1]; 54099 54100 for (var j = first; j < next; ++j) { 54101 fdSelect.push(fdIndex); 54102 } 54103 } 54104 54105 pos += 2; 54106 break; 54107 54108 default: 54109 throw new _util.FormatError(`parseFDSelect: Unknown format "${format}".`); 54110 } 54111 54112 if (fdSelect.length !== length) { 54113 throw new _util.FormatError("parseFDSelect: Invalid font data."); 54114 } 54115 54116 return new CFFFDSelect(format, fdSelect); 54117 } 54118 }; 54119 return CFFParser; 54120}(); 54121 54122exports.CFFParser = CFFParser; 54123 54124var CFF = function CFFClosure() { 54125 function CFF() { 54126 this.header = null; 54127 this.names = []; 54128 this.topDict = null; 54129 this.strings = new CFFStrings(); 54130 this.globalSubrIndex = null; 54131 this.encoding = null; 54132 this.charset = null; 54133 this.charStrings = null; 54134 this.fdArray = []; 54135 this.fdSelect = null; 54136 this.isCIDFont = false;
54137 } 54138 54139 CFF.prototype = { 54140 duplicateFirstGlyph: function CFF_duplicateFirstGlyph() { 54141 if (this.charStrings.count >= 65535) { 54142 (0, _util.warn)("Not enough space in charstrings to duplicate first glyph."); 54143 return; 54144 } 54145 54146 var glyphZero = this.charStrings.get(0); 54147 this.charStrings.add(glyphZero); 54148 54149 if (this.isCIDFont) { 54150 this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]); 54151 } 54152 }, 54153 hasGlyphId: function CFF_hasGlyphID(id) { 54154 if (id < 0 || id >= this.charStrings.count) { 54155 return false; 54156 } 54157 54158 var glyph = this.charStrings.get(id); 54159 return glyph.length > 0; 54160 } 54161 }; 54162 return CFF; 54163}(); 54164 54165exports.CFF = CFF; 54166 54167var CFFHeader = function CFFHeaderClosure() { 54168 function CFFHeader(major, minor, hdrSize, offSize) { 54169 this.major = major; 54170 this.minor = minor; 54171 this.hdrSize = hdrSize; 54172 this.offSize = offSize; 54173 } 54174 54175 return CFFHeader; 54176}(); 54177 54178exports.CFFHeader = CFFHeader; 54179 54180var CFFStrings = function CFFStringsClosure() { 54181 function CFFStrings() { 54182 this.strings = []; 54183 } 54184 54185 CFFStrings.prototype = { 54186 get: function CFFStrings_get(index) { 54187 if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) { 54188 return CFFStandardStrings[index]; 54189 } 54190 54191 if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) { 54192 return this.strings[index - NUM_STANDARD_CFF_STRINGS]; 54193 } 54194 54195 return CFFStandardStrings[0]; 54196 }, 54197 getSID: function CFFStrings_getSID(str) { 54198 let index = CFFStandardStrings.indexOf(str); 54199 54200 if (index !== -1) { 54201 return index; 54202 } 54203 54204 index = this.strings.indexOf(str); 54205 54206 if (index !== -1) { 54207 return index + NUM_STANDARD_CFF_STRINGS; 54208 } 54209 54210 return -1; 54211 }, 54212 add: function CFFStrings_add(value) { 54213 this.strings.push(value); 54214 }, 54215 54216 get count() { 54217 return this.strings.length; 54218 } 54219 54220 }; 54221 return CFFStrings; 54222}(); 54223 54224exports.CFFStrings = CFFStrings; 54225 54226var CFFIndex = function CFFIndexClosure() { 54227 function CFFIndex() { 54228 this.objects = []; 54229 this.length = 0; 54230 } 54231 54232 CFFIndex.prototype = { 54233 add: function CFFIndex_add(data) { 54234 this.length += data.length; 54235 this.objects.push(data); 54236 }, 54237 set: function CFFIndex_set(index, data) { 54238 this.length += data.length - this.objects[index].length; 54239 this.objects[index] = data; 54240 }, 54241 get: function CFFIndex_get(index) { 54242 return this.objects[index]; 54243 }, 54244 54245 get count() { 54246 return this.objects.length; 54247 } 54248 54249 }; 54250 return CFFIndex; 54251}(); 54252 54253exports.CFFIndex = CFFIndex; 54254 54255var CFFDict = function CFFDictClosure() { 54256 function CFFDict(tables, strings) { 54257 this.keyToNameMap = tables.keyToNameMap; 54258 this.nameToKeyMap = tables.nameToKeyMap; 54259 this.defaults = tables.defaults; 54260 this.types = tables.types; 54261 this.opcodes = tables.opcodes; 54262 this.order = tables.order; 54263 this.strings = strings; 54264 this.values = Object.create(null); 54265 } 54266 54267 CFFDict.prototype = { 54268 setByKey: function CFFDict_setByKey(key, value) { 54269 if (!(key in this.keyToNameMap)) { 54270 return false; 54271 } 54272 54273 var valueLength = value.length; 54274 54275 if (valueLength === 0) { 54276 return true; 54277 } 54278 54279 for (var i = 0; i < valueLength; i++) { 54280 if (isNaN(value[i])) { 54281 (0, _util.warn)('Invalid CFFDict value: "' + value + '" for key "' + key + '".'); 54282 return true; 54283 } 54284 } 54285 54286 var type = this.types[key]; 54287 54288 if (type === "num" || type === "sid" || type === "offset") { 54289 value = value[0]; 54290 } 54291 54292 this.values[key] = value; 54293 return true; 54294 }, 54295 setByName: function CFFDict_setByName(name, value) { 54296 if (!(name in this.nameToKeyMap)) { 54297 throw new _util.FormatError(`Invalid dictionary name "${name}"`); 54298 } 54299 54300 this.values[this.nameToKeyMap[name]] = value; 54301 }, 54302 hasName: function CFFDict_hasName(name) { 54303 return this.nameToKeyMap[name] in this.values; 54304 }, 54305 getByName: function CFFDict_getByName(name) { 54306 if (!(name in this.nameToKeyMap)) { 54307 throw new _util.FormatError(`Invalid dictionary name ${name}"`); 54308 } 54309 54310 var key = this.nameToKeyMap[name]; 54311 54312 if (!(key in this.values)) { 54313 return this.defaults[key]; 54314 } 54315 54316 return this.values[key]; 54317 }, 54318 removeByName: function CFFDict_removeByName(name) { 54319 delete this.values[this.nameToKeyMap[name]]; 54320 } 54321 }; 54322 54323 CFFDict.createTables = function CFFDict_createTables(layout) { 54324 var tables = { 54325 keyToNameMap: {}, 54326 nameToKeyMap: {}, 54327 defaults: {}, 54328 types: {}, 54329 opcodes: {}, 54330 order: [] 54331 }; 54332 54333 for (var i = 0, ii = layout.length; i < ii; ++i) { 54334 var entry = layout[i]; 54335 var key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0]; 54336 tables.keyToNameMap[key] = entry[1]; 54337 tables.nameToKeyMap[entry[1]] = key; 54338 tables.types[key] = entry[2]; 54339 tables.defaults[key] = entry[3]; 54340 tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]]; 54341 tables.order.push(key); 54342 } 54343 54344 return tables; 54345 }; 54346 54347 return CFFDict; 54348}(); 54349 54350var CFFTopDict = function CFFTopDictClosure() { 54351 var layout = [[[12, 30], "ROS", ["sid", "sid", "num"], null], [[12, 20], "SyntheticBase", "num", null], [0, "version", "sid", null], [1, "Notice", "sid", null], [[12, 0], "Copyright", "sid", null], [2, "FullName", "sid", null], [3, "FamilyName", "sid", null], [4, "Weight", "sid", null], [[12, 1], "isFixedPitch", "num", 0], [[12, 2], "ItalicAngle", "num", 0], [[12, 3], "UnderlinePosition", "num", -100], [[12, 4], "UnderlineThickness", "num", 50], [[12, 5], "PaintType", "num", 0], [[12, 6], "CharstringType", "num", 2], [[12, 7], "FontMatrix", ["num", "num", "num", "num", "num", "num"], [0.001, 0, 0, 0.001, 0, 0]], [13, "UniqueID", "num", null], [5, "FontBBox", ["num", "num", "num", "num"], [0, 0, 0, 0]], [[12, 8], "StrokeWidth", "num", 0], [14, "XUID", "array", null], [15, "charset", "offset", 0], [16, "Encoding", "offset", 0], [17, "CharStrings", "offset", 0], [18, "Private", ["offset", "offset"], null], [[12, 21], "PostScript", "sid", null], [[12, 22], "BaseFontName", "sid", null], [[12, 23], "BaseFontBlend", "delta", null], [[12, 31], "CIDFontVersion", "num", 0], [[12, 32], "CIDFontRevision", "num", 0], [[12, 33], "CIDFontType", "num", 0], [[12, 34], "CIDCount", "num", 8720], [[12, 35], "UIDBase", "num", null], [[12, 37], "FDSelect", "offset", null], [[12, 36], "FDArray", "offset", null], [[12, 38], "FontName", "sid", null]]; 54352 var tables = null; 54353 54354 function CFFTopDict(strings) { 54355 if (tables === null) { 54356 tables = CFFDict.createTables(layout); 54357 } 54358 54359 CFFDict.call(this, tables, strings); 54360 this.privateDict = null; 54361 } 54362 54363 CFFTopDict.prototype = Object.create(CFFDict.prototype); 54364 return CFFTopDict; 54365}(); 54366 54367exports.CFFTopDict = CFFTopDict; 54368
54369var CFFPrivateDict = function CFFPrivateDictClosure() { 54370 var layout = [[6, "BlueValues", "delta", null], [7, "OtherBlues", "delta", null], [8, "FamilyBlues", "delta", null], [9, "FamilyOtherBlues", "delta", null], [[12, 9], "BlueScale", "num", 0.039625], [[12, 10], "BlueShift", "num", 7], [[12, 11], "BlueFuzz", "num", 1], [10, "StdHW", "num", null], [11, "StdVW", "num", null], [[12, 12], "StemSnapH", "delta", null], [[12, 13], "StemSnapV", "delta", null], [[12, 14], "ForceBold", "num", 0], [[12, 17], "LanguageGroup", "num", 0], [[12, 18], "ExpansionFactor", "num", 0.06], [[12, 19], "initialRandomSeed", "num", 0], [20, "defaultWidthX", "num", 0], [21, "nominalWidthX", "num", 0], [19, "Subrs", "offset", null]]; 54371 var tables = null; 54372 54373 function CFFPrivateDict(strings) { 54374 if (tables === null) { 54375 tables = CFFDict.createTables(layout); 54376 } 54377 54378 CFFDict.call(this, tables, strings); 54379 this.subrsIndex = null; 54380 } 54381 54382 CFFPrivateDict.prototype = Object.create(CFFDict.prototype); 54383 return CFFPrivateDict; 54384}(); 54385 54386exports.CFFPrivateDict = CFFPrivateDict; 54387var CFFCharsetPredefinedTypes = { 54388 ISO_ADOBE: 0, 54389 EXPERT: 1, 54390 EXPERT_SUBSET: 2 54391}; 54392 54393var CFFCharset = function CFFCharsetClosure() { 54394 function CFFCharset(predefined, format, charset, raw) { 54395 this.predefined = predefined; 54396 this.format = format; 54397 this.charset = charset; 54398 this.raw = raw; 54399 } 54400 54401 return CFFCharset; 54402}(); 54403 54404exports.CFFCharset = CFFCharset; 54405 54406var CFFEncoding = function CFFEncodingClosure() { 54407 function CFFEncoding(predefined, format, encoding, raw) { 54408 this.predefined = predefined; 54409 this.format = format; 54410 this.encoding = encoding; 54411 this.raw = raw; 54412 } 54413 54414 return CFFEncoding; 54415}(); 54416 54417var CFFFDSelect = function CFFFDSelectClosure() { 54418 function CFFFDSelect(format, fdSelect) { 54419 this.format = format; 54420 this.fdSelect = fdSelect; 54421 } 54422 54423 CFFFDSelect.prototype = { 54424 getFDIndex: function CFFFDSelect_get(glyphIndex) { 54425 if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) { 54426 return -1; 54427 } 54428 54429 return this.fdSelect[glyphIndex]; 54430 } 54431 }; 54432 return CFFFDSelect; 54433}(); 54434 54435exports.CFFFDSelect = CFFFDSelect; 54436 54437var CFFOffsetTracker = function CFFOffsetTrackerClosure() { 54438 function CFFOffsetTracker() { 54439 this.offsets = Object.create(null); 54440 } 54441 54442 CFFOffsetTracker.prototype = { 54443 isTracking: function CFFOffsetTracker_isTracking(key) { 54444 return key in this.offsets; 54445 }, 54446 track: function CFFOffsetTracker_track(key, location) { 54447 if (key in this.offsets) { 54448 throw new _util.FormatError(`Already tracking location of ${key}`); 54449 } 54450 54451 this.offsets[key] = location; 54452 }, 54453 offset: function CFFOffsetTracker_offset(value) { 54454 for (var key in this.offsets) { 54455 this.offsets[key] += value; 54456 } 54457 }, 54458 setEntryLocation: function CFFOffsetTracker_setEntryLocation(key, values, output) { 54459 if (!(key in this.offsets)) { 54460 throw new _util.FormatError(`Not tracking location of ${key}`); 54461 } 54462 54463 var data = output.data; 54464 var dataOffset = this.offsets[key]; 54465 var size = 5; 54466 54467 for (var i = 0, ii = values.length; i < ii; ++i) { 54468 var offset0 = i * size + dataOffset; 54469 var offset1 = offset0 + 1; 54470 var offset2 = offset0 + 2; 54471 var offset3 = offset0 + 3; 54472 var offset4 = offset0 + 4; 54473 54474 if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) { 54475 throw new _util.FormatError("writing to an offset that is not empty"); 54476 } 54477 54478 var value = values[i]; 54479 data[offset0] = 0x1d; 54480 data[offset1] = value >> 24 & 0xff; 54481 data[offset2] = value >> 16 & 0xff; 54482 data[offset3] = value >> 8 & 0xff; 54483 data[offset4] = value & 0xff; 54484 } 54485 } 54486 }; 54487 return CFFOffsetTracker; 54488}(); 54489 54490var CFFCompiler = function CFFCompilerClosure() { 54491 function CFFCompiler(cff) { 54492 this.cff = cff; 54493 } 54494 54495 CFFCompiler.prototype = { 54496 compile: function CFFCompiler_compile() { 54497 var cff = this.cff; 54498 var output = { 54499 data: [], 54500 length: 0, 54501 add: function CFFCompiler_add(data) { 54502 this.data = this.data.concat(data); 54503 this.length = this.data.length; 54504 } 54505 }; 54506 var header = this.compileHeader(cff.header); 54507 output.add(header);
54508 var nameIndex = this.compileNameIndex(cff.names); 54509 output.add(nameIndex); 54510 54511 if (cff.isCIDFont) { 54512 if (cff.topDict.hasName("FontMatrix")) { 54513 var base = cff.topDict.getByName("FontMatrix"); 54514 cff.topDict.removeByName("FontMatrix"); 54515 54516 for (var i = 0, ii = cff.fdArray.length; i < ii; i++) { 54517 var subDict = cff.fdArray[i]; 54518 var matrix = base.slice(0); 54519 54520 if (subDict.hasName("FontMatrix")) { 54521 matrix = _util.Util.transform(matrix, subDict.getByName("FontMatrix")); 54522 } 54523 54524 subDict.setByName("FontMatrix", matrix); 54525 } 54526 } 54527 } 54528 54529 cff.topDict.setByName("charset", 0); 54530 var compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont); 54531 output.add(compiled.output); 54532 var topDictTracker = compiled.trackers[0]; 54533 var stringIndex = this.compileStringIndex(cff.strings.strings); 54534 output.add(stringIndex); 54535 var globalSubrIndex = this.compileIndex(cff.globalSubrIndex); 54536 output.add(globalSubrIndex); 54537 54538 if (cff.encoding && cff.topDict.hasName("Encoding")) { 54539 if (cff.encoding.predefined) { 54540 topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output); 54541 } else { 54542 var encoding = this.compileEncoding(cff.encoding); 54543 topDictTracker.setEntryLocation("Encoding", [output.length], output); 54544 output.add(encoding); 54545 } 54546 } 54547 54548 var charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont); 54549 topDictTracker.setEntryLocation("charset", [output.length], output); 54550 output.add(charset); 54551 var charStrings = this.compileCharStrings(cff.charStrings); 54552 topDictTracker.setEntryLocation("CharStrings", [output.length], output); 54553 output.add(charStrings); 54554 54555 if (cff.isCIDFont) { 54556 topDictTracker.setEntryLocation("FDSelect", [output.length], output); 54557 var fdSelect = this.compileFDSelect(cff.fdSelect); 54558 output.add(fdSelect); 54559 compiled = this.compileTopDicts(cff.fdArray, output.length, true); 54560 topDictTracker.setEntryLocation("FDArray", [output.length], output); 54561 output.add(compiled.output); 54562 var fontDictTrackers = compiled.trackers; 54563 this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output); 54564 } 54565 54566 this.compilePrivateDicts([cff.topDict], [topDictTracker], output); 54567 output.add([0]); 54568 return output.data; 54569 }, 54570 encodeNumber: function CFFCompiler_encodeNumber(value) { 54571 if (parseFloat(value) === parseInt(value, 10) && !isNaN(value)) { 54572 return this.encodeInteger(value); 54573 } 54574 54575 return this.encodeFloat(value); 54576 }, 54577 encodeFloat: function CFFCompiler_encodeFloat(num) { 54578 var value = num.toString(); 54579 var m = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(value); 54580 54581 if (m) { 54582 var epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length)); 54583 value = (Math.round(num * epsilon) / epsilon).toString(); 54584 } 54585 54586 var nibbles = ""; 54587 var i, ii; 54588 54589 for (i = 0, ii = value.length; i < ii; ++i) { 54590 var a = value[i]; 54591 54592 if (a === "e") { 54593 nibbles += value[++i] === "-" ? "c" : "b"; 54594 } else if (a === ".") { 54595 nibbles += "a"; 54596 } else if (a === "-") { 54597 nibbles += "e"; 54598 } else { 54599 nibbles += a; 54600 } 54601 } 54602 54603 nibbles += nibbles.length & 1 ? "f" : "ff"; 54604 var out = [30]; 54605 54606 for (i = 0, ii = nibbles.length; i < ii; i += 2) { 54607 out.push(parseInt(nibbles.substring(i, i + 2), 16)); 54608 } 54609 54610 return out; 54611 }, 54612 encodeInteger: function CFFCompiler_encodeInteger(value) { 54613 var code; 54614 54615 if (value >= -107 && value <= 107) { 54616 code = [value + 139]; 54617 } else if (value >= 108 && value <= 1131) { 54618 value = value - 108; 54619 code = [(value >> 8) + 247, value & 0xff]; 54620 } else if (value >= -1131 && value <= -108) { 54621 value = -value - 108; 54622 code = [(value >> 8) + 251, value & 0xff]; 54623 } else if (value >= -32768 && value <= 32767) { 54624 code = [0x1c, value >> 8 & 0xff, value & 0xff]; 54625 } else { 54626 code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff]; 54627 } 54628 54629 return code; 54630 }, 54631 compileHeader: function CFFCompiler_compileHeader(header) { 54632 return [header.major, header.minor, header.hdrSize, header.offSize]; 54633 }, 54634 compileNameIndex: function CFFCompiler_compileNameIndex(names) { 54635 var nameIndex = new CFFIndex(); 54636 54637 for (var i = 0, ii = names.length; i < ii; ++i) { 54638 var name = names[i]; 54639 var length = Math.min(name.length, 127); 54640 var sanitizedName = new Array(length); 54641 54642 for (var j = 0; j < length; j++) { 54643 var char = name[j]; 54644 54645 if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") { 54646 char = "_"; 54647 } 54648 54649 sanitizedName[j] = char; 54650 } 54651 54652 sanitizedName = sanitizedName.join(""); 54653 54654 if (sanitizedName === "") { 54655 sanitizedName = "Bad_Font_Name"; 54656 } 54657 54658 nameIndex.add((0, _util.stringToBytes)(sanitizedName)); 54659 } 54660 54661 return this.compileIndex(nameIndex); 54662 }, 54663 compileTopDicts: function CFFCompiler_compileTopDicts(dicts, length, removeCidKeys) { 54664 var fontDictTrackers = []; 54665 var fdArrayIndex = new CFFIndex(); 54666 54667 for (var i = 0, ii = dicts.length; i < ii; ++i) { 54668 var fontDict = dicts[i]; 54669 54670 if (removeCidKeys) { 54671 fontDict.removeByName("CIDFontVersion"); 54672 fontDict.removeByName("CIDFontRevision"); 54673 fontDict.removeByName("CIDFontType"); 54674 fontDict.removeByName("CIDCount"); 54675 fontDict.removeByName("UIDBase"); 54676 } 54677 54678 var fontDictTracker = new CFFOffsetTracker(); 54679 var fontDictData = this.compileDict(fontDict, fontDictTracker); 54680 fontDictTrackers.push(fontDictTracker); 54681 fdArrayIndex.add(fontDictData); 54682 fontDictTracker.offset(length); 54683 } 54684 54685 fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers); 54686 return { 54687 trackers: fontDictTrackers, 54688 output: fdArrayIndex 54689 }; 54690 }, 54691 compilePrivateDicts: function CFFCompiler_compilePrivateDicts(dicts, trackers, output) { 54692 for (var i = 0, ii = dicts.length; i < ii; ++i) { 54693 var fontDict = dicts[i]; 54694 var privateDict = fontDict.privateDict; 54695 54696 if (!privateDict || !fontDict.hasName("Private")) { 54697 throw new _util.FormatError("There must be a private dictionary."); 54698 } 54699 54700 var privateDictTracker = new CFFOffsetTracker(); 54701 var privateDictData = this.compileDict(privateDict, privateDictTracker); 54702 var outputLength = output.length; 54703 privateDictTracker.offset(outputLength); 54704 54705 if (!privateDictData.length) { 54706 outputLength = 0; 54707 } 54708 54709 trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output); 54710 output.add(privateDictData); 54711 54712 if (privateDict.subrsIndex && privateDict.hasName("Subrs")) { 54713 var subrs = this.compileIndex(privateDict.subrsIndex); 54714 privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output); 54715 output.add(subrs); 54716 } 54717 } 54718 }, 54719 compileDict: function CFFCompiler_compileDict(dict, offsetTracker) { 54720 var out = []; 54721 var order = dict.order; 54722 54723 for (var i = 0; i < order.length; ++i) { 54724 var key = order[i]; 54725 54726 if (!(key in dict.values)) { 54727 continue; 54728 } 54729 54730 var values = dict.values[key]; 54731 var types = dict.types[key]; 54732 54733 if (!Array.isArray(types)) { 54734 types = [types]; 54735 } 54736 54737 if (!Array.isArray(values)) { 54738 values = [values]; 54739 } 54740 54741 if (values.length === 0) { 54742 continue; 54743 } 54744 54745 for (var j = 0, jj = types.length; j < jj; ++j) { 54746 var type = types[j]; 54747 var value = values[j]; 54748 54749 switch (type) { 54750 case "num": 54751 case "sid": 54752 out = out.concat(this.encodeNumber(value)); 54753 break; 54754 54755 case "offset": 54756 var name = dict.keyToNameMap[key]; 54757 54758 if (!offsetTracker.isTracking(name)) { 54759 offsetTracker.track(name, out.length); 54760 } 54761 54762 out = out.concat([0x1d, 0, 0, 0, 0]); 54763 break; 54764 54765 case "array": 54766 case "delta": 54767 out = out.concat(this.encodeNumber(value)); 54768 54769 for (var k = 1, kk = values.length; k < kk; ++k) { 54770 out = out.concat(this.encodeNumber(values[k])); 54771 } 54772 54773 break; 54774 54775 default: 54776 throw new _util.FormatError(`Unknown data type of ${type}`); 54777 } 54778 } 54779 54780 out = out.concat(dict.opcodes[key]); 54781 } 54782 54783 return out; 54784 }, 54785 compileStringIndex: function CFFCompiler_compileStringIndex(strings) { 54786 var stringIndex = new CFFIndex(); 54787 54788 for (var i = 0, ii = strings.length; i < ii; ++i) {
54789 stringIndex.add((0, _util.stringToBytes)(strings[i])); 54790 } 54791 54792 return this.compileIndex(stringIndex); 54793 }, 54794 compileGlobalSubrIndex: function CFFCompiler_compileGlobalSubrIndex() { 54795 var globalSubrIndex = this.cff.globalSubrIndex; 54796 this.out.writeByteArray(this.compileIndex(globalSubrIndex)); 54797 }, 54798 compileCharStrings: function CFFCompiler_compileCharStrings(charStrings) { 54799 var charStringsIndex = new CFFIndex(); 54800 54801 for (var i = 0; i < charStrings.count; i++) { 54802 var glyph = charStrings.get(i); 54803 54804 if (glyph.length === 0) { 54805 charStringsIndex.add(new Uint8Array([0x8b, 0x0e])); 54806 continue; 54807 } 54808 54809 charStringsIndex.add(glyph); 54810 } 54811 54812 return this.compileIndex(charStringsIndex); 54813 }, 54814 compileCharset: function CFFCompiler_compileCharset(charset, numGlyphs, strings, isCIDFont) { 54815 let out; 54816 const numGlyphsLessNotDef = numGlyphs - 1; 54817 54818 if (isCIDFont) { 54819 out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]); 54820 } else { 54821 const length = 1 + numGlyphsLessNotDef * 2; 54822 out = new Uint8Array(length); 54823 out[0] = 0; 54824 let charsetIndex = 0; 54825 const numCharsets = charset.charset.length; 54826 let warned = false; 54827 54828 for (let i = 1; i < out.length; i += 2) { 54829 let sid = 0; 54830 54831 if (charsetIndex < numCharsets) { 54832 const name = charset.charset[charsetIndex++]; 54833 sid = strings.getSID(name); 54834 54835 if (sid === -1) { 54836 sid = 0; 54837 54838 if (!warned) { 54839 warned = true; 54840 (0, _util.warn)(`Couldn't find ${name} in CFF strings`); 54841 } 54842 } 54843 } 54844 54845 out[i] = sid >> 8 & 0xff; 54846 out[i + 1] = sid & 0xff; 54847 } 54848 } 54849 54850 return this.compileTypedArray(out); 54851 }, 54852 compileEncoding: function CFFCompiler_compileEncoding(encoding) { 54853 return this.compileTypedArray(encoding.raw); 54854 }, 54855 compileFDSelect: function CFFCompiler_compileFDSelect(fdSelect) { 54856 const format = fdSelect.format; 54857 let out, i; 54858 54859 switch (format) { 54860 case 0: 54861 out = new Uint8Array(1 + fdSelect.fdSelect.length); 54862 out[0] = format; 54863 54864 for (i = 0; i < fdSelect.fdSelect.length; i++) { 54865 out[i + 1] = fdSelect.fdSelect[i]; 54866 } 54867 54868 break; 54869 54870 case 3: 54871 const start = 0; 54872 let lastFD = fdSelect.fdSelect[0]; 54873 const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD]; 54874 54875 for (i = 1; i < fdSelect.fdSelect.length; i++) { 54876 const currentFD = fdSelect.fdSelect[i]; 54877 54878 if (currentFD !== lastFD) { 54879 ranges.push(i >> 8 & 0xff, i & 0xff, currentFD); 54880 lastFD = currentFD; 54881 } 54882 } 54883 54884 const numRanges = (ranges.length - 3) / 3; 54885 ranges[1] = numRanges >> 8 & 0xff; 54886 ranges[2] = numRanges & 0xff; 54887 ranges.push(i >> 8 & 0xff, i & 0xff); 54888 out = new Uint8Array(ranges); 54889 break; 54890 } 54891 54892 return this.compileTypedArray(out); 54893 }, 54894 compileTypedArray: function CFFCompiler_compileTypedArray(data) { 54895 var out = []; 54896 54897 for (var i = 0, ii = data.length; i < ii; ++i) { 54898 out[i] = data[i]; 54899 } 54900 54901 return out; 54902 }, 54903 compileIndex: function CFFCompiler_compileIndex(index, trackers) { 54904 trackers = trackers || []; 54905 var objects = index.objects; 54906 var count = objects.length; 54907 54908 if (count === 0) { 54909 return [0, 0, 0]; 54910 } 54911 54912 var data = [count >> 8 & 0xff, count & 0xff]; 54913 var lastOffset = 1, 54914 i; 54915 54916 for (i = 0; i < count; ++i) { 54917 lastOffset += objects[i].length; 54918 } 54919 54920 var offsetSize; 54921 54922 if (lastOffset < 0x100) { 54923 offsetSize = 1; 54924 } else if (lastOffset < 0x10000) { 54925 offsetSize = 2; 54926 } else if (lastOffset < 0x1000000) { 54927 offsetSize = 3; 54928 } else { 54929 offsetSize = 4; 54930 } 54931 54932 data.push(offsetSize); 54933 var relativeOffset = 1; 54934 54935 for (i = 0; i < count + 1; i++) { 54936 if (offsetSize === 1) { 54937 data.push(relativeOffset & 0xff); 54938 } else if (offsetSize === 2) { 54939 data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff); 54940 } else if (offsetSize === 3) { 54941 data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff); 54942 } else { 54943 data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff); 54944 } 54945 54946 if (objects[i]) { 54947 relativeOffset += objects[i].length; 54948 } 54949 } 54950 54951 for (i = 0; i < count; i++) { 54952 if (trackers[i]) { 54953 trackers[i].offset(data.length); 54954 } 54955 54956 for (var j = 0, jj = objects[i].length; j < jj; j++) { 54957 data.push(objects[i][j]); 54958 } 54959 } 54960 54961 return data; 54962 } 54963 }; 54964 return CFFCompiler; 54965}(); 54966 54967exports.CFFCompiler = CFFCompiler; 54968 54969/***/ }), 54970/* 29 */ 54971/***/ (function(module, exports, __w_pdfjs_require__) { 54972 54973"use strict"; 54974 54975 54976Object.defineProperty(exports, "__esModule", { 54977 value: true 54978}); 54979exports.ExpertSubsetCharset = exports.ExpertCharset = exports.ISOAdobeCharset = void 0; 54980const 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", "periodce
54980ntered", "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"]; 54981exports.ISOAdobeCharset = ISOAdobeCharset; 54982const 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"]; 54983exports.ExpertCharset = ExpertCharset; 54984const 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"]; 54985exports.ExpertSubsetCharset = ExpertSubsetCharset; 54986 54987/***/ }), 54988/* 30 */ 54989/***/ (function(module, exports, __w_pdfjs_require__) { 54990 54991"use strict"; 54992 54993 54994Object.defineProperty(exports, "__esModule", { 54995 value: true 54996}); 54997exports.getEncoding = getEncoding; 54998exports.ExpertEncoding = exports.ZapfDingbatsEncoding = exports.SymbolSetEncoding = exports.MacRomanEncoding = exports.StandardEncoding = exports.WinAnsiEncoding = void 0
vendor: 16,661 bytes, lines 54998-55011
54998; 54999const 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"]; 55000exports.ExpertEncoding = ExpertEncoding; 55001const 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", "", "", "", ""]; 55002const 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"]; 55003exports.MacRomanEncoding = MacRomanEncoding; 55004const 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", "", "", "", ""]; 55005exports.StandardEncoding = StandardEncoding; 55006const 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"]; 55007exports.WinAnsiEncoding = WinAnsiEncoding; 55008const 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", ""]; 55009exports.SymbolSetEncoding = SymbolSetEncoding; 55010const 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", ""]; 55011exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
55012 55013function getEncoding(encodingName) { 55014 switch (encodingName) { 55015 case "WinAnsiEncoding": 55016 return WinAnsiEncoding; 55017 55018 case "StandardEncoding": 55019 return StandardEncoding; 55020 55021 case "MacRomanEncoding": 55022 return MacRomanEncoding; 55023 55024 case "SymbolSetEncoding": 55025 return SymbolSetEncoding; 55026 55027 case "ZapfDingbatsEncoding": 55028 return ZapfDingbatsEncoding; 55029 55030 case "ExpertEncoding": 55031 return ExpertEncoding; 55032 55033 case "MacExpertEncoding": 55034 return MacExpertEncoding; 55035 55036 default: 55037 return null; 55038 } 55039} 55040 55041/***/ }), 55042/* 31 */ 55043/***/ (function(module, exports, __w_pdfjs_require__) { 55044 55045var getLookupTableFactory = __w_pdfjs_require__(7).getLookupTableFactory; 55046var getGlyphsUnicode = getLookupTableFactory(function (t) { 55047 t["A"] = 0x0041; 55048 t["AE"] = 0x00c6; 55049 t["AEacute"] = 0x01fc; 55050 t["AEmacron"] = 0x01e2; 55051 t["AEsmall"] = 0xf7e6; 55052 t["Aacute"] = 0x00c1; 55053 t["Aacutesmall"] = 0xf7e1; 55054 t["Abreve"] = 0x0102; 55055 t["Abreveacute"] = 0x1eae; 55056 t["Abrevecyrillic"] = 0x04d0; 55057 t["Abrevedotbelow"] = 0x1eb6; 55058 t["Abrevegrave"] = 0x1eb0; 55059 t["Abrevehookabove"] = 0x1eb2; 55060 t["Abrevetilde"] = 0x1eb4; 55061 t["Acaron"] = 0x01cd; 55062 t["Acircle"] = 0x24b6; 55063 t["Acircumflex"] = 0x00c2; 55064 t["Acircumflexacute"] = 0x1ea4; 55065 t["Acircumflexdotbelow"] = 0x1eac; 55066 t["Acircumflexgrave"] = 0x1ea6; 55067 t["Acircumflexhookabove"] = 0x1ea8; 55068 t["Acircumflexsmall"] = 0xf7e2; 55069 t["Acircumflextilde"] = 0x1eaa; 55070 t["Acute"] = 0xf6c9; 55071 t["Acutesmall"] = 0xf7b4; 55072 t["Acyrillic"] = 0x0410; 55073 t["Adblgrave"] = 0x0200; 55074 t["Adieresis"] = 0x00c4; 55075 t["Adieresiscyrillic"] = 0x04d2; 55076 t["Adieresismacron"] = 0x01de; 55077 t["Adieresissmall"] = 0xf7e4; 55078 t["Adotbelow"] = 0x1ea0; 55079 t["Adotmacron"] = 0x01e0; 55080 t["Agrave"] = 0x00c0; 55081 t["Agravesmall"] = 0xf7e0; 55082 t["Ahookabove"] = 0x1ea2; 55083 t["Aiecyrillic"] = 0x04d4; 55084 t["Ainvertedbreve"] = 0x0202; 55085 t["Alpha"] = 0x0391; 55086 t["Alphatonos"] = 0x0386; 55087 t["Amacron"] = 0x0100; 55088 t["Amonospace"] = 0xff21; 55089 t["Aogonek"] = 0x0104; 55090 t["Aring"] = 0x00c5; 55091 t["Aringacute"] = 0x01fa; 55092 t["Aringbelow"] = 0x1e00; 55093 t["Aringsmall"] = 0xf7e5; 55094 t["Asmall"] = 0xf761; 55095 t["Atilde"] = 0x00c3; 55096 t["Atildesmall"] = 0xf7e3; 55097 t["Aybarmenian"] = 0x0531; 55098 t["B"] = 0x0042; 55099 t["Bcircle"] = 0x24b7; 55100 t["Bdotaccent"] = 0x1e02; 55101 t["Bdotbelow"] = 0x1e04; 55102 t["Becyrillic"] = 0x0411; 55103 t["Benarmenian"] = 0x0532; 55104 t["Beta"] = 0x0392; 55105 t["Bhook"] = 0x0181; 55106 t["Blinebelow"] = 0x1e06; 55107 t["Bmonospace"] = 0xff22; 55108 t["Brevesmall"] = 0xf6f4; 55109 t["Bsmall"] = 0xf762; 55110 t["Btopbar"] = 0x0182; 55111 t["C"] = 0x0043; 55112 t["Caarmenian"] = 0x053e; 55113 t["Cacute"] = 0x0106; 55114 t["Caron"] = 0xf6ca; 55115 t["Caronsmall"] = 0xf6f5; 55116 t["Ccaron"] = 0x010c; 55117 t["Ccedilla"] = 0x00c7; 55118 t["Ccedillaacute"] = 0x1e08; 55119 t["Ccedillasmall"] = 0xf7e7; 55120 t["Ccircle"] = 0x24b8; 55121 t["Ccircumflex"] = 0x0108; 55122 t["Cdot"] = 0x010a; 55123 t["Cdotaccent"] = 0x010a; 55124 t["Cedillasmall"] = 0xf7b8; 55125 t["Chaarmenian"] = 0x0549; 55126 t["Cheabkhasiancyrillic"] = 0x04bc; 55127 t["Checyrillic"] = 0x0427; 55128 t["Chedescenderabkhasiancyrillic"] = 0x04be; 55129 t["Chedescendercyrillic"] = 0x04b6; 55130 t["Chedieresiscyrillic"] = 0x04f4; 55131 t["Cheharmenian"] = 0x0543; 55132 t["Chekhakassiancyrillic"] = 0x04cb; 55133 t["Cheverticalstrokecyrillic"] = 0x04b8; 55134 t["Chi"] = 0x03a7; 55135 t["Chook"] = 0x0187; 55136 t["Circumflexsmall"] = 0xf6f6; 55137 t["Cmonospace"] = 0xff23; 55138 t["Coarmenian"] = 0x0551; 55139 t["Csmall"] = 0xf763; 55140 t["D"] = 0x0044; 55141 t["DZ"] = 0x01f1; 55142 t["DZcaron"] = 0x01c4; 55143 t["Daarmenian"] = 0x0534; 55144 t["Dafrican"] = 0x0189; 55145 t["Dcaron"] = 0x010e; 55146 t["Dcedilla"] = 0x1e10; 55147 t["Dcircle"] = 0x24b9; 55148 t["Dcircumflexbelow"] = 0x1e12; 55149 t["Dcroat"] = 0x0110; 55150 t["Ddotaccent"] = 0x1e0a; 55151 t["Ddotbelow"] = 0x1e0c; 55152 t["Decyrillic"] = 0x0414; 55153 t["Deicoptic"] = 0x03ee; 55154 t["Delta"] = 0x2206; 55155 t["Deltagreek"] = 0x0394; 55156 t["Dhook"] = 0x018a; 55157 t["Dieresis"] = 0xf6cb; 55158 t["DieresisAcute"] = 0xf6cc; 55159 t["DieresisGrave"] = 0xf6cd; 55160 t["Dieresissmall"] = 0xf7a8; 55161 t["Digammagreek"] = 0x03dc; 55162 t["Djecyrillic"] = 0x0402; 55163 t["Dlinebelow"] = 0x1e0e; 55164 t["Dmonospace"] = 0xff24; 55165 t["Dotaccentsmall"] = 0xf6f7; 55166 t["Dslash"] = 0x0110; 55167 t["Dsmall"] = 0xf764; 55168 t["Dtopbar"] = 0x018b; 55169 t["Dz"] = 0x01f2; 55170 t["Dzcaron"] = 0x01c5; 55171 t["Dzeabkhasiancyrillic"] = 0x04e0; 55172 t["Dzecyrillic"] = 0x0405; 55173 t["Dzhecyrillic"] = 0x040f; 55174 t["E"] = 0x0045; 55175 t["Eacute"] = 0x00c9; 55176 t["Eacutesmall"] = 0xf7e9; 55177 t["Ebreve"] = 0x0114; 55178 t["Ecaron"] = 0x011a; 55179 t["Ecedillabreve"] = 0x1e1c; 55180 t["Echarmenian"] = 0x0535; 55181 t["Ecircle"] = 0x24ba; 55182 t["Ecircumflex"] = 0x00ca; 55183 t["Ecircumflexacute"] = 0x1ebe;
55184 t["Ecircumflexbelow"] = 0x1e18; 55185 t["Ecircumflexdotbelow"] = 0x1ec6; 55186 t["Ecircumflexgrave"] = 0x1ec0; 55187 t["Ecircumflexhookabove"] = 0x1ec2; 55188 t["Ecircumflexsmall"] = 0xf7ea; 55189 t["Ecircumflextilde"] = 0x1ec4; 55190 t["Ecyrillic"] = 0x0404; 55191 t["Edblgrave"] = 0x0204; 55192 t["Edieresis"] = 0x00cb; 55193 t["Edieresissmall"] = 0xf7eb; 55194 t["Edot"] = 0x0116; 55195 t["Edotaccent"] = 0x0116; 55196 t["Edotbelow"] = 0x1eb8; 55197 t["Efcyrillic"] = 0x0424; 55198 t["Egrave"] = 0x00c8; 55199 t["Egravesmall"] = 0xf7e8; 55200 t["Eharmenian"] = 0x0537; 55201 t["Ehookabove"] = 0x1eba; 55202 t["Eightroman"] = 0x2167; 55203 t["Einvertedbreve"] = 0x0206; 55204 t["Eiotifiedcyrillic"] = 0x0464; 55205 t["Elcyrillic"] = 0x041b; 55206 t["Elevenroman"] = 0x216a; 55207 t["Emacron"] = 0x0112; 55208 t["Emacronacute"] = 0x1e16; 55209 t["Emacrongrave"] = 0x1e14; 55210 t["Emcyrillic"] = 0x041c; 55211 t["Emonospace"] = 0xff25; 55212 t["Encyrillic"] = 0x041d; 55213 t["Endescendercyrillic"] = 0x04a2; 55214 t["Eng"] = 0x014a; 55215 t["Enghecyrillic"] = 0x04a4; 55216 t["Enhookcyrillic"] = 0x04c7; 55217 t["Eogonek"] = 0x0118; 55218 t["Eopen"] = 0x0190; 55219 t["Epsilon"] = 0x0395; 55220 t["Epsilontonos"] = 0x0388; 55221 t["Ercyrillic"] = 0x0420; 55222 t["Ereversed"] = 0x018e; 55223 t["Ereversedcyrillic"] = 0x042d; 55224 t["Escyrillic"] = 0x0421; 55225 t["Esdescendercyrillic"] = 0x04aa; 55226 t["Esh"] = 0x01a9; 55227 t["Esmall"] = 0xf765; 55228 t["Eta"] = 0x0397; 55229 t["Etarmenian"] = 0x0538; 55230 t["Etatonos"] = 0x0389; 55231 t["Eth"] = 0x00d0; 55232 t["Ethsmall"] = 0xf7f0; 55233 t["Etilde"] = 0x1ebc; 55234 t["Etildebelow"] = 0x1e1a;
55235 t["Euro"] = 0x20ac; 55236 t["Ezh"] = 0x01b7; 55237 t["Ezhcaron"] = 0x01ee; 55238 t["Ezhreversed"] = 0x01b8; 55239 t["F"] = 0x0046; 55240 t["Fcircle"] = 0x24bb; 55241 t["Fdotaccent"] = 0x1e1e; 55242 t["Feharmenian"] = 0x0556; 55243 t["Feicoptic"] = 0x03e4; 55244 t["Fhook"] = 0x0191; 55245 t["Fitacyrillic"] = 0x0472; 55246 t["Fiveroman"] = 0x2164; 55247 t["Fmonospace"] = 0xff26; 55248 t["Fourroman"] = 0x2163; 55249 t["Fsmall"] = 0xf766; 55250 t["G"] = 0x0047; 55251 t["GBsquare"] = 0x3387; 55252 t["Gacute"] = 0x01f4; 55253 t["Gamma"] = 0x0393; 55254 t["Gammaafrican"] = 0x0194; 55255 t["Gangiacoptic"] = 0x03ea; 55256 t["Gbreve"] = 0x011e; 55257 t["Gcaron"] = 0x01e6; 55258 t["Gcedilla"] = 0x0122; 55259 t["Gcircle"] = 0x24bc; 55260 t["Gcircumflex"] = 0x011c; 55261 t["Gcommaaccent"] = 0x0122; 55262 t["Gdot"] = 0x0120; 55263 t["Gdotaccent"] = 0x0120; 55264 t["Gecyrillic"] = 0x0413; 55265 t["Ghadarmenian"] = 0x0542; 55266 t["Ghemiddlehookcyrillic"] = 0x0494; 55267 t["Ghestrokecyrillic"] = 0x0492; 55268 t["Gheupturncyrillic"] = 0x0490; 55269 t["Ghook"] = 0x0193; 55270 t["Gimarmenian"] = 0x0533; 55271 t["Gjecyrillic"] = 0x0403; 55272 t["Gmacron"] = 0x1e20; 55273 t["Gmonospace"] = 0xff27; 55274 t["Grave"] = 0xf6ce; 55275 t["Gravesmall"] = 0xf760; 55276 t["Gsmall"] = 0xf767; 55277 t["Gsmallhook"] = 0x029b; 55278 t["Gstroke"] = 0x01e4; 55279 t["H"] = 0x0048; 55280 t["H18533"] = 0x25cf; 55281 t["H18543"] = 0x25aa; 55282 t["H18551"] = 0x25ab; 55283 t["H22073"] = 0x25a1; 55284 t["HPsquare"] = 0x33cb; 55285 t["Haabkhasiancyrillic"] = 0x04a8; 55286 t["Hadescendercyrillic"] = 0x04b2; 55287 t["Hardsigncyrillic"] = 0x042a; 55288 t["Hbar"] = 0x0126; 55289 t["Hbrevebelow"] = 0x1e2a; 55290 t["Hcedilla"] = 0x1e28; 55291 t["Hcircle"] = 0x24bd; 55292 t["Hcircumflex"] = 0x0124; 55293 t["Hdieresis"] = 0x1e26; 55294 t["Hdotaccent"] = 0x1e22; 55295 t["Hdotbelow"] = 0x1e24; 55296 t["Hmonospace"] = 0xff28; 55297 t["Hoarmenian"] = 0x0540; 55298 t["Horicoptic"] = 0x03e8; 55299 t["Hsmall"] = 0xf768; 55300 t["Hungarumlaut"] = 0xf6cf; 55301 t["Hungarumlautsmall"] = 0xf6f8; 55302 t["Hzsquare"] = 0x3390; 55303 t["I"] = 0x0049; 55304 t["IAcyrillic"] = 0x042f; 55305 t["IJ"] = 0x0132; 55306 t["IUcyrillic"] = 0x042e; 55307 t["Iacute"] = 0x00cd; 55308 t["Iacutesmall"] = 0xf7ed; 55309 t["Ibreve"] = 0x012c; 55310 t["Icaron"] = 0x01cf; 55311 t["Icircle"] = 0x24be; 55312 t["Icircumflex"] = 0x00ce; 55313 t["Icircumflexsmall"] = 0xf7ee; 55314 t["Icyrillic"] = 0x0406; 55315 t["Idblgrave"] = 0x0208; 55316 t["Idieresis"] = 0x00cf; 55317 t["Idieresisacute"] = 0x1e2e; 55318 t["Idieresiscyrillic"] = 0x04e4; 55319 t["Idieresissmall"] = 0xf7ef; 55320 t["Idot"] = 0x0130; 55321 t["Idotaccent"] = 0x0130; 55322 t["Idotbelow"] = 0x1eca; 55323 t["Iebrevecyrillic"] = 0x04d6; 55324 t["Iecyrillic"] = 0x0415; 55325 t["Ifraktur"] = 0x2111; 55326 t["Igrave"] = 0x00cc; 55327 t["Igravesmall"] = 0xf7ec; 55328 t["Ihookabove"] = 0x1ec8; 55329 t["Iicyrillic"] = 0x0418; 55330 t["Iinvertedbreve"] = 0x020a; 55331 t["Iishortcyrillic"] = 0x0419; 55332 t["Imacron"] = 0x012a; 55333 t["Imacroncyrillic"] = 0x04e2; 55334 t["Imonospace"] = 0xff29; 55335 t["Iniarmenian"] = 0x053b; 55336 t["Iocyrillic"] = 0x0401; 55337 t["Iogonek"] = 0x012e; 55338 t["Iota"] = 0x0399; 55339 t["Iotaafrican"] = 0x0196; 55340 t["Iotadieresis"] = 0x03aa; 55341 t["Iotatonos"] = 0x038a; 55342 t["Ismall"] = 0xf769; 55343 t["Istroke"] = 0x0197; 55344 t["Itilde"] = 0x0128; 55345 t["Itildebelow"] = 0x1e2c; 55346 t["Izhitsacyrillic"] = 0x0474; 55347 t["Izhitsadblgravecyrillic"] = 0x0476; 55348 t["J"] = 0x004a; 55349 t["Jaarmenian"] = 0x0541; 55350 t["Jcircle"] = 0x24bf; 55351 t["Jcircumflex"] = 0x0134; 55352 t["Jecyrillic"] = 0x0408; 55353 t["Jheharmenian"] = 0x054b; 55354 t["Jmonospace"] = 0xff2a; 55355 t["Jsmall"] = 0xf76a; 55356 t["K"] = 0x004b; 55357 t["KBsquare"] = 0x3385; 55358 t["KKsquare"] = 0x33cd; 55359 t["Kabashkircyrillic"] = 0x04a0; 55360 t["Kacute"] = 0x1e30; 55361 t["Kacyrillic"] = 0x041a; 55362 t["Kadescendercyrillic"] = 0x049a; 55363 t["Kahookcyrillic"] = 0x04c3; 55364 t["Kappa"] = 0x039a; 55365 t["Kastrokecyrillic"] = 0x049e; 55366 t["Kaverticalstrokecyrillic"] = 0x049c; 55367 t["Kcaron"] = 0x01e8; 55368 t["Kcedilla"] = 0x0136; 55369 t["Kcircle"] = 0x24c0; 55370 t["Kcommaaccent"] = 0x0136; 55371 t["Kdotbelow"] = 0x1e32; 55372 t["Keharmenian"] = 0x0554; 55373 t["Kenarmenian"] = 0x053f; 55374 t["Khacyrillic"] = 0x0425; 55375 t["Kheicoptic"] = 0x03e6; 55376 t["Khook"] = 0x0198; 55377 t["Kjecyrillic"] = 0x040c; 55378 t["Klinebelow"] = 0x1e34; 55379 t["Kmonospace"] = 0xff2b; 55380 t["Koppacyrillic"] = 0x0480; 55381 t["Koppagreek"] = 0x03de; 55382 t["Ksicyrillic"] = 0x046e; 55383 t["Ksmall"] = 0xf76b; 55384 t["L"] = 0x004c; 55385 t["LJ"] = 0x01c7; 55386 t["LL"] = 0xf6bf; 55387 t["Lacute"] = 0x0139; 55388 t["Lambda"] = 0x039b; 55389 t["Lcaron"] = 0x013d; 55390 t["Lcedilla"] = 0x013b; 55391 t["Lcircle"] = 0x24c1;
55392 t["Lcircumflexbelow"] = 0x1e3c; 55393 t["Lcommaaccent"] = 0x013b; 55394 t["Ldot"] = 0x013f; 55395 t["Ldotaccent"] = 0x013f; 55396 t["Ldotbelow"] = 0x1e36; 55397 t["Ldotbelowmacron"] = 0x1e38; 55398 t["Liwnarmenian"] = 0x053c; 55399 t["Lj"] = 0x01c8; 55400 t["Ljecyrillic"] = 0x0409; 55401 t["Llinebelow"] = 0x1e3a; 55402 t["Lmonospace"] = 0xff2c; 55403 t["Lslash"] = 0x0141; 55404 t["Lslashsmall"] = 0xf6f9; 55405 t["Lsmall"] = 0xf76c; 55406 t["M"] = 0x004d; 55407 t["MBsquare"] = 0x3386; 55408 t["Macron"] = 0xf6d0; 55409 t["Macronsmall"] = 0xf7af; 55410 t["Macute"] = 0x1e3e; 55411 t["Mcircle"] = 0x24c2; 55412 t["Mdotaccent"] = 0x1e40; 55413 t["Mdotbelow"] = 0x1e42; 55414 t["Menarmenian"] = 0x0544; 55415 t["Mmonospace"] = 0xff2d; 55416 t["Msmall"] = 0xf76d; 55417 t["Mturned"] = 0x019c; 55418 t["Mu"] = 0x039c; 55419 t["N"] = 0x004e; 55420 t["NJ"] = 0x01ca; 55421 t["Nacute"] = 0x0143; 55422 t["Ncaron"] = 0x0147; 55423 t["Ncedilla"] = 0x0145; 55424 t["Ncircle"] = 0x24c3; 55425 t["Ncircumflexbelow"] = 0x1e4a; 55426 t["Ncommaaccent"] = 0x0145; 55427 t["Ndotaccent"] = 0x1e44; 55428 t["Ndotbelow"] = 0x1e46; 55429 t["Nhookleft"] = 0x019d; 55430 t["Nineroman"] = 0x2168; 55431 t["Nj"] = 0x01cb; 55432 t["Njecyrillic"] = 0x040a; 55433 t["Nlinebelow"] = 0x1e48; 55434 t["Nmonospace"] = 0xff2e; 55435 t["Nowarmenian"] = 0x0546; 55436 t["Nsmall"] = 0xf76e; 55437 t["Ntilde"] = 0x00d1; 55438 t["Ntildesmall"] = 0xf7f1; 55439 t["Nu"] = 0x039d; 55440 t["O"] = 0x004f; 55441 t["OE"] = 0x0152; 55442 t["OEsmall"] = 0xf6fa; 55443 t["Oacute"] = 0x00d3; 55444 t["Oacutesmall"] = 0xf7f3; 55445 t["Obarredcyrillic"] = 0x04e8; 55446 t["Obarreddieresiscyrillic"] = 0x04ea; 55447 t["Obreve"] = 0x014e; 55448 t["Ocaron"] = 0x01d1; 55449 t["Ocenteredtilde"] = 0x019f; 55450 t["Ocircle"] = 0x24c4; 55451 t["Ocircumflex"] = 0x00d4; 55452 t["Ocircumflexacute"] = 0x1ed0; 55453 t["Ocircumflexdotbelow"] = 0x1ed8; 55454 t["Ocircumflexgrave"] = 0x1ed2; 55455 t["Ocircumflexhookabove"] = 0x1ed4; 55456 t["Ocircumflexsmall"] = 0xf7f4; 55457 t["Ocircumflextilde"] = 0x1ed6; 55458 t["Ocyrillic"] = 0x041e; 55459 t["Odblacute"] = 0x0150; 55460 t["Odblgrave"] = 0x020c; 55461 t["Odieresis"] = 0x00d6; 55462 t["Odieresiscyrillic"] = 0x04e6; 55463 t["Odieresissmall"] = 0xf7f6; 55464 t["Odotbelow"] = 0x1ecc; 55465 t["Ogoneksmall"] = 0xf6fb; 55466 t["Ograve"] = 0x00d2; 55467 t["Ogravesmall"] = 0xf7f2; 55468 t["Oharmenian"] = 0x0555; 55469 t["Ohm"] = 0x2126; 55470 t["Ohookabove"] = 0x1ece; 55471 t["Ohorn"] = 0x01a0; 55472 t["Ohornacute"] = 0x1eda; 55473 t["Ohorndotbelow"] = 0x1ee2; 55474 t["Ohorngrave"] = 0x1edc; 55475 t["Ohornhookabove"] = 0x1ede; 55476 t["Ohorntilde"] = 0x1ee0; 55477 t["Ohungarumlaut"] = 0x0150; 55478 t["Oi"] = 0x01a2; 55479 t["Oinvertedbreve"] = 0x020e; 55480 t["Omacron"] = 0x014c; 55481 t["Omacronacute"] = 0x1e52; 55482 t["Omacrongrave"] = 0x1e50; 55483 t["Omega"] = 0x2126; 55484 t["Omegacyrillic"] = 0x0460; 55485 t["Omegagreek"] = 0x03a9; 55486 t["Omegaroundcyrillic"] = 0x047a; 55487 t["Omegatitlocyrillic"] = 0x047c; 55488 t["Omegatonos"] = 0x038f; 55489 t["Omicron"] = 0x039f; 55490 t["Omicrontonos"] = 0x038c; 55491 t["Omonospace"] = 0xff2f; 55492 t["Oneroman"] = 0x2160; 55493 t["Oogonek"] = 0x01ea; 55494 t["Oogonekmacron"] = 0x01ec; 55495 t["Oopen"] = 0x0186; 55496 t["Oslash"] = 0x00d8; 55497 t["Oslashacute"] = 0x01fe; 55498 t["Oslashsmall"] = 0xf7f8; 55499 t["Osmall"] = 0xf76f; 55500 t["Ostrokeacute"] = 0x01fe; 55501 t["Otcyrillic"] = 0x047e; 55502 t["Otilde"] = 0x00d5; 55503 t["Otildeacute"] = 0x1e4c; 55504 t["Otildedieresis"] = 0x1e4e; 55505 t["Otildesmall"] = 0xf7f5; 55506 t["P"] = 0x0050; 55507 t["Pacute"] = 0x1e54; 55508 t["Pcircle"] = 0x24c5; 55509 t["Pdotaccent"] = 0x1e56; 55510 t["Pecyrillic"] = 0x041f; 55511 t["Peharmenian"] = 0x054a; 55512 t["Pemiddlehookcyrillic"] = 0x04a6; 55513 t["Phi"] = 0x03a6; 55514 t["Phook"] = 0x01a4; 55515 t["Pi"] = 0x03a0; 55516 t["Piwrarmenian"] = 0x0553; 55517 t["Pmonospace"] = 0xff30; 55518 t["Psi"] = 0x03a8; 55519 t["Psicyrillic"] = 0x0470; 55520 t["Psmall"] = 0xf770; 55521 t["Q"] = 0x0051; 55522 t["Qcircle"] = 0x24c6; 55523 t["Qmonospace"] = 0xff31; 55524 t["Qsmall"] = 0xf771; 55525 t["R"] = 0x0052; 55526 t["Raarmenian"] = 0x054c; 55527 t["Racute"] = 0x0154; 55528 t["Rcaron"] = 0x0158; 55529 t["Rcedilla"] = 0x0156; 55530 t["Rcircle"] = 0x24c7; 55531 t["Rcommaaccent"] = 0x0156; 55532 t["Rdblgrave"] = 0x0210; 55533 t["Rdotaccent"] = 0x1e58; 55534 t["Rdotbelow"] = 0x1e5a; 55535 t["Rdotbelowmacron"] = 0x1e5c; 55536 t["Reharmenian"] = 0x0550; 55537 t["Rfraktur"] = 0x211c; 55538 t["Rho"] = 0x03a1; 55539 t["Ringsmall"] = 0xf6fc; 55540 t["Rinvertedbreve"] = 0x0212; 55541 t["Rlinebelow"] = 0x1e5e; 55542 t["Rmonospace"] = 0xff32; 55543 t["Rsmall"] = 0xf772; 55544 t["Rsmallinverted"] = 0x0281; 55545 t["Rsmallinvertedsuperior"] = 0x02b6; 55546 t["S"] = 0x0053; 55547 t["SF010000"] = 0x250c; 55548 t["SF020000"] = 0x2514; 55549 t["SF030000"] = 0x2510; 55550 t["SF040000"] = 0x2518; 55551 t["SF050000"] = 0x253c; 55552 t["SF060000"] = 0x252c; 55553 t["SF070000"] = 0x2534; 55554 t["SF080000"] = 0x251c; 55555 t["SF090000"] = 0x2524; 55556 t["SF100000"] = 0x2500; 55557 t["SF110000"] = 0x2502; 55558 t["SF190000"] = 0x2561; 55559 t["SF200000"] = 0x2562; 55560 t["SF210000"] = 0x2556; 55561 t["SF220000"] = 0x2555; 55562 t["SF230000"] = 0x2563; 55563 t["SF240000"] = 0x2551; 55564 t["SF250000"] = 0x2557; 55565 t["SF260000"] = 0x255d; 55566 t["SF270000"] = 0x255c; 55567 t["SF280000"] = 0x255b; 55568 t["SF360000"] = 0x255e; 55569 t["SF370000"] = 0x255f; 55570 t["SF380000"] = 0x255a; 55571 t["SF390000"] = 0x2554; 55572 t["SF400000"] = 0x2569; 55573 t["SF410000"] = 0x2566; 55574 t["SF420000"] = 0x2560; 55575 t["SF430000"] = 0x2550; 55576 t["SF440000"] = 0x256c; 55577 t["SF450000"] = 0x2567; 55578 t["SF460000"] = 0x2568; 55579 t["SF470000"] = 0x2564; 55580 t["SF480000"] = 0x2565; 55581 t["SF490000"] = 0x2559; 55582 t["SF500000"] = 0x2558; 55583 t["SF510000"] = 0x2552; 55584 t["SF520000"] = 0x2553; 55585 t["SF530000"] = 0x256b; 55586 t["SF540000"] = 0x256a;
55587 t["Sacute"] = 0x015a; 55588 t["Sacutedotaccent"] = 0x1e64; 55589 t["Sampigreek"] = 0x03e0; 55590 t["Scaron"] = 0x0160; 55591 t["Scarondotaccent"] = 0x1e66; 55592 t["Scaronsmall"] = 0xf6fd; 55593 t["Scedilla"] = 0x015e; 55594 t["Schwa"] = 0x018f; 55595 t["Schwacyrillic"] = 0x04d8; 55596 t["Schwadieresiscyrillic"] = 0x04da; 55597 t["Scircle"] = 0x24c8; 55598 t["Scircumflex"] = 0x015c; 55599 t["Scommaaccent"] = 0x0218; 55600 t["Sdotaccent"] = 0x1e60; 55601 t["Sdotbelow"] = 0x1e62; 55602 t["Sdotbelowdotaccent"] = 0x1e68; 55603 t["Seharmenian"] = 0x054d; 55604 t["Sevenroman"] = 0x2166; 55605 t["Shaarmenian"] = 0x0547; 55606 t["Shacyrillic"] = 0x0428; 55607 t["Shchacyrillic"] = 0x0429; 55608 t["Sheicoptic"] = 0x03e2; 55609 t["Shhacyrillic"] = 0x04ba; 55610 t["Shimacoptic"] = 0x03ec; 55611 t["Sigma"] = 0x03a3; 55612 t["Sixroman"] = 0x2165; 55613 t["Smonospace"] = 0xff33; 55614 t["Softsigncyrillic"] = 0x042c; 55615 t["Ssmall"] = 0xf773; 55616 t["Stigmagreek"] = 0x03da; 55617 t["T"] = 0x0054; 55618 t["Tau"] = 0x03a4; 55619 t["Tbar"] = 0x0166; 55620 t["Tcaron"] = 0x0164; 55621 t["Tcedilla"] = 0x0162; 55622 t["Tcircle"] = 0x24c9; 55623 t["Tcircumflexbelow"] = 0x1e70; 55624 t["Tcommaaccent"] = 0x0162; 55625 t["Tdotaccent"] = 0x1e6a; 55626 t["Tdotbelow"] = 0x1e6c; 55627 t["Tecyrillic"] = 0x0422; 55628 t["Tedescendercyrillic"] = 0x04ac; 55629 t["Tenroman"] = 0x2169; 55630 t["Tetsecyrillic"] = 0x04b4; 55631 t["Theta"] = 0x0398; 55632 t["Thook"] = 0x01ac; 55633 t["Thorn"] = 0x00de; 55634 t["Thornsmall"] = 0xf7fe; 55635 t["Threeroman"] = 0x2162; 55636 t["Tildesmall"] = 0xf6fe; 55637 t["Tiwnarmenian"] = 0x054f; 55638 t["Tlinebelow"] = 0x1e6e; 55639 t["Tmonospace"] = 0xff34; 55640 t["Toarmenian"] = 0x0539; 55641 t["Tonefive"] = 0x01bc; 55642 t["Tonesix"] = 0x0184; 55643 t["Tonetwo"] = 0x01a7; 55644 t["Tretroflexhook"] = 0x01ae; 55645 t["Tsecyrillic"] = 0x0426; 55646 t["Tshecyrillic"] = 0x040b; 55647 t["Tsmall"] = 0xf774; 55648 t["Twelveroman"] = 0x216b; 55649 t["Tworoman"] = 0x2161; 55650 t["U"] = 0x0055; 55651 t["Uacute"] = 0x00da; 55652 t["Uacutesmall"] = 0xf7fa; 55653 t["Ubreve"] = 0x016c; 55654 t["Ucaron"] = 0x01d3; 55655 t["Ucircle"] = 0x24ca; 55656 t["Ucircumflex"] = 0x00db; 55657 t["Ucircumflexbelow"] = 0x1e76; 55658 t["Ucircumflexsmall"] = 0xf7fb; 55659 t["Ucyrillic"] = 0x0423; 55660 t["Udblacute"] = 0x0170; 55661 t["Udblgrave"] = 0x0214; 55662 t["Udieresis"] = 0x00dc; 55663 t["Udieresisacute"] = 0x01d7; 55664 t["Udieresisbelow"] = 0x1e72; 55665 t["Udieresiscaron"] = 0x01d9; 55666 t["Udieresiscyrillic"] = 0x04f0; 55667 t["Udieresisgrave"] = 0x01db; 55668 t["Udieresismacron"] = 0x01d5; 55669 t["Udieresissmall"] = 0xf7fc; 55670 t["Udotbelow"] = 0x1ee4; 55671 t["Ugrave"] = 0x00d9; 55672 t["Ugravesmall"] = 0xf7f9; 55673 t["Uhookabove"] = 0x1ee6; 55674 t["Uhorn"] = 0x01af; 55675 t["Uhornacute"] = 0x1ee8; 55676 t["Uhorndotbelow"] = 0x1ef0; 55677 t["Uhorngrave"] = 0x1eea; 55678 t["Uhornhookabove"] = 0x1eec; 55679 t["Uhorntilde"] = 0x1eee; 55680 t["Uhungarumlaut"] = 0x0170; 55681 t["Uhungarumlautcyrillic"] = 0x04f2; 55682 t["Uinvertedbreve"] = 0x0216; 55683 t["Ukcyrillic"] = 0x0478; 55684 t["Umacron"] = 0x016a; 55685 t["Umacroncyrillic"] = 0x04ee; 55686 t["Umacrondieresis"] = 0x1e7a; 55687 t["Umonospace"] = 0xff35; 55688 t["Uogonek"] = 0x0172; 55689 t["Upsilon"] = 0x03a5; 55690 t["Upsilon1"] = 0x03d2; 55691 t["Upsilonacutehooksymbolgreek"] = 0x03d3; 55692 t["Upsilonafrican"] = 0x01b1; 55693 t["Upsilondieresis"] = 0x03ab; 55694 t["Upsilondieresishooksymbolgreek"] = 0x03d4; 55695 t["Upsilonhooksymbol"] = 0x03d2; 55696 t["Upsilontonos"] = 0x038e; 55697 t["Uring"] = 0x016e; 55698 t["Ushortcyrillic"] = 0x040e; 55699 t["Usmall"] = 0xf775; 55700 t["Ustraightcyrillic"] = 0x04ae; 55701 t["Ustraightstrokecyrillic"] = 0x04b0; 55702 t["Utilde"] = 0x0168; 55703 t["Utildeacute"] = 0x1e78; 55704 t["Utildebelow"] = 0x1e74; 55705 t["V"] = 0x0056; 55706 t["Vcircle"] = 0x24cb; 55707 t["Vdotbelow"] = 0x1e7e; 55708 t["Vecyrillic"] = 0x0412; 55709 t["Vewarmenian"] = 0x054e; 55710 t["Vhook"] = 0x01b2; 55711 t["Vmonospace"] = 0xff36; 55712 t["Voarmenian"] = 0x0548; 55713 t["Vsmall"] = 0xf776; 55714 t["Vtilde"] = 0x1e7c; 55715 t["W"] = 0x0057; 55716 t["Wacute"] = 0x1e82; 55717 t["Wcircle"] = 0x24cc; 55718 t["Wcircumflex"] = 0x0174; 55719 t["Wdieresis"] = 0x1e84; 55720 t["Wdotaccent"] = 0x1e86; 55721 t["Wdotbelow"] = 0x1e88; 55722 t["Wgrave"] = 0x1e80; 55723 t["Wmonospace"] = 0xff37; 55724 t["Wsmall"] = 0xf777; 55725 t["X"] = 0x0058; 55726 t["Xcircle"] = 0x24cd; 55727 t["Xdieresis"] = 0x1e8c; 55728 t["Xdotaccent"] = 0x1e8a; 55729 t["Xeharmenian"] = 0x053d; 55730 t["Xi"] = 0x039e; 55731 t["Xmonospace"] = 0xff38; 55732 t["Xsmall"] = 0xf778; 55733 t["Y"] = 0x0059; 55734 t["Yacute"] = 0x00dd; 55735 t["Yacutesmall"] = 0xf7fd; 55736 t["Yatcyrillic"] = 0x0462; 55737 t["Ycircle"] = 0x24ce; 55738 t["Ycircumflex"] = 0x0176; 55739 t["Ydieresis"] = 0x0178; 55740 t["Ydieresissmall"] = 0xf7ff; 55741 t["Ydotaccent"] = 0x1e8e; 55742 t["Ydotbelow"] = 0x1ef4; 55743 t["Yericyrillic"] = 0x042b; 55744 t["Yerudieresiscyrillic"] = 0x04f8; 55745 t["Ygrave"] = 0x1ef2; 55746 t["Yhook"] = 0x01b3; 55747 t["Yhookabove"] = 0x1ef6; 55748 t["Yiarmenian"] = 0x0545; 55749 t["Yicyrillic"] = 0x0407; 55750 t["Yiwnarmenian"] = 0x0552; 55751 t["Ymonospace"] = 0xff39; 55752 t["Ysmall"] = 0xf779; 55753 t["Ytilde"] = 0x1ef8; 55754 t["Yusbigcyrillic"] = 0x046a; 55755 t["Yusbigiotifiedcyrillic"] = 0x046c; 55756 t["Yuslittlecyrillic"] = 0x0466; 55757 t["Yuslittleiotifiedcyrillic"] = 0x0468; 55758 t["Z"] = 0x005a; 55759 t["Zaarmenian"] = 0x0536; 55760 t["Zacute"] = 0x0179; 55761 t["Zcaron"] = 0x017d; 55762 t["Zcaronsmall"] = 0xf6ff; 55763 t["Zcircle"] = 0x24cf; 55764 t["Zcircumflex"] = 0x1e90; 55765 t["Zdot"] = 0x017b; 55766 t["Zdotaccent"] = 0x017b; 55767 t["Zdotbelow"] = 0x1e92; 55768 t["Zecyrillic"] = 0x0417; 55769 t["Zedescendercyrillic"] = 0x0498; 55770 t["Zedieresiscyrillic"] = 0x04de; 55771 t["Zeta"] = 0x0396; 55772 t["Zhearmenian"] = 0x053a; 55773 t["Zhebrevecyrillic"] = 0x04c1; 55774 t["Zhecyrillic"] = 0x0416; 55775 t["Zhedescendercyrillic"] = 0x0496; 55776 t["Zhedieresiscyrillic"] = 0x04dc; 55777 t["Zlinebelow"] = 0x1e94; 55778 t["Zmonospace"] = 0xff3a; 55779 t["Zsmall"] = 0xf77a; 55780 t["Zstroke"] = 0x01b5; 55781 t["a"] = 0x0061; 55782 t["aabengali"] = 0x0986; 55783 t["aacute"] = 0x00e1; 55784 t["aadeva"] = 0x0906; 55785 t["aagujarati"] = 0x0a86; 55786 t["aagurmukhi"] = 0x0a06; 55787 t["aamatragurmukhi"] = 0x0a3e; 55788 t["aarusquare"] = 0x3303; 55789 t["aavowelsignbengali"] = 0x09be; 55790 t["aavowelsigndeva"] = 0x093e; 55791 t["aavowelsigngujarati"] = 0x0abe; 55792 t["abbreviationmarkarmenian"] = 0x055f; 55793 t["abbreviationsigndeva"] = 0x0970; 55794 t["abengali"] = 0x0985; 55795 t["abopomofo"] = 0x311a; 55796 t["abreve"] = 0x0103; 55797 t["abreveacute"] = 0x1eaf; 55798 t["abrevecyrillic"] = 0x04d1; 55799 t["abrevedotbelow"] = 0x1eb7; 55800 t["abrevegrave"] = 0x1eb1; 55801 t["abrevehookabove"] = 0x1eb3; 55802 t["abrevetilde"] = 0x1eb5; 55803 t["acaron"] = 0x01ce; 55804 t["acircle"] = 0x24d0; 55805 t["acircumflex"] = 0x00e2; 55806 t["acircumflexacute"] = 0x1ea5; 55807 t["acircumflexdotbelow"] = 0x1ead; 55808 t["acircumflexgrave"] = 0x1ea7; 55809 t["acircumflexhookabove"] = 0x1ea9; 55810 t["acircumflextilde"] = 0x1eab; 55811 t["acute"] = 0x00b4; 55812 t["acutebelowcmb"] = 0x0317; 55813 t["acutecmb"] = 0x0301; 55814 t["acutecomb"] = 0x0301; 55815 t["acutedeva"] = 0x0954; 55816 t["acutelowmod"] = 0x02cf; 55817 t["acutetonecmb"] = 0x0341; 55818 t["acyrillic"] = 0x0430; 55819 t["adblgrave"] = 0x0201; 55820 t["addakgurmukhi"] = 0x0a71; 55821 t["adeva"] = 0x0905; 55822 t["adieresis"] = 0x00e4; 55823 t["adieresiscyrillic"] = 0x04d3; 55824 t["adieresismacron"] = 0x01df; 55825 t["adotbelow"] = 0x1ea1; 55826 t["adotmacron"] = 0x01e1; 55827 t["ae"] = 0x00e6; 55828 t["aeacute"] = 0x01fd; 55829 t["aekorean"] = 0x3150; 55830 t["aemacron"] = 0x01e3; 55831 t["afii00208"] = 0x2015; 55832 t["afii08941"] = 0x20a4; 55833 t["afii10017"] = 0x0410; 55834 t["afii10018"] = 0x0411; 55835 t["afii10019"] = 0x0412; 55836 t["afii10020"] = 0x0413;
55837 t["afii10021"] = 0x0414; 55838 t["afii10022"] = 0x0415; 55839 t["afii10023"] = 0x0401; 55840 t["afii10024"] = 0x0416; 55841 t["afii10025"] = 0x0417; 55842 t["afii10026"] = 0x0418; 55843 t["afii10027"] = 0x0419; 55844 t["afii10028"] = 0x041a; 55845 t["afii10029"] = 0x041b; 55846 t["afii10030"] = 0x041c; 55847 t["afii10031"] = 0x041d; 55848 t["afii10032"] = 0x041e; 55849 t["afii10033"] = 0x041f; 55850 t["afii10034"] = 0x0420; 55851 t["afii10035"] = 0x0421; 55852 t["afii10036"] = 0x0422; 55853 t["afii10037"] = 0x0423; 55854 t["afii10038"] = 0x0424; 55855 t["afii10039"] = 0x0425; 55856 t["afii10040"] = 0x0426; 55857 t["afii10041"] = 0x0427; 55858 t["afii10042"] = 0x0428; 55859 t["afii10043"] = 0x0429; 55860 t["afii10044"] = 0x042a; 55861 t["afii10045"] = 0x042b; 55862 t["afii10046"] = 0x042c; 55863 t["afii10047"] = 0x042d; 55864 t["afii10048"] = 0x042e; 55865 t["afii10049"] = 0x042f; 55866 t["afii10050"] = 0x0490; 55867 t["afii10051"] = 0x0402; 55868 t["afii10052"] = 0x0403; 55869 t["afii10053"] = 0x0404; 55870 t["afii10054"] = 0x0405; 55871 t["afii10055"] = 0x0406; 55872 t["afii10056"] = 0x0407; 55873 t["afii10057"] = 0x0408; 55874 t["afii10058"] = 0x0409; 55875 t["afii10059"] = 0x040a; 55876 t["afii10060"] = 0x040b; 55877 t["afii10061"] = 0x040c; 55878 t["afii10062"] = 0x040e; 55879 t["afii10063"] = 0xf6c4; 55880 t["afii10064"] = 0xf6c5; 55881 t["afii10065"] = 0x0430; 55882 t["afii10066"] = 0x0431; 55883 t["afii10067"] = 0x0432; 55884 t["afii10068"] = 0x0433; 55885 t["afii10069"] = 0x0434; 55886 t["afii10070"] = 0x0435; 55887 t["afii10071"] = 0x0451; 55888 t["afii10072"] = 0x0436; 55889 t["afii10073"] = 0x0437; 55890 t["afii10074"] = 0x0438; 55891 t["afii10075"] = 0x0439; 55892 t["afii10076"] = 0x043a; 55893 t["afii10077"] = 0x043b; 55894 t["afii10078"] = 0x043c; 55895 t["afii10079"] = 0x043d; 55896 t["afii10080"] = 0x043e; 55897 t["afii10081"] = 0x043f; 55898 t["afii10082"] = 0x0440; 55899 t["afii10083"] = 0x0441; 55900 t["afii10084"] = 0x0442; 55901 t["afii10085"] = 0x0443; 55902 t["afii10086"] = 0x0444; 55903 t["afii10087"] = 0x0445; 55904 t["afii10088"] = 0x0446; 55905 t["afii10089"] = 0x0447; 55906 t["afii10090"] = 0x0448; 55907 t["afii10091"] = 0x0449; 55908 t["afii10092"] = 0x044a; 55909 t["afii10093"] = 0x044b; 55910 t["afii10094"] = 0x044c; 55911 t["afii10095"] = 0x044d; 55912 t["afii10096"] = 0x044e; 55913 t["afii10097"] = 0x044f; 55914 t["afii10098"] = 0x0491; 55915 t["afii10099"] = 0x0452; 55916 t["afii10100"] = 0x0453; 55917 t["afii10101"] = 0x0454; 55918 t["afii10102"] = 0x0455; 55919 t["afii10103"] = 0x0456; 55920 t["afii10104"] = 0x0457; 55921 t["afii10105"] = 0x0458; 55922 t["afii10106"] = 0x0459; 55923 t["afii10107"] = 0x045a; 55924 t["afii10108"] = 0x045b; 55925 t["afii10109"] = 0x045c; 55926 t["afii10110"] = 0x045e; 55927 t["afii10145"] = 0x040f; 55928 t["afii10146"] = 0x0462; 55929 t["afii10147"] = 0x0472; 55930 t["afii10148"] = 0x0474; 55931 t["afii10192"] = 0xf6c6; 55932 t["afii10193"] = 0x045f; 55933 t["afii10194"] = 0x0463; 55934 t["afii10195"] = 0x0473; 55935 t["afii10196"] = 0x0475; 55936 t["afii10831"] = 0xf6c7; 55937 t["afii10832"] = 0xf6c8; 55938 t["afii10846"] = 0x04d9; 55939 t["afii299"] = 0x200e; 55940 t["afii300"] = 0x200f; 55941 t["afii301"] = 0x200d; 55942 t["afii57381"] = 0x066a; 55943 t["afii57388"] = 0x060c; 55944 t["afii57392"] = 0x0660; 55945 t["afii57393"] = 0x0661; 55946 t["afii57394"] = 0x0662; 55947 t["afii57395"] = 0x0663; 55948 t["afii57396"] = 0x0664; 55949 t["afii57397"] = 0x0665; 55950 t["afii57398"] = 0x0666; 55951 t["afii57399"] = 0x0667; 55952 t["afii57400"] = 0x0668; 55953 t["afii57401"] = 0x0669; 55954 t["afii57403"] = 0x061b; 55955 t["afii57407"] = 0x061f; 55956 t["afii57409"] = 0x0621; 55957 t["afii57410"] = 0x0622; 55958 t["afii57411"] = 0x0623; 55959 t["afii57412"] = 0x0624; 55960 t["afii57413"] = 0x0625; 55961 t["afii57414"] = 0x0626; 55962 t["afii57415"] = 0x0627; 55963 t["afii57416"] = 0x0628; 55964 t["afii57417"] = 0x0629; 55965 t["afii57418"] = 0x062a; 55966 t["afii57419"] = 0x062b; 55967 t["afii57420"] = 0x062c; 55968 t["afii57421"] = 0x062d; 55969 t["afii57422"] = 0x062e; 55970 t["afii57423"] = 0x062f; 55971 t["afii57424"] = 0x0630; 55972 t["afii57425"] = 0x0631; 55973 t["afii57426"] = 0x0632; 55974 t["afii57427"] = 0x0633; 55975 t["afii57428"] = 0x0634; 55976 t["afii57429"] = 0x0635; 55977 t["afii57430"] = 0x0636; 55978 t["afii57431"] = 0x0637; 55979 t["afii57432"] = 0x0638; 55980 t["afii57433"] = 0x0639; 55981 t["afii57434"] = 0x063a; 55982 t["afii57440"] = 0x0640; 55983 t["afii57441"] = 0x0641; 55984 t["afii57442"] = 0x0642; 55985 t["afii57443"] = 0x0643; 55986 t["afii57444"] = 0x0644; 55987 t["afii57445"] = 0x0645; 55988 t["afii57446"] = 0x0646; 55989 t["afii57448"] = 0x0648; 55990 t["afii57449"] = 0x0649; 55991 t["afii57450"] = 0x064a; 55992 t["afii57451"] = 0x064b; 55993 t["afii57452"] = 0x064c; 55994 t["afii57453"] = 0x064d; 55995 t["afii57454"] = 0x064e; 55996 t["afii57455"] = 0x064f; 55997 t["afii57456"] = 0x0650; 55998 t["afii57457"] = 0x0651; 55999 t["afii57458"] = 0x0652; 56000 t["afii57470"] = 0x0647; 56001 t["afii57505"] = 0x06a4; 56002 t["afii57506"] = 0x067e; 56003 t["afii57507"] = 0x0686; 56004 t["afii57508"] = 0x0698; 56005 t["afii57509"] = 0x06af; 56006 t["afii57511"] = 0x0679; 56007 t["afii57512"] = 0x0688; 56008 t["afii57513"] = 0x0691; 56009 t["afii57514"] = 0x06ba; 56010 t["afii57519"] = 0x06d2; 56011 t["afii57534"] = 0x06d5; 56012 t["afii57636"] = 0x20aa; 56013 t["afii57645"] = 0x05be; 56014 t["afii57658"] = 0x05c3; 56015 t["afii57664"] = 0x05d0; 56016 t["afii57665"] = 0x05d1; 56017 t["afii57666"] = 0x05d2; 56018 t["afii57667"] = 0x05d3; 56019 t["afii57668"] = 0x05d4; 56020 t["afii57669"] = 0x05d5; 56021 t["afii57670"] = 0x05d6; 56022 t["afii57671"] = 0x05d7; 56023 t["afii57672"] = 0x05d8; 56024 t["afii57673"] = 0x05d9; 56025 t["afii57674"] = 0x05da; 56026 t["afii57675"] = 0x05db; 56027 t["afii57676"] = 0x05dc; 56028 t["afii57677"] = 0x05dd; 56029 t["afii57678"] = 0x05de; 56030 t["afii57679"] = 0x05df; 56031 t["afii57680"] = 0x05e0; 56032 t["afii57681"] = 0x05e1; 56033 t["afii57682"] = 0x05e2; 56034 t["afii57683"] = 0x05e3; 56035 t["afii57684"] = 0x05e4; 56036 t["afii57685"] = 0x05e5; 56037 t["afii57686"] = 0x05e6; 56038 t["afii57687"] = 0x05e7; 56039 t["afii57688"] = 0x05e8; 56040 t["afii57689"] = 0x05e9; 56041 t["afii57690"] = 0x05ea; 56042 t["afii57694"] = 0xfb2a; 56043 t["afii57695"] = 0xfb2b; 56044 t["afii57700"] = 0xfb4b; 56045 t["afii57705"] = 0xfb1f; 56046 t["afii57716"] = 0x05f0; 56047 t["afii57717"] = 0x05f1; 56048 t["afii57718"] = 0x05f2; 56049 t["afii57723"] = 0xfb35; 56050 t["afii57793"] = 0x05b4; 56051 t["afii57794"] = 0x05b5; 56052 t["afii57795"] = 0x05b6; 56053 t["afii57796"] = 0x05bb; 56054 t["afii57797"] = 0x05b8; 56055 t["afii57798"] = 0x05b7; 56056 t["afii57799"] = 0x05b0; 56057 t["afii57800"] = 0x05b2; 56058 t["afii57801"] = 0x05b1; 56059 t["afii57802"] = 0x05b3; 56060 t["afii57803"] = 0x05c2; 56061 t["afii57804"] = 0x05c1; 56062 t["afii57806"] = 0x05b9; 56063 t["afii57807"] = 0x05bc; 56064 t["afii57839"] = 0x05bd; 56065 t["afii57841"] = 0x05bf; 56066 t["afii57842"] = 0x05c0; 56067 t["afii57929"] = 0x02bc; 56068 t["afii61248"] = 0x2105; 56069 t["afii61289"] = 0x2113; 56070 t["afii61352"] = 0x2116; 56071 t["afii61573"] = 0x202c; 56072 t["afii61574"] = 0x202d; 56073 t["afii61575"] = 0x202e; 56074 t["afii61664"] = 0x200c; 56075 t["afii63167"] = 0x066d; 56076 t["afii64937"] = 0x02bd; 56077 t["agrave"] = 0x00e0; 56078 t["agujarati"] = 0x0a85; 56079 t["agurmukhi"] = 0x0a05; 56080 t["ahiragana"] = 0x3042;
56081 t["ahookabove"] = 0x1ea3; 56082 t["aibengali"] = 0x0990; 56083 t["aibopomofo"] = 0x311e; 56084 t["aideva"] = 0x0910; 56085 t["aiecyrillic"] = 0x04d5; 56086 t["aigujarati"] = 0x0a90; 56087 t["aigurmukhi"] = 0x0a10; 56088 t["aimatragurmukhi"] = 0x0a48; 56089 t["ainarabic"] = 0x0639; 56090 t["ainfinalarabic"] = 0xfeca; 56091 t["aininitialarabic"] = 0xfecb; 56092 t["ainmedialarabic"] = 0xfecc; 56093 t["ainvertedbreve"] = 0x0203; 56094 t["aivowelsignbengali"] = 0x09c8; 56095 t["aivowelsigndeva"] = 0x0948; 56096 t["aivowelsigngujarati"] = 0x0ac8; 56097 t["akatakana"] = 0x30a2; 56098 t["akatakanahalfwidth"] = 0xff71; 56099 t["akorean"] = 0x314f; 56100 t["alef"] = 0x05d0; 56101 t["alefarabic"] = 0x0627; 56102 t["alefdageshhebrew"] = 0xfb30; 56103 t["aleffinalarabic"] = 0xfe8e; 56104 t["alefhamzaabovearabic"] = 0x0623; 56105 t["alefhamzaabovefinalarabic"] = 0xfe84; 56106 t["alefhamzabelowarabic"] = 0x0625; 56107 t["alefhamzabelowfinalarabic"] = 0xfe88; 56108 t["alefhebrew"] = 0x05d0; 56109 t["aleflamedhebrew"] = 0xfb4f; 56110 t["alefmaddaabovearabic"] = 0x0622; 56111 t["alefmaddaabovefinalarabic"] = 0xfe82; 56112 t["alefmaksuraarabic"] = 0x0649; 56113 t["alefmaksurafinalarabic"] = 0xfef0; 56114 t["alefmaksurainitialarabic"] = 0xfef3; 56115 t["alefmaksuramedialarabic"] = 0xfef4; 56116 t["alefpatahhebrew"] = 0xfb2e; 56117 t["alefqamatshebrew"] = 0xfb2f; 56118 t["aleph"] = 0x2135; 56119 t["allequal"] = 0x224c; 56120 t["alpha"] = 0x03b1; 56121 t["alphatonos"] = 0x03ac; 56122 t["amacron"] = 0x0101; 56123 t["amonospace"] = 0xff41; 56124 t["ampersand"] = 0x0026; 56125 t["ampersandmonospace"] = 0xff06; 56126 t["ampersandsmall"] = 0xf726; 56127 t["amsquare"] = 0x33c2; 56128 t["anbopomofo"] = 0x3122; 56129 t["angbopomofo"] = 0x3124; 56130 t["angbracketleft"] = 0x3008; 56131 t["angbracketright"] = 0x3009; 56132 t["angkhankhuthai"] = 0x0e5a; 56133 t["angle"] = 0x2220; 56134 t["anglebracketleft"] = 0x3008; 56135 t["anglebracketleftvertical"] = 0xfe3f; 56136 t["anglebracketright"] = 0x3009; 56137 t["anglebracketrightvertical"] = 0xfe40; 56138 t["angleleft"] = 0x2329; 56139 t["angleright"] = 0x232a; 56140 t["angstrom"] = 0x212b; 56141 t["anoteleia"] = 0x0387; 56142 t["anudattadeva"] = 0x0952; 56143 t["anusvarabengali"] = 0x0982; 56144 t["anusvaradeva"] = 0x0902; 56145 t["anusvaragujarati"] = 0x0a82; 56146 t["aogonek"] = 0x0105; 56147 t["apaatosquare"] = 0x3300; 56148 t["aparen"] = 0x249c; 56149 t["apostrophearmenian"] = 0x055a; 56150 t["apostrophemod"] = 0x02bc; 56151 t["apple"] = 0xf8ff; 56152 t["approaches"] = 0x2250; 56153 t["approxequal"] = 0x2248; 56154 t["approxequalorimage"] = 0x2252; 56155 t["approximatelyequal"] = 0x2245; 56156 t["araeaekorean"] = 0x318e; 56157 t["araeakorean"] = 0x318d; 56158 t["arc"] = 0x2312; 56159 t["arighthalfring"] = 0x1e9a; 56160 t["aring"] = 0x00e5; 56161 t["aringacute"] = 0x01fb; 56162 t["aringbelow"] = 0x1e01; 56163 t["arrowboth"] = 0x2194; 56164 t["arrowdashdown"] = 0x21e3; 56165 t["arrowdashleft"] = 0x21e0; 56166 t["arrowdashright"] = 0x21e2; 56167 t["arrowdashup"] = 0x21e1; 56168 t["arrowdblboth"] = 0x21d4; 56169 t["arrowdbldown"] = 0x21d3; 56170 t["arrowdblleft"] = 0x21d0; 56171 t["arrowdblright"] = 0x21d2; 56172 t["arrowdblup"] = 0x21d1; 56173 t["arrowdown"] = 0x2193; 56174 t["arrowdownleft"] = 0x2199; 56175 t["arrowdownright"] = 0x2198; 56176 t["arrowdownwhite"] = 0x21e9; 56177 t["arrowheaddownmod"] = 0x02c5; 56178 t["arrowheadleftmod"] = 0x02c2; 56179 t["arrowheadrightmod"] = 0x02c3; 56180 t["arrowheadupmod"] = 0x02c4; 56181 t["arrowhorizex"] = 0xf8e7; 56182 t["arrowleft"] = 0x2190; 56183 t["arrowleftdbl"] = 0x21d0; 56184 t["arrowleftdblstroke"] = 0x21cd; 56185 t["arrowleftoverright"] = 0x21c6; 56186 t["arrowleftwhite"] = 0x21e6; 56187 t["arrowright"] = 0x2192; 56188 t["arrowrightdblstroke"] = 0x21cf; 56189 t["arrowrightheavy"] = 0x279e; 56190 t["arrowrightoverleft"] = 0x21c4; 56191 t["arrowrightwhite"] = 0x21e8; 56192 t["arrowtableft"] = 0x21e4; 56193 t["arrowtabright"] = 0x21e5; 56194 t["arrowup"] = 0x2191; 56195 t["arrowupdn"] = 0x2195; 56196 t["arrowupdnbse"] = 0x21a8; 56197 t["arrowupdownbase"] = 0x21a8; 56198 t["arrowupleft"] = 0x2196; 56199 t["arrowupleftofdown"] = 0x21c5; 56200 t["arrowupright"] = 0x2197; 56201 t["arrowupwhite"] = 0x21e7; 56202 t["arrowvertex"] = 0xf8e6; 56203 t["asciicircum"] = 0x005e; 56204 t["asciicircummonospace"] = 0xff3e; 56205 t["asciitilde"] = 0x007e; 56206 t["asciitildemonospace"] = 0xff5e; 56207 t["ascript"] = 0x0251; 56208 t["ascriptturned"] = 0x0252; 56209 t["asmallhiragana"] = 0x3041; 56210 t["asmallkatakana"] = 0x30a1; 56211 t["asmallkatakanahalfwidth"] = 0xff67; 56212 t["asterisk"] = 0x002a; 56213 t["asteriskaltonearabic"] = 0x066d; 56214 t["asteriskarabic"] = 0x066d; 56215 t["asteriskmath"] = 0x2217; 56216 t["asteriskmonospace"] = 0xff0a; 56217 t["asterisksmall"] = 0xfe61; 56218 t["asterism"] = 0x2042; 56219 t["asuperior"] = 0xf6e9; 56220 t["asymptoticallyequal"] = 0x2243; 56221 t["at"] = 0x0040; 56222 t["atilde"] = 0x00e3; 56223 t["atmonospace"] = 0xff20; 56224 t["atsmall"] = 0xfe6b;
56225 t["aturned"] = 0x0250; 56226 t["aubengali"] = 0x0994; 56227 t["aubopomofo"] = 0x3120; 56228 t["audeva"] = 0x0914; 56229 t["augujarati"] = 0x0a94; 56230 t["augurmukhi"] = 0x0a14; 56231 t["aulengthmarkbengali"] = 0x09d7; 56232 t["aumatragurmukhi"] = 0x0a4c; 56233 t["auvowelsignbengali"] = 0x09cc; 56234 t["auvowelsigndeva"] = 0x094c; 56235 t["auvowelsigngujarati"] = 0x0acc; 56236 t["avagrahadeva"] = 0x093d; 56237 t["aybarmenian"] = 0x0561; 56238 t["ayin"] = 0x05e2; 56239 t["ayinaltonehebrew"] = 0xfb20; 56240 t["ayinhebrew"] = 0x05e2; 56241 t["b"] = 0x0062; 56242 t["babengali"] = 0x09ac; 56243 t["backslash"] = 0x005c; 56244 t["backslashmonospace"] = 0xff3c; 56245 t["badeva"] = 0x092c; 56246 t["bagujarati"] = 0x0aac; 56247 t["bagurmukhi"] = 0x0a2c; 56248 t["bahiragana"] = 0x3070; 56249 t["bahtthai"] = 0x0e3f; 56250 t["bakatakana"] = 0x30d0; 56251 t["bar"] = 0x007c; 56252 t["barmonospace"] = 0xff5c; 56253 t["bbopomofo"] = 0x3105; 56254 t["bcircle"] = 0x24d1; 56255 t["bdotaccent"] = 0x1e03; 56256 t["bdotbelow"] = 0x1e05; 56257 t["beamedsixteenthnotes"] = 0x266c; 56258 t["because"] = 0x2235; 56259 t["becyrillic"] = 0x0431; 56260 t["beharabic"] = 0x0628; 56261 t["behfinalarabic"] = 0xfe90; 56262 t["behinitialarabic"] = 0xfe91; 56263 t["behiragana"] = 0x3079; 56264 t["behmedialarabic"] = 0xfe92; 56265 t["behmeeminitialarabic"] = 0xfc9f; 56266 t["behmeemisolatedarabic"] = 0xfc08; 56267 t["behnoonfinalarabic"] = 0xfc6d; 56268 t["bekatakana"] = 0x30d9; 56269 t["benarmenian"] = 0x0562; 56270 t["bet"] = 0x05d1; 56271 t["beta"] = 0x03b2; 56272 t["betasymbolgreek"] = 0x03d0; 56273 t["betdagesh"] = 0xfb31; 56274 t["betdageshhebrew"] = 0xfb31; 56275 t["bethebrew"] = 0x05d1; 56276 t["betrafehebrew"] = 0xfb4c; 56277 t["bhabengali"] = 0x09ad; 56278 t["bhadeva"] = 0x092d; 56279 t["bhagujarati"] = 0x0aad; 56280 t["bhagurmukhi"] = 0x0a2d; 56281 t["bhook"] = 0x0253; 56282 t["bihiragana"] = 0x3073; 56283 t["bikatakana"] = 0x30d3; 56284 t["bilabialclick"] = 0x0298; 56285 t["bindigurmukhi"] = 0x0a02; 56286 t["birusquare"] = 0x3331; 56287 t["blackcircle"] = 0x25cf; 56288 t["blackdiamond"] = 0x25c6; 56289 t["blackdownpointingtriangle"] = 0x25bc; 56290 t["blackleftpointingpointer"] = 0x25c4; 56291 t["blackleftpointingtriangle"] = 0x25c0; 56292 t["blacklenticularbracketleft"] = 0x3010; 56293 t["blacklenticularbracketleftvertical"] = 0xfe3b; 56294 t["blacklenticularbracketright"] = 0x3011; 56295 t["blacklenticularbracketrightvertical"] = 0xfe3c; 56296 t["blacklowerlefttriangle"] = 0x25e3; 56297 t["blacklowerrighttriangle"] = 0x25e2; 56298 t["blackrectangle"] = 0x25ac; 56299 t["blackrightpointingpointer"] = 0x25ba; 56300 t["blackrightpointingtriangle"] = 0x25b6; 56301 t["blacksmallsquare"] = 0x25aa; 56302 t["blacksmilingface"] = 0x263b; 56303 t["blacksquare"] = 0x25a0; 56304 t["blackstar"] = 0x2605; 56305 t["blackupperlefttriangle"] = 0x25e4; 56306 t["blackupperrighttriangle"] = 0x25e5; 56307 t["blackuppointingsmalltriangle"] = 0x25b4; 56308 t["blackuppointingtriangle"] = 0x25b2; 56309 t["blank"] = 0x2423; 56310 t["blinebelow"] = 0x1e07; 56311 t["block"] = 0x2588; 56312 t["bmonospace"] = 0xff42; 56313 t["bobaimaithai"] = 0x0e1a; 56314 t["bohiragana"] = 0x307c; 56315 t["bokatakana"] = 0x30dc; 56316 t["bparen"] = 0x249d; 56317 t["bqsquare"] = 0x33c3; 56318 t["braceex"] = 0xf8f4; 56319 t["braceleft"] = 0x007b; 56320 t["braceleftbt"] = 0xf8f3; 56321 t["braceleftmid"] = 0xf8f2; 56322 t["braceleftmonospace"] = 0xff5b; 56323 t["braceleftsmall"] = 0xfe5b; 56324 t["bracelefttp"] = 0xf8f1; 56325 t["braceleftvertical"] = 0xfe37; 56326 t["braceright"] = 0x007d; 56327 t["bracerightbt"] = 0xf8fe; 56328 t["bracerightmid"] = 0xf8fd; 56329 t["bracerightmonospace"] = 0xff5d; 56330 t["bracerightsmall"] = 0xfe5c; 56331 t["bracerighttp"] = 0xf8fc; 56332 t["bracerightvertical"] = 0xfe38; 56333 t["bracketleft"] = 0x005b; 56334 t["bracketleftbt"] = 0xf8f0; 56335 t["bracketleftex"] = 0xf8ef; 56336 t["bracketleftmonospace"] = 0xff3b; 56337 t["bracketlefttp"] = 0xf8ee; 56338 t["bracketright"] = 0x005d; 56339 t["bracketrightbt"] = 0xf8fb; 56340 t["bracketrightex"] = 0xf8fa; 56341 t["bracketrightmonospace"] = 0xff3d; 56342 t["bracketrighttp"] = 0xf8f9; 56343 t["breve"] = 0x02d8; 56344 t["brevebelowcmb"] = 0x032e; 56345 t["brevecmb"] = 0x0306; 56346 t["breveinvertedbelowcmb"] = 0x032f; 56347 t["breveinvertedcmb"] = 0x0311; 56348 t["breveinverteddoublecmb"] = 0x0361; 56349 t["bridgebelowcmb"] = 0x032a; 56350 t["bridgeinvertedbelowcmb"] = 0x033a; 56351 t["brokenbar"] = 0x00a6; 56352 t["bstroke"] = 0x0180; 56353 t["bsuperior"] = 0xf6ea; 56354 t["btopbar"] = 0x0183; 56355 t["buhiragana"] = 0x3076; 56356 t["bukatakana"] = 0x30d6; 56357 t["bullet"] = 0x2022; 56358 t["bulletinverse"] = 0x25d8; 56359 t["bulletoperator"] = 0x2219; 56360 t["bullseye"] = 0x25ce; 56361 t["c"] = 0x0063; 56362 t["caarmenian"] = 0x056e; 56363 t["cabengali"] = 0x099a; 56364 t["cacute"] = 0x0107; 56365 t["cadeva"] = 0x091a; 56366 t["cagujarati"] = 0x0a9a; 56367 t["cagurmukhi"] = 0x0a1a; 56368 t["calsquare"] = 0x3388; 56369 t["candrabindubengali"] = 0x0981; 56370 t["candrabinducmb"] = 0x0310; 56371 t["candrabindudeva"] = 0x0901; 56372 t["candrabindugujarati"] = 0x0a81; 56373 t["capslock"] = 0x21ea; 56374 t["careof"] = 0x2105; 56375 t["caron"] = 0x02c7; 56376 t["caronbelowcmb"] = 0x032c; 56377 t["caroncmb"] = 0x030c; 56378 t["carriagereturn"] = 0x21b5; 56379 t["cbopomofo"] = 0x3118; 56380 t["ccaron"] = 0x010d; 56381 t["ccedilla"] = 0x00e7; 56382 t["ccedillaacute"] = 0x1e09; 56383 t["ccircle"] = 0x24d2; 56384 t["ccircumflex"] = 0x0109; 56385 t["ccurl"] = 0x0255; 56386 t["cdot"] = 0x010b; 56387 t["cdotaccent"] = 0x010b; 56388 t["cdsquare"] = 0x33c5; 56389 t["cedilla"] = 0x00b8; 56390 t["cedillacmb"] = 0x0327; 56391 t["cent"] = 0x00a2; 56392 t["centigrade"] = 0x2103; 56393 t["centinferior"] = 0xf6df; 56394 t["centmonospace"] = 0xffe0; 56395 t["centoldstyle"] = 0xf7a2; 56396 t["centsuperior"] = 0xf6e0; 56397 t["chaarmenian"] = 0x0579; 56398 t["chabengali"] = 0x099b; 56399 t["chadeva"] = 0x091b; 56400 t["chagujarati"] = 0x0a9b; 56401 t["chagurmukhi"] = 0x0a1b; 56402 t["chbopomofo"] = 0x3114; 56403 t["cheabkhasiancyrillic"] = 0x04bd; 56404 t["checkmark"] = 0x2713; 56405 t["checyrillic"] = 0x0447;
56406 t["chedescenderabkhasiancyrillic"] = 0x04bf; 56407 t["chedescendercyrillic"] = 0x04b7; 56408 t["chedieresiscyrillic"] = 0x04f5; 56409 t["cheharmenian"] = 0x0573; 56410 t["chekhakassiancyrillic"] = 0x04cc; 56411 t["cheverticalstrokecyrillic"] = 0x04b9; 56412 t["chi"] = 0x03c7; 56413 t["chieuchacirclekorean"] = 0x3277; 56414 t["chieuchaparenkorean"] = 0x3217; 56415 t["chieuchcirclekorean"] = 0x3269; 56416 t["chieuchkorean"] = 0x314a; 56417 t["chieuchparenkorean"] = 0x3209; 56418 t["chochangthai"] = 0x0e0a; 56419 t["chochanthai"] = 0x0e08; 56420 t["chochingthai"] = 0x0e09; 56421 t["chochoethai"] = 0x0e0c; 56422 t["chook"] = 0x0188; 56423 t["cieucacirclekorean"] = 0x3276; 56424 t["cieucaparenkorean"] = 0x3216; 56425 t["cieuccirclekorean"] = 0x3268; 56426 t["cieuckorean"] = 0x3148; 56427 t["cieucparenkorean"] = 0x3208; 56428 t["cieucuparenkorean"] = 0x321c; 56429 t["circle"] = 0x25cb; 56430 t["circlecopyrt"] = 0x00a9; 56431 t["circlemultiply"] = 0x2297; 56432 t["circleot"] = 0x2299; 56433 t["circleplus"] = 0x2295; 56434 t["circlepostalmark"] = 0x3036; 56435 t["circlewithlefthalfblack"] = 0x25d0; 56436 t["circlewithrighthalfblack"] = 0x25d1; 56437 t["circumflex"] = 0x02c6; 56438 t["circumflexbelowcmb"] = 0x032d; 56439 t["circumflexcmb"] = 0x0302; 56440 t["clear"] = 0x2327; 56441 t["clickalveolar"] = 0x01c2; 56442 t["clickdental"] = 0x01c0; 56443 t["clicklateral"] = 0x01c1; 56444 t["clickretroflex"] = 0x01c3; 56445 t["club"] = 0x2663; 56446 t["clubsuitblack"] = 0x2663; 56447 t["clubsuitwhite"] = 0x2667; 56448 t["cmcubedsquare"] = 0x33a4; 56449 t["cmonospace"] = 0xff43; 56450 t["cmsquaredsquare"] = 0x33a0; 56451 t["coarmenian"] = 0x0581; 56452 t["colon"] = 0x003a; 56453 t["colonmonetary"] = 0x20a1; 56454 t["colonmonospace"] = 0xff1a; 56455 t["colonsign"] = 0x20a1; 56456 t["colonsmall"] = 0xfe55; 56457 t["colontriangularhalfmod"] = 0x02d1; 56458 t["colontriangularmod"] = 0x02d0; 56459 t["comma"] = 0x002c; 56460 t["commaabovecmb"] = 0x0313; 56461 t["commaaboverightcmb"] = 0x0315; 56462 t["commaaccent"] = 0xf6c3; 56463 t["commaarabic"] = 0x060c; 56464 t["commaarmenian"] = 0x055d; 56465 t["commainferior"] = 0xf6e1; 56466 t["commamonospace"] = 0xff0c; 56467 t["commareversedabovecmb"] = 0x0314; 56468 t["commareversedmod"] = 0x02bd; 56469 t["commasmall"] = 0xfe50; 56470 t["commasuperior"] = 0xf6e2; 56471 t["commaturnedabovecmb"] = 0x0312; 56472 t["commaturnedmod"] = 0x02bb; 56473 t["compass"] = 0x263c; 56474 t["congruent"] = 0x2245; 56475 t["contourintegral"] = 0x222e; 56476 t["control"] = 0x2303; 56477 t["controlACK"] = 0x0006; 56478 t["controlBEL"] = 0x0007; 56479 t["controlBS"] = 0x0008; 56480 t["controlCAN"] = 0x0018; 56481 t["controlCR"] = 0x000d; 56482 t["controlDC1"] = 0x0011; 56483 t["controlDC2"] = 0x0012; 56484 t["controlDC3"] = 0x0013; 56485 t["controlDC4"] = 0x0014; 56486 t["controlDEL"] = 0x007f; 56487 t["controlDLE"] = 0x0010; 56488 t["controlEM"] = 0x0019; 56489 t["controlENQ"] = 0x0005; 56490 t["controlEOT"] = 0x0004; 56491 t["controlESC"] = 0x001b; 56492 t["controlETB"] = 0x0017; 56493 t["controlETX"] = 0x0003; 56494 t["controlFF"] = 0x000c; 56495 t["controlFS"] = 0x001c; 56496 t["controlGS"] = 0x001d; 56497 t["controlHT"] = 0x0009; 56498 t["controlLF"] = 0x000a; 56499 t["controlNAK"] = 0x0015; 56500 t["controlNULL"] = 0x0000; 56501 t["controlRS"] = 0x001e; 56502 t["controlSI"] = 0x000f; 56503 t["controlSO"] = 0x000e; 56504 t["controlSOT"] = 0x0002; 56505 t["controlSTX"] = 0x0001; 56506 t["controlSUB"] = 0x001a; 56507 t["controlSYN"] = 0x0016; 56508 t["controlUS"] = 0x001f; 56509 t["controlVT"] = 0x000b; 56510 t["copyright"] = 0x00a9; 56511 t["copyrightsans"] = 0xf8e9; 56512 t["copyrightserif"] = 0xf6d9; 56513 t["cornerbracketleft"] = 0x300c; 56514 t["cornerbracketlefthalfwidth"] = 0xff62; 56515 t["cornerbracketleftvertical"] = 0xfe41; 56516 t["cornerbracketright"] = 0x300d; 56517 t["cornerbracketrighthalfwidth"] = 0xff63; 56518 t["cornerbracketrightvertical"] = 0xfe42; 56519 t["corporationsquare"] = 0x337f; 56520 t["cosquare"] = 0x33c7; 56521 t["coverkgsquare"] = 0x33c6; 56522 t["cparen"] = 0x249e; 56523 t["cruzeiro"] = 0x20a2; 56524 t["cstretched"] = 0x0297; 56525 t["curlyand"] = 0x22cf; 56526 t["curlyor"] = 0x22ce; 56527 t["currency"] = 0x00a4; 56528 t["cyrBreve"] = 0xf6d1; 56529 t["cyrFlex"] = 0xf6d2; 56530 t["cyrbreve"] = 0xf6d4; 56531 t["cyrflex"] = 0xf6d5; 56532 t["d"] = 0x0064; 56533 t["daarmenian"] = 0x0564; 56534 t["dabengali"] = 0x09a6; 56535 t["dadarabic"] = 0x0636; 56536 t["dadeva"] = 0x0926; 56537 t["dadfinalarabic"] = 0xfebe; 56538 t["dadinitialarabic"] = 0xfebf; 56539 t["dadmedialarabic"] = 0xfec0; 56540 t["dagesh"] = 0x05bc; 56541 t["dageshhebrew"] = 0x05bc; 56542 t["dagger"] = 0x2020; 56543 t["daggerdbl"] = 0x2021; 56544 t["dagujarati"] = 0x0aa6; 56545 t["dagurmukhi"] = 0x0a26; 56546 t["dahiragana"] = 0x3060; 56547 t["dakatakana"] = 0x30c0;
56548 t["dalarabic"] = 0x062f; 56549 t["dalet"] = 0x05d3; 56550 t["daletdagesh"] = 0xfb33; 56551 t["daletdageshhebrew"] = 0xfb33; 56552 t["dalethebrew"] = 0x05d3; 56553 t["dalfinalarabic"] = 0xfeaa; 56554 t["dammaarabic"] = 0x064f; 56555 t["dammalowarabic"] = 0x064f; 56556 t["dammatanaltonearabic"] = 0x064c; 56557 t["dammatanarabic"] = 0x064c; 56558 t["danda"] = 0x0964; 56559 t["dargahebrew"] = 0x05a7; 56560 t["dargalefthebrew"] = 0x05a7; 56561 t["dasiapneumatacyrilliccmb"] = 0x0485; 56562 t["dblGrave"] = 0xf6d3; 56563 t["dblanglebracketleft"] = 0x300a; 56564 t["dblanglebracketleftvertical"] = 0xfe3d; 56565 t["dblanglebracketright"] = 0x300b; 56566 t["dblanglebracketrightvertical"] = 0xfe3e; 56567 t["dblarchinvertedbelowcmb"] = 0x032b; 56568 t["dblarrowleft"] = 0x21d4; 56569 t["dblarrowright"] = 0x21d2; 56570 t["dbldanda"] = 0x0965; 56571 t["dblgrave"] = 0xf6d6; 56572 t["dblgravecmb"] = 0x030f; 56573 t["dblintegral"] = 0x222c; 56574 t["dbllowline"] = 0x2017; 56575 t["dbllowlinecmb"] = 0x0333; 56576 t["dbloverlinecmb"] = 0x033f; 56577 t["dblprimemod"] = 0x02ba; 56578 t["dblverticalbar"] = 0x2016; 56579 t["dblverticallineabovecmb"] = 0x030e; 56580 t["dbopomofo"] = 0x3109; 56581 t["dbsquare"] = 0x33c8; 56582 t["dcaron"] = 0x010f; 56583 t["dcedilla"] = 0x1e11; 56584 t["dcircle"] = 0x24d3; 56585 t["dcircumflexbelow"] = 0x1e13; 56586 t["dcroat"] = 0x0111; 56587 t["ddabengali"] = 0x09a1; 56588 t["ddadeva"] = 0x0921; 56589 t["ddagujarati"] = 0x0aa1; 56590 t["ddagurmukhi"] = 0x0a21; 56591 t["ddalarabic"] = 0x0688; 56592 t["ddalfinalarabic"] = 0xfb89; 56593 t["dddhadeva"] = 0x095c; 56594 t["ddhabengali"] = 0x09a2; 56595 t["ddhadeva"] = 0x0922; 56596 t["ddhagujarati"] = 0x0aa2; 56597 t["ddhagurmukhi"] = 0x0a22; 56598 t["ddotaccent"] = 0x1e0b; 56599 t["ddotbelow"] = 0x1e0d; 56600 t["decimalseparatorarabic"] = 0x066b; 56601 t["decimalseparatorpersian"] = 0x066b; 56602 t["decyrillic"] = 0x0434; 56603 t["degree"] = 0x00b0; 56604 t["dehihebrew"] = 0x05ad; 56605 t["dehiragana"] = 0x3067; 56606 t["deicoptic"] = 0x03ef; 56607 t["dekatakana"] = 0x30c7; 56608 t["deleteleft"] = 0x232b; 56609 t["deleteright"] = 0x2326; 56610 t["delta"] = 0x03b4; 56611 t["deltaturned"] = 0x018d; 56612 t["denominatorminusonenumeratorbengali"] = 0x09f8; 56613 t["dezh"] = 0x02a4; 56614 t["dhabengali"] = 0x09a7; 56615 t["dhadeva"] = 0x0927; 56616 t["dhagujarati"] = 0x0aa7; 56617 t["dhagurmukhi"] = 0x0a27; 56618 t["dhook"] = 0x0257; 56619 t["dialytikatonos"] = 0x0385; 56620 t["dialytikatonoscmb"] = 0x0344; 56621 t["diamond"] = 0x2666; 56622 t["diamondsuitwhite"] = 0x2662; 56623 t["dieresis"] = 0x00a8; 56624 t["dieresisacute"] = 0xf6d7; 56625 t["dieresisbelowcmb"] = 0x0324; 56626 t["dieresiscmb"] = 0x0308; 56627 t["dieresisgrave"] = 0xf6d8; 56628 t["dieresistonos"] = 0x0385; 56629 t["dihiragana"] = 0x3062; 56630 t["dikatakana"] = 0x30c2; 56631 t["dittomark"] = 0x3003; 56632 t["divide"] = 0x00f7; 56633 t["divides"] = 0x2223; 56634 t["divisionslash"] = 0x2215; 56635 t["djecyrillic"] = 0x0452; 56636 t["dkshade"] = 0x2593; 56637 t["dlinebelow"] = 0x1e0f; 56638 t["dlsquare"] = 0x3397; 56639 t["dmacron"] = 0x0111; 56640 t["dmonospace"] = 0xff44; 56641 t["dnblock"] = 0x2584; 56642 t["dochadathai"] = 0x0e0e; 56643 t["dodekthai"] = 0x0e14; 56644 t["dohiragana"] = 0x3069; 56645 t["dokatakana"] = 0x30c9; 56646 t["dollar"] = 0x0024; 56647 t["dollarinferior"] = 0xf6e3; 56648 t["dollarmonospace"] = 0xff04; 56649 t["dollaroldstyle"] = 0xf724; 56650 t["dollarsmall"] = 0xfe69; 56651 t["dollarsuperior"] = 0xf6e4; 56652 t["dong"] = 0x20ab; 56653 t["dorusquare"] = 0x3326; 56654 t["dotaccent"] = 0x02d9; 56655 t["dotaccentcmb"] = 0x0307; 56656 t["dotbelowcmb"] = 0x0323; 56657 t["dotbelowcomb"] = 0x0323; 56658 t["dotkatakana"] = 0x30fb; 56659 t["dotlessi"] = 0x0131; 56660 t["dotlessj"] = 0xf6be; 56661 t["dotlessjstrokehook"] = 0x0284; 56662 t["dotmath"] = 0x22c5; 56663 t["dottedcircle"] = 0x25cc; 56664 t["doubleyodpatah"] = 0xfb1f; 56665 t["doubleyodpatahhebrew"] = 0xfb1f; 56666 t["downtackbelowcmb"] = 0x031e; 56667 t["downtackmod"] = 0x02d5; 56668 t["dparen"] = 0x249f; 56669 t["dsuperior"] = 0xf6eb; 56670 t["dtail"] = 0x0256; 56671 t["dtopbar"] = 0x018c; 56672 t["duhiragana"] = 0x3065; 56673 t["dukatakana"] = 0x30c5; 56674 t["dz"] = 0x01f3; 56675 t["dzaltone"] = 0x02a3; 56676 t["dzcaron"] = 0x01c6; 56677 t["dzcurl"] = 0x02a5; 56678 t["dzeabkhasiancyrillic"] = 0x04e1; 56679 t["dzecyrillic"] = 0x0455; 56680 t["dzhecyrillic"] = 0x045f; 56681 t["e"] = 0x0065; 56682 t["eacute"] = 0x00e9; 56683 t["earth"] = 0x2641; 56684 t["ebengali"] = 0x098f; 56685 t["ebopomofo"] = 0x311c; 56686 t["ebreve"] = 0x0115; 56687 t["ecandradeva"] = 0x090d; 56688 t["ecandragujarati"] = 0x0a8d; 56689 t["ecandravowelsigndeva"] = 0x0945; 56690 t["ecandravowelsigngujarati"] = 0x0ac5; 56691 t["ecaron"] = 0x011b; 56692 t["ecedillabreve"] = 0x1e1d; 56693 t["echarmenian"] = 0x0565; 56694 t["echyiwnarmenian"] = 0x0587; 56695 t["ecircle"] = 0x24d4; 56696 t["ecircumflex"] = 0x00ea; 56697 t["ecircumflexacute"] = 0x1ebf;
56698 t["ecircumflexbelow"] = 0x1e19; 56699 t["ecircumflexdotbelow"] = 0x1ec7; 56700 t["ecircumflexgrave"] = 0x1ec1; 56701 t["ecircumflexhookabove"] = 0x1ec3; 56702 t["ecircumflextilde"] = 0x1ec5; 56703 t["ecyrillic"] = 0x0454; 56704 t["edblgrave"] = 0x0205; 56705 t["edeva"] = 0x090f; 56706 t["edieresis"] = 0x00eb; 56707 t["edot"] = 0x0117; 56708 t["edotaccent"] = 0x0117; 56709 t["edotbelow"] = 0x1eb9; 56710 t["eegurmukhi"] = 0x0a0f; 56711 t["eematragurmukhi"] = 0x0a47; 56712 t["efcyrillic"] = 0x0444; 56713 t["egrave"] = 0x00e8; 56714 t["egujarati"] = 0x0a8f; 56715 t["eharmenian"] = 0x0567; 56716 t["ehbopomofo"] = 0x311d; 56717 t["ehiragana"] = 0x3048; 56718 t["ehookabove"] = 0x1ebb; 56719 t["eibopomofo"] = 0x311f; 56720 t["eight"] = 0x0038; 56721 t["eightarabic"] = 0x0668; 56722 t["eightbengali"] = 0x09ee; 56723 t["eightcircle"] = 0x2467; 56724 t["eightcircleinversesansserif"] = 0x2791; 56725 t["eightdeva"] = 0x096e; 56726 t["eighteencircle"] = 0x2471; 56727 t["eighteenparen"] = 0x2485; 56728 t["eighteenperiod"] = 0x2499; 56729 t["eightgujarati"] = 0x0aee; 56730 t["eightgurmukhi"] = 0x0a6e; 56731 t["eighthackarabic"] = 0x0668; 56732 t["eighthangzhou"] = 0x3028; 56733 t["eighthnotebeamed"] = 0x266b; 56734 t["eightideographicparen"] = 0x3227; 56735 t["eightinferior"] = 0x2088; 56736 t["eightmonospace"] = 0xff18; 56737 t["eightoldstyle"] = 0xf738; 56738 t["eightparen"] = 0x247b; 56739 t["eightperiod"] = 0x248f; 56740 t["eightpersian"] = 0x06f8; 56741 t["eightroman"] = 0x2177; 56742 t["eightsuperior"] = 0x2078; 56743 t["eightthai"] = 0x0e58; 56744 t["einvertedbreve"] = 0x0207; 56745 t["eiotifiedcyrillic"] = 0x0465; 56746 t["ekatakana"] = 0x30a8; 56747 t["ekatakanahalfwidth"] = 0xff74; 56748 t["ekonkargurmukhi"] = 0x0a74; 56749 t["ekorean"] = 0x3154; 56750 t["elcyrillic"] = 0x043b; 56751 t["element"] = 0x2208; 56752 t["elevencircle"] = 0x246a; 56753 t["elevenparen"] = 0x247e; 56754 t["elevenperiod"] = 0x2492; 56755 t["elevenroman"] = 0x217a; 56756 t["ellipsis"] = 0x2026; 56757 t["ellipsisvertical"] = 0x22ee; 56758 t["emacron"] = 0x0113; 56759 t["emacronacute"] = 0x1e17; 56760 t["emacrongrave"] = 0x1e15; 56761 t["emcyrillic"] = 0x043c; 56762 t["emdash"] = 0x2014; 56763 t["emdashvertical"] = 0xfe31; 56764 t["emonospace"] = 0xff45; 56765 t["emphasismarkarmenian"] = 0x055b; 56766 t["emptyset"] = 0x2205; 56767 t["enbopomofo"] = 0x3123; 56768 t["encyrillic"] = 0x043d; 56769 t["endash"] = 0x2013; 56770 t["endashvertical"] = 0xfe32; 56771 t["endescendercyrillic"] = 0x04a3; 56772 t["eng"] = 0x014b; 56773 t["engbopomofo"] = 0x3125; 56774 t["enghecyrillic"] = 0x04a5; 56775 t["enhookcyrillic"] = 0x04c8; 56776 t["enspace"] = 0x2002; 56777 t["eogonek"] = 0x0119; 56778 t["eokorean"] = 0x3153; 56779 t["eopen"] = 0x025b; 56780 t["eopenclosed"] = 0x029a; 56781 t["eopenreversed"] = 0x025c; 56782 t["eopenreversedclosed"] = 0x025e; 56783 t["eopenreversedhook"] = 0x025d; 56784 t["eparen"] = 0x24a0; 56785 t["epsilon"] = 0x03b5; 56786 t["epsilontonos"] = 0x03ad; 56787 t["equal"] = 0x003d; 56788 t["equalmonospace"] = 0xff1d; 56789 t["equalsmall"] = 0xfe66; 56790 t["equalsuperior"] = 0x207c; 56791 t["equivalence"] = 0x2261; 56792 t["erbopomofo"] = 0x3126; 56793 t["ercyrillic"] = 0x0440; 56794 t["ereversed"] = 0x0258; 56795 t["ereversedcyrillic"] = 0x044d; 56796 t["escyrillic"] = 0x0441; 56797 t["esdescendercyrillic"] = 0x04ab; 56798 t["esh"] = 0x0283; 56799 t["eshcurl"] = 0x0286; 56800 t["eshortdeva"] = 0x090e; 56801 t["eshortvowelsigndeva"] = 0x0946; 56802 t["eshreversedloop"] = 0x01aa; 56803 t["eshsquatreversed"] = 0x0285; 56804 t["esmallhiragana"] = 0x3047; 56805 t["esmallkatakana"] = 0x30a7; 56806 t["esmallkatakanahalfwidth"] = 0xff6a; 56807 t["estimated"] = 0x212e; 56808 t["esuperior"] = 0xf6ec; 56809 t["eta"] = 0x03b7; 56810 t["etarmenian"] = 0x0568; 56811 t["etatonos"] = 0x03ae; 56812 t["eth"] = 0x00f0; 56813 t["etilde"] = 0x1ebd; 56814 t["etildebelow"] = 0x1e1b; 56815 t["etnahtafoukhhebrew"] = 0x0591; 56816 t["etnahtafoukhlefthebrew"] = 0x0591; 56817 t["etnahtahebrew"] = 0x0591; 56818 t["etnahtalefthebrew"] = 0x0591; 56819 t["eturned"] = 0x01dd; 56820 t["eukorean"] = 0x3161; 56821 t["euro"] = 0x20ac; 56822 t["evowelsignbengali"] = 0x09c7; 56823 t["evowelsigndeva"] = 0x0947; 56824 t["evowelsigngujarati"] = 0x0ac7; 56825 t["exclam"] = 0x0021; 56826 t["exclamarmenian"] = 0x055c; 56827 t["exclamdbl"] = 0x203c; 56828 t["exclamdown"] = 0x00a1; 56829 t["exclamdownsmall"] = 0xf7a1; 56830 t["exclammonospace"] = 0xff01; 56831 t["exclamsmall"] = 0xf721; 56832 t["existential"] = 0x2203; 56833 t["ezh"] = 0x0292; 56834 t["ezhcaron"] = 0x01ef; 56835 t["ezhcurl"] = 0x0293; 56836 t["ezhreversed"] = 0x01b9; 56837 t["ezhtail"] = 0x01ba; 56838 t["f"] = 0x0066; 56839 t["fadeva"] = 0x095e; 56840 t["fagurmukhi"] = 0x0a5e; 56841 t["fahrenheit"] = 0x2109;
56842 t["fathaarabic"] = 0x064e; 56843 t["fathalowarabic"] = 0x064e; 56844 t["fathatanarabic"] = 0x064b; 56845 t["fbopomofo"] = 0x3108; 56846 t["fcircle"] = 0x24d5; 56847 t["fdotaccent"] = 0x1e1f; 56848 t["feharabic"] = 0x0641; 56849 t["feharmenian"] = 0x0586; 56850 t["fehfinalarabic"] = 0xfed2; 56851 t["fehinitialarabic"] = 0xfed3; 56852 t["fehmedialarabic"] = 0xfed4; 56853 t["feicoptic"] = 0x03e5; 56854 t["female"] = 0x2640; 56855 t["ff"] = 0xfb00; 56856 t["f_f"] = 0xfb00; 56857 t["ffi"] = 0xfb03; 56858 t["ffl"] = 0xfb04; 56859 t["fi"] = 0xfb01; 56860 t["fifteencircle"] = 0x246e; 56861 t["fifteenparen"] = 0x2482; 56862 t["fifteenperiod"] = 0x2496; 56863 t["figuredash"] = 0x2012; 56864 t["filledbox"] = 0x25a0; 56865 t["filledrect"] = 0x25ac; 56866 t["finalkaf"] = 0x05da; 56867 t["finalkafdagesh"] = 0xfb3a; 56868 t["finalkafdageshhebrew"] = 0xfb3a; 56869 t["finalkafhebrew"] = 0x05da; 56870 t["finalmem"] = 0x05dd; 56871 t["finalmemhebrew"] = 0x05dd; 56872 t["finalnun"] = 0x05df; 56873 t["finalnunhebrew"] = 0x05df; 56874 t["finalpe"] = 0x05e3; 56875 t["finalpehebrew"] = 0x05e3; 56876 t["finaltsadi"] = 0x05e5; 56877 t["finaltsadihebrew"] = 0x05e5; 56878 t["firsttonechinese"] = 0x02c9; 56879 t["fisheye"] = 0x25c9; 56880 t["fitacyrillic"] = 0x0473; 56881 t["five"] = 0x0035; 56882 t["fivearabic"] = 0x0665; 56883 t["fivebengali"] = 0x09eb; 56884 t["fivecircle"] = 0x2464; 56885 t["fivecircleinversesansserif"] = 0x278e; 56886 t["fivedeva"] = 0x096b; 56887 t["fiveeighths"] = 0x215d; 56888 t["fivegujarati"] = 0x0aeb; 56889 t["fivegurmukhi"] = 0x0a6b; 56890 t["fivehackarabic"] = 0x0665; 56891 t["fivehangzhou"] = 0x3025; 56892 t["fiveideographicparen"] = 0x3224; 56893 t["fiveinferior"] = 0x2085; 56894 t["fivemonospace"] = 0xff15; 56895 t["fiveoldstyle"] = 0xf735; 56896 t["fiveparen"] = 0x2478; 56897 t["fiveperiod"] = 0x248c; 56898 t["fivepersian"] = 0x06f5; 56899 t["fiveroman"] = 0x2174; 56900 t["fivesuperior"] = 0x2075; 56901 t["fivethai"] = 0x0e55; 56902 t["fl"] = 0xfb02; 56903 t["florin"] = 0x0192; 56904 t["fmonospace"] = 0xff46; 56905 t["fmsquare"] = 0x3399; 56906 t["fofanthai"] = 0x0e1f; 56907 t["fofathai"] = 0x0e1d; 56908 t["fongmanthai"] = 0x0e4f; 56909 t["forall"] = 0x2200; 56910 t["four"] = 0x0034; 56911 t["fourarabic"] = 0x0664; 56912 t["fourbengali"] = 0x09ea; 56913 t["fourcircle"] = 0x2463; 56914 t["fourcircleinversesansserif"] = 0x278d; 56915 t["fourdeva"] = 0x096a; 56916 t["fourgujarati"] = 0x0aea; 56917 t["fourgurmukhi"] = 0x0a6a; 56918 t["fourhackarabic"] = 0x0664; 56919 t["fourhangzhou"] = 0x3024; 56920 t["fourideographicparen"] = 0x3223; 56921 t["fourinferior"] = 0x2084; 56922 t["fourmonospace"] = 0xff14; 56923 t["fournumeratorbengali"] = 0x09f7; 56924 t["fouroldstyle"] = 0xf734; 56925 t["fourparen"] = 0x2477; 56926 t["fourperiod"] = 0x248b; 56927 t["fourpersian"] = 0x06f4; 56928 t["fourroman"] = 0x2173; 56929 t["foursuperior"] = 0x2074; 56930 t["fourteencircle"] = 0x246d; 56931 t["fourteenparen"] = 0x2481; 56932 t["fourteenperiod"] = 0x2495; 56933 t["fourthai"] = 0x0e54; 56934 t["fourthtonechinese"] = 0x02cb; 56935 t["fparen"] = 0x24a1; 56936 t["fraction"] = 0x2044; 56937 t["franc"] = 0x20a3; 56938 t["g"] = 0x0067; 56939 t["gabengali"] = 0x0997; 56940 t["gacute"] = 0x01f5; 56941 t["gadeva"] = 0x0917; 56942 t["gafarabic"] = 0x06af; 56943 t["gaffinalarabic"] = 0xfb93; 56944 t["gafinitialarabic"] = 0xfb94; 56945 t["gafmedialarabic"] = 0xfb95; 56946 t["gagujarati"] = 0x0a97; 56947 t["gagurmukhi"] = 0x0a17; 56948 t["gahiragana"] = 0x304c; 56949 t["gakatakana"] = 0x30ac; 56950 t["gamma"] = 0x03b3; 56951 t["gammalatinsmall"] = 0x0263; 56952 t["gammasuperior"] = 0x02e0; 56953 t["gangiacoptic"] = 0x03eb; 56954 t["gbopomofo"] = 0x310d; 56955 t["gbreve"] = 0x011f; 56956 t["gcaron"] = 0x01e7; 56957 t["gcedilla"] = 0x0123; 56958 t["gcircle"] = 0x24d6; 56959 t["gcircumflex"] = 0x011d; 56960 t["gcommaaccent"] = 0x0123; 56961 t["gdot"] = 0x0121; 56962 t["gdotaccent"] = 0x0121; 56963 t["gecyrillic"] = 0x0433; 56964 t["gehiragana"] = 0x3052; 56965 t["gekatakana"] = 0x30b2; 56966 t["geometricallyequal"] = 0x2251; 56967 t["gereshaccenthebrew"] = 0x059c; 56968 t["gereshhebrew"] = 0x05f3; 56969 t["gereshmuqdamhebrew"] = 0x059d; 56970 t["germandbls"] = 0x00df; 56971 t["gershayimaccenthebrew"] = 0x059e; 56972 t["gershayimhebrew"] = 0x05f4; 56973 t["getamark"] = 0x3013; 56974 t["ghabengali"] = 0x0998; 56975 t["ghadarmenian"] = 0x0572; 56976 t["ghadeva"] = 0x0918; 56977 t["ghagujarati"] = 0x0a98; 56978 t["ghagurmukhi"] = 0x0a18; 56979 t["ghainarabic"] = 0x063a; 56980 t["ghainfinalarabic"] = 0xfece; 56981 t["ghaininitialarabic"] = 0xfecf; 56982 t["ghainmedialarabic"] = 0xfed0; 56983 t["ghemiddlehookcyrillic"] = 0x0495; 56984 t["ghestrokecyrillic"] = 0x0493; 56985 t["gheupturncyrillic"] = 0x0491; 56986 t["ghhadeva"] = 0x095a; 56987 t["ghhagurmukhi"] = 0x0a5a; 56988 t["ghook"] = 0x0260; 56989 t["ghzsquare"] = 0x3393; 56990 t["gihiragana"] = 0x304e; 56991 t["gikatakana"] = 0x30ae; 56992 t["gimarmenian"] = 0x0563; 56993 t["gimel"] = 0x05d2; 56994 t["gimeldagesh"] = 0xfb32; 56995 t["gimeldageshhebrew"] = 0xfb32; 56996 t["gimelhebrew"] = 0x05d2; 56997 t["gjecyrillic"] = 0x0453; 56998 t["glottalinvertedstroke"] = 0x01be; 56999 t["glottalstop"] = 0x0294; 57000 t["glottalstopinverted"] = 0x0296; 57001 t["glottalstopmod"] = 0x02c0;
57002 t["glottalstopreversed"] = 0x0295; 57003 t["glottalstopreversedmod"] = 0x02c1; 57004 t["glottalstopreversedsuperior"] = 0x02e4; 57005 t["glottalstopstroke"] = 0x02a1; 57006 t["glottalstopstrokereversed"] = 0x02a2; 57007 t["gmacron"] = 0x1e21; 57008 t["gmonospace"] = 0xff47; 57009 t["gohiragana"] = 0x3054; 57010 t["gokatakana"] = 0x30b4; 57011 t["gparen"] = 0x24a2; 57012 t["gpasquare"] = 0x33ac; 57013 t["gradient"] = 0x2207; 57014 t["grave"] = 0x0060; 57015 t["gravebelowcmb"] = 0x0316; 57016 t["gravecmb"] = 0x0300; 57017 t["gravecomb"] = 0x0300; 57018 t["gravedeva"] = 0x0953; 57019 t["gravelowmod"] = 0x02ce; 57020 t["gravemonospace"] = 0xff40; 57021 t["gravetonecmb"] = 0x0340; 57022 t["greater"] = 0x003e; 57023 t["greaterequal"] = 0x2265; 57024 t["greaterequalorless"] = 0x22db; 57025 t["greatermonospace"] = 0xff1e; 57026 t["greaterorequivalent"] = 0x2273; 57027 t["greaterorless"] = 0x2277; 57028 t["greateroverequal"] = 0x2267; 57029 t["greatersmall"] = 0xfe65; 57030 t["gscript"] = 0x0261; 57031 t["gstroke"] = 0x01e5; 57032 t["guhiragana"] = 0x3050; 57033 t["guillemotleft"] = 0x00ab; 57034 t["guillemotright"] = 0x00bb; 57035 t["guilsinglleft"] = 0x2039; 57036 t["guilsinglright"] = 0x203a; 57037 t["gukatakana"] = 0x30b0; 57038 t["guramusquare"] = 0x3318; 57039 t["gysquare"] = 0x33c9; 57040 t["h"] = 0x0068; 57041 t["haabkhasiancyrillic"] = 0x04a9; 57042 t["haaltonearabic"] = 0x06c1; 57043 t["habengali"] = 0x09b9; 57044 t["hadescendercyrillic"] = 0x04b3; 57045 t["hadeva"] = 0x0939; 57046 t["hagujarati"] = 0x0ab9; 57047 t["hagurmukhi"] = 0x0a39;
57048 t["haharabic"] = 0x062d; 57049 t["hahfinalarabic"] = 0xfea2; 57050 t["hahinitialarabic"] = 0xfea3; 57051 t["hahiragana"] = 0x306f; 57052 t["hahmedialarabic"] = 0xfea4; 57053 t["haitusquare"] = 0x332a; 57054 t["hakatakana"] = 0x30cf; 57055 t["hakatakanahalfwidth"] = 0xff8a; 57056 t["halantgurmukhi"] = 0x0a4d; 57057 t["hamzaarabic"] = 0x0621; 57058 t["hamzalowarabic"] = 0x0621; 57059 t["hangulfiller"] = 0x3164; 57060 t["hardsigncyrillic"] = 0x044a; 57061 t["harpoonleftbarbup"] = 0x21bc; 57062 t["harpoonrightbarbup"] = 0x21c0; 57063 t["hasquare"] = 0x33ca; 57064 t["hatafpatah"] = 0x05b2; 57065 t["hatafpatah16"] = 0x05b2; 57066 t["hatafpatah23"] = 0x05b2; 57067 t["hatafpatah2f"] = 0x05b2; 57068 t["hatafpatahhebrew"] = 0x05b2; 57069 t["hatafpatahnarrowhebrew"] = 0x05b2; 57070 t["hatafpatahquarterhebrew"] = 0x05b2; 57071 t["hatafpatahwidehebrew"] = 0x05b2; 57072 t["hatafqamats"] = 0x05b3; 57073 t["hatafqamats1b"] = 0x05b3; 57074 t["hatafqamats28"] = 0x05b3; 57075 t["hatafqamats34"] = 0x05b3; 57076 t["hatafqamatshebrew"] = 0x05b3; 57077 t["hatafqamatsnarrowhebrew"] = 0x05b3; 57078 t["hatafqamatsquarterhebrew"] = 0x05b3; 57079 t["hatafqamatswidehebrew"] = 0x05b3; 57080 t["hatafsegol"] = 0x05b1; 57081 t["hatafsegol17"] = 0x05b1; 57082 t["hatafsegol24"] = 0x05b1; 57083 t["hatafsegol30"] = 0x05b1; 57084 t["hatafsegolhebrew"] = 0x05b1; 57085 t["hatafsegolnarrowhebrew"] = 0x05b1; 57086 t["hatafsegolquarterhebrew"] = 0x05b1; 57087 t["hatafsegolwidehebrew"] = 0x05b1; 57088 t["hbar"] = 0x0127; 57089 t["hbopomofo"] = 0x310f; 57090 t["hbrevebelow"] = 0x1e2b; 57091 t["hcedilla"] = 0x1e29; 57092 t["hcircle"] = 0x24d7; 57093 t["hcircumflex"] = 0x0125; 57094 t["hdieresis"] = 0x1e27; 57095 t["hdotaccent"] = 0x1e23; 57096 t["hdotbelow"] = 0x1e25; 57097 t["he"] = 0x05d4; 57098 t["heart"] = 0x2665; 57099 t["heartsuitblack"] = 0x2665; 57100 t["heartsuitwhite"] = 0x2661; 57101 t["hedagesh"] = 0xfb34; 57102 t["hedageshhebrew"] = 0xfb34; 57103 t["hehaltonearabic"] = 0x06c1; 57104 t["heharabic"] = 0x0647; 57105 t["hehebrew"] = 0x05d4; 57106 t["hehfinalaltonearabic"] = 0xfba7; 57107 t["hehfinalalttwoarabic"] = 0xfeea; 57108 t["hehfinalarabic"] = 0xfeea; 57109 t["hehhamzaabovefinalarabic"] = 0xfba5; 57110 t["hehhamzaaboveisolatedarabic"] = 0xfba4; 57111 t["hehinitialaltonearabic"] = 0xfba8; 57112 t["hehinitialarabic"] = 0xfeeb; 57113 t["hehiragana"] = 0x3078; 57114 t["hehmedialaltonearabic"] = 0xfba9; 57115 t["hehmedialarabic"] = 0xfeec; 57116 t["heiseierasquare"] = 0x337b; 57117 t["hekatakana"] = 0x30d8; 57118 t["hekatakanahalfwidth"] = 0xff8d; 57119 t["hekutaarusquare"] = 0x3336; 57120 t["henghook"] = 0x0267; 57121 t["herutusquare"] = 0x3339; 57122 t["het"] = 0x05d7; 57123 t["hethebrew"] = 0x05d7; 57124 t["hhook"] = 0x0266; 57125 t["hhooksuperior"] = 0x02b1; 57126 t["hieuhacirclekorean"] = 0x327b; 57127 t["hieuhaparenkorean"] = 0x321b; 57128 t["hieuhcirclekorean"] = 0x326d; 57129 t["hieuhkorean"] = 0x314e; 57130 t["hieuhparenkorean"] = 0x320d; 57131 t["hihiragana"] = 0x3072; 57132 t["hikatakana"] = 0x30d2; 57133 t["hikatakanahalfwidth"] = 0xff8b; 57134 t["hiriq"] = 0x05b4; 57135 t["hiriq14"] = 0x05b4; 57136 t["hiriq21"] = 0x05b4; 57137 t["hiriq2d"] = 0x05b4; 57138 t["hiriqhebrew"] = 0x05b4; 57139 t["hiriqnarrowhebrew"] = 0x05b4; 57140 t["hiriqquarterhebrew"] = 0x05b4; 57141 t["hiriqwidehebrew"] = 0x05b4; 57142 t["hlinebelow"] = 0x1e96; 57143 t["hmonospace"] = 0xff48; 57144 t["hoarmenian"] = 0x0570; 57145 t["hohipthai"] = 0x0e2b; 57146 t["hohiragana"] = 0x307b; 57147 t["hokatakana"] = 0x30db; 57148 t["hokatakanahalfwidth"] = 0xff8e; 57149 t["holam"] = 0x05b9; 57150 t["holam19"] = 0x05b9; 57151 t["holam26"] = 0x05b9; 57152 t["holam32"] = 0x05b9; 57153 t["holamhebrew"] = 0x05b9; 57154 t["holamnarrowhebrew"] = 0x05b9; 57155 t["holamquarterhebrew"] = 0x05b9; 57156 t["holamwidehebrew"] = 0x05b9; 57157 t["honokhukthai"] = 0x0e2e; 57158 t["hookabovecomb"] = 0x0309; 57159 t["hookcmb"] = 0x0309; 57160 t["hookpalatalizedbelowcmb"] = 0x0321; 57161 t["hookretroflexbelowcmb"] = 0x0322; 57162 t["hoonsquare"] = 0x3342; 57163 t["horicoptic"] = 0x03e9; 57164 t["horizontalbar"] = 0x2015; 57165 t["horncmb"] = 0x031b; 57166 t["hotsprings"] = 0x2668; 57167 t["house"] = 0x2302; 57168 t["hparen"] = 0x24a3; 57169 t["hsuperior"] = 0x02b0; 57170 t["hturned"] = 0x0265; 57171 t["huhiragana"] = 0x3075; 57172 t["huiitosquare"] = 0x3333; 57173 t["hukatakana"] = 0x30d5; 57174 t["hukatakanahalfwidth"] = 0xff8c; 57175 t["hungarumlaut"] = 0x02dd; 57176 t["hungarumlautcmb"] = 0x030b; 57177 t["hv"] = 0x0195; 57178 t["hyphen"] = 0x002d; 57179 t["hypheninferior"] = 0xf6e5; 57180 t["hyphenmonospace"] = 0xff0d; 57181 t["hyphensmall"] = 0xfe63; 57182 t["hyphensuperior"] = 0xf6e6; 57183 t["hyphentwo"] = 0x2010; 57184 t["i"] = 0x0069; 57185 t["iacute"] = 0x00ed; 57186 t["iacyrillic"] = 0x044f; 57187 t["ibengali"] = 0x0987; 57188 t["ibopomofo"] = 0x3127; 57189 t["ibreve"] = 0x012d; 57190 t["icaron"] = 0x01d0; 57191 t["icircle"] = 0x24d8; 57192 t["icircumflex"] = 0x00ee; 57193 t["icyrillic"] = 0x0456; 57194 t["idblgrave"] = 0x0209; 57195 t["ideographearthcircle"] = 0x328f; 57196 t["ideographfirecircle"] = 0x328b; 57197 t["ideographicallianceparen"] = 0x323f; 57198 t["ideographiccallparen"] = 0x323a; 57199 t["ideographiccentrecircle"] = 0x32a5; 57200 t["ideographicclose"] = 0x3006; 57201 t["ideographiccomma"] = 0x3001; 57202 t["ideographiccommaleft"] = 0xff64; 57203 t["ideographiccongratulationparen"] = 0x3237; 57204 t["ideographiccorrectcircle"] = 0x32a3; 57205 t["ideographicearthparen"] = 0x322f; 57206 t["ideographicenterpriseparen"] = 0x323d; 57207 t["ideographicexcellentcircle"] = 0x329d; 57208 t["ideographicfestivalparen"] = 0x3240; 57209 t["ideographicfinancialcircle"] = 0x3296; 57210 t["ideographicfinancialparen"] = 0x3236; 57211 t["ideographicfireparen"] = 0x322b; 57212 t["ideographichaveparen"] = 0x3232; 57213 t["ideographichighcircle"] = 0x32a4; 57214 t["ideographiciterationmark"] = 0x3005; 57215 t["ideographiclaborcircle"] = 0x3298; 57216 t["ideographiclaborparen"] = 0x3238; 57217 t["ideographicleftcircle"] = 0x32a7; 57218 t["ideographiclowcircle"] = 0x32a6; 57219 t["ideographicmedicinecircle"] = 0x32a9; 57220 t["ideographicmetalparen"] = 0x322e; 57221 t["ideographicmoonparen"] = 0x322a; 57222 t["ideographicnameparen"] = 0x3234; 57223 t["ideographicperiod"] = 0x3002; 57224 t["ideographicprintcircle"] = 0x329e; 57225 t["ideographicreachparen"] = 0x3243; 57226 t["ideographicrepresentparen"] = 0x3239; 57227 t["ideographicresourceparen"] = 0x323e; 57228 t["ideographicrightcircle"] = 0x32a8;
57229 t["ideographicsecretcircle"] = 0x3299; 57230 t["ideographicselfparen"] = 0x3242; 57231 t["ideographicsocietyparen"] = 0x3233; 57232 t["ideographicspace"] = 0x3000; 57233 t["ideographicspecialparen"] = 0x3235; 57234 t["ideographicstockparen"] = 0x3231; 57235 t["ideographicstudyparen"] = 0x323b; 57236 t["ideographicsunparen"] = 0x3230; 57237 t["ideographicsuperviseparen"] = 0x323c; 57238 t["ideographicwaterparen"] = 0x322c; 57239 t["ideographicwoodparen"] = 0x322d; 57240 t["ideographiczero"] = 0x3007; 57241 t["ideographmetalcircle"] = 0x328e; 57242 t["ideographmooncircle"] = 0x328a; 57243 t["ideographnamecircle"] = 0x3294; 57244 t["ideographsuncircle"] = 0x3290; 57245 t["ideographwatercircle"] = 0x328c; 57246 t["ideographwoodcircle"] = 0x328d; 57247 t["ideva"] = 0x0907; 57248 t["idieresis"] = 0x00ef; 57249 t["idieresisacute"] = 0x1e2f; 57250 t["idieresiscyrillic"] = 0x04e5; 57251 t["idotbelow"] = 0x1ecb; 57252 t["iebrevecyrillic"] = 0x04d7; 57253 t["iecyrillic"] = 0x0435; 57254 t["ieungacirclekorean"] = 0x3275; 57255 t["ieungaparenkorean"] = 0x3215; 57256 t["ieungcirclekorean"] = 0x3267; 57257 t["ieungkorean"] = 0x3147; 57258 t["ieungparenkorean"] = 0x3207; 57259 t["igrave"] = 0x00ec; 57260 t["igujarati"] = 0x0a87; 57261 t["igurmukhi"] = 0x0a07; 57262 t["ihiragana"] = 0x3044; 57263 t["ihookabove"] = 0x1ec9; 57264 t["iibengali"] = 0x0988; 57265 t["iicyrillic"] = 0x0438; 57266 t["iideva"] = 0x0908; 57267 t["iigujarati"] = 0x0a88; 57268 t["iigurmukhi"] = 0x0a08; 57269 t["iimatragurmukhi"] = 0x0a40; 57270 t["iinvertedbreve"] = 0x020b; 57271 t["iishortcyrillic"] = 0x0439; 57272 t["iivowelsignbengali"] = 0x09c0; 57273 t["iivowelsigndeva"] = 0x0940; 57274 t["iivowelsigngujarati"] = 0x0ac0; 57275 t["ij"] = 0x0133; 57276 t["ikatakana"] = 0x30a4; 57277 t["ikatakanahalfwidth"] = 0xff72; 57278 t["ikorean"] = 0x3163; 57279 t["ilde"] = 0x02dc; 57280 t["iluyhebrew"] = 0x05ac; 57281 t["imacron"] = 0x012b; 57282 t["imacroncyrillic"] = 0x04e3; 57283 t["imageorapproximatelyequal"] = 0x2253; 57284 t["imatragurmukhi"] = 0x0a3f; 57285 t["imonospace"] = 0xff49; 57286 t["increment"] = 0x2206; 57287 t["infinity"] = 0x221e; 57288 t["iniarmenian"] = 0x056b; 57289 t["integral"] = 0x222b; 57290 t["integralbottom"] = 0x2321; 57291 t["integralbt"] = 0x2321; 57292 t["integralex"] = 0xf8f5; 57293 t["integraltop"] = 0x2320; 57294 t["integraltp"] = 0x2320; 57295 t["intersection"] = 0x2229; 57296 t["intisquare"] = 0x3305; 57297 t["invbullet"] = 0x25d8; 57298 t["invcircle"] = 0x25d9; 57299 t["invsmileface"] = 0x263b; 57300 t["iocyrillic"] = 0x0451; 57301 t["iogonek"] = 0x012f; 57302 t["iota"] = 0x03b9; 57303 t["iotadieresis"] = 0x03ca; 57304 t["iotadieresistonos"] = 0x0390; 57305 t["iotalatin"] = 0x0269; 57306 t["iotatonos"] = 0x03af; 57307 t["iparen"] = 0x24a4; 57308 t["irigurmukhi"] = 0x0a72; 57309 t["ismallhiragana"] = 0x3043; 57310 t["ismallkatakana"] = 0x30a3; 57311 t["ismallkatakanahalfwidth"] = 0xff68; 57312 t["issharbengali"] = 0x09fa; 57313 t["istroke"] = 0x0268; 57314 t["isuperior"] = 0xf6ed; 57315 t["iterationhiragana"] = 0x309d; 57316 t["iterationkatakana"] = 0x30fd; 57317 t["itilde"] = 0x0129; 57318 t["itildebelow"] = 0x1e2d; 57319 t["iubopomofo"] = 0x3129; 57320 t["iucyrillic"] = 0x044e; 57321 t["ivowelsignbengali"] = 0x09bf; 57322 t["ivowelsigndeva"] = 0x093f; 57323 t["ivowelsigngujarati"] = 0x0abf; 57324 t["izhitsacyrillic"] = 0x0475; 57325 t["izhitsadblgravecyrillic"] = 0x0477; 57326 t["j"] = 0x006a; 57327 t["jaarmenian"] = 0x0571; 57328 t["jabengali"] = 0x099c; 57329 t["jadeva"] = 0x091c; 57330 t["jagujarati"] = 0x0a9c; 57331 t["jagurmukhi"] = 0x0a1c; 57332 t["jbopomofo"] = 0x3110; 57333 t["jcaron"] = 0x01f0; 57334 t["jcircle"] = 0x24d9; 57335 t["jcircumflex"] = 0x0135; 57336 t["jcrossedtail"] = 0x029d; 57337 t["jdotlessstroke"] = 0x025f; 57338 t["jecyrillic"] = 0x0458; 57339 t["jeemarabic"] = 0x062c; 57340 t["jeemfinalarabic"] = 0xfe9e; 57341 t["jeeminitialarabic"] = 0xfe9f; 57342 t["jeemmedialarabic"] = 0xfea0; 57343 t["jeharabic"] = 0x0698; 57344 t["jehfinalarabic"] = 0xfb8b; 57345 t["jhabengali"] = 0x099d; 57346 t["jhadeva"] = 0x091d; 57347 t["jhagujarati"] = 0x0a9d; 57348 t["jhagurmukhi"] = 0x0a1d; 57349 t["jheharmenian"] = 0x057b; 57350 t["jis"] = 0x3004; 57351 t["jmonospace"] = 0xff4a; 57352 t["jparen"] = 0x24a5; 57353 t["jsuperior"] = 0x02b2; 57354 t["k"] = 0x006b; 57355 t["kabashkircyrillic"] = 0x04a1; 57356 t["kabengali"] = 0x0995; 57357 t["kacute"] = 0x1e31; 57358 t["kacyrillic"] = 0x043a; 57359 t["kadescendercyrillic"] = 0x049b; 57360 t["kadeva"] = 0x0915; 57361 t["kaf"] = 0x05db; 57362 t["kafarabic"] = 0x0643; 57363 t["kafdagesh"] = 0xfb3b; 57364 t["kafdageshhebrew"] = 0xfb3b; 57365 t["kaffinalarabic"] = 0xfeda; 57366 t["kafhebrew"] = 0x05db; 57367 t["kafinitialarabic"] = 0xfedb; 57368 t["kafmedialarabic"] = 0xfedc; 57369 t["kafrafehebrew"] = 0xfb4d; 57370 t["kagujarati"] = 0x0a95; 57371 t["kagurmukhi"] = 0x0a15; 57372 t["kahiragana"] = 0x304b; 57373 t["kahookcyrillic"] = 0x04c4; 57374 t["kakatakana"] = 0x30ab;
57375 t["kakatakanahalfwidth"] = 0xff76; 57376 t["kappa"] = 0x03ba; 57377 t["kappasymbolgreek"] = 0x03f0; 57378 t["kapyeounmieumkorean"] = 0x3171; 57379 t["kapyeounphieuphkorean"] = 0x3184; 57380 t["kapyeounpieupkorean"] = 0x3178; 57381 t["kapyeounssangpieupkorean"] = 0x3179; 57382 t["karoriisquare"] = 0x330d; 57383 t["kashidaautoarabic"] = 0x0640; 57384 t["kashidaautonosidebearingarabic"] = 0x0640; 57385 t["kasmallkatakana"] = 0x30f5; 57386 t["kasquare"] = 0x3384; 57387 t["kasraarabic"] = 0x0650; 57388 t["kasratanarabic"] = 0x064d; 57389 t["kastrokecyrillic"] = 0x049f; 57390 t["katahiraprolongmarkhalfwidth"] = 0xff70; 57391 t["kaverticalstrokecyrillic"] = 0x049d; 57392 t["kbopomofo"] = 0x310e; 57393 t["kcalsquare"] = 0x3389; 57394 t["kcaron"] = 0x01e9; 57395 t["kcedilla"] = 0x0137; 57396 t["kcircle"] = 0x24da; 57397 t["kcommaaccent"] = 0x0137; 57398 t["kdotbelow"] = 0x1e33; 57399 t["keharmenian"] = 0x0584; 57400 t["kehiragana"] = 0x3051; 57401 t["kekatakana"] = 0x30b1; 57402 t["kekatakanahalfwidth"] = 0xff79; 57403 t["kenarmenian"] = 0x056f; 57404 t["kesmallkatakana"] = 0x30f6; 57405 t["kgreenlandic"] = 0x0138; 57406 t["khabengali"] = 0x0996; 57407 t["khacyrillic"] = 0x0445; 57408 t["khadeva"] = 0x0916; 57409 t["khagujarati"] = 0x0a96; 57410 t["khagurmukhi"] = 0x0a16; 57411 t["khaharabic"] = 0x062e; 57412 t["khahfinalarabic"] = 0xfea6; 57413 t["khahinitialarabic"] = 0xfea7; 57414 t["khahmedialarabic"] = 0xfea8; 57415 t["kheicoptic"] = 0x03e7; 57416 t["khhadeva"] = 0x0959; 57417 t["khhagurmukhi"] = 0x0a59; 57418 t["khieukhacirclekorean"] = 0x3278; 57419 t["khieukhaparenkorean"] = 0x3218; 57420 t["khieukhcirclekorean"] = 0x326a; 57421 t["khieukhkorean"] = 0x314b; 57422 t["khieukhparenkorean"] = 0x320a; 57423 t["khokhaithai"] = 0x0e02; 57424 t["khokhonthai"] = 0x0e05; 57425 t["khokhuatthai"] = 0x0e03; 57426 t["khokhwaithai"] = 0x0e04; 57427 t["khomutthai"] = 0x0e5b;
57428 t["khook"] = 0x0199; 57429 t["khorakhangthai"] = 0x0e06; 57430 t["khzsquare"] = 0x3391; 57431 t["kihiragana"] = 0x304d; 57432 t["kikatakana"] = 0x30ad; 57433 t["kikatakanahalfwidth"] = 0xff77; 57434 t["kiroguramusquare"] = 0x3315; 57435 t["kiromeetorusquare"] = 0x3316; 57436 t["kirosquare"] = 0x3314; 57437 t["kiyeokacirclekorean"] = 0x326e; 57438 t["kiyeokaparenkorean"] = 0x320e; 57439 t["kiyeokcirclekorean"] = 0x3260; 57440 t["kiyeokkorean"] = 0x3131; 57441 t["kiyeokparenkorean"] = 0x3200; 57442 t["kiyeoksioskorean"] = 0x3133; 57443 t["kjecyrillic"] = 0x045c; 57444 t["klinebelow"] = 0x1e35; 57445 t["klsquare"] = 0x3398; 57446 t["kmcubedsquare"] = 0x33a6; 57447 t["kmonospace"] = 0xff4b; 57448 t["kmsquaredsquare"] = 0x33a2; 57449 t["kohiragana"] = 0x3053; 57450 t["kohmsquare"] = 0x33c0; 57451 t["kokaithai"] = 0x0e01; 57452 t["kokatakana"] = 0x30b3; 57453 t["kokatakanahalfwidth"] = 0xff7a; 57454 t["kooposquare"] = 0x331e; 57455 t["koppacyrillic"] = 0x0481; 57456 t["koreanstandardsymbol"] = 0x327f; 57457 t["koroniscmb"] = 0x0343; 57458 t["kparen"] = 0x24a6; 57459 t["kpasquare"] = 0x33aa; 57460 t["ksicyrillic"] = 0x046f; 57461 t["ktsquare"] = 0x33cf; 57462 t["kturned"] = 0x029e; 57463 t["kuhiragana"] = 0x304f; 57464 t["kukatakana"] = 0x30af; 57465 t["kukatakanahalfwidth"] = 0xff78; 57466 t["kvsquare"] = 0x33b8; 57467 t["kwsquare"] = 0x33be; 57468 t["l"] = 0x006c; 57469 t["labengali"] = 0x09b2; 57470 t["lacute"] = 0x013a; 57471 t["ladeva"] = 0x0932; 57472 t["lagujarati"] = 0x0ab2; 57473 t["lagurmukhi"] = 0x0a32; 57474 t["lakkhangyaothai"] = 0x0e45; 57475 t["lamaleffinalarabic"] = 0xfefc; 57476 t["lamalefhamzaabovefinalarabic"] = 0xfef8; 57477 t["lamalefhamzaaboveisolatedarabic"] = 0xfef7; 57478 t["lamalefhamzabelowfinalarabic"] = 0xfefa; 57479 t["lamalefhamzabelowisolatedarabic"] = 0xfef9; 57480 t["lamalefisolatedarabic"] = 0xfefb; 57481 t["lamalefmaddaabovefinalarabic"] = 0xfef6; 57482 t["lamalefmaddaaboveisolatedarabic"] = 0xfef5; 57483 t["lamarabic"] = 0x0644; 57484 t["lambda"] = 0x03bb; 57485 t["lambdastroke"] = 0x019b; 57486 t["lamed"] = 0x05dc; 57487 t["lameddagesh"] = 0xfb3c; 57488 t["lameddageshhebrew"] = 0xfb3c; 57489 t["lamedhebrew"] = 0x05dc; 57490 t["lamfinalarabic"] = 0xfede; 57491 t["lamhahinitialarabic"] = 0xfcca; 57492 t["laminitialarabic"] = 0xfedf; 57493 t["lamjeeminitialarabic"] = 0xfcc9; 57494 t["lamkhahinitialarabic"] = 0xfccb; 57495 t["lamlamhehisolatedarabic"] = 0xfdf2; 57496 t["lammedialarabic"] = 0xfee0; 57497 t["lammeemhahinitialarabic"] = 0xfd88; 57498 t["lammeeminitialarabic"] = 0xfccc; 57499 t["largecircle"] = 0x25ef; 57500 t["lbar"] = 0x019a; 57501 t["lbelt"] = 0x026c; 57502 t["lbopomofo"] = 0x310c; 57503 t["lcaron"] = 0x013e; 57504 t["lcedilla"] = 0x013c; 57505 t["lcircle"] = 0x24db; 57506 t["lcircumflexbelow"] = 0x1e3d; 57507 t["lcommaaccent"] = 0x013c; 57508 t["ldot"] = 0x0140; 57509 t["ldotaccent"] = 0x0140; 57510 t["ldotbelow"] = 0x1e37; 57511 t["ldotbelowmacron"] = 0x1e39; 57512 t["leftangleabovecmb"] = 0x031a; 57513 t["lefttackbelowcmb"] = 0x0318; 57514 t["less"] = 0x003c; 57515 t["lessequal"] = 0x2264; 57516 t["lessequalorgreater"] = 0x22da; 57517 t["lessmonospace"] = 0xff1c; 57518 t["lessorequivalent"] = 0x2272; 57519 t["lessorgreater"] = 0x2276; 57520 t["lessoverequal"] = 0x2266; 57521 t["lesssmall"] = 0xfe64; 57522 t["lezh"] = 0x026e; 57523 t["lfblock"] = 0x258c; 57524 t["lhookretroflex"] = 0x026d; 57525 t["lira"] = 0x20a4; 57526 t["liwnarmenian"] = 0x056c; 57527 t["lj"] = 0x01c9; 57528 t["ljecyrillic"] = 0x0459; 57529 t["ll"] = 0xf6c0; 57530 t["lladeva"] = 0x0933; 57531 t["llagujarati"] = 0x0ab3; 57532 t["llinebelow"] = 0x1e3b; 57533 t["llladeva"] = 0x0934; 57534 t["llvocalicbengali"] = 0x09e1; 57535 t["llvocalicdeva"] = 0x0961; 57536 t["llvocalicvowelsignbengali"] = 0x09e3; 57537 t["llvocalicvowelsigndeva"] = 0x0963; 57538 t["lmiddletilde"] = 0x026b; 57539 t["lmonospace"] = 0xff4c; 57540 t["lmsquare"] = 0x33d0; 57541 t["lochulathai"] = 0x0e2c; 57542 t["logicaland"] = 0x2227; 57543 t["logicalnot"] = 0x00ac; 57544 t["logicalnotreversed"] = 0x2310; 57545 t["logicalor"] = 0x2228; 57546 t["lolingthai"] = 0x0e25; 57547 t["longs"] = 0x017f; 57548 t["lowlinecenterline"] = 0xfe4e; 57549 t["lowlinecmb"] = 0x0332; 57550 t["lowlinedashed"] = 0xfe4d; 57551 t["lozenge"] = 0x25ca; 57552 t["lparen"] = 0x24a7; 57553 t["lslash"] = 0x0142; 57554 t["lsquare"] = 0x2113; 57555 t["lsuperior"] = 0xf6ee; 57556 t["ltshade"] = 0x2591; 57557 t["luthai"] = 0x0e26; 57558 t["lvocalicbengali"] = 0x098c; 57559 t["lvocalicdeva"] = 0x090c; 57560 t["lvocalicvowelsignbengali"] = 0x09e2; 57561 t["lvocalicvowelsigndeva"] = 0x0962; 57562 t["lxsquare"] = 0x33d3; 57563 t["m"] = 0x006d; 57564 t["mabengali"] = 0x09ae; 57565 t["macron"] = 0x00af; 57566 t["macronbelowcmb"] = 0x0331; 57567 t["macroncmb"] = 0x0304; 57568 t["macronlowmod"] = 0x02cd; 57569 t["macronmonospace"] = 0xffe3; 57570 t["macute"] = 0x1e3f; 57571 t["madeva"] = 0x092e; 57572 t["magujarati"] = 0x0aae; 57573 t["magurmukhi"] = 0x0a2e; 57574 t["mahapakhhebrew"] = 0x05a4; 57575 t["mahapakhlefthebrew"] = 0x05a4; 57576 t["mahiragana"] = 0x307e; 57577 t["maichattawalowleftthai"] = 0xf895; 57578 t["maichattawalowrightthai"] = 0xf894; 57579 t["maichattawathai"] = 0x0e4b; 57580 t["maichattawaupperleftthai"] = 0xf893; 57581 t["maieklowleftthai"] = 0xf88c; 57582 t["maieklowrightthai"] = 0xf88b; 57583 t["maiekthai"] = 0x0e48; 57584 t["maiekupperleftthai"] = 0xf88a; 57585 t["maihanakatleftthai"] = 0xf884; 57586 t["maihanakatthai"] = 0x0e31; 57587 t["maitaikhuleftthai"] = 0xf889; 57588 t["maitaikhuthai"] = 0x0e47; 57589 t["maitholowleftthai"] = 0xf88f; 57590 t["maitholowrightthai"] = 0xf88e; 57591 t["maithothai"] = 0x0e49; 57592 t["maithoupperleftthai"] = 0xf88d; 57593 t["maitrilowleftthai"] = 0xf892; 57594 t["maitrilowrightthai"] = 0xf891; 57595 t["maitrithai"] = 0x0e4a; 57596 t["maitriupperleftthai"] = 0xf890; 57597 t["maiyamokthai"] = 0x0e46; 57598 t["makatakana"] = 0x30de;
57599 t["makatakanahalfwidth"] = 0xff8f; 57600 t["male"] = 0x2642; 57601 t["mansyonsquare"] = 0x3347; 57602 t["maqafhebrew"] = 0x05be; 57603 t["mars"] = 0x2642; 57604 t["masoracirclehebrew"] = 0x05af; 57605 t["masquare"] = 0x3383; 57606 t["mbopomofo"] = 0x3107; 57607 t["mbsquare"] = 0x33d4; 57608 t["mcircle"] = 0x24dc; 57609 t["mcubedsquare"] = 0x33a5; 57610 t["mdotaccent"] = 0x1e41; 57611 t["mdotbelow"] = 0x1e43; 57612 t["meemarabic"] = 0x0645; 57613 t["meemfinalarabic"] = 0xfee2; 57614 t["meeminitialarabic"] = 0xfee3; 57615 t["meemmedialarabic"] = 0xfee4; 57616 t["meemmeeminitialarabic"] = 0xfcd1; 57617 t["meemmeemisolatedarabic"] = 0xfc48; 57618 t["meetorusquare"] = 0x334d; 57619 t["mehiragana"] = 0x3081; 57620 t["meizierasquare"] = 0x337e; 57621 t["mekatakana"] = 0x30e1; 57622 t["mekatakanahalfwidth"] = 0xff92; 57623 t["mem"] = 0x05de; 57624 t["memdagesh"] = 0xfb3e; 57625 t["memdageshhebrew"] = 0xfb3e; 57626 t["memhebrew"] = 0x05de; 57627 t["menarmenian"] = 0x0574; 57628 t["merkhahebrew"] = 0x05a5; 57629 t["merkhakefulahebrew"] = 0x05a6; 57630 t["merkhakefulalefthebrew"] = 0x05a6; 57631 t["merkhalefthebrew"] = 0x05a5; 57632 t["mhook"] = 0x0271; 57633 t["mhzsquare"] = 0x3392; 57634 t["middledotkatakanahalfwidth"] = 0xff65; 57635 t["middot"] = 0x00b7; 57636 t["mieumacirclekorean"] = 0x3272; 57637 t["mieumaparenkorean"] = 0x3212; 57638 t["mieumcirclekorean"] = 0x3264; 57639 t["mieumkorean"] = 0x3141; 57640 t["mieumpansioskorean"] = 0x3170; 57641 t["mieumparenkorean"] = 0x3204; 57642 t["mieumpieupkorean"] = 0x316e; 57643 t["mieumsioskorean"] = 0x316f; 57644 t["mihiragana"] = 0x307f; 57645 t["mikatakana"] = 0x30df; 57646 t["mikatakanahalfwidth"] = 0xff90; 57647 t["minus"] = 0x2212; 57648 t["minusbelowcmb"] = 0x0320; 57649 t["minuscircle"] = 0x2296; 57650 t["minusmod"] = 0x02d7; 57651 t["minusplus"] = 0x2213; 57652 t["minute"] = 0x2032; 57653 t["miribaarusquare"] = 0x334a; 57654 t["mirisquare"] = 0x3349; 57655 t["mlonglegturned"] = 0x0270; 57656 t["mlsquare"] = 0x3396; 57657 t["mmcubedsquare"] = 0x33a3; 57658 t["mmonospace"] = 0xff4d; 57659 t["mmsquaredsquare"] = 0x339f; 57660 t["mohiragana"] = 0x3082; 57661 t["mohmsquare"] = 0x33c1; 57662 t["mokatakana"] = 0x30e2; 57663 t["mokatakanahalfwidth"] = 0xff93; 57664 t["molsquare"] = 0x33d6; 57665 t["momathai"] = 0x0e21; 57666 t["moverssquare"] = 0x33a7; 57667 t["moverssquaredsquare"] = 0x33a8; 57668 t["mparen"] = 0x24a8; 57669 t["mpasquare"] = 0x33ab; 57670 t["mssquare"] = 0x33b3; 57671 t["msuperior"] = 0xf6ef; 57672 t["mturned"] = 0x026f; 57673 t["mu"] = 0x00b5; 57674 t["mu1"] = 0x00b5; 57675 t["muasquare"] = 0x3382; 57676 t["muchgreater"] = 0x226b; 57677 t["muchless"] = 0x226a; 57678 t["mufsquare"] = 0x338c; 57679 t["mugreek"] = 0x03bc; 57680 t["mugsquare"] = 0x338d; 57681 t["muhiragana"] = 0x3080; 57682 t["mukatakana"] = 0x30e0; 57683 t["mukatakanahalfwidth"] = 0xff91; 57684 t["mulsquare"] = 0x3395; 57685 t["multiply"] = 0x00d7; 57686 t["mumsquare"] = 0x339b; 57687 t["munahhebrew"] = 0x05a3; 57688 t["munahlefthebrew"] = 0x05a3; 57689 t["musicalnote"] = 0x266a; 57690 t["musicalnotedbl"] = 0x266b; 57691 t["musicflatsign"] = 0x266d; 57692 t["musicsharpsign"] = 0x266f; 57693 t["mussquare"] = 0x33b2; 57694 t["muvsquare"] = 0x33b6; 57695 t["muwsquare"] = 0x33bc; 57696 t["mvmegasquare"] = 0x33b9; 57697 t["mvsquare"] = 0x33b7; 57698 t["mwmegasquare"] = 0x33bf; 57699 t["mwsquare"] = 0x33bd; 57700 t["n"] = 0x006e; 57701 t["nabengali"] = 0x09a8; 57702 t["nabla"] = 0x2207; 57703 t["nacute"] = 0x0144; 57704 t["nadeva"] = 0x0928; 57705 t["nagujarati"] = 0x0aa8; 57706 t["nagurmukhi"] = 0x0a28; 57707 t["nahiragana"] = 0x306a; 57708 t["nakatakana"] = 0x30ca; 57709 t["nakatakanahalfwidth"] = 0xff85; 57710 t["napostrophe"] = 0x0149; 57711 t["nasquare"] = 0x3381; 57712 t["nbopomofo"] = 0x310b; 57713 t["nbspace"] = 0x00a0; 57714 t["ncaron"] = 0x0148; 57715 t["ncedilla"] = 0x0146; 57716 t["ncircle"] = 0x24dd; 57717 t["ncircumflexbelow"] = 0x1e4b; 57718 t["ncommaaccent"] = 0x0146; 57719 t["ndotaccent"] = 0x1e45; 57720 t["ndotbelow"] = 0x1e47; 57721 t["nehiragana"] = 0x306d; 57722 t["nekatakana"] = 0x30cd; 57723 t["nekatakanahalfwidth"] = 0xff88; 57724 t["newsheqelsign"] = 0x20aa; 57725 t["nfsquare"] = 0x338b; 57726 t["ngabengali"] = 0x0999; 57727 t["ngadeva"] = 0x0919; 57728 t["ngagujarati"] = 0x0a99; 57729 t["ngagurmukhi"] = 0x0a19; 57730 t["ngonguthai"] = 0x0e07; 57731 t["nhiragana"] = 0x3093; 57732 t["nhookleft"] = 0x0272; 57733 t["nhookretroflex"] = 0x0273; 57734 t["nieunacirclekorean"] = 0x326f; 57735 t["nieunaparenkorean"] = 0x320f; 57736 t["nieuncieuckorean"] = 0x3135; 57737 t["nieuncirclekorean"] = 0x3261; 57738 t["nieunhieuhkorean"] = 0x3136; 57739 t["nieunkorean"] = 0x3134; 57740 t["nieunpansioskorean"] = 0x3168; 57741 t["nieunparenkorean"] = 0x3201; 57742 t["nieunsioskorean"] = 0x3167; 57743 t["nieuntikeutkorean"] = 0x3166; 57744 t["nihiragana"] = 0x306b; 57745 t["nikatakana"] = 0x30cb;
57746 t["nikatakanahalfwidth"] = 0xff86; 57747 t["nikhahitleftthai"] = 0xf899; 57748 t["nikhahitthai"] = 0x0e4d; 57749 t["nine"] = 0x0039; 57750 t["ninearabic"] = 0x0669; 57751 t["ninebengali"] = 0x09ef; 57752 t["ninecircle"] = 0x2468; 57753 t["ninecircleinversesansserif"] = 0x2792; 57754 t["ninedeva"] = 0x096f; 57755 t["ninegujarati"] = 0x0aef; 57756 t["ninegurmukhi"] = 0x0a6f; 57757 t["ninehackarabic"] = 0x0669; 57758 t["ninehangzhou"] = 0x3029; 57759 t["nineideographicparen"] = 0x3228; 57760 t["nineinferior"] = 0x2089; 57761 t["ninemonospace"] = 0xff19; 57762 t["nineoldstyle"] = 0xf739; 57763 t["nineparen"] = 0x247c; 57764 t["nineperiod"] = 0x2490; 57765 t["ninepersian"] = 0x06f9; 57766 t["nineroman"] = 0x2178; 57767 t["ninesuperior"] = 0x2079; 57768 t["nineteencircle"] = 0x2472; 57769 t["nineteenparen"] = 0x2486; 57770 t["nineteenperiod"] = 0x249a; 57771 t["ninethai"] = 0x0e59; 57772 t["nj"] = 0x01cc; 57773 t["njecyrillic"] = 0x045a; 57774 t["nkatakana"] = 0x30f3; 57775 t["nkatakanahalfwidth"] = 0xff9d; 57776 t["nlegrightlong"] = 0x019e; 57777 t["nlinebelow"] = 0x1e49; 57778 t["nmonospace"] = 0xff4e; 57779 t["nmsquare"] = 0x339a; 57780 t["nnabengali"] = 0x09a3; 57781 t["nnadeva"] = 0x0923; 57782 t["nnagujarati"] = 0x0aa3; 57783 t["nnagurmukhi"] = 0x0a23; 57784 t["nnnadeva"] = 0x0929; 57785 t["nohiragana"] = 0x306e; 57786 t["nokatakana"] = 0x30ce; 57787 t["nokatakanahalfwidth"] = 0xff89; 57788 t["nonbreakingspace"] = 0x00a0; 57789 t["nonenthai"] = 0x0e13; 57790 t["nonuthai"] = 0x0e19; 57791 t["noonarabic"] = 0x0646; 57792 t["noonfinalarabic"] = 0xfee6; 57793 t["noonghunnaarabic"] = 0x06ba; 57794 t["noonghunnafinalarabic"] = 0xfb9f; 57795 t["nooninitialarabic"] = 0xfee7; 57796 t["noonjeeminitialarabic"] = 0xfcd2; 57797 t["noonjeemisolatedarabic"] = 0xfc4b; 57798 t["noonmedialarabic"] = 0xfee8; 57799 t["noonmeeminitialarabic"] = 0xfcd5; 57800 t["noonmeemisolatedarabic"] = 0xfc4e; 57801 t["noonnoonfinalarabic"] = 0xfc8d; 57802 t["notcontains"] = 0x220c; 57803 t["notelement"] = 0x2209; 57804 t["notelementof"] = 0x2209; 57805 t["notequal"] = 0x2260; 57806 t["notgreater"] = 0x226f; 57807 t["notgreaternorequal"] = 0x2271; 57808 t["notgreaternorless"] = 0x2279; 57809 t["notidentical"] = 0x2262; 57810 t["notless"] = 0x226e; 57811 t["notlessnorequal"] = 0x2270; 57812 t["notparallel"] = 0x2226; 57813 t["notprecedes"] = 0x2280; 57814 t["notsubset"] = 0x2284; 57815 t["notsucceeds"] = 0x2281; 57816 t["notsuperset"] = 0x2285; 57817 t["nowarmenian"] = 0x0576; 57818 t["nparen"] = 0x24a9; 57819 t["nssquare"] = 0x33b1; 57820 t["nsuperior"] = 0x207f; 57821 t["ntilde"] = 0x00f1; 57822 t["nu"] = 0x03bd; 57823 t["nuhiragana"] = 0x306c; 57824 t["nukatakana"] = 0x30cc; 57825 t["nukatakanahalfwidth"] = 0xff87; 57826 t["nuktabengali"] = 0x09bc; 57827 t["nuktadeva"] = 0x093c; 57828 t["nuktagujarati"] = 0x0abc; 57829 t["nuktagurmukhi"] = 0x0a3c; 57830 t["numbersign"] = 0x0023; 57831 t["numbersignmonospace"] = 0xff03; 57832 t["numbersignsmall"] = 0xfe5f; 57833 t["numeralsigngreek"] = 0x0374; 57834 t["numeralsignlowergreek"] = 0x0375; 57835 t["numero"] = 0x2116; 57836 t["nun"] = 0x05e0; 57837 t["nundagesh"] = 0xfb40; 57838 t["nundageshhebrew"] = 0xfb40; 57839 t["nunhebrew"] = 0x05e0; 57840 t["nvsquare"] = 0x33b5; 57841 t["nwsquare"] = 0x33bb; 57842 t["nyabengali"] = 0x099e; 57843 t["nyadeva"] = 0x091e; 57844 t["nyagujarati"] = 0x0a9e; 57845 t["nyagurmukhi"] = 0x0a1e; 57846 t["o"] = 0x006f; 57847 t["oacute"] = 0x00f3; 57848 t["oangthai"] = 0x0e2d; 57849 t["obarred"] = 0x0275; 57850 t["obarredcyrillic"] = 0x04e9; 57851 t["obarreddieresiscyrillic"] = 0x04eb; 57852 t["obengali"] = 0x0993; 57853 t["obopomofo"] = 0x311b; 57854 t["obreve"] = 0x014f; 57855 t["ocandradeva"] = 0x0911; 57856 t["ocandragujarati"] = 0x0a91; 57857 t["ocandravowelsigndeva"] = 0x0949; 57858 t["ocandravowelsigngujarati"] = 0x0ac9; 57859 t["ocaron"] = 0x01d2; 57860 t["ocircle"] = 0x24de; 57861 t["ocircumflex"] = 0x00f4; 57862 t["ocircumflexacute"] = 0x1ed1; 57863 t["ocircumflexdotbelow"] = 0x1ed9; 57864 t["ocircumflexgrave"] = 0x1ed3; 57865 t["ocircumflexhookabove"] = 0x1ed5; 57866 t["ocircumflextilde"] = 0x1ed7; 57867 t["ocyrillic"] = 0x043e; 57868 t["odblacute"] = 0x0151; 57869 t["odblgrave"] = 0x020d; 57870 t["odeva"] = 0x0913; 57871 t["odieresis"] = 0x00f6; 57872 t["odieresiscyrillic"] = 0x04e7; 57873 t["odotbelow"] = 0x1ecd; 57874 t["oe"] = 0x0153; 57875 t["oekorean"] = 0x315a; 57876 t["ogonek"] = 0x02db; 57877 t["ogonekcmb"] = 0x0328; 57878 t["ograve"] = 0x00f2; 57879 t["ogujarati"] = 0x0a93; 57880 t["oharmenian"] = 0x0585; 57881 t["ohiragana"] = 0x304a; 57882 t["ohookabove"] = 0x1ecf; 57883 t["ohorn"] = 0x01a1; 57884 t["ohornacute"] = 0x1edb; 57885 t["ohorndotbelow"] = 0x1ee3; 57886 t["ohorngrave"] = 0x1edd; 57887 t["ohornhookabove"] = 0x1edf; 57888 t["ohorntilde"] = 0x1ee1; 57889 t["ohungarumlaut"] = 0x0151; 57890 t["oi"] = 0x01a3; 57891 t["oinvertedbreve"] = 0x020f; 57892 t["okatakana"] = 0x30aa;
57893 t["okatakanahalfwidth"] = 0xff75; 57894 t["okorean"] = 0x3157; 57895 t["olehebrew"] = 0x05ab; 57896 t["omacron"] = 0x014d; 57897 t["omacronacute"] = 0x1e53; 57898 t["omacrongrave"] = 0x1e51; 57899 t["omdeva"] = 0x0950; 57900 t["omega"] = 0x03c9; 57901 t["omega1"] = 0x03d6; 57902 t["omegacyrillic"] = 0x0461; 57903 t["omegalatinclosed"] = 0x0277; 57904 t["omegaroundcyrillic"] = 0x047b; 57905 t["omegatitlocyrillic"] = 0x047d; 57906 t["omegatonos"] = 0x03ce; 57907 t["omgujarati"] = 0x0ad0; 57908 t["omicron"] = 0x03bf; 57909 t["omicrontonos"] = 0x03cc; 57910 t["omonospace"] = 0xff4f; 57911 t["one"] = 0x0031; 57912 t["onearabic"] = 0x0661; 57913 t["onebengali"] = 0x09e7; 57914 t["onecircle"] = 0x2460; 57915 t["onecircleinversesansserif"] = 0x278a; 57916 t["onedeva"] = 0x0967; 57917 t["onedotenleader"] = 0x2024; 57918 t["oneeighth"] = 0x215b; 57919 t["onefitted"] = 0xf6dc; 57920 t["onegujarati"] = 0x0ae7; 57921 t["onegurmukhi"] = 0x0a67; 57922 t["onehackarabic"] = 0x0661; 57923 t["onehalf"] = 0x00bd; 57924 t["onehangzhou"] = 0x3021; 57925 t["oneideographicparen"] = 0x3220; 57926 t["oneinferior"] = 0x2081; 57927 t["onemonospace"] = 0xff11; 57928 t["onenumeratorbengali"] = 0x09f4; 57929 t["oneoldstyle"] = 0xf731; 57930 t["oneparen"] = 0x2474; 57931 t["oneperiod"] = 0x2488; 57932 t["onepersian"] = 0x06f1; 57933 t["onequarter"] = 0x00bc; 57934 t["oneroman"] = 0x2170; 57935 t["onesuperior"] = 0x00b9; 57936 t["onethai"] = 0x0e51; 57937 t["onethird"] = 0x2153; 57938 t["oogonek"] = 0x01eb; 57939 t["oogonekmacron"] = 0x01ed; 57940 t["oogurmukhi"] = 0x0a13; 57941 t["oomatragurmukhi"] = 0x0a4b; 57942 t["oopen"] = 0x0254; 57943 t["oparen"] = 0x24aa; 57944 t["openbullet"] = 0x25e6; 57945 t["option"] = 0x2325; 57946 t["ordfeminine"] = 0x00aa; 57947 t["ordmasculine"] = 0x00ba; 57948 t["orthogonal"] = 0x221f; 57949 t["oshortdeva"] = 0x0912; 57950 t["oshortvowelsigndeva"] = 0x094a; 57951 t["oslash"] = 0x00f8; 57952 t["oslashacute"] = 0x01ff; 57953 t["osmallhiragana"] = 0x3049; 57954 t["osmallkatakana"] = 0x30a9; 57955 t["osmallkatakanahalfwidth"] = 0xff6b; 57956 t["ostrokeacute"] = 0x01ff; 57957 t["osuperior"] = 0xf6f0; 57958 t["otcyrillic"] = 0x047f; 57959 t["otilde"] = 0x00f5; 57960 t["otildeacute"] = 0x1e4d; 57961 t["otildedieresis"] = 0x1e4f; 57962 t["oubopomofo"] = 0x3121; 57963 t["overline"] = 0x203e; 57964 t["overlinecenterline"] = 0xfe4a; 57965 t["overlinecmb"] = 0x0305; 57966 t["overlinedashed"] = 0xfe49; 57967 t["overlinedblwavy"] = 0xfe4c; 57968 t["overlinewavy"] = 0xfe4b; 57969 t["overscore"] = 0x00af; 57970 t["ovowelsignbengali"] = 0x09cb; 57971 t["ovowelsigndeva"] = 0x094b; 57972 t["ovowelsigngujarati"] = 0x0acb; 57973 t["p"] = 0x0070; 57974 t["paampssquare"] = 0x3380; 57975 t["paasentosquare"] = 0x332b; 57976 t["pabengali"] = 0x09aa; 57977 t["pacute"] = 0x1e55; 57978 t["padeva"] = 0x092a; 57979 t["pagedown"] = 0x21df; 57980 t["pageup"] = 0x21de; 57981 t["pagujarati"] = 0x0aaa; 57982 t["pagurmukhi"] = 0x0a2a; 57983 t["pahiragana"] = 0x3071; 57984 t["paiyannoithai"] = 0x0e2f; 57985 t["pakatakana"] = 0x30d1; 57986 t["palatalizationcyrilliccmb"] = 0x0484; 57987 t["palochkacyrillic"] = 0x04c0; 57988 t["pansioskorean"] = 0x317f; 57989 t["paragraph"] = 0x00b6; 57990 t["parallel"] = 0x2225; 57991 t["parenleft"] = 0x0028; 57992 t["parenleftaltonearabic"] = 0xfd3e; 57993 t["parenleftbt"] = 0xf8ed; 57994 t["parenleftex"] = 0xf8ec; 57995 t["parenleftinferior"] = 0x208d; 57996 t["parenleftmonospace"] = 0xff08; 57997 t["parenleftsmall"] = 0xfe59; 57998 t["parenleftsuperior"] = 0x207d; 57999 t["parenlefttp"] = 0xf8eb; 58000 t["parenleftvertical"] = 0xfe35; 58001 t["parenright"] = 0x0029; 58002 t["parenrightaltonearabic"] = 0xfd3f; 58003 t["parenrightbt"] = 0xf8f8; 58004 t["parenrightex"] = 0xf8f7; 58005 t["parenrightinferior"] = 0x208e; 58006 t["parenrightmonospace"] = 0xff09; 58007 t["parenrightsmall"] = 0xfe5a; 58008 t["parenrightsuperior"] = 0x207e; 58009 t["parenrighttp"] = 0xf8f6; 58010 t["parenrightvertical"] = 0xfe36; 58011 t["partialdiff"] = 0x2202; 58012 t["paseqhebrew"] = 0x05c0; 58013 t["pashtahebrew"] = 0x0599; 58014 t["pasquare"] = 0x33a9; 58015 t["patah"] = 0x05b7; 58016 t["patah11"] = 0x05b7; 58017 t["patah1d"] = 0x05b7; 58018 t["patah2a"] = 0x05b7; 58019 t["patahhebrew"] = 0x05b7; 58020 t["patahnarrowhebrew"] = 0x05b7; 58021 t["patahquarterhebrew"] = 0x05b7; 58022 t["patahwidehebrew"] = 0x05b7; 58023 t["pazerhebrew"] = 0x05a1;
58024 t["pbopomofo"] = 0x3106; 58025 t["pcircle"] = 0x24df; 58026 t["pdotaccent"] = 0x1e57; 58027 t["pe"] = 0x05e4; 58028 t["pecyrillic"] = 0x043f; 58029 t["pedagesh"] = 0xfb44; 58030 t["pedageshhebrew"] = 0xfb44; 58031 t["peezisquare"] = 0x333b; 58032 t["pefinaldageshhebrew"] = 0xfb43; 58033 t["peharabic"] = 0x067e; 58034 t["peharmenian"] = 0x057a; 58035 t["pehebrew"] = 0x05e4; 58036 t["pehfinalarabic"] = 0xfb57; 58037 t["pehinitialarabic"] = 0xfb58; 58038 t["pehiragana"] = 0x307a; 58039 t["pehmedialarabic"] = 0xfb59; 58040 t["pekatakana"] = 0x30da; 58041 t["pemiddlehookcyrillic"] = 0x04a7; 58042 t["perafehebrew"] = 0xfb4e; 58043 t["percent"] = 0x0025; 58044 t["percentarabic"] = 0x066a; 58045 t["percentmonospace"] = 0xff05; 58046 t["percentsmall"] = 0xfe6a; 58047 t["period"] = 0x002e; 58048 t["periodarmenian"] = 0x0589; 58049 t["periodcentered"] = 0x00b7; 58050 t["periodhalfwidth"] = 0xff61; 58051 t["periodinferior"] = 0xf6e7; 58052 t["periodmonospace"] = 0xff0e; 58053 t["periodsmall"] = 0xfe52; 58054 t["periodsuperior"] = 0xf6e8; 58055 t["perispomenigreekcmb"] = 0x0342; 58056 t["perpendicular"] = 0x22a5; 58057 t["perthousand"] = 0x2030; 58058 t["peseta"] = 0x20a7; 58059 t["pfsquare"] = 0x338a; 58060 t["phabengali"] = 0x09ab; 58061 t["phadeva"] = 0x092b; 58062 t["phagujarati"] = 0x0aab; 58063 t["phagurmukhi"] = 0x0a2b; 58064 t["phi"] = 0x03c6; 58065 t["phi1"] = 0x03d5; 58066 t["phieuphacirclekorean"] = 0x327a; 58067 t["phieuphaparenkorean"] = 0x321a; 58068 t["phieuphcirclekorean"] = 0x326c; 58069 t["phieuphkorean"] = 0x314d; 58070 t["phieuphparenkorean"] = 0x320c; 58071 t["philatin"] = 0x0278; 58072 t["phinthuthai"] = 0x0e3a; 58073 t["phisymbolgreek"] = 0x03d5; 58074 t["phook"] = 0x01a5; 58075 t["phophanthai"] = 0x0e1e; 58076 t["phophungthai"] = 0x0e1c; 58077 t["phosamphaothai"] = 0x0e20; 58078 t["pi"] = 0x03c0; 58079 t["pieupacirclekorean"] = 0x3273; 58080 t["pieupaparenkorean"] = 0x3213; 58081 t["pieupcieuckorean"] = 0x3176; 58082 t["pieupcirclekorean"] = 0x3265; 58083 t["pieupkiyeokkorean"] = 0x3172; 58084 t["pieupkorean"] = 0x3142; 58085 t["pieupparenkorean"] = 0x3205; 58086 t["pieupsioskiyeokkorean"] = 0x3174; 58087 t["pieupsioskorean"] = 0x3144; 58088 t["pieupsiostikeutkorean"] = 0x3175; 58089 t["pieupthieuthkorean"] = 0x3177; 58090 t["pieuptikeutkorean"] = 0x3173; 58091 t["pihiragana"] = 0x3074; 58092 t["pikatakana"] = 0x30d4; 58093 t["pisymbolgreek"] = 0x03d6; 58094 t["piwrarmenian"] = 0x0583; 58095 t["plus"] = 0x002b; 58096 t["plusbelowcmb"] = 0x031f; 58097 t["pluscircle"] = 0x2295; 58098 t["plusminus"] = 0x00b1; 58099 t["plusmod"] = 0x02d6; 58100 t["plusmonospace"] = 0xff0b; 58101 t["plussmall"] = 0xfe62; 58102 t["plussuperior"] = 0x207a; 58103 t["pmonospace"] = 0xff50; 58104 t["pmsquare"] = 0x33d8; 58105 t["pohiragana"] = 0x307d; 58106 t["pointingindexdownwhite"] = 0x261f; 58107 t["pointingindexleftwhite"] = 0x261c; 58108 t["pointingindexrightwhite"] = 0x261e; 58109 t["pointingindexupwhite"] = 0x261d; 58110 t["pokatakana"] = 0x30dd; 58111 t["poplathai"] = 0x0e1b; 58112 t["postalmark"] = 0x3012; 58113 t["postalmarkface"] = 0x3020; 58114 t["pparen"] = 0x24ab; 58115 t["precedes"] = 0x227a; 58116 t["prescription"] = 0x211e; 58117 t["primemod"] = 0x02b9; 58118 t["primereversed"] = 0x2035; 58119 t["product"] = 0x220f; 58120 t["projective"] = 0x2305; 58121 t["prolongedkana"] = 0x30fc; 58122 t["propellor"] = 0x2318; 58123 t["propersubset"] = 0x2282; 58124 t["propersuperset"] = 0x2283; 58125 t["proportion"] = 0x2237; 58126 t["proportional"] = 0x221d; 58127 t["psi"] = 0x03c8; 58128 t["psicyrillic"] = 0x0471; 58129 t["psilipneumatacyrilliccmb"] = 0x0486; 58130 t["pssquare"] = 0x33b0; 58131 t["puhiragana"] = 0x3077; 58132 t["pukatakana"] = 0x30d7; 58133 t["pvsquare"] = 0x33b4; 58134 t["pwsquare"] = 0x33ba; 58135 t["q"] = 0x0071; 58136 t["qadeva"] = 0x0958; 58137 t["qadmahebrew"] = 0x05a8; 58138 t["qafarabic"] = 0x0642; 58139 t["qaffinalarabic"] = 0xfed6; 58140 t["qafinitialarabic"] = 0xfed7; 58141 t["qafmedialarabic"] = 0xfed8; 58142 t["qamats"] = 0x05b8; 58143 t["qamats10"] = 0x05b8; 58144 t["qamats1a"] = 0x05b8; 58145 t["qamats1c"] = 0x05b8; 58146 t["qamats27"] = 0x05b8; 58147 t["qamats29"] = 0x05b8; 58148 t["qamats33"] = 0x05b8; 58149 t["qamatsde"] = 0x05b8; 58150 t["qamatshebrew"] = 0x05b8; 58151 t["qamatsnarrowhebrew"] = 0x05b8; 58152 t["qamatsqatanhebrew"] = 0x05b8; 58153 t["qamatsqatannarrowhebrew"] = 0x05b8; 58154 t["qamatsqatanquarterhebrew"] = 0x05b8; 58155 t["qamatsqatanwidehebrew"] = 0x05b8; 58156 t["qamatsquarterhebrew"] = 0x05b8; 58157 t["qamatswidehebrew"] = 0x05b8; 58158 t["qarneyparahebrew"] = 0x059f; 58159 t["qbopomofo"] = 0x3111; 58160 t["qcircle"] = 0x24e0; 58161 t["qhook"] = 0x02a0; 58162 t["qmonospace"] = 0xff51; 58163 t["qof"] = 0x05e7; 58164 t["qofdagesh"] = 0xfb47; 58165 t["qofdageshhebrew"] = 0xfb47; 58166 t["qofhebrew"] = 0x05e7; 58167 t["qparen"] = 0x24ac; 58168 t["quarternote"] = 0x2669; 58169 t["qubuts"] = 0x05bb; 58170 t["qubuts18"] = 0x05bb; 58171 t["qubuts25"] = 0x05bb; 58172 t["qubuts31"] = 0x05bb; 58173 t["qubutshebrew"] = 0x05bb; 58174 t["qubutsnarrowhebrew"] = 0x05bb; 58175 t["qubutsquarterhebrew"] = 0x05bb; 58176 t["qubutswidehebrew"] = 0x05bb; 58177 t["question"] = 0x003f;
58178 t["questionarabic"] = 0x061f; 58179 t["questionarmenian"] = 0x055e; 58180 t["questiondown"] = 0x00bf; 58181 t["questiondownsmall"] = 0xf7bf; 58182 t["questiongreek"] = 0x037e; 58183 t["questionmonospace"] = 0xff1f; 58184 t["questionsmall"] = 0xf73f; 58185 t["quotedbl"] = 0x0022; 58186 t["quotedblbase"] = 0x201e; 58187 t["quotedblleft"] = 0x201c; 58188 t["quotedblmonospace"] = 0xff02; 58189 t["quotedblprime"] = 0x301e; 58190 t["quotedblprimereversed"] = 0x301d; 58191 t["quotedblright"] = 0x201d; 58192 t["quoteleft"] = 0x2018; 58193 t["quoteleftreversed"] = 0x201b; 58194 t["quotereversed"] = 0x201b; 58195 t["quoteright"] = 0x2019; 58196 t["quoterightn"] = 0x0149; 58197 t["quotesinglbase"] = 0x201a; 58198 t["quotesingle"] = 0x0027; 58199 t["quotesinglemonospace"] = 0xff07; 58200 t["r"] = 0x0072; 58201 t["raarmenian"] = 0x057c; 58202 t["rabengali"] = 0x09b0; 58203 t["racute"] = 0x0155; 58204 t["radeva"] = 0x0930; 58205 t["radical"] = 0x221a; 58206 t["radicalex"] = 0xf8e5; 58207 t["radoverssquare"] = 0x33ae; 58208 t["radoverssquaredsquare"] = 0x33af; 58209 t["radsquare"] = 0x33ad; 58210 t["rafe"] = 0x05bf; 58211 t["rafehebrew"] = 0x05bf; 58212 t["ragujarati"] = 0x0ab0; 58213 t["ragurmukhi"] = 0x0a30; 58214 t["rahiragana"] = 0x3089; 58215 t["rakatakana"] = 0x30e9; 58216 t["rakatakanahalfwidth"] = 0xff97; 58217 t["ralowerdiagonalbengali"] = 0x09f1; 58218 t["ramiddlediagonalbengali"] = 0x09f0; 58219 t["ramshorn"] = 0x0264; 58220 t["ratio"] = 0x2236; 58221 t["rbopomofo"] = 0x3116; 58222 t["rcaron"] = 0x0159; 58223 t["rcedilla"] = 0x0157; 58224 t["rcircle"] = 0x24e1; 58225 t["rcommaaccent"] = 0x0157; 58226 t["rdblgrave"] = 0x0211; 58227 t["rdotaccent"] = 0x1e59; 58228 t["rdotbelow"] = 0x1e5b; 58229 t["rdotbelowmacron"] = 0x1e5d; 58230 t["referencemark"] = 0x203b; 58231 t["reflexsubset"] = 0x2286; 58232 t["reflexsuperset"] = 0x2287; 58233 t["registered"] = 0x00ae; 58234 t["registersans"] = 0xf8e8; 58235 t["registerserif"] = 0xf6da; 58236 t["reharabic"] = 0x0631; 58237 t["reharmenian"] = 0x0580; 58238 t["rehfinalarabic"] = 0xfeae; 58239 t["rehiragana"] = 0x308c; 58240 t["rekatakana"] = 0x30ec; 58241 t["rekatakanahalfwidth"] = 0xff9a; 58242 t["resh"] = 0x05e8; 58243 t["reshdageshhebrew"] = 0xfb48; 58244 t["reshhebrew"] = 0x05e8; 58245 t["reversedtilde"] = 0x223d; 58246 t["reviahebrew"] = 0x0597; 58247 t["reviamugrashhebrew"] = 0x0597; 58248 t["revlogicalnot"] = 0x2310; 58249 t["rfishhook"] = 0x027e; 58250 t["rfishhookreversed"] = 0x027f; 58251 t["rhabengali"] = 0x09dd; 58252 t["rhadeva"] = 0x095d; 58253 t["rho"] = 0x03c1; 58254 t["rhook"] = 0x027d; 58255 t["rhookturned"] = 0x027b; 58256 t["rhookturnedsuperior"] = 0x02b5; 58257 t["rhosymbolgreek"] = 0x03f1; 58258 t["rhotichookmod"] = 0x02de; 58259 t["rieulacirclekorean"] = 0x3271; 58260 t["rieulaparenkorean"] = 0x3211; 58261 t["rieulcirclekorean"] = 0x3263; 58262 t["rieulhieuhkorean"] = 0x3140; 58263 t["rieulkiyeokkorean"] = 0x313a; 58264 t["rieulkiyeoksioskorean"] = 0x3169; 58265 t["rieulkorean"] = 0x3139; 58266 t["rieulmieumkorean"] = 0x313b; 58267 t["rieulpansioskorean"] = 0x316c; 58268 t["rieulparenkorean"] = 0x3203; 58269 t["rieulphieuphkorean"] = 0x313f; 58270 t["rieulpieupkorean"] = 0x313c; 58271 t["rieulpieupsioskorean"] = 0x316b; 58272 t["rieulsioskorean"] = 0x313d; 58273 t["rieulthieuthkorean"] = 0x313e; 58274 t["rieultikeutkorean"] = 0x316a; 58275 t["rieulyeorinhieuhkorean"] = 0x316d; 58276 t["rightangle"] = 0x221f; 58277 t["righttackbelowcmb"] = 0x0319; 58278 t["righttriangle"] = 0x22bf; 58279 t["rihiragana"] = 0x308a; 58280 t["rikatakana"] = 0x30ea; 58281 t["rikatakanahalfwidth"] = 0xff98; 58282 t["ring"] = 0x02da; 58283 t["ringbelowcmb"] = 0x0325; 58284 t["ringcmb"] = 0x030a; 58285 t["ringhalfleft"] = 0x02bf; 58286 t["ringhalfleftarmenian"] = 0x0559; 58287 t["ringhalfleftbelowcmb"] = 0x031c; 58288 t["ringhalfleftcentered"] = 0x02d3; 58289 t["ringhalfright"] = 0x02be; 58290 t["ringhalfrightbelowcmb"] = 0x0339; 58291 t["ringhalfrightcentered"] = 0x02d2; 58292 t["rinvertedbreve"] = 0x0213; 58293 t["rittorusquare"] = 0x3351; 58294 t["rlinebelow"] = 0x1e5f; 58295 t["rlongleg"] = 0x027c; 58296 t["rlonglegturned"] = 0x027a; 58297 t["rmonospace"] = 0xff52; 58298 t["rohiragana"] = 0x308d; 58299 t["rokatakana"] = 0x30ed; 58300 t["rokatakanahalfwidth"] = 0xff9b; 58301 t["roruathai"] = 0x0e23; 58302 t["rparen"] = 0x24ad; 58303 t["rrabengali"] = 0x09dc; 58304 t["rradeva"] = 0x0931; 58305 t["rragurmukhi"] = 0x0a5c; 58306 t["rreharabic"] = 0x0691; 58307 t["rrehfinalarabic"] = 0xfb8d; 58308 t["rrvocalicbengali"] = 0x09e0; 58309 t["rrvocalicdeva"] = 0x0960; 58310 t["rrvocalicgujarati"] = 0x0ae0; 58311 t["rrvocalicvowelsignbengali"] = 0x09c4; 58312 t["rrvocalicvowelsigndeva"] = 0x0944; 58313 t["rrvocalicvowelsigngujarati"] = 0x0ac4; 58314 t["rsuperior"] = 0xf6f1; 58315 t["rtblock"] = 0x2590;
58316 t["rturned"] = 0x0279; 58317 t["rturnedsuperior"] = 0x02b4; 58318 t["ruhiragana"] = 0x308b; 58319 t["rukatakana"] = 0x30eb; 58320 t["rukatakanahalfwidth"] = 0xff99; 58321 t["rupeemarkbengali"] = 0x09f2; 58322 t["rupeesignbengali"] = 0x09f3; 58323 t["rupiah"] = 0xf6dd; 58324 t["ruthai"] = 0x0e24; 58325 t["rvocalicbengali"] = 0x098b; 58326 t["rvocalicdeva"] = 0x090b; 58327 t["rvocalicgujarati"] = 0x0a8b; 58328 t["rvocalicvowelsignbengali"] = 0x09c3; 58329 t["rvocalicvowelsigndeva"] = 0x0943; 58330 t["rvocalicvowelsigngujarati"] = 0x0ac3; 58331 t["s"] = 0x0073; 58332 t["sabengali"] = 0x09b8; 58333 t["sacute"] = 0x015b; 58334 t["sacutedotaccent"] = 0x1e65; 58335 t["sadarabic"] = 0x0635; 58336 t["sadeva"] = 0x0938; 58337 t["sadfinalarabic"] = 0xfeba; 58338 t["sadinitialarabic"] = 0xfebb; 58339 t["sadmedialarabic"] = 0xfebc; 58340 t["sagujarati"] = 0x0ab8; 58341 t["sagurmukhi"] = 0x0a38; 58342 t["sahiragana"] = 0x3055; 58343 t["sakatakana"] = 0x30b5; 58344 t["sakatakanahalfwidth"] = 0xff7b; 58345 t["sallallahoualayhewasallamarabic"] = 0xfdfa; 58346 t["samekh"] = 0x05e1; 58347 t["samekhdagesh"] = 0xfb41; 58348 t["samekhdageshhebrew"] = 0xfb41; 58349 t["samekhhebrew"] = 0x05e1; 58350 t["saraaathai"] = 0x0e32; 58351 t["saraaethai"] = 0x0e41; 58352 t["saraaimaimalaithai"] = 0x0e44; 58353 t["saraaimaimuanthai"] = 0x0e43; 58354 t["saraamthai"] = 0x0e33; 58355 t["saraathai"] = 0x0e30; 58356 t["saraethai"] = 0x0e40; 58357 t["saraiileftthai"] = 0xf886; 58358 t["saraiithai"] = 0x0e35; 58359 t["saraileftthai"] = 0xf885; 58360 t["saraithai"] = 0x0e34; 58361 t["saraothai"] = 0x0e42; 58362 t["saraueeleftthai"] = 0xf888; 58363 t["saraueethai"] = 0x0e37; 58364 t["saraueleftthai"] = 0xf887; 58365 t["sarauethai"] = 0x0e36; 58366 t["sarauthai"] = 0x0e38; 58367 t["sarauuthai"] = 0x0e39; 58368 t["sbopomofo"] = 0x3119; 58369 t["scaron"] = 0x0161; 58370 t["scarondotaccent"] = 0x1e67; 58371 t["scedilla"] = 0x015f; 58372 t["schwa"] = 0x0259; 58373 t["schwacyrillic"] = 0x04d9; 58374 t["schwadieresiscyrillic"] = 0x04db; 58375 t["schwahook"] = 0x025a; 58376 t["scircle"] = 0x24e2; 58377 t["scircumflex"] = 0x015d; 58378 t["scommaaccent"] = 0x0219; 58379 t["sdotaccent"] = 0x1e61; 58380 t["sdotbelow"] = 0x1e63; 58381 t["sdotbelowdotaccent"] = 0x1e69; 58382 t["seagullbelowcmb"] = 0x033c; 58383 t["second"] = 0x2033; 58384 t["secondtonechinese"] = 0x02ca; 58385 t["section"] = 0x00a7; 58386 t["seenarabic"] = 0x0633; 58387 t["seenfinalarabic"] = 0xfeb2; 58388 t["seeninitialarabic"] = 0xfeb3; 58389 t["seenmedialarabic"] = 0xfeb4; 58390 t["segol"] = 0x05b6; 58391 t["segol13"] = 0x05b6; 58392 t["segol1f"] = 0x05b6; 58393 t["segol2c"] = 0x05b6; 58394 t["segolhebrew"] = 0x05b6; 58395 t["segolnarrowhebrew"] = 0x05b6; 58396 t["segolquarterhebrew"] = 0x05b6; 58397 t["segoltahebrew"] = 0x0592; 58398 t["segolwidehebrew"] = 0x05b6; 58399 t["seharmenian"] = 0x057d; 58400 t["sehiragana"] = 0x305b; 58401 t["sekatakana"] = 0x30bb; 58402 t["sekatakanahalfwidth"] = 0xff7e; 58403 t["semicolon"] = 0x003b; 58404 t["semicolonarabic"] = 0x061b; 58405 t["semicolonmonospace"] = 0xff1b; 58406 t["semicolonsmall"] = 0xfe54; 58407 t["semivoicedmarkkana"] = 0x309c; 58408 t["semivoicedmarkkanahalfwidth"] = 0xff9f; 58409 t["sentisquare"] = 0x3322; 58410 t["sentosquare"] = 0x3323; 58411 t["seven"] = 0x0037;
58412 t["sevenarabic"] = 0x0667; 58413 t["sevenbengali"] = 0x09ed; 58414 t["sevencircle"] = 0x2466; 58415 t["sevencircleinversesansserif"] = 0x2790; 58416 t["sevendeva"] = 0x096d; 58417 t["seveneighths"] = 0x215e; 58418 t["sevengujarati"] = 0x0aed; 58419 t["sevengurmukhi"] = 0x0a6d; 58420 t["sevenhackarabic"] = 0x0667; 58421 t["sevenhangzhou"] = 0x3027; 58422 t["sevenideographicparen"] = 0x3226; 58423 t["seveninferior"] = 0x2087; 58424 t["sevenmonospace"] = 0xff17; 58425 t["sevenoldstyle"] = 0xf737; 58426 t["sevenparen"] = 0x247a; 58427 t["sevenperiod"] = 0x248e; 58428 t["sevenpersian"] = 0x06f7; 58429 t["sevenroman"] = 0x2176; 58430 t["sevensuperior"] = 0x2077; 58431 t["seventeencircle"] = 0x2470; 58432 t["seventeenparen"] = 0x2484; 58433 t["seventeenperiod"] = 0x2498; 58434 t["seventhai"] = 0x0e57; 58435 t["sfthyphen"] = 0x00ad; 58436 t["shaarmenian"] = 0x0577; 58437 t["shabengali"] = 0x09b6; 58438 t["shacyrillic"] = 0x0448; 58439 t["shaddaarabic"] = 0x0651; 58440 t["shaddadammaarabic"] = 0xfc61; 58441 t["shaddadammatanarabic"] = 0xfc5e; 58442 t["shaddafathaarabic"] = 0xfc60; 58443 t["shaddakasraarabic"] = 0xfc62; 58444 t["shaddakasratanarabic"] = 0xfc5f; 58445 t["shade"] = 0x2592; 58446 t["shadedark"] = 0x2593; 58447 t["shadelight"] = 0x2591; 58448 t["shademedium"] = 0x2592; 58449 t["shadeva"] = 0x0936; 58450 t["shagujarati"] = 0x0ab6; 58451 t["shagurmukhi"] = 0x0a36; 58452 t["shalshelethebrew"] = 0x0593; 58453 t["shbopomofo"] = 0x3115; 58454 t["shchacyrillic"] = 0x0449; 58455 t["sheenarabic"] = 0x0634; 58456 t["sheenfinalarabic"] = 0xfeb6; 58457 t["sheeninitialarabic"] = 0xfeb7; 58458 t["sheenmedialarabic"] = 0xfeb8; 58459 t["sheicoptic"] = 0x03e3; 58460 t["sheqel"] = 0x20aa; 58461 t["sheqelhebrew"] = 0x20aa; 58462 t["sheva"] = 0x05b0; 58463 t["sheva115"] = 0x05b0; 58464 t["sheva15"] = 0x05b0; 58465 t["sheva22"] = 0x05b0; 58466 t["sheva2e"] = 0x05b0; 58467 t["shevahebrew"] = 0x05b0; 58468 t["shevanarrowhebrew"] = 0x05b0; 58469 t["shevaquarterhebrew"] = 0x05b0; 58470 t["shevawidehebrew"] = 0x05b0; 58471 t["shhacyrillic"] = 0x04bb; 58472 t["shimacoptic"] = 0x03ed; 58473 t["shin"] = 0x05e9; 58474 t["shindagesh"] = 0xfb49; 58475 t["shindageshhebrew"] = 0xfb49; 58476 t["shindageshshindot"] = 0xfb2c; 58477 t["shindageshshindothebrew"] = 0xfb2c; 58478 t["shindageshsindot"] = 0xfb2d; 58479 t["shindageshsindothebrew"] = 0xfb2d; 58480 t["shindothebrew"] = 0x05c1; 58481 t["shinhebrew"] = 0x05e9; 58482 t["shinshindot"] = 0xfb2a; 58483 t["shinshindothebrew"] = 0xfb2a; 58484 t["shinsindot"] = 0xfb2b; 58485 t["shinsindothebrew"] = 0xfb2b; 58486 t["shook"] = 0x0282; 58487 t["sigma"] = 0x03c3; 58488 t["sigma1"] = 0x03c2; 58489 t["sigmafinal"] = 0x03c2; 58490 t["sigmalunatesymbolgreek"] = 0x03f2; 58491 t["sihiragana"] = 0x3057; 58492 t["sikatakana"] = 0x30b7; 58493 t["sikatakanahalfwidth"] = 0xff7c; 58494 t["siluqhebrew"] = 0x05bd; 58495 t["siluqlefthebrew"] = 0x05bd; 58496 t["similar"] = 0x223c; 58497 t["sindothebrew"] = 0x05c2; 58498 t["siosacirclekorean"] = 0x3274; 58499 t["siosaparenkorean"] = 0x3214; 58500 t["sioscieuckorean"] = 0x317e; 58501 t["sioscirclekorean"] = 0x3266; 58502 t["sioskiyeokkorean"] = 0x317a; 58503 t["sioskorean"] = 0x3145; 58504 t["siosnieunkorean"] = 0x317b; 58505 t["siosparenkorean"] = 0x3206; 58506 t["siospieupkorean"] = 0x317d; 58507 t["siostikeutkorean"] = 0x317c; 58508 t["six"] = 0x0036;
58509 t["sixarabic"] = 0x0666; 58510 t["sixbengali"] = 0x09ec; 58511 t["sixcircle"] = 0x2465; 58512 t["sixcircleinversesansserif"] = 0x278f; 58513 t["sixdeva"] = 0x096c; 58514 t["sixgujarati"] = 0x0aec; 58515 t["sixgurmukhi"] = 0x0a6c; 58516 t["sixhackarabic"] = 0x0666; 58517 t["sixhangzhou"] = 0x3026; 58518 t["sixideographicparen"] = 0x3225; 58519 t["sixinferior"] = 0x2086; 58520 t["sixmonospace"] = 0xff16; 58521 t["sixoldstyle"] = 0xf736; 58522 t["sixparen"] = 0x2479; 58523 t["sixperiod"] = 0x248d; 58524 t["sixpersian"] = 0x06f6; 58525 t["sixroman"] = 0x2175; 58526 t["sixsuperior"] = 0x2076; 58527 t["sixteencircle"] = 0x246f; 58528 t["sixteencurrencydenominatorbengali"] = 0x09f9; 58529 t["sixteenparen"] = 0x2483; 58530 t["sixteenperiod"] = 0x2497; 58531 t["sixthai"] = 0x0e56; 58532 t["slash"] = 0x002f; 58533 t["slashmonospace"] = 0xff0f; 58534 t["slong"] = 0x017f; 58535 t["slongdotaccent"] = 0x1e9b; 58536 t["smileface"] = 0x263a; 58537 t["smonospace"] = 0xff53; 58538 t["sofpasuqhebrew"] = 0x05c3; 58539 t["softhyphen"] = 0x00ad; 58540 t["softsigncyrillic"] = 0x044c; 58541 t["sohiragana"] = 0x305d; 58542 t["sokatakana"] = 0x30bd; 58543 t["sokatakanahalfwidth"] = 0xff7f; 58544 t["soliduslongoverlaycmb"] = 0x0338; 58545 t["solidusshortoverlaycmb"] = 0x0337; 58546 t["sorusithai"] = 0x0e29; 58547 t["sosalathai"] = 0x0e28; 58548 t["sosothai"] = 0x0e0b; 58549 t["sosuathai"] = 0x0e2a; 58550 t["space"] = 0x0020; 58551 t["spacehackarabic"] = 0x0020; 58552 t["spade"] = 0x2660; 58553 t["spadesuitblack"] = 0x2660; 58554 t["spadesuitwhite"] = 0x2664; 58555 t["sparen"] = 0x24ae; 58556 t["squarebelowcmb"] = 0x033b; 58557 t["squarecc"] = 0x33c4; 58558 t["squarecm"] = 0x339d; 58559 t["squarediagonalcrosshatchfill"] = 0x25a9; 58560 t["squarehorizontalfill"] = 0x25a4; 58561 t["squarekg"] = 0x338f; 58562 t["squarekm"] = 0x339e; 58563 t["squarekmcapital"] = 0x33ce; 58564 t["squareln"] = 0x33d1; 58565 t["squarelog"] = 0x33d2; 58566 t["squaremg"] = 0x338e; 58567 t["squaremil"] = 0x33d5; 58568 t["squaremm"] = 0x339c; 58569 t["squaremsquared"] = 0x33a1; 58570 t["squareorthogonalcrosshatchfill"] = 0x25a6; 58571 t["squareupperlefttolowerrightfill"] = 0x25a7; 58572 t["squareupperrighttolowerleftfill"] = 0x25a8; 58573 t["squareverticalfill"] = 0x25a5; 58574 t["squarewhitewithsmallblack"] = 0x25a3; 58575 t["srsquare"] = 0x33db; 58576 t["ssabengali"] = 0x09b7; 58577 t["ssadeva"] = 0x0937; 58578 t["ssagujarati"] = 0x0ab7; 58579 t["ssangcieuckorean"] = 0x3149; 58580 t["ssanghieuhkorean"] = 0x3185; 58581 t["ssangieungkorean"] = 0x3180; 58582 t["ssangkiyeokkorean"] = 0x3132; 58583 t["ssangnieunkorean"] = 0x3165; 58584 t["ssangpieupkorean"] = 0x3143; 58585 t["ssangsioskorean"] = 0x3146; 58586 t["ssangtikeutkorean"] = 0x3138; 58587 t["ssuperior"] = 0xf6f2; 58588 t["sterling"] = 0x00a3; 58589 t["sterlingmonospace"] = 0xffe1; 58590 t["strokelongoverlaycmb"] = 0x0336; 58591 t["strokeshortoverlaycmb"] = 0x0335; 58592 t["subset"] = 0x2282; 58593 t["subsetnotequal"] = 0x228a; 58594 t["subsetorequal"] = 0x2286; 58595 t["succeeds"] = 0x227b; 58596 t["suchthat"] = 0x220b; 58597 t["suhiragana"] = 0x3059; 58598 t["sukatakana"] = 0x30b9; 58599 t["sukatakanahalfwidth"] = 0xff7d; 58600 t["sukunarabic"] = 0x0652; 58601 t["summation"] = 0x2211; 58602 t["sun"] = 0x263c; 58603 t["superset"] = 0x2283; 58604 t["supersetnotequal"] = 0x228b; 58605 t["supersetorequal"] = 0x2287; 58606 t["svsquare"] = 0x33dc; 58607 t["syouwaerasquare"] = 0x337c; 58608 t["t"] = 0x0074; 58609 t["tabengali"] = 0x09a4; 58610 t["tackdown"] = 0x22a4; 58611 t["tackleft"] = 0x22a3; 58612 t["tadeva"] = 0x0924; 58613 t["tagujarati"] = 0x0aa4; 58614 t["tagurmukhi"] = 0x0a24; 58615 t["taharabic"] = 0x0637; 58616 t["tahfinalarabic"] = 0xfec2; 58617 t["tahinitialarabic"] = 0xfec3; 58618 t["tahiragana"] = 0x305f; 58619 t["tahmedialarabic"] = 0xfec4; 58620 t["taisyouerasquare"] = 0x337d; 58621 t["takatakana"] = 0x30bf; 58622 t["takatakanahalfwidth"] = 0xff80; 58623 t["tatweelarabic"] = 0x0640; 58624 t["tau"] = 0x03c4; 58625 t["tav"] = 0x05ea; 58626 t["tavdages"] = 0xfb4a; 58627 t["tavdagesh"] = 0xfb4a; 58628 t["tavdageshhebrew"] = 0xfb4a; 58629 t["tavhebrew"] = 0x05ea; 58630 t["tbar"] = 0x0167; 58631 t["tbopomofo"] = 0x310a; 58632 t["tcaron"] = 0x0165; 58633 t["tccurl"] = 0x02a8; 58634 t["tcedilla"] = 0x0163; 58635 t["tcheharabic"] = 0x0686; 58636 t["tchehfinalarabic"] = 0xfb7b; 58637 t["tchehinitialarabic"] = 0xfb7c; 58638 t["tchehmedialarabic"] = 0xfb7d; 58639 t["tcircle"] = 0x24e3; 58640 t["tcircumflexbelow"] = 0x1e71; 58641 t["tcommaaccent"] = 0x0163; 58642 t["tdieresis"] = 0x1e97; 58643 t["tdotaccent"] = 0x1e6b; 58644 t["tdotbelow"] = 0x1e6d; 58645 t["tecyrillic"] = 0x0442; 58646 t["tedescendercyrillic"] = 0x04ad; 58647 t["teharabic"] = 0x062a; 58648 t["tehfinalarabic"] = 0xfe96;
58649 t["tehhahinitialarabic"] = 0xfca2; 58650 t["tehhahisolatedarabic"] = 0xfc0c; 58651 t["tehinitialarabic"] = 0xfe97; 58652 t["tehiragana"] = 0x3066; 58653 t["tehjeeminitialarabic"] = 0xfca1; 58654 t["tehjeemisolatedarabic"] = 0xfc0b; 58655 t["tehmarbutaarabic"] = 0x0629; 58656 t["tehmarbutafinalarabic"] = 0xfe94; 58657 t["tehmedialarabic"] = 0xfe98; 58658 t["tehmeeminitialarabic"] = 0xfca4; 58659 t["tehmeemisolatedarabic"] = 0xfc0e; 58660 t["tehnoonfinalarabic"] = 0xfc73; 58661 t["tekatakana"] = 0x30c6; 58662 t["tekatakanahalfwidth"] = 0xff83; 58663 t["telephone"] = 0x2121; 58664 t["telephoneblack"] = 0x260e; 58665 t["telishagedolahebrew"] = 0x05a0; 58666 t["telishaqetanahebrew"] = 0x05a9; 58667 t["tencircle"] = 0x2469; 58668 t["tenideographicparen"] = 0x3229; 58669 t["tenparen"] = 0x247d; 58670 t["tenperiod"] = 0x2491; 58671 t["tenroman"] = 0x2179; 58672 t["tesh"] = 0x02a7; 58673 t["tet"] = 0x05d8; 58674 t["tetdagesh"] = 0xfb38; 58675 t["tetdageshhebrew"] = 0xfb38; 58676 t["tethebrew"] = 0x05d8; 58677 t["tetsecyrillic"] = 0x04b5; 58678 t["tevirhebrew"] = 0x059b; 58679 t["tevirlefthebrew"] = 0x059b; 58680 t["thabengali"] = 0x09a5; 58681 t["thadeva"] = 0x0925; 58682 t["thagujarati"] = 0x0aa5; 58683 t["thagurmukhi"] = 0x0a25; 58684 t["thalarabic"] = 0x0630; 58685 t["thalfinalarabic"] = 0xfeac; 58686 t["thanthakhatlowleftthai"] = 0xf898; 58687 t["thanthakhatlowrightthai"] = 0xf897; 58688 t["thanthakhatthai"] = 0x0e4c; 58689 t["thanthakhatupperleftthai"] = 0xf896; 58690 t["theharabic"] = 0x062b; 58691 t["thehfinalarabic"] = 0xfe9a; 58692 t["thehinitialarabic"] = 0xfe9b; 58693 t["thehmedialarabic"] = 0xfe9c; 58694 t["thereexists"] = 0x2203; 58695 t["therefore"] = 0x2234; 58696 t["theta"] = 0x03b8; 58697 t["theta1"] = 0x03d1; 58698 t["thetasymbolgreek"] = 0x03d1; 58699 t["thieuthacirclekorean"] = 0x3279; 58700 t["thieuthaparenkorean"] = 0x3219; 58701 t["thieuthcirclekorean"] = 0x326b; 58702 t["thieuthkorean"] = 0x314c; 58703 t["thieuthparenkorean"] = 0x320b; 58704 t["thirteencircle"] = 0x246c; 58705 t["thirteenparen"] = 0x2480; 58706 t["thirteenperiod"] = 0x2494; 58707 t["thonangmonthothai"] = 0x0e11; 58708 t["thook"] = 0x01ad; 58709 t["thophuthaothai"] = 0x0e12; 58710 t["thorn"] = 0x00fe; 58711 t["thothahanthai"] = 0x0e17; 58712 t["thothanthai"] = 0x0e10; 58713 t["thothongthai"] = 0x0e18; 58714 t["thothungthai"] = 0x0e16; 58715 t["thousandcyrillic"] = 0x0482; 58716 t["thousandsseparatorarabic"] = 0x066c; 58717 t["thousandsseparatorpersian"] = 0x066c; 58718 t["three"] = 0x0033; 58719 t["threearabic"] = 0x0663; 58720 t["threebengali"] = 0x09e9; 58721 t["threecircle"] = 0x2462; 58722 t["threecircleinversesansserif"] = 0x278c; 58723 t["threedeva"] = 0x0969; 58724 t["threeeighths"] = 0x215c; 58725 t["threegujarati"] = 0x0ae9; 58726 t["threegurmukhi"] = 0x0a69; 58727 t["threehackarabic"] = 0x0663; 58728 t["threehangzhou"] = 0x3023; 58729 t["threeideographicparen"] = 0x3222; 58730 t["threeinferior"] = 0x2083; 58731 t["threemonospace"] = 0xff13; 58732 t["threenumeratorbengali"] = 0x09f6; 58733 t["threeoldstyle"] = 0xf733; 58734 t["threeparen"] = 0x2476; 58735 t["threeperiod"] = 0x248a; 58736 t["threepersian"] = 0x06f3; 58737 t["threequarters"] = 0x00be; 58738 t["threequartersemdash"] = 0xf6de; 58739 t["threeroman"] = 0x2172; 58740 t["threesuperior"] = 0x00b3; 58741 t["threethai"] = 0x0e53; 58742 t["thzsquare"] = 0x3394; 58743 t["tihiragana"] = 0x3061; 58744 t["tikatakana"] = 0x30c1; 58745 t["tikatakanahalfwidth"] = 0xff81; 58746 t["tikeutacirclekorean"] = 0x3270; 58747 t["tikeutaparenkorean"] = 0x3210; 58748 t["tikeutcirclekorean"] = 0x3262; 58749 t["tikeutkorean"] = 0x3137; 58750 t["tikeutparenkorean"] = 0x3202; 58751 t["tilde"] = 0x02dc; 58752 t["tildebelowcmb"] = 0x0330; 58753 t["tildecmb"] = 0x0303; 58754 t["tildecomb"] = 0x0303; 58755 t["tildedoublecmb"] = 0x0360; 58756 t["tildeoperator"] = 0x223c; 58757 t["tildeoverlaycmb"] = 0x0334; 58758 t["tildeverticalcmb"] = 0x033e; 58759 t["timescircle"] = 0x2297; 58760 t["tipehahebrew"] = 0x0596; 58761 t["tipehalefthebrew"] = 0x0596; 58762 t["tippigurmukhi"] = 0x0a70; 58763 t["titlocyrilliccmb"] = 0x0483; 58764 t["tiwnarmenian"] = 0x057f; 58765 t["tlinebelow"] = 0x1e6f; 58766 t["tmonospace"] = 0xff54; 58767 t["toarmenian"] = 0x0569; 58768 t["tohiragana"] = 0x3068; 58769 t["tokatakana"] = 0x30c8; 58770 t["tokatakanahalfwidth"] = 0xff84; 58771 t["tonebarextrahighmod"] = 0x02e5; 58772 t["tonebarextralowmod"] = 0x02e9; 58773 t["tonebarhighmod"] = 0x02e6; 58774 t["tonebarlowmod"] = 0x02e8; 58775 t["tonebarmidmod"] = 0x02e7; 58776 t["tonefive"] = 0x01bd; 58777 t["tonesix"] = 0x0185; 58778 t["tonetwo"] = 0x01a8; 58779 t["tonos"] = 0x0384; 58780 t["tonsquare"] = 0x3327; 58781 t["topatakthai"] = 0x0e0f; 58782 t["tortoiseshellbracketleft"] = 0x3014; 58783 t["tortoiseshellbracketleftsmall"] = 0xfe5d; 58784 t["tortoiseshellbracketleftvertical"] = 0xfe39; 58785 t["tortoiseshellbracketright"] = 0x3015; 58786 t["tortoiseshellbracketrightsmall"] = 0xfe5e; 58787 t["tortoiseshellbracketrightvertical"] = 0xfe3a; 58788 t["totaothai"] = 0x0e15; 58789 t["tpalatalhook"] = 0x01ab; 58790 t["tparen"] = 0x24af; 58791 t["trademark"] = 0x2122; 58792 t["trademarksans"] = 0xf8ea; 58793 t["trademarkserif"] = 0xf6db; 58794 t["tretroflexhook"] = 0x0288; 58795 t["triagdn"] = 0x25bc; 58796 t["triaglf"] = 0x25c4; 58797 t["triagrt"] = 0x25ba; 58798 t["triagup"] = 0x25b2; 58799 t["ts"] = 0x02a6; 58800 t["tsadi"] = 0x05e6; 58801 t["tsadidagesh"] = 0xfb46; 58802 t["tsadidageshhebrew"] = 0xfb46; 58803 t["tsadihebrew"] = 0x05e6; 58804 t["tsecyrillic"] = 0x0446; 58805 t["tsere"] = 0x05b5; 58806 t["tsere12"] = 0x05b5; 58807 t["tsere1e"] = 0x05b5; 58808 t["tsere2b"] = 0x05b5; 58809 t["tserehebrew"] = 0x05b5; 58810 t["tserenarrowhebrew"] = 0x05b5; 58811 t["tserequarterhebrew"] = 0x05b5; 58812 t["tserewidehebrew"] = 0x05b5; 58813 t["tshecyrillic"] = 0x045b; 58814 t["tsuperior"] = 0xf6f3; 58815 t["ttabengali"] = 0x099f; 58816 t["ttadeva"] = 0x091f; 58817 t["ttagujarati"] = 0x0a9f; 58818 t["ttagurmukhi"] = 0x0a1f;
58819 t["tteharabic"] = 0x0679; 58820 t["ttehfinalarabic"] = 0xfb67; 58821 t["ttehinitialarabic"] = 0xfb68; 58822 t["ttehmedialarabic"] = 0xfb69; 58823 t["tthabengali"] = 0x09a0; 58824 t["tthadeva"] = 0x0920; 58825 t["tthagujarati"] = 0x0aa0; 58826 t["tthagurmukhi"] = 0x0a20; 58827 t["tturned"] = 0x0287; 58828 t["tuhiragana"] = 0x3064; 58829 t["tukatakana"] = 0x30c4; 58830 t["tukatakanahalfwidth"] = 0xff82; 58831 t["tusmallhiragana"] = 0x3063; 58832 t["tusmallkatakana"] = 0x30c3; 58833 t["tusmallkatakanahalfwidth"] = 0xff6f; 58834 t["twelvecircle"] = 0x246b; 58835 t["twelveparen"] = 0x247f; 58836 t["twelveperiod"] = 0x2493; 58837 t["twelveroman"] = 0x217b; 58838 t["twentycircle"] = 0x2473; 58839 t["twentyhangzhou"] = 0x5344; 58840 t["twentyparen"] = 0x2487; 58841 t["twentyperiod"] = 0x249b; 58842 t["two"] = 0x0032; 58843 t["twoarabic"] = 0x0662; 58844 t["twobengali"] = 0x09e8; 58845 t["twocircle"] = 0x2461; 58846 t["twocircleinversesansserif"] = 0x278b; 58847 t["twodeva"] = 0x0968; 58848 t["twodotenleader"] = 0x2025; 58849 t["twodotleader"] = 0x2025; 58850 t["twodotleadervertical"] = 0xfe30; 58851 t["twogujarati"] = 0x0ae8; 58852 t["twogurmukhi"] = 0x0a68; 58853 t["twohackarabic"] = 0x0662; 58854 t["twohangzhou"] = 0x3022; 58855 t["twoideographicparen"] = 0x3221; 58856 t["twoinferior"] = 0x2082; 58857 t["twomonospace"] = 0xff12; 58858 t["twonumeratorbengali"] = 0x09f5; 58859 t["twooldstyle"] = 0xf732; 58860 t["twoparen"] = 0x2475; 58861 t["twoperiod"] = 0x2489; 58862 t["twopersian"] = 0x06f2; 58863 t["tworoman"] = 0x2171; 58864 t["twostroke"] = 0x01bb; 58865 t["twosuperior"] = 0x00b2; 58866 t["twothai"] = 0x0e52; 58867 t["twothirds"] = 0x2154; 58868 t["u"] = 0x0075; 58869 t["uacute"] = 0x00fa; 58870 t["ubar"] = 0x0289; 58871 t["ubengali"] = 0x0989; 58872 t["ubopomofo"] = 0x3128; 58873 t["ubreve"] = 0x016d; 58874 t["ucaron"] = 0x01d4; 58875 t["ucircle"] = 0x24e4; 58876 t["ucircumflex"] = 0x00fb; 58877 t["ucircumflexbelow"] = 0x1e77; 58878 t["ucyrillic"] = 0x0443; 58879 t["udattadeva"] = 0x0951; 58880 t["udblacute"] = 0x0171; 58881 t["udblgrave"] = 0x0215; 58882 t["udeva"] = 0x0909; 58883 t["udieresis"] = 0x00fc; 58884 t["udieresisacute"] = 0x01d8; 58885 t["udieresisbelow"] = 0x1e73; 58886 t["udieresiscaron"] = 0x01da; 58887 t["udieresiscyrillic"] = 0x04f1; 58888 t["udieresisgrave"] = 0x01dc; 58889 t["udieresismacron"] = 0x01d6; 58890 t["udotbelow"] = 0x1ee5; 58891 t["ugrave"] = 0x00f9; 58892 t["ugujarati"] = 0x0a89; 58893 t["ugurmukhi"] = 0x0a09; 58894 t["uhiragana"] = 0x3046; 58895 t["uhookabove"] = 0x1ee7; 58896 t["uhorn"] = 0x01b0; 58897 t["uhornacute"] = 0x1ee9; 58898 t["uhorndotbelow"] = 0x1ef1; 58899 t["uhorngrave"] = 0x1eeb; 58900 t["uhornhookabove"] = 0x1eed; 58901 t["uhorntilde"] = 0x1eef; 58902 t["uhungarumlaut"] = 0x0171; 58903 t["uhungarumlautcyrillic"] = 0x04f3; 58904 t["uinvertedbreve"] = 0x0217; 58905 t["ukatakana"] = 0x30a6; 58906 t["ukatakanahalfwidth"] = 0xff73; 58907 t["ukcyrillic"] = 0x0479; 58908 t["ukorean"] = 0x315c; 58909 t["umacron"] = 0x016b; 58910 t["umacroncyrillic"] = 0x04ef; 58911 t["umacrondieresis"] = 0x1e7b; 58912 t["umatragurmukhi"] = 0x0a41; 58913 t["umonospace"] = 0xff55; 58914 t["underscore"] = 0x005f; 58915 t["underscoredbl"] = 0x2017; 58916 t["underscoremonospace"] = 0xff3f; 58917 t["underscorevertical"] = 0xfe33; 58918 t["underscorewavy"] = 0xfe4f; 58919 t["union"] = 0x222a; 58920 t["universal"] = 0x2200; 58921 t["uogonek"] = 0x0173; 58922 t["uparen"] = 0x24b0; 58923 t["upblock"] = 0x2580; 58924 t["upperdothebrew"] = 0x05c4; 58925 t["upsilon"] = 0x03c5; 58926 t["upsilondieresis"] = 0x03cb; 58927 t["upsilondieresistonos"] = 0x03b0; 58928 t["upsilonlatin"] = 0x028a; 58929 t["upsilontonos"] = 0x03cd; 58930 t["uptackbelowcmb"] = 0x031d; 58931 t["uptackmod"] = 0x02d4; 58932 t["uragurmukhi"] = 0x0a73; 58933 t["uring"] = 0x016f; 58934 t["ushortcyrillic"] = 0x045e; 58935 t["usmallhiragana"] = 0x3045; 58936 t["usmallkatakana"] = 0x30a5; 58937 t["usmallkatakanahalfwidth"] = 0xff69; 58938 t["ustraightcyrillic"] = 0x04af; 58939 t["ustraightstrokecyrillic"] = 0x04b1; 58940 t["utilde"] = 0x0169; 58941 t["utildeacute"] = 0x1e79; 58942 t["utildebelow"] = 0x1e75; 58943 t["uubengali"] = 0x098a; 58944 t["uudeva"] = 0x090a; 58945 t["uugujarati"] = 0x0a8a; 58946 t["uugurmukhi"] = 0x0a0a; 58947 t["uumatragurmukhi"] = 0x0a42; 58948 t["uuvowelsignbengali"] = 0x09c2; 58949 t["uuvowelsigndeva"] = 0x0942; 58950 t["uuvowelsigngujarati"] = 0x0ac2; 58951 t["uvowelsignbengali"] = 0x09c1; 58952 t["uvowelsigndeva"] = 0x0941; 58953 t["uvowelsigngujarati"] = 0x0ac1; 58954 t["v"] = 0x0076; 58955 t["vadeva"] = 0x0935; 58956 t["vagujarati"] = 0x0ab5; 58957 t["vagurmukhi"] = 0x0a35; 58958 t["vakatakana"] = 0x30f7; 58959 t["vav"] = 0x05d5; 58960 t["vavdagesh"] = 0xfb35; 58961 t["vavdagesh65"] = 0xfb35; 58962 t["vavdageshhebrew"] = 0xfb35; 58963 t["vavhebrew"] = 0x05d5; 58964 t["vavholam"] = 0xfb4b; 58965 t["vavholamhebrew"] = 0xfb4b; 58966 t["vavvavhebrew"] = 0x05f0; 58967 t["vavyodhebrew"] = 0x05f1; 58968 t["vcircle"] = 0x24e5; 58969 t["vdotbelow"] = 0x1e7f; 58970 t["vecyrillic"] = 0x0432;
58971 t["veharabic"] = 0x06a4; 58972 t["vehfinalarabic"] = 0xfb6b; 58973 t["vehinitialarabic"] = 0xfb6c; 58974 t["vehmedialarabic"] = 0xfb6d; 58975 t["vekatakana"] = 0x30f9; 58976 t["venus"] = 0x2640; 58977 t["verticalbar"] = 0x007c; 58978 t["verticallineabovecmb"] = 0x030d; 58979 t["verticallinebelowcmb"] = 0x0329; 58980 t["verticallinelowmod"] = 0x02cc; 58981 t["verticallinemod"] = 0x02c8; 58982 t["vewarmenian"] = 0x057e; 58983 t["vhook"] = 0x028b; 58984 t["vikatakana"] = 0x30f8; 58985 t["viramabengali"] = 0x09cd; 58986 t["viramadeva"] = 0x094d; 58987 t["viramagujarati"] = 0x0acd; 58988 t["visargabengali"] = 0x0983; 58989 t["visargadeva"] = 0x0903; 58990 t["visargagujarati"] = 0x0a83; 58991 t["vmonospace"] = 0xff56; 58992 t["voarmenian"] = 0x0578; 58993 t["voicediterationhiragana"] = 0x309e; 58994 t["voicediterationkatakana"] = 0x30fe; 58995 t["voicedmarkkana"] = 0x309b; 58996 t["voicedmarkkanahalfwidth"] = 0xff9e; 58997 t["vokatakana"] = 0x30fa; 58998 t["vparen"] = 0x24b1; 58999 t["vtilde"] = 0x1e7d; 59000 t["vturned"] = 0x028c; 59001 t["vuhiragana"] = 0x3094; 59002 t["vukatakana"] = 0x30f4; 59003 t["w"] = 0x0077; 59004 t["wacute"] = 0x1e83; 59005 t["waekorean"] = 0x3159; 59006 t["wahiragana"] = 0x308f; 59007 t["wakatakana"] = 0x30ef; 59008 t["wakatakanahalfwidth"] = 0xff9c; 59009 t["wakorean"] = 0x3158; 59010 t["wasmallhiragana"] = 0x308e; 59011 t["wasmallkatakana"] = 0x30ee; 59012 t["wattosquare"] = 0x3357; 59013 t["wavedash"] = 0x301c; 59014 t["wavyunderscorevertical"] = 0xfe34; 59015 t["wawarabic"] = 0x0648; 59016 t["wawfinalarabic"] = 0xfeee; 59017 t["wawhamzaabovearabic"] = 0x0624; 59018 t["wawhamzaabovefinalarabic"] = 0xfe86; 59019 t["wbsquare"] = 0x33dd; 59020 t["wcircle"] = 0x24e6; 59021 t["wcircumflex"] = 0x0175; 59022 t["wdieresis"] = 0x1e85; 59023 t["wdotaccent"] = 0x1e87; 59024 t["wdotbelow"] = 0x1e89; 59025 t["wehiragana"] = 0x3091; 59026 t["weierstrass"] = 0x2118; 59027 t["wekatakana"] = 0x30f1; 59028 t["wekorean"] = 0x315e; 59029 t["weokorean"] = 0x315d; 59030 t["wgrave"] = 0x1e81; 59031 t["whitebullet"] = 0x25e6; 59032 t["whitecircle"] = 0x25cb; 59033 t["whitecircleinverse"] = 0x25d9; 59034 t["whitecornerbracketleft"] = 0x300e; 59035 t["whitecornerbracketleftvertical"] = 0xfe43; 59036 t["whitecornerbracketright"] = 0x300f; 59037 t["whitecornerbracketrightvertical"] = 0xfe44; 59038 t["whitediamond"] = 0x25c7; 59039 t["whitediamondcontainingblacksmalldiamond"] = 0x25c8; 59040 t["whitedownpointingsmalltriangle"] = 0x25bf; 59041 t["whitedownpointingtriangle"] = 0x25bd; 59042 t["whiteleftpointingsmalltriangle"] = 0x25c3; 59043 t["whiteleftpointingtriangle"] = 0x25c1; 59044 t["whitelenticularbracketleft"] = 0x3016; 59045 t["whitelenticularbracketright"] = 0x3017; 59046 t["whiterightpointingsmalltriangle"] = 0x25b9; 59047 t["whiterightpointingtriangle"] = 0x25b7; 59048 t["whitesmallsquare"] = 0x25ab; 59049 t["whitesmilingface"] = 0x263a; 59050 t["whitesquare"] = 0x25a1; 59051 t["whitestar"] = 0x2606; 59052 t["whitetelephone"] = 0x260f; 59053 t["whitetortoiseshellbracketleft"] = 0x3018; 59054 t["whitetortoiseshellbracketright"] = 0x3019; 59055 t["whiteuppointingsmalltriangle"] = 0x25b5; 59056 t["whiteuppointingtriangle"] = 0x25b3; 59057 t["wihiragana"] = 0x3090; 59058 t["wikatakana"] = 0x30f0; 59059 t["wikorean"] = 0x315f; 59060 t["wmonospace"] = 0xff57; 59061 t["wohiragana"] = 0x3092; 59062 t["wokatakana"] = 0x30f2; 59063 t["wokatakanahalfwidth"] = 0xff66; 59064 t["won"] = 0x20a9; 59065 t["wonmonospace"] = 0xffe6; 59066 t["wowaenthai"] = 0x0e27; 59067 t["wparen"] = 0x24b2; 59068 t["wring"] = 0x1e98; 59069 t["wsuperior"] = 0x02b7; 59070 t["wturned"] = 0x028d; 59071 t["wynn"] = 0x01bf; 59072 t["x"] = 0x0078; 59073 t["xabovecmb"] = 0x033d; 59074 t["xbopomofo"] = 0x3112; 59075 t["xcircle"] = 0x24e7; 59076 t["xdieresis"] = 0x1e8d; 59077 t["xdotaccent"] = 0x1e8b; 59078 t["xeharmenian"] = 0x056d; 59079 t["xi"] = 0x03be; 59080 t["xmonospace"] = 0xff58; 59081 t["xparen"] = 0x24b3; 59082 t["xsuperior"] = 0x02e3; 59083 t["y"] = 0x0079; 59084 t["yaadosquare"] = 0x334e; 59085 t["yabengali"] = 0x09af; 59086 t["yacute"] = 0x00fd; 59087 t["yadeva"] = 0x092f; 59088 t["yaekorean"] = 0x3152; 59089 t["yagujarati"] = 0x0aaf; 59090 t["yagurmukhi"] = 0x0a2f; 59091 t["yahiragana"] = 0x3084; 59092 t["yakatakana"] = 0x30e4; 59093 t["yakatakanahalfwidth"] = 0xff94; 59094 t["yakorean"] = 0x3151; 59095 t["yamakkanthai"] = 0x0e4e; 59096 t["yasmallhiragana"] = 0x3083; 59097 t["yasmallkatakana"] = 0x30e3; 59098 t["yasmallkatakanahalfwidth"] = 0xff6c; 59099 t["yatcyrillic"] = 0x0463; 59100 t["ycircle"] = 0x24e8; 59101 t["ycircumflex"] = 0x0177; 59102 t["ydieresis"] = 0x00ff; 59103 t["ydotaccent"] = 0x1e8f; 59104 t["ydotbelow"] = 0x1ef5; 59105 t["yeharabic"] = 0x064a; 59106 t["yehbarreearabic"] = 0x06d2;
59107 t["yehbarreefinalarabic"] = 0xfbaf; 59108 t["yehfinalarabic"] = 0xfef2; 59109 t["yehhamzaabovearabic"] = 0x0626; 59110 t["yehhamzaabovefinalarabic"] = 0xfe8a; 59111 t["yehhamzaaboveinitialarabic"] = 0xfe8b; 59112 t["yehhamzaabovemedialarabic"] = 0xfe8c; 59113 t["yehinitialarabic"] = 0xfef3; 59114 t["yehmedialarabic"] = 0xfef4; 59115 t["yehmeeminitialarabic"] = 0xfcdd; 59116 t["yehmeemisolatedarabic"] = 0xfc58; 59117 t["yehnoonfinalarabic"] = 0xfc94; 59118 t["yehthreedotsbelowarabic"] = 0x06d1; 59119 t["yekorean"] = 0x3156; 59120 t["yen"] = 0x00a5; 59121 t["yenmonospace"] = 0xffe5; 59122 t["yeokorean"] = 0x3155; 59123 t["yeorinhieuhkorean"] = 0x3186; 59124 t["yerahbenyomohebrew"] = 0x05aa; 59125 t["yerahbenyomolefthebrew"] = 0x05aa; 59126 t["yericyrillic"] = 0x044b; 59127 t["yerudieresiscyrillic"] = 0x04f9; 59128 t["yesieungkorean"] = 0x3181; 59129 t["yesieungpansioskorean"] = 0x3183; 59130 t["yesieungsioskorean"] = 0x3182; 59131 t["yetivhebrew"] = 0x059a; 59132 t["ygrave"] = 0x1ef3; 59133 t["yhook"] = 0x01b4; 59134 t["yhookabove"] = 0x1ef7; 59135 t["yiarmenian"] = 0x0575; 59136 t["yicyrillic"] = 0x0457; 59137 t["yikorean"] = 0x3162; 59138 t["yinyang"] = 0x262f; 59139 t["yiwnarmenian"] = 0x0582; 59140 t["ymonospace"] = 0xff59; 59141 t["yod"] = 0x05d9; 59142 t["yoddagesh"] = 0xfb39; 59143 t["yoddageshhebrew"] = 0xfb39; 59144 t["yodhebrew"] = 0x05d9; 59145 t["yodyodhebrew"] = 0x05f2; 59146 t["yodyodpatahhebrew"] = 0xfb1f; 59147 t["yohiragana"] = 0x3088; 59148 t["yoikorean"] = 0x3189; 59149 t["yokatakana"] = 0x30e8; 59150 t["yokatakanahalfwidth"] = 0xff96; 59151 t["yokorean"] = 0x315b; 59152 t["yosmallhiragana"] = 0x3087; 59153 t["yosmallkatakana"] = 0x30e7; 59154 t["yosmallkatakanahalfwidth"] = 0xff6e; 59155 t["yotgreek"] = 0x03f3; 59156 t["yoyaekorean"] = 0x3188; 59157 t["yoyakorean"] = 0x3187; 59158 t["yoyakthai"] = 0x0e22; 59159 t["yoyingthai"] = 0x0e0d; 59160 t["yparen"] = 0x24b4; 59161 t["ypogegrammeni"] = 0x037a; 59162 t["ypogegrammenigreekcmb"] = 0x0345; 59163 t["yr"] = 0x01a6; 59164 t["yring"] = 0x1e99; 59165 t["ysuperior"] = 0x02b8; 59166 t["ytilde"] = 0x1ef9; 59167 t["yturned"] = 0x028e; 59168 t["yuhiragana"] = 0x3086; 59169 t["yuikorean"] = 0x318c; 59170 t["yukatakana"] = 0x30e6; 59171 t["yukatakanahalfwidth"] = 0xff95; 59172 t["yukorean"] = 0x3160; 59173 t["yusbigcyrillic"] = 0x046b; 59174 t["yusbigiotifiedcyrillic"] = 0x046d; 59175 t["yuslittlecyrillic"] = 0x0467; 59176 t["yuslittleiotifiedcyrillic"] = 0x0469; 59177 t["yusmallhiragana"] = 0x3085; 59178 t["yusmallkatakana"] = 0x30e5; 59179 t["yusmallkatakanahalfwidth"] = 0xff6d; 59180 t["yuyekorean"] = 0x318b; 59181 t["yuyeokorean"] = 0x318a; 59182 t["yyabengali"] = 0x09df; 59183 t["yyadeva"] = 0x095f; 59184 t["z"] = 0x007a; 59185 t["zaarmenian"] = 0x0566; 59186 t["zacute"] = 0x017a; 59187 t["zadeva"] = 0x095b; 59188 t["zagurmukhi"] = 0x0a5b; 59189 t["zaharabic"] = 0x0638; 59190 t["zahfinalarabic"] = 0xfec6; 59191 t["zahinitialarabic"] = 0xfec7; 59192 t["zahiragana"] = 0x3056; 59193 t["zahmedialarabic"] = 0xfec8; 59194 t["zainarabic"] = 0x0632; 59195 t["zainfinalarabic"] = 0xfeb0; 59196 t["zakatakana"] = 0x30b6; 59197 t["zaqefgadolhebrew"] = 0x0595; 59198 t["zaqefqatanhebrew"] = 0x0594; 59199 t["zarqahebrew"] = 0x0598; 59200 t["zayin"] = 0x05d6; 59201 t["zayindagesh"] = 0xfb36; 59202 t["zayindageshhebrew"] = 0xfb36; 59203 t["zayinhebrew"] = 0x05d6; 59204 t["zbopomofo"] = 0x3117; 59205 t["zcaron"] = 0x017e; 59206 t["zcircle"] = 0x24e9; 59207 t["zcircumflex"] = 0x1e91; 59208 t["zcurl"] = 0x0291; 59209 t["zdot"] = 0x017c; 59210 t["zdotaccent"] = 0x017c; 59211 t["zdotbelow"] = 0x1e93; 59212 t["zecyrillic"] = 0x0437; 59213 t["zedescendercyrillic"] = 0x0499; 59214 t["zedieresiscyrillic"] = 0x04df; 59215 t["zehiragana"] = 0x305c; 59216 t["zekatakana"] = 0x30bc; 59217 t["zero"] = 0x0030; 59218 t["zeroarabic"] = 0x0660; 59219 t["zerobengali"] = 0x09e6; 59220 t["zerodeva"] = 0x0966; 59221 t["zerogujarati"] = 0x0ae6; 59222 t["zerogurmukhi"] = 0x0a66; 59223 t["zerohackarabic"] = 0x0660; 59224 t["zeroinferior"] = 0x2080; 59225 t["zeromonospace"] = 0xff10; 59226 t["zerooldstyle"] = 0xf730; 59227 t["zeropersian"] = 0x06f0; 59228 t["zerosuperior"] = 0x2070; 59229 t["zerothai"] = 0x0e50; 59230 t["zerowidthjoiner"] = 0xfeff; 59231 t["zerowidthnonjoiner"] = 0x200c; 59232 t["zerowidthspace"] = 0x200b; 59233 t["zeta"] = 0x03b6; 59234 t["zhbopomofo"] = 0x3113; 59235 t["zhearmenian"] = 0x056a; 59236 t["zhebrevecyrillic"] = 0x04c2; 59237 t["zhecyrillic"] = 0x0436; 59238 t["zhedescendercyrillic"] = 0x0497; 59239 t["zhedieresiscyrillic"] = 0x04dd; 59240 t["zihiragana"] = 0x3058; 59241 t["zikatakana"] = 0x30b8; 59242 t["zinorhebrew"] = 0x05ae; 59243 t["zlinebelow"] = 0x1e95; 59244 t["zmonospace"] = 0xff5a; 59245 t["zohiragana"] = 0x305e; 59246 t["zokatakana"] = 0x30be; 59247 t["zparen"] = 0x24b5; 59248 t["zretroflexhook"] = 0x0290; 59249 t["zstroke"] = 0x01b6; 59250 t["zuhiragana"] = 0x305a; 59251 t["zukatakana"] = 0x30ba;
59252 t[".notdef"] = 0x0000; 59253 t["angbracketleftbig"] = 0x2329; 59254 t["angbracketleftBig"] = 0x2329; 59255 t["angbracketleftbigg"] = 0x2329; 59256 t["angbracketleftBigg"] = 0x2329; 59257 t["angbracketrightBig"] = 0x232a; 59258 t["angbracketrightbig"] = 0x232a; 59259 t["angbracketrightBigg"] = 0x232a; 59260 t["angbracketrightbigg"] = 0x232a; 59261 t["arrowhookleft"] = 0x21aa; 59262 t["arrowhookright"] = 0x21a9; 59263 t["arrowlefttophalf"] = 0x21bc; 59264 t["arrowleftbothalf"] = 0x21bd; 59265 t["arrownortheast"] = 0x2197; 59266 t["arrownorthwest"] = 0x2196; 59267 t["arrowrighttophalf"] = 0x21c0; 59268 t["arrowrightbothalf"] = 0x21c1; 59269 t["arrowsoutheast"] = 0x2198; 59270 t["arrowsouthwest"] = 0x2199; 59271 t["backslashbig"] = 0x2216; 59272 t["backslashBig"] = 0x2216; 59273 t["backslashBigg"] = 0x2216; 59274 t["backslashbigg"] = 0x2216; 59275 t["bardbl"] = 0x2016; 59276 t["bracehtipdownleft"] = 0xfe37; 59277 t["bracehtipdownright"] = 0xfe37; 59278 t["bracehtipupleft"] = 0xfe38; 59279 t["bracehtipupright"] = 0xfe38; 59280 t["braceleftBig"] = 0x007b; 59281 t["braceleftbig"] = 0x007b; 59282 t["braceleftbigg"] = 0x007b; 59283 t["braceleftBigg"] = 0x007b; 59284 t["bracerightBig"] = 0x007d; 59285 t["bracerightbig"] = 0x007d; 59286 t["bracerightbigg"] = 0x007d; 59287 t["bracerightBigg"] = 0x007d; 59288 t["bracketleftbig"] = 0x005b; 59289 t["bracketleftBig"] = 0x005b; 59290 t["bracketleftbigg"] = 0x005b; 59291 t["bracketleftBigg"] = 0x005b; 59292 t["bracketrightBig"] = 0x005d; 59293 t["bracketrightbig"] = 0x005d; 59294 t["bracketrightbigg"] = 0x005d; 59295 t["bracketrightBigg"] = 0x005d; 59296 t["ceilingleftbig"] = 0x2308; 59297 t["ceilingleftBig"] = 0x2308; 59298 t["ceilingleftBigg"] = 0x2308; 59299 t["ceilingleftbigg"] = 0x2308; 59300 t["ceilingrightbig"] = 0x2309; 59301 t["ceilingrightBig"] = 0x2309; 59302 t["ceilingrightbigg"] = 0x2309; 59303 t["ceilingrightBigg"] = 0x2309; 59304 t["circledotdisplay"] = 0x2299; 59305 t["circledottext"] = 0x2299; 59306 t["circlemultiplydisplay"] = 0x2297; 59307 t["circlemultiplytext"] = 0x2297; 59308 t["circleplusdisplay"] = 0x2295; 59309 t["circleplustext"] = 0x2295; 59310 t["contintegraldisplay"] = 0x222e; 59311 t["contintegraltext"] = 0x222e; 59312 t["coproductdisplay"] = 0x2210; 59313 t["coproducttext"] = 0x2210; 59314 t["floorleftBig"] = 0x230a; 59315 t["floorleftbig"] = 0x230a; 59316 t["floorleftbigg"] = 0x230a; 59317 t["floorleftBigg"] = 0x230a; 59318 t["floorrightbig"] = 0x230b; 59319 t["floorrightBig"] = 0x230b; 59320 t["floorrightBigg"] = 0x230b; 59321 t["floorrightbigg"] = 0x230b; 59322 t["hatwide"] = 0x0302; 59323 t["hatwider"] = 0x0302; 59324 t["hatwidest"] = 0x0302; 59325 t["intercal"] = 0x1d40; 59326 t["integraldisplay"] = 0x222b; 59327 t["integraltext"] = 0x222b; 59328 t["intersectiondisplay"] = 0x22c2; 59329 t["intersectiontext"] = 0x22c2; 59330 t["logicalanddisplay"] = 0x2227; 59331 t["logicalandtext"] = 0x2227; 59332 t["logicalordisplay"] = 0x2228; 59333 t["logicalortext"] = 0x2228; 59334 t["parenleftBig"] = 0x0028; 59335 t["parenleftbig"] = 0x0028; 59336 t["parenleftBigg"] = 0x0028; 59337 t["parenleftbigg"] = 0x0028; 59338 t["parenrightBig"] = 0x0029; 59339 t["parenrightbig"] = 0x0029; 59340 t["parenrightBigg"] = 0x0029; 59341 t["parenrightbigg"] = 0x0029; 59342 t["prime"] = 0x2032; 59343 t["productdisplay"] = 0x220f; 59344 t["producttext"] = 0x220f; 59345 t["radicalbig"] = 0x221a; 59346 t["radicalBig"] = 0x221a; 59347 t["radicalBigg"] = 0x221a; 59348 t["radicalbigg"] = 0x221a; 59349 t["radicalbt"] = 0x221a; 59350 t["radicaltp"] = 0x221a; 59351 t["radicalvertex"] = 0x221a; 59352 t["slashbig"] = 0x002f; 59353 t["slashBig"] = 0x002f; 59354 t["slashBigg"] = 0x002f; 59355 t["slashbigg"] = 0x002f; 59356 t["summationdisplay"] = 0x2211; 59357 t["summationtext"] = 0x2211; 59358 t["tildewide"] = 0x02dc; 59359 t["tildewider"] = 0x02dc; 59360 t["tildewidest"] = 0x02dc; 59361 t["uniondisplay"] = 0x22c3; 59362 t["unionmultidisplay"] = 0x228e; 59363 t["unionmultitext"] = 0x228e; 59364 t["unionsqdisplay"] = 0x2294; 59365 t["unionsqtext"] = 0x2294; 59366 t["uniontext"] = 0x22c3; 59367 t["vextenddouble"] = 0x2225; 59368 t["vextendsingle"] = 0x2223; 59369}); 59370var getDingbatsGlyphsUnicode = getLookupTableFactory(function (t) { 59371 t["space"] = 0x0020; 59372 t["a1"] = 0x2701; 59373 t["a2"] = 0x2702; 59374 t["a202"] = 0x2703; 59375 t["a3"] = 0x2704; 59376 t["a4"] = 0x260e; 59377 t["a5"] = 0x2706; 59378 t["a119"] = 0x2707; 59379 t["a118"] = 0x2708; 59380 t["a117"] = 0x2709; 59381 t["a11"] = 0x261b; 59382 t["a12"] = 0x261e; 59383 t["a13"] = 0x270c; 59384 t["a14"] = 0x270d; 59385 t["a15"] = 0x270e; 59386 t["a16"] = 0x270f; 59387 t["a105"] = 0x2710; 59388 t["a17"] = 0x2711; 59389 t["a18"] = 0x2712; 59390 t["a19"] = 0x2713; 59391 t["a20"] = 0x2714; 59392 t["a21"] = 0x2715; 59393 t["a22"] = 0x2716; 59394 t["a23"] = 0x2717; 59395 t["a24"] = 0x2718; 59396 t["a25"] = 0x2719; 59397 t["a26"] = 0x271a; 59398 t["a27"] = 0x271b; 59399 t["a28"] = 0x271c; 59400 t["a6"] = 0x271d; 59401 t["a7"] = 0x271e; 59402 t["a8"] = 0x271f; 59403 t["a9"] = 0x2720; 59404 t["a10"] = 0x2721; 59405 t["a29"] = 0x2722; 59406 t["a30"] = 0x2723; 59407 t["a31"] = 0x2724; 59408 t["a32"] = 0x2725; 59409 t["a33"] = 0x2726; 59410 t["a34"] = 0x2727; 59411 t["a35"] = 0x2605; 59412 t["a36"] = 0x2729; 59413 t["a37"] = 0x272a; 59414 t["a38"] = 0x272b; 59415 t["a39"] = 0x272c; 59416 t["a40"] = 0x272d; 59417 t["a41"] = 0x272e; 59418 t["a42"] = 0x272f; 59419 t["a43"] = 0x2730; 59420 t["a44"] = 0x2731; 59421 t["a45"] = 0x2732; 59422 t["a46"] = 0x2733; 59423 t["a47"] = 0x2734; 59424 t["a48"] = 0x2735; 59425 t["a49"] = 0x2736; 59426 t["a50"] = 0x2737; 59427 t["a51"] = 0x2738; 59428 t["a52"] = 0x2739; 59429 t["a53"] = 0x273a; 59430 t["a54"] = 0x273b; 59431 t["a55"] = 0x273c; 59432 t["a56"] = 0x273d; 59433 t["a57"] = 0x273e; 59434 t["a58"] = 0x273f; 59435 t["a59"] = 0x2740; 59436 t["a60"] = 0x2741; 59437 t["a61"] = 0x2742; 59438 t["a62"] = 0x2743; 59439 t["a63"] = 0x2744; 59440 t["a64"] = 0x2745; 59441 t["a65"] = 0x2746; 59442 t["a66"] = 0x2747; 59443 t["a67"] = 0x2748; 59444 t["a68"] = 0x2749; 59445 t["a69"] = 0x274a; 59446 t["a70"] = 0x274b; 59447 t["a71"] = 0x25cf; 59448 t["a72"] = 0x274d; 59449 t["a73"] = 0x25a0; 59450 t["a74"] = 0x274f; 59451 t["a203"] = 0x2750; 59452 t["a75"] = 0x2751; 59453 t["a204"] = 0x2752; 59454 t["a76"] = 0x25b2; 59455 t["a77"] = 0x25bc; 59456 t["a78"] = 0x25c6; 59457 t["a79"] = 0x2756; 59458 t["a81"] = 0x25d7; 59459 t["a82"] = 0x2758; 59460 t["a83"] = 0x2759; 59461 t["a84"] = 0x275a; 59462 t["a97"] = 0x275b; 59463 t["a98"] = 0x275c; 59464 t["a99"] = 0x275d; 59465 t["a100"] = 0x275e; 59466 t["a101"] = 0x2761; 59467 t["a102"] = 0x2762; 59468 t["a103"] = 0x2763; 59469 t["a104"] = 0x2764; 59470 t["a106"] = 0x2765; 59471 t["a107"] = 0x2766; 59472 t["a108"] = 0x2767; 59473 t["a112"] = 0x2663; 59474 t["a111"] = 0x2666; 59475 t["a110"] = 0x2665; 59476 t["a109"] = 0x2660; 59477 t["a120"] = 0x2460; 59478 t["a121"] = 0x2461; 59479 t["a122"] = 0x2462; 59480 t["a123"] = 0x2463; 59481 t["a124"] = 0x2464;
59482 t["a125"] = 0x2465; 59483 t["a126"] = 0x2466; 59484 t["a127"] = 0x2467; 59485 t["a128"] = 0x2468; 59486 t["a129"] = 0x2469; 59487 t["a130"] = 0x2776; 59488 t["a131"] = 0x2777; 59489 t["a132"] = 0x2778; 59490 t["a133"] = 0x2779; 59491 t["a134"] = 0x277a; 59492 t["a135"] = 0x277b; 59493 t["a136"] = 0x277c; 59494 t["a137"] = 0x277d; 59495 t["a138"] = 0x277e; 59496 t["a139"] = 0x277f; 59497 t["a140"] = 0x2780; 59498 t["a141"] = 0x2781; 59499 t["a142"] = 0x2782; 59500 t["a143"] = 0x2783; 59501 t["a144"] = 0x2784; 59502 t["a145"] = 0x2785; 59503 t["a146"] = 0x2786; 59504 t["a147"] = 0x2787; 59505 t["a148"] = 0x2788; 59506 t["a149"] = 0x2789; 59507 t["a150"] = 0x278a; 59508 t["a151"] = 0x278b; 59509 t["a152"] = 0x278c; 59510 t["a153"] = 0x278d; 59511 t["a154"] = 0x278e; 59512 t["a155"] = 0x278f; 59513 t["a156"] = 0x2790; 59514 t["a157"] = 0x2791; 59515 t["a158"] = 0x2792; 59516 t["a159"] = 0x2793; 59517 t["a160"] = 0x2794; 59518 t["a161"] = 0x2192; 59519 t["a163"] = 0x2194; 59520 t["a164"] = 0x2195; 59521 t["a196"] = 0x2798; 59522 t["a165"] = 0x2799; 59523 t["a192"] = 0x279a; 59524 t["a166"] = 0x279b; 59525 t["a167"] = 0x279c; 59526 t["a168"] = 0x279d; 59527 t["a169"] = 0x279e; 59528 t["a170"] = 0x279f; 59529 t["a171"] = 0x27a0; 59530 t["a172"] = 0x27a1; 59531 t["a173"] = 0x27a2; 59532 t["a162"] = 0x27a3; 59533 t["a174"] = 0x27a4; 59534 t["a175"] = 0x27a5; 59535 t["a176"] = 0x27a6; 59536 t["a177"] = 0x27a7; 59537 t["a178"] = 0x27a8; 59538 t["a179"] = 0x27a9; 59539 t["a193"] = 0x27aa; 59540 t["a180"] = 0x27ab; 59541 t["a199"] = 0x27ac; 59542 t["a181"] = 0x27ad; 59543 t["a200"] = 0x27ae; 59544 t["a182"] = 0x27af; 59545 t["a201"] = 0x27b1; 59546 t["a183"] = 0x27b2; 59547 t["a184"] = 0x27b3; 59548 t["a197"] = 0x27b4; 59549 t["a185"] = 0x27b5; 59550 t["a194"] = 0x27b6; 59551 t["a198"] = 0x27b7; 59552 t["a186"] = 0x27b8; 59553 t["a195"] = 0x27b9; 59554 t["a187"] = 0x27ba; 59555 t["a188"] = 0x27bb; 59556 t["a189"] = 0x27bc; 59557 t["a190"] = 0x27bd; 59558 t["a191"] = 0x27be; 59559 t["a89"] = 0x2768; 59560 t["a90"] = 0x2769; 59561 t["a93"] = 0x276a; 59562 t["a94"] = 0x276b; 59563 t["a91"] = 0x276c; 59564 t["a92"] = 0x276d; 59565 t["a205"] = 0x276e; 59566 t["a85"] = 0x276f; 59567 t["a206"] = 0x2770; 59568 t["a86"] = 0x2771; 59569 t["a87"] = 0x2772; 59570 t["a88"] = 0x2773; 59571 t["a95"] = 0x2774; 59572 t["a96"] = 0x2775; 59573 t[".notdef"] = 0x0000; 59574}); 59575exports.getGlyphsUnicode = getGlyphsUnicode; 59576exports.getDingbatsGlyphsUnicode = getDingbatsGlyphsUnicode; 59577 59578/***/ }), 59579/* 32 */ 59580/***/ (function(module, exports, __w_pdfjs_require__) { 59581 59582"use strict"; 59583 59584 59585Object.defineProperty(exports, "__esModule", { 59586 value: true 59587}); 59588exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getGlyphMapForStandardFonts = exports.getSymbolsFonts = exports.getSerifFonts = exports.getNonStdFontMap = exports.getStdFontMap = void 0; 59589 59590var _core_utils = __w_pdfjs_require__(7); 59591 59592const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) { 59593 t["ArialNarrow"] = "Helvetica"; 59594 t["ArialNarrow-Bold"] = "Helvetica-Bold"; 59595 t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique"; 59596 t["ArialNarrow-Italic"] = "Helvetica-Oblique"; 59597 t["ArialBlack"] = "Helvetica"; 59598 t["ArialBlack-Bold"] = "Helvetica-Bold"; 59599 t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique"; 59600 t["ArialBlack-Italic"] = "Helvetica-Oblique"; 59601 t["Arial-Black"] = "Helvetica"; 59602 t["Arial-Black-Bold"] = "Helvetica-Bold"; 59603 t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique"; 59604 t["Arial-Black-Italic"] = "Helvetica-Oblique"; 59605 t["Arial"] = "Helvetica"; 59606 t["Arial-Bold"] = "Helvetica-Bold"; 59607 t["Arial-BoldItalic"] = "Helvetica-BoldOblique"; 59608 t["Arial-Italic"] = "Helvetica-Oblique"; 59609 t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique"; 59610 t["Arial-BoldMT"] = "Helvetica-Bold"; 59611 t["Arial-ItalicMT"] = "Helvetica-Oblique"; 59612 t["ArialMT"] = "Helvetica"; 59613 t["Courier-Bold"] = "Courier-Bold"; 59614 t["Courier-BoldItalic"] = "Courier-BoldOblique"; 59615 t["Courier-Italic"] = "Courier-Oblique"; 59616 t["CourierNew"] = "Courier"; 59617 t["CourierNew-Bold"] = "Courier-Bold"; 59618 t["CourierNew-BoldItalic"] = "Courier-BoldOblique"; 59619 t["CourierNew-Italic"] = "Courier-Oblique"; 59620 t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique"; 59621 t["CourierNewPS-BoldMT"] = "Courier-Bold"; 59622 t["CourierNewPS-ItalicMT"] = "Courier-Oblique"; 59623 t["CourierNewPSMT"] = "Courier"; 59624 t["Helvetica"] = "Helvetica"; 59625 t["Helvetica-Bold"] = "Helvetica-Bold"; 59626 t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique"; 59627 t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique"; 59628 t["Helvetica-Italic"] = "Helvetica-Oblique"; 59629 t["Helvetica-Oblique"] = "Helvetica-Oblique";
59630 t["Symbol-Bold"] = "Symbol"; 59631 t["Symbol-BoldItalic"] = "Symbol"; 59632 t["Symbol-Italic"] = "Symbol"; 59633 t["TimesNewRoman"] = "Times-Roman"; 59634 t["TimesNewRoman-Bold"] = "Times-Bold"; 59635 t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic"; 59636 t["TimesNewRoman-Italic"] = "Times-Italic"; 59637 t["TimesNewRomanPS"] = "Times-Roman"; 59638 t["TimesNewRomanPS-Bold"] = "Times-Bold"; 59639 t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic"; 59640 t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic"; 59641 t["TimesNewRomanPS-BoldMT"] = "Times-Bold"; 59642 t["TimesNewRomanPS-Italic"] = "Times-Italic"; 59643 t["TimesNewRomanPS-ItalicMT"] = "Times-Italic"; 59644 t["TimesNewRomanPSMT"] = "Times-Roman"; 59645 t["TimesNewRomanPSMT-Bold"] = "Times-Bold"; 59646 t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic"; 59647 t["TimesNewRomanPSMT-Italic"] = "Times-Italic"; 59648}); 59649exports.getStdFontMap = getStdFontMap; 59650const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) { 59651 t["Calibri"] = "Helvetica"; 59652 t["Calibri-Bold"] = "Helvetica-Bold"; 59653 t["Calibri-BoldItalic"] = "Helvetica-BoldOblique"; 59654 t["Calibri-Italic"] = "Helvetica-Oblique"; 59655 t["CenturyGothic"] = "Helvetica"; 59656 t["CenturyGothic-Bold"] = "Helvetica-Bold"; 59657 t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique"; 59658 t["CenturyGothic-Italic"] = "Helvetica-Oblique"; 59659 t["ComicSansMS"] = "Comic Sans MS"; 59660 t["ComicSansMS-Bold"] = "Comic Sans MS-Bold"; 59661 t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic"; 59662 t["ComicSansMS-Italic"] = "Comic Sans MS-Italic"; 59663 t["LucidaConsole"] = "Courier"; 59664 t["LucidaConsole-Bold"] = "Courier-Bold"; 59665 t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique"; 59666 t["LucidaConsole-Italic"] = "Courier-Oblique"; 59667 t["LucidaSans-Demi"] = "Helvetica-Bold"; 59668 t["MS-Gothic"] = "MS Gothic"; 59669 t["MS-Gothic-Bold"] = "MS Gothic-Bold"; 59670 t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic"; 59671 t["MS-Gothic-Italic"] = "MS Gothic-Italic"; 59672 t["MS-Mincho"] = "MS Mincho"; 59673 t["MS-Mincho-Bold"] = "MS Mincho-Bold"; 59674 t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic"; 59675 t["MS-Mincho-Italic"] = "MS Mincho-Italic"; 59676 t["MS-PGothic"] = "MS PGothic"; 59677 t["MS-PGothic-Bold"] = "MS PGothic-Bold"; 59678 t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic"; 59679 t["MS-PGothic-Italic"] = "MS PGothic-Italic"; 59680 t["MS-PMincho"] = "MS PMincho"; 59681 t["MS-PMincho-Bold"] = "MS PMincho-Bold"; 59682 t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic"; 59683 t["MS-PMincho-Italic"] = "MS PMincho-Italic"; 59684 t["NuptialScript"] = "Times-Italic"; 59685 t["SegoeUISymbol"] = "Helvetica"; 59686 t["Wingdings"] = "ZapfDingbats"; 59687 t["Wingdings-Regular"] = "ZapfDingbats"; 59688}); 59689exports.getNonStdFontMap = getNonStdFontMap; 59690const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) { 59691 t["Adobe Jenson"] = true; 59692 t["Adobe Text"] = true; 59693 t["Albertus"] = true; 59694 t["Aldus"] = true; 59695 t["Alexandria"] = true; 59696 t["Algerian"] = true; 59697 t["American Typewriter"] = true; 59698 t["Antiqua"] = true; 59699 t["Apex"] = true; 59700 t["Arno"] = true; 59701 t["Aster"] = true; 59702 t["Aurora"] = true; 59703 t["Baskerville"] = true; 59704 t["Bell"] = true; 59705 t["Bembo"] = true; 59706 t["Bembo Schoolbook"] = true; 59707 t["Benguiat"] = true; 59708 t["Berkeley Old Style"] = true; 59709 t["Bernhard Modern"] = true; 59710 t["Berthold City"] = true; 59711 t["Bodoni"] = true; 59712 t["Bauer Bodoni"] = true; 59713 t["Book Antiqua"] = true; 59714 t["Bookman"] = true; 59715 t["Bordeaux Roman"] = true; 59716 t["Californian FB"] = true; 59717 t["Calisto"] = true; 59718 t["Calvert"] = true; 59719 t["Capitals"] = true; 59720 t["Cambria"] = true; 59721 t["Cartier"] = true; 59722 t["Caslon"] = true; 59723 t["Catull"] = true; 59724 t["Centaur"] = true; 59725 t["Century Old Style"] = true; 59726 t["Century Schoolbook"] = true; 59727 t["Chaparral"] = true; 59728 t["Charis SIL"] = true; 59729 t["Cheltenham"] = true; 59730 t["Cholla Slab"] = true; 59731 t["Clarendon"] = true; 59732 t["Clearface"] = true; 59733 t["Cochin"] = true; 59734 t["Colonna"] = true; 59735 t["Computer Modern"] = true; 59736 t["Concrete Roman"] = true; 59737 t["Constantia"] = true; 59738 t["Cooper Black"] = true; 59739 t["Corona"] = true; 59740 t["Ecotype"] = true; 59741 t["Egyptienne"] = true; 59742 t["Elephant"] = true; 59743 t["Excelsior"] = true; 59744 t["Fairfield"] = true;
59745 t["FF Scala"] = true; 59746 t["Folkard"] = true; 59747 t["Footlight"] = true; 59748 t["FreeSerif"] = true; 59749 t["Friz Quadrata"] = true; 59750 t["Garamond"] = true; 59751 t["Gentium"] = true; 59752 t["Georgia"] = true; 59753 t["Gloucester"] = true; 59754 t["Goudy Old Style"] = true; 59755 t["Goudy Schoolbook"] = true; 59756 t["Goudy Pro Font"] = true; 59757 t["Granjon"] = true; 59758 t["Guardian Egyptian"] = true; 59759 t["Heather"] = true; 59760 t["Hercules"] = true; 59761 t["High Tower Text"] = true; 59762 t["Hiroshige"] = true; 59763 t["Hoefler Text"] = true; 59764 t["Humana Serif"] = true; 59765 t["Imprint"] = true; 59766 t["Ionic No. 5"] = true; 59767 t["Janson"] = true; 59768 t["Joanna"] = true; 59769 t["Korinna"] = true; 59770 t["Lexicon"] = true; 59771 t["Liberation Serif"] = true; 59772 t["Linux Libertine"] = true; 59773 t["Literaturnaya"] = true; 59774 t["Lucida"] = true; 59775 t["Lucida Bright"] = true; 59776 t["Melior"] = true; 59777 t["Memphis"] = true; 59778 t["Miller"] = true; 59779 t["Minion"] = true; 59780 t["Modern"] = true; 59781 t["Mona Lisa"] = true; 59782 t["Mrs Eaves"] = true; 59783 t["MS Serif"] = true; 59784 t["Museo Slab"] = true; 59785 t["New York"] = true; 59786 t["Nimbus Roman"] = true; 59787 t["NPS Rawlinson Roadway"] = true; 59788 t["NuptialScript"] = true; 59789 t["Palatino"] = true; 59790 t["Perpetua"] = true; 59791 t["Plantin"] = true; 59792 t["Plantin Schoolbook"] = true; 59793 t["Playbill"] = true; 59794 t["Poor Richard"] = true; 59795 t["Rawlinson Roadway"] = true; 59796 t["Renault"] = true; 59797 t["Requiem"] = true; 59798 t["Rockwell"] = true; 59799 t["Roman"] = true; 59800 t["Rotis Serif"] = true; 59801 t["Sabon"] = true; 59802 t["Scala"] = true; 59803 t["Seagull"] = true; 59804 t["Sistina"] = true; 59805 t["Souvenir"] = true; 59806 t["STIX"] = true; 59807 t["Stone Informal"] = true; 59808 t["Stone Serif"] = true; 59809 t["Sylfaen"] = true; 59810 t["Times"] = true; 59811 t["Trajan"] = true; 59812 t["Trinité"] = true; 59813 t["Trump Mediaeval"] = true; 59814 t["Utopia"] = true; 59815 t["Vale Type"] = true; 59816 t["Bitstream Vera"] = true; 59817 t["Vera Serif"] = true; 59818 t["Versailles"] = true; 59819 t["Wanted"] = true; 59820 t["Weiss"] = true; 59821 t["Wide Latin"] = true; 59822 t["Windsor"] = true; 59823 t["XITS"] = true; 59824}); 59825exports.getSerifFonts = getSerifFonts; 59826const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) { 59827 t["Dingbats"] = true; 59828 t["Symbol"] = true; 59829 t["ZapfDingbats"] = true; 59830}); 59831exports.getSymbolsFonts = getSymbolsFonts; 59832const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) { 59833 t[2] = 10; 59834 t[3] = 32; 59835 t[4] = 33; 59836 t[5] = 34; 59837 t[6] = 35; 59838 t[7] = 36; 59839 t[8] = 37; 59840 t[9] = 38; 59841 t[10] = 39; 59842 t[11] = 40; 59843 t[12] = 41; 59844 t[13] = 42; 59845 t[14] = 43; 59846 t[15] = 44; 59847 t[16] = 45; 59848 t[17] = 46; 59849 t[18] = 47; 59850 t[19] = 48; 59851 t[20] = 49; 59852 t[21] = 50; 59853 t[22] = 51; 59854 t[23] = 52; 59855 t[24] = 53; 59856 t[25] = 54; 59857 t[26] = 55; 59858 t[27] = 56; 59859 t[28] = 57; 59860 t[29] = 58; 59861 t[30] = 894; 59862 t[31] = 60; 59863 t[32] = 61; 59864 t[33] = 62; 59865 t[34] = 63; 59866 t[35] = 64; 59867 t[36] = 65; 59868 t[37] = 66; 59869 t[38] = 67; 59870 t[39] = 68; 59871 t[40] = 69; 59872 t[41] = 70; 59873 t[42] = 71; 59874 t[43] = 72; 59875 t[44] = 73; 59876 t[45] = 74; 59877 t[46] = 75; 59878 t[47] = 76; 59879 t[48] = 77; 59880 t[49] = 78; 59881 t[50] = 79; 59882 t[51] = 80; 59883 t[52] = 81; 59884 t[53] = 82; 59885 t[54] = 83; 59886 t[55] = 84; 59887 t[56] = 85; 59888 t[57] = 86; 59889 t[58] = 87; 59890 t[59] = 88; 59891 t[60] = 89; 59892 t[61] = 90; 59893 t[62] = 91; 59894 t[63] = 92; 59895 t[64] = 93; 59896 t[65] = 94; 59897 t[66] = 95; 59898 t[67] = 96; 59899 t[68] = 97; 59900 t[69] = 98; 59901 t[70] = 99; 59902 t[71] = 100; 59903 t[72] = 101; 59904 t[73] = 102; 59905 t[74] = 103; 59906 t[75] = 104; 59907 t[76] = 105; 59908 t[77] = 106; 59909 t[78] = 107; 59910 t[79] = 108; 59911 t[80] = 109; 59912 t[81] = 110; 59913 t[82] = 111; 59914 t[83] = 112; 59915 t[84] = 113; 59916 t[85] = 114; 59917 t[86] = 115; 59918 t[87] = 116; 59919 t[88] = 117; 59920 t[89] = 118; 59921 t[90] = 119; 59922 t[91] = 120; 59923 t[92] = 121; 59924 t[93] = 122; 59925 t[94] = 123; 59926 t[95] = 124; 59927 t[96] = 125; 59928 t[97] = 126; 59929 t[98] = 196; 59930 t[99] = 197; 59931 t[100] = 199; 59932 t[101] = 201; 59933 t[102] = 209; 59934 t[103] = 214; 59935 t[104] = 220; 59936 t[105] = 225; 59937 t[106] = 224; 59938 t[107] = 226; 59939 t[108] = 228; 59940 t[109] = 227; 59941 t[110] = 229; 59942 t[111] = 231; 59943 t[112] = 233; 59944 t[113] = 232; 59945 t[114] = 234; 59946 t[115] = 235; 59947 t[116] = 237; 59948 t[117] = 236; 59949 t[118] = 238; 59950 t[119] = 239; 59951 t[120] = 241; 59952 t[121] = 243; 59953 t[122] = 242; 59954 t[123] = 244;
59955 t[124] = 246; 59956 t[125] = 245; 59957 t[126] = 250; 59958 t[127] = 249; 59959 t[128] = 251; 59960 t[129] = 252; 59961 t[130] = 8224; 59962 t[131] = 176; 59963 t[132] = 162; 59964 t[133] = 163; 59965 t[134] = 167; 59966 t[135] = 8226; 59967 t[136] = 182; 59968 t[137] = 223; 59969 t[138] = 174; 59970 t[139] = 169; 59971 t[140] = 8482; 59972 t[141] = 180; 59973 t[142] = 168; 59974 t[143] = 8800; 59975 t[144] = 198; 59976 t[145] = 216; 59977 t[146] = 8734; 59978 t[147] = 177; 59979 t[148] = 8804; 59980 t[149] = 8805; 59981 t[150] = 165; 59982 t[151] = 181; 59983 t[152] = 8706; 59984 t[153] = 8721; 59985 t[154] = 8719; 59986 t[156] = 8747; 59987 t[157] = 170; 59988 t[158] = 186; 59989 t[159] = 8486; 59990 t[160] = 230; 59991 t[161] = 248; 59992 t[162] = 191; 59993 t[163] = 161; 59994 t[164] = 172; 59995 t[165] = 8730; 59996 t[166] = 402; 59997 t[167] = 8776; 59998 t[168] = 8710; 59999 t[169] = 171; 60000 t[170] = 187; 60001 t[171] = 8230; 60002 t[210] = 218; 60003 t[223] = 711; 60004 t[224] = 321; 60005 t[225] = 322; 60006 t[227] = 353; 60007 t[229] = 382; 60008 t[234] = 253; 60009 t[252] = 263; 60010 t[253] = 268; 60011 t[254] = 269; 60012 t[258] = 258; 60013 t[260] = 260; 60014 t[261] = 261; 60015 t[265] = 280; 60016 t[266] = 281; 60017 t[268] = 283; 60018 t[269] = 313; 60019 t[275] = 323; 60020 t[276] = 324; 60021 t[278] = 328; 60022 t[284] = 345; 60023 t[285] = 346; 60024 t[286] = 347; 60025 t[292] = 367; 60026 t[295] = 377; 60027 t[296] = 378; 60028 t[298] = 380; 60029 t[305] = 963; 60030 t[306] = 964; 60031 t[307] = 966; 60032 t[308] = 8215; 60033 t[309] = 8252; 60034 t[310] = 8319; 60035 t[311] = 8359; 60036 t[312] = 8592; 60037 t[313] = 8593; 60038 t[337] = 9552; 60039 t[493] = 1039; 60040 t[494] = 1040; 60041 t[705] = 1524; 60042 t[706] = 8362; 60043 t[710] = 64288; 60044 t[711] = 64298; 60045 t[759] = 1617; 60046 t[761] = 1776; 60047 t[763] = 1778; 60048 t[775] = 1652; 60049 t[777] = 1764; 60050 t[778] = 1780; 60051 t[779] = 1781; 60052 t[780] = 1782; 60053 t[782] = 771; 60054 t[783] = 64726; 60055 t[786] = 8363; 60056 t[788] = 8532; 60057 t[790] = 768; 60058 t[791] = 769; 60059 t[792] = 768; 60060 t[795] = 803; 60061 t[797] = 64336; 60062 t[798] = 64337; 60063 t[799] = 64342; 60064 t[800] = 64343; 60065 t[801] = 64344; 60066 t[802] = 64345; 60067 t[803] = 64362; 60068 t[804] = 64363; 60069 t[805] = 64364; 60070 t[2424] = 7821; 60071 t[2425] = 7822; 60072 t[2426] = 7823; 60073 t[2427] = 7824; 60074 t[2428] = 7825; 60075 t[2429] = 7826; 60076 t[2430] = 7827; 60077 t[2433] = 7682; 60078 t[2678] = 8045; 60079 t[2679] = 8046; 60080 t[2830] = 1552; 60081 t[2838] = 686; 60082 t[2840] = 751; 60083 t[2842] = 753; 60084 t[2843] = 754; 60085 t[2844] = 755; 60086 t[2846] = 757; 60087 t[2856] = 767; 60088 t[2857] = 848; 60089 t[2858] = 849; 60090 t[2862] = 853; 60091 t[2863] = 854; 60092 t[2864] = 855; 60093 t[2865] = 861; 60094 t[2866] = 862; 60095 t[2906] = 7460; 60096 t[2908] = 7462; 60097 t[2909] = 7463; 60098 t[2910] = 7464; 60099 t[2912] = 7466; 60100 t[2913] = 7467; 60101 t[2914] = 7468; 60102 t[2916] = 7470; 60103 t[2917] = 7471; 60104 t[2918] = 7472; 60105 t[2920] = 7474; 60106 t[2921] = 7475; 60107 t[2922] = 7476; 60108 t[2924] = 7478; 60109 t[2925] = 7479; 60110 t[2926] = 7480; 60111 t[2928] = 7482; 60112 t[2929] = 7483; 60113 t[2930] = 7484; 60114 t[2932] = 7486; 60115 t[2933] = 7487; 60116 t[2934] = 7488; 60117 t[2936] = 7490; 60118 t[2937] = 7491; 60119 t[2938] = 7492; 60120 t[2940] = 7494; 60121 t[2941] = 7495; 60122 t[2942] = 7496; 60123 t[2944] = 7498; 60124 t[2946] = 7500; 60125 t[2948] = 7502; 60126 t[2950] = 7504; 60127 t[2951] = 7505; 60128 t[2952] = 7506; 60129 t[2954] = 7508; 60130 t[2955] = 7509; 60131 t[2956] = 7510; 60132 t[2958] = 7512; 60133 t[2959] = 7513; 60134 t[2960] = 7514; 60135 t[2962] = 7516; 60136 t[2963] = 7517; 60137 t[2964] = 7518; 60138 t[2966] = 7520; 60139 t[2967] = 7521; 60140 t[2968] = 7522; 60141 t[2970] = 7524; 60142 t[2971] = 7525; 60143 t[2972] = 7526; 60144 t[2974] = 7528; 60145 t[2975] = 7529; 60146 t[2976] = 7530; 60147 t[2978] = 1537; 60148 t[2979] = 1538; 60149 t[2980] = 1539; 60150 t[2982] = 1549; 60151 t[2983] = 1551; 60152 t[2984] = 1552; 60153 t[2986] = 1554; 60154 t[2987] = 1555; 60155 t[2988] = 1556; 60156 t[2990] = 1623; 60157 t[2991] = 1624; 60158 t[2995] = 1775; 60159 t[2999] = 1791; 60160 t[3002] = 64290; 60161 t[3003] = 64291; 60162 t[3004] = 64292; 60163 t[3006] = 64294; 60164 t[3007] = 64295; 60165 t[3008] = 64296; 60166 t[3011] = 1900; 60167 t[3014] = 8223; 60168 t[3015] = 8244; 60169 t[3017] = 7532; 60170 t[3018] = 7533; 60171 t[3019] = 7534; 60172 t[3075] = 7590; 60173 t[3076] = 7591; 60174 t[3079] = 7594; 60175 t[3080] = 7595; 60176 t[3083] = 7598; 60177 t[3084] = 7599; 60178 t[3087] = 7602; 60179 t[3088] = 7603; 60180 t[3091] = 7606; 60181 t[3092] = 7607; 60182 t[3095] = 7610; 60183 t[3096] = 7611; 60184 t[3099] = 7614; 60185 t[3100] = 7615; 60186 t[3103] = 7618; 60187 t[3104] = 7619; 60188 t[3107] = 8337; 60189 t[3108] = 8338; 60190 t[3116] = 1884; 60191 t[3119] = 1885; 60192 t[3120] = 1885; 60193 t[3123] = 1886; 60194 t[3124] = 1886; 60195 t[3127] = 1887; 60196 t[3128] = 1887; 60197 t[3131] = 1888; 60198 t[3132] = 1888; 60199 t[3135] = 1889; 60200 t[3136] = 1889; 60201 t[3139] = 1890; 60202 t[3140] = 1890; 60203 t[3143] = 1891; 60204 t[3144] = 1891; 60205 t[3147] = 1892; 60206 t[3148] = 1892; 60207 t[3153] = 580; 60208 t[3154] = 581; 60209 t[3157] = 584; 60210 t[3158] = 585; 60211 t[3161] = 588; 60212 t[3162] = 589; 60213 t[3165] = 891; 60214 t[3166] = 892; 60215 t[3169] = 1274; 60216 t[3170] = 1275; 60217 t[3173] = 1278; 60218 t[3174] = 1279; 60219 t[3181] = 7622; 60220 t[3182] = 7623; 60221 t[3282] = 11799; 60222 t[3316] = 578; 60223 t[3379] = 42785; 60224 t[3393] = 1159; 60225 t[3416] = 8377; 60226}); 60227exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts; 60228const getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) { 60229 t[227] = 322; 60230 t[264] = 261; 60231 t[291] = 346; 60232}); 60233exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack; 60234const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) { 60235 t[1] = 32; 60236 t[4] = 65; 60237 t[17] = 66; 60238 t[18] = 67; 60239 t[24] = 68; 60240 t[28] = 69; 60241 t[38] = 70; 60242 t[39] = 71; 60243 t[44] = 72; 60244 t[47] = 73; 60245 t[58] = 74; 60246 t[60] = 75; 60247 t[62] = 76; 60248 t[68] = 77; 60249 t[69] = 78; 60250 t[75] = 79; 60251 t[87] = 80; 60252 t[89] = 81; 60253 t[90] = 82; 60254 t[94] = 83; 60255 t[100] = 84; 60256 t[104] = 85; 60257 t[115] = 86; 60258 t[116] = 87; 60259 t[121] = 88; 60260 t[122] = 89; 60261 t[127] = 90; 60262 t[258] = 97; 60263 t[268] = 261; 60264 t[271] = 98; 60265 t[272] = 99; 60266 t[273] = 263; 60267 t[282] = 100; 60268 t[286] = 101; 60269 t[295] = 281; 60270 t[296] = 102; 60271 t[336] = 103; 60272 t[346] = 104; 60273 t[349] = 105; 60274 t[361] = 106; 60275 t[364] = 107; 60276 t[367] = 108; 60277 t[371] = 322; 60278 t[373] = 109; 60279 t[374] = 110; 60280 t[381] = 111; 60281 t[383] = 243; 60282 t[393] = 112; 60283 t[395] = 113; 60284 t[396] = 114; 60285 t[400] = 115;
60286 t[401] = 347; 60287 t[410] = 116; 60288 t[437] = 117; 60289 t[448] = 118; 60290 t[449] = 119; 60291 t[454] = 120; 60292 t[455] = 121; 60293 t[460] = 122; 60294 t[463] = 380; 60295 t[853] = 44; 60296 t[855] = 58; 60297 t[856] = 46; 60298 t[876] = 47; 60299 t[878] = 45; 60300 t[882] = 45; 60301 t[894] = 40; 60302 t[895] = 41; 60303 t[896] = 91; 60304 t[897] = 93; 60305 t[923] = 64; 60306 t[1004] = 48; 60307 t[1005] = 49; 60308 t[1006] = 50; 60309 t[1007] = 51; 60310 t[1008] = 52; 60311 t[1009] = 53; 60312 t[1010] = 54; 60313 t[1011] = 55; 60314 t[1012] = 56; 60315 t[1013] = 57; 60316 t[1081] = 37; 60317 t[1085] = 43; 60318 t[1086] = 45; 60319}); 60320exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri; 60321 60322/***/ }), 60323/* 33 */ 60324/***/ (function(module, exports, __w_pdfjs_require__) { 60325 60326var getLookupTableFactory = __w_pdfjs_require__(7).getLookupTableFactory; 60327var getSpecialPUASymbols = getLookupTableFactory(function (t) { 60328 t[63721] = 0x00a9; 60329 t[63193] = 0x00a9; 60330 t[63720] = 0x00ae; 60331 t[63194] = 0x00ae; 60332 t[63722] = 0x2122; 60333 t[63195] = 0x2122; 60334 t[63729] = 0x23a7; 60335 t[63730] = 0x23a8; 60336 t[63731] = 0x23a9; 60337 t[63740] = 0x23ab; 60338 t[63741] = 0x23ac; 60339 t[63742] = 0x23ad; 60340 t[63726] = 0x23a1; 60341 t[63727] = 0x23a2; 60342 t[63728] = 0x23a3; 60343 t[63737] = 0x23a4; 60344 t[63738] = 0x23a5; 60345 t[63739] = 0x23a6; 60346 t[63723] = 0x239b; 60347 t[63724] = 0x239c; 60348 t[63725] = 0x239d; 60349 t[63734] = 0x239e; 60350 t[63735] = 0x239f; 60351 t[63736] = 0x23a0; 60352}); 60353function mapSpecialUnicodeValues(code) { 60354 if (code >= 0xfff0 && code <= 0xffff) { 60355 return 0; 60356 } else if (code >= 0xf600 && code <= 0xf8ff) {
60357 return getSpecialPUASymbols()[code] || code; 60358 } else if (code === 0x00ad) { 60359 return 0x002d; 60360 } 60361 return code; 60362} 60363function getUnicodeForGlyph(name, glyphsUnicodeMap) { 60364 var unicode = glyphsUnicodeMap[name]; 60365 if (unicode !== undefined) { 60366 return unicode; 60367 } 60368 if (!name) { 60369 return -1; 60370 } 60371 if (name[0] === "u") { 60372 var nameLen = name.length, hexStr; 60373 if (nameLen === 7 && name[1] === "n" && name[2] === "i") { 60374 hexStr = name.substring(3); 60375 } else if (nameLen >= 5 && nameLen <= 7) { 60376 hexStr = name.substring(1); 60377 } else { 60378 return -1; 60379 } 60380 if (hexStr === hexStr.toUpperCase()) { 60381 unicode = parseInt(hexStr, 16); 60382 if (unicode >= 0) { 60383 return unicode; 60384 } 60385 } 60386 } 60387 return -1; 60388} 60389var UnicodeRanges = [ 60390 { 60391 begin: 0x0000, 60392 end: 0x007f 60393 }, 60394 { 60395 begin: 0x0080, 60396 end: 0x00ff 60397 }, 60398 { 60399 begin: 0x0100, 60400 end: 0x017f 60401 }, 60402 { 60403 begin: 0x0180, 60404 end: 0x024f 60405 }, 60406 { 60407 begin: 0x0250, 60408 end: 0x02af 60409 }, 60410 { 60411 begin: 0x02b0, 60412 end: 0x02ff 60413 }, 60414 { 60415 begin: 0x0300, 60416 end: 0x036f 60417 }, 60418 { 60419 begin: 0x0370, 60420 end: 0x03ff 60421 }, 60422 { 60423 begin: 0x2c80, 60424 end: 0x2cff 60425 }, 60426 { 60427 begin: 0x0400, 60428 end: 0x04ff 60429 }, 60430 { 60431 begin: 0x0530, 60432 end: 0x058f 60433 }, 60434 { 60435 begin: 0x0590, 60436 end: 0x05ff 60437 }, 60438 { 60439 begin: 0xa500, 60440 end: 0xa63f 60441 }, 60442 { 60443 begin: 0x0600, 60444 end: 0x06ff 60445 }, 60446 { 60447 begin: 0x07c0, 60448 end: 0x07ff 60449 }, 60450 { 60451 begin: 0x0900, 60452 end: 0x097f 60453 }, 60454 { 60455 begin: 0x0980, 60456 end: 0x09ff 60457 }, 60458 { 60459 begin: 0x0a00, 60460 end: 0x0a7f 60461 }, 60462 { 60463 begin: 0x0a80, 60464 end: 0x0aff 60465 }, 60466 { 60467 begin: 0x0b00, 60468 end: 0x0b7f 60469 }, 60470 { 60471 begin: 0x0b80, 60472 end: 0x0bff 60473 }, 60474 { 60475 begin: 0x0c00, 60476 end: 0x0c7f 60477 }, 60478 { 60479 begin: 0x0c80, 60480 end: 0x0cff 60481 }, 60482 { 60483 begin: 0x0d00, 60484 end: 0x0d7f 60485 }, 60486 { 60487 begin: 0x0e00, 60488 end: 0x0e7f 60489 }, 60490 { 60491 begin: 0x0e80, 60492 end: 0x0eff 60493 }, 60494 { 60495 begin: 0x10a0, 60496 end: 0x10ff 60497 }, 60498 { 60499 begin: 0x1b00, 60500 end: 0x1b7f 60501 }, 60502 { 60503 begin: 0x1100, 60504 end: 0x11ff 60505 }, 60506 { 60507 begin: 0x1e00, 60508 end: 0x1eff 60509 }, 60510 { 60511 begin: 0x1f00, 60512 end: 0x1fff 60513 }, 60514 { 60515 begin: 0x2000, 60516 end: 0x206f 60517 }, 60518 { 60519 begin: 0x2070, 60520 end: 0x209f 60521 }, 60522 { 60523 begin: 0x20a0, 60524 end: 0x20cf 60525 }, 60526 { 60527 begin: 0x20d0, 60528 end: 0x20ff 60529 }, 60530 { 60531 begin: 0x2100, 60532 end: 0x214f 60533 }, 60534 { 60535 begin: 0x2150, 60536 end: 0x218f 60537 }, 60538 { 60539 begin: 0x2190, 60540 end: 0x21ff 60541 }, 60542 { 60543 begin: 0x2200, 60544 end: 0x22ff 60545 }, 60546 { 60547 begin: 0x2300, 60548 end: 0x23ff 60549 }, 60550 { 60551 begin: 0x2400, 60552 end: 0x243f 60553 }, 60554 { 60555 begin: 0x2440, 60556 end: 0x245f 60557 }, 60558 { 60559 begin: 0x2460, 60560 end: 0x24ff 60561 }, 60562 { 60563 begin: 0x2500, 60564 end: 0x257f 60565 }, 60566 { 60567 begin: 0x2580, 60568 end: 0x259f 60569 }, 60570 { 60571 begin: 0x25a0, 60572 end: 0x25ff 60573 }, 60574 { 60575 begin: 0x2600, 60576 end: 0x26ff 60577 }, 60578 { 60579 begin: 0x2700, 60580 end: 0x27bf 60581 }, 60582 { 60583 begin: 0x3000, 60584 end: 0x303f 60585 }, 60586 { 60587 begin: 0x3040, 60588 end: 0x309f 60589 }, 60590 { 60591 begin: 0x30a0, 60592 end: 0x30ff 60593 }, 60594 { 60595 begin: 0x3100, 60596 end: 0x312f 60597 }, 60598 { 60599 begin: 0x3130, 60600 end: 0x318f 60601 }, 60602 { 60603 begin: 0xa840, 60604 end: 0xa87f 60605 }, 60606 { 60607 begin: 0x3200, 60608 end: 0x32ff 60609 }, 60610 { 60611 begin: 0x3300, 60612 end: 0x33ff 60613 }, 60614 { 60615 begin: 0xac00, 60616 end: 0xd7af 60617 }, 60618 { 60619 begin: 0xd800, 60620 end: 0xdfff 60621 }, 60622 { 60623 begin: 0x10900, 60624 end: 0x1091f 60625 }, 60626 { 60627 begin: 0x4e00, 60628 end: 0x9fff 60629 }, 60630 { 60631 begin: 0xe000, 60632 end: 0xf8ff 60633 }, 60634 { 60635 begin: 0x31c0, 60636 end: 0x31ef 60637 }, 60638 { 60639 begin: 0xfb00, 60640 end: 0xfb4f 60641 }, 60642 { 60643 begin: 0xfb50, 60644 end: 0xfdff 60645 }, 60646 { 60647 begin: 0xfe20, 60648 end: 0xfe2f 60649 }, 60650 { 60651 begin: 0xfe10, 60652 end: 0xfe1f 60653 }, 60654 { 60655 begin: 0xfe50, 60656 end: 0xfe6f 60657 }, 60658 { 60659 begin: 0xfe70, 60660 end: 0xfeff 60661 }, 60662 { 60663 begin: 0xff00, 60664 end: 0xffef 60665 }, 60666 { 60667 begin: 0xfff0, 60668 end: 0xffff 60669 }, 60670 { 60671 begin: 0x0f00, 60672 end: 0x0fff 60673 }, 60674 { 60675 begin: 0x0700, 60676 end: 0x074f 60677 }, 60678 { 60679 begin: 0x0780, 60680 end: 0x07bf 60681 }, 60682 { 60683 begin: 0x0d80, 60684 end: 0x0dff 60685 }, 60686 { 60687 begin: 0x1000, 60688 end: 0x109f 60689 }, 60690 { 60691 begin: 0x1200, 60692 end: 0x137f 60693 }, 60694 { 60695 begin: 0x13a0, 60696 end: 0x13ff 60697 }, 60698 { 60699 begin: 0x1400, 60700 end: 0x167f 60701 }, 60702 { 60703 begin: 0x1680, 60704 end: 0x169f 60705 }, 60706 { 60707 begin: 0x16a0, 60708 end: 0x16ff 60709 }, 60710 { 60711 begin: 0x1780, 60712 end: 0x17ff 60713 }, 60714 { 60715 begin: 0x1800, 60716 end: 0x18af 60717 }, 60718 { 60719 begin: 0x2800, 60720 end: 0x28ff 60721 }, 60722 { 60723 begin: 0xa000, 60724 end: 0xa48f 60725 }, 60726 { 60727 begin: 0x1700, 60728 end: 0x171f 60729 }, 60730 { 60731 begin: 0x10300, 60732 end: 0x1032f 60733 }, 60734 { 60735 begin: 0x10330, 60736 end: 0x1034f 60737 }, 60738 { 60739 begin: 0x10400, 60740 end: 0x1044f 60741 }, 60742 { 60743 begin: 0x1d000, 60744 end: 0x1d0ff 60745 }, 60746 { 60747 begin: 0x1d400, 60748 end: 0x1d7ff 60749 }, 60750 { 60751 begin: 0xff000, 60752 end: 0xffffd 60753 }, 60754 { 60755 begin: 0xfe00, 60756 end: 0xfe0f 60757 }, 60758 { 60759 begin: 0xe0000, 60760 end: 0xe007f 60761 }, 60762 { 60763 begin: 0x1900, 60764 end: 0x194f 60765 }, 60766 { 60767 begin: 0x1950, 60768 end: 0x197f 60769 }, 60770 { 60771 begin: 0x1980, 60772 end: 0x19df 60773 }, 60774 { 60775 begin: 0x1a00, 60776 end: 0x1a1f 60777 }, 60778 { 60779 begin: 0x2c00, 60780 end: 0x2c5f 60781 }, 60782 { 60783 begin: 0x2d30, 60784 end: 0x2d7f 60785 }, 60786 { 60787 begin: 0x4dc0, 60788 end: 0x4dff 60789 }, 60790 { 60791 begin: 0xa800, 60792 end: 0xa82f 60793 }, 60794 { 60795 begin: 0x10000, 60796 end: 0x1007f 60797 }, 60798 { 60799 begin: 0x10140, 60800 end: 0x1018f 60801 }, 60802 { 60803 begin: 0x10380, 60804 end: 0x1039f 60805 }, 60806 { 60807 begin: 0x103a0, 60808 end: 0x103df 60809 }, 60810 { 60811 begin: 0x10450, 60812 end: 0x1047f 60813 }, 60814 { 60815 begin: 0x10480, 60816 end: 0x104af 60817 }, 60818 { 60819 begin: 0x10800, 60820 end: 0x1083f 60821 }, 60822 { 60823 begin: 0x10a00, 60824 end: 0x10a5f 60825 }, 60826 { 60827 begin: 0x1d300, 60828 end: 0x1d35f 60829 }, 60830 { 60831 begin: 0x12000, 60832 end: 0x123ff 60833 }, 60834 { 60835 begin: 0x1d360, 60836 end: 0x1d37f 60837 }, 60838 { 60839 begin: 0x1b80, 60840 end: 0x1bbf 60841 }, 60842 { 60843 begin: 0x1c00, 60844 end: 0x1c4f 60845 }, 60846 { 60847 begin: 0x1c50, 60848 end: 0x1c7f 60849 }, 60850 { 60851 begin: 0xa880, 60852 end: 0xa8df 60853 }, 60854 { 60855 begin: 0xa900, 60856 end: 0xa92f 60857 }, 60858 { 60859 begin: 0xa930, 60860 end: 0xa95f 60861 }, 60862 { 60863 begin: 0xaa00, 60864 end: 0xaa5f 60865 }, 60866 { 60867 begin: 0x10190, 60868 end: 0x101cf 60869 }, 60870 { 60871 begin: 0x101d0, 60872 end: 0x101ff 60873 }, 60874 { 60875 begin: 0x102a0, 60876 end: 0x102df 60877 }, 60878 { 60879 begin: 0x1f030, 60880 end: 0x1f09f 60881 } 60882]; 60883function getUnicodeRangeFor(value) { 60884 for (var i = 0, ii = UnicodeRanges.length; i < ii; i++) { 60885 var range = UnicodeRanges[i]; 60886 if (value >= range.begin && value < range.end) { 60887 return i; 60888 } 60889 } 60890 return -1; 60891} 60892function isRTLRangeFor(value) { 60893 var range = UnicodeRanges[13]; 60894 if (value >= range.begin && value < range.end) { 60895 return true; 60896 } 60897 range = UnicodeRanges[11]; 60898 if (value >= range.begin && value < range.end) { 60899 return true; 60900 } 60901 return false;
60902} 60903var getNormalizedUnicodes = getLookupTableFactory(function (t) { 60904 t["\u00A8"] = "\u0020\u0308"; 60905 t["\u00AF"] = "\u0020\u0304"; 60906 t["\u00B4"] = "\u0020\u0301"; 60907 t["\u00B5"] = "\u03BC"; 60908 t["\u00B8"] = "\u0020\u0327"; 60909 t["\u0132"] = "\u0049\u004A"; 60910 t["\u0133"] = "\u0069\u006A"; 60911 t["\u013F"] = "\u004C\u00B7"; 60912 t["\u0140"] = "\u006C\u00B7"; 60913 t["\u0149"] = "\u02BC\u006E"; 60914 t["\u017F"] = "\u0073"; 60915 t["\u01C4"] = "\u0044\u017D"; 60916 t["\u01C5"] = "\u0044\u017E"; 60917 t["\u01C6"] = "\u0064\u017E"; 60918 t["\u01C7"] = "\u004C\u004A"; 60919 t["\u01C8"] = "\u004C\u006A"; 60920 t["\u01C9"] = "\u006C\u006A"; 60921 t["\u01CA"] = "\u004E\u004A"; 60922 t["\u01CB"] = "\u004E\u006A"; 60923 t["\u01CC"] = "\u006E\u006A"; 60924 t["\u01F1"] = "\u0044\u005A"; 60925 t["\u01F2"] = "\u0044\u007A"; 60926 t["\u01F3"] = "\u0064\u007A"; 60927 t["\u02D8"] = "\u0020\u0306"; 60928 t["\u02D9"] = "\u0020\u0307"; 60929 t["\u02DA"] = "\u0020\u030A"; 60930 t["\u02DB"] = "\u0020\u0328"; 60931 t["\u02DC"] = "\u0020\u0303"; 60932 t["\u02DD"] = "\u0020\u030B"; 60933 t["\u037A"] = "\u0020\u0345"; 60934 t["\u0384"] = "\u0020\u0301"; 60935 t["\u03D0"] = "\u03B2"; 60936 t["\u03D1"] = "\u03B8"; 60937 t["\u03D2"] = "\u03A5"; 60938 t["\u03D5"] = "\u03C6"; 60939 t["\u03D6"] = "\u03C0"; 60940 t["\u03F0"] = "\u03BA"; 60941 t["\u03F1"] = "\u03C1"; 60942 t["\u03F2"] = "\u03C2"; 60943 t["\u03F4"] = "\u0398"; 60944 t["\u03F5"] = "\u03B5"; 60945 t["\u03F9"] = "\u03A3"; 60946 t["\u0587"] = "\u0565\u0582"; 60947 t["\u0675"] = "\u0627\u0674"; 60948 t["\u0676"] = "\u0648\u0674"; 60949 t["\u0677"] = "\u06C7\u0674"; 60950 t["\u0678"] = "\u064A\u0674"; 60951 t["\u0E33"] = "\u0E4D\u0E32"; 60952 t["\u0EB3"] = "\u0ECD\u0EB2"; 60953 t["\u0EDC"] = "\u0EAB\u0E99"; 60954 t["\u0EDD"] = "\u0EAB\u0EA1"; 60955 t["\u0F77"] = "\u0FB2\u0F81"; 60956 t["\u0F79"] = "\u0FB3\u0F81"; 60957 t["\u1E9A"] = "\u0061\u02BE"; 60958 t["\u1FBD"] = "\u0020\u0313"; 60959 t["\u1FBF"] = "\u0020\u0313"; 60960 t["\u1FC0"] = "\u0020\u0342"; 60961 t["\u1FFE"] = "\u0020\u0314"; 60962 t["\u2002"] = "\u0020"; 60963 t["\u2003"] = "\u0020"; 60964 t["\u2004"] = "\u0020"; 60965 t["\u2005"] = "\u0020"; 60966 t["\u2006"] = "\u0020"; 60967 t["\u2008"] = "\u0020"; 60968 t["\u2009"] = "\u0020"; 60969 t["\u200A"] = "\u0020"; 60970 t["\u2017"] = "\u0020\u0333"; 60971 t["\u2024"] = "\u002E"; 60972 t["\u2025"] = "\u002E\u002E"; 60973 t["\u2026"] = "\u002E\u002E\u002E"; 60974 t["\u2033"] = "\u2032\u2032"; 60975 t["\u2034"] = "\u2032\u2032\u2032"; 60976 t["\u2036"] = "\u2035\u2035"; 60977 t["\u2037"] = "\u2035\u2035\u2035"; 60978 t["\u203C"] = "\u0021\u0021"; 60979 t["\u203E"] = "\u0020\u0305"; 60980 t["\u2047"] = "\u003F\u003F"; 60981 t["\u2048"] = "\u003F\u0021"; 60982 t["\u2049"] = "\u0021\u003F"; 60983 t["\u2057"] = "\u2032\u2032\u2032\u2032"; 60984 t["\u205F"] = "\u0020"; 60985 t["\u20A8"] = "\u0052\u0073"; 60986 t["\u2100"] = "\u0061\u002F\u0063"; 60987 t["\u2101"] = "\u0061\u002F\u0073"; 60988 t["\u2103"] = "\u00B0\u0043"; 60989 t["\u2105"] = "\u0063\u002F\u006F"; 60990 t["\u2106"] = "\u0063\u002F\u0075"; 60991 t["\u2107"] = "\u0190"; 60992 t["\u2109"] = "\u00B0\u0046"; 60993 t["\u2116"] = "\u004E\u006F"; 60994 t["\u2121"] = "\u0054\u0045\u004C"; 60995 t["\u2135"] = "\u05D0"; 60996 t["\u2136"] = "\u05D1"; 60997 t["\u2137"] = "\u05D2"; 60998 t["\u2138"] = "\u05D3"; 60999 t["\u213B"] = "\u0046\u0041\u0058"; 61000 t["\u2160"] = "\u0049"; 61001 t["\u2161"] = "\u0049\u0049"; 61002 t["\u2162"] = "\u0049\u0049\u0049"; 61003 t["\u2163"] = "\u0049\u0056"; 61004 t["\u2164"] = "\u0056"; 61005 t["\u2165"] = "\u0056\u0049"; 61006 t["\u2166"] = "\u0056\u0049\u0049"; 61007 t["\u2167"] = "\u0056\u0049\u0049\u0049"; 61008 t["\u2168"] = "\u0049\u0058"; 61009 t["\u2169"] = "\u0058"; 61010 t["\u216A"] = "\u0058\u0049"; 61011 t["\u216B"] = "\u0058\u0049\u0049"; 61012 t["\u216C"] = "\u004C"; 61013 t["\u216D"] = "\u0043"; 61014 t["\u216E"] = "\u0044"; 61015 t["\u216F"] = "\u004D"; 61016 t["\u2170"] = "\u0069"; 61017 t["\u2171"] = "\u0069\u0069"; 61018 t["\u2172"] = "\u0069\u0069\u0069"; 61019 t["\u2173"] = "\u0069\u0076"; 61020 t["\u2174"] = "\u0076"; 61021 t["\u2175"] = "\u0076\u0069"; 61022 t["\u2176"] = "\u0076\u0069\u0069"; 61023 t["\u2177"] = "\u0076\u0069\u0069\u0069"; 61024 t["\u2178"] = "\u0069\u0078"; 61025 t["\u2179"] = "\u0078"; 61026 t["\u217A"] = "\u0078\u0069"; 61027 t["\u217B"] = "\u0078\u0069\u0069"; 61028 t["\u217C"] = "\u006C"; 61029 t["\u217D"] = "\u0063"; 61030 t["\u217E"] = "\u0064"; 61031 t["\u217F"] = "\u006D"; 61032 t["\u222C"] = "\u222B\u222B"; 61033 t["\u222D"] = "\u222B\u222B\u222B"; 61034 t["\u222F"] = "\u222E\u222E"; 61035 t["\u2230"] = "\u222E\u222E\u222E"; 61036 t["\u2474"] = "\u0028\u0031\u0029"; 61037 t["\u2475"] = "\u0028\u0032\u0029"; 61038 t["\u2476"] = "\u0028\u0033\u0029"; 61039 t["\u2477"] = "\u0028\u0034\u0029"; 61040 t["\u2478"] = "\u0028\u0035\u0029"; 61041 t["\u2479"] = "\u0028\u0036\u0029"; 61042 t["\u247A"] = "\u0028\u0037\u0029"; 61043 t["\u247B"] = "\u0028\u0038\u0029"; 61044 t["\u247C"] = "\u0028\u0039\u0029"; 61045 t["\u247D"] = "\u0028\u0031\u0030\u0029"; 61046 t["\u247E"] = "\u0028\u0031\u0031\u0029"; 61047 t["\u247F"] = "\u0028\u0031\u0032\u0029"; 61048 t["\u2480"] = "\u0028\u0031\u0033\u0029"; 61049 t["\u2481"] = "\u0028\u0031\u0034\u0029"; 61050 t["\u2482"] = "\u0028\u0031\u0035\u0029"; 61051 t["\u2483"] = "\u0028\u0031\u0036\u0029"; 61052 t["\u2484"] = "\u0028\u0031\u0037\u0029"; 61053 t["\u2485"] = "\u0028\u0031\u0038\u0029"; 61054 t["\u2486"] = "\u0028\u0031\u0039\u0029"; 61055 t["\u2487"] = "\u0028\u0032\u0030\u0029"; 61056 t["\u2488"] = "\u0031\u002E"; 61057 t["\u2489"] = "\u0032\u002E"; 61058 t["\u248A"] = "\u0033\u002E"; 61059 t["\u248B"] = "\u0034\u002E"; 61060 t["\u248C"] = "\u0035\u002E"; 61061 t["\u248D"] = "\u0036\u002E"; 61062 t["\u248E"] = "\u0037\u002E"; 61063 t["\u248F"] = "\u0038\u002E"; 61064 t["\u2490"] = "\u0039\u002E"; 61065 t["\u2491"] = "\u0031\u0030\u002E"; 61066 t["\u2492"] = "\u0031\u0031\u002E"; 61067 t["\u2493"] = "\u0031\u0032\u002E"; 61068 t["\u2494"] = "\u0031\u0033\u002E";
61069 t["\u2495"] = "\u0031\u0034\u002E"; 61070 t["\u2496"] = "\u0031\u0035\u002E"; 61071 t["\u2497"] = "\u0031\u0036\u002E"; 61072 t["\u2498"] = "\u0031\u0037\u002E"; 61073 t["\u2499"] = "\u0031\u0038\u002E"; 61074 t["\u249A"] = "\u0031\u0039\u002E"; 61075 t["\u249B"] = "\u0032\u0030\u002E"; 61076 t["\u249C"] = "\u0028\u0061\u0029"; 61077 t["\u249D"] = "\u0028\u0062\u0029"; 61078 t["\u249E"] = "\u0028\u0063\u0029"; 61079 t["\u249F"] = "\u0028\u0064\u0029"; 61080 t["\u24A0"] = "\u0028\u0065\u0029"; 61081 t["\u24A1"] = "\u0028\u0066\u0029"; 61082 t["\u24A2"] = "\u0028\u0067\u0029"; 61083 t["\u24A3"] = "\u0028\u0068\u0029"; 61084 t["\u24A4"] = "\u0028\u0069\u0029"; 61085 t["\u24A5"] = "\u0028\u006A\u0029"; 61086 t["\u24A6"] = "\u0028\u006B\u0029"; 61087 t["\u24A7"] = "\u0028\u006C\u0029"; 61088 t["\u24A8"] = "\u0028\u006D\u0029"; 61089 t["\u24A9"] = "\u0028\u006E\u0029"; 61090 t["\u24AA"] = "\u0028\u006F\u0029"; 61091 t["\u24AB"] = "\u0028\u0070\u0029"; 61092 t["\u24AC"] = "\u0028\u0071\u0029"; 61093 t["\u24AD"] = "\u0028\u0072\u0029"; 61094 t["\u24AE"] = "\u0028\u0073\u0029"; 61095 t["\u24AF"] = "\u0028\u0074\u0029"; 61096 t["\u24B0"] = "\u0028\u0075\u0029"; 61097 t["\u24B1"] = "\u0028\u0076\u0029"; 61098 t["\u24B2"] = "\u0028\u0077\u0029"; 61099 t["\u24B3"] = "\u0028\u0078\u0029"; 61100 t["\u24B4"] = "\u0028\u0079\u0029"; 61101 t["\u24B5"] = "\u0028\u007A\u0029"; 61102 t["\u2A0C"] = "\u222B\u222B\u222B\u222B"; 61103 t["\u2A74"] = "\u003A\u003A\u003D"; 61104 t["\u2A75"] = "\u003D\u003D"; 61105 t["\u2A76"] = "\u003D\u003D\u003D"; 61106 t["\u2E9F"] = "\u6BCD"; 61107 t["\u2EF3"] = "\u9F9F"; 61108 t["\u2F00"] = "\u4E00"; 61109 t["\u2F01"] = "\u4E28"; 61110 t["\u2F02"] = "\u4E36"; 61111 t["\u2F03"] = "\u4E3F"; 61112 t["\u2F04"] = "\u4E59"; 61113 t["\u2F05"] = "\u4E85"; 61114 t["\u2F06"] = "\u4E8C"; 61115 t["\u2F07"] = "\u4EA0"; 61116 t["\u2F08"] = "\u4EBA"; 61117 t["\u2F09"] = "\u513F"; 61118 t["\u2F0A"] = "\u5165"; 61119 t["\u2F0B"] = "\u516B"; 61120 t["\u2F0C"] = "\u5182"; 61121 t["\u2F0D"] = "\u5196"; 61122 t["\u2F0E"] = "\u51AB"; 61123 t["\u2F0F"] = "\u51E0"; 61124 t["\u2F10"] = "\u51F5"; 61125 t["\u2F11"] = "\u5200"; 61126 t["\u2F12"] = "\u529B"; 61127 t["\u2F13"] = "\u52F9"; 61128 t["\u2F14"] = "\u5315"; 61129 t["\u2F15"] = "\u531A"; 61130 t["\u2F16"] = "\u5338"; 61131 t["\u2F17"] = "\u5341"; 61132 t["\u2F18"] = "\u535C"; 61133 t["\u2F19"] = "\u5369"; 61134 t["\u2F1A"] = "\u5382"; 61135 t["\u2F1B"] = "\u53B6"; 61136 t["\u2F1C"] = "\u53C8"; 61137 t["\u2F1D"] = "\u53E3"; 61138 t["\u2F1E"] = "\u56D7"; 61139 t["\u2F1F"] = "\u571F"; 61140 t["\u2F20"] = "\u58EB"; 61141 t["\u2F21"] = "\u5902"; 61142 t["\u2F22"] = "\u590A"; 61143 t["\u2F23"] = "\u5915"; 61144 t["\u2F24"] = "\u5927"; 61145 t["\u2F25"] = "\u5973"; 61146 t["\u2F26"] = "\u5B50"; 61147 t["\u2F27"] = "\u5B80"; 61148 t["\u2F28"] = "\u5BF8"; 61149 t["\u2F29"] = "\u5C0F"; 61150 t["\u2F2A"] = "\u5C22"; 61151 t["\u2F2B"] = "\u5C38"; 61152 t["\u2F2C"] = "\u5C6E"; 61153 t["\u2F2D"] = "\u5C71"; 61154 t["\u2F2E"] = "\u5DDB"; 61155 t["\u2F2F"] = "\u5DE5"; 61156 t["\u2F30"] = "\u5DF1"; 61157 t["\u2F31"] = "\u5DFE"; 61158 t["\u2F32"] = "\u5E72"; 61159 t["\u2F33"] = "\u5E7A"; 61160 t["\u2F34"] = "\u5E7F"; 61161 t["\u2F35"] = "\u5EF4"; 61162 t["\u2F36"] = "\u5EFE"; 61163 t["\u2F37"] = "\u5F0B"; 61164 t["\u2F38"] = "\u5F13"; 61165 t["\u2F39"] = "\u5F50"; 61166 t["\u2F3A"] = "\u5F61"; 61167 t["\u2F3B"] = "\u5F73"; 61168 t["\u2F3C"] = "\u5FC3";
61169 t["\u2F3D"] = "\u6208"; 61170 t["\u2F3E"] = "\u6236"; 61171 t["\u2F3F"] = "\u624B"; 61172 t["\u2F40"] = "\u652F"; 61173 t["\u2F41"] = "\u6534"; 61174 t["\u2F42"] = "\u6587"; 61175 t["\u2F43"] = "\u6597"; 61176 t["\u2F44"] = "\u65A4"; 61177 t["\u2F45"] = "\u65B9"; 61178 t["\u2F46"] = "\u65E0"; 61179 t["\u2F47"] = "\u65E5"; 61180 t["\u2F48"] = "\u66F0"; 61181 t["\u2F49"] = "\u6708"; 61182 t["\u2F4A"] = "\u6728"; 61183 t["\u2F4B"] = "\u6B20"; 61184 t["\u2F4C"] = "\u6B62"; 61185 t["\u2F4D"] = "\u6B79"; 61186 t["\u2F4E"] = "\u6BB3"; 61187 t["\u2F4F"] = "\u6BCB"; 61188 t["\u2F50"] = "\u6BD4"; 61189 t["\u2F51"] = "\u6BDB"; 61190 t["\u2F52"] = "\u6C0F"; 61191 t["\u2F53"] = "\u6C14"; 61192 t["\u2F54"] = "\u6C34"; 61193 t["\u2F55"] = "\u706B"; 61194 t["\u2F56"] = "\u722A"; 61195 t["\u2F57"] = "\u7236"; 61196 t["\u2F58"] = "\u723B"; 61197 t["\u2F59"] = "\u723F"; 61198 t["\u2F5A"] = "\u7247"; 61199 t["\u2F5B"] = "\u7259"; 61200 t["\u2F5C"] = "\u725B"; 61201 t["\u2F5D"] = "\u72AC"; 61202 t["\u2F5E"] = "\u7384"; 61203 t["\u2F5F"] = "\u7389"; 61204 t["\u2F60"] = "\u74DC"; 61205 t["\u2F61"] = "\u74E6"; 61206 t["\u2F62"] = "\u7518"; 61207 t["\u2F63"] = "\u751F"; 61208 t["\u2F64"] = "\u7528"; 61209 t["\u2F65"] = "\u7530"; 61210 t["\u2F66"] = "\u758B"; 61211 t["\u2F67"] = "\u7592"; 61212 t["\u2F68"] = "\u7676"; 61213 t["\u2F69"] = "\u767D"; 61214 t["\u2F6A"] = "\u76AE"; 61215 t["\u2F6B"] = "\u76BF"; 61216 t["\u2F6C"] = "\u76EE"; 61217 t["\u2F6D"] = "\u77DB"; 61218 t["\u2F6E"] = "\u77E2"; 61219 t["\u2F6F"] = "\u77F3"; 61220 t["\u2F70"] = "\u793A"; 61221 t["\u2F71"] = "\u79B8"; 61222 t["\u2F72"] = "\u79BE"; 61223 t["\u2F73"] = "\u7A74"; 61224 t["\u2F74"] = "\u7ACB"; 61225 t["\u2F75"] = "\u7AF9"; 61226 t["\u2F76"] = "\u7C73"; 61227 t["\u2F77"] = "\u7CF8"; 61228 t["\u2F78"] = "\u7F36"; 61229 t["\u2F79"] = "\u7F51"; 61230 t["\u2F7A"] = "\u7F8A"; 61231 t["\u2F7B"] = "\u7FBD"; 61232 t["\u2F7C"] = "\u8001"; 61233 t["\u2F7D"] = "\u800C"; 61234 t["\u2F7E"] = "\u8012"; 61235 t["\u2F7F"] = "\u8033"; 61236 t["\u2F80"] = "\u807F"; 61237 t["\u2F81"] = "\u8089"; 61238 t["\u2F82"] = "\u81E3"; 61239 t["\u2F83"] = "\u81EA"; 61240 t["\u2F84"] = "\u81F3"; 61241 t["\u2F85"] = "\u81FC"; 61242 t["\u2F86"] = "\u820C"; 61243 t["\u2F87"] = "\u821B"; 61244 t["\u2F88"] = "\u821F"; 61245 t["\u2F89"] = "\u826E"; 61246 t["\u2F8A"] = "\u8272"; 61247 t["\u2F8B"] = "\u8278"; 61248 t["\u2F8C"] = "\u864D"; 61249 t["\u2F8D"] = "\u866B"; 61250 t["\u2F8E"] = "\u8840"; 61251 t["\u2F8F"] = "\u884C"; 61252 t["\u2F90"] = "\u8863"; 61253 t["\u2F91"] = "\u897E"; 61254 t["\u2F92"] = "\u898B"; 61255 t["\u2F93"] = "\u89D2"; 61256 t["\u2F94"] = "\u8A00"; 61257 t["\u2F95"] = "\u8C37"; 61258 t["\u2F96"] = "\u8C46"; 61259 t["\u2F97"] = "\u8C55"; 61260 t["\u2F98"] = "\u8C78"; 61261 t["\u2F99"] = "\u8C9D"; 61262 t["\u2F9A"] = "\u8D64"; 61263 t["\u2F9B"] = "\u8D70"; 61264 t["\u2F9C"] = "\u8DB3"; 61265 t["\u2F9D"] = "\u8EAB"; 61266 t["\u2F9E"] = "\u8ECA"; 61267 t["\u2F9F"] = "\u8F9B"; 61268 t["\u2FA0"] = "\u8FB0"; 61269 t["\u2FA1"] = "\u8FB5"; 61270 t["\u2FA2"] = "\u9091"; 61271 t["\u2FA3"] = "\u9149"; 61272 t["\u2FA4"] = "\u91C6"; 61273 t["\u2FA5"] = "\u91CC"; 61274 t["\u2FA6"] = "\u91D1"; 61275 t["\u2FA7"] = "\u9577"; 61276 t["\u2FA8"] = "\u9580"; 61277 t["\u2FA9"] = "\u961C"; 61278 t["\u2FAA"] = "\u96B6"; 61279 t["\u2FAB"] = "\u96B9"; 61280 t["\u2FAC"] = "\u96E8"; 61281 t["\u2FAD"] = "\u9751"; 61282 t["\u2FAE"] = "\u975E"; 61283 t["\u2FAF"] = "\u9762"; 61284 t["\u2FB0"] = "\u9769"; 61285 t["\u2FB1"] = "\u97CB"; 61286 t["\u2FB2"] = "\u97ED"; 61287 t["\u2FB3"] = "\u97F3"; 61288 t["\u2FB4"] = "\u9801"; 61289 t["\u2FB5"] = "\u98A8"; 61290 t["\u2FB6"] = "\u98DB"; 61291 t["\u2FB7"] = "\u98DF"; 61292 t["\u2FB8"] = "\u9996"; 61293 t["\u2FB9"] = "\u9999"; 61294 t["\u2FBA"] = "\u99AC"; 61295 t["\u2FBB"] = "\u9AA8"; 61296 t["\u2FBC"] = "\u9AD8"; 61297 t["\u2FBD"] = "\u9ADF"; 61298 t["\u2FBE"] = "\u9B25"; 61299 t["\u2FBF"] = "\u9B2F"; 61300 t["\u2FC0"] = "\u9B32"; 61301 t["\u2FC1"] = "\u9B3C"; 61302 t["\u2FC2"] = "\u9B5A"; 61303 t["\u2FC3"] = "\u9CE5"; 61304 t["\u2FC4"] = "\u9E75"; 61305 t["\u2FC5"] = "\u9E7F"; 61306 t["\u2FC6"] = "\u9EA5"; 61307 t["\u2FC7"] = "\u9EBB"; 61308 t["\u2FC8"] = "\u9EC3"; 61309 t["\u2FC9"] = "\u9ECD"; 61310 t["\u2FCA"] = "\u9ED1"; 61311 t["\u2FCB"] = "\u9EF9"; 61312 t["\u2FCC"] = "\u9EFD"; 61313 t["\u2FCD"] = "\u9F0E"; 61314 t["\u2FCE"] = "\u9F13"; 61315 t["\u2FCF"] = "\u9F20"; 61316 t["\u2FD0"] = "\u9F3B"; 61317 t["\u2FD1"] = "\u9F4A"; 61318 t["\u2FD2"] = "\u9F52"; 61319 t["\u2FD3"] = "\u9F8D"; 61320 t["\u2FD4"] = "\u9F9C"; 61321 t["\u2FD5"] = "\u9FA0"; 61322 t["\u3036"] = "\u3012"; 61323 t["\u3038"] = "\u5341"; 61324 t["\u3039"] = "\u5344"; 61325 t["\u303A"] = "\u5345"; 61326 t["\u309B"] = "\u0020\u3099"; 61327 t["\u309C"] = "\u0020\u309A"; 61328 t["\u3131"] = "\u1100"; 61329 t["\u3132"] = "\u1101"; 61330 t["\u3133"] = "\u11AA"; 61331 t["\u3134"] = "\u1102"; 61332 t["\u3135"] = "\u11AC"; 61333 t["\u3136"] = "\u11AD"; 61334 t["\u3137"] = "\u1103"; 61335 t["\u3138"] = "\u1104"; 61336 t["\u3139"] = "\u1105"; 61337 t["\u313A"] = "\u11B0"; 61338 t["\u313B"] = "\u11B1"; 61339 t["\u313C"] = "\u11B2"; 61340 t["\u313D"] = "\u11B3"; 61341 t["\u313E"] = "\u11B4"; 61342 t["\u313F"] = "\u11B5"; 61343 t["\u3140"] = "\u111A"; 61344 t["\u3141"] = "\u1106"; 61345 t["\u3142"] = "\u1107"; 61346 t["\u3143"] = "\u1108"; 61347 t["\u3144"] = "\u1121"; 61348 t["\u3145"] = "\u1109"; 61349 t["\u3146"] = "\u110A"; 61350 t["\u3147"] = "\u110B"; 61351 t["\u3148"] = "\u110C"; 61352 t["\u3149"] = "\u110D"; 61353 t["\u314A"] = "\u110E"; 61354 t["\u314B"] = "\u110F"; 61355 t["\u314C"] = "\u1110"; 61356 t["\u314D"] = "\u1111"; 61357 t["\u314E"] = "\u1112"; 61358 t["\u314F"] = "\u1161"; 61359 t["\u3150"] = "\u1162";
61360 t["\u3151"] = "\u1163"; 61361 t["\u3152"] = "\u1164"; 61362 t["\u3153"] = "\u1165"; 61363 t["\u3154"] = "\u1166"; 61364 t["\u3155"] = "\u1167"; 61365 t["\u3156"] = "\u1168"; 61366 t["\u3157"] = "\u1169"; 61367 t["\u3158"] = "\u116A"; 61368 t["\u3159"] = "\u116B"; 61369 t["\u315A"] = "\u116C"; 61370 t["\u315B"] = "\u116D"; 61371 t["\u315C"] = "\u116E"; 61372 t["\u315D"] = "\u116F"; 61373 t["\u315E"] = "\u1170"; 61374 t["\u315F"] = "\u1171"; 61375 t["\u3160"] = "\u1172"; 61376 t["\u3161"] = "\u1173"; 61377 t["\u3162"] = "\u1174"; 61378 t["\u3163"] = "\u1175"; 61379 t["\u3164"] = "\u1160"; 61380 t["\u3165"] = "\u1114"; 61381 t["\u3166"] = "\u1115"; 61382 t["\u3167"] = "\u11C7"; 61383 t["\u3168"] = "\u11C8"; 61384 t["\u3169"] = "\u11CC"; 61385 t["\u316A"] = "\u11CE"; 61386 t["\u316B"] = "\u11D3"; 61387 t["\u316C"] = "\u11D7"; 61388 t["\u316D"] = "\u11D9"; 61389 t["\u316E"] = "\u111C"; 61390 t["\u316F"] = "\u11DD"; 61391 t["\u3170"] = "\u11DF"; 61392 t["\u3171"] = "\u111D"; 61393 t["\u3172"] = "\u111E"; 61394 t["\u3173"] = "\u1120"; 61395 t["\u3174"] = "\u1122"; 61396 t["\u3175"] = "\u1123"; 61397 t["\u3176"] = "\u1127"; 61398 t["\u3177"] = "\u1129"; 61399 t["\u3178"] = "\u112B"; 61400 t["\u3179"] = "\u112C"; 61401 t["\u317A"] = "\u112D"; 61402 t["\u317B"] = "\u112E"; 61403 t["\u317C"] = "\u112F"; 61404 t["\u317D"] = "\u1132"; 61405 t["\u317E"] = "\u1136"; 61406 t["\u317F"] = "\u1140"; 61407 t["\u3180"] = "\u1147"; 61408 t["\u3181"] = "\u114C"; 61409 t["\u3182"] = "\u11F1"; 61410 t["\u3183"] = "\u11F2"; 61411 t["\u3184"] = "\u1157"; 61412 t["\u3185"] = "\u1158"; 61413 t["\u3186"] = "\u1159"; 61414 t["\u3187"] = "\u1184"; 61415 t["\u3188"] = "\u1185"; 61416 t["\u3189"] = "\u1188"; 61417 t["\u318A"] = "\u1191"; 61418 t["\u318B"] = "\u1192"; 61419 t["\u318C"] = "\u1194"; 61420 t["\u318D"] = "\u119E"; 61421 t["\u318E"] = "\u11A1"; 61422 t["\u3200"] = "\u0028\u1100\u0029"; 61423 t["\u3201"] = "\u0028\u1102\u0029"; 61424 t["\u3202"] = "\u0028\u1103\u0029"; 61425 t["\u3203"] = "\u0028\u1105\u0029"; 61426 t["\u3204"] = "\u0028\u1106\u0029"; 61427 t["\u3205"] = "\u0028\u1107\u0029"; 61428 t["\u3206"] = "\u0028\u1109\u0029"; 61429 t["\u3207"] = "\u0028\u110B\u0029"; 61430 t["\u3208"] = "\u0028\u110C\u0029"; 61431 t["\u3209"] = "\u0028\u110E\u0029"; 61432 t["\u320A"] = "\u0028\u110F\u0029"; 61433 t["\u320B"] = "\u0028\u1110\u0029"; 61434 t["\u320C"] = "\u0028\u1111\u0029"; 61435 t["\u320D"] = "\u0028\u1112\u0029"; 61436 t["\u320E"] = "\u0028\u1100\u1161\u0029"; 61437 t["\u320F"] = "\u0028\u1102\u1161\u0029"; 61438 t["\u3210"] = "\u0028\u1103\u1161\u0029"; 61439 t["\u3211"] = "\u0028\u1105\u1161\u0029"; 61440 t["\u3212"] = "\u0028\u1106\u1161\u0029"; 61441 t["\u3213"] = "\u0028\u1107\u1161\u0029"; 61442 t["\u3214"] = "\u0028\u1109\u1161\u0029"; 61443 t["\u3215"] = "\u0028\u110B\u1161\u0029"; 61444 t["\u3216"] = "\u0028\u110C\u1161\u0029"; 61445 t["\u3217"] = "\u0028\u110E\u1161\u0029"; 61446 t["\u3218"] = "\u0028\u110F\u1161\u0029"; 61447 t["\u3219"] = "\u0028\u1110\u1161\u0029"; 61448 t["\u321A"] = "\u0028\u1111\u1161\u0029"; 61449 t["\u321B"] = "\u0028\u1112\u1161\u0029"; 61450 t["\u321C"] = "\u0028\u110C\u116E\u0029"; 61451 t["\u321D"] = "\u0028\u110B\u1169\u110C\u1165\u11AB\u0029"; 61452 t["\u321E"] = "\u0028\u110B\u1169\u1112\u116E\u0029"; 61453 t["\u3220"] = "\u0028\u4E00\u0029"; 61454 t["\u3221"] = "\u0028\u4E8C\u0029"; 61455 t["\u3222"] = "\u0028\u4E09\u0029"; 61456 t["\u3223"] = "\u0028\u56DB\u0029"; 61457 t["\u3224"] = "\u0028\u4E94\u0029"; 61458 t["\u3225"] = "\u0028\u516D\u0029"; 61459 t["\u3226"] = "\u0028\u4E03\u0029"; 61460 t["\u3227"] = "\u0028\u516B\u0029"; 61461 t["\u3228"] = "\u0028\u4E5D\u0029"; 61462 t["\u3229"] = "\u0028\u5341\u0029"; 61463 t["\u322A"] = "\u0028\u6708\u0029"; 61464 t["\u322B"] = "\u0028\u706B\u0029"; 61465 t["\u322C"] = "\u0028\u6C34\u0029"; 61466 t["\u322D"] = "\u0028\u6728\u0029"; 61467 t["\u322E"] = "\u0028\u91D1\u0029"; 61468 t["\u322F"] = "\u0028\u571F\u0029"; 61469 t["\u3230"] = "\u0028\u65E5\u0029"; 61470 t["\u3231"] = "\u0028\u682A\u0029"; 61471 t["\u3232"] = "\u0028\u6709\u0029"; 61472 t["\u3233"] = "\u0028\u793E\u0029"; 61473 t["\u3234"] = "\u0028\u540D\u0029"; 61474 t["\u3235"] = "\u0028\u7279\u0029"; 61475 t["\u3236"] = "\u0028\u8CA1\u0029"; 61476 t["\u3237"] = "\u0028\u795D\u0029"; 61477 t["\u3238"] = "\u0028\u52B4\u0029"; 61478 t["\u3239"] = "\u0028\u4EE3\u0029"; 61479 t["\u323A"] = "\u0028\u547C\u0029"; 61480 t["\u323B"] = "\u0028\u5B66\u0029"; 61481 t["\u323C"] = "\u0028\u76E3\u0029"; 61482 t["\u323D"] = "\u0028\u4F01\u0029"; 61483 t["\u323E"] = "\u0028\u8CC7\u0029"; 61484 t["\u323F"] = "\u0028\u5354\u0029"; 61485 t["\u3240"] = "\u0028\u796D\u0029"; 61486 t["\u3241"] = "\u0028\u4F11\u0029"; 61487 t["\u3242"] = "\u0028\u81EA\u0029"; 61488 t["\u3243"] = "\u0028\u81F3\u0029"; 61489 t["\u32C0"] = "\u0031\u6708";
61490 t["\u32C1"] = "\u0032\u6708"; 61491 t["\u32C2"] = "\u0033\u6708"; 61492 t["\u32C3"] = "\u0034\u6708"; 61493 t["\u32C4"] = "\u0035\u6708"; 61494 t["\u32C5"] = "\u0036\u6708"; 61495 t["\u32C6"] = "\u0037\u6708"; 61496 t["\u32C7"] = "\u0038\u6708"; 61497 t["\u32C8"] = "\u0039\u6708"; 61498 t["\u32C9"] = "\u0031\u0030\u6708"; 61499 t["\u32CA"] = "\u0031\u0031\u6708"; 61500 t["\u32CB"] = "\u0031\u0032\u6708"; 61501 t["\u3358"] = "\u0030\u70B9"; 61502 t["\u3359"] = "\u0031\u70B9"; 61503 t["\u335A"] = "\u0032\u70B9"; 61504 t["\u335B"] = "\u0033\u70B9"; 61505 t["\u335C"] = "\u0034\u70B9"; 61506 t["\u335D"] = "\u0035\u70B9"; 61507 t["\u335E"] = "\u0036\u70B9"; 61508 t["\u335F"] = "\u0037\u70B9"; 61509 t["\u3360"] = "\u0038\u70B9"; 61510 t["\u3361"] = "\u0039\u70B9"; 61511 t["\u3362"] = "\u0031\u0030\u70B9"; 61512 t["\u3363"] = "\u0031\u0031\u70B9"; 61513 t["\u3364"] = "\u0031\u0032\u70B9"; 61514 t["\u3365"] = "\u0031\u0033\u70B9"; 61515 t["\u3366"] = "\u0031\u0034\u70B9"; 61516 t["\u3367"] = "\u0031\u0035\u70B9"; 61517 t["\u3368"] = "\u0031\u0036\u70B9"; 61518 t["\u3369"] = "\u0031\u0037\u70B9"; 61519 t["\u336A"] = "\u0031\u0038\u70B9"; 61520 t["\u336B"] = "\u0031\u0039\u70B9"; 61521 t["\u336C"] = "\u0032\u0030\u70B9"; 61522 t["\u336D"] = "\u0032\u0031\u70B9"; 61523 t["\u336E"] = "\u0032\u0032\u70B9"; 61524 t["\u336F"] = "\u0032\u0033\u70B9"; 61525 t["\u3370"] = "\u0032\u0034\u70B9"; 61526 t["\u33E0"] = "\u0031\u65E5"; 61527 t["\u33E1"] = "\u0032\u65E5"; 61528 t["\u33E2"] = "\u0033\u65E5"; 61529 t["\u33E3"] = "\u0034\u65E5"; 61530 t["\u33E4"] = "\u0035\u65E5"; 61531 t["\u33E5"] = "\u0036\u65E5"; 61532 t["\u33E6"] = "\u0037\u65E5"; 61533 t["\u33E7"] = "\u0038\u65E5"; 61534 t["\u33E8"] = "\u0039\u65E5"; 61535 t["\u33E9"] = "\u0031\u0030\u65E5"; 61536 t["\u33EA"] = "\u0031\u0031\u65E5"; 61537 t["\u33EB"] = "\u0031\u0032\u65E5"; 61538 t["\u33EC"] = "\u0031\u0033\u65E5"; 61539 t["\u33ED"] = "\u0031\u0034\u65E5"; 61540 t["\u33EE"] = "\u0031\u0035\u65E5"; 61541 t["\u33EF"] = "\u0031\u0036\u65E5"; 61542 t["\u33F0"] = "\u0031\u0037\u65E5"; 61543 t["\u33F1"] = "\u0031\u0038\u65E5"; 61544 t["\u33F2"] = "\u0031\u0039\u65E5"; 61545 t["\u33F3"] = "\u0032\u0030\u65E5"; 61546 t["\u33F4"] = "\u0032\u0031\u65E5"; 61547 t["\u33F5"] = "\u0032\u0032\u65E5"; 61548 t["\u33F6"] = "\u0032\u0033\u65E5"; 61549 t["\u33F7"] = "\u0032\u0034\u65E5"; 61550 t["\u33F8"] = "\u0032\u0035\u65E5"; 61551 t["\u33F9"] = "\u0032\u0036\u65E5"; 61552 t["\u33FA"] = "\u0032\u0037\u65E5"; 61553 t["\u33FB"] = "\u0032\u0038\u65E5"; 61554 t["\u33FC"] = "\u0032\u0039\u65E5"; 61555 t["\u33FD"] = "\u0033\u0030\u65E5"; 61556 t["\u33FE"] = "\u0033\u0031\u65E5"; 61557 t["\uFB00"] = "\u0066\u0066"; 61558 t["\uFB01"] = "\u0066\u0069"; 61559 t["\uFB02"] = "\u0066\u006C"; 61560 t["\uFB03"] = "\u0066\u0066\u0069"; 61561 t["\uFB04"] = "\u0066\u0066\u006C"; 61562 t["\uFB05"] = "\u017F\u0074"; 61563 t["\uFB06"] = "\u0073\u0074"; 61564 t["\uFB13"] = "\u0574\u0576"; 61565 t["\uFB14"] = "\u0574\u0565"; 61566 t["\uFB15"] = "\u0574\u056B"; 61567 t["\uFB16"] = "\u057E\u0576"; 61568 t["\uFB17"] = "\u0574\u056D"; 61569 t["\uFB4F"] = "\u05D0\u05DC"; 61570 t["\uFB50"] = "\u0671"; 61571 t["\uFB51"] = "\u0671"; 61572 t["\uFB52"] = "\u067B";
61573 t["\uFB53"] = "\u067B"; 61574 t["\uFB54"] = "\u067B"; 61575 t["\uFB55"] = "\u067B"; 61576 t["\uFB56"] = "\u067E"; 61577 t["\uFB57"] = "\u067E"; 61578 t["\uFB58"] = "\u067E"; 61579 t["\uFB59"] = "\u067E"; 61580 t["\uFB5A"] = "\u0680"; 61581 t["\uFB5B"] = "\u0680"; 61582 t["\uFB5C"] = "\u0680"; 61583 t["\uFB5D"] = "\u0680"; 61584 t["\uFB5E"] = "\u067A"; 61585 t["\uFB5F"] = "\u067A"; 61586 t["\uFB60"] = "\u067A"; 61587 t["\uFB61"] = "\u067A"; 61588 t["\uFB62"] = "\u067F"; 61589 t["\uFB63"] = "\u067F"; 61590 t["\uFB64"] = "\u067F"; 61591 t["\uFB65"] = "\u067F"; 61592 t["\uFB66"] = "\u0679"; 61593 t["\uFB67"] = "\u0679"; 61594 t["\uFB68"] = "\u0679"; 61595 t["\uFB69"] = "\u0679"; 61596 t["\uFB6A"] = "\u06A4"; 61597 t["\uFB6B"] = "\u06A4"; 61598 t["\uFB6C"] = "\u06A4"; 61599 t["\uFB6D"] = "\u06A4"; 61600 t["\uFB6E"] = "\u06A6"; 61601 t["\uFB6F"] = "\u06A6"; 61602 t["\uFB70"] = "\u06A6"; 61603 t["\uFB71"] = "\u06A6"; 61604 t["\uFB72"] = "\u0684"; 61605 t["\uFB73"] = "\u0684"; 61606 t["\uFB74"] = "\u0684"; 61607 t["\uFB75"] = "\u0684"; 61608 t["\uFB76"] = "\u0683"; 61609 t["\uFB77"] = "\u0683"; 61610 t["\uFB78"] = "\u0683"; 61611 t["\uFB79"] = "\u0683"; 61612 t["\uFB7A"] = "\u0686"; 61613 t["\uFB7B"] = "\u0686"; 61614 t["\uFB7C"] = "\u0686"; 61615 t["\uFB7D"] = "\u0686"; 61616 t["\uFB7E"] = "\u0687"; 61617 t["\uFB7F"] = "\u0687"; 61618 t["\uFB80"] = "\u0687"; 61619 t["\uFB81"] = "\u0687"; 61620 t["\uFB82"] = "\u068D"; 61621 t["\uFB83"] = "\u068D"; 61622 t["\uFB84"] = "\u068C"; 61623 t["\uFB85"] = "\u068C"; 61624 t["\uFB86"] = "\u068E"; 61625 t["\uFB87"] = "\u068E"; 61626 t["\uFB88"] = "\u0688"; 61627 t["\uFB89"] = "\u0688"; 61628 t["\uFB8A"] = "\u0698"; 61629 t["\uFB8B"] = "\u0698"; 61630 t["\uFB8C"] = "\u0691"; 61631 t["\uFB8D"] = "\u0691"; 61632 t["\uFB8E"] = "\u06A9"; 61633 t["\uFB8F"] = "\u06A9"; 61634 t["\uFB90"] = "\u06A9"; 61635 t["\uFB91"] = "\u06A9"; 61636 t["\uFB92"] = "\u06AF"; 61637 t["\uFB93"] = "\u06AF"; 61638 t["\uFB94"] = "\u06AF"; 61639 t["\uFB95"] = "\u06AF"; 61640 t["\uFB96"] = "\u06B3"; 61641 t["\uFB97"] = "\u06B3"; 61642 t["\uFB98"] = "\u06B3"; 61643 t["\uFB99"] = "\u06B3"; 61644 t["\uFB9A"] = "\u06B1"; 61645 t["\uFB9B"] = "\u06B1"; 61646 t["\uFB9C"] = "\u06B1"; 61647 t["\uFB9D"] = "\u06B1"; 61648 t["\uFB9E"] = "\u06BA"; 61649 t["\uFB9F"] = "\u06BA"; 61650 t["\uFBA0"] = "\u06BB"; 61651 t["\uFBA1"] = "\u06BB"; 61652 t["\uFBA2"] = "\u06BB"; 61653 t["\uFBA3"] = "\u06BB"; 61654 t["\uFBA4"] = "\u06C0"; 61655 t["\uFBA5"] = "\u06C0"; 61656 t["\uFBA6"] = "\u06C1"; 61657 t["\uFBA7"] = "\u06C1"; 61658 t["\uFBA8"] = "\u06C1"; 61659 t["\uFBA9"] = "\u06C1"; 61660 t["\uFBAA"] = "\u06BE"; 61661 t["\uFBAB"] = "\u06BE"; 61662 t["\uFBAC"] = "\u06BE"; 61663 t["\uFBAD"] = "\u06BE"; 61664 t["\uFBAE"] = "\u06D2"; 61665 t["\uFBAF"] = "\u06D2"; 61666 t["\uFBB0"] = "\u06D3"; 61667 t["\uFBB1"] = "\u06D3"; 61668 t["\uFBD3"] = "\u06AD"; 61669 t["\uFBD4"] = "\u06AD"; 61670 t["\uFBD5"] = "\u06AD"; 61671 t["\uFBD6"] = "\u06AD"; 61672 t["\uFBD7"] = "\u06C7"; 61673 t["\uFBD8"] = "\u06C7"; 61674 t["\uFBD9"] = "\u06C6"; 61675 t["\uFBDA"] = "\u06C6"; 61676 t["\uFBDB"] = "\u06C8"; 61677 t["\uFBDC"] = "\u06C8"; 61678 t["\uFBDD"] = "\u0677"; 61679 t["\uFBDE"] = "\u06CB"; 61680 t["\uFBDF"] = "\u06CB"; 61681 t["\uFBE0"] = "\u06C5"; 61682 t["\uFBE1"] = "\u06C5"; 61683 t["\uFBE2"] = "\u06C9"; 61684 t["\uFBE3"] = "\u06C9"; 61685 t["\uFBE4"] = "\u06D0"; 61686 t["\uFBE5"] = "\u06D0"; 61687 t["\uFBE6"] = "\u06D0"; 61688 t["\uFBE7"] = "\u06D0"; 61689 t["\uFBE8"] = "\u0649"; 61690 t["\uFBE9"] = "\u0649"; 61691 t["\uFBEA"] = "\u0626\u0627"; 61692 t["\uFBEB"] = "\u0626\u0627"; 61693 t["\uFBEC"] = "\u0626\u06D5"; 61694 t["\uFBED"] = "\u0626\u06D5"; 61695 t["\uFBEE"] = "\u0626\u0648"; 61696 t["\uFBEF"] = "\u0626\u0648"; 61697 t["\uFBF0"] = "\u0626\u06C7"; 61698 t["\uFBF1"] = "\u0626\u06C7"; 61699 t["\uFBF2"] = "\u0626\u06C6"; 61700 t["\uFBF3"] = "\u0626\u06C6"; 61701 t["\uFBF4"] = "\u0626\u06C8"; 61702 t["\uFBF5"] = "\u0626\u06C8"; 61703 t["\uFBF6"] = "\u0626\u06D0"; 61704 t["\uFBF7"] = "\u0626\u06D0"; 61705 t["\uFBF8"] = "\u0626\u06D0"; 61706 t["\uFBF9"] = "\u0626\u0649"; 61707 t["\uFBFA"] = "\u0626\u0649"; 61708 t["\uFBFB"] = "\u0626\u0649"; 61709 t["\uFBFC"] = "\u06CC"; 61710 t["\uFBFD"] = "\u06CC"; 61711 t["\uFBFE"] = "\u06CC"; 61712 t["\uFBFF"] = "\u06CC"; 61713 t["\uFC00"] = "\u0626\u062C"; 61714 t["\uFC01"] = "\u0626\u062D"; 61715 t["\uFC02"] = "\u0626\u0645"; 61716 t["\uFC03"] = "\u0626\u0649"; 61717 t["\uFC04"] = "\u0626\u064A"; 61718 t["\uFC05"] = "\u0628\u062C"; 61719 t["\uFC06"] = "\u0628\u062D"; 61720 t["\uFC07"] = "\u0628\u062E"; 61721 t["\uFC08"] = "\u0628\u0645"; 61722 t["\uFC09"] = "\u0628\u0649"; 61723 t["\uFC0A"] = "\u0628\u064A"; 61724 t["\uFC0B"] = "\u062A\u062C"; 61725 t["\uFC0C"] = "\u062A\u062D"; 61726 t["\uFC0D"] = "\u062A\u062E"; 61727 t["\uFC0E"] = "\u062A\u0645"; 61728 t["\uFC0F"] = "\u062A\u0649"; 61729 t["\uFC10"] = "\u062A\u064A"; 61730 t["\uFC11"] = "\u062B\u062C"; 61731 t["\uFC12"] = "\u062B\u0645"; 61732 t["\uFC13"] = "\u062B\u0649"; 61733 t["\uFC14"] = "\u062B\u064A"; 61734 t["\uFC15"] = "\u062C\u062D"; 61735 t["\uFC16"] = "\u062C\u0645"; 61736 t["\uFC17"] = "\u062D\u062C"; 61737 t["\uFC18"] = "\u062D\u0645"; 61738 t["\uFC19"] = "\u062E\u062C"; 61739 t["\uFC1A"] = "\u062E\u062D"; 61740 t["\uFC1B"] = "\u062E\u0645";
61741 t["\uFC1C"] = "\u0633\u062C"; 61742 t["\uFC1D"] = "\u0633\u062D"; 61743 t["\uFC1E"] = "\u0633\u062E"; 61744 t["\uFC1F"] = "\u0633\u0645"; 61745 t["\uFC20"] = "\u0635\u062D"; 61746 t["\uFC21"] = "\u0635\u0645"; 61747 t["\uFC22"] = "\u0636\u062C"; 61748 t["\uFC23"] = "\u0636\u062D"; 61749 t["\uFC24"] = "\u0636\u062E"; 61750 t["\uFC25"] = "\u0636\u0645"; 61751 t["\uFC26"] = "\u0637\u062D"; 61752 t["\uFC27"] = "\u0637\u0645"; 61753 t["\uFC28"] = "\u0638\u0645"; 61754 t["\uFC29"] = "\u0639\u062C"; 61755 t["\uFC2A"] = "\u0639\u0645"; 61756 t["\uFC2B"] = "\u063A\u062C"; 61757 t["\uFC2C"] = "\u063A\u0645"; 61758 t["\uFC2D"] = "\u0641\u062C"; 61759 t["\uFC2E"] = "\u0641\u062D"; 61760 t["\uFC2F"] = "\u0641\u062E"; 61761 t["\uFC30"] = "\u0641\u0645"; 61762 t["\uFC31"] = "\u0641\u0649"; 61763 t["\uFC32"] = "\u0641\u064A"; 61764 t["\uFC33"] = "\u0642\u062D"; 61765 t["\uFC34"] = "\u0642\u0645"; 61766 t["\uFC35"] = "\u0642\u0649"; 61767 t["\uFC36"] = "\u0642\u064A"; 61768 t["\uFC37"] = "\u0643\u0627"; 61769 t["\uFC38"] = "\u0643\u062C"; 61770 t["\uFC39"] = "\u0643\u062D"; 61771 t["\uFC3A"] = "\u0643\u062E"; 61772 t["\uFC3B"] = "\u0643\u0644"; 61773 t["\uFC3C"] = "\u0643\u0645"; 61774 t["\uFC3D"] = "\u0643\u0649"; 61775 t["\uFC3E"] = "\u0643\u064A"; 61776 t["\uFC3F"] = "\u0644\u062C"; 61777 t["\uFC40"] = "\u0644\u062D"; 61778 t["\uFC41"] = "\u0644\u062E"; 61779 t["\uFC42"] = "\u0644\u0645"; 61780 t["\uFC43"] = "\u0644\u0649"; 61781 t["\uFC44"] = "\u0644\u064A"; 61782 t["\uFC45"] = "\u0645\u062C"; 61783 t["\uFC46"] = "\u0645\u062D"; 61784 t["\uFC47"] = "\u0645\u062E"; 61785 t["\uFC48"] = "\u0645\u0645"; 61786 t["\uFC49"] = "\u0645\u0649"; 61787 t["\uFC4A"] = "\u0645\u064A"; 61788 t["\uFC4B"] = "\u0646\u062C"; 61789 t["\uFC4C"] = "\u0646\u062D"; 61790 t["\uFC4D"] = "\u0646\u062E"; 61791 t["\uFC4E"] = "\u0646\u0645"; 61792 t["\uFC4F"] = "\u0646\u0649"; 61793 t["\uFC50"] = "\u0646\u064A"; 61794 t["\uFC51"] = "\u0647\u062C"; 61795 t["\uFC52"] = "\u0647\u0645"; 61796 t["\uFC53"] = "\u0647\u0649"; 61797 t["\uFC54"] = "\u0647\u064A"; 61798 t["\uFC55"] = "\u064A\u062C"; 61799 t["\uFC56"] = "\u064A\u062D"; 61800 t["\uFC57"] = "\u064A\u062E"; 61801 t["\uFC58"] = "\u064A\u0645"; 61802 t["\uFC59"] = "\u064A\u0649"; 61803 t["\uFC5A"] = "\u064A\u064A"; 61804 t["\uFC5B"] = "\u0630\u0670"; 61805 t["\uFC5C"] = "\u0631\u0670"; 61806 t["\uFC5D"] = "\u0649\u0670"; 61807 t["\uFC5E"] = "\u0020\u064C\u0651"; 61808 t["\uFC5F"] = "\u0020\u064D\u0651"; 61809 t["\uFC60"] = "\u0020\u064E\u0651"; 61810 t["\uFC61"] = "\u0020\u064F\u0651"; 61811 t["\uFC62"] = "\u0020\u0650\u0651"; 61812 t["\uFC63"] = "\u0020\u0651\u0670"; 61813 t["\uFC64"] = "\u0626\u0631"; 61814 t["\uFC65"] = "\u0626\u0632"; 61815 t["\uFC66"] = "\u0626\u0645"; 61816 t["\uFC67"] = "\u0626\u0646"; 61817 t["\uFC68"] = "\u0626\u0649"; 61818 t["\uFC69"] = "\u0626\u064A"; 61819 t["\uFC6A"] = "\u0628\u0631"; 61820 t["\uFC6B"] = "\u0628\u0632"; 61821 t["\uFC6C"] = "\u0628\u0645"; 61822 t["\uFC6D"] = "\u0628\u0646"; 61823 t["\uFC6E"] = "\u0628\u0649"; 61824 t["\uFC6F"] = "\u0628\u064A"; 61825 t["\uFC70"] = "\u062A\u0631"; 61826 t["\uFC71"] = "\u062A\u0632"; 61827 t["\uFC72"] = "\u062A\u0645"; 61828 t["\uFC73"] = "\u062A\u0646"; 61829 t["\uFC74"] = "\u062A\u0649"; 61830 t["\uFC75"] = "\u062A\u064A"; 61831 t["\uFC76"] = "\u062B\u0631"; 61832 t["\uFC77"] = "\u062B\u0632"; 61833 t["\uFC78"] = "\u062B\u0645"; 61834 t["\uFC79"] = "\u062B\u0646"; 61835 t["\uFC7A"] = "\u062B\u0649"; 61836 t["\uFC7B"] = "\u062B\u064A"; 61837 t["\uFC7C"] = "\u0641\u0649"; 61838 t["\uFC7D"] = "\u0641\u064A"; 61839 t["\uFC7E"] = "\u0642\u0649"; 61840 t["\uFC7F"] = "\u0642\u064A"; 61841 t["\uFC80"] = "\u0643\u0627"; 61842 t["\uFC81"] = "\u0643\u0644"; 61843 t["\uFC82"] = "\u0643\u0645"; 61844 t["\uFC83"] = "\u0643\u0649"; 61845 t["\uFC84"] = "\u0643\u064A"; 61846 t["\uFC85"] = "\u0644\u0645"; 61847 t["\uFC86"] = "\u0644\u0649"; 61848 t["\uFC87"] = "\u0644\u064A"; 61849 t["\uFC88"] = "\u0645\u0627"; 61850 t["\uFC89"] = "\u0645\u0645"; 61851 t["\uFC8A"] = "\u0646\u0631"; 61852 t["\uFC8B"] = "\u0646\u0632"; 61853 t["\uFC8C"] = "\u0646\u0645"; 61854 t["\uFC8D"] = "\u0646\u0646"; 61855 t["\uFC8E"] = "\u0646\u0649"; 61856 t["\uFC8F"] = "\u0646\u064A"; 61857 t["\uFC90"] = "\u0649\u0670"; 61858 t["\uFC91"] = "\u064A\u0631"; 61859 t["\uFC92"] = "\u064A\u0632"; 61860 t["\uFC93"] = "\u064A\u0645"; 61861 t["\uFC94"] = "\u064A\u0646"; 61862 t["\uFC95"] = "\u064A\u0649"; 61863 t["\uFC96"] = "\u064A\u064A"; 61864 t["\uFC97"] = "\u0626\u062C"; 61865 t["\uFC98"] = "\u0626\u062D"; 61866 t["\uFC99"] = "\u0626\u062E"; 61867 t["\uFC9A"] = "\u0626\u0645"; 61868 t["\uFC9B"] = "\u0626\u0647"; 61869 t["\uFC9C"] = "\u0628\u062C"; 61870 t["\uFC9D"] = "\u0628\u062D"; 61871 t["\uFC9E"] = "\u0628\u062E"; 61872 t["\uFC9F"] = "\u0628\u0645"; 61873 t["\uFCA0"] = "\u0628\u0647"; 61874 t["\uFCA1"] = "\u062A\u062C"; 61875 t["\uFCA2"] = "\u062A\u062D"; 61876 t["\uFCA3"] = "\u062A\u062E"; 61877 t["\uFCA4"] = "\u062A\u0645"; 61878 t["\uFCA5"] = "\u062A\u0647"; 61879 t["\uFCA6"] = "\u062B\u0645"; 61880 t["\uFCA7"] = "\u062C\u062D"; 61881 t["\uFCA8"] = "\u062C\u0645"; 61882 t["\uFCA9"] = "\u062D\u062C"; 61883 t["\uFCAA"] = "\u062D\u0645"; 61884 t["\uFCAB"] = "\u062E\u062C"; 61885 t["\uFCAC"] = "\u062E\u0645";
61886 t["\uFCAD"] = "\u0633\u062C"; 61887 t["\uFCAE"] = "\u0633\u062D"; 61888 t["\uFCAF"] = "\u0633\u062E"; 61889 t["\uFCB0"] = "\u0633\u0645"; 61890 t["\uFCB1"] = "\u0635\u062D"; 61891 t["\uFCB2"] = "\u0635\u062E"; 61892 t["\uFCB3"] = "\u0635\u0645"; 61893 t["\uFCB4"] = "\u0636\u062C"; 61894 t["\uFCB5"] = "\u0636\u062D"; 61895 t["\uFCB6"] = "\u0636\u062E"; 61896 t["\uFCB7"] = "\u0636\u0645"; 61897 t["\uFCB8"] = "\u0637\u062D"; 61898 t["\uFCB9"] = "\u0638\u0645"; 61899 t["\uFCBA"] = "\u0639\u062C"; 61900 t["\uFCBB"] = "\u0639\u0645"; 61901 t["\uFCBC"] = "\u063A\u062C"; 61902 t["\uFCBD"] = "\u063A\u0645"; 61903 t["\uFCBE"] = "\u0641\u062C"; 61904 t["\uFCBF"] = "\u0641\u062D"; 61905 t["\uFCC0"] = "\u0641\u062E"; 61906 t["\uFCC1"] = "\u0641\u0645"; 61907 t["\uFCC2"] = "\u0642\u062D"; 61908 t["\uFCC3"] = "\u0642\u0645"; 61909 t["\uFCC4"] = "\u0643\u062C"; 61910 t["\uFCC5"] = "\u0643\u062D"; 61911 t["\uFCC6"] = "\u0643\u062E"; 61912 t["\uFCC7"] = "\u0643\u0644"; 61913 t["\uFCC8"] = "\u0643\u0645"; 61914 t["\uFCC9"] = "\u0644\u062C"; 61915 t["\uFCCA"] = "\u0644\u062D"; 61916 t["\uFCCB"] = "\u0644\u062E"; 61917 t["\uFCCC"] = "\u0644\u0645"; 61918 t["\uFCCD"] = "\u0644\u0647"; 61919 t["\uFCCE"] = "\u0645\u062C"; 61920 t["\uFCCF"] = "\u0645\u062D"; 61921 t["\uFCD0"] = "\u0645\u062E"; 61922 t["\uFCD1"] = "\u0645\u0645"; 61923 t["\uFCD2"] = "\u0646\u062C"; 61924 t["\uFCD3"] = "\u0646\u062D"; 61925 t["\uFCD4"] = "\u0646\u062E"; 61926 t["\uFCD5"] = "\u0646\u0645"; 61927 t["\uFCD6"] = "\u0646\u0647"; 61928 t["\uFCD7"] = "\u0647\u062C"; 61929 t["\uFCD8"] = "\u0647\u0645"; 61930 t["\uFCD9"] = "\u0647\u0670"; 61931 t["\uFCDA"] = "\u064A\u062C"; 61932 t["\uFCDB"] = "\u064A\u062D"; 61933 t["\uFCDC"] = "\u064A\u062E"; 61934 t["\uFCDD"] = "\u064A\u0645"; 61935 t["\uFCDE"] = "\u064A\u0647"; 61936 t["\uFCDF"] = "\u0626\u0645"; 61937 t["\uFCE0"] = "\u0626\u0647"; 61938 t["\uFCE1"] = "\u0628\u0645"; 61939 t["\uFCE2"] = "\u0628\u0647"; 61940 t["\uFCE3"] = "\u062A\u0645"; 61941 t["\uFCE4"] = "\u062A\u0647"; 61942 t["\uFCE5"] = "\u062B\u0645"; 61943 t["\uFCE6"] = "\u062B\u0647"; 61944 t["\uFCE7"] = "\u0633\u0645"; 61945 t["\uFCE8"] = "\u0633\u0647"; 61946 t["\uFCE9"] = "\u0634\u0645"; 61947 t["\uFCEA"] = "\u0634\u0647"; 61948 t["\uFCEB"] = "\u0643\u0644"; 61949 t["\uFCEC"] = "\u0643\u0645"; 61950 t["\uFCED"] = "\u0644\u0645"; 61951 t["\uFCEE"] = "\u0646\u0645"; 61952 t["\uFCEF"] = "\u0646\u0647"; 61953 t["\uFCF0"] = "\u064A\u0645"; 61954 t["\uFCF1"] = "\u064A\u0647"; 61955 t["\uFCF2"] = "\u0640\u064E\u0651"; 61956 t["\uFCF3"] = "\u0640\u064F\u0651"; 61957 t["\uFCF4"] = "\u0640\u0650\u0651"; 61958 t["\uFCF5"] = "\u0637\u0649"; 61959 t["\uFCF6"] = "\u0637\u064A"; 61960 t["\uFCF7"] = "\u0639\u0649"; 61961 t["\uFCF8"] = "\u0639\u064A"; 61962 t["\uFCF9"] = "\u063A\u0649"; 61963 t["\uFCFA"] = "\u063A\u064A"; 61964 t["\uFCFB"] = "\u0633\u0649"; 61965 t["\uFCFC"] = "\u0633\u064A"; 61966 t["\uFCFD"] = "\u0634\u0649"; 61967 t["\uFCFE"] = "\u0634\u064A"; 61968 t["\uFCFF"] = "\u062D\u0649"; 61969 t["\uFD00"] = "\u062D\u064A"; 61970 t["\uFD01"] = "\u062C\u0649"; 61971 t["\uFD02"] = "\u062C\u064A"; 61972 t["\uFD03"] = "\u062E\u0649"; 61973 t["\uFD04"] = "\u062E\u064A"; 61974 t["\uFD05"] = "\u0635\u0649"; 61975 t["\uFD06"] = "\u0635\u064A"; 61976 t["\uFD07"] = "\u0636\u0649"; 61977 t["\uFD08"] = "\u0636\u064A"; 61978 t["\uFD09"] = "\u0634\u062C"; 61979 t["\uFD0A"] = "\u0634\u062D"; 61980 t["\uFD0B"] = "\u0634\u062E"; 61981 t["\uFD0C"] = "\u0634\u0645"; 61982 t["\uFD0D"] = "\u0634\u0631"; 61983 t["\uFD0E"] = "\u0633\u0631"; 61984 t["\uFD0F"] = "\u0635\u0631"; 61985 t["\uFD10"] = "\u0636\u0631"; 61986 t["\uFD11"] = "\u0637\u0649"; 61987 t["\uFD12"] = "\u0637\u064A"; 61988 t["\uFD13"] = "\u0639\u0649"; 61989 t["\uFD14"] = "\u0639\u064A"; 61990 t["\uFD15"] = "\u063A\u0649"; 61991 t["\uFD16"] = "\u063A\u064A"; 61992 t["\uFD17"] = "\u0633\u0649"; 61993 t["\uFD18"] = "\u0633\u064A"; 61994 t["\uFD19"] = "\u0634\u0649"; 61995 t["\uFD1A"] = "\u0634\u064A"; 61996 t["\uFD1B"] = "\u062D\u0649"; 61997 t["\uFD1C"] = "\u062D\u064A"; 61998 t["\uFD1D"] = "\u062C\u0649"; 61999 t["\uFD1E"] = "\u062C\u064A"; 62000 t["\uFD1F"] = "\u062E\u0649"; 62001 t["\uFD20"] = "\u062E\u064A"; 62002 t["\uFD21"] = "\u0635\u0649"; 62003 t["\uFD22"] = "\u0635\u064A"; 62004 t["\uFD23"] = "\u0636\u0649"; 62005 t["\uFD24"] = "\u0636\u064A"; 62006 t["\uFD25"] = "\u0634\u062C"; 62007 t["\uFD26"] = "\u0634\u062D"; 62008 t["\uFD27"] = "\u0634\u062E"; 62009 t["\uFD28"] = "\u0634\u0645"; 62010 t["\uFD29"] = "\u0634\u0631"; 62011 t["\uFD2A"] = "\u0633\u0631"; 62012 t["\uFD2B"] = "\u0635\u0631"; 62013 t["\uFD2C"] = "\u0636\u0631"; 62014 t["\uFD2D"] = "\u0634\u062C"; 62015 t["\uFD2E"] = "\u0634\u062D"; 62016 t["\uFD2F"] = "\u0634\u062E"; 62017 t["\uFD30"] = "\u0634\u0645"; 62018 t["\uFD31"] = "\u0633\u0647"; 62019 t["\uFD32"] = "\u0634\u0647"; 62020 t["\uFD33"] = "\u0637\u0645";
62021 t["\uFD34"] = "\u0633\u062C"; 62022 t["\uFD35"] = "\u0633\u062D"; 62023 t["\uFD36"] = "\u0633\u062E"; 62024 t["\uFD37"] = "\u0634\u062C"; 62025 t["\uFD38"] = "\u0634\u062D"; 62026 t["\uFD39"] = "\u0634\u062E"; 62027 t["\uFD3A"] = "\u0637\u0645"; 62028 t["\uFD3B"] = "\u0638\u0645"; 62029 t["\uFD3C"] = "\u0627\u064B"; 62030 t["\uFD3D"] = "\u0627\u064B"; 62031 t["\uFD50"] = "\u062A\u062C\u0645"; 62032 t["\uFD51"] = "\u062A\u062D\u062C"; 62033 t["\uFD52"] = "\u062A\u062D\u062C"; 62034 t["\uFD53"] = "\u062A\u062D\u0645"; 62035 t["\uFD54"] = "\u062A\u062E\u0645"; 62036 t["\uFD55"] = "\u062A\u0645\u062C"; 62037 t["\uFD56"] = "\u062A\u0645\u062D"; 62038 t["\uFD57"] = "\u062A\u0645\u062E"; 62039 t["\uFD58"] = "\u062C\u0645\u062D"; 62040 t["\uFD59"] = "\u062C\u0645\u062D"; 62041 t["\uFD5A"] = "\u062D\u0645\u064A"; 62042 t["\uFD5B"] = "\u062D\u0645\u0649"; 62043 t["\uFD5C"] = "\u0633\u062D\u062C"; 62044 t["\uFD5D"] = "\u0633\u062C\u062D"; 62045 t["\uFD5E"] = "\u0633\u062C\u0649"; 62046 t["\uFD5F"] = "\u0633\u0645\u062D"; 62047 t["\uFD60"] = "\u0633\u0645\u062D"; 62048 t["\uFD61"] = "\u0633\u0645\u062C"; 62049 t["\uFD62"] = "\u0633\u0645\u0645"; 62050 t["\uFD63"] = "\u0633\u0645\u0645"; 62051 t["\uFD64"] = "\u0635\u062D\u062D"; 62052 t["\uFD65"] = "\u0635\u062D\u062D"; 62053 t["\uFD66"] = "\u0635\u0645\u0645"; 62054 t["\uFD67"] = "\u0634\u062D\u0645"; 62055 t["\uFD68"] = "\u0634\u062D\u0645"; 62056 t["\uFD69"] = "\u0634\u062C\u064A"; 62057 t["\uFD6A"] = "\u0634\u0645\u062E"; 62058 t["\uFD6B"] = "\u0634\u0645\u062E"; 62059 t["\uFD6C"] = "\u0634\u0645\u0645"; 62060 t["\uFD6D"] = "\u0634\u0645\u0645"; 62061 t["\uFD6E"] = "\u0636\u062D\u0649"; 62062 t["\uFD6F"] = "\u0636\u062E\u0645"; 62063 t["\uFD70"] = "\u0636\u062E\u0645"; 62064 t["\uFD71"] = "\u0637\u0645\u062D"; 62065 t["\uFD72"] = "\u0637\u0645\u062D"; 62066 t["\uFD73"] = "\u0637\u0645\u0645"; 62067 t["\uFD74"] = "\u0637\u0645\u064A"; 62068 t["\uFD75"] = "\u0639\u062C\u0645"; 62069 t["\uFD76"] = "\u0639\u0645\u0645"; 62070 t["\uFD77"] = "\u0639\u0645\u0645"; 62071 t["\uFD78"] = "\u0639\u0645\u0649"; 62072 t["\uFD79"] = "\u063A\u0645\u0645"; 62073 t["\uFD7A"] = "\u063A\u0645\u064A"; 62074 t["\uFD7B"] = "\u063A\u0645\u0649"; 62075 t["\uFD7C"] = "\u0641\u062E\u0645"; 62076 t["\uFD7D"] = "\u0641\u062E\u0645"; 62077 t["\uFD7E"] = "\u0642\u0645\u062D"; 62078 t["\uFD7F"] = "\u0642\u0645\u0645"; 62079 t["\uFD80"] = "\u0644\u062D\u0645"; 62080 t["\uFD81"] = "\u0644\u062D\u064A"; 62081 t["\uFD82"] = "\u0644\u062D\u0649"; 62082 t["\uFD83"] = "\u0644\u062C\u062C"; 62083 t["\uFD84"] = "\u0644\u062C\u062C"; 62084 t["\uFD85"] = "\u0644\u062E\u0645"; 62085 t["\uFD86"] = "\u0644\u062E\u0645"; 62086 t["\uFD87"] = "\u0644\u0645\u062D"; 62087 t["\uFD88"] = "\u0644\u0645\u062D"; 62088 t["\uFD89"] = "\u0645\u062D\u062C"; 62089 t["\uFD8A"] = "\u0645\u062D\u0645"; 62090 t["\uFD8B"] = "\u0645\u062D\u064A"; 62091 t["\uFD8C"] = "\u0645\u062C\u062D"; 62092 t["\uFD8D"] = "\u0645\u062C\u0645"; 62093 t["\uFD8E"] = "\u0645\u062E\u062C"; 62094 t["\uFD8F"] = "\u0645\u062E\u0645"; 62095 t["\uFD92"] = "\u0645\u062C\u062E"; 62096 t["\uFD93"] = "\u0647\u0645\u062C"; 62097 t["\uFD94"] = "\u0647\u0645\u0645"; 62098 t["\uFD95"] = "\u0646\u062D\u0645"; 62099 t["\uFD96"] = "\u0646\u062D\u0649"; 62100 t["\uFD97"] = "\u0646\u062C\u0645"; 62101 t["\uFD98"] = "\u0646\u062C\u0645"; 62102 t["\uFD99"] = "\u0646\u062C\u0649"; 62103 t["\uFD9A"] = "\u0646\u0645\u064A"; 62104 t["\uFD9B"] = "\u0646\u0645\u0649"; 62105 t["\uFD9C"] = "\u064A\u0645\u0645"; 62106 t["\uFD9D"] = "\u064A\u0645\u0645"; 62107 t["\uFD9E"] = "\u0628\u062E\u064A"; 62108 t["\uFD9F"] = "\u062A\u062C\u064A"; 62109 t["\uFDA0"] = "\u062A\u062C\u0649"; 62110 t["\uFDA1"] = "\u062A\u062E\u064A"; 62111 t["\uFDA2"] = "\u062A\u062E\u0649"; 62112 t["\uFDA3"] = "\u062A\u0645\u064A"; 62113 t["\uFDA4"] = "\u062A\u0645\u0649"; 62114 t["\uFDA5"] = "\u062C\u0645\u064A"; 62115 t["\uFDA6"] = "\u062C\u062D\u0649"; 62116 t["\uFDA7"] = "\u062C\u0645\u0649"; 62117 t["\uFDA8"] = "\u0633\u062E\u0649"; 62118 t["\uFDA9"] = "\u0635\u062D\u064A"; 62119 t["\uFDAA"] = "\u0634\u062D\u064A"; 62120 t["\uFDAB"] = "\u0636\u062D\u064A"; 62121 t["\uFDAC"] = "\u0644\u062C\u064A"; 62122 t["\uFDAD"] = "\u0644\u0645\u064A"; 62123 t["\uFDAE"] = "\u064A\u062D\u064A"; 62124 t["\uFDAF"] = "\u064A\u062C\u064A"; 62125 t["\uFDB0"] = "\u064A\u0645\u064A"; 62126 t["\uFDB1"] = "\u0645\u0645\u064A"; 62127 t["\uFDB2"] = "\u0642\u0645\u064A"; 62128 t["\uFDB3"] = "\u0646\u062D\u064A"; 62129 t["\uFDB4"] = "\u0642\u0645\u062D"; 62130 t["\uFDB5"] = "\u0644\u062D\u0645"; 62131 t["\uFDB6"] = "\u0639\u0645\u064A"; 62132 t["\uFDB7"] = "\u0643\u0645\u064A"; 62133 t["\uFDB8"] = "\u0646\u062C\u062D"; 62134 t["\uFDB9"] = "\u0645\u062E\u064A"; 62135 t["\uFDBA"] = "\u0644\u062C\u0645"; 62136 t["\uFDBB"] = "\u0643\u0645\u0645"; 62137 t["\uFDBC"] = "\u0644\u062C\u0645"; 62138 t["\uFDBD"] = "\u0646\u062C\u062D"; 62139 t["\uFDBE"] = "\u062C\u062D\u064A"; 62140 t["\uFDBF"] = "\u062D\u062C\u064A"; 62141 t["\uFDC0"] = "\u0645\u062C\u064A"; 62142 t["\uFDC1"] = "\u0641\u0645\u064A"; 62143 t["\uFDC2"] = "\u0628\u062D\u064A"; 62144 t["\uFDC3"] = "\u0643\u0645\u0645"; 62145 t["\uFDC4"] = "\u0639\u062C\u0645"; 62146 t["\uFDC5"] = "\u0635\u0645\u0645"; 62147 t["\uFDC6"] = "\u0633\u062E\u064A"; 62148 t["\uFDC7"] = "\u0646\u062C\u064A"; 62149 t["\uFE49"] = "\u203E"; 62150 t["\uFE4A"] = "\u203E"; 62151 t["\uFE4B"] = "\u203E"; 62152 t["\uFE4C"] = "\u203E"; 62153 t["\uFE4D"] = "\u005F"; 62154 t["\uFE4E"] = "\u005F"; 62155 t["\uFE4F"] = "\u005F"; 62156 t["\uFE80"] = "\u0621"; 62157 t["\uFE81"] = "\u0622"; 62158 t["\uFE82"] = "\u0622"; 62159 t["\uFE83"] = "\u0623"; 62160 t["\uFE84"] = "\u0623"; 62161 t["\uFE85"] = "\u0624"; 62162 t["\uFE86"] = "\u0624"; 62163 t["\uFE87"] = "\u0625"; 62164 t["\uFE88"] = "\u0625"; 62165 t["\uFE89"] = "\u0626"; 62166 t["\uFE8A"] = "\u0626"; 62167 t["\uFE8B"] = "\u0626"; 62168 t["\uFE8C"] = "\u0626"; 62169 t["\uFE8D"] = "\u0627"; 62170 t["\uFE8E"] = "\u0627"; 62171 t["\uFE8F"] = "\u0628"; 62172 t["\uFE90"] = "\u0628"; 62173 t["\uFE91"] = "\u0628"; 62174 t["\uFE92"] = "\u0628"; 62175 t["\uFE93"] = "\u0629"; 62176 t["\uFE94"] = "\u0629"; 62177 t["\uFE95"] = "\u062A"; 62178 t["\uFE96"] = "\u062A"; 62179 t["\uFE97"] = "\u062A"; 62180 t["\uFE98"] = "\u062A"; 62181 t["\uFE99"] = "\u062B"; 62182 t["\uFE9A"] = "\u062B"; 62183 t["\uFE9B"] = "\u062B"; 62184 t["\uFE9C"] = "\u062B"; 62185 t["\uFE9D"] = "\u062C"; 62186 t["\uFE9E"] = "\u062C"; 62187 t["\uFE9F"] = "\u062C"; 62188 t["\uFEA0"] = "\u062C"; 62189 t["\uFEA1"] = "\u062D"; 62190 t["\uFEA2"] = "\u062D"; 62191 t["\uFEA3"] = "\u062D"; 62192 t["\uFEA4"] = "\u062D"; 62193 t["\uFEA5"] = "\u062E"; 62194 t["\uFEA6"] = "\u062E"; 62195 t["\uFEA7"] = "\u062E"; 62196 t["\uFEA8"] = "\u062E"; 62197 t["\uFEA9"] = "\u062F"; 62198 t["\uFEAA"] = "\u062F"; 62199 t["\uFEAB"] = "\u0630"; 62200 t["\uFEAC"] = "\u0630";
62201 t["\uFEAD"] = "\u0631"; 62202 t["\uFEAE"] = "\u0631"; 62203 t["\uFEAF"] = "\u0632"; 62204 t["\uFEB0"] = "\u0632"; 62205 t["\uFEB1"] = "\u0633"; 62206 t["\uFEB2"] = "\u0633"; 62207 t["\uFEB3"] = "\u0633"; 62208 t["\uFEB4"] = "\u0633"; 62209 t["\uFEB5"] = "\u0634"; 62210 t["\uFEB6"] = "\u0634"; 62211 t["\uFEB7"] = "\u0634"; 62212 t["\uFEB8"] = "\u0634"; 62213 t["\uFEB9"] = "\u0635"; 62214 t["\uFEBA"] = "\u0635"; 62215 t["\uFEBB"] = "\u0635"; 62216 t["\uFEBC"] = "\u0635"; 62217 t["\uFEBD"] = "\u0636"; 62218 t["\uFEBE"] = "\u0636"; 62219 t["\uFEBF"] = "\u0636"; 62220 t["\uFEC0"] = "\u0636"; 62221 t["\uFEC1"] = "\u0637"; 62222 t["\uFEC2"] = "\u0637"; 62223 t["\uFEC3"] = "\u0637"; 62224 t["\uFEC4"] = "\u0637"; 62225 t["\uFEC5"] = "\u0638"; 62226 t["\uFEC6"] = "\u0638"; 62227 t["\uFEC7"] = "\u0638"; 62228 t["\uFEC8"] = "\u0638"; 62229 t["\uFEC9"] = "\u0639"; 62230 t["\uFECA"] = "\u0639"; 62231 t["\uFECB"] = "\u0639"; 62232 t["\uFECC"] = "\u0639"; 62233 t["\uFECD"] = "\u063A"; 62234 t["\uFECE"] = "\u063A"; 62235 t["\uFECF"] = "\u063A"; 62236 t["\uFED0"] = "\u063A"; 62237 t["\uFED1"] = "\u0641"; 62238 t["\uFED2"] = "\u0641"; 62239 t["\uFED3"] = "\u0641"; 62240 t["\uFED4"] = "\u0641"; 62241 t["\uFED5"] = "\u0642"; 62242 t["\uFED6"] = "\u0642"; 62243 t["\uFED7"] = "\u0642"; 62244 t["\uFED8"] = "\u0642"; 62245 t["\uFED9"] = "\u0643"; 62246 t["\uFEDA"] = "\u0643"; 62247 t["\uFEDB"] = "\u0643"; 62248 t["\uFEDC"] = "\u0643"; 62249 t["\uFEDD"] = "\u0644"; 62250 t["\uFEDE"] = "\u0644"; 62251 t["\uFEDF"] = "\u0644"; 62252 t["\uFEE0"] = "\u0644"; 62253 t["\uFEE1"] = "\u0645"; 62254 t["\uFEE2"] = "\u0645"; 62255 t["\uFEE3"] = "\u0645"; 62256 t["\uFEE4"] = "\u0645"; 62257 t["\uFEE5"] = "\u0646"; 62258 t["\uFEE6"] = "\u0646"; 62259 t["\uFEE7"] = "\u0646"; 62260 t["\uFEE8"] = "\u0646"; 62261 t["\uFEE9"] = "\u0647"; 62262 t["\uFEEA"] = "\u0647"; 62263 t["\uFEEB"] = "\u0647"; 62264 t["\uFEEC"] = "\u0647"; 62265 t["\uFEED"] = "\u0648"; 62266 t["\uFEEE"] = "\u0648"; 62267 t["\uFEEF"] = "\u0649"; 62268 t["\uFEF0"] = "\u0649"; 62269 t["\uFEF1"] = "\u064A"; 62270 t["\uFEF2"] = "\u064A"; 62271 t["\uFEF3"] = "\u064A"; 62272 t["\uFEF4"] = "\u064A"; 62273 t["\uFEF5"] = "\u0644\u0622"; 62274 t["\uFEF6"] = "\u0644\u0622"; 62275 t["\uFEF7"] = "\u0644\u0623"; 62276 t["\uFEF8"] = "\u0644\u0623"; 62277 t["\uFEF9"] = "\u0644\u0625"; 62278 t["\uFEFA"] = "\u0644\u0625"; 62279 t["\uFEFB"] = "\u0644\u0627"; 62280 t["\uFEFC"] = "\u0644\u0627"; 62281}); 62282function reverseIfRtl(chars) { 62283 var charsLength = chars.length; 62284 if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) { 62285 return chars; 62286 } 62287 var s = ""; 62288 for (var ii = charsLength - 1; ii >= 0; ii--) { 62289 s += chars[ii]; 62290 } 62291 return s; 62292} 62293exports.mapSpecialUnicodeValues = mapSpecialUnicodeValues; 62294exports.reverseIfRtl = reverseIfRtl; 62295exports.getUnicodeRangeFor = getUnicodeRangeFor; 62296exports.getNormalizedUnicodes = getNormalizedUnicodes; 62297exports.getUnicodeForGlyph = getUnicodeForGlyph; 62298 62299/***/ }), 62300/* 34 */ 62301/***/ (function(module, exports, __w_pdfjs_require__) { 62302 62303"use strict"; 62304 62305 62306Object.defineProperty(exports, "__esModule", { 62307 value: true 62308}); 62309exports.FontRendererFactory = void 0; 62310 62311var _util = __w_pdfjs_require__(2); 62312 62313var _cff_parser = __w_pdfjs_require__(28); 62314 62315var _glyphlist = __w_pdfjs_require__(31); 62316 62317var _encodings = __w_pdfjs_require__(30); 62318 62319var _stream = __w_pdfjs_require__(11); 62320 62321var FontRendererFactory = function FontRendererFactoryClosure() { 62322 function getLong(data, offset) { 62323 return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]; 62324 } 62325 62326 function getUshort(data, offset) { 62327 return data[offset] << 8 | data[offset + 1]; 62328 } 62329 62330 function getSubroutineBias(subrs) { 62331 const numSubrs = subrs.length; 62332 let bias = 32768; 62333 62334 if (numSubrs < 1240) { 62335 bias = 107; 62336 } else if (numSubrs < 33900) { 62337 bias = 1131; 62338 } 62339 62340 return bias; 62341 } 62342 62343 function parseCmap(data, start, end) { 62344 var offset = getUshort(data, start + 2) === 1 ? getLong(data, start + 8) : getLong(data, start + 16); 62345 var format = getUshort(data, start + offset); 62346 var ranges, p, i; 62347 62348 if (format === 4) { 62349 getUshort(data, start + offset + 2); 62350 var segCount = getUshort(data, start + offset + 6) >> 1; 62351 p = start + offset + 14; 62352 ranges = []; 62353 62354 for (i = 0; i < segCount; i++, p += 2) { 62355 ranges[i] = { 62356 end: getUshort(data, p) 62357 }; 62358 } 62359 62360 p += 2; 62361 62362 for (i = 0; i < segCount; i++, p += 2) { 62363 ranges[i].start = getUshort(data, p); 62364 } 62365 62366 for (i = 0; i < segCount; i++, p += 2) { 62367 ranges[i].idDelta = getUshort(data, p); 62368 } 62369 62370 for (i = 0; i < segCount; i++, p += 2) { 62371 var idOffset = getUshort(data, p); 62372 62373 if (idOffset === 0) { 62374 continue; 62375 } 62376 62377 ranges[i].ids = []; 62378 62379 for (var j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) { 62380 ranges[i].ids[j] = getUshort(data, p + idOffset); 62381 idOffset += 2; 62382 } 62383 } 62384 62385 return ranges; 62386 } else if (format === 12) { 62387 getLong(data, start + offset + 4); 62388 var groups = getLong(data, start + offset + 12); 62389 p = start + offset + 16; 62390 ranges = []; 62391 62392 for (i = 0; i < groups; i++) { 62393 ranges.push({ 62394 start: getLong(data, p), 62395 end: getLong(data, p + 4), 62396 idDelta: getLong(data, p + 8) - getLong(data, p) 62397 }); 62398 p += 12; 62399 } 62400 62401 return ranges; 62402 } 62403 62404 throw new _util.FormatError(`unsupported cmap: ${format}`); 62405 } 62406 62407 function parseCff(data, start, end, seacAnalysisEnabled) { 62408 var properties = {}; 62409 var parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end
62409- start), properties, seacAnalysisEnabled); 62410 var cff = parser.parse(); 62411 return { 62412 glyphs: cff.charStrings.objects, 62413 subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects, 62414 gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects, 62415 isCFFCIDFont: cff.isCIDFont, 62416 fdSelect: cff.fdSelect, 62417 fdArray: cff.fdArray 62418 }; 62419 } 62420 62421 function parseGlyfTable(glyf, loca, isGlyphLocationsLong) { 62422 var itemSize, itemDecode; 62423 62424 if (isGlyphLocationsLong) { 62425 itemSize = 4; 62426 62427 itemDecode = function fontItemDecodeLong(data, offset) { 62428 return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]; 62429 }; 62430 } else { 62431 itemSize = 2; 62432 62433 itemDecode = function fontItemDecode(data, offset) { 62434 return data[offset] << 9 | data[offset + 1] << 1; 62435 }; 62436 } 62437 62438 var glyphs = []; 62439 var startOffset = itemDecode(loca, 0); 62440 62441 for (var j = itemSize; j < loca.length; j += itemSize) { 62442 var endOffset = itemDecode(loca, j); 62443 glyphs.push(glyf.subarray(startOffset, endOffset)); 62444 startOffset = endOffset; 62445 } 62446 62447 return glyphs; 62448 } 62449 62450 function lookupCmap(ranges, unicode) { 62451 var code = unicode.codePointAt(0), 62452 gid = 0; 62453 var l = 0, 62454 r = ranges.length - 1; 62455 62456 while (l < r) { 62457 var c = l + r + 1 >> 1; 62458 62459 if (code < ranges[c].start) { 62460 r = c - 1; 62461 } else { 62462 l = c; 62463 } 62464 } 62465 62466 if (ranges[l].start <= code && code <= ranges[l].end) { 62467 gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff; 62468 } 62469 62470 return { 62471 charCode: code, 62472 glyphId: gid 62473 }; 62474 } 62475 62476 function compileGlyf(code, cmds, font) { 62477 function moveTo(x, y) { 62478 cmds.push({ 62479 cmd: "moveTo", 62480 args: [x, y] 62481 }); 62482 } 62483 62484 function lineTo(x, y) { 62485 cmds.push({ 62486 cmd: "lineTo", 62487 args: [x, y] 62488 }); 62489 } 62490 62491 function quadraticCurveTo(xa, ya, x, y) { 62492 cmds.push({ 62493 cmd: "quadraticCurveTo", 62494 args: [xa, ya, x, y] 62495 }); 62496 } 62497 62498 var i = 0; 62499 var numberOfContours = (code[i] << 24 | code[i + 1] << 16) >> 16; 62500 var flags; 62501 var x = 0, 62502 y = 0; 62503 i += 10; 62504 62505 if (numberOfContours < 0) { 62506 do { 62507 flags = code[i] << 8 | code[i + 1]; 62508 var glyphIndex = code[i + 2] << 8 | code[i + 3]; 62509 i += 4; 62510 var arg1, arg2; 62511 62512 if (flags & 0x01) { 62513 arg1 = (code[i] << 24 | code[i + 1] << 16) >> 16; 62514 arg2 = (code[i + 2] << 24 | code[i + 3] << 16) >> 16; 62515 i += 4; 62516 } else { 62517 arg1 = code[i++]; 62518 arg2 = code[i++]; 62519 } 62520 62521 if (flags & 0x02) { 62522 x = arg1; 62523 y = arg2; 62524 } else { 62525 x = 0; 62526 y = 0; 62527 } 62528 62529 var scaleX = 1, 62530 scaleY = 1, 62531 scale01 = 0, 62532 scale10 = 0; 62533 62534 if (flags & 0x08) { 62535 scaleX = scaleY = (code[i] << 24 | code[i + 1] << 16) / 1073741824; 62536 i += 2; 62537 } else if (flags & 0x40) { 62538 scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824; 62539 scaleY = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824; 62540 i += 4; 62541 } else if (flags & 0x80) { 62542 scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824; 62543 scale01 = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824; 62544 scale10 = (code[i + 4] << 24 | code[i + 5] << 16) / 1073741824; 62545 scaleY = (code[i + 6] << 24 | code[i + 7] << 16) / 1073741824; 62546 i += 8; 62547 } 62548 62549 var subglyph = font.glyphs[glyphIndex]; 62550 62551 if (subglyph) { 62552 cmds.push({ 62553 cmd: "save" 62554 }); 62555 cmds.push({ 62556 cmd: "transform", 62557 args: [scaleX, scale01, scale10, scaleY, x, y] 62558 }); 62559 compileGlyf(subglyph, cmds, font); 62560 cmds.push({ 62561 cmd: "restore" 62562 }); 62563 } 62564 } while (flags & 0x20); 62565 } else { 62566 var endPtsOfContours = []; 62567 var j, jj; 62568 62569 for (j = 0; j < numberOfContours; j++) { 62570 endPtsOfContours.push(code[i] << 8 | code[i + 1]); 62571 i += 2; 62572 } 62573 62574 var instructionLength = code[i] << 8 | code[i + 1]; 62575 i += 2 + instructionLength; 62576 var numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1; 62577 var points = []; 62578 62579 while (points.length < numberOfPoints) { 62580 flags = code[i++]; 62581 var repeat = 1; 62582 62583 if (flags & 0x08) { 62584 repeat += code[i++]; 62585 } 62586 62587 while (repeat-- > 0) { 62588 points.push({ 62589 flags 62590 }); 62591 } 62592 } 62593 62594 for (j = 0; j < numberOfPoints; j++) { 62595 switch (points[j].flags & 0x12) { 62596 case 0x00: 62597 x += (code[i] << 24 | code[i + 1] << 16) >> 16; 62598 i += 2; 62599 break; 62600 62601 case 0x02: 62602 x -= code[i++]; 62603 break; 62604 62605 case 0x12: 62606 x += code[i++]; 62607 break; 62608 } 62609 62610 points[j].x = x; 62611 } 62612 62613 for (j = 0; j < numberOfPoints; j++) { 62614 switch (points[j].flags & 0x24) { 62615 case 0x00: 62616 y += (code[i] << 24 | code[i + 1] << 16) >> 16; 62617 i += 2; 62618 break; 62619 62620 case 0x04: 62621 y -= code[i++]; 62622 break; 62623 62624 case 0x24: 62625 y += code[i++]; 62626 break; 62627 } 62628 62629 points[j].y = y; 62630 } 62631 62632 var startPoint = 0; 62633 62634 for (i = 0; i < numberOfContours; i++) { 62635 var endPoint = endPtsOfContours[i]; 62636 var contour = points.slice(startPoint, endPoint + 1); 62637 62638 if (contour[0].flags & 1) { 62639 contour.push(contour[0]); 62640 } else if (contour[contour.length - 1].flags & 1) { 62641 contour.unshift(contour[contour.length - 1]); 62642 } else { 62643 var p = { 62644 flags: 1, 62645 x: (contour[0].x + contour[contour.length - 1].x) / 2, 62646 y: (contour[0].y + contour[contour.length - 1].y) / 2 62647 }; 62648 contour.unshift(p); 62649 contour.push(p); 62650 } 62651 62652 moveTo(contour[0].x, contour[0].y); 62653 62654 for (j = 1, jj = contour.length; j < jj; j++) { 62655 if (contour[j].flags & 1) { 62656 lineTo(contour[j].x, contour[j].y); 62657 } else if (contour[j + 1].flags & 1) { 62658 quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y); 62659 j++; 62660 } else { 62661 quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2); 62662 } 62663 } 62664 62665 startPoint = endPoint + 1; 62666 } 62667 } 62668 } 62669 62670 function compileCharString(code, cmds, font, glyphId) { 62671 var stack = []; 62672 var x = 0, 62673 y = 0; 62674 var stems = 0; 62675 62676 function moveTo(x, y) { 62677 cmds.push({ 62678 cmd: "moveTo", 62679 args: [x, y] 62680 }); 62681 } 62682 62683 function lineTo(x, y) { 62684 cmds.push({ 62685 cmd: "lineTo", 62686 args: [x, y] 62687 }); 62688 } 62689 62690 function bezierCurveTo(x1, y1, x2, y2, x, y) { 62691 cmds.push({ 62692 cmd: "bezierCurveTo", 62693 args: [x1, y1, x2, y2, x, y] 62694 }); 62695 } 62696 62697 function parse(code) { 62698 var i = 0; 62699 62700 while (i < code.length) { 62701 var stackClean = false;
vendor: 10,857 bytes, lines 62702-63088
62702 var v = code[i++]; 62703 var xa, xb, ya, yb, y1, y2, y3, n, subrCode; 62704 62705 switch (v) { 62706 case 1: 62707 stems += stack.length >> 1; 62708 stackClean = true; 62709 break; 62710 62711 case 3: 62712 stems += stack.length >> 1; 62713 stackClean = true; 62714 break; 62715 62716 case 4: 62717 y += stack.pop(); 62718 moveTo(x, y); 62719 stackClean = true; 62720 break; 62721 62722 case 5: 62723 while (stack.length > 0) { 62724 x += stack.shift(); 62725 y += stack.shift(); 62726 lineTo(x, y); 62727 } 62728 62729 break; 62730 62731 case 6: 62732 while (stack.length > 0) { 62733 x += stack.shift(); 62734 lineTo(x, y); 62735 62736 if (stack.length === 0) { 62737 break; 62738 } 62739 62740 y += stack.shift(); 62741 lineTo(x, y); 62742 } 62743 62744 break; 62745 62746 case 7: 62747 while (stack.length > 0) { 62748 y += stack.shift(); 62749 lineTo(x, y); 62750 62751 if (stack.length === 0) { 62752 break; 62753 } 62754 62755 x += stack.shift(); 62756 lineTo(x, y); 62757 } 62758 62759 break; 62760 62761 case 8: 62762 while (stack.length > 0) { 62763 xa = x + stack.shift(); 62764 ya = y + stack.shift(); 62765 xb = xa + stack.shift(); 62766 yb = ya + stack.shift(); 62767 x = xb + stack.shift(); 62768 y = yb + stack.shift(); 62769 bezierCurveTo(xa, ya, xb, yb, x, y); 62770 } 62771 62772 break; 62773 62774 case 10: 62775 n = stack.pop(); 62776 subrCode = null; 62777 62778 if (font.isCFFCIDFont) { 62779 const fdIndex = font.fdSelect.getFDIndex(glyphId); 62780 62781 if (fdIndex >= 0 && fdIndex < font.fdArray.length) { 62782 const fontDict = font.fdArray[fdIndex]; 62783 let subrs; 62784 62785 if (fontDict.privateDict && fontDict.privateDict.subrsIndex) { 62786 subrs = fontDict.privateDict.subrsIndex.objects; 62787 } 62788 62789 if (subrs) { 62790 n += getSubroutineBias(subrs); 62791 subrCode = subrs[n]; 62792 } 62793 } else { 62794 (0, _util.warn)("Invalid fd index for glyph index."); 62795 } 62796 } else { 62797 subrCode = font.subrs[n + font.subrsBias]; 62798 } 62799 62800 if (subrCode) { 62801 parse(subrCode); 62802 } 62803 62804 break; 62805 62806 case 11: 62807 return; 62808 62809 case 12: 62810 v = code[i++]; 62811 62812 switch (v) { 62813 case 34: 62814 xa = x + stack.shift(); 62815 xb = xa + stack.shift(); 62816 y1 = y + stack.shift(); 62817 x = xb + stack.shift(); 62818 bezierCurveTo(xa, y, xb, y1, x, y1); 62819 xa = x + stack.shift(); 62820 xb = xa + stack.shift(); 62821 x = xb + stack.shift(); 62822 bezierCurveTo(xa, y1, xb, y, x, y); 62823 break; 62824 62825 case 35: 62826 xa = x + stack.shift(); 62827 ya = y + stack.shift(); 62828 xb = xa + stack.shift(); 62829 yb = ya + stack.shift(); 62830 x = xb + stack.shift(); 62831 y = yb + stack.shift(); 62832 bezierCurveTo(xa, ya, xb, yb, x, y); 62833 xa = x + stack.shift(); 62834 ya = y + stack.shift(); 62835 xb = xa + stack.shift(); 62836 yb = ya + stack.shift(); 62837 x = xb + stack.shift(); 62838 y = yb + stack.shift(); 62839 bezierCurveTo(xa, ya, xb, yb, x, y); 62840 stack.pop(); 62841 break; 62842 62843 case 36: 62844 xa = x + stack.shift(); 62845 y1 = y + stack.shift(); 62846 xb = xa + stack.shift(); 62847 y2 = y1 + stack.shift(); 62848 x = xb + stack.shift(); 62849 bezierCurveTo(xa, y1, xb, y2, x, y2); 62850 xa = x + stack.shift(); 62851 xb = xa + stack.shift(); 62852 y3 = y2 + stack.shift(); 62853 x = xb + stack.shift(); 62854 bezierCurveTo(xa, y2, xb, y3, x, y); 62855 break; 62856 62857 case 37: 62858 var x0 = x, 62859 y0 = y; 62860 xa = x + stack.shift(); 62861 ya = y + stack.shift(); 62862 xb = xa + stack.shift(); 62863 yb = ya + stack.shift(); 62864 x = xb + stack.shift(); 62865 y = yb + stack.shift(); 62866 bezierCurveTo(xa, ya, xb, yb, x, y); 62867 xa = x + stack.shift(); 62868 ya = y + stack.shift(); 62869 xb = xa + stack.shift(); 62870 yb = ya + stack.shift(); 62871 x = xb; 62872 y = yb; 62873 62874 if (Math.abs(x - x0) > Math.abs(y - y0)) { 62875 x += stack.shift(); 62876 } else { 62877 y += stack.shift(); 62878 } 62879 62880 bezierCurveTo(xa, ya, xb, yb, x, y); 62881 break; 62882 62883 default: 62884 throw new _util.FormatError(`unknown operator: 12 ${v}`); 62885 } 62886 62887 break; 62888 62889 case 14: 62890 if (stack.length >= 4) { 62891 var achar = stack.pop(); 62892 var bchar = stack.pop(); 62893 y = stack.pop(); 62894 x = stack.pop(); 62895 cmds.push({ 62896 cmd: "save" 62897 }); 62898 cmds.push({ 62899 cmd: "translate", 62900 args: [x, y] 62901 }); 62902 var cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]])); 62903 compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId); 62904 cmds.push({ 62905 cmd: "restore" 62906 }); 62907 cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]])); 62908 compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId); 62909 } 62910 62911 return; 62912 62913 case 18: 62914 stems += stack.length >> 1; 62915 stackClean = true; 62916 break; 62917 62918 case 19: 62919 stems += stack.length >> 1; 62920 i += stems + 7 >> 3; 62921 stackClean = true; 62922 break; 62923 62924 case 20: 62925 stems += stack.length >> 1; 62926 i += stems + 7 >> 3; 62927 stackClean = true; 62928 break; 62929 62930 case 21: 62931 y += stack.pop(); 62932 x += stack.pop(); 62933 moveTo(x, y); 62934 stackClean = true; 62935 break; 62936 62937 case 22: 62938 x += stack.pop(); 62939 moveTo(x, y); 62940 stackClean = true; 62941 break; 62942 62943 case 23: 62944 stems += stack.length >> 1; 62945 stackClean = true; 62946 break; 62947 62948 case 24: 62949 while (stack.length > 2) { 62950 xa = x + stack.shift(); 62951 ya = y + stack.shift(); 62952 xb = xa + stack.shift(); 62953 yb = ya + stack.shift(); 62954 x = xb + stack.shift(); 62955 y = yb + stack.shift(); 62956 bezierCurveTo(xa, ya, xb, yb, x, y); 62957 } 62958 62959 x += stack.shift(); 62960 y += stack.shift(); 62961 lineTo(x, y); 62962 break; 62963 62964 case 25: 62965 while (stack.length > 6) { 62966 x += stack.shift(); 62967 y += stack.shift(); 62968 lineTo(x, y); 62969 } 62970 62971 xa = x + stack.shift(); 62972 ya = y + stack.shift(); 62973 xb = xa + stack.shift(); 62974 yb = ya + stack.shift(); 62975 x = xb + stack.shift(); 62976 y = yb + stack.shift(); 62977 bezierCurveTo(xa, ya, xb, yb, x, y); 62978 break; 62979 62980 case 26: 62981 if (stack.length % 2) { 62982 x += stack.shift(); 62983 } 62984 62985 while (stack.length > 0) { 62986 xa = x; 62987 ya = y + stack.shift(); 62988 xb = xa + stack.shift(); 62989 yb = ya + stack.shift(); 62990 x = xb; 62991 y = yb + stack.shift(); 62992 bezierCurveTo(xa, ya, xb, yb, x, y); 62993 } 62994 62995 break; 62996 62997 case 27: 62998 if (stack.length % 2) { 62999 y += stack.shift(); 63000 } 63001 63002 while (stack.length > 0) { 63003 xa = x + stack.shift(); 63004 ya = y; 63005 xb = xa + stack.shift(); 63006 yb = ya + stack.shift(); 63007 x = xb + stack.shift(); 63008 y = yb; 63009 bezierCurveTo(xa, ya, xb, yb, x, y); 63010 } 63011 63012 break; 63013 63014 case 28: 63015 stack.push((code[i] << 24 | code[i + 1] << 16) >> 16); 63016 i += 2; 63017 break; 63018 63019 case 29: 63020 n = stack.pop() + font.gsubrsBias; 63021 subrCode = font.gsubrs[n]; 63022 63023 if (subrCode) { 63024 parse(subrCode); 63025 } 63026 63027 break; 63028 63029 case 30: 63030 while (stack.length > 0) { 63031 xa = x; 63032 ya = y + stack.shift(); 63033 xb = xa + stack.shift(); 63034 yb = ya + stack.shift(); 63035 x = xb + stack.shift(); 63036 y = yb + (stack.length === 1 ? stack.shift() : 0); 63037 bezierCurveTo(xa, ya, xb, yb, x, y); 63038 63039 if (stack.length === 0) { 63040 break; 63041 } 63042 63043 xa = x + stack.shift(); 63044 ya = y; 63045 xb = xa + stack.shift(); 63046 yb = ya + stack.shift(); 63047 y = yb + stack.shift(); 63048 x = xb + (stack.length === 1 ? stack.shift() : 0); 63049 bezierCurveTo(xa, ya, xb, yb, x, y); 63050 } 63051 63052 break; 63053 63054 case 31: 63055 while (stack.length > 0) { 63056 xa = x + stack.shift(); 63057 ya = y; 63058 xb = xa + stack.shift(); 63059 yb = ya + stack.shift(); 63060 y = yb + stack.shift(); 63061 x = xb + (stack.length === 1 ? stack.shift() : 0); 63062 bezierCurveTo(xa, ya, xb, yb, x, y); 63063 63064 if (stack.length === 0) { 63065 break; 63066 } 63067 63068 xa = x; 63069 ya = y + stack.shift(); 63070 xb = xa + stack.shift(); 63071 yb = ya + stack.shift(); 63072 x = xb + stack.shift(); 63073 y = yb + (stack.length === 1 ? stack.shift() : 0); 63074 bezierCurveTo(xa, ya, xb, yb, x, y); 63075 } 63076 63077 break; 63078 63079 default: 63080 if (v < 32) { 63081 throw new _util.FormatError(`unknown operator: ${v}`); 63082 } 63083 63084 if (v < 247) { 63085 stack.push(v - 139); 63086 } else if (v < 251) { 63087 stack.push((v - 247) * 256 + code[i++] + 108); 63088 } else if (v < 255) {
63089 stack.push(-(v - 251) * 256 - code[i++] - 108); 63090 } else { 63091 stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536); 63092 i += 4; 63093 } 63094 63095 break; 63096 } 63097 63098 if (stackClean) { 63099 stack.length = 0; 63100 } 63101 } 63102 } 63103 63104 parse(code); 63105 } 63106 63107 const NOOP = []; 63108 63109 class CompiledFont { 63110 constructor(fontMatrix) { 63111 if (this.constructor === CompiledFont) { 63112 (0, _util.unreachable)("Cannot initialize CompiledFont."); 63113 } 63114 63115 this.fontMatrix = fontMatrix; 63116 this.compiledGlyphs = Object.create(null); 63117 this.compiledCharCodeToGlyphId = Object.create(null); 63118 } 63119 63120 getPathJs(unicode) { 63121 const cmap = lookupCmap(this.cmap, unicode); 63122 let fn = this.compiledGlyphs[cmap.glyphId]; 63123 63124 if (!fn) { 63125 fn = this.compileGlyph(this.glyphs[cmap.glyphId], cmap.glyphId); 63126 this.compiledGlyphs[cmap.glyphId] = fn; 63127 } 63128 63129 if (this.compiledCharCodeToGlyphId[cmap.charCode] === undefined) {
63130 this.compiledCharCodeToGlyphId[cmap.charCode] = cmap.glyphId; 63131 } 63132 63133 return fn; 63134 } 63135 63136 compileGlyph(code, glyphId) { 63137 if (!code || code.length === 0 || code[0] === 14) { 63138 return NOOP; 63139 } 63140 63141 let fontMatrix = this.fontMatrix; 63142 63143 if (this.isCFFCIDFont) { 63144 const fdIndex = this.fdSelect.getFDIndex(glyphId); 63145 63146 if (fdIndex >= 0 && fdIndex < this.fdArray.length) { 63147 const fontDict = this.fdArray[fdIndex]; 63148 fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX; 63149 } else { 63150 (0, _util.warn)("Invalid fd index for glyph index."); 63151 } 63152 } 63153 63154 const cmds = []; 63155 cmds.push({ 63156 cmd: "save" 63157 }); 63158 cmds.push({ 63159 cmd: "transform", 63160 args: fontMatrix.slice() 63161 }); 63162 cmds.push({ 63163 cmd: "scale", 63164 args: ["size", "-size"] 63165 }); 63166 this.compileGlyphImpl(code, cmds, glyphId); 63167 cmds.push({ 63168 cmd: "restore" 63169 }); 63170 return cmds; 63171 } 63172 63173 compileGlyphImpl() { 63174 (0, _util.unreachable)("Children classes should implement this."); 63175 } 63176 63177 hasBuiltPath(unicode) { 63178 const cmap = lookupCmap(this.cmap, unicode); 63179 return this.compiledGlyphs[cmap.glyphId] !== undefined && this.compiledCharCodeToGlyphId[cmap.charCo
63179de] !== undefined; 63180 } 63181 63182 } 63183 63184 class TrueTypeCompiled extends CompiledFont { 63185 constructor(glyphs, cmap, fontMatrix) { 63186 super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]); 63187 this.glyphs = glyphs; 63188 this.cmap = cmap; 63189 } 63190 63191 compileGlyphImpl(code, cmds) { 63192 compileGlyf(code, cmds, this); 63193 } 63194 63195 } 63196 63197 class Type2Compiled extends CompiledFont { 63198 constructor(cffInfo, cmap, fontMatrix, glyphNameMap) { 63199 super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]); 63200 this.glyphs = cffInfo.glyphs; 63201 this.gsubrs = cffInfo.gsubrs || []; 63202 this.subrs = cffInfo.subrs || []; 63203 this.cmap = cmap; 63204 this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)(); 63205 this.gsubrsBias = getSubroutineBias(this.gsubrs); 63206 this.subrsBias = getSubroutineBias(this.subrs); 63207 this.isCFFCIDFont = cffInfo.isCFFCIDFont; 63208 this.fdSelect = cffInfo.fdSelect; 63209 this.fdArray = cffInfo.fdArray; 63210 } 63211 63212 compileGlyphImpl(code, cmds, glyphId) { 63213 compileCharString(code, cmds, this, glyphId); 63214 } 63215 63216 } 63217 63218 return { 63219 create: function FontRendererFactory_create(font, seacAnalysisEnabled) { 63220 var data = new Uint8Array(font.data); 63221 var cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm; 63222 var numTables = getUshort(data, 4); 63223 63224 for (var i = 0, p = 12; i < numTables; i++, p += 16) { 63225 var tag = (0, _util.bytesToString)(data.subarray(p, p + 4)); 63226 var offset = getLong(data, p + 8); 63227 var length = getLong(data, p + 12); 63228 63229 switch (tag) { 63230 case "cmap": 63231 cmap = parseCmap(data, offset, offset + length); 63232 break; 63233 63234 case "glyf": 63235 glyf = data.subarray(offset, offset + length); 63236 break; 63237 63238 case "loca": 63239 loca = data.subarray(offset, offset + length); 63240 break; 63241 63242 case "head": 63243 unitsPerEm = getUshort(data, offset + 18); 63244 indexToLocFormat = getUshort(data, offset + 50); 63245 break; 63246 63247 case "CFF ": 63248 cff = parseCff(data, offset, offset + length, seacAnalysisEnabled); 63249 break; 63250 } 63251 } 63252 63253 if (glyf) { 63254 var fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0]; 63255 return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix); 63256 } 63257 63258 return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap); 63259 } 63260 }; 63261}(); 63262 63263exports.FontRendererFactory = FontRendererFactory; 63264 63265/***/ }), 63266/* 35 */ 63267/***/ (function(module, exports, __w_pdfjs_require__) { 63268 63269"use strict"; 63270 63271 63272Object.defineProperty(exports, "__esModule", { 63273 value: true 63274}); 63275exports.Type1Parser = void 0; 63276 63277var _encodings = __w_pdfjs_require__(30); 63278 63279var _core_utils = __w_pdfjs_require__(7); 63280 63281var _stream = __w_pdfjs_require__(11); 63282 63283var _util = __w_pdfjs_require__(2); 63284 63285var HINTING_ENABLED = false; 63286 63287var Type1CharString = function Type1CharStringClosure() { 63288 var COMMAND_MAP = { 63289 hstem: [1], 63290 vstem: [3], 63291 vmoveto: [4], 63292 rlineto: [5], 63293 hlineto: [6], 63294 vlineto: [7], 63295 rrcurveto: [8], 63296 callsubr: [10], 63297 flex: [12, 35], 63298 drop: [12, 18], 63299 endchar: [14], 63300 rmoveto: [21], 63301 hmoveto: [22], 63302 vhcurveto: [30], 63303 hvcurveto: [31] 63304 }; 63305 63306 function Type1CharString() { 63307 this.width = 0; 63308 this.lsb = 0; 63309 this.flexing = false; 63310 this.output = []; 63311 this.stack = []; 63312 } 63313 63314 Type1CharString.prototype = { 63315 convert: function Type1CharString_convert(encoded, subrs, seacAnalysisEnabled) { 63316 var count = encoded.length; 63317 var error = false; 63318 var wx, sbx, subrNumber; 63319 63320 for (var i = 0; i < count; i++) { 63321 var value = encoded[i]; 63322 63323 if (value < 32) { 63324 if (value === 12) { 63325 value = (value << 8) + encoded[++i]; 63326 } 63327 63328 switch (value) { 63329 case 1: 63330 if (!HINTING_ENABLED) { 63331 this.stack = []; 63332 break; 63333 } 63334 63335 error = this.executeCommand(2, COMMAND_MAP.hstem); 63336 break; 63337 63338 case 3: 63339 if (!HINTING_ENABLED) { 63340 this.stack = []; 63341 break; 63342 } 63343 63344 error = this.executeCommand(2, COMMAND_MAP.vstem); 63345 break; 63346 63347 case 4: 63348 if (this.flexing) { 63349 if (this.stack.length < 1) { 63350 error = true; 63351 break; 63352 } 63353 63354 var dy = this.stack.pop(); 63355 this.stack.push(0, dy); 63356 break; 63357 } 63358 63359 error = this.executeCommand(1, COMMAND_MAP.vmoveto); 63360 break; 63361 63362 case 5: 63363 error = this.executeCommand(2, COMMAND_MAP.rlineto); 63364 break; 63365 63366 case 6: 63367 error = this.executeCommand(1, COMMAND_MAP.hlineto); 63368 break; 63369 63370 case 7: 63371 error = this.executeCommand(1, COMMAND_MAP.vlineto); 63372 break; 63373 63374 case 8: 63375 error = this.executeCommand(6, COMMAND_MAP.rrcurveto); 63376 break; 63377 63378 case 9: 63379 this.stack = []; 63380 break; 63381 63382 case 10: 63383 if (this.stack.length < 1) { 63384 error = true; 63385 break; 63386 } 63387 63388 subrNumber = this.stack.pop(); 63389 63390 if (!subrs[subrNumber]) { 63391 error = true; 63392 break; 63393 } 63394 63395 error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled); 63396 break; 63397 63398 case 11: 63399 return error; 63400 63401 case 13: 63402 if (this.stack.length < 2) { 63403 error = true; 63404 break; 63405 } 63406 63407 wx = this.stack.pop(); 63408 sbx = this.stack.pop(); 63409 this.lsb = sbx; 63410 this.width = wx; 63411 this.stack.push(wx, sbx); 63412 error = this.executeCommand(2, COMMAND_MAP.hmoveto); 63413 break; 63414 63415 case 14: 63416 this.output.push(COMMAND_MAP.endchar[0]); 63417 break; 63418 63419 case 21: 63420 if (this.flexing) { 63421 break; 63422 } 63423 63424 error = this.executeCommand(2, COMMAND_MAP.rmoveto); 63425 break; 63426 63427 case 22: 63428 if (this.flexing) { 63429 this.stack.push(0); 63430 break; 63431 } 63432 63433 error = this.executeCommand(1, COMMAND_MAP.hmoveto); 63434 break; 63435 63436 case 30: 63437 error = this.executeCommand(4, COMMAND_MAP.vhcurveto); 63438 break; 63439 63440 case 31: 63441 error = this.executeCommand(4, COMMAND_MAP.hvcurveto); 63442 break; 63443 63444 case (12 << 8) + 0: 63445 this.stack = []; 63446 break; 63447 63448 case (12 << 8) + 1: 63449 if (!HINTING_ENABLED) { 63450 this.stack = []; 63451 break; 63452 } 63453 63454 error = this.executeCommand(2, COMMAND_MAP.vstem); 63455 break; 63456 63457 case (12 << 8) + 2: 63458 if (!HINTING_ENABLED) { 63459 this.stack = []; 63460 break; 63461 } 63462 63463 error = this.executeCommand(2, COMMAND_MAP.hstem); 63464 break; 63465 63466 case (12 << 8) + 6: 63467 if (seacAnalysisEnabled) { 63468 this.seac = this.stack.splice(-4, 4); 63469 error = this.executeCommand(0, COMMAND_MAP.endchar); 63470 } else { 63471 error = this.executeCommand(4, COMMAND_MAP.endchar); 63472 } 63473 63474 break; 63475 63476 case (12 << 8) + 7: 63477 if (this.stack.length < 4) { 63478 error = true; 63479 break; 63480 } 63481 63482 this.stack.pop(); 63483 wx = this.stack.pop(); 63484 var sby = this.stack.pop(); 63485 sbx = this.stack.pop(); 63486 this.lsb = sbx; 63487 this.width = wx; 63488 this.stack.push(wx, sbx, sby); 63489 error = this.executeCommand(3, COMMAND_MAP.rmoveto); 63490 break; 63491 63492 case (12 << 8) + 12: 63493 if (this.stack.length < 2) { 63494 error = true; 63495 break; 63496 } 63497 63498 var num2 = this.stack.pop(); 63499 var num1 = this.stack.pop(); 63500 this.stack.push(num1 / num2); 63501 break; 63502 63503 case (12 << 8) + 16: 63504 if (this.stack.length < 2) { 63505 error = true; 63506 break; 63507 } 63508 63509 subrNumber = this.stack.pop(); 63510 var numArgs = this.stack.pop(); 63511 63512 if (subrNumber === 0 && numArgs === 3) { 63513 var flexArgs = this.stack.splice(this.stack.length - 17, 17); 63514 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]); 63515 error = this.executeCommand(13, COMMAND_MAP.flex, true); 63516 this.flexing = false;
63517 this.stack.push(flexArgs[15], flexArgs[16]); 63518 } else if (subrNumber === 1 && numArgs === 0) { 63519 this.flexing = true; 63520 } 63521 63522 break; 63523 63524 case (12 << 8) + 17: 63525 break; 63526 63527 case (12 << 8) + 33: 63528 this.stack = []; 63529 break; 63530 63531 default: 63532 (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"'); 63533 break; 63534 } 63535 63536 if (error) { 63537 break; 63538 } 63539 63540 continue; 63541 } else if (value <= 246) { 63542 value = value - 139; 63543 } else if (value <= 250) { 63544 value = (value - 247) * 256 + encoded[++i] + 108; 63545 } else if (value <= 254) { 63546 value = -((value - 251) * 256) - encoded[++i] - 108; 63547 } else { 63548 value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0; 63549 } 63550 63551 this.stack.push(value); 63552 } 63553 63554 return error; 63555 }, 63556 63557 executeCommand(howManyArgs, command, keepStack) { 63558 var stackLength = this.stack.length; 63559 63560 if (howManyArgs > stackLength) { 63561 return true; 63562 } 63563 63564 var start = stackLength - howManyArgs; 63565 63566 for (var i = start; i < stackLength; i++) { 63567 var value = this.stack[i]; 63568 63569 if (Number.isInteger(value)) { 63570 this.output.push(28, value >> 8 & 0xff, value & 0xff); 63571 } else { 63572 value = 65536 * value | 0; 63573 this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff); 63574 } 63575 } 63576 63577 this.output.push.apply(this.output, command); 63578 63579 if (keepStack) { 63580 this.stack.splice(start, howManyArgs); 63581 } else { 63582 this.stack.length = 0; 63583 } 63584 63585 return false; 63586 } 63587 63588 }; 63589 return Type1CharString; 63590}(); 63591 63592var Type1Parser = function Type1ParserClosure() { 63593 var EEXEC_ENCRYPT_KEY = 55665; 63594 var CHAR_STRS_ENCRYPT_KEY = 4330; 63595 63596 function isHexDigit(code) { 63597 return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102; 63598 } 63599 63600 function decrypt(data, key, discardNumber) { 63601 if (discardNumber >= data.length) { 63602 return new Uint8Array(0); 63603 } 63604 63605 var r = key | 0, 63606 c1 = 52845, 63607 c2 = 22719, 63608 i, 63609 j; 63610 63611 for (i = 0; i < discardNumber; i++) { 63612 r = (data[i] + r) * c1 + c2 & (1 << 16) - 1; 63613 } 63614 63615 var count = data.length - discardNumber; 63616 var decrypted = new Uint8Array(count); 63617 63618 for (i = discardNumber, j = 0; j < count; i++, j++) { 63619 var value = data[i]; 63620 decrypted[j] = value ^ r >> 8; 63621 r = (value + r) * c1 + c2 & (1 << 16) - 1; 63622 } 63623 63624 return decrypted; 63625 } 63626 63627 function decryptAscii(data, key, discardNumber) { 63628 var r = key | 0, 63629 c1 = 52845, 63630 c2 = 22719; 63631 var count = data.length, 63632 maybeLength = count >>> 1; 63633 var decrypted = new Uint8Array(maybeLength); 63634 var i, j; 63635 63636 for (i = 0, j = 0; i < count; i++) { 63637 var digit1 = data[i]; 63638 63639 if (!isHexDigit(digit1)) { 63640 continue; 63641 } 63642 63643 i++; 63644 var digit2; 63645 63646 while (i < count && !isHexDigit(digit2 = data[i])) { 63647 i++; 63648 } 63649 63650 if (i < count) { 63651 var value = parseInt(String.fromCharCode(digit1, digit2), 16); 63652 decrypted[j++] = value ^ r >> 8; 63653 r = (value + r) * c1 + c2 & (1 << 16) - 1; 63654 } 63655 } 63656 63657 return Array.prototype.slice.call(decrypted, discardNumber, j); 63658 } 63659 63660 function isSpecial(c) { 63661 return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29; 63662 } 63663 63664 function Type1Parser(stream, encrypted, seacAnalysisEnabled) { 63665 if (encrypted) { 63666 var data = stream.getBytes(); 63667 var isBinary = !(isHexDigit(data[0]) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3])); 63668 stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4)); 63669 } 63670 63671 this.seacAnalysisEnabled = !!seacAnalysisEnabled; 63672 this.stream = stream; 63673 this.nextChar(); 63674 } 63675 63676 Type1Parser.prototype = { 63677 readNumberArray: function Type1Parser_readNumberArray() { 63678 this.getToken(); 63679 var array = []; 63680 63681 while (true) { 63682 var token = this.getToken(); 63683 63684 if (token === null || token === "]" || token === "}") { 63685 break; 63686 } 63687 63688 array.push(parseFloat(token || 0)); 63689 } 63690 63691 return array; 63692 }, 63693 readNumber: function Type1Parser_readNumber() { 63694 var token = this.getToken(); 63695 return parseFloat(token || 0); 63696 }, 63697 readInt: function Type1Parser_readInt() { 63698 var token = this.getToken(); 63699 return parseInt(token || 0, 10) | 0; 63700 }, 63701 readBoolean: function Type1Parser_readBoolean() { 63702 var token = this.getToken(); 63703 return token === "true" ? 1 : 0; 63704 }, 63705 nextChar: function Type1_nextChar() { 63706 return this.currentChar = this.stream.getByte(); 63707 }, 63708 getToken: function Type1Parser_getToken() { 63709 var comment = false;
63710 var ch = this.currentChar; 63711 63712 while (true) { 63713 if (ch === -1) { 63714 return null; 63715 } 63716 63717 if (comment) { 63718 if (ch === 0x0a || ch === 0x0d) { 63719 comment = false; 63720 } 63721 } else if (ch === 0x25) { 63722 comment = true; 63723 } else if (!(0, _core_utils.isWhiteSpace)(ch)) { 63724 break; 63725 } 63726 63727 ch = this.nextChar(); 63728 } 63729 63730 if (isSpecial(ch)) { 63731 this.nextChar(); 63732 return String.fromCharCode(ch); 63733 } 63734 63735 var token = ""; 63736 63737 do { 63738 token += String.fromCharCode(ch); 63739 ch = this.nextChar(); 63740 } while (ch >= 0 && !(0, _core_utils.isWhiteSpace)(ch) && !isSpecial(ch)); 63741 63742 return token; 63743 }, 63744 readCharStrings: function Type1Parser_readCharStrings(bytes, lenIV) { 63745 if (lenIV === -1) { 63746 return bytes; 63747 } 63748 63749 return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV); 63750 }, 63751 extractFontProgram: function Type1Parser_extractFontProgram(properties) { 63752 var stream = this.stream; 63753 var subrs = [], 63754 charstrings = []; 63755 var privateData = Object.create(null); 63756 privateData["lenIV"] = 4; 63757 var program = { 63758 subrs: [], 63759 charstrings: [], 63760 properties: { 63761 privateData 63762 } 63763 }; 63764 var token, length, data, lenIV, encoded; 63765 63766 while ((token = this.getToken()) !== null) { 63767 if (token !== "/") { 63768 continue; 63769 } 63770 63771 token = this.getToken(); 63772 63773 switch (token) { 63774 case "CharStrings": 63775 this.getToken(); 63776 this.getToken(); 63777 this.getToken(); 63778 this.getToken(); 63779 63780 while (true) { 63781 token = this.getToken(); 63782 63783 if (token === null || token === "end") { 63784 break; 63785 } 63786 63787 if (token !== "/") { 63788 continue; 63789 } 63790 63791 var glyph = this.getToken(); 63792 length = this.readInt(); 63793 this.getToken(); 63794 data = length > 0 ? stream.getBytes(length) : new Uint8Array(0); 63795 lenIV = program.properties.privateData["lenIV"]; 63796 encoded = this.readCharStrings(data, lenIV); 63797 this.nextChar(); 63798 token = this.getToken(); 63799 63800 if (token === "noaccess") { 63801 this.getToken(); 63802 } 63803 63804 charstrings.push({ 63805 glyph, 63806 encoded 63807 }); 63808 } 63809 63810 break; 63811 63812 case "Subrs": 63813 this.readInt(); 63814 this.getToken(); 63815 63816 while (this.getToken() === "dup") { 63817 var index = this.readInt(); 63818 length = this.readInt(); 63819 this.getToken(); 63820 data = length > 0 ? stream.getBytes(length) : new Uint8Array(0); 63821 lenIV = program.properties.privateData["lenIV"]; 63822 encoded = this.readCharStrings(data, lenIV); 63823 this.nextChar(); 63824 token = this.getToken(); 63825 63826 if (token === "noaccess") { 63827 this.getToken(); 63828 } 63829 63830 subrs[index] = encoded; 63831 } 63832 63833 break; 63834 63835 case "BlueValues": 63836 case "OtherBlues": 63837 case "FamilyBlues": 63838 case "FamilyOtherBlues": 63839 var blueArray = this.readNumberArray(); 63840 63841 if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) { 63842 program.properties.privateData[token] = blueArray; 63843 } 63844 63845 break; 63846 63847 case "StemSnapH": 63848 case "StemSnapV": 63849 program.properties.privateData[token] = this.readNumberArray(); 63850 break; 63851 63852 case "StdHW": 63853 case "StdVW": 63854 program.properties.privateData[token] = this.readNumberArray()[0]; 63855 break; 63856 63857 case "BlueShift": 63858 case "lenIV": 63859 case "BlueFuzz": 63860 case "BlueScale": 63861 case "LanguageGroup": 63862 case "ExpansionFactor": 63863 program.properties.privateData[token] = this.readNumber(); 63864 break; 63865 63866 case "ForceBold": 63867 program.properties.privateData[token] = this.readBoolean(); 63868 break; 63869 } 63870 } 63871 63872 for (var i = 0; i < charstrings.length; i++) { 63873 glyph = charstrings[i].glyph; 63874 encoded = charstrings[i].encoded; 63875 var charString = new Type1CharString(); 63876 var error = charString.convert(encoded, subrs, this.seacAnalysisEnabled); 63877 var output = charString.output; 63878 63879 if (error) { 63880 output = [14]; 63881 } 63882 63883 const charStringObject = { 63884 glyphName: glyph, 63885 charstring: output, 63886 width: charString.width, 63887 lsb: charString.lsb, 63888 seac: charString.seac 63889 }; 63890 63891 if (glyph === ".notdef") { 63892 program.charstrings.unshift(charStringObject); 63893 } else { 63894 program.charstrings.push(charStringObject); 63895 } 63896 63897 if (properties.builtInEncoding) { 63898 const index = properties.builtInEncoding.indexOf(glyph); 63899 63900 if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) { 63901 properties.widths[index] = charString.width; 63902 } 63903 } 63904 } 63905 63906 return program; 63907 }, 63908 extractFontHeader: function Type1Parser_extractFontHeader(properties) { 63909 var token; 63910 63911 while ((token = this.getToken()) !== null) { 63912 if (token !== "/") { 63913 continue; 63914 } 63915 63916 token = this.getToken(); 63917 63918 switch (token) { 63919 case "FontMatrix": 63920 var matrix = this.readNumberArray(); 63921 properties.fontMatrix = matrix; 63922 break; 63923 63924 case "Encoding": 63925 var encodingArg = this.getToken(); 63926 var encoding; 63927 63928 if (!/^\d+$/.test(encodingArg)) { 63929 encoding = (0, _encodings.getEncoding)(encodingArg); 63930 } else { 63931 encoding = []; 63932 var size = parseInt(encodingArg, 10) | 0; 63933 this.getToken(); 63934 63935 for (var j = 0; j < size; j++) { 63936 token = this.getToken(); 63937 63938 while (token !== "dup" && token !== "def") { 63939 token = this.getToken(); 63940 63941 if (token === null) { 63942 return; 63943 } 63944 } 63945 63946 if (token === "def") { 63947 break; 63948 } 63949 63950 var index = this.readInt(); 63951 this.getToken(); 63952 var glyph = this.getToken(); 63953 encoding[index] = glyph; 63954 this.getToken(); 63955 } 63956 } 63957 63958 properties.builtInEncoding = encoding; 63959 break; 63960 63961 case "FontBBox": 63962 var fontBBox = this.readNumberArray(); 63963 properties.ascent = Math.max(fontBBox[3], fontBBox[1]); 63964 properties.descent = Math.min(fontBBox[1], fontBBox[3]); 63965 properties.ascentScaled = true; 63966 break; 63967 } 63968 } 63969 } 63970 }; 63971 return Type1Parser; 63972}(); 63973 63974exports.Type1Parser = Type1Parser; 63975 63976/***/ }), 63977/* 36 */ 63978/***/ (function(module, exports, __w_pdfjs_require__) { 63979 63980"use strict"; 63981 63982 63983Object.defineProperty(exports, "__esModule", { 63984 value: true 63985}); 63986exports.getTilingPatternIR = getTilingPatternIR; 63987exports.Pattern = void 0; 63988 63989var _util = __w_pdfjs_require__(2); 63990 63991var _colorspace = __w_pdfjs_require__(22); 63992 63993var _primitives = __w_pdfjs_require__(4); 63994 63995var _core_utils = __w_pdfjs_require__(7); 63996 63997var ShadingType = { 63998 FUNCTION_BASED: 1, 63999 AXIAL: 2, 64000 RADIAL: 3, 64001 FREE_FORM_MESH: 4, 64002 LATTICE_FORM_MESH: 5, 64003 COONS_PATCH_MESH: 6, 64004 TENSOR_PATCH_MESH: 7 64005}; 64006 64007var Pattern = function PatternClosure() { 64008 function Pattern() { 64009 (0, _util.unreachable)("should not call Pattern constructor"); 64010 } 64011 64012 Pattern.prototype = { 64013 getPattern: function Pattern_getPattern(ctx) { 64014 (0, _util.unreachable)(`Should not call Pattern.getStyle: ${ctx}`); 64015 } 64016 }; 64017 64018 Pattern.parseShading = function (shading, matrix, xref, res, handler, pdfFunctionFactory) { 64019 var dict = (0, _primitives.isStream)(shading) ? shading.dict : shading; 64020 var type = dict.get("ShadingType"); 64021 64022 try { 64023 switch (type) { 64024 case ShadingType.AXIAL: 64025 case ShadingType.RADIAL: 64026 return new Shadings.RadialAxial(dict, matrix, xref, res, pdfFunctionFactory); 64027 64028 case ShadingType.FREE_FORM_MESH: 64029 case ShadingType.LATTICE_FORM_MESH: 64030 case ShadingType.COONS_PATCH_MESH: 64031 case ShadingType.TENSOR_PATCH_MESH: 64032 return new Shadings.Mesh(shading, matrix, xref, res, pdfFunctionFactory); 64033 64034 default: 64035 throw new _util.FormatError("Unsupported ShadingType: " + type); 64036 } 64037 } catch (ex) { 64038 if (ex instanceof _core_utils.MissingDataException) { 64039 throw ex; 64040 } 64041 64042 handler.send("UnsupportedFeature", { 64043 featureId: _util.UNSUPPORTED_FEATURES.shadingPattern 64044 }); 64045 (0, _util.warn)(ex); 64046 return new Shadings.Dummy(); 64047 } 64048 }; 64049 64050 return Pattern; 64051}(); 64052 64053exports.Pattern = Pattern; 64054var Shadings = {}; 64055Shadings.SMALL_NUMBER = 1e-6; 64056 64057Shadings.RadialAxial = function RadialAxialClosure() { 64058 function RadialAxial(dict, matrix, xref, res, pdfFunctionFactory) { 64059 this.matrix = matrix; 64060 this.coordsArr = dict.getArray("Coords"); 64061 this.shadingType = dict.get("ShadingType"); 64062 this.type = "Pattern"; 64063 var cs = dict.get("ColorSpace", "CS"); 64064 cs = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory); 64065 this.cs = cs; 64066 const bbox = dict.getArray("BBox"); 64067 64068 if (Array.isArray(bbox) && bbox.length === 4) { 64069 this.bbox = _util.Util.normalizeRect(bbox); 64070 } else { 64071 this.bbox = null; 64072 } 64073 64074 var t0 = 0.0, 64075 t1 = 1.0; 64076 64077 if (dict.has("Domain")) { 64078 var domainArr = dict.getArray("Domain"); 64079 t0 = domainArr[0]; 64080 t1 = domainArr[1]; 64081 } 64082 64083 var extendStart = false, 64084 extendEnd = false;
64085 64086 if (dict.has("Extend")) { 64087 var extendArr = dict.getArray("Extend"); 64088 extendStart = extendArr[0]; 64089 extendEnd = extendArr[1]; 64090 } 64091 64092 if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) { 64093 var x1 = this.coordsArr[0]; 64094 var y1 = this.coordsArr[1]; 64095 var r1 = this.coordsArr[2]; 64096 var x2 = this.coordsArr[3]; 64097 var y2 = this.coordsArr[4]; 64098 var r2 = this.coordsArr[5]; 64099 var distance = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); 64100 64101 if (r1 <= r2 + distance && r2 <= r1 + distance) { 64102 (0, _util.warn)("Unsupported radial gradient."); 64103 } 64104 } 64105 64106 this.extendStart = extendStart; 64107 this.extendEnd = extendEnd; 64108 var fnObj = dict.get("Function"); 64109 var fn = pdfFunctionFactory.createFromArray(fnObj); 64110 const NUMBER_OF_SAMPLES = 10; 64111 const step = (t1 - t0) / NUMBER_OF_SAMPLES; 64112 var colorStops = this.colorStops = []; 64113 64114 if (t0 >= t1 || step <= 0) { 64115 (0, _util.info)("Bad shading domain."); 64116 return; 64117 } 64118 64119 var color = new Float32Array(cs.numComps), 64120 ratio = new Float32Array(1); 64121 var rgbColor; 64122 64123 for (let i = 0; i <= NUMBER_OF_SAMPLES; i++) { 64124 ratio[0] = t0 + i * step; 64125 fn(ratio, 0, color, 0); 64126 rgbColor = cs.getRgb(color, 0); 64127 64128 var cssColor = _util.Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]); 64129 64130 colorStops.push([i / NUMBER_OF_SAMPLES, cssColor]); 64131 } 64132 64133 var background = "transparent"; 64134
64135 if (dict.has("Background")) { 64136 rgbColor = cs.getRgb(dict.get("Background"), 0); 64137 background = _util.Util.makeCssRgb(rgbColor[0], rgbColor[1], rgbColor[2]); 64138 } 64139 64140 if (!extendStart) { 64141 colorStops.unshift([0, background]); 64142 colorStops[1][0] += Shadings.SMALL_NUMBER; 64143 } 64144 64145 if (!extendEnd) { 64146 colorStops[colorStops.length - 1][0] -= Shadings.SMALL_NUMBER; 64147 colorStops.push([1, background]); 64148 } 64149 64150 this.colorStops = colorStops; 64151 } 64152 64153 RadialAxial.prototype = { 64154 getIR: function RadialAxial_getIR() { 64155 var coordsArr = this.coordsArr; 64156 var shadingType = this.shadingType; 64157 var type, p0, p1, r0, r1; 64158 64159 if (shadingType === ShadingType.AXIAL) { 64160 p0 = [coordsArr[0], coordsArr[1]]; 64161 p1 = [coordsArr[2], coordsArr[3]]; 64162 r0 = null; 64163 r1 = null; 64164 type = "axial"; 64165 } else if (shadingType === ShadingType.RADIAL) { 64166 p0 = [coordsArr[0], coordsArr[1]]; 64167 p1 = [coordsArr[3], coordsArr[4]]; 64168 r0 = coordsArr[2]; 64169 r1 = coordsArr[5]; 64170 type = "radial"; 64171 } else { 64172 (0, _util.unreachable)(`getPattern type unknown: ${shadingType}`); 64173 } 64174 64175 var matrix = this.matrix; 64176 64177 if (matrix) { 64178 p0 = _util.Util.applyTransform(p0, matrix); 64179 p1 = _util.Util.applyTransform(p1, matrix); 64180 64181 if (shadingType === ShadingType.RADIAL) { 64182 var scale = _util.Util.singularValueDecompose2dScale(matrix); 64183 64184 r0 *= scale[0]; 64185 r1 *= scale[1]; 64186 } 64187 } 64188 64189 return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1]; 64190 } 64191 }; 64192 return RadialAxial; 64193}(); 64194 64195Shadings.Mesh = function MeshClosure() { 64196 function MeshStreamReader(stream, context) { 64197 this.stream = stream; 64198 this.context = context; 64199 this.buffer = 0; 64200 this.bufferLength = 0; 64201 var numComps = context.numComps; 64202 this.tmpCompsBuf = new Float32Array(numComps); 64203 var csNumComps = context.colorSpace.numComps; 64204 this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf; 64205 } 64206 64207 MeshStreamReader.prototype = { 64208 get hasData() { 64209 if (this.stream.end) { 64210 return this.stream.pos < this.stream.end; 64211 } 64212 64213 if (this.bufferLength > 0) { 64214 return true; 64215 } 64216 64217 var nextByte = this.stream.getByte(); 64218 64219 if (nextByte < 0) { 64220 return false; 64221 } 64222 64223 this.buffer = nextByte; 64224 this.bufferLength = 8; 64225 return true; 64226 }, 64227 64228 readBits: function MeshStreamReader_readBits(n) { 64229 var buffer = this.buffer; 64230 var bufferLength = this.bufferLength; 64231 64232 if (n === 32) { 64233 if (bufferLength === 0) { 64234 return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0; 64235 } 64236 64237 buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte(); 64238 var nextByte = this.stream.getByte(); 64239 this.buffer = nextByte & (1 << bufferLength) - 1; 64240 return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0; 64241 } 64242 64243 if (n === 8 && bufferLength === 0) { 64244 return this.stream.getByte(); 64245 } 64246 64247 while (bufferLength < n) { 64248 buffer = buffer << 8 | this.stream.getByte(); 64249 bufferLength += 8; 64250 } 64251 64252 bufferLength -= n; 64253 this.bufferLength = bufferLength; 64254 this.buffer = buffer & (1 << bufferLength) - 1; 64255 return buffer >> bufferLength; 64256 }, 64257 align: function MeshStreamReader_align() { 64258 this.buffer = 0; 64259 this.bufferLength = 0; 64260 }, 64261 readFlag: function MeshStreamReader_readFlag() { 64262 return this.readBits(this.context.bitsPerFlag); 64263 }, 64264 readCoordinate: function MeshStreamReader_readCoordinate() { 64265 var bitsPerCoordinate = this.context.bitsPerCoordinate; 64266 var xi = this.readBits(bitsPerCoordinate); 64267 var yi = this.readBits(bitsPerCoordinate); 64268 var decode = this.context.decode; 64269 var scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10; 64270 return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]]; 64271 }, 64272 readComponents: function MeshStreamReader_readComponents() { 64273 var numComps = this.context.numComps; 64274 var bitsPerComponent = this.context.bitsPerComponent; 64275 var scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10; 64276 var decode = this.context.decode; 64277 var components = this.tmpCompsBuf; 64278 64279 for (var i = 0, j = 4; i < numComps; i++, j += 2) { 64280 var ci = this.readBits(bitsPerComponent); 64281 components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j]; 64282 } 64283 64284 var color = this.tmpCsCompsBuf; 64285 64286 if (this.context.colorFn) { 64287 this.context.colorFn(components, 0, color, 0); 64288 } 64289 64290 return this.context.colorSpace.getRgb(color, 0); 64291 } 64292 }; 64293 64294 function decodeType4Shading(mesh, reader) { 64295 var coords = mesh.coords; 64296 var colors = mesh.colors; 64297 var operators = []; 64298 var ps = []; 64299 var verticesLeft = 0; 64300 64301 while (reader.hasData) { 64302 var f = reader.readFlag(); 64303 var coord = reader.readCoordinate(); 64304 var color = reader.readComponents(); 64305 64306 if (verticesLeft === 0) { 64307 if (!(0 <= f && f <= 2)) { 64308 throw new _util.FormatError("Unknown type4 flag"); 64309 } 64310 64311 switch (f) { 64312 case 0: 64313 verticesLeft = 3; 64314 break; 64315 64316 case 1: 64317 ps.push(ps[ps.length - 2], ps[ps.length - 1]); 64318 verticesLeft = 1; 64319 break; 64320 64321 case 2: 64322 ps.push(ps[ps.length - 3], ps[ps.length - 1]); 64323 verticesLeft = 1; 64324 break; 64325 } 64326 64327 operators.push(f); 64328 } 64329 64330 ps.push(coords.length); 64331 coords.push(coord); 64332 colors.push(color); 64333 verticesLeft--; 64334 reader.align(); 64335 } 64336 64337 mesh.figures.push({ 64338 type: "triangles", 64339 coords: new Int32Array(ps), 64340 colors: new Int32Array(ps) 64341 }); 64342 } 64343 64344 function decodeType5Shading(mesh, reader, verticesPerRow) { 64345 var coords = mesh.coords; 64346 var colors = mesh.colors; 64347 var ps = []; 64348 64349 while (reader.hasData) { 64350 var coord = reader.readCoordinate(); 64351 var color = reader.readComponents(); 64352 ps.push(coords.length); 64353 coords.push(coord); 64354 colors.push(color); 64355 } 64356 64357 mesh.figures.push({ 64358 type: "lattice", 64359 coords: new Int32Array(ps), 64360 colors: new Int32Array(ps), 64361 verticesPerRow 64362 }); 64363 } 64364 64365 var MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3; 64366 var MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20; 64367 var TRIANGLE_DENSITY = 20; 64368 64369 var getB = function getBClosure() { 64370 function buildB(count) { 64371 var lut = []; 64372 64373 for (var i = 0; i <= count; i++) { 64374 var t = i / count, 64375 t_ = 1 - t; 64376 lut.push(new Float32Array([t_ * t_ * t_, 3 * t * t_ * t_, 3 * t * t * t_, t * t * t])); 64377 } 64378 64379 return lut; 64380 } 64381 64382 var cache = []; 64383 return function getB(count) { 64384 if (!cache[count]) { 64385 cache[count] = buildB(count); 64386 } 64387 64388 return cache[count]; 64389 }; 64390 }(); 64391 64392 function buildFigureFromPatch(mesh, index) { 64393 var figure = mesh.figures[index]; 64394 (0, _util.assert)(figure.type === "patch", "Unexpected patch mesh figure"); 64395 var coords = mesh.coords, 64396 colors = mesh.colors; 64397 var pi = figure.coords; 64398 var ci = figure.colors; 64399 var figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]); 64400 var figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]); 64401 var figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]); 64402 var figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]); 64403 var splitXBy = Math.ceil((figureMaxX - figureMinX) * TRIANGLE_DENSITY / (mesh.bounds[2] - mesh.bounds[0])); 64404 splitXBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy)); 64405 var splitYBy = Math.ceil((figureMaxY - figureMinY) * TRIANGLE_DENSITY / (mesh.bounds[3] - mesh.bounds[1])); 64406 splitYBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy)); 64407 var verticesPerRow = splitXBy + 1; 64408 var figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow); 64409 var figureColors = new Int32Array((splitYBy + 1) * verticesPerRow); 64410 var k = 0; 64411 var cl = new Uint8Array(3), 64412 cr = new Uint8Array(3); 64413 var c0 = colors[ci[0]], 64414 c1 = colors[ci[1]], 64415 c2 = colors[ci[2]], 64416 c3 = colors[ci[3]]; 64417 var bRow = getB(splitYBy), 64418 bCol = getB(splitXBy); 64419 64420 for (var row = 0; row <= splitYBy; row++) { 64421 cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0; 64422 cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0; 64423 cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0; 64424 cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0; 64425 cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0; 64426 cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0; 64427 64428 for (var col = 0; col <= splitXBy; col++, k++) { 64429 if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) { 64430 continue; 64431 } 64432 64433 var x = 0, 64434 y = 0; 64435 var q = 0; 64436 64437 for (var i = 0; i <= 3; i++) { 64438 for (var j = 0; j <= 3; j++, q++) { 64439 var m = bRow[row][i] * bCol[col][j]; 64440 x += coords[pi[q]][0] * m; 64441 y += coords[pi[q]][1] * m; 64442 } 64443 } 64444 64445 figureCoords[k] = coords.length; 64446 coords.push([x, y]); 64447 figureColors[k] = colors.length; 64448 var newColor = new Uint8Array(3); 64449 newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0; 64450 newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0; 64451 newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0; 64452 colors.push(newColor); 64453 } 64454 } 64455 64456 figureCoords[0] = pi[0]; 64457 figureColors[0] = ci[0]; 64458 figureCoords[splitXBy] = pi[3];
vendor: 5,678 bytes, lines 64459-64634
64459 figureColors[splitXBy] = ci[1]; 64460 figureCoords[verticesPerRow * splitYBy] = pi[12]; 64461 figureColors[verticesPerRow * splitYBy] = ci[2]; 64462 figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15]; 64463 figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3]; 64464 mesh.figures[index] = { 64465 type: "lattice", 64466 coords: figureCoords, 64467 colors: figureColors, 64468 verticesPerRow 64469 }; 64470 } 64471 64472 function decodeType6Shading(mesh, reader) { 64473 var coords = mesh.coords; 64474 var colors = mesh.colors; 64475 var ps = new Int32Array(16); 64476 var cs = new Int32Array(4); 64477 64478 while (reader.hasData) { 64479 var f = reader.readFlag(); 64480 64481 if (!(0 <= f && f <= 3)) { 64482 throw new _util.FormatError("Unknown type6 flag"); 64483 } 64484 64485 var i, ii; 64486 var pi = coords.length; 64487 64488 for (i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) { 64489 coords.push(reader.readCoordinate()); 64490 } 64491 64492 var ci = colors.length; 64493 64494 for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) { 64495 colors.push(reader.readComponents()); 64496 } 64497 64498 var tmp1, tmp2, tmp3, tmp4; 64499 64500 switch (f) { 64501 case 0: 64502 ps[12] = pi + 3; 64503 ps[13] = pi + 4; 64504 ps[14] = pi + 5; 64505 ps[15] = pi + 6; 64506 ps[8] = pi + 2; 64507 ps[11] = pi + 7; 64508 ps[4] = pi + 1; 64509 ps[7] = pi + 8; 64510 ps[0] = pi; 64511 ps[1] = pi + 11; 64512 ps[2] = pi + 10; 64513 ps[3] = pi + 9; 64514 cs[2] = ci + 1; 64515 cs[3] = ci + 2; 64516 cs[0] = ci; 64517 cs[1] = ci + 3; 64518 break; 64519 64520 case 1: 64521 tmp1 = ps[12]; 64522 tmp2 = ps[13]; 64523 tmp3 = ps[14]; 64524 tmp4 = ps[15]; 64525 ps[12] = tmp4; 64526 ps[13] = pi + 0; 64527 ps[14] = pi + 1; 64528 ps[15] = pi + 2; 64529 ps[8] = tmp3; 64530 ps[11] = pi + 3; 64531 ps[4] = tmp2; 64532 ps[7] = pi + 4; 64533 ps[0] = tmp1; 64534 ps[1] = pi + 7; 64535 ps[2] = pi + 6; 64536 ps[3] = pi + 5; 64537 tmp1 = cs[2]; 64538 tmp2 = cs[3]; 64539 cs[2] = tmp2; 64540 cs[3] = ci; 64541 cs[0] = tmp1; 64542 cs[1] = ci + 1; 64543 break; 64544 64545 case 2: 64546 tmp1 = ps[15]; 64547 tmp2 = ps[11]; 64548 ps[12] = ps[3]; 64549 ps[13] = pi + 0; 64550 ps[14] = pi + 1; 64551 ps[15] = pi + 2; 64552 ps[8] = ps[7]; 64553 ps[11] = pi + 3; 64554 ps[4] = tmp2; 64555 ps[7] = pi + 4; 64556 ps[0] = tmp1; 64557 ps[1] = pi + 7; 64558 ps[2] = pi + 6; 64559 ps[3] = pi + 5; 64560 tmp1 = cs[3]; 64561 cs[2] = cs[1]; 64562 cs[3] = ci; 64563 cs[0] = tmp1; 64564 cs[1] = ci + 1; 64565 break; 64566 64567 case 3: 64568 ps[12] = ps[0]; 64569 ps[13] = pi + 0; 64570 ps[14] = pi + 1; 64571 ps[15] = pi + 2; 64572 ps[8] = ps[1]; 64573 ps[11] = pi + 3; 64574 ps[4] = ps[2]; 64575 ps[7] = pi + 4; 64576 ps[0] = ps[3]; 64577 ps[1] = pi + 7; 64578 ps[2] = pi + 6; 64579 ps[3] = pi + 5; 64580 cs[2] = cs[0]; 64581 cs[3] = ci; 64582 cs[0] = cs[1]; 64583 cs[1] = ci + 1; 64584 break; 64585 } 64586 64587 ps[5] = coords.length; 64588 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]); 64589 ps[6] = coords.length; 64590 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]); 64591 ps[9] = coords.length; 64592 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]); 64593 ps[10] = coords.length; 64594 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]); 64595 mesh.figures.push({ 64596 type: "patch", 64597 coords: new Int32Array(ps), 64598 colors: new Int32Array(cs) 64599 }); 64600 } 64601 } 64602 64603 function decodeType7Shading(mesh, reader) { 64604 var coords = mesh.coords; 64605 var colors = mesh.colors; 64606 var ps = new Int32Array(16); 64607 var cs = new Int32Array(4); 64608 64609 while (reader.hasData) { 64610 var f = reader.readFlag(); 64611 64612 if (!(0 <= f && f <= 3)) { 64613 throw new _util.FormatError("Unknown type7 flag"); 64614 } 64615 64616 var i, ii; 64617 var pi = coords.length; 64618 64619 for (i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) { 64620 coords.push(reader.readCoordinate()); 64621 } 64622 64623 var ci = colors.length; 64624 64625 for (i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) { 64626 colors.push(reader.readComponents()); 64627 } 64628 64629 var tmp1, tmp2, tmp3, tmp4; 64630 64631 switch (f) { 64632 case 0: 64633 ps[12] = pi + 3; 64634 ps[13] = pi + 4;
64635 ps[14] = pi + 5; 64636 ps[15] = pi + 6; 64637 ps[8] = pi + 2; 64638 ps[9] = pi + 13; 64639 ps[10] = pi + 14; 64640 ps[11] = pi + 7; 64641 ps[4] = pi + 1; 64642 ps[5] = pi + 12; 64643 ps[6] = pi + 15; 64644 ps[7] = pi + 8; 64645 ps[0] = pi; 64646 ps[1] = pi + 11; 64647 ps[2] = pi + 10; 64648 ps[3] = pi + 9; 64649 cs[2] = ci + 1; 64650 cs[3] = ci + 2; 64651 cs[0] = ci; 64652 cs[1] = ci + 3; 64653 break; 64654 64655 case 1: 64656 tmp1 = ps[12]; 64657 tmp2 = ps[13]; 64658 tmp3 = ps[14]; 64659 tmp4 = ps[15]; 64660 ps[12] = tmp4; 64661 ps[13] = pi + 0; 64662 ps[14] = pi + 1; 64663 ps[15] = pi + 2; 64664 ps[8] = tmp3; 64665 ps[9] = pi + 9; 64666 ps[10] = pi + 10; 64667 ps[11] = pi + 3; 64668 ps[4] = tmp2; 64669 ps[5] = pi + 8; 64670 ps[6] = pi + 11; 64671 ps[7] = pi + 4; 64672 ps[0] = tmp1; 64673 ps[1] = pi + 7; 64674 ps[2] = pi + 6; 64675 ps[3] = pi + 5; 64676 tmp1 = cs[2]; 64677 tmp2 = cs[3]; 64678 cs[2] = tmp2; 64679 cs[3] = ci; 64680 cs[0] = tmp1; 64681 cs[1] = ci + 1; 64682 break; 64683 64684 case 2: 64685 tmp1 = ps[15]; 64686 tmp2 = ps[11]; 64687 ps[12] = ps[3]; 64688 ps[13] = pi + 0; 64689 ps[14] = pi + 1; 64690 ps[15] = pi + 2; 64691 ps[8] = ps[7]; 64692 ps[9] = pi + 9; 64693 ps[10] = pi + 10; 64694 ps[11] = pi + 3; 64695 ps[4] = tmp2; 64696 ps[5] = pi + 8; 64697 ps[6] = pi + 11; 64698 ps[7] = pi + 4; 64699 ps[0] = tmp1; 64700 ps[1] = pi + 7; 64701 ps[2] = pi + 6; 64702 ps[3] = pi + 5; 64703 tmp1 = cs[3]; 64704 cs[2] = cs[1]; 64705 cs[3] = ci; 64706 cs[0] = tmp1; 64707 cs[1] = ci + 1; 64708 break; 64709 64710 case 3: 64711 ps[12] = ps[0]; 64712 ps[13] = pi + 0; 64713 ps[14] = pi + 1; 64714 ps[15] = pi + 2; 64715 ps[8] = ps[1]; 64716 ps[9] = pi + 9; 64717 ps[10] = pi + 10; 64718 ps[11] = pi + 3; 64719 ps[4] = ps[2]; 64720 ps[5] = pi + 8; 64721 ps[6] = pi + 11; 64722 ps[7] = pi + 4; 64723 ps[0] = ps[3]; 64724 ps[1] = pi + 7; 64725 ps[2] = pi + 6; 64726 ps[3] = pi + 5; 64727 cs[2] = cs[0]; 64728 cs[3] = ci; 64729 cs[0] = cs[1]; 64730 cs[1] = ci + 1; 64731 break; 64732 } 64733 64734 mesh.figures.push({ 64735 type: "patch", 64736 coords: new Int32Array(ps), 64737 colors: new Int32Array(cs) 64738 }); 64739 } 64740 } 64741 64742 function updateBounds(mesh) { 64743 var minX = mesh.coords[0][0], 64744 minY = mesh.coords[0][1], 64745 maxX = minX, 64746 maxY = minY; 64747 64748 for (var i = 1, ii = mesh.coords.length; i < ii; i++) { 64749 var x = mesh.coords[i][0], 64750 y = mesh.coords[i][1]; 64751 minX = minX > x ? x : minX; 64752 minY = minY > y ? y : minY; 64753 maxX = maxX < x ? x : maxX; 64754 maxY = maxY < y ? y : maxY; 64755 } 64756 64757 mesh.bounds = [minX, minY, maxX, maxY]; 64758 } 64759 64760 function packData(mesh) { 64761 var i, ii, j, jj; 64762 var coords = mesh.coords; 64763 var coordsPacked = new Float32Array(coords.length * 2); 64764 64765 for (i = 0, j = 0, ii = coords.length; i < ii; i++) { 64766 var xy = coords[i]; 64767 coordsPacked[j++] = xy[0]; 64768 coordsPacked[j++] = xy[1]; 64769 } 64770 64771 mesh.coords = coordsPacked; 64772 var colors = mesh.colors; 64773 var colorsPacked = new Uint8Array(colors.length * 3); 64774 64775 for (i = 0, j = 0, ii = colors.length; i < ii; i++) { 64776 var c = colors[i]; 64777 colorsPacked[j++] = c[0]; 64778 colorsPacked[j++] = c[1]; 64779 colorsPacked[j++] = c[2]; 64780 } 64781 64782 mesh.colors = colorsPacked; 64783 var figures = mesh.figures; 64784 64785 for (i = 0, ii = figures.length; i < ii; i++) { 64786 var figure = figures[i], 64787 ps = figure.coords, 64788 cs = figure.colors; 64789 64790 for (j = 0, jj = ps.length; j < jj; j++) { 64791 ps[j] *= 2; 64792 cs[j] *= 3; 64793 } 64794 } 64795 } 64796 64797 function Mesh(stream, matrix, xref, res, pdfFunctionFactory) { 64798 if (!(0, _primitives.isStream)(stream)) { 64799 throw new _util.FormatError("Mesh data is not a stream"); 64800 } 64801 64802 var dict = stream.dict; 64803 this.matrix = matrix; 64804 this.shadingType = dict.get("ShadingType"); 64805 this.type = "Pattern"; 64806 const bbox = dict.getArray("BBox"); 64807 64808 if (Array.isArray(bbox) && bbox.length === 4) { 64809 this.bbox = _util.Util.normalizeRect(bbox); 64810 } else { 64811 this.bbox = null; 64812 } 64813 64814 var cs = dict.get("ColorSpace", "CS"); 64815 cs = _colorspace.ColorSpace.parse(cs, xref, res, pdfFunctionFactory); 64816 this.cs = cs;
64817 this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null; 64818 var fnObj = dict.get("Function"); 64819 var fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null; 64820 this.coords = []; 64821 this.colors = []; 64822 this.figures = []; 64823 var decodeContext = { 64824 bitsPerCoordinate: dict.get("BitsPerCoordinate"), 64825 bitsPerComponent: dict.get("BitsPerComponent"), 64826 bitsPerFlag: dict.get("BitsPerFlag"), 64827 decode: dict.getArray("Decode"), 64828 colorFn: fn, 64829 colorSpace: cs, 64830 numComps: fn ? 1 : cs.numComps 64831 }; 64832 var reader = new MeshStreamReader(stream, decodeContext); 64833 var patchMesh = false; 64834 64835 switch (this.shadingType) { 64836 case ShadingType.FREE_FORM_MESH: 64837 decodeType4Shading(this, reader); 64838 break; 64839 64840 case ShadingType.LATTICE_FORM_MESH: 64841 var verticesPerRow = dict.get("VerticesPerRow") | 0; 64842 64843 if (verticesPerRow < 2) { 64844 throw new _util.FormatError("Invalid VerticesPerRow"); 64845 } 64846 64847 decodeType5Shading(this, reader, verticesPerRow); 64848 break; 64849 64850 case ShadingType.COONS_PATCH_MESH: 64851 decodeType6Shading(this, reader); 64852 patchMesh = true; 64853 break; 64854 64855 case ShadingType.TENSOR_PATCH_MESH: 64856 decodeType7Shading(this, reader); 64857 patchMesh = true; 64858 break; 64859 64860 default: 64861 (0, _util.unreachable)("Unsupported mesh type."); 64862 break; 64863 } 64864 64865 if (patchMesh) { 64866 updateBounds(this); 64867 64868 for (var i = 0, ii = this.figures.length; i < ii; i++) { 64869 buildFigureFromPatch(this, i); 64870 } 64871 } 64872 64873 updateBounds(this); 64874 packData(this); 64875 } 64876 64877 Mesh.prototype = { 64878 getIR: function Mesh_getIR() { 64879 return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.matrix, this.bbox, this.background]; 64880 } 64881 }; 64882 return Mesh; 64883}(); 64884 64885Shadings.Dummy = function DummyClosure() { 64886 function Dummy() { 64887 this.type = "Pattern"; 64888 } 64889 64890 Dummy.prototype = { 64891 getIR: function Dummy_getIR() { 64892 return ["Dummy"]; 64893 } 64894 }; 64895 return Dummy; 64896}(); 64897 64898function getTilingPatternIR(operatorList, dict, args) { 64899 const matrix = dict.getArray("Matrix"); 64900 64901 const bbox = _util.Util.normalizeRect(dict.getArray("BBox")); 64902 64903 const xstep = dict.get("XStep"); 64904 const ystep = dict.get("YStep"); 64905 const paintType = dict.get("PaintType"); 64906 const tilingType = dict.get("TilingType"); 64907 64908 if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) { 64909 throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`); 64910 } 64911 64912 return ["TilingPattern", args, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType]; 64913} 64914 64915/***/ }), 64916/* 37 */ 64917/***/ (function(module, exports, __w_pdfjs_require__) { 64918 64919"use strict"; 64920 64921 64922Object.defineProperty(exports, "__esModule", { 64923 value: true 64924}); 64925exports.bidi = bidi; 64926 64927var _util = __w_pdfjs_require__(2); 64928 64929var 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"]; 64930var 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"]; 64931 64932function isOdd(i) { 64933 return (i & 1) !== 0; 64934} 64935 64936function isEven(i) { 64937 return (i & 1) === 0; 64938} 64939 64940function findUnequal(arr, start, value) { 64941 for (var j = start, jj = arr.length; j < jj; ++j) { 64942 if (arr[j] !== value) { 64943 return j; 64944 } 64945 } 64946 64947 return j; 64948} 64949 64950function setValues(arr, start, end, value) { 64951 for (var j = start; j < end; ++j) { 64952 arr[j] = value; 64953 } 64954} 64955 64956function reverseValues(arr, start, end) { 64957 for (var i = start, j = end - 1; i < j; ++i, --j) { 64958 var temp = arr[i]; 64959 arr[i] = arr[j]; 64960 arr[j] = temp; 64961 } 64962} 64963 64964function createBidiText(str, isLTR, vertical = false) { 64965 let dir = "ltr"; 64966 64967 if (vertical) { 64968 dir = "ttb"; 64969 } else if (!isLTR) { 64970 dir = "rtl";
vendor: 4,139 bytes, lines 64971-65188
64971 } 64972 64973 return { 64974 str, 64975 dir 64976 }; 64977} 64978 64979var chars = []; 64980var types = []; 64981 64982function bidi(str, startLevel, vertical) { 64983 var isLTR = true; 64984 var strLength = str.length; 64985 64986 if (strLength === 0 || vertical) { 64987 return createBidiText(str, isLTR, vertical); 64988 } 64989 64990 chars.length = strLength; 64991 types.length = strLength; 64992 var numBidi = 0; 64993 var i, ii; 64994 64995 for (i = 0; i < strLength; ++i) { 64996 chars[i] = str.charAt(i); 64997 var charCode = str.charCodeAt(i); 64998 var charType = "L"; 64999 65000 if (charCode <= 0x00ff) { 65001 charType = baseTypes[charCode]; 65002 } else if (0x0590 <= charCode && charCode <= 0x05f4) { 65003 charType = "R"; 65004 } else if (0x0600 <= charCode && charCode <= 0x06ff) { 65005 charType = arabicTypes[charCode & 0xff]; 65006 65007 if (!charType) { 65008 (0, _util.warn)("Bidi: invalid Unicode character " + charCode.toString(16)); 65009 } 65010 } else if (0x0700 <= charCode && charCode <= 0x08ac) { 65011 charType = "AL"; 65012 } 65013 65014 if (charType === "R" || charType === "AL" || charType === "AN") { 65015 numBidi++; 65016 } 65017 65018 types[i] = charType; 65019 } 65020 65021 if (numBidi === 0) { 65022 isLTR = true; 65023 return createBidiText(str, isLTR); 65024 } 65025 65026 if (startLevel === -1) { 65027 if (numBidi / strLength < 0.3) { 65028 isLTR = true; 65029 startLevel = 0; 65030 } else { 65031 isLTR = false; 65032 startLevel = 1; 65033 } 65034 } 65035 65036 var levels = []; 65037 65038 for (i = 0; i < strLength; ++i) { 65039 levels[i] = startLevel; 65040 } 65041 65042 var e = isOdd(startLevel) ? "R" : "L"; 65043 var sor = e; 65044 var eor = sor; 65045 var lastType = sor; 65046 65047 for (i = 0; i < strLength; ++i) { 65048 if (types[i] === "NSM") { 65049 types[i] = lastType; 65050 } else { 65051 lastType = types[i]; 65052 } 65053 } 65054 65055 lastType = sor; 65056 var t; 65057 65058 for (i = 0; i < strLength; ++i) { 65059 t = types[i]; 65060 65061 if (t === "EN") { 65062 types[i] = lastType === "AL" ? "AN" : "EN"; 65063 } else if (t === "R" || t === "L" || t === "AL") { 65064 lastType = t; 65065 } 65066 } 65067 65068 for (i = 0; i < strLength; ++i) { 65069 t = types[i]; 65070 65071 if (t === "AL") { 65072 types[i] = "R"; 65073 } 65074 } 65075 65076 for (i = 1; i < strLength - 1; ++i) { 65077 if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") { 65078 types[i] = "EN"; 65079 } 65080 65081 if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) { 65082 types[i] = types[i - 1]; 65083 } 65084 } 65085 65086 for (i = 0; i < strLength; ++i) { 65087 if (types[i] === "EN") { 65088 var j; 65089 65090 for (j = i - 1; j >= 0; --j) { 65091 if (types[j] !== "ET") { 65092 break; 65093 } 65094 65095 types[j] = "EN"; 65096 } 65097 65098 for (j = i + 1; j < strLength; ++j) { 65099 if (types[j] !== "ET") { 65100 break; 65101 } 65102 65103 types[j] = "EN"; 65104 } 65105 } 65106 } 65107 65108 for (i = 0; i < strLength; ++i) { 65109 t = types[i]; 65110 65111 if (t === "WS" || t === "ES" || t === "ET" || t === "CS") { 65112 types[i] = "ON"; 65113 } 65114 } 65115 65116 lastType = sor; 65117 65118 for (i = 0; i < strLength; ++i) { 65119 t = types[i]; 65120 65121 if (t === "EN") { 65122 types[i] = lastType === "L" ? "L" : "EN"; 65123 } else if (t === "R" || t === "L") { 65124 lastType = t; 65125 } 65126 } 65127 65128 for (i = 0; i < strLength; ++i) { 65129 if (types[i] === "ON") { 65130 var end = findUnequal(types, i + 1, "ON"); 65131 var before = sor; 65132 65133 if (i > 0) { 65134 before = types[i - 1]; 65135 } 65136 65137 var after = eor; 65138 65139 if (end + 1 < strLength) { 65140 after = types[end + 1]; 65141 } 65142 65143 if (before !== "L") { 65144 before = "R"; 65145 } 65146 65147 if (after !== "L") { 65148 after = "R"; 65149 } 65150 65151 if (before === after) { 65152 setValues(types, i, end, before); 65153 } 65154 65155 i = end - 1; 65156 } 65157 } 65158 65159 for (i = 0; i < strLength; ++i) { 65160 if (types[i] === "ON") { 65161 types[i] = e; 65162 } 65163 } 65164 65165 for (i = 0; i < strLength; ++i) { 65166 t = types[i]; 65167 65168 if (isEven(levels[i])) { 65169 if (t === "R") { 65170 levels[i] += 1; 65171 } else if (t === "AN" || t === "EN") { 65172 levels[i] += 2; 65173 } 65174 } else { 65175 if (t === "L" || t === "AN" || t === "EN") { 65176 levels[i] += 1; 65177 } 65178 } 65179 } 65180 65181 var highestLevel = -1; 65182 var lowestOddLevel = 99; 65183 var level; 65184 65185 for (i = 0, ii = levels.length; i < ii; ++i) { 65186 level = levels[i]; 65187 65188 if (highestLevel < level) {
vendor: 2,119 bytes, lines 65189-65287
65189 highestLevel = level; 65190 } 65191 65192 if (lowestOddLevel > level && isOdd(level)) { 65193 lowestOddLevel = level; 65194 } 65195 } 65196 65197 for (level = highestLevel; level >= lowestOddLevel; --level) { 65198 var start = -1; 65199 65200 for (i = 0, ii = levels.length; i < ii; ++i) { 65201 if (levels[i] < level) { 65202 if (start >= 0) { 65203 reverseValues(chars, start, i); 65204 start = -1; 65205 } 65206 } else if (start < 0) { 65207 start = i; 65208 } 65209 } 65210 65211 if (start >= 0) { 65212 reverseValues(chars, start, levels.length); 65213 } 65214 } 65215 65216 for (i = 0, ii = chars.length; i < ii; ++i) { 65217 var ch = chars[i]; 65218 65219 if (ch === "<" || ch === ">") { 65220 chars[i] = ""; 65221 } 65222 } 65223 65224 return createBidiText(chars.join(""), isLTR); 65225} 65226 65227/***/ }), 65228/* 38 */ 65229/***/ (function(module, exports, __w_pdfjs_require__) { 65230 65231"use strict"; 65232 65233 65234Object.defineProperty(exports, "__esModule", { 65235 value: true 65236}); 65237exports.getMetrics = void 0; 65238 65239var _core_utils = __w_pdfjs_require__(7); 65240 65241var getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) { 65242 t["Courier"] = 600; 65243 t["Courier-Bold"] = 600; 65244 t["Courier-BoldOblique"] = 600; 65245 t["Courier-Oblique"] = 600; 65246 t["Helvetica"] = (0, _core_utils.getLookupTableFactory)(function (t) { 65247 t["space"] = 278; 65248 t["exclam"] = 278; 65249 t["quotedbl"] = 355; 65250 t["numbersign"] = 556; 65251 t["dollar"] = 556; 65252 t["percent"] = 889; 65253 t["ampersand"] = 667; 65254 t["quoteright"] = 222; 65255 t["parenleft"] = 333; 65256 t["parenright"] = 333; 65257 t["asterisk"] = 389; 65258 t["plus"] = 584; 65259 t["comma"] = 278; 65260 t["hyphen"] = 333; 65261 t["period"] = 278; 65262 t["slash"] = 278; 65263 t["zero"] = 556; 65264 t["one"] = 556; 65265 t["two"] = 556; 65266 t["three"] = 556; 65267 t["four"] = 556; 65268 t["five"] = 556; 65269 t["six"] = 556; 65270 t["seven"] = 556; 65271 t["eight"] = 556; 65272 t["nine"] = 556; 65273 t["colon"] = 278; 65274 t["semicolon"] = 278; 65275 t["less"] = 584; 65276 t["equal"] = 584; 65277 t["greater"] = 584; 65278 t["question"] = 556; 65279 t["at"] = 1015; 65280 t["A"] = 667; 65281 t["B"] = 667; 65282 t["C"] = 722; 65283 t["D"] = 722; 65284 t["E"] = 667; 65285 t["F"] = 611; 65286 t["G"] = 778; 65287 t["H"] = 722;
65288 t["I"] = 278; 65289 t["J"] = 500; 65290 t["K"] = 667; 65291 t["L"] = 556; 65292 t["M"] = 833; 65293 t["N"] = 722; 65294 t["O"] = 778; 65295 t["P"] = 667; 65296 t["Q"] = 778; 65297 t["R"] = 722; 65298 t["S"] = 667; 65299 t["T"] = 611; 65300 t["U"] = 722; 65301 t["V"] = 667; 65302 t["W"] = 944; 65303 t["X"] = 667; 65304 t["Y"] = 667; 65305 t["Z"] = 611; 65306 t["bracketleft"] = 278; 65307 t["backslash"] = 278; 65308 t["bracketright"] = 278; 65309 t["asciicircum"] = 469; 65310 t["underscore"] = 556; 65311 t["quoteleft"] = 222; 65312 t["a"] = 556; 65313 t["b"] = 556; 65314 t["c"] = 500; 65315 t["d"] = 556; 65316 t["e"] = 556; 65317 t["f"] = 278; 65318 t["g"] = 556; 65319 t["h"] = 556; 65320 t["i"] = 222; 65321 t["j"] = 222; 65322 t["k"] = 500; 65323 t["l"] = 222; 65324 t["m"] = 833; 65325 t["n"] = 556; 65326 t["o"] = 556; 65327 t["p"] = 556; 65328 t["q"] = 556; 65329 t["r"] = 333; 65330 t["s"] = 500; 65331 t["t"] = 278; 65332 t["u"] = 556; 65333 t["v"] = 500; 65334 t["w"] = 722; 65335 t["x"] = 500; 65336 t["y"] = 500; 65337 t["z"] = 500; 65338 t["braceleft"] = 334; 65339 t["bar"] = 260; 65340 t["braceright"] = 334; 65341 t["asciitilde"] = 584; 65342 t["exclamdown"] = 333; 65343 t["cent"] = 556; 65344 t["sterling"] = 556; 65345 t["fraction"] = 167; 65346 t["yen"] = 556; 65347 t["florin"] = 556; 65348 t["section"] = 556; 65349 t["currency"] = 556; 65350 t["quotesingle"] = 191; 65351 t["quotedblleft"] = 333; 65352 t["guillemotleft"] = 556; 65353 t["guilsinglleft"] = 333; 65354 t["guilsinglright"] = 333; 65355 t["fi"] = 500; 65356 t["fl"] = 500; 65357 t["endash"] = 556; 65358 t["dagger"] = 556; 65359 t["daggerdbl"] = 556; 65360 t["periodcentered"] = 278; 65361 t["paragraph"] = 537; 65362 t["bullet"] = 350; 65363 t["quotesinglbase"] = 222; 65364 t["quotedblbase"] = 333; 65365 t["quotedblright"] = 333; 65366 t["guillemotright"] = 556; 65367 t["ellipsis"] = 1000; 65368 t["perthousand"] = 1000; 65369 t["questiondown"] = 611; 65370 t["grave"] = 333; 65371 t["acute"] = 333; 65372 t["circumflex"] = 333; 65373 t["tilde"] = 333; 65374 t["macron"] = 333; 65375 t["breve"] = 333; 65376 t["dotaccent"] = 333; 65377 t["dieresis"] = 333; 65378 t["ring"] = 333; 65379 t["cedilla"] = 333; 65380 t["hungarumlaut"] = 333; 65381 t["ogonek"] = 333; 65382 t["caron"] = 333; 65383 t["emdash"] = 1000; 65384 t["AE"] = 1000; 65385 t["ordfeminine"] = 370; 65386 t["Lslash"] = 556; 65387 t["Oslash"] = 778; 65388 t["OE"] = 1000; 65389 t["ordmasculine"] = 365; 65390 t["ae"] = 889; 65391 t["dotlessi"] = 278; 65392 t["lslash"] = 222; 65393 t["oslash"] = 611; 65394 t["oe"] = 944; 65395 t["germandbls"] = 611; 65396 t["Idieresis"] = 278; 65397 t["eacute"] = 556; 65398 t["abreve"] = 556; 65399 t["uhungarumlaut"] = 556; 65400 t["ecaron"] = 556; 65401 t["Ydieresis"] = 667; 65402 t["divide"] = 584; 65403 t["Yacute"] = 667; 65404 t["Acircumflex"] = 667; 65405 t["aacute"] = 556; 65406 t["Ucircumflex"] = 722; 65407 t["yacute"] = 500; 65408 t["scommaaccent"] = 500; 65409 t["ecircumflex"] = 556; 65410 t["Uring"] = 722; 65411 t["Udieresis"] = 722; 65412 t["aogonek"] = 556; 65413 t["Uacute"] = 722; 65414 t["uogonek"] = 556; 65415 t["Edieresis"] = 667; 65416 t["Dcroat"] = 722; 65417 t["commaaccent"] = 250; 65418 t["copyright"] = 737; 65419 t["Emacron"] = 667; 65420 t["ccaron"] = 500; 65421 t["aring"] = 556; 65422 t["Ncommaaccent"] = 722; 65423 t["lacute"] = 222; 65424 t["agrave"] = 556; 65425 t["Tcommaaccent"] = 611; 65426 t["Cacute"] = 722; 65427 t["atilde"] = 556; 65428 t["Edotaccent"] = 667; 65429 t["scaron"] = 500; 65430 t["scedilla"] = 500; 65431 t["iacute"] = 278; 65432 t["lozenge"] = 471; 65433 t["Rcaron"] = 722; 65434 t["Gcommaaccent"] = 778; 65435 t["ucircumflex"] = 556; 65436 t["acircumflex"] = 556; 65437 t["Amacron"] = 667; 65438 t["rcaron"] = 333; 65439 t["ccedilla"] = 500; 65440 t["Zdotaccent"] = 611; 65441 t["Thorn"] = 667; 65442 t["Omacron"] = 778; 65443 t["Racute"] = 722; 65444 t["Sacute"] = 667; 65445 t["dcaron"] = 643; 65446 t["Umacron"] = 722; 65447 t["uring"] = 556; 65448 t["threesuperior"] = 333; 65449 t["Ograve"] = 778; 65450 t["Agrave"] = 667; 65451 t["Abreve"] = 667; 65452 t["multiply"] = 584; 65453 t["uacute"] = 556; 65454 t["Tcaron"] = 611; 65455 t["partialdiff"] = 476; 65456 t["ydieresis"] = 500; 65457 t["Nacute"] = 722; 65458 t["icircumflex"] = 278; 65459 t["Ecircumflex"] = 667; 65460 t["adieresis"] = 556; 65461 t["edieresis"] = 556; 65462 t["cacute"] = 500; 65463 t["nacute"] = 556; 65464 t["umacron"] = 556; 65465 t["Ncaron"] = 722; 65466 t["Iacute"] = 278; 65467 t["plusminus"] = 584; 65468 t["brokenbar"] = 260; 65469 t["registered"] = 737; 65470 t["Gbreve"] = 778; 65471 t["Idotaccent"] = 278;
65472 t["summation"] = 600; 65473 t["Egrave"] = 667; 65474 t["racute"] = 333; 65475 t["omacron"] = 556; 65476 t["Zacute"] = 611; 65477 t["Zcaron"] = 611; 65478 t["greaterequal"] = 549; 65479 t["Eth"] = 722; 65480 t["Ccedilla"] = 722; 65481 t["lcommaaccent"] = 222; 65482 t["tcaron"] = 317; 65483 t["eogonek"] = 556; 65484 t["Uogonek"] = 722; 65485 t["Aacute"] = 667; 65486 t["Adieresis"] = 667; 65487 t["egrave"] = 556; 65488 t["zacute"] = 500; 65489 t["iogonek"] = 222; 65490 t["Oacute"] = 778; 65491 t["oacute"] = 556; 65492 t["amacron"] = 556; 65493 t["sacute"] = 500; 65494 t["idieresis"] = 278; 65495 t["Ocircumflex"] = 778; 65496 t["Ugrave"] = 722; 65497 t["Delta"] = 612; 65498 t["thorn"] = 556; 65499 t["twosuperior"] = 333; 65500 t["Odieresis"] = 778; 65501 t["mu"] = 556; 65502 t["igrave"] = 278; 65503 t["ohungarumlaut"] = 556; 65504 t["Eogonek"] = 667; 65505 t["dcroat"] = 556; 65506 t["threequarters"] = 834; 65507 t["Scedilla"] = 667; 65508 t["lcaron"] = 299; 65509 t["Kcommaaccent"] = 667; 65510 t["Lacute"] = 556; 65511 t["trademark"] = 1000; 65512 t["edotaccent"] = 556; 65513 t["Igrave"] = 278; 65514 t["Imacron"] = 278; 65515 t["Lcaron"] = 556; 65516 t["onehalf"] = 834; 65517 t["lessequal"] = 549; 65518 t["ocircumflex"] = 556; 65519 t["ntilde"] = 556; 65520 t["Uhungarumlaut"] = 722; 65521 t["Eacute"] = 667; 65522 t["emacron"] = 556; 65523 t["gbreve"] = 556; 65524 t["onequarter"] = 834; 65525 t["Scaron"] = 667; 65526 t["Scommaaccent"] = 667; 65527 t["Ohungarumlaut"] = 778; 65528 t["degree"] = 400; 65529 t["ograve"] = 556; 65530 t["Ccaron"] = 722; 65531 t["ugrave"] = 556; 65532 t["radical"] = 453; 65533 t["Dcaron"] = 722; 65534 t["rcommaaccent"] = 333; 65535 t["Ntilde"] = 722; 65536 t["otilde"] = 556; 65537 t["Rcommaaccent"] = 722; 65538 t["Lcommaaccent"] = 556; 65539 t["Atilde"] = 667; 65540 t["Aogonek"] = 667; 65541 t["Aring"] = 667; 65542 t["Otilde"] = 778; 65543 t["zdotaccent"] = 500; 65544 t["Ecaron"] = 667; 65545 t["Iogonek"] = 278; 65546 t["kcommaaccent"] = 500; 65547 t["minus"] = 584; 65548 t["Icircumflex"] = 278; 65549 t["ncaron"] = 556; 65550 t["tcommaaccent"] = 278; 65551 t["logicalnot"] = 584; 65552 t["odieresis"] = 556; 65553 t["udieresis"] = 556; 65554 t["notequal"] = 549; 65555 t["gcommaaccent"] = 556; 65556 t["eth"] = 556; 65557 t["zcaron"] = 500; 65558 t["ncommaaccent"] = 556; 65559 t["onesuperior"] = 333; 65560 t["imacron"] = 278; 65561 t["Euro"] = 556; 65562 }); 65563 t["Helvetica-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) { 65564 t["space"] = 278; 65565 t["exclam"] = 333; 65566 t["quotedbl"] = 474; 65567 t["numbersign"] = 556; 65568 t["dollar"] = 556; 65569 t["percent"] = 889; 65570 t["ampersand"] = 722; 65571 t["quoteright"] = 278; 65572 t["parenleft"] = 333; 65573 t["parenright"] = 333; 65574 t["asterisk"] = 389; 65575 t["plus"] = 584; 65576 t["comma"] = 278; 65577 t["hyphen"] = 333; 65578 t["period"] = 278; 65579 t["slash"] = 278; 65580 t["zero"] = 556; 65581 t["one"] = 556; 65582 t["two"] = 556; 65583 t["three"] = 556; 65584 t["four"] = 556; 65585 t["five"] = 556; 65586 t["six"] = 556; 65587 t["seven"] = 556; 65588 t["eight"] = 556; 65589 t["nine"] = 556; 65590 t["colon"] = 333; 65591 t["semicolon"] = 333; 65592 t["less"] = 584; 65593 t["equal"] = 584; 65594 t["greater"] = 584; 65595 t["question"] = 611; 65596 t["at"] = 975; 65597 t["A"] = 722; 65598 t["B"] = 722; 65599 t["C"] = 722; 65600 t["D"] = 722; 65601 t["E"] = 667; 65602 t["F"] = 611; 65603 t["G"] = 778; 65604 t["H"] = 722;
65605 t["I"] = 278; 65606 t["J"] = 556; 65607 t["K"] = 722; 65608 t["L"] = 611; 65609 t["M"] = 833; 65610 t["N"] = 722; 65611 t["O"] = 778; 65612 t["P"] = 667; 65613 t["Q"] = 778; 65614 t["R"] = 722; 65615 t["S"] = 667; 65616 t["T"] = 611; 65617 t["U"] = 722; 65618 t["V"] = 667; 65619 t["W"] = 944; 65620 t["X"] = 667; 65621 t["Y"] = 667; 65622 t["Z"] = 611; 65623 t["bracketleft"] = 333; 65624 t["backslash"] = 278; 65625 t["bracketright"] = 333; 65626 t["asciicircum"] = 584; 65627 t["underscore"] = 556; 65628 t["quoteleft"] = 278; 65629 t["a"] = 556; 65630 t["b"] = 611; 65631 t["c"] = 556; 65632 t["d"] = 611; 65633 t["e"] = 556; 65634 t["f"] = 333; 65635 t["g"] = 611; 65636 t["h"] = 611; 65637 t["i"] = 278; 65638 t["j"] = 278; 65639 t["k"] = 556; 65640 t["l"] = 278; 65641 t["m"] = 889; 65642 t["n"] = 611; 65643 t["o"] = 611; 65644 t["p"] = 611; 65645 t["q"] = 611; 65646 t["r"] = 389; 65647 t["s"] = 556; 65648 t["t"] = 333; 65649 t["u"] = 611; 65650 t["v"] = 556; 65651 t["w"] = 778; 65652 t["x"] = 556; 65653 t["y"] = 556; 65654 t["z"] = 500; 65655 t["braceleft"] = 389; 65656 t["bar"] = 280; 65657 t["braceright"] = 389; 65658 t["asciitilde"] = 584; 65659 t["exclamdown"] = 333; 65660 t["cent"] = 556; 65661 t["sterling"] = 556; 65662 t["fraction"] = 167; 65663 t["yen"] = 556; 65664 t["florin"] = 556; 65665 t["section"] = 556; 65666 t["currency"] = 556; 65667 t["quotesingle"] = 238; 65668 t["quotedblleft"] = 500; 65669 t["guillemotleft"] = 556; 65670 t["guilsinglleft"] = 333; 65671 t["guilsinglright"] = 333; 65672 t["fi"] = 611; 65673 t["fl"] = 611; 65674 t["endash"] = 556; 65675 t["dagger"] = 556; 65676 t["daggerdbl"] = 556; 65677 t["periodcentered"] = 278; 65678 t["paragraph"] = 556; 65679 t["bullet"] = 350; 65680 t["quotesinglbase"] = 278; 65681 t["quotedblbase"] = 500; 65682 t["quotedblright"] = 500; 65683 t["guillemotright"] = 556; 65684 t["ellipsis"] = 1000; 65685 t["perthousand"] = 1000; 65686 t["questiondown"] = 611; 65687 t["grave"] = 333; 65688 t["acute"] = 333; 65689 t["circumflex"] = 333; 65690 t["tilde"] = 333; 65691 t["macron"] = 333; 65692 t["breve"] = 333; 65693 t["dotaccent"] = 333; 65694 t["dieresis"] = 333; 65695 t["ring"] = 333; 65696 t["cedilla"] = 333; 65697 t["hungarumlaut"] = 333; 65698 t["ogonek"] = 333; 65699 t["caron"] = 333; 65700 t["emdash"] = 1000; 65701 t["AE"] = 1000; 65702 t["ordfeminine"] = 370; 65703 t["Lslash"] = 611; 65704 t["Oslash"] = 778; 65705 t["OE"] = 1000; 65706 t["ordmasculine"] = 365; 65707 t["ae"] = 889; 65708 t["dotlessi"] = 278; 65709 t["lslash"] = 278; 65710 t["oslash"] = 611; 65711 t["oe"] = 944; 65712 t["germandbls"] = 611; 65713 t["Idieresis"] = 278; 65714 t["eacute"] = 556; 65715 t["abreve"] = 556; 65716 t["uhungarumlaut"] = 611; 65717 t["ecaron"] = 556; 65718 t["Ydieresis"] = 667; 65719 t["divide"] = 584; 65720 t["Yacute"] = 667; 65721 t["Acircumflex"] = 722; 65722 t["aacute"] = 556; 65723 t["Ucircumflex"] = 722; 65724 t["yacute"] = 556; 65725 t["scommaaccent"] = 556; 65726 t["ecircumflex"] = 556; 65727 t["Uring"] = 722; 65728 t["Udieresis"] = 722; 65729 t["aogonek"] = 556; 65730 t["Uacute"] = 722; 65731 t["uogonek"] = 611; 65732 t["Edieresis"] = 667; 65733 t["Dcroat"] = 722; 65734 t["commaaccent"] = 250; 65735 t["copyright"] = 737; 65736 t["Emacron"] = 667; 65737 t["ccaron"] = 556; 65738 t["aring"] = 556; 65739 t["Ncommaaccent"] = 722; 65740 t["lacute"] = 278; 65741 t["agrave"] = 556; 65742 t["Tcommaaccent"] = 611; 65743 t["Cacute"] = 722; 65744 t["atilde"] = 556; 65745 t["Edotaccent"] = 667; 65746 t["scaron"] = 556; 65747 t["scedilla"] = 556; 65748 t["iacute"] = 278; 65749 t["lozenge"] = 494; 65750 t["Rcaron"] = 722; 65751 t["Gcommaaccent"] = 778; 65752 t["ucircumflex"] = 611; 65753 t["acircumflex"] = 556; 65754 t["Amacron"] = 722; 65755 t["rcaron"] = 389; 65756 t["ccedilla"] = 556; 65757 t["Zdotaccent"] = 611; 65758 t["Thorn"] = 667; 65759 t["Omacron"] = 778; 65760 t["Racute"] = 722; 65761 t["Sacute"] = 667; 65762 t["dcaron"] = 743; 65763 t["Umacron"] = 722; 65764 t["uring"] = 611; 65765 t["threesuperior"] = 333; 65766 t["Ograve"] = 778; 65767 t["Agrave"] = 722; 65768 t["Abreve"] = 722; 65769 t["multiply"] = 584; 65770 t["uacute"] = 611; 65771 t["Tcaron"] = 611; 65772 t["partialdiff"] = 494; 65773 t["ydieresis"] = 556; 65774 t["Nacute"] = 722; 65775 t["icircumflex"] = 278; 65776 t["Ecircumflex"] = 667; 65777 t["adieresis"] = 556; 65778 t["edieresis"] = 556; 65779 t["cacute"] = 556; 65780 t["nacute"] = 611; 65781 t["umacron"] = 611; 65782 t["Ncaron"] = 722; 65783 t["Iacute"] = 278; 65784 t["plusminus"] = 584; 65785 t["brokenbar"] = 280; 65786 t["registered"] = 737; 65787 t["Gbreve"] = 778; 65788 t["Idotaccent"] = 278;
65789 t["summation"] = 600; 65790 t["Egrave"] = 667; 65791 t["racute"] = 389; 65792 t["omacron"] = 611; 65793 t["Zacute"] = 611; 65794 t["Zcaron"] = 611; 65795 t["greaterequal"] = 549; 65796 t["Eth"] = 722; 65797 t["Ccedilla"] = 722; 65798 t["lcommaaccent"] = 278; 65799 t["tcaron"] = 389; 65800 t["eogonek"] = 556; 65801 t["Uogonek"] = 722; 65802 t["Aacute"] = 722; 65803 t["Adieresis"] = 722; 65804 t["egrave"] = 556; 65805 t["zacute"] = 500; 65806 t["iogonek"] = 278; 65807 t["Oacute"] = 778; 65808 t["oacute"] = 611; 65809 t["amacron"] = 556; 65810 t["sacute"] = 556; 65811 t["idieresis"] = 278; 65812 t["Ocircumflex"] = 778; 65813 t["Ugrave"] = 722; 65814 t["Delta"] = 612; 65815 t["thorn"] = 611; 65816 t["twosuperior"] = 333; 65817 t["Odieresis"] = 778; 65818 t["mu"] = 611; 65819 t["igrave"] = 278; 65820 t["ohungarumlaut"] = 611; 65821 t["Eogonek"] = 667; 65822 t["dcroat"] = 611; 65823 t["threequarters"] = 834; 65824 t["Scedilla"] = 667; 65825 t["lcaron"] = 400; 65826 t["Kcommaaccent"] = 722; 65827 t["Lacute"] = 611; 65828 t["trademark"] = 1000; 65829 t["edotaccent"] = 556; 65830 t["Igrave"] = 278; 65831 t["Imacron"] = 278; 65832 t["Lcaron"] = 611; 65833 t["onehalf"] = 834; 65834 t["lessequal"] = 549; 65835 t["ocircumflex"] = 611; 65836 t["ntilde"] = 611; 65837 t["Uhungarumlaut"] = 722; 65838 t["Eacute"] = 667; 65839 t["emacron"] = 556; 65840 t["gbreve"] = 611; 65841 t["onequarter"] = 834; 65842 t["Scaron"] = 667; 65843 t["Scommaaccent"] = 667; 65844 t["Ohungarumlaut"] = 778; 65845 t["degree"] = 400; 65846 t["ograve"] = 611; 65847 t["Ccaron"] = 722; 65848 t["ugrave"] = 611; 65849 t["radical"] = 549; 65850 t["Dcaron"] = 722; 65851 t["rcommaaccent"] = 389; 65852 t["Ntilde"] = 722; 65853 t["otilde"] = 611; 65854 t["Rcommaaccent"] = 722; 65855 t["Lcommaaccent"] = 611; 65856 t["Atilde"] = 722; 65857 t["Aogonek"] = 722; 65858 t["Aring"] = 722; 65859 t["Otilde"] = 778; 65860 t["zdotaccent"] = 500; 65861 t["Ecaron"] = 667; 65862 t["Iogonek"] = 278; 65863 t["kcommaaccent"] = 556; 65864 t["minus"] = 584; 65865 t["Icircumflex"] = 278; 65866 t["ncaron"] = 611; 65867 t["tcommaaccent"] = 333; 65868 t["logicalnot"] = 584; 65869 t["odieresis"] = 611; 65870 t["udieresis"] = 611; 65871 t["notequal"] = 549; 65872 t["gcommaaccent"] = 611; 65873 t["eth"] = 611; 65874 t["zcaron"] = 500; 65875 t["ncommaaccent"] = 611; 65876 t["onesuperior"] = 333; 65877 t["imacron"] = 278; 65878 t["Euro"] = 556; 65879 }); 65880 t["Helvetica-BoldOblique"] = (0, _core_utils.getLookupTableFactory)(function (t) { 65881 t["space"] = 278; 65882 t["exclam"] = 333; 65883 t["quotedbl"] = 474; 65884 t["numbersign"] = 556; 65885 t["dollar"] = 556; 65886 t["percent"] = 889; 65887 t["ampersand"] = 722; 65888 t["quoteright"] = 278; 65889 t["parenleft"] = 333; 65890 t["parenright"] = 333; 65891 t["asterisk"] = 389; 65892 t["plus"] = 584; 65893 t["comma"] = 278; 65894 t["hyphen"] = 333; 65895 t["period"] = 278; 65896 t["slash"] = 278; 65897 t["zero"] = 556; 65898 t["one"] = 556; 65899 t["two"] = 556; 65900 t["three"] = 556; 65901 t["four"] = 556; 65902 t["five"] = 556; 65903 t["six"] = 556; 65904 t["seven"] = 556; 65905 t["eight"] = 556; 65906 t["nine"] = 556; 65907 t["colon"] = 333; 65908 t["semicolon"] = 333; 65909 t["less"] = 584; 65910 t["equal"] = 584; 65911 t["greater"] = 584; 65912 t["question"] = 611; 65913 t["at"] = 975; 65914 t["A"] = 722; 65915 t["B"] = 722; 65916 t["C"] = 722; 65917 t["D"] = 722; 65918 t["E"] = 667; 65919 t["F"] = 611; 65920 t["G"] = 778; 65921 t["H"] = 722;
65922 t["I"] = 278; 65923 t["J"] = 556; 65924 t["K"] = 722; 65925 t["L"] = 611; 65926 t["M"] = 833; 65927 t["N"] = 722; 65928 t["O"] = 778; 65929 t["P"] = 667; 65930 t["Q"] = 778; 65931 t["R"] = 722; 65932 t["S"] = 667; 65933 t["T"] = 611; 65934 t["U"] = 722; 65935 t["V"] = 667; 65936 t["W"] = 944; 65937 t["X"] = 667; 65938 t["Y"] = 667; 65939 t["Z"] = 611; 65940 t["bracketleft"] = 333; 65941 t["backslash"] = 278; 65942 t["bracketright"] = 333; 65943 t["asciicircum"] = 584; 65944 t["underscore"] = 556; 65945 t["quoteleft"] = 278; 65946 t["a"] = 556; 65947 t["b"] = 611; 65948 t["c"] = 556; 65949 t["d"] = 611; 65950 t["e"] = 556; 65951 t["f"] = 333; 65952 t["g"] = 611; 65953 t["h"] = 611; 65954 t["i"] = 278; 65955 t["j"] = 278; 65956 t["k"] = 556; 65957 t["l"] = 278; 65958 t["m"] = 889; 65959 t["n"] = 611; 65960 t["o"] = 611; 65961 t["p"] = 611; 65962 t["q"] = 611; 65963 t["r"] = 389; 65964 t["s"] = 556; 65965 t["t"] = 333; 65966 t["u"] = 611; 65967 t["v"] = 556; 65968 t["w"] = 778; 65969 t["x"] = 556; 65970 t["y"] = 556; 65971 t["z"] = 500; 65972 t["braceleft"] = 389; 65973 t["bar"] = 280; 65974 t["braceright"] = 389; 65975 t["asciitilde"] = 584; 65976 t["exclamdown"] = 333; 65977 t["cent"] = 556; 65978 t["sterling"] = 556; 65979 t["fraction"] = 167; 65980 t["yen"] = 556; 65981 t["florin"] = 556; 65982 t["section"] = 556; 65983 t["currency"] = 556; 65984 t["quotesingle"] = 238; 65985 t["quotedblleft"] = 500; 65986 t["guillemotleft"] = 556; 65987 t["guilsinglleft"] = 333; 65988 t["guilsinglright"] = 333; 65989 t["fi"] = 611; 65990 t["fl"] = 611; 65991 t["endash"] = 556; 65992 t["dagger"] = 556; 65993 t["daggerdbl"] = 556; 65994 t["periodcentered"] = 278; 65995 t["paragraph"] = 556; 65996 t["bullet"] = 350; 65997 t["quotesinglbase"] = 278; 65998 t["quotedblbase"] = 500; 65999 t["quotedblright"] = 500; 66000 t["guillemotright"] = 556; 66001 t["ellipsis"] = 1000; 66002 t["perthousand"] = 1000; 66003 t["questiondown"] = 611; 66004 t["grave"] = 333; 66005 t["acute"] = 333; 66006 t["circumflex"] = 333; 66007 t["tilde"] = 333; 66008 t["macron"] = 333; 66009 t["breve"] = 333; 66010 t["dotaccent"] = 333; 66011 t["dieresis"] = 333; 66012 t["ring"] = 333; 66013 t["cedilla"] = 333; 66014 t["hungarumlaut"] = 333; 66015 t["ogonek"] = 333; 66016 t["caron"] = 333; 66017 t["emdash"] = 1000; 66018 t["AE"] = 1000; 66019 t["ordfeminine"] = 370; 66020 t["Lslash"] = 611; 66021 t["Oslash"] = 778; 66022 t["OE"] = 1000; 66023 t["ordmasculine"] = 365; 66024 t["ae"] = 889; 66025 t["dotlessi"] = 278; 66026 t["lslash"] = 278; 66027 t["oslash"] = 611; 66028 t["oe"] = 944; 66029 t["germandbls"] = 611; 66030 t["Idieresis"] = 278; 66031 t["eacute"] = 556; 66032 t["abreve"] = 556; 66033 t["uhungarumlaut"] = 611; 66034 t["ecaron"] = 556; 66035 t["Ydieresis"] = 667; 66036 t["divide"] = 584; 66037 t["Yacute"] = 667; 66038 t["Acircumflex"] = 722; 66039 t["aacute"] = 556; 66040 t["Ucircumflex"] = 722; 66041 t["yacute"] = 556; 66042 t["scommaaccent"] = 556; 66043 t["ecircumflex"] = 556; 66044 t["Uring"] = 722; 66045 t["Udieresis"] = 722; 66046 t["aogonek"] = 556; 66047 t["Uacute"] = 722; 66048 t["uogonek"] = 611; 66049 t["Edieresis"] = 667; 66050 t["Dcroat"] = 722; 66051 t["commaaccent"] = 250; 66052 t["copyright"] = 737; 66053 t["Emacron"] = 667; 66054 t["ccaron"] = 556; 66055 t["aring"] = 556; 66056 t["Ncommaaccent"] = 722; 66057 t["lacute"] = 278; 66058 t["agrave"] = 556; 66059 t["Tcommaaccent"] = 611; 66060 t["Cacute"] = 722; 66061 t["atilde"] = 556; 66062 t["Edotaccent"] = 667; 66063 t["scaron"] = 556; 66064 t["scedilla"] = 556; 66065 t["iacute"] = 278; 66066 t["lozenge"] = 494; 66067 t["Rcaron"] = 722; 66068 t["Gcommaaccent"] = 778; 66069 t["ucircumflex"] = 611; 66070 t["acircumflex"] = 556; 66071 t["Amacron"] = 722; 66072 t["rcaron"] = 389; 66073 t["ccedilla"] = 556; 66074 t["Zdotaccent"] = 611; 66075 t["Thorn"] = 667; 66076 t["Omacron"] = 778; 66077 t["Racute"] = 722; 66078 t["Sacute"] = 667; 66079 t["dcaron"] = 743; 66080 t["Umacron"] = 722; 66081 t["uring"] = 611; 66082 t["threesuperior"] = 333; 66083 t["Ograve"] = 778; 66084 t["Agrave"] = 722; 66085 t["Abreve"] = 722; 66086 t["multiply"] = 584; 66087 t["uacute"] = 611; 66088 t["Tcaron"] = 611; 66089 t["partialdiff"] = 494; 66090 t["ydieresis"] = 556; 66091 t["Nacute"] = 722; 66092 t["icircumflex"] = 278; 66093 t["Ecircumflex"] = 667; 66094 t["adieresis"] = 556; 66095 t["edieresis"] = 556; 66096 t["cacute"] = 556; 66097 t["nacute"] = 611; 66098 t["umacron"] = 611; 66099 t["Ncaron"] = 722; 66100 t["Iacute"] = 278; 66101 t["plusminus"] = 584; 66102 t["brokenbar"] = 280; 66103 t["registered"] = 737; 66104 t["Gbreve"] = 778; 66105 t["Idotaccent"] = 278;
66106 t["summation"] = 600; 66107 t["Egrave"] = 667; 66108 t["racute"] = 389; 66109 t["omacron"] = 611; 66110 t["Zacute"] = 611; 66111 t["Zcaron"] = 611; 66112 t["greaterequal"] = 549; 66113 t["Eth"] = 722; 66114 t["Ccedilla"] = 722; 66115 t["lcommaaccent"] = 278; 66116 t["tcaron"] = 389; 66117 t["eogonek"] = 556; 66118 t["Uogonek"] = 722; 66119 t["Aacute"] = 722; 66120 t["Adieresis"] = 722; 66121 t["egrave"] = 556; 66122 t["zacute"] = 500; 66123 t["iogonek"] = 278; 66124 t["Oacute"] = 778; 66125 t["oacute"] = 611; 66126 t["amacron"] = 556; 66127 t["sacute"] = 556; 66128 t["idieresis"] = 278; 66129 t["Ocircumflex"] = 778; 66130 t["Ugrave"] = 722; 66131 t["Delta"] = 612; 66132 t["thorn"] = 611; 66133 t["twosuperior"] = 333; 66134 t["Odieresis"] = 778; 66135 t["mu"] = 611; 66136 t["igrave"] = 278; 66137 t["ohungarumlaut"] = 611; 66138 t["Eogonek"] = 667; 66139 t["dcroat"] = 611; 66140 t["threequarters"] = 834; 66141 t["Scedilla"] = 667; 66142 t["lcaron"] = 400; 66143 t["Kcommaaccent"] = 722; 66144 t["Lacute"] = 611; 66145 t["trademark"] = 1000; 66146 t["edotaccent"] = 556; 66147 t["Igrave"] = 278; 66148 t["Imacron"] = 278; 66149 t["Lcaron"] = 611; 66150 t["onehalf"] = 834; 66151 t["lessequal"] = 549; 66152 t["ocircumflex"] = 611; 66153 t["ntilde"] = 611; 66154 t["Uhungarumlaut"] = 722; 66155 t["Eacute"] = 667; 66156 t["emacron"] = 556; 66157 t["gbreve"] = 611; 66158 t["onequarter"] = 834; 66159 t["Scaron"] = 667; 66160 t["Scommaaccent"] = 667; 66161 t["Ohungarumlaut"] = 778; 66162 t["degree"] = 400; 66163 t["ograve"] = 611; 66164 t["Ccaron"] = 722; 66165 t["ugrave"] = 611; 66166 t["radical"] = 549; 66167 t["Dcaron"] = 722; 66168 t["rcommaaccent"] = 389; 66169 t["Ntilde"] = 722; 66170 t["otilde"] = 611; 66171 t["Rcommaaccent"] = 722; 66172 t["Lcommaaccent"] = 611; 66173 t["Atilde"] = 722; 66174 t["Aogonek"] = 722; 66175 t["Aring"] = 722; 66176 t["Otilde"] = 778; 66177 t["zdotaccent"] = 500; 66178 t["Ecaron"] = 667; 66179 t["Iogonek"] = 278; 66180 t["kcommaaccent"] = 556; 66181 t["minus"] = 584; 66182 t["Icircumflex"] = 278; 66183 t["ncaron"] = 611; 66184 t["tcommaaccent"] = 333; 66185 t["logicalnot"] = 584; 66186 t["odieresis"] = 611; 66187 t["udieresis"] = 611; 66188 t["notequal"] = 549; 66189 t["gcommaaccent"] = 611; 66190 t["eth"] = 611; 66191 t["zcaron"] = 500; 66192 t["ncommaaccent"] = 611; 66193 t["onesuperior"] = 333; 66194 t["imacron"] = 278; 66195 t["Euro"] = 556; 66196 }); 66197 t["Helvetica-Oblique"] = (0, _core_utils.getLookupTableFactory)(function (t) { 66198 t["space"] = 278; 66199 t["exclam"] = 278; 66200 t["quotedbl"] = 355; 66201 t["numbersign"] = 556; 66202 t["dollar"] = 556; 66203 t["percent"] = 889; 66204 t["ampersand"] = 667; 66205 t["quoteright"] = 222; 66206 t["parenleft"] = 333; 66207 t["parenright"] = 333; 66208 t["asterisk"] = 389; 66209 t["plus"] = 584; 66210 t["comma"] = 278; 66211 t["hyphen"] = 333; 66212 t["period"] = 278; 66213 t["slash"] = 278; 66214 t["zero"] = 556; 66215 t["one"] = 556; 66216 t["two"] = 556; 66217 t["three"] = 556; 66218 t["four"] = 556; 66219 t["five"] = 556; 66220 t["six"] = 556; 66221 t["seven"] = 556; 66222 t["eight"] = 556; 66223 t["nine"] = 556; 66224 t["colon"] = 278; 66225 t["semicolon"] = 278; 66226 t["less"] = 584; 66227 t["equal"] = 584; 66228 t["greater"] = 584; 66229 t["question"] = 556; 66230 t["at"] = 1015; 66231 t["A"] = 667; 66232 t["B"] = 667; 66233 t["C"] = 722; 66234 t["D"] = 722; 66235 t["E"] = 667; 66236 t["F"] = 611; 66237 t["G"] = 778; 66238 t["H"] = 722;
66239 t["I"] = 278; 66240 t["J"] = 500; 66241 t["K"] = 667; 66242 t["L"] = 556; 66243 t["M"] = 833; 66244 t["N"] = 722; 66245 t["O"] = 778; 66246 t["P"] = 667; 66247 t["Q"] = 778; 66248 t["R"] = 722; 66249 t["S"] = 667; 66250 t["T"] = 611; 66251 t["U"] = 722; 66252 t["V"] = 667; 66253 t["W"] = 944; 66254 t["X"] = 667; 66255 t["Y"] = 667; 66256 t["Z"] = 611; 66257 t["bracketleft"] = 278; 66258 t["backslash"] = 278; 66259 t["bracketright"] = 278; 66260 t["asciicircum"] = 469; 66261 t["underscore"] = 556; 66262 t["quoteleft"] = 222; 66263 t["a"] = 556; 66264 t["b"] = 556; 66265 t["c"] = 500; 66266 t["d"] = 556; 66267 t["e"] = 556; 66268 t["f"] = 278; 66269 t["g"] = 556; 66270 t["h"] = 556; 66271 t["i"] = 222; 66272 t["j"] = 222; 66273 t["k"] = 500; 66274 t["l"] = 222; 66275 t["m"] = 833; 66276 t["n"] = 556; 66277 t["o"] = 556; 66278 t["p"] = 556; 66279 t["q"] = 556; 66280 t["r"] = 333; 66281 t["s"] = 500; 66282 t["t"] = 278; 66283 t["u"] = 556; 66284 t["v"] = 500; 66285 t["w"] = 722; 66286 t["x"] = 500; 66287 t["y"] = 500; 66288 t["z"] = 500; 66289 t["braceleft"] = 334; 66290 t["bar"] = 260; 66291 t["braceright"] = 334; 66292 t["asciitilde"] = 584; 66293 t["exclamdown"] = 333; 66294 t["cent"] = 556; 66295 t["sterling"] = 556; 66296 t["fraction"] = 167; 66297 t["yen"] = 556; 66298 t["florin"] = 556; 66299 t["section"] = 556; 66300 t["currency"] = 556; 66301 t["quotesingle"] = 191; 66302 t["quotedblleft"] = 333; 66303 t["guillemotleft"] = 556; 66304 t["guilsinglleft"] = 333; 66305 t["guilsinglright"] = 333; 66306 t["fi"] = 500; 66307 t["fl"] = 500; 66308 t["endash"] = 556; 66309 t["dagger"] = 556; 66310 t["daggerdbl"] = 556; 66311 t["periodcentered"] = 278; 66312 t["paragraph"] = 537; 66313 t["bullet"] = 350; 66314 t["quotesinglbase"] = 222; 66315 t["quotedblbase"] = 333; 66316 t["quotedblright"] = 333; 66317 t["guillemotright"] = 556; 66318 t["ellipsis"] = 1000; 66319 t["perthousand"] = 1000; 66320 t["questiondown"] = 611; 66321 t["grave"] = 333; 66322 t["acute"] = 333; 66323 t["circumflex"] = 333; 66324 t["tilde"] = 333; 66325 t["macron"] = 333; 66326 t["breve"] = 333; 66327 t["dotaccent"] = 333; 66328 t["dieresis"] = 333; 66329 t["ring"] = 333; 66330 t["cedilla"] = 333; 66331 t["hungarumlaut"] = 333; 66332 t["ogonek"] = 333; 66333 t["caron"] = 333; 66334 t["emdash"] = 1000; 66335 t["AE"] = 1000; 66336 t["ordfeminine"] = 370; 66337 t["Lslash"] = 556; 66338 t["Oslash"] = 778; 66339 t["OE"] = 1000; 66340 t["ordmasculine"] = 365; 66341 t["ae"] = 889; 66342 t["dotlessi"] = 278; 66343 t["lslash"] = 222; 66344 t["oslash"] = 611; 66345 t["oe"] = 944; 66346 t["germandbls"] = 611; 66347 t["Idieresis"] = 278; 66348 t["eacute"] = 556; 66349 t["abreve"] = 556; 66350 t["uhungarumlaut"] = 556; 66351 t["ecaron"] = 556; 66352 t["Ydieresis"] = 667; 66353 t["divide"] = 584; 66354 t["Yacute"] = 667; 66355 t["Acircumflex"] = 667; 66356 t["aacute"] = 556; 66357 t["Ucircumflex"] = 722; 66358 t["yacute"] = 500; 66359 t["scommaaccent"] = 500; 66360 t["ecircumflex"] = 556; 66361 t["Uring"] = 722; 66362 t["Udieresis"] = 722; 66363 t["aogonek"] = 556; 66364 t["Uacute"] = 722; 66365 t["uogonek"] = 556; 66366 t["Edieresis"] = 667; 66367 t["Dcroat"] = 722; 66368 t["commaaccent"] = 250; 66369 t["copyright"] = 737; 66370 t["Emacron"] = 667; 66371 t["ccaron"] = 500; 66372 t["aring"] = 556; 66373 t["Ncommaaccent"] = 722; 66374 t["lacute"] = 222; 66375 t["agrave"] = 556; 66376 t["Tcommaaccent"] = 611; 66377 t["Cacute"] = 722; 66378 t["atilde"] = 556; 66379 t["Edotaccent"] = 667; 66380 t["scaron"] = 500; 66381 t["scedilla"] = 500; 66382 t["iacute"] = 278; 66383 t["lozenge"] = 471; 66384 t["Rcaron"] = 722; 66385 t["Gcommaaccent"] = 778; 66386 t["ucircumflex"] = 556; 66387 t["acircumflex"] = 556; 66388 t["Amacron"] = 667; 66389 t["rcaron"] = 333; 66390 t["ccedilla"] = 500; 66391 t["Zdotaccent"] = 611; 66392 t["Thorn"] = 667; 66393 t["Omacron"] = 778; 66394 t["Racute"] = 722; 66395 t["Sacute"] = 667; 66396 t["dcaron"] = 643; 66397 t["Umacron"] = 722; 66398 t["uring"] = 556; 66399 t["threesuperior"] = 333; 66400 t["Ograve"] = 778; 66401 t["Agrave"] = 667; 66402 t["Abreve"] = 667; 66403 t["multiply"] = 584; 66404 t["uacute"] = 556; 66405 t["Tcaron"] = 611; 66406 t["partialdiff"] = 476; 66407 t["ydieresis"] = 500; 66408 t["Nacute"] = 722; 66409 t["icircumflex"] = 278; 66410 t["Ecircumflex"] = 667; 66411 t["adieresis"] = 556; 66412 t["edieresis"] = 556; 66413 t["cacute"] = 500; 66414 t["nacute"] = 556; 66415 t["umacron"] = 556; 66416 t["Ncaron"] = 722; 66417 t["Iacute"] = 278; 66418 t["plusminus"] = 584; 66419 t["brokenbar"] = 260; 66420 t["registered"] = 737; 66421 t["Gbreve"] = 778; 66422 t["Idotaccent"] = 278;
66423 t["summation"] = 600; 66424 t["Egrave"] = 667; 66425 t["racute"] = 333; 66426 t["omacron"] = 556; 66427 t["Zacute"] = 611; 66428 t["Zcaron"] = 611; 66429 t["greaterequal"] = 549; 66430 t["Eth"] = 722; 66431 t["Ccedilla"] = 722; 66432 t["lcommaaccent"] = 222; 66433 t["tcaron"] = 317; 66434 t["eogonek"] = 556; 66435 t["Uogonek"] = 722; 66436 t["Aacute"] = 667; 66437 t["Adieresis"] = 667; 66438 t["egrave"] = 556; 66439 t["zacute"] = 500; 66440 t["iogonek"] = 222; 66441 t["Oacute"] = 778; 66442 t["oacute"] = 556; 66443 t["amacron"] = 556; 66444 t["sacute"] = 500; 66445 t["idieresis"] = 278; 66446 t["Ocircumflex"] = 778; 66447 t["Ugrave"] = 722; 66448 t["Delta"] = 612; 66449 t["thorn"] = 556; 66450 t["twosuperior"] = 333; 66451 t["Odieresis"] = 778; 66452 t["mu"] = 556; 66453 t["igrave"] = 278; 66454 t["ohungarumlaut"] = 556; 66455 t["Eogonek"] = 667; 66456 t["dcroat"] = 556; 66457 t["threequarters"] = 834; 66458 t["Scedilla"] = 667; 66459 t["lcaron"] = 299; 66460 t["Kcommaaccent"] = 667; 66461 t["Lacute"] = 556; 66462 t["trademark"] = 1000; 66463 t["edotaccent"] = 556; 66464 t["Igrave"] = 278; 66465 t["Imacron"] = 278; 66466 t["Lcaron"] = 556; 66467 t["onehalf"] = 834; 66468 t["lessequal"] = 549; 66469 t["ocircumflex"] = 556; 66470 t["ntilde"] = 556; 66471 t["Uhungarumlaut"] = 722; 66472 t["Eacute"] = 667; 66473 t["emacron"] = 556; 66474 t["gbreve"] = 556; 66475 t["onequarter"] = 834; 66476 t["Scaron"] = 667; 66477 t["Scommaaccent"] = 667; 66478 t["Ohungarumlaut"] = 778; 66479 t["degree"] = 400; 66480 t["ograve"] = 556; 66481 t["Ccaron"] = 722; 66482 t["ugrave"] = 556; 66483 t["radical"] = 453; 66484 t["Dcaron"] = 722; 66485 t["rcommaaccent"] = 333; 66486 t["Ntilde"] = 722; 66487 t["otilde"] = 556; 66488 t["Rcommaaccent"] = 722; 66489 t["Lcommaaccent"] = 556; 66490 t["Atilde"] = 667; 66491 t["Aogonek"] = 667; 66492 t["Aring"] = 667; 66493 t["Otilde"] = 778; 66494 t["zdotaccent"] = 500; 66495 t["Ecaron"] = 667; 66496 t["Iogonek"] = 278; 66497 t["kcommaaccent"] = 500; 66498 t["minus"] = 584; 66499 t["Icircumflex"] = 278; 66500 t["ncaron"] = 556; 66501 t["tcommaaccent"] = 278; 66502 t["logicalnot"] = 584; 66503 t["odieresis"] = 556; 66504 t["udieresis"] = 556; 66505 t["notequal"] = 549; 66506 t["gcommaaccent"] = 556; 66507 t["eth"] = 556; 66508 t["zcaron"] = 500; 66509 t["ncommaaccent"] = 556; 66510 t["onesuperior"] = 333; 66511 t["imacron"] = 278; 66512 t["Euro"] = 556; 66513 }); 66514 t["Symbol"] = (0, _core_utils.getLookupTableFactory)(function (t) { 66515 t["space"] = 250; 66516 t["exclam"] = 333; 66517 t["universal"] = 713; 66518 t["numbersign"] = 500; 66519 t["existential"] = 549; 66520 t["percent"] = 833; 66521 t["ampersand"] = 778; 66522 t["suchthat"] = 439; 66523 t["parenleft"] = 333; 66524 t["parenright"] = 333; 66525 t["asteriskmath"] = 500; 66526 t["plus"] = 549; 66527 t["comma"] = 250; 66528 t["minus"] = 549; 66529 t["period"] = 250; 66530 t["slash"] = 278; 66531 t["zero"] = 500; 66532 t["one"] = 500; 66533 t["two"] = 500; 66534 t["three"] = 500; 66535 t["four"] = 500; 66536 t["five"] = 500; 66537 t["six"] = 500; 66538 t["seven"] = 500; 66539 t["eight"] = 500; 66540 t["nine"] = 500; 66541 t["colon"] = 278; 66542 t["semicolon"] = 278; 66543 t["less"] = 549; 66544 t["equal"] = 549; 66545 t["greater"] = 549; 66546 t["question"] = 444; 66547 t["congruent"] = 549; 66548 t["Alpha"] = 722; 66549 t["Beta"] = 667; 66550 t["Chi"] = 722; 66551 t["Delta"] = 612; 66552 t["Epsilon"] = 611; 66553 t["Phi"] = 763; 66554 t["Gamma"] = 603; 66555 t["Eta"] = 722; 66556 t["Iota"] = 333; 66557 t["theta1"] = 631; 66558 t["Kappa"] = 722; 66559 t["Lambda"] = 686; 66560 t["Mu"] = 889; 66561 t["Nu"] = 722; 66562 t["Omicron"] = 722; 66563 t["Pi"] = 768; 66564 t["Theta"] = 741; 66565 t["Rho"] = 556; 66566 t["Sigma"] = 592; 66567 t["Tau"] = 611; 66568 t["Upsilon"] = 690; 66569 t["sigma1"] = 439; 66570 t["Omega"] = 768; 66571 t["Xi"] = 645; 66572 t["Psi"] = 795; 66573 t["Zeta"] = 611; 66574 t["bracketleft"] = 333; 66575 t["therefore"] = 863; 66576 t["bracketright"] = 333; 66577 t["perpendicular"] = 658; 66578 t["underscore"] = 500; 66579 t["radicalex"] = 500; 66580 t["alpha"] = 631; 66581 t["beta"] = 549; 66582 t["chi"] = 549; 66583 t["delta"] = 494; 66584 t["epsilon"] = 439; 66585 t["phi"] = 521; 66586 t["gamma"] = 411; 66587 t["eta"] = 603; 66588 t["iota"] = 329; 66589 t["phi1"] = 603; 66590 t["kappa"] = 549; 66591 t["lambda"] = 549; 66592 t["mu"] = 576; 66593 t["nu"] = 521;
66594 t["omicron"] = 549; 66595 t["pi"] = 549; 66596 t["theta"] = 521; 66597 t["rho"] = 549; 66598 t["sigma"] = 603; 66599 t["tau"] = 439; 66600 t["upsilon"] = 576; 66601 t["omega1"] = 713; 66602 t["omega"] = 686; 66603 t["xi"] = 493; 66604 t["psi"] = 686; 66605 t["zeta"] = 494; 66606 t["braceleft"] = 480; 66607 t["bar"] = 200; 66608 t["braceright"] = 480; 66609 t["similar"] = 549; 66610 t["Euro"] = 750; 66611 t["Upsilon1"] = 620; 66612 t["minute"] = 247; 66613 t["lessequal"] = 549; 66614 t["fraction"] = 167; 66615 t["infinity"] = 713; 66616 t["florin"] = 500; 66617 t["club"] = 753; 66618 t["diamond"] = 753; 66619 t["heart"] = 753; 66620 t["spade"] = 753; 66621 t["arrowboth"] = 1042; 66622 t["arrowleft"] = 987; 66623 t["arrowup"] = 603; 66624 t["arrowright"] = 987; 66625 t["arrowdown"] = 603; 66626 t["degree"] = 400; 66627 t["plusminus"] = 549; 66628 t["second"] = 411; 66629 t["greaterequal"] = 549; 66630 t["multiply"] = 549; 66631 t["proportional"] = 713; 66632 t["partialdiff"] = 494; 66633 t["bullet"] = 460; 66634 t["divide"] = 549; 66635 t["notequal"] = 549; 66636 t["equivalence"] = 549; 66637 t["approxequal"] = 549; 66638 t["ellipsis"] = 1000; 66639 t["arrowvertex"] = 603; 66640 t["arrowhorizex"] = 1000; 66641 t["carriagereturn"] = 658; 66642 t["aleph"] = 823; 66643 t["Ifraktur"] = 686; 66644 t["Rfraktur"] = 795; 66645 t["weierstrass"] = 987; 66646 t["circlemultiply"] = 768; 66647 t["circleplus"] = 768; 66648 t["emptyset"] = 823; 66649 t["intersection"] = 768; 66650 t["union"] = 768; 66651 t["propersuperset"] = 713; 66652 t["reflexsuperset"] = 713; 66653 t["notsubset"] = 713; 66654 t["propersubset"] = 713; 66655 t["reflexsubset"] = 713; 66656 t["element"] = 713; 66657 t["notelement"] = 713; 66658 t["angle"] = 768; 66659 t["gradient"] = 713; 66660 t["registerserif"] = 790; 66661 t["copyrightserif"] = 790; 66662 t["trademarkserif"] = 890; 66663 t["product"] = 823; 66664 t["radical"] = 549; 66665 t["dotmath"] = 250; 66666 t["logicalnot"] = 713; 66667 t["logicaland"] = 603; 66668 t["logicalor"] = 603; 66669 t["arrowdblboth"] = 1042; 66670 t["arrowdblleft"] = 987; 66671 t["arrowdblup"] = 603; 66672 t["arrowdblright"] = 987; 66673 t["arrowdbldown"] = 603; 66674 t["lozenge"] = 494; 66675 t["angleleft"] = 329; 66676 t["registersans"] = 790; 66677 t["copyrightsans"] = 790; 66678 t["trademarksans"] = 786; 66679 t["summation"] = 713; 66680 t["parenlefttp"] = 384; 66681 t["parenleftex"] = 384; 66682 t["parenleftbt"] = 384; 66683 t["bracketlefttp"] = 384; 66684 t["bracketleftex"] = 384; 66685 t["bracketleftbt"] = 384; 66686 t["bracelefttp"] = 494; 66687 t["braceleftmid"] = 494; 66688 t["braceleftbt"] = 494; 66689 t["braceex"] = 494; 66690 t["angleright"] = 329; 66691 t["integral"] = 274; 66692 t["integraltp"] = 686; 66693 t["integralex"] = 686; 66694 t["integralbt"] = 686; 66695 t["parenrighttp"] = 384; 66696 t["parenrightex"] = 384; 66697 t["parenrightbt"] = 384; 66698 t["bracketrighttp"] = 384; 66699 t["bracketrightex"] = 384; 66700 t["bracketrightbt"] = 384; 66701 t["bracerighttp"] = 494; 66702 t["bracerightmid"] = 494; 66703 t["bracerightbt"] = 494; 66704 t["apple"] = 790; 66705 }); 66706 t["Times-Roman"] = (0, _core_utils.getLookupTableFactory)(function (t) { 66707 t["space"] = 250; 66708 t["exclam"] = 333; 66709 t["quotedbl"] = 408; 66710 t["numbersign"] = 500; 66711 t["dollar"] = 500; 66712 t["percent"] = 833; 66713 t["ampersand"] = 778; 66714 t["quoteright"] = 333; 66715 t["parenleft"] = 333; 66716 t["parenright"] = 333; 66717 t["asterisk"] = 500; 66718 t["plus"] = 564; 66719 t["comma"] = 250; 66720 t["hyphen"] = 333; 66721 t["period"] = 250; 66722 t["slash"] = 278; 66723 t["zero"] = 500; 66724 t["one"] = 500; 66725 t["two"] = 500; 66726 t["three"] = 500; 66727 t["four"] = 500; 66728 t["five"] = 500; 66729 t["six"] = 500; 66730 t["seven"] = 500; 66731 t["eight"] = 500; 66732 t["nine"] = 500; 66733 t["colon"] = 278; 66734 t["semicolon"] = 278; 66735 t["less"] = 564; 66736 t["equal"] = 564; 66737 t["greater"] = 564; 66738 t["question"] = 444; 66739 t["at"] = 921; 66740 t["A"] = 722; 66741 t["B"] = 667; 66742 t["C"] = 667; 66743 t["D"] = 722; 66744 t["E"] = 611; 66745 t["F"] = 556; 66746 t["G"] = 722; 66747 t["H"] = 722;
66748 t["I"] = 333; 66749 t["J"] = 389; 66750 t["K"] = 722; 66751 t["L"] = 611; 66752 t["M"] = 889; 66753 t["N"] = 722; 66754 t["O"] = 722; 66755 t["P"] = 556; 66756 t["Q"] = 722; 66757 t["R"] = 667; 66758 t["S"] = 556; 66759 t["T"] = 611; 66760 t["U"] = 722; 66761 t["V"] = 722; 66762 t["W"] = 944; 66763 t["X"] = 722; 66764 t["Y"] = 722; 66765 t["Z"] = 611; 66766 t["bracketleft"] = 333; 66767 t["backslash"] = 278; 66768 t["bracketright"] = 333; 66769 t["asciicircum"] = 469; 66770 t["underscore"] = 500; 66771 t["quoteleft"] = 333; 66772 t["a"] = 444; 66773 t["b"] = 500; 66774 t["c"] = 444; 66775 t["d"] = 500; 66776 t["e"] = 444; 66777 t["f"] = 333; 66778 t["g"] = 500; 66779 t["h"] = 500; 66780 t["i"] = 278; 66781 t["j"] = 278; 66782 t["k"] = 500; 66783 t["l"] = 278; 66784 t["m"] = 778; 66785 t["n"] = 500; 66786 t["o"] = 500; 66787 t["p"] = 500; 66788 t["q"] = 500; 66789 t["r"] = 333; 66790 t["s"] = 389; 66791 t["t"] = 278; 66792 t["u"] = 500; 66793 t["v"] = 500; 66794 t["w"] = 722; 66795 t["x"] = 500; 66796 t["y"] = 500; 66797 t["z"] = 444; 66798 t["braceleft"] = 480; 66799 t["bar"] = 200; 66800 t["braceright"] = 480; 66801 t["asciitilde"] = 541; 66802 t["exclamdown"] = 333; 66803 t["cent"] = 500; 66804 t["sterling"] = 500; 66805 t["fraction"] = 167; 66806 t["yen"] = 500; 66807 t["florin"] = 500; 66808 t["section"] = 500; 66809 t["currency"] = 500; 66810 t["quotesingle"] = 180; 66811 t["quotedblleft"] = 444; 66812 t["guillemotleft"] = 500; 66813 t["guilsinglleft"] = 333; 66814 t["guilsinglright"] = 333; 66815 t["fi"] = 556; 66816 t["fl"] = 556; 66817 t["endash"] = 500; 66818 t["dagger"] = 500; 66819 t["daggerdbl"] = 500; 66820 t["periodcentered"] = 250; 66821 t["paragraph"] = 453; 66822 t["bullet"] = 350; 66823 t["quotesinglbase"] = 333; 66824 t["quotedblbase"] = 444; 66825 t["quotedblright"] = 444; 66826 t["guillemotright"] = 500; 66827 t["ellipsis"] = 1000; 66828 t["perthousand"] = 1000; 66829 t["questiondown"] = 444; 66830 t["grave"] = 333; 66831 t["acute"] = 333; 66832 t["circumflex"] = 333; 66833 t["tilde"] = 333; 66834 t["macron"] = 333; 66835 t["breve"] = 333; 66836 t["dotaccent"] = 333; 66837 t["dieresis"] = 333; 66838 t["ring"] = 333; 66839 t["cedilla"] = 333; 66840 t["hungarumlaut"] = 333; 66841 t["ogonek"] = 333; 66842 t["caron"] = 333; 66843 t["emdash"] = 1000; 66844 t["AE"] = 889; 66845 t["ordfeminine"] = 276; 66846 t["Lslash"] = 611; 66847 t["Oslash"] = 722; 66848 t["OE"] = 889; 66849 t["ordmasculine"] = 310; 66850 t["ae"] = 667; 66851 t["dotlessi"] = 278; 66852 t["lslash"] = 278; 66853 t["oslash"] = 500; 66854 t["oe"] = 722; 66855 t["germandbls"] = 500; 66856 t["Idieresis"] = 333; 66857 t["eacute"] = 444; 66858 t["abreve"] = 444; 66859 t["uhungarumlaut"] = 500; 66860 t["ecaron"] = 444; 66861 t["Ydieresis"] = 722; 66862 t["divide"] = 564; 66863 t["Yacute"] = 722; 66864 t["Acircumflex"] = 722; 66865 t["aacute"] = 444; 66866 t["Ucircumflex"] = 722; 66867 t["yacute"] = 500; 66868 t["scommaaccent"] = 389; 66869 t["ecircumflex"] = 444; 66870 t["Uring"] = 722; 66871 t["Udieresis"] = 722; 66872 t["aogonek"] = 444; 66873 t["Uacute"] = 722; 66874 t["uogonek"] = 500; 66875 t["Edieresis"] = 611; 66876 t["Dcroat"] = 722; 66877 t["commaaccent"] = 250; 66878 t["copyright"] = 760; 66879 t["Emacron"] = 611; 66880 t["ccaron"] = 444; 66881 t["aring"] = 444; 66882 t["Ncommaaccent"] = 722; 66883 t["lacute"] = 278; 66884 t["agrave"] = 444; 66885 t["Tcommaaccent"] = 611; 66886 t["Cacute"] = 667; 66887 t["atilde"] = 444; 66888 t["Edotaccent"] = 611; 66889 t["scaron"] = 389;
66890 t["scedilla"] = 389; 66891 t["iacute"] = 278; 66892 t["lozenge"] = 471; 66893 t["Rcaron"] = 667; 66894 t["Gcommaaccent"] = 722; 66895 t["ucircumflex"] = 500; 66896 t["acircumflex"] = 444; 66897 t["Amacron"] = 722; 66898 t["rcaron"] = 333; 66899 t["ccedilla"] = 444; 66900 t["Zdotaccent"] = 611; 66901 t["Thorn"] = 556; 66902 t["Omacron"] = 722; 66903 t["Racute"] = 667; 66904 t["Sacute"] = 556; 66905 t["dcaron"] = 588; 66906 t["Umacron"] = 722; 66907 t["uring"] = 500; 66908 t["threesuperior"] = 300; 66909 t["Ograve"] = 722; 66910 t["Agrave"] = 722; 66911 t["Abreve"] = 722; 66912 t["multiply"] = 564; 66913 t["uacute"] = 500; 66914 t["Tcaron"] = 611; 66915 t["partialdiff"] = 476; 66916 t["ydieresis"] = 500; 66917 t["Nacute"] = 722; 66918 t["icircumflex"] = 278; 66919 t["Ecircumflex"] = 611; 66920 t["adieresis"] = 444; 66921 t["edieresis"] = 444; 66922 t["cacute"] = 444; 66923 t["nacute"] = 500; 66924 t["umacron"] = 500; 66925 t["Ncaron"] = 722; 66926 t["Iacute"] = 333; 66927 t["plusminus"] = 564; 66928 t["brokenbar"] = 200; 66929 t["registered"] = 760; 66930 t["Gbreve"] = 722; 66931 t["Idotaccent"] = 333; 66932 t["summation"] = 600; 66933 t["Egrave"] = 611; 66934 t["racute"] = 333; 66935 t["omacron"] = 500; 66936 t["Zacute"] = 611; 66937 t["Zcaron"] = 611; 66938 t["greaterequal"] = 549; 66939 t["Eth"] = 722; 66940 t["Ccedilla"] = 667; 66941 t["lcommaaccent"] = 278; 66942 t["tcaron"] = 326; 66943 t["eogonek"] = 444; 66944 t["Uogonek"] = 722; 66945 t["Aacute"] = 722; 66946 t["Adieresis"] = 722; 66947 t["egrave"] = 444; 66948 t["zacute"] = 444; 66949 t["iogonek"] = 278; 66950 t["Oacute"] = 722; 66951 t["oacute"] = 500; 66952 t["amacron"] = 444; 66953 t["sacute"] = 389; 66954 t["idieresis"] = 278; 66955 t["Ocircumflex"] = 722; 66956 t["Ugrave"] = 722; 66957 t["Delta"] = 612; 66958 t["thorn"] = 500; 66959 t["twosuperior"] = 300; 66960 t["Odieresis"] = 722; 66961 t["mu"] = 500; 66962 t["igrave"] = 278; 66963 t["ohungarumlaut"] = 500; 66964 t["Eogonek"] = 611; 66965 t["dcroat"] = 500; 66966 t["threequarters"] = 750; 66967 t["Scedilla"] = 556; 66968 t["lcaron"] = 344; 66969 t["Kcommaaccent"] = 722; 66970 t["Lacute"] = 611; 66971 t["trademark"] = 980; 66972 t["edotaccent"] = 444; 66973 t["Igrave"] = 333; 66974 t["Imacron"] = 333; 66975 t["Lcaron"] = 611; 66976 t["onehalf"] = 750; 66977 t["lessequal"] = 549; 66978 t["ocircumflex"] = 500; 66979 t["ntilde"] = 500; 66980 t["Uhungarumlaut"] = 722; 66981 t["Eacute"] = 611; 66982 t["emacron"] = 444; 66983 t["gbreve"] = 500; 66984 t["onequarter"] = 750; 66985 t["Scaron"] = 556; 66986 t["Scommaaccent"] = 556; 66987 t["Ohungarumlaut"] = 722; 66988 t["degree"] = 400; 66989 t["ograve"] = 500; 66990 t["Ccaron"] = 667; 66991 t["ugrave"] = 500; 66992 t["radical"] = 453; 66993 t["Dcaron"] = 722; 66994 t["rcommaaccent"] = 333; 66995 t["Ntilde"] = 722; 66996 t["otilde"] = 500; 66997 t["Rcommaaccent"] = 667; 66998 t["Lcommaaccent"] = 611; 66999 t["Atilde"] = 722; 67000 t["Aogonek"] = 722; 67001 t["Aring"] = 722; 67002 t["Otilde"] = 722; 67003 t["zdotaccent"] = 444; 67004 t["Ecaron"] = 611; 67005 t["Iogonek"] = 333; 67006 t["kcommaaccent"] = 500; 67007 t["minus"] = 564; 67008 t["Icircumflex"] = 333; 67009 t["ncaron"] = 500; 67010 t["tcommaaccent"] = 278; 67011 t["logicalnot"] = 564; 67012 t["odieresis"] = 500; 67013 t["udieresis"] = 500; 67014 t["notequal"] = 549; 67015 t["gcommaaccent"] = 500; 67016 t["eth"] = 500; 67017 t["zcaron"] = 444; 67018 t["ncommaaccent"] = 500; 67019 t["onesuperior"] = 300; 67020 t["imacron"] = 278; 67021 t["Euro"] = 500; 67022 }); 67023 t["Times-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) { 67024 t["space"] = 250; 67025 t["exclam"] = 333; 67026 t["quotedbl"] = 555; 67027 t["numbersign"] = 500; 67028 t["dollar"] = 500; 67029 t["percent"] = 1000; 67030 t["ampersand"] = 833; 67031 t["quoteright"] = 333; 67032 t["parenleft"] = 333; 67033 t["parenright"] = 333; 67034 t["asterisk"] = 500; 67035 t["plus"] = 570; 67036 t["comma"] = 250; 67037 t["hyphen"] = 333; 67038 t["period"] = 250; 67039 t["slash"] = 278; 67040 t["zero"] = 500; 67041 t["one"] = 500; 67042 t["two"] = 500; 67043 t["three"] = 500; 67044 t["four"] = 500; 67045 t["five"] = 500; 67046 t["six"] = 500; 67047 t["seven"] = 500; 67048 t["eight"] = 500; 67049 t["nine"] = 500; 67050 t["colon"] = 333; 67051 t["semicolon"] = 333; 67052 t["less"] = 570; 67053 t["equal"] = 570; 67054 t["greater"] = 570; 67055 t["question"] = 500; 67056 t["at"] = 930; 67057 t["A"] = 722;
67058 t["B"] = 667; 67059 t["C"] = 722; 67060 t["D"] = 722; 67061 t["E"] = 667; 67062 t["F"] = 611; 67063 t["G"] = 778; 67064 t["H"] = 778; 67065 t["I"] = 389; 67066 t["J"] = 500; 67067 t["K"] = 778; 67068 t["L"] = 667; 67069 t["M"] = 944; 67070 t["N"] = 722; 67071 t["O"] = 778; 67072 t["P"] = 611; 67073 t["Q"] = 778; 67074 t["R"] = 722; 67075 t["S"] = 556; 67076 t["T"] = 667; 67077 t["U"] = 722; 67078 t["V"] = 722; 67079 t["W"] = 1000; 67080 t["X"] = 722; 67081 t["Y"] = 722; 67082 t["Z"] = 667; 67083 t["bracketleft"] = 333; 67084 t["backslash"] = 278; 67085 t["bracketright"] = 333; 67086 t["asciicircum"] = 581; 67087 t["underscore"] = 500; 67088 t["quoteleft"] = 333; 67089 t["a"] = 500; 67090 t["b"] = 556; 67091 t["c"] = 444; 67092 t["d"] = 556; 67093 t["e"] = 444; 67094 t["f"] = 333; 67095 t["g"] = 500; 67096 t["h"] = 556; 67097 t["i"] = 278; 67098 t["j"] = 333; 67099 t["k"] = 556; 67100 t["l"] = 278; 67101 t["m"] = 833; 67102 t["n"] = 556; 67103 t["o"] = 500; 67104 t["p"] = 556; 67105 t["q"] = 556; 67106 t["r"] = 444; 67107 t["s"] = 389; 67108 t["t"] = 333; 67109 t["u"] = 556; 67110 t["v"] = 500; 67111 t["w"] = 722; 67112 t["x"] = 500; 67113 t["y"] = 500; 67114 t["z"] = 444; 67115 t["braceleft"] = 394; 67116 t["bar"] = 220; 67117 t["braceright"] = 394; 67118 t["asciitilde"] = 520; 67119 t["exclamdown"] = 333; 67120 t["cent"] = 500; 67121 t["sterling"] = 500; 67122 t["fraction"] = 167; 67123 t["yen"] = 500; 67124 t["florin"] = 500; 67125 t["section"] = 500; 67126 t["currency"] = 500; 67127 t["quotesingle"] = 278; 67128 t["quotedblleft"] = 500; 67129 t["guillemotleft"] = 500; 67130 t["guilsinglleft"] = 333; 67131 t["guilsinglright"] = 333; 67132 t["fi"] = 556; 67133 t["fl"] = 556; 67134 t["endash"] = 500; 67135 t["dagger"] = 500; 67136 t["daggerdbl"] = 500; 67137 t["periodcentered"] = 250; 67138 t["paragraph"] = 540; 67139 t["bullet"] = 350; 67140 t["quotesinglbase"] = 333; 67141 t["quotedblbase"] = 500; 67142 t["quotedblright"] = 500; 67143 t["guillemotright"] = 500; 67144 t["ellipsis"] = 1000; 67145 t["perthousand"] = 1000; 67146 t["questiondown"] = 500; 67147 t["grave"] = 333; 67148 t["acute"] = 333; 67149 t["circumflex"] = 333; 67150 t["tilde"] = 333; 67151 t["macron"] = 333; 67152 t["breve"] = 333; 67153 t["dotaccent"] = 333; 67154 t["dieresis"] = 333; 67155 t["ring"] = 333; 67156 t["cedilla"] = 333; 67157 t["hungarumlaut"] = 333; 67158 t["ogonek"] = 333; 67159 t["caron"] = 333; 67160 t["emdash"] = 1000; 67161 t["AE"] = 1000; 67162 t["ordfeminine"] = 300; 67163 t["Lslash"] = 667; 67164 t["Oslash"] = 778; 67165 t["OE"] = 1000; 67166 t["ordmasculine"] = 330; 67167 t["ae"] = 722; 67168 t["dotlessi"] = 278; 67169 t["lslash"] = 278; 67170 t["oslash"] = 500; 67171 t["oe"] = 722; 67172 t["germandbls"] = 556; 67173 t["Idieresis"] = 389; 67174 t["eacute"] = 444; 67175 t["abreve"] = 500; 67176 t["uhungarumlaut"] = 556; 67177 t["ecaron"] = 444; 67178 t["Ydieresis"] = 722; 67179 t["divide"] = 570; 67180 t["Yacute"] = 722; 67181 t["Acircumflex"] = 722; 67182 t["aacute"] = 500; 67183 t["Ucircumflex"] = 722; 67184 t["yacute"] = 500; 67185 t["scommaaccent"] = 389; 67186 t["ecircumflex"] = 444; 67187 t["Uring"] = 722; 67188 t["Udieresis"] = 722; 67189 t["aogonek"] = 500; 67190 t["Uacute"] = 722; 67191 t["uogonek"] = 556; 67192 t["Edieresis"] = 667; 67193 t["Dcroat"] = 722; 67194 t["commaaccent"] = 250; 67195 t["copyright"] = 747; 67196 t["Emacron"] = 667; 67197 t["ccaron"] = 444; 67198 t["aring"] = 500; 67199 t["Ncommaaccent"] = 722; 67200 t["lacute"] = 278; 67201 t["agrave"] = 500; 67202 t["Tcommaaccent"] = 667; 67203 t["Cacute"] = 722; 67204 t["atilde"] = 500; 67205 t["Edotaccent"] = 667; 67206 t["scaron"] = 389;
67207 t["scedilla"] = 389; 67208 t["iacute"] = 278; 67209 t["lozenge"] = 494; 67210 t["Rcaron"] = 722; 67211 t["Gcommaaccent"] = 778; 67212 t["ucircumflex"] = 556; 67213 t["acircumflex"] = 500; 67214 t["Amacron"] = 722; 67215 t["rcaron"] = 444; 67216 t["ccedilla"] = 444; 67217 t["Zdotaccent"] = 667; 67218 t["Thorn"] = 611; 67219 t["Omacron"] = 778; 67220 t["Racute"] = 722; 67221 t["Sacute"] = 556; 67222 t["dcaron"] = 672; 67223 t["Umacron"] = 722; 67224 t["uring"] = 556; 67225 t["threesuperior"] = 300; 67226 t["Ograve"] = 778; 67227 t["Agrave"] = 722; 67228 t["Abreve"] = 722; 67229 t["multiply"] = 570; 67230 t["uacute"] = 556; 67231 t["Tcaron"] = 667; 67232 t["partialdiff"] = 494; 67233 t["ydieresis"] = 500; 67234 t["Nacute"] = 722; 67235 t["icircumflex"] = 278; 67236 t["Ecircumflex"] = 667; 67237 t["adieresis"] = 500; 67238 t["edieresis"] = 444; 67239 t["cacute"] = 444; 67240 t["nacute"] = 556; 67241 t["umacron"] = 556; 67242 t["Ncaron"] = 722; 67243 t["Iacute"] = 389; 67244 t["plusminus"] = 570; 67245 t["brokenbar"] = 220; 67246 t["registered"] = 747; 67247 t["Gbreve"] = 778; 67248 t["Idotaccent"] = 389;
67249 t["summation"] = 600; 67250 t["Egrave"] = 667; 67251 t["racute"] = 444; 67252 t["omacron"] = 500; 67253 t["Zacute"] = 667; 67254 t["Zcaron"] = 667; 67255 t["greaterequal"] = 549; 67256 t["Eth"] = 722; 67257 t["Ccedilla"] = 722; 67258 t["lcommaaccent"] = 278; 67259 t["tcaron"] = 416; 67260 t["eogonek"] = 444; 67261 t["Uogonek"] = 722; 67262 t["Aacute"] = 722; 67263 t["Adieresis"] = 722; 67264 t["egrave"] = 444; 67265 t["zacute"] = 444; 67266 t["iogonek"] = 278; 67267 t["Oacute"] = 778; 67268 t["oacute"] = 500; 67269 t["amacron"] = 500; 67270 t["sacute"] = 389; 67271 t["idieresis"] = 278; 67272 t["Ocircumflex"] = 778; 67273 t["Ugrave"] = 722; 67274 t["Delta"] = 612; 67275 t["thorn"] = 556; 67276 t["twosuperior"] = 300; 67277 t["Odieresis"] = 778; 67278 t["mu"] = 556; 67279 t["igrave"] = 278; 67280 t["ohungarumlaut"] = 500; 67281 t["Eogonek"] = 667; 67282 t["dcroat"] = 556; 67283 t["threequarters"] = 750; 67284 t["Scedilla"] = 556; 67285 t["lcaron"] = 394; 67286 t["Kcommaaccent"] = 778; 67287 t["Lacute"] = 667; 67288 t["trademark"] = 1000; 67289 t["edotaccent"] = 444; 67290 t["Igrave"] = 389; 67291 t["Imacron"] = 389; 67292 t["Lcaron"] = 667; 67293 t["onehalf"] = 750; 67294 t["lessequal"] = 549; 67295 t["ocircumflex"] = 500; 67296 t["ntilde"] = 556; 67297 t["Uhungarumlaut"] = 722; 67298 t["Eacute"] = 667; 67299 t["emacron"] = 444; 67300 t["gbreve"] = 500; 67301 t["onequarter"] = 750; 67302 t["Scaron"] = 556; 67303 t["Scommaaccent"] = 556; 67304 t["Ohungarumlaut"] = 778; 67305 t["degree"] = 400; 67306 t["ograve"] = 500; 67307 t["Ccaron"] = 722; 67308 t["ugrave"] = 556; 67309 t["radical"] = 549; 67310 t["Dcaron"] = 722; 67311 t["rcommaaccent"] = 444; 67312 t["Ntilde"] = 722; 67313 t["otilde"] = 500; 67314 t["Rcommaaccent"] = 722; 67315 t["Lcommaaccent"] = 667; 67316 t["Atilde"] = 722; 67317 t["Aogonek"] = 722; 67318 t["Aring"] = 722; 67319 t["Otilde"] = 778; 67320 t["zdotaccent"] = 444; 67321 t["Ecaron"] = 667; 67322 t["Iogonek"] = 389; 67323 t["kcommaaccent"] = 556; 67324 t["minus"] = 570; 67325 t["Icircumflex"] = 389; 67326 t["ncaron"] = 556; 67327 t["tcommaaccent"] = 333; 67328 t["logicalnot"] = 570; 67329 t["odieresis"] = 500; 67330 t["udieresis"] = 556; 67331 t["notequal"] = 549; 67332 t["gcommaaccent"] = 500; 67333 t["eth"] = 500; 67334 t["zcaron"] = 444; 67335 t["ncommaaccent"] = 556; 67336 t["onesuperior"] = 300; 67337 t["imacron"] = 278; 67338 t["Euro"] = 500; 67339 }); 67340 t["Times-BoldItalic"] = (0, _core_utils.getLookupTableFactory)(function (t) { 67341 t["space"] = 250; 67342 t["exclam"] = 389; 67343 t["quotedbl"] = 555; 67344 t["numbersign"] = 500; 67345 t["dollar"] = 500; 67346 t["percent"] = 833; 67347 t["ampersand"] = 778; 67348 t["quoteright"] = 333; 67349 t["parenleft"] = 333; 67350 t["parenright"] = 333; 67351 t["asterisk"] = 500; 67352 t["plus"] = 570; 67353 t["comma"] = 250; 67354 t["hyphen"] = 333; 67355 t["period"] = 250; 67356 t["slash"] = 278; 67357 t["zero"] = 500; 67358 t["one"] = 500; 67359 t["two"] = 500; 67360 t["three"] = 500; 67361 t["four"] = 500; 67362 t["five"] = 500; 67363 t["six"] = 500; 67364 t["seven"] = 500; 67365 t["eight"] = 500; 67366 t["nine"] = 500; 67367 t["colon"] = 333; 67368 t["semicolon"] = 333; 67369 t["less"] = 570; 67370 t["equal"] = 570; 67371 t["greater"] = 570; 67372 t["question"] = 500; 67373 t["at"] = 832; 67374 t["A"] = 667; 67375 t["B"] = 667; 67376 t["C"] = 667; 67377 t["D"] = 722; 67378 t["E"] = 667; 67379 t["F"] = 667; 67380 t["G"] = 722; 67381 t["H"] = 778;
67382 t["I"] = 389; 67383 t["J"] = 500; 67384 t["K"] = 667; 67385 t["L"] = 611; 67386 t["M"] = 889; 67387 t["N"] = 722; 67388 t["O"] = 722; 67389 t["P"] = 611; 67390 t["Q"] = 722; 67391 t["R"] = 667; 67392 t["S"] = 556; 67393 t["T"] = 611; 67394 t["U"] = 722; 67395 t["V"] = 667; 67396 t["W"] = 889; 67397 t["X"] = 667; 67398 t["Y"] = 611; 67399 t["Z"] = 611; 67400 t["bracketleft"] = 333; 67401 t["backslash"] = 278; 67402 t["bracketright"] = 333; 67403 t["asciicircum"] = 570; 67404 t["underscore"] = 500; 67405 t["quoteleft"] = 333; 67406 t["a"] = 500; 67407 t["b"] = 500; 67408 t["c"] = 444; 67409 t["d"] = 500; 67410 t["e"] = 444; 67411 t["f"] = 333; 67412 t["g"] = 500; 67413 t["h"] = 556; 67414 t["i"] = 278; 67415 t["j"] = 278; 67416 t["k"] = 500; 67417 t["l"] = 278; 67418 t["m"] = 778; 67419 t["n"] = 556; 67420 t["o"] = 500; 67421 t["p"] = 500; 67422 t["q"] = 500; 67423 t["r"] = 389; 67424 t["s"] = 389; 67425 t["t"] = 278; 67426 t["u"] = 556; 67427 t["v"] = 444; 67428 t["w"] = 667; 67429 t["x"] = 500; 67430 t["y"] = 444; 67431 t["z"] = 389; 67432 t["braceleft"] = 348; 67433 t["bar"] = 220; 67434 t["braceright"] = 348; 67435 t["asciitilde"] = 570; 67436 t["exclamdown"] = 389; 67437 t["cent"] = 500; 67438 t["sterling"] = 500; 67439 t["fraction"] = 167; 67440 t["yen"] = 500; 67441 t["florin"] = 500; 67442 t["section"] = 500; 67443 t["currency"] = 500; 67444 t["quotesingle"] = 278; 67445 t["quotedblleft"] = 500; 67446 t["guillemotleft"] = 500; 67447 t["guilsinglleft"] = 333; 67448 t["guilsinglright"] = 333; 67449 t["fi"] = 556; 67450 t["fl"] = 556; 67451 t["endash"] = 500; 67452 t["dagger"] = 500; 67453 t["daggerdbl"] = 500; 67454 t["periodcentered"] = 250; 67455 t["paragraph"] = 500; 67456 t["bullet"] = 350; 67457 t["quotesinglbase"] = 333; 67458 t["quotedblbase"] = 500; 67459 t["quotedblright"] = 500; 67460 t["guillemotright"] = 500; 67461 t["ellipsis"] = 1000; 67462 t["perthousand"] = 1000; 67463 t["questiondown"] = 500; 67464 t["grave"] = 333; 67465 t["acute"] = 333; 67466 t["circumflex"] = 333; 67467 t["tilde"] = 333; 67468 t["macron"] = 333; 67469 t["breve"] = 333; 67470 t["dotaccent"] = 333; 67471 t["dieresis"] = 333; 67472 t["ring"] = 333; 67473 t["cedilla"] = 333; 67474 t["hungarumlaut"] = 333; 67475 t["ogonek"] = 333; 67476 t["caron"] = 333; 67477 t["emdash"] = 1000; 67478 t["AE"] = 944; 67479 t["ordfeminine"] = 266; 67480 t["Lslash"] = 611; 67481 t["Oslash"] = 722; 67482 t["OE"] = 944; 67483 t["ordmasculine"] = 300; 67484 t["ae"] = 722; 67485 t["dotlessi"] = 278; 67486 t["lslash"] = 278; 67487 t["oslash"] = 500; 67488 t["oe"] = 722; 67489 t["germandbls"] = 500; 67490 t["Idieresis"] = 389; 67491 t["eacute"] = 444; 67492 t["abreve"] = 500; 67493 t["uhungarumlaut"] = 556; 67494 t["ecaron"] = 444; 67495 t["Ydieresis"] = 611; 67496 t["divide"] = 570; 67497 t["Yacute"] = 611; 67498 t["Acircumflex"] = 667; 67499 t["aacute"] = 500; 67500 t["Ucircumflex"] = 722; 67501 t["yacute"] = 444; 67502 t["scommaaccent"] = 389; 67503 t["ecircumflex"] = 444; 67504 t["Uring"] = 722; 67505 t["Udieresis"] = 722; 67506 t["aogonek"] = 500; 67507 t["Uacute"] = 722; 67508 t["uogonek"] = 556; 67509 t["Edieresis"] = 667; 67510 t["Dcroat"] = 722; 67511 t["commaaccent"] = 250; 67512 t["copyright"] = 747; 67513 t["Emacron"] = 667; 67514 t["ccaron"] = 444; 67515 t["aring"] = 500; 67516 t["Ncommaaccent"] = 722; 67517 t["lacute"] = 278; 67518 t["agrave"] = 500; 67519 t["Tcommaaccent"] = 611; 67520 t["Cacute"] = 667; 67521 t["atilde"] = 500; 67522 t["Edotaccent"] = 667; 67523 t["scaron"] = 389;
67524 t["scedilla"] = 389; 67525 t["iacute"] = 278; 67526 t["lozenge"] = 494; 67527 t["Rcaron"] = 667; 67528 t["Gcommaaccent"] = 722; 67529 t["ucircumflex"] = 556; 67530 t["acircumflex"] = 500; 67531 t["Amacron"] = 667; 67532 t["rcaron"] = 389; 67533 t["ccedilla"] = 444; 67534 t["Zdotaccent"] = 611; 67535 t["Thorn"] = 611; 67536 t["Omacron"] = 722; 67537 t["Racute"] = 667; 67538 t["Sacute"] = 556; 67539 t["dcaron"] = 608; 67540 t["Umacron"] = 722; 67541 t["uring"] = 556; 67542 t["threesuperior"] = 300; 67543 t["Ograve"] = 722; 67544 t["Agrave"] = 667; 67545 t["Abreve"] = 667; 67546 t["multiply"] = 570; 67547 t["uacute"] = 556; 67548 t["Tcaron"] = 611; 67549 t["partialdiff"] = 494; 67550 t["ydieresis"] = 444; 67551 t["Nacute"] = 722; 67552 t["icircumflex"] = 278; 67553 t["Ecircumflex"] = 667; 67554 t["adieresis"] = 500; 67555 t["edieresis"] = 444; 67556 t["cacute"] = 444; 67557 t["nacute"] = 556; 67558 t["umacron"] = 556; 67559 t["Ncaron"] = 722; 67560 t["Iacute"] = 389; 67561 t["plusminus"] = 570; 67562 t["brokenbar"] = 220; 67563 t["registered"] = 747; 67564 t["Gbreve"] = 722; 67565 t["Idotaccent"] = 389;
67566 t["summation"] = 600; 67567 t["Egrave"] = 667; 67568 t["racute"] = 389; 67569 t["omacron"] = 500; 67570 t["Zacute"] = 611; 67571 t["Zcaron"] = 611; 67572 t["greaterequal"] = 549; 67573 t["Eth"] = 722; 67574 t["Ccedilla"] = 667; 67575 t["lcommaaccent"] = 278; 67576 t["tcaron"] = 366; 67577 t["eogonek"] = 444; 67578 t["Uogonek"] = 722; 67579 t["Aacute"] = 667; 67580 t["Adieresis"] = 667; 67581 t["egrave"] = 444; 67582 t["zacute"] = 389; 67583 t["iogonek"] = 278; 67584 t["Oacute"] = 722; 67585 t["oacute"] = 500; 67586 t["amacron"] = 500; 67587 t["sacute"] = 389; 67588 t["idieresis"] = 278; 67589 t["Ocircumflex"] = 722; 67590 t["Ugrave"] = 722; 67591 t["Delta"] = 612; 67592 t["thorn"] = 500; 67593 t["twosuperior"] = 300; 67594 t["Odieresis"] = 722; 67595 t["mu"] = 576; 67596 t["igrave"] = 278; 67597 t["ohungarumlaut"] = 500; 67598 t["Eogonek"] = 667; 67599 t["dcroat"] = 500; 67600 t["threequarters"] = 750; 67601 t["Scedilla"] = 556; 67602 t["lcaron"] = 382; 67603 t["Kcommaaccent"] = 667; 67604 t["Lacute"] = 611; 67605 t["trademark"] = 1000; 67606 t["edotaccent"] = 444; 67607 t["Igrave"] = 389; 67608 t["Imacron"] = 389; 67609 t["Lcaron"] = 611; 67610 t["onehalf"] = 750; 67611 t["lessequal"] = 549; 67612 t["ocircumflex"] = 500; 67613 t["ntilde"] = 556; 67614 t["Uhungarumlaut"] = 722; 67615 t["Eacute"] = 667; 67616 t["emacron"] = 444; 67617 t["gbreve"] = 500; 67618 t["onequarter"] = 750; 67619 t["Scaron"] = 556; 67620 t["Scommaaccent"] = 556; 67621 t["Ohungarumlaut"] = 722; 67622 t["degree"] = 400; 67623 t["ograve"] = 500; 67624 t["Ccaron"] = 667; 67625 t["ugrave"] = 556; 67626 t["radical"] = 549; 67627 t["Dcaron"] = 722; 67628 t["rcommaaccent"] = 389; 67629 t["Ntilde"] = 722; 67630 t["otilde"] = 500; 67631 t["Rcommaaccent"] = 667; 67632 t["Lcommaaccent"] = 611; 67633 t["Atilde"] = 667; 67634 t["Aogonek"] = 667; 67635 t["Aring"] = 667; 67636 t["Otilde"] = 722; 67637 t["zdotaccent"] = 389; 67638 t["Ecaron"] = 667; 67639 t["Iogonek"] = 389; 67640 t["kcommaaccent"] = 500; 67641 t["minus"] = 606; 67642 t["Icircumflex"] = 389; 67643 t["ncaron"] = 556; 67644 t["tcommaaccent"] = 278; 67645 t["logicalnot"] = 606; 67646 t["odieresis"] = 500; 67647 t["udieresis"] = 556; 67648 t["notequal"] = 549; 67649 t["gcommaaccent"] = 500; 67650 t["eth"] = 500; 67651 t["zcaron"] = 389; 67652 t["ncommaaccent"] = 556; 67653 t["onesuperior"] = 300; 67654 t["imacron"] = 278; 67655 t["Euro"] = 500; 67656 }); 67657 t["Times-Italic"] = (0, _core_utils.getLookupTableFactory)(function (t) { 67658 t["space"] = 250; 67659 t["exclam"] = 333; 67660 t["quotedbl"] = 420; 67661 t["numbersign"] = 500; 67662 t["dollar"] = 500; 67663 t["percent"] = 833; 67664 t["ampersand"] = 778; 67665 t["quoteright"] = 333; 67666 t["parenleft"] = 333; 67667 t["parenright"] = 333; 67668 t["asterisk"] = 500; 67669 t["plus"] = 675; 67670 t["comma"] = 250; 67671 t["hyphen"] = 333; 67672 t["period"] = 250; 67673 t["slash"] = 278; 67674 t["zero"] = 500; 67675 t["one"] = 500; 67676 t["two"] = 500; 67677 t["three"] = 500; 67678 t["four"] = 500; 67679 t["five"] = 500; 67680 t["six"] = 500; 67681 t["seven"] = 500; 67682 t["eight"] = 500; 67683 t["nine"] = 500; 67684 t["colon"] = 333; 67685 t["semicolon"] = 333; 67686 t["less"] = 675; 67687 t["equal"] = 675; 67688 t["greater"] = 675; 67689 t["question"] = 500; 67690 t["at"] = 920; 67691 t["A"] = 611; 67692 t["B"] = 611; 67693 t["C"] = 667; 67694 t["D"] = 722; 67695 t["E"] = 611; 67696 t["F"] = 611; 67697 t["G"] = 722; 67698 t["H"] = 722;
67699 t["I"] = 333; 67700 t["J"] = 444; 67701 t["K"] = 667; 67702 t["L"] = 556; 67703 t["M"] = 833; 67704 t["N"] = 667; 67705 t["O"] = 722; 67706 t["P"] = 611; 67707 t["Q"] = 722; 67708 t["R"] = 611; 67709 t["S"] = 500; 67710 t["T"] = 556; 67711 t["U"] = 722; 67712 t["V"] = 611; 67713 t["W"] = 833; 67714 t["X"] = 611; 67715 t["Y"] = 556; 67716 t["Z"] = 556; 67717 t["bracketleft"] = 389; 67718 t["backslash"] = 278; 67719 t["bracketright"] = 389; 67720 t["asciicircum"] = 422; 67721 t["underscore"] = 500; 67722 t["quoteleft"] = 333; 67723 t["a"] = 500; 67724 t["b"] = 500; 67725 t["c"] = 444; 67726 t["d"] = 500; 67727 t["e"] = 444; 67728 t["f"] = 278; 67729 t["g"] = 500; 67730 t["h"] = 500; 67731 t["i"] = 278; 67732 t["j"] = 278; 67733 t["k"] = 444; 67734 t["l"] = 278; 67735 t["m"] = 722; 67736 t["n"] = 500; 67737 t["o"] = 500; 67738 t["p"] = 500; 67739 t["q"] = 500; 67740 t["r"] = 389; 67741 t["s"] = 389; 67742 t["t"] = 278; 67743 t["u"] = 500; 67744 t["v"] = 444; 67745 t["w"] = 667; 67746 t["x"] = 444; 67747 t["y"] = 444; 67748 t["z"] = 389; 67749 t["braceleft"] = 400; 67750 t["bar"] = 275; 67751 t["braceright"] = 400; 67752 t["asciitilde"] = 541; 67753 t["exclamdown"] = 389; 67754 t["cent"] = 500; 67755 t["sterling"] = 500; 67756 t["fraction"] = 167; 67757 t["yen"] = 500; 67758 t["florin"] = 500; 67759 t["section"] = 500; 67760 t["currency"] = 500; 67761 t["quotesingle"] = 214; 67762 t["quotedblleft"] = 556; 67763 t["guillemotleft"] = 500; 67764 t["guilsinglleft"] = 333; 67765 t["guilsinglright"] = 333; 67766 t["fi"] = 500; 67767 t["fl"] = 500; 67768 t["endash"] = 500; 67769 t["dagger"] = 500; 67770 t["daggerdbl"] = 500; 67771 t["periodcentered"] = 250; 67772 t["paragraph"] = 523; 67773 t["bullet"] = 350; 67774 t["quotesinglbase"] = 333; 67775 t["quotedblbase"] = 556; 67776 t["quotedblright"] = 556; 67777 t["guillemotright"] = 500; 67778 t["ellipsis"] = 889; 67779 t["perthousand"] = 1000; 67780 t["questiondown"] = 500; 67781 t["grave"] = 333; 67782 t["acute"] = 333; 67783 t["circumflex"] = 333; 67784 t["tilde"] = 333; 67785 t["macron"] = 333; 67786 t["breve"] = 333; 67787 t["dotaccent"] = 333; 67788 t["dieresis"] = 333; 67789 t["ring"] = 333; 67790 t["cedilla"] = 333; 67791 t["hungarumlaut"] = 333; 67792 t["ogonek"] = 333; 67793 t["caron"] = 333; 67794 t["emdash"] = 889; 67795 t["AE"] = 889; 67796 t["ordfeminine"] = 276; 67797 t["Lslash"] = 556; 67798 t["Oslash"] = 722; 67799 t["OE"] = 944; 67800 t["ordmasculine"] = 310; 67801 t["ae"] = 667; 67802 t["dotlessi"] = 278; 67803 t["lslash"] = 278; 67804 t["oslash"] = 500; 67805 t["oe"] = 667; 67806 t["germandbls"] = 500; 67807 t["Idieresis"] = 333; 67808 t["eacute"] = 444; 67809 t["abreve"] = 500; 67810 t["uhungarumlaut"] = 500; 67811 t["ecaron"] = 444; 67812 t["Ydieresis"] = 556; 67813 t["divide"] = 675; 67814 t["Yacute"] = 556; 67815 t["Acircumflex"] = 611; 67816 t["aacute"] = 500; 67817 t["Ucircumflex"] = 722; 67818 t["yacute"] = 444; 67819 t["scommaaccent"] = 389; 67820 t["ecircumflex"] = 444; 67821 t["Uring"] = 722; 67822 t["Udieresis"] = 722; 67823 t["aogonek"] = 500; 67824 t["Uacute"] = 722; 67825 t["uogonek"] = 500; 67826 t["Edieresis"] = 611; 67827 t["Dcroat"] = 722; 67828 t["commaaccent"] = 250; 67829 t["copyright"] = 760; 67830 t["Emacron"] = 611; 67831 t["ccaron"] = 444; 67832 t["aring"] = 500; 67833 t["Ncommaaccent"] = 667; 67834 t["lacute"] = 278; 67835 t["agrave"] = 500; 67836 t["Tcommaaccent"] = 556; 67837 t["Cacute"] = 667; 67838 t["atilde"] = 500; 67839 t["Edotaccent"] = 611; 67840 t["scaron"] = 389;
67841 t["scedilla"] = 389; 67842 t["iacute"] = 278; 67843 t["lozenge"] = 471; 67844 t["Rcaron"] = 611; 67845 t["Gcommaaccent"] = 722; 67846 t["ucircumflex"] = 500; 67847 t["acircumflex"] = 500; 67848 t["Amacron"] = 611; 67849 t["rcaron"] = 389; 67850 t["ccedilla"] = 444; 67851 t["Zdotaccent"] = 556; 67852 t["Thorn"] = 611; 67853 t["Omacron"] = 722; 67854 t["Racute"] = 611; 67855 t["Sacute"] = 500; 67856 t["dcaron"] = 544; 67857 t["Umacron"] = 722; 67858 t["uring"] = 500; 67859 t["threesuperior"] = 300; 67860 t["Ograve"] = 722; 67861 t["Agrave"] = 611; 67862 t["Abreve"] = 611; 67863 t["multiply"] = 675; 67864 t["uacute"] = 500; 67865 t["Tcaron"] = 556; 67866 t["partialdiff"] = 476; 67867 t["ydieresis"] = 444; 67868 t["Nacute"] = 667; 67869 t["icircumflex"] = 278; 67870 t["Ecircumflex"] = 611; 67871 t["adieresis"] = 500; 67872 t["edieresis"] = 444; 67873 t["cacute"] = 444; 67874 t["nacute"] = 500; 67875 t["umacron"] = 500; 67876 t["Ncaron"] = 667; 67877 t["Iacute"] = 333; 67878 t["plusminus"] = 675; 67879 t["brokenbar"] = 275; 67880 t["registered"] = 760; 67881 t["Gbreve"] = 722; 67882 t["Idotaccent"] = 333; 67883 t["summation"] = 600; 67884 t["Egrave"] = 611; 67885 t["racute"] = 389; 67886 t["omacron"] = 500; 67887 t["Zacute"] = 556; 67888 t["Zcaron"] = 556; 67889 t["greaterequal"] = 549; 67890 t["Eth"] = 722; 67891 t["Ccedilla"] = 667; 67892 t["lcommaaccent"] = 278; 67893 t["tcaron"] = 300; 67894 t["eogonek"] = 444; 67895 t["Uogonek"] = 722; 67896 t["Aacute"] = 611; 67897 t["Adieresis"] = 611; 67898 t["egrave"] = 444; 67899 t["zacute"] = 389; 67900 t["iogonek"] = 278; 67901 t["Oacute"] = 722; 67902 t["oacute"] = 500; 67903 t["amacron"] = 500; 67904 t["sacute"] = 389; 67905 t["idieresis"] = 278; 67906 t["Ocircumflex"] = 722; 67907 t["Ugrave"] = 722; 67908 t["Delta"] = 612; 67909 t["thorn"] = 500; 67910 t["twosuperior"] = 300; 67911 t["Odieresis"] = 722; 67912 t["mu"] = 500; 67913 t["igrave"] = 278; 67914 t["ohungarumlaut"] = 500; 67915 t["Eogonek"] = 611; 67916 t["dcroat"] = 500; 67917 t["threequarters"] = 750; 67918 t["Scedilla"] = 500; 67919 t["lcaron"] = 300; 67920 t["Kcommaaccent"] = 667; 67921 t["Lacute"] = 556; 67922 t["trademark"] = 980; 67923 t["edotaccent"] = 444; 67924 t["Igrave"] = 333; 67925 t["Imacron"] = 333; 67926 t["Lcaron"] = 611; 67927 t["onehalf"] = 750; 67928 t["lessequal"] = 549; 67929 t["ocircumflex"] = 500; 67930 t["ntilde"] = 500; 67931 t["Uhungarumlaut"] = 722; 67932 t["Eacute"] = 611; 67933 t["emacron"] = 444; 67934 t["gbreve"] = 500; 67935 t["onequarter"] = 750; 67936 t["Scaron"] = 500; 67937 t["Scommaaccent"] = 500; 67938 t["Ohungarumlaut"] = 722; 67939 t["degree"] = 400; 67940 t["ograve"] = 500; 67941 t["Ccaron"] = 667; 67942 t["ugrave"] = 500; 67943 t["radical"] = 453; 67944 t["Dcaron"] = 722; 67945 t["rcommaaccent"] = 389; 67946 t["Ntilde"] = 667; 67947 t["otilde"] = 500; 67948 t["Rcommaaccent"] = 611; 67949 t["Lcommaaccent"] = 556; 67950 t["Atilde"] = 611; 67951 t["Aogonek"] = 611; 67952 t["Aring"] = 611; 67953 t["Otilde"] = 722; 67954 t["zdotaccent"] = 389; 67955 t["Ecaron"] = 611; 67956 t["Iogonek"] = 333; 67957 t["kcommaaccent"] = 444; 67958 t["minus"] = 675; 67959 t["Icircumflex"] = 333; 67960 t["ncaron"] = 500; 67961 t["tcommaaccent"] = 278; 67962 t["logicalnot"] = 675; 67963 t["odieresis"] = 500; 67964 t["udieresis"] = 500; 67965 t["notequal"] = 549; 67966 t["gcommaaccent"] = 500; 67967 t["eth"] = 500; 67968 t["zcaron"] = 389; 67969 t["ncommaaccent"] = 500; 67970 t["onesuperior"] = 300; 67971 t["imacron"] = 278; 67972 t["Euro"] = 500; 67973 }); 67974 t["ZapfDingbats"] = (0, _core_utils.getLookupTableFactory)(function (t) { 67975 t["space"] = 278; 67976 t["a1"] = 974; 67977 t["a2"] = 961; 67978 t["a202"] = 974; 67979 t["a3"] = 980; 67980 t["a4"] = 719; 67981 t["a5"] = 789; 67982 t["a119"] = 790; 67983 t["a118"] = 791; 67984 t["a117"] = 690; 67985 t["a11"] = 960; 67986 t["a12"] = 939; 67987 t["a13"] = 549; 67988 t["a14"] = 855; 67989 t["a15"] = 911; 67990 t["a16"] = 933; 67991 t["a105"] = 911; 67992 t["a17"] = 945; 67993 t["a18"] = 974; 67994 t["a19"] = 755; 67995 t["a20"] = 846; 67996 t["a21"] = 762; 67997 t["a22"] = 761; 67998 t["a23"] = 571; 67999 t["a24"] = 677; 68000 t["a25"] = 763; 68001 t["a26"] = 760; 68002 t["a27"] = 759; 68003 t["a28"] = 754; 68004 t["a6"] = 494; 68005 t["a7"] = 552; 68006 t["a8"] = 537; 68007 t["a9"] = 577; 68008 t["a10"] = 692; 68009 t["a29"] = 786; 68010 t["a30"] = 788; 68011 t["a31"] = 788; 68012 t["a32"] = 790; 68013 t["a33"] = 793; 68014 t["a34"] = 794; 68015 t["a35"] = 816; 68016 t["a36"] = 823; 68017 t["a37"] = 789; 68018 t["a38"] = 841; 68019 t["a39"] = 823; 68020 t["a40"] = 833; 68021 t["a41"] = 816; 68022 t["a42"] = 831; 68023 t["a43"] = 923; 68024 t["a44"] = 744; 68025 t["a45"] = 723; 68026 t["a46"] = 749; 68027 t["a47"] = 790; 68028 t["a48"] = 792; 68029 t["a49"] = 695; 68030 t["a50"] = 776; 68031 t["a51"] = 768; 68032 t["a52"] = 792; 68033 t["a53"] = 759; 68034 t["a54"] = 707; 68035 t["a55"] = 708; 68036 t["a56"] = 682; 68037 t["a57"] = 701; 68038 t["a58"] = 826; 68039 t["a59"] = 815; 68040 t["a60"] = 789; 68041 t["a61"] = 789; 68042 t["a62"] = 707; 68043 t["a63"] = 687; 68044 t["a64"] = 696; 68045 t["a65"] = 689; 68046 t["a66"] = 786; 68047 t["a67"] = 787; 68048 t["a68"] = 713; 68049 t["a69"] = 791; 68050 t["a70"] = 785; 68051 t["a71"] = 791; 68052 t["a72"] = 873; 68053 t["a73"] = 761; 68054 t["a74"] = 762; 68055 t["a203"] = 762; 68056 t["a75"] = 759; 68057 t["a204"] = 759; 68058 t["a76"] = 892; 68059 t["a77"] = 892; 68060 t["a78"] = 788; 68061 t["a79"] = 784; 68062 t["a81"] = 438; 68063 t["a82"] = 138; 68064 t["a83"] = 277; 68065 t["a84"] = 415; 68066 t["a97"] = 392; 68067 t["a98"] = 392; 68068 t["a99"] = 668; 68069 t["a100"] = 668; 68070 t["a89"] = 390; 68071 t["a90"] = 390;
68072 t["a93"] = 317; 68073 t["a94"] = 317; 68074 t["a91"] = 276; 68075 t["a92"] = 276; 68076 t["a205"] = 509; 68077 t["a85"] = 509; 68078 t["a206"] = 410; 68079 t["a86"] = 410; 68080 t["a87"] = 234; 68081 t["a88"] = 234; 68082 t["a95"] = 334; 68083 t["a96"] = 334; 68084 t["a101"] = 732; 68085 t["a102"] = 544; 68086 t["a103"] = 544; 68087 t["a104"] = 910; 68088 t["a106"] = 667; 68089 t["a107"] = 760; 68090 t["a108"] = 760; 68091 t["a112"] = 776; 68092 t["a111"] = 595; 68093 t["a110"] = 694; 68094 t["a109"] = 626; 68095 t["a120"] = 788; 68096 t["a121"] = 788; 68097 t["a122"] = 788; 68098 t["a123"] = 788; 68099 t["a124"] = 788; 68100 t["a125"] = 788; 68101 t["a126"] = 788; 68102 t["a127"] = 788; 68103 t["a128"] = 788; 68104 t["a129"] = 788; 68105 t["a130"] = 788; 68106 t["a131"] = 788; 68107 t["a132"] = 788; 68108 t["a133"] = 788; 68109 t["a134"] = 788; 68110 t["a135"] = 788; 68111 t["a136"] = 788; 68112 t["a137"] = 788; 68113 t["a138"] = 788; 68114 t["a139"] = 788; 68115 t["a140"] = 788; 68116 t["a141"] = 788; 68117 t["a142"] = 788; 68118 t["a143"] = 788; 68119 t["a144"] = 788; 68120 t["a145"] = 788; 68121 t["a146"] = 788; 68122 t["a147"] = 788; 68123 t["a148"] = 788; 68124 t["a149"] = 788; 68125 t["a150"] = 788; 68126 t["a151"] = 788; 68127 t["a152"] = 788; 68128 t["a153"] = 788; 68129 t["a154"] = 788; 68130 t["a155"] = 788; 68131 t["a156"] = 788; 68132 t["a157"] = 788; 68133 t["a158"] = 788; 68134 t["a159"] = 788; 68135 t["a160"] = 894; 68136 t["a161"] = 838; 68137 t["a163"] = 1016; 68138 t["a164"] = 458; 68139 t["a196"] = 748; 68140 t["a165"] = 924; 68141 t["a192"] = 748; 68142 t["a166"] = 918; 68143 t["a167"] = 927; 68144 t["a168"] = 928; 68145 t["a169"] = 928; 68146 t["a170"] = 834; 68147 t["a171"] = 873; 68148 t["a172"] = 828; 68149 t["a173"] = 924; 68150 t["a162"] = 924; 68151 t["a174"] = 917; 68152 t["a175"] = 930; 68153 t["a176"] = 931; 68154 t["a177"] = 463; 68155 t["a178"] = 883; 68156 t["a179"] = 836; 68157 t["a193"] = 836; 68158 t["a180"] = 867; 68159 t["a199"] = 867; 68160 t["a181"] = 696; 68161 t["a200"] = 696; 68162 t["a182"] = 874; 68163 t["a201"] = 874; 68164 t["a183"] = 760; 68165 t["a184"] = 946; 68166 t["a197"] = 771; 68167 t["a185"] = 865; 68168 t["a194"] = 771; 68169 t["a198"] = 888; 68170 t["a186"] = 967; 68171 t["a195"] = 888; 68172 t["a187"] = 831; 68173 t["a188"] = 873; 68174 t["a189"] = 927; 68175 t["a190"] = 970; 68176 t["a191"] = 918; 68177 }); 68178}); 68179exports.getMetrics = getMetrics; 68180 68181/***/ }), 68182/* 39 */ 68183/***/ (function(module, exports, __w_pdfjs_require__) { 68184 68185"use strict"; 68186 68187 68188Object.defineProperty(exports, "__esModule", { 68189 value: true 68190}); 68191exports.isPDFFunction = isPDFFunction; 68192exports.PostScriptCompiler = exports.PostScriptEvaluator = exports.PDFFunctionFactory = void 0; 68193 68194var _util = __w_pdfjs_require__(2); 68195 68196var _primitives = __w_pdfjs_require__(4); 68197 68198var _ps_parser = __w_pdfjs_require__(40); 68199 68200class PDFFunctionFactory { 68201 constructor({ 68202 xref, 68203 isEvalSupported = true 68204 }) { 68205 this.xref = xref; 68206 this.isEvalSupported = isEvalSupported !== false; 68207 } 68208 68209 create(fn) { 68210 return PDFFunction.parse({ 68211 xref: this.xref, 68212 isEvalSupported: this.isEvalSupported, 68213 fn 68214 }); 68215 } 68216 68217 createFromArray(fnObj) { 68218 return PDFFunction.parseArray({ 68219 xref: this.xref, 68220 isEvalSupported: this.isEvalSupported, 68221 fnObj 68222 }); 68223 } 68224 68225} 68226 68227exports.PDFFunctionFactory = PDFFunctionFactory; 68228 68229function toNumberArray(arr) { 68230 if (!Array.isArray(arr)) { 68231 return null; 68232 } 68233 68234 const length = arr.length; 68235 68236 for (let i = 0; i < length; i++) { 68237 if (typeof arr[i] !== "number") { 68238 const result = new Array(length); 68239 68240 for (let i = 0; i < length; i++) { 68241 result[i] = +arr[i]; 68242 } 68243 68244 return result; 68245 } 68246 } 68247 68248 return arr; 68249} 68250 68251var PDFFunction = function PDFFunctionClosure() { 68252 const CONSTRUCT_SAMPLED = 0; 68253 const CONSTRUCT_INTERPOLATED = 2; 68254 const CONSTRUCT_STICHED = 3; 68255 const CONSTRUCT_POSTSCRIPT = 4; 68256 return { 68257 getSampleArray(size, outputSize, bps, stream) { 68258 var i, ii; 68259 var length = 1; 68260 68261 for (i = 0, ii = size.length; i < ii; i++) { 68262 length *= size[i]; 68263 } 68264 68265 length *= outputSize; 68266 var array = new Array(length); 68267 var codeSize = 0; 68268 var codeBuf = 0; 68269 var sampleMul = 1.0 / (2.0 ** bps - 1); 68270 var strBytes = stream.getBytes((length * bps + 7) / 8); 68271 var strIdx = 0; 68272 68273 for (i = 0; i < length; i++) { 68274 while (codeSize < bps) { 68275 codeBuf <<= 8; 68276 codeBuf |= strBytes[strIdx++]; 68277 codeSize += 8; 68278 } 68279 68280 codeSize -= bps; 68281 array[i] = (codeBuf >> codeSize) * sampleMul; 68282 codeBuf &= (1 << codeSize) - 1; 68283 } 68284 68285 return array; 68286 }, 68287 68288 getIR({ 68289 xref, 68290 isEvalSupported, 68291 fn 68292 }) { 68293 var dict = fn.dict; 68294 68295 if (!dict) { 68296 dict = fn; 68297 } 68298 68299 var types = [this.constructSampled, null, this.constructInterpolated, this.constructStiched, this.constructPostScript]; 68300 var typeNum = dict.get("FunctionType"); 68301 var typeFn = types[typeNum]; 68302 68303 if (!typeFn) { 68304 throw new _util.FormatError("Unknown type of function"); 68305 } 68306 68307 return typeFn.call(this, { 68308 xref, 68309 isEvalSupported, 68310 fn, 68311 dict 68312 }); 68313 }, 68314 68315 fromIR({ 68316 xref, 68317 isEvalSupported, 68318 IR 68319 }) { 68320 var type = IR[0]; 68321 68322 switch (type) { 68323 case CONSTRUCT_SAMPLED: 68324 return this.constructSampledFromIR({ 68325 xref, 68326 isEvalSupported, 68327 IR 68328 }); 68329 68330 case CONSTRUCT_INTERPOLATED: 68331 return this.constructInterpolatedFromIR({ 68332 xref, 68333 isEvalSupported, 68334 IR 68335 }); 68336 68337 case CONSTRUCT_STICHED: 68338 return this.constructStichedFromIR({ 68339 xref, 68340 isEvalSupported, 68341 IR 68342 }); 68343 68344 default: 68345 return this.constructPostScriptFromIR({ 68346 xref, 68347 isEvalSupported, 68348 IR 68349 }); 68350 } 68351 }, 68352 68353 parse({ 68354 xref, 68355 isEvalSupported, 68356 fn 68357 }) { 68358 const IR = this.getIR({ 68359 xref, 68360 isEvalSupported, 68361 fn 68362 }); 68363 return this.fromIR({ 68364 xref, 68365 isEvalSupported, 68366 IR 68367 }); 68368 }, 68369 68370 parseArray({ 68371 xref, 68372 isEvalSupported, 68373 fnObj 68374 }) { 68375 if (!Array.isArray(fnObj)) { 68376 return this.parse({ 68377 xref, 68378 isEvalSupported, 68379 fn: fnObj 68380 }); 68381 } 68382 68383 var fnArray = []; 68384 68385 for (var j = 0, jj = fnObj.length; j < jj; j++) { 68386 fnArray.push(this.parse({ 68387 xref, 68388 isEvalSupported, 68389 fn: xref.fetchIfRef(fnObj[j]) 68390 })); 68391 } 68392
68393 return function (src, srcOffset, dest, destOffset) { 68394 for (var i = 0, ii = fnArray.length; i < ii; i++) { 68395 fnArray[i](src, srcOffset, dest, destOffset + i); 68396 } 68397 }; 68398 }, 68399 68400 constructSampled({ 68401 xref, 68402 isEvalSupported, 68403 fn, 68404 dict 68405 }) { 68406 function toMultiArray(arr) { 68407 var inputLength = arr.length; 68408 var out = []; 68409 var index = 0; 68410 68411 for (var i = 0; i < inputLength; i += 2) { 68412 out[index] = [arr[i], arr[i + 1]]; 68413 ++index; 68414 } 68415 68416 return out; 68417 } 68418 68419 var domain = toNumberArray(dict.getArray("Domain")); 68420 var range = toNumberArray(dict.getArray("Range")); 68421 68422 if (!domain || !range) { 68423 throw new _util.FormatError("No domain or range"); 68424 } 68425 68426 var inputSize = domain.length / 2; 68427 var outputSize = range.length / 2; 68428 domain = toMultiArray(domain); 68429 range = toMultiArray(range); 68430 var size = toNumberArray(dict.getArray("Size")); 68431 var bps = dict.get("BitsPerSample"); 68432 var order = dict.get("Order") || 1; 68433 68434 if (order !== 1) { 68435 (0, _util.info)("No support for cubic spline interpolation: " + order); 68436 } 68437 68438 var encode = toNumberArray(dict.getArray("Encode")); 68439 68440 if (!encode) { 68441 encode = []; 68442 68443 for (var i = 0; i < inputSize; ++i) { 68444 encode.push([0, size[i] - 1]); 68445 } 68446 } else { 68447 encode = toMultiArray(encode); 68448 } 68449 68450 var decode = toNumberArray(dict.getArray("Decode")); 68451 68452 if (!decode) { 68453 decode = range; 68454 } else { 68455 decode = toMultiArray(decode); 68456 } 68457 68458 var samples = this.getSampleArray(size, outputSize, bps, fn); 68459 return [CONSTRUCT_SAMPLED, inputSize, domain, encode, decode, samples, size, outputSize, 2 ** bps - 1, range]; 68460 }, 68461 68462 constructSampledFromIR({ 68463 xref, 68464 isEvalSupported, 68465 IR 68466 }) { 68467 function interpolate(x, xmin, xmax, ymin, ymax) { 68468 return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin)); 68469 } 68470 68471 return function constructSampledFromIRResult(src, srcOffset, dest, destOffset) { 68472 var m = IR[1]; 68473 var domain = IR[2]; 68474 var encode = IR[3]; 68475 var decode = IR[4]; 68476 var samples = IR[5]; 68477 var size = IR[6]; 68478 var n = IR[7]; 68479 var range = IR[9]; 68480 var cubeVertices = 1 << m; 68481 var cubeN = new Float64Array(cubeVertices); 68482 var cubeVertex = new Uint32Array(cubeVertices); 68483 var i, j; 68484 68485 for (j = 0; j < cubeVertices; j++) { 68486 cubeN[j] = 1; 68487 } 68488 68489 var k = n, 68490 pos = 1; 68491 68492 for (i = 0; i < m; ++i) { 68493 var domain_2i = domain[i][0]; 68494 var domain_2i_1 = domain[i][1]; 68495 var xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1); 68496 var e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]); 68497 var size_i = size[i]; 68498 e = Math.min(Math.max(e, 0), size_i - 1); 68499 var e0 = e < size_i - 1 ? Math.floor(e) : e - 1; 68500 var n0 = e0 + 1 - e; 68501 var n1 = e - e0; 68502 var offset0 = e0 * k; 68503 var offset1 = offset0 + k; 68504 68505 for (j = 0; j < cubeVertices; j++) { 68506 if (j & pos) { 68507 cubeN[j] *= n1; 68508 cubeVertex[j] += offset1; 68509 } else { 68510 cubeN[j] *= n0; 68511 cubeVertex[j] += offset0; 68512 } 68513 } 68514 68515 k *= size_i; 68516 pos <<= 1; 68517 } 68518 68519 for (j = 0; j < n; ++j) { 68520 var rj = 0; 68521 68522 for (i = 0; i < cubeVertices; i++) { 68523 rj += samples[cubeVertex[i] + j] * cubeN[i]; 68524 } 68525 68526 rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]); 68527 dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]); 68528 } 68529 }; 68530 }, 68531 68532 constructInterpolated({ 68533 xref, 68534 isEvalSupported, 68535 fn, 68536 dict 68537 }) { 68538 var c0 = toNumberArray(dict.getArray("C0")) || [0]; 68539 var c1 = toNumberArray(dict.getArray("C1")) || [1]; 68540 var n = dict.get("N"); 68541 var length = c0.length; 68542 var diff = []; 68543 68544 for (var i = 0; i < length; ++i) { 68545 diff.push(c1[i] - c0[i]); 68546 } 68547 68548 return [CONSTRUCT_INTERPOLATED, c0, diff, n]; 68549 }, 68550 68551 constructInterpolatedFromIR({ 68552 xref, 68553 isEvalSupported, 68554 IR 68555 }) { 68556 var c0 = IR[1]; 68557 var diff = IR[2]; 68558 var n = IR[3]; 68559 var length = diff.length; 68560 return function constructInterpolatedFromIRResult(src, srcOffset, dest, destOff
68560set) { 68561 var x = n === 1 ? src[srcOffset] : src[srcOffset] ** n; 68562 68563 for (var j = 0; j < length; ++j) { 68564 dest[destOffset + j] = c0[j] + x * diff[j]; 68565 } 68566 }; 68567 }, 68568 68569 constructStiched({ 68570 xref, 68571 isEvalSupported, 68572 fn, 68573 dict 68574 }) { 68575 var domain = toNumberArray(dict.getArray("Domain")); 68576 68577 if (!domain) { 68578 throw new _util.FormatError("No domain"); 68579 } 68580 68581 var inputSize = domain.length / 2; 68582 68583 if (inputSize !== 1) { 68584 throw new _util.FormatError("Bad domain for stiched function"); 68585 } 68586 68587 var fnRefs = dict.get("Functions"); 68588 var fns = []; 68589 68590 for (var i = 0, ii = fnRefs.length; i < ii; ++i) { 68591 fns.push(this.parse({ 68592 xref, 68593 isEvalSupported, 68594 fn: xref.fetchIfRef(fnRefs[i]) 68595 })); 68596 } 68597 68598 var bounds = toNumberArray(dict.getArray("Bounds")); 68599 var encode = toNumberArray(dict.getArray("Encode")); 68600 return [CONSTRUCT_STICHED, domain, bounds, encode, fns]; 68601 }, 68602 68603 constructStichedFromIR({ 68604 xref, 68605 isEvalSupported, 68606 IR 68607 }) { 68608 var domain = IR[1]; 68609 var bounds = IR[2]; 68610 var encode = IR[3]; 68611 var fns = IR[4]; 68612 var tmpBuf = new Float32Array(1); 68613 return function constructStichedFromIRResult(src, srcOffset, dest, destOffset) { 68614 var clip = function constructStichedFromIRClip(v, min, max) { 68615 if (v > max) { 68616 v = max; 68617 } else if (v < min) { 68618 v = min; 68619 } 68620 68621 return v; 68622 }; 68623 68624 var v = clip(src[srcOffset], domain[0], domain[1]); 68625 68626 for (var i = 0, ii = bounds.length; i < ii; ++i) { 68627 if (v < bounds[i]) { 68628 break; 68629 } 68630 } 68631 68632 var dmin = domain[0]; 68633 68634 if (i > 0) { 68635 dmin = bounds[i - 1]; 68636 } 68637 68638 var dmax = domain[1]; 68639 68640 if (i < bounds.length) { 68641 dmax = bounds[i]; 68642 } 68643 68644 var rmin = encode[2 * i]; 68645 var rmax = encode[2 * i + 1]; 68646 tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin); 68647 fns[i](tmpBuf, 0, dest, destOffset); 68648 }; 68649 }, 68650 68651 constructPostScript({ 68652 xref, 68653 isEvalSupported, 68654 fn, 68655 dict 68656 }) { 68657 var domain = toNumberArray(dict.getArray("Domain")); 68658 var range = toNumberArray(dict.getArray("Range")); 68659 68660 if (!domain) { 68661 throw new _util.FormatError("No domain."); 68662 } 68663 68664 if (!range) { 68665 throw new _util.FormatError("No range."); 68666 } 68667 68668 var lexer = new _ps_parser.PostScriptLexer(fn); 68669 var parser = new _ps_parser.PostScriptParser(lexer); 68670 var code = parser.parse(); 68671 return [CONSTRUCT_POSTSCRIPT, domain, range, code]; 68672 }, 68673 68674 constructPostScriptFromIR({ 68675 xref, 68676 isEvalSupported, 68677 IR 68678 }) { 68679 var domain = IR[1]; 68680 var range = IR[2]; 68681 var code = IR[3]; 68682 68683 if (isEvalSupported && _util.IsEvalSupportedCached.value) { 68684 const compiled = new PostScriptCompiler().compile(code, domain, range); 68685 68686 if (compiled) { 68687 return new Function("src", "srcOffset", "dest", "destOffset", compiled); 68688 } 68689 } 68690 68691 (0, _util.info)("Unable to compile PS function"); 68692 var numOutputs = range.length >> 1; 68693 var numInputs = domain.length >> 1; 68694 var evaluator = new PostScriptEvaluator(code); 68695 var cache = Object.create(null); 68696 var MAX_CACHE_SIZE = 2048 * 4; 68697 var cache_available = MAX_CACHE_SIZE; 68698 var tmpBuf = new Float32Array(numInputs); 68699 return function constructPostScriptFromIRResult(src, srcOffset, dest, destOffset) { 68700 var i, value; 68701 var key = ""; 68702 var input = tmpBuf; 68703 68704 for (i = 0; i < numInputs; i++) { 68705 value = src[srcOffset + i]; 68706 input[i] = value; 68707 key += value + "_"; 68708 } 68709 68710 var cachedValue = cache[key]; 68711 68712 if (cachedValue !== undefined) { 68713 dest.set(cachedValue, destOffset); 68714 return; 68715 } 68716 68717 var output = new Float32Array(numOutputs); 68718 var stack = evaluator.execute(input); 68719 var stackIndex = stack.length - numOutputs; 68720 68721 for (i = 0; i < numOutputs; i++) { 68722 value = stack[stackIndex + i]; 68723 var bound = range[i * 2]; 68724 68725 if (value < bound) { 68726 value = bound; 68727 } else { 68728 bound = range[i * 2 + 1]; 68729 68730 if (value > bound) { 68731 value = bound; 68732 } 68733 } 68734 68735 output[i] = value; 68736 } 68737 68738 if (cache_available > 0) { 68739 cache_available--; 68740 cache[key] = output; 68741 } 68742
vendor: 16,236 bytes, lines 68743-69439
68743 dest.set(output, destOffset); 68744 }; 68745 } 68746 68747 }; 68748}(); 68749 68750function isPDFFunction(v) { 68751 var fnDict; 68752 68753 if (typeof v !== "object") { 68754 return false; 68755 } else if ((0, _primitives.isDict)(v)) { 68756 fnDict = v; 68757 } else if ((0, _primitives.isStream)(v)) { 68758 fnDict = v.dict; 68759 } else { 68760 return false; 68761 } 68762 68763 return fnDict.has("FunctionType"); 68764} 68765 68766var PostScriptStack = function PostScriptStackClosure() { 68767 var MAX_STACK_SIZE = 100; 68768 68769 function PostScriptStack(initialStack) { 68770 this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0); 68771 } 68772 68773 PostScriptStack.prototype = { 68774 push: function PostScriptStack_push(value) { 68775 if (this.stack.length >= MAX_STACK_SIZE) { 68776 throw new Error("PostScript function stack overflow."); 68777 } 68778 68779 this.stack.push(value); 68780 }, 68781 pop: function PostScriptStack_pop() { 68782 if (this.stack.length <= 0) { 68783 throw new Error("PostScript function stack underflow."); 68784 } 68785 68786 return this.stack.pop(); 68787 }, 68788 copy: function PostScriptStack_copy(n) { 68789 if (this.stack.length + n >= MAX_STACK_SIZE) { 68790 throw new Error("PostScript function stack overflow."); 68791 } 68792 68793 var stack = this.stack; 68794 68795 for (var i = stack.length - n, j = n - 1; j >= 0; j--, i++) { 68796 stack.push(stack[i]); 68797 } 68798 }, 68799 index: function PostScriptStack_index(n) { 68800 this.push(this.stack[this.stack.length - n - 1]); 68801 }, 68802 roll: function PostScriptStack_roll(n, p) { 68803 var stack = this.stack; 68804 var l = stack.length - n; 68805 var r = stack.length - 1, 68806 c = l + (p - Math.floor(p / n) * n), 68807 i, 68808 j, 68809 t; 68810 68811 for (i = l, j = r; i < j; i++, j--) { 68812 t = stack[i]; 68813 stack[i] = stack[j]; 68814 stack[j] = t; 68815 } 68816 68817 for (i = l, j = c - 1; i < j; i++, j--) { 68818 t = stack[i]; 68819 stack[i] = stack[j]; 68820 stack[j] = t; 68821 } 68822 68823 for (i = c, j = r; i < j; i++, j--) { 68824 t = stack[i]; 68825 stack[i] = stack[j]; 68826 stack[j] = t; 68827 } 68828 } 68829 }; 68830 return PostScriptStack; 68831}(); 68832 68833var PostScriptEvaluator = function PostScriptEvaluatorClosure() { 68834 function PostScriptEvaluator(operators) { 68835 this.operators = operators; 68836 } 68837 68838 PostScriptEvaluator.prototype = { 68839 execute: function PostScriptEvaluator_execute(initialStack) { 68840 var stack = new PostScriptStack(initialStack); 68841 var counter = 0; 68842 var operators = this.operators; 68843 var length = operators.length; 68844 var operator, a, b; 68845 68846 while (counter < length) { 68847 operator = operators[counter++]; 68848 68849 if (typeof operator === "number") { 68850 stack.push(operator); 68851 continue; 68852 } 68853 68854 switch (operator) { 68855 case "jz": 68856 b = stack.pop(); 68857 a = stack.pop(); 68858 68859 if (!a) { 68860 counter = b; 68861 } 68862 68863 break; 68864 68865 case "j": 68866 a = stack.pop(); 68867 counter = a; 68868 break; 68869 68870 case "abs": 68871 a = stack.pop(); 68872 stack.push(Math.abs(a)); 68873 break; 68874 68875 case "add": 68876 b = stack.pop(); 68877 a = stack.pop(); 68878 stack.push(a + b); 68879 break; 68880 68881 case "and": 68882 b = stack.pop(); 68883 a = stack.pop(); 68884 68885 if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) { 68886 stack.push(a && b); 68887 } else { 68888 stack.push(a & b); 68889 } 68890 68891 break; 68892 68893 case "atan": 68894 a = stack.pop(); 68895 stack.push(Math.atan(a)); 68896 break; 68897 68898 case "bitshift": 68899 b = stack.pop(); 68900 a = stack.pop(); 68901 68902 if (a > 0) { 68903 stack.push(a << b); 68904 } else { 68905 stack.push(a >> b); 68906 } 68907 68908 break; 68909 68910 case "ceiling": 68911 a = stack.pop(); 68912 stack.push(Math.ceil(a)); 68913 break; 68914 68915 case "copy": 68916 a = stack.pop(); 68917 stack.copy(a); 68918 break; 68919 68920 case "cos": 68921 a = stack.pop(); 68922 stack.push(Math.cos(a)); 68923 break; 68924 68925 case "cvi": 68926 a = stack.pop() | 0; 68927 stack.push(a); 68928 break; 68929 68930 case "cvr": 68931 break; 68932 68933 case "div": 68934 b = stack.pop(); 68935 a = stack.pop(); 68936 stack.push(a / b); 68937 break; 68938 68939 case "dup": 68940 stack.copy(1); 68941 break; 68942 68943 case "eq": 68944 b = stack.pop(); 68945 a = stack.pop(); 68946 stack.push(a === b); 68947 break; 68948 68949 case "exch": 68950 stack.roll(2, 1); 68951 break; 68952 68953 case "exp": 68954 b = stack.pop(); 68955 a = stack.pop(); 68956 stack.push(a ** b); 68957 break; 68958 68959 case "false": 68960 stack.push(false); 68961 break; 68962 68963 case "floor": 68964 a = stack.pop(); 68965 stack.push(Math.floor(a)); 68966 break; 68967 68968 case "ge": 68969 b = stack.pop(); 68970 a = stack.pop(); 68971 stack.push(a >= b); 68972 break; 68973 68974 case "gt": 68975 b = stack.pop(); 68976 a = stack.pop(); 68977 stack.push(a > b); 68978 break; 68979 68980 case "idiv": 68981 b = stack.pop(); 68982 a = stack.pop(); 68983 stack.push(a / b | 0); 68984 break; 68985 68986 case "index": 68987 a = stack.pop(); 68988 stack.index(a); 68989 break; 68990 68991 case "le": 68992 b = stack.pop(); 68993 a = stack.pop(); 68994 stack.push(a <= b); 68995 break; 68996 68997 case "ln": 68998 a = stack.pop(); 68999 stack.push(Math.log(a)); 69000 break; 69001 69002 case "log": 69003 a = stack.pop(); 69004 stack.push(Math.log(a) / Math.LN10); 69005 break; 69006 69007 case "lt": 69008 b = stack.pop(); 69009 a = stack.pop(); 69010 stack.push(a < b); 69011 break; 69012 69013 case "mod": 69014 b = stack.pop(); 69015 a = stack.pop(); 69016 stack.push(a % b); 69017 break; 69018 69019 case "mul": 69020 b = stack.pop(); 69021 a = stack.pop(); 69022 stack.push(a * b); 69023 break; 69024 69025 case "ne": 69026 b = stack.pop(); 69027 a = stack.pop(); 69028 stack.push(a !== b); 69029 break; 69030 69031 case "neg": 69032 a = stack.pop(); 69033 stack.push(-a); 69034 break; 69035 69036 case "not": 69037 a = stack.pop(); 69038 69039 if ((0, _util.isBool)(a)) { 69040 stack.push(!a); 69041 } else { 69042 stack.push(~a); 69043 } 69044 69045 break; 69046 69047 case "or": 69048 b = stack.pop(); 69049 a = stack.pop(); 69050 69051 if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) { 69052 stack.push(a || b); 69053 } else { 69054 stack.push(a | b); 69055 } 69056 69057 break; 69058 69059 case "pop": 69060 stack.pop(); 69061 break; 69062 69063 case "roll": 69064 b = stack.pop(); 69065 a = stack.pop(); 69066 stack.roll(a, b); 69067 break; 69068 69069 case "round": 69070 a = stack.pop(); 69071 stack.push(Math.round(a)); 69072 break; 69073 69074 case "sin": 69075 a = stack.pop(); 69076 stack.push(Math.sin(a)); 69077 break; 69078 69079 case "sqrt": 69080 a = stack.pop(); 69081 stack.push(Math.sqrt(a)); 69082 break; 69083 69084 case "sub": 69085 b = stack.pop(); 69086 a = stack.pop(); 69087 stack.push(a - b); 69088 break; 69089 69090 case "true": 69091 stack.push(true); 69092 break; 69093 69094 case "truncate": 69095 a = stack.pop(); 69096 a = a < 0 ? Math.ceil(a) : Math.floor(a); 69097 stack.push(a); 69098 break; 69099 69100 case "xor": 69101 b = stack.pop(); 69102 a = stack.pop(); 69103 69104 if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) { 69105 stack.push(a !== b); 69106 } else { 69107 stack.push(a ^ b); 69108 } 69109 69110 break; 69111 69112 default: 69113 throw new _util.FormatError(`Unknown operator ${operator}`); 69114 } 69115 } 69116 69117 return stack.stack; 69118 } 69119 }; 69120 return PostScriptEvaluator; 69121}(); 69122 69123exports.PostScriptEvaluator = PostScriptEvaluator; 69124 69125var PostScriptCompiler = function PostScriptCompilerClosure() { 69126 function AstNode(type) { 69127 this.type = type; 69128 } 69129 69130 AstNode.prototype.visit = function (visitor) { 69131 (0, _util.unreachable)("abstract method"); 69132 }; 69133 69134 function AstArgument(index, min, max) { 69135 AstNode.call(this, "args"); 69136 this.index = index; 69137 this.min = min; 69138 this.max = max; 69139 } 69140 69141 AstArgument.prototype = Object.create(AstNode.prototype); 69142 69143 AstArgument.prototype.visit = function (visitor) { 69144 visitor.visitArgument(this); 69145 }; 69146 69147 function AstLiteral(number) { 69148 AstNode.call(this, "literal"); 69149 this.number = number; 69150 this.min = number; 69151 this.max = number; 69152 } 69153 69154 AstLiteral.prototype = Object.create(AstNode.prototype); 69155 69156 AstLiteral.prototype.visit = function (visitor) { 69157 visitor.visitLiteral(this); 69158 }; 69159 69160 function AstBinaryOperation(op, arg1, arg2, min, max) { 69161 AstNode.call(this, "binary"); 69162 this.op = op; 69163 this.arg1 = arg1; 69164 this.arg2 = arg2; 69165 this.min = min; 69166 this.max = max; 69167 } 69168 69169 AstBinaryOperation.prototype = Object.create(AstNode.prototype); 69170 69171 AstBinaryOperation.prototype.visit = function (visitor) { 69172 visitor.visitBinaryOperation(this); 69173 }; 69174 69175 function AstMin(arg, max) { 69176 AstNode.call(this, "max"); 69177 this.arg = arg; 69178 this.min = arg.min; 69179 this.max = max; 69180 } 69181 69182 AstMin.prototype = Object.create(AstNode.prototype); 69183 69184 AstMin.prototype.visit = function (visitor) { 69185 visitor.visitMin(this); 69186 }; 69187 69188 function AstVariable(index, min, max) { 69189 AstNode.call(this, "var"); 69190 this.index = index; 69191 this.min = min; 69192 this.max = max; 69193 } 69194 69195 AstVariable.prototype = Object.create(AstNode.prototype); 69196 69197 AstVariable.prototype.visit = function (visitor) { 69198 visitor.visitVariable(this); 69199 }; 69200 69201 function AstVariableDefinition(variable, arg) { 69202 AstNode.call(this, "definition"); 69203 this.variable = variable; 69204 this.arg = arg; 69205 } 69206 69207 AstVariableDefinition.prototype = Object.create(AstNode.prototype); 69208 69209 AstVariableDefinition.prototype.visit = function (visitor) { 69210 visitor.visitVariableDefinition(this); 69211 }; 69212 69213 function ExpressionBuilderVisitor() { 69214 this.parts = []; 69215 } 69216 69217 ExpressionBuilderVisitor.prototype = { 69218 visitArgument(arg) { 69219 this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))"); 69220 }, 69221 69222 visitVariable(variable) { 69223 this.parts.push("v", variable.index); 69224 }, 69225 69226 visitLiteral(literal) { 69227 this.parts.push(literal.number); 69228 }, 69229 69230 visitBinaryOperation(operation) { 69231 this.parts.push("("); 69232 operation.arg1.visit(this); 69233 this.parts.push(" ", operation.op, " "); 69234 operation.arg2.visit(this); 69235 this.parts.push(")"); 69236 }, 69237 69238 visitVariableDefinition(definition) { 69239 this.parts.push("var "); 69240 definition.variable.visit(this); 69241 this.parts.push(" = "); 69242 definition.arg.visit(this); 69243 this.parts.push(";"); 69244 }, 69245 69246 visitMin(max) { 69247 this.parts.push("Math.min("); 69248 max.arg.visit(this); 69249 this.parts.push(", ", max.max, ")"); 69250 }, 69251 69252 toString() { 69253 return this.parts.join(""); 69254 } 69255 69256 }; 69257 69258 function buildAddOperation(num1, num2) { 69259 if (num2.type === "literal" && num2.number === 0) { 69260 return num1; 69261 } 69262 69263 if (num1.type === "literal" && num1.number === 0) { 69264 return num2; 69265 } 69266 69267 if (num2.type === "literal" && num1.type === "literal") { 69268 return new AstLiteral(num1.number + num2.number); 69269 } 69270 69271 return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max); 69272 } 69273 69274 function buildMulOperation(num1, num2) { 69275 if (num2.type === "literal") { 69276 if (num2.number === 0) { 69277 return new AstLiteral(0); 69278 } else if (num2.number === 1) { 69279 return num1; 69280 } else if (num1.type === "literal") { 69281 return new AstLiteral(num1.number * num2.number); 69282 } 69283 } 69284 69285 if (num1.type === "literal") { 69286 if (num1.number === 0) { 69287 return new AstLiteral(0); 69288 } else if (num1.number === 1) { 69289 return num2; 69290 } 69291 } 69292 69293 var min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max); 69294 var max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max); 69295 return new AstBinaryOperation("*", num1, num2, min, max); 69296 } 69297 69298 function buildSubOperation(num1, num2) { 69299 if (num2.type === "literal") { 69300 if (num2.number === 0) { 69301 return num1; 69302 } else if (num1.type === "literal") { 69303 return new AstLiteral(num1.number - num2.number); 69304 } 69305 } 69306 69307 if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) { 69308 return num2.arg2; 69309 } 69310 69311 return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min); 69312 } 69313 69314 function buildMinOperation(num1, max) { 69315 if (num1.min >= max) { 69316 return new AstLiteral(max); 69317 } else if (num1.max <= max) { 69318 return num1; 69319 } 69320 69321 return new AstMin(num1, max); 69322 } 69323 69324 function PostScriptCompiler() {} 69325 69326 PostScriptCompiler.prototype = { 69327 compile: function PostScriptCompiler_compile(code, domain, range) { 69328 var stack = []; 69329 var i, ii; 69330 var instructions = []; 69331 var inputSize = domain.length >> 1, 69332 outputSize = range.length >> 1; 69333 var lastRegister = 0; 69334 var n, j; 69335 var num1, num2, ast1, ast2, tmpVar, item; 69336 69337 for (i = 0; i < inputSize; i++) { 69338 stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1])); 69339 } 69340 69341 for (i = 0, ii = code.length; i < ii; i++) { 69342 item = code[i]; 69343 69344 if (typeof item === "number") { 69345 stack.push(new AstLiteral(item)); 69346 continue; 69347 } 69348 69349 switch (item) { 69350 case "add": 69351 if (stack.length < 2) { 69352 return null; 69353 } 69354 69355 num2 = stack.pop(); 69356 num1 = stack.pop(); 69357 stack.push(buildAddOperation(num1, num2)); 69358 break; 69359 69360 case "cvr": 69361 if (stack.length < 1) { 69362 return null; 69363 } 69364 69365 break; 69366 69367 case "mul": 69368 if (stack.length < 2) { 69369 return null; 69370 } 69371 69372 num2 = stack.pop(); 69373 num1 = stack.pop(); 69374 stack.push(buildMulOperation(num1, num2)); 69375 break; 69376 69377 case "sub": 69378 if (stack.length < 2) { 69379 return null; 69380 } 69381 69382 num2 = stack.pop(); 69383 num1 = stack.pop(); 69384 stack.push(buildSubOperation(num1, num2)); 69385 break; 69386 69387 case "exch": 69388 if (stack.length < 2) { 69389 return null; 69390 } 69391 69392 ast1 = stack.pop(); 69393 ast2 = stack.pop(); 69394 stack.push(ast1, ast2); 69395 break; 69396 69397 case "pop": 69398 if (stack.length < 1) { 69399 return null; 69400 } 69401 69402 stack.pop(); 69403 break; 69404 69405 case "index": 69406 if (stack.length < 1) { 69407 return null; 69408 } 69409 69410 num1 = stack.pop(); 69411 69412 if (num1.type !== "literal") { 69413 return null; 69414 } 69415 69416 n = num1.number; 69417 69418 if (n < 0 || !Number.isInteger(n) || stack.length < n) { 69419 return null; 69420 } 69421 69422 ast1 = stack[stack.length - n - 1]; 69423 69424 if (ast1.type === "literal" || ast1.type === "var") { 69425 stack.push(ast1); 69426 break; 69427 } 69428 69429 tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max); 69430 stack[stack.length - n - 1] = tmpVar; 69431 stack.push(tmpVar); 69432 instructions.push(new AstVariableDefinition(tmpVar, ast1)); 69433 break; 69434 69435 case "dup": 69436 if (stack.length < 1) { 69437 return null; 69438 } 69439
69440 if (typeof code[i + 1] === "number" && code[i + 2] === "gt" && code[i + 3] === i + 7 && code[i + 4] === "jz" && code[i + 5] === "pop" && code[i + 6] === code[i + 1]) { 69441 num1 = stack.pop(); 69442 stack.push(buildMinOperation(num1, code[i + 1])); 69443 i += 6; 69444 break; 69445 } 69446 69447 ast1 = stack[stack.length - 1]; 69448 69449 if (ast1.type === "literal" || ast1.type === "var") { 69450 stack.push(ast1); 69451 break; 69452 } 69453 69454 tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max); 69455 stack[stack.length - 1] = tmpVar; 69456 stack.push(tmpVar); 69457 instructions.push(new AstVariableDefinition(tmpVar, ast1)); 69458 break; 69459 69460 case "roll": 69461 if (stack.length < 2) { 69462 return null; 69463 } 69464 69465 num2 = stack.pop(); 69466 num1 = stack.pop(); 69467 69468 if (num2.type !== "literal" || num1.type !== "literal") { 69469 return null; 69470 } 69471 69472 j = num2.number; 69473 n = num1.number; 69474 69475 if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) { 69476 return null; 69477 } 69478 69479 j = (j % n + n) % n; 69480 69481 if (j === 0) { 69482 break; 69483 } 69484 69485 Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j)); 69486 break; 69487 69488 default: 69489 return null; 69490 } 69491 } 69492 69493 if (stack.length !== outputSize) { 69494 return null; 69495 } 69496 69497 var result = []; 69498 instructions.forEach(function (instruction) { 69499 var statementBuilder = new ExpressionBuilderVisitor(); 69500 instruction.visit(statementBuilder); 69501 result.push(statementBuilder.toString()); 69502 }); 69503 stack.forEach(function (expr, i) { 69504 var statementBuilder = new ExpressionBuilderVisitor(); 69505 expr.visit(statementBuilder); 69506 var min = range[i * 2], 69507 max = range[i * 2 + 1]; 69508 var out = [statementBuilder.toString()]; 69509 69510 if (min > expr.min) { 69511 out.unshift("Math.max(", min, ", "); 69512 out.push(")"); 69513 } 69514 69515 if (max < expr.max) { 69516 out.unshift("Math.min(", max, ", "); 69517 out.push(")"); 69518 } 69519 69520 out.unshift("dest[destOffset + ", i, "] = "); 69521 out.push(";"); 69522 result.push(out.join("")); 69523 }); 69524 return result.join("\n"); 69525 } 69526 }; 69527 return PostScriptCompiler; 69528}(); 69529 69530exports.PostScriptCompiler = PostScriptCompiler; 69531 69532/***/ }), 69533/* 40 */ 69534/***/ (function(module, exports, __w_pdfjs_require__) { 69535 69536"use strict"; 69537 69538 69539Object.defineProperty(exports, "__esModule", { 69540 value: true 69541}); 69542exports.PostScriptParser = exports.PostScriptLexer = void 0; 69543 69544var _util = __w_pdfjs_require__(2); 69545 69546var _primitives = __w_pdfjs_require__(4); 69547 69548var _core_utils = __w_pdfjs_require__(7); 69549 69550class PostScriptParser { 69551 constructor(lexer) { 69552 this.lexer = lexer; 69553 this.operators = []; 69554 this.token = null; 69555 this.prev = null; 69556 } 69557 69558 nextToken() { 69559 this.prev = this.token; 69560 this.token = this.lexer.getToken(); 69561 } 69562 69563 accept(type) { 69564 if (this.token.type === type) { 69565 this.nextToken(); 69566 return true; 69567 } 69568 69569 return false; 69570 } 69571 69572 expect(type) { 69573 if (this.accept(type)) { 69574 return true; 69575 } 69576 69577 throw new _util.FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`); 69578 } 69579 69580 parse() { 69581 this.nextToken(); 69582 this.expect(PostScriptTokenTypes.LBRACE); 69583 this.parseBlock(); 69584 this.expect(PostScriptTokenTypes.RBRACE); 69585 return this.operators; 69586 } 69587 69588 parseBlock() { 69589 while (true) { 69590 if (this.accept(PostScriptTokenTypes.NUMBER)) { 69591 this.operators.push(this.prev.value); 69592 } else if (this.accept(PostScriptTokenTypes.OPERATOR)) { 69593 this.operators.push(this.prev.value); 69594 } else if (this.accept(PostScriptTokenTypes.LBRACE)) { 69595 this.parseCondition(); 69596 } else { 69597 return; 69598 } 69599 } 69600 } 69601 69602 parseCondition() { 69603 const conditionLocation = this.operators.length; 69604 this.operators.push(null, null); 69605 this.parseBlock(); 69606 this.expect(PostScriptTokenTypes.RBRACE); 69607 69608 if (this.accept(PostScriptTokenTypes.IF)) { 69609 this.operators[conditionLocation] = this.operators.length; 69610 this.operators[conditionLocation + 1] = "jz"; 69611 } else if (this.accept(PostScriptTokenTypes.LBRACE)) { 69612 const jumpLocation = this.operators.length; 69613 this.operators.push(null, null); 69614 const endOfTrue = this.operators.length; 69615 this.parseBlock(); 69616 this.expect(PostScriptTokenTypes.RBRACE); 69617 this.expect(PostScriptTokenTypes.IFELSE); 69618 this.operators[jumpLocation] = this.operators.length; 69619 this.operators[jumpLocation + 1] = "j"; 69620 this.operators[conditionLocation] = endOfTrue; 69621 this.operators[conditionLocation + 1] = "jz"; 69622 } else { 69623 throw new _util.FormatError("PS Function: error parsing conditional."); 69624 } 69625 } 69626 69627} 69628 69629exports.PostScriptParser = PostScriptParser; 69630const PostScriptTokenTypes = { 69631 LBRACE: 0, 69632 RBRACE: 1, 69633 NUMBER: 2, 69634 OPERATOR: 3, 69635 IF: 4, 69636 IFELSE: 5 69637}; 69638 69639const PostScriptToken = function PostScriptTokenClosure() { 69640 const opCache = Object.create(null); 69641 69642 class PostScriptToken { 69643 constructor(type, value) { 69644 this.type = type; 69645 this.value = value; 69646 } 69647 69648 static getOperator(op) { 69649 const opValue = opCache[op]; 69650 69651 if (opValue) { 69652 return opValue; 69653 } 69654 69655 return opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op); 69656 } 69657 69658 static get LBRACE() { 69659 return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{")); 69660 } 69661 69662 static get RBRACE() { 69663 return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}")); 69664 } 69665 69666 static get IF() { 69667 return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF")); 69668 } 69669 69670 static get IFELSE() { 69671 return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE")); 69672 } 69673 69674 } 69675 69676 return PostScriptToken; 69677}(); 69678 69679class PostScriptLexer { 69680 constructor(stream) { 69681 this.stream = stream; 69682 this.nextChar(); 69683 this.strBuf = []; 69684 } 69685 69686 nextChar() { 69687 return this.currentChar = this.stream.getByte(); 69688 } 69689 69690 getToken() {
vendor: 1,424 bytes, lines 69691-69759
69691 let comment = false; 69692 let ch = this.currentChar; 69693 69694 while (true) { 69695 if (ch < 0) { 69696 return _primitives.EOF; 69697 } 69698 69699 if (comment) { 69700 if (ch === 0x0a || ch === 0x0d) { 69701 comment = false; 69702 } 69703 } else if (ch === 0x25) { 69704 comment = true; 69705 } else if (!(0, _core_utils.isWhiteSpace)(ch)) { 69706 break; 69707 } 69708 69709 ch = this.nextChar(); 69710 } 69711 69712 switch (ch | 0) { 69713 case 0x30: 69714 case 0x31: 69715 case 0x32: 69716 case 0x33: 69717 case 0x34: 69718 case 0x35: 69719 case 0x36: 69720 case 0x37: 69721 case 0x38: 69722 case 0x39: 69723 case 0x2b: 69724 case 0x2d: 69725 case 0x2e: 69726 return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber()); 69727 69728 case 0x7b: 69729 this.nextChar(); 69730 return PostScriptToken.LBRACE; 69731 69732 case 0x7d: 69733 this.nextChar(); 69734 return PostScriptToken.RBRACE; 69735 } 69736 69737 const strBuf = this.strBuf; 69738 strBuf.length = 0; 69739 strBuf[0] = String.fromCharCode(ch); 69740 69741 while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) { 69742 strBuf.push(String.fromCharCode(ch)); 69743 } 69744 69745 const str = strBuf.join(""); 69746 69747 switch (str.toLowerCase()) { 69748 case "if": 69749 return PostScriptToken.IF; 69750 69751 case "ifelse": 69752 return PostScriptToken.IFELSE; 69753 69754 default: 69755 return PostScriptToken.getOperator(str); 69756 } 69757 } 69758 69759 getNumber() {
69760 let ch = this.currentChar; 69761 const strBuf = this.strBuf; 69762 strBuf.length = 0; 69763 strBuf[0] = String.fromCharCode(ch); 69764 69765 while ((ch = this.nextChar()) >= 0) { 69766 if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) { 69767 strBuf.push(String.fromCharCode(ch)); 69768 } else { 69769 break; 69770 } 69771 } 69772 69773 const value = parseFloat(strBuf.join("")); 69774 69775 if (isNaN(value)) { 69776 throw new _util.FormatError(`Invalid floating point number: ${value}`); 69777 } 69778 69779 return value; 69780 } 69781 69782} 69783 69784exports.PostScriptLexer = PostScriptLexer; 69785 69786/***/ }), 69787/* 41 */ 69788/***/ (function(module, exports, __w_pdfjs_require__) { 69789 69790"use strict"; 69791 69792 69793Object.defineProperty(exports, "__esModule", { 69794 value: true 69795}); 69796exports.MurmurHash3_64 = void 0; 69797 69798var _util = __w_pdfjs_require__(2); 69799 69800const SEED = 0xc3d2e1f0; 69801const MASK_HIGH = 0xffff0000; 69802const MASK_LOW = 0xffff; 69803 69804class MurmurHash3_64 { 69805 constructor(seed) { 69806 this.h1 = seed ? seed & 0xffffffff : SEED; 69807 this.h2 = seed ? seed & 0xffffffff : SEED; 69808 } 69809 69810 update(input) { 69811 let data, length; 69812 69813 if ((0, _util.isString)(input)) { 69814 data = new Uint8Array(input.length * 2); 69815 length = 0; 69816 69817 for (let i = 0, ii = input.length; i < ii; i++) { 69818 const code = input.charCodeAt(i); 69819 69820 if (code <= 0xff) { 69821 data[length++] = code; 69822 } else { 69823 data[length++] = code >>> 8; 69824 data[length++] = code & 0xff; 69825 } 69826 } 69827 } else if ((0, _util.isArrayBuffer)(input)) { 69828 data = input; 69829 length = data.byteLength; 69830 } else { 69831 throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array."); 69832 } 69833 69834 const blockCounts = length >> 2; 69835 const tailLength = length - blockCounts * 4; 69836 const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts); 69837 let k1 = 0, 69838 k2 = 0; 69839 let h1 = this.h1, 69840 h2 = this.h2; 69841 const C1 = 0xcc9e2d51, 69842 C2 = 0x1b873593; 69843 const C1_LOW = C1 & MASK_LOW, 69844 C2_LOW = C2 & MASK_LOW; 69845 69846 for (let i = 0; i < blockCounts; i++) { 69847 if (i & 1) { 69848 k1 = dataUint32[i]; 69849 k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW; 69850 k1 = k1 << 15 | k1 >>> 17; 69851 k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW; 69852 h1 ^= k1; 69853 h1 = h1 << 13 | h1 >>> 19; 69854 h1 = h1 * 5 + 0xe6546b64; 69855 } else { 69856 k2 = dataUint32[i]; 69857 k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW; 69858 k2 = k2 << 15 | k2 >>> 17; 69859 k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW; 69860 h2 ^= k2; 69861 h2 = h2 << 13 | h2 >>> 19; 69862 h2 = h2 * 5 + 0xe6546b64; 69863 } 69864 } 69865 69866 k1 = 0; 69867 69868 switch (tailLength) { 69869 case 3: 69870 k1 ^= data[blockCounts * 4 + 2] << 16; 69871 69872 case 2: 69873 k1 ^= data[blockCounts * 4 + 1] << 8; 69874 69875 case 1: 69876 k1 ^= data[blockCounts * 4]; 69877 k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW; 69878 k1 = k1 << 15 | k1 >>> 17; 69879 k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW; 69880 69881 if (blockCounts & 1) { 69882 h1 ^= k1; 69883 } else { 69884 h2 ^= k1; 69885 } 69886 69887 } 69888 69889 this.h1 = h1; 69890 this.h2 = h2; 69891 } 69892 69893 hexdigest() { 69894 let h1 = this.h1, 69895 h2 = this.h2; 69896 h1 ^= h2 >>> 1; 69897 h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW; 69898 h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16; 69899 h1 ^= h2 >>> 1; 69900 h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW; 69901 h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16; 69902 h1 ^= h2 >>> 1; 69903 const hex1 = (h1 >>> 0).toString(16), 69904 hex2 = (h2 >>> 0).toString(16); 69905 return hex1.padStart(8, "0") + hex2.padStart(8, "0"); 69906 } 69907 69908} 69909 69910exports.MurmurHash3_64 = MurmurHash3_64; 69911 69912/***/ }), 69913/* 42 */ 69914/***/ (function(module, exports, __w_pdfjs_require__) { 69915 69916"use strict"; 69917 69918 69919Object.defineProperty(exports, "__esModule", { 69920 value: true 69921}); 69922exports.NativeImageDecoder = void 0; 69923 69924var _colorspace = __w_pdfjs_require__(22); 69925 69926var _jpeg_stream = __w_pdfjs_require__(17); 69927 69928var _stream = __w_pdfjs_require__(11); 69929 69930class NativeImageDecoder { 69931 constructor({ 69932 xref, 69933 resources, 69934 handler, 69935 forceDataSchema = false, 69936 pdfFunctionFactory 69937 }) { 69938 this.xref = xref; 69939 this.resources = resources; 69940 this.handler = handler; 69941 this.forceDataSchema = forceDataSchema; 69942 this.pdfFunctionFactory = pdfFunctionFactory; 69943 } 69944 69945 canDecode(image) { 69946 return image instanceof _jpeg_stream.JpegStream && NativeImageDecoder.isDecodable(image, this.xref, this.resources, this.pdfFunctionFactory) && image.maybeValidDimensions; 69947 } 69948 69949 decode(image) { 69950 const dict = image.dict;
69951 let colorSpace = dict.get("ColorSpace", "CS"); 69952 colorSpace = _colorspace.ColorSpace.parse(colorSpace, this.xref, this.resources, this.pdfFunctionFactory); 69953 return this.handler.sendWithPromise("JpegDecode", [image.getIR(this.forceDataSchema), colorSpace.numComps]).then(function ({ 69954 data, 69955 width, 69956 height 69957 }) { 69958 return new _stream.Stream(data, 0, data.length, dict); 69959 }); 69960 } 69961 69962 static isSupported(image, xref, res, pdfFunctionFactory) { 69963 const dict = image.dict; 69964 69965 if (dict.has("DecodeParms") || dict.has("DP")) { 69966 return false; 69967 } 69968 69969 const cs = _colorspace.ColorSpace.parse(dict.get("ColorSpace", "CS"), xref, res, pdfFunctionFactory); 69970 69971 return (cs.name === "DeviceGray" || cs.name === "DeviceRGB") && cs.isDefaultDecode(dict.getArray("Decode", "D")); 69972 } 69973 69974 static isDecodable(image, xref, res, pdfFunctionFactory) { 69975 const dict = image.dict; 69976 69977 if (dict.has("DecodeParms") || dict.has("DP")) { 69978 return false; 69979 } 69980 69981 const cs = _colorspace.ColorSpace.parse(dict.get("ColorSpace", "CS"), xref, res, pdfFunctionFactory); 69982 69983 const bpc = dict.get("BitsPerComponent", "BPC") || 1; 69984 return (cs.numComps === 1 || cs.numComps === 3) && cs.isDefaultDecode(dict.getArray("Decode", "D"), bpc); 69985 } 69986 69987} 69988 69989exports.NativeImageDecoder = NativeImageDecoder; 69990 69991/***/ }), 69992/* 43 */ 69993/***/ (function(module, exports, __w_pdfjs_require__) { 69994 69995"use strict"; 69996 69997 69998Object.defineProperty(exports, "__esModule", { 69999 value: true 70000}); 70001exports.PDFImage = void 0; 70002 70003var _util = __w_pdfjs_require__(2); 70004 70005var _primitives = __w_pdfjs_require__(4); 70006 70007var _colorspace = __w_pdfjs_require__(22); 70008 70009var _stream = __w_pdfjs_require__(11); 70010 70011var _jpeg_stream = __w_pdfjs_require__(17); 70012 70013var _jpx = __w_pdfjs_require__(20); 70014 70015var PDFImage = function PDFImageClosure() { 70016 function handleImageData(image, nativeDecoder) { 70017 if (nativeDecoder && nativeDecoder.canDecode(image)) { 70018 return nativeDecoder.decode(image).catch(reason => { 70019 (0, _util.warn)("Native image decoding failed -- trying to recover: " + (reason && reason.message)); 70020 return image; 70021 }); 70022 } 70023 70024 return Promise.resolve(image); 70025 } 70026 70027 function decodeAndClamp(value, addend, coefficient, max) { 70028 value = addend + value * coefficient; 70029 70030 if (value < 0) { 70031 value = 0; 70032 } else if (value > max) { 70033 value = max; 70034 } 70035 70036 return value; 70037 } 70038 70039 function resizeImageMask(src, bpc, w1, h1, w2, h2) { 70040 var length = w2 * h2; 70041 let dest; 70042 70043 if (bpc <= 8) { 70044 dest = new Uint8Array(length); 70045 } else if (bpc <= 16) { 70046 dest = new Uint16Array(length); 70047 } else { 70048 dest = new Uint32Array(length); 70049 } 70050 70051 var xRatio = w1 / w2; 70052 var yRatio = h1 / h2; 70053 var i, 70054 j, 70055 py, 70056 newIndex = 0, 70057 oldIndex; 70058 var xScaled = new Uint16Array(w2); 70059 var w1Scanline = w1; 70060 70061 for (i = 0; i < w2; i++) { 70062 xScaled[i] = Math.floor(i * xRatio); 70063 } 70064 70065 for (i = 0; i < h2; i++) { 70066 py = Math.floor(i * yRatio) * w1Scanline; 70067 70068 for (j = 0; j < w2; j++) { 70069 oldIndex = py + xScaled[j]; 70070 dest[newIndex++] = src[oldIndex]; 70071 } 70072 } 70073 70074 return dest; 70075 } 70076 70077 function PDFImage({ 70078 xref, 70079 res, 70080 image, 70081 isInline = false, 70082 smask = null, 70083 mask = null, 70084 isMask = false, 70085 pdfFunctionFactory 70086 }) { 70087 this.image = image; 70088 var dict = image.dict; 70089 const filter = dict.get("Filter"); 70090 70091 if ((0, _primitives.isName)(filter)) { 70092 switch (filter.name) { 70093 case "JPXDecode": 70094 var jpxImage = new _jpx.JpxImage(); 70095 jpxImage.parseImageProperties(image.stream); 70096 image.stream.reset(); 70097 image.width = jpxImage.width; 70098 image.height = jpxImage.height; 70099 image.bitsPerComponent = jpxImage.bitsPerComponent; 70100 image.numComps = jpxImage.componentsCount; 70101 break; 70102 70103 case "JBIG2Decode": 70104 image.bitsPerComponent = 1; 70105 image.numComps = 1; 70106 break; 70107 } 70108 } 70109 70110 let width = dict.get("Width", "W"); 70111 let height = dict.get("Height", "H"); 70112 70113 if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) { 70114 (0, _util.warn)("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary."); 70115 width = image.width; 70116 height = image.height; 70117 } 70118 70119 if (width < 1 || height < 1) { 70120 throw new _util.FormatError(`Invalid image width: ${width} or height: ${height}`); 70121 } 70122 70123 this.width = width; 70124 this.height = height; 70125 this.interpolate = dict.get("Interpolate", "I") || false; 70126 this.imageMask = dict.get("ImageMask", "IM") || false; 70127 this.matte = dict.get("Matte") || false; 70128 var bitsPerComponent = image.bitsPerComponent; 70129 70130 if (!bitsPerComponent) { 70131 bitsPerComponent = dict.get("BitsPerComponent", "BPC"); 70132 70133 if (!bitsPerComponent) { 70134 if (this.imageMask) { 70135 bitsPerComponent = 1; 70136 } else { 70137 throw new _util.FormatError(`Bits per component missing in image: ${this.imageMask}`); 70138 } 70139 } 70140 } 70141 70142 this.bpc = bitsPerComponent; 70143 70144 if (!this.imageMask) { 70145 var colorSpace = dict.get("ColorSpace", "CS"); 70146 70147 if (!colorSpace) { 70148 (0, _util.info)("JPX images (which do not require color spaces)"); 70149 70150 switch (image.numComps) { 70151 case 1: 70152 colorSpace = _primitives.Name.get("DeviceGray"); 70153 break; 70154 70155 case 3: 70156 colorSpace = _primitives.Name.get("DeviceRGB"); 70157 break; 70158 70159 case 4: 70160 colorSpace = _primitives.Name.get("DeviceCMYK"); 70161 break; 70162 70163 default: 70164 throw new Error(`JPX images with ${image.numComps} ` + "color components not supported."); 70165 } 70166 } 70167 70168 const resources = isInline ? res : null; 70169 this.colorSpace = _colorspace.ColorSpace.parse(colorSpace, xref, resources, pdfFunctionFactory); 70170 this.numComps = this.colorSpace.numComps; 70171 } 70172 70173 this.decode = dict.getArray("Decode", "D"); 70174 this.needsDecode = false;
70175 70176 if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) { 70177 this.needsDecode = true; 70178 var max = (1 << bitsPerComponent) - 1; 70179 this.decodeCoefficients = []; 70180 this.decodeAddends = []; 70181 const isIndexed = this.colorSpace && this.colorSpace.name === "Indexed"; 70182 70183 for (var i = 0, j = 0; i < this.decode.length; i += 2, ++j) { 70184 var dmin = this.decode[i]; 70185 var dmax = this.decode[i + 1]; 70186 this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin; 70187 this.decodeAddends[j] = isIndexed ? dmin : max * dmin; 70188 } 70189 } 70190 70191 if (smask) { 70192 this.smask = new PDFImage({ 70193 xref, 70194 res, 70195 image: smask, 70196 isInline, 70197 pdfFunctionFactory 70198 }); 70199 } else if (mask) { 70200 if ((0, _primitives.isStream)(mask)) { 70201 var maskDict = mask.dict, 70202 imageMask = maskDict.get("ImageMask", "IM"); 70203 70204 if (!imageMask) { 70205 (0, _util.warn)("Ignoring /Mask in image without /ImageMask."); 70206 } else { 70207 this.mask = new PDFImage({ 70208 xref, 70209 res, 70210 image: mask, 70211 isInline, 70212 isMask: true, 70213 pdfFunctionFactory 70214 }); 70215 } 70216 } else { 70217 this.mask = mask; 70218 } 70219 } 70220 } 70221 70222 PDFImage.buildImage = function ({ 70223 handler, 70224 xref, 70225 res, 70226 image, 70227 isInline = false, 70228 nativeDecoder = null, 70229 pdfFunctionFactory 70230 }) { 70231 var imagePromise = handleImageData(image, nativeDecoder); 70232 var smaskPromise; 70233 var maskPromise; 70234 var smask = image.dict.get("SMask"); 70235 var mask = image.dict.get("Mask"); 70236 70237 if (smask) { 70238 smaskPromise = handleImageData(smask, nativeDecoder); 70239 maskPromise = Promise.resolve(null); 70240 } else { 70241 smaskPromise = Promise.resolve(null); 70242 70243 if (mask) { 70244 if ((0, _primitives.isStream)(mask)) { 70245 maskPromise = handleImageData(mask, nativeDecoder); 70246 } else if (Array.isArray(mask)) { 70247 maskPromise = Promise.resolve(mask); 70248 } else { 70249 (0, _util.warn)("Unsupported mask format."); 70250 maskPromise = Promise.resolve(null); 70251 } 70252 } else { 70253 maskPromise = Promise.resolve(null); 70254 } 70255 } 70256 70257 return Promise.all([imagePromise, smaskPromise, maskPromise]).then(function ([imageData, smaskData, maskData]) { 70258 return new PDFImage({ 70259 xref, 70260 res, 70261 image: imageData, 70262 isInline, 70263 smask: smaskData, 70264 mask: maskData, 70265 pdfFunctionFactory 70266 }); 70267 }); 70268 }; 70269 70270 PDFImage.createMask = function ({ 70271 imgArray, 70272 width, 70273 height, 70274 imageIsFromDecodeStream, 70275 inverseDecode 70276 }) { 70277 var computedLength = (width + 7 >> 3) * height; 70278 var actualLength = imgArray.byteLength; 70279 var haveFullData = computedLength === actualLength; 70280 var data, i; 70281 70282 if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) { 70283 data = imgArray; 70284 } else if (!inverseDecode) { 70285 data = new Uint8ClampedArray(actualLength); 70286 data.set(imgArray); 70287 } else { 70288 data = new Uint8ClampedArray(computedLength); 70289 data.set(imgArray); 70290 70291 for (i = actualLength; i < computedLength; i++) { 70292 data[i] = 0xff; 70293 } 70294 } 70295 70296 if (inverseDecode) { 70297 for (i = 0; i < actualLength; i++) { 70298 data[i] ^= 0xff; 70299 } 70300 } 70301 70302 return { 70303 data, 70304 width, 70305 height 70306 }; 70307 }; 70308 70309 PDFImage.prototype = { 70310 get drawWidth() { 70311 return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0); 70312 }, 70313 70314 get drawHeight() { 70315 return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0); 70316 }, 70317 70318 decodeBuffer(buffer) { 70319 var bpc = this.bpc; 70320 var numComps = this.numComps; 70321 var decodeAddends = this.decodeAddends; 70322 var decodeCoefficients = this.decodeCoefficients; 70323 var max = (1 << bpc) - 1; 70324 var i, ii; 70325 70326 if (bpc === 1) { 70327 for (i = 0, ii = buffer.length; i < ii; i++) { 70328 buffer[i] = +!buffer[i]; 70329 } 70330 70331 return; 70332 } 70333 70334 var index = 0; 70335 70336 for (i = 0, ii = this.width * this.height; i < ii; i++) { 70337 for (var j = 0; j < numComps; j++) { 70338 buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max); 70339 index++; 70340 } 70341 } 70342 }, 70343 70344 getComponents(buffer) { 70345 var bpc = this.bpc; 70346 70347 if (bpc === 8) { 70348 return buffer; 70349 } 70350 70351 var width = this.width; 70352 var height = this.height; 70353 var numComps = this.numComps;
70354 var length = width * height * numComps; 70355 var bufferPos = 0; 70356 let output; 70357 70358 if (bpc <= 8) { 70359 output = new Uint8Array(length); 70360 } else if (bpc <= 16) { 70361 output = new Uint16Array(length); 70362 } else { 70363 output = new Uint32Array(length); 70364 } 70365 70366 var rowComps = width * numComps; 70367 var max = (1 << bpc) - 1; 70368 var i = 0, 70369 ii, 70370 buf; 70371 70372 if (bpc === 1) { 70373 var mask, loop1End, loop2End; 70374 70375 for (var j = 0; j < height; j++) { 70376 loop1End = i + (rowComps & ~7); 70377 loop2End = i + rowComps; 70378 70379 while (i < loop1End) { 70380 buf = buffer[bufferPos++]; 70381 output[i] = buf >> 7 & 1; 70382 output[i + 1] = buf >> 6 & 1; 70383 output[i + 2] = buf >> 5 & 1; 70384 output[i + 3] = buf >> 4 & 1; 70385 output[i + 4] = buf >> 3 & 1; 70386 output[i + 5] = buf >> 2 & 1; 70387 output[i + 6] = buf >> 1 & 1; 70388 output[i + 7] = buf & 1; 70389 i += 8; 70390 } 70391 70392 if (i < loop2End) { 70393 buf = buffer[bufferPos++]; 70394 mask = 128; 70395 70396 while (i < loop2End) { 70397 output[i++] = +!!(buf & mask); 70398 mask >>= 1; 70399 } 70400 } 70401 } 70402 } else { 70403 var bits = 0; 70404 buf = 0; 70405 70406 for (i = 0, ii = length; i < ii; ++i) { 70407 if (i % rowComps === 0) { 70408 buf = 0; 70409 bits = 0; 70410 } 70411 70412 while (bits < bpc) { 70413 buf = buf << 8 | buffer[bufferPos++]; 70414 bits += 8; 70415 } 70416 70417 var remainingBits = bits - bpc; 70418 let value = buf >> remainingBits; 70419 70420 if (value < 0) { 70421 value = 0; 70422 } else if (value > max) { 70423 value = max; 70424 } 70425 70426 output[i] = value; 70427 buf = buf & (1 << remainingBits) - 1; 70428 bits = remainingBits; 70429 } 70430 } 70431 70432 return output; 70433 }, 70434 70435 fillOpacity(rgbaBuf, width, height, actualHeight, image) { 70436 var smask = this.smask; 70437 var mask = this.mask; 70438 var alphaBuf, sw, sh, i, ii, j; 70439 70440 if (smask) { 70441 sw = smask.width; 70442 sh = smask.height; 70443 alphaBuf = new Uint8ClampedArray(sw * sh); 70444 smask.fillGrayBuffer(alphaBuf); 70445 70446 if (sw !== width || sh !== height) { 70447 alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height); 70448 } 70449 } else if (mask) { 70450 if (mask instanceof PDFImage) { 70451 sw = mask.width; 70452 sh = mask.height; 70453 alphaBuf = new Uint8ClampedArray(sw * sh); 70454 mask.numComps = 1; 70455 mask.fillGrayBuffer(alphaBuf); 70456 70457 for (i = 0, ii = sw * sh; i < ii; ++i) { 70458 alphaBuf[i] = 255 - alphaBuf[i]; 70459 } 70460 70461 if (sw !== width || sh !== height) { 70462 alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height); 70463 } 70464 } else if (Array.isArray(mask)) { 70465 alphaBuf = new Uint8ClampedArray(width * height); 70466 var numComps = this.numComps; 70467 70468 for (i = 0, ii = width * height; i < ii; ++i) { 70469 var opacity = 0; 70470 var imageOffset = i * numComps; 70471 70472 for (j = 0; j < numComps; ++j) { 70473 var color = image[imageOffset + j]; 70474 var maskOffset = j * 2; 70475 70476 if (color < mask[maskOffset] || color > mask[maskOffset + 1]) { 70477 opacity = 255; 70478 break; 70479 } 70480 } 70481 70482 alphaBuf[i] = opacity; 70483 } 70484 } else { 70485 throw new _util.FormatError("Unknown mask format."); 70486 } 70487 } 70488 70489 if (alphaBuf) { 70490 for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) { 70491 rgbaBuf[j] = alphaBuf[i]; 70492 } 70493 } else { 70494 for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) { 70495 rgbaBuf[j] = 255; 70496 } 70497 } 70498 }, 70499 70500 undoPreblend(buffer, width, height) { 70501 var matte = this.smask && this.smask.matte; 70502 70503 if (!matte) { 70504 return; 70505 } 70506 70507 var matteRgb = this.colorSpace.getRgb(matte, 0); 70508 var matteR = matteRgb[0]; 70509 var matteG = matteRgb[1]; 70510 var matteB = matteRgb[2]; 70511 var length = width * height * 4; 70512 70513 for (var i = 0; i < length; i += 4) { 70514 var alpha = buffer[i + 3]; 70515 70516 if (alpha === 0) { 70517 buffer[i] = 255; 70518 buffer[i + 1] = 255; 70519 buffer[i + 2] = 255; 70520 continue; 70521 } 70522 70523 var k = 255 / alpha; 70524 buffer[i] = (buffer[i] - matteR) * k + matteR; 70525 buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG; 70526 buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB; 70527 } 70528 }, 70529 70530 createImageData(forceRGBA = false) { 70531 var drawWidth = this.drawWidth; 70532 var drawHeight = this.drawHeight; 70533 var imgData = { 70534 width: drawWidth, 70535 height: drawHeight, 70536 kind: 0, 70537 data: null 70538 }; 70539 var numComps = this.numComps; 70540 var originalWidth = this.width; 70541 var originalHeight = this.height; 70542 var bpc = this.bpc; 70543 var rowBytes = originalWidth * numComps * bpc + 7 >> 3; 70544 var imgArray; 70545 70546 if (!forceRGBA) { 70547 var kind; 70548 70549 if (this.colorSpace.name === "DeviceGray" && bpc === 1) { 70550 kind = _util.ImageKind.GRAYSCALE_1BPP; 70551 } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) { 70552 kind = _util.ImageKind.RGB_24BPP; 70553 } 70554 70555 if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) { 70556 imgData.kind = kind; 70557 imgArray = this.getImageBytes(originalHeight * rowBytes); 70558 70559 if (this.image instanceof _stream.DecodeStream) { 70560 imgData.data = imgArray; 70561 } else { 70562 var newArray = new Uint8ClampedArray(imgArray.length); 70563 newArray.set(imgArray); 70564 imgData.data = newArray; 70565 } 70566 70567 if (this.needsDecode) { 70568 (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale."); 70569 var buffer = imgData.data; 70570 70571 for (var i = 0, ii = buffer.length; i < ii; i++) { 70572 buffer[i] ^= 0xff; 70573 } 70574 } 70575 70576 return imgData; 70577 } 70578 70579 if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask) { 70580 let imageLength = originalHeight * rowBytes; 70581 70582 switch (this.colorSpace.name) { 70583 case "DeviceGray": 70584 imageLength *= 3; 70585 70586 case "DeviceRGB": 70587 case "DeviceCMYK": 70588 imgData.kind = _util.ImageKind.RGB_24BPP; 70589 imgData.data = this.getImageBytes(imageLength, drawWidth, drawHeight, true); 70590 return imgData; 70591 } 70592 } 70593 } 70594 70595 imgArray = this.getImageBytes(originalHeight * rowBytes); 70596 var actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight; 70597 var comps = this.getComponents(imgArray); 70598 var alpha01, maybeUndoPreblend; 70599 70600 if (!forceRGBA && !this.smask && !this.mask) { 70601 imgData.kind = _util.ImageKind.RGB_24BPP; 70602 imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 3); 70603 alpha01 = 0; 70604 maybeUndoPreblend = false;
70605 } else { 70606 imgData.kind = _util.ImageKind.RGBA_32BPP; 70607 imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 4); 70608 alpha01 = 1; 70609 maybeUndoPreblend = true; 70610 this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps); 70611 } 70612 70613 if (this.needsDecode) { 70614 this.decodeBuffer(comps); 70615 } 70616 70617 this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01); 70618 70619 if (maybeUndoPreblend) { 70620 this.undoPreblend(imgData.data, drawWidth, actualHeight); 70621 } 70622 70623 return imgData; 70624 }, 70625 70626 fillGrayBuffer(buffer) { 70627 var numComps = this.numComps; 70628 70629 if (numComps !== 1) { 70630 throw new _util.FormatError(`Reading gray scale from a color image: ${numComps}`); 70631 } 70632 70633 var width = this.width; 70634 var height = this.height; 70635 var bpc = this.bpc; 70636 var rowBytes = width * numComps * bpc + 7 >> 3; 70637 var imgArray = this.getImageBytes(height * rowBytes); 70638 var comps = this.getComponents(imgArray); 70639 var i, length; 70640 70641 if (bpc === 1) { 70642 length = width * height; 70643 70644 if (this.needsDecode) { 70645 for (i = 0; i < length; ++i) { 70646 buffer[i] = comps[i] - 1 & 255; 70647 } 70648 } else { 70649 for (i = 0; i < length; ++i) { 70650 buffer[i] = -comps[i] & 255; 70651 } 70652 } 70653 70654 return; 70655 } 70656 70657 if (this.needsDecode) { 70658 this.decodeBuffer(comps); 70659 } 70660 70661 length = width * height; 70662 var scale = 255 / ((1 << bpc) - 1); 70663 70664 for (i = 0; i < length; ++i) { 70665 buffer[i] = scale * comps[i]; 70666 } 70667 }, 70668 70669 getImageBytes(length, drawWidth, drawHeight, forceRGB = false) { 70670 this.image.reset(); 70671 this.image.drawWidth = drawWidth || this.width; 70672 this.image.drawHeight = drawHeight || this.height; 70673 this.image.forceRGB = !!forceRGB; 70674 return this.image.getBytes(length, true); 70675 } 70676 70677 }; 70678 return PDFImage; 70679}(); 70680 70681exports.PDFImage = PDFImage; 70682 70683/***/ }), 70684/* 44 */ 70685/***/ (function(module, exports, __w_pdfjs_require__) { 70686 70687"use strict"; 70688 70689 70690Object.defineProperty(exports, "__esModule", { 70691 value: true 70692}); 70693exports.isNodeJS = void 0; 70694const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions["nw"] && !process.versions["electron"]; 70695exports.isNodeJS = isNodeJS; 70696 70697/***/ }), 70698/* 45 */ 70699/***/ (function(module, exports, __w_pdfjs_require__) { 70700 70701"use strict"; 70702 70703 70704Object.defineProperty(exports, "__esModule", { 70705 value: true 70706}); 70707exports.MessageHandler = void 0; 70708 70709var _util = __w_pdfjs_require__(2); 70710 70711const CallbackKind = { 70712 UNKNOWN: 0, 70713 DATA: 1, 70714 ERROR: 2 70715}; 70716const StreamKind = { 70717 UNKNOWN: 0, 70718 CANCEL: 1, 70719 CANCEL_COMPLETE: 2, 70720 CLOSE: 3, 70721 ENQUEUE: 4, 70722 ERROR: 5, 70723 PULL: 6, 70724 PULL_COMPLETE: 7, 70725 START_COMPLETE: 8 70726}; 70727 70728function wrapReason(reason) { 70729 if (typeof reason !== "object" || reason === null) { 70730 return reason; 70731 } 70732 70733 switch (reason.name) { 70734 case "AbortException": 70735 return new _util.AbortException(reason.message); 70736 70737 case "MissingPDFException": 70738 return new _util.MissingPDFException(reason.message); 70739 70740 case "UnexpectedResponseException": 70741 return new _util.UnexpectedResponseException(reason.message, reason.status); 70742 70743 case "UnknownErrorException": 70744 return new _util.UnknownErrorException(reason.message, reason.details); 70745 70746 default: 70747 return new _util.UnknownErrorException(reason.message, reason.toString()); 70748 } 70749} 70750 70751class MessageHandler { 70752 constructor(sourceName, targetName, comObj) { 70753 this.sourceName = sourceName; 70754 this.targetName = targetName; 70755 this.comObj = comObj; 70756 this.callbackId = 1; 70757 this.streamId = 1; 70758 this.postMessageTransfers = true; 70759 this.streamSinks = Object.create(null); 70760 this.streamControllers = Object.create(null); 70761 this.callbackCapabilities = Object.create(null); 70762 this.actionHandler = Object.create(null); 70763 70764 this._onComObjOnMessage = event => { 70765 const data = event.data; 70766 70767 if (data.targetName !== this.sourceName) { 70768 return; 70769 } 70770 70771 if (data.stream) { 70772 this._processStreamMessage(data); 70773 70774 return; 70775 } 70776 70777 if (data.callback) { 70778 const callbackId = data.callbackId; 70779 const capability = this.callbackCapabilities[callbackId]; 70780 70781 if (!capability) { 70782 throw new Error(`Cannot resolve callback ${callbackId}`); 70783 } 70784 70785 delete this.callbackCapabilities[callbackId]; 70786 70787 if (data.callback === CallbackKind.DATA) { 70788 capability.resolve(data.data); 70789 } else if (data.callback === CallbackKind.ERROR) { 70790 capability.reject(wrapReason(data.reason)); 70791 } else { 70792 throw new Error("Unexpected callback case"); 70793 } 70794 70795 return; 70796 } 70797 70798 const action = this.actionHandler[data.action]; 70799 70800 if (!action) { 70801 throw new Error(`Unknown action from worker: ${data.action}`); 70802 } 70803 70804 if (data.callbackId) { 70805 const sourceName = this.sourceName; 70806 const targetName = data.sourceName; 70807 new Promise(function (resolve) { 70808 resolve(action(data.data)); 70809 }).then(function (result) { 70810 comObj.postMessage({ 70811 sourceName, 70812 targetName, 70813 callback: CallbackKind.DATA, 70814 callbackId: data.callbackId, 70815 data: result 70816 }); 70817 }, function (reason) { 70818 comObj.postMessage({ 70819 sourceName, 70820 targetName, 70821 callback: CallbackKind.ERROR, 70822 callbackId: data.callbackId, 70823 reason: wrapReason(reason) 70824 }); 70825 }); 70826 return; 70827 } 70828 70829 if (data.streamId) { 70830 this._createStreamSink(data); 70831 70832 return; 70833 } 70834 70835 action(data.data); 70836 }; 70837 70838 comObj.addEventListener("message", this._onComObjOnMessage); 70839 } 70840 70841 on(actionName, handler) { 70842 const ah = this.actionHandler; 70843 70844 if (ah[actionName]) { 70845 throw new Error(`There is already an actionName called "${actionName}"`); 70846 } 70847 70848 ah[actionName] = handler; 70849 } 70850 70851 send(actionName, data, transfers) { 70852 this._postMessage({ 70853 sourceName: this.sourceName, 70854 targetName: this.targetName, 70855 action: actionName, 70856 data 70857 }, transfers); 70858 } 70859
70860 sendWithPromise(actionName, data, transfers) { 70861 const callbackId = this.callbackId++; 70862 const capability = (0, _util.createPromiseCapability)(); 70863 this.callbackCapabilities[callbackId] = capability; 70864 70865 try { 70866 this._postMessage({ 70867 sourceName: this.sourceName, 70868 targetName: this.targetName, 70869 action: actionName, 70870 callbackId, 70871 data 70872 }, transfers); 70873 } catch (ex) { 70874 capability.reject(ex); 70875 } 70876 70877 return capability.promise; 70878 } 70879 70880 sendWithStream(actionName, data, queueingStrategy, transfers) { 70881 const streamId = this.streamId++; 70882 const sourceName = this.sourceName; 70883 const targetName = this.targetName; 70884 const comObj = this.comObj; 70885 return new ReadableStream({ 70886 start: controller => { 70887 const startCapability = (0, _util.createPromiseCapability)(); 70888 this.streamControllers[streamId] = { 70889 controller, 70890 startCall: startCapability, 70891 pullCall: null, 70892 cancelCall: null, 70893 isClosed: false 70894 }; 70895 70896 this._postMessage({ 70897 sourceName, 70898 targetName, 70899 action: actionName, 70900 streamId, 70901 data, 70902 desiredSize: controller.desiredSize 70903 }, transfers); 70904 70905 return startCapability.promise; 70906 }, 70907 pull: controller => { 70908 const pullCapability = (0, _util.createPromiseCapability)(); 70909 this.streamControllers[streamId].pullCall = pullCapability; 70910 comObj.postMessage({ 70911 sourceName, 70912 targetName, 70913 stream: StreamKind.PULL, 70914 streamId, 70915 desiredSize: controller.desiredSize 70916 }); 70917 return pullCapability.promise; 70918 }, 70919 cancel: reason => { 70920 (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason"); 70921 const cancelCapability = (0, _util.createPromiseCapability)(); 70922 this.streamControllers[streamId].cancelCall = cancelCapability; 70923 this.streamControllers[streamId].isClosed = true; 70924 comObj.postMessage({ 70925 sourceName, 70926 targetName, 70927 stream: StreamKind.CANCEL, 70928 streamId, 70929 reason: wrapReason(reason) 70930 }); 70931 return cancelCapability.promise; 70932 } 70933 }, queueingStrategy); 70934 } 70935 70936 _createStreamSink(data) { 70937 const self = this; 70938 const action = this.actionHandler[data.action]; 70939 const streamId = data.streamId; 70940 const sourceName = this.sourceName; 70941 const targetName = data.sourceName; 70942 const comObj = this.comObj; 70943 const streamSink = { 70944 enqueue(chunk, size = 1, transfers) { 70945 if (this.isCancelled) { 70946 return; 70947 } 70948 70949 const lastDesiredSize = this.desiredSize; 70950 this.desiredSize -= size; 70951 70952 if (lastDesiredSize > 0 && this.desiredSize <= 0) { 70953 this.sinkCapability = (0, _util.createPromiseCapability)(); 70954 this.ready = this.sinkCapability.promise; 70955 } 70956 70957 self._postMessage({ 70958 sourceName, 70959 targetName, 70960 stream: StreamKind.ENQUEUE, 70961 streamId, 70962 chunk 70963 }, transfers); 70964 }, 70965 70966 close() { 70967 if (this.isCancelled) { 70968 return; 70969 } 70970 70971 this.isCancelled = true; 70972 comObj.postMessage({ 70973 sourceName, 70974 targetName, 70975 stream: StreamKind.CLOSE, 70976 streamId 70977 }); 70978 delete self.streamSinks[streamId]; 70979 }, 70980 70981 error(reason) { 70982 (0, _util.assert)(reason instanceof Error, "error must have a valid reason"); 70983 70984 if (this.isCancelled) { 70985 return; 70986 } 70987 70988 this.isCancelled = true; 70989 comObj.postMessage({ 70990 sourceName, 70991 targetName, 70992 stream: StreamKind.ERROR, 70993 streamId, 70994 reason: wrapReason(reason) 70995 }); 70996 }, 70997 70998 sinkCapability: (0, _util.createPromiseCapability)(), 70999 onPull: null, 71000 onCancel: null, 71001 isCancelled: false, 71002 desiredSize: data.desiredSize, 71003 ready: null 71004 }; 71005 streamSink.sinkCapability.resolve(); 71006 streamSink.ready = streamSink.sinkCapability.promise; 71007 this.streamSinks[streamId] = streamSink; 71008 new Promise(function (resolve) { 71009 resolve(action(data.data, streamSink)); 71010 }).then(function () { 71011 comObj.postMessage({ 71012 sourceName, 71013 targetName, 71014 stream: StreamKind.START_COMPLETE, 71015 streamId, 71016 success: true 71017 }); 71018 }, function (reason) { 71019 comObj.postMessage({ 71020 sourceName, 71021 targetName, 71022 stream: StreamKind.START_COMPLETE, 71023 streamId, 71024 reason: wrapReason(reason) 71025 }); 71026 }); 71027 } 71028 71029 _processStreamMessage(data) { 71030 const streamId = data.streamId; 71031 const sourceName = this.sourceName; 71032 const targetName = data.sourceName; 71033 const comObj = this.comObj; 71034 71035 switch (data.stream) { 71036 case StreamKind.START_COMPLETE: 71037 if (data.success) { 71038 this.streamControllers[streamId].startCall.resolve(); 71039 } else { 71040 this.streamControllers[streamId].startCall.reject(wrapReason(data.reason)); 71041 } 71042 71043 break; 71044 71045 case StreamKind.PULL_COMPLETE: 71046 if (data.success) { 71047 this.streamControllers[streamId].pullCall.resolve(); 71048 } else { 71049 this.streamControllers[streamId].pullCall.reject(wrapReason(data.reason)); 71050 } 71051 71052 break; 71053 71054 case StreamKind.PULL: 71055 if (!this.streamSinks[streamId]) { 71056 comObj.postMessage({ 71057 sourceName, 71058 targetName, 71059 stream: StreamKind.PULL_COMPLETE, 71060 streamId, 71061 success: true 71062 }); 71063 break; 71064 } 71065 71066 if (this.streamSinks[streamId].desiredSize <= 0 && data.desiredSize > 0) { 71067 this.streamSinks[streamId].sinkCapability.resolve(); 71068 } 71069 71070 this.streamSinks[streamId].desiredSize = data.desiredSize; 71071 const { 71072 onPull 71073 } = this.streamSinks[data.streamId]; 71074 new Promise(function (resolve) { 71075 resolve(onPull && onPull()); 71076 }).then(function () { 71077 comObj.postMessage({ 71078 sourceName, 71079 targetName, 71080 stream: StreamKind.PULL_COMPLETE, 71081 streamId, 71082 success: true 71083 }); 71084 }, function (reason) { 71085 comObj.postMessage({ 71086 sourceName, 71087 targetName, 71088 stream: StreamKind.PULL_COMPLETE, 71089 streamId, 71090 reason: wrapReason(reason) 71091 }); 71092 }); 71093 break; 71094 71095 case StreamKind.ENQUEUE: 71096 (0, _util.assert)(this.streamControllers[streamId], "enqueue should have stream controller"); 71097 71098 if (this.streamControllers[streamId].isClosed) { 71099 break; 71100 } 71101 71102 this.streamControllers[streamId].controller.enqueue(data.chunk); 71103 break; 71104 71105 case StreamKind.CLOSE: 71106 (0, _util.assert)(this.streamControllers[streamId], "close should have stream controller"); 71107 71108 if (this.streamControllers[streamId].isClosed) { 71109 break; 71110 } 71111 71112 this.streamControllers[streamId].isClosed = true; 71113 this.streamControllers[streamId].controller.close(); 71114 71115 this._deleteStreamController(streamId); 71116 71117 break; 71118 71119 case StreamKind.ERROR: 71120 (0, _util.assert)(this.streamControllers[streamId], "error should have stream controller"); 71121 this.streamControllers[streamId].controller.error(wrapReason(data.reason)); 71122 71123 this._deleteStreamController(streamId); 71124 71125 break; 71126 71127 case StreamKind.CANCEL_COMPLETE: 71128 if (data.success) { 71129 this.streamControllers[streamId].cancelCall.resolve(); 71130 } else { 71131 this.streamControllers[streamId].cancelCall.reject(wrapReason(data.reason)); 71132 } 71133 71134 this._deleteStreamController(streamId); 71135 71136 break; 71137 71138 case StreamKind.CANCEL: 71139 if (!this.streamSinks[streamId]) { 71140 break; 71141 } 71142 71143 const { 71144 onCancel 71145 } = this.streamSinks[data.streamId]; 71146 new Promise(function (resolve) { 71147 resolve(onCancel && onCancel(wrapReason(data.reason))); 71148 }).then(function () { 71149 comObj.postMessage({ 71150 sourceName, 71151 targetName, 71152 stream: StreamKind.CANCEL_COMPLETE, 71153 streamId, 71154 success: true 71155 }); 71156 }, function (reason) { 71157 comObj.postMessage({ 71158 sourceName, 71159 targetName, 71160 stream: StreamKind.CANCEL_COMPLETE, 71161 streamId, 71162 reason: wrapReason(reason) 71163 }); 71164 }); 71165 this.streamSinks[streamId].sinkCapability.reject(wrapReason(data.reason)); 71166 this.streamSinks[streamId].isCancelled = true; 71167 delete this.streamSinks[streamId]; 71168 break; 71169 71170 default: 71171 throw new Error("Unexpected stream case"); 71172 } 71173 } 71174 71175 async _deleteStreamController(streamId) { 71176 await Promise.allSettled([this.streamControllers[streamId].startCall, this.streamControllers[streamId].pullCall, this.streamControllers[streamId].cancelCall].map(function (capability) { 71177 return capability && capability.promise; 71178 })); 71179 delete this.streamControllers[streamId]; 71180 } 71181 71182 _postMessage(message, transfers) { 71183 if (transfers && this.postMessageTransfers) { 71184 this.comObj.postMessage(message, transfers); 71185 } else { 71186 this.comObj.postMessage(message); 71187 } 71188 } 71189 71190 destroy() { 71191 this.comObj.removeEventListener("message", this._onComObjOnMessage); 71192 } 71193 71194} 71195 71196exports.MessageHandler = MessageHandler; 71197 71198/***/ }), 71199/* 46 */ 71200/***/ (function(module, exports, __w_pdfjs_require__) { 71201 71202"use strict"; 71203 71204 71205Object.defineProperty(exports, "__esModule", { 71206 value: true 71207}); 71208exports.PDFWorkerStream = void 0; 71209 71210var _util = __w_pdfjs_require__(2); 71211 71212class PDFWorkerStream { 71213 constructor(msgHandler) { 71214 this._msgHandler = msgHandler; 71215 this._contentLength = null; 71216 this._fullRequestReader = null; 71217 this._rangeRequestReaders = []; 71218 } 71219 71220 getFullReader() { 71221 (0, _util.assert)(!this._fullRequestReader); 71222 this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler); 71223 return this._fullRequestReader; 71224 } 71225 71226 getRangeReader(begin, end) { 71227 const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler); 71228 71229 this._rangeRequestReaders.push(reader); 71230 71231 return reader; 71232 } 71233 71234 cancelAllRequests(reason) { 71235 if (this._fullRequestReader) { 71236 this._fullRequestReader.cancel(reason); 71237 } 71238 71239 const readers = this._rangeRequestReaders.slice(0); 71240
71241 readers.forEach(function (reader) { 71242 reader.cancel(reason); 71243 }); 71244 } 71245 71246} 71247 71248exports.PDFWorkerStream = PDFWorkerStream; 71249 71250class PDFWorkerStreamReader { 71251 constructor(msgHandler) { 71252 this._msgHandler = msgHandler; 71253 this.onProgress = null; 71254 this._contentLength = null; 71255 this._isRangeSupported = false; 71256 this._isStreamingSupported = false; 71257 71258 const readableStream = this._msgHandler.sendWithStream("GetReader"); 71259 71260 this._reader = readableStream.getReader(); 71261 this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => { 71262 this._isStreamingSupported = data.isStreamingSupported; 71263 this._isRangeSupported = data.isRangeSupported; 71264 this._contentLength = data.contentLength; 71265 }); 71266 } 71267 71268 get headersReady() { 71269 return this._headersReady; 71270 } 71271 71272 get contentLength() { 71273 return this._contentLength; 71274 } 71275 71276 get isStreamingSupported() { 71277 return this._isStreamingSupported; 71278 } 71279 71280 get isRangeSupported() { 71281 return this._isRangeSupported; 71282 } 71283 71284 async read() { 71285 const { 71286 value, 71287 done 71288 } = await this._reader.read(); 71289 71290 if (done) { 71291 return { 71292 value: undefined, 71293 done: true 71294 }; 71295 } 71296 71297 return { 71298 value: value.buffer, 71299 done: false 71300 }; 71301 } 71302 71303 cancel(reason) { 71304 this._reader.cancel(reason); 71305 } 71306 71307} 71308 71309class PDFWorkerStreamRangeReader { 71310 constructor(begin, end, msgHandler) { 71311 this._msgHandler = msgHandler; 71312 this.onProgress = null; 71313 71314 const readableStream = this._msgHandler.sendWithStream("GetRangeReader", { 71315 begin, 71316 end 71317 }); 71318 71319 this._reader = readableStream.getReader(); 71320 } 71321 71322 get isStreamingSupported() { 71323 return false; 71324 } 71325 71326 async read() { 71327 const { 71328 value, 71329 done 71330 } = await this._reader.read(); 71331 71332 if (done) { 71333 return { 71334 value: undefined, 71335 done: true 71336 }; 71337 } 71338 71339 return { 71340 value: value.buffer, 71341 done: false 71342 }; 71343 } 71344 71345 cancel(reason) { 71346 this._reader.cancel(reason); 71347 } 71348 71349} 71350 71351/***/ }) 71352/******/ ]); 71353}); 71354//# sourceMappingURL=pdf.worker.js.map 71355; 71356(function() { 71357 var PiwikService; 71358 71359 PiwikService = (function() { 71360 function PiwikService(imprint_code) { 71361 this.imprint_code = imprint_code.concat('_'); 71362 } 71363 71364 PiwikService.prototype.trackEvent = function(category, action, name) { 71365 if (typeof _paq !== 'undefined') { 71366 return _paq.push(['trackEvent', this.imprint_code.concat(category), this.imprint_code.concat(action), this.imprint_code.concat(name)]); 71367 } 71368 }; 71369 71370 return PiwikService; 71371 71372 })(); 71373 71374 window.PiwikService = PiwikService; 71375 71376}).call(this); 71377 71378 71379 71380
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.